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--.cvsignore17
-rw-r--r--AUTHORS2
-rw-r--r--COPYING.LIB485
-rw-r--r--ChangeLog390
-rw-r--r--Makefile.am4
-rw-r--r--NEWS20
-rw-r--r--README53
-rw-r--r--acconfig.h15
-rwxr-xr-xautogen.sh120
-rw-r--r--config.h.in42
-rw-r--r--configure.in484
-rw-r--r--doc/.cvsignore4
-rw-r--r--doc/Makefile.am32
-rw-r--r--doc/README17
-rw-r--r--doc/ado-net44
-rw-r--r--doc/anoncvs70
-rwxr-xr-xdoc/asp-net11
-rw-r--r--doc/books37
-rw-r--r--doc/c-sharp223
-rw-r--r--doc/ccvs138
-rw-r--r--doc/class-library190
-rw-r--r--doc/class-status.in26
-rw-r--r--doc/classlib-doc105
-rw-r--r--doc/contact13
-rw-r--r--doc/contributing189
-rw-r--r--doc/devel-faq190
-rw-r--r--doc/documentation62
-rw-r--r--doc/download352
-rw-r--r--doc/faq698
-rw-r--r--doc/gcc-frontend9
-rw-r--r--doc/ideas112
-rw-r--r--doc/index1016
-rwxr-xr-xdoc/java52
-rw-r--r--doc/jit-debug181
-rw-r--r--doc/jit-debug-sample86
-rw-r--r--doc/jit-debug-sample270
-rwxr-xr-xdoc/languages19
-rw-r--r--doc/mailing-lists90
-rwxr-xr-xdoc/mono-build-w32.sh142
-rwxr-xr-xdoc/mono-build.sh183
-rw-r--r--doc/monodoc-xml755
-rw-r--r--doc/papers96
-rw-r--r--doc/passport293
-rw-r--r--doc/pending14
-rw-r--r--doc/pending-classes.in246
-rwxr-xr-xdoc/plans15
-rw-r--r--doc/porting63
-rw-r--r--doc/rationale173
-rw-r--r--doc/release-notes/mono-0.346
-rw-r--r--doc/release-notes/mono-0.443
-rw-r--r--doc/resources188
-rw-r--r--doc/resources-pending30
-rw-r--r--doc/roadmap12
-rw-r--r--doc/runtime195
-rw-r--r--doc/status40
-rw-r--r--doc/team2
-rw-r--r--doc/testing46
-rw-r--r--doc/thanks6
-rw-r--r--doc/todo1
-rw-r--r--doc/tools67
-rw-r--r--doc/web/.cvsignore2
-rw-r--r--doc/web/commands40
-rwxr-xr-xdoc/web/deploy/.cvsignore1
-rw-r--r--doc/web/deploy/cm/c.gifbin0 -> 150 bytes
-rw-r--r--doc/web/deploy/cm/cormissing.css182
-rw-r--r--doc/web/deploy/cm/cormissing.js392
-rw-r--r--doc/web/deploy/cm/d.gifbin0 -> 137 bytes
-rw-r--r--doc/web/deploy/cm/e.gifbin0 -> 861 bytes
-rw-r--r--doc/web/deploy/cm/en.gifbin0 -> 111 bytes
-rw-r--r--doc/web/deploy/cm/f.gifbin0 -> 90 bytes
-rw-r--r--doc/web/deploy/cm/i.gifbin0 -> 90 bytes
-rw-r--r--doc/web/deploy/cm/m.gifbin0 -> 101 bytes
-rw-r--r--doc/web/deploy/cm/n.gifbin0 -> 65 bytes
-rw-r--r--doc/web/deploy/cm/p.gifbin0 -> 111 bytes
-rw-r--r--doc/web/deploy/cm/r.gifbin0 -> 73 bytes
-rw-r--r--doc/web/deploy/cm/s.gifbin0 -> 127 bytes
-rw-r--r--doc/web/deploy/cm/sc.gifbin0 -> 70 bytes
-rw-r--r--doc/web/deploy/cm/se.gifbin0 -> 73 bytes
-rw-r--r--doc/web/deploy/cm/sm.gifbin0 -> 76 bytes
-rw-r--r--doc/web/deploy/cm/st.gifbin0 -> 101 bytes
-rw-r--r--doc/web/deploy/cm/sx.gifbin0 -> 73 bytes
-rw-r--r--doc/web/deploy/cm/tb.gifbin0 -> 49 bytes
-rw-r--r--doc/web/deploy/cm/tm.gifbin0 -> 64 bytes
-rw-r--r--doc/web/deploy/cm/tp.gifbin0 -> 67 bytes
-rw-r--r--doc/web/deploy/cm/y.gifbin0 -> 92 bytes
-rw-r--r--doc/web/deploy/images/bgsquares.gifbin0 -> 4963 bytes
-rw-r--r--doc/web/deploy/images/bgsquares.pngbin0 -> 4643 bytes
-rw-r--r--doc/web/deploy/images/bgsquares.xcf.gzbin0 -> 2775 bytes
-rw-r--r--doc/web/deploy/images/mono.gifbin0 -> 3079 bytes
-rw-r--r--doc/web/deploy/images/mono.pngbin0 -> 4495 bytes
-rw-r--r--doc/web/deploy/images/pixel.gifbin0 -> 49 bytes
-rw-r--r--doc/web/deploy/images/pixel.pngbin0 -> 156 bytes
-rw-r--r--doc/web/htmlify28
-rw-r--r--doc/web/icaza.pl76
-rw-r--r--doc/web/images/bgsquares.gifbin0 -> 4963 bytes
-rw-r--r--doc/web/images/bgsquares.pngbin0 -> 4644 bytes
-rw-r--r--doc/web/images/bgsquares.xcf.gzbin0 -> 2775 bytes
-rw-r--r--doc/web/images/mono.gifbin0 -> 3079 bytes
-rw-r--r--doc/web/images/mono.pngbin0 -> 4496 bytes
-rw-r--r--doc/web/images/pixel.gifbin0 -> 49 bytes
-rw-r--r--doc/web/images/pixel.pngbin0 -> 157 bytes
-rw-r--r--doc/web/makefile100
-rwxr-xr-xdoc/web/process.pl89
-rwxr-xr-xdoc/web/src/.cvsignore1
-rw-r--r--doc/web/template.html.in85
-rw-r--r--doc/winforms90
-rw-r--r--docs/Makefile.am3
-rw-r--r--docs/exceptions70
-rw-r--r--docs/gc-issues31
-rw-r--r--docs/internal-calls59
-rw-r--r--docs/jit-thoughts125
-rw-r--r--docs/jit-trampolines52
-rw-r--r--docs/object-layout63
-rw-r--r--docs/stack-alignment33
-rw-r--r--docs/unmanaged-calls135
-rw-r--r--man/.cvsignore2
-rw-r--r--man/Makefile.am4
-rwxr-xr-xman/mcs.1155
-rw-r--r--man/mono.185
-rw-r--r--man/monostyle.143
-rwxr-xr-xmcs/AUTHORS15
-rw-r--r--mcs/ChangeLog21
-rwxr-xr-xmcs/README23
-rw-r--r--mcs/class/.cvsignore1
-rw-r--r--mcs/class/Mono.CSharp.Debugger/AssemblerWriterI386.cs306
-rw-r--r--mcs/class/Mono.CSharp.Debugger/ChangeLog125
-rw-r--r--mcs/class/Mono.CSharp.Debugger/IAssemblerWriter.cs70
-rw-r--r--mcs/class/Mono.CSharp.Debugger/IMonoSymbolWriter.cs167
-rw-r--r--mcs/class/Mono.CSharp.Debugger/Mono.CSharp.Debugger.build24
-rwxr-xr-xmcs/class/Mono.CSharp.Debugger/MonoDwarfFileWriter.cs2257
-rw-r--r--mcs/class/Mono.CSharp.Debugger/MonoSymbolDocumentWriter.cs60
-rwxr-xr-xmcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs717
-rw-r--r--mcs/class/Mono.CSharp.Debugger/README43
-rw-r--r--mcs/class/Mono.CSharp.Debugger/README.relocation-table100
-rw-r--r--mcs/class/Mono.CSharp.Debugger/gdb-variable-scopes.patch175
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs76
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs51
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs380
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs103
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs528
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs231
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs263
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlError.cs155
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs114
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlException.cs202
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs50
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs19
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameter.cs196
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs231
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs38
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs18
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs42
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs18
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs191
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresLibrary.cs471
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs76
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs51
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs380
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs103
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlConnection.cs528
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs231
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs263
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlError.cs155
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs114
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlException.cs202
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs50
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs19
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlParameter.cs196
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs231
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs38
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs18
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs42
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs18
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs191
-rw-r--r--mcs/class/Mono.Data.PostgreSqlClient/PostgresLibrary.cs471
-rw-r--r--mcs/class/README277
-rw-r--r--mcs/class/System.Data/ChangeLog330
-rw-r--r--mcs/class/System.Data/System.Data.Common/DataAdapter.cs96
-rw-r--r--mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs58
-rw-r--r--mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs140
-rw-r--r--mcs/class/System.Data/System.Data.Common/DataTableMapping.cs65
-rw-r--r--mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs128
-rw-r--r--mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs160
-rw-r--r--mcs/class/System.Data/System.Data.Common/DbDataPermission.cs86
-rw-r--r--mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs36
-rw-r--r--mcs/class/System.Data/System.Data.Common/RowUpdatedEventArgs.cs64
-rw-r--r--mcs/class/System.Data/System.Data.Common/RowUpdatingEventArgs.cs58
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/PostgresLibrary.cs471
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs76
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlClientPermissionAttribute.cs51
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs380
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs103
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs528
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs231
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs263
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlError.cs155
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlErrorCollection.cs114
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlException.cs202
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventArgs.cs50
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventHandler.cs19
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs196
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs231
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs38
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs42
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs191
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/INullable.cs22
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlBinary.cs155
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlBoolean.cs300
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlCompareOptions.cs29
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlInt32.cs304
-rw-r--r--mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs344
-rw-r--r--mcs/class/System.Data/System.Data.build48
-rw-r--r--mcs/class/System.Data/System.Data/AcceptRejectRule.cs23
-rw-r--r--mcs/class/System.Data/System.Data/CommandBehavior.cs30
-rw-r--r--mcs/class/System.Data/System.Data/CommandType.cs25
-rw-r--r--mcs/class/System.Data/System.Data/ConnectionState.cs30
-rw-r--r--mcs/class/System.Data/System.Data/Constraint.cs59
-rw-r--r--mcs/class/System.Data/System.Data/ConstraintCollection.cs137
-rw-r--r--mcs/class/System.Data/System.Data/DataColumn.cs358
-rw-r--r--mcs/class/System.Data/System.Data/DataColumnChangeEventArgs.cs80
-rw-r--r--mcs/class/System.Data/System.Data/DataColumnChangeEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data/DataColumnCollection.cs413
-rw-r--r--mcs/class/System.Data/System.Data/DataRelationCollection.cs305
-rw-r--r--mcs/class/System.Data/System.Data/DataRow.cs247
-rw-r--r--mcs/class/System.Data/System.Data/DataRowAction.cs28
-rw-r--r--mcs/class/System.Data/System.Data/DataRowChangeEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data/DataRowState.cs26
-rw-r--r--mcs/class/System.Data/System.Data/DataRowVersion.cs23
-rw-r--r--mcs/class/System.Data/System.Data/DataSet.cs47
-rw-r--r--mcs/class/System.Data/System.Data/DataTable.cs729
-rw-r--r--mcs/class/System.Data/System.Data/DataTableRelationCollection.cs322
-rw-r--r--mcs/class/System.Data/System.Data/DataViewRowState.cs29
-rw-r--r--mcs/class/System.Data/System.Data/DbType.cs44
-rw-r--r--mcs/class/System.Data/System.Data/FillErrorEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data/IColumnMapping.cs35
-rw-r--r--mcs/class/System.Data/System.Data/IColumnMappingCollection.cs35
-rw-r--r--mcs/class/System.Data/System.Data/IDataAdapter.cs33
-rw-r--r--mcs/class/System.Data/System.Data/IDataParameter.cs36
-rw-r--r--mcs/class/System.Data/System.Data/IDataParameterCollection.cs28
-rw-r--r--mcs/class/System.Data/System.Data/IDataReader.cs33
-rw-r--r--mcs/class/System.Data/System.Data/IDataRecord.cs67
-rw-r--r--mcs/class/System.Data/System.Data/IDbCommand.cs51
-rw-r--r--mcs/class/System.Data/System.Data/IDbConnection.cs41
-rw-r--r--mcs/class/System.Data/System.Data/IDbDataAdapter.cs25
-rw-r--r--mcs/class/System.Data/System.Data/IDbDataParameter.cs25
-rw-r--r--mcs/class/System.Data/System.Data/IDbTransaction.cs27
-rw-r--r--mcs/class/System.Data/System.Data/ITableMapping.cs23
-rw-r--r--mcs/class/System.Data/System.Data/ITableMappingCollection.cs31
-rw-r--r--mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs86
-rw-r--r--mcs/class/System.Data/System.Data/IsolationLevel.cs27
-rw-r--r--mcs/class/System.Data/System.Data/MappingType.cs26
-rw-r--r--mcs/class/System.Data/System.Data/MergeFailedEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data/MissingMappingAction.cs24
-rw-r--r--mcs/class/System.Data/System.Data/MissingSchemaAction.cs25
-rw-r--r--mcs/class/System.Data/System.Data/ParameterDirection.cs25
-rw-r--r--mcs/class/System.Data/System.Data/PropertyAttributes.cs28
-rw-r--r--mcs/class/System.Data/System.Data/Rule.cs25
-rw-r--r--mcs/class/System.Data/System.Data/SchemaType.cs23
-rw-r--r--mcs/class/System.Data/System.Data/SqlDbType.cs45
-rw-r--r--mcs/class/System.Data/System.Data/StateChangeEventArgs.cs43
-rw-r--r--mcs/class/System.Data/System.Data/StateChangeEventHandler.cs18
-rw-r--r--mcs/class/System.Data/System.Data/StatementType.cs25
-rw-r--r--mcs/class/System.Data/System.Data/TODOAttribute.cs33
-rw-r--r--mcs/class/System.Data/System.Data/UpdateRowSource.cs25
-rw-r--r--mcs/class/System.Data/System.Data/UpdateStatus.cs25
-rw-r--r--mcs/class/System.Data/System.Data/XmlReadMode.cs27
-rw-r--r--mcs/class/System.Data/System.Data/XmlWriteMode.cs24
-rw-r--r--mcs/class/System.Data/TODO157
-rw-r--r--mcs/class/System.Data/Test/TestSqlException.cs116
-rw-r--r--mcs/class/System.Data/Test/TestSqlInsert.cs106
-rw-r--r--mcs/class/System.Data/Test/TestSqlIsolationLevel.cs105
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Design/UITypeEditorEditStyle.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog7
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/Enums.cs258
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs453
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs21
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Drawing2D/TODOAttribute.cs37
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog8
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs19
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs17
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs14
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs14
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs262
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs36
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs59
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs21
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs26
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs16
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs110
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs18
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs39
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/Duplex.cs16
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PaperKind.cs125
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceKind.cs26
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintRange.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolutionKind.cs17
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnit.cs16
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionLevel.cs16
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs15
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs18
-rw-r--r--mcs/class/System.Drawing/System.Drawing.build21
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing/Bitmap.cs277
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing/Brush.cs34
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ChangeLog33
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Color.cs1281
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ColorTranslator.cs95
-rw-r--r--mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs22
-rw-r--r--mcs/class/System.Drawing/System.Drawing/FontStyle.cs19
-rw-r--r--mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Image.cs199
-rw-r--r--mcs/class/System.Drawing/System.Drawing/KnownColor.cs182
-rwxr-xr-xmcs/class/System.Drawing/System.Drawing/Pen.cs113
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Point.cs339
-rw-r--r--mcs/class/System.Drawing/System.Drawing/PointF.cs204
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Rectangle.cs584
-rw-r--r--mcs/class/System.Drawing/System.Drawing/RectangleF.cs531
-rw-r--r--mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs29
-rw-r--r--mcs/class/System.Drawing/System.Drawing/Size.cs309
-rw-r--r--mcs/class/System.Drawing/System.Drawing/SizeF.cs249
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringAligment.cs17
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs18
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs23
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringTrimming.cs20
-rw-r--r--mcs/class/System.Drawing/System.Drawing/StringUnit.cs22
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/ChangeLog4
-rw-r--r--mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs159
-rw-r--r--mcs/class/System.Web/.cvsignore4
-rw-r--r--mcs/class/System.Web/ChangeLog66
-rw-r--r--mcs/class/System.Web/System.Web.Caching/Cache.cs520
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs53
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheDependency.cs97
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheEntry.cs363
-rw-r--r--mcs/class/System.Web/System.Web.Caching/CacheExpires.cs145
-rw-r--r--mcs/class/System.Web/System.Web.Caching/ChangeLog12
-rw-r--r--mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs253
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs19
-rw-r--r--mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs44
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs18
-rwxr-xr-xmcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs19
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs19
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs33
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/ChangeLog13
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs18
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs21
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs22
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs231
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog10
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs99
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs74
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs138
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs152
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs32
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs90
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs88
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs68
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs63
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs71
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs52
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs129
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs115
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs98
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs402
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs171
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs129
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs84
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs137
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs118
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore2
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs92
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs17
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs358
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs311
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs275
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs395
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs29
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs109
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/Button.cs169
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs186
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs21
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs1111
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs100
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs23
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog403
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs256
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs251
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs50
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs17
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs89
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs113
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs776
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs379
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs186
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs17
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs86
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs17
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs241
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs83
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DataList.cs824
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs93
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs16
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs23
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs43
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs17
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs156
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs109
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs27
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs253
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs63
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs30
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs211
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs81
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs23
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs24
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs158
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs221
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs27
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs29
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Image.cs118
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs29
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs181
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Label.cs94
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs27
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs208
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs31
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs55
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs221
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs331
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs252
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs366
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs36
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs27
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs68
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs16
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs22
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs470
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs21
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs22
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs97
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs27
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs31
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs142
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs227
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs125
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs93
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs267
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs283
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs46
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs72
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs83
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs37
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs60
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs120
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Style.cs542
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/TODO156
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Table.cs190
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs173
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs181
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs31
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs26
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs172
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs110
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs179
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs229
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs55
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs109
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs284
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs36
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs22
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs258
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs65
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs28
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs76
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs26
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs24
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs142
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs22
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs22
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs23
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs57
-rwxr-xr-xmcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs489
-rw-r--r--mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs203
-rw-r--r--mcs/class/System.Web/System.Web.UI/BuildMethod.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI/ChangeLog83
-rw-r--r--mcs/class/System.Web/System.Web.UI/Control.cs608
-rw-r--r--mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs49
-rw-r--r--mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs29
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs1028
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs54
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs28
-rw-r--r--mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs111
-rw-r--r--mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs20
-rw-r--r--mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs20
-rw-r--r--mcs/class/System.Web/System.Web.UI/INamingContainer.cs18
-rw-r--r--mcs/class/System.Web/System.Web.UI/IParserAccessor.cs19
-rw-r--r--mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs19
-rw-r--r--mcs/class/System.Web/System.Web.UI/IStateManager.cs22
-rw-r--r--mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs20
-rw-r--r--mcs/class/System.Web/System.Web.UI/ITemplate.cs19
-rw-r--r--mcs/class/System.Web/System.Web.UI/IValidator.cs21
-rw-r--r--mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web.UI/LiteralControl.cs39
-rw-r--r--mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs23
-rw-r--r--mcs/class/System.Web/System.Web.UI/Pair.cs36
-rw-r--r--mcs/class/System.Web/System.Web.UI/PersistanceMode.cs22
-rw-r--r--mcs/class/System.Web/System.Web.UI/PropertyConverter.cs124
-rw-r--r--mcs/class/System.Web/System.Web.UI/StateBag.cs278
-rw-r--r--mcs/class/System.Web/System.Web.UI/StateItem.cs47
-rw-r--r--mcs/class/System.Web/System.Web.UI/TODO42
-rw-r--r--mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs58
-rw-r--r--mcs/class/System.Web/System.Web.UI/Utils.cs46
-rw-r--r--mcs/class/System.Web/System.Web.Utils/.cvsignore1
-rw-r--r--mcs/class/System.Web/System.Web.Utils/ApacheVersionInfo.cs31
-rw-r--r--mcs/class/System.Web/System.Web.Utils/ChangeLog57
-rw-r--r--mcs/class/System.Web/System.Web.Utils/DataSourceHelper.cs72
-rw-r--r--mcs/class/System.Web/System.Web.Utils/FileAction.cs26
-rw-r--r--mcs/class/System.Web/System.Web.Utils/FileChangeEventHandler.cs17
-rw-r--r--mcs/class/System.Web/System.Web.Utils/FileChangedEventArgs.cs43
-rw-r--r--mcs/class/System.Web/System.Web.Utils/FileChangesMonitor.cs62
-rw-r--r--mcs/class/System.Web/System.Web.Utils/FilePathParser.cs82
-rw-r--r--mcs/class/System.Web/System.Web.Utils/IISVersionInfo.cs110
-rw-r--r--mcs/class/System.Web/System.Web.Utils/NativeFileChangeEventHandler.cs17
-rw-r--r--mcs/class/System.Web/System.Web.Utils/UrlUtils.cs283
-rw-r--r--mcs/class/System.Web/System.Web.Utils/WebEqualComparer.cs107
-rw-r--r--mcs/class/System.Web/System.Web.Utils/WebHashCodeProvider.cs54
-rw-r--r--mcs/class/System.Web/System.Web.build34
-rw-r--r--mcs/class/System.Web/System.Web/.cvsignore1
-rw-r--r--mcs/class/System.Web/System.Web/BeginEventHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web/ChangeLog148
-rw-r--r--mcs/class/System.Web/System.Web/EndEventHandler.cs13
-rw-r--r--mcs/class/System.Web/System.Web/HttpApplication.cs163
-rw-r--r--mcs/class/System.Web/System.Web/HttpApplicationState.cs232
-rw-r--r--mcs/class/System.Web/System.Web/HttpBrowserCapabilites.cs25
-rw-r--r--mcs/class/System.Web/System.Web/HttpCachePolicy.cs14
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs16
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs110
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs81
-rw-r--r--mcs/class/System.Web/System.Web/HttpCacheability.cs17
-rw-r--r--mcs/class/System.Web/System.Web/HttpClientCertificate.cs147
-rw-r--r--mcs/class/System.Web/System.Web/HttpContext.cs247
-rw-r--r--mcs/class/System.Web/System.Web/HttpCookie.cs177
-rw-r--r--mcs/class/System.Web/System.Web/HttpCookieCollection.cs139
-rw-r--r--mcs/class/System.Web/System.Web/HttpException.cs59
-rw-r--r--mcs/class/System.Web/System.Web/HttpFileCollection.cs73
-rw-r--r--mcs/class/System.Web/System.Web/HttpHelper.cs48
-rw-r--r--mcs/class/System.Web/System.Web/HttpModuleCollection.cs73
-rw-r--r--mcs/class/System.Web/System.Web/HttpPostedFile.cs56
-rw-r--r--mcs/class/System.Web/System.Web/HttpRequest.cs836
-rw-r--r--mcs/class/System.Web/System.Web/HttpRequestStream.cs142
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponse.cs750
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponseHeader.cs53
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponseStream.cs87
-rw-r--r--mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs48
-rw-r--r--mcs/class/System.Web/System.Web/HttpRuntime.cs254
-rw-r--r--mcs/class/System.Web/System.Web/HttpServerUtility.cs283
-rw-r--r--mcs/class/System.Web/System.Web/HttpSessionState.cs15
-rw-r--r--mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs64
-rw-r--r--mcs/class/System.Web/System.Web/HttpUtility.cs180
-rw-r--r--mcs/class/System.Web/System.Web/HttpValidationStatus.cs18
-rw-r--r--mcs/class/System.Web/System.Web/HttpValueCollection.cs142
-rw-r--r--mcs/class/System.Web/System.Web/HttpWorkerRequest.cs477
-rw-r--r--mcs/class/System.Web/System.Web/HttpWriter.cs230
-rw-r--r--mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs18
-rw-r--r--mcs/class/System.Web/System.Web/IHttpHandler.cs16
-rw-r--r--mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs19
-rw-r--r--mcs/class/System.Web/System.Web/IHttpModule.cs14
-rw-r--r--mcs/class/System.Web/System.Web/NOTES21
-rw-r--r--mcs/class/System.Web/System.Web/ProcessShutdownReason.cs22
-rw-r--r--mcs/class/System.Web/System.Web/ProcessStatus.cs19
-rw-r--r--mcs/class/System.Web/System.Web/TODO19
-rw-r--r--mcs/class/System.Web/System.Web/TODOAttribute.cs32
-rw-r--r--mcs/class/System.Web/System.Web/TraceContext.cs69
-rw-r--r--mcs/class/System.Web/System.Web/TraceMode.cs16
-rw-r--r--mcs/class/System.Web/System.Web/WebCategoryAttribute.cs38
-rw-r--r--mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs44
-rw-r--r--mcs/class/System.Web/Test/test.aspx29
-rw-r--r--mcs/class/System.Web/Test/test2.aspx101
-rw-r--r--mcs/class/System.Web/Test/test3.aspx23
-rw-r--r--mcs/class/System.Web/Test/test4.aspx119
-rw-r--r--mcs/class/System.Web/Test/test5.aspx121
-rw-r--r--mcs/class/System.Web/Test/test6.aspx83
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs31
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleObject.cs251
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs30
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CaptionButton.cs28
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog33
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CharacterCasing.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/CheckState.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs16
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DialogResult.cs31
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DockStyle.cs28
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DragAction.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DragDropEffects.cs30
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemState.cs36
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/DrawMode.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs29
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FeatureSupport.cs49
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FileDialog.cs162
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FlatStyle.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FontDialog.cs175
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Form.ControlCollection.cs54
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs30
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FormStartPosition.cs28
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FormWindowState.cs26
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/FrameStyle.cs24
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs53
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs106
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GridItem.cs84
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemCollection.cs48
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs102
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs193
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/HScrollBar.cs187
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/Help.cs29
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs58
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/HelpProvider.cs118
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IButtonControl.cs17
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs22
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs24
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IContainerControl.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs17
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs24
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IDataObject.cs33
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IFileReaderService.cs23
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IWin32Window.cs20
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/IWindowTarget.cs25
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs257
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs129
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MethodInvoker.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs18
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs19
-rw-r--r--mcs/class/System.Windows.Forms/enums.cs310
-rw-r--r--mcs/class/System.XML/.cvsignore6
-rw-r--r--mcs/class/System.XML/ChangeLog15
-rw-r--r--mcs/class/System.XML/Mono.System.XML.csproj401
-rw-r--r--mcs/class/System.XML/Mono.System.XML.sln27
-rw-r--r--mcs/class/System.XML/System.XML.build38
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/ChangeLog3
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/ValidationEventArgs.cs37
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchema.cs303
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs24
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotated.cs57
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs44
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs37
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs37
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAppInfo.cs37
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs123
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs53
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs26
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs29
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs118
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaCollectionEnumerator.cs47
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs34
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs53
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs56
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs123
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs15
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaContentModel.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaContentProcessing.cs22
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaContentType.cs17
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs24
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaDerivationMethod.cs31
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaDocumentation.cs45
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs178
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaException.cs72
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaExternal.cs49
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs36
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaForm.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs36
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs31
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs51
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaImport.cs33
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaInclude.cs24
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs27
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs39
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaNumericFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs54
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectCollection.cs82
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectEnumerator.cs49
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs46
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs97
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs47
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs29
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs27
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs46
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs74
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs28
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs17
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs43
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs54
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs35
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs80
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaUse.cs22
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs16
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs27
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSeverityType.cs15
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/AssemblyInfo.cs58
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapAttributeAttribute.cs61
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapAttributeOverrides.cs50
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapAttributes.cs52
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapElementAttribute.cs60
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapEnumAttribute.cs40
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapIgnoreAttribute.cs25
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapIncludeAttribute.cs41
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/SoapTypeAttribute.cs52
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/TODOAttribute.cs32
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventArgs.cs35
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAnyAttributeAttribute.cs30
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttribute.cs57
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttributes.cs61
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlArrayAttribute.cs81
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttribute.cs76
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttributes.cs37
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs78
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventArgs.cs38
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAttributeOverrides.cs44
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlAttributes.cs152
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlChoiceIdentifierAttribute.cs41
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlElementAttribute.cs95
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlElementAttributes.cs34
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlElementEventArgs.cs37
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlEnumAttribute.cs41
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlIgnoreAttribute.cs26
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlIncludeAttribute.cs37
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlMapping.cs43
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlNamespaceDeclarationsAttribute.cs26
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlNodeEventArgs.cs69
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs73
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs137
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSerializerNamespaces.cs54
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlTextAttribute.cs52
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlTypeAttribute.cs60
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs28
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/ChangeLog36
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/IXPathNavigable.cs16
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathExpression.cs50
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathNamespaceScope.cs18
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs212
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathNodeIterator.cs52
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathNodeType.cs25
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathResultType.cs22
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XPathScanner.cs260
-rwxr-xr-xmcs/class/System.XML/System.Xml.XPath/XmlCaseOrder.cs33
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XmlDataType.cs17
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/XmlSortOrder.cs17
-rw-r--r--mcs/class/System.XML/System.Xml/ChangeLog557
-rw-r--r--mcs/class/System.XML/System.Xml/Driver.cs56
-rwxr-xr-xmcs/class/System.XML/System.Xml/EntityHandling.cs29
-rwxr-xr-xmcs/class/System.XML/System.Xml/Formatting.cs29
-rwxr-xr-xmcs/class/System.XML/System.Xml/IHasXmlNode.cs15
-rw-r--r--mcs/class/System.XML/System.Xml/IXmlLineInfo.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml/NameTable.cs74
-rw-r--r--mcs/class/System.XML/System.Xml/Profile.cs47
-rw-r--r--mcs/class/System.XML/System.Xml/ReadState.cs41
-rw-r--r--mcs/class/System.XML/System.Xml/TODOAttribute.cs32
-rwxr-xr-xmcs/class/System.XML/System.Xml/ValidationType.cs20
-rw-r--r--mcs/class/System.XML/System.Xml/WhitespaceHandling.cs33
-rwxr-xr-xmcs/class/System.XML/System.Xml/WriteState.cs53
-rw-r--r--mcs/class/System.XML/System.Xml/XmlAttribute.cs196
-rw-r--r--mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs117
-rw-r--r--mcs/class/System.XML/System.Xml/XmlCDataSection.cs54
-rw-r--r--mcs/class/System.XML/System.Xml/XmlChar.cs200
-rw-r--r--mcs/class/System.XML/System.Xml/XmlCharacterData.cs90
-rw-r--r--mcs/class/System.XML/System.Xml/XmlComment.cs58
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDeclaration.cs107
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDocument.cs563
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs84
-rw-r--r--mcs/class/System.XML/System.Xml/XmlDocumentType.cs98
-rw-r--r--mcs/class/System.XML/System.Xml/XmlElement.cs291
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlEntity.cs122
-rw-r--r--mcs/class/System.XML/System.Xml/XmlEntityReference.cs70
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlException.cs81
-rw-r--r--mcs/class/System.XML/System.Xml/XmlImplementation.cs32
-rw-r--r--mcs/class/System.XML/System.Xml/XmlLinkedNode.cs46
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNameTable.cs20
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNamedNodeMap.cs104
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs155
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNode.cs353
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNodeChangedAction.cs27
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNodeChangedEventArgs.cs67
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNodeChangedEventHandler.cs14
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNodeList.cs42
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNodeListChildren.cs146
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNodeOrder.cs19
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNodeReader.cs247
-rw-r--r--mcs/class/System.XML/System.Xml/XmlNodeType.cs93
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlNotation.cs100
-rw-r--r--mcs/class/System.XML/System.Xml/XmlParserContext.cs186
-rw-r--r--mcs/class/System.XML/System.Xml/XmlProcessingInstruction.cs96
-rw-r--r--mcs/class/System.XML/System.Xml/XmlQualifiedName.cs104
-rw-r--r--mcs/class/System.XML/System.Xml/XmlReader.cs241
-rw-r--r--mcs/class/System.XML/System.Xml/XmlResolver.cs32
-rw-r--r--mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs53
-rw-r--r--mcs/class/System.XML/System.Xml/XmlSpace.cs37
-rw-r--r--mcs/class/System.XML/System.Xml/XmlText.cs69
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextReader.cs1274
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextWriter.cs644
-rw-r--r--mcs/class/System.XML/System.Xml/XmlTextWriterOpenElement.cs61
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlTokenizedType.cs27
-rwxr-xr-xmcs/class/System.XML/System.Xml/XmlUrlResolver.cs41
-rw-r--r--mcs/class/System.XML/System.Xml/XmlWhitespace.cs55
-rw-r--r--mcs/class/System.XML/System.Xml/XmlWriter.cs170
-rw-r--r--mcs/class/System.XML/Test/.cvsignore4
-rw-r--r--mcs/class/System.XML/Test/AllTests.cs42
-rw-r--r--mcs/class/System.XML/Test/ChangeLog294
-rw-r--r--mcs/class/System.XML/Test/Microsoft.Test.csproj162
-rw-r--r--mcs/class/System.XML/Test/Mono.Test.csproj167
-rw-r--r--mcs/class/System.XML/Test/MonoMicro.Test.csproj177
-rwxr-xr-xmcs/class/System.XML/Test/NameTableTests.cs91
-rw-r--r--mcs/class/System.XML/Test/System.XML_test.build53
-rw-r--r--mcs/class/System.XML/Test/TheTests.cs93
-rw-r--r--mcs/class/System.XML/Test/XPathScannerTests.cs340
-rw-r--r--mcs/class/System.XML/Test/XmlAttributeTests.cs95
-rwxr-xr-xmcs/class/System.XML/Test/XmlCDataSectionTests.cs99
-rwxr-xr-xmcs/class/System.XML/Test/XmlCommentTests.cs107
-rwxr-xr-xmcs/class/System.XML/Test/XmlDeclarationTests.cs130
-rw-r--r--mcs/class/System.XML/Test/XmlDocumentTests.cs354
-rwxr-xr-xmcs/class/System.XML/Test/XmlDocumentTypeTests.cs104
-rw-r--r--mcs/class/System.XML/Test/XmlElementTests.cs131
-rw-r--r--mcs/class/System.XML/Test/XmlNamespaceManagerTests.cs138
-rw-r--r--mcs/class/System.XML/Test/XmlNodeListTests.cs206
-rw-r--r--mcs/class/System.XML/Test/XmlProcessingInstructionTests.cs36
-rwxr-xr-xmcs/class/System.XML/Test/XmlSignificantWhitespaceTests.cs117
-rw-r--r--mcs/class/System.XML/Test/XmlTextReaderTests.cs1766
-rw-r--r--mcs/class/System.XML/Test/XmlTextTests.cs36
-rw-r--r--mcs/class/System.XML/Test/XmlTextWriterTests.cs903
-rwxr-xr-xmcs/class/System.XML/Test/XmlWhiteSpaceTests.cs117
-rw-r--r--mcs/class/System/.cvsignore2
-rw-r--r--mcs/class/System/ChangeLog18
-rwxr-xr-xmcs/class/System/System.CodeDom.Compiler/ChangeLog9
-rwxr-xr-xmcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs238
-rwxr-xr-xmcs/class/System/System.CodeDom.Compiler/ICodeGenerator.cs30
-rw-r--r--mcs/class/System/System.CodeDom/ChangeLog19
-rwxr-xr-xmcs/class/System/System.CodeDom/Code-X-Collection.cs159
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs90
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAssignStatement.cs53
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttachEventStatement.cs63
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttributeArgument.cs61
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs167
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttributeBlock.cs42
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs61
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs166
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs16
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs89
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeBinaryOperatorType.cs30
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeCastExpression.cs53
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeCatchClause.cs47
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs166
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeClass.cs107
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeClassCollection.cs165
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeClassConstructor.cs17
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeClassDelegate.cs52
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeClassMember.cs80
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeClassMemberCollection.cs165
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeCommentStatement.cs40
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeConstructor.cs44
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs67
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs60
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeDelegateInvokeStatement.cs55
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeDetachEventStatement.cs62
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeExpression.cs36
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeExpressionCollection.cs165
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs72
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeForLoopStatement.cs78
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeIfStatement.cs73
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeIndexerExpression.cs35
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeLinePragma.cs51
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeLiteralClassMember.cs40
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeLiteralExpression.cs40
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeLiteralNamespace.cs48
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeLiteralStatement.cs36
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMemberEvent.cs51
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMemberField.cs49
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMemberMethod.cs74
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMemberProperty.cs109
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs69
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMethodInvokeStatement.cs84
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs15
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeNamespace.cs93
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeNamespaceImport.cs37
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeNamespaceImportCollection.cs166
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeObject.cs16
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs55
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs69
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs166
-rwxr-xr-xmcs/class/System/System.CodeDom/CodePrimitiveExpression.cs34
-rwxr-xr-xmcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs60
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeStatement.cs16
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeStatementCollection.cs166
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs17
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs32
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs71
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeTypeDeclaration.cs16
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeTypeMember.cs25
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeTypeOfExpression.cs33
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs33
-rwxr-xr-xmcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs63
-rwxr-xr-xmcs/class/System/System.CodeDom/FieldDirection.cs14
-rwxr-xr-xmcs/class/System/System.CodeDom/MemberAttributes.cs29
-rw-r--r--mcs/class/System/System.Collections.Specialized/BitVector32.cs68
-rwxr-xr-xmcs/class/System/System.Collections.Specialized/ChangeLog41
-rw-r--r--mcs/class/System/System.Collections.Specialized/ListDictionary.cs435
-rw-r--r--mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs515
-rw-r--r--mcs/class/System/System.Collections.Specialized/NameValueCollection.cs365
-rwxr-xr-xmcs/class/System/System.Collections.Specialized/StringCollection.cs293
-rw-r--r--mcs/class/System/System.Collections.Specialized/StringDictionary.cs97
-rw-r--r--mcs/class/System/System.Collections.Specialized/StringEnumerator.cs36
-rwxr-xr-xmcs/class/System/System.ComponentModel/BrowsableAttribute.cs38
-rwxr-xr-xmcs/class/System/System.ComponentModel/CategoryAttribute.cs227
-rw-r--r--mcs/class/System/System.ComponentModel/ChangeLog50
-rw-r--r--mcs/class/System/System.ComponentModel/Component.cs126
-rw-r--r--mcs/class/System/System.ComponentModel/ComponentCollection.cs21
-rw-r--r--mcs/class/System/System.ComponentModel/Container.cs159
-rwxr-xr-xmcs/class/System/System.ComponentModel/DescriptionAttribute.cs46
-rwxr-xr-xmcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs37
-rwxr-xr-xmcs/class/System/System.ComponentModel/DesignerSerializationVisibility.cs16
-rwxr-xr-xmcs/class/System/System.ComponentModel/DesignerSerializationVisibilityAttribute.cs42
-rw-r--r--mcs/class/System/System.ComponentModel/EventHandlerList.cs64
-rw-r--r--mcs/class/System/System.ComponentModel/IComponent.cs20
-rw-r--r--mcs/class/System/System.ComponentModel/IContainer.cs24
-rw-r--r--mcs/class/System/System.ComponentModel/ISite.cs21
-rwxr-xr-xmcs/class/System/System.ComponentModel/ISynchronizeInvoke.cs26
-rwxr-xr-xmcs/class/System/System.ComponentModel/LocalizableAttribute.cs40
-rwxr-xr-xmcs/class/System/System.ComponentModel/MemberDescriptor.cs120
-rwxr-xr-xmcs/class/System/System.ComponentModel/PropertyDescriptor.cs114
-rwxr-xr-xmcs/class/System/System.ComponentModel/TypeConverter.cs8
-rwxr-xr-xmcs/class/System/System.ComponentModel/Win32Exception.cs84
-rw-r--r--mcs/class/System/System.Configuration/ChangeLog25
-rw-r--r--mcs/class/System/System.Configuration/ConfigurationException.cs132
-rw-r--r--mcs/class/System/System.Configuration/ConfigurationSettings.cs198
-rw-r--r--mcs/class/System/System.Configuration/DictionarySectionHandler.cs91
-rw-r--r--mcs/class/System/System.Configuration/IConfigurationSectionHandler.cs27
-rw-r--r--mcs/class/System/System.Configuration/IgnoreSectionHandler.cs45
-rw-r--r--mcs/class/System/System.Configuration/NameValueSectionHandler.cs107
-rw-r--r--mcs/class/System/System.Configuration/SingleTagSectionHandler.cs64
-rwxr-xr-xmcs/class/System/System.Diagnostics/BooleanSwitch.cs59
-rw-r--r--mcs/class/System/System.Diagnostics/ChangeLog72
-rw-r--r--mcs/class/System/System.Diagnostics/Debug.cs307
-rw-r--r--mcs/class/System/System.Diagnostics/DefaultTraceListener.cs166
-rw-r--r--mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs63
-rwxr-xr-xmcs/class/System/System.Diagnostics/FileVersionInfo.cs215
-rwxr-xr-xmcs/class/System/System.Diagnostics/Process.cs429
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessModule.cs61
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessModuleCollection.cs43
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessPriorityClass.cs20
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessStartInfo.cs148
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessThread.cs118
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessThreadCollection.cs56
-rwxr-xr-xmcs/class/System/System.Diagnostics/ProcessWindowStyle.cs18
-rwxr-xr-xmcs/class/System/System.Diagnostics/Switch.cs94
-rw-r--r--mcs/class/System/System.Diagnostics/TextWriterTraceListener.cs235
-rwxr-xr-xmcs/class/System/System.Diagnostics/ThreadPriorityLevel.cs21
-rwxr-xr-xmcs/class/System/System.Diagnostics/ThreadState.cs22
-rwxr-xr-xmcs/class/System/System.Diagnostics/ThreadWaitReason.cs28
-rw-r--r--mcs/class/System/System.Diagnostics/Trace.cs307
-rw-r--r--mcs/class/System/System.Diagnostics/TraceImpl.cs296
-rwxr-xr-xmcs/class/System/System.Diagnostics/TraceLevel.cs41
-rw-r--r--mcs/class/System/System.Diagnostics/TraceListener.cs297
-rw-r--r--mcs/class/System/System.Diagnostics/TraceListenerCollection.cs286
-rwxr-xr-xmcs/class/System/System.Diagnostics/TraceSwitch.cs97
-rwxr-xr-xmcs/class/System/System.Globalization/Locale.cs22
-rw-r--r--mcs/class/System/System.Net.Sockets/AddressFamily.cs50
-rw-r--r--mcs/class/System/System.Net.Sockets/ChangeLog47
-rw-r--r--mcs/class/System/System.Net.Sockets/LingerOption.cs42
-rw-r--r--mcs/class/System/System.Net.Sockets/MulticastOption.cs48
-rw-r--r--mcs/class/System/System.Net.Sockets/NetworkStream.cs272
-rw-r--r--mcs/class/System/System.Net.Sockets/ProtocolFamily.cs46
-rw-r--r--mcs/class/System/System.Net.Sockets/ProtocolType.cs81
-rw-r--r--mcs/class/System/System.Net.Sockets/SelectMode.cs33
-rw-r--r--mcs/class/System/System.Net.Sockets/Socket.cs937
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketException.cs41
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketFlags.cs42
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketOptionLevel.cs37
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketOptionName.cs181
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketShutdown.cs33
-rw-r--r--mcs/class/System/System.Net.Sockets/SocketType.cs45
-rwxr-xr-xmcs/class/System/System.Net.Sockets/TcpClient.cs321
-rwxr-xr-xmcs/class/System/System.Net.Sockets/TcpListener.cs171
-rw-r--r--mcs/class/System/System.Net.Sockets/UdpClient.cs224
-rwxr-xr-xmcs/class/System/System.Net/AuthenticationManager.cs24
-rwxr-xr-xmcs/class/System/System.Net/Authorization.cs2
-rw-r--r--mcs/class/System/System.Net/ChangeLog119
-rwxr-xr-xmcs/class/System/System.Net/ConnectionModes.cs37
-rw-r--r--mcs/class/System/System.Net/Dns.cs205
-rwxr-xr-xmcs/class/System/System.Net/EndPoint.cs25
-rwxr-xr-xmcs/class/System/System.Net/HttpStatusCode.cs205
-rwxr-xr-xmcs/class/System/System.Net/IAuthenticationModule.cs4
-rwxr-xr-xmcs/class/System/System.Net/ICredentialLookup.cs7
-rwxr-xr-xmcs/class/System/System.Net/IPAddress.cs228
-rwxr-xr-xmcs/class/System/System.Net/IPAdress.cs87
-rwxr-xr-xmcs/class/System/System.Net/IPEndPoint.cs111
-rw-r--r--mcs/class/System/System.Net/IPHostEntry.cs75
-rwxr-xr-xmcs/class/System/System.Net/NetworkAccess.cs29
-rwxr-xr-xmcs/class/System/System.Net/NetworkCredential.cs63
-rwxr-xr-xmcs/class/System/System.Net/ProxyUseType.cs37
-rwxr-xr-xmcs/class/System/System.Net/SocketAddress.cs77
-rwxr-xr-xmcs/class/System/System.Net/TransportType.cs41
-rwxr-xr-xmcs/class/System/System.Net/WebExceptionStatus.cs85
-rwxr-xr-xmcs/class/System/System.Net/WebStatus.cs77
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/ChangeLog20
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/RegexRunner.cs92
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/RegexRunnerFactory.cs20
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/arch.cs333
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/cache.cs143
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/category.cs637
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/collections.cs127
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/compiler.cs368
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/debug.cs208
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/interpreter.cs889
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/interval.cs305
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/match.cs218
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/notes.txt45
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/parser.cs1109
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/quicksearch.cs108
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/regex.cs401
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/replace.cs181
-rw-r--r--mcs/class/System/System.Text.RegularExpressions/syntax.cs976
-rwxr-xr-xmcs/class/System/System.Threading/ChangeLog9
-rwxr-xr-xmcs/class/System/System.Threading/ThreadExceptionEventArgs.cs27
-rwxr-xr-xmcs/class/System/System.Threading/ThreadExceptionEventHandler.cs14
-rw-r--r--mcs/class/System/System.build38
-rw-r--r--mcs/class/System/System/ChangeLog14
-rw-r--r--mcs/class/System/System/TODOAttribute.cs32
-rwxr-xr-xmcs/class/System/System/Uri.cs329
-rwxr-xr-xmcs/class/System/System/UriFormatException.cs43
-rwxr-xr-xmcs/class/System/System/UriHostNameType.cs37
-rwxr-xr-xmcs/class/System/System/UriPartial.cs33
-rw-r--r--mcs/class/System/Test/.cvsignore1
-rw-r--r--mcs/class/System/Test/AllTests.cs32
-rwxr-xr-xmcs/class/System/Test/BasicOperationsTest.cs165
-rw-r--r--mcs/class/System/Test/ChangeLog49
-rw-r--r--mcs/class/System/Test/DnsTest.cs162
-rw-r--r--mcs/class/System/Test/NameValueCollectionTest.cs31
-rw-r--r--mcs/class/System/Test/StringCollectionTest.cs157
-rw-r--r--mcs/class/System/Test/System.Diagnostics/AllTests.cs29
-rw-r--r--mcs/class/System/Test/System.Diagnostics/ChangeLog11
-rw-r--r--mcs/class/System/Test/System.Diagnostics/TraceTest.cs94
-rwxr-xr-xmcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs82
-rwxr-xr-xmcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs85
-rw-r--r--mcs/class/System/Test/System.Net/AllTests.cs30
-rw-r--r--mcs/class/System/Test/System.Net/ChangeLog27
-rw-r--r--mcs/class/System/Test/System.Net/DnsTest.cs162
-rw-r--r--mcs/class/System/Test/System.Net/IPAddressTest.cs175
-rw-r--r--mcs/class/System/Test/System.Net/IPEndPointTest.cs134
-rw-r--r--mcs/class/System/Test/System.Text.RegularExpressions/AllTests.cs26
-rw-r--r--mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs40
-rw-r--r--mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs746
-rw-r--r--mcs/class/System/Test/System.Text.RegularExpressions/RegexTrial.cs98
-rw-r--r--mcs/class/System/Test/System_test.build54
-rwxr-xr-xmcs/class/System/Test/TcpClientTest.cs82
-rwxr-xr-xmcs/class/System/Test/TcpListenerTest.cs85
-rw-r--r--mcs/class/System/Test/TheTests.cs74
-rw-r--r--mcs/class/corlib/.cvsignore2
-rw-r--r--mcs/class/corlib/ChangeLog69
-rw-r--r--mcs/class/corlib/Linux/ChangeLog27
-rw-r--r--mcs/class/corlib/Linux/Linux.cs484
-rw-r--r--mcs/class/corlib/System.Collections/ArrayList.cs574
-rw-r--r--mcs/class/corlib/System.Collections/BitArray.cs499
-rw-r--r--mcs/class/corlib/System.Collections/CaseInsensitiveComparer.cs77
-rw-r--r--mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs92
-rw-r--r--mcs/class/corlib/System.Collections/ChangeLog190
-rw-r--r--mcs/class/corlib/System.Collections/CollectionBase.cs137
-rw-r--r--mcs/class/corlib/System.Collections/Comparer.cs56
-rwxr-xr-xmcs/class/corlib/System.Collections/DictionaryBase.cs372
-rw-r--r--mcs/class/corlib/System.Collections/DictionaryEntry.cs24
-rw-r--r--mcs/class/corlib/System.Collections/Hashtable.cs1031
-rw-r--r--mcs/class/corlib/System.Collections/ICollection.cs24
-rw-r--r--mcs/class/corlib/System.Collections/IComparer.cs19
-rw-r--r--mcs/class/corlib/System.Collections/IDictionary.cs40
-rw-r--r--mcs/class/corlib/System.Collections/IDictionaryEnumerator.cs20
-rw-r--r--mcs/class/corlib/System.Collections/IEnumerable.cs18
-rw-r--r--mcs/class/corlib/System.Collections/IEnumerator.cs22
-rw-r--r--mcs/class/corlib/System.Collections/IHashCodeProvider.cs18
-rw-r--r--mcs/class/corlib/System.Collections/IList.cs40
-rw-r--r--mcs/class/corlib/System.Collections/Queue.cs334
-rw-r--r--mcs/class/corlib/System.Collections/ReadOnlyCollectionBase.cs45
-rw-r--r--mcs/class/corlib/System.Collections/SortedList.cs862
-rw-r--r--mcs/class/corlib/System.Collections/Stack.cs321
-rw-r--r--mcs/class/corlib/System.Configuration.Assemblies/AssemblyHash.cs71
-rw-r--r--mcs/class/corlib/System.Configuration.Assemblies/AssemblyHashAlgorithm.cs33
-rw-r--r--mcs/class/corlib/System.Configuration.Assemblies/AssemblyVersionCompatibility.cs33
-rw-r--r--mcs/class/corlib/System.Configuration.Assemblies/ChangeLog6
-rwxr-xr-xmcs/class/corlib/System.Configuration.Assemblies/ProcessorID.cs101
-rw-r--r--mcs/class/corlib/System.Diagnostics.SymbolStore/ChangeLog29
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolBinder.cs19
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocument.cs30
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.cs13
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolMethod.cs38
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolNamespace.cs21
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolReader.cs38
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolScope.cs26
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolVariable.cs28
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolWriter.cs88
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/SymAddressKind.cs25
-rw-r--r--mcs/class/corlib/System.Diagnostics.SymbolStore/SymDocumentType.cs21
-rw-r--r--mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageType.cs31
-rw-r--r--mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageVendor.cs21
-rwxr-xr-xmcs/class/corlib/System.Diagnostics.SymbolStore/SymbolToken.cs29
-rw-r--r--mcs/class/corlib/System.Diagnostics/ChangeLog52
-rw-r--r--mcs/class/corlib/System.Diagnostics/ConditionalAttribute.cs30
-rw-r--r--mcs/class/corlib/System.Diagnostics/DebuggableAttribute.cs28
-rw-r--r--mcs/class/corlib/System.Diagnostics/Debugger.cs94
-rw-r--r--mcs/class/corlib/System.Diagnostics/DebuggerHiddenAttribute.cs25
-rw-r--r--mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs23
-rw-r--r--mcs/class/corlib/System.Diagnostics/StackFrame.cs316
-rw-r--r--mcs/class/corlib/System.Diagnostics/StackTrace.cs291
-rw-r--r--mcs/class/corlib/System.Globalization/Calendar.cs917
-rw-r--r--mcs/class/corlib/System.Globalization/CalendarWeekRule.cs28
-rw-r--r--mcs/class/corlib/System.Globalization/CalendricalCalculations.cs2120
-rw-r--r--mcs/class/corlib/System.Globalization/ChangeLog92
-rwxr-xr-xmcs/class/corlib/System.Globalization/CompareOptions.cs54
-rw-r--r--mcs/class/corlib/System.Globalization/CultureInfo.cs850
-rwxr-xr-xmcs/class/corlib/System.Globalization/CultureTypes.cs38
-rw-r--r--mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs520
-rw-r--r--mcs/class/corlib/System.Globalization/DateTimeStyles.cs50
-rwxr-xr-xmcs/class/corlib/System.Globalization/DaylightTime.cs51
-rw-r--r--mcs/class/corlib/System.Globalization/GregorianCalendar.cs448
-rwxr-xr-xmcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs45
-rw-r--r--mcs/class/corlib/System.Globalization/HebrewCalendar.cs861
-rw-r--r--mcs/class/corlib/System.Globalization/HijriCalendar.cs870
-rw-r--r--mcs/class/corlib/System.Globalization/JapaneseCalendar.cs783
-rw-r--r--mcs/class/corlib/System.Globalization/JulianCalendar.cs443
-rw-r--r--mcs/class/corlib/System.Globalization/KoreanCalendar.cs444
-rwxr-xr-xmcs/class/corlib/System.Globalization/Locale.cs22
-rw-r--r--mcs/class/corlib/System.Globalization/NumberFormatInfo.cs675
-rw-r--r--mcs/class/corlib/System.Globalization/NumberStyles.cs46
-rw-r--r--mcs/class/corlib/System.Globalization/RegionInfo.cs1689
-rw-r--r--mcs/class/corlib/System.Globalization/TaiwanCalendar.cs745
-rw-r--r--mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs445
-rw-r--r--mcs/class/corlib/System.Globalization/UnicodeCategory.cs44
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog19
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs18
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorage.cs78
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageException.cs37
-rw-r--r--mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs19
-rwxr-xr-xmcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageScope.cs38
-rw-r--r--mcs/class/corlib/System.IO/BinaryReader.cs362
-rwxr-xr-xmcs/class/corlib/System.IO/BinaryWriter.cs165
-rw-r--r--mcs/class/corlib/System.IO/BufferedStream.cs166
-rw-r--r--mcs/class/corlib/System.IO/ChangeLog255
-rw-r--r--mcs/class/corlib/System.IO/CheckArgument.cs167
-rw-r--r--mcs/class/corlib/System.IO/CheckPermission.cs87
-rw-r--r--mcs/class/corlib/System.IO/Directory.cs237
-rw-r--r--mcs/class/corlib/System.IO/DirectoryInfo.cs135
-rwxr-xr-xmcs/class/corlib/System.IO/DirectoryNotFoundException.cs30
-rw-r--r--mcs/class/corlib/System.IO/EndOfStreamException.cs43
-rw-r--r--mcs/class/corlib/System.IO/File.cs172
-rw-r--r--mcs/class/corlib/System.IO/FileAccess.cs34
-rw-r--r--mcs/class/corlib/System.IO/FileAttributes.cs35
-rw-r--r--mcs/class/corlib/System.IO/FileInfo.cs135
-rwxr-xr-xmcs/class/corlib/System.IO/FileLoadException.cs76
-rw-r--r--mcs/class/corlib/System.IO/FileMode.cs45
-rwxr-xr-xmcs/class/corlib/System.IO/FileNotFoundException.cs92
-rw-r--r--mcs/class/corlib/System.IO/FileShare.cs38
-rw-r--r--mcs/class/corlib/System.IO/FileStream.cs339
-rw-r--r--mcs/class/corlib/System.IO/FileSystemInfo.cs133
-rw-r--r--mcs/class/corlib/System.IO/IOException.cs43
-rw-r--r--mcs/class/corlib/System.IO/MemoryStream.cs404
-rw-r--r--mcs/class/corlib/System.IO/MonoIO.cs221
-rw-r--r--mcs/class/corlib/System.IO/MonoIOError.cs1798
-rw-r--r--mcs/class/corlib/System.IO/MonoIOStat.cs22
-rw-r--r--mcs/class/corlib/System.IO/Path.cs256
-rw-r--r--mcs/class/corlib/System.IO/PathTooLongException.cs43
-rw-r--r--mcs/class/corlib/System.IO/SearchPattern.cs169
-rw-r--r--mcs/class/corlib/System.IO/SeekOrigin.cs34
-rwxr-xr-xmcs/class/corlib/System.IO/Stream.cs229
-rw-r--r--mcs/class/corlib/System.IO/StreamReader.cs243
-rw-r--r--mcs/class/corlib/System.IO/StreamWriter.cs135
-rw-r--r--mcs/class/corlib/System.IO/StringReader.cs131
-rw-r--r--mcs/class/corlib/System.IO/StringWriter.cs80
-rw-r--r--mcs/class/corlib/System.IO/TextReader.cs84
-rw-r--r--mcs/class/corlib/System.IO/TextWriter.cs271
-rw-r--r--mcs/class/corlib/System.PAL/IOperatingSystem.cs194
-rw-r--r--mcs/class/corlib/System.PAL/Platform.cs23
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs248
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs16
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ChangeLog258
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs143
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs45
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs195
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/EventBuilder.cs85
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/EventToken.cs70
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs105
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/FieldToken.cs70
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/FlowControl.cs63
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs611
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/Label.cs29
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs74
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs156
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/MethodToken.cs70
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs210
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs111
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/OpCode.cs125
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/OpCodeType.cs49
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/OpCodes.cs486
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/OperandType.cs87
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/PEFileKinds.cs8
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/PackingSize.cs41
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/ParameterBuilder.cs86
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs70
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs124
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs70
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs121
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs70
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/StackBehaviour.cs126
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/StringToken.cs70
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs599
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/TypeToken.cs70
-rwxr-xr-xmcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs51
-rwxr-xr-xmcs/class/corlib/System.Reflection/AmbiguousMatchException.cs32
-rw-r--r--mcs/class/corlib/System.Reflection/Assembly.cs279
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyAlgorithmIdAttribute.cs39
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyCompanyAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyConfigurationAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyCopyrightAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyCultureAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyDefaultAliasAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyDelaySignAttribute.cs32
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyDescriptionAttribute.cs30
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyFileVersionAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyFlagsAttribute.cs31
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyInformationalVersionAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyKeyFileAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyKeyNameAttribute.cs29
-rwxr-xr-xmcs/class/corlib/System.Reflection/AssemblyName.cs90
-rwxr-xr-xmcs/class/corlib/System.Reflection/AssemblyNameFlags.cs33
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyNameProxy.cs27
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyProductAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyTitleAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyTradeMarkAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/AssemblyVersionAttribute.cs29
-rw-r--r--mcs/class/corlib/System.Reflection/Binder.cs13
-rw-r--r--mcs/class/corlib/System.Reflection/BindingFlags.cs92
-rwxr-xr-xmcs/class/corlib/System.Reflection/CallingConventions.cs42
-rw-r--r--mcs/class/corlib/System.Reflection/ChangeLog240
-rw-r--r--mcs/class/corlib/System.Reflection/ConstructorInfo.cs39
-rw-r--r--mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs38
-rw-r--r--mcs/class/corlib/System.Reflection/DefaultMemberAttribute.cs29
-rwxr-xr-xmcs/class/corlib/System.Reflection/EventAttributes.cs37
-rwxr-xr-xmcs/class/corlib/System.Reflection/EventInfo.cs73
-rwxr-xr-xmcs/class/corlib/System.Reflection/FieldAttributes.cs101
-rwxr-xr-xmcs/class/corlib/System.Reflection/FieldInfo.cs117
-rwxr-xr-xmcs/class/corlib/System.Reflection/ICustomAttributeProvider.cs25
-rwxr-xr-xmcs/class/corlib/System.Reflection/IReflect.cs44
-rwxr-xr-xmcs/class/corlib/System.Reflection/InterfaceMapping.cs10
-rw-r--r--mcs/class/corlib/System.Reflection/InvalidFilterCriteriaException.cs37
-rw-r--r--mcs/class/corlib/System.Reflection/ManifestResourceInfo.cs27
-rw-r--r--mcs/class/corlib/System.Reflection/MemberFilter.cs7
-rwxr-xr-xmcs/class/corlib/System.Reflection/MemberInfo.cs39
-rwxr-xr-xmcs/class/corlib/System.Reflection/MemberTypes.cs57
-rwxr-xr-xmcs/class/corlib/System.Reflection/MethodAttributes.cs113
-rw-r--r--mcs/class/corlib/System.Reflection/MethodBase.cs127
-rwxr-xr-xmcs/class/corlib/System.Reflection/MethodImplAttributes.cs77
-rw-r--r--mcs/class/corlib/System.Reflection/MethodInfo.cs26
-rw-r--r--mcs/class/corlib/System.Reflection/Missing.cs17
-rw-r--r--mcs/class/corlib/System.Reflection/Module.cs103
-rwxr-xr-xmcs/class/corlib/System.Reflection/MonoEvent.cs43
-rwxr-xr-xmcs/class/corlib/System.Reflection/MonoField.cs99
-rwxr-xr-xmcs/class/corlib/System.Reflection/MonoMethod.cs205
-rwxr-xr-xmcs/class/corlib/System.Reflection/MonoProperty.cs164
-rwxr-xr-xmcs/class/corlib/System.Reflection/ParameterAttributes.cs66
-rw-r--r--mcs/class/corlib/System.Reflection/ParameterInfo.cs78
-rwxr-xr-xmcs/class/corlib/System.Reflection/ParameterModifier.cs26
-rwxr-xr-xmcs/class/corlib/System.Reflection/PropertyAttributes.cs54
-rwxr-xr-xmcs/class/corlib/System.Reflection/PropertyInfo.cs55
-rw-r--r--mcs/class/corlib/System.Reflection/ReflectionTypeLoadException.cs62
-rwxr-xr-xmcs/class/corlib/System.Reflection/ResourceAttributes.cs30
-rwxr-xr-xmcs/class/corlib/System.Reflection/ResourceLocation.cs34
-rwxr-xr-xmcs/class/corlib/System.Reflection/StrongNameKeyPair.cs39
-rw-r--r--mcs/class/corlib/System.Reflection/TargetException.cs37
-rw-r--r--mcs/class/corlib/System.Reflection/TargetInvocationException.cs23
-rw-r--r--mcs/class/corlib/System.Reflection/TargetParameterCountException.cs38
-rwxr-xr-xmcs/class/corlib/System.Reflection/TypeAttributes.cs138
-rwxr-xr-xmcs/class/corlib/System.Reflection/TypeDelegator.cs204
-rw-r--r--mcs/class/corlib/System.Reflection/TypeFilter.cs13
-rw-r--r--mcs/class/corlib/System.Resources/ChangeLog128
-rw-r--r--mcs/class/corlib/System.Resources/IResourceReader.cs20
-rw-r--r--mcs/class/corlib/System.Resources/IResourceWriter.cs25
-rw-r--r--mcs/class/corlib/System.Resources/MissingManifestResourceException.cs42
-rw-r--r--mcs/class/corlib/System.Resources/NeutralResoucesLanguageAttribute.cs28
-rw-r--r--mcs/class/corlib/System.Resources/ResourceManager.cs163
-rw-r--r--mcs/class/corlib/System.Resources/ResourceReader.cs265
-rw-r--r--mcs/class/corlib/System.Resources/ResourceSet.cs127
-rw-r--r--mcs/class/corlib/System.Resources/ResourceWriter.cs64
-rw-r--r--mcs/class/corlib/System.Resources/SatelliteContractVersionAttribute.cs27
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/ChangeLog15
-rwxr-xr-xmcs/class/corlib/System.Runtime.CompilerServices/IndexerNameAttribute.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/MethodCodeType.cs23
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/MethodImplAttribute.cs40
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/MethodImplOptions.cs41
-rw-r--r--mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs26
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/AssemblyRegistrationFlags.cs18
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/AutomationProxyAttribute.cs28
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/CallingConvention.cs41
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ChangeLog133
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/CharSet.cs33
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceAttribute.cs30
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceType.cs24
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/CoClassAttribute.cs26
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComAliasNameAttribute.cs27
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComConversionLossAttribute.cs21
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComEventInterfaceAttribute.cs34
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs21
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComInterfaceType.cs17
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComRegisterFunctionAttribute.cs18
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ComUnregisterFunctionAttribute.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ComVisible.cs25
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/DispIdAttribute.cs25
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/DllImportAttribute.cs33
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ExporterEventKind.cs18
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ExternalException.cs50
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/FieldOffsetAttribute.cs17
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs91
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/GCHandleType.cs38
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/GuidAttribute.cs25
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ICustomAdapter.cs15
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ICustomFactory.cs15
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ICustomMarshaler.cs19
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/IRegistrationServices.cs25
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ITypeLibConverter.cs22
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs18
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs20
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs20
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ImportedFromTypeLibAttribute.cs26
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ImporterEventKind.cs17
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/InAttribute.cs18
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/InterfaceTypeAttribute.cs29
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/LCIDConversionAttribute.cs27
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/LayoutKind.cs33
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs38
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/MarshalAsAttribute.cs27
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/OptionalAttribute.cs10
-rw-r--r--mcs/class/corlib/System.Runtime.InteropServices/OutAttribute.cs26
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/PInvokeMap.cs78
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/PreserveSigAttribute.cs19
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/PrimaryInteropAssemblyAttribute.cs32
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/ProgIdAttribute.cs28
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/StructLayoutAttribute.cs23
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibExporterFlags.cs16
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncAttribute.cs32
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncFlags.cs25
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeAttribute.cs32
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeFlags.cs26
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibVarAttribute.cs32
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/TypeLibVarFlags.cs26
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs168
-rwxr-xr-xmcs/class/corlib/System.Runtime.InteropServices/VarEnum.cs50
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Activation/ActivatorLevel.cs19
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Activation/IActivator.cs24
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionCallMessage.cs36
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionReturnMessage.cs17
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs72
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextAttribute.cs96
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextAttribute.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextProperty.cs23
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicMessageSink.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicProperty.cs19
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/SynchronizationAttribute.cs96
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs74
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog13
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/Header.cs50
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessage.cs20
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageCtrl.cs19
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageSink.cs21
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodCallMessage.cs28
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodMessage.cs55
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodReturnMessage.cs22
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs43
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs232
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs146
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs56
-rwxr-xr-xmcs/class/corlib/System.Runtime.Remoting/ChangeLog8
-rwxr-xr-xmcs/class/corlib/System.Runtime.Remoting/LeaseState.cs41
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs72
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/ObjectHandle.cs42
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs50
-rwxr-xr-xmcs/class/corlib/System.Runtime.Remoting/SoapMethodOption.cs37
-rwxr-xr-xmcs/class/corlib/System.Runtime.Remoting/SoapOption.cs30
-rwxr-xr-xmcs/class/corlib/System.Runtime.Remoting/WellKnownObjectMode.cs29
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryArrayTypeEnum.cs45
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog5
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs29
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs29
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs33
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs30
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs60
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs41
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs33
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs37
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs41
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs61
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs37
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs33
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs37
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs73
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs89
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs29
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/ChangeLog90
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs14
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs66
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs33
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs16
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs15
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs43
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/ISurrogateSelector.cs40
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs62
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs22
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs40
-rwxr-xr-xmcs/class/corlib/System.Runtime.Serialization/SerializationException.cs39
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs262
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs62
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs58
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs56
-rw-r--r--mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs92
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/AsymmetricAlgorithm.cs108
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.cs45
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.cs50
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureDeformatter.cs52
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureFormatter.cs52
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/ChangeLog90
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/CipherMode.cs24
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CryptoAPITransform.cs77
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CryptoStream.cs120
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/CryptoStreamMode.cs20
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CryptographicException.cs40
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs35
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CspParameters.cs57
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CspProviderFlags.cs20
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/DES.cs587
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/DESCryptoServiceProvider.cs250
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/DSA.cs101
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs87
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/DSAParameters.cs38
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/DSASignatureDeformatter.cs51
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/DSASignatureFormatter.cs52
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/DeriveBytes.cs27
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs264
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/HashAlgorithm.cs157
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/ICryptoTransform.cs49
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/KeySizes.cs61
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/MD5.cs44
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/MD5CryptoServiceProvider.cs482
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/PaddingMode.cs22
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs52
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RSA.cs36
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RSAParameters.cs36
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs36
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/Rijndael.cs25
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/RijndaelManaged.cs744
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA1.cs44
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA1CryptoServiceProvider.cs455
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA256.cs45
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA256Managed.cs290
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA384.cs45
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA384Managed.cs33
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA512.cs45
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/SHA512Managed.cs33
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/SignatureDescription.cs107
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs256
-rw-r--r--mcs/class/corlib/System.Security.Cryptography/ToBase64Transform.cs234
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/X509Certificates.cs10
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ChangeLog68
-rw-r--r--mcs/class/corlib/System.Security.Permissions/CodeAccessSecurityAttribute.cs33
-rw-r--r--mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAccess.cs38
-rw-r--r--mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAttribute.cs53
-rw-r--r--mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAccess.cs21
-rw-r--r--mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAttribute.cs47
-rw-r--r--mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs411
-rw-r--r--mcs/class/corlib/System.Security.Permissions/FileIOPermissionAccess.cs46
-rw-r--r--mcs/class/corlib/System.Security.Permissions/FileIOPermissionAttribute.cs68
-rw-r--r--mcs/class/corlib/System.Security.Permissions/IUnrestrictedPermission.cs15
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/IsolatedStorageContainment.cs56
-rw-r--r--mcs/class/corlib/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.cs34
-rw-r--r--mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermission.cs84
-rw-r--r--mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermissionAttribute.cs44
-rw-r--r--mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs69
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/PermissionState.cs29
-rw-r--r--mcs/class/corlib/System.Security.Permissions/PrincipalPermissionAttribute.cs60
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ReflectionPermissionAttribute.cs61
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ReflectionPermissionFlag.cs38
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/RegistryPermissionAccess.cs42
-rw-r--r--mcs/class/corlib/System.Security.Permissions/RegistryPermissionAttribute.cs60
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/SecurityAction.cs57
-rw-r--r--mcs/class/corlib/System.Security.Permissions/SecurityAttribute.cs59
-rw-r--r--mcs/class/corlib/System.Security.Permissions/SecurityPermission.cs66
-rw-r--r--mcs/class/corlib/System.Security.Permissions/SecurityPermissionAttribute.cs216
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/SecurityPermissionFlag.cs68
-rw-r--r--mcs/class/corlib/System.Security.Permissions/SiteIdentityPermissionAttribute.cs43
-rw-r--r--mcs/class/corlib/System.Security.Permissions/StrongNamePermissionAttribute.cs56
-rw-r--r--mcs/class/corlib/System.Security.Permissions/UIPermissionAttribute.cs48
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/UIPermissionClipboard.cs33
-rwxr-xr-xmcs/class/corlib/System.Security.Permissions/UIPermissionWindow.cs37
-rw-r--r--mcs/class/corlib/System.Security.Permissions/UrlIdentityPermissionAttribute.cs40
-rw-r--r--mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermissionAttribute.cs40
-rwxr-xr-xmcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs86
-rw-r--r--mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs66
-rw-r--r--mcs/class/corlib/System.Security.Policy/ChangeLog60
-rw-r--r--mcs/class/corlib/System.Security.Policy/CodeGroup.cs252
-rw-r--r--mcs/class/corlib/System.Security.Policy/Evidence.cs27
-rw-r--r--mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs135
-rw-r--r--mcs/class/corlib/System.Security.Policy/IIdentityPermissionFactory.cs13
-rw-r--r--mcs/class/corlib/System.Security.Policy/IMembershipCondition.cs17
-rw-r--r--mcs/class/corlib/System.Security.Policy/PolicyException.cs42
-rw-r--r--mcs/class/corlib/System.Security.Policy/PolicyLevel.cs62
-rw-r--r--mcs/class/corlib/System.Security.Policy/PolicyStatement.cs61
-rw-r--r--mcs/class/corlib/System.Security.Policy/PolicyStatementAttribute.cs17
-rw-r--r--mcs/class/corlib/System.Security.Principal/ChangeLog3
-rw-r--r--mcs/class/corlib/System.Security.Principal/GenericIdentity.cs46
-rw-r--r--mcs/class/corlib/System.Security.Principal/GenericPrincipal.cs38
-rw-r--r--mcs/class/corlib/System.Security.Principal/IIdentity.cs26
-rw-r--r--mcs/class/corlib/System.Security.Principal/IPrincipal.cs20
-rw-r--r--mcs/class/corlib/System.Security.Principal/PrincipalPolicy.cs17
-rw-r--r--mcs/class/corlib/System.Security.Principal/WindowsAccountType.cs18
-rw-r--r--mcs/class/corlib/System.Security.Principal/WindowsBuiltInRole.cs23
-rwxr-xr-xmcs/class/corlib/System.Security/ChangeLog46
-rwxr-xr-xmcs/class/corlib/System.Security/CodeAccessPermission.cs85
-rw-r--r--mcs/class/corlib/System.Security/IEvidenceFactory.cs12
-rwxr-xr-xmcs/class/corlib/System.Security/IPermission.cs24
-rwxr-xr-xmcs/class/corlib/System.Security/ISecurityEncodable.cs18
-rw-r--r--mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs20
-rwxr-xr-xmcs/class/corlib/System.Security/IStackWalk.cs22
-rw-r--r--mcs/class/corlib/System.Security/NamedPermissionSet.cs66
-rw-r--r--mcs/class/corlib/System.Security/PermissionSet.cs202
-rw-r--r--mcs/class/corlib/System.Security/PolicyLevelType.cs18
-rwxr-xr-xmcs/class/corlib/System.Security/SecurityElement.cs206
-rw-r--r--mcs/class/corlib/System.Security/SecurityException.cs79
-rw-r--r--mcs/class/corlib/System.Security/SecurityManager.cs88
-rw-r--r--mcs/class/corlib/System.Security/SecurityZone.cs20
-rw-r--r--mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs13
-rw-r--r--mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs13
-rw-r--r--mcs/class/corlib/System.Security/VerificationException.cs26
-rw-r--r--mcs/class/corlib/System.Security/XmlSyntaxException.cs27
-rwxr-xr-xmcs/class/corlib/System.Text/ASCIIEncoding.cs166
-rwxr-xr-xmcs/class/corlib/System.Text/ChangeLog106
-rw-r--r--mcs/class/corlib/System.Text/Decoder.cs71
-rw-r--r--mcs/class/corlib/System.Text/Encoder.cs81
-rwxr-xr-xmcs/class/corlib/System.Text/Encoding.cs384
-rw-r--r--mcs/class/corlib/System.Text/StringBuilder.cs619
-rwxr-xr-xmcs/class/corlib/System.Text/UTF7Encoding.cs42
-rwxr-xr-xmcs/class/corlib/System.Text/UTF8Encoding.cs38
-rwxr-xr-xmcs/class/corlib/System.Text/UnicodeEncoding.cs55
-rwxr-xr-xmcs/class/corlib/System.Threading/ApartmentState.cs18
-rwxr-xr-xmcs/class/corlib/System.Threading/AutoResetEvent.cs35
-rw-r--r--mcs/class/corlib/System.Threading/ChangeLog141
-rwxr-xr-xmcs/class/corlib/System.Threading/IOCompletionCallback.cs18
-rwxr-xr-xmcs/class/corlib/System.Threading/Interlocked.cs51
-rwxr-xr-xmcs/class/corlib/System.Threading/LockCookie.cs17
-rwxr-xr-xmcs/class/corlib/System.Threading/ManualResetEvent.cs38
-rwxr-xr-xmcs/class/corlib/System.Threading/Monitor.cs219
-rwxr-xr-xmcs/class/corlib/System.Threading/Mutex.cs49
-rwxr-xr-xmcs/class/corlib/System.Threading/NativeEventCalls.cs28
-rwxr-xr-xmcs/class/corlib/System.Threading/NativeOverlapped.cs27
-rwxr-xr-xmcs/class/corlib/System.Threading/Overlapped.cs92
-rwxr-xr-xmcs/class/corlib/System.Threading/ReaderWriterLock.cs109
-rwxr-xr-xmcs/class/corlib/System.Threading/RegisteredWaitHandle.cs28
-rwxr-xr-xmcs/class/corlib/System.Threading/SynchronizationLockException.cs33
-rwxr-xr-xmcs/class/corlib/System.Threading/Thread.cs426
-rwxr-xr-xmcs/class/corlib/System.Threading/ThreadAbortException.cs26
-rwxr-xr-xmcs/class/corlib/System.Threading/ThreadInterruptedException.cs33
-rwxr-xr-xmcs/class/corlib/System.Threading/ThreadPool.cs245
-rw-r--r--mcs/class/corlib/System.Threading/ThreadPriority.cs41
-rwxr-xr-xmcs/class/corlib/System.Threading/ThreadStart.cs14
-rw-r--r--mcs/class/corlib/System.Threading/ThreadState.cs55
-rwxr-xr-xmcs/class/corlib/System.Threading/ThreadStateException.cs33
-rwxr-xr-xmcs/class/corlib/System.Threading/Timeout.cs18
-rwxr-xr-xmcs/class/corlib/System.Threading/Timer.cs112
-rwxr-xr-xmcs/class/corlib/System.Threading/TimerCallback.cs14
-rwxr-xr-xmcs/class/corlib/System.Threading/WaitCallback.cs14
-rwxr-xr-xmcs/class/corlib/System.Threading/WaitHandle.cs204
-rwxr-xr-xmcs/class/corlib/System.Threading/WaitOrTimerCallback.cs14
-rw-r--r--mcs/class/corlib/System/Activator.cs111
-rwxr-xr-xmcs/class/corlib/System/AppDomain.cs462
-rwxr-xr-xmcs/class/corlib/System/AppDomainSetup.cs161
-rw-r--r--mcs/class/corlib/System/AppDomainUnloadedException.cs42
-rw-r--r--mcs/class/corlib/System/ApplicationException.cs42
-rw-r--r--mcs/class/corlib/System/ArgumentException.cs65
-rw-r--r--mcs/class/corlib/System/ArgumentNullException.cs38
-rw-r--r--mcs/class/corlib/System/ArgumentOutOfRangeException.cs63
-rw-r--r--mcs/class/corlib/System/ArithmeticException.cs38
-rw-r--r--mcs/class/corlib/System/Array.cs835
-rw-r--r--mcs/class/corlib/System/ArrayTypeMismatchException.cs38
-rwxr-xr-xmcs/class/corlib/System/AssemblyLoadEventArgs.cs34
-rwxr-xr-xmcs/class/corlib/System/AssemblyLoadEventHandler.cs10
-rw-r--r--mcs/class/corlib/System/AsyncCallback.cs13
-rw-r--r--mcs/class/corlib/System/Attribute.cs386
-rw-r--r--mcs/class/corlib/System/AttributeTargets.cs82
-rw-r--r--mcs/class/corlib/System/AttributeUsage.cs50
-rw-r--r--mcs/class/corlib/System/BadImageFormatException.cs93
-rwxr-xr-xmcs/class/corlib/System/BitConverter.cs270
-rw-r--r--mcs/class/corlib/System/Boolean.cs266
-rwxr-xr-xmcs/class/corlib/System/Buffer.cs70
-rw-r--r--mcs/class/corlib/System/Byte.cs249
-rwxr-xr-xmcs/class/corlib/System/CLSCompliantAttribute.cs35
-rw-r--r--mcs/class/corlib/System/CannotUnloadAppDomainException.cs41
-rw-r--r--mcs/class/corlib/System/ChangeLog1901
-rw-r--r--mcs/class/corlib/System/Char.cs403
-rw-r--r--mcs/class/corlib/System/CharEnumerator.cs90
-rw-r--r--mcs/class/corlib/System/Console.cs317
-rw-r--r--mcs/class/corlib/System/ContextBoundObject.cs25
-rw-r--r--mcs/class/corlib/System/ContextMarshalException.cs42
-rwxr-xr-xmcs/class/corlib/System/ContextStaticAttribute.cs28
-rw-r--r--mcs/class/corlib/System/Convert.cs2371
-rwxr-xr-xmcs/class/corlib/System/CrossAppDomainDelegate.cs10
-rw-r--r--mcs/class/corlib/System/DBNull.cs133
-rw-r--r--mcs/class/corlib/System/DateTime.cs1462
-rw-r--r--mcs/class/corlib/System/Decimal.cs1028
-rw-r--r--mcs/class/corlib/System/DecimalFormatter.cs389
-rw-r--r--mcs/class/corlib/System/Delegate.cs196
-rw-r--r--mcs/class/corlib/System/DivideByZeroException.cs31
-rw-r--r--mcs/class/corlib/System/DllNotFoundException.cs42
-rw-r--r--mcs/class/corlib/System/Double.cs297
-rw-r--r--mcs/class/corlib/System/DuplicateWaitObjectException.cs39
-rw-r--r--mcs/class/corlib/System/EntryPointNotFoundException.cs42
-rw-r--r--mcs/class/corlib/System/Enum.cs571
-rw-r--r--mcs/class/corlib/System/Environment.cs305
-rw-r--r--mcs/class/corlib/System/EventArgs.cs26
-rw-r--r--mcs/class/corlib/System/EventHandler.cs16
-rw-r--r--mcs/class/corlib/System/Exception.cs159
-rw-r--r--mcs/class/corlib/System/ExecutionEngineException.cs31
-rw-r--r--mcs/class/corlib/System/FieldAccessException.cs41
-rwxr-xr-xmcs/class/corlib/System/FlagsAttribute.cs29
-rw-r--r--mcs/class/corlib/System/FormatException.cs39
-rwxr-xr-xmcs/class/corlib/System/GC.cs65
-rwxr-xr-xmcs/class/corlib/System/Guid.cs654
-rw-r--r--mcs/class/corlib/System/IAppDomainSetup.cs37
-rw-r--r--mcs/class/corlib/System/IAsyncResult.cs43
-rw-r--r--mcs/class/corlib/System/ICloneable.cs15
-rw-r--r--mcs/class/corlib/System/IComparable.cs15
-rw-r--r--mcs/class/corlib/System/IConvertible.cs55
-rw-r--r--mcs/class/corlib/System/ICustomFormatter.cs15
-rw-r--r--mcs/class/corlib/System/IDisposable.cs17
-rw-r--r--mcs/class/corlib/System/IFormatProvider.cs15
-rw-r--r--mcs/class/corlib/System/IFormattable.cs15
-rw-r--r--mcs/class/corlib/System/IServiceProvider.cs18
-rw-r--r--mcs/class/corlib/System/IndexOutOfRangeException.cs31
-rw-r--r--mcs/class/corlib/System/Int16.cs237
-rw-r--r--mcs/class/corlib/System/Int32.cs490
-rw-r--r--mcs/class/corlib/System/Int64.cs503
-rw-r--r--mcs/class/corlib/System/IntPtr.cs165
-rw-r--r--mcs/class/corlib/System/IntegerFormatter.cs4027
-rw-r--r--mcs/class/corlib/System/InvalidCastException.cs39
-rw-r--r--mcs/class/corlib/System/InvalidOperationException.cs38
-rw-r--r--mcs/class/corlib/System/InvalidProgramException.cs31
-rw-r--r--mcs/class/corlib/System/LoaderOptimization.cs18
-rw-r--r--mcs/class/corlib/System/LoaderOptimizationAttribute.cs34
-rwxr-xr-xmcs/class/corlib/System/LocalDataStoreSlot.cs18
-rw-r--r--mcs/class/corlib/System/MTAThreadAttribute.cs19
-rw-r--r--mcs/class/corlib/System/MarshalByRefObject.cs36
-rw-r--r--mcs/class/corlib/System/Math.cs312
-rw-r--r--mcs/class/corlib/System/MemberAccessException.cs29
-rw-r--r--mcs/class/corlib/System/MethodAccessException.cs42
-rw-r--r--mcs/class/corlib/System/MissingFieldException.cs45
-rw-r--r--mcs/class/corlib/System/MissingMemberException.cs73
-rw-r--r--mcs/class/corlib/System/MissingMethodException.cs32
-rwxr-xr-xmcs/class/corlib/System/MonoCustomAttrs.cs60
-rw-r--r--mcs/class/corlib/System/MonoDummy.cs20
-rw-r--r--mcs/class/corlib/System/MonoType.cs285
-rw-r--r--mcs/class/corlib/System/MulticastDelegate.cs151
-rw-r--r--mcs/class/corlib/System/MulticastNotSupportedException.cs31
-rwxr-xr-xmcs/class/corlib/System/NonSerializedAttribute.cs18
-rw-r--r--mcs/class/corlib/System/NotFiniteNumberException.cs67
-rwxr-xr-xmcs/class/corlib/System/NotImplementedException.cs39
-rw-r--r--mcs/class/corlib/System/NotSupportedException.cs39
-rw-r--r--mcs/class/corlib/System/NullReferenceException.cs39
-rw-r--r--mcs/class/corlib/System/Object.cs108
-rwxr-xr-xmcs/class/corlib/System/ObjectDisposedException.cs60
-rw-r--r--mcs/class/corlib/System/ObsoleteAttribute.cs48
-rw-r--r--mcs/class/corlib/System/OperatingSystem.cs106
-rw-r--r--mcs/class/corlib/System/OutOfMemoryException.cs39
-rw-r--r--mcs/class/corlib/System/OverflowException.cs39
-rw-r--r--mcs/class/corlib/System/ParamArrayAttribute.cs23
-rw-r--r--mcs/class/corlib/System/PlatformID.cs37
-rw-r--r--mcs/class/corlib/System/PlatformNotSupportedException.cs41
-rw-r--r--mcs/class/corlib/System/Random.cs83
-rw-r--r--mcs/class/corlib/System/RankException.cs40
-rw-r--r--mcs/class/corlib/System/ResolveEventArgs.cs29
-rw-r--r--mcs/class/corlib/System/ResolveEventHandler.cs10
-rw-r--r--mcs/class/corlib/System/RuntimeArgumentHandle.cs16
-rwxr-xr-xmcs/class/corlib/System/RuntimeFieldHandle.cs45
-rwxr-xr-xmcs/class/corlib/System/RuntimeMethodHandle.cs34
-rw-r--r--mcs/class/corlib/System/RuntimeTypeHandle.cs31
-rw-r--r--mcs/class/corlib/System/SByte.cs227
-rw-r--r--mcs/class/corlib/System/STAThreadAttribute.cs19
-rwxr-xr-xmcs/class/corlib/System/SerializableAttribute.cs38
-rw-r--r--mcs/class/corlib/System/Single.cs201
-rw-r--r--mcs/class/corlib/System/StackOverflowException.cs39
-rw-r--r--mcs/class/corlib/System/String.cs1090
-rw-r--r--mcs/class/corlib/System/SystemException.cs38
-rw-r--r--mcs/class/corlib/System/TODO22
-rw-r--r--mcs/class/corlib/System/TODOAttribute.cs37
-rw-r--r--mcs/class/corlib/System/ThreadStaticAttribute.cs20
-rw-r--r--mcs/class/corlib/System/TimeSpan.cs551
-rw-r--r--mcs/class/corlib/System/TimeZone.cs193
-rw-r--r--mcs/class/corlib/System/Type.cs840
-rw-r--r--mcs/class/corlib/System/TypeCode.cs93
-rw-r--r--mcs/class/corlib/System/TypeInitializationException.cs40
-rw-r--r--mcs/class/corlib/System/TypeLoadException.cs73
-rw-r--r--mcs/class/corlib/System/TypeUnloadedException.cs43
-rw-r--r--mcs/class/corlib/System/UInt16.cs232
-rw-r--r--mcs/class/corlib/System/UInt32.cs498
-rw-r--r--mcs/class/corlib/System/UInt64.cs436
-rw-r--r--mcs/class/corlib/System/UIntPtr.cs180
-rwxr-xr-xmcs/class/corlib/System/UnauthorizedAccessException.cs38
-rwxr-xr-xmcs/class/corlib/System/UnhandledExceptionEventArgs.cs43
-rwxr-xr-xmcs/class/corlib/System/UnhandledExceptionEventHandler.cs10
-rw-r--r--mcs/class/corlib/System/ValueType.cs48
-rw-r--r--mcs/class/corlib/System/Version.cs277
-rw-r--r--mcs/class/corlib/System/Void.cs15
-rwxr-xr-xmcs/class/corlib/System/WeakReference.cs119
-rwxr-xr-xmcs/class/corlib/System/_AppDomain.cs161
-rw-r--r--mcs/class/corlib/Test/.cvsignore2
-rw-r--r--mcs/class/corlib/Test/AllTests.cs38
-rw-r--r--mcs/class/corlib/Test/ChangeLog185
-rwxr-xr-xmcs/class/corlib/Test/MartinTests.cs30
-rw-r--r--mcs/class/corlib/Test/System.Collections/AllTests.cs37
-rw-r--r--mcs/class/corlib/Test/System.Collections/ArrayListTest.cs1376
-rw-r--r--mcs/class/corlib/Test/System.Collections/BitArrayTest.cs300
-rw-r--r--mcs/class/corlib/Test/System.Collections/CaseInsensitiveComparerTest.cs50
-rw-r--r--mcs/class/corlib/Test/System.Collections/CaseInsensitiveHashCodeProviderTest.cs57
-rw-r--r--mcs/class/corlib/Test/System.Collections/ChangeLog28
-rw-r--r--mcs/class/corlib/Test/System.Collections/CollectionBaseTest.cs236
-rw-r--r--mcs/class/corlib/Test/System.Collections/ComparerTest.cs60
-rw-r--r--mcs/class/corlib/Test/System.Collections/HashtableTest.cs761
-rw-r--r--mcs/class/corlib/Test/System.Collections/QueueTest.cs179
-rw-r--r--mcs/class/corlib/Test/System.Collections/ReadOnlyCollectionBaseTest.cs49
-rwxr-xr-xmcs/class/corlib/Test/System.Collections/SortedListTest.cs625
-rw-r--r--mcs/class/corlib/Test/System.Collections/StackTest.cs270
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/AllTests.cs31
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/ChangeLog4
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/DebugTest.cs89
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs350
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/StackTraceTest.cs98
-rw-r--r--mcs/class/corlib/Test/System.Diagnostics/TextWriterTraceListenerTest.cs83
-rw-r--r--mcs/class/corlib/Test/System.Globalization/AllTests.cs28
-rw-r--r--mcs/class/corlib/Test/System.Globalization/CalendarTest.cs602
-rw-r--r--mcs/class/corlib/Test/System.IO/AllTests.cs34
-rw-r--r--mcs/class/corlib/Test/System.IO/ChangeLog24
-rw-r--r--mcs/class/corlib/Test/System.IO/FileTest.cs72
-rw-r--r--mcs/class/corlib/Test/System.IO/MemoryStreamTest.cs154
-rw-r--r--mcs/class/corlib/Test/System.IO/PathTest.cs149
-rw-r--r--mcs/class/corlib/Test/System.IO/StreamReaderTest.cs488
-rw-r--r--mcs/class/corlib/Test/System.IO/StreamWriterTest.cs319
-rw-r--r--mcs/class/corlib/Test/System.IO/StringReaderTest.cs122
-rw-r--r--mcs/class/corlib/Test/System.IO/StringWriterTest.cs56
-rw-r--r--mcs/class/corlib/Test/System.Net/AllTests.cs30
-rw-r--r--mcs/class/corlib/Test/System.Net/ChangeLog27
-rw-r--r--mcs/class/corlib/Test/System.Net/IPAddressTest.cs175
-rw-r--r--mcs/class/corlib/Test/System.Net/IPEndPointTest.cs134
-rw-r--r--mcs/class/corlib/Test/System.Resources/AllTests.cs27
-rw-r--r--mcs/class/corlib/Test/System.Resources/ChangeLog17
-rw-r--r--mcs/class/corlib/Test/System.Resources/Empty.resources0
-rw-r--r--mcs/class/corlib/Test/System.Resources/MyResources.resourcesbin0 -> 412 bytes
-rw-r--r--mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs144
-rwxr-xr-xmcs/class/corlib/Test/System.Runtime.Serialization/ObjectIDGeneratorTests.cs87
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/AllTests.cs30
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Cryptography/AsymmetricAlgorithmTest.cs54
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/RNGCryptoServiceProviderTest.cs55
-rwxr-xr-xmcs/class/corlib/Test/System.Security.Cryptography/SymmetricAlgorithmTest.cs65
-rw-r--r--mcs/class/corlib/Test/System.Security.Permissions/AllTests.cs27
-rw-r--r--mcs/class/corlib/Test/System.Security.Permissions/ChangeLog11
-rw-r--r--mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs284
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/AllTests.cs27
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/ChangeLog15
-rw-r--r--mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs248
-rwxr-xr-xmcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs192
-rw-r--r--mcs/class/corlib/Test/System.Text/AllTests.cs30
-rw-r--r--mcs/class/corlib/Test/System.Text/ChangeLog13
-rw-r--r--mcs/class/corlib/Test/System.Text/StringBuilderTest.cs238
-rw-r--r--mcs/class/corlib/Test/System/AllTests.cs56
-rw-r--r--mcs/class/corlib/Test/System/ArrayTest.cs1996
-rwxr-xr-xmcs/class/corlib/Test/System/AttributeTest.cs155
-rwxr-xr-xmcs/class/corlib/Test/System/BitConverterTest.cs545
-rw-r--r--mcs/class/corlib/Test/System/BooleanTest.cs113
-rw-r--r--mcs/class/corlib/Test/System/ByteTest.cs182
-rw-r--r--mcs/class/corlib/Test/System/ChangeLog301
-rwxr-xr-xmcs/class/corlib/Test/System/CharEnumeratorTest.cs123
-rw-r--r--mcs/class/corlib/Test/System/CharTest.cs500
-rw-r--r--mcs/class/corlib/Test/System/ConsoleTest.cs286
-rwxr-xr-xmcs/class/corlib/Test/System/DateTimeTest.cs327
-rw-r--r--mcs/class/corlib/Test/System/DecimalTest.cs855
-rw-r--r--mcs/class/corlib/Test/System/DecimalTest2.cs3126
-rw-r--r--mcs/class/corlib/Test/System/DoubleTest.cs169
-rw-r--r--mcs/class/corlib/Test/System/EnumTest.cs728
-rwxr-xr-xmcs/class/corlib/Test/System/GuidTest.cs247
-rw-r--r--mcs/class/corlib/Test/System/Int16Test.cs193
-rw-r--r--mcs/class/corlib/Test/System/Int32Test.cs238
-rw-r--r--mcs/class/corlib/Test/System/Int64Test.cs330
-rw-r--r--mcs/class/corlib/Test/System/IntegerFormatterTest.cs2016
-rwxr-xr-xmcs/class/corlib/Test/System/MartinTests.cs73
-rwxr-xr-xmcs/class/corlib/Test/System/MathTest.cs589
-rw-r--r--mcs/class/corlib/Test/System/ObjectTest.cs121
-rw-r--r--mcs/class/corlib/Test/System/RandomTest.cs79
-rw-r--r--mcs/class/corlib/Test/System/ResolveEventArgsTest.cs30
-rw-r--r--mcs/class/corlib/Test/System/SByteTest.cs180
-rw-r--r--mcs/class/corlib/Test/System/StringTest.cs1077
-rwxr-xr-xmcs/class/corlib/Test/System/TimeSpanTest.cs266
-rw-r--r--mcs/class/corlib/Test/System/TimeZoneTest.cs71
-rw-r--r--mcs/class/corlib/Test/System/UInt16Test.cs194
-rw-r--r--mcs/class/corlib/Test/System/UInt32Test.cs200
-rw-r--r--mcs/class/corlib/Test/System/UInt64Test.cs188
-rw-r--r--mcs/class/corlib/Test/System/VersionTest.cs244
-rwxr-xr-xmcs/class/corlib/Test/TheTests.cs560
-rw-r--r--mcs/class/corlib/Test/corlib_test.build94
-rwxr-xr-xmcs/class/corlib/Unix/Errno.cs139
-rw-r--r--mcs/class/corlib/Unix/Wrapper.cs237
-rw-r--r--mcs/class/corlib/Unix/common.src1
-rw-r--r--mcs/class/corlib/Unix/mono.src0
-rw-r--r--mcs/class/corlib/Unix/windows.src0
-rw-r--r--mcs/class/corlib/Windows/Windows.cs694
-rw-r--r--mcs/class/corlib/corlib.build127
-rwxr-xr-xmcs/class/corlib/list587
-rw-r--r--mcs/class/library.build36
-rw-r--r--mcs/class/makefile13
-rw-r--r--mcs/class/notes/BitVecto32.txt6
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom.Compiler/CodeGenerator.xml117
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom.Compiler/ICodeGenerator.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeArrayCreateExpression.xml50
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeAssignStatement.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttachEventStatement.xml34
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeArgument.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeArgumentCollection.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeBlock.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeDeclaration.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeDeclarationCollection.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeBaseReferenceExpression.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeBinaryOperatorExpression.xml34
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeBinaryOperatorType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeCastExpression.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeCatchClause.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeCatchClauseCollection.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeClass.xml52
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassCollection.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassConstructor.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassDelegate.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassMember.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassMemberCollection.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeCommentStatement.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeConstructor.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateCreateExpression.xml34
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateInvokeExpression.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateInvokeStatement.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeDetachEventStatement.xml34
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeExpression.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeExpressionCollection.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeFieldReferenceExpression.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeForLoopStatement.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeIfStatement.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeIndexerExpression.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeLinePragma.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralClassMember.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralExpression.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralNamespace.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralStatement.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberEvent.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberField.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberMethod.xml37
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberProperty.xml52
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodInvokeExpression.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodInvokeStatement.xml50
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodReturnStatement.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespace.xml47
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespaceImport.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespaceImportCollection.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeObject.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeObjectCreateExpression.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeParameterDeclarationExpression.xml38
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeParameterDeclarationExpressionCollection.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodePrimitiveExpression.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodePropertyReferenceExpression.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeStatement.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeStatementCollection.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeThisReferenceExpression.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeThrowExceptionStatement.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeTryCatchFinallyStatement.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeDeclaration.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeMember.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeOfExpression.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeReferenceExpression.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/CodeVariableDeclarationStatement.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/FieldDirection.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.CodeDom/MemberAttributes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections.Specialized/BitVector32.xml51
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections.Specialized/KeysCollection.xml41
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections.Specialized/ListDictionary.xml88
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections.Specialized/NameObjectCollectionBase.xml68
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections.Specialized/NameValueCollection.xml123
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections.Specialized/Section.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringCollection.xml102
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringDictionary.xml84
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringEnumerator.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/ArrayList.xml326
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/BitArray.xml128
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/CaseInsensitiveComparer.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/CaseInsensitiveHashCodeProvider.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/CollectionBase.xml39
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/Comparer.xml19
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/DictionaryBase.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/DictionaryEntry.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/EnumeratorMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/Hashtable.xml192
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/ICollection.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/IComparer.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/IDictionary.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/IDictionaryEnumerator.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/IEnumerable.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/IEnumerator.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/IHashCodeProvider.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/IList.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/Queue.xml98
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/ReadOnlyCollectionBase.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/SortedList.xml195
-rw-r--r--mcs/docs/apidocs/xml/en/System.Collections/Stack.xml92
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/BrowsableAttribute.xml26
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/CategoryAttribute.xml87
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/Component.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/ComponentCollection.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/Container.xml41
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/DescriptionAttribute.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/DesignOnlyAttribute.xml26
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/DesignerSerializationVisibility.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/DesignerSerializationVisibilityAttribute.xml30
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/EventHandlerList.xml36
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/IComponent.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/IContainer.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/ISite.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/LocalizableAttribute.xml26
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/MemberDescriptor.xml48
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/PropertyDescriptor.xml45
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/TypeConverter.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.ComponentModel/Win32Exception.xml35
-rw-r--r--mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyHash.xml44
-rw-r--r--mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyHashAlgorithm.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyVersionCompatibility.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/ProcessorID.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Configuration/ConfigurationException.xml90
-rw-r--r--mcs/docs/apidocs/xml/en/System.Configuration/ConfigurationSettings.xml19
-rw-r--r--mcs/docs/apidocs/xml/en/System.Configuration/DictionarySectionHandler.xml30
-rw-r--r--mcs/docs/apidocs/xml/en/System.Configuration/IConfigurationSectionHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Configuration/IgnoreSectionHandler.xml20
-rw-r--r--mcs/docs/apidocs/xml/en/System.Configuration/NameValueSectionHandler.xml30
-rw-r--r--mcs/docs/apidocs/xml/en/System.Configuration/SingleTagSectionHandler.xml20
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/AcceptRejectRule.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/CommandBehavior.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/CommandType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/ConnectionState.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/DataColumnChangeEventArgs.xml30
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/DataColumnChangeEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/DataColumnCollection.xml113
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/DataRowAction.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/DataRowChangeEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/DataRowState.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/DataRowVersion.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/DataViewRowState.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/DbType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/FillErrorEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IColumnMapping.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IColumnMappingCollection.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IDBCommand.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IDBConnection.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IDataAdapter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IDataParameter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IDataParameterCollection.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IDataReader.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IDataRecord.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IDbDataAdapter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IDbDataParameter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IDbTransaction.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/ITableMapping.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/ITableMappingCollection.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/IsolationLevel.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/MappingType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/MergeFailedEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/MissingMappingAction.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/MissingSchemaAction.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/ParameterDirection.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/PropertyAttributes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/Rule.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/SchemaType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/SqlDbType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/StateChangeEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/StatementType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/UpdateRowSource.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/UpdateStatus.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/XmlReadMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Data/XmlWriteMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolBinder.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolDocument.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolMethod.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolNamespace.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolReader.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolScope.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolVariable.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolWriter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymAddressKind.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymDocumentType.xml16
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymLanguageType.xml56
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymLanguageVendor.xml16
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymbolToken.xml29
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/BooleanSwitch.xml19
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/ConditionalAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/Debug.xml194
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggableAttribute.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/Debugger.xml44
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggerHiddenAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggerStepThroughAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/DefaultTraceListener.xml47
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/DiagnosticsConfigurationHandler.xml20
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/FileVersionInfo.xml158
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/Process.xml340
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/ProcessModule.xml47
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/ProcessPriorityClass.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/StackFrame.xml91
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/StackTrace.xml94
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/Switch.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/TextWriterTraceListener.xml72
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/Trace.xml194
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/TraceLevel.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/TraceListener.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/TraceListenerCollection.xml95
-rw-r--r--mcs/docs/apidocs/xml/en/System.Diagnostics/TraceSwitch.xml39
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/CCGregorianEraHandler.xml64
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/CCHijriCalendar.xml88
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/Calendar.xml283
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/CalendarWeekRule.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/CompareOptions.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/CultureInfo.xml87
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/CultureTypes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/DateTimeFormatInfo.xml212
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/DateTimeStyles.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/DaylightTime.xml30
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/GregorianCalendar.xml140
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/GregorianCalendarTypes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/HebrewCalendar.xml201
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/HijriCalendar.xml201
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/JapaneseCalendar.xml198
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/JulianCalendar.xml130
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/KoreanCalendar.xml130
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/Month.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/NumberFormatInfo.xml175
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/NumberStyles.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/RegionInfo.xml59
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/TaiwanCalendar.xml198
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/ThaiBuddhistCalendar.xml130
-rw-r--r--mcs/docs/apidocs/xml/en/System.Globalization/UnicodeCategory.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorage.xml48
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageFileStream.xml14
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageScope.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/BinaryReader.xml142
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/BinaryWriter.xml162
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/BufferedStream.xml99
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/Directory.xml146
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/DirectoryInfo.xml99
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/DirectoryNotFoundException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/EndOfStreamException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/File.xml155
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/FileAccess.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/FileAttributes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/FileInfo.xml113
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/FileLoadException.xml45
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/FileMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/FileNotFoundException.xml63
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/FileShare.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/FileStream.xml163
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/FileSystemInfo.xml58
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/IOException.xml29
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/MemoryStream.xml148
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/Path.xml100
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/PathTooLongException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/SeekOrigin.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/Stream.xml124
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/StreamReader.xml124
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/StreamWriter.xml86
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/StringReader.xml46
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/StringWriter.xml68
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/TextReader.xml59
-rw-r--r--mcs/docs/apidocs/xml/en/System.IO/TextWriter.xml270
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/AddressFamily.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/LingerOption.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/MulticastOption.xml29
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/NetworkStream.xml148
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/ProtocolFamily.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/ProtocolType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/SelectMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/Socket.xml396
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketException.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketFlags.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketOptionLevel.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketOptionName.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketShutdown.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/TcpClient.xml98
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net.Sockets/TcpListener.xml64
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/Authorization.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/ConnectionModes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/Dns.xml65
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/EndPoint.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/HttpStatusCode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/ICredentials.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/IPAddress.xml103
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/IPEndPoint.xml59
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/IPHostEntry.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/NetworkAccess.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/NetworkCredential.xml47
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/ProxyUseType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/SocketAddress.xml39
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/TransportType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/WebExceptionStatus.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Net/WebStatus.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/AssemblyBuilder.xml159
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/AssemblyBuilderAccess.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/ConstructorBuilder.xml169
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/CustomAttributeBuilder.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/EnumBuilder.xml240
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/EventBuilder.xml50
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/EventToken.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/FieldBuilder.xml110
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/FieldToken.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/FlowControl.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/ILGenerator.xml242
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/Label.xml19
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/LocalBuilder.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/MethodBuilder.xml143
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/MethodToken.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/ModuleBuilder.xml128
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCode.xml48
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCodeType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCodes.xml906
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/OperandType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/PEFileKinds.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/PackingSize.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/ParameterBuilder.xml68
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/ParameterToken.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/PropertyBuilder.xml164
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/PropertyToken.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/SignatureHelper.xml76
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/SignatureToken.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/StackBehaviour.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/StringToken.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/TypeBuilder.xml403
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/TypeToken.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection.Emit/UnmanagedMarshal.xml62
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AmbiguousMatchException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/Assembly.xml277
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyAlgorithmIdAttribute.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCompanyAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyConfigurationAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCopyrightAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCultureAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDefaultAliasAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDelaySignAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDescriptionAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyFileVersionAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyFlagsAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyInformationalVersionAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyKeyFileAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyKeyNameAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyName.xml45
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyNameFlags.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyNameProxy.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyProductAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyTitleAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyTrademarkAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/AssemblyVersionAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/Binder.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/BindingFlags.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/CallingConventions.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/ConstructorInfo.xml36
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/CustomAttributeFormatException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/DefaultMemberAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/EventAttributes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/EventInfo.xml115
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/FieldAttributes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/FieldInfo.xml66
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/ICustomAttributeProvider.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/IReflect.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/InterfaceMapping.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/InvalidFilterCriteriaException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/ManifestResourceInfo.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/MemberFilter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/MemberInfo.xml48
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/MemberTypes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/MethodAttributes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/MethodBase.xml126
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/MethodImplAttributes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/MethodInfo.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/Missing.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/Module.xml158
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/MonoEvent.xml45
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/ParameterAttributes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/ParameterInfo.xml83
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/ParameterModifier.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/PropertyAttributes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/PropertyInfo.xml112
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/ReflectionTypeLoadException.xml38
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/ResourceAttributes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/ResourceLocation.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/StrongNameKeyPair.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/TargetException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/TargetInvocationException.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/TargetParameterCountException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/TypeAttributes.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/TypeDelegator.xml195
-rw-r--r--mcs/docs/apidocs/xml/en/System.Reflection/TypeFilter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Resources/IResourceReader.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Resources/IResourceWriter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Resources/MissingManifestResourceException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Resources/NeutralResourcesLanguageAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Resources/ResourceManager.xml79
-rw-r--r--mcs/docs/apidocs/xml/en/System.Resources/ResourceReader.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Resources/ResourceSet.xml69
-rw-r--r--mcs/docs/apidocs/xml/en/System.Resources/ResourceWriter.xml54
-rw-r--r--mcs/docs/apidocs/xml/en/System.Resources/SatelliteContractVersionAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/IndexerNameAttribute.xml13
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodCodeType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodImplAttribute.xml31
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodImplOptions.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/RuntimeHelpers.xml20
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/AssemblyRegistrationFlags.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/CallingConvention.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/CharSet.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ClassInterfaceAttribute.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ClassInterfaceType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ComInterfaceType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/DllImportAttribute.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ExporterEventKind.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ExternalException.xml34
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/FieldOffsetAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GCHandle.xml53
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GCHandleType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GuidAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomAdapter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomFactory.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomMarshaler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/IRegistrationServices.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibConverter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibExporterNameProvider.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibExporterNotifySink.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibImporterNotifySink.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ImporterEventKind.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/InAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/InterfaceTypeAttribute.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/LayoutKind.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/MarshalAsAttribute.xml51
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/OptionalAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/OutAttribute.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/PInvokeMap.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/StructLayoutAttribute.xml35
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/TypeLibExporterFlags.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/UnmanagedType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/VarEnum.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/ActivatorLevel.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IActivator.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IConstructionCallMessage.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IConstructionReturnMessage.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/Context.xml34
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/ContextAttribute.xml53
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IContextAttribute.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IContextProperty.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IDynamicMessageSink.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IDynamicProperty.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/SynchronizationAttribute.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/AsyncResult.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/Header.xml45
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessage.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessageCtrl.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessageSink.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodCallMessage.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodMessage.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodReturnMessage.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/LogicalCallContext.xml44
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Proxies/RealProxy.xml19
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting/LeaseState.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting/ObjRef.xml41
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting/ObjectHandle.xml29
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting/RemotingServices.xml21
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting/SoapMethodOption.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting/SoapOption.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Remoting/WellKnownObjectMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters.Binary/BinaryArrayTypeEnum.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterTypeStyle.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/IFieldInfo.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/ISoapMessage.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalArrayTypeE.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalElementTypeE.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalMemberTypeE.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalMemberValueE.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalNameSpaceE.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalObjectPositionE.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalObjectTypeE.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalParseStateE.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalParseTypeE.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IDeserializationCallback.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IFormatter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IFormatterConverter.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IObjectReference.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISerializable.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISerializationSurrogate.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISurrogateSelector.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ObjectIDGenerator.xml26
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationBinder.xml15
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationEntry.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationInfo.xml250
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationInfoEnumerator.xml38
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/StreamingContext.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/StreamingContextStates.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SurrogateSelector.xml46
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography.X509Certificates/X509Certificate.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricAlgorithm.xml57
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.xml29
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.xml36
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricSignatureDeformatter.xml38
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricSignatureFormatter.xml36
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/CipherMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoAPITransform.xml50
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoStream.xml79
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoStreamMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptographicException.xml34
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptographicUnexpectedOperationException.xml29
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/CspParameters.xml51
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/CspProviderFlags.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/DES.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/DESCryptoServiceProvider.xml37
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSA.xml56
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSACryptoServiceProvider.xml124
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSAParameters.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSASignatureDeformatter.xml36
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSASignatureFormatter.xml35
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/DeriveBytes.xml19
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/FromBase64Transform.xml55
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/FromBase64TransformMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/HashAlgorithm.xml73
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/ICryptoTransform.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/KeySizes.xml30
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/MD5.xml19
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/MD5CryptoServiceProvider.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/PaddingMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/RNGCryptoServiceProvider.xml39
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/RSA.xml59
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/RSAParameters.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/RandomNumberGenerator.xml35
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/Rijndael.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/RijndaelManaged.xml36
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA1.xml19
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA1CryptoServiceProvider.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA256.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA256Managed.xml32
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA384.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA384Managed.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA512.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA512Managed.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/SignatureDescription.xml50
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/SymmetricAlgorithm.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Cryptography/ToBase64Transform.xml50
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/CodeAccessSecurityAttribute.xml13
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/EnvironmentPermissionAccess.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/EnvironmentPermissionAttribute.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/FileDialogPermissionAccess.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/FileDialogPermissionAttribute.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermission.xml108
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermissionAccess.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermissionAttribute.xml43
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/IUnrestrictedPermission.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStorageContainment.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStoragePermission.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStoragePermissionAttribute.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/PermissionSetAttribute.xml43
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/PermissionState.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/PrinciplePermissionAttribute.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/ReflectionPermissionAttribute.xml38
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/ReflectionPermissionFlag.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/RegistryPermissionAccess.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/RegistryPermissionAttribute.xml38
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityAction.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityAttribute.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityPermission.xml62
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityPermissionFlag.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/SiteIdentityPermissionAttribute.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/StrongNameIdentityPermissionAttribute.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionAttribute.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionClipboard.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionWindow.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/UrlIdentityPermissionAttribute.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Permissions/ZoneIdentityPermissionAttribute.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Policy/AllMembershipCondition.xml63
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Policy/ApplicationDirectoryMembershipCondition.xml63
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Policy/CodeGroup.xml125
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Policy/Evidence.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Policy/FileCodeGroup.xml57
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Policy/IIdentityPermissionFactory.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Policy/IMembershipCondition.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyLevel.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyStatement.xml58
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyStatementAttribute.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Principal/GenericIdentity.xml34
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Principal/GenericPrincipal.xml25
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Principal/IIdentity.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Principal/IPrincipal.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security.Principal/PrincipalPolicy.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/CodeAccessPermission.xml67
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/IEvidenceFactory.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/IPermission.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/ISecurityEncodable.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/ISecurityPolicyEncodable.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/IStackWalk.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/NamedPermissionSet.xml62
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/PermissionSet.xml89
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/PolicyLevelType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/SecurityElement.xml94
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/SecurityException.xml58
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/SecurityManager.xml76
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/SecurityZone.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/SuppressUnmanagedCodeSecurityAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/UnverifiableCodeAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/VerificationException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Security/XmlSyntaxException.xml34
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Capture.xml48
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/CaptureCollection.xml13
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/CostDelegate.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Group.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/GroupCollection.xml13
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Match.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/MatchCollection.xml13
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/MatchEvaluator.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Regex.xml291
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexCollectionBase.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexCompilationInfo.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexOptions.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text/ASCIIEncoding.xml102
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text/Decoder.xml26
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text/Encoder.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text/Encoding.xml268
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text/StringBuilder.xml412
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text/UTF7Encoding.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text/UTF8Encoding.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Text/UnicodeEncoding.xml30
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ApartmentState.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/AutoResetEvent.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/IOCompletionCallback.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/Interlocked.xml77
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/LockCookie.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ManualResetEvent.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/Monitor.xml88
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/Mutex.xml35
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/NativeOverlapped.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/Overlapped.xml64
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ReaderWriterLock.xml96
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/RegisteredWaitHandle.xml14
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/SynchronizationLockException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/Thread.xml179
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ThreadAbortException.xml13
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ThreadExceptionEventArgs.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ThreadExceptionEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ThreadInterruptedException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ThreadPool.xml114
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ThreadPriority.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ThreadStart.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ThreadState.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/ThreadStateException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/Timeout.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/Timer.xml79
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/TimerCallback.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/WaitCallback.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/WaitHandle.xml94
-rw-r--r--mcs/docs/apidocs/xml/en/System.Threading/WaitOrTimerCallback.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/Cache.xml114
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/CacheDependency.xml53
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/CacheDependencyCallback.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/CacheEntry.xml106
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/CacheExpires.xml43
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemPriority.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemPriorityDecay.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemRemovedCallback.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemRemovedReason.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/ExpiresBucket.xml48
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/ExpiresEntry.xml20
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Caching/Flags.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Configuration/AuthenticationMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Configuration/ClientTargetSectionHandler.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Configuration/FormsAuthPasswordFormat.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Configuration/FormsProtectionEnum.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdCreatedEventArgs.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdCreatedEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdRotator.xml37
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseCompareValidator.xml25
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseDataList.xml78
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseValidator.xml64
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BorderStyle.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BoundColumn.xml44
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Button.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ButtonColumn.xml50
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ButtonColumnType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Calendar.xml167
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CalendarDay.xml53
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CalendarSelectionMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CheckBox.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CheckBoxList.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CommandEventArgs.xml29
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CommandEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CompareValidator.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CustomValidator.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGrid.xml208
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridColumn.xml90
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridColumnCollection.xml87
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridCommandEventArgs.xml25
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridCommandEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItem.xml35
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemCollection.xml50
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemEventArgs.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPageChangedEventArgs.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPageChangedEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPagerStyle.xml55
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridSortCommandEventArgs.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridSortCommandEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataKeyCollection.xml50
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataList.xml197
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListCommandEventArgs.xml25
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListCommandEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItem.xml37
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemCollection.xml50
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemEventArgs.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayNameFormat.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayRenderEventArgs.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayRenderEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DropDownList.xml37
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/EditCommandColumn.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FirstDayOfWeek.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontInfo.xml75
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontNamesConverter.xml36
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontSize.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontUnit.xml150
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontUnitConverter.xml54
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/GridLines.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HorizontalAlign.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLink.xml32
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLinkColumn.xml60
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLinkControlBuilder.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/IRepeatInfoUser.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Image.xml37
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ImageAlign.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ImageButton.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Label.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LabelControlBuilder.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LinkButton.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LinkButtonControlBuilder.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListBox.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListControl.xml77
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItem.xml59
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemCollection.xml133
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemControlBuilder.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListSelectionMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Literal.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LiteralControlBuilder.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/MonthChangedEventArgs.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/MonthChangedEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/NextPrevFormat.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagedDataSource.xml121
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagerMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagerPosition.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Panel.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PlaceHolder.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PlaceHolderControlBuilder.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RadioButton.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RadioButtonList.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RangeValidator.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RegularExpressionValidator.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatDirection.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatInfo.xml41
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatLayout.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Repeater.xml77
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterCommandEventArgs.xml25
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterCommandEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItem.xml29
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemCollection.xml50
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemEventArgs.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RequiredFieldValidator.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/SelectedDatesCollection.xml80
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ServerValidateEventArgs.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ServerValidateEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Style.xml112
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Table.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCell.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCellCollection.xml87
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCellControlBuilder.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableHeaderCell.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableItemStyle.xml56
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableRow.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableRowCollection.xml87
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableStyle.xml66
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TargetConverter.xml30
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TemplateColumn.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextAlign.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBox.xml62
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBoxControlBuilder.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBoxMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TitleFormat.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Unit.xml127
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/UnitConverter.xml36
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/UnitType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidatedControlConverter.xml30
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationCompareOperator.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationDataType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationSummary.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationSummaryDisplayMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidatorDisplay.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/VerticalAlign.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/WebColorConverter.xml29
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/WebControl.xml138
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Xml.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/BuildMethod.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/BuildTemplateMethod.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/Control.xml171
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/DataBindingHandlerAttribute.xml31
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/DesignTimeParseData.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriter.xml409
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterAttribute.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterStyle.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterTag.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/IAttributeAccessor.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/IDataBindingsAccessor.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/INamingContainer.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/IParserAccessor.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/IPostBackDataHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/IPostBackEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/IStateManager.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/ITagNameToTypeMapper.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/ITemplate.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/IValidator.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/ImageClickEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/LiteralControl.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/OutputCacheLocation.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/Pair.xml26
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/PersistenceMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/PropertyConverter.xml30
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/StateBag.xml78
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/StateItem.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.UI/ToolboxDataAttribute.xml38
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Utils/FileAction.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Utils/FileChangeEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Utils/NativeFileChangeEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Utils/WebEqualComparer.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web.Utils/WebHashCodeProvider.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/BeginEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/EndEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/EndOfSendNotification.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/HttpCacheRevalidation.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/HttpCacheability.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/HttpCookie.xml64
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/HttpCookieCollection.xml63
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/HttpRuntime.xml102
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/HttpServerUtility.xml140
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/HttpValidationStatus.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/HttpWorkerRequest.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/ProcessShutdownReason.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/ProcessStatus.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Web/TraceMode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/ValidationEventArgs.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/ValidationEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchema.xml176
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAll.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnnotated.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnnotation.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAny.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnyAttribute.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAppInfo.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttribute.xml62
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttributeGroup.xml32
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttributeGroupRef.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaChoice.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaCollection.xml87
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaCollectionEnumerator.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContent.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContentExtension.xml32
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContentRestriction.xml32
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexType.xml72
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContent.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentModel.xml13
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentProcessing.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDatatype.xml26
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDerivationMethod.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDocumentation.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaElement.xml97
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaEnumerationFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaException.xml46
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaExternal.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaFacet.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaForm.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaFractionDigitsFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroup.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroupBase.xml13
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroupRef.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaIdentityConstraint.xml32
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaImport.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaInclude.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaKey.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaKeyref.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaLengthFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxLengthFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinExclusiveFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinInclusiveFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinLengthFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaNotation.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaNumericFacet.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObject.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectCollection.xml65
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectEnumerator.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectTable.xml39
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaParticle.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaPatternFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaRedefine.xml32
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSequence.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContent.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContentExtension.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContentRestriction.xml37
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleType.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeContent.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeList.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.xml27
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeUnion.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaTotalDigitsFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaType.xml52
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaUnique.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaUse.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaXPath.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSeverityType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.XPath/IXPathNavigable.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathExpression.xml46
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNamespaceScope.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNavigator.xml288
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNodeIterator.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNodeType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathResultType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathScanner.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathTokenType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.XPath/XmlDataType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml.XPath/XmlSortOrder.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/EntityHandling.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/Formatting.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/IHasXmlNode.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/IXmlLineInfo.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/NameTable.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/ReadState.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/ValidationType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/WhitespaceHandling.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/WriteState.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlAttribute.xml96
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlAttributeCollection.xml79
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlCDataSection.xml41
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlCaseOrder.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlCharacterData.xml63
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlComment.xml41
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlDeclaration.xml66
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlDocument.xml353
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlDocumentFragment.xml56
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlDocumentType.xml71
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlElement.xml213
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlEntity.xml81
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlEntityReference.xml56
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlException.xml36
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlImplementation.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlLinkedNode.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlNameTable.xml36
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlNamedNodeMap.xml56
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlNamespaceManager.xml70
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlNode.xml250
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedAction.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedEventArgs.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlNodeList.xml29
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlNodeOrder.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlNodeType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlNotation.xml66
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlParserContext.xml102
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlProcessingInstruction.xml61
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlQualifiedName.xml79
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlReader.xml298
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlResolver.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlSignificantWhitespace.xml46
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlSpace.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlText.xml52
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlTextReader.xml349
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlTextWriter.xml254
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlTokenizedType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlUrlResolver.xml32
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlWhitespace.xml46
-rw-r--r--mcs/docs/apidocs/xml/en/System.Xml/XmlWriter.xml275
-rw-r--r--mcs/docs/apidocs/xml/en/System/AppDomain.xml426
-rw-r--r--mcs/docs/apidocs/xml/en/System/AppDomainSetup.xml67
-rw-r--r--mcs/docs/apidocs/xml/en/System/AppDomainUnloadedException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/ApplicationException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/ArgumentException.xml48
-rw-r--r--mcs/docs/apidocs/xml/en/System/ArgumentNullException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/ArgumentOutOfRangeException.xml42
-rw-r--r--mcs/docs/apidocs/xml/en/System/ArithmeticException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/Array.xml366
-rw-r--r--mcs/docs/apidocs/xml/en/System/ArrayTypeMismatchException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/AssemblyLoadEventArgs.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System/AssemblyLoadEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/AsyncCallback.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/Attribute.xml261
-rw-r--r--mcs/docs/apidocs/xml/en/System/AttributeTargets.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System/AttributeUsageAttribute.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System/BadImageFormatException.xml63
-rw-r--r--mcs/docs/apidocs/xml/en/System/BitConverter.xml175
-rw-r--r--mcs/docs/apidocs/xml/en/System/Boolean.xml150
-rw-r--r--mcs/docs/apidocs/xml/en/System/Buffer.xml39
-rw-r--r--mcs/docs/apidocs/xml/en/System/Byte.xml185
-rw-r--r--mcs/docs/apidocs/xml/en/System/CLSCompliantAttribute.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System/CannotUnloadAppDomainException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/Char.xml344
-rw-r--r--mcs/docs/apidocs/xml/en/System/CharEnumerator.xml28
-rw-r--r--mcs/docs/apidocs/xml/en/System/Console.xml311
-rw-r--r--mcs/docs/apidocs/xml/en/System/ContextBoundObject.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/ContextMarshalException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/ContextStaticAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System/Convert.xml1924
-rw-r--r--mcs/docs/apidocs/xml/en/System/CrossAppDomainDelegate.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/DBNull.xml35
-rw-r--r--mcs/docs/apidocs/xml/en/System/DateTime.xml565
-rw-r--r--mcs/docs/apidocs/xml/en/System/DayOfWeek.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System/Decimal.xml454
-rw-r--r--mcs/docs/apidocs/xml/en/System/DivideByZeroException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/DllNotFoundException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/Double.xml225
-rw-r--r--mcs/docs/apidocs/xml/en/System/DuplicateWaitObjectException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/EntryPointNotFoundException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/Environment.xml117
-rw-r--r--mcs/docs/apidocs/xml/en/System/EventArgs.xml16
-rw-r--r--mcs/docs/apidocs/xml/en/System/EventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/ExecutionEngineException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/FieldAccessException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/FlagsAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System/FormatException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/GC.xml14
-rw-r--r--mcs/docs/apidocs/xml/en/System/Guid.xml119
-rw-r--r--mcs/docs/apidocs/xml/en/System/IAppDomainSetup.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/IAsyncResult.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/ICloneable.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/IComparable.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/IConvertible.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/IDisposable.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/IFormatProvider.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/IFormattable.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/IServiceProvider.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/IndexOutOfRangeException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/Int16.xml185
-rw-r--r--mcs/docs/apidocs/xml/en/System/Int32.xml185
-rw-r--r--mcs/docs/apidocs/xml/en/System/Int64.xml185
-rw-r--r--mcs/docs/apidocs/xml/en/System/IntPtr.xml120
-rw-r--r--mcs/docs/apidocs/xml/en/System/IntegerFormatter.xml76
-rw-r--r--mcs/docs/apidocs/xml/en/System/InvalidCastException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/InvalidOperationException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/InvalidProgramException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/LoaderOptimization.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System/LoaderOptimizationAttribute.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/LocalDataStoreSlot.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System/MTAThreadAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System/MarshalByRefObject.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System/Math.xml398
-rw-r--r--mcs/docs/apidocs/xml/en/System/MemberAccessException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/MethodAccessException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/MissingFieldException.xml29
-rw-r--r--mcs/docs/apidocs/xml/en/System/MissingMemberException.xml41
-rw-r--r--mcs/docs/apidocs/xml/en/System/MissingMethodException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/MonoDummy.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System/MonoTODOAttribute.xml22
-rw-r--r--mcs/docs/apidocs/xml/en/System/MulticastNotSupportedException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/NonSerializedAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System/NotFiniteNumberException.xml47
-rw-r--r--mcs/docs/apidocs/xml/en/System/NotImplementedException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/NotSupportedException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/NullReferenceException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/ObjectDisposedException.xml36
-rw-r--r--mcs/docs/apidocs/xml/en/System/ObsoleteAttribute.xml33
-rw-r--r--mcs/docs/apidocs/xml/en/System/OperatingSystem.xml45
-rw-r--r--mcs/docs/apidocs/xml/en/System/OutOfMemoryException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/OverflowException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/ParamArrayAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System/PlatformID.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System/PlatformNotSupportedException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/Random.xml46
-rw-r--r--mcs/docs/apidocs/xml/en/System/RankException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/ResolveEventArgs.xml18
-rw-r--r--mcs/docs/apidocs/xml/en/System/ResolveEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/RuntimeArgumentHandle.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/RuntimeFieldHandle.xml20
-rw-r--r--mcs/docs/apidocs/xml/en/System/RuntimeMethodHandle.xml20
-rw-r--r--mcs/docs/apidocs/xml/en/System/RuntimeTypeHandle.xml20
-rw-r--r--mcs/docs/apidocs/xml/en/System/SByte.xml185
-rw-r--r--mcs/docs/apidocs/xml/en/System/STAThreadAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System/SerializableAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System/Single.xml225
-rw-r--r--mcs/docs/apidocs/xml/en/System/SpecialFolder.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System/StackOverflowException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/String.xml630
-rw-r--r--mcs/docs/apidocs/xml/en/System/SystemException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/ThreadStaticAttribute.xml12
-rw-r--r--mcs/docs/apidocs/xml/en/System/TimeSpan.xml292
-rw-r--r--mcs/docs/apidocs/xml/en/System/TimeZone.xml60
-rw-r--r--mcs/docs/apidocs/xml/en/System/Type.xml758
-rw-r--r--mcs/docs/apidocs/xml/en/System/TypeCode.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System/TypeInitializationException.xml26
-rw-r--r--mcs/docs/apidocs/xml/en/System/TypeLoadException.xml40
-rw-r--r--mcs/docs/apidocs/xml/en/System/TypeUnloadedException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/UInt16.xml185
-rw-r--r--mcs/docs/apidocs/xml/en/System/UInt32.xml185
-rw-r--r--mcs/docs/apidocs/xml/en/System/UInt64.xml185
-rw-r--r--mcs/docs/apidocs/xml/en/System/UIntPtr.xml113
-rw-r--r--mcs/docs/apidocs/xml/en/System/UnauthorizedAccessException.xml23
-rw-r--r--mcs/docs/apidocs/xml/en/System/UnhandledExceptionEventArgs.xml24
-rw-r--r--mcs/docs/apidocs/xml/en/System/UnhandledExceptionEventHandler.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/Uri.xml233
-rw-r--r--mcs/docs/apidocs/xml/en/System/UriFormatException.xml17
-rw-r--r--mcs/docs/apidocs/xml/en/System/UriHostNameType.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System/UriPartial.xml9
-rw-r--r--mcs/docs/apidocs/xml/en/System/Version.xml133
-rw-r--r--mcs/docs/apidocs/xml/en/System/Void.xml8
-rw-r--r--mcs/docs/apidocs/xml/en/System/WeakReference.xml41
-rw-r--r--mcs/docs/apidocs/xml/en/System/_AppDomain.xml8
-rwxr-xr-xmcs/docs/compiler248
-rwxr-xr-xmcs/docs/order.txt5
-rw-r--r--mcs/doctools/.cvsignore1
-rw-r--r--mcs/doctools/ChangeLog13
-rw-r--r--mcs/doctools/README.build8
-rw-r--r--mcs/doctools/doctools.build70
-rw-r--r--mcs/doctools/etc/gui/AboutMonodoc.pngbin0 -> 12632 bytes
-rw-r--r--mcs/doctools/etc/gui/AssemblyBrowser.pngbin0 -> 1949 bytes
-rw-r--r--mcs/doctools/etc/gui/ErrorExplosion.pngbin0 -> 9302 bytes
-rw-r--r--mcs/doctools/etc/gui/ImageResources.resx504
-rw-r--r--mcs/doctools/etc/gui/TextResources.resx138
-rw-r--r--mcs/doctools/etc/gui/readme.txt20
-rw-r--r--mcs/doctools/etc/monodoc.dtd135
-rwxr-xr-xmcs/doctools/makefile11
-rw-r--r--mcs/doctools/src/Console/docstub.cs693
-rw-r--r--mcs/doctools/src/Console/docval.cs94
-rw-r--r--mcs/doctools/src/Core/.cvsignore3
-rw-r--r--mcs/doctools/src/Core/AbstractClassStructDoc.cs116
-rw-r--r--mcs/doctools/src/Core/AbstractDoc.cs77
-rw-r--r--mcs/doctools/src/Core/AbstractMethodOperatorDoc.cs59
-rw-r--r--mcs/doctools/src/Core/AbstractTypeDoc.cs45
-rw-r--r--mcs/doctools/src/Core/AssemblyInfo.cs79
-rw-r--r--mcs/doctools/src/Core/AssemblyLoader.cs359
-rw-r--r--mcs/doctools/src/Core/ClassDoc.cs36
-rw-r--r--mcs/doctools/src/Core/ConstructorDoc.cs52
-rw-r--r--mcs/doctools/src/Core/Core.csproj223
-rw-r--r--mcs/doctools/src/Core/DelegateDoc.cs45
-rw-r--r--mcs/doctools/src/Core/DocProject.cs327
-rw-r--r--mcs/doctools/src/Core/EnumDoc.cs45
-rw-r--r--mcs/doctools/src/Core/EventDoc.cs47
-rw-r--r--mcs/doctools/src/Core/ExceptionDoc.cs55
-rw-r--r--mcs/doctools/src/Core/FieldDoc.cs36
-rw-r--r--mcs/doctools/src/Core/InterfaceDoc.cs36
-rw-r--r--mcs/doctools/src/Core/MethodDoc.cs36
-rw-r--r--mcs/doctools/src/Core/MonodocException.cs40
-rw-r--r--mcs/doctools/src/Core/NamingFlags.cs36
-rw-r--r--mcs/doctools/src/Core/NotifyArrayList.cs175
-rw-r--r--mcs/doctools/src/Core/NotifyCollection.cs82
-rw-r--r--mcs/doctools/src/Core/NotifyHashtable.cs174
-rw-r--r--mcs/doctools/src/Core/OperatorDoc.cs36
-rw-r--r--mcs/doctools/src/Core/PropertyDoc.cs52
-rw-r--r--mcs/doctools/src/Core/RecursiveFileList.cs105
-rw-r--r--mcs/doctools/src/Core/SortedStringValues.cs85
-rw-r--r--mcs/doctools/src/Core/StructDoc.cs36
-rw-r--r--mcs/doctools/src/Core/TypeNameHelper.cs122
-rw-r--r--mcs/doctools/src/Core/ValueConstrainedArrayList.cs164
-rw-r--r--mcs/doctools/src/Gui/.cvsignore3
-rw-r--r--mcs/doctools/src/Gui/AboutForm.cs82
-rw-r--r--mcs/doctools/src/Gui/AssemblyTreeImages.cs94
-rw-r--r--mcs/doctools/src/Gui/AssemblyTreeLoader.cs461
-rw-r--r--mcs/doctools/src/Gui/DirectorySelectorForm.cs318
-rw-r--r--mcs/doctools/src/Gui/EditPropertyForm.cs182
-rw-r--r--mcs/doctools/src/Gui/ExampleCodeEditorForm.cs166
-rw-r--r--mcs/doctools/src/Gui/GenericEditorForm.cs232
-rw-r--r--mcs/doctools/src/Gui/Gui.csproj238
-rw-r--r--mcs/doctools/src/Gui/GuiDriver.cs45
-rw-r--r--mcs/doctools/src/Gui/GuiResources.cs78
-rw-r--r--mcs/doctools/src/Gui/MainForm.cs898
-rw-r--r--mcs/doctools/src/Gui/MdiToolBar.cs206
-rw-r--r--mcs/doctools/src/Gui/ProjectOptionsForm.cs560
-rw-r--r--mcs/doctools/src/Gui/TypeEditorForm.cs120
-rw-r--r--mcs/doctools/src/Gui/UnexpectedErrorForm.cs203
-rw-r--r--mcs/doctools/src/doctools.sln27
-rwxr-xr-xmcs/errors/bug1.cs17
-rw-r--r--mcs/errors/bug10.cs30
-rwxr-xr-xmcs/errors/bug11.cs23
-rwxr-xr-xmcs/errors/bug12.cs19
-rwxr-xr-xmcs/errors/bug13.cs11
-rwxr-xr-xmcs/errors/bug14.cs15
-rwxr-xr-xmcs/errors/bug15.cs25
-rw-r--r--mcs/errors/bug16.cs24
-rwxr-xr-xmcs/errors/bug17.cs10
-rwxr-xr-xmcs/errors/bug18.cs16
-rwxr-xr-xmcs/errors/bug19.cs18
-rwxr-xr-xmcs/errors/bug2.cs29
-rwxr-xr-xmcs/errors/bug3.cs36
-rwxr-xr-xmcs/errors/bug4.cs18
-rwxr-xr-xmcs/errors/bug5.cs23
-rwxr-xr-xmcs/errors/bug6.cs14
-rwxr-xr-xmcs/errors/bug7.cs13
-rwxr-xr-xmcs/errors/bug8.cs20
-rwxr-xr-xmcs/errors/bug9.cs7
-rw-r--r--mcs/errors/cs-11.cs20
-rwxr-xr-xmcs/errors/cs-12.cs34
-rw-r--r--mcs/errors/cs-20.cs35
-rwxr-xr-xmcs/errors/cs0017.cs9
-rwxr-xr-xmcs/errors/cs0019-2.cs20
-rwxr-xr-xmcs/errors/cs0019-3.cs19
-rwxr-xr-xmcs/errors/cs0019-4.cs20
-rw-r--r--mcs/errors/cs0019.cs14
-rwxr-xr-xmcs/errors/cs0020.cs12
-rw-r--r--mcs/errors/cs0023.cs13
-rwxr-xr-xmcs/errors/cs0026-2.cs10
-rwxr-xr-xmcs/errors/cs0026.cs8
-rw-r--r--mcs/errors/cs0030.cs15
-rw-r--r--mcs/errors/cs0031.cs14
-rwxr-xr-xmcs/errors/cs0034.cs15
-rw-r--r--mcs/errors/cs0066.cs25
-rw-r--r--mcs/errors/cs0070.cs30
-rwxr-xr-xmcs/errors/cs0107.cs2
-rwxr-xr-xmcs/errors/cs0108.cs10
-rw-r--r--mcs/errors/cs0111.cs21
-rwxr-xr-xmcs/errors/cs0113.cs3
-rwxr-xr-xmcs/errors/cs0114.cs2
-rwxr-xr-xmcs/errors/cs0115.cs5
-rwxr-xr-xmcs/errors/cs0117.cs1
-rwxr-xr-xmcs/errors/cs0121.cs17
-rw-r--r--mcs/errors/cs0126.cs9
-rwxr-xr-xmcs/errors/cs0131.cs8
-rwxr-xr-xmcs/errors/cs0132.cs7
-rwxr-xr-xmcs/errors/cs0136-2.cs9
-rw-r--r--mcs/errors/cs0139.cs8
-rw-r--r--mcs/errors/cs0146.cs7
-rw-r--r--mcs/errors/cs0150.cs14
-rwxr-xr-xmcs/errors/cs0151.cs19
-rwxr-xr-xmcs/errors/cs0153.cs8
-rwxr-xr-xmcs/errors/cs0157.cs12
-rwxr-xr-xmcs/errors/cs0159-2.cs16
-rwxr-xr-xmcs/errors/cs0159.cs23
-rwxr-xr-xmcs/errors/cs0169.cs2
-rwxr-xr-xmcs/errors/cs0171.cs11
-rwxr-xr-xmcs/errors/cs0172.cs25
-rw-r--r--mcs/errors/cs0178.cs12
-rwxr-xr-xmcs/errors/cs0179.cs14
-rwxr-xr-xmcs/errors/cs0180.cs12
-rwxr-xr-xmcs/errors/cs0183.cs13
-rwxr-xr-xmcs/errors/cs0184.cs13
-rwxr-xr-xmcs/errors/cs0185.cs11
-rwxr-xr-xmcs/errors/cs0187.cs8
-rwxr-xr-xmcs/errors/cs0196.cs11
-rwxr-xr-xmcs/errors/cs0200.cs15
-rwxr-xr-xmcs/errors/cs0206.cs16
-rw-r--r--mcs/errors/cs0214.cs5
-rw-r--r--mcs/errors/cs0215.cs13
-rw-r--r--mcs/errors/cs0216.cs9
-rw-r--r--mcs/errors/cs0239.cs34
-rwxr-xr-xmcs/errors/cs0242.cs11
-rw-r--r--mcs/errors/cs0246.cs4
-rwxr-xr-xmcs/errors/cs0255.cs13
-rwxr-xr-xmcs/errors/cs0503.cs2
-rw-r--r--mcs/errors/cs0509.cs8
-rwxr-xr-xmcs/errors/cs0523.cs12
-rw-r--r--mcs/errors/cs0527-2.cs8
-rw-r--r--mcs/errors/cs0527.cs7
-rw-r--r--mcs/errors/cs0529.cs7
-rwxr-xr-xmcs/errors/cs0534.cs1
-rw-r--r--mcs/errors/cs0543.cs14
-rwxr-xr-xmcs/errors/cs0552.cs17
-rw-r--r--mcs/errors/cs0555.cs11
-rw-r--r--mcs/errors/cs0556.cs10
-rw-r--r--mcs/errors/cs0563.cs7
-rwxr-xr-xmcs/errors/cs0574.cs13
-rwxr-xr-xmcs/errors/cs0575.cs12
-rw-r--r--mcs/errors/cs0592.cs29
-rw-r--r--mcs/errors/cs0601.cs11
-rw-r--r--mcs/errors/cs0617.cs26
-rwxr-xr-xmcs/errors/cs0621.cs2
-rwxr-xr-xmcs/errors/cs0642.cs6
-rwxr-xr-xmcs/errors/cs0644.cs4
-rwxr-xr-xmcs/errors/cs0645.cs4
-rw-r--r--mcs/errors/cs0646.cs26
-rw-r--r--mcs/errors/cs0658.cs18
-rwxr-xr-xmcs/errors/cs0664.cs8
-rwxr-xr-xmcs/errors/cs0677.cs12
-rw-r--r--mcs/errors/cs1008.cs14
-rw-r--r--mcs/errors/cs1019.cs27
-rw-r--r--mcs/errors/cs1020.cs28
-rwxr-xr-xmcs/errors/cs1032.cs8
-rwxr-xr-xmcs/errors/cs1510.cs13
-rwxr-xr-xmcs/errors/cs1511.cs14
-rwxr-xr-xmcs/errors/cs1513.cs3
-rwxr-xr-xmcs/errors/cs1518.cs6
-rwxr-xr-xmcs/errors/cs1523.cs14
-rwxr-xr-xmcs/errors/cs1524.cs15
-rwxr-xr-xmcs/errors/cs1526.cs8
-rwxr-xr-xmcs/errors/cs1527.cs4
-rwxr-xr-xmcs/errors/cs1528.cs14
-rwxr-xr-xmcs/errors/cs1530.cs7
-rw-r--r--mcs/errors/cs1593.cs30
-rw-r--r--mcs/errors/cs1594.cs30
-rwxr-xr-xmcs/errors/cs1604.cs14
-rwxr-xr-xmcs/errors/errors.txt47
-rwxr-xr-xmcs/errors/fail53
-rwxr-xr-xmcs/errors/makefile37
-rwxr-xr-xmcs/jay/.cvsignore2
-rw-r--r--mcs/jay/ACKNOWLEDGEMENTS25
-rwxr-xr-xmcs/jay/ChangeLog9
-rw-r--r--mcs/jay/NEW_FEATURES46
-rw-r--r--mcs/jay/NOTES9
-rw-r--r--mcs/jay/README10
-rw-r--r--mcs/jay/README.jay55
-rw-r--r--mcs/jay/closure.c295
-rw-r--r--mcs/jay/defs.h308
-rw-r--r--mcs/jay/depend11
-rw-r--r--mcs/jay/error.c335
-rw-r--r--mcs/jay/jay.1120
-rw-r--r--mcs/jay/lalr.c678
-rw-r--r--mcs/jay/lr0.c637
-rw-r--r--mcs/jay/main.c341
-rw-r--r--mcs/jay/makefile14
-rw-r--r--mcs/jay/mkpar.c395
-rw-r--r--mcs/jay/output.c1173
-rw-r--r--mcs/jay/reader.c1627
-rw-r--r--mcs/jay/skeleton268
-rw-r--r--mcs/jay/skeleton.cs352
-rw-r--r--mcs/jay/symtab.c158
-rw-r--r--mcs/jay/verbose.c366
-rw-r--r--mcs/jay/warshall.c122
-rwxr-xr-xmcs/makefile23
-rw-r--r--mcs/mcs/.cvsignore5
-rwxr-xr-xmcs/mcs/ChangeLog6217
-rw-r--r--mcs/mcs/TODO323
-rwxr-xr-xmcs/mcs/assign.cs242
-rw-r--r--mcs/mcs/attribute.cs682
-rwxr-xr-xmcs/mcs/cfold.cs1002
-rwxr-xr-xmcs/mcs/class.cs3963
-rwxr-xr-xmcs/mcs/codegen.cs453
-rwxr-xr-xmcs/mcs/compiler.csproj238
-rwxr-xr-xmcs/mcs/compiler.csproj.user48
-rw-r--r--mcs/mcs/compiler.doc114
-rwxr-xr-xmcs/mcs/compiler.sln21
-rwxr-xr-xmcs/mcs/const.cs172
-rwxr-xr-xmcs/mcs/constant.cs975
-rwxr-xr-xmcs/mcs/cs-parser.cs5531
-rwxr-xr-xmcs/mcs/cs-parser.jay6739
-rwxr-xr-xmcs/mcs/cs-tokenizer.cs988
-rwxr-xr-xmcs/mcs/decl.cs481
-rw-r--r--mcs/mcs/delegate.cs710
-rwxr-xr-xmcs/mcs/driver.cs1173
-rwxr-xr-xmcs/mcs/ecore.cs3759
-rwxr-xr-xmcs/mcs/enum.cs385
-rwxr-xr-xmcs/mcs/errors.cs12
-rwxr-xr-xmcs/mcs/expression.cs5969
-rwxr-xr-xmcs/mcs/gen-il.cs2
-rwxr-xr-xmcs/mcs/gen-treedump.cs129
-rwxr-xr-xmcs/mcs/generator.cs19
-rw-r--r--mcs/mcs/genericparser.cs85
-rwxr-xr-xmcs/mcs/interface.cs807
-rwxr-xr-xmcs/mcs/literal.cs212
-rw-r--r--mcs/mcs/location.cs151
-rwxr-xr-xmcs/mcs/makefile110
-rw-r--r--mcs/mcs/mb-parser.jay480
-rw-r--r--mcs/mcs/mb-tokenizer.cs824
-rw-r--r--mcs/mcs/mcs.exe.config11
-rwxr-xr-xmcs/mcs/modifiers.cs123
-rwxr-xr-xmcs/mcs/namespace.cs113
-rwxr-xr-xmcs/mcs/old-code.cs216
-rwxr-xr-xmcs/mcs/parameter.cs406
-rwxr-xr-xmcs/mcs/parameterCollection.cs8
-rwxr-xr-xmcs/mcs/parser.cs4
-rw-r--r--mcs/mcs/report.cs195
-rwxr-xr-xmcs/mcs/rootcontext.cs724
-rwxr-xr-xmcs/mcs/statement.cs2914
-rwxr-xr-xmcs/mcs/statementCollection.cs8
-rwxr-xr-xmcs/mcs/support.cs240
-rwxr-xr-xmcs/mcs/tree.cs184
-rwxr-xr-xmcs/mcs/type.cs104
-rwxr-xr-xmcs/mcs/typemanager.cs1095
-rwxr-xr-xmcs/nant/.cvsignore2
-rw-r--r--mcs/nant/ChangeLog11
-rwxr-xr-xmcs/nant/README-nant.txt62
-rwxr-xr-xmcs/nant/doc/arrow.gifbin0 -> 58 bytes
-rwxr-xr-xmcs/nant/doc/authors.html43
-rwxr-xr-xmcs/nant/doc/changelog.html121
-rwxr-xr-xmcs/nant/doc/index.html43
-rwxr-xr-xmcs/nant/doc/license.html48
-rwxr-xr-xmcs/nant/doc/style.css71
-rwxr-xr-xmcs/nant/doc/todo.html55
-rwxr-xr-xmcs/nant/makefile15
-rwxr-xr-xmcs/nant/readme.txt4
-rwxr-xr-xmcs/nant/src/AssemblyInfo.cs37
-rwxr-xr-xmcs/nant/src/AssemblyInfo.cs~38
-rwxr-xr-xmcs/nant/src/Attributes/BooleanValidatorAttribute.cs42
-rwxr-xr-xmcs/nant/src/Attributes/Int32ValidatorAttribute.cs63
-rwxr-xr-xmcs/nant/src/Attributes/TaskAttributeAttribute.cs78
-rwxr-xr-xmcs/nant/src/Attributes/TaskFileSetAttribute.cs40
-rwxr-xr-xmcs/nant/src/Attributes/TaskNameAttribute.cs45
-rwxr-xr-xmcs/nant/src/Attributes/ValidatorAttribute.cs28
-rwxr-xr-xmcs/nant/src/BuildException.cs85
-rwxr-xr-xmcs/nant/src/DirectoryScanner.cs226
-rwxr-xr-xmcs/nant/src/FileSet.cs132
-rwxr-xr-xmcs/nant/src/Location.cs89
-rwxr-xr-xmcs/nant/src/NAnt.cs107
-rwxr-xr-xmcs/nant/src/NAnt.exebin0 -> 61440 bytes
-rwxr-xr-xmcs/nant/src/Project.cs332
-rwxr-xr-xmcs/nant/src/PropertyDictionary.cs72
-rwxr-xr-xmcs/nant/src/Target.cs115
-rwxr-xr-xmcs/nant/src/TargetCollection.cs35
-rwxr-xr-xmcs/nant/src/Task.cs192
-rwxr-xr-xmcs/nant/src/TaskBuilder.cs84
-rwxr-xr-xmcs/nant/src/TaskBuilderCollection.cs46
-rwxr-xr-xmcs/nant/src/TaskCollection.cs26
-rwxr-xr-xmcs/nant/src/TaskFactory.cs57
-rwxr-xr-xmcs/nant/src/Tasks/CallTask.cs41
-rwxr-xr-xmcs/nant/src/Tasks/CompilerBase.cs186
-rwxr-xr-xmcs/nant/src/Tasks/CopyTask.cs196
-rwxr-xr-xmcs/nant/src/Tasks/CscTask.cs45
-rwxr-xr-xmcs/nant/src/Tasks/DeleteTask.cs173
-rwxr-xr-xmcs/nant/src/Tasks/EchoTask.cs34
-rwxr-xr-xmcs/nant/src/Tasks/ExecTask.cs58
-rwxr-xr-xmcs/nant/src/Tasks/ExternalProgramBase.cs130
-rwxr-xr-xmcs/nant/src/Tasks/FailTask.cs38
-rwxr-xr-xmcs/nant/src/Tasks/IncludeTask.cs134
-rwxr-xr-xmcs/nant/src/Tasks/JscTask.cs40
-rwxr-xr-xmcs/nant/src/Tasks/MkDirTask.cs49
-rwxr-xr-xmcs/nant/src/Tasks/MoveTask.cs71
-rwxr-xr-xmcs/nant/src/Tasks/NantTask.cs65
-rwxr-xr-xmcs/nant/src/Tasks/PropertyTask.cs37
-rwxr-xr-xmcs/nant/src/Tasks/SleepTask.cs91
-rwxr-xr-xmcs/nant/src/Tasks/StyleTask.cs171
-rwxr-xr-xmcs/nant/src/Tasks/TStampTask.cs43
-rwxr-xr-xmcs/nant/src/Tasks/TaskDefTask.cs42
-rwxr-xr-xmcs/nant/src/Tasks/VbcTask.cs40
-rwxr-xr-xmcs/nant/src/Util/Log.cs155
-rwxr-xr-xmcs/nant/src/Util/XmlNodeTextPositionMap.cs187
-rw-r--r--mcs/nunit/.cvsignore2
-rw-r--r--mcs/nunit/ChangeLog32
-rwxr-xr-xmcs/nunit/RunTests.cs79
-rw-r--r--mcs/nunit/makefile12
-rwxr-xr-xmcs/nunit/nunit.build85
-rw-r--r--mcs/nunit/src/NUnitConsole/AssemblyInfo.cs55
-rwxr-xr-xmcs/nunit/src/NUnitConsole/NUnitConsole.csproj93
-rw-r--r--mcs/nunit/src/NUnitConsole/NUnitConsole.xml146
-rw-r--r--mcs/nunit/src/NUnitConsole/NUnitConsoleMain.cs35
-rw-r--r--mcs/nunit/src/NUnitConsole/TestRunner.cs277
-rw-r--r--mcs/nunit/src/NUnitCore/ActiveTestSuite.cs113
-rw-r--r--mcs/nunit/src/NUnitCore/AssemblyInfo.cs55
-rwxr-xr-xmcs/nunit/src/NUnitCore/AssemblyTestCollector.cs72
-rw-r--r--mcs/nunit/src/NUnitCore/Assertion.cs184
-rw-r--r--mcs/nunit/src/NUnitCore/AssertionFailedError.cs27
-rw-r--r--mcs/nunit/src/NUnitCore/BaseTestRunner.cs323
-rw-r--r--mcs/nunit/src/NUnitCore/ClassPathTestCollector.cs78
-rw-r--r--mcs/nunit/src/NUnitCore/ExceptionTestCase.cs53
-rw-r--r--mcs/nunit/src/NUnitCore/ExpectExceptionAttribute.cs47
-rw-r--r--mcs/nunit/src/NUnitCore/IFailureDetailView.cs21
-rw-r--r--mcs/nunit/src/NUnitCore/IProtectable.cs12
-rw-r--r--mcs/nunit/src/NUnitCore/ITest.cs18
-rw-r--r--mcs/nunit/src/NUnitCore/ITestCollector.cs16
-rw-r--r--mcs/nunit/src/NUnitCore/ITestListener.cs65
-rwxr-xr-xmcs/nunit/src/NUnitCore/ITestLoader.cs58
-rw-r--r--mcs/nunit/src/NUnitCore/ITestSuiteLoader.cs17
-rw-r--r--mcs/nunit/src/NUnitCore/LoadingTestCollector.cs54
-rwxr-xr-xmcs/nunit/src/NUnitCore/NUnitCore.csproj238
-rw-r--r--mcs/nunit/src/NUnitCore/NUnitException.cs51
-rw-r--r--mcs/nunit/src/NUnitCore/ReflectionUtils.cs94
-rw-r--r--mcs/nunit/src/NUnitCore/ReloadingTestSuiteLoader.cs33
-rw-r--r--mcs/nunit/src/NUnitCore/RepeatedTest.cs45
-rw-r--r--mcs/nunit/src/NUnitCore/SimpleTestCollector.cs28
-rwxr-xr-xmcs/nunit/src/NUnitCore/StandardLoader.cs222
-rw-r--r--mcs/nunit/src/NUnitCore/StandardTestSuiteLoader.cs47
-rw-r--r--mcs/nunit/src/NUnitCore/TestCase.cs241
-rw-r--r--mcs/nunit/src/NUnitCore/TestCaseClassLoader.cs208
-rw-r--r--mcs/nunit/src/NUnitCore/TestDecorator.cs71
-rw-r--r--mcs/nunit/src/NUnitCore/TestFailure.cs55
-rw-r--r--mcs/nunit/src/NUnitCore/TestResult.cs249
-rw-r--r--mcs/nunit/src/NUnitCore/TestSetup.cs70
-rw-r--r--mcs/nunit/src/NUnitCore/TestSuite.cs293
-rw-r--r--mcs/nunit/src/NUnitCore/Version.cs23
-rwxr-xr-xmcs/tests/ChangeLog341
-rwxr-xr-xmcs/tests/c1.cs7
-rwxr-xr-xmcs/tests/c2.cs2
-rwxr-xr-xmcs/tests/casts.cs566
-rwxr-xr-xmcs/tests/co1.cs4
-rwxr-xr-xmcs/tests/cs1.cs5
-rwxr-xr-xmcs/tests/csc-casts.outbin0 -> 5041 bytes
-rwxr-xr-xmcs/tests/gen-cast-test.cs99
-rwxr-xr-xmcs/tests/gen-check.cs78
-rw-r--r--mcs/tests/i-recursive.cs5
-rwxr-xr-xmcs/tests/i-three.cs11
-rw-r--r--mcs/tests/i-undefined.cs2
-rwxr-xr-xmcs/tests/i1.cs2
-rwxr-xr-xmcs/tests/i2.cs5
-rwxr-xr-xmcs/tests/i3.cs5
-rwxr-xr-xmcs/tests/i4.cs8
-rwxr-xr-xmcs/tests/i5.cs8
-rwxr-xr-xmcs/tests/i6.cs4
-rwxr-xr-xmcs/tests/ix1.cs3
-rwxr-xr-xmcs/tests/ix2.cs15
-rwxr-xr-xmcs/tests/makefile102
-rwxr-xr-xmcs/tests/n1.cs11
-rwxr-xr-xmcs/tests/n2.cs4
-rwxr-xr-xmcs/tests/s1.cs7
-rwxr-xr-xmcs/tests/test-1.cs9
-rw-r--r--mcs/tests/test-10.cs150
-rwxr-xr-xmcs/tests/test-100.cs31
-rw-r--r--mcs/tests/test-101.cs39
-rw-r--r--mcs/tests/test-102.cs30
-rwxr-xr-xmcs/tests/test-103.cs28
-rw-r--r--mcs/tests/test-104.cs14
-rw-r--r--mcs/tests/test-11.cs27
-rw-r--r--mcs/tests/test-12.cs44
-rw-r--r--mcs/tests/test-13.cs31
-rw-r--r--mcs/tests/test-14.cs43
-rwxr-xr-xmcs/tests/test-15.cs22
-rw-r--r--mcs/tests/test-16.cs59
-rwxr-xr-xmcs/tests/test-17.cs45
-rw-r--r--mcs/tests/test-18.cs52
-rwxr-xr-xmcs/tests/test-19.cs83
-rwxr-xr-xmcs/tests/test-2.cs7
-rwxr-xr-xmcs/tests/test-20.cs70
-rw-r--r--mcs/tests/test-21.cs35
-rw-r--r--mcs/tests/test-22.cs46
-rw-r--r--mcs/tests/test-23.cs106
-rw-r--r--mcs/tests/test-24.cs35
-rw-r--r--mcs/tests/test-25.cs65
-rw-r--r--mcs/tests/test-26.cs72
-rw-r--r--mcs/tests/test-27.cs97
-rw-r--r--mcs/tests/test-28.cs47
-rw-r--r--mcs/tests/test-29.cs40
-rwxr-xr-xmcs/tests/test-3.cs62
-rw-r--r--mcs/tests/test-30.cs60
-rw-r--r--mcs/tests/test-31.cs41
-rw-r--r--mcs/tests/test-32.cs21
-rw-r--r--mcs/tests/test-33.cs51
-rw-r--r--mcs/tests/test-34.cs90
-rwxr-xr-xmcs/tests/test-35.cs71
-rwxr-xr-xmcs/tests/test-36.cs46
-rwxr-xr-xmcs/tests/test-37.cs136
-rwxr-xr-xmcs/tests/test-38.cs36
-rw-r--r--mcs/tests/test-39.cs38
-rwxr-xr-xmcs/tests/test-4.cs40
-rw-r--r--mcs/tests/test-40.cs75
-rw-r--r--mcs/tests/test-41.cs93
-rwxr-xr-xmcs/tests/test-42.cs184
-rwxr-xr-xmcs/tests/test-43.cs78
-rwxr-xr-xmcs/tests/test-44.cs55
-rw-r--r--mcs/tests/test-45.cs101
-rwxr-xr-xmcs/tests/test-46.cs127
-rwxr-xr-xmcs/tests/test-47.cs95
-rw-r--r--mcs/tests/test-48.cs30
-rwxr-xr-xmcs/tests/test-49.cs480
-rwxr-xr-xmcs/tests/test-5.cs14
-rw-r--r--mcs/tests/test-50.cs15
-rwxr-xr-xmcs/tests/test-51.cs89
-rwxr-xr-xmcs/tests/test-52.cs79
-rwxr-xr-xmcs/tests/test-53.cs119
-rwxr-xr-xmcs/tests/test-54.cs23
-rwxr-xr-xmcs/tests/test-55.cs33
-rwxr-xr-xmcs/tests/test-56.cs96
-rw-r--r--mcs/tests/test-57.cs75
-rwxr-xr-xmcs/tests/test-58.cs25
-rwxr-xr-xmcs/tests/test-59.cs89
-rwxr-xr-xmcs/tests/test-6.cs15
-rwxr-xr-xmcs/tests/test-60.cs17
-rwxr-xr-xmcs/tests/test-61.cs39
-rwxr-xr-xmcs/tests/test-62.cs28
-rwxr-xr-xmcs/tests/test-63.cs31
-rwxr-xr-xmcs/tests/test-64.cs29
-rwxr-xr-xmcs/tests/test-65.cs51
-rwxr-xr-xmcs/tests/test-66.cs134
-rw-r--r--mcs/tests/test-67.cs93
-rwxr-xr-xmcs/tests/test-68.cs22
-rw-r--r--mcs/tests/test-69.cs13
-rw-r--r--mcs/tests/test-7.cs176
-rwxr-xr-xmcs/tests/test-70.cs48
-rwxr-xr-xmcs/tests/test-71.cs28
-rwxr-xr-xmcs/tests/test-72.cs21
-rwxr-xr-xmcs/tests/test-73.cs28
-rwxr-xr-xmcs/tests/test-74.cs22
-rwxr-xr-xmcs/tests/test-75.cs36
-rwxr-xr-xmcs/tests/test-76.cs35
-rwxr-xr-xmcs/tests/test-77.cs38
-rwxr-xr-xmcs/tests/test-78.cs59
-rwxr-xr-xmcs/tests/test-79.cs17
-rw-r--r--mcs/tests/test-8.cs29
-rwxr-xr-xmcs/tests/test-80.cs32
-rw-r--r--mcs/tests/test-81.cs37
-rw-r--r--mcs/tests/test-82.cs40
-rwxr-xr-xmcs/tests/test-83.cs44
-rwxr-xr-xmcs/tests/test-84.cs22
-rwxr-xr-xmcs/tests/test-85.cs23
-rw-r--r--mcs/tests/test-86.cs45
-rwxr-xr-xmcs/tests/test-87.cs47
-rwxr-xr-xmcs/tests/test-88.cs18
-rwxr-xr-xmcs/tests/test-89.cs34
-rwxr-xr-xmcs/tests/test-9.cs24
-rwxr-xr-xmcs/tests/test-90.cs37
-rwxr-xr-xmcs/tests/test-91.cs53
-rwxr-xr-xmcs/tests/test-92.cs20
-rwxr-xr-xmcs/tests/test-93.cs47
-rwxr-xr-xmcs/tests/test-94.cs59
-rwxr-xr-xmcs/tests/test-95.cs18
-rwxr-xr-xmcs/tests/test-96.cs20
-rwxr-xr-xmcs/tests/test-97.cs18
-rwxr-xr-xmcs/tests/test-98.cs18
-rwxr-xr-xmcs/tests/test-99.cs25
-rwxr-xr-xmcs/tests/try.cs2
-rwxr-xr-xmcs/tests/unsafe-1.cs163
-rwxr-xr-xmcs/tests/unsafe-2.cs25
-rw-r--r--mcs/tools/.cvsignore4
-rw-r--r--mcs/tools/ChangeLog124
-rwxr-xr-xmcs/tools/DumpCultureInfo.cs176
-rw-r--r--mcs/tools/EnumCheck.cs132
-rw-r--r--mcs/tools/EnumCheckAssemblyCollection.cs77
-rw-r--r--mcs/tools/GenerateDelegate.cs190
-rw-r--r--mcs/tools/IFaceDisco.cs105
-rw-r--r--mcs/tools/XMLUtil.cs36
-rw-r--r--mcs/tools/assemblies.xml20
-rw-r--r--mcs/tools/corcompare/.cvsignore2
-rw-r--r--mcs/tools/corcompare/ChangeLog6
-rw-r--r--mcs/tools/corcompare/CompletionInfo.cs573
-rw-r--r--mcs/tools/corcompare/CorCompare.cs72
-rw-r--r--mcs/tools/corcompare/Makefile11
-rw-r--r--mcs/tools/corcompare/MissingAttribute.cs136
-rw-r--r--mcs/tools/corcompare/MissingBase.cs134
-rw-r--r--mcs/tools/corcompare/MissingConstructor.cs30
-rw-r--r--mcs/tools/corcompare/MissingEvent.cs110
-rw-r--r--mcs/tools/corcompare/MissingField.cs76
-rw-r--r--mcs/tools/corcompare/MissingInterface.cs51
-rw-r--r--mcs/tools/corcompare/MissingMember.cs138
-rw-r--r--mcs/tools/corcompare/MissingMethod.cs58
-rw-r--r--mcs/tools/corcompare/MissingNameSpace.cs159
-rw-r--r--mcs/tools/corcompare/MissingNestedType.cs36
-rw-r--r--mcs/tools/corcompare/MissingProperty.cs108
-rw-r--r--mcs/tools/corcompare/MissingType.cs493
-rw-r--r--mcs/tools/corcompare/TODO16
-rw-r--r--mcs/tools/corcompare/ToDoAssembly.cs199
-rw-r--r--mcs/tools/corcompare/corcompare.build12
-rw-r--r--mcs/tools/corcompare/cormissing.xsl424
-rw-r--r--mcs/tools/corcompare/transform.js11
-rw-r--r--mcs/tools/ictool/Makefile10
-rw-r--r--mcs/tools/ictool/depgraph.cs69
-rw-r--r--mcs/tools/ictool/ictool-config.xml105
-rw-r--r--mcs/tools/ictool/ictool.cs428
-rw-r--r--mcs/tools/ictool/peer.cs284
-rw-r--r--mcs/tools/makefile45
-rw-r--r--mcs/tools/monostyle.cs366
-rwxr-xr-xmcs/tools/sample_cast_const.cs49
-rwxr-xr-xmcs/tools/scan-tests.pl163
-rwxr-xr-xmcs/tools/serialize.cs138
-rw-r--r--mcs/tools/verifier.cs1587
-rw-r--r--mono/.cvsignore2
-rw-r--r--mono/Makefile.am5
-rw-r--r--mono/arch/.cvsignore6
-rw-r--r--mono/arch/ChangeLog242
-rw-r--r--mono/arch/Makefile.am13
-rw-r--r--mono/arch/arm/.cvsignore13
-rw-r--r--mono/arch/arm/Makefile.am22
-rw-r--r--mono/arch/arm/arm-codegen.c193
-rw-r--r--mono/arch/arm/arm-codegen.h748
-rw-r--r--mono/arch/arm/arm-dis.c494
-rw-r--r--mono/arch/arm/arm-dis.h40
-rw-r--r--mono/arch/arm/cmp_macros.th11
-rw-r--r--mono/arch/arm/dpi_macros.th44
-rwxr-xr-xmono/arch/arm/dpiops.sh32
-rw-r--r--mono/arch/arm/mov_macros.th39
-rw-r--r--mono/arch/arm/tramp.c809
-rw-r--r--mono/arch/ppc/.cvsignore7
-rw-r--r--mono/arch/ppc/Makefile.am8
-rw-r--r--mono/arch/ppc/ppc-codegen.h115
-rw-r--r--mono/arch/ppc/test.c30
-rw-r--r--mono/arch/ppc/tramp.c808
-rw-r--r--mono/arch/sparc/.cvsignore2
-rw-r--r--mono/arch/sparc/Makefile.am7
-rw-r--r--mono/arch/sparc/sparc-codegen.h486
-rw-r--r--mono/arch/sparc/test.c123
-rw-r--r--mono/arch/sparc/tramp.c539
-rw-r--r--mono/arch/unknown.c19
-rw-r--r--mono/arch/x86/.cvsignore6
-rw-r--r--mono/arch/x86/Makefile.am7
-rw-r--r--mono/arch/x86/test.c225
-rw-r--r--mono/arch/x86/tramp.c524
-rw-r--r--mono/arch/x86/x86-codegen.h1501
-rw-r--r--mono/benchmark/.cvsignore5
-rw-r--r--mono/benchmark/Makefile.am44
-rwxr-xr-xmono/benchmark/castclass.cs27
-rwxr-xr-xmono/benchmark/fib.cs26
-rwxr-xr-xmono/benchmark/inline1.cs24
-rw-r--r--mono/benchmark/inline2.cs36
-rw-r--r--mono/benchmark/inline3.cs52
-rwxr-xr-xmono/benchmark/isinst.cs24
-rw-r--r--mono/benchmark/life.cs74
-rwxr-xr-xmono/benchmark/test-driver39
-rw-r--r--mono/cil/.cvsignore3
-rw-r--r--mono/cil/ChangeLog25
-rw-r--r--mono/cil/Makefile.am12
-rw-r--r--mono/cil/TODO3
-rw-r--r--mono/cil/cil-opcodes.xml297
-rw-r--r--mono/cil/make-opcode-def.xsl100
-rw-r--r--mono/cil/make-opcodes-def.pl80
-rw-r--r--mono/cil/opcode.def313
-rw-r--r--mono/dis/.cvsignore5
-rw-r--r--mono/dis/ChangeLog346
-rw-r--r--mono/dis/Makefile.am23
-rw-r--r--mono/dis/TODO5
-rw-r--r--mono/dis/dis-cil.c272
-rw-r--r--mono/dis/dis-cil.h1
-rw-r--r--mono/dis/dump.c784
-rw-r--r--mono/dis/dump.h22
-rw-r--r--mono/dis/get.c1222
-rw-r--r--mono/dis/get.h55
-rw-r--r--mono/dis/main.c857
-rw-r--r--mono/dis/meta.h7
-rw-r--r--mono/dis/monodis.1106
-rw-r--r--mono/dis/push-pop.h265
-rw-r--r--mono/dis/util.c84
-rw-r--r--mono/dis/util.h11
-rw-r--r--mono/interpreter/.cvsignore6
-rw-r--r--mono/interpreter/ChangeLog748
-rw-r--r--mono/interpreter/Makefile.am25
-rw-r--r--mono/interpreter/hacks.h116
-rw-r--r--mono/interpreter/interp.c3987
-rw-r--r--mono/interpreter/interp.h79
-rw-r--r--mono/interpreter/mint.161
-rw-r--r--mono/io-layer/.cvsignore4
-rw-r--r--mono/io-layer/ChangeLog276
-rw-r--r--mono/io-layer/Makefile.am99
-rw-r--r--mono/io-layer/atomic.c130
-rw-r--r--mono/io-layer/atomic.h111
-rw-r--r--mono/io-layer/context.c13
-rw-r--r--mono/io-layer/context.h77
-rw-r--r--mono/io-layer/critical-sections.c146
-rw-r--r--mono/io-layer/critical-sections.h27
-rw-r--r--mono/io-layer/error.c46
-rw-r--r--mono/io-layer/error.h1792
-rw-r--r--mono/io-layer/events.c667
-rw-r--r--mono/io-layer/events.h11
-rw-r--r--mono/io-layer/handles-private.h12
-rw-r--r--mono/io-layer/handles.c166
-rw-r--r--mono/io-layer/handles.h12
-rw-r--r--mono/io-layer/io-layer-dummy.c2
-rw-r--r--mono/io-layer/io-layer.h26
-rw-r--r--mono/io-layer/io.c2028
-rw-r--r--mono/io-layer/io.h174
-rw-r--r--mono/io-layer/macros.h15
-rw-r--r--mono/io-layer/misc-private.h9
-rw-r--r--mono/io-layer/misc.c18
-rw-r--r--mono/io-layer/mono-mutex.c320
-rw-r--r--mono/io-layer/mono-mutex.h160
-rw-r--r--mono/io-layer/mutexes.c372
-rw-r--r--mono/io-layer/mutexes.h9
-rw-r--r--mono/io-layer/semaphores.c436
-rw-r--r--mono/io-layer/semaphores.h9
-rw-r--r--mono/io-layer/sockets.c977
-rw-r--r--mono/io-layer/sockets.h98
-rw-r--r--mono/io-layer/status.h36
-rw-r--r--mono/io-layer/system.c17
-rw-r--r--mono/io-layer/system.h33
-rw-r--r--mono/io-layer/threads.c657
-rw-r--r--mono/io-layer/threads.h53
-rw-r--r--mono/io-layer/timed-thread.c144
-rw-r--r--mono/io-layer/timed-thread.h33
-rw-r--r--mono/io-layer/timefuncs.c17
-rw-r--r--mono/io-layer/timefuncs.h11
-rw-r--r--mono/io-layer/types.h17
-rw-r--r--mono/io-layer/uglify.h58
-rw-r--r--mono/io-layer/unicode.c41
-rw-r--r--mono/io-layer/unicode.h10
-rw-r--r--mono/io-layer/wait-private.h42
-rw-r--r--mono/io-layer/wait.c484
-rw-r--r--mono/io-layer/wait.h22
-rw-r--r--mono/io-layer/wapi-private.h76
-rw-r--r--mono/io-layer/wapi.h22
-rw-r--r--mono/jit/.cvsignore10
-rw-r--r--mono/jit/ChangeLog1195
-rw-r--r--mono/jit/Makefile.am53
-rw-r--r--mono/jit/TODO34
-rw-r--r--mono/jit/debug-dwarf2-plus.c58
-rw-r--r--mono/jit/debug-dwarf2.c1385
-rw-r--r--mono/jit/debug-private.h73
-rw-r--r--mono/jit/debug-stabs.c213
-rw-r--r--mono/jit/debug.c513
-rw-r--r--mono/jit/debug.h73
-rw-r--r--mono/jit/delegate.c439
-rw-r--r--mono/jit/emit-x86.c968
-rw-r--r--mono/jit/exception.c370
-rw-r--r--mono/jit/interp.brg731
-rw-r--r--mono/jit/invoke.c606
-rw-r--r--mono/jit/jit.c3688
-rw-r--r--mono/jit/jit.h284
-rw-r--r--mono/jit/message.c342
-rw-r--r--mono/jit/mono.c227
-rw-r--r--mono/jit/regset.c115
-rw-r--r--mono/jit/regset.h38
-rw-r--r--mono/jit/trampoline.c342
-rw-r--r--mono/jit/win32-exception.c104
-rw-r--r--mono/jit/win32-exception.h58
-rw-r--r--mono/jit/x86.brg4092
-rw-r--r--mono/metadata/.cvsignore5
-rw-r--r--mono/metadata/ChangeLog2163
-rw-r--r--mono/metadata/Makefile.am91
-rw-r--r--mono/metadata/TODO15
-rw-r--r--mono/metadata/appdomain.c351
-rw-r--r--mono/metadata/appdomain.h155
-rw-r--r--mono/metadata/assembly.c427
-rw-r--r--mono/metadata/assembly.h22
-rw-r--r--mono/metadata/blob.h51
-rw-r--r--mono/metadata/cil-coff.h150
-rw-r--r--mono/metadata/class.c1427
-rw-r--r--mono/metadata/class.h199
-rw-r--r--mono/metadata/debug-helpers.c416
-rw-r--r--mono/metadata/debug-helpers.h37
-rw-r--r--mono/metadata/debug-symfile.c815
-rw-r--r--mono/metadata/debug-symfile.h128
-rw-r--r--mono/metadata/decimal.c1517
-rw-r--r--mono/metadata/decimal.h39
-rw-r--r--mono/metadata/domain.c434
-rw-r--r--mono/metadata/exception.c201
-rw-r--r--mono/metadata/exception.h67
-rw-r--r--mono/metadata/file-io.c597
-rw-r--r--mono/metadata/file-io.h157
-rw-r--r--mono/metadata/gc.c103
-rw-r--r--mono/metadata/gc.h24
-rw-r--r--mono/metadata/icall.c2535
-rw-r--r--mono/metadata/image.c651
-rw-r--r--mono/metadata/image.h116
-rw-r--r--mono/metadata/loader.c512
-rw-r--r--mono/metadata/loader.h93
-rw-r--r--mono/metadata/marshal.c33
-rw-r--r--mono/metadata/marshal.h18
-rw-r--r--mono/metadata/mempool.c123
-rw-r--r--mono/metadata/mempool.h20
-rw-r--r--mono/metadata/metadata.c2577
-rw-r--r--mono/metadata/metadata.h297
-rw-r--r--mono/metadata/mono-endian.c78
-rw-r--r--mono/metadata/mono-endian.h48
-rw-r--r--mono/metadata/object.c1192
-rw-r--r--mono/metadata/object.h289
-rw-r--r--mono/metadata/opcodes.c30
-rw-r--r--mono/metadata/opcodes.h54
-rw-r--r--mono/metadata/pedump.c194
-rw-r--r--mono/metadata/private.h78
-rw-r--r--mono/metadata/profiler-private.h40
-rw-r--r--mono/metadata/profiler.c618
-rw-r--r--mono/metadata/profiler.h80
-rw-r--r--mono/metadata/rand.c112
-rw-r--r--mono/metadata/rand.h19
-rw-r--r--mono/metadata/rawbuffer.c204
-rw-r--r--mono/metadata/rawbuffer.h5
-rw-r--r--mono/metadata/reflection.c3042
-rw-r--r--mono/metadata/reflection.h373
-rw-r--r--mono/metadata/row-indexes.h385
-rw-r--r--mono/metadata/socket-io.c1371
-rw-r--r--mono/metadata/socket-io.h160
-rw-r--r--mono/metadata/string-icalls.c813
-rw-r--r--mono/metadata/string-icalls.h129
-rw-r--r--mono/metadata/sysmath.c116
-rw-r--r--mono/metadata/sysmath.h61
-rw-r--r--mono/metadata/tabledefs.h213
-rw-r--r--mono/metadata/threads-types.h46
-rw-r--r--mono/metadata/threads.c904
-rw-r--r--mono/metadata/threads.h64
-rw-r--r--mono/metadata/tokentype.h39
-rw-r--r--mono/metadata/typedef.c54
-rw-r--r--mono/metadata/unicode.c464
-rw-r--r--mono/metadata/unicode.h123
-rw-r--r--mono/metadata/verify.c2067
-rw-r--r--mono/metadata/verify.h27
-rw-r--r--mono/monoburg/.cvsignore8
-rw-r--r--mono/monoburg/ChangeLog94
-rw-r--r--mono/monoburg/Makefile.am28
-rw-r--r--mono/monoburg/README9
-rw-r--r--mono/monoburg/monoburg.190
-rw-r--r--mono/monoburg/monoburg.c928
-rw-r--r--mono/monoburg/monoburg.h63
-rw-r--r--mono/monoburg/monoburg.y241
-rw-r--r--mono/monoburg/sample.brg145
-rw-r--r--mono/monograph/.cvsignore5
-rw-r--r--mono/monograph/ChangeLog30
-rw-r--r--mono/monograph/Makefile.am27
-rw-r--r--mono/monograph/monograph.c766
-rw-r--r--mono/tests/.cvsignore7
-rw-r--r--mono/tests/Makefile.am150
-rw-r--r--mono/tests/ackermann.cs18
-rw-r--r--mono/tests/appdomain-client.cs20
-rw-r--r--mono/tests/appdomain.cs36
-rw-r--r--mono/tests/array-cast.cs12
-rw-r--r--mono/tests/array-init.cs44
-rw-r--r--mono/tests/array-vt.cs15
-rwxr-xr-xmono/tests/array.cs127
-rw-r--r--mono/tests/array2.cs13
-rw-r--r--mono/tests/arraylist-clone.cs34
-rw-r--r--mono/tests/arraylist.cs19
-rw-r--r--mono/tests/assignable-tests.cs69
-rwxr-xr-xmono/tests/autoresetevents.cs67
-rw-r--r--mono/tests/bench1.cs46
-rw-r--r--mono/tests/bitconverter.cs22
-rwxr-xr-xmono/tests/box.cs33
-rw-r--r--mono/tests/cattr-compile.cs11
-rw-r--r--mono/tests/codegen-interfaces.cs44
-rw-r--r--mono/tests/codegen.cs44
-rw-r--r--mono/tests/codegen2.cs63
-rwxr-xr-xmono/tests/console.cs13
-rw-r--r--mono/tests/custom-attr.cs37
-rw-r--r--mono/tests/delegate.cs75
-rw-r--r--mono/tests/delegate1.cs61
-rw-r--r--mono/tests/delegate2.cs50
-rw-r--r--mono/tests/delegate3.cs45
-rw-r--r--mono/tests/delegate4.cs24
-rw-r--r--mono/tests/double-cast.cs15
-rwxr-xr-xmono/tests/enum.cs38
-rwxr-xr-xmono/tests/enum2.cs79
-rwxr-xr-xmono/tests/enum3.cs32
-rw-r--r--mono/tests/enumcast.cs19
-rwxr-xr-xmono/tests/exception.cs50
-rwxr-xr-xmono/tests/exception2.cs22
-rwxr-xr-xmono/tests/exception3.cs53
-rwxr-xr-xmono/tests/exception4.cs47
-rwxr-xr-xmono/tests/exception5.cs30
-rwxr-xr-xmono/tests/exception6.cs224
-rw-r--r--mono/tests/exception7.cs20
-rwxr-xr-xmono/tests/fib.cs26
-rw-r--r--mono/tests/field-layout.cs59
-rw-r--r--mono/tests/hash-table.cs27
-rw-r--r--mono/tests/hashcode.cs28
-rw-r--r--mono/tests/iface.cs23
-rw-r--r--mono/tests/iface2.cs81
-rw-r--r--mono/tests/iface3.cs49
-rw-r--r--mono/tests/iface4.cs58
-rw-r--r--mono/tests/iface6.cs79
-rw-r--r--mono/tests/indexer.cs32
-rw-r--r--mono/tests/interface.cs56
-rw-r--r--mono/tests/interface1.cs19
-rw-r--r--mono/tests/intptrcast.cs14
-rw-r--r--mono/tests/ipaddress.cs30
-rw-r--r--mono/tests/isvaluetype.cs38
-rw-r--r--mono/tests/jit-float.cs125
-rw-r--r--mono/tests/jit-int.cs142
-rw-r--r--mono/tests/jit-long.cs178
-rw-r--r--mono/tests/jit-uint.cs82
-rw-r--r--mono/tests/jit-ulong.cs82
-rw-r--r--mono/tests/libtest.c49
-rw-r--r--mono/tests/long.cs50
-rwxr-xr-xmono/tests/manualresetevents.cs63
-rw-r--r--mono/tests/many-locals.cs427
-rwxr-xr-xmono/tests/mis.cs247
-rw-r--r--mono/tests/mutexes.cs87
-rwxr-xr-xmono/tests/nested-loops.cs31
-rw-r--r--mono/tests/newobj-valuetype.cs21
-rwxr-xr-xmono/tests/nonvirt.cs22
-rwxr-xr-xmono/tests/obj.cs30
-rwxr-xr-xmono/tests/outparm.cs21
-rw-r--r--mono/tests/params.cs22
-rwxr-xr-xmono/tests/pinvoke.cs35
-rwxr-xr-xmono/tests/pinvoke1.cs46
-rw-r--r--mono/tests/pointer.cs33
-rw-r--r--mono/tests/pop.cs25
-rwxr-xr-xmono/tests/property.cs25
-rwxr-xr-xmono/tests/random.cs21
-rw-r--r--mono/tests/reflection-enum.cs44
-rw-r--r--mono/tests/reflection-prop.cs21
-rw-r--r--mono/tests/reflection.cs37
-rw-r--r--mono/tests/reflection4.cs18
-rw-r--r--mono/tests/reflection5.cs16
-rw-r--r--mono/tests/remoting1.cs175
-rw-r--r--mono/tests/remoting2.cs113
-rw-r--r--mono/tests/remoting3.cs124
-rw-r--r--mono/tests/rounding.cs15
-rw-r--r--mono/tests/setenv.cs24
-rw-r--r--mono/tests/sieve.cs32
-rwxr-xr-xmono/tests/static-constructor.cs23
-rwxr-xr-xmono/tests/stream-writer.cs19
-rwxr-xr-xmono/tests/stream.cs25
-rw-r--r--mono/tests/string-compare.cs50
-rwxr-xr-xmono/tests/string.cs19
-rw-r--r--mono/tests/stringbuilder.cs25
-rwxr-xr-xmono/tests/struct.cs58
-rw-r--r--mono/tests/switch-string.cs23
-rwxr-xr-xmono/tests/switch.cs26
-rwxr-xr-xmono/tests/test-driver35
-rwxr-xr-xmono/tests/test-ops.cs69
-rw-r--r--mono/tests/test-prime.cs20
-rwxr-xr-xmono/tests/thread.cs20
-rwxr-xr-xmono/tests/thread2.cs96
-rwxr-xr-xmono/tests/thread3.cs68
-rw-r--r--mono/tests/thread4.cs16
-rw-r--r--mono/tests/tight-loop.cs9
-rw-r--r--mono/tests/time.cs17
-rw-r--r--mono/tests/unreachable-code.cs17
-rw-r--r--mono/tests/valuetype-gettype.cs17
-rw-r--r--mono/tests/vararg.cs30
-rw-r--r--mono/tests/virtual-method.cs41
-rw-r--r--mono/tests/vtype.cs20
-rw-r--r--mono/utils/.cvsignore3
-rw-r--r--mono/utils/ChangeLog9
-rw-r--r--mono/utils/Makefile.am14
-rw-r--r--mono/utils/mono-hash.c720
-rw-r--r--mono/utils/mono-hash.h81
-rw-r--r--mono/wrapper/.cvsignore9
-rw-r--r--mono/wrapper/ChangeLog61
-rw-r--r--mono/wrapper/Makefile.am44
-rwxr-xr-xmono/wrapper/build-dll71
-rwxr-xr-xmono/wrapper/genwrapper.pl528
-rw-r--r--mono/wrapper/glob.c57
-rw-r--r--mono/wrapper/libmonowrapper.rc32
-rw-r--r--mono/wrapper/wrapper.c201
-rw-r--r--notes/cil13
-rw-r--r--runtime/.cvsignore3
-rw-r--r--runtime/Makefile.am39
-rw-r--r--scripts/.cvsignore3
-rw-r--r--scripts/Makefile.am9
-rw-r--r--scripts/mcs.in2
-rwxr-xr-xstatus/.cvsignore7
-rwxr-xr-xstatus/ByMaintainer.cs52
-rwxr-xr-xstatus/ByMaintainer.xsl37
-rwxr-xr-xstatus/ByNamespace.cs55
-rwxr-xr-xstatus/ByNamespace.xsl39
-rwxr-xr-xstatus/ChangeLog64
-rwxr-xr-xstatus/class.xml5337
-rwxr-xr-xstatus/commands86
-rwxr-xr-xstatus/compare-assembly.cs164
-rwxr-xr-xstatus/index.src17
-rwxr-xr-xstatus/maintainer.src1
-rwxr-xr-xstatus/maintainers.xml54
-rwxr-xr-xstatus/make_web.pl21
-rw-r--r--status/makefile36
-rwxr-xr-xstatus/mono-stats289
-rwxr-xr-xstatus/namespace.src1
-rw-r--r--web/.cvsignore4
-rw-r--r--web/Makefile.am32
-rw-r--r--web/README17
-rw-r--r--web/ado-net44
-rw-r--r--web/anoncvs70
-rwxr-xr-xweb/asp-net11
-rw-r--r--web/books37
-rw-r--r--web/c-sharp223
-rw-r--r--web/ccvs138
-rw-r--r--web/class-library190
-rw-r--r--web/class-status.in26
-rw-r--r--web/classlib-doc105
-rw-r--r--web/contact13
-rw-r--r--web/contributing189
-rw-r--r--web/devel-faq190
-rw-r--r--web/documentation62
-rw-r--r--web/download352
-rw-r--r--web/faq698
-rw-r--r--web/gcc-frontend9
-rw-r--r--web/ideas112
-rw-r--r--web/index1016
-rwxr-xr-xweb/java52
-rw-r--r--web/jit-debug181
-rw-r--r--web/jit-debug-sample86
-rw-r--r--web/jit-debug-sample270
-rwxr-xr-xweb/languages19
-rw-r--r--web/mailing-lists90
-rwxr-xr-xweb/mono-build-w32.sh142
-rwxr-xr-xweb/mono-build.sh183
-rw-r--r--web/monodoc-xml755
-rw-r--r--web/papers96
-rw-r--r--web/passport293
-rw-r--r--web/pending14
-rw-r--r--web/pending-classes.in246
-rwxr-xr-xweb/plans15
-rw-r--r--web/porting63
-rw-r--r--web/rationale173
-rw-r--r--web/release-notes/mono-0.346
-rw-r--r--web/release-notes/mono-0.443
-rw-r--r--web/resources188
-rw-r--r--web/resources-pending30
-rw-r--r--web/roadmap12
-rw-r--r--web/runtime195
-rw-r--r--web/status40
-rw-r--r--web/team2
-rw-r--r--web/testing46
-rw-r--r--web/thanks6
-rw-r--r--web/todo1
-rw-r--r--web/tools67
-rw-r--r--web/web/.cvsignore2
-rw-r--r--web/web/commands40
-rwxr-xr-xweb/web/deploy/.cvsignore1
-rw-r--r--web/web/deploy/cm/c.gifbin0 -> 150 bytes
-rw-r--r--web/web/deploy/cm/cormissing.css182
-rw-r--r--web/web/deploy/cm/cormissing.js392
-rw-r--r--web/web/deploy/cm/d.gifbin0 -> 137 bytes
-rw-r--r--web/web/deploy/cm/e.gifbin0 -> 861 bytes
-rw-r--r--web/web/deploy/cm/en.gifbin0 -> 111 bytes
-rw-r--r--web/web/deploy/cm/f.gifbin0 -> 90 bytes
-rw-r--r--web/web/deploy/cm/i.gifbin0 -> 90 bytes
-rw-r--r--web/web/deploy/cm/m.gifbin0 -> 101 bytes
-rw-r--r--web/web/deploy/cm/n.gifbin0 -> 65 bytes
-rw-r--r--web/web/deploy/cm/p.gifbin0 -> 111 bytes
-rw-r--r--web/web/deploy/cm/r.gifbin0 -> 73 bytes
-rw-r--r--web/web/deploy/cm/s.gifbin0 -> 127 bytes
-rw-r--r--web/web/deploy/cm/sc.gifbin0 -> 70 bytes
-rw-r--r--web/web/deploy/cm/se.gifbin0 -> 73 bytes
-rw-r--r--web/web/deploy/cm/sm.gifbin0 -> 76 bytes
-rw-r--r--web/web/deploy/cm/st.gifbin0 -> 101 bytes
-rw-r--r--web/web/deploy/cm/sx.gifbin0 -> 73 bytes
-rw-r--r--web/web/deploy/cm/tb.gifbin0 -> 49 bytes
-rw-r--r--web/web/deploy/cm/tm.gifbin0 -> 64 bytes
-rw-r--r--web/web/deploy/cm/tp.gifbin0 -> 67 bytes
-rw-r--r--web/web/deploy/cm/y.gifbin0 -> 92 bytes
-rw-r--r--web/web/deploy/images/bgsquares.gifbin0 -> 4963 bytes
-rw-r--r--web/web/deploy/images/bgsquares.pngbin0 -> 4643 bytes
-rw-r--r--web/web/deploy/images/bgsquares.xcf.gzbin0 -> 2775 bytes
-rw-r--r--web/web/deploy/images/mono.gifbin0 -> 3079 bytes
-rw-r--r--web/web/deploy/images/mono.pngbin0 -> 4495 bytes
-rw-r--r--web/web/deploy/images/pixel.gifbin0 -> 49 bytes
-rw-r--r--web/web/deploy/images/pixel.pngbin0 -> 156 bytes
-rw-r--r--web/web/htmlify28
-rw-r--r--web/web/icaza.pl76
-rw-r--r--web/web/images/bgsquares.gifbin0 -> 4963 bytes
-rw-r--r--web/web/images/bgsquares.pngbin0 -> 4644 bytes
-rw-r--r--web/web/images/bgsquares.xcf.gzbin0 -> 2775 bytes
-rw-r--r--web/web/images/mono.gifbin0 -> 3079 bytes
-rw-r--r--web/web/images/mono.pngbin0 -> 4496 bytes
-rw-r--r--web/web/images/pixel.gifbin0 -> 49 bytes
-rw-r--r--web/web/images/pixel.pngbin0 -> 157 bytes
-rw-r--r--web/web/makefile100
-rwxr-xr-xweb/web/process.pl89
-rwxr-xr-xweb/web/src/.cvsignore1
-rw-r--r--web/web/template.html.in85
-rw-r--r--web/winforms90
4005 files changed, 458631 insertions, 11022 deletions
diff --git a/.cvsignore b/.cvsignore
new file mode 100644
index 00000000000..ccea8b4dfbe
--- /dev/null
+++ b/.cvsignore
@@ -0,0 +1,17 @@
+aclocal.m4
+config.cache
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+libtool
+ltmain.sh
+ltconfig
+Makefile
+Makefile.in
+mono-*.tar.gz
+stamp-h
+stamp-h.in
diff --git a/AUTHORS b/AUTHORS
index 25e66d4943c..6c19bda941e 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1 +1,3 @@
Miguel de Icaza (miguel@ximian.com)
+Paolo Molaro (lupus@ximian.com)
+Dietmar Maurer (dietmar@ximian.com)
diff --git a/COPYING.LIB b/COPYING.LIB
new file mode 100644
index 00000000000..ee8f329b8e3
--- /dev/null
+++ b/COPYING.LIB
@@ -0,0 +1,485 @@
+
+The Mono runtime is licensed under the terms of the GNU
+Library General Public License, version 2.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/ChangeLog b/ChangeLog
index 1a76f446632..2150c2e9c97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,393 @@
+2002-04-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * configure.in: removed -Wshadow from CFLAGS.
+
+2002-04-12 Rodrigo Moya <rodrigo@ximian.com>
+
+ * status/maintainers.xml: added danmorg and myself for System.Data.*
+ classes.
+
+ * status/class.xml: added System.Data.* classes.
+
+2002-04-08 Dick Porter <dick@ximian.com>
+
+ * configure.in: Set -mno-cygwin here rather than in the build script
+
+2002-04-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/remoting2.cs: new test for async invoke of proxy calls
+
+2002-03-29 Martin Baulig <martin@gnome.org>
+
+ * doc/jit-debug, docs/jit-debug-sample, docs/jit-debug-sample2:
+ New files, added documentation for the debugging code.
+
+ * doc/web/commands: Added the debugging pages.
+
+ * docs/jit-debug: Removed, this is now on the web site.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * man/mcs.1: Documented the new --debug option and added a section
+ about debugging support.
+
+ * man/mono.1: Documented the new --dwarf and --dwarf-plus options.
+
+2002-03-21 Martin Baulig <martin@gnome.org>
+
+ * configure.in: Added check for <elf.h>.
+
+2002-03-18 Dick Porter <dick@ximian.com>
+
+ * configure.in: Only look for libgc on the system. Default to not
+ using GC at all, because it doesn't work with the jit.
+
+2002-03-17 Miguel de Icaza <miguel@ximian.com>
+
+ * configure.in: Add support for building the included boehm GC.
+
+Thu Mar 7 17:19:44 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * configure.in: detect Boehm GC libs and add --with-gc switch.
+ Boehm GC needs to be explicitly enabled since the JIT currently fails
+ in some cases with it.
+
+2002-02-27 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/fib.cs: it is now possible to pass a repeat count as
+ command line argument, for example fib.exe 20 runs the test 20
+ times.
+
+2002-02-25 Sergey Chaban <serge@wildwestsoftware.com>
+ * configure.in: added support for ARM target arch.
+ Uncommented and modified arm-*-linux* target,
+ added mono/arch/arm/Makefile to AC_OUTPUT list.
+
+2002-02-21 Mark Crichton <crichton@gimp.org>
+
+ * status/class.xml: Added contact info for RNGCryptoServiceProvider
+ class and Rijndael classes.
+ * status/maintainers.xml: Added contact info to maintainers list.
+
+2002-02-21 Mark Crichton <crichton@gimp.org>
+
+ * configure.in: Add checks for a system-provided entropy device
+ * acconfig.h: Added HAVE_CRYPT_RNG and NAME_DEV_RANDOM
+
+2002-02-20 Dick Porter <dick@ximian.com>
+
+ * acconfig.h:
+ * configure.in: Always build without cygwin support on windows
+
+2002-02-19 Radek Doulik <rodo@ximian.com>
+
+ * mono/tests/pinvoke.cs: use more pinvoke test methods
+
+2002-02-19 Radek Doulik <rodo@ximian.com>
+
+ * mono/tests/libtest.c (mono_test_many_short_arguments): new test
+ method
+ (mono_test_many_byte_arguments): ditto
+
+2002-02-18 Radek Doulik <rodo@ximian.com>
+
+ * mono/tests/Makefile.am: added small test library for pinvoke
+ testing
+
+ * mono/tests/libtest.c (mono_test_many_int_arguments): new file,
+ new function to test pinvoke
+
+ * mono/tests/pinvoke.cs (Test): added pinvoked method with 10 int
+ arguments
+
+ * mono/tests/Makefile.am: display # of passing tests too
+ added simple shared library libtest with testing function for
+ pinvoke
+
+2002-02-17 Radek Doulik <rodo@ximian.com>
+
+ * mono/tests/Makefile.am (test): display # of failed tests
+
+2002-02-16 Jeffrey Stedfast <fejj@ximian.com>
+
+ * configure.in: Add checks for SOL_IP, SOL_TCP, and
+ IP_PKTINFO. Also check for struct ip_mreqn.
+
+2002-02-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * configure.in: Add checks to see if we need to link to libsocket,
+ libnsl, and/or librt. Also check for inet_pton and inet_aton.
+
+2002-02-13 Jeffrey Stedfast <fejj@ximian.com>
+
+ * acconfig.h: #undef USE_MONO_MUTEX
+
+ * configure.in: If the system pthread implementation is lacking,
+ default to using mono-mutex.
+
+2002-02-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/enum2.cs: new file with more enum tests.
+
+2002-02-01 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/jit-long.cs: added some SHL/SHR tests
+
+Fri Feb 1 15:32:36 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * configure.in: allow PKG_CONFIG_PATH for the build-platform
+ pkg-config invocation.
+
+Fri Feb 1 15:13:25 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * configure.in: add some support/fixes for cross-compilation.
+
+2002-01-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/exception6.cs: new tests for ADD_OVF, MUL_OVF
+ added tests for SUB_OVF, SUB_OVF_UN
+
+2001-12-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/Makefile.am (TESTSRC): disabled stream-writer test
+
+2001-12-21 Aaron Weber <aaron@ximian.com>
+
+ * doc/faq (A): added a linebreak that was missing and was causing
+ a heading to appear badly.
+
+2001-12-20 Aaron Weber <aaron@ximian.com>
+
+ * doc/faq: added <a name=""> nav links, and moved all MSFT-related
+ questions into a single section.
+
+2001-12-17 Aaron Weber <aaron@ximian.com>
+
+ * doc/faq (Q): Question-by-question, line-by-line revision.
+
+2001-12-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/time.cs: new test
+
+2001-11-30 Radek Doulik <rodo@ximian.com>
+
+ * configure.in: remove ACCESS_UNALIGNED="no" from ppc
+
+2001-11-29 Radek Doulik <rodo@ximian.com>
+
+ * configure.in (ACCESS_UNALIGNED): uncommented and modified
+ powerpc-*-linux*
+ generate mono/arch/ppc/Makefile
+
+2001-11-26 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/exception3.cs: modified the test to show a bug in the
+ current exception handling implementation.
+
+2001-11-13 Dick Porter <dick@ximian.com>
+
+ * configure.in: Some more tests for pthread features
+ (specifically, glibc 2.1 doesnt define pthread_mutex_timedlock but
+ still needs _GNU_SOURCE for PTHREAD_MUTEX_RECURSIVE)
+
+2001-11-09 Dick Porter <dick@ximian.com>
+
+ * configure.in: Try and get large file support, but it's not fatal
+ if it's not there (the io-layer just ignores the high word in that
+ case.)
+
+ Check for windows builds, and only bother to look for pthreads and
+ large files if we're not building for cygwin or native win32. Not
+ having pthread support on Posix systems is now a fatal error.
+
+ * autogen.sh: Fix ACLOCAL_FLAGS - it wasn't being passed to
+ aclocal
+
+2001-10-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/Makefile.am: removed JITTESTS, simply run all tests for
+ target testjit.
+
+2001-10-11 Dietmar Maurer <dietmar@ximian.com>
+
+ * docs/object-layout: more documentation
+
+Mon Oct 8 20:27:50 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * configure.in: define NO_UNALIGNED_ACCESS for platforms that
+ can't read on unaligned boundaries
+
+2001-10-04 Dick Porter <dick@ximian.com>
+
+ * configure.in: Do some deeper checks on pthreads for some of the
+ more interesting functions
+
+2001-09-24 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/Makefile.am (testjit): a new target to test the JITer
+
+ * mono/tests/jit-*: added some test for the JITer
+
+2001-09-23 Dick Porter <dick@ximian.com>
+
+ * configure.in: Arrange to compile dummy thread support routines
+ if pthread isnt available
+
+2001-09-23 Dick Porter <dick@ximian.com>
+
+ * configure.in: Check for pthread.h, so that we can check for the
+ HAVE_PTHREAD_H define in config.h
+
+2001-09-21 Dick Porter <dick@ximian.com>
+
+ * configure.in: Check for libpthread
+
+2001-09-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/test-ops.cs: added more tests
+
+Mon Sep 10 20:19:00 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * configure.in: check for sizeof(void*) and for the architecture.
+
+2001-09-05 Dick Porter <dick@ximian.com>
+
+ * autogen.sh: Fixed the section that adds $ACLOCAL_FLAGS to the
+ aclocal invocation, so putting aclocal files in /usr/local works
+
+2001-08-30 Dietmar Maurer <dietmar@ximian.com>
+
+ * *: removed the libffi dependency, mono now compiles on cygwin
+
+ * mono/wrapper/build-dll: new file.
+
+2001-08-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/console.cs: impl.
+
+ * mono/tests/box.cs: impl.
+
+ * mono/tests/stream-writer.cs: impl.
+
+Mon Aug 27 20:24:26 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * mono/tests/*: New test cases, mostly for virtual method dispatch.
+ Use make testb for the slow benchmarking programs,
+ make test for the usual regression test checks.
+
+2001-08-22 Rodrigo Moya <rodrigo@ximian.com>
+
+ * mono/cil/Makefile.am:
+ * mono/wrapper/Makefile.am: use correct variables for installation
+ directories
+
+Tue Aug 21 18:54:06 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * mono/tests/exceptions*: enhanced and added more tests for
+ exceptions.
+
+2001-08-20 Miguel de Icaza <miguel@ximian.com>
+
+ * mono/Makefile.am (SUBDIRS): Remove `test' from here to allow us
+ to pass make distcheck
+
+ * mono/wrapper/Makefile.am (EXTRA_DIST): Include genwrapper.pl
+
+ * configure.in, Makefile.am, runtime/Makefile.am (dist-hook,
+ install-data-hook): Added mechanism to distribute and install the
+ dll files.
+
+2001-08-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/stream.cs: new tests for the Stream class
+
+ * configure.in: I really need LIBTOOL for libmonowrapper.so, so I
+ added it again.
+
+2001-08-16 Alex Graveley <alex@ximian.com>
+
+ * configure.in: Replace AM_PROG_LIBTOOL with AC_PROG_RANLIB. This
+ removes libtool dependency on all of Mono.
+
+2001-08-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/array.cs: more array tests
+
+2001-08-09 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/array.cs: more array tests
+
+2001-08-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/pinvoke.cs: we can now print strings ;-)
+
+ * mono/tests/array.cs: new test for arrays
+
+2001-08-02 Alex Graveley <alex@ximian.com>
+
+ * libffi/*: Import libffi CVS version, with minor changes to make it
+ compile.
+
+ * mono/interpreter/Makefile.am: Link against
+ ../../libffi/.libs/libffi.a.
+
+ * Makefile.am: Add libffi
+
+ * autogen.sh: Replace with adapted gnome autogen.sh
+
+ * configure.in: Add AC_CONFIG_SUBDIRS(libffi).
+
+2001-08-02 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono/tests/pinvoke.cs: impl.
+
+Wed Aug 1 22:34:52 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * configure.in, mono/tests: added some tests for the interpreter.
+
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * doc/download: added instructions for cygwin
+
+ * doc/c-sharp: removed bit about compiling
+
+ * status/compare-assembly.cs: basedir should be there if
+ parameters are provided.
+
+ * status/makefile: made targets to dump info.
+
+2001-07-15 Joe Shaw <joe@ximian.com>
+
+ * configure.in: Don't create doc/Makefile as there's nothing there
+ to make.
+
+ * Makefile.am: Don't build the doc directory because there's no
+ Makefile.am there.
+
+ * autogen.sh: Call aclocal with the $ACLOCAL_FLAGS env var.
+
+2001-07-15 Miguel de Icaza <miguel@ximian.com>
+
+ * doc/class-library (A): Updated FAQ with question on error 1595.
+
+2001-07-14 Miguel de Icaza <miguel@ximian.com>
+
+ * doc/index:
+
+Wed Jul 11 00:36:36 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * status/*: scripts and data to create statistics about the
+ class library status.
+
+2001-07-09 Alex Graveley <alex@ximian.com>
+
+ * doc/makefile (clean): Add clean target.
+ * doc/web/makefile (clean): Ditto.
+
+2001-07-09 Alex Graveley <alex@ximian.com>
+
+ * doc/makefile (all-docs): Fix typo.
+
2001-05-30 Miguel de Icaza <miguel@ximian.com>
* NEWS:
diff --git a/Makefile.am b/Makefile.am
index 7a0d4a47da8..b4ab7f57021 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1 +1,3 @@
-SUBDIRS = mono
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = mono doc docs runtime scripts man
diff --git a/NEWS b/NEWS
index 37b3c8595b0..a0597920702 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,23 @@
+2002-Feb-11 Miguel de Icaza <miguel@ximian.com>
+
+ New release, functional x86-JIT, x86 interpreter, ppc interpreter
+
+ Class libraries ship.
+
+ Limited compiler ships.
+
+ Too many changes to list
+
+2001-07-12 Miguel de Icaza <miguel@ximian.com>
+
+ New XSLT file from Sergey Chaban for CIL opcodes
+
+ Paolo got the beginning of an interpreter in.
+
+ Further work on the dissasembler.
+
+ Fix various parts of the metadata library
+
2001-05-30 Miguel de Icaza <miguel@ximian.com>
Project started
diff --git a/README b/README
index 27f2ef4c497..95e4b3806a1 100644
--- a/README
+++ b/README
@@ -1,3 +1,52 @@
-This is MonoNet.
-Ximian's portable implementation of .NET
+This is Mono.
+
+Installation:
+
+ Read doc/download for installation instructions,
+ or read the HTML version:
+
+ http://www.go-mono.com/download.html
+
+A directory roadmap:
+
+ doc/
+ Contains documentation and the web site contents.
+
+ mono/
+ The core of the executable.
+
+ metadata/
+ The library to deal with executables and libraries for
+ .NET
+
+ dis/
+ CIL executable Disassembler
+
+ cli/
+ Common code for the JIT and the interpreter.
+
+ cil/
+ Common Intermediate Representation, XML
+ definition of the CIL bytecodes.
+
+ interp/
+ Interpreter for CLI executables.
+
+* Using Mono
+
+ Once you have installed the software, you can run a few programs:
+
+ monodis program.exe
+
+ That will dump the bytecodes for program.exe. Monodis support
+ a number of options that dumps various metadata tables
+ (chapter 23 of the Partition III).
+
+ You can try the interpreter like this:
+
+ mint program.exe
+
+
+
+
diff --git a/acconfig.h b/acconfig.h
new file mode 100644
index 00000000000..53815a7b6bf
--- /dev/null
+++ b/acconfig.h
@@ -0,0 +1,15 @@
+#undef HAVE_INET_PTON
+#undef HAVE_INET_ATON
+#undef HAVE_SOL_IP
+#undef HAVE_SOL_TCP
+#undef HAVE_IP_PKTINFO
+#undef HAVE_STRUCT_IP_MREQN
+#undef HAVE_PTHREAD
+#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK
+#undef USE_MONO_MUTEX
+#undef HAVE_LARGE_FILE_SUPPORT
+#undef PLATFORM_WIN32
+#undef HAVE_NEW_ICONV
+#undef NAME_DEV_RANDOM
+#undef HAVE_CRYPT_RNG
+#undef HAVE_BOEHM_GC
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 00000000000..6f5d86a5691
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,120 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+# Ripped off from GNOME macros version
+
+DIE=0
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+if [ -n "$MONO_PATH" ]; then
+ ACLOCAL_FLAGS="-I $MONO_PATH/share/aclocal $ACLOCAL_FLAGS"
+ PATH="$MONO_PATH/bin:$PATH"
+ export PATH
+fi
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`autoconf' installed to compile Mono."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
+ (libtool --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`libtool' installed to compile Mono."
+ echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ }
+}
+
+grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
+ grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
+ (gettext --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`gettext' installed to compile Mono."
+ echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ }
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`automake' installed to compile Mono."
+ echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ NO_AUTOMAKE=yes
+}
+
+
+# if no automake, don't bother testing for aclocal
+test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: Missing \`aclocal'. The version of \`automake'"
+ echo "installed doesn't appear recent enough."
+ echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+}
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+if test -z "$*"; then
+ echo "**Warning**: I am going to run \`configure' with no arguments."
+ echo "If you wish to pass any to it, please specify them on the"
+ echo \`$0\'" command line."
+ echo
+fi
+
+case $CC in
+xlc )
+ am_opt=--include-deps;;
+esac
+
+
+if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
+ if test -z "$NO_LIBTOOLIZE" ; then
+ echo "Running libtoolize..."
+ libtoolize --force --copy
+ fi
+fi
+
+echo "Running aclocal $ACLOCAL_FLAGS ..."
+aclocal $ACLOCAL_FLAGS || {
+ echo
+ echo "**Error**: aclocal failed. This may mean that you have not"
+ echo "installed all of the packages you need, or you may need to"
+ echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
+ echo "for the prefix where you installed the packages whose"
+ echo "macros were not found"
+ exit 1
+}
+
+if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
+ echo "Running autoheader..."
+ autoheader || { echo "**Error**: autoheader failed."; exit 1; }
+fi
+
+echo "Running automake --gnu $am_opt ..."
+automake --add-missing --gnu $am_opt ||
+ { echo "**Error**: automake failed."; exit 1; }
+echo "Running autoconf ..."
+autoconf || { echo "**Error**: autoconf failed."; exit 1; }
+
+
+conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
+
+if test x$NOCONFIGURE = x; then
+ echo Running $srcdir/configure $conf_flags "$@" ...
+ $srcdir/configure $conf_flags "$@" \
+ && echo Now type \`make\' to compile $PKG_NAME || exit 1
+else
+ echo Skipping configure process.
+fi
diff --git a/config.h.in b/config.h.in
index f871c4edf55..b412155c227 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,8 +1,48 @@
-/* config.h.in. Generated automatically from configure.in by autoheader. */
+/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
+#undef HAVE_INET_PTON
+#undef HAVE_INET_ATON
+#undef HAVE_SOL_IP
+#undef HAVE_SOL_TCP
+#undef HAVE_IP_PKTINFO
+#undef HAVE_STRUCT_IP_MREQN
+#undef HAVE_PTHREAD
+#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK
+#undef USE_MONO_MUTEX
+#undef HAVE_LARGE_FILE_SUPPORT
+#undef PLATFORM_WIN32
+#undef HAVE_NEW_ICONV
+#undef NAME_DEV_RANDOM
+#undef HAVE_CRYPT_RNG
+#undef HAVE_BOEHM_GC
+
+/* The number of bytes in a void *. */
+#undef SIZEOF_VOID_P
+
+/* Define if you have the inet_aton function. */
+#undef HAVE_INET_ATON
+
+/* Define if you have the inet_pton function. */
+#undef HAVE_INET_PTON
+
+/* Define if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define if you have the <sys/filio.h> header file. */
+#undef HAVE_SYS_FILIO_H
+
+/* Define if you have the <sys/sockio.h> header file. */
+#undef HAVE_SYS_SOCKIO_H
+
+/* Define if you have the <utime.h> header file. */
+#undef HAVE_UTIME_H
+
/* Name of package */
#undef PACKAGE
diff --git a/configure.in b/configure.in
index b146447d4d7..155c6c03c47 100644
--- a/configure.in
+++ b/configure.in
@@ -1,34 +1,498 @@
+
AC_INIT(README)
+AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(mononet, 0.1)
+AM_INIT_AUTOMAKE(mono, 0.10)
AM_MAINTAINER_MODE
+dnl ****************************************
+dnl *** Check if we're building on win32 ***
+dnl ****************************************
+AC_MSG_CHECKING([if building for some Win32 platform])
+case "$host" in
+ *-*-mingw*|*-*-cygwin*)
+ platform_win32=yes
+ AC_DEFINE(PLATFORM_WIN32)
+ CC="gcc -mno-cygwin"
+ ;;
+ *)
+ platform_win32=no
+ ;;
+esac
+AC_MSG_RESULT($platform_win32)
+AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
+
+AC_CHECK_TOOL(CC, gcc, gcc)
AC_PROG_CC
AM_PROG_CC_STDC
AC_PROG_INSTALL
+dnl may require a specific autoconf version
+dnl AC_PROG_CC_FOR_BUILD
+dnl CC_FOR_BUILD not automatically detected
+CC_FOR_BUILD=$CC
+BUILD_EXEEXT=
+if test "x$cross_compiling" = "xyes"; then
+ CC_FOR_BUILD=cc
+ BUILD_EXEEXT=""
+fi
+AC_SUBST(CC_FOR_BUILD)
+AC_SUBST(HOST_CC)
+AC_SUBST(BUILD_EXEEXT)
+
# Set STDC_HEADERS
AC_HEADER_STDC
+AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
-dnl ***************************
-dnl *** Checks for glib 1.2 ***
-dnl ***************************
-AM_PATH_GLIB(1.2.0,,
- AC_MSG_ERROR([Cannot find GLIB: Is glib-config in path?]))
+AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h)
+
+AC_CHECK_HEADERS(iconv.h)
+AC_CHECK_HEADERS(giconv.h)
+
+# for mono/metadata/debug-symfile.c
+AC_CHECK_HEADERS(elf.h)
+
+# not 64 bit clean in cross-compile
+AC_CHECK_SIZEOF(void *, 4)
+
+CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
-GLIB_CFLAGS=`glib-config --cflags glib`
-GLIB_LIBS=`glib-config --libs glib`
+AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+if test "x$PKG_CONFIG" = "xno"; then
+ AC_MSG_ERROR([You need to install pkg-config])
+fi
+
+dnl for use on the build system
+dnl pkg-config is stupid
+BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
+BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
+AC_SUBST(BUILD_GLIB_CFLAGS)
+AC_SUBST(BUILD_GLIB_LIBS)
+
+PKG_PATH=
+AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
+ if test x$with_crosspkgdir = "x"; then
+ if test -s $PKG_CONFIG_PATH; then
+ PKG_PATH=$PKG_CONFIG_PATH
+ fi
+ else
+ PKG_PATH=$with_crosspkgdir
+ PKG_CONFIG_PATH=$PKG_PATH
+ export PKG_CONFIG_PATH
+ fi
+)
+
+## Versions of dependencies
+GLIB_REQUIRED_VERSION=1.3.11
+
+PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
+
+GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0`
+GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
+GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
+GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
+AC_SUBST(GMODULE_CFLAGS)
+AC_SUBST(GMODULE_LIBS)
+
+AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes")
+gc=auto
+AC_ARG_WITH(gc, [ --with-gc=boehm,none],[gc=$with_gc])
+
+case "x$gc" in
+ xboehm|xyes)
+ if test "x$found_boehm" != "xyes"; then
+ AC_MSG_ERROR("GC requested but libgc not found!")
+ fi
+
+ AC_DEFINE(HAVE_BOEHM_GC)
+ AC_SUBST(HAVE_BOEHM_GC)
+ LIBS="$LIBS -lgc"
+ ;;
+ xnone)
+ AC_MSG_WARN("Compiling mono without GC.")
+ ;;
+ *)
+dnl When the JIT works with libgc, use this chunk.
+dnl # If libgc was found, use it. Otherwise just warn.
+ if test "x$found_boehm" != "xyes"; then
+ AC_MSG_WARN("Compiling mono without GC.")
+ else
+ AC_DEFINE(HAVE_BOEHM_GC)
+ AC_SUBST(HAVE_BOEHM_GC)
+ LIBS="$LIBS -lgc"
+ gc="boehm"
+ fi
+dnl AC_MSG_WARN("Compiling mono without GC.")
+ ;;
+esac
+
+if test x$platform_win32 = xno; then
+ dnl ******************************************************************
+ dnl *** Check for large file support ***
+ dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
+ dnl ******************************************************************
+
+ # Check that off_t can represent 2**63 - 1 correctly, working around
+ # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
+ # CFLAGS and sets $large_offt to yes if the test succeeds
+ large_offt=no
+ AC_DEFUN(LARGE_FILES, [
+ large_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $1"
+ AC_TRY_RUN([
+ #include <sys/types.h>
+
+ #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
+
+ int main(void) {
+ int big_off_t=((BIG_OFF_T%2147483629==721) &&
+ (BIG_OFF_T%2147483647==1));
+ if(big_off_t) {
+ exit(0);
+ } else {
+ exit(1);
+ }
+ }
+ ], [
+ AC_MSG_RESULT(ok)
+ AC_DEFINE(HAVE_LARGE_FILE_SUPPORT)
+ CFLAGS="$CFLAGS $1"
+ large_offt=yes
+ ], [
+ AC_MSG_RESULT(no)
+ ], "")
+ CPPFLAGS=$large_CPPFLAGS
+ ])
+
+ AC_MSG_CHECKING(if off_t is 64 bits wide)
+ LARGE_FILES("")
+ if test $large_offt = no; then
+ AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
+ LARGE_FILES("-D_FILE_OFFSET_BITS=64")
+ fi
+ if test $large_offt = no; then
+ AC_MSG_WARN([No 64 bit file size support available])
+ fi
+
+ dnl *****************************
+ dnl *** Checks for libsocket ***
+ dnl *****************************
+ AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
+
+ dnl *****************************
+ dnl *** Checks for SOL_IP ***
+ dnl *****************************
+ AC_MSG_CHECKING(for SOL_IP)
+ AC_TRY_COMPILE([#include <netdb.h>], [
+ int level = SOL_IP;
+ ], [
+ # Yes, we have it...
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_SOL_IP)
+ ], [
+ # We'll have to use getprotobyname
+ AC_MSG_RESULT(no)
+ ])
+
+ dnl *****************************
+ dnl *** Checks for SOL_TCP ***
+ dnl *****************************
+ AC_MSG_CHECKING(for SOL_TCP)
+ AC_TRY_COMPILE([#include <netdb.h>], [
+ int level = SOL_TCP;
+ ], [
+ # Yes, we have it...
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_SOL_TCP)
+ ], [
+ # We'll have to use getprotobyname
+ AC_MSG_RESULT(no)
+ ])
+
+ dnl *****************************
+ dnl *** Checks for IP_PKTINFO ***
+ dnl *****************************
+ AC_MSG_CHECKING(for IP_PKTINFO)
+ AC_TRY_COMPILE([#include <netdb.h>], [
+ int level = IP_PKTINFO;
+ ], [
+ # Yes, we have it...
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_IP_PKTINFO)
+ ], [
+ AC_MSG_RESULT(no)
+ ])
+
+ dnl *********************************
+ dnl *** Check for struct ip_mreqn ***
+ dnl *********************************
+ AC_MSG_CHECKING(for struct ip_mreqn)
+ AC_TRY_COMPILE([#include <netinet/in.h>], [
+ struct ip_mreqn mreq;
+ mreq.imr_address.s_addr = 0;
+ ], [
+ # Yes, we have it...
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_STRUCT_IP_MREQN)
+ ], [
+ # We'll just have to use struct ip_mreq
+ AC_MSG_RESULT(no)
+ ])
+
+ dnl *****************************
+ dnl *** Checks for libnsl ***
+ dnl *****************************
+ AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl")
+
+ AC_CHECK_FUNCS(inet_pton inet_aton)
+
+ dnl *****************************
+ dnl *** Checks for libpthread ***
+ dnl *****************************
+ AC_SEARCH_LIBS(pthread_create, pthread, [
+ AM_CONDITIONAL(THREADS_PTHREAD, true)
+ AC_DEFINE(HAVE_PTHREAD)
-CFLAGS='-g -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations'
+ # Need pthread_mutex_timedlock
+ pthread_CFLAGS=""
+ orig_CPPFLAGS=$CPPFLAGS
+ # This is a gcc-specific error, but we already set
+ # gcc-specific options in CFLAGS
+ CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
+ AC_MSG_CHECKING(for pthread_mutex_timedlock)
+ AC_TRY_COMPILE([ #include <pthread.h>], [
+ pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_timedlock(&mut, NULL);
+ ], [
+ # Works!
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
+ ], [
+ AC_MSG_RESULT(no)
+
+ # glibc requires -D_GNU_SOURCE before it will declare
+ # this function
+ AC_MSG_CHECKING(whether _GNU_SOURCE is needed for pthread_mutex_timedlock)
+ CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+ AC_TRY_COMPILE([ #include <pthread.h>], [
+ pthread_mutex_t mut=PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_timedlock(&mut, NULL);
+ ], [
+ AC_MSG_RESULT(yes)
+ pthread_CFLAGS="-D_GNU_SOURCE"
+ AC_DEFINE(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
+ ], [
+ AC_MSG_RESULT(no)
+ dnl Add other variants here
+ AC_MSG_WARN(Working around pthread_mutex_timedlock)
+ ])
+ ])
+ CPPFLAGS=$orig_CPPFLAGS
+ CFLAGS="$CFLAGS $pthread_CFLAGS"
+
+ # Need PTHREAD_MUTEX_RECURSIVE
+ pthread_CFLAGS=""
+ orig_CPPFLAGS=$CPPFLAGS
+ # This is a gcc-specific error, but we already set
+ # gcc-specific options in CFLAGS
+ CPPFLAGS="$CPPFLAGS -Werror-implicit-function-declaration"
+ AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
+ AC_TRY_COMPILE([ #include <pthread.h>], [
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ ], [
+ # Works!
+ AC_MSG_RESULT(ok)
+ ], [
+ AC_MSG_RESULT(no)
+
+ # glibc requires -D_GNU_SOURCE before it will declare
+ # this macro
+ AC_MSG_CHECKING(whether _GNU_SOURCE is needed for PTHREAD_MUTEX_RECURSIVE)
+ CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+ AC_TRY_COMPILE([ #include <pthread.h>], [
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ ], [
+ AC_MSG_RESULT(ok)
+ pthread_CFLAGS="-D_GNU_SOURCE"
+ ], [
+ AC_MSG_RESULT(no)
+ dnl Add other variants here
+ AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
+ AC_DEFINE(USE_MONO_MUTEX)
+ ])
+ ])
+ CPPFLAGS=$orig_CPPFLAGS
+ CFLAGS="$CFLAGS $pthread_CFLAGS"
+ ], [
+ AC_MSG_ERROR([libpthread is required on non-win32 hosts])
+ ])
+
+ dnl ********************************
+ dnl *** Checks for semaphore lib ***
+ dnl ********************************
+ AC_CHECK_LIB(rt, sem_init, LIBS="$LIBS -lrt")
+else
+ # This is a kludge, we really ought to test for libws2_32, but
+ # I can't make AC_CHECK_LIB link (the symbols seem to be mangled
+ # with @num suffixes)
+ LIBS="$LIBS -lws2_32"
+ CFLAGS="$CFLAGS -mno-cygwin"
+fi
+
+dnl ****************************
+dnl *** Look for /dev/random ***
+dnl ****************************
+
+AC_MSG_CHECKING([if usage of random device is requested])
+AC_ARG_ENABLE(dev-random,
+[ --disable-dev-random disable the use of the random device],
+try_dev_random=$enableval, try_dev_random=yes)
+AC_MSG_RESULT($try_dev_random)
+
+case "{$target}" in
+ *-openbsd*)
+ NAME_DEV_RANDOM="/dev/srandom"
+ ;;
+
+dnl Win32 does not have /dev/random, they have their own method...
+
+ *-*-mingw*|*-*-cygwin*)
+ ac_cv_have_dev_random = no
+ ;;
+
+dnl Everywhere else, it's /dev/random
+
+ *)
+ NAME_DEV_RANDOM="/dev/random"
+ ;;
+esac
+
+AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM")
+
+dnl Now check if the device actually exists
+
+if test "x$try_dev_random" = "xyes"; then
+ AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
+ [if test -r "$NAME_DEV_RANDOM" ; then
+ ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
+ if test "x$ac_cv_have_dev_random" = "xyes"; then
+ AC_DEFINE(HAVE_CRYPT_RNG)
+ fi
+else
+ AC_MSG_CHECKING(for random device)
+ ac_cv_have_dev_random=no
+ AC_MSG_RESULT(has been disabled)
+fi
+
+if test "x$platform_win32" = "xyes"; then
+ AC_DEFINE(HAVE_CRYPT_RNG)
+fi
+
+if test "x$ac_cv_have_dev_random" = "xno" \
+ && test "x$platform_win32" = "xno"; then
+ AC_MSG_WARN([[
+***
+*** A system-provided entropy source was not found on this system.
+*** Because of this, the System.Security.Cryptography random number generator
+*** will throw a NotImplemented exception.
+***
+*** If you are seeing this message, and you know your system DOES have an
+*** entropy collection in place, please contact <crichton@gimp.org> and
+*** provide information about the system and how to access the random device.
+***
+*** For those systems who lack a random device, EGD support is forthcoming.
+***]])
+fi
+
+if test "x$cross_compiling" = "xno"; then
+# check for new iconv version
+AC_MSG_CHECKING(for new iconv)
+AC_CACHE_VAL(new_iconv,[
+ AC_TRY_RUN([#include <stdio.h>
+ #include <iconv.h>
+
+ int main()
+ {
+ exit (iconv_open ("UTF-16le", "UTF-8") == (iconv_t)-1);
+ }
+ ],
+ new_iconv=yes,new_iconv=)])
+if test -n "$new_iconv"; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NEW_ICONV)
+else
+ AC_MSG_RESULT(no)
+fi
+fi
+
+TARGET="unknown"
+ACCESS_UNALIGNED="yes"
+
+case "$host" in
+#mips-sgi-irix5.* | mips-sgi-irix6.*) TARGET=MIPS; ACCESS_UNALIGNED="no";;
+i*86-*-*) TARGET=X86; arch_target=x86;;
+sparc*-*-*) TARGET=SPARC; arch_target=sparc; ACCESS_UNALIGNED="no";;
+#alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; ACCESS_UNALIGNED="no";;
+#m68k-*-linux*) TARGET=M68K;;
+powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; arch_target=ppc;;
+arm-*-linux-*) TARGET=ARM; arch_target=arm; ACCESS_UNALIGNED="no";;
+esac
+
+if test ${TARGET} = unknown; then
+ CFLAGS="$CFLAGS -DNO_PORT"
+ AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
+fi
+
+if test ${ACCESS_UNALIGNED} = no; then
+ CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
+fi
+
+AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
+AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
+AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
+AM_CONDITIONAL(X86, test x$TARGET = xX86)
+AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
+AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
+AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
+AM_CONDITIONAL(ARM, test x$TARGET = xARM)
+
+AC_SUBST(arch_target)
AC_SUBST(CFLAGS)
AC_OUTPUT([
Makefile
mono/Makefile
+mono/utils/Makefile
mono/metadata/Makefile
mono/dis/Makefile
-]) \ No newline at end of file
+mono/cil/Makefile
+mono/arch/Makefile
+mono/arch/x86/Makefile
+mono/arch/ppc/Makefile
+mono/arch/sparc/Makefile
+mono/arch/arm/Makefile
+mono/interpreter/Makefile
+mono/tests/Makefile
+mono/benchmark/Makefile
+mono/monoburg/Makefile
+mono/monograph/Makefile
+mono/jit/Makefile
+mono/io-layer/Makefile
+runtime/Makefile
+scripts/Makefile
+man/Makefile
+doc/Makefile
+docs/Makefile
+])
+
+echo "
+
+ GC: $gc
+
+"
diff --git a/doc/.cvsignore b/doc/.cvsignore
new file mode 100644
index 00000000000..6d3ceb93234
--- /dev/null
+++ b/doc/.cvsignore
@@ -0,0 +1,4 @@
+Makefile.in
+Makefile
+all-docs
+pending-classes.in
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 00000000000..8ef4e422c5d
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,32 @@
+WEB_FILES= \
+ ado-net c-sharp class-library contact contributing documentation download \
+ faq gcc-frontend ideas index passport rationale resources \
+ roadmap runtime status team testing thanks tools porting anoncvs monodoc-xml winforms
+
+OTHERS= pending resources-pending todo mono-build.sh mono-build-w32.sh
+
+EXTRA_DIST = $(WEB_FILES) README $(OTHERS)
+
+all-docs: $(WEB_FILES)
+ cat rationale roadmap c-sharp tools class-library \
+ runtime documentation download faq contributing \
+ resources status > all-docs
+
+class-status: class-status.in pending-classes Makefile.am
+ cat class-status.in pending-classes > class-status
+
+pending-classes:
+
+#pending-classes: pending-classes.in Makefile.am
+# echo "This is a list of pending classes, and links to their documentation on MSDN.Microsoft.com<p><p>" > pending-classes
+# for i in `cat pending-classes.in`; do x=`echo $$i | sed s/\\\.//g`; link=`echo http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrf@@@ClassTopic.asp | sed "s/@@@/$$x/"`; echo " <a href=\"$$link\">$$i</a><br>" >> pending-classes; done
+
+
+webit: dummy
+ (cd web; make && make push)
+
+push-notes:
+ scp release-notes/mono* www@www:/web/cvsmodules/mono/archive
+
+dummy:
+
diff --git a/doc/README b/doc/README
new file mode 100644
index 00000000000..333d133943f
--- /dev/null
+++ b/doc/README
@@ -0,0 +1,17 @@
+To edit the website appearance:
+
+cd doc/web
+edit template.html.in
+make
+
+To edit website content:
+
+cd doc (this directory)
+edit files carefully
+cd web
+make
+
+To publish changes:
+
+cd web
+make push
diff --git a/doc/ado-net b/doc/ado-net
new file mode 100644
index 00000000000..438b47cb2be
--- /dev/null
+++ b/doc/ado-net
@@ -0,0 +1,44 @@
+* ADO.NET
+
+ The coordinator for the ADO.NET implementation is <a
+ href="mailto:rodrigo@ximian.com">Rodrigo Moya</a>.
+
+* Action plan
+
+ The current plan to implement ADO.NET is as follows:
+
+ <b>Step 1:</b> SqlClient:
+
+ <ul>
+ * Implementation of System.Data.SqlClient based on
+ the PostgreSQL C API.
+
+ * Once the System.Data.SqlClient code is functional and
+ is usable by other people, we willl move it to
+ System.Data.PostgreSQL, and will convert the existing
+ System.Data.SqlClient to be just a wrapper around
+ System.Data.PostgreSQL.
+
+ </ul>
+
+ <b>Step 2:</b> OleDBClient:
+ <ul>
+ * On Unix systems: System.Data.OleDb will use LibGDA as its
+ engine.
+
+ LibGDA is the data access engine that is used by
+ Gnome-Db (only libgda, not libgnomedb at all).
+
+ * On Windows systems: System.Data.OleDb will use OLE-DB as
+ its engine.
+ </ul>
+
+ <b>Step 3:</b> System.Data.SqlClient Providers:
+
+ <ul>
+ * System.Data.SqlClient will then become a generic
+ proxy for binding to other SQL implementations other
+ than PostgreSQL (MySQL on Unix/Windows; MS SQL on
+ Window; Interbase on Unix/Windows). Others are welcomed.
+ </ul>
+
diff --git a/doc/anoncvs b/doc/anoncvs
new file mode 100644
index 00000000000..ed70a4c0074
--- /dev/null
+++ b/doc/anoncvs
@@ -0,0 +1,70 @@
+* Anonymous CVS access
+
+ Anonymous access to the Mono is available currently from three
+ servers (anoncvs-spain-1.go-mono.com,
+ anoncvs-spain-2.go-mono.com and anoncvs-us-1.go-mono.com).
+
+ You can also use `anoncvs.go-mono.com', and that will pick a
+ server automatically for you.
+
+ Sources are currently being updated every hour.
+
+** Checking out the sources
+
+ To check out the sources for the first time from the
+ repository, use this command:
+
+<pre>
+ export CVSROOT=:pserver:anonymous@anoncvs.go-mono.com:/mono
+ cvs login
+ cvs -z3 co mcs mono gtk-sharp
+</pre>
+
+ That will get you the compiler and class libraries (mcs), the
+ interpreter and JITer (mono) and the Gtk# bindings.
+
+ The server is located in Spain.
+
+** Updating the sources
+
+ To update your sources every day, you use this command:
+
+<pre>
+ export CVSROOT=:pserver:anonymous@reypastor.hispalinux.es:/mono
+ cvs -z3 update -dP mcs mono gtk-sharp
+</pre>
+
+** Thanks
+
+ Thanks to <a href="http://www.hispalinux.es">HispaLinux</a>
+ for providing this Anon CVS server. The server is located in
+ Spain.
+
+ Special thanks to Jesus Climent, Rodrigo Moya, Juantomás
+ García and Ismael Olea for making this happen.
+
+<a name="#mirror">
+** Becoming an AnonCVS mirror
+
+ To become an AnonCVS mirror, you currently need about 20
+ megabytes of free disk space and bandwidth that you do not
+ mind sharing (you probably want enough to spare).
+
+ I need to be able to rsync to your machine from the main CVS
+ server. The preferred method to rsync is to setup ssh in your
+ machine.
+
+ The requirements are:
+ <ul>
+ * An account where we can ssh into.
+
+ * rsync.
+
+ * AnonCVS setup with the same paths as the rest of the
+ servers.
+
+ * Currently, about 40 megabytes of disk space, but this
+ will likely grow as the project evolves.
+
+ * A sysadmin contact e-mail address.
+ </ul>
diff --git a/doc/asp-net b/doc/asp-net
new file mode 100755
index 00000000000..49f31f872d4
--- /dev/null
+++ b/doc/asp-net
@@ -0,0 +1,11 @@
+* ASP.NET
+
+ The classes for running ASP.NET are being actively written.
+ Gaurav, Leen and Patrik have been building the classes
+ required to run ASP.NET web application as well as a small
+ embeddable web server.
+
+ Currently ASP.NET does not work, but work is underway. If you
+ are interested in helping the effort please contact the
+ mono-list mailing list.
+
diff --git a/doc/books b/doc/books
new file mode 100644
index 00000000000..d5933e79836
--- /dev/null
+++ b/doc/books
@@ -0,0 +1,37 @@
+* C# Books
+
+ A Programmer's Introduction to C# - Second Edition: Eric Gunnerson
+
+* Remoting
+
+ <a href="http://www.dotnetremoting.cc/book/AdvancedDotNetRemoting.asp">
+ Advanced .NET Remoting: Ingo Rammer</a>
+
+* Compiler Implementation
+
+ Compilers - Principles, Techniques, and Tools: Alfred V. Aho, Ravi Sethi,
+ Jeffrey D. Ullman
+
+ Advanced Compiler Design Implementation: Steven S. Muchnick
+
+ Modern Compiler Implementation in C: Andrew W. Appel
+
+ A Retargetable C Compiler - Design and Implementation: C. Fraser, David
+ Hanson
+
+* Reference Manuals
+
+ <a
+ href="http://developer.intel.com/design/pentium/manuals/24319101.pdf">Intel
+ Architecture Software Developer's Manual, Volume 2 - Instruction Set Reference Manual</a>
+
+ <a
+ href="http://www.caldera.com/developers/devspecs/abi386-4.pdf">System V ABI
+ - i386 Architecture Processor Supplement</a>
+
+ <a
+ href="http://www.caldera.com/developers/devspecs/mipsabi.pdf">System V ABI -
+ MIPS Processor supplement</a>
+
+ <a href="http://www.sparc.org/standards/V8.pdf">The SPARC Architecture
+ Manual Version 8</a> \ No newline at end of file
diff --git a/doc/c-sharp b/doc/c-sharp
new file mode 100644
index 00000000000..fa4dad1d732
--- /dev/null
+++ b/doc/c-sharp
@@ -0,0 +1,223 @@
+* MCS: The Ximian C# compiler
+
+ MCS is currently able to compile itself and many more C#
+ programs (there is a test suite included that you can use).
+
+ We are in feature completion mode right now. There are still
+ a couple of areas that are not covered by the Mono compiler, but
+ they are very very few at this point.
+
+ MCS was able to parse itself on April 2001, MCS compiled itself
+ for the first time on December 28 2001. MCS became self hosting
+ on January 3rd, 2002.
+
+ The Mono Runtime and the Mono execution engine were able to make
+ our compiler self hosting on March 12, 2002.
+
+ A test suite is maintained to track the progress of
+ the compiler and various programs are routinely compiled and
+ ran.
+
+** Obtaining MCS
+
+ The Mono C# compiler is part of the `mcs' module in the Mono CVS
+ you can get it from our <a href="anoncvs.html">Anonymous CVS</a> server,
+ or you can get nightly <a href="download.html">download page</a>.
+
+** Running MCS
+
+ MCS is written in C# and uses heavily the .NET APIs. MCS runs
+ on Linux (with the Mono runtime) and Windows (with the .NET
+ framework runtime)
+
+** Reporting Bugs in MCS
+
+ When you report a bug, try to provide a small test case that would
+ show the error so we can include this as part of the Mono C# regression
+ test suite.
+
+ If the bug is an error or a warning that we do not flag, write
+ a sample program called `csXXXX.cs' where XXXX is the code number
+ that is used by the Microsoft C# compiler that illustrates the
+ problem. That way we can also do regression tests on the invalid
+ input.
+
+** Phases of the compiler
+
+ The compiler has a number of phases:
+
+ <ul>
+ * Lexical analyzer: hand-coded lexical analyzer that
+ provides tokens to the parser.
+
+ * The Parser: the parser is implemented using Jay (A
+ Berkeley Yacc port to Java, that I ported to C#).
+ The parser does minimal work and syntax checking,
+ and only constructs a parsed tree.
+
+ Each language element gets its own class. The code
+ convention is to use an uppercase name for the
+ language element. So a C# class and its associated
+ information is kept in a "Class" class, a "struct"
+ in a "Struct" class and so on. Statements derive
+ from the "Statement" class, and Expressions from the
+ Expr class.
+
+ * Parent class resolution: before the actual code
+ generation, we need to resolve the parents and
+ interfaces for interface, classe and struct
+ definitions.
+
+ * Semantic analysis: since C# can not resolve in a
+ top-down pass what identifiers actually mean, we
+ have to postpone this decision until the above steps
+ are finished.
+
+ * Code generation: The code generation is done through
+ the System.Reflection.Emit API.
+ </ul>
+
+** CIL Optimizations.
+
+ The compiler performs a number of simple optimizations on its input:
+ constant folding (this is required by the C# language spec) and
+ can perform dead code elimination.
+
+ Other more interesting optimizations like hoisting are not possible
+ at this point since the compiler output at this point does not
+ generate an intermediate representation that is suitable to
+ perform basic block computation.
+
+ Adding an intermediate layer to enable the basic block
+ computation to the compiler should be a simple task, but we
+ are considering having a generic CIL optimizer. Since all the
+ information that is required to perform basic block-based
+ optimizations is available at the CIL level, we might just skip
+ this step altogether and have just a generic IL optimizer that
+ would perform hoisting on arbitrary CIL programs, not only
+ those produced by MCS.
+
+ If this tool is further expanded to perform constant folding
+ (not needed for our C# compiler, as it is already in there)
+ and dead code elimination, other compiler authors might be
+ able to use this generic CIL optimizer in their projects
+ reducing their time to develop a production compiler.
+
+<a name="tasks">
+** Current pending tasks
+
+ Simple tasks:
+
+ <ul>
+ * Redo the way we deal with built-in operators.
+ </ul>
+
+ Larger tasks:
+ <ul>
+
+ * Jay does not work correctly with `error'
+ productions, making parser errors hard to point. It
+ would be best to port the Bison-To-Java compiler to
+ become Bison-to-C# compiler.
+
+ Nick Drochak has started a project on SourceForge for this.
+ You can find the project at: <a href="http://sourceforge.net/projects/jb2csharp/">
+ http://sourceforge.net/projects/jb2csharp/</a>
+
+ * Semantic Analysis: Return path coverage and
+ initialization before use coverage are two great
+ features of C# that help reduce the number of bugs
+ in applications. It is one interesting hack.
+
+ </ul>
+
+** Questions and Answers
+
+Q: Why not write a C# front-end for GCC?
+
+A: I wanted to learn about C#, and this was an exercise in this
+ task. The resulting compiler is highly object-oriented, which has
+ lead to a very nice, easy to follow and simple implementation of
+ the compiler.
+
+ I found that the design of this compiler is very similar to
+ Guavac's implementation.
+
+ Targeting the CIL/MSIL byte codes would require to re-architecting
+ GCC, as GCC is mostly designed to be used for register machines.
+
+ The GCC Java engine that generates Java byte codes cheats: it does
+ not use the GCC backend; it has a special backend just for Java, so
+ you can not really generate Java bytecodes from the other languages
+ supported by GCC.
+
+Q: If your C# compiler is written in C#, how do you plan on getting
+ this working on a non-Microsoft environment.
+
+ We will do this through an implementation of the CLI Virtual
+ Execution System for Unix (our JIT engine).
+
+ Our JIT engine is working for the purposes of using the compiler.
+ The supporting class libraries are being worked on to fully support
+ the compiler.
+
+Q: Do you use Bison?
+
+A: No, currently I am using Jay which is a port of Berkeley Yacc to
+ Java that I later ported to C#. This means that error recovery is
+ not as nice as I would like to, and for some reason error
+ productions are not being caught.
+
+ In the future I want to port one of the Bison/Java ports to C# for
+ the parser.
+
+Q: Should someone work on a GCC front-end to C#?
+
+A: I would love if someone does, and we would love to help anyone that
+ takes on that task, but we do not have the time or expertise to
+ build a C# compiler with the GCC engine. I find it a lot more fun
+ personally to work on C# on a C# compiler, which has an intrinsic
+ beauty.
+
+ We can provide help and assistance to anyone who would like to work
+ on this task.
+
+Q: Should someone make a GCC backend that will generate CIL images?
+
+A: I would love to see a backend to GCC that generates CIL images. It
+ would provide a ton of free compilers that would generate CIL
+ code. This is something that people would want to look into
+ anyways for Windows interoperation in the future.
+
+ Again, we would love to provide help and assistance to anyone
+ interested in working in such a project.
+
+Q: What about making a front-end to GCC that takes CIL images and
+ generates native code?
+
+A: I would love to see this, specially since GCC supports this same
+ feature for Java Byte Codes. You could use the metadata library
+ from Mono to read the byte codes (ie, this would be your
+ "front-end") and generate the trees that get passed to the
+ optimizer.
+
+ Ideally our implementation of the CLI will be available as a shared
+ library that could be linked with your application as its runtime
+ support.
+
+ Again, we would love to provide help and assistance to anyone
+ interested in working in such a project.
+
+Q: But would this work around the GPL in the GCC compiler and allow
+ people to work on non-free front-ends?
+
+A: People can already do this by targeting the JVM byte codes (there
+ are about 130 compilers for various languages that target the JVM).
+
+Q: Why are you writing a JIT engine instead of a front-end to GCC?
+
+A: The JIT engine and runtime engine will be able to execute CIL
+ executables generated on Windows.
+
+You might also want to look at the <a href="faq.html#gcc">GCC</a>
+section on the main FAQ
diff --git a/doc/ccvs b/doc/ccvs
new file mode 100644
index 00000000000..c7710b56601
--- /dev/null
+++ b/doc/ccvs
@@ -0,0 +1,138 @@
+* CVS Access
+
+ If you are an active Mono developer, you can get a CVS account
+ that hosts the Mono source code.
+
+ If you are not a developer, but want to track the development, please
+ see the <a href="anoncvs.html">AnonCVS</a> instructions.
+
+ Send an e-mail to miguel with your public SSH key for this
+ purpose. Please specify if the key was generated with SSH1 or SSH2.
+
+ If you are using SSH2, please generate your key using:
+
+<pre>
+ ssh-keygen -t rsa
+</pre>
+
+ And mail me the id_rsa.pub file.
+
+ If you are using SSH1, run:
+<pre>
+ ssh-keygen
+</pre>
+
+ And mail me your identity.pub file.
+
+ You will need CVS and SSH. Windows users can get both by
+ installing Cygwin (<a
+ href="http://www.cygwin.com">http://www.cygwin.com</a>)
+
+ Unix users will probably have those tools installed already.
+
+** Checking out the sources
+
+ To check out the sources for the first time from the
+ repository, use this command:
+
+<pre>
+ export CVS_RSH=ssh
+ export CVSROOT=username@mono-cvs.ximian.com:/cvs/public
+ cvs -z3 co mcs mono
+</pre>
+
+** Updating your sources
+
+ Every day people will be making changes, to get your latest
+ updated sources, use:
+
+<pre>
+ cvs -z3 update -Pd mcs mono
+</pre>
+
+ Note: The '-z3' enables compression for the whole cvs action.
+ The '-Pd' makes the update operation (P)rune directories that
+ have been deleted and get new (d)irectories added to the
+ repository.
+
+** Making patches
+
+ Usually you will want to make a patch to contribute, and let
+ other people review it before commiting it. To obtain such a
+ "patch", you type:
+
+<pre>
+ cd directory-you-want-to-diff
+ cvs -z3 diff -u > file.diff
+ mail mono-list@ximian.com < file.diff
+</pre>
+
+** Keeping track of changes.
+
+ We provide two e-mail based mechanisms to keep track of
+ changes to the code base:
+
+ <ul>
+ * <a href="mailto:mono-patches-request@ximian.com">
+ mono-patches@ximian.com</a>: This mailing list receives
+ in patch form all the changes that are being made to the
+ CVS.
+
+ * <a href="mailto:mono-cvs-list-request@ximian.com">
+ mono-cvs-list@ximian.com</a>: This mailing list only
+ receives the CVS commit logs with a list of files
+ modified.
+ </ul>
+
+ We hope to offer LXR and Bonsai in the future as well.
+
+** Commiting your work
+
+ Once you get approval to commit to the CVS, or if you are
+ commiting code that you are the maintainer of, you will want
+ to commit your code to CVS.
+
+ To do this, you have to "add" any new files that you created:
+
+<pre>
+ cvs add new-file.cs
+</pre>
+
+ And then commit your changes to the repository:
+
+<pre>
+ cvs commit file-1.cs file-2.cs
+</pre>
+
+** The Mailing List
+
+ To keep track of the various development and changes to the
+ CVS tree, you can subscribe to the mono-cvs-list@ximian.com.
+ To subscribe, send an email message to
+ mono-cvs-list-request@ximian.com and in the body of the
+ message put `subscribe'.
+
+ This will send you an email message every time a change is
+ made to the CVS repository, together with the information that
+ the author of the changes submitted.
+
+** Recommendations
+
+ Please do not commit code that would break the compile to the
+ CVS, because that normally wastes everybody's time. Two things
+ are important in this step: trying to build your sources and making
+ sure that you add all the new files before you do a commit.
+
+ To build the sources, most of the type trying the `make' command
+ is enough. In some cases (the class libraries) we use nant, so
+ you need to run nant manually.
+
+ Use ChangeLog entries so we can keep textual descriptions of
+ your work, and use the contents of your ChangeLog file as the
+ CVS commit message (ie, paste the contents of this into the
+ editor buffer).
+
+ If you are making changes to someone else's code, please make
+ sure you get in touch with the maintainer of that code before
+ applying patches. You want to avoid commiting conflicting
+ work to someone else's code.
diff --git a/doc/class-library b/doc/class-library
new file mode 100644
index 00000000000..95b56cacf9d
--- /dev/null
+++ b/doc/class-library
@@ -0,0 +1,190 @@
+* The Class Library
+
+ The Class Library should be compatible with Microsoft's .NET
+ implementation.
+
+ Please see the <a href="class-status.html">Class Status</a>
+ page for a status of who is working on which classes.
+
+ We will write as much code as possible in C#. We may need to
+ interface with code written in C to gain access to the
+ functionality of libraries like libart, Gtk+, and libc.
+
+** Contributing
+
+ We welcome contributions to the the Class Library. To get
+ started, check the status page for information about which
+ APIs are being worked on, and how to get in touch with
+ individual maintainers.
+
+ If you want to work on a class, first check the <a
+ href="download.html">Classes Distribution</a> to see if it is
+ not implemented yet, if not, check the <a
+ href="class-status.html">Class Status</a> to see if someone is
+ already working on it, and maybe contact them.
+
+ If nobody is working on it, mail <a
+ href="mailto:mono-list@ximian.com">mono-list@ximian.com</a>
+ with the class you want to implement and CC <a
+ href="mailto:miguel@ximian.com">miguel@ximian.com</a>.
+
+ You can also track live the activities of the Mono CVS module
+ by subscribing to the <a
+ href="http://lists.ximian.com/mailman/listinfo/mono-cvs-list">mono-cvs-list</a>
+
+
+** Missing features
+
+ Our class libraries miss some features, for example, most classes
+ do not implement the serialization bits at all, it would be a good
+ contribution to add this to each class.
+
+ This is a simple task, but it needs to be done in a compatible way
+ with the Microsoft.NET classes: using the same arguments to serialize
+ and reincarnate data.
+
+** Layout
+
+ The Class Library resides in the `mcs' module in the directoy
+ `class'.
+
+ Each directory in the directory represents the assembly where
+ the code belongs to, and inside each directory we divide the
+ code based on the namespace they implement.
+
+ There are two cases when we should consider portability: when
+ we are dealing with a couple of classes only that differ from
+ system to system (Consider System.Net and System.IO for Win32
+ and Unix). In those cases we will just place the files for
+ example on <t>corlib/System/System.IO/Unix-Console.cs</t> and
+ <t>corlib/System/System.IO/Win32-Console.cs</t>.
+
+ For classes that might differ more (for example, the
+ implementation of Windows.Forms), we might have different
+ directories altogether: <t>System.Windows.Forms/Win32</t>,
+ <t>System.Windows.Forms/Gtk+</t> and
+ <t>System.Windows.Forms/Cocoa</t>.
+
+** Using existing components from GNOME.
+
+ Our current plan is to implement the GUI tools on top of
+ Gtk+. The only obstacle here is that applications from Windows
+ might expect to be able to pull the HWND property from the
+ widgets and use PInvoke to call Windows functions.
+
+** Class Library and Win32 dependencies.
+
+ There are a few spots where the Win32 foundation is exposed to
+ the class library (for example, the HDC and HWND properties in
+ the GDI+). Casual inspection suggests that these can be
+ safely mapped to Gdk's GC and GdkWindow pointers without
+ breaking anything.
+
+ The only drawback is that support for PInvoke of Win32 code
+ won't be available. An alternate solution would be to use
+ portions of Wine, or even to use Wine as our toolkit.
+
+*** Initial GDI+ and WinForms implementation
+
+ The initial implementation will use Gtk+ as the underlying
+ toolkit. Since GTK+ has already been ported to many windowing
+ systems other than X (including frame buffer, Win32, and BeOS)
+ its use should cover most applications for most users.
+
+*** Database access
+
+ We will implement ADO.NET functionality by reusing <a
+ href="http://www.gnome-db.org">GNOME-DB</a>. This is an ideal
+ choice, since GNOME-DB was implemented precisely to provide an
+ ADO-like system for GNOME.
+
+*** Component Integration
+
+ We will provide a new namespace to use GNOME specific features
+ as well as a namespace to host Bonobo interfaces and classes
+ in Mono.
+
+** Licensing
+
+ The class library is being licensed under the terms of the
+ <a
+ href="http://www.opensource.org/licenses/mit-license.html">MIT
+ license.</a> This is the same license used by the X11 window
+ system.
+
+** Class Library testing
+
+ We need to write regression tests that will verify
+ the correctness of the class library, compiler, and JIT
+ engine.
+
+ Please write your regression tests using <a
+ href="http://nunit.sourceforge.net">NUnit</a>
+
+** Coding conventions
+
+ Please follow the conventions on the ECMA specification (On
+ the Annex Partition) for your coding your libraries.
+
+ Use 8 space tabs for writing your code (hopefully we can keep
+ this consistent). If you are modifying someone else's code, try
+ to keep the coding style similar.
+
+ For a rationale on 8 space tabs, read Linus Torvald's Coding
+ Style guidelines in the Linux kernel source for a rationale.
+
+*** Missing implementation bits
+
+ If you implement a class and you are missing implementation bits,
+ please put in the code the word "TODO" and a description of what
+ is missing to be implemented.
+
+*** Tagging buggy code
+
+ If there is a bug in your implementation tag the problem by using
+ the word "FIXME" in the code, together with a description of the
+ problem.
+
+ Do not use XXX or obscure descriptions, because otherwise people
+ will not be able to understand what you mean.
+
+*** Tagging Lame specs
+
+ Sometimes the specification will be lame (consider Version.ToString (fieldCount)
+ where there is no way of knowing how many fields are available, making the API
+ not only stupid, but leading to unreliable code).
+
+ In those cases, use the keyword "LAMESPEC".
+
+** Namespaces
+
+ We are using a number of namespaces in the class libraries for
+ private classes when we need them, you are encouraged to use these:
+
+<pre>
+Mono
+ .Languages // General Compiler classes
+ .CSharp // Specific C# parsing/tokenizing classes
+ .MonoBASIC // Specific VB.NET/MonoBASIC parsing/tokenizing classes
+ .Python // Specific Python parsing/tokenizing classes
+ .Runtime
+ .LateBind // General latebinding-support for MonoBASIC/Python
+ .MonoBASIC // Specific runtime classes for MonoBASIC programs
+ .Python // Specific runtime classes for Python programs
+ .Web
+ .UI
+ .Utils // Gaurav utility classes
+</pre>
+
+** FAQ
+
+Frequently asked questions about the class library:
+
+Q: I am writing a new class that overrides one of the system classes,
+ and I am getting a 1595 warning from the compiler. Should we use a
+ different namespace?
+
+A: There is a quick solution to the problem, you can pass the command
+ line argument /nowarn:1595 and this will effectively let you use
+ your implementation of the code, while overriding the ones from the
+ system assemblies. \ No newline at end of file
diff --git a/doc/class-status.in b/doc/class-status.in
new file mode 100644
index 00000000000..a66aa18092e
--- /dev/null
+++ b/doc/class-status.in
@@ -0,0 +1,26 @@
+* Status of the various pieces of the class library
+
+ You can browse the status of the class library and see who has
+ registered to work on what parts of the system. These list
+ work-in-progress components currently.
+
+ Browse the current <a href="class-status/index.html">status</a>.
+
+ You can also download the XML <a
+ href="class-status/maintainers.xml">maintainers</a> file that
+ contains the actual maintainers list.
+
+ You can also download the master <a
+ href="class-status/class.xml">Class Status XML</a> file.
+
+* List of not-implemented classes
+
+ Pick from the list of assemblies in the menu on the left to
+ view the current status of that assembly.
+
+ The tree shows items that are either missing or that have TODO
+ attributes associated with them.
+ You can use the checkboxes to show only missing or only TODO items.
+
+ Clicking on a name will take you to the <a href="http://msdn.microsoft.com/">MSDN documentation</a> for that item.
+ CTRL-Clicking will take you to the <a href="http://cvs.hispalinux.es/cgi-bin/cvsweb/?cvsroot=Mono">mono CVS tree</a>.
diff --git a/doc/classlib-doc b/doc/classlib-doc
new file mode 100644
index 00000000000..14fdc9e7191
--- /dev/null
+++ b/doc/classlib-doc
@@ -0,0 +1,105 @@
+* Class Library Documentation
+
+** Summary
+
+ <em>
+ [This documentation is in progress. Comments to
+ <a href="mailto:jbarn@httcb.net">jbarn@httcb.net</a>.]
+ </em>
+
+ While using inline XML tags to document classes is certainly
+ convenient, properly verbose documentation quickly overwhelms
+ the code, making the source quite difficult to read. Furthermore,
+ multilingual documentation makes for significant additional text.
+
+ With these considerations in mind, Mono will use external XML files
+ for type documentation, rather than documenting the source inline.
+
+ Several tools will be created for managing, verifying, generating,
+ and updating class library documentation, including:
+
+ <ul>
+ <li><a href="#docstub">docstub</a></li>
+ <li><a href="#docverify">docverify</a></li>
+ <li><a href="#docconv">docconv</a></li>
+ <li><a href="#docgen">docgen</a></li>
+ <li><a href="#monodoc">monodoc</a></li>
+ </ul>
+
+** XML Documentation Files and Formats
+
+
+*** Monodoc XML
+ This XML is similar to the XML documentation described in the
+ C# standard, with added tags for internationalization and a
+ slightly different structure. Documentation and a DTD/Schema
+ for Monodoc XML is forthcoming.
+
+ Monodoc XML does not contain any definitive type information,
+ and is only useful in conjunction with the Type definition for
+ whatever is being documented.
+
+ This XML could be generated by hand, by monostub, or by monodoc.
+
+*** Assembly XML
+ This XML is generated by combining runtime type information for
+ an Assembly with a collection of Monodoc XML files. The resultant
+ XML (in the best of cases) contains both complete type and
+ documentary information for each type in the assembly.
+
+ This XML contains enough information to be transformed into
+ user-accessible documentation. It is likely that scripts
+ will be created to generate reference docs as HTML and other
+ formats.
+
+ Documentation and a DTD/Schema for Assembly XML is forthcoming.
+
+** Documentation Tools
+
+*** <a name="docstub">docstub</a>
+ Given a type name and an assembly, generates stub Monodoc XML
+ documentation for the type. Optionally, docstub can attempt to
+ populate initial documentation from an XML file in the format
+ published along with the ECMA standard.
+
+*** <a name="docverify">docverify</a>
+ Given a Monodoc XML file and an assembly, verifies that the
+ documentation matches the compiled type. Checks signatures,
+ parameters, et cetera.
+
+*** <a name="docconv">docconv</a>
+ Converts from Monodoc XML to the standard C# compiler-emitted
+ XML format and vice versa.
+
+*** <a name="docgen">docgen</a>
+ Given an assembly and a collection of Monodoc XML files, creates
+ an Assembly XML file containing all documentation and type information
+ available. This output is suitable for transforming into user
+ documentation.
+
+*** <a name="monodoc">monodoc</a>
+ A GUI tool for documentation and translation, this encapsulates
+ the capabilities of docstub, docverify, docconv, and docgen in
+ a friendly user interface. In addition, monodoc provides features
+ to ease translation, such as side-by-side editing and coverage
+ statistics.
+
+** Status and Roadmap
+
+*** 2 January 2002
+
+ As I write the initial version of this document, very little has been
+ implemented. Currently, there is a:
+
+ <ul>
+ <li>Preliminary version of the Monodoc XML format</li>
+ <li>Preliminary version of the docstub utility</li>
+ </ul>
+
+ Here's hoping for frequent, productive updates.
+
+** Get Involved
+
+ Help us define Mono's documentation structure! Subscribe to
+ <a href="http://lists.ximian.com/mailman/listinfo/mono-docs-list">mono-docs-list</a>
+ and wade right in.
diff --git a/doc/contact b/doc/contact
new file mode 100644
index 00000000000..74e09d9a195
--- /dev/null
+++ b/doc/contact
@@ -0,0 +1,13 @@
+* Contacting the Mono team.
+
+ You can contact the general forum of discussion by sending
+ e-mail to <a href="mailto:mono-list@ximian.com">mono-list@ximian.com</a>
+
+ You can contact me (Miguel de Icaza) by sending e-mail to <a
+ href="mailto:miguel@ximian.com">miguel@ximian.com</a>. My web
+ page is <a
+ href="http://primates.ximian.com/~miguel">http://primates.ximian.com/~miguel"</a>
+
+ You can also <a
+ href="http://www.ximian.com/about/contact.php3">reach Ximian.</a>
+
diff --git a/doc/contributing b/doc/contributing
new file mode 100644
index 00000000000..5bec9cefda5
--- /dev/null
+++ b/doc/contributing
@@ -0,0 +1,189 @@
+* Contributing to the Mono project
+
+ There are many ways in which you can help in the Mono project:
+
+ <ul>
+ * <b>Programmers:</b> You can work on a free
+ implementation of the <a
+ href="class-library.html">class libraries</a>, the
+ <a href="runtime.html">runtime engine</a>, <a
+ href="tools.html">the tools</a>, the <a
+ href="testing.html">testing framework</a>
+
+ * <b>Writers:</b> You can help us bywriting <a
+ href="documentation.html">documentation</a>.
+ </ul>
+
+ Those are just broad things that need to be worked on, but
+ something that would help tremendously would be to help with
+ small duties in the project that need to be addressed.
+
+ You can see what needs to be done in the class libraries <a href="class-status.html">here</a>
+
+** To start contributing
+
+ As a programmer, you can contribute in three different scenarios to Mono:
+
+ <ul>
+ * If you only have Linux/Unix.
+ * If you only have Windows.
+
+ * If you have both Linux and Windows.
+ </ul>
+
+ You might also want to check our <a href="#setup">common
+ setups</a> section that describes some common setups that people
+ use while working on Mono.
+
+*** Contributing to the class library, regression tests or the compiler
+
+ This only requires Windows currently.
+
+ To start developing classes or to contribute to the compiler,
+ you only need Windows and the .NET Framework 1.0 SDK. Please notice
+ that you do not need Visual Studio (although you can use it if
+ you want). The .NET Framework SDK requires some version of
+ Windows XP or Windows NT. If you are running Windows 98, 95
+ or Me, you could use instead the <a
+ href="http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/829/msdncompositedoc.xml">.NET Redist package</a>, but it
+ lacks the documentation browser and the ildasm program (C#, VB, JScript and IL
+ assembler are included).
+
+ You can get it <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>
+
+ If you are new to .NET, writing regression tests is a good way
+ of starting to contribute: it will help you get used to C# as
+ well as getting comfortable with the .NET APIs.
+
+ This helps because at this point you might be the best
+ qualified person to fix a problem found by the regression
+ test, or you might have a new class to implement in the .NET
+ world that only has a test suite.
+
+ To get started writing tests see the <a href="testing.html">Test Suite</a>
+ section.
+
+*** Contributing to the runtime engine
+
+ This only requires Linux, currently some tasks are easier if you
+ have access to Windows as well.
+
+ Here are a few things you can do:
+ <ul>
+ * Port the runtime to other architectures.
+ * Port the runtime to other operating systems.
+ * Finish the IL code verifier in the runtime.
+ * Hack the JIT, improve the code generator, add new
+ pattern rules, improve the register allocator.
+ * Implement the debugging interfaaces
+ </ul>
+
+** Bug reporting
+
+ If you find bugs in Mono, please make sure you enter a bug
+ report so we can keep track of problems in Mono.
+
+ To enter bug reports go to <a href="http://bugzilla.ximian.com">
+ http://bugzilla.ximian.com</a> and enter bug reports against
+ your favorite component (Mono, Runtime, C# compiler).
+
+ You can review the list of current bugs by going <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FClass+Libraries&product=Mono%2FMCS&product=Mono%2FRuntime&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&order=%27Importance%27&form_name=query">here</a>
+
+** Small tasks
+
+ A few smaller tasks are here, dropped in no particular order:
+ <ul>
+ * <b>Mono/doc and web site:</b> They need to be
+ packaged up in the official `distribution'
+
+ * Adding serialization support to all the classes.
+
+ We have many classes, but we have not implemented in
+ many cases the serialization and re-incarnation support in
+ them (this is pretty straight forward code, and simple,
+ but there is a lot to be done here).
+ </ul>
+
+* Emacs support
+
+ Brad Merryl's C# mode for Emacs is available: <a
+ href="http://www.cybercom.net/~zbrad/DotNet/Emacs/">http://www.cybercom.net/~zbrad/DotNet/Emacs/</a>
+
+* Books on C# and DotNet.
+
+ <ul>
+ * Dotnet Books (<a href="http://www.dotnetbooks.com">http://www.dotnetbooks.com</a>)
+
+ * Dotnet Resources (<a href="http://www.dotnetexperts.com/resources/">
+ http://www.dotnetexperts.com/resources</a>)
+
+ * O'Reilly C# Essentials (<a href="http://www.oreilly.com/catalog/csharpess/">
+ http://www.oreally.com/catalog/csharpess</a>)
+
+ * O'Really .NET Essentials (<a href="http://www.oreilly.com/catalog/dotnetfrmess/">
+ http://www.oreally.com/catalog/dotnetfrmess</a>)
+ </ul>
+
+<a name="setup">
+* Common Setups
+
+ People running both Linux and Windows while contributing to
+ Mono use a number of tricks to increase their productivity.
+
+ Scenarios:
+
+ <ul>
+ * <b>Linux host and Windows host</b>
+
+ The Windows file system is shared (right click on
+ your hard drive icon, and select sharing, allow this
+ to be shared).
+
+ The Windows machine has the required build tools
+ (cygwin, and the .NET framework). On the Windows
+ machine, you want to setup the ssh server (run the
+ ssh-host-config program to configure your ssh) and
+ run it (from a cygwin terminal, type: /usr/sbin/sshd).
+
+ From the Linux side, you want to mount the Windows
+ file system, using something like this:
+
+<tt><pre>
+ mount -t smbfs -o uid=miguel,username="Miguel de Icaza" "//quack/c$" /mnt
+</pre></tt>
+
+ In the above example, my Linux user name is
+ `miguel', and this will allow this user to have
+ read/write access to the share.
+
+ The host name is `quack', and the name of the share
+ is `c$' (that is the C: partition).
+
+ The file system is accessible on /mnt.
+
+ You can perform your cvs update and cvs commits from
+ the /mnt directory, and run Emacs or your favorite
+ Linux text editor on the Unix side in this way.
+
+ Then from another terminal, you can ssh into your
+ Windows box using ssh, like this: ssh "Miguel de Icaza@quack"
+ </ul>
+
+* Special Note
+
+ If you have looked at Microsoft's implementation of .NET or
+ their shared source code, you may not be able to contribute
+ to Mono. Details will follow when we know more about this.
+
+ In general be careful when you are implementing free software
+ and you have access to proprietary code. We need to make sure
+ that we are not using someone else's copyrighted code
+ accidentally.
+
+ Please do not use the <b>ildasm</b> program to disassemble
+ proprietary code when you are planning to reimplement a class
+ for Mono. If you have done this, we might not be able to use
+ your code.
+
+ Please stick to published documentation for implementing any
+ classes.
diff --git a/doc/devel-faq b/doc/devel-faq
new file mode 100644
index 00000000000..9ca89285219
--- /dev/null
+++ b/doc/devel-faq
@@ -0,0 +1,190 @@
+* Developer FAQ
+
+** New classes
+
+Q: Should we write classes which are not part of the .NET or ECMA specs?
+
+A: Yes. The ECMA and .NET specifications are far from complete, and
+ to produce a complete platform we will need a number of other
+ classes and components.
+
+ Any new classes that are not part of .NET or ECMA should be
+ designed to be reusable on anyone's CLI implementation. So that
+ Windows developers can also use any new classes that we come up
+ with.
+
+ We have a few existing <a href="ideas.html">Ideas on missing
+ classes</a>
+
+** Language Compatibility
+
+Q: What is the magic that allow multiple languages to co-exist?
+
+A: From Fergus Henderson:
+
+<i><blockquote>
+There are different levels of interoperability.
+The ECMA spec defines different categories of
+CLS (Common Language Specification) conformance.
+There are also some useful categories that don't
+correspond to any of the levels defined in the ECMA spec.
+In increasing degree of difficulty, your language implementation
+can
+
+ <ul>
+ * (a) just generate IL
+
+ * (b) be a CLS "consumer", which means that it can read in
+ meta-data describing component interfaces,
+ and that it provides a way to declare variables of
+ CLS-complaint types and to call CLS-complaint methods.
+
+ * (c) be a CLS "extender", which means that it can in addition
+ derive from CLS-compliant classes
+ and implement CLS-compliant interfaces
+
+ * (d) be able to produce components with *any* CLS-compliant
+ component interface.
+ </ul>
+
+Supporting some of these may require extending your language. However,
+you can get quite a lot of interoperability by just putting appropriate
+functionality in your compiler, without extending your language.
+
+For some things, e.g. ASP.NET, your language implementation also needs to be
+able to
+
+ <ul>
+ * (e) consume CodeDom trees. CodeDom trees are an abstract
+ representation of programs in a form similar to a C# parse
+ tree, with embedded code snippets (unparsed strings).
+ Given a CodeDom tree, with the snippets in your language,
+ your language implementation needs to generate a (i) .NET
+ assembly and possibly also (ii) a source file in your language.
+
+ * (f) produce CodeDom trees. For some applications,
+ your language implementation also needs to be able to
+ round-trip from CodeDom -> your language -> CodeDom.
+ </ul>
+
+and for some things it needs to
+
+ <ul>
+ * (g) generate *verifiable* IL
+ </ul>
+
+So when you hear all the hype about how language XYZ is a
+".NET language", make sure you ask which of these different
+things are supported.
+
+[For the record, Mercury currently supports (a). We're working on
+(b) and (g), and on parts of (c) and (e). We're never going to do (f), I very
+strongly doubt we'll ever do (d), and for (c) we might only ever support
+implementing interfaces, not deriving from classes.]
+
+</blockquote></i>
+
+** PInvoke
+
+Q: What are the two major initiatives to implement PInvoke?
+
+A: Fergus Henderson answers:
+
+<i><blockquote>
+Many of the .NET APIs will need to be implemented using code that calls C/Unix
+APIs, such as stat(). The standard way of interfacing with native code from
+.NET code is to use "PInvoke". However, there is a difficulty: many of
+these APIs are defined in terms of types such as C's `long' or `size_t'
+or the Posix `struct stat' whose representation varies depending on the
+platform (architecture/OS/C compiler). There's no *portable* way of
+accessing those from .NET managed code.
+
+So, there are a couple of different approaches.
+One possibility is to access such routines by writing a wrapper, e.g. in C,
+that provides the same functionality without using types with a system-dependent
+representation. The wrapper can then be directly accessed from portable
+.NET code. The .NET code remains both source- and binary-portable;
+the wrapper code is source-portable, but needs to be compiled
+seperately for each target platform. The drawback of this approach is
+that you have to write a lot of cumbersome wrapper code.
+
+Another possibility is to extend the .NET VM with support for an
+additional custom attribute, e.g. "[PosixType]". The VM would then
+represent types tagged with this attribute in the same way that the
+underlying system represents those types. With this approach, no
+wrapper code would be needed. A drawback of this approach is that it
+pushes quite a bit of complexity into the VM; the VM would have to know
+the native representation of all types annotated with this attribute.
+Another drawback is that code using this extension might not work on
+different VMs.
+
+There have also been some other suggestions, but those are the two that
+I think are the best.
+</blockquote></i>
+
+Q: What is the problem implementing PInvoke?
+
+A: Again, from Fergus Henderson:
+
+<i><blockquote>
+There's no problem implementing PInvoke as specified in the ECMA
+specs and/or MS documentation. It's just that PInvoke by itself
+doesn't solve all of the problems; in particular it doesn't solve
+the problem of C types whose representation is different on different
+systems.
+</blockquote></i>
+
+** CVS use
+
+Q: Why do we keep ChangeLogs and make the CVS commit messages be the
+ same? One could be generated from the other
+
+A: There are a number of reasons for keeping ChangeLog files as well as
+ CVS commit files:
+
+ <ul>
+ * Offline programming: when people are traveling, CVS logs are
+ not available.
+
+ * Slow CVS access: Many people work over modem lines (very
+ typical for contributors in Europe, Asia, Latin America)
+ using CVS is slow and might not be available to you (cvs
+ server down, no anoncvs server available).
+
+ * ChangeLogs travel in a released tarball package, so it is
+ possible to study the rationale of changes even after a
+ project is long "released", or you only have the sources for
+ the code.
+
+ * ChangeLog are not metadata for each file, they are live
+ files that you can browse in the package that is being
+ distributed.
+ </ul>
+
+Making the CVS commit message be the same as the ChangeLog has other
+benefits:
+
+ <ul>
+ * You can track down with `cvs log' what things were changed,
+ and match those to meaningful reports on the intentions of
+ the commit.
+
+ * When reading the commits-list, you can get a glimpse of the
+ changes without having to diff out or cvs update your tree.
+
+ * You can read off-line the changes that are being made
+ (asyncrouns operation).
+ </ul>
+
+This mechanism works very well for GNOME and other projects.
+
+Q: Should I use any of the special RCS keywords like $Id: devel-faq,v 1.1 2001/07/31 21:13:05 miguel Exp $, $Author: miguel $,
+ $Date: 2001/07/31 21:13:05 $, or $Revision: 1.1 $?
+
+A: Please avoid using those in the source code in the CVS. They
+ are not really useful, and they cause a lot of conflicts when
+ people have separate CVS trees.
+
+ It was a nightmare with the Linux kernel when two people had their
+ private CVS trees and were submitting patches to the core.
+
diff --git a/doc/documentation b/doc/documentation
new file mode 100644
index 00000000000..4ed2e6a6639
--- /dev/null
+++ b/doc/documentation
@@ -0,0 +1,62 @@
+* Documentation
+
+ Although most of the concepts from Microsoft.NET can
+ be applied to the completed Mono platform, we do need to
+ have a complete set of free documentation written specifically
+ for Mono.
+
+ The documentation license we have chosen is the GNU Free
+ Documentation License (FDL), the standard for most documents
+ in the free software world.
+
+ We need documentation on a number of topics:
+
+ <ul>
+
+ * The development tools (compilers, assembler tools,
+ language reference, design time features).
+
+ * Frequently Asked Question compilations.
+
+ * HOWTO documents.
+
+ * The Class Libraries
+
+ * Tutorials on Mono and the specifics of running it.
+
+ * A guide to Mono as compared to the Microsoft.NET
+ Framework SDK
+
+ </ul>
+
+** Class Library documentation
+
+ We are moving to a new setup for documenting the class libraries,
+ and you can read about it <a href="classlib-doc.html">here</a>.
+
+ A few words of warning and advice for class documentors:
+
+ A well-documented API can ease hours of frustration; as Mono
+ matures, robust and complete class library documentation will
+ become increasingly important. As you write API documentation,
+ whether it is embedded in source files or in external Monodoc XML,
+ please keep the following in mind:
+
+ Plagarism, even if it's unintentional, is a Bad Thing(TM).
+ Microsoft's .NET Framework Class Library documentation is an
+ excellent resource for understanding the behavior and properties of
+ a type, and a lot of hard work went in to creating this (copyrighted)
+ resource. Please don't copy from Microsoft's reference when
+ documenting a type.
+
+ To avoid this, I (<a href="mailto:jbarn@httcb.net">jbarn@httcb.net</a>)
+ suggest that you read the complete Microsoft documentation for a type,
+ ponder it for a while, and write the Mono documentation in your own
+ words. While it's certainly okay to refer to the Microsoft
+ documentation to clarify your understanding of behavior or properties,
+ please don't open the Microsoft docs and refer to them for each member
+ you document.
+
+ There's a lot of domain expertise among the class library contributors;
+ let's put the same personal stamp on the class library documentation
+ that we have on the class libraries themselves. \ No newline at end of file
diff --git a/doc/download b/doc/download
new file mode 100644
index 00000000000..10755d1caa5
--- /dev/null
+++ b/doc/download
@@ -0,0 +1,352 @@
+* Software Availability
+
+ The Virtual Execution System is available in package `mono'.
+ Currently this contains a metadata library and the
+ disassembler. Please refer to our <a
+ href="runtime.html">Runtime</a> description for more details
+ on this part of the project.
+
+ The code for the C# compiler as well as the language error
+ test suite and the class library are in the `mcs' package, we
+ will move this later into `mono' itself.
+
+ In order to make mcs and the class libraries you will need a computer
+ running Windows with the <strong>GNU make tools</strong> from the
+ <strong>Cygwin</strong> environment, <strong>Microsoft's .NET Framework
+ SDK</strong>, <strong>GLIB 1.3</strong> and
+ <strong>pkg-config</strong>.
+
+ When installing Cygwin, don't forget to include
+ <tt>mingw-runtime</tt>. If you omit this, you will encounter
+ configure problems regarding not being able to generate
+ executables.
+
+<a name="sources">
+*** Sources
+
+ Stay up to date on the Mono team's development using the
+ <a href="http://lists.ximian.com/mailman/listinfo/mono-cvs-list">
+ mono-cvs-list</a> mailing list. The CVS source code can also
+ be browsed <a href="http://cvs.hispalinux.es/cgi-bin/cvsweb/mcs/mcs/cfold.cs?cvsroot=Mono">here</a>
+
+<a name="mar-27">
+ <b>Mono 0.10</b>
+
+ New packaged versions of the Mono C# compiler and Mono runtime
+ are now available. The latest version is 0.10.
+
+ <ul>
+ * <a href="archive/mono-0.10">Mono 0.10 release notes</a>
+
+ * <a href="archive/mcs-0.10.tar.gz">mcs-0.10.tar.gz</a>
+ Mono C# compiler
+ * <a href="archive/mono-0.10.tar.gz">mono-0.10.tar.gz</a>
+ Mono runtime
+ </ul>
+
+<a name="feb-22">
+ <b>Mono 0.9</b>
+
+ New packaged versions of the Mono C# compiler and Mono runtime
+ are now available. The latest version is 0.9.
+
+ <ul>
+ * <a href="archive/mono-0.9">Mono 0.9 release notes</a>
+
+ * <a href="archive/mcs-0.9.tar.gz">mcs-0.9.tar.gz</a>
+ Mono C# compiler
+ * <a href="archive/mono-0.9.tar.gz">mono-0.9.tar.gz</a>
+ Mono runtime
+ </ul>
+
+<a name="snapshots">
+ For up to date sources, it is recommended that you use the Mono
+ source code from either 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. They should give you a window to see what we are
+ up to.
+
+ You can download the GNU make tools and the Cygwin environment from
+ <a href="http://www.cygwin.com">www.cygwin.com</a>.
+
+ You can download Microsoft's .NET Framework SDK from
+ <a href="http://msdn.microsoft.com/downloads">
+ msdn.microsoft.com/downloads</a>.
+
+ 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.
+
+ The script will download required packages from
+ www.go-mono.com and do a cvs checkout of mono in the current
+ directory. The cvs server chosen defaults to anonymous cvs;
+ set your CVSROOT environment variable before running the script to
+ select a particular cvs server.
+
+** Mono Regression Test Suite
+
+ You can get binaries for the Mono Regression Test Suite <a
+ href="archive/mono-tests.tar.gz">here</a>
+
+<a name="install">
+** Building the software manually
+
+*** Download the required software.
+
+ <ul>
+
+ * 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 1.3 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.80-tml-20020101.zip">http://www.go-mono.com/archive/pkgconfig-0.80-tml-20020101.zip</a>
+ <a href="http://www.go-mono.com/archive/glib-1.3.12-20020101.zip">http://www.go-mono.com/archive/glib-1.3.12-20020101.zip</a>
+ <a href="http://www.go-mono.com/archive/glib-dev-1.3.12-20020101.zip">http://www.go-mono.com/archive/glib-dev-1.3.12-20020101.zip</a>
+ <a href="http://www.go-mono.com/archive/libiconv-1.7.zip">http://www.go-mono.com/archive/libiconv-1.7.zip</a>
+ <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>
+ <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>
+
+ * 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>
+
+
+*** Install Cygwin and the GNU build tools, Microsoft's .NET Framework SDK and the precompiled GLIB 1.3 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 <strong>/usr/local</strong> directory
+ of your Cygwin installation.<br>
+ Unzip the precompiled packages listed above.
+
+ </ul>
+
+*** On Windows, to install and work on the compiler and the class libraries:
+
+ <ul>
+
+ * If you downloaded the Mono
+ <a href="http://www.go-mono.com/snapshots">nightly snapshot
+ </a>, untar the snapshot.
+
+ * Change directories to <strong>"mcs"</strong>.
+
+ * Compile:
+
+<pre>
+<strong>make windows</strong>
+</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 <strong>"mono"</strong>.
+
+ * Configure, compile and install:
+
+<pre><strong>
+./configure --prefix=c:/mono
+make
+make install
+</strong></pre>
+
+ </ul>
+
+*** On Unix, to compile the mono runtime:
+
+ <ul>
+
+ * Install <a href="http://www.freedesktop.org/software/pkgconfig">pkg-config</a>.
+
+ * Install glib 1.3. You can download it
+ from <a href="ftp://ftp.gtk.org/pub/gtk/v1.3/glib-1.3.12.tar.gz">ftp.gtk.org</a>. Maybe you need
+ to modify your ACLOCAL_FLAGS for pkg-config, for example if
+ your install prefix is /usr/local:
+<pre>
+<strong>export ACLOCAL_FLAGS="-I /usr/local/share/aclocal"</strong>
+</pre>
+
+ * If you downloaded the Mono
+ <a href="http://www.go-mono.com/snapshots">nightly snapshots
+ </a>, untar the snapshot.
+
+ * Change directories to <strong>"mono"</strong>.
+
+ * Configure, compile and install:
+<pre><strong>
+./configure
+make
+make install</strong>
+</pre>
+ </ul>
+
+*** Notes on compiling GLIB 1.3 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><strong>
+tar xzvf pkg-config-0.8.0.tar.gz
+cd pkg-config-0.8.0
+./configure --prefix=/usr
+make
+make install</strong>
+</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/v1.3/glib-1.3.12.tar.gz">
+ glib 1.3</a> from source.
+
+ </ul>
+
+
+<a name="oldreleases">
+
+*** Very old releases.
+
+ <ul>
+ <a name="feb-11">
+ <b>February 11, 2002</b>
+ * <a href="archive/mcs-0.8.tar.gz">mcs-0.8.tar.gz</a>
+ Mono C# compiler
+ * <a href="archive/mono-0.8.tar.gz">mono-0.8.tar.gz</a>
+ Mono runtime
+ </ul>
+
+ <a name="sep-18">
+ <b>September 18, 2001</b>
+ <ul>
+ * <a href="archive/mono-0.7.tar.gz">mono-0.7.tar.gz</a>: Mono Runtime 0.7 release.
+ * <a href="archive/mcs-0.7.tar.gz">mcs-0.7.tar.gz</a>: Mono Compiler and Classes 0.7 release.
+ * <a href="archive/mono-0.7">Release Notes.</a>
+ </ul>
+
+ <a name="august-22">
+ <b>August 22, 2001</b>
+ <ul>
+ * <a href="archive/mono-0.6.tar.gz">mono-0.6.tar.gz</a>: Mono Runtime 0.6 release.
+ * <a href="archive/mono-compiler-classes-0.6.tar.gz">mono-compiler-classes-0.6.tar.gz</a>: Mono Compiler and Classes 0.6 release.
+ * <a href="archive/mono-0.6">Release Notes.</a>
+ </ul>
+
+
+ <a name="july-29">
+ <b>July 29, 2001</b>
+ <ul>
+ * <a href="archive/mono-0.5.tar.gz">mono-0.5.tar.gz</a>: Mono Runtime 0.5 release.
+ * <a href="archive/mono-0.5">Release Notes.</a>
+ </ul>
+
+
+ <a name="july-22">
+ <b>July 22, 2001</b>
+ <ul>
+ * <a href="archive/mcs-22-Jul-2001.tar.gz">mcs-22-Jul-2001.tar.gz</a>: CVS snapshot.
+ * <a href="archive/mcs-Jul-22-Jul-19-2001.tar.gz">Differences since 19</a>: CVS snapshot.
+ * <a href="archive/mcs-22">Release Notes.</a>
+ </ul>
+
+ <a name="july-19">
+ <b>July 19th, 2001</b>
+ <ul>
+ * <a href="archive/mcs-19-Jul-2001.tar.gz">mcs-19-Jul-2001.tar.gz</a>: CVS snapshot.
+ * <a href="archive/mcs-Jul-17-Jul-19-2001.tar.gz">Differences since 17</a>: CVS snapshot.
+ * <a href="archive/mcs-19">Release Notes.</a>
+ </ul>
+
+ <a name="july-17">
+ <b>July 17th, 2001</b>
+ <ul>
+ * <a href="archive/mcs-17-Jul-2001.tar.gz">mcs-17-Jul-2001.tar.gz</a>: CVS snapshot.
+ * <a href="archive/mcs-Jul-15-Jul-17-2001.tar.gz">Differences since 15</a>: CVS snapshot.
+ * <a href="archive/mcs-17">Release Notes.</a>
+ </ul>
+
+ <a name="july-15">
+ <b>July 15th, 2001</b>
+ <ul>
+ * <a href="archive/mcs-15-Jul-2001.tar.gz">mcs-15-Jul-2001.tar.gz</a>: CVS snapshot.
+ * <a href="archive/mono-0.4.tar.gz">mono-0.4.tar.gz</a>: Packaged Source Code.
+ * <a href="archive/mono-0.4">Release Notes.</a>
+ </ul>
+
+ <a name="july-14">
+ <b>July 14th, 2001</b>
+ <ul>
+ * <a href="archive/mcs-12-Jul-2001.tar.gz">mcs-12-Jul-2001.tar.gz</a>: CVS snapshot.
+ * <a href="archive/mono-0.3.tar.gz">mono-0.3.tar.gz</a>: Packaged Source Code.
+ </ul>
+
+ <a name="july-8">
+ <b>July 8th, 2001</b>
+
+ <ul>
+ * <a href="archive/mcs-08-Jul-2001.tar.gz">mcs-08-Jul-2001.tar.gz</a>: CVS Snapshot
+ * <a href="archive/mono-08-Jul-2001.tar.gz">mono-08-Jul-2001.tar.gz</a>: CVS Snapshot
+ </ul>
+ </ul>
+
diff --git a/doc/faq b/doc/faq
new file mode 100644
index 00000000000..00bb0989cce
--- /dev/null
+++ b/doc/faq
@@ -0,0 +1,698 @@
+<a href="#basics">Basics</a><br>
+<a href="#ximian">The Ximian Role in the Mono project</a><br>
+<a href="#gnome">Mono and GNOME</a><br>
+<a href="#gui">Building GUI applications with Mono</a><br>
+<a href="#msft">Mono and Microsoft</a><br>
+<a href="#pnpproject">Mono and the Portable.NET Project</a><br>
+<a href="#webservices">Web Services</a><br>
+<a href="#devel">Development Tools and Issues</a><br>
+<a href="#java">Mono and Java</a><br>
+<a href="#extending">Extending Mono</a><br>
+<a href="#portability">Portability</a><br>
+<a href="#reuse">Reusing Existing Code</a><br>
+<a href="#gcc">Mono and GCC</a><br>
+<a href="#performance">Performance</a><br>
+<a href="#licensing">Licensing</a><br>
+<a href="#patents">Patents</a><br>
+<a href="#etc">Miscellaneous Questions</a><br>
+
+
+<a name="basics"></a>
+** Basics
+
+Q: What is Mono exactly?
+
+A: The Mono Project is an open development initiative sponsored by
+ Ximian that is working to develop an open source, Linux-based
+ version of the Microsoft .NET development platform. Its objective
+ is to enable Linux developers to build and
+ deploy cross-platform .NET Applications. The project will
+ implement various technologies developed by Microsoft that have now
+ been submitted to the ECMA for standardization.
+
+Q: What is the difference between Mono and the .NET Initiative?
+
+A: The ".NET Initiative" is a somewhat nebulous company-wide effort by
+ Microsoft, one part of which is a cross-platform development
+ framework. Mono is an implementation of the development framework,
+ but not an implementation of anything else related to the .NET
+ Initiative, such as Passport, software-as-a-service, or
+ corporate rebranding.
+
+Q: What technologies are included in Mono?
+
+A: Mono contains a number of components useful for building new
+ software:
+
+ <ul>
+ * A Common Language Infrastructure (CLI) virtual
+ machine that contains a class loader, Just-in-time
+ compiler, and a garbage collecting runtime.
+
+ * A class library that can work with any language
+ which works on the CLR.
+
+ * A compiler for the C# language. In the future we
+ might work on other compilers that target the Common
+ Language Runtime.
+ </ul>
+
+
+ Windows has compilers that target the virtual machine from <a
+ href="http://msdn.microsoft.com/net/thirdparty/default.asp#lang">a
+ number of languages:</a> Managed C++, Java Script, Eiffel,
+ Component Pascal, APL, Cobol, Oberon, Perl, Python, Scheme,
+ Smalltalk, Standard ML, Haskell, Mercury and Oberon.
+
+ The CLR and the Common Type System (CTS) enables applications and
+ libraries to be written in a collection of different languages that
+ target the byte code
+
+ This means for example that if you define a class to do algebraic
+ manipulation in C#, that class can be reused from any other
+ language that supports the CLI. You could create a class in C#,
+ subclass it in C++ and instantiate it in an Eiffel program.
+
+ A single object system, threading system, class libraries, and
+ garbage collection system can be shared across all these languages.
+
+Q: Where can I find the specification for these technologies?
+
+A: You can find the work-in-progress documentation from the T3G ECMA
+ group here:
+
+ <a href="http://www.dotnetexperts.com">http://www.dotnetexperts.com</a>
+
+Q: Will you implement the .NET Framework SDK class libraries?
+
+A: Yes, we will be implementing the APIs of the .NET Framework SDK
+ class libraries.
+
+Q: Will you offer an ECMA-compliant set of class libraries?
+
+A: Eventually we will. Our current focus is on interoperating
+ with the Microsoft SDK, but we will also offer an ECMA compliant
+ set of libraries.
+
+Q: What does the name "Mono" mean?
+
+A: Mono is the word for `monkey' in Spanish. We like monkeys.
+
+Q: Is Mono usable?
+
+A: The JIT engine is usable on Intel x86 machines. An interpreter
+ can be used on other non-Intel x86 machines.
+
+ The class libraries are not yet mature enough to run real applications,
+ but if you are interested in trying out Mono, you can definetly start
+ testing things out as many programs run.
+
+ The C# compiler has made significant progress, it can even compile
+ itself now, but it can not yet be ran with our class libraries as
+ they are missing some features.
+
+Q: When will you ship it?
+
+A: It is premature to target a shipdate for the code, but we
+ anticipate that it will be available some time in the middle of
+ 2002.
+
+Q: How can I contribute?
+
+A: Check the <a href="contributing.html">contributing</a> section.
+
+Q: Aren't you just copying someone else's work?
+
+A: We are interested in providing the best tools for programmers to
+ develop applications for Free Operating Systems. We also want to help
+ provide the interoperability that will allow those systems to fit in
+ with other standards.
+
+ For more background, read the <a href="http://www.go-mono.com/rationale.html">Mono
+ Project white paper</a>.
+ the project.
+
+
+<a name="ximian"></a>
+
+** The Ximian Role in the Mono Project
+
+Q: Why is Ximian working on .NET?
+
+A: Ximian is interested in providing the best tools for programmers to
+ develop applications for Free Operating Systems.
+
+ For more information, read the project <a
+ href="rationale.html">rationale</a> page.
+
+Q: Will Ximian be able to take on a project of this size?
+
+A: Of course not. Ximian a supporter of the Mono project, but the only way
+ to implement something of this size is for the entire free software
+ community to get involved. Visit the <a href="contributing.html">contributing</a>
+ page if you'd like to help out.
+
+Q: What pieces will Ximian be working on?
+
+A: We will devote most of our resources to work on the pieces which are
+ on the critical path to release a development and execution
+ environment. Once the project is at a stage where it is useful in
+ the real world, it will achieve a critical mass of developers to
+ improve it further.
+
+Q: Will Ximian offer Mono commercially?
+
+A: When Mono is ready to be shipped Ximian will offer a commercial
+ support and services for Mono.
+
+Q: Will you wait until Mono is finished?
+
+A: Mono will ship on various stages as they mature. Some people
+ require only a subset of the technologies, those will ship first.
+
+ More advanced features will take more time to develop. A support
+ timeline will be available in June 2002.
+
+<a name="gnome"></a>
+** Mono and GNOME
+
+Q: How is Mono related to GNOME?
+
+A: In a number of ways. This project was born out of the need of
+ providing improved tools for the GNOME community, and will use
+ existing components that have been developed for GNOME when they
+ are available. For example, we plan to use Gtk+ and Libart to
+ implement Winforms and the Drawing2D API and are considering
+ GObject support.
+
+Q: Has the GNOME Foundation or the GNOME team adopted Mono?
+
+A: Mono is too new to be adopted by those groups. We hope that the
+ tools that we will provide will be adopted by free software
+ programmers including the GNOME Foundation members and the GNOME
+ project generally.
+
+Q: Should GNOME programmers switch over to Mono now?
+
+A: It is still far to early for discussions of "switching over." No
+ pieces of Mono will be ready within the next six months, and a
+ complete implementation is roughly one year away.
+
+ We encourage GNOME developers to continue using the existing tools,
+ libraries and components. Improvements made to GNOME will have an
+ impact on Mono, as they would be the "backend" for various classes.
+
+Q: Will Mono include compatibility with Bonobo components? What is the
+ relationship between Mono and Bonobo?
+
+A: Yes, we will provide a set of classes for implementing and using
+ Bonobo components from within Mono. Mono should allow you to write
+ Bonobo components more easily, just like .NET on Windows allows you
+ to export .NET components to COM.
+
+Q: Does Mono depend on GNOME?
+
+A: No, Mono does not depend on GNOME. We use a few packages produced by
+ the GNOME team like the `glib' library.
+
+Q: But will I be able to build GNOME applications?
+
+A: Yes, we will enable people to write GNOME applications using Mono.
+
+<a name="gui"></a>
+** GUI applications
+
+Q: Will Mono enable GUI applications to be authored?
+
+A: Yes, you will be able to build GUI applications. Indeed, that is our
+ main focus. We will provide both the Windows.Forms API and the Gtk# API.
+
+Q: What is the difference between Gtk# and System.Windows.Forms?
+
+A: Gtk# is a set of bindings for the Gtk+ toolkit for C# (and other
+ CIL-enabled languages). System.Windows.Forms is an API defined
+ by Microsoft to build GUI applications.
+
+Q: Will I be able to run my smart clients on systems powered by Mono?
+
+A: As long as your applications are 100% .NET and do not make use
+ of P/Invoke to call Win32 functions, your smart client applications
+ will run on Mono platforms.
+
+<a name="msft"></a>
+** Mono and Microsoft
+
+Q: Is Microsoft helping Ximian with this project?
+
+A: No. Ximian CTO Miguel de Icaza had a friendly conversation with
+ Microsoft software architect David Stutz, but that's about the
+ extent of the contact. Microsoft is interested in other
+ implementations of .NET and are willing to help make the ECMA spec
+ more accurate for this purpose.
+
+ Ximian representatives have also spoken with Sam Ruby at the ECMA
+ TG3 committee to discuss the same issues.
+
+Q: Is Microsoft or Corel paying Ximian to do this?
+
+A: No.
+
+Q: Do you fear that Microsoft will change the spec and render Mono
+ useless?
+
+A: No. Microsoft proved with the CLI and the C# language that it was
+ possible to create a powerful foundation for many languages to
+ interoperate. We will always have that.
+
+ Even if changes happened in the platform which were undocumented,
+ the existing platform would a value on its own.
+
+Q: Are you writing Mono from the ECMA specs?
+
+A: Yes, we are writing them from the ECMA specs and the published
+ materials in print about .NET.
+
+Q: If my applications use Mono, will I have to pay a service fee?
+
+A: No. Mono is not related to Microsoft's initiative of
+ software-as-a-service.
+
+Q: Is the Mono Project is related to the Microsoft Hailstorm effort? Is
+ Ximian endorsing Hailstorm?
+
+A: No. The Mono Project is focused on providing a compatible set of
+ tools for the Microsoft .NET development platform. It does not
+ address, require, or otherwise endorse the MS Passport-based
+ Hailstorm single sign-on system that is part of Windows XP and
+ other services.
+
+Q: Will Mono or .NET applications depend on Microsoft Passport?
+
+A: No. MS Passport is unrelated to running .NET compatible applications
+ produced with the Mono tools. The only thing you will need is a
+ just-in-time compiler (JIT).
+
+Q: What is a 100% .NET application?
+
+A: A `100% .NET application' is one that only uses the APIs defined
+ under the System namespace and does not use PInvoke. These
+ applications would in theory run unmodified on Windows, Linux,
+ HP-UX, Solaris, MacOS X and others.
+
+Q: If Microsoft will release a port of their .NET platform under the
+ `Shared Source' license, why should I bother with anything else?
+
+A: The Shared Source implementation will be expensive and its uses
+ will be tightly restricted, especially for commercial use. We are
+ working towards an implementation that will grant a number of
+ important rights to recipients: use for any purpose,
+ redistribution, modification, and redistribution of modifications.
+
+ This is what we call <a
+ href="http://www.gnu.org/philosophy/free-sw.html">Free Software</a>
+
+Q: Is Mono a free implementation of Passport?
+
+A: No. Mono is just a runtime, a compiler and a set of class
+ libraries.
+
+Q: Will the System.Web.Security.PassportIdentity class mean
+ that my software will depend on Passport?
+
+A: No. Applications may use that API to contact a Passport site, but
+ are not required to do so.
+
+ As long as your application does not use Passport, you will not
+ need Passport.
+
+Q: Will Mono running on Linux make Passport available for Linux?
+
+A: No. However, the Passport toolkit for Linux-based web servers is
+ available from Microsoft.
+
+Q: Will Mono allow me to run Microsoft Office on Linux?
+
+A: No, it will not. Microsoft Office is a Windows application. To
+ learn more about running Windows applications on Intel Unix systems
+ refer to <a href="http://www.winehq.com">the Wine Project</a>.
+
+<a name="pnpproject"></a>
+** Mono and Portable.NET
+
+Q: What are the differences between Mono and Portable.NET?
+
+A: Most of Mono is being written using C#, with only
+ a few parts written in C (The JIT engine, the runtime, the
+ interfaces to the garbage collection system). The Portable.NET
+ Project is using C for development.
+
+<a name="webservices"></a>
+** Web Services
+
+Q: How is Mono related to Web Services?
+
+A: Mono is only related to Web Services in that it will implement the
+ same set of classes that have been authored in the .NET Framework
+ to simplify and streamline the process of building Web Services.
+
+ But most importantly, Mono is an Open Source implementation of the
+ .NET Framework.
+
+Q: Can I author Web Services with Mono?
+
+A: You will be able to write Web Services on .NET that run on Mono and
+ viceversa.
+
+Q: If Mono implements the SDK classes, will I be able to write and
+ execute .NET Web Services with it?
+
+A: Yes. When the project is finished, you will be able to use the
+ same technologies that are available through the .NET Framework SDK
+ on Windows to write Web Services.
+
+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>.
+
+Q: Can I use CORBA?
+
+A: Yes. The CLI contains enough information about a class that
+ exposing it to other RPC systems (like CORBA) is really simple, and
+ does not even require support from an object.
+
+ We will be implementing CORBA interoperation as an extension to the
+ Mono classes so that we can integrate with Bonobo, just like
+ Microsoft provides COM interoperation classes and support
+ mechanisms.
+
+Q: Can I serialize my objects to other things other than XML?
+
+A: Yes, although the serializing tools have not yet been planned, and
+you would probably have to implement them yourself.
+
+Q: Will Mono use ORBit?
+
+A: No. Mono will be using a new implementation of CORBA that isn't still started.
+
+<a name="devel"></a>
+** Development Tools and Issues
+
+Q: Will it be possible to use the CLI features without using bytecodes
+ or the JIT?
+
+A: Yes. The CLI engine will be made available as a shared library.
+ The garbage collection engine, the threading abstraction, the
+ object system, the dynamic type code system and the JIT will be
+ available for C developers to integreate with their applications if
+ they wish to do so.
+
+Q: Will you have new development tools?
+
+A: With any luck, Free Software enthusiasts will contribute tools to
+ improve the developer environment. These tools could be developed
+ initially using the Microsoft implementation of the CLI and then
+ executed later with Mono.
+
+Q: What kind of rules make the Common Intermediate Language useful for
+ JITers?
+
+A: The main rule is that the stack in the CLI is not a general purpose
+ stack. You are not allowed to use it for other purposes than
+ computing values and passing arguments to functions or return
+ values.
+
+ At any given call or return instruction, the types on the stack
+ have to be the same independently of the flow of execution of your
+ code.
+
+Q: Is it true that the CIL is ideal for JITing and not efficient for
+ interpreters?
+
+A: The CIL is better suited to be JITed than JVM byte codes, but you
+ can interpret them as trivially as you can interpret JVM byte
+ codes.
+
+<a name="java">
+** Mono and Java
+
+Q: Why don't you use Java? After all, there are many languages that
+ target the Java VM.
+
+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">frontend 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
+ <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>.
+
+ The JVM is not designed to be a general purpose virtual machine.
+ The Common Intermediate Language (CIL), on the other hand, is
+ designed to be a target for a
+ wide variety of programming languages, and has a set of rules
+ designed to be optimal for JITers.
+
+Q: Could Java target the CLI?
+
+A: Yes, Java could target the CLI. We have details on a <a
+ href="ideas.html#guavac">project</a> that someone could take on to
+ make this happen.
+
+ Microsoft has an implemenation of the Java language called J# that
+ can target the CIL execution engine.
+
+Q: Is it possible to write a JVM byte code to CIL convertor?
+
+A: Yes, it is possible. Here are a few starting point:
+
+ <ul>
+ * A byte code representation is really a flattened forest of
+ trees. Look at the Mono JIT engine to see how we compute
+ the basic blocks (this is used to figure out the "trees").
+
+ The forest is just an array of trees.
+
+ Indeed, run the JIT engine with -d (mono -d prog.exe) and
+ you will see how these trees look like.
+
+ You will have to do something similar for Java.
+
+ * Each "forest of trees" has a meaning. This meaning can now
+ be translated into the equivalent "meaning" in CLR-land.
+ </ul>
+
+<a name="extending"></a>
+** Extending Mono
+
+Q: Would you allow other classes other than those in the
+ specification?
+
+A: Yes. The Microsoft class collection is very big, but it is by no
+ means complete. It would be nice to have a port of `Camel' (the
+ Mail API used by Evolution inspired by Java Mail) for Mono
+ applications.
+
+ You might also want to look into implementing CORBA for Mono. Not
+ only because it would be useful, but because it sounds like a fun
+ thing to do, given the fact that the CLI is such a type rich
+ system.
+
+ For more information on extending Mono, see our <a
+ href="ideas.html">ideas</a> page.
+
+Q: Do you plan to Embrace and Extend .NET?
+
+A: Embracing a good technology is good. Extending technologies in
+ incompatible ways is bad for the users, so we do not plan on
+ extending the technologies.
+
+ If you have innovative ideas, and want to create new classes, we
+ encourage you to make those classes operate correctly well in both
+ Mono and .NET
+
+<a name="portability"></a>
+** Portability
+
+Q: Will Mono only work on Linux?
+
+A: Currently, we are doing our work on Linux-based systems and
+ Windows. We do not expect many Linux-isms in the code, so it
+ should be easy to port Mono to other UNIX variants.
+
+Q: What about Mono on non X-based systems?
+
+A: Our main intention at Ximian is to be able to develop GNOME
+ applications with Mono, but if you are interested in providing a
+ port of the Winform classes to other platforms (frame buffer or
+ MacOS X for example), we would gladly integrate them, as long
+ they are under an open source license.
+
+Q: Will Mono run on Windows?
+
+A: We hope so. Currently some parts of Mono only run on Windows
+ (the C# compiler is a .NET executable) and other parts have only
+ been compiled on Linux, but work on Windows with Cygwin.
+
+Q: Will Mono depend on GNOME?
+
+A: It will depend only if you are using a particular assembly (for
+ example, for doing GUI applications). If you are just interested
+ in Mono for implementing a `Hello World Enterprise P2P Web
+ Service', you will not need any GNOME components.
+
+<a name="reuse"></a>
+** Reusing Existing Code
+
+Q: What projects will you reuse or build upon?
+
+A: We want to get Mono in the hands of programmers soon. We are
+ interested in reusing existing open source software.
+
+Q: What about Intel's research JIT framework, ORP?
+
+A: At this time, we are investigating whether we can use elements of
+ ORP for Mono. ORP is a research JIT engine that has a clearly
+ defined API that splits the JIT from the GC system and the actual
+ byte code implementation.
+
+Q: What about using GNU Lightning?
+
+A: We are also researching <a
+ href="http://www.gnu.org/software/lightning/lightning.html">GNU
+ Lightning</a>.
+
+<a name="gcc"></a>
+** Mono and GCC
+
+Q: Are you working on a GCC front-end to C#? A GCC backend that will
+ generate CIL images? What about making a front-end to GCC that
+ takes CIL images and generates native code?
+
+A: We are currently seeking volunteers for those projects.
+ Visit the <a href="contributing.html">contributing</a> section if
+ you are interested.
+
+Q: But would this work around the GPL in the GCC compiler and allow
+ people to work on non-free front-ends?
+
+A: People can already do this by targeting the JVM byte codes (there
+ are about 130 compilers for various languages that target the JVM).
+
+Q: Why are you writing a JIT engine instead of a front-end to GCC?
+
+A: We want the JIT engine and runtime engine because they will be able
+ to execute CIL executables generated on Windows, and so no recompilation
+ will be necessary.
+
+<a name="performance"></a>
+** Performance
+
+Q: How fast will Mono be?
+
+A: We can not predict the future, but a conservative estimate is that
+ it would be at least `as fast as other JIT engines'.
+
+ We would like to ship various JIT engines with Mono, just like
+ Microsoft has done with their .NET development platform. We could
+ provide a faster, JIT for fast load times but lower performance,
+ and an and an optimizing JIT that would be slower at generating
+ code but produce more optimal output.
+
+ The CIL has some advantages over the Java byte code: it is really
+ an intermediate representation and there are a number of
+ restrictions on how you can emit CIL code that simplify creating
+ better JIT engines.
+
+ For example, on the CIL, the stack is not really an abstraction
+ available for the code generator to use at will. Rather, it is a
+ way of creating a postfix representation of the parsed tree. At
+ any given call point or return point, the contents of the stack are
+ expected to contain the same object types independently of how the
+ instruction was reached.
+
+<a name="licensing"></a>
+** Licensing
+
+Q: Will I be able to write proprietary applications that run with
+ Mono?
+
+A: Yes. The licensing scheme is planned to allow proprietary
+ developers to write applications with Mono.
+
+Q: What license or licenses are you using for the Mono Project?
+
+A: The C# Compiler is released under the terms of the <a
+ href="http://www.opensource.org/licenses/gpl-license.html">GNU GPL</a>. The runtime
+ libraries are under the <a
+ href="http://www.opensource.org/licenses/lgpl-license.html">GNU
+ Library GPL</a>. And the class libraries are released
+ under the terms of the <a
+ href="http://www.opensource.org/licenses/mit-license.html">MIT X11</a>
+ license.
+
+Q: I would like to contribute code to Mono under a particular
+ license. What licenses will you accept?
+
+A: We will have to evaluate the licenses for compatibility first,
+ but as a general rule, we will accept the code under the same
+ terms of the "container" module.
+
+<a name="patents></a>
+** Patents
+
+Q: Could patents be used to completely disable Mono (either submarine
+ patents filed now, or changes made by Microsoft specifically to
+ create patent problems)?
+
+A: No. First, its basic functional capabilities have pre-existed too
+ long to be held up by patents. The basic components of Mono are
+ technologically equivalent to Sun's Java technology, which has been
+ around for years. Mono will also implement multi-language and
+ multi-architecture support, but there are previous technologies
+ such as UCSD p-code and ANDF that also support multiple languages
+ using a common intermediate language. The libraries are similar
+ to other language's libraries, so again, they're too similar to
+ be patentable in large measure.
+
+ However, if Microsoft does patent some technology, then our plan is
+ to either (1) work around it, (2) chop out patented pieces, (3)
+ find prior art that would render the patent useless.
+
+ Not providing a patented capability would weaken the
+ interoperability, but it would still provide the free software /
+ open source software community with good development tools, which
+ is the primary reason for developing Mono.
+
+<a name="etc"></a> **
+Miscellaneous Questions
+
+Q: You say that the CLI allows multiple languages to execute on the
+ same environment. Isn't this the purpose of CORBA?
+
+A: The key difference between CORBA (and COM) and the CLI is that the
+ CLI allows "data-level interoperability" because every
+ language/component uses the same data layout and memory management.
+
+ This means you can operate directly upon the datatypes that someone
+ else provides, without having to go via their interfaces. It also
+ means you don't have to "marshall" (convert) parameters (data
+ layouts are the same, so you can just pass components directly) and
+ you don't have to worry about memory managment, because all
+ languages/components share the same garbage collector and address
+ space. This means much less copying and no need for reference
+ counting.
+
+Q: Will you support COM?
+
+A: The runtime will support XPCOM on Unix systems and COM on Windows.
+ Most of the code for dynamic trampolines exists already.
+
+Q: Will Ximian offer certifications on Mono or related technologies?.
+
+A: It's possible. But there is no plan about this. So the short answer is no.
+
diff --git a/doc/gcc-frontend b/doc/gcc-frontend
new file mode 100644
index 00000000000..2b15346db69
--- /dev/null
+++ b/doc/gcc-frontend
@@ -0,0 +1,9 @@
+* The GCC front-end
+
+ The GCC front-end will accept input in a binary file with
+ codes in the Common Intermediate Language (CIL), and generate
+ native code.
+
+ This will allow pre-compilation and full optimization to take
+ place before a program is executed.
+
diff --git a/doc/ideas b/doc/ideas
new file mode 100644
index 00000000000..0a97cdcc4d2
--- /dev/null
+++ b/doc/ideas
@@ -0,0 +1,112 @@
+* Ideas
+
+ There are many pending classes that need to be implemented. Those have
+ the highest impact in the Mono project: the sooner they are done,
+ the sooner we can start using this platform to create new and
+ exciting applications.
+
+ That being said, if you are not very excited about working on class
+ libraries, here is a list of other related projects or tools that might
+ be useful to the Mono project.
+
+ Here are a few ideas of tools, classes and projects that you
+ could start. More are forthcoming.
+
+<a name="runtime">
+** Runtime
+
+ We need a verifier that can be run on an executable (assembly)
+ and tells whether the metadata for the executable is correct
+ or not. It should report any anomalies.
+
+ For a list of anomalies in assemblies, check the various assertions
+ that are described on the ECMA documentation.
+
+ This will help test our generated executables and can be also
+ used as an external verifier.
+
+<a name="classes">
+** Classes
+
+ <ul>
+TODO=jxta,The JXTA Peer to Peer foundation
+ * Implement a JXTA protocol implementation:
+ <a href="http://www.jxta.org">http://www.jxta.org</a>
+
+TODO=camel,Mail API
+ * Implement a Mail API, similar to Camel or JavaMail (Camel has
+ significant architecture features that are required on a real
+ mailer).
+
+ You can check the current C
+ <a href="http://cvs.gnome.org/bonsai/rview.cgi?dir=evolution%2Fcamel">
+ Camel implementation</a>.
+
+ Such an implementation could be used both with
+ Microsoft .NET and Mono.
+
+TODO=multimedia
+ * Interfacing to Multimedia systems. You might want
+ to look into the Quicktime API. I know <a
+ href="mailto:vladimir@ximian.com">Vladimir</a> has
+ researched the problem before
+
+ </ul>
+
+<a name="projects">
+** Projects
+
+ <ul>
+TODO=xmlStorage,
+ * Implement an xmlStorageSystem for the CLI:
+ <a href="http://www.soapware.org/xmlStorageSystem">
+ http://www.soapware.org/xmlStorageSystem</a>
+
+TODO=guavac,Java compiler for .NET
+ * You could take one of the existing Java compilers
+ (Guavac comes to mind as it is so nice) and modify
+ it to generate .NET code rather than JVM byte
+ codes.
+
+ This should be a pretty straightforward task.
+ Guavac has the advantage of being written in C++ and
+ it could be compiled with the Microsoft Managed C++
+ compiler and produce a .NET executable with it.
+
+TODO=CORBA,CORBA implementation
+ * Build a CORBA interoperability engine for the CLR.
+ You do not need to do all of the work, just talking
+ the protocol will get us a long way (<a
+ href="http://www.omg.org">The OMG site</a> has the
+ CORBA specs).
+
+ Get in touch with David Taylor (dtaylo11 at bigpond
+ dot net dot au) as he has been working on this
+ project.
+
+TODO=Bonobo,Bonobo for Mono
+ * Once CORBA is done, implement the Bonobo interfaces
+ to allow people to use Bonobo components in Mono and
+ Mono components with Bonobo. The best of both worlds!
+
+TODO=moniker,Object Naming System with Monikers
+ * A naming space for Mono. An object naming space is
+ a very powerful tool. Bonobo implements a moniker
+ system that is more powerful than the original
+ moniker concept that was pioneered by COM/OLE in the
+ Microsoft world.
+
+ Our implementation builds on a concept, and we have
+ made it simpler, more powerful, more extensible and
+ a much better mechanism than the equivalent monikers
+ on Windows.
+
+ Implementing Mono monikers would benefit both
+ Windows users using .NET and Mono users on Unix and
+ Windows.
+
+ Here is <a
+ href="http://primates.ximian.com/~miguel/monikers.html">an
+ overview of the moniker system</a> in Bonobo.
+
+ </ul>
diff --git a/doc/index b/doc/index
new file mode 100644
index 00000000000..e3409bd1d4c
--- /dev/null
+++ b/doc/index
@@ -0,0 +1,1016 @@
+<table>
+ <tr>
+ <td>
+ <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.
+
+ Mono includes: <a href="c-sharp.html">a compiler</a> for the
+ C# language, a <a href="runtime.html">runtime</a> for the
+ Common Language Infrastructure and a set of <a
+ href="class-library.html">class libraries</a>.
+
+ You can read our <a href="rationale.html">rationale</a> for
+ this project. If you have questions about the project, please
+ read our list of <a href="faq.html">Frequently Asked
+ Questions</a> or <a href="mailto:mono-list@ximian.com">contact us.</a>
+
+ You might also want to <a href="download.html">Download the
+ source</a> for our work so far. Grab a <a
+ href="snapshots">snapshot</a> of our current work, or <a
+ href="http://cvs.hispalinux.es/cgi-bin/cvsweb/?hidenonreadable=1&f=u&logsort=date&sortby=file&hideattic=1&cvsroot=Mono">browse
+ the sources</a>
+
+ You might want to <a
+ href="mailing-lists.html">subscribe</a> to our mono-list
+ and mono-announce-list
+
+ You can contact the team at: <a
+ href="mailto:mono-list@ximian.com">mono-list@ximian.com</a>
+ </td>
+ <td>
+ <table border=1 bgcolor>
+ <tr>
+ </tr>
+ <tr>
+ <td>
+ <b><a href="c-sharp.html">C# Compiler</a></b>
+ </td>
+ <td>
+ <b>Self hosting on Linux</b><br>
+ Self hosting on .NET.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>JIT</b>
+ </td>
+ <td>
+ Linux/x86 working.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>Interpreter</b>
+ </td>
+ <td>
+ Working:<br>
+ Linux/x86, Linux/PPC<br>
+ In progress: StrongARM, SPARC.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a href="class-status.html">Classes</a></b>
+ </td>
+ <td>
+ Corlib is self hosting.
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+** Apr 24, 2002
+
+ SharpDevelop 0.88a <a href="http://www.icsharpcode.net/OpenSource/SD">is out!</a>
+
+ Congratulations to the developers behind SharpDevelop for
+ their new release.
+
+** Apr 20, 2002
+
+ Some updates from the hacking lines:
+
+ <b>The web:</b> Patrik Torstensson last week contributed the
+ http runtime support and started work on thread pools. This
+ is part of the ASP.NET support.
+
+ <b>Docs:</b> John Barnette, John Sohn and Adam Treat have been
+ hacking on MonoDoc.
+
+ <b>ADO.NET:</b> Daniel Morgan and Rodrigo Moya have been
+ working on the <a href="ado-net">ADO.NET</a> support, and got
+ the first signs of life this week (we can connect, insert
+ rows; do transactions: commit/rollback; SQL errors and
+ exceptions work). Check <a
+ href="mailing-lists.html">mono-patches</a> for all the
+ goodies.
+
+ <b>Optimizations:</b> A number of optimizations in the runtime
+ made the compiler twice as fast this week:
+
+ Early this week Patrik started the string
+ rewrite in the runtime. Today Dietmar finished the
+ constructors and deployed the new layout.
+
+ Paolo got the JIT engine to generate profiles, which were in
+ turn used to find hot spots in Reflection, which he improved.
+
+ Daniel Lewis (of Regex fame) noticed the performance issues
+ with our current array layout, and contributed a new array
+ representation.
+
+ At the same time Dietmar started the the JIT inline code and
+ implemented constant propagation. These two optimizations
+ together are very powerful.
+
+ <b>Bug fixing:</b> And of course everyone has been helping out
+ with the bug fixing (Duncan, Gonzalo, Jonathan, Miguel, Nick,
+ Ravi, Sergey)
+
+
+** Apr 18, 2002
+
+ Dietmar's inlining for the JIT engine just landed into
+ CVS. This is only a first cut and more improvements will come later.
+
+ Patrik, Paolo, Dietmar and Gonzalo have been busy optimizing
+ our class libraries and runtime engine to become faster. Many changes
+ on CVS as well.
+
+** Apr 11, 2002
+
+ Gtk# 0.1 "ButtonHook" has been <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2002-April/000048.html">released</a>
+
+ Binaries for the Mono Regression Test Suite are <a
+ href="archive/mono-tests.tar.gz">available</a> for
+ people porting the Mono Runtime to new platforms.
+
+** Apr 6, 2002
+
+ <a href="http://www.dotnetremoting.cc/book/AdvancedDotNetRemoting.asp">
+ Advanced .NET Remoting</a> from Ingo Rammer is now available. Ingo
+ helped us to implement the proxy support and the book is a valuable
+ resource for anyone interested in remoting.
+
+** Apr 5, 2002
+
+ Transparent proxy support has been finished, congrats to
+ Dietmar. Our JIT engine on CVS contains the implementation.
+ This should enable people to test the remoting framework on
+ Mono.
+
+** Mar 28, 2002
+
+ Debugging information is now generated by the compiler thanks
+ to Martin's work. The resulting dwarf file can be used to
+ single step C# code in GDB. A document will be shortly published with
+ the details.
+
+** Mar 27, 2002
+
+ <b>Mono 0.10 is out!</b> The self hosting release of Mono has
+ been released.
+
+ A new version of the runtime, compiler and class libraries has
+ been packaged for your download pleasure. Binaries are
+ included. The <a href="archive/mono-0.10">Release Notes</a>
+ are available.
+
+ You can get it <a
+ href="download.html#mar-27">Here</a> (quick links: <a
+ href="archive/mono-0.10.tar.gz">runtime</a> and <a
+ href="archive/mcs-0.10.tar.gz">compiler/classes</a>).
+
+** Mar 26, 2002
+
+ Paolo finally fixed the last bug in the JITer that stopped
+ us from using it to run the Mono C# compiler. Goodies are on
+ CVS.
+
+ <a href="http://gtk-sharp.sourceforge.net">Gtk#</a> runs <a
+ href="http://gtk-sharp.sourceforge.net/gtk-hello-world.png">Hello
+ World</a>. Mike posted some <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2002-March/000034.html">details.</a>
+
+
+** Mar 19, 2002
+
+ Martin has been working on our debugging infrastructure, both
+ on the JIT side of things (adding dward support) as well as on
+ the class libraries (so that MCS can start generating
+ debugging information).
+
+ Jason and Kral keep working on the System.Xml namespace,
+ allowing Mike to move more to self-hosting his Gtk# code.
+
+ The System.Web classes are now part of the build (and they are
+ also part of the class status now). Ajay contributed a large
+ chunk of code to the System.Xml.Schema namespace
+
+ Dan (of regex fame) has been working on internal calls
+ support: moving more code from the old monowrapper to become
+ internal calls.
+
+ Paolo and Dietmar are working steadily on our runtime
+ environment, fixing bugs, adding missing features and allowing
+ us to run the compiler on Linux.
+
+ Remember to post your bug reports.
+
+ The nice class status on the right is brought to you by
+ endless hacking hours from Piers and Nick. These status
+ report pages have been helping us track down various mistakes
+ in our classes (very useful, check it out for yourself)
+
+** Mar 12, 2002
+
+ At midnight, in Italy, Paolo got the Mono C# compiler to self
+ host on Linux, the last bug has been squashed to self
+ hostingness. We have now a fully self hosting compiler in Linux.
+
+ A release will follow up shortly.
+
+** Mar 9, 2002
+
+ Updated the <a href="class-status.html">class status</a>, now
+ it is possible to use the right-side menu to browse a specific
+ assembly.
+
+** Mar 7, 2002
+
+ MCS compiles on Linux!
+
+ Today Paolo got the <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-March/003726.html">MCS
+ compiler compiling itself on Linux</a>
+ completely for the first time! The resulting image still contains
+ some errors, but the whole compiler process goes now. Later in the day
+ and a couple of small optimizations and bug fixes, the compile
+ speed was improved in 400%
+
+ We are very close to have a complete self hosting environment now.
+
+ Mono is temporarly using the Bohem GC garbage collector while
+ we deploy the more advanced ORP one.
+
+** Mar 5, 2002
+
+ The CVS repository <a href="http://cvs.hispalinux.es/cgi-bin/cvsweb/?hidenonreadable=1&f=u&logsort=date&sortby=file&hideattic=1&cvsroot=Mono">can be browsed</a>
+
+ Jason has got an incredible amount of work on the Xml
+ classes during the weekend, and Gaurav is very close to have
+ the complete System.Web.UI.WebControls namespace implemented.
+
+ Martin and Duco have been killing bugs by using the recently
+ revamped regression test suite.
+
+ Piers has updated our <a href="class-status.html">class
+ status</a> page again, with even more information available.
+
+ The C# compiler has full constant folding implemented now and Ravi
+ killed bugs of bugs in the <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FClass+Libraries&product=Mono%2FMCS&product=Mono%2FRuntime&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&order=%27Importance%27&form_name=query">Mono Bug List</a>
+
+** Mar 1, 2002
+
+ RPMs of Mono 0.9 are available at <a href="http://mono.baselabs.org/#download">mono.baselabs.com</a>
+
+** Feb 28, 2002
+
+ <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-February/003464.html">Christophe</a>
+ has setup his <a href="http://mono.baselabs.org">First Steps in Mono</a> web site, which
+ shows you a step-by-step process on getting Mono running on your system.
+
+ RPMs of Mono 0.9 are available at <a href="http://mono.baselabs.org/index.php/software/">mono.baselabs.org</a>
+
+** Feb 27, 2002
+
+ New <a href="class-status.html">class status</a> engine that
+ provides detailed information about missing functionality in
+ our class libraries. Nick built the cormissing tool and Piers
+ did the XSLT and DHTML magic.
+
+ More compiler progress on Linux: our support runtime now
+ enables the compiler to compile `MIS' on Linux (MIS being
+ Dick's Mono sample HTTP server ;-)
+
+** Feb 26, 2002
+
+ Paolo posted a list of <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-February/003266.html">ways
+ you can help</a> if you do not have Windows right now. Sergey followed up with
+ <a href="http://lists.ximian.com/archives/public/mono-list/2002-February/003268.html">his</a>
+ suggestions.
+
+** Feb 25, 2002
+
+ StrongARM port from Sergey Chaban has been checked into CVS.
+
+** Feb 24, 2002
+
+ SPARC: 44 out of 74 tests pass now (Jeff)
+
+ Power PC: delegates are working now (Radek)
+
+** Feb 22, 2002
+
+ <b>Mono 0.9 has been released!</b>
+
+ A new version of the runtime, compiler and class libraries has
+ been packaged for your download pleasure. The <a
+ href="archive/mono-0.9">Release Notes</a>
+
+ You can get it <a
+ href="download.html#feb-22">Here</a> (quick links: <a
+ href="archive/mono-0.9.tar.gz">runtime</a> and <a
+ href="archive/mcs-0.9.tar.gz">compiler/classes</a>).
+
+** Feb 21, 2002
+
+ Paolo got our compiler natively to compile 117 of our tests.
+ Self hosting is closer every day.
+
+ Unsafe support is finished in the C# compiler.
+
+** Feb 20, 2002
+
+ Gaurav got DataGrid and DataGridItemCollection done.
+
+ C# compiler: Unsafe support is mostly complete (only stackalloc is missing).
+
+ New easy to run scripts for compiling Mono on Unix and Windows
+ is <a href="download.html">available</a>. We can now easily compile
+ Mono on Windows and Linux. If you had trouble before, use the
+ above scripts which will get the setup right for you.
+
+ There are now three machines that can provide AnonCVS, just
+ use anoncvs.go-mono.com as the hostname for your CVSROOT and
+ you will get one of the machines.
+
+** Feb 19, 2002
+
+ Do you want to see what <a href="http://people.debian.org/~lupus/mono/">Mono Looks Like?</a>
+
+** Feb 18, 2002
+
+ Application Domains now support the two LoaderOptimization
+ modes: share code or do not share code, and you can control
+ this with the --share-code command line option.
+
+ Paolo has now 100+ test cases run on Linux now with our class
+ libraries.
+
+ PowerPC and SPARC ports are moving along (Radek and Jeff)
+
+** Feb 13, 2002
+
+ Excellent news since the 11th, here is a quick rundown:
+
+ AppDomains have been deployed (Dietmar). Socket work is done
+ (Dick). Corlib compiled with no refs to mscorlib (Dan). New
+ comprehensive tests for colib bits (David). Nick is driving the
+ regression test suite efforts and class library completeness.
+ New System.Data work (Chris). Bug fixes (Paolo, Duncan, Ravi, Miguel)
+
+ Miguel is off to the <a
+ href="http://www.fosdem.org">FOSDEM</a> conference in Brussels.
+
+** Feb 11, 2002
+
+ <b>Mono 0.8 has been released!</b>
+
+ A new version of the runtime, compiler and class libraries has
+ been packaged for your download pleasure.
+
+ You can get it <a
+ href="download.html#feb-11">Here</a> (quick links: <a
+ href="archive/mono-0.8.tar.gz">runtime</a> and <a
+ href="archive/mcs-0.8.tar.gz">compiler/classes</a>)
+
+** Feb 11, 2002
+
+ We would like to welcome all the new developers that have
+ joined the project in the last couple of days. The classes
+ are rapidly moving.
+
+ An explanation of the relationship between <a
+ href="http://mail.gnome.org/archives/gnome-hackers/2002-February/msg00031.html">GNOME
+ and Mono</a>.
+
+ Nick is still leading our test suite platform. I can not
+ stress how important it is to have a good regression test suite
+ for our platform, as buggy class libraries are what are
+ stopping the compiler from running completely on Linux.
+
+ We are of course psyched to see Mono run on
+ non-Linux systems. Work is moving on native code generation
+ for StrongARM, PowerPC, and SPARC as well as porting Mono to
+ other systems.
+
+ There are a couple of debates on the Mono list on implementing
+ a set of web server classes for <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-February/002911.html">enabling
+ ASP.NET</a> on Mono.
+
+ Paolo also <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-February/002944.html">
+ posted a list of pending tasks</a> to enable the compiler to run on Linux
+
+** Feb 10, 2002
+
+ Mike Kestner has posted an <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2002-February/000024.html">Update
+ on his Gtk#</a> activities.
+
+** Feb 4, 2002
+
+ Adam has done <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-February/002808.html">Qt
+ bindings</a> for .NET. Adam is cool.
+
+** Jan 29, 2002
+
+ Dan Lewis has contributed a major missing set of classes to
+ Mono: <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-January/002745.html">
+ System.Text.RegularExpressions</a>.
+
+ This is a fully .NET compatible implementation of the .NET regular expressions,
+ fully Unicode aware. This contribution is very appreciated, as implementing this
+ was not entirely trivial (supporting Unicode, plus a regex engine which is a super
+ set of the Perl regex engine).
+
+** Jan 28, 2002
+
+ The Mono contributors have relicensed the Class Libraries under
+ the terms of the
+ <a href="http://www.opensource.org/licenses/mit-license.html">MIT X11</a> license.
+
+ This license is an Open Source license, and is used by other projects
+ (most notably, the XFree86 project).
+
+ The runtime (JIT, metadata library, interpreter) remains under
+ the LGPL and the C# compiler remains under the GPL.
+
+ Our <a
+ href="http://www.ximian.com/about_us/press_center/press_releases/mono_partners.html">Press
+ Release</a>
+
+ Press coverage: <a
+ href="http://news.com.com/2100-1001-823734.html">CNet</a>, <a
+ href="http://www.wired.com/news/technology/0,1282,50037-2,00.html">Wired</a>,
+ <a href="http://www.infoworld.com/articles/hn/xml/02/01/28/020128hnopennet.xml">InfoWorld</a>,
+ <a href="http://www.newsforge.com/article.pl?sid=02/01/27/2232231">NewsForge</a>.
+
+** Jan 23, 2002
+
+ New mailing list: <a href="mailto:mono-patches-request@ximian.com">mono-patches@ximian.com</a>.
+ This mailing list will receive automatically the patches that are submitted
+ to the Mono CVS to any of its modules.
+
+ This allows anyone who wants to participate in the peer-review of the
+ code submitted to CVS to receive patches on e-mail. It should also
+ expose to everyone the changes that are being done by the team every day.
+
+** Jan 21, 2002
+
+ Dick has got a simple web server running with Mono (`MIS: Mono
+ Internet Server') that is mostly used to test our IO layer, a
+ <a href="http://primates.ximian.com/~miguel/dick-mis-server.png">screenshot</a>
+
+ Paolo and Dietmar are busy making our runtime self sufficient on
+ non-Windows platforms.
+
+ C# compiler front: A lot of focus in the past weeks after
+ the C# became self hosting has been in making the compiler a useful
+ tool for development: improve error handling, provide better error
+ reports, fixing all known bugs, and finally profiling of the compiler
+ has begun.
+
+** Jan 8, 2002
+
+ Our compiler has been self-supporting since January 3rd. In
+ the meantime, we have been busy working on making it run on
+ Linux. Today Paolo got more work done on Reflection.Emit and
+ the compiler compiled `console.cs' (a sample Mono program) on
+ Linux.
+
+** Jan 4, 2002
+
+ Dietmar landed the Unicode support patch. Class libraries and
+ runtimes are now fully Unicode aware. The details are <a href=
+ "http://lists.ximian.com/archives/public/mono-list/2002-January/002409.html">
+ here</a>
+
+ Last minute breaking news: Paolo got our compiler in Linux to
+ compile fib.cs, patches are comming tomorrow once we have
+ ChangeLog entries.
+
+** Jan 4, 2002
+
+ Mike Kestner posted an update on Gtk# <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2002-January/000021.html"><i>New
+ year, new direction</i></a>.
+
+ Gtk# will be our foundation on which we will be implementing
+ System.Windows.Forms.
+
+** Jan 3, 2002
+
+ Mono C# compiler becomes self-sufficient. We can now continue
+ development of the compiler with itself.
+
+ Work on the class libraries is still underway for having a full
+ self hosting system. We hope to achieve our goal of self-hosting
+ on Linux before the end of the month.
+
+ Join the fun by downloading either tonight's <a
+ href="snapshots">snapshot</a> or getting your sources from our
+ <a href="anoncvs.html">Anonymous CVS server</a>.
+
+** Dec 28, 2001
+
+ After a lot of work, the C# compiler can compile itself.
+ There are still errors in the generated image, but they are
+ being fixed quickly.
+
+ We will soon have the first non-Microsoft C# implementation!
+
+** Dec 18, 2001
+
+ JIT: More work on our IO abstraction layer (Dick).
+
+ JIT: exception handling for unmanaged code (Dietmar)
+
+ System.Reflection: Support for PropertyInfo and
+ PropertyBuilder as well as the various queries for MethodBase.
+
+ C#: Pre-processor; Rewrite of MemberLookup which fixed many of
+ the outstanding issues. More bug fixing allows it to compile
+ more programs.
+
+** Dec 14, 2001
+
+ Dietmar has improved the register allocation and now Mono performs
+ two to three times as fast as it did yesterday. Amazing.
+
+ The compiler keeps moving along, explicit interface
+ implementation is there.
+
+** Dec 11, 2001
+
+ The JIT engine can now run all the compiler regression tests as
+ well as assorted other programs, many more opcodes added
+ recently. Currently the JIT engine uses a very simplistic register
+ allocator (just enough to allow us to focus on feature completeness)
+ and that will be the next major task to improve performance and
+ reduce spills and reloads.
+
+ On the C# compiler front: language features are now pretty
+ much complete. The big missing tasks are unsafe code support,
+ visibility, explicit interface implementation plus static flow
+ analysis. There are many small bugs that need to be addressed.
+
+ You can get your copy of the <a href="snapshots">latest Mono</a>
+
+ More work is also required on fixing the foundation class
+ libraries, it is easy to find spots now since Nick got the
+ `make test' going.
+
+** Dec 1, 2001
+
+ AnonCVS access to Mono is here (updated every hour). Thanks
+ to <a href="http://www.hispalinux.es">HispaLinux</a> and Jesus
+ Climent for helping to set this up.
+
+** Nov 30, 2001
+
+ All tests from the mono runtime work with the JIT engine now
+ (Dietmar).
+
+ Recursive enumeration definition in the C# compiler are
+ working now (Ravi).
+
+ More work on the Web classes (Gaurav).
+
+** Nov 28, 2001
+
+ JIT land: Paolo got GDB support into the JIT engine while
+ Dietmar added exceptions support to it.
+
+ The C# compiler supports all array initializations now, and the
+ switch statement as well as fixing many existing bugs. Many
+ new more tests.
+
+ Nick keeps working on improving our class library test suite.
+
+ Dick has almost completed the Mono IO layer.
+
+** Nov 16, 2001
+
+<blockquote>
+ Mike Kestner has posted an <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2001-November/000015.html">update</a>
+ on Gtk# development.
+</blockquote>
+
+** Nov 14, 2001
+
+<blockquote>
+ Paolo today got the Mono C# compiler running <a
+ href="http://lists.ximian.com/archives/public/mono-list/2001-November/001941.html">on
+ Linux</a>. It compiles a sample program and then the sample
+ program is executed.
+
+ Mutator unary operators (++ and --) in the compiler are fully
+ functional, they used to only work on variables, and now they
+ are complete.
+
+ To sum things up: The Mono C# compiler is written in C# and
+ uses the .NET classes to get its work done. To make this work
+ on Linux work has to happen in various fronts:
+<ul>
+ * The C# compiler is being worked on and can compile
+ many programs now (our test suite at this point is
+ made up of 40 tests).
+
+ * The class libraries need to be mature enough to support
+ the compiler, particularly System.Reflection.Emit (which is
+ what Paolo has been working on lately).
+
+ The compiler currently requires 103 classes from the
+ .NET runtime (you can get the list by running: <b>monodis --typeref mcs.exe</b>
+
+ * The interpreter should be mature enough to run the actual
+ compiler byte codes and the corlib bytecodes.
+</ul>
+
+ At the same time, Dietmar is working on the JIT engine which will
+ replace our interpreter in production.
+</blockquote>
+
+** Nov 12, 2001
+
+<blockquote>
+ Dietmar got value types working on the JIT engine. Sean has
+ got assembly loading in the runtime (required for NUnit).
+
+ More progress on enumerations and attributes from Ravi.
+
+ Nick keeps working on improving our class libraries.
+</blockquote>
+
+** Nov 8, 2001
+
+<blockquote>
+ Enumerations, array access and attributes for the C# compiler are into the CVS now.
+
+ Full array support is not complete, but moving along.
+</blockquote>
+
+** Nov 5, 2001
+
+<blockquote>
+ Dietmar's new set of patches to the JIT have 20 out of 33
+ tests running now.
+</blockquote>
+
+** Nov 4, 2001
+
+<blockquote>
+ Mike Kestner, main Gtk# contributor has posted a very interesting <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2001-November/000013.html">
+ update</a> on his work on Gtk#.
+
+ Ravi commited the initial support for Attributes in the
+ compiler.
+
+ Many HTML Controls from Leen checked into CVS.
+
+ Paolo checked in his new System.Reflection and
+ System.Reflection.Emit implementations. He has been working
+ steadily on this huge task for a few weeks now. This is the
+ foundation for the Mono C# compiler, and hence a very
+ important piece of the puzzle.
+</blockquote>
+
+** Nov 3, 2001
+
+<blockquote>
+ Many clean ups have been going into the class library by Nick Drochak.
+
+ Mega patch from Dietmar: he commited the flow analysis code
+ for the JITer.
+
+ A lot of work has been going into the WebControls by Gaurav (4
+ new controls plus improved and bug fixed base classes).
+</blockquote>
+
+** Nov 1, 2001
+
+<blockquote>
+ Ravi commited the caller-side method selection of methods with
+ variable length arguments. Now he depends on Miguel finishing
+ the array handling support.
+</blockquote>
+
+** Oct 27, 2001
+
+<blockquote>
+ Lots of classes for System.Web from Gaurav were commited this
+ morning.
+
+ Some large recent developments:
+
+ The Decimal implementation from Martin Weindel has been
+ partially integrated (we need to put the internalcalls in
+ place now and compile and link the decimal code).
+
+ Derek Holden commited recently the IntegerFormatter code into
+ the CVS, so we got a pretty comprehensive integer formatting
+ engine that we can finally use all over the place.
+
+ Compiler got support for lock as well as assorted bug fixes.
+ Ravi is still working on array support (and then we can
+ optimize foreach for the array case).
+
+ Dietmar is busy working on flow analysis on the JITer, the
+ previous mechanism of generating the forest was wrong. Paolo
+ has been a busy bee reworking the System.Reflection.Emit
+ support code, and we should have some pretty nice stuff next
+ week. Dick on the other hand is still working on the
+ WaitOne/WaitAll emulation code. WaitAll is like select on
+ steroids: it can wait for different kinds of objects: files,
+ mutexes, events and a couple of others.
+
+ Mike Kestner is busy working on Gtk# which is now using the
+ .defs files to quickly wrap the API.
+</blockquote>
+
+** Oct 18, 2001
+
+<blockquote>
+ Reworking expressions to support cleanly indexers and
+ properties. <a href="http://www.nat.org/evolution.php3">11
+ days</a> until Evolution 1.0 ships.
+
+ Ximian users around the world <!--a
+ href="http://www.bez.it/IMAGES/nora.jpg"-->rejoice<!--/a--> with
+ recent C# compiler progress.
+</blockquote>
+
+** Oct 17, 2001
+
+<blockquote>
+ Delegate support has been checked into the compiler
+ (definition and invocation); break/continue implemented.
+</blockquote>
+
+** Oct 15, 2001
+
+<blockquote>
+ JIT engine supports many of the object constructs now (object
+ creation, vtable setup, interface table setup).
+
+ The C# compiler now has almost full property support (only
+ missing bit are pre-post increment/decrement operations),
+ delegates are now created (still missing delegate invocation).
+ try/catch/finally is also supported in the compiler now.
+
+ System.Decimal implementation is in, as well as many crypto
+ classes.
+</blockquote>
+
+** Oct 5, 2001
+
+<blockquote>
+ Sergey has released his first version of the <b>ilasm</b>
+ assembler written in C#. You can get it from his web page:
+ <a
+ href="http://mono.eurosoft.od.ua">http://mono.eurosoft.od.ua</a>.
+
+ The plan is to integrate ildasm into the Mono CVS soon. This
+ component should in theory also be reusable for SharpDevelop
+ eventually.
+</blockquote>
+
+** Oct 4, 2001
+
+<blockquote>
+ Our System.Reflection.Emit implementation created its first
+ executable today. This means that a very simple .NET program
+ that was compiled on Windows was able to generate a .NET program
+ while running on Linux using the Mono runtime.
+
+ The various piece of the puzzle are starting to get together:
+ the compiler can compile simple programs now and we are
+ basically focusing on completeness now.
+</blockquote>
+
+** Sep 28, 2001
+
+<blockquote>
+ <a
+ href="http://www.icsharpcode.net/OpenSource/SD/default.asp">Sharp
+ Develop 0.80</a> was released today.
+</blockquote>
+
+** Sep 26, 2001
+
+<blockquote>
+ More progress: more opcodes are working (Paolo); The compiler
+ runs up to a point in Mint (Paolo); operator overloading works
+ (both unary and binary) all over the place (Miguel); Completed decimal
+ type conversions (Miguel); New build system in place based on
+ Ant (Sean and Sergey); Refactored and documented the
+ internals of the JIT engine (Dietmar); StatementExpressions
+ handled correctly (Miguel).
+</blockquote>
+
+** Sep 21, 2001
+
+<blockquote>
+ A couple of news-worthy items: Dick got the initial thread
+ support into mint; Paolo implemented many new opcodes; Dietmar
+ got long operations and mul/div working on the JITer; Ravi rewrote
+ the Method selector for expressions to be conformant; Miguel
+ got i++ working. All in tonight's snapshot
+</blockquote>
+
+** Sep 19, 2001
+
+<blockquote>
+ Paolo has written a section on <a href="porting.html">Porting
+ Mono</a> to othre architectures.
+</blockquote>
+
+** Sep 18, 2001
+
+<blockquote>
+ <A a href="download.html#sep-18">Mono 0.7</a> has been
+ released (runtime engine, class libraries
+ and C# compiler). Check the <a href="archive/mono-0.7">Mono
+ 0.7 announcement</a> for details
+</blockquote>
+
+** Sep 17, 2001
+
+<blockquote>
+ Mike Kestner's Gtk# (Gtk-sharp) was checked into the CVS
+ repository. Gtk# can run a simple hello world application.
+ The binding is nice, as it maps Gtk+ signals to delegates in
+ C#. You can see the Gtk# Hello World program <a href="src/HelloWorld.cs">here</a>
+
+ Gtk-sharp should be available on the next snapshot set.
+</blockquote>
+
+** Sep 10, 2001
+
+<blockquote>
+ Dietmar checked in his CIL tree/forest regeneration and most
+ importantly, the x86 instruction selector burg grammar.
+</blockquote>
+
+
+** Sep 5, 2001
+
+<blockquote>
+ The MCS compiler <b>can compile the sample Hello World</b>
+ application and generate a Windows/CIL executable that runs!
+
+ This executable runs with the Mono Interpreter of course (see
+ August 28)
+</blockquote>
+
+** Sep 4, 2001
+
+<blockquote>
+ Dietmar checked into CVS the `monoburg' architecture
+ independent instruction selector for the JIT engine.
+</blockquote>
+
+** Aug 28, 2001
+
+<blockquote>
+ <b>.NET Hello World is working under Mono!</b> The latest snapshots
+ will let you run it.
+
+ Hello World consits of 1821 CIL instructions,
+ performs 66 subroutine calls and loads 12 classes from the corlib.dll
+
+ Good work Mono team!
+</blockquote>
+
+** Aug 23, 2001
+
+<blockquote>
+ Lloyd Dupont has announced his OpenGL bindings for C#, they
+ are available here: <a
+ href="http://csgl.sourceforge.net">http://csgl.sourceforge.net</a>
+</blockquote>
+
+** Aug 22, 2001
+
+<blockquote>
+ New version of the Mono Runtime, Compiler and Classes has been
+ <a
+ href="download.html#august-22">released.</a> Check the <a
+ href="archive/mono-0.6">0.6 announcement</a>.
+</blockquote>
+
+** Aug 20, 2001
+
+<blockquote>
+ A new <a href="contributing.html#compile-service">Compilation
+ service</a> has been made available by Derek to allow people
+ without access to the <a
+ href="http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/000/976/msdncompositedoc.xml&frame=true">.NET SDK</a>
+</blockquote>
+
+** Aug 3, 2001
+
+<blockquote>
+ Daily snapshots of mcs and mono are now available, they will
+ run every night at 10pm Boston time.
+</blockquote>
+
+** Jul 29, 2001
+
+<blockquote>
+ Mono Runtime 0.5 has been <a
+ href="download.html#july-29">released.</a> Check the <a
+ href="archive/mono-0.5">release notes</a>
+</blockquote>
+
+** Jul 25, 2001
+
+<blockquote>
+ The slides for <A href="Presentations/O-Reilly">my
+ presentation</a> at <a href="http://www.oreilly.com">O'Reilly
+ Open Source Software Convention</a>
+</blockquote>
+
+** Jul 22, 2001
+
+<blockquote>
+ Another release of the class libraries is out, check the <a
+ href="archive/mcs-22">MCS 22-July Release Notes</a>. You can
+ get the new class libraries from <a
+ href="download.html#july-22">here</a>
+</blockquote>
+
+** Jul 19, 2001
+
+<blockquote>
+ Another release of the class libraries is out, check the <a
+ href="archive/mcs-19">MCS 19-July Release Notes</a>. You can
+ get the new class libraries from <a
+ href="download.html#july-19">here</a>
+</blockquote>
+
+** Jul 17, 2001
+
+<blockquote>
+ Another release of the class libraries is out, check the <a
+ href="archive/mcs-17">MCS 17-July Release Notes</a>. You can
+ get the new class libraries from <a
+ href="download.html#july-17">here</a>
+
+ Do not forget to check out the updated <a href="faq.html">FAQ</a>.
+
+ Got Sean's new <a href="class-status/index.html">Class
+ Status</a> web pages up. These are a lot better than mine, and
+ we are now keeping better track of contributors.
+</blockquote>
+
+** Jul 15, 2001
+
+<blockquote>
+ Another release of Mono is out, check the <a
+ href="archive/mono-0.4">Mono 0.4 Release Notes</a>. Get it <a
+ href="download.html#july-15">here</a>.
+</blockquote>
+
+** Jul 14, 2001
+
+<blockquote>
+ A <a
+ href="http://lists.ximian.com/archives/public/mono-list/2001-July/000399.html">new
+ release</a> of the
+ runtime, compiler and classes has been made. Get it <a href="download.html#july-14">here</a>
+</blockquote>
+
+** Jul 12, 2001
+
+<blockquote>
+ I keep getting questions about my opinion on Passport, even when
+ Mono has <b>nothing</b> to do with it. I finally <a
+ href="passport.html">wrote something.</a>
+</blockquote>
+
+** Jul 9, 2001
+
+<blockquote>
+ Project launched.
+</blockquote>
+
+** O'Reilly
+
+<blockquote>
+ Brian posted a story on <a
+ href="http://www.oreillynet.com/dotnet">O'Reilly Network .NET</a>
+</blockquote>
diff --git a/doc/java b/doc/java
new file mode 100755
index 00000000000..a6cd58f34af
--- /dev/null
+++ b/doc/java
@@ -0,0 +1,52 @@
+* Java
+
+ It would be interesting to support the Java language as part
+ of the Mono project.
+
+ You have to think of Java as various pieces: Java the
+ language and Java the virtual machine.
+
+ It is possible to compile Java to .NET, as shown by the
+ Microsoft J# compiler. We could then allow the migration of
+ Java applications to the Mono runtime.
+
+** The translator.
+
+ It would be interesting to write a semantic translator that
+ converts java byte codes into CIL opcodes. This is possible
+ because the Java byte codes are a subset of the CIL ones.
+
+ A semantic tree needs to be constructed (very much in the
+ spirit of what is done in mono_analize_stack in
+ <tt>mono/mono/jit/jit.c</tt>. Once such a semantic tree is
+ constructed, we could generate the equivalent Java code.
+
+ This has a number of interesting side effects: people can
+ continue to use their existing Java compilers to compile their
+ code, and a simple tool that converts their .class files into
+ a .NET assembly can be used.
+
+** Libraries
+
+ We could translate the GNU Classpath libraries with the above
+ tools to provide the Java runtime required to host into the
+ Mono runtime. Some special treatment would be required for
+ core data types like integers, arrays and strings, and of
+ course reuse where possible existing classes from .NET to make
+ them compatible.
+
+** JILC - Java to IL Compiler
+
+ This is an attempt to make the java bytecode available for the
+ .NET environment.
+
+ The project attempts to generate the IL code / bytecode from the
+ compiled java class files. It has reached the stage of code-generation.
+ The issues that needs to be addressed is the mapping of java objects
+ to the IL objects, eg: java.lang.String to System.String.
+
+ Gaurav Vaish and Abhaya Agarwal are currently leading this project.
+ The project is currently hosted at <a href="http://sourceforge.net/projects/jilc">SourceForge.Net</a>.
+ The official home page of the project is
+ <a href="http://jilc.sourceforge.net">http://jilc.sourceforge.net</a>.
+
diff --git a/doc/jit-debug b/doc/jit-debug
new file mode 100644
index 00000000000..867738101ae
--- /dev/null
+++ b/doc/jit-debug
@@ -0,0 +1,181 @@
+* How to debug your C# application with the JIT engine
+
+ To debug a C# application you need to run the JIT in your debugger.
+
+ Before you can do anything useful in a debugger, you need a symbol
+ file which tells your debugger about functions, types, line numbers
+ and such. Unfortunately, this symbol file needs to be recreated each
+ time the JIT compiles a new method since it doesn't know anything
+ about this method (especially not its memory address) before actually
+ compiling it.
+
+ You have two ways of creating a symbol file:
+
+** Letting the JIT dynamically create the symbol file
+
+ This'll give you a symbol file which is suitable for debugging IL byte
+ code - you won't see your C# source code.
+
+ However, this method has the advantage that it works with every assembly,
+ no matter whether it has been compiled with Mono's C# compiler (MCS) or
+ with any other compiler. It's currently the only way to debug
+ <tt>corlib.dll</tt> or any other library which cannot be compiled with
+ our compiler yet.
+
+ All that you need is a dump of the IL bytecode for each assembly (including
+ all assemblies this assembly is referencing). This is done by using the
+ <tt>monodis</tt> utility:
+
+ <pre>
+ monodis /home/export/martin/MONO-LINUX/lib/corlib.dll > corlib.il<br>
+ monodis /home/export/martin/MONO-LINUX/lib/System.dll > System.il<br>
+ monodis /home/export/martin/MONO-LINUX/bin/mcs.exe > mcs.il
+ </pre>
+
+ Make sure that all the .il files have the same name as their corresponding
+ assembly and that they're all created in the current directory.
+
+ The JIT supports two different debugging file formats:
+
+ <ul>
+ * STABS: This is a very simple debugging format, but it may be the only one
+ which is supported on your system. It is limited to source files of no more
+ than 65.535 lines and it's type support is also very limited. You should only
+ use this if your debugger doesn't support DWARF 2.
+
+ To generate STABS output, use the <tt>--stabs</tt> command line argument.
+
+
+ * DWARF 2: The DWARF 2 debugging format is a very powerful debugging format
+ which can handle source files of arbitrary size and has a highly sophisticated
+ type support. It's the recommended format unless you need to use STABS because
+ your debugger doesn't support DWARF 2.
+
+ To generate DWARF 2 output, use the <tt>--dwarf</tt> command line argument.
+ </ul>
+
+
+ You need to regenerate the symbol file each time the JIT compiled a new
+ method and each time you restart the JIT. You cannot reuse your symbol file
+ if you start the JIT a second file, not even if you're running the same
+ application with the same input data a second time.
+
+ Regenerating the symbol file is done by calling the JIT's
+ <tt>mono_debug_make_symbols ()</tt> function from within your debugger and
+ then reloading the symbol files. This function creates a <tt>filename-dwarf.s</tt>
+ (or <tt>filename-stabs.s</tt>) assembler input file in the current directory and
+ an object file in <tt>/tmp/filename.o</tt> - you need to tell your debugger to
+ add this object file as symbol file.
+
+ If you're using the GNU debugger, this is done like this:
+
+ <pre>
+ call mono_debug_make_symbols ()
+ add-symbol-file /tmp/corlib.o
+ add-symbol-file /tmp/mcs.o
+ add-symbol-file /tmp/Mono.CSharp.Debugger.o
+ </pre>
+
+ You can also write a GDB macro like this:
+
+ <pre>
+ define reload
+ call mono_debug_make_symbols ()
+ add-symbol-file /tmp/corlib.o
+ add-symbol-file /tmp/mcs.o
+ add-symbol-file /tmp/Mono.CSharp.Debugger.o
+ end
+ </pre>
+
+ Then you can just say <tt>reload</tt> to have GDB recreate the symbol file.
+
+ There's also an <a href="jit-debug-sample.html">example debugging session</a> using
+ the GNU debugger.
+
+** Using a symbol file which have been created by the Mono C# compiler
+
+ If you compiled your application with Mono's C# compiler (MCS), you can tell it to
+ create a symbol file which is then processed and rewritten by the JIT engine.
+
+ To do this, you must give MCS the <tt>-g</tt> option:
+
+ <pre>
+ $ mcs -g Foo.cs
+ </pre>
+
+ This creates a <tt>Foo-debug.s</tt> assembler input file.
+
+ To use this in the JIT, you must first copy it to the target machine (the machine
+ where you want to run the JIT to debug your application) and run it through the
+ assembler to produce an object file <tt>Foo-debug.o</tt>. This object file must be
+ in the current directory.
+
+ Then start the JIT in your debugger and give it the <tt>--dwarf-plus</tt> command
+ line argument.
+
+ Each time you call <tt>mono_debug_make_symbols ()</tt> from withing your debugger,
+ the JIT will read this <tt>Foo-debug.o</tt>, fix some machine dependent things like
+ memory addresses etc. in it and write it back to disk.
+
+ If you're using the GNU debugger, you'll want to use a macro like this:
+
+ <pre>
+ define relocate
+ call mono_debug_make_symbols ()
+ add-symbol-file /tmp/corlib.o
+ add-symbol-file mcs-debug.o
+ add-symbol-file Mono.CSharp.Debugger-debug.o
+ end
+ </pre>
+
+ If there is no <tt>assembly-debug.o</tt> file, but an <tt>assembly.il</tt> one, the
+ JIT will fall back to normal DWARF 2 (in the example above, <tt>corlib.dll</tt> was
+ compiled with Microsoft's compiler and the JIT is thus using DWARF to debug it).
+
+ This debugging method only works if you compiled your assembly with MCS, but it'll
+ allow you to actually debug your C# source code :-)
+
+ Here's an <a href="jit-debug-sample2.html">example debugging session</a> using
+ the GNU debugger.
+
+** Breakpoints and single stepping
+
+ The JIT has a <tt>--debug</tt> command line argument to insert a breakpoint at the
+ beginning of this method. It takes a <tt>Namespace.Class:Method</tt> argument which
+ is the method. This argument can be given multiple times.
+
+ However, once your application is stopped in GDB you may want to insert a breakpoint
+ the next time the JIT compiles a method. There's a global variable
+ <tt>mono_debug_insert_breakpoint</tt> which you can modify in your debugger.
+
+ If this variable is set to a non-zero value, the JIT's <tt>arch_compile_method</tt>
+ will insert a breakpoint the next time it is called, ie. at the top of the next
+ method it compiles. If this value has a positive value, it acts as a counter and is
+ decremented after inserting the breakpoint - setting it to a negative value will let
+ the JIT insert the breakpoint each time it compiles a new method.
+
+ There's also global variable <tt>mono_debug_last_breakpoint_address</tt> which always
+ contains the address of the last inserted breakpoint. You may manually override this
+ address with a <tt>nop</tt> instruction to delete the breakpoint.
+
+ For instance, I have a GDB macro called <tt>enter</tt> which I use to enter a method
+ rather than stepping over it:
+
+ <pre>
+ define enter
+ set mono_debug_insert_breakpoint = 1
+ continue
+ set *mono_debug_last_breakpoint_address = 0x90
+ relocate
+ frame
+ </pre>
+
+ Btw. speaking of single stepping - you should use your debuggers <tt>next</tt> command,
+ not its <tt>step</tt> command for single stepping unless you compiled the JIT without
+ debugging support. The reason for this is that the JIT creates machine code which contains
+ calls to JIT methods such as <tt>mono_object_new_wrapper</tt> at places where you don't
+ expect them - so unless the JIT is compiled at least without line numbers, your debugger
+ will enter such methods if you use <tt>step</tt> rather than <tt>next</tt>.
+
+
+
diff --git a/doc/jit-debug-sample b/doc/jit-debug-sample
new file mode 100644
index 00000000000..a0c5d2d8b48
--- /dev/null
+++ b/doc/jit-debug-sample
@@ -0,0 +1,86 @@
+* A debugging session using a dynamically generated symbol file.
+
+ Let's assume we have the following C# application which we want to debug:
+
+ <pre>
+ using System;
+
+ public class Foo
+ {
+ public struct MyStruct {
+ int a;
+ long b;
+ double c;
+ }
+
+ public static void Main ()
+ {
+ Int32 value = 5;
+ long test = 512;
+
+ MyStruct my_struct;
+ my_struct.a = 5;
+ my_struct.b = test;
+ my_struct.c = 23323.5235;
+ }
+ }
+ </pre>
+
+ First of all, we need to compile it and create the .il files:
+
+ <pre>
+ $ mcs ./Foo.cs
+ $ monodis /home/export/martin/MONO-LINUX/lib/corlib.dll > corlib.il
+ $ monodis Foo.exe > Foo.il
+ </pre>
+
+ Now we can start the JIT in the debugger:
+
+ <pre>
+ $ gdb ~/monocvs/mono/mono/jit/mono
+ (gdb) r --dwarf --debug Foo:Main ./Foo.exe
+ Starting program: /home/martin/monocvs/mono/mono/jit/mono --dwarf --debug Foo:Main ./Foo.exe
+ 0x081e8911 in ?? ()
+ (gdb) call mono_debug_make_symbols ()
+ (gdb) add-symbol-file /tmp/Foo.o
+ Reading symbols from /tmp/Foo.o...done.
+ Current language: auto; currently c++
+ (gdb) frame
+ #0 Foo.Main () at Foo.il:26
+ 26 // method line 2
+ (gdb) n
+ Foo.Main () at Foo.il:38
+ 38 IL_0000: ldc.i4.5
+ (gdb) list
+ 33 .maxstack 2
+ 34 .locals (
+ 35 int32 V_0,
+ 36 int64 V_1,
+ 37 valuetype MyStruct V_2)
+ 38 IL_0000: ldc.i4.5
+ 39 IL_0001: stloc.0
+ 40 IL_0002: ldc.i4 512
+ 41 IL_0007: conv.i8
+ 42 IL_0008: stloc.1
+ 43 IL_0009: ldloca.s 2
+ 44 IL_000b: ldc.i4.5
+ 45 IL_000c: stfld int32 .MyStruct::a
+ 46 IL_0011: ldloca.s 2
+ 47 IL_0013: ldloc.1
+ 48 IL_0014: stfld int64 .MyStruct::b
+ 49 IL_0019: ldloca.s 2
+ 50 IL_001b: ldc.r8 23323.5
+ 51 IL_0024: stfld float64 .MyStruct::c
+ 52 IL_0029: ret
+ (gdb) until 52
+ Foo.Main () at Foo.il:53
+ 53 }
+ (gdb) info locals
+ V_0 = 5
+ V_1 = 512
+ V_2 = {a = 5, b = 512, c = 23323.523499999999}
+ </pre>
+
+ As you see in this example, you need to know IL code to use this debugging method - but
+ it may be the only way to debug a library.
+
diff --git a/doc/jit-debug-sample2 b/doc/jit-debug-sample2
new file mode 100644
index 00000000000..ae75ceed591
--- /dev/null
+++ b/doc/jit-debug-sample2
@@ -0,0 +1,70 @@
+* A debugging session using a symbol file which has been created by MCS.
+
+ Let's assume we have the following C# application which we want to debug:
+
+ <pre>
+ using System;
+
+ public class Foo
+ {
+ public struct MyStruct {
+ int a;
+ long b;
+ double c;
+ }
+
+ public static void Main ()
+ {
+ Int32 value = 5;
+ long test = 512;
+
+ MyStruct my_struct;
+ my_struct.a = 5;
+ my_struct.b = test;
+ my_struct.c = 23323.5235;
+ }
+ }
+ </pre>
+
+ First of all, we need to compile it with MCS, assemble the generated .s file and
+ create the .il files for all referenced assemblies which were not compiled with MCS:
+
+ <pre>
+ $ mcs -g ./Foo.cs
+ $ as -o Foo-debug.o Foo-debug.s
+ $ monodis /home/export/martin/MONO-LINUX/lib/corlib.dll > corlib.il
+ </pre>
+
+ Now we can start the JIT in the debugger:
+
+ <pre>
+ $ gdb ~/monocvs/mono/mono/jit/mono
+ (gdb) r --dwarf-plus --debug Foo:Main ./Foo.exe
+ Starting program: /home/martin/monocvs/mono/mono/jit/mono --dwarf-plus --debug Foo:Main ./Foo.exe
+ Program received signal SIGTRAP, Trace/breakpoint trap.
+ 0x081e8681 in ?? ()
+ (gdb) call mono_debug_make_symbols ()
+ (gdb) add-symbol-file Foo-debug.o
+ (gdb) add-symbol-file /tmp/corlib.o
+` (gdb) frame
+ #0 Main () at ./Foo.cs:11
+ 11 public static void Main ()
+ (gdb) n
+ Main () at ./Foo.cs:13
+ 13 Int32 value = 5;
+ (gdb)
+ 14 long test = 512;
+ (gdb)
+ 17 my_struct.a = 5;
+ (gdb)
+ 18 my_struct.b = test;
+ (gdb)
+ 19 my_struct.c = 23323.5235;
+ (gdb)
+ 20 }
+ (gdb) info locals
+ value = 5
+ test = 512
+ my_struct = { a = 5, b = 512, c = 23323.5235 }
+ </pre>
+
diff --git a/doc/languages b/doc/languages
new file mode 100755
index 00000000000..209bbdd8626
--- /dev/null
+++ b/doc/languages
@@ -0,0 +1,19 @@
+* Compilers for other languages
+
+ Here are some other free compilers for other languages that
+ target .NET and should work with Mono with no problem:
+
+* Oberon
+
+ This Oberon compiler is written in Oberon.NET (another self
+ hosting compiler):
+
+ <a href="http://www.superin.formativ.net/mono/oberon/oberon.zip">http://www.superin.formativ.net/mono/oberon/oberon.zip</a>
+
+* Component Pascal
+
+ The Component Pascal compiler: <a
+ href="http://www2.fit.qut.edu.au/CompSci/PLAS/ComponentPascal">Home
+ Page</a>, you can <a
+ href="http://www2.fit.qut.edu.au/CompSci/PLAS/ComponentPascal/gpcp1.1.4-netRTM.zip">
+ download it</a>
diff --git a/doc/mailing-lists b/doc/mailing-lists
new file mode 100644
index 00000000000..22a71135ac1
--- /dev/null
+++ b/doc/mailing-lists
@@ -0,0 +1,90 @@
+* Mailing Lists
+
+ There are a number of mailing lists for Mono
+
+ <table>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-list">mono-list</a></b>
+ </td>
+ <td>
+ The general Mono discussion list.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-announce-list">mono-announce-list</a></b>
+ </td>
+ <td>
+ Announcements of Mono developments.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-gc-list">mono-gc-list</a></b>
+ </td>
+ <td>
+ Discussion on the GC system of Mono.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-patches">mono-patches</a></b>
+ </td>
+ <td>
+ Track the CVS activity of Mono on this mailing list (patches are sent to recipients).
+ You can get <a href="http://www.go-mono.com/snapshots">daily snapshots</a> as well.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-cvs-list">mono-cvs-list</a></b>
+ </td>
+ <td>
+ Track the CVS activity of Mono on this mailing list.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-docs-list">mono-docs-list</a></b>
+ </td>
+ <td>
+ Discussion on the documentation of Mono.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-patches">mono-patches</a></b>
+ </td>
+ <td>
+ Track the development of Mono in realtime: receive patches to the Mono repository
+ by email.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs</a></b>
+ </td>
+ <td>
+ This mailing list is used to keep track of the bugs in Mono as reported
+ in <a href="http://bugzilla.ximian.com">Bugzilla.ximian.com</a>
+ </td>
+ </tr>
+ </table>
+
+ Other mailing lists of interest:
+
+ <ul>
+ * <b><a
+ href="http://discuss.develop.com/dotnet.html">Dotnet mailing
+ list at Develop.com:</a></b> The guys at Develop Mentor run
+ this general purpose mailing list.
+ </ul>
+ </ul> \ No newline at end of file
diff --git a/doc/mono-build-w32.sh b/doc/mono-build-w32.sh
new file mode 100755
index 00000000000..a1f141a718d
--- /dev/null
+++ b/doc/mono-build-w32.sh
@@ -0,0 +1,142 @@
+#!/bin/bash
+
+# Script to automate the building of mono and its dependencies on
+# cygwin. Relies on wget being installed (could make it fall back to
+# using lynx, links, w3, curl etc), assumes that gcc, make, tar,
+# automake, etc are already installed too (may be worth testing for
+# all that right at the top and bailing out if missing/too old/too new
+# etc).
+
+
+# See where we are. This will become the top level directory for the
+# installation, unless we are given an alternative location
+here=$1
+test -z "$here" && here=`pwd`
+
+echo "Building Mono and dependencies in $here, installing to $here/install"
+
+PATH=$here/install/bin:$here/install/lib:$PATH
+
+# Check mono out first, so we can run aclocal from inside the mono dir (it
+# needs to see which version of the real aclocal to run)
+test -z "$CVSROOT" && CVSROOT=:pserver:anonymous@anoncvs.go-mono.com:/mono
+export CVSROOT
+
+echo "Updating mono"
+
+# cvs checkout does the same as cvs update, except that it copes with
+# new modules being added
+
+# Older versions of cvs insist on a cvs login for :pserver: methods
+# Make sure cvs is using ssh for :ext: methods
+
+if [ ${CVSROOT:0:5} = ":ext:" ]; then
+ CVS_RSH=ssh
+ export CVS_RSH
+elif [ ${CVSROOT:0:9} = ":pserver:" ]; then
+ if ! grep $CVSROOT ~/.cvspass > /dev/null 2>&1 ; then
+ echo "Logging into CVS server. Anonymous CVS password is probably empty"
+ cvs login || exit -1
+ fi
+fi
+
+cvs checkout mono || exit -1
+
+# Need to install pkgconfig and set ACLOCAL_FLAGS if there is not a
+# pkgconfig installed already. Otherwise set PKG_CONFIG_PATH to the
+# glib we're about to install in $here/install. This script could
+# attempt to be clever and see if glib 2 is already installed, too.
+
+
+# --print-ac-dir was added in 1.2h according to the ChangeLog. This
+# should mean that any automake new enough for us has it.
+
+# This sets ACLOCAL_FLAGS to point to the freshly installed pkgconfig
+# if it doesnt already exist on the system (otherwise auto* breaks if
+# it finds two copies of the m4 macros). The GIMP for Windows
+# pkgconfig sets its prefix based on the location of its binary, so we
+# dont need PKG_CONFIG_PATH (the internal pkgconfig config file
+# $prefix is handled similarly).
+
+function aclocal_scan () {
+ # Quietly ignore the rogue '-I' and other aclocal flags that
+ # aren't actually directories...
+ #
+ # cd into mono/ so that the aclocal wrapper can work out which version
+ # of aclocal to run
+ for i in `(cd mono && aclocal --print-ac-dir)` $ACLOCAL_FLAGS
+ do
+ if [ -f $i/$1 ]; then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+function install_package() {
+ zipfile=$1
+ markerfile=$2
+ name=$3
+
+ echo "Installing $name..."
+ if [ ! -f $here/$zipfile ]; then
+ wget http://www.go-mono.com/archive/$zipfile
+ fi
+
+ # Assume that the package is installed correctly if the marker
+ # file is there
+ if [ ! -f $here/install/$markerfile ]; then
+ (cd $here/install || exit -1; unzip -o $here/$zipfile || exit -1) || exit -1
+ fi
+}
+
+if ! aclocal_scan pkg.m4 ; then
+ ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
+fi
+
+export PATH
+export ACLOCAL_FLAGS
+
+# Grab pkg-config, glib etc
+if [ ! -d $here/install ]; then
+ mkdir $here/install || exit -1
+fi
+
+# Fetch and install pkg-config, glib, iconv, intl
+
+install_package pkgconfig-0.80-tml-20020101.zip bin/pkg-config.exe pkgconfig
+install_package glib-1.3.12-20020101.zip lib/libglib-1.3-12.dll glib
+install_package glib-dev-1.3.12-20020101.zip lib/glib-1.3.lib glib-dev
+install_package libiconv-1.7.zip lib/iconv.dll iconv
+install_package libiconv-dev-1.7.zip lib/iconv.lib iconv-dev
+install_package libintl-0.10.40-20020101.zip lib/libintl-1.dll intl
+install_package libgc-dev.zip lib/gc.dll gc-dev
+
+# Needed to find the libiconv bits
+CPPFLAGS="$CPPFLAGS -I$here/install/include"
+LDFLAGS="$LDFLAGS -L$here/install/lib"
+export CPPFLAGS
+export LDFLAGS
+
+# Make sure we build native w32, not cygwin
+#CC="gcc -mno-cygwin"
+#export CC
+
+# --prefix is used to set the class library dir in mono, and it needs
+# to be in windows-native form. It also needs to have '\' turned into
+# '/' to avoid quoting issues during the build.
+prefix=`cygpath -w $here/install | sed -e 's@\\\\@/@g'`
+
+# Build and install mono
+echo "Building and installing mono"
+
+(cd $here/mono; ./autogen.sh --prefix=$prefix || exit -1; make || exit -1; make install || exit -1) || exit -1
+
+
+echo ""
+echo ""
+echo "All done."
+echo "Add $here/install/bin and $here/install/lib to \$PATH"
+echo "Don't forget to copy the class libraries to $here/install/lib"
+
diff --git a/doc/mono-build.sh b/doc/mono-build.sh
new file mode 100755
index 00000000000..10878bf2780
--- /dev/null
+++ b/doc/mono-build.sh
@@ -0,0 +1,183 @@
+#!/bin/bash
+
+# Script to automate the building of mono and its dependencies.
+# Relies on wget being installed (could make it fall back to using
+# lynx, links, w3, curl etc), assumes that gcc, make, tar, automake,
+# etc are already installed too (may be worth testing for all that
+# right at the top and bailing out if missing/too old/too new etc).
+
+
+# See where we are. This will become the top level directory for the
+# installation, unless we are given an alternative location
+here=$1
+test -z "$here" && here=`pwd`
+
+echo "Building Mono and dependencies in $here, installing to $here/install"
+
+PATH=$here/install/bin:$PATH
+LD_LIBRARY_PATH=$here/install/lib:$LD_LIBRARY_PATH
+
+# Need to install pkgconfig and set ACLOCAL_FLAGS if there is not a
+# pkgconfig installed already. Otherwise set PKG_CONFIG_PATH to the
+# glib we're about to install in $here/install. This script could
+# attempt to be clever and see if glib 2 is already installed, too.
+
+
+# --print-ac-dir was added in 1.2h according to the ChangeLog. This
+# should mean that any automake new enough for us has it.
+
+function aclocal_scan () {
+ # Quietly ignore the rogue '-I' and other aclocal flags that
+ # aren't actually directories...
+ for i in `aclocal --print-ac-dir` $ACLOCAL_FLAGS
+ do
+ if [ -f $i/$1 ]; then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+function pkgconfig_scan () {
+ module=$1
+
+ echo "Finding pkgconfig files for $module..."
+
+ # Should we use locate? or just a list of well-known directories?
+ # locate has the problem of false positives in src dirs
+ for i in /usr/lib/pkgconfig /usr/local/lib/pkgconfig
+ do
+ echo "Looking in $i..."
+ if [ -f $i/${module}.pc ]; then
+ echo $i
+ return
+ fi
+ done
+}
+
+function install_package() {
+ tarfile=$1
+ dirname=$2
+ name=$3
+ configure_options=$4
+
+ echo "Installing $name..."
+ if [ ! -f $here/$tarfile ]; then
+ wget http://www.go-mono.org/archive/$tarfile
+ fi
+
+ # Assume that the package built correctly if the dir is there
+ if [ ! -d $here/$dirname ]; then
+ # Build and install package
+ tar xzf $here/$tarfile || exit -1
+ (cd $here/$dirname; ./configure --prefix=$here/install $configure_options || exit -1; make || exit -1; make install || exit -1)
+ success=$?
+ if [ $success -ne 0 ]; then
+ echo "***** $name build failure. Run rm -rf $here/$dirname to have this script attempt to build $name again next time"
+ exit -1
+ fi
+ fi
+}
+
+if aclocal_scan pkg.m4 ; then
+ install_pkgconfig=no
+else
+ install_pkgconfig=yes
+fi
+
+if aclocal_scan glib-2.0.m4 ; then
+ install_glib=no
+ if [ $install_pkgconfig = "yes" ]; then
+ # We have to tell the newly-installed pkgconfig about the
+ # system-installed glib
+ PKG_CONFIG_PATH=`pkgconfig_scan glib-2.0`:$PKG_CONFIG_PATH
+ fi
+else
+ install_glib=yes
+ PKG_CONFIG_PATH="$here/install/lib/pkgconfig:$PKG_CONFIG_PATH"
+fi
+
+if [ -f /usr/include/gc/gc.h ]; then
+ install_libgc=no
+else
+ install_libgc=yes
+fi
+
+if [ $install_pkgconfig = "yes" -o $install_glib = "yes" ]; then
+ ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
+fi
+
+export PATH
+export LD_LIBRARY_PATH
+export ACLOCAL_FLAGS
+export PKG_CONFIG_PATH
+
+CPPFLAGS="$CPPFLAGS -I$here/install/include"
+LDFLAGS="$LDFLAGS -L$here/install/lib"
+export CPPFLAGS
+export LDFLAGS
+
+# Grab pkg-config-0.8, glib-1.3.12 if necessary
+
+if [ $install_pkgconfig = "yes" ]; then
+ install_package pkgconfig-0.8.0.tar.gz pkgconfig-0.8.0 pkgconfig ""
+else
+ echo "Not installing pkgconfig, you already seem to have it installed"
+fi
+
+if [ $install_glib = "yes" ]; then
+ install_package glib-1.3.13.tar.gz glib-1.3.13 glib ""
+else
+ echo "Not installing glib, you already seem to have it installed"
+fi
+
+if [ $install_libgc = "yes" ]; then
+ LIBS="-ldl" install_package gc6.0.tar.gz gc6.0 libgc "--enable-threads=pthreads"
+ # make install didnt do the headers!
+ mkdir -p $here/install/include/gc
+ cp -r $here/gc6.0/include/* $here/install/include/gc
+else
+ echo "Not installing libgc, you already seem to have it installed"
+fi
+
+# End of build dependencies, now get the latest mono checkout and build that
+
+test -z "$CVSROOT" && CVSROOT=:pserver:anonymous@anoncvs.go-mono.com:/mono
+export CVSROOT
+
+echo "Updating mono"
+
+# cvs checkout does the same as cvs update, except that it copes with
+# new modules being added
+
+# Older versions of cvs insist on a cvs login for :pserver: methods
+# Make sure cvs is using ssh for :ext: methods
+
+if [ ${CVSROOT:0:5} = ":ext:" ]; then
+ CVS_RSH=ssh
+ export CVS_RSH
+elif [ ${CVSROOT:0:9} = ":pserver:" ]; then
+ # Chop off the trailing /mono because cvs 1.11 adds the port number
+ # into the .cvspass line
+ if ! grep ${CVSROOT%:/mono} ~/.cvspass > /dev/null 2>&1 ; then
+ echo "Logging into CVS server. Anonymous CVS password is probably empty"
+ cvs login
+ fi
+fi
+
+cvs checkout mono || exit -1
+
+# Build and install mono
+echo "Building and installing mono"
+
+(cd $here/mono; ./autogen.sh --prefix=$here/install || exit -1; make || exit -1; make install || exit -1) || exit -1
+
+
+echo ""
+echo ""
+echo "All done."
+echo "Add $here/install/bin to \$PATH"
+echo "Add $here/install/lib to \$LD_LIBRARY_PATH"
+echo "Don't forget to copy the class libraries to $here/install/lib"
+
diff --git a/doc/monodoc-xml b/doc/monodoc-xml
new file mode 100644
index 00000000000..e8a5ffe2c71
--- /dev/null
+++ b/doc/monodoc-xml
@@ -0,0 +1,755 @@
+* MonoDoc XML Tag Reference
+
+** Introduction
+
+<em>
+[This documentation is in progress. Comments to
+<a href="mailto:jbarn@httcb.net">jbarn@httcb.net</a> and/or
+<a href="mailto:mono-docs-list@ximian.com">mono-docs-list@ximian.com</a>.]
+</em>
+
+MonoDoc XML, our format for multilingual API documentation stored outside of
+source files, is very similar to the output of Microsoft's csc /doc. Minor
+alterations have been made to ease human parsing and hand-editing, but
+the majority of the tags are identical. In fact, many of the descriptions
+and examples below are taken from the ECMA C# Language Specification with
+little or no alteration.
+
+This document provides a list of all available MonoDoc XML tags, with
+syntax and examples. A complete example can be found in
+<a href="#appendix-a">Appendix A</a>, and both a <a href="#">DTD</a> and
+<a href="#">XSD schema</a> will be available very shortly.
+
+** MonoDoc XML Tags
+
+<dl>
+<dt><code><a href="#c">&lt;c&gt;</a></code></dt>
+<dd>Mark short sections of text as code.</dd>
+
+<dt><code><code><a href="#code">&lt;code&gt;</a></code></dt></code>
+<dd>Mark one or more lines as code or output.</dd>
+
+<dt><code><a href="#doc">&lt;doc&gt;</a></dt></code>
+<dd>Root element of documentation XML.</dd>
+
+<dt><code><a href="#event">&lt;event&gt;</a></dt></code>
+<dd>Describe an event.</dd>
+
+<dt><code><a href="#example">&lt;example&gt;</a></dt></code>
+<dd>An example.</dd>
+
+<dt><code><a href="#exception">&lt;exception&gt;</a></dt></code>
+<dd>Specify an exception a method can throw.</dd>
+
+<dt><code><a href="#field">&lt;field&gt;</a></dt></code>
+<dd>Describe a field.</dd>
+
+<dt><code><a href="#list">&lt;list&gt;</a></dt></code>
+<dd>Create a list or table.</dd>
+
+<dt><code><a href="#method">&lt;method&gt;</a></dt></code>
+<dd>Describe a method.</dd>
+
+<dt><code><a href="#para">&lt;para&gt;</a></dt></code>
+<dd>Allow text to be structured in paragraphs.</dd>
+
+<dt><code><a href="#param">&lt;param&gt;</a></dt></code>
+<dd>Specify a parameter for a method.</dd>
+
+<dt><code><a href="#paramref">&lt;paramref&gt;</a></dt></code>
+<dd>Mark a word as a parameter.</dd>
+
+<dt><code><a href="#permission">&lt;permission&gt;</a></dt></code>
+<dd>Define the access level of a member.</dd>
+
+<dt><code><a href="#property">&lt;property&gt;</a></dt></code>
+<dd>Describe a property.</dd>
+
+<dt><code><a href="#remarks">&lt;remarks&gt;</a></dt></code>
+<dd>Provide verbose information for a type or member.</dd>
+
+<dt><code><a href="#returns">&lt;returns&gt;</a></dt></code>
+<dd>Specify the return value of a method.</dd>
+
+<dt><code><a href="#see">&lt;see&gt;</a></dt></code>
+<dd>Specify a link.</dd>
+
+<dt><code><a href="#seealso">&lt;seealso&gt;</a></dt></code>
+<dd>Specify a 'see also' entry.</dd>
+
+<dt><code><a href="#summary">&lt;summary&gt;</a></dt></code>
+<dd>Provide a brief (usually one sentence) description of a member or type.</dd>
+
+<dt><code><a href="#type">&lt;type&gt;</a></dt></code>
+<dd>Describe a type.</dd>
+</dl>
+
+** Definitions and Examples
+
+*** <a name="c">&lt;c&gt;</a>
+
+This tag can be used to mark short, inline fragments of text that should
+be considered source code or program output. User agents should render
+this tag in a special -- likely monospace -- font. For larger sections,
+use <a href="#code"><code>&lt;code&gt;</code></a>.
+
+**** Syntax
+
+<pre>
+&lt;c&gt;code or output text&lt;/c&gt;
+</pre>
+
+**** Example
+
+<pre>
+&lt;remarks&gt;
+ Class &lt;c&gt;Point&lt;/c&gt; models a point in two-dimensional space.
+&lt;/remarks&gt;
+</pre>
+
+*** <a name="code">&lt;code&gt;</a>
+
+This tag can be used to mark one or more lines of text as source code or
+program output. User agents should render this tag in a special (likely
+monospace) font, and preserve both whitespace and newlines.
+
+**** Syntax
+
+ <code>&lt;code&gt;source or program output&lt;/code&gt;</code>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This method changes the point's location by the given
+ x- and y-offsets.
+ &lt;example lang="C#"&gt;
+ A C# example:
+ &lt;code&gt;
+ Point p = new Point(3, 5);
+ p.Translate(-1, 3);
+ // p == (2, 8);
+ &lt;/code&gt;
+ &lt;/example&gt;
+&lt;/summary&gt;
+</pre>
+
+*** <a name="doc">&lt;doc&gt;</a>
+
+This tag is the root element of the documentation file. It can contain
+any number of &lt;type&gt; elements.
+
+**** Syntax
+
+<code>&lt;doc lang="language" assembly="assembly"&gt;typedocs&lt;/doc&gt;</code>
+
+<blockquote>
+<em>lang="language"</em><br />
+The two-letter ISO code that specifies what language the contained
+documentation is written in.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;doc lang="en"&gt;
+ &lt;type name="Graphics.Point"&gt;
+ &lt;!-- ... --&gt;
+ &lt;/type&gt;
+&lt;/doc&gt;
+</pre>
+
+*** <a name="event">&lt;event&gt;</a>
+
+This tag documents an event.
+
+**** Syntax
+
+<code>&lt;event name="eventname"&gt;documentation&lt;/event&gt;</code>
+
+<blockquote>
+<em>name="eventname"</em><br />
+The name of the event being documented.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;event name="Click"&gt;
+ &lt;summary&gt;
+ Occurs when the control is clicked.
+ &lt;/summary&gt;
+ &lt;data&gt;
+ The event handler receives an argument of type EventArgs
+ containing data related to this event.
+ &lt;/data&gt;
+ &lt;remarks&gt;
+ &lt;para&gt;The ControlStyles.StandardClick style must be set
+ for this event to be raised.&lt;/para&gt;
+ &lt;para&gt;For more information about handling events, see
+ Consuming Events.&lt;/para&gt;
+ &lt;/remarks&gt;
+&lt;/event&gt;
+</pre>
+
+*** <a name="example">&lt;example&gt;</a>
+
+This tag marks a section of text as an example, and optionally specifies
+what programming language <code><a href="#code">&lt;code&gt;</a></code> portions of the example are written in.
+
+**** Syntax
+
+<code><example lang="language">example text and code</example></code>
+
+<blockquote>
+<em>lang="language"</em><br />
+(optional) The name of the programming language <code><a href="#code">&lt;code&gt;</a></code> blocks in this example
+use. This information can be used by user agents to provide
+intelligent access to examples in multiple languages.
+</blockquote>
+
+**** Example
+
+See <code><a href="#code">&lt;code&gt;<a/></code> for an example.
+
+*** <a name="exception">&lt;exception&gt;</a>
+
+This tag provides a way to specify the exceptions a method can throw.
+
+**** Syntax
+
+<code>&lt;exception cref="exception-type"&gt;description&lt;/exception&gt;</code>
+
+<blockquote>
+<em>cref="exception-type"</em><br />
+The name of an exception type.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;exception cref="System.IO.FileNotFoundException"&gt;
+ Thrown when the requested file is not found.
+&lt;/exception&gt;
+</pre>
+
+*** <a name="field">&lt;field&gt;</a>
+
+This tag is used to describe a field.
+
+**** Syntax
+
+<code>&lt;field name="fieldname"&gt;documentation&lt;/field&gt;</code>
+
+<blockquote>
+<em>name="fieldname"</em><br />
+The name of the field being documented.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;field name="x"&gt;
+ &lt;summary&gt;
+ Instance variable &lt;c&gt;x&lt;/c&gt; represents the point's
+ x-coordinate.
+ &lt;/summary&gt;
+&lt;/field&gt;
+</pre>
+
+*** <a name="list">&lt;list&gt;</a>
+
+This tag is used to create a list or table of items. It may contain a
+<code>&lt;listheader&gt;</code> block to define the heading row of either a table or
+definition list. (When defining a table, only an entry for 'term' in the
+heading need be supplied.)
+
+Each item in the list is specified with an <code>&lt;item&gt;</code> block. When creating a
+definition list, both <code>&lt;term&gt;</code> and <code>&ltdescription&gt;</code> must be specified.
+However, for a table, bulleted list, or numbered list, only <code>&lt;description&gt;</code>
+need be specified.
+
+**** Syntax
+
+<pre>
+&lt;list type="bullet" | "number" | "table"&gt;
+ &lt;listheader&gt;
+ &lt;term&gt;term&lt;/term&gt;
+ &lt;description&gt;description&lt;/description&gt;
+ &lt;/listheader&gt;
+ &lt;item&gt;
+ &lt;term&gt;term&lt;/term&gt;
+ &lt;description&gt;description&lt;/description&gt;
+ &lt;/item&gt;
+
+ ...
+
+&lt;/list&gt;
+</pre>
+
+<blockquote>
+<em>term</em><br />
+The term to define, whose definition is in <code>&lt;description&gt;</code>.
+<br /><br />
+<em>description</em><br />
+Either an item in a bullet or numbered list, or the definition of a <code>&lt;term&gt;</code>.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;list type="bullet"&gt;
+ &lt;item&gt;
+ &lt;description&gt;Item 1&lt;/description&gt;
+ &lt;/item&gt;
+ &lt;item&gt;
+ &lt;description&gt;Item 2&lt;/description&gt;
+ &lt;/item&gt;
+&lt;/list&gt;
+</pre>
+
+*** <a name="method">&lt;method&gt;</a>
+
+This tag is the overall containing tag for documenting a method.
+
+**** Syntax
+
+<code>&lt;method name="methodname"&gt;documentation&lt;/method&gt;</code>
+
+**** Example
+
+<pre>
+&lt;method name="op_Equality(Graphics.Point,Graphics.Point)"&gt;
+ &lt;summary&gt;
+ This operator determines whether two points have
+ the same location.
+ &lt;/summary&gt;
+ &lt;param name="p1"&gt;
+ &lt;c&gt;p1&lt;/c&gt; is the first Point to be compared.
+ &lt;/param&gt;
+ &lt;param name="p2"&gt;
+ &lt;c&gt;p2&lt;/c&gt; is the second Point to be compared.
+ &lt;/param&gt;
+ &lt;returns&gt;
+ True if the points have the same location and they
+ have the exact same type; otherwise, false.
+ &lt;/returns&gt;
+ &lt;seealso cref="Equals(System.Object)" /&gt;
+ &lt;seealso cref="op_Inequality(Graphics.Point,Graphics.Point)" /&gt;
+&lt;/method&gt;
+</pre>
+
+*** <a name="para">&lt;para&gt;</a>
+
+
+This tag is for use inside other tags such as <code>&lt;remarks&gt;</code> or <code>&lt;returns&gt;</code>, and
+allows text to be structured into paragraphs.
+
+**** Syntax
+
+<code>&lt;para&gt;text&lt;/para&gt;</code>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ &lt;para&gt;
+ This is the entry point of the &lt;c&gt;Point&lt;/c&gt; class testing
+ program.
+ &lt;/para&gt;
+ &lt;para&gt;
+ This program tests each method and operator, and
+ is intended to be run after any non-trivial maintenance has
+ been performed on the &lt;c&gt;Point&lt;/c&gt; class.
+ &lt;/para&gt;
+&lt;/summary&gt;
+</pre>
+
+*** <a name="param">&lt;param&gt;</a>
+
+This tag is used to describe a parameter for a method, constructor, or
+indexer.
+
+**** Syntax
+
+<code>&lt;param name="name"&gt;description&lt;/param&gt;</code>
+
+<blockquote>
+<em>name</em><br />
+The name of the parameter.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This is the entry point of the &lt;c&gt;Point&lt;/c&gt;
+ class.
+&lt;/summary&gt;
+&lt;param name="xor"&gt;&lt;c&gt;xor&lt;/c&gt; is the new x-coordinate.&lt;/param&gt;
+&lt;param name "yor"&gt;&lt;c&gt;yor&lt;/c&gt; is the new y-coordinate.&lt;/param&gt;
+</pre>
+
+*** <a name="paramref">&lt;paramref&gt;</a>
+
+This tag is used to indicate that a word is a parameter. User agents
+could use this information for special formatting or hyperlink insertion.
+
+**** Syntax
+
+<code>&lt;paramref name="name" /&gt;</code>
+
+<blockquote>
+<em>name</em><br />
+The name of the parameter.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This constructor initializes the new Point to
+ (&lt;paramref name="xor" /&gt;,&lt;paramref name="yor" /&gt;).
+&lt;/summary&gt;
+&lt;param name="xor"&gt;&lt;c&gt;xor&lt;/c&gt; is the new x-coordinate.&lt;/param&gt;
+&lt;param name "yor"&gt;&lt;c&gt;yor&lt;/c&gt; is the new y-coordinate.&lt;/param&gt;
+</pre>
+
+*** <a name="permission">&lt;permission&gt;</a>
+
+This tag allows the security accessibility of a member to be documented.
+
+**** Syntax
+
+<code>&lt;permission cref="member"&gt;description&lt;/permission&gt;</code>
+
+<blockquote>
+<em>cref="member"</em><br />
+The name of a member.</br>
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;permission cref="System.Security.PermissionSet"&gt;
+ Everyone can access this method.
+&lt;/permission&gt;
+</pre>
+
+*** <a name="property">&ltproperty&gt;</a>
+
+This tag is the overall containing tag for documenting a property.
+
+**** Syntax
+
+<code>&lt;property name="propertyname"&gt;documentation&lt;/property&gt;</code>
+
+<blockquote>
+<em>name="propertyname"</em><br />
+The name of the property.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;property name="X"&gt;
+ &lt;summary&gt;
+ Gets or sets the point's x-coordinate.
+ &lt;value&gt;
+ The point's x-coordinate.
+ &lt;/value&gt;
+&lt;/property&gt;
+</pre>
+
+
+*** <a name="remarks">&lt;remarks&gt;</a>
+
+This tag contains extended discussion and information about a member or
+a type. <em>[jbarn: This differs from both the ECMA docs and
+portions of Microsoft's documentation, but seems consistent with both
+common usage, and, more importantly, NDoc convention.]</em>
+
+**** Syntax
+
+<code>&lt;remarks&gt;description&lt;/remarks&gt;</code>
+
+**** Example
+
+<pre>
+&lt;type name="Graphics.Point"&gt;
+ &lt;summary&gt;
+ Models a point in a two-dimensional plane.
+ &lt;/summary&gt;
+ &lt;remarks&gt;
+ Herein I might have an extended discussion of
+ the validity of Cartesian coordinate systems,
+ with examples pro and con, and perhaps
+ some code.
+ &lt;/remarks&gt;
+
+ &lt;!-- ... --&gt;
+&lt;/type&gt;
+</pre>
+
+*** <a name="returns">&lt;returns&gt;</a>
+
+This tag is used to describe the return value of a method.
+
+**** Syntax
+
+<code>&lt;returns&gt;description&lt;/returns&gt;</code>
+
+**** Example
+
+<pre>
+&lt;method name="op_Inequality(Graphics.Point,Graphics.Point)"&gt;
+ &lt;summary&gt;
+ This operator determines whether two points have the
+ same location.
+ &lt;/summary&gt;
+ &lt;param name="p1"&gt;&lt;c&gt;p1&lt;/c&gt; is the first Point to be compared.&lt;/param&gt;
+ &lt;param name="p2"&gt;&lt;c&gt;p2&lt;/c&gt; is the second Point to be compared.&lt;/param&gt;
+ &lt;returns&gt;
+ True if the points do not have the same location and they
+ have the exact same type; otherwise, false.
+ &lt;/returns&gt;
+&lt;/method&gt;
+</pre>
+
+*** <a name="see">&lt;see&gt;</a>
+
+This tag allows a link to be specified within documentation text. (Use
+<code>&lt;seealso&gt;</code> to indicate links that should appear in a 'See Also' section.)
+
+**** Syntax
+
+<code>&lt;see cref="destination" /&gt;</code>
+
+<blockquote>
+<em>cref="destination"</em><br />
+A destination, such as a type or a member of a type.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This method changes the point's location to the given
+ coordinates. This is an asinine way to insert a link,
+ but &lt;see cref="Equals(Object)" /&gt; to understand
+ how points are compared.
+&lt;/summary&gt;
+</pre>
+
+*** <a name="seealso">&lt;seealso&gt;</a>
+
+This tag allows an entry to be generated for the 'See Also' section. (Use
+<code>&lt;see&gt;</code> to specify a link from within text.)
+
+**** Syntax
+
+<code>&lt;seealso cref="destination" /&gt;</code>
+
+<blockquote>
+<em>cref="destination"</em><br />
+A destination, such as a type or a member of a type.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This method determines whether two Points have the
+ same location.
+&lt;/summary&gt;
+&lt;seealso cref="op_Equality(Graphics.Point,Graphics.Point)" /&gt;
+&lt;seealso cref="op_Inequality(Graphics.Point,Graphics.Point" /&gt;
+</pre>
+
+*** <a name="summary">&lt;summary&gt;</a>
+
+This tag contains a short summary of a member or type,
+often one sentence. <em>[jbarn: This differs from both the ECMA docs and
+portions of Microsoft's documentation, but seems consistent with both
+common usage, and, more importantly, NDoc convention.]</em>
+
+**** Syntax
+
+<code>&lt;summary&gt;description&lt;/summary&gt;</code>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This is the entry point of the &lt;c&gt;Point&lt;/c&gt; class testing
+ program.
+&lt;/summary&gt;
+&lt;remarks&gt;
+ This program tests each method an operator, and is intended
+ to be run after any non-trivial maintenance is performed
+ on the &lt;c&gt;Point&lt;/c&gt; class.
+&lt;/remarks&gt;
+</pre>
+
+*** <a name="type">&lt;type&gt;</a>
+
+This tag is the overall containing tag for documenting a type.
+
+**** Syntax
+
+<code>&lttype name="typename" assembly="assemblyname"&gt;documentation&lt;/type&gt;</code>
+
+<blockquote>
+<em>name="typename"</em><br />
+The name of the type being documented.
+<br /><br />
+<em>assembly="assemblyname"</em><br />
+The assembly this type resides in. This attribute is not required for nested types.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;type name="Graphics.Point" assembly="Point"&gt;
+ &lt;summary&gt;
+ Models a point in two-dimensional space.
+ &lt;/summary&gt;
+
+ &lt;!-- members --&gt;
+
+ &lt;field name="x"&gt;
+ &lt;summary&gt;
+ Represents the point's x-coordinate.
+ &lt;/summary&gt;
+ &lt;/field&gt;
+&lt;/type&gt;
+</pre>
+
+** <a name="appendix-a">Appendix A: Complete Example</a>
+
+<em>[jbarn: Please, please, don't take the human-readable portions of
+this example to be good guidelines for writing your own documentation.
+this XML is intended only to show structure.]</em>
+
+<pre>
+&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+&lt;doc lang="en"&gt;
+ &lt;type name="Graphics.Point" assembly="Point"&gt;
+ &lt;summary&gt;
+ Models a point in a two-dimensional plane.
+ &lt;/summary&gt;
+ &lt;remarks&gt;
+ No useful remarks.
+ &lt;/remarks&gt;
+
+ &lt;!-- fields --&gt;
+ &lt;field name="x"&gt;
+ &lt;summary&gt;
+ Instance variable &lt;c&gt;x&lt;/c&gt; represents the point's x-coordinate.
+ &lt;/summary&gt;
+ &lt;/field&gt;
+
+ &lt;field name="y"&gt;
+ &lt;summary&gt;
+ Instance variable &lt;c&gt;y&lt;/c&gt; represents the point's y-coordinate.
+ &lt;/summary&gt;
+ &lt;/field&gt;
+
+ &lt;!-- methods --&gt;
+ &lt;method name="#ctor"&gt;
+ &lt;summary&gt;
+ Initializes the new point to &lt;c&gt;(0,0)&lt;/c&gt;.
+ &lt;/summary&gt;
+ &lt;/method&gt;
+
+ &lt;method name="#ctor(System.Int32,System.Int32)"&gt;
+ &lt;summary&gt;
+ Initializes the new Point to (&lt;paramref name="xor" /&gt;,&lt;paramref name="yor" /&gt;).
+ &lt;/summary&gt;
+ &lt;param name="xor"&gt;&lt;c&gt;xor&lt;/c&gt; is the new x-coordinate.&lt;/param&gt;
+ &lt;param name="yor"&gt;&lt;c&gt;yor&lt;/c&gt; is the new y-coordinate.&lt;/param&gt;
+ &lt;/method&gt;
+
+ &lt;method name="Move(System.Int32,System.Int32)"&gt;
+ &lt;summary&gt;
+ This method changes the point's location to the given coordinates.
+ &lt;/summary&gt;
+ &lt;param name="xor"&gt;&lt;c&gt;xor&lt;/c&gt; is the new x-coordinate.&lt;/param&gt;
+ &lt;param name="yor"&gt;&lt;c&gt;yor&lt;/c&gt; is the new y-coordinate.&lt;/param&gt;
+ &lt;seealso cref="Translate(System.Int32,System.Int32)" /&gt;
+ &lt;/method&gt;
+
+ &lt;method name="Translate(System.Int32,System.Int32)"&gt;
+ &lt;summary&gt;This method changes the point's location by the given x- and y-offsets.&lt;/summary&gt;
+ &lt;remarks&gt;
+ &lt;example lang="C#"&gt;
+ A C# example:
+ &lt;code&gt;
+ Point p = new Point(3, 5);
+ p.Translate(-1, 3);
+ &lt;/code&gt;
+ This code results in &lt;c&gt;p&lt;/c&gt; having the value (2,8).
+ &lt;/example&gt;
+ &lt;/remarks&gt;
+ &lt;param name="xor"&gt;&lt;c&gt;xor&lt;/c&gt; is the relative x-offset.&lt;/param&gt;
+ &lt;param name="yor"&gt;&lt;c&gt;yor&lt;/c&gt; is the relative y-offset.&lt;/param&gt;
+ &lt;seealso cref="Move(System.Int32,System.Int32)" /&gt;
+ &lt;/method&gt;
+
+ &lt;method name="Equals(System.Object)"&gt;
+ &lt;summary&gt;This method determines whether two points have the same location.&lt;/summary&gt;
+ &lt;param name="o"&gt;&lt;c&gt;o&lt;/c&gt; is the object to be compared to the current object.&lt;/param&gt;
+ &lt;returns&gt;True if the Points have the same location and they have the exact same
+ type; otherwise, false.&lt;/returns&gt;
+ &lt;seealso cref="op_Equality(Graphics.Point,Graphics.Point)" /&gt;
+ &lt;seealso cref="op_Inequality(Graphics.Point,Graphics.Point" /&gt;
+ &lt;/method&gt;
+
+ &lt;method name="ToString"&gt;
+ &lt;summary&gt;Report a point's location as a string.&lt;/summary&gt;
+ &lt;returns&gt;A string representing a point's location, in the form (x,y), without any
+ leading, trailing, or embedded whitespace.&lt;/returns&gt;
+ &lt;/method&gt;
+
+ &lt;method name="op_Equality(Graphics.Point,Graphics.Point)"&gt;
+ &lt;summary&gt;This operator determines whether two points have the same location.&lt;/summary&gt;
+ &lt;param name="p1"&gt;&lt;c&gt;p1&lt;/c&gt; is the first Point to be compared.&lt;/param&gt;
+ &lt;param name="p2"&gt;&lt;c&gt;p2&lt;/c&gt; is the second Point to be compared.&lt;/param&gt;
+ &lt;returns&gt;True if the points have the same location and they have the exact same
+ type; otherwise, false.&lt;/returns&gt;
+ &lt;seealso cref="Equals(System.Object)" /&gt;
+ &lt;seealso cref="op_Inequality(Graphics.Point,Graphics.Point)" /&gt;
+ &lt;/method&gt;
+
+ &lt;method name="op_Inequality(Graphics.Point,Graphics.Point)"&gt;
+ &lt;summary&gt;This operator determines whether two points have the same location.&lt;/summary&gt;
+ &lt;param name="p1"&gt;&lt;c&gt;p1&lt;/c&gt; is the first Point to be compared.&lt;/param&gt;
+ &lt;param name="p2"&gt;&lt;c&gt;p2&lt;/c&gt; is the second Point to be compared.&lt;/param&gt;
+ &lt;returns&gt;True if the points do not have the same location and they have the exact same
+ type; otherwise, false.&lt;/returns&gt;
+ &lt;seealso cref="Equals(System.Object)" /&gt;
+ &lt;seealso cref="op_Equality(Graphics.Point,Graphics.Point)" /&gt;
+ &lt;/method&gt;
+
+ &lt;method name="Main"&gt;
+ &lt;summary&gt;
+ This is the entry point of the Point class testing program.
+ &lt;/summary&gt;
+ &lt;remarks&gt;
+ &lt;para&gt;This program tests each method and operator, and is intended to be run after
+ any non-trivial maintenance has been performed on the Point class.&lt;/para&gt;
+ &lt;/remarks&gt;
+ &lt;/method&gt;
+
+ &lt;!-- properties --&gt;
+ &lt;property name="X"&gt;
+ &lt;value&gt;Property &lt;c&gt;X&lt;/c&gt; represents the point's x-coordinate.&lt;/value&gt;
+ &lt;/property&gt;
+
+ &lt;property name="Y"&gt;
+ &lt;value&gt;Property &lt;c&gt;y&lt;/c&gt; represents the point's y-coordinate.&lt;/value&gt;
+ &lt;/property&gt;
+ &lt;/type&gt;
+&lt;/doc&gt;
+</pre>
+
diff --git a/doc/papers b/doc/papers
new file mode 100644
index 00000000000..36a31988e83
--- /dev/null
+++ b/doc/papers
@@ -0,0 +1,96 @@
+* JIT Compiler
+
+ <a
+ href="http://citeseer.nj.nec.com/vitek97efficient.html">
+ Efficient Type Inclusion Tests: Jahn Vitek, R. Nigel Horspool, Andres
+ Krall</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/cytron91efficiently.html">
+ Efficiently Computing Static Single Assignment Form and the Control
+ Dependence Graph: Ron Cytron, Jeanne Ferrante</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/193349.html">
+ Practical Improvements to the Construction and Destruction of Static Single Assignment Form: Preston Briggs,
+ Keith Cooper, Timothy Harvey, Taylor Simpson</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/krall98efficient.html">
+ Efficient JavaVM Just-in-Time Compilation: Andreas Krall</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/452617.html">Java for
+ Large-Scale Scientific Computations: Andreas Krall, Phillip Thomsich</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/117522.html">
+ Engineering Simple, Efficient Code Generator Generator: Christopher
+ W. Fraser, David R. Hanson, Todd A. Proebsting</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/proebsting92code.html">
+ Code Generation Techniques: Todd Alan Proebsting</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/74629.html">Fast,
+ Effective Code Generation in a Just-In-Time Java Compiler: Ali-Reza
+ Adl-Tabatabai Guei-Yuan Lueh, Vishesh M. Parikh, James M. Stichnoth...</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/bodik00abcd.html">
+ ABCD: Eliminating Array-Bounds Checks on Demand: Rastislav Bodik, Rajiv Gupta, Vivek Sarkar</a>
+
+* Register Allocation
+
+ <a
+ href="http://citeseer.nj.nec.com/poletto99linear.html">
+ Linear Scan Register Allocation: Massimiliano Poletto, Vivek Sarkar</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/traub98quality.html">
+ Quality and Speed in Linear-scan Register Allocation: Omri Traub, Glenn
+ Holloway, Michael D. Smith</a>
+
+* Loop Transformations
+
+ <a
+ href="http://citeseer.nj.nec.com/bacon93compiler.html">
+ Compiler Transformations for High-Performance Computing: David Bacon</a>
+
+* Interpreter
+
+ <a
+ href="http://citeseer.nj.nec.com/470069.html">
+ vmgen-A Generator of Efficient Virtual Machine Interpreters: M. Anton
+ Ertl, David Gregg, Andreas Krall, Bernd Paysan</a>
+
+* Synchronization
+
+ <a
+ href="http://citeseer.nj.nec.com/krall98monitors.html">
+ Monitors and Exceptions - How to implement Java efficiently: Andreas Krall,
+ Mark Probst</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/bacon98thin.html">
+ Thin Locks: Featherweight Synchronization for Java: David Bacon</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/278639.html">
+ Featherweight Monitors with Bacon Bits: David Bacon</a>
+
+* Garbage Collection
+
+ <a
+ href="http://citeseer.nj.nec.com/wilson92uniprocessor.html">
+ Uniprocessor Garbage Collection Techniques: Paul Wilson</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/41666.html">
+ A Language-Independent Garbage Collector Toolkit: Richard Hudson, Eliot Moss, Amer Diwan, Christopher Weight</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/seligmann95incremental.html">
+ Incremental Collection of Mature Objects: Richard Hudson, Eliot Moss</a>
+
diff --git a/doc/passport b/doc/passport
new file mode 100644
index 00000000000..fd402772293
--- /dev/null
+++ b/doc/passport
@@ -0,0 +1,293 @@
+* Updates
+
+ <b>Sep 20, 2001:</b> Microsoft has just announced some changes
+ to passport that are rather interesting. This document
+ reflects the Passport system without taking into account the
+ new changes.
+
+ Read about it <a href="http://www.microsoft.com/presspass/features/2001/sep01/09-20passport.asp">here</a>.
+
+ For an analysis of security problems with passport, check <a
+ href="http://avirubin.com/passport.html">http://avirubin.com/passport.html</a>.
+ The bottom line is that you should not put any sensitive
+ information on passport.
+
+ I have received many comments from people, and I have updated
+ the page accordingly. From removing incorrect statements, to
+ fixing typos, to include mentions to other software pieces.
+
+ I also corrected my statement about IIS and a trojan horse, I
+ should read a more educated press in the future. My apologies
+ to Microsoft and its employees on this particular topic. IIS
+ did not have a trojan horse built in.
+
+* Microsoft Hailstorm and Passport
+
+ Microsoft Passport is a centralized database hosted by
+ Microsoft that enhances the consumer experience with the Web
+ by providing a single logon system that they can use across a
+ number of participant web sites.
+
+ As you might know by now from our extensive <a
+ href="faq.html">FAQ</a>, the Mono project has nothing to do
+ with Microsoft Hailstorm or <a
+ href="http://www.passport.com">Microsoft Passport.</a>
+
+ Still a lot of people have asked us our opinion on them.
+
+** Passport
+
+ Passport is important not because of it being a breakthrough
+ technologically speaking, but because the company is in a
+ position to drive most people toward being suscribers of it.
+
+ At the time of this writing passport is required to use the
+ free mail service <a href="http://www.hotmail.com">Hotmail</a>
+ to get customized support for the <a
+ href="http://www.msn.com">MSN portal</a>, <a
+ href="http://msdn.microsoft.com">Microsoft Developers
+ Network</a> and according to the original announcement from
+ Microsoft <a href="http://www.americanexpress.com">American
+ Express</a> and <a href="http://www.ebay.com">EBay</a> will be
+ adopting it.
+
+ There is already a <a
+ href="http://www.passport.com/Directory/Default.asp?PPDir=C&lc=1033">Large
+ list</a> of participating sites.
+
+ There are many current users of it and Microsoft will be
+ driving more users towards Passport as it <a
+ href="http://news.cnet.com/news/0-1003-200-6343275.html">integrates
+ it</a> in their upcoming release of Windows.
+
+ Microsoft has also <a
+ href="http://www.passport.com/Business/JoinPassportNetwork.asp?lc=1033">developed
+ a toolkit</a> to enable current web merchants to integrate
+ their services with passport.
+
+ To the end user, there is a clear benefit: they only have to
+ log into a single network and not remember multiple passwords
+ across sites on the internet. Companies that adopt passport
+ will have a competition advantage over those that dont.
+ Microsoft lists a list of <a
+ href="http://www.passport.com/Business/Default.asp?lc=1033">benefits</a>
+ to companies.
+
+
+** The problems of Passport
+
+ There are a number of concerns that different groups have over
+ Passport. Sometimes I have some, sometimes I do not. But
+ overall, consumers and businesses can have better solutions.
+
+ <ul>
+ * <b>Single Point of Failure:</b> As more services and
+ components depend on remote servers, functionality can
+ grind to a halt if there is a failure on the
+ centralized Passport system.
+
+ Such a failure was predicted, and we recently <a
+ href="http://news.cnet.com/news/0-1005-200-6473003.html">witnessed</a>
+ got a lot of people worried.
+
+ The outgage lasted for seven days. Think what this
+ could do to your business.
+
+ * <b>Trust:</b> Not everyone trusts Microsoft to keep
+ their information confidential. Concerns are not only
+ at the corporate level policy, but also the fact that
+ the source code for Microsoft products is not
+ available, means that trojans or worms could be built
+ into the products by malicious engineers.
+
+ * <b>Security:</b> With a centralized system like
+ Passport, imagine the repercussions of a malicious
+ hacker gaining access to the Passport database.
+ Personal information and credit card information about
+ almost everyone using a computer could be stored there.
+
+ Hackers have already <a
+ href="http://slashdot.org/articles/00/10/27/1147248.shtml">broken
+ into Microsoft</a> in the past. And the company was
+ unable to figure out for how long their systems had
+ been hacked.
+
+ Security holes have been found in <a
+ href="http://slashdot.org/articles/00/04/14/0619206.shtml">IIS
+ in the past.</a> If all the world's data is stored on
+ a central location, when a single security hole is
+ detected, it would allow an intruder to install a
+ backdoor within seconds into the corporate network
+ without people ever noticing.
+
+ Microsoft itself has been recently hit by worms,
+ imagine if all your business depended on a single
+ provider for providing all or your authentication
+ needs
+ </ul>
+
+ Microsoft might or might not realize this. The idea behind
+ Passport is indeed a good one (I can start to get rid of my
+ file that keeps track of the 30 logins and passwords or so
+ that I use across the various services on the net myself).
+
+** Alternatives to Microsoft Passport
+
+ An alternative to Microsoft Passport needs to take the above
+ problems into consideration. Any solution of the form `We
+ will just have a competing offering' will not work.
+
+ The system thus has to be:
+
+ <ul>
+ * <b>Distributed:</b> The entire authentication
+ system should not create an internet `blackout' in the
+ case of failure.
+
+ A distributed system using different software
+ platforms and different vendors would be more
+ resistent to an attack, as holes in a particular
+ implementation of the server software would not affect
+ every person at the same time.
+
+ A security hole attack might not even be relevant to
+ other software vendors software.
+
+ * <b>Allow for multiple registrars:</b> Users should
+ be able to choose a registrar (their banks, local
+ phone company, service provider, Swiss bank, or any
+ other entity they trust.
+
+ * <b>Mandate good security measures:</b> As a
+ principle, only Open Source software should be used
+ for servers in the registrar, and they should conform
+ to a standard set of tools and software that can be
+ examined by third parties.
+ </ul>
+
+ An implementation of this protocol could use the DNS or a
+ DNS-like setup to distribute the information of users with the
+ possibility of replicating and caching public information
+ about the user.
+
+ For instant messaging (another piece of the Hailstorm bit),
+ you want to use a non-centralized system like Sun's <a
+ href="http://www.jxta.org">JXTA</a>. Some people mailed me to
+ mention Jabber as a messaging platform and other people
+ pointed out to the <a
+ href="http://java.sun.com/products/jms/">Java Message
+ Service</a>. The JMS does support a number of very
+ interesting features that are worth researching.
+
+ It could also just use the user e-mail address as the `key' to
+ choose the registrar (msn.com, hotmail.com -> passport.com;
+ aol.com -> aol.passport.com; you get the idea).
+
+ The <a
+ href="http://www.soapware.org/xmlStorageSystem">xmlStorage</a>
+ idea from <a href="http://www.scripting.com">Dave Winer</a>
+ could be used to store the information.
+
+ A toolkit for various popular web servers could be provided,
+ authenticated and should be open sourced (for those of you who
+ think that a binary program would give more security and would
+ prevent people from tampering: you are wrong. You can always
+ use a proxy system that "behaves" like the binary, and passes
+ information back and forth from the real program, and snoops
+ in-transit information).
+
+ Good cryptographers need to be involved in this problem to
+ figure out the details and the possible insecure pieces of a
+ proposal like this.
+
+** Implementation: In short
+
+ To keep it short: <b>DNS, JXTA, xmlStorage.</b>
+
+
+** Deploying it
+
+ The implementation of such a system should be a pretty
+ straightforward task once security cryptographers have
+ designed such a beast.
+
+ The major problems are:
+
+ <ul>
+ * <b>People might just not care:</b> In a poll to US
+ citizens a couple of decades ago, it was found that
+ most people did not care about the rights they were
+ given by the Bill of Rights, which lead to a number of
+ laws to be passed in the US that eliminated most of
+ the rights people had.
+
+ * <b>The industry will move way too slow:</b>
+ Microsoft's implementation is out in the open now: it
+ is being deployed, and soon it will be insinuated to
+ many, many users. The industry needs to get together
+ soon if they care about this issue.
+
+ By the time the industry reacts, it might be too
+ late.
+ </ul>
+
+** Passport and Mono
+
+ The .NET class libraries include a Passport class that
+ applications might use to authenticate with Passport. Since
+ we do not have information at this point on the exact protocol
+ of Passport, it is not even feasible to implement it.
+
+ If at some point the information is disclosed, it could be
+ implemented.
+
+ If a competing system to Passport existed, we could probably
+ hide all the authentication information to use a number of
+ different passport-like systems.
+
+ If a user does not want to use Passport at all, he could
+ always turn it off (or completely remove the class from the
+ library). After all, this is free software.
+
+ Currently, we are too far from the point where this is a real
+ issue.
+
+** Passport and endangering Open Source.
+
+ A few people have said: `Mono will allow Passport to be
+ available for Linux and that is bad'. This is plain
+ misinformation.
+
+ Currently, you can obtain Passport for Linux from Microsoft
+ itself and deploy it today on your Web server. Mono does not
+ even enter the picture here. Go to passport.com and download
+ the toolkit and you will see with your own eyes that passport
+ is <B>already</b> available for Linux.
+
+** Disclaimer
+
+ This is just a group of personal thoughts of mine that I have
+ placed here because I get asked this question a lot lately.
+ The views of this page are not a statement from my employer
+ (Ximian, Inc).
+
+ This is not part of Mono. We are not trying to deal with this
+ problem.
+
+ Nat Friedman (Ximian's co-founder) has his own ideas on how a
+ competing system to Passport could be designed, but I will let
+ <a href="http://www.nat.org/">him</a> post his own story.
+
+** Other Passport Comments
+
+ An interesting study on the security of passport is available at: <a
+ href="http://avirubin.com/passport.html">http://avirubin.com/passport.html</a>
+
+** Other Alternatives
+
+ Some people have pointed out <a
+ href="http://www.xns.org">XNS</a>
+
+Send comments to me: Miguel de Icaza (<a
+ href="mailto:miguel@ximian.com">miguel@ximian.com</a>)
+
diff --git a/doc/pending b/doc/pending
new file mode 100644
index 00000000000..e243a10dedf
--- /dev/null
+++ b/doc/pending
@@ -0,0 +1,14 @@
+** Microsoft and GNU and Linux.
+
+Q: Does this mean that Microsoft is better than Linux?
+
+A: Many of us are working on <a
+ href="http://www.gnu.org/philosophy/free-sw.html">free software<a>
+ and want to have an <a href="http://www.opensource.org">open
+ source</a> environment that we can change, modify, improve, learn
+ from, and share with others. Some of us also think that this will
+ lead on the long run to better software: more efficient, faster,
+ more robust and more.
+
+ We are willing to take good ideas from any source they come from.
+
diff --git a/doc/pending-classes.in b/doc/pending-classes.in
new file mode 100644
index 00000000000..1cdb5a4cb36
--- /dev/null
+++ b/doc/pending-classes.in
@@ -0,0 +1,246 @@
+System.Object
+System.Exception
+System.ValueType
+System.Delegate
+System.MulticastDelegate
+System.Enum
+System.Activator
+System.ArgIterator
+System.__ComObject
+System.TypedReference
+System.Security.AllowPartiallyTrustedCallersAttribute
+System.Runtime.Serialization.Formatter
+System.Runtime.Serialization.FormatterConverter
+System.Runtime.Serialization.FormatterServices
+System.Runtime.Serialization.ObjectIDGenerator
+System.Runtime.Serialization.ObjectManager
+System.Reflection.ModuleResolveEventHandler
+System.Reflection.Pointer
+System.Globalization.CompareInfo
+System.Globalization.HebrewCalendar
+System.Globalization.HijriCalendar
+System.Globalization.JapaneseCalendar
+System.Globalization.KoreanCalendar
+System.Globalization.SortKey
+System.Globalization.StringInfo
+System.Globalization.TaiwanCalendar
+System.Globalization.TextElementEnumerator
+System.Globalization.TextInfo
+System.Globalization.ThaiBuddhistCalendar
+System.IO.IsolatedStorage.IsolatedStorageFile
+System.Reflection.Emit.MethodRental
+System.Runtime.CompilerServices.AccessedThroughPropertyAttribute
+System.Runtime.CompilerServices.CallConvCdecl
+System.Runtime.CompilerServices.CallConvStdcall
+System.Runtime.CompilerServices.CallConvThiscall
+System.Runtime.CompilerServices.CallConvFastcall
+System.Runtime.CompilerServices.CustomConstantAttribute
+System.Runtime.CompilerServices.DateTimeConstantAttribute
+System.Runtime.CompilerServices.DiscardableAttribute
+System.Runtime.CompilerServices.DecimalConstantAttribute
+System.Runtime.CompilerServices.CompilationRelaxationsAttribute
+System.Runtime.CompilerServices.CompilerGlobalScopeAttribute
+System.Runtime.CompilerServices.IDispatchConstantAttribute
+System.Runtime.CompilerServices.IsVolatile
+System.Runtime.CompilerServices.IUnknownConstantAttribute
+System.Runtime.CompilerServices.RequiredAttributeAttribute
+System.Runtime.InteropServices.ArrayWithOffset
+System.Runtime.InteropServices.DispIdAttribute
+System.Runtime.InteropServices.ClassInterfaceType
+System.Runtime.InteropServices.ClassInterfaceAttribute
+System.Runtime.InteropServices.ComVisibleAttribute
+System.Runtime.InteropServices.LCIDConversionAttribute
+System.Runtime.InteropServices.ComRegisterFunctionAttribute
+System.Runtime.InteropServices.ComUnregisterFunctionAttribute
+System.Runtime.InteropServices.ProgIdAttribute
+System.Runtime.InteropServices.ImportedFromTypeLibAttribute
+System.Runtime.InteropServices.IDispatchImplType
+System.Runtime.InteropServices.IDispatchImplAttribute
+System.Runtime.InteropServices.ComSourceInterfacesAttribute
+System.Runtime.InteropServices.ComConversionLossAttribute
+System.Runtime.InteropServices.TypeLibTypeFlags
+System.Runtime.InteropServices.TypeLibFuncFlags
+System.Runtime.InteropServices.TypeLibVarFlags
+System.Runtime.InteropServices.TypeLibTypeAttribute
+System.Runtime.InteropServices.TypeLibFuncAttribute
+System.Runtime.InteropServices.TypeLibVarAttribute
+System.Runtime.InteropServices.ComImportAttribute
+System.Runtime.InteropServices.PreserveSigAttribute
+System.Runtime.InteropServices.ComAliasNameAttribute
+System.Runtime.InteropServices.AutomationProxyAttribute
+System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute
+System.Runtime.InteropServices.CoClassAttribute
+System.Runtime.InteropServices.ComEventInterfaceAttribute
+System.Runtime.InteropServices.COMException
+System.Runtime.InteropServices.ComMemberType
+System.Runtime.InteropServices.CurrencyWrapper
+System.Runtime.InteropServices.DispatchWrapper
+System.Runtime.InteropServices.ErrorWrapper
+System.Runtime.InteropServices.ExtensibleClassFactory
+System.Runtime.InteropServices.HandleRef
+System.Runtime.InteropServices.InvalidComObjectException
+System.Runtime.InteropServices.InvalidOleVariantTypeException
+System.Runtime.InteropServices.TypeLibImporterFlags
+System.Runtime.InteropServices.ExporterEventKind
+System.Runtime.InteropServices.ITypeLibExporterNotifySink
+System.Runtime.InteropServices.ITypeLibConverter
+System.Runtime.InteropServices.MarshalDirectiveException
+System.Runtime.InteropServices.ObjectCreationDelegate
+System.Runtime.InteropServices.RuntimeEnvironment
+System.Runtime.InteropServices.RegistrationServices
+System.Runtime.InteropServices.SafeArrayRankMismatchException
+System.Runtime.InteropServices.SafeArrayTypeMismatchException
+System.Runtime.InteropServices.SEHException
+System.Runtime.InteropServices.TypeLibConverter
+System.Runtime.InteropServices.BIND_OPTS
+System.Runtime.InteropServices.UCOMIBindCtx
+System.Runtime.InteropServices.UCOMIConnectionPointContainer
+System.Runtime.InteropServices.UCOMIConnectionPoint
+System.Runtime.InteropServices.UCOMIEnumMoniker
+System.Runtime.InteropServices.CONNECTDATA
+System.Runtime.InteropServices.UCOMIEnumConnections
+System.Runtime.InteropServices.UCOMIEnumConnectionPoints
+System.Runtime.InteropServices.UCOMIEnumString
+System.Runtime.InteropServices.UCOMIEnumVARIANT
+System.Runtime.InteropServices.FILETIME
+System.Runtime.InteropServices.UCOMIMoniker
+System.Runtime.InteropServices.UCOMIPersistFile
+System.Runtime.InteropServices.UCOMIRunningObjectTable
+System.Runtime.InteropServices.STATSTG
+System.Runtime.InteropServices.UCOMIStream
+System.Runtime.InteropServices.DESCKIND
+System.Runtime.InteropServices.BINDPTR
+System.Runtime.InteropServices.UCOMITypeComp
+System.Runtime.InteropServices.TYPEKIND
+System.Runtime.InteropServices.TYPEFLAGS
+System.Runtime.InteropServices.IMPLTYPEFLAGS
+System.Runtime.InteropServices.TYPEATTR
+System.Runtime.InteropServices.FUNCDESC
+System.Runtime.InteropServices.IDLFLAG
+System.Runtime.InteropServices.IDLDESC
+System.Runtime.InteropServices.PARAMFLAG
+System.Runtime.InteropServices.PARAMDESC
+System.Runtime.InteropServices.TYPEDESC
+System.Runtime.InteropServices.ELEMDESC
+System.Runtime.InteropServices.VARDESC
+System.Runtime.InteropServices.DISPPARAMS
+System.Runtime.InteropServices.EXCEPINFO
+System.Runtime.InteropServices.FUNCKIND
+System.Runtime.InteropServices.INVOKEKIND
+System.Runtime.InteropServices.CALLCONV
+System.Runtime.InteropServices.FUNCFLAGS
+System.Runtime.InteropServices.VARFLAGS
+System.Runtime.InteropServices.UCOMITypeInfo
+System.Runtime.InteropServices.SYSKIND
+System.Runtime.InteropServices.LIBFLAGS
+System.Runtime.InteropServices.TYPELIBATTR
+System.Runtime.InteropServices.UCOMITypeLib
+System.Runtime.InteropServices.UnknownWrapper
+System.Runtime.Remoting.IObjectHandle
+System.Runtime.Remoting.IRemotingTypeInfo
+System.Runtime.Remoting.IChannelInfo
+System.Runtime.Remoting.IEnvoyInfo
+System.Runtime.Remoting.RemotingConfiguration
+System.Runtime.Remoting.TypeEntry
+System.Runtime.Remoting.ActivatedClientTypeEntry
+System.Runtime.Remoting.ActivatedServiceTypeEntry
+System.Runtime.Remoting.WellKnownClientTypeEntry
+System.Runtime.Remoting.WellKnownServiceTypeEntry
+System.Runtime.Remoting.RemotingException
+System.Runtime.Remoting.ServerException
+System.Runtime.Remoting.RemotingTimeoutException
+System.Runtime.Remoting.RemotingServices
+System.Runtime.Remoting.InternalRemotingServices
+System.Runtime.Remoting.SoapServices
+System.Runtime.Remoting.Activation.UrlAttribute
+System.Runtime.Remoting.Messaging.IMessageSink
+System.Runtime.Remoting.Messaging.AsyncResult
+System.Runtime.Remoting.Messaging.CallContext
+System.Runtime.Remoting.Messaging.ILogicalThreadAffinative
+System.Runtime.Remoting.Messaging.InternalMessageWrapper
+System.Runtime.Remoting.Messaging.IMethodCallMessage
+System.Runtime.Remoting.Messaging.MethodCallMessageWrapper
+System.Runtime.Remoting.Messaging.HeaderHandler
+System.Runtime.Remoting.Messaging.IMessageCtrl
+System.Runtime.Remoting.Messaging.IRemotingFormatter
+System.Runtime.Remoting.Messaging.ReturnMessage
+System.Runtime.Remoting.Messaging.MethodCall
+System.Runtime.Remoting.Messaging.ConstructionCall
+System.Runtime.Remoting.Messaging.MethodResponse
+System.Runtime.Remoting.Messaging.ConstructionResponse
+System.Runtime.Remoting.Messaging.MethodReturnMessageWrapper
+System.Runtime.Remoting.Messaging.OneWayAttribute
+System.Runtime.Remoting.Messaging.MessageSurrogateFilter
+System.Runtime.Remoting.Messaging.RemotingSurrogateSelector
+System.Runtime.Remoting.Contexts.CrossContextDelegate
+System.Runtime.Remoting.Contexts.ContextProperty
+System.Runtime.Remoting.Contexts.IContextPropertyActivator
+System.Runtime.Remoting.Contexts.IContributeClientContextSink
+System.Runtime.Remoting.Contexts.IContributeDynamicSink
+System.Runtime.Remoting.Contexts.IContributeEnvoySink
+System.Runtime.Remoting.Contexts.IContributeObjectSink
+System.Runtime.Remoting.Contexts.IContributeServerContextSink
+System.Runtime.Serialization.Formatters.InternalRM
+System.Runtime.Serialization.Formatters.InternalST
+System.Runtime.Serialization.Formatters.SoapMessage
+System.Runtime.Serialization.Formatters.SoapFault
+System.Runtime.Serialization.Formatters.ServerFault
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+System.Security.Cryptography.CryptoConfig
+System.Security.Cryptography.KeyedHashAlgorithm
+System.Security.Cryptography.HMACSHA1
+System.Security.Cryptography.MACTripleDES
+System.Security.Cryptography.MaskGenerationMethod
+System.Security.Cryptography.PasswordDeriveBytes
+System.Security.Cryptography.PKCS1MaskGenerationMethod
+System.Security.Cryptography.RC2
+System.Security.Cryptography.RC2CryptoServiceProvider
+System.Security.Cryptography.RSACryptoServiceProvider
+System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter
+System.Security.Cryptography.RSAOAEPKeyExchangeFormatter
+System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter
+System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter
+System.Security.Cryptography.RSAPKCS1SignatureDeformatter
+System.Security.Cryptography.RSAPKCS1SignatureFormatter
+System.Security.Cryptography.SHA1Managed
+System.Security.Cryptography.TripleDES
+System.Security.Cryptography.TripleDESCryptoServiceProvider
+System.Security.Permissions.EnvironmentPermission
+System.Security.Permissions.FileDialogPermission
+System.Security.Permissions.IsolatedStorageFilePermission
+System.Security.Permissions.PrincipalPermissionAttribute
+System.Security.Permissions.SecurityPermissionAttribute
+System.Security.Permissions.PublisherIdentityPermissionAttribute
+System.Security.Permissions.PublisherIdentityPermission
+System.Security.Permissions.ReflectionPermission
+System.Security.Permissions.RegistryPermission
+System.Security.Permissions.PrincipalPermission
+System.Security.Permissions.SiteIdentityPermission
+System.Security.Permissions.StrongNameIdentityPermission
+System.Security.Permissions.StrongNamePublicKeyBlob
+System.Security.Permissions.UIPermission
+System.Security.Permissions.UrlIdentityPermission
+System.Security.Permissions.ZoneIdentityPermission
+System.Security.Policy.ApplicationDirectory
+System.Security.Policy.ApplicationDirectoryMembershipCondition
+System.Security.Policy.FirstMatchCodeGroup
+System.Security.Policy.Hash
+System.Security.Policy.HashMembershipCondition
+System.Security.Policy.NetCodeGroup
+System.Security.Policy.PermissionRequestEvidence
+System.Security.Policy.Publisher
+System.Security.Policy.PublisherMembershipCondition
+System.Security.Policy.Site
+System.Security.Policy.SiteMembershipCondition
+System.Security.Policy.StrongName
+System.Security.Policy.StrongNameMembershipCondition
+System.Security.Policy.UnionCodeGroup
+System.Security.Policy.Url
+System.Security.Policy.UrlMembershipCondition
+System.Security.Policy.Zone
+System.Security.Policy.ZoneMembershipCondition
+System.Security.Principal.WindowsIdentity
+System.Security.Principal.WindowsImpersonationContext
+System.Security.Principal.WindowsPrincipal
+System.Threading.CompressedStack
+
diff --git a/doc/plans b/doc/plans
new file mode 100755
index 00000000000..db6f6dde7c8
--- /dev/null
+++ b/doc/plans
@@ -0,0 +1,15 @@
+* Plans
+
+ Here we are tracking some plans to particular pieces of
+ technology that are part of Mono.
+
+ This is just a repository of information that is handy for
+ contributors.
+
+ Currently you can read our plans for <a
+ href="ado-net.html">ADO.NET</a>, <a
+ href="asp-net">ASP.NET</a>, <a href="java.html">Java</a> and
+ <a href="winforms.html">WinForms</a>.
+
+
+
diff --git a/doc/porting b/doc/porting
new file mode 100644
index 00000000000..a09ab69deaa
--- /dev/null
+++ b/doc/porting
@@ -0,0 +1,63 @@
+* How to port Mono to your preferred architecture
+
+** Endian, 64 bits and unaligned access issues
+
+ The first thing to do is to check that the metadata handling
+ library works on your target processor. You may use the disassembler
+ on simple programs and check that you get sensible results
+ (assuming it compiles at all on your system:-).
+
+ The main issue is to write macros that read unaligned
+ little endian shorts/ints/longs/float/doubles: look into
+ mono/metadata/endian.h. There may be other spots in the code that are
+ unsafe at reading/writing to some datatypes that require special
+ alignment, but there should be few such issues and they need to be fixed.
+
+ Once this stuff is sorted out, you should be able to run the interpreter
+ on simple programs that don't require delegates, P/Invoke functions etc..
+
+** Generating assembly bytecodes for the target processor
+
+ Next, you need to provide the support code for generating assembly bytecode
+ for your target platform (in mono/arch/{ppc,sparc,alpha,*}).
+ The code should be more or less like the code in x86-codegen.h:
+ macros that produce fast in-line code. You don't need to provide
+ code to create every possible code, at first, just the code to
+ create trampolines and execute them is fine (you'll need to research
+ how the call convention works on your platform): that would be, for
+ example, the prolog and epilog code in a function, code to pass function
+ parameters and deal with the return value and so on.
+
+ libffi in gcc or the xptcall sources in mozilla may be helpful to
+ understand how the calling convention works, if you can't find a specification.
+ You'd need a processor manual to know how to create the assembly binary data.
+ This requires a lot of reading if you're not familiar with the assembly for your
+ target platform. Manuals for many processors are available as PDF files on the
+ web site of the respective vendors. Note that some processors require you to
+ flush the I-cache before executing the code: have a look at how the same thing is
+ done in GNU lightning.
+
+** Getting the interpreter to work
+
+ Once you can generate binary code, you can start working on a
+ mono_create_trampoline() function for your platform: this function will receive
+ a MonoMethod that describes the arguments and the return type of a C function
+ and will create the code to call such function. When this function is complete
+ you'll be able to run more sample programs, that use System.IO, P/Invoke
+ functions etc.
+
+ To support delegates you'll need to write a mono_create_method_pointer()
+ function that creates a native function: this can be used to call the
+ method using the runtime's calling convention (it's basically the reverse
+ of mono_create_trampoline()).
+
+** The final step: porting the JIT
+
+ At this point you'd need to have a more complete code generation header file
+ and you can start writing the machine description file for the monoburg
+ system. This code (jit/tesjit.c) will require some machine specific tweaks,
+ but hopefully all you have to do is create the grammar that emit assembly
+ code from the IR tree. Work is at the early stages also for x86 on this stuff
+ as we are still testing various solutions: you'd want to read about burg-like
+ code-generator generators (the LCC book is a good starting point).
+
diff --git a/doc/rationale b/doc/rationale
new file mode 100644
index 00000000000..d63cf225a59
--- /dev/null
+++ b/doc/rationale
@@ -0,0 +1,173 @@
+
+* The Mono Project
+
+** Background.
+
+ The GNOME project goal was to bring missing technologies to
+ Unix and make it competitive in the current market place for
+ desktop applications. We also realized early on that language
+ independence was important, and that is why GNOME APIs were
+ coded using a standard that allowed the APIs to be easily
+ wrapped for other languages. Our APIs are available to most
+ programming languages on Unix (Perl, Python, Scheme, C++,
+ Objective-C, Ada).
+
+ Later on we decided to use better methods for encapsulating
+ our APIs, and we started to use CORBA to define interfaces to
+ components. We complemented it with policy and a set of
+ standard GNOME interfaces for easily creating reusable,
+ language independent components, controls and compound
+ documents. This technology is known as <a
+ href="http://developer.ximian.com/tech/bonobo.html">Bonobo</a>.
+ Interfaces to Bonobo exist for C, Perl, Python, and
+ Java.
+
+ CORBA is good when you define coarse interfaces, and most
+ Bonobo interfaces are coarse. The only problem is that
+ Bonobo/CORBA interfaces are not good for small interfaces.
+ For example, an XML parsing Bonobo/CORBA component would be
+ inefficient compared to a C API.
+
+** Another explanation
+
+ I recently explained our motivations to Dave Winer, and he posted
+ it <a
+ href="http://scriptingnews.userland.com/stories/storyReader$1275">here</a>
+
+** Microsoft's .NET
+
+ The Microsoft .NET initiative is confusing because it is a
+ company wide effort that ranges from development tools to end
+ user applications. .NET is a branding formative that
+ has been applied to:
+
+ <ul>
+ * The .NET development platform, a new platform for
+ writing software.
+
+ * Web services.
+
+ * Microsoft Server Applications.
+
+ * New tools that use the new development platform.
+
+ * Hailstorm, the Passport centralized single-signon
+ system that is being integrated into Windows XP.
+
+ </ul>
+
+ Mono is an implementation of the .NET development platform.
+
+** The Common Language Infrastructure platform.
+
+ Microsoft has created a new development platform. The
+ highlights of this new development platform are:
+
+ <ul>
+ * A runtime environment that provides garbage
+ collection, threading and a virtual machine
+ specification (The Virtual Execution System, VES)
+
+ * A comprehensive class library.
+
+ * A new language, C#. Very similar to Java, C#
+ allows programmers to use all the features available
+ on the .NET runtime.
+
+ * A language specification that compilers can
+ follow if they want to generate classes and code
+ that can interoperate with other programming
+ languages (The Common Language Specification: CLS)
+ </ul>
+
+ The Common Language Infrastructure platform is similar to the
+ goals we had in GNOME of giving language independence to
+ programmers. It is more mature, documented, larger in scope,
+ and has a consistent design.
+
+ Any API that is written using a CLS provider language can be
+ used by any language that is a CLS consumer. Compilers
+ generate code in a format called Common Intermediate Language
+ (CIL) which is an intermediate representation of a compiled
+ program and is easy to compile to native code or compiled
+ using Just-in-Time (JIT) engines. The restrictions placed by
+ the runtime on the CIL byte codes ensures that it is possible
+ to do a good job at optimizing the code in a JIT compiler.
+
+ There is not really a lot of innovation in this platform: we
+ have seen all of these concepts before, and we are all
+ familiar with how these things work.
+
+ What makes the Common Language Infrastructure development
+ platform interesting is that it is a good mix of technologies
+ that have been nicely integrated.
+
+ The .NET development platform is essentially a new foundation
+ for program development that gives Microsoft a room to grow
+ for the coming years.
+
+** ECMA standards.
+
+ Microsoft has submitted the
+ specifications of C#, the runtime, the metadata and the
+ other various bits of the .NET development platform to the
+ <a href="http://www.ecma.ch">ECMA</a> for standarization.
+
+ You can get a copy of the specifications submitted to ECMA
+ from: <a href="http://www.dotnetexperts.com/ecma">http://www.dotnetexperts.com/ecma</a>
+
+** Mono: an Open Source Common Language Infrastructure implementation.
+
+ Ximian has begun work on Mono, a project that aims to bring
+ the Common Language Infrastructure platform to free systems.
+
+ When the GNU project was launched, they picked the best
+ operating system that was available out there, and they
+ began to clone it: Unix.
+
+ The .NET development platform is a very rich, powerful, and
+ well designed platform that would help improve the free
+ software development platform. Just like the GNU project
+ began to clone Unix sixteen years ago, we will be cloning the
+ .NET development platform because it is a great platform to
+ build on.
+
+** What makes up Mono?
+
+ There are various pieces that will make up Mono:
+
+ <ul>
+ * A C# compiler.
+
+ * The Virtual Execution System: that will have the
+ Just-in-Time compiler, garbage collector, loader,
+ threading engine.
+
+ A byte code interpreter will be provided for quickly
+ porting Mono to new systems and debugging the JIT
+ purposes, but it is not intended to be the ideal
+ execution environment.
+
+ * An implemenation of the .NET class library.
+
+ * Visual development tools.
+
+ * A CIL GCC frontend.
+ </ul>
+
+** Why use GNOME components?
+
+ GNOME is an umbrella project that consists of infrastructural
+ components (GUI toolkit, XML libraries, CORBA implementation,
+ printing architecture, imaging system), a desktop environment,
+ and productivity applications.
+
+ The GNOME infrastructural components can be used to quickly
+ implement various pieces of the class libraries without reinventing
+ the wheel, and since all those components are licensed under
+ the terms of the GNU LGPL it is a perfect fit.
+
+ Libart will be used to implement the Drawing.2D API; Gtk+ and
+ the GNOME libraries will be used to implement the WinForms
+ API and of course Glib and libxml will be used in various
+ places. \ No newline at end of file
diff --git a/doc/release-notes/mono-0.3 b/doc/release-notes/mono-0.3
new file mode 100644
index 00000000000..4976037b957
--- /dev/null
+++ b/doc/release-notes/mono-0.3
@@ -0,0 +1,46 @@
+To: mono-list@ximian.com, mono-announce-list@ximian.com
+Subject: July 12 snapshots.
+FCC: ~/Mail/outbox.txt
+X-Windows: Sometimes you fill a vacuum and it still sucks.
+--text follows this line--
+
+Hey!
+
+ July 12 snapshots of class libraries, the compiler and the mono
+runtime are available.
+
+New on this release:
+
+ * Runtime (module: mono)
+
+ The beginning of a simple interpreter that Paolo started
+ workign on (can run really simple .NET programs).
+
+ Disassembler copes with more elements of the binary format and
+ more tokens are decoded. Paolo is working now on moving some
+ of these to the metadata library.
+
+ More tables are dumped.
+
+ * Class libraries (module: mcs/class)
+
+ Many new more classes are in from Joe, Vladimir, Jeff, Sean
+ and yours truly.
+
+ Sean fixed the build process, and it is now possible to
+ compile with a single command the assemblies. We will be
+ revisiting this mechanism in the future to compile per-OS
+ assemblies (ie, Unix, Windows, MacOS, etc).
+
+ * Compiler (module mcs/mcs)
+
+ Not much done this week, just a few fixes here and there, and
+ more work to make it easy to compiler.
+
+ * Documentation (module: mono/doc)
+
+ All the changes to the web site are there for your browsing
+ pleasure. We still need to integrate the status system in
+ there.
+
+Miguel.
diff --git a/doc/release-notes/mono-0.4 b/doc/release-notes/mono-0.4
new file mode 100644
index 00000000000..1d7e1cea5f1
--- /dev/null
+++ b/doc/release-notes/mono-0.4
@@ -0,0 +1,43 @@
+To: mono-list@ximian.com
+Subject: Sunday snapshot available.
+Gcc: mail.2001-07
+--text follows this line--
+
+Hey guys,
+
+ I promise I will not be doing these so often once we have the CVS
+server up. In the meantime:
+
+ * MCS
+
+ Sean got the classes to compile in a single go. You
+ will need CygWin (www.cygwin.org) to compile though
+ (GNU make and stuff is required).
+
+ System.Xml.XmlReader contribution from Jason
+ (WOOHHOO!!). It also contains a nice test-suite for
+ his functions, and in his new code bit, his
+ implementation is faster than Microsoft's
+
+ We now ship `jay' as part of the distribution to allow
+ you to compile the compiler with the same `make'
+ command. Small fixes to the parser as well were
+ introduced.
+
+ * Mono 0.4
+
+ Paolo's interpreter supports call instructions and has
+ the test suite program that he posted about.
+
+
+ All documentation ships now in the mono-0.4.tar.gz
+
+Notes:
+
+ As usual, MCS is targeted to be compiled on a Windows machine
+ (you will need Cygwin).
+
+ Mono is targeted to be compiled on a Unix machine or a Windows
+ machine running Cygwin.
+
+Miguel. \ No newline at end of file
diff --git a/doc/resources b/doc/resources
new file mode 100644
index 00000000000..7efc6d8909d
--- /dev/null
+++ b/doc/resources
@@ -0,0 +1,188 @@
+
+* Resources
+
+ There are a number of resources available for those of you who
+ want to contribute to the Mono project. Here are a few links.
+
+ If you want to send suggestions for links, address them to <a
+ mailto="web-mono@ximian.com">web-mono@ximian.com</a>.
+
+** Microsoft .NET
+
+ The <a href="http://msdn.microsoft.com/net">Microsoft.NET site.</a>
+
+ The Microsoft .NET Framework 1.0 can be downloaded <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>
+
+ New methods that are not documented in 1.0, are documented <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/framewrkaddend.asp">here</a>
+
+** IRC
+
+ Various Mono contributors get together on channel #mono on
+ irc.gnome.org
+
+** Mono related sites.
+
+ Sergey's web page on Mono resources:
+
+ <a href="http://mono.eurosoft.od.ua">http://mono.eurosoft.od.ua</a>
+
+ Got Dot Net:
+
+ <a href="http://www.gotdotnet.com">Got Dot Net</a>
+
+ MonoMail:
+
+ <a href="http://sourceforge.net/projects/monomail/">http://sourceforge.net/projects/monomail/</a>
+
+ Zip classes:
+
+ Mike's port to .NET: <a
+ href="http://www.icsharpcode.net/OpenSource/NZipLib/default.asp">NZipLib</a>
+
+ .NET Security:
+
+ A nice overview paper on the <a
+ href="http://www.foundstone.com/pdf/dotnet-security-framework.pdf">.NET
+ security architecture</a>.
+
+** 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.ch/ecma1/STAND/ecma-334.htm">C# Language Specification</a>
+ * <a href="http://www.ecma.ch/ecma1/STAND/ecma-335.htm">Common Language Infrastructure</a>
+ </ul>
+
+
+ Older copies of the standard are available here:
+
+ <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>
+
+ These contain specifications for the assembler, the metadata,
+ byte codes supported by the CLI virtual machine, the C#
+ language and the core class libraries.
+
+ For details on the .NET class libraries, you can
+ visit the Microsoft's Developer Network:
+
+ <ul>
+ * <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/cpref_start.asp">.NET Framework Class Library</a>
+ </ul>
+
+ You can also get this information if you install the Beta2
+ release of the .NET Framework.
+
+** Discussion Groups.
+
+ <ul>
+
+ * <a href="http://www.oreillynet.com">O'Reilly
+ Network</a> has a <a
+ href="http://www.oreillynet.com/dotnet">section devoted to
+ .NET</a>
+ * <a
+ href="http://msdn.microsoft.com/newsgroups">MSDN</a> also
+ lists various newsgroups related to .NET</ul>
+ </ul>
+
+** Other .NET related projects
+
+ There are a number of related projects to Mono:
+
+ <ul>
+ * <a
+ href="http://www.icsharpcode.net/OpenSource/SD/default.asp">Sharp
+ Develop:</a> an IDE for the C# language written in C#.
+
+ * <a
+ href="http://www.improve-technologies.com/alpha/esharp/">Eclipse
+ Plugin for C#</a>
+
+ * <a
+ href="http://janet-js.sourceforge.net/">Janet:</a>
+ an implemention of ECMAScript (the standarized
+ version of JavaScript) in C#
+
+ * <a
+ href="http://xmarks.sourceforge.net/doc.html">XMarks DOC.NET:</a> For
+ creating online documentation you can browse for your own classes.
+
+ * <a href="http://nunit.sourceforge.net">NUnit:</a> A
+ testing framework for .NET classes.
+
+ * <a href="http://www.kaffe.org">Kaffe:</a> A popular
+ Free Software JIT engine for Java.
+
+ * <a href="http://www.intel.com/research/mrl/orp">ORP:</a> A research
+ JIT/VM/GC system from Intel.
+
+ * C# bindings for OpenGL and SDL are available here: <a
+ href="http://csgl.sourceforge.net">http://csgl.sourceforge.net</a>
+
+ * <a
+ href="http://www.southern-storm.com.au/portable_net.html">Portable.NET:</a>
+ Another implementation of the CLI and C# compiler.
+
+ </ul>
+
+** GNOME Documentation
+
+ Documnetation on GNOME, and the GNOME APIs is available from
+ the <a href="http://developer.gnome.org">developer</a> site at
+ GNOME:
+
+ <ul>
+ * <a href="http://developer.gnome.org/doc/API/">GNOME
+ API documentation</a>
+
+ * <a href="http://developer.gnome.org/doc/books">GNOME
+ Online books</a>
+
+ * <A
+ href="http://developer.gnome.org/arch/">Architecture Overview</a>
+ </ul>
+
+** Assembly Language Manuals online
+
+ <ul>
+ * <a href="http://www.agner.org/assem/#optimize">
+ Pentium optimization tutorial</a> by Agner Fog
+
+ * <a href="http://webster.cs.ucr.edu/">
+ Art of Assembly</a> (x86 only)
+
+ * Documentation for various CPUs
+ (<a href="http://www.mit.edu/afs/sipb/contrib/doc/specs/ic/cpu/">
+ x86, IA64, MIPS, ARM, Alpha</a>)
+
+ * <a href="http://www.heyrick.co.uk/assembler/">
+ ARM Assembler</a> tutorial
+
+ * PowerPC
+ <a href="http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF7785256996007558C6">
+ Compiler Writer's Guide</a>
+
+ * <a href="http://www.lightsoft.co.uk/Fantasm/Beginners/begin1.html">
+ Beginners Guide to PowerPC Assembler</a>
+ </ul>
+
+** Win32
+
+ <ul>
+ * Win32 <a href="http://www.jorgon.freeserve.co.uk/ExceptFrame.htm">
+ Structured Exception Handling (SEH)</a> internals (x86 specific)
+ </ul>
diff --git a/doc/resources-pending b/doc/resources-pending
new file mode 100644
index 00000000000..fd9b9073d64
--- /dev/null
+++ b/doc/resources-pending
@@ -0,0 +1,30 @@
+** MacOS Documentation
+
+** Assembly Language Manuals online
+ Intel
+ MIPS
+ SPARC
+
+** Microsoft
+ msdn.microsoft.com/net
+ Research.microsoft.com
+
+** Related Technologies
+
+ <ul>
+
+ * The CLI allows people to create Web Services using the SOAP
+ protocol. SOAP is based on XML, XML schemas an the HTTP
+ protocol.
+ <ul>
+ * XML specification.
+ * XML Namespaces.
+ * XML Schemas.
+ * SOAP Specification.
+ </ul>
+ </ul>
+
+** Compiler Information
+ GCC
+ GCC Sample front-end tutorial
+
diff --git a/doc/roadmap b/doc/roadmap
new file mode 100644
index 00000000000..6cdfa1366a8
--- /dev/null
+++ b/doc/roadmap
@@ -0,0 +1,12 @@
+* Roadmap
+
+ We are working on the following three projects at Ximian:
+
+ The C# Compiler (mcs/mcs)
+
+ A .NET compatible Class Library (mcs/class)
+
+ The JIT/interpreter (mono)
+
+
+ \ No newline at end of file
diff --git a/doc/runtime b/doc/runtime
new file mode 100644
index 00000000000..908600e8f84
--- /dev/null
+++ b/doc/runtime
@@ -0,0 +1,195 @@
+* The Mono runtime
+
+ The Mono runtime implements a JIT engine for the CIL virtual
+ machine (as well as a byte code interpreter, this is to
+ quickly port it to new systems), the class loader, the garbage
+ collector, threading system and metadata access libraries.
+
+ We currently have two runtimes:
+
+ <ul>
+ * <b>mono:</b> The Just In Time compiler implemented
+ using a BURS instruction selector. We only support
+ x86 machines in the JIT engine at this point.
+
+ * <b>mint:</b> The Mono interpreter. This is an
+ easy-to-port runtime engine.
+ </ul>
+
+ Currently we are using the Bohem conservative garbage
+ collector, but we working on incorporating the ORP GC engine.
+
+** Executing MSIL/CIL images
+
+ The code will load an executable and map the references to
+ external assemblies to our own version of the assemblies on
+ Linux.
+
+ Our roadmap looks like this, this has been updated as of
+ <b>Dec 18, 2001</b>:
+
+ <ul>
+
+ * Milestone 1: <b>Done</b> Fully read and parse all CIL byte-codes
+ and metadata tokens (ie, a disassembler).
+
+ * Milestone 2: <b>Done</b> Complete an interpreter for CIL byte
+ codes. This interpreter can be used temporarly to
+ run CIL byte code on a system where no JIT is
+ available.
+
+ * Milestone 3: <b>Done</b>Define an <i>lburg</i>-like
+ instruction selector for the JITer for Intel.
+
+ * Milestone 4: <b>Done</b> Implement JITer. This is where our
+ current efforts are focused on, the JITer currently runs
+ all of the code we have tested on it. The major limitation
+ is that our class libraries are not complete, and hence not
+ every application can be ran.
+
+ * Milestone 5: Port of the JITer to non IA32 systems.
+ </ul>
+
+ A setup similar to the Kaffe JIT engine will be used to
+ layout the code to support non-IA32 architectures. Our work
+ will be focused on getting a IA32 version running first.
+
+ The JIT engine works on Linux and Win32, although you
+ will need to install the CygWin32 development tools to get a
+ Unix-like compilation environment (mostly we use GNU make in
+ a few of the makefiles).
+
+** JIT Engine (<b>updated, April 21, 2002</b>)
+
+ The JIT engine uses a code-generator generator approach for
+ compilation. Given the properties of CIL byte codes, we can
+ take full advantage of a real instruction selector for our
+ code generator.
+
+ The JIT engine implements a number of optimizations:
+
+ <ul>
+ * Opcode cost estimates (our architecture allows
+ us to generate different code paths depending
+ on the target CPU dynamically).
+
+ * Inlining.
+
+ * Constant folding.
+
+ Although compilers typically do
+ constant folding, the combination of inlining with
+ constant folding gives some very good results.
+ </ul>
+
+ There are a couple of books that deal with this technique: "A
+ Retargetable C Compiler" and "Advanced Compiler Design and
+ Implementation" are good references. You can also get a
+ technical description of <a
+ href="http://research.microsoft.com/copyright/accept.asp?path=http://www.research.microsoft.com/~drh/pubs/iburg.pdf&pub=ACM">lbrug</a>.
+
+ A few papers that describe the instruction selector:
+
+ <ul>
+ * <a href="http://research.microsoft.com/copyright/accept.asp?path=http://www.research.microsoft.com/~drh/pubs/interface.pdf&pub=wiley">A code generation interface for ANSI C</a>
+
+
+ * <a href="http://research.microsoft.com/copyright/accept.asp?path=http://www.research.microsoft.com/~drh/pubs/iburg.pdf&pub=ACM">Engineering efficient code generators using tree matching and dynamic programming.</a>
+
+ </ul>
+
+** Future plans
+
+ We are evaluating the future directions for the JIT engine:
+ both from our needs (optimizations like inlining, better register allocation,
+ instruction scheduling, and porting to other CPUs).
+
+ We have not yet decided how we will evolve the JIT engine. We
+ might just upgrade our current architecture, and provide optimizations as
+ an extra layer.
+
+** Garbage Collection
+
+ Currently we are using the Boehm conservative GC. Although our plans
+ are to move to the Intel ORP GC engine, our plans on a next generation
+ dual-JIT engine have to be taken into account.
+
+ We will be using the Intel ORP GC engine as it provides a precise
+ garbage collector engine, similar to what is available on the
+ .NET environment.
+
+ Although using a conservative garbage collector like Bohem's
+ would work, all the type information is available at runtime,
+ so we can actually implement a better collector than a
+ conservative collector.
+
+ <ul>
+ * Garbage collection list and FAQ:<br>
+ <a href="http://www.iecc.com/gclist/">http://www.iecc.com/gclist/</a>
+
+ * "GC points in a Threaded Environment":<br>
+ <a href="http://research.sun.com/techrep/1998/abstract-70.html">
+ http://research.sun.com/techrep/1998/abstract-70.html</a>
+
+ * "A Generational Mostly-concurrent Garbage Collector":
+ <a href="http://research.sun.com/techrep/2000/abstract-88.html">
+ http://research.sun.com/techrep/2000/abstract-88.html</a>
+
+ * Details on The Microsoft .NET Garbage Collection Implementation:<br>
+ <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI.asp</a>
+ <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI2.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI2.asp</a>
+ </ul>
+
+** IO and threading
+
+ The ECMA runtime and the .NET runtime assume an IO model and a
+ threading model that is very similar to the Win32 API.
+
+ Dick Porter has been working on the Mono abstraction layer
+ that allows our runtime to execute code that depend on this
+ behaviour.
+
+** Useful links
+
+ Paolo Molaro found a few interesting links:
+
+ <ul>
+ * On compilation of stack-based languages:<br>
+ <a href="http://www.complang.tuwien.ac.at/projects/rafts.html">
+ http://www.complang.tuwien.ac.at/projects/rafts.html</a>
+
+ * A paper on fast JIT compilation of a stack-based language:<br>
+ <a href="http://www.research.microsoft.com/~cwfraser/pldi99codegen.pdf">
+ http://www.research.microsoft.com/~cwfraser/pldi99codegen.pdf</a>
+
+ * Vmgen generates much of the code for efficient virtual machine (VM)
+ interpreters from simple descriptions of the VM instructions:<br>
+ <a href="http://www.complang.tuwien.ac.at/anton/vmgen/">
+ http://www.complang.tuwien.ac.at/anton/vmgen</a>
+ </ul>
+
+** PInvoke
+
+ PInvoke is the mechanism we are using to wrap Unix API calls
+ as well as talking to system libraries.
+
+ Initially we used libffi, but it was fairly slow, so we have
+ reused parts of the JIT work to create efficient PInvoke trampolines.
+
+** Remoting
+
+ Mono has support for remoting and proxy objects, just like
+ .NET does. The runtime provides these facilities.
+
+** Porting
+
+ If you are interested in porting the Mono runtime to other
+ platforms, you might find the pre-compiled <a
+ href="archive/mono-tests.tar.gz">Mono regression test
+ suite</a> useful to debug your implementation.
+
+* COM and XPCOM
+
+ We plan on adding support for XPCOM on Unix and COM on Microsoft
+ Windows later in our development process.
+
diff --git a/doc/status b/doc/status
new file mode 100644
index 00000000000..f175d7b0890
--- /dev/null
+++ b/doc/status
@@ -0,0 +1,40 @@
+* Project Status
+
+
+ Pieces of Mono that have been implemented:
+
+ <ul>
+ * C# compiler: The C# compiler is mostly complete, a
+ few features are still missing (for a list, check the
+ <a href="c-sharp.html">C# compiler</a> web page.
+
+ * The Mono JIT engine (<b>mono</b>. The JIT engine is
+ the real
+ virtual machine that we support. It is
+ functionaly currently, and we are improving its speed,
+ and making it feature complete.
+
+ * A CIL bytecode interpreter (<b>mint</b>). This
+ currently can be used to run most .NET programs
+ (modulo the fact that our class libraries are not
+ complete enough).
+
+ <b>mint</b> can currently run the Mono C# compiler and
+ the compiler generates valid code.
+
+ We use <b>mint</b> as a reference implementation of
+ the runtime environment and to quickly support
+ non-Intel platforms.
+
+ * Metadata library: Can currently parse
+ and load information from .NET modules (executables
+ and DLL files).
+
+ * Disassembler: Can disassemble .NET modules. Still
+ lacking exception handling as well as useful debugging
+ tools (hex dumping, token dumping).
+
+ * Class Libraries: You can check the current status in the
+ <a href="class-status.html">Class Status page</a>.
+ </ul>
+
diff --git a/doc/team b/doc/team
new file mode 100644
index 00000000000..eff7bc9d3d5
--- /dev/null
+++ b/doc/team
@@ -0,0 +1,2 @@
+* The MonoNet Team
+
diff --git a/doc/testing b/doc/testing
new file mode 100644
index 00000000000..f97902ec306
--- /dev/null
+++ b/doc/testing
@@ -0,0 +1,46 @@
+* Testing
+
+ Testing is an important part of the Mono project: every one of its
+ three major components has a test suite tailored for its needs. This
+ is very helpful, because in the course of developing the software it
+ is very common to introduce bugs in existing code. A test suite
+ helps us fix the bugs as soon as they are introduced.
+
+** Class Library Tests
+
+ All classes in Mono libraries should have comprehensive unit test
+ suites to go with them. Unit testing is a software engineering
+ methodology that makes it easier to build correct code. Every
+ method in every class should have a set of tests to verify
+ that they work correctly. Mono also needs a testing framework
+ to make it easy to write and run lots of tests.
+
+ Try <a href="http://nunit.sourceforge.net">NUnit</a>
+
+ Why do unit testing? It becomes simple to run automated tests
+ for the whole library. Unit tests are a safety net - you can
+ change part of the code and verify that you haven't broken
+ anything. Ideally, tests are written before the actual library
+ code itself. And every time a bug is discovered, a test should
+ be written to demonstrate the bug and its fix. Then, if
+ you ever reintroduce the bug, you will know immediately. For
+ more info, read <a
+ href="http://junit.sourceforge.net/doc/testinfected/testing.htm">
+ JUnit Test Infected: Programmers Love Writing Tests</a>.
+
+
+** Getting Started
+
+ We welcome all contributions to the Class Libary Test Suite.
+
+ There is information to help you get started in CVS at
+ mcs/class/doc/NUnitGuidelines. Once you have written your test, please
+ post it to <a href="mailing-lists.html">mono-list</a>.
+
+ Someone will make sure to add the file or apply the patch as
+ appropriate. If you plan to be an on-going contributor and
+ would like to get cvs account, email <a href="mailto:miguel@ximian.com">miguel</a>.
+
+ Normally, after you send a couple of well-written new files
+ and/or patches to the list, you will be given cvs access.
+
diff --git a/doc/thanks b/doc/thanks
new file mode 100644
index 00000000000..5f2df36f9cd
--- /dev/null
+++ b/doc/thanks
@@ -0,0 +1,6 @@
+* Thanks
+
+ We would like to thank Tim O'Reilly, Brian Jepson and Nathan
+ Torkington for their help.
+
+ Dave Winer for provided interesting comments and a to read.
diff --git a/doc/todo b/doc/todo
new file mode 100644
index 00000000000..abae8cdfb40
--- /dev/null
+++ b/doc/todo
@@ -0,0 +1 @@
+Discuss with write new JIT \ No newline at end of file
diff --git a/doc/tools b/doc/tools
new file mode 100644
index 00000000000..eabef48bb88
--- /dev/null
+++ b/doc/tools
@@ -0,0 +1,67 @@
+* Tools
+
+ We need a number of tools to make people productive using a
+ Mono-based solution. Some of these tools can be developed on
+ Windows before Mono is fully finished.
+
+ All of these tools should be written using C#.
+
+ For the tools that are typically command line tools: Try to
+ write these as components that could load their input from
+ streams or collections of streams, and implement the command
+ line tools as wrappers around those classes.
+
+ For example, we will be making the C# compiler a component
+ that could be reused by applications that might have a use for
+ the various bits of the compiler (either to embed the
+ compiler, or reuse the code generator part of it).
+
+ This is important so that these components (compiler,
+ assembler, linker, etc) can be integrated later into the
+ visual development environment (hopefully with the help of the
+ SharpDevelop hackers).
+
+TODO=ilasm,IL Assembler
+** IL Assembler.
+
+ This assembler should basically take as input a file
+ containing IL bytecodes as specified in the `Partition II' of
+ the ECMA spec, and produce a binary file.
+
+TODO=al,Assembly Linker
+** Assembly Linker.
+
+ This tool is used to construct assemblies, which are basically
+ deployment units for CLI executables.
+
+TODO=debugger,Debugger
+** Debugger
+
+ We will need a debugging API to debug CLI applications and
+ then a debugger component that can be used in an IDE
+ environment.
+
+TODO=ide,Integrated Development Environment
+** Integrated Development Environment
+
+ There is already a project to create a C# development
+ environment: <a
+ href="http://www.icsharpcode.net/OpenSource/SD/default.asp">SharpDevelop</a>.
+ People should work with the SharpDevelop hackers to produce a
+ unified development environment.
+
+ Please work with the SharpDevelop hackers to build a good IDE.
+ We will work on creating an embedable compiler component and
+ an embeddable debugger component that can be used withing
+ SharpDevelop
+
+TODO=hbrowser,Help Browser
+** Help Browser
+
+ We need a good help browser that can be used to browse
+ documentation. Ideally this help browser can accept as input
+ XML Docbook input and an assorted set of file formats
+ (Microsoft Help, Unix manual pages, Unix Info pages)
+
+ Look at the GNOME DevHelp for a good set of ideas on how to
+ implement this. \ No newline at end of file
diff --git a/doc/web/.cvsignore b/doc/web/.cvsignore
new file mode 100644
index 00000000000..a023a6f9c7c
--- /dev/null
+++ b/doc/web/.cvsignore
@@ -0,0 +1,2 @@
+*.src
+*.html
diff --git a/doc/web/commands b/doc/web/commands
new file mode 100644
index 00000000000..bb05fc861cb
--- /dev/null
+++ b/doc/web/commands
@@ -0,0 +1,40 @@
+0,Home,index.html,index.src
+1,FAQ,faq.html,faq.src
+0,Mono,rationale.html,rationale.src
+1,Runtime,runtime.html,runtime.src
+1,Classes,class-library.html,class-library.src
+1,Gtk#,http://gtk-sharp.sourceforge.net
+1,Class Status,class-status.html,class-status.src,cm/cormissing.css,cm/cormissing.js
+2,corlib,class-status-corlib.html,class-status-corlib.src,cm/cormissing.css,cm/cormissing.js
+2,System,class-status-System.html,class-status-System.src,cm/cormissing.css,cm/cormissing.js
+2,System.Xml,class-status-System.Xml.html,class-status-System.Xml.src,cm/cormissing.css,cm/cormissing.js
+2,System.Data,class-status-System.Data.html,class-status-System.Data.src,cm/cormissing.css,cm/cormissing.js
+2,System.Web,class-status-System.Web.html,class-status-System.Web.src,cm/cormissing.css,cm/cormissing.js
+1,C# Compiler,c-sharp.html,c-sharp.src
+1,Debugging,jit-debug.html,jit-debug.src
+2,Example 1,jit-debug-sample.html,jit-debug-sample.src
+2,Example 2,jit-debug-sample2.html,jit-debug-sample2.src
+1,Status,status.html,status.src
+0,Download,download.html,download.src
+1,CVS access,ccvs.html,ccvs.src
+1,AnonCVS access,anoncvs.html,anoncvs.src
+0,Contributing,contributing.html,contributing.src
+1,Documentation,documentation.html,documentation.src
+1,Class Docs,classlib-doc.html,classlib-doc.src
+1,Doc format,monodoc-xml.html,monodoc-xml.src
+1,Test Suite,testing.html,testing.src
+1,Tools,tools.html,tools.src
+1,Porting,porting.html,porting.src
+0,Plans,plans.html,plans.src
+1,ADO.NET,ado-net.html,ado-net.src
+1,ASP.NET,asp-net.html,asp-net.src
+1,Java,java.html,java.src
+1,Windows.Forms,winforms.html,winforms.src
+0,Resources,resources.html,resources.src
+1,Mailing Lists,mailing-lists.html,mailing-lists.src
+1,Ideas,ideas.html,ideas.src
+1,Passport,passport.html,passport.src
+1,Books,books.html,books.src
+1,Papers,papers.html,papers.src
+1,Languages,languages.html,languages.src
+0,Contact,contact.html,contact.src
diff --git a/doc/web/deploy/.cvsignore b/doc/web/deploy/.cvsignore
new file mode 100755
index 00000000000..2d19fc766d9
--- /dev/null
+++ b/doc/web/deploy/.cvsignore
@@ -0,0 +1 @@
+*.html
diff --git a/doc/web/deploy/cm/c.gif b/doc/web/deploy/cm/c.gif
new file mode 100644
index 00000000000..02c347efd0b
--- /dev/null
+++ b/doc/web/deploy/cm/c.gif
Binary files differ
diff --git a/doc/web/deploy/cm/cormissing.css b/doc/web/deploy/cm/cormissing.css
new file mode 100644
index 00000000000..1f22da54273
--- /dev/null
+++ b/doc/web/deploy/cm/cormissing.css
@@ -0,0 +1,182 @@
+.y IMG
+{
+ border: 0px;
+ padding: 0px;
+ margin: 0px;
+ margin-right: 4px;
+ vertical-align: middle;
+}
+
+.y, .y_,
+.n, .n_,
+.c, .c_,
+.c, .c_,
+.d, .d_,
+.en, .en_,
+.i, .i_,
+.s, .s_,
+.e, .e_,
+.f, .f_,
+.m, .m_,
+.o, .o_,
+.p, .p_,
+.r, .r_,
+.x, .x_
+{
+ FONT: 10px 'Verdana';
+ margin-left: 20px;
+}
+
+.y_ .n,
+.y_ .n_,
+.n_ .c,
+.n_ .c_,
+.n_ .s,
+.n_ .s_,
+.n_ .d,
+.n_ .d_,
+.n_ .en,
+.n_ .en_,
+.n_ .i,
+.n_ .i_,
+.c_ .c,
+.c_ .c_,
+.c_ .e,
+.c_ .e_,
+.c_ .f,
+.c_ .f_,
+.c_ .m,
+.c_ .m_,
+.c_ .o,
+.c_ .o_,
+.c_ .p,
+.c_ .p_,
+.c_ .r,
+.c_ .r_,
+.c_ .x,
+.c_ .x_,
+.c_ .i,
+.c_ .i_,
+.d_ .c,
+.d_ .c_,
+.d_ .e,
+.d_ .e_,
+.d_ .f,
+.d_ .f_,
+.d_ .m,
+.d_ .m_,
+.d_ .o,
+.d_ .o_,
+.d_ .p,
+.d_ .p_,
+.d_ .r,
+.d_ .r_,
+.d_ .x,
+.d_ .x_,
+.en_ .c,
+.en_ .c_,
+.en_ .e,
+.en_ .e_,
+.en_ .f,
+.en_ .f_,
+.en_ .m,
+.en_ .m_,
+.en_ .o,
+.en_ .o_,
+.en_ .p,
+.en_ .p_,
+.en_ .r,
+.en_ .r_,
+.en_ .x,
+.en_ .x_,
+.i_ .c,
+.i_ .c_,
+.i_ .e,
+.i_ .e_,
+.i_ .f,
+.i_ .f_,
+.i_ .m,
+.i_ .m_,
+.i_ .o,
+.i_ .o_,
+.i_ .p,
+.i_ .p_,
+.i_ .r,
+.i_ .r_,
+.i_ .x,
+.i_ .x_,
+.i_ .i,
+.i_ .i_,
+.s_ .c,
+.s_ .c_,
+.s_ .e,
+.s_ .e_,
+.s_ .f,
+.s_ .f_,
+.s_ .m,
+.s_ .m_,
+.s_ .o,
+.s_ .o_,
+.s_ .p,
+.s_ .p_,
+.s_ .r,
+.s_ .r_,
+.s_ .x,
+.s_ .x_,
+.s_ .i,
+.s_ .i_,
+
+.e_ .r,
+.e_ .r_,
+.e_ .o,
+.e_ .o_,
+.f_ .r,
+.f_ .r_,
+.f_ .o,
+.f_ .o_,
+.m_ .r,
+.m_ .r_,
+.m_ .o,
+.m_ .o_,
+.o_ .r,
+.o_ .r_,
+.o_ .o,
+.o_ .o_,
+.p_ .r,
+.p_ .r_,
+.p_ .o,
+.p_ .o_,
+.r_ .r,
+.r_ .r_,
+.r_ .o,
+.r_ .o_,
+.x_ .r,
+.x_ .r_,
+.x_ .o,
+.x_ .o_
+{
+ display: none;
+}
+
+.t
+{
+ cursor: pointer;
+ margin-right: 8px;
+}
+
+.filter
+{
+ cursor: pointer;
+ vertical-align: middle;
+}
+
+
+.st
+{
+ margin-left: 20px;
+}
+
+.l
+{
+ cursor: pointer;
+}
diff --git a/doc/web/deploy/cm/cormissing.js b/doc/web/deploy/cm/cormissing.js
new file mode 100644
index 00000000000..e6b12ac4fd2
--- /dev/null
+++ b/doc/web/deploy/cm/cormissing.js
@@ -0,0 +1,392 @@
+function toggle (elt)
+{
+ if (elt == null)
+ return;
+
+ var eltLink = elt.firstChild;
+ if (eltLink != null && eltLink.className == 't') // toggle
+ {
+ var ich = elt.className.indexOf ('_');
+ if (ich < 0)
+ {
+ eltLink.src = 'cm/tp.gif';
+ elt.className += '_';
+ }
+ else
+ {
+ eltLink.src = 'cm/tm.gif';
+ elt.className = elt.className.slice (0, ich);
+ }
+ }
+}
+
+function setView (elt, fView)
+{
+ var eltLink = elt.firstChild;
+ if (eltLink != null && eltLink.className == 't') // toggle
+ {
+ var ich = elt.className.indexOf ('_');
+ if (ich < 0 && !fView)
+ {
+ eltLink.src = 'cm/tp.gif';
+ elt.className += '_';
+ }
+ else if (ich >= 0 && fView)
+ {
+ eltLink.src = 'cm/tm.gif';
+ elt.className = elt.className.slice (0, ich);
+ }
+ }
+}
+
+function trimSrc (strSrc)
+{
+ return strSrc.slice (strSrc.lastIndexOf ('/') + 1, strSrc.lastIndexOf ('.'));
+}
+
+function getChildrenByTagName (elt, strTag)
+{
+ strTag = strTag.toLowerCase ();
+ var rgChildren = new Array ();
+ var eltChild = elt.firstChild;
+ while (eltChild)
+ {
+ if (eltChild.tagName && eltChild.tagName.toLowerCase () == strTag)
+ rgChildren.push (eltChild);
+ eltChild = eltChild.nextSibling;
+ }
+ return rgChildren;
+}
+
+function viewAll (elt, dictTypes)
+{
+ var fView = false;
+ var rgImages = getChildrenByTagName (elt, 'IMG');
+ var cImages = rgImages.length;
+ for (var iImage = 0; iImage < cImages; iImage++)
+ {
+ var strImage = trimSrc (rgImages [iImage].src);
+ if (dictTypes [strImage])
+ {
+ fView = true;
+ break;
+ }
+ }
+ var rgElts = getChildrenByTagName (elt, 'DIV');
+ var cElts = rgElts.length;
+ if (cElts != 0)
+ {
+ var iElt;
+ for (iElt = 0; iElt < cElts; iElt ++)
+ fView |= viewAll (rgElts [iElt], dictTypes);
+ }
+ elt.style.display = fView ? '' : 'none';
+ return fView;
+}
+
+function getView (elt)
+{
+ var eltLink = elt.firstChild;
+ if (eltLink != null && eltLink.className == 't') // toggle
+ {
+ var ich = elt.className.indexOf ('_');
+ if (ich < 0)
+ return true;
+ }
+ return false;
+}
+
+function getParentDiv (elt)
+{
+ if (elt)
+ {
+ do
+ {
+ elt = elt.parentNode;
+ }
+ while (elt && elt.tagName != 'DIV');
+ }
+
+ return elt;
+}
+
+function getName (elt)
+{
+ var rgSpans = getChildrenByTagName (elt, 'SPAN');
+ for (var iSpan = 0; iSpan < rgSpans.length; iSpan ++)
+ {
+ var span = rgSpans [iSpan];
+ if (span.className == 'l') // label
+ {
+ if (span.innerText)
+ return span.innerText;
+ else
+ return span.firstChild.nodeValue;
+ }
+ }
+ return null;
+}
+
+function clickHandler (evt)
+{
+ var elt;
+ if (document.layers)
+ elt = evt.taget;
+ else if (window.event && window.event.srcElement)
+ {
+ elt = window.event.srcElement;
+ evt = window.event;
+ }
+ else if (evt && evt.stopPropagation)
+ elt = evt.target;
+
+ if (!elt.className && elt.parentNode)
+ elt = elt.parentNode;
+
+ if (elt.className == 'l') // label
+ {
+ var strClass;
+ var strField;
+ var strNamespace;
+ var strAssembly;
+
+ elt = getParentDiv (elt);
+ var strEltClass = elt.className;
+ if (strEltClass.charAt (strEltClass.length - 1) == '_')
+ strEltClass = strEltClass.slice (0, strEltClass.length - 1);
+
+ if (strEltClass == 'x') // constructor
+ {
+ strField = 'ctor';
+ elt = getParentDiv (elt);
+ }
+ else
+ if (strEltClass == 'm' || // method
+ strEltClass == 'p' || // property
+ strEltClass == 'e' || // event
+ strEltClass == 'f') // field
+ {
+ strField = getName (elt).toLowerCase ();
+ var match = strField.match ( /[\.A-Z0-9_]*/i );
+ if (match)
+ strField = match [0];
+ elt = getParentDiv (elt);
+
+ }
+
+ var strEltClass = elt.className;
+ if (strEltClass.charAt (strEltClass.length - 1) == '_')
+ strEltClass = strEltClass.slice (0, strEltClass.length - 1);
+
+ if (strEltClass == 'c' || // class
+ strEltClass == 's' || // struct
+ strEltClass == 'i' || // struct
+ strEltClass == 'd' || // delegate
+ strEltClass == 'en') // enum
+ {
+ strClass = getName (elt);
+ if (strEltClass == 'en')
+ strField = null;
+ elt = getParentDiv (elt);
+ }
+
+ var strEltClass = elt.className;
+ if (strEltClass.charAt (strEltClass.length - 1) == '_')
+ strEltClass = strEltClass.slice (0, strEltClass.length - 1);
+
+ if (strEltClass == 'n')
+ {
+ strNamespace = getName (elt);
+ elt = getParentDiv (elt);
+ }
+
+ var strEltClass = elt.className;
+ if (strEltClass.charAt (strEltClass.length - 1) == '_')
+ strEltClass = strEltClass.slice (0, strEltClass.length - 1);
+
+ if (strEltClass == 'y')
+ {
+ strAssembly = getName (elt);
+ }
+
+ if (evt.ctrlKey)
+ {
+ var strRoot = 'http://cvs.hispalinux.es/cgi-bin/cvsweb/mcs/class/';
+ var strExtra = '?cvsroot=Mono';
+
+ if (strAssembly)
+ {
+ strRoot = strRoot + strAssembly + '/';
+ if (strNamespace)
+ {
+ strRoot = strRoot + strNamespace + '/';
+ if (strClass)
+ {
+ strRoot += strClass + '.cs';
+ strExtra += '&rev=1';
+ }
+ }
+ window.open (strRoot + strExtra, 'CVS');
+ }
+ }
+ else if (strNamespace)
+ {
+ var re = /\./g ;
+ strNamespace = strNamespace.toLowerCase ().replace (re, '');
+ if (strClass)
+ strNamespace += strClass.toLowerCase () + 'class';
+ if (strField)
+ strNamespace += strField;
+ if (strClass || strField)
+ strNamespace += 'topic';
+
+ window.open ('http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrf' + strNamespace + '.asp', 'MSDN');
+ }
+ }
+ else
+ {
+ if (elt.parentNode && elt.parentNode.className == 't') // toggle
+ elt = elt.parentNode;
+ else if (elt.className != 't') // toggle
+ return;
+
+ while (elt != null && elt.tagName != 'DIV')
+ elt = elt.parentNode;
+
+ if (evt.shiftKey)
+ {
+ var rgElts = getChildrenByTagName (elt, 'DIV');
+ var cElts = rgElts.length;
+ if (cElts != 0)
+ {
+ var fView = false;
+ var iElt;
+ for (iElt = 0; iElt < cElts; iElt ++)
+ {
+ if (getView (rgElts [iElt]))
+ {
+ fView = true;
+ break;
+ }
+ }
+ for (iElt = 0; iElt < cElts; iElt ++)
+ {
+ setView (rgElts [iElt], !fView);
+ }
+ }
+ }
+ else if (evt.ctrlKey)
+ {
+ setView (elt, true);
+ var eltParent = getParentDiv (elt);
+ while (eltParent)
+ {
+ var rgSiblings = getChildrenByTagName (eltParent, 'DIV');
+ var cSiblings = rgSiblings.length;
+ for (var iSibling = 0; iSibling < cSiblings; iSibling++)
+ {
+ var eltSibling = rgSiblings [iSibling];
+ if (eltSibling != elt)
+ {
+ setView (eltSibling, false);
+ }
+ }
+ elt = eltParent;
+ eltParent = getParentDiv (elt);
+ }
+ }
+ else
+ toggle (elt);
+ }
+
+ return false;
+}
+
+function filterTree ()
+{
+ var eltMissing = document.getElementById ('missing');
+ var eltTodo = document.getElementById ('todo');
+ var eltExtra = document.getElementById ('extra');
+ var eltErrors = document.getElementById ('errors');
+
+ var dictTypes = new Object ();
+ if (eltMissing.checked)
+ dictTypes ['sm'] = true;
+ if (eltTodo.checked)
+ dictTypes ['st'] = true;
+ if (eltErrors.checked)
+ dictTypes ['se'] = true;
+ if (eltExtra.checked)
+ dictTypes ['sx'] = true;
+// dictTypes ['sc'] = true;
+
+ viewAll (document.getElementById ('ROOT'), dictTypes);
+}
+
+function selectMissing ()
+{
+ toggleFilter ('missing');
+}
+
+function selectTodo ()
+{
+ toggleFilter ('todo');
+}
+
+function selectExtra ()
+{
+ toggleFilter ('extra');
+}
+
+function selectErrors ()
+{
+ toggleFilter ('errors');
+}
+
+function toggleFilter (strFilter)
+{
+ var eltTodo = document.getElementById ('todo');
+ var eltMissing = document.getElementById ('missing');
+ var eltExtra = document.getElementById ('extra');
+ var eltErrors = document.getElementById ('errors');
+
+ var eltToggle = document.getElementById (strFilter);
+ if (window && window.event && window.event.shiftKey)
+ {
+ eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = false;
+ eltToggle.checked = true;
+ }
+ else
+ if (!eltTodo.checked && !eltMissing.checked && !eltExtra.checked && !eltErrors.checked)
+ {
+ eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = true;
+ eltToggle.checked = false;
+ }
+ filterTree ();
+}
+
+function onLoad ()
+{
+ var eltMissing = document.getElementById ('missing');
+ var eltTodo = document.getElementById ('todo');
+ var eltExtra = document.getElementById ('extra');
+ var eltErrors = document.getElementById ('errors');
+ eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = true;
+}
+
+if (document.layers)
+{
+ document.captureEvents (Event.MOUSEUP);
+ document.onmouseup = clickHandler;
+}
+else if (document.attachEvent)
+{
+ document.attachEvent('onclick', clickHandler);
+}
+else if (document.addEventListener)
+{
+ document.addEventListener('click', clickHandler, false);
+}
+else
+ document.onclick = clickHandler;
+
diff --git a/doc/web/deploy/cm/d.gif b/doc/web/deploy/cm/d.gif
new file mode 100644
index 00000000000..c9735952f33
--- /dev/null
+++ b/doc/web/deploy/cm/d.gif
Binary files differ
diff --git a/doc/web/deploy/cm/e.gif b/doc/web/deploy/cm/e.gif
new file mode 100644
index 00000000000..1137246bfae
--- /dev/null
+++ b/doc/web/deploy/cm/e.gif
Binary files differ
diff --git a/doc/web/deploy/cm/en.gif b/doc/web/deploy/cm/en.gif
new file mode 100644
index 00000000000..00026b77300
--- /dev/null
+++ b/doc/web/deploy/cm/en.gif
Binary files differ
diff --git a/doc/web/deploy/cm/f.gif b/doc/web/deploy/cm/f.gif
new file mode 100644
index 00000000000..f78a2f53bbc
--- /dev/null
+++ b/doc/web/deploy/cm/f.gif
Binary files differ
diff --git a/doc/web/deploy/cm/i.gif b/doc/web/deploy/cm/i.gif
new file mode 100644
index 00000000000..56cd032a565
--- /dev/null
+++ b/doc/web/deploy/cm/i.gif
Binary files differ
diff --git a/doc/web/deploy/cm/m.gif b/doc/web/deploy/cm/m.gif
new file mode 100644
index 00000000000..75fe3586d48
--- /dev/null
+++ b/doc/web/deploy/cm/m.gif
Binary files differ
diff --git a/doc/web/deploy/cm/n.gif b/doc/web/deploy/cm/n.gif
new file mode 100644
index 00000000000..f6fa746304d
--- /dev/null
+++ b/doc/web/deploy/cm/n.gif
Binary files differ
diff --git a/doc/web/deploy/cm/p.gif b/doc/web/deploy/cm/p.gif
new file mode 100644
index 00000000000..b79d0dd7edb
--- /dev/null
+++ b/doc/web/deploy/cm/p.gif
Binary files differ
diff --git a/doc/web/deploy/cm/r.gif b/doc/web/deploy/cm/r.gif
new file mode 100644
index 00000000000..a3ef0f38ef0
--- /dev/null
+++ b/doc/web/deploy/cm/r.gif
Binary files differ
diff --git a/doc/web/deploy/cm/s.gif b/doc/web/deploy/cm/s.gif
new file mode 100644
index 00000000000..f2fd5c8aee2
--- /dev/null
+++ b/doc/web/deploy/cm/s.gif
Binary files differ
diff --git a/doc/web/deploy/cm/sc.gif b/doc/web/deploy/cm/sc.gif
new file mode 100644
index 00000000000..b02afd9b2e0
--- /dev/null
+++ b/doc/web/deploy/cm/sc.gif
Binary files differ
diff --git a/doc/web/deploy/cm/se.gif b/doc/web/deploy/cm/se.gif
new file mode 100644
index 00000000000..1c46eaa5887
--- /dev/null
+++ b/doc/web/deploy/cm/se.gif
Binary files differ
diff --git a/doc/web/deploy/cm/sm.gif b/doc/web/deploy/cm/sm.gif
new file mode 100644
index 00000000000..0c7194786d5
--- /dev/null
+++ b/doc/web/deploy/cm/sm.gif
Binary files differ
diff --git a/doc/web/deploy/cm/st.gif b/doc/web/deploy/cm/st.gif
new file mode 100644
index 00000000000..067582cb398
--- /dev/null
+++ b/doc/web/deploy/cm/st.gif
Binary files differ
diff --git a/doc/web/deploy/cm/sx.gif b/doc/web/deploy/cm/sx.gif
new file mode 100644
index 00000000000..2c8ca547929
--- /dev/null
+++ b/doc/web/deploy/cm/sx.gif
Binary files differ
diff --git a/doc/web/deploy/cm/tb.gif b/doc/web/deploy/cm/tb.gif
new file mode 100644
index 00000000000..ee68c5a356b
--- /dev/null
+++ b/doc/web/deploy/cm/tb.gif
Binary files differ
diff --git a/doc/web/deploy/cm/tm.gif b/doc/web/deploy/cm/tm.gif
new file mode 100644
index 00000000000..3c8f18aecea
--- /dev/null
+++ b/doc/web/deploy/cm/tm.gif
Binary files differ
diff --git a/doc/web/deploy/cm/tp.gif b/doc/web/deploy/cm/tp.gif
new file mode 100644
index 00000000000..8b7435361b7
--- /dev/null
+++ b/doc/web/deploy/cm/tp.gif
Binary files differ
diff --git a/doc/web/deploy/cm/y.gif b/doc/web/deploy/cm/y.gif
new file mode 100644
index 00000000000..08f00d4ea11
--- /dev/null
+++ b/doc/web/deploy/cm/y.gif
Binary files differ
diff --git a/doc/web/deploy/images/bgsquares.gif b/doc/web/deploy/images/bgsquares.gif
new file mode 100644
index 00000000000..864bcd44038
--- /dev/null
+++ b/doc/web/deploy/images/bgsquares.gif
Binary files differ
diff --git a/doc/web/deploy/images/bgsquares.png b/doc/web/deploy/images/bgsquares.png
new file mode 100644
index 00000000000..a9e2bb94dbb
--- /dev/null
+++ b/doc/web/deploy/images/bgsquares.png
Binary files differ
diff --git a/doc/web/deploy/images/bgsquares.xcf.gz b/doc/web/deploy/images/bgsquares.xcf.gz
new file mode 100644
index 00000000000..200b5805615
--- /dev/null
+++ b/doc/web/deploy/images/bgsquares.xcf.gz
Binary files differ
diff --git a/doc/web/deploy/images/mono.gif b/doc/web/deploy/images/mono.gif
new file mode 100644
index 00000000000..298976a07b7
--- /dev/null
+++ b/doc/web/deploy/images/mono.gif
Binary files differ
diff --git a/doc/web/deploy/images/mono.png b/doc/web/deploy/images/mono.png
new file mode 100644
index 00000000000..21709009d60
--- /dev/null
+++ b/doc/web/deploy/images/mono.png
Binary files differ
diff --git a/doc/web/deploy/images/pixel.gif b/doc/web/deploy/images/pixel.gif
new file mode 100644
index 00000000000..a4f37d7e02e
--- /dev/null
+++ b/doc/web/deploy/images/pixel.gif
Binary files differ
diff --git a/doc/web/deploy/images/pixel.png b/doc/web/deploy/images/pixel.png
new file mode 100644
index 00000000000..85cfd14929a
--- /dev/null
+++ b/doc/web/deploy/images/pixel.png
Binary files differ
diff --git a/doc/web/htmlify b/doc/web/htmlify
new file mode 100644
index 00000000000..f3bff2d42d2
--- /dev/null
+++ b/doc/web/htmlify
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+$q = 1;
+
+while (<>){
+ chop;
+ if (/^\* (.*)$/){
+ print "<h1>$1</h1>\n";
+ } elsif (/^\*\* (.*)$/) {
+ print "<h2>$1</h2>\n";
+ } elsif (/^\*\*\* (.*)$/) {
+ print "<h3>$1</h3>\n";
+ } elsif (/^\*\*\*\* (.*)$/) {
+ print "<h4>$1</h4>\n";
+ } elsif (/^$/) {
+ print "<p>\n";
+ } elsif (/^\t\t\* (.*)$/) {
+ print "<li>$1\n";
+ } elsif (/^Q: (.*)$/){
+ print "<p><a name=\"q$q\"></a><b>Question $q:</b> $1\n";
+ $q++;
+ } elsif (/^A: (.*)$/){
+ print "$1\n";
+ } elsif (/^TODO=(.*),$/){
+ print "<a name=\"$1\">\n";
+ } else {
+ print "$_\n";
+ }
+}
diff --git a/doc/web/icaza.pl b/doc/web/icaza.pl
new file mode 100644
index 00000000000..ce8b87c44da
--- /dev/null
+++ b/doc/web/icaza.pl
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+$q = 1;
+
+# Modified by Edwin Lima (edwinlima@hotmail.com; edwin.lima@nec-computers.com)
+# Date: 08/21/01, The Netherlands
+# $f: Variable used as a flag to create the list of questions on top of the question-answers set. This
+# is the only way that I found to scan the questions which have a <CR><LF>, in such a way that I will not
+# scan the answer together at same time.
+# @aname: Buffer used to store the question-answers set to print them out just after the print of the
+# questions.
+# @href: Buffer used to store the anchors (only questions) to the questions-answers set on the bottom
+# of the page.
+# I opened explicitly the file for input (input.txt) but U can change this as it was originally.
+#
+#
+
+#comment this line if you are not open the file explicitly
+#open(IN, "input.txt") || die "cannot open file input.txt" ;
+
+print("<A name=TOP>") ;
+
+#Uncomment line bellow to make it work as it was originally.
+while (<>){
+
+#comment line bellow
+
+#while (<IN>){
+ chop;
+ if (/^\* (.*)$/){
+ push(@aname,"<h1>$1</h1>\n");
+# print $body;
+ } elsif (/^\*\* (.*)$/) {
+ push(@aname, "<h2>$1</h2>\n");
+ push(@href, "<h2>$1</h2>\n");
+ } elsif (/^\*\*\* (.*)$/) {
+ push(@aname, "<h3>$1</h3>\n");
+
+ } elsif (/^$/) {
+ push(@aname, "<p>\n");
+# push(@href, "<p>\n"); NOT NEEDED
+ } elsif (/^\t\t\* (.*)$/) {
+ push(@aname, "<li>$1\n");
+ } elsif (/^Q: (.*)$/){
+ push(@aname, "<p><a name=\"q$q\"></a><b>Question $q:</b> $1\n");
+ push(@href,"<p><a href=\"#q$q\"><b>Question $q:</b></a> $1\n");
+ $f=1;
+ $q++;
+ } elsif (/^A: (.*)$/){
+ push(@aname,"<P>\n<A HREF=#TOP>Top</A>\n<P>");
+ push(@aname,"$1\n");
+ $f=0;
+ } elsif (/^TODO=(.*),$/){
+ push(@aname, "<a name=\"$1\">\n");
+ #push(@href, "<a name=\"$1\">\n");
+ } else {
+ push(@aname,"$_\n");
+ if ($f==1) {
+ push(@href,"$_\n");
+ }
+ }
+}
+
+foreach $line (@href) #"\n\n";
+{
+ print $line;
+ }
+
+foreach $line (@aname) #"\n\n";
+{
+ print $line;
+ }
+
+
+#comment this line if you are not open the file explicitly
+# close(IN) || die "cannot close file" ;
+
diff --git a/doc/web/images/bgsquares.gif b/doc/web/images/bgsquares.gif
new file mode 100644
index 00000000000..864bcd44038
--- /dev/null
+++ b/doc/web/images/bgsquares.gif
Binary files differ
diff --git a/doc/web/images/bgsquares.png b/doc/web/images/bgsquares.png
new file mode 100644
index 00000000000..54de2ad1e6d
--- /dev/null
+++ b/doc/web/images/bgsquares.png
Binary files differ
diff --git a/doc/web/images/bgsquares.xcf.gz b/doc/web/images/bgsquares.xcf.gz
new file mode 100644
index 00000000000..200b5805615
--- /dev/null
+++ b/doc/web/images/bgsquares.xcf.gz
Binary files differ
diff --git a/doc/web/images/mono.gif b/doc/web/images/mono.gif
new file mode 100644
index 00000000000..298976a07b7
--- /dev/null
+++ b/doc/web/images/mono.gif
Binary files differ
diff --git a/doc/web/images/mono.png b/doc/web/images/mono.png
new file mode 100644
index 00000000000..a19e38acedd
--- /dev/null
+++ b/doc/web/images/mono.png
Binary files differ
diff --git a/doc/web/images/pixel.gif b/doc/web/images/pixel.gif
new file mode 100644
index 00000000000..a4f37d7e02e
--- /dev/null
+++ b/doc/web/images/pixel.gif
Binary files differ
diff --git a/doc/web/images/pixel.png b/doc/web/images/pixel.png
new file mode 100644
index 00000000000..d8f33a2a3e4
--- /dev/null
+++ b/doc/web/images/pixel.png
Binary files differ
diff --git a/doc/web/makefile b/doc/web/makefile
new file mode 100644
index 00000000000..586e4000ddd
--- /dev/null
+++ b/doc/web/makefile
@@ -0,0 +1,100 @@
+CSCRIPT = $(SYSTEMROOT)/system32/cscript.exe
+
+CORCOMPARE=../../../mcs/tools/corcompare
+
+OBJECTS= \
+ deploy/ado-net.html \
+ deploy/anoncvs.html \
+ deploy/asp-net.html \
+ deploy/books.html \
+ deploy/contributing.html \
+ deploy/class-status.html \
+ deploy/class-status-corlib.html \
+ deploy/class-status-System.Xml.html \
+ deploy/class-status-System.Data.html \
+ deploy/class-status-System.Web.html \
+ deploy/class-library.html \
+ deploy/classlib-doc.html \
+ deploy/contact.html \
+ deploy/c-sharp.html \
+ deploy/ccvs.html \
+ deploy/documentation.html \
+ deploy/download.html \
+ deploy/faq.html \
+ deploy/gcc-frontend.html \
+ deploy/index.html \
+ deploy/ideas.html \
+ deploy/java.html \
+ deploy/jit-debug.html \
+ deploy/jit-debug-sample.html \
+ deploy/jit-debug-sample2.html \
+ deploy/languages.html \
+ deploy/mailing-lists.html \
+ deploy/monodoc-xml.html \
+ deploy/papers.html \
+ deploy/passport.html \
+ deploy/plans.html \
+ deploy/porting.html \
+ deploy/rationale.html \
+ deploy/resources.html \
+ deploy/roadmap.html \
+ deploy/runtime.html \
+ deploy/status.html \
+ deploy/testing.html \
+ deploy/tools.html \
+ deploy/winforms.html
+
+# deploy/class-status-System.html \
+
+NON_HTML_SOURCES= \
+ ../mono-build.sh \
+ ../mono-build-w32.sh
+
+
+all: $(OBJECTS)
+ perl process.pl commands template.html.in deploy
+
+clean:
+ rm -f $(OBJECTS) $(patsubst deploy/%.html,src/%.src, $(OBJECTS)) src/*.xml src/*.html.in ../class-status-* ../class-status
+
+push:
+ cp -f $(NON_HTML_SOURCES) deploy
+ echo scp -P 2200 -r deploy/* www@www.ximian.com:/web/cvsmodules/mono
+ (cd deploy; rsync --verbose --recursive --checksum --update --rsh='ssh -p 2200' . www@www.ximian.com:/web/cvsmodules/mono )
+
+push2:
+ scp -r deploy/* primates:public_html/xxx
+
+$(OBJECTS): $(patsubst deploy/%.html,src/%.src, $(OBJECTS))
+
+#.PRECIOUS: $(patsubst deploy/%.html,src/%.src, $(OBJECTS))
+
+
+
+.PRECIOUS: src/%.src
+src/%.src: ../% commands makefile template.html.in
+ perl htmlify $< > $@
+
+
+
+.PRECIOUS: ../class-status-%
+../class-status-%: src/%.html.in ../class-status.in
+ cat ../class-status.in $< > $@
+
+
+.PRECIOUS: src/%.html.in
+src/%.html.in: src/%.xml $(CORCOMPARE)/transform.js $(CORCOMPARE)/cormissing.xsl
+ $(CSCRIPT) /nologo $(CORCOMPARE)/transform.js $< $(CORCOMPARE)/cormissing.xsl > $@
+
+
+
+.PRECIOUS: src/%.xml
+src/%.xml: ../../../mcs/class/lib/%.dll $(CORCOMPARE)/CorCompare.exe
+ $(CORCOMPARE)/CorCompare.exe -x $@ $<
+
+src/corlib.xml: ../../../mcs/class/lib/corlib_cmp.dll $(CORCOMPARE)/CorCompare.exe
+ $(CORCOMPARE)/CorCompare.exe -f corlib -ms mscorlib -x $@ $<
+
+
+../class-status: ../class-status.in
+ cp -f $< $@
diff --git a/doc/web/process.pl b/doc/web/process.pl
new file mode 100755
index 00000000000..9739f9b4384
--- /dev/null
+++ b/doc/web/process.pl
@@ -0,0 +1,89 @@
+#!/usr/bin/perl
+#
+# Author:
+# Sean MacIsaac
+#
+
+use strict;
+
+my $full_expand = 1;
+my @template;
+my $n;
+
+if ($#ARGV != 2) {
+ print "process.pl command_file template_file directory_prefix\n";
+ exit ();
+}
+
+my $menu = "";
+
+open COMMANDS, $ARGV[0] || die "Can not open $ARGV[0]";
+while (<COMMANDS>) {
+ chop;
+ my @command = split /,/;
+ if ($command[0] != -1) {
+ $menu .= "\t\t";
+ $menu .= "<tr><td valign=\"top\" class=\"navi" . $command[0];
+ $menu .= "\"><a class=\"navi" . $command[0];
+ $menu .= "\"";
+ $menu .= "HREF=\"$command[2]\">$command[1]</A></td></tr>\n\n";
+ }
+}
+close COMMANDS;
+
+open TEMPLATE, $ARGV[1] || die "Can not open $ARGV[1]";
+while (<TEMPLATE>) {
+ push @template, $_;
+}
+close TEMPLATE;
+
+open COMMANDS, $ARGV[0] || die "Can not open $ARGV[0]";
+while (<COMMANDS>) {
+ chop;
+ my @command = split /,/;
+
+ if ($command[2] =~ /^http:/){
+ } else {
+ $n = $ARGV[2] . "/" . $command[2];
+ open OUTPUT, ">" . $n || die "Can not create $n";
+
+ my $content = "";
+ open INPUT, "src/$command[3]" || die "Can not open $command[3]";
+ while (<INPUT>) {
+ $content .= $_;
+ }
+ close INPUT;
+
+ my $line;
+ my $temp;
+ my $tit;
+ my $title;
+ my $css;
+ my $script;
+
+ $tit = $command[1];
+ $css = $command[4];
+ $script = $command[5];
+
+ foreach $line (@template) {
+ $temp = $line;
+ $title = "$tit / Mono";
+ $temp =~ s/#TITLE#/$title/;
+ $temp =~ s/#CONTENT#/$content/;
+ $temp =~ s/#MENU#/$menu/;
+ if ($css) {
+ $temp =~ s/#CSS#/<LINK rel="stylesheet" type="text\/css" href="$css">/;
+ } else {
+ $temp =~ s/#CSS#//;
+ }
+
+ if ($script) {
+ $temp =~ s/#SCRIPT#/<SCRIPT src="$script"><\/SCRIPT>/;
+ } else {
+ $temp =~ s/#SCRIPT#//;
+ }
+ print OUTPUT $temp;
+ }
+ }
+ close OUTPUT;
+}
diff --git a/doc/web/src/.cvsignore b/doc/web/src/.cvsignore
new file mode 100755
index 00000000000..5053fb08904
--- /dev/null
+++ b/doc/web/src/.cvsignore
@@ -0,0 +1 @@
+*.src
diff --git a/doc/web/template.html.in b/doc/web/template.html.in
new file mode 100644
index 00000000000..7603e1945d5
--- /dev/null
+++ b/doc/web/template.html.in
@@ -0,0 +1,85 @@
+<html>
+<head>
+<title>#TITLE#</title>
+<style type="text/css">
+<!--
+ body { font-family: "trebuchet ms", lucida, verdana, helvetica;
+ background-image: url("images/bgsquares.gif");
+ background-attachment: fixed; }
+ body, td, table { font-family: "trebuchet ms", lucida, verdana, helvetica;
+ font-size: 14px; }
+
+ .navi0 { font-size: 14px; font-weight: bold; background: #444444; }
+ .navi1 { font-size: 14px; font-weight: bold; left-margin: 10pt}
+ .navi2 { font-size: 10px; font-weight: bold; left-margin: 20pt}
+ .footnote { font-size: 12px; color: #aaaaaa; }
+
+ a.navi0 { color: #ffffff; text-decoration: none}
+ a.navi0:visited { color: #cccccc; }
+ a.navi0:hover { color: #ee9900; text-decoration: underline; }
+
+ a.navi1 { color: #ffffff; text-decoration: none; margin-left: 7px;}
+ a.navi1:visited { color: #cccccc; }
+ a.navi1:hover { color: #ee9900; text-decoration: underline; }
+
+ a.navi2 { color: #ffffff; text-decoration: none; margin-left: 20px;}
+ a.navi2:visited { color: #cccccc; }
+ a.navi2:hover { color: #ee9900; text-decoration: underline; }
+
+// -->
+</style>
+#CSS#
+#SCRIPT#
+</head>
+<body bgcolor="#555555" text="#000000">
+
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+ <tr>
+ <td><img src="images/pixel.gif"></td><!-- left border -->
+ <td colspan="4">
+ <a href="http://www.go-mono.com"><img src="images/mono.gif" border="0"></a></td>
+ <td><img src="images/pixel.gif"></td><!-- right border -->
+ </tr>
+ <tr>
+ <td><img src="images/pixel.gif" width="1" height="1"></td>
+ <td colspan="3" bgcolor="black"><img src="images/pixel.gif" height="2"></td>
+ <td bgcolor="black"><img src="images/pixel.gif" width="1"></td>
+ <td><img src="images/pixel.gif"></td>
+ </tr>
+ <tr>
+ <td width="100"><img src="images/pixel.gif"></td>
+ <td valign="top">
+ <table cellpadding="2" valign="top" cellspacing="0" border="0">
+ #MENU#
+ </table>
+ </td>
+ <td bgcolor="black" width="1"><img src="images/pixel.gif" width="1"></td>
+ <td bgcolor="white" align="left" width="80%" valign="top">
+ <table cellpadding="16">
+ <tr><td>
+ #CONTENT#
+ </td></tr>
+ </table>
+ </td>
+ <td bgcolor="black"><img src="images/pixel.gif" width="1"></td>
+ <td width="100"><img src="images/pixel.gif"></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <img src="images/pixel.gif"></td>
+ <td colspan="2" bgcolor="black"><img src="images/pixel.gif" height="1"></td>
+ <td bgcolor="black"><img src="images/pixel.gif" width="1"></td>
+ <td><img src="images/pixel.gif"></td>
+ </tr>
+
+ <td colspan="2"></td>
+ <td colspan="2" align="center">
+ <a class="footnote" href="mailto: webmaster@go-mono.com">webmaster@go-mono.com</a>
+ </td>
+ <td colspan="2"></td>
+ </tr>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/doc/winforms b/doc/winforms
new file mode 100644
index 00000000000..2d8c1e3d79d
--- /dev/null
+++ b/doc/winforms
@@ -0,0 +1,90 @@
+* System.Windows.Forms
+
+ System.Windows.Forms eventually will support multiple
+ toolkits. Ximian will be delivering a product that will allow
+ for System.Windows.Forms applications to integrate with GNOME
+ through Gtk and MacOS X using Cocoa.
+
+ There are no current plans to support embedded devices, but
+ Gtk/FrameBuffer is an option. If you have suggestions or
+ recommendations, please let us <a
+ href="mailto:mono-hackers-list@ximian.com">let us know</a>
+
+* Contributing
+
+ Currently Ximian developers are busy making our JIT engine
+ feature complete, and dealing with the low-level details of
+ the Mono runtime.
+
+ If you are interested in contributing, you can start stubbing
+ out classes and providing enumerations. That will help us
+ significantly when we start working on the actual bindings.
+
+ Christian Meyer is currently organizing this effort.
+
+* System.Drawing
+
+ Using existing libraries to implement some of the functionality required
+
+ <ul>
+ * gdk-pixbuf is a generic image loader that loads an image
+ and leaves it into an RGB buffer. It hides all the details
+ about what image file format is being loaded.
+
+ * Libart is a general framework for rendering RGB/RGBA
+ buffers into RGB buffers and rendering postscript-like paths into
+ RGB/RGBA buffers.
+ </ul>
+
+ We want to use gdk-pixbuf as the image loader for the image
+ classes, and then we need operations to render that into the
+ windowing system (Gtk+, MacOS, etc). But notice how there is
+ very little dependnecies in Gdk-pixbuf on gtk, and libart has
+ none.
+
+ They are pretty independent from a windowing system
+ (gdk-pixbuf comes with some "helper" routines for rendering
+ data into a pixmap and to load pixmaps into RGB buffers).
+
+ A few things to keep in mind:
+
+ <ul>
+
+ * gdk-pixbuf can be used to load images for Gtk+,
+ MacOS X and Windows, it should be pretty portable,
+ although we might need in the future to back-port
+ some new features from Gtk head.
+
+ * Libart is probably only going to be used with X11,
+ as the MacOS X provides the same features in Quartz,
+ and Win32 *probably* has that in GDI+. If not, we
+ should use libart in Win32 as well (or for older
+ Windows systems).
+ </ul>
+
+* Directory Layout
+
+ System.Drawing (assembly directory)
+ System.Drawing.Blah
+ Common code for "Blah"
+ Stubs for "Blah" to ease ports.
+
+ Gtk
+ System.Drawing.Blah.
+ Gtk ports of "System.Drawing.Blah"
+ MacOS
+ System.Drawing.Blah
+ MacOS ports of "System.Drawing.Blah"
+ Win32
+ System.Drawing.Blah
+ Win32 ports of "System.Drawing.Blah"
+
+ Then we use nant targets to include/exclude the right set of
+ files to create the assembly.
+
+* Open questions:
+
+ I believe that the graphics contexts that are used to render
+ can accept either libart-like rendering operations and
+ X11-like rendering operations. This complicates matters, but
+ I am not sure. Someone needs to investigate this.
diff --git a/docs/Makefile.am b/docs/Makefile.am
new file mode 100644
index 00000000000..1ea3eaee8b2
--- /dev/null
+++ b/docs/Makefile.am
@@ -0,0 +1,3 @@
+EXTRA_DIST = gc-issues jit-thoughts object-layout unmanaged-calls \
+ exceptions jit-trampolines stack-alignment
+
diff --git a/docs/exceptions b/docs/exceptions
new file mode 100644
index 00000000000..3bf2e606812
--- /dev/null
+++ b/docs/exceptions
@@ -0,0 +1,70 @@
+Author: Dietmar Maurer (dietmar@ximian.com)
+(C) 2001 Ximian, Inc.
+
+Exception implementation (jit):
+===============================
+
+Stack unwinding:
+================
+
+We record the code address (start_address, size) of all methods. That way it is
+possible to map an instruction pointer (IP) to the method information needed
+for unwinding the stack:
+
+We also save a Last Managed Frame (LMF) structure at each call from managed to
+unmanaged code. That way we can recover from exceptions inside unmanaged code.
+
+void handle_exception ((struct sigcontext *ctx, gpointer obj)
+{
+ if (ctx->ip < mono_end_of_stack) {
+ /* unhandled exception */
+ abort ();
+ }
+
+ info = mono_jit_info_table_find (mono_jit_info_table, ctx->ip);
+
+ if (info) { // we are inside managed code
+
+ if (ch = find_catch_handler ())
+ execute_catch_handler (ch, ctx, obj);
+
+ execute_all_finally_handler ();
+
+ // restore register, including IP and Frame pointer
+ ctx = restore_caller_saved_registers_from_ctx (ji, ctx);
+
+ // continue unwinding
+ handle_exception (ctx, obj);
+
+ } else {
+
+ lmf = get_last_managed_frame ();
+
+ // restore register, including IP and Frame pointer
+ ctx = restore_caller_saved_registers_from_lmf (ji, lmf);
+
+ // continue unwinding
+ handle_exception (ctx, obj);
+ }
+}
+
+
+Code generation:
+================
+
+leave: is simply translated into a branch to the target. If the leave
+instruction is inside a finally block (but not inside another handler)
+we call the finally handler before we branch to the target.
+
+finally/endfinally: is translated into subroutine ending with a "return"
+statement. The subroutine does not save EBP/ESP, because we need access to the
+local variables of the enclosing method. We have to use a "call"
+instruction to execute such finally handlers. This makes it possible to
+execute them inside the stack unwinding code.
+
+throw: we first save all regs into a sigcontext struct (we pass the
+exception object in register ECX), and then call the stack unwinding
+code.
+
+catch handler: receives the exception object in ECX. They store that
+object into a local variable, so that rethrow can access the object.
diff --git a/docs/gc-issues b/docs/gc-issues
new file mode 100644
index 00000000000..95062c56244
--- /dev/null
+++ b/docs/gc-issues
@@ -0,0 +1,31 @@
+* GC issues you need to be careful about when hacking on the mono runtime.
+
+mono currently uses the Boehm garbage collection library. This is a conservative
+GC package: this means that the memory is searched for possible memory references
+to chunks allocated with the GC. Not all the memory is searched, but only the memory
+allocated with the GC itself (unless you use the 'atomic' variant of the allocation
+routines), the stack and global variables. Also, if the last reference to an object
+is stored in an area of themory that is not searched, the object may be freed resulting
+in memory corruption ind segfaults.
+
+In particular, memory allocated with system's malloc() is not searched, so you need to be
+careful NOT to store object references in memory allocated with malloc() (unless you are sure
+that the object reference will be live at the same time in some other area under the control
+of the GC (on the stack or in a global variable, for example). Since g_malloc()
+ultimately calls system malloc() the data structures in GLib are not safe to
+use to store object references.
+
+Occasionally, you'll need to store some object reference from C code: in this case,
+you must make sure that the store location is searched by the GC. You can safely
+use thread local storage areas, global variables, stack variables. If you need a more
+complicated data structure, you can use a hash table: MonoGHashTable.
+This hash table has the same interface as GHashTable from GLib, just stick the "mono_"
+prefix in function calls and the "Mono" prefix in the hash table type name.
+This hash table ensures that object references stored in it are tracked by the GC, as long
+as the pointer to the hash is tracked itself.
+
+Other data structures that are allocated with the GC and are safe to use to store pointers
+to GC-allocated memory, are MonoDomain (keeps track of many domain specfic objects)
+and MonoVTable (referenced by MonoDomain: keeps track of the static data of a type
+since that can hold references to objects).
+
diff --git a/docs/internal-calls b/docs/internal-calls
new file mode 100644
index 00000000000..2f3d4abbda0
--- /dev/null
+++ b/docs/internal-calls
@@ -0,0 +1,59 @@
+
+* How to map C# types for use in the C implementation of internal calls
+
+ C# type C type
+ char gunichar2
+ bool MonoBoolean
+ sbyte signed char
+ byte guchar
+ short gint16
+ ushort guint16
+ int gint32
+ uint guint32
+ long gint64
+ ulong guint64
+ IntPtr/UIntPtr gpointer
+ 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.
+
+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:
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override int GetHashCode ();
+
+becaomes:
+
+ gint32 ves_icall_System_String_GetHashCode (MonoString *this);
+
+
+
+* 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/jit-thoughts b/docs/jit-thoughts
new file mode 100644
index 00000000000..cb50d0ecd05
--- /dev/null
+++ b/docs/jit-thoughts
@@ -0,0 +1,125 @@
+Just some thoughts for the JITer:
+
+General issues:
+===============
+
+We are designing a JIT compiler, so we have to consider two things:
+
+- the quality of the generated code
+- the time needed to generate that code
+
+The current approach is to keep the JITer as simple as possible, and thus as
+fast as possible. The generated code quality will suffer from that.
+
+Register Allocation:
+====================
+
+With lcc you can assign a fixed register to a tree before register
+allocation. For example this is needed by call, which return the value always
+in EAX on x86. The current implementation works without such system, due to
+special forest generation.
+
+Different Register Sets:
+========================
+
+Most processors have more that one register set, at least one for floating
+point values, and one for integers. Should we support architectures with more
+that two sets? Does someone knows such an architecture?
+
+64bit Integer Values:
+=====================
+
+I can imagine two different implementation. On possibility would be to treat
+long (64bit) values simply like any other value type. This implies that we
+call class methods for ALU operations like add or sub. Sure, this method will
+be be a bit inefficient.
+
+The more performant solution is to allocate two 32bit registers for each 64bit
+value. We add a new non terminal to the monoburg grammar called "lreg". The
+register allocation routines takes care of this non terminal and allocates two
+32 bit registers for them.
+
+Forest generation:
+==================
+
+Consider the following code:
+
+OPCODE: STACK LOCALS
+LDLOC.0 (5) [5,0]
+LDC.1 (5,1) [5,0]
+STLOC.0 (5) [1,0]
+STLOC.1 () [1,5]
+
+The current forest generation generates:
+
+STLOC.0(LDC.1)
+STLOC.1(LDLOC.0)
+
+Which is wrong, since it stores the wrong value (1 instead of 5). Instead we
+must generate something like:
+
+STLOC.TMP(LDLOC.0)
+STLOC.0(LDC.1)
+STLOC.1(LDLOC.TMP)
+
+Where STLOC.TMP saves the value into a new temporary variable.
+
+We also need a similar solution for basic block boundaries when the stack depth
+is not zero. We can simply save those values to new temporary values. Consider
+the following basic block with one instruction:
+
+LDLOC.1
+This should generate a tree like:
+
+STLOC.TMP(LDLOC.1) Please notice that an intelligent register allocator can
+still allocate registers for those new variables.
+
+DAG handling:
+=============
+
+Monoburg can't handle DAGs, instead we need real trees as input for
+the code generator. So we have two problems:
+
+1.) DUP instruction: This one is obvious - we need to store the value
+into a temporary variable to solve the problem.
+
+2.) function calls: Chapter 12.8, page 343 of "A retargetable C compiler"
+explains that: "because listing a call node will give it a hidden reference
+from the code list". I don't understand that (can someone explain that?), but
+there is another reason to save return values to temporaries: Consider the
+following code:
+
+x = f(y) + g(z); // all functions return integers
+
+We could generate such a tree for this expression: STLOC(ADD(CALL,CALL))
+
+The problem is that both calls returns the value in the same register,
+so it is non trivial to generate code for that tree. We must copy one
+register into another one, which make register allocation more complex.
+The easier solution is store the result of function calls to
+temporaries. This leads to the following forest:
+
+STLOC(CALL)
+STLOC(CALL)
+STLOC(ADD (LDLOC, LDLOC))
+
+This is what lcc is doing, if I understood 12.8, page 342, 343?
+
+Possible Optimisations:
+=======================
+
+Miguel said ORP does some optimisation on IL level, for example moving array
+bounds checking out of loops:
+
+for (i = 0; i < N; i++) { check_range (a, i); a [i] = X; }
+
+id transformed to:
+
+if (in_range (a, 0, N)) { for (i = 0; i < N; i++) a[i] = X; }
+else for (i = 0; i < N; i++) { check_range (a, i); a [i] = X; }
+
+The "else" is only to keep original semantics (exception handling).
+
+We need loop detection logic in order to implement this (dominator tree).
+
+AFAIK CACAO also implements this. \ No newline at end of file
diff --git a/docs/jit-trampolines b/docs/jit-trampolines
new file mode 100644
index 00000000000..d8b80b5e2c7
--- /dev/null
+++ b/docs/jit-trampolines
@@ -0,0 +1,52 @@
+Author: Dietmar Maurer (dietmar@ximian.com)
+(C) 2001 Ximian, Inc.
+
+Howto trigger JIT compilation
+=============================
+
+The JIT translates CIL code to native code on a per method basis. For example
+if you have this simple program:
+
+public class Test {
+ public static void Main () {
+ System.Console.WriteLine ("Hello");
+ }
+}
+
+the JIT first compiles the Main function. Unfortunately Main() contains another
+reference to System.Console.WriteLine(), so the JIT also needs the address for
+WriteLine() to generate a call instruction.
+
+The simplest solution would be to JIT compile System.Console.WriteLine()
+to generate that address. But that would mean that we JIT compile half of our
+class library at once, since WriteLine() uses many other classes and function,
+and we have to call the JIT for each of them. Even worse there is the
+possibility of cyclic references, and we would end up in an endless loop.
+
+Thus we need some kind of trampoline function for JIT compilation. Such a
+trampoline first calls the JIT compiler to create native code, and then jumps
+directly into that code. Whenever the JIT needs the address of a function (to
+emit a call instruction) it uses the address of those trampoline functions.
+
+One drawback of this approach is that it requires an additional indirection. We
+always call the trampoline. Inside the trampoline we need to check if the
+method is already compiled or not, and when not compiled we start JIT
+compilation. After that we call the code. This process is quite time consuming
+and shows very bad performance.
+
+The solution is to add some logic to the trampoline function to detect from
+where it is called. It is then possible for the JIT to patch the call
+instruction in the caller, so that it directly calls the JIT compiled code
+next time.
+
+Implementation for x86
+======================
+
+emit-x86.c (arch_create_jit_trampoline): return the JIT trampoline function
+
+emit-x86.c (x86_magic_trampoline): contains the code to detect the caller and
+patch the call instruction.
+
+emit-x86.c (arch_compile_method): JIT compile a method
+
+
diff --git a/docs/object-layout b/docs/object-layout
new file mode 100644
index 00000000000..4916751d1e7
--- /dev/null
+++ b/docs/object-layout
@@ -0,0 +1,63 @@
+Author: Dietmar Maurer (dietmar@ximian.com)
+(C) 2001 Ximian, Inc.
+
+Object and VTable layout
+========================
+
+The first pointer inside an Object points to a MonoVtable structure. Objects
+also contains a MonoThreadsSync structure which is used by the mono Thread
+implementation.
+
+typedef struct {
+ MonoVTable *vtable;
+ MonoThreadsSync synchronisation;
+
+ /* object specific data goes here */
+} MonoObject;
+
+The MonoVtable contains the vtable, interface offsets and a pointer to static
+class data. Each object/vtable belongs to exactly one AppDomain.
+
+typedef struct {
+ MonoClass *klass;
+ MonoDomain *domain;
+ gpointer *interface_offsets;
+ /* a pointer to static data */
+ gpointer data;
+ /* the variable sized vtable is included at the end */
+ gpointer vtable [0];
+} MonoVTable;
+
+The MonoClass contains domain independent Class infos.
+
+typedef struct {
+ /* various class infos */
+ MonoClass *parent;
+ const char *name;
+ const char *name_space;
+ ...
+} MonoClass;
+
+
+Calling virtual functions:
+==========================
+
+Each MonoMethod (if virtual) has an associated slot, which is an index into the
+VTable. So we can use the following code to compute the address of a virtual
+function:
+
+method_addr = object->vtable->vtable [method->slot];
+
+
+Calling interface methods:
+==========================
+
+Each interface class is associated with an unique ID. The following code
+computes the address of an interface function:
+
+method_addr = *(object->vtable->interface_offsets [interface_id] + method->slot*4);
+
+
+
+
+
diff --git a/docs/stack-alignment b/docs/stack-alignment
new file mode 100644
index 00000000000..da995fb288f
--- /dev/null
+++ b/docs/stack-alignment
@@ -0,0 +1,33 @@
+Size and alignment requirements of stack values
+===============================================
+
+P ... System.IntPtr
+I1 ... System.Int8
+I2 ... System.Int16
+I4 ... System.Int32
+I8 ... System.Int64
+F ... System.Single
+D ... System.Double
+LD ... native long double
+
+-----------------------------------------------------------
+ARCH | P | I1 | I2 | I4 | I8 | F | D | LD |
+-----------------------------------------------------------
+X86 | 4/4 | 4/4 | 4/4 | 4/4 | 8/4 | 4/4 | 8/4 |12/4 |
+-----------------------------------------------------------
+X86/W32 | 4/4 | 4/4 | 4/4 | 4/4 | 8/4 | 4/4 | 8/4 |12/4 |
+-----------------------------------------------------------
+ARM | 4/4 | 4/4 | 4/4 | 4/4 | 8/4 | 4/4 | 8/4 | 8/4 |
+-----------------------------------------------------------
+M68K | 4/4 | 4/4 | 4/4 | 4/4 | 8/4 | 4/4 | 8/4 |12/4 |
+-----------------------------------------------------------
+ALPHA | 8/8 | 8/8 | 8/8 | 8/8 | 8/8 | 8/8 | 8/8 | 8/8 |
+-----------------------------------------------------------
+SPARC | 4/4 | 4/4 | 4/4 | 4/4 | 8/8 | 4/4 | 8/8 |16/8 |
+-----------------------------------------------------------
+SPARC64 | 8/8 | 8/8 | 8/8 | 8/8 | 8/8 | 8/8 | 8/8 |16/16|
+-----------------------------------------------------------
+MIPS | 4/4 | 4/4 | 4/4 | 4/4 | ?/? | 4/4 | 8/8 | 8/8 |
+-----------------------------------------------------------
+ | | | | | | | | |
+-----------------------------------------------------------
diff --git a/docs/unmanaged-calls b/docs/unmanaged-calls
new file mode 100644
index 00000000000..7542623166b
--- /dev/null
+++ b/docs/unmanaged-calls
@@ -0,0 +1,135 @@
+Author: Dietmar Maurer (dietmar@ximian.com)
+(C) 2001 Ximian, Inc.
+
+More about PInvoke and Internal calls
+=====================================
+
+1.) What is PInvoke
+
+PInvoke stands for Platform Invoke. It is possible to call functions contained
+in native shared libraries, for example you can declare:
+
+ [DllImport("cygwin1.dll", EntryPoint="puts"]
+ public static extern int puts (string name);
+
+If you then call "puts(...)" it invokes the native "puts" functions in
+"cygwin1.dll". It is also possible to specify several marshalling attributes
+for the arguments, for example you can specify that they puts() function expect
+ts the string in Ansi encoding by setting the CharSet attribute field:
+
+ [DllImport("cygwin1.dll", EntryPoint="puts", CharSet=CharSet.Ansi)]
+ public static extern int puts (string name);
+
+2.) What are internal calls
+
+Some class library functions are implemented in C, because it is either not
+possible to implement them in C# or because of performance gains. Internal
+functions are contained in the mono executable itself. Here is an example form
+our array implementation:
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern int GetRank ();
+
+If you call this GetRank() function it invokes
+ves_icall_System_Array_GetRank() inside the mono runtime.
+
+If you write your own runtime environment you can add internal calls with
+mono_add_internal_call().
+
+
+2.) Runtime considerations
+
+Invoking native (unmanaged) code has several implications:
+
+- We need to handle exceptions inside unmanaged code. The JIT simply saves some
+ informations at each transition from managed to unmanaged code (in a linked
+ list), called Last Managed Frame (LMF). If an exception occurs the runtime
+ first looks if the exception was inside managed code. If not there must be a
+ LMF entry which contains all necessary information to unwind the stack.
+
+ Creation of those LMF structure clearly involves some overhead, so calling
+ into unmanaged code is not as cheap as it looks like at first glance. Maybe
+ we can introduce a special attribute to avoid the creation of LMF on internal
+ call methods that cant raise exceptions.
+
+- PInvoke has the possibility to convert argument types. For example Strings
+ are marshalled as Char*. So each String argument is translated into a
+ char*. The encoding is specified in the CharSet of the DllImport attribute.
+
+
+3.) When/how does the runtime call unmanaged PInvoke code
+
+- LDFTN, CALLI, Delegate::Invoke, Delegate::BeginInvoke: We must generate
+ wrapper code when we load the function with LDFTN, so that all arguments are
+ marshalled in the right format. We also need to save/restore the LMF.
+
+- MethodBase::Invoke (runtime invoke): We need to marshal all arguments in
+ they right format and save/restore the LMF
+
+- CALL: We need to marshal all arguments in they right format and save/restore
+ the LMF
+
+The easiest way to implement this is to always create a wrapper function for
+PInvoke calls, which takes care of argument marshalling and LMF save/restore.
+
+4.) When/how does the runtime call unmanaged internal calls
+
+We don't need to convert any arguments, so we need only take care of the LMF
+structure.
+
+- LDFTN, CALLI, Delegate::Invoke, Delegate::BeginInvoke: We must generate
+ wrapper code when we load the function with LDFTN which saves/restores the
+ LMF.
+
+- MethodBase::Invoke (runtime invoke): We need to save/restore the LMF.
+
+- CALL: We need to save/restore the LMF.
+
+- CALLVIRT (through the vtable): We must generate wrapper code to save/restore
+ the LMF.
+
+Please notice that we can call internal function with CALLVIRT, i.e. we can
+call those function through a VTable. But we cant know in advance if a vtable
+slot contains an internal call or managed code. So again it is best to generate
+a wrapper functions for internal calls in order to save/restore the LMF.
+
+Unfortunately we need to push all arguments 2 times, because we have to save
+the LMF, and the LMF is currently allocated on the stack. So the stack looks
+like:
+
+ --------------------
+ | method arguments |
+ --------------------
+ | LMF |
+ --------------------
+ | copied arguments |
+ --------------------
+
+AFAIK this is the way ORP works. Another way is to allocate the LMF not on the
+stack, but then we have additional overhead to allocate/free LMF structures
+(and another call to arch_get_lmf_addr).
+
+Maybe it is possible to avoid this addiotional copy for internal calls by
+including the LMF in the C function signature. Lets say we hav a puts()
+function which is a internal call:
+
+ves_icall_puts (MonoString *string);
+
+If we simply modify that to include the LMF we can avoid to copy all arguments:
+
+ves_icall_puts (MonoLMF lmf, MonoString *string);
+
+But this depends somehow on the calling conventions, and I don't know if that
+works on all plattforms?
+
+
+5.) What is stored in the LMF
+
+- all caller saved registers (since we can trust unmanaged code)
+- the instruction pointer of the last managed instruction
+- a MonoMethod pointer for the unmanaged function
+- the address of the thread local lfm_addr pointer (to avoid another call to
+ arch_get_lmf_addr when restoring LMF)
+
+The LMF is allocated on the stack, so we also know the stack position for
+stack unwinding.
diff --git a/man/.cvsignore b/man/.cvsignore
new file mode 100644
index 00000000000..282522db034
--- /dev/null
+++ b/man/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644
index 00000000000..bb1642c1177
--- /dev/null
+++ b/man/Makefile.am
@@ -0,0 +1,4 @@
+man_MANS = mcs.1 mono.1 monostyle.1
+
+EXTRA_DIST = $(man_MANS)
+
diff --git a/man/mcs.1 b/man/mcs.1
new file mode 100755
index 00000000000..0afabaa922c
--- /dev/null
+++ b/man/mcs.1
@@ -0,0 +1,155 @@
+.TH mcs 1 "6 January 2001"
+.SH NAME
+mcs \- Mono Compiler Suite.
+.SH SYNOPSIS
+.B mcs
+[option] [source-files]
+.SH DESCRIPTION
+mcs is the Mono C# compiler, an implementation of the ECMA-334
+language specification. You can pass one or more options to drive the
+compiler, and a set of source files. Extra options or arguments can
+be provided in a response file. Response files are referenced by
+prepending the @ symbol to the response file name.
+.PP
+C# source files must end with a ".cs" extension. Compilation of C#
+source code requires all the files that make up a library, module or
+executable to be provided on the command line. There is no support
+for partial compilation. To achieve the benefits of partial
+compilation, you should compile programs into their own assemblies,
+and later reference them with the "-r" flag.
+.PP
+The Mono C# compiler generates images (.exe files) that contain CIL
+byte code that can be executed by any system that implements a Common
+Language Infrastructure virtual machine such as the Microsoft .NET
+runtime engine on Windows or the Mono runtime engine on Unix systems.
+Executables are not bound to a specific CPU or operating system.
+.PP
+.SH OPTIONS
+.TP
+.I \-\-about
+Displays information about the Mono C# compiler
+.TP
+.I \-\-checked
+Sets the default compilation mode to `checked'. This makes all
+the math operations checked (the default is unchecked).
+.TP
+.I \-\-define SYMBOL
+Defines a symbol named SYMBOL. This can be tested in the source code
+by the pre-processor.
+.TP
+.I \-\-debug or \-g
+Generate debugging information.
+.TP
+.I \-\-fatal
+This is used for debugging the compiler. This makes the error emission
+generate an exception that can be caught by a debugger.
+.TP
+.I \-\-stacktrace
+Generates a stack trace at the time the error is reported, useful for
+debugging the compiler.
+.TP
+.I \-L PATH
+Directs the compiler to look for libraries in the specified path.
+Multiple paths can be provided.
+.TP
+.I \-\-nostdlib
+Use this flag if you want to compile the core library. This makes the
+compiler load its internal types from the assembly being compiled.
+.TP
+.I \-\-noconfig
+Disables the default compiler configuration to be loaded. The
+compiler by default has references to the system assemblies.
+.TP
+.I \-\-nowarn XXX
+Makes the compiler ignore warning XXX.
+.TP
+.I \-o FNAME
+Names the output file to be generated.
+.TP
+.I \-\-optimize
+Turns on optimizations in the compiler.
+.TP
+.I \-\-parse
+Used for benchmarking. The compiler will only parse its input files.
+.TP
+.I \-\-probe X L
+Probes for the code to generate an error named `X' in line `L'. This
+is only used by the test suite.
+.TP
+.I \-\-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:
+.PP
+.nf
+ bash$ mcs --recurse '*.cs'
+.fi
+.TP
+.I \-\-resource FILE
+Adds FILE as a resource of the resulting assembly.
+.TP
+.I \-\-target KIND
+Used to specify the desired target. The possible values are: exe,
+winexe, library and module.
+.TP
+.I \-\-timestamp
+Another debugging flag. Used to display the times at various points
+in the compilation process.
+.TP
+.I \-\-unsafe
+Enables compilation of unsafe code.
+.TP
+.I \-\-werror
+Treat warnings as errors.
+.TP
+.I \-\-wlevel LEVEL
+Sets the warning level. 0 is the lowest warning level, and 4 is the
+highest. The default is 2.
+.TP
+.I \-r ASSEMBLY
+Reference the named assembly. 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.
+.TP
+.I \-v
+Debugging. Turns on verbose yacc parsing.
+.TP
+.I \-\-
+Use this to stop option parsing, and allow option-looking parameters
+to be passed on the command line.
+.PP
+.SH DEBUGGING SUPPORT
+When use the "--debug" or "-g" flag, MCS will create an assembler file
+FILE-debug.s containing debugging information where FILE is the name of
+the generated assembly. You need to run this file through the assembler
+to get a object file FILE-debug.o. See mono's "--dwarf-plus" argument
+for details on how to use this file.
+.SH NOTES
+During compilation the MCS compiler defines the __MonoCS__ symbol,
+this can be used by pre-processor instructions to compile Mono C#
+compiler specific code.
+.SH AUTHORS
+The Mono C# Compiler was written by Miguel de Icaza and Ravi Pratap at
+Ximian.
+.PP
+.SH LICENSE
+The Mono Compiler Suite is released under the terms of the GNU GPL.
+Please read the accompanying `COPYING' file for details. Alternative
+licenses are available from Ximian.
+.PP
+.SH SEE ALSO
+mono(1), mint(1)
+.PP
+.SH BUGS
+To report bugs in the compiler, you can use `bug-buddy', or you can
+file bug reports in our bug tracking system:
+http://bugzilla.ximian.com.
+.SH MAILING LIST
+The Mono Mailing List is available at: mono-list-request@ximian.com
+.SH MORE INFORMATION
+The Mono C# compiler is developed by Ximian, Inc
+(http://www.ximian.com) (http://www.ximian.com) and is based on the
+ECMA C# language standard available here:
+http://www.ecma.ch/ecma1/STAND/ecma-334.htm
+
+
diff --git a/man/mono.1 b/man/mono.1
new file mode 100644
index 00000000000..8679e132072
--- /dev/null
+++ b/man/mono.1
@@ -0,0 +1,85 @@
+.\"
+.\" mint manual page.
+.\" (C) Ximian, Inc.
+.\" Author:
+.\" Miguel de Icaza (miguel@gnu.org)
+.\"
+.TH Mono "Mono 1.0"
+.SH NAME
+mono \- Mono ECMA-CLI Just in Time compiler.
+.SH SYNOPSIS
+.PP
+.B mono
+[\-\-help] [\-d] [\-\-debug-asm] [\-\-debug-forest] [\-\-trace-calls]
+[\-\-stabs] [\-\-compile cname] [\-\-ncompile num] [\-\-debug] [\-\-noinline] [\-\-profile]
+program.exe [arguments...]
+.SH DESCRIPTION
+The \fImono\fP program is a Just in Time compiler for ECMA CLI byte
+codes. It translates dynamically a CIL stream into native code.
+.I program.exe
+and optionally passes
+the
+.I arguments
+to it.
+.SH OPTIONS
+The following options are supported:
+.TP
+.I "--help", "-h"
+Displays usage instructions.
+.I "--share-code"
+This mode makes the LoaderOptimization for Application Domains default
+to sharing code. This results in slower code, but enables code
+sharing across application domains. The default is to maximize for
+speed, but disallow JITed code sharing across domains. See
+System.LoaderOptimization for more information
+.SH DEBUGGING OPTIONS
+The following options are used to debug, or perfomance test the JIT
+compiler:
+.TP
+.I "--trace-calls"
+Shows method names as they are invoked.
+.TP
+.I "--dump-asm"
+Displays the generated code as methods are invoked.
+.TP
+.I "--dump-forest"
+Displays the basic blocks and the forest of trees that is
+created from a stream of CIL opcodes.
+.TP
+.I "--stabs"
+Writes out stabs debug information
+.TP
+.I "--dwarf"
+Writes out dwarf debug information
+.TP
+.I "--dwarf-plus"
+Uses an extended debugging information file which has been generated
+by MCS. This extended debugging information will allow you to debug
+C# source code rather than IL code. To use it, just run the JIT in
+your debugger and call "mono_debug_make_symbols" each time the program
+stops.
+.TP
+.I "--debug method"
+Debugs the method whose name is `method'
+.TP
+.I "--compile"
+Compiles the method on the given class (namespace.name:methodname).
+.TP
+.I "--ncompile"
+Compiles the method a number of times. If no argument is specified,
+the method will be compiled a thousand times.
+.TP
+.I "--noinline"
+Disables the code inliner.
+.TP
+.I "--profile"
+Collect profiling information and dump it at the end of the process.
+.SH FILES
+Assemblies are lodaed from the installation lib directory. If you set
+`prefix' to /usr, the assemblies will be located in /usr/lib.
+.SH MAILING LISTS
+Visit http://mail.ximian.com/mailman/mono-list for details.
+.SH WEB SITE
+Visit: http://www.go-mono.com for details
+.SH SEE ALSO
+.BR mint(1), monodis(1)
diff --git a/man/monostyle.1 b/man/monostyle.1
new file mode 100644
index 00000000000..feea64a6d8a
--- /dev/null
+++ b/man/monostyle.1
@@ -0,0 +1,43 @@
+.\"
+.\" monostyle manual page.
+.\" (C) Adam Treat (manyoso@yahoo.com)
+.\"
+.TH monostyle 1
+.SH NAME
+monostyle \- Mono's C# code beautifier.
+.SH SYNOPSIS
+.PP
+.B monostyle
+-f file.cs -l <true|false> > output.cs
+.SH DESCRIPTION
+monostyle will parse a C# source code file and correct brace formatting
+reflective of the Mono Project's coding standard. To use: invoke monostyle
+by passing a C# source code file with '-f file.cs' and specify whether to
+use linespacing with '-l <true|false>. To output to a file just redirect
+with '>'.
+.PP
+Mono's Coding Standard
+.PP
+* The opening brace following a namespace, class, struct, enum, property or
+flow control unit should be at the end of the declaration line.
+.PP
+* The opening brace for a function should be on the line following the function.
+.PP
+* Please use white space around operators and a space between function names
+and their parameters.
+.SH OPTIONS
+.TP
+.I \-\-file
+The csharp source file to parse.
+.TP
+.I \-\-line
+Specifies wether to use line spacing.
+.PP
+.SH AUTHORS
+Adam Treat (manyoso@yahoo.com)
+.PP
+.SH LICENSE
+MonoStyle is released under the terms of the GNU GPL.
+.PP
+.SH SEE ALSO
+mono(1), mint(1)
diff --git a/mcs/AUTHORS b/mcs/AUTHORS
index b3d640ef755..35578c220c4 100755
--- a/mcs/AUTHORS
+++ b/mcs/AUTHORS
@@ -1 +1,14 @@
-Miguel de Icaza (miguel@ximian.com) \ No newline at end of file
+C# Compiler:
+ Miguel de Icaza (miguel@ximian.com)
+
+Class Libraries:
+ Patrik Torstensson <patrik.torstensson@labs2.com>
+ Gaurav Vaish <gvaish@iitk.ac.in>
+ Jeff Stedfast (fejj@ximian.com)
+ Joe Shaw (joe@ximian.com)
+ Miguel de Icaza (miguel@ximian.com)
+ Sean MacIsaac (macisaac@ximian.com)
+ Vladimir Vukicevic (vladimir@ximian.com)
+ Garrett Rooney (rooneg@electricjellyfish.net)
+ Bob Smith (bob@thestuff.net)
+ John Barnette (jbarn@httcb.net)
diff --git a/mcs/ChangeLog b/mcs/ChangeLog
new file mode 100644
index 00000000000..454ebcf5ead
--- /dev/null
+++ b/mcs/ChangeLog
@@ -0,0 +1,21 @@
+2002-03-26 Dick Porter <dick@ximian.com>
+
+ * makefile (linux): Abandon the build if any of the subdir makes fail
+
+2002-03-07 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: Change order of build so corlib is built before nunit since
+ Nunit needs corlib now.
+
+2002-02-14 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: Build mcs/doctools too when one does 'make'
+
+2002-01-20 Nick Drochak <ndrochak@gol.com>
+
+ * on the 'test' target, make sure NUnit is built first before building
+ and running tests
+
+2002-01-20 Nick Drochak <ndrochak@gol.com>
+
+ * add nunit directory to the list of dirs to build in \ No newline at end of file
diff --git a/mcs/README b/mcs/README
index c4ef996c177..c3d344552c2 100755
--- a/mcs/README
+++ b/mcs/README
@@ -1,2 +1,23 @@
-This is the Ximian MCS C# compiler written in C# \ No newline at end of file
+This contains the Mono C# compiler as well as the Mono runtime
+library.
+
+Layout:
+
+ class/
+ Class libraries
+
+ errors/
+ Sample programs that should generate errors by the compiler.
+
+ jay/
+ Yacc-based parser generator.
+
+ mcs/
+ The Mono C# compiler
+
+ tests/
+ Sample tests
+
+Thanks a lot to Sergey Chaban for his help during the development of
+the C# compiler.
diff --git a/mcs/class/.cvsignore b/mcs/class/.cvsignore
new file mode 100644
index 00000000000..a65b41774ad
--- /dev/null
+++ b/mcs/class/.cvsignore
@@ -0,0 +1 @@
+lib
diff --git a/mcs/class/Mono.CSharp.Debugger/AssemblerWriterI386.cs b/mcs/class/Mono.CSharp.Debugger/AssemblerWriterI386.cs
new file mode 100644
index 00000000000..f6cd2f5560c
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/AssemblerWriterI386.cs
@@ -0,0 +1,306 @@
+//
+// Mono.CSharp.Debugger/AssemblerWriterI386.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// IAssemblerWriter implementation for the Intel i386.
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.IO;
+
+namespace Mono.CSharp.Debugger
+{
+ public class AssemblerWriterI386 : IAssemblerWriter
+ {
+ public AssemblerWriterI386 (StreamWriter writer) {
+ this.writer = writer;
+ }
+
+ private StreamWriter writer;
+ private static int next_anon_label_idx = 0;
+
+ public void WriteLabel (string label)
+ {
+ writer.WriteLine (".L_" + label + ":");
+ }
+
+ public int GetNextLabelIndex ()
+ {
+ return ++next_anon_label_idx;
+ }
+
+ public int WriteLabel ()
+ {
+ int index = ++next_anon_label_idx;
+
+ WriteLabel (index);
+
+ return index;
+ }
+
+ public void WriteLabel (int index)
+ {
+ char[] output = { '.', 'L', '_', '\0', '\0', '\0', '\0', '\0', '\0',
+ ':', '\n' };
+
+ unchecked {
+ int value = (int) index;
+ output [3] = hex [(value & 0xf00000) >> 20];
+ output [4] = hex [(value & 0x0f0000) >> 16];
+ output [5] = hex [(value & 0x00f000) >> 12];
+ output [6] = hex [(value & 0x000f00) >> 8];
+ output [7] = hex [(value & 0x0000f0) >> 4];
+ output [8] = hex [(value & 0x00000f)];
+ }
+
+ writer.Write (output, 0, output.Length);
+ }
+
+ private static readonly char[] hex = { '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+ public void WriteUInt8 (bool value)
+ {
+ WriteUInt8 (value ? 1 : 0);
+ }
+
+ public void WriteUInt8 (int value)
+ {
+ char[] output = { '\t', '.', 'b', 'y', 't', 'e', '\t', '\t',
+ '0', 'x', '\0', '\0',
+ '\n' };
+
+ unchecked {
+ output [10] = hex [(value & 0xf0) >> 4];
+ output [11] = hex [value & 0x0f];
+ }
+
+ writer.Write (output, 0, output.Length);
+ }
+
+ public void WriteInt8 (int value)
+ {
+ char[] output = { '\t', '.', 'b', 'y', 't', 'e', '\t', '\t',
+ '0', 'x', '\0', '\0',
+ '\n' };
+
+ unchecked {
+ uint uvalue = (uint) value;
+ output [10] = hex [(uvalue & 0xf0) >> 4];
+ output [11] = hex [uvalue & 0x0f];
+ }
+
+ writer.Write (output, 0, output.Length);
+ }
+
+ public void Write2Bytes (int a, int b)
+ {
+ char[] output = { '\t', '.', 'b', 'y', 't', 'e', '\t', '\t',
+ '0', 'x', '\0', '\0', ',', ' ',
+ '0', 'x', '\0', '\0',
+ '\n' };
+
+ unchecked {
+ uint ua = (uint) a;
+ uint ub = (uint) b;
+ output [10] = hex [(ua & 0xf0) >> 4];
+ output [11] = hex [ua & 0x0f];
+ output [16] = hex [(ub & 0xf0) >> 4];
+ output [17] = hex [ub & 0x0f];
+ }
+
+ writer.Write (output, 0, output.Length);
+ }
+
+ public void WriteUInt16 (int value)
+ {
+ writer.WriteLine ("\t.2byte\t\t" + value);
+ }
+
+ public void WriteInt16 (int value)
+ {
+ writer.WriteLine ("\t.2byte\t\t" + value);
+ }
+
+ public void WriteUInt32 (int value)
+ {
+ char[] output = { '\t', '.', 'l', 'o', 'n', 'g', '\t', '\t',
+ '0', 'x', '\0', '\0', '\0', '\0', '\0', '\0',
+ '\0', '\0', '\n' };
+
+ unchecked {
+ output [10] = hex [(value & 0xf0000000) >> 28];
+ output [11] = hex [(value & 0x0f000000) >> 24];
+ output [12] = hex [(value & 0x00f00000) >> 20];
+ output [13] = hex [(value & 0x000f0000) >> 16];
+ output [14] = hex [(value & 0x0000f000) >> 12];
+ output [15] = hex [(value & 0x00000f00) >> 8];
+ output [16] = hex [(value & 0x000000f0) >> 4];
+ output [17] = hex [(value & 0x0000000f)];
+ }
+
+ writer.Write (output, 0, output.Length);
+ }
+
+ public void WriteInt32 (int value)
+ {
+ char[] output = { '\t', '.', 'l', 'o', 'n', 'g', '\t', '\t',
+ '0', 'x', '\0', '\0', '\0', '\0', '\0', '\0',
+ '\0', '\0', '\n' };
+
+ unchecked {
+ uint uvalue = (uint) value;
+ output [10] = hex [(uvalue & 0xf0000000) >> 28];
+ output [11] = hex [(uvalue & 0x0f000000) >> 24];
+ output [12] = hex [(uvalue & 0x00f00000) >> 20];
+ output [13] = hex [(uvalue & 0x000f0000) >> 16];
+ output [14] = hex [(uvalue & 0x0000f000) >> 12];
+ output [15] = hex [(uvalue & 0x00000f00) >> 8];
+ output [16] = hex [(uvalue & 0x000000f0) >> 4];
+ output [17] = hex [(uvalue & 0x0000000f)];
+ }
+
+ writer.Write (output, 0, output.Length);
+ }
+
+ public void WriteSLeb128 (int value)
+ {
+ writer.WriteLine ("\t.sleb128\t" + value);
+ }
+
+ public void WriteULeb128 (int value)
+ {
+ writer.WriteLine ("\t.uleb128\t" + value);
+ }
+
+ public void WriteAddress (int value)
+ {
+ if (value == 0)
+ writer.WriteLine ("\t.long\t\t0");
+ else
+ writer.WriteLine ("\t.long\t\t" + value);
+ }
+
+ public void WriteString (string value)
+ {
+ writer.WriteLine ("\t.string\t\t\"" + value + "\"");
+ }
+
+ public void WriteSectionStart (String section)
+ {
+ writer.WriteLine ("\t.section\t." + section);
+ }
+
+ public void WriteSectionEnd ()
+ {
+ writer.WriteLine ("\t.previous\n");
+ }
+
+ public void WriteRelativeOffset (int start_label, int end_label)
+ {
+ char[] output = { '\t', '.', 'l', 'o', 'n', 'g', '\t', '\t',
+ '.', 'L', '_', '\0', '\0', '\0', '\0', '\0', '\0',
+ ' ', '-', ' ',
+ '.', 'L', '_', '\0', '\0', '\0', '\0', '\0', '\0',
+ '\n' };
+
+ unchecked {
+ output [11] = hex [(end_label & 0xf00000) >> 20];
+ output [12] = hex [(end_label & 0x0f0000) >> 16];
+ output [13] = hex [(end_label & 0x00f000) >> 12];
+ output [14] = hex [(end_label & 0x000f00) >> 8];
+ output [15] = hex [(end_label & 0x0000f0) >> 4];
+ output [16] = hex [(end_label & 0x00000f)];
+ output [23] = hex [(start_label & 0xf00000) >> 20];
+ output [24] = hex [(start_label & 0x0f0000) >> 16];
+ output [25] = hex [(start_label & 0x00f000) >> 12];
+ output [26] = hex [(start_label & 0x000f00) >> 8];
+ output [27] = hex [(start_label & 0x0000f0) >> 4];
+ output [28] = hex [(start_label & 0x00000f)];
+ }
+
+ writer.Write (output, 0, output.Length);
+ }
+
+ public void WriteShortRelativeOffset (int start_label, int end_label)
+ {
+ char[] output = { '\t', '.', 'b', 'y', 't', 'e', '\t', '\t',
+ '.', 'L', '_', '\0', '\0', '\0', '\0', '\0', '\0',
+ ' ', '-', ' ',
+ '.', 'L', '_', '\0', '\0', '\0', '\0', '\0', '\0',
+ '\n' };
+
+ unchecked {
+ output [11] = hex [(end_label & 0xf00000) >> 20];
+ output [12] = hex [(end_label & 0x0f0000) >> 16];
+ output [13] = hex [(end_label & 0x00f000) >> 12];
+ output [14] = hex [(end_label & 0x000f00) >> 8];
+ output [15] = hex [(end_label & 0x0000f0) >> 4];
+ output [16] = hex [(end_label & 0x00000f)];
+ output [23] = hex [(start_label & 0xf00000) >> 20];
+ output [24] = hex [(start_label & 0x0f0000) >> 16];
+ output [25] = hex [(start_label & 0x00f000) >> 12];
+ output [26] = hex [(start_label & 0x000f00) >> 8];
+ output [27] = hex [(start_label & 0x0000f0) >> 4];
+ output [28] = hex [(start_label & 0x00000f)];
+ }
+
+ writer.Write (output, 0, output.Length);
+ }
+
+ public void WriteAbsoluteOffset (string label)
+ {
+ writer.WriteLine ("\t.long\t\t.L_" + label);
+ }
+
+ public void WriteAbsoluteOffset (int index)
+ {
+ char[] output = { '\t', '.', 'l', 'o', 'n', 'g', '\t', '\t',
+ '.', 'L', '_', '\0', '\0', '\0', '\0', '\0', '\0',
+ '\n' };
+
+ unchecked {
+ output [11] = hex [(index & 0xf00000) >> 20];
+ output [12] = hex [(index & 0x0f0000) >> 16];
+ output [13] = hex [(index & 0x00f000) >> 12];
+ output [14] = hex [(index & 0x000f00) >> 8];
+ output [15] = hex [(index & 0x0000f0) >> 4];
+ output [16] = hex [(index & 0x00000f)];
+ }
+
+ writer.Write (output, 0, output.Length);
+
+ }
+
+ public object StartSubsectionWithSize ()
+ {
+ int start_index = ++next_anon_label_idx;
+ int end_index = ++next_anon_label_idx;
+
+ WriteRelativeOffset (start_index, end_index);
+ WriteLabel (start_index);
+
+ return end_index;
+ }
+
+ public object StartSubsectionWithShortSize ()
+ {
+ int start_index = ++next_anon_label_idx;
+ int end_index = ++next_anon_label_idx;
+
+ WriteShortRelativeOffset (start_index, end_index);
+ WriteLabel (start_index);
+
+ return end_index;
+ }
+
+ public void EndSubsection (object end_index)
+ {
+ WriteLabel ((int) end_index);
+ }
+ }
+}
diff --git a/mcs/class/Mono.CSharp.Debugger/ChangeLog b/mcs/class/Mono.CSharp.Debugger/ChangeLog
new file mode 100644
index 00000000000..06564cbe071
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/ChangeLog
@@ -0,0 +1,125 @@
+2002-04-13 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (ISourceBlock): Added `Blocks' property and `AddBlock'
+ method to support nested blocks.
+
+ * MonoSymbolWriter.cs: Correctly handle nested blocks.
+
+ * MonoDwarfFileWriter.cs (DieMember): Provide info for all fields, not just for
+ public ones; also added DW_AT_accessibility.
+ (DieVariable): Reflected latest debug-symfile.c changes.
+
+2002-04-12 Martin Baulig <martin@gnome.org>
+
+ * gdb-variable-scopes.patch: A patch for GDB (against the latest CVS version)
+ to implement variable lifetimes.
+
+2002-04-12 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs (DieVariable): Provide info about the variable's
+ lifetime using DW_AT_begin_scope and a new baulig extension DW_AT_end_scope.
+
+2002-03-29 Martin Baulig <martin@gnome.org>
+
+ * AssemblerWriterI386.cs: Rewrote most of the string output function, do the
+ number->string conversion manually. It's now taking about 15 seconds to write
+ a symbol file for MCS, no longer more than a minute.
+
+ * MonoDwarfFileWriter.cs: Added some profiling code, speeded things up, fixed
+ a few bugs.
+
+2002-03-25 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs (CreateType): Return a `DieType'.
+ (RegisterType): Add the type to the type hash before creating dependency types
+ so we don't get recursion loops.
+ (RegisterPointerType): New func to register a "pointer to type" type.
+ (DieTypeDef, DiePointerType, DieArrayType, DieStringType, DieClassType): New
+ types; added support for strings, arrays and basic support for classes.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs: Killed all methods in this interface, no longer needed.
+
+ * MonoSymbolWriter.cs (MonoSymbolWriter): The constructor now takes a string
+ argument which is the full pathname of the assembly - you must call Close()
+ after the assembly has been written to disk since the symbol writer needs to
+ load the finished assembly to get its metadata.
+
+ * MonoDwarfFileWriter.cs: Added support for enums and structs.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * MonoDwarfFileWriter.cs: Added support for method parameters.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (IMonoSymbolWriter): Removed my custom OpenMethod(),
+ we're now using the ISymbolWriter's method.
+ (IVariable): Added `byte[] Signature' property.
+
+ * MonoSymbolWriter.cs (SetAssembly): New method. This must be called before
+ Close(); the assembly parameter is the already-written assembly, ie. it must
+ contain the full metadata.
+ (OpenMethod): Only take the token argument and set MethodInfo later in DoFixups.
+ (SetMethodSourceRange): You must call this function to tell the symbol writer
+ in which source file the method is defined.
+ (DefineLocal): Store the signature in the local.
+ (DoFixups): Use two new interncalls to set the SourceMethod's MethodInfo field
+ and the LocalVariable's Type field.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (ISourceBlock): New interface.
+ (ILocalVariable): Renamed this interface to IVariable.
+ (IVariable): Added Line, Type, Token.
+ (ILocalVariable, IMethodParameter): New interfaces, derive from IVariable.
+ (ISourceMethod): Added Blocks. Renamed FirstLine and LastLine to Start and End,
+ changed their type to ISourceLine. Removed CodeSize.
+ (ISourceLine): Renamed Line to Row, added Column. Added OffsetType and Offset.
+
+ * MonoDwarfFileWriter.cs (MonoDwarfFileWriter.DieLexicalBlock): New class.
+ (MonoDwarfFileWriter.DieMethodVariable): New class.
+
+ * MonoSymbolWriter.cs (OpenScope, CloseScope): Implemented.
+ Reflected latest IMonoSymbolWriter interface changes.
+
+2002-03-20 Martin Baulig <martin@gnome.org>
+
+ * IAssemblerWriter.cs: New interface.
+
+ * AssemblerWriterI386.cs: New class.
+
+ * MonoDwarfFileWriter.cs: Use the IAssemblerWriter interface to make this class
+ platform and assembler independent.
+
+2002-03-20 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (ISourceMethod): Added FirstLine, LastLine, CodeSize and
+ Token properties.
+
+ * MonoDwarfFileWriter.cs: Implemented line number support.
+
+2002-03-19 Martin Baulig <martin@gnome.org>
+
+ * IMonoSymbolWriter.cs (ISourceFile, ISourceMethod, ISourceLine, ILocalVariable):
+ New interfaces.
+
+ * IMonoSymbolWriter.cs (OpenMethod): Take a System.Reflection.MethodInfo, not
+ a string.
+
+2002-03-19 Martin Baulig <martin@gnome.org>
+
+ This is an implementation of the System.Diagnostics.SymbolStore.SymbolWriter
+ interface. It's still work in progress and not yet used anywhere.
+
+ There is some preliminary documentation in the source files and some more
+ docu in the README and README.relocation-table files.
+
+ * IMonoSymbolWriter.cs: New file.
+ * MonoDwarfFileWriter.cs: New file.
+ * MonoSymbolDocumentWriter.cs: New file.
+ * MonoSymbolWriter.cs: New file.
+
+ * README, README.relocation-table: Documentation.
+
diff --git a/mcs/class/Mono.CSharp.Debugger/IAssemblerWriter.cs b/mcs/class/Mono.CSharp.Debugger/IAssemblerWriter.cs
new file mode 100644
index 00000000000..169b9fc073e
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/IAssemblerWriter.cs
@@ -0,0 +1,70 @@
+//
+// Mono.CSharp.Debugger/IAssemblerWriter.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// This is a platform and assembler independent assembler output interface.
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+using System.IO;
+
+namespace Mono.CSharp.Debugger
+{
+ public interface IAssemblerWriter
+ {
+ int GetNextLabelIndex ();
+
+ void WriteLabel (int index);
+
+ void WriteLabel (string label);
+
+ int WriteLabel ();
+
+ void WriteUInt8 (bool value);
+
+ void WriteUInt8 (int value);
+
+ void WriteInt8 (int value);
+
+ void Write2Bytes (int a, int b);
+
+ void WriteUInt16 (int value);
+
+ void WriteInt16 (int value);
+
+ void WriteUInt32 (int value);
+
+ void WriteInt32 (int value);
+
+ void WriteSLeb128 (int value);
+
+ void WriteULeb128 (int value);
+
+ void WriteAddress (int value);
+
+ void WriteString (string value);
+
+ void WriteSectionStart (String section);
+
+ void WriteSectionEnd ();
+
+ void WriteRelativeOffset (int start_label, int end_label);
+
+ void WriteShortRelativeOffset (int start_label, int end_label);
+
+ void WriteAbsoluteOffset (int index);
+
+ void WriteAbsoluteOffset (string label);
+
+ object StartSubsectionWithSize ();
+
+ object StartSubsectionWithShortSize ();
+
+ void EndSubsection (object end_index);
+ }
+}
diff --git a/mcs/class/Mono.CSharp.Debugger/IMonoSymbolWriter.cs b/mcs/class/Mono.CSharp.Debugger/IMonoSymbolWriter.cs
new file mode 100644
index 00000000000..c4f56049283
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/IMonoSymbolWriter.cs
@@ -0,0 +1,167 @@
+//
+// System.Diagnostics.SymbolStore/IMonoSymbolWriter.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// This interface is derived from System.Diagnostics.SymbolStore.ISymbolWriter.
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Diagnostics.SymbolStore;
+using System.Collections;
+using System.IO;
+
+namespace Mono.CSharp.Debugger
+{
+ public interface IMonoSymbolWriter : ISymbolWriter
+ { }
+
+ public interface ISourceFile
+ {
+ string FileName {
+ get;
+ }
+
+ ISourceMethod[] Methods {
+ get;
+ }
+
+ void AddMethod (ISourceMethod method);
+ }
+
+ public interface ISourceMethod
+ {
+ ISourceLine[] Lines {
+ get;
+ }
+
+ void AddLine (ISourceLine line);
+
+ ISourceBlock[] Blocks {
+ get;
+ }
+
+ ILocalVariable[] Locals {
+ get;
+ }
+
+ void AddLocal (ILocalVariable local);
+
+
+ ISourceLine Start {
+ get;
+ }
+
+ ISourceLine End {
+ get;
+ }
+
+ int Token {
+ get;
+ }
+
+ MethodInfo MethodInfo {
+ get;
+ }
+
+ ISourceFile SourceFile {
+ get;
+ }
+ }
+
+ public interface ISourceBlock
+ {
+ ISourceMethod SourceMethod {
+ get;
+ }
+
+ ILocalVariable[] Locals {
+ get;
+ }
+
+ void AddLocal (ILocalVariable local);
+
+ ISourceBlock[] Blocks {
+ get;
+ }
+
+ void AddBlock (ISourceBlock block);
+
+ ISourceLine Start {
+ get;
+ }
+
+ ISourceLine End {
+ get;
+ }
+
+ int ID {
+ get;
+ }
+ }
+
+ public enum SourceOffsetType
+ {
+ OFFSET_NONE,
+ OFFSET_IL,
+ OFFSET_LOCAL,
+ OFFSET_PARAMETER
+ }
+
+ public interface ISourceLine
+ {
+ SourceOffsetType OffsetType {
+ get;
+ }
+
+ int Offset {
+ get;
+ }
+
+ int Row {
+ get;
+ }
+
+ int Column {
+ get;
+ }
+ }
+
+ public interface IVariable
+ {
+ string Name {
+ get;
+ }
+
+ ISourceLine Line {
+ get;
+ }
+
+ byte[] Signature {
+ get;
+ }
+
+ Type Type {
+ get;
+ }
+
+ int Token {
+ get;
+ }
+
+ int Index {
+ get;
+ }
+ }
+
+ public interface ILocalVariable : IVariable
+ { }
+
+ public interface IMethodParameter : IVariable
+ { }
+}
diff --git a/mcs/class/Mono.CSharp.Debugger/Mono.CSharp.Debugger.build b/mcs/class/Mono.CSharp.Debugger/Mono.CSharp.Debugger.build
new file mode 100644
index 00000000000..04c1931126a
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/Mono.CSharp.Debugger.build
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for Mono.CSharp.Debugger.dll -->
+
+<project name="Mono.CSharp.Debugger" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/Mono.CSharp.Debugger.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ </references>
+ </csc>
+ </target>
+ <target name="clean">
+ <delete file="../lib/Mono.CSharp.Debugger.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoDwarfFileWriter.cs b/mcs/class/Mono.CSharp.Debugger/MonoDwarfFileWriter.cs
new file mode 100755
index 00000000000..bca6977d5c7
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/MonoDwarfFileWriter.cs
@@ -0,0 +1,2257 @@
+//
+// System.Diagnostics.SymbolStore/MonoDwarfWriter.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// This is the default implementation of the System.Diagnostics.SymbolStore.ISymbolWriter
+// interface.
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.CompilerServices;
+using System.Diagnostics.SymbolStore;
+using System.Collections;
+using System.Text;
+using System.IO;
+
+namespace Mono.CSharp.Debugger
+{
+ public class DwarfFileWriter
+ {
+ protected const string producer_id = "Mono C# Compiler 0.01 03-18-2002";
+
+ protected ArrayList compile_units = new ArrayList ();
+ protected ArrayList line_number_engines = new ArrayList ();
+ protected StreamWriter writer = null;
+ protected IAssemblerWriter aw = null;
+ protected string symbol_file = null;
+
+ public bool timestamps = true;
+ public bool use_gnu_extensions = false;
+
+ // Write a generic file which contains no machine dependant stuff but
+ // only function and type declarations.
+ protected readonly bool DoGeneric = false;
+
+ //
+ // DwarfFileWriter public interface
+ //
+ public DwarfFileWriter (string symbol_file)
+ {
+ this.symbol_file = symbol_file;
+ this.writer = new StreamWriter (symbol_file, false, Encoding.ASCII);
+ this.aw = new AssemblerWriterI386 (this.writer);
+ this.last_time = DateTime.Now;
+ }
+
+ DateTime last_time;
+ void ShowTime (string msg)
+ {
+ DateTime now = DateTime.Now;
+ TimeSpan span = now - last_time;
+ last_time = now;
+
+ Console.WriteLine (
+ "MonoDwarfFileWriter [{0:00}:{1:000}] {2}",
+ (int) span.TotalSeconds, span.Milliseconds, msg);
+ }
+
+ // Writes the final dwarf file.
+ public void Close ()
+ {
+ if (timestamps)
+ ShowTime ("Emitting compile units");
+
+ foreach (CompileUnit compile_unit in compile_units)
+ compile_unit.Emit ();
+
+ if (timestamps)
+ ShowTime ("Done");
+
+ foreach (LineNumberEngine line_number_engine in line_number_engines)
+ line_number_engine.Emit ();
+
+ if (timestamps)
+ ShowTime ("Done emitting " + LineNumberEngine.count + " line numbers");
+
+ WriteAbbrevDeclarations ();
+ if (timestamps)
+ ShowTime ("Done writing abbrev declarations");
+
+ WriteRelocEntries ();
+ if (timestamps)
+ ShowTime ("Done writing " + reloc_entries.Count + " reloc entries");
+
+ writer.Close ();
+ }
+
+ // Adds a new compile unit to this dwarf file
+ public void AddCompileUnit (CompileUnit compile_unit)
+ {
+ compile_units.Add (compile_unit);
+ }
+
+ // Adds a new line number engine to this dwarf file
+ public void AddLineNumberEngine (LineNumberEngine line_number_engine)
+ {
+ line_number_engines.Add (line_number_engine);
+ }
+
+ public IAssemblerWriter AssemblerWriter {
+ get {
+ return aw;
+ }
+ }
+
+ // This string is written into the generated dwarf file to identify the
+ // producer and version number.
+ public string ProducerID {
+ get {
+ return producer_id;
+ }
+ }
+
+ //
+ // Create a debugging information entry for the given type.
+ //
+ public DieType CreateType (DieCompileUnit die_compile_unit, Type type)
+ {
+ if (type.IsPointer)
+ return new DiePointerType (die_compile_unit, type.GetElementType ());
+ else if (type.IsEnum)
+ return new DieEnumType (die_compile_unit, type);
+ else if (type.Equals (typeof (string)))
+ return new DieStringType (die_compile_unit, type);
+ else if (type.IsArray)
+ return new DieArrayType (die_compile_unit, type.GetElementType (),
+ type.GetArrayRank ());
+ else if (type.IsValueType)
+ return new DieStructureType (die_compile_unit, type);
+ else if (type.IsClass)
+ return new DieClassType (die_compile_unit, type);
+
+ return new DiePointerType (die_compile_unit, typeof (void));
+
+ // throw new NotSupportedException ("Type " + type + " is not yet supported.");
+ }
+
+ //
+ // A compile unit refers to a single C# source file.
+ //
+ public class CompileUnit
+ {
+ protected DwarfFileWriter dw;
+ protected IAssemblerWriter aw;
+ protected string source_file;
+ protected ArrayList dies = new ArrayList ();
+
+ public readonly int ReferenceIndex;
+
+ public CompileUnit (DwarfFileWriter dw, string source_file, Die[] dies)
+ {
+ this.dw = dw;
+ this.aw = dw.AssemblerWriter;
+ this.source_file = source_file;
+ if (dies != null)
+ this.dies.AddRange (dies);
+
+ this.ReferenceIndex = this.aw.GetNextLabelIndex ();
+
+ dw.AddCompileUnit (this);
+ }
+
+ //
+ // Construct a new compile unit for source file @source_file.
+ //
+ // This constructor automatically adds the newly created compile
+ // unit to the DwarfFileWriter's list of compile units.
+ //
+ public CompileUnit (DwarfFileWriter dw, string source_file)
+ : this (dw, source_file, null)
+ { }
+
+ public string SourceFile {
+ get {
+ return source_file;
+ }
+ }
+
+ public string ProducerID {
+ get {
+ return dw.ProducerID;
+ }
+ }
+
+ public DwarfFileWriter DwarfFileWriter
+ {
+ get {
+ return dw;
+ }
+ }
+
+ // Add a new debugging information entry to this compile unit.
+ public void AddDie (Die die)
+ {
+ dies.Add (die);
+ }
+
+ // Write the whole compile unit to the dwarf file.
+ public void Emit ()
+ {
+ object start_index, end_index;
+
+ dw.WriteSectionStart (Section.DEBUG_INFO);
+
+ aw.WriteLabel (ReferenceIndex);
+
+ start_index = aw.WriteLabel ();
+
+ end_index = aw.StartSubsectionWithSize ();
+ aw.WriteUInt16 (2);
+ aw.WriteAbsoluteOffset ("debug_abbrev_b");
+ if (dw.DoGeneric)
+ aw.WriteUInt8 (4);
+ else {
+ dw.AddRelocEntry (RelocEntryType.TARGET_ADDRESS_SIZE);
+ aw.WriteUInt8 (4);
+ }
+
+ if (dies != null)
+ foreach (Die die in dies)
+ die.Emit ();
+
+ aw.EndSubsection (end_index);
+
+ aw.WriteSectionEnd ();
+ }
+ }
+
+ public class LineNumberEngine
+ {
+ public readonly int ReferenceIndex;
+
+ public readonly int LineBase = 1;
+ public readonly int LineRange = 8;
+
+ protected DwarfFileWriter dw;
+ protected IAssemblerWriter aw;
+
+ public readonly int[] StandardOpcodeSizes = {
+ 0, 0, 1, 1, 1, 1, 0, 0, 0, 0
+ };
+
+ public readonly int OpcodeBase;
+
+ public static int count = 0;
+
+ private Hashtable _sources = new Hashtable ();
+ private Hashtable _directories = new Hashtable ();
+ private Hashtable _methods = new Hashtable ();
+
+ private int next_source_id;
+ private int next_directory_id;
+
+ private int next_method_id;
+
+ private enum DW_LNS {
+ LNS_extended_op = 0,
+ LNS_copy = 1,
+ LNS_advance_pc = 2,
+ LNS_advance_line = 3,
+ LNS_set_file = 4,
+ LNS_set_column = 5,
+ LNS_negate_stmt = 6,
+ LNS_set_basic_block = 7,
+ LNS_const_add_pc = 8,
+ LNS_fixed_advance_pc = 9
+ };
+
+ private enum DW_LNE {
+ LNE_end_sequence = 1,
+ LNE_set_address = 2,
+ LNE_define_file = 3
+ };
+
+ public ISourceFile[] Sources {
+ get {
+ ISourceFile[] retval = new ISourceFile [_sources.Count];
+
+ foreach (ISourceFile source in _sources.Keys)
+ retval [(int) _sources [source] - 1] = source;
+
+ return retval;
+ }
+ }
+
+ public string[] Directories {
+ get {
+ string[] retval = new string [_directories.Count];
+
+ foreach (string directory in _directories.Keys)
+ retval [(int) _directories [directory] - 1] = directory;
+
+ return retval;
+ }
+ }
+
+ public ISourceMethod[] Methods {
+ get {
+ ISourceMethod[] retval = new ISourceMethod [_methods.Count];
+
+ foreach (ISourceMethod method in _methods.Keys) {
+ retval [(int) _methods [method] - 1] = method;
+ }
+
+ return retval;
+ }
+ }
+
+ public LineNumberEngine (DwarfFileWriter writer)
+ {
+ this.dw = writer;
+ this.aw = writer.AssemblerWriter;
+ this.ReferenceIndex = aw.GetNextLabelIndex ();
+
+ dw.AddLineNumberEngine (this);
+ }
+
+ public int LookupSource (ISourceFile source)
+ {
+ if (_sources.ContainsKey (source))
+ return (int) _sources [source];
+
+ int index = ++next_source_id;
+ _sources.Add (source, index);
+ return index;
+ }
+
+ public int LookupDirectory (string directory)
+ {
+ if (_directories.ContainsKey (directory))
+ return (int) _directories [directory];
+
+ int index = ++next_directory_id;
+ _directories.Add (directory, index);
+ return index;
+ }
+
+ public void AddMethod (ISourceMethod method)
+ {
+ LookupSource (method.SourceFile);
+
+ int index = ++next_method_id;
+ _methods.Add (method, index);
+ }
+
+ private void SetFile (ISourceFile source)
+ {
+ aw.WriteInt8 ((int) DW_LNS.LNS_set_file);
+ aw.WriteULeb128 (LookupSource (source));
+ }
+
+ private int st_line = 1;
+
+ private void SetLine (int line)
+ {
+ aw.WriteInt8 ((int) DW_LNS.LNS_advance_line);
+ aw.WriteSLeb128 (line - st_line);
+ st_line = line;
+ }
+
+ private void SetAddress (int token, int address)
+ {
+ aw.WriteUInt8 (0);
+ object end_index = aw.StartSubsectionWithShortSize ();
+ aw.WriteUInt8 ((int) DW_LNE.LNE_set_address);
+ dw.AddRelocEntry (RelocEntryType.IL_OFFSET, token, address);
+ aw.WriteAddress (0);
+ aw.EndSubsection (end_index);
+ }
+
+ private void SetStartAddress (int token)
+ {
+ aw.WriteUInt8 (0);
+ object end_index = aw.StartSubsectionWithShortSize ();
+ aw.WriteUInt8 ((int) DW_LNE.LNE_set_address);
+ dw.AddRelocEntry (RelocEntryType.METHOD_START_ADDRESS, token);
+ aw.WriteAddress (0);
+ aw.EndSubsection (end_index);
+ }
+
+ private void SetEndAddress (int token)
+ {
+ aw.WriteUInt8 (0);
+ object end_index = aw.StartSubsectionWithShortSize ();
+ aw.WriteUInt8 ((int) DW_LNE.LNE_set_address);
+ dw.AddRelocEntry (RelocEntryType.METHOD_END_ADDRESS, token);
+ aw.WriteAddress (0);
+ aw.EndSubsection (end_index);
+ }
+
+ private void SetBasicBlock ()
+ {
+ aw.WriteUInt8 ((int) DW_LNS.LNS_set_basic_block);
+ }
+
+ private void EndSequence ()
+ {
+ aw.WriteUInt8 (0);
+ aw.WriteUInt8 (1);
+ aw.WriteUInt8 ((int) DW_LNE.LNE_end_sequence);
+
+ st_line = 1;
+ }
+
+ private void Commit ()
+ {
+ aw.WriteUInt8 ((int) DW_LNS.LNS_copy);
+ }
+
+ private void WriteOneLine (int token, int line, int offset)
+ {
+ aw.WriteInt8 ((int) DW_LNS.LNS_advance_line);
+ aw.WriteSLeb128 (line - st_line);
+ aw.WriteUInt8 (0);
+ object end_index = aw.StartSubsectionWithShortSize ();
+ aw.WriteUInt8 ((int) DW_LNE.LNE_set_address);
+ dw.AddRelocEntry (RelocEntryType.IL_OFFSET, token, offset);
+ aw.WriteAddress (0);
+ aw.EndSubsection (end_index);
+
+ aw.Write2Bytes ((int) DW_LNS.LNS_set_basic_block,
+ (int) DW_LNS.LNS_copy);
+
+ st_line = line;
+ }
+
+ public void Emit ()
+ {
+ dw.WriteSectionStart (Section.DEBUG_LINE);
+ aw.WriteLabel (ReferenceIndex);
+ object end_index = aw.StartSubsectionWithSize ();
+
+ aw.WriteUInt16 (2);
+ object start_index = aw.StartSubsectionWithSize ();
+ aw.WriteUInt8 (1);
+ aw.WriteUInt8 (1);
+ aw.WriteInt8 (LineBase);
+ aw.WriteUInt8 (LineRange);
+ aw.WriteUInt8 (StandardOpcodeSizes.Length);
+ for (int i = 1; i < StandardOpcodeSizes.Length; i++)
+ aw.WriteUInt8 (StandardOpcodeSizes [i]);
+
+ foreach (string directory in Directories)
+ aw.WriteString (directory);
+ aw.WriteUInt8 (0);
+
+ foreach (ISourceFile source in Sources) {
+ aw.WriteString (source.FileName);
+ aw.WriteULeb128 (0);
+ aw.WriteULeb128 (0);
+ aw.WriteULeb128 (0);
+ }
+
+ aw.WriteUInt8 (0);
+
+ aw.EndSubsection (start_index);
+
+ foreach (ISourceMethod method in Methods) {
+ if (method.Start == null || method.Start.Row == 0)
+ continue;
+
+ SetFile (method.SourceFile);
+ SetLine (method.Start.Row);
+ SetStartAddress (method.Token);
+ SetBasicBlock ();
+ Commit ();
+
+ foreach (ISourceLine line in method.Lines) {
+ count++;
+ WriteOneLine (method.Token, line.Row, line.Offset);
+ // SetLine (line.Row);
+ // SetAddress (method.Token, line.Offset);
+ // SetBasicBlock ();
+ // Commit ();
+ }
+
+ SetLine (method.End.Row);
+ SetEndAddress (method.Token);
+ SetBasicBlock ();
+ Commit ();
+
+ EndSequence ();
+ }
+
+ aw.EndSubsection (end_index);
+ aw.WriteSectionEnd ();
+ }
+ }
+
+ // DWARF tag from the DWARF 2 specification.
+ public enum DW_TAG {
+ TAG_array_type = 0x01,
+ TAG_class_type = 0x02,
+ TAG_enumeration_type = 0x04,
+ TAG_formal_parameter = 0x05,
+ TAG_lexical_block = 0x0b,
+ TAG_member = 0x0d,
+ TAG_pointer_type = 0x0f,
+ TAG_compile_unit = 0x11,
+ TAG_string_type = 0x12,
+ TAG_structure_type = 0x13,
+ TAG_typedef = 0x16,
+ TAG_inheritance = 0x1c,
+ TAG_subrange_type = 0x21,
+ TAG_base_type = 0x24,
+ TAG_enumerator = 0x28,
+ TAG_subprogram = 0x2e,
+ TAG_variable = 0x34
+ }
+
+ // DWARF attribute from the DWARF 2 specification.
+ public enum DW_AT {
+ AT_location = 0x02,
+ AT_name = 0x03,
+ AT_byte_size = 0x0b,
+ AT_stmt_list = 0x10,
+ AT_low_pc = 0x11,
+ AT_high_pc = 0x12,
+ AT_language = 0x13,
+ AT_string_length = 0x19,
+ AT_const_value = 0x1c,
+ AT_lower_bound = 0x22,
+ AT_producer = 0x25,
+ AT_start_scope = 0x2c,
+ AT_upper_bound = 0x2f,
+ AT_accessibility = 0x32,
+ AT_artificial = 0x34,
+ AT_data_member_location = 0x38,
+ AT_declaration = 0x3c,
+ AT_encoding = 0x3e,
+ AT_external = 0x3f,
+ AT_type = 0x49,
+ AT_data_location = 0x50,
+ AT_end_scope = 0x2121
+ }
+
+ // DWARF form from the DWARF 2 specification.
+ public enum DW_FORM {
+ FORM_addr = 0x01,
+ FORM_block4 = 0x04,
+ FORM_data4 = 0x06,
+ FORM_string = 0x08,
+ FORM_data1 = 0x0b,
+ FORM_flag = 0x0c,
+ FORM_sdata = 0x0d,
+ FORM_udata = 0x0f,
+ FORM_ref4 = 0x13
+ }
+
+ public enum DW_LANG {
+ LANG_C_plus_plus = 0x04,
+ LANG_C_sharp = 0x9001
+ }
+
+ public enum DW_OP {
+ OP_deref = 0x06,
+ OP_const1u = 0x08,
+ OP_const1s = 0x09,
+ OP_const2u = 0x0a,
+ OP_const2s = 0x0b,
+ OP_const4u = 0x0c,
+ OP_const4s = 0x0d,
+ OP_const8u = 0x0e,
+ OP_const8s = 0x0f,
+ OP_constu = 0x10,
+ OP_consts = 0x11,
+ OP_plus = 0x22,
+ OP_plus_uconst = 0x23,
+ OP_fbreg = 0x91,
+ }
+
+ public enum DW_ACCESS {
+ ACCESS_public = 1,
+ ACCESS_protected = 2,
+ ACCESS_private = 3
+ };
+
+ protected enum MRI_string {
+ offset_length = 0x00,
+ offset_vector = 0x01
+ }
+
+ protected enum MRI_array {
+ offset_bounds = 0x00,
+ offset_max_length = 0x01,
+ offset_vector = 0x02
+ }
+
+ protected enum MRI_array_bounds {
+ offset_lower = 0x00,
+ offset_length = 0x01
+ }
+
+ protected class MethodParameter : IMethodParameter
+ {
+ public MethodParameter (ISourceMethod method, ParameterInfo param)
+ {
+ this._method = method;
+ this._param = param;
+ }
+
+ private readonly ISourceMethod _method;
+ private readonly ParameterInfo _param;
+
+ // interface IMethodParameter
+
+ public string Name {
+ get {
+ return _param.Name;
+ }
+ }
+
+ public int Token {
+ get {
+ return _method.Token;
+ }
+ }
+
+ public int Index {
+ get {
+ return _method.MethodInfo.IsStatic ? _param.Position - 1 :
+ _param.Position;
+ }
+ }
+
+ public Type Type {
+ get {
+ return _param.ParameterType;
+ }
+ }
+
+ public byte[] Signature {
+ get {
+ return null;
+ }
+ }
+
+ public ISourceLine Line {
+ get {
+ return null;
+ }
+ }
+ }
+
+ // Abstract base class for a "debugging information entry" (die).
+ public abstract class Die
+ {
+ protected DwarfFileWriter dw;
+ protected IAssemblerWriter aw;
+ protected ArrayList child_dies = new ArrayList ();
+ public readonly Die Parent;
+
+ protected readonly int abbrev_id;
+ protected readonly AbbrevDeclaration abbrev_decl;
+
+ public readonly int ReferenceIndex;
+
+ //
+ // Create a new die If @parent is not null, add the newly
+ // created die to the parent's list of child dies.
+ //
+ // @abbrev_id is the abbreviation id for this die class.
+ // Derived classes should call the DwarfFileWriter's static
+ // RegisterAbbrevDeclaration function in their static constructor
+ // to get an abbrev id. Once you registered an abbrev entry, it'll
+ // be automatically written to the debug_abbrev section.
+ //
+ public Die (DwarfFileWriter dw, Die parent, int abbrev_id)
+ {
+ this.dw = dw;
+ this.aw = dw.AssemblerWriter;
+ this.Parent = parent;
+ this.abbrev_id = abbrev_id;
+ this.abbrev_decl = GetAbbrevDeclaration (abbrev_id);
+ this.ReferenceIndex = this.aw.GetNextLabelIndex ();
+
+ if (parent != null)
+ parent.AddChildDie (this);
+ }
+
+ public Die (DwarfFileWriter dw, int abbrev_id)
+ : this (dw, null, abbrev_id)
+ { }
+
+ public Die (Die parent, int abbrev_id)
+ : this (parent.dw, parent, abbrev_id)
+ { }
+
+ protected void AddChildDie (Die die)
+ {
+ child_dies.Add (die);
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is Die))
+ return false;
+
+ return ((Die) o).ReferenceIndex == ReferenceIndex;
+ }
+
+ public override int GetHashCode ()
+ {
+ return ReferenceIndex;
+ }
+
+ //
+ // Write this die and all its children to the dwarf file.
+ //
+ public virtual void Emit ()
+ {
+ aw.WriteLabel (ReferenceIndex);
+
+ aw.WriteULeb128 (abbrev_id);
+ DoEmit ();
+
+ if (abbrev_decl.HasChildren) {
+ foreach (Die child in child_dies)
+ child.Emit ();
+
+ aw.WriteUInt8 (0);
+ }
+ }
+
+ //
+ // Derived classes must implement this function to actually
+ // write themselves to the dwarf file.
+ //
+ // Note that the abbrev id has already been written in Emit() -
+ // if you don't like this, you must override Emit() as well.
+ //
+ public abstract void DoEmit ();
+
+ //
+ // Gets the compile unit of this die.
+ //
+ public virtual DieCompileUnit GetCompileUnit ()
+ {
+ Die die = this;
+
+ while (die.Parent != null)
+ die = die.Parent;
+
+ if (die is DieCompileUnit)
+ return (DieCompileUnit) die;
+ else
+ return null;
+ }
+
+ public DieCompileUnit DieCompileUnit {
+ get {
+ return GetCompileUnit ();
+ }
+ }
+ }
+
+ // DW_TAG_compile_unit
+ public class DieCompileUnit : Die
+ {
+ private static int my_abbrev_id;
+
+ protected Hashtable types = new Hashtable ();
+ protected Hashtable pointer_types = new Hashtable ();
+
+ static DieCompileUnit ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_producer, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_language, DW_FORM.FORM_udata),
+ new AbbrevEntry (DW_AT.AT_stmt_list, DW_FORM.FORM_ref4)
+ };
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_compile_unit, true, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ public readonly CompileUnit CompileUnit;
+ public readonly bool DoGeneric;
+ public readonly LineNumberEngine LineNumberEngine;
+
+ //
+ // Create a new DW_TAG_compile_unit debugging information entry
+ // and add it to the @compile_unit.
+ //
+ public DieCompileUnit (CompileUnit compile_unit)
+ : base (compile_unit.DwarfFileWriter, my_abbrev_id)
+ {
+ this.CompileUnit = compile_unit;
+ this.DoGeneric = dw.DoGeneric;
+ compile_unit.AddDie (this);
+
+ // GDB doesn't support DW_TAG_base_types yet, so we need to
+ // include the types in each compile unit.
+ RegisterType (typeof (bool));
+ RegisterType (typeof (char));
+ RegisterType (typeof (SByte));
+ RegisterType (typeof (Byte));
+ RegisterType (typeof (Int16));
+ RegisterType (typeof (UInt16));
+ RegisterType (typeof (Int32));
+ RegisterType (typeof (UInt32));
+ RegisterType (typeof (Int64));
+ RegisterType (typeof (UInt64));
+ RegisterType (typeof (Single));
+ RegisterType (typeof (Double));
+
+ LineNumberEngine = new LineNumberEngine (dw);
+ }
+
+ // Registers a new type
+ public Die RegisterType (Type type)
+ {
+ if (types.Contains (type))
+ return (Die) types [type];
+
+ if (type.IsPrimitive) {
+ Die base_type = new DieBaseType (this, type);
+
+ types.Add (type, base_type);
+
+ return base_type;
+ }
+
+ DieType die = dw.CreateType (this, type);
+
+ types.Add (type, die);
+
+ die.RegisterDependencyTypes ();
+
+ return die;
+ }
+
+ public Die RegisterPointerType (Type type)
+ {
+ if (pointer_types.Contains (type))
+ return (Die) pointer_types [type];
+
+ Die type_die = RegisterType (type);
+
+ Die pointer_die = new DieInternalPointer (this, type_die);
+
+ pointer_types.Add (type, pointer_die);
+
+ return pointer_die;
+ }
+
+ public void WriteRelativeDieReference (Die target_die)
+ {
+ if (!this.Equals (target_die.GetCompileUnit ()))
+ throw new ArgumentException ("Target die must be in the same "
+ + "compile unit");
+
+ aw.WriteRelativeOffset (CompileUnit.ReferenceIndex,
+ target_die.ReferenceIndex);
+ }
+
+ public override void DoEmit ()
+ {
+ aw.WriteString (CompileUnit.SourceFile);
+ aw.WriteString (CompileUnit.ProducerID);
+ if (dw.use_gnu_extensions)
+ aw.WriteULeb128 ((int) DW_LANG.LANG_C_sharp);
+ else
+ aw.WriteULeb128 ((int) DW_LANG.LANG_C_plus_plus);
+ aw.WriteAbsoluteOffset (LineNumberEngine.ReferenceIndex);
+ }
+ }
+
+ // DW_TAG_subprogram
+ public class DieSubProgram : Die
+ {
+ private static int my_abbrev_id_1;
+ private static int my_abbrev_id_2;
+ private static int my_abbrev_id_3;
+ private static int my_abbrev_id_4;
+
+ static DieSubProgram ()
+ {
+ // Method without return value
+ AbbrevEntry[] entries_1 = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_external, DW_FORM.FORM_flag),
+ new AbbrevEntry (DW_AT.AT_low_pc, DW_FORM.FORM_addr),
+ new AbbrevEntry (DW_AT.AT_high_pc, DW_FORM.FORM_addr)
+ };
+ // Method with return value
+ AbbrevEntry[] entries_2 = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_external, DW_FORM.FORM_flag),
+ new AbbrevEntry (DW_AT.AT_low_pc, DW_FORM.FORM_addr),
+ new AbbrevEntry (DW_AT.AT_high_pc, DW_FORM.FORM_addr),
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4)
+ };
+ // Method declaration without return value
+ AbbrevEntry[] entries_3 = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_external, DW_FORM.FORM_flag),
+ new AbbrevEntry (DW_AT.AT_declaration, DW_FORM.FORM_flag)
+ };
+ // Method declaration with return value
+ AbbrevEntry[] entries_4 = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_external, DW_FORM.FORM_flag),
+ new AbbrevEntry (DW_AT.AT_declaration, DW_FORM.FORM_flag),
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4)
+ };
+
+
+ AbbrevDeclaration decl_1 = new AbbrevDeclaration (
+ DW_TAG.TAG_subprogram, true, entries_1);
+ AbbrevDeclaration decl_2 = new AbbrevDeclaration (
+ DW_TAG.TAG_subprogram, true, entries_2);
+ AbbrevDeclaration decl_3 = new AbbrevDeclaration (
+ DW_TAG.TAG_subprogram, true, entries_3);
+ AbbrevDeclaration decl_4 = new AbbrevDeclaration (
+ DW_TAG.TAG_subprogram, true, entries_4);
+
+ my_abbrev_id_1 = RegisterAbbrevDeclaration (decl_1);
+ my_abbrev_id_2 = RegisterAbbrevDeclaration (decl_2);
+ my_abbrev_id_3 = RegisterAbbrevDeclaration (decl_3);
+ my_abbrev_id_4 = RegisterAbbrevDeclaration (decl_4);
+ }
+
+ private static int get_abbrev_id (DieCompileUnit parent_die, ISourceMethod method)
+ {
+ if (parent_die.DoGeneric)
+ if (method.MethodInfo.ReturnType == typeof (void))
+ return my_abbrev_id_3;
+ else
+ return my_abbrev_id_4;
+ else
+ if (method.MethodInfo.ReturnType == typeof (void))
+ return my_abbrev_id_1;
+ else
+ return my_abbrev_id_2;
+ }
+
+ protected ISourceMethod method;
+ protected Die retval_die;
+
+ //
+ // Create a new DW_TAG_subprogram debugging information entry
+ // for method @name (which has a void return value) and add it
+ // to the @parent_die
+ //
+ public DieSubProgram (DieCompileUnit parent_die, ISourceMethod method)
+ : base (parent_die, get_abbrev_id (parent_die, method))
+ {
+ this.method = method;
+
+ if (method.MethodInfo.ReturnType != typeof (void))
+ retval_die = DieCompileUnit.RegisterType (
+ method.MethodInfo.ReturnType);
+
+ if (!method.MethodInfo.IsStatic)
+ new DieMethodVariable (this, method);
+
+ ParameterInfo[] parameters = method.MethodInfo.GetParameters ();
+ foreach (ParameterInfo param in parameters) {
+ MethodParameter mp = new MethodParameter (method, param);
+
+ new DieMethodVariable (this, mp);
+ }
+
+ DieCompileUnit.LineNumberEngine.AddMethod (method);
+ }
+
+ public override void DoEmit ()
+ {
+ aw.WriteString (method.MethodInfo.Name);
+ aw.WriteUInt8 (true);
+ if (dw.DoGeneric)
+ aw.WriteUInt8 (true);
+ else {
+ dw.AddRelocEntry (RelocEntryType.METHOD_START_ADDRESS, method.Token);
+ aw.WriteAddress (0);
+ dw.AddRelocEntry (RelocEntryType.METHOD_END_ADDRESS, method.Token);
+ aw.WriteAddress (0);
+ }
+ if (method.MethodInfo.ReturnType != typeof (void))
+ DieCompileUnit.WriteRelativeDieReference (retval_die);
+ }
+ }
+
+ // DW_TAG_base_type
+ public class DieBaseType : Die
+ {
+ private static int my_abbrev_id;
+
+ static DieBaseType ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_encoding, DW_FORM.FORM_data1),
+ new AbbrevEntry (DW_AT.AT_byte_size, DW_FORM.FORM_data1)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_base_type, false, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ protected Type type;
+
+ //
+ // Create a new DW_TAG_base_type debugging information entry
+ //
+ public DieBaseType (DieCompileUnit parent_die, Type type)
+ : base (parent_die, my_abbrev_id)
+ {
+ this.type = type;
+ }
+
+ protected enum DW_ATE {
+ ATE_void = 0x00,
+ ATE_address = 0x01,
+ ATE_boolean = 0x02,
+ ATE_complex_float = 0x03,
+ ATE_float = 0x04,
+ ATE_signed = 0x05,
+ ATE_signed_char = 0x06,
+ ATE_unsigned = 0x07,
+ ATE_unsigned_char = 0x08
+ }
+
+ public override void DoEmit ()
+ {
+ string name = type.Name;
+
+ aw.WriteString (name);
+ switch (name) {
+ case "Void":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_address);
+ aw.WriteUInt8 (0);
+ break;
+ case "Boolean":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_boolean);
+ aw.WriteUInt8 (1);
+ break;
+ case "Char":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_unsigned_char);
+ aw.WriteUInt8 (2);
+ break;
+ case "SByte":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_signed);
+ aw.WriteUInt8 (1);
+ break;
+ case "Byte":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_unsigned);
+ aw.WriteUInt8 (1);
+ break;
+ case "Int16":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_signed);
+ aw.WriteUInt8 (2);
+ break;
+ case "UInt16":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_unsigned);
+ aw.WriteUInt8 (2);
+ break;
+ case "Int32":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_signed);
+ aw.WriteUInt8 (4);
+ break;
+ case "UInt32":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_unsigned);
+ aw.WriteUInt8 (4);
+ break;
+ case "Int64":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_signed);
+ aw.WriteUInt8 (8);
+ break;
+ case "UInt64":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_unsigned);
+ aw.WriteUInt8 (8);
+ break;
+ case "Single":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_float);
+ aw.WriteUInt8 (4);
+ break;
+ case "Double":
+ aw.WriteUInt8 ((int) DW_ATE.ATE_float);
+ aw.WriteUInt8 (8);
+ break;
+ default:
+ throw new ArgumentException ("Not a base type: " + type);
+ }
+ }
+ }
+
+ public abstract class DieType : Die
+ {
+ public DieType (DieCompileUnit parent_die, Type type, int abbrev_id)
+ : base (parent_die, abbrev_id)
+ {
+ this.type = type;
+ }
+
+ protected Type type;
+
+ //
+ // This is called after the type has been added to the type hash.
+ //
+ // You need to register your dependency types here and not in the
+ // constructor to avoid a recursion loop if a type references itself.
+ //
+ public virtual void RegisterDependencyTypes ()
+ {
+ // do nothing
+ }
+ }
+
+ public class DieTypeDef : Die
+ {
+ private static int my_abbrev_id;
+
+ static DieTypeDef ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_typedef, false, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ protected string name;
+ protected Die type_die;
+
+ public DieTypeDef (Die parent_die, Die type_die, string name)
+ : base (parent_die, my_abbrev_id)
+ {
+ this.name = name;
+ this.type_die = type_die;
+ }
+
+ public override void DoEmit ()
+ {
+ aw.WriteString (name);
+ DieCompileUnit.WriteRelativeDieReference (type_die);
+ }
+ }
+
+ // DW_TAG_pointer_type
+ public class DiePointerType : DieType
+ {
+ private static int my_abbrev_id;
+
+ static DiePointerType ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_pointer_type, false, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ protected Die type_die;
+
+ public DiePointerType (DieCompileUnit parent_die, Type type)
+ : base (parent_die, type, my_abbrev_id)
+ { }
+
+ public override void RegisterDependencyTypes ()
+ {
+ type_die = DieCompileUnit.RegisterType (type);
+ }
+
+ public override void DoEmit ()
+ {
+ DieCompileUnit.WriteRelativeDieReference (type_die);
+ }
+ }
+
+ public class DieInternalPointer : Die
+ {
+ private static int my_abbrev_id;
+
+ static DieInternalPointer ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_pointer_type, false, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ protected Die type_die;
+
+ public DieInternalPointer (Die parent_die, Die type_die)
+ : base (parent_die, my_abbrev_id)
+ {
+ this.type_die = type_die;
+ }
+
+ public override void DoEmit ()
+ {
+ DieCompileUnit.WriteRelativeDieReference (type_die);
+ }
+ }
+
+ // DW_TAG_enumeration_type
+ public class DieEnumType : DieType
+ {
+ private static int my_abbrev_id;
+
+ static DieEnumType ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_byte_size, DW_FORM.FORM_data1)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_enumeration_type, true, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ public DieEnumType (DieCompileUnit parent_die, Type type)
+ : base (parent_die, type, my_abbrev_id)
+ {
+ Array values = Enum.GetValues (type);
+ string[] names = Enum.GetNames (type);
+
+ foreach (object value in values) {
+ int intval;
+ string name = null;
+
+ if (value is int)
+ intval = (int) value;
+ else
+ intval = System.Convert.ToInt32 (value);
+
+ for (int i = 0; i < values.Length; ++i)
+ if (value.Equals (values.GetValue (i))) {
+ name = names [i];
+ break;
+ }
+
+ if (name == null)
+ throw new ArgumentException ();
+
+ new DieEnumerator (this, name, intval);
+ }
+ }
+
+ public override void DoEmit ()
+ {
+ aw.WriteString (type.Name);
+ dw.AddRelocEntry_TypeSize (type);
+ aw.WriteUInt8 (0);
+ }
+ }
+
+ // DW_TAG_enumerator
+ public class DieEnumerator : Die
+ {
+ private static int my_abbrev_id;
+
+ static DieEnumerator ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_const_value, DW_FORM.FORM_data4)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_enumerator, false, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ protected string name;
+ protected int value;
+
+ public DieEnumerator (DieEnumType parent_die, string name, int value)
+ : base (parent_die, my_abbrev_id)
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+ public override void DoEmit ()
+ {
+ aw.WriteString (name);
+ aw.WriteInt32 (value);
+ }
+ }
+
+ // DW_TAG_structure_type
+ public class DieStructureType : DieType
+ {
+ private static int my_abbrev_id;
+
+ static DieStructureType ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_byte_size, DW_FORM.FORM_data1)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_structure_type, true, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ protected string name;
+ protected FieldInfo[] fields;
+ protected Die[] field_type_dies;
+ protected Die[] field_dies;
+
+ protected const BindingFlags FieldBindingFlags =
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static |
+ BindingFlags.Instance;
+
+ public override void RegisterDependencyTypes ()
+ {
+ fields = type.GetFields (FieldBindingFlags);
+ field_type_dies = new Die [fields.Length];
+ field_dies = new Die [fields.Length];
+
+ for (int i = 0; i < fields.Length; i++) {
+ Type field_type = fields [i].FieldType;
+ field_type_dies [i] = DieCompileUnit.RegisterType (field_type);
+
+ DW_ACCESS access;
+ if (fields [i].IsPublic)
+ access = DW_ACCESS.ACCESS_public;
+ else if (fields [i].IsPrivate)
+ access = DW_ACCESS.ACCESS_private;
+ else
+ access = DW_ACCESS.ACCESS_protected;
+
+ field_dies [i] = new DieMember (this, type, fields [i].Name,
+ i, field_type_dies [i],
+ access);
+ }
+ }
+
+ public DieStructureType (DieCompileUnit parent_die, Type type)
+ : this (parent_die, type, type.Name, my_abbrev_id)
+ { }
+
+ protected DieStructureType (DieCompileUnit parent_die, Type type, int abbrev_id)
+ : this (parent_die, type, type.Name, abbrev_id)
+ { }
+
+ protected DieStructureType (DieCompileUnit parent_die, Type type, string name)
+ : this (parent_die, type, name, my_abbrev_id)
+ { }
+
+ protected DieStructureType (DieCompileUnit parent_die, Type type,
+ string name, int abbrev_id)
+ : base (parent_die, type, abbrev_id)
+ {
+ this.name = name;
+ }
+
+ public override void DoEmit ()
+ {
+ aw.WriteString (name);
+ dw.AddRelocEntry_TypeSize (type);
+ aw.WriteUInt8 (0);
+ }
+ }
+
+ public class DieArrayType : DieStructureType
+ {
+ public override void RegisterDependencyTypes ()
+ {
+ Die array_die = new DieInternalArray (DieCompileUnit, typeof (MonoArrayBounds));
+ new DieSubRangeType (array_die, typeof (int), 0, rank);
+
+ Die bounds_die = new DieInternalPointer (DieCompileUnit, array_die);
+ new DieMember (this, typeof (MonoArray), "Bounds",
+ (int) MRI_array.offset_bounds, bounds_die);
+
+ Die length_die = DieCompileUnit.RegisterType (typeof (int));
+ new DieMember (this, typeof (MonoArray), "MaxLength",
+ (int) MRI_array.offset_max_length, length_die);
+
+ Die vector_die = new DieInternalArray (DieCompileUnit, element_type);
+ new DieSubRangeType (vector_die, typeof (int), 0, -1);
+
+ new DieMember (this, typeof (MonoArray), "Vector",
+ (int) MRI_array.offset_vector, vector_die);
+ }
+
+ protected Type element_type;
+ protected int rank;
+
+ protected static string MakeArrayName (Type type, int rank)
+ {
+ string name = type.Name;
+
+ for (int i = 0; i < rank; i++)
+ name += "[]";
+
+ return name;
+ }
+
+ public DieArrayType (DieCompileUnit parent_die, Type type, int rank)
+ : base (parent_die, typeof (MonoArray), MakeArrayName (type, rank))
+ {
+ this.element_type = type;
+ this.rank = rank;
+ }
+ }
+
+ public class DieStringType : DieStructureType
+ {
+ public override void RegisterDependencyTypes ()
+ {
+ Die length_die = DieCompileUnit.RegisterType (typeof (int));
+ new DieMember (this, typeof (MonoString), "Length",
+ (int) MRI_string.offset_length, length_die);
+
+ if (dw.use_gnu_extensions) {
+ Die string_die = new DieInternalString (DieCompileUnit);
+
+ new DieMember (this, typeof (MonoString), "String",
+ (int) MRI_string.offset_vector, string_die);
+ } else {
+ Die vector_die = new DieArrayType (DieCompileUnit, typeof (char), 1);
+ new DieSubRangeType (vector_die, typeof (int), 0, -1);
+
+ Die ptr_die = new DieInternalPointer (DieCompileUnit, vector_die);
+
+ new DieMember (this, typeof (MonoString), "Vector",
+ (int) MRI_string.offset_vector, ptr_die);
+ }
+ }
+
+ public DieStringType (DieCompileUnit parent_die, Type type)
+ : base (parent_die, typeof (MonoString))
+ { }
+ }
+
+ public class DieInternalString : Die
+ {
+ private static int my_abbrev_id;
+
+ static DieInternalString ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_string_length, DW_FORM.FORM_data4),
+ new AbbrevEntry (DW_AT.AT_byte_size, DW_FORM.FORM_data4),
+ new AbbrevEntry (DW_AT.AT_data_location, DW_FORM.FORM_data4)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_string_type, false, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ public DieInternalString (Die parent_die)
+ : base (parent_die, my_abbrev_id)
+ { }
+
+ public override void DoEmit ()
+ {
+ dw.AddRelocEntry_TypeFieldOffset (typeof (MonoArray),
+ (int) MRI_array.offset_max_length);
+ aw.WriteInt32 (0);
+ dw.AddRelocEntry_TypeFieldSize (typeof (MonoArray),
+ (int) MRI_array.offset_max_length);
+ aw.WriteInt32 (0);
+ dw.AddRelocEntry_TypeFieldOffset (typeof (MonoArray),
+ (int) MRI_array.offset_vector);
+ aw.WriteInt32 (0);
+ }
+ }
+
+ protected class DieInternalArray : Die
+ {
+ private static int my_abbrev_id;
+
+ static DieInternalArray ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4),
+ new AbbrevEntry (DW_AT.AT_byte_size, DW_FORM.FORM_data1)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_array_type, true, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ public DieInternalArray (Die parent_die, Type type)
+ : base (parent_die, my_abbrev_id)
+ {
+ this.type = type;
+
+ this.type_die = DieCompileUnit.RegisterType (type);
+ }
+
+ protected Type type;
+ protected Die type_die;
+
+ public override void DoEmit ()
+ {
+ aw.WriteString (type.Name);
+ DieCompileUnit.WriteRelativeDieReference (type_die);
+ aw.WriteUInt8 (4);
+ }
+ }
+
+ public class DieSubRangeType : Die
+ {
+ private static int my_abbrev_id;
+
+ static DieSubRangeType ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4),
+ new AbbrevEntry (DW_AT.AT_lower_bound, DW_FORM.FORM_data4),
+ new AbbrevEntry (DW_AT.AT_upper_bound, DW_FORM.FORM_data4)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_subrange_type, false, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ protected int lower;
+ protected int upper;
+ protected Die type_die;
+
+ public DieSubRangeType (Die parent_die, Type type, int lower, int upper)
+ : base (parent_die, my_abbrev_id)
+ {
+ this.lower = lower;
+ this.upper = upper;
+
+ type_die = DieCompileUnit.RegisterType (type);
+ }
+
+ public override void DoEmit ()
+ {
+ DieCompileUnit.WriteRelativeDieReference (type_die);
+ aw.WriteInt32 (lower);
+ aw.WriteInt32 (upper);
+ }
+ }
+
+ // DW_TAG_class_type
+ public class DieClassType : DieStructureType
+ {
+ private static int my_abbrev_id;
+
+ static DieClassType ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_byte_size, DW_FORM.FORM_data1)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_class_type, true, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ public DieClassType (DieCompileUnit parent_die, Type type)
+ : base (parent_die, type, my_abbrev_id)
+ { }
+
+ public override void RegisterDependencyTypes ()
+ {
+ if ((type.BaseType != null) && !type.BaseType.Equals (typeof (object)) &&
+ !type.BaseType.Equals (typeof (System.Array))) {
+ Die parent_die = DieCompileUnit.RegisterType (type.BaseType);
+
+ new DieInheritance (this, parent_die);
+ }
+ }
+
+ public override void DoEmit ()
+ {
+ aw.WriteString (type.Name);
+ dw.AddRelocEntry_TypeSize (type);
+ aw.WriteUInt8 (0);
+ }
+ }
+
+ // DW_TAG_inheritance
+ public class DieInheritance : Die
+ {
+ private static int my_abbrev_id;
+
+ static DieInheritance ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4),
+ new AbbrevEntry (DW_AT.AT_data_member_location, DW_FORM.FORM_block4)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_inheritance, false, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ Die type_die;
+
+ public DieInheritance (Die parent_die, Die type_die)
+ : base (parent_die, my_abbrev_id)
+ {
+ this.type_die = type_die;
+ }
+
+ public override void DoEmit ()
+ {
+ DieCompileUnit.WriteRelativeDieReference (type_die);
+
+ object end_index = aw.StartSubsectionWithSize ();
+ aw.WriteUInt8 ((int) DW_OP.OP_const1u);
+ aw.WriteUInt8 (0);
+ aw.EndSubsection (end_index);
+ }
+ }
+
+ // DW_TAG_member
+ public class DieMember : Die
+ {
+ private static int my_abbrev_id;
+
+ static DieMember ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4),
+ new AbbrevEntry (DW_AT.AT_accessibility, DW_FORM.FORM_data1),
+ new AbbrevEntry (DW_AT.AT_data_member_location, DW_FORM.FORM_block4)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_member, false, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ protected Type parent_type;
+ protected string name;
+ protected int index;
+ protected Die type_die;
+ protected DW_ACCESS access;
+
+ public DieMember (Die parent_die, Type parent_type, string name, int index,
+ Die type_die, DW_ACCESS access)
+ : base (parent_die, my_abbrev_id)
+ {
+ this.name = name;
+ this.index = index;
+ this.parent_type = parent_type;
+ this.type_die = type_die;
+ this.access = access;
+ }
+
+ public DieMember (Die parent_die, Type parent_type, string name, int index,
+ Die type_die)
+ : this (parent_die, parent_type, name, index, type_die,
+ DW_ACCESS.ACCESS_public)
+ { }
+
+ public override void DoEmit ()
+ {
+ aw.WriteString (name);
+ DieCompileUnit.WriteRelativeDieReference (type_die);
+ aw.WriteUInt8 ((int) access);
+
+ object end_index = aw.StartSubsectionWithSize ();
+ aw.WriteUInt8 ((int) DW_OP.OP_const4u);
+ dw.AddRelocEntry_TypeFieldOffset (parent_type, index);
+ aw.WriteInt32 (0);
+ aw.EndSubsection (end_index);
+ }
+ }
+
+ // DW_TAG_lexical_block
+ public class DieLexicalBlock : Die
+ {
+ private static int my_abbrev_id;
+
+ static DieLexicalBlock ()
+ {
+ AbbrevEntry[] entries = {
+ new AbbrevEntry (DW_AT.AT_low_pc, DW_FORM.FORM_addr),
+ new AbbrevEntry (DW_AT.AT_high_pc, DW_FORM.FORM_addr)
+ };
+
+ AbbrevDeclaration decl = new AbbrevDeclaration (
+ DW_TAG.TAG_lexical_block, true, entries);
+
+ my_abbrev_id = RegisterAbbrevDeclaration (decl);
+ }
+
+ protected ISourceBlock block;
+
+ public DieLexicalBlock (Die parent_die, ISourceBlock block)
+ : base (parent_die, my_abbrev_id)
+ {
+ this.block = block;
+ }
+
+ public override void DoEmit ()
+ {
+ int token = block.SourceMethod.Token;
+ int start_offset = block.Start.Offset;
+ int end_offset = block.End.Offset;
+
+ dw.AddRelocEntry (RelocEntryType.IL_OFFSET, token, start_offset);
+ aw.WriteAddress (0);
+ dw.AddRelocEntry (RelocEntryType.IL_OFFSET, token, end_offset);
+ aw.WriteAddress (0);
+ }
+ }
+
+ public abstract class DieVariable : Die
+ {
+ private static int my_abbrev_id_this;
+ private static int my_abbrev_id_local;
+ private static int my_abbrev_id_param;
+
+ public enum VariableType {
+ VARIABLE_THIS,
+ VARIABLE_PARAMETER,
+ VARIABLE_LOCAL
+ };
+
+ static int get_abbrev_id (VariableType vtype)
+ {
+ switch (vtype) {
+ case VariableType.VARIABLE_THIS:
+ return my_abbrev_id_this;
+ case VariableType.VARIABLE_PARAMETER:
+ return my_abbrev_id_param;
+ case VariableType.VARIABLE_LOCAL:
+ return my_abbrev_id_local;
+ default:
+ throw new ArgumentException ();
+ }
+ }
+
+ static DieVariable ()
+ {
+ AbbrevEntry[] entries_1 = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4),
+ new AbbrevEntry (DW_AT.AT_external, DW_FORM.FORM_flag),
+ new AbbrevEntry (DW_AT.AT_location, DW_FORM.FORM_block4),
+ new AbbrevEntry (DW_AT.AT_start_scope, DW_FORM.FORM_addr),
+ new AbbrevEntry (DW_AT.AT_end_scope, DW_FORM.FORM_addr)
+ };
+ AbbrevEntry[] entries_2 = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4),
+ new AbbrevEntry (DW_AT.AT_external, DW_FORM.FORM_flag),
+ new AbbrevEntry (DW_AT.AT_location, DW_FORM.FORM_block4),
+ };
+ AbbrevEntry[] entries_3 = {
+ new AbbrevEntry (DW_AT.AT_name, DW_FORM.FORM_string),
+ new AbbrevEntry (DW_AT.AT_type, DW_FORM.FORM_ref4),
+ new AbbrevEntry (DW_AT.AT_artificial, DW_FORM.FORM_flag),
+ new AbbrevEntry (DW_AT.AT_location, DW_FORM.FORM_block4),
+ };
+
+ AbbrevDeclaration decl_local = new AbbrevDeclaration (
+ DW_TAG.TAG_variable, false, entries_1);
+ AbbrevDeclaration decl_param = new AbbrevDeclaration (
+ DW_TAG.TAG_formal_parameter, false, entries_2);
+ AbbrevDeclaration decl_this = new AbbrevDeclaration (
+ DW_TAG.TAG_formal_parameter, false, entries_3);
+
+
+ my_abbrev_id_local = RegisterAbbrevDeclaration (decl_local);
+ my_abbrev_id_param = RegisterAbbrevDeclaration (decl_param);
+ my_abbrev_id_this = RegisterAbbrevDeclaration (decl_this);
+ }
+
+ protected string name;
+ protected Die type_die;
+ protected VariableType vtype;
+
+ public DieVariable (Die parent_die, string name, Type type, VariableType vtype)
+ : base (parent_die, get_abbrev_id (vtype))
+ {
+ this.name = name;
+ if (type.IsValueType)
+ this.type_die = DieCompileUnit.RegisterType (type);
+ else
+ this.type_die = DieCompileUnit.RegisterPointerType (type);
+ this.vtype = vtype;
+ }
+
+ public override void DoEmit ()
+ {
+ aw.WriteString (name);
+ DieCompileUnit.WriteRelativeDieReference (type_die);
+ switch (vtype) {
+ case VariableType.VARIABLE_LOCAL:
+ aw.WriteUInt8 (false);
+ DoEmitLocation ();
+ DoEmitScope ();
+ break;
+ case VariableType.VARIABLE_PARAMETER:
+ aw.WriteUInt8 (false);
+ DoEmitLocation ();
+ break;
+ case VariableType.VARIABLE_THIS:
+ aw.WriteUInt8 (true);
+ DoEmitLocation ();
+ break;
+ }
+ }
+
+ protected abstract void DoEmitLocation ();
+ protected abstract void DoEmitScope ();
+ }
+
+ public class DieMethodVariable : DieVariable
+ {
+ public DieMethodVariable (Die parent_die, ILocalVariable local)
+ : base (parent_die, local.Name, local.Type, VariableType.VARIABLE_LOCAL)
+ {
+ this.var = local;
+ }
+
+ public DieMethodVariable (Die parent_die, IMethodParameter param)
+ : base (parent_die, param.Name, param.Type, VariableType.VARIABLE_PARAMETER)
+ {
+ this.var = param;
+ }
+
+ public DieMethodVariable (Die parent_die, ISourceMethod method)
+ : base (parent_die, "this", method.MethodInfo.ReflectedType,
+ VariableType.VARIABLE_THIS)
+ {
+ this.method = method;
+ }
+
+ protected IVariable var;
+ protected ISourceMethod method;
+
+ protected override void DoEmitLocation ()
+ {
+ object end_index = aw.StartSubsectionWithSize ();
+ // These relocation entries expect a location description
+ // of exactly 8 bytes.
+ switch (vtype) {
+ case VariableType.VARIABLE_LOCAL:
+ dw.AddRelocEntry (RelocEntryType.LOCAL_VARIABLE,
+ var.Token, var.Index);
+ break;
+ case VariableType.VARIABLE_PARAMETER:
+ dw.AddRelocEntry (RelocEntryType.METHOD_PARAMETER,
+ var.Token, var.Index);
+ break;
+ case VariableType.VARIABLE_THIS:
+ dw.AddRelocEntry (RelocEntryType.METHOD_PARAMETER,
+ method.Token, 0);
+ break;
+ }
+ // This looks a bit strange, but OP_fbreg takes a sleb128
+ // agument and we can't fields of variable size.
+ aw.WriteUInt8 ((int) DW_OP.OP_fbreg);
+ aw.WriteSLeb128 (0);
+ aw.WriteUInt8 ((int) DW_OP.OP_const4s);
+ aw.WriteInt32 (0);
+ aw.WriteUInt8 ((int) DW_OP.OP_plus);
+ aw.EndSubsection (end_index);
+ }
+
+ protected override void DoEmitScope ()
+ {
+ dw.AddRelocEntry (RelocEntryType.VARIABLE_START_SCOPE,
+ var.Token, var.Index);
+ aw.WriteAddress (0);
+ dw.AddRelocEntry (RelocEntryType.VARIABLE_END_SCOPE,
+ var.Token, var.Index);
+ aw.WriteAddress (0);
+ }
+ }
+
+ protected const int reloc_table_version = 9;
+
+ protected enum Section {
+ DEBUG_INFO = 0x01,
+ DEBUG_ABBREV = 0x02,
+ DEBUG_LINE = 0x03,
+ MONO_RELOC_TABLE = 0x04
+ }
+
+ public struct AbbrevEntry {
+ public AbbrevEntry (DW_AT attribute, DW_FORM form)
+ {
+ this._attribute = attribute;
+ this._form = form;
+ }
+
+ private DW_AT _attribute;
+ private DW_FORM _form;
+
+ public DW_AT Attribute {
+ get {
+ return _attribute;
+ }
+ }
+
+ public DW_FORM Form {
+ get {
+ return _form;
+ }
+ }
+ }
+
+ public struct AbbrevDeclaration {
+ public AbbrevDeclaration (DW_TAG tag, bool has_children, AbbrevEntry[] entries)
+ {
+ this._tag = tag;
+ this._has_children = has_children;
+ this._entries = entries;
+ }
+
+ private DW_TAG _tag;
+ private bool _has_children;
+ private AbbrevEntry[] _entries;
+
+ public DW_TAG Tag {
+ get {
+ return _tag;
+ }
+ }
+
+ public bool HasChildren {
+ get {
+ return _has_children;
+ }
+ }
+
+ public AbbrevEntry[] Entries {
+ get {
+ return _entries;
+ }
+ }
+ }
+
+
+ protected enum RelocEntryType {
+ NONE,
+ // Size of an address on the target machine
+ TARGET_ADDRESS_SIZE = 0x01,
+ // Map an IL offset to a machine address
+ IL_OFFSET = 0x02,
+ // Start address of machine code for this method
+ METHOD_START_ADDRESS = 0x03,
+ // End address of machine code for this method
+ METHOD_END_ADDRESS = 0x04,
+ // Stack offset of local variable
+ LOCAL_VARIABLE = 0x05,
+ // Stack offset of method parameter
+ METHOD_PARAMETER = 0x06,
+ // Sizeof (type)
+ TYPE_SIZEOF = 0x07,
+ TYPE_FIELD_OFFSET = 0x08,
+ MONO_STRING_SIZEOF = 0x09,
+ MONO_STRING_OFFSET = 0x0a,
+ MONO_ARRAY_SIZEOF = 0x0b,
+ MONO_ARRAY_OFFSET = 0x0c,
+ MONO_ARRAY_BOUNDS_SIZEOF = 0x0d,
+ MONO_ARRAY_BOUNDS_OFFSET = 0x0e,
+ VARIABLE_START_SCOPE = 0x0f,
+ VARIABLE_END_SCOPE = 0x10,
+ MONO_STRING_FIELDSIZE = 0x11,
+ MONO_ARRAY_FIELDSIZE = 0x12,
+ TYPE_FIELD_FIELDSIZE = 0x13
+ }
+
+ protected class RelocEntry {
+ public RelocEntry (RelocEntryType type, int token, int original,
+ Section section, int index)
+ {
+ _type = type;
+ _section = section;
+ _token = token;
+ _original = original;
+ _index = index;
+ }
+
+ public RelocEntryType RelocType {
+ get {
+ return _type;
+ }
+ }
+
+ public Section Section {
+ get {
+ return _section;
+ }
+ }
+
+ public int Index {
+ get {
+ return _index;
+ }
+ }
+
+ public int Token {
+ get {
+ return _token;
+ }
+ }
+
+ public int Original {
+ get {
+ return _original;
+ }
+ }
+
+ private RelocEntryType _type;
+ private Section _section;
+ private int _token;
+ private int _index;
+ private int _original;
+ }
+
+ private Section current_section;
+ private ArrayList reloc_entries = new ArrayList ();
+
+ private static ArrayList abbrev_declarations = new ArrayList ();
+
+ protected string GetSectionName (Section section)
+ {
+ switch (section) {
+ case Section.DEBUG_INFO:
+ return "debug_info";
+ case Section.DEBUG_ABBREV:
+ return "debug_abbrev";
+ case Section.DEBUG_LINE:
+ return "debug_line";
+ case Section.MONO_RELOC_TABLE:
+ return "mono_reloc_table";
+ default:
+ throw new ArgumentException ();
+ }
+ }
+
+ protected void AddRelocEntry (RelocEntry entry)
+ {
+ reloc_entries.Add (entry);
+ }
+
+ protected void AddRelocEntry (RelocEntryType type, int token, int original,
+ Section section, int index)
+ {
+ AddRelocEntry (new RelocEntry (type, token, original, section, index));
+ }
+
+ protected void AddRelocEntry (RelocEntryType type, int token, int original)
+ {
+ AddRelocEntry (type, token, original, current_section, aw.WriteLabel ());
+ }
+
+ protected void AddRelocEntry (RelocEntryType type, int token)
+ {
+ AddRelocEntry (type, token, 0);
+ }
+
+ protected void AddRelocEntry (RelocEntryType type)
+ {
+ AddRelocEntry (type, 0);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static int get_type_token (Type type);
+
+ protected void AddRelocEntry (RelocEntryType entry_type, Type type)
+ {
+ AddRelocEntry (entry_type, type, 0);
+ }
+
+ protected void AddRelocEntry (RelocEntryType entry_type, Type type, int original)
+ {
+ AddRelocEntry (entry_type, get_type_token (type), original);
+ }
+
+ protected void AddRelocEntry_TypeSize (Type type)
+ {
+ if (type.Equals (typeof (MonoString)))
+ AddRelocEntry (RelocEntryType.MONO_STRING_SIZEOF);
+ else if (type.Equals (typeof (MonoArray)))
+ AddRelocEntry (RelocEntryType.MONO_ARRAY_SIZEOF);
+ else if (type.Equals (typeof (MonoArrayBounds)))
+ AddRelocEntry (RelocEntryType.MONO_ARRAY_BOUNDS_SIZEOF);
+ else
+ AddRelocEntry (RelocEntryType.TYPE_SIZEOF, type);
+ }
+
+ protected void AddRelocEntry_TypeFieldOffset (Type type, int index)
+ {
+ if (type.Equals (typeof (MonoString)))
+ AddRelocEntry (RelocEntryType.MONO_STRING_OFFSET, index);
+ else if (type.Equals (typeof (MonoArray)))
+ AddRelocEntry (RelocEntryType.MONO_ARRAY_OFFSET, index);
+ else if (type.Equals (typeof (MonoArrayBounds)))
+ AddRelocEntry (RelocEntryType.MONO_ARRAY_BOUNDS_OFFSET, index);
+ else
+ AddRelocEntry (RelocEntryType.TYPE_FIELD_OFFSET, type, index);
+ }
+
+ protected void AddRelocEntry_TypeFieldSize (Type type, int index)
+ {
+ if (type.Equals (typeof (MonoString)))
+ AddRelocEntry (RelocEntryType.MONO_STRING_FIELDSIZE, index);
+ else if (type.Equals (typeof (MonoArray)))
+ AddRelocEntry (RelocEntryType.MONO_ARRAY_FIELDSIZE, index);
+ else
+ AddRelocEntry (RelocEntryType.TYPE_FIELD_FIELDSIZE, type, index);
+ }
+
+ //
+ // Mono relocation table. See the README.relocation-table file in this
+ // directory for a detailed description of the file format.
+ //
+ protected void WriteRelocEntries ()
+ {
+ WriteSectionStart (Section.MONO_RELOC_TABLE);
+ aw.WriteUInt16 (reloc_table_version);
+ aw.WriteUInt8 (0);
+ object end_index = aw.StartSubsectionWithSize ();
+
+ int count = 0;
+
+ foreach (RelocEntry entry in reloc_entries) {
+ count++;
+
+ aw.WriteUInt8 ((int) entry.RelocType);
+ object tmp_index = aw.StartSubsectionWithSize ();
+
+ aw.WriteUInt8 ((int) entry.Section);
+ aw.WriteAbsoluteOffset (entry.Index);
+
+ switch (entry.RelocType) {
+ case RelocEntryType.METHOD_START_ADDRESS:
+ case RelocEntryType.METHOD_END_ADDRESS:
+ case RelocEntryType.TYPE_SIZEOF:
+ aw.WriteUInt32 (entry.Token);
+ break;
+ case RelocEntryType.IL_OFFSET:
+ case RelocEntryType.LOCAL_VARIABLE:
+ case RelocEntryType.METHOD_PARAMETER:
+ case RelocEntryType.TYPE_FIELD_OFFSET:
+ case RelocEntryType.VARIABLE_START_SCOPE:
+ case RelocEntryType.VARIABLE_END_SCOPE:
+ case RelocEntryType.TYPE_FIELD_FIELDSIZE:
+ aw.WriteUInt32 (entry.Token);
+ aw.WriteUInt32 (entry.Original);
+ break;
+ case RelocEntryType.MONO_STRING_SIZEOF:
+ case RelocEntryType.MONO_ARRAY_SIZEOF:
+ case RelocEntryType.MONO_ARRAY_BOUNDS_SIZEOF:
+ break;
+ case RelocEntryType.MONO_STRING_OFFSET:
+ case RelocEntryType.MONO_ARRAY_OFFSET:
+ case RelocEntryType.MONO_ARRAY_BOUNDS_OFFSET:
+ case RelocEntryType.MONO_STRING_FIELDSIZE:
+ case RelocEntryType.MONO_ARRAY_FIELDSIZE:
+ aw.WriteUInt32 (entry.Token);
+ break;
+ }
+
+ aw.EndSubsection (tmp_index);
+ }
+
+ aw.EndSubsection (end_index);
+ aw.WriteSectionEnd ();
+ }
+
+ //
+ // Registers a new abbreviation declaration.
+ //
+ // This function should be called by a static constructor in one of
+ // Die's subclasses.
+ //
+ protected static int RegisterAbbrevDeclaration (AbbrevDeclaration decl)
+ {
+ return abbrev_declarations.Add (decl) + 1;
+ }
+
+ protected static AbbrevDeclaration GetAbbrevDeclaration (int index)
+ {
+ return (AbbrevDeclaration) abbrev_declarations [index - 1];
+ }
+
+ protected void WriteAbbrevDeclarations ()
+ {
+ aw.WriteSectionStart (GetSectionName (Section.DEBUG_ABBREV));
+ aw.WriteLabel ("debug_abbrev_b");
+
+ for (int index = 0; index < abbrev_declarations.Count; index++) {
+ AbbrevDeclaration decl = (AbbrevDeclaration) abbrev_declarations [index];
+
+ aw.WriteULeb128 (index + 1);
+ aw.WriteULeb128 ((int) decl.Tag);
+ aw.WriteUInt8 (decl.HasChildren);
+
+ foreach (AbbrevEntry entry in decl.Entries) {
+ aw.WriteULeb128 ((int) entry.Attribute);
+ aw.WriteULeb128 ((int) entry.Form);
+ }
+
+ aw.WriteUInt8 (0);
+ aw.WriteUInt8 (0);
+ }
+
+ aw.WriteSectionEnd ();
+ }
+
+ protected void WriteSectionStart (Section section)
+ {
+ aw.WriteSectionStart (GetSectionName (section));
+ current_section = section;
+ }
+ }
+
+ internal struct MonoString
+ { }
+
+ internal struct MonoArrayBounds
+ { }
+
+ internal struct MonoArray
+ { }
+}
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolDocumentWriter.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolDocumentWriter.cs
new file mode 100644
index 00000000000..27c4ea48749
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolDocumentWriter.cs
@@ -0,0 +1,60 @@
+//
+// System.Diagnostics.SymbolStore/MonoSymbolDocumentWriter.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// This is the default implementation of the
+// System.Diagnostics.SymbolStore.ISymbolDocumentWriter interface.
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Diagnostics.SymbolStore;
+using System.IO;
+
+namespace Mono.CSharp.Debugger
+{
+
+ public class MonoSymbolDocumentWriter : ISymbolDocumentWriter
+ {
+ protected string url;
+
+ //
+ // Constructor
+ //
+ public MonoSymbolDocumentWriter (string url)
+ {
+ this.url = url;
+ }
+
+ public string FileName {
+ get {
+ return url;
+ }
+ }
+
+ //
+ // Interface ISymbolDocumentWriter
+ //
+
+ //
+ // MonoSymbolWriter creates a DWARF 2 debugging file and DWARF operates
+ // on file names, but has no way to include a whole source file in the
+ // symbol file.
+ //
+
+ public void SetCheckSum (Guid algorithmId, byte[] checkSum)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void SetSource (byte[] source)
+ {
+ throw new NotSupportedException ();
+ }
+ }
+}
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs
new file mode 100755
index 00000000000..29aeac13f2b
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolWriter.cs
@@ -0,0 +1,717 @@
+//
+// System.Diagnostics.SymbolStore/MonoSymbolWriter.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// This is the default implementation of the System.Diagnostics.SymbolStore.ISymbolWriter
+// interface.
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.CompilerServices;
+using System.Diagnostics.SymbolStore;
+using System.Collections;
+using System.IO;
+
+namespace Mono.CSharp.Debugger
+{
+
+ public class MonoSymbolWriter : IMonoSymbolWriter
+ {
+ protected Assembly assembly;
+ protected string output_filename = null;
+ protected ArrayList locals = null;
+ protected ArrayList orphant_methods = null;
+ protected Hashtable methods = null;
+ protected Hashtable sources = null;
+
+ protected class SourceFile : ISourceFile
+ {
+ private ArrayList _methods = new ArrayList ();
+ private string _file_name;
+
+ public SourceFile (string filename)
+ {
+ this._file_name = filename;
+ }
+
+ public override string ToString ()
+ {
+ return _file_name;
+ }
+
+ // interface ISourceFile
+
+ public string FileName {
+ get {
+ return _file_name;
+ }
+ }
+
+ public ISourceMethod[] Methods {
+ get {
+ ISourceMethod[] retval = new ISourceMethod [_methods.Count];
+ _methods.CopyTo (retval);
+ return retval;
+ }
+ }
+
+ public void AddMethod (ISourceMethod method)
+ {
+ _methods.Add (method);
+ }
+ }
+
+ protected class SourceBlock : ISourceBlock
+ {
+ static private int next_index;
+ private readonly int _index;
+
+ public SourceBlock (ISourceMethod method, ISourceLine start, ISourceLine end)
+ {
+ this._method = method;
+ this._start = start;
+ this._end = end;
+ this._index = ++next_index;
+ }
+
+ internal SourceBlock (ISourceMethod method, int startOffset)
+ {
+ this._method = method;
+ this._start = new SourceLine (startOffset);
+ this._index = ++next_index;
+ }
+
+ public override string ToString ()
+ {
+ return "SourceBlock #" + ID + " (" + Start + " - " + End + ")";
+ }
+
+ private readonly ISourceMethod _method;
+ private ArrayList _blocks = new ArrayList ();
+ internal ISourceLine _start;
+ internal ISourceLine _end;
+
+ private ArrayList _locals = new ArrayList ();
+
+ public ISourceMethod SourceMethod {
+ get {
+ return _method;
+ }
+ }
+
+ public ISourceBlock[] Blocks {
+ get {
+ ISourceBlock[] retval = new ISourceBlock [_blocks.Count];
+ _blocks.CopyTo (retval);
+ return retval;
+ }
+ }
+
+ public void AddBlock (ISourceBlock block)
+ {
+ _blocks.Add (block);
+ }
+
+ public ISourceLine Start {
+ get {
+ return _start;
+ }
+ }
+
+ public ISourceLine End {
+ get {
+ return _end;
+ }
+ }
+
+ public int ID {
+ get {
+ return _index;
+ }
+ }
+
+ public ILocalVariable[] Locals {
+ get {
+ ILocalVariable[] retval = new ILocalVariable [_locals.Count];
+ _locals.CopyTo (retval);
+ return retval;
+ }
+ }
+
+ public void AddLocal (ILocalVariable local)
+ {
+ _locals.Add (local);
+ }
+ }
+
+ protected class SourceLine : ISourceLine
+ {
+ public SourceLine (int row, int column)
+ : this (0, row, column)
+ {
+ this._type = SourceOffsetType.OFFSET_NONE;
+ }
+
+ public SourceLine (int offset, int row, int column)
+ {
+ this._offset = offset;
+ this._row = row;
+ this._column = column;
+ this._type = SourceOffsetType.OFFSET_IL;
+ }
+
+ internal SourceLine (int offset)
+ : this (offset, 0, 0)
+ { }
+
+ public override string ToString ()
+ {
+ return "SourceLine (" + _offset + "@" + _row + ":" + _column + ")";
+ }
+
+ internal SourceOffsetType _type;
+ internal int _offset;
+ internal int _row;
+ internal int _column;
+
+ // interface ISourceLine
+
+ public SourceOffsetType OffsetType {
+ get {
+ return _type;
+ }
+ }
+
+ public int Offset {
+ get {
+ return _offset;
+ }
+ }
+
+ public int Row {
+ get {
+ return _row;
+ }
+ }
+
+ public int Column {
+ get {
+ return _column;
+ }
+ }
+ }
+
+ protected class LocalVariable : ILocalVariable
+ {
+ public LocalVariable (string name, byte[] signature, int token, int index)
+ : this (name, signature, token, index, null)
+ { }
+
+ public LocalVariable (string name, byte[] signature, int token, int index,
+ ISourceLine line)
+ {
+ this._name = name;
+ this._signature = signature;
+ this._token = token;
+ this._index = index;
+ this._line = line;
+ }
+
+ private readonly string _name;
+ internal Type _type;
+ private readonly byte[] _signature;
+ private readonly int _token;
+ private readonly int _index;
+ private readonly ISourceLine _line;
+
+ public override string ToString ()
+ {
+ return "LocalVariable (" + _index + "," + _name + ")";
+ }
+
+ // interface ILocalVariable
+
+ public string Name {
+ get {
+ return _name;
+ }
+ }
+
+ public int Token {
+ get {
+ return _token;
+ }
+ }
+
+ public int Index {
+ get {
+ return _index;
+ }
+ }
+
+ public Type Type {
+ get {
+ return _type;
+ }
+ }
+
+ public byte[] Signature {
+ get {
+ return _signature;
+ }
+ }
+
+ public ISourceLine Line {
+ get {
+ return _line;
+ }
+ }
+ }
+
+ protected class SourceMethod : ISourceMethod
+ {
+ private ArrayList _lines = new ArrayList ();
+ private ArrayList _blocks = new ArrayList ();
+ private Hashtable _block_hash = new Hashtable ();
+ private Stack _block_stack = new Stack ();
+
+ internal MethodInfo _method_info;
+ internal ISourceFile _source_file;
+ private readonly int _token;
+
+ private SourceBlock _implicit_block;
+
+ public SourceMethod (int token, MethodInfo method_info, ISourceFile source_file)
+ : this (token)
+ {
+ this._method_info = method_info;
+ this._source_file = source_file;
+ }
+
+ internal SourceMethod (int token)
+ {
+ this._token = token;
+
+ this._implicit_block = new SourceBlock (this, 0);
+ }
+
+ public void SetSourceRange (ISourceFile sourceFile,
+ int startLine, int startColumn,
+ int endLine, int endColumn)
+ {
+ _source_file = sourceFile;
+ _implicit_block._start = new SourceLine (startLine, startColumn);
+ _implicit_block._end = new SourceLine (endLine, endColumn);
+ }
+
+
+ public void StartBlock (ISourceBlock block)
+ {
+ _block_stack.Push (block);
+ }
+
+ public void EndBlock (int endOffset) {
+ SourceBlock block = (SourceBlock) _block_stack.Pop ();
+
+ block._end = new SourceLine (endOffset);
+
+ if (_block_stack.Count > 0) {
+ ISourceBlock parent = (ISourceBlock) _block_stack.Peek ();
+
+ parent.AddBlock (block);
+ } else
+ _blocks.Add (block);
+
+ _block_hash.Add (block.ID, block);
+ }
+
+ public void SetBlockRange (int BlockID, int startOffset, int endOffset)
+ {
+ SourceBlock block = (SourceBlock) _block_hash [BlockID];
+ ((SourceLine) block.Start)._offset = startOffset;
+ ((SourceLine) block.End)._offset = endOffset;
+ }
+
+ public ISourceBlock CurrentBlock {
+ get {
+ if (_block_stack.Count > 0)
+ return (ISourceBlock) _block_stack.Peek ();
+ else
+ return _implicit_block;
+ }
+ }
+
+ // interface ISourceMethod
+
+ public ISourceLine[] Lines {
+ get {
+ ISourceLine[] retval = new ISourceLine [_lines.Count];
+ _lines.CopyTo (retval);
+ return retval;
+ }
+ }
+
+ public void AddLine (ISourceLine line)
+ {
+ _lines.Add (line);
+ }
+
+ public ISourceBlock[] Blocks {
+ get {
+ ISourceBlock[] retval = new ISourceBlock [_blocks.Count];
+ _blocks.CopyTo (retval);
+ return retval;
+ }
+ }
+
+ public ILocalVariable[] Locals {
+ get {
+ return _implicit_block.Locals;
+ }
+ }
+
+ public void AddLocal (ILocalVariable local)
+ {
+ _implicit_block.AddLocal (local);
+ }
+
+ public MethodInfo MethodInfo {
+ get {
+ return _method_info;
+ }
+ }
+
+ public ISourceFile SourceFile {
+ get {
+ return _source_file;
+ }
+ }
+
+ public int Token {
+ get {
+ return _token;
+ }
+ }
+
+ public ISourceLine Start {
+ get {
+ return _implicit_block.Start;
+ }
+ }
+
+ public ISourceLine End {
+ get {
+ return _implicit_block.End;
+ }
+ }
+ }
+
+ protected SourceMethod current_method = null;
+ private readonly string assembly_filename = null;
+
+ //
+ // Interface IMonoSymbolWriter
+ //
+
+ public MonoSymbolWriter (string filename)
+ {
+ this.assembly_filename = filename;
+
+ this.methods = new Hashtable ();
+ this.sources = new Hashtable ();
+ this.orphant_methods = new ArrayList ();
+ this.locals = new ArrayList ();
+ }
+
+ public void Close () {
+ if (assembly == null)
+ assembly = AppDomain.CurrentDomain.Load (assembly_filename);
+
+ DoFixups (assembly);
+
+ CreateDwarfFile (output_filename);
+ }
+
+ public void CloseNamespace () {
+ }
+
+ // Create and return a new IMonoSymbolDocumentWriter.
+ public ISymbolDocumentWriter DefineDocument (string url,
+ Guid language,
+ Guid languageVendor,
+ Guid documentType)
+ {
+ return new MonoSymbolDocumentWriter (url);
+ }
+
+ public void DefineField (
+ SymbolToken parent,
+ string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3)
+ {
+ }
+
+ public void DefineGlobalVariable (
+ string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3)
+ {
+ }
+
+ public void DefineLocalVariable (string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3,
+ int startOffset,
+ int endOffset)
+ {
+ if (current_method == null)
+ return;
+
+ int token = current_method.Token;
+
+ LocalVariable local_info = new LocalVariable (name, signature, token, addr1);
+
+ current_method.CurrentBlock.AddLocal (local_info);
+ locals.Add (local_info);
+ }
+
+ public void DefineParameter (string name,
+ ParameterAttributes attributes,
+ int sequence,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void DefineSequencePoints (ISymbolDocumentWriter document,
+ int[] offsets,
+ int[] lines,
+ int[] columns,
+ int[] endLines,
+ int[] endColumns)
+ {
+ SourceLine source_line = new SourceLine (offsets [0], lines [0], columns [0]);
+
+ if (current_method != null)
+ current_method.AddLine (source_line);
+ }
+
+ public void Initialize (IntPtr emitter, string filename, bool fFullBuild)
+ {
+ this.output_filename = filename;
+ }
+
+ public void OpenMethod (SymbolToken symbol_token)
+ {
+ int token = symbol_token.GetToken ();
+
+ if (methods.ContainsKey (token))
+ methods.Remove (token);
+
+ current_method = new SourceMethod (token);
+
+ methods.Add (token, current_method);
+ }
+
+ public void SetMethodSourceRange (ISymbolDocumentWriter startDoc,
+ int startLine, int startColumn,
+ ISymbolDocumentWriter endDoc,
+ int endLine, int endColumn)
+ {
+ if (current_method == null)
+ return;
+
+ if ((startDoc == null) || (endDoc == null))
+ throw new NullReferenceException ();
+
+ if (!(startDoc is MonoSymbolDocumentWriter) || !(endDoc is MonoSymbolDocumentWriter))
+ throw new NotSupportedException ("both startDoc and endDoc must be of type "
+ + "MonoSymbolDocumentWriter");
+
+ if (!startDoc.Equals (endDoc))
+ throw new NotSupportedException ("startDoc and endDoc must be the same");
+
+ string source_file = ((MonoSymbolDocumentWriter) startDoc).FileName;
+ SourceFile source_info;
+
+ if (sources.ContainsKey (source_file))
+ source_info = (SourceFile) sources [source_file];
+ else {
+ source_info = new SourceFile (source_file);
+ sources.Add (source_file, source_info);
+ }
+
+ current_method.SetSourceRange (source_info, startLine, startColumn,
+ endLine, endColumn);
+
+ source_info.AddMethod (current_method);
+ }
+
+ public void CloseMethod () {
+ current_method = null;
+ }
+
+ public void OpenNamespace (string name)
+ {
+ }
+
+ public int OpenScope (int startOffset)
+ {
+ if (current_method == null)
+ return 0;
+
+ ISourceBlock block = new SourceBlock (current_method, startOffset);
+ current_method.StartBlock (block);
+
+ return block.ID;
+ }
+
+ public void CloseScope (int endOffset) {
+ if (current_method == null)
+ return;
+
+ current_method.EndBlock (endOffset);
+ }
+
+ public void SetScopeRange (int scopeID, int startOffset, int endOffset)
+ {
+ if (current_method == null)
+ return;
+
+ current_method.SetBlockRange (scopeID, startOffset, endOffset);
+ }
+
+ public void SetSymAttribute (SymbolToken parent, string name, byte[] data)
+ {
+ }
+
+ public void SetUnderlyingWriter (IntPtr underlyingWriter)
+ {
+ throw new NotSupportedException ();
+ }
+
+ public void SetUserEntryPoint (SymbolToken entryMethod)
+ {
+ }
+
+ public void UsingNamespace (string fullName)
+ {
+ }
+
+ //
+ // MonoSymbolWriter implementation
+ //
+ protected void WriteLocal (DwarfFileWriter.Die parent_die, ILocalVariable local)
+ {
+ DwarfFileWriter.DieMethodVariable die;
+
+ die = new DwarfFileWriter.DieMethodVariable (parent_die, local);
+ }
+
+ protected void WriteBlock (DwarfFileWriter.Die parent_die, ISourceBlock block)
+ {
+ DwarfFileWriter.DieLexicalBlock die;
+
+ die = new DwarfFileWriter.DieLexicalBlock (parent_die, block);
+
+ foreach (ILocalVariable local in block.Locals)
+ WriteLocal (die, local);
+
+ foreach (ISourceBlock subblock in block.Blocks)
+ WriteBlock (die, subblock);
+ }
+
+ protected void WriteMethod (DwarfFileWriter.DieCompileUnit parent_die, ISourceMethod method)
+ {
+ DwarfFileWriter.DieSubProgram die;
+
+ die = new DwarfFileWriter.DieSubProgram (parent_die, method);
+
+ foreach (ILocalVariable local in method.Locals)
+ WriteLocal (die, local);
+
+ foreach (ISourceBlock block in method.Blocks)
+ WriteBlock (die, block);
+ }
+
+ protected void WriteSource (DwarfFileWriter writer, ISourceFile source)
+ {
+ DwarfFileWriter.CompileUnit compile_unit = new DwarfFileWriter.CompileUnit (
+ writer, source.FileName);
+
+ DwarfFileWriter.DieCompileUnit die = new DwarfFileWriter.DieCompileUnit (compile_unit);
+
+ foreach (ISourceMethod method in source.Methods)
+ WriteMethod (die, method);
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static Type get_local_type_from_sig (Assembly module, byte[] sig);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static MethodInfo get_method (Assembly module, int token);
+
+ protected void DoFixups (Assembly assembly)
+ {
+ foreach (SourceMethod method in methods.Values) {
+ method._method_info = get_method (assembly, method.Token);
+
+ if (method.SourceFile == null)
+ orphant_methods.Add (method);
+ }
+
+ foreach (LocalVariable local in locals) {
+ byte[] signature = local.Signature;
+
+ Type type = get_local_type_from_sig (assembly, signature);
+
+ ((LocalVariable) local)._type = type;
+ }
+ }
+
+ protected void CreateDwarfFile (string filename)
+ {
+ DwarfFileWriter writer = new DwarfFileWriter (filename);
+
+ foreach (ISourceFile source in sources.Values)
+ WriteSource (writer, source);
+
+ if (orphant_methods.Count > 0) {
+ SourceFile source = new SourceFile ("<unknown>");
+
+ foreach (SourceMethod orphant in orphant_methods) {
+ orphant._source_file = source;
+ source.AddMethod (orphant);
+ }
+
+ WriteSource (writer, source);
+ }
+
+ writer.Close ();
+ }
+ }
+}
+
diff --git a/mcs/class/Mono.CSharp.Debugger/README b/mcs/class/Mono.CSharp.Debugger/README
new file mode 100644
index 00000000000..4fb2043099f
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/README
@@ -0,0 +1,43 @@
+This is an implementation of the System.Diagnostics.SymbolStore.ISymbolWriter
+interface which writes a dwarf debugging information file.
+
+Unfortunately there are several major problems with this interface and I'm
+unsure how to solve them:
+
+1.) The interface contains a constructor method `Initialize' which has an
+ 'IntPtr' emitter argument which seems to be a pointer to the actual
+ symbol writer which resides in a proprietary, undocumented DLL (I spent
+ almost 3 hours browsing the ".NET Framework SDK Documentation" and
+ msdn.microsoft.com - without success.
+
+ A short test showed me that mscorlib doesn't like passing zero, this
+ won't give you the system's default implementation.
+
+ To solve this problem, I created a derived interface IMonoSymbolWriter
+ which contains an additional constructor which only takes the name of
+ the symbol file as argument.
+
+ void Initialize (string filename);
+
+2.) You seem to get an instance of a class implementing this interface by
+ creating a new instance of System.Reflection.Emit.ModuleBuilder (with the
+ `bool createSymbolFile' argument) and then calling GetSymWriter() on
+ the returned object.
+
+ So far so good, but how does this method find out which symbol writer
+ to use ?
+
+3.) According to the documentation, some of the methods of
+ System.Reflection.Emit.ILGenerator and System.Reflection.Emit.LocalBuilder
+ seem to use the symbol writer to emit symbol debugging information.
+
+ But again, how do these objects get the symbol writer ?
+
+Currently, there are two ways to use this assembly:
+
+a.) Fix the problems outlined above and dynamically load this assembly
+ (Mono.CSharp.Debugger.dll) when a new symbol writer is created.
+
+b.) Reference this assembly in your application and manually create the
+ symbol writer using the constructor.
+
diff --git a/mcs/class/Mono.CSharp.Debugger/README.relocation-table b/mcs/class/Mono.CSharp.Debugger/README.relocation-table
new file mode 100644
index 00000000000..f9a875784fa
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/README.relocation-table
@@ -0,0 +1,100 @@
+This is an implementation of the System.Diagnostics.SymbolStore.ISymbolWriter
+interface which writes a symbol file in the dwarf format.
+
+The output is an assembler input file containing dwarf data with an
+additional ELF section called ".mono_reloc_table". This section is
+read by the JIT engine to map IL offsets and such to machine
+addresses.
+
+The mono relocation table contains of
+
+1. A 2-byte unsigned integer containing a version number, currently 2.
+
+2. A 1-byte unsigned integer containing a flag specifying whether the
+ object file containing this section has already been relocated.
+
+ The symbol writer sets this flag to zero, you must change it to 1
+ if you write the relocated file back to disk.
+
+3. A 4-byte unsigned integer containing the total size of the
+ relocation table, but not including the size field itself.
+
+4. One or more relocation entries.
+
+Each entry in the relocation table has the following form:
+
+1. A 1-byte unsigned integer specifying the type of this entry.
+
+2. A 4-byte unsigned integer containing the size of this entry, but
+ not including the size field itself.
+
+3. A 1-byte unsigned integer specifying the ELF section of this entry.
+
+4. A 4-byte unsigned offset from the beginning of the ELF section to
+ the location which needs to be relocated. This is called the target.
+
+5. Optional additional data depending on the type of the entry.
+
+The following entry types are currently defined:
+
+a) TARGET_ADDRESS_SIZE - 0x01
+
+ The target is a 1-byte unsigned integer containing the size in
+ bytes of an address on the target machine.
+
+b) IL_OFFSET - 0x02
+
+ The target is an integer of appropriate size to hold an address on
+ the target machine (the assembler ensures that the object has the
+ correct size) and contains an IL offset from the beginning of the
+ current method which needs to be replaced with the corresponding
+ machine address.
+
+ This entry has a 4-byte unsigned integer argument containing the
+ metadata token of the current method and a 4-byte unsigned integer
+ argument containing the IL offset.
+
+c) METHOD_START_ADDRESS - 0x03
+d) METHOD_END_ADDRESS - 0x04
+
+ The target is an integer of appropriate size to hold an address on
+ the target machine (the assembler ensures that the object has the
+ correct size).
+
+ This entry has a 4-byte unsigned integer argument containing the
+ metadata token of the current method.
+
+To use the generated object file, the JIT must:
+
+* Check whether the file contains a ".mono_reloc_table" section.
+ If not, the file cannot be used (you need to change the address size
+ field in each compilation unit header).
+
+* Check whether the flag field of the relocation table (the 3rd byte
+ of the relocation table) is zero. If it is 1, the file has already
+ been relocated. In this case, it's best to reject the file.
+
+* Set the flag field to 1.
+
+* Process all relocation entries.
+
+* Write the modified file back to disk.
+
+To do the relocation, the JIT can assume that:
+
+1.) All the relevant ELF sections are physically contiguous
+ (a requirement from the DWARF 2 specification).
+
+2.) All relocation targets holding addresses are suitable of holding
+ an address on the target machine.
+
+ This means that you can do something like
+
+ * (void **) ptr = map_to_machine (* (void **) ptr)
+
+3.) There are no other changes needed in the object file - so you can
+ just write it back to disk once you're done with the relocation.
+
+
+Last changed March 19th, 2002
+Martin Baulig <martin@gnome.org>
diff --git a/mcs/class/Mono.CSharp.Debugger/gdb-variable-scopes.patch b/mcs/class/Mono.CSharp.Debugger/gdb-variable-scopes.patch
new file mode 100644
index 00000000000..fc9612b0148
--- /dev/null
+++ b/mcs/class/Mono.CSharp.Debugger/gdb-variable-scopes.patch
@@ -0,0 +1,175 @@
+Index: include/elf/ChangeLog
+===================================================================
+RCS file: /cvs/src/src/include/elf/ChangeLog,v
+retrieving revision 1.121
+diff -u -u -p -r1.121 ChangeLog
+--- include/elf/ChangeLog 13 Feb 2002 18:14:48 -0000 1.121
++++ include/elf/ChangeLog 12 Apr 2002 19:50:31 -0000
+@@ -1,3 +1,7 @@
++2002-04-12 Martin Baulig <martin@gnome.org>
++
++ * dwarf2.h (DW_AT_end_scope): Added as GNU extension.
++
+ 2002-02-13 Matt Fredette <fredette@netbsd.org>
+
+ * m68k.h (EF_M68000): Define.
+Index: include/elf/dwarf2.h
+===================================================================
+RCS file: /cvs/src/src/include/elf/dwarf2.h,v
+retrieving revision 1.8
+diff -u -u -p -r1.8 dwarf2.h
+--- include/elf/dwarf2.h 28 Jan 2002 23:26:53 -0000 1.8
++++ include/elf/dwarf2.h 12 Apr 2002 19:50:32 -0000
+@@ -328,6 +328,8 @@ enum dwarf_attribute
+ DW_AT_src_coords = 0x2104,
+ DW_AT_body_begin = 0x2105,
+ DW_AT_body_end = 0x2106,
++ DW_AT_end_scope = 0x2121,
++
+ /* VMS Extensions. */
+ DW_AT_VMS_rtnbeg_pd_address = 0x2201
+ };
+Index: gdb/ChangeLog
+===================================================================
+RCS file: /cvs/src/src/gdb/ChangeLog,v
+retrieving revision 1.2421
+diff -u -u -p -r1.2421 ChangeLog
+--- gdb/ChangeLog 12 Apr 2002 07:37:17 -0000 1.2421
++++ gdb/ChangeLog 12 Apr 2002 19:50:38 -0000
+@@ -1,3 +1,14 @@
++2002-04-12 Martin Baulig <martin@gnome.org>
++
++ * dwarf2read.c (new_symbol): If DW_AT_start_scope and DW_AT_end_scope
++ are specified, set SYMBOL_RANGES().
++
++ * findvar.c (read_var_value): Check whether the current PC is within
++ the SYMBOL_RANGES(), return NULL if not.
++
++ * stack.c (print_block_frame_locals): Only print vars if the current PC
++ is in their SYMBOL_RANGES().
++
+ 2002-04-12 Kevin Buettner <kevinb@redhat.com>
+
+ From Jimi X <jimix@watson.ibm.com>:
+Index: gdb/dwarf2read.c
+===================================================================
+RCS file: /cvs/src/src/gdb/dwarf2read.c,v
+retrieving revision 1.52
+diff -u -u -p -r1.52 dwarf2read.c
+--- gdb/dwarf2read.c 4 Apr 2002 22:26:43 -0000 1.52
++++ gdb/dwarf2read.c 12 Apr 2002 19:50:44 -0000
+@@ -4394,6 +4394,19 @@ new_symbol (struct die_info *die, struct
+ add_symbol_to_list (sym, list_in_scope);
+ break;
+ }
++ attr = dwarf_attr (die, DW_AT_start_scope);
++ attr2 = dwarf_attr (die, DW_AT_end_scope);
++ if (attr && attr2)
++ {
++ struct range_list *r = (struct range_list *)
++ obstack_alloc (&objfile->type_obstack,
++ sizeof (struct range_list));
++
++ r->start = DW_ADDR (attr);
++ r->end = DW_ADDR (attr2);
++
++ SYMBOL_RANGES (sym) = r;
++ }
+ attr = dwarf_attr (die, DW_AT_location);
+ if (attr)
+ {
+Index: gdb/findvar.c
+===================================================================
+RCS file: /cvs/src/src/gdb/findvar.c,v
+retrieving revision 1.31
+diff -u -u -p -r1.31 findvar.c
+--- gdb/findvar.c 9 Apr 2002 03:06:13 -0000 1.31
++++ gdb/findvar.c 12 Apr 2002 19:50:45 -0000
+@@ -417,9 +417,11 @@ struct value *
+ read_var_value (register struct symbol *var, struct frame_info *frame)
+ {
+ register struct value *v;
++ register struct range_list *r;
+ struct type *type = SYMBOL_TYPE (var);
+ CORE_ADDR addr;
+ register int len;
++ int range_ok = 0;
+
+ v = allocate_value (type);
+ VALUE_LVAL (v) = lval_memory; /* The most likely possibility. */
+@@ -429,6 +431,23 @@ read_var_value (register struct symbol *
+
+ if (frame == NULL)
+ frame = selected_frame;
++
++ if (!SYMBOL_RANGES (var))
++ range_ok = 1;
++ else
++ {
++ for (r = SYMBOL_RANGES (var); r; r = r->next)
++ {
++ if (r->start <= frame->pc && r->end > frame->pc)
++ {
++ range_ok = 1;
++ break;
++ }
++ }
++ }
++
++ if (!range_ok)
++ return NULL;
+
+ switch (SYMBOL_CLASS (var))
+ {
+Index: gdb/stack.c
+===================================================================
+RCS file: /cvs/src/src/gdb/stack.c,v
+retrieving revision 1.33
+diff -u -u -p -r1.33 stack.c
+--- gdb/stack.c 10 Apr 2002 23:32:33 -0000 1.33
++++ gdb/stack.c 12 Apr 2002 19:50:47 -0000
+@@ -1173,14 +1173,36 @@ print_block_frame_locals (struct block *
+ case LOC_REGISTER:
+ case LOC_STATIC:
+ case LOC_BASEREG:
+- values_printed = 1;
+- for (j = 0; j < num_tabs; j++)
+- fputs_filtered ("\t", stream);
+- fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
+- fputs_filtered (" = ", stream);
+- print_variable_value (sym, fi, stream);
+- fprintf_filtered (stream, "\n");
+- break;
++ {
++ struct range_list *r;
++ int range_ok = 0;
++
++ if (!SYMBOL_RANGES (sym))
++ range_ok = 1;
++ else
++ {
++ for (r = SYMBOL_RANGES (sym); r; r = r->next)
++ {
++ if (r->start <= fi->pc && r->end > fi->pc)
++ {
++ range_ok = 1;
++ break;
++ }
++ }
++ }
++
++ if (range_ok)
++ {
++ values_printed = 1;
++ for (j = 0; j < num_tabs; j++)
++ fputs_filtered ("\t", stream);
++ fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
++ fputs_filtered (" = ", stream);
++ print_variable_value (sym, fi, stream);
++ fprintf_filtered (stream, "\n");
++ }
++ break;
++ }
+
+ default:
+ /* Ignore symbols which are not locals. */
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs
new file mode 100644
index 00000000000..3cb81e64401
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs
@@ -0,0 +1,76 @@
+//
+// System.Data.SqlClient.SqlClientPermission.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+
+ public sealed class SqlClientPermission : DBDataPermission {
+
+ [MonoTODO]
+ public SqlClientPermission() {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public SqlClientPermission(PermissionState state) {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public SqlClientPermission(PermissionState state,
+ bool allowBlankPassword) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Copy() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FromXml(SecurityElement
+ securityElement) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~SqlClientPermission() {
+ // FIXME: destructor to release resources
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs
new file mode 100644
index 00000000000..120ff3f1046
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs
@@ -0,0 +1,51 @@
+//
+// System.Data.SqlClient.SqlClientPermissionAttribute.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+
+ [AttributeUsage(AttributeTargets.Assembly |
+ AttributeTargets.Class |
+ AttributeTargets.Struct |
+ AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class SqlClientPermissionAttribute :
+ DBDataPermissionAttribute {
+
+ [MonoTODO]
+ [AttributeUsage(AttributeTargets.Assembly |
+ AttributeTargets.Class |
+ AttributeTargets.Struct |
+ AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public SqlClientPermissionAttribute(SecurityAction action) {
+ // FIXME: do constructor
+ }
+
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
+ | AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public override IPermission CreatePermission() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~SqlClientPermissionAttribute() {
+ // FIXME: destructor to release resources
+ }
+ }
+
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs
new file mode 100644
index 00000000000..02151854f49
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommand.cs
@@ -0,0 +1,380 @@
+//
+// System.Data.SqlClient.SqlCommand.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+// use #define DEBUG_SqlCommand if you want to spew debug messages
+// #define DEBUG_SqlCommand
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Xml;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a SQL statement that is executed
+ /// while connected to a SQL database.
+ /// </summary>
+ // public sealed class SqlCommand : Component, IDbCommand, ICloneable
+ public sealed class SqlCommand : IDbCommand
+ {
+ // FIXME: Console.WriteLine() is used for debugging throughout
+
+ #region Fields
+
+ string sql = "";
+ int timeout = 30;
+ // default is 30 seconds
+ // for command execution
+
+ SqlConnection conn = null;
+ SqlTransaction trans = null;
+ CommandType cmdType = CommandType.Text;
+ bool designTime = false;
+ SqlParameterCollection parmCollection = new
+ SqlParameterCollection();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SqlCommand()
+ {
+ sql = "";
+ }
+
+ public SqlCommand (string cmdText)
+ {
+ sql = cmdText;
+ }
+
+ public SqlCommand (string cmdText, SqlConnection connection)
+ {
+ sql = cmdText;
+ conn = connection;
+ }
+
+ public SqlCommand (string cmdText, SqlConnection connection,
+ SqlTransaction transaction)
+ {
+ sql = cmdText;
+ conn = connection;
+ trans = transaction;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public void Cancel ()
+ {
+ // FIXME: use non-blocking Exec for this
+ throw new NotImplementedException ();
+ }
+
+ // FIXME: is this the correct way to return a stronger type?
+ [MonoTODO]
+ IDbDataParameter IDbCommand.CreateParameter ()
+ {
+ return CreateParameter ();
+ }
+
+ [MonoTODO]
+ public SqlParameter CreateParameter ()
+ {
+ return new SqlParameter ();
+ }
+
+ [MonoTODO]
+ public int ExecuteNonQuery ()
+ {
+ IntPtr pgResult; // PGresult
+ int rowsAffected = -1;
+ ExecStatusType execStatus;
+ String rowsAffectedString;
+
+ if(conn.State != ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnnectionState is not Open");
+
+ // FIXME: PQexec blocks
+ // while PQsendQuery is non-blocking
+ // which is better to use?
+ // int PQsendQuery(PGconn *conn,
+ // const char *query);
+
+ // execute SQL command
+ // uses internal property to get the PGConn IntPtr
+ pgResult = PostgresLibrary.
+ PQexec (conn.PostgresConnection, sql);
+
+ execStatus = PostgresLibrary.
+ PQresultStatus (pgResult);
+
+ if(execStatus == ExecStatusType.PGRES_COMMAND_OK)
+ {
+ rowsAffectedString = PostgresLibrary.
+ PQcmdTuples (pgResult);
+#if DEBUG_SqlCommand
+ Console.WriteLine("rowsAffectedString: " +
+ rowsAffectedString);
+#endif // DEBUG_SqlCommand
+ if(rowsAffectedString != null)
+ if(rowsAffectedString.Equals("") == false)
+ rowsAffected = int.Parse(rowsAffectedString);
+ }
+ else
+ {
+ String errorMessage;
+
+ errorMessage = PostgresLibrary.
+ PQresStatus(execStatus);
+
+ errorMessage += " " + PostgresLibrary.
+ PQresultErrorMessage(pgResult);
+
+ throw new SqlException(0, 0,
+ errorMessage, 0, "",
+ conn.DataSource, "SqlCommand", 0);
+ }
+#if DEBUG_SqlCommand
+ String cmdStatus;
+ cmdStatus = PostgresLibrary.
+ PQcmdStatus(pgResult);
+
+ Console.WriteLine("*** Command Status: " +
+ cmdStatus);
+#endif // DEBUG_SqlCommand
+ PostgresLibrary.PQclear (pgResult);
+
+ // FIXME: get number of rows
+ // affected for INSERT, UPDATE, or DELETE
+ // any other, return -1 (such as, CREATE TABLE)
+ return rowsAffected;
+ }
+
+ // FIXME: temporarily commmented out, so I could get a simple working
+ // SqlConnection and SqlCommand. I had to temporarily
+ // comment it out the ExecuteReader in IDbCommand as well.
+ /*
+ [MonoTODO]
+ IDataReader IDbCommand.ExecuteReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ SqlDataReader ExecuteReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ IDataReader IDbCommand.ExecuteReader (
+ CommandBehavior behavior)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlDataReader ExecuteReader (CommandBehavior behavior)
+ {
+ throw new NotImplementedException ();
+ }
+ */
+
+ [MonoTODO]
+ public object ExecuteScalar ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlReader ExecuteXmlReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Prepare ()
+ {
+ // FIXME: parameters have to be implemented for this
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ #region Properties
+
+ public string CommandText {
+ get {
+ return sql;
+ }
+
+ set {
+ sql = value;
+ }
+ }
+
+ public int CommandTimeout {
+ get {
+ return timeout;
+ }
+
+ set {
+ // FIXME: if value < 0, throw
+ // ArgumentException
+ // if (value < 0)
+ // throw ArgumentException;
+ timeout = value;
+ }
+ }
+
+ public CommandType CommandType {
+ get {
+ return cmdType;
+ }
+
+ set {
+ cmdType = value;
+ }
+ }
+
+ // FIXME: for property Connection, is this the correct
+ // way to handle a return of a stronger type?
+ IDbConnection IDbCommand.Connection {
+ get {
+ return Connection;
+ }
+
+ set {
+ // FIXME: throw an InvalidOperationException
+ // if the change was during a
+ // transaction in progress
+
+ // csc
+ Connection = (SqlConnection) value;
+ // mcs
+ // Connection = value;
+
+ // FIXME: set Transaction property to null
+ }
+ }
+
+ public SqlConnection Connection {
+ get {
+ // conn defaults to null
+ return conn;
+ }
+
+ set {
+ // FIXME: throw an InvalidOperationException
+ // if the change was during
+ // a transaction in progress
+ conn = value;
+ // FIXME: set Transaction property to null
+ }
+ }
+
+ public bool DesignTimeVisible {
+ get {
+ return designTime;
+ }
+
+ set{
+ designTime = value;
+ }
+ }
+
+ // FIXME; for property Parameters, is this the correct
+ // way to handle a stronger return type?
+ IDataParameterCollection IDbCommand.Parameters {
+ get {
+ return Parameters;
+ }
+ }
+
+ SqlParameterCollection Parameters {
+ get {
+ return parmCollection;
+ }
+ }
+
+ // FIXME: for property Transaction, is this the correct
+ // way to handle a return of a stronger type?
+ IDbTransaction IDbCommand.Transaction {
+ get {
+ return Transaction;
+ }
+
+ set {
+ // FIXME: error handling - do not allow
+ // setting of transaction if transaction
+ // has already begun
+
+ // csc
+ Transaction = (SqlTransaction) value;
+ // mcs
+ // Transaction = value;
+ }
+ }
+
+ public SqlTransaction Transaction {
+ get {
+ return trans;
+ }
+
+ set {
+ // FIXME: error handling
+ trans = value;
+ }
+ }
+
+ [MonoTODO]
+ public UpdateRowSource UpdatedRowSource {
+ // FIXME: do this once DbDataAdaptor
+ // and DataRow are done
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Destructors
+
+ [MonoTODO]
+ public void Dispose() {
+ // FIXME: need proper way to release resources
+ // Dispose(true);
+ }
+
+ [MonoTODO]
+ ~SqlCommand()
+ {
+ // FIXME: need proper way to release resources
+ // Dispose(false);
+ }
+
+ #endregion //Destructors
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs
new file mode 100644
index 00000000000..d2b028bc652
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs
@@ -0,0 +1,103 @@
+//
+// System.Data.SqlClient.SqlCommandBuilder.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.ComponentModel;
+
+namespace System.Data.SqlClient {
+
+ /// <summary>
+ /// Builder of one command
+ /// that will be used in manipulating a table for
+ /// a DataSet that is assoicated with a database.
+ /// </summary>
+ public sealed class SqlCommandBuilder : Component {
+
+ [MonoTODO]
+ public SqlCommandBuilder() {
+
+ }
+
+ [MonoTODO]
+ public SqlCommandBuilder(SqlDataAdapter adapter) {
+
+ }
+
+ [MonoTODO]
+ public SqlDataAdapter DataAdapter {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string QuotePrefix {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string QuoteSuffix {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static void DeriveParameters(SqlCommand command) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand GetDeleteCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand GetInsertCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand GetUpdateCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RefreshSchema() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose(bool disposing) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~SqlCommandBuilder() {
+ // FIXME: create destructor - release resources
+ }
+ }
+}
+
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs
new file mode 100644
index 00000000000..9b0ab2280f9
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlConnection.cs
@@ -0,0 +1,528 @@
+//
+// System.Data.SqlClient.SqlConnection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+// use #define DEBUG_SqlConnection if you want to spew debug messages
+// #define DEBUG_SqlConnection
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace System.Data.SqlClient
+{
+ // using PGconn = IntPtr;
+ // PGconn is native C library type in libpq for Postgres Connection
+
+ // using PGressult = IntPtr;
+ // PGresult is native C library type in libpq for Postgres Resultset
+
+ /// <summary>
+ /// Represents an open connection to a SQL data source
+ /// </summary>
+ //public sealed class SqlConnection : Component, IDbConnection,
+ // ICloneable
+ public sealed class SqlConnection : IDbConnection
+ {
+ // FIXME: Need to implement class Component,
+ // and interfaces: ICloneable and IDisposable
+
+ #region Fields
+
+ private IntPtr pgConn = IntPtr.Zero;
+ // PGConn (Postgres Connection)
+ private string connectionString = "";
+ // OLE DB Connection String
+ private string pgConnectionString = "";
+ // PostgreSQL Connection String
+ private SqlTransaction trans = null;
+ private int connectionTimeout = 15;
+ // default for 15 seconds
+
+ // connection parameters in connection string
+ private string host = "";
+ // Name of host to connect to
+ private string hostaddr = "";
+ // IP address of host to connect to
+ // should be in "n.n.n.n" format
+ private string port = "";
+ // Port number to connect to at the server host
+ private string dbname = ""; // The database name.
+ private string user = ""; // User name to connect as.
+ private string password = "";
+ // Password to be used if the server
+ // demands password authentication.
+ private string options = "";
+ // Trace/debug options to be sent to the server.
+ private string tty = "";
+ // A file or tty for optional
+ // debug output from the backend.
+ private string requiressl = "";
+ // Set to 1 to require
+ // SSL connection to the backend.
+ // Libpq will then refuse to connect
+ // if the server does not
+ // support SSL. Set to 0 (default) to
+ // negotiate with server.
+
+ ConnectionState conState = ConnectionState.Closed;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ /*
+ [MonoTODO]
+ public SqlConnection ()
+ {
+ this.ConnectionString = null;
+ this.ConnectionTimeout = 0;
+ this.Database = null;
+ this.State = 0;
+ }
+
+ [MonoTODO]
+ public SqlConnection (string cs) : SqlConnection ()
+ {
+ this.ConnectionString = cs;
+ }
+
+ */
+ // A lot of the defaults were initialized in the Fields
+ [MonoTODO]
+ public SqlConnection ()
+ {
+
+ }
+
+ [MonoTODO]
+ public SqlConnection (String connectionString)
+ {
+ SetConnectionString (connectionString);
+ }
+
+ #endregion // Constructors
+
+ #region Destructors
+
+ [MonoTODO]
+ public void Dispose () {
+ // FIXME: release resources properly
+ Close ();
+ // Dispose (true);
+ }
+
+ // aka Finalize
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ [MonoTODO]
+ ~SqlConnection()
+ {
+ // FIXME: this class need
+ // a destructor to release resources
+ // Also, take a look at Dispose
+ // Dispose (false);
+ }
+
+ #endregion // Destructors
+
+ #region Public Methods
+
+ IDbTransaction IDbConnection.BeginTransaction ()
+ {
+ return BeginTransaction ();
+ }
+
+ public SqlTransaction BeginTransaction ()
+ {
+ return TransactionBegin (); // call private method
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction (IsolationLevel
+ il)
+ {
+ return BeginTransaction (il);
+ }
+
+ public SqlTransaction BeginTransaction (IsolationLevel il)
+ {
+ return TransactionBegin (il); // call private method
+ }
+
+ // PostgreSQL does not support named transactions/savepoint
+ // nor nested transactions
+ [Obsolete]
+ public SqlTransaction BeginTransaction(string transactionName) {
+ return TransactionBegin (); // call private method
+ }
+
+ [Obsolete]
+ public SqlTransaction BeginTransaction(IsolationLevel iso,
+ string transactionName) {
+ return TransactionBegin (iso); // call private method
+ }
+
+ [MonoTODO]
+ public void ChangeDatabase (string databaseName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Close ()
+ {
+ CloseDataSource ();
+ }
+
+ IDbCommand IDbConnection.CreateCommand ()
+ {
+ return CreateCommand ();
+ }
+
+ public SqlCommand CreateCommand ()
+ {
+ SqlCommand sqlcmd = new SqlCommand ("", this);
+
+ return sqlcmd;
+ }
+
+ [MonoTODO]
+ public void Open ()
+ {
+ OpenDataSource ();
+ }
+
+ #endregion // Public Methods
+
+ #region Internal Methods
+
+ // this is for System.Data.SqlClient classes
+ // to get the Postgres connection
+ internal IntPtr PostgresConnection {
+ get {
+ return pgConn;
+ }
+ }
+
+ #endregion // Internal Methods
+
+ #region Protected Methods
+
+ // FIXME: protected override void Dispose overrides Component
+ // however, including Component causes other problems
+ /*
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+ */
+
+ #endregion
+
+ #region Private Methods
+
+ private void OpenDataSource ()
+ {
+ if(dbname.Equals(""))
+ throw new InvalidOperationException(
+ "dbname missing");
+ else if(conState == ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnnectionState is already Open");
+
+ ConnStatusType connStatus;
+
+ // FIXME: check to make sure we have
+ // everything to connect,
+ // otherwise, throw an exception
+
+ pgConn = PostgresLibrary.PQconnectdb
+ (pgConnectionString);
+
+ // FIXME: should we use PQconnectStart/PQconnectPoll
+ // instead of PQconnectdb?
+ // PQconnectdb blocks
+ // PQconnectStart/PQconnectPoll is non-blocking
+
+ connStatus = PostgresLibrary.PQstatus (pgConn);
+ if(connStatus == ConnStatusType.CONNECTION_OK)
+ {
+ // Successfully Connected
+ conState = ConnectionState.Open;
+ }
+ else
+ {
+ String errorMessage = PostgresLibrary.
+ PQerrorMessage (pgConn);
+ errorMessage += ": Could not connect to database.";
+
+ throw new SqlException(0, 0,
+ errorMessage, 0, "",
+ host, "SqlConnection", 0);
+ }
+ }
+
+ private void CloseDataSource ()
+ {
+ // FIXME: just a quick hack
+ conState = ConnectionState.Closed;
+ PostgresLibrary.PQfinish (pgConn);
+ }
+
+ private void SetConnectionString (string connectionString)
+ {
+ // FIXME: perform error checking on string
+ // while translating string from
+ // OLE DB format to PostgreSQL
+ // connection string format
+ //
+ // OLE DB: "host=localhost;dbname=test;user=joe;password=smoe"
+ // PostgreSQL: "host=localhost dbname=test user=joe password=smoe"
+ //
+ // For OLE DB, you would have the additional
+ // "provider=postgresql"
+ // OleDbConnection you would be using libgda, maybe
+ // it would be
+ // "provider=OAFIID:GNOME_Database_Postgres_Provider"
+ // instead.
+ //
+ // Also, parse the connection string into properties
+
+ // FIXME: if connection is open, you can
+ // not set the connection
+ // string, throw an exception
+
+ this.connectionString = connectionString;
+ pgConnectionString = ConvertStringToPostgres (
+ connectionString);
+
+#if DEBUG_SqlConnection
+ Console.WriteLine(
+ "OLE-DB Connection String [in]: " +
+ this.ConnectionString);
+ Console.WriteLine(
+ "Postgres Connection String [out]: " +
+ pgConnectionString);
+#endif // DEBUG_SqlConnection
+ }
+
+ private String ConvertStringToPostgres (String
+ oleDbConnectionString)
+ {
+ StringBuilder postgresConnection =
+ new StringBuilder();
+ string result;
+ string[] connectionParameters;
+
+ char[] semicolon = new Char[1];
+ semicolon[0] = ';';
+
+ // FIXME: what is the max number of value pairs
+ // can there be for the OLE DB
+ // connnection string? what about libgda max?
+ // what about postgres max?
+
+ // FIXME: currently assuming value pairs are like:
+ // "key1=value1;key2=value2;key3=value3"
+ // Need to deal with values that have
+ // single or double quotes. And error
+ // handling of that too.
+ // "key1=value1;key2='value2';key=\"value3\""
+
+ // FIXME: put the connection parameters
+ // from the connection
+ // string into a
+ // Hashtable (System.Collections)
+ // instead of using private variables
+ // to store them
+ connectionParameters = oleDbConnectionString.
+ Split (semicolon);
+ foreach (string sParameter in connectionParameters) {
+ if(sParameter.Length > 0) {
+ BreakConnectionParameter (sParameter);
+ postgresConnection.
+ Append (sParameter +
+ " ");
+ }
+ }
+ result = postgresConnection.ToString ();
+ return result;
+ }
+
+ private bool BreakConnectionParameter (String sParameter)
+ {
+ bool addParm = true;
+ int index;
+
+ index = sParameter.IndexOf ("=");
+ if (index > 0) {
+ string parmKey, parmValue;
+
+ // separate string "key=value" to
+ // string "key" and "value"
+ parmKey = sParameter.Substring (0, index);
+ parmValue = sParameter.Substring (index + 1,
+ sParameter.Length - index - 1);
+
+ switch(parmKey.ToLower()) {
+ case "hostaddr":
+ hostaddr = parmValue;
+ break;
+
+ case "port":
+ port = parmValue;
+ break;
+
+ case "host":
+ // set DataSource property
+ host = parmValue;
+ break;
+
+ case "dbname":
+ // set Database property
+ dbname = parmValue;
+ break;
+
+ case "user":
+ user = parmValue;
+ break;
+
+ case "password":
+ password = parmValue;
+ // addParm = false;
+ break;
+
+ case "options":
+ options = parmValue;
+ break;
+
+ case "tty":
+ tty = parmValue;
+ break;
+
+ case "requiressl":
+ requiressl = parmValue;
+ break;
+ }
+ }
+ return addParm;
+ }
+
+ private SqlTransaction TransactionBegin ()
+ {
+ // FIXME: need to keep track of
+ // transaction in-progress
+ trans = new SqlTransaction ();
+ // using internal methods of SqlTransaction
+ trans.SetConnection (this);
+ trans.Begin();
+
+ return trans;
+ }
+
+ private SqlTransaction TransactionBegin (IsolationLevel il)
+ {
+ // FIXME: need to keep track of
+ // transaction in-progress
+ TransactionBegin();
+ trans.SetIsolationLevel (il);
+
+ return trans;
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public ConnectionState State {
+ get {
+ return conState;
+ }
+ }
+
+ public string ConnectionString {
+ get {
+ return connectionString;
+ }
+ set {
+ SetConnectionString (value);
+ }
+ }
+
+ public int ConnectionTimeout {
+ get {
+ return connectionTimeout;
+ }
+ }
+
+ public string Database {
+ get {
+ return dbname;
+ }
+ }
+
+ public string DataSource {
+ get {
+ return host;
+ }
+ }
+
+ /*
+ * FIXME: this is here because of Component?
+ [MonoTODO]
+ protected bool DesignMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ */
+ public int PacketSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public string ServerVersion {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ internal SqlTransaction Transaction {
+ get {
+ return trans;
+ }
+ }
+
+ #endregion
+
+ #region Events and Delegates
+
+ // FIXME: the two events belong here
+ // however, i do not know about the delegates
+ // also, they are stubs for now
+ /*
+ public delegate void
+ SqlInfoMessageEventHandler (object sender,
+ SqlInfoMessageEventArgs e);
+
+ public event
+ SqlInfoMessageEventHandler InfoMessage;
+
+ public event
+ StateChangeEventHandler StateChange;
+ */
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs
new file mode 100644
index 00000000000..e30bc74677b
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs
@@ -0,0 +1,231 @@
+//
+// System.Data.SqlClient.SqlDataAdapter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a set of command-related properties that are used
+ /// to fill the DataSet and update a data source, all this
+ /// from a SQL database.
+ /// </summary>
+ public sealed class SqlDataAdapter : DbDataAdapter, IDbDataAdapter
+ {
+ #region Properties
+
+ [MonoTODO]
+ public SqlCommand DeleteCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public SqlCommand InsertCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public SqlCommand SelectCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public SqlCommand UpdateCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override int Fill(DataSet dataSet) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill(DataTable dataTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill(DataSet dataSet, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataTable dataTable,
+ IDataReader dataReader) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataTable dataTable,
+ IDbCommand command,
+ CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill(DataSet dataSet, int startRecord,
+ int maxRecords, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataSet dataSet,
+ string srcTable, IDataReader dataReader,
+ int startRecord, int maxRecords) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataSet dataSet,
+ int startRecord, int maxRecords,
+ string srcTable, IDbCommand command,
+ CommandBehavior behavior) {
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override DataTable[] FillSchema(DataSet dataSet,
+ SchemaType schemaType) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable FillSchema(DataTable dataTable,
+ SchemaType schemaType) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable[] FillSchema(DataSet dataSet,
+ SchemaType schemaType, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual DataTable FillSchema(DataTable dataTable,
+ SchemaType schemaType, IDbCommand command,
+ CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual DataTable[] FillSchema(DataSet dataSet,
+ SchemaType schemaType, IDbCommand command,
+ string srcTable, CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IDataParameter[] GetFillParameters() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update(DataRow[] dataRows) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int Update(DataSet dataSet) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update(DataTable dataTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Update(DataRow[] dataRows,
+ DataTableMapping tableMapping) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update(DataSet dataSet, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override RowUpdatedEventArgs CreateRowUpdatedEvent(
+ DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override RowUpdatingEventArgs CreateRowUpdatingEvent(
+ DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnFillError(FillErrorEventArgs value) {
+ throw new NotImplementedException ();
+ }
+
+ protected override void OnRowUpdated(RowUpdatedEventArgs value) {
+ throw new NotImplementedException ();
+ }
+
+ protected override void OnRowUpdating(RowUpdatingEventArgs value) {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ public event FillErrorEventHandler FillError;
+
+ public event SqlRowUpdatedEventHandler RowUpdated;
+
+ public event SqlRowUpdatingEventHandler RowUpdating;
+
+ #endregion // Events and Delegates
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs
new file mode 100644
index 00000000000..f9d1f2bfe76
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs
@@ -0,0 +1,263 @@
+//
+// System.Data.SqlClient.SqlDataReader.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Provides a means of reading one or more forward-only streams
+ /// of result sets obtained by executing a command
+ /// at a SQL database.
+ /// </summary>
+ //public sealed class SqlDataReader : MarshalByRefObject,
+ // IEnumerable, IDataReader, IDisposable, IDataRecord
+ public sealed class SqlDataReader : IEnumerable,
+ IDataReader, IDataRecord
+ {
+ #region Fields
+
+ DataTable tableSchema;
+ DataTable tableRow;
+
+ #endregion // Fields
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void Close()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable GetSchemaTable()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool NextResult()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Read()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public byte GetByte(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetBytes(int i, long fieldOffset,
+ byte[] buffer, int bufferOffset,
+ int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public char GetChar(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetChars(int i, long fieldOffset,
+ char[] buffer, int bufferOffset,
+ int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IDataReader GetData(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetDataTypeName(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DateTime GetDateTime(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public decimal GetDecimal(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public double GetDouble(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Type GetFieldType(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public float GetFloat(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Guid GetGuid(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public short GetInt16(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetInt32(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetInt64(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetName(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetOrdinal(string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetString(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetValue(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetValues(object[] values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsDBNull(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool GetBoolean(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Public Methods
+
+ #region // Destructors
+
+ [MonoTODO]
+ public void Dispose () {
+ }
+
+ [MonoTODO]
+ ~SqlDataReader() {
+ }
+
+ #endregion // Destructors
+
+
+ #region Properties
+
+ public int Depth {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool IsClosed {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int RecordsAffected {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int FieldCount {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public object this[string name] {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public object this[int i] {
+ [MonoTODO]
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlError.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlError.cs
new file mode 100644
index 00000000000..e7c722285a9
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlError.cs
@@ -0,0 +1,155 @@
+//
+// System.Data.SqlClient.SqlError.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Describes an error from a SQL database.
+ /// </summary>
+ [MonoTODO]
+ public sealed class SqlError
+ {
+ byte theClass = 0;
+ int lineNumber = 0;
+ string message = "";
+ int number = 0;
+ string procedure = "";
+ string server = "";
+ string source = "";
+ byte state = 0;
+
+ internal SqlError(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+ this.theClass = theClass;
+ this.lineNumber = lineNumber;
+ this.message = message;
+ this.number = number;
+ this.procedure = procedure;
+ this.server = server;
+ this.source = source;
+ this.state = state;
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ /// <summary>
+ /// severity level of the error
+ /// </summary>
+ public byte Class {
+ get {
+ return theClass;
+ }
+ }
+
+ [MonoTODO]
+ public int LineNumber {
+ get {
+ return lineNumber;
+ }
+ }
+
+ [MonoTODO]
+ public string Message {
+ get {
+ return message;
+ }
+ }
+
+ [MonoTODO]
+ public int Number {
+ get {
+ return number;
+ }
+ }
+
+ [MonoTODO]
+ public string Procedure {
+ get {
+ return procedure;
+ }
+ }
+
+ [MonoTODO]
+ public string Server {
+ get {
+ return server;
+ }
+ }
+
+ [MonoTODO]
+ public string Source {
+ get {
+ return source;
+ }
+ }
+
+ [MonoTODO]
+ public byte State {
+ get {
+ return state;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ String toStr;
+ String stackTrace;
+ stackTrace = " <Stack Trace>";
+ // FIXME: generate the correct SQL error string
+ toStr = "SqlError:" + message + stackTrace;
+ return toStr;
+ }
+
+ internal void SetClass(byte theClass) {
+ this.theClass = theClass;
+ }
+
+ internal void SetLineNumber(int lineNumber) {
+ this.lineNumber = lineNumber;
+ }
+
+ internal void SetMessage(string message) {
+ this.message = message;
+ }
+
+ internal void SetNumber(int number) {
+ this.number = number;
+ }
+
+ internal void SetProcedure(string procedure) {
+ this.procedure = procedure;
+ }
+
+ internal void SetServer(string server) {
+ this.server = server;
+ }
+
+ internal void SetSource(string source) {
+ this.source = source;
+ }
+
+ internal void SetState(byte state) {
+ this.state = state;
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs
new file mode 100644
index 00000000000..7050d5d08fa
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs
@@ -0,0 +1,114 @@
+//
+// System.Data.SqlClient.SqlError.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+using System;
+using System.Collections;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Describes an error from a SQL database.
+ /// </summary>
+ [MonoTODO]
+ public sealed class SqlErrorCollection : ICollection, IEnumerable
+ {
+ ArrayList errorList = new ArrayList();
+
+ internal SqlErrorCollection() {
+ }
+
+ internal SqlErrorCollection(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ Add (theClass, lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ public int Count {
+ get {
+ return errorList.Count;
+ }
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index) {
+ throw new NotImplementedException ();
+ }
+
+ // [MonoTODO]
+ bool ICollection.IsSynchronized {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // [MonoTODO]
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+
+ // Index property (indexer)
+ // [MonoTODO]
+ public SqlError this[int index] {
+ get {
+ return (SqlError) errorList[index];
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ internal void Add(SqlError error) {
+ errorList.Add(error);
+ }
+
+ internal void Add(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ SqlError error = new SqlError(theClass,
+ lineNumber, message,
+ number, procedure,
+ server, source, state);
+ Add(error);
+ }
+
+ #region Destructors
+
+ [MonoTODO]
+ ~SqlErrorCollection()
+ {
+ // FIXME: do the destructor - release resources
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlException.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlException.cs
new file mode 100644
index 00000000000..89983847d55
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlException.cs
@@ -0,0 +1,202 @@
+//
+// System.Data.SqlClient.SqlException.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc
+//
+using System;
+using System.Data;
+using System.Runtime.Serialization;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Exceptions, as returned by SQL databases.
+ /// </summary>
+ public sealed class SqlException : SystemException
+ {
+ private SqlErrorCollection errors;
+
+ internal SqlException() {
+ errors = new SqlErrorCollection();
+ }
+
+ internal SqlException(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ errors = new SqlErrorCollection (theClass,
+ lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ public byte Class {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception here?
+ else
+ return errors[0].Class;
+ }
+
+ set {
+ errors[0].SetClass(value);
+ }
+ }
+
+ [MonoTODO]
+ public SqlErrorCollection Errors {
+ get {
+ return errors;
+ }
+
+ set {
+ errors = value;
+ }
+ }
+
+ [MonoTODO]
+ public int LineNumber {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception here?
+ return errors[0].LineNumber;
+ }
+
+ set {
+ errors[0].SetLineNumber(value);
+ }
+ }
+
+ [MonoTODO]
+ public override string Message {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else {
+ String msg = "";
+ int i = 0;
+
+ for(i = 0; i < errors.Count - 1; i++) {
+ msg = msg + errors[i].Message + "\n";
+ }
+ msg = msg + errors[i].Message;
+
+ return msg;
+ }
+ }
+ }
+
+ [MonoTODO]
+ public int Number {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception?
+ else
+ return errors[0].Number;
+ }
+
+ set {
+ errors[0].SetNumber(value);
+ }
+ }
+
+ [MonoTODO]
+ public string Procedure {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Procedure;
+ }
+
+ set {
+ errors[0].SetProcedure(value);
+ }
+ }
+
+ [MonoTODO]
+ public string Server {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Server;
+ }
+
+ set {
+ errors[0].SetServer(value);
+ }
+ }
+
+ [MonoTODO]
+ public override string Source {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Source;
+ }
+
+ set {
+ errors[0].SetSource(value);
+ }
+ }
+
+ [MonoTODO]
+ public byte State {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception?
+ else
+ return errors[0].State;
+ }
+
+ set {
+ errors[0].SetState(value);
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void GetObjectData(SerializationInfo si,
+ StreamingContext context) {
+ // FIXME: to do
+ }
+
+ // [Serializable]
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ public override string ToString() {
+ String toStr = "";
+ for (int i = 0; i < errors.Count; i++) {
+ toStr = toStr + errors[i].ToString() + "\n";
+ }
+ return toStr;
+ }
+
+ internal void Add(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ errors.Add (theClass, lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ [MonoTODO]
+ ~SqlException() {
+ // FIXME: destructor to release resources
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs
new file mode 100644
index 00000000000..67eaba58482
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Data.SqlClient.SqlInfoMessageEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public sealed class SqlInfoMessageEventArgs : EventArgs
+ {
+ [MonoTODO]
+ public SqlErrorCollection Errors {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string Message
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string Source {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ // representation of InfoMessage event
+ }
+
+ [MonoTODO]
+ ~SqlInfoMessageEventArgs() {
+ // FIXME: destructor needs to release resources
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs
new file mode 100644
index 00000000000..c9862d61c03
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Data.SqlClient.SqlInfoMessageEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public delegate void
+ SqlInfoMessageEventHandler (object sender,
+ SqlInfoMessageEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameter.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameter.cs
new file mode 100644
index 00000000000..31f500ffdff
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameter.cs
@@ -0,0 +1,196 @@
+//
+// System.Data.SqlClient.SqlParameter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a parameter to a Command object, and optionally,
+ /// its mapping to DataSet columns; and is implemented by .NET
+ /// data providers that access data sources.
+ /// </summary>
+ //public sealed class SqlParameter : MarshalByRefObject,
+ // IDbDataParameter, IDataParameter, ICloneable
+ public sealed class SqlParameter : IDbDataParameter, IDataParameter
+ {
+ [MonoTODO]
+ public SqlParameter () {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter (string parameterName, object value) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType,
+ int size) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType,
+ int size, string sourceColumn) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType,
+ int size, ParameterDirection direction,
+ bool isNullable, byte precision,
+ byte scale, string sourceColumn,
+ DataRowVersion sourceVersion, object value) {
+ // FIXME: do this
+ }
+
+
+ [MonoTODO]
+ public DbType DbType {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public ParameterDirection Direction {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool IsNullable {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int Offset {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string ParameterName {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string SourceColumn {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public DataRowVersion SourceVersion {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public SqlDbType SqlDbType {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public object Value {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public byte Precision {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public byte Scale {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int Size
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs
new file mode 100644
index 00000000000..7b665dd0b1e
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs
@@ -0,0 +1,231 @@
+//
+// System.Data.SqlClient.SqlParameterCollection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Collections;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Collects all parameters relevant to a Command object
+ /// and their mappings to DataSet columns.
+ /// </summary>
+ // public sealed class SqlParameterCollection : MarshalByRefObject,
+ // IDataParameterCollection, IList, ICollection, IEnumerable
+ public sealed class SqlParameterCollection : IDataParameterCollection
+ {
+ [MonoTODO]
+ public void RemoveAt(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // [MonoTODO]
+ public object this[string parameterName]
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Add( object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(SqlParameter value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName, SqlDbType sqlDbType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName,
+ SqlDbType sqlDbType, int size)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName,
+ SqlDbType sqlDbType, int size, string sourceColumn)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+/*
+ [MonoTODO]
+ public bool Contains(string value)
+ {
+ throw new NotImplementedException ();
+ }
+
+*/
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(object value)
+ {
+ throw new NotImplementedException ();
+ }
+/*
+ [MonoTODO]
+ public int IndexOf(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+*/
+ [MonoTODO]
+ public void Insert(int index, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+/*
+ [MonoTODO]
+ public void RemoveAt(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+*/
+/*
+ [MonoTODO]
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDual)]
+ ~SqlParameterCollection();
+*/
+
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // [MonoTODO]
+ object IList.this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // [MonoTODO]
+ public SqlParameter this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+/*
+ [MonoTODO]
+ public SqlParameter this[string parameterName] {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+*/
+
+ bool IList.IsFixedSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool IList.IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs
new file mode 100644
index 00000000000..6c561ba14da
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs
@@ -0,0 +1,38 @@
+//
+// System.Data.SqlClient.SqlRowUpdatedEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+ public sealed class SqlRowUpdatedEventArgs : RowUpdatedEventArgs {
+
+ [MonoTODO]
+ public SqlRowUpdatedEventArgs (DataRow row,
+ IDbCommand command, StatementType statementType,
+ DataTableMapping tableMapping) {
+ // FIXME: do the constructor
+ }
+
+ [MonoTODO]
+ public new SqlCommand Command {
+ get {
+
+ }
+ }
+
+ [MonoTODO]
+ ~SqlRowUpdatedEventArgs () {
+ // FIXME: need destructor to release resources
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs
new file mode 100644
index 00000000000..8cad2f1cbca
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.SqlClient.SqlRowUpdatedEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public delegate void SqlRowUpdatedEventHandler(object sender,
+ SqlRowUpdatedEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs
new file mode 100644
index 00000000000..2390374899b
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs
@@ -0,0 +1,42 @@
+//
+// System.Data.SqlClient.SqlRowUpdatingEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient
+{
+ public sealed class SqlRowUpdatingEventArgs : RowUpdatingEventArgs
+ {
+ [MonoTODO]
+ public SqlRowUpdatingEventArgs( DataRow row,
+ IDbCommand command, StatementType statementType,
+ DataTableMapping tableMapping) {
+ // FIXME: do the constructor
+ }
+
+ [MonoTODO]
+ public new SqlCommand Command {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ ~SqlRowUpdatingEventArgs() {
+ // FIXME: create destructor to release resources
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs
new file mode 100644
index 00000000000..69c0228534d
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.SqlClient.SqlRowUpdatingEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public delegate void SqlRowUpdatingEventHandler(object sender,
+ SqlRowUpdatingEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs
new file mode 100644
index 00000000000..3a485b299c5
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs
@@ -0,0 +1,191 @@
+//
+// System.Data.SqlClient.SqlTransaction.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+// use #define DEBUG_SqlTransaction if you want to spew debug messages
+// #define DEBUG_SqlTransaction
+
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a transaction to be performed on a SQL database.
+ /// </summary>
+ // public sealed class SqlTransaction : MarshalByRefObject,
+ // IDbTransaction, IDisposable
+ public sealed class SqlTransaction : IDbTransaction
+ {
+ #region Fields
+
+ private bool doingTransaction = false;
+ private SqlConnection conn = null;
+ private IsolationLevel isolationLevel =
+ IsolationLevel.ReadCommitted;
+ // There are only two IsolationLevel's for PostgreSQL:
+ // ReadCommitted and Serializable,
+ // but ReadCommitted is the default
+
+ #endregion
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void Commit ()
+ {
+ if(doingTransaction == false)
+ throw new InvalidOperationException(
+ "Begin transaction was not " +
+ "done earlier " +
+ "thus PostgreSQL can not " +
+ "Commit transaction.");
+
+ SqlCommand cmd = new SqlCommand("COMMIT", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = false;
+ }
+
+ [MonoTODO]
+ public void Rollback()
+ {
+ if(doingTransaction == false)
+ throw new InvalidOperationException(
+ "Begin transaction was not " +
+ "done earlier " +
+ "thus PostgreSQL can not " +
+ "Rollback transaction.");
+
+ SqlCommand cmd = new SqlCommand("ROLLBACK", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = false;
+ }
+
+ // For PostgreSQL, Rollback(string) will not be implemented
+ // because PostgreSQL does not support Savepoints
+ [Obsolete]
+ public void Rollback(string transactionName) {
+ // throw new NotImplementedException ();
+ Rollback();
+ }
+
+ // For PostgreSQL, Save(string) will not be implemented
+ // because PostgreSQL does not support Savepoints
+ [Obsolete]
+ public void Save (string savePointName) {
+ // throw new NotImplementedException ();
+ }
+
+ #endregion // Public Methods
+
+ #region Internal Methods to System.Data.dll Assembly
+
+ internal void Begin()
+ {
+ if(doingTransaction == true)
+ throw new InvalidOperationException(
+ "Transaction has begun " +
+ "and PostgreSQL does not " +
+ "support nested transactions.");
+
+ SqlCommand cmd = new SqlCommand("BEGIN", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = true;
+ }
+
+ internal void SetIsolationLevel(IsolationLevel isoLevel)
+ {
+ String sSql = "SET TRANSACTION ISOLATION LEVEL ";
+
+ switch (isoLevel)
+ {
+ case IsolationLevel.ReadCommitted:
+ sSql += "READ COMMITTED";
+ break;
+
+ case IsolationLevel.Serializable:
+ sSql += "SERIALIZABLE";
+ break;
+
+ default:
+ // FIXME: generate exception here
+ // PostgreSQL only supports:
+ // ReadCommitted or Serializable
+ break;
+ }
+ SqlCommand cmd = new SqlCommand(sSql, conn);
+ cmd.ExecuteNonQuery();
+
+ this.isolationLevel = isoLevel;
+ }
+
+ internal void SetConnection(SqlConnection connection)
+ {
+ this.conn = connection;
+ }
+
+ #endregion // Internal Methods to System.Data.dll Assembly
+
+ #region Properties
+
+ IDbConnection IDbTransaction.Connection {
+ get {
+ return Connection;
+ }
+ }
+
+ public SqlConnection Connection {
+ get {
+ return conn;
+ }
+ }
+
+ public IsolationLevel IsolationLevel {
+ get {
+ return isolationLevel;
+ }
+ }
+
+ internal bool DoingTransaction {
+ get {
+ return doingTransaction;
+ }
+ }
+
+ #endregion Properties
+
+ #region Destructors
+
+ // Destructors aka Finalize and Dispose
+
+ [MonoTODO]
+ public void Dispose()
+ {
+ // FIXME: need to properly release resources
+ // Dispose(true);
+ }
+
+ // Destructor
+ [MonoTODO]
+ // [Serializable]
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ ~SqlTransaction() {
+ // FIXME: need to properly release resources
+ // Dispose(false);
+ }
+
+ #endregion // Destructors
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresLibrary.cs b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresLibrary.cs
new file mode 100644
index 00000000000..770f268763a
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/Mono.Data.PostgreSqlClient/PostgresLibrary.cs
@@ -0,0 +1,471 @@
+//
+// System.Data.SqlClient.PostgresLibrary.cs
+//
+// PInvoke methods to libpq
+// which is PostgreSQL client library
+//
+// May also contain enumerations,
+// data types, or wrapper methods.
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+
+namespace System.Data.SqlClient
+{
+ /* IMPORTANT: DO NOT CHANGE ANY OF THESE ENUMS */
+
+ internal enum ConnStatusType
+ {
+ CONNECTION_OK,
+ CONNECTION_BAD,
+ CONNECTION_STARTED,
+ CONNECTION_MADE,
+ CONNECTION_AWAITING_RESPONSE,
+ CONNECTION_AUTH_OK,
+ CONNECTION_SETENV
+ }
+
+ internal enum PostgresPollingStatusType
+ {
+ PGRES_POLLING_FAILED = 0,
+ PGRES_POLLING_READING,
+ PGRES_POLLING_WRITING,
+ PGRES_POLLING_OK,
+ PGRES_POLLING_ACTIVE
+ }
+
+ internal enum ExecStatusType
+ {
+ PGRES_EMPTY_QUERY = 0,
+ PGRES_COMMAND_OK,
+ PGRES_TUPLES_OK,
+ PGRES_COPY_OUT,
+ PGRES_COPY_IN,
+ PGRES_BAD_RESPONSE,
+ PGRES_NONFATAL_ERROR,
+ PGRES_FATAL_ERROR
+ }
+
+ sealed internal class PostgresLibrary
+ {
+ #region PInvoke Functions
+
+ // pinvoke prototypes to PostgreSQL client library
+ // pq.dll on windows and libpq.so on linux
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconnectStart (string conninfo);
+ // PGconn *PQconnectStart(const char *conninfo);
+
+ [DllImport("pq")]
+ public static extern PostgresPollingStatusType PQconnectPoll (IntPtr conn);
+ // PostgresPollingStatusType PQconnectPoll(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconnectdb (string conninfo);
+ // PGconn *PQconnectdb(const char *conninfo);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQsetdbLogin (string pghost,
+ string pgport, string pgoptions,
+ string pgtty, string dbName,
+ string login, string pwd);
+ // PGconn *PQsetdbLogin(const char *pghost,
+ // const char *pgport, const char *pgoptions,
+ // const char *pgtty, const char *dbName,
+ // const char *login, const char *pwd);
+
+ [DllImport("pq")]
+ public static extern void PQfinish (IntPtr conn);
+ // void PQfinish(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconndefaults ();
+ // PQconninfoOption *PQconndefaults(void);
+
+ [DllImport("pq")]
+ public static extern void PQconninfoFree (IntPtr connOptions);
+ // void PQconninfoFree(PQconninfoOption *connOptions);
+
+ [DllImport("pq")]
+ public static extern int PQresetStart (IntPtr conn);
+ // int PQresetStart(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQresetPoll (IntPtr conn);
+ // PostgresPollingStatusType PQresetPoll(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQreset (IntPtr conn);
+ // void PQreset(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQrequestCancel (IntPtr conn);
+ // int PQrequestCancel(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQdb (IntPtr conn);
+ // char *PQdb(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQuser (IntPtr conn);
+ // char *PQuser(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQpass (IntPtr conn);
+ // char *PQpass(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQhost (IntPtr conn);
+ // char *PQhost(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQport (IntPtr conn);
+ // char *PQport(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQtty (IntPtr conn);
+ // char *PQtty(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQoptions (IntPtr conn);
+ // char *PQoptions(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern ConnStatusType PQstatus (IntPtr conn);
+ // ConnStatusType PQstatus(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQerrorMessage (IntPtr conn);
+ // char *PQerrorMessage(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsocket (IntPtr conn);
+ // int PQsocket(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQbackendPID (IntPtr conn);
+ // int PQbackendPID(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQclientEncoding (IntPtr conn);
+ // int PQclientEncoding(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsetClientEncoding (IntPtr conn,
+ string encoding);
+ // int PQsetClientEncoding(PGconn *conn,
+ // const char *encoding);
+
+ //FIXME: when loading, causes runtime exception
+ //[DllImport("pq")]
+ //public static extern IntPtr PQgetssl (IntPtr conn);
+ // SSL *PQgetssl(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQtrace (IntPtr conn,
+ IntPtr debug_port);
+ // void PQtrace(PGconn *conn,
+ // FILE *debug_port);
+
+ [DllImport("pq")]
+ public static extern void PQuntrace (IntPtr conn);
+ // void PQuntrace(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQsetNoticeProcessor (IntPtr conn,
+ IntPtr proc, IntPtr arg);
+ // PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn,
+ // PQnoticeProcessor proc, void *arg);
+
+ [DllImport("pq")]
+ public static extern int PQescapeString (string to,
+ string from, int length);
+ // size_t PQescapeString(char *to,
+ // const char *from, size_t length);
+
+ [DllImport("pq")]
+ public static extern string PQescapeBytea (string bintext,
+ int binlen, IntPtr bytealen);
+ // unsigned char *PQescapeBytea(unsigned char *bintext,
+ // size_t binlen, size_t *bytealen);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQexec (IntPtr conn,
+ string query);
+ // PGresult *PQexec(PGconn *conn,
+ // const char *query);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQnotifies (IntPtr conn);
+ // PGnotify *PQnotifies(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQfreeNotify (IntPtr notify);
+ // void PQfreeNotify(PGnotify *notify);
+
+ [DllImport("pq")]
+ public static extern int PQsendQuery (IntPtr conn,
+ string query);
+ // int PQsendQuery(PGconn *conn,
+ // const char *query);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQgetResult (IntPtr conn);
+ // PGresult *PQgetResult(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQisBusy (IntPtr conn);
+ // int PQisBusy(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQconsumeInput (IntPtr conn);
+ // int PQconsumeInput(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQgetline (IntPtr conn,
+ string str, int length);
+ // int PQgetline(PGconn *conn,
+ // char *string, int length);
+
+ [DllImport("pq")]
+ public static extern int PQputline (IntPtr conn,
+ string str);
+ // int PQputline(PGconn *conn,
+ // const char *string);
+
+ [DllImport("pq")]
+ public static extern int PQgetlineAsync (IntPtr conn,
+ string buffer, int bufsize);
+ // int PQgetlineAsync(PGconn *conn, char *buffer,
+ // int bufsize);
+
+ [DllImport("pq")]
+ public static extern int PQputnbytes (IntPtr conn,
+ string buffer, int nbytes);
+ // int PQputnbytes(PGconn *conn,
+ //const char *buffer, int nbytes);
+
+ [DllImport("pq")]
+ public static extern int PQendcopy (IntPtr conn);
+ // int PQendcopy(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsetnonblocking (IntPtr conn,
+ int arg);
+ // int PQsetnonblocking(PGconn *conn, int arg);
+
+ [DllImport("pq")]
+ public static extern int PQisnonblocking (IntPtr conn);
+ // int PQisnonblocking(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQflush (IntPtr conn);
+ // int PQflush(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQfn (IntPtr conn, int fnid,
+ IntPtr result_buf, IntPtr result_len,
+ int result_is_int, IntPtr args,
+ int nargs);
+ // PGresult *PQfn(PGconn *conn, int fnid,
+ // int *result_buf, int *result_len,
+ // int result_is_int, const PQArgBlock *args,
+ // int nargs);
+
+ [DllImport("pq")]
+ public static extern ExecStatusType PQresultStatus (IntPtr res);
+ // ExecStatusType PQresultStatus(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQresStatus (ExecStatusType status);
+ // char *PQresStatus(ExecStatusType status);
+
+ [DllImport("pq")]
+ public static extern string PQresultErrorMessage (IntPtr res);
+ // char *PQresultErrorMessage(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQntuples (IntPtr res);
+ // int PQntuples(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQnfields (IntPtr res);
+ // int PQnfields(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQbinaryTuples (IntPtr res);
+ // int PQbinaryTuples(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQfname (IntPtr res,
+ int field_num);
+ // char *PQfname(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfnumber (IntPtr res,
+ string field_name);
+ // int PQfnumber(const PGresult *res,
+ // const char *field_name);
+
+ [DllImport("pq")]
+ public static extern int PQftype (IntPtr res,
+ int field_num);
+ // Oid PQftype(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfsize (IntPtr res,
+ int field_num);
+ // int PQfsize(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfmod (IntPtr res, int field_num);
+ // int PQfmod(const PGresult *res, int field_num);
+
+ [DllImport("pq")]
+ public static extern string PQcmdStatus (IntPtr res);
+ // char *PQcmdStatus(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQoidStatus (IntPtr res);
+ // char *PQoidStatus(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQoidValue (IntPtr res);
+ // Oid PQoidValue(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQcmdTuples (IntPtr res);
+ // char *PQcmdTuples(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQgetvalue (IntPtr res,
+ int tup_num, int field_num);
+ // char *PQgetvalue(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQgetlength (IntPtr res,
+ int tup_num, int field_num);
+ // int PQgetlength(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQgetisnull (IntPtr res,
+ int tup_num, int field_num);
+ // int PQgetisnull(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern void PQclear (IntPtr res);
+ // void PQclear(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQmakeEmptyPGresult (IntPtr conn,
+ IntPtr status);
+ // PGresult *PQmakeEmptyPGresult(PGconn *conn,
+ // ExecStatusType status);
+
+ [DllImport("pq")]
+ public static extern void PQprint (IntPtr fout,
+ IntPtr res, IntPtr ps);
+ // void PQprint(FILE *fout,
+ // const PGresult *res, const PQprintOpt *ps);
+
+ [DllImport("pq")]
+ public static extern void PQdisplayTuples (IntPtr res,
+ IntPtr fp, int fillAlign, string fieldSep,
+ int printHeader, int quiet);
+ // void PQdisplayTuples(const PGresult *res,
+ // FILE *fp, int fillAlign, const char *fieldSep,
+ // int printHeader, int quiet);
+
+ [DllImport("pq")]
+ public static extern void PQprintTuples (IntPtr res,
+ IntPtr fout, int printAttName, int terseOutput,
+ int width);
+ // void PQprintTuples(const PGresult *res,
+ // FILE *fout, int printAttName, int terseOutput,
+ // int width);
+
+ [DllImport("pq")]
+ public static extern int lo_open (IntPtr conn,
+ int lobjId, int mode);
+ // int lo_open(PGconn *conn,
+ // Oid lobjId, int mode);
+
+ [DllImport("pq")]
+ public static extern int lo_close (IntPtr conn, int fd);
+ // int lo_close(PGconn *conn, int fd);
+
+ [DllImport("pq")]
+ public static extern int lo_read (IntPtr conn,
+ int fd, string buf, int len);
+ // int lo_read(PGconn *conn,
+ // int fd, char *buf, size_t len);
+
+ [DllImport("pq")]
+ public static extern int lo_write (IntPtr conn,
+ int fd, string buf, int len);
+ // int lo_write(PGconn *conn,
+ // int fd, char *buf, size_t len);
+
+ [DllImport("pq")]
+ public static extern int lo_lseek (IntPtr conn,
+ int fd, int offset, int whence);
+ // int lo_lseek(PGconn *conn,
+ // int fd, int offset, int whence);
+
+ [DllImport("pq")]
+ public static extern int lo_creat (IntPtr conn,
+ int mode);
+ // Oid lo_creat(PGconn *conn,
+ // int mode);
+
+ [DllImport("pq")]
+ public static extern int lo_tell (IntPtr conn, int fd);
+ // int lo_tell(PGconn *conn, int fd);
+
+ [DllImport("pq")]
+ public static extern int lo_unlink (IntPtr conn,
+ int lobjId);
+ // int lo_unlink(PGconn *conn,
+ // Oid lobjId);
+
+ [DllImport("pq")]
+ public static extern int lo_import (IntPtr conn,
+ string filename);
+ // Oid lo_import(PGconn *conn,
+ // const char *filename);
+
+ [DllImport("pq")]
+ public static extern int lo_export (IntPtr conn,
+ int lobjId, string filename);
+ // int lo_export(PGconn *conn,
+ // Oid lobjId, const char *filename);
+
+ [DllImport("pq")]
+ public static extern int PQmblen (string s,
+ int encoding);
+ // int PQmblen(const unsigned char *s,
+ // int encoding);
+
+ [DllImport("pq")]
+ public static extern int PQenv2encoding ();
+ // int PQenv2encoding(void);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs
new file mode 100644
index 00000000000..3cb81e64401
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlClientPermission.cs
@@ -0,0 +1,76 @@
+//
+// System.Data.SqlClient.SqlClientPermission.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+
+ public sealed class SqlClientPermission : DBDataPermission {
+
+ [MonoTODO]
+ public SqlClientPermission() {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public SqlClientPermission(PermissionState state) {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public SqlClientPermission(PermissionState state,
+ bool allowBlankPassword) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Copy() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FromXml(SecurityElement
+ securityElement) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~SqlClientPermission() {
+ // FIXME: destructor to release resources
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs
new file mode 100644
index 00000000000..120ff3f1046
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlClientPermissionAttribute.cs
@@ -0,0 +1,51 @@
+//
+// System.Data.SqlClient.SqlClientPermissionAttribute.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+
+ [AttributeUsage(AttributeTargets.Assembly |
+ AttributeTargets.Class |
+ AttributeTargets.Struct |
+ AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class SqlClientPermissionAttribute :
+ DBDataPermissionAttribute {
+
+ [MonoTODO]
+ [AttributeUsage(AttributeTargets.Assembly |
+ AttributeTargets.Class |
+ AttributeTargets.Struct |
+ AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public SqlClientPermissionAttribute(SecurityAction action) {
+ // FIXME: do constructor
+ }
+
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
+ | AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public override IPermission CreatePermission() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~SqlClientPermissionAttribute() {
+ // FIXME: destructor to release resources
+ }
+ }
+
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs
new file mode 100644
index 00000000000..02151854f49
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommand.cs
@@ -0,0 +1,380 @@
+//
+// System.Data.SqlClient.SqlCommand.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+// use #define DEBUG_SqlCommand if you want to spew debug messages
+// #define DEBUG_SqlCommand
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Xml;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a SQL statement that is executed
+ /// while connected to a SQL database.
+ /// </summary>
+ // public sealed class SqlCommand : Component, IDbCommand, ICloneable
+ public sealed class SqlCommand : IDbCommand
+ {
+ // FIXME: Console.WriteLine() is used for debugging throughout
+
+ #region Fields
+
+ string sql = "";
+ int timeout = 30;
+ // default is 30 seconds
+ // for command execution
+
+ SqlConnection conn = null;
+ SqlTransaction trans = null;
+ CommandType cmdType = CommandType.Text;
+ bool designTime = false;
+ SqlParameterCollection parmCollection = new
+ SqlParameterCollection();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SqlCommand()
+ {
+ sql = "";
+ }
+
+ public SqlCommand (string cmdText)
+ {
+ sql = cmdText;
+ }
+
+ public SqlCommand (string cmdText, SqlConnection connection)
+ {
+ sql = cmdText;
+ conn = connection;
+ }
+
+ public SqlCommand (string cmdText, SqlConnection connection,
+ SqlTransaction transaction)
+ {
+ sql = cmdText;
+ conn = connection;
+ trans = transaction;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public void Cancel ()
+ {
+ // FIXME: use non-blocking Exec for this
+ throw new NotImplementedException ();
+ }
+
+ // FIXME: is this the correct way to return a stronger type?
+ [MonoTODO]
+ IDbDataParameter IDbCommand.CreateParameter ()
+ {
+ return CreateParameter ();
+ }
+
+ [MonoTODO]
+ public SqlParameter CreateParameter ()
+ {
+ return new SqlParameter ();
+ }
+
+ [MonoTODO]
+ public int ExecuteNonQuery ()
+ {
+ IntPtr pgResult; // PGresult
+ int rowsAffected = -1;
+ ExecStatusType execStatus;
+ String rowsAffectedString;
+
+ if(conn.State != ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnnectionState is not Open");
+
+ // FIXME: PQexec blocks
+ // while PQsendQuery is non-blocking
+ // which is better to use?
+ // int PQsendQuery(PGconn *conn,
+ // const char *query);
+
+ // execute SQL command
+ // uses internal property to get the PGConn IntPtr
+ pgResult = PostgresLibrary.
+ PQexec (conn.PostgresConnection, sql);
+
+ execStatus = PostgresLibrary.
+ PQresultStatus (pgResult);
+
+ if(execStatus == ExecStatusType.PGRES_COMMAND_OK)
+ {
+ rowsAffectedString = PostgresLibrary.
+ PQcmdTuples (pgResult);
+#if DEBUG_SqlCommand
+ Console.WriteLine("rowsAffectedString: " +
+ rowsAffectedString);
+#endif // DEBUG_SqlCommand
+ if(rowsAffectedString != null)
+ if(rowsAffectedString.Equals("") == false)
+ rowsAffected = int.Parse(rowsAffectedString);
+ }
+ else
+ {
+ String errorMessage;
+
+ errorMessage = PostgresLibrary.
+ PQresStatus(execStatus);
+
+ errorMessage += " " + PostgresLibrary.
+ PQresultErrorMessage(pgResult);
+
+ throw new SqlException(0, 0,
+ errorMessage, 0, "",
+ conn.DataSource, "SqlCommand", 0);
+ }
+#if DEBUG_SqlCommand
+ String cmdStatus;
+ cmdStatus = PostgresLibrary.
+ PQcmdStatus(pgResult);
+
+ Console.WriteLine("*** Command Status: " +
+ cmdStatus);
+#endif // DEBUG_SqlCommand
+ PostgresLibrary.PQclear (pgResult);
+
+ // FIXME: get number of rows
+ // affected for INSERT, UPDATE, or DELETE
+ // any other, return -1 (such as, CREATE TABLE)
+ return rowsAffected;
+ }
+
+ // FIXME: temporarily commmented out, so I could get a simple working
+ // SqlConnection and SqlCommand. I had to temporarily
+ // comment it out the ExecuteReader in IDbCommand as well.
+ /*
+ [MonoTODO]
+ IDataReader IDbCommand.ExecuteReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ SqlDataReader ExecuteReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ IDataReader IDbCommand.ExecuteReader (
+ CommandBehavior behavior)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlDataReader ExecuteReader (CommandBehavior behavior)
+ {
+ throw new NotImplementedException ();
+ }
+ */
+
+ [MonoTODO]
+ public object ExecuteScalar ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlReader ExecuteXmlReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Prepare ()
+ {
+ // FIXME: parameters have to be implemented for this
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ #region Properties
+
+ public string CommandText {
+ get {
+ return sql;
+ }
+
+ set {
+ sql = value;
+ }
+ }
+
+ public int CommandTimeout {
+ get {
+ return timeout;
+ }
+
+ set {
+ // FIXME: if value < 0, throw
+ // ArgumentException
+ // if (value < 0)
+ // throw ArgumentException;
+ timeout = value;
+ }
+ }
+
+ public CommandType CommandType {
+ get {
+ return cmdType;
+ }
+
+ set {
+ cmdType = value;
+ }
+ }
+
+ // FIXME: for property Connection, is this the correct
+ // way to handle a return of a stronger type?
+ IDbConnection IDbCommand.Connection {
+ get {
+ return Connection;
+ }
+
+ set {
+ // FIXME: throw an InvalidOperationException
+ // if the change was during a
+ // transaction in progress
+
+ // csc
+ Connection = (SqlConnection) value;
+ // mcs
+ // Connection = value;
+
+ // FIXME: set Transaction property to null
+ }
+ }
+
+ public SqlConnection Connection {
+ get {
+ // conn defaults to null
+ return conn;
+ }
+
+ set {
+ // FIXME: throw an InvalidOperationException
+ // if the change was during
+ // a transaction in progress
+ conn = value;
+ // FIXME: set Transaction property to null
+ }
+ }
+
+ public bool DesignTimeVisible {
+ get {
+ return designTime;
+ }
+
+ set{
+ designTime = value;
+ }
+ }
+
+ // FIXME; for property Parameters, is this the correct
+ // way to handle a stronger return type?
+ IDataParameterCollection IDbCommand.Parameters {
+ get {
+ return Parameters;
+ }
+ }
+
+ SqlParameterCollection Parameters {
+ get {
+ return parmCollection;
+ }
+ }
+
+ // FIXME: for property Transaction, is this the correct
+ // way to handle a return of a stronger type?
+ IDbTransaction IDbCommand.Transaction {
+ get {
+ return Transaction;
+ }
+
+ set {
+ // FIXME: error handling - do not allow
+ // setting of transaction if transaction
+ // has already begun
+
+ // csc
+ Transaction = (SqlTransaction) value;
+ // mcs
+ // Transaction = value;
+ }
+ }
+
+ public SqlTransaction Transaction {
+ get {
+ return trans;
+ }
+
+ set {
+ // FIXME: error handling
+ trans = value;
+ }
+ }
+
+ [MonoTODO]
+ public UpdateRowSource UpdatedRowSource {
+ // FIXME: do this once DbDataAdaptor
+ // and DataRow are done
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Destructors
+
+ [MonoTODO]
+ public void Dispose() {
+ // FIXME: need proper way to release resources
+ // Dispose(true);
+ }
+
+ [MonoTODO]
+ ~SqlCommand()
+ {
+ // FIXME: need proper way to release resources
+ // Dispose(false);
+ }
+
+ #endregion //Destructors
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs
new file mode 100644
index 00000000000..d2b028bc652
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlCommandBuilder.cs
@@ -0,0 +1,103 @@
+//
+// System.Data.SqlClient.SqlCommandBuilder.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.ComponentModel;
+
+namespace System.Data.SqlClient {
+
+ /// <summary>
+ /// Builder of one command
+ /// that will be used in manipulating a table for
+ /// a DataSet that is assoicated with a database.
+ /// </summary>
+ public sealed class SqlCommandBuilder : Component {
+
+ [MonoTODO]
+ public SqlCommandBuilder() {
+
+ }
+
+ [MonoTODO]
+ public SqlCommandBuilder(SqlDataAdapter adapter) {
+
+ }
+
+ [MonoTODO]
+ public SqlDataAdapter DataAdapter {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string QuotePrefix {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string QuoteSuffix {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static void DeriveParameters(SqlCommand command) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand GetDeleteCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand GetInsertCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand GetUpdateCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RefreshSchema() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose(bool disposing) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~SqlCommandBuilder() {
+ // FIXME: create destructor - release resources
+ }
+ }
+}
+
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlConnection.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlConnection.cs
new file mode 100644
index 00000000000..9b0ab2280f9
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlConnection.cs
@@ -0,0 +1,528 @@
+//
+// System.Data.SqlClient.SqlConnection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+// use #define DEBUG_SqlConnection if you want to spew debug messages
+// #define DEBUG_SqlConnection
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace System.Data.SqlClient
+{
+ // using PGconn = IntPtr;
+ // PGconn is native C library type in libpq for Postgres Connection
+
+ // using PGressult = IntPtr;
+ // PGresult is native C library type in libpq for Postgres Resultset
+
+ /// <summary>
+ /// Represents an open connection to a SQL data source
+ /// </summary>
+ //public sealed class SqlConnection : Component, IDbConnection,
+ // ICloneable
+ public sealed class SqlConnection : IDbConnection
+ {
+ // FIXME: Need to implement class Component,
+ // and interfaces: ICloneable and IDisposable
+
+ #region Fields
+
+ private IntPtr pgConn = IntPtr.Zero;
+ // PGConn (Postgres Connection)
+ private string connectionString = "";
+ // OLE DB Connection String
+ private string pgConnectionString = "";
+ // PostgreSQL Connection String
+ private SqlTransaction trans = null;
+ private int connectionTimeout = 15;
+ // default for 15 seconds
+
+ // connection parameters in connection string
+ private string host = "";
+ // Name of host to connect to
+ private string hostaddr = "";
+ // IP address of host to connect to
+ // should be in "n.n.n.n" format
+ private string port = "";
+ // Port number to connect to at the server host
+ private string dbname = ""; // The database name.
+ private string user = ""; // User name to connect as.
+ private string password = "";
+ // Password to be used if the server
+ // demands password authentication.
+ private string options = "";
+ // Trace/debug options to be sent to the server.
+ private string tty = "";
+ // A file or tty for optional
+ // debug output from the backend.
+ private string requiressl = "";
+ // Set to 1 to require
+ // SSL connection to the backend.
+ // Libpq will then refuse to connect
+ // if the server does not
+ // support SSL. Set to 0 (default) to
+ // negotiate with server.
+
+ ConnectionState conState = ConnectionState.Closed;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ /*
+ [MonoTODO]
+ public SqlConnection ()
+ {
+ this.ConnectionString = null;
+ this.ConnectionTimeout = 0;
+ this.Database = null;
+ this.State = 0;
+ }
+
+ [MonoTODO]
+ public SqlConnection (string cs) : SqlConnection ()
+ {
+ this.ConnectionString = cs;
+ }
+
+ */
+ // A lot of the defaults were initialized in the Fields
+ [MonoTODO]
+ public SqlConnection ()
+ {
+
+ }
+
+ [MonoTODO]
+ public SqlConnection (String connectionString)
+ {
+ SetConnectionString (connectionString);
+ }
+
+ #endregion // Constructors
+
+ #region Destructors
+
+ [MonoTODO]
+ public void Dispose () {
+ // FIXME: release resources properly
+ Close ();
+ // Dispose (true);
+ }
+
+ // aka Finalize
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ [MonoTODO]
+ ~SqlConnection()
+ {
+ // FIXME: this class need
+ // a destructor to release resources
+ // Also, take a look at Dispose
+ // Dispose (false);
+ }
+
+ #endregion // Destructors
+
+ #region Public Methods
+
+ IDbTransaction IDbConnection.BeginTransaction ()
+ {
+ return BeginTransaction ();
+ }
+
+ public SqlTransaction BeginTransaction ()
+ {
+ return TransactionBegin (); // call private method
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction (IsolationLevel
+ il)
+ {
+ return BeginTransaction (il);
+ }
+
+ public SqlTransaction BeginTransaction (IsolationLevel il)
+ {
+ return TransactionBegin (il); // call private method
+ }
+
+ // PostgreSQL does not support named transactions/savepoint
+ // nor nested transactions
+ [Obsolete]
+ public SqlTransaction BeginTransaction(string transactionName) {
+ return TransactionBegin (); // call private method
+ }
+
+ [Obsolete]
+ public SqlTransaction BeginTransaction(IsolationLevel iso,
+ string transactionName) {
+ return TransactionBegin (iso); // call private method
+ }
+
+ [MonoTODO]
+ public void ChangeDatabase (string databaseName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Close ()
+ {
+ CloseDataSource ();
+ }
+
+ IDbCommand IDbConnection.CreateCommand ()
+ {
+ return CreateCommand ();
+ }
+
+ public SqlCommand CreateCommand ()
+ {
+ SqlCommand sqlcmd = new SqlCommand ("", this);
+
+ return sqlcmd;
+ }
+
+ [MonoTODO]
+ public void Open ()
+ {
+ OpenDataSource ();
+ }
+
+ #endregion // Public Methods
+
+ #region Internal Methods
+
+ // this is for System.Data.SqlClient classes
+ // to get the Postgres connection
+ internal IntPtr PostgresConnection {
+ get {
+ return pgConn;
+ }
+ }
+
+ #endregion // Internal Methods
+
+ #region Protected Methods
+
+ // FIXME: protected override void Dispose overrides Component
+ // however, including Component causes other problems
+ /*
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+ */
+
+ #endregion
+
+ #region Private Methods
+
+ private void OpenDataSource ()
+ {
+ if(dbname.Equals(""))
+ throw new InvalidOperationException(
+ "dbname missing");
+ else if(conState == ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnnectionState is already Open");
+
+ ConnStatusType connStatus;
+
+ // FIXME: check to make sure we have
+ // everything to connect,
+ // otherwise, throw an exception
+
+ pgConn = PostgresLibrary.PQconnectdb
+ (pgConnectionString);
+
+ // FIXME: should we use PQconnectStart/PQconnectPoll
+ // instead of PQconnectdb?
+ // PQconnectdb blocks
+ // PQconnectStart/PQconnectPoll is non-blocking
+
+ connStatus = PostgresLibrary.PQstatus (pgConn);
+ if(connStatus == ConnStatusType.CONNECTION_OK)
+ {
+ // Successfully Connected
+ conState = ConnectionState.Open;
+ }
+ else
+ {
+ String errorMessage = PostgresLibrary.
+ PQerrorMessage (pgConn);
+ errorMessage += ": Could not connect to database.";
+
+ throw new SqlException(0, 0,
+ errorMessage, 0, "",
+ host, "SqlConnection", 0);
+ }
+ }
+
+ private void CloseDataSource ()
+ {
+ // FIXME: just a quick hack
+ conState = ConnectionState.Closed;
+ PostgresLibrary.PQfinish (pgConn);
+ }
+
+ private void SetConnectionString (string connectionString)
+ {
+ // FIXME: perform error checking on string
+ // while translating string from
+ // OLE DB format to PostgreSQL
+ // connection string format
+ //
+ // OLE DB: "host=localhost;dbname=test;user=joe;password=smoe"
+ // PostgreSQL: "host=localhost dbname=test user=joe password=smoe"
+ //
+ // For OLE DB, you would have the additional
+ // "provider=postgresql"
+ // OleDbConnection you would be using libgda, maybe
+ // it would be
+ // "provider=OAFIID:GNOME_Database_Postgres_Provider"
+ // instead.
+ //
+ // Also, parse the connection string into properties
+
+ // FIXME: if connection is open, you can
+ // not set the connection
+ // string, throw an exception
+
+ this.connectionString = connectionString;
+ pgConnectionString = ConvertStringToPostgres (
+ connectionString);
+
+#if DEBUG_SqlConnection
+ Console.WriteLine(
+ "OLE-DB Connection String [in]: " +
+ this.ConnectionString);
+ Console.WriteLine(
+ "Postgres Connection String [out]: " +
+ pgConnectionString);
+#endif // DEBUG_SqlConnection
+ }
+
+ private String ConvertStringToPostgres (String
+ oleDbConnectionString)
+ {
+ StringBuilder postgresConnection =
+ new StringBuilder();
+ string result;
+ string[] connectionParameters;
+
+ char[] semicolon = new Char[1];
+ semicolon[0] = ';';
+
+ // FIXME: what is the max number of value pairs
+ // can there be for the OLE DB
+ // connnection string? what about libgda max?
+ // what about postgres max?
+
+ // FIXME: currently assuming value pairs are like:
+ // "key1=value1;key2=value2;key3=value3"
+ // Need to deal with values that have
+ // single or double quotes. And error
+ // handling of that too.
+ // "key1=value1;key2='value2';key=\"value3\""
+
+ // FIXME: put the connection parameters
+ // from the connection
+ // string into a
+ // Hashtable (System.Collections)
+ // instead of using private variables
+ // to store them
+ connectionParameters = oleDbConnectionString.
+ Split (semicolon);
+ foreach (string sParameter in connectionParameters) {
+ if(sParameter.Length > 0) {
+ BreakConnectionParameter (sParameter);
+ postgresConnection.
+ Append (sParameter +
+ " ");
+ }
+ }
+ result = postgresConnection.ToString ();
+ return result;
+ }
+
+ private bool BreakConnectionParameter (String sParameter)
+ {
+ bool addParm = true;
+ int index;
+
+ index = sParameter.IndexOf ("=");
+ if (index > 0) {
+ string parmKey, parmValue;
+
+ // separate string "key=value" to
+ // string "key" and "value"
+ parmKey = sParameter.Substring (0, index);
+ parmValue = sParameter.Substring (index + 1,
+ sParameter.Length - index - 1);
+
+ switch(parmKey.ToLower()) {
+ case "hostaddr":
+ hostaddr = parmValue;
+ break;
+
+ case "port":
+ port = parmValue;
+ break;
+
+ case "host":
+ // set DataSource property
+ host = parmValue;
+ break;
+
+ case "dbname":
+ // set Database property
+ dbname = parmValue;
+ break;
+
+ case "user":
+ user = parmValue;
+ break;
+
+ case "password":
+ password = parmValue;
+ // addParm = false;
+ break;
+
+ case "options":
+ options = parmValue;
+ break;
+
+ case "tty":
+ tty = parmValue;
+ break;
+
+ case "requiressl":
+ requiressl = parmValue;
+ break;
+ }
+ }
+ return addParm;
+ }
+
+ private SqlTransaction TransactionBegin ()
+ {
+ // FIXME: need to keep track of
+ // transaction in-progress
+ trans = new SqlTransaction ();
+ // using internal methods of SqlTransaction
+ trans.SetConnection (this);
+ trans.Begin();
+
+ return trans;
+ }
+
+ private SqlTransaction TransactionBegin (IsolationLevel il)
+ {
+ // FIXME: need to keep track of
+ // transaction in-progress
+ TransactionBegin();
+ trans.SetIsolationLevel (il);
+
+ return trans;
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public ConnectionState State {
+ get {
+ return conState;
+ }
+ }
+
+ public string ConnectionString {
+ get {
+ return connectionString;
+ }
+ set {
+ SetConnectionString (value);
+ }
+ }
+
+ public int ConnectionTimeout {
+ get {
+ return connectionTimeout;
+ }
+ }
+
+ public string Database {
+ get {
+ return dbname;
+ }
+ }
+
+ public string DataSource {
+ get {
+ return host;
+ }
+ }
+
+ /*
+ * FIXME: this is here because of Component?
+ [MonoTODO]
+ protected bool DesignMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ */
+ public int PacketSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public string ServerVersion {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ internal SqlTransaction Transaction {
+ get {
+ return trans;
+ }
+ }
+
+ #endregion
+
+ #region Events and Delegates
+
+ // FIXME: the two events belong here
+ // however, i do not know about the delegates
+ // also, they are stubs for now
+ /*
+ public delegate void
+ SqlInfoMessageEventHandler (object sender,
+ SqlInfoMessageEventArgs e);
+
+ public event
+ SqlInfoMessageEventHandler InfoMessage;
+
+ public event
+ StateChangeEventHandler StateChange;
+ */
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs
new file mode 100644
index 00000000000..e30bc74677b
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataAdapter.cs
@@ -0,0 +1,231 @@
+//
+// System.Data.SqlClient.SqlDataAdapter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a set of command-related properties that are used
+ /// to fill the DataSet and update a data source, all this
+ /// from a SQL database.
+ /// </summary>
+ public sealed class SqlDataAdapter : DbDataAdapter, IDbDataAdapter
+ {
+ #region Properties
+
+ [MonoTODO]
+ public SqlCommand DeleteCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public SqlCommand InsertCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public SqlCommand SelectCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public SqlCommand UpdateCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override int Fill(DataSet dataSet) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill(DataTable dataTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill(DataSet dataSet, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataTable dataTable,
+ IDataReader dataReader) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataTable dataTable,
+ IDbCommand command,
+ CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill(DataSet dataSet, int startRecord,
+ int maxRecords, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataSet dataSet,
+ string srcTable, IDataReader dataReader,
+ int startRecord, int maxRecords) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataSet dataSet,
+ int startRecord, int maxRecords,
+ string srcTable, IDbCommand command,
+ CommandBehavior behavior) {
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override DataTable[] FillSchema(DataSet dataSet,
+ SchemaType schemaType) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable FillSchema(DataTable dataTable,
+ SchemaType schemaType) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable[] FillSchema(DataSet dataSet,
+ SchemaType schemaType, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual DataTable FillSchema(DataTable dataTable,
+ SchemaType schemaType, IDbCommand command,
+ CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual DataTable[] FillSchema(DataSet dataSet,
+ SchemaType schemaType, IDbCommand command,
+ string srcTable, CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IDataParameter[] GetFillParameters() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update(DataRow[] dataRows) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int Update(DataSet dataSet) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update(DataTable dataTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Update(DataRow[] dataRows,
+ DataTableMapping tableMapping) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update(DataSet dataSet, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override RowUpdatedEventArgs CreateRowUpdatedEvent(
+ DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override RowUpdatingEventArgs CreateRowUpdatingEvent(
+ DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnFillError(FillErrorEventArgs value) {
+ throw new NotImplementedException ();
+ }
+
+ protected override void OnRowUpdated(RowUpdatedEventArgs value) {
+ throw new NotImplementedException ();
+ }
+
+ protected override void OnRowUpdating(RowUpdatingEventArgs value) {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ public event FillErrorEventHandler FillError;
+
+ public event SqlRowUpdatedEventHandler RowUpdated;
+
+ public event SqlRowUpdatingEventHandler RowUpdating;
+
+ #endregion // Events and Delegates
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs
new file mode 100644
index 00000000000..f9d1f2bfe76
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlDataReader.cs
@@ -0,0 +1,263 @@
+//
+// System.Data.SqlClient.SqlDataReader.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Provides a means of reading one or more forward-only streams
+ /// of result sets obtained by executing a command
+ /// at a SQL database.
+ /// </summary>
+ //public sealed class SqlDataReader : MarshalByRefObject,
+ // IEnumerable, IDataReader, IDisposable, IDataRecord
+ public sealed class SqlDataReader : IEnumerable,
+ IDataReader, IDataRecord
+ {
+ #region Fields
+
+ DataTable tableSchema;
+ DataTable tableRow;
+
+ #endregion // Fields
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void Close()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable GetSchemaTable()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool NextResult()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Read()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public byte GetByte(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetBytes(int i, long fieldOffset,
+ byte[] buffer, int bufferOffset,
+ int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public char GetChar(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetChars(int i, long fieldOffset,
+ char[] buffer, int bufferOffset,
+ int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IDataReader GetData(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetDataTypeName(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DateTime GetDateTime(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public decimal GetDecimal(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public double GetDouble(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Type GetFieldType(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public float GetFloat(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Guid GetGuid(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public short GetInt16(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetInt32(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetInt64(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetName(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetOrdinal(string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetString(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetValue(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetValues(object[] values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsDBNull(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool GetBoolean(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Public Methods
+
+ #region // Destructors
+
+ [MonoTODO]
+ public void Dispose () {
+ }
+
+ [MonoTODO]
+ ~SqlDataReader() {
+ }
+
+ #endregion // Destructors
+
+
+ #region Properties
+
+ public int Depth {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool IsClosed {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int RecordsAffected {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int FieldCount {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public object this[string name] {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public object this[int i] {
+ [MonoTODO]
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlError.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlError.cs
new file mode 100644
index 00000000000..e7c722285a9
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlError.cs
@@ -0,0 +1,155 @@
+//
+// System.Data.SqlClient.SqlError.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Describes an error from a SQL database.
+ /// </summary>
+ [MonoTODO]
+ public sealed class SqlError
+ {
+ byte theClass = 0;
+ int lineNumber = 0;
+ string message = "";
+ int number = 0;
+ string procedure = "";
+ string server = "";
+ string source = "";
+ byte state = 0;
+
+ internal SqlError(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+ this.theClass = theClass;
+ this.lineNumber = lineNumber;
+ this.message = message;
+ this.number = number;
+ this.procedure = procedure;
+ this.server = server;
+ this.source = source;
+ this.state = state;
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ /// <summary>
+ /// severity level of the error
+ /// </summary>
+ public byte Class {
+ get {
+ return theClass;
+ }
+ }
+
+ [MonoTODO]
+ public int LineNumber {
+ get {
+ return lineNumber;
+ }
+ }
+
+ [MonoTODO]
+ public string Message {
+ get {
+ return message;
+ }
+ }
+
+ [MonoTODO]
+ public int Number {
+ get {
+ return number;
+ }
+ }
+
+ [MonoTODO]
+ public string Procedure {
+ get {
+ return procedure;
+ }
+ }
+
+ [MonoTODO]
+ public string Server {
+ get {
+ return server;
+ }
+ }
+
+ [MonoTODO]
+ public string Source {
+ get {
+ return source;
+ }
+ }
+
+ [MonoTODO]
+ public byte State {
+ get {
+ return state;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ String toStr;
+ String stackTrace;
+ stackTrace = " <Stack Trace>";
+ // FIXME: generate the correct SQL error string
+ toStr = "SqlError:" + message + stackTrace;
+ return toStr;
+ }
+
+ internal void SetClass(byte theClass) {
+ this.theClass = theClass;
+ }
+
+ internal void SetLineNumber(int lineNumber) {
+ this.lineNumber = lineNumber;
+ }
+
+ internal void SetMessage(string message) {
+ this.message = message;
+ }
+
+ internal void SetNumber(int number) {
+ this.number = number;
+ }
+
+ internal void SetProcedure(string procedure) {
+ this.procedure = procedure;
+ }
+
+ internal void SetServer(string server) {
+ this.server = server;
+ }
+
+ internal void SetSource(string source) {
+ this.source = source;
+ }
+
+ internal void SetState(byte state) {
+ this.state = state;
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs
new file mode 100644
index 00000000000..7050d5d08fa
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlErrorCollection.cs
@@ -0,0 +1,114 @@
+//
+// System.Data.SqlClient.SqlError.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+using System;
+using System.Collections;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Describes an error from a SQL database.
+ /// </summary>
+ [MonoTODO]
+ public sealed class SqlErrorCollection : ICollection, IEnumerable
+ {
+ ArrayList errorList = new ArrayList();
+
+ internal SqlErrorCollection() {
+ }
+
+ internal SqlErrorCollection(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ Add (theClass, lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ public int Count {
+ get {
+ return errorList.Count;
+ }
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index) {
+ throw new NotImplementedException ();
+ }
+
+ // [MonoTODO]
+ bool ICollection.IsSynchronized {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // [MonoTODO]
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+
+ // Index property (indexer)
+ // [MonoTODO]
+ public SqlError this[int index] {
+ get {
+ return (SqlError) errorList[index];
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ internal void Add(SqlError error) {
+ errorList.Add(error);
+ }
+
+ internal void Add(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ SqlError error = new SqlError(theClass,
+ lineNumber, message,
+ number, procedure,
+ server, source, state);
+ Add(error);
+ }
+
+ #region Destructors
+
+ [MonoTODO]
+ ~SqlErrorCollection()
+ {
+ // FIXME: do the destructor - release resources
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlException.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlException.cs
new file mode 100644
index 00000000000..89983847d55
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlException.cs
@@ -0,0 +1,202 @@
+//
+// System.Data.SqlClient.SqlException.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc
+//
+using System;
+using System.Data;
+using System.Runtime.Serialization;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Exceptions, as returned by SQL databases.
+ /// </summary>
+ public sealed class SqlException : SystemException
+ {
+ private SqlErrorCollection errors;
+
+ internal SqlException() {
+ errors = new SqlErrorCollection();
+ }
+
+ internal SqlException(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ errors = new SqlErrorCollection (theClass,
+ lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ public byte Class {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception here?
+ else
+ return errors[0].Class;
+ }
+
+ set {
+ errors[0].SetClass(value);
+ }
+ }
+
+ [MonoTODO]
+ public SqlErrorCollection Errors {
+ get {
+ return errors;
+ }
+
+ set {
+ errors = value;
+ }
+ }
+
+ [MonoTODO]
+ public int LineNumber {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception here?
+ return errors[0].LineNumber;
+ }
+
+ set {
+ errors[0].SetLineNumber(value);
+ }
+ }
+
+ [MonoTODO]
+ public override string Message {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else {
+ String msg = "";
+ int i = 0;
+
+ for(i = 0; i < errors.Count - 1; i++) {
+ msg = msg + errors[i].Message + "\n";
+ }
+ msg = msg + errors[i].Message;
+
+ return msg;
+ }
+ }
+ }
+
+ [MonoTODO]
+ public int Number {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception?
+ else
+ return errors[0].Number;
+ }
+
+ set {
+ errors[0].SetNumber(value);
+ }
+ }
+
+ [MonoTODO]
+ public string Procedure {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Procedure;
+ }
+
+ set {
+ errors[0].SetProcedure(value);
+ }
+ }
+
+ [MonoTODO]
+ public string Server {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Server;
+ }
+
+ set {
+ errors[0].SetServer(value);
+ }
+ }
+
+ [MonoTODO]
+ public override string Source {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Source;
+ }
+
+ set {
+ errors[0].SetSource(value);
+ }
+ }
+
+ [MonoTODO]
+ public byte State {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception?
+ else
+ return errors[0].State;
+ }
+
+ set {
+ errors[0].SetState(value);
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void GetObjectData(SerializationInfo si,
+ StreamingContext context) {
+ // FIXME: to do
+ }
+
+ // [Serializable]
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ public override string ToString() {
+ String toStr = "";
+ for (int i = 0; i < errors.Count; i++) {
+ toStr = toStr + errors[i].ToString() + "\n";
+ }
+ return toStr;
+ }
+
+ internal void Add(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ errors.Add (theClass, lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ [MonoTODO]
+ ~SqlException() {
+ // FIXME: destructor to release resources
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs
new file mode 100644
index 00000000000..67eaba58482
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Data.SqlClient.SqlInfoMessageEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public sealed class SqlInfoMessageEventArgs : EventArgs
+ {
+ [MonoTODO]
+ public SqlErrorCollection Errors {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string Message
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string Source {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ // representation of InfoMessage event
+ }
+
+ [MonoTODO]
+ ~SqlInfoMessageEventArgs() {
+ // FIXME: destructor needs to release resources
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs
new file mode 100644
index 00000000000..c9862d61c03
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlInfoMessageEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Data.SqlClient.SqlInfoMessageEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public delegate void
+ SqlInfoMessageEventHandler (object sender,
+ SqlInfoMessageEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlParameter.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlParameter.cs
new file mode 100644
index 00000000000..31f500ffdff
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlParameter.cs
@@ -0,0 +1,196 @@
+//
+// System.Data.SqlClient.SqlParameter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a parameter to a Command object, and optionally,
+ /// its mapping to DataSet columns; and is implemented by .NET
+ /// data providers that access data sources.
+ /// </summary>
+ //public sealed class SqlParameter : MarshalByRefObject,
+ // IDbDataParameter, IDataParameter, ICloneable
+ public sealed class SqlParameter : IDbDataParameter, IDataParameter
+ {
+ [MonoTODO]
+ public SqlParameter () {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter (string parameterName, object value) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType,
+ int size) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType,
+ int size, string sourceColumn) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType,
+ int size, ParameterDirection direction,
+ bool isNullable, byte precision,
+ byte scale, string sourceColumn,
+ DataRowVersion sourceVersion, object value) {
+ // FIXME: do this
+ }
+
+
+ [MonoTODO]
+ public DbType DbType {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public ParameterDirection Direction {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool IsNullable {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int Offset {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string ParameterName {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string SourceColumn {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public DataRowVersion SourceVersion {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public SqlDbType SqlDbType {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public object Value {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public byte Precision {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public byte Scale {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int Size
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs
new file mode 100644
index 00000000000..7b665dd0b1e
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlParameterCollection.cs
@@ -0,0 +1,231 @@
+//
+// System.Data.SqlClient.SqlParameterCollection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Collections;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Collects all parameters relevant to a Command object
+ /// and their mappings to DataSet columns.
+ /// </summary>
+ // public sealed class SqlParameterCollection : MarshalByRefObject,
+ // IDataParameterCollection, IList, ICollection, IEnumerable
+ public sealed class SqlParameterCollection : IDataParameterCollection
+ {
+ [MonoTODO]
+ public void RemoveAt(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // [MonoTODO]
+ public object this[string parameterName]
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Add( object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(SqlParameter value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName, SqlDbType sqlDbType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName,
+ SqlDbType sqlDbType, int size)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName,
+ SqlDbType sqlDbType, int size, string sourceColumn)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+/*
+ [MonoTODO]
+ public bool Contains(string value)
+ {
+ throw new NotImplementedException ();
+ }
+
+*/
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(object value)
+ {
+ throw new NotImplementedException ();
+ }
+/*
+ [MonoTODO]
+ public int IndexOf(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+*/
+ [MonoTODO]
+ public void Insert(int index, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+/*
+ [MonoTODO]
+ public void RemoveAt(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+*/
+/*
+ [MonoTODO]
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDual)]
+ ~SqlParameterCollection();
+*/
+
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // [MonoTODO]
+ object IList.this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // [MonoTODO]
+ public SqlParameter this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+/*
+ [MonoTODO]
+ public SqlParameter this[string parameterName] {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+*/
+
+ bool IList.IsFixedSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool IList.IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs
new file mode 100644
index 00000000000..6c561ba14da
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventArgs.cs
@@ -0,0 +1,38 @@
+//
+// System.Data.SqlClient.SqlRowUpdatedEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+ public sealed class SqlRowUpdatedEventArgs : RowUpdatedEventArgs {
+
+ [MonoTODO]
+ public SqlRowUpdatedEventArgs (DataRow row,
+ IDbCommand command, StatementType statementType,
+ DataTableMapping tableMapping) {
+ // FIXME: do the constructor
+ }
+
+ [MonoTODO]
+ public new SqlCommand Command {
+ get {
+
+ }
+ }
+
+ [MonoTODO]
+ ~SqlRowUpdatedEventArgs () {
+ // FIXME: need destructor to release resources
+ }
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs
new file mode 100644
index 00000000000..8cad2f1cbca
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.SqlClient.SqlRowUpdatedEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public delegate void SqlRowUpdatedEventHandler(object sender,
+ SqlRowUpdatedEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs
new file mode 100644
index 00000000000..2390374899b
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventArgs.cs
@@ -0,0 +1,42 @@
+//
+// System.Data.SqlClient.SqlRowUpdatingEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient
+{
+ public sealed class SqlRowUpdatingEventArgs : RowUpdatingEventArgs
+ {
+ [MonoTODO]
+ public SqlRowUpdatingEventArgs( DataRow row,
+ IDbCommand command, StatementType statementType,
+ DataTableMapping tableMapping) {
+ // FIXME: do the constructor
+ }
+
+ [MonoTODO]
+ public new SqlCommand Command {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ ~SqlRowUpdatingEventArgs() {
+ // FIXME: create destructor to release resources
+ }
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs
new file mode 100644
index 00000000000..69c0228534d
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlRowUpdatingEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.SqlClient.SqlRowUpdatingEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public delegate void SqlRowUpdatingEventHandler(object sender,
+ SqlRowUpdatingEventArgs e);
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs
new file mode 100644
index 00000000000..3a485b299c5
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PgSqlTransaction.cs
@@ -0,0 +1,191 @@
+//
+// System.Data.SqlClient.SqlTransaction.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+// use #define DEBUG_SqlTransaction if you want to spew debug messages
+// #define DEBUG_SqlTransaction
+
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a transaction to be performed on a SQL database.
+ /// </summary>
+ // public sealed class SqlTransaction : MarshalByRefObject,
+ // IDbTransaction, IDisposable
+ public sealed class SqlTransaction : IDbTransaction
+ {
+ #region Fields
+
+ private bool doingTransaction = false;
+ private SqlConnection conn = null;
+ private IsolationLevel isolationLevel =
+ IsolationLevel.ReadCommitted;
+ // There are only two IsolationLevel's for PostgreSQL:
+ // ReadCommitted and Serializable,
+ // but ReadCommitted is the default
+
+ #endregion
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void Commit ()
+ {
+ if(doingTransaction == false)
+ throw new InvalidOperationException(
+ "Begin transaction was not " +
+ "done earlier " +
+ "thus PostgreSQL can not " +
+ "Commit transaction.");
+
+ SqlCommand cmd = new SqlCommand("COMMIT", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = false;
+ }
+
+ [MonoTODO]
+ public void Rollback()
+ {
+ if(doingTransaction == false)
+ throw new InvalidOperationException(
+ "Begin transaction was not " +
+ "done earlier " +
+ "thus PostgreSQL can not " +
+ "Rollback transaction.");
+
+ SqlCommand cmd = new SqlCommand("ROLLBACK", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = false;
+ }
+
+ // For PostgreSQL, Rollback(string) will not be implemented
+ // because PostgreSQL does not support Savepoints
+ [Obsolete]
+ public void Rollback(string transactionName) {
+ // throw new NotImplementedException ();
+ Rollback();
+ }
+
+ // For PostgreSQL, Save(string) will not be implemented
+ // because PostgreSQL does not support Savepoints
+ [Obsolete]
+ public void Save (string savePointName) {
+ // throw new NotImplementedException ();
+ }
+
+ #endregion // Public Methods
+
+ #region Internal Methods to System.Data.dll Assembly
+
+ internal void Begin()
+ {
+ if(doingTransaction == true)
+ throw new InvalidOperationException(
+ "Transaction has begun " +
+ "and PostgreSQL does not " +
+ "support nested transactions.");
+
+ SqlCommand cmd = new SqlCommand("BEGIN", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = true;
+ }
+
+ internal void SetIsolationLevel(IsolationLevel isoLevel)
+ {
+ String sSql = "SET TRANSACTION ISOLATION LEVEL ";
+
+ switch (isoLevel)
+ {
+ case IsolationLevel.ReadCommitted:
+ sSql += "READ COMMITTED";
+ break;
+
+ case IsolationLevel.Serializable:
+ sSql += "SERIALIZABLE";
+ break;
+
+ default:
+ // FIXME: generate exception here
+ // PostgreSQL only supports:
+ // ReadCommitted or Serializable
+ break;
+ }
+ SqlCommand cmd = new SqlCommand(sSql, conn);
+ cmd.ExecuteNonQuery();
+
+ this.isolationLevel = isoLevel;
+ }
+
+ internal void SetConnection(SqlConnection connection)
+ {
+ this.conn = connection;
+ }
+
+ #endregion // Internal Methods to System.Data.dll Assembly
+
+ #region Properties
+
+ IDbConnection IDbTransaction.Connection {
+ get {
+ return Connection;
+ }
+ }
+
+ public SqlConnection Connection {
+ get {
+ return conn;
+ }
+ }
+
+ public IsolationLevel IsolationLevel {
+ get {
+ return isolationLevel;
+ }
+ }
+
+ internal bool DoingTransaction {
+ get {
+ return doingTransaction;
+ }
+ }
+
+ #endregion Properties
+
+ #region Destructors
+
+ // Destructors aka Finalize and Dispose
+
+ [MonoTODO]
+ public void Dispose()
+ {
+ // FIXME: need to properly release resources
+ // Dispose(true);
+ }
+
+ // Destructor
+ [MonoTODO]
+ // [Serializable]
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ ~SqlTransaction() {
+ // FIXME: need to properly release resources
+ // Dispose(false);
+ }
+
+ #endregion // Destructors
+
+ }
+}
diff --git a/mcs/class/Mono.Data.PostgreSqlClient/PostgresLibrary.cs b/mcs/class/Mono.Data.PostgreSqlClient/PostgresLibrary.cs
new file mode 100644
index 00000000000..770f268763a
--- /dev/null
+++ b/mcs/class/Mono.Data.PostgreSqlClient/PostgresLibrary.cs
@@ -0,0 +1,471 @@
+//
+// System.Data.SqlClient.PostgresLibrary.cs
+//
+// PInvoke methods to libpq
+// which is PostgreSQL client library
+//
+// May also contain enumerations,
+// data types, or wrapper methods.
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+
+namespace System.Data.SqlClient
+{
+ /* IMPORTANT: DO NOT CHANGE ANY OF THESE ENUMS */
+
+ internal enum ConnStatusType
+ {
+ CONNECTION_OK,
+ CONNECTION_BAD,
+ CONNECTION_STARTED,
+ CONNECTION_MADE,
+ CONNECTION_AWAITING_RESPONSE,
+ CONNECTION_AUTH_OK,
+ CONNECTION_SETENV
+ }
+
+ internal enum PostgresPollingStatusType
+ {
+ PGRES_POLLING_FAILED = 0,
+ PGRES_POLLING_READING,
+ PGRES_POLLING_WRITING,
+ PGRES_POLLING_OK,
+ PGRES_POLLING_ACTIVE
+ }
+
+ internal enum ExecStatusType
+ {
+ PGRES_EMPTY_QUERY = 0,
+ PGRES_COMMAND_OK,
+ PGRES_TUPLES_OK,
+ PGRES_COPY_OUT,
+ PGRES_COPY_IN,
+ PGRES_BAD_RESPONSE,
+ PGRES_NONFATAL_ERROR,
+ PGRES_FATAL_ERROR
+ }
+
+ sealed internal class PostgresLibrary
+ {
+ #region PInvoke Functions
+
+ // pinvoke prototypes to PostgreSQL client library
+ // pq.dll on windows and libpq.so on linux
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconnectStart (string conninfo);
+ // PGconn *PQconnectStart(const char *conninfo);
+
+ [DllImport("pq")]
+ public static extern PostgresPollingStatusType PQconnectPoll (IntPtr conn);
+ // PostgresPollingStatusType PQconnectPoll(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconnectdb (string conninfo);
+ // PGconn *PQconnectdb(const char *conninfo);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQsetdbLogin (string pghost,
+ string pgport, string pgoptions,
+ string pgtty, string dbName,
+ string login, string pwd);
+ // PGconn *PQsetdbLogin(const char *pghost,
+ // const char *pgport, const char *pgoptions,
+ // const char *pgtty, const char *dbName,
+ // const char *login, const char *pwd);
+
+ [DllImport("pq")]
+ public static extern void PQfinish (IntPtr conn);
+ // void PQfinish(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconndefaults ();
+ // PQconninfoOption *PQconndefaults(void);
+
+ [DllImport("pq")]
+ public static extern void PQconninfoFree (IntPtr connOptions);
+ // void PQconninfoFree(PQconninfoOption *connOptions);
+
+ [DllImport("pq")]
+ public static extern int PQresetStart (IntPtr conn);
+ // int PQresetStart(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQresetPoll (IntPtr conn);
+ // PostgresPollingStatusType PQresetPoll(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQreset (IntPtr conn);
+ // void PQreset(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQrequestCancel (IntPtr conn);
+ // int PQrequestCancel(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQdb (IntPtr conn);
+ // char *PQdb(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQuser (IntPtr conn);
+ // char *PQuser(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQpass (IntPtr conn);
+ // char *PQpass(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQhost (IntPtr conn);
+ // char *PQhost(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQport (IntPtr conn);
+ // char *PQport(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQtty (IntPtr conn);
+ // char *PQtty(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQoptions (IntPtr conn);
+ // char *PQoptions(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern ConnStatusType PQstatus (IntPtr conn);
+ // ConnStatusType PQstatus(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQerrorMessage (IntPtr conn);
+ // char *PQerrorMessage(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsocket (IntPtr conn);
+ // int PQsocket(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQbackendPID (IntPtr conn);
+ // int PQbackendPID(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQclientEncoding (IntPtr conn);
+ // int PQclientEncoding(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsetClientEncoding (IntPtr conn,
+ string encoding);
+ // int PQsetClientEncoding(PGconn *conn,
+ // const char *encoding);
+
+ //FIXME: when loading, causes runtime exception
+ //[DllImport("pq")]
+ //public static extern IntPtr PQgetssl (IntPtr conn);
+ // SSL *PQgetssl(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQtrace (IntPtr conn,
+ IntPtr debug_port);
+ // void PQtrace(PGconn *conn,
+ // FILE *debug_port);
+
+ [DllImport("pq")]
+ public static extern void PQuntrace (IntPtr conn);
+ // void PQuntrace(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQsetNoticeProcessor (IntPtr conn,
+ IntPtr proc, IntPtr arg);
+ // PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn,
+ // PQnoticeProcessor proc, void *arg);
+
+ [DllImport("pq")]
+ public static extern int PQescapeString (string to,
+ string from, int length);
+ // size_t PQescapeString(char *to,
+ // const char *from, size_t length);
+
+ [DllImport("pq")]
+ public static extern string PQescapeBytea (string bintext,
+ int binlen, IntPtr bytealen);
+ // unsigned char *PQescapeBytea(unsigned char *bintext,
+ // size_t binlen, size_t *bytealen);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQexec (IntPtr conn,
+ string query);
+ // PGresult *PQexec(PGconn *conn,
+ // const char *query);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQnotifies (IntPtr conn);
+ // PGnotify *PQnotifies(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQfreeNotify (IntPtr notify);
+ // void PQfreeNotify(PGnotify *notify);
+
+ [DllImport("pq")]
+ public static extern int PQsendQuery (IntPtr conn,
+ string query);
+ // int PQsendQuery(PGconn *conn,
+ // const char *query);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQgetResult (IntPtr conn);
+ // PGresult *PQgetResult(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQisBusy (IntPtr conn);
+ // int PQisBusy(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQconsumeInput (IntPtr conn);
+ // int PQconsumeInput(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQgetline (IntPtr conn,
+ string str, int length);
+ // int PQgetline(PGconn *conn,
+ // char *string, int length);
+
+ [DllImport("pq")]
+ public static extern int PQputline (IntPtr conn,
+ string str);
+ // int PQputline(PGconn *conn,
+ // const char *string);
+
+ [DllImport("pq")]
+ public static extern int PQgetlineAsync (IntPtr conn,
+ string buffer, int bufsize);
+ // int PQgetlineAsync(PGconn *conn, char *buffer,
+ // int bufsize);
+
+ [DllImport("pq")]
+ public static extern int PQputnbytes (IntPtr conn,
+ string buffer, int nbytes);
+ // int PQputnbytes(PGconn *conn,
+ //const char *buffer, int nbytes);
+
+ [DllImport("pq")]
+ public static extern int PQendcopy (IntPtr conn);
+ // int PQendcopy(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsetnonblocking (IntPtr conn,
+ int arg);
+ // int PQsetnonblocking(PGconn *conn, int arg);
+
+ [DllImport("pq")]
+ public static extern int PQisnonblocking (IntPtr conn);
+ // int PQisnonblocking(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQflush (IntPtr conn);
+ // int PQflush(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQfn (IntPtr conn, int fnid,
+ IntPtr result_buf, IntPtr result_len,
+ int result_is_int, IntPtr args,
+ int nargs);
+ // PGresult *PQfn(PGconn *conn, int fnid,
+ // int *result_buf, int *result_len,
+ // int result_is_int, const PQArgBlock *args,
+ // int nargs);
+
+ [DllImport("pq")]
+ public static extern ExecStatusType PQresultStatus (IntPtr res);
+ // ExecStatusType PQresultStatus(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQresStatus (ExecStatusType status);
+ // char *PQresStatus(ExecStatusType status);
+
+ [DllImport("pq")]
+ public static extern string PQresultErrorMessage (IntPtr res);
+ // char *PQresultErrorMessage(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQntuples (IntPtr res);
+ // int PQntuples(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQnfields (IntPtr res);
+ // int PQnfields(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQbinaryTuples (IntPtr res);
+ // int PQbinaryTuples(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQfname (IntPtr res,
+ int field_num);
+ // char *PQfname(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfnumber (IntPtr res,
+ string field_name);
+ // int PQfnumber(const PGresult *res,
+ // const char *field_name);
+
+ [DllImport("pq")]
+ public static extern int PQftype (IntPtr res,
+ int field_num);
+ // Oid PQftype(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfsize (IntPtr res,
+ int field_num);
+ // int PQfsize(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfmod (IntPtr res, int field_num);
+ // int PQfmod(const PGresult *res, int field_num);
+
+ [DllImport("pq")]
+ public static extern string PQcmdStatus (IntPtr res);
+ // char *PQcmdStatus(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQoidStatus (IntPtr res);
+ // char *PQoidStatus(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQoidValue (IntPtr res);
+ // Oid PQoidValue(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQcmdTuples (IntPtr res);
+ // char *PQcmdTuples(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQgetvalue (IntPtr res,
+ int tup_num, int field_num);
+ // char *PQgetvalue(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQgetlength (IntPtr res,
+ int tup_num, int field_num);
+ // int PQgetlength(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQgetisnull (IntPtr res,
+ int tup_num, int field_num);
+ // int PQgetisnull(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern void PQclear (IntPtr res);
+ // void PQclear(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQmakeEmptyPGresult (IntPtr conn,
+ IntPtr status);
+ // PGresult *PQmakeEmptyPGresult(PGconn *conn,
+ // ExecStatusType status);
+
+ [DllImport("pq")]
+ public static extern void PQprint (IntPtr fout,
+ IntPtr res, IntPtr ps);
+ // void PQprint(FILE *fout,
+ // const PGresult *res, const PQprintOpt *ps);
+
+ [DllImport("pq")]
+ public static extern void PQdisplayTuples (IntPtr res,
+ IntPtr fp, int fillAlign, string fieldSep,
+ int printHeader, int quiet);
+ // void PQdisplayTuples(const PGresult *res,
+ // FILE *fp, int fillAlign, const char *fieldSep,
+ // int printHeader, int quiet);
+
+ [DllImport("pq")]
+ public static extern void PQprintTuples (IntPtr res,
+ IntPtr fout, int printAttName, int terseOutput,
+ int width);
+ // void PQprintTuples(const PGresult *res,
+ // FILE *fout, int printAttName, int terseOutput,
+ // int width);
+
+ [DllImport("pq")]
+ public static extern int lo_open (IntPtr conn,
+ int lobjId, int mode);
+ // int lo_open(PGconn *conn,
+ // Oid lobjId, int mode);
+
+ [DllImport("pq")]
+ public static extern int lo_close (IntPtr conn, int fd);
+ // int lo_close(PGconn *conn, int fd);
+
+ [DllImport("pq")]
+ public static extern int lo_read (IntPtr conn,
+ int fd, string buf, int len);
+ // int lo_read(PGconn *conn,
+ // int fd, char *buf, size_t len);
+
+ [DllImport("pq")]
+ public static extern int lo_write (IntPtr conn,
+ int fd, string buf, int len);
+ // int lo_write(PGconn *conn,
+ // int fd, char *buf, size_t len);
+
+ [DllImport("pq")]
+ public static extern int lo_lseek (IntPtr conn,
+ int fd, int offset, int whence);
+ // int lo_lseek(PGconn *conn,
+ // int fd, int offset, int whence);
+
+ [DllImport("pq")]
+ public static extern int lo_creat (IntPtr conn,
+ int mode);
+ // Oid lo_creat(PGconn *conn,
+ // int mode);
+
+ [DllImport("pq")]
+ public static extern int lo_tell (IntPtr conn, int fd);
+ // int lo_tell(PGconn *conn, int fd);
+
+ [DllImport("pq")]
+ public static extern int lo_unlink (IntPtr conn,
+ int lobjId);
+ // int lo_unlink(PGconn *conn,
+ // Oid lobjId);
+
+ [DllImport("pq")]
+ public static extern int lo_import (IntPtr conn,
+ string filename);
+ // Oid lo_import(PGconn *conn,
+ // const char *filename);
+
+ [DllImport("pq")]
+ public static extern int lo_export (IntPtr conn,
+ int lobjId, string filename);
+ // int lo_export(PGconn *conn,
+ // Oid lobjId, const char *filename);
+
+ [DllImport("pq")]
+ public static extern int PQmblen (string s,
+ int encoding);
+ // int PQmblen(const unsigned char *s,
+ // int encoding);
+
+ [DllImport("pq")]
+ public static extern int PQenv2encoding ();
+ // int PQenv2encoding(void);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/README b/mcs/class/README
new file mode 100644
index 00000000000..97382f10b20
--- /dev/null
+++ b/mcs/class/README
@@ -0,0 +1,277 @@
+The class libraries are grouped together in the assemblies they belong.
+
+Each directory here represents an assembly, and inside each directory we
+divide the code based on the namespace they implement.
+
+In addition, each assembly directory contains a Test directory that holds the
+NUnit tests for that assembly.
+
+The nant build file for an assembly creates two versions of the dll for that
+assembly. One version is a "full" dll. The full dll contains (almost) all
+of the classes, regardless of how complete the classes are. The name of this
+dll is the normal name you would expect, like "corlib.dll" or "System.dll".
+These full dll's are created in the /mcs/class/lib directory.
+
+The other dll which is built is a "restricted" dll. The restricted dll
+omits incomplete classes that would prevent the NUnit testrunner from actually
+running the tests. These restricted dll's are created in the Test directory
+of their respective assembly and named with a "_res" suffix. So, for example,
+the NUnit-testable dll for corlib is /mcs/class/corlib/Test/corlib_res.dll.
+
+The final dll which is built is the one which houses the actual NUnit tests.
+This dll is built from all of the classes in the Test directory and below, and
+is named with a "_test" suffix. So, for example, the NUnit tests for corlib
+are in /mcs/class/corlib/Test/corlib_test.dll. This dll is also linked with
+the restricted dll found in the same directory.
+
+
+* Missing implementation bits
+
+ If you implement a class and you are missing implementation bits,
+ please use the attribute [MonoTODO]. This attribute can be used
+ to programatically generate our status web pages:
+
+ [MonoTODO]
+ int MyFunction ()
+ {
+ throw new NotImplementedException ();
+ }
+
+* Tagging buggy code
+
+ If there is a bug in your implementation tag the problem by using
+ the word "FIXME" in the code, together with a description of the
+ problem.
+
+ Do not use XXX or obscure descriptions, because otherwise people
+ will not be able to understand what you mean.
+
+* Tagging Problematic specs.
+
+ If the documentation and the Microsoft implementation do
+ differ (you wrote a test case to prove this), I suggest that you edit
+ the file `mcs/class/doc/API-notes' so we can keep track of these problems
+ and submit our comments to ECMA or Microsoft and seek clarification.
+
+ Sometimes the documentation might be buggy, and sometimes the implementation
+ might be buggy. Lets try to identify and pinpoint which one
+ is the correct one.
+
+ Sometimes the specification will be lame (consider Version.ToString (fieldCount)
+ where there is no way of knowing how many fields are available, making the API
+ not only stupid, but leading to unreliable code).
+
+ In those cases, use the keyword "LAMESPEC".
+
+
+* Coding considerations and style.
+
+ In order to keep the code consistent, please use the following
+ conventions. From here on `good' and `bad' are used to attribute
+ things that would make the coding style match, or not match. It is not
+ a judgement call on your coding abilities, but more of a style and
+ look call. Please try to follow these guidelines to ensure prettiness.
+
+ Use 8 space tabs for writing your code (hopefully we can keep
+ this consistent). If you are modifying someone else's code, try
+ to keep the coding style similar.
+
+ Since we are using 8-space tabs, you might want to consider the Linus
+ Torvals trick to reduce code nesting. Many times in a loop, you will
+ find yourself doing a test, and if the test is true, you will nest.
+ Many times this can be changed. Example:
+
+
+ for (i = 0; i < 10; i++) {
+ if (something (i)) {
+ do_more ();
+ }
+ }
+
+ This take precious space, instead write it like this:
+
+ for (i = 0; i < 10; i++) {
+ if (!something (i))
+ continue;
+ do_more ();
+ }
+
+ A few guidelines:
+
+ * Use a space before an opening parenthesis when calling
+ functions, or indexing, like this:
+
+ method (a);
+ b [10];
+
+ * Do not put a space after the opening parenthesis and the
+ closing one, ie:
+
+ good: method (a); array [10];
+
+ bad: method ( a ); array[ 10 ];
+
+ * Inside a code block, put the opening brace on the same line
+ as the statement:
+
+ good:
+ if (a) {
+ code ();
+ code ();
+ }
+
+ bad:
+ if (a)
+ {
+ code ();
+ code ();
+ }
+
+ * Avoid using unecessary open/close braces, vertical space
+ is usually limited:
+
+ good:
+ if (a)
+ code ();
+
+ bad:
+ if (a) {
+ code ();
+ }
+
+ * When defining a method, use the C style for brace placement,
+ that means, use a new line for the brace, like this:
+
+ good:
+ void Method ()
+ {
+ }
+
+ bad:
+ void Method () {
+ }
+
+ * Properties and indexers are an exception, keep the
+ brace on the same line as the property declaration.
+ Rationale: this makes it visually
+ simple to distinguish them.
+
+ good:
+ int Property {
+ get {
+ return value;
+ }
+ }
+
+ bad:
+ int Property
+ {
+ get {
+ return value;
+ }
+ }
+
+ Notice how the accessor "get" also keeps its brace on the same
+ line.
+
+ For very small properties, you can compress things:
+
+ ok:
+ int Property {
+ get { return value; }
+ set { x = value; }
+ }
+
+ * Use white space in expressions liberally, except in the presence
+ of parenthesis:
+
+ good:
+
+ if (a + 5 > method (blah () + 4))
+
+ bad:
+ if (a+5>method(blah()+4))
+
+ * For any new files, please use a descriptive introduction, like
+ this:
+
+ //
+ // System.Comment.cs: Handles comments in System files.
+ //
+ // Author:
+ // Juan Perez (juan@address.com)
+ //
+ // (C) 2002 Address, Inc (http://www.address.com)
+ //
+
+ * If you are modyfing someone else's code, and your contribution
+ is significant, please add yourself to the Authors list.
+
+ * Switch statements have the case at the same indentation as the
+ switch:
+
+ switch (x) {
+ case 'a':
+ ...
+ case 'b':
+ ...
+ }
+
+ * Argument names should use the camel casing for
+ identifiers, like this:
+
+ good:
+ void Method (string myArgument)
+
+ bad:
+ void Method (string lpstrArgument)
+ void Method (string my_string)
+
+ Here are a couple of examples:
+
+class X : Y {
+
+ bool Method (int argument_1, int argument_2)
+ {
+ if (argument_1 == argument_2)
+ throw new Exception (Locale.GetText ("They are equal!");
+
+ if (argument_1 < argument_2) {
+ if (argument_1 * 3 > 4)
+ return true;
+ else
+ return false;
+ }
+
+ //
+ // This sample helps keep your sanity while using 8-spaces for tabs
+ //
+ VeryLongIdentifierWhichTakesManyArguments (
+ Argument1, Argument2, Argument3,
+ NestedCallHere (
+ MoreNested));
+ }
+
+ bool MyProperty {
+ get {
+ return x;
+ }
+
+ set {
+ x = value;
+ }
+ }
+
+ void AnotherMethod ()
+ {
+ if ((a + 5) != 4) {
+ }
+
+ while (blah) {
+ if (a)
+ continue;
+ b++;
+ }
+ }
+}
+ \ No newline at end of file
diff --git a/mcs/class/System.Data/ChangeLog b/mcs/class/System.Data/ChangeLog
new file mode 100644
index 00000000000..62cf46c910c
--- /dev/null
+++ b/mcs/class/System.Data/ChangeLog
@@ -0,0 +1,330 @@
+2002-04-23 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.build: modified - added new
+ files to exclude from build
+
+ * System.Data/Constraint.cs
+ * System.Data/ConstraintCollection.cs
+ * System.Data/InternalDataCollectionBase.cs: added -
+ stubs which are needed to build DataTable.cs
+
+ * TODO: modified - added more classes TODO and
+ added more stuff TODO, such as, create script
+ to create test database monotestdb for testing
+ classes in System.Data
+
+2002-04-23 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DataAdapter.cs:
+ * System.Data.Common/DataColumnMappingCollection.cs:
+ * System.Data.Common/DataTableMappingCollection.cs:
+ * System.Data.Common/DbDataPermission.cs:
+ * System.Data.Common/DbDataPermissionAttribute.cs: some
+ compilation errors fixed.
+
+2002-04-23 Daniel Morgan <danmorg@sc.rr.com>
+
+ * TODO: modified - added classes TODO, and
+ a poor attempt at System.Data plan
+
+2002-04-23 Daniel Morgan <danmorg@sc.rr.com>
+
+ * ChangeLog: modified - put tabs where they belong
+
+ * System.Data.SqlClient/SqlDataReader.cs
+ * System.Data/DataColumn.cs: modified - compile errors
+ trying to compile SqlDataAdapter and dependencies
+
+2002-04-23 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlTypes/SqlBoolean.cs
+ * System.Data.SqlTypes/SqlCompareOptions.cs
+ * System.Data.SqlTypes/SqlInt32.cs
+ * System.Data.SqlTypes/SqlString.cs: added - new stubs
+
+ * System.Data/DataTable.cs
+ * System.Data.SqlClient/SqlCommand.cs
+ * System.Data.SqlClient/SqlConnection.cs
+ * System.Data.SqlClient/SqlError.cs
+ * System.Data.SqlClient/SqlTransaction.cs: modified -
+ misc. tweaks
+
+ * System.Data.SqlClient/SqlException.cs: modified -
+ missing Message on indexer for Message property
+
+2002-04-21 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlCommand.cs: modified - to
+ compile using mcs. This problem is
+ returning a stronger type in csc vs. msc
+
+ * System.Data.SqlClient/SqlConnection.cs: modified - msc
+ can not do a using PGconn = IntPtr; and then declare
+ with PGconn pgConn = IntPtr.Zero;
+ Thiw works under csc though. Had to comment using and
+ changed declaration to IntPtr pgConn = IntPtr.Zero;
+ Also, got rid of compile warnings for hostaddr and port.
+
+ * System.Data.SqlClient/SqlErrorCollection.cs: modified - got
+ rid of compile warnings. Commented MonoTODO attribute because mcs
+ doesn't seem to work with C# array property indexer (Item)
+ this[int index]
+
+ * System.Data.SqlClient/SqlParameterCollection.cs: modified -
+ commented MonoTODO attribute for indexer for mcs compiling
+
+ * Test/TestSqlIsolationLevel.cs:
+ * Test/TestSqlInsert.cs:
+ * Test/TestSqlException.cs: modified -
+ removed extra ExecuteNonQuery which caused two inserted rows
+
+2002-04-20 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data/StateChangeEventArgs.cs - added
+ needed to compile System.Data.dll with mcs.
+
+2002-04-20 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.OleDb: added directory - for OleDb database
+ provider classes
+
+ * System.Data.SqlClient/SqlClientPermission.cs
+ * System.Data.SqlClient/SqlClientPermissionAttribute.cs
+ * System.Data.SqlClient/SqlCommandBuilder.cs
+ * System.Data.SqlClient/SqlInfoMessageEventHandler.cs
+ * System.Data.SqlClient/SqlRowUpdatedEventArgs.cs
+ * System.Data.SqlClient/SqlRowUpdatedEventHandler.cs
+ * System.Data.SqlClient/SqlRowUpdatingEventArgs.cs
+ * System.Data.SqlClient/SqlRowUpdatingEventHandler.cs
+ * Test/TestSqlException.cs
+ * Test/TestSqlIsolationLevel.cs: added - more tests
+
+ * System.Data.build: modified - added new files - excludes these too
+
+ * System.Data.SqlClient/PostgresLibrary.cs - modified - comment
+
+ * System.Data.SqlClient/SqlConnection.cs
+ * System.Data.SqlClient/SqlCommand.cs
+ * System.Data.SqlClient/SqlTransaction.cs
+ * System.Data.SqlClient/SqlException.cs
+ * System.Data.SqlClient/SqlErrorCollection.cs
+ * System.Data.SqlClient/SqlError.cs: modified - transaction and
+ exception/error handling. SqlConnection(connectionString)
+ constructor should not automatically connect.
+
+ * System.Data.SqlClient/SqlDataReader.cs
+ * System.Data.SqlClient/SqlDataAdapter.cs
+ * System.Data.SqlClient/SqlParameter.cs
+ * System.Data.SqlClient/SqlParameterCollection.cs: modified -
+ added using System.ComponentModel;
+
+ * Test/TestSqlInsert.cs: modified - to use transaction
+
+2002-04-17 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data/DataRow.cs: new skeletons.
+
+ * System.Data.Common/DataAdapter.cs:
+ * System.Data.Common/DataColumnMapping.cs:
+ * System.Data.Common/DataColumnMappingCollection.cs:
+ * System.Data.Common/DataTableMapping.cs:
+ * System.Data.Common/DataTableMappingCollection.cs:
+ * System.Data.Common/DbDataAdapter.cs:
+ * System.Data.Common/RowUpdatedEventArgs.cs:
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ * System.Data.SqlClient/SqlInfoMessageEventArgs.cs: compilation
+ fixes for Linux.
+
+ * System.Data.Common/DbDataRecord.cs:
+ * System.Data.Common/DbEnumerator.cs: removed MS implementation
+ internal classes.
+
+2002-04-17 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/TestSqlInsert.cs: modified - do
+ a SQL DELETE before SQL INSERT of row so you can use this
+ test over and over.
+
+ * System.Data.SqlClient/SqlTransaction.cs: modified - default
+ IsolationLevel for PostgreSQL is ReadCommitted. However,
+ PostgreSQL allows Serializable as well.
+ (Thanks to Gonzalo for that!)
+
+ * System.Data.SqlClient/SqlConnection.cs: modified
+ * System.Data.SqlClient/SqlCommand.cs: modified
+ * System.Data.SqlClient/SqlTransaction.cs: modified - got transactions
+ working; however, we still need to implement SQL errors
+ and exceptions to properly handle transactions. Also, added
+ status and error message support from the PostgreSQL database.
+ Currently, this does a Console.WriteLine() to display the
+ status and error messages, but this is a TODO
+ for SQL errors and exceptions.
+
+ * System.Data/TODOAttribute.cs: added - needed MonoTODO
+ attribute for System.Data.dll assembly
+
+ * System.Data/IDbCommand.cs: modified - commented
+ overloaded method ExecuteReader
+ so System.Data.SqlClient.SqlCommand can compile
+
+ * System.Data/IDbCommand.cs: modified
+ * System.Data/IDbConnection.cs: modified - added using System;
+ * System.Data/IDataParameter.cs
+
+ * System.Data.build: modified - build classes
+ in System.Data.SqlClient and exclude others in System.Data
+
+ * System.Data.SqlClient/PostgresLibrary.cs: modified - change
+ parameter data type from IntPtr to enum ExecStatusType
+
+ * ChangeLog: modified - corrected previous entries in log
+
+2002-04-16 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DataColumnMappingCollection.cs: added basic
+ implementation. Still missing some stuff.
+
+2002-04-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlConnection.cs: modified - got
+ to compile, run, and connect to PostgreSQL database
+
+ * System.Data.SqlClient/SqlCommand.cs: modified - got
+ to compile, run, and execute a SQL INSERT command
+ which successfully inserted a row
+ into the PostgreSQL database
+
+ * System.Data.SqlClient/SqlTransaction.cs: modified
+ * System.Data.SqlClient/SqlParameter.cs: modified
+ * System.Data.SqlClient/SqlParameterCollection.cs: modified
+ * System.Data.SqlClient/SqlError.cs: modified
+ * System.Data.SqlClient/SqlErrorCollection.cs: modified
+ * System.Data.SqlClient/SqlException.cs: modified
+ * System.Data.SqlClient/PostgresLibrary.cs: modified - to compile
+
+ * System.Data.SqlClient/SqlAdapter: modified
+ * System.Data.SqlClient/SqlReader: modified - add more stubs
+
+2002-04-16 Daniel Morgan <danmorg@sc.rr.com>
+
+ * Test/TestSqlInsert.cs: added
+
+2002-04-15 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/SqlInfoMessageEventArgs.cs: added - using in
+ class SqlConnecition
+ * System.Data.SqlClient/SqlErrorCollection.cs: added
+ * System.Data.SqlClient/SqlErrors.cs: removed - no such class SqlErrors
+
+2002-04-15 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ * System.Data.IDbDataParameter: Added Interface to IDataParameter.
+ * System.Data.IDbTransaction: Added Interface to IDisposable.
+ * System.Data.IDbCommand: Fixed Capitalization of class name.
+ * System.Data.IDbConnection: Fixed Capitalization of class name.
+
+2002-04-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DbDataPermissionAttribute.cs:
+ * System.Data.Common/DataAdapter.cs:
+ * System.Data.Common/DataColumnMapping.cs:
+ * System.Data.Common/DbDataPermission.cs: added some implementation.
+
+2002-04-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlClient/SqlConnection.cs: fixed constructor chaining
+ syntax, as pointed out by Levent Camlibel.
+
+2002-04-14 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlTypes/SqlBinary.cs:
+ * System.Data.SqlTypes/INullable.cs: new skeletons.
+
+2002-04-14 Daniel Morgan <danmorg@sc.rr.com>
+
+ * System.Data.SqlClient/PostgresLibrary.cs: new internal class, which
+ contains all calls the the PostgreSQL client library, to be used
+ everywhere in System.Data.SqlClient.
+
+2002-03-30 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlClient/SqlConnection.cs: implemented basic
+ constructors.
+
+ * System.Data.SqlTypes/SqlNullValueException.cs: new skeletons.
+
+2002-03-29 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DbDataRecord.cs:
+ * System.Data.Common/DbEnumerator.cs:
+ * System.Data.Common/RowUpdatedEventArgs.cs:
+ * System.Data.Common/RowUpdatingEventArgs.cs:
+ * System.Data.Common/DbDataPermissionAttribute.cs: new skeletons.
+
+2002-03-28 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DataTableMappingCollection.cs:
+ * System.Data.Common/DbDataAdapter.cs:
+ * System.Data.Common/DbDataPermission.cs:
+ * System.Data.Common/DataTableMapping.cs: new skeletons.
+
+ * System.Data.SqlClient/SqlDataAdapter.cs:
+ * System.Data.SqlClient/SqlDataReader.cs:
+ * System.Data.SqlClient/SqlErrors.cs:
+ * System.Data.SqlClient/SqlError.cs:
+ * System.Data.SqlClient/SqlException.cs:
+ * System.Data.SqlClient/SqlParameter.cs:
+ * System.Data.SqlClient/SqlParameterCollection.cs:
+ * System.Data.SqlClient/SqlTransaction.cs:
+ * System.Data.SqlClient/SqlCommand.cs: fixed skeletons.
+
+2002-03-27 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.Common/DataColumnMapping.cs:
+ * System.Data.Common/DataColumnMappingCollection.cs:
+ * System.Data.Common/DataAdapter.cs: created skeletons.
+
+ * System.Data.build: exclude new directories from build.
+
+2002-03-27 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlClient/SqlTransaction.cs: started implementation.
+
+ * System.Data.SqlClient/SqlConnection.cs (BeginTransaction):
+ implemented (2 methods).
+
+2002-03-24 Duncan Mak <duncan@ximian.com>
+
+ * System.Data.build: Excluded System.Data.SqlClient from the build.
+ The stubs are incomplete and they are stopping the build.
+
+ * System.Data.SqlClient/SqlCommand.cs: Replaced 'implements' with ':'.
+
+2002-03-24 Rodrigo Moya <rodrigo@ximian.com>
+
+ * System.Data.SqlClient/*: added skeletons for the SQL managed
+ provider for ADO.Net, to be based initially in PostgreSQL.
+
+2002-03-15 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ Changed the Namespace on some Enums from mono.System.Data to System.Data
+
+2002-03-01 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ * DataColumnCollection.cs : When an existing DataColumn is added, will now Assign a
+ default name if the ColumnName is null.
+ * DataSet.cs : Added
+ * DataTable.cs : Added
+ * DataRelationCollection.cs : Added
+ * DataTableRelationCollection.cs : Added
+ * DataColumn : Added
+
+2002-02-11 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ * DataColumnChangeEventArgs.cs : Added
+ * DataColumnCollection.cs : Added
+
+2002-02-10 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ * Removed *.cs from System.Data as the correct files are in mcs/class/System.Data/System.Data
+ * Updated all Enums, Interfaces, and Delegates in System.Data
diff --git a/mcs/class/System.Data/System.Data.Common/DataAdapter.cs b/mcs/class/System.Data/System.Data.Common/DataAdapter.cs
new file mode 100644
index 00000000000..dc8a41776fe
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DataAdapter.cs
@@ -0,0 +1,96 @@
+//
+// System.Data.Common.DataAdapter
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Data.Common
+{
+ /// <summary>
+ /// Represents a set of data commands and a database connection that are used to fill the DataSet and update the data source.
+ /// </summary>
+ public abstract class DataAdapter : Component, IDataAdapter
+ {
+ private bool acceptChangesDuringFill;
+ private bool continueUpdateOnError;
+ private MissingMappingAction missingMappingAction;
+ private MissingSchemaAction missingSchemaAction;
+ private DataTableMappingCollection tableMappings;
+
+ protected DataAdapter () {
+ acceptChangesDuringFill = false;
+ continueUpdateOnError = false;
+ missingMappingAction = MissingMappingAction.Error;
+ missingSchemaAction = MissingSchemaAction.Error;
+ tableMappings = null;
+ }
+
+ public abstract int Fill (DataSet dataSet);
+
+ public abstract DataTable[] FillSchema (DataSet dataSet,
+ SchemaType schemaType);
+
+ public abstract IDataParameter[] GetFillParameters ();
+
+ public abstract int Update (DataSet dataSet);
+
+ protected virtual DataAdapter CloneInternals () {
+ }
+
+ protected virtual DataTableMappingCollection CreateTableMappings () {
+ }
+
+ protected virtual bool ShouldSerializeTableMappings () {
+ }
+
+ public bool AcceptChangesDuringFill {
+ get {
+ return acceptChangesDuringFill;
+ }
+ set {
+ acceptChangesDuringFill = value;
+ }
+ }
+
+ public bool ContinueUpdateOnError {
+ get {
+ return continueUpdateOnError;
+ }
+ set {
+ continueUpdateOnError = value;
+ }
+ }
+
+ public MissingMappingAction MissingMappingAction {
+ get {
+ return missingMappingAction;
+ }
+ set {
+ missingMappingAction = value;
+ }
+ }
+
+ public MissingSchemaAction MissingSchemaAction {
+ get {
+ return missingSchemaAction;
+ }
+ set {
+ missingSchemaAction = value;
+ }
+ }
+
+ public DataTableMappingCollection TableMappings {
+ get {
+ if (tableMappings == null)
+ tableMappings = CreateTableMappings ();
+ return tableMappings;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs b/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs
new file mode 100644
index 00000000000..3f80b04034c
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs
@@ -0,0 +1,58 @@
+//
+// System.Data.Common.DataColumnMapping
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System.Data;
+
+namespace System.Data.Common
+{
+ /// <summary>
+ /// Contains a generic column mapping for an object that inherits from DataAdapter. This class cannot be inherited.
+ /// </summary>
+ public sealed class DataColumnMapping : MarshalByRefObject, IColumnMapping, ICloneable
+ {
+ private string srcColumn;
+ private string dsColumn;
+
+ public DataColumnMapping () {
+ srcColumn = null;
+ dsColumn = null;
+ }
+
+ public DataColumnMapping(string sc, string dc) {
+ srcColumn = sc;
+ dsColumn = dc;
+ }
+
+ [MonoTODO]
+ public DataColumn GetDataColumnBySchemaAction (
+ DataTable dataTable,
+ Type dataType,
+ MissingSchemaAction schemaAction) {
+ throw new NotImplementedException ();
+ }
+
+ public string DataSetColumn {
+ get {
+ return this.dsColumn;
+ }
+ set {
+ this.dsColumn = value;
+ }
+ }
+
+ public string SourceColumn {
+ get {
+ return this.srcColumn;
+ }
+ set {
+ this.srcColumn = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs b/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs
new file mode 100644
index 00000000000..b6f2bb5a1cc
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs
@@ -0,0 +1,140 @@
+//
+// System.Data.Common.DataColumnCollection
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System;
+using System.Collections;
+using System.Data;
+
+namespace System.Data.Common
+{
+ /// <summary>
+ /// Contains a collection of DataColumnMapping objects. This class cannot be inherited.
+ /// </summary>
+ public sealed class DataColumnMappingCollection :
+ MarshalByRefObject, IColumnMappingCollection, IList,
+ ICollection, IEnumerable
+ {
+ private DataColumnMapping[] mappings = null;
+ private int size = 0;
+
+ public DataColumnMappingCollection () {
+ }
+
+ public int Add (object obj) {
+ DataColumnMapping[] tmp = new DataColumnMapping[size + 1];
+
+ Array.Copy (mappings, tmp, size);
+ size++;
+ mappings = tmp;
+ mappings[size - 1] = obj;
+
+ return size;
+ }
+
+ public void AddRange (DataColumnMapping[] values) {
+ DataColumnMapping[] tmp = new DataColumnMapping[size + values.Length];
+
+ Array.Copy (mappings, tmp, size);
+ for (int i = 0; i < values.Length; i++) {
+ tmp[i + size] = values[i];
+ }
+
+ size += values.Length;
+ mappings = tmp;
+ }
+
+ public void Clear () {
+ /* FIXME */
+ for (int i = 0; i < size; i++)
+ mappings[i] = null;
+
+ size = 0;
+ }
+
+ public bool Contains (object obj) {
+ for (int i = 0; i < size; i++) {
+ if (obj.Equals (mappings[i]))
+ return true;
+ }
+
+ return false;
+ }
+
+ public void CopyTo (Array array, int index) {
+ DataColumnMapping[] tmp = new DataColumnMapping[size];
+ Array.Copy (mappings, tmp, size);
+ }
+
+ public DataColumnMapping GetByDataSetColumn (string value) {
+ for (int i = 0; i < size; i++) {
+ if (mappings[i].DataSetColumn == value)
+ return mappings[i];
+ }
+
+ return null;
+ }
+
+ [MonoTODO]
+ public static DataColumnMapping GetColumnMappingBySchemaAction (
+ DataColumnMappingCollection columnMappings,
+ string sourceColumn,
+ MissingMappingAction mappingAction) {
+ throw new NotImplementedException ();
+ }
+
+ public int IndexOf (object obj) {
+ for (int i = 0; i < size; i++) {
+ if (obj.Equals (mappings[i]))
+ return i;
+ }
+
+ return -1;
+ }
+
+ public int IndexOfDataSetColumn (string value) {
+ for (int i = 0; i < size; i++) {
+ if (mappings[i].DataSetColumn == value)
+ return i;
+ }
+
+ return -1;
+ }
+
+ [MonoTODO]
+ public void Insert (int index, object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove (object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt (int index) {
+ throw new NotImplementedException ();
+ }
+
+ public int Count {
+ get { return size; }
+ }
+
+ public DataColumnMapping this[int index] {
+ get {
+ if (value < size)
+ return mappings[index];
+ return null;
+ }
+ set {
+ if (value < size)
+ mappings[index] = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs b/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs
new file mode 100644
index 00000000000..3e15722a5e4
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs
@@ -0,0 +1,65 @@
+//
+// System.Data.Common.DataTableMapping.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System.Data;
+
+namespace System.Data.Common
+{
+ /// <summary>
+ /// Contains a description of a mapped relationship between a source table and a DataTable. This class is used by a DataAdapter when populating a DataSet.
+ /// </summary>
+ public sealed class DataTableMapping : MarshalByRefObject, ITableMapping, ICloneable
+ {
+ [MonoTODO]
+ public DataTableMapping() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTableMapping (string a, string b) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTableMapping(string a, string b, DataColumnMapping[] c) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataColumnMapping GetColumnMappingBySchemaAction(
+ string sourceColumn,
+ MissingMappingAction mappingAction) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable GetDataTableBySchemaAction(
+ DataSet dataSet,
+ MissingSchemaAction schemaAction) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataColumnMappingCollection ColumnMappings {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string DataSetTable {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string SourceTable {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs b/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs
new file mode 100644
index 00000000000..5a51cd6dc7b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs
@@ -0,0 +1,128 @@
+//
+// System.Data.Common.DataTableMappingCollection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System;
+using System.Collections;
+
+namespace System.Data.Common
+{
+ /// <summary>
+ /// A collection of DataTableMapping objects. This class cannot be inherited.
+ /// </summary>
+ public sealed class DataTableMappingCollection :
+ MarshalByRefObject, ITableMappingCollection, IList,
+ ICollection, IEnumerable
+ {
+ [MonoTODO]
+ public DataTableMappingCollection() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Add (object obj) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTableMapping Add (string a, string b) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddRange(DataTableMapping[] values) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Clear() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains (object obj) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains (string str) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTableMapping GetByDataSetTable(string dataSetTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static DataTableMapping GetTableMappingBySchemaAction(
+ DataTableMappingCollection tableMappings,
+ string sourceTable,
+ string dataSetTable,
+ MissingMappingAction mappingAction) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf (object obj) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf (string str) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOfDataSetTable (string dataSetTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Insert (int index, object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove (object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt (int index) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt (string index) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Count {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public DataTableMapping this[int i] {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public DataTableMapping this[string s] {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs
new file mode 100644
index 00000000000..ce2cbe0740e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs
@@ -0,0 +1,160 @@
+//
+// System.Data.Common.DbDataAdapter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+namespace System.Data.Common
+{
+ /// <summary>
+ /// Aids implementation of the IDbDataAdapter interface. Inheritors of DbDataAdapter implement a set of functions to provide strong typing, but inherit most of the functionality needed to fully implement a DataAdapter.
+ /// </summary>
+ public abstract class DbDataAdapter : DataAdapter, ICloneable
+ {
+ public const string DefaultSourceTableName = "default";
+
+ [MonoTODO]
+ protected DbDataAdapter() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int Fill (DataSet ds) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill (DataTable dt) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill (DataSet ds, string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill (DataTable dt, IDataReader idr) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill (DataTable dt,
+ IDbCommand idc,
+ CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill (DataSet ds, int i, int j, string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill (DataSet ds,
+ string s,
+ IDataReader idr,
+ int i,
+ int j) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill (DataSet ds,
+ int i,
+ int j,
+ string s,
+ IDbCommand idc,
+ CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override DataTable[] FillSchema (DataSet ds, SchemaType type) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable FillSchema (DataTable dt, SchemaType type) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable[] FillSchema (DataSet ds, SchemaType type, string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual DataTable FillSchema (DataTable dt,
+ SchemaType type,
+ IDbCommand idc,
+ CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual DataTable[] FillSchema (DataSet ds,
+ SchemaType type,
+ IDbCommand idc,
+ string s,
+ CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IDataParameter[] GetFillParameters() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update (DataRow[] row) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int Update (DataSet ds) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update (DataTable dt) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Update (DataRow[] row, DataTableMapping dtm) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update (DataSet ds, string s) {
+ throw new NotImplementedException ();
+ }
+
+ protected abstract RowUpdatedEventArgs CreateRowUpdatedEvent(
+ DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping);
+
+ protected abstract RowUpdatingEventArgs CreateRowUpdatingEvent(
+ DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping);
+
+ [MonoTODO]
+ protected virtual void OnFillError(FillErrorEventArgs value) {
+ throw new NotImplementedException ();
+ }
+
+ protected abstract void OnRowUpdated(RowUpdatedEventArgs value);
+
+ protected abstract void OnRowUpdating(RowUpdatingEventArgs value);
+
+ public event FillErrorEventHandler FillError;
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs b/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs
new file mode 100644
index 00000000000..f2e9de2d78c
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs
@@ -0,0 +1,86 @@
+//
+// System.Data.Common.DbDataAdapter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Data.Common
+{
+ /// <summary>
+ /// Provides the capability for a .NET data provider to ensure that a user has a security level adequate for accessing data.
+ /// </summary>
+ public abstract class DBDataPermission : CodeAccessPermission,
+ IUnrestrictedPermission
+ {
+ private bool allowBlankPassword;
+ private PermissionState permissionState;
+
+ protected DBDataPermission () {
+ allowBlankPassword = false;
+ permissionState = PermissionState.None;
+ }
+
+ protected DBDataPermission (PermissionState state) {
+ allowBlankPassword = false;
+ permissionState = state;
+ }
+
+ public DBDataPermission (PermissionState state, bool abp) {
+ allowBlankPassword = abp;
+ permissionState = state;
+ }
+
+ public override IPermission Copy () {
+ DbDataPermission copy = new DbDataPermission (
+ permissionState, allowBlankPassword);
+
+ return copy;
+ }
+
+ [MonoTODO]
+ public override void FromXml (SecurityElement securityElement) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect (IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf (IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ public bool IsUnrestricted () {
+ if (permissionState == PermissionState.Unrestricted)
+ return true;
+ return false;
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml () {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union (IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ public bool AllowBlankPassword {
+ get {
+ return allowBlankPassword;
+ }
+ set {
+ allowBlankPassword = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs b/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs
new file mode 100644
index 00000000000..842ea6570b1
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs
@@ -0,0 +1,36 @@
+//
+// System.Data.Common.DbDataPermissionAttribute.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System.Security.Permissions;
+
+namespace System.Data.Common
+{
+ /// <summary>
+ /// Associates a security action with a custom security attribute.
+ /// </summary>
+ public abstract class DBDataPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ private SecurityAction securityAction;
+ private bool allowBlankPassword;
+
+ protected DBDataPermissionAttribute (SecurityAction action) {
+ securityAction = action;
+ allowBlankPassword = false;
+ }
+
+ public bool AllowBlankPassword {
+ get {
+ return allowBlankPassword;
+ }
+ set {
+ allowBlankPassword = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/RowUpdatedEventArgs.cs b/mcs/class/System.Data/System.Data.Common/RowUpdatedEventArgs.cs
new file mode 100644
index 00000000000..ab3aebe4451
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/RowUpdatedEventArgs.cs
@@ -0,0 +1,64 @@
+//
+// System.Data.Common.RowUpdatedEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+using System.Data;
+
+namespace System.Data.Common
+{
+ /// <summary>
+ /// Provides data for the RowUpdated event of a .NET data provider.
+ /// </summary>
+ public abstract class RowUpdatedEventArgs : EventArgs
+ {
+ [MonoTODO]
+ protected RowUpdatedEventArgs(DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IDbCommand Command {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public Exception Errors {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int RecordsAffected {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public DataRow Row {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public StatementType StatementType {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public UpdateStatus Status {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public DataTableMapping TableMapping {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.Common/RowUpdatingEventArgs.cs b/mcs/class/System.Data/System.Data.Common/RowUpdatingEventArgs.cs
new file mode 100644
index 00000000000..6d5eae65d84
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.Common/RowUpdatingEventArgs.cs
@@ -0,0 +1,58 @@
+//
+// System.Data.Common.RowUpdatingEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc
+//
+
+namespace System.Data.Common
+{
+ /// <summary>
+ /// Provides the data for the RowUpdating event of a .NET data provider.
+ /// </summary>
+ public abstract class RowUpdatingEventArgs : EventArgs
+ {
+ [MonoTODO]
+ protected RowUpdatingEventArgs(DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IDbCommand Command {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public Exception Errors {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public DataRow Row {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public StatementType StatementType {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public UpdateStatus Status {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public DataTableMapping TableMapping {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/PostgresLibrary.cs b/mcs/class/System.Data/System.Data.SqlClient/PostgresLibrary.cs
new file mode 100644
index 00000000000..770f268763a
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/PostgresLibrary.cs
@@ -0,0 +1,471 @@
+//
+// System.Data.SqlClient.PostgresLibrary.cs
+//
+// PInvoke methods to libpq
+// which is PostgreSQL client library
+//
+// May also contain enumerations,
+// data types, or wrapper methods.
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+using System.Diagnostics;
+
+namespace System.Data.SqlClient
+{
+ /* IMPORTANT: DO NOT CHANGE ANY OF THESE ENUMS */
+
+ internal enum ConnStatusType
+ {
+ CONNECTION_OK,
+ CONNECTION_BAD,
+ CONNECTION_STARTED,
+ CONNECTION_MADE,
+ CONNECTION_AWAITING_RESPONSE,
+ CONNECTION_AUTH_OK,
+ CONNECTION_SETENV
+ }
+
+ internal enum PostgresPollingStatusType
+ {
+ PGRES_POLLING_FAILED = 0,
+ PGRES_POLLING_READING,
+ PGRES_POLLING_WRITING,
+ PGRES_POLLING_OK,
+ PGRES_POLLING_ACTIVE
+ }
+
+ internal enum ExecStatusType
+ {
+ PGRES_EMPTY_QUERY = 0,
+ PGRES_COMMAND_OK,
+ PGRES_TUPLES_OK,
+ PGRES_COPY_OUT,
+ PGRES_COPY_IN,
+ PGRES_BAD_RESPONSE,
+ PGRES_NONFATAL_ERROR,
+ PGRES_FATAL_ERROR
+ }
+
+ sealed internal class PostgresLibrary
+ {
+ #region PInvoke Functions
+
+ // pinvoke prototypes to PostgreSQL client library
+ // pq.dll on windows and libpq.so on linux
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconnectStart (string conninfo);
+ // PGconn *PQconnectStart(const char *conninfo);
+
+ [DllImport("pq")]
+ public static extern PostgresPollingStatusType PQconnectPoll (IntPtr conn);
+ // PostgresPollingStatusType PQconnectPoll(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconnectdb (string conninfo);
+ // PGconn *PQconnectdb(const char *conninfo);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQsetdbLogin (string pghost,
+ string pgport, string pgoptions,
+ string pgtty, string dbName,
+ string login, string pwd);
+ // PGconn *PQsetdbLogin(const char *pghost,
+ // const char *pgport, const char *pgoptions,
+ // const char *pgtty, const char *dbName,
+ // const char *login, const char *pwd);
+
+ [DllImport("pq")]
+ public static extern void PQfinish (IntPtr conn);
+ // void PQfinish(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQconndefaults ();
+ // PQconninfoOption *PQconndefaults(void);
+
+ [DllImport("pq")]
+ public static extern void PQconninfoFree (IntPtr connOptions);
+ // void PQconninfoFree(PQconninfoOption *connOptions);
+
+ [DllImport("pq")]
+ public static extern int PQresetStart (IntPtr conn);
+ // int PQresetStart(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQresetPoll (IntPtr conn);
+ // PostgresPollingStatusType PQresetPoll(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQreset (IntPtr conn);
+ // void PQreset(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQrequestCancel (IntPtr conn);
+ // int PQrequestCancel(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQdb (IntPtr conn);
+ // char *PQdb(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQuser (IntPtr conn);
+ // char *PQuser(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQpass (IntPtr conn);
+ // char *PQpass(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQhost (IntPtr conn);
+ // char *PQhost(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQport (IntPtr conn);
+ // char *PQport(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQtty (IntPtr conn);
+ // char *PQtty(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQoptions (IntPtr conn);
+ // char *PQoptions(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern ConnStatusType PQstatus (IntPtr conn);
+ // ConnStatusType PQstatus(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern string PQerrorMessage (IntPtr conn);
+ // char *PQerrorMessage(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsocket (IntPtr conn);
+ // int PQsocket(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQbackendPID (IntPtr conn);
+ // int PQbackendPID(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQclientEncoding (IntPtr conn);
+ // int PQclientEncoding(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsetClientEncoding (IntPtr conn,
+ string encoding);
+ // int PQsetClientEncoding(PGconn *conn,
+ // const char *encoding);
+
+ //FIXME: when loading, causes runtime exception
+ //[DllImport("pq")]
+ //public static extern IntPtr PQgetssl (IntPtr conn);
+ // SSL *PQgetssl(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQtrace (IntPtr conn,
+ IntPtr debug_port);
+ // void PQtrace(PGconn *conn,
+ // FILE *debug_port);
+
+ [DllImport("pq")]
+ public static extern void PQuntrace (IntPtr conn);
+ // void PQuntrace(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQsetNoticeProcessor (IntPtr conn,
+ IntPtr proc, IntPtr arg);
+ // PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn,
+ // PQnoticeProcessor proc, void *arg);
+
+ [DllImport("pq")]
+ public static extern int PQescapeString (string to,
+ string from, int length);
+ // size_t PQescapeString(char *to,
+ // const char *from, size_t length);
+
+ [DllImport("pq")]
+ public static extern string PQescapeBytea (string bintext,
+ int binlen, IntPtr bytealen);
+ // unsigned char *PQescapeBytea(unsigned char *bintext,
+ // size_t binlen, size_t *bytealen);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQexec (IntPtr conn,
+ string query);
+ // PGresult *PQexec(PGconn *conn,
+ // const char *query);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQnotifies (IntPtr conn);
+ // PGnotify *PQnotifies(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern void PQfreeNotify (IntPtr notify);
+ // void PQfreeNotify(PGnotify *notify);
+
+ [DllImport("pq")]
+ public static extern int PQsendQuery (IntPtr conn,
+ string query);
+ // int PQsendQuery(PGconn *conn,
+ // const char *query);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQgetResult (IntPtr conn);
+ // PGresult *PQgetResult(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQisBusy (IntPtr conn);
+ // int PQisBusy(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQconsumeInput (IntPtr conn);
+ // int PQconsumeInput(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQgetline (IntPtr conn,
+ string str, int length);
+ // int PQgetline(PGconn *conn,
+ // char *string, int length);
+
+ [DllImport("pq")]
+ public static extern int PQputline (IntPtr conn,
+ string str);
+ // int PQputline(PGconn *conn,
+ // const char *string);
+
+ [DllImport("pq")]
+ public static extern int PQgetlineAsync (IntPtr conn,
+ string buffer, int bufsize);
+ // int PQgetlineAsync(PGconn *conn, char *buffer,
+ // int bufsize);
+
+ [DllImport("pq")]
+ public static extern int PQputnbytes (IntPtr conn,
+ string buffer, int nbytes);
+ // int PQputnbytes(PGconn *conn,
+ //const char *buffer, int nbytes);
+
+ [DllImport("pq")]
+ public static extern int PQendcopy (IntPtr conn);
+ // int PQendcopy(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQsetnonblocking (IntPtr conn,
+ int arg);
+ // int PQsetnonblocking(PGconn *conn, int arg);
+
+ [DllImport("pq")]
+ public static extern int PQisnonblocking (IntPtr conn);
+ // int PQisnonblocking(const PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern int PQflush (IntPtr conn);
+ // int PQflush(PGconn *conn);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQfn (IntPtr conn, int fnid,
+ IntPtr result_buf, IntPtr result_len,
+ int result_is_int, IntPtr args,
+ int nargs);
+ // PGresult *PQfn(PGconn *conn, int fnid,
+ // int *result_buf, int *result_len,
+ // int result_is_int, const PQArgBlock *args,
+ // int nargs);
+
+ [DllImport("pq")]
+ public static extern ExecStatusType PQresultStatus (IntPtr res);
+ // ExecStatusType PQresultStatus(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQresStatus (ExecStatusType status);
+ // char *PQresStatus(ExecStatusType status);
+
+ [DllImport("pq")]
+ public static extern string PQresultErrorMessage (IntPtr res);
+ // char *PQresultErrorMessage(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQntuples (IntPtr res);
+ // int PQntuples(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQnfields (IntPtr res);
+ // int PQnfields(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQbinaryTuples (IntPtr res);
+ // int PQbinaryTuples(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQfname (IntPtr res,
+ int field_num);
+ // char *PQfname(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfnumber (IntPtr res,
+ string field_name);
+ // int PQfnumber(const PGresult *res,
+ // const char *field_name);
+
+ [DllImport("pq")]
+ public static extern int PQftype (IntPtr res,
+ int field_num);
+ // Oid PQftype(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfsize (IntPtr res,
+ int field_num);
+ // int PQfsize(const PGresult *res,
+ // int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQfmod (IntPtr res, int field_num);
+ // int PQfmod(const PGresult *res, int field_num);
+
+ [DllImport("pq")]
+ public static extern string PQcmdStatus (IntPtr res);
+ // char *PQcmdStatus(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQoidStatus (IntPtr res);
+ // char *PQoidStatus(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern int PQoidValue (IntPtr res);
+ // Oid PQoidValue(const PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQcmdTuples (IntPtr res);
+ // char *PQcmdTuples(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern string PQgetvalue (IntPtr res,
+ int tup_num, int field_num);
+ // char *PQgetvalue(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQgetlength (IntPtr res,
+ int tup_num, int field_num);
+ // int PQgetlength(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern int PQgetisnull (IntPtr res,
+ int tup_num, int field_num);
+ // int PQgetisnull(const PGresult *res,
+ // int tup_num, int field_num);
+
+ [DllImport("pq")]
+ public static extern void PQclear (IntPtr res);
+ // void PQclear(PGresult *res);
+
+ [DllImport("pq")]
+ public static extern IntPtr PQmakeEmptyPGresult (IntPtr conn,
+ IntPtr status);
+ // PGresult *PQmakeEmptyPGresult(PGconn *conn,
+ // ExecStatusType status);
+
+ [DllImport("pq")]
+ public static extern void PQprint (IntPtr fout,
+ IntPtr res, IntPtr ps);
+ // void PQprint(FILE *fout,
+ // const PGresult *res, const PQprintOpt *ps);
+
+ [DllImport("pq")]
+ public static extern void PQdisplayTuples (IntPtr res,
+ IntPtr fp, int fillAlign, string fieldSep,
+ int printHeader, int quiet);
+ // void PQdisplayTuples(const PGresult *res,
+ // FILE *fp, int fillAlign, const char *fieldSep,
+ // int printHeader, int quiet);
+
+ [DllImport("pq")]
+ public static extern void PQprintTuples (IntPtr res,
+ IntPtr fout, int printAttName, int terseOutput,
+ int width);
+ // void PQprintTuples(const PGresult *res,
+ // FILE *fout, int printAttName, int terseOutput,
+ // int width);
+
+ [DllImport("pq")]
+ public static extern int lo_open (IntPtr conn,
+ int lobjId, int mode);
+ // int lo_open(PGconn *conn,
+ // Oid lobjId, int mode);
+
+ [DllImport("pq")]
+ public static extern int lo_close (IntPtr conn, int fd);
+ // int lo_close(PGconn *conn, int fd);
+
+ [DllImport("pq")]
+ public static extern int lo_read (IntPtr conn,
+ int fd, string buf, int len);
+ // int lo_read(PGconn *conn,
+ // int fd, char *buf, size_t len);
+
+ [DllImport("pq")]
+ public static extern int lo_write (IntPtr conn,
+ int fd, string buf, int len);
+ // int lo_write(PGconn *conn,
+ // int fd, char *buf, size_t len);
+
+ [DllImport("pq")]
+ public static extern int lo_lseek (IntPtr conn,
+ int fd, int offset, int whence);
+ // int lo_lseek(PGconn *conn,
+ // int fd, int offset, int whence);
+
+ [DllImport("pq")]
+ public static extern int lo_creat (IntPtr conn,
+ int mode);
+ // Oid lo_creat(PGconn *conn,
+ // int mode);
+
+ [DllImport("pq")]
+ public static extern int lo_tell (IntPtr conn, int fd);
+ // int lo_tell(PGconn *conn, int fd);
+
+ [DllImport("pq")]
+ public static extern int lo_unlink (IntPtr conn,
+ int lobjId);
+ // int lo_unlink(PGconn *conn,
+ // Oid lobjId);
+
+ [DllImport("pq")]
+ public static extern int lo_import (IntPtr conn,
+ string filename);
+ // Oid lo_import(PGconn *conn,
+ // const char *filename);
+
+ [DllImport("pq")]
+ public static extern int lo_export (IntPtr conn,
+ int lobjId, string filename);
+ // int lo_export(PGconn *conn,
+ // Oid lobjId, const char *filename);
+
+ [DllImport("pq")]
+ public static extern int PQmblen (string s,
+ int encoding);
+ // int PQmblen(const unsigned char *s,
+ // int encoding);
+
+ [DllImport("pq")]
+ public static extern int PQenv2encoding ();
+ // int PQenv2encoding(void);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs
new file mode 100644
index 00000000000..3cb81e64401
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermission.cs
@@ -0,0 +1,76 @@
+//
+// System.Data.SqlClient.SqlClientPermission.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+
+ public sealed class SqlClientPermission : DBDataPermission {
+
+ [MonoTODO]
+ public SqlClientPermission() {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public SqlClientPermission(PermissionState state) {
+ // FIXME: do constructor
+ }
+
+ [MonoTODO]
+ public SqlClientPermission(PermissionState state,
+ bool allowBlankPassword) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Copy() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void FromXml(SecurityElement
+ securityElement) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Intersect(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsSubsetOf(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IPermission Union(IPermission target) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~SqlClientPermission() {
+ // FIXME: destructor to release resources
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermissionAttribute.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermissionAttribute.cs
new file mode 100644
index 00000000000..120ff3f1046
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlClientPermissionAttribute.cs
@@ -0,0 +1,51 @@
+//
+// System.Data.SqlClient.SqlClientPermissionAttribute.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+
+ [AttributeUsage(AttributeTargets.Assembly |
+ AttributeTargets.Class |
+ AttributeTargets.Struct |
+ AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class SqlClientPermissionAttribute :
+ DBDataPermissionAttribute {
+
+ [MonoTODO]
+ [AttributeUsage(AttributeTargets.Assembly |
+ AttributeTargets.Class |
+ AttributeTargets.Struct |
+ AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public SqlClientPermissionAttribute(SecurityAction action) {
+ // FIXME: do constructor
+ }
+
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
+ | AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public override IPermission CreatePermission() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~SqlClientPermissionAttribute() {
+ // FIXME: destructor to release resources
+ }
+ }
+
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs
new file mode 100644
index 00000000000..02151854f49
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs
@@ -0,0 +1,380 @@
+//
+// System.Data.SqlClient.SqlCommand.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+// use #define DEBUG_SqlCommand if you want to spew debug messages
+// #define DEBUG_SqlCommand
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Xml;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a SQL statement that is executed
+ /// while connected to a SQL database.
+ /// </summary>
+ // public sealed class SqlCommand : Component, IDbCommand, ICloneable
+ public sealed class SqlCommand : IDbCommand
+ {
+ // FIXME: Console.WriteLine() is used for debugging throughout
+
+ #region Fields
+
+ string sql = "";
+ int timeout = 30;
+ // default is 30 seconds
+ // for command execution
+
+ SqlConnection conn = null;
+ SqlTransaction trans = null;
+ CommandType cmdType = CommandType.Text;
+ bool designTime = false;
+ SqlParameterCollection parmCollection = new
+ SqlParameterCollection();
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public SqlCommand()
+ {
+ sql = "";
+ }
+
+ public SqlCommand (string cmdText)
+ {
+ sql = cmdText;
+ }
+
+ public SqlCommand (string cmdText, SqlConnection connection)
+ {
+ sql = cmdText;
+ conn = connection;
+ }
+
+ public SqlCommand (string cmdText, SqlConnection connection,
+ SqlTransaction transaction)
+ {
+ sql = cmdText;
+ conn = connection;
+ trans = transaction;
+ }
+
+ #endregion // Constructors
+
+ #region Methods
+
+ [MonoTODO]
+ public void Cancel ()
+ {
+ // FIXME: use non-blocking Exec for this
+ throw new NotImplementedException ();
+ }
+
+ // FIXME: is this the correct way to return a stronger type?
+ [MonoTODO]
+ IDbDataParameter IDbCommand.CreateParameter ()
+ {
+ return CreateParameter ();
+ }
+
+ [MonoTODO]
+ public SqlParameter CreateParameter ()
+ {
+ return new SqlParameter ();
+ }
+
+ [MonoTODO]
+ public int ExecuteNonQuery ()
+ {
+ IntPtr pgResult; // PGresult
+ int rowsAffected = -1;
+ ExecStatusType execStatus;
+ String rowsAffectedString;
+
+ if(conn.State != ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnnectionState is not Open");
+
+ // FIXME: PQexec blocks
+ // while PQsendQuery is non-blocking
+ // which is better to use?
+ // int PQsendQuery(PGconn *conn,
+ // const char *query);
+
+ // execute SQL command
+ // uses internal property to get the PGConn IntPtr
+ pgResult = PostgresLibrary.
+ PQexec (conn.PostgresConnection, sql);
+
+ execStatus = PostgresLibrary.
+ PQresultStatus (pgResult);
+
+ if(execStatus == ExecStatusType.PGRES_COMMAND_OK)
+ {
+ rowsAffectedString = PostgresLibrary.
+ PQcmdTuples (pgResult);
+#if DEBUG_SqlCommand
+ Console.WriteLine("rowsAffectedString: " +
+ rowsAffectedString);
+#endif // DEBUG_SqlCommand
+ if(rowsAffectedString != null)
+ if(rowsAffectedString.Equals("") == false)
+ rowsAffected = int.Parse(rowsAffectedString);
+ }
+ else
+ {
+ String errorMessage;
+
+ errorMessage = PostgresLibrary.
+ PQresStatus(execStatus);
+
+ errorMessage += " " + PostgresLibrary.
+ PQresultErrorMessage(pgResult);
+
+ throw new SqlException(0, 0,
+ errorMessage, 0, "",
+ conn.DataSource, "SqlCommand", 0);
+ }
+#if DEBUG_SqlCommand
+ String cmdStatus;
+ cmdStatus = PostgresLibrary.
+ PQcmdStatus(pgResult);
+
+ Console.WriteLine("*** Command Status: " +
+ cmdStatus);
+#endif // DEBUG_SqlCommand
+ PostgresLibrary.PQclear (pgResult);
+
+ // FIXME: get number of rows
+ // affected for INSERT, UPDATE, or DELETE
+ // any other, return -1 (such as, CREATE TABLE)
+ return rowsAffected;
+ }
+
+ // FIXME: temporarily commmented out, so I could get a simple working
+ // SqlConnection and SqlCommand. I had to temporarily
+ // comment it out the ExecuteReader in IDbCommand as well.
+ /*
+ [MonoTODO]
+ IDataReader IDbCommand.ExecuteReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ SqlDataReader ExecuteReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ IDataReader IDbCommand.ExecuteReader (
+ CommandBehavior behavior)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlDataReader ExecuteReader (CommandBehavior behavior)
+ {
+ throw new NotImplementedException ();
+ }
+ */
+
+ [MonoTODO]
+ public object ExecuteScalar ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlReader ExecuteXmlReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Prepare ()
+ {
+ // FIXME: parameters have to be implemented for this
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ #region Properties
+
+ public string CommandText {
+ get {
+ return sql;
+ }
+
+ set {
+ sql = value;
+ }
+ }
+
+ public int CommandTimeout {
+ get {
+ return timeout;
+ }
+
+ set {
+ // FIXME: if value < 0, throw
+ // ArgumentException
+ // if (value < 0)
+ // throw ArgumentException;
+ timeout = value;
+ }
+ }
+
+ public CommandType CommandType {
+ get {
+ return cmdType;
+ }
+
+ set {
+ cmdType = value;
+ }
+ }
+
+ // FIXME: for property Connection, is this the correct
+ // way to handle a return of a stronger type?
+ IDbConnection IDbCommand.Connection {
+ get {
+ return Connection;
+ }
+
+ set {
+ // FIXME: throw an InvalidOperationException
+ // if the change was during a
+ // transaction in progress
+
+ // csc
+ Connection = (SqlConnection) value;
+ // mcs
+ // Connection = value;
+
+ // FIXME: set Transaction property to null
+ }
+ }
+
+ public SqlConnection Connection {
+ get {
+ // conn defaults to null
+ return conn;
+ }
+
+ set {
+ // FIXME: throw an InvalidOperationException
+ // if the change was during
+ // a transaction in progress
+ conn = value;
+ // FIXME: set Transaction property to null
+ }
+ }
+
+ public bool DesignTimeVisible {
+ get {
+ return designTime;
+ }
+
+ set{
+ designTime = value;
+ }
+ }
+
+ // FIXME; for property Parameters, is this the correct
+ // way to handle a stronger return type?
+ IDataParameterCollection IDbCommand.Parameters {
+ get {
+ return Parameters;
+ }
+ }
+
+ SqlParameterCollection Parameters {
+ get {
+ return parmCollection;
+ }
+ }
+
+ // FIXME: for property Transaction, is this the correct
+ // way to handle a return of a stronger type?
+ IDbTransaction IDbCommand.Transaction {
+ get {
+ return Transaction;
+ }
+
+ set {
+ // FIXME: error handling - do not allow
+ // setting of transaction if transaction
+ // has already begun
+
+ // csc
+ Transaction = (SqlTransaction) value;
+ // mcs
+ // Transaction = value;
+ }
+ }
+
+ public SqlTransaction Transaction {
+ get {
+ return trans;
+ }
+
+ set {
+ // FIXME: error handling
+ trans = value;
+ }
+ }
+
+ [MonoTODO]
+ public UpdateRowSource UpdatedRowSource {
+ // FIXME: do this once DbDataAdaptor
+ // and DataRow are done
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Destructors
+
+ [MonoTODO]
+ public void Dispose() {
+ // FIXME: need proper way to release resources
+ // Dispose(true);
+ }
+
+ [MonoTODO]
+ ~SqlCommand()
+ {
+ // FIXME: need proper way to release resources
+ // Dispose(false);
+ }
+
+ #endregion //Destructors
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs
new file mode 100644
index 00000000000..d2b028bc652
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommandBuilder.cs
@@ -0,0 +1,103 @@
+//
+// System.Data.SqlClient.SqlCommandBuilder.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.ComponentModel;
+
+namespace System.Data.SqlClient {
+
+ /// <summary>
+ /// Builder of one command
+ /// that will be used in manipulating a table for
+ /// a DataSet that is assoicated with a database.
+ /// </summary>
+ public sealed class SqlCommandBuilder : Component {
+
+ [MonoTODO]
+ public SqlCommandBuilder() {
+
+ }
+
+ [MonoTODO]
+ public SqlCommandBuilder(SqlDataAdapter adapter) {
+
+ }
+
+ [MonoTODO]
+ public SqlDataAdapter DataAdapter {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set{
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string QuotePrefix {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string QuoteSuffix {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public static void DeriveParameters(SqlCommand command) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand GetDeleteCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand GetInsertCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlCommand GetUpdateCommand() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RefreshSchema() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override void Dispose(bool disposing) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~SqlCommandBuilder() {
+ // FIXME: create destructor - release resources
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
new file mode 100644
index 00000000000..9b0ab2280f9
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
@@ -0,0 +1,528 @@
+//
+// System.Data.SqlClient.SqlConnection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+// use #define DEBUG_SqlConnection if you want to spew debug messages
+// #define DEBUG_SqlConnection
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace System.Data.SqlClient
+{
+ // using PGconn = IntPtr;
+ // PGconn is native C library type in libpq for Postgres Connection
+
+ // using PGressult = IntPtr;
+ // PGresult is native C library type in libpq for Postgres Resultset
+
+ /// <summary>
+ /// Represents an open connection to a SQL data source
+ /// </summary>
+ //public sealed class SqlConnection : Component, IDbConnection,
+ // ICloneable
+ public sealed class SqlConnection : IDbConnection
+ {
+ // FIXME: Need to implement class Component,
+ // and interfaces: ICloneable and IDisposable
+
+ #region Fields
+
+ private IntPtr pgConn = IntPtr.Zero;
+ // PGConn (Postgres Connection)
+ private string connectionString = "";
+ // OLE DB Connection String
+ private string pgConnectionString = "";
+ // PostgreSQL Connection String
+ private SqlTransaction trans = null;
+ private int connectionTimeout = 15;
+ // default for 15 seconds
+
+ // connection parameters in connection string
+ private string host = "";
+ // Name of host to connect to
+ private string hostaddr = "";
+ // IP address of host to connect to
+ // should be in "n.n.n.n" format
+ private string port = "";
+ // Port number to connect to at the server host
+ private string dbname = ""; // The database name.
+ private string user = ""; // User name to connect as.
+ private string password = "";
+ // Password to be used if the server
+ // demands password authentication.
+ private string options = "";
+ // Trace/debug options to be sent to the server.
+ private string tty = "";
+ // A file or tty for optional
+ // debug output from the backend.
+ private string requiressl = "";
+ // Set to 1 to require
+ // SSL connection to the backend.
+ // Libpq will then refuse to connect
+ // if the server does not
+ // support SSL. Set to 0 (default) to
+ // negotiate with server.
+
+ ConnectionState conState = ConnectionState.Closed;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ /*
+ [MonoTODO]
+ public SqlConnection ()
+ {
+ this.ConnectionString = null;
+ this.ConnectionTimeout = 0;
+ this.Database = null;
+ this.State = 0;
+ }
+
+ [MonoTODO]
+ public SqlConnection (string cs) : SqlConnection ()
+ {
+ this.ConnectionString = cs;
+ }
+
+ */
+ // A lot of the defaults were initialized in the Fields
+ [MonoTODO]
+ public SqlConnection ()
+ {
+
+ }
+
+ [MonoTODO]
+ public SqlConnection (String connectionString)
+ {
+ SetConnectionString (connectionString);
+ }
+
+ #endregion // Constructors
+
+ #region Destructors
+
+ [MonoTODO]
+ public void Dispose () {
+ // FIXME: release resources properly
+ Close ();
+ // Dispose (true);
+ }
+
+ // aka Finalize
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ [MonoTODO]
+ ~SqlConnection()
+ {
+ // FIXME: this class need
+ // a destructor to release resources
+ // Also, take a look at Dispose
+ // Dispose (false);
+ }
+
+ #endregion // Destructors
+
+ #region Public Methods
+
+ IDbTransaction IDbConnection.BeginTransaction ()
+ {
+ return BeginTransaction ();
+ }
+
+ public SqlTransaction BeginTransaction ()
+ {
+ return TransactionBegin (); // call private method
+ }
+
+ IDbTransaction IDbConnection.BeginTransaction (IsolationLevel
+ il)
+ {
+ return BeginTransaction (il);
+ }
+
+ public SqlTransaction BeginTransaction (IsolationLevel il)
+ {
+ return TransactionBegin (il); // call private method
+ }
+
+ // PostgreSQL does not support named transactions/savepoint
+ // nor nested transactions
+ [Obsolete]
+ public SqlTransaction BeginTransaction(string transactionName) {
+ return TransactionBegin (); // call private method
+ }
+
+ [Obsolete]
+ public SqlTransaction BeginTransaction(IsolationLevel iso,
+ string transactionName) {
+ return TransactionBegin (iso); // call private method
+ }
+
+ [MonoTODO]
+ public void ChangeDatabase (string databaseName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Close ()
+ {
+ CloseDataSource ();
+ }
+
+ IDbCommand IDbConnection.CreateCommand ()
+ {
+ return CreateCommand ();
+ }
+
+ public SqlCommand CreateCommand ()
+ {
+ SqlCommand sqlcmd = new SqlCommand ("", this);
+
+ return sqlcmd;
+ }
+
+ [MonoTODO]
+ public void Open ()
+ {
+ OpenDataSource ();
+ }
+
+ #endregion // Public Methods
+
+ #region Internal Methods
+
+ // this is for System.Data.SqlClient classes
+ // to get the Postgres connection
+ internal IntPtr PostgresConnection {
+ get {
+ return pgConn;
+ }
+ }
+
+ #endregion // Internal Methods
+
+ #region Protected Methods
+
+ // FIXME: protected override void Dispose overrides Component
+ // however, including Component causes other problems
+ /*
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+ */
+
+ #endregion
+
+ #region Private Methods
+
+ private void OpenDataSource ()
+ {
+ if(dbname.Equals(""))
+ throw new InvalidOperationException(
+ "dbname missing");
+ else if(conState == ConnectionState.Open)
+ throw new InvalidOperationException(
+ "ConnnectionState is already Open");
+
+ ConnStatusType connStatus;
+
+ // FIXME: check to make sure we have
+ // everything to connect,
+ // otherwise, throw an exception
+
+ pgConn = PostgresLibrary.PQconnectdb
+ (pgConnectionString);
+
+ // FIXME: should we use PQconnectStart/PQconnectPoll
+ // instead of PQconnectdb?
+ // PQconnectdb blocks
+ // PQconnectStart/PQconnectPoll is non-blocking
+
+ connStatus = PostgresLibrary.PQstatus (pgConn);
+ if(connStatus == ConnStatusType.CONNECTION_OK)
+ {
+ // Successfully Connected
+ conState = ConnectionState.Open;
+ }
+ else
+ {
+ String errorMessage = PostgresLibrary.
+ PQerrorMessage (pgConn);
+ errorMessage += ": Could not connect to database.";
+
+ throw new SqlException(0, 0,
+ errorMessage, 0, "",
+ host, "SqlConnection", 0);
+ }
+ }
+
+ private void CloseDataSource ()
+ {
+ // FIXME: just a quick hack
+ conState = ConnectionState.Closed;
+ PostgresLibrary.PQfinish (pgConn);
+ }
+
+ private void SetConnectionString (string connectionString)
+ {
+ // FIXME: perform error checking on string
+ // while translating string from
+ // OLE DB format to PostgreSQL
+ // connection string format
+ //
+ // OLE DB: "host=localhost;dbname=test;user=joe;password=smoe"
+ // PostgreSQL: "host=localhost dbname=test user=joe password=smoe"
+ //
+ // For OLE DB, you would have the additional
+ // "provider=postgresql"
+ // OleDbConnection you would be using libgda, maybe
+ // it would be
+ // "provider=OAFIID:GNOME_Database_Postgres_Provider"
+ // instead.
+ //
+ // Also, parse the connection string into properties
+
+ // FIXME: if connection is open, you can
+ // not set the connection
+ // string, throw an exception
+
+ this.connectionString = connectionString;
+ pgConnectionString = ConvertStringToPostgres (
+ connectionString);
+
+#if DEBUG_SqlConnection
+ Console.WriteLine(
+ "OLE-DB Connection String [in]: " +
+ this.ConnectionString);
+ Console.WriteLine(
+ "Postgres Connection String [out]: " +
+ pgConnectionString);
+#endif // DEBUG_SqlConnection
+ }
+
+ private String ConvertStringToPostgres (String
+ oleDbConnectionString)
+ {
+ StringBuilder postgresConnection =
+ new StringBuilder();
+ string result;
+ string[] connectionParameters;
+
+ char[] semicolon = new Char[1];
+ semicolon[0] = ';';
+
+ // FIXME: what is the max number of value pairs
+ // can there be for the OLE DB
+ // connnection string? what about libgda max?
+ // what about postgres max?
+
+ // FIXME: currently assuming value pairs are like:
+ // "key1=value1;key2=value2;key3=value3"
+ // Need to deal with values that have
+ // single or double quotes. And error
+ // handling of that too.
+ // "key1=value1;key2='value2';key=\"value3\""
+
+ // FIXME: put the connection parameters
+ // from the connection
+ // string into a
+ // Hashtable (System.Collections)
+ // instead of using private variables
+ // to store them
+ connectionParameters = oleDbConnectionString.
+ Split (semicolon);
+ foreach (string sParameter in connectionParameters) {
+ if(sParameter.Length > 0) {
+ BreakConnectionParameter (sParameter);
+ postgresConnection.
+ Append (sParameter +
+ " ");
+ }
+ }
+ result = postgresConnection.ToString ();
+ return result;
+ }
+
+ private bool BreakConnectionParameter (String sParameter)
+ {
+ bool addParm = true;
+ int index;
+
+ index = sParameter.IndexOf ("=");
+ if (index > 0) {
+ string parmKey, parmValue;
+
+ // separate string "key=value" to
+ // string "key" and "value"
+ parmKey = sParameter.Substring (0, index);
+ parmValue = sParameter.Substring (index + 1,
+ sParameter.Length - index - 1);
+
+ switch(parmKey.ToLower()) {
+ case "hostaddr":
+ hostaddr = parmValue;
+ break;
+
+ case "port":
+ port = parmValue;
+ break;
+
+ case "host":
+ // set DataSource property
+ host = parmValue;
+ break;
+
+ case "dbname":
+ // set Database property
+ dbname = parmValue;
+ break;
+
+ case "user":
+ user = parmValue;
+ break;
+
+ case "password":
+ password = parmValue;
+ // addParm = false;
+ break;
+
+ case "options":
+ options = parmValue;
+ break;
+
+ case "tty":
+ tty = parmValue;
+ break;
+
+ case "requiressl":
+ requiressl = parmValue;
+ break;
+ }
+ }
+ return addParm;
+ }
+
+ private SqlTransaction TransactionBegin ()
+ {
+ // FIXME: need to keep track of
+ // transaction in-progress
+ trans = new SqlTransaction ();
+ // using internal methods of SqlTransaction
+ trans.SetConnection (this);
+ trans.Begin();
+
+ return trans;
+ }
+
+ private SqlTransaction TransactionBegin (IsolationLevel il)
+ {
+ // FIXME: need to keep track of
+ // transaction in-progress
+ TransactionBegin();
+ trans.SetIsolationLevel (il);
+
+ return trans;
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public ConnectionState State {
+ get {
+ return conState;
+ }
+ }
+
+ public string ConnectionString {
+ get {
+ return connectionString;
+ }
+ set {
+ SetConnectionString (value);
+ }
+ }
+
+ public int ConnectionTimeout {
+ get {
+ return connectionTimeout;
+ }
+ }
+
+ public string Database {
+ get {
+ return dbname;
+ }
+ }
+
+ public string DataSource {
+ get {
+ return host;
+ }
+ }
+
+ /*
+ * FIXME: this is here because of Component?
+ [MonoTODO]
+ protected bool DesignMode {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ */
+ public int PacketSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public string ServerVersion {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ internal SqlTransaction Transaction {
+ get {
+ return trans;
+ }
+ }
+
+ #endregion
+
+ #region Events and Delegates
+
+ // FIXME: the two events belong here
+ // however, i do not know about the delegates
+ // also, they are stubs for now
+ /*
+ public delegate void
+ SqlInfoMessageEventHandler (object sender,
+ SqlInfoMessageEventArgs e);
+
+ public event
+ SqlInfoMessageEventHandler InfoMessage;
+
+ public event
+ StateChangeEventHandler StateChange;
+ */
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs
new file mode 100644
index 00000000000..e30bc74677b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlDataAdapter.cs
@@ -0,0 +1,231 @@
+//
+// System.Data.SqlClient.SqlDataAdapter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a set of command-related properties that are used
+ /// to fill the DataSet and update a data source, all this
+ /// from a SQL database.
+ /// </summary>
+ public sealed class SqlDataAdapter : DbDataAdapter, IDbDataAdapter
+ {
+ #region Properties
+
+ [MonoTODO]
+ public SqlCommand DeleteCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public SqlCommand InsertCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public SqlCommand SelectCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public SqlCommand UpdateCommand {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override int Fill(DataSet dataSet) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill(DataTable dataTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill(DataSet dataSet, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataTable dataTable,
+ IDataReader dataReader) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataTable dataTable,
+ IDbCommand command,
+ CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Fill(DataSet dataSet, int startRecord,
+ int maxRecords, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataSet dataSet,
+ string srcTable, IDataReader dataReader,
+ int startRecord, int maxRecords) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Fill(DataSet dataSet,
+ int startRecord, int maxRecords,
+ string srcTable, IDbCommand command,
+ CommandBehavior behavior) {
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override DataTable[] FillSchema(DataSet dataSet,
+ SchemaType schemaType) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable FillSchema(DataTable dataTable,
+ SchemaType schemaType) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable[] FillSchema(DataSet dataSet,
+ SchemaType schemaType, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual DataTable FillSchema(DataTable dataTable,
+ SchemaType schemaType, IDbCommand command,
+ CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual DataTable[] FillSchema(DataSet dataSet,
+ SchemaType schemaType, IDbCommand command,
+ string srcTable, CommandBehavior behavior) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override IDataParameter[] GetFillParameters() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update(DataRow[] dataRows) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int Update(DataSet dataSet) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update(DataTable dataTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual int Update(DataRow[] dataRows,
+ DataTableMapping tableMapping) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Update(DataSet dataSet, string srcTable) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override RowUpdatedEventArgs CreateRowUpdatedEvent(
+ DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override RowUpdatingEventArgs CreateRowUpdatingEvent(
+ DataRow dataRow,
+ IDbCommand command,
+ StatementType statementType,
+ DataTableMapping tableMapping) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void OnFillError(FillErrorEventArgs value) {
+ throw new NotImplementedException ();
+ }
+
+ protected override void OnRowUpdated(RowUpdatedEventArgs value) {
+ throw new NotImplementedException ();
+ }
+
+ protected override void OnRowUpdating(RowUpdatingEventArgs value) {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ public event FillErrorEventHandler FillError;
+
+ public event SqlRowUpdatedEventHandler RowUpdated;
+
+ public event SqlRowUpdatingEventHandler RowUpdating;
+
+ #endregion // Events and Delegates
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs
new file mode 100644
index 00000000000..f9d1f2bfe76
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs
@@ -0,0 +1,263 @@
+//
+// System.Data.SqlClient.SqlDataReader.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Provides a means of reading one or more forward-only streams
+ /// of result sets obtained by executing a command
+ /// at a SQL database.
+ /// </summary>
+ //public sealed class SqlDataReader : MarshalByRefObject,
+ // IEnumerable, IDataReader, IDisposable, IDataRecord
+ public sealed class SqlDataReader : IEnumerable,
+ IDataReader, IDataRecord
+ {
+ #region Fields
+
+ DataTable tableSchema;
+ DataTable tableRow;
+
+ #endregion // Fields
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void Close()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable GetSchemaTable()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool NextResult()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Read()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public byte GetByte(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetBytes(int i, long fieldOffset,
+ byte[] buffer, int bufferOffset,
+ int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public char GetChar(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetChars(int i, long fieldOffset,
+ char[] buffer, int bufferOffset,
+ int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IDataReader GetData(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetDataTypeName(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DateTime GetDateTime(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public decimal GetDecimal(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public double GetDouble(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Type GetFieldType(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public float GetFloat(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Guid GetGuid(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public short GetInt16(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetInt32(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetInt64(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetName(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetOrdinal(string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetString(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetValue(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetValues(object[] values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsDBNull(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool GetBoolean(int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Public Methods
+
+ #region // Destructors
+
+ [MonoTODO]
+ public void Dispose () {
+ }
+
+ [MonoTODO]
+ ~SqlDataReader() {
+ }
+
+ #endregion // Destructors
+
+
+ #region Properties
+
+ public int Depth {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool IsClosed {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int RecordsAffected {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int FieldCount {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public object this[string name] {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public object this[int i] {
+ [MonoTODO]
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlError.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlError.cs
new file mode 100644
index 00000000000..e7c722285a9
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlError.cs
@@ -0,0 +1,155 @@
+//
+// System.Data.SqlClient.SqlError.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+using System;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Describes an error from a SQL database.
+ /// </summary>
+ [MonoTODO]
+ public sealed class SqlError
+ {
+ byte theClass = 0;
+ int lineNumber = 0;
+ string message = "";
+ int number = 0;
+ string procedure = "";
+ string server = "";
+ string source = "";
+ byte state = 0;
+
+ internal SqlError(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+ this.theClass = theClass;
+ this.lineNumber = lineNumber;
+ this.message = message;
+ this.number = number;
+ this.procedure = procedure;
+ this.server = server;
+ this.source = source;
+ this.state = state;
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ /// <summary>
+ /// severity level of the error
+ /// </summary>
+ public byte Class {
+ get {
+ return theClass;
+ }
+ }
+
+ [MonoTODO]
+ public int LineNumber {
+ get {
+ return lineNumber;
+ }
+ }
+
+ [MonoTODO]
+ public string Message {
+ get {
+ return message;
+ }
+ }
+
+ [MonoTODO]
+ public int Number {
+ get {
+ return number;
+ }
+ }
+
+ [MonoTODO]
+ public string Procedure {
+ get {
+ return procedure;
+ }
+ }
+
+ [MonoTODO]
+ public string Server {
+ get {
+ return server;
+ }
+ }
+
+ [MonoTODO]
+ public string Source {
+ get {
+ return source;
+ }
+ }
+
+ [MonoTODO]
+ public byte State {
+ get {
+ return state;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ String toStr;
+ String stackTrace;
+ stackTrace = " <Stack Trace>";
+ // FIXME: generate the correct SQL error string
+ toStr = "SqlError:" + message + stackTrace;
+ return toStr;
+ }
+
+ internal void SetClass(byte theClass) {
+ this.theClass = theClass;
+ }
+
+ internal void SetLineNumber(int lineNumber) {
+ this.lineNumber = lineNumber;
+ }
+
+ internal void SetMessage(string message) {
+ this.message = message;
+ }
+
+ internal void SetNumber(int number) {
+ this.number = number;
+ }
+
+ internal void SetProcedure(string procedure) {
+ this.procedure = procedure;
+ }
+
+ internal void SetServer(string server) {
+ this.server = server;
+ }
+
+ internal void SetSource(string source) {
+ this.source = source;
+ }
+
+ internal void SetState(byte state) {
+ this.state = state;
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlErrorCollection.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlErrorCollection.cs
new file mode 100644
index 00000000000..7050d5d08fa
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlErrorCollection.cs
@@ -0,0 +1,114 @@
+//
+// System.Data.SqlClient.SqlError.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+using System;
+using System.Collections;
+using System.Data;
+using System.Runtime.InteropServices;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Describes an error from a SQL database.
+ /// </summary>
+ [MonoTODO]
+ public sealed class SqlErrorCollection : ICollection, IEnumerable
+ {
+ ArrayList errorList = new ArrayList();
+
+ internal SqlErrorCollection() {
+ }
+
+ internal SqlErrorCollection(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ Add (theClass, lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ public int Count {
+ get {
+ return errorList.Count;
+ }
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index) {
+ throw new NotImplementedException ();
+ }
+
+ // [MonoTODO]
+ bool ICollection.IsSynchronized {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // [MonoTODO]
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException ();
+ }
+
+ // Index property (indexer)
+ // [MonoTODO]
+ public SqlError this[int index] {
+ get {
+ return (SqlError) errorList[index];
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override string ToString()
+ {
+ throw new NotImplementedException ();
+ }
+ #endregion
+
+ internal void Add(SqlError error) {
+ errorList.Add(error);
+ }
+
+ internal void Add(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ SqlError error = new SqlError(theClass,
+ lineNumber, message,
+ number, procedure,
+ server, source, state);
+ Add(error);
+ }
+
+ #region Destructors
+
+ [MonoTODO]
+ ~SqlErrorCollection()
+ {
+ // FIXME: do the destructor - release resources
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlException.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlException.cs
new file mode 100644
index 00000000000..89983847d55
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlException.cs
@@ -0,0 +1,202 @@
+//
+// System.Data.SqlClient.SqlException.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc
+//
+using System;
+using System.Data;
+using System.Runtime.Serialization;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Exceptions, as returned by SQL databases.
+ /// </summary>
+ public sealed class SqlException : SystemException
+ {
+ private SqlErrorCollection errors;
+
+ internal SqlException() {
+ errors = new SqlErrorCollection();
+ }
+
+ internal SqlException(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ errors = new SqlErrorCollection (theClass,
+ lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ #region Properties
+
+ [MonoTODO]
+ public byte Class {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception here?
+ else
+ return errors[0].Class;
+ }
+
+ set {
+ errors[0].SetClass(value);
+ }
+ }
+
+ [MonoTODO]
+ public SqlErrorCollection Errors {
+ get {
+ return errors;
+ }
+
+ set {
+ errors = value;
+ }
+ }
+
+ [MonoTODO]
+ public int LineNumber {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception here?
+ return errors[0].LineNumber;
+ }
+
+ set {
+ errors[0].SetLineNumber(value);
+ }
+ }
+
+ [MonoTODO]
+ public override string Message {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else {
+ String msg = "";
+ int i = 0;
+
+ for(i = 0; i < errors.Count - 1; i++) {
+ msg = msg + errors[i].Message + "\n";
+ }
+ msg = msg + errors[i].Message;
+
+ return msg;
+ }
+ }
+ }
+
+ [MonoTODO]
+ public int Number {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception?
+ else
+ return errors[0].Number;
+ }
+
+ set {
+ errors[0].SetNumber(value);
+ }
+ }
+
+ [MonoTODO]
+ public string Procedure {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Procedure;
+ }
+
+ set {
+ errors[0].SetProcedure(value);
+ }
+ }
+
+ [MonoTODO]
+ public string Server {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Server;
+ }
+
+ set {
+ errors[0].SetServer(value);
+ }
+ }
+
+ [MonoTODO]
+ public override string Source {
+ get {
+ if(errors.Count == 0)
+ return ""; // FIXME: throw exception?
+ else
+ return errors[0].Source;
+ }
+
+ set {
+ errors[0].SetSource(value);
+ }
+ }
+
+ [MonoTODO]
+ public byte State {
+ get {
+ if(errors.Count == 0)
+ return 0; // FIXME: throw exception?
+ else
+ return errors[0].State;
+ }
+
+ set {
+ errors[0].SetState(value);
+ }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public override void GetObjectData(SerializationInfo si,
+ StreamingContext context) {
+ // FIXME: to do
+ }
+
+ // [Serializable]
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ public override string ToString() {
+ String toStr = "";
+ for (int i = 0; i < errors.Count; i++) {
+ toStr = toStr + errors[i].ToString() + "\n";
+ }
+ return toStr;
+ }
+
+ internal void Add(byte theClass, int lineNumber,
+ string message, int number, string procedure,
+ string server, string source, byte state) {
+
+ errors.Add (theClass, lineNumber, message,
+ number, procedure,
+ server, source, state);
+ }
+
+ [MonoTODO]
+ ~SqlException() {
+ // FIXME: destructor to release resources
+ }
+
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventArgs.cs
new file mode 100644
index 00000000000..67eaba58482
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventArgs.cs
@@ -0,0 +1,50 @@
+//
+// System.Data.SqlClient.SqlInfoMessageEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public sealed class SqlInfoMessageEventArgs : EventArgs
+ {
+ [MonoTODO]
+ public SqlErrorCollection Errors {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string Message
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string Source {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ // representation of InfoMessage event
+ }
+
+ [MonoTODO]
+ ~SqlInfoMessageEventArgs() {
+ // FIXME: destructor needs to release resources
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventHandler.cs
new file mode 100644
index 00000000000..c9862d61c03
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlInfoMessageEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Data.SqlClient.SqlInfoMessageEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public delegate void
+ SqlInfoMessageEventHandler (object sender,
+ SqlInfoMessageEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs
new file mode 100644
index 00000000000..31f500ffdff
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlParameter.cs
@@ -0,0 +1,196 @@
+//
+// System.Data.SqlClient.SqlParameter.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+using System.Runtime.InteropServices;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a parameter to a Command object, and optionally,
+ /// its mapping to DataSet columns; and is implemented by .NET
+ /// data providers that access data sources.
+ /// </summary>
+ //public sealed class SqlParameter : MarshalByRefObject,
+ // IDbDataParameter, IDataParameter, ICloneable
+ public sealed class SqlParameter : IDbDataParameter, IDataParameter
+ {
+ [MonoTODO]
+ public SqlParameter () {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter (string parameterName, object value) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType,
+ int size) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType,
+ int size, string sourceColumn) {
+ // FIXME: do this
+ }
+
+ [MonoTODO]
+ public SqlParameter(string parameterName, SqlDbType dbType,
+ int size, ParameterDirection direction,
+ bool isNullable, byte precision,
+ byte scale, string sourceColumn,
+ DataRowVersion sourceVersion, object value) {
+ // FIXME: do this
+ }
+
+
+ [MonoTODO]
+ public DbType DbType {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public ParameterDirection Direction {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public bool IsNullable {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int Offset {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string ParameterName {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public string SourceColumn {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public DataRowVersion SourceVersion {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public SqlDbType SqlDbType {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public object Value {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public byte Precision {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public byte Scale {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public int Size
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs
new file mode 100644
index 00000000000..7b665dd0b1e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlParameterCollection.cs
@@ -0,0 +1,231 @@
+//
+// System.Data.SqlClient.SqlParameterCollection.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.ComponentModel;
+using System.Data;
+using System.Collections;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Collects all parameters relevant to a Command object
+ /// and their mappings to DataSet columns.
+ /// </summary>
+ // public sealed class SqlParameterCollection : MarshalByRefObject,
+ // IDataParameterCollection, IList, ICollection, IEnumerable
+ public sealed class SqlParameterCollection : IDataParameterCollection
+ {
+ [MonoTODO]
+ public void RemoveAt(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // [MonoTODO]
+ public object this[string parameterName]
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int Add( object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(SqlParameter value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName, SqlDbType sqlDbType)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName,
+ SqlDbType sqlDbType, int size)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlParameter Add(string parameterName,
+ SqlDbType sqlDbType, int size, string sourceColumn)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Clear()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Contains(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+/*
+ [MonoTODO]
+ public bool Contains(string value)
+ {
+ throw new NotImplementedException ();
+ }
+
+*/
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int IndexOf(object value)
+ {
+ throw new NotImplementedException ();
+ }
+/*
+ [MonoTODO]
+ public int IndexOf(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+*/
+ [MonoTODO]
+ public void Insert(int index, object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Remove(object value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RemoveAt(int index)
+ {
+ throw new NotImplementedException ();
+ }
+/*
+ [MonoTODO]
+ public void RemoveAt(string parameterName)
+ {
+ throw new NotImplementedException ();
+ }
+*/
+/*
+ [MonoTODO]
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDual)]
+ ~SqlParameterCollection();
+*/
+
+ [MonoTODO]
+ public int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // [MonoTODO]
+ object IList.this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ // [MonoTODO]
+ public SqlParameter this[int index] {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+/*
+ [MonoTODO]
+ public SqlParameter this[string parameterName] {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+*/
+
+ bool IList.IsFixedSize {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool IList.IsReadOnly {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs
new file mode 100644
index 00000000000..6c561ba14da
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventArgs.cs
@@ -0,0 +1,38 @@
+//
+// System.Data.SqlClient.SqlRowUpdatedEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient {
+ public sealed class SqlRowUpdatedEventArgs : RowUpdatedEventArgs {
+
+ [MonoTODO]
+ public SqlRowUpdatedEventArgs (DataRow row,
+ IDbCommand command, StatementType statementType,
+ DataTableMapping tableMapping) {
+ // FIXME: do the constructor
+ }
+
+ [MonoTODO]
+ public new SqlCommand Command {
+ get {
+
+ }
+ }
+
+ [MonoTODO]
+ ~SqlRowUpdatedEventArgs () {
+ // FIXME: need destructor to release resources
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventHandler.cs
new file mode 100644
index 00000000000..8cad2f1cbca
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.SqlClient.SqlRowUpdatedEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public delegate void SqlRowUpdatedEventHandler(object sender,
+ SqlRowUpdatedEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs
new file mode 100644
index 00000000000..2390374899b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventArgs.cs
@@ -0,0 +1,42 @@
+//
+// System.Data.SqlClient.SqlRowUpdatingEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient
+{
+ public sealed class SqlRowUpdatingEventArgs : RowUpdatingEventArgs
+ {
+ [MonoTODO]
+ public SqlRowUpdatingEventArgs( DataRow row,
+ IDbCommand command, StatementType statementType,
+ DataTableMapping tableMapping) {
+ // FIXME: do the constructor
+ }
+
+ [MonoTODO]
+ public new SqlCommand Command {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ ~SqlRowUpdatingEventArgs() {
+ // FIXME: create destructor to release resources
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventHandler.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventHandler.cs
new file mode 100644
index 00000000000..69c0228534d
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlRowUpdatingEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.SqlClient.SqlRowUpdatingEventHandler.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace System.Data.SqlClient
+{
+ public delegate void SqlRowUpdatingEventHandler(object sender,
+ SqlRowUpdatingEventArgs e);
+}
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs
new file mode 100644
index 00000000000..3a485b299c5
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlClient/SqlTransaction.cs
@@ -0,0 +1,191 @@
+//
+// System.Data.SqlClient.SqlTransaction.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+// use #define DEBUG_SqlTransaction if you want to spew debug messages
+// #define DEBUG_SqlTransaction
+
+
+using System;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.SqlClient
+{
+ /// <summary>
+ /// Represents a transaction to be performed on a SQL database.
+ /// </summary>
+ // public sealed class SqlTransaction : MarshalByRefObject,
+ // IDbTransaction, IDisposable
+ public sealed class SqlTransaction : IDbTransaction
+ {
+ #region Fields
+
+ private bool doingTransaction = false;
+ private SqlConnection conn = null;
+ private IsolationLevel isolationLevel =
+ IsolationLevel.ReadCommitted;
+ // There are only two IsolationLevel's for PostgreSQL:
+ // ReadCommitted and Serializable,
+ // but ReadCommitted is the default
+
+ #endregion
+
+ #region Public Methods
+
+ [MonoTODO]
+ public void Commit ()
+ {
+ if(doingTransaction == false)
+ throw new InvalidOperationException(
+ "Begin transaction was not " +
+ "done earlier " +
+ "thus PostgreSQL can not " +
+ "Commit transaction.");
+
+ SqlCommand cmd = new SqlCommand("COMMIT", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = false;
+ }
+
+ [MonoTODO]
+ public void Rollback()
+ {
+ if(doingTransaction == false)
+ throw new InvalidOperationException(
+ "Begin transaction was not " +
+ "done earlier " +
+ "thus PostgreSQL can not " +
+ "Rollback transaction.");
+
+ SqlCommand cmd = new SqlCommand("ROLLBACK", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = false;
+ }
+
+ // For PostgreSQL, Rollback(string) will not be implemented
+ // because PostgreSQL does not support Savepoints
+ [Obsolete]
+ public void Rollback(string transactionName) {
+ // throw new NotImplementedException ();
+ Rollback();
+ }
+
+ // For PostgreSQL, Save(string) will not be implemented
+ // because PostgreSQL does not support Savepoints
+ [Obsolete]
+ public void Save (string savePointName) {
+ // throw new NotImplementedException ();
+ }
+
+ #endregion // Public Methods
+
+ #region Internal Methods to System.Data.dll Assembly
+
+ internal void Begin()
+ {
+ if(doingTransaction == true)
+ throw new InvalidOperationException(
+ "Transaction has begun " +
+ "and PostgreSQL does not " +
+ "support nested transactions.");
+
+ SqlCommand cmd = new SqlCommand("BEGIN", conn);
+ cmd.ExecuteNonQuery();
+
+ doingTransaction = true;
+ }
+
+ internal void SetIsolationLevel(IsolationLevel isoLevel)
+ {
+ String sSql = "SET TRANSACTION ISOLATION LEVEL ";
+
+ switch (isoLevel)
+ {
+ case IsolationLevel.ReadCommitted:
+ sSql += "READ COMMITTED";
+ break;
+
+ case IsolationLevel.Serializable:
+ sSql += "SERIALIZABLE";
+ break;
+
+ default:
+ // FIXME: generate exception here
+ // PostgreSQL only supports:
+ // ReadCommitted or Serializable
+ break;
+ }
+ SqlCommand cmd = new SqlCommand(sSql, conn);
+ cmd.ExecuteNonQuery();
+
+ this.isolationLevel = isoLevel;
+ }
+
+ internal void SetConnection(SqlConnection connection)
+ {
+ this.conn = connection;
+ }
+
+ #endregion // Internal Methods to System.Data.dll Assembly
+
+ #region Properties
+
+ IDbConnection IDbTransaction.Connection {
+ get {
+ return Connection;
+ }
+ }
+
+ public SqlConnection Connection {
+ get {
+ return conn;
+ }
+ }
+
+ public IsolationLevel IsolationLevel {
+ get {
+ return isolationLevel;
+ }
+ }
+
+ internal bool DoingTransaction {
+ get {
+ return doingTransaction;
+ }
+ }
+
+ #endregion Properties
+
+ #region Destructors
+
+ // Destructors aka Finalize and Dispose
+
+ [MonoTODO]
+ public void Dispose()
+ {
+ // FIXME: need to properly release resources
+ // Dispose(true);
+ }
+
+ // Destructor
+ [MonoTODO]
+ // [Serializable]
+ // [ClassInterface(ClassInterfaceType.AutoDual)]
+ ~SqlTransaction() {
+ // FIXME: need to properly release resources
+ // Dispose(false);
+ }
+
+ #endregion // Destructors
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/INullable.cs b/mcs/class/System.Data/System.Data.SqlTypes/INullable.cs
new file mode 100644
index 00000000000..d70a6f6b686
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/INullable.cs
@@ -0,0 +1,22 @@
+//
+// System.Data.SqlTypes.INullable
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Data.SqlTypes
+{
+ /// <summary>
+ /// All of the System.Data.SqlTypes objects and structures implement the INullable interface, reflecting the fact that, unlike the corresponding system types, SqlTypes can legally contain the value null.
+ /// </summary>
+ public interface INullable
+ {
+ [MonoTODO]
+ bool IsNull {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlBinary.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlBinary.cs
new file mode 100644
index 00000000000..1d0d344af21
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlBinary.cs
@@ -0,0 +1,155 @@
+//
+// System.Data.SqlTypes.SqlBinary
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Data.SqlTypes
+{
+ /// <summary>
+ /// Represents a variable-length stream of binary data to be stored in or retrieved from a database.
+ /// </summary>
+ public struct SqlBinary : INullable, IComparable
+ {
+ public static readonly SqlBinary Null;
+
+ [MonoTODO]
+ public SqlBinary (byte[] value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int CompareTo (object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBinary Concat (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Equals (object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean Equals(SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode () {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean GreaterThan (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean GreaterThanOrEqual (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean LessThan (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean LessThanOrEqual (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean NotEquals (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlGuid ToSqlGuid () {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString () {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsNull {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public byte this[int index] {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int Length {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public byte[] Value {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public static SqlBinary operator + (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean operator == (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean operator > (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean operator >= (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean operator != (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean operator < (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static SqlBoolean operator <= (SqlBinary x, SqlBinary y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static explicit operator byte[] (SqlBinary x) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlBinary (SqlGuid x) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static implicit operator SqlBinary (byte[] x) {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlBoolean.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlBoolean.cs
new file mode 100644
index 00000000000..2498533f356
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlBoolean.cs
@@ -0,0 +1,300 @@
+//
+// System.Data.SqlTypes.SqlBoolean
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+namespace System.Data.SqlTypes
+{
+ /// <summary>
+ /// Represents an integer value that is either 1 or 0
+ /// to be stored in or retrieved from a database.
+ /// </summary>
+ public struct SqlBoolean : INullable, IComparable {
+
+ #region Fields
+
+ // FIXME: populate the static Fields?
+
+ // Value
+ public static readonly SqlBoolean False;
+
+ // Value
+ public static readonly SqlBoolean Null;
+
+ // ByteValue
+ public static readonly SqlBoolean One;
+
+ // Value
+ public static readonly SqlBoolean True;
+
+ // ByteValue
+ public static readonly SqlBoolean Zero;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public SqlBoolean(bool value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SqlBoolean(int value) {
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public byte ByteValue {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool IsFalse {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool IsNull {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool IsTrue {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public bool Value {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion // Properties
+
+ [MonoTODO]
+ public static SqlBoolean And(SqlBoolean x, SqlBoolean y) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int CompareTo(object value) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool Equals(object value) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean Equals(SqlBoolean x, SqlBoolean y) {
+ }
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean NotEquals(SqlBoolean x, SqlBoolean y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean OnesComplement(SqlBoolean x) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean Or(SqlBoolean x, SqlBoolean y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean Parse(string s) {
+ }
+
+ [MonoTODO]
+ public SqlByte ToSqlByte() {
+ }
+
+ // **************************************************
+ // Conversion from SqlBoolean to other SqlTypes
+ // **************************************************
+
+ [MonoTODO]
+ public SqlDecimal ToSqlDecimal() {
+ }
+
+ [MonoTODO]
+ public SqlDouble ToSqlDouble() {
+ }
+
+ [MonoTODO]
+ public SqlInt16 ToSqlInt16() {
+ }
+
+ [MonoTODO]
+ public SqlInt32 ToSqlInt32() {
+ }
+
+ [MonoTODO]
+ public SqlInt64 ToSqlInt64() {
+ }
+
+ [MonoTODO]
+ public SqlMoney ToSqlMoney() {
+ }
+
+ [MonoTODO]
+ public SqlSingle ToSqlSingle() {
+ }
+
+ [MonoTODO]
+ public SqlString ToSqlString() {
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ }
+
+ // Bitwise exclusive-OR (XOR)
+ [MonoTODO]
+ public static SqlBoolean Xor(SqlBoolean x, SqlBoolean y) {
+ }
+
+ // **************************************************
+ // Public Operators
+ // **************************************************
+
+ // Bitwise AND
+ [MonoTODO]
+ public static SqlBoolean operator &(SqlBoolean x, SqlBoolean y) {
+ }
+
+ // Bitwise OR
+ [MonoTODO]
+ public static SqlBoolean operator |(SqlBoolean x, SqlBoolean y) {
+ }
+
+ // Compares two instances for equality
+ [MonoTODO]
+ public static SqlBoolean operator ==(SqlBoolean x, SqlBoolean y) {
+ }
+
+ // Bitwize exclusive-OR (XOR)
+ [MonoTODO]
+ public static SqlBoolean operator ^(SqlBoolean x, SqlBoolean y) {
+ }
+
+ // test Value of SqlBoolean to determine it is false.
+ [MonoTODO]
+ public static bool operator false(SqlBoolean x) {
+ }
+
+ // in-equality
+ [MonoTODO]
+ public static SqlBoolean operator !=(SqlBoolean x, SqlBoolean y) {
+ }
+
+ // Logical NOT
+ [MonoTODO]
+ public static SqlBoolean operator !(SqlBoolean x) {
+ }
+
+ // One's Complement
+ [MonoTODO]
+ public static SqlBoolean operator ~(SqlBoolean x) {
+ }
+
+ // test to see if value is true
+ [MonoTODO]
+ public static bool operator true(SqlBoolean x) {
+ }
+
+ // ****************************************
+ // Type Conversion
+ // ****************************************
+
+
+ // SqlBoolean to Boolean
+ [MonoTODO]
+ public static explicit operator bool(SqlBoolean x) {
+ }
+
+
+ // SqlByte to SqlBoolean
+ [MonoTODO]
+ public static explicit operator SqlBoolean(SqlByte x) {
+ }
+
+ // SqlDecimal to SqlBoolean
+ [MonoTODO]
+ public static explicit operator SqlBoolean(SqlDecimal x) {
+ }
+
+ // SqlDouble to SqlBoolean
+ [MonoTODO]
+ public static explicit operator SqlBoolean(SqlDouble x) {
+ }
+
+ // SqlInt16 to SqlBoolean
+ [MonoTODO]
+ public static explicit operator SqlBoolean(SqlInt16 x) {
+ }
+
+ // SqlInt32 to SqlBoolean
+ [MonoTODO]
+ public static explicit operator SqlBoolean(SqlInt32 x) {
+ }
+
+ // SqlInt64 to SqlBoolean
+ [MonoTODO]
+ public static explicit operator SqlBoolean(SqlInt64 x) {
+ }
+
+ // SqlMoney to SqlBoolean
+ [MonoTODO]
+ public static explicit operator SqlBoolean(SqlMoney x) {
+ }
+
+ // SqlSingle to SqlBoolean
+ [MonoTODO]
+ public static explicit operator SqlBoolean(SqlSingle x) {
+ }
+
+ // SqlString to SqlBoolean
+ [MonoTODO]
+ public static explicit operator SqlBoolean(SqlString x) {
+ }
+
+ // Boolean to SqlBoolean
+ [MonoTODO]
+ public static implicit operator SqlBoolean(bool x) {
+ }
+
+ [MonoTODO]
+ ~SqlBoolean() {
+ // FIXME: do the destructor to release resources
+ }
+
+
+
+
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlCompareOptions.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlCompareOptions.cs
new file mode 100644
index 00000000000..56583b1e78c
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlCompareOptions.cs
@@ -0,0 +1,29 @@
+//
+// System.Data.SqlTypes.SqlCompareOptions.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+namespace System.Data.SqlTypes
+{
+ /// <summary>
+ /// compare option values for SqlString
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum SqlCompareOptions {
+ BinarySort,
+ IgnoreCase,
+ IgnoreKanaType,
+ IgnoreNonSpace,
+ IgnoreWidth,
+ None
+ }
+
+}
+
+
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlInt32.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlInt32.cs
new file mode 100644
index 00000000000..33602598958
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlInt32.cs
@@ -0,0 +1,304 @@
+//
+// System.Data.SqlTypes.SqlInt32
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+namespace System.Data.SqlTypes
+{
+
+ /// <summary>
+ /// a 32-bit signed integer to be used in reading or writing
+ /// of data from a database
+ /// </summary>
+ public struct SqlInt32 : INullable, IComparable {
+ // FIXME: Fields need to be initialized
+
+ // Constructor
+ [MonoTODO]
+ public SqlInt32(int value) {
+ }
+
+ // Fields (Constants)
+
+ public static readonly SqlInt32 MaxValue;
+
+ public static readonly SqlInt32 MinValue;
+
+ public static readonly SqlInt32 Null;
+
+ public static readonly SqlInt32 Zero;
+
+ // Public Properties
+
+ public bool IsNull {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ public int Value {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ // Public Methods
+
+ [MonoTODO]
+ public static SqlInt32 Add(SqlInt32 x, SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public static SqlInt32 BitwiseAnd(SqlInt32 x, SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public static SqlInt32 BitwiseOr(SqlInt32 x, SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public int CompareTo(object value) {
+ }
+
+ [MonoTODO]
+ public static SqlInt32 Divide(SqlInt32 x, SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public override bool Equals(object value) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean Equals(SqlInt32 x, SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean GreaterThan(SqlInt32 x,
+ SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean GreaterThanOrEqual(SqlInt32 x,
+ SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean LessThan(SqlInt32 x, SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean LessThanOrEqual(SqlInt32 x,
+ SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public static SqlInt32 Mod(SqlInt32 x, SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public static SqlInt32 Multiply(SqlInt32 x,
+ SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean NotEquals(SqlInt32 x,
+ SqlInt32 y) {
+ }
+
+ [MonoTODO]
+ public static SqlInt32 OnesComplement(SqlInt32 x) {
+ }
+
+ [MonoTODO]
+ public static SqlInt32 Parse(string s) {
+ }
+
+ [MonoTODO]
+ public static SqlInt32 Subtract(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // Type Conversions
+
+ [MonoTODO]
+ public SqlBoolean ToSqlBoolean() {
+ }
+
+ [MonoTODO]
+ public SqlByte ToSqlByte() {
+ }
+
+ [MonoTODO]
+ public SqlDecimal ToSqlDecimal() {
+ }
+
+ [MonoTODO]
+ public SqlDouble ToSqlDouble() {
+ }
+
+ [MonoTODO]
+ public SqlInt16 ToSqlInt16() {
+ }
+
+ [MonoTODO]
+ public SqlInt64 ToSqlInt64() {
+ }
+
+ [MonoTODO]
+ public SqlMoney ToSqlMoney() {
+ }
+
+ [MonoTODO]
+ public SqlSingle ToSqlSingle() {
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ }
+
+ [MonoTODO]
+ public static SqlInt32 Xor(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // Public Operators
+
+ // Compute Addition
+ [MonoTODO]
+ public static SqlInt32 operator +(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // Bitwise AND
+ [MonoTODO]
+ public static SqlInt32 operator &(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // Bitwise OR
+ [MonoTODO]
+ public static SqlInt32 operator |(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // Compute Division
+ [MonoTODO]
+ public static SqlInt32 operator /(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // Compare Equality
+ [MonoTODO]
+ public static SqlBoolean operator ==(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // Bitwise Exclusive-OR (XOR)
+ [MonoTODO]
+ public static SqlInt32 operator ^(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // > Compare
+ [MonoTODO]
+ public static SqlBoolean operator >(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // >= Compare
+ [MonoTODO]
+ public static SqlBoolean operator >=(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // != Inequality Compare
+ [MonoTODO]
+ public static SqlBoolean operator !=(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // < Compare
+ [MonoTODO]
+ public static SqlBoolean operator <(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // <= Compare
+ [MonoTODO]
+ public static SqlBoolean operator <=(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // Compute Modulus
+ [MonoTODO]
+ public static SqlInt32 operator %(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // Compute Multiplication
+ [MonoTODO]
+ public static SqlInt32 operator *(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // Ones Complement
+ [MonoTODO]
+ public static SqlInt32 operator ~(SqlInt32 x) {
+ }
+
+ // Subtraction
+ [MonoTODO]
+ public static SqlInt32 operator -(SqlInt32 x, SqlInt32 y) {
+ }
+
+ // Negates the Value
+ [MonoTODO]
+ public static SqlInt32 operator -(SqlInt32 x) {
+ }
+
+ // Type Conversions
+
+ [MonoTODO]
+ public static explicit operator SqlInt32(SqlBoolean x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlInt32(SqlDecimal x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlInt32(SqlDouble x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator int(SqlInt32 x){
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlInt32(SqlInt64 x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlInt32(SqlMoney x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlInt32(SqlSingle x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlInt32(SqlString x) {
+ }
+
+ [MonoTODO]
+ public static implicit operator SqlInt32(int x) {
+ }
+
+ [MonoTODO]
+ public static implicit operator SqlInt32(SqlByte x) {
+ }
+
+ [MonoTODO]
+ public static implicit operator SqlInt32(SqlInt16 x) {
+ }
+
+ [MonoTODO]
+ ~SqlInt32() {
+ // FIXME: does this class need a Finalize?
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs b/mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs
new file mode 100644
index 00000000000..23746c7067e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.SqlTypes/SqlString.cs
@@ -0,0 +1,344 @@
+//
+// System.Data.SqlTypes.SqlString
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc. 2002
+//
+
+namespace System.Data.SqlTypes
+{
+ /// <summary>
+ /// A variable-length stream of characters
+ /// to be stored in or retrieved from the database
+ /// </summary>
+ public struct SqlString : INullable, IComparable {
+
+ // FIXME: the static readonly fields need to be initlized
+
+ #region Constructors
+
+ // init with a string data
+ [MonoTODO]
+ public SqlString(string data) {
+ }
+
+ // init with a string data and locale id values.
+ [MonoTODO]
+ public SqlString(string data, int lcid) {
+ }
+
+ // init with locale id, compare options,
+ // and an array of bytes data
+ [MonoTODO]
+ public SqlString(int lcid, SqlCompareOptions compareOptions,
+ byte[] data) {
+ }
+
+ // init with string data, locale id, and compare options
+ [MonoTODO]
+ public SqlString(string data, int lcid,
+ SqlCompareOptions compareOptions) {
+ }
+
+ // init with locale id, compare options, array of bytes data,
+ // and whether unicode is encoded or not
+ [MonoTODO]
+ public SqlString(int lcid, SqlCompareOptions compareOptions,
+ byte[] data, bool fUnicode) {
+ }
+
+ // init with locale id, compare options, array of bytes data,
+ // starting index in the byte array,
+ // and number of bytes to copy
+ [MonoTODO]
+ public SqlString(int lcid, SqlCompareOptions compareOptions,
+ byte[] data, int index, int count) {
+ }
+
+ // init with locale id, compare options, array of bytes data,
+ // starting index in the byte array, number of byte to copy,
+ // and whether unicode is encoded or not
+ [MonoTODO]
+ public SqlString(int lcid, SqlCompareOptions compareOptions,
+ byte[] data, int index, int count, bool fUnicode) {
+ }
+
+ #endregion // Constructors
+
+ #region Public Fields
+
+ public static readonly int BinarySort;
+
+ public static readonly int IgnoreCase;
+
+ public static readonly int IgnoreKanaType;
+
+ public static readonly int IgnoreNonSpace;
+
+ public static readonly int IgnoreWidth;
+
+ public static readonly SqlString Null;
+
+ #endregion // Fields
+
+ #region Public Properties
+
+ public CompareInfo CompareInfo {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ public CultureInfo CultureInfo {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ public bool IsNull {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ // geographics location and language (locale id)
+ public int LCID {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ public SqlCompareOptions SqlCompareOptions {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ public string Value {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ #endregion // Public Properties
+
+ #region Public Methods
+
+ [MonoTODO]
+ public SqlString Clone() {
+ }
+
+ [MonoTODO]
+ public static CompareOptions
+ CompareOptionsFromSqlCompareOptions (
+ SqlCompareOptions compareOptions) {
+ }
+
+ // **********************************
+ // Comparison Methods
+ // **********************************
+
+ [MonoTODO]
+ public int CompareTo(object value){
+ }
+
+ [MonoTODO]
+ public static SqlString Concat(SqlString x, SqlString y) {
+ }
+
+ [MonoTODO]
+ public override bool Equals(object value) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean Equals(SqlString x, SqlString y) {
+ }
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ }
+
+ [MonoTODO]
+ public byte[] GetNonUnicodeBytes() {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean GreaterThan(SqlString x,
+ SqlString y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean GreaterThanOrEqual(SqlString x,
+ SqlString y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean LessThan(SqlString x, SqlString y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean LessThanOrEqual(SqlString x,
+ SqlString y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean NotEquals(SqlString x, SqlString y) {
+ }
+
+ // ****************************************
+ // Type Conversions From SqlString To ...
+ // ****************************************
+
+ [MonoTODO]
+ public SqlBoolean ToSqlBoolean() {
+ }
+
+ [MonoTODO]
+ public SqlByte ToSqlByte() {
+ }
+
+ [MonoTODO]
+ public SqlDateTime ToSqlDateTime() {
+ }
+
+ [MonoTODO]
+ public SqlDecimal ToSqlDecimal() {
+ }
+
+ [MonoTODO]
+ public SqlDouble ToSqlDouble() {
+ }
+
+ [MonoTODO]
+ public SqlGuid ToSqlGuid() {
+ }
+
+ [MonoTODO]
+ public SqlInt16 ToSqlInt16() {
+ }
+
+ [MonoTODO]
+ public SqlInt32 ToSqlInt32() {
+ }
+
+ [MonoTODO]
+ public SqlInt64 ToSqlInt64() {
+ }
+
+ [MonoTODO]
+ public SqlMoney ToSqlMoney() {
+ }
+
+ [MonoTODO]
+ public SqlSingle ToSqlSingle() {
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ }
+
+ // ***********************************
+ // Operators
+ // ***********************************
+
+ // Concatenates
+ [MonoTODO]
+ public static SqlString operator +(SqlString x, SqlString y) {
+ }
+
+ // Equality
+ [MonoTODO]
+ public static SqlBoolean operator ==(SqlString x,
+ SqlString y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean operator >(SqlString x,
+ SqlString y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean operator >=(SqlString x,
+ SqlString y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean operator !=(SqlString x,
+ SqlString y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean operator <(SqlString x,
+ SqlString y) {
+ }
+
+ [MonoTODO]
+ public static SqlBoolean operator <=(SqlString x,
+ SqlString y) {
+ }
+
+ // **************************************
+ // Type Conversions
+ // **************************************
+
+ [MonoTODO]
+ public static explicit operator SqlString(SqlBoolean x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlString(SqlByte x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlString(SqlDateTime x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlString(SqlDecimal x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlString(SqlDouble x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlString(SqlGuid x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlString(SqlInt16 x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlString(SqlInt32 x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlString(SqlInt64 x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlString(SqlMoney x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator SqlString(SqlSingle x) {
+ }
+
+ [MonoTODO]
+ public static explicit operator string(SqlString x) {
+ }
+
+ [MonoTODO]
+ public static implicit operator SqlString(string x) {
+ }
+
+ [MonoTODO]
+ ~SqlString() {
+ // FIXME: does SqlString need a destructor?
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data.build b/mcs/class/System.Data/System.Data.build
new file mode 100644
index 00000000000..cdafc342d2c
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.build
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Data.dll -->
+
+<project name="System.Data" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/System.Data.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="System.Data/Constraint.cs"/>
+ <excludes name="System.Data/ConstraintCollection.cs"/>
+ <excludes name="System.Data/InternalDataCollectionBase.cs"/>
+ <excludes name="System.Data/DataColumn.cs"/>
+ <excludes name="System.Data/DataRow.cs"/>
+ <excludes name="System.Data/DataTableRelationCollection.cs"/>
+ <excludes name="System.Data/DataRelationCollection.cs"/>
+ <excludes name="System.Data/DataTable.cs"/>
+ <excludes name="System.Data/DataSet.cs"/>
+ <excludes name="Test/**"/>
+ <excludes name="System.Data.Common/*"/>
+ <excludes name="System.Data.SqlClient/SqlDataAdapter.cs"/>
+ <excludes name="System.Data.SqlClient/SqlDataReader.cs"/>
+ <excludes name="System.Data.SqlClient/SqlInfoMessageEventArgs.cs"/>
+ <excludes name="System.Data.SqlClient/SqlRowUpdatingEventArgs.cs"/>
+ <excludes name="System.Data.SqlClient/SqlRowUpdatedEventArgs.cs"/>
+ <excludes name="System.Data.SqlClient/SqlInfoMessageEventHandler.cs"/>
+ <excludes name="System.Data.SqlClient/SqlRowUpdatingEventHandler.cs"/>
+ <excludes name="System.Data.SqlClient/SqlRowUpdatedEventHandler.cs"/>
+ <excludes name="System.Data.SqlClient/SqlClientPermission.cs"/>
+ <excludes name="System.Data.SqlClient/SqlClientPermissionAttribute.cs"/>
+ <excludes name="System.Data.SqlClient/SqlCommandBuilder.cs"/>
+ <excludes name="System.Data.SqlTypes/*"/>
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ <includes name="../lib/System.dll"/>
+ <includes name="../lib/System.Xml.dll"/>
+ </references>
+ </csc>
+ </target>
+ <target name="clean">
+ <delete file="../lib/System.Data.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.Data/System.Data/AcceptRejectRule.cs b/mcs/class/System.Data/System.Data/AcceptRejectRule.cs
new file mode 100644
index 00000000000..bb98d27cf03
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/AcceptRejectRule.cs
@@ -0,0 +1,23 @@
+//
+// System.Data.AcceptRejectRule.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+
+ /// <summary>
+ /// Determines the action that occurs when the AcceptChanges or RejectChanges method is invoked on a DataTable with a ForeignKeyConstraint.
+ /// </summary>
+ [Serializable]
+ public enum AcceptRejectRule
+ {
+ Cascade = 1,
+ None = 0
+ }
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/CommandBehavior.cs b/mcs/class/System.Data/System.Data/CommandBehavior.cs
new file mode 100644
index 00000000000..918722e1937
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/CommandBehavior.cs
@@ -0,0 +1,30 @@
+//
+// System.Data.CommandBehavior.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+
+ /// <summary>
+ /// Specifies a description of the results and the affect on the database of the query command.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum CommandBehavior
+ {
+ Default = 0,
+ SingleResult = 1,
+ SchemaOnly = 2,
+ KeyInfo = 4,
+ SingleRow = 8,
+ SequentialAccess = 16,
+ CloseConnection = 32
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/CommandType.cs b/mcs/class/System.Data/System.Data/CommandType.cs
new file mode 100644
index 00000000000..61bf5be81cb
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/CommandType.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.CommandType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies how a command string is interpreted.
+ /// </summary>
+ [Serializable]
+ public enum CommandType
+ {
+ Text = 1,
+ StoredProcedure = 4,
+ TableDirect = 512
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/ConnectionState.cs b/mcs/class/System.Data/System.Data/ConnectionState.cs
new file mode 100644
index 00000000000..63f51af0ea8
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ConnectionState.cs
@@ -0,0 +1,30 @@
+//
+// System.Data.ConnectionState.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+
+ /// <summary>
+ /// Returns the current state of the connection to a data source.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum ConnectionState
+ {
+ Closed = 0,
+ Open = 1,
+ Connecting = 2,
+ Executing = 4,
+ Fetching = 8,
+ Broken = 16
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/Constraint.cs b/mcs/class/System.Data/System.Data/Constraint.cs
new file mode 100644
index 00000000000..80d0a78c5ac
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/Constraint.cs
@@ -0,0 +1,59 @@
+//
+// System.Data.Constraint.cs
+//
+// Author:
+// Daniel Morgan
+//
+// (C) Ximian, Inc. 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace System.Data
+{
+ [Serializable]
+ public abstract class Constraint {
+
+ [MonoTODO]
+ [Serializable]
+ protected Constraint() {
+ }
+
+ [Serializable]
+ public virtual string ConstraintName {
+ [MonoTODO]
+ get{
+ }
+
+ [MonoTODO]
+ set{
+ }
+ }
+
+ [Serializable]
+ public PropertyCollection ExtendedProperties {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ [Serializable]
+ public abstract DataTable Table {
+ get;
+ }
+
+ [MonoTODO]
+ [Serializable]
+ public override string ToString() {
+ }
+
+ [MonoTODO]
+ [Serializable]
+ [ClassInterface(ClassInterfaceType.AutoDual)]
+ ~Constraint() {
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/ConstraintCollection.cs b/mcs/class/System.Data/System.Data/ConstraintCollection.cs
new file mode 100644
index 00000000000..97eca9c56b6
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ConstraintCollection.cs
@@ -0,0 +1,137 @@
+//
+// System.Data.ConstraintCollection.cs
+//
+// Author:
+// Daniel Morgan
+//
+// (C) Ximian, Inc. 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ /// <summary>
+ /// hold collection of constraints for data table
+ /// </summary>
+ public class ConstraintCollection : InternalDataCollectionBase {
+
+ [MonoTODO]
+ [Serializable]
+ public virtual Constraint this[string name] {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ [MonoTODO]
+ [Serializable]
+ public virtual Constraint this[int index] {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ // Overloaded Add method (5 of them)
+ // to add Constraint object to the collection
+
+ [Serializable]
+ [MonoTODO]
+ public void Add(Constraint constraint) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public virtual Constraint Add(string name,
+ DataColumn column, bool primaryKey) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public virtual Constraint Add(string name,
+ DataColumn primaryKeyColumn,
+ DataColumn foreignKeyColumn) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public virtual Constraint Add(string name,
+ DataColumn[] columns, bool primaryKey) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public virtual Constraint Add(string name,
+ DataColumn[] primaryKeyColumns,
+ DataColumn[] foreignKeyColumns) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public void AddRange(Constraint[] constraints) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public bool CanRemove(Constraint constraint) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public void Clear() {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public bool Contains(string name) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public int IndexOf(Constraint constraint) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public virtual int IndexOf(string constraintName) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public void Remove(Constraint constraint) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public void Remove(string name) {
+ }
+
+ [Serializable]
+ [MonoTODO]
+ public void RemoveAt(int index) {
+ }
+
+ /*
+ * FIXME: fix this event
+ [Serializable]
+ [MonoTODO]
+ public event CollectionChangeEventHandler CollectionChanged;
+ */
+
+ [Serializable]
+ protected override ArrayList List {
+ [MonoTODO]
+ get{
+ }
+ }
+
+ [Serializable]
+ [MonoTODO]
+ protected virtual void OnCollectionChanged(
+ CollectionChangeEventArgs ccevent) {
+ }
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataColumn.cs b/mcs/class/System.Data/System.Data/DataColumn.cs
new file mode 100644
index 00000000000..aaf3c9f2f32
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataColumn.cs
@@ -0,0 +1,358 @@
+//
+// System.Data.DataColumn.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Chris Podurgiel
+// (C) Ximian, Inc 2002
+//
+
+
+using System;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Summary description for DataColumn.
+ /// </summary>
+ public class DataColumn
+ {
+ private bool allowDBNull = true;
+ private bool autoIncrement = false;
+ private long autoIncrementSeed = 0;
+ private long autoIncrementStep = 1;
+ private string caption = null;
+ // FIXME: what does ms.net do for default of columnMapping
+ // when not specified by the constructor?
+ private MappingType columnMapping = MappingType.SimpleContent; // default?
+ private string columnName = null;
+ private Type dataType = null;
+ private object defaultValue = null;
+ private string expression = null;
+ private PropertyCollection extendedProperties = null;
+ private int maxLength = -1;
+ private string nameSpace = null;
+ private int ordinal = -1;
+ private string prefix = null;
+ private bool readOnly = false;
+ private DataTable table = null;
+ private bool unique = false;
+
+ #region Constructors
+ public DataColumn()
+ {
+ }
+
+ public DataColumn(string columnName): this()
+ {
+ ColumnName = columnName;
+ Caption = columnName;
+ }
+
+ public DataColumn(string columnName, Type dataType): this(columnName)
+ {
+ if(dataType == null)
+ {
+ throw new ArgumentNullException();
+ }
+
+ DataType = dataType;
+
+ }
+
+ public DataColumn( string columnName, Type dataType, string expr): this(columnName, dataType)
+ {
+ Expression = expr;
+ }
+
+ public DataColumn(string columnName, Type dataType, string expr, MappingType type): this(columnName, dataType, expr)
+ {
+ ColumnMapping = type;
+ }
+ #endregion
+
+ #region Properties
+ public bool AllowDBNull
+ {
+ get
+ {
+ return allowDBNull;
+ }
+ set
+ {
+ allowDBNull = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the column automatically increments the value of the column for new rows added to the table.
+ /// </summary>
+ /// <remarks>
+ /// If the type of this column is not Int16, Int32, or Int64 when this property is set,
+ /// the DataType property is coerced to Int32. An exception is generated if this is a computed column
+ /// (that is, the Expression property is set.) The incremented value is used only if the row's value for this column,
+ /// when added to the columns collection, is equal to the default value.
+ /// </remarks>
+ public bool AutoIncrement
+ {
+ get
+ {
+ return autoIncrement;
+ }
+ set
+ {
+ autoIncrement = value;
+ if(autoIncrement == true)
+ {
+ if(Expression != null)
+ {
+ throw new Exception();
+ }
+ if(Type.GetTypeCode(dataType) != TypeCode.Int16 &&
+ Type.GetTypeCode(dataType) != TypeCode.Int32 &&
+ Type.GetTypeCode(dataType) != TypeCode.Int64)
+ {
+ Int32 dtInt = new Int32();
+ dataType = dtInt.GetType();
+ }
+ }
+ }
+ }
+
+ public long AutoIncrementSeed
+ {
+ get
+ {
+ return autoIncrementSeed;
+ }
+ set
+ {
+ autoIncrementSeed = value;
+ }
+ }
+
+ public long AutoIncrementStep
+ {
+ get
+ {
+ return autoIncrementStep;
+ }
+ set
+ {
+ autoIncrementStep = value;
+ }
+ }
+
+ public string Caption
+ {
+ get
+ {
+ return caption;
+ }
+ set
+ {
+ caption = value;
+ }
+ }
+
+ public virtual MappingType ColumnMapping
+ {
+ get
+ {
+ return columnMapping;
+ }
+ set
+ {
+ columnMapping = value;
+ }
+ }
+
+ public string ColumnName
+ {
+ get
+ {
+ return columnName;
+ }
+ set
+ {
+ columnName = value;
+ }
+ }
+
+ public Type DataType
+ {
+ get
+ {
+ return dataType;
+ }
+ set
+ {
+ if(AutoIncrement == true &&
+ Type.GetTypeCode(value) != TypeCode.Int32)
+ {
+ throw new Exception();
+ }
+ dataType = value;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <remarks>When AutoIncrement is set to true, there can be no default value.</remarks>
+ public object DefaultValue
+ {
+ get
+ {
+ return defaultValue;
+ }
+ set
+ {
+ defaultValue = value;
+ }
+ }
+
+ public string Expression
+ {
+ get
+ {
+ return expression;
+ }
+ set
+ {
+ expression = value;
+ }
+ }
+
+ public PropertyCollection ExtendedProperties
+ {
+ get
+ {
+ return extendedProperties;
+ }
+ }
+
+ public int MaxLength
+ {
+ get
+ {
+ return maxLength;
+ }
+ set
+ {
+ maxLength = value;
+ }
+ }
+
+ public string Namespace
+ {
+ get
+ {
+ return nameSpace;
+ }
+ set
+ {
+ nameSpace = value;
+ }
+ }
+
+ //Need a good way to set the Ordinal when the column is added to a columnCollection.
+ public int Ordinal
+ {
+ get
+ {
+ return ordinal;
+ }
+ }
+
+ public string Prefix
+ {
+ get
+ {
+ return prefix;
+ }
+ set
+ {
+ prefix = value;
+ }
+ }
+
+ public bool ReadOnly
+ {
+ get
+ {
+ return readOnly;
+ }
+ set
+ {
+ readOnly = value;
+ }
+ }
+
+ public DataTable Table
+ {
+ get
+ {
+ return table;
+ }
+ }
+
+ public bool Unique
+ {
+ get
+ {
+ return unique;
+ }
+ set
+ {
+ unique = value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ protected internal void CheckNotAllowNull() {
+ }
+
+ [MonoTODO]
+ protected void CheckUnique() {
+ }
+
+ [MonoTODO]
+ protected internal virtual void
+ OnPropertyChanging (PropertyChangedEventArgs pcevent) {
+ }
+
+ [MonoTODO]
+ protected internal void RaisePropertyChanging(string name) {
+ }
+
+ /// <summary>
+ /// Gets the Expression of the column, if one exists.
+ /// </summary>
+ /// <returns>The Expression value, if the property is set;
+ /// otherwise, the ColumnName property.</returns>
+ [MonoTODO]
+ public override string ToString()
+ {
+ if(expression != null && expression != string.Empty)
+ {
+ return expression;
+ }
+ else
+ {
+ return columnName;
+ }
+ }
+
+ #endregion
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataColumnChangeEventArgs.cs b/mcs/class/System.Data/System.Data/DataColumnChangeEventArgs.cs
new file mode 100644
index 00000000000..f79d27eaf1e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataColumnChangeEventArgs.cs
@@ -0,0 +1,80 @@
+//
+// System.Data.DataColumnChangeEventArgs.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Provides data for the ColumnChanging event.
+ /// </summary>
+ public class DataColumnChangeEventArgs : EventArgs
+ {
+
+ private DataColumn _column = null;
+ private DataRow _row = null;
+ private object _proposedValue = null;
+
+ /// <summary>
+ /// Initializes a new instance of the DataColumnChangeEventArgs class.
+ /// </summary>
+ /// <param name="row"></param>
+ /// <param name="column"></param>
+ /// <param name="value"></param>
+ public DataColumnChangeEventArgs(DataRow row, DataColumn column, object value)
+ {
+ _column = column;
+ _row = row;
+ _proposedValue = value;
+ }
+
+ /// <summary>
+ /// Gets the DataColumn with a changing value.
+ /// </summary>
+ public DataColumn Column
+ {
+ get
+ {
+ return _column;
+ }
+ }
+
+
+ /// <summary>
+ /// Gets or sets the proposed new value for the column.
+ /// </summary>
+ public object ProposedValue
+ {
+ get
+ {
+ return _proposedValue;
+ }
+ set
+ {
+ _proposedValue = value;
+ }
+ }
+
+
+ /// <summary>
+ /// Gets the DataRow of the column with a changing value.
+ /// </summary>
+ public DataRow Row
+ {
+ get
+ {
+ return _row;
+ }
+ }
+
+
+
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataColumnChangeEventHandler.cs b/mcs/class/System.Data/System.Data/DataColumnChangeEventHandler.cs
new file mode 100644
index 00000000000..1932d38f2fe
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataColumnChangeEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.DataColumnChangeEventHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the method that will handle the the ColumnChanging event.
+ /// </summary>
+ [Serializable]
+ public delegate void DataColumnChangeEventHandler(object sender, DataColumnChangeEventArgs e);
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DataColumnCollection.cs b/mcs/class/System.Data/System.Data/DataColumnCollection.cs
new file mode 100644
index 00000000000..8fca31e70b8
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataColumnCollection.cs
@@ -0,0 +1,413 @@
+//
+// System.Data.DataColumnCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents a collection of DataColumn objects for a DataTable.
+ /// </summary>
+ public class DataColumnCollection : InternalDataCollectionBase
+ {
+
+ protected ArrayList list = null;
+
+ // The defaultNameIndex is used to create a default name for a column if one wasn't given.
+ private int defaultNameIndex;
+
+ //table should be the DataTable this DataColumnCollection belongs to.
+ private DataTable parentTable = null;
+
+ // Internal Constructor. This Class can only be created from other classes in this assembly.
+ internal DataColumnCollection(DataTable table):base()
+ {
+ list = new ArrayList();
+ defaultNameIndex = 1;
+ parentTable = table;
+ }
+
+
+
+ /// <summary>
+ /// Gets the DataColumn from the collection at the specified index.
+ /// </summary>
+ public virtual DataColumn this[int index]
+ {
+ get
+ {
+ return (DataColumn)list[index];
+ }
+ }
+
+ /// <summary>
+ /// Gets the DataColumn from the collection with the specified name.
+ /// </summary>
+ public virtual DataColumn this[string name]
+ {
+ get
+ {
+ foreach (DataColumn column in list)
+ {
+ if (column.ColumnName == name)
+ {
+ return column;
+ }
+ }
+
+ return null;
+
+ }
+ }
+
+
+ /// <summary>
+ /// Gets a list of the DataColumnCollection items.
+ /// </summary>
+ protected override ArrayList List
+ {
+ get
+ {
+ return list;
+ }
+ }
+
+ /// <summary>
+ /// Creates and adds a DataColumn object to the DataColumnCollection.
+ /// </summary>
+ /// <returns></returns>
+ public virtual DataColumn Add()
+ {
+ DataColumn column = new DataColumn("Column" + defaultNameIndex.ToString());
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ list.Add(column);
+ OnCollectionChanged(e);
+ defaultNameIndex++;
+ return column;
+ }
+
+ /// <summary>
+ /// Creates and adds the specified DataColumn object to the DataColumnCollection.
+ /// </summary>
+ /// <param name="column">The DataColumn to add.</param>
+ public void Add(DataColumn column)
+ {
+ if(Contains(column.ColumnName))
+ {
+ throw new DuplicateNameException("A column named " + column.ColumnName + " already belongs to this DataTable.");
+ }
+ else
+ {
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ list.Add(column);
+ OnCollectionChanged(e);
+ return;
+ }
+ }
+
+ /// <summary>
+ /// Creates and adds a DataColumn object with the specified name to the DataColumnCollection.
+ /// </summary>
+ /// <param name="columnName">The name of the column.</param>
+ /// <returns>The newly created DataColumn.</returns>
+ public virtual DataColumn Add(string columnName)
+ {
+
+ if (columnName == null || columnName == String.Empty)
+ {
+ columnName = "Column" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ if(Contains(columnName))
+ {
+ throw new DuplicateNameException("A column named " + columnName + " already belongs to this DataTable.");
+ }
+ else
+ {
+ DataColumn column = new DataColumn(columnName);
+
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ list.Add(column);
+ OnCollectionChanged(e);
+ return column;
+ }
+ }
+
+ /// <summary>
+ /// Creates and adds a DataColumn object with the specified name and type to the DataColumnCollection.
+ /// </summary>
+ /// <param name="columnName">The ColumnName to use when cretaing the column.</param>
+ /// <param name="type">The DataType of the new column.</param>
+ /// <returns>The newly created DataColumn.</returns>
+ public virtual DataColumn Add(string columnName, Type type)
+ {
+ if (columnName == null || columnName == "")
+ {
+ columnName = "Column" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ if(Contains(columnName))
+ {
+ throw new DuplicateNameException("A column named " + columnName + " already belongs to this DataTable.");
+ }
+ else
+ {
+ DataColumn column = new DataColumn(columnName, type);
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ list.Add(column);
+ OnCollectionChanged(e);
+ return column;
+ }
+ }
+
+ /// <summary>
+ /// Creates and adds a DataColumn object with the specified name, type, and expression to the DataColumnCollection.
+ /// </summary>
+ /// <param name="columnName">The name to use when creating the column.</param>
+ /// <param name="type">The DataType of the new column.</param>
+ /// <param name="expression">The expression to assign to the Expression property.</param>
+ /// <returns>The newly created DataColumn.</returns>
+ public virtual DataColumn Add(string columnName, Type type, string expression)
+ {
+ if (columnName == null || columnName == "")
+ {
+ columnName = "Column" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ if(Contains(columnName))
+ {
+ throw new DuplicateNameException("A column named " + columnName + " already belongs to this DataTable.");
+ }
+ else
+ {
+ DataColumn column = new DataColumn(columnName, type, expression);
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ list.Add(column);
+ OnCollectionChanged(e);
+ return column;
+ }
+ }
+
+ /// <summary>
+ /// Copies the elements of the specified DataColumn array to the end of the collection.
+ /// </summary>
+ /// <param name="columns">The array of DataColumn objects to add to the collection.</param>
+ public void AddRange(DataColumn[] columns)
+ {
+ foreach (DataColumn column in columns)
+ {
+ Add(column);
+ }
+ return;
+ }
+
+ /// <summary>
+ /// Checks whether a given column can be removed from the collection.
+ /// </summary>
+ /// <param name="column">A DataColumn in the collection.</param>
+ /// <returns>true if the column can be removed; otherwise, false.</returns>
+ public bool CanRemove(DataColumn column)
+ {
+
+ //Check that the column does not have a null reference.
+ if (column == null)
+ {
+ return false;
+ }
+
+
+ //Check that the column is part of this collection.
+ if (!Contains(column.ColumnName))
+ {
+ return false;
+ }
+
+
+
+ //Check if this column is part of a relationship. (this could probably be written better)
+ foreach (DataRelation childRelation in parentTable.ChildRelations)
+ {
+ foreach (DataColumn childColumn in childRelation.ChildColumns)
+ {
+ if (childColumn == column)
+ {
+ return false;
+ }
+ }
+
+ foreach (DataColumn parentColumn in childRelation.ParentColumns)
+ {
+ if (parentColumn == column)
+ {
+ return false;
+ }
+ }
+ }
+
+ //Check if this column is part of a relationship. (this could probably be written better)
+ foreach (DataRelation parentRelation in parentTable.ParentRelations)
+ {
+ foreach (DataColumn childColumn in parentRelation.ChildColumns)
+ {
+ if (childColumn == column)
+ {
+ return false;
+ }
+ }
+
+ foreach (DataColumn parentColumn in parentRelation.ParentColumns)
+ {
+ if (parentColumn == column)
+ {
+ return false;
+ }
+ }
+ }
+
+
+ //Check if another column's expression depends on this column.
+
+ foreach (DataColumn dataColumn in list)
+ {
+ if (dataColumn.Expression.ToString().IndexOf(column.ColumnName) > 0)
+ {
+ return false;
+ }
+ }
+
+
+ return true;
+ }
+
+ /// <summary>
+ /// Clears the collection of any columns.
+ /// </summary>
+ public void Clear()
+ {
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Refresh, this);
+ list.Clear();
+ OnCollectionChanged(e);
+ return;
+ }
+
+ /// <summary>
+ /// Checks whether the collection contains a column with the specified name.
+ /// </summary>
+ /// <param name="name">The ColumnName of the column to check for.</param>
+ /// <returns>true if a column exists with this name; otherwise, false.</returns>
+ public bool Contains(string name)
+ {
+ return (IndexOf(name) != -1);
+ }
+
+ /// <summary>
+ /// Gets the index of a column specified by name.
+ /// </summary>
+ /// <param name="column">The name of the column to return.</param>
+ /// <returns>The index of the column specified by column if it is found; otherwise, -1.</returns>
+ public virtual int IndexOf(DataColumn column)
+ {
+ return list.IndexOf(column);
+ }
+
+ /// <summary>
+ /// Gets the index of the column with the given name (the name is not case sensitive).
+ /// </summary>
+ /// <param name="columnName">The name of the column to find.</param>
+ /// <returns>The zero-based index of the column with the specified name, or -1 if the column doesn't exist in the collection.</returns>
+ public int IndexOf(string columnName)
+ {
+
+ DataColumn column = this[columnName];
+
+ if (column != null)
+ {
+ return IndexOf(column);
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
+ /// <summary>
+ /// Raises the OnCollectionChanged event.
+ /// </summary>
+ /// <param name="ccevent">A CollectionChangeEventArgs that contains the event data.</param>
+ protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent)
+ {
+ if (CollectionChanged != null)
+ {
+ // Invokes the delegate.
+ CollectionChanged(this, ccevent);
+ }
+ }
+
+ /// <summary>
+ /// Raises the OnCollectionChanging event.
+ /// </summary>
+ /// <param name="ccevent">A CollectionChangeEventArgs that contains the event data.</param>
+ protected internal virtual void OnCollectionChanging(CollectionChangeEventArgs ccevent)
+ {
+ if (CollectionChanged != null)
+ {
+ // Invokes the delegate.
+ CollectionChanged(this, ccevent);
+ }
+ }
+
+ /// <summary>
+ /// Removes the specified DataColumn object from the collection.
+ /// </summary>
+ /// <param name="column">The DataColumn to remove.</param>
+ public void Remove(DataColumn column)
+ {
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Remove, this);
+ list.Remove(column);
+ OnCollectionChanged(e);
+ return;
+ }
+
+ /// <summary>
+ /// Removes the DataColumn object with the specified name from the collection.
+ /// </summary>
+ /// <param name="name">The name of the column to remove.</param>
+ public void Remove(string name)
+ {
+ DataColumn column = this[name];
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Remove, this);
+ list.Remove(column);
+ OnCollectionChanged(e);
+ return;
+ }
+
+ /// <summary>
+ /// Removes the column at the specified index from the collection.
+ /// </summary>
+ /// <param name="index">The index of the column to remove.</param>
+ public void RemoveAt(int index)
+ {
+ CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Remove, this);
+ list.RemoveAt(index);
+ OnCollectionChanged(e);
+ return;
+ }
+
+ /// <summary>
+ /// Occurs when the columns collection changes, either by adding or removing a column.
+ /// </summary>
+ public event CollectionChangeEventHandler CollectionChanged;
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataRelationCollection.cs b/mcs/class/System.Data/System.Data/DataRelationCollection.cs
new file mode 100644
index 00000000000..aeff4beb1b5
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRelationCollection.cs
@@ -0,0 +1,305 @@
+//
+// System.Data.DataRelationCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the collection of DataRelation objects for this DataSet.
+ /// </summary>
+ [Serializable]
+ public abstract class DataRelationCollection : InternalDataCollectionBase
+ {
+ private bool inTransition;
+ private int defaultNameIndex;
+
+ /// <summary>
+ /// Initializes a new instance of the DataRelationCollection class.
+ /// </summary>
+ internal DataRelationCollection()
+ {
+ defaultNameIndex = 1;
+ inTransition = false;
+ }
+
+ /// <summary>
+ /// Gets the DataRelation object specified by name.
+ /// </summary>
+ public abstract DataRelation this[string name]{get;}
+
+ /// <summary>
+ /// Gets the DataRelation object at the specified index.
+ /// </summary>
+ public abstract DataRelation this[int index]{get;}
+
+
+ #region Add Methods
+ /// <summary>
+ /// Adds a DataRelation to the DataRelationCollection.
+ /// </summary>
+ /// <param name="relation">The DataRelation to add to the collection.</param>
+ public void Add(DataRelation relation)
+ {
+ if(relation != null)
+ {
+ //CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ relations.Add(relation);
+ //OnCollectionChanged(e);
+ }
+ return;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection. The name is defaulted.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is fired if it succeeds.
+ /// </summary>
+ /// <param name="parentColumn">parent column of relation.</param>
+ /// <param name="childColumn">child column of relation.</param>
+ /// <returns>The created DataRelation.</returns>
+ public virtual DataRelation Add(DataColumn parentColumn, DataColumn childColumn)
+ {
+
+ if(parentColumn == null)
+ {
+ throw new ArgumentNullException("parentColumn");
+ }
+ else if( childColumn == null)
+ {
+ throw new ArgumentNullException("childColumn");
+ }
+
+ if(parentColumn.Table.DataSet != childColumn.Table.DataSet)
+ {
+ throw new InvalidConstraintException("my ex");
+ }
+
+ DataRelation dataRelation = new DataRelation("Relation" + defaultNameIndex.ToString(), parentColumn, childColumn);
+ //CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ relations.Add(dataRelation);
+ //OnCollectionChanged(e);
+ defaultNameIndex++;
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection. The name is defaulted.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is raised if it succeeds.
+ /// </summary>
+ /// <param name="parentColumns">An array of parent DataColumn objects.</param>
+ /// <param name="childColumns">An array of child DataColumn objects.</param>
+ /// <returns>The created DataRelation.</returns>
+ public virtual DataRelation Add(DataColumn[] parentColumns, DataColumn[] childColumns)
+ {
+ DataRelation dataRelation = new DataRelation("Relation" + defaultNameIndex.ToString(), parentColumns, childColumns);
+ relations.Add(dataRelation);
+ defaultNameIndex++;
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// A DuplicateNameException is generated if this collection already has a relation with the same name (case insensitive).
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is raised if it succeeds.
+ /// </summary>
+ /// <param name="name">The name of the relation.</param>
+ /// <param name="parentColumn">parent column of relation.</param>
+ /// <returns>The created DataRelation.</returns>
+ /// <returns></returns>
+ public virtual DataRelation Add(string name, DataColumn parentColumn, DataColumn childColumn)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumn, childColumn);
+ relations.Add(dataRelation);
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a DataRelation with the specified name, and arrays of parent and child columns, and adds it to the collection.
+ /// </summary>
+ /// <param name="name">The name of the DataRelation to create.</param>
+ /// <param name="parentColumns">An array of parent DataColumn objects.</param>
+ /// <param name="childColumns">An array of child DataColumn objects.</param>
+ /// <returns>The created DataRelation.</returns>
+ public virtual DataRelation Add(string name, DataColumn[] parentColumns, DataColumn[] childColumns)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumns, childColumns);
+ relations.Add(dataRelation);
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// A DuplicateNameException is generated if this collection already has a relation with the same name (case insensitive).
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is raised if it succeeds.
+ /// </summary>
+ /// <param name="name">The name of the relation.</param>
+ /// <param name="parentColumn">parent column of relation.</param>
+ /// <param name="childColumn">child column of relation.</param>
+ /// <param name="createConstraints">true to create constraints; otherwise false. (default is true)</param>
+ /// <returns>The created DataRelation.</returns>
+ public virtual DataRelation Add(string name, DataColumn parentColumn, DataColumn childColumn, bool createConstraints)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumn, childColumn, createConstraints);
+ relations.Add(dataRelation);
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a DataRelation with the specified name, arrays of parent and child columns,
+ /// and value specifying whether to create a constraint, and adds it to the collection.
+ /// </summary>
+ /// <param name="name">The name of the DataRelation to create.</param>
+ /// <param name="parentColumns">An array of parent DataColumn objects.</param>
+ /// <param name="childColumns">An array of child DataColumn objects.</param>
+ /// <param name="createConstraints">true to create a constraint; otherwise false.</param>
+ /// <returns>The created DataRelation.</returns>
+ public virtual DataRelation Add(string name, DataColumn[] parentColumns, DataColumn[] childColumns, bool createConstraints)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumns, childColumns, createConstraints);
+ AddCore(dataRelation);
+ relations.Add(dataRelation);
+ return dataRelation;
+ }
+ #endregion
+
+ /// <summary>
+ /// Performs verification on the table.
+ /// </summary>
+ /// <param name="relation">The relation to check.</param>
+ protected virtual void AddCore(DataRelation relation)
+ {
+ if (relation == null)
+ {
+ //TODO: Issue a good exception message.
+ throw new ArgumentNullException();
+ }
+ else if(relations.IndexOf(relation) != -1)
+ {
+ //TODO: Issue a good exception message.
+ throw new ArgumentException();
+ }
+ else if(relations.Contains(relation.RelationName))
+ {
+ //TODO: Issue a good exception message.
+ throw new DuplicateNameException("A Relation named " + relation.RelationName + " already belongs to this DataSet.");
+ }
+ }
+
+ /// <summary>
+ /// Copies the elements of the specified DataRelation array to the end of the collection.
+ /// </summary>
+ /// <param name="relations">The array of DataRelation objects to add to the collection.</param>
+ public virtual void AddRange(DataRelation[] relations)
+ {
+ //TODO: Implement.
+
+ DataSet dataSet = GetDataSet();
+
+ foreach(DataRelation dataRelation in relations)
+ {
+
+ }
+
+ }
+
+ public virtual bool CanRemove(DataRelation relation)
+ {
+ //TODO: Implement.
+ return false;
+ }
+
+ public virtual void Clear()
+ {
+ }
+
+ public virtual bool Contains(string name)
+ {
+ return false;
+ }
+
+ protected abstract DataSet GetDataSet();
+
+ public virtual int IndexOf(DataRelation relation)
+ {
+ return relations.IndexOf(relation);
+ }
+
+ public virtual int IndexOf(string relationName)
+ {
+ return relations.IndexOf(this[relationName]);
+ }
+
+ protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent)
+ {
+ }
+
+ protected internal virtual void OnCollectionChanging(CollectionChangeEventArgs ccevent)
+ {
+ }
+
+ public void Remove(DataRelation relation)
+ {
+ }
+
+ public void Remove(string name)
+ {
+ }
+
+ public void RemoveAt(int index)
+ {
+ }
+
+ protected virtual void RemoveCore(DataRelation relation)
+ {
+ }
+
+ public event CollectionChangeEventHandler CollectionChanged;
+
+
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataRow.cs b/mcs/class/System.Data/System.Data/DataRow.cs
new file mode 100644
index 00000000000..56958b2212f
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRow.cs
@@ -0,0 +1,247 @@
+//
+// System.Data.DataRowAction.cs
+//
+// Author:
+// Rodrigo Moya <rodrigo@ximian.com>
+//
+// (C) Ximian, Inc
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents a row of data in a DataTable.
+ /// </summary>
+ public class DataRow
+ {
+ [MonoTODO]
+ public void AcceptChanges() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void BeginEdit() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void CancelEdit() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ClearErrors() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Delete() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void EndEdit() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow[] GetChildRows(DataRelation dr) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow[] GetChildRows(string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow[] GetChildRows(DataRelation dr, DataRowVersion version) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow[] GetChildRows(string s, DataRowVersion version) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetColumnError(DataColumn col) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetColumnError(int index) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetColumnError(string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataColumn[] GetColumnsInError() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow GetParentRow(DataRelation dr) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow GetParentRow(string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow GetParentRow(DataRelation dr, DataRowVersion version) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow GetParentRow(string s, DataRowVersion version) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow[] GetParentRows(DataRelation dr) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow[] GetParentRows(string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow[] GetParentRows(DataRelation dr, DataRowVersion version) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataRow[] GetParentRows(string s, DataRowVersion version) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool HasVersion(DataRowVersion version) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsNull(DataColumn dc) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsNull(int i) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsNull(string s) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsNull(DataColumn dc, DataRowVersion version) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void RejectChanges() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetColumnError(DataColumn dc, string err) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetColumnError(int i, string err) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetColumnError(string a, string err) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetParentRow(DataRow row) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetParentRow(DataRow row, DataRelation rel) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void SetNull(DataColumn column) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool HasErrors {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object this[string s] {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object this[DataColumn dc] {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object this[int i] {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object this[string s, DataRowVersion version] {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object this[DataColumn dc, DataRowVersion version] {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object this[int i, DataRowVersion version] {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public object[] ItemArray {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public string RowError {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public DataRowState RowState {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public DataTable Table {
+ get { throw new NotImplementedException (); }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataRowAction.cs b/mcs/class/System.Data/System.Data/DataRowAction.cs
new file mode 100644
index 00000000000..b6423b374ca
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowAction.cs
@@ -0,0 +1,28 @@
+//
+// System.Data.DataRowAction.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Describes the action taken on a DataRow.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum DataRowAction
+ {
+ Nothing = 0,
+ Delete = 1,
+ Change = 2,
+ Rollback = 4,
+ Commit = 8,
+ Add = 16
+ }
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DataRowChangeEventHandler.cs b/mcs/class/System.Data/System.Data/DataRowChangeEventHandler.cs
new file mode 100644
index 00000000000..4959e38f3bf
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowChangeEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.DataRowChangeEventHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the method that will handle the RowChanging, RowChanged, RowDeleting, and RowDeleted events of a DataTable.
+ /// </summary>
+ [Serializable]
+ public delegate void DataRowChangeEventHandler(object sender, DataRowChangeEventArgs e);
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DataRowState.cs b/mcs/class/System.Data/System.Data/DataRowState.cs
new file mode 100644
index 00000000000..4e77e406203
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowState.cs
@@ -0,0 +1,26 @@
+//
+// System.Data.DataRowState.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Gets the state of a DataRow object.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum DataRowState
+ {
+ Detached = 1,
+ Unchanged = 2,
+ Added = 4,
+ Deleted = 8,
+ Modified = 16
+ }
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DataRowVersion.cs b/mcs/class/System.Data/System.Data/DataRowVersion.cs
new file mode 100644
index 00000000000..ad757946bcb
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataRowVersion.cs
@@ -0,0 +1,23 @@
+//
+// System.Data.DataRowVersion.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Describes the version of a DataRow.
+ /// </summary>
+ [Serializable]
+ public enum DataRowVersion
+ {
+ Original = 256,
+ Current = 512,
+ Proposed = 1024,
+ Default = 1536
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DataSet.cs b/mcs/class/System.Data/System.Data/DataSet.cs
new file mode 100644
index 00000000000..3d686a98e74
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataSet.cs
@@ -0,0 +1,47 @@
+using System;
+
+namespace WindowsApplication1.Mono
+{
+ /// <summary>
+ /// Summary description for DataSet.
+ /// </summary>
+ public class DataSet
+ {
+ public DataSet()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ public DataSet(string dataSetName);
+
+ protected DataSet(SerializationInfo info, StreamingContext context);
+
+ public bool CaseSensitive {get; set;}
+
+ public string DataSetName {get; set;}
+
+ public DataViewManager DefaultViewManager {get;}
+
+ public bool EnforceConstraints {get; set;}
+
+ public PropertyCollection ExtendedProperties {get;}
+
+ public bool HasErrors {get;}
+
+ public CultureInfo Locale {get; set;}
+
+ public string Namespace {get; set;}
+
+ public string Prefix {get; set;}
+
+ public DataRelationCollection Relations {get;}
+
+ public override ISite Site {get; set;}
+
+ public DataTableCollection Tables {get;}
+
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataTable.cs b/mcs/class/System.Data/System.Data/DataTable.cs
new file mode 100644
index 00000000000..84fc089f2e8
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataTable.cs
@@ -0,0 +1,729 @@
+//
+// System.Data.DataTable.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents one table of in-memory data.
+ /// </summary>
+ [Serializable]
+ public class DataTable : MarshalByValueComponent, IListSource,
+ ISupportInitialize, ISerializable
+ {
+
+ private bool _caseSensitive;
+ private DataColumnCollection _columnCollection;
+ private ConstraintCollection _constraintCollection;
+ private DataSet _dataSet;
+ private DataView _defaultView;
+ private string _displayExpression;
+ private PropertyCollection _extendedProperties;
+ private bool _hasErrors;
+ private CultureInfo _locale;
+ private int _minimumCapacity;
+ private string _nameSpace;
+ private DataTableRelationCollection _childRelations;
+ private DataTableRelationCollection _parentRelations;
+ private string _prefix;
+ private DataColumn[] _primaryKey;
+ private DataRowCollection _rows;
+ private ISite _site;
+ private string _tableName;
+ private bool _containsListCollection;
+ private string _encodedTableName;
+
+
+
+ /// <summary>
+ /// Initializes a new instance of the DataTable class with no arguments.
+ /// </summary>
+
+ public DataTable()
+ {
+ _dataSet = null;
+ _defaultView = null;
+ _columnCollection = new DataColumnCollection(this);
+ //_constraintCollection = new ConstraintCollection(); TODO: uncomment after ConstraintCollection is built.
+ _extendedProperties = null;
+ _tableName = "";
+ _nameSpace = null;
+ _caseSensitive = false;
+ _displayExpression = null;
+ _primaryKey = null;
+
+ _childRelations = new DataTableRelationCollection();
+ _parentRelations = new DataTableRelationCollection();
+ //_nextRowID = 1;
+ //_elementColumnCount = 0;
+ //_caseSensitiveAmbient = true;
+ //_culture = null; // _locale??
+ //_compareFlags = 25; // why 25??
+ //_fNestedInDataset = true; // what?
+ //_encodedTableName = null; //??
+ //_xmlText = null; //??
+ //_colUnique = null; //??
+ //_textOnly = false; //??
+ //repeatableElement = false; //??
+ //zeroIntegers[]
+ //zeroColumns[]
+ //primaryIndex[]
+ //delayedSetPrimaryKey = null; //??
+ }
+
+ /// <summary>
+ /// Intitalizes a new instance of the DataTable class with the specified table name.
+ /// </summary>
+
+ public DataTable(string tableName)
+ {
+ _dataSet = null;
+ _defaultView = null;
+ _columnCollection = new DataColumnCollection(this);
+ //_constraintCollection = new ConstraintCollection(); TODO: uncomment after ConstraintCollection is built.
+ _extendedProperties = null;
+ _tableName = tableName;
+ _nameSpace = null;
+ _caseSensitive = false;
+ _displayExpression = null;
+ _primaryKey = null;
+ _childRelations = new DataTableRelationCollection();
+ _parentRelations = new DataTableRelationCollection();
+ //_nextRowID = 1;
+ //_elementColumnCount = 0;
+ //_caseSensitiveAmbient = true;
+ //_culture = null; // _locale??
+ //_compareFlags = 25; // why 25??
+ //_fNestedInDataset = true; // what?
+ _encodedTableName = tableName;
+ //_xmlText = null; //??
+ //_colUnique = null; //??
+ //_textOnly = false; //??
+ //repeatableElement = false; //??
+ //zeroIntegers[]
+ //zeroColumns[]
+ //primaryIndex[]
+ //delayedSetPrimaryKey = null; //??
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the DataTable class with the SerializationInfo and the StreamingContext.
+ /// </summary>
+
+ protected DataTable(SerializationInfo info, StreamingContext context)
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ /// <summary>
+ /// Indicates whether string comparisons within the table are case-sensitive.
+ /// </summary>
+
+ public bool CaseSensitive
+ {
+ get
+ {
+ return _caseSensitive;
+ }
+ set
+ {
+ _caseSensitive = value;
+ }
+ }
+
+
+ /// <summary>
+ /// Gets the collection of child relations for this DataTable.
+ /// </summary>
+
+ public DataRelationCollection ChildRelations
+ {
+ get
+ {
+ return (DataRelationCollection)_childRelations;
+ }
+ }
+
+ /// <summary>
+ /// Gets the collection of columns that belong to this table.
+ /// </summary>
+
+ public DataColumnCollection Columns
+ {
+ get
+ {
+ return _columnCollection;
+ }
+ }
+
+ /// <summary>
+ /// Gets the collection of constraints maintained by this table.
+ /// </summary>
+
+ public ConstraintCollection Constraints
+ {
+ get
+ {
+ return _constraintCollection;
+ }
+ }
+
+ /// <summary>
+ /// Gets the DataSet that this table belongs to.
+ /// </summary>
+
+ public DataSet DataSet
+ {
+ get
+ {
+ return _dataSet;
+ }
+ }
+
+ /// <summary>
+ /// Gets a customized view of the table which may include a filtered view, or a cursor position.
+ /// </summary>
+
+ public DataView DefaultView
+ {
+ get
+ {
+ return _defaultView;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the expression that will return a value used to represent this table in the user interface.
+ /// </summary>
+
+ public string DisplayExpression
+ {
+ get
+ {
+ return _displayExpression;
+ }
+ set
+ {
+ _displayExpression = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets the collection of customized user information.
+ /// </summary>
+ public PropertyCollection ExtendedProperties
+ {
+ get
+ {
+ return _extendedProperties;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether there are errors in any of the rows in any of the tables of the DataSet to which the table belongs.
+ /// </summary>
+ public bool HasErrors
+ {
+ get
+ {
+ return _hasErrors;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the locale information used to compare strings within the table.
+ /// </summary>
+ public CultureInfo Locale
+ {
+ get
+ {
+ return _locale;
+ }
+ set
+ {
+ _locale = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the initial starting size for this table.
+ /// </summary>
+ public int MinimumCapacity
+ {
+ get
+ {
+ return _minimumCapacity;
+ }
+ set
+ {
+ _minimumCapacity = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the namespace for the XML represenation of the data stored in the DataTable.
+ /// </summary>
+ public string Namespace
+ {
+ get
+ {
+ return _nameSpace;
+ }
+ set
+ {
+ _nameSpace = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets the collection of parent relations for this DataTable.
+ /// </summary>
+ public DataRelationCollection ParentRelations
+ {
+ get
+ {
+ return _parentRelations;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the namespace for the XML represenation of the data stored in the DataTable.
+ /// </summary>
+ public string Prefix
+ {
+ get
+ {
+ return _prefix;
+ }
+ set
+ {
+ _prefix = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets an array of columns that function as primary keys for the data table.
+ /// </summary>
+ public DataColumn[] PrimaryKey
+ {
+ get
+ {
+ return _primaryKey;
+ }
+ set
+ {
+ _primaryKey = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets the collection of rows that belong to this table.
+ /// </summary>
+
+ public DataRowCollection Rows
+ {
+ get
+ {
+ return _rows;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets an System.ComponentModel.ISite for the DataTable.
+ /// </summary>
+
+ public override ISite Site
+ {
+ get
+ {
+ return _site;
+ }
+ set
+ {
+ _site = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the name of the the DataTable.
+ /// </summary>
+
+ public string TableName
+ {
+ get
+ {
+ return _tableName;
+ }
+ set
+ {
+ _tableName = value;
+ }
+ }
+
+ bool IListSource.ContainsListCollection
+ {
+ get
+ {
+ return _containsListCollection;
+ }
+ }
+
+
+ /// <summary>
+ /// Commits all the changes made to this table since the last time AcceptChanges was called.
+ /// </summary>
+
+ public void AcceptChanges()
+ {
+ }
+
+ /// <summary>
+ /// Begins the initialization of a DataTable that is used on a form or used by another component. The initialization occurs at runtime.
+ /// </summary>
+
+ public void BeginInit()
+ {
+ }
+
+ /// <summary>
+ /// Turns off notifications, index maintenance, and constraints while loading data.
+ /// </summary>
+
+ public void BeginLoadData()
+ {
+ }
+
+ /// <summary>
+ /// Clears the DataTable of all data.
+ /// </summary>
+
+ public void Clear()
+ {
+ }
+
+ /// <summary>
+ /// Clones the structure of the DataTable, including all DataTable schemas and constraints.
+ /// </summary>
+
+ public virtual DataTable Clone()
+ {
+ return this;
+ }
+
+ /// <summary>
+ /// Computes the given expression on the current rows that pass the filter criteria.
+ /// </summary>
+
+ public object Compute(string expression, string filter)
+ {
+ object obj = "a";
+ return obj;
+ }
+
+ /// <summary>
+ /// Copies both the structure and data for this DataTable.
+ /// </summary>
+
+ public DataTable Copy()
+ {
+ return this;
+ }
+
+ /// <summary>
+ /// Ends the initialization of a DataTable that is used on a form or used by another component. The initialization occurs at runtime.
+ /// </summary>
+
+ public void EndInit()
+ {
+ }
+
+ /// <summary>
+ /// Turns on notifications, index maintenance, and constraints after loading data.
+ /// </summary>
+
+ public void EndLoadData()
+ {
+ }
+
+ /// <summary>
+ /// Gets a copy of the DataTable that contains all changes made to it since it was loaded or AcceptChanges was last called.
+ /// </summary>
+
+ public DataTable GetChanges()
+ {
+ return this;
+ }
+
+ /// <summary>
+ /// Gets a copy of the DataTable containing all changes made to it since it was last loaded, or since AcceptChanges was called, filtered by DataRowState.
+ /// </summary>
+
+ public DataTable GetChanges(DataRowState rowStates)
+ {
+ return this;
+ }
+
+ /// <summary>
+ /// Gets an array of DataRow objects that contain errors.
+ /// </summary>
+
+ //public DataRow[] GetErrors()
+ //{
+ // return _rows;
+ //}
+
+ /// <summary>
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// </summary>
+
+ //protected virtual Type GetRowType()
+ //{
+ //}
+
+ /// <summary>
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// </summary>
+
+ IList IListSource.GetList()
+ {
+ IList list = null;
+ return list;
+ }
+
+ /// <summary>
+ /// Copies a DataRow into a DataTable, preserving any property settings, as well as original and current values.
+ /// </summary>
+
+ public void ImportRow(DataRow row)
+ {
+ }
+
+ /// <summary>
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// </summary>
+
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ }
+
+ /// <summary>
+ /// Finds and updates a specific row. If no matching row is found, a new row is created using the given values.
+ /// </summary>
+ public DataRow LoadDataRow(object[] values, bool fAcceptChanges)
+ {
+ DataRow dataRow = null;
+ return dataRow;
+ }
+
+ /// <summary>
+ /// Creates a new DataRow with the same schema as the table.
+ /// </summary>
+ public DataRow NewRow()
+ {
+ DataRow dataRow = null;
+ return dataRow;
+ }
+
+ /// <summary>
+ /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
+ /// </summary>
+ protected internal DataRow[] NewRowArray(int size)
+ {
+ DataRow[] dataRows = {null};
+ return dataRows;
+ }
+
+ /// <summary>
+ /// Creates a new row from an existing row.
+ /// </summary>
+ protected virtual DataRow NewRowFromBuilder(DataRowBuilder builder)
+ {
+ DataRow dataRow = null;
+ return dataRow;
+ }
+
+ /// <summary>
+ /// Raises the ColumnChanged event.
+ /// </summary>
+ protected virtual void OnColumnChanged(DataColumnChangeEventArgs e)
+ {
+ }
+
+ /// <summary>
+ /// Raises the ColumnChanging event.
+ /// </summary>
+
+ protected virtual void OnColumnChanging(DataColumnChangeEventArgs e)
+ {
+ }
+
+ /// <summary>
+ /// Raises the PropertyChanging event.
+ /// </summary>
+
+ protected internal virtual void OnPropertyChanging(PropertyChangedEventArgs pcevent)
+ {
+ }
+
+ /// <summary>
+ /// Notifies the DataTable that a DataColumn is being removed.
+ /// </summary>
+
+ protected internal virtual void OnRemoveColumn(DataColumn column)
+ {
+ }
+
+ /// <summary>
+ /// Raises the RowChanged event.
+ /// </summary>
+
+ protected virtual void OnRowChanged(DataRowChangeEventArgs e)
+ {
+ }
+
+ /// <summary>
+ /// Raises the RowChanging event.
+ /// </summary>
+
+ protected virtual void OnRowChanging(DataRowChangeEventArgs e)
+ {
+ }
+
+ /// <summary>
+ /// Raises the RowDeleted event.
+ /// </summary>
+
+ protected virtual void OnRowDeleted(DataRowChangeEventArgs e)
+ {
+ }
+
+ /// <summary>
+ /// Raises the RowDeleting event.
+ /// </summary>
+
+ protected virtual void OnRowDeleting(DataRowChangeEventArgs e)
+ {
+ }
+
+ /// <summary>
+ /// Rolls back all changes that have been made to the table since it was loaded, or the last time AcceptChanges was called.
+ /// </summary>
+
+ public void RejectChanges()
+ {
+ }
+
+ /// <summary>
+ /// Resets the DataTable to its original state.
+ /// </summary>
+
+ public virtual void Reset()
+ {
+ }
+
+ /// <summary>
+ /// Gets an array of all DataRow objects.
+ /// </summary>
+
+ public DataRow[] Select()
+ {
+ DataRow[] dataRows = {null};
+ return dataRows;
+ }
+
+ /// <summary>
+ /// Gets an array of all DataRow objects that match the filter criteria in order of primary key (or lacking one, order of addition.)
+ /// </summary>
+
+ public DataRow[] Select(string filterExpression)
+ {
+ DataRow[] dataRows = {null};
+ return dataRows;
+ }
+
+ /// <summary>
+ /// Gets an array of all DataRow objects that match the filter criteria, in the the specified sort order.
+ /// </summary>
+
+ public DataRow[] Select(string filterExpression, string sort)
+ {
+ DataRow[] dataRows = {null};
+ return dataRows;
+ }
+
+ /// <summary>
+ /// Gets an array of all DataRow objects that match the filter in the order of the sort, that match the specified state.
+ /// </summary>
+
+ public DataRow[] Select(string filterExpression, string sort, DataViewRowState recordStates)
+ {
+ DataRow[] dataRows = {null};
+ return dataRows;
+ }
+
+ /// <summary>
+ /// Gets the TableName and DisplayExpression, if there is one as a concatenated string.
+ /// </summary>
+
+ public override string ToString()
+ {
+ return "";
+ }
+
+ /// <summary>
+ /// Occurs when after a value has been changed for the specified DataColumn in a DataRow.
+ /// </summary>
+
+ public event DataColumnChangeEventHandler ColumnChanged;
+
+ /// <summary>
+ /// Occurs when a value is being changed for the specified DataColumn in a DataRow.
+ /// </summary>
+
+ public event DataColumnChangeEventHandler ColumnChanging;
+
+ /// <summary>
+ /// Occurs after a DataRow has been changed successfully.
+ /// </summary>
+
+ public event DataRowChangeEventHandler RowChanged;
+
+ /// <summary>
+ /// Occurs when a DataRow is changing.
+ /// </summary>
+
+ public event DataRowChangeEventHandler RowChanging;
+
+ /// <summary>
+ /// Occurs after a row in the table has been deleted.
+ /// </summary>
+
+ public event DataRowChangeEventHandler RowDeleted;
+
+ /// <summary>
+ /// Occurs before a row in the table is about to be deleted.
+ /// </summary>
+
+ public event DataRowChangeEventHandler RowDeleting;
+
+
+
+
+
+
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataTableRelationCollection.cs b/mcs/class/System.Data/System.Data/DataTableRelationCollection.cs
new file mode 100644
index 00000000000..15d621fd1e7
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataTableRelationCollection.cs
@@ -0,0 +1,322 @@
+//
+// System.Data.DataTableRelationCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Summary description for DataTableRelationCollection.
+ /// </summary>
+ public class DataTableRelationCollection : DataRelationCollection
+ {
+ private ArrayList list;
+ private int defaultNameIndex;
+ private DataTable table;
+
+
+ /// <summary>
+ /// Initializes a new instance of the DataRelationCollection class.
+ /// </summary>
+ internal DataTableRelationCollection():base()
+ {
+ //table = dataTable;
+ }
+
+ /// <summary>
+ /// Gets the DataRelation object specified by name.
+ /// </summary>
+ public override DataRelation this[string name]
+ {
+ get
+ {
+ foreach (DataRelation dataRelation in list)
+ {
+ if (dataRelation.RelationName == name)
+ {
+ return dataRelation;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Gets the DataRelation object at the specified index.
+ /// </summary>
+ public override DataRelation this[int index]
+ {
+ get
+ {
+ return (DataRelation)list[index];
+ }
+ }
+
+ /*
+ #region Add Methods
+ /// <summary>
+ /// Adds a DataRelation to the DataRelationCollection.
+ /// </summary>
+ /// <param name="relation">The DataRelation to add to the collection.</param>
+ public new void Add(DataRelation relation)
+ {
+ if(relation != null)
+ {
+ //CollectionChangeEventArgs e = new CollectionChangeEventArgs(CollectionChangeAction.Add, this);
+ list.Add(relation);
+ //OnCollectionChanged(e);
+ }
+ return;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection. The name is defaulted.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is fired if it succeeds.
+ /// </summary>
+ /// <param name="parentColumn">parent column of relation.</param>
+ /// <param name="childColumn">child column of relation.</param>
+ /// <returns>The created DataRelation.</returns>
+ public override DataRelation Add(DataColumn parentColumn, DataColumn childColumn)
+ {
+ if(parentColumn == null)
+ {
+ throw new ArgumentNullException("parentColumn");
+ }
+ else if( childColumn == null)
+ {
+ throw new ArgumentNullException("childColumn");
+ }
+
+ if(parentColumn.Table.DataSet != childColumn.Table.DataSet)
+ {
+ throw new InvalidConstraintException("my ex");
+ }
+
+ DataRelation dataRelation = new DataRelation("Relation" + defaultNameIndex.ToString(), parentColumn, childColumn);
+ list.Add(dataRelation);
+ defaultNameIndex++;
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection. The name is defaulted.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is raised if it succeeds.
+ /// </summary>
+ /// <param name="parentColumns">An array of parent DataColumn objects.</param>
+ /// <param name="childColumns">An array of child DataColumn objects.</param>
+ /// <returns>The created DataRelation.</returns>
+ public override DataRelation Add(DataColumn[] parentColumns, DataColumn[] childColumns)
+ {
+ DataRelation dataRelation = new DataRelation("Relation" + defaultNameIndex.ToString(), parentColumns, childColumns);
+ list.Add(dataRelation);
+ defaultNameIndex++;
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// A DuplicateNameException is generated if this collection already has a relation with the same name (case insensitive).
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is raised if it succeeds.
+ /// </summary>
+ /// <param name="name">The name of the relation.</param>
+ /// <param name="parentColumn">parent column of relation.</param>
+ /// <returns>The created DataRelation.</returns>
+ /// <returns></returns>
+ public override DataRelation Add(string name, DataColumn parentColumn, DataColumn childColumn)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumn, childColumn);
+ list.Add(dataRelation);
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a DataRelation with the specified name, and arrays of parent and child columns, and adds it to the collection.
+ /// </summary>
+ /// <param name="name">The name of the DataRelation to create.</param>
+ /// <param name="parentColumns">An array of parent DataColumn objects.</param>
+ /// <param name="childColumns">An array of child DataColumn objects.</param>
+ /// <returns>The created DataRelation.</returns>
+ public override DataRelation Add(string name, DataColumn[] parentColumns, DataColumn[] childColumns)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumns, childColumns);
+ list.Add(dataRelation);
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a relation given the parameters and adds it to the collection.
+ /// An ArgumentException is generated if this relation already belongs to this collection or belongs to another collection.
+ /// A DuplicateNameException is generated if this collection already has a relation with the same name (case insensitive).
+ /// An InvalidConstraintException is generated if the relation can't be created based on the parameters.
+ /// The CollectionChanged event is raised if it succeeds.
+ /// </summary>
+ /// <param name="name">The name of the relation.</param>
+ /// <param name="parentColumn">parent column of relation.</param>
+ /// <param name="childColumn">child column of relation.</param>
+ /// <param name="createConstraints">true to create constraints; otherwise false. (default is true)</param>
+ /// <returns>The created DataRelation.</returns>
+ public override DataRelation Add(string name, DataColumn parentColumn, DataColumn childColumn, bool createConstraints)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumn, childColumn, createConstraints);
+ list.Add(dataRelation);
+ return dataRelation;
+ }
+
+ /// <summary>
+ /// Creates a DataRelation with the specified name, arrays of parent and child columns,
+ /// and value specifying whether to create a constraint, and adds it to the collection.
+ /// </summary>
+ /// <param name="name">The name of the DataRelation to create.</param>
+ /// <param name="parentColumns">An array of parent DataColumn objects.</param>
+ /// <param name="childColumns">An array of child DataColumn objects.</param>
+ /// <param name="createConstraints">true to create a constraint; otherwise false.</param>
+ /// <returns>The created DataRelation.</returns>
+ public override DataRelation Add(string name, DataColumn[] parentColumns, DataColumn[] childColumns, bool createConstraints)
+ {
+ //If no name was supplied, give it a default name.
+ if ((name == null) || (name == ""))
+ {
+ name = "Relation" + defaultNameIndex.ToString();
+ defaultNameIndex++;
+ }
+
+ DataRelation dataRelation = new DataRelation(name, parentColumns, childColumns, createConstraints);
+ list.Add(dataRelation);
+ return dataRelation;
+ }
+ #endregion
+
+ /// <summary>
+ /// Performs verification on the table.
+ /// </summary>
+ /// <param name="relation">The relation to check.</param>
+ protected virtual void AddCore(DataRelation relation)
+ {
+ if (relation == null)
+ {
+ //TODO: Issue a good exception message.
+ throw new ArgumentNullException();
+ }
+ else if(list.IndexOf(relation) != -1)
+ {
+ //TODO: Issue a good exception message.
+ throw new ArgumentException();
+ }
+ else if(list.Contains(relation.RelationName))
+ {
+ throw new DuplicateNameException("A Relation named " + relation.RelationName + " already belongs to this DataSet.");
+ }
+ }
+ */
+
+ /// <summary>
+ /// Copies the elements of the specified DataRelation array to the end of the collection.
+ /// </summary>
+ /// <param name="relations">The array of DataRelation objects to add to the collection.</param>
+ public virtual void AddRange(DataRelation[] relations)
+ {
+ //TODO: Implement.
+
+ DataSet dataSet = GetDataSet();
+
+ foreach(DataRelation dataRelation in relations)
+ {
+
+ }
+
+ }
+
+ public virtual bool CanRemove(DataRelation relation)
+ {
+ //TODO: Implement.
+ return false;
+ }
+
+ public virtual void Clear()
+ {
+ }
+
+ public virtual bool Contains(string name)
+ {
+ return false;
+ }
+
+ protected override DataSet GetDataSet()
+ {
+ return table.DataSet;
+ }
+
+ public virtual int IndexOf(DataRelation relation)
+ {
+ return list.IndexOf(relation);
+ }
+
+ public virtual int IndexOf(string relationName)
+ {
+ return list.IndexOf(this[relationName]);
+ }
+
+ protected virtual void OnCollectionChanged(CollectionChangeEventArgs ccevent)
+ {
+ }
+
+ protected internal virtual void OnCollectionChanging(CollectionChangeEventArgs ccevent)
+ {
+ }
+
+ public void Remove(DataRelation relation)
+ {
+ }
+
+ public void Remove(string name)
+ {
+ }
+
+ public void RemoveAt(int index)
+ {
+ }
+
+ protected virtual void RemoveCore(DataRelation relation)
+ {
+ }
+
+ public event CollectionChangeEventHandler CollectionChanged;
+
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/DataViewRowState.cs b/mcs/class/System.Data/System.Data/DataViewRowState.cs
new file mode 100644
index 00000000000..2768fbe0e0f
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DataViewRowState.cs
@@ -0,0 +1,29 @@
+//
+// System.Data.DataViewRowState.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Describes the version of data in a DataRow.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum DataViewRowState
+ {
+ None = 0,
+ Unchanged = 2,
+ Added = 4,
+ Deleted = 8,
+ ModifiedCurrent = 16,
+ CurrentRows = 22,
+ ModifiedOriginal = 32,
+ OriginalRows = 42
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/DbType.cs b/mcs/class/System.Data/System.Data/DbType.cs
new file mode 100644
index 00000000000..9a0cad9a631
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/DbType.cs
@@ -0,0 +1,44 @@
+//
+// System.Data.DbType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Gets the data type of a field, a property, or a Parameter object of a .NET data provider.
+ /// </summary>
+ [Serializable]
+ public enum DbType
+ {
+ AnsiString = 0,
+ Binary = 1,
+ Byte = 2,
+ Boolean = 3,
+ Currency = 4,
+ Date = 5,
+ DateTime = 6,
+ Decimal = 7,
+ Double = 8,
+ Guid = 9,
+ Int16 = 10,
+ Int32 = 11,
+ Int64 = 12,
+ Object = 13,
+ SByte = 14,
+ Single = 15,
+ String = 16,
+ Time = 17,
+ UInt16 = 18,
+ UInt32 = 19,
+ UInt64 = 20,
+ VarNumeric = 21,
+ AnsiStringFixedLength = 22,
+ StringFixedLength = 23
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/FillErrorEventHandler.cs b/mcs/class/System.Data/System.Data/FillErrorEventHandler.cs
new file mode 100644
index 00000000000..8f63a935cdb
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/FillErrorEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.FillErrorEventHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the method that will handle the FillError event.
+ /// </summary>
+ [Serializable]
+ public delegate void FillErrorEventHandler(object sender, FillErrorEventArgs e);
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IColumnMapping.cs b/mcs/class/System.Data/System.Data/IColumnMapping.cs
new file mode 100644
index 00000000000..2e307763533
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IColumnMapping.cs
@@ -0,0 +1,35 @@
+//
+// System.Data.IColumnMapping.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Associates a data source column with a DataSet column, and is implemented by the DataColumnMapping class, which is used in common by .NET data providers.
+ /// </summary>
+ public interface IColumnMapping
+ {
+ /// <summary>
+ /// Gets or sets the name of the column within the DataSet to map to.
+ /// </summary>
+ string DataSetColumn
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets the name of the column within the data source to map from. The name is case-sensitive.
+ /// </summary>
+ string SourceColumn
+ {
+ get;
+ set;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IColumnMappingCollection.cs b/mcs/class/System.Data/System.Data/IColumnMappingCollection.cs
new file mode 100644
index 00000000000..a23a2ae6056
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IColumnMappingCollection.cs
@@ -0,0 +1,35 @@
+//
+// System.Data.IColumnMappingCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System.Collections;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Contains a collection of ColumnMapping objects, and is implemented by the DataColumnMappingCollection, which is used in common by .NET data providers.
+ /// </summary>
+ public interface IColumnMappingCollection : IList, ICollection, IEnumerable
+ {
+ IColumnMapping Add(string sourceColumnName, string dataSetColumnName);
+
+ bool Contains(string sourceColumnName);
+
+ IColumnMapping GetByDataSetColumn(string dataSetColumnName);
+
+ int IndexOf(string sourceColumnName);
+
+ void RemoveAt(string sourceColumnName);
+
+ object this[string index]
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/IDataAdapter.cs b/mcs/class/System.Data/System.Data/IDataAdapter.cs
new file mode 100644
index 00000000000..be6f09036b0
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDataAdapter.cs
@@ -0,0 +1,33 @@
+//
+// System.Data.IDataAdapter.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Allows an object to implement a DataAdapter, and represents a set of methods and mapping action-related properties used to fill and refresh a DataSet and update a data source.
+ /// </summary>
+ public interface IDataAdapter
+ {
+ int Fill(DataSet dataSet);
+
+ DataTable[] FillSchema(DataSet dataSet, SchemaType schemaType);
+
+ IDataParameter[] GetFillParameters();
+
+ int Update(DataSet dataSet);
+
+ MissingMappingAction MissingMappingAction{get;set;}
+
+ MissingSchemaAction MissingSchemaAction{get;set;}
+
+ ITableMappingCollection TableMappings{get;}
+
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDataParameter.cs b/mcs/class/System.Data/System.Data/IDataParameter.cs
new file mode 100644
index 00000000000..3528cb2f246
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDataParameter.cs
@@ -0,0 +1,36 @@
+//
+// System.Data.IDataParameter.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents a parameter to a Command object, and optionally, its mapping to DataSet columns; and is implemented by .NET data providers that access data sources.
+ /// </summary>
+ public interface IDataParameter
+ {
+
+ DbType DbType{get;set;}
+
+ ParameterDirection Direction{get;set;}
+
+ bool IsNullable{get;}
+
+ string ParameterName{get;set;}
+
+ string SourceColumn{get;set;}
+
+ DataRowVersion SourceVersion {get;set;}
+
+ object Value {get;set;}
+
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDataParameterCollection.cs b/mcs/class/System.Data/System.Data/IDataParameterCollection.cs
new file mode 100644
index 00000000000..41da8ab9d77
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDataParameterCollection.cs
@@ -0,0 +1,28 @@
+//
+// System.Data.IDataParameterCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+using System.Collections;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Collects all parameters relevant to a Command object and their mappings to DataSet columns, and is implemented by .NET data providers that access data sources.
+ /// </summary>
+ public interface IDataParameterCollection : IList, ICollection, IEnumerable
+ {
+ void RemoveAt(string parameterName);
+
+ int IndexOf(string parameterName);
+
+ bool Contains(string parameterName);
+
+ object this[string parameterName]{get; set;}
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/IDataReader.cs b/mcs/class/System.Data/System.Data/IDataReader.cs
new file mode 100644
index 00000000000..746d0d72ed6
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDataReader.cs
@@ -0,0 +1,33 @@
+//
+// System.Data.IDataReader.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Provides a means of reading one or more forward-only streams of result sets obtained by executing a command at a data source, and is implemented by .NET data providers that access relational databases.
+ /// </summary>
+ public interface IDataReader : IDisposable, IDataRecord
+ {
+ void Close();
+
+ DataTable GetSchemaTable();
+
+ bool NextResult();
+
+ bool Read();
+
+ int Depth{get;}
+
+ bool IsClosed{get;}
+
+ int RecordsAffected{get;}
+
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDataRecord.cs b/mcs/class/System.Data/System.Data/IDataRecord.cs
new file mode 100644
index 00000000000..7221603ae38
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDataRecord.cs
@@ -0,0 +1,67 @@
+//
+// System.Data.IDataRecord.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Provides access to the column values within each row for a DataReader, and is implemented by .NET data providers that access relational databases.
+ /// </summary>
+ public interface IDataRecord
+ {
+ bool GetBoolean(int i);
+
+ byte GetByte(int i);
+
+ long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferOffset, int length);
+
+ char GetChar(int i);
+
+ long GetChars(int i, long fieldOffset, char[] buffer, int bufferOffset, int length);
+
+ IDataReader GetData(int i);
+
+ string GetDataTypeName(int i);
+
+ DateTime GetDateTime(int i);
+
+ decimal GetDecimal(int i);
+
+ double GetDouble(int i);
+
+ Type GetFieldType(int i);
+
+ float GetFloat(int i);
+
+ Guid GetGuid(int i);
+
+ short GetInt16(int i);
+
+ int GetInt32(int i);
+
+ long GetInt64(int i);
+
+ string GetName(int i);
+
+ int GetOrdinal(string name);
+
+ string GetString(int i);
+
+ object GetValue(int i);
+
+ int GetValues(object[] values);
+
+ bool IsDBNull(int i);
+
+ int FieldCount{get;}
+
+ object this[string name]{get;}
+
+ object this[int i]{get;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDbCommand.cs b/mcs/class/System.Data/System.Data/IDbCommand.cs
new file mode 100644
index 00000000000..e079dd11ebc
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDbCommand.cs
@@ -0,0 +1,51 @@
+//
+// System.Data.IDBCommand.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents a SQL statement that is executed while connected to a data source, and is implemented by .NET data providers that access relational databases.
+ /// </summary>
+ public interface IDbCommand
+ {
+ void Cancel();
+
+ IDbDataParameter CreateParameter();
+
+ int ExecuteNonQuery();
+
+ // FIXME: temporarily commented so i could
+ // compile SqlConnection and SqlCommand
+ /*
+ IDataReader ExecuteReader();
+
+ IDataReader ExecuteReader(CommandBehavior behavior);
+ */
+ object ExecuteScalar();
+
+ void Prepare();
+
+
+ string CommandText{get; set;}
+
+ int CommandTimeout{get; set;}
+
+ CommandType CommandType{get; set;}
+
+ IDbConnection Connection{get; set;}
+
+ IDataParameterCollection Parameters{get;}
+
+ IDbTransaction Transaction{get; set;}
+
+ UpdateRowSource UpdatedRowSource{get; set;}
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/IDbConnection.cs b/mcs/class/System.Data/System.Data/IDbConnection.cs
new file mode 100644
index 00000000000..1b84bed5ba2
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDbConnection.cs
@@ -0,0 +1,41 @@
+//
+// System.Data.IDBConnection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents an open connection to a data source, and is implemented by .NET data providers that access relational databases.
+ /// </summary>
+ public interface IDbConnection
+ {
+ IDbTransaction BeginTransaction();
+
+ IDbTransaction BeginTransaction(IsolationLevel il);
+
+ void ChangeDatabase(string databaseName);
+
+ void Close();
+
+ IDbCommand CreateCommand();
+
+ void Open();
+
+
+ string ConnectionString{get; set;}
+
+ int ConnectionTimeout{get;}
+
+ string Database{get;}
+
+ ConnectionState State{get;}
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDbDataAdapter.cs b/mcs/class/System.Data/System.Data/IDbDataAdapter.cs
new file mode 100644
index 00000000000..78c1173da09
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDbDataAdapter.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.IDbDataAdapter.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents a set of command-related properties that are used to fill the DataSet and update a data source, and is implemented by .NET data providers that access relational databases.
+ /// </summary>
+ public interface IDbDataAdapter : IDataAdapter
+ {
+ IDbCommand DeleteCommand{get; set;}
+
+ IDbCommand InsertCommand{get; set;}
+
+ IDbCommand SelectCommand{get; set;}
+
+ IDbCommand UpdateCommand{get; set;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDbDataParameter.cs b/mcs/class/System.Data/System.Data/IDbDataParameter.cs
new file mode 100644
index 00000000000..5eeba691179
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDbDataParameter.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.IDbDataParameter.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Used by the Visual Basic .NET Data Designers to represent a parameter to a Command object, and optionally, its mapping to DataSet columns.
+ /// </summary>
+ public interface IDbDataParameter : IDataParameter
+ {
+ byte Precision{get; set;}
+
+ byte Scale{get; set;}
+
+ int Size{get; set;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/IDbTransaction.cs b/mcs/class/System.Data/System.Data/IDbTransaction.cs
new file mode 100644
index 00000000000..792a78052b0
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IDbTransaction.cs
@@ -0,0 +1,27 @@
+//
+// System.Data.IDbTransaction.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents a transaction to be performed at a data source, and is implemented by .NET data providers that access relational databases.
+ /// </summary>
+ public interface IDbTransaction : IDisposable
+ {
+ void Commit();
+
+ void Rollback();
+
+ IDbConnection Connection{get;}
+
+ IsolationLevel IsolationLevel{get;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/ITableMapping.cs b/mcs/class/System.Data/System.Data/ITableMapping.cs
new file mode 100644
index 00000000000..82f5329b083
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ITableMapping.cs
@@ -0,0 +1,23 @@
+//
+// System.Data.ITableMapping.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Associates a source table with a table in a DataSet, and is implemented by the DataTableMapping class, which is used in common by .NET data providers.
+ /// </summary>
+ public interface ITableMapping
+ {
+ IColumnMappingCollection ColumnMappings{get;}
+
+ string DataSetTable{get; set;}
+
+ string SourceTable{get; set;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/ITableMappingCollection.cs b/mcs/class/System.Data/System.Data/ITableMappingCollection.cs
new file mode 100644
index 00000000000..5ca052f94ab
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ITableMappingCollection.cs
@@ -0,0 +1,31 @@
+//
+// System.Data.ITableMappingCollection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System.Collections;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Contains a collection of TableMapping objects, and is implemented by the DataTableMappingCollection, which is used in common by .NET data providers.
+ /// </summary>
+ public interface ITableMappingCollection : IList, ICollection, IEnumerable
+ {
+ ITableMapping Add(string sourceTableName, string dataSetTableName);
+
+ bool Contains(string sourceTableName);
+
+ ITableMapping GetByDataSetTable(string dataSetTableName);
+
+ int IndexOf(string sourceTableName);
+
+ void RemoveAt(string sourceTableName);
+
+ object this[string index]{get; set;}
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs b/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs
new file mode 100644
index 00000000000..2397051bec8
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/InternalDataCollectionBase.cs
@@ -0,0 +1,86 @@
+//
+// System.Data.InternalDataCollectionBase.cs
+//
+// Base class for:
+// DataRowCollection
+// DataColumnCollection
+// DataTableCollection
+// DataRelationCollection
+// DataConstraintCollection
+//
+// Author:
+// Daniel Morgan
+//
+// (C) Ximian, Inc. 2002
+//
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Base class for System.Data collection classes
+ /// that are used within a DataTable object
+ /// to represent a collection of
+ /// relations, tables, rows, columns, and constraints
+ /// </summary>
+ public class InternalDataCollectionBase : ICollection, IEnumerable {
+
+ // Constructor
+ [MonoTODO]
+ public InternalDataCollectionBase() {
+ // FIXME: TODO
+ }
+
+ public virtual int Count {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ public bool IsReadOnly {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ public bool IsSynchronized {
+ [MonoTODO]
+ get {
+
+ }
+ }
+
+ public object SyncRoot {
+ [MonoTODO]
+ get {
+
+ }
+ }
+
+ protected virtual ArrayList List {
+ [MonoTODO]
+ get {
+ }
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array ar, int index) {
+
+ }
+
+ [MonoTODO]
+ public IEnumerator GetEnumerator() {
+
+ }
+
+ [MonoTODO]
+ ~InternalDataCollectionBase() {
+
+ }
+
+ }
+
+}
diff --git a/mcs/class/System.Data/System.Data/IsolationLevel.cs b/mcs/class/System.Data/System.Data/IsolationLevel.cs
new file mode 100644
index 00000000000..3a25ef9cc0e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/IsolationLevel.cs
@@ -0,0 +1,27 @@
+//
+// System.Data.IsolationLevel.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the transaction locking behavior for the connection.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum IsolationLevel
+ {
+ Unspecified = -1,
+ Chaos = 16,
+ ReadUncommitted = 256,
+ ReadCommitted = 4096,
+ RepeatableRead = 65536,
+ Serializable = 1048576
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/MappingType.cs b/mcs/class/System.Data/System.Data/MappingType.cs
new file mode 100644
index 00000000000..dbdeb9fc23e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/MappingType.cs
@@ -0,0 +1,26 @@
+//
+// System.Data.MappingType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies how a DataColumn is mapped.
+ /// </summary>
+ [Serializable]
+ public enum MappingType
+ {
+ Element = 1,
+ Attribute = 2,
+ SimpleContent = 3,
+ Hidden = 4
+
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/MergeFailedEventHandler.cs b/mcs/class/System.Data/System.Data/MergeFailedEventHandler.cs
new file mode 100644
index 00000000000..3ec7962496a
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/MergeFailedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.MergeFailedEventHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the method that will handle the MergeFailed event.
+ /// </summary>
+ [Serializable]
+ public delegate void MergeFailedEventHandler(object sender, MergeFailedEventArgs e);
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/MissingMappingAction.cs b/mcs/class/System.Data/System.Data/MissingMappingAction.cs
new file mode 100644
index 00000000000..74ce838d9c9
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/MissingMappingAction.cs
@@ -0,0 +1,24 @@
+//
+// System.Data.MissingMappingAction.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Determines the action that occurs when a mapping is missing from a source table or a source column.
+ /// </summary>
+ [Serializable]
+ public enum MissingMappingAction
+ {
+ Passthrough = 1,
+ Ignore = 2,
+ Error = 3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/MissingSchemaAction.cs b/mcs/class/System.Data/System.Data/MissingSchemaAction.cs
new file mode 100644
index 00000000000..52051457961
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/MissingSchemaAction.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.MissingSchemaAction.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the action to take when adding data to the DataSet and the required DataTable or DataColumn is missing.
+ /// </summary>
+ [Serializable]
+ public enum MissingSchemaAction
+ {
+ Add = 1,
+ Ignore = 2,
+ Error = 3,
+ AddWithKey = 4
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/ParameterDirection.cs b/mcs/class/System.Data/System.Data/ParameterDirection.cs
new file mode 100644
index 00000000000..7de26dfc868
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/ParameterDirection.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.ParameterDirection.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the type of a parameter within a query relative to the DataSet.
+ /// </summary>
+ [Serializable]
+ public enum ParameterDirection
+ {
+ Input = 1,
+ Output = 2,
+ InputOutput = 3,
+ ReturnValue = 6
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/PropertyAttributes.cs b/mcs/class/System.Data/System.Data/PropertyAttributes.cs
new file mode 100644
index 00000000000..6e43646100e
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/PropertyAttributes.cs
@@ -0,0 +1,28 @@
+//
+// System.Data.PropertyAttributes.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the attributes of a property.
+ /// This enumeration has a FlagsAttribute that allows a bitwise combination of its member values
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum PropertyAttributes
+ {
+ NotSupported = 0,
+ Required = 1,
+ Optional = 2,
+ Read = 512,
+ Write = 1024
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/Rule.cs b/mcs/class/System.Data/System.Data/Rule.cs
new file mode 100644
index 00000000000..e8fc4166f34
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/Rule.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.Rule.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Indicates the action that occurs when a ForeignKeyConstraint is enforced.
+ /// </summary>
+ [Serializable]
+ public enum Rule
+ {
+ None = 0,
+ Cascade = 1,
+ SetNull = 2,
+ SetDefault = 3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/SchemaType.cs b/mcs/class/System.Data/System.Data/SchemaType.cs
new file mode 100644
index 00000000000..8c0d1dbf904
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/SchemaType.cs
@@ -0,0 +1,23 @@
+//
+// System.Data.SchemaType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies how to handle existing schema mappings when performing a FillSchema operation.
+ /// </summary>
+ [Serializable]
+ public enum SchemaType
+ {
+ Source = 1,
+ Mapped = 2
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/SqlDbType.cs b/mcs/class/System.Data/System.Data/SqlDbType.cs
new file mode 100644
index 00000000000..9c4afccf5e0
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/SqlDbType.cs
@@ -0,0 +1,45 @@
+//
+// System.Data.SqlDbType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies SQL Server data types.
+ /// </summary>
+ [Serializable]
+ public enum SqlDbType
+ {
+ BigInt = 0,
+ Binary = 1,
+ Bit = 2,
+ Char = 3,
+ DateTime = 4,
+ Decimal = 5,
+ Float = 6,
+ Image = 7,
+ Int = 8,
+ Money = 9,
+ NChar = 10,
+ NText = 11,
+ NVarChar = 12,
+ Real = 13,
+ UniqueIdentifier = 14,
+ SmallDateTime = 15,
+ SmallInt = 16,
+ SmallMoney = 17,
+ Text = 18,
+ Timestamp = 19,
+ TinyInt = 20,
+ VarBinary = 21,
+ VarChar = 22,
+ Variant = 23
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/StateChangeEventArgs.cs b/mcs/class/System.Data/System.Data/StateChangeEventArgs.cs
new file mode 100644
index 00000000000..c21e4abbc76
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/StateChangeEventArgs.cs
@@ -0,0 +1,43 @@
+//
+// System.Data.SqlRowUpdatingEventArgs.cs
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+
+namespace System.Data {
+ public sealed class StateChangeEventArgs : EventArgs {
+
+ [MonoTODO]
+ public StateChangeEventArgs(ConnectionState originalState,
+ ConnectionState currentState) {
+ // FIXME: do me
+ }
+
+ [MonoTODO]
+ public ConnectionState CurrentState {
+ get {
+ // FIXME: do me
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public ConnectionState OriginalState {
+ get {
+ // FIXME: do me
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ ~StateChangeEventArgs() {
+ // FIXME: do me
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/StateChangeEventHandler.cs b/mcs/class/System.Data/System.Data/StateChangeEventHandler.cs
new file mode 100644
index 00000000000..29ad7703030
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/StateChangeEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Data.StateChangeEventHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+namespace System.Data
+{
+ /// <summary>
+ /// Represents the method that will handle the StateChange event.
+ /// </summary>
+ [Serializable]
+ public delegate void StateChangeEventHandler(object sender, StateChangeEventArgs e);
+
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/StatementType.cs b/mcs/class/System.Data/System.Data/StatementType.cs
new file mode 100644
index 00000000000..11cc51c1bba
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/StatementType.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.StatementType.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the type of SQL query to be used by the OleDbRowUpdatedEventArgs, OleDbRowUpdatingEventArgs, SqlRowUpdatedEventArgs, or SqlRowUpdatingEventArgs class.
+ /// </summary>
+ [Serializable]
+ public enum StatementType
+ {
+ Select = 0,
+ Insert = 1,
+ Update = 2,
+ Delete = 3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/TODOAttribute.cs b/mcs/class/System.Data/System.Data/TODOAttribute.cs
new file mode 100644
index 00000000000..9aae1ca30bb
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/TODOAttribute.cs
@@ -0,0 +1,33 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Data {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.Data/System.Data/UpdateRowSource.cs b/mcs/class/System.Data/System.Data/UpdateRowSource.cs
new file mode 100644
index 00000000000..6ccf40d5306
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/UpdateRowSource.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.UpdateRowSource.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies how query command results are applied to the row being updated.
+ /// </summary>
+ [Serializable]
+ public enum UpdateRowSource
+ {
+ None = 0,
+ OutputParameters = 1,
+ FirstReturnedRecord = 2,
+ Both = 3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/UpdateStatus.cs b/mcs/class/System.Data/System.Data/UpdateStatus.cs
new file mode 100644
index 00000000000..f686d6cd1aa
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/UpdateStatus.cs
@@ -0,0 +1,25 @@
+//
+// System.Data.UpdateStatus.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies the action to take with regard to the current and remaining rows during an Update.
+ /// </summary>
+ [Serializable]
+ public enum UpdateStatus
+ {
+ Continue = 0,
+ ErrorsOccurred = 1,
+ SkipCurrentRow = 2,
+ SkipAllRemainingRows = 3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/XmlReadMode.cs b/mcs/class/System.Data/System.Data/XmlReadMode.cs
new file mode 100644
index 00000000000..d8db21dbd19
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/XmlReadMode.cs
@@ -0,0 +1,27 @@
+//
+// System.Data.XmlReadMode.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Specifies how to read XML data and a relational schema into a DataSet.
+ /// </summary>
+ [Serializable]
+ public enum XmlReadMode
+ {
+ Auto = 0,
+ ReadSchema = 1,
+ IgnoreSchema = 2,
+ InferSchema = 3,
+ DiffGram = 4,
+ Fragment = 5
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/System.Data/XmlWriteMode.cs b/mcs/class/System.Data/System.Data/XmlWriteMode.cs
new file mode 100644
index 00000000000..f70b9c5850b
--- /dev/null
+++ b/mcs/class/System.Data/System.Data/XmlWriteMode.cs
@@ -0,0 +1,24 @@
+//
+// System.Data.XmlWriteMode.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+
+namespace System.Data
+{
+ /// <summary>
+ /// Use the members of this enumeration when setting the WriteMode parameter of the WriteXml method.
+ /// </summary>
+ [Serializable]
+ public enum XmlWriteMode
+ {
+ WriteSchema = 0,
+ IgnoreSchema = 1,
+ DiffGram = 2
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Data/TODO b/mcs/class/System.Data/TODO
new file mode 100644
index 00000000000..7d0fc012101
--- /dev/null
+++ b/mcs/class/System.Data/TODO
@@ -0,0 +1,157 @@
+System.Data TODO List
+=====================
+
+This TODO list last updated on 2002-04-23
+
+Update this file as needed...
+
+* To get ExecuteReader() in a SqlCommand object to return
+ a SqlDataReader object which can Read() data and get a String or
+ Int32 from the database. Other types can be done later.
+
+In order to do this, we need to compile
+ SqlDataReader
+ DataTable
+ and dependencies...
+
+Other classes missing:
+ * InternalDataCollectionBase - this is a public class despite its name
+ * DataRowBuilder
+ * Constraint
+ * ConstraintCollection
+
+System.Data.Common classes that need to be implemented:
+ - implement DataAdapter.cs
+ - implement DataColumnMapping.cs
+ - implement DataColumnMappingCollection.cs
+ - implement DataTableMapping.cs
+ - implement DataTableMappingCollection.cs
+ - implement DbDataAdapter.cs
+ - implement DbDataPermission.cs
+ - implement DbDataPermissionAttribute.cs
+ - implement RowUpdatedEventArgs.cs
+ - implement RowUpdatingEventArgs.cs
+
+The following classes implement InternalDataCollectionBase:
+ * DataRowCollection
+ * DataColumnCollection
+ * DataTableCollection
+ * DataRelationCollection
+ * ConstraintCollection
+
+Other classes, structs, etc. that are missing:
+ Constraint
+ DataRowChangeEventArgs
+ DataSysDescriptionAttribute
+ DataView
+ DataViewManager
+ DataViewSetting
+ DataViewSettingCollection
+ FillErrorEventArgs
+ ForeignKeyConstraint
+ MergeFailedEventArgs
+ PropertyCollection
+ UniqueConstraint
+ TypedDataSetGenerator
+
+Exceptions that still need to be stubbed:
+ (need to see what exceptions need to be done)
+ ConstraintException
+ DataException
+ DBConcurrencyException
+ InvalidConstraintException
+ InvalidExpressionException
+ MissingPrimaryKeyException
+ NonNullAllowedException
+ ReadOnlyException
+ RowNotInTableException
+ SqlNullValueException
+ SqlTruncateException
+ SqlTypeException
+ StrongTypingException
+ SyntaxErrorException
+ TypedDataSetGeneratorException
+ VersionNotFoundException
+
+The additional System.Data.SqlTypes classes need to be stubbed:
+ SqlByte
+ SqlDataTime
+ SqlDecimal
+ SqlDouble
+ SqlGuid
+ SqlInt16
+ SqlInt64
+ SqlMoney
+ SqlSingle
+
+* provide a standard scheme for storing
+ connection string data
+
+* allow Execute methods in SqlCommand to
+ call a stored procedure
+
+* Create a script for testing System.Data:
+ - calls script to create
+ a test database named monotestdb
+ - set up nunit for testing System.Data
+ - set up System.Data.Config or some other
+ file to hold connection strings and other
+ configuration settings for the testing System.Data
+ - any other stuff needed...
+
+* get SqlParameter/SqlParameterCollection
+ working so you can:
+ - for queries/commands that have parameters:
+ o input
+ o output
+ o return
+ o input/output
+ - call a stored procedure with parameters
+
+* be able to return a XmlReader from
+ using method ExecuteXmlReader of
+ a SqlCommand object
+
+* get SqlDataAdapter/DataSet working
+
+* Create Library for PInvoking into libgda
+ This will be used by System.Data.OleDb classes
+
+* Begin System.Data.OleDb classes:
+ - OleDbConnection
+ - OleDbCommand
+ - OleDbTransaction
+
+* Do more of the OleDb classes to
+ retrieve a OleDbDataReader object
+ from a query (SELECT FROM):
+ - OleDbDataReader
+ - others...
+
+* Do more OleDb classes for DataSet:
+ - OleDbDataAdapter
+ - others...
+
+* Security Audit of System.Data
+
+* Create a MySQL ADO.NET Provider
+
+* Create an Oracle ADO.NET Provider
+
+* Create an Interbase ADO.NET Provider
+
+* Create a Sybase ADO.NET Provider (TDS?)
+
+* Create an IBM UDB DB2 ADO.NET Provider
+
+* Create other ADO.NET providers...
+
+Integration
+===========
+
+* get System.Data to work with ASP.NET's
+ System.Web.UI.WebControls.DataGrid
+
+* get System.Data to work with GUI
+ System.Windows.Forms.DataGrid
+
diff --git a/mcs/class/System.Data/Test/TestSqlException.cs b/mcs/class/System.Data/Test/TestSqlException.cs
new file mode 100644
index 00000000000..81ea28c740b
--- /dev/null
+++ b/mcs/class/System.Data/Test/TestSqlException.cs
@@ -0,0 +1,116 @@
+//
+// TestSqlInsert.cs
+//
+// To Test SqlConnection and SqlCommand by connecting
+// to a PostgreSQL database
+// and then executing an INSERT SQL statement
+//
+// To use:
+// change strings to your database, userid, tables, etc...:
+// connectionString
+// insertStatement
+//
+// To test:
+// mcs TestSqlInsert.cs -r System.Data
+// mint TestSqlInsert.exe
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+namespace TestSystemDataSqlClient
+{
+ class TestSqlInsert
+ {
+ [STAThread]
+ static void Main(string[] args) {
+ SqlConnection conn;
+ SqlCommand cmd;
+ SqlTransaction trans;
+
+ int rowsAffected;
+
+ String connectionString;
+ String insertStatement;
+ String deleteStatement;
+
+ connectionString =
+ "host=localhost;" +
+ "dbname=test;" +
+ "user=danmorg;" +
+ "password=viewsonic";
+
+ insertStatement =
+ "insert into NoSuchTable " +
+ "(tid, tdesc) " +
+ "values ('beer', 'Beer for All!') ";
+
+ deleteStatement =
+ "delete from sometable " +
+ "where tid = 'beer' ";
+
+ try {
+ // Connect to a PostgreSQL database
+ Console.WriteLine ("Connect to database...");
+ conn = new SqlConnection(connectionString);
+ conn.Open();
+
+ // begin transaction
+ Console.WriteLine ("Begin Transaction...");
+ trans = conn.BeginTransaction();
+
+ // create SQL DELETE command
+ Console.WriteLine ("Create Command initializing " +
+ "with an DELETE statement...");
+ cmd = new SqlCommand (deleteStatement, conn);
+
+ // execute the DELETE SQL command
+ Console.WriteLine ("Execute DELETE SQL Command...");
+ rowsAffected = cmd.ExecuteNonQuery();
+ Console.WriteLine ("Rows Affected: " + rowsAffected);
+
+ // change the SQL command to an SQL INSERT Command
+ Console.WriteLine ("Now use INSERT SQL Command...");
+ cmd.CommandText = insertStatement;
+
+ // execute the INSERT SQL command
+ Console.WriteLine ("Execute INSERT SQL Command...");
+ rowsAffected = cmd.ExecuteNonQuery();
+ Console.WriteLine ("Rows Affected: " + rowsAffected);
+
+ // if successfull at INSERT, commit the transaction,
+ // otherwise, do a rollback the transaction using
+ // trans.Rollback();
+ Console.WriteLine ("Commit transaction...");
+ trans.Commit();
+
+ // Close connection to database
+ Console.WriteLine ("Close database connection...");
+ conn.Close();
+
+ Console.WriteLine ("Assuming everything " +
+ "was successful.");
+ Console.WriteLine ("Verify data in database to " +
+ "see if row is there.");
+ }
+ catch(SqlException e) {
+ // Display the SQL Errors and Rollback the database
+ Console.WriteLine("SqlException caught: " +
+ e.ToString());
+ trans.Rollback();
+ Console.WriteLine("Database has been Rolled back!");
+ }
+ finally {
+ if(conn.State == ConnectionState.Open)
+ conn.Close();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/TestSqlInsert.cs b/mcs/class/System.Data/Test/TestSqlInsert.cs
new file mode 100644
index 00000000000..4a968e6305f
--- /dev/null
+++ b/mcs/class/System.Data/Test/TestSqlInsert.cs
@@ -0,0 +1,106 @@
+//
+// TestSqlInsert.cs
+//
+// To Test SqlConnection and SqlCommand by connecting
+// to a PostgreSQL database
+// and then executing an INSERT SQL statement
+//
+// To use:
+// change strings to your database, userid, tables, etc...:
+// connectionString
+// insertStatement
+//
+// To test:
+// mcs TestSqlInsert.cs -r System.Data
+// mint TestSqlInsert.exe
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+namespace TestSystemDataSqlClient
+{
+ class TestSqlInsert
+ {
+ [STAThread]
+ static void Main(string[] args)
+ {
+ SqlConnection conn;
+ SqlCommand cmd;
+ SqlTransaction trans;
+
+ int rowsAffected;
+
+ String connectionString;
+ String insertStatement;
+ String deleteStatement;
+
+ connectionString =
+ "host=localhost;" +
+ "dbname=test;" +
+ "user=danmorg;" +
+ "password=viewsonic";
+
+ insertStatement =
+ "insert into sometable " +
+ "(tid, tdesc) " +
+ "values ('beer', 'Beer for All!') ";
+
+ deleteStatement =
+ "delete from sometable " +
+ "where tid = 'beer' ";
+
+ // Connect to a PostgreSQL database
+ Console.WriteLine ("Connect to database...");
+ conn = new SqlConnection(connectionString);
+ conn.Open();
+
+ // begin transaction
+ Console.WriteLine ("Begin Transaction...");
+ trans = conn.BeginTransaction();
+
+ // create SQL DELETE command
+ Console.WriteLine ("Create Command initializing " +
+ "with an DELETE statement...");
+ cmd = new SqlCommand (deleteStatement, conn);
+
+ // execute the DELETE SQL command
+ Console.WriteLine ("Execute DELETE SQL Command...");
+ rowsAffected = cmd.ExecuteNonQuery();
+ Console.WriteLine ("Rows Affected: " + rowsAffected);
+
+ // change the SQL command to an SQL INSERT Command
+ Console.WriteLine ("Now use INSERT SQL Command...");
+ cmd.CommandText = insertStatement;
+
+ // execute the INSERT SQL command
+ Console.WriteLine ("Execute INSERT SQL Command...");
+ rowsAffected = cmd.ExecuteNonQuery();
+ Console.WriteLine ("Rows Affected: " + rowsAffected);
+
+ // if successfull at INSERT, commit the transaction,
+ // otherwise, do a rollback the transaction using
+ // trans.Rollback();
+ // FIXME: need to have exceptions working in
+ // SqlClient classes before you can do rollback
+ Console.WriteLine ("Commit transaction...");
+ trans.Commit();
+
+ // Close connection to database
+ Console.WriteLine ("Close database connection...");
+ conn.Close();
+
+ Console.WriteLine ("Assuming everything " +
+ "was successful.");
+ Console.WriteLine ("Verify data in database to " +
+ "see if row is there.");
+ }
+ }
+}
diff --git a/mcs/class/System.Data/Test/TestSqlIsolationLevel.cs b/mcs/class/System.Data/Test/TestSqlIsolationLevel.cs
new file mode 100644
index 00000000000..caeaf18cc81
--- /dev/null
+++ b/mcs/class/System.Data/Test/TestSqlIsolationLevel.cs
@@ -0,0 +1,105 @@
+//
+// TestSqlIsolationLevel.
+//
+// To Test Setting Isolation Level of SqlTransaction
+// to a PostgreSQL database
+//
+// To use:
+// change strings to your database, userid, tables, etc...:
+// connectionString
+// insertStatement
+//
+// To test:
+// mcs TestSqlIsolationLevel.cs -r System.Data
+// mint TestSqlIsolationLevel.exe
+//
+// Author:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Daniel Morgan (danmorg@sc.rr.com)
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+namespace TestSystemDataSqlClient
+{
+ class TestSqlInsert
+ {
+ [STAThread]
+ static void Main(string[] args)
+ {
+ SqlConnection conn;
+ SqlCommand cmd;
+ SqlTransaction trans;
+
+ int rowsAffected;
+
+ String connectionString;
+ String insertStatement;
+ String deleteStatement;
+
+ connectionString =
+ "host=localhost;" +
+ "dbname=test;" +
+ "user=danmorg;" +
+ "password=viewsonic";
+
+ insertStatement =
+ "insert into sometable " +
+ "(tid, tdesc) " +
+ "values ('beer', 'Beer for All!') ";
+
+ deleteStatement =
+ "delete from sometable " +
+ "where tid = 'beer' ";
+
+ // Connect to a PostgreSQL database
+ Console.WriteLine ("Connect to database...");
+ conn = new SqlConnection(connectionString);
+ conn.Open();
+
+ // begin transaction
+ Console.WriteLine ("Begin Transaction...");
+ trans = conn.BeginTransaction(IsolationLevel.Serializable);
+
+ // create SQL DELETE command
+ Console.WriteLine ("Create Command initializing " +
+ "with an DELETE statement...");
+ cmd = new SqlCommand (deleteStatement, conn);
+
+ // execute the DELETE SQL command
+ Console.WriteLine ("Execute DELETE SQL Command...");
+ rowsAffected = cmd.ExecuteNonQuery();
+ Console.WriteLine ("Rows Affected: " + rowsAffected);
+
+ // change the SQL command to an SQL INSERT Command
+ Console.WriteLine ("Now use INSERT SQL Command...");
+ cmd.CommandText = insertStatement;
+
+ // execute the INSERT SQL command
+ Console.WriteLine ("Execute INSERT SQL Command...");
+ rowsAffected = cmd.ExecuteNonQuery();
+ Console.WriteLine ("Rows Affected: " + rowsAffected);
+
+ // if successfull at INSERT, commit the transaction,
+ // otherwise, do a rollback the transaction using
+ // trans.Rollback();
+ // FIXME: need to have exceptions working in
+ // SqlClient classes before you can do rollback
+ Console.WriteLine ("Commit transaction...");
+ trans.Commit();
+
+ // Close connection to database
+ Console.WriteLine ("Close database connection...");
+ conn.Close();
+
+ Console.WriteLine ("Assuming everything " +
+ "was successful.");
+ Console.WriteLine ("Verify data in database to " +
+ "see if row is there.");
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/UITypeEditorEditStyle.cs b/mcs/class/System.Drawing/System.Drawing.Design/UITypeEditorEditStyle.cs
new file mode 100644
index 00000000000..6a571cc7cc4
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Design/UITypeEditorEditStyle.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.Design.UITypeEditorEditStyle.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Design
+{
+ public enum UITypeEditorEditStyle{
+ DropDown=1,
+ Modal=2,
+ None=3
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
new file mode 100644
index 00000000000..cf74d68dffe
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
@@ -0,0 +1,7 @@
+2002-01-06 Ravi Pratap <ravi@ximian.com>
+
+ * ChangeLog : Add.
+
+ * Matrix.cs : MonoTODO everywhere.
+
+ * TODOAttribute.cs : Add here too. \ No newline at end of file
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/Enums.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/Enums.cs
new file mode 100644
index 00000000000..3ba9f61892e
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/Enums.cs
@@ -0,0 +1,258 @@
+//
+// System.Drawing.Drawing2D.Matrix.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Drawing.Drawing2D
+{
+
+ public enum CombineMode
+ {
+ Complement,
+ Exclude,
+ Intersect,
+ Replace,
+ Union,
+ Xor
+ }
+
+ public enum CompositingMode
+ {
+ SourceCopy,
+ SourceOver
+ }
+
+ public enum CompositingQuality
+ {
+ AssumeLinear,
+ Default,
+ GammaCorrected,
+ HighQuality,
+ HighSpeed,
+ Invalid
+ }
+
+ public enum CoordinateSpace
+ {
+ Device,
+ Page,
+ World
+ }
+
+ public enum DashCap
+ {
+ Flat,
+ Round,
+ Triangle
+ }
+
+ public enum DashStyle
+ {
+ Custom,
+ Dash,
+ DashDot,
+ DashDotDot,
+ Dot,
+ Solid
+ }
+
+ public enum FillMode
+ {
+ Alternate,
+ Winding
+ }
+
+ public enum FlushIntention
+ {
+ Flush,
+ Sync
+ }
+
+ public enum HatchStyle
+ {
+ BackwardDiagonal,
+ Cross,
+ DarkDownwardDiagonal,
+ DarkHorizontal,
+ DarkUpwardDiagonal,
+ DarkVertical,
+ DashedDownwardDiagonal,
+ DashedHorizontal,
+ DashedUpwardDiagonal,
+ DashedVertical,
+ DiagonalBrick,
+ DiagonalCross,
+ Divot,
+ DottedDiamond,
+ DottedGrid,
+ ForwardDiagonal,
+ Horizontal,
+ HorizontalBrick,
+ LargeCheckerBoard,
+ LargeConfetti,
+ LargeGrid,
+ LightDownwardDiagonal,
+ LightHorizontal,
+ LightUpwardDiagonal,
+ LightVertical,
+ Max,
+ Min,
+ NarrowHorizontal,
+ NarrowVertical,
+ OutlinedDiamond,
+ Percent05,
+ Percent10,
+ Percent20,
+ Percent25,
+ Percent30,
+ Percent40,
+ Percent50,
+ Percent60,
+ Percent70,
+ Percent75,
+ Percent80,
+ Percent90,
+ Plaid,
+ Shingle,
+ SmallCheckerBoard,
+ SmallConfetti,
+ SmallGrid,
+ SolidDiamond,
+ Sphere,
+ Trellis,
+ Vertical,
+ Wave,
+ Weave,
+ WideDownwardDiagonal,
+ WideUpwardDiagonal,
+ ZigZag
+ }
+
+ public enum InterpolationMode
+ {
+ Bicubic,
+ Bilinear,
+ Default,
+ High,
+ HighQualityBicubic,
+ HighQualityBilinear,
+ Invalid,
+ Low,
+ NearestNeighbour
+ }
+
+ public enum LinearGradientMode
+ {
+ BackwardDiagonal,
+ ForwardDiagonal,
+ Horizontal,
+ Vertical
+ }
+
+ public enum LineCap
+ {
+ AnchorMask,
+ ArrowAnchor,
+ Custom,
+ DiamondAnchor,
+ Flat,
+ NoAnchor,
+ Round,
+ RoundAnchor,
+ Square,
+ SquareAnchor,
+ Triangle
+ }
+
+ public enum LineJoin
+ {
+ Bevel,
+ Miter,
+ MiterClipped,
+ Round
+ }
+
+ public enum MatrixOrder
+ {
+ Append,
+ Prepend
+ }
+
+ public enum PathPointType
+ {
+ Bezier,
+ Bezier3,
+ CloseSubpath,
+ DashMode,
+ Line,
+ PathMarker,
+ PathTypeMask,
+ Start
+ }
+
+ public enum PenAlignment
+ {
+ Center,
+ Inset,
+ Left,
+ Outset,
+ Right
+ }
+
+ public enum PenType
+ {
+ HatchFill,
+ LinearGradient,
+ PathGradient,
+ SolidColor,
+ TextureFill
+ }
+
+ public enum PixelOffsetMode
+ {
+ Default,
+ Half,
+ HighQuality,
+ HighSpeed,
+ Invalid,
+ None
+ }
+
+ public enum QualityMode
+ {
+ Default,
+ Hight,
+ Invalid,
+ Low
+ }
+
+ public enum SmoothingMode
+ {
+ AntiAlias,
+ Default,
+ HighQuality,
+ HighSpeed,
+ Invalid,
+ None
+ }
+
+ public enum WarpMode
+ {
+ Bilinear,
+ Perspective
+ }
+
+ public enum WrapMode
+ {
+ Clamp,
+ Tile,
+ TileFlipX,
+ TileFlipXY,
+ TileFlipY
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
new file mode 100644
index 00000000000..2163ac94984
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
@@ -0,0 +1,453 @@
+//
+// System.Drawing.Drawing2D.Matrix.cs
+//
+// Author:
+// Stefan Maierhofer <sm@cg.tuwien.ac.at>
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Drawing;
+using System.Runtime.InteropServices;
+
+namespace System.Drawing.Drawing2D
+{
+ public sealed class Matrix : MarshalByRefObject, IDisposable
+ {
+ // initialize to identity
+ private float[] m = {1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f};
+
+ // constructors
+ public Matrix() { }
+
+ /* TODO: depends on System.Drawing.Drawing2D.Rectangle
+ public Matrix(Rectangle rect , Point[] plgpts)
+ {
+ // TODO
+ }
+ */
+
+ /* TODO: depends on System.Drawing.Drawing2D.RectangleF
+ public Matrix(RectangleF rect , PointF[] pa)
+ {
+ // TODO
+ }
+ */
+ public Matrix(float m11, float m12,
+ float m21, float m22,
+ float dx, float dy)
+ {
+ m[0] = m11; m[1] = m12;
+ m[2] = m21; m[3] = m22;
+ m[4] = dx; m[5] = dy;
+ }
+
+ // properties
+ public float[] Elements
+ {
+ get { return m; }
+ }
+
+ public bool IsIdentity
+ {
+ get
+ {
+ if ( (m[0] == 1.0f) && (m[1] == 0.0f) &&
+ (m[2] == 0.0f) && (m[3] == 1.0f) &&
+ (m[4] == 0.0f) && (m[5] == 0.0f) )
+ return true;
+ else
+ return false;
+ }
+ }
+
+ public bool IsInvertible
+ {
+ get
+ {
+ // matrix M is invertible if det(M) != 0
+ float det = m[0] * m[3] - m[2] * m[1];
+ if (det != 0.0f) return true;
+ else return false;
+ }
+ }
+
+ public float OffsetX
+ {
+ get { return m[4]; }
+ }
+
+ public float OffsetY
+ {
+ get { return m[5]; }
+ }
+
+ // methods
+ public Matrix Clone()
+ {
+ return new Matrix(m[0], m[1], m[2], m[3], m[4], m[5]);
+ }
+
+ public void Dispose() { }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Matrix)
+ {
+ float[] a = ((Matrix)obj).Elements;
+ if ( m[0] == a[0] && m[1] == a[1] &&
+ m[2] == a[2] && m[3] == a[3] &&
+ m[4] == a[4] && m[5] == a[5] )
+ return true;
+ else
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ ~Matrix() {}
+
+ [StructLayout(LayoutKind.Explicit)]
+ internal struct BitConverter
+ {
+ [FieldOffset(0)] public float f;
+ [FieldOffset(0)] public int i;
+ }
+
+ public override int GetHashCode()
+ {
+ BitConverter b;
+ // compiler is not smart
+ b.i = 0;
+ int h = 0;
+ for (int i = 0; i < 6; i++)
+ {
+ b.f = m[i];
+ h ^= b.i >> i;
+ }
+ return h;
+ }
+
+ public void Invert()
+ {
+ float det = m[0] * m[3] - m[2] * m[1];
+ if (det != 0.0f) // if invertible
+ {
+ float[] r =
+ {
+ m[3] / det,
+ -m[1] / det,
+ -m[2] / det,
+ m[0] / det,
+ (-m[3] * m[4] + m[1] * m[5]) / det,
+ (m[2] * m[4] - m[0] * m[5]) / det
+ };
+ m = r;
+ }
+ }
+
+ public void Multiply(Matrix matrix)
+ {
+ Multiply(matrix, MatrixOrder.Prepend);
+ }
+
+ public void Multiply(Matrix matrix, MatrixOrder order)
+ {
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = matrix * this
+ float[] p = matrix.Elements;
+ float[] r0 =
+ {
+ p[0] * m[0] + p[1] * m[2],
+ p[0] * m[1] + p[1] * m[3],
+ p[2] * m[0] + p[3] * m[2],
+ p[2] * m[1] + p[3] * m[3],
+ p[4] * m[0] + p[5] * m[2] + m[4],
+ p[4] * m[1] + p[5] * m[3] + m[5]
+ };
+ m = r0;
+ break;
+ case MatrixOrder.Append:
+ // this = this * matrix
+ float[] a = matrix.Elements;
+ float[] r1 =
+ {
+ m[0] * a[0] + m[1] * a[2],
+ m[0] * a[1] + m[1] * a[3],
+ m[2] * a[0] + m[3] * a[2],
+ m[2] * a[1] + m[3] * a[3],
+ m[4] * a[0] + m[5] * a[2] + a[4],
+ m[4] * a[1] + m[5] * a[3] + a[5]
+ };
+ m = r1;
+ break;
+ }
+ }
+
+ public void Reset()
+ {
+ m[0] = 1.0f; m[1] = 0.0f;
+ m[2] = 0.0f; m[3] = 1.0f;
+ m[4] = 0.0f; m[5] = 0.0f;
+ }
+
+ public void Rotate(float angle)
+ {
+ Rotate(angle, MatrixOrder.Prepend);
+ }
+
+ public void Rotate(float angle, MatrixOrder order)
+ {
+ angle *= (float)(Math.PI / 180.0); // degrees to randians
+ float cos = (float)Math.Cos(angle);
+ float sin = (float)Math.Sin(angle);
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = rotation * this
+ float[] r0 =
+ {
+ cos * m[0] + sin * m[2],
+ cos * m[1] + sin * m[3],
+ -sin * m[0] + cos * m[2],
+ -sin * m[1] + cos * m[3],
+ m[4],
+ m[5]
+ };
+ m = r0;
+ break;
+ case MatrixOrder.Append:
+ // this = this * rotation
+ float[] r1 =
+ {
+ m[0] * cos + m[1] * -sin,
+ m[0] * sin + m[1] * cos,
+ m[2] * cos + m[3] * -sin,
+ m[2] * sin + m[3] * cos,
+ m[4] * cos + m[5] * -sin,
+ m[4] * sin + m[5] * cos
+ };
+ m = r1;
+ break;
+ }
+ }
+
+ public void RotateAt(float angle, PointF point)
+ {
+ RotateAt(angle, point, MatrixOrder.Prepend);
+ }
+
+ public void RotateAt(float angle, PointF point, MatrixOrder order)
+ {
+ angle *= (float)(Math.PI / 180.0); // degrees to randians
+ float cos = (float)Math.Cos(angle);
+ float sin = (float)Math.Sin(angle);
+ float e4 = -point.X * cos + point.Y * sin + point.X;
+ float e5 = -point.X * sin - point.Y * cos + point.Y;
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = rotation * this
+ float[] r0 =
+ {
+ cos * m[0] + sin * m[2],
+ cos * m[1] + sin * m[3],
+ -sin * m[0] + cos * m[2],
+ -sin * m[1] + cos * m[3],
+ e4 * m[0] + e5 * m[2] + m[4],
+ e4 * m[1] + e5 * m[3] + m[5]
+ };
+ m = r0;
+ break;
+ case MatrixOrder.Append:
+ // this = this * rotation
+ float[] r1 =
+ {
+ m[0] * cos + m[1] * -sin,
+ m[0] * sin + m[1] * cos,
+ m[2] * cos + m[3] * -sin,
+ m[2] * sin + m[3] * cos,
+ m[4] * cos + m[5] * -sin + e4,
+ m[4] * sin + m[5] * cos + e5
+ };
+ m = r1;
+ break;
+ }
+ }
+
+ public void Scale(float scaleX, float scaleY)
+ {
+ Scale(scaleX, scaleY, MatrixOrder.Prepend);
+ }
+
+ public void Scale(float scaleX, float scaleY, MatrixOrder order)
+ {
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = scale * this
+ m[0] *= scaleX; m[1] *= scaleX;
+ m[2] *= scaleY; m[3] *= scaleY;
+ break;
+ case MatrixOrder.Append:
+ // this = this * scale
+ m[0] *= scaleX; m[1] *= scaleY;
+ m[2] *= scaleX; m[3] *= scaleY;
+ m[4] *= scaleX; m[5] *= scaleY;
+ break;
+ }
+ }
+
+ public void Shear(float shearX, float shearY)
+ {
+ Shear(shearX, shearY, MatrixOrder.Prepend);
+ }
+
+ // LAMESPEC: quote from beta 2 sdk docs: "[To be supplied!]"
+ //
+ // assuming transformation matrix:
+ //
+ // (1 shearY 0)
+ // (shearX 1 0)
+ // (0 0 1)
+ //
+ public void Shear(float shearX, float shearY, MatrixOrder order)
+ {
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = shear * this
+ float[] r0 =
+ {
+ m[0] + shearY * m[2],
+ m[1] + shearY * m[3],
+ shearX * m[0] + m[2],
+ shearX * m[1] + m[3],
+ m[4],
+ m[5]
+ };
+ m = r0;
+ break;
+ case MatrixOrder.Append:
+ // this = this * shear
+ float[] r1 =
+ {
+ m[0] + m[1] * shearX,
+ m[0] * shearY + m[1],
+ m[2] + m[3] * shearX,
+ m[2] * shearY + m[3],
+ m[4] + m[5] * shearX ,
+ m[4] * shearY + m[5]
+ };
+ m = r1;
+ break;
+ }
+ }
+
+ public void TransformPoints(Point[] pts)
+ {
+ for (int i = 0; i < pts.Length; i++)
+ {
+ float x = (float)pts[i].X;
+ float y = (float)pts[i].Y;
+ pts[i].X = (int)(x * m[0] + y * m[2] + m[4]);
+ pts[i].Y = (int)(x * m[1] + y * m[3] + m[5]);
+ }
+ }
+
+ public void TransformPoints(PointF[] pts)
+ {
+ for (int i = 0; i < pts.Length; i++)
+ {
+ float x = pts[i].X;
+ float y = pts[i].Y;
+ pts[i].X = x * m[0] + y * m[2] + m[4];
+ pts[i].Y = x * m[1] + y * m[3] + m[5];
+ }
+ }
+
+ public void TransformVectors(Point[] pts)
+ {
+ for (int i = 0; i < pts.Length; i++)
+ {
+ float x = (float)pts[i].X;
+ float y = (float)pts[i].Y;
+ pts[i].X = (int)(x * m[0] + y * m[2]);
+ pts[i].Y = (int)(x * m[1] + y * m[3]);
+ }
+ }
+
+ public void TransformVectors(PointF[] pts)
+ {
+ for (int i = 0; i < pts.Length; i++)
+ {
+ float x = pts[i].X;
+ float y = pts[i].Y;
+ pts[i].X = x * m[0] + y * m[2];
+ pts[i].Y = x * m[1] + y * m[3];
+ }
+ }
+
+ public void Translate(float offsetX, float offsetY)
+ {
+ Translate(offsetX, offsetY, MatrixOrder.Prepend);
+ }
+
+ public void Translate(float offsetX, float offsetY, MatrixOrder order)
+ {
+ switch (order)
+ {
+ case MatrixOrder.Prepend:
+ // this = translation * this
+ m[4] = offsetX * m[0] + offsetY * m[2] + m[4];
+ m[5] = offsetX * m[1] + offsetY * m[3] + m[5];
+ break;
+ case MatrixOrder.Append:
+ // this = this * translation
+ m[4] += offsetX;
+ m[5] += offsetY;
+ break;
+ }
+ }
+
+ // LAMESPEC: quote from beta 2 sdk docs: "[To be supplied!]"
+ [MonoTODO]
+ public void VectorTransformPoints(Point[] pts)
+ {
+ // TODO
+ }
+
+ // some simple test (TODO: remove)
+ /*
+ public static void Main()
+ {
+ PointF[] p = {new PointF(1.0f, 2.0f)};
+ Console.WriteLine("(" + p[0].X + " " + p[0].Y + ")");
+ Matrix m = new Matrix();
+
+ m.Translate(1.0f, 1.0f);
+ m.Scale(2.0f, 2.0f);
+ m.Rotate(180.0f);
+
+ m.TransformPoints(p);
+ Console.WriteLine("(" + p[0].X + " " + p[0].Y + ")");
+ m.Invert();
+ m.TransformPoints(p);
+ Console.WriteLine("(" + p[0].X + " " + p[0].Y + ")");
+
+ Matrix a = new Matrix(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
+ Matrix b = new Matrix(2.0f, 0.0f, 0.0f, 2.0f, 0.0f, 0.0f);
+
+ Console.WriteLine("h(a) = " + a.GetHashCode());
+ Console.WriteLine("h(b) = " + b.GetHashCode());
+ }
+ */
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs
new file mode 100755
index 00000000000..e5f49323e96
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PenAlignment.cs
@@ -0,0 +1,21 @@
+//
+// System.Drawing.Drawing2D.PenAlignment.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public enum PenAlignment {
+ Center = 0,
+ Inset = 1,
+ Outset = 2,
+ Left = 3,
+ Right =4
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/TODOAttribute.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/TODOAttribute.cs
new file mode 100644
index 00000000000..0920ce8f92d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/TODOAttribute.cs
@@ -0,0 +1,37 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+ public class MonoTODOAttribute : Attribute {
+
+ private string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment
+ {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog b/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
new file mode 100644
index 00000000000..9f67ad07309
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ChangeLog
@@ -0,0 +1,8 @@
+2002-04-14 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * ChangeLog: created.
+ * Metafile.cs: Added. Wrote some ctors. No impl done, yet.
+2002-04-21 Dennis Hayes <dennish@raytek.com>
+
+ * corrected emum values.
+
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs
new file mode 100644
index 00000000000..d445a9b5afe
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorAdjustType.cs
@@ -0,0 +1,19 @@
+//
+// System.Drawing.Imaging.ColorAdjustType.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ColorAdjustType {
+ Any = 6,
+ Bitmap = 1,
+ Brush = 2,
+ Count = 5,
+ Default = 0,
+ Pen = 3,
+ Text = 4
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs
new file mode 100644
index 00000000000..82f07834b68
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorChannelFlag.cs
@@ -0,0 +1,17 @@
+//
+// System.Drawing.Imaging.ColorChannelFlag.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ColorChannelFlag {
+ ColorChannelC = 0,
+ ColorChannelK = 3,
+ ColorChannelLast = 4,
+ ColorChannelM = 1,
+ ColorChannelY = 2
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs
new file mode 100644
index 00000000000..0943f290da2
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMapType.cs
@@ -0,0 +1,14 @@
+//
+// System.Drawing.Imaging.ColorMapType.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ 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
new file mode 100644
index 00000000000..f244e02447f
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMatrixFlag.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.Imaging.ColorMatrixFlag.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ColorMatrixFlag{
+ AltGrays = 2,
+ Default = 0,
+ SkipGrays = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs
new file mode 100644
index 00000000000..91872fa6247
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ColorMode.cs
@@ -0,0 +1,14 @@
+//
+// System.Drawing.Imaging.ColorMode.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ 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
new file mode 100644
index 00000000000..052604968e7
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfPlusRecordType.cs
@@ -0,0 +1,262 @@
+//
+// System.Drawing.Imaging.EmfPlusRecordType.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum EmfPlusRecordType {
+ BeginContainer = 16423,
+ BeginContainerNoParams = 16424,
+ Clear = 16393,
+ Comment = 16387,
+ DrawArc = 16402,
+ DrawBeziers = 16409,
+ DrawClosedCurve = 16407,
+ DrawCurve = 16408,
+ DrawDriverString = 16438,
+ DrawEllipse = 16399,
+ DrawImage = 16410,
+ DrawImagePoints = 16411,
+ DrawLines = 16397,
+ DrawPath = 16405,
+ DrawPie = 16401,
+ DrawRects = 16395,
+ DrawString = 16412,
+ EmfAbortPath = 68,
+ EmfAlphaBlend = 114,
+ EmfAngleArc = 41,
+ EmfArcTo = 55,
+ EmfBeginPath = 59,
+ EmfBitBlt = 76,
+ EmfChord = 46,
+ EmfCloseFigure = 61,
+ EmfColorCorrectPalette = 111,
+ EmfColorMatchToTargetW = 121,
+ EmfCreateBrushIndirect = 39,
+ EmfCreateColorSpace = 99,
+ EmfCreateColorSpaceW = 122,
+ EmfCreateDibPatternBrushPt = 94,
+ EmfCreateMonoBrush = 93,
+ EmfCreatePalette = 49,
+ EmfCreatePen = 38,
+ EmfDeleteColorSpace = 101,
+ EmfDeleteObject = 40,
+ EmfDrawEscape = 105,
+ EmfEllipse = 42,
+ EmfEndPath = 60,
+ EmfEof = 14,
+ EmfExcludeClipRect = 29,
+ EmfExtCreateFontIndirect = 82,
+ EmfExtCreatePen = 95,
+ EmfExtEscape = 106,
+ EmfExtFloodFill = 53,
+ EmfExtSelectClipRgn = 75,
+ EmfExtTextOutA = 83,
+ EmfExtTextOutW = 84,
+ EmfFillPath = 62,
+ EmfFillRgn = 71,
+ EmfFlattenPath = 65,
+ EmfForceUfiMapping = 109,
+ EmfFrameRgn = 72,
+ EmfGdiComment = 70,
+ EmfGlsBoundedRecord = 103,
+ EmfGlsRecord = 102,
+ EmfGradientFill = 118,
+ EmfHeader = 1,
+ EmfIntersectClipRect = 30,
+ EmfInvertRgn = 73,
+ EmfLineTo = 54,
+ EmfMaskBlt = 78,
+ EmfMin = 1,
+ EmfModifyWorldTransform = 36,
+ EmfMoveToEx = 27,
+ EmfNamedEscpae = 110,
+ EmfOffsetClipRgn = 26,
+ EmfPaintRgn = 74,
+ EmfPie = 47,
+ EmfPixelFormat = 104,
+ EmfPlgBlt = 79,
+ EmfPlusRecordBase = 16384,
+ EmfPolyBezier = 2,
+ EmfPolyBezier16 = 85,
+ EmfPolyBezierTo = 5,
+ EmfPolyBezierTo16 = 88,
+ EmfPolyDraw = 56,
+ EmfPolyDraw16 = 92,
+ EmfPolygon = 3,
+ EmfPolyPolygon16 = 86,
+ EmfPolyPolyline = 4,
+ EmfPolyline16 = 87,
+ EmfPolyPolygon = 8,
+ EmfPolyPolyline16 = 91,
+ EmfPolyTextOutA = 96,
+ EmfPolyTextOutW = 97,
+ EmfRealizePalette = 52,
+ EmfRectangle = 43,
+ EmfReserved069 = 69,
+ EmfReserved117 = 117,
+ EmfResizePalette = 51,
+ EmfRestoreDC = 34,
+ EmfRoundArc = 45,
+ EmfRoundRect = 44,
+ EmfSaveDC = 33,
+ EmfScaleViewportExtEx = 31,
+ EmfScaleWindowExtEx = 32,
+ EmfSelectClipPath = 67,
+ EmfSelectObject = 37,
+ EmfSelectPalette = 48,
+ EmfSetArcDirection = 57,
+ EmfSetBkColor = 25,
+ EmfSetBkMode = 18,
+ EmfSetBrushOrgEx = 13,
+ EmfSetColorAdjustment = 23,
+ EmfSetColorSpace = 100,
+ EmfSetDIBitsToDevice = 80,
+ EmfSetIcmMode = 98,
+ EmfSetIcmProfileA = 112,
+ EmfSetIcmProfileW = 113,
+ EmfSetLayout = 115,
+ EmfSetLinkedUfis = 119,
+ EmfSetMapMode = 17,
+ EmfSetMapperFlags = 16,
+ EmfSetMetaRgn = 28,
+ EmfSetMiterLimit = 58,
+ EmfSetPaletteEntries = 50,
+ EmfSetPixelV = 15,
+ EmfSetPolyFillMode = 19,
+ EmfSetROP2 = 20,
+ EmfSetStretchBltMode = 21,
+ EmfSetTextAlign = 22,
+ EmfSetTextColor = 24,
+ EmfSetTextJustification =120 ,
+ EmfSetViewportExtEx = 11,
+ EmfSetViewportOrgEx = 12,
+ EmfSetWindowExtEx = 9,
+ EmfSetWindowOrgEx = 10,
+ EmfSetWorldTransform = 35,
+ EmfSmallTextOut = 108,
+ EmfStartDoc = 107,
+ EmfStretchBlt = 77,
+ EmfStretchDIBits = 81,
+ EmfStrokeAndFillPath = 63,
+ EmfStrokePath = 64,
+ EmfTransparentBlt = 116,
+ EmfWidenPath = 66,
+ EndContainer = 16425,
+ EndOfFile = 16386,
+ FillClosedCurve = 16406,
+ FillEllipse = 16398,
+ FillPath = 16404,
+ FillPie = 16400,
+ FillPolygon = 16396,
+ FillRects = 16394,
+ FillRegion = 16403,
+ GetDC = 16388,
+ Header = 16385,
+ Invalid = 16384,
+ Max = 16438,
+ Min = 16385,
+ MultiFormatEnd = 16391,
+ MultiFormatSection = 16390,
+ MultiFormatStart = 16389,
+ MultiplyWorldTransform = 16428,
+ Object = 16392,
+ OffsetClip = 16437,
+ ResetClip = 16433,
+ ResetWorldTransform = 16427,
+ Restore = 16422,
+ RotateWorldTransform = 16431,
+ Save = 16421,
+ ScaleWorldTransform = 16430,
+ SetAntiAliasMode = 16414,
+ SetClipPath = 16435,
+ SetClipRect = 16434,
+ SetClipRegion = 16436,
+ SetCompositingMode = 16419,
+ SetCompositingQuality = 16420,
+ SetInterpolationMode = 16417,
+ SetPageTransform = 16432,
+ SetPixelOffsetMode = 16418,
+ SetRenderingOrigin = 16413,
+ SetTextContrast = 16416,
+ SetTextRenderingHint = 16415,
+ SetWorldTransform = 16426,
+ Total = 16439,
+ TranslateWorldTransform = 16429,
+ WmfAnimatePalette = 66614,
+ WmfArc = 67607,
+ WmfBitBlt = 67874,
+ WmfChord = 67632,
+ WmfCreateBrushIndirect = 66300,
+ WmfCreateFontIndirect = 66299,
+ WmfCreatePalette = 65783,
+ WmfCreatePatternBrush = 66041,
+ WmfCreatePenIndirect = 66298,
+ WmfCreateRegion = 67327,
+ WmfDeleteObject = 66032,
+ WmfDibBitBlt = 67904,
+ WmfDibCreatePatternBrush = 65858,
+ WmfFillRegion = 66088,
+ WmfFloodFill = 66585,
+ WmfFrameRegion = 66601,
+ WmfIntersectClipRect = 66582,
+ WmfInvertRegion = 65834,
+ WmfLineTo = 66067,
+ WmfMoveTo = 66068,
+ WmfOffsetCilpRgn = 66080,
+ WmfOffsetViewportOrg = 66065,
+ WmfOffsetWindowOrg = 66063,
+ WmfPaintRegion = 65835,
+ WmfPatBlt = 67101,
+ WmfPie = 67610,
+ WmfPolygon = 66340,
+ WmfPolyline = 66341,
+ WmfPolyPolygon = 66872,
+ WmfRealizePalette = 65589,
+ WmfRecordBase = 65536,
+ WmfRectangle = 66587,
+ WmfResizePalette = 65849,
+ WmfRestoreDC = 65831,
+ WmfRoundRect = 67100,
+ WmfSaveDC = 65566,
+ WmfScaleViewportExt = 66578,
+ WmfScaleWindowExt = 66576,
+ WmfSelectClipRegion = 65836,
+ WmfSelectObject = 65837,
+ WmfSelectPalette = 66100,
+ WmfSetBkColor = 66049,
+ WmfSetBkMode = 65794,
+ WmfSetDibToDev = 68915,
+ WmfSetLayout = 65865,
+ WmfSetMapMode = 65795,
+ WmfSetMapperFlags = 66097,
+ WmfSetPalEntries = 65591,
+ WmfSetPixel = 66591,
+ WmfSetPolyFillMode = 65798,
+ WmfSetRelAbs = 65797,
+ WmfSetROP2 = 65796,
+ WmfSetStretchBltMode = 65799,
+ WmfSetTextAlign = 65838,
+ WmfSetTextCharExtra = 65800,
+ WmfSetTextColor = 66057,
+ WmfSetTextJustification = 66058,
+ WmfSetViewportExt = 66062,
+ WmfSetViewportOrg = 66061,
+ WmfSetWindowExt = 66060,
+ WmfSetWindowOrg = 66059,
+ WmfStretchBlt = 68387,
+ WmfStretchDib = 69443,
+ WmfTextOut = 66849,
+ EmfPolyLineTo = 6,
+ EmfPolylineTo16 = 89,
+ WmfDibStretchBlt = 68417,
+ WmfEllipse = 66584,
+ WmfEscape = 67110,
+ WmfExcludeClipRect = 66581,
+ WmfExtFloodFill = 66888,
+ WmfExtTextOut = 68146
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs
new file mode 100644
index 00000000000..f02a42f4923
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EmfType.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.Imaging.EmfType.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum EmfType {
+ EmfOnly = 3,
+ EmfPlusDual = 5,
+ EmfPlusOnly = 4
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs
new file mode 100644
index 00000000000..6a0071ad20d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderParameterValueType.cs
@@ -0,0 +1,20 @@
+//
+// System.Drawing.Imaging.EncoderParameterValueType.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum EncoderParameterValueType {
+ ValueTypeAscii = 2,
+ ValueTypeByte = 1,
+ ValueTypeLong = 4,
+ ValueTypeLongRange = 6,
+ ValueTypeRational = 5,
+ ValueTypeRationalRange = 8,
+ ValueTypeShort = 3,
+ ValueTypeUndefined = 7
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs
new file mode 100644
index 00000000000..0e51a47031e
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/EncoderValue.cs
@@ -0,0 +1,36 @@
+//
+// System.Drawing.Imaging.EncoderValue.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum EncoderValue {
+ ColorTypeCMYK = 0,
+ ColorTypeYCCK = 1,
+ CompressionCCITT3 = 3,
+ CompressionCCITT4 = 4,
+ CompressionLZW = 2,
+ CompressionNone = 6,
+ CompressionRle = 5,
+ Flush = 20,
+ FrameDimensionPage = 23,
+ FrameDimensionResolution = 22,
+ FrameDimensionTime = 21,
+ LastFrame = 19,
+ MultiFrame = 18,
+ RenderNonProgressive = 12,
+ RenderProgressive = 11,
+ ScanMethodInterlaced = 7,
+ ScanMethodNonInterlaced = 8,
+ TransformFlipHorizontal = 16,
+ TransformFlipVertical = 17,
+ TransformRotate180 = 14,
+ TransformRotate270 = 15,
+ TransformRotate90 = 13,
+ VersionGif87 = 9,
+ VersionGif89 = 10
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs
new file mode 100644
index 00000000000..cc431619f31
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/FrameDimension.cs
@@ -0,0 +1,59 @@
+// created on 21.02.2002 at 17:06
+//
+// FrameDimension.cs
+//
+// Author: Christian Meyer
+// eMail: Christian.Meyer@cs.tum.edu
+//
+
+namespace System.Drawing.Imaging {
+
+using System;
+
+public sealed class FrameDimension {
+
+ // constructor
+ public FrameDimension (Guid guid) {}
+
+ //properties
+ public Guid Guid {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public static FrameDimension Page {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public static FrameDimension Resolution {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public static FrameDimension Time {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //methods
+ public override bool Equals (object o) {
+ throw new NotImplementedException ();
+ }
+
+ public override int GetHashCode () {
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+
+ //destructor
+ ~FrameDimension () {}
+}
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs
new file mode 100644
index 00000000000..235ebed2fc0
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageCodecFlags.cs
@@ -0,0 +1,21 @@
+//
+// System.Drawing.Imaging.ImageCodecFlags.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ImageCodecFlags {
+ BlockingDecode = 32,
+ Builtin = 65536,
+ Decoder = 2,
+ Encoder = 1,
+ SeekableEncode = 16,
+ SupportBitmap = 4,
+ SupportVector = 8,
+ System = 131072,
+ User = 262144
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs
new file mode 100644
index 00000000000..61e0ec878a1
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageFlags.cs
@@ -0,0 +1,26 @@
+//
+// System.Drawing.Imaging.ImageFlags.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ImageFlags {
+ Caching = 131072,
+ ColorSpaceCmyk = 32,
+ ColorSpaceGray = 64,
+ ColorSpaceRgb = 16,
+ ColorSpaceYcbcr = 128,
+ ColorSpaceYcck = 256,
+ HasAlpha = 2,
+ HasRealDpi = 4096,
+ HasRealPixelSize = 8192,
+ HasTranslucent = 4,
+ None = 0,
+ PartiallyScalable = 8,
+ ReadOnly = 65536,
+ Scalable = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs
new file mode 100644
index 00000000000..14b720acb2b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageLockMode.cs
@@ -0,0 +1,16 @@
+//
+// System.Drawing.Imaging.ImageLockMode.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum ImageLockMode {
+ ReadOnly = 1,
+ ReadWrite = 3,
+ UserInputBuffer = 4,
+ WriteOnly = 2
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs
new file mode 100644
index 00000000000..163950d1e71
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/Metafile.cs
@@ -0,0 +1,110 @@
+//
+// Metafile.cs
+//
+// (C) 2002 Christian Meyer
+// Author: Christian Meyer
+// eMail: Christian.Meyer@cs.tum.edu
+//
+using System;
+using System.Reflection;
+
+namespace System.Drawing.Imaging {
+
+ public sealed class Metafile : Image {
+
+ // constructors
+ [MonoTODO]
+ public Metafile (Stream stream) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (string filename) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr henhmetafile, bool deleteEmf) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHtc, EmfType emfType) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHtc, Rectangle frameRect) {
+ throw new NotImplemtedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHtc, RectangleF frameRect) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader) {
+ throw new NotImplemtedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (Stream stream, IntPtr referenceHtc) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (String fileName, IntPtr referenceHtc) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHdc, EmfType emfType, string description) {
+ throw new NotImplemtedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (IntPtr hmetafile, WmfPlaceableFileHeader wmfHeader, bool deleteWmf) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (Stream stream, IntPtr referenceHdc, EmfType type) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (Stream stream, IntPtr referenceHdc, Rectangle frameRect) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (Stream stream, IntPtr referenceHdc, RectangleF frameRect) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (string fileName, IntPtr referenceHdc, EmfType type) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Metafile (string fileName, IntPtr referenceHdc, Rectangle frameRect) {
+ throw new NotImplementedException ();
+ }
+
+ // methods
+ // properties
+ }
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs
new file mode 100644
index 00000000000..97d59c6c0c1
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/MetafileFrameUnit.cs
@@ -0,0 +1,18 @@
+//
+// System.Drawing.Imaging.MetafileFrameUnit.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum MetafileFrameUnit {
+ Document = 5,
+ GdiCompatible = 7,
+ Inch = 4,
+ Millimeter = 6,
+ Pixel = 2,
+ Point = 3
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs
new file mode 100644
index 00000000000..007313d0622
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PaletteFlags.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.Imaging.PaletteFlags.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Imaging
+{
+ public enum PaletteFlags {
+ GrayScale = 2,
+ Halftone = 4,
+ HasAlpha = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs
new file mode 100644
index 00000000000..abc675c4739
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Imaging/PixelFormat.cs
@@ -0,0 +1,39 @@
+// created on 20.02.2002 at 21:18
+//
+// Image.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Christian Meyer
+// eMail: Christian.Meyer@cs.tum.edu
+// Dennis Hayes
+// dennish@raytek.com
+//
+//
+namespace System.Drawing.Imaging {
+
+ public enum PixelFormat {
+ 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 //shows up in enumcheck as second "dontcare".
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/Duplex.cs b/mcs/class/System.Drawing/System.Drawing.Printing/Duplex.cs
new file mode 100644
index 00000000000..a158382eea3
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/Duplex.cs
@@ -0,0 +1,16 @@
+//
+// System.Drawing.Duplex.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum Duplex {
+ Default = -1,
+ Horizontal = 3,
+ Simplex = 1,
+ Vertical = 2
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperKind.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperKind.cs
new file mode 100644
index 00000000000..137a0da4a9b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PaperKind.cs
@@ -0,0 +1,125 @@
+//
+// System.Drawing.PaperKind.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum PaperKind {
+ A2 = 66,
+ A3 = 8,
+ A3Extra = 63,
+ A3ExtraTransverse = 68,
+ A3Rotated = 76,
+ A3Transverse = 67,
+ A4 = 9,
+ A4Extra = 53,
+ A4Plus = 60,
+ A4Rotated = 77,
+ A4Small = 10,
+ A4Transverse = 55,
+ A5 = 11,
+ A5Extra = 64,
+ A5Rotated = 78,
+ A5Transverse = 61,
+ A6 = 70,
+ A6Rotated = 83,
+ APlus = 57,
+ B4 = 12,
+ B4Envelope = 33,
+ B4JisRotated = 79,
+ B5Extra,
+ B5JisRotated = 80,
+ B5Transverse = 61,
+ B6Envelope = 35,
+ B6Jis = 88,
+ B6JisRotated = 89,
+ BPlus = 58,
+ C3Envelope = 29,
+ C4Envelope = 30,
+ C5Envelope = 34,
+ C65Envelope = 32,
+ CSheet = 24,
+ Custom = 0,
+ DLEnvelope = 27,
+ DSheet = 25,
+ ESheet = 26,
+ Executive = 7,
+ Folio = 14,
+ GermanLegalFanfold = 41,
+ GermanStandardFanfold = 40,
+ InviteEnvelope = 47,
+ IsoB4 = 42,
+ JapaneseDoublePostcard = 69,
+ JapaneseDoublePostcardRotated = 81,
+ JapaneseEnvelopeChouNumber3 = 73,
+ JapaneseEnvelopeChouNumber3Rotated = 86,
+ JapaneseEnvelopeChouNumber4 = 74,
+ JapaneseEnvelopeChouNumber4Rotated = 87,
+ JapaneseEnvelopeKakuNumber2 = 71,
+ JapaneseEnvelopeKakuNumber2Rotated = 84,
+ JapaneseEnvelopeKakuNumber3 = 72,
+ JapaneseEnvelopeKakuNumber3Rotated = 85,
+ JapaneseEnvelopeYouNumber4 = 91,
+ JapaneseEnvelopeYouNumber4Rotated = 92,
+ JapanesePostcard = 43,
+ JapanesePostcardRotated = 81,
+ Ledger = 4,
+ Legal = 5,
+ LegalExtra = 51,
+ Letter = 1,
+ LetterExtra = 50,
+ LetterExtraTransverse = 56,
+ LetterPlus = 59,
+ LetterRotated = 75,
+ LetterSmall = 2,
+ LetterTransverse = 54,
+ MonarchEnvelope = 37,
+ Note = 18,
+ Number10Envelope = 20,
+ Number11Envelope = 21,
+ Number12Envelope = 22,
+ Number14Envelope = 23,
+ Number9Envelope = 19,
+ PersonalEnvelope = 38,
+ Prc16K = 93,
+ Prc16KRotated = 106,
+ Prc32K = 94,
+ Prc32KBig = 95,
+ Prc32KBigRotated = 108,
+ Prc32KRotated = 107,
+ PrcEnvelopeNumber1 = 96,
+ PrcEnvelopeNumber10 = 105,
+ PrcEnvelopeNumber10Rotated = 118,
+ PrcEnvelopeNumber1Rotated = 109,
+ PrcEnvelopeNumber2 = 97,
+ PrcEnvelopeNumber2Rotated = 110,
+ PrcEnvelopeNumber3 = 98,
+ PrcEnvelopeNumber3Rotated = 111,
+ PrcEnvelopeNumber4 = 99,
+ PrcEnvelopeNumber4Rotated = 112,
+ PrcEnvelopeNumber5 = 100,
+ PrcEnvelopeNumber5Rotated = 113,
+ PrcEnvelopeNumber6 = 101,
+ PrcEnvelopeNumber6Rotated = 114,
+ PrcEnvelopeNumber7 = 102,
+ PrcEnvelopeNumber7Rotated = 115,
+ PrcEnvelopeNumber8 = 103,
+ PrcEnvelopeNumber8Rotated = 116,
+ PrcEnvelopeNumber9 = 104,
+ PrcEnvelopeNumber9Rotated = 117,
+ Quarto = 15,
+ Standard10x11 = 45,
+ Standard10x14 = 16,
+ Standard11x17 = 17,
+ Standard12x11 = 90,
+ Standard15x11 = 46,
+ Standard9x11 = 44,
+ Statement = 6,
+ Tabloid = 3,
+ TabloidExtra = 52,
+ USStandardFanfold = 39
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceKind.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceKind.cs
new file mode 100644
index 00000000000..a8cd9e0e68e
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceKind.cs
@@ -0,0 +1,26 @@
+//
+// System.Drawing.PaperSourceKind.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum PaperSourceKind {
+ AutomaticFeed = 7,
+ Cassette = 14,
+ Custom = 257,
+ Envelope = 5,
+ FormSource = 15,
+ LargeCapacity = 11,
+ LargeFormat = 10,
+ Lower = 2,
+ Manual = 4,
+ ManualFeed = 6,
+ Middle = 3,
+ SmallFormat = 9,
+ TractorFeed = 8,
+ Upper = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintRange.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintRange.cs
new file mode 100644
index 00000000000..a43f9e8bf88
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintRange.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.PrintRange.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum PrintRange {
+ AllPages = 0,
+ Selection = 1,
+ SomePages = 2
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolutionKind.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolutionKind.cs
new file mode 100644
index 00000000000..7580938c71a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolutionKind.cs
@@ -0,0 +1,17 @@
+//
+// System.Drawing.PrinterResolutionKind.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum PrinterResolutionKind {
+ Custom = 0,
+ Draft = -1,
+ High = -4,
+ Low = -2,
+ Medium = -3
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnit.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnit.cs
new file mode 100644
index 00000000000..ae4209301cc
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnit.cs
@@ -0,0 +1,16 @@
+//
+// System.Drawing.PrinterUnit.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum PrinterUnit {
+ Display = 0,
+ HundredthsOfAMillimeter = 2,
+ TenthsOfAMillimeter = 3,
+ ThousandthsOfAnInch = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionLevel.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionLevel.cs
new file mode 100644
index 00000000000..0f77f63bf6b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionLevel.cs
@@ -0,0 +1,16 @@
+//
+// System.Drawing.PrintingPermissionLevel.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Printing
+{
+ public enum PrintingPermissionLevel {
+ AllPrinting = 3,
+ DefaultPrinting = 2,
+ NoPrinting = 0,
+ SafePrinting = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs b/mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs
new file mode 100644
index 00000000000..3b76c6b94b0
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Text/GenericFontFamilies.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.GenericFontFamilies.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Text
+{
+ public enum GenericFontFamilies {
+ Monospace = 2,
+ SansSerif = 1,
+ Serif = 0
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs b/mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs
new file mode 100644
index 00000000000..df0418debc3
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Text/HotkeyPrefix.cs
@@ -0,0 +1,15 @@
+//
+// System.Drawing.HotkeyPrefix.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Text
+{
+ public enum HotkeyPrefix {
+ Hide = 2,
+ None = 0,
+ Show = 1
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs b/mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs
new file mode 100644
index 00000000000..5f11cdcbb73
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.Text/TextRenderingHint.cs
@@ -0,0 +1,18 @@
+//
+// System.Drawing.TextRenderingHint.cs
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+using System;
+namespace System.Drawing.Text
+{
+ public enum TextRenderingHint {
+ AntiAlias = 4,
+ AntiAliasGridFit = 3,
+ ClearTypeGridFit = 5,
+ SingleBitPerPixel = 2,
+ SingleBitPerPixelGridFit = 1,
+ SystemDefault = 0
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.build b/mcs/class/System.Drawing/System.Drawing.build
new file mode 100644
index 00000000000..b05d3180001
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing.build
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for SystemDrawing.dll -->
+
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <csc target="library" output="../lib/System.Drawing.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ </sources>
+ <references>
+ <includes name="../lib/corlib.dll"/>
+ </references>
+ </csc>
+ </target>
+</project>
diff --git a/mcs/class/System.Drawing/System.Drawing/Bitmap.cs b/mcs/class/System.Drawing/System.Drawing/Bitmap.cs
new file mode 100755
index 00000000000..aac85029a4c
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Bitmap.cs
@@ -0,0 +1,277 @@
+// created on 25.02.2002 at 22:43
+//
+// Bitmap.cs
+//
+// Author: Christian Meyer
+// eMail: Christian.Meyer@cs.tum.edu
+//
+// No implementation has been done yet. I first want to write the method
+// headers of every System.Drawing.
+//
+//Buid warnings. Note add 6 to line numbers for these comments!
+//C:\cygwin\usr\local\mcs\class\System.Drawing\System.Drawing\Bitmap.cs(47,18): warning CS0649: Field 'System.Drawing.RGBQUAD.rgbBlue' is never assigned to, and will always have its default value 0
+//C:\cygwin\usr\local\mcs\class\System.Drawing\System.Drawing\Bitmap.cs(48,18): warning CS0649: Field 'System.Drawing.RGBQUAD.rgbGreen' is never assigned to, and will always have its default value 0
+//C:\cygwin\usr\local\mcs\class\System.Drawing\System.Drawing\Bitmap.cs(49,18): warning CS0649: Field 'System.Drawing.RGBQUAD.rgbRed' is never assigned to, and will always have its default value 0
+//C:\cygwin\usr\local\mcs\class\System.Drawing\System.Drawing\Bitmap.cs(50,18): warning CS0649: Field 'System.Drawing.RGBQUAD.rgbReserved' is never assigned to, and will always have its default value 0
+//C:\cygwin\usr\local\mcs\class\System.Drawing\System.Drawing\Bitmap.cs(54,20): warning CS0649: Field 'System.Drawing.BITMAPINFO.colorpalette' is never assigned to, and will always have its default value null
+// 2002-03-27 Christian Meyer <Christian.Meyer@cs.tum.edu>
+// I'll have a closer look at it next week.
+//
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+
+namespace System.Drawing {
+ struct BITMAPFILEHEADER { // File info header
+ public uint bfType; // Specifies the type of file. This member must be BM.
+ public uint bfSize; // Specifies the size of the file, in bytes.
+ public uint bfReserved1; // Reserved; must be set to zero.
+ public uint bfReserved2; // Reserved; must be set to zero.
+ public uint bfOffBits; // Specifies the byte offset from the BITMAPFILEHEADER
+ // structure to the actual bitmap data in the file.
+ }
+ struct BITMAPINFOHEADER { // bitmap info header
+ public uint biSize;
+ public int biWidth;
+ public int biHeight;
+ public ushort biPlanes;
+ public ushort biBitCount;
+ public uint biCompression;
+ public uint biSizeImage;
+ public int biXPelsPerMeter;
+ public int biYPelsPerMeter;
+ public uint biClrUsed;
+ public uint biClrImportant;
+ }
+
+ struct RGBQUAD {
+ public byte rgbBlue;
+ public byte rgbGreen;
+ public byte rgbRed;
+ public byte rgbReserved;
+ }
+ struct BITMAPINFO { // bitmap info
+ public BITMAPINFOHEADER bitmapinfoheader;
+ public RGBQUAD[] colorpalette;
+ }
+ // I do not think pinning is needed execpt for when locked
+ // Is layout packed attribute needed here?
+ struct bitmapstruct {
+ //placed in a struct to keep all 3 (4 including the color table) contugious in memory.)
+ public BITMAPFILEHEADER fileheader; //File info header
+ //bitmapinfo includes the color table
+ public BITMAPINFO info; //bitmap info
+ public byte[,] bits; //Actual bitmap bits
+ }
+ public sealed class Bitmap : Image {
+ // TODO: add following to an enum with BI_RLE4 and BI_RLE8
+ const int BI_RGB = 0; //? 0 is from example;
+ bitmapstruct bitmap = new bitmapstruct();
+ private void CommonInit (int width, int height) {
+ // Init BITMAPFILEHANDLE
+ // document I am working from says tyoe must allways be "BM",
+ // the example has this set to 19778.
+ // TODO: verify magic number 19778 for "BM" bfType
+ bitmap.fileheader.bfType = 19778;
+ // TODO: is this the correct file size?
+ bitmap.fileheader.bfSize = (uint)
+ //bitmap
+ (width * height * 4)
+ //add color table, 0 for now
+ + 0
+ // add header
+ + 60;
+ bitmap.fileheader.bfReserved1 = 0;
+ bitmap.fileheader.bfReserved2 = 0;
+ // bfOffBits is bytes offset between start of bitmap (bimapfileheader)
+ // and start of actual data bits.
+ // Example puts it at 118 including 64 bytes of color table.
+ // I count 124. What is right?
+ // Also I force 32 bit color for first pass, so for now there is no color table (24 bit or greater)
+ // TODO: verify magic number 124 for bfOffBits
+ // TODO: Could also be sizeof(fileheader and bitmapinfo)
+ bitmap.fileheader.bfOffBits = 60; //14 * 4 for ints + 2 * 2 for words.
+
+ // Init BITMAPINFO HEADER
+ // TODO: document on bitmaps shows only 1, 4, 8, 24 as valid pixel depths
+ // TODO; MS's document says 32ppARGB is 32 bits per pixle, the default.
+
+ bitmap.info.bitmapinfoheader.biBitCount = 32;
+ // biclrused is the number of colors in the bitmap that are actualy used
+ // in the bitmap. 0 means all. default to this.
+ // TODO: As far as I know, it is fine to leave this as 0, but
+ // TODO: that it would be better to do an actual count.
+ // TODO: If we open an already created bitmap, we could in a later
+ // TODO: version store that.
+ bitmap.info.bitmapinfoheader.biClrUsed = 0;
+ // biclrused is the number of colors in the bitmap that are importiant
+ // in the bitmap. 0 means all. default to this.
+ // TODO: As far as I know, it is fine to leave this as 0,
+ // TODO: If we open an already created bitmap, we could in a later
+ // TODO: version store that.
+ // In a new bitmap, I do not know how we would know which colors are importiant.
+ bitmap.info.bitmapinfoheader.biClrImportant = 0;
+ // Options are BI_RGB for none, BI_RLE8 for 8 bit color ,BI_RLE4 for 4 bit color
+ // Only supprt BI_RGB for now;
+ // TODO: add definition for BI_***
+ // TODO: correctly set biSizeImage before supporting compression.
+ bitmap.info.bitmapinfoheader.biCompression = BI_RGB;
+ bitmap.info.bitmapinfoheader.biHeight = height;
+ bitmap.info.bitmapinfoheader.biWidth = width;
+ // TODO: add support for more planes
+ bitmap.info.bitmapinfoheader.biPlanes = 1;
+ // TODO: replace 40 with a sizeof() call
+ bitmap.info.bitmapinfoheader.biSize = 40;// size of this structure.
+ // TODO: correctly set biSizeImage so compression can be supported.
+ bitmap.info.bitmapinfoheader.biSizeImage = 0; //0 is allowed for BI_RGB (no compression)
+ // The example uses 0 for pels per meter, so do I.
+ // TODO: support pels per meter
+ bitmap.info.bitmapinfoheader.biXPelsPerMeter = 0;
+ bitmap.info.bitmapinfoheader.biYPelsPerMeter = 0;
+ bitmap.bits = new byte[width*4, height];
+ }
+ #region constructors
+ // constructors
+ public Bitmap (int width, int height) {
+ CommonInit (width, height);
+ }
+
+ public Bitmap (int width, int height, Graphics g) {
+ //TODO: Error check X,Y
+ CommonInit (width,height);
+ //TODO: use graphics to set vertial and horzontal resolution.
+ //TODO: that is all the spec requires or desires
+ }
+
+ public Bitmap (int width, int heigth, PixelFormat format) {
+ if ((int)format != BI_RGB) {
+ throw new NotImplementedException ();
+ }
+ CommonInit (width, heigth);
+ }
+
+ public Bitmap (Image origial) {
+ throw new NotImplementedException ();
+ //this.original = original;
+ }
+
+ public Bitmap (Stream stream) {
+ throw new NotImplementedException ();
+ //this.stream = stream;
+ }
+
+ public Bitmap (string filename) {
+ throw new NotImplementedException ();
+ //this.filename = filename;
+ }
+
+ public Bitmap (Image original, Size newSize) {
+ throw new NotImplementedException ();
+ //this.original = original;
+ //this.newSize = newSize;
+ }
+
+ public Bitmap (Stream stream, bool useIcm) {
+ throw new NotImplementedException ();
+ //this.stream = stream;
+ //this.useIcm = useIcm;
+ }
+
+ public Bitmap (string filename, bool useIcm) {
+ throw new NotImplementedException ();
+ //this.filename = filename;
+ //this.useIcm = useIcm;
+ }
+
+ public Bitmap (Type type, string resource) {
+ throw new NotImplementedException ();
+ //this.type = type;
+ //this.resource = resource;
+ }
+
+ public Bitmap (Image original, int width, int heigth) {
+ throw new NotImplementedException ();
+ //this.original = original;
+ //this.width = width;
+ //this.heigth = heigth;
+ }
+
+
+ public Bitmap (int width, int height, int stride,
+ PixelFormat format, IntPtr scan0) {
+ throw new NotImplementedException ();
+ //this.width = width;
+ //this.heigth = heigth;
+ //this.stride = stride;
+ //this.format = format;
+ //this.scan0 = scan0;
+ }
+ #endregion
+ // methods
+ public Color GetPixel (int x, int y) {
+ //TODO: Error check X,Y
+ return Color.FromArgb (bitmap.bits[x,y], bitmap.bits[x+1,y], bitmap.bits[x+2,y], bitmap.bits[x+3,y]);
+ }
+
+ public void SetPixel (int x, int y, Color color) {
+ //TODO: Error check X,Y
+ bitmap.bits[x, y] = color.A;
+ bitmap.bits[x + 1, y] = color.R;
+ bitmap.bits[x + 2, y] = color.G;
+ bitmap.bits[x + 2, y] = color.B;
+ }
+
+ public Bitmap Clone (Rectangle rect,PixelFormat format) {
+ throw new NotImplementedException ();
+ }
+
+ public Bitmap Clone (RectangleF rect, PixelFormat format) {
+ throw new NotImplementedException ();
+ }
+
+ public static Bitmap FromHicon (IntPtr hicon) {
+ throw new NotImplementedException ();
+ }
+
+ public static Bitmap FromResource (IntPtr hinstance,
+ string bitmapName) {
+ throw new NotImplementedException ();
+ }
+
+ public IntPtr GetHbitmap () {
+ throw new NotImplementedException ();
+ }
+
+ public IntPtr GetHbitmap (Color background) {
+ throw new NotImplementedException ();
+ }
+
+ public IntPtr GetHicon () {
+ throw new NotImplementedException ();
+ }
+
+ public BitmapData LockBits (Rectangle rect, ImageLockMode flags,
+ PixelFormat format) {
+ throw new NotImplementedException ();
+ }
+
+ public void MakeTransparent () {
+ throw new NotImplementedException ();
+ }
+
+ public void MakeTransparent (Color transparentColor) {
+ throw new NotImplementedException ();
+ }
+
+ public void SetResolution (float xDpi, float yDpi) {
+ throw new NotImplementedException ();
+ }
+
+ public void UnlockBits (BitmapData bitmapdata) {
+ throw new NotImplementedException ();
+ }
+
+ // properties
+ // needs to be done ###FIXME###
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Brush.cs b/mcs/class/System.Drawing/System.Drawing/Brush.cs
new file mode 100755
index 00000000000..731f2d55408
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Brush.cs
@@ -0,0 +1,34 @@
+//
+// System.Drawing.Brush.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public abstract class Brush : MarshalByRefObject, ICloneable, IDisposable {
+
+ abstract public object Clone ();
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ System.GC.SuppressFinalize (this);
+ }
+
+ void Dispose (bool disposing)
+ {
+ // Nothing for now.
+ }
+
+ ~Brush ()
+ {
+ Dispose (false);
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/ChangeLog b/mcs/class/System.Drawing/System.Drawing/ChangeLog
new file mode 100644
index 00000000000..13ef675f01a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/ChangeLog
@@ -0,0 +1,33 @@
+2002-04-05 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * Uppercased several files.
+
+2002-04-05 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * color.cs: Fixed a typo in GetSaturation ().
+
+2002-02-26 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * Bitmap.cs: Added method headers.
+
+2002-02-25 Christian Meyer <Christian.Meyer@cs.tum.edu>
+
+ * Bitmap.cs: Added, no implementation's done, yet.
+
+2001-12-15 Mike Kestner <mkestner@speakeasy.net>
+
+ * Rectangle.cs : Add a doc comment.
+ * RectangleF.cs : New struct implementation.
+
+2001-12-15 Mike Kestner <mkestner@speakeasy.net>
+
+ * Rectangle.cs : New struct implementation.
+
+2001-08-17 Mike Kestner <mkestner@speakeasy.net>
+
+ * PointF.cs, Size.cs, SizeF.cs : New struct implementations.
+
+2001-08-16 Mike Kestner <mkestner@speakeasy.net>
+
+ * Point.cs : New. Implementation of System.Drawing.Point struct.
+
diff --git a/mcs/class/System.Drawing/System.Drawing/Color.cs b/mcs/class/System.Drawing/System.Drawing/Color.cs
new file mode 100644
index 00000000000..7708e57c63a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Color.cs
@@ -0,0 +1,1281 @@
+
+//
+// System.Drawing.Color.cs
+//
+// (C) 2002 Dennis Hayes
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// Ben Houston (ben@exocortex.org)
+//
+// TODO: Are the static/non static functions declared correctly
+
+using System;
+using System.Reflection;
+
+namespace System.Drawing
+{
+ public struct Color
+ {
+ // Private transparancy (A) and R,G,B fields.
+ byte a;
+ byte r;
+ byte g;
+ byte b;
+
+ // The specs also indicate that all three of these propities are true
+ // if created with FromKnownColor or FromNamedColor, false otherwise (FromARGB).
+ // Per Microsoft and ECMA specs these varibles are set by which constructor is used, not by their values.
+ bool isknowncolor;
+ bool isnamedcolor;
+ bool issystemcolor;
+
+ string myname;
+
+ public string Name {
+ get{
+ return myname;
+ }
+ }
+
+ public bool IsKnownColor {
+ get{
+ return isknowncolor;
+ }
+ }
+
+ public bool IsSystemColor {
+ get{
+ return issystemcolor;
+ }
+ }
+
+ public bool IsNamedColor {
+ get{
+ return isnamedcolor;
+ }
+ }
+
+
+ public static Color FromArgb (int red, int green, int blue)
+ {
+ //TODO: convert rgb to name format "12345678"
+ CheckRGBValues(red, green, blue);
+ Color color;
+ color.myname = "";
+ color.isknowncolor = false;
+ color.isnamedcolor = false;
+ color.issystemcolor = false;
+ color.a = 255;
+ color.r = (byte)red;
+ color.g = (byte)green;
+ color.b = (byte)blue;
+ return color;
+ }
+
+ public static Color FromArgb (int alpha, int red, int green, int blue)
+ {
+ //TODO: convert rgb to name format "12345678"
+ CheckARGBValues(alpha, red, green, blue);
+ Color color;
+ color.isknowncolor = false;
+ color.isnamedcolor = false;
+ color.issystemcolor = false;
+ color.myname = "";
+ color.a = (byte)alpha;
+ color.r = (byte)red;
+ color.g = (byte)green;
+ color.b = (byte)blue;
+ return color;
+ }
+ public int ToArgb()
+ {
+ return a << 24 | r << 16 | g << 8 | b;
+ }
+
+ public static Color FromArgb (int alpha, Color baseColor)
+ {
+ //TODO: convert basecolor rgb to name
+ //check alpha, use valid dummy values for rgb.
+ CheckARGBValues(alpha, 0, 0, 0);
+ Color color;
+ color.isknowncolor = false;
+ color.isnamedcolor = false;
+ color.issystemcolor = false;
+ color.myname = "";
+ color.a = (byte)alpha;
+ color.r = baseColor.r;
+ color.g = baseColor.g;
+ color.b = baseColor.b;
+ return color;
+ }
+
+ public static Color FromArgb (int argb)
+ {
+ //TODO: convert irgb to name
+ Color color;
+ color.isknowncolor = false;
+ color.isnamedcolor = false;
+ color.issystemcolor = false;
+ color.myname = "";
+ color.a = (byte) (argb >> 24);
+ color.r = (byte) (argb >> 16);
+ color.g = (byte) (argb >> 8);
+ color.b = (byte)argb;
+ return color;
+ }
+
+ public static Color FromKnownColor (KnownColor KnownColorToConvert)
+ {
+// isknowncolor = true;
+// isnamedcolor = true;
+// issystemcolor = true;
+
+// name = KnownColorToConvert.ToString();
+
+ return FromName(KnownColorToConvert.ToString());
+ }
+
+ public KnownColor ToKnownColor () {
+ if(isknowncolor){
+ // TODO: return correct enumeration of knowncolor. note the return 0 in the else block is correct.
+ return (KnownColor)0;
+ }
+ else{
+ return (KnownColor)0;
+ }
+ //return KnownColor.FromName(KnownColorToConvert.ToString());
+ }
+ public static Color FromName( string ColorName )
+ {
+// isknowncolor = true;
+// isnamedcolor = true;
+// issystemcolor = true;
+
+ string name = ColorName;
+
+ Type colorType = typeof( Color );
+ PropertyInfo[] properties =
+ colorType.GetProperties();
+ foreach( PropertyInfo property in properties ){
+ if( property.Name == name ){
+ MethodInfo method = property.GetGetMethod();
+ if( method != null &&
+ method.IsStatic == true
+ &&
+ method.ReturnType ==
+ colorType ){
+ return (Color)
+ method.Invoke( null, new object[0] );
+ }
+ }
+ }
+ throw new System.ArgumentException(name + " is not a named color","name");
+ }
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized Color Structure
+ /// </remarks>
+
+ public static readonly Color Empty;
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Color objects. The return value is
+ /// based on the equivalence of the A,R,G,B properties
+ /// of the two Colors.
+ /// </remarks>
+
+ public static bool operator == (Color colorA, Color colorB)
+ {
+ return ((colorA.a == colorB.a) && (colorA.r == colorB.r)
+ && (colorA.g == colorB.g) && (colorA.b == colorB.b));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Color objects. The return value is
+ /// based on the equivalence of the A,R,G,B properties
+ /// of the two colors.
+ /// </remarks>
+
+ public static bool operator != (Color colorA, Color colorB)
+ {
+ return ((colorA.a != colorB.a) || (colorA.r != colorB.r)
+ || (colorA.g != colorB.g) || (colorA.b != colorB.b));
+ }
+
+ public float GetBrightness (){
+ // Intensity is the normalized sum of the three RGB values.;
+ return ((float)(r + g + b))/(255*3);
+ }
+ public float GetSaturation (){
+ // S = 1 - I * Min(r,g,b)
+ return (255 -
+ (((float)(r + g +b))/3)*Math.Min(r,Math.Min(g,b))
+ )/255;
+ }
+
+ public float GetHue (){
+ float top = ((float)(2*r-g-b))/(2*255);
+ float bottom = (float)Math.Sqrt(((r-g)*(r-g) + (r-b)*(g-b))/255);
+ return (float)Math.Acos(top/bottom);
+ }
+
+ // -----------------------
+ // Public Constructors
+ // -----------------------
+ public Color(int alpha, int red, int green, int blue)
+ {
+ CheckARGBValues(alpha, red, green, blue);
+ a = (byte)alpha;
+ r = (byte)red;
+ g = (byte)green;
+ b = (byte)blue;
+ isknowncolor = false;
+ isnamedcolor = false;
+ issystemcolor = false;
+ myname = "";
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates transparent black. R,G,B = 0; A=0?
+ /// </remarks>
+
+ public bool IsEmpty
+ {
+ get {
+ return (a + r + g + b) == 0;
+ }
+ }
+
+ /// <summary>
+ /// A Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The transparancy of the Color.
+ /// </remarks>
+
+ public byte A
+ {
+ get {
+ return a;
+ }
+ }
+
+ /// <summary>
+ /// R Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The red value of the Color.
+ /// </remarks>
+
+ public byte R
+ {
+ get {
+ return r;
+ }
+ }
+
+ /// <summary>
+ /// G Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The green value of the Color.
+ /// </remarks>
+
+ public byte G
+ {
+ get {
+ return g;
+ }
+ }
+
+ /// <summary>
+ /// B Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The blue value of the Color.
+ /// </remarks>
+
+ public byte B
+ {
+ get {
+ return b;
+ }
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Color and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is Color))return false;
+ return (this == (Color) o);
+ }
+
+ /// <summary>
+ /// Reference Equals Method
+ /// Is commented out because this is handled by the base class.
+ /// TODO: Is it correct to let the base class handel reference equals
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Color and another object.
+ /// </remarks>
+ //public bool ReferenceEquals (object o)
+ //{
+ // if (!(o is Color))return false;
+ // return (this == (Color) o);
+ //}
+
+
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return ToArgb().GetHashCode();
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the Color as a string in ARGB notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1},{2},{3}]", a, r, g, b);
+ }
+ private static void CheckRGBValues (int red,int green,int blue)
+ {
+ if( (red > 255) || (red < 0))
+ throw new System.ArgumentOutOfRangeException
+ ("red",red,"Value must be in the range 0 - 255");
+ if( (green > 255) || (green < 0))
+ throw new System.ArgumentOutOfRangeException
+ ("green",green,"Value must be in the range 0 - 255");
+ if( (blue > 255) || (blue < 0))
+ throw new System.ArgumentOutOfRangeException
+ ("blue",blue,"Value must be in the range 0 - 255");
+ }
+
+ private static void CheckARGBValues (int alpha,int red,int green,int blue)
+ {
+ if( (alpha > 255) || (alpha < 0))
+ throw new System.ArgumentOutOfRangeException
+ ("alpha",alpha,"Value must be in the range 0 - 255");
+ CheckRGBValues(red,green,blue);
+ }
+
+ //Documentation, do not remove!
+ //This is the program that was used to generate the C# source code below.
+ //static void Main(string[] args)
+ //{
+ // Type cType = typeof( Color );
+ // PropertyInfo[] properties = cType.GetProperties();
+ // foreach( PropertyInfo property in properties )
+ // {
+ // MethodInfo method = property.GetGetMethod();
+ // if( method != null && method.IsStatic && method.ReturnType == cType
+ // )
+ // {
+ // Color c = (Color) method.Invoke( null, new object[0] );
+ // Debug.WriteLine( "static public Color " + property.Name + " {" );
+ // Debug.WriteLine( "\tget{" );
+ // Debug.WriteLine( "\t\treturn Color.FromArgb( " + c.A + ", " + c.R
+ // + ", " + c.G + ", " + c.B + " );" );
+ // Debug.WriteLine( "\t}" );
+ // Debug.WriteLine( "}" );
+ // }
+ // }
+ //}
+
+ static public Color Transparent
+ {
+ get {
+ return Color.FromArgb( 0, 255, 255, 255 );
+ }
+ }
+ static public Color AliceBlue
+ {
+ get {
+ return Color.FromArgb( 255, 240, 248, 255 );
+ }
+ }
+ static public Color AntiqueWhite
+ {
+ get {
+ return Color.FromArgb( 255, 250, 235, 215 );
+ }
+ }
+ static public Color Aqua
+ {
+ get {
+ return Color.FromArgb( 255, 0, 255, 255 );
+ }
+ }
+ static public Color Aquamarine
+ {
+ get {
+ return Color.FromArgb( 255, 127, 255, 212 );
+ }
+ }
+ static public Color Azure
+ {
+ get {
+ return Color.FromArgb( 255, 240, 255, 255 );
+ }
+ }
+ static public Color Beige
+ {
+ get {
+ return Color.FromArgb( 255, 245, 245, 220 );
+ }
+ }
+ static public Color Bisque
+ {
+ get {
+ return Color.FromArgb( 255, 255, 228, 196 );
+ }
+ }
+ static public Color Black
+ {
+ get {
+ return Color.FromArgb( 255, 0, 0, 0 );
+ }
+ }
+ static public Color BlanchedAlmond
+ {
+ get {
+ return Color.FromArgb( 255, 255, 235, 205 );
+ }
+ }
+ static public Color Blue
+ {
+ get {
+ return Color.FromArgb( 255, 0, 0, 255 );
+ }
+ }
+ static public Color BlueViolet
+ {
+ get {
+ return Color.FromArgb( 255, 138, 43, 226 );
+ }
+ }
+ static public Color Brown
+ {
+ get {
+ return Color.FromArgb( 255, 165, 42, 42 );
+ }
+ }
+ static public Color BurlyWood
+ {
+ get {
+ return Color.FromArgb( 255, 222, 184, 135 );
+ }
+ }
+ static public Color CadetBlue
+ {
+ get {
+ return Color.FromArgb( 255, 95, 158, 160 );
+ }
+ }
+ static public Color Chartreuse
+ {
+ get {
+ return Color.FromArgb( 255, 127, 255, 0 );
+ }
+ }
+ static public Color Chocolate
+ {
+ get {
+ return Color.FromArgb( 255, 210, 105, 30 );
+ }
+ }
+ static public Color Coral
+ {
+ get {
+ return Color.FromArgb( 255, 255, 127, 80 );
+ }
+ }
+ static public Color CornflowerBlue
+ {
+ get {
+ return Color.FromArgb( 255, 100, 149, 237 );
+ }
+ }
+ static public Color Cornsilk
+ {
+ get {
+ return Color.FromArgb( 255, 255, 248, 220 );
+ }
+ }
+ static public Color Crimson
+ {
+ get {
+ return Color.FromArgb( 255, 220, 20, 60 );
+ }
+ }
+ static public Color Cyan
+ {
+ get {
+ return Color.FromArgb( 255, 0, 255, 255 );
+ }
+ }
+ static public Color DarkBlue
+ {
+ get {
+ return Color.FromArgb( 255, 0, 0, 139 );
+ }
+ }
+ static public Color DarkCyan
+ {
+ get {
+ return Color.FromArgb( 255, 0, 139, 139 );
+ }
+ }
+ static public Color DarkGoldenrod
+ {
+ get {
+ return Color.FromArgb( 255, 184, 134, 11 );
+ }
+ }
+ static public Color DarkGray
+ {
+ get {
+ return Color.FromArgb( 255, 169, 169, 169 );
+ }
+ }
+ static public Color DarkGreen
+ {
+ get {
+ return Color.FromArgb( 255, 0, 100, 0 );
+ }
+ }
+ static public Color DarkKhaki
+ {
+ get {
+ return Color.FromArgb( 255, 189, 183, 107 );
+ }
+ }
+ static public Color DarkMagenta
+ {
+ get {
+ return Color.FromArgb( 255, 139, 0, 139 );
+ }
+ }
+ static public Color DarkOliveGreen
+ {
+ get {
+ return Color.FromArgb( 255, 85, 107, 47 );
+ }
+ }
+ static public Color DarkOrange
+ {
+ get {
+ return Color.FromArgb( 255, 255, 140, 0 );
+ }
+ }
+ static public Color DarkOrchid
+ {
+ get {
+ return Color.FromArgb( 255, 153, 50, 204 );
+ }
+ }
+ static public Color DarkRed
+ {
+ get {
+ return Color.FromArgb( 255, 139, 0, 0 );
+ }
+ }
+ static public Color DarkSalmon
+ {
+ get {
+ return Color.FromArgb( 255, 233, 150, 122 );
+ }
+ }
+ static public Color DarkSeaGreen
+ {
+ get {
+ return Color.FromArgb( 255, 143, 188, 139 );
+ }
+ }
+ static public Color DarkSlateBlue
+ {
+ get {
+ return Color.FromArgb( 255, 72, 61, 139 );
+ }
+ }
+ static public Color DarkSlateGray
+ {
+ get {
+ return Color.FromArgb( 255, 47, 79, 79 );
+ }
+ }
+ static public Color DarkTurquoise
+ {
+ get {
+ return Color.FromArgb( 255, 0, 206, 209 );
+ }
+ }
+ static public Color DarkViolet
+ {
+ get {
+ return Color.FromArgb( 255, 148, 0, 211 );
+ }
+ }
+ static public Color DeepPink
+ {
+ get {
+ return Color.FromArgb( 255, 255, 20, 147 );
+ }
+ }
+ static public Color DeepSkyBlue
+ {
+ get {
+ return Color.FromArgb( 255, 0, 191, 255 );
+ }
+ }
+ static public Color DimGray
+ {
+ get {
+ return Color.FromArgb( 255, 105, 105, 105 );
+ }
+ }
+ static public Color DodgerBlue
+ {
+ get {
+ return Color.FromArgb( 255, 30, 144, 255 );
+ }
+ }
+ static public Color Firebrick
+ {
+ get {
+ return Color.FromArgb( 255, 178, 34, 34 );
+ }
+ }
+ static public Color FloralWhite
+ {
+ get {
+ return Color.FromArgb( 255, 255, 250, 240 );
+ }
+ }
+ static public Color ForestGreen
+ {
+ get {
+ return Color.FromArgb( 255, 34, 139, 34 );
+ }
+ }
+ static public Color Fuchsia
+ {
+ get {
+ return Color.FromArgb( 255, 255, 0, 255 );
+ }
+ }
+ static public Color Gainsboro
+ {
+ get {
+ return Color.FromArgb( 255, 220, 220, 220 );
+ }
+ }
+ static public Color GhostWhite
+ {
+ get {
+ return Color.FromArgb( 255, 248, 248, 255 );
+ }
+ }
+ static public Color Gold
+ {
+ get {
+ return Color.FromArgb( 255, 255, 215, 0 );
+ }
+ }
+ static public Color Goldenrod
+ {
+ get {
+ return Color.FromArgb( 255, 218, 165, 32 );
+ }
+ }
+ static public Color Gray
+ {
+ get {
+ return Color.FromArgb( 255, 128, 128, 128 );
+ }
+ }
+ static public Color Green
+ {
+ get {
+ return Color.FromArgb( 255, 0, 128, 0 );
+ }
+ }
+ static public Color GreenYellow
+ {
+ get {
+ return Color.FromArgb( 255, 173, 255, 47 );
+ }
+ }
+ static public Color Honeydew
+ {
+ get {
+ return Color.FromArgb( 255, 240, 255, 240 );
+ }
+ }
+ static public Color HotPink
+ {
+ get {
+ return Color.FromArgb( 255, 255, 105, 180 );
+ }
+ }
+ static public Color IndianRed
+ {
+ get {
+ return Color.FromArgb( 255, 205, 92, 92 );
+ }
+ }
+ static public Color Indigo
+ {
+ get {
+ return Color.FromArgb( 255, 75, 0, 130 );
+ }
+ }
+ static public Color Ivory
+ {
+ get {
+ return Color.FromArgb( 255, 255, 255, 240 );
+ }
+ }
+ static public Color Khaki
+ {
+ get {
+ return Color.FromArgb( 255, 240, 230, 140 );
+ }
+ }
+ static public Color Lavender
+ {
+ get {
+ return Color.FromArgb( 255, 230, 230, 250 );
+ }
+ }
+ static public Color LavenderBlush
+ {
+ get {
+ return Color.FromArgb( 255, 255, 240, 245 );
+ }
+ }
+ static public Color LawnGreen
+ {
+ get {
+ return Color.FromArgb( 255, 124, 252, 0 );
+ }
+ }
+ static public Color LemonChiffon
+ {
+ get {
+ return Color.FromArgb( 255, 255, 250, 205 );
+ }
+ }
+ static public Color LightBlue
+ {
+ get {
+ return Color.FromArgb( 255, 173, 216, 230 );
+ }
+ }
+ static public Color LightCoral
+ {
+ get {
+ return Color.FromArgb( 255, 240, 128, 128 );
+ }
+ }
+ static public Color LightCyan
+ {
+ get {
+ return Color.FromArgb( 255, 224, 255, 255 );
+ }
+ }
+ static public Color LightGoldenrodYellow
+ {
+ get {
+ return Color.FromArgb( 255, 250, 250, 210 );
+ }
+ }
+ static public Color LightGreen
+ {
+ get {
+ return Color.FromArgb( 255, 144, 238, 144 );
+ }
+ }
+ static public Color LightGray
+ {
+ get {
+ return Color.FromArgb( 255, 211, 211, 211 );
+ }
+ }
+ static public Color LightPink
+ {
+ get {
+ return Color.FromArgb( 255, 255, 182, 193 );
+ }
+ }
+ static public Color LightSalmon
+ {
+ get {
+ return Color.FromArgb( 255, 255, 160, 122 );
+ }
+ }
+ static public Color LightSeaGreen
+ {
+ get {
+ return Color.FromArgb( 255, 32, 178, 170 );
+ }
+ }
+ static public Color LightSkyBlue
+ {
+ get {
+ return Color.FromArgb( 255, 135, 206, 250 );
+ }
+ }
+ static public Color LightSlateGray
+ {
+ get {
+ return Color.FromArgb( 255, 119, 136, 153 );
+ }
+ }
+ static public Color LightSteelBlue
+ {
+ get {
+ return Color.FromArgb( 255, 176, 196, 222 );
+ }
+ }
+ static public Color LightYellow
+ {
+ get {
+ return Color.FromArgb( 255, 255, 255, 224 );
+ }
+ }
+ static public Color Lime
+ {
+ get {
+ return Color.FromArgb( 255, 0, 255, 0 );
+ }
+ }
+ static public Color LimeGreen
+ {
+ get {
+ return Color.FromArgb( 255, 50, 205, 50 );
+ }
+ }
+ static public Color Linen
+ {
+ get {
+ return Color.FromArgb( 255, 250, 240, 230 );
+ }
+ }
+ static public Color Magenta
+ {
+ get {
+ return Color.FromArgb( 255, 255, 0, 255 );
+ }
+ }
+ static public Color Maroon
+ {
+ get {
+ return Color.FromArgb( 255, 128, 0, 0 );
+ }
+ }
+ static public Color MediumAquamarine
+ {
+ get {
+ return Color.FromArgb( 255, 102, 205, 170 );
+ }
+ }
+ static public Color MediumBlue
+ {
+ get {
+ return Color.FromArgb( 255, 0, 0, 205 );
+ }
+ }
+ static public Color MediumOrchid
+ {
+ get {
+ return Color.FromArgb( 255, 186, 85, 211 );
+ }
+ }
+ static public Color MediumPurple
+ {
+ get {
+ return Color.FromArgb( 255, 147, 112, 219 );
+ }
+ }
+ static public Color MediumSeaGreen
+ {
+ get {
+ return Color.FromArgb( 255, 60, 179, 113 );
+ }
+ }
+ static public Color MediumSlateBlue
+ {
+ get {
+ return Color.FromArgb( 255, 123, 104, 238 );
+ }
+ }
+ static public Color MediumSpringGreen
+ {
+ get {
+ return Color.FromArgb( 255, 0, 250, 154 );
+ }
+ }
+ static public Color MediumTurquoise
+ {
+ get {
+ return Color.FromArgb( 255, 72, 209, 204 );
+ }
+ }
+ static public Color MediumVioletRed
+ {
+ get {
+ return Color.FromArgb( 255, 199, 21, 133 );
+ }
+ }
+ static public Color MidnightBlue
+ {
+ get {
+ return Color.FromArgb( 255, 25, 25, 112 );
+ }
+ }
+ static public Color MintCream
+ {
+ get {
+ return Color.FromArgb( 255, 245, 255, 250 );
+ }
+ }
+ static public Color MistyRose
+ {
+ get {
+ return Color.FromArgb( 255, 255, 228, 225 );
+ }
+ }
+ static public Color Moccasin
+ {
+ get {
+ return Color.FromArgb( 255, 255, 228, 181 );
+ }
+ }
+ static public Color NavajoWhite
+ {
+ get {
+ return Color.FromArgb( 255, 255, 222, 173 );
+ }
+ }
+ static public Color Navy
+ {
+ get {
+ return Color.FromArgb( 255, 0, 0, 128 );
+ }
+ }
+ static public Color OldLace
+ {
+ get {
+ return Color.FromArgb( 255, 253, 245, 230 );
+ }
+ }
+ static public Color Olive
+ {
+ get {
+ return Color.FromArgb( 255, 128, 128, 0 );
+ }
+ }
+ static public Color OliveDrab
+ {
+ get {
+ return Color.FromArgb( 255, 107, 142, 35 );
+ }
+ }
+ static public Color Orange
+ {
+ get {
+ return Color.FromArgb( 255, 255, 165, 0 );
+ }
+ }
+ static public Color OrangeRed
+ {
+ get {
+ return Color.FromArgb( 255, 255, 69, 0 );
+ }
+ }
+ static public Color Orchid
+ {
+ get {
+ return Color.FromArgb( 255, 218, 112, 214 );
+ }
+ }
+ static public Color PaleGoldenrod
+ {
+ get {
+ return Color.FromArgb( 255, 238, 232, 170 );
+ }
+ }
+ static public Color PaleGreen
+ {
+ get {
+ return Color.FromArgb( 255, 152, 251, 152 );
+ }
+ }
+ static public Color PaleTurquoise
+ {
+ get {
+ return Color.FromArgb( 255, 175, 238, 238 );
+ }
+ }
+ static public Color PaleVioletRed
+ {
+ get {
+ return Color.FromArgb( 255, 219, 112, 147 );
+ }
+ }
+ static public Color PapayaWhip
+ {
+ get {
+ return Color.FromArgb( 255, 255, 239, 213 );
+ }
+ }
+ static public Color PeachPuff
+ {
+ get {
+ return Color.FromArgb( 255, 255, 218, 185 );
+ }
+ }
+ static public Color Peru
+ {
+ get {
+ return Color.FromArgb( 255, 205, 133, 63 );
+ }
+ }
+ static public Color Pink
+ {
+ get {
+ return Color.FromArgb( 255, 255, 192, 203 );
+ }
+ }
+ static public Color Plum
+ {
+ get {
+ return Color.FromArgb( 255, 221, 160, 221 );
+ }
+ }
+ static public Color PowderBlue
+ {
+ get {
+ return Color.FromArgb( 255, 176, 224, 230 );
+ }
+ }
+ static public Color Purple
+ {
+ get {
+ return Color.FromArgb( 255, 128, 0, 128 );
+ }
+ }
+ static public Color Red
+ {
+ get {
+ return Color.FromArgb( 255, 255, 0, 0 );
+ }
+ }
+ static public Color RosyBrown
+ {
+ get {
+ return Color.FromArgb( 255, 188, 143, 143 );
+ }
+ }
+ static public Color RoyalBlue
+ {
+ get {
+ return Color.FromArgb( 255, 65, 105, 225 );
+ }
+ }
+ static public Color SaddleBrown
+ {
+ get {
+ return Color.FromArgb( 255, 139, 69, 19 );
+ }
+ }
+ static public Color Salmon
+ {
+ get {
+ return Color.FromArgb( 255, 250, 128, 114 );
+ }
+ }
+ static public Color SandyBrown
+ {
+ get {
+ return Color.FromArgb( 255, 244, 164, 96 );
+ }
+ }
+ static public Color SeaGreen
+ {
+ get {
+ return Color.FromArgb( 255, 46, 139, 87 );
+ }
+ }
+ static public Color SeaShell
+ {
+ get {
+ return Color.FromArgb( 255, 255, 245, 238 );
+ }
+ }
+ static public Color Sienna
+ {
+ get {
+ return Color.FromArgb( 255, 160, 82, 45 );
+ }
+ }
+ static public Color Silver
+ {
+ get {
+ return Color.FromArgb( 255, 192, 192, 192 );
+ }
+ }
+ static public Color SkyBlue
+ {
+ get {
+ return Color.FromArgb( 255, 135, 206, 235 );
+ }
+ }
+ static public Color SlateBlue
+ {
+ get {
+ return Color.FromArgb( 255, 106, 90, 205 );
+ }
+ }
+ static public Color SlateGray
+ {
+ get {
+ return Color.FromArgb( 255, 112, 128, 144 );
+ }
+ }
+ static public Color Snow
+ {
+ get {
+ return Color.FromArgb( 255, 255, 250, 250 );
+ }
+ }
+ static public Color SpringGreen
+ {
+ get {
+ return Color.FromArgb( 255, 0, 255, 127 );
+ }
+ }
+ static public Color SteelBlue
+ {
+ get {
+ return Color.FromArgb( 255, 70, 130, 180 );
+ }
+ }
+ static public Color Tan
+ {
+ get {
+ return Color.FromArgb( 255, 210, 180, 140 );
+ }
+ }
+ static public Color Teal
+ {
+ get {
+ return Color.FromArgb( 255, 0, 128, 128 );
+ }
+ }
+ static public Color Thistle
+ {
+ get {
+ return Color.FromArgb( 255, 216, 191, 216 );
+ }
+ }
+ static public Color Tomato
+ {
+ get {
+ return Color.FromArgb( 255, 255, 99, 71 );
+ }
+ }
+ static public Color Turquoise
+ {
+ get {
+ return Color.FromArgb( 255, 64, 224, 208 );
+ }
+ }
+ static public Color Violet
+ {
+ get {
+ return Color.FromArgb( 255, 238, 130, 238 );
+ }
+ }
+ static public Color Wheat
+ {
+ get {
+ return Color.FromArgb( 255, 245, 222, 179 );
+ }
+ }
+ static public Color White
+ {
+ get {
+ return Color.FromArgb( 255, 255, 255, 255 );
+ }
+ }
+ static public Color WhiteSmoke
+ {
+ get {
+ return Color.FromArgb( 255, 245, 245, 245 );
+ }
+ }
+ static public Color Yellow
+ {
+ get {
+ return Color.FromArgb( 255, 255, 255, 0 );
+ }
+ }
+ static public Color YellowGreen
+ {
+ get {
+ return Color.FromArgb( 255, 154, 205, 50 );
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/ColorTranslator.cs b/mcs/class/System.Drawing/System.Drawing/ColorTranslator.cs
new file mode 100644
index 00000000000..ac639f62162
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/ColorTranslator.cs
@@ -0,0 +1,95 @@
+//
+// System.Drawing.ColorTranslator.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+// Dennis Hayes (dennish@raytek.com)
+// Inital Implimentation 3/25/2002
+// All conversions based on best guess, will improve over time
+//
+using System;
+namespace System.Drawing {
+ public class ColorTranslator{
+ // From converisons
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="HtmlFromColor"></param>
+ /// <returns></returns>
+ public static Color FromHtml(string HtmlFromColor){
+ // TODO:
+ // If first char is "#"
+ //convert "#RRGGBB" to int and use Color.FromARGB(int) to create color
+ // else //it is a color name
+ //If there is a single digit at the end of the name, remove it.
+ // Call Color.FromKnownColor(HtmlFromColor)
+
+ //At least some Html strings match .NET Colors,
+ // so this should work for those colors.
+ // .NET colors, XWindows colors, and WWWC web colors
+ // are (according to Charles Pretziod) base the same
+ //colors, so many shouold work if any do.
+ return Color.FromKnownColor(HtmlFromColor);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="OLEFromColor"></param>
+ /// <returns></returns>
+ public static Color FromOle(int OLEFromColor){
+ int newcolor;
+ //TODO: swap RB bytes i.e. AARRGGBB to AABBGGRR
+ return Color.FromArgb(newcolor);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="Win32FromColor"></param>
+ /// <returns></returns>
+ public static Color FromWin32(int Win32FromColor){
+ int newcolor;
+ //TODO: swap RB bytes i.e. AARRGGBB to AABBGGRR
+ return Color.FromArgb(newcolor);
+ }
+
+ // To converisons
+ public static string ToHtml(Color HtmlToColor){
+ //TODO: html string for unknown color is "#rrgggbb" in hex format.
+ //TODO: first pass use same for known color.
+ //TODO: second pass return name string for known colors.
+ string returnstring;
+ if(HtmlToColor.IsKnownColor){
+ }
+ else{
+ }
+ return Color.FromKnownColor(HtmlToColor);
+ }
+ /// <summary>
+ /// converts from BGR to RGB
+ /// </summary>
+ /// <param name="OleToColor"></param>
+ /// <returns></returns>
+ public static int ToOle(Color FromColor){
+ // TODO: Swap red and blue(from argb), convert to int(toargb)
+ // Same as ToWin32
+ return (Color.FromArgb(FromColor.B,FromColor.G,FromColor.R)).ToArgb();
+ }
+
+ /// <summary>
+ /// converts from RGB to BGR
+ /// </summary>
+ /// <param name="Win32ToColor"></param>
+ /// <returns></returns>
+ public static int ToWin32(Color FromColor){
+ // TODO: Swap red and blue(from argb), convert to int(toargb)
+ // Same as ToOle
+ return (Color.FromArgb(FromColor.B,FromColor.G,FromColor.R)).ToArgb();
+ }
+ }
+}
+
+
+
+
diff --git a/mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs b/mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs
new file mode 100644
index 00000000000..15f9a600532
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/ContentAlignment.cs
@@ -0,0 +1,22 @@
+//
+// System.Drawing.ContentAlignment.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+using System;
+namespace System.Drawing
+{
+ public enum ContentAlignment {
+ BottomCenter = 1,
+ BottomLeft = 2,
+ BottomRight = 3,
+ MiddleCenter = 4,
+ MiddleLeft = 5,
+ MiddleRight = 6,
+ TopCenter = 7,
+ TopLeft = 8,
+ TopRight = 9
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/FontStyle.cs b/mcs/class/System.Drawing/System.Drawing/FontStyle.cs
new file mode 100644
index 00000000000..002bbb9fa3d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/FontStyle.cs
@@ -0,0 +1,19 @@
+//
+// System.Drawing.fontStyle.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ public enum FontStyle {
+ Bold = 1,
+ Italic = 2,
+ Regular = 3,
+ Strikeout = 4,
+ Underline = 5
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs b/mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs
new file mode 100644
index 00000000000..a5428c3a603
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/GraphicsUnit.cs
@@ -0,0 +1,20 @@
+//
+// System.Drawing.GraphicsUnit.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+using System;
+namespace System.Drawing
+{
+ public enum GraphicsUnit {
+ Display = 1,
+ Document = 2,
+ Inch = 3,
+ Millimeter = 4,
+ Pixel = 5,
+ Point = 6,
+ World = 7,
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Image.cs b/mcs/class/System.Drawing/System.Drawing/Image.cs
new file mode 100644
index 00000000000..0425e1aae48
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Image.cs
@@ -0,0 +1,199 @@
+// created on 20.02.2002 at 21:18
+//
+// Image.cs
+//
+// Author: Christian Meyer
+// eMail: Christian.Meyer@cs.tum.edu
+//
+// Many methods are still commented. I'll care about them when all necessary
+// classes are implemented.
+//
+namespace System.Drawing {
+
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Serialization;
+using System.Drawing.Imaging;
+
+//[Serializable]
+//[ComVisible(true)]
+
+public abstract class Image : MarshalByRefObject, ICloneable, IDisposable /*, ISerializable */ {
+
+ // constructor
+ public Image () {}
+
+ // public methods
+ // static
+ public static Image FromFile (string filename)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public static Image FromFile (string filename, bool useEmbeddedColorManagement)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public static Bitmap FromHbitmap (IntPtr hbitmap)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public static Bitmap FromHbitmap (IntPtr hbitmap, IntPtr hpalette)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public static int GetPixelFormatSize (PixelFormat pixfmt)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public static bool IsAlphaPixelFormat (PixelFormat pixfmt)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public static bool IsCanonicalPixelFormat (PixelFormat pixfmt)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public static bool IsExtendedPixelFormat (PixelFormat pixfmt)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ // non-static
+ public RectangleF GetBounds (ref GraphicsUnit pageUnit)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ //public EncoderParameters GetEncoderParameterList(Guid encoder);
+ //public int GetFrameCount(FrameDimension dimension);
+ //public PropertyItem GetPropertyItem(int propid);
+ /*
+ public Image GetThumbnailImage(int thumbWidth, int thumbHeight,
+ Image.GetThumbnailImageAbort callback,
+ IntPtr callbackData);
+ */
+
+ public void RemovePropertyItem (int propid)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public void RotateFlip (RotateFlipType rotateFlipType)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ public void Save (string filename)
+ {
+ // Fixme: implement me
+ throw new NotImplementedException ();
+ }
+
+ //public void Save(Stream stream, ImageFormat format);
+ //public void Save(string filename, ImageFormat format);
+ //public void Save(Stream stream, ImageCodecInfo encoder,
+ // EncoderParameters encoderParams);
+ //public void Save(string filename, ImageCodecInfo encoder,
+ // EncoderParameters encoderParams);
+ //public void SaveAdd(EncoderParameters_ encoderParams);
+ //public void SaveAdd(Image image, EncoderParameters_ encoderParams);
+ //public int SelectActiveFrame(FrameDimension dimension, int frameIndex);
+ //public void SetPropertyItem(PropertyItem propitem);
+
+ // destructor
+ ~Image() {}
+
+ // properties
+ public int Flags {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public Guid[] FrameDimensionsList {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int Height {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public float HorizontalResolution {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public ColorPalette Palette {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public SizeF PhysicalDimension {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public PixelFormat PixelFormat {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int[] PropertyIdList {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ //public PropertyItem[] PropertyItems {get;}
+ //public ImageFormat RawFormat {get;}
+
+ public Size Size {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public float VerticalResolution {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public int Width {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+}
+
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/KnownColor.cs b/mcs/class/System.Drawing/System.Drawing/KnownColor.cs
new file mode 100644
index 00000000000..5a60973509f
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/KnownColor.cs
@@ -0,0 +1,182 @@
+//
+// System.Drawing.Color.cs
+//
+// (C) 2002 Dennis Hayes
+// Author:
+// Dennis Hayes (dennish@raytek.com)
+// Ben Houston (ben@exocortex.org)
+//
+
+using System;
+namespace System.Drawing
+{
+ public enum KnownColor {
+ ActiveBorder = 1,
+ ActiveCaption = 2,
+ ActiveCaptionText = 3,
+ AppWorkspace = 4,
+ Control = 5,
+ ControlDark = 6,
+ ControlDarkDark = 7,
+ ControlLight = 8,
+ ControlLightLight = 9,
+ ControlText = 10,
+ Desktop = 11,
+ GrayText = 12,
+ Highlight = 13,
+ HighlightText = 14,
+ HotTrack = 15,
+ InactiveBorder = 16,
+ InactiveCaption = 17,
+ InactiveCaptionText = 18,
+ Info = 19,
+ InfoText = 20,
+ Menu = 21,
+ MenuText = 22,
+ ScrollBar = 23,
+ Window = 24,
+ WindowFrame = 25,
+ WindowText = 26,
+ Transparent = 27,
+ AliceBlue = 28,
+ AntiqueWhite = 29,
+ Aqua = 30,
+ Aquamarine = 31,
+ Azure = 32,
+ Beige = 33,
+ Bisque = 34,
+ Black = 35,
+ BlanchedAlmond = 36,
+ Blue = 37,
+ BlueViolet = 38,
+ Brown = 39,
+ BurlyWood = 40,
+ CadetBlue = 41,
+ Chartreuse = 42,
+ Chocolate = 43,
+ Coral = 44,
+ CornflowerBlue = 45,
+ Cornsilk = 46,
+ Crimson = 47,
+ Cyan = 48,
+ DarkBlue = 49,
+ DarkCyan = 50,
+ DarkGoldenrod = 51,
+ DarkGray = 52,
+ DarkGreen = 53,
+ DarkKhaki = 54,
+ DarkMagenta = 55,
+ DarkOliveGreen = 56,
+ DarkOrange = 57,
+ DarkOrchid = 58,
+ DarkRed = 59,
+ DarkSalmon = 60,
+ DarkSeaGreen = 61,
+ DarkSlateBlue = 62,
+ DarkSlateGray = 63,
+ DarkTurquoise = 64,
+ DarkViolet = 65,
+ DeepPink = 66,
+ DeepSkyBlue = 67,
+ DimGray = 68,
+ DodgerBlue = 69,
+ Firebrick = 70,
+ FloralWhite = 71,
+ ForestGreen = 72,
+ Fuchsia = 73,
+ Gainsboro = 74,
+ GhostWhite = 75,
+ Gold = 76,
+ Goldenrod = 77,
+ Gray = 78,
+ Green = 79,
+ GreenYellow = 80,
+ Honeydew = 81,
+ HotPink = 82,
+ IndianRed = 83,
+ Indigo = 84,
+ Ivory = 85,
+ Khaki = 86,
+ Lavender = 87,
+ LavenderBlush = 88,
+ LawnGreen = 89,
+ LemonChiffon = 90,
+ LightBlue = 91,
+ LightCoral = 92,
+ LightCyan = 93,
+ LightGoldenrodYellow = 94,
+ LightGreen = 95,
+ LightGray = 96,
+ LightPink = 97,
+ LightSalmon = 98,
+ LightSeaGreen = 99,
+ LightSkyBlue = 100,
+ LightSlateGray = 101,
+ LightSteelBlue = 102,
+ LightYellow = 103,
+ Lime = 104,
+ LimeGreen = 105,
+ Linen = 106,
+ Magenta = 107,
+ Maroon = 108,
+ MediumAquamarine = 109,
+ MediumBlue = 110,
+ MediumOrchid = 111,
+ MediumPurple = 112,
+ MediumSeaGreen = 113,
+ MediumSlateBlue = 114,
+ MediumSpringGreen = 115,
+ MediumTurquoise = 116,
+ MediumVioletRed = 117,
+ MidnightBlue = 118,
+ MintCream = 119,
+ MistyRose = 120,
+ Moccasin = 121,
+ NavajoWhite = 122,
+ Navy = 123,
+ OldLace = 124,
+ Olive = 125,
+ OliveDrab = 126,
+ Orange = 127,
+ OrangeRed = 128,
+ Orchid = 129,
+ PaleGoldenrod = 130,
+ PaleGreen = 131,
+ PaleTurquoise = 132,
+ PaleVioletRed = 133,
+ PapayaWhip = 134,
+ PeachPuff = 135,
+ Peru = 136,
+ Pink = 137,
+ Plum = 138,
+ PowderBlue = 139,
+ Purple = 140,
+ Red = 141,
+ RosyBrown = 142,
+ RoyalBlue = 143,
+ SaddleBrown = 144,
+ Salmon = 145,
+ SandyBrown = 146,
+ SeaGreen = 147,
+ SeaShell = 148,
+ Sienna = 149,
+ Silver = 150,
+ SkyBlue = 151,
+ SlateBlue = 152,
+ SlateGray = 153,
+ Snow = 154,
+ SpringGreen = 155,
+ SteelBlue = 156,
+ Tan = 157,
+ Teal = 158,
+ Thistle = 159,
+ Tomato = 160,
+ Turquoise = 161,
+ Violet = 162,
+ Wheat = 163,
+ White = 164,
+ WhiteSmoke = 165,
+ Yellow = 166,
+ YellowGreen = 167
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Pen.cs b/mcs/class/System.Drawing/System.Drawing/Pen.cs
new file mode 100755
index 00000000000..16c6263b049
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Pen.cs
@@ -0,0 +1,113 @@
+//
+// System.Drawing.Pen.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Drawing.Drawing2D;
+
+namespace System.Drawing {
+
+ public sealed class Pen : MarshalByRefObject, ICloneable, IDisposable {
+ Brush brush;
+ Color color;
+ float width;
+ PenAlignment alignment;
+
+ public Pen (Brush brush)
+ {
+ this.brush = brush;
+ width = 1;
+ }
+
+ public Pen (Color color)
+ {
+ this.color = color;
+ width = 1;
+ }
+
+ public Pen (Brush brush, float width)
+ {
+ this.width = width;
+ this.brush = brush;
+ }
+
+ public Pen (Color color, float width)
+ {
+ this.width = width;
+ this.color = color;
+ }
+
+ //
+ // Properties
+ //
+ public PenAlignment Alignment {
+ get {
+ return alignment;
+ }
+
+ set {
+ alignment = value;
+ }
+ }
+
+ public Brush Brush {
+ get {
+ return brush;
+ }
+
+ set {
+ brush = value;
+ }
+ }
+
+ public Color Color {
+ get {
+ return color;
+ }
+
+ set {
+ color = value;
+ }
+ }
+
+ public float Width {
+ get {
+ return width;
+ }
+ set {
+ width = value;
+ }
+ }
+
+ public object Clone ()
+ {
+ Pen p = new Pen (brush, width);
+
+ p.color = color;
+ p.alignment = alignment;
+
+ return p;
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ System.GC.SuppressFinalize (this);
+ }
+
+ void Dispose (bool disposing)
+ {
+ // Nothing for now.
+ }
+
+ ~Pen ()
+ {
+ Dispose (false);
+ }
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Point.cs b/mcs/class/System.Drawing/System.Drawing/Point.cs
new file mode 100644
index 00000000000..fa0db9abc9b
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Point.cs
@@ -0,0 +1,339 @@
+//
+// System.Drawing.Point.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct Point {
+
+ // Private x and y coordinate fields.
+ int cx, cy;
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized Point Structure.
+ /// </remarks>
+
+ public static readonly Point Empty;
+
+ /// <summary>
+ /// Ceiling Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Point structure from a PointF structure by
+ /// taking the ceiling of the X and Y properties.
+ /// </remarks>
+
+ public static Point Ceiling (PointF value)
+ {
+ int x, y;
+ checked {
+ x = (int) Math.Ceiling (value.X);
+ y = (int) Math.Ceiling (value.Y);
+ }
+
+ return new Point (x, y);
+ }
+
+ /// <summary>
+ /// Round Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Point structure from a PointF structure by
+ /// rounding the X and Y properties.
+ /// </remarks>
+
+ public static Point Round (PointF value)
+ {
+ int x, y;
+ checked {
+ x = (int) Math.Round (value.X);
+ y = (int) Math.Round (value.Y);
+ }
+
+ return new Point (x, y);
+ }
+
+ /// <summary>
+ /// Truncate Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Point structure from a PointF structure by
+ /// truncating the X and Y properties.
+ /// </remarks>
+
+ // LAMESPEC: Should this be floor, or a pure cast to int?
+
+ public static Point Truncate (PointF value)
+ {
+ int x, y;
+ checked {
+ x = (int) value.X;
+ y = (int) value.Y;
+ }
+
+ return new Point (x, y);
+ }
+
+ /// <summary>
+ /// Addition Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Translates a Point using the Width and Height
+ /// properties of the given <typeref>Size</typeref>.
+ /// </remarks>
+
+ public static Point operator + (Point pt, Size sz)
+ {
+ return new Point (pt.X + sz.Width, pt.Y + sz.Height);
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Point objects. The return value is
+ /// based on the equivalence of the X and Y properties
+ /// of the two points.
+ /// </remarks>
+
+ public static bool operator == (Point pt_a, Point pt_b)
+ {
+ return ((pt_a.X == pt_b.X) && (pt_a.Y == pt_b.Y));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Point objects. The return value is
+ /// based on the equivalence of the X and Y properties
+ /// of the two points.
+ /// </remarks>
+
+ public static bool operator != (Point pt_a, Point pt_b)
+ {
+ return ((pt_a.X != pt_b.X) || (pt_a.Y != pt_b.Y));
+ }
+
+ /// <summary>
+ /// Subtraction Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Translates a Point using the negation of the Width
+ /// and Height properties of the given Size.
+ /// </remarks>
+
+ public static Point operator - (Point pt, Size sz)
+ {
+ return new Point (pt.X - sz.Width, pt.Y - sz.Height);
+ }
+
+ /// <summary>
+ /// Point to Size Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Returns a Size based on the Coordinates of a given
+ /// Point. Requires explicit cast.
+ /// </remarks>
+
+ public static explicit operator Size (Point pt)
+ {
+ return new Size (pt.X, pt.Y);
+ }
+
+ /// <summary>
+ /// Point to PointF Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a PointF based on the coordinates of a given
+ /// Point. No explicit cast is required.
+ /// </remarks>
+
+ public static implicit operator PointF (Point pt)
+ {
+ return new PointF (pt.X, pt.Y);
+ }
+
+
+ // -----------------------
+ // Public Constructors
+ // -----------------------
+
+ /// <summary>
+ /// Point Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Point from an integer which holds the X
+ /// coordinate in the high order 16 bits and the Y
+ /// coordinate in the low order 16 bits.
+ /// </remarks>
+
+ public Point (int dw)
+ {
+ cx = dw >> 16;
+ cy = dw & 0xffff;
+ }
+
+ /// <summary>
+ /// Point Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Point from a Size value.
+ /// </remarks>
+
+ public Point (Size sz)
+ {
+ cx = sz.Width;
+ cy = sz.Height;
+ }
+
+ /// <summary>
+ /// Point Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Point from a specified x,y coordinate pair.
+ /// </remarks>
+
+ public Point (int x, int y)
+ {
+ cx = x;
+ cy = y;
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if both X and Y are zero.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((cx == 0) && (cy == 0));
+ }
+ }
+
+ /// <summary>
+ /// X Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the Point.
+ /// </remarks>
+
+ public int X {
+ get {
+ return cx;
+ }
+ set {
+ cx = value;
+ }
+ }
+
+ /// <summary>
+ /// Y Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the Point.
+ /// </remarks>
+
+ public int Y {
+ get {
+ return cy;
+ }
+ set {
+ cy = value;
+ }
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Point and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is Point))
+ return false;
+
+ return (this == (Point) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return cx^cy;
+ }
+
+ /// <summary>
+ /// Offset Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Moves the Point a specified distance.
+ /// </remarks>
+
+ public void Offset (int dx, int dy)
+ {
+ cx += dx;
+ cy += dy;
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the Point as a string in coordinate notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1}]", cx, cy);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/PointF.cs b/mcs/class/System.Drawing/System.Drawing/PointF.cs
new file mode 100644
index 00000000000..42895bdac4a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/PointF.cs
@@ -0,0 +1,204 @@
+//
+// System.Drawing.PointF.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct PointF {
+
+ // Private x and y coordinate fields.
+ float cx, cy;
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized PointF Structure.
+ /// </remarks>
+
+ public static readonly PointF Empty;
+
+ /// <summary>
+ /// Addition Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Translates a PointF using the Width and Height
+ /// properties of the given Size.
+ /// </remarks>
+
+ public static PointF operator + (PointF pt, Size sz)
+ {
+ return new PointF (pt.X + sz.Width, pt.Y + sz.Height);
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two PointF objects. The return value is
+ /// based on the equivalence of the X and Y properties
+ /// of the two points.
+ /// </remarks>
+
+ public static bool operator == (PointF pt_a, PointF pt_b)
+ {
+ return ((pt_a.X == pt_b.X) && (pt_a.Y == pt_b.Y));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two PointF objects. The return value is
+ /// based on the equivalence of the X and Y properties
+ /// of the two points.
+ /// </remarks>
+
+ public static bool operator != (PointF pt_a, PointF pt_b)
+ {
+ return ((pt_a.X != pt_b.X) || (pt_a.Y != pt_b.Y));
+ }
+
+ /// <summary>
+ /// Subtraction Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Translates a PointF using the negation of the Width
+ /// and Height properties of the given Size.
+ /// </remarks>
+
+ public static PointF operator - (PointF pt, Size sz)
+ {
+ return new PointF (pt.X - sz.Width, pt.Y - sz.Height);
+ }
+
+ // -----------------------
+ // Public Constructor
+ // -----------------------
+
+ /// <summary>
+ /// PointF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a PointF from a specified x,y coordinate pair.
+ /// </remarks>
+
+ public PointF (float x, float y)
+ {
+ cx = x;
+ cy = y;
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if both X and Y are zero.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((cx == 0.0) && (cy == 0.0));
+ }
+ }
+
+ /// <summary>
+ /// X Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the PointF.
+ /// </remarks>
+
+ public float X {
+ get {
+ return cx;
+ }
+ set {
+ cx = value;
+ }
+ }
+
+ /// <summary>
+ /// Y Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the PointF.
+ /// </remarks>
+
+ public float Y {
+ get {
+ return cy;
+ }
+ set {
+ cy = value;
+ }
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this PointF and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is PointF))
+ return false;
+
+ return (this == (PointF) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return (int) cx ^ (int) cy;
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the PointF as a string in coordinate notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1}]", cx, cy);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Rectangle.cs b/mcs/class/System.Drawing/System.Drawing/Rectangle.cs
new file mode 100644
index 00000000000..45f28755102
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Rectangle.cs
@@ -0,0 +1,584 @@
+//
+// System.Drawing.Rectangle.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct Rectangle {
+
+ // Private position and size fields.
+ private Point loc;
+ private Size sz;
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized Rectangle Structure.
+ /// </remarks>
+
+ public static readonly Rectangle Empty;
+
+ /// <summary>
+ /// Ceiling Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Rectangle structure from a RectangleF
+ /// structure by taking the ceiling of the X, Y, Width,
+ /// and Height properties.
+ /// </remarks>
+
+ public static Rectangle Ceiling (RectangleF value)
+ {
+ int x, y, w, h;
+ checked {
+ x = (int) Math.Ceiling (value.X);
+ y = (int) Math.Ceiling (value.Y);
+ w = (int) Math.Ceiling (value.Width);
+ h = (int) Math.Ceiling (value.Height);
+ }
+
+ return new Rectangle (x, y, w, h);
+ }
+
+ /// <summary>
+ /// FromLTRB Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Rectangle structure from left, top, right,
+ /// and bottom coordinates.
+ /// </remarks>
+
+ public static Rectangle FromLTRB (int left, int top,
+ int right, int bottom)
+ {
+ return new Rectangle (left, top, right - left,
+ bottom - top);
+ }
+
+ /// <summary>
+ /// Inflate Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new Rectangle by inflating an existing
+ /// Rectangle by the specified coordinate values.
+ /// </remarks>
+
+ public static Rectangle Inflate (Rectangle rect, int x, int y)
+ {
+ Rectangle r = new Rectangle (rect.Location, rect.Size);
+ r.Inflate (x, y);
+ return r;
+ }
+
+ /// <summary>
+ /// Inflate Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Inflates the Rectangle by a specified width and height.
+ /// </remarks>
+
+ public void Inflate (int width, int height)
+ {
+ Inflate (new Size (width, height));
+ }
+
+ /// <summary>
+ /// Inflate Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Inflates the Rectangle by a specified Size.
+ /// </remarks>
+
+ public void Inflate (Size sz)
+ {
+ loc -= sz;
+ Size ds = new Size (sz.Width * 2, sz.Height * 2);
+ this.sz += ds;
+ }
+
+ /// <summary>
+ /// Intersect Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new Rectangle by intersecting 2 existing
+ /// Rectangles. Returns null if there is no intersection.
+ /// </remarks>
+
+ public static Rectangle Intersect (Rectangle r1, Rectangle r2)
+ {
+ Rectangle r = new Rectangle (r1.Location, r1.Size);
+ r.Intersect (r2);
+ return r;
+ }
+
+ /// <summary>
+ /// Intersect Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Replaces the Rectangle with the intersection of itself
+ /// and another Rectangle.
+ /// </remarks>
+
+ public void Intersect (Rectangle r)
+ {
+ if (!IntersectsWith (r)) {
+ loc = Point.Empty;
+ sz = Size.Empty;
+ }
+
+ X = Math.Max (Left, r.Left);
+ Y = Math.Max (Top, r.Top);
+ Width = Math.Min (Right, r.Right) - X;
+ Height = Math.Min (Bottom, r.Bottom) - Y;
+ }
+
+ /// <summary>
+ /// Round Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Rectangle structure from a RectangleF by
+ /// rounding the X, Y, Width, and Height properties.
+ /// </remarks>
+
+ public static Rectangle Round (RectangleF value)
+ {
+ int x, y, w, h;
+ checked {
+ x = (int) Math.Round (value.X);
+ y = (int) Math.Round (value.Y);
+ w = (int) Math.Round (value.Width);
+ h = (int) Math.Round (value.Height);
+ }
+
+ return new Rectangle (x, y, w, h);
+ }
+
+ /// <summary>
+ /// Truncate Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Rectangle structure from a RectangleF by
+ /// truncating the X, Y, Width, and Height properties.
+ /// </remarks>
+
+ // LAMESPEC: Should this be floor, or a pure cast to int?
+
+ public static Rectangle Truncate (RectangleF value)
+ {
+ int x, y, w, h;
+ checked {
+ x = (int) value.X;
+ y = (int) value.Y;
+ w = (int) value.Width;
+ h = (int) value.Height;
+ }
+
+ return new Rectangle (x, y, w, h);
+ }
+
+ /// <summary>
+ /// Union Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new Rectangle from the union of 2 existing
+ /// Rectangles.
+ /// </remarks>
+
+ public static Rectangle Union (Rectangle r1, Rectangle r2)
+ {
+ return FromLTRB (Math.Min (r1.Left, r2.Left),
+ Math.Min (r1.Top, r2.Top),
+ Math.Max (r1.Right, r2.Right),
+ Math.Max (r1.Bottom, r2.Bottom));
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Rectangle objects. The return value is
+ /// based on the equivalence of the Location and Size
+ /// properties of the two Rectangles.
+ /// </remarks>
+
+ public static bool operator == (Rectangle r1, Rectangle r2)
+ {
+ return ((r1.Location == r2.Location) &&
+ (r1.Size == r2.Size));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Rectangle objects. The return value is
+ /// based on the equivalence of the Location and Size
+ /// properties of the two Rectangles.
+ /// </remarks>
+
+ public static bool operator != (Rectangle r1, Rectangle r2)
+ {
+ return ((r1.Location != r2.Location) ||
+ (r1.Size != r2.Size));
+ }
+
+
+ // -----------------------
+ // Public Constructors
+ // -----------------------
+
+ /// <summary>
+ /// Rectangle Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Rectangle from Point and Size values.
+ /// </remarks>
+
+ public Rectangle (Point loc, Size sz)
+ {
+ this.loc = loc;
+ this.sz = sz;
+ }
+
+ /// <summary>
+ /// Rectangle Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Rectangle from a specified x,y location and
+ /// width and height values.
+ /// </remarks>
+
+ public Rectangle (int x, int y, int width, int height)
+ {
+ loc = new Point (x, y);
+ sz = new Size (width, height);
+ }
+
+
+
+ /// <summary>
+ /// Bottom Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the bottom edge of the Rectangle.
+ /// Read only.
+ /// </remarks>
+
+ public int Bottom {
+ get {
+ return Y + Height;
+ }
+ }
+
+ /// <summary>
+ /// Height Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Height of the Rectangle.
+ /// </remarks>
+
+ public int Height {
+ get {
+ return sz.Height;
+ }
+ set {
+ sz.Height = value;
+ }
+ }
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if the width or height are zero. Read only.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((sz.Width == 0) || (sz.Height == 0));
+ }
+ }
+
+ /// <summary>
+ /// Left Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the left edge of the Rectangle.
+ /// Read only.
+ /// </remarks>
+
+ public int Left {
+ get {
+ return X;
+ }
+ }
+
+ /// <summary>
+ /// Location Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Location of the top-left corner of the Rectangle.
+ /// </remarks>
+
+ public Point Location {
+ get {
+ return loc;
+ }
+ set {
+ loc = value;
+ }
+ }
+
+ /// <summary>
+ /// Right Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the right edge of the Rectangle.
+ /// Read only.
+ /// </remarks>
+
+ public int Right {
+ get {
+ return X + Width;
+ }
+ }
+
+ /// <summary>
+ /// Size Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Size of the Rectangle.
+ /// </remarks>
+
+ public Size Size {
+ get {
+ return sz;
+ }
+ set {
+ sz = value;
+ }
+ }
+
+ /// <summary>
+ /// Top Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the top edge of the Rectangle.
+ /// Read only.
+ /// </remarks>
+
+ public int Top {
+ get {
+ return Y;
+ }
+ }
+
+ /// <summary>
+ /// Width Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Width of the Rectangle.
+ /// </remarks>
+
+ public int Width {
+ get {
+ return sz.Width;
+ }
+ set {
+ sz.Width = value;
+ }
+ }
+
+ /// <summary>
+ /// X Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the Rectangle.
+ /// </remarks>
+
+ public int X {
+ get {
+ return loc.X;
+ }
+ set {
+ loc.X = value;
+ }
+ }
+
+ /// <summary>
+ /// Y Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the Rectangle.
+ /// </remarks>
+
+ public int Y {
+ get {
+ return loc.Y;
+ }
+ set {
+ loc.Y = value;
+ }
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if an x,y coordinate lies within this Rectangle.
+ /// </remarks>
+
+ public bool Contains (int x, int y)
+ {
+ return ((x >= Left) && (x <= Right) &&
+ (y >= Top) && (y <= Bottom));
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a Point lies within this Rectangle.
+ /// </remarks>
+
+ public bool Contains (Point pt)
+ {
+ return Contains (pt.X, pt.Y);
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a Rectangle lies entirely within this
+ /// Rectangle.
+ /// </remarks>
+
+ public bool Contains (Rectangle rect)
+ {
+ return (rect == Intersect (this, rect));
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Rectangle and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is Rectangle))
+ return false;
+
+ return (this == (Rectangle) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return loc.GetHashCode()^sz.GetHashCode();
+ }
+
+ /// <summary>
+ /// IntersectsWith Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a Rectangle intersects with this one.
+ /// </remarks>
+
+ public bool IntersectsWith (Rectangle r)
+ {
+ return !((Left > r.Right) || (Right < r.Left) ||
+ (Top > r.Bottom) || (Bottom < r.Top));
+ }
+
+ /// <summary>
+ /// Offset Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Moves the Rectangle a specified distance.
+ /// </remarks>
+
+ public void Offset (int dx, int dy)
+ {
+ X += dx;
+ Y += dy;
+ }
+
+ /// <summary>
+ /// Offset Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Moves the Rectangle a specified distance.
+ /// </remarks>
+
+ public void Offset (Point pt)
+ {
+ loc.Offset(pt.X, pt.Y);
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the Rectangle as a string in (x,y,w,h) notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1},{2},{3}]",
+ X, Y, Width, Height);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/RectangleF.cs b/mcs/class/System.Drawing/System.Drawing/RectangleF.cs
new file mode 100644
index 00000000000..cfe4a7313ed
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/RectangleF.cs
@@ -0,0 +1,531 @@
+//
+// System.Drawing.RectangleF.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct RectangleF {
+
+ // Private position and size fields.
+ private PointF loc;
+ private SizeF sz;
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized RectangleF Structure.
+ /// </remarks>
+
+ public static readonly RectangleF Empty;
+
+
+ /// <summary>
+ /// FromLTRB Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a RectangleF structure from left, top, right,
+ /// and bottom coordinates.
+ /// </remarks>
+
+ public static RectangleF FromLTRB (float left, float top,
+ float right, float bottom)
+ {
+ return new RectangleF (left, top, right - left,
+ bottom - top);
+ }
+
+ /// <summary>
+ /// Inflate Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new RectangleF by inflating an existing
+ /// RectangleF by the specified coordinate values.
+ /// </remarks>
+
+ public static RectangleF Inflate (RectangleF r,
+ float x, float y)
+ {
+ RectangleF ir = new RectangleF (r.Location, r.Size);
+ ir.Inflate (x, y);
+ return ir;
+ }
+
+ /// <summary>
+ /// Inflate Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Inflates the RectangleF by a specified width and height.
+ /// </remarks>
+
+ public void Inflate (float width, float height)
+ {
+ Inflate (new SizeF (width, height));
+ }
+
+ /// <summary>
+ /// Inflate Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Inflates the RectangleF by a specified Size.
+ /// </remarks>
+
+ public void Inflate (SizeF sz)
+ {
+ Offset(sz.Width, sz.Height);
+ SizeF ds = new SizeF (sz.Width * 2, sz.Height * 2);
+ this.sz += ds;
+ }
+
+ /// <summary>
+ /// Intersect Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new RectangleF by intersecting 2 existing
+ /// RectangleFs. Returns null if there is no intersection.
+ /// </remarks>
+
+ public static RectangleF Intersect (RectangleF r1,
+ RectangleF r2)
+ {
+ RectangleF r = new RectangleF (r1.Location, r1.Size);
+ r.Intersect (r2);
+ return r;
+ }
+
+ /// <summary>
+ /// Intersect Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Replaces the RectangleF with the intersection of itself
+ /// and another RectangleF.
+ /// </remarks>
+
+ public void Intersect (RectangleF r)
+ {
+ if (!IntersectsWith (r)) {
+ loc = PointF.Empty;
+ sz = SizeF.Empty;
+ }
+
+ X = Math.Max (Left, r.Left);
+ Y = Math.Max (Top, r.Top);
+ Width = Math.Min (Right, r.Right) - X;
+ Height = Math.Min (Bottom, r.Bottom) - Y;
+ }
+
+ /// <summary>
+ /// Union Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a new RectangleF from the union of 2 existing
+ /// RectangleFs.
+ /// </remarks>
+
+ public static RectangleF Union (RectangleF r1, RectangleF r2)
+ {
+ return FromLTRB (Math.Min (r1.Left, r2.Left),
+ Math.Min (r1.Top, r2.Top),
+ Math.Max (r1.Right, r2.Right),
+ Math.Max (r1.Bottom, r2.Bottom));
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two RectangleF objects. The return value is
+ /// based on the equivalence of the Location and Size
+ /// properties of the two RectangleFs.
+ /// </remarks>
+
+ public static bool operator == (RectangleF r1, RectangleF r2)
+ {
+ return ((r1.Location == r2.Location) &&
+ (r1.Size == r2.Size));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two RectangleF objects. The return value is
+ /// based on the equivalence of the Location and Size
+ /// properties of the two RectangleFs.
+ /// </remarks>
+
+ public static bool operator != (RectangleF r1, RectangleF r2)
+ {
+ return ((r1.Location != r2.Location) ||
+ (r1.Size != r2.Size));
+ }
+
+ /// <summary>
+ /// Rectangle to RectangleF Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Converts a Rectangle object to a RectangleF.
+ /// </remarks>
+
+ public static implicit operator RectangleF (Rectangle r)
+ {
+ return new RectangleF (r.Location, r.Size);
+ }
+
+
+ // -----------------------
+ // Public Constructors
+ // -----------------------
+
+ /// <summary>
+ /// RectangleF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a RectangleF from PointF and SizeF values.
+ /// </remarks>
+
+ public RectangleF (PointF loc, SizeF sz)
+ {
+ this.loc = loc;
+ this.sz = sz;
+ }
+
+ /// <summary>
+ /// RectangleF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a RectangleF from a specified x,y location and
+ /// width and height values.
+ /// </remarks>
+
+ public RectangleF (float x, float y, float width, float height)
+ {
+ loc = new PointF (x, y);
+ sz = new SizeF (width, height);
+ }
+
+
+
+ /// <summary>
+ /// Bottom Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the bottom edge of the RectangleF.
+ /// Read only.
+ /// </remarks>
+
+ public float Bottom {
+ get {
+ return Y + Height;
+ }
+ }
+
+ /// <summary>
+ /// Height Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Height of the RectangleF.
+ /// </remarks>
+
+ public float Height {
+ get {
+ return sz.Height;
+ }
+ set {
+ sz.Height = value;
+ }
+ }
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if the width or height are zero. Read only.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((sz.Width == 0) || (sz.Height == 0));
+ }
+ }
+
+ /// <summary>
+ /// Left Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the left edge of the RectangleF.
+ /// Read only.
+ /// </remarks>
+
+ public float Left {
+ get {
+ return X;
+ }
+ }
+
+ /// <summary>
+ /// Location Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Location of the top-left corner of the RectangleF.
+ /// </remarks>
+
+ public PointF Location {
+ get {
+ return loc;
+ }
+ set {
+ loc = value;
+ }
+ }
+
+ /// <summary>
+ /// Right Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the right edge of the RectangleF.
+ /// Read only.
+ /// </remarks>
+
+ public float Right {
+ get {
+ return X + Width;
+ }
+ }
+
+ /// <summary>
+ /// Size Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Size of the RectangleF.
+ /// </remarks>
+
+ public SizeF Size {
+ get {
+ return sz;
+ }
+ set {
+ sz = value;
+ }
+ }
+
+ /// <summary>
+ /// Top Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the top edge of the RectangleF.
+ /// Read only.
+ /// </remarks>
+
+ public float Top {
+ get {
+ return Y;
+ }
+ }
+
+ /// <summary>
+ /// Width Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Width of the RectangleF.
+ /// </remarks>
+
+ public float Width {
+ get {
+ return sz.Width;
+ }
+ set {
+ sz.Width = value;
+ }
+ }
+
+ /// <summary>
+ /// X Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The X coordinate of the RectangleF.
+ /// </remarks>
+
+ public float X {
+ get {
+ return loc.X;
+ }
+ set {
+ loc.X = value;
+ }
+ }
+
+ /// <summary>
+ /// Y Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Y coordinate of the RectangleF.
+ /// </remarks>
+
+ public float Y {
+ get {
+ return loc.Y;
+ }
+ set {
+ loc.Y = value;
+ }
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if an x,y coordinate lies within this RectangleF.
+ /// </remarks>
+
+ public bool Contains (float x, float y)
+ {
+ return ((x >= Left) && (x <= Right) &&
+ (y >= Top) && (y <= Bottom));
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a Point lies within this RectangleF.
+ /// </remarks>
+
+ public bool Contains (PointF pt)
+ {
+ return Contains (pt.X, pt.Y);
+ }
+
+ /// <summary>
+ /// Contains Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a RectangleF lies entirely within this
+ /// RectangleF.
+ /// </remarks>
+
+ public bool Contains (RectangleF rect)
+ {
+ return (rect == Intersect (this, rect));
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this RectangleF and an object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is RectangleF))
+ return false;
+
+ return (this == (RectangleF) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return loc.GetHashCode()^sz.GetHashCode();
+ }
+
+ /// <summary>
+ /// IntersectsWith Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks if a RectangleF intersects with this one.
+ /// </remarks>
+
+ public bool IntersectsWith (RectangleF r)
+ {
+ return !((Left > r.Right) || (Right < r.Left) ||
+ (Top > r.Bottom) || (Bottom < r.Top));
+ }
+
+ /// <summary>
+ /// Offset Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Moves the RectangleF a specified distance.
+ /// </remarks>
+
+ public void Offset (float dx, float dy)
+ {
+ X += dx;
+ Y += dy;
+ }
+
+ /// <summary>
+ /// Offset Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Moves the RectangleF a specified distance.
+ /// </remarks>
+
+ public void Offset (PointF pt)
+ {
+ Offset(pt.X, pt.Y);
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the RectangleF in (x,y,w,h) notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1},{2},{3}]",
+ X, Y, Width, Height);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs b/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs
new file mode 100644
index 00000000000..c50f32b0bc3
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs
@@ -0,0 +1,29 @@
+//
+// System.Drawing.RotateFlipType .cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+using System;
+namespace System.Drawing
+{
+ public enum RotateFlipType {
+ Rotate180FlipNone = 1,
+ Rotate180FlipX = 2,
+ Rotate180FlipXY = 3,
+ Rotate180FlipY = 4,
+ Rotate270FlipNone = 5,
+ Rotate270FlipX = 6,
+ Rotate270FlipXY = 7,
+ Rotate270FlipY = 8,
+ Rotate90FlipNone = 9,
+ Rotate90FlipX = 10,
+ Rotate90FlipXY = 11,
+ Rotate90FlipY = 12,
+ RotateNoneFlipNone = 13,
+ RotateNoneFlipX = 14,
+ RotateNoneFlipXY = 15,
+ RotateNoneFlipY = 16
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/Size.cs b/mcs/class/System.Drawing/System.Drawing/Size.cs
new file mode 100644
index 00000000000..d5b56d3a453
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/Size.cs
@@ -0,0 +1,309 @@
+//
+// System.Drawing.Size.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct Size {
+
+ // Private height and width fields.
+ int wd, ht;
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized Size Structure.
+ /// </remarks>
+
+ public static readonly Size Empty;
+
+ /// <summary>
+ /// Ceiling Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Size structure from a SizeF structure by
+ /// taking the ceiling of the Width and Height properties.
+ /// </remarks>
+
+ public static Size Ceiling (SizeF value)
+ {
+ int w, h;
+ checked {
+ w = (int) Math.Ceiling (value.Width);
+ h = (int) Math.Ceiling (value.Height);
+ }
+
+ return new Size (w, h);
+ }
+
+ /// <summary>
+ /// Round Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Size structure from a SizeF structure by
+ /// rounding the Width and Height properties.
+ /// </remarks>
+
+ public static Size Round (SizeF value)
+ {
+ int w, h;
+ checked {
+ w = (int) Math.Round (value.Width);
+ h = (int) Math.Round (value.Height);
+ }
+
+ return new Size (w, h);
+ }
+
+ /// <summary>
+ /// Truncate Shared Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Produces a Size structure from a SizeF structure by
+ /// truncating the Width and Height properties.
+ /// </remarks>
+
+ public static Size Truncate (SizeF value)
+ {
+ int w, h;
+ checked {
+ w = (int) value.Width;
+ h = (int) value.Height;
+ }
+
+ return new Size (w, h);
+ }
+
+ /// <summary>
+ /// Addition Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Addition of two Size structures.
+ /// </remarks>
+
+ public static Size operator + (Size sz1, Size sz2)
+ {
+ return new Size (sz1.Width + sz2.Width,
+ sz1.Height + sz2.Height);
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Size objects. The return value is
+ /// based on the equivalence of the Width and Height
+ /// properties of the two Sizes.
+ /// </remarks>
+
+ public static bool operator == (Size sz_a, Size sz_b)
+ {
+ return ((sz_a.Width == sz_b.Width) &&
+ (sz_a.Height == sz_b.Height));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two Size objects. The return value is
+ /// based on the equivalence of the Width and Height
+ /// properties of the two Sizes.
+ /// </remarks>
+
+ public static bool operator != (Size sz_a, Size sz_b)
+ {
+ return ((sz_a.Width != sz_b.Width) ||
+ (sz_a.Height != sz_b.Height));
+ }
+
+ /// <summary>
+ /// Subtraction Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Subtracts two Size structures.
+ /// </remarks>
+
+ public static Size operator - (Size sz1, Size sz2)
+ {
+ return new Size (sz1.Width - sz2.Width,
+ sz1.Height - sz2.Height);
+ }
+
+ /// <summary>
+ /// Size to Point Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Returns a Point based on the dimensions of a given
+ /// Size. Requires explicit cast.
+ /// </remarks>
+
+ public static explicit operator Point (Size sz)
+ {
+ return new Point (sz.Width, sz.Height);
+ }
+
+ /// <summary>
+ /// Size to SizeF Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a SizeF based on the dimensions of a given
+ /// Size. No explicit cast is required.
+ /// </remarks>
+
+ public static implicit operator SizeF (Size sz)
+ {
+ return new SizeF (sz.Width, sz.Height);
+ }
+
+
+ // -----------------------
+ // Public Constructors
+ // -----------------------
+
+ /// <summary>
+ /// Size Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Size from a Point value.
+ /// </remarks>
+
+ public Size (Point pt)
+ {
+ wd = pt.X;
+ ht = pt.Y;
+ }
+
+ /// <summary>
+ /// Size Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a Size from specified dimensions.
+ /// </remarks>
+
+ public Size (int width, int height)
+ {
+ wd = width;
+ ht = height;
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if both Width and Height are zero.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((wd == 0) && (ht == 0));
+ }
+ }
+
+ /// <summary>
+ /// Width Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Width coordinate of the Size.
+ /// </remarks>
+
+ public int Width {
+ get {
+ return wd;
+ }
+ set {
+ wd = value;
+ }
+ }
+
+ /// <summary>
+ /// Height Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Height coordinate of the Size.
+ /// </remarks>
+
+ public int Height {
+ get {
+ return ht;
+ }
+ set {
+ ht = value;
+ }
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this Size and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is Size))
+ return false;
+
+ return (this == (Size) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return wd^ht;
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the Size as a string in coordinate notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1}]", wd, ht);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/SizeF.cs b/mcs/class/System.Drawing/System.Drawing/SizeF.cs
new file mode 100644
index 00000000000..1aa0155c56d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/SizeF.cs
@@ -0,0 +1,249 @@
+//
+// System.Drawing.SizeF.cs
+//
+// Author:
+// Mike Kestner (mkestner@speakeasy.net)
+//
+// (C) 2001 Mike Kestner
+//
+
+using System;
+
+namespace System.Drawing {
+
+ public struct SizeF {
+
+ // Private height and width fields.
+ float wd, ht;
+
+ // -----------------------
+ // Public Shared Members
+ // -----------------------
+
+ /// <summary>
+ /// Empty Shared Field
+ /// </summary>
+ ///
+ /// <remarks>
+ /// An uninitialized SizeF Structure.
+ /// </remarks>
+
+ public static readonly SizeF Empty;
+
+ /// <summary>
+ /// Addition Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Addition of two SizeF structures.
+ /// </remarks>
+
+ public static SizeF operator + (SizeF sz1, SizeF sz2)
+ {
+ return new SizeF (sz1.Width + sz2.Width,
+ sz1.Height + sz2.Height);
+ }
+
+ /// <summary>
+ /// Equality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two SizeF objects. The return value is
+ /// based on the equivalence of the Width and Height
+ /// properties of the two Sizes.
+ /// </remarks>
+
+ public static bool operator == (SizeF sz_a, SizeF sz_b)
+ {
+ return ((sz_a.Width == sz_b.Width) &&
+ (sz_a.Height == sz_b.Height));
+ }
+
+ /// <summary>
+ /// Inequality Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Compares two SizeF objects. The return value is
+ /// based on the equivalence of the Width and Height
+ /// properties of the two Sizes.
+ /// </remarks>
+
+ public static bool operator != (SizeF sz_a, SizeF sz_b)
+ {
+ return ((sz_a.Width != sz_b.Width) ||
+ (sz_a.Height != sz_b.Height));
+ }
+
+ /// <summary>
+ /// Subtraction Operator
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Subtracts two SizeF structures.
+ /// </remarks>
+
+ public static SizeF operator - (SizeF sz1, SizeF sz2)
+ {
+ return new SizeF (sz1.Width - sz2.Width,
+ sz1.Height - sz2.Height);
+ }
+
+ /// <summary>
+ /// SizeF to PointF Conversion
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Returns a PointF based on the dimensions of a given
+ /// SizeF. Requires explicit cast.
+ /// </remarks>
+
+ public static explicit operator PointF (SizeF sz)
+ {
+ return new PointF (sz.Width, sz.Height);
+ }
+
+
+ // -----------------------
+ // Public Constructors
+ // -----------------------
+
+ /// <summary>
+ /// SizeF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a SizeF from a PointF value.
+ /// </remarks>
+
+ public SizeF (PointF pt)
+ {
+ wd = pt.X;
+ ht = pt.Y;
+ }
+
+ /// <summary>
+ /// SizeF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a SizeF from an existing SizeF value.
+ /// </remarks>
+
+ public SizeF (SizeF sz)
+ {
+ wd = sz.Width;
+ ht = sz.Height;
+ }
+
+ /// <summary>
+ /// SizeF Constructor
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Creates a SizeF from specified dimensions.
+ /// </remarks>
+
+ public SizeF (float width, float height)
+ {
+ wd = width;
+ ht = height;
+ }
+
+ // -----------------------
+ // Public Instance Members
+ // -----------------------
+
+ /// <summary>
+ /// IsEmpty Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Indicates if both Width and Height are zero.
+ /// </remarks>
+
+ public bool IsEmpty {
+ get {
+ return ((wd == 0.0) && (ht == 0.0));
+ }
+ }
+
+ /// <summary>
+ /// Width Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Width coordinate of the SizeF.
+ /// </remarks>
+
+ public float Width {
+ get {
+ return wd;
+ }
+ set {
+ wd = value;
+ }
+ }
+
+ /// <summary>
+ /// Height Property
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Height coordinate of the SizeF.
+ /// </remarks>
+
+ public float Height {
+ get {
+ return ht;
+ }
+ set {
+ ht = value;
+ }
+ }
+
+ /// <summary>
+ /// Equals Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Checks equivalence of this SizeF and another object.
+ /// </remarks>
+
+ public override bool Equals (object o)
+ {
+ if (!(o is SizeF))
+ return false;
+
+ return (this == (SizeF) o);
+ }
+
+ /// <summary>
+ /// GetHashCode Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Calculates a hashing value.
+ /// </remarks>
+
+ public override int GetHashCode ()
+ {
+ return (int) wd ^ (int) ht;
+ }
+
+ /// <summary>
+ /// ToString Method
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Formats the SizeF as a string in coordinate notation.
+ /// </remarks>
+
+ public override string ToString ()
+ {
+ return String.Format ("[{0},{1}]", wd, ht);
+ }
+
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/StringAligment.cs b/mcs/class/System.Drawing/System.Drawing/StringAligment.cs
new file mode 100644
index 00000000000..08539bc6176
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/StringAligment.cs
@@ -0,0 +1,17 @@
+//
+// System.Drawing.StringAligment.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ public enum StringAligment {
+ Center = 1,
+ Far = 2,
+ Near = 3
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs b/mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs
new file mode 100644
index 00000000000..377894f26f6
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/StringDigitSubstitute.cs
@@ -0,0 +1,18 @@
+//
+// System.Drawing.StringDigitSubstitute.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ public enum StringDigitSubstitute {
+ National = 1,
+ None = 2,
+ Traditional = 3,
+ User = 4
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs b/mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs
new file mode 100644
index 00000000000..c323522b838
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/StringFormatFlags.cs
@@ -0,0 +1,23 @@
+//
+// System.Drawing.StringFormatFlags.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ public enum StringFormatFlags {
+ DirectionRightToLeft = 1,
+ DirectionVertical = 2,
+ DisplayFormatControl = 3,
+ FitBlackBox = 4,
+ LineLimit = 5,
+ MeasureTrailingSpaces = 6,
+ NoClip = 7,
+ NoFontFallback = 8,
+ NoWrap = 9,
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/StringTrimming.cs b/mcs/class/System.Drawing/System.Drawing/StringTrimming.cs
new file mode 100644
index 00000000000..ee4f1bb738a
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/StringTrimming.cs
@@ -0,0 +1,20 @@
+//
+// System.Drawing.StringTrimming.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ public enum StringTrimming{
+ Character = 1,
+ EllipsisCharacter = 2,
+ EllipsisPath = 3,
+ EllipsisWord = 4,
+ None = 5,
+ Word = 6
+ }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing/StringUnit.cs b/mcs/class/System.Drawing/System.Drawing/StringUnit.cs
new file mode 100644
index 00000000000..82dd42b969d
--- /dev/null
+++ b/mcs/class/System.Drawing/System.Drawing/StringUnit.cs
@@ -0,0 +1,22 @@
+//
+// System.Drawing.StringUnit.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Author: Dennis Hayes (dennish@raytek.com)
+//
+
+
+using System;
+namespace System.Drawing
+{
+ public enum StringUnit{
+ Display = 1,
+ Document = 2,
+ Em = 3,
+ Inch = 3,
+ Millimeter = 4,
+ Pixel = 5,
+ Point = 6,
+ World = 7
+ }
+}
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog b/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
new file mode 100644
index 00000000000..62c04eb1808
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog
@@ -0,0 +1,4 @@
+2001-10-31 Mike Kestner <mkestner@speakeasy.net>
+
+ * TestPoint.cs : Tests I've had in my node forever.
+
diff --git a/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs b/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs
new file mode 100644
index 00000000000..01de794dc02
--- /dev/null
+++ b/mcs/class/System.Drawing/Test/System.Drawing/TestPoint.cs
@@ -0,0 +1,159 @@
+// Tests for System.Drawing.Point.cs
+//
+// Author: Mike Kestner (mkestner@speakeasy.net)
+//
+// 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;
+ }
+ }
+
+ 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);
+ }
+}
+
+
diff --git a/mcs/class/System.Web/.cvsignore b/mcs/class/System.Web/.cvsignore
new file mode 100644
index 00000000000..d57b205f4e1
--- /dev/null
+++ b/mcs/class/System.Web/.cvsignore
@@ -0,0 +1,4 @@
+Temp.build
+*.dll
+lib
+makefile
diff --git a/mcs/class/System.Web/ChangeLog b/mcs/class/System.Web/ChangeLog
new file mode 100644
index 00000000000..6fb8d8a35cb
--- /dev/null
+++ b/mcs/class/System.Web/ChangeLog
@@ -0,0 +1,66 @@
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * System.Web -- Assembly build.
+
+ The basic runtime support is now working, we can now start working
+ on the runtime flow system (thread pool etc) and also start testing
+ the parser and control framework. (224 files are compiled)
+
+2002-03-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.Security: Removed all files. Will do it later.
+ May be someone else like to do it for the time being.
+
+2002-03-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web -- Assembly build.
+ Another milestone reached. Compiled 195 classes successfully.
+ Build includes System.Web.UI.WebControls and all the dependencies
+ for the namespace.
+
+2002-03-05 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.Security: Added directory.
+
+2002-03-04 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.UI.WebContorls: Virtually complete. See
+ System.Web.UI.WebControls/ChangeLog for a comprehensensive
+ description of what's left and where. But, don't go for
+ a build at this stage. There are a few classes left in
+ System.Web namespace that need to be filled-up, though
+ I will try to fix up the current state to be able to make
+ a build.
+
+2001-12-20 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Did first successful build of System.Web.dll that included
+ System.Web.UI.WebControls namespace. Though, not updating
+ the System.Web.build file, since with the changes that
+ followed, the build again fails :(
+
+2001-11-30 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.WebUtils: Removed
+ * System.Web.Utils : Added --- replacement of WebUtils
+
+2001-11-08 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * System.Web.WebUtils: Added directory
+
+2001-08-22 Bob Smith <bob@thestuff.net>
+
+ * Added directory: System.Web.UI.HtmlControls
+ * Added directory: Test
+
+2001-08-17 Bob Smith <bob@thestuff.net>
+
+ * Added directory: System.Web.UI
+
+2001-08-09 Bob Smith <bob@thestuff.net>
+
+ * Added directory: System.Web
+
+2001-07-20 Patrik Torstensson (Patrik.Torstensson@labs2.com)
+
+ * Added directory: System.Web.Caching
diff --git a/mcs/class/System.Web/System.Web.Caching/Cache.cs b/mcs/class/System.Web/System.Web.Caching/Cache.cs
new file mode 100644
index 00000000000..5e331aa43c4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/Cache.cs
@@ -0,0 +1,520 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Implements a cache for Web applications and other. The difference from the MS.NET implementation is that we
+ /// support to use the Cache object as cache in our applications.
+ /// </summary>
+ /// <remarks>
+ /// The Singleton cache is created per application domain, and it remains valid as long as the application domain remains active.
+ /// </remarks>
+ /// <example>
+ /// Usage of the singleton cache:
+ ///
+ /// Cache objManager = Cache.SingletonCache;
+ ///
+ /// String obj = "tobecached";
+ /// objManager.Add("kalle", obj);
+ /// </example>
+ public class Cache : System.Collections.IEnumerable, System.IDisposable
+ {
+ // Declarations
+
+ // MS.NET Does only have the cache connected to the HttpRuntime and we don't have the HttpRuntime (yet)
+ static Cache objSingletonCache = new Cache();
+
+ private bool _boolDisposed;
+
+ // Helper objects
+ private CacheExpires _objExpires;
+
+ // The data storage
+ // Todo: Make a specialized storage for the cache entries?
+ // todo: allow system to replace the storage?
+ private System.Collections.Hashtable _arrEntries;
+ private System.Threading.ReaderWriterLock _lockEntries;
+
+ static private System.TimeSpan _datetimeOneYear = System.TimeSpan.FromDays(365);
+
+ // Number of items in the cache
+ private long _longItems;
+
+ // Constructor
+ public Cache()
+ {
+ _boolDisposed = false;
+ _longItems = 0;
+
+ _lockEntries = new System.Threading.ReaderWriterLock();
+ _arrEntries = new System.Collections.Hashtable();
+
+ _objExpires = new CacheExpires(this);
+ }
+
+ // Public methods and properties
+
+ //
+ /// <summary>
+ /// Returns a static version of the cache. In MS.NET the cache is stored in the System.Web.HttpRuntime
+ /// but we keep it here as a singleton (right now anyway).
+ /// </summary>
+ public static Cache SingletonCache
+ {
+ get
+ {
+ if (objSingletonCache == null)
+ {
+ throw new System.InvalidOperationException();
+ }
+
+ return objSingletonCache;
+ }
+ }
+
+ /// <summary>
+ /// Used in the absoluteExpiration parameter in an Insert method call to indicate the item should never expire. This field is read-only.
+ /// </summary>
+ public static readonly System.DateTime NoAbsoluteExpiration = System.DateTime.MaxValue;
+
+ /// <summary>
+ /// Used as the slidingExpiration parameter in an Insert method call to disable sliding expirations. This field is read-only.
+ /// </summary>
+ public static readonly System.TimeSpan NoSlidingExpiration = System.TimeSpan.Zero;
+
+ /// <summary>
+ /// Internal method to create a enumerator and over all public items in the cache and is used by GetEnumerator method.
+ /// </summary>
+ /// <returns>Returns IDictionaryEnumerator that contains all public items in the cache</returns>
+ private System.Collections.IDictionaryEnumerator CreateEnumerator()
+ {
+ System.Collections.Hashtable objTable;
+
+ _lockEntries.AcquireReaderLock(int.MaxValue);
+ try
+ {
+ // Create a new hashtable to return as collection of public items
+ objTable = new System.Collections.Hashtable(_arrEntries.Count);
+
+ foreach(System.Collections.DictionaryEntry objEntry in _arrEntries)
+ {
+ if (objEntry.Key != null)
+ {
+ // Check if this is a public entry
+ if (((CacheEntry) objEntry.Value).TestFlag(CacheEntry.Flags.Public))
+ {
+ // Add to the collection
+ objTable.Add(objEntry.Key, ((CacheEntry) objEntry.Value).Item);
+ }
+ }
+ }
+ }
+ finally
+ {
+ _lockEntries.ReleaseReaderLock();
+ }
+
+ return objTable.GetEnumerator();
+ }
+
+ /// <summary>
+ /// Implementation of IEnumerable interface and calls the GetEnumerator that returns
+ /// IDictionaryEnumerator.
+ /// </summary>
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ /// <summary>
+ /// Virtual override of the IEnumerable.GetEnumerator() method, returns a specialized enumerator.
+ /// </summary>
+ public virtual System.Collections.IDictionaryEnumerator GetEnumerator()
+ {
+ return CreateEnumerator();
+ }
+
+ /// <summary>
+ /// Touches a object in the cache. Used to update expire time and hit count.
+ /// </summary>
+ /// <param name="strKey">The identifier for the cache item to retrieve.</param>
+ public void Touch(string strKey)
+ {
+ // Just touch the object
+ Get(strKey);
+ }
+
+ /// <summary>
+ /// Adds the specified item to the Cache object with dependencies, expiration and priority policies, and a
+ /// delegate you can use to notify your application when the inserted item is removed from the Cache.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference.</param>
+ /// <param name="absolutExpiration">The time at which the added object expires and is removed from the cache. </param>
+ /// <param name="slidingExpiration">The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed.</param>
+ /// <param name="enumPriority">The relative cost of the object, as expressed by the CacheItemPriority enumeration. The cache uses this value when it evicts objects; objects with a lower cost are removed from the cache before objects with a higher cost.</param>
+ /// <param name="enumPriorityDecay">The rate at which an object in the cache decays in importance. Objects that decay quickly are more likely to be removed.</param>
+ /// <param name="eventRemoveCallback">A delegate that, if provided, is called when an object is removed from the cache. You can use this to notify applications when their objects are deleted from the cache.</param>
+ /// <returns>The Object item added to the Cache.</returns>
+ public object Add(string strKey, object objItem, CacheDependency objDependency, System.DateTime absolutExpiration, System.TimeSpan slidingExpiration, CacheItemPriority enumPriority, CacheItemPriorityDecay enumPriorityDecay, CacheItemRemovedCallback eventRemoveCallback)
+ {
+ if (_boolDisposed)
+ {
+ throw new System.ObjectDisposedException("System.Web.Cache");
+ }
+
+ if (strKey == null)
+ {
+ throw new System.ArgumentNullException("strKey");
+ }
+
+ if (objItem == null)
+ {
+ throw new System.ArgumentNullException("objItem");
+ }
+
+ if (slidingExpiration > _datetimeOneYear)
+ {
+ throw new System.ArgumentOutOfRangeException("slidingExpiration");
+ }
+
+ CacheEntry objEntry;
+ CacheEntry objNewEntry;
+
+ long longHitRange = 10000;
+
+ // todo: check decay and make up the minHit range
+
+ objEntry = new CacheEntry(this, strKey, objItem, objDependency, eventRemoveCallback, absolutExpiration, slidingExpiration, longHitRange, true, enumPriority);
+
+ System.Threading.Interlocked.Increment(ref _longItems);
+
+ // If we have any kind of expiration add into the CacheExpires class
+ if (objEntry.HasSlidingExpiration || objEntry.HasAbsoluteExpiration)
+ {
+ // Add it to CacheExpires
+ _objExpires.Add(objEntry);
+ }
+
+ // Check and get the new item..
+ objNewEntry = UpdateCache(strKey, objEntry, true, CacheItemRemovedReason.Removed);
+
+ if (objNewEntry != null)
+ {
+ // Return added item
+ return objEntry.Item;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Inserts an item into the Cache object with a cache key to reference its location and using default values
+ /// provided by the CacheItemPriority and CacheItemPriorityDecay enumerations.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ public void Insert(string strKey, object objItem)
+ {
+ Add(strKey, objItem, null, System.DateTime.MaxValue, System.TimeSpan.Zero, CacheItemPriority.Default, CacheItemPriorityDecay.Default, null);
+ }
+
+ /// <summary>
+ /// Inserts an object into the Cache that has file or key dependencies.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference.</param>
+ public void Insert(string strKey, object objItem, CacheDependency objDependency)
+ {
+ Add(strKey, objItem, objDependency, System.DateTime.MaxValue, System.TimeSpan.Zero, CacheItemPriority.Default, CacheItemPriorityDecay.Default, null);
+ }
+
+ /// <summary>
+ /// Inserts an object into the Cache with dependencies and expiration policies.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference.</param>
+ /// <param name="absolutExpiration">The time at which the added object expires and is removed from the cache. </param>
+ /// <param name="slidingExpiration">The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed.</param>
+ public void Insert(string strKey, object objItem, CacheDependency objDependency, System.DateTime absolutExpiration, System.TimeSpan slidingExpiration)
+ {
+ Add(strKey, objItem, objDependency, absolutExpiration, slidingExpiration, CacheItemPriority.Default, CacheItemPriorityDecay.Default, null);
+ }
+
+ /// <summary>
+ /// Inserts an object into the Cache object with dependencies, expiration and priority policies, and a delegate
+ /// you can use to notify your application when the inserted item is removed from the Cache.
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference.</param>
+ /// <param name="absolutExpiration">The time at which the added object expires and is removed from the cache. </param>
+ /// <param name="slidingExpiration">The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed.</param>
+ /// <param name="enumPriority">The relative cost of the object, as expressed by the CacheItemPriority enumeration. The cache uses this value when it evicts objects; objects with a lower cost are removed from the cache before objects with a higher cost.</param>
+ /// <param name="enumPriorityDecay">The rate at which an object in the cache decays in importance. Objects that decay quickly are more likely to be removed.</param>
+ /// <param name="eventRemoveCallback">A delegate that, if provided, is called when an object is removed from the cache. You can use this to notify applications when their objects are deleted from the cache.</param>
+ public void Insert(string strKey, object objItem, CacheDependency objDependency, System.DateTime absolutExpiration, System.TimeSpan slidingExpiration, CacheItemPriority enumPriority, CacheItemPriorityDecay enumPriorityDecay, CacheItemRemovedCallback eventRemoveCallback)
+ {
+ Add(strKey, objItem, objDependency, absolutExpiration, slidingExpiration, enumPriority, enumPriorityDecay, eventRemoveCallback);
+ }
+
+ /// <summary>
+ /// Removes the specified item from the Cache object.
+ /// </summary>
+ /// <param name="strKey">The cache key for the cache item to remove.</param>
+ /// <returns>The item removed from the Cache. If the value in the key parameter is not found, returns a null reference.</returns>
+ public object Remove(string strKey)
+ {
+ return Remove(strKey, CacheItemRemovedReason.Removed);
+ }
+
+ /// <summary>
+ /// Internal method that updates the cache, decremenents the number of existing items and call close on the cache entry. This method
+ /// is also used from the ExpiresBuckets class to remove an item during GC flush.
+ /// </summary>
+ /// <param name="strKey">The cache key for the cache item to remove.</param>
+ /// <param name="enumReason">Reason why the item is removed.</param>
+ /// <returns>The item removed from the Cache. If the value in the key parameter is not found, returns a null reference.</returns>
+ internal object Remove(string strKey, CacheItemRemovedReason enumReason)
+ {
+ CacheEntry objEntry = UpdateCache(strKey, null, true, enumReason);
+
+ if (objEntry != null)
+ {
+ System.Threading.Interlocked.Decrement(ref _longItems);
+
+ // Close the cache entry (calls the remove delegate)
+ objEntry.Close(enumReason);
+
+ return objEntry.Item;
+ } else
+ {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves the specified item from the Cache object.
+ /// </summary>
+ /// <param name="strKey">The identifier for the cache item to retrieve.</param>
+ /// <returns>The retrieved cache item, or a null reference.</returns>
+ public object Get(string strKey)
+ {
+ CacheEntry objEntry = UpdateCache(strKey, null, false, CacheItemRemovedReason.Expired);
+
+ if (objEntry == null)
+ {
+ return null;
+ } else
+ {
+ return objEntry.Item;
+ }
+ }
+
+ /// <summary>
+ /// Internal method used for removing, updating and adding CacheEntries into the cache.
+ /// </summary>
+ /// <param name="strKey">The identifier for the cache item to modify</param>
+ /// <param name="objEntry">CacheEntry to use for overwrite operation, if this parameter is null and overwrite true the item is going to be removed</param>
+ /// <param name="boolOverwrite">If true the objEntry parameter is used to overwrite the strKey entry</param>
+ /// <param name="enumReason">Reason why an item was removed</param>
+ /// <returns></returns>
+ private CacheEntry UpdateCache(string strKey, CacheEntry objEntry, bool boolOverwrite, CacheItemRemovedReason enumReason)
+ {
+ if (_boolDisposed)
+ {
+ throw new System.ObjectDisposedException("System.Web.Cache", "Can't update item(s) in a disposed cache");
+ }
+
+ if (strKey == null)
+ {
+ throw new System.ArgumentNullException("System.Web.Cache");
+ }
+
+ long ticksNow = System.DateTime.Now.Ticks;
+ long ticksExpires = long.MaxValue;
+
+ bool boolGetItem = false;
+ bool boolExpiried = false;
+ bool boolWrite = false;
+ bool boolRemoved = false;
+
+ // Are we getting the item from the hashtable
+ if (boolOverwrite == false && strKey.Length > 0 && objEntry == null)
+ {
+ boolGetItem = true;
+ }
+
+ // TODO: Optimize this method, move out functionality outside the lock
+ _lockEntries.AcquireReaderLock(int.MaxValue);
+ try
+ {
+ if (boolGetItem)
+ {
+ objEntry = (CacheEntry) _arrEntries[strKey];
+ if (objEntry == null)
+ {
+ return null;
+ }
+ }
+
+ if (objEntry != null)
+ {
+ // Check if we have expired
+ if (objEntry.HasSlidingExpiration || objEntry.HasAbsoluteExpiration)
+ {
+ if (objEntry.Expires < ticksNow)
+ {
+ // We have expired, remove the item from the cache
+ boolWrite = true;
+ boolExpiried = true;
+ }
+ }
+ }
+
+ // Check if we going to modify the hashtable
+ if (boolWrite || (boolOverwrite && !boolExpiried))
+ {
+ // Upgrade our lock to write
+ System.Threading.LockCookie objCookie = _lockEntries.UpgradeToWriterLock(int.MaxValue);
+ try
+ {
+ // Check if we going to just modify an existing entry (or add)
+ if (boolOverwrite && objEntry != null)
+ {
+ _arrEntries[strKey] = objEntry;
+ }
+ else
+ {
+ // We need to remove the item, fetch the item first
+ objEntry = (CacheEntry) _arrEntries[strKey];
+ if (objEntry != null)
+ {
+ _arrEntries.Remove(strKey);
+ }
+
+ boolRemoved = true;
+ }
+ }
+ finally
+ {
+ _lockEntries.DowngradeFromWriterLock(ref objCookie);
+ }
+ }
+
+ // If the entry haven't expired or been removed update the info
+ if (!boolExpiried && !boolRemoved)
+ {
+ // Update that we got a hit
+ objEntry.Hits++;
+ if (objEntry.HasSlidingExpiration)
+ {
+ ticksExpires = ticksNow + objEntry.SlidingExpiration;
+ }
+ }
+ }
+ finally
+ {
+ _lockEntries.ReleaseLock();
+
+ }
+
+ // If the item was removed we need to remove it from the CacheExpired class also
+ if (boolRemoved)
+ {
+ if (objEntry != null)
+ {
+ 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;
+ }
+
+ // If we have sliding expiration and we have a correct hit, update the expiration manager
+ if (objEntry.HasSlidingExpiration)
+ {
+ _objExpires.Update(objEntry, ticksExpires);
+ }
+
+ // Return the cache entry
+ return objEntry;
+ }
+
+ /// <summary>
+ /// Gets the number of items stored in the cache.
+ /// </summary>
+ long Count
+ {
+ get
+ {
+ return _longItems;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the cache item at the specified key.
+ /// </summary>
+ public object this[string strKey]
+ {
+ get
+ {
+ return Get(strKey);
+ }
+
+ set
+ {
+ Insert(strKey, value);
+ }
+ }
+
+ /// <summary>
+ /// Called to close the cache when the AppDomain is closing down or the GC has decided it's time to destroy the object.
+ /// </summary>
+ public void Dispose()
+ {
+ _boolDisposed = true;
+
+ _lockEntries.AcquireReaderLock(int.MaxValue);
+ try
+ {
+ foreach(System.Collections.DictionaryEntry objEntry in _arrEntries)
+ {
+ if (objEntry.Key != null)
+ {
+ // Check if this is active
+ if ( ((CacheEntry) objEntry.Value).TestFlag(CacheEntry.Flags.Removed) )
+ {
+ try
+ {
+ ((CacheEntry) objEntry.Value).Close(CacheItemRemovedReason.Removed);
+ }
+ catch (System.Exception objException)
+ {
+ System.Diagnostics.Debug.Fail("System.Web.Cache.Dispose() Exception when closing cache entry", "Message: " + objException.Message + " Stack: " + objException.StackTrace + " Source:" + objException.Source);
+ }
+ }
+ }
+ }
+ }
+ finally
+ {
+ _lockEntries.ReleaseReaderLock();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs b/mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs
new file mode 100644
index 00000000000..d59afadc184
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheDefinitions.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Specifies the relative priority of items stored in the Cache.
+ /// </summary>
+ public enum CacheItemPriority {
+ AboveNormal,
+ BelowNormal,
+ Default,
+ High,
+ Low,
+ Normal,
+ NotRemovable
+ }
+
+ /// <summary>
+ /// Specifies the rate at which the priority of items stored in the Cache are downgraded when not accessed frequently.
+ /// </summary>
+ public enum CacheItemPriorityDecay {
+ Default,
+ Fast,
+ Medium,
+ Never,
+ Slow
+ }
+
+ /// <summary>
+ /// Specifies the reason an item was removed from the Cache.
+ /// </summary>
+ public enum CacheItemRemovedReason {
+ DependencyChanged,
+ Expired,
+ Removed,
+ Underused
+ }
+
+ /// <summary>
+ /// Defines a callback method for notifying applications when a cached item is removed from the Cache.
+ /// </summary>
+ /// <param name="key">The index location for the item removed from the cache. </param>
+ /// <param name="value">The Object item removed from the cache. </param>
+ /// <param name="reason">The reason the item was removed from the cache, as specified by the CacheItemRemovedReason enumeration.</param>
+ public delegate void CacheItemRemovedCallback(string key, object value, CacheItemRemovedReason reason);
+
+ }
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs b/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs
new file mode 100644
index 00000000000..3d0f722f098
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheDependency.cs
@@ -0,0 +1,97 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Class to handle cache dependency, right now this class is only a mookup
+ /// </summary>
+ public class CacheDependency : System.IDisposable
+ {
+ private bool _boolDisposed;
+
+ public CacheDependency()
+ {
+ _boolDisposed = false;
+ }
+
+ /// <remarks>
+ /// Added by gvaish@iitk.ac.in
+ /// </remarks>
+ [MonoTODO("Constrcutor")]
+ public CacheDependency(string filename)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <remarks>
+ /// Added by gvaish@iitk.ac.in
+ /// </remarks>
+ [MonoTODO("Constrcutor")]
+ public CacheDependency(string[] filenames, string[] cachekeys)
+ {
+ throw new NotImplementedException();
+ }
+
+ public delegate void CacheDependencyCallback(CacheDependency objDependency);
+
+ public event CacheDependencyCallback Changed;
+
+ public void OnChanged()
+ {
+ if (_boolDisposed)
+ {
+ throw new System.ObjectDisposedException("System.Web.CacheDependency");
+ }
+
+ if (Changed != null)
+ {
+ Changed(this);
+ }
+ }
+
+ public bool IsDisposed
+ {
+ get
+ {
+ return _boolDisposed;
+ }
+ }
+
+ public bool HasEvents
+ {
+ get
+ {
+ if (_boolDisposed)
+ {
+ throw new System.ObjectDisposedException("System.Web.CacheDependency");
+ }
+
+ if (Changed != null)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ public void Dispose()
+ {
+ _boolDisposed = true;
+ }
+
+ /// <summary>
+ /// Used in testing.
+ /// </summary>
+ public void Signal()
+ {
+ OnChanged();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs
new file mode 100644
index 00000000000..0943be5db30
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheEntry.cs
@@ -0,0 +1,363 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Class responsible for representing a cache entry.
+ /// </summary>
+ public class CacheEntry
+ {
+ /// <summary>
+ /// Defines the status of the current cache entry
+ /// </summary>
+ public enum Flags
+ {
+ Removed = 0,
+ Public = 1
+ }
+
+ private CacheItemPriority _enumPriority;
+
+ private long _longHits;
+
+ private byte _byteExpiresBucket;
+ private int _intExpiresIndex;
+
+ private long _ticksExpires;
+ private long _ticksSlidingExpiration;
+
+ private string _strKey;
+ private object _objItem;
+
+ private long _longMinHits;
+
+ private Flags _enumFlags;
+
+ private CacheDependency _objDependency;
+ private Cache _objCache;
+
+ /// <summary>
+ /// Constructs a new cache entry
+ /// </summary>
+ /// <param name="strKey">The cache key used to reference the item.</param>
+ /// <param name="objItem">The item to be added to the cache.</param>
+ /// <param name="objDependency">The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference.</param>
+ /// <param name="dtExpires">The time at which the added object expires and is removed from the cache. </param>
+ /// <param name="tsSpan">The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed.</param>
+ /// <param name="longMinHits">Used to detect and control if the item should be flushed due to under usage</param>
+ /// <param name="boolPublic">Defines if the item is public or not</param>
+ /// <param name="enumPriority">The relative cost of the object, as expressed by the CacheItemPriority enumeration. The cache uses this value when it evicts objects; objects with a lower cost are removed from the cache before objects with a higher cost.</param>
+ public CacheEntry( Cache objManager, string strKey, object objItem, CacheDependency objDependency, CacheItemRemovedCallback eventRemove,
+ System.DateTime dtExpires, System.TimeSpan tsSpan, long longMinHits, bool boolPublic, CacheItemPriority enumPriority )
+ {
+ if (boolPublic)
+ {
+ SetFlag(Flags.Public);
+ }
+
+ _strKey = strKey;
+ _objItem = objItem;
+ _objCache = objManager;
+
+ _onRemoved += eventRemove;
+
+ _enumPriority = enumPriority;
+
+ _ticksExpires = dtExpires.Ticks;
+
+ _ticksSlidingExpiration = tsSpan.Ticks;
+
+ // If we have a sliding expiration it overrides the absolute expiration (MS behavior)
+ if (tsSpan.Ticks != System.TimeSpan.Zero.Ticks)
+ {
+ _ticksExpires = System.DateTime.Now.AddTicks(_ticksSlidingExpiration).Ticks;
+ }
+
+ _objDependency = objDependency;
+ if (_objDependency != null)
+ {
+ if (_objDependency.IsDisposed)
+ {
+ throw new System.ObjectDisposedException("System.Web.CacheDependency");
+ }
+
+ // Add the entry to the cache dependency handler (we support multiple entries per handler)
+ _objDependency.Changed += new CacheDependency.CacheDependencyCallback(OnChanged);
+ }
+
+ _longMinHits = longMinHits;
+ }
+
+ private event CacheItemRemovedCallback _onRemoved;
+
+ public void OnChanged(CacheDependency objDependency)
+ {
+ _objCache.Remove(_strKey, CacheItemRemovedReason.DependencyChanged);
+ }
+
+ /// <summary>
+ /// Cleans up the cache entry, removes the cache dependency and calls the remove delegate.
+ /// </summary>
+ /// <param name="enumReason">The reason why the cache entry are going to be removed</param>
+ public void Close(CacheItemRemovedReason enumReason)
+ {
+ lock(this)
+ {
+ // Check if the item already is removed
+ if (TestFlag(Flags.Removed))
+ {
+ return;
+ }
+
+ SetFlag(Flags.Removed);
+
+ if (_onRemoved != null)
+ {
+ // Call the delegate to tell that we are now removing the entry
+ try
+ {
+ _onRemoved(_strKey, _objItem, enumReason);
+ }
+ catch (System.Exception objException)
+ {
+ System.Diagnostics.Debug.Fail("System.Web.CacheEntry.Close() Exception when calling remove delegate", "Message: " + objException.Message + " Stack: " + objException.StackTrace + " Source:" + objException.Source);
+ }
+ }
+
+ // If we have a dependency, remove the entry
+ if (_objDependency != null)
+ {
+ _objDependency.Changed -= new CacheDependency.CacheDependencyCallback(OnChanged);
+ if (!_objDependency.HasEvents)
+ {
+ _objDependency.Dispose();
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Tests a specific flag is set or not.
+ /// </summary>
+ /// <param name="oFlag">Flag to test agains</param>
+ /// <returns>Returns true if the flag is set.</returns>
+ public bool TestFlag(Flags oFlag)
+ {
+ lock(this)
+ {
+ if ((_enumFlags & oFlag) != 0)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Sets a specific flag.
+ /// </summary>
+ /// <param name="oFlag">Flag to set.</param>
+ public void SetFlag(Flags oFlag)
+ {
+ lock (this)
+ {
+ _enumFlags |= oFlag;
+ }
+ }
+
+ /// <summary>
+ /// Returns true if the object has minimum hit usage flushing enabled.
+ /// </summary>
+ public bool HasUsage
+ {
+ get {
+ if (_longMinHits == System.Int64.MaxValue)
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// Returns true if the entry has absolute expiration.
+ /// </summary>
+ public bool HasAbsoluteExpiration
+ {
+ get
+ {
+ if (_ticksExpires == System.DateTime.MaxValue.Ticks)
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// Returns true if the entry has sliding expiration enabled.
+ /// </summary>
+ public bool HasSlidingExpiration
+ {
+ get
+ {
+ if (_ticksSlidingExpiration == System.TimeSpan.Zero.Ticks)
+ {
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the current expires bucket the entry is active in.
+ /// </summary>
+ public byte ExpiresBucket
+ {
+ get
+ {
+ lock (this)
+ {
+ return _byteExpiresBucket;
+ }
+ }
+ set
+ {
+ lock (this)
+ {
+ _byteExpiresBucket = ExpiresBucket;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the current index in the expires bucket of the current cache entry.
+ /// </summary>
+ public int ExpiresIndex
+ {
+ get
+ {
+ lock (this)
+ {
+ return _intExpiresIndex;
+ }
+ }
+
+ set
+ {
+ lock (this)
+ {
+ _intExpiresIndex = ExpiresIndex;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the expiration of the cache entry.
+ /// </summary>
+ public long Expires
+ {
+ get
+ {
+ lock (this)
+ {
+ return _ticksExpires;
+ }
+ }
+ set
+ {
+ lock (this)
+ {
+ _ticksExpires = Expires;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets the sliding expiration value. The return value is in ticks (since 0/0-01 in 100nanosec)
+ /// </summary>
+ public long SlidingExpiration
+ {
+ get
+ {
+ return _ticksSlidingExpiration;
+ }
+ }
+
+ /// <summary>
+ /// Returns the current cached item.
+ /// </summary>
+ public object Item
+ {
+ get
+ {
+ return _objItem;
+ }
+ }
+
+ /// <summary>
+ /// Returns the current cache identifier.
+ /// </summary>
+ public string Key
+ {
+ get
+ {
+ return _strKey;
+ }
+ }
+
+ /// <summary>
+ /// Gets and sets the current number of hits on the cache entry.
+ /// </summary>
+ public long Hits
+ {
+ // todo: Could be optimized by using interlocked methods..
+ get
+ {
+ lock (this)
+ {
+ return _longHits;
+ }
+ }
+ set
+ {
+ lock (this)
+ {
+ _longHits = Hits;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Returns minimum hits for the usage flushing rutine.
+ /// </summary>
+ public long MinimumHits
+ {
+ get
+ {
+ return _longMinHits;
+ }
+ }
+
+ /// <summary>
+ /// Returns the priority of the cache entry.
+ /// </summary>
+ public CacheItemPriority Priority
+ {
+ get
+ {
+ return _enumPriority;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs
new file mode 100644
index 00000000000..a58eb5c1e69
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/CacheExpires.cs
@@ -0,0 +1,145 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Class responsible for handling time based flushing of entries in the cache. The class creates
+ /// and manages 60 buckets each holding every item that expires that minute. The bucket calculated
+ /// for an entry is one minute more than the timeout just to make sure that the item end up in the
+ /// bucket where it should be flushed.
+ /// </summary>
+ public class CacheExpires : System.IDisposable
+ {
+ static int _intFlush;
+ static long _ticksPerBucket = 600000000;
+ static long _ticksPerCycle = _ticksPerBucket * 60;
+
+ private ExpiresBucket[] _arrBuckets;
+ private System.Threading.Timer _objTimer;
+ private Cache _objManager;
+
+ /// <summary>
+ /// Constructor
+ /// </summary>
+ /// <param name="objManager">The cache manager, used when flushing items in a bucket.</param>
+ public CacheExpires(Cache objManager)
+ {
+ _objManager = objManager;
+ Initialize();
+ }
+
+ /// <summary>
+ /// Initializes the class.
+ /// </summary>
+ private void Initialize()
+ {
+ // Create one bucket per minute
+ _arrBuckets = new ExpiresBucket[60];
+
+ byte bytePos = 0;
+ do
+ {
+ _arrBuckets[bytePos] = new ExpiresBucket(bytePos, _objManager);
+ bytePos++;
+ } while (bytePos < 60);
+
+ // GC Bucket controller
+ _intFlush = System.DateTime.Now.Minute - 1;
+ _objTimer = new System.Threading.Timer(new System.Threading.TimerCallback(GarbageCleanup), null, 10000, 60000);
+ }
+
+ /// <summary>
+ /// Adds a Cache entry to the correct flush bucket.
+ /// </summary>
+ /// <param name="objEntry">Cache entry to add.</param>
+ public void Add(CacheEntry objEntry)
+ {
+ long ticksNow = System.DateTime.Now.Ticks;
+
+ lock(this)
+ {
+ // If the entry doesn't have a expires time we assume that the entry is due to expire now.
+ if (objEntry.Expires == 0)
+ {
+ objEntry.Expires = ticksNow;
+ }
+
+ _arrBuckets[GetHashBucket(objEntry.Expires)].Add(objEntry);
+ }
+ }
+
+ public void Remove(CacheEntry objEntry)
+ {
+ long ticksNow = System.DateTime.Now.Ticks;
+
+ lock(this)
+ {
+ // If the entry doesn't have a expires time we assume that the entry is due to expire now.
+ if (objEntry.Expires == 0)
+ {
+ objEntry.Expires = ticksNow;
+ }
+
+ _arrBuckets[GetHashBucket(objEntry.Expires)].Remove(objEntry);
+ }
+ }
+
+ public void Update(CacheEntry objEntry, long ticksExpires)
+ {
+ long ticksNow = System.DateTime.Now.Ticks;
+
+ lock(this)
+ {
+ // If the entry doesn't have a expires time we assume that the entry is due to expire now.
+ if (objEntry.Expires == 0)
+ {
+ objEntry.Expires = ticksNow;
+ }
+
+ _arrBuckets[GetHashBucket(objEntry.Expires)].Update(objEntry, ticksExpires);
+ }
+ }
+
+ public void GarbageCleanup(object State)
+ {
+ ExpiresBucket objBucket;
+
+ lock(this)
+ {
+ // Do cleanup of the bucket
+ objBucket = _arrBuckets[(++_intFlush) % 60];
+ }
+
+ // Flush expired items in the current bucket (defined by _intFlush)
+ objBucket.FlushExpiredItems();
+ }
+
+ private int GetHashBucket(long ticks)
+ {
+ // Get bucket to add expire item into, add one minute to the bucket just to make sure that we get it in the bucket gc
+ return (int) (((((ticks + 60000) % _ticksPerCycle) / _ticksPerBucket) + 1) % 60);
+ }
+
+ /// <summary>
+ /// Called by the cache for cleanup.
+ /// </summary>
+ public void Dispose()
+ {
+ lock(this)
+ {
+ // Cleanup the internal timer
+ if (_objTimer != null)
+ {
+ _objTimer.Dispose();
+ _objTimer = null;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Caching/ChangeLog b/mcs/class/System.Web/System.Web.Caching/ChangeLog
new file mode 100644
index 00000000000..616d7b40f9c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/ChangeLog
@@ -0,0 +1,12 @@
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * CacheDependency.cs: Some unimplemented methods to make build
+
+2001-07-20 Patrik Torstensson (Patrik.Torstensson@labs2.com)
+
+ * Cache.cs: Implemented. (90% ready)
+ * CacheDefinitions.cs: Implemented.
+ * CacheDependency.cs: Added. (20% ready)
+ * CacheExpires: Implemented.
+ * CacheEntry.cs: Implemented. (95% ready, going to be changed due to CacheDependecy support)
+ * ExpiresBuckets.cs: Implemented.
diff --git a/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs
new file mode 100644
index 00000000000..b5b877d455d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Caching/ExpiresBuckets.cs
@@ -0,0 +1,253 @@
+//
+// System.Web.Caching
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+// (C) Copyright Patrik Torstensson, 2001
+//
+namespace System.Web.Caching
+{
+ /// <summary>
+ /// Responsible for holding a cache entry in the linked list bucket.
+ /// </summary>
+ public struct ExpiresEntry
+ {
+ public CacheEntry _objEntry;
+ public long _ticksExpires;
+ public int _intNext;
+ }
+
+ /// <summary>
+ /// Holds cache entries that has a expiration in a bucket list.
+ /// </summary>
+ public class ExpiresBucket
+ {
+ private static int MIN_ENTRIES = 16;
+
+ private byte _byteID;
+ private int _intSize;
+ private int _intCount;
+ private int _intNext;
+
+ private Cache _objManager;
+
+ private ExpiresEntry [] _arrEntries;
+
+ /// <summary>
+ /// Constructs a new bucket.
+ /// </summary>
+ /// <param name="bucket">Current bucket ID.</param>
+ /// <param name="objManager">Cache manager reponsible for the item(s) in the expires bucket.</param>
+ public ExpiresBucket(byte bucket, Cache objManager)
+ {
+ _objManager = objManager;
+ Initialize(bucket);
+ }
+
+ /// <summary>
+ /// Initializes the expires bucket, creates a linked list of MIN_ENTRIES.
+ /// </summary>
+ /// <param name="bucket">Bucket ID.</param>
+ private void Initialize(byte bucket)
+ {
+ _byteID = bucket;
+ _intNext = 0;
+ _intCount = 0;
+
+ _arrEntries = new ExpiresEntry[MIN_ENTRIES];
+ _intSize = MIN_ENTRIES;
+
+ int intPos = 0;
+ do
+ {
+ _arrEntries[intPos]._intNext = intPos + 1;
+ _arrEntries[intPos]._ticksExpires = System.DateTime.MaxValue.Ticks;
+
+ intPos++;
+ } while (intPos < _intSize);
+
+ _arrEntries[_intSize - 1]._intNext = -1;
+ }
+
+ /// <summary>
+ /// Expands the bucket linked array list.
+ /// </summary>
+ private void Expand()
+ {
+ ExpiresEntry [] arrData;
+ int intPos = 0;
+ int intOldSize;
+
+ lock(this)
+ {
+ intOldSize = _intSize;
+ _intSize *= 2;
+
+ // Create a new array and copy the old data into the new array
+ arrData = new ExpiresEntry[_intSize];
+ do
+ {
+ arrData[intPos] = _arrEntries[intPos];
+ intPos++;
+ } while (intPos < intOldSize);
+
+ _intNext = intPos;
+
+ // Initialize the "new" positions.
+ do
+ {
+ arrData[intPos]._intNext = intPos + 1;
+ intPos++;
+ } while (intPos < _intSize);
+
+ arrData[_intSize - 1]._intNext = -1;
+
+ _arrEntries = arrData;
+ }
+ }
+
+ /// <summary>
+ /// Adds a cache entry into the expires bucket.
+ /// </summary>
+ /// <param name="objEntry">Cache Entry object to be added.</param>
+ public void Add(CacheEntry objEntry)
+ {
+ if (_intNext == -1)
+ {
+ Expand();
+ }
+
+ lock(this)
+ {
+ _arrEntries[_intNext]._ticksExpires = objEntry.Expires;
+ _arrEntries[_intNext]._objEntry = objEntry;
+
+ _intNext = _arrEntries[_intNext]._intNext;
+
+ _intCount++;
+ }
+ }
+
+ /// <summary>
+ /// Removes a cache entry from the expires bucket.
+ /// </summary>
+ /// <param name="objEntry">Cache entry to be removed.</param>
+ public void Remove(CacheEntry objEntry)
+ {
+ lock(this)
+ {
+ // Check if this is our bucket
+ if (objEntry.ExpiresIndex != _byteID) return;
+ if (objEntry.ExpiresIndex == System.Int32.MaxValue) return;
+ if (_arrEntries.Length < objEntry.ExpiresIndex) return;
+
+ _intCount--;
+
+ _arrEntries[objEntry.ExpiresIndex]._objEntry.ExpiresBucket = byte.MaxValue;
+ _arrEntries[objEntry.ExpiresIndex]._objEntry.ExpiresIndex = int.MaxValue;
+ _arrEntries[objEntry.ExpiresIndex]._objEntry = null;
+ _intNext = _arrEntries[objEntry.ExpiresIndex]._intNext;
+ }
+ }
+
+ /// <summary>
+ /// Updates a cache entry in the expires bucket, this is called during a hit of an item if the
+ /// cache item has a sliding expiration. The function is responsible for updating the cache
+ /// entry.
+ /// </summary>
+ /// <param name="objEntry">Cache entry to update.</param>
+ /// <param name="ticksExpires">New expiration value for the cache entry.</param>
+ public void Update(CacheEntry objEntry, long ticksExpires)
+ {
+ lock(this)
+ {
+ // Check if this is our bucket
+ if (objEntry.ExpiresIndex != _byteID) return;
+ if (objEntry.ExpiresIndex == System.Int32.MaxValue) return;
+ if (_arrEntries.Length < objEntry.ExpiresIndex) return;
+
+ _arrEntries[objEntry.ExpiresIndex]._ticksExpires = ticksExpires;
+ _arrEntries[objEntry.ExpiresIndex]._objEntry.Expires = ticksExpires;
+ }
+ }
+
+ /// <summary>
+ /// Flushes all cache entries that has expired and removes them from the cache manager.
+ /// </summary>
+ public void FlushExpiredItems()
+ {
+ ExpiresEntry objEntry;
+ CacheEntry [] arrCacheEntries;
+
+ int intCachePos;
+ int intPos;
+ long ticksNow;
+
+ ticksNow = System.DateTime.Now.Ticks;
+
+ intCachePos = 0;
+
+ // Lookup all items that needs to be removed, this is done in a two part
+ // operation to minimize the locking time.
+ lock (this)
+ {
+ arrCacheEntries = new CacheEntry[_intSize];
+
+ intPos = 0;
+ do
+ {
+ objEntry = _arrEntries[intPos];
+ if (objEntry._objEntry != null)
+ {
+ if (objEntry._ticksExpires < ticksNow)
+ {
+ arrCacheEntries[intCachePos++] = objEntry._objEntry;
+
+ objEntry._objEntry.ExpiresBucket = byte.MaxValue;
+ objEntry._objEntry.ExpiresIndex = int.MaxValue;
+ objEntry._objEntry = null;
+ _intNext = objEntry._intNext;
+ }
+ }
+
+ intPos++;
+ } while (intPos < _intSize);
+ }
+
+ // If we have any entries to remove, go ahead and call the cache manager remove.
+ if (intCachePos > 0)
+ {
+ intPos = 0;
+ do
+ {
+ _objManager.Remove(arrCacheEntries[intPos].Key, CacheItemRemovedReason.Expired);
+
+ intPos++;
+ } while (intPos < intCachePos);
+ }
+ }
+
+ /// <summary>
+ /// Returns the current size of the expires bucket.
+ /// </summary>
+ public int Size
+ {
+ get
+ {
+ return _arrEntries.Length;
+ }
+ }
+
+ /// <summary>
+ /// Returns number of items in the bucket.
+ /// </summary>
+ public int Count
+ {
+ get
+ {
+ return _intCount;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs b/mcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs
new file mode 100755
index 00000000000..1bc1d9e9a36
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/AuthenticationMode.cs
@@ -0,0 +1,19 @@
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+
+namespace System.Web.Configuration {
+
+ /// <summary>
+ /// Defines the AuthenticationMode for a Web Application.
+ /// </summary>
+ public enum AuthenticationMode{
+ Forms,
+ None,
+ Passport,
+ Windows
+ }
+
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs b/mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs
new file mode 100644
index 00000000000..d30affc8f2d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/ClientTargetSectionHandler.cs
@@ -0,0 +1,44 @@
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+using System;
+using System.Configuration;
+
+namespace System.Web.Configuration
+{
+ /// <summary>
+ /// Summary description for ClientTargetSectionHandler.
+ /// </summary>
+ public class ClientTargetSectionHandler: NameValueSectionHandler
+ {
+ /// <summary>
+ /// ClientTargetSectionHandler Constructor
+ /// </summary>
+ public ClientTargetSectionHandler(){}
+
+ /// <summary>
+ /// Gets the name of the key in the key-value pair.
+ /// </summary>
+ protected override string KeyAttributeName
+ {
+ get
+ {
+ return "alias";
+ }
+ }
+
+ /// <summary>
+ /// Gets the value for the key in the key-value pair.
+ /// </summary>
+ protected override string ValueAttributeName
+ {
+ get
+ {
+ return "userAgent";
+ }
+ }
+
+ }
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs b/mcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs
new file mode 100755
index 00000000000..ff416bc6ebc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/FormsAuthPasswordFormat.cs
@@ -0,0 +1,18 @@
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+
+namespace System.Web.Configuration {
+
+ /// <summary>
+ /// Defines the password encryption format.
+ /// </summary>
+ public enum FormsAuthPasswordFormat{
+ Clear,
+ MD5,
+ SHA1
+ }
+
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs b/mcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs
new file mode 100755
index 00000000000..e94950e067e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Configuration/FormsProtectionEnum.cs
@@ -0,0 +1,19 @@
+/* System.Web.Configuration
+ * Authors:
+ * Leen Toelen (toelen@hotmail.com)
+ * Copyright (C) 2001 Leen Toelen
+*/
+
+namespace System.Web.Configuration {
+
+ /// <summary>
+ /// Defines the method used for securing web forms.
+ /// </summary>
+ public enum FormsProtectionEnum{
+ All,
+ Encryption,
+ None,
+ Validation
+ }
+
+} //namespace System.Web.Configuration
diff --git a/mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs b/mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs
new file mode 100644
index 00000000000..7cf5b14a9c1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/AppDomainFactory.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.Hosting.AppDomainFactory.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+
+namespace System.Web.Hosting
+{
+ public sealed class AppDomainFactory : IAppDomainFactory
+ {
+ public AppDomainFactory();
+ public object Create(string module, string typeName, string appId, string appPath, string strUrlOfAppOrigin, int iZone);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs b/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
new file mode 100644
index 00000000000..c447a3658e1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
@@ -0,0 +1,33 @@
+//
+// System.Web.Hosting.ApplicationHost
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (class signature from Bob Smith <bob@thestuff.net> (C) )
+//
+
+using System;
+using System.Runtime.Remoting;
+
+namespace System.Web.Hosting {
+ public sealed class ApplicationHost {
+ [MonoTODO("object CreateApplicationHost() Implement (dummy implementation right now)")]
+ public static object CreateApplicationHost(Type HostType, string VirtualPath, string PhysicalPath) {
+ // Construct and own AppDomain via DomainFactory? Can be good to have control over the web appdomain
+ // Dummy impl: just return a init object..
+
+ // TODO: Save in the created app domain....
+ System.Threading.Thread.GetDomain().SetData(".ASP.Net.App.VirtualPath", VirtualPath);
+ System.Threading.Thread.GetDomain().SetData(".ASP.Net.App.Path", PhysicalPath);
+
+ // TODO: Set to the install path of the runtime engine....
+ System.Threading.Thread.GetDomain().SetData(".ASP.Net.App.InstallPath", "");
+
+ // TODO: Create a name and id for the application...
+ // TODO: Copy all of the domain info to our new domain
+
+ ObjectHandle obj = System.Threading.Thread.GetDomain().CreateInstance(HostType.Module.Assembly.FullName, HostType.FullName);
+ return obj.Unwrap();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Hosting/ChangeLog b/mcs/class/System.Web/System.Web.Hosting/ChangeLog
new file mode 100644
index 00000000000..31f38df52c3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/ChangeLog
@@ -0,0 +1,13 @@
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * ApplicationHost.cs: Test implementation to support testing.
+ * SimpleWorkerRequest.cs: Rewrite and a almost full implementation.
+
+2001-08-30 Bob Smith <bob@thestuff.net>
+
+ * AppDomainFactory.cs: Stubbed.
+ * ApplicationHost.cs: Stubbed.
+ * IAppDomainFactory.cs: Stubbed.
+ * IISAPIRuntime.cs: Stubbed.
+ * ISAPIRuntime.cs: Implemented.
+ * SimpleWorkerRequest.cs: Implemented.
diff --git a/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs b/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs
new file mode 100644
index 00000000000..1317ccc6c54
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IAppDomainFactory.cs
@@ -0,0 +1,18 @@
+//
+// System.Web.Hosting.IAppDomainFactory.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+
+namespace System.Web.Hosting
+{
+ public interface IAppDomainFactory
+ {
+ 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
new file mode 100644
index 00000000000..bad6cc4ef80
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/IISAPIRuntime.cs
@@ -0,0 +1,21 @@
+//
+// System.Web.Hosting.IISAPIRuntime.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+
+namespace System.Web.Hosting
+{
+ public interface IISAPIRuntime
+ {
+ void DoGCCollect();
+ int ProcessRequest(in IntPtr ecb, in int useProcessModel);
+ void StartProcessing();
+ void StopProcessing();
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs b/mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs
new file mode 100644
index 00000000000..c419344ad25
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/ISAPIRuntime.cs
@@ -0,0 +1,22 @@
+//
+// System.Web.Hosting.ISAPIRuntime.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+
+namespace System.Web.Hosting
+{
+ public sealed class ISAPIRuntime : IISAPIRuntime
+ {
+ public ISAPIRuntime();
+ public void DoGCCollect();
+ public int ProcessRequest(IntPtr ecb, int iWRType);
+ public void StartProcessing();
+ public void StopProcessing();
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
new file mode 100644
index 00000000000..7793e189eef
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
@@ -0,0 +1,231 @@
+//
+// System.Web.Hosting
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (class signature from Bob Smith <bob@thestuff.net> (C) )
+//
+using System;
+using System.IO;
+using System.Text;
+
+namespace System.Web.Hosting {
+ [MonoTODO("Implement security demands on the path usage functions (and review)")]
+ public class SimpleWorkerRequest : HttpWorkerRequest {
+ private string _Page;
+ private string _Query;
+ private string _PathInfo;
+ private string _AppVirtualPath;
+ private string _AppPhysicalPath;
+ private string _AppInstallPath;
+ private TextWriter _Output;
+ private bool _HasInstallInfo;
+
+ private SimpleWorkerRequest() {
+ }
+
+ public SimpleWorkerRequest(string Page, string Query, TextWriter Output) {
+ _Page = Page;
+ _Query = Query;
+
+ _AppVirtualPath = System.Threading.Thread.GetDomain().GetData(".ASP.Net.App.VirtualPath").ToString();
+ _AppInstallPath = AppDomain.CurrentDomain.GetData(".ASP.Net.App.InstallPath").ToString();
+ _AppPhysicalPath = CheckAndAddSlash(AppDomain.CurrentDomain.GetData(".ASP.Net.App.Path").ToString());
+
+ _Output = Output;
+
+ if (_AppPhysicalPath == null) {
+ // needs to be in a initialized app domain
+ throw new HttpException("Invalid app domain");
+ }
+
+ _HasInstallInfo = true;
+ }
+
+ public SimpleWorkerRequest(string AppVirtualPath, string AppPhysicalPath, string Page, string Query, TextWriter Output) {
+ if (AppDomain.CurrentDomain.GetData(".ASP.Net.App.Path") == null) {
+ // needs to be in a initialized app domain
+ throw new HttpException("Invalid app domain");
+ }
+
+ _Page = Page;
+ _Query = Query;
+ _AppVirtualPath = AppVirtualPath;
+ _AppPhysicalPath = CheckAndAddSlash(AppPhysicalPath);
+ _Output = Output;
+
+ _HasInstallInfo = true;
+ }
+
+ [MonoTODO("Implement security")]
+ public override string MachineInstallDirectory {
+ get {
+ if (_HasInstallInfo) {
+ return _AppInstallPath;
+ }
+
+ return null;
+ }
+ }
+
+ [MonoTODO("Get config path from Web.Config class")]
+ public override string MachineConfigPath {
+ get {
+ return MachineConfigPath;
+ }
+ }
+
+ public override void EndOfRequest() {
+ }
+
+ public override void FlushResponse(bool finalFlush) {
+ _Output.Flush();
+ }
+
+ public override string GetAppPath() {
+ return _AppVirtualPath;
+ }
+
+ [MonoTODO("Implement security")]
+ public override string GetAppPathTranslated() {
+ return _AppPhysicalPath;
+ }
+
+ public override string GetFilePath() {
+ return CreatePath(false);
+ }
+
+ [MonoTODO("Implement security")]
+ public override string GetFilePathTranslated() {
+ return _AppPhysicalPath + _Page.Replace('/', '\\');
+ }
+
+ public override string GetHttpVerbName() {
+ return "GET";
+ }
+
+ public override string GetHttpVersion() {
+ return "HTTP/1.0";
+ }
+
+ public override string GetLocalAddress() {
+ return "127.0.0.1";
+ }
+
+ public override int GetLocalPort() {
+ return 80;
+ }
+
+ [MonoTODO("Implement security")]
+ public override string GetPathInfo() {
+ if (null != _PathInfo) {
+ return _PathInfo;
+ }
+
+ return System.String.Empty;
+ }
+
+ public override string GetQueryString() {
+ return _Query;
+ }
+
+ public override string GetRawUrl() {
+ if (null != _Query && _Query.Length > 0) {
+ return CreatePath(true) + "?" + _Query;
+ }
+
+ return CreatePath(true);
+ }
+
+ public override string GetRemoteAddress() {
+ return "127.0.0.1";
+ }
+
+ public override int GetRemotePort() {
+ return 0;
+ }
+
+ public override string GetServerVariable(string name) {
+ return System.String.Empty;
+ }
+
+ public override string GetUriPath() {
+ return CreatePath(true);
+ }
+
+ public override IntPtr GetUserToken() {
+ return System.IntPtr.Zero;
+ }
+
+ public override string MapPath(string path) {
+ string sPath = _AppPhysicalPath.Substring(0, _AppPhysicalPath.Length - 1);
+ if (path != null && path.Length > 0 && path != "/") {
+ return sPath;
+ }
+
+ if (path.StartsWith(_AppVirtualPath)) {
+ return sPath + path.Substring(_AppVirtualPath.Length).Replace('/', '\\');
+ }
+
+ return null;
+ }
+
+ public override void SendKnownResponseHeader(int index, string value) {
+ }
+
+ public override void SendResponseFromFile(IntPtr handle, long offset, long length) {
+ }
+
+ public override void SendResponseFromFile(string filename, long offset, long length) {
+ }
+
+ public override void SendResponseFromMemory(byte[] data, int length) {
+ _Output.Write(Encoding.Default.GetChars(data, 0, length));
+ }
+
+ public override void SendStatus(int statusCode, string statusDescription) {
+ }
+
+ public override void SendUnknownResponseHeader(string name, string value) {
+ }
+
+ // Create's a path string
+ private string CheckAndAddSlash(string sPath) {
+ if (null == sPath) {
+ return null;
+ }
+
+ if (!sPath.EndsWith("\\")) {
+ return sPath + "\\";
+ }
+
+ return sPath;
+ }
+
+ // Create's a path string
+ private string CreatePath(bool bIncludePathInfo) {
+ string sPath;
+
+ if ("/" == _AppVirtualPath) {
+ sPath = _AppVirtualPath + "/" + _Page;
+ } else {
+ sPath = "/" + _Page;
+ }
+
+ if (bIncludePathInfo && null != _PathInfo) {
+ return sPath + _PathInfo;
+ }
+
+ return sPath;
+ }
+
+ // Parses out the string after / know as the "path info"
+ private void ParsePathInfo() {
+ int iPos = _Page.IndexOf("/");
+ if (iPos >= 0) {
+ _PathInfo = _Page.Substring(iPos);
+ _Page = _Page.Substring(0, iPos);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
new file mode 100644
index 00000000000..dd2611fb84f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/ChangeLog
@@ -0,0 +1,10 @@
+2001-09-03 Leen Toelen <toelen@hotmail.com>
+
+ * HtmlAnchor.cs: Initial implementation.
+ * HtmlTextArea.cs: Initial implementation.
+
+2001-08-22 Bob Smith <bob@thestuff.net>
+
+ * HtmlContainerControl.cs: Initial implementation.
+ * HtmlControl.cs: Initial implementation.
+ * HtmlGenericControl.cs: Initial implementation.
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
new file mode 100644
index 00000000000..8d8a4787198
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlAnchor.cs
@@ -0,0 +1,99 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlAnchor : HtmlContainerControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick;
+
+ static HtmlAnchor(){
+ EventServerClick = new Object();
+ }
+
+ public HtmlAnchor(): base("a"){}
+
+ protected virtual void OnServerClick(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerClick];
+ if(handler != null) handler.Invoke(this, e);
+ }
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ if ( Events[EventServerClick] != null){
+ Attributes.Remove("href");
+ base.RenderAttributes(writer);
+ writer.WriteAttribute("href", Page.GetPostBackClientHyperlink(this,String.Empty));
+ }
+ else{
+ PreProcessRelativeReference(writer,"href");
+ RenderAttributes(writer);
+ }
+ }
+
+ void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument){
+ OnServerClick(EventArgs.Empty);
+ }
+
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ public string HRef{
+ get{
+ string attr = Attributes["href"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["href"] = AttributeToString(value);
+ }
+ }
+
+ public string Name{
+ get{
+ string attr = Attributes["name"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["name"] = AttributeToString(value);
+ }
+ }
+
+ public string Target{
+ get{
+ string attr = Attributes["target"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["target"] = AttributeToString(value);
+ }
+ }
+
+ public string Title{
+ get{
+ string attr = Attributes["title"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["title"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlAnchor
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
new file mode 100644
index 00000000000..640daf02fef
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlButton.cs
@@ -0,0 +1,74 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlButton : HtmlContainerControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick;
+
+ //Checked
+ static HtmlButton(){
+ EventServerClick = new Object();
+ }
+ //Checked
+ public HtmlButton(): base("button"){}
+
+ //Checked
+ protected virtual void OnServerClick(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerClick];
+ if(handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ if (Page != null && Events[EventServerClick] != null){
+ WriteOnClickAttribute(
+ writer,
+ false,
+ true,
+ CausesValidation == false? Page.Validators.Count > 0: false);
+ }
+ base.RenderAttributes(writer);
+ }
+
+ void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument){
+ if (CausesValidation){
+ Page.Validate();
+ }
+ OnServerClick(EventArgs.Empty);
+ }
+
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ public bool CausesValidation{
+ get{
+ object attr = ViewState["CausesValidation"];
+ if (attr != null){
+ return (Boolean) attr;
+ }
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ } // class HtmlButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
new file mode 100644
index 00000000000..41f3b8046c8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlContainerControl.cs
@@ -0,0 +1,83 @@
+//
+// System.Web.UI.HtmlControls.HtmlContainerControl.cs
+//
+// Author
+ // Bob Smith <bob@thestuff.net>
+ //
+ // (C) Bob Smith
+ //
+
+ using System;
+ using System.Web;
+ using System.Web.UI;
+
+ //LAMESPEC: The dox talk about HttpException but are very ambigious.
+ //TODO: Check to see if Render really is overridden instead of a LiteralControl being added. It apears that this is the
+ //case due to testing. Anything inside the block is overwritten by the content of this control, so it doesnt apear
+ //to do anything with children.
+ // a doc references this. add? protected override ControlCollection CreateControlCollection();
+
+ //TODO: If Test.InnerText = Test.InnerHtml without ever assigning anything into InnerHtml, you get this:
+ // Exception Details: System.Web.HttpException: Cannot get inner content of Message because the contents are not literal.
+ //[HttpException (0x80004005): Cannot get inner content of Message because the contents are not literal.]
+ // System.Web.UI.HtmlControls.HtmlContainerControl.get_InnerHtml() +278
+ // ASP.test3_aspx.AnchorBtn_Click(Object Source, EventArgs E) in \\genfs2\www24\bobsmith11\test3.aspx:6
+ // System.Web.UI.HtmlControls.HtmlAnchor.OnServerClick(EventArgs e) +108
+ // System.Web.UI.HtmlControls.HtmlAnchor.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +26
+ // System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
+ // System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +149
+ // System.Web.UI.Page.ProcessRequestMain() +660
+
+
+ namespace System.Web.UI.HtmlControls
+ {
+ public abstract class HtmlContainerControl : HtmlControl{
+
+ private string _innerHtml = String.Empty;
+ private string _innerText = String.Empty;
+ private bool _doText = false;
+ private bool _doChildren = true;
+ protected string _tagName;
+
+ public HtmlContainerControl() : base(){}
+
+ public HtmlContainerControl(string tag) : base(tag) {}
+
+ public virtual string InnerHtml
+ {
+ get
+ {
+ return _innerHtml;
+ }
+ set
+ {
+ _innerHtml = value;
+ _doText = false;
+ _doChildren = false;
+ }
+ }
+
+ public virtual string InnerText
+ {
+ get
+ {
+ return _innerText;
+ }
+ set
+ {
+ _innerText = value;
+ _doText = true;
+ _doChildren = false;
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ if(_doChildren) RenderChildren(writer);
+ else if(_doText) Page.Server.HtmlEncode(_innerText, writer);
+ else writer.Write(_innerHtml);
+ }
+
+ protected virtual void RenderEndTag(HtmlTextWriter writer){}
+ }
+ }
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
new file mode 100644
index 00000000000..e188605050b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlControl.cs
@@ -0,0 +1,138 @@
+//
+// System.Web.UI.HtmlControls.HtmlControl.cs
+//
+// Author
+// Bob Smith <bob@thestuff.net>
+//
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ public abstract class HtmlControl : Control, IAttributeAccessor
+ {
+ private string _tagName = "span";
+ //TODO: Is this correct, or is the StateBag really the ViewState?
+ private AttributeCollection _attributes = new AttributeCollection(new StateBag(true));
+ private bool _disabled = false;
+
+ public HtmlControl(){}
+
+ public HtmlControl(string tag)
+ {
+ if(tag != null && tag != String.Empty) _tagName = tag;
+ }
+
+ internal static string AttributeToString(int n){
+ if (n != -1)return n.ToString(NumberFormatInfo.InvariantInfo);
+ return null;
+ }
+
+ internal static string AttributeToString(string s){
+ if (s != null && s.Length != 0) return s;
+ return null;
+ }
+
+ internal void PreProcessRelativeReference(HtmlTextWriter writer, string attribName){
+ string attr = Attributes[attribName];
+ if (attr != null){
+ if (attr.Length != 0){
+ try{
+ attr = ResolveUrl(attr);
+ }
+ catch (Exception e) {
+ throw new HttpException(attribName + " property had malformed url");
+ }
+ writer.WriteAttribute(attribName, attr);
+ Attributes.Remove(attribName);
+ }
+ }
+ }
+
+ string System.Web.UI.IAttributeAccessor.GetAttribute(string name){
+ return Attributes[name];
+ }
+
+ void System.Web.UI.IAttributeAccessor.SetAttribute(string name, string value){
+ Attributes[name] = value;
+ }
+
+ protected virtual void RenderAttributes(HtmlTextWriter writer){
+ if (ID != null){
+ writer.WriteAttribute("id",ClientID);
+ }
+ Attributes.Render(writer);
+ }
+
+ internal static void WriteOnClickAttribute(HtmlTextWriter writer, bool submitsAutomatically, bool submitsProgramatically, bool causesValidation) {
+ string local1;
+ string local2;
+ string local3;
+
+ AttributeCollection attr = Attributes;
+ local1 = null;
+ if (submitsAutomatically) {
+ if ((causesValidation))
+ local1 = System.Web.UI.Utils.GetClientValidateEvent(Page);
+ }
+ else if (submitsProgramatically) {
+ if (causesValidation)
+ local1 = System.Web.UI.Utils.GetClientValidatedPostback(this);
+ else
+ local1 = Page.GetPostBackClientEvent(this, String.Empty);
+ }
+ if (local1 != null) {
+ local2 = attr["language"];
+ if (local2 != null)
+ attr.Remove("language");
+ writer.WriteAttribute("language", "javascript");
+ local3 = attr["onclick"];
+ if (local3 != null) {
+ attr.Remove("onclick");
+ writer.WriteAttribute("onclick", local3 + " " + local1);
+ return;
+ }
+ writer.WriteAttribute("onclick", local1);
+ }
+ }
+
+ public AttributeCollection Attributes
+ {
+ get
+ {
+ return _attributes;
+ }
+ }
+ public bool Disabled
+ {
+ get
+ {
+ return _disabled;
+ }
+ set
+ {
+ _disabled = value;
+ }
+ }
+ public CssStyleCollection Style
+ {
+ get
+ {
+ return _attributes.CssStyle;
+ }
+ }
+ public virtual string TagName
+ {
+ get
+ {
+ return _tagName;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
new file mode 100644
index 00000000000..e4c1a817e17
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs
@@ -0,0 +1,152 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlForm : HtmlContainerControl{
+
+ private static string SmartNavIncludeScriptKey = "SmartNavIncludeScript";
+
+ public HtmlForm(): base("form"){}
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name",RenderedName);
+ Attributes.Remove("name");
+ writer.WriteAttribute("method",Method);
+ Attributes.Remove("method");
+ writer.WriteAttribute("action",Action,true);
+ Attributes.Remove("action");
+
+ string clientOnSubmit = Page.ClientOnSubmitEvent;
+ if (clientOnSubmit != null && clientOnSubmit.Length > 0){
+ if (Attributes["onsubmit"] != null){
+ clientOnSubmit = String.Concat(clientOnSubmit,Attributes["onsubmit"]);
+ Attributes.Remove("onsubmit");
+ }
+ writer.WriteAttribute("language","javascript");
+ writer.WriteAttribute("onsubmit",clientOnSubmit);
+ }
+ if (ID == null){
+ writer.WriteAttribute("id",ClientID);
+ }
+ base.RenderAttributes(writer);
+ }
+
+ //TODO: adapt code for non-IE browsers
+ protected override void Render(HtmlTextWriter output){
+ if (Page.SmartNavigation == true){
+ IAttributeAccessor.SetAttribute("_smartNavigation","true");
+ HttpBrowserCapabilities browserCap = Context.Request.Browser;
+ if (browserCap.Browser.ToLower() != "ie" && browserCap.MajorVersion < 5){
+ base.Render(output);
+ return;
+ }
+ output.WriteLine("<IFRAME ID=_hifSmartNav NAME=_hifSmartNav STYLE=display:none ></IFRAME>");
+
+ if (browserCap.MinorVersion < 0.5 && browserCap.MajorVersion != 5)
+ Page.RegisterClientScriptFile("SmartNavIncludeScript","JScript","SmartNavIE5.js");
+ else if (Page.IsPostBack) Page.RegisterClientScriptFile("SmartNavIncludeScript","JScript","SmartNav.js");
+ base.Render(output);
+ }
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ Page.OnFormRender(writer,ClientID);
+ base.RenderChildren(writer);
+ Page.OnFormPostRender(writer,ClientID);
+ }
+
+ protected override void OnInit(EventArgs e){
+ base.OnInit(e);
+ Page.RegisterViewStateHandler();
+ }
+
+ internal string Action{
+ get{
+ string executionFilePath = Context.Request.CurrentExecutionFilePath;
+ string filePath = Context.Request.FilePath;
+ string attr;
+ if (String.ReferenceEquals(executionFilePath, filePath) == true){
+ attr = filePath;
+ int lastSlash = attr.LastIndexOf('/');
+ if (lastSlash >= 0)
+ attr = attr.Substring(lastSlash + 1);
+ }
+ else{
+ attr = Util.UrlPath.MakeRelative(filePath,executionFilePath);
+ }
+ string queryString = Context.Request.QueryStringText;
+ if (queryString != null && queryString.Length > 0)
+ attr = String.Concat(attr, '?', queryString);
+ return attr;
+ }
+ }
+
+ public string EncType{
+ get{
+ string attr = Attributes["enctype"];
+ if (attr != null){
+ return attr;
+ }
+ return null;
+ }
+ set{
+ Attributes["enctype"] = AttributeToString(value);
+ }
+ }
+
+ public string Method{
+ get{
+ string attr = Attributes["method"];
+ if (attr != null){
+ return attr;
+ }
+ return "post";
+ }
+ set{
+ Attributes["method"] = AttributeToString(value);
+ }
+ }
+
+ public string Target{
+ get{
+ string attr = Attributes["target"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["target"] = AttributeToString(value);
+ }
+ }
+
+ public string Name{
+ get{
+ string attr = Attributes["name"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ }
+
+ 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/HtmlGenericControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
new file mode 100644
index 00000000000..2583de6190b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlGenericControl.cs
@@ -0,0 +1,32 @@
+//
+// System.Web.UI.HtmlControls.HtmlGenericControl.cs
+//
+// Author:
+ // Bob Smith <bob@thestuff.net>
+ //
+ // (C) Bob Smith
+ //
+
+ using System;
+ using System.Web;
+ using System.Web.UI;
+
+ namespace System.Web.UI.HtmlControls{
+
+ public class HtmlGenericControl : HtmlContainerControl {
+
+ public HtmlGenericControl(){}
+
+ public HtmlGenericControl(string tag): base(tag){}
+
+ public new string TagName {
+ get
+ {
+ return _tagName;
+ }
+ set{
+ _tagName = value;
+ }
+ }
+ }
+ }
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
new file mode 100755
index 00000000000..62135016d4c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlImage.cs
@@ -0,0 +1,90 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlImage : HtmlControl{
+
+ public HtmlImage(): base("img"){}
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ PreProcessRelativeReference(writer,"src");
+ RenderAttributes(writer);
+ writer.Write(" /");
+ }
+
+ public string Align{
+ get{
+ string attr = Attributes["align"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ public string Alt{
+ get{
+ string attr = Attributes["alt"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["alt"] = AttributeToString(value);
+ }
+ }
+
+ public int Border{
+ get{
+ string attr = Attributes["border"];
+ if (attr != null){
+ return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ public string Src{
+ get{
+ string attr = Attributes["src"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["src"] = AttributeToString(value);
+ }
+ }
+
+ public int Width{
+ get{
+ string attr = Attributes["width"];
+ if (attr != null){
+ return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlImage
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
new file mode 100755
index 00000000000..3f1a75c4133
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
@@ -0,0 +1,88 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputButton : HtmlInputControl, IPostBackEventHandler{
+
+ private static readonly object EventServerClick;
+
+ public HtmlInputButton(string type): base(type){}
+
+ protected void OnServerClick(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerClick];
+ if (handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ string attrType = Type;
+ bool ofTypeSubmit = (String.Compare(attrType, "submit", true) == 0);
+ bool events;
+ if (ofTypeSubmit != true){
+ events = (Events[EventServerClick] != null);
+ }
+ else{
+ events = false;
+ }
+ if (Page != null){
+ if (ofTypeSubmit != true){
+ WriteOnClickAttribute(
+ writer,
+ false,
+ true,
+ CausesValidation == false? Page.Validators.Count > 0: false);
+ }
+ else{
+ if (events != true && String.Compare(attrType,"button", true) != 0){
+ WriteOnClickAttribute(
+ writer,
+ false,
+ true,
+ CausesValidation == false? Page.Validators.Count > 0: false);
+ }
+ }
+ }
+ base.RenderAttributes(writer);
+ }
+
+ public void RaisePostBackEvent(string eventArgument){
+ if(CausesValidation == true){
+ Page.Validate();
+ }
+ OnServerClick(EventArgs.Empty);
+ }
+
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ public bool CausesValidation{
+ get{
+ object causesVal = ViewState["CausesValidation"];
+ if (causesVal != null){
+ return (Boolean) causesVal;
+ }
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ } // end of System.Web.UI.HtmlControls.HtmlInputButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
new file mode 100755
index 00000000000..c73915abc15
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputCheckBox.cs
@@ -0,0 +1,68 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputCheckBox : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange;
+
+ public HtmlInputCheckBox(): base("checkbox"){}
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string postValue = postCollection[postDataKey];
+ bool postChecked = false;
+ if (postValue != null)
+ postChecked = postValue.Length > 0;
+ Checked = postChecked;
+ return (postChecked == Checked == false);
+ }
+
+ public void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ protected void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null) handler.Invoke(this, e);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled)
+ Page.RegisterRequiresPostBack(this);
+ if (Events[EventServerChange] != null && !Disabled)
+ ViewState.SetItemDirty("checkbox",false);
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ public bool Checked{
+ get{
+ string attr = Attributes["checked"];
+ if (attr != null)
+ return attr.Equals("checked");
+ return false;
+ }
+ set{
+ Attributes["checked"] = (value == true)? "checked": null;
+ }
+ }
+
+ } // class HtmlInputCheckBox
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
new file mode 100755
index 00000000000..5c5010d4451
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputControl.cs
@@ -0,0 +1,63 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputControl : HtmlControl{
+
+ public HtmlInputControl(string type):base("type"){
+ Attributes["type"] = type;
+ }
+
+ protected virtual new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name",RenderedName);
+ Attributes.Remove("name");
+ base.RenderAttributes(writer);
+ writer.Write(" /");
+ }
+
+ public string Name{
+ get{
+ return UniqueID;
+ }
+ set{}
+ }
+
+ protected virtual string RenderedName{
+ get{
+ return Name;
+ }
+ }
+
+ public string Type{
+ get{
+ string attr = Attributes["type"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ }
+
+ public virtual string Value{
+ get{
+ string attr = Attributes["value"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["value"] = AttributeToString(value);
+ }
+ }
+ } // class HtmlInputControl
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
new file mode 100755
index 00000000000..b0e4710db6a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputFile.cs
@@ -0,0 +1,71 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputFile : HtmlInputControl, IPostBackDataHandler{
+
+ public HtmlInputFile():base("file"){}
+
+ public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string postValue = postCollection[postDataKey];
+ if (postValue != null)
+ Value = postValue;
+ return false;
+ }
+
+ public virtual void RaisePostDataChangedEvent(){}
+
+ public string Accept{
+ get{
+ string attr = Attributes["accept"];
+ if (attr != null)
+ return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["accept"] = AttributeToString(value);
+ }
+ }
+
+ public int MaxLength{
+ get{
+ string attr = Attributes["maxlength"];
+ if (attr != null)
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["accept"] = AttributeToString(value);
+ }
+ }
+
+ public int Size{
+ get{
+ string attr = Attributes["size"];
+ if (attr != null)
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ public HttpPostedFile PostedFile{
+ get{
+ return Context.Request.Files[RenderedName];
+ }
+ }
+
+ } // class HtmlInputFile
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
new file mode 100755
index 00000000000..daf2a326831
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputHidden.cs
@@ -0,0 +1,52 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputHidden : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange;
+
+ public HtmlInputHidden(string type):base("hidden"){}
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string postValue = postCollection[postDataKey];
+ if (postValue != null)
+ Value = postValue;
+ return false;
+ }
+
+ public virtual void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ protected void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null) handler.Invoke(this, e);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Events[EventServerChange] != null && !Disabled)
+ ViewState.SetItemDirty("value",false);
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ } // class HtmlInputFile
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
new file mode 100755
index 00000000000..3ac74919160
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputImage.cs
@@ -0,0 +1,129 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputImage : HtmlInputControl, IPostBackEventHandler, IPostBackDataHandler{
+
+ private static readonly object EventServerClick;
+ private int _x, _y;
+
+ public HtmlInputImage(): base("image"){}
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+ protected void OnServerClick(ImageClickEventArgs e){
+ ImageClickEventHandler handler = (ImageClickEventHandler) Events[EventServerClick];
+ if (handler != null) handler.Invoke(this, e);
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ PreProcessRelativeReference(writer,"src");
+ if (Page != null && !CausesValidation){
+ WriteOnClickAttribute(
+ writer,
+ false,
+ true,
+ CausesValidation == false? Page.Validators.Count > 0: false);
+ }
+ RenderAttributes(writer);
+ }
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string postX = postCollection[String.Concat(RenderedName,".x")];
+ string postY = postCollection[String.Concat(RenderedName,".y")];
+ if (postX != null && postY != null && postX.Length >= 0 && postY.Length >= 0){
+ _x = Int32.Parse(postX, CultureInfo.InvariantCulture);
+ _y = Int32.Parse(postY, CultureInfo.InvariantCulture);
+ Page.RegisterRequiresRaiseEvent(this);
+ }
+ return false;
+ }
+
+ public void RaisePostBackEvent(string eventArgument){
+ if (CausesValidation){
+ Page.Validate();
+ }
+ OnServerClick(new ImageClickEventArgs(_x,_y));
+ }
+
+ public void RaisePostDataChangedEvent(){}
+
+ public event EventHandler ServerClick{
+ add{
+ Events.AddHandler(EventServerClick, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerClick, value);
+ }
+ }
+
+ public string Align{
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ public string Alt{
+ get{
+ string attr = Attributes["alt"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["alt"] = AttributeToString(value);
+ }
+ }
+
+ public int Border{
+ get{
+ string attr = Attributes["border"];
+ if (attr != null) return Int32.Parse(attr,CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ public bool CausesValidation{
+ get{
+ object causesVal = ViewState["CausesValidation"];
+ if (causesVal != null) return (Boolean) causesVal;
+ return true;
+ }
+ set{
+ ViewState["CausesValidation"] = (Boolean) value;
+ }
+ }
+
+ public string Src{
+ get{
+ string attr = Attributes["src"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["src"] = AttributeToString(value);
+ }
+ }
+ } // class HtmlInputImage
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
new file mode 100755
index 00000000000..62f2de3f506
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputRadioButton.cs
@@ -0,0 +1,115 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputRadioButton : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange;
+
+ public HtmlInputRadioButton(): base("radio"){}
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ if (Events[EventServerChange] != null && !Disabled){
+ ViewState.SetItemDirty("checked", false);
+ }
+ }
+
+ protected void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("value", Value);
+ Attributes.Remove("value");
+ RenderAttributes(writer);
+ }
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string postValue = postCollection[postDataKey];
+ bool myBool = false;
+ if (postValue != null && postValue.Equals(Value)){
+ if (!Checked){
+ Checked = true;
+ myBool = true;
+ }
+ }
+ else{
+ if (Checked){
+ Checked = false;
+ myBool = false;
+ }
+ }
+ return myBool;
+ }
+
+ public void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ public bool Checked{
+ get{
+ string attr = Attributes["checked"];
+ if (attr != null){
+ return attr.Equals("checked");
+ }
+ return false;
+ }
+ set{
+ if (value != true){
+ Attributes["checked"] = null;
+ }
+ Attributes["checked"] = "checked";
+ }
+ }
+ public new string Name{
+ get{
+ string attr = Attributes["name"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["name"] = AttributeToString(value);
+ }
+ }
+
+ private new string RenderedName{
+ get{
+ string attr = base.RenderedName;
+ string id = UniqueID;
+ int indexOfX = id.LastIndexOf('X');
+ if (indexOfX != 0 && indexOfX >= 0){
+ attr = String.Concat(attr, id.Substring(0,indexOfX+1));
+ }
+ return attr;
+ }
+ }
+
+ } // class HtmlInputRadioButton
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
new file mode 100755
index 00000000000..e2ac0471d46
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputText.cs
@@ -0,0 +1,98 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlInputText : HtmlInputControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange;
+
+ public HtmlInputText(string type):base(type){}
+ public HtmlInputText():base("text"){}
+
+ protected override void OnPreRender(EventArgs e){
+ if (Events[EventServerChange] != null && !Disabled){
+ ViewState.SetItemDirty("value",false);
+ }
+ }
+
+ protected void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null) handler.Invoke(this, e);
+ }
+
+ protected override void RenderAttributes(HtmlTextWriter writer){
+ //hide value when password box
+ if (String.Compare(Type, "password") != 0){
+ ViewState.Remove("value");
+ }
+ RenderAttributes(writer);
+ }
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string currentValue = Value;
+ string[] postedValue = postCollection.GetValues(postDataKey);
+ if (!currentValue.Equals(postedValue)){
+ Value = postedValue[0];
+ return true;
+ }
+ return false;
+ }
+
+ public void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ public int MaxLength{
+ get{
+ string attr = (String) ViewState["maxlength"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["maxlength"] = AttributeToString(value);
+ }
+ }
+
+ public int Size{
+ get{
+ string attr = (String) ViewState["size"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ public override string Value{
+ get{
+ string attr = Attributes["value"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["value"] = AttributeToString(value);
+ }
+ }
+
+ } // class HtmlInputText
+} // 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
new file mode 100755
index 00000000000..5b58abda3d0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlSelect.cs
@@ -0,0 +1,402 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Globalization;
+using System.ComponentModel;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlSelect : HtmlContainerControl, IPostBackDataHandler{
+
+
+ private int _cachedSelectedIndex;
+ private object _dataSource;
+ private static readonly object EventServerChange;
+ private ListItemCollection _items;
+
+ public HtmlSelect():base("select"){
+ _cachedSelectedIndex = -1;
+ }
+
+ protected override void AddParsedSubObject(object obj){
+ if (obj as ListItem != null) {
+ this.Items.Add((ListItem) obj);
+ return;
+ }
+ throw new HttpException("HtmlSelect cannot have children of Type " + obj.GetType().Name);
+ }
+
+ protected virtual void ClearSelection(){
+ for (int i =0; i<= Items.Count; i++){
+ Items[i].Selected = false;
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection(){
+ return new EmptyControlCollection(this);
+ }
+
+ protected override void LoadViewState(object savedState){
+ if (savedState != null){
+ Triplet state = (Triplet) savedState;
+ LoadViewState(state.First);
+ Items.LoadViewState(state.Second);
+ object thirdState = state.Third;
+ if (thirdState != null) Select((int[]) thirdState);
+ }
+ }
+
+ protected override void OnDataBinding(EventArgs e){
+ base.OnDataBinding(e);
+ IEnumerable resolvedDataSource = System.Web.Utils.DataSourceHelper.GetResolvedDataSource(DataSource, DataMember);
+ if ( resolvedDataSource != null){
+ string text = DataTextField;
+ string value = DataValueField;
+ Items.Clear();
+ ICollection rdsCollection = resolvedDataSource as ICollection;
+ if (rdsCollection != null){
+ Items.Capacity = rdsCollection.Count;
+ }
+ bool valid = false;
+ if (text.Length >= 0 && value.Length >= 0)
+ valid = true;
+ ListItem li = new ListItem();
+ IEnumerator current = resolvedDataSource.GetEnumerator();
+ while(current.MoveNext()){
+ if (valid == true){
+ if (text.Length >= 0)
+ li.Text = DataBinder.GetPropertyValue(current, text, null);
+ if (value.Length >= 0)
+ li.Value = DataBinder.GetPropertyValue(current, value, null);
+ }
+ else{
+ li.Value = li.Text = current.ToString();
+ }
+ }
+ Items.Add(li);
+ }
+ if ( _cachedSelectedIndex != -1){
+ SelectedIndex = _cachedSelectedIndex;
+ _cachedSelectedIndex = -1;
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if (Page != null && Size >= 0 && !Disabled){
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler = (EventHandler) Events[EventServerChange];
+ if (handler != null)
+ handler.Invoke(this,e);
+ }
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", Name);
+ Attributes.Remove("name");
+ Attributes.Remove("DataValueField");
+ Attributes.Remove("DataTextField");
+ Attributes.Remove("DataMember");
+ RenderAttributes(writer);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ //flush output
+ writer.WriteLine();
+ // increase indent level, improves readability
+ writer.Indent = writer.Indent + 1;
+ if (Items.Count >= 0){
+ // display all options, and set the selected option
+ foreach (ListItem option in Items){
+ //write begin tag with attributes
+ writer.WriteBeginTag("option");
+ if (option.Selected == true){
+ writer.WriteAttribute("selected","selected");
+ }
+ writer.WriteAttribute("value",option.Value,true);
+ option.Attributes.Remove("text");
+ option.Attributes.Remove("value");
+ option.Attributes.Remove("selected");
+ option.Attributes.Render(writer);
+ writer.Write('>');
+ //write the option text
+ HttpUtility.HtmlEncode(option.Text, writer);
+ //close the current option tag
+ writer.WriteEndTag("option");
+ //flush output
+ writer.WriteLine();
+ }
+ }
+ // set the indent level back to normal
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected override object SaveViewState(){
+ object itemsViewState = SaveViewState();
+ object third = null;
+ if (Events[EventServerChange] != null && !Disabled && Visible){
+ third = SelectedIndices;
+ }
+ if (third != null && base.SaveViewState() != null && itemsViewState != null){
+ return new Triplet(itemsViewState, base.SaveViewState(), third);
+ }
+ return null;
+ }
+
+ protected virtual void Select(int[] selectedIndices){
+ // unselect all options
+ ClearSelection();
+ // iterate through options, and set when selected
+ foreach (int current in selectedIndices){
+ if (current >= 0 && current < Items.Count){
+ Items[current].Selected = true;
+ }
+ }
+ }
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ //get the posted selectedIndices[]
+ string[] postedValueColl = postCollection.GetValues(postDataKey);
+ bool valid = false;
+ if (postedValueColl != null){
+ if (!Multiple){
+ //single selection
+ //int postedValue = Items.FindIndexByValue(postedValueColl[0]);
+ int postedValue = Items.IndexOf(Items.FindByValue(postedValueColl[0]));
+ if (postedValue != SelectedIndex){
+ //set the SelectedIndex
+ SelectedIndex = postedValue;
+ valid = true;
+ }
+ }
+ else{
+ //multiple selection
+ int postedValueCount = postedValueColl.Length;
+ int[] arr= new int[postedValueCount];
+ //fill an array with the posted Values
+ for (int i = 0; i <= postedValueCount; i++)
+ arr[i] = Items.IndexOf(Items.FindByValue(postedValueColl[i]));
+ //test if everything went fine
+ if( postedValueCount == SelectedIndices.Length)
+ for (int i = 0; i <= postedValueCount; i++)
+ if(arr[i] == SelectedIndices[i])
+ valid = true;
+ else
+ valid = true;
+ //commit the posted Values
+ if(valid)
+ Select(arr);
+ }
+ }
+ else if (SelectedIndex != -1){
+ SelectedIndex = -1;
+ valid = true;
+ }
+ return valid;
+ }
+
+ public void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ //starts tracking changes to the viewstate
+ protected internal virtual void TrackViewState(){
+ TrackViewState();
+ Items.TrackViewState();
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ public virtual string DataMember{
+ get{
+ object viewStateDataMember = ViewState["DataMember"];
+ if ( viewStateDataMember != null) return (String) viewStateDataMember;
+ return String.Empty;
+ }
+ set{
+ Attributes["DataMember"] = HtmlControl.AttributeToString(value);
+ }
+ }
+
+ public virtual object DataSource{
+ get{
+ return _dataSource;
+ }
+ set{
+ if (value != null && value is IListSource){
+ if (value is IEnumerable){
+ _dataSource = value;
+ }
+ else{
+ throw new ArgumentException("Invalid dataSource type");
+ }
+ }
+ }
+ }
+
+ public virtual string DataTextField{
+ get{
+ string attr = Attributes["DataTextField"];
+ if (attr != null){
+ return attr;
+ }
+ return String.Empty;
+ }
+ set{
+ Attributes["DataTextField"] = AttributeToString(value);
+ }
+ }
+
+ public virtual string DataValueField{
+ get{
+ string attr = Attributes["DataValueField"];
+ if (attr != null)return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["DataValueField"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml{
+ get{
+ throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
+ }
+ set{
+ throw new NotSupportedException("InnerHtml is not supported by " + this.GetType().Name);
+ }
+ }
+
+ public override string InnerText{
+ get{
+ throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
+ }
+ set{
+ throw new NotSupportedException("InnerText is not supported by " + this.GetType().Name);
+ }
+ }
+
+ public ListItemCollection Items{
+ get{
+ if (_items == null){
+ _items = new ListItemCollection();
+ if (IsTrackingViewState) _items.TrackViewState();
+ }
+ return _items;
+ }
+ }
+
+ public bool Multiple{
+ get{
+ string attr = Attributes["multiple"];
+ if (attr != null) return attr.Equals("multiple");
+ return false;
+ }
+ set{
+ if (value == true) Attributes["multiple"] = "multiple";
+ else Attributes["multiple"] = null;
+ }
+ }
+
+ public string Name{
+ get{
+ return UniqueID;
+ }
+ set{
+ //LAMESPEC
+ return;
+ }
+ }
+
+ public virtual int SelectedIndex {
+ get{
+ for (int i=0; i<=Items.Count; i++){
+ if (Items[i].Selected == true) return i;
+ }
+ if (Size<=1 && !Multiple){
+ if(Items.Count > 0) Items[0].Selected = true;
+ return 0;
+ }
+ return -1;
+ }
+ set{
+ if(Items.Count == 0){
+ _cachedSelectedIndex = value;
+ return;
+ }
+ else if (value < -1 || value >= Items.Count)
+ throw new ArgumentOutOfRangeException();
+ ClearSelection();
+ if (value >= 0)
+ Items[value].Selected = true;
+ }
+ }
+
+ protected virtual int[] SelectedIndices {
+ get{
+ int[] indices = new int[3];
+ int indicesCount = 0;
+ for(int i=0; i <= Items.Count; i++){
+ if(Items[i].Selected){
+ if( indicesCount == (int) indices.Length){
+ int[] temp = new int[indicesCount + indicesCount];
+ indices.CopyTo(temp,0);
+ indices = temp;
+ }
+ indicesCount++;
+ indices[indicesCount] = i;
+ }
+ }
+ int[] arr = new int[indicesCount];
+ System.Array.Copy(indices,0,arr,0,indicesCount);
+ return arr;
+ }
+ }
+
+ public int Size{
+ get{
+ string attr = Attributes["size"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);;
+ }
+ return -1;
+ }
+ set{
+ Attributes["size"] = AttributeToString(value);
+ }
+ }
+
+ public string Value{
+ get{
+ int selectedIndex = SelectedIndex;
+ if (selectedIndex >=0 && selectedIndex <= Items.Count){
+ return Items[selectedIndex].Value;
+ }
+ return String.Empty;
+ }
+ set{
+ int findValue = Items.IndexOf(Items.FindByValue(value));
+ if (findValue >= 0) SelectedIndex = findValue;
+ }
+ }
+
+ } // class HtmlSelect
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
new file mode 100755
index 00000000000..db057fd16ff
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTable.cs
@@ -0,0 +1,171 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlTable : HtmlContainerControl {
+ private HtmlTableRowCollection _rows;
+
+ public HtmlTable():base("table"){}
+
+ protected override ControlCollection CreateControlCollection(){
+ return new HtmlTableRowControlCollection(this);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ writer.WriteLine();
+ writer.Indent = writer.Indent + 1;
+ base.RenderChildren(writer);
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected new void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ public int Border {
+ get{
+ string attr = Attributes["border"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["border"] = AttributeToString(value);
+ }
+ }
+
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ public int CellPadding {
+ get{
+ string attr = Attributes["cellpadding"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["cellpadding"] = AttributeToString(value);
+ }
+ }
+
+ public int CellSpacing {
+ get{
+ string attr = Attributes["cellspacing"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["cellspacing"] = AttributeToString(value);
+ }
+ }
+
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml {
+ get{
+ throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
+ }
+ set{
+ throw new NotSupportedException("InnerHtml property not supported by HtmlTable");
+ }
+ }
+
+ public override string InnerText {
+ get{
+ throw new NotSupportedException("InnerText property not supported by HtmlTable");
+ }
+ set{
+ throw new NotSupportedException("InnerText property not supported by HtmlTable");
+ }
+ }
+
+ public virtual HtmlTableRowCollection Rows {
+ get{
+ if (_rows == null) _rows = new HtmlTableRowCollection(this);
+ return _rows;
+ }
+ }
+
+ public string Width {
+ get{
+ string attr = Attributes["width"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ protected class HtmlTableRowControlCollection : ControlCollection {
+
+ internal HtmlTableRowControlCollection(Control owner): base(owner){}
+
+ public override void Add(Control child){
+ if ((child as HtmlTableCell) != null){
+ base.Add(child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of type" + child.GetType().Name);
+ }
+ }
+
+ public override void AddAt(int index, Control child){
+ if ((child as HtmlTableCell) != null){
+ base.AddAt(index,child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of type" + child.GetType().Name);
+ }
+ }
+ } // end of HtmlTableRowControlCollection
+ }
+ // end of System.Web.UI.HtmlControl
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
new file mode 100755
index 00000000000..6815acf909a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCell.cs
@@ -0,0 +1,129 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Globalization;
+
+namespace System.Web.UI.HtmlControls{
+ public class HtmlTableCell : HtmlContainerControl {
+ public HtmlTableCell(): base("td"){}
+
+ public HtmlTableCell(string tagName): base(tagName){}
+
+ protected new void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ public int ColSpan {
+ get{
+ string attr = Attributes["colspan"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["colspan"] = AttributeToString(value);
+ }
+ }
+
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ public bool NoWrap {
+ get{
+ string attr = Attributes["colspan"];
+ if (attr != null) return attr.Equals("nowrap");
+ return false;
+ }
+ set{
+ if (value == true){
+ Attributes["nowrap"] = "nowrap";
+ }
+ else{
+ Attributes["nowrap"] = null;
+ }
+ }
+ }
+
+ public int RowSpan {
+ get{
+ string attr = Attributes["rowspan"];
+ if (attr != null) return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ return -1;
+ }
+ set{
+ Attributes["rowspan"] = AttributeToString(value);
+ }
+ }
+
+ public string VAlign {
+ get{
+ string attr = Attributes["valign"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["valign"] = AttributeToString(value);
+ }
+ }
+
+ public string Width {
+ get{
+ string attr = Attributes["width"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["width"] = AttributeToString(value);
+ }
+ }
+
+ }
+ // System.Web.UI.HtmlControls.HtmlTableCell
+
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
new file mode 100755
index 00000000000..9deaf2f0584
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableCellCollection.cs
@@ -0,0 +1,84 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.HtmlControls{
+ public sealed class HtmlTableCellCollection : ICollection {
+ private HtmlTableRow _owner;
+
+ internal HtmlTableCellCollection(HtmlTableRow owner){
+ _owner = owner;
+ }
+
+ public void Add(HtmlTableCell cell){
+ Insert(-1, cell);
+ }
+
+ public void Clear(){
+ if (_owner.HasControls()) _owner.Controls.Clear();
+ }
+
+ public void CopyTo(Array array, int index){
+ IEnumerator tablecell = this.GetEnumerator();
+ while(tablecell.MoveNext()){
+ index = index + 1;
+ array.SetValue(tablecell.Current, index);
+ }
+ }
+
+ public IEnumerator GetEnumerator(){
+ return _owner.Controls.GetEnumerator();
+ }
+
+ public void Insert(int index, HtmlTableCell cell){
+ _owner.Controls.AddAt(index,cell);
+ }
+
+ public void Remove(HtmlTableCell cell){
+ _owner.Controls.Remove(cell);
+ }
+
+ public void RemoveAt(int index){
+ _owner.Controls.RemoveAt(index);
+ }
+
+ public int Count {
+ get{
+ if (_owner.HasControls()) return _owner.Controls.Count;
+ return 0;
+ }
+ }
+
+ public bool IsReadOnly {
+ get{
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get{
+ return false;
+ }
+ }
+
+ public HtmlTableRow this[int index] {
+ get{
+ return (HtmlTableRow) _owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot {
+ get{
+ return null;
+ }
+ }
+
+ } // end of System.Web.UI.HtmlControls.HtmlTableCellCollection
+
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
new file mode 100755
index 00000000000..378e149d835
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRow.cs
@@ -0,0 +1,137 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.HtmlControls{
+ public class HtmlTableRow : HtmlContainerControl {
+ private HtmlTableCellCollection _cells;
+ public HtmlTableRow():base("tr"){}
+
+ protected override ControlCollection CreateControlCollection(){
+ return new HtmlTableCellControlCollection(this);
+ }
+
+ protected override void RenderChildren(HtmlTextWriter writer){
+ writer.WriteLine();
+ writer.Indent = writer.Indent + 1;
+ this.RenderChildren(writer);
+ writer.Indent = writer.Indent - 1;
+ }
+
+ protected new void RenderEndTag(HtmlTextWriter writer){
+ base.RenderEndTag(writer);
+ writer.WriteLine();
+ }
+
+ public string Align {
+ get{
+ string attr = Attributes["align"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["align"] = AttributeToString(value);
+ }
+ }
+
+ public string BgColor {
+ get{
+ string attr = Attributes["bgcolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bgcolor"] = AttributeToString(value);
+ }
+ }
+
+ public string BorderColor {
+ get{
+ string attr = Attributes["bordercolor"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["bordercolor"] = AttributeToString(value);
+ }
+ }
+
+ public virtual HtmlTableCellCollection Cells {
+ get{
+ if (_cells == null) _cells = new HtmlTableCellCollection(this);
+ return _cells;
+ }
+ }
+
+ public string Height {
+ get{
+ string attr = Attributes["height"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["height"] = AttributeToString(value);
+ }
+ }
+
+ public override string InnerHtml {
+ get{
+ throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
+ }
+ set{
+ throw new NotSupportedException("InnerHtml is not supported by HtmlTableRow");
+ }
+ }
+
+ public override string InnerText {
+ get{
+ throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
+ }
+ set{
+ throw new NotSupportedException("InnerText is not supported by HtmlTableRow");
+ }
+ }
+
+ public string VAlign {
+ get{
+ string attr = Attributes["valign"];
+ if (attr != null) return attr;
+ return String.Empty;
+ }
+ set{
+ Attributes["valign"] = AttributeToString(value);
+ }
+ }
+
+
+
+ protected class HtmlTableCellControlCollection : ControlCollection {
+
+ internal HtmlTableCellControlCollection(Control owner): base(owner){}
+
+ public override void Add(Control child){
+ if (child is HtmlTableCell){
+ base.Add(child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
+ }
+ }
+
+ public override void AddAt(int index, Control child){
+ if (child is HtmlTableCell){
+ base.AddAt(index,child);
+ }
+ else{
+ throw new ArgumentException("HtmlTableRow cannot have children of Type " + child.GetType().Name);
+ }
+ }
+ }
+ } // end of System.Web.UI.HtmlControls.HtmlTableRow+HtmlTableCellControlCollection
+ // end of System.Web.UI.HtmlControls.HtmlTableRow
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
new file mode 100755
index 00000000000..987c8aed674
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTableRowCollection.cs
@@ -0,0 +1,83 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Collections;
+
+namespace System.Web.UI.HtmlControls{
+ public sealed class HtmlTableRowCollection : ICollection {
+
+ private HtmlTable _owner;
+
+ internal HtmlTableRowCollection(HtmlTable owner){
+ _owner = owner;
+ }
+
+ public void Add(HtmlTableRow row){
+ Insert(-1, row);
+ }
+
+ public void Clear(){
+ if (_owner.HasControls()) _owner.Controls.Clear();
+ }
+
+ public void CopyTo(Array array, int index){
+ IEnumerator tablerow = this.GetEnumerator();
+ while (tablerow.MoveNext()){
+ index = index + 1;
+ array.SetValue(tablerow.Current, index);
+ }
+ }
+
+ public IEnumerator GetEnumerator(){
+ return _owner.Controls.GetEnumerator();
+ }
+
+ public void Insert(int index, HtmlTableRow row){
+ _owner.Controls.AddAt(index,row);
+ }
+
+ public void Remove(HtmlTableRow row){
+ _owner.Controls.Remove(row);
+ }
+
+ public void RemoveAt(int index){
+ _owner.Controls.RemoveAt(index);
+ }
+
+ public int Count {
+ get{
+ if (_owner.HasControls()) return _owner.Controls.Count;
+ return 0;
+ }
+ }
+
+ public bool IsReadOnly {
+ get{
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get{
+ return false;
+ }
+ }
+
+ public HtmlTableRow this[int index] {
+ get{
+ return (HtmlTableRow) _owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot {
+ get{
+ return this;
+ }
+ }
+ }//System.Web.UI.HtmlControls.HtmlTableRowCollection
+}
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
new file mode 100644
index 00000000000..f5652958241
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlTextArea.cs
@@ -0,0 +1,118 @@
+/* System.Web.UI.HtmlControls
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Globalization;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.HtmlControls{
+
+ public class HtmlTextArea : HtmlContainerControl, IPostBackDataHandler{
+
+ private static readonly object EventServerChange;
+
+ public HtmlTextArea(): base("textarea"){}
+
+ public int Cols{
+ get{
+ string attr = Attributes["cols"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);
+ }
+ return -1;
+ }
+ set{
+ Attributes["cols"] = AttributeToString(value);
+ }
+ }
+
+ public int Rows{
+ get{
+ string attr = Attributes["rows"];
+ if (attr != null){
+ return Int32.Parse(attr, CultureInfo.InvariantCulture);;
+ }
+ return -1;
+ }
+ set{
+ Attributes["rows"] = AttributeToString(value);
+ }
+ }
+
+ public string Value{
+ get{
+ return InnerHtml;
+ }
+ set{
+ InnerHtml = value;
+ }
+ }
+
+ public virtual string Name{
+ get{
+ if (UniqueID != null){
+ return UniqueID;
+ }
+ return String.Empty;
+ }
+ set{}
+ }
+
+ public event EventHandler ServerChange{
+ add{
+ Events.AddHandler(EventServerChange, value);
+ }
+ remove{
+ Events.RemoveHandler(EventServerChange, value);
+ }
+ }
+
+ protected virtual void OnServerChange(EventArgs e){
+ EventHandler handler;
+ handler = (EventHandler) Events[EventServerChange];
+ if(handler != null){
+ handler.Invoke(this, e);
+ }
+ }
+
+ public bool LoadPostData(string postDataKey, NameValueCollection postCollection){
+ string currentValue = Value;
+ string postedValue = postCollection[postDataKey];
+ if (!currentValue.Equals(postedValue) && currentValue != null){
+ Value = HttpUtility.HtmlEncode(postedValue);
+ return true;
+ }
+ return false;
+ }
+
+ protected new void RenderAttributes(HtmlTextWriter writer){
+ writer.WriteAttribute("name", Name);
+ Attributes.Remove("name");
+ base.RenderAttributes(writer);
+ }
+
+ public void RaisePostDataChangedEvent(){
+ OnServerChange(EventArgs.Empty);
+ }
+
+ protected override void OnPreRender(EventArgs e){
+ if(Events[EventServerChange]==null || Disabled){
+ ViewState.SetItemDirty("value",false);
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj){
+ if (obj is LiteralControl || obj is DataBoundLiteralControl)
+ AddParsedSubObject(obj);
+ else
+ throw new NotSupportedException("HtmlTextArea cannot have children of Type " + obj.GetType().Name);
+ }
+
+ } // class HtmlTextArea
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore b/mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore
new file mode 100644
index 00000000000..13fc1fc7660
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/.cvsignore
@@ -0,0 +1,2 @@
+*.exe
+*.xml
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs
new file mode 100755
index 00000000000..d0e94b87f88
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventArgs.cs
@@ -0,0 +1,92 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: AdCreatedEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class AdCreatedEventArgs: EventArgs
+ {
+
+ private IDictionary adProperties;
+ private string alternateText;
+ private string imageUrl;
+ private string navigateUrl;
+
+ public AdCreatedEventArgs(IDictionary adProperties): base()
+ {
+ Initialize();
+ this.adProperties = adProperties;
+ if(adProperties!=null)
+ {
+ imageUrl = (string)adProperties["ImageUrl"];
+ navigateUrl = (string)adProperties["NavigateUrl"];
+ alternateText = (string)adProperties["AlternateText"];
+ }
+ }
+
+ private void Initialize()
+ {
+ alternateText = string.Empty;
+ imageUrl = string.Empty;
+ navigateUrl = string.Empty;
+ }
+
+ public IDictionary AdProperties
+ {
+ get
+ {
+ return adProperties;
+ }
+ }
+
+ public string AlternateText
+ {
+ get
+ {
+ return alternateText;
+ }
+ set
+ {
+ alternateText = value;
+ }
+ }
+
+ public string ImageUrl
+ {
+ get
+ {
+ return imageUrl;
+ }
+ set
+ {
+ imageUrl = value;
+ }
+ }
+
+ public string NavigateUrl
+ {
+ get
+ {
+ return navigateUrl;
+ }
+ set
+ {
+ navigateUrl = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs
new file mode 100755
index 00000000000..57359aa5b30
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdCreatedEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: AdCreatedEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void AdCreatedEventHandler(object sender, AdCreatedEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
new file mode 100755
index 00000000000..a536218b2fa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/AdRotator.cs
@@ -0,0 +1,358 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: AdRotator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web;
+using System.Web.Caching;
+using System.Web.UI;
+using System.Xml;
+using System.Web.Utils;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("AdCreated")]
+ [DefaultProperty("AdvertisementFile")]
+ //TODO: [Designer("??")]
+ [ToolboxData("<{0}:AdRotator runat=\"server\" Height=\"60px\" "
+ + "Width=\"468\"></{0}:AdRotator>")]
+ public class AdRotator: WebControl
+ {
+
+ private string advertisementFile;
+ private static readonly object AdCreatedEvent = new object();
+
+ // Will be set values during (On)PreRender-ing
+ private string alternateText;
+ private string imageUrl;
+ private string navigateUrl;
+
+ private string fileDirectory;
+
+ class AdRecord
+ {
+ public IDictionary adProps;
+ public int hits; // or impressions or clicks
+ public string keyword;
+
+ public AdRecord(IDictionary adProps)
+ {
+ this.adProps = adProps;
+ hits = 0;
+ keyword = String.Empty;
+ }
+ }
+
+/*
+ * Loading / Saving data from/to ad file and all the manipulations wrt to the URL...
+ * are incorporated by the following functions.
+ * GetData(string)
+ * LoadAdFile(string)
+ * IsAdMatching(AdRecord)
+ * ResolveAdUrl(string)
+ * SelectAd()
+ * The exact control flow will be detailed. Let me first write the functions
+ */
+
+ private AdRecord[] LoadAdFile(string file)
+ {
+ Stream fStream;
+ ArrayList list;
+ XmlReader reader;
+ XmlDocument document;
+ XmlNode topNode, innerNode;
+ IDictionary hybridDict = null;
+ AdRecord[] adsArray = null;
+ try
+ {
+ fStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read);
+ } catch(Exception e)
+ {
+ throw new HttpException("AdRotator: Unable to open file");
+ }
+ try
+ {
+ list = new ArrayList();
+ reader = new XmlTextReader(fStream);
+ document = new XmlDocument();
+ document.Load(reader);
+ if(document.DocumentElement!=null)
+ {
+ if(document.DocumentElement.LocalName=="Advertisements")
+ {
+ topNode = document.DocumentElement.FirstChild;
+ while(topNode!=null)
+ {
+ if(topNode.LocalName=="Ad")
+ {
+ innerNode = topNode.FirstChild;
+ while(innerNode!=null)
+ {
+ if(innerNode.NodeType==XmlNodeType.Element)
+ {
+ if(hybridDict==null)
+ {
+ hybridDict = new HybridDictionary();
+ }
+ hybridDict.Add(innerNode.LocalName, innerNode.InnerText);
+ }
+ innerNode = innerNode.NextSibling;
+ }
+ if(hybridDict!=null)
+ list.Add(hybridDict);
+ }
+ topNode = topNode.NextSibling;
+ }
+ }
+ }
+ if(list.Count>0)
+ {
+ adsArray = new AdRecord[list.Count];
+ for(int i=0; i < list.Count; i++)
+ {
+ adsArray[i] = new AdRecord((IDictionary)list[i]);
+ }
+ }
+ } catch(Exception e)
+ {
+ throw new HttpException("AdRotator_Parse_Error" + file);
+ } finally
+ {
+ fStream.Close();
+ }
+ if(adsArray == null)
+ {
+ throw new HttpException("AdRotator_No_Advertisements_Found");
+ }
+ return adsArray;
+ }
+
+ private AdRecord[] GetData(string file)
+ {
+ string physPath = MapPathSecure(file);
+ string AdKey = "AdRotatorCache: " + physPath;
+ fileDirectory = UrlUtils.GetDirectory(UrlUtils.Combine(TemplateSourceDirectory, file));
+ Cache cache = HttpRuntime.Cache;
+ AdRecord[] records = (AdRecord[])cache[AdKey];
+ if(records==null)
+ {
+ records = LoadAdFile(physPath);
+ if(records==null)
+ {
+ return null;
+ }
+ cache.Insert(AdKey, records, new CacheDependency(physPath));
+ }
+ return records;
+ }
+
+ private IDictionary SelectAd()
+ {
+ AdRecord[] records = GetData(AdvertisementFile);
+ if(records!=null && records.Length!=0)
+ {
+ int impressions = 0;
+ for(int i=0 ; i < records.Length; i++)
+ {
+ if(IsAdMatching(records[i]))
+ impressions += records[1].hits;
+ }
+ if(impressions!=0)
+ {
+ int rnd = (new Random()).Next(impressions) + 1;
+ int counter = 0;
+ int index = 0;
+ for(int i=0; i < records.Length; i++)
+ {
+ if(IsAdMatching(records[i]))
+ {
+ if(rnd <= (counter + records[i].hits))
+ {
+ index = i;
+ break;
+ }
+ counter += records[i].hits;
+ }
+ }
+ return records[index].adProps;
+ }
+ }
+ return null;
+ }
+
+ private bool IsAdMatching(AdRecord currAd)
+ {
+ if(KeywordFilter!=String.Empty)
+ {
+ if(currAd.keyword.ToLower() == KeywordFilter.ToLower())
+ return false;
+ }
+ return true;
+ }
+
+ private string ResolveAdUrl(string relativeUrl)
+ {
+ if(relativeUrl.Length==0 || !UrlUtils.IsRelativeUrl(relativeUrl))
+ return relativeUrl;
+ string fullUrl = String.Empty;
+ if(fileDirectory != null)
+ fullUrl = fileDirectory;
+ if(fullUrl.Length == 0)
+ fullUrl = TemplateSourceDirectory;
+ if(fullUrl.Length == 0)
+ return relativeUrl;
+ return (fullUrl + relativeUrl);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("AdRotator_OnAdCreated")]
+ public event AdCreatedEventHandler AdCreated
+ {
+ add
+ {
+ Events.AddHandler(AdCreatedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(AdCreatedEvent, value);
+ }
+ }
+
+ public AdRotator(): base()
+ {
+ advertisementFile = string.Empty;
+ fileDirectory = null;
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ //[Editor("??")]
+ [WebCategory("Behaviour")]
+ [WebSysDescription("AdRotator_AdvertisementFile")]
+ public string AdvertisementFile
+ {
+ get
+ {
+ return advertisementFile;
+ }
+ set
+ {
+ advertisementFile = value;
+ }
+ }
+
+ public override FontInfo Font
+ {
+ get
+ {
+ return Font;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [WebCategory("Behaviour")]
+ [WebSysDescription("AdRotator_KeywordFilter")]
+ public string KeywordFilter
+ {
+ get
+ {
+ object o = ViewState["KeywordFilter"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ if(value!=null)
+ ViewState["KeywordFilter"] = value.Trim();
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue("")]
+ [TypeConverter(typeof(TargetConverter))]
+ [WebCategory("Behaviour")]
+ [WebSysDescription("AdRotator_Target")]
+ public string Target
+ {
+ get
+ {
+ object o = ViewState["Target"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Target"] = value;
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection()
+ {
+ return new EmptyControlCollection(this);
+ }
+
+ protected virtual void OnAdCreated(AdCreatedEventArgs e)
+ {
+ if(Events!=null)
+ {
+ AdCreatedEventHandler aceh = (AdCreatedEventHandler)(Events[AdCreatedEvent]);
+ if(aceh!=null)
+ aceh(this, e);
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ if(AdvertisementFile!=String.Empty)
+ {
+ AdCreatedEventArgs acea = new AdCreatedEventArgs(SelectAd());
+ imageUrl = acea.ImageUrl;
+ navigateUrl = acea.NavigateUrl;
+ alternateText = acea.AlternateText;
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ HyperLink hLink = new HyperLink();
+ Image adImage = new Image();
+ foreach(IEnumerable current in Attributes.Keys)
+ {
+ hLink.Attributes[(string)current] = Attributes[(string)current];
+ }
+ if(ID != null && ID.Length > 0)
+ hLink.ID = ID;
+ hLink.Target = Target;
+ hLink.AccessKey = AccessKey;
+ hLink.Enabled = Enabled;
+ hLink.TabIndex = TabIndex;
+ hLink.RenderBeginTag(writer);
+ if(ControlStyleCreated)
+ {
+ adImage.ApplyStyle(ControlStyle);
+ }
+ if(imageUrl!=null && imageUrl.Length > 0)
+ adImage.ImageUrl = ResolveAdUrl(imageUrl);
+ adImage.AlternateText = alternateText;
+ adImage.ToolTip = ToolTip;
+ adImage.RenderControl(writer);
+ hLink.RenderEndTag(writer);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs
new file mode 100755
index 00000000000..a918280d3e9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseCompareValidator.cs
@@ -0,0 +1,311 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: BaseCompareValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ public abstract class BaseCompareValidator: BaseValidator
+ {
+ protected BaseCompareValidator(): base()
+ {
+ }
+
+ public static bool CanConvert(string text, ValidationDataType type)
+ {
+ object o = null;
+ return Convert(text, type, out o);
+ }
+
+ [DefaultValue(ValidationDataType.String)]
+ [WebCategory("Behaviour")]
+ [WebSysDescription("RangeValidator_Type")]
+ public ValidationDataType Type
+ {
+ get
+ {
+ object o = ViewState["Type"];
+ if(o!=null)
+ return (ValidationDataType)o;
+ return ValidationDataType.String;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(ValidationDataType), value))
+ throw new ArgumentException();
+ ViewState["Type"] = value;
+ }
+ }
+
+ protected static int CutoffYear
+ {
+ get
+ {
+ return DateTimeFormatInfo.CurrentInfo.Calendar.TwoDigitYearMax;
+ }
+ }
+
+ protected static int GetFullYear(int shortYear)
+ {
+ int century = DateTime.Today.Year - (DateTime.Today.Year % 100);
+ if(century < CutoffYear)
+ {
+ return (shortYear + century);
+ }
+ return (shortYear + century - 100);
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+ writer.AddAttribute("type", PropertyConverter.EnumToString(typeof(ValidationDataType), Type));
+ NumberFormatInfo currInfo = NumberFormatInfo.CurrentInfo;
+ if(Type == ValidationDataType.Double)
+ {
+ writer.AddAttribute("decimalchar", currInfo.NumberDecimalSeparator);
+ return;
+ }
+ if(Type == ValidationDataType.Currency)
+ {
+ writer.AddAttribute("decimalchar", currInfo.CurrencyDecimalSeparator);
+ string grpSep = currInfo.CurrencyGroupSeparator;
+ if(grpSep[0] == 0xA0)
+ {
+ grpSep = " ";
+ }
+ writer.AddAttribute("groupchar", grpSep);
+ writer.AddAttribute("digits", currInfo.CurrencyDecimalDigits.ToString(NumberFormatInfo.InvariantInfo));
+ return;
+ }
+ if(Type == ValidationDataType.Date)
+ {
+ writer.AddAttribute("cutoffyear", CutoffYear.ToString());
+ writer.AddAttribute("century", ( DateTime.Today.Year - (DateTime.Today.Year % 100) ).ToString());
+ return;
+ }
+ }
+ }
+
+ protected override bool DetermineRenderUplevel()
+ {
+ if(Type == ValidationDataType.Date && DateTimeFormatInfo.CurrentInfo.Calendar.GetType() != typeof(GregorianCalendar))
+ {
+ return false;
+ }
+ return base.DetermineRenderUplevel();
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected static bool Compare(string leftText, string rightText, ValidationCompareOperator op, ValidationDataType type)
+ {
+ object left = null, right = null;
+ if(!Convert(leftText, type, out left))
+ {
+ return false;
+ }
+ if(op == ValidationCompareOperator.DataTypeCheck)
+ {
+ return true;
+ }
+ if(!Convert(rightText, type, out right))
+ {
+ return true;
+ }
+ int compareResult = 0;
+ switch(type)
+ {
+ case ValidationDataType.String:
+ compareResult = ((String)left).CompareTo(right);
+ break;
+ case ValidationDataType.Integer:
+ compareResult = ((int)left).CompareTo(right);
+ break;
+ case ValidationDataType.Double:
+ compareResult = ((Double)left).CompareTo(right);
+ break;
+ case ValidationDataType.Date:
+ compareResult = ((DateTime)left).CompareTo(right);
+ break;
+ case ValidationDataType.Currency:
+ compareResult = ((Decimal)left).CompareTo(right);
+ break;
+ }
+ switch(op)
+ {
+ case ValidationCompareOperator.Equal:
+ return (compareResult == 0);
+ case ValidationCompareOperator.NotEqual:
+ return (compareResult != 0);
+ case ValidationCompareOperator.GreaterThan:
+ return (compareResult > 0);
+ case ValidationCompareOperator.GreaterThanEqual:
+ return (compareResult >= 0);
+ case ValidationCompareOperator.LessThan:
+ return (compareResult < 0);
+ case ValidationCompareOperator.LessThanEqual:
+ return (compareResult == 0);
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected static string GetDateElementOrder()
+ {
+ string pattern = DateTimeFormatInfo.CurrentInfo.ShortDatePattern;
+
+ //TODO: What are the various possibilities?
+ // I can think of only y*/M*/d*, d*/M*/y*, M*/d*/y*
+ if(pattern.IndexOf('y') < pattern.IndexOf('M'))
+ {
+ return "ymd";
+ }
+ if(pattern.IndexOf('M') < pattern.IndexOf('d'))
+ {
+ return "mdy";
+ }
+ return "dmy";
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected static bool Convert(string text, ValidationDataType type, out object convertedValue)
+ {
+ convertedValue = null;
+ try
+ {
+ switch(type)
+ {
+ case ValidationDataType.String: convertedValue = text;
+ break;
+ case ValidationDataType.Integer: convertedValue = Int32.Parse(text, CultureInfo.InvariantCulture);
+ break;
+ case ValidationDataType.Double:
+ Match matchDouble = Regex.Match(text, @"^\s*([-\+])?(\d+)?(\"
+ + NumberFormatInfo.CurrentInfo.NumberDecimalSeparator
+ + @"(\d+))?\s*$");
+ if(matchDouble.Success)
+ {
+ string sign = (matchDouble.Groups[1].Success ? matchDouble.Groups[1].Value : "+");
+ string decPart = (matchDouble.Groups[2].Success ? matchDouble.Groups[2].Value : "0");
+ string mantissa = (matchDouble.Groups[4].Success ? matchDouble.Groups[4].Value : "0");
+ convertedValue = Double.Parse(sign + decPart + "." + mantissa, CultureInfo.InvariantCulture);
+ }
+ break;
+ case ValidationDataType.Date:
+ if(DateTimeFormatInfo.CurrentInfo.Calendar.GetType() != typeof(GregorianCalendar))
+ {
+ convertedValue = DateTime.Parse(text);
+ break;
+ }
+ string order = GetDateElementOrder();
+ int date = 0, mth = 0, year = 0;
+ Match matchDate = Regex.Match(text, @"^\s*((\d{4})|(\d{2}))([\.\/-])(\d{1,2})\4(\d{1,2})\s*$");
+ if(matchDate.Success && order == "ymd")
+ {
+ date = Int32.Parse(matchDate.Groups[6].Value, CultureInfo.InvariantCulture);
+ mth = Int32.Parse(matchDate.Groups[5].Value, CultureInfo.InvariantCulture);
+ year = Int32.Parse((matchDate.Groups[2].Success ? matchDate.Groups[2].Value : matchDate.Groups[3].Value), CultureInfo.InvariantCulture);
+ } else
+ {
+ matchDate = Regex.Match(text, @"^\s*(\d{1,2})([\.\/-])(\d{1,2})\2((\d{4}|\d{2}))\s*$");
+ if(matchDate.Success)
+ {
+ if(order == "dmy")
+ {
+ date = Int32.Parse(matchDate.Groups[1].Value, CultureInfo.InvariantCulture);
+ mth = Int32.Parse(matchDate.Groups[3].Value, CultureInfo.InvariantCulture);
+ year = Int32.Parse((matchDate.Groups[5].Success ? matchDate.Groups[5].Value : matchDate.Groups[6].Value), CultureInfo.InvariantCulture);
+ }
+ if(order == "mdy")
+ {
+ date = Int32.Parse(matchDate.Groups[3].Value, CultureInfo.InvariantCulture);
+ mth = Int32.Parse(matchDate.Groups[1].Value, CultureInfo.InvariantCulture);
+ year = Int32.Parse((matchDate.Groups[5].Success ? matchDate.Groups[5].Value : matchDate.Groups[6].Value), CultureInfo.InvariantCulture);
+ }
+ }
+ }
+ year = (year < 100 ? GetFullYear(year) : year);
+ if(matchDate.Success && date!=0 && mth!=0 && year!=0)
+ {
+ convertedValue = new DateTime(year, mth, date);
+ }
+ break;
+ case ValidationDataType.Currency:
+ string decSep = NumberFormatInfo.CurrentInfo.CurrencyDecimalSeparator;
+ string grpSep = NumberFormatInfo.CurrentInfo.CurrencyGroupSeparator;
+ int decDig = NumberFormatInfo.CurrentInfo.CurrencyDecimalDigits;
+ if(grpSep[0] == 0xA0)
+ {
+ grpSep = " ";
+ }
+ string[] patternArray = new string[5];
+ patternArray[0] = "^\\s*([-\\+])?(((\\d+)\\";
+ patternArray[1] = grpSep;
+ patternArray[2] = @")*)(\d+)";
+ if(decDig > 0)
+ {
+ string[] decPattern = new string[5];
+ decPattern[0] = "(\\";
+ decPattern[1] = decSep;
+ decPattern[2] = @"(\d{1,";
+ decPattern[3] = decDig.ToString(NumberFormatInfo.InvariantInfo);
+ decPattern[4] = @"}))";
+ patternArray[3] = String.Concat(decPattern);
+
+ } else
+ {
+ patternArray[3] = String.Empty;
+ }
+ patternArray[4] = @"?\s*$";
+ Match matchCurrency = Regex.Match(text, String.Concat(patternArray));
+ if(matchCurrency.Success)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append(matchCurrency.Groups[1]);
+ CaptureCollection cc = matchCurrency.Groups[4].Captures;
+ foreach(IEnumerable current in cc)
+ {
+ sb.Append((Capture)current);
+ }
+ sb.Append(matchCurrency.Groups[5]);
+ if(decDig > 0)
+ {
+ sb.Append(".");
+ sb.Append(matchCurrency.Groups[7]);
+ }
+ convertedValue = Decimal.Parse(sb.ToString(), CultureInfo.InvariantCulture);
+ }
+ break;
+ }
+ } catch(Exception e)
+ {
+ convertedValue = null;
+ }
+ return (convertedValue != null);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs
new file mode 100755
index 00000000000..509d682a81c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseDataList.cs
@@ -0,0 +1,275 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: BaseDataList
+ *
+ * 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)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("SelectedIndexChanged")]
+ [DefaultProperty("DataSource")]
+ //TODO: [Designer("??")]
+ public abstract class BaseDataList: WebControl
+ {
+ private static readonly object SelectedIndexChangedEvent = new object();
+ internal static string ItemCountViewStateKey = "_!ItemCount";
+
+ private DataKeyCollection dataKeys;
+ private object dataSource;
+
+ public BaseDataList() : base()
+ {
+ }
+
+ public static bool IsBindableType(Type type)
+ {
+ if(type.IsPrimitive || type == typeof(string) || type == typeof(DateTime) || type == typeof(Decimal))
+ return true;
+ return false;
+ }
+
+ public override ControlCollection Controls
+ {
+ get
+ {
+ EnsureChildControls();
+ return Controls;
+ }
+ }
+
+ public override void DataBind()
+ {
+ OnDataBinding(EventArgs.Empty);
+ }
+
+ [WebCategory("Action")]
+ [WebSysDescription("BaseDataList_OnSelectedIndexChanged")]
+ public event EventHandler SelectedIndexChanged
+ {
+ add
+ {
+ Events.AddHandler(SelectedIndexChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SelectedIndexChangedEvent, value);
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(-1)]
+ [WebCategory("Layout")]
+ [WebSysDescription("BaseDataList_CellPadding")]
+ public virtual int CellPadding
+ {
+ get
+ {
+ if(!ControlStyleCreated)
+ return -1;
+ return ((TableStyle)ControlStyle).CellPadding;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellPadding = value;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(-1)]
+ [WebCategory("Layout")]
+ [WebSysDescription("BaseDataList_CellSpacing")]
+ public virtual int CellSpacing
+ {
+ get
+ {
+ if(!ControlStyleCreated)
+ return -1;
+ return ((TableStyle)ControlStyle).CellSpacing;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellSpacing = value;
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [WebSysDescription("BaseDataList_DataKeyField")]
+ public virtual string DataKeyField
+ {
+ get
+ {
+ object o = ViewState["DataKeyField"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataKeyField"] = value;
+ }
+ }
+
+ [Browsable(true)]
+ //[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [WebSysDescription("BaseDataList_DataKeys")]
+ public DataKeyCollection DataKeys
+ {
+ get
+ {
+ if( dataKeys==null )
+ dataKeys = new DataKeyCollection(DataKeysArray);
+ return dataKeys;
+
+ }
+ }
+
+ [DefaultValue("")]
+ [WebCategory("Data")]
+ [WebSysDescription("BaseDataList_DataMember")]
+ public string DataMember
+ {
+ get
+ {
+ object o = ViewState["DataMember"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataMember"] = value;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(null)]
+ //[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+ [WebCategory("Data")]
+ [WebSysDescription("BaseDataList_DataSource")]
+ public virtual object DataSource
+ {
+ get
+ {
+ return dataSource;
+ }
+ set
+ {
+ if( (value!=null) && (value is IListSource || value is IEnumerable) )
+ {
+ dataSource = value;
+ } else
+ {
+ throw new ArgumentException(HttpRuntime.FormatResourceString("Invalid_DataSource_Type", ID));
+ }
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(GridLines.Both)]
+ [WebCategory("Appearance")]
+ [WebSysDescription("BaseDataList_GridLines")]
+ public virtual GridLines GridLines
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ return ((TableStyle)ControlStyle).GridLines;
+ return GridLines.Both;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).GridLines = value;
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(HorizontalAlign.NotSet)]
+ [WebCategory("Layout")]
+ [WebSysDescription("BaseDataList_HorizontalAlign")]
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ return ((TableStyle)ControlStyle).HorizontalAlign;
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).HorizontalAlign = value;
+ }
+ }
+
+ protected ArrayList DataKeysArray
+ {
+ get
+ {
+ object o = ViewState["DataKeys"];
+ if(o == null)
+ {
+ o = new ArrayList();
+ ViewState["DataKeys"] = o;
+ }
+ return (ArrayList)o;
+ }
+ }
+
+ protected override void AddParsedSubObject(object o)
+ {
+ // Preventing literal controls from being added as children.
+ }
+
+ protected override void CreateChildControls()
+ {
+ Controls.Clear();
+ if(ViewState[ItemCountViewStateKey]!=null)
+ {
+ CreateControlHierarchy(true);
+ ClearChildViewState();
+ }
+ }
+
+ protected override void OnDataBinding(EventArgs e)
+ {
+ base.OnDataBinding(e);
+ Controls.Clear();
+ ClearChildViewState();
+ CreateControlHierarchy(true);
+ ChildControlsCreated = true;
+ TrackViewState();
+ }
+
+ protected virtual void OnSelectedIndexChanged(EventArgs e)
+ {
+ if(Events != null)
+ {
+ EventHandler eh = (EventHandler)(Events[SelectedIndexChangedEvent]);
+ if(eh!=null)
+ eh(this, e);
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ PrepareControlHierarchy();
+ base.RenderContents(writer);
+ }
+
+ protected abstract void PrepareControlHierarchy();
+ protected abstract void CreateControlHierarchy(bool useDataSource);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs
new file mode 100755
index 00000000000..a7d9d6a9bee
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BaseValidator.cs
@@ -0,0 +1,395 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: BaseValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 80%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("ErrorMessage")]
+ //TODO: [Designer("??")]
+ public abstract class BaseValidator: Label, IValidator
+ {
+ private bool isValid;
+ private bool isPreRenderCalled;
+ private bool isPropertiesChecked;
+ private bool propertiesValid;
+ private bool renderUplevel;
+
+ protected BaseValidator() : base()
+ {
+ isValid = true;
+ ForeColor = Color.Red;
+ }
+
+ public string ControlToValidate
+ {
+ get
+ {
+ object o = ViewState["ControlToValidate"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ControlToValidate"] = value;
+ }
+ }
+
+ public ValidatorDisplay Display
+ {
+ get
+ {
+ object o = ViewState["Display"];
+ if(o != null)
+ {
+ return (ValidatorDisplay)o;
+ }
+ return ValidatorDisplay.Static;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(ValidatorDisplay), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["ValidatorDisplay"] = value;
+ }
+ }
+
+ public bool EnableClientScript
+ {
+ get
+ {
+ object o = ViewState["EnableClientScript"];
+ if(o != null)
+ {
+ return (bool)o;
+ }
+ return true;
+ }
+ set
+ {
+ ViewState["EnableClientScript"] = value;
+ }
+ }
+
+ public override bool Enabled
+ {
+ get
+ {
+ return Enabled;
+ }
+ set
+ {
+ Enabled = value;
+ }
+ }
+
+ public string ErrorMessage
+ {
+ get
+ {
+ object o = ViewState["ErrorMessage"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ErrorMessage"] = value;
+ }
+ }
+
+ public override Color ForeColor
+ {
+ get
+ {
+ return ForeColor;
+ }
+ set
+ {
+ ForeColor = value;
+ }
+ }
+
+ public bool IsValid
+ {
+ get
+ {
+ object o = ViewState["IsValid"];
+ if(o != null)
+ {
+ return (bool)o;
+ }
+ return true;
+ }
+ set
+ {
+ ViewState["IsValid"] = value;
+ }
+ }
+
+ public static PropertyDescriptor GetValidationProperty(object component)
+ {
+ ValidationPropertyAttribute attrib = (ValidationPropertyAttribute)((TypeDescriptor.GetAttributes(component))[typeof(ValidationPropertyAttribute)]);
+ if(attrib != null && attrib.Name != null)
+ {
+ return (TypeDescriptor.GetProperties(component, null))[attrib.Name];
+ }
+ return null;
+ }
+
+ public void Validate()
+ {
+ if(!Visible || (Visible && !Enabled))
+ {
+ IsValid = true;
+ }
+ Control ctrl = Parent;
+ while(ctrl != null)
+ {
+ if(!ctrl.Visible)
+ {
+ IsValid = true;
+ return;
+ }
+ ctrl = ctrl.Parent;
+ }
+ isPropertiesChecked = false;
+ if(!PropertiesValid)
+ {
+ IsValid = true;
+ return;
+ }
+ IsValid = EvaluateIsValid();
+ }
+
+ protected bool PropertiesValid
+ {
+ get
+ {
+ if(!isPropertiesChecked)
+ {
+ propertiesValid = ControlPropertiesValid();
+ isPropertiesChecked = true;
+ }
+ return propertiesValid;
+ }
+ }
+
+ protected bool RenderUplevel
+ {
+ get
+ {
+ return renderUplevel;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ bool enabled = Enabled;
+ if(!Enabled)
+ {
+ Enabled = true;
+ }
+ AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+ if(ID == null)
+ {
+ writer.AddAttribute("id", ClientID);
+ }
+ if(ControlToValidate.Length > 0)
+ {
+ writer.AddAttribute("controltovalidate", GetControlRenderID(ControlToValidate));
+ }
+ if(ErrorMessage.Length > 0)
+ {
+ writer.AddAttribute("errormessage", ErrorMessage, true);
+ }
+ if(Display == ValidatorDisplay.Static)
+ {
+ writer.AddAttribute("display", Enum.Format(typeof(ValidatorDisplay), Display, "G").Replace('_','-'));
+ //writer.AddAttribute("display", PropertyConverter.EnumToString(typeof(ValidatorDisplay), Display));
+ }
+ if(!IsValid)
+ {
+ writer.AddAttribute("isvalid", "False");
+ }
+ if(!enabled)
+ {
+ writer.AddAttribute("enabled", "False");
+ }
+ }
+ if(!enabled)
+ {
+ Enabled = false;
+ }
+ }
+
+ [MonoTODO]
+ protected void CheckControlValidationProperty(string name, string propertyName)
+ {
+ Control ctrl = NamingContainer.FindControl(name);
+ if(ctrl == null)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_control_not_found",
+ name, propertyName/*, ID*/));
+ }
+ PropertyDescriptor pd = GetValidationProperty(ctrl);
+ if(pd == null)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_bad_control_type",
+ name, propertyName/*, ID*/));
+ }
+ }
+
+ protected virtual bool ControlPropertiesValid()
+ {
+ if(ControlToValidate.Length == 0)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_control_blank", ID));
+ }
+ CheckControlValidationProperty(ControlToValidate, "ControlToValidate");
+ return true;
+ }
+
+ [MonoTODO]
+ protected virtual bool DetermineRenderUplevel()
+ {
+ Page page = Page;
+ if(page == null || page.Request == null)
+ {
+ return false;
+ }
+ if(EnableClientScript)
+ {
+ throw new NotImplementedException();
+ //TODO: I need to get the (Browser->Dom_version_major >= 4 &&
+ // Brower->Ecma_script_version >= 1.2)
+ }
+ return false;
+ }
+
+ protected string GetControlRenderID(string name)
+ {
+ Control ctrl = FindControl(name);
+ if(ctrl != null)
+ {
+ return ctrl.ClientID;
+ }
+ return String.Empty;
+ }
+
+ protected string GetControlValidationValue(string name)
+ {
+ Control ctrl = NamingContainer.FindControl(name);
+ if(ctrl != null)
+ {
+ PropertyDescriptor pd = GetValidationProperty(ctrl);
+ if(pd != null)
+ {
+ object item = pd.GetValue(ctrl);
+ if(item is ListItem)
+ {
+ return ((ListItem)item).Value;
+ }
+ return item.ToString();
+ }
+ }
+ return null;
+ }
+
+ protected override void OnInit(EventArgs e)
+ {
+ OnInit(e);
+ Page.Validators.Add(this);
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ OnPreRender(e);
+ isPreRenderCalled = true;
+ isPropertiesChecked = false;
+ renderUplevel = DetermineRenderUplevel();
+ if(renderUplevel)
+ {
+ RegisterValidatorCommonScript();
+ }
+ }
+
+ protected override void OnUnload(EventArgs e)
+ {
+ if(Page != null)
+ {
+ Page.Validators.Remove(this);
+ }
+ OnUnload(e);
+ }
+
+ [MonoTODO("What_do_I_have_to_do")]
+ protected void RegisterValidatorCommonScript()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("I_have_to_know_javascript_for_this_I_know_it_but_for_ALL_browsers_NO")]
+ protected virtual void RegisterValidatorDeclaration()
+ {
+ throw new NotImplementedException();
+ //TODO: Since I have to access document.<ClientID> and register
+ // as page validator. Now this is Browser dependent :((
+ }
+
+ [MonoTODO("Render_ing_always_left")]
+ protected override void Render(HtmlTextWriter writer)
+ {
+ bool valid;
+ if(isPreRenderCalled)
+ {
+ valid = (Enabled && IsValid);
+ } else
+ {
+ isPropertiesChecked = true;
+ propertiesValid = true;
+ renderUplevel = false;
+ valid = true;
+ }
+ if(PropertiesValid)
+ {
+ if(Page != null)
+ {
+ Page.VerifyRenderingInServerForm(this);
+ }
+ ValidatorDisplay dis = Display;
+ if(RenderUplevel)
+ {
+ throw new NotImplementedException();
+ }
+ throw new NotImplementedException();
+ }
+ return;
+ }
+
+ protected abstract bool EvaluateIsValid();
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs
new file mode 100755
index 00000000000..93c04f1f213
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BorderStyle.cs
@@ -0,0 +1,29 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: BorderStyle
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum BorderStyle
+ {
+ NotSet,
+ None,
+ Dotted,
+ Dashed,
+ Solid,
+ Double,
+ Groove,
+ Ridge,
+ Inset,
+ Outset
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs
new file mode 100755
index 00000000000..13bcb75f8db
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/BoundColumn.cs
@@ -0,0 +1,109 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: BoundColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 60%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class BoundColumn : DataGridColumn
+ {
+ public static readonly string thisExpr = "!";
+
+ private string dataField;
+ private string dataFormatString;
+ private bool readOnly;
+
+ private PropertyDescriptor desc;
+
+ public BoundColumn(): base()
+ {
+ //TODO: The start work
+ Initialize();
+ }
+
+ public override void Initialize()
+ {
+ base.Initialize();
+ dataField = String.Empty;
+ dataFormatString = String.Empty;
+ readOnly = false;
+ desc = null;
+ }
+
+ [MonoTODO]
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ //TODO: What to do?
+ InitializeCell(cell, columnIndex, itemType);
+// switch(itemType)
+// {
+// case
+// }
+ throw new NotImplementedException();
+ }
+
+ public virtual string DataField
+ {
+ get
+ {
+ return dataField;
+ }
+ set
+ {
+ dataField = value;
+ }
+ }
+
+ public virtual string DataFormatString
+ {
+ get
+ {
+ return dataFormatString;
+ }
+ set
+ {
+ dataFormatString = value;
+ }
+ }
+
+ public virtual bool ReadOnly
+ {
+ get
+ {
+ return readOnly;
+ }
+ set
+ {
+ readOnly = value;
+ }
+ }
+
+ [MonoTODO]
+ protected virtual string FormatDataValue(Object dataValue)
+ {
+ // TODO: How to extract the value from the object?
+ // TODO: Then format the value. Here's a possible solution
+ if(dataFormatString == null || dataFormatString.Equals(String.Empty))
+ return dataValue.ToString();
+ if(dataValue is DateTime)
+ return ((DateTime)dataValue).ToString(dataFormatString);
+ throw new NotImplementedException();
+ // and so on for int, String, double..
+ // something's wrong here. there must be some shorter method!
+ //string val = dataValue.toString(dataFormatString);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Button.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Button.cs
new file mode 100755
index 00000000000..d9a1d375ebe
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Button.cs
@@ -0,0 +1,169 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Button
+ *
+ * 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)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("Click")]
+ [DefaultProperty("Text")]
+ //TODO: [Designer("??")]
+ //TODO: [DataBindingHandler("??UI.Design.TextDataBindingHandler??")]
+ [ToolboxData("<{0}:Button runat=\"server\" Text=\"Button\"></{0}:Button>")]
+ public class Button : WebControl, IPostBackEventHandler
+ {
+ private static readonly object ClickEvent = new object();
+ private static readonly object CommandEvent = new object();
+
+ //private EventHandlerList ehList;
+
+ public Button(): base(HtmlTextWriterTag.Button)
+ {
+ }
+
+ public bool CausesValidation
+ {
+ get
+ {
+ Object cv = ViewState["CausesValidation"];
+ if(cv!=null)
+ return (Boolean)cv;
+ return true;
+ }
+ set
+ {
+ ViewState["CausesValidation"] = value;
+ }
+ }
+
+ public string CommandArgument
+ {
+ get
+ {
+ string ca = (string) ViewState["CommandArgument"];
+ if(ca!=null)
+ return ca;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandArgument"] = value;
+ }
+ }
+
+ public string CommandName
+ {
+ get
+ {
+ string cn = (string)ViewState["CommandName"];
+ if(cn!=null)
+ return cn;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandName"] = value;
+ }
+ }
+
+ public string Text
+ {
+ get
+ {
+ string text = (string)ViewState["Text"];
+ if(text!=null)
+ return text;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+
+ public event EventHandler Click
+ {
+ add
+ {
+ Events.AddHandler(ClickEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ClickEvent, value);
+ }
+ }
+
+ public event CommandEventHandler Command
+ {
+ add
+ {
+ Events.AddHandler(CommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CommandEvent, value);
+ }
+ }
+
+ protected virtual void OnClick(EventArgs e)
+ {
+ if(Events != null)
+ {
+ EventHandler eh = (EventHandler)(Events[ClickEvent]);
+ if(eh!= null)
+ eh(this,e);
+ }
+ }
+
+ protected virtual void OnCommand(CommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ EventHandler eh = (EventHandler)(Events[CommandEvent]);
+ if(eh!= null)
+ eh(this,e);
+ }
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+ {
+ if(CausesValidation)
+ {
+ Page.Validate();
+ OnClick(new EventArgs());
+ OnCommand(new CommandEventArgs(CommandName, CommandArgument));
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Type,"submit");
+ writer.AddAttribute(HtmlTextWriterAttribute.Name,base.UniqueID);
+ writer.AddAttribute(HtmlTextWriterAttribute.Value,Text);
+ if(Page!=null && CausesValidation && Page.Validators.Count > 0)
+ {
+ writer.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Onclick, Utils.GetClientValidatedEvent());
+ writer.AddAttribute("language", "javascript");
+ }
+ AddAttributesToRender(writer);
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ // Preventing subclasses to do anything
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs
new file mode 100755
index 00000000000..23db52724d6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumn.cs
@@ -0,0 +1,186 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ButtonColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ButtonColumn : DataGridColumn
+ {
+ private PropertyDescriptor textFieldDescriptor;
+
+ public ButtonColumn(): base()
+ {
+ }
+
+ public override void Initialize()
+ {
+ Initialize();
+ textFieldDescriptor = null;
+ }
+
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ InitializeCell(cell, columnIndex, itemType);
+ if(Enum.IsDefined(typeof(ListItemType), itemType) && itemType != ListItemType.Footer)
+ {
+ WebControl toDisplay = null;
+ if(ButtonType == ButtonColumnType.PushButton)
+ {
+ Button b = new Button();
+ b.Text = Text;
+ b.CommandName = CommandName;
+ b.CausesValidation = false;
+ toDisplay = b;
+ } else
+ {
+ LinkButton lb = new LinkButton();
+ lb.Text = Text;
+ lb.CommandName = CommandName;
+ lb.CausesValidation = false;
+ toDisplay = lb;
+ }
+ if(DataTextField.Length > 0)
+ {
+ toDisplay.DataBinding += new EventHandler(OnDataBindButtonColumn);
+ }
+ cell.Controls.Add(toDisplay);
+ }
+ }
+
+ private void OnDataBindButtonColumn(object sender, EventArgs e)
+ {
+ Control ctrl = (Control)sender;
+ object item = ((DataGridItem)ctrl.NamingContainer).DataItem;
+ if(textFieldDescriptor == null)
+ {
+ textFieldDescriptor = TypeDescriptor.GetProperties(item).Find(DataTextField, true);
+ if(textFieldDescriptor == null && !DesignMode)
+ throw new HttpException(HttpRuntime.FormatResourceString("Field_Not_Found", DataTextField));
+ }
+ string text;
+ if(textFieldDescriptor != null)
+ {
+ text = FormatDataTextValue(textFieldDescriptor.GetValue(item));
+ } else
+ {
+ text = "Sample_DataBound_Text";
+ }
+ if(ctrl is LinkButton)
+ {
+ ((LinkButton)ctrl).Text = text;
+ }
+ else
+ {
+ ((Button)ctrl).Text = text;
+ }
+ }
+
+ protected virtual string FormatDataTextValue(object dataTextValue)
+ {
+ string retVal = null;
+ if(dataTextValue != null)
+ {
+ if(DataTextFormatString.Length > 0)
+ {
+ retVal = String.Format((string)dataTextValue, DataTextFormatString);
+ }
+ else
+ {
+ retVal = dataTextValue.ToString();
+ }
+ }
+ return retVal;
+ }
+
+ public virtual ButtonColumnType ButtonType
+ {
+ get
+ {
+ object o = ViewState["ButtonType"];
+ if(o!=null)
+ return (ButtonColumnType)o;
+ return ButtonColumnType.LinkButton;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(ButtonColumnType), value))
+ throw new ArgumentException();
+ ViewState["ButtonType"] = value;
+ }
+ }
+
+ public virtual string CommandName
+ {
+ get
+ {
+ string cn = (string)ViewState["CommandName"];
+ if(cn!=null)
+ return cn;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandName"] = value;
+ }
+ }
+
+ public virtual string DataTextField
+ {
+ get
+ {
+ string dtf = (string)ViewState["DataTextField"];
+ if(dtf!=null)
+ return dtf;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextField"] = value;
+ }
+ }
+
+ public virtual string DataTextFormatString
+ {
+ get
+ {
+ string dtfs = (string)ViewState["DataTextFormatString"];
+ if(dtfs!=null)
+ return dtfs;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextFormatString"] = value;
+ }
+ }
+
+ public virtual string Text
+ {
+ get
+ {
+ string text = (string)ViewState["Text"];
+ if(text!=null)
+ return text;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs
new file mode 100755
index 00000000000..ed59eba315b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ButtonColumnType.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ButtonColumnType
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ButtonColumnType
+ {
+ LinkButton,
+ PushButton
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
new file mode 100755
index 00000000000..ea553cc19b8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Calendar.cs
@@ -0,0 +1,1111 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Calendar
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 98%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Globalization;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("SelectionChanged")]
+ [DefaultProperty("SelectedDate")]
+ //TODO: [Designer("??")]
+ //[DataBindingHandler("??")]
+ public class Calendar : WebControl, IPostBackEventHandler
+ {
+ //
+ private TableItemStyle dayHeaderStyle;
+ private TableItemStyle dayStyle;
+ private TableItemStyle nextPrevStyle;
+ private TableItemStyle otherMonthDayStyle;
+ private SelectedDatesCollection selectedDates;
+ private ArrayList selectedDatesList;
+ private TableItemStyle selectedDayStyle;
+ private TableItemStyle selectorStyle;
+ private TableItemStyle titleStyle;
+ private TableItemStyle todayDayStyle;
+ private TableItemStyle weekendDayStyle;
+
+ private static readonly object DayRenderEvent = new object();
+ private static readonly object SelectionChangedEvent = new object();
+ private static readonly object VisibleMonthChangedEvent = new object();
+
+ private Color defaultTextColor;
+ private System.Globalization.Calendar globCal;
+
+ private static int MASK_WEEKEND = (0x01 << 0);
+ private static int MASK_OMONTH = (0x01 << 1);
+ private static int MASK_TODAY = (0x01 << 2);
+ private static int MASK_SELECTED = (0x01 << 3);
+ private static int MASK_DAY = (0x01 << 4);
+ private static int MASK_UNIQUE = MASK_WEEKEND | MASK_OMONTH | MASK_TODAY | MASK_SELECTED;
+
+ public Calendar(): base()
+ {
+ //TODO: Initialization
+ }
+
+ public int CellPadding
+ {
+ get
+ {
+ object o = ViewState["CellPadding"];
+ if(o!=null)
+ return (int)o;
+ return 2;
+ }
+ set
+ {
+ ViewState["CellPadding"] = value;
+ }
+ }
+
+ public int CellSpacing
+ {
+ get
+ {
+ object o = ViewState["CellSpacing"];
+ if(o!=null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value<-1)
+ throw new ArgumentOutOfRangeException();
+ ViewState["CellSpacing"] = value;
+ }
+ }
+
+ public TableItemStyle DayHeaderStyle
+ {
+ get
+ {
+ if(dayHeaderStyle==null)
+ dayHeaderStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ dayHeaderStyle.TrackViewState();
+ return dayHeaderStyle;
+ }
+ }
+
+ public DayNameFormat DayNameFormat
+ {
+ get
+ {
+ object o = ViewState["DayNameFormat"];
+ if(o!=null)
+ return (DayNameFormat)o;
+ return DayNameFormat.Short;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(DayNameFormat),value))
+ throw new ArgumentException();
+ ViewState["DayNameFormat"] = value;
+ }
+ }
+
+ public TableItemStyle DayStyle
+ {
+ get
+ {
+ if(dayStyle==null)
+ dayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ dayStyle.TrackViewState();
+ return dayStyle;
+ }
+ }
+
+ public FirstDayOfWeek FirstDayOfWeek
+ {
+ get
+ {
+ object o = ViewState["FirstDayOfWeek"];
+ if(o!=null)
+ return (FirstDayOfWeek)o;
+ return FirstDayOfWeek.Default;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(FirstDayOfWeek), value))
+ throw new ArgumentException();
+ ViewState["FirstDayOfWeek"] = value;
+ }
+ }
+
+ public string NextMonthText
+ {
+ get
+ {
+ object o = ViewState["NextMonthText"];
+ if(o!=null)
+ return (string)o;
+ return "&gt;";
+ }
+ set
+ {
+ ViewState["NextMonthText"] = value;
+ }
+ }
+
+ public NextPrevFormat NextPrevFormat
+ {
+ get
+ {
+ object o = ViewState["NextPrevFormat"];
+ if(o!=null)
+ return (NextPrevFormat)o;
+ return NextPrevFormat.CustomText;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(NextPrevFormat), value))
+ throw new ArgumentException();
+ ViewState["NextPrevFormat"] = value;
+ }
+ }
+
+ public TableItemStyle NextPrevStyle
+ {
+ get
+ {
+ if(nextPrevStyle == null)
+ nextPrevStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ nextPrevStyle.TrackViewState();
+ return nextPrevStyle;
+ }
+ }
+
+ public TableItemStyle OtherMonthDayStyle
+ {
+ get
+ {
+ if(otherMonthDayStyle == null)
+ otherMonthDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ otherMonthDayStyle.TrackViewState();
+ return otherMonthDayStyle;
+ }
+ }
+
+ public string PrevMonthText
+ {
+ get
+ {
+ object o = ViewState["PrevMonthText"];
+ if(o!=null)
+ return (string)o;
+ return "&lt;";
+ }
+ set
+ {
+ ViewState["PrevMonthText"] = value;
+ }
+ }
+
+ public DateTime SelectedDate
+ {
+ get
+ {
+ if(SelectedDates.Count > 0)
+ {
+ return SelectedDates[0];
+ }
+ return DateTime.MinValue;
+ }
+ set
+ {
+ if(value == DateTime.MinValue)
+ {
+ SelectedDates.Clear();
+ } else
+ {
+ SelectedDates.SelectRange(value, value);
+ }
+ }
+ }
+
+ public SelectedDatesCollection SelectedDates
+ {
+ get
+ {
+ if(selectedDates==null)
+ {
+ if(selectedDatesList == null)
+ selectedDatesList = new ArrayList();
+ selectedDates = new SelectedDatesCollection(selectedDatesList);
+ }
+ return selectedDates;
+ }
+ }
+
+ public TableItemStyle SelectedDayStyle
+ {
+ get
+ {
+ if(selectedDayStyle==null)
+ selectedDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ selectedDayStyle.TrackViewState();
+ return selectedDayStyle;
+ }
+ }
+
+ public CalendarSelectionMode SelectionMode
+ {
+ get
+ {
+ object o = ViewState["SelectionMode"];
+ if(o!=null)
+ return (CalendarSelectionMode)o;
+ return CalendarSelectionMode.Day;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(CalendarSelectionMode), value))
+ throw new ArgumentException();
+ ViewState["SelectionMode"] = value;
+ }
+ }
+
+ public string SelectMonthText
+ {
+ get
+ {
+ object o = ViewState["SelectMonthText"];
+ if(o!=null)
+ return (string)o;
+ return "&gt;&gt;";
+ }
+ set
+ {
+ ViewState["SelectMonthText"] = value;
+ }
+ }
+
+ public TableItemStyle SelectorStyle
+ {
+ get
+ {
+ if(selectorStyle==null)
+ selectorStyle = new TableItemStyle();
+ return selectorStyle;
+ }
+ }
+
+ public string SelectWeekText
+ {
+ get
+ {
+ object o = ViewState["SelectWeekText"];
+ if(o!=null)
+ return (string)o;
+ return "&gt;";
+ }
+ set
+ {
+ ViewState["SelectWeekText"] = value;
+ }
+ }
+
+ public bool ShowDayHeader
+ {
+ get
+ {
+ object o = ViewState["ShowDayHeader"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowDayHeader"] = value;
+ }
+ }
+
+ public bool ShowGridLines
+ {
+ get
+ {
+ object o = ViewState["ShowGridLines"];
+ if(o!=null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ShowGridLines"] = value;
+ }
+ }
+
+ public bool ShowNextPrevMonth
+ {
+ get
+ {
+ object o = ViewState["ShowNextPrevMonth"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowNextPrevMonth"] = value;
+ }
+ }
+
+ public bool ShowTitle
+ {
+ get
+ {
+ object o = ViewState["ShowTitle"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowTitle"] = value;
+ }
+ }
+
+ public TitleFormat TitleFormat
+ {
+ get
+ {
+ object o = ViewState["TitleFormat"];
+ if(o!=null)
+ return (TitleFormat)o;
+ return TitleFormat.MonthYear;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(TitleFormat), value))
+ throw new ArgumentException();
+ ViewState["TitleFormat"] = value;
+ }
+ }
+
+ public TableItemStyle TitleStyle
+ {
+ get
+ {
+ if(titleStyle==null)
+ titleStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ titleStyle.TrackViewState();
+ return titleStyle;
+ }
+ }
+
+ public TableItemStyle TodayDayStyle
+ {
+ get
+ {
+ if(todayDayStyle==null)
+ todayDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ todayDayStyle.TrackViewState();
+ return todayDayStyle;
+ }
+ }
+
+ public DateTime TodaysDate
+ {
+ get
+ {
+ object o = ViewState["TodaysDate"];
+ if(o!=null)
+ return (DateTime)o;
+ return DateTime.Today;
+ }
+ set
+ {
+ ViewState["TodaysDate"] = value;
+ }
+ }
+
+ public DateTime VisibleDate
+ {
+ get
+ {
+ object o = ViewState["VisibleDate"];
+ if(o!=null)
+ return (DateTime)o;
+ return DateTime.MinValue;
+ }
+ set
+ {
+ ViewState["VisibleDate"] = value;
+ }
+ }
+
+ public TableItemStyle WeekendDayStyle
+ {
+ get
+ {
+ if(weekendDayStyle == null)
+ weekendDayStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ weekendDayStyle.TrackViewState();
+ }
+ return weekendDayStyle;
+ }
+ }
+
+ public event DayRenderEventHandler DayRender
+ {
+ add
+ {
+ Events.AddHandler(DayRenderEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DayRenderEvent, value);
+ }
+ }
+
+ public event EventHandler SelectionChanged
+ {
+ add
+ {
+ Events.AddHandler(SelectionChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SelectionChangedEvent, value);
+ }
+ }
+
+ public event MonthChangedEventHandler VisibleMonthChanged
+ {
+ add
+ {
+ Events.AddHandler(VisibleMonthChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(VisibleMonthChangedEvent, value);
+ }
+ }
+
+ protected virtual void OnDayRender(TableCell cell, CalendarDay day)
+ {
+ if(Events!=null)
+ {
+ DayRenderEventHandler dreh = (DayRenderEventHandler)(Events[DayRenderEvent]);
+ if(dreh!=null)
+ dreh(this, new DayRenderEventArgs(cell, day));
+ }
+ }
+
+ protected virtual void OnSelectionChanged()
+ {
+ if(Events!=null)
+ {
+ EventHandler eh = (EventHandler)(Events[SelectionChangedEvent]);
+ if(eh!=null)
+ eh(this, new EventArgs());
+ }
+ }
+
+ protected virtual void OnVisibleMonthChanged(DateTime newDate, DateTime prevDate)
+ {
+ if(Events!=null)
+ {
+ MonthChangedEventHandler mceh = (MonthChangedEventHandler)(Events[VisibleMonthChangedEvent]);
+ if(mceh!=null)
+ mceh(this, new MonthChangedEventArgs(newDate, prevDate));
+ }
+ }
+
+ /// <remarks>
+ /// See test6.aspx in Tests directory for verification
+ /// </remarks>
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+ {
+ globCal = DateTimeFormatInfo.CurrentInfo.Calendar;
+ DateTime visDate = GetEffectiveVisibleDate();
+ //FIXME: Should it be String.Compare(eventArgument, "nextMonth", false);
+ if(eventArgument == "nextMonth")
+ {
+ VisibleDate = globCal.AddMonths(visDate, 1);
+ OnVisibleMonthChanged(VisibleDate, visDate);
+ return;
+ }
+ if(eventArgument == "prevMonth")
+ {
+ VisibleDate = globCal.AddMonths(visDate, -1);
+ OnVisibleMonthChanged(VisibleDate, visDate);
+ return;
+ }
+ if(eventArgument == "selectMonth")
+ {
+ DateTime oldDate = new DateTime(globCal.GetYear(visDate), globCal.GetMonth(visDate), 1, globCal);
+ SelectRangeInternal(oldDate, globCal.AddDays(globCal.AddMonths(oldDate, 1), -1), visDate);
+ return;
+ }
+ if(String.Compare(eventArgument, 0, "selectWeek", 0, "selectWeek".Length)==0)
+ {
+ int week = -1;
+ try
+ {
+ week = Int32.Parse(eventArgument.Substring("selectWeek".Length));
+ } catch(Exception e)
+ {
+ }
+ if(week >= 0 && week <= 5)
+ {
+ DateTime weekStart = globCal.AddDays(GetFirstCalendarDay(visDate), week * 7);
+ SelectRangeInternal(weekStart, globCal.AddDays(weekStart, 6), visDate);
+ }
+ return;
+ }
+ if(String.Compare(eventArgument, 0, "selectDay", 0, "selectDay".Length)==0)
+ {
+ int day = -1;
+ try
+ {
+ day = Int32.Parse(eventArgument.Substring("selectDay".Length));
+ } catch(Exception e)
+ {
+ }
+ if(day >= 0 && day <= 42)
+ {
+ DateTime dayStart = globCal.AddDays(GetFirstCalendarDay(visDate), day);
+ SelectRangeInternal(dayStart, dayStart, visDate);
+ }
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ //TODO: Implement me
+ globCal = DateTimeFormatInfo.CurrentInfo.Calendar;
+ DateTime visDate = GetEffectiveVisibleDate();
+ DateTime firstDate = GetFirstCalendarDay(visDate);
+
+ bool isEnabled = false;
+ bool isHtmlTextWriter = false;
+ if(Page == null || Site == null)
+ {
+ isEnabled = false;
+ isHtmlTextWriter = false;
+ } else
+ {
+ isEnabled = Enabled;
+ isHtmlTextWriter = (writer.GetType() != typeof(HtmlTextWriter));
+ }
+ defaultTextColor = ForeColor;
+ if(defaultTextColor == Color.Empty)
+ defaultTextColor = Color.Black;
+
+ Table calTable = new Table();
+ calTable.ID = ID;
+ calTable.CopyBaseAttributes(this);
+ if(ControlStyleCreated)
+ ApplyStyle(ControlStyle);
+ calTable.Width = Width;
+ calTable.Height = Height;
+ calTable.CellSpacing = CellSpacing;
+ calTable.CellPadding = CellPadding;
+
+ if(ControlStyleCreated && ControlStyle.IsSet(WebControls.Style.BORDERWIDTH) && BorderWidth != Unit.Empty)
+ {
+ calTable.BorderWidth = BorderWidth;
+ } else
+ {
+ calTable.BorderWidth = Unit.Pixel(1);
+ }
+
+ if(ShowGridLines)
+ calTable.GridLines = GridLines.Both;
+ else
+ calTable.GridLines = GridLines.None;
+
+ calTable.RenderBeginTag(writer);
+ if(ShowTitle)
+ RenderTitle(writer, visDate, SelectionMode, isEnabled);
+ if(ShowDayHeader)
+ RenderHeader(writer, firstDate, SelectionMode, isEnabled, isHtmlTextWriter);
+ RenderAllDays(writer, firstDate, visDate, SelectionMode, isEnabled, isHtmlTextWriter);
+
+ calTable.RenderEndTag(writer);
+ }
+
+ protected override ControlCollection CreateControlCollection()
+ {
+ return new EmptyControlCollection(this);
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if(savedState!=null)
+ {
+ if(ViewState["_CalendarSelectedDates"] != null)
+ selectedDates = (SelectedDatesCollection)ViewState["_CalendarSelectedDates"];
+
+ object[] states = (object[]) savedState;
+ if(states[0] != null)
+ base.LoadViewState(states[0]);
+ if(states[1] != null)
+ DayHeaderStyle.LoadViewState(states[1]);
+ if(states[2] != null)
+ DayStyle.LoadViewState(states[2]);
+ if(states[3] != null)
+ NextPrevStyle.LoadViewState(states[3]);
+ if(states[4] != null)
+ OtherMonthDayStyle.LoadViewState(states[4]);
+ if(states[5] != null)
+ SelectedDayStyle.LoadViewState(states[5]);
+ if(states[6] != null)
+ SelectorStyle.LoadViewState(states[6]);
+ if(states[7] != null)
+ TitleStyle.LoadViewState(states[7]);
+ if(states[8] != null)
+ TodayDayStyle.LoadViewState(states[8]);
+ if(states[9] != null)
+ WeekendDayStyle.LoadViewState(states[9]);
+ }
+ }
+
+ protected override object SaveViewState()
+ {
+ ViewState["_CalendarSelectedDates"] = (SelectedDates.Count > 0 ? selectedDates : null);
+ object[] states = new object[11];
+ states[0] = base.SaveViewState();
+ states[1] = (dayHeaderStyle == null ? null : dayHeaderStyle.SaveViewState());
+ states[2] = (dayStyle == null ? null : dayStyle.SaveViewState());
+ states[3] = (nextPrevStyle == null ? null : nextPrevStyle.SaveViewState());
+ states[4] = (otherMonthDayStyle == null ? null : otherMonthDayStyle.SaveViewState());
+ states[5] = (selectedDayStyle == null ? null : selectedDayStyle.SaveViewState());
+ states[6] = (selectorStyle == null ? null : selectorStyle.SaveViewState());
+ states[7] = (titleStyle == null ? null : titleStyle.SaveViewState());
+ states[8] = (todayDayStyle == null ? null : todayDayStyle.SaveViewState());
+ states[9] = (weekendDayStyle == null ? null : weekendDayStyle.SaveViewState());
+ for(int i=0; i < states.Length; i++)
+ {
+ if(states[i]!=null)
+ return states;
+ }
+ return null;
+ }
+
+ protected override void TrackViewState()
+ {
+ TrackViewState();
+ if(titleStyle!=null)
+ {
+ titleStyle.TrackViewState();
+ }
+ if(nextPrevStyle!=null)
+ {
+ nextPrevStyle.TrackViewState();
+ }
+ if(dayStyle!=null)
+ {
+ dayStyle.TrackViewState();
+ }
+ if(dayHeaderStyle!=null)
+ {
+ dayHeaderStyle.TrackViewState();
+ }
+ if(todayDayStyle!=null)
+ {
+ todayDayStyle.TrackViewState();
+ }
+ if(weekendDayStyle!=null)
+ {
+ weekendDayStyle.TrackViewState();
+ }
+ if(otherMonthDayStyle!=null)
+ {
+ otherMonthDayStyle.TrackViewState();
+ }
+ if(selectedDayStyle!=null)
+ {
+ selectedDayStyle.TrackViewState();
+ }
+ if(selectorStyle!=null)
+ {
+ selectorStyle.TrackViewState();
+ }
+ }
+
+ [MonoTODO("RenderAllDays")]
+ private void RenderAllDays(HtmlTextWriter writer, DateTime firstDay, DateTime activeDate, CalendarSelectionMode mode, bool isActive, bool isDownLevel)
+ {
+ /*
+ TableItemStyle weeksStyle;
+ Unit size;
+ string weeksCellData;
+ bool isWeekMode = (mode == CalendarSelectionMode.DayWeek || mode == CalendarSelectionMode.DayWeekMonth);
+ if(isWeekMode)
+ {
+ weeksStyle = new TableItemStyle();
+ weeksStyle.Width = Unit.Percentage(12);
+ weeksStyle.HorizontalAlign = HorizontalAlign.Center;
+ weeksStyle.CopyFrom(SelectorStyle);
+ size = Unit.Percentage(14);
+ if(!isDownLevel)
+ weeksCellData = GetHtmlForCell(weeksCell, isActive);
+ }
+ bool dayRenderBool = false;
+ if(GetType() != typeof(Calendar) || Events[DayRenderEvent] != null || !isDownLevel)
+ dayRenderBool = true;
+
+ string[] content = new string[0x01 << 4];
+ int definedStyles = MASK_SELECTED;
+ if(weekendStyle != null && !weekendStyle.IsEmpty)
+ definedStyles |= MASK_WEEKEND;
+ if(otherMonthStyle != null && !otherMonthStyle.IsEmpty)
+ definedStyles |= MASK_OMONTH;
+ if(todayDayStyle != null && todayDayStyle.IsEmpty)
+ definedStyles |= MASK_TODAY;
+ if(dayStyle != null && !dayStyle.IsEmpty)
+ definedStyles |= MASK_DAY;
+
+ bool selectDayBool = false;
+ if(isActive && mode != CalendarSelectionMode.None)
+ {
+ selectDayBool = true;
+ }
+
+ for(int crr = 0; crr < 6; crr++)
+ {
+ writer.Write("<tr>");
+ if(isWeekMode)
+ {
+ if(isDownLevel)
+ {
+ string cellText = GetCalendarLinkText("selectWeek" + crr.ToString(), SelectWeekText, isActive, weeksCell.ForeColor);
+ weeksCell.Text = cellText;
+ RenderCalendarCell(writer, weeksCell, cellText);
+ } else
+ {
+ if(isActive)
+ {
+ writer.Write(String.Format(weeksCellData, "selectWeek" + crr.ToString(), SelectWeekText));
+ } else
+ {
+ writer.Write(String.Format(weeksCellData, "selectWeek" + crr.ToString()));
+ }
+ }
+ }
+ for(int crc = 0; crc < 7; crc++)
+ {
+ // have to display for each day in the week.
+ throw new NotImplementedException();
+ }
+ }
+ */
+ throw new NotImplementedException();
+ }
+
+ private int GetMask(CalendarDay day)
+ {
+ int retVal = MASK_DAY;
+ if(day.IsSelected)
+ retVal |= MASK_SELECTED;
+ if(day.IsToday)
+ retVal |= MASK_TODAY;
+ if(day.IsOtherMonth)
+ retVal |= MASK_OMONTH;
+ if(day.IsWeekend)
+ retVal |= MASK_WEEKEND;
+ return retVal;
+ }
+
+ /// <remarks>
+ /// Refers to the second line of the calendar, that contains a link
+ /// to select whole month, and weekdays as defined by DayNameFormat
+ /// </remarks>
+ private void RenderHeader(HtmlTextWriter writer, DateTime firstDay, CalendarSelectionMode mode, bool isActive, bool isDownLevel)
+ {
+ writer.Write("<tr>");
+ bool isWeekMode = (mode == CalendarSelectionMode.DayWeek || mode == CalendarSelectionMode.DayWeekMonth);
+ TableCell headerCell = new TableCell();
+ headerCell.HorizontalAlign = HorizontalAlign.Center;
+ string selMthText = String.Empty;
+ if(isWeekMode)
+ {
+ headerCell.ApplyStyle(SelectorStyle);
+ selMthText = GetCalendarLinkText("selectMonth", SelectMonthText, SelectorStyle.ForeColor, isActive);
+ } else
+ {
+ headerCell.ApplyStyle(DayHeaderStyle);
+ }
+ RenderCalendarCell(writer, headerCell, selMthText);
+
+ TableCell dayHeaderCell = new TableCell();
+ dayHeaderCell.HorizontalAlign = HorizontalAlign.Center;
+ string content = null;
+ if(!isDownLevel)
+ {
+ content = GetHtmlForCell(dayHeaderCell, isActive);
+ }
+ int dayOfWeek = (int)globCal.GetDayOfWeek(firstDay);
+ DateTimeFormatInfo currDTInfo = DateTimeFormatInfo.CurrentInfo;
+ for(int currDay = dayOfWeek; currDay < dayOfWeek + 7; currDay++)
+ {
+ DayOfWeek effDay = (DayOfWeek) Enum.ToObject(typeof(DayOfWeek),currDay % 7);
+ string currDayContent = String.Empty;
+ switch(DayNameFormat)
+ {
+ case DayNameFormat.Full: currDayContent = currDTInfo.GetDayName(effDay);
+ break;
+ case DayNameFormat.FirstLetter: currDayContent = currDTInfo.GetDayName(effDay).Substring(0,1);
+ break;
+ case DayNameFormat.FirstTwoLetters: currDayContent = currDTInfo.GetDayName(effDay).Substring(0,2);
+ break;
+ case DayNameFormat.Short: goto default;
+ default: currDayContent = currDTInfo.GetAbbreviatedDayName(effDay);
+ break;
+ }
+ if(isDownLevel)
+ {
+ RenderCalendarCell(writer, dayHeaderCell, currDayContent);
+ } else
+ {
+ writer.Write(String.Format(content, currDayContent));
+ }
+ }
+ writer.Write("</tr>");
+ }
+
+ private void RenderTitle(HtmlTextWriter writer, DateTime visibleDate, CalendarSelectionMode mode, bool isActive)
+ {
+ writer.Write("<tr>");
+ Table innerTable = new Table();
+ TableCell titleCell = new TableCell();
+ bool isWeekMode = (mode == CalendarSelectionMode.DayWeek || mode == CalendarSelectionMode.DayWeekMonth);
+ titleCell.ColumnSpan = (isWeekMode ? 8 : 7);
+ titleCell.BackColor = Color.Silver;
+
+ innerTable.GridLines = GridLines.None;
+ innerTable.Width = Unit.Percentage(100);
+ innerTable.CellSpacing = 0;
+ ApplyTitleStyle(innerTable, titleCell, TitleStyle);
+
+ innerTable.RenderBeginTag(writer);
+ titleCell.RenderBeginTag(writer);
+
+ writer.Write("<tr>");
+ string prevContent = String.Empty;
+ if(ShowNextPrevMonth)
+ {
+ TableCell prevCell = new TableCell();
+ prevCell.Width = Unit.Percentage(15);
+ prevCell.HorizontalAlign = HorizontalAlign.Left;
+ if(NextPrevFormat == NextPrevFormat.CustomText)
+ {
+ prevContent = PrevMonthText;
+ } else
+ {
+ int pMthInt = globCal.GetMonth(globCal.AddMonths(visibleDate, -1));
+ if(NextPrevFormat == NextPrevFormat.FullMonth)
+ prevContent = DateTimeFormatInfo.CurrentInfo.GetMonthName(pMthInt);
+ else
+ prevContent = DateTimeFormatInfo.CurrentInfo.GetAbbreviatedMonthName(pMthInt);
+ }
+ prevCell.ApplyStyle(NextPrevStyle);
+ RenderCalendarCell(writer, prevCell, GetCalendarLinkText("prevMonth", prevContent, NextPrevStyle.ForeColor, isActive));
+ }
+ TableCell currCell = new TableCell();
+ currCell.Width = Unit.Percentage(70);
+ if(TitleStyle.HorizontalAlign == HorizontalAlign.NotSet)
+ currCell.HorizontalAlign = HorizontalAlign.Center;
+ else
+ currCell.HorizontalAlign = TitleStyle.HorizontalAlign;
+ currCell.Wrap = TitleStyle.Wrap;
+ string currMonthContent = String.Empty;
+ if(TitleFormat == TitleFormat.Month)
+ {
+ currMonthContent = visibleDate.ToString("MMMM");
+ } else
+ {
+ string cmcFmt = DateTimeFormatInfo.CurrentInfo.YearMonthPattern;
+ if(cmcFmt.IndexOf(',') >= 0)
+ {
+ cmcFmt = "MMMM yyyy";
+ }
+ currMonthContent = visibleDate.ToString(cmcFmt);
+ }
+ string nextContent = String.Empty;
+ if(ShowNextPrevMonth)
+ {
+ TableCell nextCell = new TableCell();
+ nextCell.Width = Unit.Percentage(15);
+ nextCell.HorizontalAlign = HorizontalAlign.Left;
+ if(NextPrevFormat == NextPrevFormat.CustomText)
+ {
+ nextContent = PrevMonthText;
+ } else
+ {
+ int nMthInt = globCal.GetMonth(globCal.AddMonths(visibleDate, 1));
+ if(NextPrevFormat == NextPrevFormat.FullMonth)
+ nextContent = DateTimeFormatInfo.CurrentInfo.GetMonthName(nMthInt);
+ else
+ nextContent = DateTimeFormatInfo.CurrentInfo.GetAbbreviatedMonthName(nMthInt);
+ }
+ nextCell.ApplyStyle(NextPrevStyle);
+ RenderCalendarCell(writer, nextCell, GetCalendarLinkText("nextMonth", nextContent, NextPrevStyle.ForeColor, isActive));
+ }
+
+ writer.Write("</tr>");
+ titleCell.RenderEndTag(writer);
+ innerTable.RenderEndTag(writer);
+
+ writer.Write("</tr>");
+ }
+
+ private void ApplyTitleStyle(Table table, TableCell cell, TableItemStyle style)
+ {
+ if(style.BackColor != Color.Empty)
+ {
+ cell.BackColor = style.BackColor;
+ }
+ if(style.BorderStyle != BorderStyle.NotSet)
+ {
+ cell.BorderStyle = style.BorderStyle;
+ }
+ if(style.BorderColor != Color.Empty)
+ {
+ cell.BorderColor = style.BorderColor;
+ }
+ if(style.BorderWidth != Unit.Empty)
+ {
+ cell.BorderWidth = style.BorderWidth;
+ }
+ if(style.Height != Unit.Empty)
+ {
+ cell.Height = style.Height;
+ }
+ if(style.VerticalAlign != VerticalAlign.NotSet)
+ {
+ cell.VerticalAlign = style.VerticalAlign;
+ }
+
+ if(style.ForeColor != Color.Empty)
+ {
+ table.ForeColor = style.ForeColor;
+ } else if(ForeColor != Color.Empty)
+ {
+ table.ForeColor = ForeColor;
+ }
+
+ table.Font.CopyFrom(style.Font);
+ table.Font.MergeWith(Font);
+ }
+
+ private void RenderCalendarCell(HtmlTextWriter writer, TableCell cell, string text)
+ {
+ cell.RenderBeginTag(writer);
+ writer.Write(text);
+ cell.RenderEndTag(writer);
+ }
+
+ private DateTime GetFirstCalendarDay(DateTime visibleDate)
+ {
+ DayOfWeek firstDay = DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek;
+ if(FirstDayOfWeek != FirstDayOfWeek.Default)
+ {
+ firstDay = (DayOfWeek) Enum.ToObject(typeof(DayOfWeek), (int)FirstDayOfWeek);
+ }
+ //FIXME: is (int)(Enum) correct?
+ int days = (int)globCal.GetDayOfWeek(visibleDate) - (int)firstDay;
+ if(days < 0)
+ {
+ days += 7;
+ }
+ return globCal.AddDays(visibleDate, -days);
+ }
+
+ private DateTime GetEffectiveVisibleDate()
+ {
+ DateTime dt = VisibleDate;
+ if(dt.Equals(DateTime.MinValue))
+ {
+ dt = TodaysDate;
+ }
+ return new DateTime(globCal.GetYear(dt), globCal.GetMonth(dt), globCal.GetDayOfMonth(dt), globCal);
+ }
+
+ /// <summary>
+ /// Creates text to be displayed, with all attributes if to be
+ /// shown as a hyperlink
+ /// </summary>
+ private string GetCalendarLinkText(string eventArg, string text, Color foreground, bool isLink)
+ {
+ if(isLink)
+ {
+ StringBuilder dispVal = new StringBuilder();
+ dispVal.Append("<a href=\"");
+ dispVal.Append(Page.GetPostBackClientHyperlink(this, eventArg));
+ dispVal.Append("\" style=\"color: ");
+ if(foreground.IsEmpty)
+ {
+ dispVal.Append(ColorTranslator.ToHtml(defaultTextColor));
+ } else
+ {
+ dispVal.Append(ColorTranslator.ToHtml(foreground));
+ }
+ dispVal.Append("\">");
+ dispVal.Append(text);
+ dispVal.Append("</a>");
+ return dispVal.ToString();
+ }
+ return text;
+ }
+
+ private string GetHtmlForCell(TableCell cell, bool showLinks)
+ {
+ StringWriter sw = new StringWriter();
+ HtmlTextWriter htw = new HtmlTextWriter(sw);
+ cell.RenderBeginTag(htw);
+ if(showLinks)
+ {
+ htw.Write(GetCalendarLinkText("{0}", "{1}", cell.ForeColor, showLinks));
+ } else
+ {
+ htw.Write("{0}");
+ }
+ cell.RenderEndTag(htw);
+ return sw.ToString();
+ }
+
+ internal void SelectRangeInternal(DateTime fromDate, DateTime toDate, DateTime visibleDate)
+ {
+ TimeSpan span = fromDate - toDate;
+ if(SelectedDates.Count != span.Days || SelectedDates[SelectedDates.Count - 1]!= toDate)
+ {
+ SelectedDates.SelectRange(fromDate, toDate);
+ OnSelectionChanged();
+ }
+ if(globCal.GetMonth(fromDate) == globCal.GetMonth(fromDate) && globCal.GetMonth(fromDate) != globCal.GetMonth(visibleDate))
+ {
+ VisibleDate = new DateTime(globCal.GetYear(fromDate), globCal.GetMonth(fromDate), 1, globCal);
+ OnVisibleMonthChanged(VisibleDate, visibleDate);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs
new file mode 100644
index 00000000000..bcd835c45e3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarDay.cs
@@ -0,0 +1,100 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: CalendarDay
+ *
+ * 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)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class CalendarDay
+ {
+ private DateTime date;
+ private bool isWeekend;
+ private bool isToday;
+ private bool isSelected;
+ private bool isOtherMonth;
+ private bool isSelectable;
+ private string dayNumberText;
+
+ public CalendarDay(DateTime date, bool isWeekend, bool isToday, bool isSelected, bool isOtherMonth, string dayNumberText)
+ {
+ this.date = date;
+ this.isWeekend = isWeekend;
+ this.isToday = isToday;
+ this.isSelected = isSelected;
+ this.isOtherMonth = isOtherMonth;
+ this.dayNumberText = dayNumberText;
+ }
+
+ public DateTime Date
+ {
+ get
+ {
+ return date;
+ }
+ }
+
+ public string DayNumberText
+ {
+ get
+ {
+ return dayNumberText;
+ }
+ }
+
+ public bool IsOtherMonth
+ {
+ get
+ {
+ return isOtherMonth;
+ }
+ }
+
+ public bool IsSelectable
+ {
+ get
+ {
+ return isSelectable;
+ }
+ set
+ {
+ isSelectable = value;
+ }
+ }
+
+ public bool IsSelected
+ {
+ get
+ {
+ return isSelected;
+ }
+ }
+
+ public bool IsToday
+ {
+ get
+ {
+ return isToday;
+ }
+ }
+
+ public bool IsWeekend
+ {
+ get
+ {
+ return isWeekend;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs
new file mode 100755
index 00000000000..54dd298f2e4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CalendarSelectionMode.cs
@@ -0,0 +1,23 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: CalendarSelectionMode
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum CalendarSelectionMode
+ {
+ None,
+ Day,
+ DayWeek,
+ DayWeekMonth
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
new file mode 100644
index 00000000000..2a132acf3d7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
@@ -0,0 +1,403 @@
+2002-03-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Removed extra methods, corrected access modifiers to several
+ methods.
+
+2002-03-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * <SeveralFiles>.cs - Added some attributes
+ * FontUnitConverter.cs - Added stubs for GetStandardValues*(..)
+ methods. Will complete them later. Right now, busy with
+ the attributes part.
+ * RepeaterItem.cs - Completed.
+
+ Oh God! Mercy! I will die applying attributes. I look at the missing
+ part in the class-status - daemon! Kyrie eleison!
+
+2002-03-19 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Some bug fixes
+
+ * AdRotator.cs - Added definition for Font.
+ * BaseCompareValidator.cs - Added definition for Controls.
+ * Calendar.cs - SelectMonthText definition corrected.
+ * DataList.cs - Added definition for SeparatorTemplate.
+ * BorderStyle.cs - Namespace correction. It belongs not to UI,
+ but to UI.WebControls.
+
+2002-03-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Finally, I have made it. Today I did a second build for the
+ System.Web assembly. It compiled 195 classes today.
+ I am waiting eagerly for the runtime to come up so that the objects
+ may be tested to their last levels. Several of the methods are still
+ under the tag of "TODO" throwing NotImplementedException. Well, I
+ hope to remove them soon, but how far is this soon - even I don't
+ know, though I am happy to make the build a success even before
+ the vacations to come.
+
+2002-03-07 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ Yesterday and today I tried to do some building of the aseembly,
+ but was dumped with uncoutably infinite errors. ;-)
+ I have put the copies of the recent errors on my home page, want
+ to have a look at them? See:
+ http://mastergaurav.virtualave.net/mono/
+ I don't know what to do with these errors. Oh! The buggy me! How
+ will I overcome myself. Hopefully, by when my vacations over, I
+ should have made a repository where the build will not fail.
+
+2002-03-05 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ I am now going to do a build that will include the
+ System.Web.UI.WebControls namespace. Hoping that I will make it
+ soon. My exams are coming near and I have to pack up soon.
+
+
+2002-03-04 Gaurav Vaish <gvaish@iitk.ac.in>
+
+Comments:
+ And with this, ie, today's work, all the objects mentioned in the
+ namespace appear in the implementation. But it may not be worth
+ trying to go for a build because of dependence of several of the
+ internal methods that may clash with already available assembly
+ System.Web.
+
+ Also, the classes lack possible attributes, like those informing
+ about child-controls etc. But I have to first create the attribute
+ classes before I attach the attributes to the classes.
+
+ * CustomValidator.cs - Completed. In process realized that
+ I have to complete / rejuvinate BaseValidator class.
+ * BaseValidator.cs - Complete rejuvination. Completed 80%
+ of the job. All that is left is Render(HtmlTextWriter),
+ DetermineRenderUplevel(), RegisterValidatorCommonScript()
+ RegisterValidatorDeclaration()
+ * DataGridPagerStyle.cs - Completed. That adds one more missle
+ in my artillery.
+ * DataKeyCollection.cs - Completed. Petty small.
+ * Repeater.cs - Work started off. This is a quite
+ heavy class. Hooh!
+ * DataGridItemEventArgs.cs,
+ * DataGridShortCommandEventArgs.cs,
+ * DataListItemEventArgs.cs,
+ * MonthChangedEventArgs.cs,
+ * RepeaterItemEventArgs.cs,
+ * ServerValidateEventArgs.cs,
+ * DataGridPageChangedEventArgs.cs
+ - Damn, I marked them "*", while they
+ did not exist.
+ * Repeater.cs - Done all except for an undocumented
+ method CreateControlHierarchy(bool). Though the method
+ is quite clear by its name, but it will take some time
+ for me to come with some material to flush in.
+
+2002-03-03 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * SelectedDatesCollection.cs - Completed.
+ * PagedDataSource.cs - Completed. Pathetically nice class.
+ * RegularExpressionValidator.cs
+ - Completed. Ridiculously small and
+ annoyinglyc crazy-driving class, basically the method
+ EvaluateIsValid().
+ * RangeValidator.cs - Completed.
+ * DataGridColumn.cs - Completed.
+ * EditCommandColumn.cs - All is complete except for the
+ InitializeCell(TableCell, int, ListItemType) method.
+ * DataListItem.cs - All done except for a longish method
+ RenderItem(HtmlTextWriter, bool, bool)
+
+2002-03-02 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * RepeaterItemCollection.cs - Completed.
+ I love *Collection classes. I am planning to make a
+ program that will generate a *Collection class. It's so
+ simple and the same. ;-)
+ * DataGridColumnCollection.cs - Completed.
+ ... except probably for *ColumnCollection classes, where
+ you have to put in some more effort. Still, these class
+ generation can be automated.
+ * DataListItemCollection.cs - Completed.
+ See, how easily, in less than a quarter of a minute, I
+ completed this class - manually. Copy-Paste/Cut-Replace.
+
+2002-02-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DataGrid.cs - Following methods implemented:
+ TrackViewState(), LoadViewState(object), SaveViewState(),
+ On* -- The event raisers.
+ OnBubbleEvent(object, EventArgs) is still incomplete.
+ * DataGridItem.cs - Initial Implementation
+ * DataGridItemCollection.cs - Completed.
+
+2002-02-08 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DataGrid.cs - Initial Implementation. Worked
+ primarily with some properties.
+
+2002-02-07 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ListBox.cs - Completed. Implemented
+ LoadPostData(string, NameValueCollection)
+ * RequiredFieldValidator.cs - Completed. Pretty simple class.
+
+2002-02-06 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ListBox.cs - Implemented the following:
+ RaisePostDataChangedEvent()
+
+2002-02-02 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ListBox.cs - Supports the following properties:
+ BorderColor, BorderStyle, BorderWidth, Rows, SelectionMode,
+ ToolTip.
+ Methods:
+ AddAttributesToRender(HtmlTextWriter), OnPreRender(EventArgs),
+ RenderContents(HtmlTextWriter)
+
+
+2002-02-01 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TargetConverter.cs - Completed
+ * TemplateColumn.cs - Completed
+ * DataList.cs - Corrected the get-er methods for the
+ *Style objects. Corrected the get/set-er methods for ViewState
+ related objects.
+ Addded support for properties:
+ GridLines, HeaderStyle, HeaderTemplate, ItemStyle, ItemTemplate,
+ RepeatColumns, RepeatDirection, RepeatLayout, SelectedIndex,
+ SelectedItem, SelectedItemStyle, SelectedItemTemplate,
+ SeparatorStyle, SeparatorItemTemplate.
+ Events:
+ CancelCommand, DeleteCommand, EditCommand, ItemCommand,
+ ItemCreated, ItemDataBound, UpdateCommand.
+ Methods:
+ CreateControlStyle(), LoadViewState(object),
+ SaveViewState(), TrackViewState
+ Event handlers:
+ OnBubbleEvent, OnCancelCommand, OnDeleteCommand,
+ OnEditCommand, OnItemCommand, OnItemCreated,
+ OnItemDataBound, OnUpdateCommand
+ Added dummy methods for some undocumented methods:
+ CreateControlHierarchy(bool), CreateItem(int, ListItemType),
+ CreateItem(int, ListItemType, bool, object),
+ PrepareControlHierarchy(), InitializeItem(DataListItem)
+ * ListBox.cs - Started working.
+
+
+
+2002-01-31 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * RepeaterInfo.cs - Initial Implementation. Done all
+ except for RepeatDirection.Vertical
+ * TableStyle.cs - Completed
+
+2002-01-30 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DropDownList.cs - Completed
+ * ListItemCollection.cs - Added method FindByValueInternal to
+ assist in the derived classes.
+ Discovered bug in FindByValue. Removed
+ * UnitConverter.cs - Completed
+ * PlaceHolder.cs - What can be simpler than this?
+ * PlaceHolderControlBuilder.cs
+ - Uh! Damn cool one.
+ * RadioButtonList.cs - Initial Implementation. All is done
+ except for the implementation of
+ method IRepeatInfoUser.RenderItem(...)
+ * ValidatedControlConverter.cs
+ ^^^^^^^^^^^^^^^^^^^^^^^^^ - Looks complete. Doubtful though !!
+ * ValidationSummary.cs - Initial Implementation.
+ * WebColorConverter.cs - Initial Implementation
+
+2002-01-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * FontNamesConverter.cs - Completed
+ * FontUnitConverter.cs - Partial Implementation
+ * ListItemControlBuilder.cs - Completed
+
+2002-01-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TextBox.cs - All done except *Render* methods
+ * TextBoxControlBuilder.cs - Completed
+ * Xml.cs - Partial Implementation
+
+2002-01-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * RadioButton.cs - Completed
+ * TextBox.cs - Partial Implementation
+
+2002-01-25 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Panel.cs - Completed
+ * TableItemStyle.cs - Completed
+
+2002-01-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TableCellCollection.cs - Completed
+ * TableRowCollection.cs - Completed
+ * TableHeaderCell.cs - Completed
+ * TableRow.cs - Completed
+
+2002-01-09 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * TableCellControlBuilder.cs - Completed
+ * Table.cs - Completed
+ * TableCell.cs - Completed
+
+2002-01-07 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * CheckBoxList.cs - Completed
+ * ButtonColumn.cs - Completed
+ * Button.cs - Completed
+
+2001-12-28 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * HyperLink.cs - Completed
+ * Image.cs - Completed
+ * ImageButton.cs - Completed
+ * Label.cs - Completed
+ * LabelControlBuilder.cs - Completed
+ * LinkButton.cs - Completed
+ * LinkButtonControlBuilder.cs - Completed
+ * Literal.cs - Completed
+ * LieteralControlBuilder.cs - Completed
+ * FontUnit.cs - Completed
+
+
+2001-12-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Calendar.cs - Completed the functions of Render*,
+ ViewStates (Track/View/Save),
+ RaisePostBackEvent.
+ Left: RenderAllDays (partially)
+
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Calendar.cs - Added some more functions
+ * Style.cs - Completed
+ * ListItem.cs - Completed
+ * ListItemCollection.cs - Completed
+
+ Made the first successful build of System.Web.dll that included
+ System.Web.UI.WebControls!
+
+2001-12-20 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ FontInfo.cs - Complete revamp. Completed
+
+2001-12-19 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ ListItemCollection.cs - Completed
+ ListItem.cs - Initial Implementation
+ Style.cs - Initial Implementation
+
+ Right now I am in a total mood to do a successful build. Creating so many
+ classes, completing classes in System.Web System.Web.UI namespaces.
+
+2001-12-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ TODO - Properly added
+ CheckBox.cs - Completed
+ BaseDataList.cs - Completed
+ DayRenderEventArgs.cs - Completed
+ RepeaterItem.cs - Initial implementation
+
+2001-12-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ BaseCompareValidator.cs - Completed
+ AdRotator.cs - Completed
+
+2001-12-15 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CommandEventArgs.cs - Completed
+ DataGridCommandEventArgs.cs - Completed
+ RepeaterCommandEventArgs.cs - Completed
+ DataListCommandEventArgs.cs - Completed
+ CompareValidator.cs - Partial Implementation
+
+2001-12-02 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CheckBoxList.cs - Partial Implementation.
+ All except "Render"
+
+2001-12-01 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ ListControl.cs - Completed
+
+2001-11-30 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CheckBox.cs - Completed
+ ListControl.cs - Initial Implementation
+ CheckBoxList.cs - Started with it, but first needed
+ ListControl. Left it.
+
+2001-11-29 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ CalendarDay.cs - Making a note that this
+ has been implemented
+ Calendar.cs - Making a note that have made some changes.
+ Unimplmented functions throw
+ NotImplementedException
+ CheckBox.cs - Can now "Render" and "LoadPostData"
+
+
+2001-11-08 Gaurav Vaish <gvaish@iitk.ac.in>
+ WebControl.cs - Total Revamp, Partial Implementation
+ AdRotator.cs - Able to load files
+ AdCreatedEventArgs.cs - Implemented
+
+2001-11-05 Gaurav Vaish <gvaish@iitk.ac.in>
+ Calendar.cs - Initial Implementation
+ ButtonColumn.cs - Initial Implementation
+ Button.cs - Initial Implementation
+ BoundColumn.cs - Initial Implementation
+ BaseCompareValidator.cs - Minor Changes
+ DataList.cs, BaseValidator.cs, BaseDataList.cs
+ - Added more functions, other changes
+
+2001-10-28 Gaurav Vaish <gvaish@iitk.ac.in>
+ WebControl.cs - Initial Implementation
+ DataList.cs - Initial Implementation
+ BaseValidator.cs - Initial Implementation
+ BaseDataList.cs - Initial Implementation
+
+2001-10-27 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ AdCreatedEventArgs.cs - Initial Implementation
+ AdCratedEventHandler.cs - Implemented
+ AdRotator.cs - Initial Implementation
+ BorderStyle.cs - Implemented
+ ButtonColumnStyle.cs - Implemented
+ CalendarSelectionMode.cs - Implemented
+ DayNameFormat.cs - Implemented
+ FirstDayOfWeek - Implemented
+ FontInfo.cs - Partial Implementation
+ FontSize.cs - Implemented
+ GridLines.cs - Implemented
+ HorizontalAlign.cs - Implemented
+ HyperLink.cs - Initial Implementation
+ ImageAlign.cs - Implemented
+ IRepeatInfoUser.cs - Implemented
+ ListItemType.cs - Implemented
+ ListSelectionMode.cs - Implemented
+ NextPrevFormat.cs - Implemented
+ PagerMode.cs - Implemented
+ PagerPosition.cs - Implemented
+ RepeatDirection.cs - Implemented
+ RepeatLayout.cs - Implemented
+ TextAlign.cs - Implemented
+ TextBoxMode.cs - Implemented
+ TitleFormat.cs - Implemented
+ UnitType.cs - Implemented
+ ValidationCompareOperator.cs
+ - Implemented
+ ValidationDataType.cs - Implemented
+ ValidationSummaryDisplayMode.cs
+ - Implemented
+ ValidatorDisplay.cs - Implemented
+ VerticalAlign.cs - Implemented
+
+
+
+// File Created 2001-11-13
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs
new file mode 100644
index 00000000000..8f7991a9cf1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBox.cs
@@ -0,0 +1,256 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: CheckBox
+ *
+ * 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)
+ * Thanks to Leen Toelen (toelen@hotmail.com)'s classes that helped me
+ * to write the contents of the function LoadPostData(...)
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("CheckedChanged")]
+ [DefaultProperty("Text")]
+ //[DataBindingHanlder("??")]
+ //[Designer("??")]
+ public class CheckBox : WebControl, IPostBackDataHandler
+ {
+ private static readonly object CheckedChangedEvent = new object();
+
+ public CheckBox(): base(HtmlTextWriterTag.Input)
+ {
+ }
+
+ public virtual bool AutoPostBack
+ {
+ get
+ {
+ object o = ViewState["AutoPostBack"];
+ if(o!=null)
+ return (bool)AutoPostBack;
+ return false;
+ }
+ set
+ {
+ ViewState["AutoPostBack"] = value;
+ }
+ }
+
+ public virtual bool Checked
+ {
+ get
+ {
+ object o = ViewState["Checked"];
+ if(o!=null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["Checked"] = value;
+ }
+ }
+
+ public virtual string Text
+ {
+ get
+ {
+ object o = ViewState["Text"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+
+ private bool SaveCheckedViewState
+ {
+ get
+ {
+ if(Events[CheckedChangedEvent] != null)
+ {
+ if(!Enabled)
+ return true;
+ if(GetType() == typeof(CheckBox))
+ {
+ return false;
+ }
+ if(GetType() == typeof(RadioButton))
+ {
+ return false;
+ }
+ }
+ return true;
+
+ }
+ }
+
+ public virtual TextAlign TextAlign
+ {
+ get
+ {
+ object o = ViewState["TextAlign"];
+ if(o!=null)
+ return (TextAlign)o;
+ return TextAlign.Right;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(TextAlign), value))
+ throw new ArgumentException();
+ ViewState["TextAlign"] = value;
+ }
+ }
+
+ public event EventHandler CheckedChanged
+ {
+ add
+ {
+ Events.AddHandler(CheckedChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CheckedChangedEvent, value);
+ }
+ }
+
+ protected virtual void OnCheckedChanged(EventArgs e)
+ {
+ if(Events!=null)
+ {
+ EventHandler eh = (EventHandler)(Events[CheckedChangedEvent]);
+ if(eh!=null)
+ eh(this, e);
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ if(Page!=null)
+ {
+ if(Enabled)
+ {
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+ if(SaveCheckedViewState)
+ {
+ ViewState.SetItemDirty("checked", false);
+ }
+ }
+
+ [MonoTODO("Internal_Call_Requirements")]
+ protected override void Render(HtmlTextWriter writer)
+ {
+ bool hasBeginRendering = false;
+ if(ControlStyleCreated)
+ {
+ //TODO: Uncomment this in final version
+ /*
+ if(!ControlStyle.IsEmpty)
+ {
+ hasBeginRendering = true;
+ ControlStyle.AddAttributesToRender(writer, this);
+ }
+ */
+ }
+ if(!Enabled)
+ {
+ hasBeginRendering = true;
+ writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
+ }
+ if(ToolTip.Length > 0)
+ {
+ hasBeginRendering = true;
+ writer.AddAttribute(HtmlTextWriterAttribute.Title, ToolTip);
+ }
+ if(Attributes.Count > 0)
+ {
+ hasBeginRendering = true;
+ Attributes.AddAttributes(writer);
+ }
+ if(hasBeginRendering)
+ writer.RenderBeginTag(HtmlTextWriterTag.Span);
+ if(Text.Length > 0)
+ {
+ if(TextAlign == TextAlign.Right)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.For, ClientID);
+ writer.RenderBeginTag(HtmlTextWriterTag.Label);
+ writer.Write(Text);
+ writer.RenderEndTag();
+ RenderInputTag(writer, ClientID);
+ } else
+ {
+ RenderInputTag(writer, ClientID);
+ writer.AddAttribute(HtmlTextWriterAttribute.For, ClientID);
+ writer.RenderBeginTag(HtmlTextWriterTag.Label);
+ writer.Write(Text);
+ }
+ }
+ if(hasBeginRendering)
+ writer.RenderEndTag();
+ throw new NotImplementedException("Calling some internal functions");
+ }
+
+ internal virtual void RenderInputTag(HtmlTextWriter writer, string clientId)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Id, clientId);
+ writer.AddAttribute(HtmlTextWriterAttribute.Type, "checkbox");
+ writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
+ if(Checked)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Checked, "checked");
+ }
+ if(AutoPostBack)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Onclick,Page.GetPostBackClientEvent(this, String.Empty));
+ writer.AddAttribute("language", "javascript");
+ }
+ if(AccessKey.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey);
+ }
+ if(TabIndex != 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ writer.RenderBeginTag(HtmlTextWriterTag.Input);
+ writer.RenderEndTag();
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ string postedVal = postCollection[postDataKey];
+ bool postChecked = false;
+ if(postedVal != null)
+ {
+ postChecked = postedVal.Length > 0;
+ }
+ Checked = postChecked;
+ return (postChecked == Checked == false);
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ OnCheckedChanged(EventArgs.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs
new file mode 100644
index 00000000000..58754a0af78
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CheckBoxList.cs
@@ -0,0 +1,251 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: CheckBoxList
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Contact: <gvaish@iitk.ac.in>
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class CheckBoxList: ListControl, IRepeatInfoUser, INamingContainer, IPostBackDataHandler
+ {
+ CheckBox checkBoxRepeater;
+ bool isChangeNotified;
+
+ public CheckBoxList()
+ {
+ checkBoxRepeater = new CheckBox();
+ checkBoxRepeater.ID = "0";
+ checkBoxRepeater.EnableViewState = false;
+ checkBoxRepeater.Controls.Add(this);
+ isChangeNotified = false;
+ }
+
+ public virtual int CellPadding
+ {
+ get
+ {
+ return (ControlStyleCreated ? ((TableStyle)ControlStyle).CellPadding : -1);
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellPadding = value;
+ }
+ }
+
+ public virtual int CellSpacing
+ {
+ get
+ {
+ return (ControlStyleCreated ? ((TableStyle)ControlStyle).CellSpacing : -1);
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellSpacing = value;
+ }
+ }
+
+ public virtual int RepeatColumns
+ {
+ get
+ {
+ object o = ViewState["RepeatColumns"];
+ if(o!=null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException();
+ ViewState["RepeatColumns"] = value;
+ }
+ }
+
+ public virtual RepeatDirection RepeatDirection
+ {
+ get
+ {
+ object o = ViewState["RepeatDirection"];
+ if(o!=null)
+ return (RepeatDirection)o;
+ return RepeatDirection.Vertical;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(RepeatDirection),value))
+ throw new ArgumentException();
+ ViewState["RepeatDirection"] = value;
+ }
+ }
+
+ public virtual RepeatLayout RepeatLayout
+ {
+ get
+ {
+ object o = ViewState["RepeatLayout"];
+ if(o!=null)
+ return (RepeatLayout)o;
+ return RepeatLayout.Table;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(RepeatLayout), value))
+ throw new ArgumentException();
+ ViewState["RepeatLayout"] = value;
+ }
+ }
+
+ public virtual TextAlign TextAlign
+ {
+ get
+ {
+ object o = ViewState["TextAlign"];
+ if(o!=null)
+ return (TextAlign)o;
+ return TextAlign.Right;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(TextAlign), value))
+ throw new ArgumentException();
+ ViewState["TextAlign"] = value;
+ }
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableStyle(ViewState);
+ }
+
+ protected override Control FindControl(string id, int pathOffset)
+ {
+ return this;
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ checkBoxRepeater.AutoPostBack = AutoPostBack;
+ if(Page!=null)
+ {
+ for(int i=0; i < Items.Count; i++)
+ {
+ if(Items[i].Selected)
+ {
+ checkBoxRepeater.ID = i.ToString(NumberFormatInfo.InvariantInfo);
+ Page.RegisterRequiresPostBack(checkBoxRepeater);
+ }
+ }
+ }
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ RepeatInfo ri = new RepeatInfo();
+ checkBoxRepeater.TabIndex = TabIndex;
+ bool dirtyFlag = false;
+ short tTabIndex = TabIndex;
+ Style s = (ControlStyleCreated ? ControlStyle : null);
+ if(TabIndex > 0)
+ {
+ if(!ViewState.IsItemDirty("TabIndex"))
+ dirtyFlag = true;
+ TabIndex = 0;
+ }
+ ri.RepeatColumns = RepeatColumns;
+ ri.RepeatLayout = RepeatLayout;
+ ri.RepeatDirection = RepeatDirection;
+ ri.RenderRepeater(writer, this, s, this);
+ if(tTabIndex > 0)
+ {
+ TabIndex = tTabIndex;
+ }
+ if(dirtyFlag)
+ {
+ ViewState.SetItemDirty("TabIndex", false);
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ int index = Int32.Parse(postDataKey.Substring(UniqueID.Length + 1));
+ if(index >= 0 && index < Items.Count)
+ {
+ bool exists = (postCollection[postDataKey]!=null);
+ if(Items[index].Selected != exists)
+ {
+ Items[index].Selected = exists;
+ if(!isChangeNotified)
+ {
+ isChangeNotified = true;
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ OnSelectedIndexChanged(EventArgs.Empty);
+ }
+
+ bool IRepeatInfoUser.HasFooter
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ bool IRepeatInfoUser.HasHeader
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ bool IRepeatInfoUser.HasSeparators
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ int IRepeatInfoUser.RepeatedItemCount
+ {
+ get
+ {
+ return Items.Count;
+ }
+ }
+
+ Style IRepeatInfoUser.GetItemStyle(ListItemType itemType, int repeatIndex)
+ {
+ return null;
+ }
+
+ void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+ {
+ checkBoxRepeater.ID = repeatIndex.ToString(NumberFormatInfo.InvariantInfo);
+ checkBoxRepeater.Text = Items[repeatIndex].Text;
+ checkBoxRepeater.TextAlign = TextAlign;
+ checkBoxRepeater.Checked = Items[repeatIndex].Selected;
+ checkBoxRepeater.RenderControl(writer);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs
new file mode 100644
index 00000000000..145280eb7e3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventArgs.cs
@@ -0,0 +1,50 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: CommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class CommandEventArgs : EventArgs
+ {
+ private string cmdName;
+ private object cmdArg;
+
+ public CommandEventArgs(CommandEventArgs e) : this(e.CommandName, e.CommandArgument)
+ {
+ }
+
+ public CommandEventArgs(string commandName, object argument)
+ {
+ cmdName = commandName;
+ cmdArg = argument;
+ }
+
+ public string CommandName
+ {
+ get
+ {
+ return cmdName;
+ }
+ }
+
+ public object CommandArgument
+ {
+ get
+ {
+ return cmdArg;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs
new file mode 100644
index 00000000000..e806b1e952c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CommandEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: CommandEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void CommandEventHandler(object sender, CommandEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs
new file mode 100644
index 00000000000..46b4a18198a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CompareValidator.cs
@@ -0,0 +1,89 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: CompareValidator
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 80%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:CompareValidator runat=\"server\""
+ + "ErrorMessage=\"CompareValidator\"></{0}:CompareValidator>")]
+ public class CompareValidator: BaseCompareValidator
+ {
+ public CompareValidator()
+ {
+ // Intitalize();
+ }
+
+ public string ControlToCompare
+ {
+ get
+ {
+ object o = ViewState["ControlToCompare"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+
+ set
+ {
+ ViewState["ControlToCompare"] = value;
+ }
+ }
+
+ public ValidationCompareOperator Operator
+ {
+ get
+ {
+ object o = ViewState["Operator"];
+ if(o!=null)
+ return (ValidationCompareOperator)o;
+ return ValidationCompareOperator.Equal;
+ }
+ set
+ {
+ if(!System.Enum.IsDefined(typeof(ValidationCompareOperator), value))
+ throw new ArgumentException();
+ ViewState["Operator"] = value;
+ }
+ }
+
+ public string ValueToCompare
+ {
+ get
+ {
+ object o = ViewState["ValueToCompare"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ValueToCompare"] = value;
+ }
+ }
+
+ [MonoTODO]
+ protected override bool EvaluateIsValid()
+ {
+ string ctrl = GetControlValidationValue(ControlToValidate);
+ throw new NotImplementedException();
+ if(ctrl!=null && ctrl.Length > 0)
+ {
+ //string
+ throw new NotImplementedException();
+ }
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs
new file mode 100644
index 00000000000..192cab3bcad
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/CustomValidator.cs
@@ -0,0 +1,113 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: CustomValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("ServerValidate")]
+ [ToolboxData("<{0}:CustomValidator runat=\"server\""
+ + "ErrorMessage=\"CustomValidator\">"
+ + "</{0}:CustomValidator>")]
+ public class CustomValidator : BaseValidator
+ {
+ private static readonly object ServerValidateEvent = new object();
+
+ public CustomValidator()
+ {
+ }
+
+ public string ClientValidationFunction
+ {
+ get
+ {
+ object o = ViewState["ClientValidationFunction"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ClientValidationFunction"] = value;
+ }
+ }
+
+ public event ServerValidateEventHandler ServerValidate
+ {
+ add
+ {
+ Events.AddHandler(ServerValidateEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ServerValidateEvent, value);
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "CustomValidatorEvaluateIsValid");
+ if(ClientValidationFunction.Length > 0)
+ {
+ writer.AddAttribute("clientvalidationfunction", ClientValidationFunction);
+ }
+ }
+ }
+
+ protected override bool ControlPropertiesValid()
+ {
+ if(ControlToValidate.Length > 0)
+ {
+ CheckControlValidationProperty(ControlToValidate, "ControlToValidate");
+ }
+ return true;
+ }
+
+ protected virtual bool OnServerValidate(string value)
+ {
+ if(Events != null)
+ {
+ ServerValidateEventHandler sveh = (ServerValidateEventHandler)(Events[ServerValidateEvent]);
+ if(sveh != null)
+ {
+ ServerValidateEventArgs args = new ServerValidateEventArgs(value, true);
+ sveh(this, args);
+ return args.IsValid;
+ }
+ }
+ return true;
+ }
+
+ protected override bool EvaluateIsValid()
+ {
+ string ctrl = ControlToValidate;
+ if(ctrl.Length > 0)
+ {
+ ctrl = GetControlValidationValue(ctrl);
+ if(ctrl== null || ctrl.Length == 0)
+ {
+ return true;
+ }
+ }
+ return OnServerValidate(ctrl);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs
new file mode 100644
index 00000000000..c9da59e129a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs
@@ -0,0 +1,776 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGrid
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ //TODO: [Designer("??")]
+ //TODO: [Editor("??")]
+ public class DataGrid : BaseDataList, INamingContainer
+ {
+ public const string CancelCommandName = "Cancel";
+ public const string DeleteCommandName = "Delete";
+ public const string EditCommandName = "Edit";
+ public const string NextPageCommandArgument = "Next";
+ public const string PageCommandName = "Page";
+ public const string PrevPageCommandArgument = "Prev";
+ public const string SelectCommandName = "Select";
+ public const string SortCommandName = "Sort";
+ public const string UpdateCommandName = "Update";
+
+ private TableItemStyle alternatingItemStyle;
+ private TableItemStyle editItemStyle;
+ private TableItemStyle headerStyle;
+ private TableItemStyle footerStyle;
+ private TableItemStyle itemStyle;
+ private TableItemStyle selectedItemStyle;
+ private DataGridPagerStyle pagerStyle;
+
+ private DataGridColumnCollection columns;
+ private ArrayList columnsArrayList;
+ private DataGridItemCollection items;
+ private ArrayList itemsArrayList;
+ private PagedDataSource pagedDataSource;
+
+ private static readonly object CancelCommandEvent = new object();
+ private static readonly object DeleteCommandEvent = new object();
+ private static readonly object EditCommandEvent = new object();
+ private static readonly object ItemCommandEvent = new object();
+ private static readonly object ItemCreatedEvent = new object();
+ private static readonly object ItemDataBoundEvent = new object();
+ private static readonly object PageIndexChangedEvent = new object();
+ private static readonly object SortCommandEvent = new object();
+ private static readonly object UpdateCommandEvent = new object();
+
+ public DataGrid(): base()
+ {
+ }
+
+ public virtual bool AllowCustomPaging
+ {
+ get
+ {
+ object o = ViewState["AllowCustomPaging"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AllowCustomPaging"] = value;
+ }
+ }
+
+ public virtual bool AllowPaging
+ {
+ get
+ {
+ object o = ViewState["AllowPaging"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AllowPaging"] = value;
+ }
+ }
+
+ public virtual bool AllowSorting
+ {
+ get
+ {
+ object o = ViewState["AllowSorting"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AllowSorting"] = value;
+ }
+ }
+
+ public virtual TableItemStyle AlternatingItemStyle
+ {
+ get
+ {
+ if(alternatingItemStyle == null)
+ {
+ alternatingItemStyle = new TableItemStyle();
+ }
+ if(IsTrackingViewState)
+ {
+ alternatingItemStyle.TrackViewState();
+ }
+ return alternatingItemStyle;
+ }
+ }
+
+ public virtual bool AutoGenerateColumns
+ {
+ get
+ {
+ object o = ViewState["AutoGenerateColumns"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AutoGenerateColumns"] = value;
+ }
+ }
+
+ public virtual string BackImageUrl
+ {
+ get
+ {
+ object o = ViewState["BackImageUrl"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["BackImageUrl"] = value;
+ }
+ }
+
+ public virtual DataGridColumnCollection Columns
+ {
+ get
+ {
+ if(columns == null)
+ {
+ columnsArrayList = new ArrayList();
+ columns = new DataGridColumnCollection(this, columnsArrayList);
+ if(IsTrackingViewState)
+ {
+ ((IStateManager)columns).TrackViewState();
+ }
+ }
+ return columns;
+ }
+ }
+
+ public int CurrentPageIndex
+ {
+ get
+ {
+ object o = ViewState["CurrentPageIndex"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException();
+ ViewState["CurrentPageIndex"] = value;
+ }
+ }
+
+ public virtual int EditItemIndex
+ {
+ get
+ {
+ object o = ViewState["EditItemIndex"];
+ if(o != null)
+ return (int)o;
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException();
+ ViewState["EditItemIndex"] = value;
+ }
+ }
+
+ public virtual TableItemStyle EditItemStyle
+ {
+ get
+ {
+ if(editItemStyle == null)
+ {
+ editItemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ editItemStyle.TrackViewState();
+ }
+ }
+ return editItemStyle;
+ }
+ }
+
+ public virtual TableItemStyle FooterStyle
+ {
+ get
+ {
+ if(footerStyle == null)
+ {
+ footerStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ footerStyle.TrackViewState();
+ }
+ }
+ return footerStyle;
+ }
+ }
+
+ public virtual TableItemStyle HeaderStyle
+ {
+ get
+ {
+ if(headerStyle == null)
+ {
+ headerStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ headerStyle.TrackViewState();
+ }
+ }
+ return headerStyle;
+ }
+ }
+
+ public virtual DataGridItemCollection Items
+ {
+ get
+ {
+ if(items == null)
+ {
+ if(itemsArrayList == null)
+ EnsureChildControls();
+ if(itemsArrayList == null)
+ {
+ itemsArrayList = new ArrayList();
+ }
+ items = new DataGridItemCollection(itemsArrayList);
+ }
+ return items;
+ }
+ }
+
+ public virtual TableItemStyle ItemStyle
+ {
+ get
+ {
+ if(itemStyle == null)
+ {
+ itemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ itemStyle.TrackViewState();
+ }
+ }
+ return itemStyle;
+ }
+ }
+
+ public int PageCount
+ {
+ get
+ {
+ if(pagedDataSource != null)
+ {
+ return pagedDataSource.PageCount;
+ }
+ object o = ViewState["PageCount"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ }
+
+ public virtual DataGridPagerStyle PagerStyle
+ {
+ get
+ {
+ if(pagerStyle == null)
+ {
+ pagerStyle = new DataGridPagerStyle(this);
+ if(IsTrackingViewState)
+ {
+ pagerStyle.TrackViewState();
+ }
+ }
+ return pagerStyle;
+ }
+ }
+
+ public virtual int PageSize
+ {
+ get
+ {
+ object o = ViewState["PageSize"];
+ if(o != null)
+ return (int)o;
+ return 10;
+ }
+ set
+ {
+ if(value < 1)
+ throw new ArgumentOutOfRangeException();
+ ViewState["PageSize"] = value;
+ }
+ }
+
+ public virtual int SelectedIndex
+ {
+ get
+ {
+ object o = ViewState["SelectedIndex"];
+ if(o != null)
+ return (int)o;
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException();
+ int prevVal = SelectedIndex;
+ ViewState["SelectedIndex"] = value;
+ if(items != null)
+ {
+ if(prevVal !=-1 && prevVal < items.Count)
+ {
+ DataGridItem prev = (DataGridItem)items[prevVal];
+ if(prev.ItemType != ListItemType.EditItem)
+ {
+ ListItemType newType = ListItemType.Item;
+ if( (prevVal % 2) != 0)
+ {
+ newType = ListItemType.AlternatingItem;
+ }
+ prev.SetItemType(newType);
+ }
+ }
+ }
+ }
+ }
+
+ public virtual DataGridItem SelectedItem
+ {
+ get
+ {
+ if(SelectedIndex == -1)
+ return null;
+ return Items[SelectedIndex];
+ }
+ }
+
+ public virtual TableItemStyle SelectedItemStyle
+ {
+ get
+ {
+ if(selectedItemStyle == null)
+ {
+ selectedItemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ selectedItemStyle.TrackViewState();
+ }
+ }
+ return selectedItemStyle;
+ }
+ }
+
+ public virtual bool ShowFooter
+ {
+ get
+ {
+ object o = ViewState["ShowFooter"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ShowFooter"] = value;
+ }
+ }
+
+ public virtual bool ShowHeader
+ {
+ get
+ {
+ object o = ViewState["ShowHeader"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ShowHeader"] = value;
+ }
+ }
+
+ public virtual int VirtualItemCount
+ {
+ get
+ {
+ object o = ViewState["VirtualItemCount"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException();
+ ViewState["VirtualItemCount"] = value;
+ }
+ }
+
+ public event DataGridCommandEventHandler CancelCommand
+ {
+ add
+ {
+ Events.AddHandler(CancelCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CancelCommandEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler DeleteCommand
+ {
+ add
+ {
+ Events.AddHandler(DeleteCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DeleteCommandEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler EditCommand
+ {
+ add
+ {
+ Events.AddHandler(EditCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(EditCommandEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler ItemCommand
+ {
+ add
+ {
+ Events.AddHandler(ItemCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCommandEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler ItemCreated
+ {
+ add
+ {
+ Events.AddHandler(ItemCreatedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCreatedEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler ItemDataBound
+ {
+ add
+ {
+ Events.AddHandler(ItemDataBoundEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemDataBoundEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler PageIndexChanged
+ {
+ add
+ {
+ Events.AddHandler(PageIndexChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(PageIndexChangedEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler SortCommand
+ {
+ add
+ {
+ Events.AddHandler(SortCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SortCommandEvent, value);
+ }
+ }
+
+ public event DataGridCommandEventHandler UpdateCommand
+ {
+ add
+ {
+ Events.AddHandler(UpdateCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(UpdateCommandEvent, value);
+ }
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ TableStyle style = new TableStyle(ViewState);
+ style.GridLines = GridLines.Both;
+ style.CellSpacing = 0;
+ return style;
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if(savedState != null)
+ {
+ object[] states = (object[])savedState;
+ if(states != null)
+ {
+ LoadViewState(states[0]);
+ if(columns != null)
+ ((IStateManager)columns).LoadViewState(states[1]);
+ if(pagerStyle != null)
+ pagerStyle.LoadViewState(states[2]);
+ if(headerStyle != null)
+ headerStyle.LoadViewState(states[3]);
+ if(footerStyle != null)
+ footerStyle.LoadViewState(states[4]);
+ if(itemStyle != null)
+ itemStyle.LoadViewState(states[5]);
+ if(alternatingItemStyle != null)
+ alternatingItemStyle.LoadViewState(states[6]);
+ if(selectedItemStyle != null)
+ selectedItemStyle.LoadViewState(states[7]);
+ if(editItemStyle != null)
+ editItemStyle.LoadViewState(states[8]);
+ }
+ }
+ }
+
+ protected override object SaveViewState()
+ {
+ object[] states = new object[9];
+ states[0] = SaveViewState();
+ states[1] = (columns == null ? null : ((IStateManager)columns).SaveViewState());
+ states[2] = (pagerStyle == null ? null : pagerStyle.SaveViewState());
+ states[3] = (headerStyle == null ? null : headerStyle.SaveViewState());
+ states[4] = (footerStyle == null ? null : footerStyle.SaveViewState());
+ states[5] = (itemStyle == null ? null : itemStyle.SaveViewState());
+ states[6] = (alternatingItemStyle == null ? null : alternatingItemStyle.SaveViewState());
+ states[7] = (selectedItemStyle == null ? null : selectedItemStyle.SaveViewState());
+ states[8] = (editItemStyle == null ? null : editItemStyle.SaveViewState());
+ return states;
+ }
+
+ protected override void TrackViewState()
+ {
+ TrackViewState();
+ if(alternatingItemStyle != null)
+ {
+ alternatingItemStyle.TrackViewState();
+ }
+ if(editItemStyle != null)
+ {
+ editItemStyle.TrackViewState();
+ }
+ if(headerStyle != null)
+ {
+ headerStyle.TrackViewState();
+ }
+ if(footerStyle != null)
+ {
+ footerStyle.TrackViewState();
+ }
+ if(itemStyle != null)
+ {
+ itemStyle.TrackViewState();
+ }
+ if(selectedItemStyle != null)
+ {
+ selectedItemStyle.TrackViewState();
+ }
+ if(pagerStyle != null)
+ {
+ pagerStyle.TrackViewState();
+ }
+
+ if(columns != null)
+ {
+ ((IStateManager)columns).TrackViewState();
+ }
+ }
+
+ [MonoTODO]
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ /*
+ bool retVal = false;
+ if(e is DataGridCommandEventArgs)
+ {
+ DataGridCommandEventArgs ea = (DataGridCommandEventArgs)e;
+ retVal = true;
+ OnItemCommand(ea);
+ string cmd = ea.CommandName;
+ if(cmd == "Select")
+ {
+ SelectedIndex = ea.Item.SelectedIndex;
+ OnSelectedIndexChanged(EventArgs.Empty);
+ } else if(cmd == "Page")
+ {
+ throw new NotImplementedException();
+ // Next; Prev; Sort etc
+ }
+ }
+ */
+ throw new NotImplementedException();
+ //return retVal;
+ }
+
+ protected virtual void OnCancelCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[CancelCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnDeleteCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[DeleteCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnEditCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[EditCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[ItemCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemCreated(DataGridItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridItemEventHandler dceh = (DataGridItemEventHandler)(Events[ItemCreatedEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemDataBound(DataGridItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridItemEventHandler dceh = (DataGridItemEventHandler)(Events[ItemDataBoundEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnPageIndexChanged(DataGridPageChangedEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridPageChangedEventHandler dceh = (DataGridPageChangedEventHandler)(Events[PageIndexChangedEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnSortCommand(DataGridSortCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridSortCommandEventHandler dceh = (DataGridSortCommandEventHandler)(Events[SortCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ protected virtual void OnUpdateCommand(DataGridCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataGridCommandEventHandler dceh = (DataGridCommandEventHandler)(Events[UpdateCommandEvent]);
+ if(dceh != null)
+ dceh(this, e);
+ }
+ }
+
+ [MonoTODO]
+ protected override void PrepareControlHierarchy()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ protected override void CreateControlHierarchy(bool useDataSource)
+ {
+ throw new NotImplementedException();
+ }
+
+ internal void OnColumnsChanged()
+ {
+ }
+
+ internal void OnPagerChanged()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs
new file mode 100644
index 00000000000..c0adca881d9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumn.cs
@@ -0,0 +1,379 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ //TODO: [TypeConverter("??")]
+ public class DataGridColumn : IStateManager
+ {
+ private StateBag viewState;
+ private bool marked;
+ private TableItemStyle footerStyle;
+ private TableItemStyle headerStyle;
+ private TableItemStyle itemStyle;
+
+ private DataGrid owner;
+ private bool designMode;
+
+ public DataGridColumn()
+ {
+ viewState = new StateBag();
+ }
+
+ public virtual TableItemStyle FooterStyle
+ {
+ get
+ {
+ if(footerStyle == null)
+ {
+ footerStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ footerStyle.TrackViewState();
+ }
+ }
+ return footerStyle;
+ }
+ }
+
+ public virtual TableItemStyle HeaderStyle
+ {
+ get
+ {
+ if(headerStyle == null)
+ {
+ headerStyle= new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ headerStyle.TrackViewState();
+ }
+ }
+ return headerStyle;
+ }
+ }
+
+ public virtual TableItemStyle ItemStyle
+ {
+ get
+ {
+ if(itemStyle == null)
+ {
+ itemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ {
+ itemStyle.TrackViewState();
+ }
+ }
+ return itemStyle;
+ }
+ }
+
+ public virtual string FooterText
+ {
+ get
+ {
+ object o = ViewState["FooterText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["FooterText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string HeaderImageUrl
+ {
+ get
+ {
+ object o = ViewState["HeaderImageUrl"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["HeaderImageUrl"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string HeaderText
+ {
+ get
+ {
+ object o = ViewState["HeaderText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["HeaderText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string SortExpression
+ {
+ get
+ {
+ object o = ViewState["SortExpression"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["SortExpression"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public bool Visible
+ {
+ get
+ {
+ object o = ViewState["Visible"];
+ if(o != null)
+ {
+ return (bool)o;
+ }
+ return true;
+ }
+ set
+ {
+ ViewState["Visible"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual void Initialize()
+ {
+ if(owner != null && owner.Site != null)
+ {
+ designMode = owner.Site.DesignMode;
+ }
+ }
+
+ public virtual void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ switch(itemType)
+ {
+ case ListItemType.Header : InitializeCellHeader(cell, columnIndex);
+ break;
+ case ListItemType.Footer : InitializeCellFooter(cell, columnIndex);
+ break;
+ default : return;
+ }
+ }
+
+ private void InitializeCellHeader(TableCell cell, int columnIndex)
+ {
+ WebControl ctrl = null;
+ bool sort = true;
+ string sortExpr = "";
+ ImageButton headButton;
+ Image headImage;
+ LinkButtonInternal link;
+
+ if(owner != null)
+ {
+ sort = owner.AllowSorting;
+ }
+ if(sort)
+ {
+ sortExpr = SortExpression;
+ if(sortExpr.Length == 0)
+ {
+ sort = false;
+ }
+ }
+ if(HeaderImageUrl.Length > 0)
+ {
+ if(sort)
+ {
+ headButton = new ImageButton();
+ headButton.ImageUrl = HeaderImageUrl;
+ headButton.CommandName = "Sort";
+ headButton.CommandArgument = sortExpr;
+ headButton.CausesValidation = false;
+ ctrl = headButton;
+ } else
+ {
+ headImage = new Image();
+ headImage.ImageUrl = HeaderImageUrl;
+ ctrl = headImage;
+ }
+ } else
+ {
+ if(sort)
+ {
+ link = new LinkButtonInternal();
+ link.Text = HeaderText;
+ link.CommandName = "Sort";
+ link.CommandArgument = sortExpr;
+ link.CausesValidation = false;
+ ctrl = link;
+ } else
+ {
+ if(HeaderText.Length > 0)
+ {
+ cell.Text = HeaderText;
+ } else
+ {
+ cell.Text = "&nbsp;";
+ }
+ }
+ }
+ if(ctrl != null)
+ {
+ cell.Controls.Add(ctrl);
+ }
+ }
+
+ private void InitializeCellFooter(TableCell cell, int columnIndex)
+ {
+ cell.Text = (FooterText.Length > 0 ? FooterText : "&nbsp;");
+ }
+
+ public override string ToString()
+ {
+ return String.Empty;
+ }
+
+ protected bool DesignMode
+ {
+ get
+ {
+ return designMode;
+ }
+ }
+
+ protected DataGrid Owner
+ {
+ get
+ {
+ return owner;
+ }
+ }
+
+ protected StateBag ViewState
+ {
+ get
+ {
+ return viewState;
+ }
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ protected void OnColumnChanged()
+ {
+ if(owner != null)
+ {
+ owner.OnColumnsChanged();
+ }
+ }
+
+ protected virtual object SaveViewState()
+ {
+ object[] states = new object[4];
+ states[0] = ViewState.SaveViewState();
+ states[1] = (footerStyle == null ? null : footerStyle.SaveViewState());
+ states[2] = (headerStyle == null ? null : headerStyle.SaveViewState());
+ states[3] = (itemStyle == null ? null : itemStyle.SaveViewState());
+ return states;
+ }
+
+ protected virtual void LoadViewState(object savedState)
+ {
+ if(savedState!= null)
+ {
+ object[] states = (object[]) savedState;
+ if(states != null)
+ {
+ ViewState.LoadViewState(states[0]);
+ FooterStyle.LoadViewState(states[1]);
+ HeaderStyle.LoadViewState(states[2]);
+ ItemStyle.LoadViewState(states[3]);
+ }
+ }
+ }
+
+ protected virtual void TrackViewState()
+ {
+ marked = true;
+ ViewState.TrackViewState();
+ if(footerStyle != null)
+ {
+ footerStyle.TrackViewState();
+ }
+ if(headerStyle != null)
+ {
+ headerStyle.TrackViewState();
+ }
+ if(itemStyle != null)
+ {
+ itemStyle.TrackViewState();
+ }
+ }
+
+ protected virtual bool IsTrackingViewState
+ {
+ get
+ {
+ return marked;
+ }
+ }
+
+ void IStateManager.LoadViewState(object savedState)
+ {
+ LoadViewState(savedState);
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return IsTrackingViewState;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs
new file mode 100644
index 00000000000..3fce0c04af1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridColumnCollection.cs
@@ -0,0 +1,186 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridColumnCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataGridColumnCollection : ICollection, IEnumerable, IStateManager
+ {
+ private DataGrid owner;
+ private ArrayList columns;
+ private bool trackViewState = false;
+
+ public DataGridColumnCollection(DataGrid owner, ArrayList columns)
+ {
+ this.owner = owner;
+ this.columns = columns;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return columns.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public DataGridColumn this[int index]
+ {
+ get
+ {
+ return (DataGridColumn)(columns[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void Add(DataGridColumn column)
+ {
+ AddAt(-1, column);
+ }
+
+ public void AddAt(int index, DataGridColumn column)
+ {
+ if(index == -1)
+ {
+ columns.Add(column);
+ } else
+ {
+ columns.Insert(index, column);
+ }
+ //TODO: To put. DataGridColumn class not created!
+ //column->owner = owner;
+ if(trackViewState)
+ {
+ ((IStateManager)column).TrackViewState();
+ }
+ OnColumnsChanged();
+ }
+
+ internal void OnColumnsChanged()
+ {
+ if(owner != null)
+ {
+ owner.OnColumnsChanged();
+ }
+ }
+
+ public void Clear()
+ {
+ columns.Clear();
+ OnColumnsChanged();
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DataGridColumn current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return columns.GetEnumerator();
+ }
+
+ public int IndexOf(DataGridColumn column)
+ {
+ if(column != null)
+ {
+ return columns.IndexOf(column);
+ }
+ return -1;
+ }
+
+ public void Remove(DataGridColumn column)
+ {
+ if(column != null)
+ {
+ RemoveAt(IndexOf(column));
+ }
+ }
+
+ public void RemoveAt(int index)
+ {
+ if(index >= 0 && index < columns.Count)
+ {
+ columns.RemoveAt(index);
+ OnColumnsChanged();
+ }
+ //This exception is not documented, but thrown
+ throw new ArgumentOutOfRangeException("string");
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ ArrayList retVal = new ArrayList(columns.Count);
+ foreach(DataGridColumn current in this)
+ {
+ retVal.Add(((IStateManager)current).SaveViewState());
+ }
+ return retVal;
+ }
+
+ void IStateManager.LoadViewState(object savedState)
+ {
+ if(savedState != null && savedState is ArrayList)
+ {
+ int currentIndex = 0;
+ foreach(DataGridColumn current in (ArrayList)savedState)
+ {
+ ((IStateManager)columns[currentIndex ++]).LoadViewState(current);
+ }
+ }
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ trackViewState = true;
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return trackViewState;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs
new file mode 100644
index 00000000000..e5850371123
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventArgs.cs
@@ -0,0 +1,46 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: DataGridCommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataGridCommandEventArgs : CommandEventArgs
+ {
+ DataGridItem dgItem;
+ object cmdSrc;
+
+ public DataGridCommandEventArgs(DataGridItem item, object commandSource, CommandEventArgs originalArgs): base(originalArgs)
+ {
+ dgItem = item;
+ cmdSrc = originalArgs;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return cmdSrc;
+ }
+ }
+
+ public DataGridItem Item
+ {
+ get
+ {
+ return dgItem;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs
new file mode 100644
index 00000000000..bd06eed39f4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridCommandEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DataGridCommandEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridCommandEventHandler(object sender, DataGridCommandEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs
new file mode 100644
index 00000000000..059881ec5cb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItem.cs
@@ -0,0 +1,86 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridItem
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataGridItem : TableRow, INamingContainer
+ {
+ private int itemIndex;
+ private int dataSetIndex;
+ private ListItemType itemType;
+ private object dataItem;
+
+ public DataGridItem(int itemIndex, int dataSetIndex, ListItemType itemType): base()
+ {
+ this.itemIndex = itemIndex;
+ this.dataSetIndex = dataSetIndex;
+ this.itemType = itemType;
+ }
+
+ public virtual object DataItem
+ {
+ get
+ {
+ return dataItem;
+ }
+ set
+ {
+ dataItem = value;
+ }
+ }
+
+ public virtual int DataSetIndex
+ {
+ get
+ {
+ return dataSetIndex;
+ }
+ }
+
+ public virtual int ItemIndex
+ {
+ get
+ {
+ return itemIndex;
+ }
+ }
+
+ public virtual ListItemType ItemType
+ {
+ get
+ {
+ return itemType;
+ }
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ if(e is CommandEventArgs)
+ {
+ DataGridCommandEventArgs args = new DataGridCommandEventArgs(this, source, (CommandEventArgs)e);
+ RaiseBubbleEvent(this, args);
+ return true;
+ }
+ return false;
+ }
+
+ internal void SetItemType(ListItemType itemType)
+ {
+ this.itemType = itemType;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs
new file mode 100644
index 00000000000..8f73b541336
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemCollection.cs
@@ -0,0 +1,83 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridItemCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataGridItemCollection : ICollection, IEnumerable
+ {
+ private ArrayList items;
+
+ public DataGridItemCollection(ArrayList items)
+ {
+ this.items = items;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public DataGridItem this[int index]
+ {
+ get
+ {
+ return (DataGridItem)(items[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DataGridItem current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs
new file mode 100644
index 00000000000..4418b4cf00a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventArgs.cs
@@ -0,0 +1,37 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridItemEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataGridItemEventArgs : EventArgs
+ {
+ DataGridItem item;
+
+ public DataGridItemEventArgs(DataGridItem item)
+ {
+ this.item = item;
+ }
+
+ public DataGridItem Item
+ {
+ get
+ {
+ return item;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs
new file mode 100644
index 00000000000..de0f92cfa30
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridItemEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DataGridItemEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridItemEventHandler(object sender, DataGridItemEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs
new file mode 100644
index 00000000000..d63ac4940f9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventArgs.cs
@@ -0,0 +1,47 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridPageChangedEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataGridPageChangedEventArgs : EventArgs
+ {
+ private object source;
+ private int npIndex;
+
+ public DataGridPageChangedEventArgs(object commandSource, int newPageIndex)
+ {
+ source = commandSource;
+ npIndex = newPageIndex;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return source;
+ }
+ }
+
+ public int NewPageIndex
+ {
+ get
+ {
+ return npIndex;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs
new file mode 100644
index 00000000000..83dfc6d0dde
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPageChangedEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridPageChangedEventHandler(object sender, DataGridPageChangedEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs
new file mode 100644
index 00000000000..8e15bb77b79
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridPagerStyle.cs
@@ -0,0 +1,241 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridPagerStyle
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class DataGridPagerStyle : TableItemStyle
+ {
+ DataGrid owner;
+
+ private static int MODE = (0x01 << 19);
+ private static int NEXT_PG_TEXT = (0x01 << 20);
+ private static int PG_BTN_COUNT = (0x01 << 21);
+ private static int POSITION = (0x01 << 22);
+ private static int VISIBLE = (0x01 << 23);
+ private static int PREV_PG_TEXT = (0x01 << 24);
+
+ internal DataGridPagerStyle(DataGrid owner): base()
+ {
+ this.owner = owner;
+ }
+
+ public PagerMode Mode
+ {
+ get
+ {
+ if(IsSet(MODE))
+ {
+ return (PagerMode)ViewState["Mode"];
+ }
+ return PagerMode.NextPrev;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(PagerMode), value))
+ {
+ throw new NotImplementedException();
+ }
+ ViewState["Mode"] = value;
+ Set(MODE);
+ }
+ }
+
+ public string NextPageText
+ {
+ get
+ {
+ if(IsSet(NEXT_PG_TEXT))
+ {
+ return (string)ViewState["NextPageText"];
+ }
+ return "&gt;";
+ }
+ set
+ {
+ ViewState["NextPageText"] = value;
+ Set(NEXT_PG_TEXT);
+ }
+ }
+
+ public string PrevPageText
+ {
+ get
+ {
+ if(IsSet(PREV_PG_TEXT))
+ {
+ return (string)ViewState["PrevPageText"];
+ }
+ return "&lt;";
+ }
+ set
+ {
+ ViewState["PrevPageText"] = value;
+ Set(PREV_PG_TEXT);
+ }
+ }
+
+ public int PageButtonCount
+ {
+ get
+ {
+ if(IsSet(PG_BTN_COUNT))
+ {
+ return (int)ViewState["PageButtonCount"];
+ }
+ return 10;
+ }
+ set
+ {
+ ViewState["PageButtonCount"] = value;
+ Set(PG_BTN_COUNT);
+ }
+ }
+
+ public PagerPosition Position
+ {
+ get
+ {
+ if(IsSet(POSITION))
+ {
+ return (PagerPosition)ViewState["Position"];
+ }
+ return PagerPosition.Bottom;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(PagerPosition), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["Position"] = value;
+ Set(POSITION);
+ }
+ }
+
+ public bool Visible
+ {
+ get
+ {
+ if(IsSet(VISIBLE))
+ {
+ return (bool)ViewState["Visible"];
+ }
+ return true;
+ }
+ set
+ {
+ ViewState["Visible"] = value;
+ Set(PG_BTN_COUNT);
+ }
+ }
+
+ public override void CopyFrom(Style s)
+ {
+ if(s != null && !s.IsEmpty && s is DataGridPagerStyle)
+ {
+ base.CopyFrom(s);
+ DataGridPagerStyle from = (DataGridPagerStyle)s;
+ if(from.IsSet(MODE))
+ {
+ Mode = from.Mode;
+ }
+ if(from.IsSet(NEXT_PG_TEXT))
+ {
+ NextPageText = from.NextPageText;
+ }
+ if(from.IsSet(PG_BTN_COUNT))
+ {
+ PageButtonCount = from.PageButtonCount;
+ }
+ if(from.IsSet(POSITION))
+ {
+ Position = from.Position;
+ }
+ if(from.IsSet(VISIBLE))
+ {
+ Visible = from.Visible;
+ }
+ if(from.IsSet(PREV_PG_TEXT))
+ {
+ PrevPageText = from.PrevPageText;
+ }
+ }
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s != null && !s.IsEmpty && s is DataGridPagerStyle)
+ {
+ base.MergeWith(s);
+ DataGridPagerStyle with = (DataGridPagerStyle)s;
+ if(with.IsSet(MODE) && !IsSet(MODE))
+ {
+ Mode = with.Mode;
+ }
+ if(with.IsSet(NEXT_PG_TEXT) && !IsSet(NEXT_PG_TEXT))
+ {
+ NextPageText = with.NextPageText;
+ }
+ if(with.IsSet(PG_BTN_COUNT) && !IsSet(PG_BTN_COUNT))
+ {
+ PageButtonCount = with.PageButtonCount;
+ }
+ if(with.IsSet(POSITION) && !IsSet(POSITION))
+ {
+ Position = with.Position;
+ }
+ if(with.IsSet(VISIBLE) && !IsSet(VISIBLE))
+ {
+ Visible = with.Visible;
+ }
+ if(with.IsSet(PREV_PG_TEXT) && !IsSet(PREV_PG_TEXT))
+ {
+ PrevPageText = with.PrevPageText;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(MODE))
+ {
+ ViewState.Remove("Mode");
+ }
+ if(IsSet(NEXT_PG_TEXT))
+ {
+ ViewState.Remove("NextPageText");
+ }
+ if(IsSet(PG_BTN_COUNT))
+ {
+ ViewState.Remove("PageButtonCount");
+ }
+ if(IsSet(POSITION))
+ {
+ ViewState.Remove("Position");
+ }
+ if(IsSet(VISIBLE))
+ {
+ ViewState.Remove("Visible");
+ }
+ if(IsSet(PREV_PG_TEXT))
+ {
+ ViewState.Remove("PrevPageText");
+ }
+ base.Reset();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs
new file mode 100644
index 00000000000..564451fbb7a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventArgs.cs
@@ -0,0 +1,47 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataGridSortCommandEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataGridSortCommandEventArgs : EventArgs
+ {
+ private object source;
+ private string sortExpr;
+
+ public DataGridSortCommandEventArgs(object commandSource, DataGridCommandEventArgs dce)
+ {
+ source = commandSource;
+ sortExpr = (string)dce.CommandArgument;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return source;
+ }
+ }
+
+ public string SortExpression
+ {
+ get
+ {
+ return sortExpr;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs
new file mode 100644
index 00000000000..b9a1d2653b7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataGridSortCommandEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataGridSortCommandEventHandler(object sender, DataGridSortCommandEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs
new file mode 100644
index 00000000000..f4a010ac49b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataKeyCollection.cs
@@ -0,0 +1,83 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataKeyCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataKeyCollection : ICollection, IEnumerable
+ {
+ private ArrayList keys;
+
+ public DataKeyCollection(ArrayList keys)
+ {
+ this.keys = keys;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return keys.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public object this[int index]
+ {
+ get
+ {
+ return keys[index];
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(object current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return keys.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
new file mode 100755
index 00000000000..1cfda979874
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs
@@ -0,0 +1,824 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataList
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 70%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ //TODO: [Designer("??")]
+ //TODO: [Editor("??")]
+ public class DataList: BaseDataList, INamingContainer, IRepeatInfoUser
+ {
+ public const string CancelCommandName = "Cancel";
+ public const string DeleteCommandName = "Delete";
+ public const string EditCommandName = "Edit";
+ public const string SelectCommandName = "Select";
+ public const string UpdateCommandName = "Update";
+
+ private static readonly object CancelCommandEvent = new object();
+ private static readonly object DeleteCommandEvent = new object();
+ private static readonly object EditCommandEvent = new object();
+ private static readonly object ItemCommandEvent = new object();
+ private static readonly object ItemCreatedEvent = new object();
+ private static readonly object ItemDataBoundEvent = new object();
+ private static readonly object UpdateCommandEvent = new object();
+
+ private TableItemStyle alternatingItemStyle;
+ private TableItemStyle editItemStyle;
+ private TableItemStyle footerStyle;
+ private TableItemStyle headerStyle;
+ private TableItemStyle itemStyle;
+ private TableItemStyle selectedItemStyle;
+ private TableItemStyle separatorStyle;
+
+ private ITemplate alternatingItemTemplate;
+ private ITemplate editItemTemplate;
+ private ITemplate footerTemplate;
+ private ITemplate headerTemplate;
+ private ITemplate itemTemplate;
+ private ITemplate selectedItemTemplate;
+ private ITemplate separatorTemplate;
+ private ITemplate separatorItemTemplate;
+
+ private ArrayList itemsArray;
+ private DataListItemCollection items;
+
+ private bool extractTemplateRows;
+
+ public DataList(): base()
+ {
+ }
+
+ public virtual TableItemStyle AlternatingItemStyle
+ {
+ get
+ {
+ if(alternatingItemStyle == null)
+ {
+ alternatingItemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ alternatingItemStyle.TrackViewState();
+ }
+ return alternatingItemStyle;
+ }
+ }
+
+ public virtual ITemplate AlternatingItemTemplate
+ {
+ get
+ {
+ return alternatingItemTemplate;
+ }
+ set
+ {
+ alternatingItemTemplate = value;
+ }
+ }
+
+ public virtual int EditItemIndex
+ {
+ get
+ {
+ object o = ViewState["EditItemIndex"];
+ if(o != null)
+ return (int)o;
+ return -1;
+ }
+ set
+ {
+ ViewState["EditItemIndex"] = value;
+ }
+ }
+
+ public virtual TableItemStyle EditItemStyle
+ {
+ get
+ {
+ if(editItemStyle == null)
+ {
+ editItemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ editItemStyle.TrackViewState();
+ }
+ return editItemStyle;
+ }
+ }
+
+ public virtual ITemplate EditItemTemplate
+ {
+ get
+ {
+ return editItemTemplate;
+ }
+ set
+ {
+ editItemTemplate = value;
+ }
+ }
+
+ public virtual bool ExtractTemplateRows
+ {
+ get
+ {
+ object o = ViewState["ExtractTemplateRows"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ExtractTemplateRows"] = value;
+ }
+ }
+
+ public virtual TableItemStyle FooterStyle
+ {
+ get
+ {
+ if(footerStyle == null)
+ {
+ footerStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ footerStyle.TrackViewState();
+ }
+ return footerStyle;
+ }
+ }
+
+ public virtual ITemplate FooterTemplate
+ {
+ get
+ {
+ return footerTemplate;
+ }
+ set
+ {
+ footerTemplate = value;
+ }
+ }
+
+ public override GridLines GridLines
+ {
+ get
+ {
+ return GridLines;
+ }
+ set
+ {
+ GridLines = value;
+ }
+ }
+
+ public virtual TableItemStyle HeaderStyle
+ {
+ get
+ {
+ if(headerStyle == null)
+ {
+ headerStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ headerStyle.TrackViewState();
+ }
+ return headerStyle;
+ }
+ }
+
+ public virtual ITemplate HeaderTemplate
+ {
+ get
+ {
+ return headerTemplate;
+ }
+ set
+ {
+ headerTemplate = value;
+ }
+ }
+
+ public virtual DataListItemCollection Items
+ {
+ get
+ {
+ if(items == null)
+ {
+ if(itemsArray == null)
+ {
+ EnsureChildControls();
+ itemsArray = new ArrayList();
+ }
+ items = new DataListItemCollection(itemsArray);
+ }
+ return items;
+ }
+ }
+
+ public virtual TableItemStyle ItemStyle
+ {
+ get
+ {
+ if(itemStyle == null)
+ {
+ itemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ itemStyle.TrackViewState();
+ }
+ return itemStyle;
+ }
+ }
+
+ public virtual ITemplate ItemTemplate
+ {
+ get
+ {
+ return itemTemplate;
+ }
+ set
+ {
+ itemTemplate = value;
+ }
+ }
+
+ public virtual int RepeatColumns
+ {
+ get
+ {
+ object o = ViewState["RepeatColumns"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException("value");
+ ViewState["RepeatColumns"] = value;
+ }
+ }
+
+ public virtual RepeatDirection RepeatDirection
+ {
+ get
+ {
+ object o = ViewState["RepeatDirection"];
+ if(o != null)
+ return (RepeatDirection)o;
+ return RepeatDirection.Vertical;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatDirection), value))
+ throw new ArgumentException();
+ ViewState["RepeatDirection"] = value;
+ }
+ }
+
+ public virtual RepeatLayout RepeatLayout
+ {
+ get
+ {
+ object o = ViewState["RepeatLayout"];
+ if(o != null)
+ return (RepeatLayout)o;
+ return RepeatLayout.Table;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatLayout), value))
+ throw new ArgumentException();
+ ViewState["RepeatLayout"] = value;
+ }
+ }
+
+ public virtual int SelectedIndex
+ {
+ get
+ {
+ object o = ViewState["SelectedIndex"];
+ if(o != null)
+ return (int)o;
+ return -1;
+ }
+ set
+ {
+ //FIXME: Looks like a bug in Microsoft's specs.
+ // Exception is missing in document. I haven't tested the case
+ // But I think exception should follow
+ if(value < -1)
+ throw new ArgumentOutOfRangeException("value");
+ int prevSel = SelectedIndex;
+ ViewState["SelectedIndex"] = value;
+ DataListItem prevSelItem;
+ ListItemType liType;
+ if(itemsArray != null)
+ {
+ if(prevSel >= 0 && prevSel < itemsArray.Count)
+ {
+ prevSelItem = (DataListItem)itemsArray[prevSel];
+ if(prevSelItem.ItemType != ListItemType.EditItem)
+ {
+ liType = ( (prevSel % 2) == 0 ? ListItemType.AlternatingItem : ListItemType.Item );
+ prevSelItem.SetItemType(liType);
+ }
+ }
+ if(value >= 0 && value < itemsArray.Count)
+ {
+ prevSelItem = (DataListItem) itemsArray[value];
+ if(prevSelItem.ItemType != ListItemType.EditItem)
+ {
+ prevSelItem.SetItemType(ListItemType.SelectedItem);
+ }
+ }
+ }
+ }
+ }
+
+ public virtual DataListItem SelectedItem
+ {
+ get
+ {
+ if(SelectedIndex == -1)
+ return null;
+ return Items[SelectedIndex];
+ }
+ }
+
+ public virtual TableItemStyle SelectedItemStyle
+ {
+ get
+ {
+ if(selectedItemStyle == null)
+ {
+ selectedItemStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ selectedItemStyle.TrackViewState();
+ }
+ return selectedItemStyle;
+ }
+ }
+
+ public virtual ITemplate SelectedItemTemplate
+ {
+ get
+ {
+ return selectedItemTemplate;
+ }
+ set
+ {
+ selectedItemTemplate = value;
+ }
+ }
+
+ public virtual TableItemStyle SeparatorStyle
+ {
+ get
+ {
+ if(separatorStyle == null)
+ {
+ separatorStyle = new TableItemStyle();
+ if(IsTrackingViewState)
+ separatorStyle.TrackViewState();
+ }
+ return separatorStyle;
+ }
+ }
+
+ public virtual ITemplate SeparatorTemplate
+ {
+ get
+ {
+ return separatorTemplate;
+ }
+ set
+ {
+ separatorTemplate = value;
+ }
+ }
+
+ public virtual ITemplate SeparatorItemTemplate
+ {
+ get
+ {
+ return separatorItemTemplate;
+ }
+ set
+ {
+ separatorItemTemplate = value;
+ }
+ }
+
+ public virtual bool ShowHeader
+ {
+ get
+ {
+ object o = ViewState["ShowHeader"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowHeader"] = value;
+ }
+ }
+
+ public virtual bool ShowFooter
+ {
+ get
+ {
+ object o = ViewState["ShowFooter"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowFooter"] = value;
+ }
+ }
+
+ public event DataListCommandEventHandler CancelCommand
+ {
+ add
+ {
+ Events.AddHandler(CancelCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CancelCommandEvent, value);
+ }
+ }
+
+ public event DataListCommandEventHandler DeleteCommand
+ {
+ add
+ {
+ Events.AddHandler(DeleteCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DeleteCommandEvent, value);
+ }
+ }
+
+ public event DataListCommandEventHandler EditCommand
+ {
+ add
+ {
+ Events.AddHandler(EditCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(EditCommandEvent, value);
+ }
+ }
+
+ public event DataListCommandEventHandler ItemCommand
+ {
+ add
+ {
+ Events.AddHandler(ItemCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCommandEvent, value);
+ }
+ }
+
+ public event DataListCommandEventHandler ItemCreated
+ {
+ add
+ {
+ Events.AddHandler(ItemCreatedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCreatedEvent, value);
+ }
+ }
+
+ public event DataListCommandEventHandler ItemDataBound
+ {
+ add
+ {
+ Events.AddHandler(ItemDataBoundEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemDataBoundEvent, value);
+ }
+ }
+
+ public event DataListCommandEventHandler UpdateCommand
+ {
+ add
+ {
+ Events.AddHandler(UpdateCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(UpdateCommandEvent, value);
+ }
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ TableStyle retVal = new TableStyle(ViewState);
+ retVal.CellSpacing = 0;
+ return retVal;
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ object[] states;
+ if(savedState != null && (states = (object[])savedState) != null)
+ {
+ if(states[0] != null)
+ LoadViewState(states[0]);
+ if(states[1] != null)
+ alternatingItemStyle.LoadViewState(states[1]);
+ if(states[2] != null)
+ editItemStyle.LoadViewState(states[2]);
+ if(states[3] != null)
+ footerStyle.LoadViewState(states[3]);
+ if(states[4] != null)
+ headerStyle.LoadViewState(states[4]);
+ if(states[5] != null)
+ itemStyle.LoadViewState(states[5]);
+ if(states[6] != null)
+ selectedItemStyle.LoadViewState(states[6]);
+ if(states[7] != null)
+ separatorStyle.LoadViewState(states[7]);
+ }
+ }
+ protected override object SaveViewState()
+ {
+ object[] states = new object[8];
+ states[0] = SaveViewState();
+ states[1] = (alternatingItemStyle == null ? null : alternatingItemStyle.SaveViewState());
+ states[2] = (editItemStyle == null ? null : editItemStyle.SaveViewState());
+ states[3] = (footerStyle == null ? null : footerStyle.SaveViewState());
+ states[4] = (headerStyle == null ? null : headerStyle.SaveViewState());
+ states[5] = (itemStyle == null ? null : itemStyle.SaveViewState());
+ states[6] = (selectedItemStyle == null ? null : selectedItemStyle.SaveViewState());
+ states[7] = (separatorStyle == null ? null : separatorStyle.SaveViewState());
+ return states;
+ }
+
+ protected override void TrackViewState()
+ {
+ TrackViewState();
+ if(alternatingItemStyle != null)
+ alternatingItemStyle.TrackViewState();
+ if(editItemStyle != null)
+ editItemStyle.TrackViewState();
+ if(footerStyle != null)
+ footerStyle.TrackViewState();
+ if(headerStyle != null)
+ headerStyle.TrackViewState();
+ if(itemStyle != null)
+ itemStyle.TrackViewState();
+ if(selectedItemStyle != null)
+ selectedItemStyle.TrackViewState();
+ if(separatorStyle != null)
+ separatorStyle.TrackViewState();
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ bool retVal = false;
+ if(e is DataListCommandEventArgs)
+ {
+ DataListCommandEventArgs dlcea = (DataListCommandEventArgs)e;
+ OnItemCommand(dlcea);
+ retVal = true;
+ if(String.Compare(dlcea.CommandName, "Cancel") == 0)
+ {
+ OnCancelCommand(dlcea);
+ }
+ if(String.Compare(dlcea.CommandName, "Delete") == 0)
+ {
+ OnDeleteCommand(dlcea);
+ }
+ if(String.Compare(dlcea.CommandName, "Edit") == 0)
+ {
+ OnEditCommand(dlcea);
+ }
+ if(String.Compare(dlcea.CommandName, "Select") == 0)
+ {
+ SelectedIndex = dlcea.Item.ItemIndex;
+ OnSelectedIndexChanged(EventArgs.Empty);
+ }
+ if(String.Compare(dlcea.CommandName, "Update") == 0)
+ {
+ OnUpdateCommand(dlcea);
+ }
+ }
+ return retVal;
+ }
+
+ protected virtual void OnCancelCommand(DataListCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataListCommandEventHandler dlceh = (DataListCommandEventHandler)(Events[CancelCommandEvent]);
+ if(dlceh != null)
+ dlceh(this, e);
+ }
+ }
+
+ protected virtual void OnDeleteCommand(DataListCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataListCommandEventHandler dlceh = (DataListCommandEventHandler)(Events[DeleteCommandEvent]);
+ if(dlceh != null)
+ dlceh(this, e);
+ }
+ }
+
+ protected virtual void OnEditCommand(DataListCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataListCommandEventHandler dlceh = (DataListCommandEventHandler)(Events[EditCommandEvent]);
+ if(dlceh != null)
+ dlceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemCommand(DataListCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataListCommandEventHandler dlceh = (DataListCommandEventHandler)(Events[ItemCommandEvent]);
+ if(dlceh != null)
+ dlceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemCreated(DataListItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataListItemEventHandler dlceh = (DataListItemEventHandler)(Events[ItemCreatedEvent]);
+ if(dlceh != null)
+ dlceh(this, e);
+ }
+ }
+
+ protected virtual void OnItemDataBound(DataListItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataListItemEventHandler dlceh = (DataListItemEventHandler)(Events[ItemDataBoundEvent]);
+ if(dlceh != null)
+ dlceh(this, e);
+ }
+ }
+
+ protected virtual void OnUpdateCommand(DataListCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ DataListCommandEventHandler dlceh = (DataListCommandEventHandler)(Events[UpdateCommandEvent]);
+ if(dlceh != null)
+ dlceh(this, e);
+ }
+ }
+
+ [MonoTODO]
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ private DataListItem GetItem(ListItemType itemType, int repeatIndex)
+ {
+ DataListItem retVal = null;
+ switch(itemType)
+ {
+ case ListItemType.Header: retVal = (DataListItem)Controls[0];
+ break;
+ case ListItemType.Footer: retVal = (DataListItem)Controls[Controls.Count - 1];
+ break;
+ case ListItemType.Item: goto case ListItemType.EditItem;
+ case ListItemType.AlternatingItem: goto case ListItemType.EditItem;
+ case ListItemType.SelectedItem: goto case ListItemType.EditItem;
+ case ListItemType.EditItem: retVal = (DataListItem)Controls[repeatIndex];
+ break;
+ case ListItemType.Separator: int index = 2 * repeatIndex + 1;
+ if(headerTemplate != null)
+ index ++;
+ retVal = (DataListItem)Controls[index];
+ break;
+ }
+ return retVal;
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ [MonoTODO]
+ protected override void CreateControlHierarchy(bool create)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ [MonoTODO]
+ protected DataListItem CreateItem(int itemIndex, ListItemType itemType)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ private DataListItem CreateItem(int itemIndex, ListItemType itemType, bool dataBind, object dataItem)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ [MonoTODO]
+ protected override void PrepareControlHierarchy()
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ [MonoTODO]
+ protected void InitializeItem(DataListItem item)
+ {
+ throw new NotImplementedException();
+ }
+
+ bool IRepeatInfoUser.HasFooter
+ {
+ get
+ {
+ return !(ShowFooter && footerTemplate!=null);
+ }
+ }
+
+ bool IRepeatInfoUser.HasHeader
+ {
+ get
+ {
+ return !(ShowHeader && headerTemplate!=null);
+ }
+ }
+
+ bool IRepeatInfoUser.HasSeparators
+ {
+ get
+ {
+ return (separatorItemTemplate!=null);
+ }
+ }
+
+ int IRepeatInfoUser.RepeatedItemCount
+ {
+ get
+ {
+ if(itemsArray!=null)
+ return itemsArray.Count;
+ return 0;
+ }
+ }
+
+ void IRepeatInfoUser.RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+ {
+ DataListItem item = GetItem(itemType, repeatIndex);
+ if(item!=null)
+ {
+ item.RenderItem(writer, extractTemplateRows, repeatInfo.RepeatLayout == RepeatLayout.Table);
+ }
+ }
+
+ Style IRepeatInfoUser.GetItemStyle(ListItemType itemType, int repeatIndex)
+ {
+ if(GetItem(itemType, repeatIndex)!=null && ControlStyleCreated)
+ return ControlStyle;
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs
new file mode 100644
index 00000000000..93511a27730
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventArgs.cs
@@ -0,0 +1,46 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: DataListCommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataListCommandEventArgs: CommandEventArgs
+ {
+ private DataListItem dlItem;
+ private object cmdSrc;
+
+ public DataListCommandEventArgs(DataListItem item, object commandSource, CommandEventArgs originalArgs): base(originalArgs)
+ {
+ dlItem = item;
+ cmdSrc = commandSource;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return cmdSrc;
+ }
+ }
+
+ public DataListItem Item
+ {
+ get
+ {
+ return dlItem;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs
new file mode 100644
index 00000000000..59df1b2fe50
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListCommandEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataListCommandEventHandler(object sender, DataListCommandEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs
new file mode 100644
index 00000000000..9928ccc603e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItem.cs
@@ -0,0 +1,93 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataListItem
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxItem(false)]
+ public class DataListItem : WebControl, INamingContainer
+ {
+ int itemIndex;
+ ListItemType itemType;
+ object dataItem;
+
+ public DataListItem(int itemIndex, ListItemType itemType)
+ {
+ this.itemIndex = itemIndex;
+ this.itemType = itemType;
+ }
+
+ public virtual object DataItem
+ {
+ get
+ {
+ return dataItem;
+ }
+ set
+ {
+ dataItem = value;
+ }
+ }
+
+ public virtual int ItemIndex
+ {
+ get
+ {
+ return itemIndex;
+ }
+ }
+
+ public virtual ListItemType ItemType
+ {
+ get
+ {
+ return itemType;
+ }
+ }
+
+ [MonoTODO]
+ public virtual void RenderItem(HtmlTextWriter writer, bool extractRows, bool tableLayout)
+ {
+ //TODO: Complete me!
+ throw new NotImplementedException();
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableItemStyle();
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ if(e is CommandEventArgs)
+ {
+ RaiseBubbleEvent(this, new DataListCommandEventArgs(this, source, (CommandEventArgs)e));
+ return true;
+ }
+ return false;
+ }
+
+ internal void SetItemType(ListItemType itemType)
+ {
+ if(Enum.IsDefined(typeof(ListItemType), itemType))
+ {
+ this.itemType = itemType;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs
new file mode 100644
index 00000000000..b98df0906d1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemCollection.cs
@@ -0,0 +1,83 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataListItemCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataListItemCollection : ICollection, IEnumerable
+ {
+ private ArrayList items;
+
+ public DataListItemCollection(ArrayList items)
+ {
+ this.items = items;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public DataListItem this[int index]
+ {
+ get
+ {
+ return (DataListItem)(items[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DataListItem current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs
new file mode 100644
index 00000000000..f9488bea1a6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventArgs.cs
@@ -0,0 +1,37 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DataListItemEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DataListItemEventArgs : EventArgs
+ {
+ private DataListItem item;
+
+ public DataListItemEventArgs(DataListItem item)
+ {
+ this.item = item;
+ }
+
+ public DataListItem Item
+ {
+ get
+ {
+ return item;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs
new file mode 100644
index 00000000000..3310857658d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DataListItemEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DataListItemEventHandler(object sender, DataListItemEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs
new file mode 100755
index 00000000000..39aaffb4b83
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DayNameFormat.cs
@@ -0,0 +1,23 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: DayNameFormat
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum DayNameFormat
+ {
+ Full,
+ Short,
+ FirstLetter,
+ FirstTwoLetters
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs
new file mode 100644
index 00000000000..a7e50cf9cdd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventArgs.cs
@@ -0,0 +1,43 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DayRenderEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class DayRenderEventArgs
+ {
+ private TableCell cell;
+ private CalendarDay day;
+
+ public DayRenderEventArgs(TableCell cell, CalendarDay day)
+ {
+ this.cell = cell;
+ this.day = day;
+ }
+
+ public TableCell Cell
+ {
+ get
+ {
+ return cell;
+ }
+ }
+
+ public CalendarDay Day
+ {
+ get
+ {
+ return day;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs
new file mode 100644
index 00000000000..1501321ffb9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DayRenderEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Delegate: DayRenderEventHandler
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void DayRenderEventHandler(object sender, DayRenderEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
new file mode 100644
index 00000000000..a128c33cdeb
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/DropDownList.cs
@@ -0,0 +1,156 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: DropDownList
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections.Specialized;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ValidationProperty("SelectedItem")]
+ public class DropDownList : ListControl, IPostBackDataHandler
+ {
+ public DropDownList(): base()
+ {
+ }
+
+ public override Color BorderColor
+ {
+ get
+ {
+ return BorderColor;
+ }
+ set
+ {
+ BorderColor = value;
+ }
+ }
+
+ public override BorderStyle BorderStyle
+ {
+ get
+ {
+ return BorderStyle;
+ }
+ set
+ {
+ BorderStyle = value;
+ }
+ }
+
+ public override Unit BorderWidth
+ {
+ get
+ {
+ return BorderWidth;
+ }
+ set
+ {
+ BorderWidth = value;
+ }
+ }
+
+ public override int SelectedIndex
+ {
+ get
+ {
+ return SelectedIndex;
+ }
+ set
+ {
+ SelectedIndex = value;
+ }
+ }
+
+ public override string ToolTip
+ {
+ get
+ {
+ return ToolTip;
+ }
+ set
+ {
+ ToolTip = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ if(Page != null)
+ {
+ Page.VerifyRenderingInServerForm(this);
+ }
+ writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
+ AddAttributesToRender(writer);
+
+ if(AutoPostBack && Page != null)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Onchange, Page.GetPostBackClientEvent(this,""));
+ writer.AddAttribute("language", "javascript");
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection()
+ {
+ return new EmptyControlCollection(this);
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ if(Items != null)
+ {
+ bool selected = false;
+ foreach(ListItem current in Items)
+ {
+ writer.WriteBeginTag("option");
+ if(current.Selected)
+ {
+ if(selected)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Multiselect_In_DropDownList"));
+ }
+ selected = true;
+ writer.WriteAttribute("selected", "selected", false);
+ }
+ writer.WriteAttribute("value", current.Value, true);
+ writer.Write('>');
+ HttpUtility.HtmlEncode(current.Text, writer);
+ writer.WriteEndTag("option");
+ writer.WriteLine();
+ }
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ string[] vals = postCollection.GetValues(postDataKey);
+ if(vals != null)
+ {
+ int index = Items.FindByValueInternal(vals[0]);
+ if(index != SelectedIndex)
+ {
+ SelectedIndex = index;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ OnSelectedIndexChanged(EventArgs.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs
new file mode 100644
index 00000000000..7779f07ce11
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/EditCommandColumn.cs
@@ -0,0 +1,109 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: EditCommandColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class EditCommandColumn : DataGridColumn
+ {
+ public EditCommandColumn(): base()
+ {
+ }
+
+ public virtual ButtonColumnType ButtonType
+ {
+ get
+ {
+ object o = ViewState["ButtonType"];
+ if(o != null)
+ {
+ return (ButtonColumnType)o;
+ }
+ return ButtonColumnType.LinkButton;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(ButtonColumnType), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["ButtonType"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string CancelText
+ {
+ get
+ {
+ object o = ViewState["CancelText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CancelText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string EditText
+ {
+ get
+ {
+ object o = ViewState["EditText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["EditText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual string UpdateText
+ {
+ get
+ {
+ object o = ViewState["UpdateText"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["UpdateText"] = value;
+ OnColumnChanged();
+ }
+ }
+
+ [MonoTODO]
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell(cell, columnIndex, itemType);
+ //TODO: I have to read some documents.
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs
new file mode 100755
index 00000000000..3b618c7acbf
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FirstDayOfWeek.cs
@@ -0,0 +1,27 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: FirstDayOfWeek
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum FirstDayOfWeek
+ {
+ Sunday,
+ Monday,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday,
+ Default
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs
new file mode 100755
index 00000000000..1dcf22b9c7a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontInfo.cs
@@ -0,0 +1,253 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: FontInfo
+ *
+ * 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)
+ */
+
+using System;
+using System.Text;
+using System.Reflection;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public sealed class FontInfo
+ {
+ private Style infoOwner;
+
+ internal FontInfo(Style owner)
+ {
+ infoOwner = owner;
+ }
+
+ /// <summary>
+ /// Default constructor
+ /// <remarks>
+ /// The default constructor is made private to prevent any instances being made.
+ /// </remarks>
+ /// </summary>
+ private FontInfo()
+ {
+ }
+
+ public bool Bold
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_BOLD))
+ return (bool)(infoOwner.ViewState["FontInfoBold"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoBold"] = value;
+ infoOwner.Set(Style.FONT_BOLD);
+ }
+ }
+
+ public bool Italic
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_ITALIC))
+ return (bool)(infoOwner.ViewState["FontInfoItalic"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoItalic"] = value;
+ infoOwner.Set(Style.FONT_ITALIC);
+ }
+ }
+
+ public bool Overline
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_OLINE))
+ return (bool)(infoOwner.ViewState["FontInfoOverline"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoOverline"] = value;
+ infoOwner.Set(Style.FONT_OLINE);
+ }
+ }
+
+ public bool Strikeout
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_STRIKE))
+ return (bool)(infoOwner.ViewState["FontInfoStrikeout"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoStrikeout"] = value;
+ infoOwner.Set(Style.FONT_STRIKE);
+ }
+ }
+
+ public bool Underline
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_ULINE))
+ return (bool)(infoOwner.ViewState["FontInfoUnderline"]);
+ return false;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoUnderline"] = value;
+ infoOwner.Set(Style.FONT_ULINE);
+ }
+ }
+
+ //TODO: How do I check if the value is negative. FontUnit is struct not enum
+ public FontUnit Size
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_SIZE))
+ return (FontUnit)(infoOwner.ViewState["FontInfoSize"]);
+ return FontUnit.Empty;
+ }
+ set
+ {
+ infoOwner.ViewState["FontInfoSize"] = value;
+ infoOwner.Set(Style.FONT_SIZE);
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ if(Names!=null)
+ return Names[0];
+ return String.Empty;
+ }
+ set
+ {
+ if(value == null)
+ throw new ArgumentException();
+ string[] strArray = null;
+ if(value.Length > 0)
+ {
+ strArray = new string[1];
+ strArray[0] = value;
+ }
+ Names = strArray;
+ }
+ }
+
+ public string[] Names
+ {
+ get
+ {
+ if(infoOwner.IsSet(Style.FONT_NAMES))
+ return (string[])(infoOwner.ViewState["FontInfoNames"]);
+ return (new string[0]);
+ }
+ set
+ {
+ if(value!=null)
+ {
+ infoOwner.ViewState["FontInfoNames"] = value;
+ infoOwner.Set(Style.FONT_NAMES);
+ }
+ }
+ }
+
+ internal void Reset()
+ {
+ if(infoOwner.IsSet(Style.FONT_NAMES))
+ infoOwner.ViewState.Remove("FontInfoNames");
+ if(infoOwner.IsSet(Style.FONT_BOLD))
+ infoOwner.ViewState.Remove("FontInfoBold");
+ if(infoOwner.IsSet(Style.FONT_ITALIC))
+ infoOwner.ViewState.Remove("FontInfoItalic");
+ if(infoOwner.IsSet(Style.FONT_STRIKE))
+ infoOwner.ViewState.Remove("FontInfoStrikeout");
+ if(infoOwner.IsSet(Style.FONT_OLINE))
+ infoOwner.ViewState.Remove("FontInfoOverline");
+ if(infoOwner.IsSet(Style.FONT_ULINE))
+ infoOwner.ViewState.Remove("FontInfoUnderline");
+ if(infoOwner.IsSet(Style.FONT_SIZE) && infoOwner.Font.Size != FontUnit.Empty)
+ infoOwner.ViewState.Remove("FontInfoSize");
+ }
+
+ internal Style Owner
+ {
+ get
+ {
+ return infoOwner;
+ }
+ }
+
+ public void CopyFrom(FontInfo source)
+ {
+ if(source!=null)
+ {
+ if(source.Owner.IsSet(Style.FONT_NAMES))
+ Names = source.Names;
+ if(source.Owner.IsSet(Style.FONT_BOLD))
+ Bold = source.Bold;
+ if(source.Owner.IsSet(Style.FONT_ITALIC))
+ Italic = source.Italic;
+ if(source.Owner.IsSet(Style.FONT_STRIKE))
+ Strikeout = source.Strikeout;
+ if(source.Owner.IsSet(Style.FONT_OLINE))
+ Overline = source.Overline;
+ if(source.Owner.IsSet(Style.FONT_ULINE))
+ Underline = source.Underline;
+ if(source.Owner.IsSet(Style.FONT_SIZE) && source.Size != FontUnit.Empty)
+ Size = source.Size;
+ }
+ }
+
+ public void MergeWith(FontInfo with)
+ {
+ if(with!=null)
+ {
+ if(with.Owner.IsSet(Style.FONT_NAMES) && !infoOwner.IsSet(Style.FONT_NAMES))
+ Names = with.Names;
+ if(with.Owner.IsSet(Style.FONT_BOLD) && !infoOwner.IsSet(Style.FONT_BOLD))
+ Bold = with.Bold;
+ if(with.Owner.IsSet(Style.FONT_ITALIC) && !infoOwner.IsSet(Style.FONT_ITALIC))
+ Italic = with.Italic;
+ if(with.Owner.IsSet(Style.FONT_STRIKE) && !infoOwner.IsSet(Style.FONT_STRIKE))
+ Strikeout = with.Strikeout;
+ if(with.Owner.IsSet(Style.FONT_OLINE) && !infoOwner.IsSet(Style.FONT_OLINE))
+ Overline = with.Overline;
+ if(with.Owner.IsSet(Style.FONT_ULINE) && !infoOwner.IsSet(Style.FONT_ULINE))
+ Underline = with.Underline;
+ if(with.Owner.IsSet(Style.FONT_SIZE) && with.Size != FontUnit.Empty && !infoOwner.IsSet(Style.FONT_SIZE))
+ Size = with.Size;
+ }
+ }
+
+ public bool ShouldSerializeNames()
+ {
+ return (Names.Length > 0);
+ }
+
+ public override string ToString()
+ {
+ return ( (Name.Length > 0) ? (Name.ToString() + ", " + Size.ToString()) : Size.ToString() );
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs
new file mode 100644
index 00000000000..3a04e327a56
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontNamesConverter.cs
@@ -0,0 +1,63 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: FontNamesConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class FontNamesConverter : TypeConverter
+ {
+ public FontNamesConverter(): base()
+ {
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ return (sourceType == typeof(string));
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if(value is string)
+ {
+ string fontNames = (string)value;
+ if(fontNames.Length == 0)
+ {
+ return (new string[0]);
+ }
+ string[] names = fontNames.Split(new char[] { ','});
+ for(int i=0; i < names.Length; i++)
+ {
+ names[i] = names[i].Trim();
+ }
+ return names;
+ }
+ throw GetConvertFromException(value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if(destinationType == typeof(string))
+ {
+ if(value == null || ((string[])value) == null)
+ return String.Empty;
+ return String.Join(",", (string[])value);
+ }
+ throw GetConvertToException(value, destinationType);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs
new file mode 100755
index 00000000000..f72e3d455aa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontSize.cs
@@ -0,0 +1,30 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: FontSize
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum FontSize
+ {
+ NotSet,
+ AsUnit,
+ Smaller,
+ Larger,
+ XXSmall,
+ XSmall,
+ Small,
+ Medium,
+ Large,
+ XLarge,
+ XXLarge
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs
new file mode 100644
index 00000000000..b9242e892c4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnit.cs
@@ -0,0 +1,211 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Struct: FontUnit
+ *
+ * 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)
+ */
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public struct FontUnit
+ {
+ public static readonly FontUnit Empty = new FontUnit();
+ public static readonly FontUnit Large = new FontUnit(FontSize.Large);
+ public static readonly FontUnit Larger = new FontUnit(FontSize.Larger);
+ public static readonly FontUnit Medium = new FontUnit(FontSize.Medium);
+ public static readonly FontUnit Small = new FontUnit(FontSize.Small);
+ public static readonly FontUnit Smaller = new FontUnit(FontSize.Smaller);
+ public static readonly FontUnit XLarge = new FontUnit(FontSize.XLarge);
+ public static readonly FontUnit XSmall = new FontUnit(FontSize.XSmall);
+ public static readonly FontUnit XXLarge = new FontUnit(FontSize.XXLarge);
+ public static readonly FontUnit XXSmall = new FontUnit(FontSize.XXSmall);
+
+ private FontSize type;
+ private Unit val;
+
+ public FontUnit(FontSize type)
+ {
+ if(!Enum.IsDefined(typeof(FontSize), type))
+ throw new ArgumentException();
+ this.type = type;
+ if(this.type == FontSize.AsUnit)
+ {
+ val = Unit.Point(10);
+ } else
+ {
+ val = Unit.Empty;
+ }
+ }
+
+ public FontUnit(int value)
+ {
+ type = FontSize.AsUnit;
+ val = Unit.Point(value);
+ }
+
+ public FontUnit(string value): this(value, CultureInfo.CurrentCulture)
+ {
+ }
+
+ public FontUnit(Unit value)
+ {
+ if(value.IsEmpty)
+ {
+ type = FontSize.NotSet;
+ val = Unit.Empty;
+ } else
+ {
+ type = FontSize.AsUnit;
+ val = value;
+ }
+ }
+
+ public FontUnit(string value, CultureInfo culture)
+ {
+ type = FontSize.NotSet;
+ val = Unit.Empty;
+ if(value != null && value != String.Empty)
+ {
+ string low = value.ToLower(culture);
+ int index = GetTypeFromString(low);
+ if( index != -1)
+ {
+ type = (FontSize)index;
+ return;
+ } else
+ {
+ val = new Unit(value, culture, UnitType.Point);
+ type = FontSize.AsUnit;
+ }
+ }
+ }
+
+ private int GetTypeFromString(string strVal)
+ {
+ string[] values = {
+ "smaller",
+ "larger",
+ "xx-small",
+ "x-small",
+ "small",
+ "medium",
+ "large",
+ "xlarge",
+ "xxlarge"
+ };
+ int i = 0;
+ foreach(string valType in values)
+ {
+ if(strVal == valType)
+ {
+ return (i + 2);
+ }
+ i++;
+ }
+ return -1;
+ }
+
+ public static FontUnit Parse(string s)
+ {
+ return Parse(s, CultureInfo.CurrentCulture);
+ }
+
+ public static FontUnit Parse(string s, CultureInfo culture)
+ {
+ return new FontUnit(s, culture);
+ }
+
+ public static FontUnit Point(int n)
+ {
+ return new FontUnit(n);
+ }
+
+ public static bool operator ==(FontUnit left, FontUnit right)
+ {
+ return (left.type == right.type && left.val == right.val);
+ }
+
+ public static bool operator !=(FontUnit left, FontUnit right)
+ {
+ return !(left == right);
+ }
+
+ public static implicit operator FontUnit(int n)
+ {
+ return FontUnit.Point(n);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj!= null && obj is FontUnit)
+ {
+ FontUnit that = (FontUnit)obj;
+ return (this.type == that.type && this.val == that.val);
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return ( (type.GetHashCode() << 2) | val.GetHashCode() );
+ }
+
+ public override string ToString()
+ {
+ return ToString(CultureInfo.CurrentCulture);
+ }
+
+ public string ToString(CultureInfo culture)
+ {
+ if(IsEmpty)
+ {
+ return String.Empty;
+ }
+ //string strRepr = String.Empty;
+ switch(type)
+ {
+ case FontSize.AsUnit: return val.ToString(culture);
+ case FontSize.XXSmall: return "XX-Small";
+ case FontSize.XSmall: return "X-Small";
+ case FontSize.XLarge: return "X-Large";
+ case FontSize.XXLarge: return "XX-Large";
+ default: return PropertyConverter.EnumToString(typeof(FontSize), type);
+ }
+ }
+
+ public bool IsEmpty
+ {
+ get
+ {
+ return (type == FontSize.NotSet);
+ }
+ }
+
+ public FontSize Type
+ {
+ get
+ {
+ return type;
+ }
+ }
+
+ public Unit Unit
+ {
+ get
+ {
+ return val;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs
new file mode 100644
index 00000000000..7197e219b80
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/FontUnitConverter.cs
@@ -0,0 +1,81 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: FontUnitConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class FontUnitConverter : TypeConverter
+ {
+ public FontUnitConverter(): base()
+ {
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ if(sourceType == typeof(string))
+ return true;
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if(value == null)
+ return null;
+ if(value is string)
+ {
+ string val = ((string)value).Trim();
+ if(val.Length == 0)
+ {
+ return FontUnit.Empty;
+ }
+ return FontUnit.Parse(val, culture);
+ }
+ return base.ConvertFrom(context, culture, value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if(value != null && value is FontUnit)
+ {
+ FontUnit val = (FontUnit)value;
+ if(val.Type == FontSize.NotSet)
+ {
+ return String.Empty;
+ }
+ return val.ToString(culture);
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ [MonoTODO("GetStandardValues")]
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs b/mcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs
new file mode 100755
index 00000000000..b013b5a1779
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/GridLines.cs
@@ -0,0 +1,23 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: GridLines
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum GridLines
+ {
+ None,
+ Horizontal,
+ Vertical,
+ Both
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs
new file mode 100755
index 00000000000..079e26419c1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HorizontalAlign.cs
@@ -0,0 +1,24 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: HorizontalAlign
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum HorizontalAlign
+ {
+ NotSet,
+ Left,
+ Center,
+ Right,
+ Justify
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs
new file mode 100755
index 00000000000..c80a58b3f71
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLink.cs
@@ -0,0 +1,158 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: HyperLink
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: gvaish@iitk.ac.in, myscripts_2001@yahoo.com
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Text")]
+ //[Designer(??)]
+ [ControlBuilder(typeof(HyperLinkControlBuilder))]
+ //[DataBindingHandler("??")]
+ [ParseChildren(false)]
+ [ToolboxData("<{0}:HyperLink runat=\"server\">HyperLink</{0}:HyperLink>")]
+ public class HyperLink: WebControl
+ {
+ public HyperLink(): base()
+ {
+ }
+
+ public virtual string ImageUrl
+ {
+ get
+ {
+ object o = ViewState["ImageUrl"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ImageUrl"] = value;
+ }
+ }
+
+ public string NavigateUrl
+ {
+ get
+ {
+ object o = ViewState["NavigateUrl"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["NavigateUrl"] = value;
+ }
+ }
+
+ public string Target
+ {
+ get
+ {
+ object o = ViewState["Target"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Target"] = value;
+ }
+ }
+
+ public virtual string Text
+ {
+ get
+ {
+ object o = ViewState["Text"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ AddAttributesToRender(writer);
+ if(NavigateUrl.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Href, NavigateUrl);
+ }
+ if(Target.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Target, Target);
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ if(HasControls())
+ {
+ base.AddParsedSubObject(obj);
+ return;
+ }
+ if(obj is LiteralControl)
+ {
+ Text = ((LiteralControl)obj).Text;
+ return;
+ }
+ if(Text.Length > 0)
+ {
+ base.AddParsedSubObject(Text);
+ Text = String.Empty;
+ }
+ AddParsedSubObject(obj);
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if(savedState != null)
+ {
+ base.LoadViewState(savedState);
+ object o = ViewState["Text"];
+ if(o!=null)
+ Text = (string)o;
+ }
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ if(ImageUrl.Length > 0)
+ {
+ Image img = new Image();
+ img.ImageUrl = ResolveUrl(ImageUrl);
+ if(ToolTip.Length > 0)
+ img.ToolTip = ToolTip;
+ if(Text.Length > 0)
+ img.AlternateText = Text;
+ img.RenderControl(writer);
+ return;
+ }
+ if(HasControls())
+ {
+ base.RenderControl(writer);
+ return;
+ }
+ writer.Write(Text);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs
new file mode 100644
index 00000000000..a2eb2465950
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkColumn.cs
@@ -0,0 +1,221 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: HyperLinkColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 5%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class HyperLinkColumn: DataGridColumn
+ {
+ PropertyDescriptor textFieldDescriptor;
+ PropertyDescriptor urlFieldDescriptor;
+
+ public HyperLinkColumn(): base()
+ {
+ }
+
+ public virtual string DataNavigateUrlField
+ {
+ get
+ {
+ object o = ViewState["DataNavigateUrlField"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataNavigateUrlField"] = value;
+ }
+ }
+
+ public virtual string DataNavigateUrlFormatString
+ {
+ get
+ {
+ object o = ViewState["DataNavigateUrlFormatString"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataNavigateUrlFormatString"] = value;
+ }
+ }
+
+ public virtual string DataTextField
+ {
+ get
+ {
+ object o = ViewState["DataTextField"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextField"] = value;
+ }
+ }
+
+ public virtual string DataTextFormatString
+ {
+ get
+ {
+ object o = ViewState["DataTextFormatString"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextFormatString"] = value;
+ }
+ }
+
+ public virtual string NavigateUrl
+ {
+ get
+ {
+ object o = ViewState["NavigateUrl"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["NavigateUrl"] = value;
+ }
+ }
+
+ public virtual string Target
+ {
+ get
+ {
+ object o = ViewState["Target"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Target"] = value;
+ }
+ }
+
+ public virtual string Text
+ {
+ get
+ {
+ object o = ViewState["Text"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+
+ public override void Initialize()
+ {
+ textFieldDescriptor = null;
+ urlFieldDescriptor = null;
+ }
+
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ InitializeCell(cell, columnIndex, itemType);
+ if(Enum.IsDefined(typeof(ListItemType), itemType) && itemType != ListItemType.Footer)
+ {
+ HyperLink toDisplay = new HyperLink();
+ toDisplay.Text = Text;
+ toDisplay.NavigateUrl = NavigateUrl;
+ toDisplay.Target = Target;
+ if(DataTextField.Length > 0 || DataNavigateUrlField.Length>0)
+ {
+ toDisplay.DataBinding += new EventHandler(OnDataBindHyperLinkColumn);
+ }
+ cell.Controls.Add(toDisplay);
+ }
+ }
+
+ private void OnDataBindHyperLinkColumn(object sender, EventArgs e)
+ {
+ HyperLink link = (HyperLink)sender;
+ object item = ((DataGridItem)link.NamingContainer).DataItem;
+ if(textFieldDescriptor == null && urlFieldDescriptor == null)
+ {
+ textFieldDescriptor = TypeDescriptor.GetProperties(item).Find(DataTextField, true);
+ if(textFieldDescriptor == null && !DesignMode)
+ throw new HttpException(HttpRuntime.FormatResourceString("Field_Not_Found", DataTextField));
+ urlFieldDescriptor = TypeDescriptor.GetProperties(item).Find(DataNavigateUrlField, true);
+ if(urlFieldDescriptor == null && !DesignMode)
+ throw new HttpException(HttpRuntime.FormatResourceString("Field_Not_Found", DataNavigateUrlField));
+ }
+
+ if(textFieldDescriptor != null)
+ {
+ link.Text = FormatDataTextValue(textFieldDescriptor.GetValue(item));
+ } else
+ {
+ link.Text = "Sample_DataBound_Text";
+ }
+
+ if(urlFieldDescriptor != null)
+ {
+ link.NavigateUrl = FormatDataNavigateUrlValue(urlFieldDescriptor.GetValue(item));
+ } else
+ {
+ link.NavigateUrl = "url";
+ }
+ }
+
+ protected virtual string FormatDataNavigateUrlValue(object dataUrlValue)
+ {
+ string retVal = String.Empty;
+ if(dataUrlValue != null)
+ {
+ if(DataNavigateUrlFormatString.Length > 0)
+ {
+ retVal = String.Format(DataNavigateUrlFormatString, dataUrlValue);
+ } else
+ {
+ retVal = dataUrlValue.ToString();
+ }
+ }
+ return retVal;
+ }
+
+ protected virtual string FormatDataTextValue(object dataTextValue)
+ {
+ string retVal = String.Empty;
+ if(dataTextValue != null)
+ {
+ if(DataTextFormatString.Length > 0)
+ {
+ retVal = String.Format(DataTextFormatString, dataTextValue);
+ } else
+ {
+ retVal = dataTextValue.ToString();
+ }
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs
new file mode 100644
index 00000000000..cca04d06622
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/HyperLinkControlBuilder.cs
@@ -0,0 +1,27 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: HyperLinkControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public class HyperLinkControlBuilder : ControlBuilder
+ {
+ public HyperLinkControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs b/mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs
new file mode 100755
index 00000000000..47526f80d8e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/IRepeatInfoUser.cs
@@ -0,0 +1,29 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Interface: IRepeatInfoUser
+ *
+ * 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)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public interface IRepeatInfoUser
+ {
+ bool HasFooter { get; }
+ bool HasHeader { get; }
+ bool HasSeparators { get; }
+ int RepeatedItemCount { get; }
+ void RenderItem(ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer);
+ Style GetItemStyle(ListItemType itemType, int repeatIndex);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
new file mode 100644
index 00000000000..de71423075a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
@@ -0,0 +1,118 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Image
+ *
+ * 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)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("ImageUrl")]
+ public class Image : WebControl
+ {
+ public Image(): base(HtmlTextWriterTag.Img)
+ {
+ }
+
+ public virtual string AlternateText
+ {
+ get
+ {
+ object o = ViewState["AlternateText"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["AlternateText"] = value;
+ }
+ }
+
+ public override bool Enabled
+ {
+ get
+ {
+ return base.Enabled;
+ }
+ set
+ {
+ base.Enabled = value;
+ }
+ }
+
+ public override FontInfo Font
+ {
+ get
+ {
+ return base.Font;
+ }
+ }
+
+ public virtual ImageAlign ImageAlign
+ {
+ get
+ {
+ object o = ViewState["ImageAlign"];
+ if(o!=null)
+ return (ImageAlign)o;
+ return ImageAlign.NotSet;
+ }
+ set
+ {
+ ViewState["ImageAlign"] = value;
+ }
+ }
+
+ public virtual string ImageUrl
+ {
+ get
+ {
+ object o = ViewState["ImageUrl"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ImageUrl"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ AddAttributesToRender(writer);
+ if(ImageUrl.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Src, ResolveUrl(ImageUrl));
+ }
+ if(AlternateText.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Alt, AlternateText);
+ }
+ if(BorderWidth.IsEmpty)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
+ }
+ if(ImageAlign != ImageAlign.NotSet)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(ImageAlign), ImageAlign, "G"));
+ }
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs
new file mode 100755
index 00000000000..5a5fa02db58
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ImageAlign.cs
@@ -0,0 +1,29 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ImageAlign
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ImageAlign
+ {
+ NotSet,
+ Left,
+ Right,
+ Baseline,
+ Top,
+ Middle,
+ Bottom,
+ AbsBottom,
+ AbsMiddle,
+ TextTop
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs
new file mode 100644
index 00000000000..361a792f018
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ImageButton.cs
@@ -0,0 +1,181 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ImageButton
+ *
+ * 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)
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("Click")]
+ public class ImageButton: Image, IPostBackDataHandler, IPostBackEventHandler
+ {
+ private static readonly object ClickEvent = new object();
+ private static readonly object CommandEvent = new object();
+
+ private int x, y;
+
+ public ImageButton(): base()
+ {
+ }
+
+ public bool CausesValidation
+ {
+ get
+ {
+ object o = ViewState["CausesValidation"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["CausesValidation"] = value;
+ }
+ }
+
+ public string CommandArgument
+ {
+ get
+ {
+ object o = ViewState["CommandArgument"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandArgument"] = value;
+ }
+ }
+
+ public string CommandName
+ {
+ get
+ {
+ object o = ViewState["CommandName"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandName"] = value;
+ }
+ }
+
+ protected override HtmlTextWriterTag TagKey
+ {
+ get
+ {
+ return HtmlTextWriterTag.Input;
+ }
+ }
+
+ public event ImageClickEventHandler Click
+ {
+ add
+ {
+ Events.AddHandler(ClickEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ClickEvent, value);
+ }
+ }
+
+ public event CommandEventHandler Command
+ {
+ add
+ {
+ Events.AddHandler(CommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CommandEvent, value);
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Type, "image");
+ writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
+ if(Page != null && CausesValidation)
+ {
+ if(Page.Validators.Count > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Onclick, Utils.GetClientValidatedEvent());
+ writer.AddAttribute("language", "javascript");
+ }
+ }
+ AddAttributesToRender(writer);
+ }
+
+ protected virtual void OnClick(ImageClickEventArgs e)
+ {
+ if(Events != null)
+ {
+ ImageClickEventHandler iceh = (ImageClickEventHandler)(Events[ClickEvent]);
+ if(iceh != null)
+ iceh(this, e);
+ }
+ }
+
+ protected virtual void OnCommand(CommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ CommandEventHandler ceh = (CommandEventHandler)(Events[CommandEvent]);
+ if(ceh != null)
+ ceh(this, e);
+ RaiseBubbleEvent(this, e);
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ if(Page != null)
+ {
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ string xCoord = postCollection[UniqueID + ".x"];
+ string yCoord = postCollection[UniqueID + ".y"];
+ if(xCoord != null && yCoord != null && xCoord.Length > 0 && yCoord.Length > 0)
+ {
+ x = Int32.Parse(xCoord);
+ y = Int32.Parse(yCoord);
+ Page.RegisterRequiresRaiseEvent(this);
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+ {
+ if(CausesValidation)
+ Page.Validate();
+ OnClick(new ImageClickEventArgs(x, y));
+ OnCommand(new CommandEventArgs(CommandName, CommandArgument));
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs
new file mode 100644
index 00000000000..752b77f7b4b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Label.cs
@@ -0,0 +1,94 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Label
+ *
+ * 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)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Text")]
+ //[Designer("??")]
+ [ControlBuilder(typeof(LabelControlBuilder))]
+ //[DataBindingHandler("??")]
+ [ParseChildren(false)]
+ [ToolboxData("<{0}:Label runat=\"server\">Label</{0}:Label>")]
+ public class Label : WebControl
+ {
+ public Label(): base()
+ {
+ }
+
+ internal Label(HtmlTextWriterTag tagKey): base(tagKey)
+ {
+ }
+
+ public virtual string Text
+ {
+ get
+ {
+ object o = ViewState["Text"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ if(HasControls())
+ {
+ AddParsedSubObject(obj);
+ return;
+ }
+ if(obj is LiteralControl)
+ {
+ Text = ((LiteralControl)obj).Text;
+ return;
+ }
+ if(Text.Length > 0)
+ {
+ AddParsedSubObject(Text);
+ Text = String.Empty;
+ }
+ AddParsedSubObject(obj);
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if(savedState != null)
+ {
+ base.LoadViewState(savedState);
+ string savedText = (string)ViewState["Text"];
+ if(savedText != null)
+ Text = savedText;
+ }
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ if(HasControls())
+ {
+ RenderContents(writer);
+ } else
+ {
+ writer.Write(Text);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs
new file mode 100644
index 00000000000..5ef512cd092
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LabelControlBuilder.cs
@@ -0,0 +1,27 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LabelControlBuilder
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public class LabelControlBuilder : ControlBuilder
+ {
+ public LabelControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs
new file mode 100644
index 00000000000..44fae99fdaa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButton.cs
@@ -0,0 +1,208 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LinkButton
+ *
+ * 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)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("Click")]
+ [DefaultProperty("Text")]
+ //[Designer("??")]
+ [ControlBuilder(typeof(LinkButtonControlBuilder))]
+ //[DataBindingHandler("??")]
+ [ParseChildren(false)]
+ [ToolboxData("<{0}:LinkButton runat=\"server\">LinkButton</{0}:LinkButton>")]
+ public class LinkButton : WebControl, IPostBackEventHandler
+ {
+ private static readonly object ClickEvent = new object();
+ private static readonly object CommandEvent = new object();
+
+ public LinkButton(): base(HtmlTextWriterTag.A)
+ {
+ }
+
+ public bool CausesValidation
+ {
+ get
+ {
+ object o = ViewState["CausesValidation"];
+ if(o!=null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["CausesValidation"] = value;
+ }
+ }
+
+ public string CommandArgument
+ {
+ get
+ {
+ object o = ViewState["CommandArgument"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandArgument"] = value;
+ }
+ }
+
+ public string CommandName
+ {
+ get
+ {
+ object o = ViewState["CommandName"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["CommandName"] = value;
+ }
+ }
+
+ public virtual string Text
+ {
+ get
+ {
+ object o = ViewState["Text"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+
+ public event EventHandler Click
+ {
+ add
+ {
+ Events.AddHandler(ClickEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ClickEvent, value);
+ }
+ }
+
+ public event CommandEventHandler Command
+ {
+ add
+ {
+ Events.AddHandler(CommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(CommandEvent, value);
+ }
+ }
+
+ protected virtual void OnClick(EventArgs e)
+ {
+ if(Events != null)
+ {
+ EventHandler eh = (EventHandler)(Events[ClickEvent]);
+ if(eh != null)
+ eh(this, e);
+ }
+ }
+
+ protected virtual void OnCommand(CommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ CommandEventHandler ceh = (CommandEventHandler)(Events[CommandEvent]);
+ if(ceh != null)
+ ceh(this, e);
+ }
+ }
+
+ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
+ {
+ if(CausesValidation)
+ {
+ Page.Validate();
+ }
+ OnClick(new EventArgs());
+ OnCommand( new CommandEventArgs(CommandName, CommandArgument));
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(Enabled && Page != null)
+ {
+ if(CausesValidation && Page.Validators.Count > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Href, "javscript:" + Utils.GetClientValidatedPostBack(this));
+ return;
+ }
+ writer.AddAttribute(HtmlTextWriterAttribute.Href, Page.GetPostBackClientHyperlink(this, ""));
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ if(HasControls())
+ {
+ AddParsedSubObject(obj);
+ return;
+ }
+ if(obj is LiteralControl)
+ {
+ Text = ((LiteralControl)obj).Text;
+ return;
+ }
+ if(Text.Length > 0)
+ {
+ AddParsedSubObject(Text);
+ Text = String.Empty;
+ }
+ AddParsedSubObject(obj);
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ if(savedState != null)
+ {
+ base.LoadViewState(savedState);
+ string savedText = (string)ViewState["Text"];
+ if(savedText != null)
+ Text = savedText;
+ }
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ if(HasControls())
+ {
+ RenderContents(writer);
+ return;
+ }
+ writer.Write(Text);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs
new file mode 100644
index 00000000000..cfb8a69b986
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonControlBuilder.cs
@@ -0,0 +1,31 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LinkButtonControlBuilder
+ *
+ * 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)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class LinkButtonControlBuilder : ControlBuilder
+ {
+ public LinkButtonControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs
new file mode 100644
index 00000000000..215d5efd082
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LinkButtonInternal.cs
@@ -0,0 +1,55 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LinkButtonInternal
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ internal class LinkButtonInternal : LinkButton
+ {
+ public LinkButtonInternal() : base()
+ {
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ SetForeColor();
+ Render(writer);
+ }
+
+ private void SetForeColor()
+ {
+ if(!ControlStyle.IsSet(System.Web.UI.WebControls.Style.FORECOLOR))
+ {
+ Control ctrl = this;
+ Color foreCol;
+ int ctr = 0;
+ //FIXME: this-> LinkButton-> WebControl
+ while(ctr < 2)
+ {
+ ctrl = ctrl.Parent;
+ foreCol = ((WebControl)ctrl).ForeColor;
+ if(foreCol != Color.Empty)
+ {
+ ForeColor = foreCol;
+ return;
+ }
+ ctr++;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs
new file mode 100644
index 00000000000..18d9e6f11d9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListBox.cs
@@ -0,0 +1,221 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListBox
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ValidationProperty("SelectedItem")]
+ public class ListBox : ListControl, IPostBackDataHandler
+ {
+ public ListBox(): base()
+ {
+ }
+
+ public override Color BorderColor
+ {
+ get
+ {
+ return BorderColor;
+ }
+ set
+ {
+ BorderColor = value;
+ }
+ }
+
+ public override BorderStyle BorderStyle
+ {
+ get
+ {
+ return BorderStyle;
+ }
+ set
+ {
+ BorderStyle = value;
+ }
+ }
+
+ public override Unit BorderWidth
+ {
+ get
+ {
+ return BorderWidth;
+ }
+ set
+ {
+ BorderWidth = value;
+ }
+ }
+
+ public virtual int Rows
+ {
+ get
+ {
+ object o = ViewState["Rows"];
+ if(o != null)
+ return (int)o;
+ return 4;
+ }
+ set
+ {
+ if(value < 1 || value > 2000)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ ViewState["Rows"] = value;
+ }
+ }
+
+ public virtual ListSelectionMode SelectionMode
+ {
+ get
+ {
+ object o = ViewState["SelectionMode"];
+ if(o != null)
+ return (ListSelectionMode)o;
+ return ListSelectionMode.Single;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(ListSelectionMode), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["SelectionMode"] = value;
+ }
+ }
+
+ public override string ToolTip
+ {
+ get
+ {
+ return String.Empty;
+ }
+ set
+ {
+ // Don't do anything.
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ if(Page != null)
+ {
+ Page.VerifyRenderingInServerForm(this);
+ }
+ writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
+ writer.AddAttribute(HtmlTextWriterAttribute.Size, Rows.ToString(NumberFormatInfo.InvariantInfo));
+ writer.AddAttribute(HtmlTextWriterAttribute.Multiple, "multiple");
+ if(AutoPostBack && Page != null)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Onchange, Page.GetPostBackClientEvent(this, ""));
+ writer.AddAttribute("language", "javascript");
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ base.OnPreRender(e);
+ if(Page != null && SelectionMode == ListSelectionMode.Multiple && Enabled)
+ {
+ Page.RegisterRequiresPostBack(this);
+ }
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ bool isMultAllowed = (SelectionMode == ListSelectionMode.Multiple);
+ bool selMade = false;
+ foreach(ListItem current in Items)
+ {
+ writer.WriteBeginTag("option");
+ if(current.Selected)
+ {
+ if(!isMultAllowed && selMade)
+ {
+ throw new HttpException("Cannnot_MutliSelect_In_Single_Mode");
+ }
+ selMade = true;
+ writer.WriteAttribute("selected", "selected");
+ }
+ writer.WriteAttribute("value", current.Value, true);
+ writer.Write('>');
+ writer.Write(HttpUtility.HtmlEncode(current.Text));
+ writer.WriteEndTag("option");
+ writer.WriteLine();
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ string[] vals = postCollection.GetValues(postDataKey);
+ bool updated = false;
+ ArrayList selected = SelectedIndices;
+ ArrayList final = new ArrayList(vals.Length);
+ if(vals != null)
+ {
+ if(SelectionMode == ListSelectionMode.Single)
+ {
+ int index = Items.FindByValueInternal(vals[0]);
+ if(SelectedIndex != index)
+ {
+ SelectedIndex = index;
+ updated = true;
+ }
+ } else
+ {
+ foreach(string current in vals)
+ {
+ final.Add(Items.FindByValueInternal(current));
+ }
+ if(selected != null && selected.Count == vals.Length)
+ {
+ for(int ctr = 0; ctr < vals.Length; ctr++)
+ {
+ if(((int)final[ctr]) != ((int)selected[ctr]))
+ {
+ updated = true;
+ break;
+ }
+ }
+ } else
+ {
+ updated = true;
+ }
+ }
+ if(!updated)
+ {
+ Select(final);
+ }
+ } else
+ {
+ if(SelectedIndex != -1)
+ SelectedIndex = -1;
+ updated = true;
+ }
+ return updated;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ OnSelectedIndexChanged(EventArgs.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
new file mode 100644
index 00000000000..9b118b114a8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListControl.cs
@@ -0,0 +1,331 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListControl
+ *
+ * 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)
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+using System.Web.Utils;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("SelectedIndexChanged")]
+ [DefaultProperty("DataSource")]
+ //[Designer("??")]
+ //[DataBindingHandler("??")]
+ [ParseChildren(true, "Items")]
+ public class ListControl: WebControl
+ {
+ private static readonly object SelectedIndexChangedEvent = new object();
+
+ private object dataSource;
+ private ListItemCollection items;
+
+ private int cachedSelectedIndex = -1;
+
+ public ListControl(): base(HtmlTextWriterTag.Select)
+ {
+ }
+
+ public event EventHandler SelectedIndexChanged
+ {
+ add
+ {
+ Events.AddHandler(SelectedIndexChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(SelectedIndexChangedEvent, value);
+ }
+ }
+
+ public virtual bool AutoPostBack
+ {
+ get
+ {
+ object o = ViewState["AutoPostBack"];
+ if(o!=null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AutoPostBack"] = value;
+ }
+ }
+
+ public virtual string DataMember
+ {
+ get
+ {
+ object o = ViewState["DataMember"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataMember"] = value;
+ }
+ }
+
+ public virtual object DataSource
+ {
+ get
+ {
+ return dataSource;
+ }
+ set
+ {
+ if(value != null)
+ {
+ if(value is IListSource || value is IEnumerable)
+ {
+ dataSource = value;
+ return;
+ }
+ }
+ throw new ArgumentException(HttpRuntime.FormatResourceString(ID, "Invalid DataSource Type"));
+ }
+ }
+
+ public virtual string DataTextField
+ {
+ get
+ {
+ object o = ViewState["DataTextField"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextField"] = value;
+ }
+ }
+
+ public virtual string DataTextFormatString
+ {
+ get
+ {
+ object o = ViewState["DataTextFormatString"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataTextFormatString"] = value;
+ }
+ }
+
+ public virtual string DataValueField
+ {
+ get
+ {
+ object o = ViewState["DataValueField"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataValueField"] = value;
+ }
+ }
+
+ public virtual ListItemCollection Items
+ {
+ get
+ {
+ if(items==null)
+ {
+ items = new ListItemCollection();
+ if(IsTrackingViewState)
+ {
+ items.TrackViewState();
+ }
+ }
+ return items;
+ }
+ }
+
+ public virtual int SelectedIndex
+ {
+ get
+ {
+ object o = ViewState["SelectedIndex"];
+ if(o!=null)
+ return (int)o;
+ return -1;
+ }
+ set
+ {
+ if(value < -1 || value > Items.Count)
+ throw new ArgumentOutOfRangeException();
+ ViewState["SelectedIndex"] = value;
+ }
+ }
+
+ public virtual ListItem SelectedItem
+ {
+ get
+ {
+ if(SelectedIndex > 0)
+ {
+ return Items[SelectedIndex];
+ }
+ return null;
+ }
+ }
+
+ internal virtual ArrayList SelectedIndices
+ {
+ get
+ {
+ ArrayList si = new ArrayList();
+ for(int i=0; i < Items.Count; i++)
+ {
+ if(Items[i].Selected)
+ si.Add(i);
+ }
+ return si;
+ }
+ }
+
+ internal void Select(ArrayList indices)
+ {
+ ClearSelection();
+ foreach(object intObj in indices)
+ {
+ int index = (int)intObj;
+ if(index >= 0 && index < Items.Count)
+ Items[index].Selected = true;
+ }
+ }
+
+ public virtual void ClearSelection()
+ {
+ for(int i=0; i < Items.Count; i++)
+ {
+ Items[i].Selected = false;
+ }
+ }
+
+ protected override void LoadViewState(object savedState)
+ {
+ //Order: BaseClass, Items (Collection), Indices
+ if(savedState != null && savedState is Triplet)
+ {
+ Triplet state = (Triplet)savedState;
+ base.LoadViewState(state.First);
+ Items.LoadViewState(state.Second);
+ object indices = state.Third;
+ if(indices != null)
+ {
+ Select((ArrayList)indices);
+ }
+ }
+ }
+
+ protected override void OnDataBinding(EventArgs e)
+ {
+ base.OnDataBinding(e);
+ IEnumerable resolvedDataSource = DataSourceHelper.GetResolvedDataSource(DataSource, DataMember);
+ if(resolvedDataSource != null)
+ {
+ string dataTextField = DataTextField;
+ string dataValueField = DataValueField;
+ Items.Clear();
+ ICollection rdsCollection = (ICollection)resolvedDataSource;
+ if(rdsCollection != null)
+ {
+ Items.Capacity = rdsCollection.Count;
+ }
+ bool valid = ( (dataTextField.Length >= 0) && (dataValueField.Length >=0) );
+ foreach(IEnumerable current in resolvedDataSource)
+ {
+ ListItem li = new ListItem();
+ if(valid)
+ {
+ if(dataTextField.Length >= 0)
+ {
+ li.Text = DataBinder.GetPropertyValue(current, dataTextField, null);
+ }
+ if(dataValueField.Length >= 0)
+ {
+ li.Value = DataBinder.GetPropertyValue(current, dataValueField, null);
+ }
+ } else
+ {
+ li.Text = dataTextField.ToString();
+ li.Value = dataValueField.ToString();
+ }
+ Items.Add(li);
+ }
+ }
+ if(cachedSelectedIndex != -1)
+ {
+ SelectedIndex = cachedSelectedIndex;
+ cachedSelectedIndex = -1;
+ }
+ }
+
+ protected virtual void OnSelectedIndexChanged(EventArgs e)
+ {
+ if(Events!=null)
+ {
+ EventHandler eh = (EventHandler)(Events[SelectedIndexChangedEvent]);
+ if(eh!=null)
+ eh(this, e);
+ }
+ }
+
+ protected override object SaveViewState()
+ {
+ //Order: BaseClass, Items (Collection), Indices
+ object vs = base.SaveViewState();
+ object itemSvs = Items.SaveViewState();
+ object indices = null;
+ if(SaveSelectedIndicesViewState)
+ indices = SelectedIndices;
+ if(vs!= null && itemSvs != null && indices != null)
+ {
+ return new Triplet(vs, itemSvs, indices);
+ }
+ return null;
+ }
+
+ protected override void TrackViewState()
+ {
+ base.TrackViewState();
+ Items.TrackViewState();
+ }
+
+ private bool SaveSelectedIndicesViewState
+ {
+ get
+ {
+ if( Events[SelectedIndexChangedEvent] != null && Enabled && Visible)
+ {
+ Type t = GetType();
+ // If I am a derivative, let it take of storing the selected indices.
+ if(t == typeof(DropDownList) || t == typeof(ListBox) || t == typeof(CheckBoxList) || t == typeof(RadioButtonList))
+ return false;
+ }
+ return true;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs
new file mode 100644
index 00000000000..e58a1917835
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItem.cs
@@ -0,0 +1,252 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListItem
+ *
+ * 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)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ [ControlBuilder(typeof(ListItemControlBuilder))]
+ public sealed class ListItem : IStateManager, IParserAccessor, IAttributeAccessor
+ {
+ private static int MARKED = (0x01 << 0);
+ private static int SELECTED = (0x01 << 1);
+ private static int DIRTY_T = (0x01 << 2);
+ private static int DIRTY_V = (0x01 << 3);
+
+ private static int selBits;
+
+ private AttributeCollection attributes;
+ private string text;
+ private string val;
+
+ public ListItem(string text, string value)
+ {
+ this.text = text;
+ this.val = value;
+ selBits = 0x00;
+ attributes = null;
+ }
+
+ public ListItem(string text): this(text, null)
+ {
+ }
+
+ public ListItem(): this(null, null)
+ {
+ }
+
+ public static ListItem FromString(string text)
+ {
+ return new ListItem(text);
+ }
+
+ public AttributeCollection Attributes
+ {
+ get
+ {
+ if(attributes == null)
+ attributes = new AttributeCollection(new StateBag(true));
+ return attributes;
+ }
+ }
+
+ public bool Selected
+ {
+ get
+ {
+ return IsSet(SELECTED);
+ }
+ set
+ {
+ Set(SELECTED);
+ }
+ }
+
+ internal bool Dirty
+ {
+ get
+ {
+ return (IsSet(DIRTY_T) && IsSet(DIRTY_V));
+ }
+ set
+ {
+ Set(DIRTY_T);
+ Set(DIRTY_V);
+ }
+ }
+
+ private bool IsSet(int bit)
+ {
+ return ( (selBits & bit) != 0x00 );
+ }
+
+ private void Set(int bit)
+ {
+ selBits |= bit;
+ }
+
+ public string Text
+ {
+ get
+ {
+ if(text!=null)
+ {
+ return text;
+ }
+ if(val!=null)
+ {
+ return val;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ text = value;
+ if(IsTrackingViewState)
+ {
+ Set(DIRTY_T);
+ }
+ }
+ }
+
+ public string Value
+ {
+ get
+ {
+ if(val!=null)
+ {
+ return val;
+ }
+ if(text!=null)
+ {
+ return text;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ val = value;
+ if(IsTrackingViewState)
+ {
+ Set(DIRTY_V);
+ }
+ }
+ }
+
+ string IAttributeAccessor.GetAttribute(string key)
+ {
+ return attributes[key];
+ }
+
+ void IAttributeAccessor.SetAttribute(string key, string value)
+ {
+ attributes[key] = value;
+ }
+
+ /// <remarks>
+ /// The data is parsed - object must be of type LiteralControl or DataBoundLiteralControl.
+ /// In latter case, throw an exception telling that the data cannot be bind-ed.
+ /// </remarks>
+ void IParserAccessor.AddParsedSubObject(object obj)
+ {
+ if(obj is LiteralControl)
+ {
+ Text = ((LiteralControl)obj).Text;
+ return;
+ }
+ if(obj is DataBoundLiteralControl)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Control_Cannot_DataBind","ListItem"));
+ }
+ throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type", "ListItem", obj.GetType().ToString()));
+ }
+
+ bool IsTrackingViewState
+ {
+ get
+ {
+ return IsSet(MARKED);
+ }
+ }
+
+ internal void TrackViewState()
+ {
+ Set(MARKED);
+ }
+
+ internal void LoadViewState(object state)
+ {
+ if(state is Pair)
+ {
+ Pair tv = (Pair)state;
+ if(tv.First!=null)
+ {
+ Text = (string)tv.First;
+ }
+ if(tv.Second!=null)
+ {
+ Value = (string)tv.Second;
+ }
+ }
+ if(state is string)
+ {
+ Text = (string)state;
+ }
+ }
+
+ internal object SaveViewState()
+ {
+ if(IsSet(DIRTY_T) && IsSet(DIRTY_V))
+ {
+ return new Pair(Text, Value);
+ }
+ if(IsSet(DIRTY_T))
+ {
+ return Text;
+ }
+ if(IsSet(DIRTY_V))
+ {
+ return new Pair(null, Value);
+ }
+ return null;
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return IsTrackingViewState;
+ }
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.LoadViewState(object state)
+ {
+ LoadViewState(state);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs
new file mode 100644
index 00000000000..7327eabba30
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemCollection.cs
@@ -0,0 +1,366 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListItemCollection
+ *
+ * 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)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace System.Web.UI.WebControls
+{
+ //[DefaultMember("Item")] I need the this[...] thing...
+ //[Editor("??", typeof(Design.WebControls.ListItemCollectionEditor))]
+ public class ListItemCollection : IList, ICollection, IEnumerable, IStateManager
+ {
+ private ArrayList items;
+ private bool saveAll;
+ private bool marked;
+
+ public ListItemCollection()
+ {
+ items = new ArrayList();
+ saveAll = false;
+ marked = false;
+ }
+
+ public int Capacity
+ {
+ get
+ {
+ return items.Capacity;
+ }
+ set
+ {
+ items.Capacity = value;
+ }
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return items.IsReadOnly;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return items.IsSynchronized;
+ }
+ }
+
+ public ListItem this[int index]
+ {
+ get
+ {
+ if(index < 0 || index >= Count)
+ return null;
+ return (ListItem)(items[index]);
+ }
+ set
+ {
+ if(index >= 0 && index < Count)
+ items[index] = value;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void Add(ListItem item)
+ {
+ items.Add(item);
+ if(marked)
+ item.Dirty = true;
+ }
+
+ public void Add(string item)
+ {
+ Add(new ListItem(item));
+ }
+
+ public void AddRange(ListItem[] items)
+ {
+ foreach(ListItem item in items)
+ {
+ if(item!=null)
+ Add(item);
+ }
+ }
+
+ public void Clear()
+ {
+ items.Clear();
+ if(marked)
+ saveAll = true;
+ }
+
+ public bool Contains(ListItem item)
+ {
+ return items.Contains(item);
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ items.CopyTo(array, index);
+ }
+
+ public ListItem FindByText(string text)
+ {
+ int i=-1;
+ foreach(object current in items)
+ {
+ i++;
+ if(((ListItem)current).Text == text)
+ break;
+ }
+ return (i==-1 ? null : (ListItem)items[i]);
+ }
+
+ public ListItem FindByValue(string value)
+ {
+ foreach(ListItem current in items)
+ {
+ if(current.Value == value)
+ {
+ return current;
+ }
+ }
+ return null;
+ }
+
+ internal int FindByValueInternal(string value)
+ {
+ int i = -1;
+ foreach(ListItem current in items)
+ {
+ i++;
+ if(current.Value == value)
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+
+ public int IndexOf(ListItem item)
+ {
+ return items.IndexOf(item);
+ }
+
+ public void Insert(int index, ListItem item)
+ {
+ items.Insert(index, item);
+ if(marked)
+ saveAll = true;
+ }
+
+ public void Insert(int index, string item)
+ {
+ Insert(index, new ListItem(item));
+ }
+
+ public void RemoveAt(int index)
+ {
+ if(index < 0 || index >= items.Count)
+ return;
+ items.RemoveAt(index);
+ if(marked)
+ saveAll = true;
+ }
+
+ public void Remove(ListItem item)
+ {
+ RemoveAt(IndexOf(item));
+ }
+
+ public void Remove(string item)
+ {
+ RemoveAt(IndexOf(ListItem.FromString(item)));
+ }
+
+ internal object SaveViewState()
+ {
+ if(saveAll)
+ {
+ string[] keys = new string[Count];
+ string[] vals = new string[Count];
+ for(int i=0; i < Count; i++)
+ {
+ keys[i] = this[i].Text;
+ vals[i] = this[i].Value;
+ }
+ return new Triplet(Count, keys, vals);
+ }
+ ArrayList indices = new ArrayList();
+ ArrayList states = new ArrayList();
+ object o;
+ for(int i=0; i < Count; i++)
+ {
+ o = this[i].SaveViewState();
+ if(o!=null)
+ {
+ indices.Add(i);
+ states.Add(o);
+ }
+ }
+ if(indices.Count > 0)
+ return new Pair(indices, states);
+ return null;
+ }
+
+ internal void LoadViewState(object savedState)
+ {
+ if(savedState!=null)
+ {
+ if(savedState is Pair)
+ {
+ ArrayList indices = (ArrayList)(((Pair)savedState).First);
+ ArrayList states = (ArrayList)(((Pair)savedState).Second);
+ for(int i=0; i < indices.Count; i++)
+ {
+ if( (int)indices[i] < Count )
+ this[i].LoadViewState(states[i]);
+ else
+ {
+ ListItem temp = new ListItem();
+ temp.LoadViewState(states[i]);
+ Add(temp);
+ }
+ }
+ }
+ if(savedState is Triplet)
+ {
+ Triplet t = (Triplet)savedState;
+ items = new ArrayList((int)t.First);
+ saveAll = true;
+ string[] text = (string[])t.Second;
+ string[] vals = (string[])t.Third;
+ for(int i=0; i < text.Length; i++)
+ items.Add(new ListItem(text[i], vals[i]));
+ }
+ }
+ }
+
+ internal void TrackViewState()
+ {
+ marked = true;
+ foreach(ListItem current in this)
+ current.TrackViewState();
+ }
+
+ bool IList.IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return this[index];
+ }
+ set
+ {
+ if(value is ListItem)
+ {
+ this[index] = (ListItem)value;
+ }
+ }
+ }
+
+ int IList.Add(object item)
+ {
+ int index = (item is ListItem ? items.Add((ListItem)item) : -1);
+ if(index!=-1 && marked)
+ ((ListItem)item).Dirty = true;
+ return index;
+ }
+
+ bool IList.Contains(object item)
+ {
+ if(item is ListItem)
+ return Contains((ListItem)item);
+ return false;
+ }
+
+ int IList.IndexOf(object item)
+ {
+ if(item is ListItem)
+ return IndexOf((ListItem)item);
+ return -1;
+ }
+
+ void IList.Insert(int index, object item)
+ {
+ if(item is ListItem)
+ Insert(index, (ListItem)item);
+ }
+
+ void IList.Remove(object item)
+ {
+ if(item is string)
+ Remove((string)item);
+ if(item is ListItem)
+ Remove((ListItem)item);
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return marked;
+ }
+ }
+
+ void IStateManager.LoadViewState(object state)
+ {
+ LoadViewState(state);
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs
new file mode 100644
index 00000000000..16c60a196a7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemControlBuilder.cs
@@ -0,0 +1,36 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ListItemControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ListItemControlBuilder : ControlBuilder
+ {
+ public ListItemControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+
+ public override bool HtmlDecodeLiterals()
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs
new file mode 100755
index 00000000000..3d45e73693a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListItemType.cs
@@ -0,0 +1,27 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ListItemType
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ListItemType
+ {
+ Header,
+ Footer,
+ Item,
+ AlternatingItem,
+ SelectedItem,
+ EditItem,
+ Separator,
+ Pager
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs
new file mode 100755
index 00000000000..f7c7967356c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ListSelectionMode.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ListSelectionMode
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ListSelectionMode
+ {
+ Single,
+ Multiple
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs
new file mode 100644
index 00000000000..9ffe57c4ba9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Literal.cs
@@ -0,0 +1,68 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Literal
+ *
+ * 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)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Text")]
+ [ControlBuilder(typeof(LiteralControlBuilder))]
+ //[DataBindingHandler("??")]
+ public class Literal : Control
+ {
+ public Literal(): base()
+ {
+ }
+
+ public string Text
+ {
+ get
+ {
+ object o = ViewState["Text"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+
+ protected override ControlCollection CreateControlCollection()
+ {
+ return new EmptyControlCollection(this);
+ }
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ if(obj is LiteralControl)
+ {
+ Text = ((LiteralControl)obj).Text;
+ return;
+ }
+ throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type", "Literal", obj.GetType().Name.ToString()));
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ if(Text.Length > 0)
+ {
+ writer.Write(Text);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs
new file mode 100644
index 00000000000..75dcb77192a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/LiteralControlBuilder.cs
@@ -0,0 +1,36 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: LiteralControlBuilder
+ *
+ * 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)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class LiteralControlBuilder : ControlBuilder
+ {
+ public LiteralControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+
+ public override void AppendSubBuilder(ControlBuilder subBuilder)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Control_does_not_allow_children",(typeof(Literal)).ToString()));
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs
new file mode 100644
index 00000000000..8de0d910c4b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventArgs.cs
@@ -0,0 +1,47 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: MonthChangedEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class MonthChangedEventArgs
+ {
+ private DateTime nDate;
+ private DateTime pDate;
+
+ public MonthChangedEventArgs(DateTime newDate, DateTime previousDate)
+ {
+ nDate = newDate;
+ pDate = previousDate;
+ }
+
+ public DateTime NewDate
+ {
+ get
+ {
+ return nDate;
+ }
+ }
+
+ public DateTime PreviousDate
+ {
+ get
+ {
+ return pDate;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs
new file mode 100644
index 00000000000..99a7a27157e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/MonthChangedEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void MonthChangedEventHandler(object sender, MonthChangedEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs b/mcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs
new file mode 100755
index 00000000000..91d6cf3003b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/NextPrevFormat.cs
@@ -0,0 +1,22 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: NextPrevFormat
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum NextPrevFormat
+ {
+ CustomText,
+ ShortMonth,
+ FullMonth
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs
new file mode 100644
index 00000000000..41546a4c814
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PagedDataSource.cs
@@ -0,0 +1,470 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: PagedDataSource
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class PagedDataSource : ICollection, IEnumerable, ITypedList
+ {
+ private int pageSize;
+ private bool allowPaging;
+ private int currentPageIndex;
+ private bool allowCustomPaging;
+ private int virtualCount;
+
+ private IEnumerable dataSource;
+
+ public PagedDataSource()
+ {
+ Initialize();
+ }
+
+ private void Initialize()
+ {
+ pageSize = 10;
+ allowPaging = false;
+ currentPageIndex = 0;
+ allowCustomPaging = false;
+ virtualCount = 0;
+ }
+
+ public bool AllowCustomPaging
+ {
+ get
+ {
+ return allowCustomPaging;
+ }
+ set
+ {
+ allowCustomPaging = value;
+ }
+ }
+
+ public bool AllowPaging
+ {
+ get
+ {
+ return allowPaging;
+ }
+ set
+ {
+ allowPaging = value;
+ }
+ }
+
+ public int Count
+ {
+ get
+ {
+ if(dataSource != null)
+ {
+ if(IsPagingEnabled)
+ {
+ return DataSourceCount;
+ }
+ if(IsCustomPagingEnabled)
+ {
+ return pageSize;
+ }
+ if(IsLastPage)
+ {
+ return (DataSourceCount - FirstIndexInPage);
+ }
+ return pageSize;
+ }
+ return 0;
+ }
+ }
+
+ public int CurrentPageIndex
+ {
+ get
+ {
+ return currentPageIndex;
+ }
+ }
+
+ public IEnumerable DataSource
+ {
+ get
+ {
+ return dataSource;
+ }
+ set
+ {
+ dataSource = value;
+ }
+ }
+
+ public int DataSourceCount
+ {
+ get
+ {
+ if(dataSource != null)
+ {
+ if(IsCustomPagingEnabled)
+ {
+ return virtualCount;
+ }
+ if(dataSource is ICollection)
+ {
+ return ((ICollection)dataSource).Count;
+ }
+ throw new HttpException(HttpRuntime.FormatResourceString("PagedDataSource_Cannot_Get_Count"));
+ }
+ return 0;
+ }
+ }
+
+ public int FirstIndexInPage
+ {
+ get
+ {
+ if(dataSource != null && IsPagingEnabled && IsCustomPagingEnabled)
+ {
+ return (currentPageIndex * pageSize);
+ }
+ return 0;
+ }
+ }
+
+ public bool IsCustomPagingEnabled
+ {
+ get
+ {
+ return (IsPagingEnabled && allowCustomPaging);
+ }
+ }
+
+ public bool IsFirstPage
+ {
+ get
+ {
+ return (!IsPagingEnabled || (CurrentPageIndex == 0));
+ }
+ }
+
+ public bool IsLastPage
+ {
+ get
+ {
+ return (!IsPagingEnabled || (CurrentPageIndex == PageCount));
+ }
+ }
+
+ public bool IsPagingEnabled
+ {
+ get
+ {
+ return (allowPaging && pageSize != 0);
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public int PageCount
+ {
+ get
+ {
+ if(dataSource != null)
+ {
+ int total = DataSourceCount;
+ if(!IsPagingEnabled)
+ {
+ return total;
+ }
+ return (total + pageSize - 1)/pageSize;
+ }
+ return 0;
+ }
+ }
+
+ public int PageSize
+ {
+ get
+ {
+ return pageSize;
+ }
+ set
+ {
+ pageSize = value;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public int VirtualCount
+ {
+ get
+ {
+ return virtualCount;
+ }
+ set
+ {
+ virtualCount = value;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(object current in this)
+ {
+ array.SetValue(array, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ int fInd = FirstIndexInPage;
+ int count = -1;
+ if(dataSource is ICollection)
+ {
+ count = Count;
+ }
+
+ if(dataSource is IList)
+ {
+ return (new PrivateListEnumerator((IList)dataSource, fInd, count));
+ }
+ if(dataSource is Array)
+ {
+ return (new PrivateArrayEnumerator((object[])dataSource, fInd, count));
+ }
+ if(dataSource is ICollection)
+ {
+ return (new PrivateICollectionEnumerator((ICollection)dataSource, fInd, count));
+ }
+ if(allowCustomPaging)
+ {
+ return (new PrivateIEnumeratorEnumerator(dataSource.GetEnumerator(), Count));
+ }
+ return dataSource.GetEnumerator();
+ }
+
+ class PrivateIEnumeratorEnumerator : IEnumerator
+ {
+ private int index;
+ private int max;
+
+ private IEnumerator enumerator;
+
+ public PrivateIEnumeratorEnumerator(IEnumerator enumerator, int count)
+ {
+ this.enumerator = enumerator;
+ index = -1;
+ max = count;
+ }
+
+ public bool MoveNext()
+ {
+ enumerator.MoveNext();
+ index++;
+ return (index < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ enumerator.Reset();
+ }
+
+ public object Current
+ {
+ get
+ {
+ return enumerator.Current;
+ }
+ }
+ }
+
+ class PrivateICollectionEnumerator : IEnumerator
+ {
+ private int index;
+ private int start;
+ private int max;
+
+ private ICollection collection;
+ private IEnumerator collEnum;
+
+ public PrivateICollectionEnumerator(ICollection collection, int start, int count)
+ {
+ this.collection = collection;
+ this.start = start;
+ index = -1;
+ max = start + count;
+ if(max > collection.Count)
+ {
+ max = collection.Count;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ if(collEnum == null)
+ {
+ int cIndex = 0;
+ collEnum = collection.GetEnumerator();
+ while(cIndex < start)
+ {
+ collEnum.MoveNext();
+ }
+ }
+ collEnum.MoveNext();
+ index++;
+ return (start + index < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ collEnum = null;
+ }
+
+ public object Current
+ {
+ get
+ {
+ return collEnum.Current;
+ }
+ }
+ }
+
+ class PrivateArrayEnumerator : IEnumerator
+ {
+ private int index;
+ private int start;
+ private int max;
+ private object[] values;
+
+ public PrivateArrayEnumerator(object[] values, int start, int count)
+ {
+ this.values = values;
+ this.start = start;
+ index = -1;
+ max = start + count;
+ if(max > this.values.Length)
+ {
+ max = this.values.Length;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ index++;
+ return (index + start < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ }
+
+ public object Current
+ {
+ get
+ {
+ if(index >= 0)
+ {
+ return values[index + start];
+ }
+ throw new InvalidOperationException("Enumerator_MoveNext_Not_Called");
+ }
+ }
+ }
+
+ class PrivateListEnumerator : IEnumerator
+ {
+ private int index;
+ private int start;
+ private int max;
+ private IList collection;
+
+ public PrivateListEnumerator(IList list, int start, int count)
+ {
+ collection = list;
+ this.start = start;
+ index = -1;
+ max = start + count;
+ if(max > list.Count)
+ {
+ max = list.Count;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ index++;
+ return (index + start < max);
+ }
+
+ public void Reset()
+ {
+ index = -1;
+ }
+
+ public object Current
+ {
+ get
+ {
+ if(index >= 0)
+ {
+ return collection[index + start];
+ }
+ throw new InvalidOperationException("Enumerator_MoveNext_Not_Called");
+ }
+ }
+ }
+
+ public string GetListName(PropertyDescriptor[] listAccessors)
+ {
+ return String.Empty;
+ }
+
+ public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors)
+ {
+ if(dataSource != null)
+ {
+ if(dataSource is ITypedList)
+ {
+ return ((ITypedList)dataSource).GetItemProperties(listAccessors);
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs
new file mode 100755
index 00000000000..5f99cee5773
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PagerMode.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: PagerMode
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum PagerMode
+ {
+ NextPrev,
+ NumericPages
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs
new file mode 100755
index 00000000000..2ad9b466413
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PagerPosition.cs
@@ -0,0 +1,22 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: PagerPosition
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum PagerPosition
+ {
+ Bottom,
+ Top,
+ TopAndBottom
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs
new file mode 100644
index 00000000000..b48316cab75
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Panel.cs
@@ -0,0 +1,97 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Panel
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ //[Designer("??")]
+ [ParseChildren(false)]
+ [PersistChildren(true)]
+ [ToolboxData("<{0}:Panel runat=\"server\">Panel</{0}:Panel>")]
+ public class Panel: WebControl
+ {
+ public Panel(): base(HtmlTextWriterTag.Div)
+ {
+ }
+
+ public virtual string BackImageUrl
+ {
+ get
+ {
+ object o = ViewState["BackImageUrl"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["BackImageUrl"] = value;
+ }
+ }
+
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ object o = ViewState["HorizontalAlign"];
+ if(o != null)
+ return (HorizontalAlign)o;
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(HorizontalAlign), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["HorizontalAlign"] = value;
+ }
+ }
+
+ public virtual bool Wrap
+ {
+ get
+ {
+ object o = ViewState["Wrap"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["Wrap"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ AddAttributesToRender(writer);
+ if(BackImageUrl.Length > 0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, "url(" + ResolveUrl(BackImageUrl) + ")");
+ }
+ if(HorizontalAlign != HorizontalAlign.NotSet)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, TypeDescriptor.GetConverter(typeof(HorizontalAlign)).ConvertToString(HorizontalAlign));
+ }
+ if(Wrap)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs
new file mode 100644
index 00000000000..fd00a47da9d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolder.cs
@@ -0,0 +1,27 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: PlaceHolder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ControlBuilder(typeof(PlaceHolderControlBuilder))]
+ public class PlaceHolder : Control
+ {
+ public PlaceHolder(): base()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs
new file mode 100644
index 00000000000..3bbd68c6d22
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/PlaceHolderControlBuilder.cs
@@ -0,0 +1,31 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: PlaceHolderControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class PlaceHolderControlBuilder : ControlBuilder
+ {
+ public PlaceHolderControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs
new file mode 100644
index 00000000000..e8d0b85b9f4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs
@@ -0,0 +1,142 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RadioButton
+ *
+ * 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)
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ //[Designer("??")]
+ public class RadioButton: CheckBox, IPostBackDataHandler
+ {
+ public RadioButton(): base()
+ {
+ }
+
+ public virtual string GroupName
+ {
+ get
+ {
+ object o = ViewState["GroupName"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["GroupName"] = value;
+ }
+ }
+
+ protected override void OnPreRender(EventArgs e)
+ {
+ base.OnPreRender(e);
+ if(Page != null && Enabled && !Checked)
+ {
+ Page.RegisterRequiresPostBack(this);
+ }
+ if(GroupName.Length == 0)
+ {
+ GroupName = UniqueID;
+ }
+ }
+
+ internal override void RenderInputTag(HtmlTextWriter writer, string id)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Id, id);
+ writer.AddAttribute(HtmlTextWriterAttribute.Type, "radio");
+ writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueGroupNamePrivate);
+ writer.AddAttribute(HtmlTextWriterAttribute.Value, ValueAttributePrivate);
+
+ if(Checked)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Checked, "checked");
+ }
+ if(AutoPostBack)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Onclick, Page.GetPostBackClientEvent(this, ""));
+ writer.AddAttribute("language", "javascript");
+ }
+
+ if(AccessKey.Length > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey);
+ }
+
+ if(TabIndex > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString(NumberFormatInfo.InvariantInfo));
+ }
+
+ writer.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Input);
+ writer.RenderEndTag();
+ }
+
+ private string UniqueGroupNamePrivate
+ {
+ get
+ {
+ string retVal = GroupName;
+ if(UniqueID.LastIndexOf(":") >= 0)
+ {
+ retVal += UniqueID.Substring(UniqueID.LastIndexOf(":") + 1);
+ }
+ return retVal;
+ }
+ }
+
+ private string ValueAttributePrivate
+ {
+ get
+ {
+ string retVal = Attributes["value"];
+ if(retVal == null)
+ {
+ retVal = ID;
+ }
+ if(retVal == null)
+ {
+ retVal = UniqueID;
+ }
+ return retVal;
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ if(postCollection[UniqueGroupNamePrivate] != null && postCollection[UniqueGroupNamePrivate] == ValueAttributePrivate)
+ {
+ if(!Checked)
+ {
+ Checked = true;
+ }
+ return true;
+ }
+ if(Checked)
+ {
+ Checked = false;
+ }
+ return true;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ OnCheckedChanged(EventArgs.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs
new file mode 100644
index 00000000000..309fc47af6e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs
@@ -0,0 +1,227 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RadioButtonList
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections.Specialized;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ValidationProperty("SelectedItem")]
+ public class RadioButtonList : ListControl, IRepeatInfoUser, INamingContainer, IPostBackDataHandler
+ {
+ private bool selectionIndexChanged;
+ private short tabIndex;
+
+ public RadioButtonList(): base()
+ {
+ selectionIndexChanged = false;
+ }
+
+ public virtual int CellPadding
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ {
+ return (int)(((TableStyle)ControlStyle).CellPadding);
+ }
+ return -1;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellPadding = value;
+ }
+ }
+
+ public virtual int CellSpacing
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ {
+ return (int)(((TableStyle)ControlStyle).CellSpacing);
+ }
+ return -1;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellSpacing = value;
+ }
+ }
+
+ public virtual int RepeatColumns
+ {
+ get
+ {
+ object o = ViewState["RepeatColumns"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ if(value < 0)
+ throw new ArgumentOutOfRangeException("value");
+ ViewState["RepeatColumns"] = value;
+ }
+ }
+
+ public virtual RepeatDirection RepeatDirection
+ {
+ get
+ {
+ object o = ViewState["RepeatDirection"];
+ if(o != null)
+ return (RepeatDirection)o;
+ return RepeatDirection.Vertical;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatDirection), value))
+ throw new ArgumentException();
+ ViewState["RepeatDirection"] = value;
+ }
+ }
+
+ public virtual RepeatLayout RepeatLayout
+ {
+ get
+ {
+ object o = ViewState["RepeatLayout"];
+ if(o != null)
+ return (RepeatLayout)o;
+ return RepeatLayout.Table;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatLayout), value))
+ throw new ArgumentException();
+ ViewState["RepeatLayout"] = value;
+ }
+ }
+
+ public virtual TextAlign TextAlign
+ {
+ get
+ {
+ object o = ViewState["TextAlign"];
+ if(o != null)
+ return (TextAlign)o;
+ return TextAlign.Right;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(TextAlign), value))
+ throw new ArgumentException();
+ ViewState["TextAlign"] = value;
+ }
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableStyle(ViewState);
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ RepeatInfo info = new RepeatInfo();
+ Style cStyle = (ControlStyleCreated ? ControlStyle : null);
+ bool dirty = false;
+ tabIndex = TabIndex;
+ if(tabIndex != 0)
+ {
+ dirty = !ViewState.IsItemDirty("TabIndex");
+ TabIndex = 0;
+ }
+ info.RepeatColumns = RepeatColumns;
+ info.RepeatDirection = RepeatDirection;
+ info.RenderRepeater(writer, this, cStyle, this);
+ if(tabIndex != 0)
+ {
+ TabIndex = tabIndex;
+ }
+ if(dirty)
+ {
+ ViewState.SetItemDirty("TabIndex", false);
+ }
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ string value = postCollection[postDataKey];
+ for(int i=0; i < Items.Count; i++)
+ {
+ if(Items[i].Value == value)
+ {
+ if(i != SelectedIndex)
+ {
+ SelectedIndex = i;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ if(selectionIndexChanged)
+ OnSelectedIndexChanged(EventArgs.Empty);
+ }
+
+ Style IRepeatInfoUser.GetItemStyle(System.Web.UI.WebControls.ListItemType itemType, int repeatIndex)
+ {
+ return null;
+ }
+
+ [MonoTODO("RadioButtonList_RenderItem")]
+ void IRepeatInfoUser.RenderItem(System.Web.UI.WebControls.ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+ {
+ throw new NotImplementedException();
+ }
+
+ bool IRepeatInfoUser.HasFooter
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ bool IRepeatInfoUser.HasHeader
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ bool IRepeatInfoUser.HasSeparators
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ int IRepeatInfoUser.RepeatedItemCount
+ {
+ get
+ {
+ return Items.Count;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs
new file mode 100644
index 00000000000..43a496023b5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RangeValidator.cs
@@ -0,0 +1,125 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RangeValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Xml;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:RangeValidator runat=\"server\" "
+ + "ErrorMessage=\"RangeValidator\"></{0}:RangeValidator>")]
+ public class RangeValidator : BaseCompareValidator
+ {
+ public RangeValidator(): base()
+ {
+ }
+
+ public string MaximumValue
+ {
+ get
+ {
+ object o = ViewState["MaximumValue"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["MaximumValue"] = value;
+ }
+ }
+
+ public string MinimumValue
+ {
+ get
+ {
+ object o = ViewState["MinimumValue"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["MinimumValue"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(base.RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "RangeValidatorEvaluateIsValid");
+ writer.AddAttribute("maximumvalue", MaximumValue);
+ writer.AddAttribute("minimumvalue", MinimumValue);
+ }
+ }
+
+ protected override bool ControlPropertiesValid()
+ {
+ string max = MaximumValue;
+ if(!CanConvert(max, Type))
+ {
+ string[] fmt = new string[4];
+ fmt[0] = max;
+ fmt[1] = "MaximumValue";
+ fmt[2] = ID;
+ fmt[3] = PropertyConverter.EnumToString(typeof(ValidationDataType), Type);
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_value_bad_type", fmt));
+ }
+ string min = MaximumValue;
+ if(!CanConvert(min, Type))
+ {
+ string[] fmt = new string[4];
+ fmt[0] = min;
+ fmt[1] = "MinimumValue";
+ fmt[2] = ID;
+ fmt[3] = PropertyConverter.EnumToString(typeof(ValidationDataType), Type);
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_value_bad_type", fmt));
+ }
+
+ if(Compare(max, min, ValidationCompareOperator.GreaterThan, ValidationDataType.Double))
+ {
+ string[] fmt = new string[3];
+ fmt[0] = min;
+ fmt[1] = max;
+ fmt[2] = PropertyConverter.EnumToString(typeof(ValidationDataType), Type);
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_range_overalap", fmt));
+ }
+ return base.ControlPropertiesValid();
+ }
+
+ protected override bool EvaluateIsValid()
+ {
+ string ctrl = GetControlValidationValue(ControlToValidate);
+ if(ctrl == null || ctrl.Trim().Length == 0)
+ {
+ return true;
+ }
+ bool retVal = Compare(ctrl, MinimumValue, ValidationCompareOperator.GreaterThanEqual,
+ ValidationDataType.String);
+ if(!retVal)
+ {
+ retVal = Compare(ctrl, MaximumValue, ValidationCompareOperator.LessThanEqual,
+ ValidationDataType.String);
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs
new file mode 100644
index 00000000000..961e45def85
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RegularExpressionValidator.cs
@@ -0,0 +1,93 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RegularExpressionValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.Text.RegularExpressions;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:RegularExpressionValidator runat=\"server\" "
+ + "ErrorMessage=\"RegularExpressionValidator\">"
+ + "</{0}:RegularExpressionValidator>")]
+ public class RegularExpressionValidator : BaseValidator
+ {
+ public RegularExpressionValidator(): base()
+ {
+ }
+
+ public string ValidationExpression
+ {
+ get
+ {
+ object o = ViewState["ValidationExpression"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ try
+ {
+ Regex.IsMatch("", value);
+ } catch(Exception)
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Validator_bad_regex", value));
+ }
+ ViewState["ValidationExpression"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(base.RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "RegularExpressionValidatorEvaluateIsValid");
+ string exp = ValidationExpression;
+ if(exp.Length > 0)
+ {
+ writer.AddAttribute("validationexpression", exp);
+ }
+ }
+ }
+
+ protected override bool EvaluateIsValid()
+ {
+ string ctrl = GetControlValidationValue(ControlToValidate);
+ bool retVal = true;
+ if(ctrl == null || ctrl.Trim().Length == 0)
+ {
+ return true;
+ }
+ try
+ {
+ Match match = Regex.Match(ctrl, ValidationExpression);
+ if(match.Success && match.Index > 0 && match.Length == ctrl.Length)
+ {
+ retVal = true;
+ } else
+ {
+ retVal = false;
+ }
+ } catch(Exception)
+ {
+ retVal = true;
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs
new file mode 100755
index 00000000000..fc26596dafc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatDirection.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: RepeatDirection
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum RepeatDirection
+ {
+ Horizontal,
+ Vertical
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs
new file mode 100644
index 00000000000..c53e1eaf5b4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs
@@ -0,0 +1,267 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RepeatInfo
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 90%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class RepeatInfo
+ {
+ private bool outerTableImp;
+ private int repeatColumns;
+ private RepeatDirection repeatDirection;
+ private RepeatLayout repeatLayout;
+
+ public RepeatInfo()
+ {
+ outerTableImp = false;
+ repeatColumns = 0;
+ repeatDirection = RepeatDirection.Vertical;
+ repeatLayout = RepeatLayout.Table;
+ }
+
+ public bool OuterTableImplied
+ {
+ get
+ {
+ return outerTableImp;
+ }
+ set
+ {
+ outerTableImp = value;
+ }
+ }
+
+ public int RepeatColumns
+ {
+ get
+ {
+ return repeatColumns;
+ }
+ set
+ {
+ repeatColumns = value;
+ }
+ }
+
+ public RepeatDirection RepeatDirection
+ {
+ get
+ {
+ return repeatDirection;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatDirection), value))
+ throw new ArgumentException();
+ repeatDirection = value;
+ }
+ }
+
+ public RepeatLayout RepeatLayout
+ {
+ get
+ {
+ return repeatLayout;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(RepeatLayout), value))
+ throw new ArgumentException();
+ repeatLayout = value;
+ }
+ }
+
+ public void RenderRepeater(HtmlTextWriter writer, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
+ {
+ if(RepeatDirection == RepeatDirection.Vertical)
+ {
+ DoVerticalRendering(writer, user, controlStyle, baseControl);
+ } else
+ {
+ DoHorizontalRendering(writer, user, controlStyle, baseControl);
+ }
+ }
+
+ private void DoVerticalRendering(HtmlTextWriter writer, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
+ {
+ int total = user.RepeatedItemCount;
+ int colsCount;
+ int rowsCount;
+ if(repeatColumns == 0 || repeatColumns==1)
+ {
+ colsCount = 1;
+ rowsCount = total;
+ } else
+ {
+ colsCount = repeatColumns;
+ rowsCount = (total + repeatColumns - 1) / repeatColumns;
+ if(rowsCount ==0 && total != 0)
+ {
+ rowsCount = 1;
+ colsCount = total;
+ }
+ }
+ WebControl ctrl = null;
+ bool isTable = true;
+ bool hasSeps = user.HasSeparators;
+ if(!outerTableImp)
+ {
+ if(RepeatLayout == RepeatLayout.Table)
+ {
+ ctrl = new Table();
+ } else
+ {
+ ctrl = new WebControl(HtmlTextWriterTag.Span);
+ isTable = false;
+ }
+ }
+
+ if(ctrl != null)
+ {
+ ctrl.ID = baseControl.ClientID;
+ ctrl.CopyBaseAttributes(baseControl);
+ ctrl.ApplyStyle(controlStyle);
+ ctrl.RenderBeginTag(writer);
+ }
+
+ Style itemStyle;
+ int colSpan = 0;
+ if(user.HasHeader)
+ {
+ if(isTable)
+ {
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ if(rowsCount != 1)
+ {
+ colSpan = rowsCount;
+ if(hasSeps)
+ colSpan += rowsCount;
+ writer.AddAttribute(HtmlTextWriterAttribute.Colspan, colSpan.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ itemStyle = user.GetItemStyle(ListItemType.Header, -1);
+ if(itemStyle != null)
+ {
+ itemStyle.AddAttributesToRender(writer);
+ }
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ user.RenderItem(ListItemType.Header, -1, this, writer);
+ if(isTable)
+ {
+ writer.RenderEndTag();
+ writer.RenderEndTag();
+ } else
+ {
+ if(!outerTableImp)
+ {
+ writer.WriteFullBeginTag("br");
+ }
+ }
+ }
+
+ int rowIndex = 0;
+ int colIndex = 0;
+ int index = 0;
+ while(rowIndex < rowsCount)
+ {
+ if(isTable)
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ colIndex = 0;
+ while(colIndex < colsCount)
+ {
+ index = rowIndex + colIndex * rowsCount;
+ if(index < total)
+ {
+ if(isTable)
+ {
+ itemStyle = user.GetItemStyle(ListItemType.Item, index);
+ if(itemStyle != null)
+ {
+ itemStyle.AddAttributesToRender(writer);
+ }
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ user.RenderItem(ListItemType.Item, index, this, writer);
+ if(isTable)
+ writer.RenderEndTag();
+ if(hasSeps && index != (total - 1))
+ {
+ if(colsCount == 1)
+ {
+ writer.RenderEndTag();
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ } else
+ {
+ writer.WriteFullBeginTag("br");
+ }
+ if(isTable)
+ {
+ itemStyle = user.GetItemStyle(ListItemType.Separator, index);
+ if(itemStyle != null)
+ itemStyle.AddAttributesToRender(writer);
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ if(index < total)
+ user.RenderItem(ListItemType.Separator, index, this, writer);
+ if(isTable)
+ writer.RenderEndTag();
+ }
+ }
+ colIndex++;
+ }
+ if(isTable)
+ writer.RenderEndTag();
+ else
+ if(rowIndex != (rowsCount - 1) || (user.HasFooter && !outerTableImp))
+ writer.WriteFullBeginTag("br");
+ rowIndex++;
+ }
+ if(user.HasFooter)
+ {
+ if(isTable)
+ {
+ writer.RenderBeginTag(HtmlTextWriterTag.Tr);
+ if(colsCount != 1)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Colspan, colSpan.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ itemStyle = user.GetItemStyle(ListItemType.Footer, -1);
+ if(itemStyle != null)
+ {
+ itemStyle.AddAttributesToRender(writer);
+ }
+ writer.RenderBeginTag(HtmlTextWriterTag.Td);
+ }
+ user.RenderItem(ListItemType.Footer, -1, this, writer);
+ if(isTable)
+ {
+ writer.RenderEndTag();
+ writer.RenderEndTag();
+ }
+ }
+ if(ctrl != null)
+ {
+ ctrl.RenderEndTag(writer);
+ }
+ }
+
+ private void DoHorizontalRendering(HtmlTextWriter writer, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
+ {
+
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs
new file mode 100755
index 00000000000..de1e81530e0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeatLayout.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: RepeatLayout
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum RepeatLayout
+ {
+ Table,
+ Flow
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs
new file mode 100644
index 00000000000..61c91e686c9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Repeater.cs
@@ -0,0 +1,283 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Repeater
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 90%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultEvent("ItemCommand")]
+ [DefaultProperty("DataSource")]
+ //[Designer("??")]
+ [ParseChildren(true)]
+ [PersistChildren(false)]
+ public class Repeater : Control, INamingContainer
+ {
+ private static readonly object ItemCommandEvent = new object();
+ private static readonly object ItemCreatedEvent = new object();
+ private static readonly object ItemDataBoundEvent = new object();
+
+ private static readonly string ITEMCOUNT = "Repeater_Item_Count";
+
+ private ITemplate alternatingItemTemplate;
+ private ITemplate footerTemplate;
+ private ITemplate headerTemplate;
+ private ITemplate itemTemplate;
+ private ITemplate separatorTemplate;
+ private object dataSource;
+
+ private RepeaterItemCollection items;
+ private ArrayList itemsArrayList;
+
+ public Repeater(): base()
+ {
+ }
+
+ public event RepeaterCommandEventHandler ItemCommand
+ {
+ add
+ {
+ Events.AddHandler(ItemCommandEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCommandEvent, value);
+ }
+ }
+
+ public event RepeaterItemEventHandler ItemCreated
+ {
+ add
+ {
+ Events.AddHandler(ItemCreatedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemCreatedEvent, value);
+ }
+ }
+
+ public event RepeaterItemEventHandler ItemDataBound
+ {
+ add
+ {
+ Events.AddHandler(ItemDataBoundEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(ItemDataBoundEvent, value);
+ }
+ }
+
+ public virtual ITemplate AlternatingItemTemplate
+ {
+ get
+ {
+ return alternatingItemTemplate;
+ }
+ set
+ {
+ alternatingItemTemplate = value;
+ }
+ }
+
+ public override ControlCollection Controls
+ {
+ get
+ {
+ EnsureChildControls();
+ return Controls;
+ }
+ }
+
+ public virtual string DataMember
+ {
+ get
+ {
+ object o = ViewState["DataMember"];
+ if(o != null)
+ {
+ return (string)o;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["DataMember"] = value;
+ }
+ }
+
+ public virtual object DataSource
+ {
+ get
+ {
+ return dataSource;
+ }
+ set
+ {
+ dataSource = value;
+ }
+ }
+
+ public virtual ITemplate FooterTemplate
+ {
+ get
+ {
+ return footerTemplate;
+ }
+ set
+ {
+ footerTemplate = value;
+ }
+ }
+
+ public virtual ITemplate HeaderTemplate
+ {
+ get
+ {
+ return headerTemplate;
+ }
+ set
+ {
+ headerTemplate = value;
+ }
+ }
+
+ public virtual RepeaterItemCollection Items
+ {
+ get
+ {
+ if(items != null)
+ {
+ if(itemsArrayList != null)
+ {
+ EnsureChildControls();
+ }
+ items = new RepeaterItemCollection(itemsArrayList);
+ }
+ return items;
+ }
+ }
+
+ public virtual ITemplate ItemTemplate
+ {
+ get
+ {
+ return itemTemplate;
+ }
+ set
+ {
+ itemTemplate = value;
+ }
+ }
+
+ public virtual ITemplate SeparatorTemplate
+ {
+ get
+ {
+ return separatorTemplate;
+ }
+ set
+ {
+ separatorTemplate = value;
+ }
+ }
+
+ public override void DataBind()
+ {
+ OnDataBinding(EventArgs.Empty);
+ }
+
+ protected override void CreateChildControls()
+ {
+ Controls.Clear();
+ if(ViewState[ITEMCOUNT] != null)
+ {
+ CreateControlHierarchy(false);
+ } else
+ {
+ itemsArrayList = new ArrayList();
+ }
+ ClearChildViewState();
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ [MonoTODO]
+ protected void CreateControlHierarchy(bool useDataSource)
+ {
+ //TODO: Fille me up
+ throw new NotImplementedException();
+ }
+
+ protected override bool OnBubbleEvent(object sender, EventArgs e)
+ {
+ bool retVal = false;
+ if(e is RepeaterCommandEventArgs)
+ {
+ OnItemCommand((RepeaterCommandEventArgs)e);
+ retVal = true;
+ }
+ return retVal;
+ }
+
+ protected override void OnDataBinding(EventArgs e)
+ {
+ OnDataBinding(e);
+ Controls.Clear();
+ ClearChildViewState();
+ CreateControlHierarchy(true);
+ ChildControlsCreated = true;
+ }
+
+ protected virtual void OnItemCommand(RepeaterCommandEventArgs e)
+ {
+ if(Events != null)
+ {
+ RepeaterCommandEventHandler rceh = (RepeaterCommandEventHandler)(ViewState[ItemCommandEvent]);
+ if(rceh != null)
+ {
+ rceh(this, e);
+ }
+ }
+ }
+
+ protected virtual void OnItemCreated(RepeaterItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ RepeaterItemEventHandler rceh = (RepeaterItemEventHandler)(ViewState[ItemCreatedEvent]);
+ if(rceh != null)
+ {
+ rceh(this, e);
+ }
+ }
+ }
+
+ protected virtual void OnItemDataBound(RepeaterItemEventArgs e)
+ {
+ if(Events != null)
+ {
+ RepeaterItemEventHandler rceh = (RepeaterItemEventHandler)(ViewState[ItemDataBoundEvent]);
+ if(rceh != null)
+ {
+ rceh(this, e);
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs
new file mode 100644
index 00000000000..1d2e5c298ff
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventArgs.cs
@@ -0,0 +1,46 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: RepeaterCommandEventArgs
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class RepeaterCommandEventArgs: CommandEventArgs
+ {
+ private RepeaterItem rItem;
+ private object cmdSrc;
+
+ public RepeaterCommandEventArgs(RepeaterItem item, object commandSource, CommandEventArgs originalArgs): base(originalArgs)
+ {
+ rItem = item;
+ cmdSrc = commandSource;
+ }
+
+ public object CommandSource
+ {
+ get
+ {
+ return cmdSrc;
+ }
+ }
+
+ public RepeaterItem Item
+ {
+ get
+ {
+ return rItem;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs
new file mode 100644
index 00000000000..1d93d3d8a67
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterCommandEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void RepeaterCommandEventHandler(object sender, RepeaterCommandEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs
new file mode 100644
index 00000000000..69adc3bb369
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItem.cs
@@ -0,0 +1,72 @@
+/**
+* Namespace: System.Web.UI.WebControls
+* Class: RepeaterItem
+*
+* Author: Gaurav Vaish
+* Maintainer: gvaish@iitk.ac.in
+* Implementation: yes
+* Status: 100%
+*
+* (C) Gaurav Vaish (2001)
+*/
+
+using System;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxItem(false)]
+ public class RepeaterItem: Control, INamingContainer
+ {
+ private int itemIndex;
+ private ListItemType itemType;
+ private object dataItem;
+
+ public RepeaterItem(int itemIndex, ListItemType itemType)
+ {
+ this.itemIndex = itemIndex;
+ this.itemType = itemType;
+ }
+
+ public virtual object DataItem
+ {
+ get
+ {
+ return dataItem;
+ }
+ set
+ {
+ dataItem = value;
+ }
+ }
+
+ public virtual int ItemIndex
+ {
+ get
+ {
+ return itemIndex;
+ }
+ }
+
+ public virtual ListItemType ItemType
+ {
+ get
+ {
+ return itemType;
+ }
+ }
+
+ protected override bool OnBubbleEvent(object source, EventArgs e)
+ {
+ if(e is CommandEventArgs)
+ {
+ RepeaterCommandEventArgs rcea = new RepeaterCommandEventArgs(this, source, (CommandEventArgs)e);
+ RaiseBubbleEvent(source, rcea);
+ return true;
+ }
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs
new file mode 100644
index 00000000000..a77a5549562
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemCollection.cs
@@ -0,0 +1,83 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RepeaterItemCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class RepeaterItemCollection : ICollection, IEnumerable
+ {
+ private ArrayList items;
+
+ public RepeaterItemCollection(ArrayList items)
+ {
+ this.items = items;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return items.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public RepeaterItem this[int index]
+ {
+ get
+ {
+ return (RepeaterItem)(items[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(RepeaterItem current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return items.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs
new file mode 100644
index 00000000000..4ccd5dc1269
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventArgs.cs
@@ -0,0 +1,37 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RepeaterItemEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class RepeaterItemEventArgs : EventArgs
+ {
+ private RepeaterItem item;
+
+ public RepeaterItemEventArgs(RepeaterItem item)
+ {
+ this.item = item;
+ }
+
+ public RepeaterItem Item
+ {
+ get
+ {
+ return item;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs
new file mode 100644
index 00000000000..73f7913171c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RepeaterItemEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void RepeaterItemEventHandler(object sender, RepeaterItemEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs
new file mode 100644
index 00000000000..202741b73fc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/RequiredFieldValidator.cs
@@ -0,0 +1,60 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: RequiredFieldValidator
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxData("<{0}:RequiredFieldValidator runat=\"server\" "
+ + "ErrorMessage=\"RequiredFieldValidator\">"
+ + "</{0}:RequiredFieldValidator>")]
+ public class RequiredFieldValidator : BaseValidator
+ {
+ public RequiredFieldValidator(): base()
+ {
+ }
+
+ public string InitialValue
+ {
+ get
+ {
+ object o = ViewState["InitialValue"];
+ if(o != null)
+ return (String)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["InitialValue"] = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ base.AddAttributesToRender(writer);
+ if(RenderUplevel)
+ {
+ writer.AddAttribute("evaluationfunction", "RequiredFieldValidatorEvaluateIsValid");
+ writer.AddAttribute("initialvalue", InitialValue);
+ }
+ }
+
+ protected override bool EvaluateIsValid()
+ {
+ string val = GetControlValidationValue(ControlToValidate);
+ if(val != null)
+ {
+ return (val.Trim() == InitialValue.Trim());
+ }
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs
new file mode 100644
index 00000000000..fa3776a70d8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/SelectedDatesCollection.cs
@@ -0,0 +1,120 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: SelectedDatesCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class SelectedDatesCollection : ICollection, IEnumerable
+ {
+ ArrayList dateList;
+
+ public SelectedDatesCollection(ArrayList dateList)
+ {
+ this.dateList = dateList;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return dateList.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public DateTime this[int index]
+ {
+ get
+ {
+ return (DateTime)(dateList[index]);
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public void Add(DateTime date)
+ {
+ dateList.Add(date);
+ }
+
+ public void Clear()
+ {
+ dateList.Clear();
+ }
+
+ public bool Contains(DateTime date)
+ {
+ return dateList.Contains(date);
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(DateTime current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return dateList.GetEnumerator();
+ }
+
+ public void Remove(DateTime date)
+ {
+ dateList.Remove(date);
+ }
+
+ public void SelectRange(DateTime fromDate, DateTime toDate)
+ {
+ dateList.Clear();
+ //FIXME: Probable bug in MS implementation. It SHOULD NOT
+ // clear the list if fromDate > toDate
+ if(fromDate > toDate)
+ {
+ return;
+ }
+ DateTime local = fromDate;
+ do
+ {
+ dateList.Add(local);
+ local = local.AddDays(1);
+ } while(local < toDate);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs
new file mode 100644
index 00000000000..69ac40110e8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventArgs.cs
@@ -0,0 +1,47 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ServerValidateEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class ServerValidateEventArgs : EventArgs
+ {
+ private bool isValid;
+ private string value;
+
+ public ServerValidateEventArgs(string value, bool isValid)
+ {
+ this.value = value;
+ this.isValid = isValid;
+ }
+
+ public bool IsValid
+ {
+ get
+ {
+ return isValid;
+ }
+ }
+
+ public string Value
+ {
+ get
+ {
+ return value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs
new file mode 100644
index 00000000000..b37ffd5f26f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ServerValidateEventHandler.cs
@@ -0,0 +1,16 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public delegate void ServerValidateEventHandler(object sender, ServerValidateEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs
new file mode 100644
index 00000000000..93d9295835c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Style.cs
@@ -0,0 +1,542 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Style
+ *
+ * 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)
+ */
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Drawing;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ [ToolboxItem(false)]
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ public class Style : Component , IStateManager
+ {
+ internal static int MARKED = (0x01 << 0);
+ internal static int BACKCOLOR = (0x01 << 1);
+ internal static int BORDERCOLOR = (0x01 << 2);
+ internal static int BORDERSTYLE = (0x01 << 3);
+ internal static int BORDERWIDTH = (0x01 << 4);
+ internal static int CSSCLASS = (0x01 << 5);
+ internal static int FORECOLOR = (0x01 << 6);
+ internal static int HEIGHT = (0x01 << 7);
+ internal static int WIDTH = (0x01 << 8);
+ internal static int FONT_BOLD = (0x01 << 9);
+ internal static int FONT_ITALIC = (0x01 << 10);
+ internal static int FONT_NAMES = (0x01 << 11);
+ internal static int FONT_SIZE = (0x01 << 12);
+ internal static int FONT_STRIKE = (0x01 << 13);
+ internal static int FONT_OLINE = (0x01 << 14);
+ internal static int FONT_ULINE = (0x01 << 15);
+
+ internal static string selectionBitString = "_SystemWebUIWebControlsStyle_SBS";
+
+ private StateBag viewState;
+ private int selectionBits;
+ private bool selfStateBag;
+
+ private FontInfo font;
+
+ public Style()
+ {
+ Initialize(null);
+ selfStateBag = true;
+ }
+
+ public Style(StateBag bag): base()
+ {
+ Initialize(bag);
+ selfStateBag = false;
+ }
+
+ private void Initialize(StateBag bag)
+ {
+ viewState = bag;
+ selectionBits = 0x00;
+ }
+
+ internal virtual StateBag ViewState
+ {
+ get
+ {
+ if(viewState == null)
+ {
+ viewState = new StateBag(false);
+ if(IsTrackingViewState)
+ viewState.TrackViewState();
+ }
+ return viewState;
+ }
+ }
+
+ internal bool IsSet(int bit)
+ {
+ return ( (selectionBits & bit) != 0x00);
+ }
+
+ internal virtual void Set(int bit)
+ {
+ selectionBits |= bit;
+ if(IsTrackingViewState)
+ selectionBits |= MARKED;
+ }
+
+ public Color BackColor
+ {
+ get
+ {
+ if(IsSet(BACKCOLOR))
+ return (Color)ViewState["BackColor"];
+ return Color.Empty;
+ }
+ set
+ {
+ ViewState["BackColor"] = value;
+ Set(BACKCOLOR);
+ }
+ }
+
+ public Color BorderColor
+ {
+ get
+ {
+ if(IsSet(BORDERCOLOR))
+ return (Color)ViewState["BorderColor"];
+ return Color.Empty;
+ }
+ set
+ {
+ ViewState["BorderColor"] = value;
+ Set(BORDERCOLOR);
+ }
+ }
+
+ public BorderStyle BorderStyle
+ {
+ get
+ {
+ if(IsSet(BORDERSTYLE))
+ return (BorderStyle)ViewState["BorderStyle"];
+ return BorderStyle.NotSet;
+ }
+ set
+ {
+ ViewState["BorderStyle"] = value;
+ Set(BORDERSTYLE);
+ }
+ }
+
+ public Unit BorderWidth
+ {
+ get
+ {
+ if(IsSet(BORDERWIDTH))
+ return (Unit)ViewState["BorderWidth"];
+ return Unit.Empty;
+ }
+ set
+ {
+ ViewState["BorderWidth"] = value;
+ Set(BORDERWIDTH);
+ }
+ }
+
+ public string CssClass
+ {
+ get
+ {
+ if(IsSet(CSSCLASS))
+ return (string)ViewState["CssClass"];
+ return string.Empty;
+ }
+ set
+ {
+ ViewState["CssClass"] = value;
+ Set(CSSCLASS);
+ }
+ }
+
+ public Color ForeColor
+ {
+ get
+ {
+ if(IsSet(FORECOLOR))
+ return (Color)ViewState["ForeColor"];
+ return Color.Empty;
+ }
+ set
+ {
+ ViewState["ForeColor"] = value;
+ Set(FORECOLOR);
+ }
+ }
+
+ public Unit Height
+ {
+ get
+ {
+ if(IsSet(HEIGHT))
+ return (Unit)ViewState["Height"];
+ return Unit.Empty;
+ }
+ set
+ {
+ ViewState["Height"] = value;
+ Set(HEIGHT);
+ }
+ }
+
+ public Unit Width
+ {
+ get
+ {
+ if(IsSet(WIDTH))
+ return (Unit)ViewState["Width"];
+ return Unit.Empty;
+ }
+ set
+ {
+ ViewState["Width"] = value;
+ Set(HEIGHT);
+ }
+ }
+
+ public FontInfo Font
+ {
+ get
+ {
+ if(font==null)
+ font = new FontInfo(this);
+ return font;
+ }
+ }
+
+ internal virtual bool IsEmpty
+ {
+ get
+ {
+ return (selectionBits != 0);
+ }
+ }
+
+ private void AddColor(HtmlTextWriter writer, HtmlTextWriterStyle style, Color color)
+ {
+ if(!color.IsEmpty)
+ writer.AddStyleAttribute(style, ColorTranslator.ToHtml(color));
+ }
+
+ private static string StringArrayToString(string[] array, char separator)
+ {
+ if(array.Length == 0)
+ return String.Empty;
+ StringBuilder sb = new StringBuilder();
+ for(int i=0; i < array.Length; i++)
+ {
+ if(i==0)
+ {
+ sb.Append(array[0]);
+ } else
+ {
+ sb.Append(separator);
+ sb.Append(array[i]);
+ }
+ }
+ return sb.ToString();
+ }
+
+ public void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ AddAttributesToRender(writer, null);
+ }
+
+ public virtual void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
+ {
+ if(IsSet(BACKCOLOR))
+ {
+ AddColor(writer, HtmlTextWriterStyle.BackgroundColor, (Color)ViewState["BackColor"]);
+ }
+
+ if(IsSet(BORDERCOLOR))
+ {
+ AddColor(writer, HtmlTextWriterStyle.BorderColor, (Color)ViewState["BorderColor"]);
+ }
+
+ if(IsSet(FORECOLOR))
+ {
+ AddColor(writer, HtmlTextWriterStyle.Color, (Color)ViewState["ForeColor"]);
+ }
+
+ if(IsSet(CSSCLASS))
+ {
+ string cssClass = (string)ViewState["CssClass"];
+ if(cssClass.Length > 0)
+ writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);
+ }
+
+ if(!BorderWidth.IsEmpty)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, BorderWidth.ToString(CultureInfo.InvariantCulture));
+ if(BorderStyle!=BorderStyle.NotSet)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, Enum.Format(typeof(BorderStyle), BorderStyle, "G"));
+ } else
+ {
+ if(BorderWidth.Value != 0.0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "solid");
+ }
+ }
+ } else
+ {
+ if(BorderStyle!=BorderStyle.NotSet)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, Enum.Format(typeof(BorderStyle), BorderStyle, "G"));
+ }
+ }
+
+ if(Font.Names.Length > 0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.FontFamily, StringArrayToString(Font.Names,','));
+ }
+
+ if(!Font.Size.IsEmpty)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, Font.Size.ToString(CultureInfo.InvariantCulture));
+ }
+
+ if(Font.Bold)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "bold");
+ }
+
+ if(Font.Italic)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.FontStyle, "italic");
+ }
+
+ string textDecoration = String.Empty;
+ if(Font.Strikeout)
+ {
+ textDecoration += " strikeout";
+ }
+ if(Font.Underline)
+ {
+ textDecoration += " underline";
+ }
+ if(Font.Overline)
+ {
+ textDecoration += " overline";
+ }
+ if(textDecoration.Length > 0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.TextDecoration, textDecoration);
+ }
+
+ Unit u = Unit.Empty;
+ if(IsSet(HEIGHT))
+ {
+ u = (Unit)ViewState["Height"];
+ writer.AddStyleAttribute(HtmlTextWriterStyle.Height, u.ToString(CultureInfo.InvariantCulture));
+ }
+ if(IsSet(WIDTH))
+ {
+ u = (Unit)ViewState["Width"];
+ writer.AddStyleAttribute(HtmlTextWriterStyle.Width, u.ToString(CultureInfo.InvariantCulture));
+ }
+ }
+
+ public virtual void CopyFrom(Style source)
+ {
+ if(source!=null && !source.IsEmpty)
+ {
+ Font.CopyFrom(source.Font);
+ if(source.Height!=Unit.Empty)
+ {
+ Height = source.Height;
+ }
+ if(source.Width!=Unit.Empty)
+ {
+ Width = source.Width;
+ }
+ if(source.BorderColor!=Color.Empty)
+ {
+ BorderColor = source.BorderColor;
+ }
+ if(source.BorderWidth!=Unit.Empty)
+ {
+ BorderWidth = source.BorderWidth;
+ }
+ if(source.BorderStyle!=BorderStyle.NotSet)
+ {
+ BorderStyle = source.BorderStyle;
+ }
+ if(source.BackColor!=Color.Empty)
+ {
+ BackColor = source.BackColor;
+ }
+ if(source.CssClass!=String.Empty)
+ {
+ CssClass = source.CssClass;
+ }
+ if(source.ForeColor!=Color.Empty)
+ {
+ ForeColor = source.ForeColor;
+ }
+ }
+ }
+
+ public virtual void MergeWith(Style with)
+ {
+ if(with!=null && !with.IsEmpty)
+ {
+ if(IsEmpty)
+ {
+ CopyFrom(with);
+ return;
+ }
+
+ Font.MergeWith(with.Font);
+ if(!IsSet(HEIGHT) && with.Height!=Unit.Empty)
+ {
+ Height = with.Height;
+ }
+ if(!IsSet(WIDTH) && with.Width!=Unit.Empty)
+ {
+ Width = with.Width;
+ }
+ if(!IsSet(BORDERCOLOR) && with.BorderColor!=Color.Empty)
+ {
+ BorderColor = with.BorderColor;
+ }
+ if(!IsSet(BORDERWIDTH) && with.BorderWidth!=Unit.Empty)
+ {
+ BorderWidth = with.BorderWidth;
+ }
+ if(!IsSet(BORDERSTYLE) && with.BorderStyle!=BorderStyle.NotSet)
+ {
+ BorderStyle = with.BorderStyle;
+ }
+ if(!IsSet(BACKCOLOR) && with.BackColor!=Color.Empty)
+ {
+ BackColor = with.BackColor;
+ }
+ if(!IsSet(CSSCLASS) && with.CssClass!=String.Empty)
+ {
+ CssClass = with.CssClass;
+ }
+ if(!IsSet(FORECOLOR) && with.ForeColor!=Color.Empty)
+ {
+ ForeColor = with.ForeColor;
+ }
+ }
+ }
+
+ public virtual void Reset()
+ {
+ if(IsSet(BACKCOLOR))
+ ViewState.Remove("BackColor");
+ if(IsSet(BORDERCOLOR))
+ ViewState.Remove("BorderColor");
+ if(IsSet(BORDERSTYLE))
+ ViewState.Remove("BorderStyle");
+ if(IsSet(BORDERWIDTH))
+ ViewState.Remove("BorderWidth");
+ if(IsSet(CSSCLASS))
+ ViewState.Remove("CssClass");
+ if(IsSet(FORECOLOR))
+ ViewState.Remove("ForeColor");
+ if(IsSet(HEIGHT))
+ ViewState.Remove("Height");
+ if(IsSet(WIDTH))
+ ViewState.Remove("Width");
+ if(font!=null)
+ font.Reset();
+ selectionBits = 0x00;
+ }
+
+ protected bool IsTrackingViewState
+ {
+ get
+ {
+ return ( (selectionBits & MARKED) != 0x00 );
+ }
+ }
+
+ protected internal virtual void TrackViewState()
+ {
+ if(viewState!=null)
+ ViewState.TrackViewState();
+ Set(MARKED);
+ }
+
+ protected internal object SaveViewState()
+ {
+ if(viewState != null)
+ {
+ if(IsSet(MARKED))
+ {
+ ViewState[selectionBitString] = selectionBits;
+ }
+ if(selfStateBag)
+ {
+ return ViewState.SaveViewState();
+ }
+ }
+ return null;
+ }
+
+ protected internal void LoadViewState(object state)
+ {
+ if(state!=null && selfStateBag)
+ {
+ ViewState.LoadViewState(state);
+ }
+ if(viewState!=null)
+ {
+ selectionBits = (int)ViewState[selectionBitString];
+ }
+ }
+
+ void IStateManager.LoadViewState(object state)
+ {
+ LoadViewState(state);
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return IsTrackingViewState;
+ }
+ }
+
+ public override string ToString()
+ {
+ return String.Empty;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TODO b/mcs/class/System.Web/System.Web.UI.WebControls/TODO
new file mode 100755
index 00000000000..05abe9b822a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TODO
@@ -0,0 +1,156 @@
+All Classes, Interfaces, Structures, Delegates and Enumerations
+
+
+<attributesIssue>
+ Attributes may have to be supplied to the classes. Some of the attributes
+ include DefaultPropertyAttribute, ToolboxItemAttribute, ParseChildrenAttribute
+ (to be added to System.Web.UI) etc. Currently, I have not taken care of these
+ aspects. They are to be handled later on.
+</attributesIssue>
+
+<disposableItemsIssue>
+ I have not taken care of any disposing issues that may be involved. But I think
+ it will not be a problem since I am no where using unmanaged code.
+</disposableItemsIssue>
+
+<legends>
+*: Completed
+&: Work in progress. See <item-name>.cs file for maintainer's name
+</legends>
+
+* AdCreatedEventArgs
+* AdRotator
+* BaseCompareValidator
+* BaseDataList
+& BaseValidator
+& BoundColumn
+* Button
+* ButtonColumn
+& Calendar
+* CalendarDay
+* CheckBox
+* CheckBoxList
+* CommandEventArgs
+& CompareValidator
+* CustomValidator
+& DataGrid
+* DataGridColumn
+* DataGridColumnCollection
+* DataGridCommandEventArgs
+& DataGridItem
+* DataGridItemCollection
+* DataGridItemEventArgs
+* DataGridPageChangedEventArgs
+& DataGridPagerStyle
+* DataGridShortCommandEventArgs
+* DataKeyCollection
+& DataList
+* DataListCommandEventArgs
+& DataListItem
+* DataListItemCollecton
+* DataListItemEventArgs
+* DayRenderEventArgs
+* DropDownList
+& EditCommandColumn
+* FontInfo
+* FontNamesConverter
+& FontUnitConverter
+* HyperLink
+* HyperLinkColumn
+* HyperLinkControlBuilder
+* Image
+* ImageButton
+* Label
+* LabelControlBuilder
+* LinkButton
+* LinkButtonControlBuilder
+* ListBox
+* ListControl
+* ListItem
+* ListItemCollection
+* ListItemControlBuilder
+* Literal
+* LiteralControlBuilder
+* MonthChangedEventArgs
+* PagedDataSource
+* Panel
+* PlaceHolder
+* PlaceHolderControlBuilder
+* RadioButton
+& RadioButtonList
+* RangeValidator
+* RegularExpressionValidator
+& Repeater
+* RepeaterCommandEventArgs
+& RepeaterItem
+* RepeaterItemCollection
+* RepeaterItemEventArgs
+& RepeatInfo
+* RequiredFieldValidator
+* SelectedDatesCollection
+* ServerValidateEventArgs
+* Style
+* Table
+* TableCell
+* TableCellCollection
+* TableCellControlBuilder
+* TableHeaderCell
+* TableItemStyle
+* TableRow
+* TableRowCollection
+* TableStyle
+* TargetConverter
+* TemplateColumn
+& TextBox
+* TextBoxControlBuilder
+* UnitConverter
+* ValidatedControlConverter
+& ValidationSummary
+& WebColorConverter
+& WebControl
+& Xml
+
+* IRepeatInfoUser
+
+* FontUnit
+* Unit
+
+* AdCreatedEventHandler
+* CommandEventHandler
+* DataGridCommandEventHandler
+* DataGridItemEventHandler
+* DataGridPageChangedEventHandler
+* DataGridSortCommandEventHandler
+* DataListCommandEventHandler
+* DataListItemEventHandler
+* DayRenderEventHandler
+* MonthChangedEventHandler
+* RepeaterCommandEventHandler
+* RepeaterItemEventHandler
+* ServerValidateEventHandler
+
+* BorderStyle
+* ButtonColumnType
+* CalendarSelectionMode
+* DayNameFormat
+* FirstDayOfWeek
+* FontSize
+* GridLines
+* HorizontalAlign
+* ImageAlign
+* ListItemType
+* ListSelectionMode
+* NextPrevFormat
+* PagerMode
+* PagerPosition
+* RepeatDirection
+* RepeatLayout
+* TextAlign
+* TextBoxMode
+* TitleFormat
+* UnitType
+* ValidationCompareOperator
+* ValidationDataType
+* ValidationSummaryDisplayMode
+* ValidatorDisplay
+* VerticalAlign
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Table.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Table.cs
new file mode 100644
index 00000000000..8de3484518b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Table.cs
@@ -0,0 +1,190 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Table
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Rows")]
+ //[Designer("??")]
+ [ParseChildren(true, "Rows")]
+ public class Table: WebControl
+ {
+ private TableRowCollection rows;
+
+ private class TableRowControlCollection : ControlCollection
+ {
+ public TableRowControlCollection(Control owner): base(owner)
+ {
+ }
+
+ public override void Add(Control child)
+ {
+ if(child is TableRow)
+ {
+ Add(child);
+ return;
+ }
+ throw new ArgumentException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type", "Table", child.GetType().Name.ToString()));
+ }
+
+ public override void AddAt(int index, Control child)
+ {
+ if(child is TableRow)
+ {
+ Add(child);
+ return;
+ }
+ throw new ArgumentException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type", "Table", child.GetType().Name.ToString()));
+ }
+ }
+
+ public Table(): base(HtmlTextWriterTag.Table)
+ {
+ }
+
+ public virtual string BackImageUrl
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ {
+ return ((TableStyle)ControlStyle).BackImageUrl;
+ }
+ return String.Empty;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).BackImageUrl = value;
+ }
+ }
+
+ public virtual int CellPadding
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ {
+ return ((TableStyle)ControlStyle).CellPadding;
+ }
+ return -1;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellPadding = value;
+ }
+ }
+
+ public virtual int CellSpacing
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ {
+ return ((TableStyle)ControlStyle).CellSpacing;
+ }
+ return -1;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).CellSpacing = value;
+ }
+ }
+
+ public virtual GridLines GridLines
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ {
+ return ((TableStyle)ControlStyle).GridLines;
+ }
+ return GridLines.None;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).GridLines = value;
+ }
+ }
+
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ {
+ return ((TableStyle)ControlStyle).HorizontalAlign;
+ }
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ ((TableStyle)ControlStyle).HorizontalAlign = value;
+ }
+ }
+
+ public virtual TableRowCollection Rows
+ {
+ get
+ {
+ if(rows == null)
+ {
+ rows = new TableRowCollection(this);
+ }
+ return rows;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ AddAttributesToRender(writer);
+ if(!BorderColor.IsEmpty)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Bordercolor, ColorTranslator.ToHtml(BorderColor));
+ }
+
+ Unit bw = BorderWidth;
+ if(GridLines == GridLines.None)
+ {
+ bw = Unit.Pixel(0);
+ } else if(!bw.IsEmpty && bw.Type == UnitType.Pixel)
+ {
+ bw = Unit.Pixel(1);
+ }
+ writer.AddAttribute(HtmlTextWriterAttribute.Border, ((int)bw.Value).ToString(NumberFormatInfo.InvariantInfo));
+ }
+
+ protected override ControlCollection CreateControlCollection()
+ {
+ return new TableRowControlCollection(this);
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableStyle(ViewState);
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ foreach(object current in Rows)
+ {
+ ((TableRow)current).RenderControl(writer);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs
new file mode 100644
index 00000000000..56f12f9d13d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableCell.cs
@@ -0,0 +1,173 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableCell
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ [DefaultProperty("Text")]
+ [ToolboxItem(false)]
+ [ControlBuilder(typeof(TableCellControlBuilder))]
+ [ParseChildren(false)]
+ [PersistChildren(true)]
+ public class TableCell: WebControl
+ {
+ [MonoTODO]
+ public TableCell(): base(HtmlTextWriterTag.Td)
+ {
+ //TODO: What's the function to prevent Control to give _auto_generated_id
+ }
+
+ [MonoTODO]
+ internal TableCell(HtmlTextWriterTag tag): base(tag)
+ {
+ //TODO: What's the function to prevent Control to give _auto_generated_id
+ }
+
+ public virtual int ColumnSpan
+ {
+ get
+ {
+ object o = ViewState["ColumnSpan"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ ViewState["ColumnSpan"] = value;
+ }
+ }
+
+ public virtual int RowSpan
+ {
+ get
+ {
+ object o = ViewState["RowSpan"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ ViewState["RowSpan"] = value;
+ }
+ }
+
+ public virtual string Text
+ {
+ get
+ {
+ object o = ViewState["Text"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ return ((TableItemStyle)ControlStyle).HorizontalAlign;
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ ((TableItemStyle)ControlStyle).HorizontalAlign = value;
+ }
+ }
+
+ public virtual VerticalAlign VerticalAlign
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ return ((TableItemStyle)ControlStyle).VerticalAlign;
+ return VerticalAlign.NotSet;
+ }
+ set
+ {
+ ((TableItemStyle)ControlStyle).VerticalAlign = value;
+ }
+ }
+
+ public virtual bool Wrap
+ {
+ get
+ {
+ if(ControlStyleCreated)
+ return ((TableItemStyle)ControlStyle).Wrap;
+ return true;
+ }
+ set
+ {
+ ((TableItemStyle)ControlStyle).Wrap = value;
+ }
+ }
+
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ AddAttributesToRender(writer);
+ if(ColumnSpan > 0)
+ writer.AddAttribute(HtmlTextWriterAttribute.Colspan, ColumnSpan.ToString(NumberFormatInfo.InvariantInfo));
+ if(RowSpan > 0)
+ writer.AddAttribute(HtmlTextWriterAttribute.Rowspan, RowSpan.ToString(NumberFormatInfo.InvariantInfo));
+ }
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ if(HasControls())
+ {
+ AddParsedSubObject(obj);
+ return;
+ }
+ if(obj is LiteralControl)
+ {
+ Text = ((LiteralControl)obj).Text;
+ return;
+ }
+ string text = Text;
+ if(text.Length > 0)
+ {
+ Text = String.Empty;
+ AddParsedSubObject(new LiteralControl(text));
+ }
+ AddParsedSubObject(obj);
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableItemStyle(ViewState);
+ }
+
+ protected override void RenderContents(HtmlTextWriter writer)
+ {
+ if(HasControls())
+ {
+ RenderContents(writer);
+ return;
+ }
+ writer.Write(Text);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs
new file mode 100644
index 00000000000..c3b442b91de
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellCollection.cs
@@ -0,0 +1,181 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableCellCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.ComponentModel;
+
+namespace System.Web.UI.WebControls
+{
+ //[Editor("??")]
+ public sealed class TableCellCollection: IList, ICollection, IEnumerable
+ {
+ private TableRow owner;
+
+ internal TableCellCollection(TableRow owner)
+ {
+ if(owner == null)
+ {
+ throw new ArgumentNullException();
+ }
+ this.owner = owner;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return owner.Controls.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public TableCell this[int index]
+ {
+ get
+ {
+ return (TableCell)owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public int Add(TableCell cell)
+ {
+ AddAt(-1, cell);
+ return owner.Controls.Count;
+ }
+
+ public void AddAt(int index, TableCell cell)
+ {
+ owner.Controls.AddAt(index, cell);
+ }
+
+ public void AddRange(TableCell[] cells)
+ {
+ foreach(TableCell cell in cells)
+ {
+ Add(cell);
+ }
+ }
+
+ public void Clear()
+ {
+ if(owner.HasControls())
+ {
+ owner.Controls.Clear();
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(object cell in this)
+ {
+ array.SetValue(cell, index++);
+ }
+ }
+
+ public int GetCellIndex(TableCell cell)
+ {
+ if(!owner.HasControls())
+ {
+ return -1;
+ }
+ return owner.Controls.IndexOf(cell);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return owner.Controls.GetEnumerator();
+ }
+
+ public void Remove(TableCell cell)
+ {
+ owner.Controls.Remove(cell);
+ }
+
+ public void RemoveAt(int index)
+ {
+ owner.Controls.RemoveAt(index);
+ }
+
+ int IList.Add(object o)
+ {
+ return Add((TableCell)o);
+ }
+
+ bool IList.Contains(object o)
+ {
+ return owner.Controls.Contains((TableCell)o);
+ }
+
+ int IList.IndexOf(object o)
+ {
+ return owner.Controls.IndexOf((TableCell)o);
+ }
+
+ void IList.Insert(int index, object o)
+ {
+ owner.Controls.AddAt(index, (TableCell)o);
+ }
+
+ void IList.Remove(object o)
+ {
+ owner.Controls.Remove((TableCell)o);
+ }
+
+ bool IList.IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return this[index];
+ }
+ set
+ {
+ RemoveAt(index);
+ AddAt(index, (TableCell)value);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs
new file mode 100644
index 00000000000..6363462fa51
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableCellControlBuilder.cs
@@ -0,0 +1,31 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableCellControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableCellControlBuilder: ControlBuilder
+ {
+ public TableCellControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs
new file mode 100644
index 00000000000..e3ccb0c1a93
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableHeaderCell.cs
@@ -0,0 +1,26 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableHeaderCell
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableHeaderCell: TableCell
+ {
+ public TableHeaderCell(): base(HtmlTextWriterTag.Th)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs
new file mode 100644
index 00000000000..9d848e5f5b0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableItemStyle.cs
@@ -0,0 +1,172 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableItemStyle
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableItemStyle: Style
+ {
+ private static int H_ALIGN = (0x01 << 16);
+ private static int V_ALIGN = (0x01 << 17);
+ private static int WRAP = (0x01 << 18);
+
+ public TableItemStyle(): base()
+ {
+ }
+
+ public TableItemStyle(StateBag bag): base(bag)
+ {
+ }
+
+ [Bindable(true)]
+ [DefaultValue(HorizontalAlign.NotSet)]
+ [NotifyParentProperty(true)]
+ [WebCategory("Layout")]
+ [WebSysDescription("TableItemStyle_HorizontalAlign")]
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ if(IsSet(H_ALIGN))
+ return (HorizontalAlign)ViewState["HorizontalAlign"];
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(HorizontalAlign), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["HorizontalAlign"] = value;
+ Set(H_ALIGN);
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(VerticalAlign.NotSet)]
+ [NotifyParentProperty(true)]
+ [WebCategory("Layout")]
+ [WebSysDescription("TableItemStyle_VerticalAlign")]
+ public virtual VerticalAlign VerticalAlign
+ {
+ get
+ {
+ if(IsSet(V_ALIGN))
+ return (VerticalAlign)ViewState["VerticalAlign"];
+ return VerticalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(VerticalAlign), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["VerticalAlign"] = value;
+ Set(V_ALIGN);
+ }
+ }
+
+ [Bindable(true)]
+ [DefaultValue(VerticalAlign.NotSet)]
+ [NotifyParentProperty(true)]
+ [WebCategory("Layout")]
+ [WebSysDescription("TableItemStyle_Wrap")]
+ public virtual bool Wrap
+ {
+ get
+ {
+ if(IsSet(WRAP))
+ return (bool)ViewState["Wrap"];
+ return true;
+ }
+ set
+ {
+ ViewState["Wrap"] = value;
+ }
+ }
+
+ public override void CopyFrom(Style s)
+ {
+ if(s!=null && s is TableItemStyle && !s.IsEmpty)
+ {
+ base.CopyFrom(s);
+ TableItemStyle from = (TableItemStyle)s;
+ if(from.IsSet(H_ALIGN))
+ {
+ HorizontalAlign = from.HorizontalAlign;
+ }
+ if(from.IsSet(V_ALIGN))
+ {
+ VerticalAlign = from.VerticalAlign;
+ }
+ if(from.IsSet(WRAP))
+ {
+ Wrap = from.Wrap;
+ }
+ }
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s!=null && s is TableItemStyle && !s.IsEmpty)
+ {
+ base.MergeWith(s);
+ TableItemStyle with = (TableItemStyle)s;
+ if(with.IsSet(H_ALIGN) && !IsSet(H_ALIGN))
+ {
+ HorizontalAlign = with.HorizontalAlign;
+ }
+ if(with.IsSet(V_ALIGN) && !IsSet(V_ALIGN))
+ {
+ VerticalAlign = with.VerticalAlign;
+ }
+ if(with.IsSet(WRAP) && !IsSet(WRAP))
+ {
+ Wrap = with.Wrap;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(H_ALIGN))
+ ViewState.Remove("HorizontalAlign");
+ if(IsSet(V_ALIGN))
+ ViewState.Remove("VerticalAlign");
+ if(IsSet(WRAP))
+ ViewState.Remove("Wrap");
+ base.Reset();
+ }
+
+ public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
+ {
+ base.AddAttributesToRender(writer, owner);
+ if(!Wrap)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
+ }
+ if(HorizontalAlign != HorizontalAlign.NotSet)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, TypeDescriptor.GetConverter(typeof(HorizontalAlign)).ConvertToString(HorizontalAlign));
+ }
+ if(VerticalAlign != VerticalAlign.NotSet)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Valign, TypeDescriptor.GetConverter(typeof(VerticalAlign)).ConvertToString(VerticalAlign));
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs
new file mode 100644
index 00000000000..baf3e07c232
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableRow.cs
@@ -0,0 +1,110 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableRow
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableRow: WebControl
+ {
+ private TableCellCollection cells;
+
+ public TableRow(): base(HtmlTextWriterTag.Tr)
+ {
+ PreventAutoID();
+ }
+
+ public virtual TableCellCollection Cells
+ {
+ get
+ {
+ if(cells == null)
+ {
+ cells = new TableCellCollection(this);
+ }
+ return cells;
+ }
+ }
+
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ object o = ViewState["HorizontalAlign"];
+ if(o != null)
+ return (HorizontalAlign)o;
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ ViewState["HorizontalAlign"] = value;
+ }
+ }
+
+ public virtual VerticalAlign VerticalAlign
+ {
+ get
+ {
+ object o = ViewState["VerticalAlign"];
+ if(o != null)
+ return (VerticalAlign)o;
+ return VerticalAlign.NotSet;
+ }
+ set
+ {
+ ViewState["VerticalAlign"] = value;
+ }
+ }
+
+ protected override Style CreateControlStyle()
+ {
+ return new TableItemStyle(ViewState);
+ }
+
+ protected override ControlCollection CreateControlCollection()
+ {
+ return new CellControlCollection(this);
+ }
+
+ class CellControlCollection: ControlCollection
+ {
+ public CellControlCollection(Control owner): base(owner)
+ {
+ }
+
+ public override void Add(Control child)
+ {
+ if(child is TableCell)
+ {
+ base.Add(child);
+ } else
+ {
+ throw new ArgumentException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type", "TableRow", GetType().Name.ToString()));
+ }
+ }
+
+ public override void AddAt(int index, Control child)
+ {
+ if(child is TableCell)
+ {
+ base.AddAt(index, child);
+ } else
+ {
+ throw new ArgumentException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type", "TableRow", GetType().Name.ToString()));
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs
new file mode 100644
index 00000000000..b2db6123249
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableRowCollection.cs
@@ -0,0 +1,179 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableRowCollection
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Collections;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public sealed class TableRowCollection: IList, ICollection, IEnumerable
+ {
+ Table owner;
+
+ internal TableRowCollection(Table owner)
+ {
+ if(owner == null)
+ {
+ throw new ArgumentNullException();
+ }
+ this.owner = owner;
+ }
+
+ public int Count
+ {
+ get
+ {
+ return owner.Controls.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public TableRow this[int index]
+ {
+ get
+ {
+ return (TableRow)owner.Controls[index];
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ public int Add(TableRow row)
+ {
+ AddAt(-1, row);
+ return owner.Controls.Count;
+ }
+
+ public void AddAt(int index, TableRow row)
+ {
+ owner.Controls.AddAt(index, row);
+ }
+
+ public void AddRange(TableRow[] rows)
+ {
+ foreach(TableRow row in rows)
+ {
+ Add(row);
+ }
+ }
+
+ public void Clear()
+ {
+ if(owner.HasControls())
+ {
+ owner.Controls.Clear();
+ }
+ }
+
+ public void CopyTo(Array array, int index)
+ {
+ foreach(object current in this)
+ {
+ array.SetValue(current, index++);
+ }
+ }
+
+ public int GetRowIndex(TableRow row)
+ {
+ if(!owner.HasControls())
+ {
+ return -1;
+ }
+ return owner.Controls.IndexOf(row);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return owner.Controls.GetEnumerator();
+ }
+
+ public void Remove(TableRow row)
+ {
+ owner.Controls.Remove(row);
+ }
+
+ public void RemoveAt(int index)
+ {
+ owner.Controls.RemoveAt(index);
+ }
+
+ int IList.Add(object o)
+ {
+ return Add((TableRow)o);
+ }
+
+ bool IList.Contains(object o)
+ {
+ return owner.Controls.Contains((TableRow)o);
+ }
+
+ int IList.IndexOf(object o)
+ {
+ return owner.Controls.IndexOf((TableRow)o);
+ }
+
+ void IList.Insert(int index, object o)
+ {
+ owner.Controls.AddAt(index, (TableRow)o);
+ }
+
+ void IList.Remove(object o)
+ {
+ owner.Controls.Remove((TableRow)o);
+ }
+
+ bool IList.IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object IList.this[int index]
+ {
+ get
+ {
+ return this[index];
+ }
+ set
+ {
+ RemoveAt(index);
+ AddAt(index, (TableRow)value);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs
new file mode 100644
index 00000000000..bde5813d45b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TableStyle.cs
@@ -0,0 +1,229 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TableStyle
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TableStyle : Style
+ {
+ private static int IMAGE_URL = (0x01 << 16);
+ private static int CELL_PADD = (0x01 << 17);
+ private static int CELL_SPAC = (0x01 << 18);
+ private static int GRID_LINE = (0x01 << 19);
+ private static int HOR_ALIGN = (0x01 << 20);
+
+ public TableStyle(): base()
+ {
+ }
+
+ public TableStyle(StateBag bag): base(bag)
+ {
+ }
+
+ public virtual string BackImageUrl
+ {
+ get
+ {
+ if(IsSet(IMAGE_URL))
+ return (string)(ViewState["BackImageUrl"]);
+ return String.Empty;
+ }
+ set
+ {
+ if(value == null)
+ throw new ArgumentNullException("BackImageUrl");
+ ViewState["BackImageUrl"] = value;
+ Set(IMAGE_URL);
+ }
+ }
+
+ public virtual int CellPadding
+ {
+ get
+ {
+ if(IsSet(CELL_PADD))
+ return (int)(ViewState["CellPadding"]);
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException("CellPadding");
+ ViewState["CellPadding"] = value;
+ Set(CELL_PADD);
+ }
+ }
+
+ public virtual int CellSpacing
+ {
+ get
+ {
+ if(IsSet(CELL_SPAC))
+ return (int)(ViewState["CellSpacing"]);
+ return -1;
+ }
+ set
+ {
+ if(value < -1)
+ throw new ArgumentOutOfRangeException("CellSpacing");
+ ViewState["CellSpacing"] = value;
+ Set(CELL_SPAC);
+ }
+ }
+
+ public virtual GridLines GridLines
+ {
+ get
+ {
+ if(IsSet(GRID_LINE))
+ return (GridLines)(ViewState["GridLines"]);
+ return GridLines.Both;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(GridLines), value))
+ throw new ArgumentException();
+ ViewState["GridLines"] = value;
+ Set(GRID_LINE);
+ }
+ }
+
+ public virtual HorizontalAlign HorizontalAlign
+ {
+ get
+ {
+ if(IsSet(HOR_ALIGN))
+ return (HorizontalAlign)(ViewState["HorizontalAlign"]);
+ return HorizontalAlign.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(HorizontalAlign), value))
+ throw new ArgumentException();
+ ViewState["HorizontalAlign"] = value;
+ Set(HOR_ALIGN);
+ }
+ }
+
+ public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
+ {
+ base.AddAttributesToRender(writer, owner);
+ if(BackImageUrl.Length > 0)
+ {
+ writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, "url(" + owner.ResolveUrl(BackImageUrl) + ")");
+ }
+ if(CellSpacing >= 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, CellSpacing.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ if(CellPadding >= 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, CellPadding.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ if(HorizontalAlign != HorizontalAlign.NotSet)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(HorizontalAlign), HorizontalAlign, "G"));
+ }
+ string gd = "";
+ switch(GridLines)
+ {
+ case GridLines.None: gd = "";
+ break;
+ case GridLines.Horizontal: gd = "cols";
+ break;
+ case GridLines.Vertical: gd = "rows";
+ break;
+ case GridLines.Both: gd = "all";
+ break;
+ }
+ writer.AddAttribute(HtmlTextWriterAttribute.Rules, gd);
+ }
+
+ public override void CopyFrom(Style s)
+ {
+ if(s != null && s is TableStyle && !s.IsEmpty)
+ {
+ base.CopyFrom(s);
+ TableStyle from = (TableStyle)s;
+ if(from.IsSet(HOR_ALIGN))
+ {
+ HorizontalAlign = from.HorizontalAlign;
+ }
+ if(from.IsSet(IMAGE_URL))
+ {
+ BackImageUrl = from.BackImageUrl;
+ }
+ if(from.IsSet(CELL_PADD))
+ {
+ CellPadding = from.CellPadding;
+ }
+ if(from.IsSet(CELL_SPAC))
+ {
+ CellSpacing = from.CellSpacing;
+ }
+ if(from.IsSet(GRID_LINE))
+ {
+ GridLines = from.GridLines;
+ }
+ }
+ }
+
+ public override void MergeWith(Style s)
+ {
+ if(s != null && s is TableStyle && !s.IsEmpty)
+ {
+ base.MergeWith(s);
+ TableStyle with = (TableStyle)s;
+ if(with.IsSet(HOR_ALIGN) && IsSet(HOR_ALIGN))
+ {
+ HorizontalAlign = with.HorizontalAlign;
+ }
+ if(with.IsSet(IMAGE_URL) && IsSet(IMAGE_URL))
+ {
+ BackImageUrl = with.BackImageUrl;
+ }
+ if(with.IsSet(CELL_PADD) && IsSet(CELL_PADD))
+ {
+ CellPadding = with.CellPadding;
+ }
+ if(with.IsSet(CELL_SPAC) && IsSet(CELL_SPAC))
+ {
+ CellSpacing = with.CellSpacing;
+ }
+ if(with.IsSet(GRID_LINE) && IsSet(GRID_LINE))
+ {
+ GridLines = with.GridLines;
+ }
+ }
+ }
+
+ public override void Reset()
+ {
+ if(IsSet(IMAGE_URL))
+ ViewState.Remove("BackImageUrl");
+ if(IsSet(HOR_ALIGN))
+ ViewState.Remove("HorizontalAlign");
+ if(IsSet(CELL_PADD))
+ ViewState.Remove("CellPadding");
+ if(IsSet(CELL_SPAC))
+ ViewState.Remove("CellSpacing");
+ if(IsSet(GRID_LINE))
+ ViewState.Remove("GridLines");
+ base.Reset();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs
new file mode 100644
index 00000000000..409dd35a9c0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TargetConverter.cs
@@ -0,0 +1,55 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TargetConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TargetConverter : StringConverter
+ {
+ private StandardValuesCollection standardValues;
+ private string[] values = {
+ "_parent",
+ "_self",
+ "_blank",
+ "_search",
+ "_top"
+ };
+
+ public TargetConverter(): base()
+ {
+ }
+
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ if(standardValues == null)
+ {
+ standardValues = new StandardValuesCollection(values);
+ }
+ return standardValues;
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs
new file mode 100644
index 00000000000..b64b42bde50
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TemplateColumn.cs
@@ -0,0 +1,109 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TemplateColumn
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TemplateColumn : DataGridColumn
+ {
+ private ITemplate editItemTemplate;
+ private ITemplate footerTemplate;
+ private ITemplate headerTemplate;
+ private ITemplate itemTemplate;
+
+ public TemplateColumn(): base()
+ {
+ }
+
+ public virtual ITemplate EditItemTemplate
+ {
+ get
+ {
+ return editItemTemplate;
+ }
+ set
+ {
+ editItemTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual ITemplate FooterTemplate
+ {
+ get
+ {
+ return footerTemplate;
+ }
+ set
+ {
+ footerTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual ITemplate HeaderTemplate
+ {
+ get
+ {
+ return headerTemplate;
+ }
+ set
+ {
+ headerTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ public virtual ITemplate ItemTemplate
+ {
+ get
+ {
+ return itemTemplate;
+ }
+ set
+ {
+ itemTemplate = value;
+ OnColumnChanged();
+ }
+ }
+
+ public override void InitializeCell(TableCell cell, int columnIndex, ListItemType itemType)
+ {
+ base.InitializeCell(cell, columnIndex, itemType);
+ ITemplate toRender = null;
+ switch(itemType)
+ {
+ case ListItemType.Header: toRender = headerTemplate;
+ break;
+ case ListItemType.Footer: toRender = footerTemplate;
+ break;
+ case ListItemType.Item: toRender = itemTemplate;
+ break;
+ case ListItemType.AlternatingItem: toRender = itemTemplate;
+ break;
+ case ListItemType.SelectedItem: toRender = editItemTemplate;
+ break;
+ default: toRender = editItemTemplate;
+ break;
+ }
+ if(toRender != null)
+ {
+ cell.Text = String.Empty;
+ toRender.InstantiateIn(cell);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs
new file mode 100755
index 00000000000..906bb73badd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextAlign.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: TextAlign
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum TextAlign
+ {
+ Left = 1,
+ Right
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs
new file mode 100644
index 00000000000..521cad1cbca
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs
@@ -0,0 +1,284 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TextBox
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 80%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Collections.Specialized;
+using System.Globalization;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TextBox : WebControl, IPostBackDataHandler
+ {
+ private static readonly object TextChangedEvent = new object();
+
+ public TextBox(): base(HtmlTextWriterTag.Input)
+ {
+ }
+
+ public virtual bool AutoPostBack
+ {
+ get
+ {
+ object o = ViewState["AutoPostBack"];
+ if(o!=null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["AutoPostBack"] = value;
+ }
+ }
+
+ public virtual int Columns
+ {
+ get
+ {
+ object o = ViewState["Columns"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ ViewState["Columns"] = value;
+ }
+ }
+
+ public virtual int MaxLength
+ {
+ get
+ {
+ object o = ViewState["MaxLrngth"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ ViewState["MaxLrngth"] = value;
+ }
+ }
+
+ public virtual bool ReadOnly
+ {
+ get
+ {
+ object o = ViewState["ReadOnly"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ReadOnly"] = value;
+ }
+ }
+
+ public virtual int Rows
+ {
+ get
+ {
+ object o = ViewState["Rows"];
+ if(o != null)
+ return (int)o;
+ return 0;
+ }
+ set
+ {
+ ViewState["Rows"] = value;
+ }
+ }
+
+ public virtual string Text
+ {
+ get
+ {
+ object o = ViewState["Text"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["Text"] = value;
+ }
+ }
+
+ public virtual TextBoxMode TextMode
+ {
+ get
+ {
+ object o = ViewState["TextMode"];
+ if(o != null)
+ return (TextBoxMode)o;
+ return TextBoxMode.SingleLine;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(TextBoxMode), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["TextMode"] = value;
+ }
+ }
+
+ public virtual bool Wrap
+ {
+ get
+ {
+ object o = ViewState["Wrap"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["Wrap"] = value;
+ }
+ }
+
+ public event EventHandler TextChanged
+ {
+ add
+ {
+ Events.AddHandler(TextChangedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(TextChangedEvent, value);
+ }
+ }
+
+ protected override HtmlTextWriterTag TagKey
+ {
+ get
+ {
+ if(TextMode == TextBoxMode.MultiLine)
+ {
+ return HtmlTextWriterTag.Textarea;
+ }
+ return HtmlTextWriterTag.Input;
+ }
+ }
+
+ [MonoTODO("Check_Value_of_Text_Potential_Bug_In_MS_Implementation")]
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ if(Page != null)
+ {
+ Page.VerifyRenderingInServerForm(this);
+ }
+ writer.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID);
+ if(TextMode == TextBoxMode.MultiLine)
+ {
+ if(Rows > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Rows, Rows.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ if(Columns > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Cols, Columns.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ if(!Wrap)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Wrap, "off");
+ }
+ } else
+ {
+ if(TextMode == TextBoxMode.Password)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Type, "password");
+ } else
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
+ }
+ if(MaxLength > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Maxlength, MaxLength.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ if(Columns > 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Size, Columns.ToString(NumberFormatInfo.InvariantInfo));
+ }
+ }
+
+ writer.AddAttribute(HtmlTextWriterAttribute.Value, Text);
+ if(ReadOnly)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.ReadOnly, "readonly");
+ }
+ base.AddAttributesToRender(writer);
+
+ if(AutoPostBack && Page != null)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Onchange, Page.GetPostBackClientEvent(this, ""));
+ writer.AddAttribute("language", "javascript");
+ }
+ }
+
+ protected override void AddParsedSubObject(object obj)
+ {
+ if(obj is LiteralControl)
+ {
+ Text = ((LiteralControl)obj).Text;
+ return;
+ }
+ throw new HttpException(HttpRuntime.FormatResourceString("Cannot_Have_Children_Of_Type", "TextBox", GetType().Name.ToString()));
+ }
+
+ [MonoTODO("OnPreRender")]
+ protected override void OnPreRender(EventArgs e)
+ {
+ OnPreRender(e);
+ throw new NotImplementedException();
+ }
+
+ protected virtual void OnTextChanged(EventArgs e)
+ {
+ if(Events != null)
+ {
+ EventHandler eh = (EventHandler)(Events[TextChangedEvent]);
+ if(eh != null)
+ eh(this, e);
+ }
+ }
+
+ [MonoTODO("Encode_Text")]
+ protected override void Render(HtmlTextWriter writer)
+ {
+ RenderBeginTag(writer);
+ //TODO: if(TextMode == MultiLine) { Encode(Text) and writeTo(writer) }
+ RenderEndTag(writer);
+ throw new NotImplementedException();
+ }
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ if(postCollection[postDataKey] != Text)
+ {
+ Text = postCollection[postDataKey];
+ return true;
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent()
+ {
+ OnTextChanged(EventArgs.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs
new file mode 100644
index 00000000000..7c26db6eaf3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxControlBuilder.cs
@@ -0,0 +1,36 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: TextBoxControlBuilder
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class TextBoxControlBuilder : ControlBuilder
+ {
+ public TextBoxControlBuilder(): base()
+ {
+ }
+
+ public override bool AllowWhitespaceLiterals()
+ {
+ return false;
+ }
+
+ public override bool HtmlDecodeLiterals()
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs
new file mode 100755
index 00000000000..47b903ec0f2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TextBoxMode.cs
@@ -0,0 +1,22 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: TextBoxMode
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum TextBoxMode
+ {
+ SingleLine,
+ MultiLine,
+ Password
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs b/mcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs
new file mode 100755
index 00000000000..3cfb9a42f42
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/TitleFormat.cs
@@ -0,0 +1,21 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: TitleFormat
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum TitleFormat
+ {
+ Month,
+ MonthYear
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs
new file mode 100644
index 00000000000..a8574945070
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Unit.cs
@@ -0,0 +1,258 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Struct: Unit
+ *
+ * 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)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public struct Unit
+ {
+ public static readonly Unit Empty = new Unit();
+
+ private static int Min = -32768;
+ private static int Max = +32767;
+
+ private UnitType type;
+ private double val;
+
+ public static Unit Parse(string s)
+ {
+ return new Unit(s);
+ }
+
+ public static Unit Parse(string s, CultureInfo culture)
+ {
+ return new Unit(s, culture);
+ }
+
+ public static Unit Percentage(double n)
+ {
+ return new Unit(n);
+ }
+
+ public static Unit Pixel(int n)
+ {
+ return new Unit(n);
+ }
+
+ public static Unit Point(int n)
+ {
+ return new Unit(n, UnitType.Point);
+ }
+
+ public static bool operator ==(Unit left, Unit right)
+ {
+ return (left.type == right.type && left.val == right.val);
+ }
+
+ public static bool operator !=(Unit left, Unit right)
+ {
+ return !(left == right);
+ }
+
+ public static implicit operator Unit(int n)
+ {
+ return new Unit(n);
+ }
+
+ public Unit(double value)
+ {
+ if(value < Min || value > Max)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ val = value;
+ type = UnitType.Pixel;
+ }
+
+ public Unit(int value)
+ {
+ if(value < Min || value > Max)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ val = value;
+ type = UnitType.Pixel;
+ }
+
+ public Unit(string value): this(value, CultureInfo.CurrentCulture)
+ {
+ }
+
+ public Unit(double value, UnitType type)
+ {
+ if(value < Min || value > Max)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ val = value;
+ this.type = type;
+ }
+
+ public Unit(string value, CultureInfo culture): this(value, culture, UnitType.Pixel)
+ {
+ }
+
+ internal Unit(string value, CultureInfo culture, UnitType defType)
+ {
+ this.val = 0;
+ this.type = UnitType.Pixel;
+ if(value == null || value.Length == 0)
+ {
+ this.val = 0;
+ this.type = UnitType.Pixel;
+ }
+ if(culture == null)
+ culture = CultureInfo.CurrentCulture;
+ string strVal = value.Trim().ToLower();
+ char c;
+ int start = -1;
+ //int current = 0;
+ for(int i = 0; i < strVal.Length; i++)
+ {
+ c = strVal[i];
+ if( (c >= '0' && c <= '9') || (c == '-' || c == '.' || c == ',') )
+ start = i;
+ }
+ if(start == -1)
+ throw new ArgumentException();
+ if( (start + 1) < strVal.Length)
+ {
+ this.type = (UnitType)GetTypeFromString(strVal.Substring(start + 1).Trim());
+ this.val = 0;
+ } else
+ {
+ this.type = defType;
+ this.val = 0;
+ }
+ try
+ {
+ if(type == UnitType.Pixel)
+ {
+ val = (double)((new Int32Converter()).ConvertFromString(null, culture, strVal.Substring(0, start + 1)));
+ } else
+ {
+ val = (double)((new SingleConverter()).ConvertFromString(null, culture, strVal.Substring(0, start + 1)));
+ }
+ } catch(Exception)
+ {
+ throw new ArgumentOutOfRangeException();
+ }
+ if(val < Min || val > Max)
+ throw new ArgumentOutOfRangeException();
+ }
+
+ private UnitType GetTypeFromString(string s)
+ {
+ if(s == null || s.Length == 0)
+ return UnitType.Pixel;
+ s = s.ToLower().Trim();
+ string[] uTypes = {
+ "px",
+ "pt",
+ "pc",
+ "in",
+ "mm",
+ "cm",
+ "%",
+ "em",
+ "ex"
+ };
+ int i = 0;
+ foreach(string cType in uTypes)
+ {
+ if(s == cType)
+ return (UnitType)Enum.ToObject(typeof(UnitType), (i + 1));
+ i++;
+ }
+ return UnitType.Pixel;
+ }
+
+ private string GetStringFromPixel(UnitType ut)
+ {
+ string[] uTypes = {
+ "px",
+ "pt",
+ "pc",
+ "in",
+ "mm",
+ "cm",
+ "%",
+ "em",
+ "ex"
+ };
+ if( !Enum.IsDefined(typeof(UnitType), ut) )
+ return "px";
+ return uTypes[(int)ut - 1];
+ }
+
+ public bool IsEmpty
+ {
+ get
+ {
+ return (type == 0);
+ }
+ }
+
+ public UnitType Type
+ {
+ get
+ {
+ if(IsEmpty)
+ return UnitType.Pixel;
+ return type;
+ }
+ }
+
+ public double Value
+ {
+ get
+ {
+ return val;
+ }
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj != null && obj is Unit)
+ {
+ Unit that = (Unit)obj;
+ return ( this.type == that.type && this.val == that.val );
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return ( (type.GetHashCode() << 2) | (val.GetHashCode()) );
+ }
+
+ public override string ToString()
+ {
+ if(IsEmpty)
+ return String.Empty;
+ return ( val.ToString() + GetStringFromPixel(type) );
+ }
+
+ public string ToString(CultureInfo culture)
+ {
+ if(IsEmpty)
+ return String.Empty;
+ return ( val.ToString(culture) + GetStringFromPixel(type) );
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs
new file mode 100644
index 00000000000..b3320bb39ce
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/UnitConverter.cs
@@ -0,0 +1,65 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: UnitConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class UnitConverter : TypeConverter
+ {
+ public UnitConverter(): base()
+ {
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ if(sourceType == typeof(string))
+ return true;
+ return CanConvertFrom(context, sourceType);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if(value == null)
+ return null;
+ if(value is string)
+ {
+ string val = ((string)value).Trim();
+ if(val.Length == 0)
+ {
+ return Unit.Empty;
+ }
+ return (culture == null ? Unit.Parse(val) : Unit.Parse(val, culture));
+ }
+ return ConvertFrom(context, culture, value);
+ }
+
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if(destinationType == typeof(string))
+ {
+ Unit val = (Unit)value;
+ if(val == Unit.Empty)
+ {
+ return String.Empty;
+ }
+ return val.ToString(culture);
+ }
+ return ConvertTo(context, culture, value, destinationType);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs
new file mode 100755
index 00000000000..285c1cc7195
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/UnitType.cs
@@ -0,0 +1,28 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: UnitType
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum UnitType
+ {
+ Pixel = 1,
+ Point,
+ Pica,
+ Inch,
+ Mm,
+ Cm,
+ Percentage,
+ Em,
+ Ex
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs
new file mode 100644
index 00000000000..883154a7429
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatedControlConverter.cs
@@ -0,0 +1,76 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ValidatedControlConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ValidatedControlConverter : StringConverter
+ {
+ public ValidatedControlConverter(): base()
+ {
+ }
+
+ private object[] GetValues(IContainer container)
+ {
+ ArrayList values = new ArrayList();
+ IEnumerator ie = container.Components.GetEnumerator();
+ try
+ {
+ foreach(IComponent current in container.Components)
+ {
+ Control ctrl = (Control)current;
+ if(ctrl == null || ctrl.ID == null || ctrl.ID.Length == 0)
+ continue;
+ ValidationPropertyAttribute attrib = (ValidationPropertyAttribute)((TypeDescriptor.GetAttributes(ctrl))[typeof(ValidationPropertyAttribute)]);
+ if(attrib == null || attrib.Name == null)
+ continue;
+ values.Add(String.Copy(ctrl.ID));
+ }
+ }finally
+ {
+ if(ie is IDisposable)
+ ((IDisposable)ie).Dispose();
+ }
+ values.Sort();
+ return values.ToArray();
+ }
+
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ if(context != null && context.Container != null)
+ {
+ object[] values = GetValues(context.Container);
+ if(values != null)
+ {
+ return new StandardValuesCollection(values);
+ }
+ }
+ return null;
+ }
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+ {
+ return false;
+ }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs
new file mode 100755
index 00000000000..a752aa1df5d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationCompareOperator.cs
@@ -0,0 +1,26 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidationCompareOperator
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidationCompareOperator
+ {
+ Equal,
+ NotEqual,
+ GreaterThan,
+ GreaterThanEqual,
+ LessThan,
+ LessThanEqual,
+ DataTypeCheck
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs
new file mode 100755
index 00000000000..227133269e1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationDataType.cs
@@ -0,0 +1,24 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidationDataType
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidationDataType
+ {
+ String,
+ Integer,
+ Double,
+ Date,
+ Currency
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs
new file mode 100644
index 00000000000..a90ce3f20fe
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummary.cs
@@ -0,0 +1,142 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: ValidationSummary
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class ValidationSummary : WebControl
+ {
+ private bool uplevelRender;
+
+ public ValidationSummary(): base(HtmlTextWriterTag.Div)
+ {
+ uplevelRender = false;
+ ForeColor = Color.Red;
+ }
+
+ public ValidationSummaryDisplayMode DisplayMode
+ {
+ get
+ {
+ object o = ViewState["DisplayMode"];
+ if(o != null)
+ return (ValidationSummaryDisplayMode)o;
+ return ValidationSummaryDisplayMode.BulletList;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(ValidationSummaryDisplayMode), value))
+ throw new ArgumentException();
+ ViewState["DisplayMode"] = value;
+ }
+ }
+
+ public bool EnableClientScript
+ {
+ get
+ {
+ object o = ViewState["EnableClientScript"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["EnableClientScript"] = value;
+ }
+ }
+
+ public override Color ForeColor
+ {
+ get
+ {
+ return ForeColor;
+ }
+ set
+ {
+ ForeColor = value;
+ }
+ }
+
+ public bool ShowMessageBox
+ {
+ get
+ {
+ object o = ViewState["ShowMessageBox"];
+ if(o != null)
+ return (bool)o;
+ return false;
+ }
+ set
+ {
+ ViewState["ShowMessageBox"] = value;
+ }
+ }
+
+ public bool ShowSummary
+ {
+ get
+ {
+ object o = ViewState["ShowSummary"];
+ if(o != null)
+ return (bool)o;
+ return true;
+ }
+ set
+ {
+ ViewState["ShowSummary"] = value;
+ }
+ }
+
+ public string HeaderText
+ {
+ get
+ {
+ object o = ViewState["HeaderText"];
+ if(o != null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["HeaderText"] = value;
+ }
+ }
+
+ [MonoTODO("FIXME_See_Comments")]
+ protected override void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ AddAttributesToRender(writer);
+ if(uplevelRender)
+ {
+ //FIXME: This is not the case always. I forgot the case when it is absent.
+ // something to do with the ID's value? or ClienID's value itself?
+ writer.AddAttribute("id", ClientID);
+ if(HeaderText.Length > 0)
+ writer.AddAttribute("headertext", HeaderText, true);
+ if(ShowMessageBox)
+ writer.AddAttribute("showmessagebox", "True");
+ if(!ShowSummary)
+ writer.AddAttribute("showsummary", "False");
+ if(DisplayMode != ValidationSummaryDisplayMode.BulletList)
+ {
+ writer.AddAttribute("displaymode", PropertyConverter.EnumToString(typeof(ValidationSummaryDisplayMode), DisplayMode));
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs
new file mode 100755
index 00000000000..c3cf718395c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidationSummaryDisplayMode.cs
@@ -0,0 +1,22 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidationSummaryDisplayMode
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidationSummaryDisplayMode
+ {
+ List,
+ BulletList,
+ SingleParagraph
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs
new file mode 100755
index 00000000000..48086af18bc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/ValidatorDisplay.cs
@@ -0,0 +1,22 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: ValidatorDisplay
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum ValidatorDisplay
+ {
+ None,
+ Static,
+ Dynamic
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs b/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs
new file mode 100755
index 00000000000..a115544e98c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/VerticalAlign.cs
@@ -0,0 +1,23 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Enumeration: VerticalAlign
+ *
+ * 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)
+ */
+
+namespace System.Web.UI.WebControls
+{
+ public enum VerticalAlign
+ {
+ NotSet,
+ Top,
+ Middle,
+ Bottom
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs b/mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs
new file mode 100644
index 00000000000..127633c390a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/WebColorConverter.cs
@@ -0,0 +1,57 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: WebColorConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Globalization;
+using System.ComponentModel;
+using System.Drawing;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ public class WebColorConverter : ColorConverter
+ {
+ public WebColorConverter(): base()
+ {
+ }
+
+ [MonoTODO("Implement_If_Color_Is_#xxxxxx_OR_A_KnownColor")]
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ if(value is string)
+ {
+ string val = ((string)value).Trim();
+ if(val == String.Empty || val.Length == 0)
+ {
+ return Color.Empty;
+ }
+ if(val[0] == '#')
+ {
+ throw new NotImplementedException();
+ }
+ }
+ return ConvertFrom(context, culture, value);
+ }
+
+ [MonoTODO("Convert_To_For_KnownColor_And_For_#xxxxxx")]
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if(destinationType == null)
+ {
+ throw new ArgumentNullException("destinationType");
+ }
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs b/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
new file mode 100755
index 00000000000..768e2a635d7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/WebControl.cs
@@ -0,0 +1,489 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: WebControl
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 40%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+using System.Drawing;
+using System.Collections.Specialized;
+
+namespace System.Web.UI.WebControls
+{
+ public class WebControl : Control, IAttributeAccessor
+ {
+ //TODO: A list of private members may be incomplete
+
+ private HtmlTextWriterTag tagKey;
+ private string stringTag;
+ private AttributeCollection attributes;
+ private StateBag attributeState;
+ private Style controlStyle;
+ private bool enabled;
+ private string tagName;
+
+ // TODO: The constructors definitions
+ protected WebControl(): base()
+ {
+ //todo: what now? To be rendered as SPAN tag!
+ Initialize();
+ }
+
+ public WebControl(HtmlTextWriterTag tag): base()
+ {
+ //FIXME: am i right?
+ tagKey = tag;
+ //stringTag = null;
+ Initialize();
+ }
+
+ protected WebControl(string tag): base()
+ {
+ //FIXME: am i right?
+ stringTag = tag;
+ Initialize();
+ }
+
+ private void Initialize()
+ {
+ controlStyle = null;
+ enabled = true;
+ tagName = null;
+ attributeState = null;
+ }
+
+ public virtual string AccessKey
+ {
+ get
+ {
+ object o = ViewState["AccessKey"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["AccessKey"] = value;
+ }
+ }
+
+ [MonoTODO("FIXME_Internal_method_calls")]
+ public AttributeCollection Attributes
+ {
+ get
+ {
+ throw new NotImplementedException();
+ if(attributes==null)
+ {
+ //FIXME: From where to get StateBag and how? I think this method is OK!
+ if(attributeState == null)
+ {
+ attributeState = new StateBag(true);
+ //FIXME: Uncomment the following in the final release
+ // commented because of the assembly problem.
+ //The function TrackViewState() is internal
+ /*
+ if(IsTrackingViewState)
+ {
+ attributeState.TrackViewState();
+ }
+ */
+ }
+ attributes = new AttributeCollection(attributeState);
+ }
+ return attributes;
+ }
+ }
+
+ public virtual Color BackColor
+ {
+ get
+ {
+ object o = ViewState["BackColor"];
+ if(o != null)
+ {
+ return (Color)o;
+ }
+ return Color.Empty;
+ }
+ set
+ {
+ ViewState["BackColor"] = value;
+ }
+ }
+
+ public virtual Color BorderColor
+ {
+ get
+ {
+ object o = ViewState["BorderColor"];
+ if(o != null)
+ {
+ return (Color)o;
+ }
+ return Color.Empty;
+ }
+ set
+ {
+ ViewState["BorderColor"] = value;
+ }
+ }
+
+ [MonoTODO("FIXME_Internal_method_calls")]
+ public virtual BorderStyle BorderStyle
+ {
+ get
+ {
+ object o = ViewState["BorderStyle"];
+ if(o != null)
+ {
+ return (BorderStyle)o;
+ }
+ return BorderStyle.NotSet;
+ }
+ set
+ {
+ if(!Enum.IsDefined(typeof(BorderStyle), value))
+ {
+ throw new ArgumentException();
+ }
+ ViewState["BorderStyle"] = value;
+ }
+ }
+
+ public virtual Unit BorderWidth
+ {
+ get
+ {
+ object o = ViewState["BorderWidth"];
+ if(o != null)
+ {
+ return (Unit)o;
+ }
+ return Unit.Empty;
+ }
+ set
+ {
+ if(value.Value < 0)
+ {
+ throw new ArgumentException();
+ }
+ ViewState["BorderWidth"] = value;
+ }
+ }
+
+ [MonoTODO("FIXME_Internal_method_calls")]
+ public virtual Style ControlStyle
+ {
+ get
+ {
+ if(controlStyle == null)
+ {
+ controlStyle = CreateControlStyle();
+ //FIXME: Uncomment the following in the final release
+ // commented because of the assembly problem.
+ //The functions TrackViewState() and LoadViewState() are internal
+ /*
+ if(IsTrackingViewState)
+ {
+ controlStyle.TrackViewState();
+ }
+ controlStyle.LoadViewState(null);
+ */
+ }
+ return controlStyle;
+ }
+ }
+
+ public bool ControlStyleCreated
+ {
+ get
+ {
+ return (controlStyle!=null);
+ }
+ }
+
+ public virtual string CssClass
+ {
+ get
+ {
+ return ControlStyle.CssClass;
+ }
+ set
+ {
+ ControlStyle.CssClass = value;
+ }
+ }
+
+ public virtual bool Enabled
+ {
+ get
+ {
+ return enabled;
+ }
+ set
+ {
+ enabled = value;
+ }
+ }
+
+ public virtual FontInfo Font
+ {
+ get
+ {
+ return ControlStyle.Font;
+ }
+ }
+
+ public virtual Color ForeColor
+ {
+ get
+ {
+ return ControlStyle.ForeColor;
+ }
+ set
+ {
+ ControlStyle.ForeColor = value;
+ }
+ }
+
+ public virtual Unit Height
+ {
+ get
+ {
+ return ControlStyle.Height;
+ }
+ set
+ {
+ ControlStyle.Height = value;
+ }
+ }
+
+ public CssStyleCollection Style
+ {
+ get
+ {
+ return Attributes.CssStyle;
+ }
+ }
+
+ public virtual short TabIndex
+ {
+ get
+ {
+ object o = ViewState["TabIndex"];
+ if(o!=null)
+ return (short)o;
+ return 0;
+ }
+ set
+ {
+ if(value < -32768 || value > 32767)
+ throw new ArgumentException();
+ ViewState["TabIndex"] = value;
+ }
+ }
+
+ public virtual string ToolTip
+ {
+ get
+ {
+ object o = ViewState["ToolTip"];
+ if(o!=null)
+ return (string)o;
+ return String.Empty;
+ }
+ set
+ {
+ ViewState["ToolTip"] = value;
+ }
+ }
+
+ public virtual Unit Width
+ {
+ get
+ {
+ return ControlStyle.Width;
+ }
+ set
+ {
+ ControlStyle.Width = value;
+ }
+ }
+
+ [MonoTODO("FIXME_Internal_method_calls")]
+ public void ApplyStyle(Style s)
+ {
+ /* FIXME: Again internal problem
+ if(!ControlStyle.IsEmpty)
+ {
+ */
+ ControlStyle.CopyFrom(s);
+ //}
+ }
+
+ [MonoTODO]
+ public void CopyBaseAttributes(WebControl controlSrc)
+ {
+ //TODO: tocopy
+ /*
+ * AccessKey, Enabled, ToolTip, TabIndex, Attributes
+ */
+ AccessKey = controlSrc.AccessKey;
+ Enabled = controlSrc.Enabled;
+ ToolTip = controlSrc.ToolTip;
+ TabIndex = controlSrc.TabIndex;
+ attributes = controlSrc.Attributes;
+ throw new NotImplementedException();
+ }
+
+ public void MergeStyle(Style s)
+ {
+ ControlStyle.MergeWith(s);
+ }
+
+ public virtual void RenderBeginTag(HtmlTextWriter writer)
+ {
+ AddAttributesToRender(writer);
+ if(Enum.IsDefined(typeof(HtmlTextWriterTag), TagKey) )
+ {
+ writer.RenderBeginTag(TagKey);
+ return;
+ }
+ writer.RenderBeginTag(tagName);
+ }
+
+ public virtual void RenderEndTag(HtmlTextWriter writer)
+ {
+ writer.RenderEndTag();
+ }
+
+ protected virtual HtmlTextWriterTag TagKey
+ {
+ get
+ {
+ return tagKey;
+ }
+ }
+
+ protected virtual string TagName
+ {
+ get
+ {
+ if(tagName==null && Enum.IsDefined(typeof(HtmlTextWriterTag), tagKey) )
+ {
+ tagName = Enum.Format(typeof(HtmlTextWriterTag), tagKey, "G").ToString();
+ }
+ return tagName;
+ }
+ }
+
+ protected virtual void AddAttributesToRender(HtmlTextWriter writer)
+ {
+ if(ID!=null)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
+ }
+ if(AccessKey.Length>0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey);
+ }
+ if(!Enabled)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled");
+ }
+ if(ToolTip.Length>0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Title, ToolTip);
+ }
+ if(TabIndex != 0)
+ {
+ writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString());
+ }
+ if(ControlStyleCreated)
+ {
+ if(!ControlStyle.IsEmpty)
+ {
+ ControlStyle.AddAttributesToRender(writer, this);
+ }
+ }
+ if(attributeState!=null)
+ {
+ IEnumerator ie = Attributes.Keys.GetEnumerator();
+ do
+ {
+ writer.AddAttribute((string)ie.Current, Attributes[(string)ie.Current]);
+ } while(ie.MoveNext());
+ }
+ }
+
+ protected virtual Style CreateControlStyle()
+ {
+ return new Style(ViewState);
+ }
+
+ [MonoTODO]
+ protected override void LoadViewState(object savedState)
+ {
+ throw new NotImplementedException();
+ //TODO: Load viewStates
+ /*
+ * May be will have to first look at Control::LoadViewState
+ */
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ RenderBeginTag(writer);
+ RenderContents(writer);
+ RenderEndTag(writer);
+ }
+
+ protected virtual void RenderContents(HtmlTextWriter writer)
+ {
+ base.Render(writer);
+ }
+
+ [MonoTODO]
+ protected override object SaveViewState()
+ {
+ throw new NotImplementedException();
+ //TODO: Implement me!
+ }
+
+ protected override void TrackViewState()
+ {
+ TrackViewState();
+ if(ControlStyleCreated)
+ {
+ ControlStyle.TrackViewState();
+ }
+ if(attributeState!=null)
+ {
+ attributeState.TrackViewState();
+ }
+ }
+
+ string IAttributeAccessor.GetAttribute(string key)
+ {
+ if(Attributes!=null)
+ return (string)Attributes[key];
+ return null;
+ }
+
+ void IAttributeAccessor.SetAttribute(string key, string value)
+ {
+ Attributes[key] = value;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs
new file mode 100644
index 00000000000..597f984e5d3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI.WebControls/Xml.cs
@@ -0,0 +1,203 @@
+/**
+ * Namespace: System.Web.UI.WebControls
+ * Class: Xml
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 75%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+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
+{
+ 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();
+ defaultTransform.Load(reader);
+ }
+
+ public Xml(): base()
+ {
+ }
+
+ [MonoTODO("Initialize_Document")]
+ private void LoadXmlDoc()
+ {
+ throw new NotImplementedException();
+ }
+
+ public XmlDocument Document
+ {
+ get
+ {
+ if(document == null)
+ LoadXmlDoc();
+ return document;
+ }
+ set
+ {
+ documentSource = null;
+ documentContent = null;
+ xpathDoc = null;
+ document = value;
+ }
+ }
+
+ public string DocumentContent
+ {
+ get
+ {
+ return String.Empty;
+ }
+ set
+ {
+ document = null;
+ xpathDoc = null;
+ documentContent = value;
+ }
+ }
+
+ public string DocumentSource
+ {
+ get
+ {
+ if(documentSource != null)
+ return documentSource;
+ return String.Empty;
+ }
+ set
+ {
+ document = null;
+ documentContent = null;
+ xpathDoc = null;
+ documentSource = value;
+ }
+ }
+
+ public XslTransform Transform
+ {
+ get
+ {
+ return transform;
+ }
+ set
+ {
+ transformSource = null;
+ transform = value;
+ }
+ }
+
+ public string TransformSource
+ {
+ get
+ {
+ if(transformSource != null)
+ return transformSource;
+ return String.Empty;
+ }
+ set
+ {
+ transform = null;
+ transformSource = value;
+ }
+ }
+
+ 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.ToString()));
+ }
+
+ [MonoTODO("Initialize_xpathDocument")]
+ private void LoadXpathDoc()
+ {
+ if(documentContent != null && documentContent.Length > 0)
+ {
+ xpathDoc = new XPathDocument(new StringReader(documentContent));
+ return;
+ }
+ if(documentSource == null || documentSource.Length == 0)
+ {
+ return;
+ }
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("Initialize_Transform")]
+ private void LoadTransform()
+ {
+ throw new ArgumentException();
+ }
+
+ [MonoTODO]
+ 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);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/BuildMethod.cs b/mcs/class/System.Web/System.Web.UI/BuildMethod.cs
new file mode 100644
index 00000000000..d06a4024166
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/BuildMethod.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.UI.BuildMethod.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public delegate Control BuildMethod();
+}
diff --git a/mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs b/mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs
new file mode 100644
index 00000000000..8d53ce41e2e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/BuildTemplateMethod.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.UI.BuildTemplateMethod.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public delegate void BuildTemplateMethod(Control control);
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog
new file mode 100644
index 00000000000..0d5f0c4471c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ChangeLog
@@ -0,0 +1,83 @@
+2002-03-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DataBindingHandlerAttribute.cs
+ - Completed
+ * ToolboxDataAttribute.cs - Completed
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * DesignTimeParseData.cs: initialze static member to avoid compile
+ error
+ * PropertyConverter.cs: remove uneeded exception variables from
+ catch blocks.
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * DesignTimeParseData.cs: fix header to show correct class name
+
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * StateBag.cs - Completed
+
+2001-12-19 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * Pair.cs - Small undocumented class. Completed.
+
+2001-12-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * DesignTimeParseData.cs - Initial implementation
+ * StateBag.cs - Initial implementation
+
+2001-12-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * PropertyConverter.cs - Undocumented class. Completed.
+ * Utils.cs - Undocumented, private class.
+ Initial implementation
+
+2001-08-28 Bob Smith <bob@thestuff.net>
+ * Control.cs: Figured out some undocumented API.
+ * Added TODO.
+ * BuildMethod.cs: Initial implementation.
+ * BuildTemplateMethod.cs: Initial implementation.
+ * HtmlTextWriterAttribute.cs: Initial implementation.
+ * HtmlTextWriterStyle.cs: Initial implementation.
+ * HtmlTextWriterTag.cs: Initial implementation.
+ * IAttributeAccessor.cs: Initial implementation.
+ * IDataBindingsAccessor.cs: Initial implementation.
+ * ImageClickEventHandler.cs: Initial implementation.
+ * INamingContainer.cs: Initial implementation.
+ * IParserAccessor.cs: Initial implementation.
+ * IPostBackDataHandler.cs: Initial implementation.
+ * IPostBackEventHandler.cs: Initial implementation.
+ * IStateManager.cs: Initial implementation.
+ * ITagNameToTypeMapper.cs: Initial implementation.
+ * ITemplate.cs: Initial implementation.
+ * IValidator.cs: Initial implementation.
+ * OutputCacheLocation.cs: Initial implementation.
+ * PersistanceMode.cs: Initial implementation.
+ * StateItem.cs: Initial implementation.
+
+2001-08-27 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: Bug fixes and implementations.
+
+2001-08-24 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: Bug fixes.
+
+2001-08-23 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: More implementation. Events reworked for performance.
+
+2001-08-22 Bob Smith <bob@thestuff.net>
+
+ * LiteralControl.cs: Implemented.
+ * Control.cs: Even more implementation (Events). What a beast.
+
+2001-08-20 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: More implementation. Not done yet. Shutter.
+
+2001-08-17 Bob Smith <bob@thestuff.net>
+
+ * Control.cs: Partial implementation.
diff --git a/mcs/class/System.Web/System.Web.UI/Control.cs b/mcs/class/System.Web/System.Web.UI/Control.cs
new file mode 100644
index 00000000000..70779b7cdaa
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Control.cs
@@ -0,0 +1,608 @@
+//
+// System.Web.UI.Control.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+/*
+ * Maintainer: bob@thestuff.net, gvaish@iitk.ac.in
+ * (C) Bob Smith, Gaurav Vaish
+ */
+
+//notes: view state only tracks changes after OnInit method is executed for the page request. You can read from it at any time, but cant write to it during rendering.
+//even more notes: view state info in trackviewstate method description. read later.
+//Ok, enough notes: what the heck is different between enable view state, and track view state.
+//Well, maybe not. How does the ViewState know when to track changes? Does it look at the property
+//on the owning control, or does it have a method/property of its own that gets called?
+// I think this last question is solved in the Interface for it. Look into this.
+
+//cycle:
+//init is called when control is first created.
+//load view state ic called right after init to populate the view state.
+//loadpostdata is called if ipostbackdatahandler is implemented.
+//load is called when control is loaded into a page
+//raisepostdatachangedevent if ipostbackdatahandler is implemented.
+//raisepostbackevent if ipostbackeventhandler is implemented.
+//prerender is called when the server is about to render its page object
+//SaveViewState is called.
+//Unload then dispose it apears. :)
+
+//Naming Container MUST have some methods. What are they? No clue. Help?
+
+//read this later. http://gotdotnet.com/quickstart/aspplus/
+//This to: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpconattributesdesign-timesupport.asp
+//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpcontracefunctionality.asp
+
+// Isnt life grand? :)
+// See the undocumented methods? Gota love um. ;)
+// ASP.test4_aspx.Page_Load(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.OnLoad(EventArgs e) +67
+// System.Web.UI.Control.LoadRecursive() +73
+// System.Web.UI.Page.ProcessRequestMain() +394
+
+// ASP.test4_aspx.Page_Unload(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.EventHandler.Invoke(Object sender, EventArgs e) +0
+// System.Web.UI.Control.OnUnload(EventArgs e) +67
+// System.Web.UI.Control.UnloadRecursive(Boolean dispose) +78
+// System.Web.UI.Page.ProcessRequest() +194
+// System.Web.UI.Page.ProcessRequest(HttpContext context) +18
+// System.Web.CallHandlerExecutionStep.Execute() +179
+// System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
+
+
+// ASP.test4_aspx.Page_Unload(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.OnUnload(EventArgs e) +67
+// System.Web.UI.Control.UnloadRecursive(Boolean dispose) +78
+// System.Web.UI.Page.ProcessRequest()
+
+// ASP.test4_aspx.Page_Kill(Object Sender, EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.OnPreRender(EventArgs e) +67
+// System.Web.UI.Control.PreRenderRecursiveInternal() +61
+// System.Web.UI.Page.ProcessRequestMain() +753
+
+// ASP.test4_aspx.OnInit(EventArgs e) in \\genfs2\www24\bobsmith11\test4.aspx:6
+// System.Web.UI.Control.InitRecursive(Control namingContainer) +202
+// System.Web.UI.Page.ProcessRequestMain() +120
+
+// ASP.test4_aspx.SaveViewState() in \\genfs2\www24\bobsmith11\test4.aspx:12
+// System.Web.UI.Control.SaveViewStateRecursive() +51
+// System.Web.UI.Page.SavePageViewState() +174
+// System.Web.UI.Page.ProcessRequestMain() +861
+
+// ASP.test_aspx.LoadViewState(Object t) +28
+// System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +125
+// System.Web.UI.Page.LoadPageViewState() +182
+// System.Web.UI.Page.ProcessRequestMain() +256
+
+using System;
+using System.Collections;
+using System.Web;
+using System.ComponentModel;
+
+namespace System.Web.UI
+{
+ public class Control : IComponent, IDisposable, IParserAccessor, IDataBindingsAccessor
+ {
+ private static readonly object DataBindingEvent = new object();
+ private static readonly object DisposedEvent = new object();
+ private static readonly object InitEvent = new object();
+ private static readonly object LoadEvent = new object();
+ private static readonly object PreRenderEvent = new object();
+ private static readonly object UnloadEvent = new object();
+ private string _userId = null;
+ private string _cachedUserId = null;
+ private string _cachedClientId = null;
+ private ControlCollection _controls = null;
+ private bool _enableViewState = true;
+ private IDictionary _childViewStates = null; //TODO: Not sure datatype. Placeholder guess.
+ private bool _isNamingContainer = false;
+ private Control _namingContainer = null;
+ private Page _page = null;
+ private Control _parent = null;
+ private ISite _site = null;
+ private bool _visible = true;
+ private HttpContext _context = null;
+ private bool _childControlsCreated = false;
+ private StateBag _viewState = null;
+ private bool _trackViewState = false;
+ private EventHandlerList _events = new EventHandlerList();
+ private RenderMethod _renderMethodDelegate = null;
+
+ private DataBindingCollection dataBindings = null;
+
+ public Control()
+ {
+ if (this is INamingContainer) _isNamingContainer = true;
+ }
+ public virtual string ClientID //DIT
+ {
+ get
+ {
+ if (_cachedUserId != null && _cachedClientId != null)
+ return _cachedClientId;
+ _cachedUserId = UniqueID.Replace(':', '_');
+ return _cachedUserId;
+ }
+ }
+ public virtual ControlCollection Controls //DIT
+ {
+ get
+ {
+ if (_controls == null) _controls = CreateControlCollection();
+ return _controls;
+ }
+ }
+ public virtual bool EnableViewState //DIT
+ {
+ get
+ {
+ return _enableViewState;
+ }
+ set
+ {
+ _enableViewState = value;
+ }
+ }
+ public virtual string ID
+ {
+ get //DIT
+ {
+ return _userId;
+ }
+ set
+ {
+ if (value == null || value == "") return;
+ _userId = value;
+ _cachedUserId = null;
+ //TODO: Some Naming Container stuff here I think.
+ }
+ }
+ public virtual Control NamingContainer //DIT
+ {
+ get
+ {
+ if (_namingContainer == null && _parent != null)
+ {
+ if (_parent._isNamingContainer == false)
+ _namingContainer = _parent.NamingContainer;
+ else
+ _namingContainer = _parent;
+ }
+ return _namingContainer;
+ }
+ }
+ public virtual Page Page //DIT
+ {
+ get
+ {
+ if (_page == null && _parent != null) _page = _parent.Page;
+ return _page;
+ }
+ set
+ {
+ _page = value;
+ }
+ }
+ public virtual Control Parent //DIT
+ {
+ get
+ {
+ return _parent;
+ }
+ }
+ public ISite Site //DIT
+ {
+ get
+ {
+ return _site;
+ }
+ set
+ {
+ _site = value;
+ }
+ }
+ public virtual string TemplateSourceDirectory
+ {
+ get
+ {
+ return Context.Request.ApplicationPath; //TODO: Dont think this is right.
+ }
+ }
+
+ [MonoTODO]
+ public virtual string UniqueID
+ {
+ get
+ {
+ //TODO: Some Naming container methods here. What are they? Why arnt they declared?
+ //Note: Nuked the old stuff here. Was total crap. :)
+ throw new NotImplementedException();
+ }
+ }
+ public virtual bool Visible
+ { //TODO: Are children visible when parents are not?
+ get
+ {
+ return _visible;
+ }
+ set
+ {
+ _visible = value;
+ }
+ }
+ protected bool ChildControlsCreated //DIT
+ {
+ get
+ {
+ return _childControlsCreated;
+ }
+ set
+ {
+ if (value == false && _childControlsCreated == true)
+ _controls.Clear();
+ _childControlsCreated = value;
+ }
+ }
+ protected virtual HttpContext Context //DIT
+ {
+ get
+ {
+ HttpContext context;
+ if (_context != null)
+ return _context;
+ if (_parent == null)
+ return HttpContext.Current;
+ context = _parent.Context;
+ if (context != null)
+ return context;
+ return HttpContext.Current;
+ }
+ }
+ protected EventHandlerList Events //DIT
+ {
+ get
+ {
+ if (_events == null)
+ {
+ _events = new EventHandlerList();
+ }
+ return _events;
+ }
+ }
+ protected bool HasChildViewState //DIT
+ {
+ get
+ {
+ if (_childViewStates == null) return false;
+ return true;
+ }
+ }
+ protected bool IsTrackingViewState //DIT
+ {
+ get
+ {
+ return _trackViewState;
+ }
+ }
+ protected virtual StateBag ViewState
+ {
+ get
+ {
+ if(_viewState == null)
+ {
+ _viewState = new StateBag(ViewStateIgnoresCase);
+ if(IsTrackingViewState)
+ _viewState.TrackViewState();
+ }
+ return _viewState;
+ }
+ }
+ protected virtual bool ViewStateIgnoresCase //DIT
+ {
+ get
+ {
+ return true;
+ }
+ }
+ protected virtual void AddParsedSubObject(object obj) //DIT
+ {
+ Control c = (Control)obj;
+ if (c != null) Controls.Add(c);
+ }
+ protected void BuildProfileTree(string parentId, bool calcViewState)
+ {
+ //TODO
+ }
+ protected void ClearChildViewState()
+ {
+ //TODO
+ //Not quite sure about this. an example clears children then calls this, so I think
+ //view state is local to the current object, not children.
+ }
+ protected virtual void CreateChildControls() {} //DIT
+ protected virtual ControlCollection CreateControlCollection() //DIT
+ {
+ return new ControlCollection(this);
+ }
+ protected virtual void EnsureChildControls() //DIT
+ {
+ if (_childControlsCreated == false)
+ {
+ CreateChildControls();
+ ChildControlsCreated = true;
+ }
+ }
+ protected virtual Control FindControl(string id, int pathOffset)
+ {
+ //TODO: I think there is Naming Container stuff here. Redo.
+ int i;
+ for (i = pathOffset; i < _controls.Count; i++)
+ if (_controls[i].ID == id) return _controls[i];
+ return null;
+ }
+ protected virtual void LoadViewState(object savedState)
+ {
+ //TODO: What should I do by default?
+ }
+
+ [MonoTODO]
+ protected string MapPathSecure(string virtualPath)
+ {
+ throw new NotImplementedException();
+ //TODO: Need to read up on security+web.
+ }
+ protected virtual bool OnBubbleEvent(object source, EventArgs args) //DIT
+ {
+ return false;
+ }
+ protected virtual void OnDataBinding(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[DataBindingEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnInit(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[InitEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnLoad(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[LoadEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnPreRender(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[PreRenderEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+ protected virtual void OnUnload(EventArgs e) //DIT
+ {
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[UnloadEvent]);
+ if (eh != null) eh(this, e);
+ }
+ }
+
+ [MonoTODO]
+ protected void RaiseBubbleEvent(object source, EventArgs args)
+ {
+ throw new NotImplementedException();
+ //return false;
+ }
+ protected virtual void Render(HtmlTextWriter writer) //DIT
+ {
+ RenderChildren(writer);
+ }
+ protected virtual void RenderChildren(HtmlTextWriter writer) //DIT
+ {
+ if (_renderMethodDelegate != null)
+ _renderMethodDelegate(writer, this);
+ else if (_controls != null)
+ foreach (Control c in _controls)
+ c.RenderControl(writer);
+ }
+ protected virtual object SaveViewState()
+ {
+ return ViewState;
+ }
+ protected virtual void TrackViewState()
+ {
+ _trackViewState = true;
+ }
+
+ [MonoTODO]
+ public virtual void Dispose()
+ {
+ //TODO: nuke stuff.
+ throw new NotImplementedException();
+ /*
+ if (_events != null)
+ {
+ EventHandler eh = (EventHandler)(_events[DisposedEvent]);
+ if (eh != null) eh(this, e);
+ }
+ */
+ }
+ public event EventHandler DataBinding //DIT
+ {
+ add
+ {
+ Events.AddHandler(DataBindingEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DataBindingEvent, value);
+ }
+ }
+ public event EventHandler Disposed //DIT
+ {
+ add
+ {
+ Events.AddHandler(DisposedEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(DisposedEvent, value);
+ }
+ }
+ public event EventHandler Init //DIT
+ {
+ add
+ {
+ Events.AddHandler(InitEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(InitEvent, value);
+ }
+ }
+ public event EventHandler Load //DIT
+ {
+ add
+ {
+ Events.AddHandler(LoadEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(LoadEvent, value);
+ }
+ }
+ public event EventHandler PreRender //DIT
+ {
+ add
+ {
+ Events.AddHandler(PreRenderEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(PreRenderEvent, value);
+ }
+ }
+ public event EventHandler Unload //DIT
+ {
+ add
+ {
+ Events.AddHandler(UnloadEvent, value);
+ }
+ remove
+ {
+ Events.RemoveHandler(UnloadEvent, value);
+ }
+ }
+ public virtual void DataBind() //DIT
+ {
+ OnDataBinding(EventArgs.Empty);
+ if (_controls != null)
+ foreach (Control c in _controls)
+ c.DataBind();
+ }
+ public virtual Control FindControl(string id) //DIT
+ {
+ return FindControl(id, 0);
+ }
+ public virtual bool HasControls() //DIT
+ {
+ if (_controls != null && _controls.Count >0) return true;
+ return false;
+ }
+ public void RenderControl(HtmlTextWriter writer)
+ {
+ if (_visible)
+ {
+ //TODO: Something about tracing here.
+ Render(writer);
+ }
+ }
+
+ [MonoTODO]
+ public string ResolveUrl(string relativeUrl)
+ {
+ throw new NotImplementedException();
+ }
+ public void SetRenderMethodDelegate(RenderMethod renderMethod) //DIT
+ {
+ _renderMethodDelegate = renderMethod;
+ }
+ protected void LoadRecursive()
+ {
+ OnLoad(EventArgs.Empty);
+ if (_controls != null) foreach (Control c in _controls) c.LoadRecursive();
+ }
+ protected void UnloadRecursive(Boolean dispose)
+ {
+ OnUnload(EventArgs.Empty);
+ if (_controls != null) foreach (Control c in _controls) c.UnloadRecursive(dispose);
+ if (dispose) Dispose();
+ }
+ protected void PreRenderRecursiveInternal()
+ {
+ OnPreRender(EventArgs.Empty);
+ if (_controls != null) foreach (Control c in _controls) c.PreRenderRecursiveInternal();
+ }
+ protected void InitRecursive(Control namingContainer)
+ {
+ if (_controls != null) foreach (Control c in _controls) c.InitRecursive(namingContainer);
+ OnInit(EventArgs.Empty);
+ }
+
+ [MonoTODO]
+ protected object SaveViewStateRecursive()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ protected void LoadViewStateRecursive(Object savedState)
+ {
+ throw new NotImplementedException();
+ }
+
+ void IParserAccessor.AddParsedSubObject(object obj)
+ {
+ this.AddParsedSubObject(obj);
+ }
+
+ DataBindingCollection IDataBindingsAccessor.DataBindings
+ {
+ get
+ {
+ if(dataBindings == null)
+ dataBindings = new DataBindingCollection();
+ return dataBindings;
+ }
+ }
+
+ bool IDataBindingsAccessor.HasDataBindings
+ {
+ get
+ {
+ return (dataBindings!=null && dataBindings.Count>0);
+ }
+ }
+
+ [MonoTODO("To set a flag to prevent automatic generation of IDs")]
+ internal void PreventAutoID()
+ {
+ throw new NotImplementedException();
+ }
+
+ //TODO: I think there are some needed Interface implementations to do here.
+ //TODO: Find api for INamingContainer.
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs b/mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs
new file mode 100644
index 00000000000..65af373bc8c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DataBindingHandlerAttribute.cs
@@ -0,0 +1,49 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: DataBindingHandlerAttribute
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Reflection;
+
+namespace System.Web.UI
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public sealed class DataBindingHandlerAttribute : Attribute
+ {
+ public static readonly DataBindingHandlerAttribute Default;
+
+ private string handlerTypeName;
+
+ public DataBindingHandlerAttribute()
+ {
+ handlerTypeName = String.Empty;
+ }
+
+ public DataBindingHandlerAttribute(string typeName)
+ {
+ handlerTypeName = typeName;
+ }
+
+ public DataBindingHandlerAttribute(Type type)
+ {
+ handlerTypeName = type.AssemblyQualifiedName;
+ }
+
+ public string HandlerTypeName
+ {
+ get
+ {
+ return handlerTypeName;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs b/mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs
new file mode 100644
index 00000000000..901e0c4cb91
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/DesignTimeParseData.cs
@@ -0,0 +1,29 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: DesignTimeParseData
+ *
+ * Author: Gaurav Vaish
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: ?%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public sealed class DesignTimeParseData
+ {
+ private static bool inDesigner = false;
+
+ internal static bool InDesigner
+ {
+ get
+ {
+ return inDesigner;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
new file mode 100644
index 00000000000..ef794771686
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriter.cs
@@ -0,0 +1,1028 @@
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI{
+
+public class HtmlTextWriter : System.IO.TextWriter {
+
+static HtmlTextWriter(){
+ HtmlTextWriter._tagKeyLookupTable = new Hashtable(97);
+ HtmlTextWriter._tagNameLookupArray = new TagInformation[97];
+ HtmlTextWriter.RegisterTag("", HtmlTextWriterTag.Unknown, TagType.Other);
+ HtmlTextWriter.RegisterTag("a", HtmlTextWriterTag.A, TagType.Inline);
+ HtmlTextWriter.RegisterTag("acronym", HtmlTextWriterTag.Acronym, TagType.Inline);
+ HtmlTextWriter.RegisterTag("address", HtmlTextWriterTag.Address, TagType.Other);
+ HtmlTextWriter.RegisterTag("area", HtmlTextWriterTag.Area, TagType.Other);
+ HtmlTextWriter.RegisterTag("b", HtmlTextWriterTag.B, TagType.Inline);
+ HtmlTextWriter.RegisterTag("base", HtmlTextWriterTag.Base, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("basefont", HtmlTextWriterTag.Basefont, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("bdo", HtmlTextWriterTag.Bdo, TagType.Inline);
+ HtmlTextWriter.RegisterTag("bgsound", HtmlTextWriterTag.Bgsound, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("big", HtmlTextWriterTag.Big, TagType.Inline);
+ HtmlTextWriter.RegisterTag("blockquote", HtmlTextWriterTag.Blockquote, TagType.Other);
+ HtmlTextWriter.RegisterTag("body", HtmlTextWriterTag.Body, TagType.Other);
+ HtmlTextWriter.RegisterTag("br", HtmlTextWriterTag.Br, TagType.Other);
+ HtmlTextWriter.RegisterTag("button", HtmlTextWriterTag.Button, TagType.Inline);
+ HtmlTextWriter.RegisterTag("caption", HtmlTextWriterTag.Caption, TagType.Other);
+ HtmlTextWriter.RegisterTag("center", HtmlTextWriterTag.Center, TagType.Other);
+ HtmlTextWriter.RegisterTag("cite", HtmlTextWriterTag.Cite, TagType.Inline);
+ HtmlTextWriter.RegisterTag("code", HtmlTextWriterTag.Code, TagType.Inline);
+ HtmlTextWriter.RegisterTag("col", HtmlTextWriterTag.Col, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("colgroup", HtmlTextWriterTag.Colgroup, TagType.Other);
+ HtmlTextWriter.RegisterTag("del", HtmlTextWriterTag.Del, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dd", HtmlTextWriterTag.Dd, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dfn", HtmlTextWriterTag.Dfn, TagType.Inline);
+ HtmlTextWriter.RegisterTag("dir", HtmlTextWriterTag.Dir, TagType.Other);
+ HtmlTextWriter.RegisterTag("div", HtmlTextWriterTag.Div, TagType.Other);
+ HtmlTextWriter.RegisterTag("dl", HtmlTextWriterTag.Dl, TagType.Other);
+ HtmlTextWriter.RegisterTag("dt", HtmlTextWriterTag.Dt, TagType.Inline);
+ HtmlTextWriter.RegisterTag("em", HtmlTextWriterTag.Em, TagType.Inline);
+ HtmlTextWriter.RegisterTag("embed", HtmlTextWriterTag.Embed, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("fieldset", HtmlTextWriterTag.Fieldset, TagType.Other);
+ HtmlTextWriter.RegisterTag("font", HtmlTextWriterTag.Font, TagType.Inline);
+ HtmlTextWriter.RegisterTag("form", HtmlTextWriterTag.Form, TagType.Other);
+ HtmlTextWriter.RegisterTag("frame", HtmlTextWriterTag.Frame, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("frameset", HtmlTextWriterTag.Frameset, TagType.Other);
+ HtmlTextWriter.RegisterTag("h1", HtmlTextWriterTag.H1, TagType.Other);
+ HtmlTextWriter.RegisterTag("h2", HtmlTextWriterTag.H2, TagType.Other);
+ HtmlTextWriter.RegisterTag("h3", HtmlTextWriterTag.H3, TagType.Other);
+ HtmlTextWriter.RegisterTag("h4", HtmlTextWriterTag.H4, TagType.Other);
+ HtmlTextWriter.RegisterTag("h5", HtmlTextWriterTag.H5, TagType.Other);
+ HtmlTextWriter.RegisterTag("h6", HtmlTextWriterTag.H6, TagType.Other);
+ HtmlTextWriter.RegisterTag("head", HtmlTextWriterTag.Head, TagType.Other);
+ HtmlTextWriter.RegisterTag("hr", HtmlTextWriterTag.Hr, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("html", HtmlTextWriterTag.Html, TagType.Other);
+ HtmlTextWriter.RegisterTag("i", HtmlTextWriterTag.I, TagType.Inline);
+ HtmlTextWriter.RegisterTag("iframe", HtmlTextWriterTag.Iframe, TagType.Other);
+ HtmlTextWriter.RegisterTag("img", HtmlTextWriterTag.Img, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("input", HtmlTextWriterTag.Input, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("ins", HtmlTextWriterTag.Ins, TagType.Inline);
+ HtmlTextWriter.RegisterTag("isindex", HtmlTextWriterTag.Isindex, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("kbd", HtmlTextWriterTag.Kbd, TagType.Inline);
+ HtmlTextWriter.RegisterTag("label", HtmlTextWriterTag.Label, TagType.Inline);
+ HtmlTextWriter.RegisterTag("legend", HtmlTextWriterTag.Legend, TagType.Other);
+ HtmlTextWriter.RegisterTag("li", HtmlTextWriterTag.Li, TagType.Inline);
+ HtmlTextWriter.RegisterTag("link", HtmlTextWriterTag.Link, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("map", HtmlTextWriterTag.Map, TagType.Other);
+ HtmlTextWriter.RegisterTag("marquee", HtmlTextWriterTag.Marquee, TagType.Other);
+ HtmlTextWriter.RegisterTag("menu", HtmlTextWriterTag.Menu, TagType.Other);
+ HtmlTextWriter.RegisterTag("meta", HtmlTextWriterTag.Meta, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("nobr", HtmlTextWriterTag.Nobr, TagType.Inline);
+ HtmlTextWriter.RegisterTag("noframes", HtmlTextWriterTag.Noframes, TagType.Other);
+ HtmlTextWriter.RegisterTag("noscript", HtmlTextWriterTag.Noscript, TagType.Other);
+ HtmlTextWriter.RegisterTag("object", HtmlTextWriterTag.Object, TagType.Other);
+ HtmlTextWriter.RegisterTag("ol", HtmlTextWriterTag.Ol, TagType.Other);
+ HtmlTextWriter.RegisterTag("option", HtmlTextWriterTag.Option, TagType.Other);
+ HtmlTextWriter.RegisterTag("p", HtmlTextWriterTag.P, TagType.Inline);
+ HtmlTextWriter.RegisterTag("param", HtmlTextWriterTag.Param, TagType.Other);
+ HtmlTextWriter.RegisterTag("pre", HtmlTextWriterTag.Pre, TagType.Other);
+ HtmlTextWriter.RegisterTag("q", HtmlTextWriterTag.Q, TagType.Inline);
+ HtmlTextWriter.RegisterTag("rt", HtmlTextWriterTag.Rt, TagType.Other);
+ HtmlTextWriter.RegisterTag("ruby", HtmlTextWriterTag.Ruby, TagType.Other);
+ HtmlTextWriter.RegisterTag("s", HtmlTextWriterTag.S, TagType.Inline);
+ HtmlTextWriter.RegisterTag("samp", HtmlTextWriterTag.Samp, TagType.Inline);
+ HtmlTextWriter.RegisterTag("script", HtmlTextWriterTag.Script, TagType.Other);
+ HtmlTextWriter.RegisterTag("select", HtmlTextWriterTag.Select, TagType.Other);
+ HtmlTextWriter.RegisterTag("small", HtmlTextWriterTag.Small, TagType.Other);
+ HtmlTextWriter.RegisterTag("span", HtmlTextWriterTag.Span, TagType.Inline);
+ HtmlTextWriter.RegisterTag("strike", HtmlTextWriterTag.Strike, TagType.Inline);
+ HtmlTextWriter.RegisterTag("strong", HtmlTextWriterTag.Strong, TagType.Inline);
+ HtmlTextWriter.RegisterTag("style", HtmlTextWriterTag.Style, TagType.Other);
+ HtmlTextWriter.RegisterTag("sub", HtmlTextWriterTag.Sub, TagType.Inline);
+ HtmlTextWriter.RegisterTag("sup", HtmlTextWriterTag.Sup, TagType.Inline);
+ HtmlTextWriter.RegisterTag("table", HtmlTextWriterTag.Table, TagType.Other);
+ HtmlTextWriter.RegisterTag("tbody", HtmlTextWriterTag.Tbody, TagType.Other);
+ HtmlTextWriter.RegisterTag("td", HtmlTextWriterTag.Td, TagType.Inline);
+ HtmlTextWriter.RegisterTag("textarea", HtmlTextWriterTag.Textarea, TagType.Inline);
+ HtmlTextWriter.RegisterTag("tfoot", HtmlTextWriterTag.Tfoot, TagType.Other);
+ HtmlTextWriter.RegisterTag("th", HtmlTextWriterTag.Th, TagType.Inline);
+ HtmlTextWriter.RegisterTag("thead", HtmlTextWriterTag.Thead, TagType.Other);
+ HtmlTextWriter.RegisterTag("title", HtmlTextWriterTag.Title, TagType.Other);
+ HtmlTextWriter.RegisterTag("tr", HtmlTextWriterTag.Tr, TagType.Other);
+ HtmlTextWriter.RegisterTag("tt", HtmlTextWriterTag.Tt, TagType.Inline);
+ HtmlTextWriter.RegisterTag("u", HtmlTextWriterTag.U, TagType.Inline);
+ HtmlTextWriter.RegisterTag("ul", HtmlTextWriterTag.Ul, TagType.Other);
+ HtmlTextWriter.RegisterTag("var", HtmlTextWriterTag.Var, TagType.Inline);
+ HtmlTextWriter.RegisterTag("wbr", HtmlTextWriterTag.Wbr, TagType.NonClosing);
+ HtmlTextWriter.RegisterTag("xml", HtmlTextWriterTag.Xml, TagType.Other);
+
+ HtmlTextWriter._attrKeyLookupTable = new Hashtable(40);
+ HtmlTextWriter._attrNameLookupArray = new AttributeInformation[40];
+ HtmlTextWriter.RegisterAttribute("accesskey", HtmlTextWriterAttribute.Accesskey, true);
+ HtmlTextWriter.RegisterAttribute("align", HtmlTextWriterAttribute.Align, false);
+ HtmlTextWriter.RegisterAttribute("alt", HtmlTextWriterAttribute.Alt, true);
+ HtmlTextWriter.RegisterAttribute("background", HtmlTextWriterAttribute.Background, true);
+ HtmlTextWriter.RegisterAttribute("bgcolor", HtmlTextWriterAttribute.Bgcolor, false);
+ HtmlTextWriter.RegisterAttribute("border", HtmlTextWriterAttribute.Border, false);
+ HtmlTextWriter.RegisterAttribute("bordercolor", HtmlTextWriterAttribute.Bordercolor, false);
+ HtmlTextWriter.RegisterAttribute("cellpadding", HtmlTextWriterAttribute.Cellpadding, false);
+ HtmlTextWriter.RegisterAttribute("cellspacing", HtmlTextWriterAttribute.Cellspacing, false);
+ HtmlTextWriter.RegisterAttribute("checked", HtmlTextWriterAttribute.Checked, false);
+ HtmlTextWriter.RegisterAttribute("class", HtmlTextWriterAttribute.Class, true);
+ HtmlTextWriter.RegisterAttribute("cols", HtmlTextWriterAttribute.Cols, false);
+ HtmlTextWriter.RegisterAttribute("colspan", HtmlTextWriterAttribute.Colspan, false);
+ HtmlTextWriter.RegisterAttribute("disabled", HtmlTextWriterAttribute.Disabled, false);
+ HtmlTextWriter.RegisterAttribute("for", HtmlTextWriterAttribute.For, false);
+ HtmlTextWriter.RegisterAttribute("height", HtmlTextWriterAttribute.Height, false);
+ HtmlTextWriter.RegisterAttribute("href", HtmlTextWriterAttribute.Href, true);
+ HtmlTextWriter.RegisterAttribute("id", HtmlTextWriterAttribute.Id, false);
+ HtmlTextWriter.RegisterAttribute("maxlength", HtmlTextWriterAttribute.Maxlength, false);
+ HtmlTextWriter.RegisterAttribute("multiple", HtmlTextWriterAttribute.Multiple, false);
+ HtmlTextWriter.RegisterAttribute("name", HtmlTextWriterAttribute.Name, false);
+ HtmlTextWriter.RegisterAttribute("nowrap", HtmlTextWriterAttribute.Nowrap, false);
+ HtmlTextWriter.RegisterAttribute("onchange", HtmlTextWriterAttribute.Onchange, true);
+ HtmlTextWriter.RegisterAttribute("onclick", HtmlTextWriterAttribute.Onclick, true);
+ HtmlTextWriter.RegisterAttribute("readonly", HtmlTextWriterAttribute.ReadOnly, false);
+ HtmlTextWriter.RegisterAttribute("rows", HtmlTextWriterAttribute.Rows, false);
+ HtmlTextWriter.RegisterAttribute("rowspan", HtmlTextWriterAttribute.Rowspan, false);
+ HtmlTextWriter.RegisterAttribute("rules", HtmlTextWriterAttribute.Rules, false);
+ HtmlTextWriter.RegisterAttribute("selected", HtmlTextWriterAttribute.Selected, false);
+ HtmlTextWriter.RegisterAttribute("size", HtmlTextWriterAttribute.Size, false);
+ HtmlTextWriter.RegisterAttribute("src", HtmlTextWriterAttribute.Src, true);
+ HtmlTextWriter.RegisterAttribute("style", HtmlTextWriterAttribute.Style, false);
+ HtmlTextWriter.RegisterAttribute("tabindex", HtmlTextWriterAttribute.Tabindex, false);
+ HtmlTextWriter.RegisterAttribute("target", HtmlTextWriterAttribute.Target, false);
+ HtmlTextWriter.RegisterAttribute("title", HtmlTextWriterAttribute.Title, true);
+ HtmlTextWriter.RegisterAttribute("type", HtmlTextWriterAttribute.Type, false);
+ HtmlTextWriter.RegisterAttribute("valign", HtmlTextWriterAttribute.Valign, false);
+ HtmlTextWriter.RegisterAttribute("value", HtmlTextWriterAttribute.Value, true);
+ HtmlTextWriter.RegisterAttribute("width", HtmlTextWriterAttribute.Width, false);
+ HtmlTextWriter.RegisterAttribute("wrap", HtmlTextWriterAttribute.Wrap, false);
+
+ HtmlTextWriter._styleKeyLookupTable = new Hashtable(14);
+ HtmlTextWriter._styleNameLookupArray = new String[14];
+ HtmlTextWriter.RegisterStyle("background-color", HtmlTextWriterStyle.BackgroundColor);
+ HtmlTextWriter.RegisterStyle("background-image", HtmlTextWriterStyle.BackgroundImage);
+ HtmlTextWriter.RegisterStyle("border-collapse", HtmlTextWriterStyle.BorderCollapse);
+ HtmlTextWriter.RegisterStyle("border-color", HtmlTextWriterStyle.BorderColor);
+ HtmlTextWriter.RegisterStyle("border-style", HtmlTextWriterStyle.BorderStyle);
+ HtmlTextWriter.RegisterStyle("border-width", HtmlTextWriterStyle.BorderWidth);
+ HtmlTextWriter.RegisterStyle("color", HtmlTextWriterStyle.Color);
+ HtmlTextWriter.RegisterStyle("font-family", HtmlTextWriterStyle.FontFamily);
+ HtmlTextWriter.RegisterStyle("font-size", HtmlTextWriterStyle.FontSize);
+ HtmlTextWriter.RegisterStyle("font-style", HtmlTextWriterStyle.FontStyle);
+ HtmlTextWriter.RegisterStyle("font-weight", HtmlTextWriterStyle.FontWeight);
+ HtmlTextWriter.RegisterStyle("height", HtmlTextWriterStyle.Height);
+ HtmlTextWriter.RegisterStyle("text-decoration", HtmlTextWriterStyle.TextDecoration);
+ HtmlTextWriter.RegisterStyle("width", HtmlTextWriterStyle.Width);
+}
+
+public HtmlTextWriter(TextWriter writer):this(writer, " "){}
+
+public HtmlTextWriter(TextWriter writer, string tabString) : base() {
+ writer = writer;
+ tabString = tabString;
+ indentLevel = 0;
+ tabsPending = false;
+ _httpWriter = writer as HttpWriter;
+ _isDescendant = GetType() == typeof(HtmlTextWriter) == false;
+ _attrList = new RenderAttribute[20];
+ _attrCount = 0;
+ _styleList = new RenderStyle[20];
+ _styleCount = 0;
+ _endTags = new TagStackEntry[16];
+ _endTagCount = 0;
+ _inlineCount = 0;
+}
+
+public virtual void AddAttribute(HtmlTextWriterAttribute key, string value){
+ if ((int) key >= 0 && (int) key < HtmlTextWriter._attrNameLookupArray.Length) {
+ AttributeInformation attrInfo = HtmlTextWriter._attrNameLookupArray[(int) key];
+ AddAttribute(attrInfo.name, value, key, attrInfo.encode);
+ }
+}
+
+public virtual void AddAttribute(HtmlTextWriterAttribute key, string value, bool fEncode){
+ if ((int) key >= 0 && (int) key < HtmlTextWriter._attrNameLookupArray.Length) {
+ AddAttribute(HtmlTextWriter._attrNameLookupArray[(int) key].name, value, key, fEncode);
+ }
+}
+
+public virtual void AddAttribute(string name, string value){
+ HtmlTextWriterAttribute attr = GetAttributeKey(name);
+ value = EncodeAttributeValue(GetAttributeKey(name), value);
+ AddAttribute(name, value, attr);
+}
+
+public virtual void AddAttribute(string name, string value, bool fEndode){
+ value = EncodeAttributeValue(value, fEndode);
+ AddAttribute(name, value, GetAttributeKey(name));
+}
+
+protected virtual void AddAttribute(string name, string value, HtmlTextWriterAttribute key){
+ AddAttribute(name, value, key, false);
+}
+
+private void AddAttribute(string name, string value, HtmlTextWriterAttribute key, bool encode){
+ if (_attrCount >= (int) _attrList.Length) {
+ RenderAttribute[] rAttrArr = new RenderAttribute[_attrList.Length * 2];
+ System.Array.Copy(_attrList, rAttrArr, (int) _attrList.Length);
+ _attrList = rAttrArr;
+ }
+ RenderAttribute rAttr;
+ rAttr.name = name;
+ rAttr.value = value;
+ rAttr.key = key;
+ rAttr.encode = encode;
+ _attrCount++;
+}
+
+public virtual void AddStyleAttribute(HtmlTextWriterStyle key, string value){
+ AddStyleAttribute(GetStyleName(key), value, key);
+}
+
+public virtual void AddStyleAttribute(string name, string value){
+ AddStyleAttribute(name, value, GetStyleKey(name));
+}
+
+protected virtual void AddStyleAttribute(string name, string value, HtmlTextWriterStyle key){
+ RenderStyle[] tagRender;
+ RenderStyle beforeTag;
+
+ if (_styleCount > (int) _styleList.Length) {
+ RenderStyle[] rAttrArr = new RenderStyle[_styleList.Length * 2];
+ System.Array.Copy(_styleList, rAttrArr, (int) _styleList.Length);
+ _styleList = rAttrArr;
+ }
+ RenderStyle rAttr;
+ rAttr.name = name;
+ rAttr.value = value;
+ rAttr.key = key;
+ _styleCount++;
+}
+
+public override void Close(){
+ writer.Close();
+}
+
+protected virtual string EncodeAttributeValue(HtmlTextWriterAttribute attrKey, string value){
+ bool valid = true;
+ if (0 <= (int) attrKey && (int) attrKey < HtmlTextWriter._attrNameLookupArray.Length)
+ valid = HtmlTextWriter._attrNameLookupArray[(int) attrKey].encode;
+ return EncodeAttributeValue(value, valid);
+}
+
+protected string EncodeAttributeValue(string value, bool fEncode){
+ if (value == null)
+ return null;
+ if (!(fEncode))
+ return value;
+ return System.Web.HttpUtility.HtmlAttributeEncode(value);
+}
+
+protected string EncodeUrl(string url){
+ if (url.IndexOf(SpaceChar) < 0)
+ return url;
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ for(int i=0; i <= url.Length; i++){
+ char temp = url[i];
+ if (temp != 32)
+ sb.Append(temp);
+ else
+ sb.Append("%20");
+ }
+ return sb.ToString();
+}
+
+protected virtual void FilterAttributes(){
+ int count = 0;
+ for(int i=0; i <= _styleCount; i++){
+ RenderStyle rStyle = _styleList[i];
+ if (OnStyleAttributeRender(rStyle.name, rStyle.value, rStyle.key)) {
+ count++;
+ }
+ }
+ _styleCount = count;
+ count = 0;
+ for(int i=0; i <= _attrCount; i++){
+ RenderAttribute rAttr = _attrList[i];
+ if (OnAttributeRender(rAttr.name, rAttr.value, rAttr.key)) {
+ count++;
+ }
+ }
+ _attrCount = count;
+}
+
+public override void Flush(){
+ writer.Flush();
+}
+
+protected HtmlTextWriterAttribute GetAttributeKey(string attrName){
+ if (attrName != null && attrName.Length > 0) {
+ object attr = HtmlTextWriter._attrKeyLookupTable[attrName.ToLower()];
+ if (attr != null)
+ return (HtmlTextWriterAttribute) attr;
+ }
+ return (HtmlTextWriterAttribute) (-1);
+}
+
+protected string GetAttributeName(HtmlTextWriterAttribute attrKey){
+ if ((int) attrKey >= 0 && (int) attrKey < HtmlTextWriter._attrNameLookupArray.Length)
+ return HtmlTextWriter._attrNameLookupArray[(int) attrKey].name;
+ return System.String.Empty;
+}
+
+protected HtmlTextWriterStyle GetStyleKey(string styleName){
+ if (styleName != null && styleName.Length > 0) {
+ object style = HtmlTextWriter._styleKeyLookupTable[styleName.ToLower()];
+ if (style != null)
+ return (HtmlTextWriterStyle) style;
+ }
+ return (HtmlTextWriterStyle) (-1);
+}
+
+protected string GetStyleName(HtmlTextWriterStyle styleKey){
+ if ((int) styleKey >= 0 && (int) styleKey < HtmlTextWriter._styleNameLookupArray.Length)
+ return HtmlTextWriter._styleNameLookupArray[(int) styleKey];
+ return System.String.Empty;
+}
+
+protected virtual HtmlTextWriterTag GetTagKey(string tagName){
+ if (tagName != null && tagName.Length > 0) {
+ object tag = HtmlTextWriter._tagKeyLookupTable[tagName.ToLower()];
+ if (tag != null)
+ return (HtmlTextWriterTag) tag;
+ }
+ return 0;
+}
+
+protected virtual string GetTagName(HtmlTextWriterTag tagKey){
+ if ((int) tagKey >= 0 && (int) tagKey < HtmlTextWriter._tagNameLookupArray.Length)
+ return HtmlTextWriter._tagNameLookupArray[(int) tagKey].name;
+ return System.String.Empty;
+}
+
+protected bool IsAttributeDefined(HtmlTextWriterAttribute key){
+ for (int i=0; i <= _attrCount; i++) {
+ if (_attrList[i].key == key)
+ return true;
+ }
+ return false;
+}
+
+protected bool IsAttributeDefined(HtmlTextWriterAttribute key, ref string value){
+ value = null;
+ for (int i=0; i <= _attrCount; i++) {
+ if (_attrList[i].key == key) {
+ value = _attrList[i].value;
+ return true;
+ }
+ }
+ return false;
+}
+
+protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key){
+ for (int i= 0; i <= _styleCount; i++) {
+ if (_styleList[i].key == key)
+ return true;
+ }
+ return false;
+}
+
+protected bool IsStyleAttributeDefined(HtmlTextWriterStyle key, ref string value){
+ value = null;
+ for( int i=0; i <= _styleCount; i++) {
+ if (_styleList[i].key == key) {
+ value = _styleList[i].value;
+ return true;
+ }
+ }
+ return false;
+}
+
+protected virtual bool OnAttributeRender(string name, string value, HtmlTextWriterAttribute key){
+ return true;
+}
+
+protected virtual bool OnStyleAttributeRender(string name, string value, HtmlTextWriterStyle key){
+ return true;
+}
+
+protected virtual bool OnTagRender(string name, HtmlTextWriterTag key){
+ return true;
+}
+
+protected virtual void OutputTabs(){
+ if (tabsPending) {
+ for(int i=0; i <= indentLevel; i++) {
+ writer.Write(tabString);
+ }
+ tabsPending = false;
+ }
+}
+
+protected string PopEndTag(){
+ if (_endTagCount <= 0)
+ throw new InvalidOperationException("A PopEndTag was called without a corresponding PushEndTag");
+ _endTagCount--;
+ TagKey = _endTags[_endTagCount].tagKey;
+ return _endTags[_endTagCount].endTagText;
+}
+
+protected void PushEndTag(string endTag){
+ if (_endTagCount >= (int) _endTags.Length) {
+ TagStackEntry[] temp = new TagStackEntry[(int) _endTags.Length * 2];
+ System.Array.Copy(_endTags, temp, (int) _endTags.Length);
+ _endTags = temp;
+ }
+ _endTags[_endTagCount].tagKey = _tagKey;
+ _endTags[_endTagCount].endTagText = endTag;
+ _endTagCount++;
+}
+
+protected static void RegisterAttribute(string name, HtmlTextWriterAttribute key){
+ HtmlTextWriter.RegisterAttribute(name, key, false);
+}
+
+private static void RegisterAttribute(string name, HtmlTextWriterAttribute key, bool fEncode){
+ name = name.ToLower();
+ HtmlTextWriter._attrKeyLookupTable.Add(name, key);
+ if ((int) key < (int) HtmlTextWriter._attrNameLookupArray.Length)
+ HtmlTextWriter._attrNameLookupArray[(int) key] = new AttributeInformation(name, fEncode);
+}
+
+protected static void RegisterStyle(string name, HtmlTextWriterStyle key){
+ name = name.ToLower();
+ HtmlTextWriter._styleKeyLookupTable.Add(name, key);
+ if ((int) key < (int) HtmlTextWriter._styleNameLookupArray.Length)
+ HtmlTextWriter._styleNameLookupArray[(int) key] = name;
+}
+
+protected static void RegisterTag(string name, HtmlTextWriterTag key){
+ HtmlTextWriter.RegisterTag(name, key, TagType.Other);
+}
+
+private static void RegisterTag(string name, HtmlTextWriterTag key, TagType type){
+ name = name.ToLower();
+ HtmlTextWriter._tagKeyLookupTable.Add(name, key);
+ string fullTag = null;
+ if ((int) type != 1 && (int) key != 0) {
+ fullTag = EndTagLeftChars + name + TagRightChar;
+ }
+ if ((int) key < HtmlTextWriter._tagNameLookupArray.Length)
+ HtmlTextWriter._tagNameLookupArray[(int) key] = new TagInformation(name, type, fullTag);
+}
+
+protected virtual string RenderAfterContent(){
+ return null;
+}
+
+protected virtual string RenderAfterTag(){
+ return null;
+}
+
+protected virtual string RenderBeforeContent(){
+ return null;
+}
+
+protected virtual string RenderBeforeTag(){
+ return null;
+}
+
+public virtual void RenderBeginTag(HtmlTextWriterTag tagKey){
+ TagKey = tagKey;
+ bool tagRender = true;
+ if (_isDescendant) {
+ tagRender = OnTagRender(_tagName, _tagKey);
+ FilterAttributes();
+ string beforeTag = RenderBeforeTag();
+ if (beforeTag != null) {
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(beforeTag);
+ }
+ }
+ TagInformation currentTag = HtmlTextWriter._tagNameLookupArray[_tagIndex];
+ bool tagRendered=true;
+ if (!tagRender)
+ tagRendered = false;
+ if (tagRender) {
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(_tagName);
+ RenderAttribute rAttr;
+ string rAttrValue = null;
+ for (int i=0; i <= _attrCount; i++) {
+ rAttr = _attrList[i];
+ if (rAttr.key == HtmlTextWriterAttribute.Style)
+ rAttrValue = rAttr.value;
+ else {
+ writer.Write(SpaceChar);
+ writer.Write(rAttr.name);
+ if (rAttr.value != null) {
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ if (rAttr.encode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(rAttr.value, writer);
+ }
+ else {
+ System.Web.HttpUtility.HtmlAttributeEncode(rAttr.value, (TextWriter) _httpWriter);
+ }
+ }
+ else {
+ writer.Write(rAttr.value);
+ }
+ writer.Write(DoubleQuoteChar);
+ }
+ }
+ }
+ if (_styleCount > 0 || rAttrValue != null) {
+ writer.Write(SpaceChar);
+ writer.Write("style");
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ RenderStyle rStyle;
+ for (int i=0; i <= _styleCount; i++) {
+ rStyle = _styleList[i];
+ writer.Write(rStyle.name);
+ writer.Write(StyleEqualsChar);
+ writer.Write(rStyle.value);
+ writer.Write(SemicolonChar);
+ }
+ if (rAttrValue != null)
+ writer.Write(rAttrValue);
+ writer.Write(DoubleQuoteChar);
+ }
+ if (currentTag.tagType == TagType.NonClosing) {
+ writer.Write(SpaceChar);
+ writer.Write(SlashChar);
+ writer.Write(TagRightChar);
+ }
+ else
+ writer.Write(TagRightChar);
+ }
+ string beforeContent = RenderBeforeContent();
+ if (beforeContent != null) {
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(beforeContent);
+ }
+ if (tagRendered) {
+ if (currentTag.tagType == TagType.Inline)
+ _inlineCount++;
+ else {
+ WriteLine();
+ Indent++;
+ }
+ if (currentTag.closingTag == null) {
+ currentTag.closingTag = EndTagLeftChars + _tagName + TagRightChar;
+ }
+ }
+ if (_isDescendant) {
+ string afterContent = RenderAfterContent();
+ if (afterContent != null) {
+ if (currentTag.closingTag != null)
+ currentTag.closingTag = afterContent;
+ }
+ string afterTag = RenderAfterTag();
+ if (afterTag != null) {
+ if (currentTag.closingTag != null)
+ currentTag.closingTag = afterTag;
+ }
+ }
+ PushEndTag(currentTag.closingTag);
+ _attrCount = 0;
+ _styleCount = 0;
+}
+
+public virtual void RenderBeginTag(string tagName){
+ TagName = tagName;
+ RenderBeginTag(_tagKey);
+}
+
+public virtual void RenderEndTag(){
+ string endTagText = PopEndTag();
+ if (endTagText != null) {
+ if (HtmlTextWriter._tagNameLookupArray[_tagIndex].tagType == 0) {
+ _inlineCount--;
+ Write(endTagText);
+ }
+ else{
+ WriteLine();
+ Indent--;
+ Write(endTagText);
+ }
+ }
+}
+
+public override void Write(bool value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(char value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(char[] buffer){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(buffer);
+}
+
+public override void Write(char[] buffer, int index, int count){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(buffer, index, count);
+}
+
+public override void Write(double value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(int value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(long value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(object value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(float value){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(value);
+}
+
+public override void Write(string s){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(s);
+}
+
+public override void Write(string format, object arg0){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg0);
+}
+
+public override void Write(string format, object arg0, object arg1){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg0, arg1);
+}
+
+public override void Write(string format, params object[] arg){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(format, arg);
+}
+
+public virtual void WriteAttribute(string name, string value){
+ WriteAttribute(name, value, false);
+}
+
+public virtual void WriteAttribute(string name, string value, bool fEncode){
+ writer.Write(SpaceChar);
+ writer.Write(name);
+ if (value != null) {
+ writer.Write(EqualsChar);
+ writer.Write(DoubleQuoteChar);
+ if (fEncode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(value, writer);
+ }
+ else{
+ System.Web.HttpUtility.HtmlAttributeEncode(value, (TextWriter) _httpWriter);
+ }
+ }
+ else{
+ writer.Write(value);
+ }
+ writer.Write(DoubleQuoteChar);
+ }
+}
+
+public virtual void WriteBeginTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(tagName);
+}
+
+public virtual void WriteEndTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(SlashChar);
+ writer.Write(tagName);
+ writer.Write(TagRightChar);
+}
+
+public virtual void WriteFullBeginTag(string tagName){
+ if (tabsPending)
+ OutputTabs();
+ writer.Write(TagLeftChar);
+ writer.Write(tagName);
+ writer.Write(TagRightChar);
+}
+
+public override void WriteLine(){
+ writer.WriteLine();
+ tabsPending = true;
+}
+
+public override void WriteLine(bool value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(char value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(char[] buffer){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(buffer);
+ tabsPending = true;
+}
+
+public override void WriteLine(char[] buffer, int index, int count){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(buffer, index, count);
+ tabsPending = true;
+}
+
+public override void WriteLine(double value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(int value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(long value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(object value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(float value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public override void WriteLine(string s){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(s);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, object arg0){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg0);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, object arg0, object arg1){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg0, arg1);
+ tabsPending = true;
+}
+
+public override void WriteLine(string format, params object[] arg){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(format, arg);
+ tabsPending = true;
+}
+
+[CLSCompliant(false)]
+public override void WriteLine(uint value){
+ if (tabsPending)
+ OutputTabs();
+ writer.WriteLine(value);
+ tabsPending = true;
+}
+
+public void WriteLineNoTabs(string s){
+ writer.WriteLine(s);
+}
+
+public virtual void WriteStyleAttribute(string name, string value){
+ WriteStyleAttribute(name, value, false);
+}
+
+public virtual void WriteStyleAttribute(string name, string value, bool fEncode){
+ writer.Write(name);
+ writer.Write(StyleEqualsChar);
+ if (fEncode) {
+ if (_httpWriter == null) {
+ System.Web.HttpUtility.HtmlAttributeEncode(value, writer);
+ }
+ else{
+ System.Web.HttpUtility.HtmlAttributeEncode(value, (TextWriter) _httpWriter);
+ }
+ }
+ else {
+ writer.Write(value);
+ }
+ writer.Write(SemicolonChar);
+}
+
+public override System.Text.Encoding Encoding {
+ get{
+ return writer.Encoding;
+ }
+}
+
+public int Indent {
+ get{
+ return indentLevel;
+ }
+ set{
+ if (value < 0)
+ value = 0;
+ indentLevel = value;
+ }
+}
+
+public TextWriter InnerWriter {
+ get{
+ return writer;
+ }
+ set{
+ writer = value;
+ _httpWriter = value as HttpWriter;
+ }
+}
+
+public override string NewLine {
+ get{
+ return writer.NewLine;
+ }
+ set{
+ writer.NewLine = value;
+ }
+}
+
+protected HtmlTextWriterTag TagKey {
+ get{
+ return _tagKey;
+ }
+ set{
+ _tagIndex = (int) value;
+ if (_tagIndex < 0 || _tagIndex >= (int) HtmlTextWriter._tagNameLookupArray.Length)
+ throw new ArgumentOutOfRangeException("value");
+ _tagKey = value;
+ if (value != 0)
+ _tagName = HtmlTextWriter._tagNameLookupArray[_tagIndex].name;
+ }
+}
+
+protected string TagName {
+ get{
+ return _tagName;
+ }
+ set{
+ _tagName = value;
+ _tagKey = GetTagKey(_tagName);
+ _tagIndex = (int) _tagKey;
+ }
+}
+
+public const string DefaultTabString = "\t";
+public const char DoubleQuoteChar = '"';
+public const string EndTagLeftChars = "</";
+public const char EqualsChar = '=';
+public const string EqualsDoubleQuoteString = "=\"";
+public const string SelfClosingChars = " /";
+public const string SelfClosingTagEnd = " />";
+public const char SemicolonChar = ';';
+public const char SingleQuoteChar = '\'';
+public const char SlashChar = '/';
+public const char SpaceChar = ' ';
+public const char StyleEqualsChar = ':';
+public const char TagLeftChar = '<';
+public const char TagRightChar = '>';
+
+private int _attrCount;
+private int _endTagCount;
+private int _styleCount;
+private int indentLevel;
+private int _inlineCount;
+private int _tagIndex;
+
+private bool _isDescendant;
+private bool tabsPending;
+
+private HtmlTextWriterTag _tagKey;
+private TextWriter writer;
+private HttpWriter _httpWriter;
+
+private static Hashtable _attrKeyLookupTable;
+private static Hashtable _styleKeyLookupTable;
+private static Hashtable _tagKeyLookupTable;
+
+private string _tagName;
+private string tabString;
+private static string[] _styleNameLookupArray;
+
+private RenderAttribute[] _attrList;
+private static AttributeInformation[] _attrNameLookupArray;
+private static TagInformation[] _tagNameLookupArray;
+private TagStackEntry[] _endTags;
+private RenderStyle[] _styleList;
+
+} //HtmlTextWriter
+
+struct AttributeInformation {
+ public bool encode;
+ public string name;
+
+ public AttributeInformation(string name, bool encode){
+ this.encode = encode;
+ this.name = name;
+ }
+}
+
+struct RenderAttribute {
+ public bool encode;
+ public HtmlTextWriterAttribute key;
+ public string name;
+ public string value;
+}
+
+struct RenderStyle {
+ public HtmlTextWriterStyle key;
+ public string name;
+ public string value;
+}
+
+struct TagInformation {
+ public string closingTag;
+ public string name;
+ public TagType tagType;
+
+ public TagInformation(string name, TagType tagType, string closingTag){
+ this.name = name;
+ this.tagType = tagType;
+ this.closingTag = closingTag;
+ }
+}
+
+struct TagStackEntry {
+ public string endTagText;
+ public HtmlTextWriterTag tagKey;
+}
+
+enum TagType {
+ Inline,
+ NonClosing,
+ Other
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs
new file mode 100644
index 00000000000..5b82723c5c3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterAttribute.cs
@@ -0,0 +1,54 @@
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+
+namespace System.Web.UI{
+
+public enum HtmlTextWriterAttribute {
+Accesskey,
+Align,
+Alt,
+Background,
+Bgcolor,
+Border,
+Bordercolor,
+Cellpadding,
+Cellspacing,
+Checked,
+Class,
+Cols,
+Colspan,
+Disabled,
+For,
+Height,
+Href,
+Id,
+Maxlength,
+Multiple,
+Name,
+Nowrap,
+Onchange,
+Onclick,
+ReadOnly,
+Rows,
+Rowspan,
+Rules,
+Selected,
+Size,
+Src,
+Style,
+Tabindex,
+Target,
+Title,
+Type,
+Valign,
+Value,
+Width,
+Wrap,
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs
new file mode 100644
index 00000000000..4955422d668
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterStyle.cs
@@ -0,0 +1,28 @@
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+
+namespace System.Web.UI{
+
+public enum HtmlTextWriterStyle {
+BackgroundColor,
+BackgroundImage,
+BorderCollapse,
+BorderColor,
+BorderStyle,
+BorderWidth,
+Color,
+FontFamily,
+FontSize,
+FontStyle,
+FontWeight,
+Height,
+TextDecoration,
+Width
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs
new file mode 100644
index 00000000000..f248979246a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/HtmlTextWriterTag.cs
@@ -0,0 +1,111 @@
+/* System.Web.UI
+* Authors
+* Leen Toelen (toelen@hotmail.com)
+*/
+
+
+namespace System.Web.UI{
+
+public enum HtmlTextWriterTag {
+Unknown,
+A,
+Acronym,
+Address,
+Area,
+B,
+Base,
+Basefont,
+Bdo,
+Bgsound,
+Big,
+Blockquote,
+Body,
+Br,
+Button,
+Caption,
+Center,
+Cite,
+Code,
+Col,
+Colgroup,
+Dd,
+Del,
+Dfn,
+Dir,
+Div,
+Dl,
+Dt,
+Em,
+Embed,
+Fieldset,
+Font,
+Form,
+Frame,
+Frameset,
+H1,
+H2,
+H3,
+H4,
+H5,
+H6,
+Head,
+Hr,
+Html,
+I,
+Iframe,
+Img,
+Input,
+Ins,
+Isindex,
+Kbd,
+Label,
+Legend,
+Li,
+Link,
+Map,
+Marquee,
+Menu,
+Meta,
+Nobr,
+Noframes,
+Noscript,
+Object,
+Ol,
+Option,
+P,
+Param,
+Pre,
+Q,
+Rt,
+Ruby,
+S,
+Samp,
+Script,
+Select,
+Small,
+Span,
+Strike,
+Strong,
+Style,
+Sub,
+Sup,
+Table,
+Tbody,
+Td,
+Textarea,
+Tfoot,
+Th,
+Thead,
+Title,
+Tr,
+Tt,
+U,
+Ul,
+Var,
+Wbr,
+Xml
+}
+
+
+} // namespace System.Web.UI.HtmlControls
+
diff --git a/mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs b/mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs
new file mode 100644
index 00000000000..be0984b2c8b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IAttributeAccessor.cs
@@ -0,0 +1,20 @@
+//
+// System.Web.UI.IAttributeAccessor.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IAttributeAccessor
+ {
+ string GetAttribute(string key);
+ void SetAttribute(string key, string value);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs b/mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs
new file mode 100644
index 00000000000..5ff7f00b2da
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IDataBindingsAccessor.cs
@@ -0,0 +1,20 @@
+//
+// System.Web.UI.IDataBindingsAccessor.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IDataBindingsAccessor
+ {
+ DataBindingCollection DataBindings {get;}
+ bool HasDataBindings {get;}
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/INamingContainer.cs b/mcs/class/System.Web/System.Web.UI/INamingContainer.cs
new file mode 100644
index 00000000000..659c5b60bed
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/INamingContainer.cs
@@ -0,0 +1,18 @@
+//
+// System.Web.UI.INamingContainer.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface INamingContainer
+ {
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IParserAccessor.cs b/mcs/class/System.Web/System.Web.UI/IParserAccessor.cs
new file mode 100644
index 00000000000..cad22017e9d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IParserAccessor.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.UI.IParserAccessor.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IParserAccessor
+ {
+ void AddParsedSubObject(object obj);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs b/mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs
new file mode 100644
index 00000000000..7d105cb7476
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IPostBackDataHandler.cs
@@ -0,0 +1,21 @@
+//
+// System.Web.UI.IPostBackDataHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+ public interface IPostBackDataHandler
+ {
+ bool LoadPostData(string postDataKey, NameValueCollection postCollection);
+ void RaisePostDataChangedEvent();
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs b/mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs
new file mode 100644
index 00000000000..daa6f70160c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IPostBackEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.UI.IPostBackEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IPostBackEventHandler
+ {
+ void RaisePostBackEvent(string eventArgument);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IStateManager.cs b/mcs/class/System.Web/System.Web.UI/IStateManager.cs
new file mode 100644
index 00000000000..4bcb6b8deb0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IStateManager.cs
@@ -0,0 +1,22 @@
+//
+// System.Web.UI.IStateManager.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IStateManager
+ {
+ void LoadViewState(object state);
+ object SaveViewState();
+ void TrackViewState();
+ bool IsTrackingViewState { get; }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs b/mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs
new file mode 100644
index 00000000000..da35c6b0ee8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ITagNameToTypeMapper.cs
@@ -0,0 +1,20 @@
+//
+// System.Web.UI.ITagNameToTypeMapper.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+using System.Collections;
+
+namespace System.Web.UI
+{
+ public interface ITagNameToTypeMapper
+ {
+ Type GetControlType(string tagName, IDictionary attribs);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ITemplate.cs b/mcs/class/System.Web/System.Web.UI/ITemplate.cs
new file mode 100644
index 00000000000..c9981859b37
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ITemplate.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.UI.ITemplate.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface ITemplate
+ {
+ void InstantiateIn(Control container);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/IValidator.cs b/mcs/class/System.Web/System.Web.UI/IValidator.cs
new file mode 100644
index 00000000000..47b418aee39
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/IValidator.cs
@@ -0,0 +1,21 @@
+//
+// System.Web.UI.IValidator.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public interface IValidator
+ {
+ void Validate();
+ string ErrorMessage {get; set;}
+ bool IsValid {get; set;}
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs b/mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs
new file mode 100644
index 00000000000..2bcc75881df
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ImageClickEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.UI.ImageClickEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public delegate void ImageClickEventHandler(object sender, ImageClickEventArgs e);
+}
diff --git a/mcs/class/System.Web/System.Web.UI/LiteralControl.cs b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs
new file mode 100644
index 00000000000..180c700dc9a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/LiteralControl.cs
@@ -0,0 +1,39 @@
+//
+// System.Web.UI.LiteralControl.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public class LiteralControl : Control
+ {
+ private string _text = String.Empty;
+ public LiteralControl() {}
+ public LiteralControl(string text)
+ {
+ _text = text;
+ }
+ public virtual string Text
+ {
+ get
+ {
+ return _text;
+ }
+ set
+ {
+ _text = value;
+ }
+ }
+ protected override void Render(HtmlTextWriter writer)
+ {
+ writer.Write(_text);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs b/mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs
new file mode 100644
index 00000000000..734131f2fb0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/OutputCacheLocation.cs
@@ -0,0 +1,23 @@
+//
+// System.Web.UI.OutputCacheLocation.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public enum OutputCacheLocation
+ {
+ Any,
+ Client,
+ Downstream,
+ None,
+ Server
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/Pair.cs b/mcs/class/System.Web/System.Web.UI/Pair.cs
new file mode 100644
index 00000000000..bf13fabdce8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Pair.cs
@@ -0,0 +1,36 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: Pair
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+ public class Pair
+ {
+ public object First;
+ public object Second;
+
+ public Pair(object first, object second)
+ {
+ First = first;
+ Second = second;
+ }
+
+ public Pair()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PersistanceMode.cs b/mcs/class/System.Web/System.Web.UI/PersistanceMode.cs
new file mode 100644
index 00000000000..4799d743c58
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PersistanceMode.cs
@@ -0,0 +1,22 @@
+//
+// System.Web.UI.PersistanceMode.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public enum PersistenceMode
+ {
+ Attribute,
+ EncodedInnerDefaultProperty,
+ InnerDefaultProperty,
+ InnerProperty
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/PropertyConverter.cs b/mcs/class/System.Web/System.Web.UI/PropertyConverter.cs
new file mode 100644
index 00000000000..d98e80f912a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/PropertyConverter.cs
@@ -0,0 +1,124 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: PropertyConverter
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Reflection;
+
+namespace System.Web.UI
+{
+ public sealed class PropertyConverter
+ {
+ private static Type[] parseMethodTypes;
+ private static Type[] parseMethodTypesWithSOP;
+
+ static PropertyConverter()
+ {
+ parseMethodTypes = new Type[1];
+ parseMethodTypes[0] = typeof(string);
+ parseMethodTypesWithSOP = new Type[2];
+ parseMethodTypesWithSOP[0] = typeof(string);
+ parseMethodTypesWithSOP[1] = typeof(IServiceProvider);
+ }
+
+ private PropertyConverter()
+ {
+ // Prevent any instance
+ }
+
+ public static object EnumFromString(Type enumType, string enumValue)
+ {
+ object retVal = null;
+ try
+ {
+ retVal = Enum.Parse(enumType, enumValue, true);
+ } catch
+ {
+ retVal = null;
+ }
+ return retVal;
+ }
+
+ public static string EnumToString(Type enumType, object enumValue)
+ {
+ string retVal = Enum.Format(enumType, enumValue, "G");
+ return retVal.Replace('_','-');
+ }
+
+ public static object ObjectFromString(Type objType, MemberInfo propertyInfo, string objValue)
+ {
+ if(objValue == null)
+ return null;
+ if(! (!objType.Equals(typeof(Boolean)) || objValue.Length > 0) )
+ {
+ return null;
+ }
+ if(objType.IsEnum)
+ {
+ return EnumFromString(objType, objValue);
+ }
+ if(objType.Equals(typeof(string)))
+ {
+ return objValue;
+ }
+ PropertyDescriptor pc = null;
+ if(propertyInfo != null)
+ {
+ pc = (TypeDescriptor.GetProperties(propertyInfo.ReflectedType))[propertyInfo.Name];
+ }
+ if(pc != null)
+ {
+ TypeConverter converter = pc.Converter;
+ if(converter!=null && converter.CanConvertFrom(typeof(string)))
+ {
+ return converter.ConvertFromInvariantString(objValue);
+ }
+ }
+ MethodInfo mi = objType.GetMethod("Parse", parseMethodTypesWithSOP);
+ object o = null;
+ if(mi != null)
+ {
+ object[] parameters = new object[2];
+ parameters[0] = objValue;
+ parameters[1] = CultureInfo.InvariantCulture;
+ try
+ {
+ o = Utils.InvokeMethod(mi, null, parameters);
+ } catch
+ {
+ }
+ }
+ if(o == null)
+ {
+ mi = objType.GetMethod("Parse", parseMethodTypes);
+ if(mi!=null)
+ {
+ object[] parameters = new object[1];
+ parameters[0] = objValue;
+ try
+ {
+ o = Utils.InvokeMethod(mi, null, parameters);
+ } catch
+ {
+ }
+ }
+ }
+ if(o == null)
+ {
+ throw new HttpException(/*HttpRuntime.FormatResourceString(*/"Type_not_creatable_from_string"/*, objType.FullName, objValue, propertyInfo.Name)*/);
+ }
+ return o;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/StateBag.cs b/mcs/class/System.Web/System.Web.UI/StateBag.cs
new file mode 100644
index 00000000000..fecb7a1c5b2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/StateBag.cs
@@ -0,0 +1,278 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: StateBag
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Web;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace System.Web.UI
+{
+ public sealed class StateBag : IStateManager, IDictionary, ICollection, IEnumerable
+ {
+ private bool ignoreCase;
+ private bool marked;
+ private IDictionary bag;
+
+ public StateBag(bool ignoreCase)
+ {
+ Initialize(ignoreCase);
+ }
+
+ public StateBag()
+ {
+ Initialize(false);
+ }
+
+ private void Initialize(bool ignoreCase)
+ {
+ this.ignoreCase = ignoreCase;
+ marked = false;
+ bag = new HybridDictionary(ignoreCase);
+ }
+
+ public int Count
+ {
+ get
+ {
+ return bag.Count;
+ }
+ }
+
+ public object this[object key]
+ {
+ get
+ {
+ string sKey = (string)key;
+ if(sKey==null || sKey.Length==0)
+ throw new ArgumentException(HttpRuntime.FormatResourceString("Key_Cannot_Be_Null"));
+ object val = bag[sKey];
+ if(val is StateItem)
+ return val;
+ return null;
+ }
+ set
+ {
+ Add((string)key, value);
+ }
+ }
+
+ public ICollection Keys
+ {
+ get
+ {
+ return bag.Keys;
+ }
+ }
+
+ public ICollection Values
+ {
+ get
+ {
+ return bag.Values;
+ }
+ }
+
+ public StateItem Add(string key, object value)
+ {
+ if(key == null || key.Length == 0)
+ {
+ throw new ArgumentException(HttpRuntime.FormatResourceString("Key_Cannot_Be_Null"));
+ }
+ StateItem val = null;
+ if(bag[key] is StateItem)
+ val = (StateItem)(bag[key]);
+ if(val==null)
+ {
+ if(value!=null || marked)
+ {
+ val = new StateItem(value);
+ bag.Add(key, val);
+ }
+
+ } else
+ {
+ if(value!=null && !marked)
+ bag.Remove(key);
+ val.Value = value;
+ }
+ if(val!=null && marked)
+ {
+ val.IsDirty = true;
+ }
+ return val;
+ }
+
+ public void Clear()
+ {
+ bag.Clear();
+ }
+
+ public IDictionaryEnumerator GetEnumerator()
+ {
+ return bag.GetEnumerator();
+ }
+
+ public bool IsItemDirty(string key)
+ {
+ object o = bag[key];
+ if(o is StateItem)
+ return ((StateItem)o).IsDirty;
+ return false;
+ }
+
+ public void Remove(string key)
+ {
+ bag.Remove(key);
+ }
+
+ /// <summary>
+ /// Undocumented
+ /// </summary>
+ public void SetItemDirty(string key, bool dirty)
+ {
+ if(bag[key] is StateItem)
+ ((StateItem)bag[key]).IsDirty = dirty;
+ }
+
+ internal bool IsTrackingViewState
+ {
+ get
+ {
+ return marked;
+ }
+ }
+
+ internal void LoadViewState(object state)
+ {
+ if(state!=null)
+ {
+ Pair pair = (Pair)state;
+ ArrayList keyList = (ArrayList)(pair.First);
+ ArrayList valList = (ArrayList)(pair.Second);
+ for(int i=0; i < keyList.Count; i++)
+ Add((string)keyList[i], valList[i]);
+ }
+ }
+
+ internal object SaveViewState()
+ {
+ if(bag.Count > 0)
+ {
+ ArrayList keyList = null, valList = null;
+ foreach(IDictionaryEnumerator current in bag)
+ {
+ StateItem item = (StateItem)current.Value;
+ if(item.IsDirty)
+ {
+ if(keyList==null)
+ {
+ keyList = new ArrayList();
+ valList = new ArrayList();
+ }
+ keyList.Add(current.Key);
+ valList.Add(current.Value);
+ }
+ }
+ if(keyList!=null)
+ return new Pair(keyList, valList);
+ }
+ return null;
+ }
+
+ internal void TrackViewState()
+ {
+ marked = true;
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ void IStateManager.LoadViewState(object savedState)
+ {
+ LoadViewState(savedState);
+ }
+
+ object IStateManager.SaveViewState()
+ {
+ return SaveViewState();
+ }
+
+ void IStateManager.TrackViewState()
+ {
+ TrackViewState();
+ }
+
+ bool IStateManager.IsTrackingViewState
+ {
+ get
+ {
+ return IsTrackingViewState;
+ }
+ }
+
+ void ICollection.CopyTo(Array array, int index)
+ {
+ Values.CopyTo(array, index);
+ }
+
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ void IDictionary.Add(object key, object value)
+ {
+ Add((string)key, value);
+ }
+
+ void IDictionary.Remove(object key)
+ {
+ Remove((string)key);
+ }
+
+ bool IDictionary.Contains(object key)
+ {
+ return bag.Contains((string)key);
+ }
+
+ bool IDictionary.IsFixedSize
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ bool IDictionary.IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/StateItem.cs b/mcs/class/System.Web/System.Web.UI/StateItem.cs
new file mode 100644
index 00000000000..81a425bbaac
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/StateItem.cs
@@ -0,0 +1,47 @@
+//
+// System.Web.UI.StateItem.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+using System;
+using System.Web;
+
+namespace System.Web.UI
+{
+ public sealed class StateItem
+ {
+ private bool _isDirty = false;
+ private object _value = null;
+ public bool IsDirty
+ {
+ get
+ {
+ return _isDirty;
+ }
+ set
+ {
+ _isDirty = value;
+ }
+ }
+ public object Value
+ {
+ get
+ {
+ return _value;
+ }
+ set
+ {
+ _value = value;
+ }
+ }
+ private StateItem() {}
+ internal StateItem(Object value)
+ {
+ _value = value;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/TODO b/mcs/class/System.Web/System.Web.UI/TODO
new file mode 100644
index 00000000000..de529b87f86
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/TODO
@@ -0,0 +1,42 @@
+AttributeCollection
+BaseParser
+BasePartialCachingControl
+CompiledTemplateBuilder
+ConstructorNeedsTagAttribute
+ControlBuilder
+ControlBuilderAttribute
+ControlCollection
+CssStyleCollection
+DataBinder
+DataBinding
+DataBindingCollection
+DataBindingHandlerAttribute
+DataBoundLiteralControl
+DesignTimeParseData
+DesignTimeTemplateParser
+EmptyControlCollection
+Html32TextWriter
+HtmlTextWriter
+ImageClickEventArgs
+LosFormatter
+Page
+PageParser
+ParseChildrenAttribute
+PartialCachingAttribute
+PartialCachingControl
+PersistChildrenAttribute
+PersistanceModeAttribute
+RootBuilder
+SimpleWebHandlerParser
+StateBag
+StaticPartialCachingControl
+TagPrefixAttribute
+TemplateBuilder
+TemplateContainerAttribute
+TemplateControl
+TemplateControlParser
+ToolboxDataAttribute
+UserControl
+ValidationPropertyAttribute
+ValidatorCollection
+WebServiceProvider
diff --git a/mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs b/mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs
new file mode 100644
index 00000000000..88bdd66227f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/ToolboxDataAttribute.cs
@@ -0,0 +1,58 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: ToolboxDataAttribute
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+
+namespace System.Web.UI
+{
+ [AttributeUsage(AttributeTargets.Class)]
+ public sealed class ToolboxDataAttribute : Attribute
+ {
+ public static readonly ToolboxDataAttribute Default = new ToolboxDataAttribute("");
+
+ private string data;
+
+ public ToolboxDataAttribute(string data)
+ {
+ this.data = data;
+ }
+
+ public string Data
+ {
+ get
+ {
+ return data;
+ }
+ }
+
+ public override bool IsDefaultAttribute()
+ {
+ return Default.Equals(this);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if(obj != null && obj is ToolboxDataAttribute)
+ {
+ ToolboxDataAttribute tda = (ToolboxDataAttribute)obj;
+ return (tda.Data == Data);
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.UI/Utils.cs b/mcs/class/System.Web/System.Web.UI/Utils.cs
new file mode 100644
index 00000000000..48138375e13
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.UI/Utils.cs
@@ -0,0 +1,46 @@
+/**
+ * Namespace: System.Web.UI
+ * Class: Utils
+ *
+ * Author: Gaurav Vaish
+ * Maintainer-> gvaish@iitk.ac.in
+ * Implementation: yes
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Reflection;
+
+namespace System.Web.UI
+{
+ internal class Utils
+ {
+ internal static object InvokeMethod(MethodInfo info, object obj, object[] parameters)
+ {
+ object retVal = null;
+ try
+ {
+ retVal = info.Invoke(obj, parameters);
+ } catch(TargetInvocationException tie)
+ {
+ throw tie.InnerException;
+ }
+ return retVal;
+ }
+
+ internal static string GetClientValidatedEvent(/*Page page*/)
+ {
+ return "if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();";
+ }
+
+ internal static string GetClientValidatedPostBack(Control control)
+ {
+ return (" { if (typeof(Page_ClientValidate) != 'function' || Page_ClientValidate()) " +
+ control.Page.GetPostBackEventReference(control) +
+ " } " );
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/.cvsignore b/mcs/class/System.Web/System.Web.Utils/.cvsignore
new file mode 100644
index 00000000000..04bc145deea
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/.cvsignore
@@ -0,0 +1 @@
+_*
diff --git a/mcs/class/System.Web/System.Web.Utils/ApacheVersionInfo.cs b/mcs/class/System.Web/System.Web.Utils/ApacheVersionInfo.cs
new file mode 100644
index 00000000000..b166b32b8d5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/ApacheVersionInfo.cs
@@ -0,0 +1,31 @@
+/**
+ * Namespace: System.Web.Utils
+ * Class: ApacheVersionInfo
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.Utils
+{
+ /// <summary>
+ /// Versions of the modules related to Apache
+ /// </summary>
+ /// <remarks>
+ /// At present I don't know what modules are to be loaded and how
+ /// </remarks>
+ /// <see>
+ /// System.Web.Utils.IISVersionInfo
+ /// </see>
+ internal class ApacheVersionInfo
+ {
+ public ApacheVersionInfo()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/ChangeLog b/mcs/class/System.Web/System.Web.Utils/ChangeLog
new file mode 100644
index 00000000000..e027d138da4
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/ChangeLog
@@ -0,0 +1,57 @@
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * FileChangesMonitor.cs: remove redundant using statement; use int
+ for MAXLEN; capitalize correctly 'WebHashCodeProvider';
+ fix typo rsLock -> rwLock; Change IsRooted to IsPathRooted;
+ set out parameter value where needed
+ * FilePathParser.cs: qualify method GetPathRoot() with 'Path.'
+ * IISVersionInfo.cs: initialize static member to avoid compile error.
+ * WebEqualComparer.cs: static member defC shouldn't be readonly;
+ the string comparer had some typos (fixed)
+ * WebHashCodeProvider.cs: needed System.Globalization; static member
+ defHcp shouldn't be readonly; remove double equal typo.
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * FileAction.cs: Use 0x7FFFFFFF as enum value for error. 0xFFFFFFFF
+ is too big for Int32.
+ * FileChangeEventHandler.cs: put missing 'void' return type on delegate
+ FileChangeEventHandler()
+ * FileChangedEventArgs.cs: ditto for FileChangedEvent()
+ * NativeFileChangeEventHandler.cs: ditto for NativeFileChangeEventHandler()
+ * FileChangesMonitor.cs: add needed namespaces and comment out imcomplete
+ code.
+
+2001-12-21 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * ApacheVersionInfo.cs - Dummy class, for later use.
+ * FileAction.cs:
+ * FileChangeEventHandler.cs:
+ * FileChangeEventArgs.cs:
+ * FileChangesMonitor.cs:
+ * NativeFileChangeEventHandler.cs
+ - To be used in System.Web/Http* classes.
+ Initially needed for HttpRuntime
+ * IISVersionInfo.cs - Some useful methods
+
+
+2001-12-17 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * UrlUtils.cs - Added functions Combine and Reduce
+
+2001-12-16 Miguel de Icaza <miguel@ximian.com>
+
+ * DataSourceHelper.cs, UrlUtils.cs: Set the correct namespace.
+
+2001-11-30
+ Gaurav Vaish <gvaish@iitk.ac.in>
+ * DataSourceHelper.cs - Resolving DataSource objects
+
+2001-11-09
+ Gaurav Vaish <gvaish@iitk.ac.in>
+ * UrlUtil.cs - Some basic functions
+
+2001-11-08
+ Gaurav Vaish <gvaish@iitk.ac.in>
+ * Namespace - Created the namespace for commonly used,
+ otherwise not available functions \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web.Utils/DataSourceHelper.cs b/mcs/class/System.Web/System.Web.Utils/DataSourceHelper.cs
new file mode 100644
index 00000000000..35efcfa749d
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/DataSourceHelper.cs
@@ -0,0 +1,72 @@
+/**
+ * Namespace: System.Web.UI.Utils
+ * Class: DataSourceHelper
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Status: 10%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.Web.Utils
+{
+ internal class DataSourceHelper
+ {
+ public static IEnumerable GetResolvedDataSource(object source, string member)
+ {
+ if(source==null)
+ return null;
+ if(source is IListSource)
+ {
+ IListSource ils = (IListSource)source;
+ IList il = ils.GetList();
+ if(ils.ContainsListCollection)
+ {
+ return il;
+ }
+ if(il is ITypedList)
+ {
+ ITypedList itl = (ITypedList)il;
+ PropertyDescriptorCollection pdc = itl.GetItemProperties(new PropertyDescriptor[0]);
+ PropertyDescriptor pd = null;
+ if(pdc != null)
+ {
+ if(pdc.Count > 0)
+ {
+ if(member != null)
+ {
+ if(member.Length > 0)
+ {
+ pd = pdc.Find(member, true);
+ } else
+ {
+ pd = pdc[0];
+ }
+ }
+ }
+ }
+ if(pd!=null)
+ {
+ object o = pd.GetValue(il[0]);
+ if(o!=null)
+ {
+ if(o is IEnumerable)
+ return (IEnumerable)o;
+ }
+ throw new HttpException("ListSource Empty"); // no data in ListSource object
+ }
+ }
+ } else if(source is IEnumerable)
+ {
+ return (IEnumerable)source;
+ }
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/FileAction.cs b/mcs/class/System.Web/System.Web.Utils/FileAction.cs
new file mode 100644
index 00000000000..7de90d2aead
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/FileAction.cs
@@ -0,0 +1,26 @@
+/**
+ * Namespace: System.Web.Utils
+ * 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)
+ */
+
+namespace System.Web.Utils
+{
+ public enum FileAction
+ {
+ Overwhleming,
+ Added,
+ Removed,
+ Modifiled,
+ RenamedOldName,
+ RenamedNewName,
+ Error = 0x7FFFFFFF
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/FileChangeEventHandler.cs b/mcs/class/System.Web/System.Web.Utils/FileChangeEventHandler.cs
new file mode 100644
index 00000000000..e202fbcb503
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/FileChangeEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.Utils
+ * 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)
+ */
+
+namespace System.Web.Utils
+{
+ public delegate void FileChangeEventHandler(object sender, int method);
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/FileChangedEventArgs.cs b/mcs/class/System.Web/System.Web.Utils/FileChangedEventArgs.cs
new file mode 100644
index 00000000000..909711dbbe2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/FileChangedEventArgs.cs
@@ -0,0 +1,43 @@
+/**
+ * Namespace: System.Web.Utils
+ * Class: FileChangedEventArgs
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+namespace System.Web.Utils
+{
+ internal class FileChangedEventArgs : EventArgs
+ {
+ private string filename;
+ private FileAction action;
+
+ public void FileChangedEvent(FileAction action, string file)
+ {
+ this.action = action;
+ this.filename = file;
+ }
+
+ public string FileName
+ {
+ get
+ {
+ return filename;
+ }
+ }
+
+ public FileAction Action
+ {
+ get
+ {
+ return action;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/FileChangesMonitor.cs b/mcs/class/System.Web/System.Web.Utils/FileChangesMonitor.cs
new file mode 100644
index 00000000000..7d288ca0515
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/FileChangesMonitor.cs
@@ -0,0 +1,62 @@
+/**
+ *
+ * Namespace: System.Web.Utils
+ * Class: FileChangesMonitor
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.IO;
+using System.Web;
+using System.Runtime.InteropServices;
+using System.Collections;
+using System.Threading;
+
+namespace System.Web.Utils
+{
+ internal class FileChangesMonitor
+ {
+ private static string BIN = "bin";
+ private static string BINDIR = "bin/";
+ private static int MAXLEN = 260;
+
+ private FileChangeEventHandler cbRename;
+ private NativeFileChangeEventHandler cbSubDirs;
+
+ private int monitoredSubdirs;
+ private string rootDir;
+ private Hashtable allDirs;
+ private GCHandle rootcbSubDirs;
+
+ private ReaderWriterLock rwLock;
+
+ public FileChangesMonitor()
+ {
+ allDirs = new Hashtable(WebHashCodeProvider.Default, WebEqualComparer.Default);
+ rwLock = new ReaderWriterLock();
+ }
+
+ /// <param name="file">Name of the file</param>
+ /// <param name="mTime">Last modification date</param>
+ /// <param name="length">Legnth of the file</param>
+ [MonoTODO]
+ public void GetFileAttributes(string file, out DateTime mTime, long length)
+ {
+ if(!Path.IsPathRooted(file))
+ {
+ throw new HttpException(HttpRuntime.FormatResourceString("Path_must_be_rooted"));
+ }
+ // TODO: finish this
+ mTime = DateTime.Now;
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/FilePathParser.cs b/mcs/class/System.Web/System.Web.Utils/FilePathParser.cs
new file mode 100644
index 00000000000..25bd7740a98
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/FilePathParser.cs
@@ -0,0 +1,82 @@
+/**
+ * Namespace: System.Web.Utils
+ * Class: FilePathParser
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+using System.IO;
+
+namespace System.Web.Utils
+{
+ internal class FilePathParser
+ {
+ private static char[] pathSeparators = {
+ Path.DirectorySeparatorChar,
+ Path.AltDirectorySeparatorChar
+ };
+
+ private string dirName;
+ private string fileName;
+ private string shortDirName;
+ private string shortFileName;
+
+ private bool exists;
+
+ [MonoTODO]
+ public FilePathParser(string path, bool isFile, bool getShortNames)
+ {
+ path = path.Trim();
+ if(Path.GetPathRoot(path).Length < path.Length)
+ {
+ path = path.TrimEnd(pathSeparators);
+ }
+ if(!isFile)
+ {
+ dirName = GetBaseDirOrRoot(path);
+ } else
+ {
+ dirName = path;
+ }
+ if(getShortNames)
+ {
+ if(!Directory.Exists(dirName))
+ {
+ dirName = null;
+ return;
+ }
+ shortDirName = GetShortPathName(dirName);
+ if(shortDirName==null)
+ {
+ dirName = null;
+ return;
+ }
+ if(shortDirName == dirName)
+ {
+ shortDirName = null;
+ } else
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+
+ public static string GetBaseDirOrRoot(string file)
+ {
+ string bDir = Path.GetDirectoryName(file);
+ return ( bDir!=null ? bDir : Path.GetPathRoot(file));
+ }
+
+ [MonoTODO("Native_Call_Required")]
+ public static string GetShortPathName(string path)
+ {
+ //TODO: Native calls required, it's in kernel32.dll for windows
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/IISVersionInfo.cs b/mcs/class/System.Web/System.Web.Utils/IISVersionInfo.cs
new file mode 100644
index 00000000000..fce89988b12
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/IISVersionInfo.cs
@@ -0,0 +1,110 @@
+/**
+
+ * Namespace: System.Web.Utils
+ * Class: IISVersionInfo
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: ??%
+
+ *
+
+ * (C) Gaurav Vaish (2001)
+
+ */
+
+
+using System;
+using System.Diagnostics;
+using System.Web;
+using System.Web.Utils;
+
+namespace System.Web.Utils
+{
+ //FIXME: This is highly Windows/IIS specific code. What about Apache related stuff?
+ internal class IISVersionInfo
+ {
+ private static string isapiVersion;
+ private static string mscoreeVersion;
+ private static string systemWebVersion;
+
+ private static readonly object lockObj = null;
+
+ public IISVersionInfo()
+ {
+ }
+
+ internal static string IsapiVersion
+ {
+ get
+ {
+ if(isapiVersion==null)
+ {
+ lock(lockObj)
+ {
+ // Recheck - another thread may have set the value
+ // before entering lock / exiting previous lock
+ if(isapiVersion==null)
+ {
+ //FIXME: What about Apache? What dll/shared-object to be loaded?
+ isapiVersion = GetLoadedModuleVersion("aspnet_isapi.dll");
+ }
+ }
+ }
+ return isapiVersion;
+ }
+ }
+
+ internal static string ClrVersion
+ {
+ get
+ {
+ if(mscoreeVersion==null)
+ {
+ lock(lockObj)
+ {
+ if(mscoreeVersion==null)
+ {
+ mscoreeVersion = GetLoadedModuleVersion("mscorlib.dll");
+ }
+ }
+ }
+ return mscoreeVersion;
+ }
+ }
+
+ internal static string SystemWebVersion
+ {
+ get
+ {
+ if(systemWebVersion == null)
+ {
+ lock(lockObj)
+ {
+ if(systemWebVersion==null)
+ {
+ systemWebVersion = (FileVersionInfo.GetVersionInfo((typeof(HttpRuntime)).Module.FullyQualifiedName)).FileVersion;
+ }
+ }
+ }
+ return systemWebVersion;
+ }
+ }
+
+ [MonoTODO]
+ internal static string GetLoadedModuleVersion(string modulename)
+ {
+ //TODO: Load the version information from the module
+ // Needs native calls - which ones, since the module will not be .Net aware
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ internal static string GetLoadedModuleFilename(string modulename)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/NativeFileChangeEventHandler.cs b/mcs/class/System.Web/System.Web.Utils/NativeFileChangeEventHandler.cs
new file mode 100644
index 00000000000..6047a52688b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/NativeFileChangeEventHandler.cs
@@ -0,0 +1,17 @@
+/**
+ * Namespace: System.Web.Utils
+ * 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)
+ */
+
+namespace System.Web.Utils
+{
+ public delegate void NativeFileChangeEventHandler(object sender, int method);
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/UrlUtils.cs b/mcs/class/System.Web/System.Web.Utils/UrlUtils.cs
new file mode 100644
index 00000000000..5da94a47ac6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/UrlUtils.cs
@@ -0,0 +1,283 @@
+/**
+ * Namespace: System.Web.UI.Utils
+ * Class: UrlUtils
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Status: ??%
+ *
+ * (C) Gaurav Vaish (2001)
+ */
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace System.Web.Utils
+{
+ internal class UrlUtils
+ {
+ /*
+ * I could not find these functions in the class System.Uri
+ * Besides, an instance of Uri will not be formed until and unless the address is of
+ * the form protocol://[user:pass]host[:port]/[fullpath]
+ * ie, a protocol, and that too without any blanks before,
+ * is a must which may not be the case here.
+ * Important: Escaped URL is assumed here. nothing like .aspx?path=/something
+ * It should be .aspx?path=%2Fsomething
+ */
+ public static string GetProtocol(string url)
+ {
+ //Taking code from Java Class java.net.URL
+ if(url!=null)
+ {
+ if(url.Length>0)
+ {
+
+ int i, start = 0, limit;
+ limit = url.Length;
+ char c;
+ bool aRef = false;
+ while( (limit > 0) && (url[limit-1] <= ' '))
+ {
+ limit --;
+ }
+ while( (start < limit) && (url[start] <= ' '))
+ {
+ start++;
+ }
+ if(RegionMatches(true, url, start, "url:", 0, 4))
+ {
+ start += 4;
+ }
+ if(start < url.Length && url[start]=='#')
+ {
+ aRef = true;
+ }
+ for(i = start; !aRef && (i < limit) && ((c=url[i]) != '/'); i++)
+ {
+ if(c==':')
+ {
+ return url.Substring(start, i - start);
+ }
+ }
+ }
+ }
+ return String.Empty;
+ }
+
+ public static bool IsRelativeUrl(string url)
+ {
+ if(url.IndexOf(':') != -1)
+ return !IsRootUrl(url);
+ return true;
+ }
+
+ public static bool IsRootUrl(string url)
+ {
+ if(url!=null)
+ {
+ if(url.Length>0)
+ {
+ return IsValidProtocol(GetProtocol(url).ToLower());
+ }
+ }
+ return true;
+ }
+
+ public static bool IsRooted(string path)
+ {
+ if(path!=null && path.Length > 0)
+ {
+ return (path[0]=='/' || path[0]=='\\');
+ }
+ return false;
+ }
+
+ public static void FailIfPhysicalPath(string path)
+ {
+ if(path!= null && path.Length > 0)
+ {
+ if(path[0]==':' || path.StartsWith(@"\\"))
+ throw new HttpException(HttpRuntime.FormatResourceString("Physical_path_not_allowed", path));
+ }
+ }
+
+ public static string Combine(string basePath, string relPath)
+ {
+ FailIfPhysicalPath(relPath);
+ if(IsRootUrl(relPath))
+ {
+ if(relPath != null && relPath.Length > 0)
+ {
+ return Reduce(relPath);
+ }
+ return String.Empty;
+ }
+ if(relPath.Length < 3 || relPath[0]!='~' || (relPath[0]!='/' && relPath[0]!='\\'))
+ {
+ if(basePath==null || basePath.Length==1 || basePath[0]=='/')
+ basePath = String.Empty;
+ return Reduce(basePath + "/" + relPath);
+ }
+ string vPath = HttpRuntime.AppDomainAppVirtualPath;
+ if(vPath.Length <= 1)
+ vPath = String.Empty;
+ return Reduce(vPath + "/" + relPath.Substring(2));
+ }
+
+ public static bool IsValidProtocol(string protocol)
+ {
+ if(protocol.Length < 1)
+ return false;
+ char c = protocol[0];
+ if(!Char.IsLetter(c))
+ {
+ return false;
+ }
+ for(int i=1; i < protocol.Length; i++)
+ {
+ c = protocol[i];
+ if(!Char.IsLetterOrDigit(c) && c!='.' && c!='+' && c!='-')
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /*
+ * MakeRelative("http://www.foo.com/bar1/bar2/file","http://www.foo.com/bar1")
+ * will return "bar2/file"
+ * while MakeRelative("http://www.foo.com/bar1/...","http://www.anotherfoo.com")
+ * return 'null' and so does the call
+ * MakeRelative("http://www.foo.com/bar1/bar2","http://www.foo.com/bar")
+ */
+ public static string MakeRelative(string fullUrl, string relativeTo)
+ {
+ if(fullUrl==relativeTo)
+ {
+ return String.Empty;
+ }
+ if(fullUrl.IndexOf(relativeTo)!=0)
+ {
+ return null;
+ }
+ string leftOver = fullUrl.Substring(relativeTo.Length);
+ if(!fullUrl.EndsWith("/") && !leftOver.StartsWith("/"))
+ {
+ return null;
+ }
+ if(leftOver.StartsWith("/"))
+ {
+ leftOver = leftOver.Substring(1);
+ }
+ return leftOver;
+ }
+
+ /*
+ * Check JavaDocs for java.lang.String#RegionMatches(bool, int, String, int, int)
+ * Could not find anything similar in the System.String class
+ */
+ public static bool RegionMatches(bool ignoreCase, string source, int start, string match, int offset, int len)
+ {
+ if(source!=null || match!=null)
+ {
+ if(source.Length>0 && match.Length>0)
+ {
+ char[] ta = source.ToCharArray();
+ char[] pa = match.ToCharArray();
+ if((offset < 0) || (start < 0) || (start > (source.Length - len)) || (offset > (match.Length - len)))
+ {
+ return false;
+ }
+ while(len-- > 0)
+ {
+ char c1 = ta[start++];
+ char c2 = pa[offset++];
+ if(c1==c2)
+ continue;
+ if(ignoreCase)
+ {
+ if(Char.ToUpper(c1)==Char.ToUpper(c2))
+ continue;
+ // Check for Gregorian Calendar where the above may not hold good
+ if(Char.ToLower(c1)==Char.ToLower(c2))
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static string Reduce(string path)
+ {
+ int len = path.Length;
+ int dotIndex = -1;
+ path = path.Replace('\\','/');
+ while(true)
+ {
+ dotIndex++;
+ dotIndex = path.IndexOf('.', dotIndex);
+ if(dotIndex < 0)
+ {
+ return path;
+ }
+ if(dotIndex != 0 && path[dotIndex -1]=='/')
+ continue;
+ if(dotIndex+1 == len || path[dotIndex+1]=='/')
+ break;
+ if(path[dotIndex+1]=='.')
+ continue;
+ if(dotIndex+2 == len || path[dotIndex+2]=='/')
+ break;
+ }
+ ArrayList list = new ArrayList();
+ StringBuilder sb = new StringBuilder();
+ dotIndex = 0;
+ int temp;
+ do
+ {
+ temp = dotIndex;
+ dotIndex = path.IndexOf('/', temp + 1);
+ if(dotIndex < 0)
+ dotIndex = len;
+ if( (dotIndex - temp) <= 3 && (dotIndex < 1 || path[dotIndex - 1]== '.') && ( (temp+1) >= len || path[temp+1]=='.') )
+ {
+ if(dotIndex - temp == 3)
+ continue;
+ if(list.Count == 0)
+ throw new System.Web.HttpException(System.Web.HttpRuntime.FormatResourceString("Cannot_exit_up_top_directory"));
+ sb.Length = (int) list[list.Count - 1];
+ list.RemoveRange(list.Count - 1, 1);
+ continue;
+ }
+ list.Add(sb.Length);
+ sb.Append(path, temp, dotIndex - temp);
+ } while(dotIndex != len);
+ return sb.ToString();
+ }
+
+ public static string GetDirectory(string url)
+ {
+ if(url==null)
+ {
+ return null;
+ }
+ if(url.Length==0)
+ {
+ return String.Empty;
+ }
+ url.Replace('\\','/');
+ string baseDir = url.Substring(0, url.LastIndexOf('/'));
+ if(baseDir.Length==0)
+ {
+ baseDir = "/";
+ }
+ return baseDir;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/WebEqualComparer.cs b/mcs/class/System.Web/System.Web.Utils/WebEqualComparer.cs
new file mode 100644
index 00000000000..ee570dd34c6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/WebEqualComparer.cs
@@ -0,0 +1,107 @@
+/**
+ * Namespace: System.Web.Utils
+ * 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)
+ */
+
+using System;
+using System.Globalization;
+using System.Collections;
+
+namespace System.Web.Utils
+{
+ public class WebEqualComparer : IComparer
+ {
+ private static IComparer defC;
+
+ public WebEqualComparer()
+ {
+ }
+
+ public static IComparer Default
+ {
+ get
+ {
+ if(defC == null)
+ {
+ defC = new WebEqualComparer();
+ }
+ return defC;
+ }
+ }
+
+ /// <summary>
+ /// To compare two strings
+ /// </summary>
+ /// <remarks>
+ /// Cannot apply String.Compare(..) since I am at web
+ /// </remarks>
+ int IComparer.Compare(object left, object right)
+ {
+ string leftStr, rightStr;
+ leftStr = null;
+ rightStr = null;
+ if(left is string)
+ {
+ leftStr = (string)left;
+ }
+ if(right is string)
+ {
+ rightStr = (string)right;
+ }
+
+ if(leftStr==null || rightStr==null)
+ {
+ throw new ArgumentException();
+ }
+
+ int ll = leftStr.Length;
+ int lr = rightStr.Length;
+ if(ll==0 && lr==0)
+ {
+ return 0;
+ }
+
+ if(ll==0 || lr==0)
+ {
+ return ( (ll > 0) ? 1 : -1);
+ }
+
+ char cl,cr;
+ int i=0;
+ for(i=0; i < leftStr.Length; i++)
+ {
+ if(i==lr)
+ {
+ return 1;
+ }
+ cl = leftStr[i];
+ cr = leftStr[i];
+ if(cl==cr)
+ {
+ continue;
+ }
+ UnicodeCategory ucl = Char.GetUnicodeCategory(cl);
+ UnicodeCategory ucr = Char.GetUnicodeCategory(cr);
+ if(ucl==ucr)
+ {
+ return ( (cl > cr) ? 1 : -1 );
+ }
+ cl = Char.ToLower(cl);
+ cr = Char.ToLower(cr);
+ if(cl!=cr)
+ {
+ return ( (cl > cr) ? 1 : -1);
+ }
+ }
+ return ( (i==lr) ? 0 : -1 );
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.Utils/WebHashCodeProvider.cs b/mcs/class/System.Web/System.Web.Utils/WebHashCodeProvider.cs
new file mode 100644
index 00000000000..a2db4a4577f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.Utils/WebHashCodeProvider.cs
@@ -0,0 +1,54 @@
+/**
+
+ * Namespace: System.Web.Utils
+ * 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)
+
+ */
+
+
+using System.Collections;
+using System.Globalization;
+
+namespace System.Web.Utils
+{
+ public class WebHashCodeProvider : IHashCodeProvider
+ {
+ private static IHashCodeProvider defHcp;
+
+ public WebHashCodeProvider()
+ {
+ }
+
+ int IHashCodeProvider.GetHashCode(object key)
+ {
+ return Default.GetHashCode(key);
+ }
+
+ public static IHashCodeProvider Default
+ {
+ get
+ {
+ if(defHcp==null)
+ {
+ defHcp = new CaseInsensitiveHashCodeProvider(CultureInfo.InvariantCulture);
+ }
+ return defHcp;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web.build b/mcs/class/System.Web/System.Web.build
new file mode 100644
index 00000000000..2fd7bb70d8e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web.build
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.Web.dll -->
+
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.Web.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0169"/>
+ <arg value="/nowarn:0679"/> <!-- internal virual -->
+ <arg value="/nowarn:0168"/> <!-- never used variable -->
+ <arg value="/nowarn:0162"/> <!-- unreachable code -->
+ <arg value="/unsafe"/>
+ <arg value="/r:System.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ <includes name="System.Web.Hosting/ApplicationHost.cs"/>
+ <includes name="System.Web.Hosting/SimpleWorkerRequest.cs.cs"/>
+ <excludes name="System.Web.Hosting/ISAPIRuntime.cs"/>
+ <excludes name="System.Web.Hosting/IISAPIRuntime.cs"/>
+ <excludes name="System.Web.Hosting/IAppDomainFactory.cs"/>
+ <excludes name="System.Web.Hosting/AppDomainFactory.cs"/>
+ <!--<excludes name="System.Web.UI/**"/>-->
+ <excludes name="System.Web.UI.HtmlControls/**"/>
+ <!--<excludes name="System.Web.UI.WebControls/**"/>-->
+ <excludes name="System.Web/HttpCacheValidateHandler.cs"/>
+ </sources>
+ </csc>
+ </target>
+</project>
diff --git a/mcs/class/System.Web/System.Web/.cvsignore b/mcs/class/System.Web/System.Web/.cvsignore
new file mode 100644
index 00000000000..04bc145deea
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/.cvsignore
@@ -0,0 +1 @@
+_*
diff --git a/mcs/class/System.Web/System.Web/BeginEventHandler.cs b/mcs/class/System.Web/System.Web/BeginEventHandler.cs
new file mode 100644
index 00000000000..c2bd1ac2782
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/BeginEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.BeginEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web
+{
+ public delegate IAsyncResult BeginEventHandler(object sender,
+ EventArgs e,
+ AsyncCallback cb,
+ object extraData);
+}
diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog
new file mode 100644
index 00000000000..dd4104f6ed1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ChangeLog
@@ -0,0 +1,148 @@
+2002-04-12 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpApplication.cs: Minor updates
+ * HttpApplicationState.cs: Ready.
+ * HttpClientCertificate.cs: Signature updates
+ * HttpValueCollection.cs: ready
+ * HttpStaticObjectsCollection.cs: ready
+ * HttpResponseHeader.cs: made internal only
+ * HttpResponse.cs: Signature updates
+ * HttpPostedFile.cs: ready
+ * HttpCacheVaryByHeaders.cs: ready (except communication to policy)
+ * HttpCacheVaryByParams.cs: ready (except communication to policy)
+
+ System.Web is now over 60% ready..
+
+2002-04-11 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpException.cs: 95% ready, only windows dependent code left
+ * HttpFileCollection.cs: Finished.
+ * HttpRequest.cs: Minor fixes and fixed signature problems
+ * HttpResponse.cs: Implementation of missing methods and signature problems
+ * HttpResponseHeader.cs: Fixed signature problems
+ * HttpRuntime.cs: Fixed signature problems
+ * HttpServerUtility.cs: Added support for HttpApplication
+ * HttpSessionState.cs: Fixed signature issues
+ * HttpUtility.cs: fixed signature issues
+ * HttpValueCollection.cs: Support for cookie parsing and fixed signature issues
+ * HttpWorkerRequest.cs: Fixed small signature issue
+ * HttpWriter.cs: Fixed signature issue
+ * HttpApplication.cs: Basic implementation
+ * HttpApplicationState.cs: Small fixes to support major change comming up
+ * HttpBrowserCapabilities.cs: Added Type method
+ * HttpClientCertificate.cs: Almost ready, needs to parse certificate.
+ * HttpContext.cs: Fixed signature issues and added last methods.
+ * HttpCookie.cs: Full implementation
+ * HttpCookieCollection.cs: Full implementation
+ * TraceContext.cs: Methods implemented.
+ * HttpPostedFile.cs: Placeholder
+ * HttpStaticObjectsCollection.cs: Placeholder
+ * HttpModuleCollection.cs: Ready, will be used during the major revamp.
+
+ * Fixed a number of other small signature problems also (class status page)
+
+
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpWorkerRequest.EndOfSendNotification.cs Removed (included in WorkerRequest)
+ * Checkin of all new files (noted in last changenote)
+
+2002-04-10 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * HttpContext.cs: First implementation (basic support, few methods left to impl)
+ * HttpException.cs: Partial implementation (basic support)
+ * HttpHelper.cs: Header parse helper, used by runtime (non public)
+ * HttpRequest.cs: Implementation (all methods there, not all fully impl)
+ * HttpRequestStream.cs: Full implementation
+ * HttpResponse.cs: Partial implementation(almost all methods)
+ * HttpResponseHeader.cs: Header helper
+ * HttpResponseStream.cs: Full implementation - Response stream support
+ * HttpResponseStreamProxy.cs: Implementation - filter support
+ * HttpRuntime.cs: Rewrite to support one IHttpModule (use for testing the runtime)
+ * HttpServerUtility.cs: Implemented usage of HttpContext for methods
+ and moved encoding functions to HttpUtility.
+
+ * HttpUtility.cs: Added encoding/decoding functions from HttpServerUtility and
+ added the Attribute encoding functions.
+
+ * HttpValueCollection.cs: Implementation.
+ * HttpWorkerRequest.cs: Rewrite and implementation of all methods (ready)
+ * HttpWriter.cs: Implementation (with filter support)
+
+ * HttpFileCollection: Added dummy class (placeholder)
+ * HttpApplication.cs: Added dummy class (placeholder)
+ * HttpApplicationState.cs: Added dummy class (placeholder)
+ * HttpBrowserCapabilities.cs: Added dummy class (placeholder)
+ * HtttpCachePolicy.cs: Added dummy class (placeholder)
+ * HttpClientCertificate.cs: Added dummy class (placeholder)
+ * HttpSessionState.cs: Added dummy class (placeholder)
+ * TraceContext.cs: Added dummy class (placeholder)
+
+
+2002/04/10 Nick Drochak <ndrochak@gol.com>
+
+ * HttpServerUtility.cs: Fix build breaker.
+
+2002-03-28 Wictor Wilén <wictor@iBizkit.se>
+
+ * HttpServerUtils.cs : Added some more functionality
+
+2002-03-28 Martin Baulig <martin@gnome.org>
+
+ * HttpServerUtils.cs (UrlDecode): You cannot implicitly cast a
+ char to a string, use ToString() instead.
+
+2002-03-16 Gaurav Vaish <gavish@iitk.ac.in>
+
+ * WebCategoryAttribute.cs
+ : Added private attribute.
+
+2002-03-16 Gaurav Vaish <gavish@iitk.ac.in>
+
+ * HttpRuntime.cs : Stubbed methods for
+ FormatStringResource(...) in agreement with the various
+ overloads available at String.Format(...)
+
+2002-01-08 Gaurav Vaish <gavish@iitk.ac.in>
+
+ * TODOAttribute.cs : Added, as an internal class to the assembly
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * HttpRuntime.cs: remove uneeded exception variable from catch and
+ initialize remaining instance members to avoid compile warnings
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * HttpRuntime.cs: fix spelling error/variable name change.
+
+2001-12-18 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * HttpRuntime.cs : Initial implementation
+
+2001-08-29 Bob Smith <bob@thestuff.net>
+
+ * HttpWorkerRequest.cs: Partial Implementation.
+
+2001-08-16 Bob Smith <bob@thestuff.net>
+
+ * HttpCookieCollection.cs, HttpCookie.cs: Bug fixes.
+
+2001-08-09 Bob Smith <bob@thestuff.net>
+
+ * BeginEventHandler.cs: Implemented.
+ * EndEventHandler.cs: Implemented.
+ * HttpCacheability.cs: Implemented.
+ * HttpCacheRevalidation.cs: Implemented.
+ * HttpCacheValidateHandler.cs: Implemented.
+ * HttpCookieCollection.cs: Implemented.
+ * HttpCookie.cs: Implemented.
+ * HttpValidationStatus.cs: Implemented.
+ * HttpWorkerRequest.EndOfSendNotification.cs: Implemented.
+ * IHttpAsyncHandler.cs: Implemented.
+ * IHttpHandler.cs: Implemented.
+ * IHttpHandlerFactory.cs: Implemented.
+ * IHttpModule.cs: Implemented.
+ * ProcessShutdownReason.cs: Implemented.
+ * ProcessStatus.cs: Implemented.
+ * TraceMode.cs: Implemented.
diff --git a/mcs/class/System.Web/System.Web/EndEventHandler.cs b/mcs/class/System.Web/System.Web/EndEventHandler.cs
new file mode 100644
index 00000000000..cd7a51c222a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/EndEventHandler.cs
@@ -0,0 +1,13 @@
+//
+// System.Web.EndEventHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web
+{
+ public delegate void EndEventHandler(IAsyncResult ar);
+}
diff --git a/mcs/class/System.Web/System.Web/HttpApplication.cs b/mcs/class/System.Web/System.Web/HttpApplication.cs
new file mode 100644
index 00000000000..21a20a1c1d6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpApplication.cs
@@ -0,0 +1,163 @@
+ //
+// System.Web.HttpApplication
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.ComponentModel;
+
+namespace System.Web {
+ [MonoTODO()]
+ public class HttpApplication : IHttpAsyncHandler, IHttpHandler, IComponent, IDisposable {
+ private bool _CompleteRequest;
+
+ private HttpContext _Context;
+ private HttpContext _OverrideContext;
+
+ private bool _InPreRequestResponseMode;
+
+ private ISite _Site;
+ private HttpModuleCollection _ModuleCollection;
+ private HttpSessionState _Session;
+
+ public event EventHandler AcquireRequestState;
+ public event EventHandler AuthenticateRequest;
+ public event EventHandler AuthorizeRequest;
+ public event EventHandler BeginRequest;
+ public event EventHandler Disposed;
+ public event EventHandler EndRequest;
+ public event EventHandler Error;
+ public event EventHandler PostRequestHandlerExecute;
+ public event EventHandler PreRequestHandlerExecute;
+ public event EventHandler PreSendRequestContent;
+ public event EventHandler PreSendRequestHeaders;
+ public event EventHandler ReleaseRequestState;
+ public event EventHandler ResolveRequestCache;
+ public event EventHandler UpdateRequestCache;
+
+ [MonoTODO()]
+ public HttpApplication() {
+ // Init HTTP context and the methods from HttpRuntime....
+ }
+
+ internal void ClearError() {
+ // Called from Server Utility
+ }
+
+ public HttpContext Context {
+ get {
+ if (null != _OverrideContext) {
+ return _OverrideContext;
+ }
+
+ return _Context;
+ }
+ }
+
+ public HttpModuleCollection Modules {
+ get {
+ if (null == _ModuleCollection) {
+ _ModuleCollection = new HttpModuleCollection();
+ }
+
+ return _ModuleCollection;
+ }
+ }
+
+ public HttpRequest Request {
+ get {
+ if (null != _Context && (!_InPreRequestResponseMode)) {
+ return _Context.Request;
+ }
+
+ throw new HttpException("Cant get request object");
+ }
+ }
+
+ public HttpResponse Response {
+ get {
+ if (null != _Context && (!_InPreRequestResponseMode)) {
+ return _Context.Response;
+ }
+
+ throw new HttpException("Cant get response object");
+ }
+ }
+
+ public HttpServerUtility Server {
+ get {
+ if (null != _Context) {
+ return _Context.Server;
+ }
+
+ return new HttpServerUtility(this);
+ }
+ }
+
+ public HttpSessionState Session {
+ get {
+ if (null != _Session) {
+ return _Session;
+ }
+
+ if (null != _Context && null != _Context.Session) {
+ return _Context.Session;
+ }
+
+ throw new HttpException("Failed to get session object");
+ }
+ }
+
+ public virtual string GetVaryByCustomString(HttpContext context, string custom) {
+ if (custom.ToLower() == "browser") {
+ return context.Request.Browser.Type;
+ }
+
+ return string.Empty;
+ }
+
+ [MonoTODO()]
+ IAsyncResult IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO()]
+ void IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO()]
+ void IHttpHandler.ProcessRequest(HttpContext context) {
+ throw new NotImplementedException();
+ }
+
+ bool IHttpHandler.IsReusable {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ public ISite Site {
+ get {
+ return _Site;
+ }
+
+ set {
+ _Site = value;
+ }
+ }
+
+ public void CompleteRequest() {
+ _CompleteRequest = true;
+ }
+
+ [MonoTODO("Cleanup")]
+ public virtual void Dispose() {
+
+ }
+
+ public virtual void Init() {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpApplicationState.cs b/mcs/class/System.Web/System.Web/HttpApplicationState.cs
new file mode 100644
index 00000000000..6131f07c776
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpApplicationState.cs
@@ -0,0 +1,232 @@
+//
+// 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;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpBrowserCapabilites.cs b/mcs/class/System.Web/System.Web/HttpBrowserCapabilites.cs
new file mode 100644
index 00000000000..5d3487dbbb7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpBrowserCapabilites.cs
@@ -0,0 +1,25 @@
+//
+// System.Web.HttpBrowserCapabilites
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+
+namespace System.Web {
+ [MonoTODO()]
+ public class HttpBrowserCapabilites {
+ public HttpBrowserCapabilites() {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ [MonoTODO()]
+ public string Type {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCachePolicy.cs b/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
new file mode 100644
index 00000000000..da3059ea32c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCachePolicy.cs
@@ -0,0 +1,14 @@
+//
+// System.Web.HttpCachePolicy
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+
+namespace System.Web {
+ public sealed class HttpCachePolicy {
+ internal HttpCachePolicy() {
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs b/mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs
new file mode 100644
index 00000000000..5425d5ebc56
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheRevalidation.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.HttpCacheRevalidation.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web {
+ public enum HttpCacheRevalidation {
+ AllCaches,
+ None,
+ ProxyCaches
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs b/mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs
new file mode 100644
index 00000000000..032aea39f6f
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheValidateHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.HttpCacheValidateHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web
+{
+ public delegate void HttpCacheValidateHandler(
+ HttpContext context,
+ object data,
+ ref HttpValidationStatus validationStatus);
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs b/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs
new file mode 100644
index 00000000000..93ee07a0afe
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheVaryByHeaders.cs
@@ -0,0 +1,110 @@
+//
+// System.Web.HttpCacheVaryByHeaders
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections;
+
+namespace System.Web {
+ public sealed class HttpCacheVaryByHeaders {
+ private Hashtable _Items;
+ private bool _Dirty;
+ private bool _Wildcard;
+
+ // TODO: We need internal methods here to communicate with CachePolicy
+
+ internal HttpCacheVaryByHeaders() {
+ }
+
+ public void VaryByUnspecifiedParameters() {
+ _Dirty = true;
+ _Wildcard = true;
+ _Items = null;
+ }
+
+ public bool AcceptTypes {
+ get {
+ return this["Accept"];
+ }
+
+ set {
+ this["Accept"] = value;
+ }
+ }
+
+ public bool this[string header] {
+ get {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (header == "*") {
+ return _Wildcard;
+ }
+
+ if (null != _Items) {
+ return _Items.ContainsKey(header);
+ }
+
+ return false;
+ }
+
+ set {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (!(value)) {
+ return;
+ }
+
+ _Dirty = true;
+
+ if (header == "*") {
+ VaryByUnspecifiedParameters();
+ return;
+ }
+
+ if (!_Wildcard) {
+ if (null == _Items) {
+ _Items = new Hashtable();
+ }
+
+ _Items[header] = true;
+ }
+ }
+ }
+
+ public bool UserAgent {
+ get {
+ return this["User-Agent"];
+ }
+
+ set {
+ this["User-Agent"] = value;
+ }
+ }
+
+ public bool UserCharSet {
+ get {
+ return this["Accept-Charset"];
+ }
+
+ set {
+ this["Accept-Charset"] = value;
+ }
+ }
+
+ public bool UserLanguage {
+ get {
+ return this["Accept-Language"];
+ }
+
+ set {
+ this["Accept-Language"] = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs b/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs
new file mode 100644
index 00000000000..057ae081d7e
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheVaryByParams.cs
@@ -0,0 +1,81 @@
+//
+// System.Web.HttpCacheVaryByParams
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections;
+
+namespace System.Web {
+ public sealed class HttpCacheVaryByParams {
+ private Hashtable _Items;
+ private bool _IgnoreParams;
+ private bool _Wildcard;
+ private bool _Dirty;
+
+ // TODO: We need internal methods here to communicate with CachePolicy
+
+ internal HttpCacheVaryByParams() {
+ }
+
+ public bool IgnoreParams {
+ get {
+ return _IgnoreParams;
+ }
+
+ set {
+ if (_Wildcard || null != _Items) {
+ return;
+ }
+
+ _Dirty = true;
+ _IgnoreParams = value;
+ }
+ }
+
+ public bool this[string header] {
+ get {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (header == "*") {
+ return _Wildcard;
+ }
+
+ if (null != _Items) {
+ return _Items.ContainsKey(header);
+ }
+
+ return false;
+ }
+
+ set {
+ if (null == header) {
+ throw new ArgumentNullException("header");
+ }
+
+ if (!(value)) {
+ return;
+ }
+
+ _Dirty = true;
+
+ if (header == "*") {
+ _Wildcard = true;
+ _Items = null;
+ return;
+ }
+
+ if (!_Wildcard) {
+ if (null == _Items) {
+ _Items = new Hashtable();
+ }
+
+ _Items[header] = true;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCacheability.cs b/mcs/class/System.Web/System.Web/HttpCacheability.cs
new file mode 100644
index 00000000000..cd5d3861239
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCacheability.cs
@@ -0,0 +1,17 @@
+//
+// System.Web.HttpCacheability.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web {
+ public enum HttpCacheability {
+ NoCache,
+ Private,
+ Public,
+ Server
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web/HttpClientCertificate.cs b/mcs/class/System.Web/System.Web/HttpClientCertificate.cs
new file mode 100644
index 00000000000..4ffc12c0cd8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpClientCertificate.cs
@@ -0,0 +1,147 @@
+//
+// System.Web.HttpClientCertificate
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web {
+ [MonoTODO()]
+ public class HttpClientCertificate : NameValueCollection {
+ private HttpContext _Context;
+ private byte [] _BinaryIssuer;
+ private int _CertEncoding;
+ private byte [] _Certificate;
+ private string _Cookie;
+ private int _Flags;
+ private string _Issuer;
+ private int _KeySize;
+ private byte [] _PublicKey;
+ private int _SecretKeySize;
+ private string _SerialNumber;
+ private string _ServerIssuer;
+ private string _ServerSubject;
+ private string _Subject;
+
+ private DateTime _ValidFrom;
+ private DateTime _ValidTo;
+
+ [MonoTODO("Decode ceritificate from Server variables.. CGI standard?")]
+ internal HttpClientCertificate(HttpContext Context) {
+ _Context = Context;
+ _Flags = 0;
+ }
+
+ public byte [] BinaryIssuer {
+ get {
+ return _BinaryIssuer;
+ }
+ }
+
+ public int CertEncoding {
+ get {
+ return _CertEncoding;
+ }
+ }
+
+ public byte [] Certificate {
+ get {
+ return _Certificate;
+ }
+ }
+
+ public string Cookie {
+ get {
+ return _Cookie;
+ }
+ }
+
+ public int Flags {
+ get {
+ return _Flags;
+ }
+ }
+
+ [MonoTODO()]
+ public bool IsPresent {
+ get {
+ return false;
+ }
+ }
+
+ public string Issuer {
+ get {
+ return _Issuer;
+ }
+ }
+
+ [MonoTODO()]
+ public bool IsValid {
+ get {
+ return false;
+ }
+ }
+
+ public int KeySize {
+ get {
+ return _KeySize;
+ }
+ }
+
+ public byte [] PublicKey {
+ get {
+ return _PublicKey;
+ }
+ }
+
+ public int SecretKeySize {
+ get {
+ return _SecretKeySize;
+ }
+ }
+
+ public string SerialNumber {
+ get {
+ return _SerialNumber;
+ }
+ }
+
+ public string ServerIssuer {
+ get {
+ return _ServerIssuer;
+ }
+ }
+
+ public string ServerSubject {
+ get {
+ return _ServerSubject;
+ }
+ }
+
+ public string Subject {
+ get {
+ return _Subject;
+ }
+ }
+
+ public DateTime ValidFrom {
+ get {
+ return _ValidFrom;
+ }
+ }
+
+ public DateTime ValidUntil {
+ get {
+ return ValidUntil;
+ }
+ }
+
+ [MonoTODO()]
+ public override string Get(string s) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpContext.cs b/mcs/class/System.Web/System.Web/HttpContext.cs
new file mode 100644
index 00000000000..4e6ca908acd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpContext.cs
@@ -0,0 +1,247 @@
+//
+// System.Web.HttpContext
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections;
+using System.Security.Principal;
+using System.Web.Caching;
+using System.Threading;
+
+namespace System.Web {
+ [MonoTODO("HttpContext - Should also keep the script timeout info")]
+ public sealed class HttpContext : IServiceProvider {
+ private Exception [] _arrExceptions;
+
+ private HttpResponse _oResponse;
+ private HttpRequest _oRequest;
+ private HttpServerUtility _Server;
+ private HttpApplication _oApplication;
+ private IHttpHandler _Handler;
+ private IPrincipal _User;
+
+ private Hashtable _oItems;
+ private DateTime _oTimestamp;
+
+ public HttpContext(HttpRequest Request, HttpResponse Response) {
+ Context = this;
+
+ _arrExceptions = null;
+ _oItems = null;
+ _oTimestamp = DateTime.Now;
+ _oRequest = Request;
+ _oResponse = Response;
+ }
+
+ public HttpContext(HttpWorkerRequest WorkerRequest) {
+ Context = this;
+
+ _arrExceptions = null;
+ _oItems = null;
+ _oTimestamp = DateTime.Now;
+ _oRequest = new HttpRequest(WorkerRequest, this);
+ _oResponse = new HttpResponse(WorkerRequest, this);
+ }
+
+ [MonoTODO("Context - Use System.Remoting.Messaging.CallContext instead of Thread storage")]
+ internal static HttpContext Context {
+ get {
+ return (HttpContext) Thread.GetData(Thread.GetNamedDataSlot("Context"));
+ }
+
+ set {
+ Thread.SetData(Thread.GetNamedDataSlot("Context"), value);
+ }
+ }
+
+ public Exception [] AllErrors {
+ get {
+ return _arrExceptions;
+ }
+ }
+
+ [MonoTODO("HttpApplicationState Application")]
+ public HttpApplicationState Application {
+ get {
+ // Should get the state from a app factory (or the app it self) static method?
+ throw new NotImplementedException();
+ }
+ }
+
+ public HttpApplication ApplicationInstance {
+ get {
+ return _oApplication;
+ }
+ set {
+ _oApplication = value;
+ }
+ }
+
+ [MonoTODO("HttpCache Cache")]
+ public Cache Cache {
+ get {
+ // Get the cache from the runtime
+ throw new NotImplementedException();
+ }
+ }
+
+ public static HttpContext Current {
+ get {
+ return Context;
+ }
+ }
+
+ public Exception Error {
+ get {
+ if (_arrExceptions == null) {
+ return null;
+ }
+ else {
+ return _arrExceptions[0];
+ }
+ }
+ }
+
+ public IHttpHandler Handler {
+ get {
+ return _Handler;
+ }
+
+ set {
+ _Handler = value;
+ }
+ }
+
+ [MonoTODO("bool IsCustomErrorEnabled")]
+ public bool IsCustomErrorEnabled {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO("bool IsDebuggingEnabled")]
+ public bool IsDebuggingEnabled {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ public IDictionary Items {
+ get {
+ if (_oItems == null) {
+ _oItems = new Hashtable();
+ }
+
+ return _oItems;
+ }
+ }
+
+ public HttpRequest Request {
+ get {
+ return _oRequest;
+ }
+ }
+
+ public HttpResponse Response {
+ get {
+ return _oResponse;
+ }
+ }
+
+ public HttpServerUtility Server {
+ get {
+ if (null == _Server) {
+ _Server = new HttpServerUtility(this);
+ }
+
+ return _Server;
+ }
+ }
+
+ [MonoTODO("HttpSessionState Session")]
+ public HttpSessionState Session {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO("bool SkipAuthorization")]
+ public bool SkipAuthorization {
+ get {
+ throw new NotImplementedException();
+ }
+
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ public DateTime Timestamp {
+ get {
+ return _oTimestamp;
+ }
+ }
+
+ [MonoTODO("TraceContext Trace")]
+ public TraceContext Trace {
+ get {
+ // TODO: Should be initialized in the constructor (holds current trace)
+ throw new NotImplementedException();
+ }
+ }
+
+ public IPrincipal User {
+ get {
+ return _User;
+ }
+ set {
+ // TODO: Should check security (ControlPrincipal flag)
+ _User = value;
+ }
+ }
+
+ public void AddError(Exception errorInfo) {
+ int iSize;
+
+ if (_arrExceptions == null) {
+ iSize = 1;
+ }
+ else {
+ iSize = _arrExceptions.Length + 1;
+ }
+
+ Exception [] arrNew = new Exception[iSize];
+
+ _arrExceptions.CopyTo(arrNew, 0);
+ _arrExceptions = arrNew;
+
+ _arrExceptions[iSize - 1] = errorInfo;
+ }
+
+ public void ClearError() {
+ _arrExceptions = null;
+ }
+
+ [MonoTODO("GetConfig(string name)")]
+ public object GetConfig(string name) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("GetAppConfig(string name)")]
+ public static object GetAppConfig(string name) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("IServiceProvider.GetService(Type service)")]
+ object IServiceProvider.GetService(Type service) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("void RewritePath(string path)")]
+ public void RewritePath(string Path) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCookie.cs b/mcs/class/System.Web/System.Web/HttpCookie.cs
new file mode 100644
index 00000000000..f53cdc7ce94
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCookie.cs
@@ -0,0 +1,177 @@
+//
+// System.Web.HttpCookie
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Text;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web {
+ public sealed class HttpCookie {
+ private string _Name;
+ private string _Value;
+ private string _Domain;
+ private DateTime _Expires;
+ private bool _ExpiresSet;
+ private string _Path;
+ private bool _Secure = false;
+
+ private HttpValueCollection _Values;
+
+ internal HttpCookie() {
+ _Path = "/";
+ }
+
+ public HttpCookie(string name) {
+ _Path = "/";
+ _Name = name;
+ }
+
+ public HttpCookie(string name, string value) {
+ _Name = name;
+ _Value = value;
+ }
+
+ HttpResponseHeader GetCookieHeader() {
+ StringBuilder oSetCookie = new StringBuilder();
+
+ if (null != _Name && _Name.Length > 0) {
+ oSetCookie.Append(_Name);
+ oSetCookie.Append("=");
+ }
+
+ if (null != _Values) {
+ oSetCookie.Append(_Values.ToString(false));
+ } else if (null != _Value) {
+ oSetCookie.Append(_Value);
+ }
+
+ if (null != _Domain && _Domain.Length > 0) {
+ oSetCookie.Append("; domain=");
+ oSetCookie.Append(_Domain);
+ }
+
+ if (null != _Path && Path.Length > 0) {
+ oSetCookie.Append("; path=");
+ oSetCookie.Append(_Path);
+ }
+
+ if (_Secure) {
+ oSetCookie.Append("; secure");
+ }
+
+ return new HttpResponseHeader(HttpWorkerRequest.HeaderSetCookie, oSetCookie.ToString());
+ }
+
+ public string Domain {
+ get {
+ return _Domain;
+ }
+ set {
+ _Domain = value;
+ }
+ }
+
+ public DateTime Expires {
+ get {
+ if (!_ExpiresSet) {
+ return DateTime.MinValue;
+ }
+
+ return _Expires;
+ }
+
+ set {
+ _ExpiresSet = true;
+ _Expires = value;
+ }
+ }
+
+ public bool HasKeys {
+ get {
+ return Values.HasKeys();
+ }
+ }
+
+ public string this[string key] {
+ get {
+ return Values[key];
+ }
+
+ set {
+ Values[key] = value;
+ }
+ }
+
+ public string Name {
+ get {
+ return _Name;
+ }
+
+ set {
+ _Name = value;
+ }
+ }
+
+ public string Path {
+ get {
+ return _Path;
+ }
+
+ set {
+ _Path = value;
+ }
+ }
+
+ public bool Secure {
+ get {
+ return _Secure;
+ }
+ set {
+ _Secure = value;
+ }
+ }
+
+ public string Value {
+ get {
+ if (null != _Values) {
+ return _Values.ToString(false);
+ }
+
+ return _Value;
+ }
+ set {
+ if (null != _Values) {
+ _Values.Reset();
+ _Values.Add(null, value);
+ return;
+ }
+
+ _Value = value;
+ }
+ }
+
+ public NameValueCollection Values {
+ get {
+ if (null == _Values) {
+ _Values = new HttpValueCollection();
+ if (null != _Value) {
+ // Do we have multiple keys
+ if (_Value.IndexOf("&") >= 0 || _Value.IndexOf("=") >= 0) {
+ _Values.FillFromCookieString(_Value);
+ } else {
+ _Values.Add(null, _Value);
+ }
+
+ _Value = null;
+ }
+ }
+
+ return _Values;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpCookieCollection.cs b/mcs/class/System.Web/System.Web/HttpCookieCollection.cs
new file mode 100644
index 00000000000..e3918e4a4f0
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpCookieCollection.cs
@@ -0,0 +1,139 @@
+//
+// System.Web.HttpCookieCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (First impl Bob Smith <bob@thestuff.net>)
+//
+
+using System;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace System.Web {
+ public sealed class HttpCookieCollection : NameObjectCollectionBase {
+ private HttpCookie [] _AllCookies;
+ private string [] _AllKeys;
+
+ private HttpResponse _Response;
+
+ internal HttpCookieCollection(HttpResponse Response, bool ReadOnly) : base() {
+ _Response = Response;
+ IsReadOnly = ReadOnly;
+ }
+
+ public HttpCookieCollection() {
+ }
+
+ public string [] AllKeys {
+ get {
+ if (null == _AllKeys) {
+ _AllKeys = BaseGetAllKeys();
+ }
+
+ return _AllKeys;
+ }
+ }
+
+ public HttpCookie this[int index] {
+ get {
+ return Get(index);
+ }
+ }
+
+ public HttpCookie this[string name] {
+ get {
+ return Get(name);
+ }
+ }
+
+ public void Add(HttpCookie cookie) {
+ if (null != _Response) {
+ _Response.GoingToChangeCookieColl();
+ }
+
+ // empy performance cache
+ _AllCookies = null;
+ _AllKeys = null;
+
+ BaseAdd(cookie.Name, cookie);
+
+ if (null != _Response) {
+ _Response.OnCookieAdd(cookie);
+ }
+ }
+
+ public void Clear() {
+ _AllCookies = null;
+ _AllKeys = null;
+ this.BaseClear();
+ }
+
+ public void CopyTo(Array dest, int index) {
+ if (null == _AllCookies) {
+ _AllCookies = new HttpCookie[Count];
+
+ for (int i = 0; i != Count; i++) {
+ _AllCookies[i] = Get(i);
+ }
+ }
+
+ if (null != _AllCookies) {
+ _AllCookies.CopyTo(dest, index);
+ }
+ }
+
+ public HttpCookie Get(int index) {
+ return (HttpCookie) BaseGet(index);
+ }
+
+ public HttpCookie Get(string name) {
+ HttpCookie oRet = (HttpCookie) BaseGet(name);
+ if (null == oRet && _Response != null) {
+ _AllCookies = null;
+ _AllKeys = null;
+
+ _Response.GoingToChangeCookieColl();
+
+ oRet = new HttpCookie(name);
+ BaseAdd(name, oRet);
+
+ _Response.OnCookieAdd(oRet);
+ }
+
+ return oRet;
+ }
+
+ public string GetKey(int index) {
+ return this.BaseGetKey(index);
+ }
+
+ public void Remove(string name) {
+ if (null != _Response) {
+ _Response.GoingToChangeCookieColl();
+ }
+
+ _AllCookies = null;
+ _AllKeys = null;
+ this.BaseRemove(name);
+
+ if (null != _Response) {
+ _Response.ChangedCookieColl();
+ }
+ }
+
+ public void Set(HttpCookie cookie) {
+ if (null != _Response) {
+ _Response.GoingToChangeCookieColl();
+ }
+
+ _AllCookies = null;
+ _AllKeys = null;
+ this.BaseSet(cookie.Name, cookie);
+
+ if (null != _Response) {
+ _Response.ChangedCookieColl();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpException.cs b/mcs/class/System.Web/System.Web/HttpException.cs
new file mode 100644
index 00000000000..594b825baf3
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpException.cs
@@ -0,0 +1,59 @@
+//
+// System.Web.HttpException
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Web {
+ [MonoTODO("This class contains a lot of windows specific methods, solve this.. :)")]
+ public class HttpException : ExternalException {
+ private int _HttpCode;
+ private int _HR;
+
+ public HttpException() : base() {
+ }
+
+ public HttpException(string sMessage) : base(sMessage) {
+ }
+
+ public HttpException(string sMessage, Exception InnerException) : base(sMessage, InnerException) {
+ }
+
+ public HttpException(int iHttpCode, string sMessage) : base(sMessage) {
+ _HttpCode = iHttpCode;
+ }
+
+ public HttpException(int iHttpCode, string sMessage, int iHR) : base(sMessage) {
+ _HttpCode = iHttpCode;
+ _HR = iHR;
+ }
+
+ public HttpException(string sMessage, int iHR) : base(sMessage) {
+ _HR = iHR;
+ }
+
+ public HttpException(int iHttpCode, string sMessage, Exception InnerException) : base(sMessage, InnerException) {
+ _HttpCode = iHttpCode;
+ }
+
+ [MonoTODO("Should get an correct html message depending on error type")]
+ public string GetHtmlErrorMessage() {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("Check error type and Set the correct error code")]
+ public int GetHttpCode() {
+ return _HttpCode;
+ }
+
+ [MonoTODO("Get the last error code")]
+ public static HttpException CreateFromLastError(string Message) {
+ return new HttpException(Message);
+ }
+
+
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpFileCollection.cs b/mcs/class/System.Web/System.Web/HttpFileCollection.cs
new file mode 100644
index 00000000000..423a5d4f605
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpFileCollection.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.HttpFileCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections.Specialized;
+
+namespace System.Web {
+ public sealed class HttpFileCollection : NameObjectCollectionBase {
+ private HttpPostedFile [] _AllFiles;
+ private string [] _AllKeys;
+
+ internal HttpFileCollection() : base() {
+ }
+
+ internal void AddFile(string name, HttpPostedFile file) {
+ _AllFiles = null;
+ _AllKeys = null;
+
+ BaseAdd(name, file);
+ }
+
+ public void CopyTo(Array Dest, int index) {
+ if (null == _AllFiles) {
+ _AllFiles = new HttpPostedFile[Count];
+ for (int i = 0; i != Count; i++) {
+ _AllFiles[i] = Get(i);
+ }
+ }
+
+ if (null != _AllFiles) {
+ _AllFiles.CopyTo(Dest, index);
+ }
+ }
+
+ public HttpPostedFile Get(string Name) {
+ return (HttpPostedFile) BaseGet(Name);
+ }
+
+ public HttpPostedFile Get(int index) {
+ return (HttpPostedFile) BaseGet(index);
+ }
+
+ public string GetKey(int index) {
+ return BaseGetKey(index);
+ }
+
+ public string [] AllKeys {
+ get {
+ if (null == _AllKeys) {
+ _AllKeys = BaseGetAllKeys();
+ }
+
+ return _AllKeys;
+ }
+ }
+
+ public HttpPostedFile this [string name] {
+ get {
+ return Get(name);
+ }
+ }
+
+ public HttpPostedFile this [int index] {
+ get {
+ return Get(index);
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpHelper.cs b/mcs/class/System.Web/System.Web/HttpHelper.cs
new file mode 100644
index 00000000000..9798f8b3b4b
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpHelper.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.HttpHelper
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections;
+using System.IO;
+
+namespace System.Web {
+ internal class HttpHelper {
+ internal static string [] ParseMultiValueHeader(string header) {
+ if (null == header) {
+ return null;
+ }
+
+ if (header.Length == 0) {
+ return null;
+ }
+
+ // Parse the , chars
+ Stack oValues = new Stack();
+
+ string sValue;
+
+ int iLastPos = -1;
+ int iPos = header.IndexOf(",");
+
+ while (iPos != -1) {
+ sValue = header.Substring(iLastPos + 1, iPos - iLastPos - 1).Trim();
+ iLastPos = iPos;
+
+ iPos = header.IndexOf(",", iPos + 1);
+ oValues.Push(sValue);
+ }
+
+ sValue = header.Substring(iLastPos + 1).Trim();
+ oValues.Push(sValue);
+
+ string [] arrValues = new string[oValues.Count];
+
+ Array.Copy(oValues.ToArray(), 0, arrValues, 0, oValues.Count);
+
+ return arrValues;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpModuleCollection.cs b/mcs/class/System.Web/System.Web/HttpModuleCollection.cs
new file mode 100644
index 00000000000..c7dc329abc8
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpModuleCollection.cs
@@ -0,0 +1,73 @@
+//
+// System.Web.HttpModuleCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections.Specialized;
+
+namespace System.Web {
+ public sealed class HttpModuleCollection : NameObjectCollectionBase {
+ private IHttpModule [] _Modules;
+ private string [] _Keys;
+
+ internal HttpModuleCollection() : base() {
+ }
+
+ internal void AddModule(string key, IHttpModule m) {
+ _Modules = null;
+ _Keys = null;
+
+ BaseAdd(key, m);
+ }
+
+ public void CopyTo(Array dest, int index) {
+ if (null == _Modules) {
+ _Modules = new IHttpModule[Count];
+
+ for (int i = 0; i != Count; i++) {
+ _Modules[i] = Get(i);
+ }
+ }
+
+ if (null != _Modules) {
+ _Modules.CopyTo(dest, index);
+ }
+ }
+
+ public IHttpModule Get(string key) {
+ return (IHttpModule) BaseGet(key);
+ }
+
+ public IHttpModule Get(int index) {
+ return (IHttpModule) BaseGet(index);
+ }
+
+ public string GetKey(int index) {
+ return GetKey(index);
+ }
+
+ public string [] AllKeys {
+ get {
+ if (null == _Keys) {
+ _Keys = BaseGetAllKeys();
+ }
+
+ return _Keys;
+ }
+ }
+
+ public IHttpModule this [string key] {
+ get {
+ return Get(key);
+ }
+ }
+
+ public IHttpModule this [int index] {
+ get {
+ return Get(index);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpPostedFile.cs b/mcs/class/System.Web/System.Web/HttpPostedFile.cs
new file mode 100644
index 00000000000..02c02fc217a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpPostedFile.cs
@@ -0,0 +1,56 @@
+//
+// System.Web.HttpPostedFile
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.IO;
+
+namespace System.Web {
+ public sealed class HttpPostedFile {
+ private HttpRequestStream _Stream;
+ private string _ContentType;
+ private string _FileName;
+
+ internal HttpPostedFile(string file, string type, HttpRequestStream data) {
+ _Stream = data;
+ _FileName = file;
+ _ContentType = type;
+ }
+
+ public void SaveAs(string filename) {
+ FileStream File = new FileStream(filename, FileMode.Create);
+ if (_Stream.DataLength > 0) {
+ File.Write(_Stream.Data, _Stream.DataOffset, _Stream.DataLength);
+ }
+
+ File.Flush();
+ File.Close();
+ }
+
+ public int ContentLength {
+ get {
+ return _Stream.DataLength;
+ }
+ }
+
+ public string ContentType {
+ get {
+ return _ContentType;
+ }
+ }
+
+ public string FileName {
+ get {
+ return _FileName;
+ }
+ }
+
+ public Stream InputStream {
+ get {
+ return _Stream;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpRequest.cs b/mcs/class/System.Web/System.Web/HttpRequest.cs
new file mode 100644
index 00000000000..62e716689cc
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpRequest.cs
@@ -0,0 +1,836 @@
+//
+// System.Web.HttpRequest
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.IO;
+using System.Text;
+
+namespace System.Web {
+ [MonoTODO("Review security in all path access function")]
+ public sealed class HttpRequest {
+ private string [] _arrAcceptTypes;
+ private string [] _arrUserLanguages;
+
+ private byte [] _arrRawContent;
+ private int _iContentLength;
+
+ private string _sContentType;
+ private string _sHttpMethod;
+ private string _sRawUrl;
+ private string _sUserAgent;
+ private string _sUserHostAddress;
+ private string _sUserHostName;
+ private string _sPath;
+ private string _sPathInfo;
+ private string _sFilePath;
+ private string _sPathTranslated;
+ private string _sQueryStringRaw;
+ private string _sRequestType;
+ private string _sRequestRootVirtualDir;
+
+ private Encoding _oContentEncoding;
+
+ private Uri _oUriReferrer;
+ private Uri _oUrl;
+
+ private int _iTotalBytes;
+
+ private HttpContext _oContext;
+
+ private HttpWorkerRequest _WorkerRequest;
+ private HttpRequestStream _oInputStream;
+ private HttpClientCertificate _ClientCert;
+
+ private HttpValueCollection _oServerVariables;
+ private HttpValueCollection _oHeaders;
+ private HttpValueCollection _oQueryString;
+ private HttpValueCollection _oFormData;
+ private HttpValueCollection _oParams;
+
+ public HttpRequest(string Filename, string Url, string Querystring) {
+ _iContentLength = -1;
+ _iTotalBytes = -1;
+
+ _WorkerRequest = null;
+ _sPathTranslated = Filename;
+ _sRequestType = "GET";
+ _sHttpMethod = "GET";
+ _oUrl = new Uri(Url);
+ _sPath = _oUrl.AbsolutePath;
+
+ _sQueryStringRaw = Querystring;
+ _oQueryString = new HttpValueCollection(Querystring, true, Encoding.Default);
+ }
+
+ internal HttpRequest(HttpWorkerRequest WorkRequest, HttpContext Context) {
+ _WorkerRequest = WorkRequest;
+ _oContext = Context;
+
+ _iContentLength = -1;
+ _iTotalBytes = -1;
+ }
+
+ static private string MakeServerVariableFromHeader(string header) {
+ return "HTTP_" + header.ToUpper().Replace("-", "_");
+ }
+
+ [MonoTODO("Need to support non-raw mode also..")]
+ private string GetAllHeaders(bool Raw) {
+ StringBuilder oData;
+
+ if (null == _WorkerRequest) {
+ return null;
+ }
+
+ oData = new StringBuilder(512);
+
+ string sHeaderValue;
+ string sHeaderName;
+ int iCount = 0;
+
+ // Add all know headers
+ for (; iCount != 40; iCount++) {
+ sHeaderValue = _WorkerRequest.GetKnownRequestHeader(iCount);
+ if (null != sHeaderValue && sHeaderValue.Length > 0) {
+ sHeaderName = _WorkerRequest.GetKnownRequestHeader(iCount);
+ if (null != sHeaderName && sHeaderName.Length > 0) {
+ oData.Append(sHeaderName);
+ oData.Append(": ");
+ oData.Append(sHeaderValue);
+ oData.Append("\r\n");
+ }
+ }
+ }
+
+ // Get all other headers
+ string [][] arrUnknownHeaders = _WorkerRequest.GetUnknownRequestHeaders();
+ if (null != arrUnknownHeaders) {
+ for (iCount = 0; iCount != arrUnknownHeaders.Length; iCount++) {
+ oData.Append(arrUnknownHeaders[iCount][0]);
+ oData.Append(": ");
+ oData.Append(arrUnknownHeaders[iCount][1]);
+ oData.Append("\r\n");
+ }
+ }
+
+ return oData.ToString();
+ }
+
+ [MonoTODO("We need to handly 'dynamic' variables like AUTH_USER, that can be changed during runtime... special collection")]
+ private void ParseServerVariables() {
+ if (null == _WorkerRequest) {
+ return;
+ }
+
+ if (_oServerVariables == null) {
+ string sTmp;
+
+ _oServerVariables = new HttpValueCollection();
+
+ _oServerVariables.Add("ALL_HTTP", GetAllHeaders(false));
+ _oServerVariables.Add("ALL_RAW", GetAllHeaders(true));
+
+ _oServerVariables.Add("APPL_MD_PATH", _WorkerRequest.GetServerVariable("APPL_MD_PATH"));
+ _oServerVariables.Add("AUTH_PASSWORD", _WorkerRequest.GetServerVariable("AUTH_PASSWORD"));
+ _oServerVariables.Add("CERT_COOKIE", _WorkerRequest.GetServerVariable("CERT_COOKIE"));
+ _oServerVariables.Add("CERT_FLAGS", _WorkerRequest.GetServerVariable("CERT_FLAGS"));
+ _oServerVariables.Add("CERT_ISSUER", _WorkerRequest.GetServerVariable("CERT_ISSUER"));
+ _oServerVariables.Add("CERT_KEYSIZE", _WorkerRequest.GetServerVariable("CERT_KEYSIZE"));
+ _oServerVariables.Add("CERT_SECRETKEYSIZE", _WorkerRequest.GetServerVariable("CERT_SECRETKEYSIZE"));
+ _oServerVariables.Add("CERT_SERIALNUMBER", _WorkerRequest.GetServerVariable("CERT_SERIALNUMBER"));
+ _oServerVariables.Add("CERT_SERVER_ISSUER", _WorkerRequest.GetServerVariable("CERT_SERVER_ISSUER"));
+ _oServerVariables.Add("CERT_SERVER_SUBJECT", _WorkerRequest.GetServerVariable("CERT_SERVER_SUBJECT"));
+ _oServerVariables.Add("CERT_SUBJECT", _WorkerRequest.GetServerVariable("CERT_SUBJECT"));
+
+ _oServerVariables.Add("GATEWAY_INTERFACE", _WorkerRequest.GetServerVariable("GATEWAY_INTERFACE"));
+ _oServerVariables.Add("HTTPS", _WorkerRequest.GetServerVariable("HTTPS"));
+ _oServerVariables.Add("HTTPS_KEYSIZE", _WorkerRequest.GetServerVariable("HTTPS_KEYSIZE"));
+ _oServerVariables.Add("HTTPS_SECRETKEYSIZE", _WorkerRequest.GetServerVariable("HTTPS_SECRETKEYSIZE"));
+
+ _oServerVariables.Add("CONTENT_TYPE", ContentType);
+ _oServerVariables.Add("HTTPS_SERVER_ISSUER", _WorkerRequest.GetServerVariable("HTTPS_SERVER_ISSUER"));
+ _oServerVariables.Add("HTTPS_SERVER_SUBJECT", _WorkerRequest.GetServerVariable("HTTPS_SERVER_SUBJECT"));
+ _oServerVariables.Add("INSTANCE_ID", _WorkerRequest.GetServerVariable("INSTANCE_ID"));
+ _oServerVariables.Add("INSTANCE_META_PATH", _WorkerRequest.GetServerVariable("INSTANCE_META_PATH"));
+ _oServerVariables.Add("LOCAL_ADDR", _WorkerRequest.GetLocalAddress());
+ _oServerVariables.Add("REMOTE_ADDR", UserHostAddress);
+ _oServerVariables.Add("REMOTE_HOST", UserHostName);
+ _oServerVariables.Add("REQUEST_METHOD", HttpMethod);
+ _oServerVariables.Add("SERVER_NAME", _WorkerRequest.GetServerName());
+ _oServerVariables.Add("SERVER_PORT", _WorkerRequest.GetLocalPort().ToString());
+ _oServerVariables.Add("SERVER_PROTOCOL", _WorkerRequest.GetHttpVersion());
+ _oServerVariables.Add("SERVER_SOFTWARE", _WorkerRequest.GetServerVariable("SERVER_SOFTWARE"));
+
+ if (_WorkerRequest.IsSecure()) {
+ _oServerVariables.Add("SERVER_PORT_SECURE", "1");
+ } else {
+ _oServerVariables.Add("SERVER_PORT_SECURE", "0");
+ }
+
+ sTmp = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentLength);
+ if (null != sTmp) {
+ _oServerVariables.Add("CONTENT_LENGTH", sTmp);
+ }
+
+ // TODO: Should be dynamic
+ if (null != _oContext.User && _oContext.User.Identity.IsAuthenticated) {
+ _oServerVariables.Add("AUTH_TYPE", _oContext.User.Identity.AuthenticationType);
+ _oServerVariables.Add("AUTH_USER", _oContext.User.Identity.Name);
+ } else {
+ _oServerVariables.Add("AUTH_TYPE", "");
+ _oServerVariables.Add("AUTH_USER", "");
+ }
+
+ _oServerVariables.Add("PATH_INFO", PathInfo);
+ _oServerVariables.Add("PATH_TRANSLATED", PhysicalPath);
+ _oServerVariables.Add("QUERY_STRING", QueryStringRaw);
+ _oServerVariables.Add("SCRIPT_NAME", FilePath);
+ // end dynamic
+
+ _oServerVariables.MakeReadOnly();
+ }
+ }
+
+ [MonoTODO("Handle Multipart data also, content-encoding check")]
+ private void ParseFormData() {
+ if (_oFormData == null) {
+ byte [] arrData = GetRawContent();
+ _oFormData = new HttpValueCollection(ContentEncoding.GetString(arrData), true, ContentEncoding);
+ }
+ }
+
+ void Dispose() {
+
+ }
+
+ [MonoTODO("Handle Multipart data, max content length?")]
+ private byte [] GetRawContent() {
+ if (null == _arrRawContent) {
+ if (null == _WorkerRequest) {
+ return null;
+ }
+
+ // TODO: Check max length?
+ _arrRawContent = _WorkerRequest.GetPreloadedEntityBody();
+ if (!_WorkerRequest.IsEntireEntityBodyIsPreloaded()) {
+ byte [] arrTemp;
+ byte [] arrBuffer;
+
+ arrBuffer = new byte[16384];
+ int iLoaded = 16384;
+
+ while (iLoaded == arrBuffer.Length) {
+ iLoaded = _WorkerRequest.ReadEntityBody(arrBuffer, arrBuffer.Length);
+
+ // Save data
+ arrTemp = new byte[_arrRawContent.Length + iLoaded];
+
+ Array.Copy(_arrRawContent, 0, arrTemp, 0, _arrRawContent.Length);
+ Array.Copy(arrBuffer, 0, arrTemp, _arrRawContent.Length, iLoaded);
+
+ _arrRawContent = arrTemp;
+ }
+ }
+ }
+
+ return _arrRawContent;
+ }
+
+ public string [] AcceptTypes {
+ get {
+ if (null == _arrAcceptTypes && null != _WorkerRequest) {
+ _arrAcceptTypes = HttpHelper.ParseMultiValueHeader(_WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderAccept));
+ }
+
+ return _arrAcceptTypes;
+
+ }
+ }
+
+ public string ApplicationPath {
+ get {
+ if (null != _WorkerRequest) {
+ return _WorkerRequest.GetAppPath();
+ }
+
+ return null;
+ }
+ }
+
+ [MonoTODO()]
+ public HttpBrowserCapabilites Browser {
+ get {
+ throw new NotImplementedException();
+ }
+
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ public HttpClientCertificate ClientCertificate {
+ get {
+ if (null == _ClientCert) {
+ _ClientCert = new HttpClientCertificate(_oContext);
+ }
+
+ return _ClientCert;
+ }
+ }
+
+ [MonoTODO("Get content encoding from Syste.Web.Configuration namespace")]
+ public Encoding ContentEncoding {
+ get {
+ if (_oContentEncoding == null) {
+ // TODO: Get from config what is the default encoding
+ // TODO: Should we get encoding from HttpHeaders? Just get charset from ContentType and the get encoding..
+ _oContentEncoding = Encoding.Default;
+ }
+
+ return _oContentEncoding;
+ }
+
+ set {
+ _oContentEncoding = value;
+ }
+ }
+
+ public int ContentLength {
+ get {
+ if (_iContentLength == -1 && null != _WorkerRequest) {
+ string sLength = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentLength);
+ if (sLength != null) {
+ try {
+ _iContentLength = Int32.Parse(sLength);
+ }
+ catch(Exception) {
+ }
+ }
+ }
+
+ if (_iContentLength < 0) {
+ _iContentLength = 0;
+ }
+
+ return _iContentLength;
+ }
+ }
+
+ public string ContentType {
+ get {
+ if (null == _sContentType) {
+ if (null != _WorkerRequest) {
+ _sContentType = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderContentType);
+ }
+
+ if (null == _sContentType) {
+ _sContentType = string.Empty;
+ }
+ }
+
+ return _sContentType;
+ }
+ }
+
+ [MonoTODO()]
+ public HttpCookieCollection Cookies {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO()]
+ public string CurrentExecutionFilePath {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ public string FilePath {
+ get {
+ if (null == _sFilePath && null != _WorkerRequest) {
+ _sFilePath = _WorkerRequest.GetFilePath();
+ }
+
+ return _sFilePath;
+ }
+ }
+
+ [MonoTODO()]
+ public HttpFileCollection Files {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO("Use stream filter in the request stream")]
+ public Stream Filter {
+ get {
+ throw new NotImplementedException();
+ }
+
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+
+ public NameValueCollection Form {
+ get {
+ ParseFormData();
+
+ return (NameValueCollection) _oFormData;
+ }
+ }
+
+ public NameValueCollection Headers {
+ get {
+ if (_oHeaders == null) {
+ _oHeaders = new HttpValueCollection();
+
+ if (null != _WorkerRequest) {
+ string sHeaderValue;
+ string sHeaderName;
+ int iCount = 0;
+
+ // Add all know headers
+ for (; iCount != 40; iCount++) {
+ sHeaderValue = _WorkerRequest.GetKnownRequestHeader(iCount);
+ if (null != sHeaderValue && sHeaderValue.Length > 0) {
+ sHeaderName = _WorkerRequest.GetKnownRequestHeader(iCount);
+ if (null != sHeaderName && sHeaderName.Length > 0) {
+ _oHeaders.Add(sHeaderName, sHeaderValue);
+ }
+ }
+ }
+
+ // Get all other headers
+ string [][] arrUnknownHeaders = _WorkerRequest.GetUnknownRequestHeaders();
+ if (null != arrUnknownHeaders) {
+ for (iCount = 0; iCount != arrUnknownHeaders.Length; iCount++) {
+ _oHeaders.Add(arrUnknownHeaders[iCount][0], arrUnknownHeaders[iCount][1]);
+ }
+ }
+ }
+
+ // Make headers read-only
+ _oHeaders.MakeReadOnly();
+ }
+
+ return (NameValueCollection) _oHeaders;
+ }
+ }
+
+ public string HttpMethod {
+ get {
+ if (null == _sHttpMethod) {
+ if (null != _WorkerRequest) {
+ _sHttpMethod = _WorkerRequest.GetHttpVerbName().ToUpper();
+ }
+
+ if (_sHttpMethod == null) {
+ _sHttpMethod = "GET";
+ }
+ }
+
+ return _sHttpMethod;
+ }
+ }
+
+ public Stream InputStream {
+ get {
+ if (_oInputStream == null) {
+ byte [] arrInputData = GetRawContent();
+
+ if (null != arrInputData) {
+ _oInputStream = new HttpRequestStream(arrInputData, 0, arrInputData.Length);
+ } else {
+ _oInputStream = new HttpRequestStream(null, 0, 0);
+ }
+ }
+
+ return _oInputStream;
+ }
+ }
+
+ public bool IsAuthenticated {
+ get {
+ if (_oContext != null && _oContext.User != null && _oContext.User.Identity != null) {
+ return _oContext.User.Identity.IsAuthenticated;
+ }
+
+ return false;
+ }
+ }
+
+ public bool IsSecureConnection {
+ get {
+ if (null != _WorkerRequest) {
+ return _WorkerRequest.IsSecure();
+ }
+
+ return false;
+ }
+ }
+
+ [MonoTODO("Call item in querystring, form, cookie and servervariables")]
+ public string this [string sKey] {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO("Add cookie collection to our Params collection via merge")]
+ public NameValueCollection Params {
+ get {
+ if (_oParams == null) {
+ _oParams = new HttpValueCollection();
+
+ _oParams.Merge(QueryString);
+ _oParams.Merge(Form);
+ _oParams.Merge(ServerVariables);
+ // TODO: Cookie
+
+ _oParams.MakeReadOnly();
+ }
+
+ return (NameValueCollection) _oParams;
+ }
+ }
+
+ public string Path {
+ get {
+ if (_sPath == null) {
+ if (null != _WorkerRequest) {
+ _sPath = _WorkerRequest.GetUriPath();
+ }
+
+ if (_sPath == null) {
+ _sPath = string.Empty;
+ }
+ }
+
+ return _sPath;
+ }
+ }
+
+ public string PathInfo {
+ get {
+ if (_sPathInfo == null) {
+ if (null != _WorkerRequest) {
+ _sPathInfo = _WorkerRequest.GetPathInfo();
+ }
+
+ if (_sPathInfo == null) {
+ _sPathInfo = string.Empty;
+ }
+ }
+
+ return _sPathInfo;
+ }
+ }
+
+ public string PhysicalApplicationPath {
+ get {
+ if (null != _WorkerRequest) {
+ return _WorkerRequest.GetAppPathTranslated();
+ }
+
+ return null;
+ }
+ }
+
+ public string PhysicalPath {
+ get {
+ if (null != _WorkerRequest) {
+ _sPathTranslated = _WorkerRequest.GetFilePathTranslated();
+ if (null == _sPathTranslated) {
+ _sPathTranslated = _WorkerRequest.MapPath(FilePath);
+ }
+ }
+
+ return _sPathTranslated;
+ }
+ }
+
+ public NameValueCollection QueryString {
+ get {
+ if (_oQueryString == null) {
+ _oQueryString = new HttpValueCollection(QueryStringRaw, true, Encoding.UTF8);
+ }
+
+ return _oQueryString;
+ }
+ }
+
+ // Used to parse the querystring
+ internal string QueryStringRaw {
+ get {
+ if (_sQueryStringRaw == null && null != _WorkerRequest) {
+ byte [] arrQuerystringBytes = _WorkerRequest.GetQueryStringRawBytes();
+ if (null != arrQuerystringBytes && arrQuerystringBytes.Length > 0) {
+ _sQueryStringRaw = ContentEncoding.GetString(arrQuerystringBytes);
+ } else {
+ _sQueryStringRaw = _WorkerRequest.GetQueryString();
+ }
+ }
+
+ if (_sQueryStringRaw == null) {
+ _sQueryStringRaw = string.Empty;
+ }
+
+ return _sQueryStringRaw;
+ }
+ }
+
+ public string RawUrl {
+ get {
+ if (null == _sRawUrl) {
+ if (null != _WorkerRequest) {
+ _sRawUrl = _WorkerRequest.GetRawUrl();
+ } else {
+ _sRawUrl = Path;
+ if (QueryStringRaw != null && QueryStringRaw.Length > 0) {
+ _sRawUrl = _sRawUrl + "?" + QueryStringRaw;
+ }
+ }
+ }
+
+ return _sRawUrl;
+ }
+ }
+
+ public string RequestType {
+ get {
+ if (null == _sRequestType) {
+ return HttpMethod;
+ }
+
+ return _sRequestType;
+ }
+
+ set {
+ _sRequestType = value;
+ }
+ }
+
+
+ public NameValueCollection ServerVariables {
+ get {
+ ParseServerVariables();
+
+ return (NameValueCollection) _oServerVariables;
+ }
+ }
+
+ public int TotalBytes {
+ get {
+ if (_iTotalBytes == -1) {
+ if (null != InputStream) {
+ _iTotalBytes = (int) InputStream.Length;
+ } else {
+ _iTotalBytes = 0;
+ }
+ }
+
+ return _iTotalBytes;
+ }
+ }
+
+ public Uri Url {
+ get {
+ if (null == _oUrl) {
+ _oUrl = new Uri(RawUrl);
+ }
+
+ return _oUrl;
+ }
+ }
+
+ public Uri UrlReferrer {
+ get {
+ if (null == _oUriReferrer && null != _WorkerRequest) {
+ string sReferrer = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderReferer);
+ if (null != sReferrer && sReferrer.Length > 0) {
+ try {
+ if (sReferrer.IndexOf("://") >= 0) {
+ _oUriReferrer = new Uri(sReferrer);
+ } else {
+ _oUriReferrer = new Uri(this.Url, sReferrer);
+ }
+ }
+ catch (Exception) {
+ }
+ }
+ }
+
+ return _oUriReferrer;
+ }
+ }
+
+ public string UserAgent {
+ get {
+ if (_sUserAgent == null && _WorkerRequest != null) {
+ _sUserAgent = _WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderUserAgent);
+ }
+
+ if (_sUserAgent == null) {
+ _sUserAgent = string.Empty;
+ }
+
+ return _sUserAgent;
+ }
+ }
+
+ public string UserHostAddress {
+ get {
+ if (_sUserHostAddress == null && null != _WorkerRequest) {
+ _sUserHostAddress = _WorkerRequest.GetRemoteAddress();
+ }
+
+ if (_sUserHostAddress == null || _sUserHostAddress.Length == 0) {
+ _sUserHostAddress = "127.0.0.1";
+ }
+
+ return _sUserHostAddress;
+ }
+ }
+
+ public string UserHostName {
+ get {
+ if (_sUserHostName == null && null != _WorkerRequest) {
+ _sUserHostName = _WorkerRequest.GetRemoteName();
+ }
+
+ if (_sUserHostName == null || _sUserHostName.Length == 0) {
+ _sUserHostName = UserHostAddress;
+ }
+
+ return _sUserHostName;
+ }
+ }
+
+ public string [] UserLanguages {
+ get {
+ if (_arrUserLanguages == null && null != _WorkerRequest) {
+ _arrUserLanguages = HttpHelper.ParseMultiValueHeader(_WorkerRequest.GetKnownRequestHeader(HttpWorkerRequest.HeaderAcceptLanguage));
+ }
+
+ return _arrUserLanguages;
+ }
+ }
+
+ public byte [] BinaryRead(int count) {
+ int iSize = TotalBytes;
+ if (iSize == 0) {
+ throw new ArgumentException();
+ }
+
+ byte [] arrData = new byte[iSize];
+
+ int iRetSize = InputStream.Read(arrData, 0, iSize);
+ if (iRetSize != iSize) {
+ byte [] tmpData = new byte[iRetSize];
+ if (iRetSize > 0) {
+ Array.Copy(arrData, 0, tmpData, 0, iRetSize);
+ }
+
+ arrData = tmpData;
+ }
+
+ return arrData;
+ }
+
+ public int [] MapImageCoordinates(string ImageFieldName) {
+ NameValueCollection oItems;
+
+ if (HttpMethod == "GET" || HttpMethod == "HEAD") {
+ oItems = QueryString;
+ } else if (HttpMethod == "POST") {
+ oItems = Form;
+ } else {
+ return null;
+ }
+
+ int [] arrRet = null;
+ try {
+ string sX = oItems.Get(ImageFieldName + ".x");
+ string sY = oItems.Get(ImageFieldName + ".y");
+
+ if (null != sX && null != sY) {
+ int [] arrTmp = new Int32[2];
+ arrRet[0] = Int32.Parse(sX);
+ arrRet[1] = Int32.Parse(sY);
+
+ arrRet = arrTmp;
+ }
+ }
+ catch (Exception) {
+ }
+
+ return arrRet;
+ }
+
+ public string MapPath(string VirtualPath) {
+ if (null == _sRequestRootVirtualDir) {
+ if (null == FilePath || FilePath.Length == 0) {
+ throw new ArgumentException("Filepath can't be empty");
+ }
+
+ if (FilePath[0] != '/') {
+ throw new ArgumentException("Filepath must be a root");
+ }
+
+ _sRequestRootVirtualDir = FilePath.Substring(0, FilePath.LastIndexOf('/'));
+ if (_sRequestRootVirtualDir.Length == 0) {
+ _sRequestRootVirtualDir = "/";
+ }
+ }
+
+ return MapPath(VirtualPath, _sRequestRootVirtualDir, true);
+ }
+
+ [MonoTODO("Build a path to send to MapPath in the workerrequest")]
+ public string MapPath(string virtualPath, string baseVirtualDir, bool allowCrossAppMapping) {
+ throw new NotImplementedException();
+ }
+
+ public void SaveAs(string filename, bool includeHeaders) {
+ FileStream oFile;
+ TextWriter oWriter;
+ HttpRequestStream oData;
+
+ oFile = new FileStream(filename, FileMode.CreateNew);
+ if (includeHeaders) {
+ oWriter = new StreamWriter(oFile);
+ oWriter.Write(HttpMethod + " " + Path);
+
+ if (QueryStringRaw != null && QueryStringRaw.Length > 0)
+ oWriter.Write("?" + QueryStringRaw);
+ if (_WorkerRequest != null) {
+ oWriter.Write(" " + _WorkerRequest.GetHttpVersion() + "\r\n");
+ oWriter.Write(GetAllHeaders(true));
+ } else {
+ oWriter.Write("\r\n");
+ }
+
+ oWriter.Write("\r\n");
+ oWriter.Flush();
+ }
+
+ oData = (HttpRequestStream) InputStream;
+
+ if (oData.DataLength > 0) {
+ oFile.Write(oData.Data, oData.DataOffset, oData.DataLength);
+ }
+
+ oFile.Flush();
+ oFile.Close();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpRequestStream.cs b/mcs/class/System.Web/System.Web/HttpRequestStream.cs
new file mode 100644
index 00000000000..c67281d3dd1
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpRequestStream.cs
@@ -0,0 +1,142 @@
+//
+// System.Web.HttpRequestStream
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.IO;
+
+namespace System.Web {
+ public class HttpRequestStream : Stream {
+ private byte [] _arrData;
+ private int _iLength;
+ private int _iOffset;
+ private int _iPos;
+
+ internal HttpRequestStream(byte [] buffer, int offset, int length) {
+ _iPos = 0;
+ _iOffset = offset;
+ _iLength = length;
+
+ _arrData = buffer;
+ }
+
+ private void Reset() {
+ _iPos = 0;
+ _iOffset = 0;
+ _iLength = 0;
+
+ _arrData = null;
+ }
+
+ public override void Flush() {
+ }
+
+ public override void Close() {
+ Reset();
+ }
+
+ public override int Read(byte [] buffer, int offset, int length) {
+ int iBytes = length;
+
+ if (_iPos + length > _arrData.Length) {
+ iBytes = (int) _arrData.Length - _iPos;
+ }
+
+ if (iBytes <= 0) {
+ return 0;
+ }
+
+ Buffer.BlockCopy(_arrData, _iPos, buffer, offset, iBytes);
+ _iPos += iBytes;
+
+ return iBytes;
+ }
+
+ public override long Seek(long offset, SeekOrigin origin) {
+ switch (origin) {
+ case SeekOrigin.Begin : if (offset > _arrData.Length) {
+ throw new ArgumentException();
+ }
+ _iPos = (int) offset;
+ break;
+
+ case SeekOrigin.Current : if (((long) _iPos + offset > _arrData.Length) || (_iPos + (int) offset < 0)) {
+ throw new ArgumentException();
+ }
+ _iPos += Convert.ToInt32(offset);
+ break;
+
+ case SeekOrigin.End: if (_arrData.Length - offset < 0) {
+ throw new ArgumentException();
+ }
+
+ _iPos = Convert.ToInt32( _arrData.Length - offset);
+ break;
+ }
+
+ return (long) _iPos;
+ }
+
+ public override void SetLength(long length) {
+ throw new NotSupportedException();
+ }
+
+ public override void Write(byte [] buffer, int offset, int length) {
+ throw new NotSupportedException();
+ }
+
+ public override bool CanRead {
+ get {
+ return true;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return true;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return false;
+ }
+ }
+
+ public byte [] Data {
+ get {
+ return _arrData;
+ }
+ }
+
+ public int DataLength {
+ get {
+ return _iLength;
+ }
+ }
+
+ public int DataOffset {
+ get {
+ return _iOffset;
+ }
+ }
+
+ public override long Length {
+ get {
+ return (long) _arrData.Length;
+ }
+ }
+
+ public override long Position {
+ get {
+ return (long) _iPos;
+ }
+
+ set {
+ Seek(value, SeekOrigin.Begin);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpResponse.cs b/mcs/class/System.Web/System.Web/HttpResponse.cs
new file mode 100644
index 00000000000..ea10cfd42ec
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponse.cs
@@ -0,0 +1,750 @@
+//
+// System.Web.HttpResponse
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Globalization;
+
+namespace System.Web {
+ public sealed class HttpResponse {
+ // Chunked encoding static helpers
+ private static byte [] s_arrChunkSuffix = { 10, 13 };
+ private static byte [] s_arrChunkEnd = { 10 , 13 };
+ private static string s_sChunkedPrefix = "\r\n";
+
+ private ArrayList _Headers;
+
+ private bool _bClientDisconnected;
+ private bool _bSuppressHeaders;
+ private bool _bSuppressContent;
+ private bool _bChunked;
+ private bool _bEnded;
+ private bool _bBuffering;
+ private bool _bHeadersSent;
+ private bool _bFlushing;
+ private long _lContentLength;
+ private int _iStatusCode;
+
+ private bool _ClientDisconnected;
+
+ private string _sContentType;
+ private string _sCacheControl;
+ private string _sTransferEncoding;
+ private string _sCharset;
+ private string _sStatusDescription;
+
+ private HttpCookieCollection _Cookies;
+ private HttpCachePolicy _CachePolicy;
+
+ private Encoding _ContentEncoding;
+
+ private HttpContext _Context;
+ private HttpWriter _Writer;
+ private TextWriter _TextWriter;
+
+ private HttpWorkerRequest _WorkerRequest;
+
+ [MonoTODO("Verify that this really works")]
+ public HttpResponse(TextWriter output) {
+ _bBuffering = true;
+ _bFlushing = false;
+ _bHeadersSent = false;
+
+ _Headers = new ArrayList();
+
+ _sContentType = "text/html";
+
+ _iStatusCode = 200;
+ _sCharset = null;
+ _sCacheControl = null;
+
+ _lContentLength = 0;
+ _bSuppressContent = false;
+ _bSuppressHeaders = false;
+ _bClientDisconnected = false;
+
+ _bChunked = false;
+
+ _TextWriter = output;
+ }
+
+ internal HttpResponse(HttpWorkerRequest WorkerRequest, HttpContext Context) {
+ _Context = Context;
+ _WorkerRequest = WorkerRequest;
+
+ _bBuffering = true;
+ _bFlushing = false;
+ _bHeadersSent = false;
+
+ _Headers = new ArrayList();
+
+ _sContentType = "text/html";
+
+ _iStatusCode = 200;
+ _sCharset = null;
+ _sCacheControl = null;
+
+ _lContentLength = 0;
+ _bSuppressContent = false;
+ _bSuppressHeaders = false;
+ _bClientDisconnected = false;
+
+ _bChunked = false;
+
+ _Writer = new HttpWriter(this);
+ _TextWriter = _Writer;
+ }
+
+ internal System.Text.Encoder ContentEncoder {
+ get {
+ return ContentEncoding.GetEncoder();
+ }
+ }
+
+ internal void FinalFlush() {
+ Flush(true);
+ }
+
+ [MonoTODO("We need to add cache headers also")]
+ private ArrayList GenerateHeaders() {
+ ArrayList oHeaders = new ArrayList(_Headers.ToArray());
+
+ // save culture info, we need us info here
+ CultureInfo oSavedInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
+ System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo(0x0409);
+
+ oHeaders.Add(new HttpResponseHeader("Date", DateTime.Now.ToUniversalTime().ToString("ddd, d MMM yyyy HH:mm:ss") + " GMT"));
+
+ System.Threading.Thread.CurrentThread.CurrentCulture = oSavedInfo;
+
+ if (_lContentLength > 0) {
+ oHeaders.Add(new HttpResponseHeader(HttpWorkerRequest.HeaderContentLength, _lContentLength.ToString()));
+ }
+
+ if (_sContentType != null) {
+ if (_sContentType.IndexOf("charset=") == -1) {
+ if (Charset.Length == 0) {
+ Charset = ContentEncoding.HeaderName;
+ }
+
+ // Time to build our string
+ if (Charset.Length > 0) {
+ _sContentType += "; charset=" + Charset;
+ }
+ }
+
+ oHeaders.Add(new HttpResponseHeader(HttpWorkerRequest.HeaderContentType, _sContentType));
+ }
+
+ if (_sCacheControl != null) {
+ oHeaders.Add(new HttpResponseHeader(HttpWorkerRequest.HeaderPragma, _sCacheControl));
+ }
+
+ if (_sTransferEncoding != null) {
+ oHeaders.Add(new HttpResponseHeader(HttpWorkerRequest.HeaderTransferEncoding, _sTransferEncoding));
+ }
+
+ // TODO: Add Cookie headers..
+
+ return oHeaders;
+ }
+
+ private void SendHeaders() {
+ _WorkerRequest.SendStatus(StatusCode, StatusDescription);
+
+ ArrayList oHeaders = GenerateHeaders();
+ foreach (object oHeader in oHeaders) {
+ ((HttpResponseHeader) oHeader).SendContent(_WorkerRequest);
+ }
+
+ _bHeadersSent = true;
+ }
+
+ public string Status {
+ get {
+ return StatusCode.ToString() + " " + StatusDescription;
+ }
+
+ set {
+ string sMsg = "OK";
+ int iCode = 200;
+
+ try {
+ iCode = Int32.Parse(value.Substring(0, value.IndexOf(' ')));
+ sMsg = value.Substring(value.IndexOf(' ') + 1);
+ }
+ catch(Exception) {
+ throw new HttpException("Invalid status string");
+ }
+
+ StatusCode = iCode;
+ StatusDescription = sMsg;
+ }
+ }
+
+ [MonoTODO()]
+ public void AddCacheItemDependencies(ArrayList cacheKeys) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO()]
+ public void AddCacheItemDependency(string cacheKey) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO()]
+ public void AddFileDependencies(ArrayList filenames) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO()]
+ public void AddFileDependency(string filename) {
+ throw new NotImplementedException();
+ }
+
+ public void AddHeader(string name, string value) {
+ AppendHeader(name, value);
+ }
+
+ [MonoTODO()]
+ public void AppendCookie(HttpCookie cookie) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO()]
+ public void AppendToLog(string param) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO()]
+ public string ApplyAppPathModifier(string virtualPath) {
+ throw new NotImplementedException();
+ }
+
+ public bool Buffer {
+ get {
+ return BufferOutput;
+ }
+
+ set {
+ BufferOutput = value;
+ }
+ }
+
+ public bool BufferOutput {
+ get {
+ return _bBuffering;
+ }
+
+ set {
+ if (_Writer != null) {
+ _Writer.Update();
+ }
+
+ _bBuffering = value;
+ }
+ }
+
+ public HttpCachePolicy Cache {
+ get {
+ if (null == _CachePolicy) {
+ _CachePolicy = new HttpCachePolicy();
+ }
+
+ return _CachePolicy;
+ }
+ }
+
+ [MonoTODO("Set status in the cache policy")]
+ public string CacheControl {
+ get {
+ return _sCacheControl;
+ }
+
+ set {
+ if (_bHeadersSent) {
+ throw new System.Web.HttpException("Headers has been sent to the client");
+ }
+
+ _sCacheControl = value;
+ }
+ }
+
+ public string Charset {
+ get {
+ if (null == _sCharset) {
+ _sCharset = ContentEncoding.WebName;
+ }
+
+ return _sCharset;
+ }
+ set {
+ if (_bHeadersSent) {
+ throw new System.Web.HttpException("Headers has been sent to the client");
+ }
+
+ _sCharset = value;
+ }
+ }
+
+ public Encoding ContentEncoding {
+ get {
+ if (_ContentEncoding == null) {
+ _ContentEncoding = Encoding.UTF8;
+ }
+
+ return _ContentEncoding;
+ }
+
+ set {
+ if (value == null) {
+ throw new ArgumentException("Can't set a null as encoding");
+ }
+
+ _ContentEncoding = value;
+
+ if (_Writer != null) {
+ _Writer.Update();
+ }
+ }
+ }
+
+ public string ContentType {
+ get {
+ return _sContentType;
+ }
+
+ set {
+ if (_bHeadersSent) {
+ throw new System.Web.HttpException("Headers has been sent to the client");
+ }
+
+ _sContentType = value;
+ }
+ }
+
+ public HttpCookieCollection Cookies {
+ get {
+ if (null == _Cookies) {
+ _Cookies = new HttpCookieCollection(this, false);
+ }
+ return _Cookies;
+ }
+ }
+
+ [MonoTODO("Set expires in the cache policy")]
+ public int Expires {
+ get {
+ throw new NotImplementedException();
+ }
+
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO("Set expiresabsolute in the cache policy")]
+ public int ExpiresAbsolute {
+ get {
+ throw new NotImplementedException();
+ }
+
+ set {
+ throw new NotImplementedException();
+ }
+ }
+
+ public Stream Filter {
+ get {
+ if (_Writer != null) {
+ return _Writer.GetActiveFilter();
+ }
+ return null;
+ }
+
+ set {
+ if (_Writer == null) {
+ throw new HttpException("Filtering is not allowed");
+ }
+
+ _Writer.ActivateFilter(value);
+ }
+ }
+
+ public bool IsClientConnected {
+ get {
+ if (_ClientDisconnected) {
+ return false;
+ }
+
+ if (null != _WorkerRequest && (!_WorkerRequest.IsClientConnected())) {
+ _ClientDisconnected = false;
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ public TextWriter Output {
+ get {
+ return _TextWriter;
+ }
+ }
+
+ public Stream OutputStream {
+ get {
+ if (_Writer == null) {
+ throw new System.Web.HttpException("a Output stream not available when running with custom text writer");
+ }
+
+ return _Writer.OutputStream;
+ }
+ }
+
+ public string StatusDescription {
+ get {
+ if (null == _sStatusDescription) {
+ _sStatusDescription = HttpWorkerRequest.GetStatusDescription(_iStatusCode);
+ }
+
+ return _sStatusDescription;
+ }
+
+ set {
+ if (_bHeadersSent) {
+ throw new System.Web.HttpException("Headers has been sent to the client");
+ }
+
+ _sStatusDescription = value;
+ }
+ }
+
+ public int StatusCode {
+ get {
+ return _iStatusCode;
+ }
+ set {
+ if (_bHeadersSent) {
+ throw new System.Web.HttpException("Headers has been sent to the client");
+ }
+
+ _sStatusDescription = null;
+ _iStatusCode = value;
+ }
+ }
+
+ public bool SuppressContent {
+ get {
+ return _bSuppressContent;
+ }
+
+ set {
+ if (_bHeadersSent) {
+ throw new System.Web.HttpException("Headers has been sent to the client");
+ }
+
+ _bSuppressContent = true;
+ }
+ }
+
+ public HttpRequest Request {
+ get {
+ return _Context.Request;
+ }
+ }
+
+ internal void AppendHeader(int iIndex, string value) {
+ if (_bHeadersSent) {
+ throw new System.Web.HttpException("Headers has been sent to the client");
+ }
+ switch (iIndex) {
+ case HttpWorkerRequest.HeaderContentLength :
+ _lContentLength = Int64.Parse(value);
+ break;
+ case HttpWorkerRequest.HeaderContentEncoding :
+ _sContentType = value;
+ break;
+ case HttpWorkerRequest.HeaderTransferEncoding :
+ _sTransferEncoding = value;
+ if (value.Equals("chunked")) {
+ _bChunked = true;
+ } else {
+ _bChunked = false;
+ }
+ break;
+
+ case HttpWorkerRequest.HeaderPragma :
+ _sCacheControl = value;
+ break;
+
+ default :
+ _Headers.Add(new HttpResponseHeader(iIndex, value));
+ break;
+ }
+
+
+ }
+
+ public void AppendHeader(string name, string value) {
+ if (_bHeadersSent) {
+ throw new System.Web.HttpException("Headers has been sent to the client");
+ }
+
+ switch (name.ToLower()) {
+ case "content-length" : _lContentLength = Int64.Parse(value);
+ break;
+ case "content-type" : _sContentType = value;
+ break;
+ case "transfer-encoding" : _sTransferEncoding = value;
+ if (value.Equals("chunked")) {
+ _bChunked = true;
+ } else {
+ _bChunked = false;
+ }
+
+ break;
+ case "pragma" : _sCacheControl = value;
+ break;
+
+ default : _Headers.Add(new HttpResponseHeader(name, value));
+ break;
+ }
+ }
+
+ public void BinaryWrite(byte [] buffer) {
+ OutputStream.Write(buffer, 0, buffer.Length);
+ }
+
+ public void Clear() {
+ if (_Writer != null) {
+ _Writer.Clear();
+ }
+ }
+
+ public void ClearContent() {
+ Clear();
+ }
+
+ public void ClearHeaders() {
+ if (_bHeadersSent) {
+ throw new System.Web.HttpException("Headers has been sent to the client");
+ }
+
+ _sContentType = "text/html";
+
+ _iStatusCode = 200;
+ _sCharset = null;
+ _Headers = new ArrayList();
+ _sCacheControl = null;
+ _sTransferEncoding = null;
+
+ _lContentLength = 0;
+ _bSuppressContent = false;
+ _bSuppressHeaders = false;
+ _bClientDisconnected = false;
+ }
+
+ public void Close() {
+ _bClientDisconnected = false;
+
+ _WorkerRequest.CloseConnection();
+
+ _bClientDisconnected = true;
+ }
+
+ internal void Dispose() {
+ if (_Writer != null) {
+ _Writer.Dispose();
+ _Writer = null;
+ }
+ }
+
+ [MonoTODO("Handle callbacks into before done with session, needs to have a non ended flush here")]
+ internal void FlushAtEndOfRequest()
+ {
+ Flush(true);
+ }
+
+ [MonoTODO("Check timeout and if we can cancel the thread...")]
+ public void End() {
+ if (!_bEnded) {
+ Flush();
+ _WorkerRequest.CloseConnection();
+
+ _bEnded = true;
+ }
+ }
+
+ public void Flush() {
+ Flush(false);
+ }
+
+ private void Flush(bool bFinish) {
+ if (_bFlushing) {
+ return;
+ }
+
+ _bFlushing = true;
+
+ if (_Writer != null) {
+ _Writer.FlushBuffers();
+ } else {
+ _TextWriter.Flush();
+ }
+
+ try {
+ if (!_bHeadersSent) {
+ if (!_bSuppressHeaders && !_bClientDisconnected) {
+ if (_Writer != null && BufferOutput) {
+ _lContentLength = _Writer.BufferSize;
+ }
+ else {
+ _lContentLength = 0;
+ }
+
+ if (_lContentLength == 0 && _iStatusCode == 200 && _sTransferEncoding == null) {
+ // Check we are going todo chunked encoding
+ string sProto = _Context.Request.ServerVariables["SERVER_PROTOCOL"];
+ if (sProto != null && sProto == "HTTP/1.1") {
+ AppendHeader(HttpWorkerRequest.HeaderTransferEncoding, "chunked");
+ }
+ else {
+ // Just in case, the old browsers sends a HTTP/1.0 request with Connection: Keep-Alive
+ AppendHeader(HttpWorkerRequest.HeaderConnection, "Close");
+ }
+ }
+
+ SendHeaders();
+ }
+ }
+ if ((!_bSuppressContent && Request.HttpMethod.Equals("HEAD")) || _Writer == null) {
+ _bSuppressContent = true;
+ }
+
+ if (!_bSuppressContent) {
+ _bClientDisconnected = false;
+ if (_bChunked) {
+ Encoding oASCII = Encoding.ASCII;
+
+ byte [] arrPrefix = oASCII.GetBytes(Convert.ToString(_Writer.BufferSize, 16) + s_sChunkedPrefix);
+ _WorkerRequest.SendResponseFromMemory(arrPrefix, arrPrefix.Length);
+
+ _Writer.SendContent(_WorkerRequest);
+
+ _WorkerRequest.SendResponseFromMemory(s_arrChunkSuffix, s_arrChunkSuffix.Length);
+ if (bFinish) {
+ _WorkerRequest.SendResponseFromMemory(s_arrChunkEnd, s_arrChunkEnd.Length);
+ }
+ }
+ else {
+ _Writer.SendContent(_WorkerRequest);
+ }
+
+ _WorkerRequest.FlushResponse(bFinish);
+
+ if (!bFinish) {
+ _Writer.Clear();
+ }
+ }
+ }
+ finally {
+ _bFlushing = false;
+ }
+ }
+
+ public void Pics(string value) {
+ AppendHeader("PICS-Label", value);
+ }
+
+
+ public void Redirect(string url) {
+ Redirect(url, true);
+ }
+
+ public void Redirect(string url, bool endResponse) {
+ if (_bHeadersSent) {
+ throw new System.Web.HttpException("Headers has been sent to the client");
+ }
+
+ Clear();
+
+ StatusCode = 302;
+ AppendHeader(HttpWorkerRequest.HeaderLocation, url);
+
+ // Text for browsers that can't handle location header
+ Write("<html><head><title>Object moved</title></head><body>\r\n");
+ Write("<h2>Object moved to <a href='" + url + "'>here</a></h2>\r\n");
+ Write("</body><html>\r\n");
+
+ if (endResponse) {
+ End();
+ }
+ }
+
+ public void Write(char ch) {
+ _TextWriter.Write(ch);
+ }
+
+ public void Write(object obj) {
+ _TextWriter.Write(obj);
+ }
+
+ public void Write(string str) {
+ _TextWriter.Write(str);
+ }
+
+ public void Write(char [] buffer, int index, int count) {
+ _TextWriter.Write(buffer, index, count);
+ }
+
+ [MonoTODO()]
+ public static void RemoveOutputCacheItem(string path) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO()]
+ public void SetCookie(HttpCookie cookie) {
+ throw new NotImplementedException();
+ }
+
+ public void WriteFile(string filename) {
+ WriteFile(filename, false);
+ }
+
+ [MonoTODO()]
+ public void WriteFile(string filename, bool readIntoMemory) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO()]
+ public void WriteFile(string filename, long offset, long size) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("Should we support fileHandle ptrs?")]
+ public void WriteFile(IntPtr fileHandle, long offset, long size) {
+ }
+
+ [MonoTODO()]
+ internal void OnCookieAdd(HttpCookie cookie) {
+ }
+
+ [MonoTODO("Do we need this?")]
+ internal void OnCookieChange(HttpCookie cookie) {
+ }
+
+ [MonoTODO()]
+ internal void GoingToChangeCookieColl() {
+ }
+
+ [MonoTODO()]
+ internal void ChangedCookieColl() {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpResponseHeader.cs b/mcs/class/System.Web/System.Web/HttpResponseHeader.cs
new file mode 100644
index 00000000000..1d34d8da430
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponseHeader.cs
@@ -0,0 +1,53 @@
+//
+// System.Web.HttpResponseHeader
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+
+namespace System.Web {
+ internal class HttpResponseHeader {
+ private string _sHeader;
+ private string _sValue;
+ private int _iKnowHeaderId;
+
+ internal HttpResponseHeader(int KnowHeaderId, string value) {
+ _iKnowHeaderId = KnowHeaderId;
+ _sValue = value;
+ }
+
+ internal HttpResponseHeader(string header, string value) {
+ _sHeader = header;
+ _sValue = value;
+ }
+
+ internal string Name {
+ get {
+ if (null == _sHeader) {
+ return HttpWorkerRequest.GetKnownResponseHeaderName(_iKnowHeaderId);
+ }
+
+ return _sHeader;
+ }
+ }
+
+ internal string Value {
+ get {
+ return _sValue;
+ }
+ }
+
+ override public string ToString() {
+ return Name + ": " + Value;
+ }
+
+ internal void SendContent(HttpWorkerRequest WorkerRequest) {
+ if (null != _sHeader) {
+ WorkerRequest.SendUnknownResponseHeader(_sHeader, _sValue);
+ } else {
+ WorkerRequest.SendKnownResponseHeader(_iKnowHeaderId, _sValue);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpResponseStream.cs b/mcs/class/System.Web/System.Web/HttpResponseStream.cs
new file mode 100644
index 00000000000..340a5a50442
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponseStream.cs
@@ -0,0 +1,87 @@
+//
+// System.Web.HttpResponseStream
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.IO;
+
+namespace System.Web {
+ /// <summary>
+ /// Simple wrapper around HttpWriter to support the Stream interface
+ /// </summary>
+ public class HttpResponseStream : Stream {
+ private HttpWriter _Writer;
+
+ internal HttpResponseStream(HttpWriter Writer) {
+ _Writer = Writer;
+ }
+
+ public override void Flush() {
+ _Writer.Flush();
+ }
+
+ public override void Close() {
+ _Writer.Close();
+ }
+
+ public override int Read(byte [] buffer, int offset, int length) {
+ throw new NotSupportedException();
+ }
+
+ public override long Seek(long offset, SeekOrigin origin) {
+ throw new NotSupportedException();
+ }
+
+ public override void SetLength(long length) {
+ throw new NotSupportedException();
+ }
+
+ public override void Write(byte [] buffer, int offset, int length) {
+ if (offset < 0) {
+ throw new ArgumentOutOfRangeException("offset");
+ }
+
+ if (length <= 0) {
+ throw new ArgumentOutOfRangeException("length");
+ }
+
+ _Writer.WriteBytes(buffer, offset, length);
+ }
+
+ public override bool CanRead {
+ get {
+ return false;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return false;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return true;
+ }
+ }
+
+ public override long Length {
+ get {
+ throw new NotSupportedException();
+ }
+ }
+
+ public override long Position {
+ get {
+ throw new NotSupportedException();
+ }
+
+ set {
+ throw new NotSupportedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs b/mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs
new file mode 100644
index 00000000000..1ef2778f459
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpResponseStreamProxy.cs
@@ -0,0 +1,48 @@
+//
+// System.Web.HttpResponseStreamProxy
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.IO;
+
+namespace System.Web {
+ /// <summary>
+ /// Used to detect if there is a valid filter proxy.
+ /// </summary>
+ public class HttpResponseStreamProxy : HttpResponseStream {
+ bool _FilteringActive;
+
+ internal HttpResponseStreamProxy(HttpWriter Writer) : base(Writer) {
+ _FilteringActive = false;
+ }
+
+ internal void CheckFilteringState() {
+ if (_FilteringActive) {
+ throw new HttpException("Invalid response filter state");
+ }
+ }
+
+ internal bool Active {
+ get {
+ return _FilteringActive;
+ }
+ set {
+ _FilteringActive = value;
+ }
+ }
+
+ public override void Flush() {
+ }
+
+ public override void Close() {
+ }
+
+ public override void Write(byte [] buffer, int offset, int length) {
+ CheckFilteringState();
+
+ Write(buffer, offset, length);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpRuntime.cs b/mcs/class/System.Web/System.Web/HttpRuntime.cs
new file mode 100644
index 00000000000..079e39841a6
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpRuntime.cs
@@ -0,0 +1,254 @@
+//
+// System.Web.HttpRuntime
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Gaurav Vaish (gvaish@iitk.ac.in)
+//
+using System;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+using System.Web.UI;
+using System.Web.Utils;
+using System.Web.Caching;
+
+namespace System.Web {
+ [MonoTODO("Make corrent right now this is a simple impl to give us a base for testing... the methods here are not complete or valid")]
+ public sealed class HttpRuntime {
+ // Security permission helper objects
+ private static IStackWalk appPathDiscoveryStackWalk;
+ private static IStackWalk ctrlPrincipalStackWalk;
+ private static IStackWalk sensitiveInfoStackWalk;
+ private static IStackWalk unmgdCodeStackWalk;
+ private static IStackWalk unrestrictedStackWalk;
+ private static IStackWalk reflectionStackWalk;
+
+ private static HttpRuntime _Runtime;
+ private Cache _Cache;
+
+ // TODO: Temp to test the framework..
+ IHttpHandler _Handler;
+
+ static HttpRuntime() {
+ appPathDiscoveryStackWalk = null;
+ ctrlPrincipalStackWalk = null;
+ sensitiveInfoStackWalk = null;
+ unmgdCodeStackWalk = null;
+ unrestrictedStackWalk = null;
+
+ _Runtime = new HttpRuntime();
+ }
+
+ public HttpRuntime() {
+ Init();
+ }
+
+ private void Init() {
+ _Cache = new Cache();
+ }
+
+ public static IHttpHandler Handler {
+ get {
+ return _Runtime._Handler;
+ }
+
+ set {
+ _Runtime._Handler = value;
+ }
+ }
+
+ public static void ProcessRequest(HttpWorkerRequest Request) {
+ if (null == _Runtime._Handler) {
+ throw new ArgumentException("No handler");
+ }
+
+ // just a test method to test the framework
+
+ HttpContext oContext = new HttpContext(Request);
+ _Runtime._Handler.ProcessRequest(oContext);
+
+ oContext.Response.FlushAtEndOfRequest();
+ Request.EndOfRequest();
+ }
+
+ public static Cache Cache {
+ get {
+ return _Runtime._Cache;
+ }
+ }
+
+ [MonoTODO]
+ public static string AppDomainAppId {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public static string AppDomainAppPath {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public static string AppDomainAppVirtualPath {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public static string AppDomainId {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public static string AspInstallDirectory {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public static string BinDirectory {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public static string ClrInstallDirectory {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public static string CodegenDir {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public static bool IsOnUNCShare {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public static string MachineConfigurationDirectory {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ [MonoTODO]
+ public static void Close() {
+ throw new NotImplementedException();
+ }
+
+ internal static string FormatResourceString(string key) { return GetResourceString(key); }
+ internal static string FormatResourceString(string key, string arg0) {
+ string format = GetResourceString(key);
+ if(format==null)
+ return null;
+ return String.Format(format, arg0);
+ }
+
+ [MonoTODO("FormatResourceString(string, string, string)")]
+ internal static string FormatResourceString(string key, string arg0, string type) {
+ // String.Format(string, object, object);
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("FormatResourceString(string, string, string, string)")]
+ internal static string FormatResourceString(string key, string arg0, string arg1, string arg2) {
+ // String.Format(string, object, object, object);
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("FormatResourceString(string, string[]")]
+ internal static string FormatResourceString(string key, string[] args) {
+ // String.Format(string, object[]);
+ throw new NotImplementedException();
+ }
+
+ private static string GetResourceString(string key) {
+ return _Runtime.GetResourceStringFromResourceManager(key);
+ }
+
+ [MonoTODO("GetResourceStringFromResourceManager(string)")]
+ private string GetResourceStringFromResourceManager(string key) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("Get Application path from the appdomain object")]
+ internal static IStackWalk AppPathDiscovery {
+ get {
+ if(appPathDiscoveryStackWalk == null) {
+ appPathDiscoveryStackWalk = new FileIOPermission(FileIOPermissionAccess.PathDiscovery, "<apppath>");
+ }
+ return appPathDiscoveryStackWalk;
+ }
+ }
+
+ internal static IStackWalk ControlPrincipal {
+ get {
+ if(ctrlPrincipalStackWalk == null) {
+ ctrlPrincipalStackWalk = new SecurityPermission(SecurityPermissionFlag.ControlPrincipal);
+ }
+ return ctrlPrincipalStackWalk;
+ }
+ }
+
+ internal static IStackWalk Reflection {
+ get {
+ if(reflectionStackWalk == null) {
+ reflectionStackWalk = new ReflectionPermission(ReflectionPermissionFlag.TypeInformation | ReflectionPermissionFlag.MemberAccess);
+ }
+ return reflectionStackWalk;
+ }
+ }
+
+ internal static IStackWalk SensitiveInformation {
+ get {
+ if(sensitiveInfoStackWalk == null) {
+ sensitiveInfoStackWalk = new EnvironmentPermission(PermissionState.Unrestricted);
+ }
+ return sensitiveInfoStackWalk;
+ }
+ }
+
+ internal static IStackWalk UnmanagedCode {
+ get {
+ if(unmgdCodeStackWalk == null) {
+ unmgdCodeStackWalk = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode);
+ }
+ return unmgdCodeStackWalk;
+ }
+ }
+
+ internal static IStackWalk Unrestricted {
+ get {
+ if(unrestrictedStackWalk == null) {
+ unrestrictedStackWalk = new PermissionSet(PermissionState.Unrestricted);
+ }
+ return unrestrictedStackWalk;
+ }
+ }
+
+ internal static IStackWalk FileReadAccess(string file) {
+ return new FileIOPermission(FileIOPermissionAccess.Read, file);
+ }
+
+ internal static IStackWalk PathDiscoveryAccess(string path) {
+ return new FileIOPermission(FileIOPermissionAccess.PathDiscovery, path);
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpServerUtility.cs b/mcs/class/System.Web/System.Web/HttpServerUtility.cs
new file mode 100644
index 00000000000..c41d72d9d56
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpServerUtility.cs
@@ -0,0 +1,283 @@
+/**
+ * Namespace: System.Web
+ * Class: HttpServerUtility
+ *
+ * Author: Wictor Wilén
+ * Contact: <wictor@ibizkit.se>, <patrik.torstensson@labs2.com>
+ * Status: ?%
+ *
+ * (C) Wictor Wilén (2002)
+ * ---------------------------------------
+ * 2002-03-27 Wictor Started implementation
+ * 2002-04-09 Patrik Added HttpContext constructor
+ * 2002-04-10 Patrik Moved encoding to HttpUtility and
+ * fixed all functions that used
+ * HttpContext
+ *
+ */
+using System;
+using System.IO;
+
+namespace System.Web {
+ public sealed class HttpServerUtility {
+
+ private static string _name = "";
+
+ private HttpContext _Context;
+ private HttpApplication _Application;
+
+ [MonoTODO()]
+ internal HttpServerUtility(HttpContext Context) {
+ _Context = Context;
+ }
+
+ [MonoTODO()]
+ internal HttpServerUtility(HttpApplication app) {
+ _Application = app;
+ }
+
+ // Properties
+
+
+ /// <summary>
+ /// Gets the server's computer name.
+ /// </summary>
+ public string MachineName {
+ get {
+ if(_name.Length == 0) {
+ _name = Environment.MachineName;
+ }
+ return _name;
+ }
+ }
+ /// <summary>
+ /// Gets and sets the request time-out in seconds.
+ /// </summary>
+ [MonoTODO()]
+ public int ScriptTimeout {
+ get {
+ throw new System.NotImplementedException();
+ }
+ set {
+ throw new System.NotImplementedException();
+ }
+ }
+
+ // Methods
+
+ /// <summary>
+ /// Clears the previous exception.
+ /// </summary>
+ public void ClearError() {
+ if (null != _Context) {
+ _Context.ClearError();
+ return;
+ }
+
+ if (null != _Application) {
+ _Application.ClearError();
+ }
+ }
+
+
+ /// <summary>
+ /// Creates a server instance of a COM object identified by the object's Programmatic Identifier (ProgID).
+ /// </summary>
+ /// <param name="progID">The class or type of object to be instantiated. </param>
+ /// <returns>The new object.</returns>
+ public object CreateObject(string progID) {
+ return CreateObject(Type.GetTypeFromProgID(progID));
+ }
+
+
+ /// <summary>
+ /// Creates a server instance of a COM object identified by the object's type.
+ /// </summary>
+ /// <param name="type">A Type representing the object to create. </param>
+ /// <returns>The new object.</returns>
+ [MonoTODO()]
+ public object CreateObject(Type type) {
+ Object o;
+ o = Activator.CreateInstance(type);
+
+ // TODO: Call OnStartPage()
+
+ return o;
+ }
+
+
+ /// <summary>
+ /// Creates a server instance of a COM object identified by the object's class identifier (CLSID).
+ /// </summary>
+ /// <param name="clsid">The class identifier of the object to be instantiated. </param>
+ /// <returns>The new object.</returns>
+ public object CreateObjectFromClsid(string clsid) {
+ Guid guid = new Guid(clsid);
+ return CreateObject(Type.GetTypeFromCLSID(guid));
+ }
+
+
+ /// <summary>
+ /// Executes a request to another page using the specified URL path to the page.
+ /// </summary>
+ /// <param name="path">The URL path of the new request. </param>
+ [MonoTODO()]
+ public void Execute(string path) {
+ throw new System.NotImplementedException();
+ }
+
+
+ /// <summary>
+ /// Executes a request to another page using the specified URL path to the page. A TextWriter captures output from the page.
+ /// </summary>
+ /// <param name="path">The URL path of the new request. </param>
+ /// <param name="writer">The TextWriter to capture the output. </param>
+ [MonoTODO()]
+ public void Execute(string path, TextWriter writer ) {
+ throw new System.NotImplementedException();
+ }
+
+
+
+ /// <summary>
+ /// Returns the previous exception.
+ /// </summary>
+ /// <returns>The previous exception that was thrown.</returns>
+ [MonoTODO()]
+ public Exception GetLastError() {
+ throw new System.NotImplementedException();
+ }
+
+
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and returns the decoded string.
+ /// </summary>
+ /// <param name="s">The HTML string to decode. </param>
+ /// <returns>The decoded text.</returns>
+ [MonoTODO()]
+ public string HtmlDecode(string s) {
+ return HttpUtility.HtmlDecode(s);
+ }
+
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The HTML string to decode</param>
+ /// <param name="output">The TextWriter output stream containing the decoded string. </param>
+ public void HtmlDecode(string s, TextWriter output) {
+ output.Write(HttpUtility.HtmlDecode(s));
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text string to encode. </param>
+ /// <returns>The HTML-encoded text.</returns>
+ public string HtmlEncode(string s) {
+ return HttpUtility.HtmlEncode(s);
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The string to encode. </param>
+ /// <param name="output">The TextWriter output stream containing the encoded string. </param>
+ public void HtmlEncode( string s, TextWriter output) {
+ output.Write(HtmlEncode(s));
+ }
+
+
+ /// <summary>
+ /// Returns the physical file path that corresponds to the specified virtual path on the Web server.
+ /// </summary>
+ /// <param name="path">The virtual path on the Web server. </param>
+ /// <returns>The physical file path that corresponds to path.</returns>
+ public string MapPath(string path) {
+ if (null == _Context) {
+ throw new HttpException("MapPath is not available");
+ }
+
+ return _Context.Request.MapPath(path);
+ }
+
+ /// <summary>
+ /// Terminates execution of the current page and begins execution of a new page using the specified URL path to the page.
+ /// </summary>
+ /// <param name="path">The URL path of the new page on the server to execute. </param>
+ [MonoTODO()]
+ public void Transfer(string path) {
+ throw new System.NotImplementedException();
+ }
+
+ /// <summary>
+ /// Terminates execution of the current page and begins execution of a new page using the specified URL path to the page. Specifies whether to clear the QueryString and Form collections.
+ /// </summary>
+ /// <param name="path">The URL path of the new page on the server to execute. </param>
+ /// <param name="preserveForm">If true, the QueryString and Form collections are preserved. If false, they are cleared. The default is false. </param>
+ [MonoTODO()]
+ public void Transfer(string path, bool preserveForm ) {
+ throw new System.NotImplementedException();
+ }
+
+ /// <summary>
+ /// URL-decodes a string and returns the decoded string.
+ /// </summary>
+ /// <param name="s">The text string to decode. </param>
+ /// <returns>The decoded text.</returns>
+ /// <remarks>
+ /// Post/html encoding @ ftp://ftp.isi.edu/in-notes/rfc1866.txt
+ /// Uncomment the line marked with RFC1738 to get pure RFC1738
+ /// and it will also consider the RFC1866 (ftp://ftp.isi.edu/in-notes/rfc1866.txt)
+ /// `application/x-www-form-urlencoded' format
+ /// </remarks>
+ public string UrlDecode(string s) {
+ return HttpUtility.UrlDecode(s);
+ }
+
+ /// <summary>
+ /// Decodes an HTML string received in a URL and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s"></param>
+ /// <param name="output"></param>
+ public void UrlDecode(string s, TextWriter output) {
+ output.Write(UrlDecode(s));
+ }
+
+ /// <summary>
+ /// URL-encodes a string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text to URL-encode. </param>
+ /// <returns>The URL encoded text.</returns>
+ public string UrlEncode(string s) {
+ return HttpUtility.UrlEncode(s);
+ }
+
+ /// <summary>
+ /// URL encodes a string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The text string to encode. </param>
+ /// <param name="output">The TextWriter output stream containing the encoded string. </param>
+ public void UrlEncode(string s, TextWriter output) {
+ output.Write(UrlEncode(s));
+ }
+
+ /// <summary>
+ /// URL-encodes the path portion of a URL string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text to URL-encode.</param>
+ /// <returns>The URL encoded text.</returns>
+ /// <remarks>Does not do any browser specific adjustments, just encode everything</remarks>
+ public string UrlPathEncode(string s) {
+ // find the path portion (?)
+ int idx = s.IndexOf("?");
+ string s2 = s.Substring(0, idx-1);
+ s2 = UrlEncode(s2);
+ s2 += s.Substring(idx);
+
+ return s2;
+ }
+
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpSessionState.cs b/mcs/class/System.Web/System.Web/HttpSessionState.cs
new file mode 100644
index 00000000000..5500050c192
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpSessionState.cs
@@ -0,0 +1,15 @@
+//
+// System.Web.HttpSessionState
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+
+namespace System.Web {
+ [MonoTODO()]
+ public class HttpSessionState {
+ public HttpSessionState() {
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs b/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs
new file mode 100644
index 00000000000..30b26fce1ab
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpStaticObjectsCollection.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections;
+
+namespace System.Web {
+ public sealed class HttpStaticObjectsCollection : ICollection, IEnumerable {
+ private Hashtable _Objects;
+
+ // Needs to hold object items that can be latebound and can be serialized
+ public HttpStaticObjectsCollection() {
+ _Objects = new Hashtable();
+ }
+
+ public object GetObject(string name) {
+ return this[name];
+ }
+
+ [MonoTODO()]
+ public IEnumerator GetEnumerator() {
+ throw new NotImplementedException();
+ }
+
+ public void CopyTo(Array array, int index) {
+ IEnumerator Enum = GetEnumerator();
+ while (Enum.MoveNext()) {
+ array.SetValue(Enum.Current, ++index);
+ }
+ }
+
+ internal IDictionary GetObjects() {
+ return _Objects;
+ }
+
+ [MonoTODO()]
+ public object this[string name] {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
+ public int Count {
+ get {
+ return _Objects.Count;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return true;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ public object SyncRoot {
+ get {
+ return this;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpUtility.cs b/mcs/class/System.Web/System.Web/HttpUtility.cs
new file mode 100644
index 00000000000..206b8abb961
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpUtility.cs
@@ -0,0 +1,180 @@
+//
+// System.Web.HttpUtility
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// Wictor Wilén (decode/encode functions) (wictor@ibizkit.se)
+//
+using System;
+using System.Text;
+using System.IO;
+
+namespace System.Web {
+ public sealed class HttpUtility {
+ // private stuff
+ private const string _hex = "0123456789ABCDEF";
+ private const string _chars = "<>;:.?=&@*+%/\\";
+
+ public HttpUtility() {
+ }
+
+ public static void HtmlAttributeEncode(string s, TextWriter output) {
+ output.Write(HtmlAttributeEncode(s));
+ }
+
+ public static string HtmlAttributeEncode(string s) {
+ if (null == s) {
+ return s;
+ }
+
+ StringBuilder oStr = new StringBuilder(128);
+
+ for (int i = 0; i != s.Length; i++) {
+ if (s[i] == '&') {
+ oStr.Append("&amp;");
+ } else
+ if (s[i] == '"') {
+ oStr.Append("&quot;");
+ } else {
+ oStr.Append(s[i]);
+ }
+ }
+
+ return oStr.ToString();
+ }
+
+ public static string UrlDecode(string str) {
+ return UrlDecode(str, Encoding.UTF8);
+ }
+
+ [MonoTODO("Use Encoding")]
+ public static string UrlDecode(string s, Encoding Enc) {
+ if (null == s) {
+ return null;
+ }
+
+ string dest = "";
+ long len = s.Length;
+ string tmp = "";
+
+
+ for(int i = 0; i < len; i++) {
+ if(s[i] == '%') {
+ tmp = s[i+1].ToString ();
+ tmp += s[i+2];
+ dest += char.Parse(tmp);
+ }
+ else if( s[i] == '+') {
+ dest += " ";
+ }
+ else
+ dest += s[i];
+
+ }
+ return dest;
+ }
+
+
+
+ public static string UrlEncode(string str) {
+ return UrlDecode(str, Encoding.UTF8);
+ }
+
+ [MonoTODO("Use encoding")]
+ public static string UrlEncode(string s, Encoding Enc) {
+ if (null == s) {
+ return null;
+ }
+
+ string dest = "";
+ long len = s.Length;
+ int h1, h2;
+
+ for(int i = 0; i < len; i++) {
+ if(s[i] == ' ') // space character is replaced with '+'
+ dest += "+";
+ else if ( _chars.IndexOf(s[i]) >= 0 ) {
+ h1 = (int)s[i] % 16;
+ h2 = (int)s[i] / 16;
+ dest += "%";
+ dest += _hex[h1].ToString();
+ dest += _hex[h2].ToString();
+ }
+ else
+ dest += s[i].ToString();
+
+ }
+ return dest;
+ }
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and returns the decoded string.
+ /// </summary>
+ /// <param name="s">The HTML string to decode. </param>
+ /// <returns>The decoded text.</returns>
+ [MonoTODO()]
+ public static string HtmlDecode(string s) {
+ throw new System.NotImplementedException();
+ }
+
+ /// <summary>
+ /// Decodes an HTML-encoded string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The HTML string to decode</param>
+ /// <param name="output">The TextWriter output stream containing the decoded string. </param>
+ [MonoTODO()]
+ public static void HtmlDecode(string s, TextWriter output) {
+ throw new System.NotImplementedException();
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and returns the encoded string.
+ /// </summary>
+ /// <param name="s">The text string to encode. </param>
+ /// <returns>The HTML-encoded text.</returns>
+ public static string HtmlEncode(string s) {
+ string dest = "";
+ long len = s.Length;
+ int v;
+
+
+
+ for(int i = 0; i < len; i++) {
+ switch(s[i]) {
+ case '>':
+ dest += "&gt;";
+ break;
+ case '<':
+ dest += "&lt;";
+ break;
+ case '"':
+ dest += "&quot;";
+ break;
+ case '&':
+ dest += "&amp;";
+ break;
+ default:
+ if(s[i] >= 128) {
+ dest += "&H";
+ v = (int) s[i];
+ dest += v.ToString() ;
+
+ }
+ else
+ dest += s[i];
+ break;
+ }
+ }
+ return dest;
+ }
+
+ /// <summary>
+ /// HTML-encodes a string and sends the resulting output to a TextWriter output stream.
+ /// </summary>
+ /// <param name="s">The string to encode. </param>
+ /// <param name="output">The TextWriter output stream containing the encoded string. </param>
+ public static void HtmlEncode( string s, TextWriter output) {
+ output.Write(HtmlEncode(s));
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/HttpValidationStatus.cs b/mcs/class/System.Web/System.Web/HttpValidationStatus.cs
new file mode 100644
index 00000000000..6338b59d613
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpValidationStatus.cs
@@ -0,0 +1,18 @@
+//
+// System.Web.HttpValidationStatus.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web
+{
+ public enum HttpValidationStatus
+ {
+ IgnoreThisRequest,
+ Invalid,
+ Valid
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web/HttpValueCollection.cs b/mcs/class/System.Web/System.Web/HttpValueCollection.cs
new file mode 100644
index 00000000000..018234198b7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpValueCollection.cs
@@ -0,0 +1,142 @@
+//
+// System.Web.HttpValueCollection
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.Collections.Specialized;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace System.Web {
+
+ [Serializable]
+ public class HttpValueCollection : NameValueCollection {
+ private bool _bHeaders;
+
+ internal HttpValueCollection() {
+ _bHeaders = false;
+ }
+
+ internal HttpValueCollection(string sData) {
+ FillFromQueryString(sData, Encoding.UTF8);
+ IsReadOnly = true;
+ }
+
+ internal HttpValueCollection(string sData, bool ReadOnly, Encoding encoding) {
+ FillFromQueryString(sData, encoding);
+ IsReadOnly = ReadOnly;
+ }
+
+ protected HttpValueCollection(SerializationInfo info, StreamingContext context) : base(info, context) {
+ }
+
+ // string = header1: value1\r\nheader2: value2
+ internal void FillFromHeaders(string sHeaders, Encoding encoding) {
+ _bHeaders = true;
+ char [] arrSplitValue = new char [] {':'};
+ string sKey, sValue;
+
+ sKey = "";
+ sValue = "";
+
+ string [] arrValues = sHeaders.Split(new char [] {'\r', '\n'});
+ foreach (string sLine in arrValues) {
+ string [] arrKeyValue = sLine.Split(arrSplitValue);
+ if (arrKeyValue.Length == 1 && arrKeyValue[0].Length == 0) {
+ // Empty \r or \n is ignored
+ continue;
+ }
+
+ if (arrKeyValue[0] != sKey && sKey.Length > 0) {
+ Add(System.Web.HttpUtility.UrlDecode(sKey, encoding), System.Web.HttpUtility.UrlDecode(sValue, encoding));
+ }
+
+ if (arrKeyValue.Length == 1) {
+ sValue += "\r\n" + arrKeyValue[0].Trim();
+ continue;
+ }
+ else if (arrKeyValue.Length == 2) {
+ if (arrKeyValue[0].Length == 0) {
+ sValue += arrKeyValue[1].Trim();
+ continue;
+ }
+
+ sKey = arrKeyValue[0].Trim();
+ sValue = arrKeyValue[1].Trim();
+ }
+ }
+
+ if (sKey.Length > 0) {
+ Add(System.Web.HttpUtility.UrlDecode(sKey, encoding), System.Web.HttpUtility.UrlDecode(sValue, encoding));
+ }
+ }
+
+ internal void FillFromHeaders(string sData) {
+ FillFromHeaders(sData, Encoding.UTF8);
+ }
+
+ // String = test=aaa&kalle=nisse
+ internal void FillFromQueryString(string sData, Encoding encoding) {
+ _bHeaders = false;
+
+ char [] arrSplitValue = new char [] {'='};
+
+ string [] arrValues = sData.Split(new char [] {'&'});
+ foreach (string sValue in arrValues) {
+ string [] arrKeyValue = sValue.Split(arrSplitValue);
+ if (arrKeyValue.Length == 1) {
+ // Add key only
+ Add(System.Web.HttpUtility.UrlDecode(arrKeyValue[0].Trim(), encoding), string.Empty);
+ }
+ else if (arrKeyValue.Length == 2) {
+ Add(System.Web.HttpUtility.UrlDecode(arrKeyValue[0].Trim(), encoding),System.Web.HttpUtility.UrlDecode(arrKeyValue[1].Trim(), encoding));
+ }
+ else {
+ throw new InvalidOperationException("Data is malformed");
+ }
+ }
+ }
+
+ internal void FillFromQueryString(string sData) {
+ FillFromQueryString(sData, Encoding.UTF8);
+ }
+
+ internal void FillFromCookieString(string sData) {
+ FillFromQueryString(sData, Encoding.UTF8);
+ }
+
+ internal void MakeReadOnly() {
+ IsReadOnly = true;
+ }
+
+ internal void MakeReadWrite() {
+ IsReadOnly = false;
+ }
+
+ internal void Merge(NameValueCollection oData) {
+ foreach (string sKey in oData) {
+ Add(sKey, oData[sKey]);
+ }
+ }
+
+ internal void Reset() {
+ Clear();
+ }
+
+ [MonoTODO("string ToString(bool UrlEncode)")]
+ internal string ToString(bool UrlEncode) {
+ if (_bHeaders) {
+ }
+
+ // TODO: Should return a correctly formated string (different depending on header flag)
+ throw new NotImplementedException();
+ }
+
+ virtual new public string ToString() {
+ return ToString(false);
+ }
+ }
+
+}
diff --git a/mcs/class/System.Web/System.Web/HttpWorkerRequest.cs b/mcs/class/System.Web/System.Web/HttpWorkerRequest.cs
new file mode 100644
index 00000000000..e1bf3c981a7
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpWorkerRequest.cs
@@ -0,0 +1,477 @@
+//
+// System.Web.HttpResponseStreamProxy
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+// (constants from Bob Smith (bob@thestuff.net))
+//
+using System;
+using System.Collections;
+
+namespace System.Web {
+ public abstract class HttpWorkerRequest {
+ public delegate void EndOfSendNotification(HttpWorkerRequest wr, object extraData);
+
+ public const int HeaderAccept = 20;
+ public const int HeaderAcceptCharset = 21;
+ public const int HeaderAcceptEncoding = 22;
+ public const int HeaderAcceptLanguage = 23;
+ public const int HeaderAcceptRanges = 20;
+ public const int HeaderAge = 21;
+ public const int HeaderAllow = 10;
+ public const int HeaderAuthorization = 24;
+ public const int HeaderCacheControl = 0;
+ public const int HeaderConnection = 1;
+ public const int HeaderContentEncoding = 13;
+ public const int HeaderContentLanguage = 14;
+ public const int HeaderContentLength = 11;
+ public const int HeaderContentLocation = 15;
+ public const int HeaderContentMd5 = 16;
+ public const int HeaderContentRange = 17;
+ public const int HeaderContentType = 12;
+ public const int HeaderCookie = 25;
+ public const int HeaderDate = 2;
+ public const int HeaderEtag = 22;
+ public const int HeaderExpect = 26;
+ public const int HeaderExpires = 18;
+ public const int HeaderFrom = 27;
+ public const int HeaderHost = 28;
+ public const int HeaderIfMatch = 29;
+ public const int HeaderIfModifiedSince = 30;
+ public const int HeaderIfNoneMatch = 31;
+ public const int HeaderIfRange = 32;
+ public const int HeaderIfUnmodifiedSince = 33;
+ public const int HeaderKeepAlive = 3;
+ public const int HeaderLastModified = 19;
+ public const int HeaderLocation = 23;
+ public const int HeaderMaxForwards = 34;
+ public const int HeaderPragma = 4;
+ public const int HeaderProxyAuthenticate = 24;
+ public const int HeaderProxyAuthorization = 35;
+ public const int HeaderRange = 37;
+ public const int HeaderReferer = 36;
+ public const int HeaderRetryAfter = 25;
+ public const int HeaderServer = 26;
+ public const int HeaderSetCookie = 27;
+ public const int HeaderTe = 38;
+ public const int HeaderTrailer = 5;
+ public const int HeaderTransferEncoding = 6;
+ public const int HeaderUpgrade = 7;
+ public const int HeaderUserAgent = 39;
+ public const int HeaderVary = 28;
+ public const int HeaderVia = 8;
+ public const int HeaderWarning = 9;
+ public const int HeaderWwwAuthenticate = 29;
+ public const int ReasonCachePolicy = 2;
+ public const int ReasonCacheSecurity = 3;
+ public const int ReasonClientDisconnect = 4;
+ public const int ReasonDefault = 0;
+ public const int ReasonFileHandleCacheMiss = 1;
+ public const int ReasonResponseCacheMiss = 0;
+ public const int RequestHeaderMaximum = 40;
+ public const int ResponseHeaderMaximum = 30;
+
+ static string [][] s_HttpStatusDescriptions;
+ static string [] s_HttpRequestHeaderNames;
+ static string [] s_HttpResponseHeaderNames;
+
+ static Hashtable s_HttpResponseHeadersTable;
+ static Hashtable s_HttpRequestHeaderTable;
+
+ static HttpWorkerRequest() {
+ string[] sSubCodes;
+
+ s_HttpStatusDescriptions = new string[6][];
+
+ sSubCodes = new String[3];
+ sSubCodes[0] = "Continue";
+ sSubCodes[1] = "Switching Protocols";
+ sSubCodes[2] = "Processing";
+ s_HttpStatusDescriptions[1] = sSubCodes;
+
+ sSubCodes = new String[8];
+ sSubCodes[0] = "OK";
+ sSubCodes[1] = "Created";
+ sSubCodes[2] = "Accepted";
+ sSubCodes[3] = "Non-Authoritative Information";
+ sSubCodes[4] = "No Content";
+ sSubCodes[5] = "Reset Content";
+ sSubCodes[6] = "Partial Content";
+ sSubCodes[7] = "Multi-Status";
+ s_HttpStatusDescriptions[2] = sSubCodes;
+
+ sSubCodes = new String[8];
+ sSubCodes[0] = "Multiple Choices";
+ sSubCodes[1] = "Moved Permanently";
+ sSubCodes[2] = "Found";
+ sSubCodes[3] = "See Other";
+ sSubCodes[4] = "Not Modified";
+ sSubCodes[5] = "Use Proxy";
+ sSubCodes[6] = "";
+ sSubCodes[7] = "Temporary Redirect";
+ s_HttpStatusDescriptions[3] = sSubCodes;
+
+ sSubCodes = new String[24];
+ sSubCodes[0] = "Bad Request";
+ sSubCodes[1] = "Unauthorized";
+ sSubCodes[2] = "Payment Required";
+ sSubCodes[3] = "Forbidden";
+ sSubCodes[4] = "Not Found";
+ sSubCodes[5] = "Method Not Allowed";
+ sSubCodes[6] = "Not Acceptable";
+ sSubCodes[7] = "Proxy Authentication Required";
+ sSubCodes[8] = "Request Timeout";
+ sSubCodes[9] = "Conflict";
+ sSubCodes[10] = "Gone";
+ sSubCodes[11] = "Length Required";
+ sSubCodes[12] = "Precondition Failed";
+ sSubCodes[13] = "Request Entity Too Large";
+ sSubCodes[14] = "Request-Uri Too Long";
+ sSubCodes[15] = "Unsupported Media Type";
+ sSubCodes[16] = "Requested Range Not Satisfiable";
+ sSubCodes[17] = "Expectation Failed";
+ sSubCodes[18] = "";
+ sSubCodes[19] = "";
+ sSubCodes[20] = "";
+ sSubCodes[21] = "Unprocessable Entity";
+ sSubCodes[22] = "Locked";
+ sSubCodes[23] = "Failed Dependency";
+ s_HttpStatusDescriptions[4] = sSubCodes;
+
+ sSubCodes = new String[8];
+ sSubCodes[0] = "Internal Server Error";
+ sSubCodes[1] = "Not Implemented";
+ sSubCodes[2] = "Bad Gateway";
+ sSubCodes[3] = "Service Unavailable";
+ sSubCodes[4] = "Gateway Timeout";
+ sSubCodes[5] = "Http Version Not Supported";
+ sSubCodes[6] = "";
+ sSubCodes[7] = "Insufficient Storage";
+ s_HttpStatusDescriptions[5] = sSubCodes;
+
+ InitLookupTables();
+ }
+
+ protected HttpWorkerRequest() {
+ }
+
+ static private void InitLookupTables() {
+ // Performance arrays
+ s_HttpRequestHeaderNames = new string[40];
+ s_HttpResponseHeaderNames = new string[30];
+
+ // Lookup tables (name -> id)
+ s_HttpRequestHeaderTable = new Hashtable();
+ s_HttpResponseHeadersTable = new Hashtable();
+
+ AddHeader(true, true, 0, "Cache-Control");
+ AddHeader(true, true, 1, "Connection");
+ AddHeader(true, true, 2, "Date");
+ AddHeader(true, true, 3, "Keep-Alive");
+ AddHeader(true, true, 4, "Pragma");
+ AddHeader(true, true, 5, "Trailer");
+ AddHeader(true, true, 6, "Transfer-Encoding");
+ AddHeader(true, true, 7, "Upgrade");
+ AddHeader(true, true, 8, "Via");
+ AddHeader(true, true, 9, "Warning");
+ AddHeader(true, true, 10, "Allow");
+ AddHeader(true, true, 11, "Content-Length");
+ AddHeader(true, true, 12, "Content-Type");
+ AddHeader(true, true, 13, "Content-Encoding");
+ AddHeader(true, true, 14, "Content-Language");
+ AddHeader(true, true, 15, "Content-Location");
+ AddHeader(true, true, 16, "Content-MD5");
+ AddHeader(true, true, 17, "Content-Range");
+ AddHeader(true, true, 18, "Expires");
+ AddHeader(true, true, 19, "Last-Modified");
+ AddHeader(true, false, 20, "Accept");
+ AddHeader(true, false, 21, "Accept-Charset");
+ AddHeader(true, false, 22, "Accept-Encoding");
+ AddHeader(true, false, 23, "Accept-Language");
+ AddHeader(true, false, 24, "Authorization");
+ AddHeader(true, false, 25, "Cookie");
+ AddHeader(true, false, 26, "Expect");
+ AddHeader(true, false, 27, "From");
+ AddHeader(true, false, 28, "Host");
+ AddHeader(true, false, 29, "If-Match");
+ AddHeader(true, false, 30, "If-Modified-Since");
+ AddHeader(true, false, 31, "If-None-Match");
+ AddHeader(true, false, 32, "If-Range");
+ AddHeader(true, false, 33, "If-Unmodified-Since");
+ AddHeader(true, false, 34, "Max-Forwards");
+ AddHeader(true, false, 35, "Proxy-Authorization");
+ AddHeader(true, false, 36, "Referer");
+ AddHeader(true, false, 37, "Range");
+ AddHeader(true, false, 38, "TE");
+ AddHeader(true, false, 39, "User-Agent");
+ AddHeader(false, true, 20, "Accept-Ranges");
+ AddHeader(false, true, 21, "Age");
+ AddHeader(false, true, 22, "ETag");
+ AddHeader(false, true, 23, "Location");
+ AddHeader(false, true, 24, "Proxy-Authenticate");
+ AddHeader(false, true, 25, "Retry-After");
+ AddHeader(false, true, 26, "Server");
+ AddHeader(false, true, 27, "Set-Cookie");
+ AddHeader(false, true, 28, "Vary");
+ AddHeader(false, true, 29, "WWW-Authenticate");
+ }
+
+ static private void AddHeader(bool bRequest, bool bResponse, int iID, string sHeader) {
+ if (bResponse) {
+ s_HttpResponseHeaderNames[iID] = sHeader;
+ s_HttpResponseHeadersTable.Add(sHeader, iID);
+ }
+
+ if (bRequest) {
+ s_HttpRequestHeaderNames[iID] = sHeader;
+ s_HttpRequestHeaderTable.Add(sHeader, iID);
+ }
+ }
+
+ public virtual void CloseConnection() {}
+ public abstract void EndOfRequest();
+ public abstract void FlushResponse(bool finalFlush);
+
+ public virtual string GetAppPath() {
+ return null;
+ }
+
+ public virtual string GetAppPathTranslated() {
+ return null;
+ }
+
+ public virtual string GetAppPoolID() {
+ return null;
+ }
+
+ public virtual long GetBytesRead() {
+ return 0;
+ }
+
+ public virtual byte[] GetClientCertificate() {
+ return new byte[0];
+ }
+
+ public virtual byte[] GetClientCertificateBinaryIssuer() {
+ return new byte[0];
+ }
+
+ public virtual int GetClientCertificateEncoding() {
+ return 0;
+ }
+
+ public virtual byte[] GetClientCertificatePublicKey() {
+ return new byte[0];
+ }
+
+ public virtual DateTime GetClientCertificateValidFrom() {
+ return DateTime.Now;
+ }
+
+ public virtual DateTime GetClientCertificateValidUntil() {
+ return DateTime.Now;
+ }
+
+ public virtual long GetConnectionID() {
+ return 0;
+ }
+
+ public virtual string GetFilePath() {
+ return GetUriPath();
+ }
+
+ public virtual string GetFilePathTranslated() {
+ return null;
+ }
+
+ public abstract string GetHttpVerbName();
+ public abstract string GetHttpVersion();
+
+ public virtual string GetKnownRequestHeader(int index) {
+ return null;
+ }
+
+ public static int GetKnownRequestHeaderIndex(string header) {
+ object Index;
+ Index = s_HttpRequestHeaderTable[header];
+ if (null != Index) {
+ return (Int32) Index;
+ }
+
+ return -1;
+ }
+
+ public static string GetKnownRequestHeaderName(int index) {
+ return s_HttpRequestHeaderNames[index];
+ }
+
+ public static int GetKnownResponseHeaderIndex(string header) {
+ object Index;
+
+ Index = s_HttpResponseHeadersTable[header];
+ if (null != Index) {
+ return (Int32) Index;
+ }
+
+ return -1;
+ }
+
+ public static string GetKnownResponseHeaderName(int index) {
+ return s_HttpResponseHeaderNames[index];
+ }
+
+ public abstract string GetLocalAddress();
+ public abstract int GetLocalPort();
+
+ public virtual string GetPathInfo() {
+ return "";
+ }
+
+ public virtual byte[] GetPreloadedEntityBody() {
+ return null;
+ }
+
+ public virtual string GetProtocol() {
+ if (IsSecure()) {
+ return "HTTPS";
+ }
+
+ return "HTTP";
+ }
+
+ public abstract string GetQueryString();
+
+ public virtual byte[] GetQueryStringRawBytes() {
+ return null;
+ }
+
+ public abstract string GetRawUrl();
+ public abstract string GetRemoteAddress();
+
+ public virtual string GetRemoteName() {
+ return GetRemoteAddress();
+ }
+
+ public abstract int GetRemotePort();
+
+ public virtual int GetRequestReason() {
+ return 0;
+ }
+
+ public virtual string GetServerName() {
+ return GetLocalAddress();
+ }
+
+ public virtual string GetServerVariable(string name) {
+ return null;
+ }
+
+ public static string GetStatusDescription(int code) {
+ if (code>= 100 && code < 600) {
+ int iMajor = code / 100;
+ int iMinor = code % 100;
+ if (iMinor < (int) s_HttpStatusDescriptions[iMajor].Length) {
+ return s_HttpStatusDescriptions[iMajor][iMinor];
+ }
+ }
+
+ return "";
+ }
+
+ public virtual string GetUnknownRequestHeader(string name) {
+ return null;
+ }
+
+ [CLSCompliant(false)]
+ public virtual string[][] GetUnknownRequestHeaders() {
+ return null;
+ }
+
+ public abstract string GetUriPath();
+
+ public virtual long GetUrlContextID() {
+ return 0;
+ }
+
+ public virtual IntPtr GetUserToken() {
+ throw new NotSupportedException();
+ }
+
+ public virtual IntPtr GetVirtualPathToken() {
+ throw new NotSupportedException();
+ }
+
+ public bool HasEntityBody() {
+ string sContentLength = GetKnownRequestHeader(HeaderContentLength);
+ if (null != sContentLength && sContentLength != "0") {
+ return true;
+ }
+
+ if (null != GetKnownRequestHeader(HeaderTransferEncoding)) {
+ return true;
+ }
+
+ if (null != GetPreloadedEntityBody() || IsEntireEntityBodyIsPreloaded()) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public virtual bool HeadersSent() {
+ return true;
+ }
+
+ public virtual bool IsClientConnected() {
+ return true;
+ }
+
+ public virtual bool IsEntireEntityBodyIsPreloaded() {
+ return false;
+ }
+
+ public virtual bool IsSecure() {
+ return false;
+ }
+
+ public virtual string MapPath(string virtualPath) {
+ return null;
+ }
+
+ public virtual int ReadEntityBody(byte[] buffer, int size) {
+ return 0;
+ }
+
+ public virtual void SendCalculatedContentLength(int contentLength) {
+ }
+
+ public abstract void SendKnownResponseHeader(int index, string value);
+ public abstract void SendResponseFromFile(IntPtr handle, long offset, long length);
+ public abstract void SendResponseFromFile(string filename, long offset, long length);
+ public abstract void SendResponseFromMemory(byte[] data, int length);
+
+ [MonoTODO("Should we support this method? We could just use the stringresource to build a string and then send it via SendResponseFromMemory?")]
+ public virtual void SendResponseFromMemory(IntPtr data, int length) {
+ throw new NotSupportedException();
+ }
+
+ public abstract void SendStatus(int statusCode, string statusDescription);
+ public abstract void SendUnknownResponseHeader(string name, string value);
+
+ public virtual void SetEndOfSendNotification(HttpWorkerRequest.EndOfSendNotification callback, object extraData) {
+ }
+
+ public virtual string MachineConfigPath {
+ get {
+ return null;
+ }
+ }
+
+ public virtual string MachineInstallDirectory {
+ get {
+ return null;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System.Web/System.Web/HttpWriter.cs b/mcs/class/System.Web/System.Web/HttpWriter.cs
new file mode 100644
index 00000000000..f34dc5c33ed
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/HttpWriter.cs
@@ -0,0 +1,230 @@
+//
+// System.Web.HttpWriter
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+using System.IO;
+using System.Text;
+
+namespace System.Web {
+ public sealed class HttpWriter : TextWriter {
+ private HttpResponse _Response;
+
+ private HttpResponseStream _ResponseStream;
+
+ private MemoryStream _OutputStream;
+ private StreamWriter _OutputHelper;
+ private Encoder _Encoder;
+ private Encoding _Encoding;
+
+ private Stream _OutputFilter;
+ private HttpResponseStreamProxy _OutputProxy;
+
+ internal HttpWriter(HttpResponse Response) {
+ _Response = Response;
+
+ _OutputStream = new MemoryStream(32768);
+ _OutputHelper = new StreamWriter(_OutputStream, Encoding.Unicode);
+ _ResponseStream = new HttpResponseStream(this);
+
+ Update();
+ }
+
+ internal void Dispose() {
+ _OutputHelper.Close();
+ _OutputStream.Close();
+
+ _OutputFilter.Close();
+ }
+
+ internal Stream GetActiveFilter() {
+ if (null == _OutputFilter) {
+ if (null == _OutputProxy) {
+ // Create a filter proxy to allow us to know if we have a valid filter
+ _OutputProxy = new HttpResponseStreamProxy(this);
+ }
+
+ return _OutputProxy;
+ }
+
+ return _OutputFilter;
+ }
+
+ internal void ActivateFilter(Stream OutputFilter) {
+ if (null == _OutputProxy) {
+ throw new HttpException("Invalid filter usage");
+ }
+
+ _OutputFilter = OutputFilter;
+ }
+
+ internal void FilterData(bool CloseStream) {
+ // Check if we have any filter at all
+ if (null == _OutputFilter) {
+ return;
+ }
+
+ FlushBuffers();
+
+ // Save our current data
+ byte [] arrData = _OutputStream.ToArray();
+
+ // Remove our internal data
+ Clear();
+
+ // If we have a filter then we have a proxy
+ _OutputProxy.Active = true;
+
+ try {
+ // Call the filter (it does a callback into our HttpWriter again)
+ _OutputFilter.Write(arrData, 0, arrData.Length);
+
+ if (CloseStream) {
+ _OutputFilter.Close();
+ }
+ }
+ finally {
+ _OutputProxy.Active = false;
+ }
+ }
+
+ internal void Clear() {
+ _OutputHelper.Close();
+ _OutputStream.Close();
+
+ // Quick way of doing cleanup
+ _OutputStream = new MemoryStream(32768);
+ _OutputHelper = new StreamWriter(_OutputStream, Encoding.Unicode);
+ }
+
+ internal byte [] ToArray() {
+ if (_OutputStream.Length == 0) {
+ return null;
+ }
+
+ // TODO: Optimize
+ byte [] arrStream = _OutputStream.ToArray();
+ byte [] arrData = new byte [arrStream.Length - 2];
+
+ Buffer.BlockCopy(arrStream, 2, arrData, 0, arrStream.Length - 2);
+
+ byte [] arrContent = _Encoding.GetBytes(Encoding.Unicode.GetString(arrData));
+
+ return arrContent;
+ }
+
+ internal void SendContent(HttpWorkerRequest Handler) {
+ FlushBuffers();
+
+ if (_OutputStream.Length > 0) {
+ byte [] arrContent = ToArray();
+ Handler.SendResponseFromMemory(arrContent, arrContent.Length);
+ }
+ }
+
+ internal void Update() {
+ _Encoder = _Response.ContentEncoder;
+ _Encoding = _Response.ContentEncoding;
+ }
+
+ internal long BufferSize {
+ get {
+ FlushBuffers();
+
+ if (_OutputStream.Length == 0) {
+ return 0;
+ }
+
+ return ToArray().Length;
+ }
+ }
+
+ internal void FlushBuffers() {
+ _OutputHelper.Flush();
+ _OutputStream.Flush();
+ }
+
+ public override Encoding Encoding {
+ get {
+ return _Encoding;
+ }
+ }
+
+ public Stream OutputStream {
+ get {
+ return _ResponseStream;
+ }
+ }
+
+ public override void Close() {
+ FlushBuffers();
+
+ _Response.Flush();
+ _Response.Close();
+ }
+
+ public override void Flush() {
+ FlushBuffers();
+
+ _Response.Flush();
+ }
+
+ public override void Write(char ch) {
+ _OutputHelper.Write(ch);
+ if (!_Response.BufferOutput) {
+ FlushBuffers();
+ _Response.Flush();
+ }
+ }
+
+ public override void Write(object obj) {
+ _OutputHelper.Write(obj.ToString());
+ if (!_Response.BufferOutput) {
+ FlushBuffers();
+ _Response.Flush();
+ }
+ }
+
+ public override void Write(string s) {
+ _OutputHelper.Write(s);
+ if (!_Response.BufferOutput) {
+ FlushBuffers();
+ _Response.Flush();
+ }
+ }
+
+ public override void Write(char[] buffer, int index, int count) {
+ _OutputHelper.Write(buffer, index, count);
+ if (!_Response.BufferOutput) {
+ FlushBuffers();
+ _Response.Flush();
+ }
+ }
+
+ public void WriteBytes(byte[] buffer, int index, int count) {
+ _OutputStream.Write(buffer, index, count);
+ if (!_Response.BufferOutput) {
+ FlushBuffers();
+ _Response.Flush();
+ }
+ }
+
+ override public void WriteLine() {
+ _OutputHelper.Write("\n\r");
+ if (!_Response.BufferOutput) {
+ FlushBuffers();
+ _Response.Flush();
+ }
+ }
+
+ public void WriteString(string s, int index, int count) {
+ _OutputHelper.Write(s.Substring(index, count));
+ if (!_Response.BufferOutput) {
+ FlushBuffers();
+ _Response.Flush();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs b/mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs
new file mode 100644
index 00000000000..06e62cba463
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpAsyncHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Web.IHttpAsyncHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+namespace System.Web
+{
+ public interface IHttpAsyncHandler : IHttpHandler
+ {
+ IAsyncResult BeginProcessRequest(HttpContext context,
+ AsyncCallback cb,
+ object extraData);
+ void EndProcessRequest(IAsyncResult result);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/IHttpHandler.cs b/mcs/class/System.Web/System.Web/IHttpHandler.cs
new file mode 100644
index 00000000000..8bad2c1b1bd
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.IHttpHandler.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+namespace System.Web
+{
+ public interface IHttpHandler
+ {
+ bool IsReusable { get; }
+ void ProcessRequest(HttpContext context);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs b/mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs
new file mode 100644
index 00000000000..b8cc4a3d2c5
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpHandlerFactory.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.IHttpHandlerFactory.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+namespace System.Web
+{
+ public interface IHttpHandlerFactory
+ {
+ IHttpHandler GetHandler(HttpContext context,
+ string requestType,
+ string url,
+ string pathTranslated);
+ void ReleaseHandler(IHttpHandler handler);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/IHttpModule.cs b/mcs/class/System.Web/System.Web/IHttpModule.cs
new file mode 100644
index 00000000000..a98d2f54d29
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/IHttpModule.cs
@@ -0,0 +1,14 @@
+//
+// System.Web.IHttpModule.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+namespace System.Web {
+ public interface IHttpModule {
+ void Dispose();
+ void Init(HttpApplication context);
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/NOTES b/mcs/class/System.Web/System.Web/NOTES
new file mode 100644
index 00000000000..55926bd4ef9
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/NOTES
@@ -0,0 +1,21 @@
+Found another namespace not listed. System.Web.Hosting.
+HttpRuntime.ProcessRequest and HttpWorkerRequest seems to be the key.
+
+ASP maintains a pool of HttpApplication objects dirived from Global.asax.
+One is used per request, then reclamed after the request is totally
+complete.
+
+Read:
+http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguidnf/html/cpconaspnetapplications.asp
+
+
+Request notes:
+It apears each http request has its own thread. Need to figure out how to deal with this with apache.
+
+Session notes:
+When a request is finished, the contents of Request.Session are serialized and dumped to the State Server.
+When a request is started, a new Request.Session is created, data is deserialized from the State Server, and the objects are placed back into Request.Session.
+The State Server is accessed via the SessionStateModule which is used for both session ID and state data management.
+HttpApplicationState instance is created the first time a url within the applications virtual directory is accessed. Its accessable through HttpContext.Application.
+HttpApplicationState needs to use lock/unlock explicitly.
+Not shared across machines or multiple processes.
diff --git a/mcs/class/System.Web/System.Web/ProcessShutdownReason.cs b/mcs/class/System.Web/System.Web/ProcessShutdownReason.cs
new file mode 100644
index 00000000000..e8c8ed21de2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ProcessShutdownReason.cs
@@ -0,0 +1,22 @@
+//
+// System.Web.ProcessShutdownReason.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web {
+ public enum ProcessShutdownReason {
+ DeadlockSuspected,
+ IdleTimeout,
+ MemoryLimitExceeded,
+ None,
+ PingFailed,
+ RequestQueueLimit,
+ RequestsLimit,
+ Timeout,
+ Unexpected
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web/ProcessStatus.cs b/mcs/class/System.Web/System.Web/ProcessStatus.cs
new file mode 100644
index 00000000000..79066887e78
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/ProcessStatus.cs
@@ -0,0 +1,19 @@
+//
+// System.Web.ProcessStatus.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web
+{
+ public enum ProcessStatus
+ {
+ Alive,
+ ShutDown,
+ ShuttingDown,
+ Terminated
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Web/System.Web/TODO b/mcs/class/System.Web/System.Web/TODO
new file mode 100644
index 00000000000..4de26ec8397
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TODO
@@ -0,0 +1,19 @@
+HttpClientCertificate
+HttpApplicationState
+HttpFileCollection
+HttpModuleCollection
+HttpException
+HttpCompileException
+HttpParseException
+HttpUnhandledException
+HttpCapabilitiesBase
+HttpBrowserCapabilities
+HttpApplication
+HttpCachePolicy
+HttpCacheVaryByHeaders
+HttpCacheVaryByParams
+HttpPostedFile
+HttpStaticObjectsCollection
+ProcessInfo
+ProcessModelInfo
+TraceContext
diff --git a/mcs/class/System.Web/System.Web/TODOAttribute.cs b/mcs/class/System.Web/System.Web/TODOAttribute.cs
new file mode 100644
index 00000000000..eb2bfa0dda2
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TODOAttribute.cs
@@ -0,0 +1,32 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Web {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/TraceContext.cs b/mcs/class/System.Web/System.Web/TraceContext.cs
new file mode 100644
index 00000000000..0708227547c
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TraceContext.cs
@@ -0,0 +1,69 @@
+//
+// System.Web.TraceContext
+//
+// Author:
+// Patrik Torstensson (Patrik.Torstensson@labs2.com)
+//
+using System;
+
+namespace System.Web {
+ public sealed class TraceContext {
+ private HttpContext _Context;
+ private bool _Enabled;
+ private TraceMode _Mode;
+
+ public TraceContext(HttpContext Context) {
+ _Context = Context;
+ _Enabled = true;
+ }
+
+ public bool IsEnabled {
+ get {
+ return _Enabled;
+ }
+
+ set {
+ _Enabled = value;
+ }
+ }
+
+ public TraceMode TraceMode {
+ get {
+ return _Mode;
+ }
+
+ set {
+ _Mode = value;
+ }
+ }
+
+ public void Warn(string msg) {
+ Write(String.Empty, msg, null, true);
+ }
+
+ public void Warn(string category, string msg) {
+ Write(category, msg, null, true);
+ }
+
+ public void Warn(string category, string msg, Exception error) {
+ Write(category, msg, error, true);
+ }
+
+ public void Write(string msg) {
+ Write(String.Empty, msg, null, true);
+ }
+
+ public void Write(string category, string msg) {
+ Write(category, msg, null, true);
+ }
+
+ public void Write(string category, string msg, Exception error) {
+ Write(category, msg, error, true);
+ }
+
+ [MonoTODO("Save the data into a web dataset directly...")]
+ private void Write(string category, string msg, Exception error, bool Warning) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/TraceMode.cs b/mcs/class/System.Web/System.Web/TraceMode.cs
new file mode 100644
index 00000000000..0bc88d0ca64
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/TraceMode.cs
@@ -0,0 +1,16 @@
+//
+// System.Web.TraceMode.cs
+//
+// Author:
+// Bob Smith <bob@thestuff.net>
+//
+// (C) Bob Smith
+//
+
+namespace System.Web {
+ public enum TraceMode {
+ Default,
+ SortByCategory,
+ SortByTime
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/WebCategoryAttribute.cs b/mcs/class/System.Web/System.Web/WebCategoryAttribute.cs
new file mode 100644
index 00000000000..dd4b9ea5b46
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/WebCategoryAttribute.cs
@@ -0,0 +1,38 @@
+/**
+ * Namespace: System.Web
+ * Class: WebCategoryAttribute
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+
+namespace System.Web
+{
+ [AttributeUsage(AttributeTargets.All)]
+ internal sealed class WebCategoryAttribute : CategoryAttribute
+ {
+ public WebCategoryAttribute(string category) : base(category)
+ {
+ }
+
+ [MonoTODO]
+ protected override string GetLocalizedString(string value)
+ {
+ string retVal = base.GetLocalizedString(value);
+ if(retVal == null)
+ {
+ throw new NotImplementedException();
+ //retVal = "Category_" + something I don't know how to get!
+ }
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs b/mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs
new file mode 100644
index 00000000000..2425607069a
--- /dev/null
+++ b/mcs/class/System.Web/System.Web/WebSysDescriptionAttribute.cs
@@ -0,0 +1,44 @@
+/**
+ * Namespace: System.Web
+ * Class: WebSysDescriptionAttribute
+ *
+ * Author: Gaurav Vaish
+ * Maintainer: gvaish@iitk.ac.in
+ * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>
+ * Implementation: yes
+ * Status: 95%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.ComponentModel;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web
+{
+ [AttributeUsage(AttributeTargets.All)]
+ internal class WebSysDescriptionAttribute : DescriptionAttribute
+ {
+ private bool isReplaced;
+
+ public WebSysDescriptionAttribute(string description) : base(description)
+ {
+ }
+
+ [MonoTODO]
+ public override string Description
+ {
+ get
+ {
+ if(!isReplaced)
+ {
+ throw new NotImplementedException();
+ //DescriptionValue = Description + do something I donno;
+ }
+ return Description;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.Web/Test/test.aspx b/mcs/class/System.Web/Test/test.aspx
new file mode 100644
index 00000000000..363fab9697f
--- /dev/null
+++ b/mcs/class/System.Web/Test/test.aspx
@@ -0,0 +1,29 @@
+<%@ page language="c#"%>
+<html>
+<head>
+<title>Test</title>
+<%Response.Write("Test");%>
+
+<script runat="server" language="c#">
+ void SubmitBtn_Click(Object sender, EventArgs e) {
+ Response.Write("Hi");
+ }
+</script>
+
+<form action="test.aspx" method="post" runat="server">
+<asp:button text="Click Me" OnClick="SubmitBtn_Click" runat="server"/>
+</form>
+
+<!-- output
+
+<html>
+<head>
+<title>Test</title>
+Test<form name="ctrl0" method="post" action="test.aspx" id="ctrl0">
+<input type="hidden" name="__VIEWSTATE" value="dDwtMTc0MDc5ODg1Mzs7Pg==" />
+
+<input type="submit" name="ctrl1" value="Click Me" />
+</form>
+
+
+--> \ No newline at end of file
diff --git a/mcs/class/System.Web/Test/test2.aspx b/mcs/class/System.Web/Test/test2.aspx
new file mode 100644
index 00000000000..168aa05cb58
--- /dev/null
+++ b/mcs/class/System.Web/Test/test2.aspx
@@ -0,0 +1,101 @@
+<%@ Page Language="C#" %>
+<html>
+<head>
+<script language="C#" runat="server">
+void Page_Load(Object Sender, EventArgs e) {
+ if (!IsPostBack) {
+ ArrayList values = new ArrayList();
+
+ values.Add(new PositionData("Microsoft", "Msft"));
+ values.Add(new PositionData("Intel", "Intc"));
+ values.Add(new PositionData("Dell", "Dell"));
+
+ Repeater1.DataSource = values;
+ Repeater1.DataBind();
+
+ Repeater2.DataSource = values;
+ Repeater2.DataBind();
+ Response.Write(Repeater1.Controls[0].ClientID);
+ Response.Write("<br>");
+ Response.Write(Repeater1.Controls[0].UniqueID);
+ Response.Write("<br>");
+ }
+ }
+
+ public class PositionData {
+
+ private string name;
+ private string ticker;
+
+ public PositionData(string name, string ticker) {
+ this.name = name;
+ this.ticker = ticker;
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ public string Ticker {
+ get {
+ return ticker;
+ }
+ }
+ }
+
+ </script>
+
+</head>
+<body>
+
+<h3><font face="Verdana">Repeater Example</font></h3>
+
+<form runat=server>
+
+<b>Repeater1:</b>
+
+<p>
+
+<asp:Repeater id=Repeater1 runat="server">
+<HeaderTemplate>
+<table border=1>
+<tr>
+<td><b>Company</b></td>
+<td><b>Symbol</b></td>
+</tr>
+</HeaderTemplate>
+
+<ItemTemplate>
+<tr>
+<td> <%# DataBinder.Eval(Container.DataItem, "Name") %> <asp:label id="test"></td>
+<td> <%# DataBinder.Eval(Container.DataItem, "Ticker") %> </td>
+</tr>
+</ItemTemplate>
+
+<FooterTemplate>
+</table>
+</FooterTemplate>
+
+</asp:Repeater>
+<p>
+
+<b>Repeater2:</b>
+<p>
+<asp:Repeater id=Repeater2 runat="server">
+
+<HeaderTemplate>
+Company data:
+ </HeaderTemplate>
+
+<ItemTemplate>
+<%# DataBinder.Eval(Container.DataItem, "Name") %> (<%# DataBinder.Eval(Container.DataItem, "Ticker") %>)
+ </ItemTemplate>
+
+<SeparatorTemplate>, </SeparatorTemplate>
+</asp:Repeater>
+</form>
+</body>
+</html>
+
diff --git a/mcs/class/System.Web/Test/test3.aspx b/mcs/class/System.Web/Test/test3.aspx
new file mode 100644
index 00000000000..d8776e45f48
--- /dev/null
+++ b/mcs/class/System.Web/Test/test3.aspx
@@ -0,0 +1,23 @@
+<%@ Page Debug="true" %>
+<html>
+<script runat=server language="vb">
+
+Sub AnchorBtn_Click(Source As Object, E as EventArgs)
+ Message.InnerText = Message.InnerHtml
+ End Sub
+
+ </script>
+
+<body>
+<form method=post runat=server>
+
+<a OnServerClick="AnchorBtn_Click" runat=server> Click here at your peril.</a>
+
+<h1>
+<span id="Message" runat=server><span id="Message2" runat=server>narf</span></span>
+</h1>
+
+</form>
+</body>
+</html>
+
diff --git a/mcs/class/System.Web/Test/test4.aspx b/mcs/class/System.Web/Test/test4.aspx
new file mode 100644
index 00000000000..f9c020c1d85
--- /dev/null
+++ b/mcs/class/System.Web/Test/test4.aspx
@@ -0,0 +1,119 @@
+<%@ Page Language="C#" Debug="true" %>
+<html>
+<head>
+<script language="C#" runat="server">
+// protected override void OnInit(EventArgs e){
+// throw new Exception();
+// }
+ protected override void LoadViewState(object savedState){
+ throw new Exception();
+ }
+ protected override object SaveViewState(){
+ throw new Exception();
+ }
+ void Page_Kill(Object Sender, EventArgs e) {
+ throw new Exception();
+ }
+ protected override void OnInit(EventArgs e){
+ EnableViewState = true;
+ TrackViewState();
+ ViewState["test"] = "DIE!";
+ }
+ void Page_Load(Object Sender, EventArgs e) {
+// ((Control)Sender).PreRender += new EventHandler(Page_Kill);
+ if (!IsPostBack) {
+ ArrayList values = new ArrayList();
+
+ values.Add(new PositionData("Microsoft", "Msft"));
+ values.Add(new PositionData("Intel", "Intc"));
+ values.Add(new PositionData("Dell", "Dell"));
+
+ Repeater1.DataSource = values;
+ Repeater1.DataBind();
+
+ Repeater2.DataSource = values;
+ Repeater2.DataBind();
+ Response.Write(Repeater1.Controls[0].ClientID);
+ Response.Write("<br>");
+ Response.Write(Repeater1.Controls[0].UniqueID);
+ Response.Write("<br>");
+ }
+ }
+
+ public class PositionData {
+
+ private string name;
+ private string ticker;
+
+ public PositionData(string name, string ticker) {
+ this.name = name;
+ this.ticker = ticker;
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ public string Ticker {
+ get {
+ return ticker;
+ }
+ }
+ }
+
+ </script>
+
+</head>
+<body>
+
+<h3><font face="Verdana">Repeater Example</font></h3>
+
+<form runat=server>
+
+<b>Repeater1:</b>
+
+<p>
+
+<asp:Repeater id=Repeater1 runat="server">
+<HeaderTemplate>
+<table border=1>
+<tr>
+<td><b>Company</b></td>
+<td><b>Symbol</b></td>
+</tr>
+</HeaderTemplate>
+
+<ItemTemplate>
+<tr>
+<td> <%# DataBinder.Eval(Container.DataItem, "Name") %> <asp:label id="test"></td>
+<td> <%# DataBinder.Eval(Container.DataItem, "Ticker") %> </td>
+</tr>
+</ItemTemplate>
+
+<FooterTemplate>
+</table>
+</FooterTemplate>
+
+</asp:Repeater>
+<p>
+
+<b>Repeater2:</b>
+<p>
+<asp:Repeater id=Repeater2 runat="server">
+
+<HeaderTemplate>
+Company data:
+ </HeaderTemplate>
+
+<ItemTemplate>
+<%# DataBinder.Eval(Container.DataItem, "Name") %> (<%# DataBinder.Eval(Container.DataItem, "Ticker") %>)
+ </ItemTemplate>
+
+<SeparatorTemplate>, </SeparatorTemplate>
+</asp:Repeater>
+</form>
+</body>
+</html>
+
diff --git a/mcs/class/System.Web/Test/test5.aspx b/mcs/class/System.Web/Test/test5.aspx
new file mode 100644
index 00000000000..2aaf4bf06c2
--- /dev/null
+++ b/mcs/class/System.Web/Test/test5.aspx
@@ -0,0 +1,121 @@
+<%@ Page Language="C#" Debug="true" %>
+<html>
+<head>
+<%
+Response.Write(HttpWorkerRequest.HeaderAccept);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptCharset);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptEncoding);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptLanguage);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAcceptRanges);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAge);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAllow);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderAuthorization);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderCacheControl);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderConnection);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentEncoding);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentLanguage);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentLength);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentLocation);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentMd5);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentRange);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderContentType);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderCookie);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderDate);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderEtag);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderExpect);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderExpires);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderFrom);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderHost);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfMatch);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfModifiedSince);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfNoneMatch);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfRange);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderIfUnmodifiedSince);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderKeepAlive);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderLastModified);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderLocation);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderMaxForwards);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderPragma);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderProxyAuthenticate);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderProxyAuthorization);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderRange);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderReferer);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderRetryAfter);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderServer);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderSetCookie);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderTe);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderTrailer);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderTransferEncoding);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderUpgrade);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderUserAgent);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderVary);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderVia);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderWarning);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.HeaderWwwAuthenticate);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonCachePolicy);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonCacheSecurity);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonClientDisconnect);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonDefault);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonFileHandleCacheMiss);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ReasonResponseCacheMiss);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.RequestHeaderMaximum);
+Response.Write("<br>");
+Response.Write(HttpWorkerRequest.ResponseHeaderMaximum);
+Response.Write("<br>");
+%> \ No newline at end of file
diff --git a/mcs/class/System.Web/Test/test6.aspx b/mcs/class/System.Web/Test/test6.aspx
new file mode 100644
index 00000000000..594c4bc7bbb
--- /dev/null
+++ b/mcs/class/System.Web/Test/test6.aspx
@@ -0,0 +1,83 @@
+<html>
+<head>
+<!--
+ Author: Gaurav Vaish
+ Original Source: http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIWebControlsCalendarClassSelectedDateTopic.asp
+ Copyright: (C) Gaurav Vaish, 2001
+-->
+ <script language="C#" runat="server">
+
+ void Selection_Change(Object sender, EventArgs e)
+ {
+ Label1.Text = "The selected date is " + Calendar1.SelectedDate.ToShortDateString();
+ }
+
+ void Selection_Change_Month(Object sender, EventArgs e)
+ {
+ Label2.Text = "The selected date is " + Calendar2.SelectedDate.ToShortDateString();
+ }
+
+ void Selection_Change_DWM(Object sender, EventArgs e)
+ {
+ Label3.Text = "The selected date is " + Calendar3.SelectedDate.ToShortDateString();
+ }
+
+ </script>
+
+</head>
+<body>
+
+ <form runat="server">
+
+ <h3><font face="Verdana">Calendar Example</font></h3>
+
+ Select a date on the Calendar control.<br><br>
+
+ <asp:Calendar ID="Calendar1" runat="server"
+ SelectionMode="Day"
+ ShowGridLines="True"
+ OnSelectionChanged="Selection_Change">
+
+ <SelectedDayStyle BackColor="Yellow"
+ ForeColor="Red">
+ </SelectedDayStyle>
+
+ </asp:Calendar>
+
+ <asp:Label id="Label1" runat=server />
+
+ <hr><br>
+
+ <asp:Calendar ID="Calendar2" runat="server"
+ SelectionMode="DayWeek"
+ ShowGridLines="True"
+ OnSelectionChanged="Selection_Change_Month">
+
+ <SelectedDayStyle BackColor="Yellow"
+ ForeColor="Red">
+ </SelectedDayStyle>
+
+ </asp:Calendar>
+
+ <asp:Label id="Label2" runat=server />
+
+ <hr><br>
+
+ <asp:Calendar ID="Calendar3" runat="server"
+ SelectionMode="DayWeekMonth"
+ ShowGridLines="True"
+ OnSelectionChanged="Selection_Change_DWM">
+
+ <SelectedDayStyle BackColor="Yellow"
+ ForeColor="Red">
+ </SelectedDayStyle>
+
+ </asp:Calendar>
+
+ <asp:Label id="Label3" runat=server />
+
+ <hr><br>
+
+ </form>
+</body>
+</html> \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs
new file mode 100644
index 00000000000..0f4bac37d83
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleNavigation.cs
@@ -0,0 +1,31 @@
+//
+// System.Windows.Forms.AccessibleNavigation.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 a values for navigating among accessible objects.
+ /// </summary>
+
+ [Serializable]
+ public enum AccessibleNavigation
+ {
+ Down,
+ FirstChild,
+ LastChild,
+ Left,
+ Next,
+ Previous,
+ Right,
+ Up
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleObject.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleObject.cs
new file mode 100644
index 00000000000..0c646763d0b
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleObject.cs
@@ -0,0 +1,251 @@
+////
+//// System.Windows.Forms.AccessibleObject.cs
+////
+//// Author:
+//// stubbed out by Jaak Simm (jaaksimm@firm.ee)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//using System;
+//using System.Reflection;
+//using System.Globalization;
+////using System.Windows.Forms.AccessibleObject.IAccessible;
+//using System.Drawing;
+//
+//namespace System.Windows.Forms
+//{
+// /// <summary>
+// /// Provides information that accessibility applications use to adjust an application's UI for users with impairments.
+// ///
+// /// ToDo note:
+// /// - Nothing is implemented
+// /// - IAccessible members not stubbed out
+// /// - MarshalByRefObject members not stubbed out
+// /// MSDN gives little info on the members of IAccessible: "This member supports the .NET Framework infrastructure and is not intended to be used directly from your code."
+// /// </summary>
+// [MonoTODO]
+// public class AccessibleObject : MarshalByRefObject, IReflect/*, [MonoTODO]: */,IAccessible
+// {
+// string name;
+//
+// // --- Properties ---
+// [MonoTODO]
+// public virtual Rectangle Bounds
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// [MonoTODO]
+// public virtual string DefaultAction
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// [MonoTODO]
+// public virtual string Description
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public virtual string Help
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public virtual string KeyboardShortcut
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// public virtual string Name {
+// get { return name; }
+// set { name = value; }
+// }
+//
+// [MonoTODO]
+// public virtual AccessibleObject Parent
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// [MonoTODO]
+// public virtual AccessibleRole Role
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// [MonoTODO]
+// public virtual AccessibleStates State
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// [MonoTODO]
+// public virtual string Value
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+//
+//
+// // --- Constructor ---
+// [MonoTODO]
+// public AccessibleObject()
+// {
+// throw new NotImplementedException ();
+// }
+//
+//
+//
+// // --- Methods ---
+// [MonoTODO]
+// public virtual void DoDefaultAction() {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public virtual AccessibleObject GetChild(int index) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public virtual int GetChildCount() {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public virtual AccessibleObject GetFocused() {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public virtual int GetHelpTopic(out string fileName) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public virtual AccessibleObject GetSelected() {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public virtual AccessibleObject HitTest(int x,int y) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public virtual AccessibleObject Navigate(AccessibleNavigation navdir) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public virtual void Select(AccessibleSelection flags) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// protected void UseStdAccessibleObjects(IntPtr handle,int objid) {
+// throw new NotImplementedException ();
+// }
+//
+//
+//
+// // --- Methods: object ---
+// [MonoTODO]
+// public override bool Equals (object obj) {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override int GetHashCode()
+// {
+// throw new NotImplementedException ();
+// }
+//
+//
+//
+//
+// // --- Methods: IReflect ---
+// [MonoTODO]
+// public FieldInfo GetField( string name,BindingFlags bindingAttr) {
+// // FIXME
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public FieldInfo[] GetFields (BindingFlags bindingAttr)
+// {
+// // FIXME
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public MemberInfo[] GetMember( string name, BindingFlags bindingAttr) {
+// // FIXME
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public MemberInfo[] GetMembers( BindingFlags bindingAttr) {
+// // FIXME
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public MethodInfo GetMethod( string name, BindingFlags bindingAttr) {
+// // FIXME
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public MethodInfo GetMethod( string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) {
+// // FIXME
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public MethodInfo[] GetMethods( BindingFlags bindingAttr) {
+// // FIXME
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public PropertyInfo[] GetProperties( BindingFlags bindingAttr) {
+// // FIXME
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public PropertyInfo GetProperty( string name, BindingFlags bindingAttr) {
+// // FIXME
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public PropertyInfo GetProperty( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+// // FIXME
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
+// // FIXME
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public Type UnderlyingSystemType
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// /*
+// interface IAccessible
+// {
+// void accDoDefaultAction(object childID);
+// ...
+// }
+// */
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs
new file mode 100644
index 00000000000..713c47b22c8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/AccessibleSelection.cs
@@ -0,0 +1,30 @@
+//
+// System.Windows.Forms.AccessibleSelection.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 an accessible object is selected or receives focus.
+ /// This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum AccessibleSelection
+ {
+ AddSelection = 1,
+ ExtendSelection = 2,
+ None = 0,
+ RemoveSelection = 4,
+ TakeFocus = 8,
+ TakeSelection = 16
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CaptionButton.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CaptionButton.cs
new file mode 100644
index 00000000000..ca913769bf4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CaptionButton.cs
@@ -0,0 +1,28 @@
+//
+// System.Windows.Forms.CaptionButton.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.CaptionButton
+{
+
+ /// <summary>
+ /// Specifies the type of caption button to display.
+ /// </summary>
+
+ [Serializable]
+ public enum CaptionButton
+ {
+ Close = 0,
+ Minimize = 1,
+ Minimize = 2,
+ Restore = 3,
+ Help = 4,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog
new file mode 100644
index 00000000000..7654697e489
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ChangeLog
@@ -0,0 +1,33 @@
+2002-04-10 Duncan Mak <duncan@ximian.com>
+
+ * CaptionButton.cs:
+ * CharacterCasing.cs:
+ * CheckState.cs:
+ * DataGridParentRowsLabelStyle.cs:
+ * DialogResult.cs:
+ * DockStyle.cs:
+ * DragAction.cs:
+ * DragDropEffects.cs:
+ * DrawItemState.cs:
+ * DrawMode.cs:
+ * ErrorBlinkStyle.cs:
+ * ErrorIconAlignment.cs:
+ * FlatStyle.cs:
+ * FormBorderStyle.cs:
+ * FormStartPosition.cs:
+ * FormWindowState.cs:
+ * FrameStyle.cs: Fixed enum layouts with EnumCheck.
+
+2002-4-23 Dennis Hayes <dennish@raytek.com>
+
+ * AccessibleNavigation.cs :added to cvs with bad enum values, I will correct.
+ * AccessibleSelection.cs :added with good enum values.
+ * ContentsResizedEventHandler.cs :Added delagate
+ * MainMenu.cs
+ * AccessibleObject.cs
+ * MeasureItemEventArgs :added stubbed classes. Commented out.
+ * IButtonControl.cs : Added interface.
+
+2002-4-23 Dennis Hayes <dennish@raytek.com>
+* added stubbed and commented out classes from F to G *
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CharacterCasing.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CharacterCasing.cs
new file mode 100644
index 00000000000..2dccf298cb2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/CharacterCasing.cs
@@ -0,0 +1,25 @@
+//
+// System.Windows.Forms.CharacterCasing.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 case of characters in a TextBox control.
+ /// </summary>
+ [Serializable]
+ public enum CharacterCasing
+ {
+ Normal = 0,
+ Upper = 1,
+ Lower = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckState.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/CheckState.cs
new file mode 100644
index 00000000000..3a0c4769cb6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/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>
+ [Serializable]
+ public enum CheckState
+ {
+ Unchecked = 0,
+ Checked = 1,
+ Indeterminate = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs
new file mode 100644
index 00000000000..36f638893e0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ContentsResizedEventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.ContentsResizedEventHandler.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+ [Serializable]
+ public delegate void ContentsResizedEventHandler(
+ object sender,
+ ContentsResizedEventArgs e
+ );
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs
new file mode 100644
index 00000000000..93176586aef
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridParentRowsLabelStyle.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.DataGridParentRowsLabelStyle.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 parent row labels of a DataGrid control are displayed.
+ /// </summary>
+ [Serializable]
+ public enum DataGridParentRowsLabelStyle
+ {
+ None = 0,
+ TableName = 1,
+ ColumnName = 2,
+ Both = 3,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DialogResult.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DialogResult.cs
new file mode 100644
index 00000000000..936a6825cdd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DialogResult.cs
@@ -0,0 +1,31 @@
+//
+// System.Windows.Forms.DialogResult.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 identifiers to indicate the return value of a dialog box.
+ /// </summary>
+ [Serializable]
+ [ComVisible(true)]
+ public enum DialogResult
+ {
+ None = 0,
+ OK = 1,
+ Cancel = 2,
+ Abort = 3,
+ Retry = 4,
+ Ignore = 5,
+ Yes = 6,
+ No = 7,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DockStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DockStyle.cs
new file mode 100644
index 00000000000..b465de3bda3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DockStyle.cs
@@ -0,0 +1,28 @@
+//
+// System.Windows.Forms.DockStyle.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 position and manner in which a control is docked.
+ /// </summary>
+ [Serializable]
+ public enum DockStyle
+ {
+ None = 0,
+ Top = 1,
+ Bottom = 2,
+ left = 3,
+ Right = 4,
+ Fill = 5,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DragAction.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragAction.cs
new file mode 100644
index 00000000000..becf2a6eddf
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragAction.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.DragAction.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 and if a drag-and-drop operation should continue.
+ /// </summary>
+ [Serializable]
+ [ComVisible(true)]
+ public enum DragAction
+ {
+ Continue = 0,
+ Drop = 1,
+ Cancel = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DragDropEffects.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragDropEffects.cs
new file mode 100644
index 00000000000..601389e14c9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DragDropEffects.cs
@@ -0,0 +1,30 @@
+//
+// System.Windows.Forms.DragDropEffects.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 effects of a drag-and-drop operation.
+ /// This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum DragDropEffects
+ {
+ None = 0,
+ Copy = 1,
+ Move = 2,
+ Link = 4,
+ Scroll = -2147483648,
+ All = -2147483645,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemState.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemState.cs
new file mode 100644
index 00000000000..35807740c68
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawItemState.cs
@@ -0,0 +1,36 @@
+//
+// System.Windows.Forms.DrawItemState.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 an item that is being drawn.
+ /// this enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum DrawItemState
+ {
+ None = 0,
+ Selected = 1,
+ Grayed = 2,
+ Disabled = 4,
+ Checked = 8,
+ Focus = 16,
+ Default = 32,
+ HotLight = 64,
+ Inactive = 128,
+ NoAccelerator = 256,
+ NoFocusRect = 512,
+ ComboBoxEdit = 1024,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawMode.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawMode.cs
new file mode 100644
index 00000000000..8d6fbb63f6d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DrawMode.cs
@@ -0,0 +1,25 @@
+//
+// 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>
+ [Serializable]
+ public enum DrawMode
+ {
+ Normal = 0,
+ OwnerDrawFixed = 1,
+ OwnerDrawVariable = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs
new file mode 100644
index 00000000000..b5c0cf60480
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorBlinkStyle.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.ErrorBlinkStyle.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 constants indicating when the error icon, supplied by an ErrorProvider,
+ /// should blink to alert the user that an error has occurred.
+ /// </summary>
+ [Serializable]
+ public enum ErrorBlinkStyle
+ {
+ BlinkIfDifferentError = 0,
+ AlwaysBlink = 1,
+ NeverBlink = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs
new file mode 100644
index 00000000000..08a519277b4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ErrorIconAlignment.cs
@@ -0,0 +1,29 @@
+//
+// System.Windows.Forms.ErrorIconAlignment.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 constants indicating the locations that an error icon can appear
+ /// in relation to the control with an error.
+ /// </summary>
+ [Serializable]
+ public enum ErrorIconAlignment
+ {
+ TopLeft = 0,
+ TopRight = 1,
+ MiddleLeft = 2,
+ MiddleRight = 3,
+ BottomLeft = 4,
+ BottomRight = 5,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FeatureSupport.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FeatureSupport.cs
new file mode 100644
index 00000000000..b26cdc44cc1
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FeatureSupport.cs
@@ -0,0 +1,49 @@
+////
+//// System.Windows.Forms.FeatureSupport.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public public abstract class FeatureSupport : IFeatureSupport
+// {
+//
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public abstract Version GetVersionPresent(object o)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual bool IsPresent(object o)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Protected Constructors
+// //
+// [MonoTODO]
+// protected FeatureSupport()
+// {
+// throw new NotImplementedException ();
+// }
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FileDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FileDialog.cs
new file mode 100644
index 00000000000..aa3bc1f7b80
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FileDialog.cs
@@ -0,0 +1,162 @@
+////
+//// System.Windows.Forms.FileDialog.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public abstract class FileDialog : CommonDialog
+// {
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public bool AddExtension
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual bool CheckFileExists
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public bool CheckPathExists
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public string DefaultExt
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public bool DereferenceLinks
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public string FileName
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public string FileNames
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public string Filter
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public int FilterIndex
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public string InitialDirectory
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public bool RestoreDirectory
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public bool ShowHelp
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public string Title
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public bool ValidateNames
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public void Dispose()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public override void Reset()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public DialogResult ShowDialog()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public DialogResult ShowDialog(IWin32Window)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public override string ToString()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Events
+// //
+// [MonoTODO]
+// public event CancelEventHandler FileOk
+// {
+// add { throw new NotImplementedException (); }
+// remove { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Protected Methods
+// //
+// [MonoTODO]
+// protected void Dispose()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override IntPtr HookProc( IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam )
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected void OnFileOk( CancelEventArgs e)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override bool RunDialog( IntPtr hWndOwner)
+// {
+// throw new NotImplementedException ();
+// }
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FlatStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FlatStyle.cs
new file mode 100644
index 00000000000..b8f3b696ab6
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FlatStyle.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.FlatStyle.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 appearance of a control.
+ /// </summary>
+ [Serializable]
+ public enum FlatStyle
+ {
+ Flat = 0,
+ Popup = 1,
+ Standard = 2,
+ System = 3,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FontDialog.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FontDialog.cs
new file mode 100644
index 00000000000..f9cb76e7bd0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FontDialog.cs
@@ -0,0 +1,175 @@
+////
+//// System.Windows.Forms.FontDialog.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public class FontDialog : CommonDialog
+// {
+//
+// //
+// // --- Constructor
+// //
+// [MonoTODO]
+// public FontDialog()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public bool AllowScriptChange
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool AllowSimululations
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool AllowVectorForms
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool AllowVerticalForms
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public Color Color
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool FixedPitchOnly
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public Font Font
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool FontMustExist
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public int MaxSize
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public int MinSize
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool ScriptsOnly
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool ShowApply
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool ShowColor
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool ShowEffects
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool ShowHelp
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public void Dispose()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual bool Equals(object o)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public override void Reset()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public DialogResult ShowDialog()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public override string ToString()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public event EventHandler Apply
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Protected Properties
+// //
+// [MonoTODO]
+// protected void Dispose()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override IntPtr HookProc( IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam )
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override bool RunDialog(IntPtr hWndOwner)
+// {
+// throw new NotImplementedException ();
+// }
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.ControlCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.ControlCollection.cs
new file mode 100644
index 00000000000..99119f46cfd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Form.ControlCollection.cs
@@ -0,0 +1,54 @@
+////
+//// System.Windows.Forms.Form.ControlCollection.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public class Form.ControlCollection : Control.ControlCollection
+// {
+//
+// //
+// // --- Constructor
+// //
+// [MonoTODO]
+// public Form.ControlCollection(Form owner)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public override void Add(Control value)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public int GetChildIndex(Control c)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public override void Remove(Control value)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs
new file mode 100644
index 00000000000..cf54e484932
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormBorderStyle.cs
@@ -0,0 +1,30 @@
+//
+// System.Windows.Forms.FormBorderStyle.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 border styles for a form.
+ /// </summary>
+ [Serializable]
+ [ComVisible(true)]
+ public enum FormBorderStyle
+ {
+ None = 0,
+ FixedSingle = 1,
+ Fixed3D = 2,
+ FixedDialog = 3,
+ Sizable = 4,
+ FixedToolWindows = 5,
+ SizableToolWindow = 6
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FormStartPosition.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormStartPosition.cs
new file mode 100644
index 00000000000..b7c5a308cbc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormStartPosition.cs
@@ -0,0 +1,28 @@
+//
+// System.Windows.Forms.FormStartPosition.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 initial position of a form.
+ /// </summary>
+ [Serializable]
+ [ComVisible(true)]
+ public enum FormStartPosition
+ {
+ Manual = 0,
+ CenterScreen = 1,
+ WindowsDefaultLocation = 2,
+ WindowsDefaultBounds = 3,
+ CenterParent = 4,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FormWindowState.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormWindowState.cs
new file mode 100644
index 00000000000..1005b18f83a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FormWindowState.cs
@@ -0,0 +1,26 @@
+//
+// System.Windows.Forms.FormWindowState.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 a form window is displayed.
+ /// </summary>
+ [Serializable]
+ [ComVisible(true)]
+ public enum FormWindowState
+ {
+ Normal = 0,
+ Maximized = 1,
+ Minimized = 2,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/FrameStyle.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/FrameStyle.cs
new file mode 100644
index 00000000000..f1488be15c0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/FrameStyle.cs
@@ -0,0 +1,24 @@
+//
+// System.Windows.Forms.FrameStyle.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 frame style of the selected control.
+ /// </summary>
+ [Serializable]
+ public enum FrameStyle
+ {
+ Dashed = 0,
+ Thick = 1,
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs
new file mode 100644
index 00000000000..288fee65a0f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GiveFeedbackEventArgs.cs
@@ -0,0 +1,53 @@
+////
+//// System.Windows.Forms.GiveFeedbackEventArgs.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public class GiveFeedbackEventArgs : EventArgs
+// {
+//
+// //
+// // --- Constructor
+// //
+// [MonoTODO]
+// public GiveFeedbackEventArgs( DragDropEffects effect, bool useDefaultCursors )
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public DragDropEffects effect Effect
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool UseDefaultCursors
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
new file mode 100644
index 00000000000..53762c21060
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridColumnStylesCollection.cs
@@ -0,0 +1,106 @@
+////
+//// System.Windows.Forms.GridColumnStylesCollection.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public class GridColumnStylesCollection : BaseCollection, IList
+// {
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public DataGridColumnStyle Item this[int index]
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public virtual int Add(DataGridColumnStyle column)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void AddRange(DataGridColumnStyle[] columns[])
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Clear()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public Contains()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public int IndexOf(DataGridColumnStyle element)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Remove(DataGridColumnStyle column)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void RemoveAt(int index)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void ResetPropertyDescriptors()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public event CollectionChangeEventHandler CollectionChanged
+// {
+// add { throw new NotImplementedException (); }
+// remove { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Protected Properties
+// //
+// [MonoTODO]
+// protected override ArrayList List
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Protected Properties
+// //
+// [MonoTODO]
+// protected override void OnCollectionChanged(CollectionChangeEventArgs cevent)
+// {
+// throw new NotImplementedException ();
+// }
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItem.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItem.cs
new file mode 100644
index 00000000000..fdae9a20037
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItem.cs
@@ -0,0 +1,84 @@
+////
+//// System.Windows.Forms.GridItem.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public abstract class GridItem
+// {
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public bool Expandable
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public bool Expanded
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public abstract GridItemCollection GridItems
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public abstract GridItemType GridItemType
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public abstract string Label
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public abstract GridItem Parent
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public abstract PropertyDescriptor PropertyDescriptor
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public abstract object Value
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Protected Constructor
+// //
+// [MonoTODO]
+// protected GridItem()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemCollection.cs
new file mode 100644
index 00000000000..2d279d98911
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridItemCollection.cs
@@ -0,0 +1,48 @@
+////
+//// System.Windows.Forms.GridItemCollection.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public abstract class GridItemCollection : ICollection, IEnumerable
+// {
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public int Count
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public GridItem tihs[string]
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public IEnumerator GetEnumerator()
+// {
+// throw new NotImplementedException ();
+// }
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
new file mode 100644
index 00000000000..2decb9317a3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GridTableStylesCollection.cs
@@ -0,0 +1,102 @@
+////
+//// System.Windows.Forms.GridTableStylesCollection.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public class GridTableStylesCollection : BaseCollection, IList
+// {
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public DataGridTableStyle this[int index]
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public DataGridTableStyle this[string s]
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public virtual int Add(DataGridTableStyle table)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual void AddRange(DataGridTableStyle[] tables)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual void Clear()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public bool Contains(DataGridTableStyle table)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Remove(DataGridTableStyle table)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void RemoveAt(int index)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Events
+// //
+// [MonoTODO]
+// public event CollectionChangeEvnentHandler CollectionChanged
+// {
+// add { throw new NotImplementedException (); }
+// remove { throw new NotImplementedException (); }
+// }
+//
+//
+// //
+// // --- Protected Properties
+// //
+// [MonoTODO]
+// protected override ArrayList List
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Protected Methods
+// //
+// [MonoTODO]
+// protected void OnCollectionChanged(CollectionChangeEvnentArgs cevent)
+// {
+// throw new NotImplementedException ();
+// }
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs
new file mode 100644
index 00000000000..711838b89a0
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/GroupBox.cs
@@ -0,0 +1,193 @@
+////
+//// System.Windows.Forms.GroupBox.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public class GroupBox : Control
+// {
+//
+// //
+// // --- Constructor
+// //
+// [MonoTODO]
+// public GroupBox()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public override bool AllowDrop
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public override Rectangle DisplayRectangle
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public FlatStyle FlatStyle
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public IAsyncResult BeginInvoke(Delegate d)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public IAsyncResult BeginInvoke(Delegate d, object[] objs)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Dispose()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Invalidate()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public object Invoke(Delegate d)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public object Invoke(Delegate d, object[] objs)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void PerformLayout()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void ResumeLayout()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Scale(float val)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Scale(float val1, float val2)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Select()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void SetBounds(int b1, int b2, int b3, int b4)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void SetBounds(int b1, int b2, int b3, int b4 BoundsSpecified bounds)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public override string ToString()
+// {
+// throw new NotImplementedException ();
+// }
+//
+//
+// //
+// // --- Protected Properties
+// //
+// [MonoTODO]
+// protected override CreateParams CreateParams
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// protected override Size DefaultSize
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Protected Properties
+// //
+// [MonoTODO]
+// protected override void Dispose(bool b)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override void OnFontChanged(EventArgs e)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override void OnPaint(PaintEventArgs e)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override bool ProcessMnemonic(char charCode)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override virtual void Select(bool b1, bool b2)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override void UpdateBounds()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override void UpdateBounds(int b1, int b2, int b3, int b4)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override void UpdateBounds(int b1, int b2, int b3, int b4, int b5, int b6)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected override void WndProc(ref Message m)
+// {
+// throw new NotImplementedException ();
+// }
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/HScrollBar.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/HScrollBar.cs
new file mode 100644
index 00000000000..eae5ae365b5
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/HScrollBar.cs
@@ -0,0 +1,187 @@
+////
+//// System.Windows.Forms.HScrollBar.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public class HScrollBar : ScrollBar
+// {
+//
+// //
+// // --- Constructor
+// //
+// [MonoTODO]
+// public HScrollBar()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public override ISite Site
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public void Dispose()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Invalidate()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Invalidate(bool val)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Invalidate(Rectangle rect)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Invalidate(Region reg)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Invalidate(Rectangle rect, bool val)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Invalidate(Region reg, bool val)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public object Invoke(Delegate del)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public object Invoke(Delegate del, object[] objs)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void PerformLayout()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void PerformLayout(Control ctl, string s)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void ResumeLayout()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void ResumeLayout(bool val)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Scale(float val)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Scale(float val1, float val2)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void Select()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void SetBounds(int b1, int b2, int b3, int b4)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public void SetBounds(int b1, int b2, int b3, int b4, BoundsSpecified bnds)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Protected Properties
+// //
+// [MonoTODO]
+// protected override CreateParams CreateParams
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// protected override ImeMode DefaultMode
+// {
+// get { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// protected override Size DefaultSize
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Protected Methods
+// //
+// [MonoTODO]
+// protected virtual void Dispose(bool val)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected virtual void Select(bool val1, bool val2)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected void UpdateBounds()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected void UpdateBounds(int b1, int b2, int b3, int b4)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// protected void UpdateBounds(int b1, int b2, int b3, int b4, int b5, int b6)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Help.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Help.cs
new file mode 100644
index 00000000000..b1c4ce77f60
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Help.cs
@@ -0,0 +1,29 @@
+////
+//// System.Windows.Forms.Help.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public class Help
+// {
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs
new file mode 100644
index 00000000000..4e1015fb9c2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpEventArgs.cs
@@ -0,0 +1,58 @@
+////
+//// System.Windows.Forms.HelpEventArgs.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public class HelpEventArgs : EventArgs
+// {
+//
+// //
+// // --- Constructor
+// //
+// [MonoTODO]
+// public HelpEventArgs(Point mousePos)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public bool Handled
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+// [MonoTODO]
+// public Point MousePos
+// {
+// get { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual string ToString()
+// {
+// throw new NotImplementedException ();
+// }
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpProvider.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpProvider.cs
new file mode 100644
index 00000000000..e0016a2583e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/HelpProvider.cs
@@ -0,0 +1,118 @@
+////
+//// System.Windows.Forms.HelpProvider.cs
+////
+//// Author:
+//// stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//namespace System.Windows.Forms
+//{
+// public class HelpProvider : Component, IExtenderProvider
+// {
+//
+// //
+// // --- Constructor
+// //
+// [MonoTODO]
+// public HelpProvider()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Properties
+// //
+// [MonoTODO]
+// public virtual string HelpNamespace
+// {
+// get { throw new NotImplementedException (); }
+// set { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Public Methods
+// //
+// [MonoTODO]
+// public void Dispose()
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual bool Equals(object o);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public static bool Equals(object o1, object o2);
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual string GetHelpKeyword(Control ctl)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual HelpNavigator GetHelpNavigator(Control ctl)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual string GetHelpString(Control ctl)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual bool GetShowHelp(Control ctl)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual void SetHelpKeyword(Control ctl, string keyword)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual void SetHelpNavigator(Control ctl, HelpNavigator nav)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual void SetHelpString(Control ctl, string helpString)
+// {
+// throw new NotImplementedException ();
+// }
+// [MonoTODO]
+// public virtual void SetShowHelp(Control ctl, bool val)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// [MonoTODO]
+// public override string ToString()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Events
+// //
+// [MonoTODO]
+// public event EventHandler Disposed
+// {
+// add { throw new NotImplementedException (); }
+// remove { throw new NotImplementedException (); }
+// }
+//
+// //
+// // --- Protected Methods
+// //
+// [MonoTODO]
+// protected virtual void Dispose(bool val)
+// {
+// throw new NotImplementedException ();
+// }
+// }
+//}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IButtonControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IButtonControl.cs
new file mode 100644
index 00000000000..47d8ee10f5d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IButtonControl.cs
@@ -0,0 +1,17 @@
+//
+// System.IButtonControl.cs
+//
+// Author:
+// Dennis hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms {
+
+ interface IButtonControl {
+ void NotifyDefault(bool value);
+ void PerformClick();
+ DialogResult DialogResult {get; set;}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs
new file mode 100644
index 00000000000..82195f163db
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ICommandExecutor.cs
@@ -0,0 +1,22 @@
+//
+// System.ICommandExecutor.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ public interface ICommandExecutor
+ {
+ // There is no documentation for this interface's members!
+ // Only a note saying that it supports the .NET infrastructure
+ // and is not intended to be used directly from your code.
+ // The Execute method had its own listing in the documentation;
+ // I don't know what other methods and properties there may be.
+ void Execute();
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs
new file mode 100644
index 00000000000..7eb282edf5a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IComponentEditorPageSite.cs
@@ -0,0 +1,24 @@
+//
+// System.IComponentEditorPageSite.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ public interface IComponentEditorPageSite
+ {
+ // There is no documentation for this interface's members!
+ // Only a note saying that it supports the .NET infrastructure
+ // and is not intended to be used directly from your code.
+ // The following methods had their own listing in the documentation;
+ // I don't know what other methods and properties there may be.
+
+ Control GetControl();
+ void SetDirty();
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IContainerControl.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IContainerControl.cs
new file mode 100644
index 00000000000..8cf66a9d716
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IContainerControl.cs
@@ -0,0 +1,18 @@
+//
+// System.IContainerControl.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ public interface IContainerControl
+ {
+ bool ActivateControl(Control active);
+ Control ActiveControl {get; set;}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs
new file mode 100644
index 00000000000..6558d4f63bd
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridColumnStyleEditingNotificationService.cs
@@ -0,0 +1,17 @@
+//
+// System.IDataGridColumnStyleEditingNotificationService.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ public interface IDataGridColumnStyleEditingNotificationService
+ {
+ void ColumnStartedEditing(Control editingControl);
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs
new file mode 100644
index 00000000000..6634469314e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataGridEditingService.cs
@@ -0,0 +1,24 @@
+//
+// System.IDataGridEditingService.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ public interface IDataGridEditingService
+ {
+ // There is no documentation for this interface's members!
+ // Only a note saying that it supports the .NET infrastructure
+ // and is not intended to be used directly from your code.
+ // The following methods had their own listing in the documentation;
+ // I don't know what other methods and properties there may be.
+
+ bool BeginEdit(DataGridColumnStyle gridColumn, int rowNumber);
+ bool EndEdit(DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort);
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataObject.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataObject.cs
new file mode 100644
index 00000000000..433de3c22b2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IDataObject.cs
@@ -0,0 +1,33 @@
+//
+// System.IDataObject.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ [ComVisible(true)]
+ public interface IDataObject
+ {
+ object GetData(string format);
+ object GetData(Type format);
+ object GetData(string format, bool autoConvert);
+
+ bool GetDataPresent(string format);
+ bool GetDataPresent(Type format);
+ bool GetDataPresent(string format, bool autoConvert);
+
+ string[] GetFormats();
+ string[] GetFormats(bool autoConvert);
+
+ void SetData(object data);
+ void SetData(string format, object data);
+ void SetData(Type format, object data);
+ void SetData(string format, bool autoConvert, object data);
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs
new file mode 100644
index 00000000000..83c09105101
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IFeatureSupport.cs
@@ -0,0 +1,19 @@
+//
+// System.IFeatureSupport.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ public interface IFeatureSupport
+ {
+ Version GetVersionPresent(object feature);
+ bool IsPresent(object feature);
+ bool IsPresent(object feature, Version minimumVersion);
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IFileReaderService.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IFileReaderService.cs
new file mode 100644
index 00000000000..3418ee999c4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IFileReaderService.cs
@@ -0,0 +1,23 @@
+//
+// System.IFileReaderService.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ public interface IFileReaderService
+ {
+ // There is no documentation for this interface's members!
+ // Only a note saying that it supports the .NET infrastructure
+ // and is not intended to be used directly from your code.
+ // The following method had its own listing in the documentation;
+ // I don't know what other methods and properties there may be.
+
+ Stream OpenFileFromSource(string relativePath);
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IWin32Window.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IWin32Window.cs
new file mode 100644
index 00000000000..a9c2bbe68b2
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IWin32Window.cs
@@ -0,0 +1,20 @@
+//
+// System.IWin32Window.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ [ComVisible(true)]
+ [Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IWin32Window
+ {
+ IntPtr Handle {get;}
+ }
+}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/IWindowTarget.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/IWindowTarget.cs
new file mode 100644
index 00000000000..bff4e2ed46a
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/IWindowTarget.cs
@@ -0,0 +1,25 @@
+//
+// System.IWindowTarget.cs
+//
+// Author:
+// William Lamb (wdlamb@notwires.com)
+// Dennis Hayes (dennish@raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ public interface IWindowTarget
+ {
+ // There is no documentation for this interface's members!
+ // Only a note saying that it supports the .NET infrastructure
+ // and is not intended to be used directly from your code.
+ // The following methods had their own listing in the documentation;
+ // I don't know what other methods and properties there may be.
+
+ void OnHandleChange(IntPtr newHandle);
+ void OnMessage(ref Message m);
+ }
+}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs
new file mode 100644
index 00000000000..09a9eed7c25
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MainMenu.cs
@@ -0,0 +1,257 @@
+////
+//// System.Windows.Forms.MainMenu.cs
+////
+//// Author:
+//// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//
+//using System;
+//using System.Reflection;
+//using System.Globalization;
+////using System.Windows.Forms.AccessibleObject.IAccessible;
+//using System.Drawing;
+//
+//namespace System.Windows.Forms {
+//
+// /// <summary>
+// /// ToDo note:
+// /// - Nothing is implemented
+// /// </summary>
+//
+// public class MainMenu : Menu {
+//
+// //
+// // --- Constructors
+// //
+//
+// public MainMenu()
+// {
+// throw new NotImplementedException ();
+// }
+//
+// public MainMenu(MenuItem[] items)
+// {
+// throw new NotImplementedException ();
+// }
+//
+// //
+// // --- Public Methods
+// //
+//
+// public virtual MainMenu CloneMenu()
+// {
+// throw new NotImplementedException();
+// }
+//
+// protected void MainMenu(Menu m)
+// {
+// throw new NotImplementedException();
+// }
+//
+// public virtual ObjRef CreateObjRef(Type requestedType)
+// {
+// throw new NotImplementedException();
+// }
+//
+// public void Dispose()
+// {
+// throw new NotImplementedException();
+// }
+//
+// protected virtual void Dispose(bool b)
+// {
+// throw new NotImplementedException();
+// }
+//
+// public virtual bool Equals(object o)
+// {
+// throw new NotImplementedException();
+// }
+//
+// public static bool Equals(object o, object o)
+// {
+// throw new NotImplementedException();
+// }
+//
+// public ContextMenu GetContextMenu()
+// {
+// throw new NotImplementedException();
+// }
+//
+// public Form GetForm()
+// {
+// throw new NotImplementedException();
+// }
+//
+// public virtual int GetHashCode()
+// {
+// throw new NotImplementedException();
+// }
+//
+// public object GetLifetimeService()
+// {
+// throw new NotImplementedException();
+// }
+//
+// public MainMenu GetMainMenu()
+// {
+// throw new NotImplementedException();
+// }
+//
+// public Type GetType()
+// {
+// throw new NotImplementedException();
+// }
+//
+// public virtual object InitializeLifetimeService()
+// {
+// throw new NotImplementedException();
+// }
+//
+// public virtual void MergeMenu(Menu menuSrc)
+// {
+// throw new NotImplementedException();
+// }
+//
+// public override string ToString()
+// {
+// throw new NotImplementedException();
+// }
+//
+// //
+// // -- Protected Methods
+// //
+//
+// protected void CloneMenu(Menu menuSrc)
+// {
+// throw new NotImplementedException();
+// }
+//
+// protected override void Dispose(bool b)
+// {
+// throw new NotImplementedException();
+// }
+//
+// public void Dispose()
+// {
+// throw new NotImplementedException();
+// }
+//
+// protected virtual object GetService()
+// {
+// throw new NotImplementedException();
+// }
+//
+// protected object MemberwiseClone()
+// {
+// throw new NotImplementedException();
+// }
+//
+// //
+// // -- DeConstructor
+// //
+//
+// ~MainMenu()
+// {
+// throw new NotImplementedException();
+// }
+//
+// //
+// // -- Public Events
+// //
+//
+// public event EventHandler Disposed;
+//
+// //
+// // -- Public Properties
+// //
+//
+// public IContainer Container {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// }
+//
+// public IntPtr Handle {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// }
+//
+// public virtual bool IsParent {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// }
+//
+// public MenuItem MdiListItem {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// }
+//
+// public Menu.MenuItemCollection MenuItems {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// }
+//
+// public virtual RightToLeft RightToLeft {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// set
+// {
+// throw new NotImplementedException();
+// }
+// }
+//
+// public virtual ISite Site {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// set
+// {
+// throw new NotImplementedException();
+// }
+// }
+//
+// //
+// // -- protected Properties
+// //
+//
+// protected bool DesignMode {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// }
+//
+// protected EventHandler Events {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// }
+// }
+//}
+//
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs
new file mode 100644
index 00000000000..3b50df446e3
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventArgs.cs
@@ -0,0 +1,129 @@
+////
+//// System.Windows.Forms.MeasureItemEventArgs.cs
+////
+//// Author:
+//// stubbed out by Paul Osman (paul.osman@sympatico.ca)
+////
+//// (C) 2002 Ximian, Inc
+////
+//
+//using System;
+//using System.Reflection;
+//using System.Globalization;
+////using System.Windows.Forms.AccessibleObject.IAccessible;
+//using System.Drawing;
+//
+//namespace System.Windows.Forms {
+//
+//
+// /// <summary>
+// /// ToDo note:
+// /// - Nothing is implemented
+// /// </summary>
+//
+// public class MeasureItemEventArgs : EventArgs {
+//
+//
+// //
+// // --- Constructors
+// //
+//
+// public MeasureItemEventArgs(Graphics g, int i)
+// {
+// throw new NotImplementedException();
+// }
+//
+// public MeasureItemEventArgs(Graphics g, int i, int i)
+// {
+// throw new NotImplementedException();
+// }
+//
+// //
+// // -- Public Methods
+// //
+//
+// public virtual bool Equals(object o)
+// {
+// throw new NotImplementedException();
+// }
+//
+// public static bool Equals(object o, object o)
+// {
+// throw new NotImplementedException();
+// }
+//
+// public virtual int GetHashCode()
+// {
+// throw new NotImplementedException();
+// }
+//
+// public Type GetType()
+// {
+// throw new NotImplementedException();
+// }
+//
+// public virtual string ToString()
+// {
+// throw new NotImplementedException();
+// }
+//
+// //
+// // -- Protected Methods
+// //
+//
+// ~MeasureItemEventArgs()
+// {
+// throw new NotImplementedException();
+// }
+//
+// protected object MemberwiseClone()
+// {
+// throw new NotImplementedException();
+// }
+//
+// //
+// // -- Public Properties
+// //
+//
+// public Graphics Graphics {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// }
+//
+// public int Index {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// }
+//
+// public int ItemHeight {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// set
+// {
+// throw new NotImplementedException();
+// }
+// }
+//
+// public int ItemWidth {
+//
+// get
+// {
+// throw new NotImplementedException();
+// }
+// set
+// {
+// throw new NotImplementedException();
+// }
+// }
+// }
+//}
+
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs
new file mode 100644
index 00000000000..661f98cc20d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MeasureItemEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.MeasureItemEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the MeasureItem event of the
+ /// ListBox, ComboBox, CheckedListBox, or MenuItem controls.
+ /// </summary>
+ [Serializable]
+ public delegate void MeasureItemEventHandler(object sender, MeasureItemEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MethodInvoker.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MethodInvoker.cs
new file mode 100644
index 00000000000..96b0ac9472d
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MethodInvoker.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.MethodInvoker.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that handles the Invoke event for a method.
+ /// </summary>
+ [Serializable]
+ public delegate void MethodInvoker();
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs
new file mode 100644
index 00000000000..d5759b99555
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MouseEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.MouseEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the MouseDown, MouseUp, or MouseMove
+ /// event of a form, control, or other component.
+ /// </summary>
+ [Serializable]
+ public delegate void MouseEventHandler(object sender, MouseEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs
new file mode 100644
index 00000000000..0bbe0e61edc
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/NavigateEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.NavigateEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the NavigateEventArgs event of a DataGrid.
+ /// </summary>
+ [Serializable]
+ public delegate void NavigateEventHandler(object sender, NavigateEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs
new file mode 100644
index 00000000000..420f1040646
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/NodeLabelEditEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.NodeLabelEditEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the BeforeLabelEdit
+ /// and AfterLabelEdit events of a TreeView control.
+ /// </summary>
+ [Serializable]
+ public delegate void NodeLabelEditEventHandler(object sender, NodeLabelEditEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs
new file mode 100644
index 00000000000..eda39e995f7
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PaintEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.PaintEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the Paint event of a Control class.
+ /// </summary>
+ [Serializable]
+ public delegate void PaintEventHandler(object sender, PaintEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs
new file mode 100644
index 00000000000..2d08ca92785
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyTabChangedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.PropertyTabChangedEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the PropertyTabChanged event of a PropertyGrid.
+ /// </summary>
+ [Serializable]
+ public delegate void PropertyTabChangedEventHandler(object s, PropertyTabChangedEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs
new file mode 100644
index 00000000000..70fe58a4c28
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyValueChangedEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.PropertyValueChangedEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// The event handler class that is invoked when
+ /// a property in the grid is modified by the user.
+ /// </summary>
+ [Serializable]
+ public delegate void PropertyValueChangedEventHandler(object s, PropertyValueChangedEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs
new file mode 100644
index 00000000000..952189efa08
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryAccessibilityHelpEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.QueryAccessibilityHelpEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the QueryAccessibilityHelp event of a control.
+ /// </summary>
+ [Serializable]
+ public delegate void QueryAccessibilityHelpEventHandler(object sender, QueryAccessibilityHelpEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs
new file mode 100644
index 00000000000..8c1eeba2eb8
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/QueryContinueDragEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.QueryContinueDragEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the QueryContinueDrag event of a Control.
+ /// </summary>
+ [Serializable]
+ public delegate void QueryContinueDragEventHandler(object sender, QueryContinueDragEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs
new file mode 100644
index 00000000000..05fe92b819f
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ScrollEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.ScrollEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that handles the Scroll
+ /// event of a ScrollBar, TrackBar, or DataGrid.
+ /// </summary>
+ [Serializable]
+ public delegate void ScrollEventHandler(object sender, ScrollEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs
new file mode 100644
index 00000000000..c9c86628a23
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SelectedGridItemChangedEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.SelectedGridItemChangedEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the SelectedGridItemChanged event of a PropertyGrid.
+ /// </summary>
+ [Serializable]
+ public delegate void SelectedGridItemChangedEventHandler(object sender, SelectedGridItemChangedEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs
new file mode 100644
index 00000000000..b7799135188
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/SplitterEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.SplitterEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the SplitterMoving and SplitterMoved events of a Splitter.
+ /// </summary>
+ [Serializable]
+ public delegate void SplitterEventHandler(object sender, SplitterEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs
new file mode 100644
index 00000000000..abe3fff5603
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarDrawItemEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.StatusBarDrawItemEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the DrawItem event of a StatusBar.
+ /// </summary>
+ [Serializable]
+ public delegate void StatusBarDrawItemEventHandler(object sender, StatusBarDrawItemEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs
new file mode 100644
index 00000000000..ed9fe1b2bee
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/StatusBarPanelClickEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.StatusBarPanelClickEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the PanelClick event of a StatusBar.
+ /// </summary>
+ [Serializable]
+ public delegate void StatusBarPanelClickEventHandler(object sender, StatusBarPanelClickEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs
new file mode 100644
index 00000000000..78bd33b1cac
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolBarButtonClickEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.ToolBarButtonClickEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the ButtonClick event of a ToolBar.
+ /// </summary>
+ [Serializable]
+ public delegate void ToolBarButtonClickEventHandler(object sender, ToolBarButtonClickEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs
new file mode 100644
index 00000000000..948f69bc69c
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewCancelEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.TreeViewCancelEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the BeforeCheck,
+ /// BeforeCollapse, BeforeExpand, or BeforeSelect event of a TreeView.
+ /// </summary>
+ [Serializable]
+ public delegate void TreeViewCancelEventHandler(object sender, TreeViewCancelEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs
new file mode 100644
index 00000000000..ecbaace79f4
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/TreeViewEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.TreeViewEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents the method that will handle the
+ /// AfterCheck, AfterCollapse, AfterExpand, or AfterSelect event of a TreeView.
+ /// </summary>
+ [Serializable]
+ public delegate void TreeViewEventHandler(object sender, TreeViewEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs
new file mode 100644
index 00000000000..a5ae458266e
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/UICuesEventHandler.cs
@@ -0,0 +1,18 @@
+//
+// System.Windows.Forms.UICuesEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// Represents a method that will handle the ChangeUICues event of a Control.
+ /// </summary>
+ [Serializable]
+ public delegate void UICuesEventHandler(object sender, UICuesEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs
new file mode 100644
index 00000000000..40f951b22c9
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/UpDownEventHandler.cs
@@ -0,0 +1,19 @@
+//
+// System.Windows.Forms.UpDownEventHandler.cs
+//
+// Authors:
+// Jaak Simm (jaaksimm@firm.ee)
+// Dennis Hayes (dennish@Raytek.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Windows.Forms
+{
+ /// <summary>
+ /// This type supports the .NET Framework infrastructure
+ /// and is not intended to be used directly from your code.
+ /// </summary>
+ [Serializable]
+ public delegate void UpDownEventHandler(object sender, UpDownEventArgs e);
+} \ No newline at end of file
diff --git a/mcs/class/System.Windows.Forms/enums.cs b/mcs/class/System.Windows.Forms/enums.cs
new file mode 100644
index 00000000000..de8d3476962
--- /dev/null
+++ b/mcs/class/System.Windows.Forms/enums.cs
@@ -0,0 +1,310 @@
+using System;
+namespace System.Windows.Forms {
+ public enum AccessibleEvents{
+ AcceleratorChange,
+ Create,
+ DefaultActionChange,
+ DescriptionChange,
+ Destroy,
+ Focus,
+ HelpChange,
+ Hide,
+ LocationChange,
+ NameChange,
+ ParentChange,
+ Reorder,
+ Selection,
+ SelectionAdd,
+ SelectionRemove,
+ SelectionWithin,
+ Show,
+ StateChange,
+ SystemAlert,
+ SystemCaptureEnd,
+ SystemCaptureStart,
+ SystemContextHelpEnd,
+ SystemContextHelpStart,
+ SystemDialogEnd,
+ SystemDialogStart,
+ SystemDragDropEnd,
+ SystemDragDropStart,
+ SystemForeground,
+ SystemMenuEnd,
+ SystemMenuPopupEnd,
+ SystemMenuPopupStart,
+ SystemMenuStart,
+ SystemMinimizeEnd,
+ SystemMinimizeStart,
+ SystemMoveSizeEnd,
+ SystemMoveSizeStart,
+ SystemScrollingEnd,
+ SystemScrollingStart,
+ SystemSound,
+ SystemSwitchEnd,
+ SystemSwitchStart,
+ ValueChange
+ }
+
+
+ public enum AccessibleEvents{
+ Down,
+ FirstChild,
+ LastChild,
+ Left,
+ Next,
+ Previous,
+ Right,
+ Up
+ }
+
+
+ public enum AccessibleRole{
+ Alert,
+ Animation,
+ Application,
+ Border,
+ ButtonDropDown,
+ ButtonDropDownGrid,
+ ButtonMenu,
+ Caret,
+ Cell,
+ Character,
+ Chart,
+ CheckButton,
+ Client,
+ Clock,
+ Column,
+ ColumnHeader,
+ ComboBox,
+ Cursor,
+ Default,
+ Diagram,
+ Dial,
+ Dialog,
+ Document,
+ DropList,
+ Equation,
+ Graphic,
+ Grip,
+ Grouping,
+ HelpBalloon,
+ HotkeyField,
+ Indicator,
+ Link,
+ List,
+ ListItem,
+ MenuBar,
+ MenuItem,
+ MenuPopup,
+ None,
+ Outline,
+ OutlineItem,
+ PageTab,
+ PageTabList,
+ Pane,
+ ProgressBar,
+ PropertyPage,
+ PushButton,
+ RadioButton,
+ Row,
+ RowHeader,
+ ScrollBar,
+ Separator,
+ Slider,
+ Sound,
+ SpinButton,
+ StaticText,
+ StatusBar,
+ Table,
+ Text,
+ TitleBar,
+ ToolBar,
+ ToolTip,
+ WhiteSpace,
+ Window
+ }
+
+
+ public enum AccessibleStates{
+ AddSelection,
+ ExtendSelection,
+ None,
+ RemoveSelection,
+ TakeFocus,
+ TakeSelection
+ }
+
+
+ public enum AnchorStyles{
+ Bottom,
+ Left,
+ None,
+ Right,
+ Top
+ }
+
+
+ public enum Appearance {
+ Button,
+ Normal
+ }
+
+
+ public enum ArrangeDirection {
+ Down,
+ Left,
+ Right,
+ Up
+ }
+
+
+ public enum ArrangeStartingPosition {
+ BottomLeft,
+ BottomRight,
+ Hide,
+ TopLeft,
+ TopRight
+ }
+
+ public enum BootMode {
+ FailSafe,
+ FailSafeWithNetwork,
+ Normal
+ }
+
+ public enum Border3DSide {
+ All,
+ Bottom,
+ Left,
+ Middle,
+ Right,
+ Top
+ }
+
+ public enum Border3DStyle {
+ Adjust,
+ Bump,
+ Etched,
+ Flat,
+ Raised,
+ RaisedInner,
+ RaisedOuter,
+ Sunken,
+ SunkenInner,
+ SunkenOuter
+ }
+
+
+ public enum BorderStyle {
+ Fixed3D,
+ FixedSingle,
+ None
+ }
+
+ public enum BoundsSpecified {
+ All,
+ Height,
+ Location,
+ None,
+ Size,
+ Width,
+ X,
+ Y
+ }
+
+ public enum ButtonBorderStyle {
+ Dashed,
+ Dotted,
+ Inset,
+ None,
+ Outset,
+ Solid
+ }
+
+ public enum ButtonState {
+ All,
+ Checked,
+ Flat,
+ Inactive,
+ Normal,
+ Pushed
+ }
+
+ public enum ColorDepth {
+ Depth16Bit,
+ Depth24Bit,
+ Depth32Bit,
+ Depth4Bit,
+ Depth8Bit
+ }
+
+ public enum ColumnHeaderStyle {
+ Clickable,
+ Nonclickable,
+ None
+ }
+
+ public enum ComboBoxStyle {
+ DropDown,
+ DropDownList,
+ Simple
+ }
+
+ public enum ControlStyles {
+ AllPaintingInWmPaint,
+ CacheText,
+ ContainerControl,
+ DoubleBuffer,
+ EnableNotifyMessage,
+ FixedHeight,
+ FixedWidth,
+ Opaque,
+ ResizeRedraw,
+ Selectable,
+ StandardClick,
+ StandardDoubleClick,
+ SupportsTransparentBackColor,
+ UserMouse,
+ UserPaint
+ }
+
+ public enum DataGridLineStyle {
+ None,
+ Solid
+ }
+ //System.Windows.Forms.DataGridParentRowsLabelStyle
+ public enum DateTimePickerFormat {
+ Custom = 1,
+ Long = 2,
+ Short = 3,
+ Time = 4
+ }
+
+ public enum Day {
+ Default,
+ Friday,
+ Monday,
+ Saturday,
+ Sunday,
+ Thursday,
+ Tuesday,
+ Wednesday
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mcs/class/System.XML/.cvsignore b/mcs/class/System.XML/.cvsignore
new file mode 100644
index 00000000000..36defaa40ed
--- /dev/null
+++ b/mcs/class/System.XML/.cvsignore
@@ -0,0 +1,6 @@
+*.dll
+list
+*.suo
+*.csproj.user
+bin
+obj
diff --git a/mcs/class/System.XML/ChangeLog b/mcs/class/System.XML/ChangeLog
new file mode 100644
index 00000000000..e95c134afe0
--- /dev/null
+++ b/mcs/class/System.XML/ChangeLog
@@ -0,0 +1,15 @@
+2002-03-06 Jason Diamond <jason@injektilo.org>
+
+ * System.XML.build: Disable warning CS0679: Other languages may permit the internal virtual member 'foo' to be overridden.
+
+2002-02-23 Nick Drochak <ndrochak@gol.com>
+
+ * System.XML.build: Change dll name to System.Xml.dll from
+ System.XML.dll (not easy to notice, btw)
+
+2001-12-07 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: Add the change log to this directory
+
+ * System.XML.build: Add dependancy on linux target to test target. Need to have the dll before we can test it, right? Plus is encourages other to try 'make test'.
+
diff --git a/mcs/class/System.XML/Mono.System.XML.csproj b/mcs/class/System.XML/Mono.System.XML.csproj
new file mode 100644
index 00000000000..91f95f00183
--- /dev/null
+++ b/mcs/class/System.XML/Mono.System.XML.csproj
@@ -0,0 +1,401 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "System.XML"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "System.XML"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "System.Xml\ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml\Driver.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\EntityHandling.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\Formatting.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\IXmlLineInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\NameTable.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\Profile.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\ReadState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\TODOAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\ValidationType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\WhitespaceHandling.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\WriteState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlAttributeCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlCaseOrder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlCDataSection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlChar.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlCharacterData.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlComment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlDeclaration.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlDocument.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlDocumentFragment.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlDocumentType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlElement.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlEntityReference.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlImplementation.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlLinkedNode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNamedNodeMap.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNamespaceManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNameTable.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeChangedAction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeChangedEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeChangedEventHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeList.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeListChildren.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeOrder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlNodeType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlParserContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlProcessingInstruction.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlQualifiedName.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlResolver.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlSignificantWhitespace.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlSpace.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlText.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlTextReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlTextWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlTextWriterOpenElement.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlTokenizedType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlUrlResolver.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlWhitespace.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml\XmlWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "System.Xml.XPath\IXPathNavigable.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XmlDataType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XmlSortOrder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathExpression.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathNamespaceScope.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathNavigator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathNodeIterator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathNodeType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathResultType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "System.Xml.XPath\XPathScanner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.XML/Mono.System.XML.sln b/mcs/class/System.XML/Mono.System.XML.sln
new file mode 100644
index 00000000000..0d2c98ae7dd
--- /dev/null
+++ b/mcs/class/System.XML/Mono.System.XML.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.System.XML", "Mono.System.XML.csproj", "{0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoMicro.Test", "Test\MonoMicro.Test.csproj", "{F7734143-3845-4288-B1CA-FE614FFA70F0}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}.Debug.ActiveCfg = Debug|.NET
+ {0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}.Debug.Build.0 = Debug|.NET
+ {0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}.Release.ActiveCfg = Release|.NET
+ {0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}.Release.Build.0 = Release|.NET
+ {F7734143-3845-4288-B1CA-FE614FFA70F0}.Debug.ActiveCfg = Debug|.NET
+ {F7734143-3845-4288-B1CA-FE614FFA70F0}.Debug.Build.0 = Debug|.NET
+ {F7734143-3845-4288-B1CA-FE614FFA70F0}.Release.ActiveCfg = Release|.NET
+ {F7734143-3845-4288-B1CA-FE614FFA70F0}.Release.Build.0 = Release|.NET
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/mcs/class/System.XML/System.XML.build b/mcs/class/System.XML/System.XML.build
new file mode 100644
index 00000000000..bb4bd7961f8
--- /dev/null
+++ b/mcs/class/System.XML/System.XML.build
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.XML.dll -->
+
+<project name="System.XML" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.Xml.dll" debug="${debug}">
+ <!-- 'foo' is defined in multiple places; using definition from 'bar' -->
+ <arg value="/nowarn:1595"/>
+ <!-- Other languages may permit the internal virtual member 'foo' to be overridden -->
+ <arg value="/nowarn:0679"/>
+ <arg value="/nowarn:0649"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ <excludes name="System.Xml.Serialization/**"/>
+ </sources>
+ </csc>
+ <copy file="../lib/System.Xml.dll" tofile="Test/System.XML.dll"/>
+ <nant basedir="Test" target="build"/>
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <nant basedir="Test" target="clean"/>
+ <delete file="../lib/System.XML.dll" failonerror="false"/>
+ <delete file="../lib/System.Xml.dll" failonerror="false"/>
+ <delete file="Test/System.XML.dll" failonerror="false"/>
+ <delete file="Test/System.Xml.dll" failonerror="false"/>
+ <delete file="../lib/System.XML.pdb" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.XML/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/System.Xml.Schema/ChangeLog
new file mode 100755
index 00000000000..07f428e8aaa
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/ChangeLog
@@ -0,0 +1,3 @@
+2002-03-27 Duncan Mak <duncan@ximian.com>
+
+ * *.cs: Updates from Ajay Dwivedi <AjayKumar.Dwivedi@dresdner-bank.com>. \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/ValidationEventArgs.cs b/mcs/class/System.XML/System.Xml.Schema/ValidationEventArgs.cs
new file mode 100755
index 00000000000..f2b0a9431a4
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/ValidationEventArgs.cs
@@ -0,0 +1,37 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for ValidationEventArgs.
+ /// </summary>
+ public sealed class ValidationEventArgs : EventArgs
+ {
+ private XmlSchemaException exception;
+ private string message;
+ private XmlSeverityType severity;
+
+ private ValidationEventArgs()
+ {}
+
+ public XmlSchemaException Exception
+ {
+ get{ return exception; }
+ }
+ public string Message
+ {
+ get{ return message; }
+ }
+ public XmlSeverityType Severity
+ {
+ get{ return severity; }
+ }
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ public delegate void ValidationEventHandler(object sender,ValidationEventArgs e);
+
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
new file mode 100755
index 00000000000..e5c021bbdb0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
@@ -0,0 +1,303 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.IO;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchema.
+ /// </summary>
+ [XmlRoot("schema",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public class XmlSchema : XmlSchemaObject
+ {
+ //public constants
+ [XmlIgnore]
+ public const string InstanceNamespace = "http://www.w3.org/2001/XMLSchema-instance";
+ [XmlIgnore]
+ public const string Namespace = "http://www.w3.org/2001/XMLSchema";
+
+ //private fields
+ private XmlSchemaForm attributeFormDefault ;
+ private XmlSchemaObjectTable attributeGroups ;
+ private XmlSchemaObjectTable attributes ;
+ private XmlSchemaDerivationMethod blockDefault ;
+ private XmlSchemaForm elementFormDefault ;
+ private XmlSchemaObjectTable elements ;
+ private XmlSchemaDerivationMethod finalDefault ;
+ private XmlSchemaObjectTable groups ;
+ private string id ;
+ private XmlSchemaObjectCollection includes ;
+ private bool isCompiled ;
+ private XmlSchemaObjectCollection items ;
+ private XmlSchemaObjectTable notations ;
+ private XmlSchemaObjectTable schemaTypes ;
+ private string targetNamespace ;
+ private XmlAttribute[] unhandledAttributes ;
+ private string version;
+ private string language;
+
+ public XmlSchema()
+ {
+ attributeFormDefault= XmlSchemaForm.None;
+ blockDefault = XmlSchemaDerivationMethod.None;
+ elementFormDefault = XmlSchemaForm.None;
+ finalDefault = XmlSchemaDerivationMethod.None;
+ includes = new XmlSchemaObjectCollection();
+ isCompiled = false;
+ items = new XmlSchemaObjectCollection();
+ }
+
+ #region Properties
+
+ [DefaultValue(XmlSchemaForm.None)]
+ [System.Xml.Serialization.XmlAttribute("attributeFormDefault")]
+ public XmlSchemaForm AttributeFormDefault
+ {
+ get{ return attributeFormDefault; }
+ set{ this.attributeFormDefault = value;}
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable AttributeGroups
+ {
+ get{ return attributeGroups; }
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable Attributes
+ {
+ get{ return attributes;}
+ }
+
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("blockDefault")]
+ public XmlSchemaDerivationMethod BlockDefault
+ {
+ get{ return blockDefault;}
+ set{ blockDefault = value;}
+ }
+
+ [DefaultValue(XmlSchemaForm.None)]
+ [System.Xml.Serialization.XmlAttribute("elementFormDefault")]
+ public XmlSchemaForm ElementFormDefault
+ {
+ get{ return elementFormDefault;}
+ set{ elementFormDefault = value;}
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable Elements
+ {
+ get{ return elements;}
+ }
+
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("finalDefault")]
+ public XmlSchemaDerivationMethod FinalDefault
+ {
+ get{ return finalDefault;}
+ set{ finalDefault = value;}
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable Groups
+ {
+ get{ return groups;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("id")]
+ public string Id
+ {
+ get{ return id;}
+ set{ id = value;}
+ }
+
+ [XmlElement("include",typeof(XmlSchemaInclude),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("import",typeof(XmlSchemaImport),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("redefine",typeof(XmlSchemaRedefine),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Includes
+ {
+ get{ return includes;}
+ }
+
+ [XmlIgnore]
+ public bool IsCompiled
+ {
+ get{ return isCompiled;}
+ }
+
+ [XmlElement("simpleType",typeof(XmlSchemaSimpleType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("complexType",typeof(XmlSchemaComplexType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("group",typeof(XmlSchemaGroup),Namespace="http://www.w3.org/2001/XMLSchema")]
+ //Only Schema's attributeGroup has type XmlSchemaAttributeGroup.
+ //Others (complextype, restrictions etc) must have XmlSchemaAttributeGroupRef
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroup),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("element",typeof(XmlSchemaElement),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("notation",typeof(XmlSchemaNotation),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("annotation",typeof(XmlSchemaAnnotation),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Items
+ {
+ get{ return items;}
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable Notations
+ {
+ get{ return notations;}
+ }
+
+ [XmlIgnore]
+ public XmlSchemaObjectTable SchemaTypes
+ {
+ get{ return schemaTypes;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("targetNamespace")]
+ public string TargetNamespace
+ {
+ get{ return targetNamespace;}
+ set{ targetNamespace = value;}
+ }
+
+ [XmlAnyAttribute]
+ public XmlAttribute[] UnhandledAttributes
+ {
+ get{ return unhandledAttributes;}
+ set{ unhandledAttributes = value;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("version")]
+ public string Version
+ {
+ get{ return version;}
+ set{ version = value;}
+ }
+
+ // New attribute defined in W3C schema element
+ [System.Xml.Serialization.XmlAttribute("xml:lang")]
+ public string Language
+ {
+ get{ return language; }
+ set{ language = value; }
+ }
+
+ #endregion
+
+ // Methods
+ [MonoTODO]
+ public void Compile(ValidationEventHandler validationEventHandler)
+ {
+ attributeGroups = null;
+
+ }
+
+ public static XmlSchema Read(TextReader reader, ValidationEventHandler validationEventHandler)
+ {
+ return Read(new XmlTextReader(reader),validationEventHandler);
+ }
+ public static XmlSchema Read(Stream stream, ValidationEventHandler validationEventHandler)
+ {
+ return Read(new XmlTextReader(stream),validationEventHandler);
+ }
+ //<ToBeRemoved>
+ private static void Serializer_UnknownAttribute(object sender, XmlAttributeEventArgs e)
+ {
+ Console.WriteLine("Unknown Attribute");
+ Console.WriteLine("\t" + e.Attr.Name + " " + e.Attr.InnerXml);
+ Console.WriteLine("\t LineNumber: " + e.LineNumber);
+ Console.WriteLine("\t LinePosition: " + e.LinePosition);
+ }
+ private static void Serializer_UnknownElement(object sender, XmlElementEventArgs e)
+ {
+ Console.WriteLine("Unknown Element");
+ Console.WriteLine("\t" + e.Element.Name + " " + e.Element.InnerXml);
+ Console.WriteLine("\t LineNumber: " + e.LineNumber);
+ Console.WriteLine("\t LinePosition: " + e.LinePosition);
+ }
+ private static void Serializer_UnknownNode(object sender, XmlNodeEventArgs e)
+ {
+ Console.WriteLine("Unknown Node");
+ Console.WriteLine("\t" + e.Name + " " + e.Text);
+ Console.WriteLine("\t LineNumber: " + e.LineNumber);
+ Console.WriteLine("\t LinePosition: " + e.LinePosition);
+ }
+ private static void Serializer_UnknownAttribute(object sender, UnreferencedObjectEventArgs e)
+ {
+ Console.WriteLine("Unknown");
+ Console.WriteLine("\t" + e.UnreferencedId);
+ Console.WriteLine("\t" + e.UnreferencedObject);
+ }
+ //</ToBeRemoved>
+ [MonoTODO]
+ public static XmlSchema Read(XmlReader reader, ValidationEventHandler validationEventHandler)
+ {
+ XmlSerializer xser = new XmlSerializer(typeof(XmlSchema));
+ //<ToBeRemoved>
+ xser.UnknownAttribute += new XmlAttributeEventHandler(Serializer_UnknownAttribute);
+ xser.UnknownElement += new XmlElementEventHandler(Serializer_UnknownElement);
+ xser.UnknownNode += new XmlNodeEventHandler(Serializer_UnknownNode);
+ xser.UnreferencedObject += new UnreferencedObjectEventHandler(Serializer_UnknownAttribute);
+ //</ToBeRemoved>
+ return (XmlSchema) xser.Deserialize(reader);
+ }
+ public void Write(System.IO.Stream stream)
+ {
+ Write(stream,null);
+ }
+ public void Write(System.IO.TextWriter writer)
+ {
+ Write(writer,null);
+ }
+ public void Write(System.Xml.XmlWriter writer)
+ {
+ Write(writer,null);
+ }
+ public void Write(System.IO.Stream stream, System.Xml.XmlNamespaceManager namespaceManager)
+ {
+ Write(new XmlTextWriter(stream,null),namespaceManager);
+ }
+ public void Write(System.IO.TextWriter writer, System.Xml.XmlNamespaceManager namespaceManager)
+ {
+ XmlTextWriter xwriter = new XmlTextWriter(writer);
+ // This is why the Write was not writing schema with line breaks
+ xwriter.Formatting = Formatting.Indented;
+ Write(xwriter,namespaceManager);
+ }
+ [MonoTODO]
+ public void Write(System.Xml.XmlWriter writer, System.Xml.XmlNamespaceManager namespaceManager)
+ {
+ XmlSerializerNamespaces xns;
+
+ if(Namespaces != null)
+ {
+ xns = new XmlSerializerNamespaces(this.Namespaces);
+ }
+ else
+ {
+ xns = new XmlSerializerNamespaces();
+ }
+
+ if(namespaceManager != null)
+ {
+ foreach(string name in namespaceManager)
+ {
+ //xml and xmlns namespaced are added by default in namespaceManager.
+ //So we should ignore them
+ if(name!="xml" && name != "xmlns")
+ xns.Add(name,namespaceManager.LookupNamespace(name));
+ }
+ }
+
+ this.Namespaces = xns;
+
+ XmlSerializer xser = new XmlSerializer(typeof(XmlSchema));
+ xser.Serialize(writer,this,xns);
+ writer.Flush();
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
new file mode 100755
index 00000000000..c5b1d1c2790
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
@@ -0,0 +1,24 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAll.
+ /// </summary>
+ public class XmlSchemaAll : XmlSchemaGroupBase
+ {
+ private XmlSchemaObjectCollection items;
+ public XmlSchemaAll()
+ {
+ items = new XmlSchemaObjectCollection();
+ }
+ [XmlElement("element",typeof(XmlSchemaElement),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public override XmlSchemaObjectCollection Items
+ {
+ get{ return items; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotated.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotated.cs
new file mode 100755
index 00000000000..ab179dcdd0a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotated.cs
@@ -0,0 +1,57 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAnnotated.
+ /// </summary>
+ // Include all childrens of this class
+// [XmlInclude(typeof(XmlSchemaAnyAttribute)),
+// XmlInclude(typeof(XmlSchemaAttribute)),
+// XmlInclude(typeof(XmlSchemaAttributeGroup)),
+// XmlInclude(typeof(XmlSchemaAttributeGroupRef)),
+// XmlInclude(typeof(XmlSchemaContent)),
+// XmlInclude(typeof(XmlSchemaContentModel)),
+// XmlInclude(typeof(XmlSchemaFacet)),
+// XmlInclude(typeof(XmlSchemaGroup)),
+// XmlInclude(typeof(XmlSchemaIdentityConstraint)),
+// XmlInclude(typeof(XmlSchemaNotation)),
+// XmlInclude(typeof(XmlSchemaParticle)),
+// XmlInclude(typeof(XmlSchemaSimpleTypeContent)),
+// XmlInclude(typeof(XmlSchemaType)),
+// XmlInclude(typeof(XmlSchemaXPath))]
+ public class XmlSchemaAnnotated : XmlSchemaObject
+ {
+ private XmlSchemaAnnotation annotation;
+ private string id;
+ private XmlAttribute[] unhandledAttributes;
+
+ public XmlSchemaAnnotated()
+ {}
+
+ [XmlElement("annotation",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnnotation Annotation
+ {
+ get{ return annotation; }
+ set{ annotation = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("id")]
+ public string Id
+ {
+ get{ return id; }
+ set{ id = value; }
+ }
+
+ [XmlAnyAttribute]
+ public XmlAttribute[] UnhandledAttributes
+ {
+ get{ return unhandledAttributes; }
+ set{ unhandledAttributes = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs
new file mode 100755
index 00000000000..3b53f03a616
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs
@@ -0,0 +1,44 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAnnotation.
+ /// </summary>
+ public class XmlSchemaAnnotation : XmlSchemaObject
+ {
+ private string id;
+ private XmlSchemaObjectCollection items;
+ private XmlAttribute[] unhandledAttributes;
+
+ public XmlSchemaAnnotation()
+ {
+ items = new XmlSchemaObjectCollection();
+ }
+
+ [System.Xml.Serialization.XmlAttribute("id")]
+ public string Id
+ {
+ get{ return id; }
+ set{ id = value; }
+ }
+
+ [XmlElement("appinfo",typeof(XmlSchemaAppInfo),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("documentation",typeof(XmlSchemaDocumentation),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Items
+ {
+ get{ return items; }
+ }
+
+ [XmlAnyAttribute]
+ public XmlAttribute[] UnhandledAttributes
+ {
+ get{ return unhandledAttributes; }
+ set{ unhandledAttributes = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
new file mode 100755
index 00000000000..80ce4619902
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
@@ -0,0 +1,37 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAny.
+ /// </summary>
+ public class XmlSchemaAny : XmlSchemaParticle
+ {
+ private string nameSpace;
+ private XmlSchemaContentProcessing processing;
+
+ public XmlSchemaAny()
+ {
+ nameSpace = string.Empty;
+ }
+
+ [System.Xml.Serialization.XmlAttribute("namespace")]
+ public string Namespace
+ {
+ get{ return nameSpace; }
+ set{ nameSpace = value; }
+ }
+
+ [DefaultValue(XmlSchemaContentProcessing.None)]
+ [System.Xml.Serialization.XmlAttribute("processContents")]
+ public XmlSchemaContentProcessing ProcessContents
+ {
+ get{ return processing; }
+ set{ processing = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs
new file mode 100755
index 00000000000..6392c84ebb0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs
@@ -0,0 +1,37 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAnyAttribute.
+ /// </summary>
+ public class XmlSchemaAnyAttribute : XmlSchemaAnnotated
+ {
+ private string nameSpace;
+ private XmlSchemaContentProcessing processing;
+
+ public XmlSchemaAnyAttribute()
+ {
+ nameSpace = string.Empty;
+ }
+
+ [System.Xml.Serialization.XmlAttribute("namespace")]
+ public string Namespace
+ {
+ get{ return nameSpace; }
+ set{ nameSpace = value; }
+ }
+
+ [DefaultValue(XmlSchemaContentProcessing.None)]
+ [System.Xml.Serialization.XmlAttribute("processContents")]
+ public XmlSchemaContentProcessing ProcessContents
+ {
+ get{ return processing; }
+ set{ processing = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAppInfo.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAppInfo.cs
new file mode 100755
index 00000000000..ae060eb7238
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAppInfo.cs
@@ -0,0 +1,37 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAppInfo.
+ /// </summary>
+ public class XmlSchemaAppInfo : XmlSchemaObject
+ {
+ private XmlNode[] markup;
+ private string source;
+
+ public XmlSchemaAppInfo()
+ {
+ source = string.Empty;
+ }
+
+ [XmlAnyElement]
+ [XmlText]
+ public XmlNode[] Markup
+ {
+ get{ return markup; }
+ set{ markup = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("source")]
+ public string Source
+ {
+ get{ return source; }
+ set{ source = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
new file mode 100755
index 00000000000..41b122de80a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
@@ -0,0 +1,123 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAttribute.
+ /// </summary>
+ public class XmlSchemaAttribute : XmlSchemaAnnotated
+ {
+ private object attributeType;
+ private string defaultValue;
+ private string fixedValue;
+ private XmlSchemaForm form;
+ private string name;
+ private XmlQualifiedName qualifiedName;
+ private XmlQualifiedName refName;
+ private XmlSchemaSimpleType schemaType;
+ private XmlQualifiedName schemaTypeName;
+ private XmlSchemaUse use;
+
+ public XmlSchemaAttribute()
+ {
+ //FIXME: Docs says the default is optional.
+ //Whereas the MS implementation has default None.
+ use = XmlSchemaUse.None;
+ qualifiedName = XmlQualifiedName.Empty;
+ refName = XmlQualifiedName.Empty;
+ }
+
+ // Properties
+ [XmlIgnore]
+ public object AttributeType
+ { //FIXME: This is not correct. Is it?
+ get{ return attributeType; }
+ }
+
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("default")]
+ public string DefaultValue
+ {
+ get{ return defaultValue;}
+ set
+ { // Default Value and fixed Value are mutually exclusive
+ fixedValue = null;
+ defaultValue = value;
+ }
+ }
+
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("fixed")]
+ public string FixedValue
+ {
+ get{ return fixedValue;}
+ set
+ { // Default Value and fixed Value are mutually exclusive
+ defaultValue = null;
+ fixedValue = value;
+ }
+ }
+
+ [DefaultValue(XmlSchemaForm.None)]
+ [System.Xml.Serialization.XmlAttribute("form")]
+ public XmlSchemaForm Form
+ {
+ get{ return form;}
+ set{ form = value;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name;}
+ set
+ { // Name and RefName are mutually exclusive
+ refName = null;
+ name = value;
+ }
+ }
+ [XmlIgnore]
+ public XmlQualifiedName QualifiedName
+ {
+ get{ return qualifiedName;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("ref")]
+ public XmlQualifiedName RefName
+ {
+ get{ return refName;}
+ set
+ { // Name and RefName are mutually exclusive
+ name = null;
+ refName = value;
+ }
+ }
+
+ [XmlElement("simpleType",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaSimpleType SchemaType
+ {
+ get{ return schemaType;}
+ set{ schemaType = value;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("type")]
+ public XmlQualifiedName SchemaTypeName
+ {
+ get{ return schemaTypeName;}
+ set{ schemaTypeName = value;}
+ }
+
+ [DefaultValue(XmlSchemaUse.None)]
+ [System.Xml.Serialization.XmlAttribute("use")]
+ public XmlSchemaUse Use
+ {
+ get{ return use;}
+ set{ use = value;}
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs
new file mode 100755
index 00000000000..1a8795e354d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs
@@ -0,0 +1,53 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAttributeGroup.
+ /// </summary>
+ public class XmlSchemaAttributeGroup : XmlSchemaAnnotated
+ {
+ private XmlSchemaAnyAttribute any;
+ private XmlSchemaObjectCollection attributes;
+ private string name;
+ private XmlSchemaAttributeGroup redefined;
+
+ public XmlSchemaAttributeGroup()
+ {
+ attributes = new XmlSchemaObjectCollection();
+ //FIXME:
+ redefined = this;
+ }
+
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return any;}
+ set{ any = value;}
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name;}
+ set{ name = value;}
+ }
+
+ //Undocumented property
+ [XmlIgnore]
+ public XmlSchemaAttributeGroup RedefinedAttributeGroup
+ {
+ get{ return redefined;}
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs
new file mode 100755
index 00000000000..371f30fe0ae
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs
@@ -0,0 +1,26 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAttributeGroupRef.
+ /// </summary>
+ public class XmlSchemaAttributeGroupRef : XmlSchemaAnnotated
+ {
+ private XmlQualifiedName refName;
+
+ public XmlSchemaAttributeGroupRef()
+ {}
+
+ [System.Xml.Serialization.XmlAttribute("ref")]
+ public XmlQualifiedName RefName
+ {
+ get{ return refName; }
+ set{ refName = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
new file mode 100755
index 00000000000..372f6b5ffdf
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
@@ -0,0 +1,29 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaAll.
+ /// </summary>
+ public class XmlSchemaChoice : XmlSchemaGroupBase
+ {
+ private XmlSchemaObjectCollection items;
+ public XmlSchemaChoice()
+ {
+ items = new XmlSchemaObjectCollection();
+ }
+
+ [XmlElement("element",typeof(XmlSchemaElement),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("group",typeof(XmlSchemaGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("any",typeof(XmlSchemaAny),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public override XmlSchemaObjectCollection Items
+ {
+ get{ return items; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs
new file mode 100755
index 00000000000..68e1c6b4f7e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs
@@ -0,0 +1,118 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+using System.Xml;
+
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaCollection.
+ /// </summary>
+ public sealed class XmlSchemaCollection : ICollection, IEnumerable
+ {
+ //private fields
+ private Hashtable htable;
+ private XmlNameTable ntable;
+
+ [MonoTODO]
+ public XmlSchemaCollection()
+ {
+ htable = new Hashtable();
+ ntable = new NameTable();
+ }
+ public XmlSchemaCollection(XmlNameTable nametable)
+ {
+ htable = new Hashtable();
+ ntable = nametable;
+ }
+
+ //properties
+ public int Count
+ {
+ get
+ {
+ return this.htable.Count;
+ }
+ }
+ public XmlSchema this[ string ns ]
+ {
+ get
+ {
+ return (XmlSchema) this.htable[ns];
+ }
+ }
+ public XmlNameTable NameTable
+ {
+ get
+ {
+ return this.ntable;
+ }
+ }
+
+ // Events
+ public event ValidationEventHandler ValidationEventHandler;
+
+ // Methods
+ [MonoTODO]
+ public XmlSchema Add(string ns, XmlReader reader)
+ {
+ return null;
+ }
+ [MonoTODO]
+ public XmlSchema Add(string ns, string uri)
+ {
+ return null;
+ }
+ [MonoTODO]
+ public XmlSchema Add(XmlSchema schema)
+ {
+ return null;
+ }
+
+ public void Add(XmlSchemaCollection schema)
+ {
+ XmlSchemaCollectionEnumerator xenum = schema.GetEnumerator();
+ while(xenum.MoveNext())
+ {
+ this.Add(xenum.Current);
+ }
+ }
+
+ public bool Contains(string ns)
+ {
+ return this.htable.Contains(ns);
+ }
+ public bool Contains(XmlSchema schema)
+ {
+ return this.htable.Contains(schema.TargetNamespace);
+ }
+ public void CopyTo(XmlSchema[] array, int index)
+ {
+
+ }
+ public XmlSchemaCollectionEnumerator GetEnumerator()
+ {
+ return new XmlSchemaCollectionEnumerator(this.htable);
+ }
+
+ //assembly Methods
+ [MonoTODO]
+ void ICollection.CopyTo(Array array, int index)
+ {
+ }
+ bool ICollection.IsSynchronized
+ {
+ get { return false; }
+ }
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return this.htable.GetEnumerator();
+ }
+ Object ICollection.SyncRoot
+ {
+ get { return this; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollectionEnumerator.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollectionEnumerator.cs
new file mode 100755
index 00000000000..3130c3094ac
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollectionEnumerator.cs
@@ -0,0 +1,47 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaCollectionEnumerator.
+ /// </summary>
+ public sealed class XmlSchemaCollectionEnumerator : IEnumerator
+ {
+ private IDictionaryEnumerator xenum;
+ internal XmlSchemaCollectionEnumerator(Hashtable htable)
+ {
+ this.xenum = htable.GetEnumerator();
+ }
+ // Properties
+ public XmlSchema Current
+ {
+ get
+ {
+ return (XmlSchema) xenum.Current;
+ }
+ }
+ // Methods
+ public bool MoveNext()
+ {
+ return xenum.MoveNext();
+ }
+
+ //Explicit Interface implementation
+ bool IEnumerator.MoveNext()
+ {
+ return xenum.MoveNext();
+ }
+ void IEnumerator.Reset()
+ {
+ xenum.Reset();
+ }
+ object IEnumerator.Current
+ {
+ get{return (XmlSchema) xenum.Current;}
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs
new file mode 100755
index 00000000000..e66cde088b2
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs
@@ -0,0 +1,34 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaComplexContent.
+ /// </summary>
+ public class XmlSchemaComplexContent : XmlSchemaContentModel
+ {
+ private XmlSchemaContent content;
+ private bool isMixed;
+
+ public XmlSchemaComplexContent()
+ {}
+
+ [XmlElement("restriction",typeof(XmlSchemaComplexContentRestriction),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("extension",typeof(XmlSchemaComplexContentExtension),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public override XmlSchemaContent Content
+ {
+ get{ return content; }
+ set{ content = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("mixed")]
+ public bool IsMixed
+ {
+ get{ return isMixed; }
+ set{ isMixed = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
new file mode 100755
index 00000000000..95e4d2c5095
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
@@ -0,0 +1,53 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaComplexContentExtension.
+ /// </summary>
+ public class XmlSchemaComplexContentExtension : XmlSchemaContent
+ {
+ private XmlSchemaAnyAttribute any;
+ private XmlSchemaObjectCollection attributes;
+ private XmlQualifiedName baseTypeName;
+ private XmlSchemaParticle particle;
+ public XmlSchemaComplexContentExtension()
+ {
+ attributes = new XmlSchemaObjectCollection();
+ }
+
+ [System.Xml.Serialization.XmlAttribute("base")]
+ public XmlQualifiedName BaseTypeName
+ {
+ get{ return baseTypeName; }
+ set{ baseTypeName = value; }
+ }
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return any; }
+ set{ any = value;}
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes; }
+ }
+
+ [XmlElement("group",typeof(XmlSchemaGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("all",typeof(XmlSchemaAll),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaParticle Particle
+ {
+ get{ return particle; }
+ set{ particle = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
new file mode 100755
index 00000000000..043704b55f3
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
@@ -0,0 +1,56 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaComplexContentRestriction.
+ /// </summary>
+ public class XmlSchemaComplexContentRestriction : XmlSchemaContent
+ {
+ private XmlSchemaAnyAttribute any;
+ private XmlSchemaObjectCollection attributes;
+ private XmlQualifiedName baseTypeName;
+ private XmlSchemaParticle particle;
+
+ public XmlSchemaComplexContentRestriction()
+ {
+ baseTypeName = XmlQualifiedName.Empty;
+ attributes = new XmlSchemaObjectCollection();
+ }
+
+ [System.Xml.Serialization.XmlAttribute("base")]
+ public XmlQualifiedName BaseTypeName
+ {
+ get{ return baseTypeName; }
+ set{ baseTypeName = value; }
+ }
+
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return any; }
+ set{ any = value; }
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes; }
+ }
+
+ [XmlElement("group",typeof(XmlSchemaGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("all",typeof(XmlSchemaAll),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaParticle Particle
+ {
+ get{ return particle; }
+ set{ particle = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
new file mode 100755
index 00000000000..76821253c83
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
@@ -0,0 +1,123 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaComplexType.
+ /// </summary>
+ public class XmlSchemaComplexType : XmlSchemaType
+ {
+ private XmlSchemaAnyAttribute anyAttribute;
+ private XmlSchemaObjectCollection attributes;
+ private XmlSchemaObjectTable attributeUses;
+ private XmlSchemaAnyAttribute attributeWildcard;
+ private XmlSchemaDerivationMethod block;
+ private XmlSchemaDerivationMethod blockResolved;
+ private XmlSchemaContentModel contentModel;
+ private XmlSchemaContentType contentType;
+ private XmlSchemaParticle contentTypeParticle;
+ private bool isAbstract;
+ private bool isMixed;
+ private XmlSchemaParticle particle;
+
+ public XmlSchemaComplexType()
+ {
+ attributes = new XmlSchemaObjectCollection();
+ block = XmlSchemaDerivationMethod.None;
+ }
+
+ #region Attributes
+
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("block")]
+ public XmlSchemaDerivationMethod Block
+ {
+ get{ return block; }
+ set{ block = value; }
+ }
+ [DefaultValue(false)]
+ [System.Xml.Serialization.XmlAttribute("abstract")]
+ public bool IsAbstract
+ {
+ get{ return isAbstract; }
+ set{ isAbstract = value; }
+ }
+ [DefaultValue(false)]
+ [System.Xml.Serialization.XmlAttribute("mixed")]
+ public override bool IsMixed
+ {
+ get{ return isMixed; }
+ set{ isMixed = value; }
+ }
+
+ #endregion
+
+ #region Elements
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return anyAttribute; }
+ set{ anyAttribute = value; }
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes; }
+ }
+
+ [XmlElement("simpleContent",typeof(XmlSchemaSimpleContent),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("complexContent",typeof(XmlSchemaComplexContent),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaContentModel ContentModel
+ {
+ get{ return contentModel; }
+ set{ contentModel = value; }
+ }
+
+ [XmlElement("group",typeof(XmlSchemaGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("all",typeof(XmlSchemaAll),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaParticle Particle
+ {
+ get{ return particle; }
+ set{ particle = value; }
+ }
+
+ #endregion
+
+ #region XmlIgnore
+ [XmlIgnore]
+ public XmlSchemaObjectTable AttributeUses
+ {
+ get{ return attributeUses; }
+ }
+ [XmlIgnore]
+ public XmlSchemaAnyAttribute AttributeWildcard
+ {
+ get{ return attributeWildcard; }
+ }
+ [XmlIgnore]
+ public XmlSchemaDerivationMethod BlockResolved
+ {
+ get{ return blockResolved; }
+ }
+ [XmlIgnore]
+ public XmlSchemaContentType ContentType
+ {
+ get{ return contentType; }
+ }
+ [XmlIgnore]
+ public XmlSchemaParticle ContentTypeParticle
+ {
+ get{ return contentTypeParticle; }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs
new file mode 100755
index 00000000000..ac32916437a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContent.cs
@@ -0,0 +1,15 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaContent.
+ /// </summary>
+ public abstract class XmlSchemaContent : XmlSchemaAnnotated
+ {
+ protected XmlSchemaContent()
+ {}
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentModel.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentModel.cs
new file mode 100755
index 00000000000..994dd211de5
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentModel.cs
@@ -0,0 +1,19 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaContentModel.
+ /// </summary>
+ public abstract class XmlSchemaContentModel : XmlSchemaAnnotated
+ {
+ protected XmlSchemaContentModel()
+ {
+ }
+ [XmlIgnore]
+ public abstract XmlSchemaContent Content {get; set;}
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentProcessing.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentProcessing.cs
new file mode 100755
index 00000000000..2cd60231a03
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentProcessing.cs
@@ -0,0 +1,22 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaContentProcessing.
+ /// </summary>
+ public enum XmlSchemaContentProcessing
+ {
+ [XmlIgnore]
+ None = 0,
+ [XmlEnum("skip")]
+ Skip = 1,
+ [XmlEnum("lax")]
+ Lax = 2,
+ [XmlEnum("strict")]
+ Strict = 3,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentType.cs
new file mode 100755
index 00000000000..dc7bda2433e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaContentType.cs
@@ -0,0 +1,17 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaContentType.
+ /// </summary>
+ public enum XmlSchemaContentType
+ {
+ TextOnly = 0,
+ Empty = 1,
+ ElementOnly = 2,
+ Mixed = 3,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
new file mode 100755
index 00000000000..e93428efbce
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDatatype.cs
@@ -0,0 +1,24 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaDatatype.
+ /// </summary>
+ public abstract class XmlSchemaDatatype
+ {
+ protected XmlSchemaDatatype()
+ {
+ }
+
+ public abstract XmlTokenizedType TokenizedType { get; }
+ public abstract Type ValueType { get; }
+
+ // Methods
+ public abstract object ParseValue(string s,
+ XmlNameTable nameTable, XmlNamespaceManager nsmgr);
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDerivationMethod.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDerivationMethod.cs
new file mode 100755
index 00000000000..4f2fba2da5a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDerivationMethod.cs
@@ -0,0 +1,31 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaDerivationMethod.
+ /// </summary>
+ [Flags]
+ public enum XmlSchemaDerivationMethod
+ {
+ [XmlEnum("empty")]
+ Empty = 0x00000000,
+ [XmlEnum("substitution")]
+ Substitution= 0x00000001,
+ [XmlEnum("extension")]
+ Extension = 0x00000002,
+ [XmlEnum("restriction")]
+ Restriction = 0x00000004,
+ [XmlEnum("list")]
+ List = 0x00000008,
+ [XmlEnum("union")]
+ Union = 0x00000010,
+ [XmlEnum("#all")]
+ All = 0x000000FF,
+ [XmlIgnore]
+ None = 0x00000100,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDocumentation.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDocumentation.cs
new file mode 100755
index 00000000000..183ffbab193
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaDocumentation.cs
@@ -0,0 +1,45 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaDocumentation.
+ /// </summary>
+ public class XmlSchemaDocumentation : XmlSchemaObject
+ {
+ private string language;
+ private XmlNode[] markup;
+ private string source;
+
+ public XmlSchemaDocumentation()
+ {
+ source = string.Empty;
+ }
+
+ [XmlAnyElement]
+ [XmlText]
+ public XmlNode[] Markup
+ {
+ get{ return markup; }
+ set{ markup = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("source")]
+ public string Source
+ {
+ get{ return source; }
+ set{ source = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("xml:lang")]
+ public string Language
+ {
+ get{ return language; }
+ set{ language = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
new file mode 100755
index 00000000000..fd859cbc6a3
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
@@ -0,0 +1,178 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaElement.
+ /// </summary>
+ public class XmlSchemaElement : XmlSchemaParticle
+ {
+ private XmlSchemaDerivationMethod block;
+ private XmlSchemaDerivationMethod blockResolved;
+ private XmlSchemaObjectCollection constraints;
+ private string defaultValue;
+ private object elementType;
+ private XmlSchemaDerivationMethod final;
+ private XmlSchemaDerivationMethod finalResolved;
+ private string fixedValue;
+ private XmlSchemaForm form;
+ private bool isAbstract;
+ private bool isNillable;
+ private string name;
+ private XmlQualifiedName qName;
+ private XmlQualifiedName refName;
+ private XmlSchemaType schemaType;
+ private XmlQualifiedName schemaTypeName;
+ private XmlQualifiedName substitutionGroup;
+
+ public XmlSchemaElement()
+ {
+ block = XmlSchemaDerivationMethod.None;
+ final = XmlSchemaDerivationMethod.None;
+ constraints = new XmlSchemaObjectCollection();
+ qName = XmlQualifiedName.Empty;
+ substitutionGroup = XmlQualifiedName.Empty;
+ }
+
+ #region Attributes
+
+ [DefaultValue(false)]
+ [System.Xml.Serialization.XmlAttribute("abstract")]
+ public bool IsAbstract
+ {
+ get{ return isAbstract; }
+ set{ isAbstract = value; }
+ }
+
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("block")]
+ public XmlSchemaDerivationMethod Block
+ {
+ get{ return block; }
+ set{ block = value; }
+ }
+
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("default")]
+ public string DefaultValue
+ {
+ get{ return defaultValue; }
+ set{ defaultValue = value; }
+ }
+
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("final")]
+ public XmlSchemaDerivationMethod Final
+ {
+ get{ return final; }
+ set{ final = value; }
+ }
+
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("fixed")]
+ public string FixedValue
+ {
+ get{ return fixedValue; }
+ set{ fixedValue = value; }
+ }
+ [DefaultValue(XmlSchemaForm.None)]
+ [System.Xml.Serialization.XmlAttribute("form")]
+ public XmlSchemaForm Form
+ {
+ get{ return form; }
+ set{ form = value; }
+ }
+
+ [DefaultValue(false)]
+ [System.Xml.Serialization.XmlAttribute("nillable")]
+ public bool IsNillable
+ {
+ get{ return isNillable; }
+ set{ isNillable = value; }
+ }
+
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name; }
+ set{ name = value; }
+ }
+ [System.Xml.Serialization.XmlAttribute("ref")]
+ public XmlQualifiedName RefName
+ {
+ get{ return refName; }
+ set{ refName = value;}
+ }
+
+ [System.Xml.Serialization.XmlAttribute("type")]
+ public XmlQualifiedName SchemaTypeName
+ {
+ get{ return schemaTypeName; }
+ set{ schemaTypeName = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("substitutionGroup")]
+ public XmlQualifiedName SubstitutionGroup
+ {
+ get{ return substitutionGroup; }
+ set{ substitutionGroup = value; }
+ }
+
+
+ #endregion
+
+ #region Elements
+
+ [XmlElement("unique",typeof(XmlSchemaUnique),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("key",typeof(XmlSchemaKey),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("keyref",typeof(XmlSchemaKeyref),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Constraints
+ {
+ get{ return constraints; }
+ }
+
+ [XmlElement("simpleType",typeof(XmlSchemaSimpleType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("complexType",typeof(XmlSchemaComplexType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaType SchemaType
+ {
+ get{ return schemaType; }
+ set{ schemaType = value; }
+ }
+
+ #endregion
+
+ #region XmlIgnore
+ [XmlIgnore]
+ public XmlSchemaDerivationMethod BlockResolved
+ {
+ get{ return blockResolved; }
+ }
+
+ [XmlIgnore]
+ public object ElementType
+ {
+ get{ return elementType; }
+ }
+
+ [XmlIgnore]
+ public XmlSchemaDerivationMethod FinalResolved
+ {
+ get{ return finalResolved; }
+ }
+
+ [XmlIgnore]
+ public XmlQualifiedName QualifiedName
+ {
+ get{ return qName; }
+ }
+
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs
new file mode 100755
index 00000000000..affa12a9833
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaEnumerationFacet.
+ /// </summary>
+ public class XmlSchemaEnumerationFacet : XmlSchemaFacet
+ {
+ public XmlSchemaEnumerationFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaException.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaException.cs
new file mode 100755
index 00000000000..6ef2ecee95d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaException.cs
@@ -0,0 +1,72 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Runtime.Serialization;
+
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaException.
+ /// </summary>
+ [Serializable]
+ public class XmlSchemaException : System.SystemException
+ {
+ //fields
+ private int lineNumber;
+ private int linePosition;
+ private XmlSchemaObject sourceObj;
+ private string sourceUri;
+
+ [MonoTODO]
+ protected XmlSchemaException(SerializationInfo info, StreamingContext context){}
+
+ protected XmlSchemaException(string message, int lineNumber, int linePosition,
+ XmlSchemaObject sourceObject, string sourceUri, Exception innerException)
+ : base(message, innerException)
+ {
+ this.lineNumber = lineNumber;
+ this.linePosition = linePosition;
+ this.sourceObj = sourceObject;
+ this.sourceUri = sourceUri;
+ }
+ protected XmlSchemaException(string message, XmlSchemaObject sourceObject,
+ Exception innerException)
+ : base(message, innerException)
+ {
+ this.lineNumber = sourceObject.LineNumber;
+ this.linePosition = sourceObject.LinePosition;
+ this.sourceObj = sourceObject;
+ this.sourceUri = sourceObject.SourceUri;
+ }
+
+ public XmlSchemaException(string message, Exception innerException)
+ : base(message,innerException){}
+
+ // Properties
+ public int LineNumber
+ {
+ get{ return this.lineNumber;}
+ }
+ public int LinePosition
+ {
+ get{ return this.linePosition;}
+ }
+ public override string Message
+ {
+ get{ return this.Message; }
+ }
+ public XmlSchemaObject SourceSchemaObject
+ {
+ get{ return this.sourceObj; }
+ }
+ public string SourceUri
+ {
+ get{ return this.sourceUri; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override void GetObjectData(SerializationInfo info, StreamingContext context){}
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaExternal.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaExternal.cs
new file mode 100755
index 00000000000..2f65395e84c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaExternal.cs
@@ -0,0 +1,49 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaExternal.
+ /// </summary>
+ public abstract class XmlSchemaExternal : XmlSchemaObject
+ {
+ private string id;
+ private XmlSchema schema;
+ private string location;
+ private XmlAttribute[] unhandledAttributes;
+
+ protected XmlSchemaExternal()
+ {}
+
+ [System.Xml.Serialization.XmlAttribute("id")]
+ public string Id
+ {
+ get{ return id; }
+ set{ id = value; }
+ }
+
+ [XmlIgnore]
+ public XmlSchema Schema
+ {
+ get{ return schema; }
+ set{ schema = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("schemaLocation")]
+ public string SchemaLocation
+ {
+ get{ return location; }
+ set{ location = value; }
+ }
+ [XmlAnyAttribute]
+ public XmlAttribute[] UnhandledAttributes
+ {
+ get{ return unhandledAttributes; }
+ set{ unhandledAttributes = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs
new file mode 100755
index 00000000000..ed684395714
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFacet.cs
@@ -0,0 +1,36 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaFacet.
+ /// </summary>
+ public abstract class XmlSchemaFacet : XmlSchemaAnnotated
+ {
+ private bool isFixed;
+ private string val;
+
+ protected XmlSchemaFacet()
+ {
+ val = string.Empty;
+ }
+ [DefaultValue(false)]
+ [System.Xml.Serialization.XmlAttribute("fixed")]
+ public virtual bool IsFixed
+ {
+ get{ return isFixed; }
+ set{ isFixed = value; }
+ }
+ [System.Xml.Serialization.XmlAttribute("value")]
+ public string Value
+ {
+ get{ return val; }
+ set{ val = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaForm.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaForm.cs
new file mode 100755
index 00000000000..8efb7e3d548
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaForm.cs
@@ -0,0 +1,19 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaForm.
+ /// </summary>
+ public enum XmlSchemaForm
+ {
+ [XmlIgnore]
+ None = 0x00000000,
+ [XmlEnum("qualified")]
+ Qualified = 0x00000001,
+ [XmlEnum("unqualified")]
+ Unqualified = 0x00000002,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs
new file mode 100755
index 00000000000..ae803fabd01
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaFractionDigitsFacet.
+ /// </summary>
+ public class XmlSchemaFractionDigitsFacet : XmlSchemaNumericFacet
+ {
+ public XmlSchemaFractionDigitsFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
new file mode 100755
index 00000000000..f7abc1f13b4
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
@@ -0,0 +1,36 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaGroup.
+ /// </summary>
+ public class XmlSchemaGroup : XmlSchemaAnnotated
+ {
+ private string name;
+ private XmlSchemaGroupBase particle;
+
+ public XmlSchemaGroup()
+ {
+ }
+
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name; }
+ set{ name = value; }
+ }
+
+ [XmlElement("all",typeof(XmlSchemaAll),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaGroupBase Particle
+ {
+ get{ return particle; }
+ set{ particle = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs
new file mode 100755
index 00000000000..6b56b478bab
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupBase.cs
@@ -0,0 +1,19 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaGroupBase.
+ /// </summary>
+ public abstract class XmlSchemaGroupBase : XmlSchemaParticle
+ {
+ protected XmlSchemaGroupBase()
+ {
+ }
+ [XmlIgnore]
+ public abstract XmlSchemaObjectCollection Items { get; }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
new file mode 100755
index 00000000000..f8b73c6f34a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
@@ -0,0 +1,31 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaGroupRef.
+ /// </summary>
+ public class XmlSchemaGroupRef : XmlSchemaParticle
+ {
+ private XmlSchemaGroupBase particle;
+ private XmlQualifiedName refName;
+ public XmlSchemaGroupRef()
+ {
+ }
+ [XmlIgnore]
+ public XmlSchemaGroupBase Particle
+ {
+ get{ return particle; }
+ }
+ [System.Xml.Serialization.XmlAttribute("ref")]
+ public XmlQualifiedName RefName
+ {
+ get{ return refName; }
+ set{ refName = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
new file mode 100755
index 00000000000..f7e20a7c184
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
@@ -0,0 +1,51 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaIdentityConstraint.
+ /// </summary>
+ public class XmlSchemaIdentityConstraint : XmlSchemaAnnotated
+ {
+ private XmlSchemaObjectCollection fields;
+ private string name;
+ private XmlQualifiedName qName;
+ private XmlSchemaXPath selector;
+
+ public XmlSchemaIdentityConstraint()
+ {
+ fields = new XmlSchemaObjectCollection();
+ qName = XmlQualifiedName.Empty;
+ }
+
+ [XmlElement("field",typeof(XmlSchemaXPath),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Fields
+ {
+ get{ return fields; }
+ }
+
+ [XmlElement("selector",typeof(XmlSchemaXPath),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaXPath Selector
+ {
+ get{ return selector; }
+ set{ selector = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name; }
+ set{ name = value; }
+ }
+
+ [XmlIgnore]
+ public XmlQualifiedName QualifiedName
+ {
+ get{ return qName; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaImport.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaImport.cs
new file mode 100755
index 00000000000..82798cacaf9
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaImport.cs
@@ -0,0 +1,33 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaImport.
+ /// </summary>
+ public class XmlSchemaImport : XmlSchemaExternal
+ {
+ private XmlSchemaAnnotation annotation;
+ private string nameSpace;
+ public XmlSchemaImport()
+ {
+ }
+
+ [XmlElement("annotation",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnnotation Annotation
+ {
+ get{ return annotation; }
+ set{ annotation = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("namespace")]
+ public string Namespace
+ {
+ get{ return nameSpace; }
+ set{ nameSpace = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaInclude.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaInclude.cs
new file mode 100755
index 00000000000..405af045a0b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaInclude.cs
@@ -0,0 +1,24 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaInclude.
+ /// </summary>
+ public class XmlSchemaInclude : XmlSchemaExternal
+ {
+ private XmlSchemaAnnotation annotation;
+ public XmlSchemaInclude()
+ {
+ }
+ [XmlElement("annotation",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnnotation Annotation
+ {
+ get{ return annotation; }
+ set{ annotation = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs
new file mode 100755
index 00000000000..f89c00594fc
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaKey.
+ /// </summary>
+ public class XmlSchemaKey : XmlSchemaIdentityConstraint
+ {
+ public XmlSchemaKey()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs
new file mode 100755
index 00000000000..cc3a06792ed
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs
@@ -0,0 +1,27 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaKeyref.
+ /// </summary>
+ public class XmlSchemaKeyref : XmlSchemaIdentityConstraint
+ {
+ private XmlQualifiedName refer;
+
+ public XmlSchemaKeyref()
+ {
+ }
+
+ [System.Xml.Serialization.XmlAttribute("refer")]
+ public XmlQualifiedName Refer
+ {
+ get{ return refer; }
+ set{ refer = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs
new file mode 100755
index 00000000000..45bee26c0f8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaLengthFacet.
+ /// </summary>
+ public class XmlSchemaLengthFacet : XmlSchemaNumericFacet
+ {
+ public XmlSchemaLengthFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs
new file mode 100755
index 00000000000..cbe57bfbc52
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMaxExclusiveFacet.
+ /// </summary>
+ public class XmlSchemaMaxExclusiveFacet : XmlSchemaFacet
+ {
+ public XmlSchemaMaxExclusiveFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs
new file mode 100755
index 00000000000..cfc74d5e7d4
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMaxInclusiveFacet.
+ /// </summary>
+ public class XmlSchemaMaxInclusiveFacet : XmlSchemaFacet
+ {
+ public XmlSchemaMaxInclusiveFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs
new file mode 100755
index 00000000000..efd12931081
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMaxLengthFacet.
+ /// </summary>
+ public class XmlSchemaMaxLengthFacet : XmlSchemaNumericFacet
+ {
+ public XmlSchemaMaxLengthFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs
new file mode 100755
index 00000000000..62b0156752a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMinExclusiveFacet.
+ /// </summary>
+ public class XmlSchemaMinExclusiveFacet : XmlSchemaFacet
+ {
+ public XmlSchemaMinExclusiveFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs
new file mode 100755
index 00000000000..5c76a0ecd30
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMinInclusiveFacet.
+ /// </summary>
+ public class XmlSchemaMinInclusiveFacet : XmlSchemaFacet
+ {
+ public XmlSchemaMinInclusiveFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs
new file mode 100755
index 00000000000..57cf2e35d1e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaMinLengthFacet.
+ /// </summary>
+ public class XmlSchemaMinLengthFacet : XmlSchemaNumericFacet
+ {
+ public XmlSchemaMinLengthFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs
new file mode 100755
index 00000000000..2320a909d6b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs
@@ -0,0 +1,39 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaNotation.
+ /// </summary>
+ public class XmlSchemaNotation : XmlSchemaAnnotated
+ {
+ private string name;
+ private string pub;
+ private string system;
+
+ public XmlSchemaNotation()
+ {
+ }
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name; }
+ set{ name = value; }
+ }
+ [System.Xml.Serialization.XmlAttribute("public")]
+ public string Public
+ {
+ get{ return pub; }
+ set{ pub = value; }
+ }
+ [System.Xml.Serialization.XmlAttribute("system")]
+ public string System
+ {
+ get{ return system; }
+ set{ system = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNumericFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNumericFacet.cs
new file mode 100755
index 00000000000..72359a71f16
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNumericFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaNumericFacet.
+ /// </summary>
+ public abstract class XmlSchemaNumericFacet : XmlSchemaFacet
+ {
+ protected XmlSchemaNumericFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
new file mode 100755
index 00000000000..b0485a2a519
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
@@ -0,0 +1,54 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaObject.
+ /// </summary>
+// [XmlInclude(typeof(XmlSchema)),
+// XmlInclude(typeof(XmlSchemaAnnotated)),
+// XmlInclude(typeof(XmlSchemaAnnotation)),
+// XmlInclude(typeof(XmlSchemaAppInfo)),
+// XmlInclude(typeof(XmlSchemaDocumentation)),
+// XmlInclude(typeof(XmlSchemaExternal))]
+ public abstract class XmlSchemaObject
+ {
+ private int lineNumber;
+ private int linePosition;
+ private string sourceUri;
+ private XmlSerializerNamespaces namespaces;
+
+ protected XmlSchemaObject()
+ {
+ }
+ [XmlIgnore]
+ public int LineNumber
+ {
+ get{ return lineNumber; }
+ set{ lineNumber = value; }
+ }
+ [XmlIgnore]
+ public int LinePosition
+ {
+ get{ return linePosition; }
+ set{ linePosition = value; }
+ }
+ [XmlIgnore]
+ public string SourceUri
+ {
+ get{ return sourceUri; }
+ set{ sourceUri = value; }
+ }
+
+ // Undocumented Property
+ [XmlNamespaceDeclarations]
+ public XmlSerializerNamespaces Namespaces
+ {
+ get{ return namespaces; }
+ set{ namespaces = value; }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectCollection.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectCollection.cs
new file mode 100755
index 00000000000..dade4c20cd4
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectCollection.cs
@@ -0,0 +1,82 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaObjectCollection.
+ /// </summary>
+ public class XmlSchemaObjectCollection : System.Collections.CollectionBase
+ {
+ private XmlSchemaObject parent;
+
+ public XmlSchemaObjectCollection()
+ {
+ }
+ public XmlSchemaObjectCollection(XmlSchemaObject parent)
+ {
+ this.parent = parent;
+ }
+
+ // Properties
+ public virtual XmlSchemaObject this[ int index ]
+ {
+ get
+ {
+ return (XmlSchemaObject) this.List[index];
+ }
+ set
+ {
+ this.List[index] = value;
+ }
+ }
+
+ // Methods
+ public int Add(XmlSchemaObject item)
+ {
+ return this.List.Add(item);
+ }
+
+ public bool Contains(XmlSchemaObject item)
+ {
+ return this.List.Contains(item);
+ }
+
+ public void CopyTo(XmlSchemaObject[] array, int index)
+ {
+ this.List.CopyTo(array,index);
+ }
+
+ [MonoTODO]
+ public new XmlSchemaObjectEnumerator GetEnumerator()
+ {
+ return (XmlSchemaObjectEnumerator) new object();
+ }
+
+ public int IndexOf(XmlSchemaObject item)
+ {
+ return this.List.IndexOf(item);
+ }
+
+ public void Insert(int index, XmlSchemaObject item)
+ {
+ this.List.Insert(index, item);
+ }
+
+ [MonoTODO]
+ protected override void OnClear(){}
+ [MonoTODO]
+ protected override void OnInsert(int index,object item){}
+ [MonoTODO]
+ protected override void OnRemove(int index,object item){}
+ [MonoTODO]
+ protected override void OnSet(int index,object oldValue,object newValue){}
+
+ public void Remove(XmlSchemaObject item)
+ {
+ this.List.Remove(item);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectEnumerator.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectEnumerator.cs
new file mode 100755
index 00000000000..7e7215d6cf8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectEnumerator.cs
@@ -0,0 +1,49 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaObjectEnumerator.
+ /// </summary>
+ public sealed class XmlSchemaObjectEnumerator : IEnumerator
+ {
+ private IDictionaryEnumerator xenum;
+ internal XmlSchemaObjectEnumerator(Hashtable htable)
+ {
+ this.xenum = htable.GetEnumerator();
+ }
+ // Properties
+ public XmlSchemaObject Current
+ {
+ get
+ {
+ return (XmlSchema) xenum.Current;
+ }
+ }
+ // Methods
+ public bool MoveNext()
+ {
+ return xenum.MoveNext();
+ }
+ public void Reset()
+ {
+ xenum.Reset();
+ }
+ //Explicit Interface implementation
+ bool IEnumerator.MoveNext()
+ {
+ return xenum.MoveNext();
+ }
+ void IEnumerator.Reset()
+ {
+ xenum.Reset();
+ }
+ object IEnumerator.Current
+ {
+ get{return (XmlSchema) xenum.Current;}
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs
new file mode 100755
index 00000000000..cd73d028676
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaObjectTable.cs
@@ -0,0 +1,46 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Collections;
+using System.Xml;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaObjectTable.
+ /// </summary>
+ public class XmlSchemaObjectTable
+ {
+ private Hashtable table;
+
+ internal XmlSchemaObjectTable()
+ {
+ table = new Hashtable();
+ }
+ public int Count
+ {
+ get{ return table.Count; }
+ }
+ public XmlSchemaObject this[XmlQualifiedName name]
+ {
+ get{ return (XmlSchemaObject) table[name]; }
+ }
+ public ICollection Names
+ {
+ get{ return table.Keys; }
+ }
+ public ICollection Values
+ {
+ get{ return table.Values;}
+ }
+
+ public bool Contains(XmlQualifiedName name)
+ {
+ return table.Contains(name);
+ }
+ public IDictionaryEnumerator GetEnumerator()
+ {
+ return table.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs
new file mode 100755
index 00000000000..2a3f38b86b8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs
@@ -0,0 +1,97 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaParticle.
+ /// </summary>
+ public abstract class XmlSchemaParticle : XmlSchemaAnnotated
+ {
+ decimal minOccurs, maxOccurs;
+ string minstr, maxstr;
+
+ protected XmlSchemaParticle()
+ {
+ minOccurs = decimal.One;
+ maxOccurs = decimal.One;
+ }
+
+ #region Attributes
+
+ [System.Xml.Serialization.XmlAttribute("maxOccurs")]
+ public string MaxOccursString
+ {
+ get{ return maxstr; }
+ set
+ {
+ if(value == "unbounded")
+ {
+ maxstr = value;
+ maxOccurs = decimal.MaxValue;
+ }
+ else
+ {
+ decimal val = decimal.Parse(value);
+ if(val >= 0 && (val == Decimal.Truncate(val)))
+ {
+ maxOccurs = val;
+ maxstr = value;
+ }
+ else
+ {
+ throw new XmlSchemaException
+ ("MaxOccurs must be a non-negative integer",null);
+ }
+ }
+ }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("minOccurs")]
+ public string MinOccursString
+ {
+ get{ return minstr; }
+ set
+ {
+ decimal val = decimal.Parse(value);
+ if(val >= 0 && (val == Decimal.Truncate(val)))
+ {
+ minOccurs = val;
+ minstr = value;
+ }
+ else
+ {
+ throw new XmlSchemaException
+ ("MinOccursString must be a non-negative number",null);
+ }
+ }
+ }
+
+ #endregion
+
+ #region XmlIgnore
+
+ [XmlIgnore]
+ public decimal MaxOccurs
+ {
+ get{ return maxOccurs; }
+ set
+ {
+ MaxOccursString = value.ToString();
+ }
+ }
+
+ [XmlIgnore]
+ public decimal MinOccurs
+ {
+ get{ return minOccurs; }
+ set
+ {
+ MinOccursString = value.ToString();
+ }
+ }
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs
new file mode 100755
index 00000000000..1450d885d12
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaPatternFacet.
+ /// </summary>
+ public class XmlSchemaPatternFacet : XmlSchemaFacet
+ {
+ public XmlSchemaPatternFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs
new file mode 100755
index 00000000000..29c358207a0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs
@@ -0,0 +1,47 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaRedefine.
+ /// </summary>
+ public class XmlSchemaRedefine : XmlSchemaExternal
+ {
+ private XmlSchemaObjectTable attributeGroups;
+ private XmlSchemaObjectTable groups;
+ private XmlSchemaObjectCollection items;
+ private XmlSchemaObjectTable schemaTypes;
+
+ public XmlSchemaRedefine()
+ {
+ }
+ [XmlIgnore]
+ public XmlSchemaObjectTable AttributeGroups
+ {
+ get{ return attributeGroups; }
+ }
+ [XmlIgnore]
+ public XmlSchemaObjectTable Groups
+ {
+ get{ return groups; }
+ }
+ [XmlElement("annotation",typeof(XmlSchemaAnnotation),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("simpleType",typeof(XmlSchemaSimpleType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("complexType",typeof(XmlSchemaComplexType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("group",typeof(XmlSchemaGroup),Namespace="http://www.w3.org/2001/XMLSchema")]
+ //NOTE: AttributeGroup and not AttributeGroupRef
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroup),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Items
+ {
+ get{ return items; }
+ }
+ [XmlIgnore]
+ public XmlSchemaObjectTable SchemaTypes
+ {
+ get{ return schemaTypes; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
new file mode 100755
index 00000000000..66295e2d2b1
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
@@ -0,0 +1,29 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSequence.
+ /// </summary>
+ public class XmlSchemaSequence : XmlSchemaGroupBase
+ {
+ private XmlSchemaObjectCollection items;
+ public XmlSchemaSequence()
+ {
+ items = new XmlSchemaObjectCollection();
+ }
+
+ [XmlElement("element",typeof(XmlSchemaElement),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("group",typeof(XmlSchemaGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("choice",typeof(XmlSchemaChoice),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("sequence",typeof(XmlSchemaSequence),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("any",typeof(XmlSchemaAny),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public override XmlSchemaObjectCollection Items
+ {
+ get{ return items; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
new file mode 100755
index 00000000000..827a37075c3
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
@@ -0,0 +1,27 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleContent.
+ /// </summary>
+ public class XmlSchemaSimpleContent : XmlSchemaContentModel
+ {
+ private XmlSchemaContent content;
+
+ public XmlSchemaSimpleContent()
+ {
+ }
+
+ [XmlElement("restriction",typeof(XmlSchemaSimpleContentRestriction),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("extension",typeof(XmlSchemaSimpleContentExtension),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public override XmlSchemaContent Content
+ {
+ get{ return content; }
+ set{ content = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
new file mode 100755
index 00000000000..eacb8c5bf16
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
@@ -0,0 +1,46 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleContentExtension.
+ /// </summary>
+ public class XmlSchemaSimpleContentExtension : XmlSchemaContent
+ {
+
+ private XmlSchemaAnyAttribute any;
+ private XmlSchemaObjectCollection attributes;
+ private XmlQualifiedName baseTypeName;
+
+ public XmlSchemaSimpleContentExtension()
+ {
+ baseTypeName = XmlQualifiedName.Empty;
+ attributes = new XmlSchemaObjectCollection();
+ }
+
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return any; }
+ set{ any = value; }
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("base")]
+ public XmlQualifiedName BaseTypeName
+ {
+ get{ return baseTypeName; }
+ set{ baseTypeName = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
new file mode 100755
index 00000000000..98e6bb7afd1
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
@@ -0,0 +1,74 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleContentRestriction.
+ /// </summary>
+ public class XmlSchemaSimpleContentRestriction : XmlSchemaContent
+ {
+
+ private XmlSchemaAnyAttribute any;
+ private XmlSchemaObjectCollection attributes;
+ private XmlSchemaSimpleType baseType;
+ private XmlQualifiedName baseTypeName;
+ private XmlSchemaObjectCollection facets;
+
+ public XmlSchemaSimpleContentRestriction()
+ {
+ baseTypeName = XmlQualifiedName.Empty;
+ attributes = new XmlSchemaObjectCollection();
+ facets = new XmlSchemaObjectCollection();
+ }
+
+ [System.Xml.Serialization.XmlAttribute("base")]
+ public XmlQualifiedName BaseTypeName
+ {
+ get{ return baseTypeName; }
+ set{ baseTypeName = value; }
+ }
+
+ [XmlElement("anyAttribute",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaAnyAttribute AnyAttribute
+ {
+ get{ return any; }
+ set{ any = value; }
+ }
+
+ [XmlElement("attribute",typeof(XmlSchemaAttribute),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("attributeGroup",typeof(XmlSchemaAttributeGroupRef),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Attributes
+ {
+ get{ return attributes; }
+ }
+
+ [XmlElement("simpleType",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaSimpleType BaseType
+ {
+ get{ return baseType; }
+ set{ baseType = value; }
+ }
+
+
+ [XmlElement("minExclusive",typeof(XmlSchemaMinExclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("minInclusive",typeof(XmlSchemaMinInclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxExclusive",typeof(XmlSchemaMaxExclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxInclusive",typeof(XmlSchemaMaxInclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("totalDigits",typeof(XmlSchemaTotalDigitsFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("fractionDigits",typeof(XmlSchemaFractionDigitsFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("length",typeof(XmlSchemaLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("minLength",typeof(XmlSchemaMinLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxLength",typeof(XmlSchemaMaxLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("enumeration",typeof(XmlSchemaEnumerationFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("whiteSpace",typeof(XmlSchemaWhiteSpaceFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("pattern",typeof(XmlSchemaPatternFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Facets
+ {
+ get{ return facets; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
new file mode 100755
index 00000000000..cd4ffaf62b6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
@@ -0,0 +1,28 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleType.
+ /// </summary>
+ public class XmlSchemaSimpleType : XmlSchemaType
+ {
+ private XmlSchemaSimpleTypeContent content;
+
+ public XmlSchemaSimpleType()
+ {
+ }
+
+ [XmlElement("restriction",typeof(XmlSchemaSimpleTypeRestriction),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("list",typeof(XmlSchemaSimpleTypeList),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("union",typeof(XmlSchemaSimpleTypeUnion),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaSimpleTypeContent Content
+ {
+ get{ return content; }
+ set{ content = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs
new file mode 100755
index 00000000000..6068361768c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeContent.cs
@@ -0,0 +1,17 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleTypeContent.
+ /// </summary>
+ public abstract class XmlSchemaSimpleTypeContent : XmlSchemaAnnotated
+ {
+ protected XmlSchemaSimpleTypeContent()
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
new file mode 100755
index 00000000000..560e3551eba
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
@@ -0,0 +1,43 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleTypeList.
+ /// </summary>
+ public class XmlSchemaSimpleTypeList : XmlSchemaSimpleTypeContent
+ {
+ private XmlSchemaSimpleType itemType;
+ private XmlQualifiedName itemTypeName;
+
+ public XmlSchemaSimpleTypeList()
+ {}
+
+ [XmlElement("simpleType",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaSimpleType ItemType
+ {
+ get{ return itemType; }
+ set
+ {
+ itemType = value;
+ itemTypeName = null;
+ }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("itemType")]
+ public XmlQualifiedName ItemTypeName
+ {
+ get{ return itemTypeName; }
+ set
+ {
+ itemTypeName = value;
+ itemType = null;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
new file mode 100755
index 00000000000..fb764b71b2e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
@@ -0,0 +1,54 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleTypeRestriction.
+ /// </summary>
+ public class XmlSchemaSimpleTypeRestriction : XmlSchemaSimpleTypeContent
+ {
+ private XmlSchemaSimpleType baseType;
+ private XmlQualifiedName baseTypeName;
+ private XmlSchemaObjectCollection facets;
+ public XmlSchemaSimpleTypeRestriction()
+ {
+ facets = new XmlSchemaObjectCollection();
+ }
+
+ [XmlElement("simpleType",Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaSimpleType BaseType
+ {
+ get{ return baseType; }
+ set{ baseType = value; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("base")]
+ public XmlQualifiedName BaseTypeName
+ {
+ get{ return baseTypeName; }
+ set{ baseTypeName = value; }
+ }
+
+ [XmlElement("minExclusive",typeof(XmlSchemaMinExclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("minInclusive",typeof(XmlSchemaMinInclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxExclusive",typeof(XmlSchemaMaxExclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxInclusive",typeof(XmlSchemaMaxInclusiveFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("totalDigits",typeof(XmlSchemaTotalDigitsFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("fractionDigits",typeof(XmlSchemaFractionDigitsFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("length",typeof(XmlSchemaLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("minLength",typeof(XmlSchemaMinLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("maxLength",typeof(XmlSchemaMaxLengthFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("enumeration",typeof(XmlSchemaEnumerationFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("whiteSpace",typeof(XmlSchemaWhiteSpaceFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ [XmlElement("pattern",typeof(XmlSchemaPatternFacet),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection Facets
+ {
+ get{ return facets; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
new file mode 100755
index 00000000000..bca18331f88
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
@@ -0,0 +1,35 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaSimpleTypeUnion.
+ /// </summary>
+ public class XmlSchemaSimpleTypeUnion : XmlSchemaSimpleTypeContent
+ {
+ private XmlSchemaObjectCollection baseTypes;
+ private XmlQualifiedName[] memberTypes;
+
+ public XmlSchemaSimpleTypeUnion()
+ {
+ baseTypes = new XmlSchemaObjectCollection();
+ }
+
+ [XmlElement("simpleType",typeof(XmlSchemaSimpleType),Namespace="http://www.w3.org/2001/XMLSchema")]
+ public XmlSchemaObjectCollection BaseTypes
+ {
+ get{ return baseTypes; }
+ }
+
+ [System.Xml.Serialization.XmlAttribute("memberTypes")]
+ public XmlQualifiedName[] MemberTypes
+ {
+ get{ return memberTypes; }
+ set{ memberTypes = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs
new file mode 100755
index 00000000000..c6dadbdc27f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaTotalDigitsFacet.
+ /// </summary>
+ public class XmlSchemaTotalDigitsFacet : XmlSchemaNumericFacet
+ {
+ public XmlSchemaTotalDigitsFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
new file mode 100755
index 00000000000..24009448e24
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
@@ -0,0 +1,80 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml;
+using System.ComponentModel;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaType.
+ /// </summary>
+ [XmlInclude(typeof(XmlSchemaSimpleType))]
+ public class XmlSchemaType : XmlSchemaAnnotated
+ {
+ private object baseSchemaType;
+ private XmlSchemaDatatype datatype;
+ private XmlSchemaDerivationMethod derivedBy;
+ private XmlSchemaDerivationMethod final;
+ private XmlSchemaDerivationMethod finalResolved;
+ private bool isMixed;
+ private string name;
+ private XmlQualifiedName qName;
+
+ public XmlSchemaType()
+ {
+ final = XmlSchemaDerivationMethod.None;
+ }
+
+ #region Attributes
+ [System.Xml.Serialization.XmlAttribute("name")]
+ public string Name
+ {
+ get{ return name; }
+ set{ name = value; }
+ }
+ [DefaultValue(XmlSchemaDerivationMethod.None)]
+ [System.Xml.Serialization.XmlAttribute("final")]
+ public XmlSchemaDerivationMethod Final
+ {
+ get{ return final; }
+ set{ final = value; }
+ }
+ #endregion
+
+ #region XmlIgnore
+ [XmlIgnore]
+ public object BaseSchemaType
+ {
+ get{ return baseSchemaType; }
+ }
+ [XmlIgnore]
+ public XmlSchemaDatatype Datatype
+ {
+ get{ return datatype; }
+ }
+ [XmlIgnore]
+ public XmlSchemaDerivationMethod DerivedBy
+ {
+ get{ return derivedBy; }
+ }
+ [XmlIgnore]
+ public XmlSchemaDerivationMethod FinalResolved
+ {
+ get{ return finalResolved; }
+ }
+ [XmlIgnore]
+ public virtual bool IsMixed
+ {
+ get{ return isMixed; }
+ set{ isMixed = value; }
+ }
+ [XmlIgnore]
+ public XmlQualifiedName QualifiedName
+ {
+ get{ return qName; }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs
new file mode 100755
index 00000000000..82465500e59
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaUnique.
+ /// </summary>
+ public class XmlSchemaUnique : XmlSchemaIdentityConstraint
+ {
+ public XmlSchemaUnique()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUse.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUse.cs
new file mode 100755
index 00000000000..8015edd8ed2
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaUse.cs
@@ -0,0 +1,22 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaUse.
+ /// </summary>
+ public enum XmlSchemaUse
+ {
+ [XmlIgnore]
+ None = 0x00000000,
+ [XmlEnum("optional")]
+ Optional = 0x00000001,
+ [XmlEnum("prohibited")]
+ Prohibited = 0x00000002,
+ [XmlEnum("required")]
+ Required = 0x00000003,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs
new file mode 100755
index 00000000000..ada39ae1370
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs
@@ -0,0 +1,16 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaWhiteSpaceFacet.
+ /// </summary>
+ public class XmlSchemaWhiteSpaceFacet : XmlSchemaFacet
+ {
+ public XmlSchemaWhiteSpaceFacet()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs
new file mode 100755
index 00000000000..6f3d7c77c19
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs
@@ -0,0 +1,27 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSchemaXPath.
+ /// </summary>
+ public class XmlSchemaXPath : XmlSchemaAnnotated
+ {
+ private string xpath;
+
+ public XmlSchemaXPath()
+ {
+ }
+ [DefaultValue(null)]
+ [System.Xml.Serialization.XmlAttribute("xpath")]
+ public string XPath
+ {
+ get{ return xpath; }
+ set{ xpath = value; }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSeverityType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSeverityType.cs
new file mode 100755
index 00000000000..f16d15967e8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSeverityType.cs
@@ -0,0 +1,15 @@
+// Author: Dwivedi, Ajay kumar
+// Adwiv@Yahoo.com
+using System;
+
+namespace System.Xml.Schema
+{
+ /// <summary>
+ /// Summary description for XmlSeverityType.
+ /// </summary>
+ public enum XmlSeverityType
+ {
+ Error = 0x00000000,
+ Warning = 0x00000001,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/AssemblyInfo.cs b/mcs/class/System.XML/System.Xml.Serialization/AssemblyInfo.cs
new file mode 100644
index 00000000000..177a4f0e70a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/AssemblyInfo.cs
@@ -0,0 +1,58 @@
+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("")]
+
+//
+// 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.XML/System.Xml.Serialization/SoapAttributeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributeAttribute.cs
new file mode 100644
index 00000000000..1030d4b668c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributeAttribute.cs
@@ -0,0 +1,61 @@
+//
+// SoapAttributeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapAttributeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class SoapAttributeAttribute : Attribute
+ {
+ private string attrName;
+ private string dataType;
+ private string ns;
+
+ public SoapAttributeAttribute ()
+ {
+ }
+
+ public SoapAttributeAttribute (string attrName)
+ {
+ AttrName = attrName;
+ }
+
+ public string AttrName {
+ get {
+ return attrName;
+ }
+ set {
+ attrName = value;
+ }
+ }
+
+ public string DataType {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+
+ public string Namespace {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapAttributeOverrides.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributeOverrides.cs
new file mode 100644
index 00000000000..54459a2dbae
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributeOverrides.cs
@@ -0,0 +1,50 @@
+//
+// SoapAttributeOverrides.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapAttributeOverrides.
+ /// </summary>
+ public class SoapAttributeOverrides
+ {
+ public SoapAttributeOverrides ()
+ {
+ }
+
+ [MonoTODO]
+ public SoapAttributes this [Type type]
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public SoapAttributes this [Type type, string member] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public void Add (Type type, SoapAttributes attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void Add (Type type, string member, SoapAttributes attributes)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapAttributes.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributes.cs
new file mode 100644
index 00000000000..978b5eb28d2
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapAttributes.cs
@@ -0,0 +1,52 @@
+//
+// SoapAttributes.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Reflection;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapAttributes.
+ /// </summary>
+ public class SoapAttributes
+ {
+ private SoapAttributeAttribute soapAttribute;
+ private object soapDefaultValue;
+
+ public SoapAttributes ()
+ {
+ }
+
+ [MonoTODO]
+ public SoapAttributes (ICustomAttributeProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public SoapAttributeAttribute SoapAttribute
+ {
+ get {
+ return soapAttribute;
+ }
+ set {
+ soapAttribute = value;
+ }
+ }
+ public object SoapDefaultValue {
+ get {
+ return soapDefaultValue;
+ }
+ set {
+ soapDefaultValue = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapElementAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapElementAttribute.cs
new file mode 100644
index 00000000000..fbb6527e821
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapElementAttribute.cs
@@ -0,0 +1,60 @@
+//
+// SoapElementAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapElementAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class SoapElementAttribute : Attribute
+ {
+ private string dataType;
+ private string elementName;
+ private bool isNullable;
+
+ public SoapElementAttribute ()
+ {
+ }
+ public SoapElementAttribute (string elementName)
+ {
+ ElementName = elementName;
+ }
+
+ public string DataType {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+
+ public string ElementName {
+ get {
+ return elementName;
+ }
+ set {
+ elementName = value;
+ }
+ }
+
+ public bool IsNullable {
+ get {
+ return isNullable;
+ }
+ set {
+ isNullable = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapEnumAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapEnumAttribute.cs
new file mode 100644
index 00000000000..fba4f311126
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapEnumAttribute.cs
@@ -0,0 +1,40 @@
+//
+// SoapEnumAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapEnumAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Field)]
+ public class SoapEnumAttribute : Attribute
+ {
+ private string name;
+
+ public SoapEnumAttribute ()
+ {
+ }
+
+ public SoapEnumAttribute (string name)
+ {
+ Name = name;
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapIgnoreAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapIgnoreAttribute.cs
new file mode 100644
index 00000000000..52798f1dd30
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapIgnoreAttribute.cs
@@ -0,0 +1,25 @@
+//
+// SoapIgnoreAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapIgnoreAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class SoapIgnoreAttribute : Attribute
+ {
+ public SoapIgnoreAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapIncludeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapIncludeAttribute.cs
new file mode 100644
index 00000000000..86f21c0b2db
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapIncludeAttribute.cs
@@ -0,0 +1,41 @@
+//
+// SoapIncludeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapIncludeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Method)]
+ public class SoapIncludeAttribute : Attribute
+ {
+ private Type type;
+
+ public SoapIncludeAttribute ()
+ {
+ }
+ public SoapIncludeAttribute( Type type)
+ {
+ Type = type;
+ }
+
+ public Type Type
+ {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/SoapTypeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/SoapTypeAttribute.cs
new file mode 100644
index 00000000000..cbea83cfd2c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/SoapTypeAttribute.cs
@@ -0,0 +1,52 @@
+//
+// SoapTypeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for SoapTypeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Enum | AttributeTargets.Interface)]
+ public class SoapTypeAttribute : Attribute
+ {
+ private string ns;
+ private string typeName;
+
+ public SoapTypeAttribute ()
+ {
+ }
+ public SoapTypeAttribute (string typeName)
+ {
+ TypeName = typeName;
+ }
+ public SoapTypeAttribute (string typeName, string ns)
+ {
+ TypeName = typeName;
+ Namespace = ns;
+ }
+
+ public string Namespace {
+ get { return ns;
+ }
+ set { ns = value;
+ }
+ }
+ public string TypeName {
+ get { return typeName;
+ }
+ set { typeName = value;
+ }
+ }
+
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/TODOAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/TODOAttribute.cs
new file mode 100644
index 00000000000..741cd760c1f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/TODOAttribute.cs
@@ -0,0 +1,32 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Xml {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventArgs.cs b/mcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventArgs.cs
new file mode 100644
index 00000000000..b501cb5fea0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/UnreferencedObjectEventArgs.cs
@@ -0,0 +1,35 @@
+//
+// UnreferencedObjectEventArgs.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for UnreferencedObjectEventArgs.
+ /// </summary>
+ public class UnreferencedObjectEventArgs : EventArgs
+ {
+ private object unreferencedObject;
+ private string unreferencedId;
+
+ public UnreferencedObjectEventArgs(object o, string id)
+ {
+ unreferencedObject = o;
+ unreferencedId = id;
+ }
+
+ public string UnreferencedId {
+ get{ return unreferencedId; }
+ }
+ public object UnreferencedObject {
+ get{ return unreferencedObject; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAnyAttributeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyAttributeAttribute.cs
new file mode 100644
index 00000000000..6569e736c12
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyAttributeAttribute.cs
@@ -0,0 +1,30 @@
+//
+// XmlAnyAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAnyAttributeAttribute.
+ /// </summary>
+ ///
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlAnyAttributeAttribute : Attribute
+ {
+
+ public XmlAnyAttributeAttribute()
+ {
+
+ }
+
+ //public virtual object TypeId {get;}
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttribute.cs
new file mode 100644
index 00000000000..8222a5bcf4c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttribute.cs
@@ -0,0 +1,57 @@
+//
+// filename.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAnyElementAttribute.
+ /// </summary>
+ ///
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlAnyElementAttribute : Attribute
+ {
+ private string elementName;
+ private string ns;
+
+ public XmlAnyElementAttribute ()
+ {
+ }
+
+ public XmlAnyElementAttribute (string name)
+ {
+ elementName = name;
+ }
+
+ public XmlAnyElementAttribute (string name, string ns)
+ {
+ elementName = name;
+ Namespace = ns;
+ }
+
+ public string Name {
+ get {
+ return elementName;
+ }
+ set {
+ elementName = value;
+ }
+ }
+ public string Namespace {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttributes.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttributes.cs
new file mode 100644
index 00000000000..db716a4f592
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAnyElementAttributes.cs
@@ -0,0 +1,61 @@
+//
+// XmlAnyElementAttributes.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml;
+using System.Xml.Serialization;
+using System.Collections;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAnyElementAttributes.
+ /// </summary>
+ public class XmlAnyElementAttributes : CollectionBase
+ {
+
+ public XmlAnyElementAttribute this[int index]
+ {
+ get
+ {
+ return (XmlAnyElementAttribute)List[index];
+ }
+ set
+ {
+ List[index] = value;
+ }
+ }
+
+ public int Add(XmlAnyElementAttribute attribute)
+ {
+ return List.Add(attribute);
+ }
+
+ public bool Contains(XmlAnyElementAttribute attribute)
+ {
+ return List.Contains(attribute);
+ }
+
+ public int IndexOf(XmlAnyElementAttribute attribute)
+ {
+ return List.IndexOf(attribute);
+ }
+
+ public void Insert(int index, XmlAnyElementAttribute attribute)
+ {
+ List.Insert(index, attribute);
+ }
+
+ public void Remove(XmlAnyElementAttribute attribute)
+ {
+ List.Remove(attribute);
+ }
+ }
+
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlArrayAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayAttribute.cs
new file mode 100644
index 00000000000..52d53612f6f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayAttribute.cs
@@ -0,0 +1,81 @@
+//
+// XmlArrayAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml.Schema;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlArrayAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlArrayAttribute : Attribute
+ {
+ private string elementName;
+ private XmlSchemaForm form;
+ private bool isNullable;
+ private string ns;
+
+ public XmlArrayAttribute()
+ {
+ }
+
+ public XmlArrayAttribute(string elementName)
+ {
+ ElementName = elementName;
+ }
+
+ public string ElementName
+ {
+ get
+ {
+ return elementName;
+ }
+ set
+ {
+ elementName = value;
+ }
+ }
+ public XmlSchemaForm Form
+ {
+ get
+ {
+ return form;
+ }
+ set
+ {
+ form = value;
+ }
+ }
+ public bool IsNullable
+ {
+ get
+ {
+ return isNullable;
+ }
+ set
+ {
+ isNullable = value;
+ }
+ }
+ public string Namespace
+ {
+ get
+ {
+ return ns;
+ }
+ set
+ {
+ ns = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttribute.cs
new file mode 100644
index 00000000000..d72c06322cb
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttribute.cs
@@ -0,0 +1,76 @@
+//
+// XmlArrayItemAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml.Schema;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlArrayItemAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlArrayItemAttribute : Attribute
+ {
+ private string dataType;
+ private string elementName;
+ private XmlSchemaForm form;
+ private string ns;
+ private bool isNullable;
+ private int nestingLevel;
+ private Type type;
+
+ public XmlArrayItemAttribute ()
+ {
+ }
+ public XmlArrayItemAttribute (string elementName)
+ {
+ ElementName = elementName;
+ }
+ public XmlArrayItemAttribute (Type type)
+ {
+ Type = type;
+ }
+ public XmlArrayItemAttribute (string elementName, Type type)
+ {
+ ElementName = elementName;
+ Type = type;
+ }
+
+ public string DataType {
+ get { return dataType; }
+ set { dataType = value; }
+ }
+ public string ElementName {
+ get { return elementName; }
+ set { elementName = value; }
+ }
+ public XmlSchemaForm Form {
+ get { return form; }
+ set { form = value; }
+ }
+ public string Namespace {
+ get { return ns; }
+ set { ns = value; }
+ }
+ public bool IsNullable {
+ get { return isNullable; }
+ set { isNullable = value; }
+ }
+ public Type Type {
+ get { return type; }
+ set { type = value; }
+ }
+ public int NestingLevel {
+ get { return nestingLevel; }
+ set { nestingLevel = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttributes.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttributes.cs
new file mode 100644
index 00000000000..2a500889b2a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlArrayItemAttributes.cs
@@ -0,0 +1,37 @@
+//
+// XmlArrayItemAttributes.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml.Serialization;
+using System.Collections;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlArrayItemAttributes.
+ /// </summary>
+ public class XmlArrayItemAttributes : CollectionBase
+ {
+
+ public XmlArrayItemAttribute this [int index] {
+ get {
+ return (XmlArrayItemAttribute)List [index];
+ }
+ set {
+ List [index] = value;
+ }
+ }
+
+ public int Add (XmlArrayItemAttribute attribute)
+ {
+ return List.Add(attribute);
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs
new file mode 100644
index 00000000000..df54c7b467e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeAttribute.cs
@@ -0,0 +1,78 @@
+//
+// XmlAttributeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml.Schema;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAttributeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlAttributeAttribute : Attribute
+ {
+ private string attributeName;
+ private string dataType;
+ private XmlSchemaForm form;
+ private string ns;
+
+ public XmlAttributeAttribute ()
+ {
+ }
+ public XmlAttributeAttribute (string attributeName)
+ {
+ AttributeName = attributeName;
+ }
+ [MonoTODO]
+ public XmlAttributeAttribute (Type type)
+ {
+ }
+ [MonoTODO]
+ public XmlAttributeAttribute (string attributeName, Type type)
+ {
+ AttributeName = attributeName;
+ }
+
+ public string AttributeName {
+ get {
+ return attributeName;
+ }
+ set {
+ attributeName = value;
+ }
+ }
+ public string DataType {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+ public XmlSchemaForm Form {
+ get {
+ return form;
+ }
+ set {
+ form = value;
+ }
+ }
+ public string Namespace {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventArgs.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventArgs.cs
new file mode 100644
index 00000000000..376ad55187c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeEventArgs.cs
@@ -0,0 +1,38 @@
+//
+// XmlAttributeEventArgs.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAttributeEventArgs.
+ /// </summary>
+ public class XmlAttributeEventArgs : EventArgs
+ {
+ [MonoTODO]
+ public XmlAttribute Attr {
+ get { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public int LineNumber {
+ get { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public int LinePosition {
+ get { throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public object ObjectBeingDeserialized {
+ get{ throw new NotImplementedException(); }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeOverrides.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeOverrides.cs
new file mode 100644
index 00000000000..745af8a7efe
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributeOverrides.cs
@@ -0,0 +1,44 @@
+//
+// XmlAttributeOverrides.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAttributeOverrides.
+ /// </summary>
+ public class XmlAttributeOverrides
+ {
+
+ public XmlAttributes this[Type type]
+ {
+ [MonoTODO]
+ get{ throw new NotImplementedException (); }
+ }
+
+ public XmlAttributes this[Type type, string member]
+ {
+ [MonoTODO]
+ get{ throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public void Add (Type type, XmlAttributes attributes)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Add( Type type, string member, XmlAttributes attributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlAttributes.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributes.cs
new file mode 100644
index 00000000000..233018488c0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlAttributes.cs
@@ -0,0 +1,152 @@
+//
+// XmlAttributes.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Reflection;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlAttributes.
+ /// </summary>
+ public class XmlAttributes
+ {
+ private XmlAnyAttributeAttribute xmlAnyAttribute;
+ private XmlAnyElementAttributes xmlAnyElements;
+ private XmlArrayAttribute xmlArray;
+ private XmlArrayItemAttributes xmlArrayItems;
+ private XmlAttributeAttribute xmlAttribute;
+ private XmlChoiceIdentifierAttribute xmlChoiceIdentifier;
+ private object xmlDefaultValue;
+ private XmlElementAttributes xmlElements;
+ private XmlEnumAttribute xmlEnum;
+ private bool xmlIgnore;
+ private bool xmlns;
+ private XmlRootAttribute xmlRoot;
+ private XmlTextAttribute xmlText;
+ private XmlTypeAttribute xmlType;
+
+ public XmlAttributes ()
+ {
+ xmlAnyElements = new XmlAnyElementAttributes ();
+ xmlArrayItems = new XmlArrayItemAttributes ();
+ xmlElements = new XmlElementAttributes ();
+ }
+
+ [MonoTODO]
+ public XmlAttributes (ICustomAttributeProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public XmlAnyAttributeAttribute XmlAnyAttribute {
+ get {
+ return xmlAnyAttribute;
+ }
+ set {
+ xmlAnyAttribute = value;
+ }
+ }
+ public XmlAnyElementAttributes XmlAnyElements {
+ get {
+ return xmlAnyElements;
+ }
+ }
+ public XmlArrayAttribute XmlArray {
+ get {
+ return xmlArray;
+ }
+ set {
+ xmlArray = value;
+ }
+ }
+ public XmlArrayItemAttributes XmlArrayItems {
+ get {
+ return xmlArrayItems;
+ }
+ }
+ public XmlAttributeAttribute XmlAttribute {
+ get {
+ return xmlAttribute;
+ }
+ set {
+ xmlAttribute = value;
+ }
+ }
+ public XmlChoiceIdentifierAttribute XmlChoiceIdentifier {
+ get {
+ return xmlChoiceIdentifier;
+ }
+ set {
+ xmlChoiceIdentifier = value;
+ }
+ }
+ public object XmlDefaultValue {
+ get {
+ return xmlDefaultValue;
+ }
+ set {
+ xmlDefaultValue = value;
+ }
+ }
+ public XmlElementAttributes XmlElements {
+ get {
+ return xmlElements;
+ }
+ }
+ public XmlEnumAttribute XmlEnum {
+ get {
+ return xmlEnum;
+ }
+ set {
+ xmlEnum = value;
+ }
+ }
+ public bool XmlIgnore {
+ get {
+ return xmlIgnore;
+ }
+ set {
+ xmlIgnore = value;
+ }
+ }
+ public bool Xmlns {
+ get {
+ return xmlns;
+ }
+ set {
+ xmlns = value;
+ }
+ }
+ public XmlRootAttribute XmlRoot {
+ get {
+ return xmlRoot;}
+ set {
+ xmlRoot = value;
+ }
+ }
+ public XmlTextAttribute XmlText {
+ get {
+ return xmlText;
+ }
+ set {
+ xmlText = value;
+ }
+ }
+ public XmlTypeAttribute XmlType {
+ get {
+ return xmlType;
+ }
+ set {
+ xmlType = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlChoiceIdentifierAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlChoiceIdentifierAttribute.cs
new file mode 100644
index 00000000000..08d2aba86ef
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlChoiceIdentifierAttribute.cs
@@ -0,0 +1,41 @@
+//
+// XmlChoiceIdentifierAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlChoiceIdentifierAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlChoiceIdentifierAttribute : Attribute
+ {
+ private string memberName;
+
+ public XmlChoiceIdentifierAttribute ()
+ {
+ }
+ public XmlChoiceIdentifierAttribute (string name)
+ {
+ MemberName = name;
+ }
+
+ public string MemberName {
+ get {
+ return memberName;
+ }
+ set {
+ memberName = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttribute.cs
new file mode 100644
index 00000000000..0b192e4ca20
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttribute.cs
@@ -0,0 +1,95 @@
+//
+// XmlElementAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml.Schema;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlElementAttribute.
+ /// </summary
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlElementAttribute : Attribute
+ {
+ private string dataType;
+ private string elementName;
+ private XmlSchemaForm form;
+ private string ns;
+ private bool isNullable;
+ private Type type;
+
+ public XmlElementAttribute ()
+ {
+ }
+ public XmlElementAttribute (string elementName)
+ {
+ ElementName = elementName;
+ }
+ public XmlElementAttribute (Type type)
+ {
+ Type = type;
+ }
+ public XmlElementAttribute (string elementName, Type type)
+ {
+ ElementName = elementName;
+ Type = type;
+ }
+
+ public string DataType {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+ public string ElementName {
+ get {
+ return elementName;
+ }
+ set {
+ elementName = value;
+ }
+ }
+ public XmlSchemaForm Form {
+ get {
+ return form;
+ }
+ set {
+ form = value;
+ }
+ }
+ public string Namespace {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+ public bool IsNullable {
+ get {
+ return isNullable;
+ }
+ set {
+ isNullable = value;
+ }
+ }
+ public Type Type {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttributes.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttributes.cs
new file mode 100644
index 00000000000..826ad32910c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlElementAttributes.cs
@@ -0,0 +1,34 @@
+//
+// XmlElementAttributes.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Collections;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlElementAttributes.
+ /// </summary>
+ public class XmlElementAttributes : CollectionBase
+ {
+ public XmlElementAttribute this [int index] {
+ get {
+ return (XmlElementAttribute)List [index];
+ }
+ set {
+ List [index] = value;
+ }
+ }
+
+ public int Add (XmlElementAttribute attribute)
+ {
+ return List.Add (attribute);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlElementEventArgs.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlElementEventArgs.cs
new file mode 100644
index 00000000000..6a3f2f36edb
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlElementEventArgs.cs
@@ -0,0 +1,37 @@
+//
+// XmlElementEventArgs.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlElementEventArgs.
+ /// </summary>
+ public class XmlElementEventArgs : EventArgs
+ {
+ [MonoTODO]
+ public XmlElement Element {
+ get{ throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public int LineNumber {
+ get{ throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public int LinePosition {
+ get{ throw new NotImplementedException(); }
+ }
+ [MonoTODO]
+ public object ObjectBeingDeserialized {
+ get{ throw new NotImplementedException(); }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlEnumAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlEnumAttribute.cs
new file mode 100644
index 00000000000..e95087c09fb
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlEnumAttribute.cs
@@ -0,0 +1,41 @@
+//
+// XmlEnumAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlEnumAttribute.
+ /// </summary>\
+ [AttributeUsage(AttributeTargets.Field)]
+ public class XmlEnumAttribute : Attribute
+ {
+ private string name;
+
+ public XmlEnumAttribute ()
+ {
+ }
+
+ public XmlEnumAttribute (string name)
+ {
+ Name = name;
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlIgnoreAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlIgnoreAttribute.cs
new file mode 100644
index 00000000000..cb0fe82ba33
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlIgnoreAttribute.cs
@@ -0,0 +1,26 @@
+//
+// XmlIgnoreAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlIgnoreAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlIgnoreAttribute : Attribute
+ {
+ public XmlIgnoreAttribute ()
+ {
+
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlIncludeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlIncludeAttribute.cs
new file mode 100644
index 00000000000..e7eafcdf4cc
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlIncludeAttribute.cs
@@ -0,0 +1,37 @@
+//
+// XmlIncludeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlIncludeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Method)]
+ public class XmlIncludeAttribute : Attribute
+ {
+ private Type type;
+
+ public XmlIncludeAttribute (Type type)
+ {
+ Type = type;
+ }
+
+ public Type Type {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlMapping.cs
new file mode 100644
index 00000000000..3374278e72b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlMapping.cs
@@ -0,0 +1,43 @@
+//
+// XmlMapping.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlMapping.
+ /// </summary>
+ public abstract class XmlMapping
+ {
+ private string elementName;
+ private string ns;
+ private string typeName;
+
+ public XmlMapping ()
+ {
+ }
+
+ public string ElementName {
+ get {
+ return elementName;
+ }
+ }
+ public string Namespace {
+ get {
+ return ns;
+ }
+ }
+ public string TypeName {
+ get {
+ return typeName;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlNamespaceDeclarationsAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlNamespaceDeclarationsAttribute.cs
new file mode 100644
index 00000000000..4cc59b3cf00
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlNamespaceDeclarationsAttribute.cs
@@ -0,0 +1,26 @@
+//
+// XmlNamespaceDeclarationsAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlNamespaceDeclarationsAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlNamespaceDeclarationsAttribute : Attribute
+ {
+ public XmlNamespaceDeclarationsAttribute ()
+ {
+
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlNodeEventArgs.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlNodeEventArgs.cs
new file mode 100644
index 00000000000..5b1e3c30d01
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlNodeEventArgs.cs
@@ -0,0 +1,69 @@
+//
+// XmlNodeEventArgs.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlNodeEventArgs.
+ /// </summary>
+ public class XmlNodeEventArgs : EventArgs
+ {
+ [MonoTODO]
+ public int LineNumber {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ [MonoTODO]
+ public int LinePosition {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ [MonoTODO]
+ public string LocalName {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ [MonoTODO]
+ public string Name {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ [MonoTODO]
+ public string NamespaceURI {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ [MonoTODO]
+ public XmlNodeType NodeType {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ [MonoTODO]
+ public object ObjectBeingDeserialized {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ [MonoTODO]
+ public string Text {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs
new file mode 100644
index 00000000000..cc3a83c1b9f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlRootAttribute.cs
@@ -0,0 +1,73 @@
+//
+// XmlRootAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlRootAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Enum | AttributeTargets.Interface |
+ AttributeTargets.ReturnValue)]
+ public class XmlRootAttribute : Attribute
+ {
+ private string dataType;
+ private string elementName;
+ private bool isNullable;
+ private string ns;
+
+ public XmlRootAttribute ()
+ {
+
+ }
+ public XmlRootAttribute (string elementName)
+ {
+ ElementName = elementName;
+ }
+
+ public string DataType
+ {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+ public string ElementName
+ {
+ get {
+ return elementName;
+ }
+ set {
+ elementName = value;
+ }
+ }
+ public bool IsNullable
+ {
+ get {
+ return isNullable;
+ }
+ set {
+ isNullable = value;
+ }
+ }
+ public string Namespace
+ {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs
new file mode 100644
index 00000000000..ab78d64a08e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs
@@ -0,0 +1,137 @@
+//
+// XmlSerializer.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml.Serialization;
+using System.Xml;
+using System.IO;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlSerializer.
+ /// </summary>
+ public class XmlSerializer
+ {
+ [MonoTODO]
+ protected XmlSerializer ()
+ {
+ }
+
+ [MonoTODO]
+ public XmlSerializer (Type type)
+ {
+ }
+
+ [MonoTODO]
+ public XmlSerializer (XmlTypeMapping xmltypemapping)
+ {
+ }
+
+ [MonoTODO]
+ public XmlSerializer (Type type, string defaultNamespace)
+ {
+ }
+
+ [MonoTODO]
+ public XmlSerializer (Type type, Type[] extraTypes)
+ {
+ }
+
+ [MonoTODO]
+ public XmlSerializer (Type type, XmlAttributeOverrides overrides)
+ {
+ }
+
+ [MonoTODO]
+ public XmlSerializer (Type type, XmlRootAttribute root)
+ {
+ }
+
+ [MonoTODO]
+ public XmlSerializer (Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace)
+ {
+ }
+
+
+
+ [MonoTODO]
+ public event XmlAttributeEventHandler UnknownAttribute;
+ [MonoTODO]
+ public event XmlElementEventHandler UnknownElement;
+ [MonoTODO]
+ public event XmlNodeEventHandler UnknownNode;
+ [MonoTODO]
+ public event UnreferencedObjectEventHandler UnreferencedObject;
+
+
+ [MonoTODO]
+ public virtual bool CanDeserialize (XmlReader xmlReader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual object Deserialize (XmlSerializationReader reader)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public object Deserialize (Stream stream)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public object Deserialize (TextReader textReader)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public object Deserialize (XmlReader xmlReader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual void Serialize (object o, XmlSerializationWriter writer)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Serialize (Stream stream, object o)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Serialize (TextWriter textWriter, object o)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Serialize (XmlWriter xmlWriter, object o)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Serialize (Stream stream, object o, XmlSerializerNamespaces namespaces)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Serialize (TextWriter textWriter, object o, XmlSerializerNamespaces namespaces)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public void Serialize (XmlWriter xmlWriter, object o, XmlSerializerNamespaces namespaces)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializerNamespaces.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializerNamespaces.cs
new file mode 100644
index 00000000000..b6d49145644
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializerNamespaces.cs
@@ -0,0 +1,54 @@
+//
+// XmlSerializerNamespaces.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+using System.Xml;
+using System.Collections;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlSerializerNamespaces.
+ /// </summary>
+ public class XmlSerializerNamespaces
+ {
+ private ArrayList xmlQualifiedNames;
+
+ public XmlSerializerNamespaces ()
+ {
+ xmlQualifiedNames = new ArrayList ();
+ }
+
+ [MonoTODO]
+ public XmlSerializerNamespaces(XmlQualifiedName[] namespaces)
+ {
+ }
+
+ [MonoTODO]
+ public XmlSerializerNamespaces(XmlSerializerNamespaces namespaces)
+ {
+ }
+
+ public void Add (string prefix, string ns)
+ {
+ xmlQualifiedNames.Add (new XmlQualifiedName (prefix, ns) );
+ }
+
+ public XmlQualifiedName[] ToArray ()
+ {
+ return (XmlQualifiedName[])xmlQualifiedNames.ToArray ();
+ }
+
+ public int Count
+ {
+ get{ return xmlQualifiedNames.Count; }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlTextAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlTextAttribute.cs
new file mode 100644
index 00000000000..1ab9587eef8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlTextAttribute.cs
@@ -0,0 +1,52 @@
+//
+// XmlTextAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlTextAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field
+ | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public class XmlTextAttribute : Attribute
+ {
+ private string dataType;
+ private Type type;
+
+ public XmlTextAttribute ()
+ {
+ }
+
+ public XmlTextAttribute (Type type)
+ {
+ Type = type;
+ }
+
+ public string DataType {
+ get {
+ return dataType;
+ }
+ set {
+ dataType = value;
+ }
+ }
+ public Type Type
+ {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeAttribute.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeAttribute.cs
new file mode 100644
index 00000000000..dd8ebacb162
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeAttribute.cs
@@ -0,0 +1,60 @@
+//
+// XmlTypeAttribute.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlTypeAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Enum | AttributeTargets.Interface)]
+ public class XmlTypeAttribute : Attribute
+ {
+ private bool includeInSchema;
+ private string ns;
+ private string typeName;
+
+ public XmlTypeAttribute ()
+ {
+ }
+
+ public XmlTypeAttribute (string typeName)
+ {
+ TypeName = typeName;
+ }
+
+ public bool IncludeInSchema {
+ get {
+ return includeInSchema;
+ }
+ set {
+ includeInSchema = value;
+ }
+ }
+
+ public string Namespace {
+ get {
+ return ns;
+ }
+ set {
+ ns = value;
+ }
+ }
+ public string TypeName {
+ get {
+ return typeName;
+ }
+ set {
+ typeName = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs
new file mode 100644
index 00000000000..0dead01ff86
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs
@@ -0,0 +1,28 @@
+//
+// XmlTypeMapping.cs:
+//
+// Author:
+// John Donagher (john@webmeta.com)
+//
+// (C) 2002 John Donagher
+//
+
+using System.Xml;
+using System;
+
+namespace System.Xml.Serialization
+{
+ /// <summary>
+ /// Summary description for XmlTypeMapping.
+ /// </summary>
+ public class XmlTypeMapping : XmlMapping
+ {
+ private string typeFullName;
+
+ public string TypeFullName {
+ get {
+ return typeFullName;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/ChangeLog b/mcs/class/System.XML/System.Xml.XPath/ChangeLog
new file mode 100644
index 00000000000..620d90dcdb3
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/ChangeLog
@@ -0,0 +1,36 @@
+2002-04-12 Duncan Mak <duncan@ximian.com>
+
+ * XmlCaseOrder.cs: Moved to here from System.Xml.
+
+2002-03-26 Jason Diamond <jason@injektilo.org>
+
+ * XPathScanner.cs: Now handles name tests with wildacards. Abbreviated
+ steps. Both absolution and relative abbreviated location paths.
+
+2002-03-25 Jason Diamond <jason@injektilo.org>
+
+ * XPathScanner.cs: Added new file. This class is supposed to be internal
+ but that would make it impossible to test.
+
+2002-03-08 Duncan Mak <duncan@ximian.com>
+
+ * XPathNamespaceScope.cs:
+ * XPathNodeType.cs:
+ * XPathResultType.cs:
+ * XmlDataType.cs:
+ * XmlSortOrder.cs: Used EnumCheck and realigned elements to be compatible with MS
+ implementation. XPathResultType is interesting as EnumCheck does
+ not show the Navigator element, but shows the String element twice.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlDataType.cs, XmlSortOrder.cs, XPathNodeType.cs: Added files.
+
+2002-03-06 Jason Diamond <jason@injektilo.org>
+
+ * ChangeLog: Added to this directory.
+
+ * XPathExpression.cs, XPathNamespaceScope.cs, XPathNodeIterator.cs,
+ XPathResultType.cs: New files.
+
+ * XPathNavigator.cs: Stubbed out all properties and methods.
diff --git a/mcs/class/System.XML/System.Xml.XPath/IXPathNavigable.cs b/mcs/class/System.XML/System.Xml.XPath/IXPathNavigable.cs
new file mode 100644
index 00000000000..13c9018e761
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/IXPathNavigable.cs
@@ -0,0 +1,16 @@
+//
+// System.Xml.XPath.IXPathNavigable
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public interface IXPathNavigable
+ {
+ XPathNavigator CreateNavigator ();
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathExpression.cs b/mcs/class/System.XML/System.Xml.XPath/XPathExpression.cs
new file mode 100644
index 00000000000..4d525b36e02
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathExpression.cs
@@ -0,0 +1,50 @@
+//
+// System.Xml.XPath.XPathExpression
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System.Collections;
+
+namespace System.Xml.XPath
+{
+ public abstract class XPathExpression
+ {
+ #region Constructor
+
+ internal XPathExpression ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public abstract string Expression { get; }
+
+ public abstract XPathResultType ReturnType { get; }
+
+ #endregion
+
+ #region Methods
+
+ public abstract void AddSort (object expr, IComparer comparer);
+
+ public abstract void AddSort (
+ object expr,
+ XmlSortOrder order,
+ XmlCaseOrder caseOrder,
+ string lang,
+ XmlDataType dataType
+ );
+
+ public abstract XPathExpression Clone ();
+
+ public abstract void SetContext (XmlNamespaceManager nsManager);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathNamespaceScope.cs b/mcs/class/System.XML/System.Xml.XPath/XPathNamespaceScope.cs
new file mode 100644
index 00000000000..34a55e92662
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathNamespaceScope.cs
@@ -0,0 +1,18 @@
+//
+// System.Xml.XPath.XPathNamespaceScope
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public enum XPathNamespaceScope
+ {
+ All = 0,
+ ExcludeXml = 1,
+ Local =2,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs b/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs
new file mode 100644
index 00000000000..ca7b23025d5
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathNavigator.cs
@@ -0,0 +1,212 @@
+//
+// System.Xml.XPath.XPathNavigator
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+
+namespace System.Xml.XPath
+{
+ public abstract class XPathNavigator : ICloneable
+ {
+ #region Constructor
+
+ protected XPathNavigator ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public abstract string BaseURI { get; }
+
+ public abstract bool HasAttributes { get; }
+
+ public abstract bool HasChildren { get; }
+
+ public abstract bool IsEmptyElement { get; }
+
+ public abstract string LocalName { get; }
+
+ public abstract string Name { get; }
+
+ public abstract string NamespaceURI { get; }
+
+ public abstract XmlNameTable NameTable { get; }
+
+ public abstract XPathNodeType NodeType { get; }
+
+ public abstract string Prefix { get; }
+
+ public abstract string Value { get; }
+
+ public abstract string XmlLang { get; }
+
+ #endregion
+
+ #region Methods
+
+ public abstract XPathNavigator Clone ();
+
+ [MonoTODO]
+ public virtual XmlNodeOrder ComparePosition (XPathNavigator nav)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XPathExpression Compile (string xpath)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual object Evaluate (string xpath)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual object Evaluate (XPathExpression expr)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual object Evaluate (XPathExpression expr, XPathNodeIterator context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract string GetAttribute (string localName, string namespaceURI);
+
+ public abstract string GetNamespace (string name);
+
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool IsDescendant (XPathNavigator nav)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract bool IsSamePosition (XPathNavigator other);
+
+ [MonoTODO]
+ public virtual bool Matches (string xpath)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool Matches (XPathExpression expr)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract bool MoveTo (XPathNavigator other);
+
+ public abstract bool MoveToAttribute (string localName, string namespaceURI);
+
+ public abstract bool MoveToFirst ();
+
+ public abstract bool MoveToFirstAttribute ();
+
+ public abstract bool MoveToFirstChild ();
+
+ [MonoTODO]
+ public bool MoveToFirstNamespace ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract bool MoveToFirstNamespace (XPathNamespaceScope namespaceScope);
+
+ public abstract bool MoveToId (string id);
+
+ public abstract bool MoveToNamespace (string name);
+
+ public abstract bool MoveToNext ();
+
+ public abstract bool MoveToNextAttribute ();
+
+ [MonoTODO]
+ public bool MoveToNextNamespace ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract bool MoveToNextNamespace (XPathNamespaceScope namespaceScope);
+
+ public abstract bool MoveToParent ();
+
+ public abstract bool MoveToPrevious ();
+
+ public abstract void MoveToRoot ();
+
+ [MonoTODO]
+ public virtual XPathNodeIterator Select (string xpath)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XPathNodeIterator Select (XPathExpression expr)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XPathNodeIterator SelectAncestors (XPathNodeType type, bool matchSelf)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XPathNodeIterator SelectAncestors (string name, string namespaceURI, bool matchSelf)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XPathNodeIterator SelectChildren (XPathNodeType type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XPathNodeIterator SelectChildren (string name, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XPathNodeIterator SelectDescendants (XPathNodeType type, bool matchSelf)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XPathNodeIterator SelectDescendants (string name, string namespaceURI, bool matchSelf)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathNodeIterator.cs b/mcs/class/System.XML/System.Xml.XPath/XPathNodeIterator.cs
new file mode 100644
index 00000000000..acfcb36aba4
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathNodeIterator.cs
@@ -0,0 +1,52 @@
+//
+// System.Xml.XPath.XPathNodeIterator
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+
+namespace System.Xml.XPath
+{
+ public abstract class XPathNodeIterator : ICloneable
+ {
+ #region Constructor
+
+ protected XPathNodeIterator ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public virtual int Count {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public abstract XPathNavigator Current { get; }
+
+ public abstract int CurrentPosition { get; }
+
+ #endregion
+
+ #region Methods
+
+ public abstract XPathNodeIterator Clone ();
+
+ object ICloneable.Clone ()
+ {
+ return Clone ();
+ }
+
+ public abstract bool MoveNext ();
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathNodeType.cs b/mcs/class/System.XML/System.Xml.XPath/XPathNodeType.cs
new file mode 100644
index 00000000000..22720f838be
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathNodeType.cs
@@ -0,0 +1,25 @@
+//
+// System.Xml.XPath.XPathNodeType
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public enum XPathNodeType
+ {
+ Root = 0,
+ Element = 1,
+ Attribute = 2,
+ Namespace = 3,
+ Text = 4,
+ SignificantWhitespace = 5,
+ Whitespace = 6,
+ ProcessingInstruction = 7,
+ Comment = 8,
+ All = 9,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathResultType.cs b/mcs/class/System.XML/System.Xml.XPath/XPathResultType.cs
new file mode 100644
index 00000000000..9b1b481f840
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathResultType.cs
@@ -0,0 +1,22 @@
+//
+// System.Xml.XPath.XPathResultType
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public enum XPathResultType
+ {
+ Number = 0,
+ String = 1,
+ Boolean = 2,
+ NodeSet = 3,
+ Navigator = 4, // [MonoTODO]
+ Any = 5,
+ Error = 6,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XPathScanner.cs b/mcs/class/System.XML/System.Xml.XPath/XPathScanner.cs
new file mode 100644
index 00000000000..9142f5da139
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XPathScanner.cs
@@ -0,0 +1,260 @@
+//
+// System.Xml.XPath.XPathScanner
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.IO;
+using System.Text;
+
+// [28] ExprToken ::= '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::'
+// | NameTest
+// | NodeType
+// | Operator
+// | FunctionName
+// | AxisName
+// | Literal
+// | Number
+// | VariableReference
+// [29] Literal ::= '"' [^"]* '"'
+// | "'" [^']* "'"
+// [30] Number ::= Digits ('.' Digits?)?
+// | '.' Digits
+// [31] Digits ::= [0-9]+
+// [32] Operator ::= OperatorName
+// | MultiplyOperator
+// | '/' | '//' | '|' | '+' | '-' | '=' | '!=' | '<' | '<=' | '>' | '>='
+// [33] OperatorName ::= 'and' | 'or' | 'mod' | 'div'
+// [34] MultiplyOperator ::= '*'
+// [35] FunctionName ::= QName - NodeType
+// [36] VariableReference ::= '$' QName
+// [37] NameTest ::= '*'
+// | NCName ':' '*'
+// | QName
+// [38] NodeType ::= 'comment'
+// | 'text'
+// | 'processing-instruction'
+// | 'node'
+// [39] ExprWhitespace ::= S
+
+namespace System.Xml.XPath
+{
+ public enum XPathTokenType
+ {
+ Start,
+ End,
+ Error,
+ LeftParen,
+ RightParen,
+ LeftBracket,
+ RightBracket,
+ Dot,
+ DotDot,
+ At,
+ Comma,
+ ColonColon,
+ NameTest,
+ NodeType,
+ Operator,
+ FunctionName,
+ AxisName,
+ Literal,
+ Number,
+ VariableReference
+ }
+
+ public sealed class XPathScanner
+ {
+ private string xpath;
+ private int index;
+ private XPathTokenType tokenType;
+ private string value;
+ private XPathTokenType precedingTokenType;
+
+ public XPathScanner (string xpath)
+ {
+ this.xpath = xpath;
+ index = 0;
+ tokenType = XPathTokenType.Start;
+ }
+
+ public XPathTokenType TokenType {
+ get {
+ return tokenType;
+ }
+ }
+
+ public string Value {
+ get {
+ return value;
+ }
+ }
+
+ private int Read ()
+ {
+ int c = Peek ();
+ if (c != -1)
+ MoveNext ();
+ return c;
+ }
+
+ private int Peek ()
+ {
+ if (index < xpath.Length)
+ return xpath[index];
+ return -1;
+ }
+
+ private int Peek2 ()
+ {
+ if (index + 1 < xpath.Length)
+ return xpath[index + 1];
+ return -1;
+ }
+
+ private void MoveNext ()
+ {
+ ++index;
+ }
+
+ private void MovePrevious ()
+ {
+ if (index > 0)
+ --index;
+ }
+
+ public XPathTokenType Scan ()
+ {
+ precedingTokenType = tokenType;
+
+ int c = Read ();
+
+ if (c == -1) {
+ tokenType = XPathTokenType.End;
+ value = null;
+ } else if (c != ':' && XmlChar.IsFirstNameChar (c)) {
+ StringBuilder builder = new StringBuilder ();
+ builder.Append ((char) c);
+ while (Peek () != ':' && XmlChar.IsNameChar (Peek ())) {
+ builder.Append ((char) Read ());
+ }
+ if (Peek () == ':' && Peek2 () != ':') {
+ Read();
+ if (XmlChar.IsFirstNameChar (Peek ())) {
+ builder.Append (':');
+ builder.Append ((char) Read ());
+ while (XmlChar.IsNameChar (Peek ())) {
+ builder.Append ((char) Read ());
+ }
+ tokenType = XPathTokenType.NameTest;
+ } else if (Peek () == '*') {
+ builder.Append (':');
+ builder.Append ((char) Read ());
+ tokenType = XPathTokenType.NameTest;
+ value = builder.ToString ();
+ return tokenType;
+ } else {
+ tokenType = XPathTokenType.Error;
+ return tokenType;
+ }
+ }
+ value = builder.ToString ();
+ if (precedingTokenType != XPathTokenType.Start &&
+ precedingTokenType != XPathTokenType.At &&
+ precedingTokenType != XPathTokenType.ColonColon &&
+ precedingTokenType != XPathTokenType.LeftParen &&
+ precedingTokenType != XPathTokenType.LeftBracket &&
+ precedingTokenType != XPathTokenType.Operator)
+ tokenType = XPathTokenType.Operator;
+ else if (Peek () == '(') {
+ if (value == "comment" ||
+ value == "node" ||
+ value == "processing-instruction" ||
+ value == "text")
+ tokenType = XPathTokenType.NodeType;
+ else
+ tokenType = XPathTokenType.FunctionName;
+ } else {
+ if (Peek () == ':' && Peek2 () == ':')
+ tokenType = XPathTokenType.AxisName;
+ else
+ tokenType = XPathTokenType.NameTest;
+ }
+ value = builder.ToString ();
+ } else {
+ switch (c) {
+ case '(':
+ tokenType = XPathTokenType.LeftParen;
+ value = "(";
+ break;
+ case ')':
+ tokenType = XPathTokenType.RightParen;
+ value = ")";
+ break;
+ case '[':
+ tokenType = XPathTokenType.LeftBracket;
+ break;
+ case ']':
+ tokenType = XPathTokenType.RightBracket;
+ break;
+ case '.':
+ if (Peek () != '.') {
+ tokenType = XPathTokenType.Dot;
+ value = ".";
+ } else {
+ Read ();
+ tokenType = XPathTokenType.DotDot;
+ value = "..";
+ }
+ break;
+ case '@':
+ tokenType = XPathTokenType.At;
+ value = "@";
+ break;
+ case ',':
+ tokenType = XPathTokenType.Comma;
+ break;
+ case ':':
+ if (Peek () == ':') {
+ Read ();
+ tokenType = XPathTokenType.ColonColon;
+ value = "::";
+ } else
+ tokenType = XPathTokenType.Error;
+ break;
+ case '*':
+ if (precedingTokenType != XPathTokenType.Start &&
+ precedingTokenType != XPathTokenType.At &&
+ precedingTokenType != XPathTokenType.ColonColon &&
+ precedingTokenType != XPathTokenType.LeftParen &&
+ precedingTokenType != XPathTokenType.LeftBracket &&
+ precedingTokenType != XPathTokenType.Operator) {
+ tokenType = XPathTokenType.Operator;
+ value = "*";
+ } else {
+ tokenType = XPathTokenType.NameTest;
+ value = "*";
+ }
+ break;
+ default:
+ if (c == '/') {
+ tokenType = XPathTokenType.Operator;
+ if (Peek () != '/')
+ value = "/";
+ else {
+ Read ();
+ value = "//";
+ }
+ }
+ break;
+ }
+ }
+
+ return tokenType;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XmlCaseOrder.cs b/mcs/class/System.XML/System.Xml.XPath/XmlCaseOrder.cs
new file mode 100755
index 00000000000..90c34ef4d3c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XmlCaseOrder.cs
@@ -0,0 +1,33 @@
+// XmlCaseOrder.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:47:03 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// </summary>
+ public enum XmlCaseOrder {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ UpperFirst = 1,
+
+ /// <summary>
+ /// </summary>
+ LowerFirst = 2,
+ } // XmlCaseOrder
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml.XPath/XmlDataType.cs b/mcs/class/System.XML/System.Xml.XPath/XmlDataType.cs
new file mode 100644
index 00000000000..4b8c8ea44ae
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XmlDataType.cs
@@ -0,0 +1,17 @@
+//
+// System.Xml.XPath.XmlDataType
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public enum XmlDataType
+ {
+ Text = 1,
+ Number = 2,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml.XPath/XmlSortOrder.cs b/mcs/class/System.XML/System.Xml.XPath/XmlSortOrder.cs
new file mode 100644
index 00000000000..925aa15cd6c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml.XPath/XmlSortOrder.cs
@@ -0,0 +1,17 @@
+//
+// System.Xml.XPath.XmlSortOrder
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml.XPath
+{
+ public enum XmlSortOrder
+ {
+ Ascending = 1,
+ Descending = 2,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog
new file mode 100644
index 00000000000..ebcd0a50646
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/ChangeLog
@@ -0,0 +1,557 @@
+2002-04-16 Duncan Mak <duncan@ximian.com>
+
+ * XmlParserContext.cs (NameTable): Fixed a typo in the set block.
+
+2002-04-12 Duncan Mak <duncan@ximian.com>
+
+ * XmlAttribute.cs (Prefix): Added preliminary code for set block,
+ added comment on work that needs to be done here. A new MonoTODO item.
+
+ * XmlDocument.cs (ctor): Corrected constructor signature, changed
+ parameter from 'NameTable' to 'XmlNameTable'.
+
+ * XmlDocumentFragment.cs (InnerXml): Added missing set block.
+
+ * XmlCaseOrder.cs: Moved to System.Xml.XPath.
+
+2002-04-10 Duncan Mak <duncan@ximian.com>
+
+ * XmlNodeReader.cs: Initial stubs for the class.
+
+2002-04-08 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlAttributes.cs: InnerXml getter, WriteContentTo, and WriteTo
+ implementations.
+
+ * XmlDeclaration.cs: WriteTo implementation.
+
+ * XmlDocument.cs: InnerXml getter implementation.
+
+ * XmlElement.cs: InnerXml getter implementation.
+
+ * XmlNode.cs: Removed MonoTODO attrib on OuterXml.
+
+ * XmlSignificantWhitespace.cs: WriteTo implementation.
+
+ * XmlText.cs: WriteContentTo and WriteTo implementation.
+
+ * XmlTextWriter.cs: WriteRaw implementation.
+
+ * XmlWhitespace.cs: WriteContentTo and WriteTo implementations.
+
+2002-04-05 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlAttributes.cs: Added reminder MonoTODO to set NamespaceURI
+ if prefix in constructor is one of the default ones.
+
+ * XmlCharacterData.cs: Returns String.Empty for Value and Data
+ even when constructed with null.
+
+ * XmlDeclaration.cs: Value doesn't put encoding or standalone
+ in if they are empty.
+
+ * XmlDocument.cs: Implemented CreateNode methods and this caused
+ the changes in the other files in this checkin.
+
+ * XmlProcessingInstruction.cs: Returns String.Empty for Value and Data
+ even when constructed with null.
+
+ * XmlWhitespace.cs: Changed Value 'get' to return Data.
+
+2002-04-01 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: Impls for WriteEndDocument and WriteFullEndElement.
+
+2002-03-31 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: Impls for LookupPrefix, WriteBase64,
+ and WriteCharEntity.
+
+ * XmlWrite.cs: Fixed bug where attribute namespace decl
+ was pushing a scope onto the namespace manager when it shouldn't
+ have been.
+
+2002-03-31 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: Some tweaks for WriteAttibuteString
+ in different states (no open start element, in WriteState.Content mode).
+
+2002-03-29 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: XmlLang and XmlSpace properties
+ and WriteWhitespace.
+
+ * XmlTextWriterOpenElement.cs: scope support for XmlLang
+ and XmlSpace.
+
+2002-03-29 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: Working on Attribute methods.
+
+ * XmlWriter.cs: Working on Attribute methods.
+
+2002-03-28 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocument.cs (CreateWhitespace):
+ (CreateSignificantWhitespace): Removed extraneous call to the ToCharArray
+ method.
+
+ * XmlSignificantWhitespace.cs (Value): Removed MonoTODO attribute.
+
+2002-03-26 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocument.cs (CreateDocumentType): Implemented.
+
+ * XmlNode.cs (Value): Implemented.
+
+ * XmlProcessingInstruction.cs (InnerText): Implemented. It works just
+ like XmlCharacterData.
+
+ * XmlDeclaration.cs (CloneNode):
+ * XmlDocument.cs (CreateXmlDeclaration): Added missing constructor
+ arguments.
+
+ * XmlCharacterData.cs (InnerText): Implemented. Funny that the
+ docs say it is the "The concatenated values of the node and all
+ the children of the node.". I wrote some test programs and
+ couldn't get any of the derived nodes to AppendChild. For now,
+ InnerText == Data == Value.
+ (Substring): Fixed typo.
+
+ * XmlDeclaration.cs (XmlDeclaration): Fixed the constructor parameter signature.
+
+ * XmlImplementation.cs (CreateDocument): Implemented.
+
+2002-03-25 Duncan Mak <duncan@ximian.com>
+
+ * XmlDeclaration.cs: Rewrote the class, fixed formatting, added
+ missing properties (InnerText, Value).
+
+ * XmlDocument.cs (CreateXmlDeclaration): Implemented.
+
+2002-03-23 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: Impls for BaseStream and
+ Namespaces and WriteState.
+
+ * XmlWriter.cs: WriteState and WriteStartElementInternal.
+
+2002-03-23 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNodeListChildren.cs: made class internal
+ instead of public. Shouldn't be visible outside
+ of System.Xml.
+
+ * XmlTextWriter.cs: Implementations for Formatting,
+ IndentChar, Indenting, QuoteChar, WriteStartDocument(standalone).
+ Suppresses encoding on xml declaration if null stream passed in.
+ Formats output including suppressing indentation for elements in
+ mixed content mode.
+
+ * XmlTextWriterOpenElement.cs: Initial checkin.
+ XmlTextWriter uses stack of these objects to track
+ state.
+
+2002-03-22 Mike Kestner <mkestner@speakeasy.net>
+
+ * XmlElement.cs: impl HasAttribute(string name).
+
+2002-03-22 Duncan Mak <duncan@ximian.com>
+
+ * XmlElement.cs: Reformatted.
+ (CloneNode) Corrected.
+
+ * XmlDocument.cs (CreateWhitespace):
+ (CreateSignificantWhitespace): Implemented.
+
+ * XmlAttribute.cs (CloneNode): Changed the child's CloneNode to
+ true, because Attributes have ChildNodes.
+
+2002-03-21 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: WriteStartDocument tracks state, writes out
+ xml declaration along with encoding. WriteEndElement throws
+ exception if no WriteStartElement exists.
+
+2002-03-20 Duncan Mak <duncan@ximian.com>
+
+ * XmlEntityReference.cs (CloneNode): Implemented.
+
+ * XmlException.cs (Message): Implemented. We need to cache the
+ message string because SystemException doesn't expose 'message'
+ from Exception.
+
+ * XmlText.cs (Value): Added in the missing Value property.
+
+2002-03-20 Duncan Mak <duncan@ximian.com>
+
+ * XmlAttribute.cs (CloneNode): Implemented.
+
+ * XmlDocumentFragment.cs (CloneNode): Implemented.
+
+ * XmlElement.cs (CloneNode): Implemented.
+
+2002-03-19 Duncan Mak <duncan@ximian.com>
+
+ * XmlNotation.cs: Added to CVS.
+
+ * XmlAttribute.cs (CloneNode): First crack at the CloneNode method.
+
+ * XmlCDataSection.cs (CloneNode): Implemented.
+
+ * XmlDocumentFragment.cs: Reformatted and added the missing properties
+ (InnerXml, OwnerDocument, ParentNode).
+ (CloneNode): Implemented.
+
+ * XmlSignificantWhitespace.cs (CloneNode): Implemented.
+ (Value) Implemented the 'get' property.
+
+ * XmlWhitespace.cs (Module): implemented.
+
+2002-03-19 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs: Fixed typo in Load that was duplicating the LocalName
+ in the prefix.
+
+2002-03-18 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReader.cs: Don't restore properties after reading last
+ attribute on an element.
+
+ * XmlDocument.cs: Move back to element after reading attributes
+ so that IsEmptyElement test succeeds.
+
+2002-03-18 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNamespaceManager.cs: Implemented LookupPrefix.
+
+ * XmlTextWriter.cs: Implemented namespace and prefix support.
+
+2002-03-18 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextReader.cs: Restores properties after
+ reading last attribute on an element.
+
+ * XmlNode.cs: AppendChild sets the parent
+ on the child.
+
+2002-03-17 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlCDataSection.cs: Formatting, Implementation for WriteTo.
+
+ * XmlComment.cs: Implementations for WriteTo and WriteContentTo.
+
+ * XmlElement.cs: Fixed bug in WriteTo.
+
+ * XmlProcessingInstruction.cs: Formatting.
+
+ * XmlTextWriter.cs: Implementations for Close, WriteCData, WriteComment,
+ fixes for WriteEndElement, WriteProcessingInstruction.
+
+2002-03-17 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocument.cs: Implementations for WriteTo() and WriteContentTo(),
+ had Load() add PIs to the document, moved onXXX methods to alphabetical
+ order in the file.
+
+ * XmlElement.cs: Implementations for WriteTo() and WriteContentTo().
+
+ * XmlNode.cs: Implementations for InnerXml Get and OuterXml.
+
+ * XmlProcessingInstruction.cs: Implementations for WriteTo() and
+ WriteContentTo().
+
+ * XmlTextWriter.cs: Implementations for WriteEndElement,
+ WriteProcessingInstruction, WriteStartElement, and WriteString.
+
+ * XmlWriter.cs: Implemented WriteStartElement() methods.
+
+2002-03-15 Duncan Mak <duncan@ximian.com>
+
+ * XmlEntity.cs: Added to CVS. Need to implement BaseURI and
+ InnerText once I know what they do.
+
+ * XmlDocumentType.cs (XmlDocumentType): Fix the constructor now
+ that we can properly chain constructors.
+ (CloneNode): implemented.
+ (WriteContentTo): Removed MonoTODO attribute as this method has no
+ effect in this class.
+
+ * XmlProcessingInstruction.cs (Value): Added the missing Set
+ block.
+ (InnerText): Added in, but not implemented.
+
+2002-03-14 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriter.cs: implemented constructors and
+ WriteCData and WriteComment.
+
+2002-03-14 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocument.cs: Moved the NodeChanged EventHandler to its own
+ file, and updated the callbacks to reflect the change.
+ (XmlDocument): Added the NameTable constructor.
+ (NameTable): Also the NameTable property.
+
+ * XmlNodeChangedEventHandler.cs: Added, replacing the version that
+ was in XmlDocument.cs. It has two arguments now (object,
+ EventArgs) , instead of one (object).
+
+2002-03-14 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlWriter.cs: Formatting.
+
+ * XmlTextWriter.cs: Initial checkin.
+
+2002-03-14 Duncan Mak <duncan@ximian.com>
+
+ * Validation.cs: Removed, replaced by ValidationType.cs.
+
+ * ValidationType.cs: Added.
+
+2002-03-13 Duncan Mak <duncan@ximian.com>
+
+ * XmlException.cs: Made it [Serializable], implemented good ol'
+ GetObjectData, and the serialization constructor.
+
+ * XmlNamedNodeMap.cs (SetNamedItem): Check for the Name property.
+ (SetNamedItem): Reverted (added back in) the patch with the
+ ReadOnly checks. "Don't doubt yourself, my son... you were right!"
+
+ * XmlNamedNodeMap.cs (GetEnumerator): piggyback on the ArrayList implementation.
+ (GetNamedItem (string, string)): implemented.
+ (RemoveNamedItem): implemented.
+ (SetNamedItem): implemented.
+
+2002-03-12 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlAttribute.cs: Moved a method from amongst properties down to
+ it's alphabetical position in the methods section.
+
+ * XmlNode.cs: Passes in 'this' to XmlNodeList constructor instead of
+ last linked child. Set XmlNode base class to return false for IsReadOnly().
+ Implemented GetEnumerator() and RemoveChild().
+
+ * XmlNodeListChildren.cs: Now stores the parent instead of the last child.
+ This is to support the behavior that the Enumerator doesn't become invalid
+ when changes to the children occur. Flushed out rest of implementation for
+ MoveNext, Current, and Reset.
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * XmlCharacterData.cs: Reformatted the properties for better readability.
+
+ * XmlLinkedNode.cs: Removed the awful boxy comments.
+
+ * XmlNamedNodeMap.cs (Count):
+ (Item): Implemented. Tests will be coming.
+
+ * XmlEntityReference.cs:
+ * XmlSignificantWhitespace.cs: Implemented these classes except for
+ the Clone, WriteContentTo and WriteTo methods. Will have to
+ investigate into these later.
+
+2002-03-11 Duncan Mak <duncan@ximian.com>
+
+ * IHasXmlNode.cs: Added to CVS.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlParserContext.cs: Added missing constructors and missing Encoding
+ property.
+
+ * XmlTextReader.cs: Start using the XmlParserContext class.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReader.cs: Implemented MoveToElement and MoveToFirstAttribute.
+
+2002-03-08 Mike Kestner <mkestner@speakeasy.net>
+
+ * XmlNode.cs (Item): Implemented both indexers.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * DomEncodingType.cs, TreePosition.cs, XPathNodeType.cs, XmlDataType.cs,
+ XmlExceptionCode.cs, XmlSortOrder.cs, XmlUtil.cs: Removed files.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlAttribute.cs: Attribute nodes are supposed to store their values
+ as child nodes so updated to reflect that.
+
+ * XmlDocument.cs, XmlElement.cs, XmlNode.cs: Moved code that was
+ duplicated in XmlDocument and XmlElement into XmlNode so that it
+ wouldn't have to be duplicated in XmlAttribute, too.
+
+2002-03-08 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNodeList.cs, XmlDocument.cs, XmlLinkedNode.cs,
+ XmlNode.cs: Formatting.
+
+ * XmlNodeListChildren.cs: Implementation of XmlNodeList
+ for XmlNode.ChildNodes property.
+
+ * XmlNodeListAsArrayList.cs: Removed file. Using different
+ data structure (circular list) in XmlNode so this file
+ is no longer valid.
+
+ * XmlDocument.cs, XmlElement.cs: New ChildNodes tests found
+ bug in setter property of LastLinkedChild so fixed it.
+
+2002-03-06 Jason Diamond <jason@injektilo.org>
+
+ * XmlInputSource.cs, XmlNames_1_0.cs, XmlParse.cs: Removed files.
+ We already have a parser in XmlTextReader.
+
+ * XmlException.cs: Removed constructor accepting XmlInputSource.
+
+2002-03-06 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNode.cs: Rewrote this class from scratch with
+ MonoToDo attribs and NotImplementedExceptions. Now defines an
+ internal LastLinkedNode property to aid the new implementation.
+ XmlNodes only have ref to owner doc and parent nodes now.
+
+ * XmlLinkedNode.cs: Added NextLinkedSibling internal property
+ and ref to next sibling to support walking our circular child
+ node list.
+
+ * XmlDocument.cs: Added ref to last child node and overrides
+ XmlNode's internal LastLinkedChild property to support walking
+ our circular child node list.
+
+2002-03-02 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlProcessingInstructions.cs: Class was empty. Implemented
+ constructor, properties, and CloneNode() method. Put in
+ MonoToDo attrib for remaining methods.
+
+ * XmlComment.cs: Reformatted and put in MonoToDo attribs.
+ Got rid of helper methods and fields since they were no
+ longer needed.
+
+ * XmlLinkedNode.cs: Reformatted and put in MonoToDo attribs.
+
+ * XmlDocument.cs: Added code to Load(XmlReader) to create XmlComment,
+ XmlCDataSection, and XmlProcessingInstruction nodes. Implemented
+ Createxxx() methods for those three node types.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs: Implemented the remaining CreateElement and
+ CreateAttribute methods.
+
+ * XmlAttribute.cs: Re-implemented.
+
+ * XmlElement.cs: Set owner element on attributes. Reformatted.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReader.cs: Implemented MoveToNextAttribute().
+
+ * XmlDocument.cs: Reformatted. Adding missing methods and MonoTODO
+ attributes. Create attribute nodes while loading. Implemented
+ Load(string) and CreateTextNode().
+
+ * XmlCharacterData.cs, XmlText.cs: Re-implemented.
+
+ * XmlCDataSection.cs, XmlComment.cs: Call correct constructor in
+ XmlCharacterData.
+
+ * XmlNamedNodeMap.cs, XmlAttributeCollection.cs: Stubbed out.
+
+2002-03-02 Mike Kestner <mkestner@speakeasy.net>
+
+ * XmlAttribute.cs : Using fix.
+ * XmlDocument.cs (CreateAttribute(String)): Implement.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlNamespaceManager.cs: Atomize prefixes and namespaces strings in
+ the name table.
+
+2002-02-28 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs, XmlNode.cs: Initial implementation of LoadXml
+ courtesy of Kral Ferch <kral.ferch@hotmail.com>.
+
+2002-02-28 Jason Diamond <jason@injektilo.org>
+
+ * XmlException.cs, XmlReader.cs, XmlTextReader.cs: Reformatted,
+ added missing members and MonoTODO attributes.
+
+ * XmlTextReader.cs: Throw XmlException instead of System.Exception.
+
+2002-02-27 Jason Diamond <jason@injektilo.org>
+
+ * XmlElement.cs: Reformatted, added missing members and MonoTODO
+ attributes.
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * XmlCDataSection.cs: Initial implementation.
+
+ * NameTable.cs: Fixed the whole thing. Wrote a NUnit test to test
+ it out. This should (hopefully) be correct.
+
+2002-02-26 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReader.cs: Apparently Microsoft's implementation treats
+ namespace declarations as attributes so we do now, too.
+
+ * XmlNamespaceManager.cs: HasNamespace fixed so that it only
+ checks the current scope.
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * XmlDocumentType.cs: Added a few hacks here and there to
+ temporarily fix the "I broke the build issue".
+
+2002-02-25 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocument.cs, XmlElement.cs, XmlNode.xs, XmlNodeList.cs,
+ XmlNodeListAsArrayList.cs: Multiple fixes necessary to get
+ simple test to pass. The existing code is really shitty so I'll
+ probably start writing tests and refactoring before much else
+ can get done.
+
+2002-02-25 Duncan Mak <duncan@ximian.com>
+
+ * NameTable.cs: Implemented.
+
+ * XmlDeclaration.cs: It should inherit from XmlLinkedNode, not XmlNode.
+
+2002-02-24 Duncan Mak <duncan@ximian.com>
+
+ * XmlNodeOrder.cs: Added to CVS.
+
+ * XmlQualifiedName.cs: Fixed a warning from Equals ().
+
+ * XmlTokenizedType.cs: Added to CVS.
+
+ * XmlUrlResolver.cs: Added to CVS with one TODO task.
+
+2002-02-23 Duncan Mak <duncan@ximian.com>
+
+ * XmlQualifiedName.cs: Fixed ToString () and added the operators
+ (== and !=).
+
+2002-02-23 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReader.cs: Added support for qualified attributes.
+
+2002-02-23 Jason Diamond <jason@injektilo.org>
+
+ * XmlNamespaceManager.cs: Initial implementation.
+
+ * XmlTextReader.cs: Added support for NamespaceURI property on
+ elements.
+
+2002-02-23 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: Add the change log to this directory
+
+ * XmlQualifiedName.cs: Fixed compile errors so it would build. Still has
+ MonoTODO's
+
diff --git a/mcs/class/System.XML/System.Xml/Driver.cs b/mcs/class/System.XML/System.Xml/Driver.cs
new file mode 100644
index 00000000000..80f9cf32934
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/Driver.cs
@@ -0,0 +1,56 @@
+//
+// Driver.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Xml;
+
+public class Driver
+{
+ public static void Main(string[] args)
+ {
+ XmlReader xmlReader = null;
+
+ if (args.Length < 1)
+ {
+ xmlReader = new XmlTextReader(Console.In);
+ }
+ else
+ {
+ xmlReader = new XmlTextReader(args[0]);
+ }
+
+ while (xmlReader.Read())
+ {
+ Console.WriteLine("NodeType = {0}", xmlReader.NodeType);
+ Console.WriteLine(" Name = {0}", xmlReader.Name);
+ Console.WriteLine(" IsEmptyElement = {0}", xmlReader.IsEmptyElement);
+ Console.WriteLine(" HasAttributes = {0}", xmlReader.HasAttributes);
+ Console.WriteLine(" AttributeCount = {0}", xmlReader.AttributeCount);
+ Console.WriteLine(" HasValue = {0}", xmlReader.HasValue);
+ Console.WriteLine(" Value = {0}", xmlReader.Value);
+ Console.WriteLine(" Depth = {0}", xmlReader.Depth);
+
+ if (xmlReader.HasAttributes)
+ {
+ while (xmlReader.MoveToNextAttribute())
+ {
+ Console.WriteLine(" AttributeName = {0}", xmlReader.Name);
+ Console.WriteLine(" AttributeValue = {0}", xmlReader.Value);
+
+ while (xmlReader.ReadAttributeValue())
+ {
+ Console.WriteLine(" AttributeValueNodeType = {0}", xmlReader.NodeType);
+ Console.WriteLine(" AttributeValueName = {0}", xmlReader.Name);
+ Console.WriteLine(" AttributeValueValue = {0}", xmlReader.Value);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/EntityHandling.cs b/mcs/class/System.XML/System.Xml/EntityHandling.cs
new file mode 100755
index 00000000000..c54b016b1e6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/EntityHandling.cs
@@ -0,0 +1,29 @@
+// EntityHandling.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:46:17 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// </summary>
+ public enum EntityHandling {
+
+ /// <summary>
+ /// </summary>
+ ExpandEntities = 1,
+
+ /// <summary>
+ /// </summary>
+ ExpandCharEntities = 2,
+ } // EntityHandling
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/Formatting.cs b/mcs/class/System.XML/System.Xml/Formatting.cs
new file mode 100755
index 00000000000..2586f58a04d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/Formatting.cs
@@ -0,0 +1,29 @@
+// Formatting.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:21 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// </summary>
+ public enum Formatting {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ Indented = 1,
+ } // Formatting
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/IHasXmlNode.cs b/mcs/class/System.XML/System.Xml/IHasXmlNode.cs
new file mode 100755
index 00000000000..6eaef10dcfa
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/IHasXmlNode.cs
@@ -0,0 +1,15 @@
+//
+// System.Xml.IHasXmlNode.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public interface IHasXmlNode
+ {
+ XmlNode GetNode ();
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/IXmlLineInfo.cs b/mcs/class/System.XML/System.Xml/IXmlLineInfo.cs
new file mode 100644
index 00000000000..d49e1e93208
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/IXmlLineInfo.cs
@@ -0,0 +1,19 @@
+//
+// System.Xml.IXmlLineInfo.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml
+{
+ public interface IXmlLineInfo
+ {
+ int LineNumber { get; }
+ int LinePosition { get; }
+
+ bool HasLineInfo();
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/NameTable.cs b/mcs/class/System.XML/System.Xml/NameTable.cs
new file mode 100755
index 00000000000..c8533218040
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/NameTable.cs
@@ -0,0 +1,74 @@
+//
+// System.Xml.NameTable.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml
+{
+ public class NameTable : XmlNameTable
+ {
+ // Fields
+ Hashtable table;
+
+ // Constructor
+ public NameTable ()
+ : base ()
+ {
+ table = new Hashtable ();
+ }
+
+ // Method
+ public override string Add (string key)
+ {
+ if (table.Contains (key))
+ return (string) table [key];
+ else {
+ table.Add (key, key);
+ return key;
+ }
+ }
+
+ public override string Add (char[] key, int start, int len)
+ {
+ if (((0 > start) && (start >= key.Length))
+ || ((0 > len) && (len >= key.Length - len)))
+ throw new IndexOutOfRangeException ("The Index is out of range.");
+
+ if (len == 0)
+ return String.Empty;
+
+ string item = new string (key, start, len);
+
+ return Add (item);
+ }
+
+ public override string Get (string key)
+ {
+ if (! (table.Contains (key)))
+ return null;
+ else
+ return (string) table [key];
+
+ }
+
+ public override string Get (char[] array, int offset, int length)
+ {
+ if (((0 > offset) && (offset >= array.Length))
+ || ((0 > length) && (length >= array.Length - offset)))
+ throw new IndexOutOfRangeException ("The Index is out of range.");
+
+ if (length == 0)
+ return String.Empty;
+
+ string key = new string (array, offset, length);
+
+ return Get (key);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/Profile.cs b/mcs/class/System.XML/System.Xml/Profile.cs
new file mode 100644
index 00000000000..d16049576d1
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/Profile.cs
@@ -0,0 +1,47 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// Profile.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Xml;
+
+using System.IO;
+using System.Text;
+
+public class Profile
+{
+ public static void Main(string[] args)
+ {
+ XmlReader xmlReader = null;
+
+ if (args.Length < 1)
+ {
+ xmlReader = new XmlTextReader(Console.In);
+ }
+ else
+ {
+ xmlReader = new XmlTextReader(args[0]);
+ }
+
+ int nodes = 0;
+
+ DateTime start = DateTime.Now;
+
+ while (xmlReader.Read())
+ {
+ ++nodes;
+ }
+
+ DateTime end = DateTime.Now;
+
+ Console.WriteLine("time = {0}", end - start);
+
+ Console.WriteLine("nodes = {0}", nodes);
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/ReadState.cs b/mcs/class/System.XML/System.Xml/ReadState.cs
new file mode 100644
index 00000000000..6675af3990f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/ReadState.cs
@@ -0,0 +1,41 @@
+// ReadState.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:27 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ReadState {
+
+ /// <summary>
+ /// </summary>
+ Initial = 0,
+
+ /// <summary>
+ /// </summary>
+ Interactive = 1,
+
+ /// <summary>
+ /// </summary>
+ Error = 2,
+
+ /// <summary>
+ /// </summary>
+ EndOfFile = 3,
+
+ /// <summary>
+ /// </summary>
+ Closed = 4,
+ } // ReadState
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/TODOAttribute.cs b/mcs/class/System.XML/System.Xml/TODOAttribute.cs
new file mode 100644
index 00000000000..741cd760c1f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/TODOAttribute.cs
@@ -0,0 +1,32 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Xml {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/ValidationType.cs b/mcs/class/System.XML/System.Xml/ValidationType.cs
new file mode 100755
index 00000000000..d746324e256
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/ValidationType.cs
@@ -0,0 +1,20 @@
+// System.Xml.ValidationType.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Xml
+{
+ public enum ValidationType
+ {
+ None = 0,
+ Auto = 1,
+ DTD = 2,
+ XDR = 3,
+ Schema = 4,
+ }
+}
+
diff --git a/mcs/class/System.XML/System.Xml/WhitespaceHandling.cs b/mcs/class/System.XML/System.Xml/WhitespaceHandling.cs
new file mode 100644
index 00000000000..8e9962b367e
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/WhitespaceHandling.cs
@@ -0,0 +1,33 @@
+// WhitespaceHandling.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:33 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// </summary>
+ public enum WhitespaceHandling {
+
+ /// <summary>
+ /// </summary>
+ All = 0,
+
+ /// <summary>
+ /// </summary>
+ Significant = 1,
+
+ /// <summary>
+ /// </summary>
+ None = 2,
+ } // WhitespaceHandling
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/WriteState.cs b/mcs/class/System.XML/System.Xml/WriteState.cs
new file mode 100755
index 00000000000..7d387708782
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/WriteState.cs
@@ -0,0 +1,53 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Xml.WriteState
+//
+// Author:
+// Daniel Weber (daniel-weber@austin.rr.com)
+//
+// (C) 2001 Daniel Weber
+
+namespace System.Xml
+{
+
+
+ /// <summary>
+ /// </summary>
+ public enum WriteState {
+
+ /// <summary>
+ /// A write method has not been called.
+ /// </summary>
+ Start = 0,
+
+ /// <summary>
+ /// The prolog is being written.
+ /// </summary>
+ Prolog = 1,
+
+ /// <summary>
+ /// An element start tag is being written.
+ /// </summary>
+ Element = 2,
+
+ /// <summary>
+ /// An attribute is being written.
+ /// </summary>
+ Attribute = 3,
+
+ /// <summary>
+ /// Element content is being written.
+ /// </summary>
+ Content = 4,
+
+ /// <summary>
+ /// The close method has been called.
+ /// </summary>
+ Closed = 5,
+
+
+
+
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlAttribute.cs b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
new file mode 100644
index 00000000000..62bea221983
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlAttribute.cs
@@ -0,0 +1,196 @@
+//
+// System.Xml.XmlAttribute
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+
+namespace System.Xml
+{
+ public class XmlAttribute : XmlNode
+ {
+ #region Fields
+
+ private XmlElement ownerElement;
+ private XmlLinkedNode lastChild;
+ private string localName;
+ private string namespaceURI;
+ private string prefix;
+
+ #endregion
+
+ #region Constructor
+
+ [MonoTODO("need to set namespaceURI if prefix is recognized built-in ones like xmlns")]
+ protected internal XmlAttribute (
+ string prefix,
+ string localName,
+ string namespaceURI,
+ XmlDocument doc) : base (doc)
+ {
+ this.prefix = prefix;
+ this.localName = localName;
+ this.namespaceURI = namespaceURI;
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public override string BaseURI {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public override string InnerText {
+ get {
+ throw new NotImplementedException ();
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO ("Setter.")]
+ public override string InnerXml {
+ get {
+ // Not sure why this is an override. Passing through for now.
+ return base.InnerXml;
+ }
+
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public override string LocalName {
+ get {
+ return localName;
+ }
+ }
+
+ public override string Name {
+ get {
+ return prefix != String.Empty ? prefix + ":" + localName : localName;
+ }
+ }
+
+ public override string NamespaceURI {
+ get {
+ return namespaceURI;
+ }
+ }
+
+ public override XmlNodeType NodeType {
+ get {
+ return XmlNodeType.Attribute;
+ }
+ }
+
+ public override XmlDocument OwnerDocument {
+ get {
+ return base.OwnerDocument;
+ }
+ }
+
+ public virtual XmlElement OwnerElement {
+ get {
+ return ownerElement;
+ }
+ }
+
+ [MonoTODO]
+ public override XmlNode ParentNode {
+ get {
+ return null;
+ }
+ }
+
+ [MonoTODO]
+ // We gotta do more in the set block here
+ // We need to do the proper tests and throw
+ // the correct Exceptions
+ public override string Prefix {
+ set {
+ prefix = value;
+ }
+
+ get {
+ return prefix;
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool Specified {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public override string Value {
+ get {
+ XmlNode firstChild = FirstChild;
+ if (firstChild == null)
+ return String.Empty;
+ return firstChild.Value;
+ }
+
+ set {
+ XmlNode firstChild = FirstChild;
+ if (firstChild == null)
+ AppendChild (OwnerDocument.CreateTextNode (value));
+ else
+ firstChild.Value = value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ XmlNode node = new XmlAttribute (prefix, localName, namespaceURI,
+ OwnerDocument);
+ if (deep) {
+ while ((node != null) && (node.HasChildNodes)) {
+ AppendChild (node.NextSibling.CloneNode (true));
+ node = node.NextSibling;
+ }
+ }
+
+ return node;
+ }
+
+ internal void SetOwnerElement (XmlElement ownerElement)
+ {
+ this.ownerElement = ownerElement;
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ w.WriteString (Value);
+ }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteAttributeString (prefix, localName, namespaceURI, Value);
+ }
+
+ #endregion
+
+ internal override XmlLinkedNode LastLinkedChild {
+ get { return lastChild; }
+
+ set { lastChild = value; }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs b/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs
new file mode 100644
index 00000000000..11bef65eaaa
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlAttributeCollection.cs
@@ -0,0 +1,117 @@
+//
+// System.Xml.XmlAttributeCollection
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml
+{
+ public class XmlAttributeCollection : XmlNamedNodeMap, ICollection
+ {
+ internal XmlAttributeCollection (XmlNode parent) : base (parent)
+ {
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ [System.Runtime.CompilerServices.IndexerName ("ItemOf")]
+ public virtual XmlAttribute this [string name] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ [System.Runtime.CompilerServices.IndexerName ("ItemOf")]
+ public virtual XmlAttribute this [int i] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ [System.Runtime.CompilerServices.IndexerName ("ItemOf")]
+ public virtual XmlAttribute this [string localName, string namespaceURI] {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute Append (XmlAttribute node)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void CopyTo (XmlAttribute [] array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void ICollection.CopyTo (Array array, int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute InsertAfter (XmlAttribute newNode, XmlAttribute refNode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute InsertBefore (XmlAttribute newNode, XmlAttribute refNode)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute Prepend (XmlAttribute node)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute Remove (XmlAttribute node)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void RemoveAll ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute RemoveAt (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override XmlNode SetNamedItem (XmlNode node)
+ {
+ return base.SetNamedItem (node);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlCDataSection.cs b/mcs/class/System.XML/System.Xml/XmlCDataSection.cs
new file mode 100644
index 00000000000..fae85718883
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlCDataSection.cs
@@ -0,0 +1,54 @@
+//
+// System.Xml.XmlCDataSection.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public class XmlCDataSection : XmlCharacterData
+ {
+ #region Constructors
+
+ protected internal XmlCDataSection (string data, XmlDocument doc)
+ : base (data, doc)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override string LocalName {
+ get { return "#cdata-section"; }
+ }
+
+ public override string Name {
+ get { return "#cdata-section"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.CDATA; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ return new XmlCDataSection (Data, OwnerDocument); // CDATA nodes have no children.
+ }
+
+ public override void WriteContentTo (XmlWriter w) { }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteCData (Data);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlChar.cs b/mcs/class/System.XML/System.Xml/XmlChar.cs
new file mode 100644
index 00000000000..2ea00dd8572
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlChar.cs
@@ -0,0 +1,200 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Xml.XmlChar.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml
+{
+ internal class XmlChar
+ {
+ internal static bool IsWhitespace(int ch)
+ {
+ return ch == 0x20 || ch == 0x9 || ch == 0xD || ch == 0xA;
+ }
+
+ internal static bool IsFirstNameChar(int ch)
+ {
+ bool result = false;
+
+ if (ch >= 0 && ch <= 0xFFFF)
+ {
+ result = (nameBitmap[(firstNamePages[ch >> 8] << 3) + ((ch & 0xFF) >> 5)] & (1 << (ch & 0x1F))) != 0;
+ }
+
+ return result;
+ }
+
+ internal static bool IsNameChar(int ch)
+ {
+ bool result = false;
+
+ if (ch >= 0 && ch <= 0xFFFF)
+ {
+ result = (nameBitmap[(namePages[ch >> 8] << 3) + ((ch & 0xFF) >> 5)] & (1 << (ch & 0x1F))) != 0;
+ }
+
+ return result;
+ }
+
+ private static byte[] firstNamePages =
+ {
+ 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
+ 0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
+ 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ private static byte[] namePages =
+ {
+ 0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
+ 0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
+ 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
+ 0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ private static uint[] nameBitmap =
+ {
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
+ 0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
+ 0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
+ 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
+ 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
+ 0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
+ 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
+ 0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
+ 0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
+ 0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
+ 0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
+ 0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
+ 0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
+ 0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
+ 0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
+ 0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
+ 0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
+ 0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
+ 0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
+ 0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
+ 0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
+ 0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
+ 0x40000000, 0xF580C900, 0x00000007, 0x02010800,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
+ 0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
+ 0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
+ 0x00000000, 0x00004C40, 0x00000000, 0x00000000,
+ 0x00000007, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
+ 0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
+ 0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
+ 0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
+ 0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
+ 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
+ 0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
+ 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
+ 0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
+ 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
+ 0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
+ 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
+ 0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
+ 0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
+ 0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
+ 0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
+ 0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
+ 0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
+ 0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
+ 0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
+ 0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
+ 0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
+ 0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
+ 0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
+ 0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
+ 0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
+ 0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
+ 0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
+ 0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF
+ };
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlCharacterData.cs b/mcs/class/System.XML/System.Xml/XmlCharacterData.cs
new file mode 100644
index 00000000000..861f1d143eb
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlCharacterData.cs
@@ -0,0 +1,90 @@
+//
+// System.Xml.XmlCharacterData.cs
+//
+// Author:
+// Jason Diamond <jason@injektilo.org>
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+
+namespace System.Xml
+{
+ public abstract class XmlCharacterData : XmlLinkedNode
+ {
+ private string data;
+
+ #region Constructor
+
+ protected internal XmlCharacterData (string data, XmlDocument doc)
+ : base (doc)
+ {
+ if (data == null)
+ data = String.Empty;
+
+ this.data = data;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public virtual string Data {
+ get { return data; }
+
+ set { data = value; }
+ }
+
+ public override string InnerText {
+ get { return data; }
+
+ set { data = value; }
+ }
+
+ public virtual int Length {
+ get { return data != null ? data.Length : 0; }
+ }
+
+ public override string Value {
+ get { return data; }
+
+ set { data = value; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public virtual void AppendData (string strData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void DeleteData (int offset, int count)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void InsertData (int offset, string strData)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void ReplaceData (int offset, int count, string strData)
+ {
+ throw new NotImplementedException();
+ }
+
+ public virtual string Substring (int offset, int count)
+ {
+ return data.Substring (offset, count);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlComment.cs b/mcs/class/System.XML/System.Xml/XmlComment.cs
new file mode 100644
index 00000000000..4c83ebab0e6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlComment.cs
@@ -0,0 +1,58 @@
+//
+// System.Xml.XmlComment
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+
+namespace System.Xml
+{
+ public class XmlComment : XmlCharacterData
+ {
+ #region Constructors
+
+ protected internal XmlComment (string comment, XmlDocument doc)
+ : base (comment, doc)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override string LocalName {
+ get { return "#comment"; }
+ }
+
+ public override string Name {
+ get { return "#comment"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Comment; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ // discard deep because Comments have no children.
+ return new XmlComment(Value, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w) { }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteComment (Data);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlDeclaration.cs b/mcs/class/System.XML/System.Xml/XmlDeclaration.cs
new file mode 100644
index 00000000000..8f1974e4d9a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlDeclaration.cs
@@ -0,0 +1,107 @@
+//
+// System.Xml.XmlDeclaration
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+using System;
+using System.Xml;
+
+namespace System.Xml
+{
+ public class XmlDeclaration : XmlLinkedNode
+ {
+ string encoding = "UTF-8"; // defaults to UTF-8
+ string standalone;
+ string version;
+
+ protected internal XmlDeclaration (string version, string encoding,
+ string standalone, XmlDocument doc)
+ : base (doc)
+ {
+ if (encoding == null)
+ encoding = "";
+
+ if (standalone == null)
+ standalone = "";
+
+ this.version = version;
+ this.encoding = encoding;
+ this.standalone = standalone;
+ }
+
+ public string Encoding {
+ get { return encoding; }
+ set { encoding = (value == null) ? String.Empty : value; }
+ }
+
+ public override string InnerText {
+ get { return Value; }
+ set { ParseInput (value); }
+ }
+
+ public override string LocalName {
+ get { return "xml"; }
+ }
+
+ public override string Name {
+ get { return "xml"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.XmlDeclaration; }
+ }
+
+ public string Standalone {
+ get { return standalone; }
+ set {
+ if (value.ToUpper() == "YES")
+ standalone = "yes";
+ if (value.ToUpper() == "NO")
+ standalone = "no";
+ }
+ }
+
+ public override string Value {
+ get {
+ string formatEncoding = "";
+ string formatStandalone = "";
+
+ if (encoding != String.Empty)
+ formatEncoding = String.Format (" encoding=\"{0}\"", encoding);
+
+ if (standalone != String.Empty)
+ formatStandalone = String.Format (" standalone=\"{0}\"", standalone);
+
+ return String.Format ("version=\"{0}\"{1}{2}", Version, formatEncoding, formatStandalone);
+ }
+ set { ParseInput (value); }
+ }
+
+ public string Version {
+ get { return version; }
+ }
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ return new XmlDeclaration (Version, Encoding, standalone, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w) {}
+
+ public override void WriteTo (XmlWriter w)
+ {
+ // This doesn't seem to match up very well with w.WriteStartDocument()
+ // so writing out custom here.
+ w.WriteRaw (String.Format ("<?xml {0}?>", Value));
+ }
+
+ void ParseInput (string input)
+ {
+ Encoding = input.Split (new char [] { ' ' }) [1].Split (new char [] { '=' }) [1];
+ Standalone = input.Split (new char [] { ' ' }) [2].Split (new char [] { '=' }) [1];
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlDocument.cs b/mcs/class/System.XML/System.Xml/XmlDocument.cs
new file mode 100644
index 00000000000..5a6cc0827e2
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlDocument.cs
@@ -0,0 +1,563 @@
+//
+// System.Xml.XmlDocument
+//
+// Author:
+// Daniel Weber (daniel-weber@austin.rr.com)
+//
+// (C) 2001 Daniel Weber
+
+using System;
+using System.IO;
+using System.Xml.XPath;
+using System.Diagnostics;
+
+namespace System.Xml
+{
+ public class XmlDocument : XmlNode
+ {
+ #region Fields
+
+ XmlLinkedNode lastLinkedChild;
+ XmlNameTable nameTable;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlDocument () : base (null) { }
+
+ [MonoTODO]
+ protected internal XmlDocument (XmlImplementation imp) : base (null)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public XmlDocument (XmlNameTable nt) : base (null)
+ {
+ nameTable = nt;
+ }
+
+ #endregion
+
+ #region Events
+
+ public event XmlNodeChangedEventHandler NodeChanged;
+
+ public event XmlNodeChangedEventHandler NodeChanging;
+
+ public event XmlNodeChangedEventHandler NodeInserted;
+
+ public event XmlNodeChangedEventHandler NodeInserting;
+
+ public event XmlNodeChangedEventHandler NodeRemoved;
+
+ public event XmlNodeChangedEventHandler NodeRemoving;
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public override string BaseURI {
+ get { throw new NotImplementedException(); }
+ }
+
+ public XmlElement DocumentElement {
+ get {
+ XmlNode node = FirstChild;
+
+ while (node != null) {
+ if (node is XmlElement)
+ break;
+ node = node.NextSibling;
+ }
+
+ return node != null ? node as XmlElement : null;
+ }
+ }
+
+ [MonoTODO]
+ public virtual XmlDocumentType DocumentType {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO]
+ public XmlImplementation Implementation {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO ("Setter.")]
+ public override string InnerXml {
+ get {
+ // Not sure why this is an override. Passing through for now.
+ return base.InnerXml;
+ }
+ set { throw new NotImplementedException(); }
+ }
+
+ public override bool IsReadOnly {
+ get { return false; }
+ }
+
+ internal override XmlLinkedNode LastLinkedChild {
+ get {
+ return lastLinkedChild;
+ }
+
+ set {
+ lastLinkedChild = value;
+ }
+ }
+
+ public override string LocalName {
+ get { return "#document"; }
+ }
+
+ public override string Name {
+ get { return "#document"; }
+ }
+
+ public XmlNameTable NameTable {
+ get { return nameTable; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Document; }
+ }
+
+ public override XmlDocument OwnerDocument {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public bool PreserveWhitespace {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO]
+ public virtual XmlResolver XmlResolver {
+ set { throw new NotImplementedException(); }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override XmlNode CloneNode (bool deep)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public XmlAttribute CreateAttribute (string name)
+ {
+ return CreateAttribute (name, String.Empty);
+ }
+
+ public XmlAttribute CreateAttribute (string qualifiedName, string namespaceURI)
+ {
+ string prefix;
+ string localName;
+
+ ParseName (qualifiedName, out prefix, out localName);
+
+ return CreateAttribute (prefix, localName, namespaceURI);
+ }
+
+ public virtual XmlAttribute CreateAttribute (string prefix, string localName, string namespaceURI)
+ {
+ if ((localName == null) || (localName == String.Empty))
+ throw new ArgumentException ("The attribute local name cannot be empty.");
+
+ return new XmlAttribute (prefix, localName, namespaceURI, this);
+ }
+
+ public virtual XmlCDataSection CreateCDataSection (string data)
+ {
+ return new XmlCDataSection (data, this);
+ }
+
+ public virtual XmlComment CreateComment (string data)
+ {
+ return new XmlComment(data, this);
+ }
+
+ [MonoTODO]
+ protected internal virtual XmlAttribute CreateDefaultAttribute (string prefix, string localName, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlDocumentFragment CreateDocumentFragment ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual XmlDocumentType CreateDocumentType (string name, string publicId,
+ string systemId, string internalSubset)
+ {
+ return new XmlDocumentType (name, publicId, systemId, internalSubset, this);
+ }
+
+ public XmlElement CreateElement (string name)
+ {
+ return CreateElement (name, String.Empty);
+ }
+
+ public XmlElement CreateElement (
+ string qualifiedName,
+ string namespaceURI)
+ {
+ string prefix;
+ string localName;
+
+ ParseName (qualifiedName, out prefix, out localName);
+
+ return CreateElement (prefix, localName, namespaceURI);
+ }
+
+ public virtual XmlElement CreateElement (
+ string prefix,
+ string localName,
+ string namespaceURI)
+ {
+ if ((localName == null) || (localName == String.Empty))
+ throw new ArgumentException ("The local name for elements or attributes cannot be null or an empty string.");
+
+ return new XmlElement (prefix, localName, namespaceURI, this);
+ }
+
+ [MonoTODO]
+ public virtual XmlEntityReference CreateEntityReference (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected internal virtual XPathNavigator CreateNavigator (XmlNode node)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual XmlNode CreateNode (
+ string nodeTypeString,
+ string name,
+ string namespaceURI)
+ {
+ return CreateNode (GetNodeTypeFromString (nodeTypeString), name, namespaceURI);
+ }
+
+ public virtual XmlNode CreateNode (
+ XmlNodeType type,
+ string name,
+ string namespaceURI)
+ {
+ string prefix = null;
+ string localName = name;
+
+ if ((type == XmlNodeType.Attribute) || (type == XmlNodeType.Element) || (type == XmlNodeType.EntityReference))
+ ParseName (name, out prefix, out localName);
+
+ return CreateNode (type, prefix, localName, namespaceURI);
+ }
+
+ public virtual XmlNode CreateNode (
+ XmlNodeType type,
+ string prefix,
+ string name,
+ string namespaceURI)
+ {
+ switch (type) {
+ case XmlNodeType.Attribute: return CreateAttribute (prefix, name, namespaceURI);
+ case XmlNodeType.CDATA: return CreateCDataSection (null);
+ case XmlNodeType.Comment: return CreateComment (null);
+ case XmlNodeType.Document: return new XmlDocument (); // TODO - test to see which constructor to use, i.e. use existing NameTable or not.
+ case XmlNodeType.DocumentFragment: return CreateDocumentFragment ();
+ case XmlNodeType.DocumentType: return CreateDocumentType (null, null, null, null);
+ case XmlNodeType.Element: return CreateElement (prefix, name, namespaceURI);
+ case XmlNodeType.EntityReference: return CreateEntityReference (null);
+ case XmlNodeType.ProcessingInstruction: return CreateProcessingInstruction (null, null);
+ case XmlNodeType.SignificantWhitespace: return CreateSignificantWhitespace (String.Empty);
+ case XmlNodeType.Text: return CreateTextNode (null);
+ case XmlNodeType.Whitespace: return CreateWhitespace (String.Empty);
+ case XmlNodeType.XmlDeclaration: return CreateXmlDeclaration ("1.0", null, null);
+ default: throw new ArgumentOutOfRangeException(String.Format("{0}\nParameter name: {1}",
+ "Specified argument was out of the range of valid values", type.ToString ()));
+ }
+ }
+
+ public virtual XmlProcessingInstruction CreateProcessingInstruction (
+ string target,
+ string data)
+ {
+ return new XmlProcessingInstruction (target, data, this);
+ }
+
+ public virtual XmlSignificantWhitespace CreateSignificantWhitespace (string text)
+ {
+ foreach (char c in text)
+ if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t'))
+ throw new ArgumentException ("Invalid whitespace characters.");
+
+ return new XmlSignificantWhitespace (text, this);
+ }
+
+ public virtual XmlText CreateTextNode (string text)
+ {
+ return new XmlText (text, this);
+ }
+
+ public virtual XmlWhitespace CreateWhitespace (string text)
+ {
+ foreach (char c in text)
+ if ((c != ' ') && (c != '\r') && (c != '\n') && (c != '\t'))
+ throw new ArgumentException ("Invalid whitespace characters.");
+
+ return new XmlWhitespace (text, this);
+ }
+
+ public virtual XmlDeclaration CreateXmlDeclaration (string version, string encoding,
+ string standalone)
+ {
+ if (version != "1.0")
+ throw new ArgumentException ("version string is not correct.");
+
+ if ((standalone != null) && !((standalone == "yes") || (standalone == "no")))
+ throw new ArgumentException ("standalone string is not correct.");
+
+ return new XmlDeclaration (version, encoding, standalone, this);
+ }
+
+ [MonoTODO]
+ public virtual XmlElement GetElementById (string elementId)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlNodeList GetElementsByTagName (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlNodeList GetElementsByTagName (string localName, string namespaceURI)
+ {
+ throw new NotImplementedException();
+ }
+
+ private XmlNodeType GetNodeTypeFromString (string nodeTypeString)
+ {
+ switch (nodeTypeString) {
+ case "attribute": return XmlNodeType.Attribute;
+ case "cdatasection": return XmlNodeType.CDATA;
+ case "comment": return XmlNodeType.Comment;
+ case "document": return XmlNodeType.Document;
+ case "documentfragment": return XmlNodeType.DocumentFragment;
+ case "documenttype": return XmlNodeType.DocumentType;
+ case "element": return XmlNodeType.Element;
+ case "entityreference": return XmlNodeType.EntityReference;
+ case "processinginstruction": return XmlNodeType.ProcessingInstruction;
+ case "significantwhitespace": return XmlNodeType.SignificantWhitespace;
+ case "text": return XmlNodeType.Text;
+ case "whitespace": return XmlNodeType.Whitespace;
+ default:
+ throw new ArgumentException(String.Format("The string doesn't represent any node type : {0}.", nodeTypeString));
+ }
+ }
+
+ [MonoTODO]
+ public virtual XmlNode ImportNode (XmlNode node, bool deep)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Load (Stream inStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void Load (string filename)
+ {
+ XmlReader xmlReader = new XmlTextReader (new StreamReader (filename));
+ Load (xmlReader);
+ }
+
+ [MonoTODO]
+ public virtual void Load (TextReader txtReader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void Load (XmlReader xmlReader)
+ {
+ // Reset our document
+ // For now this just means removing all our children but later this
+ // may turn out o need to call a private method that resets other things
+ // like properties we have, etc.
+ RemoveAll ();
+
+ XmlNode currentNode = this;
+ XmlNode newNode;
+
+ while (xmlReader.Read ())
+ {
+ switch (xmlReader.NodeType) {
+
+ case XmlNodeType.CDATA:
+ newNode = CreateCDataSection(xmlReader.Value);
+ currentNode.AppendChild (newNode);
+ break;
+
+ case XmlNodeType.Comment:
+ newNode = CreateComment (xmlReader.Value);
+ currentNode.AppendChild (newNode);
+ break;
+
+ case XmlNodeType.Element:
+ XmlElement element = CreateElement (xmlReader.Prefix, xmlReader.LocalName, xmlReader.NamespaceURI);
+ currentNode.AppendChild (element);
+
+ // set the element's attributes.
+ while (xmlReader.MoveToNextAttribute ())
+ element.SetAttribute (xmlReader.Name, xmlReader.Value);
+
+ xmlReader.MoveToElement ();
+
+ // if this element isn't empty, push it onto our "stack".
+ if (!xmlReader.IsEmptyElement)
+ currentNode = element;
+
+ break;
+
+ case XmlNodeType.EndElement:
+ currentNode = currentNode.ParentNode;
+ break;
+
+ case XmlNodeType.ProcessingInstruction:
+ newNode = CreateProcessingInstruction (xmlReader.Name, xmlReader.Value);
+ currentNode.AppendChild (newNode);
+ break;
+
+ case XmlNodeType.Text:
+ newNode = CreateTextNode (xmlReader.Value);
+ currentNode.AppendChild (newNode);
+ break;
+ }
+ }
+ }
+
+ public virtual void LoadXml (string xml)
+ {
+ XmlReader xmlReader = new XmlTextReader (new StringReader (xml));
+ Load (xmlReader);
+ }
+
+ internal void onNodeChanged (XmlNode node, XmlNode Parent)
+ {
+ if (NodeChanged != null)
+ NodeInserted (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Change,
+ node, Parent, Parent));
+ }
+
+ internal void onNodeChanging(XmlNode node, XmlNode Parent)
+ {
+ if (NodeInserting != null)
+ NodeChanging (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Change,
+ node, Parent, Parent));
+ }
+
+ internal void onNodeInserted (XmlNode node, XmlNode newParent)
+ {
+ if (NodeInserted != null)
+ NodeInserted (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Insert,
+ node, null, newParent));
+ }
+
+ internal void onNodeInserting (XmlNode node, XmlNode newParent)
+ {
+ if (NodeInserting != null)
+ NodeInserting (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Insert,
+ node, null, newParent));
+ }
+
+ internal void onNodeRemoved (XmlNode node, XmlNode oldParent)
+ {
+ if (NodeRemoved != null)
+ NodeRemoved (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Remove,
+ node, oldParent, null));
+ }
+
+ internal void onNodeRemoving (XmlNode node, XmlNode oldParent)
+ {
+ if (NodeRemoving != null)
+ NodeRemoving (node, new XmlNodeChangedEventArgs
+ (XmlNodeChangedAction.Remove,
+ node, oldParent, null));
+ }
+
+ private void ParseName (string name, out string prefix, out string localName)
+ {
+ int indexOfColon = name.IndexOf (':');
+
+ if (indexOfColon != -1) {
+ prefix = name.Substring (0, indexOfColon);
+ localName = name.Substring (indexOfColon + 1);
+ } else {
+ prefix = "";
+ localName = name;
+ }
+ }
+
+ [MonoTODO]
+ public virtual XmlNode ReadNode(XmlReader reader)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Save(Stream outStream)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Save (string filename)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Save (TextWriter writer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Save (XmlWriter writer)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ foreach(XmlNode childNode in ChildNodes)
+ childNode.WriteTo(w);
+ }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ WriteContentTo(w);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs b/mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs
new file mode 100644
index 00000000000..8bc9aa4aac3
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlDocumentFragment.cs
@@ -0,0 +1,84 @@
+//
+// System.Xml.XmlDocumentFragment
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C), Ximian, Inc
+//
+using System;
+
+namespace System.Xml
+{
+ public class XmlDocumentFragment : XmlNode
+ {
+ #region Constructor
+
+ protected internal XmlDocumentFragment (XmlDocument doc)
+ : base (doc)
+ {
+ }
+
+ #endregion
+ #region Properties
+
+ [MonoTODO]
+ public override string InnerXml {
+ set { throw new NotImplementedException (); }
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string LocalName {
+ get { return "#document-fragment"; }
+ }
+
+
+ public override string Name {
+ get { return "#document-fragment"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.DocumentFragment; }
+ }
+
+ public override XmlDocument OwnerDocument {
+ get { return base.OwnerDocument; }
+ }
+
+ public override XmlNode ParentNode {
+ get { return null; } // it's always null here.
+ }
+
+ #endregion
+
+ #region Methods
+ public override XmlNode CloneNode (bool deep)
+ {
+ if (deep) { // clone document + child nodes
+ XmlNode node = FirstChild;
+
+ while ((node != null) && (node.HasChildNodes)) {
+ AppendChild (node.NextSibling.CloneNode (false));
+ node = node.NextSibling;
+ }
+
+ return node;
+ } else
+ return new XmlDocumentFragment (OwnerDocument);
+ }
+
+ [MonoTODO]
+ public override void WriteContentTo (XmlWriter w)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void WriteTo (XmlWriter w)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlDocumentType.cs b/mcs/class/System.XML/System.Xml/XmlDocumentType.cs
new file mode 100644
index 00000000000..83dbf11c7ea
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlDocumentType.cs
@@ -0,0 +1,98 @@
+//
+// System.Xml.XmlDocumentType.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public class XmlDocumentType : XmlLinkedNode
+ {
+ // Fields
+ string name; // name of the document type
+ string publicId; // public identifier on the DOCTYPE
+ string systemId; // system identifier on the DOCTYPE
+ string internalSubset; // value of the DTD internal subset
+
+ // Constructor
+ protected internal XmlDocumentType (string name, string publicId,
+ string systemId, string internalSubset,
+ XmlDocument doc)
+ : base (doc)
+ {
+ this.name = name;
+ this.publicId = publicId;
+ this.systemId = systemId;
+ this.internalSubset = internalSubset;
+ }
+
+
+ // Properties
+ [MonoTODO]
+ public XmlNamedNodeMap Entities
+ {
+ get { return null; }
+ }
+
+ public string InternalSubset
+ {
+ get { return internalSubset; }
+ }
+
+ public override bool IsReadOnly
+ {
+ get { return true; } // always return true
+ }
+
+ public override string LocalName
+ {
+ get { return name; }
+ }
+
+ public override string Name
+ {
+ get { return name; }
+ }
+
+ public override XmlNodeType NodeType
+ {
+ get { return XmlNodeType.DocumentType; }
+ }
+
+ [MonoTODO]
+ public XmlNamedNodeMap Notations
+ {
+ get { return null; }
+ }
+
+ public string PublicId
+ {
+ get { return publicId; }
+ }
+
+ public string SystemId
+ {
+ get { return systemId; }
+ }
+
+ // Methods
+ public override XmlNode CloneNode (bool deep)
+ {
+ // deep is ignored
+ return new XmlDocumentType (name, publicId, systemId,
+ internalSubset, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ // No effect
+ }
+
+ [MonoTODO]
+ public override void WriteTo (XmlWriter w)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlElement.cs b/mcs/class/System.XML/System.Xml/XmlElement.cs
new file mode 100644
index 00000000000..8963918f9bb
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlElement.cs
@@ -0,0 +1,291 @@
+//
+// System.Xml.XmlAttribute
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+
+namespace System.Xml
+{
+ public class XmlElement : XmlLinkedNode
+ {
+ #region Fields
+
+ private XmlAttributeCollection attributes;
+ private XmlLinkedNode lastLinkedChild;
+ private string localName;
+ private string namespaceURI;
+ private string prefix;
+
+ #endregion
+
+ #region Constructor
+
+ protected internal XmlElement (
+ string prefix,
+ string localName,
+ string namespaceURI,
+ XmlDocument doc) : base (doc)
+ {
+ this.prefix = prefix;
+ this.localName = localName;
+ this.namespaceURI = namespaceURI;
+
+ attributes = new XmlAttributeCollection (this);
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override XmlAttributeCollection Attributes {
+ get { return attributes; }
+ }
+
+ public virtual bool HasAttributes {
+ get { return attributes.Count > 0; }
+ }
+
+ [MonoTODO]
+ public override string InnerText {
+ get { throw new NotImplementedException (); }
+
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO ("Setter.")]
+ public override string InnerXml {
+ get {
+ // Not sure why this is an override. Passing through for now.
+ return base.InnerXml;
+ }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public bool IsEmpty {
+ get { throw new NotImplementedException (); }
+
+ set { throw new NotImplementedException (); }
+ }
+
+ internal override XmlLinkedNode LastLinkedChild {
+ get { return lastLinkedChild; }
+
+ set { lastLinkedChild = value; }
+ }
+
+ public override string LocalName {
+ get { return localName; }
+ }
+
+ public override string Name {
+ get {
+ return prefix != String.Empty ? prefix + ":" + localName : localName;
+ }
+ }
+
+ public override string NamespaceURI {
+ get { return namespaceURI; }
+ }
+
+ [MonoTODO]
+ public override XmlNode NextSibling {
+ get {
+ return base.NextSibling;
+ }
+ }
+
+ public override XmlNodeType NodeType {
+ get {
+ return XmlNodeType.Element;
+ }
+ }
+
+ [MonoTODO]
+ public override XmlDocument OwnerDocument {
+ get {
+ return base.OwnerDocument;
+ }
+ }
+
+ public override string Prefix {
+ get {
+ return prefix;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override XmlNode CloneNode (bool deep)
+ {
+ XmlNode node = new XmlElement (prefix, localName, namespaceURI,
+ OwnerDocument);
+
+ for (int i = 0; i < node.Attributes.Count; i++)
+ node.AppendChild (node.Attributes [i].CloneNode (false));
+
+ if (deep) {
+ while ((node != null) && (node.HasChildNodes)) {
+ AppendChild (node.NextSibling.CloneNode (true));
+ node = node.NextSibling;
+ }
+ } // shallow cloning
+
+ //
+ // Reminder: Also look into Default attributes.
+ //
+ return node;
+ }
+
+ [MonoTODO]
+ public virtual string GetAttribute (string name)
+ {
+ XmlNode attributeNode = Attributes.GetNamedItem (name);
+ return attributeNode != null ? attributeNode.Value : String.Empty;
+ }
+
+ [MonoTODO]
+ public virtual string GetAttribute (string localName, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute GetAttributeNode (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute GetAttributeNode (string localName, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlNodeList GetElementsByTagName (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlNodeList GetElementsByTagName (string localName, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool HasAttribute (string name)
+ {
+ XmlNode attributeNode = Attributes.GetNamedItem (name);
+ return attributeNode != null;
+ }
+
+ [MonoTODO]
+ public virtual bool HasAttribute (string localName, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO ("Don't remove default attributes.")]
+ public override void RemoveAll ()
+ {
+ // Remove the child nodes.
+ base.RemoveAll ();
+
+ // Remove all attributes.
+ attributes.RemoveAll ();
+ }
+
+ [MonoTODO]
+ public virtual void RemoveAllAttributes ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void RemoveAttribute (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void RemoveAttribute (string localName, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlNode RemoveAttributeAt (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute RemoveAttributeNode (XmlAttribute oldAttr)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute RemoveAttributeNode (string localName, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void SetAttribute (string name, string value)
+ {
+ XmlAttribute attribute = OwnerDocument.CreateAttribute (name);
+ attribute.SetOwnerElement (this);
+ attribute.Value = value;
+ Attributes.SetNamedItem (attribute);
+ }
+
+ [MonoTODO]
+ public virtual string SetAttribute (string localName, string namespaceURI, string value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute SetAttributeNode (XmlAttribute newAttr)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlAttribute SetAttributeNode (string localName, string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ foreach(XmlNode childNode in ChildNodes)
+ childNode.WriteTo(w);
+ }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteStartElement(LocalName);
+
+ foreach(XmlNode attributeNode in Attributes)
+ attributeNode.WriteTo(w);
+
+ WriteContentTo(w);
+
+ w.WriteEndElement();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlEntity.cs b/mcs/class/System.XML/System.Xml/XmlEntity.cs
new file mode 100755
index 00000000000..dc9f51dfe9b
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlEntity.cs
@@ -0,0 +1,122 @@
+//
+// System.Xml.XmlEntity.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public class XmlEntity : XmlNode
+ {
+ #region Constructors
+
+ internal XmlEntity (string name, string NDATA, string publicId, string systemId,
+ XmlDocument doc)
+ : base (doc)
+ {
+ this.name = name;
+ this.NDATA = NDATA;
+ this.publicId = publicId;
+ this.systemId = systemId;
+ }
+
+ #endregion
+
+ #region Fields
+
+ string name;
+ string NDATA;
+ string publicId;
+ string systemId;
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public override string BaseURI {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override string InnerText {
+ get { throw new NotImplementedException (); }
+ set { throw new InvalidOperationException ("This operation is not supported."); }
+ }
+
+ public override string InnerXml {
+ get { return String.Empty; }
+ set { throw new InvalidOperationException ("This operation is not supported."); }
+ }
+
+ public override bool IsReadOnly {
+ get { return true; } // always read-only.
+ }
+
+ public override string LocalName {
+ get { return name; }
+ }
+
+ public override string Name {
+ get { return name; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Entity; }
+ }
+
+ public string NotationName {
+ get {
+ if (NDATA == null)
+ return null;
+ else
+ return NDATA;
+ }
+ }
+
+ public override string OuterXml {
+ get { return String.Empty; }
+ }
+
+ public string PublicId {
+ get {
+ if (publicId == null)
+ return null;
+ else
+ return publicId;
+ }
+ }
+
+ public string SystemId {
+ get {
+ if (publicId == null)
+ return null;
+ else
+ return systemId;
+ }
+ }
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ throw new InvalidOperationException ("This operation is not supported.");
+ }
+
+ public override void WriteContentTo (XmlWriter w)
+ {
+ // No effect.
+ }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ // No effect.
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlEntityReference.cs b/mcs/class/System.XML/System.Xml/XmlEntityReference.cs
new file mode 100644
index 00000000000..b0b4aae79c9
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlEntityReference.cs
@@ -0,0 +1,70 @@
+//
+// System.Xml.XmlEntityReference.cs
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Xml
+{
+ public class XmlEntityReference : XmlLinkedNode
+ {
+ string entityName;
+
+ // Constructor
+ protected internal XmlEntityReference (string name, XmlDocument doc)
+ : base (doc)
+ {
+ entityName = name;
+ }
+
+ // Properties
+ [MonoTODO]
+ public override string BaseURI {
+ get { return null; }
+ }
+
+ public override bool IsReadOnly {
+ get { return true; }
+ }
+
+ public override string LocalName {
+ get { return entityName; } // name of the entity referenced.
+ }
+
+ public override string Name {
+ get { return entityName; } // name of the entity referenced.
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.EntityReference; }
+ }
+
+ public override string Value {
+ get { return null; } // always return null here.
+ }
+
+ // Methods
+ public override XmlNode CloneNode (bool deep)
+ {
+
+ // API docs: "The replacement text is not included." XmlNode.CloneNode
+ // "The replacement text is set when node is inserted." XmlEntityReference.CloneNode
+ //
+ return new XmlEntityReference ("", OwnerDocument);
+ }
+
+ [MonoTODO]
+ public override void WriteContentTo (XmlWriter w)
+ {
+ }
+
+ [MonoTODO]
+ public override void WriteTo (XmlWriter w)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlException.cs b/mcs/class/System.XML/System.Xml/XmlException.cs
new file mode 100755
index 00000000000..a9e291fbe93
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlException.cs
@@ -0,0 +1,81 @@
+//
+// XmlException.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Xml
+{
+ [Serializable]
+ public class XmlException : SystemException
+ {
+ #region Fields
+
+ string msg; // Cache message here because SystemException doesn't expose it
+ int lineNumber;
+ int linePosition;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ msg = message;
+ }
+
+ protected XmlException (SerializationInfo info, StreamingContext context)
+ {
+ this.lineNumber = info.GetInt32 ("lineNumber");
+ this.linePosition = info.GetInt32 ("linePosition");
+ }
+
+ internal XmlException (string message)
+ : base (message)
+ {
+ msg = message;
+ }
+
+ internal XmlException (string message, int lineNumber, int linePosition) : base (message)
+ {
+ this.lineNumber = lineNumber;
+ this.linePosition = linePosition;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int LineNumber {
+ get { return lineNumber; }
+ }
+
+ public int LinePosition {
+ get { return linePosition; }
+ }
+
+ public override string Message {
+ get { return msg; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("lineNumber", lineNumber);
+ info.AddValue ("linePosition", linePosition);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlImplementation.cs b/mcs/class/System.XML/System.Xml/XmlImplementation.cs
new file mode 100644
index 00000000000..c76875d30bc
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlImplementation.cs
@@ -0,0 +1,32 @@
+//
+// System.Xml.XmlImplementation.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public class XmlImplementation
+ {
+ public XmlImplementation ()
+ : base ()
+ {
+ }
+
+ public virtual XmlDocument CreateDocument ()
+ {
+ return new XmlDocument (this);
+ }
+
+ public bool HasFeature (string strFeature, string strVersion)
+ {
+ if ((strVersion == "XML") || (strVersion == "xml") // not case-sensitive
+ && (strVersion == "1.0") || (strVersion == "2.0"))
+ return true;
+ else
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlLinkedNode.cs b/mcs/class/System.XML/System.Xml/XmlLinkedNode.cs
new file mode 100644
index 00000000000..f7b64e8a30d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlLinkedNode.cs
@@ -0,0 +1,46 @@
+using System;
+
+namespace System.Xml
+{
+ public abstract class XmlLinkedNode : XmlNode
+ {
+ #region Fields
+ XmlLinkedNode nextSibling;
+
+ #endregion
+
+ #region Constructors
+ internal XmlLinkedNode(XmlDocument doc) : base(doc) { }
+
+ #endregion
+
+ #region Properties
+ public override XmlNode NextSibling
+ {
+ get {
+ if (Object.ReferenceEquals(nextSibling, ParentNode.LastLinkedChild.NextLinkedSibling) == false) {
+ return nextSibling;
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ internal XmlLinkedNode NextLinkedSibling
+ {
+ get { return nextSibling; }
+ set { nextSibling = value; }
+ }
+
+ [MonoTODO]
+ public override XmlNode PreviousSibling
+ {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNameTable.cs b/mcs/class/System.XML/System.Xml/XmlNameTable.cs
new file mode 100644
index 00000000000..7de896f0fc4
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNameTable.cs
@@ -0,0 +1,20 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Xml.XmlNameTable.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml
+{
+ public abstract class XmlNameTable
+ {
+ public abstract string Add (string name);
+ public abstract string Add (char [] buffer, int offset, int length);
+ public abstract string Get (string name);
+ public abstract string Get (char [] buffer, int offset, int length);
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNamedNodeMap.cs b/mcs/class/System.XML/System.Xml/XmlNamedNodeMap.cs
new file mode 100644
index 00000000000..d9cd04a6426
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNamedNodeMap.cs
@@ -0,0 +1,104 @@
+//
+// System.Xml.XmlNamedNodeMap
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml
+{
+ public class XmlNamedNodeMap : IEnumerable
+ {
+ XmlNode parent;
+ ArrayList nodeList;
+ bool readOnly = false;
+
+ internal XmlNamedNodeMap (XmlNode parent)
+ {
+ this.parent = parent;
+ nodeList = new ArrayList ();
+ }
+
+ public virtual int Count {
+ get { return nodeList.Count; }
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return nodeList.GetEnumerator ();
+ }
+
+ public virtual XmlNode GetNamedItem (string name)
+ {
+ foreach (XmlNode node in nodeList) {
+ if (node.Name == name)
+ return node;
+ }
+ return null;
+ }
+
+ public virtual XmlNode GetNamedItem (string localName, string namespaceURI)
+ {
+ foreach (XmlNode node in nodeList) {
+ if ((node.Name == localName)
+ && (parent.NamespaceURI == namespaceURI))
+ return node;
+ }
+
+ return null;
+ }
+
+ public virtual XmlNode Item (int index)
+ {
+ if (index < 0 || index > nodeList.Count)
+ return null;
+ else
+ return (XmlNode) nodeList [index];
+ }
+
+ public virtual XmlNode RemoveNamedItem (string name)
+ {
+ foreach (XmlNode node in nodeList)
+ if (node.Name == name) {
+ nodeList.Remove (node);
+ return node;
+ }
+
+ return null;
+ }
+
+ public virtual XmlNode RemoveNamedItem (string localName, string namespaceURI)
+ {
+ foreach (XmlNode node in nodeList)
+ if ((node.Name == localName)
+ && (parent.NamespaceURI == namespaceURI)) {
+ nodeList.Remove (node);
+ return node;
+ }
+
+ return null;
+ }
+
+ public virtual XmlNode SetNamedItem (XmlNode node)
+ {
+ if (readOnly || (node.OwnerDocument != parent.OwnerDocument))
+ throw new ArgumentException ("Cannot add to NodeMap.");
+
+ foreach (XmlNode x in nodeList)
+ if (x.Name == node.Name) {
+ nodeList.Remove (x);
+ nodeList.Add (x);
+ return x;
+ }
+
+ nodeList.Add (node);
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs b/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
new file mode 100644
index 00000000000..56dcaf5d88c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNamespaceManager.cs
@@ -0,0 +1,155 @@
+//
+// XmlNamespaceManager.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+using System.Collections;
+
+namespace System.Xml
+{
+ public class XmlNamespaceManager : IEnumerable
+ {
+ #region Fields
+
+ private XmlNameTable nameTable;
+ private NamespaceScope currentScope;
+
+ #endregion
+
+ #region Constructor
+
+ public XmlNamespaceManager (XmlNameTable nameTable)
+ {
+ this.nameTable = nameTable;
+
+ nameTable.Add ("xmlns");
+ nameTable.Add ("xml");
+ nameTable.Add (String.Empty);
+ nameTable.Add ("http://www.w3.org/2000/xmlns/");
+ nameTable.Add ("http://www.w3.org/XML/1998/namespace");
+
+ PushScope ();
+ }
+
+ #endregion
+
+ #region Properties
+
+ public virtual string DefaultNamespace {
+ get { return LookupNamespace (String.Empty); }
+ }
+
+ public XmlNameTable NameTable {
+ get { return nameTable; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public virtual void AddNamespace (string prefix, string uri)
+ {
+ if (prefix == null)
+ throw new ArgumentNullException ("prefix", "Value cannot be null.");
+
+ if (uri == null)
+ throw new ArgumentNullException ("uri", "Value cannot be null.");
+
+ if (prefix.Length > 2 && prefix.Substring (0, 3).ToLower () == "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");
+
+ if (currentScope.Namespaces == null)
+ currentScope.Namespaces = new Hashtable ();
+
+ currentScope.Namespaces.Add (nameTable.Add (prefix), nameTable.Add (uri));
+ }
+
+ [MonoTODO]
+ public virtual IEnumerator GetEnumerator ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual bool HasNamespace (string prefix)
+ {
+ return currentScope != null && currentScope.Namespaces != null && currentScope.Namespaces.Contains (prefix);
+ }
+
+ public virtual string LookupNamespace (string prefix)
+ {
+ NamespaceScope scope = currentScope;
+
+ while (scope != null) {
+ if (scope.Namespaces != null && scope.Namespaces.Contains (prefix))
+ return scope.Namespaces[prefix] as string;
+ scope = scope.Next;
+ }
+
+ switch (prefix) {
+ case "xmlns":
+ return nameTable.Get ("http://www.w3.org/2000/xmlns/");
+ case "xml":
+ return nameTable.Get ("http://www.w3.org/XML/1998/namespace");
+ case "":
+ return nameTable.Get (String.Empty);
+ }
+
+ return null;
+ }
+
+ public virtual string LookupPrefix (string uri)
+ {
+ if (uri == null)
+ return null;
+
+ NamespaceScope scope = currentScope;
+
+ while (scope != null)
+ {
+ if (scope.Namespaces != null && scope.Namespaces.ContainsValue (uri)) {
+ foreach (DictionaryEntry entry in scope.Namespaces) {
+ if (entry.Value.ToString() == uri)
+ return nameTable.Get (entry.Key as string) as string;
+ }
+ }
+
+ scope = scope.Next;
+ }
+
+ return String.Empty;
+ }
+
+ public virtual bool PopScope ()
+ {
+ if (currentScope != null)
+ currentScope = currentScope.Next;
+
+ return currentScope != null;
+ }
+
+ public virtual void PushScope ()
+ {
+ NamespaceScope newScope = new NamespaceScope ();
+ newScope.Next = currentScope;
+ currentScope = newScope;
+ }
+
+ [MonoTODO]
+ public virtual void RemoveNamespace (string prefix, string uri)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+
+ internal class NamespaceScope
+ {
+ internal NamespaceScope Next;
+ internal Hashtable Namespaces;
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNode.cs b/mcs/class/System.XML/System.Xml/XmlNode.cs
new file mode 100644
index 00000000000..87fbc8aa214
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNode.cs
@@ -0,0 +1,353 @@
+//
+// System.Xml.XmlNode
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Xml.XPath;
+
+namespace System.Xml
+{
+ public abstract class XmlNode : ICloneable, IEnumerable, IXPathNavigable
+ {
+ #region Fields
+
+ XmlDocument ownerDocument;
+ XmlNode parentNode;
+
+ #endregion
+
+ #region Constructors
+
+ internal XmlNode (XmlDocument ownerDocument)
+ {
+ this.ownerDocument = ownerDocument;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public virtual XmlAttributeCollection Attributes
+ {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public virtual string BaseURI
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ public virtual XmlNodeList ChildNodes {
+ get {
+ return new XmlNodeListChildren(this);
+ }
+ }
+
+ public virtual XmlNode FirstChild {
+ get {
+ if (LastChild != null) {
+ return LastLinkedChild.NextLinkedSibling;
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+ public virtual bool HasChildNodes {
+ get { return LastChild != null; }
+ }
+
+ [MonoTODO]
+ public virtual string InnerText {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO("Setter.")]
+ public virtual string InnerXml {
+ get {
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+
+ WriteContentTo(xtw);
+
+ return sw.GetStringBuilder().ToString();
+ }
+
+ set { throw new NotImplementedException (); }
+ }
+
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+
+ [System.Runtime.CompilerServices.IndexerName("Item")]
+ public virtual XmlElement this [string name] {
+ get {
+ foreach (XmlNode node in ChildNodes) {
+ if ((node.NodeType == XmlNodeType.Element) &&
+ (node.Name == name)) {
+ return (XmlElement) node;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ [System.Runtime.CompilerServices.IndexerName("Item")]
+ public virtual XmlElement this [string localname, string ns] {
+ get {
+ foreach (XmlNode node in ChildNodes) {
+ if ((node.NodeType == XmlNodeType.Element) &&
+ (node.LocalName == localname) &&
+ (node.NamespaceURI == ns)) {
+ return (XmlElement) node;
+ }
+ }
+
+ return null;
+ }
+ }
+
+ public virtual XmlNode LastChild {
+ get { return LastLinkedChild; }
+ }
+
+ internal virtual XmlLinkedNode LastLinkedChild {
+ get { return null; }
+ set { }
+ }
+
+ public abstract string LocalName { get; }
+
+ public abstract string Name { get; }
+
+ [MonoTODO]
+ public virtual string NamespaceURI {
+ get { throw new NotImplementedException (); }
+ }
+
+ public virtual XmlNode NextSibling {
+ get { return null; }
+ }
+
+ public abstract XmlNodeType NodeType { get; }
+
+ public virtual string OuterXml {
+ get {
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+
+ WriteTo(xtw);
+
+ return sw.GetStringBuilder().ToString();
+ }
+ }
+
+ public virtual XmlDocument OwnerDocument {
+ get { return ownerDocument; }
+ }
+
+ public virtual XmlNode ParentNode {
+ get { return parentNode; }
+ }
+
+ [MonoTODO]
+ public virtual string Prefix {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public virtual XmlNode PreviousSibling {
+ get { return null; }
+ }
+
+ public virtual string Value {
+ get { return null; }
+ set { throw new InvalidOperationException ("This node does not have a value"); }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public virtual XmlNode AppendChild (XmlNode newChild)
+ {
+ if (NodeType == XmlNodeType.Document
+ || NodeType == XmlNodeType.Element
+ || NodeType == XmlNodeType.Attribute) {
+ XmlLinkedNode newLinkedChild = (XmlLinkedNode) newChild;
+ XmlLinkedNode lastLinkedChild = LastLinkedChild;
+
+ newLinkedChild.parentNode = this;
+
+ if (lastLinkedChild != null) {
+ newLinkedChild.NextLinkedSibling = lastLinkedChild.NextLinkedSibling;
+ lastLinkedChild.NextLinkedSibling = newLinkedChild;
+ } else
+ newLinkedChild.NextLinkedSibling = newLinkedChild;
+
+ LastLinkedChild = newLinkedChild;
+
+ return newChild;
+ } else
+ throw new InvalidOperationException();
+ }
+
+ [MonoTODO]
+ public virtual XmlNode Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract XmlNode CloneNode (bool deep);
+
+ [MonoTODO]
+ public XPathNavigator CreateNavigator ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new XmlNodeListChildren(this).GetEnumerator();
+ }
+
+ [MonoTODO]
+ public virtual string GetNamespaceOfPrefix (string prefix)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string GetPrefixOfNamespace (string namespaceURI)
+ {
+ throw new NotImplementedException ();
+ }
+
+ object ICloneable.Clone ()
+ {
+ return Clone ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ [MonoTODO]
+ public virtual XmlNode InsertAfter (XmlNode newChild, XmlNode refChild)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlNode InsertBefore (XmlNode newChild, XmlNode refChild)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void Normalize ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlNode PrependChild (XmlNode newChild)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void RemoveAll ()
+ {
+ LastLinkedChild = null;
+ }
+
+ public virtual XmlNode RemoveChild (XmlNode oldChild)
+ {
+ if (NodeType == XmlNodeType.Document || NodeType == XmlNodeType.Element || NodeType == XmlNodeType.Attribute)
+ {
+ if (IsReadOnly)
+ throw new ArgumentException();
+
+ if (Object.ReferenceEquals(LastLinkedChild, LastLinkedChild.NextLinkedSibling) && Object.ReferenceEquals(LastLinkedChild, oldChild))
+ LastLinkedChild = null;
+ else {
+ XmlLinkedNode oldLinkedChild = (XmlLinkedNode)oldChild;
+ XmlLinkedNode beforeLinkedChild = LastLinkedChild;
+
+ while (!Object.ReferenceEquals(beforeLinkedChild.NextLinkedSibling, LastLinkedChild) && !Object.ReferenceEquals(beforeLinkedChild.NextLinkedSibling, oldLinkedChild))
+ beforeLinkedChild = beforeLinkedChild.NextLinkedSibling;
+
+ if (!Object.ReferenceEquals(beforeLinkedChild.NextLinkedSibling, oldLinkedChild))
+ throw new ArgumentException();
+
+ beforeLinkedChild.NextLinkedSibling = oldLinkedChild.NextLinkedSibling;
+ oldLinkedChild.NextLinkedSibling = null;
+ }
+
+ return oldChild;
+ }
+ else
+ throw new ArgumentException();
+ }
+
+ [MonoTODO]
+ public virtual XmlNode ReplaceChild (XmlNode newChild, XmlNode oldChild)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlNodeList SelectNodes (string xpath)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlNodeList SelectNodes (string xpath, XmlNamespaceManager nsmgr)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlNode SelectSingleNode (string xpath)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlNode SelectSingleNode (string xpath, XmlNamespaceManager nsmgr)
+ {
+ throw new NotImplementedException ();
+ }
+
+ internal void SetParentNode (XmlNode parent)
+ {
+ parentNode = parent;
+ }
+
+ [MonoTODO]
+ public virtual bool Supports (string feature, string version)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract void WriteContentTo (XmlWriter w);
+
+ public abstract void WriteTo (XmlWriter w);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeChangedAction.cs b/mcs/class/System.XML/System.Xml/XmlNodeChangedAction.cs
new file mode 100755
index 00000000000..811edfd92f0
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeChangedAction.cs
@@ -0,0 +1,27 @@
+using System;
+
+namespace System.Xml
+{
+ /// <summary>
+ /// Enumeration of node changed actions.
+ /// </summary>
+ public enum XmlNodeChangedAction
+ {
+
+ /// <summary>
+ /// A node is being inserted in the tree
+ /// </summary>
+ Insert = 0,
+
+ /// <summary>
+ /// A node is being removed from the tree.
+ /// </summary>
+ Remove = 1,
+
+ /// <summary>
+ /// A node is being changed.
+ /// </summary>
+ Change = 2,
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeChangedEventArgs.cs b/mcs/class/System.XML/System.Xml/XmlNodeChangedEventArgs.cs
new file mode 100644
index 00000000000..29a842ad55d
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeChangedEventArgs.cs
@@ -0,0 +1,67 @@
+using System;
+
+namespace System.Xml
+{
+ /// <summary>
+ /// Passed to delegates on document tree changes
+ /// </summary>
+ public class XmlNodeChangedEventArgs
+ {
+ // Private data members
+ XmlNode _oldParent;
+ XmlNode _newParent;
+ XmlNodeChangedAction _action;
+ XmlNode _node;
+
+ // public properties
+ public XmlNodeChangedAction Action
+ {
+ get
+ {
+ return _action;
+ }
+ }
+
+ public XmlNode Node
+ {
+ get
+ {
+ return _node;
+ }
+ }
+
+
+ public XmlNode OldParent
+ {
+ get
+ {
+ return _oldParent;
+ }
+ }
+
+
+ public XmlNode NewParent
+ {
+ get
+ {
+ return _newParent;
+ }
+ }
+
+
+ // Public Methods
+ // Internal Methods
+ internal XmlNodeChangedEventArgs(
+ XmlNodeChangedAction action,
+ XmlNode node,
+ XmlNode oldParent,
+ XmlNode newParent)
+ {
+ _node = node;
+ _oldParent = oldParent;
+ _newParent = newParent;
+ _action = action;
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeChangedEventHandler.cs b/mcs/class/System.XML/System.Xml/XmlNodeChangedEventHandler.cs
new file mode 100755
index 00000000000..161482276d2
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeChangedEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// System.Xml.XmlNodeChangedEventHandler.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public delegate void XmlNodeChangedEventHandler (Object sender,
+ XmlNodeChangedEventArgs e);
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeList.cs b/mcs/class/System.XML/System.Xml/XmlNodeList.cs
new file mode 100644
index 00000000000..eff56279b55
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeList.cs
@@ -0,0 +1,42 @@
+//
+// System.Xml.XmlNodeList
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml
+{
+ public abstract class XmlNodeList : IEnumerable
+ {
+ #region Constructors
+
+ protected XmlNodeList() { }
+
+ #endregion
+
+ #region Properties
+
+ public abstract int Count { get; }
+
+ [System.Runtime.CompilerServices.IndexerName("ItemOf")]
+ public virtual XmlNode this [int i] {
+ get { return Item(i); }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public abstract IEnumerator GetEnumerator ();
+
+ public abstract XmlNode Item (int index);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeListChildren.cs b/mcs/class/System.XML/System.Xml/XmlNodeListChildren.cs
new file mode 100644
index 00000000000..c5d62823503
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeListChildren.cs
@@ -0,0 +1,146 @@
+//
+// System.Xml.XmlNodeList
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Collections;
+
+namespace System.Xml
+{
+ internal class XmlNodeListChildren : XmlNodeList
+ {
+ #region Enumerator
+
+ private class Enumerator : IEnumerator
+ {
+ XmlNode parent;
+ XmlLinkedNode currentChild;
+ bool passedLastNode;
+
+ internal Enumerator (XmlNode parent)
+ {
+ currentChild = null;
+ this.parent = parent;
+ passedLastNode = false;
+ }
+
+ public virtual object Current {
+ get {
+ if ((currentChild == null) ||
+ (parent.LastLinkedChild == null) ||
+ (passedLastNode == true))
+ throw new InvalidOperationException();
+
+ return currentChild;
+ }
+ }
+
+ public virtual bool MoveNext()
+ {
+ bool movedNext = true;
+
+ if (parent.LastLinkedChild == null) {
+ movedNext = false;
+ }
+ else if (currentChild == null) {
+ currentChild = parent.LastLinkedChild.NextLinkedSibling;
+ }
+ else {
+ if (Object.ReferenceEquals(currentChild, parent.LastLinkedChild)) {
+ movedNext = false;
+ passedLastNode = true;
+ }
+ else {
+ currentChild = currentChild.NextLinkedSibling;
+ }
+ }
+
+ return movedNext;
+ }
+
+ public virtual void Reset()
+ {
+ currentChild = null;
+ }
+ }
+
+ #endregion
+
+ #region Fields
+
+ XmlNode parent;
+
+ #endregion
+
+ #region Constructors
+ public XmlNodeListChildren(XmlNode parent)
+ {
+ this.parent = parent;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override int Count {
+ get {
+ int count = 0;
+
+ if (parent.LastLinkedChild != null) {
+ XmlLinkedNode currentChild = parent.LastLinkedChild.NextLinkedSibling;
+
+ count = 1;
+ while (!Object.ReferenceEquals(currentChild, parent.LastLinkedChild)) {
+ currentChild = currentChild.NextLinkedSibling;
+ count++;
+ }
+ }
+
+ return count;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override IEnumerator GetEnumerator ()
+ {
+ return new Enumerator(parent);
+ }
+
+ public override XmlNode Item (int index)
+ {
+ XmlNode requestedNode = null;
+
+ // Instead of checking for && index < Count which has to walk
+ // the whole list to get a count, we'll just keep a count since
+ // we have to walk the list anyways to get to index.
+ if ((index >= 0) && (parent.LastLinkedChild != null)) {
+ XmlLinkedNode currentChild = parent.LastLinkedChild.NextLinkedSibling;
+ int count = 0;
+
+ while ((count < index) && !Object.ReferenceEquals(currentChild, parent.LastLinkedChild))
+ {
+ currentChild = currentChild.NextLinkedSibling;
+ count++;
+ }
+
+ if (count == index) {
+ requestedNode = currentChild;
+ }
+ }
+
+ return requestedNode;
+ }
+
+ #endregion
+ }
+
+
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeOrder.cs b/mcs/class/System.XML/System.Xml/XmlNodeOrder.cs
new file mode 100755
index 00000000000..9550967bbe6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeOrder.cs
@@ -0,0 +1,19 @@
+//
+// System.Xml.XmlNodeOrder.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ [Serializable]
+ public enum XmlNodeOrder
+ {
+ Before = 0,
+ After = 1,
+ Same = 2,
+ Unknown = 3,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeReader.cs b/mcs/class/System.XML/System.Xml/XmlNodeReader.cs
new file mode 100755
index 00000000000..064ac473d14
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeReader.cs
@@ -0,0 +1,247 @@
+//
+// System.Xml.XmlNodeReader.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ public class XmlNodeReader : XmlReader
+ {
+ #region Constructor
+
+ [MonoTODO]
+ public XmlNodeReader (XmlNode node)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ [MonoTODO]
+ public override int AttributeCount {
+ get { return 0; }
+ }
+
+ [MonoTODO]
+ public override string BaseURI {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public override bool CanResolveEntity {
+ get { return false; }
+ }
+
+ [MonoTODO]
+ public override int Depth {
+ get { return 0; }
+ }
+
+ [MonoTODO]
+ public override bool EOF {
+ get { return false; }
+ }
+
+ [MonoTODO]
+ public override bool HasAttributes {
+ get { return false; }
+ }
+
+ [MonoTODO]
+ public override bool HasValue {
+ get { return false; }
+ }
+
+ [MonoTODO]
+ public override bool IsDefault {
+ get { return false; }
+ }
+
+ [MonoTODO]
+ public override bool IsEmptyElement {
+ get { return false; }
+ }
+
+ [MonoTODO]
+ public override string this [int i] {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public override string this [string name] {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public override string this [string name, string namespaceURI] {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public override string LocalName {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public override string Name {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public override string NamespaceURI {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public override XmlNameTable NameTable {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public override XmlNodeType NodeType {
+ get { return 0; }
+ }
+
+ [MonoTODO]
+ public override string Prefix {
+ get { return null; }
+ }
+
+ public override char QuoteChar {
+ get { return '"'; }
+ }
+
+ [MonoTODO]
+ public override ReadState ReadState {
+ get { return 0; }
+ }
+
+ [MonoTODO]
+ public override string Value {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public override string XmlLang {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public override XmlSpace XmlSpace {
+ get { return 0; }
+ }
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override void Close ()
+ {
+ }
+
+ [MonoTODO]
+ public override string GetAttribute (int attributeIndex)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ public override string GetAttribute (string name)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ public override string GetAttribute (string name, string namespaceURI)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ public override string LookupNamespace (string prefix)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ public override void MoveToAttribute (int attributeIndex)
+ {
+ }
+
+ [MonoTODO]
+ public override bool MoveToAttribute (string name)
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public override bool MoveToAttribute (string name, string namespaceURI)
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public override bool MoveToElement ()
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public override bool MoveToFirstAttribute ()
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public override bool MoveToNextAttribute ()
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public override bool Read ()
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public override bool ReadAttributeValue ()
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ public override string ReadInnerXml ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ public override string ReadOuterXml ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ public override string ReadString ()
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ public override void ResolveEntity ()
+ {
+ }
+
+ [MonoTODO]
+ public override void Skip ()
+ {
+ }
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlNodeType.cs b/mcs/class/System.XML/System.Xml/XmlNodeType.cs
new file mode 100644
index 00000000000..8ed73dd8db6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNodeType.cs
@@ -0,0 +1,93 @@
+// XmlNodeType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:46 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// </summary>
+ public enum XmlNodeType {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ Element = 1,
+
+ /// <summary>
+ /// </summary>
+ Attribute = 2,
+
+ /// <summary>
+ /// </summary>
+ Text = 3,
+
+ /// <summary>
+ /// </summary>
+ CDATA = 4,
+
+ /// <summary>
+ /// </summary>
+ EntityReference = 5,
+
+ /// <summary>
+ /// </summary>
+ Entity = 6,
+
+ /// <summary>
+ /// </summary>
+ ProcessingInstruction = 7,
+
+ /// <summary>
+ /// </summary>
+ Comment = 8,
+
+ /// <summary>
+ /// </summary>
+ Document = 9,
+
+ /// <summary>
+ /// </summary>
+ DocumentType = 10,
+
+ /// <summary>
+ /// </summary>
+ DocumentFragment = 11,
+
+ /// <summary>
+ /// </summary>
+ Notation = 12,
+
+ /// <summary>
+ /// </summary>
+ Whitespace = 13,
+
+ /// <summary>
+ /// </summary>
+ SignificantWhitespace = 14,
+
+ /// <summary>
+ /// </summary>
+ EndElement = 15,
+
+ /// <summary>
+ /// </summary>
+ EndEntity = 16,
+
+ /// <summary>
+ /// </summary>
+ XmlDeclaration = 17,
+ } // XmlNodeType
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/XmlNotation.cs b/mcs/class/System.XML/System.Xml/XmlNotation.cs
new file mode 100755
index 00000000000..7a8ddbd91c8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlNotation.cs
@@ -0,0 +1,100 @@
+//
+// System.Xml.XmlNotation.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+namespace System.Xml
+{
+ public class XmlNotation : XmlNode
+ {
+ #region Fields
+
+ string localName;
+ string publicId;
+ string systemId;
+ string prefix;
+
+ #endregion
+
+ #region Constructor
+
+ internal XmlNotation (string localName, string prefix, string publicId,
+ string systemId, XmlDocument doc)
+ : base (doc)
+ {
+ this.localName = localName;
+ this.prefix = prefix;
+ this.publicId = publicId;
+ this.systemId = systemId;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override string InnerXml {
+ get { return String.Empty; }
+ set { throw new InvalidOperationException ("This operation is not allowed."); }
+ }
+
+ public override bool IsReadOnly {
+ get { return true; } // Notation nodes are always read-only
+ }
+
+ public override string LocalName {
+ get { return localName; }
+ }
+
+ public override string Name {
+ get { return prefix + ":" + localName; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Notation; }
+ }
+
+ public override string OuterXml {
+ get { return String.Empty; }
+ }
+
+ public string PublicId {
+ get {
+ if (publicId != null)
+ return publicId;
+ else
+ return null;
+ }
+ }
+
+ public string SystemId {
+ get {
+ if (systemId != null)
+ return systemId;
+ else
+ return null;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ throw new InvalidOperationException ("This operation is not allowed.");
+ }
+
+ public override void WriteContentTo (XmlWriter w) { } // has no effect.
+
+ public override void WriteTo (XmlWriter w) { } // has no effect.
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlParserContext.cs b/mcs/class/System.XML/System.Xml/XmlParserContext.cs
new file mode 100644
index 00000000000..58c5536a6d1
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlParserContext.cs
@@ -0,0 +1,186 @@
+//
+// System.Xml.XmlParserContext
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001, 2002 Jason Diamond http://injektilo.org/
+//
+
+using System.Text;
+
+namespace System.Xml
+{
+ public class XmlParserContext
+ {
+ #region Constructors
+
+ public XmlParserContext (
+ XmlNameTable nt,
+ XmlNamespaceManager nsMgr,
+ string xmlLang,
+ XmlSpace xmlSpace) :
+
+ this (
+ nt,
+ nsMgr,
+ null,
+ null,
+ null,
+ null,
+ null,
+ xmlLang,
+ xmlSpace,
+ null
+ )
+ {
+ }
+
+ public XmlParserContext (
+ XmlNameTable nt,
+ XmlNamespaceManager nsMgr,
+ string xmlLang,
+ XmlSpace xmlSpace,
+ Encoding enc) :
+
+ this (
+ nt,
+ nsMgr,
+ null,
+ null,
+ null,
+ null,
+ null,
+ xmlLang,
+ xmlSpace,
+ enc
+ )
+ {
+ }
+
+ public XmlParserContext (
+ XmlNameTable nt,
+ XmlNamespaceManager nsMgr,
+ string docTypeName,
+ string pubId,
+ string sysId,
+ string internalSubset,
+ string baseURI,
+ string xmlLang,
+ XmlSpace xmlSpace) :
+
+ this (
+ nt,
+ nsMgr,
+ null,
+ null,
+ null,
+ null,
+ null,
+ xmlLang,
+ xmlSpace,
+ null
+ )
+ {
+ }
+
+ public XmlParserContext (
+ XmlNameTable nt,
+ XmlNamespaceManager nsMgr,
+ string docTypeName,
+ string pubId,
+ string sysId,
+ string internalSubset,
+ string baseURI,
+ string xmlLang,
+ XmlSpace xmlSpace,
+ Encoding enc)
+ {
+ if (nt == null)
+ this.nameTable = nsMgr.NameTable;
+ else
+ this.NameTable = nt;
+
+ this.namespaceManager = nsMgr;
+ this.docTypeName = docTypeName;
+ this.publicID = pubId;
+ this.systemID = sysId;
+ this.internalSubset = internalSubset;
+ this.baseURI = baseURI;
+ this.xmlLang = xmlLang;
+ this.xmlSpace = xmlSpace;
+ this.encoding = enc;
+ }
+
+ #endregion
+
+ #region Fields
+
+ private string baseURI;
+ private string docTypeName;
+ private Encoding encoding;
+ private string internalSubset;
+ private XmlNamespaceManager namespaceManager;
+ private XmlNameTable nameTable;
+ private string publicID;
+ private string systemID;
+ private string xmlLang;
+ private XmlSpace xmlSpace;
+
+ #endregion
+
+ #region Properties
+
+ public string BaseURI {
+ get { return baseURI; }
+ set { baseURI = value; }
+ }
+
+ public string DocTypeName {
+ get { return docTypeName; }
+ set { docTypeName = value; }
+ }
+
+ public Encoding Encoding {
+ get { return encoding; }
+ set { encoding = value; }
+ }
+
+ public string InternalSubset {
+ get { return internalSubset; }
+ set { internalSubset = value; }
+ }
+
+ public XmlNamespaceManager NamespaceManager {
+ get { return namespaceManager; }
+ set { namespaceManager = value; }
+ }
+
+ public XmlNameTable NameTable {
+ get { return nameTable; }
+ set { nameTable = value; }
+ }
+
+ public string PublicId {
+ get { return publicID; }
+ set { publicID = value; }
+ }
+
+ public string SystemId {
+ get { return systemID; }
+ set { systemID = value; }
+ }
+
+ public string XmlLang {
+ get { return xmlLang; }
+ set { xmlLang = value; }
+ }
+
+ public XmlSpace XmlSpace {
+ get { return xmlSpace; }
+ set { xmlSpace = value; }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlProcessingInstruction.cs b/mcs/class/System.XML/System.Xml/XmlProcessingInstruction.cs
new file mode 100644
index 00000000000..c328935a7fe
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlProcessingInstruction.cs
@@ -0,0 +1,96 @@
+//
+// System.Xml.XmlProcessingInstruction
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+
+namespace System.Xml
+{
+ public class XmlProcessingInstruction : XmlLinkedNode
+ {
+ string target;
+ string data;
+
+ #region Constructors
+
+ protected internal XmlProcessingInstruction (string target, string data, XmlDocument doc) : base(doc)
+ {
+ if (data == null)
+ data = String.Empty;
+
+ this.target = target;
+ this.data = data;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public string Data
+ {
+ get { return data; }
+
+ set { data = value; }
+ }
+
+ public override string InnerText
+ {
+ get { return Data; }
+ set { data = value; }
+ }
+
+ public override string LocalName
+ {
+ get { return target; }
+ }
+
+ public override string Name
+ {
+ get { return target; }
+ }
+
+ public override XmlNodeType NodeType
+ {
+ get { return XmlNodeType.ProcessingInstruction; }
+ }
+
+ public string Target
+ {
+ get { return target; }
+ }
+
+ public override string Value
+ {
+ get { return data; }
+ set {
+ if (this.IsReadOnly)
+ throw new ArgumentException ("This node is read-only.");
+ else
+ data = value;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override XmlNode CloneNode (bool deep)
+ {
+ return new XmlProcessingInstruction (target, data, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w) { }
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteProcessingInstruction (target, data);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs b/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs
new file mode 100644
index 00000000000..8e559a749ba
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlQualifiedName.cs
@@ -0,0 +1,104 @@
+//
+// System.Xml.XmlQualifiedName.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Xml
+{
+ public class XmlQualifiedName
+ {
+ // Constructors
+ public XmlQualifiedName ()
+ : base ()
+ {
+ }
+
+ public XmlQualifiedName (string name)
+ : base ()
+ {
+ this.name = name;
+ }
+
+ public XmlQualifiedName (string name, string ns)
+ : base ()
+ {
+ this.name = name;
+ this.ns = ns;
+ }
+
+ // Fields
+ public static readonly XmlQualifiedName Empty = new XmlQualifiedName ();
+ private string name;
+ private string ns;
+
+ // Properties
+ public bool IsEmpty
+ {
+ get {
+ if ((name == String.Empty) && (ns == String.Empty))
+ return true;
+ else
+ return false;
+ }
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public string Namespace
+ {
+ get { return ns; }
+ }
+
+ // Methods
+ public override bool Equals (object other)
+ {
+ if ((XmlQualifiedName) this == (XmlQualifiedName) other)
+ return true;
+ else
+ return false;
+ }
+
+ [MonoTODO] public override int GetHashCode () { return 42; }
+
+ public override string ToString ()
+ {
+ if (ns == null)
+ return name;
+ else
+ return ns + ":" + name;
+ }
+
+ public static string ToString (string name, string ns)
+ {
+ if (ns == null)
+ return name;
+ else
+ return ns + ":" + name;
+ }
+
+ // Operators
+ public static bool operator == (XmlQualifiedName a, XmlQualifiedName b)
+ {
+ if ((a.Name == b.Name) && (a.Namespace == b.Namespace))
+ return true;
+ else
+ return false;
+ }
+
+ public static bool operator != (XmlQualifiedName a, XmlQualifiedName b)
+ {
+ if (!(a == b))
+ return false;
+ else
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlReader.cs b/mcs/class/System.XML/System.Xml/XmlReader.cs
new file mode 100644
index 00000000000..c2cd2f6541a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlReader.cs
@@ -0,0 +1,241 @@
+//
+// XmlReader.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001, 2002 Jason Diamond http://injektilo.org/
+//
+
+namespace System.Xml
+{
+ public abstract class XmlReader
+ {
+ #region Constructor
+
+ protected XmlReader ()
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public abstract int AttributeCount { get; }
+
+ public abstract string BaseURI { get; }
+
+ public virtual bool CanResolveEntity
+ {
+ get { return false; }
+ }
+
+ public abstract int Depth { get; }
+
+ public abstract bool EOF { get; }
+
+ public virtual bool HasAttributes
+ {
+ get { return AttributeCount > 0; }
+ }
+
+ public abstract bool HasValue { get; }
+
+ public abstract bool IsDefault { get; }
+
+ public abstract bool IsEmptyElement { get; }
+
+ public abstract string this[int i] { get; }
+
+ public abstract string this[string name] { get; }
+
+ public abstract string this[
+ string localName,
+ string namespaceName]
+ { get; }
+
+ public abstract string LocalName { get; }
+
+ public abstract string Name { get; }
+
+ public abstract string NamespaceURI { get; }
+
+ public abstract XmlNameTable NameTable { get; }
+
+ public abstract XmlNodeType NodeType { get; }
+
+ public abstract string Prefix { get; }
+
+ public abstract char QuoteChar { get; }
+
+ public abstract ReadState ReadState { get; }
+
+ public abstract string Value { get; }
+
+ public abstract string XmlLang { get; }
+
+ public abstract XmlSpace XmlSpace { get; }
+
+ #endregion
+
+ #region Methods
+
+ public abstract void Close ();
+
+ public abstract string GetAttribute (int i);
+
+ public abstract string GetAttribute (string name);
+
+ public abstract string GetAttribute (
+ string localName,
+ string namespaceName);
+
+ public static bool IsName (string s)
+ {
+ bool result = false;
+
+ if (s != null && s.Length > 0) {
+ char[] chars = s.ToCharArray ();
+
+ if (XmlChar.IsFirstNameChar (chars[0])) {
+ int i = 1;
+ int n = chars.Length;
+
+ while (i < n && XmlChar.IsNameChar (chars[i]))
+ ++i;
+
+ result = i == n;
+ }
+ }
+
+ return result;
+ }
+
+ public static bool IsNameToken (string s)
+ {
+ bool result = false;
+
+ if (s != null && s.Length > 0) {
+ char[] chars = s.ToCharArray ();
+
+ int i = 0;
+ int n = chars.Length;
+
+ while (i < n && XmlChar.IsNameChar (chars[i]))
+ ++i;
+
+ result = i == n;
+ }
+
+ return result;
+ }
+
+ [MonoTODO]
+ public virtual bool IsStartElement ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool IsStartElement (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual bool IsStartElement (
+ string localName,
+ string namespaceName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract string LookupNamespace (string prefix);
+
+ public abstract void MoveToAttribute (int i);
+
+ public abstract bool MoveToAttribute (string name);
+
+ public abstract bool MoveToAttribute (
+ string localName,
+ string namespaceName);
+
+ [MonoTODO]
+ public virtual XmlNodeType MoveToContent ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract bool MoveToElement ();
+
+ public abstract bool MoveToFirstAttribute ();
+
+ public abstract bool MoveToNextAttribute ();
+
+ public abstract bool Read ();
+
+ public abstract bool ReadAttributeValue ();
+
+ [MonoTODO]
+ public virtual string ReadElementString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string ReadElementString (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual string ReadElementString (
+ string localName,
+ string namespaceName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void ReadEndElement ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract string ReadInnerXml ();
+
+ public abstract string ReadOuterXml ();
+
+ [MonoTODO]
+ public virtual void ReadStartElement ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void ReadStartElement (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual void ReadStartElement (
+ string localName,
+ string namespaceName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract string ReadString ();
+
+ public abstract void ResolveEntity ();
+
+ [MonoTODO]
+ public virtual void Skip ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlResolver.cs b/mcs/class/System.XML/System.Xml/XmlResolver.cs
new file mode 100644
index 00000000000..665dff630e6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlResolver.cs
@@ -0,0 +1,32 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Xml.XmlResolver.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Net;
+
+namespace System.Xml
+{
+ public abstract class XmlResolver
+ {
+ public abstract ICredentials Credentials
+ {
+ set;
+ }
+
+ public abstract object GetEntity(
+ Uri absoluteUri,
+ string role,
+ Type type);
+
+ public abstract Uri ResolveUri(
+ Uri baseUri,
+ string relativeUri);
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs b/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs
new file mode 100644
index 00000000000..89997306999
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlSignificantWhitespace.cs
@@ -0,0 +1,53 @@
+//
+// System.Xml.XmlSignificantWhitespace.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Xml
+{
+ public class XmlSignificantWhitespace : XmlCharacterData
+ {
+ // Constructor
+ protected internal XmlSignificantWhitespace (string strData, XmlDocument doc)
+ : base (strData, doc)
+ {
+ }
+
+ // Properties
+ public override string LocalName {
+ get { return "#significant-whitespace"; }
+ }
+
+ public override string Name {
+ get { return "#significant-whitespace"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.SignificantWhitespace; }
+ }
+
+ public override string Value {
+ get { return Data; }
+ set {}
+ }
+
+ // Methods
+ public override XmlNode CloneNode (bool deep)
+ {
+ return new XmlSignificantWhitespace (Data, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w) {}
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteWhitespace (Data);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlSpace.cs b/mcs/class/System.XML/System.Xml/XmlSpace.cs
new file mode 100644
index 00000000000..f1e1128ff3c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlSpace.cs
@@ -0,0 +1,37 @@
+// XmlSpace.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:52 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Xml {
+
+
+ /// <summary>
+ /// Specifies the current xml:space scope
+ /// </summary>
+ public enum XmlSpace {
+
+ /// <summary>
+ /// No xml:space scope.
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// the xml:space scope = "default"
+ /// </summary>
+ Default = 1,
+
+ /// <summary>
+ /// the xml:space scope = "preserve"
+ /// </summary>
+ Preserve = 2,
+ } // XmlSpace
+
+} // System.Xml
diff --git a/mcs/class/System.XML/System.Xml/XmlText.cs b/mcs/class/System.XML/System.Xml/XmlText.cs
new file mode 100644
index 00000000000..59f2ba1477f
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlText.cs
@@ -0,0 +1,69 @@
+//
+// System.Xml.XmlText
+//
+// Author:
+// Jason Diamond <jason@injektilo.org>
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+
+namespace System.Xml
+{
+ public class XmlText : XmlCharacterData
+ {
+ #region Constructor
+
+ protected internal XmlText (string strData, XmlDocument doc) : base(strData, doc)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override string LocalName
+ {
+ get { return "#text"; }
+ }
+
+ public override string Name {
+ get { return "#text"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Text; }
+ }
+
+ public override string Value {
+ get { return Data; }
+ set { Data = value; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override XmlNode CloneNode (bool deep)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual XmlText SplitText (int offset)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteContentTo (XmlWriter w) {}
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteString (Data);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader.cs b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
new file mode 100644
index 00000000000..673cb9fd1f8
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlTextReader.cs
@@ -0,0 +1,1274 @@
+//
+// System.Xml.XmlTextReader
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+// Adam Treat (manyoso@yahoo.com)
+//
+// (C) 2001, 2002 Jason Diamond http://injektilo.org/
+//
+
+// FIXME:
+// This can only parse basic XML: elements, attributes, processing
+// instructions, and comments are OK.
+//
+// It barfs on DOCTYPE declarations.
+//
+// There's also no checking being done for either well-formedness
+// or validity.
+//
+// NameTables aren't being used everywhere yet.
+//
+// Some thought needs to be given to performance. There's too many
+// strings being allocated.
+//
+// Some of the MoveTo methods haven't been implemented yet.
+//
+// LineNumber and LinePosition aren't being tracked.
+//
+// xml:space, xml:lang, and xml:base aren't being tracked.
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Xml
+{
+ public class XmlTextReader : XmlReader, IXmlLineInfo
+ {
+ #region Constructors
+
+ [MonoTODO]
+ protected XmlTextReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTextReader (Stream input)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTextReader (string url)
+ {
+ XmlNameTable nt = new NameTable ();
+ XmlNamespaceManager nsMgr = new XmlNamespaceManager (nt);
+ parserContext = new XmlParserContext (null, nsMgr, null, XmlSpace.None);
+ Init ();
+ reader = new StreamReader(url);
+ }
+
+ [MonoTODO]
+ public XmlTextReader (TextReader input)
+ {
+ XmlNameTable nt = new NameTable ();
+ XmlNamespaceManager nsMgr = new XmlNamespaceManager (nt);
+ parserContext = new XmlParserContext (null, nsMgr, null, XmlSpace.None);
+ Init ();
+ reader = input;
+ }
+
+ [MonoTODO]
+ protected XmlTextReader (XmlNameTable nt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTextReader (Stream input, XmlNameTable nt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTextReader (string url, Stream input)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTextReader (string url, TextReader input)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTextReader (string url, XmlNameTable nt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTextReader (TextReader input, XmlNameTable nt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTextReader (Stream xmlFragment, XmlNodeType fragType, XmlParserContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTextReader (string url, Stream input, XmlNameTable nt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTextReader (string url, TextReader input, XmlNameTable nt)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public XmlTextReader (string xmlFragment, XmlNodeType fragType, XmlParserContext context)
+ {
+ //Waiting for Validating reader for fragType rules.
+ parserContext = context;
+ Init ();
+ reader = new StringReader(xmlFragment);
+ }
+
+ #endregion
+
+ #region Properties
+
+ public override int AttributeCount
+ {
+ get { return attributes.Count; }
+ }
+
+ [MonoTODO]
+ public override string BaseURI
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ public override int Depth
+ {
+ get { return depth > 0 ? depth : 0; }
+ }
+
+ [MonoTODO]
+ public Encoding Encoding
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ public override bool EOF
+ {
+ get
+ {
+ return
+ readState == ReadState.EndOfFile ||
+ readState == ReadState.Closed;
+ }
+ }
+
+ public override bool HasValue
+ {
+ get { return value != String.Empty; }
+ }
+
+ public override bool IsDefault
+ {
+ get
+ {
+ // XmlTextReader does not expand default attributes.
+ return false;
+ }
+ }
+
+ public override bool IsEmptyElement
+ {
+ get { return isEmptyElement; }
+ }
+
+ public override string this [int i]
+ {
+ get { return GetAttribute (i); }
+ }
+
+ public override string this [string name]
+ {
+ get { return GetAttribute (name); }
+ }
+
+ public override string this [string localName, string namespaceName]
+ {
+ get { return GetAttribute (localName, namespaceName); }
+ }
+
+ [MonoTODO]
+ public int LineNumber
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public int LinePosition
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string LocalName
+ {
+ get { return localName; }
+ }
+
+ public override string Name
+ {
+ get { return name; }
+ }
+
+ [MonoTODO]
+ public bool Namespaces
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public override string NamespaceURI
+ {
+ get { return namespaceURI; }
+ }
+
+ public override XmlNameTable NameTable
+ {
+ get { return parserContext.NameTable; }
+ }
+
+ public override XmlNodeType NodeType
+ {
+ get { return nodeType; }
+ }
+
+ [MonoTODO]
+ public bool Normalization
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ public override string Prefix
+ {
+ get { return prefix; }
+ }
+
+ [MonoTODO]
+ public override char QuoteChar
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ public override ReadState ReadState
+ {
+ get { return readState; }
+ }
+
+ public override string Value
+ {
+ get { return value; }
+ }
+
+ [MonoTODO]
+ public WhitespaceHandling WhitespaceHandling
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override string XmlLang
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public XmlResolver XmlResolver
+ {
+ set { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public override XmlSpace XmlSpace
+ {
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override void Close ()
+ {
+ readState = ReadState.Closed;
+ }
+
+ [MonoTODO]
+ public override string GetAttribute (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override string GetAttribute (string name)
+ {
+ return attributes [name] as string;
+ }
+
+ public override string GetAttribute (string localName, string namespaceURI)
+ {
+ foreach (DictionaryEntry entry in attributes)
+ {
+ string thisName = entry.Key as string;
+
+ int indexOfColon = thisName.IndexOf (':');
+
+ if (indexOfColon != -1) {
+ string thisLocalName = thisName.Substring (indexOfColon + 1);
+
+ if (localName == thisLocalName) {
+ string thisPrefix = thisName.Substring (0, indexOfColon);
+ string thisNamespaceURI = LookupNamespace (thisPrefix);
+
+ if (namespaceURI == thisNamespaceURI)
+ return attributes [thisName] as string;
+ }
+ } else if (localName == "xmlns" && namespaceURI == "http://www.w3.org/2000/xmlns/" && thisName == "xmlns")
+ return attributes [thisName] as string;
+ }
+
+ return String.Empty;
+ }
+
+ [MonoTODO]
+ public TextReader GetRemainder ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ bool IXmlLineInfo.HasLineInfo ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override string LookupNamespace (string prefix)
+ {
+ return parserContext.NamespaceManager.LookupNamespace (prefix);
+ }
+
+ [MonoTODO]
+ public override void MoveToAttribute (int i)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool MoveToAttribute (string name)
+ {
+ MoveToElement ();
+ bool match = false;
+ if (attributes == null)
+ return false;
+
+ if (attributeEnumerator == null) {
+ SaveProperties ();
+ attributeEnumerator = attributes.GetEnumerator ();
+ }
+
+ while (attributeEnumerator.MoveNext ()) {
+ if(name == attributeEnumerator.Key as string) {
+ match = true;
+ break;
+ }
+ }
+
+ if (match) {
+ string attname = attributeEnumerator.Key as string;
+ string value = attributeEnumerator.Value as string;
+ SetProperties (
+ XmlNodeType.Attribute, // nodeType
+ attname, // name
+ false, // isEmptyElement
+ value, // value
+ false // clearAttributes
+ );
+ }
+
+ return match;
+ }
+
+ [MonoTODO]
+ public override bool MoveToAttribute (string localName, string namespaceName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool MoveToElement ()
+ {
+ if (attributeEnumerator != null) {
+ attributeEnumerator = null;
+ RestoreProperties ();
+ return true;
+ }
+
+ return false;
+ }
+
+ public override bool MoveToFirstAttribute ()
+ {
+ MoveToElement ();
+ return MoveToNextAttribute ();
+ }
+
+ public override bool MoveToNextAttribute ()
+ {
+ if (attributes == null)
+ return false;
+
+ if (attributeEnumerator == null) {
+ SaveProperties ();
+ attributeEnumerator = attributes.GetEnumerator ();
+ }
+
+ if (attributeEnumerator.MoveNext ()) {
+ string name = attributeEnumerator.Key as string;
+ string value = attributeEnumerator.Value as string;
+ SetProperties (
+ XmlNodeType.Attribute, // nodeType
+ name, // name
+ false, // isEmptyElement
+ value, // value
+ false // clearAttributes
+ );
+ return true;
+ }
+
+ return false;
+ }
+
+ public override bool Read ()
+ {
+ bool more = false;
+
+ readState = ReadState.Interactive;
+
+ more = ReadContent ();
+
+ return more;
+ }
+
+ [MonoTODO]
+ public override bool ReadAttributeValue ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int ReadBase64 (byte [] buffer, int offset, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int ReadBinHex (byte [] buffer, int offset, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int ReadChars (char [] buffer, int offset, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ReadInnerXml ()
+ {
+ // Still need a Well Formedness check.
+ // Will wait for Validating reader ;-)
+ if (NodeType == XmlNodeType.Attribute) {
+ return Value;
+ } else {
+ saveToXmlBuffer = true;
+ string startname = this.Name;
+ string endname = string.Empty;
+ readState = ReadState.Interactive;
+
+ while (startname != endname) {
+ ReadContent ();
+ endname = this.Name;
+ }
+
+ xmlBuffer.Replace(currentTag.ToString (), "");
+ saveToXmlBuffer = false;
+ string InnerXml = xmlBuffer.ToString ();
+ xmlBuffer.Length = 0;
+ return InnerXml;
+ }
+ }
+
+ [MonoTODO]
+ public override string ReadOuterXml ()
+ {
+ // Still need a Well Formedness check.
+ // Will wait for Validating reader ;-)
+ if (NodeType == XmlNodeType.Attribute) {
+ return Name+"=\""+Value+"\"";
+ } else {
+ saveToXmlBuffer = true;
+ xmlBuffer.Append(currentTag.ToString ());
+ string startname = this.Name;
+ string endname = string.Empty;
+ readState = ReadState.Interactive;
+
+ while (startname != endname) {
+ ReadContent ();
+ endname = this.Name;
+ }
+ saveToXmlBuffer = false;
+ string OuterXml = xmlBuffer.ToString ();
+ xmlBuffer.Length = 0;
+ return OuterXml;
+ }
+ }
+
+ [MonoTODO]
+ public override string ReadString ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ResetState ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void ResolveEntity ()
+ {
+ // XmlTextReaders don't resolve entities.
+ throw new InvalidOperationException ("XmlTextReaders don't resolve entities.");
+ }
+
+ #endregion
+
+ // privates
+
+ private XmlParserContext parserContext;
+
+ private TextReader reader;
+ private ReadState readState;
+
+ private int depth;
+ private bool depthDown;
+
+ private bool popScope;
+
+ private XmlNodeType nodeType;
+ private string name;
+ private string prefix;
+ private string localName;
+ private string namespaceURI;
+ private bool isEmptyElement;
+ private string value;
+
+ private XmlNodeType saveNodeType;
+ private string saveName;
+ private string savePrefix;
+ private string saveLocalName;
+ private string saveNamespaceURI;
+ private bool saveIsEmptyElement;
+
+ private Hashtable attributes;
+ private IDictionaryEnumerator attributeEnumerator;
+
+ private bool returnEntityReference;
+ private string entityReferenceName;
+
+ private char [] nameBuffer;
+ private int nameLength;
+ private int nameCapacity;
+ private const int initialNameCapacity = 256;
+
+ private char [] valueBuffer;
+ private int valueLength;
+ private int valueCapacity;
+ private const int initialValueCapacity = 8192;
+
+ private StringBuilder xmlBuffer; // This is for Read(Inner|Outer)Xml
+ private StringBuilder currentTag; // A buffer for ReadContent for ReadOuterXml
+ private bool saveToXmlBuffer;
+
+ private void Init ()
+ {
+ readState = ReadState.Initial;
+
+ depth = -1;
+ depthDown = false;
+
+ popScope = false;
+
+ nodeType = XmlNodeType.None;
+ name = String.Empty;
+ prefix = String.Empty;
+ localName = string.Empty;
+ isEmptyElement = false;
+ value = String.Empty;
+
+ attributes = new Hashtable ();
+ attributeEnumerator = null;
+
+ returnEntityReference = false;
+ entityReferenceName = String.Empty;
+
+ nameBuffer = new char [initialNameCapacity];
+ nameLength = 0;
+ nameCapacity = initialNameCapacity;
+
+ valueBuffer = new char [initialValueCapacity];
+ valueLength = 0;
+ valueCapacity = initialValueCapacity;
+
+ xmlBuffer = new StringBuilder ();
+ currentTag = new StringBuilder ();
+ }
+
+ // Use this method rather than setting the properties
+ // directly so that all the necessary properties can
+ // be changed in harmony with each other. Maybe the
+ // fields should be in a seperate class to help enforce
+ // this.
+ private void SetProperties (
+ XmlNodeType nodeType,
+ string name,
+ bool isEmptyElement,
+ string value,
+ bool clearAttributes)
+ {
+ this.nodeType = nodeType;
+ this.name = name;
+ this.isEmptyElement = isEmptyElement;
+ this.value = value;
+
+ if (clearAttributes)
+ ClearAttributes ();
+
+ int indexOfColon = name.IndexOf (':');
+
+ if (indexOfColon == -1) {
+ prefix = String.Empty;
+ localName = name;
+ } else {
+ prefix = name.Substring (0, indexOfColon);
+ localName = name.Substring (indexOfColon + 1);
+ }
+
+ namespaceURI = LookupNamespace (prefix);
+ }
+
+ private void SaveProperties ()
+ {
+ saveNodeType = nodeType;
+ saveName = name;
+ savePrefix = prefix;
+ saveLocalName = localName;
+ saveNamespaceURI = namespaceURI;
+ saveIsEmptyElement = isEmptyElement;
+ // An element's value is always String.Empty.
+ }
+
+ private void RestoreProperties ()
+ {
+ nodeType = saveNodeType;
+ name = saveName;
+ prefix = savePrefix;
+ localName = saveLocalName;
+ namespaceURI = saveNamespaceURI;
+ isEmptyElement = saveIsEmptyElement;
+ value = String.Empty;
+ }
+
+ private void AddAttribute (string name, string value)
+ {
+ attributes.Add (name, value);
+ }
+
+ private void ClearAttributes ()
+ {
+ if (attributes.Count > 0)
+ attributes.Clear ();
+
+ attributeEnumerator = null;
+ }
+
+ private int PeekChar ()
+ {
+ return reader.Peek ();
+ }
+
+ private int ReadChar ()
+ {
+ int ch = reader.Read ();
+ if (saveToXmlBuffer) {
+ xmlBuffer.Append ((char) ch);
+ }
+ currentTag.Append ((char) ch);
+ return ch;
+ }
+
+ // This should really keep track of some state so
+ // that it's not possible to have more than one document
+ // element or text outside of the document element.
+ private bool ReadContent ()
+ {
+ bool more = false;
+ currentTag.Length = 0;
+ if (popScope) {
+ parserContext.NamespaceManager.PopScope ();
+ popScope = false;
+ }
+
+ if (depthDown)
+ --depth;
+
+ if (returnEntityReference) {
+ ++depth;
+ SetEntityReferenceProperties ();
+ more = true;
+ } else {
+ switch (PeekChar ())
+ {
+ case '<':
+ ReadChar ();
+ ReadTag ();
+ more = true;
+ break;
+ case -1:
+ readState = ReadState.EndOfFile;
+ SetProperties (
+ XmlNodeType.None, // nodeType
+ String.Empty, // name
+ false, // isEmptyElement
+ String.Empty, // value
+ true // clearAttributes
+ );
+ more = false;
+ break;
+ default:
+ ReadText ();
+ more = true;
+ break;
+ }
+ }
+
+ return more;
+ }
+
+ private void SetEntityReferenceProperties ()
+ {
+ SetProperties (
+ XmlNodeType.EntityReference, // nodeType
+ entityReferenceName, // name
+ false, // isEmptyElement
+ String.Empty, // value
+ true // clearAttributes
+ );
+
+ returnEntityReference = false;
+ entityReferenceName = String.Empty;
+ }
+
+ // The leading '<' has already been consumed.
+ private void ReadTag ()
+ {
+ switch (PeekChar ())
+ {
+ case '/':
+ ReadChar ();
+ ReadEndTag ();
+ break;
+ case '?':
+ ReadChar ();
+ ReadProcessingInstruction ();
+ break;
+ case '!':
+ ReadChar ();
+ ReadDeclaration ();
+ break;
+ default:
+ ReadStartTag ();
+ break;
+ }
+ }
+
+ // The leading '<' has already been consumed.
+ private void ReadStartTag ()
+ {
+ parserContext.NamespaceManager.PushScope ();
+
+ string name = ReadName ();
+ SkipWhitespace ();
+
+ bool isEmptyElement = false;
+
+ ClearAttributes ();
+
+ if (XmlChar.IsFirstNameChar (PeekChar ()))
+ ReadAttributes ();
+
+ if (PeekChar () == '/') {
+ ReadChar ();
+ isEmptyElement = true;
+ depthDown = true;
+ popScope = true;
+ }
+
+ Expect ('>');
+
+ ++depth;
+
+ SetProperties (
+ XmlNodeType.Element, // nodeType
+ name, // name
+ isEmptyElement, // isEmptyElement
+ String.Empty, // value
+ false // clearAttributes
+ );
+ }
+
+ // The reader is positioned on the first character
+ // of the element's name.
+ private void ReadEndTag ()
+ {
+ string name = ReadName ();
+ SkipWhitespace ();
+ Expect ('>');
+
+ --depth;
+
+ SetProperties (
+ XmlNodeType.EndElement, // nodeType
+ name, // name
+ false, // isEmptyElement
+ String.Empty, // value
+ true // clearAttributes
+ );
+
+ popScope = true;
+ }
+
+ private void AppendNameChar (int ch)
+ {
+ CheckNameCapacity ();
+ nameBuffer [nameLength++] = (char)ch;
+ }
+
+ private void CheckNameCapacity ()
+ {
+ if (nameLength == nameCapacity) {
+ nameCapacity = nameCapacity * 2;
+ char [] oldNameBuffer = nameBuffer;
+ nameBuffer = new char [nameCapacity];
+ Array.Copy (oldNameBuffer, nameBuffer, nameLength);
+ }
+ }
+
+ private string CreateNameString ()
+ {
+ return new String (nameBuffer, 0, nameLength);
+ }
+
+ private void AppendValueChar (int ch)
+ {
+ CheckValueCapacity ();
+ valueBuffer [valueLength++] = (char)ch;
+ }
+
+ private void CheckValueCapacity ()
+ {
+ if (valueLength == valueCapacity) {
+ valueCapacity = valueCapacity * 2;
+ char [] oldValueBuffer = valueBuffer;
+ valueBuffer = new char [valueCapacity];
+ Array.Copy (oldValueBuffer, valueBuffer, valueLength);
+ }
+ }
+
+ private string CreateValueString ()
+ {
+ return new String (valueBuffer, 0, valueLength);
+ }
+
+ // The reader is positioned on the first character
+ // of the text.
+ private void ReadText ()
+ {
+ valueLength = 0;
+
+ int ch = PeekChar ();
+
+ while (ch != '<' && ch != -1) {
+ if (ch == '&') {
+ ReadChar ();
+ if (ReadReference (false))
+ break;
+ } else
+ AppendValueChar (ReadChar ());
+
+ ch = PeekChar ();
+ }
+
+ if (returnEntityReference && valueLength == 0) {
+ ++depth;
+ SetEntityReferenceProperties ();
+ } else {
+ if (depth >= 0) {
+ ++depth;
+ depthDown = true;
+ }
+
+ SetProperties (
+ XmlNodeType.Text, // nodeType
+ String.Empty, // name
+ false, // isEmptyElement
+ CreateValueString (), // value
+ true // clearAttributes
+ );
+ }
+ }
+
+ // The leading '&' has already been consumed.
+ // Returns true if the entity reference isn't a simple
+ // 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)
+ {
+ if (PeekChar () == '#') {
+ ReadChar ();
+ ReadCharacterReference ();
+ } else
+ ReadEntityReference (ignoreEntityReferences);
+
+ return returnEntityReference;
+ }
+
+ private void ReadCharacterReference ()
+ {
+ int value = 0;
+
+ if (PeekChar () == 'x') {
+ ReadChar ();
+
+ while (PeekChar () != ';' && PeekChar () != -1) {
+ int ch = ReadChar ();
+
+ if (ch >= '0' && ch <= '9')
+ value = (value << 4) + ch - '0';
+ else if (ch >= 'A' && ch <= 'F')
+ value = (value << 4) + ch - 'A' + 10;
+ else if (ch >= 'a' && ch <= 'f')
+ value = (value << 4) + ch - 'a' + 10;
+ else
+ throw new XmlException (
+ String.Format (
+ "invalid hexadecimal digit: {0} (#x{1:X})",
+ (char)ch,
+ ch));
+ }
+ } else {
+ while (PeekChar () != ';' && PeekChar () != -1) {
+ int ch = ReadChar ();
+
+ if (ch >= '0' && ch <= '9')
+ value = value * 10 + ch - '0';
+ else
+ throw new XmlException (
+ String.Format (
+ "invalid decimal digit: {0} (#x{1:X})",
+ (char)ch,
+ ch));
+ }
+ }
+
+ ReadChar (); // ';'
+
+ AppendValueChar (value);
+ }
+
+ private void ReadEntityReference (bool ignoreEntityReferences)
+ {
+ nameLength = 0;
+
+ int ch = PeekChar ();
+
+ while (ch != ';' && ch != -1) {
+ AppendNameChar (ReadChar ());
+ ch = PeekChar ();
+ }
+
+ Expect (';');
+
+ string name = CreateNameString ();
+
+ switch (name)
+ {
+ case "lt":
+ AppendValueChar ('<');
+ break;
+ case "gt":
+ AppendValueChar ('>');
+ break;
+ case "amp":
+ AppendValueChar ('&');
+ break;
+ case "apos":
+ AppendValueChar ('\'');
+ break;
+ case "quot":
+ AppendValueChar ('"');
+ break;
+ default:
+ if (ignoreEntityReferences) {
+ AppendValueChar ('&');
+
+ foreach (char ch2 in name) {
+ AppendValueChar (ch2);
+ }
+
+ AppendValueChar (';');
+ } else {
+ returnEntityReference = true;
+ entityReferenceName = name;
+ }
+ break;
+ }
+ }
+
+ // The reader is positioned on the first character of
+ // the attribute name.
+ private void ReadAttributes ()
+ {
+ do {
+ string name = ReadName ();
+ SkipWhitespace ();
+ Expect ('=');
+ SkipWhitespace ();
+ string value = ReadAttribute ();
+ SkipWhitespace ();
+
+ if (name == "xmlns")
+ parserContext.NamespaceManager.AddNamespace (String.Empty, value);
+ else if (name.StartsWith ("xmlns:"))
+ parserContext.NamespaceManager.AddNamespace (name.Substring (6), value);
+
+ AddAttribute (name, value);
+ } while (PeekChar () != '/' && PeekChar () != '>' && PeekChar () != -1);
+ }
+
+ // The reader is positioned on the quote character.
+ private string ReadAttribute ()
+ {
+ int quoteChar = ReadChar ();
+
+ if (quoteChar != '\'' && quoteChar != '\"')
+ throw new XmlException ("an attribute value was not quoted");
+
+ valueLength = 0;
+
+ while (PeekChar () != quoteChar) {
+ int ch = ReadChar ();
+
+ switch (ch)
+ {
+ case '<':
+ throw new XmlException ("attribute values cannot contain '<'");
+ case '&':
+ ReadReference (true);
+ break;
+ case -1:
+ throw new XmlException ("unexpected end of file in an attribute value");
+ default:
+ AppendValueChar (ch);
+ break;
+ }
+ }
+
+ ReadChar (); // quoteChar
+
+ return CreateValueString ();
+ }
+
+ // The reader is positioned on the first character
+ // of the target.
+ private void ReadProcessingInstruction ()
+ {
+ string target = ReadName ();
+ SkipWhitespace ();
+
+ valueLength = 0;
+
+ while (PeekChar () != -1) {
+ int ch = ReadChar ();
+
+ if (ch == '?' && PeekChar () == '>') {
+ ReadChar ();
+ break;
+ }
+
+ AppendValueChar ((char)ch);
+ }
+
+ SetProperties (
+ XmlNodeType.ProcessingInstruction, // nodeType
+ target, // name
+ false, // isEmptyElement
+ CreateValueString (), // value
+ true // clearAttributes
+ );
+ }
+
+ // The reader is positioned on the first character after
+ // the leading '<!'.
+ private void ReadDeclaration ()
+ {
+ int ch = PeekChar ();
+
+ switch (ch)
+ {
+ case '-':
+ Expect ('-');
+ Expect ('-');
+ ReadComment ();
+ break;
+ case '[':
+ ReadChar ();
+ Expect ('C');
+ Expect ('D');
+ Expect ('A');
+ Expect ('T');
+ Expect ('A');
+ Expect ('[');
+ ReadCDATA ();
+ break;
+ }
+ }
+
+ // The reader is positioned on the first character after
+ // the leading '<!--'.
+ private void ReadComment ()
+ {
+ valueLength = 0;
+
+ while (PeekChar () != -1) {
+ int ch = ReadChar ();
+
+ if (ch == '-' && PeekChar () == '-') {
+ ReadChar ();
+
+ if (PeekChar () != '>')
+ throw new XmlException ("comments cannot contain '--'");
+
+ ReadChar ();
+ break;
+ }
+
+ AppendValueChar ((char)ch);
+ }
+
+ SetProperties (
+ XmlNodeType.Comment, // nodeType
+ String.Empty, // name
+ false, // isEmptyElement
+ CreateValueString (), // value
+ true // clearAttributes
+ );
+ }
+
+ // The reader is positioned on the first character after
+ // the leading '<![CDATA['.
+ private void ReadCDATA ()
+ {
+ valueLength = 0;
+
+ while (PeekChar () != -1) {
+ int ch = ReadChar ();
+
+ if (ch == ']' && PeekChar () == ']') {
+ ch = ReadChar (); // ']'
+
+ if (PeekChar () == '>') {
+ ReadChar (); // '>'
+ break;
+ } else {
+ AppendValueChar (']');
+ AppendValueChar (']');
+ ch = ReadChar ();
+ }
+ }
+
+ AppendValueChar ((char)ch);
+ }
+
+ ++depth;
+
+ SetProperties (
+ XmlNodeType.CDATA, // nodeType
+ String.Empty, // name
+ false, // isEmptyElement
+ CreateValueString (), // value
+ true // clearAttributes
+ );
+ }
+
+ // The reader is positioned on the first character
+ // of the name.
+ private string ReadName ()
+ {
+ if (!XmlChar.IsFirstNameChar (PeekChar ()))
+ throw new XmlException ("a name did not start with a legal character");
+
+ nameLength = 0;
+
+ AppendNameChar (ReadChar ());
+
+ while (XmlChar.IsNameChar (PeekChar ())) {
+ AppendNameChar (ReadChar ());
+ }
+
+ return CreateNameString ();
+ }
+
+ // Read the next character and compare it against the
+ // specified character.
+ private void Expect (int expected)
+ {
+ int ch = ReadChar ();
+
+ if (ch != expected) {
+ throw new XmlException (
+ String.Format (
+ "expected '{0}' ({1:X}) but found '{2}' ({3:X})",
+ (char)expected,
+ expected,
+ (char)ch,
+ ch));
+ }
+ }
+
+ // Does not consume the first non-whitespace character.
+ private void SkipWhitespace ()
+ {
+ while (XmlChar.IsWhitespace (PeekChar ()))
+ ReadChar ();
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
new file mode 100644
index 00000000000..a598695b306
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs
@@ -0,0 +1,644 @@
+//
+// System.Xml.XmlTextWriter
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+
+namespace System.Xml
+{
+ public class XmlTextWriter : XmlWriter
+ {
+ #region Fields
+
+ protected TextWriter w;
+ protected bool nullEncoding = false;
+ protected bool openWriter = true;
+ protected bool openStartElement = false;
+ protected bool openStartAttribute = false;
+ protected bool documentStarted = false;
+ private bool namespaces = true;
+ protected bool openAttribute = false;
+ protected bool attributeWrittenForElement = false;
+ protected Stack openElements = new Stack ();
+ private Formatting formatting = Formatting.None;
+ private int indentation = 2;
+ private char indentChar = ' ';
+ protected string indentChars = " ";
+ private char quoteChar = '\"';
+ protected int indentLevel = 0;
+ protected string indentFormatting;
+ protected Stream baseStream = null;
+ protected string xmlLang = null;
+ protected XmlSpace xmlSpace = XmlSpace.None;
+ protected bool openXmlLang = false;
+ protected bool openXmlSpace = false;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlTextWriter (TextWriter w) : base ()
+ {
+ this.w = w;
+
+ try {
+ baseStream = ((StreamWriter)w).BaseStream;
+ }
+ catch (Exception) { }
+ }
+
+ public XmlTextWriter (Stream w, Encoding encoding) : base ()
+ {
+ if (encoding == null) {
+ nullEncoding = true;
+ encoding = new UTF8Encoding ();
+ }
+
+ this.w = new StreamWriter(w, encoding);
+ baseStream = w;
+ }
+
+ public XmlTextWriter (string filename, Encoding encoding) : base ()
+ {
+ this.w = new StreamWriter(filename, false, encoding);
+ baseStream = ((StreamWriter)w).BaseStream;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public Stream BaseStream {
+ get { return baseStream; }
+ }
+
+
+ public Formatting Formatting {
+ get { return formatting; }
+ set { formatting = value; }
+ }
+
+ public bool IndentingOverriden
+ {
+ get {
+ if (openElements.Count == 0)
+ return false;
+ else
+ return (((XmlTextWriterOpenElement)openElements.Peek()).IndentingOverriden);
+ }
+ set {
+ if (openElements.Count > 0)
+ ((XmlTextWriterOpenElement)openElements.Peek()).IndentingOverriden = value;
+ }
+ }
+
+ public int Indentation {
+ get { return indentation; }
+ set {
+ indentation = value;
+ UpdateIndentChars ();
+ }
+ }
+
+ public char IndentChar {
+ get { return indentChar; }
+ set {
+ indentChar = value;
+ UpdateIndentChars ();
+ }
+ }
+
+ public bool Namespaces {
+ get { return namespaces; }
+ set {
+ if (ws != WriteState.Start)
+ throw new InvalidOperationException ("NotInWriteState.");
+
+ namespaces = value;
+ }
+ }
+
+ public char QuoteChar {
+ get { return quoteChar; }
+ set {
+ if ((value != '\'') && (value != '\"'))
+ throw new ArgumentException ("This is an invalid XML attribute quote character. Valid attribute quote characters are ' and \".");
+
+ quoteChar = value;
+ }
+ }
+
+ public override WriteState WriteState {
+ get { return ws; }
+ }
+
+ public override string XmlLang {
+ get {
+ string xmlLang = null;
+ int i;
+
+ for (i = 0; i < openElements.Count; i++)
+ {
+ xmlLang = ((XmlTextWriterOpenElement)openElements.ToArray().GetValue(i)).XmlLang;
+ if (xmlLang != null)
+ break;
+ }
+
+ return xmlLang;
+ }
+ }
+
+ public override XmlSpace XmlSpace {
+ get {
+ XmlSpace xmlSpace = XmlSpace.None;
+ int i;
+
+ for (i = 0; i < openElements.Count; i++)
+ {
+ xmlSpace = ((XmlTextWriterOpenElement)openElements.ToArray().GetValue(i)).XmlSpace;
+ if (xmlSpace != XmlSpace.None)
+ break;
+ }
+
+ return xmlSpace;
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ private void CheckState ()
+ {
+ if (!openWriter) {
+ throw new InvalidOperationException ("The Writer is closed.");
+ }
+
+ if ((documentStarted == true) && (formatting == Formatting.Indented) && (!IndentingOverriden)) {
+ indentFormatting = "\r\n";
+ if (indentLevel > 0) {
+ for (int i = 0; i < indentLevel; i++)
+ indentFormatting += indentChars;
+ }
+ }
+ else
+ indentFormatting = "";
+
+ documentStarted = true;
+ }
+
+ public override void Close ()
+ {
+ CloseOpenAttributeAndElements ();
+
+ w.Close();
+ ws = WriteState.Closed;
+ openWriter = false;
+ }
+
+ private void CloseOpenAttributeAndElements ()
+ {
+ if (openAttribute)
+ WriteEndAttribute ();
+
+ while (openElements.Count > 0) {
+ WriteEndElement();
+ }
+ }
+
+ private void CloseStartElement ()
+ {
+ if (openStartElement) {
+ w.Write(">");
+ ws = WriteState.Content;
+ openStartElement = false;
+ attributeWrittenForElement = false;
+ }
+ }
+
+ public override void Flush ()
+ {
+ w.Flush ();
+ }
+
+ public override string LookupPrefix (string ns)
+ {
+ string prefix = namespaceManager.LookupPrefix (ns);
+
+ if (prefix == String.Empty)
+ prefix = null;
+
+ return prefix;
+ }
+
+ private void UpdateIndentChars ()
+ {
+ indentChars = "";
+ for (int i = 0; i < indentation; i++)
+ indentChars += indentChar;
+ }
+
+ public override void WriteBase64 (byte[] buffer, int index, int count)
+ {
+ w.Write (Convert.ToBase64String (buffer, index, count));
+ }
+
+ [MonoTODO]
+ public override void WriteBinHex (byte[] buffer, int index, int count)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteCData (string text)
+ {
+ if (text.IndexOf("]]>") > 0)
+ throw new ArgumentException ();
+
+ CheckState ();
+ CloseStartElement ();
+
+ w.Write("<![CDATA[{0}]]>", text);
+ }
+
+ public override void WriteCharEntity (char ch)
+ {
+ Int16 intCh = (Int16)ch;
+
+ // Make sure the character is not in the surrogate pair
+ // character range, 0xd800- 0xdfff
+ if ((intCh >= -10240) && (intCh <= -8193))
+ throw new ArgumentException ("Surrogate Pair is invalid.");
+
+ w.Write("&#x{0:X};", intCh);
+ }
+
+ [MonoTODO]
+ public override void WriteChars (char[] buffer, int index, int count)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteComment (string text)
+ {
+ if ((text.EndsWith("-")) || (text.IndexOf("-->") > 0)) {
+ throw new ArgumentException ();
+ }
+
+ CheckState ();
+ CloseStartElement ();
+
+ w.Write ("<!--{0}-->", text);
+ }
+
+ [MonoTODO]
+ public override void WriteDocType (string name, string pubid, string sysid, string subset)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteEndAttribute ()
+ {
+ if (!openAttribute)
+ throw new InvalidOperationException("Token EndAttribute in state Start would result in an invalid XML document.");
+
+ CheckState ();
+
+ if (openXmlLang) {
+ w.Write (xmlLang);
+ openXmlLang = false;
+ ((XmlTextWriterOpenElement)openElements.Peek()).XmlLang = xmlLang;
+ }
+
+ if (openXmlSpace)
+ {
+ w.Write (xmlSpace.ToString ().ToLower ());
+ openXmlSpace = false;
+ ((XmlTextWriterOpenElement)openElements.Peek()).XmlSpace = xmlSpace;
+ }
+
+ w.Write ("{0}", quoteChar);
+
+ openAttribute = false;
+ }
+
+ public override void WriteEndDocument ()
+ {
+ if ((ws == WriteState.Start) || (ws == WriteState.Prolog))
+ throw new ArgumentException ("This document does not have a root element.");
+
+ CloseOpenAttributeAndElements ();
+
+ ws = WriteState.Start;
+ }
+
+ public override void WriteEndElement ()
+ {
+ WriteEndElementInternal (false);
+ }
+
+ private void WriteEndElementInternal (bool fullEndElement)
+ {
+ if (openElements.Count == 0)
+ throw new InvalidOperationException("There was no XML start tag open.");
+
+ indentLevel--;
+
+ CheckState ();
+
+ if (openStartElement) {
+ if (openAttribute)
+ WriteEndAttribute ();
+
+ if (fullEndElement)
+ w.Write ("></{0}>", ((XmlTextWriterOpenElement)openElements.Peek ()).Name);
+ else
+ w.Write (" />");
+
+ openElements.Pop ();
+ openStartElement = false;
+ } else {
+ w.Write ("{0}</{1}>", indentFormatting, openElements.Pop ());
+ }
+
+ namespaceManager.PopScope();
+ }
+
+ [MonoTODO]
+ public override void WriteEntityRef (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteFullEndElement ()
+ {
+ WriteEndElementInternal (true);
+ }
+
+ [MonoTODO]
+ public override void WriteName (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void WriteNmToken (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteProcessingInstruction (string name, string text)
+ {
+ if ((name == null) || (name == string.Empty) || (name.IndexOf("?>") > 0) || (text.IndexOf("?>") > 0)) {
+ throw new ArgumentException ();
+ }
+
+ CheckState ();
+ CloseStartElement ();
+
+ w.Write ("{0}<?{1} {2}?>", indentFormatting, name, text);
+ }
+
+ [MonoTODO]
+ public override void WriteQualifiedName (string localName, string ns)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteRaw (string data)
+ {
+ WriteStringInternal (data, false);
+ }
+
+ [MonoTODO]
+ public override void WriteRaw (char[] buffer, int index, int count)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteStartAttribute (string prefix, string localName, string ns)
+ {
+ if ((prefix == "xml") && (localName == "lang"))
+ openXmlLang = true;
+
+ if ((prefix == "xml") && (localName == "space"))
+ openXmlSpace = true;
+
+ if ((prefix == "xmlns") && (localName == "xmlns"))
+ 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.");
+
+ CheckState ();
+
+ if (ws == WriteState.Content)
+ throw new InvalidOperationException ("Token StartAttribute in state " + WriteState + " would result in an invalid XML document.");
+
+ if (prefix == null)
+ prefix = String.Empty;
+
+ if (ns == null)
+ ns = String.Empty;
+
+ string formatPrefix = "";
+ string formatSpace = "";
+
+ if (ns != String.Empty)
+ {
+ string existingPrefix = namespaceManager.LookupPrefix (ns);
+
+ if (prefix == String.Empty)
+ prefix = existingPrefix;
+ }
+
+ if (prefix != String.Empty)
+ {
+ formatPrefix = prefix + ":";
+ }
+
+ if (openStartElement || attributeWrittenForElement)
+ formatSpace = " ";
+
+ w.Write ("{0}{1}{2}={3}", formatSpace, formatPrefix, localName, quoteChar);
+
+ openAttribute = true;
+ attributeWrittenForElement = true;
+ ws = WriteState.Attribute;
+ }
+
+ public override void WriteStartDocument ()
+ {
+ WriteStartDocument ("");
+ }
+
+ public override void WriteStartDocument (bool standalone)
+ {
+ string standaloneFormatting;
+
+ if (standalone == true)
+ standaloneFormatting = String.Format (" standalone={0}yes{0}", quoteChar);
+ else
+ standaloneFormatting = String.Format (" standalone={0}no{0}", quoteChar);
+
+ WriteStartDocument (standaloneFormatting);
+ }
+
+ private void WriteStartDocument (string standaloneFormatting)
+ {
+ if (documentStarted == true)
+ throw new InvalidOperationException("WriteStartDocument should be the first call.");
+
+ CheckState ();
+
+ string encodingFormatting = "";
+
+ if (!nullEncoding)
+ encodingFormatting = String.Format (" encoding={0}{1}{0}", quoteChar, w.Encoding.HeaderName);
+
+ w.Write("<?xml version={0}1.0{0}{1}{2}?>", quoteChar, encodingFormatting, standaloneFormatting);
+ ws = WriteState.Prolog;
+ }
+
+ public override void WriteStartElement (string prefix, string localName, string ns)
+ {
+ if (!Namespaces && (((prefix != null) && (prefix != String.Empty))
+ || ((ns != null) && (ns != String.Empty))))
+ throw new ArgumentException ("Cannot set the namespace if Namespaces is 'false'.");
+
+ WriteStartElementInternal (prefix, localName, ns);
+ }
+
+ protected override void WriteStartElementInternal (string prefix, string localName, string ns)
+ {
+ if (prefix == null)
+ prefix = String.Empty;
+
+ if (ns == null)
+ ns = String.Empty;
+
+ if ((prefix != String.Empty) && ((ns == null) || (ns == String.Empty)))
+ throw new ArgumentException ("Cannot use a prefix with an empty namespace.");
+
+ CheckState ();
+ CloseStartElement ();
+
+ string formatXmlns = "";
+ string formatPrefix = "";
+
+ if (ns != String.Empty)
+ {
+ string existingPrefix = namespaceManager.LookupPrefix (ns);
+
+ if (prefix == String.Empty)
+ prefix = existingPrefix;
+
+ if (prefix != existingPrefix)
+ formatXmlns = String.Format (" xmlns:{0}={1}{2}{1}", prefix, quoteChar, ns);
+ else if (existingPrefix == String.Empty)
+ formatXmlns = String.Format (" xmlns={0}{1}{0}", quoteChar, ns);
+ }
+ else if ((prefix == String.Empty) && (namespaceManager.LookupNamespace(prefix) != String.Empty)) {
+ formatXmlns = String.Format (" xmlns={0}{0}", quoteChar);
+ }
+
+ if (prefix != String.Empty) {
+ formatPrefix = prefix + ":";
+ }
+
+ w.Write ("{0}<{1}{2}{3}", indentFormatting, formatPrefix, localName, formatXmlns);
+
+ openElements.Push (new XmlTextWriterOpenElement (formatPrefix + localName));
+ ws = WriteState.Element;
+ openStartElement = true;
+
+ namespaceManager.PushScope ();
+ namespaceManager.AddNamespace (prefix, ns);
+
+ indentLevel++;
+ }
+
+ public override void WriteString (string text)
+ {
+ if (ws == WriteState.Prolog)
+ throw new InvalidOperationException ("Token content in state Prolog would result in an invalid XML document.");
+
+ WriteStringInternal (text, true);
+ }
+
+ public void WriteStringInternal (string text, bool entitize)
+ {
+ if (text == null)
+ text = String.Empty;
+
+ if (text != String.Empty)
+ {
+ CheckState ();
+
+ if (entitize)
+ {
+ text = text.Replace ("&", "&amp;");
+ text = text.Replace ("<", "&lt;");
+ text = text.Replace (">", "&gt;");
+
+ if (openAttribute)
+ {
+ if (quoteChar == '"')
+ text = text.Replace ("\"", "&quot;");
+ else
+ text = text.Replace ("'", "&apos;");
+ }
+ }
+
+ if (!openAttribute)
+ CloseStartElement ();
+
+ if (!openXmlLang && !openXmlSpace)
+ w.Write (text);
+ else
+ {
+ if (openXmlLang)
+ xmlLang = text;
+ else
+ {
+ switch (text)
+ {
+ case "default":
+ xmlSpace = XmlSpace.Default;
+ break;
+ case "preserve":
+ xmlSpace = XmlSpace.Preserve;
+ break;
+ default:
+ throw new ArgumentException ("'{0}' is an invalid xml:space value.");
+ }
+ }
+ }
+ }
+
+ IndentingOverriden = true;
+ }
+
+ [MonoTODO]
+ public override void WriteSurrogateCharEntity (char lowChar, char highChar)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override void WriteWhitespace (string ws)
+ {
+ foreach (char c in ws) {
+ if ((c != ' ') && (c != '\t') && (c != '\r') && (c != '\n'))
+ throw new ArgumentException ();
+ }
+
+ w.Write (ws);
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriterOpenElement.cs b/mcs/class/System.XML/System.Xml/XmlTextWriterOpenElement.cs
new file mode 100644
index 00000000000..8c67c109e8a
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlTextWriterOpenElement.cs
@@ -0,0 +1,61 @@
+using System;
+
+namespace System.Xml
+{
+ internal class XmlTextWriterOpenElement
+ {
+ #region Fields
+
+ string name;
+ string xmlLang;
+ XmlSpace xmlSpace;
+ bool indentingOverriden = false;
+
+ #endregion
+
+ #region Constructors
+
+ public XmlTextWriterOpenElement (string name)
+ {
+ this.name = name;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public bool IndentingOverriden
+ {
+ get { return indentingOverriden; }
+ set { indentingOverriden = value; }
+ }
+
+ public string XmlLang
+ {
+ get { return xmlLang; }
+ set { xmlLang = value; }
+ }
+
+ public XmlSpace XmlSpace
+ {
+ get { return xmlSpace; }
+ set { xmlSpace = value; }
+ }
+
+ #endregion
+
+ #region Methods
+
+ public override string ToString ()
+ {
+ return name;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlTokenizedType.cs b/mcs/class/System.XML/System.Xml/XmlTokenizedType.cs
new file mode 100755
index 00000000000..13762770ce6
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlTokenizedType.cs
@@ -0,0 +1,27 @@
+//
+// System.Xml.XmlTokenizedType.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Xml
+{
+ [Serializable] public enum XmlTokenizedType
+ {
+ CDATA = 0,
+ ID = 1,
+ IDREF = 2,
+ IDREFS = 3,
+ ENTITY = 4,
+ ENTITIES = 5,
+ NMTOKEN = 6,
+ NMTOKENS = 7,
+ NOTATION = 8,
+ ENUMERATION = 9,
+ QName = 10,
+ NCName = 11,
+ None = 12,
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs b/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs
new file mode 100755
index 00000000000..54750bb6f60
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlUrlResolver.cs
@@ -0,0 +1,41 @@
+// System.Xml.XmlUrlResolver.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System.Net;
+
+namespace System.Xml
+{
+ public class XmlUrlResolver : XmlResolver
+ {
+ // Field
+ ICredentials credential;
+
+ // Constructor
+ public XmlUrlResolver ()
+ : base ()
+ {
+ }
+
+ // Properties
+ public override ICredentials Credentials
+ {
+ set { credential = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn)
+ {
+ return null;
+ }
+
+ public override Uri ResolveUri (Uri baseUri, string relativeUri)
+ {
+ return new Uri (baseUri, relativeUri);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlWhitespace.cs b/mcs/class/System.XML/System.Xml/XmlWhitespace.cs
new file mode 100644
index 00000000000..fd8da124919
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlWhitespace.cs
@@ -0,0 +1,55 @@
+//
+// System.Xml.XmlWhitespace.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Xml
+{
+ public class XmlWhitespace : XmlCharacterData
+ {
+ // Constructor
+ protected internal XmlWhitespace (string strData, XmlDocument doc)
+ : base (strData, doc)
+ {
+ }
+
+ // Properties
+ public override string LocalName {
+ get { return "#whitespace"; }
+ }
+
+ public override string Name {
+ get { return "#whitespace"; }
+ }
+
+ public override XmlNodeType NodeType {
+ get { return XmlNodeType.Whitespace; }
+ }
+
+ [MonoTODO]
+ public override string Value {
+ get { return Data; }
+ set {}
+ }
+
+ // Methods
+ public override XmlNode CloneNode (bool deep)
+ {
+ // always return the data value
+ return new XmlWhitespace (Data, OwnerDocument);
+ }
+
+ public override void WriteContentTo (XmlWriter w) {}
+
+ public override void WriteTo (XmlWriter w)
+ {
+ w.WriteWhitespace (Data);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/System.Xml/XmlWriter.cs b/mcs/class/System.XML/System.Xml/XmlWriter.cs
new file mode 100644
index 00000000000..f1c0b96737c
--- /dev/null
+++ b/mcs/class/System.XML/System.Xml/XmlWriter.cs
@@ -0,0 +1,170 @@
+//
+// System.Xml.XmlTextWriter
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+
+namespace System.Xml
+{
+ public abstract class XmlWriter
+ {
+ #region Fields
+
+ protected WriteState ws = WriteState.Start;
+ protected XmlNamespaceManager namespaceManager = new XmlNamespaceManager (new NameTable ());
+
+ #endregion
+
+ #region Constructors
+
+ protected XmlWriter () { }
+
+ #endregion
+
+ #region Properties
+
+ public abstract WriteState WriteState { get; }
+
+ public abstract string XmlLang { get; }
+
+ public abstract XmlSpace XmlSpace { get; }
+
+ #endregion
+
+ #region Methods
+
+ public abstract void Close ();
+
+ public abstract void Flush ();
+
+ public abstract string LookupPrefix (string ns);
+
+ [MonoTODO]
+ public virtual void WriteAttributes (XmlReader reader, bool defattr)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void WriteAttributeString (string localName, string value)
+ {
+ WriteAttributeString ("", localName, "", value);
+ }
+
+ public void WriteAttributeString (string localName, string ns, string value)
+ {
+ WriteAttributeString ("", localName, ns, value);
+ }
+
+ public void WriteAttributeString (string prefix, string localName, string ns, string value)
+ {
+ if ((prefix == "xmlns") || (localName == "xmlns"))
+ ns = value;
+
+ WriteStartAttribute (prefix, localName, ns);
+ WriteString (value);
+ WriteEndAttribute ();
+
+ if ((prefix == "xmlns") || (localName == "xmlns"))
+ {
+ if (prefix == "xmlns")
+ namespaceManager.AddNamespace (localName, ns);
+ else
+ namespaceManager.AddNamespace ("", ns);
+ }
+ }
+
+ public abstract void WriteBase64 (byte[] buffer, int index, int count);
+
+ public abstract void WriteBinHex (byte[] buffer, int index, int count);
+
+ public abstract void WriteCData (string text);
+
+ public abstract void WriteCharEntity (char ch);
+
+ public abstract void WriteChars (char[] buffer, int index, int count);
+
+ public abstract void WriteComment (string text);
+
+ public abstract void WriteDocType (string name, string pubid, string sysid, string subset);
+
+ public void WriteElementString (string localName, string value)
+ {
+ WriteStartElement(localName);
+ WriteString(value);
+ WriteEndElement();
+ }
+
+ public void WriteElementString (string localName, string ns, string value)
+ {
+ WriteStartElement(localName, ns);
+ WriteString(value);
+ WriteEndElement();
+ }
+
+ public abstract void WriteEndAttribute ();
+
+ public abstract void WriteEndDocument ();
+
+ public abstract void WriteEndElement ();
+
+ public abstract void WriteEntityRef (string name);
+
+ public abstract void WriteFullEndElement ();
+
+ public abstract void WriteName (string name);
+
+ public abstract void WriteNmToken (string name);
+
+ [MonoTODO]
+ public virtual void WriteNode (XmlReader reader, bool defattr)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public abstract void WriteProcessingInstruction (string name, string text);
+
+ public abstract void WriteQualifiedName (string localName, string ns);
+
+ public abstract void WriteRaw (string data);
+
+ public abstract void WriteRaw (char[] buffer, int index, int count);
+
+ public void WriteStartAttribute (string localName, string ns)
+ {
+ WriteStartAttribute ("", localName, ns);
+ }
+
+ public abstract void WriteStartAttribute (string prefix, string localName, string ns);
+
+ public abstract void WriteStartDocument ();
+
+ public abstract void WriteStartDocument (bool standalone);
+
+ public void WriteStartElement (string localName)
+ {
+ WriteStartElementInternal ("", localName, "");
+ }
+
+ public void WriteStartElement (string localName, string ns)
+ {
+ WriteStartElement ("", localName, ns);
+ }
+
+ public abstract void WriteStartElement (string prefix, string localName, string ns);
+
+ protected abstract void WriteStartElementInternal (string prefix, string localName, string ns);
+
+ public abstract void WriteString (string text);
+
+ public abstract void WriteSurrogateCharEntity (char lowChar, char highChar);
+
+ public abstract void WriteWhitespace (string ws);
+
+ #endregion
+ }
+}
diff --git a/mcs/class/System.XML/Test/.cvsignore b/mcs/class/System.XML/Test/.cvsignore
new file mode 100644
index 00000000000..136fcca0890
--- /dev/null
+++ b/mcs/class/System.XML/Test/.cvsignore
@@ -0,0 +1,4 @@
+*.dll
+*.csproj.user
+bin
+obj
diff --git a/mcs/class/System.XML/Test/AllTests.cs b/mcs/class/System.XML/Test/AllTests.cs
new file mode 100644
index 00000000000..e97c32e34eb
--- /dev/null
+++ b/mcs/class/System.XML/Test/AllTests.cs
@@ -0,0 +1,42 @@
+// Author:
+// Mario Martinez (mariom925@home.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ /// <summary>
+ /// Combines all unit tests for the System.XML.dll assembly
+ /// into one test suite.
+ /// </summary>
+ public class AllTests : TestCase
+ {
+ public AllTests (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (new TestSuite (typeof (XmlProcessingInstructionTests)));
+ suite.AddTest (new TestSuite (typeof (XmlTextTests)));
+ suite.AddTest (new TestSuite (typeof (XmlTextReaderTests)));
+ suite.AddTest (new TestSuite (typeof (XmlTextWriterTests)));
+ suite.AddTest (new TestSuite (typeof (XmlNamespaceManagerTests)));
+ suite.AddTest (new TestSuite (typeof (XmlAttributeTests)));
+ suite.AddTest (new TestSuite (typeof (XmlDocumentTests)));
+ suite.AddTest (new TestSuite (typeof (NameTableTests)));
+ suite.AddTest (new TestSuite (typeof (XmlElementTests)));
+ suite.AddTest (new TestSuite (typeof (XmlNodeListTests)));
+ suite.AddTest (new TestSuite (typeof (XmlCommentTests)));
+ suite.AddTest (new TestSuite (typeof (XmlCDataSectionTests)));
+ suite.AddTest (new TestSuite (typeof (XmlWhitespaceTests)));
+ suite.AddTest (new TestSuite (typeof (XmlSignificantWhitespaceTests)));
+ suite.AddTest (new TestSuite (typeof (XmlDeclarationTests)));
+ suite.AddTest (new TestSuite (typeof (XmlDocumentTypeTests)));
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/ChangeLog b/mcs/class/System.XML/Test/ChangeLog
new file mode 100644
index 00000000000..0fbb63d007d
--- /dev/null
+++ b/mcs/class/System.XML/Test/ChangeLog
@@ -0,0 +1,294 @@
+2002-04-08 Kral Ferch <kral_ferch@hotmail.com>
+
+ * AllTests.cs: added XmlProcessingInstructionTests and XmlTextTests.
+
+ * MonoMicro.Test.csproj: Added XmlProcessingInstructionTests.cs and
+ XmlTextTests.cs.
+
+ * XmlAttributeTests.cs: Added TestAttributeInnerAndOuterXml.
+
+ * XmlCDataSectionTests.cs: Added TestXmlCDataSectionInnerAndOuterXml.
+
+ * XmlCommentTests.cs: Added TestXmlCommentInnerAndOuterXml.
+
+ * XmlDeclarationTests.cs: Added TestInnerAndOuterXml.
+
+ * XmlDocumentTests.cs: Added TestInnerAndOuterXml.
+
+ * XmlElementTests.cs: Added TestInnerAndOuterXml.
+
+ * XmlProcessingInstructionTests.cs: Initial check-in.
+
+ * XmlSignificantWhitespaceTests.cs: Added TestInnerAndOuterXml.
+
+ * XmlTextTests.cs: Initial check-in.
+
+ * XmlTextWriterTests.cs: Added TestWriteRaw, TestWriteRawInvalidInAttribute,
+ and TestXmlSpaceRaw.
+
+ * XmlWhiteSpacesTests.cs: Added TestInnerAndOuterXml.
+
+2002-04-05 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: CreateNode tests.
+
+2002-04-01 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Tests for WriteEndDocument and WriteFullEndElement.
+
+2002-03-31 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Tests for LookupPrefix, WriteBase64,
+ and WriteCharEntity.
+
+2002-03-31 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Finished XmlLang, XmlSpace, and
+ Attribute namespace declaration tests.
+
+2002-03-29 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: XmlLang and XmlSpace tests.
+
+2002-03-29 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Working on Attributes.
+
+2002-03-28 Duncan Mak <duncan@ximian.com>
+
+ * XmlDeclarationTests.cs (TestConstructor):
+ * XmlDocumentTypeTests.cs (TestAppendChild):
+ * XmlSignificantWhitespaceTests.cs (TestXmlWhitespaceConstructor):
+ * XmlWhiteSpaceTests.cs (TestXmlWhitespaceConstructor): Fixed the
+ test for catching Exceptions.
+
+2002-03-26 Jason Diamond <jason@injektilo.org>
+
+ * AllTests.cs:
+ * Mono.Test.csproj: Removed XPathScanner tests.
+
+ * System.XML_test.build: Test XPathScanner separately.
+
+2002-03-26 Duncan Mak <duncan@ximian.com>
+
+ * AllTests.cs:
+ * Microsoft.Test.csproj:
+ * Mono.Test.csproj: Updated to include new test,
+ XmlDocumentTypeTests.
+
+ * XmlDocumentTypeTests.cs: New testsuite for XmlDocumentType class.
+
+ * XmlCommentTests.cs (TestXmlNodeBaseProperties): Move the
+ XmlNode.Value test in here.
+
+2002-03-26 Jason Diamond <jason@injektilo.org>
+
+ * XPathScannerTests.cs: More location path tests.
+
+2002-03-25 Jason Diamond <jason@injektilo.org>
+
+ * AllTests.cs:
+ * Microsoft.Test.csproj:
+ * Mono.Test.csproj: Updated to include new test, XmlScannerTests.
+
+ * XPathScannerTests.cs: Added new tests for XPathScanner class.
+
+2002-03-25 Duncan Mak <duncan@ximian.com>
+
+ * AllTests.cs:
+ * Microsoft.Test.csproj:
+ * Mono.Test.csproj: Updated to include new test,
+ XmlDeclarationTests.
+
+ * XmlDeclarationTests.cs: Added new test for XmlDeclaration class.
+
+2002-03-23 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Tests for BaseStream,
+ Namespaces = false, and WriteState.
+
+2002-03-23 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: constructor tests with
+ different encodings to test that encoding gets suppressed
+ on xml declaration when null stream passed to constructor.
+ WriteStartDocument(standalone) tests. Tests for formatting
+ and indentation. Test for invalid value set on QuoteChar.
+
+2002-03-22 Duncan Mak <duncan@ximian.com>
+
+ * AllTests.cs:
+ * Microsoft.Test.csproj:
+ * Mono.Test.csproj: Updated to include new files.
+
+ * XmlCDataSectionTests.cs: Added to CVS.
+
+ * XmlCommentTests.cs: Added to CVS. hanks to Kral for helping me
+ setup a testing environment on VS.NET.
+
+ * XmlElementTests.cs: Reformatted.
+ (TestCloneNode): Added.
+
+ * XmlSignificantWhitespaceTests.cs: Added to CVS.
+
+ * XmlWhiteSpaceTests.cs: Added to CVS.
+
+2002-03-21 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: Tessts parent traversal up through
+ document itself until null. Tests a removed elements next
+ sibling is null.
+
+ * XmlNodeListTests.cs: Tests case where enumerator is on
+ a node that gets removed from list.
+
+ * XmlTextWriterTests.cs: Keeping tests for WriteXXX after
+ writer is closed up to date as new WriteXXX methods are written.
+ TestDocumentStart and TestWriteEndElement.
+
+2002-03-19 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocumentTests.cs: Added a test to check an element's names after
+ loading.
+
+2002-03-17 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: Tests navigation to parents since
+ that was part of a document.Load() bug reported by Mike Kestner.
+
+ * XmlTextWriterTests.cs: Tests for namespaces and prefixes.
+
+2002-03-17 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: TestOuterXml.
+
+ * XmlTextWriterTests.cs: Tests for CData, Close, Comment, Element,
+ and ProcessingInstruction.
+
+2002-03-17 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: More LoadXml tests.
+
+ * XmlTextWriterTests.cs: Test for invalid Processing Instructions.
+
+2002-03-14 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Added tests TestCData and TestComment.
+
+2002-03-14 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlTextWriterTests.cs: Initial checkin.
+
+2002-03-12 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNodeListTests.cs: New tests: TestNodeTypesThatCantHaveChildren,
+ TestZeroChildren, TestOneChild, TestMultipleChildren,
+ TestAppendChildAffectOnEnumeration, TestRemoveChildAffectOnEnumeration,
+ TestRemoveOnlyChildAffectOnEnumeration, TestCurrentBeforeFirstNode,
+ TestCurrentAfterLastNode, TestCurrentDoesntMove, and TestReset. Made
+ two other tests but not in use yet until RemoveAll is implemented for
+ attributes and XmlNode.ReplaceChild is implemented. The tests are called
+ saveTestReplaceChildAffectOnEnumeration and saveTestRemoveAllAffectOnEnumeration.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReaderTests.cs: Test MoveToElement and MoveToFirstAttribute.
+
+2002-03-08 Jason Diamond <jason@injektilo.org>
+
+ * XmlAttributeTests.cs: Test XmlAttribute child nodes.
+
+2002-03-08 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlNodeListTests.cs: New file.
+
+ * AllTests.cs: Added XmlNodeListTests.
+
+2002/03/08 Nick Drochak <ndrochak@gol.com>
+
+ * System_test.build: Don't build test dll by default. Only build
+ it when 'make test' is specified.
+
+2002-03-06 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlAttributeTests.cs: Fixed bug in TestHasChildNodes test.
+
+ * XmlDocumentTests.cs: Started work on some tests for invalid data in
+ various nodes created by the document.
+
+2002-03-02 Kral Ferch <kral_ferch@hotmail.com>
+
+ * XmlDocumentTests.cs: New tests TestLoadProcessingInstruction(),
+ TestLoadCDATA(), and TestLoadComment().
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlElementTests.cs: New file.
+
+ * AllTests.cs: Added XmlElementTests.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReaderTests.cs: Test MoveToNextAttribute().
+
+ * XmlDocumentTests.cs: Test loading document containing attributes
+ and text nodes.
+
+2002-03-02 Mike Kestner <mkestner@speakeasy.net>
+
+ * XmlAttributeTests.cs : New test suite for attrs.
+ * AllTests.cs : Add the attr suite.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * XmlNamespaceManagerTests.cs: Make sure the XmlNamespaceManager
+ is using its name table.
+
+ * NameTableTests.cs: Make sure NameTable is really returning the
+ same references.
+
+2002-02-28 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocumentTests.cs: Tests for XmlDocument.LoadXml courtesy of
+ Kral Ferch <kral.ferch@hotmail.com>.
+
+2002-02-28 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReaderTests.cs: Test for XmlException when parse fail.
+
+2002-02-27 Martin Baulig <martin@gnome.org>
+
+ * System.XML_test.build: Build new executable RunTests.System.XML.exe
+ which you can use to run the tests on Linux.
+
+ * *.cs: Added zero-args constructors.
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * NameTableTests.cs: Test for System.Xml.NameTable.
+
+2002-02-26 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReaderTests.cs: Test for namespace declarations as
+ attributes.
+
+ * XmlNamespaceManagerTests.cs: Use the newly implemented NameTable
+ when creating the XmlNamespaceManager. Properly test HasNamespace.
+
+2002-02-25 Jason Diamond <jason@injektilo.org>
+
+ * XmlDocumentTests.cs: Added file.
+
+2002-02-23 Jason Diamond <jason@injektilo.org>
+
+ * XmlTextReaderTests.cs: Added tests for qualified attributes.
+
+2002-02-23 Jason Diamond <jason@injektilo.org>
+
+ * ChangeLog: Added change log to this directory.
+
+ * Test.cs: Renamed to XmlTextReaderTests.cs.
+
+ * XmlTextReaderTests.cs: Added tests for NamespaceURI property.
+
+ * XmlNamespaceManagerTests.cs: Initial tests.
diff --git a/mcs/class/System.XML/Test/Microsoft.Test.csproj b/mcs/class/System.XML/Test/Microsoft.Test.csproj
new file mode 100644
index 00000000000..99f1015f00e
--- /dev/null
+++ b/mcs/class/System.XML/Test/Microsoft.Test.csproj
@@ -0,0 +1,162 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{D6C51F53-33E2-41DF-981A-33FCFA81CDA7}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "Microsoft.Test"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "Test"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "NUnitCore"
+ AssemblyName = "NUnitCore"
+ HintPath = "..\..\..\nunit\NUnitCore.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AllTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "NameTableTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlAttributeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCDataSectionTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCommentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDeclarationTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTypeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlElementTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNamespaceManagerTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNodeListTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlSignificantWhitespaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextReaderTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextWriterTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlWhiteSpaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.XML/Test/Mono.Test.csproj b/mcs/class/System.XML/Test/Mono.Test.csproj
new file mode 100644
index 00000000000..677a5b82388
--- /dev/null
+++ b/mcs/class/System.XML/Test/Mono.Test.csproj
@@ -0,0 +1,167 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{D6C51F53-33E2-41DF-981A-33FCFA81CDA7}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "Mono.Test"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "Test"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "Mono.System.XML"
+ Project = "{0CB7FB41-3C0F-40E8-ACD3-8C5B8BC35B2C}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "NUnitCore"
+ AssemblyName = "NUnitCore"
+ HintPath = "..\..\..\nunit\NUnitCore.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AllTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "NameTableTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlAttributeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCDataSectionTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCommentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDeclarationTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTypeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlElementTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNamespaceManagerTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNodeListTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlSignificantWhitespaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextReaderTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextWriterTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlWhiteSpaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.XML/Test/MonoMicro.Test.csproj b/mcs/class/System.XML/Test/MonoMicro.Test.csproj
new file mode 100644
index 00000000000..0d5aea343d7
--- /dev/null
+++ b/mcs/class/System.XML/Test/MonoMicro.Test.csproj
@@ -0,0 +1,177 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{F7734143-3845-4288-B1CA-FE614FFA70F0}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "MonoMicro.Test"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "MonoMicro.Test"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "NUnitCore"
+ AssemblyName = "NUnitCore"
+ HintPath = "..\..\..\nunit\NUnitCore.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.XML"
+ HintPath = "..\obj\Debug\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AllTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ChangeLog"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "NameTableTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlAttributeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCDataSectionTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlCommentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDeclarationTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlDocumentTypeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlElementTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNamespaceManagerTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlNodeListTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlProcessingInstructionTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlSignificantWhitespaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextReaderTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlTextWriterTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlWhiteSpaceTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/class/System.XML/Test/NameTableTests.cs b/mcs/class/System.XML/Test/NameTableTests.cs
new file mode 100755
index 00000000000..b967e820e69
--- /dev/null
+++ b/mcs/class/System.XML/Test/NameTableTests.cs
@@ -0,0 +1,91 @@
+//
+// System.Xml.NameTableTests.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class NameTableTests : TestCase
+ {
+ NameTable table;
+
+ public NameTableTests (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ table = new NameTable ();
+ }
+
+ //
+ // Tests System.Xml.NameTable.Add (string)
+ //
+ public void TestAdd1 ()
+ {
+ string add = "add1";
+ string testAdd = table.Add (add);
+ AssertEquals (add, testAdd);
+ AssertSame (add, testAdd);
+ }
+
+ //
+ // Tests System.Xml.NameTable.Add (char[], int, int)
+ //
+ public void TestAdd2 ()
+ {
+ char[] test = new char [4] { 'a', 'd', 'd', '2' };
+ int index = 0;
+ int length = 3; // "add"
+
+ AssertEquals ("add", table.Add (test, index, length));
+ }
+
+ //
+ // Tests System.Xml.NameTable.Get (string)
+ //
+ public void TestGet1 ()
+ {
+ string get1 = "get1";
+ string testGet = table.Add (get1);
+
+ AssertEquals (table.Get (get1), testGet);
+ AssertSame (get1, testGet );
+ }
+
+ //
+ // Tests System.Xml.NameTable.Get (char[], int, int)
+ //
+ public void TestGet2 ()
+ {
+ char[] test = new char [4] { 'g', 'e', 't', '2' };
+ int index = 0;
+ int length = 3; // "get"
+
+ string testGet = table.Add (test, index, length);
+
+ AssertEquals (table.Get (test, index, length), testGet);
+ }
+
+ //
+ // Tests System.Xml.NameTable.Get (char[], int, 0)
+ //
+ public void TestGet3 ()
+ {
+ char[] test = new char [4] { 't', 'e', 's', 't' };
+ int index = 0;
+ int length = 0;
+
+ AssertEquals (table.Get (test, index, length), String.Empty);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/System.XML_test.build b/mcs/class/System.XML/Test/System.XML_test.build
new file mode 100644
index 00000000000..b388d17407c
--- /dev/null
+++ b/mcs/class/System.XML/Test/System.XML_test.build
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.XML_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="System.XML_test" default="build">
+ <property name="debug" value="false"/>
+ <property name="nunit_home" value="..\..\..\nunit"/>
+
+ <target name="build">
+ </target>
+
+ <target name="assemblies">
+ <csc target="library" output="System.XML_test.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="TheTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore.dll"/>
+ </references>
+ <arg value="/r:.\System.XML.dll"/>
+ </csc>
+
+ <csc target="exe" output="RunTests.System.XML.exe" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="**/AllTests.cs"/>
+ <excludes name="**/MartinTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitBase.dll"/>
+ </references>
+ <arg value="/nowarn:1595"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:.\System.XML.dll"/>
+ </csc>
+
+ </target>
+
+ <target name="test" depends="assemblies">
+ <exec program="..\..\..\nunit\NUnitConsole" commandline="Ximian.Mono.Tests.AllTests,System.XML_test.dll" failonerror="false"/>
+ <exec program="..\..\..\nunit\NUnitConsole" commandline="Ximian.Mono.Tests.XPathScannerTests,System.XML_test.dll" failonerror="false"/>
+ </target>
+
+ <target name="clean">
+ <delete file="System.XML.dll" failonerror="false"/>
+ <delete file="System.XML_test.dll" failonerror="false"/>
+ <delete file="System.XML_test.pdb" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System.XML/Test/TheTests.cs b/mcs/class/System.XML/Test/TheTests.cs
new file mode 100644
index 00000000000..00fc6f98706
--- /dev/null
+++ b/mcs/class/System.XML/Test/TheTests.cs
@@ -0,0 +1,93 @@
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace Ximian.Mono.Tests
+{
+ public class RunXmlTextReaderTests : XmlTextReaderTests
+ {
+ protected override void RunTest ()
+ {
+ TestEmptyElement ();
+ TestEmptyElementWithWhitespace ();
+ TestEmptyElementWithStartAndEndTag ();
+ TestEmptyElementWithStartAndEndTagWithWhitespace ();
+ TestNestedEmptyTag ();
+ TestNestedText ();
+ TestEmptyElementWithAttribute ();
+ TestStartAndEndTagWithAttribute ();
+ TestEmptyElementWithTwoAttributes ();
+ TestProcessingInstructionBeforeDocumentElement ();
+ TestCommentBeforeDocumentElement ();
+ TestPredefinedEntities ();
+ TestEntityReference ();
+ TestEntityReferenceInsideText ();
+ TestCharacterReferences ();
+ TestEntityReferenceInAttribute ();
+ TestPredefinedEntitiesInAttribute ();
+ TestCharacterReferencesInAttribute ();
+ TestCDATA ();
+ TestEmptyElementInNamespace ();
+ TestEmptyElementInDefaultNamespace ();
+ TestChildElementInNamespace ();
+ TestChildElementInDefaultNamespace ();
+ TestAttributeInNamespace ();
+ TestIsName ();
+ TestIsNameToken ();
+ }
+ }
+}
+
+namespace Ximian.Mono.Tests
+{
+ public class RunXmlNamespaceManagerTests : XmlNamespaceManagerTests
+ {
+ protected override void RunTest ()
+ {
+ TestNewNamespaceManager ();
+ TestAddNamespace ();
+ TestPushScope ();
+ TestPopScope ();
+ }
+ }
+}
+
+namespace Ximian.Mono.Tests
+{
+ public class RunXmlDocumentTests : XmlDocumentTests
+ {
+ protected override void RunTest ()
+ {
+ TestDocumentElement ();
+ }
+ }
+}
+
+namespace MonoTests
+{
+ public class RunAllTests
+ {
+ public static void AddAllTests (TestSuite suite)
+ {
+ suite.AddTest (new Ximian.Mono.Tests.RunXmlTextReaderTests ());
+ suite.AddTest (new Ximian.Mono.Tests.RunXmlNamespaceManagerTests ());
+ suite.AddTest (new Ximian.Mono.Tests.RunXmlDocumentTests ());
+ }
+ }
+}
+
+class MainApp
+{
+ public static void Main()
+ {
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");
+
+ TestResult result = new TestResult ();
+ TestSuite suite = new TestSuite ();
+ MonoTests.RunAllTests.AddAllTests (suite);
+ suite.Run (result);
+ MonoTests.MyTestRunner.Print (result);
+ }
+}
+
diff --git a/mcs/class/System.XML/Test/XPathScannerTests.cs b/mcs/class/System.XML/Test/XPathScannerTests.cs
new file mode 100644
index 00000000000..fad9d810c40
--- /dev/null
+++ b/mcs/class/System.XML/Test/XPathScannerTests.cs
@@ -0,0 +1,340 @@
+//
+// XPathScannerTests.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Xml.XPath;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XPathScannerTests : TestCase
+ {
+ public XPathScannerTests () : base ("Ximian.Mono.Tests.XPathScannerTests testsuite") { }
+ public XPathScannerTests (string name) : base (name) { }
+
+ public void TestLocationPathWithOneNameTest ()
+ {
+ XPathScanner scanner = new XPathScanner ("foo");
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestLocationPathWithTwoNameTests ()
+ {
+ XPathScanner scanner = new XPathScanner ("foo/bar");
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.Operator, scanner.Scan ());
+ AssertEquals ("/", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("bar", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestLocationPathWithOneQualifiedNameTest ()
+ {
+ XPathScanner scanner = new XPathScanner ("foo:bar");
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo:bar", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestLocationPathWithTwoQualifiedNameTests ()
+ {
+ XPathScanner scanner = new XPathScanner ("foo:bar/baz:quux");
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo:bar", scanner.Value);
+ AssertEquals (XPathTokenType.Operator, scanner.Scan ());
+ AssertEquals ("/", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("baz:quux", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestLocationPathWithOneNameTestWithAxisName ()
+ {
+ XPathScanner scanner = new XPathScanner ("child::foo");
+ AssertEquals (XPathTokenType.AxisName, scanner.Scan ());
+ AssertEquals ("child", scanner.Value);
+ AssertEquals (XPathTokenType.ColonColon, scanner.Scan ());
+ AssertEquals ("::", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestLocationPathWithTwoNameTestsWithAxisNames ()
+ {
+ XPathScanner scanner = new XPathScanner ("child::foo/preceding-sibling::bar");
+ AssertEquals (XPathTokenType.AxisName, scanner.Scan ());
+ AssertEquals ("child", scanner.Value);
+ AssertEquals (XPathTokenType.ColonColon, scanner.Scan ());
+ AssertEquals ("::", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.Operator, scanner.Scan ());
+ AssertEquals ("/", scanner.Value);
+ AssertEquals (XPathTokenType.AxisName, scanner.Scan ());
+ AssertEquals ("preceding-sibling", scanner.Value);
+ AssertEquals (XPathTokenType.ColonColon, scanner.Scan ());
+ AssertEquals ("::", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("bar", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestCommentNodeType ()
+ {
+ XPathScanner scanner = new XPathScanner ("comment()");
+ AssertEquals (XPathTokenType.NodeType, scanner.Scan ());
+ AssertEquals ("comment", scanner.Value);
+ AssertEquals (XPathTokenType.LeftParen, scanner.Scan ());
+ AssertEquals ("(", scanner.Value);
+ AssertEquals (XPathTokenType.RightParen, scanner.Scan ());
+ AssertEquals (")", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestNodeNodeType ()
+ {
+ XPathScanner scanner = new XPathScanner ("node()");
+ AssertEquals (XPathTokenType.NodeType, scanner.Scan ());
+ AssertEquals ("node", scanner.Value);
+ AssertEquals (XPathTokenType.LeftParen, scanner.Scan ());
+ AssertEquals ("(", scanner.Value);
+ AssertEquals (XPathTokenType.RightParen, scanner.Scan ());
+ AssertEquals (")", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestProcessingInstructionNodeType ()
+ {
+ XPathScanner scanner = new XPathScanner ("processing-instruction()");
+ AssertEquals (XPathTokenType.NodeType, scanner.Scan ());
+ AssertEquals ("processing-instruction", scanner.Value);
+ AssertEquals (XPathTokenType.LeftParen, scanner.Scan ());
+ AssertEquals ("(", scanner.Value);
+ AssertEquals (XPathTokenType.RightParen, scanner.Scan ());
+ AssertEquals (")", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestTextNodeType ()
+ {
+ XPathScanner scanner = new XPathScanner ("text()");
+ AssertEquals (XPathTokenType.NodeType, scanner.Scan ());
+ AssertEquals ("text", scanner.Value);
+ AssertEquals (XPathTokenType.LeftParen, scanner.Scan ());
+ AssertEquals ("(", scanner.Value);
+ AssertEquals (XPathTokenType.RightParen, scanner.Scan ());
+ AssertEquals (")", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestFunctionName ()
+ {
+ XPathScanner scanner = new XPathScanner ("foo()");
+ AssertEquals (XPathTokenType.FunctionName, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.LeftParen, scanner.Scan ());
+ AssertEquals ("(", scanner.Value);
+ AssertEquals (XPathTokenType.RightParen, scanner.Scan ());
+ AssertEquals (")", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestQualifiedFunctionName ()
+ {
+ XPathScanner scanner = new XPathScanner ("foo:bar()");
+ AssertEquals (XPathTokenType.FunctionName, scanner.Scan ());
+ AssertEquals ("foo:bar", scanner.Value);
+ AssertEquals (XPathTokenType.LeftParen, scanner.Scan ());
+ AssertEquals ("(", scanner.Value);
+ AssertEquals (XPathTokenType.RightParen, scanner.Scan ());
+ AssertEquals (")", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestWildcardNameTest ()
+ {
+ XPathScanner scanner = new XPathScanner ("*");
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("*", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestQualifiedWildcardNameTest ()
+ {
+ XPathScanner scanner = new XPathScanner ("foo:*");
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo:*", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestTwoWildcardNameTests ()
+ {
+ XPathScanner scanner = new XPathScanner ("*/*");
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("*", scanner.Value);
+ AssertEquals (XPathTokenType.Operator, scanner.Scan ());
+ AssertEquals ("/", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("*", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestTwoQualifiedWildcardNameTests ()
+ {
+ XPathScanner scanner = new XPathScanner ("foo:*/bar:*");
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo:*", scanner.Value);
+ AssertEquals (XPathTokenType.Operator, scanner.Scan ());
+ AssertEquals ("/", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("bar:*", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestAttributeNameTest ()
+ {
+ XPathScanner scanner = new XPathScanner ("@foo");
+ AssertEquals (XPathTokenType.At, scanner.Scan ());
+ AssertEquals ("@", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestNameTestAndAttributeNameTest ()
+ {
+ XPathScanner scanner = new XPathScanner ("foo/@bar");
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.Operator, scanner.Scan ());
+ AssertEquals ("/", scanner.Value);
+ AssertEquals (XPathTokenType.At, scanner.Scan ());
+ AssertEquals ("@", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("bar", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestAttributeAxis ()
+ {
+ XPathScanner scanner = new XPathScanner ("attribute::foo");
+ AssertEquals (XPathTokenType.AxisName, scanner.Scan ());
+ AssertEquals ("attribute", scanner.Value);
+ AssertEquals (XPathTokenType.ColonColon, scanner.Scan ());
+ AssertEquals ("::", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestNameTestAndAttributeAxis ()
+ {
+ XPathScanner scanner = new XPathScanner ("foo/attribute::bar");
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.Operator, scanner.Scan ());
+ AssertEquals ("/", scanner.Value);
+ AssertEquals (XPathTokenType.AxisName, scanner.Scan ());
+ AssertEquals ("attribute", scanner.Value);
+ AssertEquals (XPathTokenType.ColonColon, scanner.Scan ());
+ AssertEquals ("::", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("bar", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestRoot ()
+ {
+ XPathScanner scanner = new XPathScanner ("/");
+ AssertEquals (XPathTokenType.Operator, scanner.Scan ());
+ AssertEquals ("/", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestAbsoluteNameTest ()
+ {
+ XPathScanner scanner = new XPathScanner ("/foo");
+ AssertEquals (XPathTokenType.Operator, scanner.Scan ());
+ AssertEquals ("/", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestAbbreviatedAbsoluteLocationPathWithNameTest ()
+ {
+ XPathScanner scanner = new XPathScanner ("//foo");
+ AssertEquals (XPathTokenType.Operator, scanner.Scan ());
+ AssertEquals ("//", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestAbbreviatedRelativeLocationPathWithNameTest ()
+ {
+ XPathScanner scanner = new XPathScanner ("foo//bar");
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("foo", scanner.Value);
+ AssertEquals (XPathTokenType.Operator, scanner.Scan ());
+ AssertEquals ("//", scanner.Value);
+ AssertEquals (XPathTokenType.NameTest, scanner.Scan ());
+ AssertEquals ("bar", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestAbbreviatedStepSelf ()
+ {
+ XPathScanner scanner = new XPathScanner (".");
+ AssertEquals (XPathTokenType.Dot, scanner.Scan ());
+ AssertEquals (".", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+
+ public void TestAbbreviatedStepParent ()
+ {
+ XPathScanner scanner = new XPathScanner ("..");
+ AssertEquals (XPathTokenType.DotDot, scanner.Scan ());
+ AssertEquals ("..", scanner.Value);
+ AssertEquals (XPathTokenType.End, scanner.Scan ());
+ AssertNull (scanner.Value);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlAttributeTests.cs b/mcs/class/System.XML/Test/XmlAttributeTests.cs
new file mode 100644
index 00000000000..41ca3b92dbe
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlAttributeTests.cs
@@ -0,0 +1,95 @@
+// XmlAttributeTests.cs : Tests for the XmlAttribute class
+//
+// Author: Mike Kestner <mkestner@speakeasy.net>
+//
+// <c> 2002 Mike Kestner
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlAttributeTests : TestCase
+ {
+ public XmlAttributeTests() : base("Ximian.Mono.Tests.XmlAttributeTests testsuite") { }
+ public XmlAttributeTests(string name) : base(name) { }
+
+ XmlDocument doc;
+ XmlAttribute attr;
+
+ protected override void SetUp()
+ {
+ doc = new XmlDocument();
+ attr = doc.CreateAttribute("attr1");
+ attr.Value = "val1";
+ }
+
+ public void TestAttributes()
+ {
+ AssertNull(attr.Attributes);
+ }
+
+ public void TestAttributeInnerAndOuterXml ()
+ {
+ attr = doc.CreateAttribute ("foo", "bar", "http://abc.def");
+ attr.Value = "baz";
+ AssertEquals ("baz", attr.InnerXml);
+ AssertEquals ("foo:bar=\"baz\"", attr.OuterXml);
+ }
+
+ public void TestAttributeWithNoValue ()
+ {
+ XmlAttribute attribute = doc.CreateAttribute ("name");
+ AssertEquals (String.Empty, attribute.Value);
+ Assert (!attribute.HasChildNodes);
+ AssertNull (attribute.FirstChild);
+ AssertNull (attribute.LastChild);
+ AssertEquals (0, attribute.ChildNodes.Count);
+ }
+
+ public void TestAttributeWithValue ()
+ {
+ XmlAttribute attribute = doc.CreateAttribute ("name");
+ attribute.Value = "value";
+ AssertEquals ("value", attribute.Value);
+ Assert (attribute.HasChildNodes);
+ AssertNotNull (attribute.FirstChild);
+ AssertNotNull (attribute.LastChild);
+ AssertEquals (1, attribute.ChildNodes.Count);
+ AssertEquals (XmlNodeType.Text, attribute.ChildNodes [0].NodeType);
+ AssertEquals ("value", attribute.ChildNodes [0].Value);
+ }
+
+ public void TestHasChildNodes()
+ {
+ Assert(attr.HasChildNodes);
+ }
+
+ public void TestName()
+ {
+ AssertEquals("attr1", attr.Name);
+ }
+
+ public void TestNodeType()
+ {
+ AssertEquals(XmlNodeType.Attribute, attr.NodeType);
+ }
+
+ public void TestOwnerDocument()
+ {
+ AssertSame(doc, attr.OwnerDocument);
+ }
+
+ public void TestParentNode()
+ {
+ AssertNull("Attr parents not allowed", attr.ParentNode);
+ }
+
+ public void TestValue()
+ {
+ AssertEquals("val1", attr.Value);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlCDataSectionTests.cs b/mcs/class/System.XML/Test/XmlCDataSectionTests.cs
new file mode 100755
index 00000000000..84bc194af2c
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlCDataSectionTests.cs
@@ -0,0 +1,99 @@
+//
+// System.Xml.XmlCDataSectionTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlCDataSectionTests : TestCase
+ {
+ XmlDocument document;
+ XmlCDataSection section;
+ XmlNode original;
+ XmlNode deep;
+ XmlNode shallow;
+
+ public XmlCDataSectionTests ()
+ : base ("Ximian.Mono.Tests.XmlCDataSectionTests testsuite")
+ {
+ }
+
+ public XmlCDataSectionTests (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<root><foo></foo></root>");
+ section = document.CreateCDataSection ("CDataSection");
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+ // AssertEquals (original.nodetype + " was incorrectly cloned.",
+ // original.baseuri, cloned.baseuri);
+ AssertNull (cloned.ParentNode);
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ public void TestXmlCDataSectionInnerAndOuterXml ()
+ {
+ section = document.CreateCDataSection ("foo");
+ AssertEquals (String.Empty, section.InnerXml);
+ AssertEquals ("<![CDATA[foo]]>", section.OuterXml);
+ }
+
+ public void TestXmlCDataSectionName ()
+ {
+ AssertEquals (section.NodeType + " Name property broken",
+ section.Name, "#cdata-section");
+ }
+
+ public void TestXmlCDataSectionLocalName ()
+ {
+ AssertEquals (section.NodeType + " LocalName property broken",
+ section.LocalName, "#cdata-section");
+ }
+
+ public void TestXmlCDataSectionNodeType ()
+ {
+ AssertEquals ("XmlCDataSection NodeType property broken",
+ section.NodeType.ToString (), "CDATA");
+ }
+
+ public void TestXmlCDataSectionIsReadOnly ()
+ {
+ AssertEquals ("XmlCDataSection IsReadOnly property broken",
+ section.IsReadOnly, false);
+ }
+
+ public void TestXmlCDataSectionCloneNode ()
+ {
+ original = section;
+
+ shallow = section.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, shallow.Value);
+
+ deep = section.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, deep.Value);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlCommentTests.cs b/mcs/class/System.XML/Test/XmlCommentTests.cs
new file mode 100755
index 00000000000..f3602699e8a
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlCommentTests.cs
@@ -0,0 +1,107 @@
+//
+// System.Xml.XmlCommentTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlCommentTests : TestCase
+ {
+ XmlDocument document;
+ XmlComment comment;
+ XmlNode original;
+ XmlNode deep;
+ XmlNode shallow;
+
+ public XmlCommentTests () : base ("Ximian.Mono.Tests.XmlCommentTests testsuite") {}
+
+ public XmlCommentTests (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ }
+
+ public void TestXmlCommentCloneNode ()
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+ original = comment;
+
+ shallow = comment.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+
+ deep = comment.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, deep.Value);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+
+ public void TestXmlCommentInnerAndOuterXml ()
+ {
+ comment = document.CreateComment ("foo");
+ AssertEquals (String.Empty, comment.InnerXml);
+ AssertEquals ("<!--foo-->", comment.OuterXml);
+ }
+
+ public void TestXmlCommentIsReadOnly ()
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+ AssertEquals ("XmlComment IsReadOnly property broken",
+ comment.IsReadOnly, false);
+ }
+
+ public void TestXmlCommentLocalName ()
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+ AssertEquals (comment.NodeType + " LocalName property broken",
+ comment.LocalName, "#comment");
+ }
+
+ public void TestXmlCommentName ()
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+ AssertEquals (comment.NodeType + " Name property broken",
+ comment.Name, "#comment");
+ }
+
+ public void TestXmlCommentNodeType ()
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+ AssertEquals ("XmlComment NodeType property broken",
+ comment.NodeType.ToString (), "Comment");
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+ document.LoadXml ("<root><foo></foo></root>");
+ comment = document.CreateComment ("Comment");
+
+ // assertequals (original.nodetype + " was incorrectly cloned.",
+ // original.baseuri, cloned.baseuri);
+
+ AssertNull (cloned.ParentNode);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, cloned.Value);
+
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlDeclarationTests.cs b/mcs/class/System.XML/Test/XmlDeclarationTests.cs
new file mode 100755
index 00000000000..c362e8769ed
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlDeclarationTests.cs
@@ -0,0 +1,130 @@
+//
+// System.Xml.XmlDeclarationTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlDeclarationTests : TestCase
+ {
+
+ XmlDocument document;
+ XmlDeclaration declaration;
+
+ public XmlDeclarationTests () : base ("Ximian.Mono.Tests.XmlDeclarationTests testsuite") {}
+
+ public XmlDeclarationTests (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<foo><bar></bar></foo>");
+ declaration = document.CreateXmlDeclaration ("1.0", null, null);
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ declaration = document.CreateXmlDeclaration ("1.0", null, null);
+ AssertEquals (String.Empty, declaration.InnerXml);
+ AssertEquals ("<?xml version=\"1.0\"?>", declaration.OuterXml);
+
+ declaration = document.CreateXmlDeclaration ("1.0", "doesn't check", null);
+ AssertEquals (String.Empty, declaration.InnerXml);
+ AssertEquals ("<?xml version=\"1.0\" encoding=\"doesn't check\"?>", declaration.OuterXml);
+
+ declaration = document.CreateXmlDeclaration ("1.0", null, "yes");
+ AssertEquals (String.Empty, declaration.InnerXml);
+ AssertEquals ("<?xml version=\"1.0\" standalone=\"yes\"?>", declaration.OuterXml);
+
+ declaration = document.CreateXmlDeclaration ("1.0", "foo", "no");
+ AssertEquals (String.Empty, declaration.InnerXml);
+ AssertEquals ("<?xml version=\"1.0\" encoding=\"foo\" standalone=\"no\"?>", declaration.OuterXml);
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+// assertequals (original.nodetype + " was incorrectly cloned.",
+// original.baseuri, cloned.baseuri);
+ AssertNull (cloned.ParentNode);
+
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, cloned.Value);
+
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ public void TestConstructor ()
+ {
+ try {
+ XmlDeclaration broken = document.CreateXmlDeclaration ("2.0", null, null);
+ } catch (ArgumentException) {
+ return;
+
+ } catch (Exception e) {
+ Fail("first arg null, wrong exception: " + e.ToString());
+ }
+ }
+
+ public void TestNodeType ()
+ {
+ AssertEquals ("incorrect NodeType returned", XmlNodeType.XmlDeclaration, declaration.NodeType);
+ }
+
+ public void TestNames ()
+ {
+ AssertEquals ("Name is incorrect", "xml", declaration.Name);
+ AssertEquals ("LocalName is incorrect", "xml", declaration.LocalName);
+ }
+
+ public void TestEncodingProperty ()
+ {
+ XmlDeclaration d1 = document.CreateXmlDeclaration ("1.0", "foo", null);
+ AssertEquals ("Encoding property", "foo", d1.Encoding);
+
+ XmlDeclaration d2 = document.CreateXmlDeclaration ("1.0", null, null);
+ AssertEquals ("null Encoding property", String.Empty, d2.Encoding);
+ }
+
+ public void TestStandaloneProperty ()
+ {
+ XmlDeclaration d1 = document.CreateXmlDeclaration ("1.0", null, "yes");
+ AssertEquals ("Yes standalone property", "yes", d1.Standalone);
+
+ XmlDeclaration d2 = document.CreateXmlDeclaration ("1.0", null, "no");
+ AssertEquals ("No standalone property", "no", d2.Standalone);
+
+ XmlDeclaration d3 = document.CreateXmlDeclaration ("1.0", null, null);
+ AssertEquals ("null Standalone property", String.Empty, d3.Standalone);
+ }
+
+ public void TestValueProperty ()
+ {
+ XmlDeclaration d = document.CreateXmlDeclaration ("1.0", "UTF-8", "yes");
+ AssertEquals ("Value property", "version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"",
+ d.Value);
+ }
+
+ public void TestXmlCommentCloneNode ()
+ {
+ XmlNode original = declaration;
+
+ XmlNode shallow = declaration.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+
+ XmlNode deep = declaration.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlDocumentTests.cs b/mcs/class/System.XML/Test/XmlDocumentTests.cs
new file mode 100644
index 00000000000..5dd96282a9c
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlDocumentTests.cs
@@ -0,0 +1,354 @@
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlDocumentTests : TestCase
+ {
+ public XmlDocumentTests () : base ("Ximian.Mono.Tests.XmlDocumentTests testsuite") {}
+ public XmlDocumentTests (string name) : base (name) {}
+
+ private XmlDocument document;
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ }
+
+ public void TestCreateNodeNodeTypeNameEmptyParams ()
+ {
+ XmlNode node;
+
+ try {
+ node = document.CreateNode (null, null, null);
+ Fail ("Expected an ArgumentException to be thrown.");
+ } catch (ArgumentException) {}
+
+ try {
+ node = document.CreateNode ("attribute", null, null);
+ Fail ("Expected a NullReferenceException to be thrown.");
+ } catch (NullReferenceException) {}
+
+ try {
+ node = document.CreateNode ("attribute", "", null);
+ Fail ("Expected an ArgumentException to be thrown.");
+ } catch (ArgumentException) {}
+
+ try {
+ node = document.CreateNode ("element", null, null);
+ Fail ("Expected a NullReferenceException to be thrown.");
+ } catch (NullReferenceException) {}
+
+ try {
+ node = document.CreateNode ("element", "", null);
+ Fail ("Expected an ArgumentException to be thrown.");
+ } catch (ArgumentException) {}
+
+ try {
+ node = document.CreateNode ("entityreference", null, null);
+ Fail ("Expected a NullReferenceException to be thrown.");
+ } catch (NullReferenceException) {}
+ }
+
+ public void TestCreateNodeInvalidXmlNodeType ()
+ {
+ XmlNode node;
+
+ try {
+ node = document.CreateNode (XmlNodeType.EndElement, null, null);
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ node = document.CreateNode (XmlNodeType.EndEntity, null, null);
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ node = document.CreateNode (XmlNodeType.Entity, null, null);
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ node = document.CreateNode (XmlNodeType.None, null, null);
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ node = document.CreateNode (XmlNodeType.Notation, null, null);
+ Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ // TODO: undocumented allowable type.
+ node = document.CreateNode (XmlNodeType.XmlDeclaration, null, null);
+ AssertEquals (XmlNodeType.XmlDeclaration, node.NodeType);
+ }
+
+ public void TestCreateNodeWhichParamIsUsed ()
+ {
+ XmlNode node;
+
+ // No constructor params for Document, DocumentFragment.
+
+ node = document.CreateNode (XmlNodeType.CDATA, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlCDataSection)node).Value);
+
+ node = document.CreateNode (XmlNodeType.Comment, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlComment)node).Value);
+
+ node = document.CreateNode (XmlNodeType.DocumentType, "a", "b", "c");
+ AssertNull (((XmlDocumentType)node).Value);
+
+// TODO: add this back in to test when it's implemented.
+// node = document.CreateNode (XmlNodeType.EntityReference, "a", "b", "c");
+// AssertNull (((XmlEntityReference)node).Value);
+
+ node = document.CreateNode (XmlNodeType.ProcessingInstruction, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlProcessingInstruction)node).Value);
+
+ node = document.CreateNode (XmlNodeType.SignificantWhitespace, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlSignificantWhitespace)node).Value);
+
+ node = document.CreateNode (XmlNodeType.Text, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlText)node).Value);
+
+ node = document.CreateNode (XmlNodeType.Whitespace, "a", "b", "c");
+ AssertEquals (String.Empty, ((XmlWhitespace)node).Value);
+
+ node = document.CreateNode (XmlNodeType.XmlDeclaration, "a", "b", "c");
+ AssertEquals ("version=\"1.0\"", ((XmlDeclaration)node).Value);
+ }
+
+ public void TestCreateNodeNodeTypeName ()
+ {
+ XmlNode node;
+
+ try {
+ node = document.CreateNode ("foo", null, null);
+ Fail ("Expected an ArgumentException to be thrown.");
+ } catch (ArgumentException) {}
+
+ node = document.CreateNode("attribute", "foo", null);
+ AssertEquals (XmlNodeType.Attribute, node.NodeType);
+
+ node = document.CreateNode("cdatasection", null, null);
+ AssertEquals (XmlNodeType.CDATA, node.NodeType);
+
+ node = document.CreateNode("comment", null, null);
+ AssertEquals (XmlNodeType.Comment, node.NodeType);
+
+ node = document.CreateNode("document", null, null);
+ AssertEquals (XmlNodeType.Document, node.NodeType);
+ // TODO: test which constructor this ended up calling,
+ // i.e. reuse underlying NameTable or not?
+
+// TODO: add this back in to test when it's implemented.
+// node = document.CreateNode("documentfragment", null, null);
+// AssertEquals (XmlNodeType.DocumentFragment, node.NodeType);
+
+ node = document.CreateNode("documenttype", null, null);
+ AssertEquals (XmlNodeType.DocumentType, node.NodeType);
+
+ node = document.CreateNode("element", "foo", null);
+ AssertEquals (XmlNodeType.Element, node.NodeType);
+
+// TODO: add this back in to test when it's implemented.
+// node = document.CreateNode("entityreference", "foo", null);
+// AssertEquals (XmlNodeType.EntityReference, node.NodeType);
+
+ node = document.CreateNode("processinginstruction", null, null);
+ AssertEquals (XmlNodeType.ProcessingInstruction, node.NodeType);
+
+ node = document.CreateNode("significantwhitespace", null, null);
+ AssertEquals (XmlNodeType.SignificantWhitespace, node.NodeType);
+
+ node = document.CreateNode("text", null, null);
+ AssertEquals (XmlNodeType.Text, node.NodeType);
+
+ node = document.CreateNode("whitespace", null, null);
+ AssertEquals (XmlNodeType.Whitespace, node.NodeType);
+ }
+
+ public void TestDocumentElement ()
+ {
+ AssertNull (document.DocumentElement);
+ XmlElement element = document.CreateElement ("foo", "bar", "http://foo/");
+ AssertNotNull (element);
+
+ AssertEquals ("foo", element.Prefix);
+ AssertEquals ("bar", element.LocalName);
+ AssertEquals ("http://foo/", element.NamespaceURI);
+
+ AssertEquals ("foo:bar", element.Name);
+
+ AssertSame (element, document.AppendChild (element));
+
+ AssertSame (element, document.DocumentElement);
+ }
+
+ public void TestDocumentEmpty()
+ {
+ AssertEquals ("Incorrect output for empty document.", "", document.OuterXml);
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ AssertEquals (String.Empty, document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+
+ XmlDeclaration declaration = document.CreateXmlDeclaration ("1.0", null, null);
+ document.AppendChild (declaration);
+ AssertEquals ("<?xml version=\"1.0\"?>", document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+
+ XmlElement element = document.CreateElement ("foo");
+ document.AppendChild (element);
+ AssertEquals ("<?xml version=\"1.0\"?><foo />", document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+
+ XmlComment comment = document.CreateComment ("bar");
+ document.DocumentElement.AppendChild (comment);
+ AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar--></foo>", document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+
+ XmlText text = document.CreateTextNode ("baz");
+ document.DocumentElement.AppendChild (text);
+ AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar-->baz</foo>", document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+
+ element = document.CreateElement ("quux");
+ element.SetAttribute ("quuux", "squonk");
+ document.DocumentElement.AppendChild (element);
+ AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar-->baz<quux quuux=\"squonk\" /></foo>", document.InnerXml);
+ AssertEquals (document.InnerXml, document.OuterXml);
+ }
+
+ public void TestLoadXmlCDATA ()
+ {
+ document.LoadXml ("<foo><![CDATA[bar]]></foo>");
+ Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.CDATA);
+ AssertEquals ("bar", document.DocumentElement.FirstChild.Value);
+ }
+
+ public void TestLoadXMLComment()
+ {
+// XmlTextReader needs to throw this exception
+// try {
+// document.LoadXml("<!--foo-->");
+// Fail("XmlException should have been thrown.");
+// }
+// catch (XmlException e) {
+// AssertEquals("Exception message doesn't match.", "The root element is missing.", e.Message);
+// }
+
+ document.LoadXml ("<foo><!--Comment--></foo>");
+ Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.Comment);
+ AssertEquals ("Comment", document.DocumentElement.FirstChild.Value);
+
+ document.LoadXml (@"<foo><!--bar--></foo>");
+ AssertEquals ("Incorrect target.", "bar", ((XmlComment)document.FirstChild.FirstChild).Data);
+ }
+
+ public void TestLoadXmlElementSingle ()
+ {
+ AssertNull (document.DocumentElement);
+ document.LoadXml ("<foo/>");
+
+ AssertNotNull (document.DocumentElement);
+ AssertSame (document.FirstChild, document.DocumentElement);
+
+ AssertEquals (String.Empty, document.DocumentElement.Prefix);
+ AssertEquals ("foo", document.DocumentElement.LocalName);
+ AssertEquals (String.Empty, document.DocumentElement.NamespaceURI);
+ AssertEquals ("foo", document.DocumentElement.Name);
+ }
+
+ public void TestLoadXmlElementWithAttributes ()
+ {
+ AssertNull (document.DocumentElement);
+ document.LoadXml ("<foo bar='baz' quux='quuux'/>");
+
+ XmlElement documentElement = document.DocumentElement;
+
+ AssertEquals ("baz", documentElement.GetAttribute ("bar"));
+ AssertEquals ("quuux", documentElement.GetAttribute ("quux"));
+ }
+ public void TestLoadXmlElementWithChildElement ()
+ {
+ document.LoadXml ("<foo><bar/></foo>");
+ Assert (document.ChildNodes.Count == 1);
+ Assert (document.FirstChild.ChildNodes.Count == 1);
+ AssertEquals ("foo", document.DocumentElement.LocalName);
+ AssertEquals ("bar", document.DocumentElement.FirstChild.LocalName);
+ }
+
+ public void TestLoadXmlElementWithTextNode ()
+ {
+ document.LoadXml ("<foo>bar</foo>");
+ Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.Text);
+ AssertEquals ("bar", document.DocumentElement.FirstChild.Value);
+ }
+
+ public void TestLoadXmlExceptionClearsDocument ()
+ {
+ document.LoadXml ("<foo/>");
+ Assert (document.FirstChild != null);
+
+ try {
+ document.LoadXml ("<123/>");
+ Fail ("An XmlException should have been thrown.");
+ } catch (XmlException) {}
+
+ Assert (document.FirstChild == null);
+ }
+
+ public void TestLoadXmlProcessingInstruction ()
+ {
+ document.LoadXml (@"<?foo bar='baaz' quux='quuux'?><quuuux></quuuux>");
+ AssertEquals ("Incorrect target.", "foo", ((XmlProcessingInstruction)document.FirstChild).Target);
+ AssertEquals ("Incorrect data.", "bar='baaz' quux='quuux'", ((XmlProcessingInstruction)document.FirstChild).Data);
+ }
+
+ public void TestOuterXml ()
+ {
+ string xml;
+
+ xml = "<root><![CDATA[foo]]></root>";
+ document.LoadXml (xml);
+ AssertEquals("XmlDocument with cdata OuterXml is incorrect.", xml, document.OuterXml);
+
+ xml = "<root><!--foo--></root>";
+ document.LoadXml (xml);
+ AssertEquals("XmlDocument with comment OuterXml is incorrect.", xml, document.OuterXml);
+
+ xml = "<root><?foo bar?></root>";
+ document.LoadXml (xml);
+ AssertEquals("XmlDocument with processing instruction OuterXml is incorrect.", xml, document.OuterXml);
+ }
+
+ public void TestParentNodes ()
+ {
+ document.LoadXml ("<foo><bar><baz/></bar></foo>");
+ XmlNode node = document.FirstChild.FirstChild.FirstChild;
+ AssertEquals ("Wrong child found.", "baz", node.LocalName);
+ AssertEquals ("Wrong parent.", "bar", node.ParentNode.LocalName);
+ AssertEquals ("Wrong parent.", "foo", node.ParentNode.ParentNode.LocalName);
+ AssertEquals ("Wrong parent.", "#document", node.ParentNode.ParentNode.ParentNode.LocalName);
+ AssertNull ("Expected parent to be null.", node.ParentNode.ParentNode.ParentNode.ParentNode);
+ }
+
+ public void TestRemovedElementNextSibling ()
+ {
+ XmlNode node;
+ XmlNode nextSibling;
+
+ document.LoadXml ("<foo><child1/><child2/></foo>");
+ node = document.DocumentElement.FirstChild;
+ document.DocumentElement.RemoveChild (node);
+ nextSibling = node.NextSibling;
+ AssertNull ("Expected removed node's next sibling to be null.", nextSibling);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlDocumentTypeTests.cs b/mcs/class/System.XML/Test/XmlDocumentTypeTests.cs
new file mode 100755
index 00000000000..4eed88d4511
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlDocumentTypeTests.cs
@@ -0,0 +1,104 @@
+//
+// System.Xml.XmlDocumentTypeTests.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlDocumentTypeTests : TestCase
+ {
+ XmlDocument document;
+ XmlDocumentType docType;
+ public XmlDocumentTypeTests ()
+ : base ("XmlDocumentTypeTests testsuite")
+ {
+ }
+
+ public XmlDocumentTypeTests (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ docType = document.CreateDocumentType ("book", null, null, "<!ELEMENT book ANY>");
+ document.AppendChild (docType);
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+// assertequals (original.nodetype + " was incorrectly cloned.",
+// original.baseuri, cloned.baseuri);
+
+ AssertNull (cloned.ParentNode);
+ AssertEquals ("Value incorrectly cloned",
+ original.Value, cloned.Value);
+
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original, cloned));
+ }
+
+ public void TestName ()
+ {
+ AssertEquals ("Getting Name property", "book", docType.Name);
+ }
+
+ public void TestLocalName ()
+ {
+ AssertEquals ("Getting LocalName property", "book", docType.LocalName);
+ }
+
+ public void TestInternalSubset ()
+ {
+ AssertEquals ("Getting Internal Subset property",
+ "<!ELEMENT book ANY>", docType.InternalSubset);
+ }
+
+ public void TestAppendChild ()
+ {
+ try {
+ XmlDocumentType type1 = document.CreateDocumentType ("book", null, null, null);
+ document.AppendChild (type1);
+
+ } catch (InvalidOperationException) {
+ return;
+
+ } catch (Exception) {
+ Fail ("Incorrect Exception thrown.");
+ }
+ }
+
+ public void TestNodeType ()
+ {
+ AssertEquals ("NodeType property broken",
+ docType.NodeType.ToString (), "DocumentType");
+ }
+
+ public void TestIsReadOnly ()
+ {
+ AssertEquals ("IsReadOnly property", "True", docType.IsReadOnly.ToString ());
+ }
+
+ public void TestCloneNode ()
+ {
+ XmlNode original = docType;
+
+ XmlNode cloned1 = docType.CloneNode (true);
+ TestXmlNodeBaseProperties (original, cloned1);
+
+ XmlNode cloned2 = docType.CloneNode (false);
+ TestXmlNodeBaseProperties (original, cloned2);
+
+ AssertEquals ("Deep and shallow cloning", cloned1.Value, cloned2.Value);
+ }
+
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlElementTests.cs b/mcs/class/System.XML/Test/XmlElementTests.cs
new file mode 100644
index 00000000000..895c903cd17
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlElementTests.cs
@@ -0,0 +1,131 @@
+//
+// XmlElementTests
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlElementTests : TestCase
+ {
+ public XmlElementTests () : base ("Ximian.Mono.Tests.XmlElementTests testsuite") { }
+ public XmlElementTests (string name) : base (name) { }
+
+ private XmlDocument document;
+
+ protected override void SetUp()
+ {
+ document = new XmlDocument ();
+ }
+
+ private void AssertElement (XmlElement element, string prefix,
+ string localName, string namespaceURI,
+ int attributesCount)
+ {
+ AssertEquals (prefix != String.Empty ? prefix + ":" + localName : localName, element.Name);
+ AssertEquals (prefix, element.Prefix);
+ AssertEquals (localName, element.LocalName);
+ AssertEquals (namespaceURI, element.NamespaceURI);
+ //AssertEquals (attributesCount, element.Attributes.Count);
+ }
+
+ public void TestCloneNode ()
+ {
+ XmlElement element = document.CreateElement ("foo");
+ XmlElement child = document.CreateElement ("bar");
+ XmlElement grandson = document.CreateElement ("baz");
+
+ element.SetAttribute ("attr1", "val1");
+ element.SetAttribute ("attr2", "val2");
+ element.AppendChild (child);
+ child.SetAttribute ("attr3", "val3");
+ child.AppendChild (grandson);
+
+ document.AppendChild (element);
+ XmlNode deep = element.CloneNode (true);
+ // AssertEquals ("These should be the same", deep.OuterXml, element.OuterXml);
+ AssertNull ("This is not null", deep.ParentNode);
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (element,deep));
+
+ XmlNode shallow = element.CloneNode (false);
+ AssertNull ("This is not null", shallow.ParentNode);
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (element,shallow));
+ AssertEquals ("Shallow clones shalt have no children!", false, shallow.HasChildNodes);
+ }
+
+ public void TestCreateElement1 ()
+ {
+ XmlElement element = document.CreateElement ("name");
+ AssertElement (element, String.Empty, "name", String.Empty, 0);
+ }
+
+ public void TestCreateElement1WithPrefix ()
+ {
+ XmlElement element = document.CreateElement ("prefix:localName");
+ AssertElement (element, "prefix", "localName", String.Empty, 0);
+ }
+
+ public void TestCreateElement2 ()
+ {
+ XmlElement element = document.CreateElement ("qualifiedName", "namespaceURI");
+ AssertElement (element, String.Empty, "qualifiedName",
+ "namespaceURI", 0);
+ }
+
+ public void TestCreateElement2WithPrefix ()
+ {
+ XmlElement element = document.CreateElement ("prefix:localName", "namespaceURI");
+ AssertElement (element, "prefix", "localName", "namespaceURI", 0);
+ }
+
+ public void TestCreateElement3 ()
+ {
+ XmlElement element = document.CreateElement ("prefix", "localName", "namespaceURI");
+ AssertElement (element, "prefix", "localName", "namespaceURI", 0);
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ XmlElement element;
+ XmlText text;
+ XmlComment comment;
+
+ element = document.CreateElement ("foo");
+ AssertEquals (String.Empty, element.InnerXml);
+ AssertEquals ("<foo />", element.OuterXml);
+
+ text = document.CreateTextNode ("bar");
+ element.AppendChild (text);
+ AssertEquals ("bar", element.InnerXml);
+ AssertEquals ("<foo>bar</foo>", element.OuterXml);
+
+ element.SetAttribute ("baz", "quux");
+ AssertEquals ("bar", element.InnerXml);
+ AssertEquals ("<foo baz=\"quux\">bar</foo>", element.OuterXml);
+
+ comment = document.CreateComment ("squonk");
+ element.AppendChild (comment);
+ AssertEquals ("bar<!--squonk-->", element.InnerXml);
+ AssertEquals ("<foo baz=\"quux\">bar<!--squonk--></foo>", element.OuterXml);
+
+
+ }
+
+ public void TestSetGetAttribute ()
+ {
+ XmlElement element = document.CreateElement ("foo");
+ element.SetAttribute ("attr1", "val1");
+ element.SetAttribute ("attr2", "val2");
+ AssertEquals ("val1", element.GetAttribute ("attr1"));
+ AssertEquals ("val2", element.GetAttribute ("attr2"));
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlNamespaceManagerTests.cs b/mcs/class/System.XML/Test/XmlNamespaceManagerTests.cs
new file mode 100644
index 00000000000..b1b520e2ecc
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlNamespaceManagerTests.cs
@@ -0,0 +1,138 @@
+//
+// XmlNamespaceManagerTests.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlNamespaceManagerTests : TestCase
+ {
+ public XmlNamespaceManagerTests () : base ("Ximian.Mono.Tests.XmlNameSpaceManagerTests testsuite") { }
+ public XmlNamespaceManagerTests (string name) : base (name) { }
+
+ private XmlNameTable nameTable;
+ private XmlNamespaceManager namespaceManager;
+
+ protected override void SetUp ()
+ {
+ nameTable = new NameTable ();
+ namespaceManager = new XmlNamespaceManager (nameTable);
+ }
+
+ public void TestNewNamespaceManager ()
+ {
+ // make sure that you can call PopScope when there aren't any to pop.
+ Assert (!namespaceManager.PopScope ());
+
+ // the following strings should have been added to the name table by the
+ // namespace manager.
+ string xmlnsPrefix = nameTable.Get ("xmlns");
+ string xmlPrefix = nameTable.Get ("xml");
+ string stringEmpty = nameTable.Get (String.Empty);
+ string xmlnsNamespace = "http://www.w3.org/2000/xmlns/";
+ string xmlNamespace = "http://www.w3.org/XML/1998/namespace";
+
+ // none of them should be null.
+ AssertNotNull (xmlnsPrefix);
+ AssertNotNull (xmlPrefix);
+ AssertNotNull (stringEmpty);
+ AssertNotNull (xmlnsNamespace);
+ AssertNotNull (xmlNamespace);
+
+ // Microsoft's XmlNamespaceManager reports that these three
+ // namespaces aren't declared for some reason.
+ Assert (!namespaceManager.HasNamespace ("xmlns"));
+ Assert (!namespaceManager.HasNamespace ("xml"));
+ Assert (!namespaceManager.HasNamespace (String.Empty));
+
+ // these three namespaces are declared by default.
+ AssertEquals ("http://www.w3.org/2000/xmlns/", namespaceManager.LookupNamespace ("xmlns"));
+ AssertEquals ("http://www.w3.org/XML/1998/namespace", namespaceManager.LookupNamespace ("xml"));
+ AssertEquals (String.Empty, namespaceManager.LookupNamespace (String.Empty));
+
+ // the namespaces should be the same references found in the name table.
+ AssertSame (xmlnsNamespace, namespaceManager.LookupNamespace ("xmlns"));
+ AssertSame (xmlNamespace, namespaceManager.LookupNamespace ("xml"));
+ AssertSame (stringEmpty, namespaceManager.LookupNamespace (String.Empty));
+
+ // looking up undeclared namespaces should return null.
+ AssertNull (namespaceManager.LookupNamespace ("foo"));
+ }
+
+ public void TestAddNamespace ()
+ {
+ // add a new namespace.
+ namespaceManager.AddNamespace ("foo", "http://foo/");
+ // make sure the new namespace is there.
+ Assert (namespaceManager.HasNamespace ("foo"));
+ AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+ }
+
+ public void TestAddNamespaceWithNameTable ()
+ {
+ // add a known reference to the name table.
+ string fooNamespace = "http://foo/";
+ nameTable.Add(fooNamespace);
+
+ // create a new string with the same value but different address.
+ string fooNamespace2 = "http://";
+ fooNamespace2 += "foo/";
+
+ // the references must be different in order for this test to prove anything.
+ Assert (!Object.ReferenceEquals (fooNamespace, fooNamespace2));
+
+ // add the namespace with the reference that's not in the name table.
+ namespaceManager.AddNamespace ("foo", fooNamespace2);
+
+ // the returned reference should be the same one that's in the name table.
+ AssertSame (fooNamespace, namespaceManager.LookupNamespace ("foo"));
+ }
+
+ public void TestPushScope ()
+ {
+ // add a new namespace.
+ namespaceManager.AddNamespace ("foo", "http://foo/");
+ // make sure the new namespace is there.
+ Assert (namespaceManager.HasNamespace ("foo"));
+ AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+ // push a new scope.
+ namespaceManager.PushScope ();
+ // add a new namespace.
+ namespaceManager.AddNamespace ("bar", "http://bar/");
+ // make sure the old namespace is not in this new scope.
+ Assert (!namespaceManager.HasNamespace ("foo"));
+ // but we're still supposed to be able to lookup the old namespace.
+ AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+ // make sure the new namespace is there.
+ Assert (namespaceManager.HasNamespace ("bar"));
+ AssertEquals ("http://bar/", namespaceManager.LookupNamespace ("bar"));
+ }
+
+ public void TestPopScope ()
+ {
+ // add some namespaces and a scope.
+ TestPushScope ();
+ // pop the scope.
+ Assert (namespaceManager.PopScope ());
+ // make sure the first namespace is still there.
+ Assert (namespaceManager.HasNamespace ("foo"));
+ AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+ // make sure the second namespace is no longer there.
+ Assert (!namespaceManager.HasNamespace ("bar"));
+ AssertNull (namespaceManager.LookupNamespace ("bar"));
+ // make sure there are no more scopes to pop.
+ Assert (!namespaceManager.PopScope ());
+ // make sure that popping again doesn't cause an exception.
+ Assert (!namespaceManager.PopScope ());
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlNodeListTests.cs b/mcs/class/System.XML/Test/XmlNodeListTests.cs
new file mode 100644
index 00000000000..4ba9db85929
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlNodeListTests.cs
@@ -0,0 +1,206 @@
+using System;
+using System.Xml;
+using System.Collections;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlNodeListTests : TestCase
+ {
+ public XmlNodeListTests () : base ("Ximian.Mono.Tests.XmlNodeListTests testsuite") {}
+ public XmlNodeListTests (string name) : base (name) {}
+
+ XmlDocument document;
+ XmlElement documentElement;
+ XmlElement element;
+ XmlNode node;
+ Object obj;
+ IEnumerator enumerator;
+ int index;
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ }
+
+ public void TestNodeTypesThatCantHaveChildren ()
+ {
+ document.LoadXml ("<foo>bar</foo>");
+ documentElement = document.DocumentElement;
+ node = documentElement.FirstChild;
+ AssertEquals ("Expected a text node.", node.NodeType, XmlNodeType.Text);
+ AssertEquals ("Shouldn't have children.", node.HasChildNodes, false);
+ AssertEquals ("Should be empty node list.", node.ChildNodes.Count, 0);
+ AssertEquals ("Should be empty node list.", node.GetEnumerator().MoveNext(), false);
+ }
+
+ public void TestZeroChildren ()
+ {
+ document.LoadXml ("<foo/>");
+ documentElement = document.DocumentElement;
+ AssertEquals ("Should be empty node list.", documentElement.GetEnumerator().MoveNext(), false);
+ }
+
+ public void TestOneChild ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ documentElement = document.DocumentElement;
+ AssertEquals ("Incorrect number of children returned from Count property.", documentElement.ChildNodes.Count, 1);
+ index = 1;
+ foreach (XmlNode childNode in documentElement.ChildNodes)
+ {
+ AssertEquals ("Enumerator didn't return correct node.", "child" + index.ToString(), childNode.LocalName);
+ index++;
+ }
+ AssertEquals ("foreach didn't loop over all children correctly.", index, 2);
+ }
+
+ public void TestMultipleChildren ()
+ {
+ document.LoadXml ("<foo><child1/><child2/><child3/></foo>");
+ element = document.DocumentElement;
+ AssertEquals ("Incorrect number of children returned from Count property.", element.ChildNodes.Count, 3);
+ AssertNull ("Index less than zero should have returned null.", element.ChildNodes [-1]);
+ AssertNull ("Index greater than or equal to Count should have returned null.", element.ChildNodes [3]);
+ AssertEquals ("Didn't return the correct child.", element.FirstChild, element.ChildNodes[0]);
+ AssertEquals ("Didn't return the correct child.", "child1", element.ChildNodes[0].LocalName);
+ AssertEquals ("Didn't return the correct child.", "child2", element.ChildNodes[1].LocalName);
+ AssertEquals ("Didn't return the correct child.", "child3", element.ChildNodes[2].LocalName);
+
+ index = 1;
+ foreach (XmlNode childNode in element.ChildNodes)
+ {
+ AssertEquals ("Enumerator didn't return correct node.", "child" + index.ToString(), childNode.LocalName);
+ index++;
+ }
+ AssertEquals ("foreach didn't loop over all children correctly.", index, 4);
+ }
+
+ public void TestAppendChildAffectOnEnumeration ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+ AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+ enumerator.Reset();
+ AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+ element.AppendChild(document.CreateElement("child2"));
+ AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+ AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+ }
+
+ public void TestRemoveChildAffectOnEnumeration ()
+ {
+ document.LoadXml ("<foo><child1/><child2/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ element.RemoveChild(element.FirstChild);
+ enumerator.MoveNext();
+ AssertEquals ("Expected child2 element.", ((XmlElement)enumerator.Current).LocalName, "child2");
+ }
+
+ public void TestRemoveChildAffectOnEnumerationWhenEnumeratorIsOnRemovedChild ()
+ {
+ document.LoadXml ("<foo><child1/><child2/><child3/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator ();
+ enumerator.MoveNext ();
+ enumerator.MoveNext ();
+ AssertEquals ("Expected child2 element.", "child2", ((XmlElement)enumerator.Current).LocalName);
+ AssertEquals ("Expected child2 element.", "child2", element.FirstChild.NextSibling.LocalName);
+ element.RemoveChild (element.FirstChild.NextSibling);
+ enumerator.MoveNext ();
+
+ try {
+ element = (XmlElement) enumerator.Current;
+ Fail ("Expected an InvalidOperationException.");
+ } catch (InvalidOperationException) { }
+ }
+
+ // TODO: Take the word save off front of this method when XmlNode.ReplaceChild() is implemented.
+ public void saveTestReplaceChildAffectOnEnumeration ()
+ {
+ document.LoadXml ("<foo><child1/><child2/></foo>");
+ element = document.DocumentElement;
+ node = document.CreateElement("child3");
+ enumerator = element.GetEnumerator();
+ AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+ element.ReplaceChild(node, element.LastChild);
+ enumerator.MoveNext();
+ AssertEquals ("Expected child3 element.", ((XmlElement)enumerator.Current).LocalName, "child3");
+ AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+ }
+
+ public void TestRemoveOnlyChildAffectOnEnumeration ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ element.RemoveChild(element.FirstChild);
+ AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+ }
+
+ // TODO: Take the word save off front of this method when XmlNode.RemoveAll() is fully implemented.
+ public void saveTestRemoveAllAffectOnEnumeration ()
+ {
+ document.LoadXml ("<foo><child1/><child2/><child3/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ AssertEquals ("Expected 3 children.", element.ChildNodes.Count, 3);
+ AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+ element.RemoveAll();
+ AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+ }
+
+ public void TestCurrentBeforeFirstNode ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ try
+ {
+ obj = enumerator.Current;
+ Fail ("Calling Current property before first node in list should have thrown InvalidOperationException.");
+ } catch (InvalidOperationException) { }
+ }
+
+ public void TestCurrentAfterLastNode ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ enumerator.MoveNext();
+ enumerator.MoveNext();
+ try
+ {
+ obj = enumerator.Current;
+ Fail ("Calling Current property after last node in list should have thrown InvalidOperationException.");
+ }
+ catch (InvalidOperationException) { }
+ }
+
+ public void TestCurrentDoesntMove ()
+ {
+ document.LoadXml ("<foo><child1/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ enumerator.MoveNext();
+ AssertEquals("Consecutive calls to Current property should yield same reference.", Object.ReferenceEquals(enumerator.Current, enumerator.Current), true);
+ }
+
+ public void TestReset ()
+ {
+ document.LoadXml ("<foo><child1/><child2/></foo>");
+ element = document.DocumentElement;
+ enumerator = element.GetEnumerator();
+ enumerator.MoveNext();
+ enumerator.MoveNext();
+ AssertEquals("Expected child2.", ((XmlElement)enumerator.Current).LocalName, "child2");
+ enumerator.Reset();
+ enumerator.MoveNext();
+ AssertEquals("Expected child1.", ((XmlElement)enumerator.Current).LocalName, "child1");
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlProcessingInstructionTests.cs b/mcs/class/System.XML/Test/XmlProcessingInstructionTests.cs
new file mode 100644
index 00000000000..532312b7e3e
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlProcessingInstructionTests.cs
@@ -0,0 +1,36 @@
+//
+// System.Xml.XmlTextWriterTests
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Xml;
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlProcessingInstructionTests : TestCase
+ {
+ public XmlProcessingInstructionTests () : base ("Ximian.Mono.Tests.XmlProcessingInstructionTests testsuite") {}
+ public XmlProcessingInstructionTests (string name) : base (name) {}
+
+ XmlDocument document;
+ XmlProcessingInstruction pi;
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ pi = document.CreateProcessingInstruction ("foo", "bar");
+ AssertEquals (String.Empty, pi.InnerXml);
+ AssertEquals ("<?foo bar?>", pi.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlSignificantWhitespaceTests.cs b/mcs/class/System.XML/Test/XmlSignificantWhitespaceTests.cs
new file mode 100755
index 00000000000..165fb69671d
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlSignificantWhitespaceTests.cs
@@ -0,0 +1,117 @@
+//
+// System.Xml.XmlWhitespaceTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlSignificantWhitespaceTests : TestCase
+ {
+ XmlDocument document;
+ XmlDocument doc2;
+ XmlSignificantWhitespace whitespace;
+ XmlSignificantWhitespace broken;
+ XmlNode original;
+ XmlNode deep;
+ XmlNode shallow;
+
+ public XmlSignificantWhitespaceTests () : base ("Ximian.Mono.Tests.XmlWhitespaceTests testsuite") {}
+ public XmlSignificantWhitespaceTests (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<root><foo></foo></root>");
+ XmlElement element = document.CreateElement ("foo");
+ whitespace = document.CreateSignificantWhitespace ("\r\n");
+ element.AppendChild (whitespace);
+
+ doc2 = new XmlDocument ();
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ whitespace = doc2.CreateSignificantWhitespace ("\r\n\t ");
+ AssertEquals (String.Empty, whitespace.InnerXml);
+ AssertEquals ("\r\n\t ", whitespace.OuterXml);
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+// assertequals (original.nodetype + " was incorrectly cloned.",
+// original.baseuri, cloned.baseuri);
+ AssertNull (cloned.ParentNode);
+ AssertEquals ("Value incorrectly cloned",
+ cloned.Value, original.Value);
+
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ public void TestXmlSignificantWhitespaceBadConstructor ()
+ {
+ try {
+ broken = document.CreateSignificantWhitespace ("black");
+
+ } catch (ArgumentException) {
+ return;
+
+ } catch (Exception) {
+ Fail ("Incorrect Exception thrown.");
+ }
+ }
+
+ public void TestXmlSignificantWhitespaceConstructor ()
+ {
+ AssertEquals ("whitespace char didn't get copied right",
+ "\r\n", whitespace.Data);
+ }
+
+
+ public void TestXmlSignificantWhitespaceName ()
+ {
+ AssertEquals (whitespace.NodeType + " Name property broken",
+ whitespace.Name, "#significant-whitespace");
+ }
+
+ public void TestXmlSignificantWhitespaceLocalName ()
+ {
+ AssertEquals (whitespace.NodeType + " LocalName property broken",
+ whitespace.LocalName, "#significant-whitespace");
+ }
+
+ public void TestXmlSignificantWhitespaceNodeType ()
+ {
+ AssertEquals ("XmlSignificantWhitespace NodeType property broken",
+ whitespace.NodeType.ToString (), "SignificantWhitespace");
+ }
+
+ public void TestXmlSignificantWhitespaceIsReadOnly ()
+ {
+ AssertEquals ("XmlSignificantWhitespace IsReadOnly property broken",
+ whitespace.IsReadOnly, false);
+ }
+
+ public void TestXmlSignificantWhitespaceCloneNode ()
+ {
+ original = whitespace;
+
+ shallow = whitespace.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+
+ deep = whitespace.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlTextReaderTests.cs b/mcs/class/System.XML/Test/XmlTextReaderTests.cs
new file mode 100644
index 00000000000..bf1477f4e9c
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlTextReaderTests.cs
@@ -0,0 +1,1766 @@
+//
+// XmlTextReaderTests.cs
+//
+// Author:
+// Jason Diamond (jason@injektilo.org)
+//
+// (C) 2001, 2002 Jason Diamond http://injektilo.org/
+//
+
+using System;
+using System.IO;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlTextReaderTests : TestCase
+ {
+ public XmlTextReaderTests () : base ("Ximian.Mono.Tests.XmlTextReaderTests testsuite") { }
+ public XmlTextReaderTests (string name) : base (name) { }
+
+ private void AssertStartDocument (XmlReader xmlReader)
+ {
+ Assert (xmlReader.ReadState == ReadState.Initial);
+ Assert (xmlReader.NodeType == XmlNodeType.None);
+ Assert (xmlReader.Depth == 0);
+ Assert (!xmlReader.EOF);
+ }
+
+ private void AssertNode (
+ XmlReader xmlReader,
+ XmlNodeType nodeType,
+ int depth,
+ bool isEmptyElement,
+ string name,
+ string prefix,
+ string localName,
+ string namespaceURI,
+ string value,
+ int attributeCount)
+ {
+ Assert (xmlReader.Read ());
+ Assert (xmlReader.ReadState == ReadState.Interactive);
+ Assert (!xmlReader.EOF);
+ }
+
+ private void AssertNodeValues (
+ XmlReader xmlReader,
+ XmlNodeType nodeType,
+ int depth,
+ bool isEmptyElement,
+ string name,
+ string prefix,
+ string localName,
+ string namespaceURI,
+ string value,
+ int attributeCount)
+ {
+ Assert (xmlReader.NodeType == nodeType);
+ Assert (xmlReader.Depth == depth);
+ Assert (xmlReader.IsEmptyElement == isEmptyElement);
+
+ Assert (
+ String.Format (
+ "name was {0}, expected {1}",
+ xmlReader.Name,
+ name),
+ xmlReader.Name == name);
+
+ Assert (
+ String.Format (
+ "prefix was {0}, expected {1}",
+ xmlReader.Prefix,
+ prefix),
+ xmlReader.Prefix == prefix);
+
+ Assert (
+ String.Format (
+ "localName was {0}, expected {1}",
+ xmlReader.LocalName,
+ localName),
+ xmlReader.LocalName == localName);
+
+ Assert (
+ String.Format (
+ "namespaceURI was {0}, expected {1}",
+ xmlReader.NamespaceURI,
+ namespaceURI),
+ xmlReader.NamespaceURI == namespaceURI);
+
+ Assert (
+ String.Format (
+ "hasValue was {0}, expected {1}",
+ xmlReader.HasValue,
+ (value != String.Empty)),
+ xmlReader.HasValue == (value != String.Empty));
+
+ Assert (
+ String.Format (
+ "value was {0}, expected {1}",
+ xmlReader.Value,
+ value),
+ xmlReader.Value == value);
+
+ Assert (
+ String.Format (
+ "hasAttributes was {0}, expected {1}",
+ xmlReader.HasAttributes,
+ (attributeCount > 0)),
+ xmlReader.HasAttributes == (attributeCount > 0));
+
+ Assert (
+ String.Format (
+ "attributeCount was {0}, expected {1}",
+ xmlReader.AttributeCount,
+ attributeCount),
+ xmlReader.AttributeCount == attributeCount);
+ }
+
+ private void AssertAttribute (
+ XmlReader xmlReader,
+ string name,
+ string prefix,
+ string localName,
+ string namespaceURI,
+ string value)
+ {
+ Assert (
+ String.Format (
+ "value was {0}, expected {1}",
+ xmlReader[name],
+ value),
+ xmlReader[name] == value);
+
+ Assert (xmlReader.GetAttribute (name) == value);
+
+ if (namespaceURI != String.Empty) {
+ Assert (xmlReader[localName, namespaceURI] == value);
+ Assert (xmlReader.GetAttribute (localName, namespaceURI) == value);
+ }
+ }
+
+ private void AssertEndDocument (XmlReader xmlReader)
+ {
+ Assert (!xmlReader.Read ());
+ Assert (xmlReader.NodeType == XmlNodeType.None);
+ Assert (xmlReader.Depth == 0);
+ Assert (xmlReader.ReadState == ReadState.EndOfFile);
+ Assert (xmlReader.EOF);
+
+ xmlReader.Close ();
+ Assert (xmlReader.ReadState == ReadState.Closed);
+ }
+
+ public void TestEmptyElement ()
+ {
+ string xml = "<foo/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementWithBadName ()
+ {
+ string xml = "<1foo/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ bool caughtXmlException = false;
+
+ try {
+ xmlReader.Read();
+ } catch (XmlException) {
+ caughtXmlException = true;
+ }
+
+ Assert(caughtXmlException);
+ }
+
+ public void TestEmptyElementWithWhitespace ()
+ {
+ string xml = "<foo />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementWithStartAndEndTag ()
+ {
+ string xml = "<foo></foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementWithStartAndEndTagWithWhitespace ()
+ {
+ string xml = "<foo ></foo >";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestNestedEmptyTag ()
+ {
+ string xml = "<foo><bar/></foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 1, //depth
+ true, // isEmptyElement
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestNestedText ()
+ {
+ string xml = "<foo>bar</foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "bar", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementWithAttribute ()
+ {
+ string xml = @"<foo bar=""baz""/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "baz" // value
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestStartAndEndTagWithAttribute ()
+ {
+ string xml = @"<foo bar='baz'></foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "baz" // value
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementWithTwoAttributes ()
+ {
+ string xml = @"<foo bar=""baz"" quux='quuux'/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 2 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "baz" // value
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "quux", // name
+ String.Empty, // prefix
+ "quux", // localName
+ String.Empty, // namespaceURI
+ "quuux" // value
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestProcessingInstructionBeforeDocumentElement ()
+ {
+ string xml = "<?foo bar?><baz/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.ProcessingInstruction, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ "bar", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "baz", // name
+ String.Empty, // prefix
+ "baz", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestCommentBeforeDocumentElement ()
+ {
+ string xml = "<!--foo--><bar/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Comment, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "foo", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestPredefinedEntities ()
+ {
+ string xml = "<foo>&lt;&gt;&amp;&apos;&quot;</foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "<>&'\"", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEntityReference ()
+ {
+ string xml = "<foo>&bar;</foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EntityReference, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEntityReferenceInsideText ()
+ {
+ string xml = "<foo>bar&baz;quux</foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "bar", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EntityReference, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ "baz", // name
+ String.Empty, // prefix
+ "baz", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "quux", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestCharacterReferences ()
+ {
+ string xml = "<foo>&#70;&#x4F;&#x4f;</foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Text, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "FOO", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEntityReferenceInAttribute ()
+ {
+ string xml = "<foo bar='&baz;'/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "&baz;" // value
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestPredefinedEntitiesInAttribute ()
+ {
+ string xml = "<foo bar='&lt;&gt;&amp;&apos;&quot;'/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "<>&'\"" // value
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestCharacterReferencesInAttribute ()
+ {
+ string xml = "<foo bar='&#70;&#x4F;&#x4f;'/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "FOO" // value
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestCDATA ()
+ {
+ string xml = "<foo><![CDATA[<>&]]></foo>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.CDATA, // nodeType
+ 1, //depth
+ false, // isEmptyElement
+ String.Empty, // name
+ String.Empty, // prefix
+ String.Empty, // localName
+ String.Empty, // namespaceURI
+ "<>&", // value
+ 0 // attributeCount
+ );
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, //depth
+ false, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementInNamespace ()
+ {
+ string xml = @"<foo:bar xmlns:foo='http://foo/' />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ true, // isEmptyElement
+ "foo:bar", // name
+ "foo", // prefix
+ "bar", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns:foo", // name
+ "xmlns", // prefix
+ "foo", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://foo/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestEmptyElementInDefaultNamespace ()
+ {
+ string xml = @"<foo xmlns='http://foo/' />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns", // name
+ String.Empty, // prefix
+ "xmlns", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://foo/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace (String.Empty));
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestChildElementInNamespace ()
+ {
+ string xml = @"<foo:bar xmlns:foo='http://foo/'><baz:quux xmlns:baz='http://baz/' /></foo:bar>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ false, // isEmptyElement
+ "foo:bar", // name
+ "foo", // prefix
+ "bar", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns:foo", // name
+ "xmlns", // prefix
+ "foo", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://foo/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 1, // depth
+ true, // isEmptyElement
+ "baz:quux", // name
+ "baz", // prefix
+ "quux", // localName
+ "http://baz/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns:baz", // name
+ "xmlns", // prefix
+ "baz", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://baz/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+ AssertEquals ("http://baz/", xmlReader.LookupNamespace ("baz"));
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, // depth
+ false, // isEmptyElement
+ "foo:bar", // name
+ "foo", // prefix
+ "bar", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+ AssertNull (xmlReader.LookupNamespace ("baz"));
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestChildElementInDefaultNamespace ()
+ {
+ string xml = @"<foo:bar xmlns:foo='http://foo/'><baz xmlns='http://baz/' /></foo:bar>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ false, // isEmptyElement
+ "foo:bar", // name
+ "foo", // prefix
+ "bar", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns:foo", // name
+ "xmlns", // prefix
+ "foo", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://foo/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 1, // depth
+ true, // isEmptyElement
+ "baz", // name
+ String.Empty, // prefix
+ "baz", // localName
+ "http://baz/", // namespaceURI
+ String.Empty, // value
+ 1 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns", // name
+ String.Empty, // prefix
+ "xmlns", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://baz/" // value
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+ AssertEquals ("http://baz/", xmlReader.LookupNamespace (String.Empty));
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.EndElement, // nodeType
+ 0, // depth
+ false, // isEmptyElement
+ "foo:bar", // name
+ "foo", // prefix
+ "bar", // localName
+ "http://foo/", // namespaceURI
+ String.Empty, // value
+ 0 // attributeCount
+ );
+
+ AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+
+ AssertEndDocument (xmlReader);
+ }
+
+ public void TestAttributeInNamespace ()
+ {
+ string xml = @"<foo bar:baz='quux' xmlns:bar='http://bar/' />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, // depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 2 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar:baz", // name
+ "bar", // prefix
+ "baz", // localName
+ "http://bar/", // namespaceURI
+ "quux" // value
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "xmlns:bar", // name
+ "xmlns", // prefix
+ "bar", // localName
+ "http://www.w3.org/2000/xmlns/", // namespaceURI
+ "http://bar/" // value
+ );
+
+ AssertEquals ("http://bar/", xmlReader.LookupNamespace ("bar"));
+
+ AssertEndDocument (xmlReader);
+ }
+
+// The following is #if'ed out because it's specific to the Mono
+// implementation and won't compile when testing Microsoft's code.
+// Feel free to turn it on if you want to test Mono's name tables.
+
+#if false
+
+ public void TestIsFirstNameChar ()
+ {
+ for (int ch = 0; ch <= 0xFFFF; ++ch) {
+ Assert (
+ XmlChar.IsFirstNameChar (ch) ==
+ IsFirstNameChar (ch));
+ }
+ }
+
+ public void TestIsNameChar ()
+ {
+ for (int ch = 0; ch <= 0xFFFF; ++ch) {
+ Assert (
+ XmlChar.IsNameChar (ch) ==
+ IsNameChar (ch));
+ }
+ }
+
+ private static bool IsFirstNameChar (int ch)
+ {
+ return
+ IsLetter (ch) ||
+ (ch == '_') ||
+ (ch == ':');
+ }
+
+ private static bool IsNameChar (int ch)
+ {
+ return
+ IsLetter (ch) ||
+ IsDigit (ch) ||
+ (ch == '.') ||
+ (ch == '-') ||
+ (ch == '_') ||
+ (ch == ':') ||
+ IsCombiningChar (ch) ||
+ IsExtender (ch);
+ }
+
+ private static bool IsLetter (int ch)
+ {
+ return
+ IsBaseChar (ch) ||
+ IsIdeographic (ch);
+ }
+
+ private static bool IsBaseChar (int ch)
+ {
+ return
+ (ch >= 0x0041 && ch <= 0x005A) ||
+ (ch >= 0x0061 && ch <= 0x007A) ||
+ (ch >= 0x00C0 && ch <= 0x00D6) ||
+ (ch >= 0x00D8 && ch <= 0x00F6) ||
+ (ch >= 0x00F8 && ch <= 0x00FF) ||
+ (ch >= 0x0100 && ch <= 0x0131) ||
+ (ch >= 0x0134 && ch <= 0x013E) ||
+ (ch >= 0x0141 && ch <= 0x0148) ||
+ (ch >= 0x014A && ch <= 0x017E) ||
+ (ch >= 0x0180 && ch <= 0x01C3) ||
+ (ch >= 0x01CD && ch <= 0x01F0) ||
+ (ch >= 0x01F4 && ch <= 0x01F5) ||
+ (ch >= 0x01FA && ch <= 0x0217) ||
+ (ch >= 0x0250 && ch <= 0x02A8) ||
+ (ch >= 0x02BB && ch <= 0x02C1) ||
+ (ch == 0x0386) ||
+ (ch >= 0x0388 && ch <= 0x038A) ||
+ (ch == 0x038C) ||
+ (ch >= 0x038E && ch <= 0x03A1) ||
+ (ch >= 0x03A3 && ch <= 0x03CE) ||
+ (ch >= 0x03D0 && ch <= 0x03D6) ||
+ (ch == 0x03DA) ||
+ (ch == 0x03DC) ||
+ (ch == 0x03DE) ||
+ (ch == 0x03E0) ||
+ (ch >= 0x03E2 && ch <= 0x03F3) ||
+ (ch >= 0x0401 && ch <= 0x040C) ||
+ (ch >= 0x040E && ch <= 0x044F) ||
+ (ch >= 0x0451 && ch <= 0x045C) ||
+ (ch >= 0x045E && ch <= 0x0481) ||
+ (ch >= 0x0490 && ch <= 0x04C4) ||
+ (ch >= 0x04C7 && ch <= 0x04C8) ||
+ (ch >= 0x04CB && ch <= 0x04CC) ||
+ (ch >= 0x04D0 && ch <= 0x04EB) ||
+ (ch >= 0x04EE && ch <= 0x04F5) ||
+ (ch >= 0x04F8 && ch <= 0x04F9) ||
+ (ch >= 0x0531 && ch <= 0x0556) ||
+ (ch == 0x0559) ||
+ (ch >= 0x0561 && ch <= 0x0586) ||
+ (ch >= 0x05D0 && ch <= 0x05EA) ||
+ (ch >= 0x05F0 && ch <= 0x05F2) ||
+ (ch >= 0x0621 && ch <= 0x063A) ||
+ (ch >= 0x0641 && ch <= 0x064A) ||
+ (ch >= 0x0671 && ch <= 0x06B7) ||
+ (ch >= 0x06BA && ch <= 0x06BE) ||
+ (ch >= 0x06C0 && ch <= 0x06CE) ||
+ (ch >= 0x06D0 && ch <= 0x06D3) ||
+ (ch == 0x06D5) ||
+ (ch >= 0x06E5 && ch <= 0x06E6) ||
+ (ch >= 0x0905 && ch <= 0x0939) ||
+ (ch == 0x093D) ||
+ (ch >= 0x0958 && ch <= 0x0961) ||
+ (ch >= 0x0985 && ch <= 0x098C) ||
+ (ch >= 0x098F && ch <= 0x0990) ||
+ (ch >= 0x0993 && ch <= 0x09A8) ||
+ (ch >= 0x09AA && ch <= 0x09B0) ||
+ (ch == 0x09B2) ||
+ (ch >= 0x09B6 && ch <= 0x09B9) ||
+ (ch >= 0x09DC && ch <= 0x09DD) ||
+ (ch >= 0x09DF && ch <= 0x09E1) ||
+ (ch >= 0x09F0 && ch <= 0x09F1) ||
+ (ch >= 0x0A05 && ch <= 0x0A0A) ||
+ (ch >= 0x0A0F && ch <= 0x0A10) ||
+ (ch >= 0x0A13 && ch <= 0x0A28) ||
+ (ch >= 0x0A2A && ch <= 0x0A30) ||
+ (ch >= 0x0A32 && ch <= 0x0A33) ||
+ (ch >= 0x0A35 && ch <= 0x0A36) ||
+ (ch >= 0x0A38 && ch <= 0x0A39) ||
+ (ch >= 0x0A59 && ch <= 0x0A5C) ||
+ (ch == 0x0A5E) ||
+ (ch >= 0x0A72 && ch <= 0x0A74) ||
+ (ch >= 0x0A85 && ch <= 0x0A8B) ||
+ (ch == 0x0A8D) ||
+ (ch >= 0x0A8F && ch <= 0x0A91) ||
+ (ch >= 0x0A93 && ch <= 0x0AA8) ||
+ (ch >= 0x0AAA && ch <= 0x0AB0) ||
+ (ch >= 0x0AB2 && ch <= 0x0AB3) ||
+ (ch >= 0x0AB5 && ch <= 0x0AB9) ||
+ (ch == 0x0ABD) ||
+ (ch == 0x0AE0) ||
+ (ch >= 0x0B05 && ch <= 0x0B0C) ||
+ (ch >= 0x0B0F && ch <= 0x0B10) ||
+ (ch >= 0x0B13 && ch <= 0x0B28) ||
+ (ch >= 0x0B2A && ch <= 0x0B30) ||
+ (ch >= 0x0B32 && ch <= 0x0B33) ||
+ (ch >= 0x0B36 && ch <= 0x0B39) ||
+ (ch == 0x0B3D) ||
+ (ch >= 0x0B5C && ch <= 0x0B5D) ||
+ (ch >= 0x0B5F && ch <= 0x0B61) ||
+ (ch >= 0x0B85 && ch <= 0x0B8A) ||
+ (ch >= 0x0B8E && ch <= 0x0B90) ||
+ (ch >= 0x0B92 && ch <= 0x0B95) ||
+ (ch >= 0x0B99 && ch <= 0x0B9A) ||
+ (ch == 0x0B9C) ||
+ (ch >= 0x0B9E && ch <= 0x0B9F) ||
+ (ch >= 0x0BA3 && ch <= 0x0BA4) ||
+ (ch >= 0x0BA8 && ch <= 0x0BAA) ||
+ (ch >= 0x0BAE && ch <= 0x0BB5) ||
+ (ch >= 0x0BB7 && ch <= 0x0BB9) ||
+ (ch >= 0x0C05 && ch <= 0x0C0C) ||
+ (ch >= 0x0C0E && ch <= 0x0C10) ||
+ (ch >= 0x0C12 && ch <= 0x0C28) ||
+ (ch >= 0x0C2A && ch <= 0x0C33) ||
+ (ch >= 0x0C35 && ch <= 0x0C39) ||
+ (ch >= 0x0C60 && ch <= 0x0C61) ||
+ (ch >= 0x0C85 && ch <= 0x0C8C) ||
+ (ch >= 0x0C8E && ch <= 0x0C90) ||
+ (ch >= 0x0C92 && ch <= 0x0CA8) ||
+ (ch >= 0x0CAA && ch <= 0x0CB3) ||
+ (ch >= 0x0CB5 && ch <= 0x0CB9) ||
+ (ch == 0x0CDE) ||
+ (ch >= 0x0CE0 && ch <= 0x0CE1) ||
+ (ch >= 0x0D05 && ch <= 0x0D0C) ||
+ (ch >= 0x0D0E && ch <= 0x0D10) ||
+ (ch >= 0x0D12 && ch <= 0x0D28) ||
+ (ch >= 0x0D2A && ch <= 0x0D39) ||
+ (ch >= 0x0D60 && ch <= 0x0D61) ||
+ (ch >= 0x0E01 && ch <= 0x0E2E) ||
+ (ch == 0x0E30) ||
+ (ch >= 0x0E32 && ch <= 0x0E33) ||
+ (ch >= 0x0E40 && ch <= 0x0E45) ||
+ (ch >= 0x0E81 && ch <= 0x0E82) ||
+ (ch == 0x0E84) ||
+ (ch >= 0x0E87 && ch <= 0x0E88) ||
+ (ch == 0x0E8A) ||
+ (ch == 0x0E8D) ||
+ (ch >= 0x0E94 && ch <= 0x0E97) ||
+ (ch >= 0x0E99 && ch <= 0x0E9F) ||
+ (ch >= 0x0EA1 && ch <= 0x0EA3) ||
+ (ch == 0x0EA5) ||
+ (ch == 0x0EA7) ||
+ (ch >= 0x0EAA && ch <= 0x0EAB) ||
+ (ch >= 0x0EAD && ch <= 0x0EAE) ||
+ (ch == 0x0EB0) ||
+ (ch >= 0x0EB2 && ch <= 0x0EB3) ||
+ (ch == 0x0EBD) ||
+ (ch >= 0x0EC0 && ch <= 0x0EC4) ||
+ (ch >= 0x0F40 && ch <= 0x0F47) ||
+ (ch >= 0x0F49 && ch <= 0x0F69) ||
+ (ch >= 0x10A0 && ch <= 0x10C5) ||
+ (ch >= 0x10D0 && ch <= 0x10F6) ||
+ (ch == 0x1100) ||
+ (ch >= 0x1102 && ch <= 0x1103) ||
+ (ch >= 0x1105 && ch <= 0x1107) ||
+ (ch == 0x1109) ||
+ (ch >= 0x110B && ch <= 0x110C) ||
+ (ch >= 0x110E && ch <= 0x1112) ||
+ (ch == 0x113C) ||
+ (ch == 0x113E) ||
+ (ch == 0x1140) ||
+ (ch == 0x114C) ||
+ (ch == 0x114E) ||
+ (ch == 0x1150) ||
+ (ch >= 0x1154 && ch <= 0x1155) ||
+ (ch == 0x1159) ||
+ (ch >= 0x115F && ch <= 0x1161) ||
+ (ch == 0x1163) ||
+ (ch == 0x1165) ||
+ (ch == 0x1167) ||
+ (ch == 0x1169) ||
+ (ch >= 0x116D && ch <= 0x116E) ||
+ (ch >= 0x1172 && ch <= 0x1173) ||
+ (ch == 0x1175) ||
+ (ch == 0x119E) ||
+ (ch == 0x11A8) ||
+ (ch == 0x11AB) ||
+ (ch >= 0x11AE && ch <= 0x11AF) ||
+ (ch >= 0x11B7 && ch <= 0x11B8) ||
+ (ch == 0x11BA) ||
+ (ch >= 0x11BC && ch <= 0x11C2) ||
+ (ch == 0x11EB) ||
+ (ch == 0x11F0) ||
+ (ch == 0x11F9) ||
+ (ch >= 0x1E00 && ch <= 0x1E9B) ||
+ (ch >= 0x1EA0 && ch <= 0x1EF9) ||
+ (ch >= 0x1F00 && ch <= 0x1F15) ||
+ (ch >= 0x1F18 && ch <= 0x1F1D) ||
+ (ch >= 0x1F20 && ch <= 0x1F45) ||
+ (ch >= 0x1F48 && ch <= 0x1F4D) ||
+ (ch >= 0x1F50 && ch <= 0x1F57) ||
+ (ch == 0x1F59) ||
+ (ch == 0x1F5B) ||
+ (ch == 0x1F5D) ||
+ (ch >= 0x1F5F && ch <= 0x1F7D) ||
+ (ch >= 0x1F80 && ch <= 0x1FB4) ||
+ (ch >= 0x1FB6 && ch <= 0x1FBC) ||
+ (ch == 0x1FBE) ||
+ (ch >= 0x1FC2 && ch <= 0x1FC4) ||
+ (ch >= 0x1FC6 && ch <= 0x1FCC) ||
+ (ch >= 0x1FD0 && ch <= 0x1FD3) ||
+ (ch >= 0x1FD6 && ch <= 0x1FDB) ||
+ (ch >= 0x1FE0 && ch <= 0x1FEC) ||
+ (ch >= 0x1FF2 && ch <= 0x1FF4) ||
+ (ch >= 0x1FF6 && ch <= 0x1FFC) ||
+ (ch == 0x2126) ||
+ (ch >= 0x212A && ch <= 0x212B) ||
+ (ch == 0x212E) ||
+ (ch >= 0x2180 && ch <= 0x2182) ||
+ (ch >= 0x3041 && ch <= 0x3094) ||
+ (ch >= 0x30A1 && ch <= 0x30FA) ||
+ (ch >= 0x3105 && ch <= 0x312C) ||
+ (ch >= 0xAC00 && ch <= 0xD7A3);
+ }
+
+ private static bool IsIdeographic (int ch)
+ {
+ return
+ (ch >= 0x4E00 && ch <= 0x9FA5) ||
+ (ch == 0x3007) ||
+ (ch >= 0x3021 && ch <= 0x3029);
+ }
+
+ private static bool IsDigit (int ch)
+ {
+ return
+ (ch >= 0x0030 && ch <= 0x0039) ||
+ (ch >= 0x0660 && ch <= 0x0669) ||
+ (ch >= 0x06F0 && ch <= 0x06F9) ||
+ (ch >= 0x0966 && ch <= 0x096F) ||
+ (ch >= 0x09E6 && ch <= 0x09EF) ||
+ (ch >= 0x0A66 && ch <= 0x0A6F) ||
+ (ch >= 0x0AE6 && ch <= 0x0AEF) ||
+ (ch >= 0x0B66 && ch <= 0x0B6F) ||
+ (ch >= 0x0BE7 && ch <= 0x0BEF) ||
+ (ch >= 0x0C66 && ch <= 0x0C6F) ||
+ (ch >= 0x0CE6 && ch <= 0x0CEF) ||
+ (ch >= 0x0D66 && ch <= 0x0D6F) ||
+ (ch >= 0x0E50 && ch <= 0x0E59) ||
+ (ch >= 0x0ED0 && ch <= 0x0ED9) ||
+ (ch >= 0x0F20 && ch <= 0x0F29);
+ }
+
+ private static bool IsCombiningChar (int ch)
+ {
+ return
+ (ch >= 0x0300 && ch <= 0x0345) ||
+ (ch >= 0x0360 && ch <= 0x0361) ||
+ (ch >= 0x0483 && ch <= 0x0486) ||
+ (ch >= 0x0591 && ch <= 0x05A1) ||
+ (ch >= 0x05A3 && ch <= 0x05B9) ||
+ (ch >= 0x05BB && ch <= 0x05BD) ||
+ (ch == 0x05BF) ||
+ (ch >= 0x05C1 && ch <= 0x05C2) ||
+ (ch == 0x05C4) ||
+ (ch >= 0x064B && ch <= 0x0652) ||
+ (ch == 0x0670) ||
+ (ch >= 0x06D6 && ch <= 0x06DC) ||
+ (ch >= 0x06DD && ch <= 0x06DF) ||
+ (ch >= 0x06E0 && ch <= 0x06E4) ||
+ (ch >= 0x06E7 && ch <= 0x06E8) ||
+ (ch >= 0x06EA && ch <= 0x06ED) ||
+ (ch >= 0x0901 && ch <= 0x0903) ||
+ (ch == 0x093C) ||
+ (ch >= 0x093E && ch <= 0x094C) ||
+ (ch == 0x094D) ||
+ (ch >= 0x0951 && ch <= 0x0954) ||
+ (ch >= 0x0962 && ch <= 0x0963) ||
+ (ch >= 0x0981 && ch <= 0x0983) ||
+ (ch == 0x09BC) ||
+ (ch == 0x09BE) ||
+ (ch == 0x09BF) ||
+ (ch >= 0x09C0 && ch <= 0x09C4) ||
+ (ch >= 0x09C7 && ch <= 0x09C8) ||
+ (ch >= 0x09CB && ch <= 0x09CD) ||
+ (ch == 0x09D7) ||
+ (ch >= 0x09E2 && ch <= 0x09E3) ||
+ (ch == 0x0A02) ||
+ (ch == 0x0A3C) ||
+ (ch == 0x0A3E) ||
+ (ch == 0x0A3F) ||
+ (ch >= 0x0A40 && ch <= 0x0A42) ||
+ (ch >= 0x0A47 && ch <= 0x0A48) ||
+ (ch >= 0x0A4B && ch <= 0x0A4D) ||
+ (ch >= 0x0A70 && ch <= 0x0A71) ||
+ (ch >= 0x0A81 && ch <= 0x0A83) ||
+ (ch == 0x0ABC) ||
+ (ch >= 0x0ABE && ch <= 0x0AC5) ||
+ (ch >= 0x0AC7 && ch <= 0x0AC9) ||
+ (ch >= 0x0ACB && ch <= 0x0ACD) ||
+ (ch >= 0x0B01 && ch <= 0x0B03) ||
+ (ch == 0x0B3C) ||
+ (ch >= 0x0B3E && ch <= 0x0B43) ||
+ (ch >= 0x0B47 && ch <= 0x0B48) ||
+ (ch >= 0x0B4B && ch <= 0x0B4D) ||
+ (ch >= 0x0B56 && ch <= 0x0B57) ||
+ (ch >= 0x0B82 && ch <= 0x0B83) ||
+ (ch >= 0x0BBE && ch <= 0x0BC2) ||
+ (ch >= 0x0BC6 && ch <= 0x0BC8) ||
+ (ch >= 0x0BCA && ch <= 0x0BCD) ||
+ (ch == 0x0BD7) ||
+ (ch >= 0x0C01 && ch <= 0x0C03) ||
+ (ch >= 0x0C3E && ch <= 0x0C44) ||
+ (ch >= 0x0C46 && ch <= 0x0C48) ||
+ (ch >= 0x0C4A && ch <= 0x0C4D) ||
+ (ch >= 0x0C55 && ch <= 0x0C56) ||
+ (ch >= 0x0C82 && ch <= 0x0C83) ||
+ (ch >= 0x0CBE && ch <= 0x0CC4) ||
+ (ch >= 0x0CC6 && ch <= 0x0CC8) ||
+ (ch >= 0x0CCA && ch <= 0x0CCD) ||
+ (ch >= 0x0CD5 && ch <= 0x0CD6) ||
+ (ch >= 0x0D02 && ch <= 0x0D03) ||
+ (ch >= 0x0D3E && ch <= 0x0D43) ||
+ (ch >= 0x0D46 && ch <= 0x0D48) ||
+ (ch >= 0x0D4A && ch <= 0x0D4D) ||
+ (ch == 0x0D57) ||
+ (ch == 0x0E31) ||
+ (ch >= 0x0E34 && ch <= 0x0E3A) ||
+ (ch >= 0x0E47 && ch <= 0x0E4E) ||
+ (ch == 0x0EB1) ||
+ (ch >= 0x0EB4 && ch <= 0x0EB9) ||
+ (ch >= 0x0EBB && ch <= 0x0EBC) ||
+ (ch >= 0x0EC8 && ch <= 0x0ECD) ||
+ (ch >= 0x0F18 && ch <= 0x0F19) ||
+ (ch == 0x0F35) ||
+ (ch == 0x0F37) ||
+ (ch == 0x0F39) ||
+ (ch == 0x0F3E) ||
+ (ch == 0x0F3F) ||
+ (ch >= 0x0F71 && ch <= 0x0F84) ||
+ (ch >= 0x0F86 && ch <= 0x0F8B) ||
+ (ch >= 0x0F90 && ch <= 0x0F95) ||
+ (ch == 0x0F97) ||
+ (ch >= 0x0F99 && ch <= 0x0FAD) ||
+ (ch >= 0x0FB1 && ch <= 0x0FB7) ||
+ (ch == 0x0FB9) ||
+ (ch >= 0x20D0 && ch <= 0x20DC) ||
+ (ch == 0x20E1) ||
+ (ch >= 0x302A && ch <= 0x302F) ||
+ (ch == 0x3099) ||
+ (ch == 0x309A);
+ }
+
+ private static bool IsExtender (int ch)
+ {
+ return
+ (ch == 0x00B7) ||
+ (ch == 0x02D0) ||
+ (ch == 0x02D1) ||
+ (ch == 0x0387) ||
+ (ch == 0x0640) ||
+ (ch == 0x0E46) ||
+ (ch == 0x0EC6) ||
+ (ch == 0x3005) ||
+ (ch >= 0x3031 && ch <= 0x3035) ||
+ (ch >= 0x309D && ch <= 0x309E) ||
+ (ch >= 0x30FC && ch <= 0x30FE);
+ }
+
+#endif
+
+ public void TestIsName ()
+ {
+ Assert (XmlReader.IsName ("foo"));
+ Assert (!XmlReader.IsName ("1foo"));
+ Assert (!XmlReader.IsName (" foo"));
+ }
+
+ public void TestIsNameToken ()
+ {
+ Assert (XmlReader.IsNameToken ("foo"));
+ Assert (XmlReader.IsNameToken ("1foo"));
+ Assert (!XmlReader.IsNameToken (" foo"));
+ }
+
+ public void TestMoveToElementFromAttribute ()
+ {
+ string xml = @"<foo bar=""baz"" />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ Assert (xmlReader.Read ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ Assert (xmlReader.MoveToFirstAttribute ());
+ AssertEquals (XmlNodeType.Attribute, xmlReader.NodeType);
+ Assert (xmlReader.MoveToElement ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ }
+
+ public void TestMoveToElementFromElement ()
+ {
+ string xml = @"<foo bar=""baz"" />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ Assert (xmlReader.Read ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ Assert (!xmlReader.MoveToElement ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ }
+
+ public void TestMoveToFirstAttributeWithNoAttributes ()
+ {
+ string xml = @"<foo />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ Assert (xmlReader.Read ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ Assert (!xmlReader.MoveToFirstAttribute ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ }
+
+ public void TestMoveToNextAttributeWithNoAttributes ()
+ {
+ string xml = @"<foo />";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ Assert (xmlReader.Read ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ Assert (!xmlReader.MoveToNextAttribute ());
+ AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+ }
+
+ public void TestMoveToNextAttribute()
+ {
+ string xml = @"<foo bar=""baz"" quux='quuux'/>";
+ XmlReader xmlReader =
+ new XmlTextReader (new StringReader (xml));
+
+ AssertStartDocument (xmlReader);
+
+ AssertNode (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 2 // attributeCount
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "bar", // name
+ String.Empty, // prefix
+ "bar", // localName
+ String.Empty, // namespaceURI
+ "baz" // value
+ );
+
+ AssertAttribute (
+ xmlReader, // xmlReader
+ "quux", // name
+ String.Empty, // prefix
+ "quux", // localName
+ String.Empty, // namespaceURI
+ "quuux" // value
+ );
+
+ Assert (xmlReader.MoveToNextAttribute ());
+ Assert ("bar" == xmlReader.Name || "quux" == xmlReader.Name);
+ Assert ("baz" == xmlReader.Value || "quuux" == xmlReader.Value);
+
+ Assert (xmlReader.MoveToNextAttribute ());
+ Assert ("bar" == xmlReader.Name || "quux" == xmlReader.Name);
+ Assert ("baz" == xmlReader.Value || "quuux" == xmlReader.Value);
+
+ Assert (!xmlReader.MoveToNextAttribute ());
+
+ Assert (xmlReader.MoveToElement ());
+
+ AssertNodeValues (
+ xmlReader, // xmlReader
+ XmlNodeType.Element, // nodeType
+ 0, //depth
+ true, // isEmptyElement
+ "foo", // name
+ String.Empty, // prefix
+ "foo", // localName
+ String.Empty, // namespaceURI
+ String.Empty, // value
+ 2 // attributeCount
+ );
+
+ AssertEndDocument (xmlReader);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlTextTests.cs b/mcs/class/System.XML/Test/XmlTextTests.cs
new file mode 100644
index 00000000000..a13ea0d8a8f
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlTextTests.cs
@@ -0,0 +1,36 @@
+//
+// System.Xml.XmlTextWriterTests
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.Xml;
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlTextTests : TestCase
+ {
+ public XmlTextTests () : base ("Ximian.Mono.Tests.XmlTextTests testsuite") {}
+ public XmlTextTests (string name) : base (name) {}
+
+ XmlDocument document;
+ XmlText text;
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ text = document.CreateTextNode ("&<>\"'");
+ AssertEquals (String.Empty, text.InnerXml);
+ AssertEquals ("&amp;&lt;&gt;\"'", text.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlTextWriterTests.cs b/mcs/class/System.XML/Test/XmlTextWriterTests.cs
new file mode 100644
index 00000000000..16d49a6ad55
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlTextWriterTests.cs
@@ -0,0 +1,903 @@
+//
+// System.Xml.XmlTextWriterTests
+//
+// Author:
+// Kral Ferch <kral_ferch@hotmail.com>
+//
+// (C) 2002 Kral Ferch
+//
+
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlTextWriterTests : TestCase
+ {
+ public XmlTextWriterTests () : base ("Ximian.Mono.Tests.XmlTextWriterTests testsuite") {}
+ public XmlTextWriterTests (string name) : base (name) {}
+
+ StringWriter sw;
+ XmlTextWriter xtw;
+
+ protected override void SetUp ()
+ {
+ sw = new StringWriter ();
+ xtw = new XmlTextWriter (sw);
+ xtw.QuoteChar = '\'';
+ }
+
+ private string StringWriterText
+ {
+ get { return sw.GetStringBuilder ().ToString (); }
+ }
+
+ public void TestAttributeNamespacesNonNamespaceAttributeBefore ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteAttributeString("bar", "baz");
+ xtw.WriteAttributeString ("xmlns", "abc", null, "http://abc.def");
+ AssertEquals ("<foo bar='baz' xmlns:abc='http://abc.def'", StringWriterText);
+ }
+
+ public void TestAttributeNamespacesNonNamespaceAttributeAfter ()
+ {
+ xtw.WriteStartElement ("foo");
+
+ xtw.WriteAttributeString ("xmlns", "abc", null, "http://abc.def");
+ xtw.WriteAttributeString("bar", "baz");
+ AssertEquals ("<foo xmlns:abc='http://abc.def' bar='baz'", StringWriterText);
+ }
+
+ public void TestAttributeNamespacesThreeParamWithNullInNamespaceParam ()
+ {
+ xtw.WriteAttributeString ("xmlns", null, "http://abc.def");
+ AssertEquals ("xmlns='http://abc.def'", StringWriterText);
+ }
+
+ public void TestAttributeNamespacesThreeParamWithTextInNamespaceParam ()
+ {
+ try
+ {
+ xtw.WriteAttributeString ("xmlns", "http://somenamespace.com", "http://abc.def");
+ }
+ catch (ArgumentException) {}
+ }
+
+ public void TestAttributeNamespacesWithNullInNamespaceParam ()
+ {
+ xtw.WriteAttributeString ("xmlns", "abc", null, "http://abc.def");
+ AssertEquals ("xmlns:abc='http://abc.def'", StringWriterText);
+ }
+
+ public void TestAttributeNamespacesWithTextInNamespaceParam ()
+ {
+ try {
+ xtw.WriteAttributeString ("xmlns", "abc", "http://somenamespace.com", "http://abc.def");
+ } catch (ArgumentException) {}
+ }
+
+ public void TestAttributeNamespacesXmlnsXmlns ()
+ {
+ xtw.WriteStartElement ("foo");
+ try
+ {
+ xtw.WriteAttributeString ("xmlns", "xmlns", null, "http://abc.def");
+ Fail ("Expected an ArgumentException to be thrown.");
+ }
+ catch (ArgumentException) {}
+ }
+
+ public void TestAttributeWriteAttributeString ()
+ {
+ xtw.WriteStartElement ("foo");
+
+ xtw.WriteAttributeString ("foo", "bar");
+ AssertEquals ("<foo foo='bar'", StringWriterText);
+
+ xtw.WriteAttributeString ("bar", "");
+ AssertEquals ("<foo foo='bar' bar=''", StringWriterText);
+
+ xtw.WriteAttributeString ("baz", null);
+ AssertEquals ("<foo foo='bar' bar='' baz=''", StringWriterText);
+
+ // TODO: Why does this pass Microsoft?
+ xtw.WriteAttributeString ("", "quux");
+ AssertEquals ("<foo foo='bar' bar='' baz='' ='quux'", StringWriterText);
+
+ // TODO: Why does this pass Microsoft?
+ xtw.WriteAttributeString (null, "quuux");
+ AssertEquals ("<foo foo='bar' bar='' baz='' ='quux' ='quuux'", StringWriterText);
+ }
+
+ public void TestAttributeWriteAttributeStringNotInsideOpenStartElement ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteString ("bar");
+
+ try
+ {
+ xtw.WriteAttributeString ("baz", "quux");
+ Fail ("Expected an InvalidOperationException to be thrown.");
+ }
+ catch (InvalidOperationException) {}
+ }
+
+ public void TestAttributeWriteAttributeStringWithoutParentElement ()
+ {
+ xtw.WriteAttributeString ("foo", "bar");
+ AssertEquals ("foo='bar'", StringWriterText);
+
+ xtw.WriteAttributeString ("baz", "quux");
+ AssertEquals ("foo='bar' baz='quux'", StringWriterText);
+ }
+
+ public void TestCDataValid ()
+ {
+ xtw.WriteCData ("foo");
+ AssertEquals ("WriteCData had incorrect output.", "<![CDATA[foo]]>", StringWriterText);
+ }
+
+ public void TestCDataInvalid ()
+ {
+ try {
+ xtw.WriteCData("foo]]>bar");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+ }
+
+ public void TestCloseOpenElements ()
+ {
+ xtw.WriteStartElement("foo");
+ xtw.WriteStartElement("bar");
+ xtw.WriteStartElement("baz");
+ xtw.Close();
+ AssertEquals ("Close didn't write out end elements properly.", "<foo><bar><baz /></bar></foo>", StringWriterText);
+ }
+
+ public void TestCloseWriteAfter ()
+ {
+ xtw.WriteElementString ("foo", "bar");
+ xtw.Close ();
+
+ // WriteEndElement and WriteStartDocument aren't tested here because
+ // they will always throw different exceptions besides 'The Writer is closed.'
+ // and there are already tests for those exceptions.
+
+ try {
+ xtw.WriteCData ("foo");
+ Fail ("WriteCData after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+
+ try {
+ xtw.WriteComment ("foo");
+ Fail ("WriteComment after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+
+ try {
+ xtw.WriteProcessingInstruction ("foo", "bar");
+ Fail ("WriteProcessingInstruction after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+
+ try {
+ xtw.WriteStartElement ("foo", "bar", "baz");
+ Fail ("WriteStartElement after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+
+ try
+ {
+ xtw.WriteAttributeString ("foo", "bar");
+ Fail ("WriteAttributeString after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e)
+ {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+
+ try {
+ xtw.WriteString ("foo");
+ Fail ("WriteString after Close Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+ }
+ }
+
+ public void TestCommentValid ()
+ {
+ xtw.WriteComment ("foo");
+ AssertEquals ("WriteComment had incorrect output.", "<!--foo-->", StringWriterText);
+ }
+
+ public void TestCommentInvalid ()
+ {
+ try {
+ xtw.WriteComment("foo-");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+
+ try {
+ xtw.WriteComment("foo-->bar");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+ }
+
+ public void TestConstructorsAndBaseStream ()
+ {
+ Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (null, this.xtw.BaseStream));
+
+ MemoryStream ms;
+ StreamReader sr;
+ XmlTextWriter xtw;
+
+ ms = new MemoryStream ();
+ xtw = new XmlTextWriter (ms, new UnicodeEncoding ());
+ xtw.WriteStartDocument ();
+ xtw.Flush ();
+ ms.Seek (0, SeekOrigin.Begin);
+ sr = new StreamReader (ms);
+ AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-16\"?>", sr.ReadToEnd ());
+ Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (ms, xtw.BaseStream));
+
+ ms = new MemoryStream ();
+ xtw = new XmlTextWriter (ms, new UnicodeEncoding ());
+ xtw.WriteStartDocument (true);
+ xtw.Flush ();
+ ms.Seek (0, SeekOrigin.Begin);
+ sr = new StreamReader (ms);
+ AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?>", sr.ReadToEnd ());
+
+ ms = new MemoryStream ();
+ xtw = new XmlTextWriter (ms, new UTF8Encoding ());
+ xtw.WriteStartDocument ();
+ xtw.Flush ();
+ ms.Seek (0, SeekOrigin.Begin);
+ sr = new StreamReader (ms);
+ AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-8\"?>", sr.ReadToEnd ());
+
+ ms = new MemoryStream ();
+ xtw = new XmlTextWriter (ms, null);
+ xtw.WriteStartDocument ();
+ xtw.Flush ();
+ ms.Seek (0, SeekOrigin.Begin);
+ sr = new StreamReader (ms);
+ AssertEquals ("<?xml version=\"1.0\"?>", sr.ReadToEnd ());
+
+ ms = new MemoryStream ();
+ xtw = new XmlTextWriter (ms, null);
+ xtw.WriteStartDocument (true);
+ xtw.Flush ();
+ ms.Seek (0, SeekOrigin.Begin);
+ sr = new StreamReader (ms);
+ AssertEquals ("<?xml version=\"1.0\" standalone=\"yes\"?>", sr.ReadToEnd ());
+ Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (ms, xtw.BaseStream));
+ }
+
+ public void TestDocumentStart ()
+ {
+ xtw.WriteStartDocument ();
+ AssertEquals ("XmlDeclaration is incorrect.", "<?xml version='1.0' encoding='utf-16'?>", StringWriterText);
+
+ try
+ {
+ xtw.WriteStartDocument ();
+ Fail("Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.",
+ "WriteStartDocument should be the first call.", e.Message);
+ }
+
+ xtw = new XmlTextWriter (sw = new StringWriter ());
+ xtw.QuoteChar = '\'';
+ xtw.WriteStartDocument (true);
+ AssertEquals ("<?xml version='1.0' encoding='utf-16' standalone='yes'?>", StringWriterText);
+
+ xtw = new XmlTextWriter (sw = new StringWriter ());
+ xtw.QuoteChar = '\'';
+ xtw.WriteStartDocument (false);
+ AssertEquals ("<?xml version='1.0' encoding='utf-16' standalone='no'?>", StringWriterText);
+ }
+
+ public void TestElementEmpty ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteEndElement ();
+ AssertEquals ("Incorrect output.", "<foo />", StringWriterText);
+ }
+
+ public void TestElementWriteElementString ()
+ {
+ xtw.WriteElementString ("foo", "bar");
+ AssertEquals ("WriteElementString has incorrect output.", "<foo>bar</foo>", StringWriterText);
+
+ xtw.WriteElementString ("baz", "");
+ AssertEquals ("<foo>bar</foo><baz />", StringWriterText);
+
+ xtw.WriteElementString ("quux", null);
+ AssertEquals ("<foo>bar</foo><baz /><quux />", StringWriterText);
+
+ xtw.WriteElementString ("", "quuux");
+ AssertEquals ("<foo>bar</foo><baz /><quux /><>quuux</>", StringWriterText);
+
+ xtw.WriteElementString (null, "quuuux");
+ AssertEquals ("<foo>bar</foo><baz /><quux /><>quuux</><>quuuux</>", StringWriterText);
+ }
+
+ public void TestFormatting ()
+ {
+ xtw.Formatting = Formatting.Indented;
+ xtw.WriteStartDocument ();
+ xtw.WriteStartElement ("foo");
+ xtw.WriteElementString ("bar", "");
+ xtw.Close ();
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?>\r\n<foo>\r\n <bar />\r\n</foo>", StringWriterText);
+ }
+
+ public void TestFormattingInvalidXmlForFun ()
+ {
+ xtw.Formatting = Formatting.Indented;
+ xtw.IndentChar = 'x';
+ xtw.WriteStartDocument ();
+ xtw.WriteStartElement ("foo");
+ xtw.WriteStartElement ("bar");
+ xtw.WriteElementString ("baz", "");
+ xtw.Close ();
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?>\r\n<foo>\r\nxx<bar>\r\nxxxx<baz />\r\nxx</bar>\r\n</foo>", StringWriterText);
+ }
+
+ public void TestFormattingFromRemarks ()
+ {
+ // Remarks section of on-line help for XmlTextWriter.Formatting suggests this test.
+ xtw.Formatting = Formatting.Indented;
+ xtw.WriteStartElement ("ol");
+ xtw.WriteStartElement ("li");
+ xtw.WriteString ("The big "); // This means "li" now has a mixed content model.
+ xtw.WriteElementString ("b", "E");
+ xtw.WriteElementString ("i", "lephant");
+ xtw.WriteString (" walks slowly.");
+ xtw.WriteEndElement ();
+ xtw.WriteEndElement ();
+ AssertEquals ("<ol>\r\n <li>The big <b>E</b><i>lephant</i> walks slowly.</li>\r\n</ol>", StringWriterText);
+ }
+
+ public void TestLookupPrefix ()
+ {
+ xtw.WriteStartElement ("root");
+
+ xtw.WriteStartElement ("one");
+ xtw.WriteAttributeString ("xmlns", "foo", null, "http://abc.def");
+ xtw.WriteAttributeString ("xmlns", "bar", null, "http://ghi.jkl");
+ AssertEquals ("foo", xtw.LookupPrefix ("http://abc.def"));
+ AssertEquals ("bar", xtw.LookupPrefix ("http://ghi.jkl"));
+ xtw.WriteEndElement ();
+
+ xtw.WriteStartElement ("two");
+ xtw.WriteAttributeString ("xmlns", "baz", null, "http://mno.pqr");
+ xtw.WriteString("quux");
+ AssertEquals ("baz", xtw.LookupPrefix ("http://mno.pqr"));
+ AssertNull (xtw.LookupPrefix ("http://abc.def"));
+ AssertNull (xtw.LookupPrefix ("http://ghi.jkl"));
+
+ AssertNull (xtw.LookupPrefix ("http://bogus"));
+ }
+
+ public void TestNamespacesAttributesPassingInNamespaces ()
+ {
+ xtw.Namespaces = false;
+ xtw.WriteStartElement ("foo");
+
+ // These shouldn't throw any exceptions since they don't pass in
+ // a namespace.
+ xtw.WriteAttributeString ("bar", "baz");
+ xtw.WriteAttributeString ("", "a", "", "b");
+ xtw.WriteAttributeString (null, "c", "", "d");
+ xtw.WriteAttributeString ("", "e", null, "f");
+ xtw.WriteAttributeString (null, "g", null, "h");
+
+ AssertEquals ("<foo bar='baz' a='b' c='d' e='f' g='h'", StringWriterText);
+
+ // These should throw ArgumentException because they pass in a
+ // namespace when Namespaces = false.
+ }
+
+ public void TestNamespacesElementsPassingInNamespaces ()
+ {
+ xtw.Namespaces = false;
+
+ // These shouldn't throw any exceptions since they don't pass in
+ // a namespace.
+ xtw.WriteElementString ("foo", "bar");
+ xtw.WriteStartElement ("baz");
+ xtw.WriteStartElement ("quux", "");
+ xtw.WriteStartElement ("quuux", null);
+ xtw.WriteStartElement (null, "a", null);
+ xtw.WriteStartElement (null, "b", "");
+ xtw.WriteStartElement ("", "c", null);
+ xtw.WriteStartElement ("", "d", "");
+
+ AssertEquals ("<foo>bar</foo><baz><quux><quuux><a><b><c><d", StringWriterText);
+
+ // These should throw ArgumentException because they pass in a
+ // namespace when Namespaces = false.
+ try {
+ xtw.WriteElementString ("qux", "http://netsack.com/", String.Empty);
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteStartElement ("foo", "http://netsack.com/");
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteStartElement ("foo", "bar", "http://netsack.com/");
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteStartElement ("foo", "bar", null);
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteStartElement ("foo", "bar", "");
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteStartElement ("foo", "", "");
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+ }
+
+ public void TestNamespacesNoNamespaceClearsDefaultNamespace ()
+ {
+ xtw.WriteStartElement(String.Empty, "foo", "http://netsack.com/");
+ xtw.WriteStartElement(String.Empty, "bar", String.Empty);
+ xtw.WriteElementString("baz", String.Empty, String.Empty);
+ xtw.WriteEndElement();
+ xtw.WriteEndElement();
+ AssertEquals ("XmlTextWriter is incorrectly outputting namespaces.",
+ "<foo xmlns='http://netsack.com/'><bar xmlns=''><baz /></bar></foo>", StringWriterText);
+ }
+
+ public void TestNamespacesPrefix ()
+ {
+ xtw.WriteStartElement ("foo", "bar", "http://netsack.com/");
+ xtw.WriteStartElement ("foo", "baz", "http://netsack.com/");
+ xtw.WriteElementString ("qux", "http://netsack.com/", String.Empty);
+ xtw.WriteEndElement ();
+ xtw.WriteEndElement ();
+ AssertEquals ("XmlTextWriter is incorrectly outputting prefixes.",
+ "<foo:bar xmlns:foo='http://netsack.com/'><foo:baz><foo:qux /></foo:baz></foo:bar>", StringWriterText);
+ }
+
+ public void TestNamespacesPrefixWithEmptyAndNullNamespace ()
+ {
+ try {
+ xtw.WriteStartElement ("foo", "bar", "");
+ Fail ("Should have thrown an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ try
+ {
+ xtw.WriteStartElement ("foo", "bar", null);
+ Fail ("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) {}
+ }
+
+ public void TestNamespacesSettingWhenWriteStateNotStart ()
+ {
+ xtw.WriteStartElement ("foo");
+ try
+ {
+ xtw.Namespaces = false;
+ Fail ("Expected an InvalidOperationException.");
+ }
+ catch (InvalidOperationException) {}
+ AssertEquals (true, xtw.Namespaces);
+ }
+
+ public void TestProcessingInstructionValid ()
+ {
+ xtw.WriteProcessingInstruction("foo", "bar");
+ AssertEquals ("WriteProcessingInstruction had incorrect output.", "<?foo bar?>", StringWriterText);
+ }
+
+ public void TestProcessingInstructionInvalid ()
+ {
+ try
+ {
+ xtw.WriteProcessingInstruction("fo?>o", "bar");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+
+ try
+ {
+ xtw.WriteProcessingInstruction("foo", "ba?>r");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+
+ try
+ {
+ xtw.WriteProcessingInstruction("", "bar");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+
+ try
+ {
+ xtw.WriteProcessingInstruction(null, "bar");
+ Fail("Should have thrown an ArgumentException.");
+ }
+ catch (ArgumentException) { }
+ }
+
+ public void TestQuoteCharDoubleQuote ()
+ {
+ xtw.QuoteChar = '"';
+
+ // version, encoding, standalone
+ xtw.WriteStartDocument (true);
+
+ // namespace declaration
+ xtw.WriteElementString ("foo", "http://netsack.com", "bar");
+
+ AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?><foo xmlns=\"http://netsack.com\">bar</foo>", StringWriterText);
+
+
+ }
+
+ public void TestQuoteCharInvalid ()
+ {
+ try {
+ xtw.QuoteChar = 'x';
+ Fail ("Should have thrown an ArgumentException.");
+ } catch (ArgumentException) {}
+ }
+
+ public void TestWriteBase64 ()
+ {
+ UTF8Encoding encoding = new UTF8Encoding();
+ byte[] fooBar = encoding.GetBytes("foobar");
+ xtw.WriteBase64 (fooBar, 0, 6);
+ AssertEquals("Zm9vYmFy", StringWriterText);
+
+ try {
+ xtw.WriteBase64 (fooBar, 3, 6);
+ Fail ("Expected an Argument Exception to be thrown.");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteBase64 (fooBar, -1, 6);
+ Fail ("Expected an Argument Exception to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ xtw.WriteBase64 (fooBar, 3, -1);
+ Fail ("Expected an Argument Exception to be thrown.");
+ } catch (ArgumentOutOfRangeException) {}
+
+ try {
+ xtw.WriteBase64 (null, 0, 6);
+ Fail ("Expected an Argument Exception to be thrown.");
+ } catch (ArgumentNullException) {}
+ }
+
+ public void TestWriteCharEntity ()
+ {
+ xtw.WriteCharEntity ('a');
+ AssertEquals ("&#x61;", StringWriterText);
+
+ xtw.WriteCharEntity ('A');
+ AssertEquals ("&#x61;&#x41;", StringWriterText);
+
+ xtw.WriteCharEntity ('1');
+ AssertEquals ("&#x61;&#x41;&#x31;", StringWriterText);
+
+ xtw.WriteCharEntity ('K');
+ AssertEquals ("&#x61;&#x41;&#x31;&#x4B;", StringWriterText);
+
+ try {
+ xtw.WriteCharEntity ((char)0xd800);
+ } catch (ArgumentException) {}
+ }
+
+ public void TestWriteEndAttribute ()
+ {
+ try
+ {
+ xtw.WriteEndAttribute ();
+ Fail ("Should have thrown an InvalidOperationException.");
+ }
+ catch (InvalidOperationException) {}
+ }
+
+ public void TestWriteEndDocument ()
+ {
+ try {
+ xtw.WriteEndDocument ();
+ Fail ("Expected an ArgumentException.");
+ } catch (ArgumentException) {}
+
+ xtw.WriteStartDocument ();
+
+ try
+ {
+ xtw.WriteEndDocument ();
+ Fail ("Expected an ArgumentException.");
+ }
+ catch (ArgumentException) {}
+
+ xtw.WriteStartElement ("foo");
+ xtw.WriteStartAttribute ("bar", null);
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='", StringWriterText);
+
+ xtw.WriteEndDocument ();
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='' />", StringWriterText);
+ AssertEquals (WriteState.Start, xtw.WriteState);
+ }
+
+ public void TestWriteEndElement ()
+ {
+ try {
+ xtw.WriteEndElement ();
+ Fail ("Should have thrown an InvalidOperationException.");
+ } catch (InvalidOperationException e) {
+ AssertEquals ("Exception message is incorrect.", "There was no XML start tag open.", e.Message);
+ }
+
+ xtw.WriteStartElement ("foo");
+ xtw.WriteEndElement ();
+ AssertEquals ("<foo />", StringWriterText);
+
+ xtw.WriteStartElement ("bar");
+ xtw.WriteStartAttribute ("baz", null);
+ xtw.WriteEndElement ();
+ AssertEquals ("<foo /><bar baz='' />", StringWriterText);
+ }
+
+ public void TestFullEndElement ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteFullEndElement ();
+ AssertEquals ("<foo></foo>", StringWriterText);
+
+ xtw.WriteStartElement ("bar");
+ xtw.WriteAttributeString ("foo", "bar");
+ xtw.WriteFullEndElement ();
+ AssertEquals ("<foo></foo><bar foo='bar'></bar>", StringWriterText);
+
+ xtw.WriteStartElement ("baz");
+ xtw.WriteStartAttribute ("bar", null);
+ xtw.WriteFullEndElement ();
+ AssertEquals ("<foo></foo><bar foo='bar'></bar><baz bar=''></baz>", StringWriterText);
+ }
+
+ public void TestWriteRaw ()
+ {
+ xtw.WriteRaw("&<>\"'");
+ AssertEquals ("&<>\"'", StringWriterText);
+
+ xtw.WriteRaw(null);
+ AssertEquals ("&<>\"'", StringWriterText);
+
+ xtw.WriteRaw("");
+ AssertEquals ("&<>\"'", StringWriterText);
+ }
+
+ public void TestWriteRawInvalidInAttribute ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteStartAttribute ("bar", null);
+ xtw.WriteRaw ("&<>\"'");
+ xtw.WriteEndAttribute ();
+ xtw.WriteEndElement ();
+ AssertEquals ("<foo bar='&<>\"'' />", StringWriterText);
+ }
+
+ public void TestWriteState ()
+ {
+ AssertEquals (WriteState.Start, xtw.WriteState);
+ xtw.WriteStartDocument ();
+ AssertEquals (WriteState.Prolog, xtw.WriteState);
+ xtw.WriteStartElement ("root");
+ AssertEquals (WriteState.Element, xtw.WriteState);
+ xtw.WriteElementString ("foo", "bar");
+ AssertEquals (WriteState.Content, xtw.WriteState);
+ xtw.Close ();
+ AssertEquals (WriteState.Closed, xtw.WriteState);
+ }
+
+ public void TestWriteString ()
+ {
+ xtw.WriteStartDocument ();
+ try {
+ xtw.WriteString("foo");
+ } catch (InvalidOperationException) {}
+
+ // Testing attribute values
+
+ xtw.WriteStartElement ("foo");
+ xtw.WriteAttributeString ("bar", "&<>");
+ AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='&amp;&lt;&gt;'", StringWriterText);
+
+ // When QuoteChar is single quote then replaces single quotes within attributes
+ // but not double quotes.
+ sw.GetStringBuilder ().Remove (0, sw.GetStringBuilder ().Length);
+ xtw.WriteStartElement ("foo");
+ xtw.WriteAttributeString ("bar", "\"baz\"");
+ xtw.WriteAttributeString ("quux", "'baz'");
+ AssertEquals ("><foo bar='\"baz\"' quux='&apos;baz&apos;'", StringWriterText);
+
+ // When QuoteChar is double quote then replaces double quotes within attributes
+ // but not single quotes.
+ xtw.QuoteChar = '"';
+ sw.GetStringBuilder ().Remove (0, sw.GetStringBuilder ().Length);
+ xtw.WriteStartElement ("foo");
+ xtw.WriteAttributeString ("bar", "\"baz\"");
+ xtw.WriteAttributeString ("quux", "'baz'");
+ AssertEquals ("><foo bar=\"&quot;baz&quot;\" quux=\"'baz'\"", StringWriterText);
+
+ // Testing element values
+ xtw.QuoteChar = '\'';
+ sw.GetStringBuilder ().Remove (0, sw.GetStringBuilder ().Length);
+ xtw.WriteElementString ("foo", "&<>\"'");
+ AssertEquals ("><foo>&amp;&lt;&gt;\"'</foo>", StringWriterText);
+ }
+
+ public void TestXmlLang ()
+ {
+ AssertNull (xtw.XmlLang);
+
+ xtw.WriteStartElement ("foo");
+ xtw.WriteAttributeString ("xml", "lang", null, "langfoo");
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo'", StringWriterText);
+
+ xtw.WriteAttributeString ("boo", "yah");
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'", StringWriterText);
+
+ xtw.WriteElementString("bar", "baz");
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>", StringWriterText);
+
+ xtw.WriteString("baz");
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz", StringWriterText);
+
+ xtw.WriteStartElement ("quux");
+ xtw.WriteStartAttribute ("xml", "lang", null);
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='", StringWriterText);
+
+ xtw.WriteString("langbar");
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='", StringWriterText);
+
+ xtw.WriteEndAttribute ();
+ AssertEquals ("langbar", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'", StringWriterText);
+
+ // check if xml:lang repeats output even if same as current scope.
+ xtw.WriteStartElement ("joe");
+ xtw.WriteAttributeString ("xml", "lang", null, "langbar");
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'", StringWriterText);
+
+
+ xtw.WriteElementString ("quuux", "squonk");
+ AssertEquals ("langbar", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux>", StringWriterText);
+
+ xtw.WriteEndElement ();
+ xtw.WriteEndElement ();
+ AssertEquals ("langfoo", xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux></joe></quux>", StringWriterText);
+
+ xtw.WriteEndElement ();
+ AssertNull (xtw.XmlLang);
+ AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux></joe></quux></foo>", StringWriterText);
+
+ xtw.Close ();
+ AssertNull (xtw.XmlLang);
+ }
+
+ // TODO: test operational aspects
+ public void TestXmlSpace ()
+ {
+ xtw.WriteStartElement ("foo");
+ AssertEquals (XmlSpace.None, xtw.XmlSpace);
+
+ xtw.WriteStartElement ("bar");
+ xtw.WriteAttributeString ("xml", "space", null, "preserve");
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ AssertEquals ("<foo><bar xml:space='preserve'", StringWriterText);
+
+ xtw.WriteStartElement ("baz");
+ xtw.WriteAttributeString ("xml", "space", null, "preserve");
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'", StringWriterText);
+
+ xtw.WriteStartElement ("quux");
+ xtw.WriteStartAttribute ("xml", "space", null);
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='", StringWriterText);
+
+ xtw.WriteString ("default");
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='", StringWriterText);
+
+ xtw.WriteEndAttribute ();
+ AssertEquals (XmlSpace.Default, xtw.XmlSpace);
+ AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='default'", StringWriterText);
+
+ xtw.WriteEndElement ();
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ xtw.WriteEndElement ();
+ AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+ xtw.WriteEndElement ();
+ AssertEquals (XmlSpace.None, xtw.XmlSpace);
+
+ xtw.WriteStartElement ("quux");
+ try {
+ xtw.WriteAttributeString ("xml", "space", null, "bubba");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteAttributeString ("xml", "space", null, "PRESERVE");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteAttributeString ("xml", "space", null, "Preserve");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteAttributeString ("xml", "space", null, "Default");
+ } catch (ArgumentException) {}
+
+ try {
+ xtw.WriteWhitespace ("x");
+ } catch (ArgumentException) { }
+ }
+
+ public void TestXmlSpaceRaw ()
+ {
+ xtw.WriteStartElement ("foo");
+ xtw.WriteStartAttribute ("xml", "space", null);
+ AssertEquals (XmlSpace.None, xtw.XmlSpace);
+ AssertEquals ("<foo xml:space='", StringWriterText);
+
+ xtw.WriteString ("default");
+ AssertEquals (XmlSpace.None, xtw.XmlSpace);
+ AssertEquals ("<foo xml:space='", StringWriterText);
+
+ xtw.WriteEndAttribute ();
+ AssertEquals (XmlSpace.Default, xtw.XmlSpace);
+ AssertEquals ("<foo xml:space='default'", StringWriterText);
+ }
+ }
+}
diff --git a/mcs/class/System.XML/Test/XmlWhiteSpaceTests.cs b/mcs/class/System.XML/Test/XmlWhiteSpaceTests.cs
new file mode 100755
index 00000000000..f0f16859d3a
--- /dev/null
+++ b/mcs/class/System.XML/Test/XmlWhiteSpaceTests.cs
@@ -0,0 +1,117 @@
+//
+// System.Xml.XmlWhitespaceTests.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Xml;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+ public class XmlWhitespaceTests : TestCase
+ {
+ XmlDocument document;
+ XmlDocument doc2;
+ XmlWhitespace whitespace;
+ XmlWhitespace broken;
+ XmlNode original;
+ XmlNode deep;
+ XmlNode shallow;
+
+ public XmlWhitespaceTests () : base ("Ximian.Mono.Tests.XmlWhitespaceTests testsuite") {}
+ public XmlWhitespaceTests (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ document = new XmlDocument ();
+ document.LoadXml ("<root><foo></foo></root>");
+ XmlElement element = document.CreateElement ("foo");
+ whitespace = document.CreateWhitespace ("\r\n");
+ element.AppendChild (whitespace);
+
+ doc2 = new XmlDocument ();
+ }
+
+ public void TestInnerAndOuterXml ()
+ {
+ whitespace = doc2.CreateWhitespace ("\r\n\t ");
+ AssertEquals (String.Empty, whitespace.InnerXml);
+ AssertEquals ("\r\n\t ", whitespace.OuterXml);
+ }
+
+ internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+ {
+// assertequals (original.nodetype + " was incorrectly cloned.",
+// original.baseuri, cloned.baseuri);
+ AssertNull (cloned.ParentNode);
+ AssertEquals ("Value incorrectly cloned",
+ cloned.Value, original.Value);
+
+ Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+ }
+
+ public void TestXmlWhitespaceBadConstructor ()
+ {
+ try {
+ broken = document.CreateWhitespace ("black");
+
+ } catch (ArgumentException) {
+ return;
+
+ } catch (Exception) {
+ Fail ("Incorrect Exception thrown.");
+ }
+ }
+
+ public void TestXmlWhitespaceConstructor ()
+ {
+ AssertEquals ("whitespace char didn't get copied right",
+ "\r\n", whitespace.Data);
+ }
+
+
+ public void TestXmlWhitespaceName ()
+ {
+ AssertEquals (whitespace.NodeType + " Name property broken",
+ whitespace.Name, "#whitespace");
+ }
+
+ public void TestXmlWhitespaceLocalName ()
+ {
+ AssertEquals (whitespace.NodeType + " LocalName property broken",
+ whitespace.LocalName, "#whitespace");
+ }
+
+ public void TestXmlWhitespaceNodeType ()
+ {
+ AssertEquals ("XmlWhitespace NodeType property broken",
+ whitespace.NodeType.ToString (), "Whitespace");
+ }
+
+ public void TestXmlWhitespaceIsReadOnly ()
+ {
+ AssertEquals ("XmlWhitespace IsReadOnly property broken",
+ whitespace.IsReadOnly, false);
+ }
+
+ public void TestXmlWhitespaceCloneNode ()
+ {
+ original = whitespace;
+
+ shallow = whitespace.CloneNode (false); // shallow
+ TestXmlNodeBaseProperties (original, shallow);
+
+ deep = whitespace.CloneNode (true); // deep
+ TestXmlNodeBaseProperties (original, deep);
+
+ AssertEquals ("deep cloning differs from shallow cloning",
+ deep.OuterXml, shallow.OuterXml);
+ }
+ }
+}
diff --git a/mcs/class/System/.cvsignore b/mcs/class/System/.cvsignore
new file mode 100644
index 00000000000..c5f30212276
--- /dev/null
+++ b/mcs/class/System/.cvsignore
@@ -0,0 +1,2 @@
+System.dll
+list
diff --git a/mcs/class/System/ChangeLog b/mcs/class/System/ChangeLog
new file mode 100644
index 00000000000..b87f5c70740
--- /dev/null
+++ b/mcs/class/System/ChangeLog
@@ -0,0 +1,18 @@
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * System.build: Build System.dll with mono's corlib.dll and
+ System.Xml.dll.
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * System.build: Start build System.Net.Sockets.Socket.cs,
+ TcpClient.cs and TcpListener.cs
+
+2001-12-07 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: Add the change log to this directory
+
+ * System.build: Add dependancy on linux target to test target. Need to
+ have the dll before we can test it, right? Plus it encourages others
+ to try 'make test'.
+
diff --git a/mcs/class/System/System.CodeDom.Compiler/ChangeLog b/mcs/class/System/System.CodeDom.Compiler/ChangeLog
new file mode 100755
index 00000000000..8bbfdd12a26
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/ChangeLog
@@ -0,0 +1,9 @@
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * CodeGenerator.cs : Mark bits with MonoTODO.
+
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * CodeGenerator.cs: moved using statement out of namespace
+ declaration.
+
diff --git a/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs b/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs
new file mode 100755
index 00000000000..7cefc4f5709
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/CodeGenerator.cs
@@ -0,0 +1,238 @@
+//
+// System.CodeDom.Compiler CodeGenerator class
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.CodeDom;
+using System.Reflection;
+using System.IO;
+
+namespace System.CodeDom.Compiler {
+
+ public abstract class CodeGenerator : ICodeGenerator {
+ protected TextWriter output;
+
+ protected virtual void ContinueOnNewLine (string st)
+ {
+ }
+
+ CodeGenerator ()
+ {
+ indent = 8;
+ }
+
+ //
+ // Code Generation methods
+ //
+ protected abstract void GenerateArrayCreateExpression (CodeArrayCreateExpression e);
+ protected abstract void GenerateAssignStatement (CodeAssignStatement s);
+ protected abstract void GenerateAttachEventStatement (CodeAttachEventStatement s);
+ protected abstract void GenerateBaseReferenceExpression (CodeBaseReferenceExpression e);
+ protected abstract void GenerateBinaryOperatorExpression (CodeBinaryOperatorExpression x);
+ protected abstract void GenerateCastExpression (CodeCastExpression x);
+ protected abstract void GenerateClasses (CodeNamespace x);
+ protected abstract void GenerateCommentStatement (CodeCommentStatement x);
+ protected abstract void GenerateConstructor (CodeConstructor x, CodeTypeDeclaration c);
+ protected abstract void GenerateDelegateCreateExpression (CodeDelegateCreateExpression x);
+ protected abstract void GenerateDelegateInvokeExpression (CodeDelegateInvokeExpression x);
+ protected abstract void GenerateEvent (CodeMemberEvent x, CodeTypeDeclaration c);
+ protected abstract void GenerateExpression (CodeExpression x);
+ protected abstract void GenerateField (CodeMemberField x);
+ protected abstract void GenerateFieldReferenceExpression (CodeFieldReferenceExpression x);
+ protected abstract void GenerateIndexerExpression (CodeIndexerExpression x);
+ protected abstract void GenerateLinePragmaStart (CodeLinePragma x);
+ protected abstract void GenerateLinePragmaEnd (CodeLinePragma x);
+ protected abstract void GenerateMethod (CodeMemberMethod m, CodeTypeDeclaration c);
+ protected abstract void GenerateMethodInvokeExpression (CodeMethodInvokeExpression x);
+ protected abstract void GenerateMethodReturnStatement (CodeMethodReturnStatement x);
+ protected abstract void GenerateNamespace (CodeNamespace x);
+ protected abstract void GenerateNamespaceStart (CodeNamespace x);
+ protected abstract void GenerateNamespaceEnd (CodeNamespace x);
+ protected abstract void GenerateNamespaceImport (CodeNamespaceImport i);
+ protected abstract void GenerateNamespaceImports (CodeNamespace i);
+ protected abstract void GenerateObjectCreateExpression (CodeObjectCreateExpression x);
+ protected abstract void GenerateParameterDeclarationExpression (CodeParameterDeclarationExpression x);
+ protected abstract void GeneratePrimitiveExpression (CodePrimitiveExpression x);
+ protected abstract void GenerateProperty (CodeMemberProperty e, CodeTypeDeclaration c);
+ protected abstract void GeneratePropertyReferenceExpression (CodePropertyReferenceExpression x);
+ protected abstract void GenerateStatement (CodeStatement x);
+ protected abstract void GenerateStatementCollection (CodeStatementCollection x);
+ protected abstract void GenerateThisReferenceExpression (CodeThisReferenceExpression x);
+ protected abstract void GenerateThrowExceptionStatement (CodeThrowExceptionStatement x);
+ protected abstract void GenerateTryCatchFinallyStatement (CodeTryCatchFinallyStatement x);
+ protected abstract void GenerateTypeOfExpression (CodeTypeOfExpression x);
+ protected abstract void GenerateTypeReferenceExpression (CodeTypeReferenceExpression x);
+ protected abstract void GenerateVariableDeclarationStatement (CodeVariableDeclarationStatement x);
+
+ //
+ // Other members
+ //
+ protected abstract string GetNullToken ();
+
+ public abstract bool IsValidIdentifier (string value);
+
+ [MonoTODO]
+ public static bool IsValidLanguateIndependentIdentifier (string value)
+ {
+ /* FIXME: implement */
+ return true;
+ }
+
+ //
+ // Output functions
+ //
+ protected virtual void OutputAttributeArgument (CodeAttributeArgument arg)
+ {
+ }
+
+ protected virtual void OutputDirection (FieldDirection dir)
+ {
+ }
+
+ protected virtual void OutputExpressionList (CodeExpressionCollection c)
+ {
+ }
+
+ protected virtual void OutputExpressionLIst (CodeExpressionCollection c, bool useNewlines)
+ {
+ }
+
+ protected virtual void OutputFieldScopeModifier (MemberAttributes attrs)
+ {
+ }
+
+ protected virtual void OutputIdentifier (string ident)
+ {
+ }
+
+ protected virtual void OutputMemberAccessModifier (MemberAttributes attrs)
+ {
+ }
+
+ protected virtual void OutputMemberScopeModifier (MemberAttributes attrs)
+ {
+ }
+
+ protected virtual void OutputOperator (CodeBinaryOperatorType op)
+ {
+ }
+
+ protected virtual void OutputParameters (CodeParameterDeclarationExpressionCollection pars)
+ {
+ }
+
+ protected virtual void OutputType (string typeRef)
+ {
+ }
+
+ protected virtual void OutputTypeAttributes (TypeAttributes attrs)
+ {
+ }
+
+ protected virtual void OutputTypeNamePair (string typeRef, string name)
+ {
+ }
+
+
+ protected abstract string QuoteLiteralString (string value);
+
+ public virtual void ValidateIdentifier (string value)
+ {
+ }
+
+ //
+ // Properties
+ //
+ protected string currentClassName;
+ protected string CurrentClassName {
+ get {
+ return currentClassName;
+ }
+ }
+
+ protected CodeTypeMember codeClassMember;
+ protected CodeTypeMember CurrentMember {
+ get {
+ return codeClassMember;
+ }
+ }
+
+ protected string CurrentMemberName {
+ get {
+ return codeClassMember.Name;
+ }
+ }
+
+ int indent;
+ protected int Indent {
+ get {
+ return indent;
+ }
+
+ set {
+ indent = value;
+ }
+ }
+
+ //
+ // This concept seems broken, I should not really be using
+ // a flag, I should be "probing" what is being generated.
+ // at least the Start/End
+ // functions should not be abstract, or abstract could
+ // have an implementation piece?
+ //
+ public bool isCurrentClass;
+ protected bool IsCurrentClass {
+ get {
+ return isCurrentClass;
+ }
+ }
+
+ public bool isCurrentDelegate;
+ protected bool IsCurrentDelegate {
+ get {
+ return isCurrentDelegate;
+ }
+ }
+ public bool isCurrentEnum;
+ protected bool IsCurrentEnum {
+ get {
+ return isCurrentEnum;
+ }
+ }
+ public bool isCurrentInterface;
+ protected bool IsCurrentInterface {
+ get {
+ return isCurrentInterface;
+ }
+ }
+
+ public bool isCurrentStruct;
+ protected bool IsCurrentStruct {
+ get {
+ return isCurrentStruct;
+ }
+ }
+
+ protected TextWriter Output {
+ get {
+ return output;
+ }
+
+ set {
+ output = value;
+ }
+ }
+
+ public abstract void GenerateCodeFromExpression (TextWriter output, CodeExpression expression);
+
+ public abstract void GenerateCodeFromNamespace (TextWriter output, CodeExpression expression);
+
+ public abstract void GenerateCodeFromStatement (TextWriter output, CodeStatement expression);
+
+ }
+}
diff --git a/mcs/class/System/System.CodeDom.Compiler/ICodeGenerator.cs b/mcs/class/System/System.CodeDom.Compiler/ICodeGenerator.cs
new file mode 100755
index 00000000000..3cdbb32c7f6
--- /dev/null
+++ b/mcs/class/System/System.CodeDom.Compiler/ICodeGenerator.cs
@@ -0,0 +1,30 @@
+//
+// System.CodeDom.Compiler ICodeGenerator Interface
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom.Compiler {
+ using System.CodeDom;
+ using System.IO;
+
+ public interface ICodeGenerator {
+
+
+ // <summary>
+ // Generates code for @expression on @output
+ // </summary>
+ void GenerateCodeFromExpression (TextWriter output, CodeExpression expression);
+
+ void GenerateCodeFromNamespace (TextWriter output, CodeExpression expression);
+
+ void GenerateCodeFromStatement (TextWriter output, CodeStatement expression);
+
+ bool IsValidIdentifier (string value);
+
+ void ValidateIdentifier (string value);
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/ChangeLog b/mcs/class/System/System.CodeDom/ChangeLog
new file mode 100644
index 00000000000..102e74825e3
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/ChangeLog
@@ -0,0 +1,19 @@
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * MemberAttributes.cs: Added so rest of classes would compile.
+
+ * FieldDirection.cs: Added so rest of classes would compile.
+
+ * CodeTypeMember.cs: Added so rest of classes would compile.
+
+ * CodeTypeDeclaration.cs: Added so rest of classes would compile.
+
+ * CodeObject.cs: Added so rest of classes would compile.
+
+ * CodeBinaryOperatorType.cs: Added so rest of classes would compile.
+
+2001-07-12 Sean MacIsaac <macisaac@ximian.com>
+
+ * All files implementing IList: Added IsFixedSize property.
+
+ * All files: Changed CodeDOM to CodeDom.
diff --git a/mcs/class/System/System.CodeDom/Code-X-Collection.cs b/mcs/class/System/System.CodeDom/Code-X-Collection.cs
new file mode 100755
index 00000000000..8e4731656b4
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/Code-X-Collection.cs
@@ -0,0 +1,159 @@
+//
+// System.CodeDOM Code@CONTAINEE@Collection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDOM {
+
+ using System.Collections;
+
+ public class Code@CONTAINEE@Collection : IList, ICollection, IEnumerable {
+
+ ArrayList @arrayname@;
+
+ //
+ // Constructors
+ //
+ public Code@CONTAINEE@Collection ()
+ {
+ @arrayname@ = new ArrayList ();
+ }
+
+ //
+ // Properties
+ //
+ public int Count {
+ get {
+ return @arrayname@.Count;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public void Add (Code@CONTAINEE@ value)
+ {
+ @arrayname@.Add (value);
+ }
+
+ public void AddRange (Code@CONTAINEE@ [] values)
+ {
+ foreach (Code@CONTAINEE@ ca in values)
+ @arrayname@.Add (ca);
+
+ }
+
+ public void Clear ()
+ {
+ @arrayname@.Clear ();
+ }
+
+ private class Enumerator : IEnumerator {
+ private Code@CONTAINEE@Collection collection;
+ private int currentIndex = -1;
+
+ internal Enumerator (Code@CONTAINEE@Collection collection)
+ {
+ this.collection = collection;
+ }
+
+ public object Current {
+ get {
+ if (currentIndex == collection.Count)
+ throw new InvalidOperationException ();
+ return collection [currentIndex];
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (currentIndex > collection.Count)
+ throw new InvalidOperationException ();
+ return ++currentIndex < collection.Count;
+ }
+
+ public void Reset ()
+ {
+ currentIndex = -1;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new Code@CONTAINEE@Collection.Enumerator (this);
+ }
+
+ //
+ // IList method implementations
+ //
+ public int Add (object value)
+ {
+ return @arrayname@.Add (value);
+ }
+
+ public bool Contains (Object value)
+ {
+ return @arrayname@.Contains (value);
+ }
+
+ public int IndexOf (Object value)
+ {
+ return @arrayname@.IndexOf (value);
+ }
+
+ public void Insert (int index, Object value)
+ {
+ @arrayname@ [index] = value;
+ }
+
+ public object this[int index] {
+ get {
+ return @arrayname@ [index];
+ }
+
+ set {
+ @arrayname@ [index] = value;
+ }
+ }
+
+ public void Remove (object value)
+ {
+ @arrayname@.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ @arrayname@.RemoveAt (index);
+ }
+
+ //
+ // ICollection method implementations
+ //
+ public void CopyTo (Array array, int index)
+ {
+ @arrayname@.CopyTo (array, index);
+ }
+
+ public object SyncRoot {
+ get {
+ return @arrayname@.SyncRoot;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return @arrayname@.IsSynchronized;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs b/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs
new file mode 100755
index 00000000000..6fd273a9271
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeArrayCreateExpression.cs
@@ -0,0 +1,90 @@
+//
+// System.CodeDom CodeArrayCreateExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeArrayCreateExpression : CodeExpression {
+ string createType;
+ CodeExpressionCollection initializers;
+ CodeExpression sizeExpression;
+ int size;
+
+ //
+ // Constructors
+ //
+ public CodeArrayCreateExpression ()
+ {
+
+ }
+
+ public CodeArrayCreateExpression (string createType, CodeExpression size)
+ {
+ this.createType = createType;
+ this.sizeExpression = size;
+ }
+
+ public CodeArrayCreateExpression (string createType, int size)
+ {
+ this.createType = createType;
+ this.size = size;
+ }
+
+ public CodeArrayCreateExpression (string createType, CodeExpression [] initializers)
+ {
+ this.createType = createType;
+ this.initializers = new CodeExpressionCollection ();
+
+ this.initializers.AddRange (initializers);
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression SizeExpression {
+ get {
+ return sizeExpression;
+ }
+
+ set {
+ sizeExpression = value;
+ }
+ }
+
+ public int Size {
+ get {
+ return size;
+ }
+
+ set {
+ size = value;
+ }
+ }
+
+ public CodeExpressionCollection Initializers {
+ get {
+ return initializers;
+ }
+
+ set {
+ initializers = value;
+ }
+ }
+
+ public string CreateType {
+ get {
+ return createType;
+ }
+
+ set {
+ createType = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeAssignStatement.cs b/mcs/class/System/System.CodeDom/CodeAssignStatement.cs
new file mode 100755
index 00000000000..7e64e1b5457
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAssignStatement.cs
@@ -0,0 +1,53 @@
+//
+// System.CodeDom CodeArrayCreateExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeAssignStatement : CodeStatement {
+
+ CodeExpression left, right;
+
+ //
+ // Constructors
+ //
+ public CodeAssignStatement ()
+ {
+ }
+
+ public CodeAssignStatement (CodeExpression left, CodeExpression right)
+ {
+ this.left = left;
+ this.right = right;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression Left {
+ get {
+ return left;
+ }
+
+ set {
+ left = value;
+ }
+ }
+
+ public CodeExpression Right {
+ get {
+ return right;
+ }
+
+ set {
+ right = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs b/mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs
new file mode 100755
index 00000000000..5f3e58b2033
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAttachEventStatement.cs
@@ -0,0 +1,63 @@
+//
+// System.CodeDom CodeAttachEventStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeAttachEventStatement : CodeStatement {
+ CodeExpression targetObject;
+ string eventName;
+ CodeExpression newListener;
+
+ public CodeAttachEventStatement ()
+ {
+ }
+
+ public CodeAttachEventStatement (CodeExpression targetObject,
+ string eventName,
+ CodeExpression newListener)
+ {
+ this.targetObject = targetObject;
+ this.eventName = eventName;
+ this.newListener = newListener;
+ }
+
+ //
+ // Properties
+ //
+ public string EventName {
+ get {
+ return eventName;
+ }
+
+ set {
+ eventName = value;
+ }
+ }
+
+ public CodeExpression NewListener {
+ get {
+ return newListener;
+ }
+
+ set {
+ newListener = value;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeAttributeArgument.cs b/mcs/class/System/System.CodeDom/CodeAttributeArgument.cs
new file mode 100755
index 00000000000..ead0eb3c968
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAttributeArgument.cs
@@ -0,0 +1,61 @@
+//
+// System.CodeDom CodeAttributeArgument Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeAttributeArgument {
+ string name;
+ CodeExpression val;
+
+ //
+ // Constructors
+ //
+ public CodeAttributeArgument ()
+ {
+ }
+
+ public CodeAttributeArgument (CodeExpression value)
+ {
+ }
+
+ public CodeAttributeArgument (string name, CodeExpression val)
+ {
+ this.name = name;
+ this.val = val;
+ }
+
+ //
+ // Properties
+ //
+
+ public string Name {
+ get {
+ return name;
+ }
+
+ set {
+ name = value;
+ }
+ }
+
+ public CodeExpression Value {
+ get {
+ return val;
+ }
+
+ set {
+ val = value;
+ }
+ }
+
+
+ }
+
+}
diff --git a/mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs b/mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs
new file mode 100755
index 00000000000..2dbe445a0ec
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAttributeArgumentCollection.cs
@@ -0,0 +1,167 @@
+//
+// System.CodeDom CodeAttributeArgumentCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ using System.Collections;
+
+ [Serializable]
+ public class CodeAttributeArgumentCollection : IList, ICollection, IEnumerable {
+
+ ArrayList attributeArgs;
+
+ //
+ // Constructors
+ //
+ public CodeAttributeArgumentCollection ()
+ {
+ attributeArgs = new ArrayList ();
+ }
+
+ //
+ // Properties
+ //
+ public int Count {
+ get {
+ return attributeArgs.Count;
+ }
+ }
+
+ public bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ //
+ // Methods
+ //
+
+ public void Add (CodeAttributeArgument value)
+ {
+ attributeArgs.Add (value);
+ }
+
+ public void AddRange (CodeAttributeArgument [] values)
+ {
+ foreach (CodeAttributeArgument ca in values)
+ attributeArgs.Add (ca);
+
+ }
+
+ public void Clear ()
+ {
+ attributeArgs.Clear ();
+ }
+
+ private class Enumerator : IEnumerator {
+ private CodeAttributeArgumentCollection collection;
+ private int currentIndex = -1;
+
+ internal Enumerator (CodeAttributeArgumentCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ public object Current {
+ get {
+ if (currentIndex == collection.Count)
+ throw new InvalidOperationException ();
+ return collection [currentIndex];
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (currentIndex > collection.Count)
+ throw new InvalidOperationException ();
+ return ++currentIndex < collection.Count;
+ }
+
+ public void Reset ()
+ {
+ currentIndex = -1;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new CodeAttributeArgumentCollection.Enumerator (this);
+ }
+
+ //
+ // IList method implementations
+ //
+ public int Add (object value)
+ {
+ return attributeArgs.Add (value);
+ }
+
+ public bool Contains (Object value)
+ {
+ return attributeArgs.Contains (value);
+ }
+
+ public int IndexOf (Object value)
+ {
+ return attributeArgs.IndexOf (value);
+ }
+
+ public void Insert (int index, Object value)
+ {
+ attributeArgs [index] = value;
+ }
+
+ public object this[int index] {
+ get {
+ return attributeArgs [index];
+ }
+
+ set {
+ attributeArgs [index] = value;
+ }
+ }
+
+ public void Remove (object value)
+ {
+ attributeArgs.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ attributeArgs.RemoveAt (index);
+ }
+
+ //
+ // ICollection method implementations
+ //
+ public void CopyTo (Array array, int index)
+ {
+ attributeArgs.CopyTo (array, index);
+ }
+
+ public object SyncRoot {
+ get {
+ return attributeArgs.SyncRoot;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return attributeArgs.IsSynchronized;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeAttributeBlock.cs b/mcs/class/System/System.CodeDom/CodeAttributeBlock.cs
new file mode 100755
index 00000000000..16ed71265ba
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAttributeBlock.cs
@@ -0,0 +1,42 @@
+//
+// System.CodeDom CodeAttributeBlock Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeAttributeBlock {
+
+ CodeAttributeDeclarationCollection attributes;
+
+ //
+ // Constructors
+ //
+ public CodeAttributeBlock ()
+ {
+ }
+
+ public CodeAttributeBlock (CodeAttributeDeclaration [] attributes)
+ {
+ this.attributes = new CodeAttributeDeclarationCollection ();
+ this.attributes.AddRange (attributes);
+ }
+
+ //
+ // Prpoperties
+ //
+ public CodeAttributeDeclarationCollection Attributes {
+ get {
+ return attributes;
+ }
+
+ set {
+ attributes = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs b/mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs
new file mode 100755
index 00000000000..2d51f556f85
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAttributeDeclaration.cs
@@ -0,0 +1,61 @@
+//
+// System.CodeDom CodeAttributeDeclaration Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeAttributeDeclaration {
+
+ string name;
+ CodeAttributeArgumentCollection arguments;
+
+ //
+ // Constructors
+ //
+ public CodeAttributeDeclaration ()
+ {
+ }
+
+ public CodeAttributeDeclaration (string name)
+ {
+ this.name = name;
+ }
+
+ public CodeAttributeDeclaration (string name, CodeAttributeArgument [] arguments)
+ {
+ this.name = name;
+ this.arguments = new CodeAttributeArgumentCollection ();
+ this.arguments.AddRange (arguments);
+ }
+
+ //
+ // Properties
+ //
+ public CodeAttributeArgumentCollection Arguments {
+ get {
+ return arguments;
+ }
+
+ set {
+ arguments = value;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+
+ set {
+ name = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs b/mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs
new file mode 100755
index 00000000000..f387a1f38fc
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeAttributeDeclarationCollection.cs
@@ -0,0 +1,166 @@
+//
+// System.CodeDom CodeAttributeDeclarationCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ using System.Collections;
+
+ [Serializable]
+ public class CodeAttributeDeclarationCollection : IList, ICollection, IEnumerable {
+
+ ArrayList attributeDecls;
+
+ //
+ // Constructors
+ //
+ public CodeAttributeDeclarationCollection ()
+ {
+ attributeDecls = new ArrayList ();
+ }
+
+ //
+ // Properties
+ //
+ public int Count {
+ get {
+ return attributeDecls.Count;
+ }
+ }
+
+ public bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public void Add (CodeAttributeDeclaration value)
+ {
+ attributeDecls.Add (value);
+ }
+
+ public void AddRange (CodeAttributeDeclaration [] values)
+ {
+ foreach (CodeAttributeDeclaration ca in values)
+ attributeDecls.Add (ca);
+
+ }
+
+ public void Clear ()
+ {
+ attributeDecls.Clear ();
+ }
+
+ private class Enumerator : IEnumerator {
+ private CodeAttributeDeclarationCollection collection;
+ private int currentIndex = -1;
+
+ internal Enumerator (CodeAttributeDeclarationCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ public object Current {
+ get {
+ if (currentIndex == collection.Count)
+ throw new InvalidOperationException ();
+ return collection [currentIndex];
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (currentIndex > collection.Count)
+ throw new InvalidOperationException ();
+ return ++currentIndex < collection.Count;
+ }
+
+ public void Reset ()
+ {
+ currentIndex = -1;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new CodeAttributeDeclarationCollection.Enumerator (this);
+ }
+
+ //
+ // IList method implementations
+ //
+ public int Add (object value)
+ {
+ return attributeDecls.Add (value);
+ }
+
+ public bool Contains (Object value)
+ {
+ return attributeDecls.Contains (value);
+ }
+
+ public int IndexOf (Object value)
+ {
+ return attributeDecls.IndexOf (value);
+ }
+
+ public void Insert (int index, Object value)
+ {
+ attributeDecls [index] = value;
+ }
+
+ public object this[int index] {
+ get {
+ return attributeDecls [index];
+ }
+
+ set {
+ attributeDecls [index] = value;
+ }
+ }
+
+ public void Remove (object value)
+ {
+ attributeDecls.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ attributeDecls.RemoveAt (index);
+ }
+
+ //
+ // ICollection method implementations
+ //
+ public void CopyTo (Array array, int index)
+ {
+ attributeDecls.CopyTo (array, index);
+ }
+
+ public object SyncRoot {
+ get {
+ return attributeDecls.SyncRoot;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return attributeDecls.IsSynchronized;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs
new file mode 100755
index 00000000000..12f71c4c6a4
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeBaseReferenceExpression.cs
@@ -0,0 +1,16 @@
+//
+// System.CodeDom CodeBaseReferenceExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeBaseReferenceExpression : CodeExpression {
+ public CodeBaseReferenceExpression () {}
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs b/mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs
new file mode 100755
index 00000000000..82e2070e375
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeBinaryOperatorExpression.cs
@@ -0,0 +1,89 @@
+//
+// System.CodeDom CodeBinaryOperatorExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeBinaryOperatorExpression : CodeExpression {
+
+ CodeExpression left, right;
+ CodeBinaryOperatorType oper;
+
+ public enum CodeBinaryOperatorType {
+ Add,
+ Substract,
+ Multiply,
+ Divide,
+ Modulus,
+ Assign,
+ IdentityInequality,
+ IdentityEquality,
+ ValueEquality,
+ BitwiseOr,
+ BitwiseAnd,
+ BooleanOr,
+ BooleanAnd,
+ LessThan,
+ LessThanOrEqual,
+ GreatherThan,
+ GreatherThanOrEqual,
+ }
+
+ //
+ // Constructors
+ //
+ public CodeBinaryOperatorExpression ()
+ {
+ }
+
+
+ public CodeBinaryOperatorExpression (CodeExpression left,
+ CodeBinaryOperatorType oper,
+ CodeExpression right)
+ {
+ this.left = left;
+ this.oper = oper;
+ this.right = right;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression Left {
+ get {
+ return left;
+ }
+
+ set {
+ left = value;
+ }
+ }
+
+ public CodeExpression Right {
+ get {
+ return right;
+ }
+
+ set {
+ right = value;
+ }
+ }
+
+ public CodeBinaryOperatorType Operator {
+ get {
+ return oper;
+ }
+
+ set {
+ oper = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeBinaryOperatorType.cs b/mcs/class/System/System.CodeDom/CodeBinaryOperatorType.cs
new file mode 100755
index 00000000000..eb2d31a02d4
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeBinaryOperatorType.cs
@@ -0,0 +1,30 @@
+//
+// System.CodeDom CodeBinaryOperatorType Enum implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+ public enum CodeBinaryOperatorType {
+ Add,
+ Assign,
+ BitwiseAnd,
+ BitwiseOr,
+ BooleanAnd,
+ BooleanOr,
+ Divide,
+ GreaterThan,
+ GreaterThanOrEqual,
+ IdentityEquality,
+ IdentityInequality,
+ LessThan,
+ LessThanOrEqual,
+ Modulus,
+ Multiply,
+ Subtract,
+ ValueEquality
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeCastExpression.cs b/mcs/class/System/System.CodeDom/CodeCastExpression.cs
new file mode 100755
index 00000000000..824c1060e28
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeCastExpression.cs
@@ -0,0 +1,53 @@
+//
+// System.CodeDom CodeCastExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeCastExpression : CodeExpression {
+ string targetType;
+ CodeExpression expression;
+
+ //
+ // Constructors
+ //
+ public CodeCastExpression ()
+ {
+ }
+
+ public CodeCastExpression (string targetType, CodeExpression expression)
+ {
+ this.targetType = targetType;
+ this.expression = expression;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression Expression {
+ get {
+ return expression;
+ }
+
+ set {
+ expression = value;
+ }
+ }
+
+ public string TargetType {
+ get {
+ return targetType;
+ }
+
+ set {
+ targetType = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeCatchClause.cs b/mcs/class/System/System.CodeDom/CodeCatchClause.cs
new file mode 100755
index 00000000000..3933287e2e1
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeCatchClause.cs
@@ -0,0 +1,47 @@
+//
+// System.CodeDom CodeCatchClaus Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeCatchClause {
+
+ CodeParameterDeclarationExpression condition;
+ CodeStatementCollection statements;
+
+ public CodeCatchClause ()
+ {
+ this.statements = new CodeStatementCollection ();
+ }
+
+ public CodeCatchClause (CodeParameterDeclarationExpression condition,
+ CodeStatement [] statements)
+ {
+ this.condition = condition;
+ this.statements = new CodeStatementCollection ();
+ this.statements.AddRange (statements);
+ }
+
+ public CodeStatementCollection Statements {
+ get {
+ return statements;
+ }
+ }
+
+ public CodeParameterDeclarationExpression Condition {
+ get {
+ return condition;
+ }
+
+ set {
+ condition = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs b/mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs
new file mode 100755
index 00000000000..3f1f83ae545
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeCatchClauseCollection.cs
@@ -0,0 +1,166 @@
+//
+// System.CodeDom CodeCatchClauseCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ using System.Collections;
+
+ [Serializable]
+ public class CodeCatchClauseCollection : IList, ICollection, IEnumerable {
+
+ ArrayList catchClauses;
+
+ //
+ // Constructors
+ //
+ public CodeCatchClauseCollection ()
+ {
+ catchClauses = new ArrayList ();
+ }
+
+ //
+ // Properties
+ //
+ public int Count {
+ get {
+ return catchClauses.Count;
+ }
+ }
+
+ public bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public void Add (CodeCatchClause value)
+ {
+ catchClauses.Add (value);
+ }
+
+ public void AddRange (CodeCatchClause [] values)
+ {
+ foreach (CodeCatchClause ca in values)
+ catchClauses.Add (ca);
+
+ }
+
+ public void Clear ()
+ {
+ catchClauses.Clear ();
+ }
+
+ private class Enumerator : IEnumerator {
+ private CodeCatchClauseCollection collection;
+ private int currentIndex = -1;
+
+ internal Enumerator (CodeCatchClauseCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ public object Current {
+ get {
+ if (currentIndex == collection.Count)
+ throw new InvalidOperationException ();
+ return collection [currentIndex];
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (currentIndex > collection.Count)
+ throw new InvalidOperationException ();
+ return ++currentIndex < collection.Count;
+ }
+
+ public void Reset ()
+ {
+ currentIndex = -1;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new CodeCatchClauseCollection.Enumerator (this);
+ }
+
+ //
+ // IList method implementations
+ //
+ public int Add (object value)
+ {
+ return catchClauses.Add (value);
+ }
+
+ public bool Contains (Object value)
+ {
+ return catchClauses.Contains (value);
+ }
+
+ public int IndexOf (Object value)
+ {
+ return catchClauses.IndexOf (value);
+ }
+
+ public void Insert (int index, Object value)
+ {
+ catchClauses [index] = value;
+ }
+
+ public object this[int index] {
+ get {
+ return catchClauses [index];
+ }
+
+ set {
+ catchClauses [index] = value;
+ }
+ }
+
+ public void Remove (object value)
+ {
+ catchClauses.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ catchClauses.RemoveAt (index);
+ }
+
+ //
+ // ICollection method implementations
+ //
+ public void CopyTo (Array array, int index)
+ {
+ catchClauses.CopyTo (array, index);
+ }
+
+ public object SyncRoot {
+ get {
+ return catchClauses.SyncRoot;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return catchClauses.IsSynchronized;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeClass.cs b/mcs/class/System/System.CodeDom/CodeClass.cs
new file mode 100755
index 00000000000..146cfb474ea
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeClass.cs
@@ -0,0 +1,107 @@
+//
+// System.CodeDom CodeClass Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System.Collections.Specialized;
+
+namespace System.CodeDom {
+ using System.Reflection;
+ using System.Collections;
+
+ public class CodeClass : CodeClassMember {
+ CodeClassMemberCollection members;
+ TypeAttributes attrs;
+ StringCollection baseTypes;
+ bool isClass, isEnum, isInterface, isStruct;
+
+ string name;
+
+ //
+ // Constructors
+ //
+ public CodeClass ()
+ {
+ }
+
+ public CodeClass (string name)
+ {
+ this.name = name;
+ }
+
+ //
+ // Properties
+ //
+ public TypeAttributes attributes {
+ get {
+ return attrs;
+ }
+
+ set {
+ attrs = value;
+ }
+ }
+
+ public StringCollection BaseTypes {
+ get {
+ return baseTypes;
+ }
+
+ set {
+ baseTypes = value;
+ }
+ }
+
+ public bool IsClass {
+ get {
+ return isClass;
+ }
+
+ set {
+ isClass = value;
+ }
+ }
+ public bool IsEnum {
+ get {
+ return isEnum;
+ }
+
+ set {
+ isEnum = value;
+ }
+ }
+
+ public bool IsInterface {
+ get {
+ return isInterface;
+ }
+
+ set {
+ isInterface = value;
+ }
+ }
+ public bool IsStruct {
+ get {
+ return isStruct;
+ }
+
+ set {
+ isStruct = value;
+ }
+ }
+
+ public CodeClassMemberCollection Members {
+ get {
+ return members;
+ }
+
+ set {
+ members = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeClassCollection.cs b/mcs/class/System/System.CodeDom/CodeClassCollection.cs
new file mode 100755
index 00000000000..d38055a32b8
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeClassCollection.cs
@@ -0,0 +1,165 @@
+//
+// System.CodeDom CodeClassCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ using System.Collections;
+
+ public class CodeClassCollection : IList, ICollection, IEnumerable {
+
+ ArrayList classes;
+
+ //
+ // Constructors
+ //
+ public CodeClassCollection ()
+ {
+ classes = new ArrayList ();
+ }
+
+ //
+ // Properties
+ //
+ public int Count {
+ get {
+ return classes.Count;
+ }
+ }
+
+ public bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public void Add (CodeClass value)
+ {
+ classes.Add (value);
+ }
+
+ public void AddRange (CodeClass [] values)
+ {
+ foreach (CodeClass ca in values)
+ classes.Add (ca);
+
+ }
+
+ public void Clear ()
+ {
+ classes.Clear ();
+ }
+
+ private class Enumerator : IEnumerator {
+ private CodeClassCollection collection;
+ private int currentIndex = -1;
+
+ internal Enumerator (CodeClassCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ public object Current {
+ get {
+ if (currentIndex == collection.Count)
+ throw new InvalidOperationException ();
+ return collection [currentIndex];
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (currentIndex > collection.Count)
+ throw new InvalidOperationException ();
+ return ++currentIndex < collection.Count;
+ }
+
+ public void Reset ()
+ {
+ currentIndex = -1;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new CodeClassCollection.Enumerator (this);
+ }
+
+ //
+ // IList method implementations
+ //
+ public int Add (object value)
+ {
+ return classes.Add (value);
+ }
+
+ public bool Contains (Object value)
+ {
+ return classes.Contains (value);
+ }
+
+ public int IndexOf (Object value)
+ {
+ return classes.IndexOf (value);
+ }
+
+ public void Insert (int index, Object value)
+ {
+ classes [index] = value;
+ }
+
+ public object this[int index] {
+ get {
+ return classes [index];
+ }
+
+ set {
+ classes [index] = value;
+ }
+ }
+
+ public void Remove (object value)
+ {
+ classes.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ classes.RemoveAt (index);
+ }
+
+ //
+ // ICollection method implementations
+ //
+ public void CopyTo (Array array, int index)
+ {
+ classes.CopyTo (array, index);
+ }
+
+ public object SyncRoot {
+ get {
+ return classes.SyncRoot;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return classes.IsSynchronized;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeClassConstructor.cs b/mcs/class/System/System.CodeDom/CodeClassConstructor.cs
new file mode 100755
index 00000000000..a778cf5d82d
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeClassConstructor.cs
@@ -0,0 +1,17 @@
+//
+// System.CodeDom CodeClassConstructor Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+ public class CodeClassConstructor : CodeMemberMethod {
+
+ public CodeClassConstructor ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeClassDelegate.cs b/mcs/class/System/System.CodeDom/CodeClassDelegate.cs
new file mode 100755
index 00000000000..cf4be20b3fe
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeClassDelegate.cs
@@ -0,0 +1,52 @@
+//
+// System.CodeDom CodeClassDelegate Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeClassDelegate : CodeClass {
+ CodeParameterDeclarationExpressionCollection parameters;
+ string returnType;
+ string name;
+
+ //
+ // Constructors
+ //
+ public CodeClassDelegate ()
+ {
+ }
+
+ public CodeClassDelegate (string name)
+ {
+ this.name = name;
+ }
+
+ //
+ // Properties
+ //
+ public CodeParameterDeclarationExpressionCollection Parameters {
+ get {
+ return parameters;
+ }
+
+ set {
+ parameters = value;
+ }
+ }
+
+ public string ReturnType {
+ get {
+ return returnType;
+ }
+
+ set {
+ returnType = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeClassMember.cs b/mcs/class/System/System.CodeDom/CodeClassMember.cs
new file mode 100755
index 00000000000..51d8b0476a7
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeClassMember.cs
@@ -0,0 +1,80 @@
+//
+// System.CodeDom CodeClassMember Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeClassMember : CodeStatement {
+ MemberAttributes attributes;
+ CodeAttributeBlock customAttributes;
+
+ string name;
+
+ //
+ // Yeah, this is a strange way of defining this
+ //
+ public enum MemberAttributes {
+ Abstract = 0x0001,
+ Final = 0x0002,
+ Override = 0x0004,
+ Const = 0x0005,
+ Assembly = 0x1000,
+ AccessMask = 0xf000,
+ FamANDAssem = 0x2000,
+ Family = 0x3000,
+ FamORAssem = 0x4000,
+ New = 0x0010,
+ Private = 0x5000,
+ Public = 0x6000,
+ ScopeMask = 0x000f,
+ Static = 0x0003,
+ VTableMask = 0x00f0
+ }
+
+ //
+ // Constructors
+ //
+ public CodeClassMember ()
+ {
+ }
+
+ //
+ // Properties
+ //
+
+ public MemberAttributes Attributes {
+ get {
+ return attributes;
+ }
+
+ set {
+ attributes = value;
+ }
+ }
+
+ public CodeAttributeBlock CustomAttributes {
+ get {
+ return customAttributes;
+ }
+
+ set {
+ customAttributes = value;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+
+ set {
+ name = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeClassMemberCollection.cs b/mcs/class/System/System.CodeDom/CodeClassMemberCollection.cs
new file mode 100755
index 00000000000..f081ad3a45b
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeClassMemberCollection.cs
@@ -0,0 +1,165 @@
+//
+// System.CodeDom CodeClassMemberCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ using System.Collections;
+
+ public class CodeClassMemberCollection : IList, ICollection, IEnumerable {
+
+ ArrayList classMembers;
+
+ //
+ // Constructors
+ //
+ public CodeClassMemberCollection ()
+ {
+ classMembers = new ArrayList ();
+ }
+
+ //
+ // Properties
+ //
+ public int Count {
+ get {
+ return classMembers.Count;
+ }
+ }
+
+ public bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public void Add (CodeClassMember value)
+ {
+ classMembers.Add (value);
+ }
+
+ public void AddRange (CodeClassMember [] values)
+ {
+ foreach (CodeClassMember ca in values)
+ classMembers.Add (ca);
+
+ }
+
+ public void Clear ()
+ {
+ classMembers.Clear ();
+ }
+
+ private class Enumerator : IEnumerator {
+ private CodeClassMemberCollection collection;
+ private int currentIndex = -1;
+
+ internal Enumerator (CodeClassMemberCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ public object Current {
+ get {
+ if (currentIndex == collection.Count)
+ throw new InvalidOperationException ();
+ return collection [currentIndex];
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (currentIndex > collection.Count)
+ throw new InvalidOperationException ();
+ return ++currentIndex < collection.Count;
+ }
+
+ public void Reset ()
+ {
+ currentIndex = -1;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new CodeClassMemberCollection.Enumerator (this);
+ }
+
+ //
+ // IList method implementations
+ //
+ public int Add (object value)
+ {
+ return classMembers.Add (value);
+ }
+
+ public bool Contains (Object value)
+ {
+ return classMembers.Contains (value);
+ }
+
+ public int IndexOf (Object value)
+ {
+ return classMembers.IndexOf (value);
+ }
+
+ public void Insert (int index, Object value)
+ {
+ classMembers [index] = value;
+ }
+
+ public object this[int index] {
+ get {
+ return classMembers [index];
+ }
+
+ set {
+ classMembers [index] = value;
+ }
+ }
+
+ public void Remove (object value)
+ {
+ classMembers.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ classMembers.RemoveAt (index);
+ }
+
+ //
+ // ICollection method implementations
+ //
+ public void CopyTo (Array array, int index)
+ {
+ classMembers.CopyTo (array, index);
+ }
+
+ public object SyncRoot {
+ get {
+ return classMembers.SyncRoot;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return classMembers.IsSynchronized;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeCommentStatement.cs b/mcs/class/System/System.CodeDom/CodeCommentStatement.cs
new file mode 100755
index 00000000000..29dd86d8754
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeCommentStatement.cs
@@ -0,0 +1,40 @@
+//
+// System.CodeDom CodeCommentStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeCommentStatement : CodeStatement {
+ string text;
+
+ //
+ // Constructors
+ //
+ public CodeCommentStatement ()
+ {
+ }
+
+ public CodeCommentStatement (string text)
+ {
+ this.text = text;
+ }
+
+ string Text {
+ get {
+ return text;
+ }
+
+ set {
+ text = value;
+ }
+ }
+ }
+}
+
+
diff --git a/mcs/class/System/System.CodeDom/CodeConstructor.cs b/mcs/class/System/System.CodeDom/CodeConstructor.cs
new file mode 100755
index 00000000000..f3955ef33a2
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeConstructor.cs
@@ -0,0 +1,44 @@
+//
+// System.CodeDom CodeConstructor Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeConstructor : CodeMemberMethod {
+ CodeExpressionCollection baseConstructorArgs;
+ CodeExpressionCollection chainedConstructorArgs;
+
+ //
+ // Constructors
+ //
+ public CodeConstructor ()
+ {
+ }
+
+ public CodeExpressionCollection BaseConstructorArgs {
+ get {
+ return baseConstructorArgs;
+ }
+
+ set {
+ baseConstructorArgs = value;
+ }
+ }
+
+ public CodeExpressionCollection ChainedConstructorArgs {
+ get {
+ return chainedConstructorArgs;
+ }
+
+ set {
+ chainedConstructorArgs = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs b/mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs
new file mode 100755
index 00000000000..504d53f59df
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeDelegateCreateExpression.cs
@@ -0,0 +1,67 @@
+//
+// System.CodeDom CodeDelegateCreateExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeDelegateCreateExpression : CodeExpression {
+ string delegateType, methodName;
+ CodeExpression targetObject;
+
+ //
+ // Constructors
+ //
+ public CodeDelegateCreateExpression (string delegateType,
+ CodeExpression targetObject,
+ string methodName)
+ {
+ this.delegateType = delegateType;
+ this.targetObject = targetObject;
+ this.methodName = methodName;
+ }
+
+ public CodeDelegateCreateExpression ()
+ {
+ }
+
+ //
+ // Properties
+ //
+
+ public string DelegateType {
+ get {
+ return delegateType;
+ }
+
+ set {
+ delegateType = value;
+ }
+ }
+
+ string MethodName {
+ get {
+ return methodName;
+ }
+
+ set {
+ methodName = value;
+ }
+ }
+
+ CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs b/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
new file mode 100755
index 00000000000..3a94cdfcfb4
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeDelegateInvokeExpression.cs
@@ -0,0 +1,60 @@
+//
+// System.CodeDom CodeDelegateInvokeExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeDelegateInvokeExpression : CodeExpression {
+ CodeExpressionCollection parameters;
+ CodeExpression targetObject;
+
+ //
+ // Constructors
+ //
+ public CodeDelegateInvokeExpression ()
+ {
+ }
+
+ public CodeDelegateInvokeExpression (CodeExpression targetObject,
+ CodeExpression [] parameters)
+ {
+ this.targetObject = targetObject;
+ this.parameters = new CodeExpressionCollection ();
+ this.parameters.AddRange (parameters);
+ }
+
+ public CodeDelegateInvokeExpression (CodeExpression targetObject)
+ {
+ this.targetObject = targetObject;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+
+ set {
+ targetObject = value;
+ }
+ }
+
+ public CodeExpressionCollection Parameters {
+ get {
+ return parameters;
+ }
+
+ set {
+ parameters = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeDelegateInvokeStatement.cs b/mcs/class/System/System.CodeDom/CodeDelegateInvokeStatement.cs
new file mode 100755
index 00000000000..299e107a8ed
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeDelegateInvokeStatement.cs
@@ -0,0 +1,55 @@
+//
+// System.CodeDom CodeDelegateInvokeStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeDelegateInvokeStatement : CodeStatement {
+ CodeStatementCollection parameters;
+ CodeStatement targetObject;
+ CodeDelegateInvokeExpression delegateInvoke;
+
+ //
+ // Constructors
+ //
+ public CodeDelegateInvokeStatement ()
+ {
+ }
+
+ public CodeDelegateInvokeStatement (CodeStatement targetObject)
+ {
+ this.targetObject = targetObject;
+ }
+
+ public CodeDelegateInvokeStatement (CodeDelegateInvokeExpression delegateInvoke)
+ {
+ this.delegateInvoke = delegateInvoke;
+ }
+
+ public CodeDelegateInvokeStatement (CodeStatement targetObject,
+ CodeStatement [] parameters)
+ {
+ this.targetObject = targetObject;
+ this.parameters = new CodeStatementCollection ();
+ this.parameters.AddRange (parameters);
+ }
+
+ //
+ // Properties
+ //
+ public CodeDelegateInvokeExpression DelegateInvoke {
+ get {
+ return delegateInvoke;
+ }
+
+ set {
+ delegateInvoke = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeDetachEventStatement.cs b/mcs/class/System/System.CodeDom/CodeDetachEventStatement.cs
new file mode 100755
index 00000000000..5998b73cf2d
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeDetachEventStatement.cs
@@ -0,0 +1,62 @@
+//
+// System.CodeDom CodeDetachEventStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeDetachEventStatement : CodeStatement {
+ string eventName;
+ CodeExpression targetObject, newListener;
+
+ //
+ // Constructors
+ //
+ public CodeDetachEventStatement ()
+ {
+ }
+
+ public CodeDetachEventStatement (CodeExpression targetObject,
+ string eventName,
+ CodeExpression newListener)
+ {
+ this.targetObject = targetObject;
+ this.eventName = eventName;
+ this.newListener = newListener;
+ }
+
+ public string EventName {
+ get {
+ return eventName;
+ }
+
+ set {
+ eventName = value;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+
+ set {
+ targetObject = value;
+ }
+ }
+
+ public CodeExpression NewListener {
+ get {
+ return newListener;
+ }
+
+ set {
+ newListener = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeExpression.cs b/mcs/class/System/System.CodeDom/CodeExpression.cs
new file mode 100755
index 00000000000..0a7e890c718
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeExpression.cs
@@ -0,0 +1,36 @@
+//
+// System.CodeDom CodeExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeExpression : CodeObject {
+ object userData;
+
+ //
+ // Constructors
+ //
+ public CodeExpression ()
+ {
+ }
+
+ //
+ // Properties
+ //
+ public object UserData {
+ get {
+ return userData;
+ }
+
+ set {
+ userData = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeExpressionCollection.cs b/mcs/class/System/System.CodeDom/CodeExpressionCollection.cs
new file mode 100755
index 00000000000..10622c3b0e4
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeExpressionCollection.cs
@@ -0,0 +1,165 @@
+//
+// System.CodeDom CodeExpressionCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ using System.Collections;
+
+ public class CodeExpressionCollection : IList, ICollection, IEnumerable {
+
+ ArrayList expressions;
+
+ //
+ // Constructors
+ //
+ public CodeExpressionCollection ()
+ {
+ expressions = new ArrayList ();
+ }
+
+ //
+ // Properties
+ //
+ public int Count {
+ get {
+ return expressions.Count;
+ }
+ }
+
+ public bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public void Add (CodeExpression value)
+ {
+ expressions.Add (value);
+ }
+
+ public void AddRange (CodeExpression [] values)
+ {
+ foreach (CodeExpression ca in values)
+ expressions.Add (ca);
+
+ }
+
+ public void Clear ()
+ {
+ expressions.Clear ();
+ }
+
+ private class Enumerator : IEnumerator {
+ private CodeExpressionCollection collection;
+ private int currentIndex = -1;
+
+ internal Enumerator (CodeExpressionCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ public object Current {
+ get {
+ if (currentIndex == collection.Count)
+ throw new InvalidOperationException ();
+ return collection [currentIndex];
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (currentIndex > collection.Count)
+ throw new InvalidOperationException ();
+ return ++currentIndex < collection.Count;
+ }
+
+ public void Reset ()
+ {
+ currentIndex = -1;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new CodeExpressionCollection.Enumerator (this);
+ }
+
+ //
+ // IList method implementations
+ //
+ public int Add (object value)
+ {
+ return expressions.Add (value);
+ }
+
+ public bool Contains (Object value)
+ {
+ return expressions.Contains (value);
+ }
+
+ public int IndexOf (Object value)
+ {
+ return expressions.IndexOf (value);
+ }
+
+ public void Insert (int index, Object value)
+ {
+ expressions [index] = value;
+ }
+
+ public object this[int index] {
+ get {
+ return expressions [index];
+ }
+
+ set {
+ expressions [index] = value;
+ }
+ }
+
+ public void Remove (object value)
+ {
+ expressions.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ expressions.RemoveAt (index);
+ }
+
+ //
+ // ICollection method implementations
+ //
+ public void CopyTo (Array array, int index)
+ {
+ expressions.CopyTo (array, index);
+ }
+
+ public object SyncRoot {
+ get {
+ return expressions.SyncRoot;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return expressions.IsSynchronized;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs
new file mode 100755
index 00000000000..7cc7fda7eb1
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeFieldReferenceExpression.cs
@@ -0,0 +1,72 @@
+//
+// System.CodeDom CodeFieldReferenceExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeFieldReferenceExpression : CodeExpression {
+ CodeExpression targetObject;
+ string fieldName;
+ FieldDirection direction;
+
+ public enum FieldDirection {
+ In,
+ Out,
+ Ref
+ }
+
+ //
+ // Constructors
+ //
+ public CodeFieldReferenceExpression ()
+ {
+ }
+
+ public CodeFieldReferenceExpression (CodeExpression targetObject,
+ string fieldName)
+ {
+ this.targetObject = targetObject;
+ this.fieldName = fieldName;
+ }
+
+ //
+ // Properties
+ //
+ public FieldDirection Direction {
+ get {
+ return direction;
+ }
+
+ set {
+ direction = value;
+ }
+ }
+
+ public string FieldName {
+ get {
+ return fieldName;
+ }
+
+ set {
+ fieldName = value;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+
+ set {
+ targetObject = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeForLoopStatement.cs b/mcs/class/System/System.CodeDom/CodeForLoopStatement.cs
new file mode 100755
index 00000000000..c0b0a46ea53
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeForLoopStatement.cs
@@ -0,0 +1,78 @@
+//
+// System.CodeDom CodeForLoopStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeForLoopStatement : CodeExpression {
+ CodeStatement initStatement, incrementStatement;
+ CodeExpression testExpression;
+ CodeStatementCollection statements;
+
+ //
+ // Constructors
+ //
+ public CodeForLoopStatement ()
+ {
+ statements = new CodeStatementCollection ();
+ }
+
+ public CodeForLoopStatement (CodeStatement initStatement,
+ CodeExpression testExpression,
+ CodeStatement incrementStatement,
+ CodeStatement [] statements)
+ {
+ this.initStatement = initStatement;
+ this.testExpression = testExpression;
+ this.incrementStatement = incrementStatement;
+ this.statements = new CodeStatementCollection ();
+ this.statements.AddRange (statements);
+ }
+
+ //
+ // Properties
+ //
+
+ public CodeStatement InitStatement {
+ get {
+ return initStatement;
+ }
+
+ set {
+ initStatement = value;
+ }
+ }
+
+ public CodeStatement IncrementStatement {
+ get {
+ return incrementStatement;
+ }
+
+ set {
+ incrementStatement = value;
+ }
+ }
+
+ public CodeStatementCollection Statements {
+ get {
+ return statements;
+ }
+ }
+
+ public CodeExpression TestExpression {
+ get {
+ return testExpression;
+ }
+
+ set {
+ testExpression = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeIfStatement.cs b/mcs/class/System/System.CodeDom/CodeIfStatement.cs
new file mode 100755
index 00000000000..4ca158416b6
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeIfStatement.cs
@@ -0,0 +1,73 @@
+//
+// System.CodeDom CodeIfStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeIfStatement : CodeStatement {
+
+ CodeExpression condition;
+ CodeStatementCollection trueStatements;
+ CodeStatementCollection falseStatements;
+
+ //
+ // Constructors
+ //
+ public CodeIfStatement ()
+ {
+ trueStatements = new CodeStatementCollection ();
+ falseStatements = new CodeStatementCollection ();
+ }
+
+ public CodeIfStatement (CodeExpression condition, CodeStatement [] trueStatements)
+ {
+ this.condition = condition;
+ this.trueStatements = new CodeStatementCollection ();
+ this.trueStatements.AddRange (trueStatements);
+ this.falseStatements = new CodeStatementCollection ();
+ }
+
+ public CodeIfStatement (CodeExpression condition,
+ CodeStatement [] trueStatements,
+ CodeStatement [] falseStatements)
+ {
+ this.condition = condition;
+
+ this.trueStatements = new CodeStatementCollection ();
+ this.trueStatements.AddRange (trueStatements);
+
+ this.falseStatements = new CodeStatementCollection ();
+ this.falseStatements.AddRange (falseStatements);
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression Condition {
+ get {
+ return condition;
+ }
+
+ set {
+ condition = value;
+ }
+ }
+
+ public CodeStatementCollection FalseStatements {
+ get {
+ return falseStatements;
+ }
+ }
+
+ public CodeStatementCollection TrueStatements {
+ get {
+ return trueStatements;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeIndexerExpression.cs b/mcs/class/System/System.CodeDom/CodeIndexerExpression.cs
new file mode 100755
index 00000000000..a20ed674713
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeIndexerExpression.cs
@@ -0,0 +1,35 @@
+//
+// System.CodeDom CodeFieldReferenceExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeIndexerExpression : CodeExpression {
+ CodeExpression targetObject;
+ CodeExpression index;
+
+ //
+ // Constructors
+ //
+ public CodeIndexerExpression ()
+ {
+ }
+
+ public CodeIndexerExpression (CodeExpression targetObject, CodeExpression index)
+ {
+ this.index = index;
+ this.targetObject = targetObject;
+ }
+
+ //
+ // Properties
+ //
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeLinePragma.cs b/mcs/class/System/System.CodeDom/CodeLinePragma.cs
new file mode 100755
index 00000000000..4240e65b63f
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeLinePragma.cs
@@ -0,0 +1,51 @@
+//
+// System.CodeDom CodeLinePragma Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+using System;
+
+namespace System.CodeDom {
+
+ // <summary>
+ // Use objects of this class to keep track of locations where
+ // statements are defined
+ // </summary>
+ [Serializable]
+ public class CodeLinePragma {
+ string fileName;
+ int lineNumber;
+
+ public CodeLinePragma (string fileName, int lineNumber)
+ {
+ this.fileName = fileName;
+ this.lineNumber = lineNumber;
+ }
+
+ //
+ // Properties
+ //
+ public string FileName {
+ get {
+ return fileName;
+ }
+
+ set {
+ fileName = value;
+ }
+ }
+
+ public int LineNumber {
+ get {
+ return lineNumber;
+ }
+
+ set {
+ lineNumber = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeLiteralClassMember.cs b/mcs/class/System/System.CodeDom/CodeLiteralClassMember.cs
new file mode 100755
index 00000000000..0733b786a7f
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeLiteralClassMember.cs
@@ -0,0 +1,40 @@
+//
+// System.CodeDom CodeLiteralClassMember Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeLiteralClassMember : CodeClassMember {
+ string text;
+
+ //
+ // Constructors
+ //
+ public CodeLiteralClassMember ()
+ {
+ }
+
+ public CodeLiteralClassMember (string text)
+ {
+ this.text = text;
+ }
+
+ //
+ // Properties
+ //
+ string Text {
+ get {
+ return text;
+ }
+
+ set {
+ text = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeLiteralExpression.cs b/mcs/class/System/System.CodeDom/CodeLiteralExpression.cs
new file mode 100755
index 00000000000..36ca6908b2c
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeLiteralExpression.cs
@@ -0,0 +1,40 @@
+//
+// System.CodeDom CodeLiteralExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeLiteralExpression : CodeExpression {
+ string val;
+
+ //
+ // Constructors
+ //
+ public CodeLiteralExpression ()
+ {
+ }
+
+ public CodeLiteralExpression (string value)
+ {
+ val = value;
+ }
+
+ //
+ // Properties
+ //
+ string Value {
+ get {
+ return val;
+ }
+
+ set {
+ val = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeLiteralNamespace.cs b/mcs/class/System/System.CodeDom/CodeLiteralNamespace.cs
new file mode 100755
index 00000000000..7cbf4c46b9e
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeLiteralNamespace.cs
@@ -0,0 +1,48 @@
+//
+// System.CodeDom CodeLiteralNamespace Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeLiteralNamespace : CodeNamespace {
+ CodeLinePragma linePragma;
+ string value;
+
+ //
+ // Constructors
+ //
+ public CodeLiteralNamespace (string value)
+ {
+ this.value = value;
+ }
+
+ //
+ // Properties
+ //
+ string Value {
+ get {
+ return value;
+ }
+
+ set {
+ this.value = value;
+ }
+ }
+
+ CodeLinePragma LinePragma {
+ get {
+ return linePragma;
+ }
+
+ set {
+ linePragma = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeLiteralStatement.cs b/mcs/class/System/System.CodeDom/CodeLiteralStatement.cs
new file mode 100755
index 00000000000..63e1fec6bbb
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeLiteralStatement.cs
@@ -0,0 +1,36 @@
+//
+// System.CodeDom CodeLiteralStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeLiteralStatement : CodeStatement {
+ string value;
+
+ //
+ // Constructors
+ //
+ public CodeLiteralStatement (string value)
+ {
+ this.value = value;
+ }
+
+ //
+ // Properties
+ //
+ string Value {
+ get {
+ return value;
+ }
+
+ set {
+ this.value = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMemberEvent.cs b/mcs/class/System/System.CodeDom/CodeMemberEvent.cs
new file mode 100755
index 00000000000..7be21795c97
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMemberEvent.cs
@@ -0,0 +1,51 @@
+//
+// System.CodeDom CodeMemberEvent Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeMemberEvent : CodeTypeMember {
+ string implementsType, type;
+ bool privateImplements;
+
+ public CodeMemberEvent ()
+ {
+ }
+
+ public string ImplementsType {
+ get {
+ return implementsType;
+ }
+
+ set {
+ implementsType = value;
+ }
+ }
+
+ public bool PrivateImplements {
+ get {
+ return privateImplements;
+ }
+
+ set {
+ privateImplements = value;
+ }
+ }
+
+ public string Type {
+ get {
+ return type;
+ }
+
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMemberField.cs b/mcs/class/System/System.CodeDom/CodeMemberField.cs
new file mode 100755
index 00000000000..ac8b1d3ab79
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMemberField.cs
@@ -0,0 +1,49 @@
+//
+// System.CodeDom CodeMemberField Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeMemberField : CodeClassMember {
+ CodeExpression initExpression;
+ string type, name;
+
+ public CodeMemberField ()
+ {
+ }
+
+ public CodeMemberField (string type, string name)
+ {
+ this.type = type;
+ this.name = name;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpression InitExpression {
+ get {
+ return initExpression;
+ }
+
+ set {
+ initExpression = value;
+ }
+ }
+
+ public string Type {
+ get {
+ return type;
+ }
+
+ set {
+ type = name;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMemberMethod.cs b/mcs/class/System/System.CodeDom/CodeMemberMethod.cs
new file mode 100755
index 00000000000..e3631ae42f9
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMemberMethod.cs
@@ -0,0 +1,74 @@
+//
+// System.CodeDom CodeMemberMethod Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeMemberMethod : CodeTypeMember {
+ CodeParameterDeclarationExpressionCollection parameters;
+ CodeStatementCollection statements;
+ string implementsType;
+ string returnType;
+ bool privateImplements;
+
+ public CodeMemberMethod ()
+ {
+ }
+
+ public string ImplementsType {
+ get {
+ return implementsType;
+ }
+
+ set {
+ implementsType = value;
+ }
+ }
+
+ public bool PrivateImplements {
+ get {
+ return privateImplements;
+ }
+
+ set {
+ privateImplements = value;
+ }
+ }
+
+ public string ReturnType {
+ get {
+ return returnType;
+ }
+
+ set {
+ returnType = value;
+ }
+ }
+
+ public CodeParameterDeclarationExpressionCollection Parameters {
+ get {
+ return parameters;
+ }
+
+ set {
+ parameters = value;
+ }
+ }
+
+ public CodeStatementCollection Statements {
+ get {
+ return statements;
+ }
+
+ set {
+ statements = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMemberProperty.cs b/mcs/class/System/System.CodeDom/CodeMemberProperty.cs
new file mode 100755
index 00000000000..79b3d897f5b
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMemberProperty.cs
@@ -0,0 +1,109 @@
+//
+// System.CodeDom CodeMemberProperty Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeMemberProperty : CodeTypeMember {
+ CodeParameterDeclarationExpressionCollection parameters;
+ CodeStatementCollection getStatements, setStatements;
+ bool hasGet, hasSet;
+ string implementsType, type;
+ bool privateImplements;
+
+ public CodeMemberProperty ()
+ {
+ }
+
+ //
+ // Properties
+ //
+
+ public string ImplementsType {
+ get {
+ return implementsType;
+ }
+
+ set {
+ implementsType = value;
+ }
+ }
+
+ public bool PrivateImplements {
+ get {
+ return privateImplements;
+ }
+
+ set {
+ privateImplements = value;
+ }
+ }
+
+ public CodeParameterDeclarationExpressionCollection Parameters {
+ get {
+ return parameters;
+ }
+
+ set {
+ parameters = value;
+ }
+ }
+
+ public CodeStatementCollection SetStatements {
+ get {
+ return setStatements;
+ }
+
+ set {
+ setStatements = value;
+ }
+ }
+
+ public CodeStatementCollection GetStatements {
+ get {
+ return getStatements;
+ }
+
+ set {
+ getStatements = value;
+ }
+ }
+
+ public string Type {
+ get {
+ return type;
+ }
+
+ set {
+ type = value;
+ }
+ }
+
+ public bool HasGet {
+ get {
+ return hasGet;
+ }
+
+ set {
+ hasGet = value;
+ }
+ }
+
+ public bool HasSet {
+ get {
+ return hasSet;
+ }
+
+ set {
+ hasSet = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs b/mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs
new file mode 100755
index 00000000000..3d31ade2d76
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMethodInvokeExpression.cs
@@ -0,0 +1,69 @@
+//
+// System.CodeDom CodeMethodInvokeExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeMethodInvokeExpression : CodeExpression {
+ string methodName;
+ CodeExpression targetObject;
+ CodeExpressionCollection parameters;
+
+ //
+ // Constructors
+ //
+ public CodeMethodInvokeExpression () {}
+
+ public CodeMethodInvokeExpression (CodeExpression targetObject, string methodName)
+ {
+ this.targetObject = targetObject;
+ this.methodName = methodName;
+ }
+
+ public CodeMethodInvokeExpression (CodeExpression targetObject,
+ string methodName,
+ CodeExpression [] parameters)
+ {
+ this.targetObject = targetObject;
+ this.methodName = methodName;
+ this.parameters = new CodeExpressionCollection ();
+ this.parameters.AddRange (parameters);
+ }
+
+ public string MethodName {
+ get {
+ return methodName;
+ }
+
+ set {
+ methodName = value;
+ }
+ }
+
+ public CodeExpressionCollection Parameters {
+ get {
+ return parameters;
+ }
+
+ set {
+ parameters = value;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMethodInvokeStatement.cs b/mcs/class/System/System.CodeDom/CodeMethodInvokeStatement.cs
new file mode 100755
index 00000000000..519e4164ad5
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMethodInvokeStatement.cs
@@ -0,0 +1,84 @@
+//
+// System.CodeDom CodeMethodInvokeStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ public class CodeMethodInvokeStatement : CodeStatement {
+ string methodName;
+ CodeExpression targetObject;
+ CodeExpressionCollection parameters;
+ CodeMethodInvokeExpression methodInvoke;
+
+ //
+ // Constructors
+ //
+ public CodeMethodInvokeStatement () {}
+
+ public CodeMethodInvokeStatement (CodeMethodInvokeExpression methodInvoke)
+ {
+ this.methodInvoke = methodInvoke;
+ }
+
+ public CodeMethodInvokeStatement (CodeExpression targetObject, string methodName)
+ {
+ this.targetObject = targetObject;
+ this.methodName = methodName;
+ }
+
+ public CodeMethodInvokeStatement (CodeExpression targetObject,
+ string methodName,
+ CodeExpression [] parameters)
+ {
+ this.targetObject = targetObject;
+ this.methodName = methodName;
+ this.parameters = new CodeExpressionCollection ();
+ this.parameters.AddRange (parameters);
+ }
+
+ public string MethodName {
+ get {
+ return methodName;
+ }
+
+ set {
+ methodName = value;
+ }
+ }
+
+ public CodeExpressionCollection Parameters {
+ get {
+ return parameters;
+ }
+
+ set {
+ parameters = value;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+
+ set {
+ targetObject = value;
+ }
+ }
+
+ public CodeMethodInvokeExpression MethodInvoke {
+ get {
+ return methodInvoke;
+ }
+
+ set {
+ methodInvoke = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs b/mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs
new file mode 100755
index 00000000000..e54e605fa54
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeMethodReturnStatement.cs
@@ -0,0 +1,15 @@
+//
+// System.CodeDom CodeMethodReturnStatement class implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom
+{
+ public class CodeMethodReturnStatement : CodeStatement
+ {
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeNamespace.cs b/mcs/class/System/System.CodeDom/CodeNamespace.cs
new file mode 100755
index 00000000000..53844097a64
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeNamespace.cs
@@ -0,0 +1,93 @@
+//
+// System.CodeDom CodeNamespace Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeNamespace : CodeObject {
+ CodeClassCollection classes;
+ CodeNamespaceImportCollection imports;
+ bool allowLateBound, requireVariableDeclaration;
+ string name;
+ object userData;
+
+ public CodeNamespace ()
+ {
+ }
+
+ public CodeNamespace (string name)
+ {
+ this.name = name;
+ }
+
+ //
+ // Properties
+ //
+
+ public bool AllowLateBound {
+ get {
+ return allowLateBound;
+ }
+
+ set {
+ allowLateBound = value;
+ }
+ }
+
+ public CodeClassCollection Classes {
+ get {
+ return classes;
+ }
+
+ set {
+ classes = value;
+ }
+ }
+
+ public CodeNamespaceImportCollection Imports {
+ get {
+ return imports;
+ }
+
+ set {
+ imports = value;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+
+ set {
+ name = value;
+ }
+ }
+
+ public bool RequireVariableDeclaration {
+ get {
+ return requireVariableDeclaration;
+ }
+
+ set {
+ requireVariableDeclaration = value;
+ }
+ }
+
+ public object UserData {
+ get {
+ return userData;
+ }
+
+ set {
+ userData = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeNamespaceImport.cs b/mcs/class/System/System.CodeDom/CodeNamespaceImport.cs
new file mode 100755
index 00000000000..2f93de1a2f0
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeNamespaceImport.cs
@@ -0,0 +1,37 @@
+//
+// System.CodeDom CodeNamespaceImport Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeNamespaceImport : CodeObject {
+ string nameSpace;
+
+ public CodeNamespaceImport () {}
+
+ public CodeNamespaceImport (string nameSpace)
+ {
+ this.nameSpace = nameSpace;
+ }
+
+ //
+ // Properties
+ //
+
+ public string Namespace {
+ get {
+ return nameSpace;
+ }
+
+ set {
+ nameSpace = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeNamespaceImportCollection.cs b/mcs/class/System/System.CodeDom/CodeNamespaceImportCollection.cs
new file mode 100755
index 00000000000..b86cd19fa42
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeNamespaceImportCollection.cs
@@ -0,0 +1,166 @@
+//
+// System.CodeDom CodeNamespaceImportCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ using System.Collections;
+
+ [Serializable]
+ public class CodeNamespaceImportCollection : IList, ICollection, IEnumerable {
+
+ ArrayList namespaceImports;
+
+ //
+ // Constructors
+ //
+ public CodeNamespaceImportCollection ()
+ {
+ namespaceImports = new ArrayList ();
+ }
+
+ //
+ // Properties
+ //
+ public int Count {
+ get {
+ return namespaceImports.Count;
+ }
+ }
+
+ public bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public void Add (CodeNamespaceImport value)
+ {
+ namespaceImports.Add (value);
+ }
+
+ public void AddRange (CodeNamespaceImport [] values)
+ {
+ foreach (CodeNamespaceImport ca in values)
+ namespaceImports.Add (ca);
+
+ }
+
+ public void Clear ()
+ {
+ namespaceImports.Clear ();
+ }
+
+ private class Enumerator : IEnumerator {
+ private CodeNamespaceImportCollection collection;
+ private int currentIndex = -1;
+
+ internal Enumerator (CodeNamespaceImportCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ public object Current {
+ get {
+ if (currentIndex == collection.Count)
+ throw new InvalidOperationException ();
+ return collection [currentIndex];
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (currentIndex > collection.Count)
+ throw new InvalidOperationException ();
+ return ++currentIndex < collection.Count;
+ }
+
+ public void Reset ()
+ {
+ currentIndex = -1;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new CodeNamespaceImportCollection.Enumerator (this);
+ }
+
+ //
+ // IList method implementations
+ //
+ public int Add (object value)
+ {
+ return namespaceImports.Add (value);
+ }
+
+ public bool Contains (Object value)
+ {
+ return namespaceImports.Contains (value);
+ }
+
+ public int IndexOf (Object value)
+ {
+ return namespaceImports.IndexOf (value);
+ }
+
+ public void Insert (int index, Object value)
+ {
+ namespaceImports [index] = value;
+ }
+
+ public object this[int index] {
+ get {
+ return namespaceImports [index];
+ }
+
+ set {
+ namespaceImports [index] = value;
+ }
+ }
+
+ public void Remove (object value)
+ {
+ namespaceImports.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ namespaceImports.RemoveAt (index);
+ }
+
+ //
+ // ICollection method implementations
+ //
+ public void CopyTo (Array array, int index)
+ {
+ namespaceImports.CopyTo (array, index);
+ }
+
+ public object SyncRoot {
+ get {
+ return namespaceImports.SyncRoot;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return namespaceImports.IsSynchronized;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeObject.cs b/mcs/class/System/System.CodeDom/CodeObject.cs
new file mode 100755
index 00000000000..28320578b0a
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeObject.cs
@@ -0,0 +1,16 @@
+//
+// System.CodeDom CodeObject class implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom
+{
+ [Serializable]
+ public class CodeObject
+ {
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs b/mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs
new file mode 100755
index 00000000000..b144c887836
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeObjectCreateExpression.cs
@@ -0,0 +1,55 @@
+//
+// System.CodeDom CodeObjectCreateExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeObjectCreateExpression : CodeExpression {
+ string createType;
+ CodeExpressionCollection parameters;
+
+ public CodeObjectCreateExpression () {}
+
+ public CodeObjectCreateExpression (string createType)
+ {
+ this.createType = createType;
+ }
+
+ public CodeObjectCreateExpression (string createType, CodeExpression [] parameters)
+ {
+ this.createType = createType;
+ this.parameters = new CodeExpressionCollection ();
+ this.parameters.AddRange (parameters);
+ }
+
+ //
+ // Properties
+ //
+ public string CreateType {
+ get {
+ return createType;
+ }
+
+ set {
+ createType = value;
+ }
+ }
+
+ public CodeExpressionCollection Parameters {
+ get {
+ return parameters;
+ }
+
+ set {
+ parameters = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs b/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs
new file mode 100755
index 00000000000..4db95319dbf
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpression.cs
@@ -0,0 +1,69 @@
+//
+// System.CodeDom CodeParameterDeclarationExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeParameterDeclarationExpression : CodeExpression {
+ FieldDirection direction;
+ CodeAttributeBlock customAttributes;
+ string type, name;
+
+ public CodeParameterDeclarationExpression ()
+ {
+ }
+
+ public CodeParameterDeclarationExpression (string type, string name)
+ {
+ this.type = type;
+ this.name = name;
+ }
+
+ public string Type {
+ get {
+ return type;
+ }
+
+ set {
+ type = value;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+
+ set {
+ name = value;
+ }
+ }
+
+ public CodeAttributeBlock CustomAttributes {
+ get {
+ return customAttributes;
+ }
+
+ set {
+ customAttributes = value;
+ }
+ }
+
+ public FieldDirection Direction {
+ get {
+ return direction;
+ }
+
+ set {
+ direction = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs b/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs
new file mode 100755
index 00000000000..713c3ed7da3
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeParameterDeclarationExpressionCollection.cs
@@ -0,0 +1,166 @@
+//
+// System.CodeDom CodeParameterDeclarationExpressionCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ using System.Collections;
+
+ [Serializable]
+ public class CodeParameterDeclarationExpressionCollection : IList, ICollection, IEnumerable {
+
+ ArrayList parameterDeclExprs;
+
+ //
+ // Constructors
+ //
+ public CodeParameterDeclarationExpressionCollection ()
+ {
+ parameterDeclExprs = new ArrayList ();
+ }
+
+ //
+ // Properties
+ //
+ public int Count {
+ get {
+ return parameterDeclExprs.Count;
+ }
+ }
+
+ public bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public void Add (CodeParameterDeclarationExpression value)
+ {
+ parameterDeclExprs.Add (value);
+ }
+
+ public void AddRange (CodeParameterDeclarationExpression [] values)
+ {
+ foreach (CodeParameterDeclarationExpression ca in values)
+ parameterDeclExprs.Add (ca);
+
+ }
+
+ public void Clear ()
+ {
+ parameterDeclExprs.Clear ();
+ }
+
+ private class Enumerator : IEnumerator {
+ private CodeParameterDeclarationExpressionCollection collection;
+ private int currentIndex = -1;
+
+ internal Enumerator (CodeParameterDeclarationExpressionCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ public object Current {
+ get {
+ if (currentIndex == collection.Count)
+ throw new InvalidOperationException ();
+ return collection [currentIndex];
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (currentIndex > collection.Count)
+ throw new InvalidOperationException ();
+ return ++currentIndex < collection.Count;
+ }
+
+ public void Reset ()
+ {
+ currentIndex = -1;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new CodeParameterDeclarationExpressionCollection.Enumerator (this);
+ }
+
+ //
+ // IList method implementations
+ //
+ public int Add (object value)
+ {
+ return parameterDeclExprs.Add (value);
+ }
+
+ public bool Contains (Object value)
+ {
+ return parameterDeclExprs.Contains (value);
+ }
+
+ public int IndexOf (Object value)
+ {
+ return parameterDeclExprs.IndexOf (value);
+ }
+
+ public void Insert (int index, Object value)
+ {
+ parameterDeclExprs [index] = value;
+ }
+
+ public object this[int index] {
+ get {
+ return parameterDeclExprs [index];
+ }
+
+ set {
+ parameterDeclExprs [index] = value;
+ }
+ }
+
+ public void Remove (object value)
+ {
+ parameterDeclExprs.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ parameterDeclExprs.RemoveAt (index);
+ }
+
+ //
+ // ICollection method implementations
+ //
+ public void CopyTo (Array array, int index)
+ {
+ parameterDeclExprs.CopyTo (array, index);
+ }
+
+ public object SyncRoot {
+ get {
+ return parameterDeclExprs.SyncRoot;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return parameterDeclExprs.IsSynchronized;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs b/mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs
new file mode 100755
index 00000000000..ace039075e7
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodePrimitiveExpression.cs
@@ -0,0 +1,34 @@
+//
+// System.CodeDom CodePrimitiveExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodePrimitiveExpression : CodeExpression {
+ object value;
+
+ public CodePrimitiveExpression () {}
+
+ public CodePrimitiveExpression (Object value)
+ {
+ this.value = value;
+ }
+
+ public object Value {
+ get {
+ return value;
+ }
+
+ set {
+ this.value = value;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs
new file mode 100755
index 00000000000..bcaf37ac1ec
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodePropertyReferenceExpression.cs
@@ -0,0 +1,60 @@
+//
+// System.CodeDom CodePropertyReferenceExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodePropertyReferenceExpression : CodeExpression {
+ CodeExpressionCollection parameters;
+ CodeExpression targetObject;
+ string propertyName;
+
+ public CodePropertyReferenceExpression () {}
+
+ public CodePropertyReferenceExpression (CodeExpression targetObject,
+ string propertyName)
+ {
+ this.targetObject = targetObject;
+ this.propertyName = propertyName;
+ }
+
+ //
+ // Properties
+ //
+ public CodeExpressionCollection Parameter {
+ get {
+ return parameters;
+ }
+
+ set {
+ parameters = value;
+ }
+ }
+
+ public string PropertyName {
+ get {
+ return propertyName;
+ }
+
+ set {
+ propertyName = value;
+ }
+ }
+
+ public CodeExpression TargetObject {
+ get {
+ return targetObject;
+ }
+
+ set {
+ targetObject = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeStatement.cs b/mcs/class/System/System.CodeDom/CodeStatement.cs
new file mode 100755
index 00000000000..eef55f21615
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeStatement.cs
@@ -0,0 +1,16 @@
+//
+// System.CodeDom CodeStatement class implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom
+{
+ [Serializable]
+ public class CodeStatement : CodeObject
+ {
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeStatementCollection.cs b/mcs/class/System/System.CodeDom/CodeStatementCollection.cs
new file mode 100755
index 00000000000..dfa24764acb
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeStatementCollection.cs
@@ -0,0 +1,166 @@
+//
+// System.CodeDom CodeStatementCollection Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ using System.Collections;
+
+ [Serializable]
+ public class CodeStatementCollection : IList, ICollection, IEnumerable {
+
+ ArrayList statements;
+
+ //
+ // Constructors
+ //
+ public CodeStatementCollection ()
+ {
+ statements = new ArrayList ();
+ }
+
+ //
+ // Properties
+ //
+ public int Count {
+ get {
+ return statements.Count;
+ }
+ }
+
+ public bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ //
+ // Methods
+ //
+ public void Add (CodeStatement value)
+ {
+ statements.Add (value);
+ }
+
+ public void AddRange (CodeStatement [] values)
+ {
+ foreach (CodeStatement ca in values)
+ statements.Add (ca);
+
+ }
+
+ public void Clear ()
+ {
+ statements.Clear ();
+ }
+
+ private class Enumerator : IEnumerator {
+ private CodeStatementCollection collection;
+ private int currentIndex = -1;
+
+ internal Enumerator (CodeStatementCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ public object Current {
+ get {
+ if (currentIndex == collection.Count)
+ throw new InvalidOperationException ();
+ return collection [currentIndex];
+ }
+ }
+
+ public bool MoveNext ()
+ {
+ if (currentIndex > collection.Count)
+ throw new InvalidOperationException ();
+ return ++currentIndex < collection.Count;
+ }
+
+ public void Reset ()
+ {
+ currentIndex = -1;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return new CodeStatementCollection.Enumerator (this);
+ }
+
+ //
+ // IList method implementations
+ //
+ public int Add (object value)
+ {
+ return statements.Add (value);
+ }
+
+ public bool Contains (Object value)
+ {
+ return statements.Contains (value);
+ }
+
+ public int IndexOf (Object value)
+ {
+ return statements.IndexOf (value);
+ }
+
+ public void Insert (int index, Object value)
+ {
+ statements [index] = value;
+ }
+
+ public object this[int index] {
+ get {
+ return statements [index];
+ }
+
+ set {
+ statements [index] = value;
+ }
+ }
+
+ public void Remove (object value)
+ {
+ statements.Remove (value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ statements.RemoveAt (index);
+ }
+
+ //
+ // ICollection method implementations
+ //
+ public void CopyTo (Array array, int index)
+ {
+ statements.CopyTo (array, index);
+ }
+
+ public object SyncRoot {
+ get {
+ return statements.SyncRoot;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized {
+ get {
+ return statements.IsSynchronized;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs
new file mode 100755
index 00000000000..65d60718136
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeThisReferenceExpression.cs
@@ -0,0 +1,17 @@
+//
+// System.CodeDom CodeParameterDeclarationExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeThisReferenceExpression : CodeExpression {
+ public CodeThisReferenceExpression () { }
+ }
+}
+
diff --git a/mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs b/mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs
new file mode 100755
index 00000000000..49638514a0c
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeThrowExceptionStatement.cs
@@ -0,0 +1,32 @@
+//
+// System.CodeDom CodeThrowExceptionStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeThrowExceptionStatement : CodeStatement {
+ CodeExpression toThrow;
+
+ public CodeThrowExceptionStatement () {}
+ public CodeThrowExceptionStatement (CodeExpression toThrow)
+ {
+ this.toThrow = toThrow;
+ }
+
+ public CodeExpression ToThrow {
+ get {
+ return toThrow;
+ }
+
+ set {
+ toThrow = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs b/mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs
new file mode 100755
index 00000000000..d0a9e74fec2
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTryCatchFinallyStatement.cs
@@ -0,0 +1,71 @@
+//
+// System.CodeDom CodeTryCatchFinallyStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeTryCatchFinallyStatement : CodeStatement {
+ CodeStatementCollection tryStatements, finallyStatements;
+ CodeCatchClauseCollection catchClauses;
+
+ public CodeTryCatchFinallyStatement () {}
+
+ public CodeTryCatchFinallyStatement (CodeStatement [] tryStatements,
+ CodeCatchClause [] catchClauses)
+ {
+ this.tryStatements = new CodeStatementCollection ();
+ this.catchClauses = new CodeCatchClauseCollection ();
+
+ this.tryStatements.AddRange (tryStatements);
+ this.catchClauses.AddRange (catchClauses);
+ }
+
+ public CodeTryCatchFinallyStatement (CodeStatement [] tryStatements,
+ CodeCatchClause [] catchClauses,
+ CodeStatement [] finallyStatements)
+ {
+ this.tryStatements = new CodeStatementCollection ();
+ this.catchClauses = new CodeCatchClauseCollection ();
+ this.finallyStatements = new CodeStatementCollection ();
+
+ this.tryStatements.AddRange (tryStatements);
+ this.catchClauses.AddRange (catchClauses);
+ this.finallyStatements.AddRange (finallyStatements);
+ }
+
+ public CodeStatementCollection FinallyStatements{
+ get {
+ return finallyStatements;
+ }
+
+ set {
+ finallyStatements = value;
+ }
+ }
+
+ public CodeStatementCollection TryStatements {
+ get {
+ return tryStatements;
+ }
+
+ set {
+ tryStatements = value;
+ }
+ }
+ public CodeCatchClauseCollection CatchClauses {
+ get {
+ return catchClauses;
+ }
+
+ set {
+ catchClauses = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs b/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs
new file mode 100755
index 00000000000..ce4a24db776
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeDeclaration.cs
@@ -0,0 +1,16 @@
+//
+// System.CodeDom CodeTypeDeclaration Class implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom
+{
+ [Serializable]
+ public class CodeTypeDeclaration : CodeTypeMember
+ {
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeMember.cs b/mcs/class/System/System.CodeDom/CodeTypeMember.cs
new file mode 100755
index 00000000000..fefc6ce4e1b
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeMember.cs
@@ -0,0 +1,25 @@
+//
+// System.CodeDom CodeTypeMember Class implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom
+{
+ [Serializable]
+ public class CodeTypeMember : CodeObject {
+ private string name;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs b/mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs
new file mode 100755
index 00000000000..2de1561244c
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeOfExpression.cs
@@ -0,0 +1,33 @@
+//
+// System.CodeDom CodeTypeOfExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeTypeOfExpression : CodeExpression {
+ string type;
+
+ public CodeTypeOfExpression () {}
+
+ public CodeTypeOfExpression (string type)
+ {
+ this.type = type;
+ }
+
+ public string Type {
+ get {
+ return type;
+ }
+
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs b/mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs
new file mode 100755
index 00000000000..3fdb568e292
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeTypeReferenceExpression.cs
@@ -0,0 +1,33 @@
+//
+// System.CodeDom CodeTypeReferenceExpression Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeTypeReferenceExpression : CodeExpression {
+ string type;
+
+ public CodeTypeReferenceExpression () {}
+
+ public CodeTypeReferenceExpression (string type)
+ {
+ this.type = type;
+ }
+
+ public string Type {
+ get {
+ return type;
+ }
+
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs b/mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs
new file mode 100755
index 00000000000..497f5e664a3
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/CodeVariableDeclarationStatement.cs
@@ -0,0 +1,63 @@
+//
+// System.CodeDom CodeVariableDeclarationStatement Class implementation
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+
+ [Serializable]
+ public class CodeVariableDeclarationStatement : CodeStatement {
+ CodeExpression initExpression;
+ string type, name;
+
+ public CodeVariableDeclarationStatement () {}
+
+ public CodeVariableDeclarationStatement (string type, string name)
+ {
+ this.type = type;
+ this.name = name;
+ }
+
+ public CodeVariableDeclarationStatement (string type, string name,
+ CodeExpression initExpression)
+ {
+ this.type = type;
+ this.name = name;
+ this.initExpression = initExpression;
+ }
+
+ public CodeExpression InitExpression {
+ get {
+ return initExpression;
+ }
+
+ set {
+ initExpression = value;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+
+ set {
+ name = value;
+ }
+ }
+
+ public string Type {
+ get {
+ return type;
+ }
+
+ set {
+ type = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/FieldDirection.cs b/mcs/class/System/System.CodeDom/FieldDirection.cs
new file mode 100755
index 00000000000..669bf377c4a
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/FieldDirection.cs
@@ -0,0 +1,14 @@
+//
+// System.CodeDom FieldDirection Enum implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+ public enum FieldDirection {
+ In, Out, Ref
+ }
+}
diff --git a/mcs/class/System/System.CodeDom/MemberAttributes.cs b/mcs/class/System/System.CodeDom/MemberAttributes.cs
new file mode 100755
index 00000000000..d851f92f5d6
--- /dev/null
+++ b/mcs/class/System/System.CodeDom/MemberAttributes.cs
@@ -0,0 +1,29 @@
+//
+// System.CodeDom MemberAttributes Enum implementation
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+namespace System.CodeDom {
+ public enum MemberAttributes {
+ Abstract,
+ AccessMask,
+ Assembly,
+ Const,
+ Family,
+ FamilyAndAssembly,
+ FamilyOrAssembly,
+ Final,
+ New,
+ Overloaded,
+ Override,
+ Private,
+ Public,
+ ScopeMask,
+ Static,
+ VTableMask
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/BitVector32.cs b/mcs/class/System/System.Collections.Specialized/BitVector32.cs
new file mode 100644
index 00000000000..e176a220f8c
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/BitVector32.cs
@@ -0,0 +1,68 @@
+//
+// System.Collections.Specialized.BitVector32.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Collections.Specialized {
+
+ public struct BitVector32 {
+ int value;
+
+ public struct Section {
+ public short maxval;
+ }
+
+ [MonoTODO]
+ public static Section CreateSection (short maxval)
+ {
+ Section s = new Section();
+
+ // FIXME: Imeplemtn me
+
+ return s;
+ }
+
+ public static int CreateMask ()
+ {
+ return 1;
+ }
+
+ public static int CreateMask (int prev)
+ {
+ return prev << 1;
+ }
+
+ public BitVector32 (BitVector32 source)
+ {
+ value = source.value;
+ }
+
+ public BitVector32 (int init)
+ {
+ value = init;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is BitVector32))
+ return false;
+
+ return value == ((BitVector32) o).value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return 0;
+ }
+
+ public int Data {
+ get {
+ return value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/ChangeLog b/mcs/class/System/System.Collections.Specialized/ChangeLog
new file mode 100755
index 00000000000..e582af13fa2
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/ChangeLog
@@ -0,0 +1,41 @@
+
+Fri Feb 8 18:02:50 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * NameObjectCollectionBase.cs, NameValueCollection.cs: tweaks to make
+ it compile and provide the constructor needed by nunitcore.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * BitVector32.cs, ListDictionary.cs : MonoTODO everywhere!
+
+ * NameObjectCollectionBase.cs, NameValueCollection.cs : Ditto.
+
+2001-08-24 Nick Drochak <ndrochak@gol.com>
+ * NameObjectCollectionBase.cs: Add stub implementation
+ * common.src: Add NameObjectCollectionBase to the build
+ * NameValueCollection.cs: add 'override' to CopyTo(). Maybe
+ this code actually belongs in the superclass.
+
+2001-08-24 Miguel de Icaza <miguel@ximian.com>
+
+ * common.src: Add NameValueCollection.cs to the build
+
+2001-08-22 John Barnette <jbarn@httcb.net>
+ * StringDictionary.cs:
+ Initial working implementation.
+ * ListDictionary.cs:
+ Initial working implementation.
+
+2001-07-17 John Barnette <jbarn@httcb.net>
+ * StringCollection.cs:
+ Implemented and working according to spec.
+ * StringIterator.cs:
+ (ADDED) Implemented and working according to spec.
+ * StringCollectionTest.cs:
+ (ADDED) Initial revision contains 17 tests; all of 'em
+ run correctly. More complicated tests to follow.
+
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * StringCollection.cs: Added so that CodeDom.* would compile.
+
diff --git a/mcs/class/System/System.Collections.Specialized/ListDictionary.cs b/mcs/class/System/System.Collections.Specialized/ListDictionary.cs
new file mode 100644
index 00000000000..2dfef87da8a
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/ListDictionary.cs
@@ -0,0 +1,435 @@
+namespace System.Collections.Specialized
+{
+ [Serializable]
+ public class ListDictionary : IDictionary, ICollection, IEnumerable
+ {
+ private int count;
+ private int modCount;
+ private ListEntry root;
+ private IComparer comparer;
+
+
+ public ListDictionary()
+ {
+ count = 0;
+ modCount = 0;
+ comparer = null;
+ root = null;
+ }
+
+ public ListDictionary(IComparer comparer) : this()
+ {
+ this.comparer = comparer;
+ }
+
+ private bool AreEqual(object obj1, object obj2)
+ {
+ if (comparer != null) {
+ if (comparer.Compare(obj1, obj2) == 0) {
+ return true;
+ }
+ } else {
+ if (obj1.Equals(obj2)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private ListEntry FindEntry(object key)
+ {
+ if (key == null) {
+ throw new ArgumentNullException("Attempted lookup for a null key.");
+ }
+
+ if (root == null) {
+ return null;
+ } else {
+ ListEntry entry = root;
+
+ while (entry != null) {
+ if (AreEqual(key, entry.key)) {
+ return entry;
+ }
+
+ entry = entry.next;
+ }
+ }
+
+ return null;
+ }
+
+ private void AddImpl(object key, object value)
+ {
+ if (key == null) {
+ throw new ArgumentNullException("Attempted add with a null key.");
+ }
+
+ if (root == null) {
+ root = new ListEntry();
+ root.key = key;
+ root.value = value;
+ } else {
+ ListEntry entry = root;
+
+ while (entry != null) {
+ if (AreEqual(key, entry.key)) {
+ throw new ArgumentException("Duplicate key in add.");
+ }
+
+ if (entry.next == null) {
+ break;
+ }
+
+ entry = entry.next;
+ }
+
+ entry.next = new ListEntry();
+ entry.next.key = key;
+ entry.next.value = value;
+ }
+
+ count++;
+ modCount++;
+ }
+
+ // IEnumerable Interface
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return new ListEntryEnumerator(this);
+ }
+
+ // ICollection Interface
+ public int Count
+ {
+ get {
+ return count;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get {
+ return false;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get {
+ return this;
+ }
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index)
+ {
+ // FIXME
+ }
+
+ // IDictionary Interface
+ public bool IsFixedSize
+ {
+ get {
+ return false;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get {
+ return false;
+ }
+ }
+
+ // Indexer
+ public object this[object key]
+ {
+ get {
+ ListEntry entry = FindEntry(key);
+ return entry == null ? entry : entry.value;
+ }
+
+ set {
+ ListEntry entry = FindEntry(key);
+
+ if (entry != null) {
+ entry.value = value;
+ count++;
+ modCount++;
+ } else {
+ AddImpl(key, value);
+ }
+ }
+ }
+
+ public ICollection Keys
+ {
+ get {
+ return new ListEntryCollection(this, true);
+ }
+ }
+
+ public ICollection Values
+ {
+ get {
+ return new ListEntryCollection(this, false);
+ }
+ }
+
+ public void Add(object key, object value)
+ {
+ AddImpl(key, value);
+ }
+
+ public void Clear()
+ {
+ root = null;
+ count = 0;
+ modCount++;
+ }
+
+ public bool Contains(object key)
+ {
+ return FindEntry(key) != null ? true : false;
+ }
+
+ IDictionaryEnumerator IDictionary.GetEnumerator()
+ {
+ return new ListEntryEnumerator(this);
+ }
+
+ public void Remove(object key)
+ {
+ ListEntry entry = root;
+
+ for (ListEntry prev = null; entry != null; prev = entry, entry = entry.next) {
+ if (AreEqual(key, entry.key)) {
+ if (prev != null) {
+ prev.next = entry.next;
+ } else {
+ root = entry.next;
+ }
+
+ entry.value = null;
+ count--;
+ modCount++;
+ }
+ }
+ }
+
+
+ private class ListEntry
+ {
+ public object key = null;
+ public object value = null;
+ public ListEntry next = null;
+ }
+
+
+ private class ListEntryEnumerator : IEnumerator, IDictionaryEnumerator
+ {
+ private ListDictionary dict;
+ private bool isAtStart;
+ private ListEntry current;
+ private int version;
+
+ public ListEntryEnumerator(ListDictionary dict)
+ {
+ this.dict = dict;
+ version = dict.modCount;
+ Reset();
+ }
+
+ private void FailFast()
+ {
+ if (version != dict.modCount) {
+ throw new InvalidOperationException(
+ "The ListDictionary's contents changed after this enumerator was instantiated.");
+ }
+ }
+
+ public bool MoveNext()
+ {
+ FailFast();
+
+ if (isAtStart) {
+ current = dict.root;
+ isAtStart = false;
+ } else {
+ current = current.next;
+ }
+
+ return current != null ? true : false;
+ }
+
+ public void Reset()
+ {
+ FailFast();
+
+ isAtStart = true;
+ current = null;
+ }
+
+ public object Current
+ {
+ get {
+ FailFast();
+
+ if (isAtStart || current == null) {
+ throw new InvalidOperationException(
+ "Enumerator is positioned before the collection's first element or after the last element.");
+ }
+
+ return new DictionaryEntry(current.key, current.value);
+ }
+ }
+
+ // IDictionaryEnumerator
+ public DictionaryEntry Entry
+ {
+ get {
+ FailFast();
+ return (DictionaryEntry) Current;
+ }
+ }
+
+ public object Key
+ {
+ get {
+ FailFast();
+
+ if (isAtStart || current == null) {
+ throw new InvalidOperationException(
+ "Enumerator is positioned before the collection's first element or after the last element.");
+ }
+
+ return current.key;
+ }
+ }
+
+ public object Value
+ {
+ get {
+ FailFast();
+
+ if (isAtStart || current == null) {
+ throw new InvalidOperationException(
+ "Enumerator is positioned before the collection's first element or after the last element.");
+ }
+
+ return current.value;
+ }
+ }
+ }
+
+ private class ListEntryCollection : ICollection
+ {
+ private ListDictionary dict;
+ private bool isKeyList;
+
+ public ListEntryCollection(ListDictionary dict, bool isKeyList)
+ {
+ this.dict = dict;
+ this.isKeyList = isKeyList;
+ }
+
+ // ICollection Interface
+ public int Count
+ {
+ get {
+ return dict.Count;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get {
+ return false;
+ }
+ }
+
+ public object SyncRoot
+ {
+ get {
+ return dict.SyncRoot;
+ }
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index)
+ {
+ // FIXME
+ }
+
+ // IEnumerable Interface
+ public IEnumerator GetEnumerator()
+ {
+ return new ListEntryCollectionEnumerator(dict, isKeyList);
+ }
+
+ private class ListEntryCollectionEnumerator : IEnumerator
+ {
+ private ListDictionary dict;
+ private bool isKeyList;
+ private bool isAtStart;
+ private int version;
+ private ListEntry current;
+
+ public ListEntryCollectionEnumerator(ListDictionary dict, bool isKeyList)
+ {
+ this.dict = dict;
+ this.isKeyList = isKeyList;
+ isAtStart = true;
+ version = dict.modCount;
+ }
+
+ private void FailFast()
+ {
+ if (version != dict.modCount) {
+ throw new InvalidOperationException(
+ "The Collection's contents changed after this " +
+ "enumerator was instantiated.");
+ }
+ }
+
+ public object Current
+ {
+ get {
+ FailFast();
+
+ if (isAtStart || current == null) {
+ throw new InvalidOperationException(
+ "Enumerator is positioned before the collection's " +
+ "first element or after the last element.");
+ }
+
+ return isKeyList ? current.key : current.value;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ FailFast();
+
+ if (isAtStart) {
+ current = dict.root;
+ isAtStart = false;
+ } else {
+ current = current.next;
+ }
+
+ return current != null ? true : false;
+ }
+
+ public void Reset()
+ {
+ FailFast();
+ isAtStart = true;
+ current = null;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs b/mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs
new file mode 100644
index 00000000000..d9406ba0e1a
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/NameObjectCollectionBase.cs
@@ -0,0 +1,515 @@
+/**
+ * System.Collections.Specialized.NamaValueCollection class implementation
+ *
+ * Author: Gleb Novodran
+ */
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace System.Collections.Specialized
+{
+ [Serializable]
+ public abstract class NameObjectCollectionBase : ICollection, IEnumerable, ISerializable, IDeserializationCallback
+ {
+ private Hashtable m_ItemsContainer;
+ /// <summary>
+ /// Extends Hashtable based Items container to support storing null-key pairs
+ /// </summary>
+ private _Item m_NullKeyItem;
+ private ArrayList m_ItemsArray;
+ private IHashCodeProvider m_hashprovider;
+ private IComparer m_comparer;
+ private int m_defCapacity;
+ private bool m_readonly;
+
+ internal protected IComparer Comparer {
+ get {return m_comparer;}
+ }
+
+ internal protected IHashCodeProvider HashCodeProvider {
+ get {return m_hashprovider;}
+ }
+
+ internal protected /*?*/ class _Item
+ {
+ public string key;
+ public object value;
+ public _Item(string key, object value)
+ {
+ this.key = key;
+ this.value = value;
+ }
+ }
+ /// <summary>
+ /// Implements IEnumerable interface for KeysCollection
+ /// </summary>
+ [Serializable]
+ internal protected /*?*/ class _KeysEnumerator : IEnumerator
+ {
+ private NameObjectCollectionBase m_collection;
+ private int m_position;
+ /*private*/internal _KeysEnumerator(NameObjectCollectionBase collection)
+ {
+ m_collection = collection;
+ Reset();
+ }
+ public object Current
+ {
+
+ get{
+ if ((m_position<m_collection.Count)||(m_position<0))
+ return m_collection.BaseGetKey(m_position);
+ else
+ throw new InvalidOperationException();
+ }
+
+ }
+ public bool MoveNext()
+ {
+ return ((++m_position)<m_collection.Count)?true:false;
+ }
+ public void Reset()
+ {
+ m_position = -1;
+ }
+ }
+
+ /// <summary>
+ /// SDK: Represents a collection of the String keys of a collection.
+ /// </summary>
+ public class KeysCollection : ICollection, IEnumerable
+ {
+ private NameObjectCollectionBase m_collection;
+
+ internal/*protected?*/ KeysCollection(NameObjectCollectionBase collection)
+ {
+ this.m_collection = collection;
+ }
+ public virtual string Get( int index )
+ {
+ return m_collection.BaseGetKey(index);
+ //throw new Exception("Not implemented yet");
+ }
+
+ // ICollection methods -----------------------------------
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="arr"></param>
+ /// <param name="index"></param>
+ public virtual void /*ICollection*/ CopyTo(Array arr, int index)
+ {
+ if (arr==null)
+ throw new ArgumentNullException("array can't be null");
+ IEnumerator en = this.GetEnumerator();
+ int i = index;
+ while (en.MoveNext())
+ {
+ arr.SetValue(en.Current,i);
+ i++;
+ }
+ }
+
+ public virtual bool IsSynchronized
+ {
+ get{
+ throw new Exception("Not implemented yet");
+ }
+ }
+ public virtual object SyncRoot
+ {
+ get{
+ throw new Exception("Not implemented yet");
+ }
+ }
+ /// <summary>
+ /// Gets the number of keys in the NameObjectCollectionBase.KeysCollection
+ /// </summary>
+ public virtual int Count
+ {
+ get{
+ return m_collection.Count;
+ //throw new Exception("Not implemented yet");
+ }
+ }
+ // IEnumerable methods --------------------------------
+ /// <summary>
+ /// SDK: Returns an enumerator that can iterate through the NameObjectCollectionBase.KeysCollection.
+ /// </summary>
+ /// <returns></returns>
+ public IEnumerator GetEnumerator()
+ {
+ return new _KeysEnumerator(m_collection);
+// throw new Exception("Not implemented yet");
+ }
+ }
+
+
+
+ //--------------- Protected Instance Constructors --------------
+
+ /// <summary>
+ /// SDK: Initializes a new instance of the NameObjectCollectionBase class that is empty.
+ /// </summary>
+ [MonoTODO]
+ protected NameObjectCollectionBase():base()
+ {
+ m_readonly = false;
+
+ m_hashprovider = CaseInsensitiveHashCodeProvider.Default;
+ m_comparer = CaseInsensitiveComparer.Default;
+ m_defCapacity = 0;
+ Init();
+ /*m_ItemsContainer = new Hashtable(m_hashprovider,m_comparer);
+ m_ItemsArray = new ArrayList();
+ m_NullKeyItem = null;*/
+ //TODO: consider common Reset() method
+ }
+
+ protected NameObjectCollectionBase( int capacity )
+ {
+ m_readonly = false;
+
+ m_hashprovider = CaseInsensitiveHashCodeProvider.Default;
+ m_comparer = CaseInsensitiveComparer.Default;
+ m_defCapacity = capacity;
+ Init();
+ /*m_ItemsContainer = new Hashtable(m_defCapacity, m_hashprovider,m_comparer);
+ m_ItemsArray = new ArrayList();
+ m_NullKeyItem = null; */
+ //throw new Exception("Not implemented yet");
+ }
+ protected NameObjectCollectionBase( IHashCodeProvider hashProvider, IComparer comparer )
+ {
+ m_readonly = false;
+
+ m_hashprovider = hashProvider;
+ m_comparer = comparer;
+ m_defCapacity = 0;
+ Init();
+ /*m_ItemsContainer = new Hashtable(m_hashprovider,m_comparer);
+ m_ItemsArray = new ArrayList();
+ m_NullKeyItem = null; */
+ //throw new Exception("Not implemented yet");
+ }
+ protected NameObjectCollectionBase( SerializationInfo info, StreamingContext context )
+ {
+ throw new Exception("Not implemented yet");
+ }
+ protected NameObjectCollectionBase( int capacity, IHashCodeProvider hashProvider, IComparer comparer )
+ {
+ m_readonly = false;
+
+ m_hashprovider = hashProvider;
+ m_comparer = comparer;
+ m_defCapacity = capacity;
+ Init();
+ /*m_ItemsContainer = new Hashtable(m_defCapacity,m_hashprovider,m_comparer);
+ m_ItemsArray = new ArrayList();
+ m_NullKeyItem = null; */
+
+ //throw new Exception("Not implemented yet");
+ }
+
+ private void Init(){
+ m_ItemsContainer = new Hashtable(m_defCapacity,m_hashprovider,m_comparer);
+ m_ItemsArray = new ArrayList();
+ m_NullKeyItem = null;
+ }
+ //--------------- Public Instance Properties -------------------
+ public virtual NameObjectCollectionBase.KeysCollection Keys
+ {
+ get
+ {
+ return new KeysCollection(this);
+ //throw new Exception("Not implemented yet");
+ }
+ }
+
+ //--------------- Public Instance Methods ----------------------
+ //
+ /// <summary>
+ /// SDK: Returns an enumerator that can iterate through the NameObjectCollectionBase.
+ ///
+ /// <remark>This enumerator returns the keys of the collection as strings.</remark>
+ /// </summary>
+ /// <returns></returns>
+ public IEnumerator GetEnumerator()
+ {
+ return new _KeysEnumerator(this);
+ }
+ // GetHashCode
+
+ // ISerializable
+ public virtual void /*ISerializable*/ GetObjectData( SerializationInfo info, StreamingContext context )
+ {
+ throw new Exception("Not implemented yet");
+ }
+ public/*?*/ virtual void /*ISerializable*/ CopyTo(Array arr, int index)
+ {
+ throw new Exception("Not implemented yet");
+ }
+
+ // ICollection
+ public virtual int Count
+ {
+ get{
+ return m_ItemsArray.Count;
+ //throw new Exception("Not implemented yet");
+ }
+ }
+ public virtual bool IsSynchronized
+ {
+ get{
+ throw new Exception("Not implemented yet");
+ }
+ }
+ public virtual object SyncRoot
+ {
+ get
+ {
+ throw new Exception("Not implemented yet");
+ }
+ }
+
+ // IDeserializationCallback
+ public virtual void OnDeserialization( object sender)
+ {
+ throw new Exception("Not implemented yet");
+ }
+
+ //--------------- Protected Instance Properties ----------------
+ /// <summary>
+ /// SDK: Gets or sets a value indicating whether the NameObjectCollectionBase instance is read-only.
+ /// </summary>
+ protected bool IsReadOnly
+ {
+ get{
+ return m_readonly;
+ }
+ set{
+ m_readonly=value;
+ }
+ }
+
+ //--------------- Protected Instance Methods -------------------
+ /// <summary>
+ /// Adds an Item with the specified key and value into the <see cref="NameObjectCollectionBase"/>NameObjectCollectionBase instance.
+ /// </summary>
+ /// <param name="name"></param>
+ /// <param name="value"></param>
+ protected void BaseAdd( string name, object value )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+
+ _Item newitem=new _Item(name, value);
+
+ if (name==null){
+ //todo: consider nullkey entry
+ if (m_NullKeyItem==null)
+ m_NullKeyItem = newitem;
+ }
+ else
+ if (m_ItemsContainer[name]==null){
+ m_ItemsContainer.Add(name,newitem);
+ }
+ m_ItemsArray.Add(newitem);
+
+// throw new Exception("Not implemented yet");
+ }
+ protected void BaseClear()
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ Init();
+ //throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ /// SDK: Gets the value of the entry at the specified index of the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <param name="index"></param>
+ /// <returns></returns>
+ protected object BaseGet( int index )
+ {
+ return ((_Item)m_ItemsArray[index]).value;
+ //throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ /// SDK: Gets the value of the first entry with the specified key from the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <remark>CAUTION: The BaseGet method does not distinguish between a null reference which is returned because the specified key is not found and a null reference which is returned because the value associated with the key is a null reference.</remark>
+ /// <param name="name"></param>
+ /// <returns></returns>
+ protected object BaseGet( string name )
+ {
+ _Item item = FindFirstMatchedItem(name);
+ /// CAUTION: The BaseGet method does not distinguish between a null reference which is returned because the specified key is not found and a null reference which is returned because the value associated with the key is a null reference.
+ if (item==null)
+ return null;
+ else
+ return item.value;
+ }
+
+ /// <summary>
+ /// SDK:Returns a String array that contains all the keys in the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <returns>A String array that contains all the keys in the NameObjectCollectionBase instance.</returns>
+ protected string[] BaseGetAllKeys()
+ {
+ int cnt = m_ItemsArray.Count;
+ string[] allKeys = new string[cnt];
+ for(int i=0; i<cnt; i++)
+ allKeys[i] = BaseGetKey(i);//((_Item)m_ItemsArray[i]).key;
+
+ return allKeys;
+ }
+
+ /// <summary>
+ /// SDK: Returns an Object array that contains all the values in the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <returns>An Object array that contains all the values in the NameObjectCollectionBase instance.</returns>
+ protected object[] BaseGetAllValues()
+ {
+ int cnt = m_ItemsArray.Count;
+ object[] allValues = new object[cnt];
+ for(int i=0; i<cnt; i++)
+ allValues[i] = BaseGet(i);
+
+ return allValues;
+// throw new Exception("Not implemented yet");
+ }
+ [MonoTODO]
+ protected object[] BaseGetAllValues( Type type )
+ {
+ if (type == null)
+ throw new ArgumentNullException("'type' argument can't be null");
+ // TODO: implements this
+
+ throw new Exception("Not implemented yet");
+ }
+
+ protected string BaseGetKey( int index )
+ {
+ return ((_Item)m_ItemsArray[index]).key;
+ //throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ /// Gets a value indicating whether the NameObjectCollectionBase instance contains entries whose keys are not a null reference
+ /// </summary>
+ /// <returns>true if the NameObjectCollectionBase instance contains entries whose keys are not a null reference otherwise, false.</returns>
+ protected bool BaseHasKeys()
+ {
+ return (m_ItemsContainer.Count>0);
+// throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="name"></param>
+ [MonoTODO]
+ protected void BaseRemove( string name )
+ {
+ int cnt = 0;
+ String key;
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ if (name!=null)
+ {
+ m_ItemsContainer.Remove(name);
+ }
+ else {
+ m_NullKeyItem = null;
+ }
+
+ cnt = m_ItemsArray.Count;
+ for (int i=0 ; i< cnt; ){
+ key=BaseGetKey(i);
+ // TODO: consider case-sensivity
+ if (String.Compare(key,name)==0){
+ m_ItemsArray.RemoveAt(i);
+ cnt--;
+ }
+ else
+ i++;
+
+ }
+// throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="index"></param>
+ /// <LAME>This function implemented the way Microsoft implemented it -
+ /// item is removed from hashtable and array without considering the case when there are two items with the same key but different values in array.
+ /// E.g. if
+ /// hashtable is [("Key1","value1")] and array contains [("Key1","value1")("Key1","value2")] then
+ /// after RemoveAt(1) the collection will be in following state:
+ /// hashtable:[]
+ /// array: [("Key1","value1")]
+ /// It's ok only then the key is uniquely assosiated with the value
+ /// To fix it a comparsion of objects stored under the same key in the hashtable and in the arraylist should be added
+ /// </LAME>>
+ [MonoTODO]
+ protected void BaseRemoveAt( int index )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ string key = BaseGetKey(index);
+ if (key!=null){
+ // TODO: see LAME description above
+ m_ItemsContainer.Remove(key);
+ }
+ else
+ m_NullKeyItem = null;
+ m_ItemsArray.RemoveAt(index);
+// throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ /// SDK: Sets the value of the entry at the specified index of the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <param name="index"></param>
+ /// <param name="value"></param>
+ protected void BaseSet( int index, object value )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ _Item item = (_Item)m_ItemsArray[index];
+ item.value = value;
+ //throw new Exception("Not implemented yet");
+ }
+ /// <summary>
+ /// Sets the value of the first entry with the specified key in the NameObjectCollectionBase instance, if found; otherwise, adds an entry with the specified key and value into the NameObjectCollectionBase instance.
+ /// </summary>
+ /// <param name="name">The String key of the entry to set. The key can be a null reference </param>
+ /// <param name="value">The Object that represents the new value of the entry to set. The value can be a null reference</param>
+ protected void BaseSet( string name, object value )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ _Item item = FindFirstMatchedItem(name);
+ if (item!=null)
+ item.value=value;
+ else
+ BaseAdd(name, value);
+
+ //throw new Exception("Not implemented yet");
+ }
+ [MonoTODO]
+ private _Item FindFirstMatchedItem(string name)
+ {
+ if (name!=null)
+ return (_Item)m_ItemsContainer[name];
+ else {
+ //TODO: consider null key case
+ return m_NullKeyItem;
+ //throw new Exception("Not implemented yet");
+ }
+
+ }
+ //~Object();
+
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs b/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs
new file mode 100644
index 00000000000..ed12b672b17
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/NameValueCollection.cs
@@ -0,0 +1,365 @@
+/**
+ * System.Collections.Specialized.NamaValueCollection class implementation
+ *
+ * Author: Gleb Novodran
+ */
+// created on 7/21/2001 at 5:15 PM
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace System.Collections.Specialized{
+ [Serializable]
+ public class NameValueCollection : NameObjectCollectionBase
+ {
+ string[] cachedAllKeys = null;
+ string[] cachedAll = null;
+
+ //--------------------- Constructors -----------------------------
+
+ /// <summary> SDK: Initializes a new instance of the NameValueCollection class that is empty,
+ /// has the default initial capacity and uses the default case-insensitive hash code provider and the default case-insensitive comparer.
+ /// </summary>
+ public NameValueCollection() : base()
+ {
+
+ }
+
+ /// <summary> SDK: Initializes a new instance of the NameValueCollection class that is empty,
+ /// has the specified initial capacity and uses the default case-insensitive hash code provider and the default case-insensitive comparer.
+ ///</summary>
+ public NameValueCollection( int capacity ) : base(capacity)
+ {
+
+ }
+
+ /// <summary> SDK: Copies the entries from the specified NameValueCollection to a new
+ /// NameValueCollection with the same initial capacity as the number of entries copied
+ /// and using the same case-insensitive hash code provider and the same case-insensitive
+ /// comparer as the source collection.
+ /// </summary>
+ /// TODO: uncomment constructor below after it will be possible to compile NameValueCollection and
+ /// NameObjectCollectionBase to the same assembly
+
+ public NameValueCollection( NameValueCollection col ) : base(col.HashCodeProvider,col.Comparer)
+ {
+ if (col==null)
+ throw new ArgumentNullException("Null argument is not allowed");
+ Add(col);
+ }
+
+ ///<summary>SDK: Initializes a new instance of the NameValueCollection class that is empty,
+ ///has the default initial capacity and uses the specified hash code provider and
+ ///the specified comparer.</summary>
+ public NameValueCollection( IHashCodeProvider hashProvider, IComparer comparer )
+ : base(hashProvider, comparer)
+ {
+
+ }
+
+ /// <summary>
+ /// SDK: Copies the entries from the specified NameValueCollection to a new NameValueCollection
+ /// with the specified initial capacity or the same initial capacity as the number of entries
+ /// copied, whichever is greater, and using the default case-insensitive hash code provider and
+ /// the default case-insensitive comparer.
+ /// </summary>
+ /// TODO: uncomment constructor below after it will be possible to compile NameValueCollection and
+ /// NameObjectCollectionBase to the same assembly
+
+/* public NameValueCollection( int capacity, NameValueCollection col )
+ : base(capacity, col.get_HashCodeProvider(),col.Comparer)
+ {
+ if (col==null)
+ throw new ArgumentNullException("Null argument is not allowed");
+ Add(col);
+ }
+*/
+ /// <summary>
+ /// SDK: Initializes a new instance of the NameValueCollection class that is serializable
+ /// and uses the specified System.Runtime.Serialization.SerializationInfo and
+ /// System.Runtime.Serialization.StreamingContext.
+ /// </summary>
+ protected NameValueCollection( SerializationInfo info, StreamingContext context )
+ :base(info, context)
+ {
+
+ }
+
+ /// <summary>
+ /// SDK: Initializes a new instance of the NameValueCollection class that is empty,
+ /// has the specified initial capacity and uses the specified hash code provider and
+ /// the specified comparer.
+ /// </summary>
+ public NameValueCollection( int capacity, IHashCodeProvider hashProvider, IComparer comparer )
+ :base(capacity, hashProvider, comparer)
+ {
+
+ }
+
+ //----------------------- Public Instance Properties -------------------------------
+
+
+ ///<summary> SDK:
+ /// Gets all the keys in the NameValueCollection.
+ /// The arrays returned by AllKeys are cached for better performance and are
+ /// automatically refreshed when the collection changes. A derived class can
+ /// invalidate the cached version by calling InvalidateCachedArrays, thereby
+ /// forcing the arrays to be recreated.
+ /// </summary>
+ public virtual string[] AllKeys
+ {
+ get {
+ if (cachedAllKeys==null)
+ cachedAllKeys = BaseGetAllKeys();
+ return this.cachedAllKeys;
+ }
+ }
+
+ public string this[ int index ]
+ {
+ get{
+ return this.Get(index);
+ }
+ }
+
+ public string this[ string name ] {
+ get{
+ return this.Get(name);
+ }
+ set{
+ this.Set(name,value);
+ }
+ }
+
+/////////////////////////////// Public Instance Methods //////////////////////////////
+
+ /// <summary> SDK: Copies the entries in the specified NameValueCollection
+ /// to the current NameValueCollection.</summary>
+ /// LAMESPEC: see description that comes this Add(string, string)
+
+ public void Add( NameValueCollection c ){
+
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ if (c==null)
+ throw new ArgumentNullException();
+
+ InvalidateCachedArrays();
+ ArrayList values = null;
+
+ int max = c.Count;
+ for(int i=0; i<max; i++){
+ values=(ArrayList)BaseGet(c.GetKey(i));
+ if (values==null)
+ values = new ArrayList();
+ values.AddRange((ArrayList)c.BaseGet(i));
+ }
+
+ }
+
+
+ /// <summary> SDK: Adds an entry with the specified name and value to the
+ /// NameValueCollection. </summary>
+ ///
+ /// LAMESPEC:
+ /// in SDK doc: If the same value already exists under the same key in the collection,
+ /// the new value overwrites the old value.
+ /// however the Microsoft implemenatation in this case just adds one more value
+ /// in other words after
+ /// <code>
+ /// NameValueCollection nvc;
+ /// nvc.Add("LAZY","BASTARD")
+ /// nvc.Add("LAZY","BASTARD")
+ /// </code>
+ /// nvc.Get("LAZY") will be "BASTARD,BASTARD" instead of "BASTARD"
+
+ public virtual void Add( string name, string val )
+ {
+
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+
+ InvalidateCachedArrays();
+ ArrayList values = (ArrayList)BaseGet(name);
+ if (values==null){
+ values = new ArrayList();
+ if (val!=null)
+ values.Add(val);
+ BaseAdd(name,values);
+ }
+ else {
+ if (val!=null)
+ values.Add(val);
+ }
+
+ }
+
+ /// <summary> SDK: Invalidates the cached arrays and removes all entries from
+ /// the NameValueCollection.</summary>
+
+ public void Clear(){
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ InvalidateCachedArrays();
+ BaseClear();
+ }
+
+ /// <summary> SDK: Copies the entire NameValueCollection to a compatible one-dimensional Array,
+ /// starting at the specified index of the target array.</summary>
+
+ [MonoTODO]
+ override public void CopyTo( Array dest, int index )
+ {
+ if (dest==null)
+ throw new ArgumentNullException("Null argument - dest");
+ if (index<0)
+ throw new ArgumentOutOfRangeException("index is less than 0");
+// throw new Exception("Not implemented yet");
+
+ //TODO: add implementation here
+ if (cachedAll==null)
+ RefreshCachedAll();
+ cachedAll.CopyTo(dest, index);
+ }
+ protected void RefreshCachedAll()
+ {
+ this.cachedAll=null;
+ int max = this.Count;
+ cachedAll = new string[max];
+ for(int i=0;i<max;i++){
+ cachedAll[i] = this.Get(i);
+ }
+
+ }
+
+ /// <summary> SDK: Gets the values at the specified index of the NameValueCollection combined
+ /// into one comma-separated list.</summary>
+
+ public virtual string Get( int index )
+ {
+ ArrayList values = (ArrayList)BaseGet(index);
+ // if index is out of range BaseGet throws an ArgumentOutOfRangeException
+
+ return AsSingleString(values);
+
+ }
+
+ /**
+ * SDK: Gets the values associated with the specified key from the NameValueCollection
+ * combined into one comma-separated list.
+ */
+ public virtual string Get( string name )
+ {
+ ArrayList values = (ArrayList)BaseGet(name);
+/* if (values==null)
+ Console.WriteLine("BaseGet returned null");*/
+ return AsSingleString(values);
+// -------------------------------------------------------------
+
+ }
+ /// <summary></summary>
+ [MonoTODO]
+ private static string AsSingleString(ArrayList values)
+ {
+ const char separator = ',';
+
+ if (values==null)
+ return null;
+ int max = values.Count;
+
+ if (max==0)
+ return null;
+ //TODO: reimplement this
+ StringBuilder sb = new StringBuilder((string)values[0]);
+ for (int i=1; i<max; i++){
+ sb.Append(separator);
+ sb.Append(values[i]);
+ }
+
+ return sb.ToString();
+ }
+
+
+ /// <summary>SDK: Gets the key at the specified index of the NameValueCollection.</summary>
+ public virtual string GetKey( int index )
+ {
+ return BaseGetKey(index);
+ }
+
+
+ /// <summary>SDK: Gets the values at the specified index of the NameValueCollection.</summary>
+
+ public virtual string[] GetValues( int index )
+ {
+ ArrayList values = (ArrayList)BaseGet(index);
+
+ return AsStringArray(values);
+ }
+
+
+ public virtual string[] GetValues( string name )
+ {
+ ArrayList values = (ArrayList)BaseGet(name);
+
+ return AsStringArray(values);
+ }
+
+ private static string[] AsStringArray(ArrayList values){
+
+ int max = values.Count;//get_Count();
+ if (max==0)
+ return null;
+
+ string[] valArray =new string[max];
+ values.CopyTo(valArray);
+ return valArray;
+ }
+
+
+ /// <summary>
+ /// SDK: Gets a value indicating whether the NameValueCollection contains keys that
+ /// are not a null reference
+ /// </summary>
+
+ public bool HasKeys()
+ {
+ return BaseHasKeys();
+ }
+
+ public virtual void Remove( string name )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ InvalidateCachedArrays();
+ BaseRemove(name);
+
+ }
+
+ /// <summary>
+ /// Sets the value of an entry in the NameValueCollection.
+ /// </summary>
+ public virtual void Set( string name, string value )
+ {
+ if (this.IsReadOnly)
+ throw new NotSupportedException("Collection is read-only");
+ InvalidateCachedArrays();
+
+ ArrayList values = new ArrayList();
+ values.Add(value);
+ BaseSet(name,values);
+
+ }
+
+
+//---------------------- Protected Instance Methods ----------------------
+
+ protected void InvalidateCachedArrays()
+ {
+ cachedAllKeys = null;
+ cachedAll = null;
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/StringCollection.cs b/mcs/class/System/System.Collections.Specialized/StringCollection.cs
new file mode 100755
index 00000000000..120468812f2
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/StringCollection.cs
@@ -0,0 +1,293 @@
+/* System.Collections.Specialized.StringCollection.cs
+ * Authors:
+ * John Barnette (jbarn@httcb.net)
+ * Sean MacIsaac (macisaac@ximian.com)
+ *
+ * Copyright (C) 2001 John Barnette
+ * (C) Ximian, Inc. http://www.ximian.com
+ *
+ * NOTES:
+ * I bet Microsoft uses ArrayList as a backing store for this; I wonder what
+ * the performance difference will be.
+*/
+
+using System;
+
+namespace System.Collections.Specialized {
+ [Serializable]
+ public class StringCollection : IList, ICollection, IEnumerable {
+ private static int InitialCapacity = 11;
+ private static float CapacityMultiplier = 2.0f;
+
+ private int count;
+ private int modCount;
+
+ private string[] entries;
+
+ // Public Constructor
+ public StringCollection() {
+ entries = new string[InitialCapacity];
+ count = 0;
+ modCount = 0;
+ }
+
+ // Public Instance Properties
+ public int Count {
+ get { return count; }
+ }
+
+ public bool IsFixedSize {
+ get { return false; }
+ }
+
+ public bool IsReadOnly {
+ get { return false; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ object IList.this[int index] {
+ get { return this[index]; }
+ set { this[index] = value.ToString(); }
+ }
+
+ public string this[int index] {
+ get {
+ if (index < 0 || index >= count) {
+ throw new ArgumentOutOfRangeException("index");
+ }
+
+ return entries[index];
+ }
+
+ set {
+ if (index < 0 || index >= count) {
+ throw new ArgumentOutOfRangeException("index");
+ }
+
+ modCount++;
+ entries[index] = value;
+ }
+ }
+
+ public object SyncRoot {
+ get { return this; }
+ }
+
+
+ // Public Instance Methods
+
+ int IList.Add(object value) {
+ return Add(value.ToString());
+ }
+
+ public int Add(string value) {
+ modCount++;
+ Resize(count + 1);
+ int index = count++;
+ entries[index] = value;
+
+ return index;
+ }
+
+ public void AddRange(string[] value) {
+ int numEntries = value.Length;
+
+ modCount++;
+ Resize(count + numEntries);
+ Array.Copy(value, 0, entries, count, numEntries);
+ count += numEntries;
+ }
+
+ public void Clear() {
+ modCount++;
+ count = 0;
+ }
+
+ bool IList.Contains(object value) {
+ return Contains(value.ToString());
+ }
+
+ public bool Contains(string value) {
+ foreach (string entry in entries) {
+ if (value.Equals(entry)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ void ICollection.CopyTo(Array array, int index) {
+ if (array == null) {
+ throw new ArgumentNullException("array");
+ } else if (index < 0) {
+ throw new ArgumentOutOfRangeException("index");
+ } else if (array.Rank > 1) {
+ throw new ArgumentException("array");
+ } else if (index >= array.Length) {
+ throw new ArgumentException("index");
+ } else if (array.Length - index < count) {
+ throw new ArgumentException("array");
+ }
+
+ Array.Copy(entries, 0, array, index, count);
+ }
+
+ public void CopyTo(string[] array, int index) {
+ if (array == null) {
+ throw new ArgumentNullException("array");
+ } else if (index < 0) {
+ throw new ArgumentOutOfRangeException("index");
+ } else if (array.Rank > 1) {
+ throw new ArgumentException("array");
+ } else if (index >= array.Length) {
+ throw new ArgumentException("index");
+ } else if (array.Length - index < count) {
+ throw new ArgumentException("array");
+ }
+
+ Array.Copy(entries, 0, array, index, count);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator() {
+ return new InternalEnumerator(this);
+ }
+
+ public StringEnumerator GetEnumerator() {
+ return new StringEnumerator(this);
+ }
+
+ int IList.IndexOf(object value) {
+ return IndexOf(value.ToString());
+ }
+
+ public int IndexOf(string value) {
+ for (int i = 0; i < count; i++) {
+ if (value.Equals(entries[i])) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ void IList.Insert(int index, object value) {
+ Insert(index, value.ToString());
+ }
+
+ public void Insert(int index, string value) {
+ if (index < 0 || index > count) {
+ throw new ArgumentOutOfRangeException("index");
+ }
+
+ modCount++;
+ Resize(count + 1);
+ Array.Copy(entries, index, entries, index + 1, count - index);
+ entries[index] = value;
+ count++;
+ }
+
+
+ void IList.Remove(object value) {
+ Remove(value.ToString());
+ }
+
+ public void Remove(string value) {
+ for (int i = 0; i < count; i++) {
+ if (value.Equals(entries[i])) {
+ RemoveAt(i);
+ return;
+ }
+ }
+ }
+
+ public void RemoveAt(int index) {
+ if (index < 0 || index >= count) {
+ throw new ArgumentOutOfRangeException("index");
+ }
+
+ int remaining = count - index - 1;
+
+ modCount++;
+
+ if (remaining > 0) {
+ Array.Copy(entries, index + 1, entries, index, remaining);
+ }
+
+ count--;
+ entries[count] = null;
+ }
+
+
+ // Private Instance Methods
+
+ private void Resize(int minSize) {
+ int oldSize = entries.Length;
+
+ if (minSize > oldSize) {
+ string[] oldEntries = entries;
+ int newSize = (int) (oldEntries.Length * CapacityMultiplier);
+
+ if (newSize < minSize) newSize = minSize;
+ entries = new string[newSize];
+ Array.Copy(oldEntries, 0, entries, 0, count);
+ }
+ }
+
+
+ // Private classes
+
+ private class InternalEnumerator : IEnumerator {
+ private StringCollection data;
+ private int index;
+ private int myModCount;
+
+ public InternalEnumerator(StringCollection data) {
+ this.data = data;
+ myModCount = data.modCount;
+ index = -1;
+ }
+
+
+ // Public Instance Properties
+
+ public object Current {
+ get {
+ if (myModCount != data.modCount) {
+ throw new InvalidOperationException();
+ } else if (index < 0 || index > data.count - 1) {
+ throw new InvalidOperationException();
+ }
+
+ return data[index];
+ }
+ }
+
+
+ // Public Instance Methods
+
+ public bool MoveNext() {
+ if (myModCount != data.modCount) {
+ throw new InvalidOperationException();
+ }
+
+ if (++index >= data.count - 1) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public void Reset() {
+ if (myModCount != data.modCount) {
+ throw new InvalidOperationException();
+ }
+
+ index = -1;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Collections.Specialized/StringDictionary.cs b/mcs/class/System/System.Collections.Specialized/StringDictionary.cs
new file mode 100644
index 00000000000..2e5bc2bfe10
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/StringDictionary.cs
@@ -0,0 +1,97 @@
+namespace System.Collections.Specialized
+{
+ public class StringDictionary : IEnumerable
+ {
+ protected Hashtable table;
+
+ public StringDictionary()
+ {
+ table = new Hashtable();
+ }
+
+ // Public Instance Properties
+
+ public virtual int Count
+ {
+ get {
+ return table.Count;
+ }
+ }
+
+ public virtual bool IsSynchronized
+ {
+ get {
+ return false;
+ }
+ }
+
+ public virtual string this[string key]
+ {
+ get {
+ return (string) table[key.ToLower()];
+ }
+
+ set {
+ table[key.ToLower()] = value;
+ }
+ }
+
+ public virtual ICollection Keys
+ {
+ get {
+ return table.Keys;
+ }
+ }
+
+ public virtual ICollection Values
+ {
+ get {
+ return table.Values;
+ }
+ }
+
+ public virtual object SyncRoot
+ {
+ get {
+ return table.SyncRoot;
+ }
+ }
+
+ // Public Instance Methods
+
+ public virtual void Add(string key, string value)
+ {
+ table.Add(key.ToLower(), value);
+ }
+
+ public virtual void Clear()
+ {
+ table.Clear();
+ }
+
+ public virtual bool ContainsKey(string key)
+ {
+ return table.ContainsKey(key.ToLower());
+ }
+
+ public virtual bool ContainsValue(string value)
+ {
+ return table.ContainsValue(value);
+ }
+
+ public virtual void CopyTo(Array array, int index)
+ {
+ table.CopyTo(array, index);
+ }
+
+ public virtual IEnumerator GetEnumerator()
+ {
+ return table.GetEnumerator();
+ }
+
+ public virtual void Remove(string key)
+ {
+ table.Remove(key.ToLower());
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/System/System.Collections.Specialized/StringEnumerator.cs b/mcs/class/System/System.Collections.Specialized/StringEnumerator.cs
new file mode 100644
index 00000000000..8be9d7c5a6e
--- /dev/null
+++ b/mcs/class/System/System.Collections.Specialized/StringEnumerator.cs
@@ -0,0 +1,36 @@
+/* System.Collections.Specialized.StringEnumerator.cs
+ * Authors:
+ * John Barnette (jbarn@httcb.net)
+ *
+ * Copyright (C) 2001 John Barnette
+*/
+
+namespace System.Collections.Specialized {
+ public class StringEnumerator {
+ private StringCollection coll;
+ private IEnumerator enumerable;
+
+ // assembly-scoped constructor
+ internal StringEnumerator(StringCollection coll) {
+ this.coll = coll;
+ this.enumerable = ((IEnumerable)coll).GetEnumerator();
+ }
+
+ // Public Instance Properties
+
+ public string Current {
+ get { return (string) enumerable.Current; }
+ }
+
+
+ // Public Instance Methods
+
+ public bool MoveNext() {
+ return enumerable.MoveNext();
+ }
+
+ public void Reset() {
+ enumerable.Reset();
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs b/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs
new file mode 100755
index 00000000000..e56beb2f809
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs
@@ -0,0 +1,38 @@
+//
+// System.ComponentModel.BrowsableAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)]
+ public sealed class BrowsableAttribute : Attribute {
+ bool browsable;
+
+ public static readonly BrowsableAttribute No;
+ public static readonly BrowsableAttribute Yes;
+
+ static BrowsableAttribute ()
+ {
+ No = new BrowsableAttribute (false);
+ Yes = new BrowsableAttribute (false);
+ }
+
+ public BrowsableAttribute (bool browsable)
+ {
+ this.browsable = browsable;
+ }
+
+ public bool Browsable {
+ get {
+ return browsable;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/CategoryAttribute.cs b/mcs/class/System/System.ComponentModel/CategoryAttribute.cs
new file mode 100755
index 00000000000..b6ffec33364
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/CategoryAttribute.cs
@@ -0,0 +1,227 @@
+//
+// System.ComponentModel.CategoryAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)]
+ public class CategoryAttribute : Attribute {
+ string category;
+
+ static CategoryAttribute action, appearance, behaviour, data, def;
+ static CategoryAttribute design, drag_drop, focus, format, key;
+ static CategoryAttribute layout, mouse, window_style;
+
+ public CategoryAttribute (string category)
+ {
+ this.category = category;
+ }
+
+ public CategoryAttribute ()
+ {
+ this.category = "Misc";
+ }
+
+ [MonoTODO]
+ protected virtual string GetLocalizedString (string value)
+ {
+ // FIXME: IMPLEMENT
+
+ return category;
+ }
+
+ public string Category {
+ get {
+ return category;
+ }
+ }
+
+ public static CategoryAttribute Action {
+ get {
+ if (action != null)
+ return action;
+
+ lock (typeof (CategoryAttribute)){
+ if (action == null)
+ action = new CategoryAttribute ("Action");
+
+ return action;
+ }
+ }
+ }
+
+ public static CategoryAttribute Appearance {
+ get {
+ if (appearance != null)
+ return appearance;
+
+ lock (typeof (CategoryAttribute)){
+ if (appearance == null)
+ appearance = new CategoryAttribute ("Appearance");
+
+ return appearance;
+ }
+ }
+ }
+
+ public static CategoryAttribute Behaviour {
+ get {
+ if (behaviour != null)
+ return behaviour;
+
+ lock (typeof (CategoryAttribute)){
+ if (behaviour == null)
+ behaviour = new CategoryAttribute ("Action");
+
+ return behaviour;
+ }
+ }
+ }
+
+ public static CategoryAttribute Data {
+ get {
+ if (data != null)
+ return data;
+
+ lock (typeof (CategoryAttribute)){
+ if (data == null)
+ data = new CategoryAttribute ("Data");
+
+ return data;
+ }
+ }
+ }
+
+ public static CategoryAttribute Default {
+ get {
+ if (def != null)
+ return def;
+
+ lock (typeof (CategoryAttribute)){
+ if (def == null)
+ def = new CategoryAttribute ("Default");
+
+ return def;
+ }
+ }
+ }
+
+ public static CategoryAttribute Design {
+ get {
+ if (design != null)
+ return design;
+
+ lock (typeof (CategoryAttribute)){
+ if (design == null)
+ design = new CategoryAttribute ("Design");
+
+ return design;
+ }
+ }
+ }
+
+ public static CategoryAttribute DragDrop {
+ get {
+ if (drag_drop != null)
+ return drag_drop;
+
+ lock (typeof (CategoryAttribute)){
+ if (drag_drop == null)
+ drag_drop = new CategoryAttribute ("Drag Drop");
+
+ return drag_drop;
+ }
+ }
+ }
+
+ public static CategoryAttribute Focus {
+ get {
+ if (focus != null)
+ return focus;
+
+ lock (typeof (CategoryAttribute)){
+ if (focus == null)
+ focus = new CategoryAttribute ("Focus");
+
+ return focus;
+ }
+ }
+ }
+
+ public static CategoryAttribute Format {
+ get {
+ if (format != null)
+ return format;
+
+ lock (typeof (CategoryAttribute)){
+ if (format == null)
+ format = new CategoryAttribute ("Format");
+
+ return format;
+ }
+ }
+ }
+
+ public static CategoryAttribute Key {
+ get {
+ if (key != null)
+ return key;
+
+ lock (typeof (CategoryAttribute)){
+ if (key == null)
+ key = new CategoryAttribute ("Key");
+
+ return key;
+ }
+ }
+ }
+
+ public static CategoryAttribute Layout {
+ get {
+ if (layout != null)
+ return layout;
+
+ lock (typeof (CategoryAttribute)){
+ if (layout == null)
+ layout = new CategoryAttribute ("Layout");
+
+ return layout;
+ }
+ }
+ }
+
+ public static CategoryAttribute Mouse {
+ get {
+ if (mouse != null)
+ return mouse;
+
+ lock (typeof (CategoryAttribute)){
+ if (mouse == null)
+ mouse = new CategoryAttribute ("Mouse");
+
+ return mouse;
+ }
+ }
+ }
+
+ public static CategoryAttribute WindowStyle {
+ get {
+ if (window_style != null)
+ return window_style;
+
+ lock (typeof (CategoryAttribute)){
+ if (window_style == null)
+ window_style = new CategoryAttribute ("Window Style");
+
+ return window_style;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog
new file mode 100644
index 00000000000..b689e3ac955
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ChangeLog
@@ -0,0 +1,50 @@
+2002-04-04 Dick Porter <dick@ximian.com>
+
+ * ISynchronizeInvoke.cs: Needed by Process
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * Win32Exception.cs: implement, with support for looking up
+ runtime errors.
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * Win32Exception.cs: Add.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * CategoryAttribute.cs, Component.cs, ComponentCollection.cs: MonoTODO.
+
+ * Container.cs, MemberDescriptor.cs, PropertyDescriptor.cs : Ditto.
+
+2001-10-27 Miguel de Icaza <miguel@ximian.com>
+
+ * DesignerSerializationVisibilityAttribute.cs: Implemented.
+
+ * DesignerSerializationVisibility.cs: New enumeration.
+
+ * LocalizableAttribute.cs: Implemented.
+
+ * BrowsableAttribute.cs: Implemented.
+
+ * DesignOnlyAttribute.cs: Implemented.
+
+ * DescriptionAttribute.cs: Implement.
+
+ * MemberDescriptor.cs: Implemented.
+
+ * CategoryAttribute.cs: implemented.
+
+2001-08-21 Nick Drochak <ndrochak@gol.com>
+
+ * Component.cs: Eliminated compile errors by removing redundant fields and
+ using the ISite member instead. Also raised the Disposed event, but not
+ sure if it's correct now. Look for FIXME in the comments.
+
+2001-08-02 Miguel de Icaza <miguel@ximian.com>
+
+ * EventHandlerList.cs: New file.
+
+ * Container.cs, Component.cs, IContainer.cs, IComponent.cs,
+ ComponentCollection.cs, ISite.cs: New classes
+
diff --git a/mcs/class/System/System.ComponentModel/Component.cs b/mcs/class/System/System.ComponentModel/Component.cs
new file mode 100644
index 00000000000..37649d05e8f
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/Component.cs
@@ -0,0 +1,126 @@
+//
+// System.ComponentModel.Component.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+ // <summary>
+ // Component class.
+ // </summary>
+ //
+ // <remarks>
+ // Longer description
+ // </remarks>
+ public class Component : MarshalByRefObject, IComponent, IDisposable {
+
+ EventHandlerList event_handlers;
+ ISite mySite;
+
+ // <summary>
+ // Component Constructor
+ // </summary>
+ public Component ()
+ {
+ event_handlers = null;
+ }
+
+ // <summary>
+ // Get IContainer of this Component
+ // </summary>
+ public IContainer Container {
+ get {
+ return mySite.Container;
+ }
+ }
+
+ protected bool DesignMode {
+ get {
+ return mySite.DesignMode;
+ }
+ }
+
+ protected EventHandlerList Events {
+ get {
+ // Note: space vs. time tradeoff
+ // We create the object here if it's never be accessed before. This potentially
+ // saves space. However, we must check each time the propery is accessed to
+ // determine whether we need to create the object, which increases overhead.
+ // We could put the creation in the contructor, but that would waste space
+ // if it were never used. However, accessing this property would be faster.
+ if (null == event_handlers)
+ {
+ event_handlers = new EventHandlerList();
+ }
+ return event_handlers;
+ }
+ }
+
+ public virtual ISite Site {
+ get {
+ return mySite;
+ }
+
+ set {
+ mySite = value;
+ }
+ }
+
+ [MonoTODO]
+ ~Component()
+ {
+ // FIXME: Not sure this is correct.
+ Dispose(true);
+ Disposed(this, EventArgs.Empty);
+ }
+
+ // <summary>
+ // Dispose resources used by this component
+ // </summary>
+ [MonoTODO]
+ public virtual void Dispose ()
+ {
+ // FIXME: Not sure this is correct.
+ Dispose(false);
+ Disposed(this, EventArgs.Empty);
+ }
+
+ // <summary>
+ // Controls disposal of resources used by this.
+ // </summary>
+ //
+ // <param name="release_all"> Controls which resources are released</param>
+ //
+ // <remarks>
+ // if release_all is set to true, both managed and unmanaged
+ // resources should be released. If release_all is set to false,
+ // only unmanaged resources should be disposed
+ // </remarks>
+ protected virtual void Dispose (bool release_all)
+ {
+ }
+
+ // <summary>
+ // Implements the IServiceProvider interface
+ // </summary>
+ [MonoTODO]
+ protected virtual object GetService (Type service)
+ {
+ // FIXME: Not sure what this should do.
+ return null;
+ }
+
+ // <summary>
+ // FIXME: Figure out this one.
+ // </summary>
+ [MonoTODO ("Figure this out")]
+ public event EventHandler Disposed;
+ }
+
+}
diff --git a/mcs/class/System/System.ComponentModel/ComponentCollection.cs b/mcs/class/System/System.ComponentModel/ComponentCollection.cs
new file mode 100644
index 00000000000..90fb081887d
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ComponentCollection.cs
@@ -0,0 +1,21 @@
+//
+// System.ComponentModel.ComponentCollection.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.ComponentModel {
+
+ [MonoTODO]
+ public class ComponentCollection { // FIXME: ReadOnlyCollectionBase
+
+ public void Dispose ()
+ {
+ }
+
+ }
+}
+
diff --git a/mcs/class/System/System.ComponentModel/Container.cs b/mcs/class/System/System.ComponentModel/Container.cs
new file mode 100644
index 00000000000..f1b6b58abb6
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/Container.cs
@@ -0,0 +1,159 @@
+//
+// System.ComponentModel.Container.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.ComponentModel {
+
+ // <summary>
+ // Container class: encapsulates components.
+ // </summary>
+ //
+ // <remarks>
+ //
+ // </remarks>
+ public class Container : IContainer, IDisposable {
+ ComponentCollection cc;
+
+ // <summary>
+ // Auxiliary class to support the default behaviour of CreateSite
+ // </summary>
+ //
+ // <remarks>
+ // This is an internal class that is used to provide a
+ // default implementation of an ISite class. Container
+ // is just a default implementation of IContainer, and
+ // provides this as a way of getting started
+ // </remarks>
+
+ class DefaultSite : ISite {
+ IComponent component;
+ IContainer container;
+ string name;
+
+ public DefaultSite (string name, IComponent component, IContainer container)
+ {
+ this.component = component;
+ this.container = container;
+ this.name = name;
+ }
+
+ public IComponent Component {
+ get {
+ return component;
+ }
+ }
+
+ public IContainer Container {
+ get {
+ return container;
+ }
+ }
+
+ [MonoTODO]
+ public bool DesignMode {
+ get {
+ // FIXME: should we provide a way to set
+ // this value?
+ return false;
+ }
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+
+ set {
+ name = value;
+ }
+ }
+
+ [MonoTODO]
+ public virtual object GetService (Type t)
+ {
+ // FIXME: do not know what this is supposed to do.
+ return null;
+ }
+ }
+
+ // <summary>
+ // Container constructor
+ // </summary>
+ public Container ()
+ {
+ }
+
+ public virtual ComponentCollection Components {
+ get {
+ return cc;
+ }
+ }
+
+ // <summary>
+ // Adds an IComponent to the Container
+ // </summary>
+ [MonoTODO]
+ public virtual void Add (IComponent component)
+ {
+ // FIXME: Add this component to the ComponentCollection.cc
+ }
+
+ // <summary>
+ // Adds an IComponent to the Container. With a name binding.
+ // </summary>
+ [MonoTODO]
+ public virtual void Add (IComponent component, string name)
+ {
+ // FIXME: Add this component to the ComponentCollection.cc
+ }
+
+ // <summary>
+ // Returns an ISite for a component.
+ // <summary>
+ protected virtual ISite CreateSite (IComponent component, string name)
+ {
+ return new DefaultSite (name, component, this);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ bool disposed = false;
+
+ protected virtual void Dispose (bool release_all)
+ {
+ if (disposed)
+ return;
+
+ if (release_all){
+ cc.Dispose ();
+ cc = null;
+ }
+
+ disposed = true;
+ }
+
+ [MonoTODO]
+ protected virtual object GetService (Type service)
+ {
+ // FIXME: Not clear what GetService does.
+
+ return null;
+ }
+
+ [MonoTODO]
+ public virtual void Remove (IComponent component)
+ {
+ // FIXME: Add this component to the ComponentCollection.cc
+ }
+ }
+
+}
diff --git a/mcs/class/System/System.ComponentModel/DescriptionAttribute.cs b/mcs/class/System/System.ComponentModel/DescriptionAttribute.cs
new file mode 100755
index 00000000000..03e6f411d78
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DescriptionAttribute.cs
@@ -0,0 +1,46 @@
+//
+// System.ComponentModel.DescriptionAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)]
+ public class DescriptionAttribute : Attribute {
+ string desc;
+
+ public DescriptionAttribute (string name)
+ {
+ desc = name;
+ }
+
+ public DescriptionAttribute ()
+ {
+ desc = "";
+ }
+
+ public virtual string Description {
+ get {
+ return DescriptionValue;
+ }
+ }
+
+ //
+ // Notice that the default Description implementation uses this by default
+ //
+ protected string DescriptionValue {
+ get {
+ return desc;
+ }
+
+ set {
+ desc = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs b/mcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs
new file mode 100755
index 00000000000..81b39db62f1
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs
@@ -0,0 +1,37 @@
+//
+// System.ComponentModel.DesignOnlyAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property)]
+ public sealed class DesignOnlyAttribute : Attribute {
+ bool design_only;
+
+ public static readonly DesignOnlyAttribute No;
+ public static readonly DesignOnlyAttribute Yes;
+
+ static DesignOnlyAttribute ()
+ {
+ No = new DesignOnlyAttribute (false);
+ Yes = new DesignOnlyAttribute (false);
+ }
+
+ public DesignOnlyAttribute (bool design_only)
+ {
+ this.design_only = design_only;
+ }
+
+ public bool IsDesignOnly {
+ get {
+ return design_only;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/DesignerSerializationVisibility.cs b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibility.cs
new file mode 100755
index 00000000000..d4291a842c8
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibility.cs
@@ -0,0 +1,16 @@
+//
+// System.ComponentModel.DesignerSerializationVisibility.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ public enum DesignerSerializationVisibility {
+ Hidden, Visible, Content
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/DesignerSerializationVisibilityAttribute.cs b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibilityAttribute.cs
new file mode 100755
index 00000000000..fd2fffec348
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibilityAttribute.cs
@@ -0,0 +1,42 @@
+//
+// System.ComponentModel.DesignerSerializationVisibilityAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property)]
+ public sealed class DesignerSerializationVisibilityAttribute : Attribute {
+ DesignerSerializationVisibility visibility;
+
+ static DesignerSerializationVisibilityAttribute ()
+ {
+ Content = new DesignerSerializationVisibilityAttribute (
+ DesignerSerializationVisibility.Content);
+ Hidden = new DesignerSerializationVisibilityAttribute (
+ DesignerSerializationVisibility.Hidden);
+ Visible = new DesignerSerializationVisibilityAttribute (
+ DesignerSerializationVisibility.Visible);
+ }
+
+ public DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility vis)
+ {
+ visibility = vis;
+ }
+
+ public static readonly DesignerSerializationVisibilityAttribute Content;
+ public static readonly DesignerSerializationVisibilityAttribute Hidden;
+ public static readonly DesignerSerializationVisibilityAttribute Visible;
+
+ public DesignerSerializationVisibility Visibility {
+ get {
+ return visibility;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/EventHandlerList.cs b/mcs/class/System/System.ComponentModel/EventHandlerList.cs
new file mode 100644
index 00000000000..dba45525db5
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/EventHandlerList.cs
@@ -0,0 +1,64 @@
+//
+// System.ComponentModel.EventHandlerList.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+
+namespace System.ComponentModel {
+
+ // <summary>
+ // List of Event delegates.
+ // </summary>
+ //
+ // <remarks>
+ // Longer description
+ // </remarks>
+ public sealed class EventHandlerList : IDisposable {
+ Hashtable table;
+
+ public EventHandlerList ()
+ {
+ }
+
+ public Delegate this [object key] {
+ get {
+ if (table == null)
+ return null;
+
+ return (Delegate) table [key];
+ }
+
+ set {
+ if (table == null)
+ table = new Hashtable ();
+
+ table.Add (key, value);
+ }
+ }
+
+ public void AddHandler (object key, Delegate value)
+ {
+ if (table == null)
+ table = new Hashtable ();
+
+ table.Add (key, value);
+ }
+
+ public void RemoveHandler (object key, Delegate value)
+ {
+ table.Remove (key);
+ }
+
+ public void Dispose ()
+ {
+ table = null;
+ }
+ }
+
+}
diff --git a/mcs/class/System/System.ComponentModel/IComponent.cs b/mcs/class/System/System.ComponentModel/IComponent.cs
new file mode 100644
index 00000000000..8b8fece74f1
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/IComponent.cs
@@ -0,0 +1,20 @@
+//
+// System.ComponentModel.IComponent.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.ComponentModel {
+
+ public interface IComponent : IDisposable {
+
+ ISite Site {
+ get; set;
+ }
+
+ event EventHandler Disposed;
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/IContainer.cs b/mcs/class/System/System.ComponentModel/IContainer.cs
new file mode 100644
index 00000000000..fb5d34f1ab6
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/IContainer.cs
@@ -0,0 +1,24 @@
+//
+// System.ComponentModel.IContainer.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.ComponentModel {
+
+ public interface IContainer {
+
+ ComponentCollection Components {
+ get;
+ }
+
+ void Add (IComponent component);
+
+ void Add (IComponent component, string name);
+
+ void Remove (IComponent component);
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/ISite.cs b/mcs/class/System/System.ComponentModel/ISite.cs
new file mode 100644
index 00000000000..0a7e09e8252
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ISite.cs
@@ -0,0 +1,21 @@
+//
+// System.ComponentModel.Component.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.ComponentModel {
+
+ public interface ISite : IServiceProvider {
+ IComponent Component { get; }
+
+ IContainer Container { get; }
+
+ bool DesignMode { get; }
+
+ string Name { get; set; }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/ISynchronizeInvoke.cs b/mcs/class/System/System.ComponentModel/ISynchronizeInvoke.cs
new file mode 100755
index 00000000000..e5cad4e0739
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/ISynchronizeInvoke.cs
@@ -0,0 +1,26 @@
+//
+// System.ComponentModel.ISynchronizeInvoke.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+ public interface ISynchronizeInvoke
+ {
+ bool InvokeRequired {
+ get;
+ }
+
+ IAsyncResult BeginInvoke(Delegate method, object[] args);
+
+ object EndInvoke(IAsyncResult result);
+
+ object Invoke(Delegate method, object[] args);
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/LocalizableAttribute.cs b/mcs/class/System/System.ComponentModel/LocalizableAttribute.cs
new file mode 100755
index 00000000000..b5425ef8e53
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/LocalizableAttribute.cs
@@ -0,0 +1,40 @@
+//
+// System.ComponentModel.LocalizableAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+ [AttributeUsage (AttributeTargets.Property)]
+ public sealed class LocalizableAttribute : Attribute {
+ bool localizable;
+
+ public static readonly LocalizableAttribute No;
+ public static readonly LocalizableAttribute Yes;
+
+ static LocalizableAttribute ()
+ {
+ No = new LocalizableAttribute (false);
+ Yes = new LocalizableAttribute (false);
+ }
+
+ public LocalizableAttribute (bool localizable)
+ {
+ this.localizable = localizable;
+ }
+
+ public bool IsLocalizable {
+ get {
+ return localizable;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/MemberDescriptor.cs b/mcs/class/System/System.ComponentModel/MemberDescriptor.cs
new file mode 100755
index 00000000000..2481bdffa7c
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/MemberDescriptor.cs
@@ -0,0 +1,120 @@
+//
+// System.ComponentModel.MemberDescriptor.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.ComponentModel {
+
+ public abstract class MemberDescriptor {
+ string name;
+ Attribute [] attrs;
+
+ protected MemberDescriptor (string name, Attribute [] attrs)
+ {
+ this.name = name;
+ this.attrs = attrs;
+ }
+
+ protected MemberDescriptor (MemberDescriptor reference, Attribute [] attrs)
+ {
+ name = reference.name;
+ this.attrs = attrs;
+ }
+
+ protected MemberDescriptor (string name)
+ {
+ this.name = name;
+ }
+
+ protected MemberDescriptor (MemberDescriptor reference)
+ {
+ name = reference.name;
+ attrs = reference.attrs;
+ }
+
+ protected virtual Attribute [] AttributeArray {
+ get {
+ return attrs;
+ }
+
+ set {
+ attrs = value;
+ }
+ }
+
+ // FIXME: Implement Attributes property
+ [MonoTODO ("Implement Attributes property too")]
+ public virtual string Category {
+ get {
+ foreach (Attribute attr in attrs){
+
+
+
+ if (attr is CategoryAttribute){
+ return ((CategoryAttribute) attr).Category;
+ }
+ }
+ return "Misc";
+ }
+ }
+
+ public virtual string Description {
+ get {
+ foreach (Attribute attr in attrs){
+ if (attr is DescriptionAttribute)
+ return ((DescriptionAttribute) attr).Description;
+ }
+
+ return "";
+ }
+ }
+
+ public virtual bool DesignTimeOnly {
+ get {
+ foreach (Attribute attr in attrs){
+ if (attr is DesignOnlyAttribute)
+ return ((DesignOnlyAttribute) attr).IsDesignOnly;
+ }
+
+ return false;
+ }
+ }
+
+ //
+ // FIXME: Is there any difference between DisplayName and Name?
+ //
+ [MonoTODO ("Does this diff from Name ?")]
+ public virtual string DisplayName {
+ get {
+ return name;
+ }
+ }
+
+ public virtual string Name {
+ get {
+ return name;
+ }
+ }
+
+ public virtual bool IsBrowsable {
+ get {
+ foreach (Attribute attr in attrs){
+ if (attr is BrowsableAttribute)
+ return ((BrowsableAttribute) attr).Browsable;
+ }
+
+ return false;
+ }
+ }
+
+ protected virtual int NameHashCode {
+ get {
+ return name.GetHashCode ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs b/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs
new file mode 100755
index 00000000000..4882c3b081e
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs
@@ -0,0 +1,114 @@
+//
+// System.ComponentModel.PropertyDescriptor.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+
+namespace System.ComponentModel {
+
+ public abstract class PropertyDescriptor : MemberDescriptor {
+
+ protected PropertyDescriptor (MemberDescriptor reference)
+ : base (reference)
+ {
+ }
+
+ protected PropertyDescriptor (MemberDescriptor reference, Attribute [] attrs)
+ : base (reference, attrs)
+ {
+ }
+
+ protected PropertyDescriptor (string name, Attribute [] attrs)
+ : base (name, attrs)
+ {
+ }
+
+ public abstract Type ComponentType { get; }
+
+ [MonoTODO]
+ public virtual TypeConverter Converter {
+ get {
+ // FIXME: Implement me.
+
+ return null;
+ }
+ }
+
+ public virtual bool IsLocalizable {
+ get {
+ foreach (Attribute attr in AttributeArray){
+ if (attr is LocalizableAttribute){
+ return ((LocalizableAttribute) attr).IsLocalizable;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ public abstract bool IsReadOnly { get; }
+
+ public abstract Type PropertyType { get; }
+
+ public DesignerSerializationVisibility SerializationVisibility {
+ get {
+ foreach (Attribute attr in AttributeArray){
+ if (attr is DesignerSerializationVisibilityAttribute){
+ DesignerSerializationVisibilityAttribute a;
+
+ a = (DesignerSerializationVisibilityAttribute) attr;
+
+ return a.Visibility;
+ }
+ }
+
+ //
+ // Is this a good default if we cant find the property?
+ //
+ return DesignerSerializationVisibility.Hidden;
+ }
+ }
+
+ Hashtable notifiers;
+
+ public virtual void AddValueChanged (object component, EventHandler handler)
+ {
+ EventHandler component_notifiers;
+
+ if (component == null)
+ throw new ArgumentNullException ("component");
+
+ if (handler == null)
+ throw new ArgumentNullException ("handler");
+
+ if (notifiers == null)
+ notifiers = new Hashtable ();
+
+ component_notifiers = (EventHandler) notifiers [component];
+
+ if (component_notifiers != null)
+ component_notifiers += handler;
+ else
+ notifiers [component] = handler;
+ }
+
+ protected virtual void OnValueChanged (object component, EventArgs e)
+ {
+ if (notifiers == null)
+ return;
+
+ EventHandler component_notifiers = (EventHandler) notifiers [component];
+
+ if (component_notifiers == null)
+ return;
+
+ component_notifiers (component, e);
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/TypeConverter.cs b/mcs/class/System/System.ComponentModel/TypeConverter.cs
new file mode 100755
index 00000000000..caeb21a138d
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/TypeConverter.cs
@@ -0,0 +1,8 @@
+//
+// Nothing implemented yet
+//
+namespace System.ComponentModel {
+
+ public class TypeConverter {
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/Win32Exception.cs b/mcs/class/System/System.ComponentModel/Win32Exception.cs
new file mode 100755
index 00000000000..b6125ddd274
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel/Win32Exception.cs
@@ -0,0 +1,84 @@
+//
+// System.ComponentModel.Win32Exceptioncs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+using System.Collections;
+using System.Globalization;
+
+namespace System.ComponentModel
+{
+ [Serializable]
+ public class Win32Exception : ExternalException
+ {
+ private int native_error_code;
+
+ public Win32Exception ()
+ : base (W32ErrorMessage(Marshal.GetLastWin32Error()),
+ Marshal.GetLastWin32Error()) {
+ native_error_code=Marshal.GetLastWin32Error();
+ }
+
+ public Win32Exception(int error)
+ : base (W32ErrorMessage(error), error) {
+ native_error_code=error;
+ }
+
+ public Win32Exception(int error, string message)
+ : base (message, error) {
+ native_error_code=error;
+ }
+
+ protected Win32Exception(SerializationInfo info,
+ StreamingContext context)
+ : base (info, context) {
+ }
+
+ public int NativeErrorCode {
+ get {
+ return(native_error_code);
+ }
+ }
+
+ [MonoTODO]
+ public override void GetObjectData(SerializationInfo info,
+ StreamingContext context) {
+ if(info==null) {
+ throw new ArgumentNullException();
+ }
+
+ throw new NotImplementedException();
+ }
+
+ private static Hashtable w32_errors = new Hashtable();
+
+ /* Initialise the list of error strings */
+ static Win32Exception() {
+ /* No need to list everything, just the ones
+ * the runtime can throw
+ */
+ w32_errors.Add(10047,
+ Locale.GetText("AF not supported"));
+ w32_errors.Add(10043,
+ Locale.GetText("proto no supported"));
+ w32_errors.Add(10044,
+ Locale.GetText("socket not supproted"));
+ }
+
+ private static string W32ErrorMessage(int error_code) {
+ string message=(string)w32_errors[error_code];
+
+ if(message==null) {
+ return(Locale.GetText("Some sort of w32 error occurred"));
+ } else {
+ return(message);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Configuration/ChangeLog b/mcs/class/System/System.Configuration/ChangeLog
new file mode 100644
index 00000000000..acc2a035a7e
--- /dev/null
+++ b/mcs/class/System/System.Configuration/ChangeLog
@@ -0,0 +1,25 @@
+2002-01-31 Duncan Mak <duncan@ximian.com>
+
+ * ConfigurationException.cs: Rewrote most of the file and added
+ serialization bits.
+
+2002-01-06 Ravi Pratap <ravi@ximian.com>
+
+ * ConfigurationSettings.cs, IgnoreSectionHandler.cs : MonoTODO decoration
+
+ * SingleTagSectionHandler.cs, DictionarySectionHandler.cs,
+ NameValueSectionHandler.cs : Ditto.
+
+2001-08-28 Christopher Podurgiel <cpodurgiel@msn.com>
+ * IConfigurationSectionHandler.cs: Added reference to System.Xml.
+
+ * SingleTagSectionHandler.cs: Added Implementation of Create() method.
+
+ * NameValueSectionHandler.cs: Added Implementation of Create() method.
+
+ * ConfigurationException.cs: Now returns proper message rather than "System Exception".
+
+2001-08-26 Christopher Podurgiel <cpodurgiel@msn.com>
+
+ * ConfigurationSettings.cs: No longer references the NameValueSectionHandler directly. Instead it uses System.Reflection to call the Create() method for the appropriate SectionHandler as defined in the .config file.
+
diff --git a/mcs/class/System/System.Configuration/ConfigurationException.cs b/mcs/class/System/System.Configuration/ConfigurationException.cs
new file mode 100644
index 00000000000..9b23ee88352
--- /dev/null
+++ b/mcs/class/System/System.Configuration/ConfigurationException.cs
@@ -0,0 +1,132 @@
+//
+// System.Configuration.ConfigurationException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Xml;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Configuration
+{
+ [Serializable]
+ public class ConfigurationException : SystemException
+ {
+ // Fields
+ string bareMessage;
+ string filename;
+ int line;
+
+ //
+ // Constructors
+ //
+ public ConfigurationException ()
+ : base (Locale.GetText ("There is an error in a configuration setting."))
+ {
+ filename = null;
+ bareMessage = Locale.GetText ("There is an error in a configuration setting.");
+ line = 0;
+ }
+
+ public ConfigurationException (string message)
+ : base (message)
+ {
+ bareMessage = message;
+ }
+
+ protected ConfigurationException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ filename = info.GetString ("filename");
+ line = info.GetInt32 ("line");
+ }
+
+ public ConfigurationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ bareMessage = message;
+ }
+
+ public ConfigurationException (string message, XmlNode node)
+ : base (message)
+ {
+ filename = GetXmlNodeFilename(node);
+ line = GetXmlNodeLineNumber(node);
+ bareMessage = message;
+ }
+
+ public ConfigurationException (string message, Exception inner, XmlNode node)
+ : base (message, inner)
+ {
+ filename = GetXmlNodeFilename (node);
+ line = GetXmlNodeLineNumber (node);
+ bareMessage = message;
+ }
+
+ public ConfigurationException (string message, string filename, int line)
+ : base (message)
+ {
+ bareMessage = message;
+ this.filename = filename;
+ this.line= line;
+ }
+
+ public ConfigurationException (string message, Exception inner, string filename, int line)
+ : base (message)
+ {
+ bareMessage = message;
+ this.filename = filename;
+ this.line = line;
+ }
+ //
+ // Properties
+ //
+ public string BareMessage
+ {
+ get { return bareMessage; }
+ }
+
+ public string Filename
+ {
+ get { return filename; }
+ }
+
+ public int Line
+ {
+ get { return line; }
+ }
+
+ public override string Message
+ {
+ get { return filename + " " + line; }
+ }
+
+ //
+ // Methods
+ //
+ [MonoTODO]
+ // Not sure if that's the correct return value.
+ public static string GetXmlNodeFilename (XmlNode node)
+ {
+ return node.OwnerDocument.Name;
+ }
+
+ [MonoTODO]
+ public static int GetXmlNodeLineNumber (XmlNode node)
+ {
+ return 0;
+ }
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("filename", filename);
+ info.AddValue ("line", line);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Configuration/ConfigurationSettings.cs b/mcs/class/System/System.Configuration/ConfigurationSettings.cs
new file mode 100644
index 00000000000..ba5ccf02ad0
--- /dev/null
+++ b/mcs/class/System/System.Configuration/ConfigurationSettings.cs
@@ -0,0 +1,198 @@
+//
+// System.Configuration.ConfigurationSettings.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// C) Christopher Podurgiel
+//
+
+using System;
+using System.Collections.Specialized;
+using System.Reflection;
+using System.Xml;
+using System.Xml.XPath;
+
+namespace System.Configuration
+{
+ /// <summary>
+ /// Component class.
+ /// </summary>
+ /// <remarks>
+ /// Longer description
+ /// </remarks>
+
+ public sealed class ConfigurationSettings
+ {
+
+ private static string applicationConfigFileName;
+
+ /// <summary>
+ /// ConfigurationSettings Constructor.
+ /// </summary>
+ private ConfigurationSettings ()
+ {
+
+ }
+
+ /// <summary>
+ /// Returns configuration settings for a user-defined configuration section.
+ /// </summary>
+ /// <param name="sectionName">The name of the configuration section that configuration settings are read from.</param>
+ /// <returns></returns>
+ public static object GetConfig(string sectionName)
+ {
+ //Create an instance of an XML Document.
+ XmlDocument ConfigurationDocument = new XmlDocument();
+
+ /*
+ * LAMESPEC: The .config file that needs to be parsed is the name of the application, plus ".config"
+ * ie. "Myapplication.exe.config"
+ * The only way I could find to get the name of the application is through System.Forms.Application.ExecutablePath, this
+ * may be an incorrect way to get this information. It works properly on a windows machine when building an executable,
+ * however, I'm not sure how this would work under other platforms.
+ */
+ //Get the full path to the Applicaton Configuration File.
+ applicationConfigFileName = "FIXME:ConfigurationSettings" + ".config";
+
+ //Try to load the XML Document.
+ try
+ {
+ ConfigurationDocument.Load(applicationConfigFileName);
+ }
+ catch(XmlException e)
+ {
+ //Error loading the XML Document. Throw a ConfigurationException.
+ throw(new ConfigurationException(e.Message, applicationConfigFileName, e.LineNumber));
+ }
+
+ string sectionHandlerName = GetSectionHanderType(ConfigurationDocument, sectionName);
+
+ XmlNode sectionNode = ConfigurationDocument.SelectSingleNode("/configuration/" + sectionName);
+
+
+
+ //If the specified sectionName is not found, then sectionNode will be null. When calling objNVSHandler.Create(),
+ //sectionNode cannot be null.
+ if(sectionNode == null)
+ {
+ return null;
+ }
+
+
+ //Create a new SectionHandler
+
+ //According to the Docs provided by Microsoft, the user can create their own configuration sections, and create a custom
+ //handler class for it. The user would specify the class and its assebly in the <configSections> section. These would be
+ //seperated by a comma.
+
+ string sectionHandlerClassName = sectionHandlerName;
+ string sectionHandlerAssemblyName = "System";
+
+ //Split the SectionHandler Class Name from the Assembly Name (if provided).
+ string[] sectionHandlerArray = sectionHandlerName.Split(new char[]{','}, 2);
+ if(sectionHandlerArray.Length == 2)
+ {
+ sectionHandlerClassName = sectionHandlerArray[0];
+ sectionHandlerAssemblyName = sectionHandlerArray[1];
+ }
+
+ // Load the assembly to use.
+ Assembly assem = Assembly.Load(sectionHandlerAssemblyName);
+ //Get the class type.
+ Type handlerObjectType = assem.GetType(sectionHandlerClassName);
+ //Get a reference to the method "Create"
+ MethodInfo createMethod = handlerObjectType.GetMethod("Create");
+ //Create an Instance of this SectionHandler.
+ Object objSectionHandler = Activator.CreateInstance(handlerObjectType);
+
+ //define the arguments to be passed to the "Create" Method.
+ Object[] args = new Object[3];
+ args[0] = null;
+ args[1] = null;
+ args[2] = sectionNode;
+
+ object sectionHandlerCollection = createMethod.Invoke(objSectionHandler, args);
+
+ //Return the collection
+ return sectionHandlerCollection;
+
+ }
+
+
+ /// <summary>
+ /// Gets the name of the SectionHander Class that will handle this section.
+ /// </summary>
+ /// <param name="xmlDoc">An xml Configuration Document.</param>
+ /// <param name="sectionName">The name of the configuration section that configuration settings are read from.</param>
+ /// <returns>The name of the Handler Object for this configuration section, including the name if its Assembly.</returns>
+ [MonoTODO]
+ private static string GetSectionHanderType(XmlDocument xmlDoc, string sectionName)
+ {
+ //TODO: This method does not account for sectionGroups yet.
+ string handlerName = null;
+
+ //<appSettings> is a predefined configuration section. It does not have a definition
+ // in the <configSections> section, and will always be handled by the NameValueSectionHandler.
+ if(sectionName == "appSettings")
+ {
+ handlerName = "System.Configuration.NameValueSectionHandler";
+ }
+ else
+ {
+
+ string[] sectionPathArray = sectionName.Split(new char[]{'/'});
+
+ //Build an XPath statement.
+ string xpathStatement = "/configuration/configSections";
+ for (int i=0; i < sectionPathArray.Length; i++)
+ {
+ if(i < sectionPathArray.Length - 1)
+ {
+ xpathStatement = xpathStatement + "/sectionGroup[@name='" + sectionPathArray[i] + "']";
+ }
+ else
+ {
+ xpathStatement = xpathStatement + "/section[@name='" + sectionPathArray[i] + "']";
+ }
+ }
+
+ //Get all of the <section> node using the xpath statement.
+ XmlNode sectionNode = xmlDoc.SelectSingleNode(xpathStatement);
+
+ // if this section isn't found, then there was something wrong with the config document,
+ // or the sectionName didn't have a proper definition.
+ if(sectionNode == null)
+ {
+
+ throw (new ConfigurationException("Unrecognized element."));
+ }
+
+ handlerName = sectionNode.Attributes["type"].Value;
+
+ }
+
+ //Return the name of the handler.
+ return handlerName;
+ }
+
+
+
+ /// <summary>
+ /// Get the Application Configuration Settings.
+ /// </summary>
+ public static NameValueCollection AppSettings
+ {
+ get
+ {
+ //Get the Configuration Settings for the "appSettings" section.
+ NameValueCollection appSettings = (NameValueCollection)GetConfig("appSettings");;
+
+ return appSettings;
+ }
+ }
+
+ }
+}
+
+
diff --git a/mcs/class/System/System.Configuration/DictionarySectionHandler.cs b/mcs/class/System/System.Configuration/DictionarySectionHandler.cs
new file mode 100644
index 00000000000..f48eea8f38a
--- /dev/null
+++ b/mcs/class/System/System.Configuration/DictionarySectionHandler.cs
@@ -0,0 +1,91 @@
+
+//
+// System.Configuration.DictionarySectionHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+using System;
+using System.Collections.Specialized;
+using System.Xml;
+
+namespace System.Configuration
+{
+ /// <summary>
+ /// Summary description for DictionarySectionHandler.
+ /// </summary>
+ public class DictionarySectionHandler : IConfigurationSectionHandler
+ {
+ private static string _stringKeyName;
+ private static string _stringValueName;
+
+ /// <summary>
+ /// DictionarySectionHandler Constructor
+ /// </summary>
+ public DictionarySectionHandler()
+ {
+ //Set Default Values.
+ _stringKeyName = "key";
+ _stringValueName = "value";
+ }
+
+ /// <summary>
+ /// Creates a new DictionarySectionHandler object and adds the object to the collection.
+ /// </summary>
+ /// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
+ /// <param name="context">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
+ /// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
+ /// <returns></returns>
+ [MonoTODO]
+ public virtual object Create(object parent, object context, XmlNode section)
+ {
+ //FIXME: Enter a meaningful error message
+ if(section == null)
+ { throw new ConfigurationException("XML Node can not be null."); }
+
+ //FIXME: Enter a meaningful error message
+ if(parent == null)
+ { throw new ConfigurationException("", section); }
+
+
+ DictionarySectionHandler objHandler = new DictionarySectionHandler();
+ NameValueCollection objCollection;
+
+ //Unbox parent as a NameValueCollection type.
+ objCollection=(NameValueCollection)parent;
+
+ objCollection.Add(section.Attributes[_stringKeyName].Value, section.Attributes[_stringValueName].Value);
+
+ return null;
+
+ //FIXME: this code is far form complete, probably not even correct.
+
+ }
+
+ /// <summary>
+ /// Gets the name of the key attribute tag. This property is overidden by derived classes to change
+ /// the name of the key attribute tag. The default is "key".
+ /// </summary>
+ protected virtual string KeyAttributeName
+ {
+ get
+ {
+ return _stringKeyName;
+ }
+ }
+
+ /// <summary>
+ /// Gets the name of the value tag. This property may be overidden by derived classes to change
+ /// the name of the value tag. The default is "value".
+ /// </summary>
+ protected virtual string ValueAttributeName
+ {
+ get
+ {
+ return _stringValueName;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Configuration/IConfigurationSectionHandler.cs b/mcs/class/System/System.Configuration/IConfigurationSectionHandler.cs
new file mode 100644
index 00000000000..d3eae0ad018
--- /dev/null
+++ b/mcs/class/System/System.Configuration/IConfigurationSectionHandler.cs
@@ -0,0 +1,27 @@
+//
+// System.Configuration.IConfigurationSectionHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+using System;
+using System.Xml;
+namespace System.Configuration
+{
+ /// <summary>
+ /// Summary description for IConfigurationSectionHandler.
+ /// </summary>
+ public interface IConfigurationSectionHandler
+ {
+ /// <summary>
+ /// Creates a new configuration handler and adds the specified configuration object to the collection.
+ /// </summary>
+ /// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
+ /// <param name="configContext">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
+ /// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
+ /// <returns></returns>
+ object Create(object parent, object configContext, XmlNode section);
+ }
+}
diff --git a/mcs/class/System/System.Configuration/IgnoreSectionHandler.cs b/mcs/class/System/System.Configuration/IgnoreSectionHandler.cs
new file mode 100644
index 00000000000..4a0f558b395
--- /dev/null
+++ b/mcs/class/System/System.Configuration/IgnoreSectionHandler.cs
@@ -0,0 +1,45 @@
+//
+// System.Configuration.IgnoreSectionHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+using System.Xml;
+
+namespace System.Configuration
+{
+ /// <summary>
+ /// Summary description for IgnoreSectionHandler.
+ /// </summary>
+ public class IgnoreSectionHandler : IConfigurationSectionHandler
+ {
+ /// <summary>
+ /// IgnoreSectionHandler Constructor
+ /// </summary>
+ [MonoTODO]
+ public IgnoreSectionHandler()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ /// <summary>
+ /// Creates a new configuration handler and adds the specified configuration object to the collection.
+ /// </summary>
+ /// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
+ /// <param name="configContext">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
+ /// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
+ /// <returns></returns>
+ [MonoTODO]
+ public virtual object Create(object parent, object configContext, XmlNode section)
+ {
+ //FIXME: Add Implemetation code here.
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Configuration/NameValueSectionHandler.cs b/mcs/class/System/System.Configuration/NameValueSectionHandler.cs
new file mode 100644
index 00000000000..0e88bf44950
--- /dev/null
+++ b/mcs/class/System/System.Configuration/NameValueSectionHandler.cs
@@ -0,0 +1,107 @@
+//
+// System.Configuration.NameValueSectionHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+using System;
+using System.Xml;
+using System.Collections.Specialized;
+
+namespace System.Configuration
+{
+ /// <summary>
+ /// Summary description for NameValueSectionHandler.
+ /// </summary>
+ public class NameValueSectionHandler
+ {
+ private static string keyName;
+ private static string valueName;
+ private static NameValueCollection settingsCollection;
+
+
+ /// <summary>
+ /// NameValueSectionHandler Constructor
+ /// </summary>
+ public NameValueSectionHandler()
+ {
+ //Set Default Values.
+ keyName = "key";
+ valueName = "value";
+
+ settingsCollection = new NameValueCollection();
+
+ }
+
+ /// <summary>
+ /// Creates a new configuration handler and adds the specified configuration object to the collection.
+ /// </summary>
+ /// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
+ /// <param name="context">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
+ /// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
+ /// <returns></returns>
+ [MonoTODO]
+ public object Create(object parent, object context, XmlNode section)
+ {
+ //FIXME: I'm not quite sure how to implement 'parent' or 'context'.
+
+
+ //Get all of the ChildNodes in the XML section.
+ XmlNodeList childNodeList = section.ChildNodes;
+
+ //loop throught the ChildNodes
+ for (int i=0; i < childNodeList.Count; i++)
+ {
+ XmlNode childNode = childNodeList[i];
+
+ //if the name of this childNode is not 'add' then throw a ConfigurationException.
+ if(childNode.Name != "add")
+ {
+ throw (new ConfigurationException("Unrecognized element"));
+ }
+
+ //Get the attributes for the childNode
+ XmlAttributeCollection xmlAttributes = childNode.Attributes;
+
+ //Get the key and value Attributes by their Name
+ XmlAttribute keyAttribute = xmlAttributes[keyName];
+ XmlAttribute valueAttribute = xmlAttributes[valueName];
+
+ //Add this Key/Value Pair to the collection
+ settingsCollection.Add(keyAttribute.Value, valueAttribute.Value);
+
+ }
+
+
+ //FIXME: Something is missing here. MS's version of this method returns a System.Configuration.ReadOnlyNameValueCollection type,
+ //this class id not documented ANYWHERE. This method is curretly returning a NameValueCollection, but it should be ReadOnly.
+
+ return settingsCollection;
+ }
+
+ /// <summary>
+ /// Gets the name of the key in the key-value pair.
+ /// </summary>
+ protected virtual string KeyAttributeName
+ {
+ get
+ {
+ return keyName;
+ }
+ }
+
+ /// <summary>
+ /// Gets the value for the key in the key-value pair.
+ /// </summary>
+ protected virtual string ValueAttributeName
+ {
+ get
+ {
+ return valueName;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Configuration/SingleTagSectionHandler.cs b/mcs/class/System/System.Configuration/SingleTagSectionHandler.cs
new file mode 100644
index 00000000000..601ed10d82a
--- /dev/null
+++ b/mcs/class/System/System.Configuration/SingleTagSectionHandler.cs
@@ -0,0 +1,64 @@
+//
+// System.Configuration.SingleTagSectionHandler.cs
+//
+// Author:
+// Christopher Podurgiel (cpodurgiel@msn.com)
+//
+// (C) Chris Podurgiel
+//
+
+using System;
+using System.Xml;
+using System.Collections;
+
+
+namespace System.Configuration
+{
+ /// <summary>
+ /// Summary description for SingleTagSectionHandler.
+ /// </summary>
+ public class SingleTagSectionHandler : IConfigurationSectionHandler
+ {
+
+ [MonoTODO]
+ public SingleTagSectionHandler()
+ {
+ //
+ // TODO: Add constructor logic here
+ //
+ }
+
+ /// <summary>
+ /// Returns a collection of configuration section values.
+ /// </summary>
+ /// <param name="parent"></param>
+ /// <param name="context"></param>
+ /// <param name="section">The name of the configuration section.</param>
+ /// <returns></returns>
+ [MonoTODO]
+ public virtual object Create(object parent, object context, XmlNode section)
+ {
+ //FIXME: I'm not quite sure how to implement 'parent' or 'context'.
+ //TODO: Add in proper Error Handling.
+
+ //Get all of the ChildNodes in the XML section.
+ if(section.HasChildNodes)
+ {
+ throw (new ConfigurationException("Child Nodes not allowed."));
+ }
+
+
+ //Get the attributes for the childNode
+ XmlAttributeCollection xmlAttributes = section.Attributes;
+
+ Hashtable settingsCollection = new Hashtable();
+
+ for(int i=0; i < xmlAttributes.Count; i++)
+ {
+ settingsCollection.Add(xmlAttributes[i].Name, xmlAttributes[i].Value);
+ }
+
+ return settingsCollection;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/BooleanSwitch.cs b/mcs/class/System/System.Diagnostics/BooleanSwitch.cs
new file mode 100755
index 00000000000..e4f83292d55
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/BooleanSwitch.cs
@@ -0,0 +1,59 @@
+//
+// System.Diagnostics.BooleanSwitch.cs
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+//
+// (C) 2001
+//
+
+namespace System.Diagnostics
+{
+ /// <summary>
+ /// Provides a simple on/off switch that controls debuggina
+ /// and tracing output
+ /// </summary>
+ public class BooleanSwitch : Switch
+ {
+ /// <summary>
+ /// Initializes a new instance
+ /// </summary>
+ public BooleanSwitch(string displayName, string description)
+ : base(displayName, description)
+ {
+ SwitchSetting = (int)BooleanSwitchSetting.False;
+ }
+
+ // =================== Properties ===================
+
+ /// <summary>
+ /// Specifies whether the switch is enabled or disabled
+ /// </summary>
+ public bool Enabled
+ {
+ get
+ {
+ if((int)BooleanSwitchSetting.False == SwitchSetting) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+ set
+ {
+ if(value) {
+ SwitchSetting = (int)BooleanSwitchSetting.True;
+ }
+ else {
+ SwitchSetting = (int)BooleanSwitchSetting.False;
+ }
+ }
+ }
+
+ private enum BooleanSwitchSetting : int {
+ True = 1, False = 0
+ }
+ }
+
+}
diff --git a/mcs/class/System/System.Diagnostics/ChangeLog b/mcs/class/System/System.Diagnostics/ChangeLog
new file mode 100644
index 00000000000..38a6eae98c9
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ChangeLog
@@ -0,0 +1,72 @@
+2002-04-10 Jonathan Pryor <jonpryor@vt.edu>
+
+ * TraceListenerCollection.cs: Corrected indexer property to provide the
+ correct return value and implement the IList indexer property correctly.
+
+2002-04-07 Jonathan Pryor <jonpryor@vt.edu>
+
+ * TraceListener.cs: Fix stack overflow bug
+ * DefaultTraceListener.cs: Implement log file support
+
+2002-04-04 Dick Porter <dick@ximian.com>
+
+ * ThreadWaitReason.cs:
+ * ThreadState.cs:
+ * ThreadPriorityLevel.cs:
+ * ProcessWindowStyle.cs:
+ * ProcessThreadCollection.cs
+ * ProcessThread.cs:
+ * ProcessStartInfo.cs:
+ * ProcessModuleCollection.cs: Stub out more classes needed for Process
+
+2002-03-31 Dick Porter <dick@ximian.com>
+
+ * Process.cs:
+ * ProcessPriorityClass.cs:
+ * ProcessModule.cs:
+ * FileVersionInfo.cs: Stub out classes needed for Process
+
+2002-03-08 Jonathan Pryor <jonpryor@vt.edu>
+
+ * Debug.cs: Clean up (lots of code can be shared with Trace.cs, which
+ is why TraceImpl.cs is introduced), "DEBUG" conditional support
+ * TraceListener.cs: Proper implementation of Dispose pattern;
+ implementatino of non-abstract methods in terms of abstract methods
+ * TraceListenerCollection.cs: check 'object' types before adding
+ * TextWriterTraceListener.cs: properly implement Dispose pattern;
+ handle NeedIndent and WriteIndent
+ * Trace.cs: new file; provides Trace functionality, "TRACE" conditional
+ support
+ * DefaultTraceListener.cs: new file; the default trace listener
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * TraceListenerCollection.cs: Remove Warnings.
+
+2002-01-06 Ravi Pratap <ravi@ximian.com>
+
+ * Switch.cs, TraceListenerCollection.cs : Decorate incomplete bits
+ with the MonoTODO attribute.
+
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Added Debug.cs to the build.
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Added preliminary TraceListenerCollection.cs to the build.
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Added TraceListener.cs, TextWriterTraceListener.cs, and
+ DefaultTraceListener.cs to the build and moved them into the
+ proper assembly.
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Added DiagnosticsConfigurationHandler.cs to the build.
+
+2001-09-09 Nick Drochak <ndrochak@gol.com>
+
+ * BooleanSwitch.cs: Make this class use it's parent class's features. Namely, use SwitchSetting
+ so that we can get OnSwitchSettingChanged() to fire for free.
+
+2001-09-09 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: added this file
+
+ * Switch.cs: call OnSwitchSettingChanged() when the switch setting is, yes you gessed it, changed.
+
diff --git a/mcs/class/System/System.Diagnostics/Debug.cs b/mcs/class/System/System.Diagnostics/Debug.cs
new file mode 100644
index 00000000000..6ed9073de05
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/Debug.cs
@@ -0,0 +1,307 @@
+//
+// System.Diagnostics.Debug.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original
+// implementation.
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ /// <summary>
+ /// Provides a set of methods to help debug code
+ /// </summary>
+ public sealed class Debug {
+
+ private Debug () {}
+
+ /// <summary>
+ /// Gets or sets value indicating whether Flush should
+ /// be called on the listeners.
+ /// </summary>
+ public static bool AutoFlush {
+ get {return TraceImpl.AutoFlush;}
+ set {TraceImpl.AutoFlush = value;}
+ }
+
+ /// <summary>
+ /// Gets or sets indent level
+ /// </summary>
+ public static int IndentLevel {
+ get {return TraceImpl.IndentLevel;}
+ set {TraceImpl.IndentLevel = value;}
+ }
+
+ /// <summary>
+ /// The number of spaces in an indent.
+ /// </summary>
+ public static int IndentSize {
+ get {return TraceImpl.IndentSize;}
+ set {TraceImpl.IndentSize = value;}
+ }
+
+ /// <summary>
+ /// Returns the listeners collection
+ /// </summary>
+ public static TraceListenerCollection Listeners {
+ get {return TraceImpl.Listeners;}
+ }
+
+ /// <summary>
+ /// Checks for a condition, and prints a stack trace
+ /// if the condition is false.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Assert (bool condition)
+ {
+ TraceImpl.Assert (condition);
+ }
+
+ /// <summary>
+ /// Checks for a condition, and displays a message if the condition
+ /// is false.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Assert (bool condition, string message)
+ {
+ TraceImpl.Assert (condition, message);
+ }
+
+ /// <summary>
+ /// Checks for a condtion, and displays a message and a detailed message
+ /// string if the condition is false.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Assert (bool condition, string message,
+ string detailMessage)
+ {
+ TraceImpl.Assert (condition, message, detailMessage);
+ }
+
+ /// <summary>
+ /// Closes the Debug buffer
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Close ()
+ {
+ TraceImpl.Close ();
+ }
+
+ /// <summary>
+ /// Emits the specified error message.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Fail (string message)
+ {
+ TraceImpl.Fail (message);
+ }
+
+ /// <summary>
+ /// Emits the specified error message and detailed error message.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Fail (string message, string detailMessage)
+ {
+ TraceImpl.Fail (message, detailMessage);
+ }
+
+ /// <summary>
+ /// Flushes the listeners
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Flush ()
+ {
+ TraceImpl.Flush ();
+ }
+
+ /// <summary>
+ /// Increments the indent level
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Indent ()
+ {
+ TraceImpl.Indent ();
+ }
+
+ /// <summary>
+ /// Decrements the indent level
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Unindent ()
+ {
+ TraceImpl.Unindent ();
+ }
+
+ /// <summary>
+ /// Writes the value of the specified object's ToString method
+ /// to the listeners.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Write (object value)
+ {
+ TraceImpl.Write (value);
+ }
+
+ /// <summary>
+ /// Writes the specified message to each listener in the Listeners
+ /// collection.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Write (string message)
+ {
+ TraceImpl.Write (message);
+ }
+
+ /// <summary>
+ /// Writes the category name and value of the specified object's
+ /// ToString method to each listener in the Listeners collection.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Write (object value, string category)
+ {
+ TraceImpl.Write (value, category);
+ }
+
+ /// <summary>
+ /// Writes the category name and the specified message
+ /// to each listener in the Listeners collection.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void Write (string message, string category)
+ {
+ TraceImpl.Write (message, category);
+ }
+
+ /// <summary>
+ /// Writes the value of the specified object's ToString method
+ /// to each of the listeners if the condition is true.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteIf (bool condition, object value)
+ {
+ TraceImpl.WriteIf (condition, value);
+ }
+
+ /// <summary>
+ /// Writes the specified message to each of the listeners
+ /// if the specified condition is true.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteIf (bool condition, string message)
+ {
+ TraceImpl.WriteIf (condition, message);
+ }
+
+ /// <summary>
+ /// Writes the value of the specified object's ToString message
+ /// and category to each of the listeners if the condition is true.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteIf (bool condition, object value,
+ string category)
+ {
+ TraceImpl.WriteIf (condition, value, category);
+ }
+
+ /// <summary>
+ /// Writes the category and specified message to each listener
+ /// if the specified condition is true.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteIf (bool condition, string message,
+ string category)
+ {
+ TraceImpl.WriteIf (condition, message, category);
+ }
+
+ /// <summary>
+ /// Writes the value of the object's ToString method,
+ /// followed by a line terminator, to each listener.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteLine (object value)
+ {
+ TraceImpl.WriteLine (value);
+ }
+
+ /// <summary>
+ /// Writes the specified message, followed by a line terminator,
+ /// to each listener.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteLine (string message)
+ {
+ TraceImpl.WriteLine (message);
+ }
+
+ /// <summary>
+ /// Writes the value of the specified object's ToString method,
+ /// along with a category, followed by a line terminator, to each listener.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteLine (object value, string category)
+ {
+ TraceImpl.WriteLine (value, category);
+ }
+
+ /// <summary>
+ /// Writes the specified category and message, followed by a line
+ /// terminator, to each listener.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteLine (string message, string category)
+ {
+ TraceImpl.WriteLine (message, category);
+ }
+
+ /// <summary>
+ /// Writes the value of the object's ToString method
+ /// to each listener if the specified condition is true.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteLineIf (bool condition, object value)
+ {
+ TraceImpl.WriteLineIf (condition, value);
+ }
+
+ /// <summary>
+ /// Writes the specified message to each listener
+ /// if the specified condition is true.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteLineIf (bool condition, string message)
+ {
+ TraceImpl.WriteLineIf (condition, message);
+ }
+
+ /// <summary>
+ /// Writes the value of the object's ToString method, and a category
+ /// to each listener if the specified condition is true.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteLineIf (bool condition, object value,
+ string category)
+ {
+ TraceImpl.WriteLineIf (condition, value, category);
+ }
+
+ /// <summary>
+ /// Writes the specified category and message to each listener, followed
+ /// by a line terminator, if the specified condition is true.
+ /// </summary>
+ [Conditional("DEBUG")]
+ public static void WriteLineIf (bool condition, string message,
+ string category)
+ {
+ TraceImpl.WriteLineIf (condition, message, category);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs b/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs
new file mode 100644
index 00000000000..1ec98c95b6b
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/DefaultTraceListener.cs
@@ -0,0 +1,166 @@
+//
+// System.Diagnostics.DefaultTraceListener.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original
+// implementation.
+//
+// (C) 2002 Jonathan Pryor
+//
+
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace System.Diagnostics {
+
+ /// <summary>
+ /// Provides the default output methods and behavior for tracing.
+ /// </summary>
+ /// <remarks>
+ /// Since there is no debugging API ala Win32 on Mono,
+ /// <see cref="System.Console.Out">
+ /// Console.Out</see> is being used as the default output method.
+ ///
+ /// <para>This needs help, as MSDN specifies that GUI widgets be used
+ /// for certain features. The short-term solution is to just send output to
+ /// OutputDebugString.</para>
+ /// </remarks>
+ [ComVisible(false)]
+ public class DefaultTraceListener : TraceListener {
+
+ private string logFileName = null;
+
+ public DefaultTraceListener () : base ("Default")
+ {
+ }
+
+ [MonoTODO]
+ public bool AssertUiEnabled {
+ get {return false;}
+ set {/* ignore */}
+ }
+
+ /// <summary>
+ /// Gets or sets name of a log file to write trace or debug messages to.
+ /// </summary>
+ /// <value>
+ /// The name of a log file to write trace or debug messages to.
+ /// </value>
+ [MonoTODO]
+ public string LogFileName {
+ get {return logFileName;}
+ set {logFileName = value;}
+ }
+
+ /// <summary>
+ /// Emits or displays a message and a stack trace for an assertion that
+ /// always fails.
+ /// </summary>
+ /// <param name="message">
+ /// The message to emit or display.
+ /// </param>
+ public override void Fail (string message)
+ {
+ base.Fail (message);
+ WriteLine (new StackTrace().ToString());
+ }
+
+ /// <summary>
+ /// Emits or displays detailed messages and a stack trace
+ /// for an assertion that always fails.
+ /// </summary>
+ /// <param name="message">
+ /// The message to emit or display
+ /// </param>
+ /// <param name="detailMessage">
+ /// The detailed message to emit or display.
+ /// </param>
+ public override void Fail(string message, string detailMessage)
+ {
+ base.Fail (message, detailMessage);
+ WriteLine (new StackTrace().ToString());
+ }
+
+ #if USE_NATIVE_WIN32_OUTPUT_DEBUG_STRING
+
+ [DllImport ("kernel32.dll")]
+ private extern static void OutputDebugString (string message);
+
+ #else
+
+ private static void OutputDebugString (string message)
+ {
+ Console.Write ("**ods** " + message);
+ }
+
+ #endif
+
+ private void WriteImpl (string message)
+ {
+ if (NeedIndent)
+ WriteIndent ();
+
+ OutputDebugString (message);
+
+ if (Debugger.IsLogging())
+ Debugger.Log (0, null, message);
+
+ WriteLogFile (message);
+ }
+
+ private void WriteLogFile (string message)
+ {
+ string fname = LogFileName;
+ if (fname != null && fname.Length != 0) {
+ FileInfo info = new FileInfo (fname);
+ StreamWriter sw = null;
+
+ // Open the file
+ try {
+ if (info.Exists)
+ sw = info.AppendText ();
+ else
+ sw = info.CreateText ();
+ }
+ catch {
+ // We weren't able to open the file for some reason.
+ // We can't write to the log file; so give up.
+ return;
+ }
+
+ using (sw) {
+ sw.Write (message);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Writes the output to the Console
+ /// </summary>
+ /// <param name="message">
+ /// The message to write
+ /// </param>
+ public override void Write (string message)
+ {
+ WriteImpl (message);
+ }
+
+ /// <summary>
+ /// Writes the output to the Console, followed by a newline
+ /// </summary>
+ /// <param name="message">
+ /// The message to write
+ /// </param>
+ public override void WriteLine (string message)
+ {
+ string msg = message + Environment.NewLine;
+ WriteImpl (msg);
+ NeedIndent = true;
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs b/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs
new file mode 100644
index 00000000000..37d6e6a88ec
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs
@@ -0,0 +1,63 @@
+//
+// System.Diagnostics.DiagnosticsConfigurationHandler.cs
+//
+// Author:
+// John R. Hicks <angryjohn69@nc.rr.com>
+//
+// (C) 2002
+//
+using System;
+using System.Configuration;
+using System.Xml;
+
+namespace System.Diagnostics
+{
+ /// <summary>
+ /// The configuration section handler for the diagnostics section of
+ /// the configuration file. The section handler participates in the
+ /// resolution of configuration settings between the &lt;diagnostics&gt;
+ /// and &lt;/diagnostics&gt; portion of the .config file.
+ /// </summary>
+ public class DiagnosticsConfigurationHandler :
+ IConfigurationSectionHandler
+ {
+ /// <summary>
+ /// Initializes a new instance of the
+ /// <see cref="DiagnosticsConfigurationHandler">
+ /// DiagnosticsConfigurationHandler</see> class.
+ /// </summary>
+ public DiagnosticsConfigurationHandler()
+ {
+
+ }
+
+ /// <summary>
+ /// Parses the configuration settings between the
+ /// &lt;diagnostics&gt; and &lt;/diagnostics&gt; portion of the
+ /// .config file to populate the values of the object and return it.
+ /// </summary>
+ /// <param name="parent">
+ /// Reference to the &quot;default&quot; value provided by the parent
+ /// IConfigurationSectionHandler.
+ /// </param>
+ /// <param name="configContext">
+ /// [To be supplied]
+ /// </param>
+ /// <param name="section">
+ /// [To be supplied]
+ /// </param>
+ public virtual object Create(
+ object parent,
+ object configContext,
+ XmlNode section)
+ {
+ throw new NotImplementedException();
+ }
+
+
+ ~DiagnosticsConfigurationHandler()
+ {
+
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/FileVersionInfo.cs b/mcs/class/System/System.Diagnostics/FileVersionInfo.cs
new file mode 100755
index 00000000000..1dee15373de
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/FileVersionInfo.cs
@@ -0,0 +1,215 @@
+//
+// System.Diagnostics.FileVersionInfo.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System;
+
+namespace System.Diagnostics {
+ public sealed class FileVersionInfo {
+ [MonoTODO]
+ public string Comments {
+ get {
+ return("No comment");
+ }
+ }
+
+ [MonoTODO]
+ public string CompanyName {
+ get {
+ return("The Evil Empire, Inc");
+ }
+ }
+
+ [MonoTODO]
+ public int FileBuildPart {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public string FileDescription {
+ get {
+ return("crap");
+ }
+ }
+
+ [MonoTODO]
+ public int FileMajorPart {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int FileMinorPart {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public string FileName {
+ get {
+ return("filename");
+ }
+ }
+
+ [MonoTODO]
+ public int FilePrivatePart {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public string FileVersion {
+ get {
+ return("0.0.0.0");
+ }
+ }
+
+ [MonoTODO]
+ public string InternalName {
+ get {
+ return("internal name");
+ }
+ }
+
+ [MonoTODO]
+ public bool IsDebug {
+ get {
+ return(false);
+ }
+ }
+
+ [MonoTODO]
+ public bool IsPatched {
+ get {
+ return(false);
+ }
+ }
+
+ [MonoTODO]
+ public bool IsPreRelease {
+ get {
+ return(false);
+ }
+ }
+
+ [MonoTODO]
+ public bool IsPrivateBuild {
+ get {
+ return(false);
+ }
+ }
+
+ [MonoTODO]
+ public bool IsSpecialBuild {
+ get {
+ return(false);
+ }
+ }
+
+ [MonoTODO]
+ public string Language {
+ get {
+ return("English");
+ }
+ }
+
+ [MonoTODO]
+ public string LegalCopyright {
+ get {
+ return("legalese bollocks");
+ }
+ }
+
+ [MonoTODO]
+ public string LegalTrademarks {
+ get {
+ return("more legalese bollocks");
+ }
+ }
+
+ [MonoTODO]
+ public string OriginalFilename {
+ get {
+ return("original file name");
+ }
+ }
+
+ [MonoTODO]
+ public string PrivateBuild {
+ get {
+ return("private build");
+ }
+ }
+
+ [MonoTODO]
+ public int ProductBuildPart {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int ProductMajorPart {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int ProductMinorPart {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public string ProductName {
+ get {
+ return("product name");
+ }
+ }
+
+
+ [MonoTODO]
+ public int ProductPrivatePart {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public string ProductVersion {
+ get {
+ return("0.0.0.0");
+ }
+ }
+
+ [MonoTODO]
+ public string SpecialBuild {
+ get {
+ return("special build");
+ }
+ }
+
+ [MonoTODO]
+ public static FileVersionInfo GetVersionInfo(string fileName) {
+ return(null);
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ return("string");
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/Process.cs b/mcs/class/System/System.Diagnostics/Process.cs
new file mode 100755
index 00000000000..23b85ede094
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/Process.cs
@@ -0,0 +1,429 @@
+//
+// System.Diagnostics.Process.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System;
+using System.IO;
+using System.ComponentModel;
+
+namespace System.Diagnostics {
+ public class Process : Component {
+ [MonoTODO]
+ public Process() {
+ }
+
+ [MonoTODO]
+ public int BasePriority {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public bool EnableRaisingEvents {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public int ExitCode {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public DateTime ExitTime {
+ get {
+ return(new DateTime(0));
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr Handle {
+ get {
+ return((IntPtr)0);
+ }
+ }
+
+ [MonoTODO]
+ public int HandleCount {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public bool HasExited {
+ get {
+ return(false);
+ }
+ }
+
+ [MonoTODO]
+ public int Id {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public string MachineName {
+ get {
+ return("localhost");
+ }
+ }
+
+ [MonoTODO]
+ public ProcessModule MainModule {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr MainWindowHandle {
+ get {
+ return((IntPtr)0);
+ }
+ }
+
+ [MonoTODO]
+ public string MainWindowTitle {
+ get {
+ return("null");
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr MaxWorkingSet {
+ get {
+ return((IntPtr)0);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr MinWorkingSet {
+ get {
+ return((IntPtr)0);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public ProcessModuleCollection Modules {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public int NonpagedSystemMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int PagedMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int PagedSystemMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int PeakPagedMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int PeakVirtualMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int PeakWorkingSet {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public bool PriorityBoostEnabled {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public ProcessPriorityClass PriorityClass {
+ get {
+ return(ProcessPriorityClass.Normal);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public int PrivateMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan PrivilegedProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MonoTODO]
+ public string ProcessName {
+ get {
+ return("this-process");
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr ProcessorAffinity {
+ get {
+ return((IntPtr)0);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public bool Responding {
+ get {
+ return(false);
+ }
+ }
+
+ [MonoTODO]
+ public StreamReader StandardError {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public StreamWriter StandardInput {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public StreamReader StandardOutput {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public ProcessStartInfo StartInfo {
+ get {
+ return(null);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public DateTime StartTime {
+ get {
+ return(new DateTime(0));
+ }
+ }
+
+ [MonoTODO]
+ public ISynchronizeInvoke SynchronizingObject {
+ get {
+ return(null);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public ProcessThreadCollection Threads {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan TotalProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan UserProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MonoTODO]
+ public int VirtualMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int WorkingSet {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public void Close() {
+ }
+
+ [MonoTODO]
+ public bool CloseMainWindow() {
+ return(false);
+ }
+
+ [MonoTODO]
+ public static void EnterDebugMode() {
+ }
+
+ [MonoTODO]
+ public static Process GetCurrentProcess() {
+ return(null);
+ }
+
+ [MonoTODO]
+ public static Process GetProcessById(int processId) {
+ return(null);
+ }
+
+ [MonoTODO]
+ public static Process GetProcessById(int processId, string machineName) {
+ return(null);
+ }
+
+ [MonoTODO]
+ public static Process[] GetProcesses() {
+ return(null);
+ }
+
+ [MonoTODO]
+ public static Process[] GetProcesses(string machineName) {
+ return(null);
+ }
+
+ [MonoTODO]
+ public static Process[] GetProcessesByName(string processName) {
+ return(null);
+ }
+
+ [MonoTODO]
+ public static Process[] GetProcessesByName(string processName, string machineName) {
+ return(null);
+ }
+
+ [MonoTODO]
+ public void Kill() {
+ }
+
+ [MonoTODO]
+ public static void LeaveDebugMode() {
+ }
+
+ [MonoTODO]
+ public void Refresh() {
+ }
+
+ [MonoTODO]
+ public bool Start() {
+ return(false);
+ }
+
+ [MonoTODO]
+ public static Process Start(ProcessStartInfo startInfo) {
+ return(null);
+ }
+
+ [MonoTODO]
+ public static Process Start(string fileName) {
+ return(null);
+ }
+
+ [MonoTODO]
+ public static Process Start(string fileName, string arguments) {
+ return(null);
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ return("process name");
+ }
+
+ [MonoTODO]
+ public void WaitForExit() {
+ }
+
+ [MonoTODO]
+ public bool WaitForExit(int milliseconds) {
+ return(false);
+ }
+
+ [MonoTODO]
+ public bool WaitForInputIdle() {
+ return(false);
+ }
+
+ [MonoTODO]
+ public bool WaitForInputIdle(int milliseconds) {
+ return(false);
+ }
+
+ [MonoTODO]
+ public event EventHandler Exited;
+
+ [MonoTODO]
+ protected override void Dispose(bool disposing) {
+ }
+
+ [MonoTODO]
+ public override void Dispose() {
+ }
+
+ [MonoTODO]
+ protected void OnExited() {
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/ProcessModule.cs b/mcs/class/System/System.Diagnostics/ProcessModule.cs
new file mode 100755
index 00000000000..7bf4e614ac5
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessModule.cs
@@ -0,0 +1,61 @@
+//
+// System.Diagnostics.ProcessModule.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System;
+using System.ComponentModel;
+
+namespace System.Diagnostics {
+ public class ProcessModule : Component {
+ [MonoTODO]
+ public IntPtr BaseAddress {
+ get {
+ return((IntPtr)0);
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr EntryPointAddress {
+ get {
+ return((IntPtr)0);
+ }
+ }
+
+ [MonoTODO]
+ public string FileName {
+ get {
+ return("filename");
+ }
+ }
+
+ [MonoTODO]
+ public FileVersionInfo FileVersionInfo {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public int ModuleMemorySize {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public string ModuleName {
+ get {
+ return("module name");
+ }
+ }
+
+ public override string ToString() {
+ return(this.ModuleName);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs b/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs
new file mode 100755
index 00000000000..4ad840c1a80
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs
@@ -0,0 +1,43 @@
+//
+// System.Diagnostics.ProcessModuleCollection.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+
+namespace System.Diagnostics {
+ public class ProcessModuleCollection : ReadOnlyCollectionBase {
+ [MonoTODO]
+ protected ProcessModuleCollection() {
+ }
+
+ [MonoTODO]
+ public ProcessModuleCollection(ProcessModule[] processModules) {
+ }
+
+ [MonoTODO]
+ public ProcessModule this[int index] {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public bool Contains(ProcessModule module) {
+ return(false);
+ }
+
+ [MonoTODO]
+ public void CopyTo(ProcessModule[] array, int index) {
+ }
+
+ [MonoTODO]
+ public int IndexOf(ProcessModule module) {
+ return(0);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessPriorityClass.cs b/mcs/class/System/System.Diagnostics/ProcessPriorityClass.cs
new file mode 100755
index 00000000000..4218bb4390e
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessPriorityClass.cs
@@ -0,0 +1,20 @@
+//
+// System.Diagnostics.ProcessPriorityClass.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics {
+ [Serializable]
+ public enum ProcessPriorityClass {
+ AboveNormal=0x08000,
+ BelowNormal=0x04000,
+ High=0x00080,
+ Idle=0x00040,
+ Normal=0x00020,
+ RealTime=0x00100,
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessStartInfo.cs b/mcs/class/System/System.Diagnostics/ProcessStartInfo.cs
new file mode 100755
index 00000000000..28065dbec91
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessStartInfo.cs
@@ -0,0 +1,148 @@
+//
+// System.Diagnostics.ProcessStartInfo.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections.Specialized;
+
+namespace System.Diagnostics {
+ public class ProcessStartInfo {
+ [MonoTODO]
+ public ProcessStartInfo() {
+ }
+
+ [MonoTODO]
+ public ProcessStartInfo(string filename) {
+ }
+
+ [MonoTODO]
+ public ProcessStartInfo(string filename, string arguments) {
+ }
+
+ [MonoTODO]
+ public string Arguments {
+ get {
+ return("");
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public bool CreateNoWindow {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public StringDictionary EnvironmentVariables {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public bool ErrorDialog {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr ErrorDialogParentHandle {
+ get {
+ return((IntPtr)0);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public string FileName {
+ get {
+ return("file name");
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public bool RedirectStandardError {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public bool RedirectStandardInput {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public bool RedirectStandardOutput {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public bool UseShellExecute {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public string Verb {
+ get {
+ return("verb");
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public string[] Verbs {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public ProcessWindowStyle WindowStyle {
+ get {
+ return(ProcessWindowStyle.Normal);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public string WorkingDirectory {
+ get {
+ return(".");
+ }
+ set {
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessThread.cs b/mcs/class/System/System.Diagnostics/ProcessThread.cs
new file mode 100755
index 00000000000..bbc6d56eb97
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessThread.cs
@@ -0,0 +1,118 @@
+//
+// System.Diagnostics.ProcessThread.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.ComponentModel;
+
+namespace System.Diagnostics {
+ public class ProcessThread : Component {
+ [MonoTODO]
+ public int BasePriority {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int CurrentPriority {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ public int Id {
+ get {
+ return(0);
+ }
+ }
+
+ [MonoTODO]
+ int IdealProcessor {
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public bool PriorityBoostEnabled {
+ get {
+ return(false);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public ThreadPriorityLevel PriorityLevel {
+ get {
+ return(ThreadPriorityLevel.Idle);
+ }
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan PrivilegedProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MonoTODO]
+ IntPtr ProcessorAffinity {
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr StartAddress {
+ get {
+ return((IntPtr)0);
+ }
+ }
+
+ [MonoTODO]
+ public DateTime StartTime {
+ get {
+ return(new DateTime(0));
+ }
+ }
+
+ [MonoTODO]
+ public ThreadState ThreadState {
+ get {
+ return(ThreadState.Initialized);
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan TotalProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MonoTODO]
+ public TimeSpan UserProcessorTime {
+ get {
+ return(new TimeSpan(0));
+ }
+ }
+
+ [MonoTODO]
+ public ThreadWaitReason WaitReason {
+ get {
+ return(ThreadWaitReason.Executive);
+ }
+ }
+
+ [MonoTODO]
+ public void ResetIdealProcessor() {
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs b/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs
new file mode 100755
index 00000000000..4efbcd21bb0
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs
@@ -0,0 +1,56 @@
+//
+// System.Diagnostics.ProcessThreadCollection.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+
+namespace System.Diagnostics {
+ public class ProcessThreadCollection : ReadOnlyCollectionBase {
+ [MonoTODO]
+ protected ProcessThreadCollection() {
+ }
+
+ [MonoTODO]
+ public ProcessThreadCollection(ProcessThread[] processThreads) {
+ }
+
+ [MonoTODO]
+ public ProcessThread this[int index] {
+ get {
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public int Add(ProcessThread thread) {
+ return(0);
+ }
+
+ [MonoTODO]
+ public bool Contains(ProcessThread thread) {
+ return(false);
+ }
+
+ [MonoTODO]
+ public void CopyTo(ProcessThread[] array, int index) {
+ }
+
+ [MonoTODO]
+ public int IndexOf(ProcessThread thread) {
+ return(0);
+ }
+
+ [MonoTODO]
+ public void Insert(int index, ProcessThread thread) {
+ }
+
+ [MonoTODO]
+ public void Remove(ProcessThread thread) {
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ProcessWindowStyle.cs b/mcs/class/System/System.Diagnostics/ProcessWindowStyle.cs
new file mode 100755
index 00000000000..00afa1ac997
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ProcessWindowStyle.cs
@@ -0,0 +1,18 @@
+//
+// System.Diagnostics.ProcessWindowStyle.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics {
+ [Serializable]
+ public enum ProcessWindowStyle {
+ Hidden=1,
+ Maximized=3,
+ Minimized=2,
+ Normal=0,
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/Switch.cs b/mcs/class/System/System.Diagnostics/Switch.cs
new file mode 100755
index 00000000000..90efcc258e8
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/Switch.cs
@@ -0,0 +1,94 @@
+//
+// System.Diagnostics.Switch.cs
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+//
+// (C) 2001
+//
+
+namespace System.Diagnostics
+{
+ /// <summary>
+ /// Abstract base class to create new debugging and tracing switches
+ /// </summary>
+ public abstract class Switch
+ {
+ private string desc = "";
+ private string display_name = "";
+ private int iSwitch;
+
+ // ================= Constructors ===================
+ /// <summary>
+ /// Initialize a new instance
+ /// </summary>
+ protected Switch(string displayName, string description)
+ {
+ display_name = displayName;
+ desc = description;
+ }
+
+ /// <summary>
+ /// Allows an Object to attempt to free resources and
+ /// perform cleanup before the Object is reclaimed
+ /// by the Garbage Collector
+ /// </summary>
+ ~Switch()
+ {
+ }
+
+ // ================ Instance Methods ================
+
+ // ==================== Properties ==================
+
+ /// <summary>
+ /// Returns a description of the switch
+ /// </summary>
+ public string Description
+ {
+ get
+ {
+ return desc;
+ }
+ }
+
+ /// <summary>
+ /// Returns a name used to identify the switch
+ /// </summary>
+ public string DisplayName
+ {
+ get
+ {
+ return display_name;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the current setting for this switch
+ /// </summary>
+ protected int SwitchSetting
+ {
+ get
+ {
+ return iSwitch;
+ }
+ set
+ {
+ if(iSwitch != value)
+ {
+ iSwitch = value;
+ OnSwitchSettingChanged();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Raises the SwitchSettingChanged event
+ /// </summary>
+ [MonoTODO]
+ protected virtual void OnSwitchSettingChanged()
+ {
+ // TODO: implement me
+ }
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/TextWriterTraceListener.cs b/mcs/class/System/System.Diagnostics/TextWriterTraceListener.cs
new file mode 100644
index 00000000000..072377cfafd
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TextWriterTraceListener.cs
@@ -0,0 +1,235 @@
+//
+// System.Diagnostics.TextWriterTraceListener.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original
+// implementation.
+//
+// (C) 2002 Jonathan Pryor
+//
+
+using System;
+using System.IO;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ /// <summary>
+ /// Directs tracing or debugging output to a <see cref="System.IO.TextWriter">
+ /// TextWriter</see> or to a <see cref="System.IO.Stream">Stream</see>,
+ /// such as <see cref="System.Console.Out">Console.Out</see> or
+ /// <see cref="System.IO.FileStream">FileStream</see>.
+ /// </summary>
+ public class TextWriterTraceListener : TraceListener {
+
+ private TextWriter writer;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TextWriterTraceListener">
+ /// TextWriterTraceListener</see> class with
+ /// <see cref="System.IO.TextWriter">TextWriter</see>
+ /// as the output recipient.
+ /// </summary>
+ public TextWriterTraceListener () : base ("TextWriter")
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TextWriterTraceListener">
+ /// TextWriterTraceListener</see> class, using the stream as the output
+ /// recipient of the debugging and tracing output.
+ /// </summary>
+ /// <param name="stream">
+ /// A <see cref="System.IO.Stream">Stream</see> that represents the stream
+ /// the <see cref="TextWriterTraceListener">TextWriterTraceListener</see>
+ /// writes to.
+ /// </param>
+ /// <exception cref="System.ArgumentNullException">
+ /// The stream is a null reference.
+ /// </exception>
+ public TextWriterTraceListener (Stream stream)
+ : this (stream, "")
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TextWriterTraceListener">
+ /// TextWriterTraceListener</see> class, using the file as the recipient
+ /// of the debugging and tracing output.
+ /// </summary>
+ /// <param name="fileName">
+ /// The name of the file the <see cref="TextWriterTraceListener">
+ /// TextWriterTraceListener</see> writes to.
+ /// </param>
+ /// <exception cref="System.ArgumentNullException">
+ /// The fileName is null.
+ /// </exception>
+ public TextWriterTraceListener (string fileName)
+ : this (fileName, "")
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TextWriterTraceListener">
+ /// TextWriterTraceListener</see> class using the specified writer as the
+ /// recipient of the tracing or debugging output.
+ /// </summary>
+ /// <param name="writer">
+ /// A <see cref="System.IO.TextWriter">TextWriter</see> that receives
+ /// output from the
+ /// <see cref="TextWriterTraceListener">TextWriterTraceListener</see>.
+ /// </param>
+ /// <exception cref="System.ArgumentNullException">
+ /// The writer is a null reference
+ /// </exception>
+ public TextWriterTraceListener (TextWriter writer)
+ : this (writer, "")
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TextWriterTraceListener">
+ /// TextWriterTraceListener</see> class with the specified name, using the
+ /// stream as the recipient of the tracing or debugging output.
+ /// </summary>
+ /// <param name="stream">
+ /// A <see cref="System.IO.Stream">Stream</see> that represents the stream
+ /// the <see cref="TextWriterTraceListener">TextWriterTraceListener</see>
+ /// writes to.
+ /// </param>
+ /// <param name="name">
+ /// The name of the new instance
+ /// </param>
+ /// <exception cref="System.ArgumentNullException">
+ /// The stream is a null reference
+ /// </exception>
+ public TextWriterTraceListener (Stream stream, string name)
+ : base (name != null ? name : "")
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream");
+ writer = new StreamWriter (stream);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TextWriterTraceListener">
+ /// TextWriterTraceListener</see> class with the specified name, using the
+ /// file as the recipient of the tracing or debugging output.
+ /// </summary>
+ /// <param name="fileName">
+ /// The name of the file the <see cref="TextWriterTraceListener">
+ /// TextWriterTraceListener</see> writes to.
+ /// </param>
+ /// <param name="name">
+ /// The name of the new instance
+ /// </param>
+ /// <exception cref="System.ArgumentNullException">
+ /// The file is a null reference.
+ /// </exception>
+ public TextWriterTraceListener (string fileName, string name)
+ : base (name != null ? name : "")
+ {
+ if (fileName == null)
+ throw new ArgumentNullException ("fileName");
+ writer = new StreamWriter (File.OpenWrite (fileName));
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TextWriterTraceListener">
+ /// TextWriterTraceListener</see> class with the specified name, using
+ /// the specified writer as the recipient of the tracing or
+ /// debugging output.
+ /// </summary>
+ /// <param name="writer">
+ /// A <see cref="System.IO.TextWriter">TextWriter</see> that receives
+ /// the output from the
+ /// <see cref="TextWriterTraceListener">TextWriterTraceListener</see>.
+ /// </param>
+ /// <param name="name">
+ /// The name of the new instance.
+ /// </param>
+ /// <exception cref="System.ArgumentNullException">
+ /// The writer is a null reference.
+ /// </exception>
+ public TextWriterTraceListener (TextWriter writer, string name)
+ : base (name != null ? name : "")
+ {
+ if (writer == null)
+ throw new ArgumentNullException ("writer");
+ this.writer = writer;
+ }
+
+ /// <summary>
+ /// Gets or sets the writer that receives the debugging or tracing output.
+ /// </summary>
+ /// <value>
+ /// A <see cref="System.IO.TextWriter">TextWriter</see> that represents
+ /// the writer that receives the tracing or debugging output.
+ /// </value>
+ public TextWriter Writer {
+ get {return writer;}
+ set {writer = value;}
+ }
+
+ /// <summary>
+ /// Closes the <see cref="System.IO.Writer">Writer</see> so that it no
+ /// longer receives tracing or debugging output.
+ /// </summary>
+ public override void Close ()
+ {
+ if (writer != null) {
+ writer.Flush ();
+ writer.Close ();
+ writer = null;
+ }
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing)
+ Close ();
+ }
+
+ /// <summary>
+ /// Flushes the output buffer for the
+ /// <see cref="System.IO.Writer">Writer</see>.
+ /// </summary>
+ public override void Flush ()
+ {
+ writer.Flush ();
+ }
+
+ /// <summary>
+ /// Writes a message to this instance's
+ /// <see cref="System.IO.Writer">Writer</see>.
+ /// </summary>
+ /// <param name="message">
+ /// A message to write.
+ /// </param>
+ public override void Write (string message)
+ {
+ if (NeedIndent)
+ WriteIndent ();
+ writer.Write (message);
+ }
+
+ /// <summary>
+ /// Writes a message to this instance's
+ /// <see cref="System.IO.Writer">Writer</see>
+ /// followed by a line terminator.
+ /// </summary>
+ /// <param name="message">
+ /// A message to write.
+ /// </param>
+ public override void WriteLine (string message)
+ {
+ if (NeedIndent)
+ WriteIndent ();
+ writer.WriteLine (message);
+ NeedIndent = true;
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/ThreadPriorityLevel.cs b/mcs/class/System/System.Diagnostics/ThreadPriorityLevel.cs
new file mode 100755
index 00000000000..17297c10738
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ThreadPriorityLevel.cs
@@ -0,0 +1,21 @@
+//
+// System.Diagnostics.ThreadPriorityLevel.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics {
+ [Serializable]
+ public enum ThreadPriorityLevel {
+ AboveNormal=1,
+ BelowNormal=-1,
+ Highest=2,
+ Idle=-15,
+ Lowest=-2,
+ Normal=0,
+ TimeCritical=15,
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ThreadState.cs b/mcs/class/System/System.Diagnostics/ThreadState.cs
new file mode 100755
index 00000000000..12e4501c104
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ThreadState.cs
@@ -0,0 +1,22 @@
+//
+// System.Diagnostics.ThreadState.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics {
+ [Serializable]
+ public enum ThreadState {
+ Initialized=0,
+ Ready=1,
+ Running=2,
+ Standby=3,
+ Terminated=4,
+ Transition=6,
+ Unknown=7,
+ Wait=5,
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/ThreadWaitReason.cs b/mcs/class/System/System.Diagnostics/ThreadWaitReason.cs
new file mode 100755
index 00000000000..97946549f39
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ThreadWaitReason.cs
@@ -0,0 +1,28 @@
+//
+// System.Diagnostics.ThreadWaitReason.cs
+//
+// Authors:
+// Dick Porter (dick@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics {
+ [Serializable]
+ public enum ThreadWaitReason {
+ EventPairHigh=7,
+ EventPairLow=8,
+ ExecutionDelay=4,
+ Executive=0,
+ FreePage=1,
+ LpcReceive=9,
+ LpcReply=10,
+ PageIn=2,
+ PageOut=12,
+ Suspended=5,
+ SystemAllocation=3,
+ Unknown=13,
+ UserRequest=6,
+ VirtualMemory=11,
+ }
+}
diff --git a/mcs/class/System/System.Diagnostics/Trace.cs b/mcs/class/System/System.Diagnostics/Trace.cs
new file mode 100644
index 00000000000..bb354d07beb
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/Trace.cs
@@ -0,0 +1,307 @@
+//
+// System.Diagnostics.Trace.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original
+// implementation.
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ /// <summary>
+ /// Provides a set of methods to help debug code
+ /// </summary>
+ public sealed class Trace {
+
+ private Trace () {}
+
+ /// <summary>
+ /// Gets or sets value indicating whether Flush should
+ /// be called on the listeners.
+ /// </summary>
+ public static bool AutoFlush {
+ get {return TraceImpl.AutoFlush;}
+ set {TraceImpl.AutoFlush = value;}
+ }
+
+ /// <summary>
+ /// Gets or sets indent level
+ /// </summary>
+ public static int IndentLevel {
+ get {return TraceImpl.IndentLevel;}
+ set {TraceImpl.IndentLevel = value;}
+ }
+
+ /// <summary>
+ /// The number of spaces in an indent.
+ /// </summary>
+ public static int IndentSize {
+ get {return TraceImpl.IndentSize;}
+ set {TraceImpl.IndentSize = value;}
+ }
+
+ /// <summary>
+ /// Returns the listeners collection
+ /// </summary>
+ public static TraceListenerCollection Listeners {
+ get {return TraceImpl.Listeners;}
+ }
+
+ /// <summary>
+ /// Checks for a condition, and prints a stack trace
+ /// if the condition is false.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Assert (bool condition)
+ {
+ TraceImpl.Assert (condition);
+ }
+
+ /// <summary>
+ /// Checks for a condition, and displays a message if the condition
+ /// is false.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Assert (bool condition, string message)
+ {
+ TraceImpl.Assert (condition, message);
+ }
+
+ /// <summary>
+ /// Checks for a condtion, and displays a message and a detailed message
+ /// string if the condition is false.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Assert (bool condition, string message,
+ string detailMessage)
+ {
+ TraceImpl.Assert (condition, message, detailMessage);
+ }
+
+ /// <summary>
+ /// Closes the Debug buffer
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Close ()
+ {
+ TraceImpl.Close ();
+ }
+
+ /// <summary>
+ /// Emits the specified error message.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Fail (string message)
+ {
+ TraceImpl.Fail (message);
+ }
+
+ /// <summary>
+ /// Emits the specified error message and detailed error message.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Fail (string message, string detailMessage)
+ {
+ TraceImpl.Fail (message, detailMessage);
+ }
+
+ /// <summary>
+ /// Flushes the listeners
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Flush ()
+ {
+ TraceImpl.Flush ();
+ }
+
+ /// <summary>
+ /// Increments the indent level
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Indent ()
+ {
+ TraceImpl.Indent ();
+ }
+
+ /// <summary>
+ /// Decrements the indent level
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Unindent ()
+ {
+ TraceImpl.Unindent ();
+ }
+
+ /// <summary>
+ /// Writes the value of the specified object's ToString method
+ /// to the listeners.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Write (object value)
+ {
+ TraceImpl.Write (value);
+ }
+
+ /// <summary>
+ /// Writes the specified message to each listener in the Listeners
+ /// collection.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Write (string message)
+ {
+ TraceImpl.Write (message);
+ }
+
+ /// <summary>
+ /// Writes the category name and value of the specified object's
+ /// ToString method to each listener in the Listeners collection.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Write (object value, string category)
+ {
+ TraceImpl.Write (value, category);
+ }
+
+ /// <summary>
+ /// Writes the category name and the specified message
+ /// to each listener in the Listeners collection.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void Write (string message, string category)
+ {
+ TraceImpl.Write (message, category);
+ }
+
+ /// <summary>
+ /// Writes the value of the specified object's ToString method
+ /// to each of the listeners if the condition is true.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteIf (bool condition, object value)
+ {
+ TraceImpl.WriteIf (condition, value);
+ }
+
+ /// <summary>
+ /// Writes the specified message to each of the listeners
+ /// if the specified condition is true.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteIf (bool condition, string message)
+ {
+ TraceImpl.WriteIf (condition, message);
+ }
+
+ /// <summary>
+ /// Writes the value of the specified object's ToString message
+ /// and category to each of the listeners if the condition is true.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteIf (bool condition, object value,
+ string category)
+ {
+ TraceImpl.WriteIf (condition, value, category);
+ }
+
+ /// <summary>
+ /// Writes the category and specified message to each listener
+ /// if the specified condition is true.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteIf (bool condition, string message,
+ string category)
+ {
+ TraceImpl.WriteIf (condition, message, category);
+ }
+
+ /// <summary>
+ /// Writes the value of the object's ToString method,
+ /// followed by a line terminator, to each listener.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteLine (object value)
+ {
+ TraceImpl.WriteLine (value);
+ }
+
+ /// <summary>
+ /// Writes the specified message, followed by a line terminator,
+ /// to each listener.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteLine (string message)
+ {
+ TraceImpl.WriteLine (message);
+ }
+
+ /// <summary>
+ /// Writes the value of the specified object's ToString method,
+ /// along with a category, followed by a line terminator, to each listener.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteLine (object value, string category)
+ {
+ TraceImpl.WriteLine (value, category);
+ }
+
+ /// <summary>
+ /// Writes the specified category and message, followed by a line
+ /// terminator, to each listener.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteLine (string message, string category)
+ {
+ TraceImpl.WriteLine (message, category);
+ }
+
+ /// <summary>
+ /// Writes the value of the object's ToString method
+ /// to each listener if the specified condition is true.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteLineIf (bool condition, object value)
+ {
+ TraceImpl.WriteLineIf (condition, value);
+ }
+
+ /// <summary>
+ /// Writes the specified message to each listener
+ /// if the specified condition is true.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteLineIf (bool condition, string message)
+ {
+ TraceImpl.WriteLineIf (condition, message);
+ }
+
+ /// <summary>
+ /// Writes the value of the object's ToString method, and a category
+ /// to each listener if the specified condition is true.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteLineIf (bool condition, object value,
+ string category)
+ {
+ TraceImpl.WriteLineIf (condition, value, category);
+ }
+
+ /// <summary>
+ /// Writes the specified category and message to each listener, followed
+ /// by a line terminator, if the specified condition is true.
+ /// </summary>
+ [Conditional("TRACE")]
+ public static void WriteLineIf (bool condition, string message,
+ string category)
+ {
+ TraceImpl.WriteLineIf (condition, message, category);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/TraceImpl.cs b/mcs/class/System/System.Diagnostics/TraceImpl.cs
new file mode 100644
index 00000000000..e2fe2022485
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TraceImpl.cs
@@ -0,0 +1,296 @@
+//
+// System.Diagnostics.TraceImpl.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002 Jonathan Pryor
+//
+
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ internal class TraceImpl {
+
+ private static object lock_ = new object ();
+
+ private static bool autoFlush = false;
+
+ public static bool AutoFlush {
+ get {return autoFlush;}
+ set {autoFlush = value;}
+ }
+
+ // FIXME: From MSDN: "This property is stored on
+ // per-thread/pre-reqeust basis"
+ //
+ // What exactly does this mean? Sure, we can mark it
+ // [ThreadStatic], which make a per-thread value, but what
+ // does this mean for each of the writers? Do *they* need to
+ // store this as a thread-static value?
+ [MonoTODO, ThreadStatic]
+ private static int indentLevel = 0;
+
+ public static int IndentLevel {
+ get {return indentLevel;}
+ set {indentLevel = value;}
+ }
+
+ // FIXME: From MSDN: "This property is stored on
+ // per-thread/pre-reqeust basis"
+ //
+ // What exactly does this mean? Sure, we can mark it
+ // [ThreadStatic], which makes a per-thread value, but what
+ // does this mean for each of the writers? Do *they* need to
+ // store this as a thread-static value?
+ [MonoTODO, ThreadStatic]
+ private static int indentSize = 4;
+
+ public static int IndentSize {
+ get {return indentSize;}
+ set {indentSize = value;}
+ }
+
+ private static TraceListenerCollection listeners =
+ new TraceListenerCollection ();
+
+ public static TraceListenerCollection Listeners {
+ get {return listeners;}
+ }
+
+ // FIXME: According to MSDN, this method should display a dialog box
+ [MonoTODO]
+ public static void Assert (bool condition)
+ {
+ if (!condition)
+ Fail (new StackTrace().ToString());
+ }
+
+ // FIXME: According to MSDN, this method should display a dialog box
+ [MonoTODO]
+ public static void Assert (bool condition, string message)
+ {
+ if (!condition)
+ Fail (message);
+ }
+
+ // FIXME: According to MSDN, this method should display a dialog box
+ [MonoTODO]
+ public static void Assert (bool condition, string message,
+ string detailMessage)
+ {
+ if (!condition)
+ Fail (message, detailMessage);
+ }
+
+ public static void Close ()
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Close ();
+ }
+ }
+ }
+
+ // FIXME: From testing .NET, this method should display a dialog
+ [MonoTODO]
+ public static void Fail (string message)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Fail (message);
+ }
+ }
+ }
+
+ // FIXME: From testing .NET, this method should display a dialog
+ [MonoTODO]
+ public static void Fail (string message, string detailMessage)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Fail (message, detailMessage);
+ }
+ }
+ }
+
+ public static void Flush ()
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners){
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void Indent ()
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.IndentLevel++;
+ }
+ }
+ }
+
+ public static void Unindent ()
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.IndentLevel--;
+ }
+ }
+ }
+
+ public static void Write (object value)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Write (value);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void Write (string message)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Write (message);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void Write (object value, string category)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Write (value, category);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void Write (string message, string category)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.Write (message, category);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void WriteIf (bool condition, object value)
+ {
+ if (condition)
+ Write (value);
+ }
+
+ public static void WriteIf (bool condition, string message)
+ {
+ if (condition)
+ Write (message);
+ }
+
+ public static void WriteIf (bool condition, object value,
+ string category)
+ {
+ if (condition)
+ Write (value, category);
+ }
+
+ public static void WriteIf (bool condition, string message,
+ string category)
+ {
+ if (condition)
+ Write (message, category);
+ }
+
+ public static void WriteLine (object value)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.WriteLine (value);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void WriteLine (string message)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.WriteLine (message);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void WriteLine (object value, string category)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.WriteLine (value, category);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void WriteLine (string message, string category)
+ {
+ lock (lock_) {
+ foreach (TraceListener listener in Listeners) {
+ listener.WriteLine (message, category);
+
+ if (AutoFlush)
+ listener.Flush ();
+ }
+ }
+ }
+
+ public static void WriteLineIf (bool condition, object value)
+ {
+ if (condition)
+ WriteLine (value);
+ }
+
+ public static void WriteLineIf (bool condition, string message)
+ {
+ if (condition)
+ WriteLine (message);
+ }
+
+ public static void WriteLineIf (bool condition, object value,
+ string category)
+ {
+ if (condition)
+ WriteLine (value, category);
+ }
+
+ public static void WriteLineIf (bool condition, string message,
+ string category)
+ {
+ if (condition)
+ WriteLine (message, category);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/TraceLevel.cs b/mcs/class/System/System.Diagnostics/TraceLevel.cs
new file mode 100755
index 00000000000..ddd88595ff3
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TraceLevel.cs
@@ -0,0 +1,41 @@
+// TraceLevel.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:34:29 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Diagnostics {
+
+
+ /// <summary>
+ /// </summary>
+ public enum TraceLevel {
+
+ /// <summary>
+ /// </summary>
+ Off = 0,
+
+ /// <summary>
+ /// </summary>
+ Error = 1,
+
+ /// <summary>
+ /// </summary>
+ Warning = 2,
+
+ /// <summary>
+ /// </summary>
+ Info = 3,
+
+ /// <summary>
+ /// </summary>
+ Verbose = 4,
+ } // TraceLevel
+
+} // System.Diagnostics
diff --git a/mcs/class/System/System.Diagnostics/TraceListener.cs b/mcs/class/System/System.Diagnostics/TraceListener.cs
new file mode 100644
index 00000000000..6ba7078de2d
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TraceListener.cs
@@ -0,0 +1,297 @@
+//
+// System.Diagnostics.TraceListener.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original
+// implementation.
+//
+// (C) 2002 Jonathan Pryor
+//
+
+using System;
+using System.Diagnostics;
+
+namespace System.Diagnostics {
+
+ /// <summary>
+ /// Provides the abstract base class for the listeners who monitor
+ /// trace and debug output
+ /// </summary>
+ public abstract class TraceListener : MarshalByRefObject, IDisposable {
+
+ private int indentLevel = 0;
+ private int indentSize = 4;
+ private string name = null;
+ private bool needIndent = false;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TraceListener">
+ /// TraceListener</see> class.
+ /// </summary>
+ protected TraceListener () : this ("")
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TraceListener">
+ /// TraceListener</see> class using the specified name as the listener.
+ /// </summary>
+ protected TraceListener (string name)
+ {
+ Name = name;
+ }
+
+ /// <summary>
+ /// Gets or sets the indent level.
+ /// </summary>
+ /// <value>
+ /// The indent level. The default is zero.
+ /// </value>
+ public int IndentLevel {
+ get {return indentLevel;}
+ set {indentLevel = value;}
+ }
+
+ /// <summary>
+ /// Gets or sets the number of spaces in an indent.
+ /// </summary>
+ /// <value>
+ /// The number of spaces in an indent. The default is four spaces.
+ /// </value>
+ public int IndentSize {
+ get {return indentSize;}
+ set {indentSize = value;}
+ }
+
+ /// <summary>
+ /// Gets or sets a name for this
+ /// <see cref="TraceListener">TraceListener</see>.
+ /// </summary>
+ /// <value>
+ /// A name for this <see cref="TraceListener">TraceListener</see>.
+ /// The default is the empty string ("")
+ /// </value>
+ public virtual string Name {
+ get {return name;}
+ set {name = value;}
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to indent the output.
+ /// </summary>
+ /// <value>
+ /// <b>true</b> if the output should be indented; otherwise <b>false</b>.
+ /// </value>
+ protected bool NeedIndent {
+ get {return needIndent;}
+ set {needIndent = value;}
+ }
+
+ /// <summary>
+ /// When overridden in a derived class, closes the output stream so it
+ /// no longer receives tracing or debugging output.
+ /// </summary>
+ public virtual void Close ()
+ {
+ Dispose ();
+ }
+
+ /// <summary>
+ /// Releases all resources used by the i
+ /// <see cref="TraceListener">TraceListener</see>.
+ /// </summary>
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ /// <summary>
+ /// Releases the unmanaged resources used by the
+ /// <see cref="TraceListener">TraceListener</see> and optionally
+ /// releases the managed resources.
+ /// </summary>
+ /// <param name="disposing">
+ /// <b>true</b> to release both managed and unmanaged resources;
+ /// <b>false</b> to release only unmanaged resources.
+ /// </param>
+ protected virtual void Dispose (bool disposing)
+ {
+ }
+
+ /// <summary>
+ /// Emits an error message to the listener you create when you
+ /// implement the <see cref="TraceListener">TraceListener</see> class.
+ /// </summary>
+ /// <param name="message">
+ /// A message to emit.
+ /// </param>
+ public virtual void Fail (string message)
+ {
+ Fail (message, "");
+ }
+
+ /// <summary>
+ /// Emits an error message, and a detailed error message to the listener
+ /// you create when you implement the
+ /// <see cref="TraceListener">TraceListener</see> class.
+ /// </summary>
+ /// <param name="message">
+ /// A message to emit.
+ /// </param>
+ /// <param name="detailMessage">
+ /// A detailed message to emit.
+ /// </param>
+ public virtual void Fail (string message, string detailMessage)
+ {
+ WriteLine ("---- DEBUG ASSERTION FAILED ----");
+ WriteLine ("---- Assert Short Message ----");
+ WriteLine (message);
+ WriteLine ("---- Assert Long Message ----");
+ WriteLine (detailMessage);
+ WriteLine ("");
+ }
+
+ /// <summary>
+ /// When overridden in a derived class, flushes the output buffer.
+ /// </summary>
+ public virtual void Flush ()
+ {
+ }
+
+ /// <summary>
+ /// Writes the value of the object's
+ /// <see cref="System.Object.ToString">ToString</see>
+ /// method to the listener you create when you implement the
+ /// <see cref="TraceListener">TraceListener</see> class.
+ /// </summary>
+ /// <param name="o">
+ /// An <see cref="System.Object">Object</see> whose fully qualified
+ /// class name you want to write.
+ /// </param>
+ public virtual void Write (object o)
+ {
+ Write (o.ToString());
+ }
+
+ /// <summary>
+ /// When overridden in a derived class, writes the specified message to
+ /// the listener you create in the derived class.
+ /// </summary>
+ /// <param name="message">
+ /// A message to write.
+ /// </param>
+ public abstract void Write (string message);
+
+ /// <summary>
+ /// Writes a category name and the value of the object's
+ /// <see cref="System.Object.ToString">ToString</see>
+ /// method to the listener you create when you implement the
+ /// <see cref="TraceListener">TraceListener</see> class.
+ /// </summary>
+ /// <param name="o">
+ /// An <see cref="System.Object">Object</see> whose fully qualified
+ /// class name you wish to write.
+ /// </param>
+ /// <param name="category">
+ /// A category name used to organize the output.
+ /// </param>
+ public virtual void Write (object o, string category)
+ {
+ Write (o.ToString(), category);
+ }
+
+ /// <summary>
+ /// Writes a category name and a message to the listener you create when
+ /// you implement the <see cref="TraceListener">TraceListener</see> class.
+ /// </summary>
+ /// <param name="message">
+ /// A message to write.
+ /// </param>
+ /// <param name="category">
+ /// A category name used to organize the output.
+ /// </param>
+ public virtual void Write (string message, string category)
+ {
+ Write (category + ": " + message);
+ }
+
+ /// <summary>
+ /// Writes the indent to the listener you create when you implement
+ /// this class, and resets the <see cref="NeedIndent">NeedIndent</see>
+ /// Property to <b>false</b>.
+ /// </summary>
+ protected virtual void WriteIndent ()
+ {
+ // Must set NeedIndent to false before Write; otherwise, we get endless
+ // recursion with Write->WriteIndent->Write->WriteIndent...*boom*
+ NeedIndent = false;
+ String indent = new String (' ', IndentLevel*IndentSize);
+ Write (indent);
+ }
+
+ /// <summary>
+ /// Writes the value of the object's
+ /// <see cref="System.Object.ToString">ToString</see>
+ /// method to the listener you create when you implement the
+ /// <see cref="TraceListener">TraceListener</see> class, followed
+ /// by a line terminator.
+ /// </summary>
+ /// <param name="o">
+ /// An <see cref="System.Object">Object</see> whose fully qualified
+ /// class name you want to write.
+ /// </param>
+ public virtual void WriteLine (object o)
+ {
+ WriteLine (o.ToString());
+ }
+
+ /// <summary>
+ /// When overridden in a derived class, writes the specified message to
+ /// the listener you create in the derived class, followed by a
+ /// line terminator.
+ /// </summary>
+ /// <param name="message">
+ /// A message to write.
+ /// </param>
+ public abstract void WriteLine (string message);
+
+ /// <summary>
+ /// Writes a category name and the value of the object's
+ /// <see cref="System.Object.ToString">ToString</see>
+ /// method to the listener you create when you implement the
+ /// <see cref="TraceListener">TraceListener</see> class, followed by a
+ /// line terminator.
+ /// </summary>
+ /// <param name="o">
+ /// An <see cref="System.Object">Object</see> whose fully qualified
+ /// class name you wish to write.
+ /// </param>
+ /// <param name="category">
+ /// A category name used to organize the output.
+ /// </param>
+ public virtual void WriteLine (object o, string category)
+ {
+ WriteLine (o.ToString(), category);
+ }
+
+ /// <summary>
+ /// Writes a category name and a message to the listener you create when
+ /// you implement the <see cref="TraceListener">TraceListener</see> class,
+ /// followed by a line terminator.
+ /// </summary>
+ /// <param name="message">
+ /// A message to write.
+ /// </param>
+ /// <param name="category">
+ /// A category name used to organize the output.
+ /// </param>
+ public virtual void WriteLine (string message, string category)
+ {
+ WriteLine (category + ": " + message);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/TraceListenerCollection.cs b/mcs/class/System/System.Diagnostics/TraceListenerCollection.cs
new file mode 100644
index 00000000000..dacded7f851
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TraceListenerCollection.cs
@@ -0,0 +1,286 @@
+//
+// System.Diagnostics.TraceListenerCollection.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// Comments from John R. Hicks <angryjohn69@nc.rr.com> original
+// implementation.
+//
+// (C) 2002 Jonathan Pryor
+//
+
+
+using System;
+using System.Collections;
+using System.Diagnostics;
+using System.Globalization;
+
+namespace System.Diagnostics {
+
+ /// <summary>
+ /// Provides a list of TraceListener objects.
+ /// </summary>
+ public class TraceListenerCollection : IList, ICollection, IEnumerable {
+
+ private ArrayList listeners = new ArrayList ();
+
+ internal TraceListenerCollection ()
+ {
+ Add (new DefaultTraceListener ());
+ }
+
+ /// <summary>
+ /// Returns the number of items in the list
+ /// </summary>
+ /// <value>
+ /// The number of items
+ /// </value>
+ public int Count{
+ get {return listeners.Count;}
+ }
+
+ /// <summary>
+ /// Gets the first TraceListener in the list with the
+ /// specified name.
+ /// </summary>
+ public TraceListener this [string name] {
+ get {
+ foreach (TraceListener listener in listeners) {
+ if (listener.Name == name)
+ return listener;
+ }
+ return null;
+ }
+ }
+
+ public TraceListener this [int index] {
+ get {return (TraceListener) listeners[index];}
+ set {listeners[index] = value;}
+ }
+
+ object IList.this [int index] {
+ get {return listeners[index];}
+ set {((IList)this).Insert (index, value);}
+ }
+
+ bool ICollection.IsSynchronized {
+ get {return listeners.IsSynchronized;}
+ }
+
+ object ICollection.SyncRoot {
+ get {return listeners.SyncRoot;}
+ }
+
+ bool IList.IsFixedSize {
+ get {return listeners.IsFixedSize;}
+ }
+
+ bool IList.IsReadOnly {
+ get {return listeners.IsReadOnly;}
+ }
+
+ /// <summary>
+ /// Adds a TraceListener to the list.
+ /// </summary>
+ /// <param name="listener">
+ /// The TraceListener being added to the list.
+ /// </param>
+ /// <return>
+ /// The position in the list where the listener was inserted.
+ /// </return>
+ public int Add (TraceListener listener)
+ {
+ return listeners.Add (listener);
+ }
+
+ /// <summary>
+ /// Adds an array of TraceListeners to the list.
+ /// </summary>
+ /// <param name="value">
+ /// Array of TraceListeners to add
+ /// </param>
+ public void AddRange (TraceListener[] value)
+ {
+ listeners.AddRange (value);
+ }
+
+ /// <summary>
+ /// Adds the contents of another TraceListenerCollection to this one.
+ /// </summary>
+ /// <param name="value">
+ /// The TraceListenerCollection to copy values from.
+ /// </param>
+ public void AddRange (TraceListenerCollection value)
+ {
+ listeners.AddRange (value.listeners);
+ }
+
+ /// <summary>
+ /// Clears all listeners from the list.
+ /// </summary>
+ public void Clear ()
+ {
+ listeners.Clear ();
+ }
+
+ /// <summary>
+ /// Checks to see if the list contains the specified listener
+ /// </summary>
+ /// <param name="listener">
+ /// The listener to search for.
+ /// </param>
+ /// <return>
+ /// true if list contains listener; false otherwise.
+ /// </return>
+ public bool Contains (TraceListener listener)
+ {
+ return listeners.Contains (listener);
+ }
+
+ /// <summary>
+ /// Copies a section of the current TraceListenerCollection to
+ /// the specified array at the specified index.
+ /// </summary>
+ /// <param name="listeners">
+ /// Array to copy listeners to.
+ /// </param>
+ /// <param name="index">
+ /// Starting index of copy
+ /// </param>
+ public void CopyTo (TraceListener[] listeners, int index)
+ {
+ listeners.CopyTo (listeners, index);
+ }
+
+ /// <summary>
+ /// Returns an enumerator for the list of listeners.
+ /// </summary>
+ /// <return>
+ /// List Enumerator of type IEnumerator.
+ /// </return>
+ public IEnumerator GetEnumerator ()
+ {
+ return listeners.GetEnumerator ();
+ }
+
+ void ICollection.CopyTo (Array array, int index)
+ {
+ listeners.CopyTo (array, index);
+ }
+
+ int IList.Add (object value)
+ {
+ if (value is TraceListener)
+ return listeners.Add (value);
+ throw new NotSupportedException (Locale.GetText (
+ "You can only add TraceListener objects to the collection"));
+ }
+
+ bool IList.Contains (object value)
+ {
+ if (value is TraceListener)
+ return listeners.Contains (value);
+ return false;
+ }
+
+ int IList.IndexOf (object value)
+ {
+ if (value is TraceListener)
+ return listeners.IndexOf (value);
+ return -1;
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ if (value is TraceListener) {
+ listeners.Insert (index, value);
+ return;
+ }
+ throw new NotSupportedException (Locale.GetText (
+ "You can only insert TraceListener objects into the collection"));
+ }
+
+ void IList.Remove (object value)
+ {
+ if (value is TraceListener)
+ listeners.Remove (value);
+ }
+
+ /// <summary>
+ /// Gets the index of the specified listener.
+ /// </summary>
+ /// <param name="listener">
+ /// The listener to search for
+ /// </param>
+ /// <return>
+ /// The index of the listener in the list, if it exists.
+ /// </return>
+ public int IndexOf (TraceListener listener)
+ {
+ return listeners.IndexOf (listener);
+ }
+
+ /// <summary>
+ /// Inserts the specified listener into the list at the specified index.
+ /// </summary>
+ /// <param name="index">
+ /// Location in the list to insert the listener.
+ /// </param>
+ /// <param name="listener">
+ /// The TraceListener to insert into the list.
+ /// </param>
+ public void Insert (int index, TraceListener listener)
+ {
+ listeners.Insert (index, listener);
+ }
+
+ /// <summary>
+ /// Removes the listener with the specified name from the list, if it
+ /// exists.
+ /// </summary>
+ /// <param name="name">
+ /// Name of listener to remove
+ /// </param>
+ public void Remove (string name)
+ {
+ TraceListener found = null;
+
+ foreach (TraceListener listener in listeners) {
+ if (listener.Name == name) {
+ found = listener;
+ break;
+ }
+ }
+
+ if (found != null)
+ listeners.Remove (found);
+ else
+ throw new ArgumentException (Locale.GetText (
+ "TraceListener " + name + " was not in the collection"));
+ }
+
+ /// <summary>
+ /// Removes the specified listener from the list
+ /// </summary>
+ /// <param name="listener">
+ /// The listener to remove.
+ /// </param>
+ public void Remove (TraceListener listener)
+ {
+ listeners.Remove (listener);
+ }
+
+ /// <summary>
+ /// Removes the listener at the specified index.
+ /// </summary>
+ /// <param name="index">
+ /// Location of the listener to remove.
+ /// </param>
+ public void RemoveAt (int index)
+ {
+ listeners.RemoveAt (index);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/TraceSwitch.cs b/mcs/class/System/System.Diagnostics/TraceSwitch.cs
new file mode 100755
index 00000000000..4b64d80e6ce
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/TraceSwitch.cs
@@ -0,0 +1,97 @@
+//
+// System.Diagnostics.TraceSwtich.cs
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+//
+// (C) 2001
+//
+
+namespace System.Diagnostics
+{
+ /// <summary>
+ /// Multi-level switch to provide tracing and debug output without
+ /// recompiling.
+ /// </summary>
+ public class TraceSwitch : Switch
+ {
+ private TraceLevel level;
+ private bool traceError = false;
+ private bool traceInfo = false;
+ private bool traceVerbose = false;
+ private bool traceWarning = false;
+
+ /// <summary>
+ /// Initializes a new instance
+ /// </summary>
+ /// <param name="displayName">Name for the switch</param>
+ /// <param name="description">Description of the switch</param>
+ public TraceSwitch(string displayName, string description)
+ : base(displayName, description)
+ {
+ }
+
+ /// <summary>
+ /// Gets or sets the trace level that specifies the messages to
+ /// output for tracing and debugging.
+ /// </summary>
+ public TraceLevel Level
+ {
+ get
+ {
+ return level;
+ }
+ set
+ {
+ level = value;
+ }
+
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the Level is set to Error,
+ /// Warning, Info, or Verbose.
+ /// </summary>
+ public bool TraceError
+ {
+ get
+ {
+ return traceError;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the Level is set to Info or Verbose.
+ /// </summary>
+ public bool TraceInfo
+ {
+ get
+ {
+ return traceInfo;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the Level is set to Verbose.
+ /// </summary>
+ public bool TraceVerbose
+ {
+ get
+ {
+ return traceVerbose;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the Level is set to
+ /// Warning, Info, or Verbose.
+ /// </summary>
+ public bool TraceWarning
+ {
+ get
+ {
+ return traceWarning;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Globalization/Locale.cs b/mcs/class/System/System.Globalization/Locale.cs
new file mode 100755
index 00000000000..539184dbde4
--- /dev/null
+++ b/mcs/class/System/System.Globalization/Locale.cs
@@ -0,0 +1,22 @@
+//
+// System.Globalization.Locale.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Globalization {
+
+ internal class 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/System.Net.Sockets/AddressFamily.cs b/mcs/class/System/System.Net.Sockets/AddressFamily.cs
new file mode 100644
index 00000000000..c53fd8835b1
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/AddressFamily.cs
@@ -0,0 +1,50 @@
+// AddressFamily.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:59 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ [Serializable]
+ public enum AddressFamily {
+ Unknown = -1,
+ Unspecified = 0,
+ Unix = 1,
+ InterNetwork = 2,
+ ImpLink = 3,
+ Pup = 4,
+ Chaos = 5,
+ NS = 6,
+ Ipx = 6,
+ Iso = 7,
+ Osi = 7,
+ Ecma = 8,
+ DataKit = 9,
+ Ccitt = 10,
+ Sna = 11,
+ DecNet = 12,
+ DataLink = 13,
+ Lat = 14,
+ HyperChannel = 15,
+ AppleTalk = 16,
+ NetBios = 17,
+ VoiceView = 18,
+ FireFox = 19,
+ Banyan = 21,
+ Atm = 22,
+ InterNetworkV6 = 23,
+ Cluster = 24,
+ Ieee12844 = 25,
+ Irda = 26,
+ NetworkDesigners = 28,
+ Max = 29,
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/ChangeLog b/mcs/class/System/System.Net.Sockets/ChangeLog
new file mode 100644
index 00000000000..bbaefab2b39
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/ChangeLog
@@ -0,0 +1,47 @@
+2002-04-24 Dick Porter <dick@ximian.com>
+
+ * Socket.cs (Poll): Give correct argument to Select(), as spotted
+ by Jaroslaw Kowalski <jarek@atm.com.pl>
+
+2002-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * UdpClient.cs: implemented.
+
+2002-04-02 Dick Porter <dick@ximian.com>
+
+ * TcpListener.cs: in Start(), set the socket listen backlog value
+ to a sane value (noticed by Jonathan Stowe <gellyfish@gellyfish.com>)
+
+2002-02-13 Dick Porter <dick@ximian.com>
+
+ * Socket.cs: Implemenent Select, Blocking, Connected,
+ GetSocketOption, Poll, SetSocketOption and Shutdown
+
+ * MulticastOption.cs:
+ * LingerOption.cs: Delete override methods that don't need to be
+ implemented
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * NetworkStream.cs: Implement class.
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * SocketException.cs: Implemented
+
+ * Socket.cs: Implemented most methods
+
+ * LingerOption.cs: Made compile
+
+ * AddressFamily.cs: Removed empty auto-generated comments
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * SocketException.cs: Reimplemented.
+
+2002-01-06 Ravi Pratap <ravi@ximian.com>
+
+ * ChangeLog : Add to this directory.
+
+ * SocketException.cs, TcpClient.cs, TcpListener.cs : MonoTODO
+ attribute decoration.
diff --git a/mcs/class/System/System.Net.Sockets/LingerOption.cs b/mcs/class/System/System.Net.Sockets/LingerOption.cs
new file mode 100644
index 00000000000..4c6117f5035
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/LingerOption.cs
@@ -0,0 +1,42 @@
+//
+// System.Net.Sockets.LingerOption.cs
+//
+// Author:
+// Andrew Sutton
+//
+// (C) Andrew Sutton
+//
+
+using System;
+
+namespace System.Net.Sockets
+{
+ // <remarks>
+ // Encapsulates a linger option.
+ // </remarks>
+ public class LingerOption
+ {
+ // Don't change the names of these fields without also
+ // changing socket-io.c in the runtime
+ private bool enabled;
+ protected int seconds;
+
+ public LingerOption (bool enable, int secs)
+ {
+ enabled = enable;
+ seconds = secs;
+ }
+
+ public bool Enabled
+ {
+ get { return enabled; }
+ set { enabled = value; }
+ }
+
+ public int LingerTime
+ {
+ get { return seconds; }
+ set { seconds = value; }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/MulticastOption.cs b/mcs/class/System/System.Net.Sockets/MulticastOption.cs
new file mode 100644
index 00000000000..759cd48f314
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/MulticastOption.cs
@@ -0,0 +1,48 @@
+//
+// System.Net.Sockets.MulticastOption.cs
+//
+// Author:
+// Andrew Sutton
+//
+// (C) Andrew Sutton
+//
+
+using System;
+using System.Net;
+
+namespace System.Net.Sockets
+{
+ // <remarks>
+ // Encapsulates a multicast option
+ // </remarks>
+ public class MulticastOption
+ {
+ // Don't change the names of these fields without also
+ // changing socket-io.c in the runtime
+ private IPAddress group;
+ protected IPAddress local;
+
+ public MulticastOption (IPAddress grp)
+ {
+ group = grp;
+ }
+
+ public MulticastOption (IPAddress grp, IPAddress addr)
+ {
+ group = grp;
+ local = addr;
+ }
+
+ public IPAddress Group
+ {
+ get { return group; }
+ set { group = value; }
+ }
+
+ public IPAddress LocalAddress
+ {
+ get { return local; }
+ set { local = value; }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/NetworkStream.cs b/mcs/class/System/System.Net.Sockets/NetworkStream.cs
new file mode 100644
index 00000000000..14059a39136
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/NetworkStream.cs
@@ -0,0 +1,272 @@
+//
+// System.Net.Sockets.NetworkStream.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.IO;
+
+namespace System.Net.Sockets
+{
+ public class NetworkStream : Stream, IDisposable {
+ FileAccess access;
+ Socket socket;
+ bool owns_socket;
+ bool readable, writeable;
+
+ public NetworkStream (Socket socket)
+ : this (socket, FileAccess.ReadWrite, false)
+ {
+ }
+
+ public NetworkStream (Socket socket, bool owns_socket)
+ : this (socket, FileAccess.ReadWrite, owns_socket)
+ {
+ }
+
+ public NetworkStream (Socket socket, FileAccess access)
+ : this (socket, access, false)
+ {
+ }
+
+ public NetworkStream (Socket socket, FileAccess access, bool owns_socket)
+ {
+ if (socket == null)
+ throw new ArgumentNullException ();
+ if (!socket.Connected)
+ throw new ArgumentException ("Not connected", "socket");
+ if (socket.SocketType != SocketType.Stream)
+ throw new ArgumentException ("Socket is not of type Stream", "socket");
+ if (!socket.Blocking)
+ throw new IOException ();
+
+ this.socket = socket;
+ this.owns_socket = owns_socket;
+ this.access = access;
+
+ readable = CanRead;
+ writeable = CanWrite;
+ }
+
+ public override bool CanRead {
+ get {
+ return access == FileAccess.ReadWrite || access == FileAccess.Read;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ // network sockets cant seek.
+ return false;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return access == FileAccess.ReadWrite || access == FileAccess.Write;
+ }
+ }
+
+ public virtual bool DataAvailable {
+ get {
+ return socket.Available > 0;
+ }
+ }
+
+ public override long Length {
+ get {
+ // Network sockets always throw an exception
+ throw new NotSupportedException ();
+ }
+ }
+
+ public override long Position {
+ get {
+ // Network sockets always throw an exception
+ throw new NotSupportedException ();
+ }
+
+ set {
+ // Network sockets always throw an exception
+ throw new NotSupportedException ();
+ }
+ }
+
+ protected bool Readable {
+ get {
+ return readable;
+ }
+
+ set {
+ readable = value;
+ }
+ }
+
+ protected Socket Socket {
+ get {
+ return socket;
+ }
+ }
+
+ protected bool Writeable {
+ get {
+ return writeable;
+ }
+
+ set {
+ writeable = value;
+ }
+ }
+
+ public override IAsyncResult BeginRead (byte [] buffer, int offset, int size,
+ AsyncCallback callback, object state)
+ {
+ IAsyncResult retval;
+
+ if (buffer == null)
+ throw new ArgumentNullException ();
+ if (socket == null)
+ throw new ObjectDisposedException ("socket");
+ int len = buffer.Length;
+ if (offset >= len || size != len)
+ throw new ArgumentOutOfRangeException ();
+
+ try {
+ retval = socket.BeginReceive (buffer, offset, size, 0, callback, state);
+ } catch {
+ throw new IOException ("BeginReceive failure");
+ }
+
+ return retval;
+ }
+
+ public override IAsyncResult BeginWrite (byte [] buffer, int offset, int size,
+ AsyncCallback callback, object state)
+ {
+ IAsyncResult retval;
+
+ if (buffer == null)
+ throw new ArgumentNullException ();
+ if (socket == null)
+ throw new ObjectDisposedException ("socket");
+ int len = buffer.Length;
+ if (len < size)
+ throw new ArgumentException ();
+
+ try {
+ retval = socket.BeginSend (buffer, offset, size, 0, callback, state);
+ } catch {
+ throw new IOException ("BeginWrite failure");
+ }
+
+ return retval;
+ }
+
+ ~NetworkStream ()
+ {
+ Dispose (false);
+ }
+
+ public override void Close ()
+ {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (owns_socket)
+ if (socket != null)
+ socket.Close ();
+ socket = null;
+ }
+
+ public override int EndRead (IAsyncResult ar)
+ {
+ int res;
+
+ if (ar == null)
+ throw new ArgumentNullException ();
+ if (socket == null)
+ throw new ObjectDisposedException ("socket");
+
+ try {
+ res = socket.EndReceive (ar);
+ } catch {
+ throw new IOException ("EndRead failure");
+ }
+ return res;
+ }
+
+ public override void EndWrite (IAsyncResult ar)
+ {
+ if (ar == null)
+ throw new ArgumentNullException ();
+ if (socket == null)
+ throw new ObjectDisposedException ("socket");
+
+ try {
+ socket.EndSend (ar);
+ } catch {
+ throw new IOException ("EndWrite failure");
+ }
+ }
+
+ public override void Flush ()
+ {
+ // network streams are non-buffered, this is a no-op
+ }
+
+ void IDisposable.Dispose ()
+ {
+ Dispose (true);
+ }
+
+ public override int Read (byte [] buffer, int offset, int size)
+ {
+ int res;
+
+ if (buffer == null)
+ throw new ArgumentNullException ();
+ if (buffer.Length < size)
+ throw new ArgumentException ();
+
+ try {
+ res = socket.Receive (buffer, offset, size, 0);
+ } catch {
+ throw new IOException ("Read failure");
+ }
+ return res;
+ }
+
+ public override long Seek (long offset, SeekOrigin origin)
+ {
+ // NetworkStream objects do not support seeking.
+
+ throw new NotSupportedException ();
+ }
+
+ public override void SetLength (long value)
+ {
+ // NetworkStream objects do not support SetLength
+
+ throw new NotSupportedException ();
+ }
+
+ public override void Write (byte [] buffer, int offset, int size)
+ {
+ if (buffer == null)
+ throw new ArgumentNullException ();
+ if (buffer.Length < size)
+ throw new ArgumentException ();
+ try {
+ socket.Send (buffer, offset, size, 0);
+ } catch {
+ throw new IOException ("Write failure");
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/ProtocolFamily.cs b/mcs/class/System/System.Net.Sockets/ProtocolFamily.cs
new file mode 100644
index 00000000000..3b0777e6e54
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/ProtocolFamily.cs
@@ -0,0 +1,46 @@
+//
+// System.Net.Sockets.ProtocolFamily.cs
+//
+// Author:
+// Andrew Sutton
+//
+// (C) Andrew Sutton
+//
+
+namespace System.Net.Sockets
+{
+ public enum ProtocolFamily
+ {
+ AppleTalk,
+ Atm,
+ Banyan,
+ Ccitt,
+ Chaos,
+ Cluster,
+ DataKit,
+ DataLink,
+ DecNet,
+ Ecma,
+ FireFox,
+ HyperChannel,
+ Ieee12844,
+ ImpLink,
+ InterNetwork,
+ InterNetworkV6,
+ Ipx,
+ Irda,
+ Iso,
+ Lat,
+ Max,
+ NetBios,
+ NetworkDesigners,
+ NS,
+ Osi,
+ Pup,
+ Sna,
+ Unix,
+ Unknown,
+ Unspecified,
+ VoiceView
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/ProtocolType.cs b/mcs/class/System/System.Net.Sockets/ProtocolType.cs
new file mode 100644
index 00000000000..0b106e5f946
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/ProtocolType.cs
@@ -0,0 +1,81 @@
+// ProtocolType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:24 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ProtocolType {
+
+ /// <summary>
+ /// </summary>
+ IP = 0,
+
+ /// <summary>
+ /// </summary>
+ Icmp = 1,
+
+ /// <summary>
+ /// </summary>
+ Igmp = 2,
+
+ /// <summary>
+ /// </summary>
+ Ggp = 3,
+
+ /// <summary>
+ /// </summary>
+ Tcp = 6,
+
+ /// <summary>
+ /// </summary>
+ Pup = 12,
+
+ /// <summary>
+ /// </summary>
+ Udp = 17,
+
+ /// <summary>
+ /// </summary>
+ Idp = 22,
+
+ /// <summary>
+ /// </summary>
+ ND = 77,
+
+ /// <summary>
+ /// </summary>
+ Raw = 255,
+
+ /// <summary>
+ /// </summary>
+ Unspecified = 0,
+
+ /// <summary>
+ /// </summary>
+ Ipx = 1000,
+
+ /// <summary>
+ /// </summary>
+ Spx = 1256,
+
+ /// <summary>
+ /// </summary>
+ SpxII = 1257,
+
+ /// <summary>
+ /// </summary>
+ Unknown = -1,
+ } // ProtocolType
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/SelectMode.cs b/mcs/class/System/System.Net.Sockets/SelectMode.cs
new file mode 100644
index 00000000000..587f2a1d1b6
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SelectMode.cs
@@ -0,0 +1,33 @@
+// SelectMode.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:30 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SelectMode {
+
+ /// <summary>
+ /// </summary>
+ SelectRead = 0,
+
+ /// <summary>
+ /// </summary>
+ SelectWrite = 1,
+
+ /// <summary>
+ /// </summary>
+ SelectError = 2,
+ } // SelectMode
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/Socket.cs b/mcs/class/System/System.Net.Sockets/Socket.cs
new file mode 100644
index 00000000000..890cdc47d59
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/Socket.cs
@@ -0,0 +1,937 @@
+// System.Net.Sockets.Socket.cs
+//
+// Authors:
+// Phillip Pearson (pp@myelin.co.nz)
+// Dick Porter <dick@ximian.com>
+//
+// Copyright (C) 2001, 2002 Phillip Pearson and Ximian, Inc.
+// http://www.myelin.co.nz
+//
+
+using System;
+using System.Net;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Threading;
+
+namespace System.Net.Sockets
+{
+ public class Socket : IDisposable
+ {
+ private sealed class SocketAsyncResult: IAsyncResult
+ {
+ private object state;
+ private WaitHandle waithandle;
+ private bool completed_sync, completed;
+ private Worker worker;
+
+ public SocketAsyncResult(object state) {
+ this.state=state;
+ waithandle=new ManualResetEvent(false);
+ completed_sync=completed=false;
+ }
+
+ public object AsyncState {
+ get {
+ return(state);
+ }
+ }
+
+ public WaitHandle AsyncWaitHandle {
+ get {
+ return(waithandle);
+ }
+ set {
+ waithandle=value;
+ }
+ }
+
+ public bool CompletedSynchronously {
+ get {
+ return(completed_sync);
+ }
+ }
+
+ public bool IsCompleted {
+ get {
+ return(completed);
+ }
+ set {
+ completed=value;
+ }
+ }
+
+ public Worker Worker {
+ get {
+ return(worker);
+ }
+ set {
+ worker=value;
+ }
+ }
+ }
+
+ private sealed class Worker
+ {
+ private AsyncCallback callback;
+ private SocketAsyncResult result;
+ private Socket socket;
+
+ // Parameters
+ private EndPoint endpoint; // Connect,ReceiveFrom,SendTo
+ private byte[] buffer; // Receive,ReceiveFrom,Send,SendTo
+ private int offset; // Receive,ReceiveFrom,Send,SendTo
+ private int size; // Receive,ReceiveFrom,Send,SendTo
+ private SocketFlags sockflags; // Receive,ReceiveFrom,Send,SendTo
+
+ // Return values
+ private Socket acc_socket;
+ private int total;
+
+
+ // For Accept
+ public Worker(Socket req_sock,
+ AsyncCallback req_callback,
+ SocketAsyncResult req_result)
+ : this(req_sock, null, 0, 0, SocketFlags.None,
+ null, req_callback, req_result) {}
+
+ // For Connect
+ public Worker(Socket req_sock, EndPoint req_endpoint,
+ AsyncCallback req_callback,
+ SocketAsyncResult req_result)
+ : this(req_sock, null, 0, 0, SocketFlags.None,
+ req_endpoint, req_callback,
+ req_result) {}
+
+ // For Receive and Send
+ public Worker(Socket req_sock, byte[] req_buffer,
+ int req_offset, int req_size,
+ SocketFlags req_sockflags,
+ AsyncCallback req_callback,
+ SocketAsyncResult req_result)
+ : this(req_sock, req_buffer, req_offset,
+ req_size, req_sockflags, null,
+ req_callback, req_result) {}
+
+ // For ReceiveFrom and SendTo
+ public Worker(Socket req_sock, byte[] req_buffer,
+ int req_offset, int req_size,
+ SocketFlags req_sockflags,
+ EndPoint req_endpoint,
+ AsyncCallback req_callback,
+ SocketAsyncResult req_result) {
+ socket=req_sock;
+ buffer=req_buffer;
+ offset=req_offset;
+ size=req_size;
+ sockflags=req_sockflags;
+ endpoint=req_endpoint;
+ callback=req_callback;
+ result=req_result;
+ }
+
+ private void End() {
+ callback(result);
+ ((ManualResetEvent)result.AsyncWaitHandle).Set();
+ result.IsCompleted=true;
+ }
+
+ public void Accept() {
+ lock(result) {
+ acc_socket=socket.Accept();
+ End();
+ }
+ }
+
+ public void Connect() {
+ lock(result) {
+ socket.Connect(endpoint);
+ End();
+ }
+ }
+
+ public void Receive() {
+ lock(result) {
+ total=socket.Receive(buffer, offset,
+ size, sockflags);
+ End();
+ }
+ }
+
+ public void ReceiveFrom() {
+ lock(result) {
+ total=socket.ReceiveFrom(buffer,
+ offset, size,
+ sockflags,
+ ref endpoint);
+ End();
+ }
+ }
+
+ public void Send() {
+ lock(result) {
+ total=socket.Send(buffer, offset, size,
+ sockflags);
+ End();
+ }
+ }
+
+ public void SendTo() {
+ lock(result) {
+ total=socket.SendTo(buffer, offset,
+ size, sockflags,
+ endpoint);
+ End();
+ }
+ }
+
+ public EndPoint EndPoint {
+ get {
+ return(endpoint);
+ }
+ }
+
+ public Socket Socket {
+ get {
+ return(acc_socket);
+ }
+ }
+
+ public int Total {
+ get {
+ return(total);
+ }
+ }
+ }
+
+ /* the field "socket" is looked up by name by the runtime */
+ private IntPtr socket;
+ private AddressFamily address_family;
+ private SocketType socket_type;
+ private ProtocolType protocol_type;
+ private bool blocking=true;
+
+ /* When true, the socket was connected at the time of
+ * the last IO operation
+ */
+ private bool connected=false;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Select_internal(ref Socket[] read,
+ ref Socket[] write,
+ ref Socket[] err,
+ int timeout);
+
+ public static void Select(IList read_list, IList write_list,
+ IList err_list, int time_us) {
+ if(read_list==null &&
+ write_list==null &&
+ err_list==null) {
+ throw new ArgumentNullException();
+ }
+
+ int read_count, write_count, err_count;
+
+ if(read_list!=null) {
+ read_count=read_list.Count;
+ } else {
+ read_count=0;
+ }
+
+ if(write_list!=null) {
+ write_count=write_list.Count;
+ } else {
+ write_count=0;
+ }
+
+ if(err_list!=null) {
+ err_count=err_list.Count;
+ } else {
+ err_count=0;
+ }
+
+ Socket[] read_arr=new Socket[read_count];
+ Socket[] write_arr=new Socket[write_count];
+ Socket[] err_arr=new Socket[err_count];
+
+ int i;
+
+ if(read_list!=null) {
+ i=0;
+
+ foreach (Socket s in read_list) {
+ read_arr[i]=s;
+ i++;
+ }
+ }
+
+ if(write_list!=null) {
+ i=0;
+ foreach (Socket s in write_list) {
+ write_arr[i]=s;
+ i++;
+ }
+ }
+
+ if(err_list!=null) {
+ i=0;
+ foreach (Socket s in err_list) {
+ err_arr[i]=s;
+ i++;
+ }
+ }
+
+ Select_internal(ref read_arr, ref write_arr,
+ ref err_arr, time_us);
+
+ if(read_list!=null) {
+ read_list.Clear();
+ for(i=0; i<read_arr.Length; i++) {
+ read_list.Add(read_arr[i]);
+ }
+ }
+
+ if(write_list!=null) {
+ write_list.Clear();
+ for(i=0; i<write_arr.Length; i++) {
+ write_list.Add(write_arr[i]);
+ }
+ }
+
+ if(err_list!=null) {
+ err_list.Clear();
+ for(i=0; i<err_arr.Length; i++) {
+ err_list.Add(err_arr[i]);
+ }
+ }
+ }
+
+ // private constructor used by Accept, which already
+ // has a socket handle to use
+ private Socket(AddressFamily family, SocketType type,
+ ProtocolType proto, IntPtr sock) {
+ address_family=family;
+ socket_type=type;
+ protocol_type=proto;
+
+ socket=sock;
+ connected=true;
+ }
+
+ // Creates a new system socket, returning the handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern IntPtr Socket_internal(AddressFamily family,
+ SocketType type,
+ ProtocolType proto);
+
+ public Socket(AddressFamily family, SocketType type,
+ ProtocolType proto) {
+ address_family=family;
+ socket_type=type;
+ protocol_type=proto;
+
+ socket=Socket_internal(family, type, proto);
+ }
+
+ public AddressFamily AddressFamily {
+ get {
+ return(address_family);
+ }
+ }
+
+ // Returns the amount of data waiting to be read on socket
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int Available_internal(IntPtr socket);
+
+ public int Available {
+ get {
+ return(Available_internal(socket));
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Blocking_internal(IntPtr socket,
+ bool block);
+
+ public bool Blocking {
+ get {
+ return(blocking);
+ }
+ set {
+ Blocking_internal(socket, value);
+ blocking=value;
+ }
+ }
+
+ public bool Connected {
+ get {
+ return(connected);
+ }
+ }
+
+ public IntPtr Handle {
+ get {
+ return(socket);
+ }
+ }
+
+ // Returns the local endpoint details in addr and port
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static SocketAddress LocalEndPoint_internal(IntPtr socket);
+
+ [MonoTODO("Support non-IP endpoints")]
+ public EndPoint LocalEndPoint {
+ get {
+ SocketAddress sa;
+
+ sa=LocalEndPoint_internal(socket);
+
+ if(sa.Family==AddressFamily.InterNetwork) {
+ // Stupidly, EndPoint.Create() is an
+ // instance method
+ return new IPEndPoint(0, 0).Create(sa);
+ } else {
+ throw new NotImplementedException();
+ }
+ }
+ }
+
+ public ProtocolType ProtocolType {
+ get {
+ return(protocol_type);
+ }
+ }
+
+ // Returns the remote endpoint details in addr and port
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static SocketAddress RemoteEndPoint_internal(IntPtr socket);
+
+ [MonoTODO("Support non-IP endpoints")]
+ public EndPoint RemoteEndPoint {
+ get {
+ SocketAddress sa;
+
+ sa=RemoteEndPoint_internal(socket);
+
+ if(sa.Family==AddressFamily.InterNetwork) {
+ // Stupidly, EndPoint.Create() is an
+ // instance method
+ return new IPEndPoint(0, 0).Create(sa);
+ } else {
+ throw new NotImplementedException();
+ }
+ }
+ }
+
+ public SocketType SocketType {
+ get {
+ return(socket_type);
+ }
+ }
+
+ // Creates a new system socket, returning the handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static IntPtr Accept_internal(IntPtr sock);
+
+ public Socket Accept() {
+ IntPtr sock=Accept_internal(socket);
+
+ return(new Socket(this.AddressFamily, this.SocketType,
+ this.ProtocolType, sock));
+ }
+
+ public IAsyncResult BeginAccept(AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, callback, req);
+ Thread child=new Thread(new ThreadStart(worker.Accept));
+ child.Start();
+ return(req);
+ }
+
+ public IAsyncResult BeginConnect(EndPoint end_point,
+ AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, end_point, callback,
+ req);
+ Thread child=new Thread(new ThreadStart(worker.Connect));
+ child.Start();
+ return(req);
+ }
+
+ public IAsyncResult BeginReceive(byte[] buffer, int offset,
+ int size,
+ SocketFlags socket_flags,
+ AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, buffer, offset, size,
+ socket_flags, callback, req);
+ Thread child=new Thread(new ThreadStart(worker.Receive));
+ child.Start();
+ return(req);
+ }
+
+ public IAsyncResult BeginReceiveFrom(byte[] buffer, int offset,
+ int size,
+ SocketFlags socket_flags,
+ ref EndPoint remote_end,
+ AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, buffer, offset, size,
+ socket_flags, remote_end,
+ callback, req);
+ Thread child=new Thread(new ThreadStart(worker.ReceiveFrom));
+ child.Start();
+ return(req);
+ }
+
+ public IAsyncResult BeginSend(byte[] buffer, int offset,
+ int size,
+ SocketFlags socket_flags,
+ AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, buffer, offset, size,
+ socket_flags, callback, req);
+ Thread child=new Thread(new ThreadStart(worker.Send));
+ child.Start();
+ return(req);
+ }
+
+ public IAsyncResult BeginSendTo(byte[] buffer, int offset,
+ int size,
+ SocketFlags socket_flags,
+ EndPoint remote_end,
+ AsyncCallback callback,
+ object state) {
+ SocketAsyncResult req=new SocketAsyncResult(state);
+ Worker worker=new Worker(this, buffer, offset, size,
+ socket_flags, remote_end,
+ callback, req);
+ Thread child=new Thread(new ThreadStart(worker.SendTo));
+ child.Start();
+ return(req);
+ }
+
+ // Creates a new system socket, returning the handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Bind_internal(IntPtr sock,
+ SocketAddress sa);
+
+ public void Bind(EndPoint local_end) {
+ if(local_end==null) {
+ throw new ArgumentNullException();
+ }
+
+ Bind_internal(socket, local_end.Serialize());
+ }
+
+ // Closes the socket
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Close_internal(IntPtr socket);
+
+ public void Close() {
+ connected=false;
+ Close_internal(socket);
+ }
+
+ // Connects to the remote address
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Connect_internal(IntPtr sock,
+ SocketAddress sa);
+
+ public void Connect(EndPoint remote_end) {
+ if(remote_end==null) {
+ throw new ArgumentNullException();
+ }
+
+ Connect_internal(socket, remote_end.Serialize());
+ connected=true;
+ }
+
+ public Socket EndAccept(IAsyncResult result) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ return(req.Worker.Socket);
+ }
+
+ public void EndConnect(IAsyncResult result) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ }
+
+ public int EndReceive(IAsyncResult result) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ return(req.Worker.Total);
+ }
+
+ public int EndReceiveFrom(IAsyncResult result,
+ ref EndPoint end_point) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ end_point=req.Worker.EndPoint;
+ return(req.Worker.Total);
+ }
+
+ public int EndSend(IAsyncResult result) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ return(req.Worker.Total);
+ }
+
+ public int EndSendTo(IAsyncResult result) {
+ SocketAsyncResult req=(SocketAsyncResult)result;
+
+ result.AsyncWaitHandle.WaitOne();
+ return(req.Worker.Total);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void GetSocketOption_obj_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, out object obj_val);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void GetSocketOption_arr_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, ref byte[] byte_val);
+
+ public object GetSocketOption(SocketOptionLevel level,
+ SocketOptionName name) {
+ object obj_val;
+
+ GetSocketOption_obj_internal(socket, level, name,
+ out obj_val);
+
+ if(name==SocketOptionName.Linger) {
+ return((LingerOption)obj_val);
+ } else if (name==SocketOptionName.AddMembership ||
+ name==SocketOptionName.DropMembership) {
+ return((MulticastOption)obj_val);
+ } else {
+ return((int)obj_val);
+ }
+ }
+
+ public void GetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ byte[] opt_value) {
+ int opt_value_len=opt_value.Length;
+
+ GetSocketOption_arr_internal(socket, level, name,
+ ref opt_value);
+ }
+
+ public byte[] GetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ int length) {
+ byte[] byte_val=new byte[length];
+
+ GetSocketOption_arr_internal(socket, level, name,
+ ref byte_val);
+
+ return(byte_val);
+ }
+
+ [MonoTODO("Totally undocumented")]
+ public int IOControl(int ioctl_code, byte[] in_value,
+ byte[] out_value) {
+ throw new NotImplementedException();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Listen_internal(IntPtr sock,
+ int backlog);
+
+ public void Listen(int backlog) {
+ Listen_internal(socket, backlog);
+ }
+
+ /* The docs for Poll() are a bit lightweight too, but
+ * it seems to be just a simple wrapper around Select.
+ */
+ public bool Poll(int time_us, SelectMode mode) {
+ ArrayList socketlist=new ArrayList(1);
+
+ socketlist.Add(this);
+
+ switch(mode) {
+ case SelectMode.SelectError:
+ Select(null, null, socketlist, time_us);
+ break;
+ case SelectMode.SelectRead:
+ Select(socketlist, null, null, time_us);
+ break;
+ case SelectMode.SelectWrite:
+ Select(null, socketlist, null, time_us);
+ break;
+ default:
+ throw new NotSupportedException();
+ }
+
+ if(socketlist.Contains(this)) {
+ return(true);
+ } else {
+ return(false);
+ }
+ }
+
+ public int Receive(byte[] buf) {
+ return(Receive(buf, 0, buf.Length, SocketFlags.None));
+ }
+
+ public int Receive(byte[] buf, SocketFlags flags) {
+ return(Receive(buf, 0, buf.Length, flags));
+ }
+
+ public int Receive(byte[] buf, int size, SocketFlags flags) {
+ return(Receive(buf, 0, size, flags));
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int Receive_internal(IntPtr sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags);
+
+ public int Receive(byte[] buf, int offset, int size,
+ SocketFlags flags) {
+ if(buf==null) {
+ throw new ArgumentNullException();
+ }
+ if(offset+size>buf.Length) {
+ throw new ArgumentException();
+ }
+
+ int ret;
+
+ try {
+ ret=Receive_internal(socket, buf, offset,
+ size, flags);
+ } catch(SocketException) {
+ connected=false;
+ throw;
+ }
+ connected=true;
+
+ return(ret);
+ }
+
+ public int ReceiveFrom(byte[] buf, ref EndPoint remote_end) {
+ return(ReceiveFrom(buf, 0, buf.Length,
+ SocketFlags.None, ref remote_end));
+ }
+
+ public int ReceiveFrom(byte[] buf, SocketFlags flags,
+ ref EndPoint remote_end) {
+ return(ReceiveFrom(buf, 0, buf.Length, flags,
+ ref remote_end));
+ }
+
+ public int ReceiveFrom(byte[] buf, int size, SocketFlags flags,
+ ref EndPoint remote_end) {
+ return(ReceiveFrom(buf, 0, size, flags,
+ ref remote_end));
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int RecvFrom_internal(IntPtr sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ ref SocketAddress sockaddr);
+
+ public int ReceiveFrom(byte[] buf, int offset, int size,
+ SocketFlags flags,
+ ref EndPoint remote_end) {
+ if(buf==null || remote_end==null) {
+ throw new ArgumentNullException();
+ }
+ if(offset+size>buf.Length) {
+ throw new ArgumentException();
+ }
+
+ SocketAddress sockaddr=remote_end.Serialize();
+ int count;
+
+ try {
+ count=RecvFrom_internal(socket, buf, offset,
+ size, flags,
+ ref sockaddr);
+ } catch(SocketException) {
+ connected=false;
+ throw;
+ }
+ connected=true;
+
+ // Stupidly, EndPoint.Create() is an
+ // instance method
+ remote_end=remote_end.Create(sockaddr);
+
+ return(count);
+ }
+
+ public int Send(byte[] buf) {
+ return(Send(buf, 0, buf.Length, SocketFlags.None));
+ }
+
+ public int Send(byte[] buf, SocketFlags flags) {
+ return(Send(buf, 0, buf.Length, flags));
+ }
+
+ public int Send(byte[] buf, int size, SocketFlags flags) {
+ return(Send(buf, 0, size, flags));
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int Send_internal(IntPtr sock,
+ byte[] buf, int offset,
+ int count,
+ SocketFlags flags);
+
+ public int Send(byte[] buf, int offset, int size,
+ SocketFlags flags) {
+ if(buf==null) {
+ throw new ArgumentNullException();
+ }
+ if(offset+size>buf.Length) {
+ throw new ArgumentException();
+ }
+
+ int ret;
+
+ try {
+ ret=Send_internal(socket, buf, offset, size,
+ flags);
+ } catch(SocketException) {
+ connected=false;
+ throw;
+ }
+ connected=true;
+
+ return(ret);
+ }
+
+ public int SendTo(byte[] buffer, EndPoint remote_end) {
+ return(SendTo(buffer, 0, buffer.Length,
+ SocketFlags.None, remote_end));
+ }
+
+ public int SendTo(byte[] buffer, SocketFlags flags,
+ EndPoint remote_end) {
+ return(SendTo(buffer, 0, buffer.Length, flags,
+ remote_end));
+ }
+
+ public int SendTo(byte[] buffer, int size, SocketFlags flags,
+ EndPoint remote_end) {
+ return(SendTo(buffer, size, buffer.Length, flags,
+ remote_end));
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int SendTo_internal(IntPtr sock,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ SocketAddress sa);
+
+ public int SendTo(byte[] buffer, int offset, int size,
+ SocketFlags flags, EndPoint remote_end) {
+ if(buffer==null || remote_end==null) {
+ throw new ArgumentNullException();
+ }
+ if(offset+size>buffer.Length) {
+ throw new ArgumentException();
+ }
+
+ SocketAddress sockaddr=remote_end.Serialize();
+
+ int ret;
+
+ try {
+ ret=SendTo_internal(socket, buffer, offset,
+ size, flags, sockaddr);
+ }
+ catch(SocketException) {
+ connected=false;
+ throw;
+ }
+ connected=true;
+
+ return(ret);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void SetSocketOption_internal(IntPtr socket, SocketOptionLevel level, SocketOptionName name, object obj_val, byte[] byte_val, int int_val);
+
+ public void SetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ byte[] opt_value) {
+ SetSocketOption_internal(socket, level, name, null,
+ opt_value, 0);
+ }
+
+ public void SetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ int opt_value) {
+ SetSocketOption_internal(socket, level, name, null,
+ null, opt_value);
+ }
+
+ public void SetSocketOption(SocketOptionLevel level,
+ SocketOptionName name,
+ object opt_value) {
+ if(opt_value==null) {
+ throw new ArgumentNullException();
+ }
+
+ SetSocketOption_internal(socket, level, name,
+ opt_value, null, 0);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Shutdown_internal(IntPtr socket, SocketShutdown how);
+
+ public void Shutdown(SocketShutdown how) {
+ Shutdown_internal(socket, how);
+ }
+
+ private bool disposed = false;
+
+ protected virtual void Dispose(bool explicitDisposing) {
+ // Check to see if Dispose has already been called
+ if(!this.disposed) {
+ // If this is a call to Dispose,
+ // dispose all managed resources.
+ if(explicitDisposing) {
+ // Free up stuff here
+ }
+
+ // Release unmanaged resources
+ this.disposed=true;
+ this.Close();
+ }
+ }
+
+ public void Dispose() {
+ Dispose(true);
+ // Take yourself off the Finalization queue
+ GC.SuppressFinalize(this);
+ }
+
+ ~Socket () {
+ Dispose(false);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/SocketException.cs b/mcs/class/System/System.Net.Sockets/SocketException.cs
new file mode 100644
index 00000000000..161a7cf27ae
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketException.cs
@@ -0,0 +1,41 @@
+//
+// System.Net.Sockets.NetworkStream.cs
+//
+// Author:
+// Dick Porter <dick@ximian.com>
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Runtime.Serialization;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.Sockets
+{
+ [Serializable]
+ public class SocketException : Win32Exception
+ {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int WSAGetLastError_internal();
+
+ public SocketException ()
+ : base (WSAGetLastError_internal()) {
+ }
+
+ public SocketException (int error)
+ : base (error) {
+ }
+
+ protected SocketException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context) {
+ }
+
+ public override int ErrorCode {
+ get {
+ return NativeErrorCode;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/SocketFlags.cs b/mcs/class/System/System.Net.Sockets/SocketFlags.cs
new file mode 100644
index 00000000000..8e958d47c05
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketFlags.cs
@@ -0,0 +1,42 @@
+// SocketFlags.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:49 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum SocketFlags {
+
+ /// <summary>
+ /// </summary>
+ None = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ OutOfBand = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ Peek = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ DontRoute = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ Partial = 0x00008000,
+ } // SocketFlags
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/SocketOptionLevel.cs b/mcs/class/System/System.Net.Sockets/SocketOptionLevel.cs
new file mode 100644
index 00000000000..657a4532154
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketOptionLevel.cs
@@ -0,0 +1,37 @@
+// SocketOptionLevel.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:55 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SocketOptionLevel {
+
+ /// <summary>
+ /// </summary>
+ Socket = 65535,
+
+ /// <summary>
+ /// </summary>
+ IP = 0,
+
+ /// <summary>
+ /// </summary>
+ Tcp = 6,
+
+ /// <summary>
+ /// </summary>
+ Udp = 17,
+ } // SocketOptionLevel
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/SocketOptionName.cs b/mcs/class/System/System.Net.Sockets/SocketOptionName.cs
new file mode 100644
index 00000000000..117c7fc0225
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketOptionName.cs
@@ -0,0 +1,181 @@
+// SocketOptionName.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:33:02 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SocketOptionName {
+
+ /// <summary>
+ /// </summary>
+ Debug = 1,
+
+ /// <summary>
+ /// </summary>
+ AcceptConnection = 2,
+
+ /// <summary>
+ /// </summary>
+ ReuseAddress = 4,
+
+ /// <summary>
+ /// </summary>
+ KeepAlive = 8,
+
+ /// <summary>
+ /// </summary>
+ DontRoute = 16,
+
+ /// <summary>
+ /// </summary>
+ Broadcast = 32,
+
+ /// <summary>
+ /// </summary>
+ UseLoopback = 64,
+
+ /// <summary>
+ /// </summary>
+ Linger = 128,
+
+ /// <summary>
+ /// </summary>
+ OutOfBandInline = 256,
+
+ /// <summary>
+ /// </summary>
+ DontLinger = -129,
+
+ /// <summary>
+ /// </summary>
+ ExclusiveAddressUse = -5,
+
+ /// <summary>
+ /// </summary>
+ SendBuffer = 4097,
+
+ /// <summary>
+ /// </summary>
+ ReceiveBuffer = 4098,
+
+ /// <summary>
+ /// </summary>
+ SendLowWater = 4099,
+
+ /// <summary>
+ /// </summary>
+ ReceiveLowWater = 4100,
+
+ /// <summary>
+ /// </summary>
+ SendTimeout = 4101,
+
+ /// <summary>
+ /// </summary>
+ ReceiveTimeout = 4102,
+
+ /// <summary>
+ /// </summary>
+ Error = 4103,
+
+ /// <summary>
+ /// </summary>
+ Type = 4104,
+
+ /// <summary>
+ /// </summary>
+ MaxConnections = 2147483647,
+
+ /// <summary>
+ /// </summary>
+ IPOptions = 1,
+
+ /// <summary>
+ /// </summary>
+ HeaderIncluded = 2,
+
+ /// <summary>
+ /// </summary>
+ TypeOfService = 3,
+
+ /// <summary>
+ /// </summary>
+ IpTimeToLive = 4,
+
+ /// <summary>
+ /// </summary>
+ MulticastInterface = 9,
+
+ /// <summary>
+ /// </summary>
+ MulticastTimeToLive = 10,
+
+ /// <summary>
+ /// </summary>
+ MulticastLoopback = 11,
+
+ /// <summary>
+ /// </summary>
+ AddMembership = 12,
+
+ /// <summary>
+ /// </summary>
+ DropMembership = 13,
+
+ /// <summary>
+ /// </summary>
+ DontFragment = 14,
+
+ /// <summary>
+ /// </summary>
+ AddSourceMembership = 15,
+
+ /// <summary>
+ /// </summary>
+ DropSourceMembership = 16,
+
+ /// <summary>
+ /// </summary>
+ BlockSource = 17,
+
+ /// <summary>
+ /// </summary>
+ UnblockSource = 18,
+
+ /// <summary>
+ /// </summary>
+ PacketInformation = 19,
+
+ /// <summary>
+ /// </summary>
+ NoDelay = 1,
+
+ /// <summary>
+ /// </summary>
+ BsdUrgent = 2,
+
+ /// <summary>
+ /// </summary>
+ Expedited = 2,
+
+ /// <summary>
+ /// </summary>
+ NoChecksum = 1,
+
+ /// <summary>
+ /// </summary>
+ ChecksumCoverage = 20,
+ } // SocketOptionName
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/SocketShutdown.cs b/mcs/class/System/System.Net.Sockets/SocketShutdown.cs
new file mode 100644
index 00000000000..0f9e5f269dc
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketShutdown.cs
@@ -0,0 +1,33 @@
+// SocketShutdown.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:43 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SocketShutdown {
+
+ /// <summary>
+ /// </summary>
+ Receive = 0,
+
+ /// <summary>
+ /// </summary>
+ Send = 1,
+
+ /// <summary>
+ /// </summary>
+ Both = 2,
+ } // SocketShutdown
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/SocketType.cs b/mcs/class/System/System.Net.Sockets/SocketType.cs
new file mode 100644
index 00000000000..bdb6c54d3c2
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/SocketType.cs
@@ -0,0 +1,45 @@
+// SocketType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:37 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net.Sockets {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SocketType {
+
+ /// <summary>
+ /// </summary>
+ Stream = 1,
+
+ /// <summary>
+ /// </summary>
+ Dgram = 2,
+
+ /// <summary>
+ /// </summary>
+ Raw = 3,
+
+ /// <summary>
+ /// </summary>
+ Rdm = 4,
+
+ /// <summary>
+ /// </summary>
+ Seqpacket = 5,
+
+ /// <summary>
+ /// </summary>
+ Unknown = -1,
+ } // SocketType
+
+} // System.Net.Sockets
diff --git a/mcs/class/System/System.Net.Sockets/TcpClient.cs b/mcs/class/System/System.Net.Sockets/TcpClient.cs
new file mode 100755
index 00000000000..452869c7137
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/TcpClient.cs
@@ -0,0 +1,321 @@
+// System.Net.Sockets.TcpClient.cs
+//
+// Author:
+// Phillip Pearson (pp@myelin.co.nz)
+//
+// Copyright (C) 2001, Phillip Pearson
+// http://www.myelin.co.nz
+//
+
+// NB: This is untested (probably buggy) code - take care if using it
+
+using System;
+using System.Net;
+
+namespace System.Net.Sockets
+{
+ /// <remarks>
+ /// A slightly more abstracted way to create an
+ /// outgoing network connections than a Socket.
+ /// </remarks>
+ public class TcpClient : IDisposable
+ {
+ // private data
+
+ private NetworkStream stream;
+ private bool active;
+ private Socket client;
+ private bool disposed = false;
+
+ // constructor
+
+ /// <summary>
+ /// Some code that is shared between the constructors.
+ /// </summary>
+ private void Init ()
+ {
+ active = false;
+ client = new Socket(AddressFamily.InterNetwork,
+ SocketType.Stream, ProtocolType.Tcp);
+ }
+
+ /// <summary>
+ /// Constructs a new TcpClient with no connection set up
+ /// </summary>
+ public TcpClient ()
+ {
+ Init();
+ client.Bind(new IPEndPoint(IPAddress.Any, 0));
+ }
+
+ /// <summary>
+ /// Constructs a new TcpClient with a specified local endpoint.
+ /// Use this if you want to have your connections originating
+ /// from a certain port, or a certain IP (on a multi homed
+ /// system).
+ /// </summary>
+ /// <param name="local_end_point">The aforementioned local endpoint</param>
+ public TcpClient (IPEndPoint local_end_point)
+ {
+ Init();
+ client.Bind(local_end_point);
+ }
+
+ /// <summary>
+ /// Constructs a new TcpClient and connects to a specified
+ /// host on a specified port. A quick way to set up a network
+ /// connection.
+ /// </summary>
+ /// <param name="hostname">The host to connect to, e.g.
+ /// 192.168.0.201 or www.myelin.co.nz</param>
+ /// <param name="port">The port to connect to, e.g. 80 for HTTP</param>
+ public TcpClient (string hostname, int port)
+ {
+ Init();
+ client.Bind(new IPEndPoint(IPAddress.Any, 0));
+ Connect(hostname, port);
+ }
+
+ /// <summary>
+ /// A flag that is 'true' if the TcpClient has an active connection
+ /// </summary>
+ protected bool Active
+ {
+ get { return active; }
+ set { active = value; }
+ }
+
+ /// <summary>
+ /// The socket that all network comms passes through
+ /// </summary>
+ [MonoTODO]
+ protected Socket Client
+ {
+ get { return client; }
+ set { client = value; } //TODO: should we be able to set the socket like this?
+ }
+
+ /// <summary>
+ /// Internal function to allow TcpListener.AcceptTcpClient
+ /// to work (it needs to be able to set protected property
+ /// 'Client')
+ /// </summary>
+ /// <param name="s"></param>
+ internal void SetTcpClient (Socket s)
+ {
+ Client = s; // client or Client? They are the same at the moment
+ }
+
+ /// <summary>
+ /// If set, the socket will remain open after it has been
+ /// instructed to close, in order to send data that remains
+ /// in the buffer.
+ /// </summary>
+ public LingerOption LingerState
+ {
+ get {
+ return (LingerOption)client.GetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.Linger);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.Linger, value);
+ }
+ }
+
+ /// <summary>
+ /// <p>If set, outbound data will be sent at once rather than collected
+ /// until enough is available to fill a packet.</p>
+ ///
+ /// <p>This is the TCP_NODELAY sockopt from BSD sockets and WinSock.
+ /// For more information, look up the Nagle algorithm.</p>
+ /// </summary>
+ public bool NoDelay
+ {
+ get {
+ return (bool)client.GetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.NoDelay);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.NoDelay, value);
+ }
+ }
+
+ /// <summary>
+ /// How big the receive buffer is (from the connection socket)
+ /// </summary>
+ public int ReceiveBufferSize
+ {
+ get {
+ return (int)client.GetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.ReceiveBuffer);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.ReceiveBuffer, value);
+ }
+ }
+
+ /// <summary>
+ /// How long before the socket will time out on a
+ /// Receive() call
+ /// </summary>
+ public int ReceiveTimeout
+ {
+ get {
+ return (int)client.GetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.ReceiveTimeout);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.ReceiveTimeout, value);
+ }
+ }
+
+ /// <summary>
+ /// How big the send buffer is (from the connection socket)
+ /// </summary>
+ public int SendBufferSize
+ {
+ get {
+ return (int)client.GetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.SendBuffer);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.SendBuffer, value);
+ }
+ }
+
+ /// <summary>
+ /// How long before the socket will time out on a
+ /// Send() call
+ /// </summary>
+ public int SendTimeout
+ {
+ get {
+ return (int)client.GetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.SendTimeout);
+ }
+ set {
+ client.SetSocketOption(
+ SocketOptionLevel.Socket,
+ SocketOptionName.SendTimeout, value);
+ }
+ }
+
+
+ // methods
+
+ /// <summary>
+ /// Closes the socket and disposes of all managed resources.
+ ///
+ /// Throws SocketException if something goes wrong while
+ /// closing the socket.
+ /// </summary>
+ public void Close ()
+ {
+ Dispose(true);
+ }
+
+ /// <summary>
+ /// Connects to a specified remote endpoint
+ ///
+ /// Throws SocketException if something goes wrong while
+ /// connecting.
+ /// </summary>
+ /// <param name="remote_end_point">The aforementioned endpoint</param>
+ public void Connect (IPEndPoint remote_end_point)
+ {
+ client.Connect(remote_end_point);
+ stream = new NetworkStream(client, true);
+ active = true;
+ }
+
+ /// <summary>
+ /// Connects to an IP address on a port
+ ///
+ /// Throws SocketException if something goes wrong while
+ /// connecting.
+ /// </summary>
+ /// <param name="address">The IP address (get it from Dns.GetHostByName)</param>
+ /// <param name="port">The port to connect to, e.g. 80 for HTTP</param>
+ public void Connect (IPAddress address, int port)
+ {
+ Connect(new IPEndPoint(address, port));
+ }
+
+ /// <summary>
+ /// Resolves a fully qualified domain name to an IP address
+ /// and connects to it on a specified port
+ ///
+ /// Throws SocketException if something goes wrong while
+ /// connecting.
+ /// </summary>
+ /// <param name="hostname">The hostname, e.g. www.myelin.co.nz</param>
+ /// <param name="port">The port, e.g. 80 for HTTP</param>
+ [MonoTODO]
+ public void Connect (string hostname, int port)
+ {
+ IPHostEntry host = Dns.GetHostByName(hostname);
+ /* TODO: This will connect to the first IP address returned
+ from GetHostByName. Is that right? */
+ Connect(new IPEndPoint(host.AddressList[0], port));
+ }
+
+ /// <summary>
+ /// Gets rid of all managed resources
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Gets rid of all unmanaged resources
+ /// </summary>
+ /// <param name="disposing">If this is true, it gets rid of all
+ /// managed resources as well</param>
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposed == false) {
+ if (active) {
+ // This closes the socket as well, as the NetworkStream
+ // owns the socket.
+ stream.Close();
+ active = false;
+ }
+ disposed = true;
+ }
+ }
+
+ /// <summary>
+ /// Destructor - just calls Dispose()
+ /// </summary>
+ ~TcpClient ()
+ {
+ Dispose(false);
+ }
+
+ /// <returns>A NetworkStream object connected to the
+ /// connection socket</returns>
+ public NetworkStream GetStream()
+ {
+ return stream;
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/TcpListener.cs b/mcs/class/System/System.Net.Sockets/TcpListener.cs
new file mode 100755
index 00000000000..731cb661239
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/TcpListener.cs
@@ -0,0 +1,171 @@
+// System.Net.Sockets.TcpListener.cs
+//
+// Author:
+// Phillip Pearson (pp@myelin.co.nz)
+//
+// Copyright (C) 2001, Phillip Pearson
+// http://www.myelin.co.nz
+//
+
+// NB: This is untested (probably buggy) code - take care using it
+
+using System;
+using System.Net;
+
+namespace System.Net.Sockets
+{
+ /// <remarks>
+ /// A slightly more abstracted way to listen for incoming
+ /// network connections than a Socket.
+ /// </remarks>
+ public class TcpListener
+ {
+ // private data
+
+ private bool active;
+ private Socket server;
+
+ // constructor
+
+ /// <summary>
+ /// Some code that is shared between the constructors.
+ /// </summary>
+ private void Init ()
+ {
+ active = false;
+ server = new Socket(AddressFamily.InterNetwork,
+ SocketType.Stream, ProtocolType.Tcp);
+ }
+
+ /// <summary>
+ /// Constructs a new TcpListener to listen on a specified port
+ /// </summary>
+ /// <param name="port">The port to listen on, e.g. 80 if you
+ /// are a web server</param>
+ public TcpListener (int port)
+ {
+ Init();
+ server.Bind(new IPEndPoint(IPAddress.Any, port));
+ }
+
+ /// <summary>
+ /// Constructs a new TcpListener with a specified local endpoint
+ /// </summary>
+ /// <param name="local_end_point">The endpoint</param>
+ public TcpListener (IPEndPoint local_end_point)
+ {
+ Init();
+ server.Bind(local_end_point);
+ }
+
+ /// <summary>
+ /// Constructs a new TcpListener, listening on a specified port
+ /// and IP (for use on a multi-homed machine)
+ /// </summary>
+ /// <param name="listen_ip">The IP to listen on</param>
+ /// <param name="port">The port to listen on</param>
+ public TcpListener (IPAddress listen_ip, int port)
+ {
+ Init();
+ server.Bind(new IPEndPoint(listen_ip, port));
+ }
+
+
+ // properties
+
+ /// <summary>
+ /// A flag that is 'true' if the TcpListener is listening,
+ /// or 'false' if it is not listening
+ /// </summary>
+ protected bool Active
+ {
+ get { return active; }
+ }
+
+ /// <summary>
+ /// The local end point
+ /// </summary>
+ public EndPoint LocalEndPoint
+ {
+ get { return server.LocalEndPoint; }
+ }
+
+ /// <summary>
+ /// The listening socket
+ /// </summary>
+ protected Socket Server
+ {
+ get { return server; }
+ }
+
+
+ // methods
+
+ /// <summary>
+ /// Accepts a pending connection
+ /// <returns>A Socket object for the new connection</returns>
+ public Socket AcceptSocket ()
+ {
+ return server.Accept();
+ }
+
+ /// <summary>
+ /// Accepts a pending connection
+ /// </summary>
+ /// <returns>A TcpClient
+ /// object made from the new socket.</returns>
+ public TcpClient AcceptTcpClient ()
+ {
+ TcpClient client = new TcpClient();
+ // use internal method SetTcpClient to make a
+ // client with the specified socket
+ client.SetTcpClient(AcceptSocket());
+ return client;
+ }
+
+ /// <summary>
+ /// Destructor - stops the listener listening
+ /// </summary>
+ ~TcpListener ()
+ {
+ if (active == true) {
+ Stop();
+ }
+ }
+
+ /// <returns>
+ /// Returns 'true' if there is a connection waiting to be accepted
+ /// with AcceptSocket() or AcceptTcpClient().
+ /// </returns>
+ public bool Pending ()
+ {
+ return server.Poll(1000, SelectMode.SelectRead);
+ }
+
+ /// <summary>
+ /// Tells the TcpListener to start listening.
+ /// </summary>
+ [MonoTODO]
+ public void Start ()
+ {
+ server.Listen(5); // According to the
+ // man page some BSD
+ // and BSD-derived
+ // systems limit the
+ // backlog to 5. This
+ // should really be
+ // configurable though
+ active = true;
+ }
+
+ /// <summary>
+ /// Tells the TcpListener to stop listening and dispose
+ /// of all managed resources.
+ /// </summary>
+ public void Stop ()
+ {
+ server.Close();
+ }
+
+ }
+}
diff --git a/mcs/class/System/System.Net.Sockets/UdpClient.cs b/mcs/class/System/System.Net.Sockets/UdpClient.cs
new file mode 100644
index 00000000000..a36b8f0acf3
--- /dev/null
+++ b/mcs/class/System/System.Net.Sockets/UdpClient.cs
@@ -0,0 +1,224 @@
+//
+// System.Net.Sockets.UdpClient.cs
+//
+// Author:
+// Gonzalo Paniagua Javier <gonzalo@ximian.com>
+//
+// Copyright (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Net;
+
+namespace System.Net.Sockets
+{
+ public class UdpClient : IDisposable
+ {
+ private bool disposed = false;
+ private bool active = false;
+ private Socket socket;
+ private IPEndPoint localEP;
+
+#region Constructors
+ public UdpClient ()
+ {
+ localEP = new IPEndPoint (IPAddress.Any, 0);
+ InitSocket ();
+ }
+
+ public UdpClient (int port)
+ {
+ if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
+ throw new ArgumentException ("Invalid port");
+
+ localEP = new IPEndPoint (IPAddress.Any, port);
+ InitSocket ();
+ }
+
+ public UdpClient (IPEndPoint localEP)
+ {
+ if (localEP == null)
+ throw new ArgumentNullException ("IPEndPoint cannot be null");
+
+ this.localEP = localEP;
+ InitSocket ();
+ }
+
+ public UdpClient (string hostname, int port)
+ {
+ if (hostname == null)
+ throw new ArgumentNullException ("hostname cannot be null");
+
+ if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
+ throw new ArgumentException ("Invalid port");
+
+ localEP = new IPEndPoint (IPAddress.Any, 0);
+ InitSocket ();
+ Connect (hostname, port);
+ }
+
+ private void InitSocket ()
+ {
+ active = false;
+ socket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
+ socket.Bind (localEP);
+ }
+
+#endregion // Constructors
+#region Public methods
+#region Close
+ public void Close ()
+ {
+ socket.Close ();
+ }
+#endregion
+#region Connect
+ public void Connect (IPEndPoint endPoint)
+ {
+ socket.Connect (endPoint);
+ active = true;
+ }
+
+ public void Connect (IPAddress addr, int port)
+ {
+ Connect (new IPEndPoint (addr, port));
+ }
+
+ public void Connect (string hostname, int port)
+ {
+ Connect (new IPEndPoint (Dns.Resolve (hostname).AddressList [0], port));
+ }
+#endregion
+#region Multicast methods
+ public void DropMulticastGroup(IPAddress multicastAddr)
+ {
+ socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.DropMembership,
+ new MulticastOption (multicastAddr));
+ }
+
+ public void JoinMulticastGroup(IPAddress multicastAddr)
+ {
+ socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership,
+ new MulticastOption (multicastAddr));
+ }
+
+ public void JoinMulticastGroup(IPAddress multicastAddr, int timeToLive)
+ {
+ JoinMulticastGroup (multicastAddr);
+ socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive,
+ timeToLive);
+ }
+#endregion
+#region Data I/O
+ public byte [] Receive (ref IPEndPoint remoteEP)
+ {
+ if (remoteEP == null)
+ throw new ArgumentNullException ("remoteEP cannot be null");
+
+ // Length of the array for receiving data??
+ byte [] recBuffer;
+ int available = socket.Available;
+
+ recBuffer = new byte [1024]; // FIXME: any suggestions?
+ EndPoint endPoint = (EndPoint) remoteEP;
+ int dataRead = socket.ReceiveFrom (recBuffer, ref endPoint);
+ if (dataRead < recBuffer.Length)
+ return CutArray (recBuffer, dataRead);
+
+ return recBuffer;
+ }
+
+ public int Send (byte [] dgram, int bytes)
+ {
+ if (dgram == null)
+ throw new ArgumentNullException ("dgram is null");
+
+ byte [] realDgram;
+ if (dgram.Length <= bytes)
+ realDgram = dgram;
+ else
+ realDgram = CutArray (dgram, (bytes >= dgram.Length) ? bytes : dgram.Length);
+
+ // the socket should be connected already, so I use Send instead of SendTo
+ return socket.Send (realDgram);
+ }
+
+ public int Send (byte [] dgram, int bytes, IPEndPoint endPoint)
+ {
+ if (dgram == null)
+ throw new ArgumentNullException ("dgram is null");
+
+ byte [] realDgram;
+ if (dgram.Length <= bytes)
+ realDgram = dgram;
+ else
+ realDgram = CutArray (dgram, (bytes >= dgram.Length) ? bytes : dgram.Length);
+
+ // the socket should not be connected
+ return socket.SendTo (realDgram, endPoint);
+ }
+
+ public int Send (byte [] dgram, int bytes, string hostname, int port)
+ {
+ return Send (dgram, bytes,
+ new IPEndPoint (Dns.Resolve (hostname).AddressList [0], port));
+ }
+
+ private byte [] CutArray (byte [] orig, int length)
+ {
+ byte [] newArray = new byte [length];
+ Array.Copy (orig, 0, newArray, 0, length);
+
+ return newArray;
+ }
+#endregion
+#region Properties
+ protected bool Active {
+ get { return active; }
+ set { active = value; }
+ }
+
+ protected Socket Client {
+ get { return socket; }
+ set { socket = value; }
+ }
+#endregion
+#region Overrides
+ public override bool Equals (object obj)
+ {
+ if (obj is UdpClient)
+ return (((UdpClient) obj).socket == socket &&
+ ((UdpClient) obj).localEP == localEP);
+
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (socket.GetHashCode () + localEP.GetHashCode () + (active ? 1 : 0));
+ }
+#endregion
+#region Disposing
+ public void Dispose()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposed == false) {
+ disposed = true;
+ socket.Close ();
+ }
+ }
+
+ ~UdpClient ()
+ {
+ Dispose (false);
+ }
+#endregion
+#endregion
+ }
+}
+
diff --git a/mcs/class/System/System.Net/AuthenticationManager.cs b/mcs/class/System/System.Net/AuthenticationManager.cs
index d1c3e48b291..b67ff556817 100755
--- a/mcs/class/System/System.Net/AuthenticationManager.cs
+++ b/mcs/class/System/System.Net/AuthenticationManager.cs
@@ -7,6 +7,8 @@
// (C) Ximian, Inc. http://www.ximian.com
//
+using System.Collections;
+
namespace System.Net {
public class AuthenticationManager {
@@ -15,41 +17,37 @@ namespace System.Net {
public static IEnumerator RegisteredModules {
get {
- if (!modules)
+ if (modules == null)
modules = new ArrayList ();
- return modules;
+ return modules as IEnumerator;
}
}
+ [MonoTODO]
public static Authorization PreAuthenticate (WebRequest request,
- ICredentialLookup credentials)
+ ICredentials credentials)
{
// FIXME: implement
+ return null;
}
public static void Register (IAuthenticationModule authenticationModule)
{
- if (!modules)
+ if (modules == null)
modules = new ArrayList ();
modules.Add (authenticationModule);
}
- public static Authorization Respond (WebHeaders ResponseHeaders,
- WebRequest Request,
- ICredentialLookup credentials)
- {
- // FIXME: implement
- return null;
- }
-
+ [MonoTODO]
public static void Unregister (IAuthenticationModule authenticationModule)
{
// FIXME: implement
}
- pubilc static void Unregister (string authenticationScheme)
+ [MonoTODO]
+ public static void Unregister (string authenticationScheme)
{
// FIXME: implement
}
diff --git a/mcs/class/System/System.Net/Authorization.cs b/mcs/class/System/System.Net/Authorization.cs
index e3866b0119e..60e8c889f22 100755
--- a/mcs/class/System/System.Net/Authorization.cs
+++ b/mcs/class/System/System.Net/Authorization.cs
@@ -27,7 +27,7 @@ namespace System.Net {
public bool Complete {
get {
- return finished;
+ return complete;
}
}
diff --git a/mcs/class/System/System.Net/ChangeLog b/mcs/class/System/System.Net/ChangeLog
new file mode 100644
index 00000000000..ed6f7bfb56e
--- /dev/null
+++ b/mcs/class/System/System.Net/ChangeLog
@@ -0,0 +1,119 @@
+2002-04-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddress.cs: initialize the read only fields with Parse().
+
+2002-04-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddress.cs: little changes to behave as MS.
+
+2002-04-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Dns.cs (Resolve): behave as MS. Agreed with Mads.
+
+2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddress.cs: the icalls for sockets are endianness-aware. So I
+ changed a few things. Also included a workaround for bug #23547.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddress.cs: use System.BitConverter.IsLittleEndian (suggested
+ by Paolo) instead of guessing the endianness.
+
+ * SocketAddress.cs: implemented Equals() and GetHashcode().
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPEndPoint.cs: modifications to constructors according to the
+ specifications (suggested by Lawrence Pit).
+
+2002-04-15 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * IPEndPoint.cs: Fixed build breaker.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPEndPoint.cs: implemented Equals() and GetHashCode(). Now 100%
+ complete.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddress.cs: finished all MonoTODO's. Use network order to store
+ the address. Check for max and min values in Address:set. IsLoopback()
+ returns now true for all 127.x.y.z. Some more checks in Parse ().
+ Some changes to behave as MS does.
+
+2002-02-24 Duncan Mak <duncan@ximian.com>
+
+ * ICredentialLookup.cs: Added the GetCredential method to the
+ interface. The interface is named "ICredentials", should this file
+ be renamed?
+
+ * NetworkCredential.cs: Added to CVS. Need to investigate on how
+ GetCredential() works
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * SocketAddress.cs: Implemented.
+
+ * IPEndPoint.cs: Turned 'Address' field into a real property.
+ Implemented Create() and Serialize() methods.
+
+ * IPAddress.cs: Fixed class constructor, turned 'Address' field
+ into a real property. Removed undocumented "public
+ IPAddress(string)" constructor.
+
+ * EndPoint.cs: Implemented. All methods return
+ NotSupportedException to enforce subclass overriding.
+
+ * Dns.cs: Replaced fixed-layout Hostent struct and cygwin
+ P/Invokes with portable internal calls.
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * Dns.cs: Updated to API changes.
+
+ * IPAddress.cs: Updated API. Much left to implement.
+
+ * Dns.cs: Remove IPToString method
+
+2002-01-06 Ravi Pratap <ravi@ximian.com>
+
+ * Dns.cs, AuthenticationManager.cs, SocketAddress.cs : MonoTODO
+ attribute insertion.
+
+2001-11-22 Nick Drochak <ndrochak@gol.com>
+
+ * IPAddress.cs: Fix constructor bug, properly name Address property,
+ and use triple-slash for comments.
+
+2001-11-20 Miguel de Icaza <miguel@ximian.com>
+
+ * IPAddress.cs: Updated to contain Any, Broadcast, Loopback and
+ None as suggested by Phillip.
+
+2001-09-26 Mads Pultz <mpultz@get2net.dk>
+ * Dns.cs: Initial work on BeginGetHostByName and EndGetHostByName implemented.
+
+2001-09-24 Mads Pultz <mpultz@get2net.dk>
+
+ * Dns.cs: Minor changes (some print statements removed)
+
+2001-09-23 Mads Pultz <mpultz@get2net.dk>
+
+ * Dns.cs: Initial work submitted to repository.
+ * IPHostEntry.cs: Initial work submitted to repository.
+
+2001-07-12 Sean MacIsaac <macisaac@ximian.com>
+
+ * Authorization.cs: Fixed compiler error.
+
+ * IAuthenticationModule.cs: Changes for Beta2.
+
+ * IPAddress.cs: Internal storage changed to be uint not int.
+
+ * IPEndPoint.cs: Fixed compiler error.
+
+ * EndPoint.cs: Fixed compiler error.
+
+ * AuthenticationManager.cs: Fixed typo.
diff --git a/mcs/class/System/System.Net/ConnectionModes.cs b/mcs/class/System/System.Net/ConnectionModes.cs
new file mode 100755
index 00000000000..3a1cc437702
--- /dev/null
+++ b/mcs/class/System/System.Net/ConnectionModes.cs
@@ -0,0 +1,37 @@
+// ConnectionModes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:35:39 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ConnectionModes {
+
+ /// <summary>
+ /// </summary>
+ Single = 0,
+
+ /// <summary>
+ /// </summary>
+ Persistent = 1,
+
+ /// <summary>
+ /// </summary>
+ Pipeline = 2,
+
+ /// <summary>
+ /// </summary>
+ Mux = 3,
+ } // ConnectionModes
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/Dns.cs b/mcs/class/System/System.Net/Dns.cs
new file mode 100644
index 00000000000..6583ade8de5
--- /dev/null
+++ b/mcs/class/System/System.Net/Dns.cs
@@ -0,0 +1,205 @@
+// System.Net.Dns.cs
+//
+// Author: Mads Pultz (mpultz@diku.dk)
+//
+// (C) Mads Pultz, 2001
+
+using System;
+using System.Net.Sockets;
+using System.Text;
+using System.Collections;
+using System.Threading;
+using System.Runtime.CompilerServices;
+
+namespace System.Net {
+ public sealed class Dns {
+
+ private Dns () {}
+
+ /// <summary>
+ /// Helper class
+ /// </summary>
+ private sealed class DnsAsyncResult: IAsyncResult {
+ private object state;
+ private WaitHandle waitHandle;
+ private bool completedSync, completed;
+ private Worker worker;
+
+ public DnsAsyncResult(object state) {
+ this.state = state;
+ waitHandle = new ManualResetEvent(false);
+ completedSync = completed = false;
+ }
+ public object AsyncState {
+ get { return state; }
+ }
+ public WaitHandle AsyncWaitHandle {
+ set { waitHandle = value; }
+ get { return waitHandle; }
+ }
+ public bool CompletedSynchronously {
+ get { return completedSync; }
+ }
+ public bool IsCompleted {
+ set { completed = value; }
+ get { return completed; }
+ }
+ public Worker Worker {
+ set { worker = value; }
+ get { return worker; }
+ }
+ }
+
+ /// <summary>
+ /// Helper class for asynchronous calls to DNS server
+ /// </summary>
+ private sealed class Worker {
+ private AsyncCallback reqCallback;
+ private DnsAsyncResult reqRes;
+ private string req;
+ private IPHostEntry result;
+
+ public Worker(string req, AsyncCallback reqCallback, DnsAsyncResult reqRes) {
+ this.req = req;
+ this.reqCallback = reqCallback;
+ this.reqRes = reqRes;
+ }
+ private void End() {
+ reqCallback(reqRes);
+ ((ManualResetEvent)reqRes.AsyncWaitHandle).Set();
+ reqRes.IsCompleted = true;
+ }
+ public void GetHostByName() {
+ lock(reqRes) {
+ result = Dns.GetHostByName(req);
+ End();
+ }
+ }
+ public void Resolve() {
+ lock(reqRes) {
+ result = Dns.Resolve(req);
+ End();
+ }
+ }
+ public IPHostEntry Result {
+ get { return result; }
+ }
+ }
+
+ public static IAsyncResult BeginGetHostByName(string hostName,
+ AsyncCallback requestCallback, object stateObject)
+ {
+ DnsAsyncResult requestResult = new DnsAsyncResult(stateObject);
+ Worker worker = new Worker(hostName, requestCallback, requestResult);
+ Thread child = new Thread(new ThreadStart(worker.GetHostByName));
+ child.Start();
+ return requestResult;
+ }
+
+ public static IAsyncResult BeginResolve(string hostName,
+ AsyncCallback requestCallback, object stateObject)
+ {
+ DnsAsyncResult requestResult = new DnsAsyncResult(stateObject);
+ Worker worker = new Worker(hostName, requestCallback, requestResult);
+ Thread child = new Thread(new ThreadStart(worker.Resolve));
+ child.Start();
+ return requestResult;
+ }
+
+ public static IPHostEntry EndGetHostByName(IAsyncResult asyncResult) {
+ return ((DnsAsyncResult)asyncResult).Worker.Result;
+ }
+
+ public static IPHostEntry EndResolve(IAsyncResult asyncResult) {
+ return ((DnsAsyncResult)asyncResult).Worker.Result;
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool GetHostByName_internal(string host, out string h_name, out string[] h_aliases, out string[] h_addr_list);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool GetHostByAddr_internal(string addr, out string h_name, out string[] h_aliases, out string[] h_addr_list);
+
+ private static IPHostEntry hostent_to_IPHostEntry(string h_name, string[] h_aliases, string[] h_addrlist) {
+ IPHostEntry he = new IPHostEntry();
+ IPAddress[] addrlist = new IPAddress[h_addrlist.Length];
+
+ he.HostName=h_name;
+ he.Aliases=h_aliases;
+ for(int i=0; i<h_addrlist.Length; i++) {
+ addrlist[i]=IPAddress.Parse(h_addrlist[i]);
+ }
+ he.AddressList=addrlist;
+
+ return(he);
+ }
+
+ public static IPHostEntry GetHostByAddress(IPAddress address) {
+ if (address == null)
+ throw new ArgumentNullException();
+ return GetHostByAddress(address.ToString());
+ }
+
+ public static IPHostEntry GetHostByAddress(string address) {
+ if (address == null) {
+ throw new ArgumentNullException();
+ }
+
+ string h_name;
+ string[] h_aliases, h_addrlist;
+
+ bool ret = GetHostByAddr_internal(address, out h_name,
+ out h_aliases,
+ out h_addrlist);
+ if (ret == false) {
+ throw new SocketException();
+ }
+
+ return(hostent_to_IPHostEntry(h_name, h_aliases,
+ h_addrlist));
+ }
+
+ public static IPHostEntry GetHostByName(string hostName) {
+ if (hostName == null) {
+ throw new ArgumentNullException();
+ }
+
+ string h_name;
+ string[] h_aliases, h_addrlist;
+
+ bool ret = GetHostByName_internal(hostName, out h_name,
+ out h_aliases,
+ out h_addrlist);
+ if (ret == false) {
+ throw new SocketException();
+ }
+
+ return(hostent_to_IPHostEntry(h_name, h_aliases,
+ h_addrlist));
+ }
+
+ /// <summary>
+ /// This method returns the host name associated with the local host.
+ /// </summary>
+ public static string GetHostName() {
+ IPHostEntry h = GetHostByAddress("127.0.0.1");
+ return h.HostName;
+ }
+
+ /// <summary>
+ /// This method resolves a DNS-style host name or IP
+ /// address.
+ /// </summary>
+ /// <param name=hostName>
+ /// A string containing either a DNS-style host name (e.g.
+ /// www.go-mono.com) or IP address (e.g. 129.250.184.233).
+ /// </param>
+ public static IPHostEntry Resolve(string hostName) {
+ if (hostName == null)
+ throw new ArgumentNullException();
+
+ return GetHostByName (hostName);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.Net/EndPoint.cs b/mcs/class/System/System.Net/EndPoint.cs
index d35cad86757..5e1d81f98dc 100755
--- a/mcs/class/System/System.Net/EndPoint.cs
+++ b/mcs/class/System/System.Net/EndPoint.cs
@@ -2,32 +2,39 @@
// System.Net.EndPoint.cs
//
// Author:
-// Miguel de Icaza (miguel@ximian.com)
+// Dick Porter (dick@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
+using System.Net.Sockets;
+
namespace System.Net {
+ [Serializable]
+ public abstract class EndPoint {
- public class EndPoint {
+ // NB: These methods really do nothing but throw
+ // NotSupportedException
+
+ public virtual AddressFamily AddressFamily {
+ get {
+ throw new NotSupportedException();
+ }
+ }
+
public virtual EndPoint Create (SocketAddress address)
{
+ throw new NotSupportedException();
}
public virtual SocketAddress Serialize ()
{
+ throw new NotSupportedException();
}
protected EndPoint ()
{
}
-
- public int AddressFamily {
- virtual get {
- }
- }
-
-
}
}
diff --git a/mcs/class/System/System.Net/HttpStatusCode.cs b/mcs/class/System/System.Net/HttpStatusCode.cs
new file mode 100755
index 00000000000..6688853fafc
--- /dev/null
+++ b/mcs/class/System/System.Net/HttpStatusCode.cs
@@ -0,0 +1,205 @@
+// HttpStatusCode.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:05 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum HttpStatusCode {
+
+ /// <summary>
+ /// </summary>
+ Continue = 100,
+
+ /// <summary>
+ /// </summary>
+ SwitchingProtocols = 101,
+
+ /// <summary>
+ /// </summary>
+ OK = 200,
+
+ /// <summary>
+ /// </summary>
+ Created = 201,
+
+ /// <summary>
+ /// </summary>
+ Accepted = 202,
+
+ /// <summary>
+ /// </summary>
+ NonAuthoritativeInformation = 203,
+
+ /// <summary>
+ /// </summary>
+ NoContent = 204,
+
+ /// <summary>
+ /// </summary>
+ ResetContent = 205,
+
+ /// <summary>
+ /// </summary>
+ PartialContent = 206,
+
+ /// <summary>
+ /// </summary>
+ MultipleChoices = 300,
+
+ /// <summary>
+ /// </summary>
+ Ambiguous = 300,
+
+ /// <summary>
+ /// </summary>
+ MovedPermanently = 301,
+
+ /// <summary>
+ /// </summary>
+ Moved = 301,
+
+ /// <summary>
+ /// </summary>
+ Found = 302,
+
+ /// <summary>
+ /// </summary>
+ Redirect = 302,
+
+ /// <summary>
+ /// </summary>
+ SeeOther = 303,
+
+ /// <summary>
+ /// </summary>
+ RedirectMethod = 303,
+
+ /// <summary>
+ /// </summary>
+ NotModified = 304,
+
+ /// <summary>
+ /// </summary>
+ UseProxy = 305,
+
+ /// <summary>
+ /// </summary>
+ Unused = 306,
+
+ /// <summary>
+ /// </summary>
+ TemporaryRedirect = 307,
+
+ /// <summary>
+ /// </summary>
+ RedirectKeepVerb = 307,
+
+ /// <summary>
+ /// </summary>
+ BadRequest = 400,
+
+ /// <summary>
+ /// </summary>
+ Unauthorized = 401,
+
+ /// <summary>
+ /// </summary>
+ PaymentRequired = 402,
+
+ /// <summary>
+ /// </summary>
+ Forbidden = 403,
+
+ /// <summary>
+ /// </summary>
+ NotFound = 404,
+
+ /// <summary>
+ /// </summary>
+ MethodNotAllowed = 405,
+
+ /// <summary>
+ /// </summary>
+ NotAcceptable = 406,
+
+ /// <summary>
+ /// </summary>
+ ProxyAuthenticationRequired = 407,
+
+ /// <summary>
+ /// </summary>
+ RequestTimeout = 408,
+
+ /// <summary>
+ /// </summary>
+ Conflict = 409,
+
+ /// <summary>
+ /// </summary>
+ Gone = 410,
+
+ /// <summary>
+ /// </summary>
+ LengthRequired = 411,
+
+ /// <summary>
+ /// </summary>
+ PreconditionFailed = 412,
+
+ /// <summary>
+ /// </summary>
+ RequestEntityTooLarge = 413,
+
+ /// <summary>
+ /// </summary>
+ RequestUriTooLong = 414,
+
+ /// <summary>
+ /// </summary>
+ UnsupportedMediaType = 415,
+
+ /// <summary>
+ /// </summary>
+ RequestedRangeNotSatisfiable = 416,
+
+ /// <summary>
+ /// </summary>
+ ExpectationFailed = 417,
+
+ /// <summary>
+ /// </summary>
+ InternalServerError = 500,
+
+ /// <summary>
+ /// </summary>
+ NotImplemented = 501,
+
+ /// <summary>
+ /// </summary>
+ BadGateway = 502,
+
+ /// <summary>
+ /// </summary>
+ ServiceUnavailable = 503,
+
+ /// <summary>
+ /// </summary>
+ GatewayTimeout = 504,
+
+ /// <summary>
+ /// </summary>
+ HttpVersionNotSupported = 505,
+ } // HttpStatusCode
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/IAuthenticationModule.cs b/mcs/class/System/System.Net/IAuthenticationModule.cs
index 089cdd9d930..15119f74da3 100755
--- a/mcs/class/System/System.Net/IAuthenticationModule.cs
+++ b/mcs/class/System/System.Net/IAuthenticationModule.cs
@@ -23,8 +23,8 @@ namespace System.Net {
bool CanRespond (string challenge);
- Authorization PreAuthenticate (WebRequest request, ICredentialLookup credentials);
+ Authorization PreAuthenticate (WebRequest request, ICredentials credentials);
- Authorization Respond (string challenge, WebRequest request, ICredentialLookup credentials);
+ Authorization Respond (string challenge, WebRequest request, ICredentials credentials);
}
}
diff --git a/mcs/class/System/System.Net/ICredentialLookup.cs b/mcs/class/System/System.Net/ICredentialLookup.cs
index 3e68efe955a..26b48ba9860 100755
--- a/mcs/class/System/System.Net/ICredentialLookup.cs
+++ b/mcs/class/System/System.Net/ICredentialLookup.cs
@@ -3,6 +3,7 @@
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
+// Duncan Mak (duncan@ximian.com)
//
namespace System.Net {
@@ -10,8 +11,8 @@ namespace System.Net {
// <remarks>
// Base authentication interface for Web clients.
// </remarks>
- public interface ICredential {
-
- NetworkCredential GetCredential (string uri, string AuthType);
+ public interface ICredentials
+ {
+ NetworkCredential GetCredential (Uri uri, string authType);
}
}
diff --git a/mcs/class/System/System.Net/IPAddress.cs b/mcs/class/System/System.Net/IPAddress.cs
new file mode 100755
index 00000000000..91405348072
--- /dev/null
+++ b/mcs/class/System/System.Net/IPAddress.cs
@@ -0,0 +1,228 @@
+//
+// System.Net.IPAddress.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+// Note: the address is stored in host order
+
+using System.Net.Sockets;
+using System.Runtime.InteropServices;
+
+using System;
+
+namespace System.Net {
+
+ /// <remarks>
+ /// Encapsulates an IP Address.
+ /// </remarks>
+ [Serializable]
+ public class IPAddress {
+ // Don't change the name of this field without also
+ // changing socket-io.c in the runtime
+ private long address;
+
+ public static readonly IPAddress Any = new IPAddress(0);
+ public static readonly IPAddress Broadcast = IPAddress.Parse ("255.255.255.255");
+ public static readonly IPAddress Loopback = IPAddress.Parse ("127.0.0.1");
+ public static readonly IPAddress None = IPAddress.Parse ("255.255.255.255");
+
+ private static short SwapShort (short number)
+ {
+ return (short) ( ((number >> 8) & 0xFF) + ((number << 8) & 0xFF00) );
+ }
+
+ private static int SwapInt (int number)
+ {
+ byte b0 = (byte) ((number >> 24) & 0xFF);
+ byte b1 = (byte) ((number >> 16) & 0xFF);
+ byte b2 = (byte) ((number >> 8) & 0xFF);
+ byte b3 = (byte) (number & 0xFF);
+ return b0 + (b1 << 8) + (b2 << 16) + (b3 << 24);
+ }
+
+ private static long SwapLong (long number)
+ {
+ byte b0 = (byte) ((number >> 56) & 0xFF);
+ byte b1 = (byte) ((number >> 48) & 0xFF);
+ byte b2 = (byte) ((number >> 40) & 0xFF);
+ byte b3 = (byte) ((number >> 32) & 0xFF);
+ byte b4 = (byte) ((number >> 24) & 0xFF);
+ byte b5 = (byte) ((number >> 16) & 0xFF);
+ byte b6 = (byte) ((number >> 8) & 0xFF);
+ byte b7 = (byte) (number & 0xFF);
+ return b0 + (b1 << 8) + (b2 << 16) + (b3 << 24) + (b4 << 32) + (b5 << 40) + (b6 << 48) + (b7 << 56);
+ }
+
+ public static short HostToNetworkOrder(short host) {
+ if (!BitConverter.IsLittleEndian)
+ return(host);
+
+ return SwapShort (host);
+ }
+
+ public static int HostToNetworkOrder(int host) {
+ if (!BitConverter.IsLittleEndian)
+ return(host);
+
+ return SwapInt (host);
+ }
+
+ public static long HostToNetworkOrder(long host) {
+ if (!BitConverter.IsLittleEndian)
+ return(host);
+
+ return SwapLong (host);
+ }
+
+ public static short NetworkToHostOrder(short network) {
+ if (!BitConverter.IsLittleEndian)
+ return(network);
+
+ return SwapShort (network);
+ }
+
+ public static int NetworkToHostOrder(int network) {
+ if (!BitConverter.IsLittleEndian)
+ return(network);
+
+ return SwapInt (network);
+ }
+
+ public static long NetworkToHostOrder(long network) {
+ if (!BitConverter.IsLittleEndian)
+ return(network);
+
+ return SwapLong (network);
+ }
+
+ /// <summary>
+ /// Constructor from a 32-bit constant with its bytes
+ /// in network order.
+ /// </summary>
+ public IPAddress (long addr)
+ {
+ Address = addr;
+ }
+
+ public static IPAddress Parse(string ip)
+ {
+ if(ip == null)
+ throw new ArgumentNullException("null ip string");
+
+ int pos = 0;
+ int ndots = 0;
+ char current;
+ bool prevDigit = false;
+
+ while (pos < ip.Length) {
+ current = ip [pos++];
+ if (Char.IsDigit (current))
+ prevDigit = true;
+ else
+ if (current == '.') {
+ // No more than 3 dots. Doesn't allow ending with a dot.
+ if (++ndots > 3 || pos == ip.Length || prevDigit == false)
+ throw new FormatException ("the string is not a valid ip");
+
+ prevDigit = false;
+ }
+ else if (!Char.IsDigit (current)) {
+ if (!Char.IsWhiteSpace (current))
+ throw new FormatException ("the string is not a valid ip");
+
+ // The same as MS does
+ if (pos == 1)
+ return new IPAddress (0);
+
+ break;
+ }
+ }
+
+ if (ndots != 3)
+ throw new FormatException ("the string is not a valid ip");
+
+
+ int a = 0;
+ string [] ips = ip.Split (new char [] {'.'});
+ // Make the number in network order
+ for (int i = ips.Length - 1; i >= 0; i--)
+ a = (a << 8) | (Byte.Parse(ips [i]));
+
+ return (new IPAddress (a));
+ }
+
+ public long Address {
+ get {
+ return address;
+ }
+ set {
+ // FIXME: Temporarily disabled as a workaround for bug #23547
+ /*if (value < 0 || value > 0x00000000FFFFFFFF)
+ throw new ArgumentOutOfRangeException (
+ "the address must be between 0 and 0xFFFFFFFF");*/
+
+ address = value;
+ }
+ }
+
+ public AddressFamily AddressFamily {
+ get {
+ return(AddressFamily.InterNetwork);
+ }
+ }
+
+
+ /// <summary>
+ /// Used to tell whether an address is a loopback.
+ /// All IP addresses of the form 127.X.Y.Z, where X, Y, and Z are in
+ /// the range 0-255, are loopback addresses.
+ /// </summary>
+ /// <param name="addr">Address to compare</param>
+ /// <returns></returns>
+ public static bool IsLoopback (IPAddress addr)
+ {
+ return (NetworkToHostOrder (addr.address) & 0xFF) == 127;
+ }
+
+ /// <summary>
+ /// Overrides System.Object.ToString to return
+ /// this object rendered in a quad-dotted notation
+ /// </summary>
+ public override string ToString ()
+ {
+ return ToString (address);
+ }
+
+ /// <summary>
+ /// Returns this object rendered in a quad-dotted notation
+ /// </summary>
+ static string ToString (long addr)
+ {
+ // addr is in network order
+ return (addr & 0xff).ToString () + "." +
+ ((addr >> 8) & 0xff).ToString () + "." +
+ ((addr >> 16) & 0xff).ToString () + "." +
+ ((addr >> 24) & 0xff).ToString ();
+ }
+
+ /// <returns>
+ /// Whether both objects are equal.
+ /// </returns>
+ public override bool Equals (object other)
+ {
+ if (other is System.Net.IPAddress){
+ return Address == ((System.Net.IPAddress) other).Address;
+ }
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)Address;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net/IPAdress.cs b/mcs/class/System/System.Net/IPAdress.cs
deleted file mode 100755
index fc4e2d8e79f..00000000000
--- a/mcs/class/System/System.Net/IPAdress.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-//
-// System.Net.IPAddress.cs
-//
-// Author:
-// Miguel de Icaza (miguel@ximian.com)
-//
-// (C) Ximian, Inc. http://www.ximian.com
-//
-
-namespace System.Net {
-
- // <remarks>
- // Encapsulates an IP Address.
- // </remarks>
- public class IPAddress {
- public int Address;
-
- public const int InaddrAny = 0;
- public const int InaddrBroadcast = 0xffffffff;
- public const int InaddrLoopback = 0x7f000001;
- public const int InaddrNone = 0xffffffff;
-
- // <summary>
- // Constructor from a 32-bit constant.
- // </summary>
- public IPAddress (int address)
- {
- this.address = address;
- }
-
- // <summary>
- // Constructor from a dotted quad notation.
- // </summary>
- public IPAddress (string ip)
- {
- string ips = ip.Split (".");
- int i, a = 0;
-
- for (i = 0; i < ips.Count; i++)
- a = (a << 8) | (ips [i].ToInt16 ());
-
- Address = a;
- }
-
- // <summary>
- // Used to tell whether an address is a loopback.
- // </summary>
- // <param name="addr">Address to compare</param>
- // <returns></returns>
- public static bool IsLoopback (IPAddress addr)
- {
- return addr.Address == InaddrLoopback;
- }
-
- // <summary>
- // Overrides System.Object.ToString to return
- // this object rendered in a quad-dotted notation
- // </summary>
- public override string ToString ()
- {
- System.Net.IPAddress.ToString (Address);
- }
-
- // <summary>
- // Returns this object rendered in a quad-dotted notation
- // </summary>
- public static string ToString (int addr)
- {
- return (addr >> 24).ToString () + "." +
- ((addr >> 16) & 0xff).ToString () + "." +
- ((addr >> 8) & 0xff).ToString () + "." +
- (addr & 0xff).ToString ();
- }
-
- // <returns>
- // Whether both objects are equal.
- // </returns>
- public override bool Equal (object other)
- {
- if (typeof (other) is System.Net.IPAddress){
- return Address == ((System.Net.IPAddress) other).Address;
- }
- return false;
- }
- }
-
-}
diff --git a/mcs/class/System/System.Net/IPEndPoint.cs b/mcs/class/System/System.Net/IPEndPoint.cs
index 3d3809faade..65366527ea7 100755
--- a/mcs/class/System/System.Net/IPEndPoint.cs
+++ b/mcs/class/System/System.Net/IPEndPoint.cs
@@ -7,33 +7,124 @@
// (C) Ximian, Inc. http://www.ximian.com
//
-namespace System.Net {
+using System.Net.Sockets;
+namespace System.Net {
+ [Serializable]
public class IPEndPoint : EndPoint {
- public IPAddress Address;
public const int MaxPort = 65535;
public const int MinPort = 0;
-
- public short Port;
public IPEndPoint (IPAddress address, int port)
{
+ if (address == null)
+ throw new ArgumentNullException ("Value cannot be null");
+
Address = address;
Port = port;
}
- public IPEndPoint (int iaddr, int port)
+ public IPEndPoint (long iaddr, int port) : this (new IPAddress (iaddr), port)
{
- IPAddress address = new IPAddress (iaddr);
+ }
+
+ private IPAddress address;
+ public IPAddress Address {
+ get {
+ return(address);
+ }
+ set {
+ address=value;
+ }
+ }
+
+ public override AddressFamily AddressFamily {
+ get {
+ return AddressFamily.InterNetwork;
+ }
+ }
+
+ private int port;
+ public int Port {
+ get {
+ return port;
+ }
+ set {
+ // LAMESPEC: no mention of sanity checking
+ // PS: MS controls the range when setting the value
+ if (value < MinPort || value > MaxPort)
+ throw new ArgumentOutOfRangeException ("Invalid port");
- IPEndPoint (address, port);
+ port = value;
+ }
}
- public int AddressFamily {
- override get {
- return 2;
+ // bytes 2 and 3 store the port, the rest
+ // stores the address
+ public override EndPoint Create(SocketAddress sockaddr) {
+ int size=sockaddr.Size;
+
+ // LAMESPEC: no mention of what to do if
+ // sockaddr is bogus
+ if(size<8) {
+ // absolute minimum amount needed for
+ // an address family, buffer size,
+ // port and address
+ return(null);
}
+ AddressFamily family=(AddressFamily)sockaddr[0];
+ if(family!=AddressFamily.InterNetwork) {
+ return(null);
+ }
+
+ int port=(((int)sockaddr[2])<<8) + (int)sockaddr[3];
+ long address=(((long)sockaddr[4])<<24) +
+ (((long)sockaddr[5])<<16) +
+ (((long)sockaddr[6])<<8) +
+ (long)sockaddr[7];
+
+ IPEndPoint ipe = new IPEndPoint(address, port);
+
+ return(ipe);
+ }
+
+ public override SocketAddress Serialize() {
+ // .net produces a 16 byte buffer, even though
+ // only 8 bytes are used. I guess its just a
+ // holdover from struct sockaddr padding.
+ SocketAddress sockaddr = new SocketAddress(AddressFamily.InterNetwork, 16);
+
+ // bytes 2 and 3 store the port, the rest
+ // stores the address
+ sockaddr[2]=(byte)((port>>8) & 0xff);
+ sockaddr[3]=(byte)(port & 0xff);
+
+ sockaddr[4]=(byte)((address.Address >> 24) & 0xff);
+ sockaddr[5]=(byte)((address.Address >> 16) & 0xff);
+ sockaddr[6]=(byte)((address.Address >> 8) & 0xff);
+ sockaddr[7]=(byte)(address.Address & 0xff);
+
+ return(sockaddr);
+ }
+
+ public override string ToString() {
+ return(address.ToString() + ":" + port);
+ }
+
+ public override bool Equals (Object obj)
+ {
+ if (obj is System.Net.IPEndPoint) {
+ return ( ((IPEndPoint) obj).port == port &&
+ ((IPEndPoint) obj).address == address);
+ }
+
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return address.GetHashCode () + port;
}
}
}
diff --git a/mcs/class/System/System.Net/IPHostEntry.cs b/mcs/class/System/System.Net/IPHostEntry.cs
new file mode 100644
index 00000000000..dd24e48b19b
--- /dev/null
+++ b/mcs/class/System/System.Net/IPHostEntry.cs
@@ -0,0 +1,75 @@
+// System.Net.IPHostEntry.cs
+//
+// Author: Mads Pultz (mpultz@diku.dk)
+//
+// (C) Mads Pultz, 2001
+
+using System;
+
+namespace System.Net {
+
+ public class IPHostEntry {
+ private IPAddress[] addressList;
+ private String[] aliases;
+ private String hostName;
+
+ public IPHostEntry() {
+ hostName = "localhost";
+ addressList = new IPAddress[1];
+ addressList[0] = IPAddress.Loopback;
+ aliases = new String[0];
+ }
+
+ public IPAddress[] AddressList {
+ get { return addressList; }
+ set { addressList = value; }
+ }
+
+ public string[] Aliases {
+ get { return aliases; }
+ set { aliases = value; }
+ }
+
+ public string HostName {
+ get { return hostName; }
+ set { hostName = value; }
+ }
+
+/* According to the .NET Framework SDK Documentation (beta 2) the following
+ methods from Object are not overrided. I implemented them before realizing
+ this but I leave the implementation here if needed in the future.
+
+ public override string ToString() {
+ string res = hostName;
+ if (addressList != null && addressList.Length > 0)
+ res += " [" + addressList[0] + "]";
+ return res;
+ }
+
+ public override bool Equals(object obj) {
+ if (obj is IPHostEntry) {
+ IPHostEntry h = (IPHostEntry)obj;
+ return hostName.Equals(h.HostName) && aliases.Equals(h.Aliases) &&
+ addressList.Equals(h.AddressList);
+ }
+ else
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return hostName.GetHashCode();
+ }
+
+ protected new object MemberwiseClone() {
+ IPHostEntry res = new IPHostEntry();
+ res.AddressList = new IPAddress[addressList.Length];
+ Array.Copy(addressList, res.AddressList, addressList.Length);
+ res.Aliases = new String[aliases.Length];
+ Array.Copy(aliases, res.Aliases, aliases.Length);
+ res.HostName = hostName;
+ return res;
+ }
+*/
+ }
+}
+
diff --git a/mcs/class/System/System.Net/NetworkAccess.cs b/mcs/class/System/System.Net/NetworkAccess.cs
new file mode 100755
index 00000000000..7d20e93aa2c
--- /dev/null
+++ b/mcs/class/System/System.Net/NetworkAccess.cs
@@ -0,0 +1,29 @@
+// NetworkAccess.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:35:58 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum NetworkAccess {
+
+ /// <summary>
+ /// </summary>
+ Accept = 128,
+
+ /// <summary>
+ /// </summary>
+ Connect = 64,
+ } // NetworkAccess
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/NetworkCredential.cs b/mcs/class/System/System.Net/NetworkCredential.cs
new file mode 100755
index 00000000000..8f62cdbe292
--- /dev/null
+++ b/mcs/class/System/System.Net/NetworkCredential.cs
@@ -0,0 +1,63 @@
+//
+// System.Net.NetworkCredential.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Net
+{
+ public class NetworkCredential : ICredentials
+ {
+ // Fields
+ string userName;
+ string password;
+ string domain;
+
+ // Constructors
+ public NetworkCredential ()
+ : base ()
+ {
+ }
+
+ public NetworkCredential (string userName, string password)
+ {
+ this.userName = userName;
+ this.password = password;
+ }
+
+ public NetworkCredential (string userName, string password, string domain)
+ {
+ this.userName = userName;
+ this.password = password;
+ this.domain = domain;
+ }
+
+ // Properties
+
+ public string Domain
+ {
+ get { return domain; }
+ set { domain = value; }
+ }
+
+ public string UserName
+ {
+ get { return userName; }
+ set { userName = value; }
+ }
+
+ public string Password
+ {
+ get { return password; }
+ set { password = value; }
+ }
+
+ [MonoTODO]
+ public NetworkCredential GetCredential (Uri uri, string authType)
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net/ProxyUseType.cs b/mcs/class/System/System.Net/ProxyUseType.cs
new file mode 100755
index 00000000000..fc878e6c09a
--- /dev/null
+++ b/mcs/class/System/System.Net/ProxyUseType.cs
@@ -0,0 +1,37 @@
+// ProxyUseType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:36:08 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ProxyUseType {
+
+ /// <summary>
+ /// </summary>
+ Standard = 0,
+
+ /// <summary>
+ /// </summary>
+ Tunnel = 1,
+
+ /// <summary>
+ /// </summary>
+ FtpGateway = 2,
+
+ /// <summary>
+ /// </summary>
+ Socks = 3,
+ } // ProxyUseType
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/SocketAddress.cs b/mcs/class/System/System.Net/SocketAddress.cs
index 78a384dbc25..757a71fd7f4 100755
--- a/mcs/class/System/System.Net/SocketAddress.cs
+++ b/mcs/class/System/System.Net/SocketAddress.cs
@@ -3,48 +3,99 @@
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
+// Dick Porter (dick@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
+using System.Net.Sockets;
+
namespace System.Net {
public class SocketAddress {
- short family;
- int size;
+ private byte[] data;
- public SocketAddress (short family, int size)
+ public SocketAddress (AddressFamily family, int size)
{
- this.family = family;
- this.size = size;
+ if(size<2) {
+ throw new ArgumentOutOfRangeException("size is too small");
+ }
+
+ data=new byte[size];
+ data[0]=(byte)family;
+ data[1]=(byte)size;
}
- public SocketAddress (short family)
+ public SocketAddress (AddressFamily family)
{
- this.family = family;
+ data=new byte[32];
+ data[0]=(byte)family;
+ data[1]=(byte)32;
}
- public short Family {
+ public AddressFamily Family {
get {
- return family;
+ return((AddressFamily)data[0]);
}
}
public int Size {
get {
- return size;
+ return((int)data[1]);
}
}
public byte this [ int offset ] {
get {
- // FIXME; Unimplemented.
- return 0;
+ return(data[offset]);
}
set {
- // FIXME: Unimplemented.
+ data[offset]=value;
+ }
+ }
+
+ public override string ToString() {
+ string af=((AddressFamily)data[0]).ToString();
+ int size=(int)data[1];
+ string ret=af+":"+size+":{";
+
+ for(int i=2; i<size; i++) {
+ int val=(int)data[i];
+ ret=ret+val;
+ if(i<size-1) {
+ ret=ret+",";
+ }
+ }
+
+ ret=ret+"}";
+
+ return(ret);
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj is System.Net.SocketAddress &&
+ ((System.Net.SocketAddress) obj).data.Length == data.Length){
+ byte [] otherData = ((System.Net.SocketAddress) obj).data;
+ for (int i = 0; i < data.Length; i++)
+ if (otherData [i] != data [i])
+ return false;
+
+ return true;
}
+
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ int code = 0;
+
+ for (int i = 0; i < data.Length; i++)
+ code += data [i] + i;
+
+ return code;
}
}
}
diff --git a/mcs/class/System/System.Net/TransportType.cs b/mcs/class/System/System.Net/TransportType.cs
new file mode 100755
index 00000000000..b9e5822fcff
--- /dev/null
+++ b/mcs/class/System/System.Net/TransportType.cs
@@ -0,0 +1,41 @@
+// TransportType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:32:18 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum TransportType {
+
+ /// <summary>
+ /// </summary>
+ Udp = 1,
+
+ /// <summary>
+ /// </summary>
+ Connectionless = 1,
+
+ /// <summary>
+ /// </summary>
+ Tcp = 2,
+
+ /// <summary>
+ /// </summary>
+ ConnectionOriented = 2,
+
+ /// <summary>
+ /// </summary>
+ All = 3,
+ } // TransportType
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/WebExceptionStatus.cs b/mcs/class/System/System.Net/WebExceptionStatus.cs
new file mode 100755
index 00000000000..05dd876bac0
--- /dev/null
+++ b/mcs/class/System/System.Net/WebExceptionStatus.cs
@@ -0,0 +1,85 @@
+// WebExceptionStatus.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:33:08 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum WebExceptionStatus {
+
+ /// <summary>
+ /// </summary>
+ Success = 0,
+
+ /// <summary>
+ /// </summary>
+ NameResolutionFailure = 1,
+
+ /// <summary>
+ /// </summary>
+ ConnectFailure = 2,
+
+ /// <summary>
+ /// </summary>
+ ReceiveFailure = 3,
+
+ /// <summary>
+ /// </summary>
+ SendFailure = 4,
+
+ /// <summary>
+ /// </summary>
+ PipelineFailure = 5,
+
+ /// <summary>
+ /// </summary>
+ RequestCanceled = 6,
+
+ /// <summary>
+ /// </summary>
+ ProtocolError = 7,
+
+ /// <summary>
+ /// </summary>
+ ConnectionClosed = 8,
+
+ /// <summary>
+ /// </summary>
+ TrustFailure = 9,
+
+ /// <summary>
+ /// </summary>
+ SecureChannelFailure = 10,
+
+ /// <summary>
+ /// </summary>
+ ServerProtocolViolation = 11,
+
+ /// <summary>
+ /// </summary>
+ KeepAliveFailure = 12,
+
+ /// <summary>
+ /// </summary>
+ Pending = 13,
+
+ /// <summary>
+ /// </summary>
+ Timeout = 14,
+
+ /// <summary>
+ /// </summary>
+ ProxyNameResolutionFailure = 15,
+ } // WebExceptionStatus
+
+} // System.Net
diff --git a/mcs/class/System/System.Net/WebStatus.cs b/mcs/class/System/System.Net/WebStatus.cs
new file mode 100755
index 00000000000..5ad5450a738
--- /dev/null
+++ b/mcs/class/System/System.Net/WebStatus.cs
@@ -0,0 +1,77 @@
+// WebStatus.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:37:37 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Net {
+
+
+ /// <summary>
+ /// </summary>
+ public enum WebStatus {
+
+ /// <summary>
+ /// </summary>
+ Success = 0,
+
+ /// <summary>
+ /// </summary>
+ NameResolutionFailure = 1,
+
+ /// <summary>
+ /// </summary>
+ ConnectFailure = 2,
+
+ /// <summary>
+ /// </summary>
+ ReceiveFailure = 3,
+
+ /// <summary>
+ /// </summary>
+ SendFailure = 4,
+
+ /// <summary>
+ /// </summary>
+ PipelineFailure = 5,
+
+ /// <summary>
+ /// </summary>
+ RequestCanceled = 6,
+
+ /// <summary>
+ /// </summary>
+ ProtocolError = 7,
+
+ /// <summary>
+ /// </summary>
+ ConnectionClosed = 8,
+
+ /// <summary>
+ /// </summary>
+ TrustFailure = 9,
+
+ /// <summary>
+ /// </summary>
+ SecureChannelFailure = 10,
+
+ /// <summary>
+ /// </summary>
+ ServerProtocolViolation = 11,
+
+ /// <summary>
+ /// </summary>
+ KeepAliveFailure = 12,
+
+ /// <summary>
+ /// </summary>
+ Pending = 13,
+ } // WebStatus
+
+} // System.Net
diff --git a/mcs/class/System/System.Text.RegularExpressions/ChangeLog b/mcs/class/System/System.Text.RegularExpressions/ChangeLog
new file mode 100644
index 00000000000..988bf618578
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/ChangeLog
@@ -0,0 +1,20 @@
+2002-04-06 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * cache.cs: Object methods should be overridden with "override".
+
+2002-04-04 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * RegexRunner.cs, RegexRunnerFactory.cs: MS support classes. Stubs
+ added for completeness.
+
+ * regex.cs, match.cs, collections.cs: Serializable attribute.
+
+2002-04-04 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * regex.cs: Added static Matches and IsMatch methods.
+
+2002-04-03 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * ChangeLog: Added changelog.
+
+ * cache.cs: Fixed bug in MRUList.Evict.
diff --git a/mcs/class/System/System.Text.RegularExpressions/RegexRunner.cs b/mcs/class/System/System.Text.RegularExpressions/RegexRunner.cs
new file mode 100644
index 00000000000..dfed1ad2479
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/RegexRunner.cs
@@ -0,0 +1,92 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: RegexRunner.cs
+//
+// author: Dan Lewis (dihlewis@yahoo.co.uk)
+// (c) 2002
+
+using System;
+
+namespace System.Text.RegularExpressions {
+
+ public abstract class RegexRunner {
+ // constructor
+
+ protected internal RegexRunner () {
+ throw new NotImplementedException ("RegexRunner is not supported by Mono.");
+ }
+
+ // protected abstract
+
+ protected abstract bool FindFirstChar ();
+
+ protected abstract void Go ();
+
+ protected abstract void InitTrackCount ();
+
+ // protected methods
+
+ protected void Capture (int capnum, int start, int end) {
+ }
+
+ protected static bool CharInSet (char ch, string set, string category) {
+ return false;
+ }
+
+ protected void Crawl (int i) {
+ }
+
+ protected int CrawlPos () {
+ return 0;
+ }
+
+ protected void DoubleCrawl () {
+ }
+
+ protected void DoubleStack () {
+ }
+
+ protected void DoubleTrack () {
+ }
+
+ protected void EnsureStorage () {
+ }
+
+ protected bool IsBoundary (int index, int startpos, int endpos) {
+ return false;
+ }
+
+ protected bool IsECMABoundary (int index, int startpos, int endpos) {
+ return false;
+ }
+
+ protected bool IsMatched (int cap) {
+ return false;
+ }
+
+ protected int MatchIndex (int cap) {
+ return 0;
+ }
+
+ protected int MatchLength (int cap) {
+ return 0;
+ }
+
+ protected int PopCrawl () {
+ return 0;
+ }
+
+ protected void TransferCapture (int capnum, int uncapnum, int start, int end) {
+ }
+
+ protected void Uncapture () {
+ }
+
+ // internal
+
+ protected internal Match Scan (Regex regex, string text, int textbeg, int textend, int textstart, int prevlen, bool quick) {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/RegexRunnerFactory.cs b/mcs/class/System/System.Text.RegularExpressions/RegexRunnerFactory.cs
new file mode 100644
index 00000000000..895ff165607
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/RegexRunnerFactory.cs
@@ -0,0 +1,20 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: RegexRunnerFactory.cs
+//
+// author: Dan Lewis (dihlewis@yahoo.co.uk)
+// (c) 2002
+
+using System;
+
+namespace System.Text.RegularExpressions {
+
+ public abstract class RegexRunnerFactory {
+ protected RegexRunnerFactory () {
+ throw new NotImplementedException ("RegexRunnerFactory is not supported by Mono.");
+ }
+
+ protected internal abstract RegexRunner CreateInstance ();
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/arch.cs b/mcs/class/System/System.Text.RegularExpressions/arch.cs
new file mode 100644
index 00000000000..274d9add1a9
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/arch.cs
@@ -0,0 +1,333 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: arch.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+
+namespace System.Text.RegularExpressions {
+
+ enum OpCode : ushort {
+ False = 0, // always fails
+ True, // always succeeds
+
+ // matching
+
+ Position, // zero-width position assertion
+ String, // match string literal
+ Reference, // back reference
+
+ // character matching
+
+ Character, // match character exactly
+ Category, // match character from category
+ Range, // match character from range
+ Set, // match character from set
+ In, // match character from group of tests
+
+ // capturing
+
+ Open, // open group
+ Close, // close group
+ Balance, // balance groups
+
+ // control flow
+
+ IfDefined, // conditional on capture
+ Sub, // non-backtracking subexpression
+ Test, // non-backtracking lookahead/behind
+ Branch, // alternative expression
+ Jump, // unconditional goto
+ Repeat, // new repeat context
+ Until, // repeat subexpression within context
+ FastRepeat, // repeat simple subexpression
+ Anchor, // anchoring expression
+
+ // miscellaneous
+
+ Info // pattern information
+ }
+
+ [Flags]
+ enum OpFlags : ushort {
+ None = 0x000,
+ Negate = 0x100, // succeed on mismatch
+ IgnoreCase = 0x200, // case insensitive matching
+ RightToLeft = 0x400, // right-to-left matching
+ Lazy = 0x800 // minimizing repeat
+ }
+
+ enum Position : ushort {
+ Any, // anywhere
+ Start, // start of string \A
+ StartOfString, // start of string \A
+ StartOfLine, // start of line ^
+ StartOfScan, // start of scan \G
+ End, // end or before newline at end \Z
+ EndOfString, // end of string \z
+ EndOfLine, // end of line $
+ Boundary, // word boundary \b
+ NonBoundary // not word boundary \B
+ };
+
+ // see category.cs for Category enum
+
+ interface IMachine {
+ Match Scan (Regex regex, string text, int start, int end);
+ }
+
+ interface IMachineFactory {
+ IMachine NewInstance ();
+ }
+
+ // Anchor SKIP OFFSET
+ //
+ // Flags: [RightToLeft] ??
+ // SKIP: relative address of tail expression
+ // OFFSET: offset of anchor from start of pattern
+ //
+ // Usage:
+ //
+ // Anchor :1 OFFSET
+ // <expr>
+ // True
+ // 1: <tail>
+ //
+ // Notes:
+ //
+ // In practice, the anchoring expression is only going to be
+ // Position (StartOfString, StartOfLine, StartOfScan) or String.
+ // This is because the optimizer looks for position anchors at the
+ // start of the expression, and if that fails it looks for the
+ // longest substring. If an expression has neither a position
+ // anchor or a longest substring anchor, then the anchoring expression
+ // is left empty. Since an empty expression will anchor at any
+ // position in any string, the entire input string will be scanned.
+
+ // String LEN STR...
+ //
+ // Flags: [RightToLeft, IgnoreCase]
+ // LEN: length of string
+ // STR: string characters
+
+ // Branch SKIP
+ //
+ // SKIP: relative address of next branch
+ //
+ // Branch :1
+ // <alt expr 1>
+ // Jump :4
+ // 1: Branch :2
+ // <alt expr 2>
+ // Jump :4
+ // 2: Branch :3
+ // <alt expr 3>
+ // Jump :4
+ // 3: False
+ // 4: <tail>
+
+ // Repeat SKIP MIN MAX
+ //
+ // Flags: [Lazy]
+ // SKIP: relative address of Until instruction
+ // MIN: minimum iterations
+ // MAX: maximum iterations (0xffff is infinity)
+ //
+ // Repeat :1 MIN MAX
+ // <expr>
+ // Until
+ // 1: <tail>
+
+ // FastRepeat SKIP MIN MAX
+ //
+ // Flags: [Lazy]
+ // SKIP: relative address of tail expression
+ // MIN: minimum iterations
+ // MAX: maximum iterations (0xffff is infinity)
+ //
+ // FastRepeat :1 MIN MAX
+ // <expr>
+ // True
+ // 1: <tail>
+ //
+ // Notes:
+ //
+ // The subexpression of a FastRepeat construct must not contain any
+ // complex operators. These include: Open, Close, Balance, Repeat,
+ // FastRepeat, Sub, Test. In addition, the subexpression must have
+ // been determined to have a fixed width.
+
+ // Sub SKIP
+ //
+ // SKIP: relative address of tail expression
+ //
+ // Sub :1
+ // <expr>
+ // 1: <tail>
+ //
+ // Notes:
+ //
+ // The Sub operator invokes an independent subexpression. This means
+ // that the subexpression will match only once and so will not
+ // participate in any backtracking.
+
+ // Test TSKIP FSKIP
+ //
+ // TSKIP: relative address of true expression
+ // FSKIP: relative address of false expression
+ //
+ // Usage: (?(?=test)true|false)
+ //
+ // Test :1 :2
+ // <test expr>
+ // 1: <true expr>
+ // Jump
+ // 2: <false epxr>
+ // <tail>
+ //
+ // Usage: (?(?=test)true)
+ //
+ // Test :1 :2
+ // <test expr>
+ // 1: <true expr>
+ // 2: <tail>
+ //
+ // Usage: (?=test)
+ //
+ // Test :1 :2
+ // <test expr>
+ // 1: <true expr>
+ // Jump 3:
+ // 2: False
+ // 3: <tail>
+ //
+ // Notes:
+ //
+ // For negative lookaheads, just swap the values of TSKIP and
+ // FSKIP. For lookbehinds, the test expression must be compiled
+ // in reverse. The test expression is always executed as an
+ // independent subexpression, so its behaviour is non-backtracking
+ // (like a Sub clause.)
+
+ // IfDefined SKIP GID
+ //
+ // SKIP: relative address of else expression
+ // GID: number of group to check
+ //
+ // Usage: (?(gid)true)
+ //
+ // IfDefined :1
+ // <true expr>
+ // 1: <tail>
+ //
+ // Usage: (?(gid)true|false)
+ //
+ // IfDefined :1
+ // <true expr>
+ // Jump :2
+ // 1: <false expr>
+ // 2: <tail>
+
+ // Jump SKIP
+ //
+ // SKIP: relative address of target expression
+ //
+ // Jump :1
+ // ...
+ // :1 <target expr>
+
+ // Character CHAR
+ //
+ // Flags: [Negate, IgnoreCase, RightToLeft]
+ // CHAR: exact character to match
+
+ // Category CAT
+ //
+ // Flags: [Negate, RightToLeft]
+ // CAT: category to match (see Category enum)
+
+ // Range LO HI
+ //
+ // Flags: [Negate, IgnoreCase, RightToLeft]
+ // LO: lowest character in range
+ // HI: higest character in range
+
+ // Set LO LEN SET...
+ //
+ // Flags: [Negate, IgnoreCase, RightToLeft]
+ // LO: lowest character in set
+ // LEN: number of words in set
+ // SET: bit array representing characters in set
+ //
+ // Notes:
+ //
+ // Each word in the set represents 16 characters, so the first word
+ // defines membership for characters LO to LO + 15, the second for
+ // LO + 16 to LO + 31, and so on up to LO + (LEN * 16 - 1). It is
+ // up to the compiler to provide a compact representation for sparse
+ // unicode sets. The simple way is to use Set 0 4096. Other methods
+ // involve paritioning the set and placing the components into an
+ // In block.
+
+ // In SKIP
+ //
+ // SKIP: relative address of tail expression
+ //
+ // Usage: [expr]
+ //
+ // In :1
+ // <expr>
+ // True
+ // :1 <tail>
+ //
+ // Usage: [^expr]
+ //
+ // In :1
+ // <expr>
+ // False
+ // :1 <tail>
+ //
+ // Notes:
+ //
+ // The In instruction consumes a single character, using the flags
+ // of the first instruction in the subexpression to determine its
+ // IgnoreCase and RightToLeft properties. The subexpression is then
+ // applied to the single character as a disjunction. If any instruction
+ // in the subexpression succeeds, the entire In construct succeeds
+ // and matching continues with the tail.
+
+ // Position POS
+ //
+ // POS: position to match (see Position enum)
+
+ // Open GID
+ //
+ // GID: number of group to open
+
+ // Close GID
+ //
+ // GID: number of group to close
+
+ // Balance GID BAL
+ //
+ // GID: number of capturing group (0 if none)
+ // BAL: number of group to undefine
+
+ // Info GROUPS MIN MAX
+ //
+ // GROUPS: number of capturing groups
+ // MIN: minimum width of pattern
+ // MAX: maximum width of pattern (0xffff means undefined)
+
+ // False
+
+ // True
+
+ // Reference GID
+ //
+ // Flags: [IgnoreCase, RightToLeft]
+ // GID: number of group to reference
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/cache.cs b/mcs/class/System/System.Text.RegularExpressions/cache.cs
new file mode 100644
index 00000000000..cffb2a171ad
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/cache.cs
@@ -0,0 +1,143 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: cache.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions {
+
+ class FactoryCache {
+ public FactoryCache (int capacity) {
+ this.capacity = capacity;
+ this.factories = new Hashtable (capacity);
+ this.mru_list = new MRUList ();
+ }
+
+ public void Add (string pattern, RegexOptions options, IMachineFactory factory) {
+ lock (this) {
+ Key k = new Key (pattern, options);
+
+ while (factories.Count >= capacity) {
+ object victim = mru_list.Evict ();
+ if (victim != null)
+ factories.Remove ((Key)victim);
+ }
+
+ factories[k] = factory;
+ mru_list.Use (k);
+ }
+ }
+
+ public IMachineFactory Lookup (string pattern, RegexOptions options) {
+ lock (this) {
+ Key k = new Key (pattern, options);
+ if (factories.Contains (k)) {
+ mru_list.Use (k);
+ return (IMachineFactory)factories[k];
+ }
+ }
+
+ return null;
+ }
+
+ private int capacity;
+ private Hashtable factories;
+ private MRUList mru_list;
+
+ struct Key {
+ public string pattern;
+ public RegexOptions options;
+
+ public Key (string pattern, RegexOptions options) {
+ this.pattern = pattern;
+ this.options = options;
+ }
+
+ public override int GetHashCode () {
+ return pattern.GetHashCode () ^ (int)options;
+ }
+
+ public override bool Equals (object o) {
+ if (o == null || o.GetType () != this.GetType ())
+ return false;
+
+ Key k = (Key)o;
+ return options == k.options && pattern.Equals (k.pattern);
+ }
+
+ public override string ToString () {
+ return "('" + pattern + "', [" + options + "])";
+ }
+ }
+ }
+
+ class MRUList {
+ public MRUList () {
+ head = tail = null;
+ }
+
+ public void Use (object o) {
+ Node node;
+
+ if (head == null) {
+ node = new Node (o);
+ head = tail = node;
+ return;
+ }
+
+ node = head;
+ while (node != null && !o.Equals (node.value))
+ node = node.previous;
+
+ if (node == null)
+ node = new Node (o);
+ else {
+ if (node == head)
+ return;
+
+ if (node == tail)
+ tail = node.next;
+ else
+ node.previous.next = node.next;
+
+ node.next.previous = node.previous;
+ }
+
+ head.next = node;
+ node.previous = head;
+ node.next = null;
+ head = node;
+ }
+
+ public object Evict () {
+ if (tail == null)
+ return null;
+
+ object o = tail.value;
+ tail = tail.next;
+
+ if (tail == null)
+ head = null;
+ else
+ tail.previous = null;
+
+ return o;
+ }
+
+ private Node head, tail;
+
+ private class Node {
+ public object value;
+ public Node previous, next;
+
+ public Node (object value) {
+ this.value = value;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/category.cs b/mcs/class/System/System.Text.RegularExpressions/category.cs
new file mode 100644
index 00000000000..763712cb581
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/category.cs
@@ -0,0 +1,637 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: category.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Globalization;
+
+namespace System.Text.RegularExpressions {
+
+ enum Category : ushort {
+ None,
+
+ // canonical classes
+
+ Any, // any character except newline .
+ AnySingleline, // any character . (s option)
+ Word, // any word character \w
+ Digit, // any digit character \d
+ WhiteSpace, // any whitespace character \s
+
+ // ECMAScript classes
+
+
+ EcmaAny,
+ EcmaAnySingleline,
+ EcmaWord, // [a-zA-Z_0-9]
+ EcmaDigit, // [0-9]
+ EcmaWhiteSpace, // [ \f\n\r\t\v]
+
+ // unicode categories
+
+ UnicodeL, // Letter
+ UnicodeM, // Mark
+ UnicodeN, // Number
+ UnicodeZ, // Separator
+ UnicodeP, // Punctuation
+ UnicodeS, // Symbol
+ UnicodeC, // Other
+
+ UnicodeLu, // UppercaseLetter
+ UnicodeLl, // LowercaseLetter
+ UnicodeLt, // TitlecaseLetter
+ UnicodeLm, // ModifierLetter
+ UnicodeLo, // OtherLetter
+ UnicodeMn, // NonspacingMark
+ UnicodeMe, // EnclosingMark
+ UnicodeMc, // SpacingMark
+ UnicodeNd, // DecimalNumber
+ UnicodeNl, // LetterNumber
+ UnicodeNo, // OtherNumber
+ UnicodeZs, // SpaceSeparator
+ UnicodeZl, // LineSeparator
+ UnicodeZp, // ParagraphSeparator
+ UnicodePd, // DashPunctuation
+ UnicodePs, // OpenPunctuation
+ UnicodePi, // InitialPunctuation
+ UnicodePe, // ClosePunctuation
+ UnicodePf, // FinalPunctuation
+ UnicodePc, // ConnectorPunctuation
+ UnicodePo, // OtherPunctuation
+ UnicodeSm, // MathSymbol
+ UnicodeSc, // CurrencySymbol
+ UnicodeSk, // ModifierSymbol
+ UnicodeSo, // OtherSymbol
+ UnicodeCc, // Control
+ UnicodeCf, // Format
+ UnicodeCo, // PrivateUse
+ UnicodeCs, // Surrogate
+ UnicodeCn, // Unassigned
+
+ // unicode block ranges
+
+ // notes: the categories marked with a star are valid unicode block ranges,
+ // but don't seem to be accepted by the MS parser using the /p{...} format.
+ // any ideas?
+
+ UnicodeBasicLatin,
+ UnicodeLatin1Supplement, // *
+ UnicodeLatinExtendedA, // *
+ UnicodeLatinExtendedB, // *
+ UnicodeIPAExtensions,
+ UnicodeSpacingModifierLetters,
+ UnicodeCombiningDiacriticalMarks,
+ UnicodeGreek,
+ UnicodeCyrillic,
+ UnicodeArmenian,
+ UnicodeHebrew,
+ UnicodeArabic,
+ UnicodeSyriac,
+ UnicodeThaana,
+ UnicodeDevanagari,
+ UnicodeBengali,
+ UnicodeGurmukhi,
+ UnicodeGujarati,
+ UnicodeOriya,
+ UnicodeTamil,
+ UnicodeTelugu,
+ UnicodeKannada,
+ UnicodeMalayalam,
+ UnicodeSinhala,
+ UnicodeThai,
+ UnicodeLao,
+ UnicodeTibetan,
+ UnicodeMyanmar,
+ UnicodeGeorgian,
+ UnicodeHangulJamo,
+ UnicodeEthiopic,
+ UnicodeCherokee,
+ UnicodeUnifiedCanadianAboriginalSyllabics,
+ UnicodeOgham,
+ UnicodeRunic,
+ UnicodeKhmer,
+ UnicodeMongolian,
+ UnicodeLatinExtendedAdditional,
+ UnicodeGreekExtended,
+ UnicodeGeneralPunctuation,
+ UnicodeSuperscriptsandSubscripts,
+ UnicodeCurrencySymbols,
+ UnicodeCombiningMarksforSymbols,
+ UnicodeLetterlikeSymbols,
+ UnicodeNumberForms,
+ UnicodeArrows,
+ UnicodeMathematicalOperators,
+ UnicodeMiscellaneousTechnical,
+ UnicodeControlPictures,
+ UnicodeOpticalCharacterRecognition,
+ UnicodeEnclosedAlphanumerics,
+ UnicodeBoxDrawing,
+ UnicodeBlockElements,
+ UnicodeGeometricShapes,
+ UnicodeMiscellaneousSymbols,
+ UnicodeDingbats,
+ UnicodeBraillePatterns,
+ UnicodeCJKRadicalsSupplement,
+ UnicodeKangxiRadicals,
+ UnicodeIdeographicDescriptionCharacters,
+ UnicodeCJKSymbolsandPunctuation,
+ UnicodeHiragana,
+ UnicodeKatakana,
+ UnicodeBopomofo,
+ UnicodeHangulCompatibilityJamo,
+ UnicodeKanbun,
+ UnicodeBopomofoExtended,
+ UnicodeEnclosedCJKLettersandMonths,
+ UnicodeCJKCompatibility,
+ UnicodeCJKUnifiedIdeographsExtensionA,
+ UnicodeCJKUnifiedIdeographs,
+ UnicodeYiSyllables,
+ UnicodeYiRadicals,
+ UnicodeHangulSyllables,
+ UnicodeHighSurrogates,
+ UnicodeHighPrivateUseSurrogates,
+ UnicodeLowSurrogates,
+ UnicodePrivateUse,
+ UnicodeCJKCompatibilityIdeographs,
+ UnicodeAlphabeticPresentationForms,
+ UnicodeArabicPresentationFormsA, // *
+ UnicodeCombiningHalfMarks,
+ UnicodeCJKCompatibilityForms,
+ UnicodeSmallFormVariants,
+ UnicodeArabicPresentationFormsB, // *
+ UnicodeSpecials,
+ UnicodeHalfwidthandFullwidthForms,
+
+ UnicodeOldItalic,
+ UnicodeGothic,
+ UnicodeDeseret,
+ UnicodeByzantineMusicalSymbols,
+ UnicodeMusicalSymbols,
+ UnicodeMathematicalAlphanumericSymbols,
+ UnicodeCJKUnifiedIdeographsExtensionB,
+ UnicodeCJKCompatibilityIdeographsSupplement,
+ UnicodeTags
+ }
+
+ class CategoryUtils {
+ public static Category CategoryFromName (string name) {
+ try {
+ if (name.Substring (0, 2).Equals ("Is")) // remove prefix from block range
+ name = name.Substring (2);
+
+ return (Category)Enum.Parse (typeof (Category), "Unicode" + name);
+ }
+ catch (ArgumentException) {
+ return Category.None;
+ }
+ }
+
+ public static bool IsCategory (Category cat, char c) {
+ switch (cat) {
+ case Category.None:
+ return false;
+
+ case Category.Any:
+ return c != '\n';
+
+ case Category.AnySingleline:
+ return true;
+
+ case Category.Word:
+ return
+ Char.IsLetterOrDigit (c) ||
+ IsCategory (UnicodeCategory.ConnectorPunctuation, c);
+
+ case Category.Digit:
+ return Char.IsDigit (c);
+
+ case Category.WhiteSpace:
+ return Char.IsWhiteSpace (c);
+
+ // ECMA categories
+
+ case Category.EcmaAny:
+ return c != '\n';
+
+ case Category.EcmaAnySingleline:
+ return true;
+
+ case Category.EcmaWord:
+ return
+ 'a' <= c && c <= 'z' ||
+ 'A' <= c && c <= 'Z' ||
+ '0' <= c && c <= '9' ||
+ '_' == c;
+
+ case Category.EcmaDigit:
+ return
+ '0' <= c && c <= 9;
+
+ case Category.EcmaWhiteSpace:
+ return
+ c == ' ' ||
+ c == '\f' ||
+ c == '\n' ||
+ c == '\r' ||
+ c == '\t' ||
+ c == '\v';
+
+ // Unicode categories...
+
+ // letter
+
+ case Category.UnicodeLu: return IsCategory (UnicodeCategory.UppercaseLetter, c);
+ case Category.UnicodeLl: return IsCategory (UnicodeCategory.LowercaseLetter, c);
+ case Category.UnicodeLt: return IsCategory (UnicodeCategory.TitlecaseLetter, c);
+ case Category.UnicodeLm: return IsCategory (UnicodeCategory.ModifierLetter, c);
+ case Category.UnicodeLo: return IsCategory (UnicodeCategory.OtherLetter, c);
+
+ // mark
+
+ case Category.UnicodeMn: return IsCategory (UnicodeCategory.NonSpacingMark, c);
+ case Category.UnicodeMe: return IsCategory (UnicodeCategory.EnclosingMark, c);
+ case Category.UnicodeMc: return IsCategory (UnicodeCategory.SpacingCombiningMark, c);
+ case Category.UnicodeNd: return IsCategory (UnicodeCategory.DecimalDigitNumber, c);
+
+ // number
+
+ case Category.UnicodeNl: return IsCategory (UnicodeCategory.LetterNumber, c);
+ case Category.UnicodeNo: return IsCategory (UnicodeCategory.OtherNumber, c);
+
+ // separator
+
+ case Category.UnicodeZs: return IsCategory (UnicodeCategory.SpaceSeparator, c);
+ case Category.UnicodeZl: return IsCategory (UnicodeCategory.LineSeparator, c);
+ case Category.UnicodeZp: return IsCategory (UnicodeCategory.ParagraphSeparator, c);
+
+ // punctuation
+
+ case Category.UnicodePd: return IsCategory (UnicodeCategory.DashPunctuation, c);
+ case Category.UnicodePs: return IsCategory (UnicodeCategory.OpenPunctuation, c);
+ case Category.UnicodePi: return IsCategory (UnicodeCategory.InitialQuotePunctuation, c);
+ case Category.UnicodePe: return IsCategory (UnicodeCategory.ClosePunctuation, c);
+ case Category.UnicodePf: return IsCategory (UnicodeCategory.FinalQuotePunctuation, c);
+ case Category.UnicodePc: return IsCategory (UnicodeCategory.ConnectorPunctuation, c);
+ case Category.UnicodePo: return IsCategory (UnicodeCategory.OtherPunctuation, c);
+
+ // symbol
+
+ case Category.UnicodeSm: return IsCategory (UnicodeCategory.MathSymbol, c);
+ case Category.UnicodeSc: return IsCategory (UnicodeCategory.CurrencySymbol, c);
+ case Category.UnicodeSk: return IsCategory (UnicodeCategory.ModifierSymbol, c);
+ case Category.UnicodeSo: return IsCategory (UnicodeCategory.OtherSymbol, c);
+
+ // other
+
+ case Category.UnicodeCc: return IsCategory (UnicodeCategory.Control, c);
+ case Category.UnicodeCf: return IsCategory (UnicodeCategory.Format, c);
+ case Category.UnicodeCo: return IsCategory (UnicodeCategory.PrivateUse, c);
+ case Category.UnicodeCs: return IsCategory (UnicodeCategory.Surrogate, c);
+ case Category.UnicodeCn: return IsCategory (UnicodeCategory.OtherNotAssigned, c);
+
+ case Category.UnicodeL: // letter
+ return
+ IsCategory (UnicodeCategory.UppercaseLetter, c) ||
+ IsCategory (UnicodeCategory.LowercaseLetter, c) ||
+ IsCategory (UnicodeCategory.TitlecaseLetter, c) ||
+ IsCategory (UnicodeCategory.ModifierLetter, c) ||
+ IsCategory (UnicodeCategory.OtherLetter, c);
+
+ case Category.UnicodeM: // mark
+ return
+ IsCategory (UnicodeCategory.NonSpacingMark, c) ||
+ IsCategory (UnicodeCategory.EnclosingMark, c) ||
+ IsCategory (UnicodeCategory.SpacingCombiningMark, c);
+
+ case Category.UnicodeN: // number
+ return
+ IsCategory (UnicodeCategory.DecimalDigitNumber, c) ||
+ IsCategory (UnicodeCategory.LetterNumber, c) ||
+ IsCategory (UnicodeCategory.OtherNumber, c);
+
+ case Category.UnicodeZ: // separator
+ return
+ IsCategory (UnicodeCategory.SpaceSeparator, c) ||
+ IsCategory (UnicodeCategory.LineSeparator, c) ||
+ IsCategory (UnicodeCategory.ParagraphSeparator, c);
+
+ case Category.UnicodeP: // punctuation
+ return
+ IsCategory (UnicodeCategory.DashPunctuation, c) ||
+ IsCategory (UnicodeCategory.OpenPunctuation, c) ||
+ IsCategory (UnicodeCategory.InitialQuotePunctuation, c) ||
+ IsCategory (UnicodeCategory.ClosePunctuation, c) ||
+ IsCategory (UnicodeCategory.FinalQuotePunctuation, c) ||
+ IsCategory (UnicodeCategory.ConnectorPunctuation, c) ||
+ IsCategory (UnicodeCategory.OtherPunctuation, c);
+
+ case Category.UnicodeS: // symbol
+ return
+ IsCategory (UnicodeCategory.MathSymbol, c) ||
+ IsCategory (UnicodeCategory.CurrencySymbol, c) ||
+ IsCategory (UnicodeCategory.ModifierSymbol, c) ||
+ IsCategory (UnicodeCategory.OtherSymbol, c);
+
+ case Category.UnicodeC: // other
+ return
+ IsCategory (UnicodeCategory.Control, c) ||
+ IsCategory (UnicodeCategory.Format, c) ||
+ IsCategory (UnicodeCategory.PrivateUse, c) ||
+ IsCategory (UnicodeCategory.Surrogate, c) ||
+ IsCategory (UnicodeCategory.OtherNotAssigned, c);
+
+ // Unicode block ranges...
+
+ case Category.UnicodeBasicLatin:
+ return '\u0000' <= c && c <= '\u007F';
+
+ case Category.UnicodeLatin1Supplement:
+ return '\u0080' <= c && c <= '\u00FF';
+
+ case Category.UnicodeLatinExtendedA:
+ return '\u0100' <= c && c <= '\u017F';
+
+ case Category.UnicodeLatinExtendedB:
+ return '\u0180' <= c && c <= '\u024F';
+
+ case Category.UnicodeIPAExtensions:
+ return '\u0250' <= c && c <= '\u02AF';
+
+ case Category.UnicodeSpacingModifierLetters:
+ return '\u02B0' <= c && c <= '\u02FF';
+
+ case Category.UnicodeCombiningDiacriticalMarks:
+ return '\u0300' <= c && c <= '\u036F';
+
+ case Category.UnicodeGreek:
+ return '\u0370' <= c && c <= '\u03FF';
+
+ case Category.UnicodeCyrillic:
+ return '\u0400' <= c && c <= '\u04FF';
+
+ case Category.UnicodeArmenian:
+ return '\u0530' <= c && c <= '\u058F';
+
+ case Category.UnicodeHebrew:
+ return '\u0590' <= c && c <= '\u05FF';
+
+ case Category.UnicodeArabic:
+ return '\u0600' <= c && c <= '\u06FF';
+
+ case Category.UnicodeSyriac:
+ return '\u0700' <= c && c <= '\u074F';
+
+ case Category.UnicodeThaana:
+ return '\u0780' <= c && c <= '\u07BF';
+
+ case Category.UnicodeDevanagari:
+ return '\u0900' <= c && c <= '\u097F';
+
+ case Category.UnicodeBengali:
+ return '\u0980' <= c && c <= '\u09FF';
+
+ case Category.UnicodeGurmukhi:
+ return '\u0A00' <= c && c <= '\u0A7F';
+
+ case Category.UnicodeGujarati:
+ return '\u0A80' <= c && c <= '\u0AFF';
+
+ case Category.UnicodeOriya:
+ return '\u0B00' <= c && c <= '\u0B7F';
+
+ case Category.UnicodeTamil:
+ return '\u0B80' <= c && c <= '\u0BFF';
+
+ case Category.UnicodeTelugu:
+ return '\u0C00' <= c && c <= '\u0C7F';
+
+ case Category.UnicodeKannada:
+ return '\u0C80' <= c && c <= '\u0CFF';
+
+ case Category.UnicodeMalayalam:
+ return '\u0D00' <= c && c <= '\u0D7F';
+
+ case Category.UnicodeSinhala:
+ return '\u0D80' <= c && c <= '\u0DFF';
+
+ case Category.UnicodeThai:
+ return '\u0E00' <= c && c <= '\u0E7F';
+
+ case Category.UnicodeLao:
+ return '\u0E80' <= c && c <= '\u0EFF';
+
+ case Category.UnicodeTibetan:
+ return '\u0F00' <= c && c <= '\u0FFF';
+
+ case Category.UnicodeMyanmar:
+ return '\u1000' <= c && c <= '\u109F';
+
+ case Category.UnicodeGeorgian:
+ return '\u10A0' <= c && c <= '\u10FF';
+
+ case Category.UnicodeHangulJamo:
+ return '\u1100' <= c && c <= '\u11FF';
+
+ case Category.UnicodeEthiopic:
+ return '\u1200' <= c && c <= '\u137F';
+
+ case Category.UnicodeCherokee:
+ return '\u13A0' <= c && c <= '\u13FF';
+
+ case Category.UnicodeUnifiedCanadianAboriginalSyllabics:
+ return '\u1400' <= c && c <= '\u167F';
+
+ case Category.UnicodeOgham:
+ return '\u1680' <= c && c <= '\u169F';
+
+ case Category.UnicodeRunic:
+ return '\u16A0' <= c && c <= '\u16FF';
+
+ case Category.UnicodeKhmer:
+ return '\u1780' <= c && c <= '\u17FF';
+
+ case Category.UnicodeMongolian:
+ return '\u1800' <= c && c <= '\u18AF';
+
+ case Category.UnicodeLatinExtendedAdditional:
+ return '\u1E00' <= c && c <= '\u1EFF';
+
+ case Category.UnicodeGreekExtended:
+ return '\u1F00' <= c && c <= '\u1FFF';
+
+ case Category.UnicodeGeneralPunctuation:
+ return '\u2000' <= c && c <= '\u206F';
+
+ case Category.UnicodeSuperscriptsandSubscripts:
+ return '\u2070' <= c && c <= '\u209F';
+
+ case Category.UnicodeCurrencySymbols:
+ return '\u20A0' <= c && c <= '\u20CF';
+
+ case Category.UnicodeCombiningMarksforSymbols:
+ return '\u20D0' <= c && c <= '\u20FF';
+
+ case Category.UnicodeLetterlikeSymbols:
+ return '\u2100' <= c && c <= '\u214F';
+
+ case Category.UnicodeNumberForms:
+ return '\u2150' <= c && c <= '\u218F';
+
+ case Category.UnicodeArrows:
+ return '\u2190' <= c && c <= '\u21FF';
+
+ case Category.UnicodeMathematicalOperators:
+ return '\u2200' <= c && c <= '\u22FF';
+
+ case Category.UnicodeMiscellaneousTechnical:
+ return '\u2300' <= c && c <= '\u23FF';
+
+ case Category.UnicodeControlPictures:
+ return '\u2400' <= c && c <= '\u243F';
+
+ case Category.UnicodeOpticalCharacterRecognition:
+ return '\u2440' <= c && c <= '\u245F';
+
+ case Category.UnicodeEnclosedAlphanumerics:
+ return '\u2460' <= c && c <= '\u24FF';
+
+ case Category.UnicodeBoxDrawing:
+ return '\u2500' <= c && c <= '\u257F';
+
+ case Category.UnicodeBlockElements:
+ return '\u2580' <= c && c <= '\u259F';
+
+ case Category.UnicodeGeometricShapes:
+ return '\u25A0' <= c && c <= '\u25FF';
+
+ case Category.UnicodeMiscellaneousSymbols:
+ return '\u2600' <= c && c <= '\u26FF';
+
+ case Category.UnicodeDingbats:
+ return '\u2700' <= c && c <= '\u27BF';
+
+ case Category.UnicodeBraillePatterns:
+ return '\u2800' <= c && c <= '\u28FF';
+
+ case Category.UnicodeCJKRadicalsSupplement:
+ return '\u2E80' <= c && c <= '\u2EFF';
+
+ case Category.UnicodeKangxiRadicals:
+ return '\u2F00' <= c && c <= '\u2FDF';
+
+ case Category.UnicodeIdeographicDescriptionCharacters:
+ return '\u2FF0' <= c && c <= '\u2FFF';
+
+ case Category.UnicodeCJKSymbolsandPunctuation:
+ return '\u3000' <= c && c <= '\u303F';
+
+ case Category.UnicodeHiragana:
+ return '\u3040' <= c && c <= '\u309F';
+
+ case Category.UnicodeKatakana:
+ return '\u30A0' <= c && c <= '\u30FF';
+
+ case Category.UnicodeBopomofo:
+ return '\u3100' <= c && c <= '\u312F';
+
+ case Category.UnicodeHangulCompatibilityJamo:
+ return '\u3130' <= c && c <= '\u318F';
+
+ case Category.UnicodeKanbun:
+ return '\u3190' <= c && c <= '\u319F';
+
+ case Category.UnicodeBopomofoExtended:
+ return '\u31A0' <= c && c <= '\u31BF';
+
+ case Category.UnicodeEnclosedCJKLettersandMonths:
+ return '\u3200' <= c && c <= '\u32FF';
+
+ case Category.UnicodeCJKCompatibility:
+ return '\u3300' <= c && c <= '\u33FF';
+
+ case Category.UnicodeCJKUnifiedIdeographsExtensionA:
+ return '\u3400' <= c && c <= '\u4DB5';
+
+ case Category.UnicodeCJKUnifiedIdeographs:
+ return '\u4E00' <= c && c <= '\u9FFF';
+
+ case Category.UnicodeYiSyllables:
+ return '\uA000' <= c && c <= '\uA48F';
+
+ case Category.UnicodeYiRadicals:
+ return '\uA490' <= c && c <= '\uA4CF';
+
+ case Category.UnicodeHangulSyllables:
+ return '\uAC00' <= c && c <= '\uD7A3';
+
+ case Category.UnicodeHighSurrogates:
+ return '\uD800' <= c && c <= '\uDB7F';
+
+ case Category.UnicodeHighPrivateUseSurrogates:
+ return '\uDB80' <= c && c <= '\uDBFF';
+
+ case Category.UnicodeLowSurrogates:
+ return '\uDC00' <= c && c <= '\uDFFF';
+
+ case Category.UnicodePrivateUse:
+ return '\uE000' <= c && c <= '\uF8FF';
+
+ case Category.UnicodeCJKCompatibilityIdeographs:
+ return '\uF900' <= c && c <= '\uFAFF';
+
+ case Category.UnicodeAlphabeticPresentationForms:
+ return '\uFB00' <= c && c <= '\uFB4F';
+
+ case Category.UnicodeArabicPresentationFormsA:
+ return '\uFB50' <= c && c <= '\uFDFF';
+
+ case Category.UnicodeCombiningHalfMarks:
+ return '\uFE20' <= c && c <= '\uFE2F';
+
+ case Category.UnicodeCJKCompatibilityForms:
+ return '\uFE30' <= c && c <= '\uFE4F';
+
+ case Category.UnicodeSmallFormVariants:
+ return '\uFE50' <= c && c <= '\uFE6F';
+
+ case Category.UnicodeArabicPresentationFormsB:
+ return '\uFE70' <= c && c <= '\uFEFE';
+
+ case Category.UnicodeHalfwidthandFullwidthForms:
+ return '\uFF00' <= c && c <= '\uFFEF';
+
+ case Category.UnicodeSpecials:
+ return
+ '\uFEFF' <= c && c <= '\uFEFF' ||
+ '\uFFF0' <= c && c <= '\uFFFD';
+
+ // these block ranges begin above 0x10000
+
+ case Category.UnicodeOldItalic:
+ case Category.UnicodeGothic:
+ case Category.UnicodeDeseret:
+ case Category.UnicodeByzantineMusicalSymbols:
+ case Category.UnicodeMusicalSymbols:
+ case Category.UnicodeMathematicalAlphanumericSymbols:
+ case Category.UnicodeCJKUnifiedIdeographsExtensionB:
+ case Category.UnicodeCJKCompatibilityIdeographsSupplement:
+ case Category.UnicodeTags:
+ return false;
+
+ default:
+ return false;
+ }
+ }
+
+ private static bool IsCategory (UnicodeCategory uc, char c) {
+ if (Char.GetUnicodeCategory (c) == uc)
+ return true;
+
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/collections.cs b/mcs/class/System/System.Text.RegularExpressions/collections.cs
new file mode 100644
index 00000000000..d5270321c8a
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/collections.cs
@@ -0,0 +1,127 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: collections.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions {
+ public abstract class RegexCollectionBase : ICollection, IEnumerable {
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public bool IsReadOnly {
+ get { return true; } // FIXME
+ }
+
+ public bool IsSynchronized {
+ get { return false; } // FIXME
+ }
+
+ public object SyncRoot {
+ get { return list; } // FIXME
+ }
+
+ public void CopyTo (Array array, int index) {
+ foreach (Object o in list) {
+ if (index > array.Length)
+ break;
+
+ array.SetValue (o, index ++);
+ }
+ }
+
+ public IEnumerator GetEnumerator () {
+ return new Enumerator (list);
+ }
+
+ // internal methods
+
+ internal RegexCollectionBase () {
+ list = new ArrayList ();
+ }
+
+ internal void Add (Object o) {
+ list.Add (o);
+ }
+
+ // IEnumerator implementation
+
+ private class Enumerator : IEnumerator {
+ public Enumerator (IList list) {
+ this.list = list;
+ Reset ();
+ }
+
+ public object Current {
+ get {
+ if (ptr >= list.Count)
+ throw new InvalidOperationException ();
+
+ return list[ptr];
+ }
+ }
+
+ public bool MoveNext () {
+ if (ptr > list.Count)
+ throw new InvalidOperationException ();
+
+ return ++ ptr < list.Count;
+ }
+
+ public void Reset () {
+ ptr = -1;
+ }
+
+ private IList list;
+ private int ptr;
+ }
+
+ // protected fields
+
+ protected ArrayList list;
+ }
+
+ [Serializable]
+ public class CaptureCollection : RegexCollectionBase, ICollection, IEnumerable {
+ public Capture this[int i] {
+ get { return (Capture)list[i]; }
+ }
+
+ internal CaptureCollection (Capture cap) {
+ while (cap != null) {
+ if (cap.IsDefined)
+ Add (cap);
+
+ cap = cap.Previous;
+ }
+
+ list.Reverse ();
+ }
+ }
+
+ [Serializable]
+ public class GroupCollection : RegexCollectionBase, ICollection, IEnumerable {
+ public Group this[int i] {
+ get { return (Group)list[i]; }
+ }
+
+ internal GroupCollection () {
+ }
+ }
+
+ [Serializable]
+ public class MatchCollection : RegexCollectionBase, ICollection, IEnumerable {
+ public virtual Match this[int i] {
+ get { return (Match)list[i]; }
+ }
+
+ internal MatchCollection () {
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/compiler.cs b/mcs/class/System/System.Text.RegularExpressions/compiler.cs
new file mode 100644
index 00000000000..82fb8cfbb73
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/compiler.cs
@@ -0,0 +1,368 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: compiler.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions {
+ abstract class LinkRef {
+ // empty
+ }
+
+ interface ICompiler {
+ void Reset ();
+ IMachineFactory GetMachineFactory ();
+
+ // instruction emission
+
+ void EmitFalse ();
+ void EmitTrue ();
+
+ // character matching
+
+ void EmitCharacter (char c, bool negate, bool ignore, bool reverse);
+ void EmitCategory (Category cat, bool negate, bool reverse);
+ void EmitRange (char lo, char hi, bool negate, bool ignore, bool reverse);
+ void EmitSet (char lo, BitArray set, bool negate, bool ignore, bool reverse);
+
+ // other operators
+
+ void EmitString (string str, bool ignore, bool reverse);
+ void EmitPosition (Position pos);
+ void EmitOpen (int gid);
+ void EmitClose (int gid);
+ void EmitBalance (int gid, int balance);
+ void EmitReference (int gid, bool ignore, bool reverse);
+
+ // constructs
+
+ void EmitIfDefined (int gid, LinkRef tail);
+ void EmitSub (LinkRef tail);
+ void EmitTest (LinkRef yes, LinkRef tail);
+ void EmitBranch (LinkRef next);
+ void EmitJump (LinkRef target);
+ void EmitRepeat (int min, int max, bool lazy, LinkRef until);
+ void EmitUntil (LinkRef repeat);
+ void EmitIn (LinkRef tail);
+ void EmitInfo (int count, int min, int max);
+ void EmitFastRepeat (int min, int max, bool lazy, LinkRef tail);
+ void EmitAnchor (int offset, LinkRef tail);
+
+ LinkRef NewLink ();
+ void ResolveLink (LinkRef link);
+ }
+
+ class InterpreterFactory : IMachineFactory {
+ public InterpreterFactory (ushort[] pattern) {
+ this.pattern = pattern;
+ }
+
+ public IMachine NewInstance () {
+ return new Interpreter (pattern);
+ }
+
+ private ushort[] pattern;
+ }
+
+ class PatternCompiler : ICompiler {
+ public static ushort EncodeOp (OpCode op, OpFlags flags) {
+ return (ushort)((int)op | ((int)flags & 0xff00));
+ }
+
+ public static void DecodeOp (ushort word, out OpCode op, out OpFlags flags) {
+ op = (OpCode)(word & 0x00ff);
+ flags = (OpFlags)(word & 0xff00);
+ }
+
+ public PatternCompiler () {
+ pgm = new ArrayList ();
+ }
+
+ // ICompiler implementation
+
+ public void Reset () {
+ pgm.Clear ();
+ }
+
+ public IMachineFactory GetMachineFactory () {
+ ushort[] image = new ushort[pgm.Count];
+ pgm.CopyTo (image);
+
+ return new InterpreterFactory (image);
+ }
+
+ public void EmitFalse () {
+ Emit (OpCode.False);
+ }
+
+ public void EmitTrue () {
+ Emit (OpCode.True);
+ }
+
+ public void EmitCharacter (char c, bool negate, bool ignore, bool reverse) {
+ Emit (OpCode.Character, MakeFlags (negate, ignore, reverse, false));
+
+ if (ignore)
+ c = Char.ToLower (c);
+
+ Emit ((ushort)c);
+ }
+
+ public void EmitCategory (Category cat, bool negate, bool reverse) {
+ Emit (OpCode.Category, MakeFlags (negate, false, reverse, false));
+ Emit ((ushort)cat);
+ }
+
+ public void EmitRange (char lo, char hi, bool negate, bool ignore, bool reverse) {
+ Emit (OpCode.Range, MakeFlags (negate, ignore, reverse, false));
+ Emit ((ushort)lo);
+ Emit ((ushort)hi);
+ }
+
+ public void EmitSet (char lo, BitArray set, bool negate, bool ignore, bool reverse) {
+ Emit (OpCode.Set, MakeFlags (negate, ignore, reverse, false));
+ Emit ((ushort)lo);
+
+ int len = (set.Length + 0xf) >> 4;
+ Emit ((ushort)len);
+
+ int b = 0;
+ while (len -- != 0) {
+ ushort word = 0;
+ for (int i = 0; i < 16; ++ i) {
+ if (b >= set.Length)
+ break;
+
+ if (set[b ++])
+ word |= (ushort)(1 << i);
+ }
+
+ Emit (word);
+ }
+ }
+
+ public void EmitString (string str, bool ignore, bool reverse) {
+ Emit (OpCode.String, MakeFlags (false, ignore, reverse, false));
+ int len = str.Length;
+ Emit ((ushort)len);
+
+ if (ignore)
+ str = str.ToLower ();
+
+ for (int i = 0; i < len; ++ i)
+ Emit ((ushort)str[i]);
+ }
+
+ public void EmitPosition (Position pos) {
+ Emit (OpCode.Position, 0);
+ Emit ((ushort)pos);
+ }
+
+ public void EmitOpen (int gid) {
+ Emit (OpCode.Open);
+ Emit ((ushort)gid);
+ }
+
+ public void EmitClose (int gid) {
+ Emit (OpCode.Close);
+ Emit ((ushort)gid);
+ }
+
+ public void EmitBalance (int gid, int balance) {
+ Emit (OpCode.Balance);
+ Emit ((ushort)gid);
+ Emit ((ushort)balance);
+ }
+
+ public void EmitReference (int gid, bool ignore, bool reverse) {
+ Emit (OpCode.Reference, MakeFlags (false, ignore, reverse, false));
+ Emit ((ushort)gid);
+ }
+
+ public void EmitIfDefined (int gid, LinkRef tail) {
+ BeginLink (tail);
+ Emit (OpCode.IfDefined);
+ EmitLink (tail);
+ Emit ((ushort)gid);
+ }
+
+ public void EmitSub (LinkRef tail) {
+ BeginLink (tail);
+ Emit (OpCode.Sub);
+ EmitLink (tail);
+ }
+
+ public void EmitTest (LinkRef yes, LinkRef tail) {
+ BeginLink (yes);
+ BeginLink (tail);
+ Emit (OpCode.Test);
+ EmitLink (yes);
+ EmitLink (tail);
+ }
+
+ public void EmitBranch (LinkRef next) {
+ BeginLink (next);
+ Emit (OpCode.Branch, 0);
+ EmitLink (next);
+ }
+
+ public void EmitJump (LinkRef target) {
+ BeginLink (target);
+ Emit (OpCode.Jump, 0);
+ EmitLink (target);
+ }
+
+ public void EmitRepeat (int min, int max, bool lazy, LinkRef until) {
+ BeginLink (until);
+ Emit (OpCode.Repeat, MakeFlags (false, false, false, lazy));
+ EmitLink (until);
+ Emit ((ushort)min);
+ Emit ((ushort)max);
+ }
+
+ public void EmitUntil (LinkRef repeat) {
+ ResolveLink (repeat);
+ Emit (OpCode.Until);
+ }
+
+ public void EmitFastRepeat (int min, int max, bool lazy, LinkRef tail) {
+ BeginLink (tail);
+ Emit (OpCode.FastRepeat, MakeFlags (false, false, false, lazy));
+ EmitLink (tail);
+ Emit ((ushort)min);
+ Emit ((ushort)max);
+ }
+
+ public void EmitIn (LinkRef tail) {
+ BeginLink (tail);
+ Emit (OpCode.In);
+ EmitLink (tail);
+ }
+
+ public void EmitAnchor (int offset, LinkRef tail) {
+ BeginLink (tail);
+ Emit (OpCode.Anchor);
+ EmitLink (tail);
+ Emit ((ushort)offset);
+ }
+
+ public void EmitInfo (int count, int min, int max) {
+ Emit (OpCode.Info);
+ Emit ((ushort)count);
+ Emit ((ushort)min);
+ Emit ((ushort)max);
+ }
+
+ public LinkRef NewLink () {
+ return new PatternLinkStack ();
+ }
+
+ public void ResolveLink (LinkRef lref) {
+ PatternLinkStack stack = (PatternLinkStack)lref;
+
+ while (stack.Pop ())
+ pgm[stack.OffsetAddress] = (ushort)stack.GetOffset (CurrentAddress);
+ }
+
+ // private members
+
+ private static OpFlags MakeFlags (bool negate, bool ignore, bool reverse, bool lazy) {
+ OpFlags flags = 0;
+ if (negate) flags |= OpFlags.Negate;
+ if (ignore) flags |= OpFlags.IgnoreCase;
+ if (reverse) flags |= OpFlags.RightToLeft;
+ if (lazy) flags |= OpFlags.Lazy;
+
+ return flags;
+ }
+
+ private void Emit (OpCode op) {
+ Emit (op, (OpFlags)0);
+ }
+
+ private void Emit (OpCode op, OpFlags flags) {
+ Emit (EncodeOp (op, flags));
+ }
+
+ private void Emit (ushort word) {
+ pgm.Add (word);
+ }
+
+ private int CurrentAddress {
+ get { return pgm.Count; }
+ }
+
+ private void BeginLink (LinkRef lref) {
+ PatternLinkStack stack = (PatternLinkStack)lref;
+ stack.BaseAddress = CurrentAddress;
+ }
+
+ private void EmitLink (LinkRef lref) {
+ PatternLinkStack stack = (PatternLinkStack)lref;
+ stack.OffsetAddress = CurrentAddress;
+ Emit ((ushort)0); // placeholder
+ stack.Push ();
+ }
+
+ private class PatternLinkStack : LinkStack {
+ public PatternLinkStack () {
+ }
+
+ public int BaseAddress {
+ set { link.base_addr = value; }
+ }
+
+ public int OffsetAddress {
+ get { return link.offset_addr; }
+ set { link.offset_addr = value; }
+ }
+
+ public int GetOffset (int target_addr) {
+ return target_addr - link.base_addr;
+ }
+
+ // LinkStack implementation
+
+ protected override object GetCurrent () { return link; }
+ protected override void SetCurrent (object l) { link = (Link)l; }
+
+ private struct Link {
+ public int base_addr;
+ public int offset_addr;
+ }
+
+ Link link;
+ }
+
+ private ArrayList pgm;
+ }
+
+ abstract class LinkStack : LinkRef {
+ public LinkStack () {
+ stack = new Stack ();
+ }
+
+ public void Push () {
+ stack.Push (GetCurrent ());
+ }
+
+ public bool Pop () {
+ if (stack.Count > 0) {
+ SetCurrent (stack.Pop ());
+ return true;
+ }
+
+ return false;
+ }
+
+ protected abstract object GetCurrent ();
+ protected abstract void SetCurrent (object l);
+
+ private Stack stack;
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/debug.cs b/mcs/class/System/System.Text.RegularExpressions/debug.cs
new file mode 100644
index 00000000000..fdc3ab87bc3
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/debug.cs
@@ -0,0 +1,208 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: debug.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions {
+
+ class Disassembler {
+ public static void DisassemblePattern (ushort[] image) {
+ DisassembleBlock (image, 0, 0);
+ }
+
+ public static void DisassembleBlock (ushort[] image, int pc, int depth) {
+ OpCode op;
+ OpFlags flags;
+
+ for (;;) {
+ if (pc >= image.Length)
+ return;
+
+ PatternCompiler.DecodeOp (image[pc], out op, out flags);
+ Console.Write (FormatAddress (pc) + ": "); // address
+ Console.Write (new string (' ', depth * 2)); // indent
+ Console.Write (DisassembleOp (image, pc)); // instruction
+ Console.WriteLine ();
+
+ int skip;
+ switch (op) {
+ case OpCode.False: case OpCode.True: case OpCode.Until:
+ skip = 1;
+ break;
+
+ case OpCode.Character: case OpCode.Category: case OpCode.Position:
+ case OpCode.Open: case OpCode.Close: case OpCode.Reference:
+ case OpCode.Sub: case OpCode.Branch: case OpCode.Jump: case OpCode.In:
+ skip = 2;
+ break;
+
+ case OpCode.Balance: case OpCode.IfDefined: case OpCode.Range:
+ case OpCode.Test: case OpCode.Anchor:
+ skip = 3;
+ break;
+
+ case OpCode.Repeat: case OpCode.FastRepeat: case OpCode.Info:
+ skip = 4;
+ break;
+
+ case OpCode.String: skip = image[pc + 1] + 2; break;
+ case OpCode.Set: skip = image[pc + 2] + 3; break;
+
+ default:
+ skip = 1;
+ break;
+ }
+
+ pc += skip;
+ }
+ }
+
+ public static string DisassembleOp (ushort[] image, int pc) {
+ OpCode op;
+ OpFlags flags;
+
+ PatternCompiler.DecodeOp (image[pc], out op, out flags);
+ string str = op.ToString ();
+ if (flags != 0)
+ str += "[" + flags.ToString ("f") + "]";
+
+ switch (op) {
+ case OpCode.False: case OpCode.True: case OpCode.Until:
+ default:
+ break;
+
+ case OpCode.Info:
+ str += " " + image[pc + 1];
+ str += " (" + image[pc + 2] + ", " + image[pc + 3] + ")";
+ break;
+
+ case OpCode.Character:
+ str += " '" + FormatChar ((char)image[pc + 1]) + "'";
+ break;
+
+ case OpCode.Category:
+ str += " /" + (Category)image[pc + 1];
+ break;
+
+ case OpCode.Range:
+ str += " '" + FormatChar ((char)image[pc + 1]) + "', ";
+ str += " '" + FormatChar ((char)image[pc + 2]) + "'";
+ break;
+
+ case OpCode.Set:
+ str += " " + FormatSet (image, pc + 1);
+ break;
+
+ case OpCode.String:
+ str += " '" + ReadString (image, pc + 1) + "'";
+ break;
+
+ case OpCode.Position:
+ str += " /" + (Position)image[pc + 1];
+ break;
+
+ case OpCode.Open: case OpCode.Close: case OpCode.Reference:
+ str += " " + image[pc + 1];
+ break;
+
+ case OpCode.Balance:
+ str += " " + image[pc + 1] + " " + image[pc + 2];
+ break;
+
+ case OpCode.IfDefined: case OpCode.Anchor:
+ str += " :" + FormatAddress (pc + image[pc + 1]);
+ str += " " + image[pc + 2];
+ break;
+
+ case OpCode.Sub: case OpCode.Branch: case OpCode.Jump:
+ case OpCode.In:
+ str += " :" + FormatAddress (pc + image[pc + 1]);
+ break;
+
+ case OpCode.Test:
+ str += " :" + FormatAddress (pc + image[pc + 1]);
+ str += ", :" + FormatAddress (pc + image[pc + 2]);
+ break;
+
+ case OpCode.Repeat: case OpCode.FastRepeat:
+ str += " :" + FormatAddress (pc + image[pc + 1]);
+ str += " (" + image[pc + 2] + ", ";
+ if (image[pc + 3] == 0xffff)
+ str += "Inf";
+ else
+ str += image[pc + 3];
+ str += ")";
+ break;
+
+ }
+
+ return str;
+ }
+
+ // private static members
+
+ private static string ReadString (ushort[] image, int pc) {
+ int len = image[pc];
+ char[] chars = new char[len];
+
+ for (int i = 0; i < len; ++ i)
+ chars[i] = (char)image[pc + i + 1];
+
+ return new string (chars);
+ }
+
+ private static string FormatAddress (int pc) {
+ return pc.ToString ("x4");
+ }
+
+ private static string FormatSet (ushort[] image, int pc) {
+ int lo = image[pc ++];
+ int hi = (image[pc ++] << 4) - 1;
+
+ string str = "[";
+
+ bool hot = false;
+ char a = (char)0, b;
+ for (int i = 0; i <= hi; ++ i) {
+ bool m = (image[pc + (i >> 4)] & (1 << (i & 0xf))) != 0;
+
+ if (m & !hot) { // start of range
+ a = (char)(lo + i);
+ hot = true;
+ }
+ else if (hot & (!m || i == hi)) { // end of range
+ b = (char)(lo + i - 1);
+
+ str += FormatChar (a);
+ if (b != a)
+ str += "-" + FormatChar (b);
+
+ hot = false;
+ }
+ }
+
+ str += "]";
+ return str;
+ }
+
+ private static string FormatChar (char c) {
+ if (c == '-' || c == ']')
+ return "\\" + c;
+
+ if (Char.IsLetterOrDigit (c) || Char.IsSymbol (c))
+ return c.ToString ();
+
+ if (Char.IsControl (c)) {
+ return "^" + (char)('@' + c);
+ }
+
+ return "\\u" + ((int)c).ToString ("x4");
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/interpreter.cs b/mcs/class/System/System.Text.RegularExpressions/interpreter.cs
new file mode 100644
index 00000000000..a45f0748179
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/interpreter.cs
@@ -0,0 +1,889 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: interpreter.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Text.RegularExpressions {
+
+ class Interpreter : IMachine {
+ public Interpreter (ushort[] program) {
+ this.program = program;
+ this.checkpoints = new Stack ();
+ this.qs = null;
+
+ // process info block
+
+ if ((OpCode)program[0] != OpCode.Info)
+ throw NewInterpretException ("Can't find info block.");
+
+ this.group_count = program[1] + 1;
+ this.match_min = program[2];
+ this.match_max = program[3];
+
+ // setup
+
+ this.captures = new Capture[group_count];
+ this.program_start = 4;
+ }
+
+ // IMachine implementation
+
+ public Match Scan (Regex regex, string text, int start, int end) {
+ this.text = text;
+ this.text_end = end;
+ this.scan_ptr = start;
+
+ if (Eval (Mode.Match, ref scan_ptr, program_start))
+ return new Match (regex, this, end, captures);
+
+ return Match.Empty;
+ }
+
+ // private methods
+
+ private void Reset () {
+ for (int i = 0; i < group_count; ++ i)
+ captures[i] = new Capture (text);
+
+ checkpoints.Clear ();
+ checkpoint = 0;
+ fast = repeat = null;
+ }
+
+ private bool Eval (Mode mode, ref int ref_ptr, int pc) {
+ int ptr = ref_ptr;
+ Begin:
+ for (;;) {
+ ushort word = program[pc];
+ OpCode op = (OpCode)(word & 0x00ff);
+ OpFlags flags = (OpFlags)(word & 0xff00);
+
+ switch (op) {
+ case OpCode.Anchor: {
+ int skip = program[pc + 1];
+
+ int anch_offset = program[pc + 2];
+ int anch_ptr = ptr + anch_offset;
+ int anch_end = text_end - match_min + anch_offset; // maximum anchor position
+
+ // the general case for an anchoring expression is at the bottom, however we
+ // do some checks for the common cases before to save processing time. the current
+ // optimizer only outputs three types of anchoring expressions: fixed position,
+ // fixed substring, and no anchor.
+
+ OpCode anch_op = (OpCode)(program[pc + 3] & 0x00ff);
+ if (anch_op == OpCode.Position && skip == 6) { // position anchor
+ // Anchor
+ // Position
+ // True
+
+ switch ((Position)program[pc + 4]) {
+ case Position.StartOfString:
+ if (anch_ptr == 0) {
+ ptr = 0;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+ }
+ break;
+
+ case Position.StartOfLine:
+ if (anch_ptr == 0) {
+ ptr = 0;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+
+ ++ anch_ptr;
+ }
+
+ while (anch_ptr <= anch_end) {
+ if (text[anch_ptr - 1] == '\n') {
+ ptr = anch_ptr - anch_offset;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+ }
+
+ ++ anch_ptr;
+ }
+ break;
+
+ case Position.StartOfScan:
+ if (anch_ptr == scan_ptr) {
+ ptr = scan_ptr - anch_offset;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+ }
+ break;
+
+ default:
+ // FIXME
+ break;
+ }
+ }
+ else if (qs != null ||
+ (anch_op == OpCode.String && skip == 6 + program[pc + 4])) { // substring anchor
+ // Anchor
+ // String
+ // True
+
+ if (qs == null) {
+ bool ignore = ((OpFlags)program[pc + 3] & OpFlags.IgnoreCase) != 0;
+ string substring = GetString (pc + 3);
+
+ qs = new QuickSearch (substring, ignore);
+ }
+
+ while (anch_ptr <= anch_end) {
+ anch_ptr = qs.Search (text, anch_ptr, anch_end);
+ if (anch_ptr < 0)
+ break;
+
+ ptr = anch_ptr - anch_offset;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+
+ ++ anch_ptr;
+ }
+ }
+ else if (anch_op == OpCode.True) { // no anchor
+ // Anchor
+ // True
+
+ while (anch_ptr <= anch_end) {
+ ptr = anch_ptr;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+
+ ++ anch_ptr;
+ }
+ }
+ else { // general case
+ // Anchor
+ // <expr>
+ // True
+
+ while (anch_ptr <= anch_end) {
+ ptr = anch_ptr;
+ if (Eval (Mode.Match, ref ptr, pc + 3)) {
+ // anchor expression passed: try real expression at the correct offset
+
+ ptr = anch_ptr - anch_offset;
+ if (TryMatch (ref ptr, pc + skip))
+ goto Pass;
+ }
+
+ ++ anch_ptr;
+ }
+ }
+
+ goto Fail;
+ }
+
+ case OpCode.False: {
+ goto Fail;
+ }
+
+ case OpCode.True: {
+ goto Pass;
+ }
+
+ case OpCode.Position: {
+ if (!IsPosition ((Position)program[pc + 1], ptr))
+ goto Fail;
+ pc += 2;
+ break;
+ }
+
+ case OpCode.String: {
+ bool reverse = (flags & OpFlags.RightToLeft) != 0;
+ bool ignore = (flags & OpFlags.IgnoreCase) != 0;
+ int len = program[pc + 1];
+
+ if (reverse) {
+ ptr -= len;
+ if (ptr < 0)
+ goto Fail;
+ }
+ else if (ptr + len > text_end)
+ goto Fail;
+
+ pc += 2;
+ for (int i = 0; i < len; ++ i) {
+ char c = text[ptr + i];
+ if (ignore)
+ c = Char.ToLower (c);
+
+ if (c != (char)program[pc ++])
+ goto Fail;
+ }
+
+ if (!reverse)
+ ptr += len;
+ break;
+ }
+
+ case OpCode.Reference: {
+ bool reverse = (flags & OpFlags.RightToLeft) != 0;
+ bool ignore = (flags & OpFlags.IgnoreCase) != 0;
+ Capture cap = captures[program[pc + 1]].GetLastDefined ();
+ if (cap == null)
+ goto Fail;
+
+ int str = cap.Index;
+ int len = cap.Length;
+
+ if (reverse) {
+ ptr -= len;
+ if (ptr < 0)
+ goto Fail;
+ }
+ else if (ptr + len > text_end)
+ goto Fail;
+
+ pc += 2;
+ for (int i = 0; i < len; ++ i) {
+ if (ignore) {
+ if (Char.ToLower (text[ptr + i]) != Char.ToLower (text[str + i]))
+ goto Fail;
+ }
+ else {
+ if (text[ptr + i] != text[str + i])
+ goto Fail;
+ }
+ }
+
+ if (!reverse)
+ ptr += len;
+ break;
+ }
+
+ case OpCode.Character: case OpCode.Category:
+ case OpCode.Range: case OpCode.Set: {
+ if (!EvalChar (mode, ref ptr, ref pc, false))
+ goto Fail;
+ break;
+ }
+
+ case OpCode.In: {
+ int target = pc + program[pc + 1];
+ pc += 2;
+ if (!EvalChar (mode, ref ptr, ref pc, true))
+ goto Fail;
+
+ pc = target;
+ break;
+ }
+
+ case OpCode.Open: {
+ Open (program[pc + 1], ptr);
+ pc += 2;
+ break;
+ }
+
+ case OpCode.Close: {
+ Close (program[pc + 1], ptr);
+ pc += 2;
+ break;
+ }
+
+ case OpCode.Balance: {
+ Balance (program[pc + 1], program[pc + 2], ptr);
+ break;
+ }
+
+ case OpCode.IfDefined: {
+ Capture cap = captures[program[pc + 2]];
+ if (cap.GetLastDefined () == null)
+ pc += program[pc + 1];
+ else
+ pc += 3;
+ break;
+ }
+
+ case OpCode.Sub: {
+ if (!Eval (Mode.Match, ref ptr, pc + 2))
+ goto Fail;
+
+ pc += program[pc + 1];
+ break;
+ }
+
+ case OpCode.Test: {
+ int cp = Checkpoint ();
+ int test_ptr = ptr;
+ if (Eval (Mode.Match, ref test_ptr, pc + 3))
+ pc += program[pc + 1];
+ else {
+ Backtrack (cp);
+ pc += program[pc + 2];
+ }
+ break;
+ }
+
+ case OpCode.Branch: {
+ OpCode branch_op;
+ do {
+ int cp = Checkpoint ();
+ if (Eval (Mode.Match, ref ptr, pc + 2))
+ goto Pass;
+
+ Backtrack (cp);
+
+ pc += program[pc + 1];
+ branch_op = (OpCode)(program[pc] & 0xff);
+ } while (branch_op != OpCode.False);
+
+ goto Fail;
+ }
+
+ case OpCode.Jump: {
+ pc += program[pc + 1];
+ break;
+ }
+
+ case OpCode.Repeat: {
+ this.repeat = new RepeatContext (
+ this.repeat, // previous context
+ program[pc + 2], // minimum
+ program[pc + 3], // maximum
+ (flags & OpFlags.Lazy) != 0, // lazy
+ pc + 4 // subexpression
+ );
+
+ if (Eval (Mode.Match, ref ptr, pc + program[pc + 1]))
+ goto Pass;
+ else {
+ this.repeat = this.repeat.Previous;
+ goto Fail;
+ }
+ }
+
+ case OpCode.Until: {
+ RepeatContext current = this.repeat;
+ int start = current.Start;
+
+ if (!current.IsMinimum) {
+ ++ current.Count;
+ current.Start = ptr;
+ if (Eval (Mode.Match, ref ptr, repeat.Expression))
+ goto Pass;
+
+ current.Start = start;
+ -- current.Count;
+ goto Fail;
+ }
+
+ if (ptr == current.Start) {
+ // degenerate match ... match tail or fail
+
+ this.repeat = current.Previous;
+ if (Eval (Mode.Match, ref ptr, pc + 1))
+ goto Pass;
+
+ goto Fail;
+ }
+
+ if (current.IsLazy) {
+ // match tail first ...
+
+ this.repeat = current.Previous;
+ int cp = Checkpoint ();
+ if (Eval (Mode.Match, ref ptr, pc + 1))
+ goto Pass;
+
+ Backtrack (cp);
+
+ // ... then match more
+
+ this.repeat = current;
+ if (!current.IsMaximum) {
+ ++ current.Count;
+ current.Start = ptr;
+ if (Eval (Mode.Match, ref ptr, current.Expression))
+ goto Pass;
+
+ current.Start = start;
+ -- current.Count;
+ goto Fail;
+ }
+
+ return false;
+ }
+ else {
+ // match more first ...
+
+ if (!current.IsMaximum) {
+ int cp = Checkpoint ();
+ ++ current.Count;
+ current.Start = ptr;
+ if (Eval (Mode.Match, ref ptr, current.Expression))
+ goto Pass;
+
+ current.Start = start;
+ -- current.Count;
+ Backtrack (cp);
+ }
+
+ // ... then match tail
+
+ this.repeat = current.Previous;
+ if (Eval (Mode.Match, ref ptr, pc + 1))
+ goto Pass;
+
+ this.repeat = current;
+ goto Fail;
+ }
+ }
+
+ case OpCode.FastRepeat: {
+ this.fast = new RepeatContext (
+ fast,
+ program[pc + 2], // minimum
+ program[pc + 3], // maximum
+ (flags & OpFlags.Lazy) != 0, // lazy
+ pc + 4 // subexpression
+ );
+ fast.Start = ptr;
+
+ int cp = Checkpoint ();
+
+ pc += program[pc + 1]; // tail expression
+ ushort tail_word = program[pc];
+
+ int c1, c2; // first character of tail operator
+ int coff; // 0 or -1 depending on direction
+
+ OpCode tail_op = (OpCode)(tail_word & 0xff);
+ if (tail_op == OpCode.Character || tail_op == OpCode.String) {
+ OpFlags tail_flags = (OpFlags)(tail_word & 0xff00);
+
+ if (tail_op == OpCode.String)
+ c1 = program[pc + 2]; // first char of string
+ else
+ c1 = program[pc + 1]; // character
+
+ if ((tail_flags & OpFlags.IgnoreCase) != 0)
+ c2 = Char.ToUpper ((char)c1); // ignore case
+ else
+ c2 = c1;
+
+ if ((tail_flags & OpFlags.RightToLeft) != 0)
+ coff = -1; // reverse
+ else
+ coff = 0;
+ }
+ else {
+ c1 = c2 = -1;
+ coff = 0;
+ }
+
+ if (fast.IsLazy) {
+ if (!fast.IsMinimum && !Eval (Mode.Count, ref ptr, fast.Expression)) {
+ //Console.WriteLine ("lazy fast: failed mininum.");
+ fast = fast.Previous;
+ goto Fail;
+ }
+
+ while (true) {
+ int p = ptr + coff;
+ if ((c1 < 0 || (p >= 0 && p < text_end && (c1 == text[p] || c2 == text[p]))) &&
+ Eval (Mode.Match, ref ptr, pc))
+ break;
+
+ if (fast.IsMaximum) {
+ //Console.WriteLine ("lazy fast: failed with maximum.");
+ fast = fast.Previous;
+ goto Fail;
+ }
+
+ Backtrack (cp);
+ if (!Eval (Mode.Count, ref ptr, fast.Expression)) {
+ //Console.WriteLine ("lazy fast: no more.");
+ fast = fast.Previous;
+ goto Fail;
+ }
+ }
+ fast = fast.Previous;
+ goto Pass;
+ }
+ else {
+ if (!Eval (Mode.Count, ref ptr, fast.Expression)) {
+ fast = fast.Previous;
+ goto Fail;
+ }
+
+ int width;
+ if (fast.Count > 0)
+ width = (ptr - fast.Start) / fast.Count;
+ else
+ width = 0;
+
+ while (true) {
+ int p = ptr + coff;
+ if ((c1 < 0 || (p >= 0 && p < text_end && (c1 == text[p] || c2 == text[p]))) &&
+ Eval (Mode.Match, ref ptr, pc))
+ break;
+
+ -- fast.Count;
+ if (!fast.IsMinimum) {
+ fast = fast.Previous;
+ goto Fail;
+ }
+
+ ptr -= width;
+ Backtrack (cp);
+ }
+ fast = fast.Previous;
+ goto Pass;
+ }
+ }
+
+ case OpCode.Info: {
+ throw NewInterpretException ("Info block found in pattern.");
+ }
+ }
+ }
+ Pass:
+ ref_ptr = ptr;
+
+ switch (mode) {
+ case Mode.Match:
+ return true;
+
+ case Mode.Count: {
+ ++ fast.Count;
+ if (fast.IsMaximum || (fast.IsLazy && fast.IsMinimum))
+ return true;
+
+ pc = fast.Expression;
+ goto Begin;
+ }
+ }
+
+ Fail:
+ switch (mode) {
+ case Mode.Match:
+ return false;
+
+ case Mode.Count: {
+ if (!fast.IsLazy && fast.IsMinimum)
+ return true;
+
+ ref_ptr = fast.Start;
+ return false;
+ }
+ }
+
+ return false;
+ }
+
+ private bool EvalChar (Mode mode, ref int ptr, ref int pc, bool multi) {
+ bool consumed = false;
+ char c = '\0';
+ bool negate;
+ bool ignore;
+ do {
+ ushort word = program[pc];
+ OpCode op = (OpCode)(word & 0x00ff);
+ OpFlags flags = (OpFlags)(word & 0xff00);
+
+ ++ pc;
+
+ ignore = (flags & OpFlags.IgnoreCase) != 0;
+
+ // consume character: the direction of an In construct is
+ // determined by the direction of its first op
+
+ if (!consumed) {
+ if ((flags & OpFlags.RightToLeft) != 0) {
+ if (ptr <= 0)
+ return false;
+
+ c = text[-- ptr];
+ }
+ else {
+ if (ptr >= text_end)
+ return false;
+
+ c = text[ptr ++];
+ }
+
+ if (ignore)
+ c = Char.ToLower (c);
+
+ consumed = true;
+ }
+
+ // negate flag
+
+ negate = (flags & OpFlags.Negate) != 0;
+
+ // execute op
+
+ switch (op) {
+ case OpCode.True:
+ return true;
+
+ case OpCode.False:
+ return false;
+
+ case OpCode.Character: {
+ if (c == (char)program[pc ++])
+ return !negate;
+ break;
+ }
+
+ case OpCode.Category: {
+ if (CategoryUtils.IsCategory ((Category)program[pc ++], c))
+ return !negate;
+
+ break;
+ }
+
+ case OpCode.Range: {
+ int lo = (char)program[pc ++];
+ int hi = (char)program[pc ++];
+ if (lo <= c && c <= hi)
+ return !negate;
+ break;
+ }
+
+ case OpCode.Set: {
+ int lo = (char)program[pc ++];
+ int len = (char)program[pc ++];
+ int bits = pc;
+ pc += len;
+
+ int i = (int)c - lo;
+ if (i < 0 || i >= len << 4)
+ break;
+
+ if ((program[bits + (i >> 4)] & (1 << (i & 0xf))) != 0)
+ return !negate;
+ break;
+ }
+ }
+ } while (multi);
+
+ return negate;
+ }
+
+ private bool TryMatch (ref int ref_ptr, int pc) {
+ Reset ();
+
+ int ptr = ref_ptr;
+ captures[0].Open (ptr);
+ if (Eval (Mode.Match, ref ptr, pc)) {
+ captures[0].Close (ptr);
+ ref_ptr = ptr;
+ return true;
+ }
+
+ return false;
+ }
+
+ private bool IsPosition (Position pos, int ptr) {
+ switch (pos) {
+ case Position.Start: case Position.StartOfString:
+ return ptr == 0;
+
+ case Position.StartOfLine:
+ return ptr == 0 || text[ptr - 1] == '\n';
+
+ case Position.StartOfScan:
+ return ptr == scan_ptr;
+
+ case Position.End:
+ return ptr == text_end ||
+ (ptr == text_end - 1 && text[ptr] == '\n');
+
+ case Position.EndOfLine:
+ return ptr == text_end || text[ptr] == '\n';
+
+ case Position.EndOfString:
+ return ptr == text_end;
+
+ case Position.Boundary:
+ if (text_end == 0)
+ return false;
+
+ if (ptr == 0)
+ return IsWordChar (text[ptr]);
+ else if (ptr == text_end)
+ return IsWordChar (text[ptr - 1]);
+ else
+ return IsWordChar (text[ptr]) != IsWordChar (text[ptr - 1]);
+
+ case Position.NonBoundary:
+ if (text_end == 0)
+ return false;
+
+ if (ptr == 0)
+ return !IsWordChar (text[ptr]);
+ else if (ptr == text_end)
+ return !IsWordChar (text[ptr - 1]);
+ else
+ return IsWordChar (text[ptr]) == IsWordChar (text[ptr - 1]);
+
+ default:
+ return false;
+ }
+ }
+
+ private bool IsWordChar (char c) {
+ return CategoryUtils.IsCategory (Category.Word, c);
+ }
+
+ private string GetString (int pc) {
+ int len = program[pc + 1];
+ int str = pc + 2;
+
+ char[] cs = new char[len];
+ for (int i = 0; i < len; ++ i)
+ cs[i] = (char)program[str ++];
+
+ return new string (cs);
+ }
+
+ // capture management
+
+ private void Open (int gid, int ptr) {
+ Capture cap = captures[gid];
+ if (cap.IsDefined || cap.Checkpoint < checkpoint) {
+ cap = new Capture (cap, checkpoint);
+ captures[gid] = cap;
+ }
+
+ cap.Open (ptr);
+ }
+
+ private void Close (int gid, int ptr) {
+ captures[gid].Close (ptr);
+ }
+
+ private void Balance (int gid, int balance_gid, int ptr) {
+ Capture balance = captures[balance_gid];
+ if (!balance.IsDefined)
+ throw NewInterpretException ("Invalid state - balancing group not closed.");
+
+ if (gid > 0) {
+ Open (gid, balance.Index + balance.Length);
+ Close (gid, ptr);
+ }
+
+ captures[balance_gid] = balance.Previous;
+ }
+
+ private int Checkpoint () {
+ checkpoints.Push (captures);
+ captures = (Capture[])captures.Clone ();
+ checkpoint = checkpoints.Count;
+
+ return checkpoint;
+ }
+
+ private void Backtrack (int cp) {
+ if (cp > checkpoints.Count)
+ throw NewInterpretException ("Can't backtrack forwards");
+
+ while (checkpoints.Count > cp)
+ checkpoints.Pop ();
+
+ captures = (Capture[])checkpoints.Peek ();
+ checkpoint = cp;
+
+ // TODO optimize this
+ }
+
+ private Exception NewInterpretException (string msg) {
+ return new ApplicationException (msg);
+ }
+
+ // interpreter attributes
+
+ private ushort[] program; // regex program
+ private int program_start; // first instruction after info block
+ private string text; // input text
+ private int text_end; // end of input text (last character + 1)
+ private int group_count; // number of capturing groups
+ private int match_min, match_max; // match width information
+ private QuickSearch qs; // fast substring matcher
+
+ // match state
+
+ private int scan_ptr; // start of scan
+
+ private Capture[] captures; // current captures
+
+ private int checkpoint; // last checkpoint
+ private Stack checkpoints; // checkpointed captures
+
+ private RepeatContext repeat; // current repeat context
+ private RepeatContext fast; // fast repeat context
+
+ // private classes
+
+ private class RepeatContext {
+ public RepeatContext (RepeatContext previous, int min, int max, bool lazy, int expr_pc) {
+ this.previous = previous;
+ this.min = min;
+ this.max = max;
+ this.lazy = lazy;
+ this.expr_pc = expr_pc;
+
+ this.start = -1;
+ this.count = 0;
+ }
+
+ public int Count {
+ get { return count; }
+ set { count = value; }
+ }
+
+ public int Start {
+ get { return start; }
+ set { start = value; }
+ }
+
+ public bool IsMinimum {
+ get { return min <= count; }
+ }
+
+ public bool IsMaximum {
+ get { return max <= count; }
+ }
+
+ public bool IsLazy {
+ get { return lazy; }
+ }
+
+ public int Expression {
+ get { return expr_pc; }
+ }
+
+ public RepeatContext Previous {
+ get { return previous; }
+ }
+
+ private int start;
+ private int min, max;
+ private bool lazy;
+ private int expr_pc;
+ private RepeatContext previous;
+
+ private int count;
+ }
+
+ private enum Mode {
+ Search,
+ Match,
+ Count
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/interval.cs b/mcs/class/System/System.Text.RegularExpressions/interval.cs
new file mode 100644
index 00000000000..4c8d19f5b15
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/interval.cs
@@ -0,0 +1,305 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: interval.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions {
+
+ struct Interval : IComparable {
+ public int low;
+ public int high;
+ public bool contiguous;
+
+ public static Interval Empty {
+ get {
+ Interval i;
+ i.low = 0;
+ i.high = i.low - 1;
+ i.contiguous = true;
+
+ return i;
+ }
+ }
+
+ public static Interval Entire {
+ get { return new Interval (Int32.MinValue, Int32.MaxValue); }
+ }
+
+ public Interval (int low, int high) {
+ if (low > high) {
+ int t = low;
+ low = high;
+ high = t;
+ }
+
+ this.low = low;
+ this.high = high;
+ this.contiguous = true;
+ }
+
+ public bool IsDiscontiguous {
+ get { return !contiguous; }
+ }
+
+ public bool IsSingleton {
+ get { return contiguous && low == high; }
+ }
+
+ public bool IsRange {
+ get { return !IsSingleton && !IsEmpty; }
+ }
+
+ public bool IsEmpty {
+ get { return low > high; }
+ }
+
+ public int Size {
+ get {
+ if (IsEmpty)
+ return 0;
+
+ return high - low + 1;
+ }
+ }
+
+ public bool IsDisjoint (Interval i) {
+ if (IsEmpty || i.IsEmpty)
+ return true;
+
+ return !(low <= i.high && i.low <= high);
+ }
+
+ public bool IsAdjacent (Interval i) {
+ if (IsEmpty || i.IsEmpty)
+ return false;
+
+ return low == i.high + 1 || high == i.low - 1;
+ }
+
+ public bool Contains (Interval i) {
+ if (!IsEmpty && i.IsEmpty)
+ return true;
+ if (IsEmpty)
+ return false;
+
+ return low <= i.low && i.high <= high;
+ }
+
+ public bool Contains (int i) {
+ return low <= i && i <= high;
+ }
+
+ public void Merge (Interval i) {
+ if (i.IsEmpty)
+ return;
+ if (IsEmpty) {
+ this.low = i.low;
+ this.high = i.high;
+ }
+
+ if (i.low < low)
+ low = i.low;
+ if (i.high > high)
+ high = i.high;
+ }
+
+ public void Intersect (Interval i) {
+ if (IsDisjoint (i)) {
+ low = 0;
+ high = low - 1;
+ return;
+ }
+
+ if (i.low > low)
+ low = i.low;
+ if (i.high > high)
+ high = i.high;
+ }
+
+ public int CompareTo (object o) {
+ return low - ((Interval)o).low;
+ }
+
+ public new string ToString () {
+ if (IsEmpty)
+ return "(EMPTY)";
+ else if (!contiguous)
+ return "{" + low + ", " + high + "}";
+ else if (IsSingleton)
+ return "(" + low + ")";
+ else
+ return "(" + low + ", " + high + ")";
+ }
+ }
+
+ class IntervalCollection : ICollection, IEnumerable {
+ public IntervalCollection () {
+ intervals = new ArrayList ();
+ }
+
+ public Interval this[int i] {
+ get { return (Interval)intervals[i]; }
+ set { intervals[i] = value; }
+ }
+
+ public void Add (Interval i) {
+ intervals.Add (i);
+ }
+
+ public void Clear () {
+ intervals.Clear ();
+ }
+
+ public void Sort () {
+ intervals.Sort ();
+ }
+
+ public void Normalize () {
+ intervals.Sort ();
+
+ int j = 0;
+ while (j < intervals.Count - 1) {
+ Interval a = (Interval)intervals[j];
+ Interval b = (Interval)intervals[j + 1];
+
+ if (!a.IsDisjoint (b) || a.IsAdjacent (b)) {
+ a.Merge (b);
+ intervals[j] = a;
+ intervals.RemoveAt (j + 1);
+ }
+ else
+ ++ j;
+ }
+
+ }
+
+ public delegate double CostDelegate (Interval i);
+
+ public IntervalCollection GetMetaCollection (CostDelegate cost_del) {
+ IntervalCollection meta = new IntervalCollection ();
+
+ Normalize ();
+ Optimize (0, Count - 1, meta, cost_del);
+ meta.intervals.Sort ();
+
+ return meta;
+ }
+
+ private void Optimize (int begin, int end, IntervalCollection meta, CostDelegate cost_del) {
+ Interval set;
+ set.contiguous = false;
+
+ int best_set_begin = -1;
+ int best_set_end = -1;
+ double best_set_cost = 0;
+
+ for (int i = begin; i <= end; ++ i) {
+ set.low = this[i].low;
+
+ double cost = 0.0;
+ for (int j = i; j <= end; ++ j) {
+ set.high = this[j].high;
+ cost += cost_del (this[j]);
+
+ double set_cost = cost_del (set);
+ if (set_cost < cost && cost > best_set_cost) {
+ best_set_begin = i;
+ best_set_end = j;
+ best_set_cost = cost;
+ }
+ }
+ }
+
+ if (best_set_begin < 0) {
+ // didn't find an optimal set: add original members
+
+ for (int i = begin; i <= end; ++ i)
+ meta.Add (this[i]);
+ }
+ else {
+ // found set: add it ...
+
+ set.low = this[best_set_begin].low;
+ set.high = this[best_set_end].high;
+
+ meta.Add (set);
+
+ // ... and optimize to the left and right
+
+ if (best_set_begin > begin)
+ Optimize (begin, best_set_begin - 1, meta, cost_del);
+ if (best_set_end < end)
+ Optimize (best_set_end + 1, end, meta, cost_del);
+ }
+ }
+
+ // ICollection implementation
+
+ public int Count {
+ get { return intervals.Count; }
+ }
+
+ public bool IsSynchronized {
+ get { return false; }
+ }
+
+ public object SyncRoot {
+ get { return intervals; }
+ }
+
+ public void CopyTo (Array array, int index) {
+ foreach (Interval i in intervals) {
+ if (index > array.Length)
+ break;
+
+ array.SetValue (i, index ++);
+ }
+ }
+
+ // IEnumerator implementation
+
+ public IEnumerator GetEnumerator () {
+ return new Enumerator (intervals);
+ }
+
+ private class Enumerator : IEnumerator {
+ public Enumerator (IList list) {
+ this.list = list;
+ Reset ();
+ }
+
+ public object Current {
+ get {
+ if (ptr >= list.Count)
+ throw new InvalidOperationException ();
+
+ return list[ptr];
+ }
+ }
+
+ public bool MoveNext () {
+ if (ptr > list.Count)
+ throw new InvalidOperationException ();
+
+ return ++ ptr < list.Count;
+ }
+
+ public void Reset () {
+ ptr = -1;
+ }
+
+ private IList list;
+ private int ptr;
+ }
+
+ // private fields
+
+ private ArrayList intervals;
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/match.cs b/mcs/class/System/System.Text.RegularExpressions/match.cs
new file mode 100644
index 00000000000..87f4afbfc9d
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/match.cs
@@ -0,0 +1,218 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: match.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+
+namespace System.Text.RegularExpressions {
+
+ [Serializable]
+ public class Capture {
+ public int Index {
+ get {
+ if (!IsDefined)
+ return 0; // capture not completed
+ else if (start <= end)
+ return start; // normal capture
+ else
+ return end; // reverse capture
+ }
+ }
+
+ public int Length {
+ get {
+ if (!IsDefined)
+ return 0;
+ else if (start <= end)
+ return end - start;
+ else
+ return start - end;
+ }
+ }
+
+ public string Value {
+ get { return IsDefined ? text.Substring (Index, Length) : ""; }
+ }
+
+ public override string ToString () {
+ return Value;
+ }
+
+ // internal members
+
+ internal Capture () { // empty capture
+ this.previous = null;
+ this.text = null;
+ this.checkpoint = 0;
+
+ this.start = -1;
+ this.end = -1;
+ }
+
+ internal Capture (Capture cap) { // copy constructor
+ this.previous = cap.previous;
+ this.text = cap.text;
+ this.checkpoint = cap.checkpoint;
+
+ this.start = cap.start;
+ this.end = cap.end;
+ }
+
+ internal Capture (string text) { // first capture
+ this.previous = null;
+ this.text = text;
+ this.checkpoint = 0;
+
+ this.start = -1;
+ this.end = -1;
+ }
+
+ internal Capture (Capture previous, int checkpoint) {
+ this.previous = previous;
+ this.text = previous.text;
+ this.checkpoint = checkpoint;
+
+ this.start = -1;
+ this.end = -1;
+ }
+
+ internal Capture Previous {
+ get { return previous; }
+ }
+
+ internal string Text {
+ get { return text; }
+ }
+
+ internal int Checkpoint {
+ get { return checkpoint; }
+ }
+
+ internal bool IsDefined {
+ get { return start >= 0 && end >= 0; }
+ }
+
+ internal Capture GetLastDefined () {
+ Capture cap = this;
+ while (cap != null && !cap.IsDefined)
+ cap = cap.Previous;
+
+ return cap;
+ }
+
+ internal void Open (int ptr) {
+ this.start = ptr;
+ }
+
+ internal void Close (int ptr) {
+ this.end = ptr;
+ }
+
+ // private
+
+ private int start, end;
+ private string text;
+ private int checkpoint;
+ private Capture previous;
+ }
+
+ [Serializable]
+ public class Group : Capture {
+ public static Group Synchronized (Group inner) {
+ return inner; // is this enough?
+ }
+
+ public CaptureCollection Captures {
+ get { return captures; }
+ }
+
+ public bool Success {
+ get { return GetLastDefined () != null; }
+ }
+
+ // internal
+
+ internal Group () : base () {
+ }
+
+ internal Group (Capture last) : base (last) {
+ captures = new CaptureCollection (last);
+
+ // TODO make construction of captures lazy
+ }
+
+ private CaptureCollection captures;
+ }
+
+ [Serializable]
+ public class Match : Group {
+ public static Match Empty {
+ get { return empty; }
+ }
+
+ public static Match Synchronized (Match inner) {
+ return inner; // FIXME need to sync on machine access
+ }
+
+ public virtual GroupCollection Groups {
+ get { return groups; }
+ }
+
+ public Match NextMatch () {
+ if (this == Empty)
+ return Empty;
+
+ int scan_ptr = regex.RightToLeft ? Index : Index + Length;
+
+ // next match after an empty match: make sure scan ptr makes progress
+
+ if (Length == 0)
+ scan_ptr += regex.RightToLeft ? -1 : +1;
+
+ return machine.Scan (regex, Text, scan_ptr, text_length);
+ }
+
+ public virtual string Result (string replacement) {
+ return ReplacementEvaluator.Evaluate (replacement, this);
+ }
+
+ // internal
+
+ internal Match () : base () {
+ this.regex = null;
+ this.machine = null;
+ this.text_length = 0;
+ this.groups = new GroupCollection ();
+
+ groups.Add (this);
+ }
+
+ internal Match (Regex regex, IMachine machine, int text_length, Capture[] captures) : base (captures[0]) {
+ this.regex = regex;
+ this.machine = machine;
+ this.text_length = text_length;
+ this.groups = new GroupCollection ();
+
+ groups.Add (this);
+ for (int i = 1; i < captures.Length; ++ i)
+ groups.Add (new Group (captures[i]));
+ }
+
+ internal Regex Regex {
+ get { return regex; }
+ }
+
+ // private
+
+ private Regex regex;
+ private IMachine machine;
+ private int text_length;
+ private GroupCollection groups;
+
+ private static Match empty = new Match ();
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/notes.txt b/mcs/class/System/System.Text.RegularExpressions/notes.txt
new file mode 100644
index 00000000000..56b047ec76e
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/notes.txt
@@ -0,0 +1,45 @@
+TODO:
+
+* Need to go through everything and square it with RightToLeft matching.
+ The support for this was built into an early version, and lots of things built
+ afterwards are not savvy about bi-directional matching. Things that spring to
+ mind: Regex match methods should start at 0 or text.Length depending on
+ direction. Do split and replace need changes? Match should be aware of its
+ direction (already applied some of this to NextMatch logic). The interpreter
+ needs to check left and right bounds. Anchoring and substring discovery need
+ to be reworked. RTL matches are going to have anchors on the right - ie $, \Z
+ and \z. This should be added to the anchor logic. QuickSearch needs to work in
+ reverse. There may be other stuff.... work through the code.
+
+* Add ECMAScript support to the parser. For example, [.\w\s\d] map to ECMA
+ categories instead of canonical ones [DONE]. There's different behaviour on
+ backreference/octal disambiguation. Find out what the runtime behavioural
+ difference is for cyclic backreferences eg (?(1)abc\1) - this is only briefly
+ mentioned in the spec. I couldn't find much on this in the ECMAScript
+ specification either.
+
+* 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
+ other state? RegexTrial.Execute() will then compare result and checksum.
+
+* The pattern (?(1?)a|b). It should fail: Perl fails, the MS implementation
+ fails, but I pass. The documentation says that the construct (?(X)...) can be
+ processed in two ways. If X is a valid group number, or a valid group name,
+ then the expression becomes a capture conditional - the (...) part is
+ executed only if X has been captured. If X is not a group number or name, then
+ it is treated as a positive lookahead., and (...) is only executed if the
+ lookahead succeeds. My code does the latter, but on further investigation it
+ appears that both Perl and MS fail to recognize an expression assertion if the
+ first character of the assertion is a number - which instead suggests a
+ capture conditional. The exception raised is something like "invalid group
+ number". I get the feeling the my behaviour seems more correct, but it's not
+ consistent with the other implementations, so it should probably be changed.
diff --git a/mcs/class/System/System.Text.RegularExpressions/parser.cs b/mcs/class/System/System.Text.RegularExpressions/parser.cs
new file mode 100644
index 00000000000..3327cf3024a
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/parser.cs
@@ -0,0 +1,1109 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: parser.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+using System.Globalization;
+
+namespace System.Text.RegularExpressions.Syntax {
+
+ class Parser {
+ public static int ParseDecimal (string str, ref int ptr) {
+ return ParseNumber (str, ref ptr, 10, 1, Int32.MaxValue);
+ }
+
+ public static int ParseOctal (string str, ref int ptr) {
+ return ParseNumber (str, ref ptr, 8, 1, 3);
+ }
+
+ public static int ParseHex (string str, ref int ptr, int digits) {
+ return ParseNumber (str, ref ptr, 16, digits, digits);
+ }
+
+ public static int ParseNumber (string str, ref int ptr, int b, int min, int max) {
+ int p = ptr, n = 0, digits = 0, d;
+ if (max < min)
+ max = Int32.MaxValue;
+
+ while (digits < max && p < str.Length) {
+ d = ParseDigit (str[p ++], b, digits);
+ if (d < 0) {
+ -- p;
+ break;
+ }
+
+ n = n * b + d;
+ ++ digits;
+ }
+
+ if (digits < min)
+ return -1;
+
+ ptr = p;
+ return n;
+ }
+
+ public static string ParseName (string str, ref int ptr) {
+ if (Char.IsDigit (str[ptr])) {
+ int gid = ParseNumber (str, ref ptr, 10, 1, 0);
+ if (gid > 0)
+ return gid.ToString ();
+
+ return null;
+ }
+
+ int start = ptr;
+ for (;;) {
+ if (!IsNameChar (str[ptr]))
+ break;
+ ++ ptr;
+ }
+
+ if (ptr - start > 0)
+ return str.Substring (start, ptr - start);
+
+ return null;
+ }
+
+ public static string Escape (string str) {
+ string result = "";
+ for (int i = 0; i < str.Length; ++ i) {
+ char c = str[i];
+ switch (c) {
+ case '\\': case '*': case '+': case '?': case '|':
+ case '{': case '[': case '(': case ')': case '^':
+ case '$': case '.': case '#': case ' ':
+ result += "\\" + c;
+ break;
+
+ case '\t': result += "\\t"; break;
+ case '\n': result += "\\n"; break;
+ case '\r': result += "\\r"; break;
+ case '\f': result += "\\f"; break;
+
+ default: result += c; break;
+ }
+ }
+
+ return result;
+ }
+
+ public static string Unescape (string str) {
+ return new Parser ().ParseString (str);
+ }
+
+ // public instance
+
+ public Parser () {
+ this.caps = new ArrayList ();
+ this.refs = new Hashtable ();
+ }
+
+ public RegularExpression ParseRegularExpression (string pattern, RegexOptions options) {
+ this.pattern = pattern;
+ this.ptr = 0;
+
+ caps.Clear ();
+ refs.Clear ();
+ this.num_groups = 0;
+
+ try {
+ RegularExpression re = new RegularExpression ();
+ ParseGroup (re, options, null);
+ ResolveReferences ();
+
+ re.GroupCount = num_groups;
+
+ return re;
+ }
+ catch (IndexOutOfRangeException) {
+ throw NewParseException ("Unexpected end of pattern.");
+ }
+ }
+
+ public IDictionary GetMapping () {
+ Hashtable mapping = new Hashtable ();
+ foreach (CapturingGroup group in caps) {
+ if (group.Name != null)
+ mapping.Add (group.Name, group.Number);
+ }
+
+ return mapping;
+ }
+
+ // private methods
+
+ private void ParseGroup (Group group, RegexOptions options, Assertion assertion) {
+ bool is_top_level = group is RegularExpression;
+
+ Alternation alternation = null;
+ string literal = null;
+
+ Group current = new Group ();
+ Expression expr = null;
+ bool closed = false;
+
+ while (true) {
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ if (ptr >= pattern.Length)
+ break;
+
+ // (1) Parse for Expressions
+
+ char ch = pattern[ptr ++];
+
+ switch (ch) {
+ case '^': {
+ Position pos =
+ IsMultiline (options) ? Position.StartOfLine : Position.Start;
+ expr = new PositionAssertion (pos);
+ break;
+ }
+
+ case '$': {
+ Position pos =
+ IsMultiline (options) ? Position.EndOfLine : Position.End;
+ expr = new PositionAssertion (pos);
+ break;
+ }
+
+ case '.': {
+ Category cat =
+ IsSingleline (options) ? Category.AnySingleline : Category.Any;
+ expr = new CharacterClass (cat, false);
+ break;
+ }
+
+ case '\\': {
+ int c = ParseEscape ();
+ if (c >= 0)
+ ch = (char)c;
+ else {
+ expr = ParseSpecial (options);
+
+ if (expr == null)
+ ch = pattern[ptr ++]; // default escape
+ }
+ break;
+ }
+
+ case '[': {
+ expr = ParseCharacterClass (options);
+ break;
+ }
+
+ case '(': {
+ bool ignore = IsIgnoreCase (options);
+ expr = ParseGroupingConstruct (ref options);
+ if (expr == null) {
+ if (literal != null && IsIgnoreCase (options) != ignore) {
+ current.AppendExpression (new Literal (literal, IsIgnoreCase (options)));
+ literal = null;
+ }
+
+ continue;
+ }
+ break;
+ }
+
+ case ')': {
+ closed = true;
+ goto EndOfGroup;
+ }
+
+ case '|': {
+ if (literal != null) {
+ current.AppendExpression (new Literal (literal, IsIgnoreCase (options)));
+ literal = null;
+ }
+
+ if (assertion != null) {
+ if (assertion.TrueExpression == null)
+ assertion.TrueExpression = current;
+ else if (assertion.FalseExpression == null)
+ assertion.FalseExpression = current;
+ else
+ throw NewParseException ("Too many | in (?()|).");
+ }
+ else {
+ if (alternation == null)
+ alternation = new Alternation ();
+
+ alternation.AddAlternative (current);
+ }
+
+ current = new Group ();
+ continue;
+ }
+
+ case '*': case '+': case '?': case '{': {
+ throw NewParseException ("Bad quantifier.");
+ }
+
+ default:
+ break; // literal character
+ }
+
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+
+ // (2) Check for Repetitions
+
+ if (ptr < pattern.Length) {
+ char k = pattern[ptr];
+
+ if (k == '?' || k == '*' || k == '+' || k == '{') {
+ ++ ptr;
+
+ int min = 0, max = 0;
+ bool lazy = false;
+
+ switch (k) {
+ case '?': min = 0; max = 1; break;
+ case '*': min = 0; max = 0xffff; break;
+ case '+': min = 1; max = 0xffff; break;
+ case '{': ParseRepetitionBounds (out min, out max, options); break;
+ }
+
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ if (ptr < pattern.Length && pattern[ptr] == '?') {
+ ++ ptr;
+ lazy = true;
+ }
+
+ Repetition repetition = new Repetition (min, max, lazy);
+
+ if (expr == null)
+ repetition.Expression = new Literal (ch.ToString (), IsIgnoreCase (options));
+ else
+ repetition.Expression = expr;
+
+ expr = repetition;
+ }
+ }
+
+ // (3) Append Expression and/or Literal
+
+ if (expr == null) {
+ if (literal == null)
+ literal = "";
+ literal += ch;
+ }
+ else {
+ if (literal != null) {
+ current.AppendExpression (new Literal (literal, IsIgnoreCase (options)));
+ literal = null;
+ }
+
+ current.AppendExpression (expr);
+ expr = null;
+ }
+
+ if (is_top_level && ptr >= pattern.Length)
+ goto EndOfGroup;
+ }
+
+ EndOfGroup:
+ if (is_top_level && closed)
+ throw NewParseException ("Too many )'s.");
+ if (!is_top_level && !closed)
+ throw NewParseException ("Not enough )'s.");
+
+
+ // clean up literals and alternations
+
+ if (literal != null)
+ current.AppendExpression (new Literal (literal, IsIgnoreCase (options)));
+
+ if (assertion != null) {
+ if (assertion.TrueExpression == null)
+ assertion.TrueExpression = current;
+ else
+ assertion.FalseExpression = current;
+
+ group.AppendExpression (assertion);
+ }
+ else if (alternation != null) {
+ alternation.AddAlternative (current);
+ group.AppendExpression (alternation);
+ }
+ else
+ group.AppendExpression (current);
+ }
+
+ private Expression ParseGroupingConstruct (ref RegexOptions options) {
+ if (pattern[ptr] != '?') {
+ Group group;
+
+ if (IsExplicitCapture (options))
+ group = new Group ();
+ else {
+ group = new CapturingGroup ();
+ caps.Add (group);
+ }
+
+ ParseGroup (group, options, null);
+ return group;
+ }
+ else
+ ++ ptr;
+
+ switch (pattern[ptr]) {
+ case ':': { // non-capturing group
+ ++ ptr;
+ Group group = new Group ();
+ ParseGroup (group, options, null);
+
+ return group;
+ }
+
+ case '>': { // non-backtracking group
+ ++ ptr;
+ Group group = new NonBacktrackingGroup ();
+ ParseGroup (group, options, null);
+
+ return group;
+ }
+
+ case 'i': case 'm': case 'n':
+ case 's': case 'x': case '-': { // options
+ RegexOptions o = options;
+ ParseOptions (ref o, false);
+ if (pattern[ptr] == '-') {
+ ++ ptr;
+ ParseOptions (ref o, true);
+ }
+
+ if (pattern[ptr] == ':') { // pass options to child group
+ ++ ptr;
+ Group group = new Group ();
+ ParseGroup (group, o, null);
+ return group;
+ }
+ else if (pattern[ptr] == ')') { // change options of enclosing group
+ ++ ptr;
+ options = o;
+ return null;
+ }
+ else
+ throw NewParseException ("Bad options");
+ }
+
+ case '<': case '=': case '!': { // lookahead/lookbehind
+ ExpressionAssertion asn = new ExpressionAssertion ();
+ if (!ParseAssertionType (asn))
+ goto case '\''; // it's a (?<name> ) construct
+
+ Group test = new Group ();
+ ParseGroup (test, options, null);
+
+ asn.TestExpression = test;
+ return asn;
+ }
+
+ case '\'': { // named/balancing group
+ char delim;
+ if (pattern[ptr] == '<')
+ delim = '>';
+ else
+ delim = '\'';
+
+ ++ ptr;
+ string name = ParseName ();
+
+ if (pattern[ptr] == delim) {
+ // capturing group
+
+ if (name == null)
+ throw NewParseException ("Bad group name.");
+
+ ++ ptr;
+ CapturingGroup cap = new CapturingGroup ();
+ cap.Name = name;
+ caps.Add (cap);
+ ParseGroup (cap, options, null);
+
+ return cap;
+ }
+ else if (pattern[ptr] == '-') {
+ // balancing group
+
+ ++ ptr;
+ string balance_name = ParseName ();
+ if (balance_name == null || pattern[ptr] != delim)
+ throw NewParseException ("Bad balancing group name.");
+
+ ++ ptr;
+ BalancingGroup bal = new BalancingGroup ();
+ bal.Name = name;
+ caps.Add (bal);
+ refs.Add (bal, balance_name);
+
+ return bal;
+ }
+ else
+ throw NewParseException ("Bad group name.");
+ }
+
+ case '(': { // expression/capture test
+ Assertion asn;
+
+ ++ ptr;
+ int p = ptr;
+ string name = ParseName ();
+ if (name == null || pattern[ptr] != ')') { // expression test
+ // FIXME MS implementation doesn't seem to
+ // implement this version of (?(x) ...)
+
+ ptr = p;
+ ExpressionAssertion expr_asn = new ExpressionAssertion ();
+
+ if (pattern[ptr] == '?') {
+ ++ ptr;
+ if (!ParseAssertionType (expr_asn))
+ throw NewParseException ("Bad conditional.");
+ }
+ else {
+ expr_asn.Negate = false;
+ expr_asn.Reverse = false;
+ }
+
+ Group test = new Group ();
+ ParseGroup (test, options, null);
+ expr_asn.TestExpression = test;
+ asn = expr_asn;
+ }
+ else { // capture test
+ ++ ptr;
+ asn = new CaptureAssertion ();
+ refs.Add (asn, name);
+ }
+
+ Group group = new Group ();
+ ParseGroup (group, options, asn);
+ return group;
+ }
+
+ case '#': { // comment
+ ++ ptr;
+ while (pattern[ptr ++] != ')') {
+ if (ptr >= pattern.Length)
+ throw NewParseException ("Unterminated (?#...) comment.");
+ }
+ return null;
+ }
+
+ default: // error
+ throw NewParseException ("Bad grouping construct.");
+ }
+ }
+
+ private bool ParseAssertionType (ExpressionAssertion assertion) {
+ if (pattern[ptr] == '<') {
+ switch (pattern[ptr + 1]) {
+ case '=':
+ assertion.Negate = false;
+ break;
+ case '!':
+ assertion.Negate = true;
+ break;
+ default:
+ return false;
+ }
+
+ assertion.Reverse = true;
+ ptr += 2;
+ }
+ else {
+ switch (pattern[ptr]) {
+ case '=':
+ assertion.Negate = false;
+ break;
+ case '!':
+ assertion.Negate = true;
+ break;
+ default:
+ return false;
+ }
+
+ assertion.Reverse = false;
+ ptr += 1;
+ }
+
+ return true;
+ }
+
+ private void ParseOptions (ref RegexOptions options, bool negate) {
+ for (;;) {
+ switch (pattern[ptr]) {
+ case 'i':
+ if (negate)
+ options &= ~RegexOptions.IgnoreCase;
+ else
+ options |= RegexOptions.IgnoreCase;
+ break;
+
+ case 'm':
+ if (negate)
+ options &= ~RegexOptions.Multiline;
+ else
+ options |= RegexOptions.Multiline;
+ break;
+
+ case 'n':
+ if (negate)
+ options &= ~RegexOptions.ExplicitCapture;
+ else
+ options |= RegexOptions.ExplicitCapture;
+ break;
+
+ case 's':
+ if (negate)
+ options &= ~RegexOptions.Singleline;
+ else
+ options |= RegexOptions.Singleline;
+ break;
+
+ case 'x':
+ if (negate)
+ options &= ~RegexOptions.IgnorePatternWhitespace;
+ else
+ options |= RegexOptions.IgnorePatternWhitespace;
+ break;
+
+ default:
+ return;
+ }
+
+ ++ ptr;
+ }
+ }
+
+ private Expression ParseCharacterClass (RegexOptions options) {
+ bool negate, ecma;
+ if (pattern[ptr] == '^') {
+ negate = true;
+ ++ ptr;
+ }
+ else
+ negate = false;
+
+ ecma = IsECMAScript (options);
+ CharacterClass cls = new CharacterClass (negate, IsIgnoreCase (options));
+
+ if (pattern[ptr] == ']') {
+ cls.AddCharacter (']');
+ ++ ptr;
+ }
+
+ int c = -1;
+ int last = -1;
+ bool range = false;
+ bool closed = false;
+ while (ptr < pattern.Length) {
+ c = pattern[ptr ++];
+
+ if (c == ']') {
+ closed = true;
+ break;
+ }
+
+ if (c == '-') {
+ range = true;
+ continue;
+ }
+
+ if (c == '\\') {
+ c = ParseEscape ();
+ if (c < 0) {
+ // didn't recognize escape
+
+ c = pattern[ptr ++];
+ switch (c) {
+ case 'b': c = '\b'; break;
+
+ case 'd':
+ cls.AddCategory (ecma ? Category.EcmaDigit : Category.Digit, false);
+ last = -1;
+ continue;
+
+ case 'w':
+ cls.AddCategory (ecma ? Category.EcmaWord : Category.Word, false);
+ last = -1;
+ continue;
+
+ case 's':
+ cls.AddCategory (ecma ? Category.EcmaWhiteSpace : Category.WhiteSpace, false);
+ last = -1;
+ continue;
+
+ case 'p':
+ cls.AddCategory (ParseUnicodeCategory (), false); // ignore ecma
+ last = -1;
+ continue;
+
+ case 'D':
+ cls.AddCategory (ecma ? Category.EcmaDigit : Category.Digit, true);
+ last = -1;
+ continue;
+
+ case 'W':
+ cls.AddCategory (ecma ? Category.EcmaWord : Category.Word, true);
+ last = -1;
+ continue;
+
+ case 'S':
+ cls.AddCategory (ecma ? Category.EcmaWhiteSpace : Category.WhiteSpace, true);
+ last = -1;
+ continue;
+
+ case 'P':
+ cls.AddCategory (ParseUnicodeCategory (), true);
+ last = -1;
+ continue;
+
+ default: break; // add escaped character
+ }
+ }
+ }
+
+ if (range) {
+ if (c < last)
+ throw NewParseException ("[x-y] range in reverse order.");
+
+ if (last >=0 )
+ cls.AddRange ((char)last, (char)c);
+ else {
+ cls.AddCharacter ((char)c);
+ cls.AddCharacter ('-');
+ }
+
+ range = false;
+ last = -1;
+ }
+ else {
+ cls.AddCharacter ((char)c);
+ last = c;
+ }
+ }
+
+ if (!closed)
+ throw NewParseException ("Unterminated [] set.");
+
+ if (range)
+ cls.AddCharacter ('-');
+
+ return cls;
+ }
+
+ private void ParseRepetitionBounds (out int min, out int max, RegexOptions options) {
+ int n, m;
+
+ /* check syntax */
+
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ n = ParseNumber (10, 1, 0);
+ if (n < 0)
+ throw NewParseException ("Illegal {x,y} - bad value of x.");
+
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ switch (pattern[ptr ++]) {
+ case '}':
+ m = n;
+ break;
+ case ',':
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ m = ParseNumber (10, 1, 0);
+ ConsumeWhitespace (IsIgnorePatternWhitespace (options));
+ if (pattern[ptr ++] != '}')
+ throw NewParseException ("Illegal {x,y} - bad value of y.");
+ break;
+ default:
+ throw NewParseException ("Illegal {x,y}");
+ }
+
+ /* check bounds and ordering */
+
+ if (n >= 0xffff || m >= 0xffff)
+ throw NewParseException ("Illegal {x, y} - maximum of 65535.");
+ if (m >= 0 && m < n)
+ throw NewParseException ("Illegal {x, y} with x > y.");
+
+ /* assign min and max */
+
+ min = n;
+ if (m > 0)
+ max = m;
+ else
+ max = 0xffff;
+ }
+
+ private Category ParseUnicodeCategory () {
+ if (pattern[ptr ++] != '{')
+ throw NewParseException ("Incomplete \\p{X} character escape.");
+
+ string name = ParseName (pattern, ref ptr);
+ if (name == null)
+ throw NewParseException ("Incomplete \\p{X} character escape.");
+
+ Category cat = CategoryUtils.CategoryFromName (name);
+ if (cat == Category.None)
+ throw NewParseException ("Unknown property '" + name + "'.");
+
+ if (pattern[ptr ++] != '}')
+ throw NewParseException ("Incomplete \\p{X} character escape.");
+
+ return cat;
+ }
+
+ private Expression ParseSpecial (RegexOptions options) {
+ int p = ptr;
+ bool ecma = IsECMAScript (options);
+ Expression expr = null;
+
+ switch (pattern[ptr ++]) {
+
+ // categories
+
+ case 'd':
+ expr = new CharacterClass (ecma ? Category.EcmaDigit : Category.Digit, false);
+ break;
+
+ case 'w':
+ expr = new CharacterClass (ecma ? Category.EcmaWord : Category.Word, false);
+ break;
+
+ case 's':
+ expr = new CharacterClass (ecma ? Category.EcmaWhiteSpace : Category.WhiteSpace, false);
+ break;
+
+ case 'p':
+ // this is odd - ECMAScript isn't supposed to support Unicode,
+ // yet \p{..} compiles and runs under the MS implementation
+ // identically to canonical mode. That's why I'm ignoring the
+ // value of ecma here.
+
+ expr = new CharacterClass (ParseUnicodeCategory (), false);
+ break;
+
+ case 'D':
+ expr = new CharacterClass (ecma ? Category.EcmaDigit : Category.Digit, true);
+ break;
+
+ case 'W':
+ expr = new CharacterClass (ecma ? Category.EcmaWord : Category.Word, true);
+ break;
+
+ case 'S':
+ expr = new CharacterClass (ecma ? Category.EcmaWhiteSpace : Category.WhiteSpace, true);
+ break;
+
+ case 'P':
+ expr = new CharacterClass (ParseUnicodeCategory (), true);
+ break;
+
+ // positions
+
+ case 'A': expr = new PositionAssertion (Position.StartOfString); break;
+ case 'Z': expr = new PositionAssertion (Position.End); break;
+ case 'z': expr = new PositionAssertion (Position.EndOfString); break;
+ case 'G': expr = new PositionAssertion (Position.StartOfScan); break;
+ case 'b': expr = new PositionAssertion (Position.Boundary); break;
+ case 'B': expr = new PositionAssertion (Position.NonBoundary); break;
+
+ // references
+
+ case '1': case '2': case '3': case '4': case '5':
+ case '6': case '7': case '8': case '9': {
+ ptr --;
+ int n = ParseNumber (10, 1, 0);
+ if (n < 0) {
+ ptr = p;
+ return null;
+ }
+
+ // FIXME test if number is within number of assigned groups
+ // this may present a problem for right-to-left matching
+
+ Reference reference = new Reference (IsIgnoreCase (options));
+ refs.Add (reference, n.ToString ());
+ expr = reference;
+ break;
+ }
+
+ case 'k': {
+ char delim = pattern[ptr ++];
+ if (delim == '<')
+ delim = '>';
+ else if (delim != '\'')
+ throw NewParseException ("Malformed \\k<...> named backreference.");
+
+ string name = ParseName ();
+ if (name == null || pattern[ptr] != delim)
+ throw NewParseException ("Malformed \\k<...> named backreference.");
+
+ ++ ptr;
+ Reference reference = new Reference (IsIgnoreCase (options));
+ refs.Add (reference, name);
+ expr = reference;
+ break;
+ }
+
+ default:
+ expr = null;
+ break;
+ }
+
+ if (expr == null)
+ ptr = p;
+
+ return expr;
+ }
+
+ private int ParseEscape () {
+ int p = ptr;
+ int c;
+
+ switch (pattern[ptr ++]) {
+
+ // standard escapes (except \b)
+
+ case 'a': return '\u0007';
+ case 't': return '\u0009';
+ case 'r': return '\u000d';
+ case 'v': return '\u000b';
+ case 'f': return '\u000c';
+ case 'n': return '\u000a';
+ case 'e': return '\u001b';
+ case '\\': return '\\';
+
+ // character codes
+
+ case '0': return ParseOctal (pattern, ref ptr);
+
+ case 'x':
+ c = ParseHex (pattern, ref ptr, 2);
+ if (c < 0)
+ throw NewParseException ("Insufficient hex digits");
+
+ return c;
+
+ case 'u':
+ c = ParseHex (pattern, ref ptr, 4);
+ if (c < 0)
+ throw NewParseException ("Insufficient hex digits");
+
+ return c;
+
+ // control characters
+
+ case 'c':
+ c = pattern[p ++];
+ if (c >= 'A' && c <= 'Z')
+ return c - 'A';
+ else if (c >= '@' && c <= '_')
+ return c - '@';
+ else
+ throw NewParseException ("Unrecognized control character.");
+
+ // unknown escape
+
+ default:
+ ptr = p;
+ return -1;
+ }
+ }
+
+ private string ParseName () {
+ return Parser.ParseName (pattern, ref ptr);
+ }
+
+ private static bool IsNameChar (char c) {
+ UnicodeCategory cat = Char.GetUnicodeCategory (c);
+ if (cat == UnicodeCategory.ModifierLetter)
+ return false;
+ if (cat == UnicodeCategory.ConnectorPunctuation)
+ return true;
+ return Char.IsLetterOrDigit (c);
+ }
+
+ private int ParseNumber (int b, int min, int max) {
+ return Parser.ParseNumber (pattern, ref ptr, b, min, max);
+ }
+
+ private int ParseDecimal () {
+ return Parser.ParseDecimal (pattern, ref ptr);
+ }
+
+ private static int ParseDigit (char c, int b, int n) {
+ switch (b) {
+ case 8:
+ if (c >= '0' && c <= '7')
+ return c - '0';
+ else
+ return -1;
+ case 10:
+ if (c >= '0' && c <= '9')
+ return c - '0';
+ else
+ return -1;
+ case 16:
+ if (c >= '0' && c <= '9')
+ return c - '0';
+ else if (c >= 'a' && c <= 'f')
+ return 10 + c - 'a';
+ else if (c >= 'A' && c <= 'F')
+ return 10 + c - 'A';
+ else
+ return -1;
+ default:
+ return -1;
+ }
+ }
+
+ private void ConsumeWhitespace (bool ignore) {
+ while (true) {
+ if (ptr >= pattern.Length)
+ break;
+
+ if (pattern[ptr] == '(') {
+ if (ptr + 3 >= pattern.Length)
+ return;
+
+ if (pattern[ptr + 1] != '?' || pattern[ptr + 2] != '#')
+ return;
+
+ ptr += 3;
+ while (pattern[ptr ++] != ')')
+ /* ignore */ ;
+ }
+ else if (ignore && pattern[ptr] == '#') {
+ while (ptr < pattern.Length && pattern[ptr ++] != '\n')
+ /* ignore */ ;
+ }
+ else if (ignore && Char.IsWhiteSpace (pattern[ptr])) {
+ while (ptr < pattern.Length && Char.IsWhiteSpace (pattern[ptr]))
+ ++ ptr;
+ }
+ else
+ return;
+ }
+ }
+
+ private string ParseString (string pattern) {
+ this.pattern = pattern;
+ this.ptr = 0;
+
+ string result = "";
+ while (ptr < pattern.Length) {
+ int c = pattern[ptr ++];
+ if (c == '\\')
+ c = ParseEscape ();
+
+ result += (char)c;
+ }
+
+ return result;
+ }
+
+ private void ResolveReferences () {
+ int gid = 1;
+ Hashtable dict = new Hashtable ();
+
+ // number unnamed groups
+
+ foreach (CapturingGroup group in caps) {
+ if (group.Name == null) {
+ dict.Add (gid.ToString (), group);
+ group.Number = gid ++;
+
+ ++ num_groups;
+ }
+ }
+
+ // number named groups
+
+ foreach (CapturingGroup group in caps) {
+ if (group.Name != null) {
+ if (!dict.Contains (group.Name)) {
+ dict.Add (group.Name, group);
+ group.Number = gid ++;
+
+ ++ num_groups;
+ }
+ else {
+ CapturingGroup prev = (CapturingGroup)dict[group.Name];
+ group.Number = prev.Number;
+ }
+ }
+ }
+
+ // resolve references
+
+ foreach (Expression expr in refs.Keys) {
+ string name = (string)refs[expr];
+ if (!dict.Contains (name)) {
+ throw NewParseException ("Reference to undefined group " +
+ (Char.IsDigit (name[0]) ? "number " : "name ") +
+ name);
+ }
+
+ CapturingGroup group = (CapturingGroup)dict[name];
+ if (expr is Reference)
+ ((Reference)expr).CapturingGroup = group;
+ else if (expr is CaptureAssertion)
+ ((CaptureAssertion)expr).CapturingGroup = group;
+ else if (expr is BalancingGroup)
+ ((BalancingGroup)expr).Balance = group;
+ }
+ }
+
+ // flag helper functions
+
+ private static bool IsIgnoreCase (RegexOptions options) {
+ return (options & RegexOptions.IgnoreCase) != 0;
+ }
+
+ private static bool IsMultiline (RegexOptions options) {
+ return (options & RegexOptions.Multiline) != 0;
+ }
+
+ private static bool IsExplicitCapture (RegexOptions options) {
+ return (options & RegexOptions.ExplicitCapture) != 0;
+ }
+
+ private static bool IsSingleline (RegexOptions options) {
+ return (options & RegexOptions.Singleline) != 0;
+ }
+
+ private static bool IsIgnorePatternWhitespace (RegexOptions options) {
+ return (options & RegexOptions.IgnorePatternWhitespace) != 0;
+ }
+
+ private static bool IsRightToLeft (RegexOptions options) {
+ return (options & RegexOptions.RightToLeft) != 0;
+ }
+
+ private static bool IsECMAScript (RegexOptions options) {
+ return (options & RegexOptions.ECMAScript) != 0;
+ }
+
+ // exception creation
+
+ private ArgumentException NewParseException (string msg) {
+ msg = "parsing \"" + pattern + "\" - " + msg;
+ return new ArgumentException (msg, pattern);
+ }
+
+ private string pattern;
+ private int ptr;
+
+ private ArrayList caps;
+ private Hashtable refs;
+ private int num_groups;
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/quicksearch.cs b/mcs/class/System/System.Text.RegularExpressions/quicksearch.cs
new file mode 100644
index 00000000000..65665a2518b
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/quicksearch.cs
@@ -0,0 +1,108 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: quicksearch.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+
+namespace System.Text.RegularExpressions {
+
+ // TODO use simple test for single character strings
+
+ class QuickSearch {
+ // simplified boyer-moore for fast substring matching
+
+ public QuickSearch (string str, bool ignore) {
+ this.str = str;
+ this.len = str.Length;
+ this.ignore = ignore;
+
+ Setup ();
+ }
+
+ public string String {
+ get { return str; }
+ }
+
+ public int Length {
+ get { return len; }
+ }
+
+ public bool IgnoreCase {
+ get { return ignore; }
+ }
+
+ public int Search (string text, int start, int end) {
+ if (end > text.Length - len)
+ end = text.Length - len;
+
+ int ptr = start;
+ if (!ignore) {
+ while (ptr <= end) {
+ int i = len - 1;
+ while (str[i] == text[ptr + i]) {
+ if (-- i < 0)
+ return ptr;
+ }
+
+ if (ptr < end)
+ ptr += shift[text[ptr + len]];
+ else
+ break;
+ }
+ }
+ else {
+ // ignore case: same as above, but we convert text
+ // to lower case before doing the string compare
+
+ while (ptr <= end) {
+ int i = len - 1;
+ while (str[i] == Char.ToLower (text[ptr + i])) {
+ if (-- i < 0)
+ return ptr;
+ }
+
+ if (ptr < end)
+ ptr += shift[text[ptr + len]];
+ else
+ break;
+ }
+ }
+
+ return -1;
+ }
+
+ // private
+
+ private void Setup () {
+ if (ignore)
+ str = str.ToLower ();
+
+ // this is a 64k entry shift table. that's 128kb per pattern!
+ // is it worth compressing this by only storing shifts within
+ // a (lo, hi) character range? for most substrings this would
+ // be around 50 bytes...
+
+ shift = new int[0x1000];
+ for (int i = 0; i < 0x1000; ++ i)
+ shift[i] = len + 1;
+
+ for (int i = 0; i < len; ++ i) {
+ char c = str[i];
+
+ shift[c] = len - i;
+ if (ignore)
+ shift[Char.ToUpper (c)] = len - i;
+ }
+ }
+
+ private string str;
+ private int len;
+ private bool ignore;
+
+ private int[] shift;
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/regex.cs b/mcs/class/System/System.Text.RegularExpressions/regex.cs
new file mode 100644
index 00000000000..3b5e52cbe48
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/regex.cs
@@ -0,0 +1,401 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: regex.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.Serialization;
+
+using RegularExpression = System.Text.RegularExpressions.Syntax.RegularExpression;
+using Parser = System.Text.RegularExpressions.Syntax.Parser;
+
+namespace System.Text.RegularExpressions {
+
+ public delegate string MatchEvaluator (Match match);
+
+ [Flags]
+ public enum RegexOptions {
+ None = 0x000,
+ IgnoreCase = 0x001,
+ Multiline = 0x002,
+ ExplicitCapture = 0x004,
+ Compiled = 0x008,
+ Singleline = 0x010,
+ IgnorePatternWhitespace = 0x020,
+ RightToLeft = 0x040,
+ ECMAScript = 0x100
+ }
+
+ [Serializable]
+ public class Regex : ISerializable {
+ public static void CompileToAssembly
+ (RegexCompilationInfo[] regexes, AssemblyName aname)
+ {
+ throw new Exception ("Not implemented.");
+ }
+
+ public static void CompileToAssembly
+ (RegexCompilationInfo[] regexes, AssemblyName aname,
+ CustomAttributeBuilder[] attribs)
+ {
+ throw new Exception ("Not implemented.");
+ }
+
+ public static void CompileToAssembly
+ (RegexCompilationInfo[] regexes, AssemblyName aname,
+ CustomAttributeBuilder[] attribs, string resourceFile)
+ {
+ throw new Exception ("Not implemented.");
+ }
+
+ public static string Escape (string str) {
+ return Parser.Escape (str);
+ }
+
+ public static string Unescape (string str) {
+ return Parser.Unescape (str);
+ }
+
+ public static bool IsMatch (string input, string pattern) {
+ return IsMatch (input, pattern, RegexOptions.None);
+ }
+
+ public static bool IsMatch (string input, string pattern, RegexOptions options) {
+ Regex re = new Regex (pattern, options);
+ return re.IsMatch (input);
+ }
+
+ public static Match Match (string input, string pattern) {
+ return Regex.Match (input, pattern, RegexOptions.None);
+ }
+
+ public static Match Match (string input, string pattern, RegexOptions options) {
+ Regex re = new Regex (pattern, options);
+ return re.Match (input);
+ }
+
+ public static MatchCollection Matches (string input, string pattern) {
+ return Matches (input, pattern, RegexOptions.None);
+ }
+
+ public static MatchCollection Matches (string input, string pattern, RegexOptions options) {
+ Regex re = new Regex (pattern, options);
+ return re.Matches (input);
+ }
+
+ public static string Replace
+ (string input, string pattern, MatchEvaluator evaluator)
+ {
+ return Regex.Replace (input, pattern, evaluator, RegexOptions.None);
+ }
+
+ public static string Replace
+ (string input, string pattern, MatchEvaluator evaluator,
+ RegexOptions options)
+ {
+ Regex re = new Regex (pattern, options);
+ return re.Replace (input, evaluator);
+ }
+
+ public static string Replace
+ (string input, string pattern, string replacement)
+ {
+ return Regex.Replace (input, pattern, replacement, RegexOptions.None);
+ }
+
+ public static string Replace
+ (string input, string pattern, string replacement,
+ RegexOptions options)
+ {
+ Regex re = new Regex (pattern, options);
+ return re.Replace (input, replacement);
+ }
+
+ public static string[] Split (string input, string pattern) {
+ return Regex.Split (input, pattern, RegexOptions.None);
+ }
+
+ public static string[] Split (string input, string pattern, RegexOptions options) {
+ Regex re = new Regex (input, options);
+ return re.Split (input);
+ }
+
+ // private
+
+ private static FactoryCache cache = new FactoryCache (200); // TODO put some meaningful number here
+
+ // constructors
+
+ protected Regex () {
+ // XXX what's this constructor for?
+ }
+
+ public Regex (string pattern) : this (pattern, RegexOptions.None) {
+ }
+
+ public Regex (string pattern, RegexOptions options) {
+ this.pattern = pattern;
+ this.options = options;
+
+ this.factory = cache.Lookup (pattern, options);
+
+ if (this.factory == null) {
+ // parse and install group mapping
+
+ Parser psr = new Parser ();
+ RegularExpression re = psr.ParseRegularExpression (pattern, options);
+ this.group_count = re.GroupCount;
+ this.mapping = psr.GetMapping ();
+
+ // compile
+
+ ICompiler cmp;
+ if ((options & RegexOptions.Compiled) != 0)
+ throw new Exception ("Not implemented.");
+ //cmp = new CILCompiler ();
+ else
+ cmp = new PatternCompiler ();
+
+ re.Compile (cmp, RightToLeft);
+
+ // install machine factory and add to pattern cache
+
+ this.factory = cmp.GetMachineFactory ();
+ cache.Add (pattern, options, this.factory);
+ }
+ }
+
+ // public instance properties
+
+ public RegexOptions Options {
+ get { return options; }
+ }
+
+ public bool RightToLeft {
+ get { return (options & RegexOptions.RightToLeft) != 0; }
+ }
+
+ // public instance methods
+
+ public string[] GetGroupNames () {
+ string[] names = new string[mapping.Count];
+ mapping.Keys.CopyTo (names, 0);
+
+ return names;
+ }
+
+ public int[] GetGroupNumbers () {
+ int[] numbers = new int[mapping.Count];
+ mapping.Values.CopyTo (numbers, 0);
+
+ return numbers;
+ }
+
+ public string GroupNameFromNumber (int i) {
+ if (i >= group_count)
+ return "";
+
+ foreach (string name in mapping.Keys) {
+ if ((int)mapping[name] == i)
+ return name;
+ }
+
+ return "";
+ }
+
+ public int GroupNumberFromName (string name) {
+ if (mapping.Contains (name))
+ return (int)mapping[name];
+
+ return -1;
+ }
+
+ // match methods
+
+ public bool IsMatch (string input) {
+ return IsMatch (input, 0);
+ }
+
+ public bool IsMatch (string input, int startat) {
+ return Match (input, startat).Success;
+ }
+
+ public Match Match (string input) {
+ return Match (input, 0);
+ }
+
+ public Match Match (string input, int startat) {
+ return CreateMachine ().Scan (this, input, startat, input.Length);
+ }
+
+ public Match Match (string input, int startat, int length) {
+ return CreateMachine ().Scan (this, input, startat, startat + length);
+ }
+
+ public MatchCollection Matches (string input) {
+ return Matches (input, 0);
+ }
+
+ public MatchCollection Matches (string input, int startat) {
+ MatchCollection ms = new MatchCollection ();
+ Match m = Match (input, startat);
+ while (m.Success) {
+ ms.Add (m);
+ m = m.NextMatch ();
+ }
+
+ return ms;
+ }
+
+ // replace methods
+
+ public string Replace (string input, MatchEvaluator evaluator) {
+ return Replace (input, evaluator, Int32.MaxValue, 0);
+ }
+
+ public string Replace (string input, MatchEvaluator evaluator, int count) {
+ return Replace (input, evaluator, count, 0);
+ }
+
+ public string Replace (string input, MatchEvaluator evaluator, int count, int startat)
+ {
+ StringBuilder result = new StringBuilder ();
+ int ptr = startat;
+
+ Match m = Match (input, startat);
+ while (m.Success && count -- > 0) {
+ result.Append (input.Substring (ptr, m.Index - ptr));
+ result.Append (evaluator (m));
+
+ ptr = m.Index + m.Length;
+ m = m.NextMatch ();
+ }
+ result.Append (input.Substring (ptr));
+
+ return result.ToString ();
+ }
+
+ public string Replace (string input, string replacement) {
+ return Replace (input, replacement, Int32.MaxValue, 0);
+ }
+
+ public string Replace (string input, string replacement, int count) {
+ return Replace (input, replacement, count, 0);
+ }
+
+ public string Replace (string input, string replacement, int count, int startat) {
+ ReplacementEvaluator ev = new ReplacementEvaluator (this, replacement);
+ return Replace (input, new MatchEvaluator (ev.Evaluate), count, startat);
+ }
+
+ // split methods
+
+ public string[] Split (string input) {
+ return Split (input, Int32.MaxValue, 0);
+ }
+
+ public string[] Split (string input, int count) {
+ return Split (input, count, 0);
+ }
+
+ public string[] Split (string input, int count, int startat) {
+ ArrayList splits = new ArrayList ();
+ if (count == 0)
+ count = Int32.MaxValue;
+
+ int ptr = startat;
+ Match m = Match (input, startat);
+ while (count -- > 0 && m.Success) {
+ splits.Add (input.Substring (ptr, m.Index - ptr));
+ ptr = m.Index + m.Length;
+ }
+
+ if (count > 0)
+ splits.Add (input.Substring (ptr));
+
+ string[] result = new string[splits.Count];
+ splits.CopyTo (result);
+ return result;
+ }
+
+ // object methods
+
+ public override string ToString () {
+ return pattern;
+ }
+
+ // ISerializable interface
+
+ public void GetObjectData (SerializationInfo info, StreamingContext context) {
+ throw new Exception ("Not implemented.");
+ }
+
+ // internal
+
+ internal int GroupCount {
+ get { return group_count; }
+ }
+
+ // private
+
+ private IMachine CreateMachine () {
+ return factory.NewInstance ();
+ }
+
+ protected internal string pattern;
+ private RegexOptions options;
+
+ private IMachineFactory factory;
+ private IDictionary mapping;
+ private int group_count;
+ }
+
+ [Serializable]
+ public class RegexCompilationInfo {
+ public RegexCompilationInfo (string pattern, RegexOptions options, string name, string full_namespace, bool is_public) {
+ this.pattern = pattern;
+ this.options = options;
+ this.name = name;
+ this.full_namespace = full_namespace;
+ this.is_public = is_public;
+ }
+
+ public bool IsPublic {
+ get { return is_public; }
+ set { is_public = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public string Namespace {
+ get { return full_namespace; }
+ set { full_namespace = value; }
+ }
+
+ public RegexOptions Options {
+ get { return options; }
+ set { options = value; }
+ }
+
+ public string Pattern {
+ get { return pattern; }
+ set { pattern = value; }
+ }
+
+ // private
+
+ private string pattern, name, full_namespace;
+ private RegexOptions options;
+ private bool is_public;
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/replace.cs b/mcs/class/System/System.Text.RegularExpressions/replace.cs
new file mode 100644
index 00000000000..88b99f394bc
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/replace.cs
@@ -0,0 +1,181 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: replace.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Text;
+using System.Collections;
+
+using Parser = System.Text.RegularExpressions.Syntax.Parser;
+
+namespace System.Text.RegularExpressions {
+
+ class ReplacementEvaluator {
+ public static string Evaluate (string replacement, Match match) {
+ ReplacementEvaluator ev = new ReplacementEvaluator (match.Regex, replacement);
+ return ev.Evaluate (match);
+ }
+
+ public ReplacementEvaluator (Regex regex, string replacement) {
+ this.regex = regex;
+ terms = new ArrayList ();
+ Compile (replacement);
+ }
+
+ public string Evaluate (Match match) {
+ StringBuilder result = new StringBuilder ();
+ foreach (Term term in terms)
+ result.Append (term.GetResult (match));
+
+ return result.ToString ();
+ }
+
+ // private
+
+ private void Compile (string replacement) {
+ replacement = Parser.Unescape (replacement);
+ string literal = "";
+
+ int ptr = 0;
+ char c;
+ Term term = null;
+ while (ptr < replacement.Length) {
+ c = replacement[ptr ++];
+
+ if (c == '$') {
+ if (replacement[ptr] == '$') {
+ ++ ptr;
+ break;
+ }
+
+ term = CompileTerm (replacement, ref ptr);
+ }
+
+ if (term != null) {
+ term.Literal = literal;
+ terms.Add (term);
+
+ term = null;
+ literal = "";
+ }
+ else
+ literal += c;
+ }
+
+ if (term == null && literal.Length > 0) {
+ terms.Add (new Term (literal));
+ }
+ }
+
+ private Term CompileTerm (string str, ref int ptr) {
+ char c = str[ptr];
+
+ if (Char.IsDigit (c)) { // numbered group
+ int n = Parser.ParseDecimal (str, ref ptr);
+ if (n < 0 || n > regex.GroupCount)
+ throw new ArgumentException ("Bad group number.");
+
+ return new Term (TermOp.Match, n);
+ }
+
+ ++ ptr;
+
+ switch (c) {
+ case '{': { // named group
+ string name = Parser.ParseName (str, ref ptr);
+ if (str[ptr ++] != '}' || name == null)
+ throw new ArgumentException ("Bad group name.");
+
+ int n = regex.GroupNumberFromName (name);
+
+ if (n < 0)
+ throw new ArgumentException ("Bad group name.");
+
+ return new Term (TermOp.Match, n);
+ }
+
+ case '&': // entire match
+ return new Term (TermOp.Match, 0);
+
+ case '`': // text before match
+ return new Term (TermOp.PreMatch, 0);
+
+ case '\'': // text after match
+ return new Term (TermOp.PostMatch, 0);
+
+ case '+': // last group
+ return new Term (TermOp.Match, regex.GroupCount - 1);
+
+ case '_': // entire text
+ return new Term (TermOp.All, 0);
+
+ default:
+ throw new ArgumentException ("Bad replacement pattern.");
+ }
+ }
+
+ private Regex regex;
+ private ArrayList terms;
+
+ private enum TermOp {
+ None, // no action
+ Match, // input within group
+ PreMatch, // input before group
+ PostMatch, // input after group
+ All // entire input
+ }
+
+ private class Term {
+ public Term (TermOp op, int arg) {
+ this.op = op;
+ this.arg = arg;
+ this.literal = "";
+ }
+
+ public Term (string literal) {
+ this.op = TermOp.None;
+ this.arg = 0;
+ this.literal = literal;
+ }
+
+ public string Literal {
+ set { literal = value; }
+ }
+
+ public string GetResult (Match match) {
+ Group group = match.Groups[arg];
+
+ switch (op) {
+ case TermOp.None:
+ return literal;
+
+ case TermOp.Match:
+ return literal + group.Value;
+
+ case TermOp.PreMatch:
+ return literal + group.Text.Substring (0, group.Index);
+
+ case TermOp.PostMatch:
+ return literal + group.Text.Substring (group.Index + group.Length);
+
+ case TermOp.All:
+ return literal + group.Text;
+ }
+
+ return "";
+ }
+
+ public TermOp op; // term type
+ public int arg; // group argument
+ public string literal; // literal to prepend
+
+ public override string ToString () {
+ return op.ToString () + "(" + arg + ") " + literal;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Text.RegularExpressions/syntax.cs b/mcs/class/System/System.Text.RegularExpressions/syntax.cs
new file mode 100644
index 00000000000..f0d0bc4ef78
--- /dev/null
+++ b/mcs/class/System/System.Text.RegularExpressions/syntax.cs
@@ -0,0 +1,976 @@
+//
+// assembly: System
+// namespace: System.Text.RegularExpressions
+// file: syntax.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Collections;
+
+namespace System.Text.RegularExpressions.Syntax {
+ // collection classes
+
+ class ExpressionCollection : CollectionBase {
+ public void Add (Expression e) {
+ List.Add (e);
+ }
+
+ public Expression this[int i] {
+ get { return (Expression)List[i]; }
+ set { List[i] = value; }
+ }
+
+ protected override void OnValidate (object o) {
+ // allow null elements
+ }
+ }
+
+ // abstract classes
+
+ abstract class Expression {
+ public abstract void Compile (ICompiler cmp, bool reverse);
+ public abstract void GetWidth (out int min, out int max);
+
+ public int GetFixedWidth () {
+ int min, max;
+ GetWidth (out min, out max);
+
+ if (min == max)
+ return min;
+
+ return -1;
+ }
+
+ public virtual AnchorInfo GetAnchorInfo () {
+ return new AnchorInfo (this, GetFixedWidth ());
+ }
+
+ public virtual bool IsComplex () {
+ return true;
+ }
+ }
+
+ // composite expressions
+
+ abstract class CompositeExpression : Expression {
+ public CompositeExpression () {
+ expressions = new ExpressionCollection ();
+ }
+
+ protected ExpressionCollection Expressions {
+ get { return expressions; }
+ }
+
+ protected void GetWidth (out int min, out int max, int count) {
+ min = Int32.MaxValue;
+ max = 0;
+ bool empty = true;
+
+ for (int i = 0; i < count; ++ i) {
+ Expression e = Expressions[i];
+ if (e == null)
+ continue;
+
+ empty = false;
+ int a, b;
+ e.GetWidth (out a, out b);
+ if (a < min) min = a;
+ if (b > max) max = b;
+ }
+
+ if (empty)
+ min = max = 0;
+ }
+
+ private ExpressionCollection expressions;
+ }
+
+ // groups
+
+ class Group : CompositeExpression {
+ public Group () {
+ }
+
+ public Expression Expression {
+ get { return Expressions[0]; }
+ set { Expressions[0] = value; }
+ }
+
+ public void AppendExpression (Expression e) {
+ Expressions.Add (e);
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ int count = Expressions.Count;
+ for (int i = 0; i < count; ++ i) {
+ Expression e;
+ if (reverse)
+ e = Expressions[count - i - 1];
+ else
+ e = Expressions[i];
+
+ e.Compile (cmp, reverse);
+ }
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ min = 0;
+ max = 0;
+
+ foreach (Expression e in Expressions) {
+ int a, b;
+ e.GetWidth (out a, out b);
+ min += a;
+ if (max == Int32.MaxValue || b == Int32.MaxValue)
+ max = Int32.MaxValue;
+ else
+ max += b;
+ }
+ }
+
+ public override AnchorInfo GetAnchorInfo () {
+ int ptr;
+ int width = GetFixedWidth ();
+
+ ArrayList infos = new ArrayList ();
+ IntervalCollection segments = new IntervalCollection ();
+
+ // accumulate segments
+
+ ptr = 0;
+ foreach (Expression e in Expressions) {
+ AnchorInfo info = e.GetAnchorInfo ();
+ infos.Add (info);
+
+ if (info.IsPosition)
+ return new AnchorInfo (this, ptr + info.Offset, width, info.Position);
+
+ if (info.IsSubstring)
+ segments.Add (info.GetInterval (ptr));
+
+ if (info.IsUnknownWidth)
+ break;
+
+ ptr += info.Width;
+ }
+
+ // normalize and find the longest segment
+
+ segments.Normalize ();
+
+ Interval longest = Interval.Empty;
+ foreach (Interval segment in segments) {
+ if (segment.Size > longest.Size)
+ longest = segment;
+ }
+
+ // now chain the substrings that made this segment together
+
+ if (!longest.IsEmpty) {
+ string str = "";
+ bool ignore = false;
+
+ ptr = 0;
+ foreach (AnchorInfo info in infos) {
+ if (info.IsSubstring && longest.Contains (info.GetInterval (ptr))) {
+ str += info.Substring; // TODO mark subexpressions
+ ignore |= info.IgnoreCase;
+ }
+
+ if (info.IsUnknownWidth)
+ break;
+
+ ptr += info.Width;
+ }
+
+ return new AnchorInfo (this, longest.low, width, str, ignore);
+ }
+
+ return new AnchorInfo (this, width);
+ }
+
+ public override bool IsComplex () {
+ bool comp = false;
+ foreach (Expression e in Expressions) {
+ comp |= e.IsComplex ();
+ }
+
+ return comp | GetFixedWidth () <= 0;
+ }
+ }
+
+ class RegularExpression : Group {
+ public RegularExpression () {
+ group_count = 0;
+ }
+
+ public int GroupCount {
+ get { return group_count; }
+ set { group_count = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ // info block
+
+ int min, max;
+ GetWidth (out min, out max);
+ cmp.EmitInfo (group_count, min, max);
+
+ // anchoring expression
+
+ AnchorInfo info = GetAnchorInfo ();
+ if (reverse)
+ info = new AnchorInfo (this, GetFixedWidth ()); // FIXME
+
+ LinkRef pattern = cmp.NewLink ();
+ cmp.EmitAnchor (info.Offset, pattern);
+
+ if (info.IsPosition)
+ cmp.EmitPosition (info.Position);
+ else if (info.IsSubstring)
+ cmp.EmitString (info.Substring, info.IgnoreCase, reverse);
+
+ cmp.EmitTrue ();
+
+ // pattern
+
+ cmp.ResolveLink (pattern);
+ base.Compile (cmp, reverse);
+ cmp.EmitTrue ();
+ }
+
+ private int group_count;
+ }
+
+ class CapturingGroup : Group {
+ public CapturingGroup () {
+ this.gid = 0;
+ this.name = null;
+ }
+
+ public int Number {
+ get { return gid; }
+ set { gid = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public bool IsNamed {
+ get { return name != null; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ cmp.EmitOpen (gid);
+ base.Compile (cmp, reverse);
+ cmp.EmitClose (gid);
+ }
+
+ public override bool IsComplex () {
+ return true;
+ }
+
+ private int gid;
+ private string name;
+ }
+
+ class BalancingGroup : CapturingGroup {
+ public BalancingGroup () {
+ this.balance = null;
+ }
+
+ public CapturingGroup Balance {
+ get { return balance; }
+ set { balance = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ // can't invoke Group.Compile from here :(
+ // so I'll just repeat the code
+
+ int count = Expressions.Count;
+ for (int i = 0; i < count; ++ i) {
+ Expression e;
+ if (reverse)
+ e = Expressions[count - i - 1];
+ else
+ e = Expressions[i];
+
+ e.Compile (cmp, reverse);
+ }
+
+ cmp.EmitBalance (this.Number, balance.Number);
+ }
+
+ private CapturingGroup balance;
+ }
+
+ class NonBacktrackingGroup : Group {
+ public NonBacktrackingGroup () {
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ LinkRef tail = cmp.NewLink ();
+
+ cmp.EmitSub (tail);
+ base.Compile (cmp, reverse);
+ cmp.EmitTrue ();
+ cmp.ResolveLink (tail);
+ }
+
+ public override bool IsComplex () {
+ return true;
+ }
+ }
+
+ // repetition
+
+ class Repetition : CompositeExpression {
+ public Repetition (int min, int max, bool lazy) {
+ Expressions.Add (null);
+
+ this.min = min;
+ this.max = max;
+ this.lazy = lazy;
+ }
+
+ public Expression Expression {
+ get { return Expressions[0]; }
+ set { Expressions[0] = value; }
+ }
+
+ public int Minimum {
+ get { return min; }
+ set { min = value; }
+ }
+
+ public int Maximum {
+ get { return max; }
+ set { max = value; }
+ }
+
+ public bool Lazy {
+ get { return lazy; }
+ set { lazy = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ if (Expression.IsComplex ()) {
+ LinkRef until = cmp.NewLink ();
+
+ cmp.EmitRepeat (min, max, lazy, until);
+ Expression.Compile (cmp, reverse);
+ cmp.EmitUntil (until);
+ }
+ else {
+ LinkRef tail = cmp.NewLink ();
+
+ cmp.EmitFastRepeat (min, max, lazy, tail);
+ Expression.Compile (cmp, reverse);
+ cmp.EmitTrue ();
+ cmp.ResolveLink (tail);
+ }
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ Expression.GetWidth (out min, out max);
+ min = min * this.min;
+ if (max == Int32.MaxValue || this.max == 0xffff)
+ max = Int32.MaxValue;
+ else
+ max = max * this.max;
+ }
+
+ public override AnchorInfo GetAnchorInfo () {
+ int width = GetFixedWidth ();
+ if (Minimum == 0)
+ return new AnchorInfo (this, width);
+
+ AnchorInfo info = Expression.GetAnchorInfo ();
+ if (info.IsPosition)
+ return new AnchorInfo (this, info.Offset, width, info.Position);
+
+ if (info.IsSubstring) {
+ if (info.IsComplete) {
+ string str = "";
+ for (int i = 0; i < Minimum; ++ i)
+ str += info.Substring;
+
+ return new AnchorInfo (this, 0, width, str, info.IgnoreCase);
+ }
+
+ return new AnchorInfo (this, info.Offset, width, info.Substring, info.IgnoreCase);
+ }
+
+ return new AnchorInfo (this, width);
+ }
+
+ private int min, max;
+ private bool lazy;
+ }
+
+ // assertions
+
+ abstract class Assertion : CompositeExpression {
+ public Assertion () {
+ Expressions.Add (null); // true expression
+ Expressions.Add (null); // false expression
+ }
+
+ public Expression TrueExpression {
+ get { return Expressions[0]; }
+ set { Expressions[0] = value; }
+ }
+
+ public Expression FalseExpression {
+ get { return Expressions[1]; }
+ set { Expressions[1] = value; }
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ GetWidth (out min, out max, 2);
+
+ if (TrueExpression == null || FalseExpression == null)
+ min = 0;
+ }
+ }
+
+ class CaptureAssertion : Assertion {
+ public CaptureAssertion () {
+ }
+
+ public CapturingGroup CapturingGroup {
+ get { return group; }
+ set { group = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ int gid = group.Number;
+ LinkRef tail = cmp.NewLink ();
+
+ if (FalseExpression == null) {
+ // IfDefined :1
+ // <yes_exp>
+ // 1: <tail>
+
+ cmp.EmitIfDefined (gid, tail);
+ TrueExpression.Compile (cmp, reverse);
+ }
+ else {
+ // IfDefined :1
+ // <yes_expr>
+ // Jump :2
+ // 1: <no_expr>
+ // 2: <tail>
+
+ LinkRef false_expr = cmp.NewLink ();
+ cmp.EmitIfDefined (gid, false_expr);
+ TrueExpression.Compile (cmp, reverse);
+ cmp.EmitJump (tail);
+ cmp.ResolveLink (false_expr);
+ FalseExpression.Compile (cmp, reverse);
+ }
+
+ cmp.ResolveLink (tail);
+ }
+
+ public override bool IsComplex () {
+ bool comp = false;
+ if (TrueExpression != null)
+ comp |= TrueExpression.IsComplex ();
+ if (FalseExpression != null)
+ comp |= FalseExpression.IsComplex ();
+
+ return comp | GetFixedWidth () <= 0;
+ }
+
+ private CapturingGroup group;
+ }
+
+ class ExpressionAssertion : Assertion {
+ public ExpressionAssertion () {
+ Expressions.Add (null); // test expression
+ }
+
+ public bool Reverse {
+ get { return reverse; }
+ set { reverse = value; }
+ }
+
+ public bool Negate {
+ get { return negate; }
+ set { negate = value; }
+ }
+
+ public Expression TestExpression {
+ get { return Expressions[2]; }
+ set { Expressions[2] = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ LinkRef true_expr = cmp.NewLink ();
+ LinkRef false_expr = cmp.NewLink ();
+
+ // test op: positive / negative
+
+ if (!negate)
+ cmp.EmitTest (true_expr, false_expr);
+ else
+ cmp.EmitTest (false_expr, true_expr);
+
+ // test expression: lookahead / lookbehind
+
+ TestExpression.Compile (cmp, reverse ^ this.reverse);
+ cmp.EmitTrue ();
+
+ // target expressions
+
+ if (TrueExpression == null) { // (?= ...)
+ // Test :1, :2
+ // <test_expr>
+ // :2 False
+ // :1 <tail>
+
+ cmp.ResolveLink (false_expr);
+ cmp.EmitFalse ();
+ cmp.ResolveLink (true_expr);
+ }
+ else {
+ cmp.ResolveLink (true_expr);
+ TrueExpression.Compile (cmp, reverse);
+
+ if (FalseExpression == null) { // (?(...) ...)
+ // Test :1, :2
+ // <test_expr>
+ // :1 <yes_expr>
+ // :2 <tail>
+
+ cmp.ResolveLink (false_expr);
+ }
+ else { // (?(...) ... | ...)
+ // Test :1, :2
+ // <test_expr>
+ // :1 <yes_expr>
+ // Jump :3
+ // :2 <no_expr>
+ // :3 <tail>
+
+ LinkRef tail = cmp.NewLink ();
+
+ cmp.EmitJump (tail);
+ cmp.ResolveLink (false_expr);
+ FalseExpression.Compile (cmp, reverse);
+ cmp.ResolveLink (tail);
+ }
+ }
+ }
+
+ private bool reverse, negate;
+ }
+
+ // alternation
+
+ class Alternation : CompositeExpression {
+ public Alternation () {
+ }
+
+ public ExpressionCollection Alternatives {
+ get { return Expressions; }
+ }
+
+ public void AddAlternative (Expression e) {
+ Alternatives.Add (e);
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ LinkRef next = cmp.NewLink ();
+ LinkRef tail = cmp.NewLink ();
+
+ foreach (Expression e in Alternatives) {
+ cmp.EmitBranch (next);
+ e.Compile (cmp, reverse);
+ cmp.EmitJump (tail);
+ cmp.ResolveLink (next);
+ }
+
+ cmp.EmitFalse ();
+ cmp.ResolveLink (tail);
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ GetWidth (out min, out max, Alternatives.Count);
+ }
+
+ public override bool IsComplex () {
+ bool comp = false;
+ foreach (Expression e in Alternatives) {
+ comp |= e.IsComplex ();
+ }
+
+ return comp | GetFixedWidth () <= 0;
+ }
+ }
+
+ // terminal expressions
+
+ class Literal : Expression {
+ public Literal (string str, bool ignore) {
+ this.str = str;
+ this.ignore = ignore;
+ }
+
+ public string String {
+ get { return str; }
+ set { str = value; }
+ }
+
+ public bool IgnoreCase {
+ get { return ignore; }
+ set { ignore = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ if (str.Length == 0)
+ return;
+
+ if (str.Length == 1)
+ cmp.EmitCharacter (str[0], false, ignore, reverse);
+ else
+ cmp.EmitString (str, ignore, reverse);
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ min = max = str.Length;
+ }
+
+ public override AnchorInfo GetAnchorInfo () {
+ return new AnchorInfo (this, 0, str.Length, str, ignore);
+ }
+
+ public override bool IsComplex () {
+ return false;
+ }
+
+ private string str;
+ private bool ignore;
+ }
+
+ class PositionAssertion : Expression {
+ public PositionAssertion (Position pos) {
+ this.pos = pos;
+ }
+
+ public Position Position {
+ get { return pos; }
+ set { pos = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ cmp.EmitPosition (pos);
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ min = max = 0;
+ }
+
+ public override bool IsComplex () {
+ return false;
+ }
+
+ public override AnchorInfo GetAnchorInfo () {
+ switch (pos) {
+ case Position.StartOfString: case Position.StartOfLine: case Position.StartOfScan:
+ return new AnchorInfo (this, 0, 0, pos);
+
+ default:
+ return new AnchorInfo (this, 0);
+ }
+ }
+
+ private Position pos;
+ }
+
+ class Reference : Expression {
+ public Reference (bool ignore) {
+ this.ignore = ignore;
+ }
+
+ public CapturingGroup CapturingGroup {
+ get { return group; }
+ set { group = value; }
+ }
+
+ public bool IgnoreCase {
+ get { return ignore; }
+ set { ignore = value; }
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ cmp.EmitReference (group.Number, ignore, reverse);
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ //group.GetWidth (out min, out max);
+ // TODO set width to referenced group for non-cyclical references
+ min = 0;
+ max = Int32.MaxValue;
+ }
+
+ public override bool IsComplex () {
+ return true; // FIXME incorporate cyclic check
+ }
+
+ private CapturingGroup group;
+ private bool ignore;
+ }
+
+ class CharacterClass : Expression {
+ public CharacterClass (bool negate, bool ignore) {
+ this.negate = negate;
+ this.ignore = ignore;
+
+ intervals = new IntervalCollection ();
+
+ // initialize pos/neg category arrays
+
+ Array cat_values = Enum.GetValues (typeof (Category));
+ int cat_size = (int)(Category)cat_values.GetValue (cat_values.Length - 1) + 1;
+ pos_cats = new bool[cat_size];
+ neg_cats = new bool[cat_size];
+ for (int i = 0; i < cat_size; ++ i) {
+ pos_cats[i] = false;
+ neg_cats[i] = false;
+ }
+ }
+
+ public CharacterClass (Category cat, bool negate) : this (false, false) {
+ this.AddCategory (cat, negate);
+ }
+
+ public bool Negate {
+ get { return negate; }
+ set { negate = value; }
+ }
+
+ public bool IgnoreCase {
+ get { return ignore; }
+ set { ignore = value; }
+ }
+
+ public void AddCategory (Category cat, bool negate) {
+ int n = (int)cat;
+
+ if (negate) {
+ if (pos_cats[n])
+ pos_cats[n] = false;
+
+ neg_cats[n] = true;
+ }
+ else {
+ if (neg_cats[n])
+ neg_cats[n] = false;
+
+ pos_cats[n] = true;
+ }
+ }
+
+ public void AddCharacter (char c) {
+ intervals.Add (new Interval (c, c));
+ }
+
+ public void AddRange (char lo, char hi) {
+ intervals.Add (new Interval (lo, hi));
+ }
+
+ public override void Compile (ICompiler cmp, bool reverse) {
+ // create the meta-collection
+
+ IntervalCollection meta =
+ intervals.GetMetaCollection (new IntervalCollection.CostDelegate (GetIntervalCost));
+
+ // count ops
+
+ int count = meta.Count;
+ for (int i = 0; i < pos_cats.Length; ++ i) {
+ if (pos_cats[i]) ++ count;
+ if (neg_cats[i]) ++ count;
+ }
+
+ if (count == 0)
+ return;
+
+ // emit in op for |meta| > 1
+
+ LinkRef tail = cmp.NewLink ();
+ if (count > 1)
+ cmp.EmitIn (tail);
+
+ // emit categories
+
+ for (int i = 0; i < pos_cats.Length; ++ i) {
+ if (pos_cats[i])
+ cmp.EmitCategory ((Category)i, negate, reverse);
+ else if (neg_cats[i])
+ cmp.EmitCategory ((Category)i, !negate, reverse);
+ }
+
+ // emit character/range/sets from meta-collection
+
+ foreach (Interval a in meta) {
+ if (a.IsDiscontiguous) { // Set
+ BitArray bits = new BitArray (a.Size);
+ foreach (Interval b in intervals) {
+ if (a.Contains (b)) {
+ for (int i = b.low; i <= b.high; ++ i)
+ bits[i - a.low] = true;
+ }
+ }
+
+ cmp.EmitSet ((char)a.low, bits, negate, ignore, reverse);
+ }
+ else if (a.IsSingleton) // Character
+ cmp.EmitCharacter ((char)a.low, negate, ignore, reverse);
+ else // Range
+ cmp.EmitRange ((char)a.low, (char)a.high, negate, ignore, reverse);
+ }
+
+ // finish up
+
+ if (count > 1) {
+ if (negate)
+ cmp.EmitTrue ();
+ else
+ cmp.EmitFalse ();
+
+ cmp.ResolveLink (tail);
+ }
+ }
+
+ public override void GetWidth (out int min, out int max) {
+ min = max = 1;
+ }
+
+ public override bool IsComplex () {
+ return false;
+ }
+
+ // private
+
+ private static double GetIntervalCost (Interval i) {
+ // use op length as cost metric (=> optimize for space)
+
+ if (i.IsDiscontiguous)
+ return 3 + ((i.Size + 0xf) >> 4); // Set
+ else if (i.IsSingleton)
+ return 2; // Character
+ else
+ return 3; // Range
+ }
+
+ private bool negate, ignore;
+ private bool[] pos_cats, neg_cats;
+ private IntervalCollection intervals;
+ }
+
+ class AnchorInfo {
+ private Expression expr;
+
+ private Position pos;
+ private int offset;
+
+ private string str;
+ private int width;
+ private bool ignore;
+
+ public AnchorInfo (Expression expr, int width) {
+ this.expr = expr;
+ this.offset = 0;
+ this.width = width;
+
+ this.str = null;
+ this.ignore = false;
+ this.pos = Position.Any;
+ }
+
+ public AnchorInfo (Expression expr, int offset, int width, string str, bool ignore) {
+ this.expr = expr;
+ this.offset = offset;
+ this.width = width;
+
+ this.str = ignore ? str.ToLower () : str;
+
+ this.ignore = ignore;
+ this.pos = Position.Any;
+ }
+
+ public AnchorInfo (Expression expr, int offset, int width, Position pos) {
+ this.expr = expr;
+ this.offset = offset;
+ this.width = width;
+
+ this.pos = pos;
+
+ this.str = null;
+ this.ignore = false;
+ }
+
+ public Expression Expression {
+ get { return expr; }
+ }
+
+ public int Offset {
+ get { return offset; }
+ }
+
+ public int Width {
+ get { return width; }
+ }
+
+ public int Length {
+ get { return (str != null) ? str.Length : 0; }
+ }
+
+ public bool IsUnknownWidth {
+ get { return width < 0; }
+ }
+
+ public bool IsComplete {
+ get { return Length == Width; }
+ }
+
+ public string Substring {
+ get { return str; }
+ }
+
+ public bool IgnoreCase {
+ get { return ignore; }
+ }
+
+ public Position Position {
+ get { return pos; }
+ }
+
+ public bool IsSubstring {
+ get { return str != null; }
+ }
+
+ public bool IsPosition {
+ get { return pos != Position.Any; }
+ }
+
+ public Interval GetInterval () {
+ return GetInterval (0);
+ }
+
+ public Interval GetInterval (int start) {
+ if (!IsSubstring)
+ return Interval.Empty;
+
+ return new Interval (start + Offset, start + Offset + Length - 1);
+ }
+ }
+}
diff --git a/mcs/class/System/System.Threading/ChangeLog b/mcs/class/System/System.Threading/ChangeLog
new file mode 100755
index 00000000000..2f7f43e9fc6
--- /dev/null
+++ b/mcs/class/System/System.Threading/ChangeLog
@@ -0,0 +1,9 @@
+2001-09-21 Dick Porter <dick@ximian.com>
+
+ * ThreadExceptionEventArgs.cs: Implemented
+
+2001-09-13 Dick Porter <dick@ximian.com>
+
+ * ThreadExceptionEventArgs.cs, ThreadExceptionEventHandler.cs:
+ More System.Threading stubs, in the System assembly.
+
diff --git a/mcs/class/System/System.Threading/ThreadExceptionEventArgs.cs b/mcs/class/System/System.Threading/ThreadExceptionEventArgs.cs
new file mode 100755
index 00000000000..002324fe2db
--- /dev/null
+++ b/mcs/class/System/System.Threading/ThreadExceptionEventArgs.cs
@@ -0,0 +1,27 @@
+//
+// System.Threading.ThreadExceptionEventArgs.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public class ThreadExceptionEventArgs : EventArgs
+ {
+ private Exception exception;
+
+ public ThreadExceptionEventArgs(Exception t) {
+ exception=t;
+ }
+
+ public Exception Exception {
+ get {
+ return(exception);
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/System.Threading/ThreadExceptionEventHandler.cs b/mcs/class/System/System.Threading/ThreadExceptionEventHandler.cs
new file mode 100755
index 00000000000..6f47d2bdd96
--- /dev/null
+++ b/mcs/class/System/System.Threading/ThreadExceptionEventHandler.cs
@@ -0,0 +1,14 @@
+//
+// System.Threading.ThreadExceptionEventHandler.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public delegate void ThreadExceptionEventHandler(object sender, ThreadExceptionEventArgs e);
+}
diff --git a/mcs/class/System/System.build b/mcs/class/System/System.build
new file mode 100644
index 00000000000..b3294eaa594
--- /dev/null
+++ b/mcs/class/System/System.build
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System.dll -->
+
+<project name="System" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/System.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/unsafe"/>
+ <arg value="/nostdlib"/> <!-- don't reference mscorlib -->
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/lib:../lib/"/>
+ <arg value="/r:corlib.dll"/>
+ <arg value="/r:System.Xml.dll"/>
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="Test/**"/>
+ <excludes name="System.CodeDom/Code-X-Collection.cs"/>
+ <excludes name="System.Net/IAuthenticationModule.cs"/>
+ <excludes name="System.Net/AuthenticationManager.cs"/>
+ </sources>
+ </csc>
+ <copy file="../lib/System.dll" tofile="Test/System.dll"/>
+ <nant basedir="Test" target="build"/>
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <nant basedir="Test" target="clean"/>
+ <delete file="../lib/System.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System/System/ChangeLog b/mcs/class/System/System/ChangeLog
new file mode 100644
index 00000000000..6a77f00c92a
--- /dev/null
+++ b/mcs/class/System/System/ChangeLog
@@ -0,0 +1,14 @@
+2002-02-08 Duncan Mak <duncan@ximian.com>
+
+ * UriFormatException.cs: Removed TODO attribute, the docs are
+ probably wrong here. In any case, this code compiles and should work.
+
+2002-01-31 Duncan Mak <duncan@ximian.com>
+
+ * UriFormatException.cs: Added bits for serialization.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * ChangeLog : Add to this directory.
+
+ * Uri.cs, UriFormatException.cs : Decorate bits with MonoTODO attribute. \ No newline at end of file
diff --git a/mcs/class/System/System/TODOAttribute.cs b/mcs/class/System/System/TODOAttribute.cs
new file mode 100644
index 00000000000..e14b61a2649
--- /dev/null
+++ b/mcs/class/System/System/TODOAttribute.cs
@@ -0,0 +1,32 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All)]
+ internal class MonoTODOAttribute : Attribute {
+
+ string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+ }
+}
diff --git a/mcs/class/System/System/Uri.cs b/mcs/class/System/System/Uri.cs
new file mode 100755
index 00000000000..64b2dc4705d
--- /dev/null
+++ b/mcs/class/System/System/Uri.cs
@@ -0,0 +1,329 @@
+//
+// System.Uri
+//
+// Author:
+// Garrett Rooney (rooneg@electricjellyfish.net)
+//
+// (C) 2001 Garrett Rooney
+//
+
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class Uri : MarshalByRefObject, ISerializable {
+
+ private string path = "";
+ private string host = "";
+ private string fragment = "";
+ private string scheme = "";
+ private string port = "";
+ private string query = "";
+
+ // FIXME: is this correct?
+ private bool userEscaped = false;
+
+ public static readonly string SchemeDelimiter = "://";
+ public static readonly string UriSchemeFile = "file";
+ public static readonly string UriSchemeFtp = "ftp";
+ public static readonly string UriSchemeGopher = "gopher";
+ public static readonly string UriSchemeHttp = "http";
+ public static readonly string UriSchemeHttps = "https";
+ public static readonly string UriSchemeMailto = "mailto";
+ public static readonly string UriSchemeNntp = "nntp";
+
+ // the details table holds random info about the types of uri's
+ private struct detail {
+ public string scheme;
+ public string port;
+ public string delimiter;
+
+ public detail(string s, string p, string d) {
+ scheme = s;
+ port = p;
+ delimiter = d;
+ }
+ };
+
+ static detail[] details = new detail[] {
+ new detail(UriSchemeFile, "-1", SchemeDelimiter),
+ new detail(UriSchemeFtp, "23", SchemeDelimiter),
+ new detail(UriSchemeGopher, "70", SchemeDelimiter),
+ new detail(UriSchemeHttp, "80", SchemeDelimiter),
+ new detail(UriSchemeHttps, "223", SchemeDelimiter),
+ new detail(UriSchemeMailto, "25", ":"),
+ new detail(UriSchemeNntp, "119", SchemeDelimiter)
+ };
+
+ public static UriHostNameType CheckHostName(string name) {
+ throw new NotImplementedException();
+ }
+
+ public static bool CheckSchemeName(string schemeName) {
+ throw new NotImplementedException();
+ }
+
+ public static int FromHex(char digit) {
+ throw new NotImplementedException();
+ }
+
+ public static string HexEscape(char character) {
+ throw new NotImplementedException();
+ }
+
+ public static char HexUnescape(string pattern, ref int index) {
+ throw new NotImplementedException();
+ }
+
+ public static bool IsHexDigit(char character) {
+ throw new NotImplementedException();
+ }
+
+ public static bool IsHexEncoding(string pattern, int index) {
+ throw new NotImplementedException();
+ }
+
+ private void Parse(string uri) {
+ int i;
+
+ // figure out the scheme
+ int colon = uri.IndexOf(':');
+ if (colon == -1 || colon == uri.Length) {
+ throw new UriFormatException();
+ } else {
+ string s = uri.Substring(0, colon).ToLower();
+ uri = uri.Remove(0, colon);
+ for (i = 0; i < details.Length; i++) {
+ if (details[i].scheme == s) {
+ scheme = details[i].scheme;
+
+ // assume default port. if
+ // they specify one it'll get
+ // set later on.
+ port = details[i].port;
+ break;
+ }
+ }
+ if (i == details.Length) {
+ throw new UriFormatException();
+ }
+ }
+
+ // get rid of the delimiter
+ uri = uri.Remove(0, details[i].delimiter.Length);
+
+ parseHost(uri);
+ }
+
+ [MonoTODO]
+ private void parseHost(string uri) {
+
+ // FIXME: this doesn't handle IPv6 addresses correctly
+ for (int i = 0; i < uri.Length; i++) {
+ switch (uri[i]) {
+ case ':':
+ host = uri.Substring(0, i);
+ parsePort(uri.Remove(0, i + 1));
+ return;
+ case '/':
+ host = uri.Substring(0, i);
+ parsePath(uri.Remove(0, i + 1));
+ return;
+ case '?':
+ case '#':
+ throw new UriFormatException();
+ default:
+ break;
+ }
+ }
+
+ host = uri;
+ }
+
+ [MonoTODO]
+ private void parsePort(string uri) {
+
+ for (int i = 0; i < uri.Length; i++) {
+ switch (uri[i]) {
+ case '/':
+ port = uri.Substring(0, i);
+ parsePath(uri.Remove(0, i + 1));
+ return;
+ case '?':
+ case '#':
+ throw new UriFormatException();
+ default:
+ // FIXME: should this check if
+ // uri[i] is a number?
+ break;
+ }
+ }
+
+ port = uri;
+ }
+
+ private void parsePath(string uri) {
+
+ for (int i = 0; i < uri.Length; i++) {
+ switch (uri[i]) {
+ case '#':
+ path = uri.Substring(0, i);
+ fragment = uri.Remove(0, i + 1);
+ return;
+ case '?':
+ path = uri.Substring(0, i);
+ query = uri.Remove(0, i + 1);
+ return;
+ default:
+ break;
+ }
+ }
+
+ path = uri;
+ }
+
+ public Uri(string uri) {
+ Parse(uri);
+ }
+
+ protected Uri(SerializationInfo serializationInfo,
+ StreamingContext streamingContext) {
+ throw new NotImplementedException();
+ }
+
+ public Uri(string uri, bool dontEscape) {
+ userEscaped = dontEscape;
+ Parse(uri);
+ }
+
+ public Uri(Uri baseUri, string relativeUri) {
+ throw new NotImplementedException();
+ }
+
+ public Uri(Uri baseUri, string relativeUri, bool dontEscape) {
+ userEscaped = dontEscape;
+
+ throw new NotImplementedException();
+ }
+
+ public string AbsolutePath { get { return path; } }
+
+ public string AbsoluteUri {
+ get { throw new NotImplementedException(); }
+ }
+
+ public string Authority { get { return host + ":" + port; } }
+
+ public string Fragment { get { return fragment; } }
+
+ public string Host { get { return host; } }
+
+ public UriHostNameType HostNameType {
+ get { throw new NotImplementedException(); }
+ }
+
+ public bool IsDefaultPort {
+ get {
+ for (int i = 0; i < details.Length; i++) {
+ if (details[i].scheme == scheme) {
+ if (details[i].port == port) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+ }
+
+ public bool IsFile {
+ get {
+ if (scheme == UriSchemeFile)
+ return true;
+ else
+ return false;
+ }
+ }
+
+ [MonoTODO ("Should check IPv6")]
+ public bool IsLoopback {
+ get {
+ if (host == "localhost" || host == "127.0.0.1")
+ return true;
+ else
+ return false;
+ }
+ }
+
+ [MonoTODO]
+ public bool IsUnc {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO]
+ public string LocalPath {
+ get { throw new NotImplementedException(); }
+ }
+
+ public string PathAndQuery {
+ get { return path + "?" + query; }
+ }
+
+ public string Port { get { return port; } }
+
+ public string Query { get { return query; } }
+
+ public string Scheme { get { return scheme; } }
+
+ // FIXME: what the hell are segments?
+ [MonoTODO]
+ public string[] Segments {
+ get { throw new NotImplementedException(); }
+ }
+
+ public bool UserEscaped { get { return userEscaped; } }
+
+ [MonoTODO]
+ public string UserInfo {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO]
+ public override bool Equals(object compared) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public string GetLeftPart(UriPartial part) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public string MakeRelative(Uri toUri) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public void GetObjectData(SerializationInfo info,
+ StreamingContext context)
+ {
+ // FIXME: Implement me. yes, it is public because it implements ISerializable
+ }
+
+ [MonoTODO]
+ protected static string EscapeString(string str) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/System/System/UriFormatException.cs b/mcs/class/System/System/UriFormatException.cs
new file mode 100755
index 00000000000..8bd1813602f
--- /dev/null
+++ b/mcs/class/System/System/UriFormatException.cs
@@ -0,0 +1,43 @@
+//
+// System.UriFormatException.cs
+//
+// Author:
+// Scott Sanders (scott@stonecobra.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Scott Sanders
+// (C) 2002 Ximian, Inc.
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+ [Serializable]
+ public class UriFormatException : FormatException, ISerializable
+ {
+
+ // Constructors
+ public UriFormatException ()
+ : base (Locale.GetText ("Invalid URI format"))
+ {
+ }
+
+ public UriFormatException (string message)
+ : base (message)
+ {
+ }
+
+ protected UriFormatException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ // Methods
+ void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ }
+ }
+}
+
diff --git a/mcs/class/System/System/UriHostNameType.cs b/mcs/class/System/System/UriHostNameType.cs
new file mode 100755
index 00000000000..5e9eafb312a
--- /dev/null
+++ b/mcs/class/System/System/UriHostNameType.cs
@@ -0,0 +1,37 @@
+// UriHostNameType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:33:14 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System {
+
+
+ /// <summary>
+ /// </summary>
+ public enum UriHostNameType {
+
+ /// <summary>
+ /// </summary>
+ Unknown = 0,
+
+ /// <summary>
+ /// </summary>
+ Dns = 2,
+
+ /// <summary>
+ /// </summary>
+ IPv4 = 3,
+
+ /// <summary>
+ /// </summary>
+ IPv6 = 4,
+ } // UriHostNameType
+
+} // System
diff --git a/mcs/class/System/System/UriPartial.cs b/mcs/class/System/System/UriPartial.cs
new file mode 100755
index 00000000000..21cb52f8dbe
--- /dev/null
+++ b/mcs/class/System/System/UriPartial.cs
@@ -0,0 +1,33 @@
+// UriPartial.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:33:21 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System {
+
+
+ /// <summary>
+ /// </summary>
+ public enum UriPartial {
+
+ /// <summary>
+ /// </summary>
+ Scheme = 0,
+
+ /// <summary>
+ /// </summary>
+ Authority = 1,
+
+ /// <summary>
+ /// </summary>
+ Path = 2,
+ } // UriPartial
+
+} // System
diff --git a/mcs/class/System/Test/.cvsignore b/mcs/class/System/Test/.cvsignore
new file mode 100644
index 00000000000..6a7461313bb
--- /dev/null
+++ b/mcs/class/System/Test/.cvsignore
@@ -0,0 +1 @@
+*.dll
diff --git a/mcs/class/System/Test/AllTests.cs b/mcs/class/System/Test/AllTests.cs
new file mode 100644
index 00000000000..4d940d022bd
--- /dev/null
+++ b/mcs/class/System/Test/AllTests.cs
@@ -0,0 +1,32 @@
+// Ximian.Mono.Tests.AllTests, System.dll
+//
+// Author:
+// Mario Martinez (mariom925@home.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+namespace Ximian.Mono.Tests.System
+{
+ /// <summary>
+ /// Combines all unit tests for the System.dll assembly
+ /// into one test suite.
+ /// </summary>
+ public class AllTests : TestCase
+ {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (DnsTest.Suite);
+ suite.AddTest (Collections.Specialized.NameValueCollectionTest.Suite);
+ suite.AddTest (Collections.Specialized.StringCollectionTest.Suite);
+ suite.AddTest (Text.RegularExpressions.AllTests.Suite);
+ suite.AddTest (MonoTests.System.Diagnostics.AllTests.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/Test/BasicOperationsTest.cs b/mcs/class/System/Test/BasicOperationsTest.cs
new file mode 100755
index 00000000000..80668ec1cd1
--- /dev/null
+++ b/mcs/class/System/Test/BasicOperationsTest.cs
@@ -0,0 +1,165 @@
+// created on 7/21/2001 at 2:36 PM
+
+
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+using NUnit.Framework;
+
+
+
+namespace Ximian.Mono.Tests.System.Collections.Specialized {
+
+
+ public class BasicOperationsTest : TestCase {
+
+ protected NameValueCollection nvc;
+ private static Random rnd;
+
+ public BasicOperationsTest() : base("Ximian.Mono.Tests.System.Collections.Specialized.BasicOperationsTest testsuite") {}
+ public BasicOperationsTest(String name) : base(name) {}
+
+ protected override void SetUp() {
+ nvc = new NameValueCollection();
+ rnd=new Random();
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(BasicOperationsTest));
+ }
+ }
+
+
+
+ private void SetDefaultData() {
+ nvc.Clear();
+ nvc.Add("k1","this");
+ nvc.Add("k2","test");
+ nvc.Add("k3","is");
+ nvc.Add("k4","silly");
+ }
+ private static string FormatForPrinting(NameValueCollection nv)
+ {
+ if (nv==null)
+ return null;
+ int max = nv.Count;
+ StringBuilder sb = new StringBuilder("-\t-Key-\t-Value-\n");
+ for (int i=0; i<max; i++){
+
+ sb.Append("\t"+nv.GetKey(i)+"\t"+nv[i]+"\n");
+ }
+ return sb.ToString();
+ }
+
+
+ public void TestAddRemoveClearSetGet()
+ {
+ nvc.Clear();
+ Assert(nvc.Count==0&& !nvc.HasKeys());
+
+ SetDefaultData();
+ Assert(nvc.Count==4);
+ Assert("Get operation returns wrong result.\n"+FormatForPrinting(nvc),(nvc.Get(0).Equals("this"))&&(nvc.Get("k1").Equals("this")));
+
+
+ nvc.Add("k2","programmer");
+ Assert(nvc["k2"].Equals("test,programmer"));
+
+ nvc["k2"]="project";
+ nvc.Add("k2","project");
+ Assert(nvc.Count==4);
+ Assert("Wrong effect of add(samekey,samevalue)\n"+FormatForPrinting(nvc),nvc["k2"].Equals("project"));
+ // TODO: add Remove test
+ nvc.Remove("k4");
+ Assert("wrong nvc.Count="+nvc.Count,nvc.Count==3);
+ Assert(nvc["k4"]==null);
+
+ NameValueCollection nvc1 = new NameValueCollection();
+ nvc1["k1"]="these";
+ nvc1["k5"]="!";
+ nvc.Add(nvc1);
+ Assert(FormatForPrinting(nvc)+"Count is wrong after Add(nvc1) Count="+nvc.Count,nvc.Count==4);
+ Assert("Values are wrong after Add(nvc1)",(nvc["k1"].Equals("this,these"))&&(nvc["k5"].Equals("!")));
+
+ nvc.Set("k3","accomplished");
+ Assert("Wrong result of Set operation",nvc["k3"].Equals("accomplished"));
+
+ }
+
+ public void TestGetKeyGetValues()
+ {
+ SetDefaultData();
+ Assert(nvc.GetKey(0).Equals("k1"));
+ string[] values = nvc.GetValues(0);
+ Assert(values[0].Equals("this"));
+
+ }
+
+ public void TestCopyTo() {
+ SetDefaultData();
+ string[] entries=new string[nvc.Count];
+ nvc.CopyTo(entries,0);
+ //Message(FormatForPrinting(nvc));
+ //Assert("Not an entry.",entries[0] is DictionaryEntry);
+ }
+
+ public void TestUnderHeavyLoad() {
+
+ //TODO: add memory and time measurement
+
+ nvc.Clear();
+ int max=10000;
+ String[] cache=new String[max*2];
+ int n=0;
+
+ for (int i=0;i<max;i++) {
+ int id=rnd.Next()&0xFFFF;
+ String key=""+id+"-key-"+id;
+ String val="value-"+id;
+ if (nvc[key]==null) {
+ nvc[key]=val;
+ cache[n]=key;
+ cache[n+max]=val;
+ n++;
+ }
+ }
+
+ Assert(nvc.Count==n);
+
+ for (int i=0;i<n;i++) {
+ String key=cache[i];
+ String val=nvc[key] as String;
+ String err="nvc[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+
+ int r1=(n/3);
+ int r2=r1+(n/5);
+
+ for (int i=r1;i<r2;i++) {
+ nvc.Remove(cache[i]);
+ }
+
+
+ for (int i=0;i<n;i++) {
+ if (i>=r1 && i<r2) {
+ Assert(nvc[cache[i]]==null);
+ } else {
+ String key=cache[i];
+ String val=nvc[key] as String;
+ String err="ht[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+ }
+
+ }
+
+ }
+}
+
diff --git a/mcs/class/System/Test/ChangeLog b/mcs/class/System/Test/ChangeLog
new file mode 100644
index 00000000000..62756ab0754
--- /dev/null
+++ b/mcs/class/System/Test/ChangeLog
@@ -0,0 +1,49 @@
+2002-04-07 Jonathan Pryor <jonpryor@vt.edu>
+
+ * AllTests.cs: Added System.Diagnostics tests, as they work now.
+
+2002/03/08 Nick Drochak <ndrochak@gol.com>
+
+ * System.XML_test.build: Don't build test dll by default. Only build
+ it when 'make test' is specified.
+
+2002-02-27 Martin Baulig <martin@gnome.org>
+
+ * System.Text.RegularExpressions/*.cs: Put everything into namespace
+ Ximian.Mono.Tests.System.Text.RegularExpressions.
+
+ * System_test.build: Build new executable RunTests.System.exe which you can
+ use to run the tests on Linux.
+
+ * NameValueCollectionTest.cs: Split out BasicOperationTest into
+ BasicOperationTest.cs.
+
+ * AllTests.cs: Use namespace Ximian.Mono.Tests.System instead of
+ Ximian.Mono.Tests.
+
+ * DnsTest.cs: Put this into namespace Ximian.Mono.Tests.Systeam.
+ * NameValueCollectionTest.cs: Likewise.
+ * StringCollectionTest.cs: Likewise.
+
+2002-02-11 Duncan Mak <duncan@ximian.com>
+
+ * AllTests.cs: Removed entry for IPHostEntryTest.cs because Mads
+ removed it and included it in the new DnsTest.cs. This fixes the build.
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * DnsTest.cs: Updated test.
+
+2001-09-26 Mads Pultz <mpultz@get2net.dk>
+ * DnsTest.cs: initial tests of BeginGetHostByName and EndGetHostByName implemented.
+
+2001-09-24 Mads Pultz <mpultz@get2net.dk>
+
+ * DnsTest.cs: now tests GetHostByAddress, GetHostByName,
+ IpToString and Resolve.
+
+2001-09-23 Mads Pultz <mpultz@get2net.dk>
+
+ * DnsTest.cs: Initial work submitted to repository.
+ * IPHostEntryTest.cs: Initial work submitted to repository.
+
diff --git a/mcs/class/System/Test/DnsTest.cs b/mcs/class/System/Test/DnsTest.cs
new file mode 100644
index 00000000000..0def350b05c
--- /dev/null
+++ b/mcs/class/System/Test/DnsTest.cs
@@ -0,0 +1,162 @@
+// DnsTest.cs - NUnit Test Cases for the System.Net.Dns class
+//
+// Author: Mads Pultz (mpultz@diku.dk)
+//
+// (C) Mads Pultz, 2001
+//
+// This test assumes the following:
+// 1) The following Internet sites exist:
+// www.go-mono.com with IP address 129.250.184.233
+// info.diku.dk with IP address 130.225.96.4
+// 2) The following DNS name does not exist:
+// www.hopefullydoesnotexist.dk
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Net.Sockets;
+using System.Threading;
+using System.Collections;
+
+namespace Ximian.Mono.Tests.System {
+
+public class DnsTest: TestCase {
+
+ private String site1Name = "www.go-mono.com",
+ site1Dot = "129.250.184.233",
+ site2Name = "info.diku.dk",
+ site2Dot = "130.225.96.4",
+ noneExistingSite = "www.hopefullydoesnotexist.dk";
+ private uint site1IP = 2180692201, site2IP = 2195808260; // Big-Endian
+
+ public DnsTest(): base("Ximian.Mono.Tests.System.Net.DnsTest testsuite") { }
+ public DnsTest(String name): base(name) { }
+
+ public static ITest Suite {
+ get { return new TestSuite(typeof(DnsTest)); }
+ }
+
+ private void Callback(IAsyncResult ar) {
+ IPHostEntry h;
+ h = Dns.EndGetHostByName(ar);
+ SubTestValidIPHostEntry(h);
+ }
+
+ public void TestAsyncGetHostByName(){
+ IAsyncResult r;
+ r = Dns.BeginGetHostByName(site1Name, new AsyncCallback(Callback), null);
+ }
+
+ public void TestAsyncResolve() {
+ IAsyncResult r;
+ r = Dns.BeginResolve(site1Name, new AsyncCallback(Callback), null);
+ }
+
+ public void TestGetHostName() {
+ string hostName = Dns.GetHostName();
+ Assert(hostName != null);
+ }
+
+ private void SubTestGetHostByName(string siteName, string siteDot) {
+ IPHostEntry h = Dns.GetHostByName(siteName);
+ SubTestValidIPHostEntry(h);
+ Assert(h.HostName.Equals(siteName));
+ Assert(h.AddressList[0].ToString() == siteDot);
+ }
+
+ public void TestGetHostByName() {
+ SubTestGetHostByName(site1Name, site1Dot);
+ SubTestGetHostByName(site2Name, site2Dot);
+ try {
+ Dns.GetHostByName(noneExistingSite);
+ Fail("Should raise a SocketException (assuming that '" + noneExistingSite + "' does not exist)");
+ } catch (SocketException) {
+ }
+ try {
+ Dns.GetHostByName(null);
+ Fail("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ }
+
+ private void SubTestGetHostByAddressStringFormatException(string addr) {
+ try {
+ Dns.GetHostByAddress(addr);
+ Fail("Should raise a FormatException");
+ } catch (FormatException) {
+ }
+ }
+
+ private void SubTestGetHostByAddressString(string addr) {
+ IPHostEntry h = Dns.GetHostByAddress(addr);
+ SubTestValidIPHostEntry(h);
+ }
+
+ public void TestGetHostByAddressString() {
+ try {
+ String addr = null;
+ Dns.GetHostByAddress(addr);
+ Fail("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ SubTestGetHostByAddressStringFormatException("123.255.23");
+ SubTestGetHostByAddressStringFormatException("123.256.34.10");
+ SubTestGetHostByAddressStringFormatException("not an IP address");
+ SubTestGetHostByAddressString(site1Dot);
+ SubTestGetHostByAddressString(site2Dot);
+ }
+
+ private void SubTestGetHostByAddressIPAddress(IPAddress addr) {
+ IPHostEntry h = Dns.GetHostByAddress(addr);
+ SubTestValidIPHostEntry(h);
+ Assert(h.AddressList[0].ToString() == addr.ToString());
+ }
+
+ public void TestGetHostByAddressIPAddress() {
+ try {
+ IPAddress addr = null;
+ Dns.GetHostByAddress(addr);
+ Fail("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ SubTestGetHostByAddressIPAddress(new IPAddress(IPAddress.NetworkToHostOrder((int)site1IP)));
+ SubTestGetHostByAddressIPAddress(new IPAddress(IPAddress.NetworkToHostOrder((int)site2IP)));
+ }
+
+ private void SubTestResolve(string addr) {
+ IPHostEntry h = Dns.Resolve(addr);
+ SubTestValidIPHostEntry(h);
+ }
+
+ public void TestResolve() {
+ SubTestResolve(site1Name);
+ SubTestResolve(site2Name);
+ SubTestResolve(site1Dot);
+ SubTestResolve(site2Dot);
+ }
+
+ private void SubTestValidIPHostEntry(IPHostEntry h) {
+ Assert(h.HostName != null);
+ Assert(h.AddressList != null);
+ Assert(h.AddressList.Length > 0);
+ }
+
+ private static void printIPHostEntry(IPHostEntry h)
+ {
+ Console.WriteLine("----------------------------------------------------");
+ Console.WriteLine("Host name:");
+ Console.WriteLine(h.HostName);
+ Console.WriteLine("IP addresses:");
+ IPAddress[] list = h.AddressList;
+ for(int i = 0; i < list.Length; ++i)
+ Console.WriteLine(list[i]);
+ Console.WriteLine("Aliases:");
+ string[] aliases = h.Aliases;
+ for(int i = 0; i < aliases.Length; ++i)
+ Console.WriteLine(aliases[i]);
+ Console.WriteLine("----------------------------------------------------");
+ }
+}
+
+}
diff --git a/mcs/class/System/Test/NameValueCollectionTest.cs b/mcs/class/System/Test/NameValueCollectionTest.cs
new file mode 100644
index 00000000000..9f5c20d5c05
--- /dev/null
+++ b/mcs/class/System/Test/NameValueCollectionTest.cs
@@ -0,0 +1,31 @@
+// created on 7/21/2001 at 2:36 PM
+
+
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text;
+
+using NUnit.Framework;
+
+
+
+namespace Ximian.Mono.Tests.System.Collections.Specialized {
+
+
+ /// <summary>Microsoft NameValueCollection test.</summary>
+ public class NameValueCollectionTest : TestCase {
+
+ public NameValueCollectionTest() : base("Ximian.Mono.Tests.System.Collections.Specialized.NameValueCollectionTest testsuite") {}
+ public NameValueCollectionTest(String name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(NameValueCollectionTest));
+ }
+ }
+
+ }
+}
+
diff --git a/mcs/class/System/Test/StringCollectionTest.cs b/mcs/class/System/Test/StringCollectionTest.cs
new file mode 100644
index 00000000000..3bd203d1431
--- /dev/null
+++ b/mcs/class/System/Test/StringCollectionTest.cs
@@ -0,0 +1,157 @@
+/* System.Collections.Specialized.StringCollection.cs
+ * Authors:
+ * John Barnette (jbarn@httcb.net)
+ *
+ * Copyright (C) 2001 John Barnette
+*/
+
+using NUnit.Framework;
+using System.Collections.Specialized;
+
+namespace Ximian.Mono.Tests.System.Collections.Specialized {
+ public class StringCollectionTest : TestCase {
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof (StringCollectionTest));
+ }
+ }
+
+ private StringCollection sc;
+ string[] strings = {
+ "foo",
+ "bar",
+ "baz",
+ "john",
+ "paul",
+ "george",
+ "ringo"
+ };
+
+ public StringCollectionTest() : base("Ximian.Mono.Tests.System.Collections.Specialized.StringCollectionTest testsuite") {}
+ public StringCollectionTest(string name) : base(name) {}
+
+ protected override void SetUp() {
+ sc = new StringCollection();
+ sc.AddRange(strings);
+ }
+
+ // Simple Tests
+
+ public void TestSimpleCount() {
+ Assert(sc.Count == 7);
+ }
+
+ public void TestSimpleIsReadOnly() {
+ Assert(!sc.IsReadOnly);
+ }
+
+ public void TestSimpleIsSynchronized() {
+ Assert(!sc.IsSynchronized);
+ }
+
+ public void TestSimpleItemGet() {
+ for(int i = 0; i < strings.Length; i++) {
+ Assert(strings[i].Equals(sc[i]));
+ }
+ }
+
+ public void TestSimpleItemSet() {
+ sc[0] = "bob";
+ Assert(sc[0].Equals("bob"));
+ }
+
+ public void TestSimpleSyncRoot() {
+ Assert(sc.Equals(sc.SyncRoot));
+ }
+
+ public void TestSimpleAdd() {
+ int index = sc.Add("chuck");
+ Assert(index == strings.Length);
+ Assert(sc[strings.Length].Equals("chuck"));
+
+ }
+
+ public void TestSimpleAddRange() {
+ string[] newStrings = {
+ "peter",
+ "paul",
+ "mary"
+ };
+
+ int index = sc.Count;
+ sc.AddRange(newStrings);
+
+ Assert(sc.Count == index + newStrings.Length);
+
+ for (int i = 0; i+index <= sc.Count-1; i++) {
+ Assert(newStrings[i].Equals(sc[i+index]));
+ }
+ }
+
+ public void TestSimpleClear() {
+ sc.Clear();
+ Assert(sc.Count == 0);
+ }
+
+ public void TestSimpleContains() {
+ Assert(sc.Contains(strings[0]));
+ Assert(!sc.Contains("NOT CONTAINED"));
+ }
+
+ public void TestSimpleCopyTo() {
+ string[] copyArray = new string[sc.Count];
+ sc.CopyTo(copyArray, 0);
+ for (int i = 0; i < copyArray.Length; i++) {
+ Assert(copyArray[i] == sc[i]);
+ }
+ }
+
+ public void TestSimpleGetEnumerator() {
+ int index = 0;
+ foreach(string s in sc) {
+ Assert(s.Equals(strings[index]));
+ index++;
+ }
+ }
+
+ public void TestSimpleIndexOf() {
+ Assert(sc.IndexOf(strings[0]) == 0);
+ }
+
+ public void TestSimpleInsert() {
+ int index = 3;
+ int oldCount = sc.Count;
+ string before = sc[index - 1];
+ string current = sc[index];
+ string after = sc[index + 1];
+ string newStr = "paco";
+
+ sc.Insert(index, newStr);
+
+ Assert(sc.Count == oldCount + 1);
+ Assert(sc[index].Equals(newStr));
+ Assert(sc[index-1].Equals(before));
+ Assert(sc[index+1].Equals(current));
+ Assert(sc[index+2].Equals(after));
+ }
+
+ public void TestSimpleRemove() {
+ int oldCount = sc.Count;
+ sc.Remove(strings[0]);
+ Assert(oldCount == sc.Count + 1);
+ Assert(!sc.Contains(strings[0]));
+ }
+
+ public void TestSimpleRemoveAt() {
+ int index = 3;
+ int oldCount = sc.Count;
+ string after = sc[index+1];
+
+ sc.RemoveAt(index);
+ Assert(oldCount == sc.Count + 1);
+ Assert(sc[index].Equals(after));
+ }
+
+ }
+}
diff --git a/mcs/class/System/Test/System.Diagnostics/AllTests.cs b/mcs/class/System/Test/System.Diagnostics/AllTests.cs
new file mode 100644
index 00000000000..2f5cdb7d305
--- /dev/null
+++ b/mcs/class/System/Test/System.Diagnostics/AllTests.cs
@@ -0,0 +1,29 @@
+//
+// MonoTests.System.Diagnostics.AllTests, System.dll
+//
+// Author:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002 Jonathan Pryor
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System.Diagnostics {
+
+ public class AllTests : TestCase {
+
+ public AllTests(string name) : base(name)
+ {}
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (MonoTests.System.Diagnostics.TraceTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Diagnostics/ChangeLog b/mcs/class/System/Test/System.Diagnostics/ChangeLog
new file mode 100644
index 00000000000..ff02723e8ae
--- /dev/null
+++ b/mcs/class/System/Test/System.Diagnostics/ChangeLog
@@ -0,0 +1,11 @@
+2002-04-07 Jonathan Pryor <jonpryor@vt.edu>
+
+ * TraceTest.cs: Removed extraneous output; renamed test case so that NUnit
+ would find it.
+
+2002-03-10 Jonathan Pryor <jonpryor@vt.edu>
+
+ * Initial creation of System.Diagnostics test directory
+ * AllTests.cs: file added
+ * TraceTest.cs: Test System.Diagnostics.Trace class
+
diff --git a/mcs/class/System/Test/System.Diagnostics/TraceTest.cs b/mcs/class/System/Test/System.Diagnostics/TraceTest.cs
new file mode 100644
index 00000000000..046f04bbbc5
--- /dev/null
+++ b/mcs/class/System/Test/System.Diagnostics/TraceTest.cs
@@ -0,0 +1,94 @@
+//
+// TraceTest.cs - NUnit Test Cases for System.Diagnostics.Trace
+//
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) Jonathan Pryor
+//
+
+// We want tracing enabled, so...
+#define TRACE
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Diagnostics;
+
+namespace MonoTests.System.Diagnostics {
+
+ public class TraceTest : TestCase {
+
+ private StringWriter buffer;
+ private TraceListener listener;
+
+ public TraceTest ()
+ : base ("System.Diagnostics.Trace testsuite")
+ {
+ }
+
+ public TraceTest (string name)
+ : base(name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ // We don't want to deal with the default listener, which can send the
+ // output to various places (Debug stream, Console.Out, ...)
+ // Trace.Listeners.Remove ("Default");
+
+ buffer = new StringWriter ();
+
+ listener = new TextWriterTraceListener (buffer, "TestOutput");
+
+ Trace.Listeners.Add (listener);
+
+ Trace.AutoFlush = true;
+
+ }
+
+ protected override void TearDown ()
+ {
+ Trace.Listeners.Add (new DefaultTraceListener ());
+ Trace.Listeners.Remove (listener);
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (TraceTest));
+ }
+ }
+
+ public void TestTracing ()
+ {
+ string value =
+ "Entering Main" + Environment.NewLine +
+ "Exiting Main" + Environment.NewLine;
+
+ Trace.WriteLine ("Entering Main");
+ Trace.WriteLine ("Exiting Main");
+
+ AssertEquals ("#Tr01", value, buffer.ToString ());
+ }
+
+ public void TestIndent ()
+ {
+ Console.Error.WriteLine ("TraceTest.TestIndent");
+ string value =
+ "List of errors:" + Environment.NewLine +
+ " Error 1: File not found" + Environment.NewLine +
+ " Error 2: Directory not found" + Environment.NewLine +
+ "End of list of errors" + Environment.NewLine;
+
+ Trace.WriteLine ("List of errors:");
+ Trace.Indent ();
+ Trace.WriteLine ("Error 1: File not found");
+ Trace.WriteLine ("Error 2: Directory not found");
+ Trace.Unindent ();
+ Trace.WriteLine ("End of list of errors");
+
+ AssertEquals ("#In01", value, buffer.ToString());
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs b/mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs
new file mode 100755
index 00000000000..f7b39fd5050
--- /dev/null
+++ b/mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs
@@ -0,0 +1,82 @@
+// System.Net.Sockets.TcpClientTest.cs
+//
+// Author:
+// Phillip Pearson (pp@myelin.co.nz)
+//
+// Copyright (C) 2001, Phillip Pearson
+// http://www.myelin.co.nz
+//
+
+using System;
+using System.Net;
+using System.Net.Sockets;
+using NUnit.Framework;
+
+namespace MonoTests.System.Net.Sockets {
+
+ /// <summary>
+ /// Tests System.Net.Sockets.TcpClient
+ /// </summary>
+ public class TcpClientTest : TestCase {
+
+ public TcpClientTest(string name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof (TcpClientTest));
+ }
+ }
+
+ /// <summary>
+ /// Tests the TcpClient object
+ /// (from System.Net.Sockets)
+ /// </summary>
+ public void test_TcpClient()
+ {
+ // set up a listening Socket
+ Socket lSock = new Socket(AddressFamily.InterNetwork,
+ SocketType.Stream, ProtocolType.Tcp);
+
+ lSock.Bind(new IPEndPoint(IPAddress.Any, 1234));
+ lSock.Listen(-1);
+
+
+ // connect to it with a TcpClient
+ TcpClient outClient = new TcpClient("localhost", 1234);
+ Socket inSock = lSock.Accept();
+
+
+ // now try exchanging data
+ NetworkStream stream = outClient.GetStream();
+
+ const int len = 1024;
+ byte[] outBuf = new Byte[len];
+ for (int i=0; i<len; i++)
+ {
+ outBuf[i] = (byte)(i % 256);
+ }
+
+ // send it
+ stream.Write(outBuf,0,len);
+
+ // and see if it comes back
+ byte[] inBuf = new Byte[len];
+ int ret = inSock.Receive(inBuf, 0, len, 0);
+ Assert(ret != 0);
+
+ for (int i=0; i<len; i++)
+ {
+ Assert(inBuf[i] == outBuf[i]);
+ }
+
+
+ // tidy up
+ inSock.Close();
+ outClient.Close();
+ lSock.Close();
+
+ }
+
+ }
+
+}
diff --git a/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs
new file mode 100755
index 00000000000..a07d6bfcb9e
--- /dev/null
+++ b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs
@@ -0,0 +1,85 @@
+// System.Net.Sockets.TcpListenerTest.cs
+//
+// Author:
+// Phillip Pearson (pp@myelin.co.nz)
+//
+// Copyright (C) 2001, Phillip Pearson
+// http://www.myelin.co.nz
+//
+
+using System;
+using System.Net;
+using System.Net.Sockets;
+using NUnit.Framework;
+
+namespace MonoTests.System.Net.Sockets {
+
+ /// <summary>
+ /// Tests System.Net.Sockets.TcpListener
+ /// </summary>
+ public class TcpListenerTest : TestCase {
+
+ public TcpListenerTest(string name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof (TcpListenerTest));
+ }
+ }
+
+ /// <summary>
+ /// Tests the TcpListener object
+ /// (from System.Net.Sockets)
+ /// </summary>
+ public void test_TcpListener()
+ {
+ // listen with a new listener
+ TcpListener inListener = new TcpListener(1234);
+ inListener.Start();
+
+
+ // connect to it from a new socket
+ Socket outSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
+ ProtocolType.IP);
+ IPHostEntry hostent = Dns.GetHostByAddress("127.0.0.1");
+ IPEndPoint remote = new IPEndPoint(hostent.AddressList[0], 1234);
+ outSock.Connect(remote);
+
+
+ // make sure the connection arrives
+ Assert(inListener.Pending());
+ Socket inSock = inListener.AcceptSocket();
+
+
+ // now send some data and see if it comes out the other end
+ const int len = 1024;
+ byte[] outBuf = new Byte[len];
+ for (int i=0; i<len; i++)
+ {
+ outBuf[i] = (byte)(i % 256);
+ }
+
+ outSock.Send(outBuf, 0, len, 0);
+
+ byte[] inBuf = new Byte[len];
+ int ret = inSock.Receive(inBuf, 0, len, 0);
+
+
+ // let's see if it arrived OK
+ Assert(ret != 0);
+ for (int i=0; i<len; i++)
+ {
+ Assert(inBuf[i] == outBuf[i]);
+ }
+
+
+ // tidy up after ourselves
+ inSock.Close();
+
+ inListener.Stop();
+ }
+
+
+ }
+
+}
diff --git a/mcs/class/System/Test/System.Net/AllTests.cs b/mcs/class/System/Test/System.Net/AllTests.cs
new file mode 100644
index 00000000000..9b997e8a220
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/AllTests.cs
@@ -0,0 +1,30 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Net {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (IPAddressTest.Suite);
+ suite.AddTest (IPEndPointTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/Test/System.Net/ChangeLog b/mcs/class/System/Test/System.Net/ChangeLog
new file mode 100644
index 00000000000..48de8c30fc0
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/ChangeLog
@@ -0,0 +1,27 @@
+2002-04-24 Nick Drochak <ndrochak@gol.com>
+
+ * IPAddressTest.cs: Make test conform to MS behavior. Also, if wrong
+ exception is thrown, let eveyone know which one.
+
+2002-04-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddressTest.cs: use BitConverter to set localhost, catch
+ OverflowException in TestParseWrong() and changed some constants.
+
+2002-04-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AllTests.cs: added IPEndPointTest.
+ * IPEndPointTest.cs: added file (author: Lawrence Pit).
+ * IPAdressTest.cs: use Fail is expected exception are not raised.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddressTest.cs: use System.BitConverter.IsLittleEndian (suggested
+ by Paolo) instead of guessing the endianness.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ChangeLog:
+ * AllTests.cs:
+ * IPAddressTest.cs: added files.
+
diff --git a/mcs/class/System/Test/System.Net/DnsTest.cs b/mcs/class/System/Test/System.Net/DnsTest.cs
new file mode 100644
index 00000000000..0def350b05c
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/DnsTest.cs
@@ -0,0 +1,162 @@
+// DnsTest.cs - NUnit Test Cases for the System.Net.Dns class
+//
+// Author: Mads Pultz (mpultz@diku.dk)
+//
+// (C) Mads Pultz, 2001
+//
+// This test assumes the following:
+// 1) The following Internet sites exist:
+// www.go-mono.com with IP address 129.250.184.233
+// info.diku.dk with IP address 130.225.96.4
+// 2) The following DNS name does not exist:
+// www.hopefullydoesnotexist.dk
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Net.Sockets;
+using System.Threading;
+using System.Collections;
+
+namespace Ximian.Mono.Tests.System {
+
+public class DnsTest: TestCase {
+
+ private String site1Name = "www.go-mono.com",
+ site1Dot = "129.250.184.233",
+ site2Name = "info.diku.dk",
+ site2Dot = "130.225.96.4",
+ noneExistingSite = "www.hopefullydoesnotexist.dk";
+ private uint site1IP = 2180692201, site2IP = 2195808260; // Big-Endian
+
+ public DnsTest(): base("Ximian.Mono.Tests.System.Net.DnsTest testsuite") { }
+ public DnsTest(String name): base(name) { }
+
+ public static ITest Suite {
+ get { return new TestSuite(typeof(DnsTest)); }
+ }
+
+ private void Callback(IAsyncResult ar) {
+ IPHostEntry h;
+ h = Dns.EndGetHostByName(ar);
+ SubTestValidIPHostEntry(h);
+ }
+
+ public void TestAsyncGetHostByName(){
+ IAsyncResult r;
+ r = Dns.BeginGetHostByName(site1Name, new AsyncCallback(Callback), null);
+ }
+
+ public void TestAsyncResolve() {
+ IAsyncResult r;
+ r = Dns.BeginResolve(site1Name, new AsyncCallback(Callback), null);
+ }
+
+ public void TestGetHostName() {
+ string hostName = Dns.GetHostName();
+ Assert(hostName != null);
+ }
+
+ private void SubTestGetHostByName(string siteName, string siteDot) {
+ IPHostEntry h = Dns.GetHostByName(siteName);
+ SubTestValidIPHostEntry(h);
+ Assert(h.HostName.Equals(siteName));
+ Assert(h.AddressList[0].ToString() == siteDot);
+ }
+
+ public void TestGetHostByName() {
+ SubTestGetHostByName(site1Name, site1Dot);
+ SubTestGetHostByName(site2Name, site2Dot);
+ try {
+ Dns.GetHostByName(noneExistingSite);
+ Fail("Should raise a SocketException (assuming that '" + noneExistingSite + "' does not exist)");
+ } catch (SocketException) {
+ }
+ try {
+ Dns.GetHostByName(null);
+ Fail("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ }
+
+ private void SubTestGetHostByAddressStringFormatException(string addr) {
+ try {
+ Dns.GetHostByAddress(addr);
+ Fail("Should raise a FormatException");
+ } catch (FormatException) {
+ }
+ }
+
+ private void SubTestGetHostByAddressString(string addr) {
+ IPHostEntry h = Dns.GetHostByAddress(addr);
+ SubTestValidIPHostEntry(h);
+ }
+
+ public void TestGetHostByAddressString() {
+ try {
+ String addr = null;
+ Dns.GetHostByAddress(addr);
+ Fail("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ SubTestGetHostByAddressStringFormatException("123.255.23");
+ SubTestGetHostByAddressStringFormatException("123.256.34.10");
+ SubTestGetHostByAddressStringFormatException("not an IP address");
+ SubTestGetHostByAddressString(site1Dot);
+ SubTestGetHostByAddressString(site2Dot);
+ }
+
+ private void SubTestGetHostByAddressIPAddress(IPAddress addr) {
+ IPHostEntry h = Dns.GetHostByAddress(addr);
+ SubTestValidIPHostEntry(h);
+ Assert(h.AddressList[0].ToString() == addr.ToString());
+ }
+
+ public void TestGetHostByAddressIPAddress() {
+ try {
+ IPAddress addr = null;
+ Dns.GetHostByAddress(addr);
+ Fail("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ SubTestGetHostByAddressIPAddress(new IPAddress(IPAddress.NetworkToHostOrder((int)site1IP)));
+ SubTestGetHostByAddressIPAddress(new IPAddress(IPAddress.NetworkToHostOrder((int)site2IP)));
+ }
+
+ private void SubTestResolve(string addr) {
+ IPHostEntry h = Dns.Resolve(addr);
+ SubTestValidIPHostEntry(h);
+ }
+
+ public void TestResolve() {
+ SubTestResolve(site1Name);
+ SubTestResolve(site2Name);
+ SubTestResolve(site1Dot);
+ SubTestResolve(site2Dot);
+ }
+
+ private void SubTestValidIPHostEntry(IPHostEntry h) {
+ Assert(h.HostName != null);
+ Assert(h.AddressList != null);
+ Assert(h.AddressList.Length > 0);
+ }
+
+ private static void printIPHostEntry(IPHostEntry h)
+ {
+ Console.WriteLine("----------------------------------------------------");
+ Console.WriteLine("Host name:");
+ Console.WriteLine(h.HostName);
+ Console.WriteLine("IP addresses:");
+ IPAddress[] list = h.AddressList;
+ for(int i = 0; i < list.Length; ++i)
+ Console.WriteLine(list[i]);
+ Console.WriteLine("Aliases:");
+ string[] aliases = h.Aliases;
+ for(int i = 0; i < aliases.Length; ++i)
+ Console.WriteLine(aliases[i]);
+ Console.WriteLine("----------------------------------------------------");
+ }
+}
+
+}
diff --git a/mcs/class/System/Test/System.Net/IPAddressTest.cs b/mcs/class/System/Test/System.Net/IPAddressTest.cs
new file mode 100644
index 00000000000..2d3d92550f7
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/IPAddressTest.cs
@@ -0,0 +1,175 @@
+//
+// IPAddressTest.cs - NUnit Test Cases for System.Net.IPAddress
+//
+// Author:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Runtime.InteropServices;
+
+namespace MonoTests.System.Net
+{
+
+public class IPAddressTest : TestCase
+{
+ public IPAddressTest () :
+ base ("[MonoTests.System.Net.IPAddressTest]") {}
+
+ public IPAddressTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(IPAddressTest));
+ }
+ }
+
+ public void TestPublicFields ()
+ {
+ AssertEquals ("Any", IPAddress.Any.Address, (long) 0);
+ AssertEquals ("Broadcast", IPAddress.Broadcast.Address, (long) 0xFFFFFFFF);
+ long loopback = IPAddress.HostToNetworkOrder (BitConverter.IsLittleEndian ?
+ 0x7f000001 :
+ 0x0100007f);
+ AssertEquals ("Loopback", IPAddress.Loopback.Address, loopback);
+ AssertEquals ("None", IPAddress.None.Address, (long) 0xFFFFFFFF);
+ }
+
+ public void TestToString ()
+ {
+ IPAddress ip = IPAddress.Parse ("192.168.1.1");
+ AssertEquals ("ToString #1", "192.168.1.1", ip.ToString ());
+ AssertEquals ("ToString #2", "0.0.0.0", IPAddress.Any.ToString ());
+ AssertEquals ("ToString #3", "255.255.255.255", IPAddress.Broadcast.ToString ());
+ AssertEquals ("ToString #4", "127.0.0.1", IPAddress.Loopback.ToString ());
+ AssertEquals ("ToString #5", "255.255.255.255", IPAddress.None.ToString ());
+ }
+
+ public void TestParseOk ()
+ {
+ IPAddress ip = IPAddress.Parse ("192.168.1.1");
+ Assert ("Parse #1", ip.ToString () == "192.168.1.1");
+
+ ip = IPAddress.Parse ("0.0.0.0");
+ AssertEquals ("Parse #2", ip, IPAddress.Any);
+
+ ip = IPAddress.Parse ("255.255.255.255");
+ AssertEquals ("Parse #3", ip, IPAddress.Broadcast);
+ AssertEquals ("Parse #4", ip, IPAddress.None);
+
+ ip = IPAddress.Parse ("127.0.0.1");
+ AssertEquals ("Parse #5", IPAddress.IsLoopback (ip), true);
+
+ ip = IPAddress.Parse ("12.1.1.3 ");
+ AssertEquals ("Parse #6", IPAddress.Parse ("12.1.1.3"), ip);
+
+ // These have a strange behavior !?
+ ip = IPAddress.Parse (" 12.1.1.1");
+ AssertEquals ("Parse #7", IPAddress.Parse ("0.0.0.0"), ip);
+
+ ip = IPAddress.Parse ("12.1 .1.2");
+ AssertEquals ("Parse #8", IPAddress.Parse ("12.0.0.1"), ip);
+
+ ip = IPAddress.Parse (".1.1.6");
+ AssertEquals ("Parse #9", IPAddress.Parse ("0.1.1.6"), ip);
+
+ ip = IPAddress.Parse ("12.1.7");
+ AssertEquals ("Parse #10", IPAddress.Parse ("12.1.0.7"), ip);
+
+ ip = IPAddress.Parse ("12.1.8. ");
+ AssertEquals ("Parse #10", IPAddress.Parse ("12.1.8.0"), ip);
+ }
+
+ public void TestParseWrong ()
+ {
+ bool failure = false;
+ IPAddress ip = IPAddress.None;
+
+ failure = false;
+ try {
+ ip = IPAddress.Parse ("12.+1.1.4");
+ Fail("Should raise a FormatException #1");
+ } catch (FormatException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #1:" + e.ToString());
+ }
+
+
+ failure = false;
+ try {
+ ip = IPAddress.Parse ("12.1.-1.5");
+ Fail("Should raise a FormatException #2");
+ } catch (FormatException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #2:" + e.ToString());
+ }
+
+ failure = false;
+ try {
+ ip = IPAddress.Parse ("257.1.1.9");
+ Fail("Should raise a FormatException #3");
+ } catch (FormatException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #3:" + e.ToString());
+ }
+
+ failure = false;
+ try {
+ ip = IPAddress.Parse (null);
+ Fail("Should raise a ArgumentNullException #1");
+ } catch (ArgumentNullException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #4:" + e.ToString());
+ }
+ }
+
+ public void TestNetworkHost ()
+ {
+ long [] tested = new long [] { 0, 1, 1, 1};
+ long [] expectedLE = new long [] {0, 256, 16777216, 72057594037927936 };
+ long [] expected;
+
+ expected = BitConverter.IsLittleEndian ? expectedLE : tested;
+
+ short short0 = IPAddress.NetworkToHostOrder ((short) tested [0]);
+ AssertEquals ("NetworkToHostOrder #1", short0, (short) expected [0]);
+ short0 = IPAddress.HostToNetworkOrder (short0);
+ AssertEquals ("HostToNetworkOrder #1", short0, (short) tested [0]);
+
+ int int0 = IPAddress.NetworkToHostOrder ((int) tested [0]);
+ AssertEquals ("NetworkToHostOrder #2", int0, (int) expected [0]);
+ int0 = IPAddress.HostToNetworkOrder (int0);
+ AssertEquals ("HostToNetworkOrder #2", int0, (int) tested [0]);
+
+ long long0 = IPAddress.NetworkToHostOrder (tested [0]);
+ AssertEquals ("NetworkToHostOrder #3", long0, expected [0]);
+ long0 = IPAddress.HostToNetworkOrder (long0);
+ AssertEquals ("HostToNetworkOrder #3", long0, tested [0]);
+
+ short0 = IPAddress.NetworkToHostOrder ((short) tested [1]);
+ AssertEquals ("NetworkToHostOrder #4", short0, (short) expected [1]);
+ short0 = IPAddress.HostToNetworkOrder (short0);
+ AssertEquals ("HostToNetworkOrder #4", short0, (short) tested [1]);
+
+ int0 = IPAddress.NetworkToHostOrder ((int) tested [2]);
+ AssertEquals ("NetworkToHostOrder #5", int0, (int) expected [2]);
+ int0 = IPAddress.HostToNetworkOrder (int0);
+ AssertEquals ("HostToNetworkOrder #5", int0, (int) tested [2]);
+
+ long0 = IPAddress.NetworkToHostOrder (tested [3]);
+ AssertEquals ("NetworkToHostOrder #6", long0, expected [3]);
+ long0 = IPAddress.HostToNetworkOrder (long0);
+ AssertEquals ("HostToNetworkOrder #6", long0, tested [3]);
+ }
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Net/IPEndPointTest.cs b/mcs/class/System/Test/System.Net/IPEndPointTest.cs
new file mode 100644
index 00000000000..004fe04cd8c
--- /dev/null
+++ b/mcs/class/System/Test/System.Net/IPEndPointTest.cs
@@ -0,0 +1,134 @@
+//
+// IPEndPointTest.cs - NUnit Test Cases for System.Net.IPEndPoint
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Runtime.InteropServices;
+
+namespace MonoTests.System.Net
+{
+
+public class IPEndPointTest : TestCase
+{
+ private const int MyPort = 42;
+ private const int MyMaxPort = 65535;
+ private const int MyMinPort = 0;
+ private const string MyIPAddressString = "192.168.1.1";
+
+ private IPAddress ipAddress;
+ private long ip;
+ private IPEndPoint endPoint1;
+ private IPEndPoint endPoint2;
+
+ public IPEndPointTest () :
+ base ("[MonoTests.System.Net.IPEndPointTest]") {}
+
+ public IPEndPointTest (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ ipAddress = IPAddress.Parse (MyIPAddressString);
+ ip = ipAddress.Address;
+ endPoint1 = new IPEndPoint(ipAddress, MyPort);
+ endPoint2 = new IPEndPoint(ip, MyPort);
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite(typeof(IPEndPointTest));
+ }
+ }
+
+ public void TestPublicFields ()
+ {
+ AssertEquals ("MinPort", IPEndPoint.MinPort, MyMinPort);
+ AssertEquals ("MaxPort", IPEndPoint.MaxPort, MyMaxPort);
+ }
+
+ public void TestConstructors ()
+ {
+ try {
+ new IPEndPoint(null, 0);
+ Fail("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ try {
+ new IPEndPoint(ipAddress, MyMinPort - 1);
+ Fail("Should raise an ArgumentOutOfRangeException #1");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ new IPEndPoint(ipAddress, MyMaxPort + 1);
+ Fail("Should raise an ArgumentOutOfRangeException #2");
+ } catch (ArgumentOutOfRangeException) {
+ }
+
+ try {
+ new IPEndPoint(ip, MyMinPort -1);
+ Fail("Should raise an ArgumentOutOfRangeException #3");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ new IPEndPoint(ip, MyMaxPort + 1);
+ Fail("Should raise an ArgumentOutOfRangeException #4");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ }
+
+ public void TestPortProperty ()
+ {
+ try {
+ endPoint1.Port = MyMinPort - 1;
+ Fail("Should raise an ArgumentOutOfRangeException #1");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ endPoint1.Port = MyMaxPort + 1;
+ Fail("Should raise an ArgumentOutOfRangeException #2");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ }
+
+ public void TestCreateAndSerialize()
+ {
+ SocketAddress addr = endPoint1.Serialize();
+ EndPoint endPoint3 = endPoint2.Create(addr);
+ Assert("#1", endPoint1.Equals(endPoint3));
+
+ IPAddress ipAddress = IPAddress.Parse ("255.255.255.255");
+ IPEndPoint endPoint4 = new IPEndPoint(ipAddress, MyMaxPort);
+ addr = endPoint4.Serialize();
+ EndPoint endPoint5 = endPoint2.Create(addr);
+ Assert("#2", endPoint4.Equals(endPoint5));
+ AssertEquals("#3", endPoint5.ToString(), "255.255.255.255:" + MyMaxPort);
+ }
+
+ public void TestEquals ()
+ {
+ Assert("Equals", endPoint1.Equals(endPoint2));
+ Assert("Not Equals", !endPoint1.Equals(new IPEndPoint(ip, MyPort + 1)));
+ }
+
+ public void TestGetHashCode ()
+ {
+ AssertEquals(endPoint1.GetHashCode(), endPoint2.GetHashCode());
+ }
+
+ public void TestToString ()
+ {
+ AssertEquals("ToString #1", endPoint1.ToString(), MyIPAddressString + ":" + MyPort);
+ AssertEquals("ToString #2", endPoint2.ToString(), MyIPAddressString + ":" + MyPort);
+ }
+
+}
+
+}
+
diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/AllTests.cs b/mcs/class/System/Test/System.Text.RegularExpressions/AllTests.cs
new file mode 100644
index 00000000000..7368d6e4e29
--- /dev/null
+++ b/mcs/class/System/Test/System.Text.RegularExpressions/AllTests.cs
@@ -0,0 +1,26 @@
+//
+// assembly: System_test
+// namespace: MonoTests.System.Text.RegularExpressions
+// file: AllTests.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests.System.Text.RegularExpressions {
+
+ public class AllTests : TestCase {
+ public AllTests (string name) : base (name) { }
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (PerlTest.Suite);
+
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs b/mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs
new file mode 100644
index 00000000000..f74c8d17902
--- /dev/null
+++ b/mcs/class/System/Test/System.Text.RegularExpressions/PerlTest.cs
@@ -0,0 +1,40 @@
+//
+// assembly: System_test
+// namespace: MonoTests.System.Text.RegularExpressions
+// file: PerlTest.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System;
+using System.Text.RegularExpressions;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests.System.Text.RegularExpressions {
+
+ public class PerlTest : TestCase {
+ public static ITest Suite {
+ get { return new TestSuite (typeof (PerlTest)); }
+ }
+
+ public PerlTest () : this ("System.Text.RegularExpressions Perl testsuite") { }
+ public PerlTest (string name) : base (name) { }
+
+ public void TestTrials () {
+ foreach (RegexTrial trial in PerlTrials.trials) {
+ string actual = trial.Execute ();
+ if (actual != trial.Expected) {
+ Assertion.Fail (
+ trial.ToString () +
+ "Expected " + trial.Expected +
+ " but got " + actual
+ );
+ }
+ }
+ }
+
+ protected override void SetUp () { }
+ protected override void TearDown () { }
+ }
+}
diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs b/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs
new file mode 100644
index 00000000000..3b8e4664324
--- /dev/null
+++ b/mcs/class/System/Test/System.Text.RegularExpressions/PerlTrials.cs
@@ -0,0 +1,746 @@
+//
+// assembly: System_test
+// namespace: MonoTests.System.Text.RegularExpressions
+// file: PerlTrials.cs
+//
+// author: Dan Lewis (dlewis@gmx.co.uk)
+// (c) 2002
+
+using System.Text.RegularExpressions;
+
+namespace Ximian.Mono.Tests.System.Text.RegularExpressions {
+
+ class PerlTrials {
+ // ported from perl-5.6.1/t/op/re_tests
+
+ public static RegexTrial[] trials = new RegexTrial[] {
+ new RegexTrial (@"abc", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc", RegexOptions.None, "xbc", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.None, "axc", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.None, "abx", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.None, "xabcy", "Pass. Group[0]=(1,3)"),
+ new RegexTrial (@"abc", RegexOptions.None, "ababc", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"ab*c", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab*bc", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab*bc", RegexOptions.None, "abbc", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab*bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@".{1}", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@".{3,4}", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab{0,}bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab+bc", RegexOptions.None, "abbc", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab+bc", RegexOptions.None, "abc", "Fail."),
+ new RegexTrial (@"ab+bc", RegexOptions.None, "abq", "Fail."),
+ new RegexTrial (@"ab{1,}bc", RegexOptions.None, "abq", "Fail."),
+ new RegexTrial (@"ab+bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{1,}bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{1,3}bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{3,4}bc", RegexOptions.None, "abbbbc", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{4,5}bc", RegexOptions.None, "abbbbc", "Fail."),
+ new RegexTrial (@"ab?bc", RegexOptions.None, "abbc", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab?bc", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab{0,1}bc", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab?bc", RegexOptions.None, "abbbbc", "Fail."),
+ new RegexTrial (@"ab?c", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab{0,1}c", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.None, "abcc", "Fail."),
+ new RegexTrial (@"^abc", RegexOptions.None, "abcc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.None, "aabc", "Fail."),
+ new RegexTrial (@"abc$", RegexOptions.None, "aabc", "Pass. Group[0]=(1,3)"),
+ new RegexTrial (@"abc$", RegexOptions.None, "aabcd", "Fail."),
+ new RegexTrial (@"^", RegexOptions.None, "abc", "Pass. Group[0]=(0,0)"),
+ new RegexTrial (@"$", RegexOptions.None, "abc", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"a.c", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.c", RegexOptions.None, "axc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.*c", RegexOptions.None, "axyzc", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"a.*c", RegexOptions.None, "axyzd", "Fail."),
+ new RegexTrial (@"a[bc]d", RegexOptions.None, "abc", "Fail."),
+ new RegexTrial (@"a[bc]d", RegexOptions.None, "abd", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[b-d]e", RegexOptions.None, "abd", "Fail."),
+ new RegexTrial (@"a[b-d]e", RegexOptions.None, "ace", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[b-d]", RegexOptions.None, "aac", "Pass. Group[0]=(1,2)"),
+ new RegexTrial (@"a[-b]", RegexOptions.None, "a-", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[b-]", RegexOptions.None, "a-", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[b-a]", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a[]b", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a[", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a]", RegexOptions.None, "a]", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[]]b", RegexOptions.None, "a]b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^bc]d", RegexOptions.None, "aed", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^bc]d", RegexOptions.None, "abd", "Fail."),
+ new RegexTrial (@"a[^-b]c", RegexOptions.None, "adc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^-b]c", RegexOptions.None, "a-c", "Fail."),
+ new RegexTrial (@"a[^]b]c", RegexOptions.None, "a]c", "Fail."),
+ new RegexTrial (@"a[^]b]c", RegexOptions.None, "adc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"\ba\b", RegexOptions.None, "a-", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"\ba\b", RegexOptions.None, "-a", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"\ba\b", RegexOptions.None, "-a-", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"\by\b", RegexOptions.None, "xy", "Fail."),
+ new RegexTrial (@"\by\b", RegexOptions.None, "yz", "Fail."),
+ new RegexTrial (@"\by\b", RegexOptions.None, "xyz", "Fail."),
+ new RegexTrial (@"\Ba\B", RegexOptions.None, "a-", "Fail."),
+ new RegexTrial (@"\Ba\B", RegexOptions.None, "-a", "Fail."),
+ new RegexTrial (@"\Ba\B", RegexOptions.None, "-a-", "Fail."),
+ new RegexTrial (@"\By\b", RegexOptions.None, "xy", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"\by\B", RegexOptions.None, "yz", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"\By\B", RegexOptions.None, "xyz", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"\w", RegexOptions.None, "a", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"\w", RegexOptions.None, "-", "Fail."),
+ new RegexTrial (@"\W", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"\W", RegexOptions.None, "-", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"a\sb", RegexOptions.None, "a b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a\sb", RegexOptions.None, "a-b", "Fail."),
+ new RegexTrial (@"a\Sb", RegexOptions.None, "a b", "Fail."),
+ new RegexTrial (@"a\Sb", RegexOptions.None, "a-b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"\d", RegexOptions.None, "1", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"\d", RegexOptions.None, "-", "Fail."),
+ new RegexTrial (@"\D", RegexOptions.None, "1", "Fail."),
+ new RegexTrial (@"\D", RegexOptions.None, "-", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"[\w]", RegexOptions.None, "a", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"[\w]", RegexOptions.None, "-", "Fail."),
+ new RegexTrial (@"[\W]", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"[\W]", RegexOptions.None, "-", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"a[\s]b", RegexOptions.None, "a b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[\s]b", RegexOptions.None, "a-b", "Fail."),
+ new RegexTrial (@"a[\S]b", RegexOptions.None, "a b", "Fail."),
+ new RegexTrial (@"a[\S]b", RegexOptions.None, "a-b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"[\d]", RegexOptions.None, "1", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"[\d]", RegexOptions.None, "-", "Fail."),
+ new RegexTrial (@"[\D]", RegexOptions.None, "1", "Fail."),
+ new RegexTrial (@"[\D]", RegexOptions.None, "-", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"ab|cd", RegexOptions.None, "abc", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"ab|cd", RegexOptions.None, "abcd", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"()ef", RegexOptions.None, "def", "Pass. Group[0]=(1,2) Group[1]=(1,0)"),
+ new RegexTrial (@"*a", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"(*)b", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"$b", RegexOptions.None, "b", "Fail."),
+ new RegexTrial (@"a\", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a\(b", RegexOptions.None, "a(b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a\(*b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a\(*b", RegexOptions.None, "a((b", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"a\\b", RegexOptions.None, "a\\b", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc)", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"(abc", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"((a))", RegexOptions.None, "abc", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1)"),
+ new RegexTrial (@"(a)b(c)", RegexOptions.None, "abc", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)"),
+ new RegexTrial (@"a+b+c", RegexOptions.None, "aabbabc", "Pass. Group[0]=(4,3)"),
+ new RegexTrial (@"a{1,}b{1,}c", RegexOptions.None, "aabbabc", "Pass. Group[0]=(4,3)"),
+ new RegexTrial (@"a**", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a.+?c", RegexOptions.None, "abcabc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"(a+|b)*", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b){0,}", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b)+", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b){1,}", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b)?", RegexOptions.None, "ab", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"(a+|b){0,1}", RegexOptions.None, "ab", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@")(", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"[^ab]*", RegexOptions.None, "cde", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc", RegexOptions.None, "", "Fail."),
+ new RegexTrial (@"a*", RegexOptions.None, "", "Pass. Group[0]=(0,0)"),
+ new RegexTrial (@"([abc])*d", RegexOptions.None, "abbbcd", "Pass. Group[0]=(0,6) Group[1]=(0,1)(1,1)(2,1)(3,1)(4,1)"),
+ new RegexTrial (@"([abc])*bcd", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(0,1)"),
+ new RegexTrial (@"a|b|c|d|e", RegexOptions.None, "e", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(a|b|c|d|e)f", RegexOptions.None, "ef", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"abcd*efg", RegexOptions.None, "abcdefg", "Pass. Group[0]=(0,7)"),
+ new RegexTrial (@"ab*", RegexOptions.None, "xabyabbbz", "Pass. Group[0]=(1,2)"),
+ new RegexTrial (@"ab*", RegexOptions.None, "xayabbbz", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"(ab|cd)e", RegexOptions.None, "abcde", "Pass. Group[0]=(2,3) Group[1]=(2,2)"),
+ new RegexTrial (@"[abhgefdc]ij", RegexOptions.None, "hij", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^(ab|cd)e", RegexOptions.None, "abcde", "Fail."),
+ new RegexTrial (@"(abc|)ef", RegexOptions.None, "abcdef", "Pass. Group[0]=(4,2) Group[1]=(4,0)"),
+ new RegexTrial (@"(a|b)c*d", RegexOptions.None, "abcd", "Pass. Group[0]=(1,3) Group[1]=(1,1)"),
+ new RegexTrial (@"(ab|ab*)bc", RegexOptions.None, "abc", "Pass. Group[0]=(0,3) Group[1]=(0,1)"),
+ new RegexTrial (@"a([bc]*)c*", RegexOptions.None, "abc", "Pass. Group[0]=(0,3) Group[1]=(1,2)"),
+ new RegexTrial (@"a([bc]*)(c*d)", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)"),
+ new RegexTrial (@"a([bc]+)(c*d)", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)"),
+ new RegexTrial (@"a([bc]*)(c+d)", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,1) Group[2]=(2,2)"),
+ new RegexTrial (@"a[bcd]*dcdcde", RegexOptions.None, "adcdcde", "Pass. Group[0]=(0,7)"),
+ new RegexTrial (@"a[bcd]+dcdcde", RegexOptions.None, "adcdcde", "Fail."),
+ new RegexTrial (@"(ab|a)b*c", RegexOptions.None, "abc", "Pass. Group[0]=(0,3) Group[1]=(0,2)"),
+ new RegexTrial (@"((a)(b)c)(d)", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]=(0,1) Group[3]=(1,1) Group[4]=(3,1)"),
+ new RegexTrial (@"[a-zA-Z_][a-zA-Z0-9_]*", RegexOptions.None, "alpha", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"^a(bc+|b[eh])g|.h$", RegexOptions.None, "abh", "Pass. Group[0]=(1,2) Group[1]="),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.None, "effgz", "Pass. Group[0]=(0,5) Group[1]=(0,5) Group[2]="),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.None, "ij", "Pass. Group[0]=(0,2) Group[1]=(0,2) Group[2]=(1,1)"),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.None, "effg", "Fail."),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.None, "bcdd", "Fail."),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.None, "reffgz", "Pass. Group[0]=(1,5) Group[1]=(1,5) Group[2]="),
+ new RegexTrial (@"((((((((((a))))))))))", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"((((((((((a))))))))))\10", RegexOptions.None, "aa", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"((((((((((a))))))))))!", RegexOptions.None, "aa", "Fail."),
+ new RegexTrial (@"((((((((((a))))))))))!", RegexOptions.None, "a!", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"(((((((((a)))))))))", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1)"),
+ new RegexTrial (@"multiple words of text", RegexOptions.None, "uh-uh", "Fail."),
+ new RegexTrial (@"multiple words", RegexOptions.None, "multiple words, yeah", "Pass. Group[0]=(0,14)"),
+ new RegexTrial (@"(.*)c(.*)", RegexOptions.None, "abcde", "Pass. Group[0]=(0,5) Group[1]=(0,2) Group[2]=(3,2)"),
+ new RegexTrial (@"\((.*), (.*)\)", RegexOptions.None, "(a, b)", "Pass. Group[0]=(0,6) Group[1]=(1,1) Group[2]=(4,1)"),
+ new RegexTrial (@"[k]", RegexOptions.None, "ab", "Fail."),
+ new RegexTrial (@"abcd", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"a(bc)d", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]=(1,2)"),
+ new RegexTrial (@"a[-]?c", RegexOptions.None, "ac", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"(abc)\1", RegexOptions.None, "abcabc", "Pass. Group[0]=(0,6) Group[1]=(0,3)"),
+ new RegexTrial (@"([a-c]*)\1", RegexOptions.None, "abcabc", "Pass. Group[0]=(0,6) Group[1]=(0,3)"),
+ new RegexTrial (@"\1", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"\2", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"(a)|\1", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"(a)|\1", RegexOptions.None, "x", "Fail."),
+ new RegexTrial (@"(a)|\2", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"(([a-c])b*?\2)*", RegexOptions.None, "ababbbcbc", "Pass. Group[0]=(0,5) Group[1]=(0,3)(3,2) Group[2]=(0,1)(3,1)"),
+ new RegexTrial (@"(([a-c])b*?\2){3}", RegexOptions.None, "ababbbcbc", "Pass. Group[0]=(0,9) Group[1]=(0,3)(3,3)(6,3) Group[2]=(0,1)(3,1)(6,1)"),
+ new RegexTrial (@"((\3|b)\2(a)x)+", RegexOptions.None, "aaxabxbaxbbx", "Fail."),
+ new RegexTrial (@"((\3|b)\2(a)x)+", RegexOptions.None, "aaaxabaxbaaxbbax", "Pass. Group[0]=(12,4) Group[1]=(12,4) Group[2]=(12,1) Group[3]=(14,1)"),
+ new RegexTrial (@"((\3|b)\2(a)){2,}", RegexOptions.None, "bbaababbabaaaaabbaaaabba", "Pass. Group[0]=(15,9) Group[1]=(15,3)(18,3)(21,3) Group[2]=(15,1)(18,1)(21,1) Group[3]=(17,1)(20,1)(23,1)"),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "XBC", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "AXC", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "ABX", "Fail."),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "XABCY", "Pass. Group[0]=(1,3)"),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "ABABC", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"ab*c", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab*bc", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab*bc", RegexOptions.IgnoreCase, "ABBC", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab*?bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{0,}?bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab+?bc", RegexOptions.IgnoreCase, "ABBC", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab+bc", RegexOptions.IgnoreCase, "ABC", "Fail."),
+ new RegexTrial (@"ab+bc", RegexOptions.IgnoreCase, "ABQ", "Fail."),
+ new RegexTrial (@"ab{1,}bc", RegexOptions.IgnoreCase, "ABQ", "Fail."),
+ new RegexTrial (@"ab+bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{1,}?bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{1,3}?bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{3,4}?bc", RegexOptions.IgnoreCase, "ABBBBC", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"ab{4,5}?bc", RegexOptions.IgnoreCase, "ABBBBC", "Fail."),
+ new RegexTrial (@"ab??bc", RegexOptions.IgnoreCase, "ABBC", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"ab??bc", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab{0,1}?bc", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab??bc", RegexOptions.IgnoreCase, "ABBBBC", "Fail."),
+ new RegexTrial (@"ab??c", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab{0,1}?c", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.IgnoreCase, "ABCC", "Fail."),
+ new RegexTrial (@"^abc", RegexOptions.IgnoreCase, "ABCC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^abc$", RegexOptions.IgnoreCase, "AABC", "Fail."),
+ new RegexTrial (@"abc$", RegexOptions.IgnoreCase, "AABC", "Pass. Group[0]=(1,3)"),
+ new RegexTrial (@"^", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,0)"),
+ new RegexTrial (@"$", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"a.c", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.c", RegexOptions.IgnoreCase, "AXC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.*?c", RegexOptions.IgnoreCase, "AXYZC", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"a.*c", RegexOptions.IgnoreCase, "AXYZD", "Fail."),
+ new RegexTrial (@"a[bc]d", RegexOptions.IgnoreCase, "ABC", "Fail."),
+ new RegexTrial (@"a[bc]d", RegexOptions.IgnoreCase, "ABD", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[b-d]e", RegexOptions.IgnoreCase, "ABD", "Fail."),
+ new RegexTrial (@"a[b-d]e", RegexOptions.IgnoreCase, "ACE", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[b-d]", RegexOptions.IgnoreCase, "AAC", "Pass. Group[0]=(1,2)"),
+ new RegexTrial (@"a[-b]", RegexOptions.IgnoreCase, "A-", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[b-]", RegexOptions.IgnoreCase, "A-", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[b-a]", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"a[]b", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"a[", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"a]", RegexOptions.IgnoreCase, "A]", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a[]]b", RegexOptions.IgnoreCase, "A]B", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^bc]d", RegexOptions.IgnoreCase, "AED", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^bc]d", RegexOptions.IgnoreCase, "ABD", "Fail."),
+ new RegexTrial (@"a[^-b]c", RegexOptions.IgnoreCase, "ADC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a[^-b]c", RegexOptions.IgnoreCase, "A-C", "Fail."),
+ new RegexTrial (@"a[^]b]c", RegexOptions.IgnoreCase, "A]C", "Fail."),
+ new RegexTrial (@"a[^]b]c", RegexOptions.IgnoreCase, "ADC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"ab|cd", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"ab|cd", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"()ef", RegexOptions.IgnoreCase, "DEF", "Pass. Group[0]=(1,2) Group[1]=(1,0)"),
+ new RegexTrial (@"*a", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"(*)b", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"$b", RegexOptions.IgnoreCase, "B", "Fail."),
+ new RegexTrial (@"a\", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"a\(b", RegexOptions.IgnoreCase, "A(B", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a\(*b", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"a\(*b", RegexOptions.IgnoreCase, "A((B", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"a\\b", RegexOptions.IgnoreCase, "A\\B", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc)", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"(abc", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"((a))", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1)"),
+ new RegexTrial (@"(a)b(c)", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(2,1)"),
+ new RegexTrial (@"a+b+c", RegexOptions.IgnoreCase, "AABBABC", "Pass. Group[0]=(4,3)"),
+ new RegexTrial (@"a{1,}b{1,}c", RegexOptions.IgnoreCase, "AABBABC", "Pass. Group[0]=(4,3)"),
+ new RegexTrial (@"a**", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"a.+?c", RegexOptions.IgnoreCase, "ABCABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.*?c", RegexOptions.IgnoreCase, "ABCABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"a.{0,5}?c", RegexOptions.IgnoreCase, "ABCABC", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"(a+|b)*", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b){0,}", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b)+", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b){1,}", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)(1,1)"),
+ new RegexTrial (@"(a+|b)?", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"(a+|b){0,1}", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"(a+|b){0,1}?", RegexOptions.IgnoreCase, "AB", "Pass. Group[0]=(0,0) Group[1]="),
+ new RegexTrial (@")(", RegexOptions.IgnoreCase, "-", "Error."),
+ new RegexTrial (@"[^ab]*", RegexOptions.IgnoreCase, "CDE", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abc", RegexOptions.IgnoreCase, "", "Fail."),
+ new RegexTrial (@"a*", RegexOptions.IgnoreCase, "", "Pass. Group[0]=(0,0)"),
+ new RegexTrial (@"([abc])*d", RegexOptions.IgnoreCase, "ABBBCD", "Pass. Group[0]=(0,6) Group[1]=(0,1)(1,1)(2,1)(3,1)(4,1)"),
+ new RegexTrial (@"([abc])*bcd", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(0,1)"),
+ new RegexTrial (@"a|b|c|d|e", RegexOptions.IgnoreCase, "E", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(a|b|c|d|e)f", RegexOptions.IgnoreCase, "EF", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"abcd*efg", RegexOptions.IgnoreCase, "ABCDEFG", "Pass. Group[0]=(0,7)"),
+ new RegexTrial (@"ab*", RegexOptions.IgnoreCase, "XABYABBBZ", "Pass. Group[0]=(1,2)"),
+ new RegexTrial (@"ab*", RegexOptions.IgnoreCase, "XAYABBBZ", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"(ab|cd)e", RegexOptions.IgnoreCase, "ABCDE", "Pass. Group[0]=(2,3) Group[1]=(2,2)"),
+ new RegexTrial (@"[abhgefdc]ij", RegexOptions.IgnoreCase, "HIJ", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"^(ab|cd)e", RegexOptions.IgnoreCase, "ABCDE", "Fail."),
+ new RegexTrial (@"(abc|)ef", RegexOptions.IgnoreCase, "ABCDEF", "Pass. Group[0]=(4,2) Group[1]=(4,0)"),
+ new RegexTrial (@"(a|b)c*d", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(1,3) Group[1]=(1,1)"),
+ new RegexTrial (@"(ab|ab*)bc", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(0,1)"),
+ new RegexTrial (@"a([bc]*)c*", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(1,2)"),
+ new RegexTrial (@"a([bc]*)(c*d)", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)"),
+ new RegexTrial (@"a([bc]+)(c*d)", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,2) Group[2]=(3,1)"),
+ new RegexTrial (@"a([bc]*)(c+d)", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,1) Group[2]=(2,2)"),
+ new RegexTrial (@"a[bcd]*dcdcde", RegexOptions.IgnoreCase, "ADCDCDE", "Pass. Group[0]=(0,7)"),
+ new RegexTrial (@"a[bcd]+dcdcde", RegexOptions.IgnoreCase, "ADCDCDE", "Fail."),
+ new RegexTrial (@"(ab|a)b*c", RegexOptions.IgnoreCase, "ABC", "Pass. Group[0]=(0,3) Group[1]=(0,2)"),
+ new RegexTrial (@"((a)(b)c)(d)", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]=(0,1) Group[3]=(1,1) Group[4]=(3,1)"),
+ new RegexTrial (@"[a-zA-Z_][a-zA-Z0-9_]*", RegexOptions.IgnoreCase, "ALPHA", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"^a(bc+|b[eh])g|.h$", RegexOptions.IgnoreCase, "ABH", "Pass. Group[0]=(1,2) Group[1]="),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.IgnoreCase, "EFFGZ", "Pass. Group[0]=(0,5) Group[1]=(0,5) Group[2]="),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.IgnoreCase, "IJ", "Pass. Group[0]=(0,2) Group[1]=(0,2) Group[2]=(1,1)"),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.IgnoreCase, "EFFG", "Fail."),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.IgnoreCase, "BCDD", "Fail."),
+ new RegexTrial (@"(bc+d$|ef*g.|h?i(j|k))", RegexOptions.IgnoreCase, "REFFGZ", "Pass. Group[0]=(1,5) Group[1]=(1,5) Group[2]="),
+ new RegexTrial (@"((((((((((a))))))))))", RegexOptions.IgnoreCase, "A", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"((((((((((a))))))))))\10", RegexOptions.IgnoreCase, "AA", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"((((((((((a))))))))))!", RegexOptions.IgnoreCase, "AA", "Fail."),
+ new RegexTrial (@"((((((((((a))))))))))!", RegexOptions.IgnoreCase, "A!", "Pass. Group[0]=(0,2) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1) Group[10]=(0,1)"),
+ new RegexTrial (@"(((((((((a)))))))))", RegexOptions.IgnoreCase, "A", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]=(0,1) Group[3]=(0,1) Group[4]=(0,1) Group[5]=(0,1) Group[6]=(0,1) Group[7]=(0,1) Group[8]=(0,1) Group[9]=(0,1)"),
+ new RegexTrial (@"(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))", RegexOptions.IgnoreCase, "A", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))", RegexOptions.IgnoreCase, "C", "Pass. Group[0]=(0,1) Group[1]=(0,1)"),
+ new RegexTrial (@"multiple words of text", RegexOptions.IgnoreCase, "UH-UH", "Fail."),
+ new RegexTrial (@"multiple words", RegexOptions.IgnoreCase, "MULTIPLE WORDS, YEAH", "Pass. Group[0]=(0,14)"),
+ new RegexTrial (@"(.*)c(.*)", RegexOptions.IgnoreCase, "ABCDE", "Pass. Group[0]=(0,5) Group[1]=(0,2) Group[2]=(3,2)"),
+ new RegexTrial (@"\((.*), (.*)\)", RegexOptions.IgnoreCase, "(A, B)", "Pass. Group[0]=(0,6) Group[1]=(1,1) Group[2]=(4,1)"),
+ new RegexTrial (@"[k]", RegexOptions.IgnoreCase, "AB", "Fail."),
+ new RegexTrial (@"abcd", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"a(bc)d", RegexOptions.IgnoreCase, "ABCD", "Pass. Group[0]=(0,4) Group[1]=(1,2)"),
+ new RegexTrial (@"a[-]?c", RegexOptions.IgnoreCase, "AC", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"(abc)\1", RegexOptions.IgnoreCase, "ABCABC", "Pass. Group[0]=(0,6) Group[1]=(0,3)"),
+ new RegexTrial (@"([a-c]*)\1", RegexOptions.IgnoreCase, "ABCABC", "Pass. Group[0]=(0,6) Group[1]=(0,3)"),
+ new RegexTrial (@"a(?!b).", RegexOptions.None, "abad", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"a(?=d).", RegexOptions.None, "abad", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"a(?=c|d).", RegexOptions.None, "abad", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"a(?:b|c|d)(.)", RegexOptions.None, "ace", "Pass. Group[0]=(0,3) Group[1]=(2,1)"),
+ new RegexTrial (@"a(?:b|c|d)*(.)", RegexOptions.None, "ace", "Pass. Group[0]=(0,3) Group[1]=(2,1)"),
+ new RegexTrial (@"a(?:b|c|d)+?(.)", RegexOptions.None, "ace", "Pass. Group[0]=(0,3) Group[1]=(2,1)"),
+ new RegexTrial (@"a(?:b|c|d)+?(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,3) Group[1]=(2,1)"),
+ new RegexTrial (@"a(?:b|c|d)+(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)"),
+ new RegexTrial (@"a(?:b|c|d){2}(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,4) Group[1]=(3,1)"),
+ new RegexTrial (@"a(?:b|c|d){4,5}(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,7) Group[1]=(6,1)"),
+ new RegexTrial (@"a(?:b|c|d){4,5}?(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,6) Group[1]=(5,1)"),
+ new RegexTrial (@"((foo)|(bar))*", RegexOptions.None, "foobar", "Pass. Group[0]=(0,6) Group[1]=(0,3)(3,3) Group[2]=(0,3) Group[3]=(3,3)"),
+ new RegexTrial (@":(?:", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"a(?:b|c|d){6,7}(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)"),
+ new RegexTrial (@"a(?:b|c|d){6,7}?(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)"),
+ new RegexTrial (@"a(?:b|c|d){5,6}(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)"),
+ new RegexTrial (@"a(?:b|c|d){5,6}?(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,7) Group[1]=(6,1)"),
+ new RegexTrial (@"a(?:b|c|d){5,7}(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,8) Group[1]=(7,1)"),
+ new RegexTrial (@"a(?:b|c|d){5,7}?(.)", RegexOptions.None, "acdbcdbe", "Pass. Group[0]=(0,7) Group[1]=(6,1)"),
+ new RegexTrial (@"a(?:b|(c|e){1,2}?|d)+?(.)", RegexOptions.None, "ace", "Pass. Group[0]=(0,3) Group[1]=(1,1) Group[2]=(2,1)"),
+ new RegexTrial (@"^(.+)?B", RegexOptions.None, "AB", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"^([^a-z])|(\^)$", RegexOptions.None, ".", "Pass. Group[0]=(0,1) Group[1]=(0,1) Group[2]="),
+ new RegexTrial (@"^[<>]&", RegexOptions.None, "<&OUT", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"^(a\1?){4}$", RegexOptions.None, "aaaaaaaaaa", "Pass. Group[0]=(0,10) Group[1]=(0,1)(1,2)(3,3)(6,4)"),
+ new RegexTrial (@"^(a\1?){4}$", RegexOptions.None, "aaaaaaaaa", "Fail."),
+ new RegexTrial (@"^(a\1?){4}$", RegexOptions.None, "aaaaaaaaaaa", "Fail."),
+ new RegexTrial (@"^(a(?(1)\1)){4}$", RegexOptions.None, "aaaaaaaaaa", "Pass. Group[0]=(0,10) Group[1]=(0,1)(1,2)(3,3)(6,4)"),
+ new RegexTrial (@"^(a(?(1)\1)){4}$", RegexOptions.None, "aaaaaaaaa", "Fail."),
+ new RegexTrial (@"^(a(?(1)\1)){4}$", RegexOptions.None, "aaaaaaaaaaa", "Fail."),
+ new RegexTrial (@"((a{4})+)", RegexOptions.None, "aaaaaaaaa", "Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4)"),
+ new RegexTrial (@"(((aa){2})+)", RegexOptions.None, "aaaaaaaaaa", "Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4) Group[3]=(0,2)(2,2)(4,2)(6,2)"),
+ new RegexTrial (@"(((a{2}){2})+)", RegexOptions.None, "aaaaaaaaaa", "Pass. Group[0]=(0,8) Group[1]=(0,8) Group[2]=(0,4)(4,4) Group[3]=(0,2)(2,2)(4,2)(6,2)"),
+ new RegexTrial (@"(?:(f)(o)(o)|(b)(a)(r))*", RegexOptions.None, "foobar", "Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(1,1) Group[3]=(2,1) Group[4]=(3,1) Group[5]=(4,1) Group[6]=(5,1)"),
+ new RegexTrial (@"(?<=a)b", RegexOptions.None, "ab", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"(?<=a)b", RegexOptions.None, "cb", "Fail."),
+ new RegexTrial (@"(?<=a)b", RegexOptions.None, "b", "Fail."),
+ new RegexTrial (@"(?<!c)b", RegexOptions.None, "ab", "Pass. Group[0]=(1,1)"),
+ new RegexTrial (@"(?<!c)b", RegexOptions.None, "cb", "Fail."),
+ new RegexTrial (@"(?<!c)b", RegexOptions.None, "b", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(?<!c)b", RegexOptions.None, "b", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(?<%)b", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"(?:..)*a", RegexOptions.None, "aba", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"(?:..)*?a", RegexOptions.None, "aba", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"^(?:b|a(?=(.)))*\1", RegexOptions.None, "abc", "Pass. Group[0]=(0,2) Group[1]=(1,1)"),
+ new RegexTrial (@"^(){3,5}", RegexOptions.None, "abc", "Pass. Group[0]=(0,0) Group[1]=(0,0)(0,0)(0,0)"),
+ new RegexTrial (@"^(a+)*ax", RegexOptions.None, "aax", "Pass. Group[0]=(0,3) Group[1]=(0,1)"),
+ new RegexTrial (@"^((a|b)+)*ax", RegexOptions.None, "aax", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(0,1)"),
+ new RegexTrial (@"^((a|bc)+)*ax", RegexOptions.None, "aax", "Pass. Group[0]=(0,3) Group[1]=(0,1) Group[2]=(0,1)"),
+ new RegexTrial (@"(a|x)*ab", RegexOptions.None, "cab", "Pass. Group[0]=(1,2) Group[1]="),
+ new RegexTrial (@"(a)*ab", RegexOptions.None, "cab", "Pass. Group[0]=(1,2) Group[1]="),
+ new RegexTrial (@"(?:(?i)a)b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?i)a)b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?i)a)b", RegexOptions.None, "Ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?i)a)b", RegexOptions.None, "Ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?i)a)b", RegexOptions.None, "aB", "Fail."),
+ new RegexTrial (@"((?i)a)b", RegexOptions.None, "aB", "Fail."),
+ new RegexTrial (@"(?i:a)b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?i:a))b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?i:a)b", RegexOptions.None, "Ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?i:a))b", RegexOptions.None, "Ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?i:a)b", RegexOptions.None, "aB", "Fail."),
+ new RegexTrial (@"((?i:a))b", RegexOptions.None, "aB", "Fail."),
+ new RegexTrial (@"(?:(?-i)a)b", RegexOptions.IgnoreCase, "ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i)a)b", RegexOptions.IgnoreCase, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?-i)a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i)a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?-i)a)b", RegexOptions.IgnoreCase, "Ab", "Fail."),
+ new RegexTrial (@"((?-i)a)b", RegexOptions.IgnoreCase, "Ab", "Fail."),
+ new RegexTrial (@"(?:(?-i)a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i)a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?:(?-i)a)b", RegexOptions.IgnoreCase, "AB", "Fail."),
+ new RegexTrial (@"((?-i)a)b", RegexOptions.IgnoreCase, "AB", "Fail."),
+ new RegexTrial (@"(?-i:a)b", RegexOptions.IgnoreCase, "ab", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i:a))b", RegexOptions.IgnoreCase, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?-i:a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i:a))b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?-i:a)b", RegexOptions.IgnoreCase, "Ab", "Fail."),
+ new RegexTrial (@"((?-i:a))b", RegexOptions.IgnoreCase, "Ab", "Fail."),
+ new RegexTrial (@"(?-i:a)b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"((?-i:a))b", RegexOptions.IgnoreCase, "aB", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"(?-i:a)b", RegexOptions.IgnoreCase, "AB", "Fail."),
+ new RegexTrial (@"((?-i:a))b", RegexOptions.IgnoreCase, "AB", "Fail."),
+ new RegexTrial (@"((?-i:a.))b", RegexOptions.IgnoreCase, "a\nB", "Fail."),
+ new RegexTrial (@"((?s-i:a.))b", RegexOptions.IgnoreCase, "a\nB", "Pass. Group[0]=(0,3) Group[1]=(0,2)"),
+ new RegexTrial (@"((?s-i:a.))b", RegexOptions.IgnoreCase, "B\nB", "Fail."),
+ new RegexTrial (@"(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))", RegexOptions.None, "cabbbb", "Pass. Group[0]=(0,6)"),
+ new RegexTrial (@"(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))", RegexOptions.None, "caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "Pass. Group[0]=(0,41)"),
+ new RegexTrial (@"(ab)\d\1", RegexOptions.IgnoreCase, "Ab4ab", "Pass. Group[0]=(0,5) Group[1]=(0,2)"),
+ new RegexTrial (@"(ab)\d\1", RegexOptions.IgnoreCase, "ab4Ab", "Pass. Group[0]=(0,5) Group[1]=(0,2)"),
+ new RegexTrial (@"foo\w*\d{4}baz", RegexOptions.None, "foobar1234baz", "Pass. Group[0]=(0,13)"),
+ new RegexTrial (@"x(~~)*(?:(?:F)?)?", RegexOptions.None, "x~~", "Pass. Group[0]=(0,3) Group[1]=(1,2)"),
+ new RegexTrial (@"^a(?#xxx){3}c", RegexOptions.None, "aaac", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"(?<![cd])b", RegexOptions.None, "dbcb", "Fail."),
+ new RegexTrial (@"(?<![cd])[ab]", RegexOptions.None, "dbaacb", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"(?<!(c|d))b", RegexOptions.None, "dbcb", "Fail."),
+ new RegexTrial (@"(?<!(c|d))[ab]", RegexOptions.None, "dbaacb", "Pass. Group[0]=(2,1) Group[1]="),
+ new RegexTrial (@"(?<!cd)[ab]", RegexOptions.None, "cdaccb", "Pass. Group[0]=(5,1)"),
+ new RegexTrial (@"^(?:a?b?)*$", RegexOptions.None, "a--", "Fail."),
+ new RegexTrial (@"((?s)^a(.))((?m)^b$)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(0,3) Group[1]=(0,2) Group[2]=(1,1) Group[3]=(2,1)"),
+ new RegexTrial (@"((?m)^b$)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(2,1) Group[1]=(2,1)"),
+ new RegexTrial (@"(?m)^b", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"(?m)^(b)", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(2,1) Group[1]=(2,1)"),
+ new RegexTrial (@"((?m)^b)", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(2,1) Group[1]=(2,1)"),
+ new RegexTrial (@"\n((?m)^b)", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(1,2) Group[1]=(2,1)"),
+ new RegexTrial (@"((?s).)c(?!.)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(3,2) Group[1]=(3,1)"),
+ new RegexTrial (@"((?s).)c(?!.)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(3,2) Group[1]=(3,1)"),
+ new RegexTrial (@"((?s)b.)c(?!.)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(2,3) Group[1]=(2,2)"),
+ new RegexTrial (@"((?s)b.)c(?!.)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(2,3) Group[1]=(2,2)"),
+ new RegexTrial (@"^b", RegexOptions.None, "a\nb\nc\n", "Fail."),
+ new RegexTrial (@"()^b", RegexOptions.None, "a\nb\nc\n", "Fail."),
+ new RegexTrial (@"((?m)^b)", RegexOptions.None, "a\nb\nc\n", "Pass. Group[0]=(2,1) Group[1]=(2,1)"),
+ new RegexTrial (@"(x)?(?(1)a|b)", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"(x)?(?(1)b|a)", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]="),
+ new RegexTrial (@"()?(?(1)b|a)", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]="),
+ new RegexTrial (@"()(?(1)b|a)", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"()?(?(1)a|b)", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]=(0,0)"),
+ new RegexTrial (@"^(\()?blah(?(1)(\)))$", RegexOptions.None, "(blah)", "Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(5,1)"),
+ new RegexTrial (@"^(\()?blah(?(1)(\)))$", RegexOptions.None, "blah", "Pass. Group[0]=(0,4) Group[1]= Group[2]="),
+ new RegexTrial (@"^(\()?blah(?(1)(\)))$", RegexOptions.None, "blah)", "Fail."),
+ new RegexTrial (@"^(\()?blah(?(1)(\)))$", RegexOptions.None, "(blah", "Fail."),
+ new RegexTrial (@"^(\(+)?blah(?(1)(\)))$", RegexOptions.None, "(blah)", "Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(5,1)"),
+ new RegexTrial (@"^(\(+)?blah(?(1)(\)))$", RegexOptions.None, "blah", "Pass. Group[0]=(0,4) Group[1]= Group[2]="),
+ new RegexTrial (@"^(\(+)?blah(?(1)(\)))$", RegexOptions.None, "blah)", "Fail."),
+ new RegexTrial (@"^(\(+)?blah(?(1)(\)))$", RegexOptions.None, "(blah", "Fail."),
+ new RegexTrial (@"(?(1)a|b|c)", RegexOptions.None, "a", "Error."),
+ new RegexTrial (@"(?(?!a)a|b)", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"(?(?!a)b|a)", RegexOptions.None, "a", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(?(?=a)b|a)", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"(?(?=a)a|b)", RegexOptions.None, "a", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"(?=(a+?))(\1ab)", RegexOptions.None, "aaab", "Pass. Group[0]=(1,3) Group[1]=(1,1) Group[2]=(1,3)"),
+ new RegexTrial (@"^(?=(a+?))\1ab", RegexOptions.None, "aaab", "Fail."),
+ new RegexTrial (@"(\w+:)+", RegexOptions.None, "one:", "Pass. Group[0]=(0,4) Group[1]=(0,4)"),
+ new RegexTrial (@"$(?<=^(a))", RegexOptions.None, "a", "Pass. Group[0]=(1,0) Group[1]=(0,1)"),
+ new RegexTrial (@"(?=(a+?))(\1ab)", RegexOptions.None, "aaab", "Pass. Group[0]=(1,3) Group[1]=(1,1) Group[2]=(1,3)"),
+ new RegexTrial (@"^(?=(a+?))\1ab", RegexOptions.None, "aaab", "Fail."),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "abcd:", "Fail."),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]= Group[2]=(0,4)"),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "xy:z:::abcd", "Pass. Group[0]=(0,11) Group[1]=(0,7) Group[2]=(7,4)"),
+ new RegexTrial (@"^[^bcd]*(c+)", RegexOptions.None, "aexycd", "Pass. Group[0]=(0,5) Group[1]=(4,1)"),
+ new RegexTrial (@"(a*)b+", RegexOptions.None, "caab", "Pass. Group[0]=(1,3) Group[1]=(1,2)"),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "abcd:", "Fail."),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "abcd", "Pass. Group[0]=(0,4) Group[1]= Group[2]=(0,4)"),
+ new RegexTrial (@"([\w:]+::)?(\w+)$", RegexOptions.None, "xy:z:::abcd", "Pass. Group[0]=(0,11) Group[1]=(0,7) Group[2]=(7,4)"),
+ new RegexTrial (@"^[^bcd]*(c+)", RegexOptions.None, "aexycd", "Pass. Group[0]=(0,5) Group[1]=(4,1)"),
+ new RegexTrial (@"(>a+)ab", RegexOptions.None, "aaab", "Fail."),
+ new RegexTrial (@"(?>a+)b", RegexOptions.None, "aaab", "Pass. Group[0]=(0,4)"),
+ new RegexTrial (@"([[:]+)", RegexOptions.None, "a:[b]:", "Pass. Group[0]=(1,2) Group[1]=(1,2)"),
+ new RegexTrial (@"([[=]+)", RegexOptions.None, "a=[b]=", "Pass. Group[0]=(1,2) Group[1]=(1,2)"),
+ new RegexTrial (@"([[.]+)", RegexOptions.None, "a.[b].", "Pass. Group[0]=(1,2) Group[1]=(1,2)"),
+ new RegexTrial (@"[a[:]b[:c]", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"[a[:]b[:c]", RegexOptions.None, "abc", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"((?>a+)b)", RegexOptions.None, "aaab", "Pass. Group[0]=(0,4) Group[1]=(0,4)"),
+ new RegexTrial (@"(?>(a+))b", RegexOptions.None, "aaab", "Pass. Group[0]=(0,4) Group[1]=(0,3)"),
+ new RegexTrial (@"((?>[^()]+)|\([^()]*\))+", RegexOptions.None, "((abc(ade)ufh()()x", "Pass. Group[0]=(2,16) Group[1]=(2,3)(5,5)(10,3)(13,2)(15,2)(17,1)"),
+ new RegexTrial (@"(?<=x+)", RegexOptions.None, "xxxxy", "Pass. Group[0]=(1,0)"),
+ new RegexTrial (@"a{37,17}", RegexOptions.None, "-", "Error."),
+ new RegexTrial (@"\Z", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(4,0)"),
+ new RegexTrial (@"$", RegexOptions.None, "a\nb\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\Z", RegexOptions.None, "b\na\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.None, "b\na\n", "Pass. Group[0]=(4,0)"),
+ new RegexTrial (@"$", RegexOptions.None, "b\na\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\Z", RegexOptions.None, "b\na", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.None, "b\na", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"$", RegexOptions.None, "b\na", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\Z", RegexOptions.Multiline, "a\nb\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.Multiline, "a\nb\n", "Pass. Group[0]=(4,0)"),
+ new RegexTrial (@"$", RegexOptions.Multiline, "a\nb\n", "Pass. Group[0]=(1,0)"),
+ new RegexTrial (@"\Z", RegexOptions.Multiline, "b\na\n", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.Multiline, "b\na\n", "Pass. Group[0]=(4,0)"),
+ new RegexTrial (@"$", RegexOptions.Multiline, "b\na\n", "Pass. Group[0]=(1,0)"),
+ new RegexTrial (@"\Z", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"\z", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(3,0)"),
+ new RegexTrial (@"$", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(1,0)"),
+ new RegexTrial (@"a\Z", RegexOptions.None, "a\nb\n", "Fail."),
+ new RegexTrial (@"a\z", RegexOptions.None, "a\nb\n", "Fail."),
+ new RegexTrial (@"a$", RegexOptions.None, "a\nb\n", "Fail."),
+ new RegexTrial (@"a\Z", RegexOptions.None, "b\na\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\z", RegexOptions.None, "b\na\n", "Fail."),
+ new RegexTrial (@"a$", RegexOptions.None, "b\na\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\Z", RegexOptions.None, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\z", RegexOptions.None, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a$", RegexOptions.None, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\z", RegexOptions.Multiline, "a\nb\n", "Fail."),
+ new RegexTrial (@"a$", RegexOptions.Multiline, "a\nb\n", "Pass. Group[0]=(0,1)"),
+ new RegexTrial (@"a\Z", RegexOptions.Multiline, "b\na\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\z", RegexOptions.Multiline, "b\na\n", "Fail."),
+ new RegexTrial (@"a$", RegexOptions.Multiline, "b\na\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\Z", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a\z", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"a$", RegexOptions.Multiline, "b\na", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "aa\nb\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "aa\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "aa\nb\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\naa\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\naa\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\naa\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "aa\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "aa\nb\n", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\naa\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\naa\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\naa\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\naa", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"aa\Z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"aa\z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"aa$", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "ab\nb\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "ab\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "ab\nb\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nab\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nab\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nab\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "ab\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "ab\nb\n", "Pass. Group[0]=(0,2)"),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nab\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nab\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nab\n", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nab", "Pass. Group[0]=(2,2)"),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"ab\Z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"ab\z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"ab$", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "abb\nb\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "abb\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "abb\nb\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nabb\n", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nabb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nabb\n", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "abb\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "abb\nb\n", "Pass. Group[0]=(0,3)"),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nabb\n", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nabb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nabb\n", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nabb", "Pass. Group[0]=(2,3)"),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nac", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "ac\nb\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nac\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nac", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.None, "b\nca", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "ca\nb\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nca\n", "Fail."),
+ new RegexTrial (@"abb\Z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"abb\z", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"abb$", RegexOptions.Multiline, "b\nca", "Fail."),
+ new RegexTrial (@"(^|x)(c)", RegexOptions.None, "ca", "Pass. Group[0]=(0,1) Group[1]=(0,0) Group[2]=(0,1)"),
+ new RegexTrial (@"a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz", RegexOptions.None, "x", "Fail."),
+ new RegexTrial (@"round\(((?>[^()]+))\)", RegexOptions.None, "_I(round(xs * sz),1)", "Pass. Group[0]=(3,14) Group[1]=(9,7)"),
+ new RegexTrial (@"foo.bart", RegexOptions.None, "foo.bart", "Pass. Group[0]=(0,8)"),
+ new RegexTrial (@"^d[x][x][x]", RegexOptions.Multiline, "abcd\ndxxx", "Pass. Group[0]=(5,4)"),
+ new RegexTrial (@".X(.+)+X", RegexOptions.None, "bbbbXcXaaaaaaaa", "Pass. Group[0]=(3,4) Group[1]=(5,1)"),
+ new RegexTrial (@".X(.+)+XX", RegexOptions.None, "bbbbXcXXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(5,1)"),
+ new RegexTrial (@".XX(.+)+X", RegexOptions.None, "bbbbXXcXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(6,1)"),
+ new RegexTrial (@".X(.+)+X", RegexOptions.None, "bbbbXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".X(.+)+XX", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".XX(.+)+X", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".X(.+)+[X]", RegexOptions.None, "bbbbXcXaaaaaaaa", "Pass. Group[0]=(3,4) Group[1]=(5,1)"),
+ new RegexTrial (@".X(.+)+[X][X]", RegexOptions.None, "bbbbXcXXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(5,1)"),
+ new RegexTrial (@".XX(.+)+[X]", RegexOptions.None, "bbbbXXcXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(6,1)"),
+ new RegexTrial (@".X(.+)+[X]", RegexOptions.None, "bbbbXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".X(.+)+[X][X]", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".XX(.+)+[X]", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".[X](.+)+[X]", RegexOptions.None, "bbbbXcXaaaaaaaa", "Pass. Group[0]=(3,4) Group[1]=(5,1)"),
+ new RegexTrial (@".[X](.+)+[X][X]", RegexOptions.None, "bbbbXcXXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(5,1)"),
+ new RegexTrial (@".[X][X](.+)+[X]", RegexOptions.None, "bbbbXXcXaaaaaaaa", "Pass. Group[0]=(3,5) Group[1]=(6,1)"),
+ new RegexTrial (@".[X](.+)+[X]", RegexOptions.None, "bbbbXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".[X](.+)+[X][X]", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@".[X][X](.+)+[X]", RegexOptions.None, "bbbbXXXaaaaaaaaa", "Fail."),
+ new RegexTrial (@"tt+$", RegexOptions.None, "xxxtt", "Pass. Group[0]=(3,2)"),
+ new RegexTrial (@"([\d-z]+)", RegexOptions.None, "a0-za", "Pass. Group[0]=(1,3) Group[1]=(1,3)"),
+ new RegexTrial (@"([\d-\s]+)", RegexOptions.None, "a0- z", "Pass. Group[0]=(1,3) Group[1]=(1,3)"),
+ new RegexTrial (@"\GX.*X", RegexOptions.None, "aaaXbX", "Fail."),
+ new RegexTrial (@"(\d+\.\d+)", RegexOptions.None, "3.1415926", "Pass. Group[0]=(0,9) Group[1]=(0,9)"),
+ new RegexTrial (@"(\ba.{0,10}br)", RegexOptions.None, "have a web browser", "Pass. Group[0]=(5,8) Group[1]=(5,8)"),
+ new RegexTrial (@"\.c(pp|xx|c)?$", RegexOptions.IgnoreCase, "Changes", "Fail."),
+ new RegexTrial (@"\.c(pp|xx|c)?$", RegexOptions.IgnoreCase, "IO.c", "Pass. Group[0]=(2,2) Group[1]="),
+ new RegexTrial (@"(\.c(pp|xx|c)?$)", RegexOptions.IgnoreCase, "IO.c", "Pass. Group[0]=(2,2) Group[1]=(2,2) Group[2]="),
+ new RegexTrial (@"^([a-z]:)", RegexOptions.None, "C:/", "Fail."),
+ new RegexTrial (@"^\S\s+aa$", RegexOptions.Multiline, "\nx aa", "Pass. Group[0]=(1,4)"),
+ new RegexTrial (@"(^|a)b", RegexOptions.None, "ab", "Pass. Group[0]=(0,2) Group[1]=(0,1)"),
+ new RegexTrial (@"^([ab]*?)(b)?(c)$", RegexOptions.None, "abac", "Pass. Group[0]=(0,4) Group[1]=(0,3) Group[2]= Group[3]=(3,1)"),
+ new RegexTrial (@"(\w)?(abc)\1b", RegexOptions.None, "abcab", "Fail."),
+ new RegexTrial (@"^(?:.,){2}c", RegexOptions.None, "a,b,c", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"^(.,){2}c", RegexOptions.None, "a,b,c", "Pass. Group[0]=(0,5) Group[1]=(0,2)(2,2)"),
+ new RegexTrial (@"^(?:[^,]*,){2}c", RegexOptions.None, "a,b,c", "Pass. Group[0]=(0,5)"),
+ new RegexTrial (@"^([^,]*,){2}c", RegexOptions.None, "a,b,c", "Pass. Group[0]=(0,5) Group[1]=(0,2)(2,2)"),
+ new RegexTrial (@"^([^,]*,){3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]*,){3,}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]*,){0,3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,3},){3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,3},){3,}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,3},){0,3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,},){3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,},){3,}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{1,},){0,3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{0,3},){3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{0,3},){3,}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"^([^,]{0,3},){0,3}d", RegexOptions.None, "aaa,b,c,d", "Pass. Group[0]=(0,9) Group[1]=(0,4)(4,2)(6,2)"),
+ new RegexTrial (@"(?i)", RegexOptions.None, "", "Pass. Group[0]=(0,0)"),
+ new RegexTrial (@"(?!\A)x", RegexOptions.Multiline, "a\nxb\n", "Pass. Group[0]=(2,1)"),
+ new RegexTrial (@"^(a(b)?)+$", RegexOptions.None, "aba", "Pass. Group[0]=(0,3) Group[1]=(0,2)(2,1) Group[2]=(1,1)"),
+ new RegexTrial (@"^(aa(bb)?)+$", RegexOptions.None, "aabbaa", "Pass. Group[0]=(0,6) Group[1]=(0,4)(4,2) Group[2]=(2,2)"),
+ new RegexTrial (@"^.{9}abc.*\n", RegexOptions.Multiline, "123\nabcabcabcabc\n", "Pass. Group[0]=(4,13)"),
+ new RegexTrial (@"^(a)?a$", RegexOptions.None, "a", "Pass. Group[0]=(0,1) Group[1]="),
+ new RegexTrial (@"^(a)?(?(1)a|b)+$", RegexOptions.None, "a", "Fail."),
+ new RegexTrial (@"^(a\1?)(a\1?)(a\2?)(a\3?)$", RegexOptions.None, "aaaaaa", "Pass. Group[0]=(0,6) Group[1]=(0,1) Group[2]=(1,2) Group[3]=(3,1) Group[4]=(4,2)"),
+ new RegexTrial (@"^(a\1?){4}$", RegexOptions.None, "aaaaaa", "Pass. Group[0]=(0,6) Group[1]=(0,1)(1,2)(3,1)(4,2)"),
+ new RegexTrial (@"^(0+)?(?:x(1))?", RegexOptions.None, "x1", "Pass. Group[0]=(0,2) Group[1]= Group[2]=(1,1)"),
+ new RegexTrial (@"^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?", RegexOptions.None, "012cxx0190", "Pass. Group[0]=(0,10) Group[1]=(0,4) Group[2]= Group[3]=(6,4)"),
+ new RegexTrial (@"^(b+?|a){1,2}c", RegexOptions.None, "bbbac", "Pass. Group[0]=(0,5) Group[1]=(0,3)(3,1)"),
+ new RegexTrial (@"^(b+?|a){1,2}c", RegexOptions.None, "bbbbac", "Pass. Group[0]=(0,6) Group[1]=(0,4)(4,1)"),
+ new RegexTrial (@"\((\w\. \w+)\)", RegexOptions.None, "cd. (A. Tw)", "Pass. Group[0]=(4,7) Group[1]=(5,5)"),
+ new RegexTrial (@"((?:aaaa|bbbb)cccc)?", RegexOptions.None, "aaaacccc", "Pass. Group[0]=(0,8) Group[1]=(0,8)"),
+ new RegexTrial (@"((?:aaaa|bbbb)cccc)?", RegexOptions.None, "bbbbcccc", "Pass. Group[0]=(0,8) Group[1]=(0,8)")
+ };
+ }
+}
diff --git a/mcs/class/System/Test/System.Text.RegularExpressions/RegexTrial.cs b/mcs/class/System/Test/System.Text.RegularExpressions/RegexTrial.cs
new file mode 100644
index 00000000000..db368dbf8a1
--- /dev/null
+++ b/mcs/class/System/Test/System.Text.RegularExpressions/RegexTrial.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Text.RegularExpressions;
+
+namespace Ximian.Mono.Tests.System.Text.RegularExpressions {
+
+ class RegexTrial {
+ public string pattern;
+ public RegexOptions options;
+ public string input;
+
+ public string expected;
+
+ public RegexTrial (string pattern, RegexOptions options, string input, string expected) {
+ this.pattern = pattern;
+ this.options = options;
+ this.input = input;
+ this.expected = expected;
+ }
+
+ public string Expected {
+ get { return expected; }
+ }
+
+ public string Execute () {
+ string result;
+ try {
+ Regex re = new Regex (pattern, options);
+ Match m = re.Match (input);
+
+ if (m.Success) {
+ result = "Pass.";
+
+ for (int i = 0; i < m.Groups.Count; ++ i) {
+ Group group = m.Groups[i];
+
+ result += " Group[" + i + "]=";
+ foreach (Capture cap in group.Captures) {
+ result += "(" + cap.Index + "," + cap.Length + ")";
+ }
+ }
+ }
+ else
+ result = "Fail.";
+ }
+ catch (Exception) {
+ result = "Error.";
+ }
+
+ return result;
+ }
+
+ public override string ToString () {
+ return
+ "Matching input '" + input +
+ "' against pattern '" + pattern +
+ "' with options '" + options + "'.";
+ }
+ }
+
+ class Checksum {
+ public Checksum () {
+ this.sum = 0;
+ }
+
+ public uint Value {
+ get { return sum; }
+ }
+
+ public void Add (string str) {
+ for (int i = 0; i < str.Length; ++ i)
+ Add (str[i], 16);
+ }
+
+ public void Add (uint n) {
+ Add (n, 32);
+ }
+
+ public void Add (ulong n, int bits) {
+ ulong mask = 1ul << (bits - 1);
+ for (int i = 0; i < bits; ++ i) {
+ Add ((n & mask) != 0);
+ mask >>= 1;
+ }
+ }
+
+ public void Add (bool bit) {
+ bool top = (sum & 0x80000000) != 0;
+ sum <<= 1;
+ sum ^= bit ? (uint)1 : (uint)0;
+
+ if (top)
+ sum ^= key;
+ }
+
+ private uint sum;
+ private readonly uint key = 0x04c11db7;
+ }
+}
diff --git a/mcs/class/System/Test/System_test.build b/mcs/class/System/Test/System_test.build
new file mode 100644
index 00000000000..7e87a64db2e
--- /dev/null
+++ b/mcs/class/System/Test/System_test.build
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for System_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="System_test" default="build">
+ <property name="debug" value="false"/>
+ <property name="nunit_home" value="..\..\..\nunit"/>
+
+ <target name="build">
+ </target>
+
+ <target name="assemblies">
+ <csc target="library" output="System_test.dll" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="TheTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore.dll"/>
+ </references>
+
+ <arg value="/noconfig"/>
+ <arg value="/r:.\System.dll"/>
+ </csc>
+
+ <csc target="exe" output="RunTests.System.exe" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="**/AllTests.cs"/>
+ <excludes name="**/MartinTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitBase.dll"/>
+ </references>
+ <references basedir=".">
+ <includes name="System.dll"/>
+ </references>
+ <arg value="/nowarn:1595"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:.\System.dll"/>
+ </csc>
+
+ </target>
+
+ <target name="test" depends="assemblies">
+ <exec program="..\..\..\nunit\NUnitConsole" commandline="Ximian.Mono.Tests.AllTests,System_test.dll" failonerror="false"/>
+ </target>
+
+ <target name="clean">
+ <delete file="System_test.dll" failonerror="false"/>
+ </target>
+</project>
diff --git a/mcs/class/System/Test/TcpClientTest.cs b/mcs/class/System/Test/TcpClientTest.cs
new file mode 100755
index 00000000000..f7b39fd5050
--- /dev/null
+++ b/mcs/class/System/Test/TcpClientTest.cs
@@ -0,0 +1,82 @@
+// System.Net.Sockets.TcpClientTest.cs
+//
+// Author:
+// Phillip Pearson (pp@myelin.co.nz)
+//
+// Copyright (C) 2001, Phillip Pearson
+// http://www.myelin.co.nz
+//
+
+using System;
+using System.Net;
+using System.Net.Sockets;
+using NUnit.Framework;
+
+namespace MonoTests.System.Net.Sockets {
+
+ /// <summary>
+ /// Tests System.Net.Sockets.TcpClient
+ /// </summary>
+ public class TcpClientTest : TestCase {
+
+ public TcpClientTest(string name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof (TcpClientTest));
+ }
+ }
+
+ /// <summary>
+ /// Tests the TcpClient object
+ /// (from System.Net.Sockets)
+ /// </summary>
+ public void test_TcpClient()
+ {
+ // set up a listening Socket
+ Socket lSock = new Socket(AddressFamily.InterNetwork,
+ SocketType.Stream, ProtocolType.Tcp);
+
+ lSock.Bind(new IPEndPoint(IPAddress.Any, 1234));
+ lSock.Listen(-1);
+
+
+ // connect to it with a TcpClient
+ TcpClient outClient = new TcpClient("localhost", 1234);
+ Socket inSock = lSock.Accept();
+
+
+ // now try exchanging data
+ NetworkStream stream = outClient.GetStream();
+
+ const int len = 1024;
+ byte[] outBuf = new Byte[len];
+ for (int i=0; i<len; i++)
+ {
+ outBuf[i] = (byte)(i % 256);
+ }
+
+ // send it
+ stream.Write(outBuf,0,len);
+
+ // and see if it comes back
+ byte[] inBuf = new Byte[len];
+ int ret = inSock.Receive(inBuf, 0, len, 0);
+ Assert(ret != 0);
+
+ for (int i=0; i<len; i++)
+ {
+ Assert(inBuf[i] == outBuf[i]);
+ }
+
+
+ // tidy up
+ inSock.Close();
+ outClient.Close();
+ lSock.Close();
+
+ }
+
+ }
+
+}
diff --git a/mcs/class/System/Test/TcpListenerTest.cs b/mcs/class/System/Test/TcpListenerTest.cs
new file mode 100755
index 00000000000..a07d6bfcb9e
--- /dev/null
+++ b/mcs/class/System/Test/TcpListenerTest.cs
@@ -0,0 +1,85 @@
+// System.Net.Sockets.TcpListenerTest.cs
+//
+// Author:
+// Phillip Pearson (pp@myelin.co.nz)
+//
+// Copyright (C) 2001, Phillip Pearson
+// http://www.myelin.co.nz
+//
+
+using System;
+using System.Net;
+using System.Net.Sockets;
+using NUnit.Framework;
+
+namespace MonoTests.System.Net.Sockets {
+
+ /// <summary>
+ /// Tests System.Net.Sockets.TcpListener
+ /// </summary>
+ public class TcpListenerTest : TestCase {
+
+ public TcpListenerTest(string name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof (TcpListenerTest));
+ }
+ }
+
+ /// <summary>
+ /// Tests the TcpListener object
+ /// (from System.Net.Sockets)
+ /// </summary>
+ public void test_TcpListener()
+ {
+ // listen with a new listener
+ TcpListener inListener = new TcpListener(1234);
+ inListener.Start();
+
+
+ // connect to it from a new socket
+ Socket outSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
+ ProtocolType.IP);
+ IPHostEntry hostent = Dns.GetHostByAddress("127.0.0.1");
+ IPEndPoint remote = new IPEndPoint(hostent.AddressList[0], 1234);
+ outSock.Connect(remote);
+
+
+ // make sure the connection arrives
+ Assert(inListener.Pending());
+ Socket inSock = inListener.AcceptSocket();
+
+
+ // now send some data and see if it comes out the other end
+ const int len = 1024;
+ byte[] outBuf = new Byte[len];
+ for (int i=0; i<len; i++)
+ {
+ outBuf[i] = (byte)(i % 256);
+ }
+
+ outSock.Send(outBuf, 0, len, 0);
+
+ byte[] inBuf = new Byte[len];
+ int ret = inSock.Receive(inBuf, 0, len, 0);
+
+
+ // let's see if it arrived OK
+ Assert(ret != 0);
+ for (int i=0; i<len; i++)
+ {
+ Assert(inBuf[i] == outBuf[i]);
+ }
+
+
+ // tidy up after ourselves
+ inSock.Close();
+
+ inListener.Stop();
+ }
+
+
+ }
+
+}
diff --git a/mcs/class/System/Test/TheTests.cs b/mcs/class/System/Test/TheTests.cs
new file mode 100644
index 00000000000..15843647a0c
--- /dev/null
+++ b/mcs/class/System/Test/TheTests.cs
@@ -0,0 +1,74 @@
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace Ximian.Mono.Tests.System
+{
+ public class RunDnsTest : DnsTest
+ {
+ protected override void RunTest ()
+ {
+ TestAsyncGetHostByName ();
+ TestAsyncResolve ();
+ TestGetHostName ();
+ TestGetHostByName ();
+ TestGetHostByAddressString ();
+ TestGetHostByAddressIPAddress ();
+ TestResolve ();
+ }
+ }
+}
+
+namespace Ximian.Mono.Tests.System.Collections.Specialized.Collections.Specialized
+{
+ public class RunStringCollectionTest : StringCollectionTest
+ {
+ protected override void RunTest ()
+ {
+ TestSimpleCount ();
+ TestSimpleIsReadOnly ();
+ TestSimpleIsSynchronized ();
+ TestSimpleItemGet ();
+ TestSimpleItemSet ();
+ TestSimpleSyncRoot ();
+ TestSimpleAdd ();
+ TestSimpleAddRange ();
+ TestSimpleClear ();
+ TestSimpleContains ();
+ TestSimpleCopyTo ();
+ TestSimpleGetEnumerator ();
+ TestSimpleIndexOf ();
+ TestSimpleInsert ();
+ TestSimpleRemove ();
+ TestSimpleRemoveAt ();
+ }
+ }
+}
+
+namespace MonoTests
+{
+ public class RunAllTests
+ {
+ public static void AddAllTests (TestSuite suite)
+ {
+ suite.AddTest (new Ximian.Mono.Tests.System.RunDnsTest ());
+ suite.AddTest (new Ximian.Mono.Tests.System.Collections.Specialized.Collections.Specialized.RunStringCollectionTest ());
+ }
+ }
+}
+
+class MainApp
+{
+ public static void Main()
+ {
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");
+
+ TestResult result = new TestResult ();
+ TestSuite suite = new TestSuite ();
+ MonoTests.RunAllTests.AddAllTests (suite);
+ suite.Run (result);
+ MonoTests.MyTestRunner.Print (result);
+ }
+}
+
diff --git a/mcs/class/corlib/.cvsignore b/mcs/class/corlib/.cvsignore
new file mode 100644
index 00000000000..d091f16f294
--- /dev/null
+++ b/mcs/class/corlib/.cvsignore
@@ -0,0 +1,2 @@
+corlib.dll
+corlib.pdb
diff --git a/mcs/class/corlib/ChangeLog b/mcs/class/corlib/ChangeLog
new file mode 100644
index 00000000000..985aba344c1
--- /dev/null
+++ b/mcs/class/corlib/ChangeLog
@@ -0,0 +1,69 @@
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * corlib.build: removed seperate windows/linux builds. excluded
+ wrapper and PAL classes from all builds.
+
+2002-03-03 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Exclude a bunch of interfaces from corlib_res.dll
+ that were preventing the tests from running on Windows.
+
+2002-01-25 Mark Crichton <crichton@gimp.org>
+
+ * System.Security.Cryptography/RijndaelManaged.cs: added
+
+ * System.Security.Cryptography/Rijndael.cs: changed constructor
+ to set default values. Hopefully I did it correctly.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * Unix/Errno.cs: Added
+
+ * Unix/Wrapper.cs: Updated to new Wrapper
+
+2002-01-19 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: exclude Delegate from corlib_cmp.
+
+2002-01-09 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Exclude Security Attribute classes that need mcs
+ magic to get them to compile.
+
+2002-01-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * corlib.build: Removed <excludes> for System.Resources
+
+2002-01-05 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Have the clean target remove any .pdb files that
+ might be around if we compiled with debug on.
+
+2002-01-05 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Make new build of corlib_cmp.dll. This is the same
+ as corlib.dll without Object and ValueType. It is used by
+ /mcs/tools/corcompare.exe to compare with mscorlib.
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Put the linux target at the top. I keep changing the
+ build for windows 'cause it's at the top. Then when I do make, nothing
+ changes. It seems like it always takes me half a day to remember
+ that the linux target comes second. Old age I guess.
+
+ * .cvsignore: ignore corlib.pdb for times when it's built with debug on.
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * corlib.build: Removed "exclude CodeAccessPermission.cs"
+
+2001-12-11 Duncan Mak <duncan@ximian.com>
+
+ * ChangeLog: Added "System.Resources" to the exclude list.
+
+2001-12-05 Nick Drochak <ndrochak@gol.com>
+
+ * ChangeLog: Add the change log to this directory
+
+ * corlib.build: Add dependancy on linux target to test target. Need to have the dll before we can test it, right? Plus is encourages other to try 'make test'.
+
diff --git a/mcs/class/corlib/Linux/ChangeLog b/mcs/class/corlib/Linux/ChangeLog
new file mode 100644
index 00000000000..96eb5e7cded
--- /dev/null
+++ b/mcs/class/corlib/Linux/ChangeLog
@@ -0,0 +1,27 @@
+2002-03-18 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Linux.cs: Removed math methods (now in System.Math).
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * Linux.cs: GetFileTime and SetFileTime need to be static
+
+Tue Jan 22 22:50:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Linux.cs: comment out call to Debug.Assert(): stuff from the System
+ assembly cannot be used in corlib.
+
+2001-12-11 Dick Porter <dick@ximian.com>
+
+ * Linux.cs: IO implemented with file handles with internal calls,
+ rather than casting file descriptors for C library p/invokes.
+ Implemented Get/Set Creation/LastAccess/LastWrite TimeFile
+ functions.
+
+Wed Nov 14 16:30:27 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Linux.cs: a '/' is a valid char in a file path.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * Linux.cs (GetCurrentDirectory): implemented
diff --git a/mcs/class/corlib/Linux/Linux.cs b/mcs/class/corlib/Linux/Linux.cs
new file mode 100644
index 00000000000..86a1cfc475a
--- /dev/null
+++ b/mcs/class/corlib/Linux/Linux.cs
@@ -0,0 +1,484 @@
+/*---------------------------------------------------------------------
+
+ XX X XXX
+ XX XX
+ XXX XX XXX XXXXX XX
+ XX XXX XX XX XX
+ XX XX XX XX XXXXX XX
+ XX XX XX XX XX XX X XX
+ XXXX XX XX XXX XXXXXXX XXXX
+ XX
+ XXXXX
+
+Copyright (c) 2001 Intel Corporation. All Rights Reserved.
+
+CREATED: August 22, 2001
+OWNER: Scott D Smith, Joel Marcey
+VERSION: 1.0
+---------------------------------------------------------------------*/
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.IO;
+using System.Collections;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace System.PAL
+{
+ /// <summary>
+ /// Class that implements IOperatingSystem, providing the requested functionality through calls into APIs available in Linux
+ /// </summary>
+ internal class OpSys
+ {
+ private Hashtable _environment = null;
+
+ //----------------------------------
+ // Class Constants
+ //----------------------------------
+ private const int EOF = -1; // TODO: Linux: Is this true?
+
+
+ // For StdInputStream and StdOutputStream
+ private IntPtr Stdin;
+ private IntPtr Stdout;
+ private IntPtr Stderr;
+
+ //----------------------------------
+ // Class Fields
+ //----------------------------------
+
+ //----------------------------------
+ // Class Constructor
+ //----------------------------------
+ public OpSys()
+ {
+ Stdin=GetStdHandle(0);
+ Stdout=GetStdHandle(1);
+ Stderr=GetStdHandle(2);
+ }
+
+
+ //-------------------------------------------------
+ // Environment Services
+ //-------------------------------------------------
+
+ public string NewLineSequence
+ {
+ get
+ {
+ return "\n";
+ }
+ }
+
+ public char DirectorySeparator
+ {
+ get
+ {
+ return '/';
+ }
+ }
+
+ public char AltDirectorySeparator
+ {
+ get
+ {
+ return '\\';
+ }
+ }
+
+ public char VolumeSeparator
+ {
+ get
+ {
+ return '/';
+ }
+ }
+
+ public char PathSeparator
+ {
+ get
+ {
+ return ':';
+ }
+ }
+
+ public char[] InvalidPathChars
+ {
+ get
+ {
+ return new char[] { '\0' };
+ }
+ }
+
+ public char[] DirVolSeparatorChars
+ {
+ get
+ {
+ return new char[] { this.DirectorySeparator, this.AltDirectorySeparator, this.VolumeSeparator};
+ }
+ }
+ public char ExtensionCharacter
+ {
+ get
+ {
+ return '.';
+ }
+ }
+
+ public string GetEnvironmentVariable(string eVar)
+ {
+ return EnvironmentVariables[eVar].ToString();
+ }
+
+ public IDictionary EnvironmentVariables
+ {
+ get
+ {
+ if (_environment == null) {
+ IntPtr pp = _getEnviron(); // pointer to an array of char*
+ _environment = new Hashtable();
+
+ if (pp != IntPtr.Zero) {
+ IntPtr p;
+ bool done = false;
+ char[] delimiter = { '=' };
+
+ while (!done)
+ {
+ p = Marshal.ReadIntPtr(pp);
+ if (p != IntPtr.Zero)
+ {
+ string str = Marshal.PtrToStringAuto(p);
+ string[] ar = str.Split(delimiter, 2);
+ switch(ar.Length)
+ {
+ case 1:
+ _environment.Add(ar[0], "");
+ break;
+ case 2:
+ _environment.Add(ar[0], ar[1]);
+ break;
+ default:
+ //System.Diagnostics/.Debug.Assert(false); // this shouldn't happen
+ break;
+ }
+ }
+ else
+ {
+ done = true;
+ }
+ }
+ }
+ }
+ return _environment;
+ }
+ }
+
+ public string CommandLine
+ {
+ get
+ {
+ string path = Path.Combine(Path.Combine("/proc", _getPid().ToString()), "cmdline");
+ StreamReader stream = File.OpenText(path);
+ string res = stream.ReadToEnd();
+ stream.Close();
+ return res;
+ }
+ }
+
+ public string MachineName
+ {
+ get
+ {
+ return GetEnvironmentVariable("HOSTNAME");
+ }
+ }
+
+ public OperatingSystem OSVersion
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ // System.Path services
+
+ public string ChangeExtension(string path, string extension)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:ChangeExtension(System.String, System.String): Stub Method");
+ return null;
+ }
+
+ public string GetExtension(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetExtension(System.String): Stub Method");
+ return null;
+ }
+
+ public string GetFileName(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetFileName(System.String): Stub Method");
+ return null;
+ }
+
+ public string GetFileNameWithoutExtension(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetFileNameWithoutExtension(System.String): Stub Method");
+ return null;
+ }
+
+ public string GetFullPath(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetFullPath(System.String): Stub Method");
+ return null;
+ }
+
+ public string GetPathRoot(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetPathRoot(System.String): Stub Method");
+ return null;
+
+ }
+
+ public string GetTempFileName()
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetTempFileName(): Stub Method");
+ return null;
+ }
+
+ public string GetTempPath()
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetTempPath(): Stub Method");
+ return null;
+ }
+
+ public bool HasExtension(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:HasExtension(System.String): Stub Method");
+ return false;
+ }
+
+ public bool IsPathRooted(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:IsPathRooted(System.String): Stub Method");
+ return false;
+ }
+
+
+
+ // System.Directory services
+
+ public void DeleteDirectory(string path, bool recursive)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:DeleteDirectory(System.String, System.Boolean): Stub Method");
+ }
+
+ public bool ExistsDirectory(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:ExistsDirectory(System.String): Stub Method");
+ return false;
+ }
+
+ public DateTime GetCreationTimeDirectory(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetCreationTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public extern string GetCurrentDirectory();
+
+ public string[] GetDirectories(string path, string searchPattern)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetDirectories(System.String,System.String): Stub Method");
+ return null;
+ }
+
+ public string[] GetFiles(string path, string searchPattern)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetFiles(System.String, System.String): Stub Method");
+ return null;
+ }
+
+ public string[] GetFileSystemEntries(string path, string searchPattern)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetFileSystemEntries(System.String, System.String): Stub Method");
+ return null;
+ }
+
+ public DateTime GetLastAccessTimeDirectory(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetLastAccessTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public DateTime GetLastWriteTimeDirectory(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:GetLastWriteTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public void MoveDirectory(string sourceDirName, string destDirName)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:MoveDirectory(System.String, System.String): Stub Method");
+ }
+
+ public void SetCreationTimeDirectory(string path, DateTime creationTime)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:SetCreationTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetCurrentDirectory(string path)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:SetCurrentDirectory(System.String): Stub Method");
+ }
+
+ public void SetLastAccessTimeDirectory(string path, DateTime lastAccessTime)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:SetLastAccessTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetLastWriteTimeDirectory(string path, DateTime lastWriteTime)
+ {
+ //System.Diagnostics/.Debug.WriteLine("Linux:SetLastWriteTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+ //-----------------------------------
+ // I/O Services
+ //-----------------------------------
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ private extern IntPtr GetStdHandle(int fd);
+
+ public IntPtr StdinHandle {
+ get {
+ return(Stdin);
+ }
+ }
+
+ public IntPtr StdoutHandle {
+ get {
+ return(Stdout);
+ }
+ }
+
+ public IntPtr StderrHandle {
+ get {
+ return(Stderr);
+ }
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public extern void DeleteFile(string path);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public extern bool ExistsFile(string path);
+
+ /* The long time parameters in GetFileTime and
+ * SetFileTime correspond to Windows file times (ticks
+ * from DateTime(1/1/1601 00:00 GMT))
+ */
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ private extern static bool GetFileTime(IntPtr handle, out long creat, out long lastaccess, out long lastwrite);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ private extern static bool SetFileTime(IntPtr handle, long creat, long lastaccess, long lastwrite);
+
+ public DateTime GetCreationTimeFile(string path)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.Read);
+
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+ s.Close();
+
+ return DateTime.FromFileTime(creat);
+ }
+
+ public DateTime GetLastAccessTimeFile(string path)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.Read);
+
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+ s.Close();
+
+ return DateTime.FromFileTime(lastaccess);
+ }
+
+ public DateTime GetLastWriteTimeFile(string path)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.Read);
+
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+ s.Close();
+
+ return DateTime.FromFileTime(lastwrite);
+ }
+
+ public void SetCreationTimeFile(string path, DateTime creationTime)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.ReadWrite);
+
+ // Get the existing times first
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+
+ creat=creationTime.ToFileTime();
+
+ ret=SetFileTime(s.Handle, creat, lastaccess, lastwrite);
+ s.Close();
+ }
+
+ public void SetLastAccessTimeFile(string path, DateTime lastAccessTime)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.ReadWrite);
+
+ // Get the existing times first
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+
+ lastaccess=lastAccessTime.ToFileTime();
+
+ ret=SetFileTime(s.Handle, creat, lastaccess, lastwrite);
+ s.Close();
+ }
+
+ public void SetLastWriteTimeFile(string path, DateTime lastWriteTime)
+ {
+ long creat, lastaccess, lastwrite;
+ bool ret;
+ FileStream s = new FileStream(path, FileMode.Open, FileAccess.ReadWrite);
+
+ // Get the existing times first
+ ret=GetFileTime(s.Handle, out creat, out lastaccess, out lastwrite);
+
+ lastwrite=lastWriteTime.ToFileTime();
+
+ ret=SetFileTime(s.Handle, creat, lastaccess, lastwrite);
+ s.Close();
+ }
+
+
+ public long FileLength(string path)
+ {
+ return 0;
+ }
+
+ // Private implementation details
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_environ", CharSet=CharSet.Ansi)]
+ private unsafe static extern IntPtr _getEnviron();
+
+ [DllImport("libc", EntryPoint="getpid")]
+ private unsafe static extern int _getPid();
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/ArrayList.cs b/mcs/class/corlib/System.Collections/ArrayList.cs
new file mode 100644
index 00000000000..9c65eafc867
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/ArrayList.cs
@@ -0,0 +1,574 @@
+//
+// System.Collections.ArrayList
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ [MonoTODO ("add versioning, changing the arraylist should invalidate all enumerators")]
+ [Serializable]
+ public class ArrayList : IList, ICollection, IEnumerable, ICloneable {
+ // constructors
+
+ public ArrayList () {
+ dataArray = new object[capacity];
+ }
+
+ public ArrayList (ICollection c) {
+ if (null == c) {
+ throw new ArgumentNullException();
+ }
+ dataArray = new object[c.Count];
+ this.capacity = c.Count;
+ foreach(object o in c) {
+ Add(o);
+ }
+ }
+
+ public ArrayList (int capacity) {
+ if (capacity < 0) {
+ throw new ArgumentOutOfRangeException("capacity", capacity, "Value must be greater than or equal to zero.");
+ }
+ dataArray = new object[capacity];
+ this.capacity = capacity;
+ }
+
+ private ArrayList (object[] dataArray, int count, int capacity,
+ bool fixedSize, bool readOnly, bool synchronized)
+ {
+ this.dataArray = (object[])dataArray.Clone();
+ this.count = count;
+ this.capacity = capacity;
+ this.fixedSize = fixedSize;
+ this.readOnly = readOnly;
+ this.synchronized = synchronized;
+ }
+
+ [MonoTODO]
+ public static ArrayList ReadOnly (ArrayList list) {
+ throw new NotImplementedException ("System.Collections.ArrayList.ReadOnly");
+ }
+
+ [MonoTODO]
+ public static IList ReadOnly (IList list) {
+ throw new NotImplementedException ("System.Collections.ArrayList.ReadOnly");
+ }
+
+ [MonoTODO]
+ public static ArrayList Synchronized (ArrayList list) {
+ throw new NotImplementedException ("System.Collections.ArrayList.Synchronized");
+ }
+
+ [MonoTODO]
+ public static IList Synchronized (IList list) {
+ throw new NotImplementedException ("System.Collections.ArrayList.Synchronized");
+ }
+
+ [MonoTODO]
+ public static ArrayList FixedSize (ArrayList list) {
+ throw new NotImplementedException ("System.Collections.ArrayList.FixedSize");
+ }
+
+ [MonoTODO]
+ public static IList FixedSize (IList list) {
+ throw new NotImplementedException ("System.Collections.ArrayList.FixedSize");
+ }
+
+ public static ArrayList Repeat (object value, int count) {
+ ArrayList al = new ArrayList (count);
+ for (int i = 0; i < count; i++) {
+ al.dataArray[i] = value;
+ }
+ al.count = count;
+
+ return al;
+ }
+
+ [MonoTODO]
+ public static ArrayList Adapter (IList list) {
+ throw new NotImplementedException ("System.Collections.ArrayList.Adapter");
+ }
+
+ // properties
+
+ private bool fixedSize = false;
+ private bool readOnly = false;
+ private bool synchronized = false;
+
+ private long version = 0;
+ private ArrayList source = null;
+
+ private int count = 0;
+ private int capacity = 16;
+
+ private object[] dataArray;
+
+ private void copyDataArray (object[] outArray) {
+ for (int i = 0; i < count; i++) {
+ outArray[i] = dataArray[i];
+ }
+ }
+
+ private void setSize (int newSize) {
+ if (newSize == capacity) {
+ return;
+ }
+
+ // note that this assumes that we've already sanity-checked
+ // the new size
+ object[] newDataArray = new object[newSize];
+ copyDataArray (newDataArray);
+ dataArray = newDataArray;
+
+ capacity = newSize;
+ }
+
+ // note that this DOES NOT update count
+ private void shiftElements (int startIndex, int numshift) {
+ if (numshift == 0) {
+ return;
+ }
+
+ if (count + numshift > capacity) {
+ setSize (capacity * 2);
+ shiftElements (startIndex, numshift);
+ } else {
+ if (numshift > 0) {
+ int numelts = count - startIndex;
+ for (int i = numelts-1; i >= 0; i--) {
+ dataArray[startIndex + numshift + i] = dataArray[startIndex + i];
+ }
+
+ for (int i = startIndex; i < startIndex + numshift; i++) {
+ dataArray[i] = null;
+ }
+ } else {
+ int numelts = count - startIndex + numshift;
+ for (int i = startIndex; i <= numelts; i++) {
+ dataArray[i] = dataArray[i - numshift];
+ }
+ for (int i = count + numshift; i < count; i++) {
+ dataArray[i] = null;
+ }
+ }
+ }
+ }
+
+ public virtual int Capacity {
+ get {
+ return capacity;
+ }
+
+ set {
+ if (readOnly) {
+ throw new NotSupportedException
+ ("Collection is read-only.");
+ }
+
+ if (value < count) {
+ throw new ArgumentOutOfRangeException
+ ("ArrayList Capacity being set to less than Count");
+ }
+
+ if (fixedSize && value != capacity) {
+ throw new NotSupportedException
+ ("Collection is fixed size.");
+ }
+
+ setSize (value);
+ }
+ }
+
+ private void CheckSourceVersion() {
+ if (null != this.source && this.version != this.source.version) {
+ throw new InvalidOperationException();
+ }
+ }
+
+ public virtual int Count {
+ get {
+ CheckSourceVersion();
+ return count;
+ }
+ }
+
+ public virtual bool IsFixedSize {
+ get {
+ return fixedSize;
+ }
+ }
+
+ public virtual bool IsReadOnly {
+ get {
+ return readOnly;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return synchronized;
+ }
+ }
+
+ public virtual object this[int index] {
+ get {
+ CheckSourceVersion();
+
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException ("index < 0");
+ }
+
+ if (index >= count) {
+ throw new ArgumentOutOfRangeException ("index out of range");
+ }
+
+ return dataArray[index];
+ }
+ set {
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException ("index < 0");
+ }
+
+ if (index >= count) {
+ throw new ArgumentOutOfRangeException ("index out of range");
+ }
+
+ if (readOnly) {
+ throw new NotSupportedException ("Collection is read-only.");
+ }
+
+ dataArray[index] = value;
+ version++;
+ }
+ }
+
+ [MonoTODO]
+ public virtual object SyncRoot {
+ get {
+ throw new NotImplementedException ("System.Collections.ArrayList.SyncRoot.get");
+ }
+ }
+
+
+ // methods
+
+ public virtual int Add (object value) {
+ if (readOnly) {
+ throw new NotSupportedException ("Collection is read-only.");
+ }
+
+ if (count + 1 >= capacity) {
+ setSize (capacity * 2);
+ }
+
+ dataArray[count] = value;
+ version++;
+ return count++;
+ }
+
+ public virtual void AddRange (ICollection c) {
+ int cc = c.Count;
+ if (count + cc >= capacity)
+ Capacity = cc < count? count * 2: count + cc + 1;
+ c.CopyTo (dataArray, count);
+ count += cc;
+ version++;
+ }
+
+ public virtual int BinarySearch (object value) {
+ return BinarySearch (0, count, value, null);
+ }
+
+ public virtual int BinarySearch (object value, IComparer comparer) {
+ return BinarySearch (0, count, value, comparer);
+ }
+
+ public virtual int BinarySearch (int index, int count,
+ object value, IComparer comparer) {
+ return Array.BinarySearch (dataArray, index, count, value, comparer);
+ }
+
+ public virtual void Clear () {
+ count = 0;
+ setSize(capacity);
+ version++;
+ }
+
+ public virtual object Clone () {
+ return new ArrayList (dataArray, count, capacity,
+ fixedSize, readOnly, synchronized);
+ }
+
+ public virtual bool Contains (object item) {
+ for (int i = 0; i < count; i++) {
+ if (Object.Equals (dataArray[i], item)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public virtual void CopyTo (Array array) {
+ System.Array.Copy (dataArray, 0, array, 0, count);
+ }
+
+ public virtual void CopyTo (Array array, int arrayIndex) {
+ System.Array.Copy (dataArray, 0, array, arrayIndex, count);
+ }
+
+ public virtual void CopyTo (int index, Array array,
+ int arrayIndex, int count) {
+ System.Array.Copy (dataArray, index, array, arrayIndex, count);
+ }
+
+ [Serializable]
+ private class ArrayListEnumerator : IEnumerator {
+ private object[] data;
+ private int idx;
+ private int start;
+ private int num;
+
+ internal ArrayListEnumerator(int index, int count, object[] items) {
+ data = items;
+ start = index;
+ num = count;
+ idx = start - 1;
+ }
+
+ public object Clone ()
+ {
+ return new ArrayListEnumerator (start, num, data);
+ }
+
+ public virtual object Current {
+ get {
+ return data [idx];
+ }
+ }
+ public virtual bool MoveNext() {
+ if (++idx < start + num)
+ return true;
+ return false;
+ }
+ public virtual void Reset() {
+ idx = start - 1;
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator () {
+ return new ArrayListEnumerator(0, this.Count, dataArray);
+ }
+
+ private void ValidateRange(int index, int count) {
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException("index", index, "Must be equal to or greater than zero");
+ }
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException("count", count, "Must be equal to or greater than zero");
+ }
+ if (index > this.count - 1) {
+ throw new ArgumentException();
+ }
+ if (index + count > this.count - 1) {
+ throw new ArgumentException();
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator (int index, int count) {
+ ValidateRange(index, count);
+ return new ArrayListEnumerator(index, count, dataArray);
+ }
+
+ public virtual ArrayList GetRange (int index, int count) {
+ ValidateRange(index, count);
+ ArrayList retVal = new ArrayList(count);
+
+ for (int i = index; i < count + index; i++) {
+ retVal.Add(this[i]);
+ }
+ retVal.version = this.version;
+ retVal.source = this;
+ return retVal;
+ }
+
+ public virtual int IndexOf (object value) {
+ return IndexOf (value, 0, count);
+ }
+
+ public virtual int IndexOf (object value, int startIndex) {
+ return IndexOf (value, startIndex, count - startIndex);
+ }
+
+ public virtual int IndexOf (object value, int startIndex, int count) {
+ if (startIndex < 0 || startIndex + count > this.count || count < 0) {
+ throw new ArgumentOutOfRangeException ("IndexOf arguments out of range");
+ }
+ for (int i = startIndex; i < (startIndex + count); i++) {
+ if (Object.Equals (dataArray[i], value)) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ public virtual void Insert (int index, object value) {
+ if (readOnly) {
+ throw new NotSupportedException
+ ("Collection is read-only.");
+ }
+
+ if (fixedSize) {
+ throw new NotSupportedException
+ ("Collection is fixed size.");
+ }
+
+ if (index < 0 || index >= capacity) {
+ throw new ArgumentOutOfRangeException ("index < 0 or index >= capacity");
+ }
+
+ shiftElements (index, 1);
+ dataArray[index] = value;
+ count++;
+ version++;
+ }
+
+ [MonoTODO]
+ public virtual void InsertRange (int index, ICollection c) {
+ version++;
+ }
+
+ public virtual int LastIndexOf (object value) {
+ return LastIndexOf (value, count - 1, count);
+ }
+
+ public virtual int LastIndexOf (object value, int startIndex) {
+ if (startIndex < 0 || startIndex > count - 1) {
+ throw new ArgumentOutOfRangeException("startIndex", startIndex, "");
+ }
+ return LastIndexOf (value, startIndex, startIndex + 1);
+ }
+
+ public virtual int LastIndexOf (object value, int StartIndex,
+ int count)
+ {
+ int EndIndex = StartIndex - count + 1;
+ for (int i = StartIndex; i >= EndIndex; i--) {
+ if (Object.Equals (dataArray[i], value)) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ public virtual void Remove (object obj) {
+ int objIndex = IndexOf (obj);
+
+ if (objIndex == -1) {
+ // shouldn't an exception be thrown here??
+ // the MS docs don't indicate one, and testing
+ // with the MS .net framework doesn't indicate one
+ return;
+ }
+
+ RemoveRange (objIndex, 1);
+ }
+
+ public virtual void RemoveAt (int index) {
+ RemoveRange (index, 1);
+ }
+
+ public virtual void RemoveRange (int index, int count) {
+ if (readOnly) {
+ throw new NotSupportedException
+ ("Collection is read-only.");
+ }
+
+ if (fixedSize) {
+ throw new NotSupportedException
+ ("Collection is fixed size.");
+ }
+
+ if (index < 0 || index >= this.count || index + count > this.count) {
+ throw new ArgumentOutOfRangeException
+ ("index/count out of range");
+ }
+
+ shiftElements (index, - count);
+ this.count -= count;
+ version++;
+ }
+
+ public virtual void Reverse () {
+ Reverse (0, count);
+ }
+
+ public virtual void Reverse (int index, int count) {
+ if (readOnly) {
+ throw new NotSupportedException
+ ("Collection is read-only.");
+ }
+
+ if (index < 0 || index + count > this.count) {
+ throw new ArgumentOutOfRangeException
+ ("index/count out of range");
+ }
+
+ Array.Reverse (dataArray, index, count);
+ version++;
+ }
+
+ [MonoTODO]
+ public virtual void SetRange (int index, ICollection c) {
+ }
+
+ public virtual void Sort () {
+ Sort (0, count, null);
+ }
+
+ public virtual void Sort (IComparer comparer) {
+ Sort (0, count, comparer);
+ }
+
+ public virtual void Sort (int index, int count, IComparer comparer) {
+ if (readOnly) {
+ throw new NotSupportedException
+ ("Collection is read-only.");
+ }
+
+ if (index < 0 || index + count > this.count) {
+ throw new ArgumentOutOfRangeException
+ ("index/count out of range");
+ }
+
+ Array.Sort (dataArray, index, count, comparer);
+ version++;
+ }
+
+ public virtual object[] ToArray() {
+ object[] outArray = new object[count];
+ Array.Copy (dataArray, outArray, count);
+ return outArray;
+ }
+
+ public virtual Array ToArray (Type type) {
+ Array outArray = Array.CreateInstance (type, count);
+ Array.Copy (dataArray, outArray, count);
+ return outArray;
+ }
+
+ [MonoTODO]
+ public virtual void TrimToSize () {
+ // FIXME: implement this
+ version++;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/BitArray.cs b/mcs/class/corlib/System.Collections/BitArray.cs
new file mode 100644
index 00000000000..1fc6b156c0d
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/BitArray.cs
@@ -0,0 +1,499 @@
+using System;
+
+namespace System.Collections
+{
+ // do we really need to specify IEnumerable since ICollection extends it?
+ [Serializable]
+ public sealed class BitArray : ICollection, IEnumerable, ICloneable
+ {
+ private Int32[] m_array;
+ private int m_length;
+ private int m_modCount = 0;
+
+ private static void clearJunk(Int32[] arr, int numbits)
+ {
+ int numjunkbits = 32 - (numbits%32);
+ UInt32 mask = (~0U >> numjunkbits);
+ arr[arr.Length - 1] &= (int)mask;
+ }
+
+ private static int bitsToInts(int bits)
+ {
+ int retval = bits/32;
+ if (bits % 32 != 0)
+ retval++;
+
+ return retval;
+ }
+
+ private static int bitsToBytes(int bits)
+ {
+ int retval = bits/8;
+ if (bits % 8 != 0)
+ retval++;
+
+ return retval;
+ }
+
+
+ private void setBit(int bitIndex, bool value)
+ {
+ int index = bitIndex/32;
+ int shift = bitIndex%32;
+
+ Int32 theBit = 1 << shift;
+
+ if(value)
+ m_array[index] |= theBit;
+ else
+ m_array[index] &= ~theBit;
+
+ m_modCount++;
+ }
+
+ private bool getBit(int bitIndex)
+ {
+ int index = bitIndex/32;
+ int shift = bitIndex%32;
+
+ Int32 theBit = m_array[index] & (1 << shift);
+
+ return (theBit == 0) ? false : true;
+ }
+
+ private byte getByte(int byteIndex)
+ {
+ int index = byteIndex/4;
+ int shift = (byteIndex%4)*8;
+
+ Int32 theByte = m_array[index] & (0xff << shift);
+
+ return (byte)((theByte >> shift)&0xff);
+ }
+
+ private void setByte(int byteIndex, byte value)
+ {
+ int index = byteIndex/4;
+ int shift = (byteIndex%4)*8;
+
+ Int32 orig = m_array[index];
+
+ // clear the byte
+ orig &= ~(0xff << shift);
+ // or in the new byte
+ orig |= value << shift;
+
+ m_array[index] = orig;
+
+ m_modCount++;
+ }
+
+ /* --- Constructors --- */
+ public BitArray(BitArray orig)
+ {
+ m_length = orig.m_length;
+
+ int numInts = bitsToInts(m_length);
+ m_array = new Int32[numInts];
+ Array.Copy(orig.m_array, m_array, numInts);
+ }
+
+ public BitArray(bool[] bits)
+ {
+ m_length = bits.Length;
+
+ int numInts = bitsToInts(m_length);
+ m_array = new Int32[numInts];
+ for (int i=0; i < bits.Length; i++)
+ setBit(i, bits[i]);
+ }
+
+ public BitArray(byte[] bytes)
+ {
+ m_length = bytes.Length * 8;
+
+ m_array = new Int32[bitsToInts(m_length)];
+ for (int i=0; i < bytes.Length; i++)
+ setByte(i, bytes[i]);
+ }
+
+ public BitArray(int capacity)
+ {
+ m_length = capacity;
+ m_array = new Int32[bitsToInts(m_length)];
+ }
+
+ public BitArray(int[] words)
+ {
+ int arrlen = words.Length;
+ m_length = arrlen*32;
+ m_array = new Int32[arrlen];
+ Array.Copy(words, m_array, arrlen);
+ }
+
+ public BitArray(int capacity, bool value) : this(capacity)
+ {
+ if (value)
+ {
+ // FIXME: Maybe you can create an array pre filled?
+ for (int i = 0; i < m_array.Length; i++)
+ m_array[i] = ~0;
+ }
+ }
+
+ private BitArray(Int32 [] array, int length)
+ {
+ m_array = array;
+ m_length = length;
+ }
+
+
+ /* --- Public properties --- */
+ public int Count
+ {
+ get
+ {
+ return m_length;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ public bool this[int index]
+ {
+ get
+ {
+ return Get(index);
+ }
+ set
+ {
+ Set(index, value);
+ }
+
+ }
+
+ public int Length
+ {
+ get
+ {
+ return m_length;
+ }
+ set
+ {
+ if (value < 0)
+ throw new ArgumentOutOfRangeException();
+
+ int newLen = value;
+ if (m_length != newLen)
+ {
+ int numints = bitsToInts(newLen);
+ Int32 [] newArr = new Int32[numints];
+ int copylen = (numints > m_array.Length ? m_array.Length : numints);
+ Array.Copy(m_array, newArr, copylen);
+
+ // clear out the junk bits at the end:
+ clearJunk(newArr, newLen);
+
+ // set the internal state
+ m_array = newArr;
+ m_length = newLen;
+ m_modCount++;
+ }
+ }
+ }
+
+ public object SyncRoot
+ {
+ get
+ {
+ return this;
+ }
+ }
+
+ /* --- Public methods --- */
+ public BitArray And(BitArray operand)
+ {
+ if (operand == null)
+ throw new ArgumentNullException();
+ if (operand.m_length != m_length)
+ throw new ArgumentException();
+
+ Int32 [] newarr = new Int32[m_array.Length];
+ for (int i=0; i < m_array.Length; i++)
+ newarr[i] = m_array[i] & operand.m_array[i];
+
+ return new BitArray(newarr, m_length);
+ }
+
+ public object Clone()
+ {
+ // FIXME: according to the doc, this should be a shallow copy.
+ // But the MS implementation seems to do a deep copy.
+ return new BitArray((Int32 [])m_array.Clone(), m_length);
+ }
+
+ [MonoTODO]
+ public void CopyTo(Array array, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException();
+ if (index < 0)
+ throw new ArgumentOutOfRangeException();
+
+ // FIXME: Throw ArgumentException if array is multidimensional
+ if (index >= array.Length)
+ throw new ArgumentException();
+
+ // in each case, check to make sure enough space in array
+
+ if (array is bool[])
+ {
+ if (index + m_length >= array.Length)
+ throw new ArgumentException();
+
+ bool [] barray = (bool []) array;
+
+ // Copy the bits into the array
+ for (int i = 0; i < m_length; i++)
+ barray[index + i] = getBit(i);
+ }
+ else if (array is byte[])
+ {
+ int numbytes = bitsToBytes(m_length);
+ if (index + numbytes >= array.Length)
+ throw new ArgumentException();
+
+ byte [] barray = (byte []) array;
+ // Copy the bytes into the array
+ for (int i = 0; i < numbytes; i++)
+ barray[index + i] = getByte(i);
+ }
+ else if (array is int[])
+ {
+ int numints = bitsToInts(m_length);
+ if (index + numints >= array.Length)
+ throw new ArgumentException();
+ Array.Copy(m_array, 0, array, index, numints);
+ }
+ else
+ {
+ throw new InvalidCastException();
+ }
+ }
+
+
+ /*
+ * All this code for nothing... Apparently, The MS BitArray doesn't
+ * override Equals!
+ *public override bool Equals(object obj)
+ {
+ // If it's not a BitArray, then it can't be equal to us.
+ if (!(obj is BitArray))
+ return false;
+
+ // If the references are equal, then clearly the instances are equal
+ if (this == obj)
+ return true;
+
+ // If its length is different, than it can't be equal.
+ BitArray b = (BitArray) obj;
+ if (m_length != b.m_length)
+ return false;
+
+
+ // Now compare the bits.
+ // This is a little tricky, because if length doesn't divide 32,
+ // then we shouldn't compare the unused bits in the last element
+ // of m_array.
+
+ // Compare all full ints. If any differ, then we are not equal.
+ int numints = m_length/32;
+ for (int i = 0; i < numints; i++)
+ {
+ if (b.m_array[i] != m_array[i])
+ return false;
+ }
+
+ // Compare the left over bits (if any)
+ int extrabits = m_length%32;
+ if (extrabits != 0)
+ {
+ // our mask is the "extrabits" least significant bits set to 1.
+ UInt32 comparemask = ~0U >> (32 - extrabits);
+
+ // numints is rounded down, so it's safe to use as an index here,
+ // as long as extrabits > 0.
+ if ((b.m_array[numints] & comparemask)
+ != (m_array[numints] & comparemask))
+ return false;
+ }
+
+ // We passed through all the above, so we are equal.
+ return true;
+
+ }
+ * End comment out of Equals()
+ */
+
+ public bool Get(int index)
+ {
+ if (index < 0 || index >= m_length)
+ throw new ArgumentOutOfRangeException();
+ return getBit(index);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return new BitArrayEnumerator(this);
+ }
+
+ /*
+ * Since MS doesn't appear to override Equals/GetHashCode, we don't.
+ *public override int GetHashCode()
+ {
+ // We could make this a constant time function
+ // by just picking a constant number of bits, spread out
+ // evenly across the entire array. For now, this will suffice.
+
+ int retval = m_length;
+
+ // Add in each array element, except for the leftover bits.
+ int numints = m_length/32;
+ for (int i = 0; i < numints; i++)
+ retval += (int)m_array[i];
+
+ // That's enough. Adding in the leftover bits is tiring.
+
+ return retval;
+ }
+ * End comment out of GetHashCode()
+ */
+
+ public BitArray Not()
+ {
+ Int32 [] newarr = new Int32[m_array.Length];
+ for (int i=0; i < m_array.Length; i++)
+ newarr[i] = ~m_array[i];
+
+ return new BitArray(newarr, m_length);
+ }
+
+ public BitArray Or(BitArray operand)
+ {
+ if (operand == null)
+ throw new ArgumentNullException();
+ if (operand.m_length != m_length)
+ throw new ArgumentException();
+
+ Int32 [] newarr = new Int32[m_array.Length];
+ for (int i=0; i < m_array.Length; i++)
+ newarr[i] = m_array[i] | operand.m_array[i];
+
+ return new BitArray(newarr, m_length);
+ }
+
+ public void Set(int index, bool value)
+ {
+ if (index < 0 || index >= m_length)
+ throw new ArgumentOutOfRangeException();
+ setBit(index, value);
+ }
+
+ public void SetAll(bool value)
+ {
+ if (value)
+ {
+ for (int i = 0; i < m_array.Length; i++)
+ m_array[i] = ~0;
+
+ // clear out the junk bits that we might have set
+ clearJunk(m_array, m_length);
+ }
+ else
+ Array.Clear(m_array, 0, m_array.Length);
+
+
+ m_modCount++;
+ }
+
+ public BitArray Xor(BitArray operand)
+ {
+ if (operand == null)
+ throw new ArgumentNullException();
+ if (operand.m_length != m_length)
+ throw new ArgumentException();
+
+ Int32 [] newarr = new Int32[m_array.Length];
+ for (int i=0; i < m_array.Length; i++)
+ newarr[i] = m_array[i] ^ operand.m_array[i];
+
+ return new BitArray(newarr, m_length);
+ }
+
+ class BitArrayEnumerator : IEnumerator
+ {
+ BitArray m_bitArray;
+ private bool m_current;
+ private int m_index;
+ private int m_max;
+ private int m_modCount;
+
+ public BitArrayEnumerator(BitArray ba)
+ {
+ m_index = -1;
+ m_bitArray = ba;
+ m_max = ba.m_length;
+ m_modCount = ba.m_modCount;
+ }
+
+ public object Current
+ {
+ get
+ {
+ if (m_index < 0 || m_index >= m_max)
+ throw new InvalidOperationException();
+ return m_current;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ if (m_modCount != m_bitArray.m_modCount)
+ throw new InvalidOperationException();
+
+ if (m_index + 1 >= m_max)
+ return false;
+
+ m_index++;
+ m_current = m_bitArray[m_index];
+ return true;
+ }
+
+ public void Reset()
+ {
+ if (m_modCount != m_bitArray.m_modCount)
+ throw new InvalidOperationException();
+ m_index = -1;
+ }
+ }
+ }
+}
+
+
+
+
+
diff --git a/mcs/class/corlib/System.Collections/CaseInsensitiveComparer.cs b/mcs/class/corlib/System.Collections/CaseInsensitiveComparer.cs
new file mode 100644
index 00000000000..b04c89aa11d
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/CaseInsensitiveComparer.cs
@@ -0,0 +1,77 @@
+//
+// System.Collections.CaseInsensitiveComparer
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+
+
+using System;
+using System.Collections;
+
+
+
+namespace System.Collections {
+
+ [Serializable]
+ public class CaseInsensitiveComparer : IComparer {
+
+ private static CaseInsensitiveComparer singleton;
+
+
+ // Class constructor
+
+ static CaseInsensitiveComparer ()
+ {
+ singleton=new CaseInsensitiveComparer ();
+ }
+
+
+ // Public instance constructor
+
+ public CaseInsensitiveComparer ()
+ {
+ }
+
+
+
+ //
+ // Public static properties
+ //
+
+ public static CaseInsensitiveComparer Default {
+ get {
+ return singleton;
+ }
+ }
+
+
+ //
+ // Instance methods
+ //
+
+ //
+ // IComparer
+ //
+
+ public int Compare (object a, object b)
+ {
+ string str1 = a as string;
+ string str2 = b as string;
+
+
+ int res = 0;
+
+ if (str1 != null && str2 != null) {
+ res = String.Compare (str1, str2, true);
+ }
+
+ return res;
+ }
+
+
+
+ } // CaseInsensitiveComparer
+}
+
diff --git a/mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs b/mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs
new file mode 100644
index 00000000000..109ae18a40b
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/CaseInsensitiveHashCodeProvider.cs
@@ -0,0 +1,92 @@
+//
+// System.Collections.CaseInsensitiveHashCodeProvider
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+
+
+using System;
+using System.Collections;
+
+
+
+namespace System.Collections {
+
+ [Serializable]
+ public class CaseInsensitiveHashCodeProvider : IHashCodeProvider {
+
+ private static CaseInsensitiveHashCodeProvider singleton;
+
+
+ // Class constructor
+
+ static CaseInsensitiveHashCodeProvider ()
+ {
+ singleton=new CaseInsensitiveHashCodeProvider ();
+ }
+
+
+
+ // Public instance constructor
+
+ public CaseInsensitiveHashCodeProvider ()
+ {
+ }
+
+
+
+ //
+ // Public static properties
+ //
+
+ public static CaseInsensitiveHashCodeProvider Default {
+ get {
+ return singleton;
+ }
+ }
+
+
+ //
+ // Instance methods
+ //
+
+ //
+ // IHashCodeProvider
+ //
+
+ [MonoTODO]
+ public int GetHashCode (object obj)
+ {
+ if (obj == null) {
+ throw new ArgumentNullException ("obj is null");
+ }
+
+ string str = obj as string;
+
+ if (str == null) {
+ // FIXME:
+ return 0;
+ }
+
+ int h = 0;
+ char c;
+
+ if (str.Length > 0) {
+ for (int i = 0;i<str.Length;i++) {
+ c = str [i];
+
+ if (Char.IsLetter (c))
+ c = Char.ToLower (c);
+
+ h = h * 31 + c;
+ }
+ }
+
+ return h;
+ }
+
+ } // CaseInsensitiveHashCodeProvider
+}
+
diff --git a/mcs/class/corlib/System.Collections/ChangeLog b/mcs/class/corlib/System.Collections/ChangeLog
new file mode 100644
index 00000000000..6f391ffbf85
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/ChangeLog
@@ -0,0 +1,190 @@
+2002-03-24 Duncan Mak <duncan@ximian.com>
+
+ * SortedList.cs (Synchronized): Stubbed out a missing method
+ pointed out by Jakk Simm's test suite.
+
+2002-03-14 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayList.cs (FixedSize(ArrayList)): should return an ArrayList. The
+ other FixedSize() methods returns an IList.
+
+2002-03-13 Duncan Mak <duncan@ximian.com>
+
+ * ArrayList.cs (FixedSize): Changed the return type to IList if
+ the argument is an IList.
+ (Synchronized): Ditto here.
+
+2002-03-08 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * Hashtable.cs: Fixed ToPrime () bug. Removed ALLOC_GRAIN.
+ Removed unused code from static constructor.
+ GetObjectData () - Version is the same as modificationCount.
+
+2002-02-20 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayList.cs: Add MonoTODO's where necessary. Fix bugs discovered
+ by Bucky's tests. Implement a couple of things that were left undone.
+
+Mon Feb 11 19:49:25 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ArrayList.cs: Dick's fix to contructor.
+
+2002-02-07 Duncan Mak <duncan@ximian.com>
+
+ * Hashtable.cs: Implemented parts of the ISerializable
+ interface. GetObjectData () is good, but serialization constructor
+ needs some more love.
+
+Sat Jan 5 15:56:54 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Hashtable.cs: the IDictionaryEnumerator returns DictionaryEntries.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * Correct name to MonoTODO everywhere.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * ArrayList.cs : Setting an index does not implicitly
+ extend the arraylist : remove FIXME.
+
+ Decorate incomplete elements with the TODO attribute.
+
+ * BitArray.cs : Insert TODO attributes where appropriate.
+
+ * CaseInsensitiveHashcodeProvider.cs: Ditto.
+
+ * Hashtable.cs, SortedList.cs : Ditto.
+
+Thu Dec 13 20:17:08 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ArrayList.cs: implemented AddRange(), CopyTo().
+
+2001-11-19 Miguel de Icaza <miguel@ximian.com>
+
+ * DictionaryBase.cs: Implemented.
+
+Wed Nov 14 16:45:49 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ArrayList.cs: implement ArrayListEnumerator.
+ * Hashtable.cs: hardcode the prime number table.
+
+2001-11-06 Nick Drochak <ndrochak@gol.com>
+ * Queue.cs: Fixes from Ricardardo. QueueTest also updated.
+
+2001-11-04 Nick Drochak <ndrochak@gol.com>
+ * Queue.cs: Fixed small syntax errors that were preventing the compile.
+ I changed the build file to include Queue.cs as well.
+
+2001-11-04 Nick Drochak <ndrochak@gol.com>
+ * ArrayList.cs: Fixed "off by one" error when shifting left the array when
+ items are removed.
+
+ * CollectionBase.cs: Added OnValidate(), OnRemove() and OnRemoveComplete()
+ hook methods to the RemoveAt() method.
+
+2001-11-04 Nick Drochak <ndrochak@gol.com>
+ * ArrayList.cs: Added private enumerator class and make GetEnumerator()
+ methods return an instance of it.
+
+Tue Sep 25 18:52:48 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ArrayList.cs: fix Insert () to check capacity, not count.
+
+Tue Sep 25 16:54:54 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * DictionaryEntry.cs: added.
+
+2001-08-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * common.src: removed duplicate entries
+
+2001-08-08 Nick Drochak <ndrochak@gol.com>
+
+ * ReadOnlyCollectionBase.cs: Initialized private member.
+ * CollectionBase.cs: Initialized private member.
+ * common.src : Added ReadOnlyCollectionBase.cs and CollectionBase.cs
+ * /mcs/class/makefile: Used $(SYSTEMROOT) instead of hard coded //c/winnt
+ * /mcs/makefile: Used $(SYSTEMROOT) instead of hard coded //c/winnt
+
+2001-08-08 Nick Drochak <nick@jobdragon.com>
+
+ * CollectionBase.cs: Add
+ * ReadOnlyCollectionBase.cs: Add
+ * CollectionBaseTest.cs: Add
+ * ReadOnlyCollectionBaseTest.cs: Add
+
+2001-07-31 Garrett Rooney <rooneg@electricjellyfish.net>
+
+ * StackTest.cs: Add Test case for System.Collections.Stack.
+ Contributed by Chris Hynes <chrish@assistedsolutions.com>
+
+2001-07-30 Garrett Rooney <rooneg@electricjellyfish.net>
+
+ * Stack.cs: Clone() doesn't need to check if it's synchronized, since
+ we override it in SyncStack anyway...
+
+ * Stack.cs: Pop() now shrinks the array if we drop below 1/4 full, to
+ avoid using massive amounts of memory that are not necessary. We only
+ drop to half the current size, which I hope will avoid the 'ping-pong'
+ effect.
+
+ * Stack.cs: SyncStack.IsReadOnly should return stack.IsReadOnly
+ instead of just returning false, since we may have a ReadOnly wrapper
+ in the future (although i can't imagine why). Thanks to David
+ Menestrina <dmenest@yahoo.com> for pointing this out.
+
+2001-07-23 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * Hashtable.cs: Fixed bug in Clear(), the Count wasn't zeroed.
+ From now, Clear() increases modification count.
+ Fixed HCP bug in GetHash(object) - hcp.GetHashCode() was used
+ instead of hcp.GetHashCode(key). This was resulted in the
+ insanely long lookup times when HashCodeProvider was used to
+ construct Hashtable. Added thread-safe wrapper.
+
+2001-07-16 David Menestrina <dmenest@yahoo.com>
+
+ * BitArray.cs: Add
+ * BitArrayTest.cs: Add
+
+2001-07-18 Miguel de Icaza <miguel@ximian.com>
+
+ * IDictionary.cs (Collections): IDictionary implements ICollection
+ as well. Thanks Sergey!
+
+2001-07-18 Garrett Rooney <rooneg@electricjellyfish.net>
+
+ * Stack.cs Removed unnecessary locking from many methods of
+ SyncStack, removed SyncEnumerator because it was unnecessary,
+ added a modCount member to Stack and Stack.Enumerator, to
+ ensure that the Stack has not been modified out form under the
+ Enumerator, and changed the Enumerator to use a reference to the
+ stack rather than copying over the contents array.
+
+2001-07-17 David Menestrina <dmenest@yahoo.com>
+
+ * Added implementation of BitArray.
+
+2001-07-17 Miguel de Icaza <miguel@ximian.com>
+
+ * Hashtable.cs: Removed call to d.Count in the Hashtable
+ constructor that takes an IDictionary as IDictionary does not
+ provide a Count field.
+
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * IDictionary.cs: Clear was clear.
+
+2001-07-13 Miguel de Icaza <miguel@ximian.com>
+
+ * All files: Renamespace things to System.
+
+2001-07-05 Vladimir Vukicevic <vladimir@ximian.com>
+
+ * ArrayList.cs: initial checkin and implementation
+
+ * ICollection.cs, IComprarer.cs, IDictionary.cs,
+ IDictionaryEnumerator.cs, IEnumerable.cs, IHashCodeProvider.cs,
+ IList.cs: initial checkin
+
diff --git a/mcs/class/corlib/System.Collections/CollectionBase.cs b/mcs/class/corlib/System.Collections/CollectionBase.cs
new file mode 100644
index 00000000000..743888a3849
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/CollectionBase.cs
@@ -0,0 +1,137 @@
+//
+// System.Collections.CollectionBase.cs
+//
+// Author:
+// Nick Drochak II (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+using System;
+
+namespace System.Collections {
+
+ [Serializable]
+ public abstract class CollectionBase : IList, ICollection, IEnumerable {
+
+ // private instance properties
+ private ArrayList myList;
+
+ // public instance properties
+ public int Count { get { return InnerList.Count; } }
+
+ // Public Instance Methods
+ public IEnumerator GetEnumerator() { return InnerList.GetEnumerator(); }
+ public void Clear() {
+ OnClear();
+ InnerList.Clear();
+ OnClearComplete();
+ }
+ public void RemoveAt (int index) {
+ object objectToRemove;
+ objectToRemove = InnerList[index];
+ OnValidate(objectToRemove);
+ OnRemove(index, objectToRemove);
+ InnerList.RemoveAt(index);
+ OnRemoveComplete(index, objectToRemove);
+ }
+
+ // Protected Instance Constructors
+ protected CollectionBase() {
+ this.myList = new ArrayList();
+ }
+
+ // Protected Instance Properties
+ protected ArrayList InnerList {get { return this.myList; } }
+ protected IList List {get { return this; } }
+
+ // Protected Instance Methods
+ protected virtual void OnClear() { }
+ protected virtual void OnClearComplete() { }
+
+ protected virtual void OnInsert(int index, object value) { }
+ protected virtual void OnInsertComplete(int index, object value) { }
+
+ protected virtual void OnRemove(int index, object value) { }
+ protected virtual void OnRemoveComplete(int index, object value) { }
+
+ protected virtual void OnSet(int index, object oldValue, object newValue) { }
+ protected virtual void OnSetComplete(int index, object oldValue, object newValue) { }
+
+ protected virtual void OnValidate(object value) {
+ if (null == value) {
+ throw new System.ArgumentNullException("CollectionBase.OnValidate: Invalid parameter value passed to method: null");
+ }
+ }
+
+ // ICollection methods
+ void ICollection.CopyTo(Array array, int index) {
+ InnerList.CopyTo(array, index);
+ }
+ object ICollection.SyncRoot {
+ get { return InnerList.SyncRoot; }
+ }
+ bool ICollection.IsSynchronized {
+ get { return InnerList.IsSynchronized; }
+ }
+
+ // IList methods
+ int IList.Add (object value) {
+ int newPosition;
+ OnValidate(value);
+ newPosition = InnerList.Count;
+ OnInsert(newPosition, value);
+ InnerList.Add(value);
+ OnInsertComplete(newPosition, value);
+ return newPosition;
+ }
+
+ bool IList.Contains (object value) {
+ return InnerList.Contains(value);
+ }
+
+ int IList.IndexOf (object value) {
+ return InnerList.IndexOf(value);
+ }
+
+ void IList.Insert (int index, object value) {
+ OnValidate(value);
+ OnInsert(index, value);
+ InnerList.Insert(index, value);
+ OnInsertComplete(index, value);
+ }
+
+ void IList.Remove (object value) {
+ int removeIndex;
+ OnValidate(value);
+ removeIndex = InnerList.IndexOf(value);
+ OnRemove(removeIndex, value);
+ InnerList.Remove(value);
+ OnRemoveComplete(removeIndex, value);
+ }
+
+ // IList properties
+ bool IList.IsFixedSize {
+ get { return InnerList.IsFixedSize; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return InnerList.IsReadOnly; }
+ }
+
+ object IList.this[int index] {
+ get { return InnerList[index]; }
+ set {
+ object oldValue;
+ // make sure we have been given a valid value
+ OnValidate(value);
+ // save a reference to the object that is in the list now
+ oldValue = InnerList[index];
+
+ OnSet(index, oldValue, value);
+ InnerList[index] = value;
+ OnSetComplete(index, oldValue, value);
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/Comparer.cs b/mcs/class/corlib/System.Collections/Comparer.cs
new file mode 100644
index 00000000000..6591c70334c
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/Comparer.cs
@@ -0,0 +1,56 @@
+//
+// System.Collections.Comparer
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+
+using System;
+using System.Collections;
+
+
+namespace System.Collections {
+
+ [Serializable]
+ public sealed class Comparer : IComparer {
+
+ public static readonly Comparer Default;
+
+
+ // Class constructor
+
+ static Comparer ()
+ {
+ Default = new Comparer ();
+ }
+
+
+
+ // Public instance constructor
+
+ private Comparer ()
+ {
+ }
+
+
+
+ // IComparer
+
+ public int Compare (object a, object b)
+ {
+ if (a == b)
+ return 0;
+ else if (a == null)
+ return -1;
+ else if (b == null)
+ return 1;
+ else if (a is IComparable)
+ return (a as IComparable).CompareTo (b);
+ else if (b is IComparable)
+ return -(b as IComparable).CompareTo (a);
+
+ throw new ArgumentException ("Neither a nor b IComparable");
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/DictionaryBase.cs b/mcs/class/corlib/System.Collections/DictionaryBase.cs
new file mode 100755
index 00000000000..ba01e9cdace
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/DictionaryBase.cs
@@ -0,0 +1,372 @@
+//
+// System.Collections.DictionaryBase.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Collections {
+
+ /// <summary>
+ /// An abstract class that provides a simple way to monitor changes to a
+ /// Hashtable. Derived classes overwrite one or more of the `On' methods
+ /// to track the changes to the Hashtable.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// This class is a base class that can simplify the development of
+ /// strongly typed collections. The idea being that the insertion of elements
+ /// into the Hashtable can be forced to be of a given type.
+ ///
+ /// The `On' members are protected and designed to be used only by derived
+ /// classes.
+ /// </remarks>
+ [Serializable]
+ public abstract class DictionaryBase : IDictionary, ICollection, IEnumerable {
+
+ Hashtable dictionary;
+
+ protected DictionaryBase ()
+ {
+ dictionary = new Hashtable ();
+ }
+
+ /// <summary>
+ /// Clears the contents of the dictionary
+ /// </summary>
+ public void Clear ()
+ {
+ OnClear ();
+ dictionary.Clear ();
+ OnClearComplete ();
+ }
+
+ /// <summary>
+ /// Returns the number of items in the dictionary
+ /// </summary>
+ public int Count {
+ get {
+ return dictionary.Count;
+ }
+ }
+
+ /// <summary>
+ /// The collection contained as an IDictionary
+ /// </summary>
+ protected IDictionary Dictionary {
+ get {
+ return dictionary;
+ }
+ }
+
+ /// <summary>
+ /// The internal Hashtable representation for this dictionary
+ /// </summary>
+ protected Hashtable InnerHashtable {
+ get {
+ return dictionary;
+ }
+ }
+
+ /// <summary>
+ /// Copies the contents of the Dictionary into the target array
+ /// </summary>
+ /// <param name="array">
+ /// The array to copy the contents of the dictionary to. The
+ /// array must have a zero-based indexing
+ /// </param>
+ /// <param name="index">
+ /// Starting index within the array where to copy the objects
+ /// to.
+ /// </param>
+ public void CopyTo (Array array, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException ("array");
+ if (index < 0)
+ throw new ArgumentOutOfRangeException ("index must be possitive");
+ if (array.Rank > 1)
+ throw new ArgumentException ("array is multidimensional");
+ int size = array.Length;
+ if (index > size)
+ throw new ArgumentException ("index is larger than array size");
+ if (index + Count > size)
+ throw new ArgumentException ("Copy will overlflow array");
+
+ DoCopy (array, index);
+ }
+
+ /// <summary>
+ /// Internal routine called by CopyTo to perform the actual
+ /// copying of the data
+ /// </summary>
+ private void DoCopy (Array array, int index)
+ {
+ foreach (DictionaryEntry de in dictionary)
+ array.SetValue (de, index++);
+ }
+
+ /// <summary>
+ /// Returns an enumerator for the dictionary
+ /// </summary>
+ public IDictionaryEnumerator GetEnumerator ()
+ {
+ return dictionary.GetEnumerator ();
+ }
+
+ /// <summary>
+ /// Hook invoked before the clear operation
+ /// is performed on the DictionaryBase
+ /// </summary>
+ protected virtual void OnClear ()
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked after the clear operation
+ /// is performed on the DictionaryBase
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The default implementation does nothing, derived classes
+ /// can override this method to be notified of changes
+ /// </remarks>
+ protected virtual void OnClearComplete ()
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked while fetching data from the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// This method is provided as a simple way to override the values
+ /// returned by the DictionaryBase.
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to retrieve</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual object OnGet (object key, object current_value)
+ {
+ return current_value;
+ }
+
+ /// <summary>
+ /// Hook invoked before inserting data into the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Derived classes can override this method and perform some
+ /// action before the <paramref name="current_value"/> is inserted
+ /// into the dictionary.
+ ///
+ /// The default implementation does nothing, derived classes
+ /// can override this method to be notified of changes
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to insert</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnInsert (object key, object current_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked after inserting the data into the DictionaryBase
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The default implementation does nothing, derived classes
+ /// can override this method to be notified of changes
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to insert</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnInsertComplete (object key, object current_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked before changing a value for a key in the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Derived classes can override this method and perform some
+ /// action before the <paramref name="current_value"/> is changed
+ /// in the dictionary.
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to change</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnSet (object key, object current_value, object new_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked after changing a value for a key in the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The default implementation does nothing, derived classes
+ /// can override this method to be notified of changes
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to change</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnSetComplete (object key, object current_value, object new_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked before removing a key/value from the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Derived classes can override this method and perform some
+ /// action before the <paramref name="current_value"/> is removed
+ /// from the dictionary.
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to remove</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnRemove (object key, object current_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked after removing a key/value from the DictionaryBase.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The default implementation does nothing, derived classes
+ /// can override this method to be notified of changes.
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to remove</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnRemoveComplete (object key, object current_value)
+ {
+ }
+
+ /// <summary>
+ /// Hook invoked after the value has been validated
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The default implementation does nothing, derived classes
+ /// can override this method to monitor the DictionaryBase.
+ /// </remarks>
+ ///
+ /// <param name="key">Key of the object to retrieve</param>
+ /// <param name="current_value">Current value of the object associated with
+ /// <paramref name="key"/></param>
+ protected virtual void OnValidate (object key, object current_value)
+ {
+ }
+
+ bool IDictionary.IsFixedSize {
+ get {
+ return false;
+ }
+ }
+
+ bool IDictionary.IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ object IDictionary.this [object key] {
+ get {
+ object value = dictionary [key];
+
+ OnGet (key, value);
+ return value;
+ }
+
+ set {
+ if (dictionary.ContainsKey (key)){
+ object current_value = dictionary [key];
+ OnSet (key, current_value, value);
+ dictionary [key] = value;
+ OnSetComplete (key, current_value, value);
+ } else {
+ OnInsert (key, value);
+ dictionary [key] = value;
+ OnInsertComplete (key, value);
+ }
+ }
+ }
+
+ ICollection IDictionary.Keys {
+ get {
+ return dictionary.Keys;
+ }
+ }
+
+ ICollection IDictionary.Values {
+ get {
+ return dictionary.Values;
+ }
+ }
+
+ /// <summary>
+ /// Adds a key/value pair to the dictionary.
+ /// </summary>
+ void IDictionary.Add (object key, object value)
+ {
+ OnInsert (key, value);
+ dictionary.Add (key, value);
+ OnInsertComplete (key, value);
+ }
+
+ /// <summary>
+ /// Removes a Dictionary Entry based on its key
+ /// </summary>
+ void IDictionary.Remove (object key)
+ {
+ if (! dictionary.ContainsKey (key))
+ return;
+
+ object value = dictionary [key];
+ OnRemove (key, value);
+ dictionary.Remove (key);
+ OnRemoveComplete (key, value);
+ }
+
+ /// <summary>
+ /// Tests whether the dictionary contains an entry
+ /// </summary>
+ bool IDictionary.Contains (object key)
+ {
+ return dictionary.Contains (key);
+ }
+
+ bool ICollection.IsSynchronized {
+ get {
+ return dictionary.IsSynchronized;
+ }
+ }
+
+ object ICollection.SyncRoot {
+ get {
+ return dictionary.SyncRoot;
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return dictionary.GetEnumerator ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/DictionaryEntry.cs b/mcs/class/corlib/System.Collections/DictionaryEntry.cs
new file mode 100644
index 00000000000..e6cafab7cda
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/DictionaryEntry.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace System.Collections {
+
+ [Serializable]
+ public struct DictionaryEntry {
+ private object key;
+ private object val;
+
+ public DictionaryEntry( object k, object value) {
+ key = k;
+ val = value;
+ }
+
+ public object Key {
+ get {return key;}
+ set {key = value;}
+ }
+ public object Value {
+ get {return val;}
+ set {val = value;}
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/Hashtable.cs b/mcs/class/corlib/System.Collections/Hashtable.cs
new file mode 100644
index 00000000000..024af127fb4
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/Hashtable.cs
@@ -0,0 +1,1031 @@
+//
+// System.Collections.Hashtable
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+
+// TODO: Interfaces to implement: ISerializable and IDeserializationCallback;
+
+
+namespace System.Collections {
+
+ [MonoTODO]
+ [Serializable]
+ public class Hashtable : IDictionary, ICollection,
+ IEnumerable, ICloneable, ISerializable, IDeserializationCallback
+ {
+
+ internal struct Slot {
+ internal Object key;
+
+ internal Object value;
+
+ // Hashcode. Chains are also marked through this.
+ internal int hashMix;
+ }
+
+ //
+ // Private data
+ //
+
+ private readonly static int CHAIN_MARKER = ~Int32.MaxValue;
+
+
+ // Used as indicator for the removed parts of a chain.
+ private readonly static Object REMOVED_MARKER = new Object ();
+
+
+ private int inUse;
+ private int modificationCount;
+ private float loadFactor;
+ private Slot [] table;
+ private int threshold;
+
+ private IHashCodeProvider hcpRef;
+ private IComparer comparerRef;
+
+ private static int [] primeTbl = {
+ 11,
+ 19,
+ 37,
+ 73,
+ 109,
+ 163,
+ 251,
+ 367,
+ 557,
+ 823,
+ 1237,
+ 1861,
+ 2777,
+ 4177,
+ 6247,
+ 9371,
+ 14057,
+ 21089,
+ 31627,
+ 47431,
+ 71143,
+ 106721,
+ 160073,
+ 240101,
+ 360163,
+ 540217,
+ 810343,
+ 1215497,
+ 1823231,
+ 2734867,
+ 4102283,
+ 6153409,
+ 9230113,
+ 13845163
+ };
+
+ // Class constructor
+
+ static Hashtable () {
+ // NOTE: previously this static constructor was used
+ // to calculate primeTbl, now primeTbl is
+ // hardcoded and constructor does nothing
+ // useful except for forcing compiler to
+ // eliminate beforefieldinit from signature.
+ }
+
+
+ //
+ // Constructors
+ //
+
+ public Hashtable () : this (0, 1.0f) {}
+
+
+ public Hashtable (int capacity, float loadFactor, IHashCodeProvider hcp, IComparer comparer) {
+ if (capacity<0)
+ throw new ArgumentOutOfRangeException ("negative capacity");
+
+ if (loadFactor<0.1 || loadFactor>1)
+ throw new ArgumentOutOfRangeException ("load factor");
+
+ if (capacity == 0) ++capacity;
+ this.loadFactor = 0.75f*loadFactor;
+ int size = (int) (capacity/this.loadFactor);
+ size = ToPrime (size);
+ this.SetTable (new Slot [size]);
+
+ this.hcp = hcp;
+ this.comparer = comparer;
+
+ this.inUse = 0;
+ this.modificationCount = 0;
+
+ }
+
+ public Hashtable (int capacity, float loadFactor) :
+ this (capacity, loadFactor, null, null)
+ {
+ }
+
+ public Hashtable (int capacity) : this (capacity, 1.0f)
+ {
+ }
+
+ public Hashtable (int capacity,
+ IHashCodeProvider hcp,
+ IComparer comparer)
+ : this (capacity, 1.0f, hcp, comparer)
+ {
+ }
+
+
+ public Hashtable (IDictionary d, float loadFactor,
+ IHashCodeProvider hcp, IComparer comparer)
+ : this (d!=null ? d.Count : 0,
+ loadFactor, hcp, comparer)
+ {
+
+ if (d == null)
+ throw new ArgumentNullException ("dictionary");
+
+ IDictionaryEnumerator it = d.GetEnumerator ();
+ while (it.MoveNext ()) {
+ Add (it.Key, it.Value);
+ }
+
+ }
+
+ public Hashtable (IDictionary d, float loadFactor)
+ : this (d, loadFactor, null, null)
+ {
+ }
+
+
+ public Hashtable (IDictionary d) : this (d, 1.0f)
+ {
+ }
+
+ public Hashtable (IDictionary d, IHashCodeProvider hcp, IComparer comparer)
+ : this (d, 1.0f, hcp, comparer)
+ {
+ }
+
+ public Hashtable (IHashCodeProvider hcp, IComparer comparer)
+ : this (1, 1.0f, hcp, comparer)
+ {
+ }
+
+ [MonoTODO]
+ protected Hashtable (SerializationInfo info, StreamingContext context)
+ {
+// loadFactor = info.GetValue ("LoadFactor", Type.GetType ("System.Float"));
+// comparerRef = info.GetValue ("Comparer", typeof (object));
+// hcpRef = info.GetValue ("HashCodeProvider", typeof (object));
+// this.Count = info.GetValue ("HashSize");
+// this.Keys = info.GetValue ("Keys");
+// this.Values = info.GetValue ("Values");
+ }
+
+ //
+ // Properties
+ //
+
+ protected IComparer comparer {
+ set {
+ comparerRef = value;
+ }
+ get {
+ return comparerRef;
+ }
+ }
+
+ protected IHashCodeProvider hcp {
+ set {
+ hcpRef = value;
+ }
+ get {
+ return hcpRef;
+ }
+ }
+
+ // ICollection
+
+ public virtual int Count {
+ get {
+ return inUse;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {
+ return this;
+ }
+ }
+
+
+
+ // IDictionary
+
+ public virtual bool IsFixedSize {
+ get {
+ return false;
+ }
+ }
+
+
+ public virtual bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public virtual ICollection Keys {
+ get {
+ return new HashKeys (this);
+ }
+ }
+
+ public virtual ICollection Values {
+ get {
+ return new HashValues (this);
+ }
+ }
+
+
+
+ public virtual Object this [Object key] {
+ get {
+ return GetImpl (key);
+ }
+ set {
+ PutImpl (key, value, true);
+ }
+ }
+
+
+
+
+ //
+ // Interface methods
+ //
+
+
+ // IEnumerable
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new Enumerator (this, EnumeratorMode.KEY_MODE);
+ }
+
+
+ // ICollection
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ IDictionaryEnumerator it = GetEnumerator ();
+ int i = arrayIndex;
+
+ while (it.MoveNext ()) {
+ array.SetValue (it.Entry, i++);
+ }
+ }
+
+
+ // IDictionary
+
+ public virtual void Add (Object key, Object value)
+ {
+ PutImpl (key, value, false);
+ }
+
+ public virtual void Clear ()
+ {
+ for (int i = 0;i<table.Length;i++) {
+ table [i].key = null;
+ table [i].value = null;
+ table [i].hashMix = 0;
+ }
+
+ inUse = 0;
+ modificationCount++;
+ }
+
+ public virtual bool Contains (Object key)
+ {
+ return (Find (key) >= 0);
+ }
+
+ public virtual IDictionaryEnumerator GetEnumerator ()
+ {
+ return new Enumerator (this, EnumeratorMode.ENTRY_MODE);
+ }
+
+ public virtual void Remove (Object key)
+ {
+ int i = Find (key);
+ Slot [] table = this.table;
+ if (i >= 0) {
+ int h = table [i].hashMix;
+ h &= CHAIN_MARKER;
+ table [i].hashMix = h;
+ table [i].key = (h != 0)
+ ? REMOVED_MARKER
+ : null;
+ table [i].value = null;
+ --inUse;
+ ++modificationCount;
+ }
+ }
+
+
+
+
+ public virtual bool ContainsKey (object key)
+ {
+ return Contains (key);
+ }
+
+ public virtual bool ContainsValue (object value)
+ {
+ int size = this.table.Length;
+ Slot [] table = this.table;
+
+ for (int i = 0; i < size; i++) {
+ Slot entry = table [i];
+ if (entry.key != null && entry.key!= REMOVED_MARKER
+ && value.Equals (entry.value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ // ICloneable
+
+ public virtual object Clone ()
+ {
+ Hashtable ht = new Hashtable (Count, hcp, comparer);
+ ht.modificationCount = this.modificationCount;
+ ht.inUse = this.inUse;
+ ht.AdjustThreshold ();
+
+ // FIXME: maybe it's faster to simply
+ // copy the back-end array?
+
+ IDictionaryEnumerator it = GetEnumerator ();
+ while (it.MoveNext ()) {
+ ht [it.Key] = it.Value;
+ }
+
+ return ht;
+ }
+
+ [MonoTODO]
+ public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("LoadFactor", loadFactor);
+ info.AddValue ("Version", modificationCount);
+ info.AddValue ("Comparer", comparerRef);
+ info.AddValue ("HashCodeProvider", hcpRef);
+ info.AddValue ("HashSize", this.Count );
+ info.AddValue ("Keys", this.Keys);
+ info.AddValue ("Values", this.Values);
+ }
+
+ [MonoTODO]
+ public virtual void OnDeserialization (object sender)
+ {
+ throw new NotImplementedException ();
+ }
+
+ /// <summary>
+ /// Returns a synchronized (thread-safe)
+ /// wrapper for the Hashtable.
+ /// </summary>
+ public static Hashtable Synchronized (Hashtable table)
+ {
+ return new SynchedHashtable (table);
+ }
+
+
+
+ //
+ // Protected instance methods
+ //
+
+ /// <summary>Returns the hash code for the specified key.</summary>
+ protected virtual int GetHash (Object key)
+ {
+ IHashCodeProvider hcp = this.hcp;
+ return (hcp!= null)
+ ? hcp.GetHashCode (key)
+ : key.GetHashCode ();
+ }
+
+ /// <summary>
+ /// Compares a specific Object with a specific key
+ /// in the Hashtable.
+ /// </summary>
+ protected virtual bool KeyEquals (Object item, Object key)
+ {
+ IComparer c = this.comparer;
+ if (c!= null)
+ return (c.Compare (item, key) == 0);
+ else
+ return item.Equals (key);
+ }
+
+
+
+ //
+ // Private instance methods
+ //
+
+ private void AdjustThreshold ()
+ {
+ int size = table.Length;
+
+ threshold = (int) (size*loadFactor);
+ if (this.threshold >= size)
+ threshold = size-1;
+ }
+
+ private void SetTable (Slot [] table)
+ {
+ if (table == null)
+ throw new ArgumentNullException ("table");
+
+ this.table = table;
+ AdjustThreshold ();
+ }
+
+ private Object GetImpl (Object key)
+ {
+ int i = Find (key);
+
+ if (i >= 0)
+ return table [i].value;
+ else
+ return null;
+ }
+
+
+ private int Find (Object key)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("null key");
+
+ uint size = (uint) this.table.Length;
+ int h = this.GetHash (key) & Int32.MaxValue;
+ uint spot = (uint)h;
+ uint step = (uint) ((h >> 5)+1) % (size-1)+1;
+ Slot[] table = this.table;
+
+ for (int i = 0; i < size;i++) {
+ int indx = (int) (spot % size);
+ Slot entry = table [indx];
+ Object k = entry.key;
+ if (k == null)
+ return -1;
+ if ((entry.hashMix & Int32.MaxValue) == h
+ && this.KeyEquals (key, k)) {
+ return indx;
+ }
+
+ if ((entry.hashMix & CHAIN_MARKER) == 0)
+ return -1;
+
+ spot+= step;
+ }
+ return -1;
+ }
+
+
+ private void Rehash ()
+ {
+ int oldSize = this.table.Length;
+
+ // From the SDK docs:
+ // Hashtable is automatically increased
+ // to the smallest prime number that is larger
+ // than twice the current number of Hashtable buckets
+ uint newSize = (uint)ToPrime ((oldSize<<1)|1);
+
+
+ Slot [] newTable = new Slot [newSize];
+ Slot [] table = this.table;
+
+ for (int i = 0;i<oldSize;i++) {
+ Slot s = table [i];
+ if (s.key!= null) {
+ int h = s.hashMix & Int32.MaxValue;
+ uint spot = (uint)h;
+ uint step = ((uint) (h>>5)+1)% (newSize-1)+1;
+ for (uint j = spot%newSize;;spot+= step, j = spot%newSize) {
+ // No check for REMOVED_MARKER here,
+ // because the table is just allocated.
+ if (newTable [j].key == null) {
+ newTable [j].key = s.key;
+ newTable [j].value = s.value;
+ newTable [j].hashMix |= h;
+ break;
+ } else {
+ newTable [j].hashMix |= CHAIN_MARKER;
+ }
+ }
+ }
+ }
+
+ ++this.modificationCount;
+
+ this.SetTable (newTable);
+ }
+
+
+ private void PutImpl (Object key, Object value, bool overwrite)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("null key");
+
+ uint size = (uint)this.table.Length;
+ if (this.inUse >= this.threshold) {
+ this.Rehash ();
+ size = (uint)this.table.Length;
+ }
+
+ int h = this.GetHash (key) & Int32.MaxValue;
+ uint spot = (uint)h;
+ uint step = (uint) ((spot>>5)+1)% (size-1)+1;
+ Slot [] table = this.table;
+ Slot entry;
+
+ int freeIndx = -1;
+ for (int i = 0; i < size; i++) {
+ int indx = (int) (spot % size);
+ entry = table [indx];
+
+ if (freeIndx == -1
+ && entry.key == REMOVED_MARKER
+ && (entry.hashMix & CHAIN_MARKER)!= 0)
+ freeIndx = indx;
+
+ if (entry.key == null ||
+ (entry.key == REMOVED_MARKER
+ && (entry.hashMix & CHAIN_MARKER)!= 0)) {
+
+ if (freeIndx == -1)
+ freeIndx = indx;
+ break;
+ }
+
+ if ((entry.hashMix & Int32.MaxValue) == h && KeyEquals (key, entry.key)) {
+ if (overwrite) {
+ table [indx].value = value;
+ ++this.modificationCount;
+ } else {
+ // Handle Add ():
+ // An entry with the same key already exists in the Hashtable.
+ throw new ArgumentException ("Key duplication");
+ }
+ return;
+ }
+
+ if (freeIndx == -1) {
+ table [indx].hashMix |= CHAIN_MARKER;
+ }
+
+ spot+= step;
+
+ }
+
+ if (freeIndx!= -1) {
+ table [freeIndx].key = key;
+ table [freeIndx].value = value;
+ table [freeIndx].hashMix |= h;
+
+ ++this.inUse;
+ ++this.modificationCount;
+ }
+
+ }
+
+ private void CopyToArray (Array arr, int i,
+ EnumeratorMode mode)
+ {
+ IEnumerator it = new Enumerator (this, mode);
+
+ while (it.MoveNext ()) {
+ arr.SetValue (it.Current, i++);
+ }
+ }
+
+
+
+ //
+ // Private static methods
+ //
+ private static bool TestPrime (int x)
+ {
+ if ((x & 1) != 0) {
+ for (int n = 3; n< (int)Math.Sqrt (x); n += 2) {
+ if ((x % n) == 0)
+ return false;
+ }
+ return true;
+ }
+ // There is only one even prime - 2.
+ return (x == 2);
+ }
+
+ private static int CalcPrime (int x)
+ {
+ for (int i = (x & (~1))-1; i< Int32.MaxValue; i += 2) {
+ if (TestPrime (i)) return i;
+ }
+ return x;
+ }
+
+ private static int ToPrime (int x)
+ {
+ for (int i = 0; i < primeTbl.Length; i++) {
+ if (x <= primeTbl [i])
+ return primeTbl [i];
+ }
+ return CalcPrime (x);
+ }
+
+
+
+
+ //
+ // Inner classes
+ //
+
+ public enum EnumeratorMode : int {KEY_MODE = 0, VALUE_MODE, ENTRY_MODE};
+
+ protected sealed class Enumerator : IDictionaryEnumerator, IEnumerator {
+
+ private Hashtable host;
+ private int stamp;
+ private int pos;
+ private int size;
+ private EnumeratorMode mode;
+
+ private Object currentKey;
+ private Object currentValue;
+
+ private readonly static string xstr = "Hashtable.Enumerator: snapshot out of sync.";
+
+ public Enumerator (Hashtable host, EnumeratorMode mode) {
+ this.host = host;
+ stamp = host.modificationCount;
+ size = host.table.Length;
+ this.mode = mode;
+ Reset ();
+ }
+
+ public Enumerator (Hashtable host)
+ : this (host, EnumeratorMode.KEY_MODE) {}
+
+
+ private void FailFast ()
+ {
+ if (host.modificationCount != stamp) {
+ throw new InvalidOperationException (xstr);
+ }
+ }
+
+ public void Reset ()
+ {
+ FailFast ();
+
+ pos = -1;
+ currentKey = null;
+ currentValue = null;
+ }
+
+ public bool MoveNext ()
+ {
+ FailFast ();
+
+ if (pos < size) {
+ while (++pos < size) {
+ Slot entry = host.table [pos];
+
+ if (entry.key != null && entry.key != REMOVED_MARKER) {
+ currentKey = entry.key;
+ currentValue = entry.value;
+ return true;
+ }
+ }
+ }
+
+ currentKey = null;
+ currentValue = null;
+ return false;
+ }
+
+ public DictionaryEntry Entry
+ {
+ get {
+ FailFast ();
+ return new DictionaryEntry (currentKey, currentValue);
+ }
+ }
+
+ public Object Key {
+ get {
+ FailFast ();
+ return currentKey;
+ }
+ }
+
+ public Object Value {
+ get {
+ FailFast ();
+ return currentValue;
+ }
+ }
+
+ public Object Current {
+ get {
+ FailFast ();
+ switch (mode) {
+ case EnumeratorMode.KEY_MODE:
+ return currentKey;
+ case EnumeratorMode.VALUE_MODE:
+ return currentValue;
+ case EnumeratorMode.ENTRY_MODE:
+ return new DictionaryEntry (currentKey, currentValue);
+ }
+ throw new Exception ("should never happen");
+ }
+ }
+ }
+
+
+
+ protected class HashKeys : ICollection, IEnumerable {
+
+ private Hashtable host;
+ private int count;
+
+ public HashKeys (Hashtable host) {
+ if (host == null)
+ throw new ArgumentNullException ();
+
+ this.host = host;
+ this.count = host.Count;
+ }
+
+ // ICollection
+
+ public virtual int Count {
+ get {
+ return count;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return host.IsSynchronized;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {return host.SyncRoot;}
+ }
+
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ host.CopyToArray (array, arrayIndex, EnumeratorMode.KEY_MODE);
+ }
+
+ // IEnumerable
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return new Hashtable.Enumerator (host, EnumeratorMode.KEY_MODE);
+ }
+ }
+
+
+ protected class HashValues : ICollection, IEnumerable {
+
+ private Hashtable host;
+ private int count;
+
+ public HashValues (Hashtable host) {
+ if (host == null)
+ throw new ArgumentNullException ();
+
+ this.host = host;
+ this.count = host.Count;
+ }
+
+ // ICollection
+
+ public virtual int Count {
+ get {
+ return count;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return host.IsSynchronized;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {
+ return host.SyncRoot;
+ }
+ }
+
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ host.CopyToArray (array, arrayIndex, EnumeratorMode.VALUE_MODE);
+ }
+
+ // IEnumerable
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return new Hashtable.Enumerator (host, EnumeratorMode.VALUE_MODE);
+ }
+ }
+
+
+
+ protected class SynchedHashtable : Hashtable, IEnumerable {
+
+ private Hashtable host;
+
+ public SynchedHashtable (Hashtable host) {
+ if (host == null)
+ throw new ArgumentNullException ();
+
+ this.host = host;
+ }
+
+ // ICollection
+
+ public override int Count {
+ get {
+ return host.Count;
+ }
+ }
+
+ public override bool IsSynchronized {
+ get {
+ return true;
+ }
+ }
+
+ public override Object SyncRoot {
+ get {
+ return host.SyncRoot;
+ }
+ }
+
+
+
+ // IDictionary
+
+ public override bool IsFixedSize {
+ get {
+ return host.IsFixedSize;
+ }
+ }
+
+
+ public override bool IsReadOnly {
+ get {
+ return host.IsReadOnly;
+ }
+ }
+
+ public override ICollection Keys {
+ get {
+ ICollection keys = null;
+ lock (host.SyncRoot) {
+ keys = host.Keys;
+ }
+ return keys;
+ }
+ }
+
+ public override ICollection Values {
+ get {
+ ICollection vals = null;
+ lock (host.SyncRoot) {
+ vals = host.Values;
+ }
+ return vals;
+ }
+ }
+
+
+
+ public override Object this [Object key] {
+ get {
+ return host.GetImpl (key);
+ }
+ set {
+ lock (host.SyncRoot) {
+ host.PutImpl (key, value, true);
+ }
+ }
+ }
+
+ // IEnumerable
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new Enumerator (host, EnumeratorMode.KEY_MODE);
+ }
+
+
+
+
+ // ICollection
+
+ public override void CopyTo (Array array, int arrayIndex)
+ {
+ host.CopyTo (array, arrayIndex);
+ }
+
+
+ // IDictionary
+
+ public override void Add (Object key, Object value)
+ {
+ lock (host.SyncRoot) {
+ host.PutImpl (key, value, false);
+ }
+ }
+
+ public override void Clear ()
+ {
+ lock (host.SyncRoot) {
+ host.Clear ();
+ }
+ }
+
+ public override bool Contains (Object key)
+ {
+ return (host.Find (key) >= 0);
+ }
+
+ public override IDictionaryEnumerator GetEnumerator ()
+ {
+ return new Enumerator (host, EnumeratorMode.ENTRY_MODE);
+ }
+
+ public override void Remove (Object key)
+ {
+ lock (host.SyncRoot) {
+ host.Remove (key);
+ }
+ }
+
+
+
+ public override bool ContainsKey (object key)
+ {
+ return host.Contains (key);
+ }
+
+ public override bool ContainsValue (object value)
+ {
+ return host.ContainsValue (value);
+ }
+
+
+ // ICloneable
+
+ public override object Clone ()
+ {
+ return (host.Clone () as Hashtable);
+ }
+
+ } // SynchedHashtable
+
+
+ } // Hashtable
+
+}
+
diff --git a/mcs/class/corlib/System.Collections/ICollection.cs b/mcs/class/corlib/System.Collections/ICollection.cs
new file mode 100644
index 00000000000..2189931cae8
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/ICollection.cs
@@ -0,0 +1,24 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.ICollection
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface ICollection : IEnumerable {
+ int Count { get; }
+
+ bool IsSynchronized { get; }
+
+ object SyncRoot { get; }
+
+ void CopyTo (Array array, int index);
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/IComparer.cs b/mcs/class/corlib/System.Collections/IComparer.cs
new file mode 100644
index 00000000000..3d1ee2ef609
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IComparer.cs
@@ -0,0 +1,19 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IComparer
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IComparer {
+ int Compare (object x, object y);
+ }
+
+}
diff --git a/mcs/class/corlib/System.Collections/IDictionary.cs b/mcs/class/corlib/System.Collections/IDictionary.cs
new file mode 100644
index 00000000000..a03ab07d904
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IDictionary.cs
@@ -0,0 +1,40 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IDictionary
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IDictionary : ICollection {
+ // properties
+
+ bool IsFixedSize { get; }
+
+ bool IsReadOnly { get; }
+
+ object this[object key] { get; set; }
+
+ ICollection Keys { get; }
+
+ ICollection Values { get; }
+
+ // methods
+
+ void Add (object key, object value);
+
+ void Clear ();
+
+ bool Contains (object key);
+
+ new IDictionaryEnumerator GetEnumerator ();
+
+ void Remove (object key);
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/IDictionaryEnumerator.cs b/mcs/class/corlib/System.Collections/IDictionaryEnumerator.cs
new file mode 100644
index 00000000000..fb1998d55f0
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IDictionaryEnumerator.cs
@@ -0,0 +1,20 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IDictionaryEnumerator
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IDictionaryEnumerator : IEnumerator {
+ DictionaryEntry Entry { get; }
+ object Key { get; }
+ object Value { get; }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/IEnumerable.cs b/mcs/class/corlib/System.Collections/IEnumerable.cs
new file mode 100644
index 00000000000..de0a57475dc
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IEnumerable.cs
@@ -0,0 +1,18 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IEnumerable
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IEnumerable {
+ IEnumerator GetEnumerator();
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/IEnumerator.cs b/mcs/class/corlib/System.Collections/IEnumerator.cs
new file mode 100644
index 00000000000..06d250c8b7e
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IEnumerator.cs
@@ -0,0 +1,22 @@
+//
+// System.Collections.IEnumerator
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IEnumerator {
+ object Current { get; }
+
+ bool MoveNext ();
+
+ void Reset ();
+ }
+
+}
diff --git a/mcs/class/corlib/System.Collections/IHashCodeProvider.cs b/mcs/class/corlib/System.Collections/IHashCodeProvider.cs
new file mode 100644
index 00000000000..15fc4df45bf
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IHashCodeProvider.cs
@@ -0,0 +1,18 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IHashCodeProvider
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IHashCodeProvider {
+ int GetHashCode (object obj);
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/IList.cs b/mcs/class/corlib/System.Collections/IList.cs
new file mode 100644
index 00000000000..e039a8358c3
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/IList.cs
@@ -0,0 +1,40 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Collections.IList
+//
+// Author:
+// Vladimir Vukicevic (vladimir@pobox.com)
+//
+// (C) 2001 Vladimir Vukicevic
+//
+
+using System;
+
+namespace System.Collections {
+
+ public interface IList : ICollection, IEnumerable {
+ // properties
+
+ bool IsFixedSize { get; }
+
+ bool IsReadOnly { get; }
+
+ object this[int index] { get; set; }
+
+ // methods
+
+ int Add (object value);
+
+ void Clear ();
+
+ bool Contains (object value);
+
+ int IndexOf (object value);
+
+ void Insert (int index, object value);
+
+ void Remove (object value);
+
+ void RemoveAt (int index);
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/Queue.cs b/mcs/class/corlib/System.Collections/Queue.cs
new file mode 100644
index 00000000000..c83feaf18fe
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/Queue.cs
@@ -0,0 +1,334 @@
+//
+// System.Collections.Queue
+//
+// Author:
+// Ricardo Fernández Pascual
+//
+// (C) 2001 Ricardo Fernández Pascual
+//
+
+using System;
+using System.Collections;
+
+namespace System.Collections {
+
+ [Serializable]
+ public class Queue : ICollection, IEnumerable, ICloneable {
+
+ private object[] contents;
+ private int head = 0; // points to the first used slot
+ private int count = 0;
+ private int capacity = 16;
+ private float growFactor = 2.0F;
+ private int modCount = 0;
+
+ public Queue () {
+ contents = new object[capacity];
+ }
+
+ public Queue (ICollection collection) {
+ capacity = collection.Count;
+ contents = new object[capacity];
+ count = capacity;
+ collection.CopyTo (contents, 0);
+ }
+
+ public Queue (int initialCapacity) {
+ capacity = initialCapacity;
+ contents = new object[capacity];
+ }
+
+ public Queue (int initialCapacity, float growFactor) {
+ capacity = initialCapacity;
+ contents = new object[capacity];
+ // LAMESPEC: The spec says nothing, but I think this
+ // should throw an exception if growFactor <= 1.0
+ this.growFactor = growFactor;
+ }
+
+ // from ICollection
+
+ public virtual int Count {
+ get { return count; }
+ }
+
+ public virtual bool IsSynchronized {
+ get { return false; }
+ }
+
+ public virtual object SyncRoot {
+ get { return this; }
+ }
+
+ public virtual void CopyTo (Array array, int index) {
+ if (array == null) {
+ throw new ArgumentNullException ();
+ }
+
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException ();
+ }
+
+ if (array.Rank > 1
+ || index >= array.Length
+ || count > array.Length - index) {
+ throw new ArgumentException ();
+ }
+
+ // copy the contents of the circular array
+ Array.Copy (contents, head, array, index,
+ Math.Max (count, capacity - head));
+ if (count > capacity - head)
+ Array.Copy (contents, 0, array,
+ index + capacity - head,
+ count - (capacity - head));
+ }
+
+ // from IEnumerable
+
+ public virtual IEnumerator GetEnumerator () {
+ return new QueueEnumerator (this);
+ }
+
+ // from ICloneable
+
+ public virtual object Clone () {
+ Queue newQueue;
+
+ newQueue = new Queue (); // FIXME: improve this...
+
+ newQueue.contents = new object[this.contents.Length];
+ Array.Copy (this.contents, 0, newQueue.contents, 0,
+ this.contents.Length);
+ newQueue.head = this.head;
+ newQueue.count = this.count;
+ newQueue.capacity = this.capacity;
+ newQueue.growFactor = this.growFactor;
+
+ return newQueue;
+ }
+
+ // FIXME: should override Equals?
+
+ // from Queue spec
+
+/*
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+*/
+
+ public virtual void Clear () {
+ modCount++;
+ head = 0;
+ count = 0;
+ // FIXME: Should allocate a new contents array?
+ // Should null the current array?
+ }
+
+ public virtual bool Contains (object obj) {
+ int tail = head + count;
+ if (obj == null) {
+ for (int i = head; i < tail; i++) {
+ if (contents[i % capacity] == null)
+ return true;
+ }
+ } else {
+ for (int i = head; i < tail; i++) {
+ if (obj.Equals (contents[i % capacity]))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public virtual object Dequeue ()
+ {
+ modCount++;
+ if (count < 1)
+ throw new InvalidOperationException ();
+ object result = contents[head];
+ head = (head + 1) % capacity;
+ count--;
+ return result;
+ }
+
+ public virtual void Enqueue (object obj) {
+ modCount++;
+ if (count == capacity)
+ grow ();
+ contents[(head + count) % capacity] = obj;
+ count++;
+ }
+
+ public virtual object Peek () {
+ if (count < 1)
+ throw new InvalidOperationException ();
+ return contents[head];
+ }
+
+ public static Queue Synchronized (Queue queue) {
+ if (queue == null) {
+ throw new ArgumentNullException ();
+ }
+ return new SyncQueue (queue);
+ }
+
+ public virtual object[] ToArray () {
+ object[] ret = new object[count];
+ CopyTo (ret, 0);
+ return ret;
+ }
+
+ // private methods
+
+ private void grow () {
+ int newCapacity = (int) Math.Ceiling
+ (capacity * growFactor);
+ object[] newContents = new object[newCapacity];
+ CopyTo (newContents, 0);
+ contents = newContents;
+ head = 0;
+ }
+
+ // private classes
+
+ private class SyncQueue : Queue {
+ Queue queue;
+
+ internal SyncQueue (Queue queue) {
+ this.queue = queue;
+ }
+
+ public override int Count {
+ get {
+ lock (queue) {
+ return queue.count;
+ }
+ }
+ }
+
+ public override bool IsSynchronized {
+ get {
+ lock (queue) {
+ return queue.IsSynchronized;
+ }
+ }
+ }
+
+ public override object SyncRoot {
+ get {
+ return queue.SyncRoot;
+ }
+ }
+
+ public override void CopyTo (Array array, int index) {
+ lock (queue) {
+ queue.CopyTo (array, index);
+ }
+ }
+
+ public override IEnumerator GetEnumerator () {
+ lock (queue) {
+ return queue.GetEnumerator ();
+ }
+ }
+
+ public override object Clone () {
+ lock (queue) {
+ return queue.Clone ();
+ }
+ }
+
+/*
+ public override bool IsReadOnly {
+ get {
+ lock (queue) {
+ return queue.IsReadOnly;
+ }
+ }
+ }
+*/
+
+ public override void Clear () {
+ lock (queue) {
+ queue.Clear ();
+ }
+ }
+
+ public override bool Contains (object obj) {
+ lock (queue) {
+ return queue.Contains (obj);
+ }
+ }
+
+ public override object Dequeue () {
+ lock (queue) {
+ return queue.Dequeue ();
+ }
+ }
+
+ public override void Enqueue (object obj) {
+ lock (queue) {
+ queue.Enqueue (obj);
+ }
+ }
+
+ public override object Peek () {
+ lock (queue) {
+ return queue.Peek ();
+ }
+ }
+
+ public override object[] ToArray () {
+ lock (queue) {
+ return queue.ToArray ();
+ }
+ }
+ }
+
+ [Serializable]
+ private class QueueEnumerator : IEnumerator {
+ Queue queue;
+ private int modCount;
+ private int current;
+
+ internal QueueEnumerator (Queue q) {
+ queue = q;
+ modCount = q.modCount;
+ current = -1; // one element before the head
+ }
+
+ public virtual object Current {
+ get {
+ if (modCount != queue.modCount
+ || current < 0
+ || current >= queue.count)
+ throw new InvalidOperationException ();
+ return queue.contents[(queue.head + current) % queue.capacity];
+ }
+ }
+
+ public virtual bool MoveNext () {
+ if (modCount != queue.modCount) {
+ throw new InvalidOperationException ();
+ }
+
+ if (current >= queue.count) {
+ return false;
+ } else {
+ current++;
+ return true;
+ }
+ }
+
+ public virtual void Reset () {
+ if (modCount != queue.modCount) {
+ throw new InvalidOperationException();
+ }
+ current = -1;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Collections/ReadOnlyCollectionBase.cs b/mcs/class/corlib/System.Collections/ReadOnlyCollectionBase.cs
new file mode 100644
index 00000000000..9aafb5ff282
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/ReadOnlyCollectionBase.cs
@@ -0,0 +1,45 @@
+//
+// System.Collections.ReadOnlyCollectionBase.cs
+//
+// Author:
+// Nick Drochak II (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+using System;
+
+namespace System.Collections {
+
+ [Serializable]
+ public abstract class ReadOnlyCollectionBase : ICollection, IEnumerable {
+
+ // private instance properties
+ private System.Collections.ArrayList myList;
+
+ // public instance properties
+ public int Count { get { return InnerList.Count; } }
+
+ // Public Instance Methods
+ public System.Collections.IEnumerator GetEnumerator() { return InnerList.GetEnumerator(); }
+
+ // Protected Instance Constructors
+ protected ReadOnlyCollectionBase() {
+ this.myList = new System.Collections.ArrayList();
+ }
+
+ // Protected Instance Properties
+ protected System.Collections.ArrayList InnerList {get { return this.myList; } }
+
+ // ICollection methods
+ void ICollection.CopyTo(Array array, int index) {
+ lock (InnerList) { InnerList.CopyTo(array, index); }
+ }
+ object ICollection.SyncRoot {
+ get { return InnerList.SyncRoot; }
+ }
+ bool ICollection.IsSynchronized {
+ get { return InnerList.IsSynchronized; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Collections/SortedList.cs b/mcs/class/corlib/System.Collections/SortedList.cs
new file mode 100644
index 00000000000..7e58a8f39db
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/SortedList.cs
@@ -0,0 +1,862 @@
+//
+// System.Collections.SortedList
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+
+using System;
+using System.Collections;
+
+
+namespace System.Collections {
+
+ /// <summary>
+ /// Represents a collection of associated keys and values
+ /// that are sorted by the keys and are accessible by key
+ /// and by index.
+ /// </summary>
+ [Serializable]
+ public class SortedList : IDictionary, ICollection,
+ IEnumerable, ICloneable {
+
+
+ internal struct Slot {
+ internal Object key;
+ internal Object value;
+ }
+
+ private readonly static int INITIAL_SIZE = 16;
+
+ public enum EnumeratorMode : int {KEY_MODE = 0, VALUE_MODE}
+
+ private int inUse;
+ private int modificationCount;
+ private Slot[] table;
+ private IComparer comparer;
+
+
+
+ //
+ // Constructors
+ //
+ public SortedList () : this (INITIAL_SIZE)
+ {
+ }
+
+ public SortedList (int initialCapacity)
+ : this (null, initialCapacity)
+ {
+ }
+
+ public SortedList (IComparer comparer, int initialCapacity)
+ {
+ this.comparer = comparer;
+ InitTable (initialCapacity);
+ }
+
+ public SortedList (IComparer comparer)
+ : this (comparer, 0)
+ {
+ }
+
+
+ public SortedList (IDictionary d) : this (d, null)
+ {
+ }
+
+ public SortedList (IDictionary d, IComparer comparer)
+ {
+ if (d == null)
+ throw new ArgumentNullException ("dictionary");
+
+ InitTable (d.Count);
+ this.comparer = comparer;
+
+ IDictionaryEnumerator it = d.GetEnumerator ();
+ while (it.MoveNext ()) {
+ if (it.Key is IComparable) {
+ Add (it.Key, it.Value);
+ } else {
+ throw new InvalidCastException("!IComparable");
+ }
+ }
+ }
+
+
+
+
+ //
+ // Properties
+ //
+
+
+ // ICollection
+
+ public virtual int Count {
+ get {
+ return inUse;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return false;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {
+ return this;
+ }
+ }
+
+
+ // IDictionary
+
+ public virtual bool IsFixedSize {
+ get {
+ return false;
+ }
+ }
+
+
+ public virtual bool IsReadOnly {
+ get {
+ return false;
+ }
+ }
+
+ public virtual ICollection Keys {
+ get {
+ return new ListKeys (this);
+ }
+ }
+
+ public virtual ICollection Values {
+ get {
+ return new ListValues (this);
+ }
+ }
+
+
+
+ public virtual Object this [Object key] {
+ get {
+ return GetImpl (key);
+ }
+ set {
+ PutImpl (key, value, true);
+ }
+ }
+
+
+
+
+ public virtual int Capacity {
+ get {
+ return table.Length;
+ }
+ set {
+ Slot [] table = this.table;
+ int current = table.Length;
+
+ if (inUse > value)
+ throw new ArgumentOutOfRangeException("capacity too small");
+
+ if (value > current) {
+ Slot [] newTable = new Slot [value];
+ Array.Copy (table, newTable, current);
+ this.table = newTable;
+ }
+ }
+ }
+
+
+
+ //
+ // Public instance methods.
+ //
+
+
+ // IEnumerable
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return new Enumerator (this, EnumeratorMode.KEY_MODE);
+ }
+
+
+ // IDictionary
+
+ public virtual void Add (object key, object value)
+ {
+ PutImpl (key, value, false);
+ }
+
+
+ public virtual void Clear ()
+ {
+ this.table = new Slot [Capacity];
+ inUse = 0;
+ modificationCount++;
+ }
+
+ public virtual bool Contains (object key)
+ {
+ return (Find (key) >= 0);
+ }
+
+
+ public virtual IDictionaryEnumerator GetEnumerator ()
+ {
+ return new Enumerator (this, EnumeratorMode.KEY_MODE);
+ }
+
+ public virtual void Remove (object key)
+ {
+ int i = IndexOfKey (key);
+ if (i >= 0) RemoveAt (i);
+ }
+
+
+ // ICollection
+
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ IDictionaryEnumerator it = GetEnumerator ();
+ int i = arrayIndex;
+
+ while (it.MoveNext ()) {
+ array.SetValue (it.Entry, i++);
+ }
+ }
+
+
+
+ // ICloneable
+
+ public virtual object Clone ()
+ {
+ SortedList sl = new SortedList (this, comparer);
+ sl.modificationCount = this.modificationCount;
+ return sl;
+ }
+
+
+
+
+ //
+ // SortedList
+ //
+
+ public virtual IList GetKeyList ()
+ {
+ return new ListKeys (this);
+ }
+
+
+ public virtual IList GetValueList ()
+ {
+ return new ListValues (this);
+ }
+
+
+ public virtual void RemoveAt (int index)
+ {
+ Slot [] table = this.table;
+ int cnt = Count;
+ if (index >= 0 && index < cnt) {
+ if (index != cnt - 1) {
+ Array.Copy (table, index+1, table, index, cnt-1);
+ } else {
+ table [index].key = null;
+ table [index].value = null;
+ }
+ --inUse;
+ ++modificationCount;
+ } else {
+ throw new ArgumentOutOfRangeException("index out of range");
+ }
+ }
+
+
+
+
+
+ public virtual int IndexOfKey (object key)
+ {
+ int indx = Find (key);
+ return (indx | (indx >> 31));
+ }
+
+
+ public virtual int IndexOfValue (object value)
+ {
+ Slot [] table = this.table;
+ int len = table.Length;
+
+ for (int i=0; i < len; i++) {
+ if (table[i].value.Equals (value)) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+
+ public virtual bool ContainsKey (object key)
+ {
+ return Contains (key);
+ }
+
+
+ public virtual bool ContainsValue (object value)
+ {
+ return IndexOfValue (value) >= 0;
+ }
+
+
+ public virtual object GetByIndex (int index)
+ {
+ if (index >= 0 && index < Count) {
+ return table [index].value;
+ } else {
+ throw new ArgumentOutOfRangeException("index out of range");
+ }
+ }
+
+
+ public virtual void SetByIndex (int index, object value)
+ {
+ if (index >= 0 && index < Count) {
+ table [index].value = value;
+ } else {
+ throw new ArgumentOutOfRangeException("index out of range");
+ }
+ }
+
+
+ public virtual object GetKey (int index)
+ {
+ if (index >= 0 && index < Count) {
+ return table [index].key;
+ } else {
+ throw new ArgumentOutOfRangeException("index out of range");
+ }
+ }
+
+ [MonoTODO]
+ public static SortedList Synchronized (SortedList list)
+ {
+ return null;
+ }
+
+ public virtual void TrimToSize ()
+ {
+ // From Beta2:
+ // Trimming an empty SortedList sets the capacity
+ // of the SortedList to the default capacity,
+ // not zero.
+ if (Count == 0) Resize (INITIAL_SIZE, false);
+ else Resize (Count, true);
+ }
+
+
+ //
+ // Private methods
+ //
+
+
+ private void Resize (int n, bool copy)
+ {
+ Slot [] table = this.table;
+ Slot [] newTable = new Slot [n];
+ if (copy) Array.Copy (table, 0, newTable, 0, n);
+ this.table = newTable;
+ }
+
+
+ private void EnsureCapacity (int n, int free)
+ {
+ Slot [] table = this.table;
+ Slot [] newTable = null;
+ int cap = Capacity;
+ bool gap = (free >=0 && free < Count);
+
+ if (n > cap) {
+ newTable = new Slot [n << 1];
+ }
+
+ if (newTable != null) {
+ if (gap) {
+ int copyLen = free;
+ if (copyLen > 0) {
+ Array.Copy (table, 0, newTable, 0, copyLen);
+ }
+ copyLen = Count - free;
+ if (copyLen > 0) {
+ Array.Copy (table, free, newTable, free+1, copyLen);
+ }
+ } else {
+ // Just a resizing, copy the entire table.
+ Array.Copy (table, newTable, Count);
+ }
+ this.table = newTable;
+ } else if (gap) {
+ Array.Copy (table, free, table, free+1, Count - free);
+ }
+ }
+
+
+ private void PutImpl (object key, object value, bool overwrite)
+ {
+ if (key == null)
+ throw new ArgumentNullException ("null key");
+
+ Slot [] table = this.table;
+ int freeIndx = Find (key);
+
+
+ if (freeIndx >= 0) {
+ if (!overwrite)
+ throw new ArgumentException("element already exists");
+
+ table [freeIndx].value = value;
+ return;
+ }
+
+ freeIndx = ~freeIndx;
+
+ if (freeIndx > Capacity + 1)
+ throw new Exception ("SortedList::internal error ("+key+", "+value+") at ["+freeIndx+"]");
+
+
+ EnsureCapacity (Count+1, freeIndx);
+
+ table = this.table;
+ table [freeIndx].key = key;
+ table [freeIndx].value = value;
+
+ ++inUse;
+ ++modificationCount;
+
+ }
+
+
+ private object GetImpl (object key)
+ {
+ int i = Find (key);
+
+ if (i >= 0)
+ return table [i].value;
+ else
+ return null;
+ }
+
+
+ private void InitTable (int capacity)
+ {
+ int size = (capacity + 1) & (~1);
+ if (size < INITIAL_SIZE) size = INITIAL_SIZE;
+ this.table = new Slot [size];
+ this.inUse = 0;
+ this.modificationCount = 0;
+ }
+
+
+ private void CopyToArray (Array arr, int i,
+ EnumeratorMode mode)
+ {
+ IEnumerator it = new Enumerator (this, mode);
+
+ while (it.MoveNext ()) {
+ arr.SetValue (it.Current, i++);
+ }
+ }
+
+
+ private int Find (object key)
+ {
+ Slot [] table = this.table;
+ int len = Count;
+
+ if (len == 0) return ~0;
+
+ IComparer comparer = (this.comparer == null)
+ ? Comparer.Default
+ : this.comparer;
+
+ int left = 0;
+ int right = len-1;
+
+ while (left <= right) {
+ int guess = (left + right) >> 1;
+
+ int cmp = comparer.Compare (key, table[guess].key);
+
+ if (cmp == 0) return guess;
+
+ cmp &= ~Int32.MaxValue;
+
+ if (cmp == 0) left = guess+1;
+ else right = guess-1;
+ }
+
+ return ~left;
+ }
+
+
+
+ //
+ // Inner classes
+ //
+
+
+ protected sealed class Enumerator : IDictionaryEnumerator,
+ IEnumerator {
+
+ private SortedList host;
+ private int stamp;
+ private int pos;
+ private int size;
+ private EnumeratorMode mode;
+
+ private object currentKey;
+ private object currentValue;
+
+ private readonly static string xstr = "SortedList.Enumerator: snapshot out of sync.";
+
+ public Enumerator (SortedList host, EnumeratorMode mode)
+ {
+ this.host = host;
+ stamp = host.modificationCount;
+ size = host.Count;
+ this.mode = mode;
+ Reset ();
+ }
+
+ public Enumerator (SortedList host)
+ : this (host, EnumeratorMode.KEY_MODE)
+ {
+ }
+
+
+ private void FailFast ()
+ {
+ if (host.modificationCount != stamp) {
+ throw new InvalidOperationException (xstr);
+ }
+ }
+
+ public void Reset ()
+ {
+ FailFast ();
+
+ pos = -1;
+ currentKey = null;
+ currentValue = null;
+ }
+
+ public bool MoveNext ()
+ {
+ FailFast ();
+
+ Slot [] table = host.table;
+
+ if (++pos < size) {
+ Slot entry = table [pos];
+
+ currentKey = entry.key;
+ currentValue = entry.value;
+ return true;
+ }
+
+ currentKey = null;
+ currentValue = null;
+ return false;
+ }
+
+ public DictionaryEntry Entry
+ {
+ get {
+ FailFast ();
+ return new DictionaryEntry (currentKey,
+ currentValue);
+ }
+ }
+
+ public Object Key {
+ get {
+ FailFast ();
+ return currentKey;
+ }
+ }
+
+ public Object Value {
+ get {
+ FailFast ();
+ return currentValue;
+ }
+ }
+
+ public Object Current {
+ get {
+ FailFast ();
+ return (mode == EnumeratorMode.KEY_MODE)
+ ? currentKey
+ : currentValue;
+ }
+ }
+ }
+
+
+ protected class ListKeys : IList, IEnumerable {
+
+ private SortedList host;
+
+
+ public ListKeys (SortedList host)
+ {
+ if (host == null)
+ throw new ArgumentNullException ();
+
+ this.host = host;
+ }
+
+ //
+ // ICollection
+ //
+
+ public virtual int Count {
+ get {
+ return host.Count;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return host.IsSynchronized;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {
+ return host.SyncRoot;
+ }
+ }
+
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ host.CopyToArray (array, arrayIndex, EnumeratorMode.KEY_MODE);
+ }
+
+
+ //
+ // IList
+ //
+
+ public virtual bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ public virtual bool IsReadOnly {
+ get {
+ return true;
+ }
+ }
+
+
+ public virtual object this [int index] {
+ get {
+ return host.GetKey (index);
+ }
+ set {
+ throw new NotSupportedException("attempt to modify a key");
+ }
+ }
+
+ public virtual int Add (object value)
+ {
+ throw new NotSupportedException("IList::Add not supported");
+ }
+
+ public virtual void Clear ()
+ {
+ throw new NotSupportedException("IList::Clear not supported");
+ }
+
+ public virtual bool Contains (object key)
+ {
+ return host.Contains (key);
+ }
+
+
+ public virtual int IndexOf (object key)
+ {
+ return host.IndexOfKey (key);
+ }
+
+
+ public virtual void Insert (int index, object value)
+ {
+ throw new NotSupportedException("IList::Insert not supported");
+ }
+
+
+ public virtual void Remove (object value)
+ {
+ throw new NotSupportedException("IList::Remove not supported");
+ }
+
+
+ public virtual void RemoveAt (int index)
+ {
+ throw new NotSupportedException("IList::RemoveAt not supported");
+ }
+
+
+ //
+ // IEnumerable
+ //
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return new SortedList.Enumerator (host, EnumeratorMode.KEY_MODE);
+ }
+
+
+ }
+
+
+ protected class ListValues : IList, IEnumerable {
+
+ private SortedList host;
+
+
+ public ListValues (SortedList host)
+ {
+ if (host == null)
+ throw new ArgumentNullException ();
+
+ this.host = host;
+ }
+
+ //
+ // ICollection
+ //
+
+ public virtual int Count {
+ get {
+ return host.Count;
+ }
+ }
+
+ public virtual bool IsSynchronized {
+ get {
+ return host.IsSynchronized;
+ }
+ }
+
+ public virtual Object SyncRoot {
+ get {
+ return host.SyncRoot;
+ }
+ }
+
+ public virtual void CopyTo (Array array, int arrayIndex)
+ {
+ host.CopyToArray (array, arrayIndex, EnumeratorMode.VALUE_MODE);
+ }
+
+
+ //
+ // IList
+ //
+
+ public virtual bool IsFixedSize {
+ get {
+ return true;
+ }
+ }
+
+ public virtual bool IsReadOnly {
+ get {
+ return true;
+ }
+ }
+
+
+ [MonoTODO]
+ public virtual object this [int index] {
+ get {
+ return host.GetByIndex (index);
+ }
+ set {
+ // FIXME: It seems (according to tests)
+ // that modifications are allowed
+ // in Beta2.
+ // ? host.SetByIndex (index, value);
+ throw new NotSupportedException("attempt to modify a value");
+ }
+ }
+
+ public virtual int Add (object value)
+ {
+ throw new NotSupportedException("IList::Add not supported");
+ }
+
+ public virtual void Clear ()
+ {
+ throw new NotSupportedException("IList::Clear not supported");
+ }
+
+ public virtual bool Contains (object value)
+ {
+ return host.ContainsValue (value);
+ }
+
+
+ public virtual int IndexOf (object value)
+ {
+ return host.IndexOfValue (value);
+ }
+
+
+ public virtual void Insert (int index, object value)
+ {
+ throw new NotSupportedException("IList::Insert not supported");
+ }
+
+
+ public virtual void Remove (object value)
+ {
+ throw new NotSupportedException("IList::Remove not supported");
+ }
+
+
+ public virtual void RemoveAt (int index)
+ {
+ throw new NotSupportedException("IList::RemoveAt not supported");
+ }
+
+
+ //
+ // IEnumerable
+ //
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return new SortedList.Enumerator (host, EnumeratorMode.VALUE_MODE);
+ }
+
+
+ }
+
+ } // SortedList
+
+} // System.Collections
diff --git a/mcs/class/corlib/System.Collections/Stack.cs b/mcs/class/corlib/System.Collections/Stack.cs
new file mode 100644
index 00000000000..392ab6fcd00
--- /dev/null
+++ b/mcs/class/corlib/System.Collections/Stack.cs
@@ -0,0 +1,321 @@
+//
+// System.Collections.Stack
+//
+// Author:
+// Garrett Rooney (rooneg@electricjellyfish.net)
+//
+// (C) 2001 Garrett Rooney
+//
+
+namespace System.Collections {
+
+ [Serializable]
+ public class Stack : ICollection, IEnumerable, ICloneable {
+
+ // properties
+ private object[] contents;
+ private int current = -1;
+ private int count = 0;
+ private int capacity = 16;
+ private int modCount = 0;
+
+ private void Resize(int ncapacity) {
+ object[] ncontents = new object[ncapacity];
+
+ Array.Copy(contents, ncontents, count);
+
+ capacity = ncapacity;
+ contents = ncontents;
+ }
+
+ public Stack() {
+ contents = new object[capacity];
+ }
+
+ public Stack(ICollection collection) {
+ capacity = collection.Count;
+ contents = new object[capacity];
+ current = capacity - 1;
+ count = capacity;
+
+ collection.CopyTo(contents, 0);
+ }
+
+ public Stack(int c) {
+ capacity = c;
+ contents = new object[capacity];
+ }
+
+ [Serializable]
+ private class SyncStack : Stack {
+
+ Stack stack;
+
+ internal SyncStack(Stack s) {
+ stack = s;
+ }
+
+ public override int Count {
+ get {
+ lock (stack) {
+ return stack.Count;
+ }
+ }
+ }
+
+/*
+ public override bool IsReadOnly {
+ get {
+ lock (stack) {
+ return stack.IsReadOnly;
+ }
+ }
+ }
+*/
+
+ public override bool IsSynchronized {
+ get { return true; }
+ }
+
+ public override object SyncRoot {
+ get { return stack.SyncRoot; }
+ }
+
+ public override void Clear() {
+ lock(stack) { stack.Clear(); }
+ }
+
+ public override object Clone() {
+ lock (stack) {
+ return Stack.Synchronized((Stack)stack.Clone());
+ }
+ }
+
+ public override bool Contains(object obj) {
+ lock (stack) { return stack.Contains(obj); }
+ }
+
+ public override void CopyTo(Array array, int index) {
+ lock (stack) { stack.CopyTo(array, index); }
+ }
+
+ public override IEnumerator GetEnumerator() {
+ lock (stack) {
+ return new Enumerator(stack);
+ }
+ }
+
+ public override object Peek() {
+ lock (stack) { return stack.Peek(); }
+ }
+
+ public override object Pop() {
+ lock (stack) { return stack.Pop(); }
+ }
+
+ public override void Push(object obj) {
+ lock (stack) { stack.Push(obj); }
+ }
+
+ public override object[] ToArray() {
+ lock (stack) { return stack.ToArray(); }
+ }
+ }
+
+ public static Stack Synchronized(Stack s) {
+ if (s == null) {
+ throw new ArgumentNullException();
+ }
+
+ return new SyncStack(s);
+ }
+
+ public virtual int Count {
+ get { return count; }
+ }
+
+/*
+ public virtual bool IsReadOnly {
+ get { return false; }
+ }
+*/
+
+ public virtual bool IsSynchronized {
+ get { return false; }
+ }
+
+ public virtual object SyncRoot {
+ get { return this; }
+ }
+
+ public virtual void Clear() {
+ modCount++;
+
+ for (int i = 0; i < count; i++) {
+ contents[i] = null;
+ }
+
+ count = 0;
+ current = -1;
+ }
+
+ public virtual object Clone() {
+ Stack stack;
+
+ stack = new Stack();
+
+ stack.current = current;
+ stack.contents = contents;
+ stack.count = count;
+ stack.capacity = capacity;
+
+ return stack;
+ }
+
+ public virtual bool Contains(object obj) {
+ if (count == 0)
+ return false;
+
+ for (int i = 0; i < count; i++) {
+ if (contents[i].Equals(obj))
+ return true;
+ }
+
+ return false;
+ }
+
+ public virtual void CopyTo (Array array, int index) {
+ if (array == null) {
+ throw new ArgumentNullException();
+ }
+
+ if (index < 0) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ if (array.Rank > 1 ||
+ index >= array.Length ||
+ count > array.Length - index) {
+ throw new ArgumentException();
+ }
+
+ for (int i = current; i != -1; i--) {
+ array.SetValue(contents[i],
+ count - (i + 1) + index);
+ }
+ }
+
+ private class Enumerator : IEnumerator {
+
+ Stack stack;
+ private int modCount;
+ private int current;
+
+ internal Enumerator(Stack s) {
+ // this is odd. it seems that you need to
+ // start one further ahead than current, since
+ // MoveNext() gets called first when using an
+ // Enumeration...
+ stack = s;
+ modCount = s.modCount;
+ current = s.current + 1;
+ }
+
+ public virtual object Current {
+ get {
+ if (modCount != stack.modCount
+ || current == -1
+ || current > stack.count)
+ throw new InvalidOperationException();
+ return stack.contents[current];
+ }
+ }
+
+ public virtual bool MoveNext() {
+ if (modCount != stack.modCount
+ || current == -1) {
+ throw new InvalidOperationException();
+ }
+
+ current--;
+
+ if (current == -1) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public virtual void Reset() {
+ if (modCount != stack.modCount) {
+ throw new InvalidOperationException();
+ }
+
+ // start one ahead of stack.current, so the
+ // first MoveNext() will put us at the top
+ current = stack.current + 1;
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator() {
+ return new Enumerator(this);
+ }
+
+ public virtual object Peek() {
+ if (current == -1) {
+ throw new InvalidOperationException();
+ } else {
+ return contents[current];
+ }
+ }
+
+ public virtual object Pop() {
+ if (current == -1) {
+ throw new InvalidOperationException();
+ } else {
+ modCount++;
+
+ object ret = contents[current];
+
+ count--;
+ current--;
+
+ // if we're down to capacity/4, go back to a
+ // lower array size. this should keep us from
+ // sucking down huge amounts of memory when
+ // putting large numbers of items in the Stack.
+ // if we're lower than 16, don't bother, since
+ // it will be more trouble than it's worth.
+ if (count <= (capacity/4) && count > 16) {
+ Resize(capacity/2);
+ }
+
+ return ret;
+ }
+ }
+
+ public virtual void Push(Object o) {
+ modCount++;
+
+ if (capacity == count) {
+ Resize(capacity * 2);
+ }
+
+ count++;
+ current++;
+
+ contents[current] = o;
+ }
+
+ public virtual object[] ToArray() {
+ object[] ret = new object[count];
+
+ Array.Copy(contents, ret, count);
+
+ // ret needs to be in LIFO order
+ Array.Reverse(ret);
+
+ return ret;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHash.cs b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHash.cs
new file mode 100644
index 00000000000..ffa152e6399
--- /dev/null
+++ b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHash.cs
@@ -0,0 +1,71 @@
+
+//
+// AssemblyHash.cs
+//
+// Implementation of the
+// System.Configuration.Assemblies.AssemblyHash
+// class for the Mono Class Library
+//
+// Author:
+// Tomas Restrepo (tomasr@mvps.org)
+//
+
+namespace System.Configuration.Assemblies {
+
+ [Serializable]
+ public struct AssemblyHash : System.ICloneable
+ {
+ private AssemblyHashAlgorithm _algorithm;
+ private byte[] _value;
+
+ public static readonly AssemblyHash Empty =
+ new AssemblyHash(AssemblyHashAlgorithm.None,null);
+
+
+ //
+ // properties
+ //
+ public AssemblyHashAlgorithm Algorithm {
+ get { return _algorithm; }
+ set { _algorithm = value; }
+ }
+
+
+ //
+ // construction
+ //
+ public AssemblyHash ( AssemblyHashAlgorithm algorithm, byte[] value )
+ {
+ _algorithm = algorithm;
+ _value = null;
+ if ( value != null )
+ {
+ int size = value.Length;
+ _value = new byte[size];
+ System.Array.Copy ( value, _value, size );
+ }
+ }
+
+ public AssemblyHash ( byte[] value )
+ : this(AssemblyHashAlgorithm.SHA1, value)
+ {
+ }
+
+ public object Clone()
+ {
+ return new AssemblyHash(_algorithm,_value);
+ }
+
+ public byte[] GetValue()
+ {
+ return _value;
+ }
+ public void SetValue ( byte[] value )
+ {
+ _value = value;
+ }
+
+ } // class AssemblyHash
+
+} // namespace System.Configuration.Assemblies
+
diff --git a/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHashAlgorithm.cs b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHashAlgorithm.cs
new file mode 100644
index 00000000000..f144df7bf79
--- /dev/null
+++ b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyHashAlgorithm.cs
@@ -0,0 +1,33 @@
+// AssemblyHashAlgorithm.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:03 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Configuration.Assemblies {
+
+
+ /// <summary>
+ /// </summary>
+ public enum AssemblyHashAlgorithm {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ MD5 = 32771,
+
+ /// <summary>
+ /// </summary>
+ SHA1 = 32772,
+ } // AssemblyHashAlgorithm
+
+} // System.Configuration.Assemblies
diff --git a/mcs/class/corlib/System.Configuration.Assemblies/AssemblyVersionCompatibility.cs b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyVersionCompatibility.cs
new file mode 100644
index 00000000000..5e13d56fdf1
--- /dev/null
+++ b/mcs/class/corlib/System.Configuration.Assemblies/AssemblyVersionCompatibility.cs
@@ -0,0 +1,33 @@
+// AssemblyVersionCompatibility.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:13 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Configuration.Assemblies {
+
+
+ /// <summary>
+ /// </summary>
+ public enum AssemblyVersionCompatibility {
+
+ /// <summary>
+ /// </summary>
+ SameMachine = 1,
+
+ /// <summary>
+ /// </summary>
+ SameProcess = 2,
+
+ /// <summary>
+ /// </summary>
+ SameDomain = 3,
+ } // AssemblyVersionCompatibility
+
+} // System.Configuration.Assemblies
diff --git a/mcs/class/corlib/System.Configuration.Assemblies/ChangeLog b/mcs/class/corlib/System.Configuration.Assemblies/ChangeLog
new file mode 100644
index 00000000000..d9e7f8ea889
--- /dev/null
+++ b/mcs/class/corlib/System.Configuration.Assemblies/ChangeLog
@@ -0,0 +1,6 @@
+2001-07-13 Tomas Restrepo (tomasr@mvps.org)
+
+ * AssemblyHash finished
+ * AssemblyHashAlgorithm finished
+ * AssemblyVersion finished
+ \ No newline at end of file
diff --git a/mcs/class/corlib/System.Configuration.Assemblies/ProcessorID.cs b/mcs/class/corlib/System.Configuration.Assemblies/ProcessorID.cs
new file mode 100755
index 00000000000..10cb2e9fe5d
--- /dev/null
+++ b/mcs/class/corlib/System.Configuration.Assemblies/ProcessorID.cs
@@ -0,0 +1,101 @@
+// ProcessorID.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:23 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Configuration.Assemblies {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ProcessorID {
+
+ /// <summary>
+ /// </summary>
+ INTEL_386 = 386,
+
+ /// <summary>
+ /// </summary>
+ INTEL_486 = 486,
+
+ /// <summary>
+ /// </summary>
+ INTEL_PENTIUM = 586,
+
+ /// <summary>
+ /// </summary>
+ MIPS_R4000 = 4000,
+
+ /// <summary>
+ /// </summary>
+ ALPHA_21064 = 21064,
+
+ /// <summary>
+ /// </summary>
+ PPC_601 = 601,
+
+ /// <summary>
+ /// </summary>
+ PPC_603 = 603,
+
+ /// <summary>
+ /// </summary>
+ PPC_604 = 604,
+
+ /// <summary>
+ /// </summary>
+ PPC_620 = 620,
+
+ /// <summary>
+ /// </summary>
+ HITACHI_SH3 = 10003,
+
+ /// <summary>
+ /// </summary>
+ HITACHI_SH3E = 10004,
+
+ /// <summary>
+ /// </summary>
+ HITACHI_SH4 = 10005,
+
+ /// <summary>
+ /// </summary>
+ MOTOROLA_821 = 821,
+
+ /// <summary>
+ /// </summary>
+ SHx_SH3 = 103,
+
+ /// <summary>
+ /// </summary>
+ SHx_SH4 = 104,
+
+ /// <summary>
+ /// </summary>
+ STRONGARM = 2577,
+
+ /// <summary>
+ /// </summary>
+ ARM720 = 1824,
+
+ /// <summary>
+ /// </summary>
+ ARM820 = 2080,
+
+ /// <summary>
+ /// </summary>
+ ARM920 = 2336,
+
+ /// <summary>
+ /// </summary>
+ ARM_7TDMI = 70001,
+ } // ProcessorID
+
+} // System.Configuration.Assemblies
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ChangeLog b/mcs/class/corlib/System.Diagnostics.SymbolStore/ChangeLog
new file mode 100644
index 00000000000..4c57a305185
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ChangeLog
@@ -0,0 +1,29 @@
+2002-03-20 Martin Baulig <martin@gnome.org>
+
+ * SymbolToken.cs (GetToken): Implemented.
+
+2002-03-05 Duncan Mak <duncan@ximian.com>
+
+ * ISymbolWriter.cs:
+ (DefineParameter) corrected typo in argument type.
+ (SetMethodSourceRange): Fixed typo in method name.
+
+ * ISymbolDocument.cs:
+ (CheckSumAlgorithmId) Fixed typo.
+
+ * ISymbolNamespace.cs:
+ (GetVariable) Added missing method.
+
+2002-02-05 Duncan Mak <duncan@ximian.com>
+
+ * SymDocumentType.cs:
+ * SymLanguageType.cs:
+ * SymLanguageVendor.cs: Added to CVS.
+
+2002-01-07 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Finilized SymAddressKind enum
+
+2002-01-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Created SymAddressKind enum
+ * Created all interfaces
+ * Created dummy implementation for SymbolToken struct
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolBinder.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolBinder.cs
new file mode 100755
index 00000000000..ea1779ca15c
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolBinder.cs
@@ -0,0 +1,19 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolBinder
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolBinder {
+
+ ISymbolReader GetReader (int importer, string filename, string searchPath);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocument.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocument.cs
new file mode 100755
index 00000000000..4725e34db06
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocument.cs
@@ -0,0 +1,30 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolDocument
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolDocument {
+
+ Guid CheckSumAlgorithmId {get; }
+ Guid DocumentType {get; }
+ bool HasEmbeddedSource {get; }
+ Guid Language {get; }
+ Guid LanguageVendor {get; }
+ int SourceLength {get; }
+ string URL {get; }
+
+
+ int FindClosestLine (int line);
+ byte[] GetCheckSum ();
+ byte[] GetSourceRange (int startLine, int startColumn, int endLine, int endColumn);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.cs
new file mode 100755
index 00000000000..855b1a5cefc
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolDocumentWriter {
+
+ void SetCheckSum (Guid algorithmId, byte[] checkSum);
+ void SetSource (byte[] source);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolMethod.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolMethod.cs
new file mode 100755
index 00000000000..768ace15710
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolMethod.cs
@@ -0,0 +1,38 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolMethod
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolMethod {
+
+ ISymbolScope RootScope {get; }
+ int SequencePointCount {get; }
+ SymbolToken Token {get; }
+
+ ISymbolNamespace GetNamespace ();
+ int GetOffset (ISymbolDocument document, int line, int column);
+ ISymbolVariable[] GetParameters ();
+ int[] GetRanges (ISymbolDocument document, int line, int column);
+ ISymbolScope GetScope (int offset);
+ void GetSequencePoints (
+ int[] offsets,
+ ISymbolDocument[] documents,
+ int[] lines,
+ int[] columns,
+ int[] endLines,
+ int[] endColumns);
+ bool GetSourceStartEnd (
+ ISymbolDocument[] docs,
+ int[] lines,
+ int[] columns);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolNamespace.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolNamespace.cs
new file mode 100755
index 00000000000..394fecddc01
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolNamespace.cs
@@ -0,0 +1,21 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolNamespace
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolNamespace {
+
+ string Name {get ;}
+
+ ISymbolNamespace[] GetNamespaces ();
+ ISymbolVariable[] GetVariables ();
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolReader.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolReader.cs
new file mode 100755
index 00000000000..ee04f2b64b1
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolReader.cs
@@ -0,0 +1,38 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolReader
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolReader {
+
+ SymbolToken UserEntryPoint {get; }
+
+ ISymbolDocument GetDocument (
+ string url,
+ Guid language,
+ Guid languageVendor,
+ Guid documentType);
+ ISymbolDocument[] GetDocuments ();
+ ISymbolVariable[] GetGlobalVariables ();
+
+ ISymbolMethod GetMethod (SymbolToken method);
+ ISymbolMethod GetMethod (SymbolToken method, int version);
+
+ ISymbolMethod GetMethodFromDocumentPosition (
+ ISymbolDocument document,
+ int line,
+ int column);
+ ISymbolNamespace[] GetNamespaces ();
+ byte[] GetSymAttribute (SymbolToken parent, string name);
+ ISymbolVariable[] GetVariables (SymbolToken parent);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolScope.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolScope.cs
new file mode 100755
index 00000000000..6c3179ba67a
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolScope.cs
@@ -0,0 +1,26 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolScope
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolScope {
+
+ int EndOffset {get ;}
+ ISymbolMethod Method {get; }
+ ISymbolScope Parent {get ;}
+ int StartOffset {get ;}
+
+ ISymbolScope[] GetChildren ();
+ ISymbolVariable[] GetLocals ();
+ ISymbolNamespace[] GetNamespaces ();
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolVariable.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolVariable.cs
new file mode 100755
index 00000000000..11d4ee5f25d
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolVariable.cs
@@ -0,0 +1,28 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolVariable
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolVariable {
+
+ int AddressField1 {get; }
+ int AddressField2 {get; }
+ int AddressField3 {get; }
+ SymAddressKind AddressKind {get ;}
+ object Attributes {get ;}
+ int EndOffset {get; }
+ string Name {get; }
+ int StartOffset {get; }
+
+ byte[] GetSignature ();
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolWriter.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolWriter.cs
new file mode 100755
index 00000000000..ee347fbfbfa
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/ISymbolWriter.cs
@@ -0,0 +1,88 @@
+//
+// System.Diagnostics.SymbolStore.ISymbolWriter
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+using System.Reflection;
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public interface ISymbolWriter {
+
+ void Close ();
+ void CloseMethod ();
+ void CloseNamespace ();
+ void CloseScope (int endOffset);
+ ISymbolDocumentWriter DefineDocument(
+ string url,
+ Guid language,
+ Guid languageVendor,
+ Guid documentType);
+ void DefineField (
+ SymbolToken parent,
+ string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3);
+ void DefineGlobalVariable (
+ string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3);
+ void DefineLocalVariable (
+ string name,
+ FieldAttributes attributes,
+ byte[] signature,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3,
+ int startOffset,
+ int endOffset);
+ void DefineParameter (
+ string name,
+ ParameterAttributes attributes,
+ int sequence,
+ SymAddressKind addrKind,
+ int addr1,
+ int addr2,
+ int addr3);
+ void DefineSequencePoints (
+ ISymbolDocumentWriter document,
+ int[] offsets,
+ int[] lines,
+ int[] columns,
+ int[] endLines,
+ int[] endColumns);
+ void Initialize (IntPtr emitter, string filename, bool fFullBuild);
+ void OpenMethod (SymbolToken method);
+ void OpenNamespace (string name);
+ int OpenScope (int startOffset);
+ void SetMethodSourceRange (
+ ISymbolDocumentWriter startDoc,
+ int startLine,
+ int startColumn,
+ ISymbolDocumentWriter endDoc,
+ int endLine,
+ int endColumn);
+ void SetScopeRange (int scopeID, int startOffset, int endOffset);
+ void SetSymAttribute (SymbolToken parent, string name, byte[] data);
+ void SetUnderlyingWriter (IntPtr underlyingWriter);
+ void SetUserEntryPoint (SymbolToken entryMethod);
+ void UsingNamespace (string fullName);
+
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/SymAddressKind.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymAddressKind.cs
new file mode 100755
index 00000000000..af3e5b32ef5
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymAddressKind.cs
@@ -0,0 +1,25 @@
+//
+// System.Diagnostics.SymbolStore.SymAddressKind
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public enum SymAddressKind {
+ ILOffset = 1,
+ NativeRVA = 2,
+ NativeRegister = 3,
+ NativeRegisterRelative = 4,
+ NativeOffset = 5,
+ NativeRegisterRegister = 6,
+ NativeRegisterStack = 7,
+ NativeStackRegister = 8,
+ BitField = 9
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/SymDocumentType.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymDocumentType.cs
new file mode 100644
index 00000000000..6bbabef32d6
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymDocumentType.cs
@@ -0,0 +1,21 @@
+//
+// System.Diagnostics.SymbolStore.SymDocumentType.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+ public class SymDocumentType
+ {
+ // Constructors
+ public SymDocumentType ()
+ {
+ }
+
+ // Fields
+ public static readonly Guid Text;
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageType.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageType.cs
new file mode 100644
index 00000000000..6dd232f081e
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageType.cs
@@ -0,0 +1,31 @@
+//
+// System.Diagnostics.SymbolStore.SymLanguageType.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+ public class SymLanguageType
+ {
+ // Constructors
+ public SymLanguageType ()
+ {
+ }
+
+ // Fields
+ public static readonly Guid Basic;
+ public static readonly Guid C;
+ public static readonly Guid Cobol;
+ public static readonly Guid CPlusPlus;
+ public static readonly Guid CSharp;
+ public static readonly Guid ILAssembly;
+ public static readonly Guid Java;
+ public static readonly Guid JScript;
+ public static readonly Guid MCPlusPlus;
+ public static readonly Guid Pascal;
+ public static readonly Guid SMC;
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageVendor.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageVendor.cs
new file mode 100644
index 00000000000..a9b439eb3e5
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymLanguageVendor.cs
@@ -0,0 +1,21 @@
+//
+// System.Diagnostics.SymbolStore.SymLanguageVendor.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+ public class SymLanguageVendor
+ {
+ // Constructors
+ public SymLanguageVendor ()
+ {
+ }
+
+ // Fields
+ public static readonly Guid Microsoft;
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics.SymbolStore/SymbolToken.cs b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymbolToken.cs
new file mode 100755
index 00000000000..7d355ac244e
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics.SymbolStore/SymbolToken.cs
@@ -0,0 +1,29 @@
+//
+// System.Diagnostics.SymbolStore.SymbolToken
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.Diagnostics.SymbolStore
+{
+
+public struct SymbolToken {
+
+ private int _val;
+
+ public SymbolToken (int val) { _val = val; }
+
+ [MonoTODO]
+ public override bool Equals (object obj) { return false; }
+
+ [MonoTODO]
+ public override int GetHashCode() { return 0; }
+
+ public int GetToken() { return _val; }
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Diagnostics/ChangeLog b/mcs/class/corlib/System.Diagnostics/ChangeLog
new file mode 100644
index 00000000000..eb8cef4735a
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/ChangeLog
@@ -0,0 +1,52 @@
+2002-04-08 Jonathan Pryor <jonpryor@vt.edu>
+
+ * Debugger.cs: Added [MonoTODO] attribute to methods; modified IsLogging()
+ and Log() so that System.Diagnostics.DefaultTraceListener could use them
+ without having NotImplementedException's thrown, as the functionality
+ DefaultTraceListener is using is non-critical.
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * ConditionalAttribute.cs: Add AttributeUsage attribute for methods.
+
+2002-01-23 Duncan Mak <duncan@ximian.com>
+
+ * DebuggerStepThroughAttribute.cs:
+ * DebuggerHiddenAttribte.cs: Add to CVS.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * StackFrame.cs : Use the MonoTODO attribute to mark
+ incomplete code.
+
+ StackTrace.cs : Ditto.
+
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Moved TraceListener, TextWriterTraceListener, and
+ DefaultTraceListener to System assembly....oops.
+
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+
+ * Added TextWriterTraceListener.cs, TraceListener.cs, and
+ DefaultTraceListener.cs to the build.
+
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+
+ * Added Debugger.cs to the build.
+
+2001-09-02 Miguel de Icaza <miguel@ximian.com>
+
+ * Moved BooleanSwitch, Switch, TraceLevel and TraceSwitch to the
+ System assembly.
+
+ * Added StackFrame.cs and StackTrace.cs to the build.
+
+2001-08-21 Nick Drochak <ndrochak@gol.com>
+
+ * Implemented ConditionalAttribute.cs and DebuggableAttribute.cs
+
+2001-08-29 Alexander Klyubin <klyubin@aqris.com>
+
+ * Skeletal implementation of StackFrame and StackTrace classes.
+ The classes must be somehow connected to runtime environment in
+ order to generate proper traces.
diff --git a/mcs/class/corlib/System.Diagnostics/ConditionalAttribute.cs b/mcs/class/corlib/System.Diagnostics/ConditionalAttribute.cs
new file mode 100644
index 00000000000..ea808ac500e
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/ConditionalAttribute.cs
@@ -0,0 +1,30 @@
+//
+// System.Collections.DebuggableAttribute.cs
+//
+// Author:
+// Nick Drochak II (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+namespace System.Diagnostics
+{
+
+ [Serializable]
+ [AttributeUsage(AttributeTargets.Method)]
+ public sealed class ConditionalAttribute : System.Attribute
+ {
+
+ private string myCondition;
+
+ // Public Instance Constructors
+ public ConditionalAttribute(string conditionString)
+ {
+ myCondition = conditionString;
+ }
+
+ // Public Instance Properties
+ public string ConditionString { get { return myCondition; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics/DebuggableAttribute.cs b/mcs/class/corlib/System.Diagnostics/DebuggableAttribute.cs
new file mode 100644
index 00000000000..68d0958b04e
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/DebuggableAttribute.cs
@@ -0,0 +1,28 @@
+//
+// System.Collections.DebuggableAttribute.cs
+//
+// Author:
+// Nick Drochak II (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+namespace System.Diagnostics {
+
+ public sealed class DebuggableAttribute : System.Attribute {
+
+ private bool JITTrackingEnabledFlag;
+ private bool JITOptimizerDisabledFlag;
+
+ // Public Instance Constructors
+ public DebuggableAttribute(bool isJITTrackingEnabled, bool isJITOptimizerDisabled) {
+ JITTrackingEnabledFlag = isJITTrackingEnabled;
+ JITOptimizerDisabledFlag = isJITOptimizerDisabled;
+ }
+
+ // Public Instance Properties
+ public bool IsJITTrackingEnabled { get { return JITTrackingEnabledFlag; } }
+
+ public bool IsJITOptimizerDisabled { get { return JITOptimizerDisabledFlag; } }
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics/Debugger.cs b/mcs/class/corlib/System.Diagnostics/Debugger.cs
new file mode 100644
index 00000000000..8b5c6789799
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/Debugger.cs
@@ -0,0 +1,94 @@
+//
+// System.Diagnostics.Debugger.cs
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+//
+// (C) 2001
+//
+using System;
+
+namespace System.Diagnostics
+{
+ /// <summary>
+ /// Enables communication with a debugger.
+ /// </summary>
+ [MonoTODO]
+ public sealed class Debugger
+ {
+ private static bool isAttached;
+
+ /// <summary>
+ /// Represents the default category of a message with a constant.
+ /// </summary>
+ public static readonly string DefaultCategory = "";
+
+ /// <summary>
+ /// Returns a Boolean indicating whether a debugger is attached to a process.
+ /// </summary>
+ /// <value>
+ /// true if debugger is attached; otherwise, false.
+ /// </value>
+ public static bool IsAttached
+ {
+ get
+ {
+ return isAttached;
+ }
+ }
+
+ /// <summary>
+ /// Causes a breakpoint to be signaled to an attached debugger.
+ /// </summary>
+ [MonoTODO]
+ public static void Break()
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Checks to see if logging is enabled by an attached debugger.
+ /// </summary>
+ [MonoTODO]
+ public static bool IsLogging()
+ {
+ // Return false. DefaultTraceListener invokes this method, so throwing
+ // a NotImplementedException wouldn't be appropriate.
+ return false;
+
+ }
+
+ /// <summary>
+ /// Launches and attaches a debugger to the process.
+ /// </summary>
+ [MonoTODO]
+ public static bool Launch()
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Posts a message for the attached debugger.
+ /// </summary>
+ /// <param name="level">
+ /// A description of the importance of this message
+ /// </param>
+ /// <param name="category">
+ /// A string describing the category of this message.
+ /// </param>
+ /// <param name="message">
+ /// A string representing the message to show.
+ /// </param>
+ [MonoTODO]
+ public static void Log(int level, string category, string message)
+ {
+ // Do nothing. DefaultTraceListener invokes this method, so throwing
+ // a NotImplementedException wouldn't be appropriate.
+ }
+
+ public Debugger()
+ {
+ isAttached = false;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics/DebuggerHiddenAttribute.cs b/mcs/class/corlib/System.Diagnostics/DebuggerHiddenAttribute.cs
new file mode 100644
index 00000000000..b57db27cb8b
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/DebuggerHiddenAttribute.cs
@@ -0,0 +1,25 @@
+//
+// System.Diagnostics.DebuggerHiddenAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Diagnostics
+{
+ [AttributeUsage (AttributeTargets.Constructor |
+ AttributeTargets.Method | AttributeTargets.Property)]
+ [Serializable]
+ public sealed class DebuggerHiddenAttribute : Attribute
+ {
+ public DebuggerHiddenAttribute ()
+ : base ()
+ {
+ }
+ }
+}
+
+
diff --git a/mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs b/mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs
new file mode 100644
index 00000000000..27d81891a1d
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/DebuggerStepThroughAttribute.cs
@@ -0,0 +1,23 @@
+//
+// System.Diagnostics.DebuggerStepThroughAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Diagnostics
+{
+ [AttributeUsage (AttributeTargets.Constructor |
+ AttributeTargets.Method | AttributeTargets.Property)]
+ [Serializable]
+ public sealed class DebuggerStepThroughAttribute : Attribute
+ {
+ public DebuggerStepThroughAttribute ()
+ : base ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics/StackFrame.cs b/mcs/class/corlib/System.Diagnostics/StackFrame.cs
new file mode 100644
index 00000000000..a919eb6b989
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/StackFrame.cs
@@ -0,0 +1,316 @@
+//
+// System.Diagnostics.StackFrame.cs
+//
+// Author:
+// Alexander Klyubin (klyubin@aqris.com)
+//
+// (C) 2001
+//
+
+using System;
+using System.Reflection;
+
+namespace System.Diagnostics {
+ /// <summary>
+ /// Stack frame.
+ /// TODO: more information.
+ /// </summary>
+ [Serializable]
+ public class StackFrame {
+ /// <value>
+ /// Constant returned when the native or IL offset is unknown.
+ /// </value>
+ public const int OFFSET_UNKNOWN = -1;
+
+ /// <value>
+ /// Offset from the start of the IL code for the method
+ /// being executed.
+ /// </value>
+ private int ilOffset = OFFSET_UNKNOWN;
+
+ /// <value>
+ /// Method associated with this stack frame.
+ /// </value>
+ private MethodBase methodBase;
+
+ /// <value>
+ /// File name.
+ /// </value>
+ private string fileName;
+
+ /// <value>
+ /// Line number.
+ /// </value>
+ private int lineNumber;
+
+ /// <value>
+ /// Column number.
+ /// </value>
+ private int columnNumber;
+
+
+ /// <summary>
+ /// Initializes a new StackFrame object corresponding to the
+ /// active stack frame.
+ /// </summary>
+ public StackFrame() {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Initializes a new StackFrame object corresponding to the
+ /// active stack frame.
+ /// </summary>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackFrame(bool needFileInfo) : this() {
+ if (needFileInfo) {
+ PopulateFileInfo();
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new StackFrame object corresponding to the
+ /// active stack frame.
+ /// </summary>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to skip.
+ /// </param>
+ public StackFrame(int skipFrames) {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Initializes a new StackFrame object corresponding to the
+ /// active stack frame.
+ /// </summary>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to skip.
+ /// </param>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackFrame(int skipFrames, bool needFileInfo)
+ : this(skipFrames) {
+ if (needFileInfo) {
+ PopulateFileInfo();
+ }
+ }
+
+ /// <summary>
+ /// Constructs a fake stack frame that just contains the
+ /// given file name and line number. Use this constructor
+ /// when you do not want to use the debugger's line mapping
+ /// logic.
+ /// </summary>
+ /// <param name="fileName">
+ /// The given file name.
+ /// </param>
+ /// <param name="lineNumber">
+ /// The line number in the specified file.
+ /// </param>
+ public StackFrame(string fileName, int lineNumber)
+ : this (fileName, lineNumber, 0) {}
+
+ /// <summary>
+ /// Constructs a fake stack frame that just contains the
+ /// given file name and line number. Use this constructor
+ /// when you do not want to use the debugger's line mapping
+ /// logic.
+ /// </summary>
+ /// <param name="fileName">
+ /// The given file name.
+ /// </param>
+ /// <param name="lineNumber">
+ /// The line number in the specified file.
+ /// </param>
+ /// <param name="colNumber">
+ /// The column number in the specified file.
+ /// </param>
+ public StackFrame(string fileName,
+ int lineNumber,
+ int colNumber) {
+ this.methodBase = null;
+ this.fileName = fileName;
+ this.lineNumber = lineNumber;
+ this.columnNumber = colNumber;
+ }
+
+
+ /// <summary>
+ /// Gets the line number in the file containing the code
+ /// being executed. This information is typically extracted
+ /// from the debugging symbols for the executable.
+ /// </summary>
+ /// <returns>
+ /// The file line number or zero if it cannot be determined.
+ /// </returns>
+ public virtual int GetFileLineNumber()
+ {
+ return lineNumber;
+ }
+
+ /// <summary>
+ /// Gets the column number in the file containing the code
+ /// being executed. This information is typically extracted
+ /// from the debugging symbols for the executable.
+ /// </summary>
+ /// <returns>
+ /// The file column number or zero if it cannot be determined.
+ /// </returns>
+ public virtual int GetFileColumnNumber()
+ {
+ return columnNumber;
+ }
+
+ /// <summary>
+ /// Gets the file name containing the code being executed.
+ /// This information is typically extracted from the
+ /// debugging symbols for the executable.
+ /// </summary>
+ /// <returns>
+ /// The file name or null if it cannot be determined.
+ /// </returns>
+ public virtual string GetFileName()
+ {
+ return fileName;
+ }
+
+ /// <summary>
+ /// Gets the offset from the start of the IL code for the
+ /// method being executed. This offset may be approximate
+ /// depending on whether the JIT compiler is generating
+ /// debugging code or not.
+ /// </summary>
+ /// <returns>
+ /// The offset from the start of the IL code for the method
+ /// being executed.
+ /// </returns>
+ public virtual int GetILOffset()
+ {
+ return ilOffset;
+ }
+
+ /// <summary>
+ /// Gets the method in which the frame is executing.
+ /// </summary>
+ /// <returns>
+ /// The method the frame is executing in.
+ /// </returns>
+ public virtual MethodBase GetMethod()
+ {
+ return methodBase;
+ }
+
+ /// <summary>
+ /// Gets the offset from the start of the native
+ /// (JIT-compiled) code for the method being executed.
+ /// </summary>
+ /// <returns>
+ /// The offset from the start of the native (JIT-compiled)
+ /// code or the method being executed.
+ /// </returns>
+ public virtual int GetNativeOffset()
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Builds a readable representation of the stack frame.
+ /// </summary>
+ /// <returns>
+ /// A readable representation of the stack frame.
+ /// </returns>
+ public override string ToString() {
+ string methodNameString =
+ (GetMethod() == null)
+ ? "<unknown method>"
+ : GetMethod().Name;
+ string offsetString =
+ (GetILOffset() == OFFSET_UNKNOWN)
+ ? "<unknown offset>"
+ : "offset " + GetILOffset();
+ string fileNameString =
+ (GetFileName() == null)
+ ? "<filename unknown>" : GetFileName();
+ return methodNameString + " at " + offsetString
+ + " in file:line:column " + fileNameString
+ + ":" + GetFileLineNumber()
+ + ":" + GetFileColumnNumber();
+ }
+
+ public override bool Equals(Object obj) {
+ if ((obj == null) || (!(obj is StackFrame))) {
+ return false;
+ }
+
+ StackFrame rhs = (StackFrame) obj;
+
+ if (!ObjectsEqual(GetMethod(), rhs.GetMethod())) {
+ return false;
+ }
+
+ if (!ObjectsEqual(GetFileName(), rhs.GetFileName())) {
+ return false;
+ }
+
+ if (GetFileLineNumber() != rhs.GetFileLineNumber()) {
+ return false;
+ }
+
+ if (GetFileColumnNumber() != rhs.GetFileColumnNumber()) {
+ return false;
+ }
+
+ if (GetILOffset() != rhs.GetILOffset()) {
+ return false;
+ }
+
+ if (GetNativeOffset() != rhs.GetNativeOffset()) {
+ return false;
+ }
+
+ return true;
+
+ }
+
+ public override int GetHashCode() {
+ return GetFileLineNumber();
+ }
+
+ /// <summary>
+ /// Checks whether two objects are equal.
+ /// The objects are assumed equal if and only if either
+ /// both of the references are <code>null</code> or they
+ /// equal via <code>Equals</code> method.
+ /// </summary>
+ /// <param name="obj1">
+ /// First object.
+ /// </param>
+ /// <param name="obj2">
+ /// Second object.
+ /// </param>
+ /// <returns>
+ /// <code>true</code> if the two objects are equal,
+ /// </code>false</code> otherwise.
+ /// </returns>
+ private static bool ObjectsEqual(Object obj1, Object obj2) {
+ if (obj1 == null) {
+ return (obj2 == null);
+ } else {
+ return obj1.Equals(obj2);
+ }
+ }
+
+ /// <summary>
+ /// Populates file information for this frame.
+ /// </summary>
+ [MonoTODO]
+ private void PopulateFileInfo() {
+ // TODO: Populate this.fileName, this.lineNumber and
+ // this.columnNumber
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Diagnostics/StackTrace.cs b/mcs/class/corlib/System.Diagnostics/StackTrace.cs
new file mode 100644
index 00000000000..8e45008b456
--- /dev/null
+++ b/mcs/class/corlib/System.Diagnostics/StackTrace.cs
@@ -0,0 +1,291 @@
+//
+// System.Diagnostics.StackTrace.cs
+//
+// Author:
+// Alexander Klyubin (klyubin@aqris.com)
+//
+// (C) 2001
+//
+
+using System;
+using System.Reflection;
+using System.Threading;
+
+namespace System.Diagnostics {
+ /// <summary>
+ /// Stack trace.
+ /// TODO: more information.
+ /// </summary>
+ [Serializable]
+ public class StackTrace {
+ /// <value>
+ /// Uses a constant to define the number of methods that are
+ /// to be omitted from the stack trace.
+ /// </value>
+ public const int METHODS_TO_SKIP = 0;
+
+ /// <value>
+ /// Frames. First frame is the last stack frame pushed.
+ /// </value>
+ private StackFrame[] frames;
+
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class.
+ /// </summary>
+ [MonoTODO]
+ public StackTrace() {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class.
+ /// </summary>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackTrace(bool needFileInfo) : this() {}
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class.
+ /// </summary>
+ /// <param name="e">
+ /// TODO:
+ /// </param>
+ [MonoTODO]
+ public StackTrace(Exception e) {
+ throw new NotImplementedException();
+ }
+
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class,
+ /// using the provided exception object. The resulting stack
+ /// trace describes the stack at the time of the exception.
+ /// </summary>
+ /// <param name="e">
+ /// TODO:
+ /// </param>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackTrace(Exception e, bool needFileInfo) : this(e) {}
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class,
+ /// using the provided exception object. The resulting stack
+ /// trace describes the stack at the time of the exception.
+ /// </summary>
+ /// <param name="e">
+ /// Exception.
+ /// </param>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to start the trace
+ /// from.
+ /// </param>
+ [MonoTODO]
+ public StackTrace(Exception e, int skipFrames) {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class,
+ /// using the provided exception object. The resulting stack
+ /// trace describes the stack at the time of the exception.
+ /// </summary>
+ /// <param name="e">
+ /// Exception.
+ /// </param>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to start the trace
+ /// from.
+ /// </param>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackTrace(Exception e, int skipFrames, bool needFileInfo)
+ : this(e, skipFrames) {}
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class
+ /// from the current location, in a caller's frame.
+ /// </summary>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to start the trace
+ /// from.
+ /// </param>
+ [MonoTODO]
+ public StackTrace(int skipFrames) {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class
+ /// containing a single frame.
+ /// </summary>
+ /// <param name="frame">
+ /// The frame that the StackTrace object should contain.
+ /// </param>
+ public StackTrace(StackFrame frame) {
+ this.frames = new StackFrame[1];
+ this.frames[0] = frame;
+ }
+
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class
+ /// from the current location, in a caller's frame.
+ /// </summary>
+ /// <param name="skipFrames">
+ /// The number of frames up the stack to start the trace
+ /// from.
+ /// </param>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ public StackTrace(int skipFrames, bool needFileInfo)
+ : this(skipFrames) {}
+
+ /// <summary>
+ /// Initializes a new instance of the StackTrace class.
+ /// </summary>
+ /// <param name="targetThread">
+ /// TODO:
+ /// </param>
+ /// <param name="needFileInfo">
+ /// TODO:
+ /// </param>
+ [MonoTODO]
+ public StackTrace(Thread targetThread, bool needFileInfo) {
+ throw new NotImplementedException();
+ }
+
+
+
+ /// <summary>
+ /// Holds the number of frames in the stack trace.
+ /// </summary>
+ public virtual int FrameCount {
+ get {
+ return (frames == null) ? 0 : frames.Length;
+ }
+ }
+
+ /// <summary>
+ /// Gets the specified stack frame.
+ /// </summary>
+ /// <param name="index">
+ /// The index of the stack frame requested.
+ /// </param>
+ /// <returns>
+ /// The specified stack frame. Returns <code>null</code> if
+ /// frame with specified index does not exist in this stack
+ /// trace.
+ /// </returns>
+ /// <remarks>
+ /// Stack frames are numbered starting at zero, which is the
+ /// last stack frame pushed.
+ /// </remarks>
+ public virtual StackFrame GetFrame(int index) {
+ if ((index < 0) || (index >= FrameCount)) {
+ return null;
+ }
+
+ return frames[index];
+ }
+
+ /// <summary>
+ /// Builds a readable representation of the stack trace.
+ /// </summary>
+ /// <returns>
+ /// A readable representation of the stack trace.
+ /// </returns>
+ public override string ToString() {
+ string result = "";
+ for (int i = 0; i < FrameCount; i++) {
+ StackFrame frame = GetFrame(i);
+ result += "\n\tat " + FrameToString(frame);
+ }
+
+ return result;
+ }
+
+ public override bool Equals(Object obj) {
+ if ((obj == null) || (!(obj is StackTrace))) {
+ return false;
+ }
+
+ StackTrace rhs = (StackTrace) obj;
+
+ if (FrameCount != rhs.FrameCount) {
+ return false;
+ }
+
+ for (int i = 0; i < FrameCount; i++) {
+ if (!GetFrame(i).Equals(rhs.GetFrame(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public override int GetHashCode() {
+ return FrameCount;
+ }
+
+ /// <summary>
+ /// Converts single stack frame to string to be used in
+ /// ToString method.
+ /// </summary>
+ /// <param name="frame">
+ /// Frame to convert.
+ /// </param>
+ /// <returns>
+ /// A readable representation of stack frame for using
+ /// ToString.
+ /// </returns>
+ private static String FrameToString(StackFrame frame) {
+ string locationInfo;
+
+ if (frame.GetFileName() == null) {
+ // File name not available
+ locationInfo = "";
+ } else {
+ // File name available
+ locationInfo = frame.GetFileName();
+ if (frame.GetFileLineNumber() != 0) {
+ // Line number information available
+ locationInfo += ":line "
+ + frame.GetFileLineNumber();
+ if (frame.GetFileColumnNumber() != 0) {
+ // Column number information available
+ locationInfo += ":column"
+ + frame.GetFileColumnNumber();
+ }
+ }
+
+ }
+
+ MethodBase method = frame.GetMethod();
+ if (method != null) {
+ // Method information available
+ return method.DeclaringType.Name
+ + "." + method.Name + "()"
+ + ((locationInfo != null)
+ ? " at " + locationInfo
+ : "");
+ } else {
+ // Method information not available
+ string methodInfo = "<unknown method>";
+ if ("".Equals(locationInfo)) {
+ // No location information available
+ return methodInfo;
+ }
+
+ // Location information available
+ return methodInfo + " at " + locationInfo;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/Calendar.cs b/mcs/class/corlib/System.Globalization/Calendar.cs
new file mode 100644
index 00000000000..8b36614dd27
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/Calendar.cs
@@ -0,0 +1,917 @@
+// Calendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+using System.IO;
+
+/// <remarks>
+/// The class serves as a base class for calendar classes.
+/// </remarks>
+[Serializable]
+public abstract class Calendar {
+ /// <value>An protected integer property that gives the number of
+ /// days in a week. It might be overridden.</value>
+ internal virtual int M_DaysInWeek
+ {
+ get { return 7; }
+ }
+
+ /// <summary>
+ /// The protected method creates the string used in the
+ /// <see cref="T:System.ArgumentOutOfRangeException"/>
+ /// </summary>
+ /// <param name="a">An object that represents the smallest
+ /// allowable value.</param>
+ /// <param name="b">An object that represents the greatest allowable
+ /// value.</param>
+ /// <returns>The string used in the
+ /// <see cref="T:System.ArgumentOutOfRangeException"/>
+ /// </returns>
+ internal string M_ValidValues(object a, object b)
+ {
+ StringWriter sw = new StringWriter();
+ sw.Write("Valid values are between {0} and {1}, inclusive.",
+ a, b);
+ return sw.ToString();
+ }
+
+ /// <summary>
+ /// The protected method checks wether the parameter
+ /// <paramref name="arg"/> is in the allowed range.
+ /// </summary>
+ /// <param name="param">A string that gives the name of the
+ /// parameter to check.</param>
+ /// <param name="arg">An integer that gives the value to check.
+ /// </param>
+ /// <param name="a">An integer that represents the smallest allowed
+ /// value.</param>
+ /// <param name="b">An integer that represents the greatest allowed
+ /// value.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the <paramref name="arg"/> is outside
+ /// the allowed range.
+ /// </exception>
+ internal void M_ArgumentInRange(string param, int arg, int a, int b)
+ {
+ if (a <= arg && arg <= b)
+ return;
+ throw new ArgumentOutOfRangeException(param, M_ValidValues(a, b));
+ }
+
+ /// <summary>
+ /// The protected method, that checks whether
+ /// <paramref name="hour"/>, <paramref name="minute"/>,
+ /// <paramref name="second"/>, and <parameref name="millisecond"/>
+ /// are in their valid ranges
+ /// </summary>
+ /// <param name="hour">An integer that represents a hour,
+ /// should be between 0 and 23.</param>
+ /// <param name="minute">An integer that represents a minute,
+ /// should be between 0 and 59.</param>
+ /// <param name="second">An integer that represents a second,
+ /// should be between 0 and 59.</param>
+ /// <param name="milliseconds">An integer that represents a number
+ /// of milliseconds, should be between 0 and 999999.</param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The Exception is thrown, if one of the parameter is outside the
+ /// allowed the range.
+ /// </exception>
+ internal void M_CheckHMSM(int hour, int minute, int second,
+ int milliseconds)
+ {
+ M_ArgumentInRange("hour", hour, 0, 23);
+ M_ArgumentInRange("minute", minute, 0, 59);
+ M_ArgumentInRange("second", second, 0, 59);
+ M_ArgumentInRange("milliseconds", milliseconds, 0, 999999);
+ }
+
+ /// <value>
+ /// A represantation of the CurrentEra.
+ /// </value>
+ public const int CurrentEra = 0;
+
+ /// <value>When overridden gives the eras supported by the
+ /// calendar as an array of integers.
+ /// </value>
+ public abstract int[] Eras { get; }
+
+ /// <summary>
+ /// The protected member stores the value for the
+ /// <see cref="P:TwoDigitYearMax"/>
+ /// property.
+ /// </summary>
+ internal int M_TwoDigitYearMax;
+
+
+ /// <summary>
+ /// Private field containing the maximum year for the calendar.
+ /// </summary>
+ private int M_MaxYearValue = 0;
+
+ /// <value>
+ /// Get-only property returing the maximum allowed year for this
+ /// class.
+ /// </value>
+ internal virtual int M_MaxYear {
+ get {
+ if (M_MaxYearValue == 0) {
+ M_MaxYearValue = GetYear(DateTime.MaxValue);
+ }
+ return M_MaxYearValue;
+ }
+ }
+
+ /// <summary>
+ /// Checks whether the year is the era is valid, if era = CurrentEra
+ /// the right value is set.
+ /// </summary>
+ /// <param name="year">The year to check.</param>
+ /// <param name="era">The era to check.</Param>
+ /// <exception cref="T:ArgumentOutOfRangeException">
+ /// The exception will be thrown, if the year is not valid.
+ /// </exception>
+ internal abstract void M_CheckYE(int year, ref int era);
+
+ /// <value>
+ /// <para>The property gives the maximum value for years with two
+ /// digits. If the property has the value 2029, than the two-digit
+ /// integer 29 results in the year 2029 and 30 in the
+ /// year 1930.</para>
+ /// <para>It might be overridden.</para>
+ /// </value>
+ public virtual int TwoDigitYearMax {
+ get { return M_TwoDigitYearMax; }
+ set {
+ M_ArgumentInRange("year", value, 100, M_MaxYear);
+ int era = CurrentEra;
+ M_CheckYE(value, ref era);
+ M_TwoDigitYearMax = value;
+ }
+ }
+
+ /// <summary>
+ /// The virtual method adds days to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// days.
+ /// </param>
+ /// <param name="days">The number of days to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="days"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddDays(DateTime time, int days) {
+ return time.Add(TimeSpan.FromDays(days));
+ }
+
+ /// <summary>
+ /// The virtual method adds hours to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// hours.
+ /// </param>
+ /// <param name="hours">The number of hours to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="hours"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddHours(DateTime time, int hours) {
+ return time.Add(TimeSpan.FromHours(hours));
+ }
+
+ /// <summary>
+ /// The virtual method adds milliseconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// milliseconds.
+ /// </param>
+ /// <param name="milliseconds">The number of milliseconds given as
+ /// double to add. Keep in mind the 100 nanosecond resolution of
+ /// <see cref="T:System.DateTime"/>.
+ /// </param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="milliseconds"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddMilliseconds(DateTime time,
+ double milliseconds)
+ {
+ return time.Add(TimeSpan.FromMilliseconds(milliseconds));
+ }
+
+ /// <summary>
+ /// The virtual method adds minutes to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// minutes.
+ /// </param>
+ /// <param name="minutes">The number of minutes to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="minutes"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddMinutes(DateTime time, int minutes) {
+ return time.Add(TimeSpan.FromMinutes(minutes));
+ }
+
+ /// <summary>
+ /// When overrideden adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public abstract DateTime AddMonths(DateTime time, int months);
+
+ /// <summary>
+ /// The virtual method adds seconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// seconds.
+ /// </param>
+ /// <param name="seconds">The number of seconds to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="seconds"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddSeconds(DateTime time, int seconds) {
+ return time.Add(TimeSpan.FromSeconds(seconds));
+ }
+
+ /// <summary>
+ /// A wirtual method that adds weeks to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// weeks.
+ /// </param>
+ /// <param name="weeks">The number of weeks to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="weeks"/> to the specified
+ /// DateTime.</returns>
+ public virtual DateTime AddWeeks(DateTime time, int weeks) {
+ return time.AddDays(weeks * M_DaysInWeek);
+ }
+
+ /// <summary>
+ /// When overrideden adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public abstract DateTime AddYears(DateTime time, int years);
+
+ /// <summary>
+ /// When overriden gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public abstract int GetDayOfMonth(DateTime time);
+
+ /// <summary>
+ /// When overriden gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public abstract DayOfWeek GetDayOfWeek(DateTime time);
+
+ /// <summary>
+ /// When overridden gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public abstract int GetDayOfYear(DateTime time);
+
+ /// <summary>
+ /// A virtual method that gives the number of days of the specified
+ /// month of the <paramref name="year"/> and the
+ /// <see cref="P:CurrentEra"/>.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the current
+ /// era.</param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/> or
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public virtual int GetDaysInMonth(int year, int month) {
+ return GetDaysInMonth(year, month, CurrentEra);
+ }
+
+ /// <summary>
+ /// When overridden gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An intger that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public abstract int GetDaysInMonth(int year, int month, int era);
+
+ /// <summary>
+ /// A virtual method that gives the number of days of the specified
+ /// year of the <see cref="P:CurrentEra"/>.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the current
+ /// era.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public virtual int GetDaysInYear(int year) {
+ return GetDaysInYear(year, CurrentEra);
+ }
+
+ /// <summary>
+ /// When overridden gives the number of days of the specified
+ /// year of the given era..
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public abstract int GetDaysInYear(int year, int era);
+
+ /// <summary>
+ /// When overridden gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ public abstract int GetEra(DateTime time);
+
+ /// <summary>
+ /// Virtual method that gives the hour of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the hour of the specified time,
+ /// starting with 0.</returns>
+ public virtual int GetHour(DateTime time) {
+ return time.TimeOfDay.Hours;
+ }
+
+ /// <summary>
+ /// Virtual method that gives the milliseconds in the current second
+ /// of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the milliseconds in the seconds
+ /// of the specified time, starting with 0.</returns>
+ public virtual double GetMilliseconds(DateTime time) {
+ return time.TimeOfDay.Milliseconds;
+ }
+
+ /// <summary>
+ /// Virtual method that gives the minute of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the minute of the specified time,
+ /// starting with 0.</returns>
+ public virtual int GetMinute(DateTime time) {
+ return time.TimeOfDay.Minutes;
+ }
+
+ /// <summary>
+ /// When overridden gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public abstract int GetMonth(DateTime time);
+
+ /// <summary>
+ /// Virtual method that gives the number of months of the specified
+ /// year of the <see cref="M:CurrentEra"/>.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// current era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year is not allowed in the
+ /// current era.
+ /// </exception>
+ public virtual int GetMonthsInYear(int year) {
+ return GetMonthsInYear(year, CurrentEra);
+ }
+
+ /// <summary>
+ /// When overridden gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public abstract int GetMonthsInYear(int year, int era);
+
+ /// <summary>
+ /// Virtual method that gives the second of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the second of the specified time,
+ /// starting with 0.</returns>
+ public virtual int GetSecond(DateTime time) {
+ return time.TimeOfDay.Seconds;
+ }
+
+ /// <summary>
+ /// A protected method to calculate the number of days between two
+ /// dates.
+ /// </summary>
+ /// <param name="timeA">A <see cref="T:System.DateTime"/>
+ /// representing the first date.
+ /// </param>
+ /// <param name="timeB">A <see cref="T:System.DateTime"/>
+ /// representing the second date.
+ /// </param>
+ /// <returns>An integer that represents the difference of days
+ /// between <paramref name="timeA"/> and <paramref name="timeB"/>.
+ /// </returns>
+ internal int M_DiffDays(DateTime timeA, DateTime timeB) {
+ long diff = timeA.Ticks - timeB.Ticks;
+
+ if (diff >= 0) {
+ return (int)(diff/TimeSpan.TicksPerDay);
+ }
+
+ diff += 1;
+ return -1 + (int)(diff/TimeSpan.TicksPerDay);
+ }
+
+ /// <summary>
+ /// A protected method that gives the first day of the second week of
+ /// the year.
+ /// </summary>
+ /// <param name="year">An integer that represents the year.</param>
+ /// <param name="rule">The
+ /// <see cref="T:System.Globalization.CalendarWeekRule"/>
+ /// to be used for the calculation.
+ /// </param>
+ /// <param name="firstDayOfWeek">
+ /// The <see cref="T:System.Globalization.DayOfWeek"/>
+ /// specifying the first day in a week.
+ /// </param>
+ /// <returns>The <see cref="T:System.DateTime"/> representing
+ /// the first day of the second week of the year.
+ /// </returns>
+ internal DateTime M_GetFirstDayOfSecondWeekOfYear(
+ int year, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
+ {
+ DateTime d1 = ToDateTime(year, 1, 1, 0, 0, 0, 0);
+ int dow1 = (int)GetDayOfWeek(d1);
+ int fdow = (int)firstDayOfWeek;
+ int d = 0;
+
+ switch (rule) {
+ case CalendarWeekRule.FirstDay:
+ if (fdow > dow1) {
+ d += fdow - dow1;
+ }
+ else {
+ d += fdow + M_DaysInWeek - dow1;
+ }
+ break;
+ case CalendarWeekRule.FirstFullWeek:
+ d = M_DaysInWeek;
+ if (fdow >= dow1) {
+ d += fdow - dow1;
+ }
+ else {
+ d += fdow + M_DaysInWeek - dow1;
+ }
+ break;
+ case CalendarWeekRule.FirstFourDayWeek:
+ int dow4 = (dow1 + 3)%M_DaysInWeek;
+
+ d = 3;
+ if (fdow > dow4) {
+ d += fdow - dow4;
+ }
+ else {
+ d += fdow + M_DaysInWeek - dow4;
+ }
+ break;
+ }
+
+ return AddDays(d1, d);
+ }
+
+ /// <summary>
+ /// A virtual method that gives the number of the week in the year.
+ /// </summary>
+ /// <param name="time">A
+ /// <see cref="T:System.DateTime"/> representing the date.
+ /// </param>
+ /// <param name="rule">The
+ /// <see cref="T:System.Globalization.CalendarWeekRule"/>
+ /// to be used for the calculation.
+ /// </param>
+ /// <param name="firstDayOfWeek">
+ /// The <see cref="T:System.Globalization.DayOfWeek"/>
+ /// specifying the first day in a week.
+ /// </param>
+ /// <returns>An integer representing the number of the week in the
+ /// year, starting with 1.
+ /// </returns>
+ public virtual int GetWeekOfYear(DateTime time,
+ CalendarWeekRule rule,
+ DayOfWeek firstDayOfWeek)
+ {
+ if (firstDayOfWeek < DayOfWeek.Sunday ||
+ DayOfWeek.Saturday < firstDayOfWeek)
+ {
+ throw new ArgumentOutOfRangeException("firstDayOfWeek",
+ "Value is not a valid day of week.");
+ }
+ int year = GetYear(time);
+
+ int days;
+
+ while (true) {
+ DateTime secondWeek = M_GetFirstDayOfSecondWeekOfYear(
+ year, rule, firstDayOfWeek);
+ days = M_DiffDays(time, secondWeek) + M_DaysInWeek;
+ if (days >= 0)
+ break;
+ year -= 1;
+ }
+
+ return 1 + days/M_DaysInWeek;
+ }
+
+ /// <summary>
+ /// When overridden gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ public abstract int GetYear(DateTime time);
+
+ /// <summary>
+ /// A virtual method that tells whether the given day in the
+ /// <see cref="M:CurrentEra"/> is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// current era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month or day is not valid
+ /// the current era.
+ /// </exception>
+ public virtual bool IsLeapDay(int year, int month, int day) {
+ return IsLeapDay(year, month, day, CurrentEra);
+ }
+
+ /// <summary>
+ /// Tells when overridden whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public abstract bool IsLeapDay(int year, int month, int day, int era);
+
+ /// <summary>
+ /// A virtual method that tells whether the given month of the
+ /// specified year in the
+ /// <see cref="M:CurrentEra"/> is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// current era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or month is not valid
+ /// the current era.
+ /// </exception>
+ public virtual bool IsLeapMonth(int year, int month) {
+ return IsLeapMonth(year, month, CurrentEra);
+ }
+
+ /// <summary>
+ /// Tells when overridden whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public abstract bool IsLeapMonth(int year, int month, int era);
+
+ /// <summary>
+ /// A virtual method that tells whether the given year
+ /// in the
+ /// <see cref="M:CurrentEra"/> is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// current era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year is not valid
+ /// the current era.
+ /// </exception>
+ public virtual bool IsLeapYear(int year) {
+ return IsLeapYear(year, CurrentEra);
+ }
+
+ /// <summary>
+ /// Tells when overridden whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public abstract bool IsLeapYear(int year, int era);
+
+ /// <summary>
+ /// A virtual method that creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <see cref="M:CurrentEra"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public virtual DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds)
+ {
+ return ToDateTime(year, month, day, hour, minute, second,
+ milliseconds, CurrentEra);
+ }
+
+
+ /// <summary>
+ /// When overridden creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public abstract DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era);
+
+ /// <summary>
+ /// A virtual method that converts a two-digit year to a four-digit
+ /// year. It uses the <see cref="M:TwoDigitYearMax"/> property.
+ /// </summary>
+ /// <param name="year">An integer that gives the two-digit year.
+ /// </param>
+ /// <returns>An integer giving the four digit year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the year is negative or the resulting
+ /// year is invalid.
+ /// </exception>
+ public virtual int ToFourDigitYear(int year) {
+ if (year < 0)
+ throw new ArgumentOutOfRangeException(
+ "year", "Non-negative number required.");
+ /* seems not to be the right thing to do, but .NET is
+ * doing it this way.
+ */
+ if (year <= 99) {
+ int year2 = TwoDigitYearMax%100;
+ int d = year - year2;
+ year = TwoDigitYearMax + d + (d <= 0 ? 0 : -100);
+ }
+ int era = CurrentEra;
+ M_CheckYE(year, ref era);
+ return year;
+ }
+
+ // TwoDigitYearMax: Windows reads it from the Registry, we
+ // should have an XML file with the defaults
+ /// <summary>
+ /// The default constructor, is sets the TwoDigitYearMax to 2029.
+ /// </summary>
+ /// <remarks>
+ /// The .NET framework reads the value from the registry.
+ /// We should implement it here. Currently I set the default values
+ /// in the ctors of the derived classes, if it is 99.
+ /// </remarks>
+ protected Calendar() {
+ M_TwoDigitYearMax = 99;
+ }
+
+ /// <summary>Protected field storing the abbreviated era names.
+ /// </summary>
+ internal string[] M_AbbrEraNames;
+ /// <summary>Protected field storing the era names.
+ /// </summary>
+ internal string[] M_EraNames;
+
+ /// <value>
+ /// The property stores the era names. It might be overwritten by
+ /// CultureInfo.
+ /// </value>
+ internal string[] AbbreviatedEraNames {
+ get {
+ if (M_AbbrEraNames == null ||
+ M_AbbrEraNames.Length != Eras.Length)
+ throw new Exception(
+ "Internal: M_AbbrEraNames " +
+ "wrong initialized!");
+ return (string[])M_AbbrEraNames.Clone();
+ }
+ set {
+ if (value.Length != Eras.Length) {
+ StringWriter sw = new StringWriter();
+ sw.Write("Array length must be equal Eras " +
+ "length {0}.", Eras.Length);
+ throw new ArgumentException(
+ sw.ToString());
+ }
+ M_AbbrEraNames = (string[])value.Clone();
+ }
+ }
+
+ /// <value>
+ /// The property stores the era names. It might be overwritten by
+ /// CultureInfo.
+ /// </value>
+ internal string[] EraNames {
+ get {
+ if (M_EraNames == null ||
+ M_EraNames.Length != Eras.Length)
+ throw new Exception(
+ "Internal: M_EraNames " +
+ "not initialized!");
+ return (string[])M_EraNames.Clone();
+ }
+ set {
+ if (value.Length != Eras.Length) {
+ StringWriter sw = new StringWriter();
+ sw.Write("Array length must be equal Eras " +
+ "length {0}.", Eras.Length);
+ throw new ArgumentException(
+ sw.ToString());
+ }
+ M_EraNames = (string[])value.Clone();
+ }
+ }
+} // class Calendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/CalendarWeekRule.cs b/mcs/class/corlib/System.Globalization/CalendarWeekRule.cs
new file mode 100644
index 00000000000..936a56e8469
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/CalendarWeekRule.cs
@@ -0,0 +1,28 @@
+// ::MONO
+//
+// System.Globalization.CalendarWeekRule.cs
+//
+// Copyright (C) Wictor Wilén 2001 (wictor@iBizkit.se)
+//
+// Contributors: Wictor Wilén
+//
+// Revisions
+// 2001-09-14: First draft
+// 2001-09-15: First release
+
+using System;
+
+namespace System.Globalization
+{
+ /// <summary>
+ /// The System.Globalization.CalendarWeekRule enumeration
+ /// </summary>
+ public enum CalendarWeekRule
+ {
+ FirstDay = 0,
+ FirstFullWeek = 1,
+ FirstFourDayWeek = 2
+
+ }
+
+}
diff --git a/mcs/class/corlib/System.Globalization/CalendricalCalculations.cs b/mcs/class/corlib/System.Globalization/CalendricalCalculations.cs
new file mode 100644
index 00000000000..3f493f2cc2e
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/CalendricalCalculations.cs
@@ -0,0 +1,2120 @@
+// CalendricalCalculations.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System.Collections;
+
+/// <summary>A class that provides mathematical functions.</summary>
+/// <remarks>
+/// <para>
+/// We are breaking the .Net
+/// naming conventions to be compatible to the "Calendrical Calculations"
+/// bool.
+/// </para>
+/// </remarks>
+internal class CCMath {
+ /// <summary>
+ /// A static method which rounds a double value.
+ /// </summary>
+ /// <param name="x">The double value to round.</param>
+ /// <returns>The rounded double.</returns>
+ public static double round(double x) {
+ return System.Math.Floor(x+0.5);
+ }
+
+ /// <summary>
+ /// A static method that computes the remainder of the division
+ /// of two doubles.
+ /// </summary>
+ /// <param name="x">The double value which is divided.</param>
+ /// <param name="y">The divisor.</param>
+ /// <returns>The remainder as double value.</returns>
+ public static double mod(double x, double y) {
+ return x - y * System.Math.Floor(x/y);
+ }
+
+ /// <summary>
+ /// The static method divides two integers.
+ /// </summary>
+ /// <param name="x">The integer x value.</param>
+ /// <param name="y">The integer y value.</param>
+ /// <returns>The qotient of x and y defined by floor(x/y).
+ /// </returns>
+ /// <remarks>
+ /// Please notify that the function is not compatible to the standard
+ /// integer divide operation /.
+ /// </remarks>
+ public static int div(int x, int y) {
+ return (int)System.Math.Floor((double)x/(double)y);
+ }
+
+ /// <summary>
+ /// The static method computes the remainder of two integers.
+ /// </summary>
+ /// <param name="x">The integer value which will be divided.</param>
+ /// <param name="y">The divisor integer value.</param>
+ /// <returns> The remainder as integer value.</returns>
+ /// <remarks>
+ /// Please notify that the method is not compatible to the C#
+ /// remainder operation %.
+ /// </remarks>
+ public static int mod(int x, int y) {
+ return x - y * div(x, y);
+ }
+
+ /// <summary>
+ /// A static method that combines integer division and remainder
+ /// computation.
+ /// </summary>
+ /// <param name="remainder">Remainder integer output value.
+ /// </param>
+ /// <param name="x">Integer to be divided.</param>
+ /// <param name="y">Divisor integer value.</param>
+ /// <returns>The quotient as integer.</returns>
+ /// <seealso cref="M:div"/>
+ /// <seealso cref="M:mod"/>
+ public static int div_mod(out int remainder, int x, int y) {
+ int d = div(x, y);
+ remainder = x - y * d;
+ return d;
+ }
+
+ /// <summary>
+ /// A static method returning the sign of the argument.
+ /// </summary>
+ /// <param name="x">The double argument.</param>
+ /// <returns>An integer value: -1 for a negative argument;
+ /// 0 for a zero argument, and 1 for a positive argument.
+ /// </returns>
+ public static int signum(double x) {
+ if (x < 0.0)
+ return -1;
+ if (x == 0.0)
+ return 0;
+ return 1;
+ }
+
+ /// <summary>
+ /// A static method returning the sign of the integer
+ /// argument.
+ /// </summary>
+ /// <param name="x">The integer argument.</param>
+ /// <returns>An integer value: -1 for a negative argument;
+ /// 0 for a zero argument, and 1 for a positive argument.
+ /// </returns>
+ public static int signum(int x) {
+ if (x < 0)
+ return -1;
+ if (x == 0)
+ return 0;
+ return 1;
+ }
+
+ /// <summary>
+ /// An adjusted remainder function as defined in "Calendrical
+ /// Calculations".
+ /// </summary>
+ /// <param name="x">The double x argument.</param>
+ /// <param name="y">The double y argument, the divisor.</param>
+ /// <returns>A double value representing remainder; but instead 0.0
+ /// the divisor y is returned.
+ /// </returns>
+ public static double amod(double x, double y) {
+ double d = mod(x, y);
+ return (d == 0.0) ? y : d;
+ }
+
+ /// <summary>
+ /// The adjusted remainder functions for integers as defined in
+ /// "Calendrical Calculations".
+ /// </summary>
+ /// <param name="x">The integer argument to be divided.</param>
+ /// <param name="y">The integer divisor argument.</param>
+ /// <returns>The remainder as an integer; however instead 0
+ /// is the divisor y returned.
+ /// </returns>
+ public static int amod(int x, int y) {
+ int i = mod(x, y);
+ return (i == 0) ? y : i;
+ }
+}
+
+/// <summary>The class implements methods to handle the fixed date value from
+/// the "Calendrical Calculations" books.
+/// </summary>
+/// <remarks>
+/// <para>
+/// For implementing the Calendar classes I used the algorithms from the
+/// book "Calendrical Calculations" by Nachum Dershowitz and Edward M.
+/// Rheingold, second reprint 1998. Trying to prevent the introduction of new
+/// bugs, I implemented their algorithms in the
+/// <see cref="N:CalendricalCalculations"/>
+/// namespace and wrapped it in the calendar classes.
+/// </para>
+/// <para>
+/// The fixed day number is also known as R.D. - rata die.
+/// Midnight at the onset of Monday,
+/// January 1, year 1 (Gregorian) is R.D. 1.
+/// </para>
+/// <para>Here are all my references:</para>
+/// <list type="table">
+/// <item><description>
+/// [1] Nachum Dershowitz and Edward M. Rheingold: "Calendrical Calculations";
+/// Cambridge University Press; second reprint 1998.
+/// </description></item>
+/// <item><description>
+/// [2] P. Kenneth Seidelmann (ed.): "Explanatory Supplement to the Astronomical
+/// Almanac"; University Science Books, Sausalito; 1992
+/// </description></item>
+/// <item><description>
+/// [3] F. Richard Stephenson: "Historical Eclipses and Earth Rotation";
+/// Cambridge University Press; 1997
+/// </description></item>
+/// </list>
+/// </remarks>
+internal class CCFixed {
+ /// <summary>The method computes the
+ /// <see cref="T:System.DateTime"/>
+ /// from a fixed day number.
+ /// </summary>
+ /// <param name="date">A integer representing the fixed day number.
+ /// </param>
+ /// <returns>The <see cref="T:System.DateTime"/> representing
+ /// the date.
+ /// </returns>
+ public static System.DateTime ToDateTime(int date) {
+ long ticks = (date - 1) * System.TimeSpan.TicksPerDay;
+ return new System.DateTime(ticks);
+ }
+
+ /// <summary>The method computes the
+ /// <see cref="T:System.DateTime"/>
+ /// from a fixed day number and time arguments.
+ /// </summary>
+ /// <param name="date">An integer representing the fixed day number.
+ /// </param>
+ /// <param name="hour">An integer argument specifying the hour.
+ /// </param>
+ /// <param name="minute">An integer argument specifying the minute.
+ /// </param>
+ /// <param name="second">An integer argument giving the second.
+ /// </param>
+ /// <param name="milliseconds">An double argument specifying
+ /// the milliseconds. Notice that
+ /// <see cref="T:System.DateTime"/> has 100 nanosecond resolution.
+ /// </param>
+ /// <returns>The <see cref="T:System.DateTime"/> representing
+ /// the date.
+ /// </returns>
+ public static System.DateTime ToDateTime(int date,
+ int hour, int minute, int second, double milliseconds)
+ {
+ System.DateTime time = ToDateTime(date);
+ time = time.AddHours(hour);
+ time = time.AddMinutes(minute);
+ time = time.AddSeconds(second);
+ return time.AddMilliseconds(milliseconds);
+ }
+
+ /// <summary>
+ /// A static method computing the fixed day number from a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="time">A
+ /// <see cref="T:System.DateTime"/> value representing the date.
+ /// </param>
+ /// <returns>The fixed day number as integer representing the date.
+ /// </returns>
+ public static int FromDateTime(System.DateTime time) {
+ return 1 + (int)(time.Ticks / System.TimeSpan.TicksPerDay);
+ }
+
+ /// <summary>
+ /// The static method computes the <see cref="T:DayOfWeek"/>.
+ /// </summary>
+ /// <param name="date">An integer representing the fixed day number.
+ /// </param>
+ /// <returns>The day of week.</returns>
+ public static DayOfWeek day_of_week(int date) {
+ return (DayOfWeek)CCMath.mod(date, 7);
+ }
+
+ /// <summary>
+ /// The static method computes the date of a day of week on or before
+ /// a particular date.
+ /// </summary>
+ /// <param name="date">An integer representing the date as
+ /// fixed day number.
+ /// </param>
+ /// <param name="k">An integer representing the day of the week,
+ /// starting with 0 for sunday.
+ /// </param>
+ /// <returns>The fixed day number of the day of week specified by k
+ /// on or before the given date.
+ /// </returns>
+ public static int kday_on_or_before(int date, int k) {
+ return date - (int)day_of_week(date-k);
+ }
+
+ /// <summary>
+ /// The static method computes the date of a day of week on or after
+ /// a particular date.
+ /// </summary>
+ /// <param name="date">An integer representing the date as
+ /// fixed day number.
+ /// </param>
+ /// <param name="k">An integer representing the day of the week,
+ /// starting with 0 for sunday.
+ /// </param>
+ /// <returns>The fixed day number of the day of week specified by k
+ /// on or after the given date.
+ /// </returns>
+ public static int kday_on_or_after(int date, int k) {
+ return kday_on_or_before(date+6, k);
+ }
+
+ /// <summary>
+ /// The static method computes the date of a day of week that is
+ /// nearest to a particular date.
+ /// </summary>
+ /// <param name="date">An integer representing the date as
+ /// fixed day number.
+ /// </param>
+ /// <param name="k">An integer representing the day of the week,
+ /// starting with 0 for sunday.
+ /// </param>
+ /// <returns>The fixed day number of the day of week neares to the
+ /// given date.
+ /// </returns>
+ public static int kd_nearest(int date, int k) {
+ return kday_on_or_before(date+3, k);
+ }
+
+ /// <summary>
+ /// The static method computes the date of a day of week after
+ /// a particular date.
+ /// </summary>
+ /// <param name="date">An integer representing the date as
+ /// fixed day number.
+ /// </param>
+ /// <param name="k">An integer representing the day of the week,
+ /// starting with 0 for sunday.
+ /// </param>
+ /// <returns>The fixed day number of the day of week specified by k
+ /// after the given date.
+ /// </returns>
+ public static int kday_after(int date, int k) {
+ return kday_on_or_before(date+7, k);
+ }
+
+ /// <summary>
+ /// The static method computes the date of a day of week before
+ /// a particular date.
+ /// </summary>
+ /// <param name="date">An integer representing the date as
+ /// fixed day number.
+ /// </param>
+ /// <param name="k">An integer representing the day of the week,
+ /// starting with 0 for sunday.
+ /// </param>
+ /// <returns>The fixed day number of the day of week specified by k
+ /// before the given date.
+ /// </returns>
+ public static int kday_before(int date, int k) {
+ return kday_on_or_before(date-1, k);
+ }
+} // class CCFixed
+
+/// <summary>
+/// A class encapsulating the functions of the Gregorian calendar as static
+/// methods.
+/// </summary>
+/// <remarks>
+/// <para>
+/// This class is not compatible to
+/// <see cref="T:System.Globalization.GregorianCalendar"/>.
+/// </para>
+/// <para>
+/// The fixed day number is also known as R.D. - rata die.
+/// Midnight at the onset of Monday,
+/// January 1, year 1 (Gregorian) is R.D. 1.
+/// </para>
+/// <seealso cref="T:CCFixed"/>
+/// </remarks>
+internal class CCGregorianCalendar {
+ /// <summary>An integer defining the epoch of the Gregorian calendar
+ /// as fixed day number.</summary>
+ /// <remarks>The epoch is January 3, 1 C.E. (Julian).</remarks>
+ const int epoch = 1;
+
+ /// <summary>The enumeration defines the months of the Gregorian
+ /// calendar.
+ /// </summary>
+ public enum Month {
+ /// <summary>
+ /// January.
+ /// </summary>
+ january = 1,
+ /// <summary>
+ /// February.
+ /// </summary>
+ february,
+ /// <summary>
+ /// March.
+ /// </summary>
+ march,
+ /// <summary>
+ /// April.
+ /// </summary>
+ april,
+ /// <summary>
+ /// May.
+ /// </summary>
+ may,
+ /// <summary>
+ /// June.
+ /// </summary>
+ june,
+ /// <summary>
+ /// July.
+ /// </summary>
+ july,
+ /// <summary>
+ /// August.
+ /// </summary>
+ august,
+ /// <summary>
+ /// September.
+ /// </summary>
+ september,
+ /// <summary>
+ /// October.
+ /// </summary>
+ october,
+ /// <summary>
+ /// November.
+ /// </summary>
+ november,
+ /// <summary>
+ /// December.
+ /// </summary>
+ december
+ };
+
+
+ /// <summary>
+ /// The method tells whether the year is a leap year.
+ /// </summary>
+ /// <param name="year">An integer representing the Gregorian year.
+ /// </param>
+ /// <returns>A boolean which is true if <paramref name="year"/> is
+ /// a leap year.
+ /// </returns>
+ public static bool is_leap_year(int year) {
+ if (CCMath.mod(year, 4) != 0)
+ return false;
+ switch (CCMath.mod(year, 400)) {
+ case 100:
+ return false;
+ case 200:
+ return false;
+ case 300:
+ return false;
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// The method returns the fixed day number of the given Gregorian
+ /// date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Gregorian year.
+ /// </param>
+ /// <param name="year">An integer representing the Gregorian year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value representing the fixed day number.
+ /// </returns>
+ public static int fixed_from_dmy(int day, int month, int year) {
+ int k = epoch - 1;
+ k += 365 * (year-1);
+ k += CCMath.div(year-1, 4);
+ k -= CCMath.div(year-1, 100);
+ k += CCMath.div(year-1, 400);
+ k += CCMath.div(367*month-362, 12);
+ if (month > 2) {
+ k += is_leap_year(year) ? -1 : -2;
+ }
+
+ k += day;
+
+ return k;
+ }
+
+ /// <summary>
+ /// The method computes the Gregorian year from a fixed day number.
+ /// </summary>
+ /// <param name="date">The fixed day number.
+ /// </param>
+ /// <returns>An integer value giving the Gregorian year of the date.
+ /// </returns>
+ public static int year_from_fixed(int date) {
+ int d = date - epoch;
+ int n_400 = CCMath.div_mod(out d, d, 146097);
+ int n_100 = CCMath.div_mod(out d, d, 36524);
+ int n_4 = CCMath.div_mod(out d, d, 1461);
+ int n_1 = CCMath.div(d, 365);
+
+ int year = 400*n_400 + 100*n_100 + 4*n_4 + n_1;
+ return (n_100 == 4 || n_1 == 4) ? year : year + 1;
+ }
+
+ /// <summary>
+ /// The method computes the Gregorian year and month from a fixed day
+ /// number.
+ /// </summary>
+ /// <param name="month">The output value giving the Gregorian month.
+ /// </param>
+ /// <param name="year">The output value giving the Gregorian year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void my_from_fixed(out int month, out int year,
+ int date)
+ {
+ year = year_from_fixed(date);
+
+ int prior_days = date - fixed_from_dmy(1, (int)Month.january,
+ year);
+
+ int correction;
+ if (date < fixed_from_dmy(1, (int)Month.march, year)) {
+ correction = 0;
+ } else if (is_leap_year(year)) {
+ correction = 1;
+ } else {
+ correction = 2;
+ }
+
+ month = CCMath.div(12 * (prior_days + correction) + 373, 367);
+
+ }
+
+ /// <summary>
+ /// The method computes the Gregorian year, month, and day from a
+ /// fixed day number.
+ /// </summary>
+ /// <param name="day">The output value returning the day of the
+ /// month.
+ /// </param>
+ /// <param name="month">The output value giving the Gregorian month.
+ /// </param>
+ /// <param name="year">The output value giving the Gregorian year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void dmy_from_fixed(out int day, out int month,
+ out int year,
+ int date)
+ {
+ my_from_fixed(out month, out year, date);
+ day = date - fixed_from_dmy(1, month, year) + 1;
+ }
+
+ /// <summary>A method computing the Gregorian month from a fixed
+ /// day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the Gregorian month.
+ /// </returns>
+ public static int month_from_fixed(int date) {
+ int month, year;
+
+ my_from_fixed(out month, out year, date);
+ return month;
+ }
+
+ /// <summary>
+ /// A method computing the day of the month from a fixed day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the day of the month.
+ /// </returns>
+ public static int day_from_fixed(int date) {
+ int day, month, year;
+
+ dmy_from_fixed(out day, out month, out year, date);
+ return day;
+ }
+
+ /// <summary>
+ /// The method computes the difference between two Gregorian dates.
+ /// </summary>
+ /// <param name="dayA">The integer parameter gives the day of month
+ /// of the first date.
+ /// </param>
+ /// <param name="monthA">The integer parameter gives the Gregorian
+ /// month of the first date.
+ /// </param>
+ /// <param name="yearA">The integer parameter gives the Gregorian
+ /// year of the first date.
+ /// </param>
+ /// <param name="dayB">The integer parameter gives the day of month
+ /// of the second date.
+ /// </param>
+ /// <param name="monthB">The integer parameter gives the Gregorian
+ /// month of the second date.
+ /// </param>
+ /// <param name="yearB">The integer parameter gives the Gregorian
+ /// year of the second date.
+ /// </param>
+ /// <returns>An integer giving the difference of days from the first
+ /// the second date.
+ /// </returns>
+ public static int date_difference(int dayA, int monthA, int yearA,
+ int dayB, int monthB, int yearB)
+ {
+ return fixed_from_dmy(dayB, monthB, yearB) -
+ fixed_from_dmy(dayA, monthA, yearA);
+ }
+
+ /// <summary>
+ /// The method computes the number of the day in the year from
+ /// a Gregorian date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Gregorian year.
+ /// </param>
+ /// <param name="year">An integer representing the Gregorian year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value giving the number of the day in the
+ /// Gregorian year, counting from 1.
+ /// </returns>
+ public static int day_number(int day, int month, int year) {
+ return date_difference(31, (int)Month.december, year-1,
+ day, month, year);
+ }
+
+ /// <summary>
+ /// The method computes the days remaining in the given Gregorian
+ /// year from a Gregorian date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Gregorian year.
+ /// </param>
+ /// <param name="year">An integer representing the Gregorian year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value giving the number of days remaining in
+ /// the Gregorian year.
+ /// </returns>
+ public static int days_remaining(int day, int month, int year) {
+ return date_difference(day, month, year,
+ 31, (int)Month.december, year);
+ }
+
+ // Helper functions for the Gregorian calendars.
+
+ /// <summary>
+ /// Adds months to the given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public static System.DateTime AddMonths(System.DateTime time,
+ int months)
+ {
+ int rd = CCFixed.FromDateTime(time);
+ int day, month, year;
+ dmy_from_fixed(out day, out month, out year, rd);
+ month += months;
+ rd = fixed_from_dmy(day, month, year);
+ System.DateTime t = CCFixed.ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Adds years to the given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public static System.DateTime AddYears(System.DateTime time,
+ int years)
+ {
+ int rd = CCFixed.FromDateTime(time);
+ int day, month, year;
+ dmy_from_fixed(out day, out month, out year, rd);
+ year += years;
+ rd = fixed_from_dmy(day, month, year);
+ System.DateTime t = CCFixed.ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Gets the of the month from <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public static int GetDayOfMonth(System.DateTime time) {
+ return day_from_fixed(CCFixed.FromDateTime(time));
+ }
+
+ /// <summary>
+ /// The method gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public static int GetDayOfYear(System.DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int year = year_from_fixed(rd);
+ int rd1_1 = fixed_from_dmy(1, 1, year);
+ return rd - rd1_1 + 1;
+ }
+
+ /// <summary>
+ /// A method that gives the number of days of the specified
+ /// month of the <paramref name="year"/>.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the current
+ /// era.</param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ public static int GetDaysInMonth(int year, int month) {
+ int rd1 = fixed_from_dmy(1, month, year);
+ int rd2 = fixed_from_dmy(1, month+1, year);
+ return rd2 - rd1;
+ }
+
+ /// <summary>
+ /// The method gives the number of days in the specified year.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ public static int GetDaysInYear(int year) {
+ int rd1 = fixed_from_dmy(1, 1, year);
+ int rd2 = fixed_from_dmy(1, 1, year+1);
+ return rd2 - rd1;
+ }
+
+ /// <summary>
+ /// The method gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public static int GetMonth(System.DateTime time) {
+ return month_from_fixed(CCFixed.FromDateTime(time));
+ }
+
+ /// <summary>
+ /// The method gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year.
+ /// </returns>
+ public static int GetYear(System.DateTime time) {
+ return year_from_fixed(CCFixed.FromDateTime(time));
+ }
+
+ /// <summary>
+ /// A virtual method that tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ public static bool IsLeapDay(int year, int month, int day) {
+ return is_leap_year(year) && month == 2 && day == 29;
+ }
+
+ /// <summary>
+ /// A method that creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ public static System.DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds)
+ {
+ return CCFixed.ToDateTime(fixed_from_dmy(day, month, year),
+ hour, minute, second, milliseconds);
+ }
+} // class CCGregorianCalendar
+
+/// <summary>
+/// A class encapsulating the functions of the Julian calendar as static
+/// methods.
+/// </summary>
+/// <remarks>
+/// <para>The algorithms don't support a year 0. Years before Common Era
+/// (B.C.E. or B.C.) are negative and years of Common Era (C.E. or A.D.)
+/// are positive.
+/// </para>
+/// <para>
+/// This class is not compatible to
+/// <see cref="T:System.Globalization.JulianCalendar"/>.
+/// </para>
+/// <seealso cref="T:CCFixed"/>
+/// </remarks>
+internal class CCJulianCalendar {
+ /// <summary>An integer defining the epoch of the Julian calendar
+ /// as fixed day number.</summary>
+ /// <remarks>The epoch is December 30, 0 (Gregorian).</remarks>
+ const int epoch = -1; // 30. 12. 0 Gregorian
+
+ /// <summary>The enumeration defines the months of the Julian
+ /// calendar.
+ /// </summary>
+ public enum Month {
+ /// <summary>
+ /// January.
+ /// </summary>
+ january = 1,
+ /// <summary>
+ /// February.
+ /// </summary>
+ february,
+ /// <summary>
+ /// March.
+ /// </summary>
+ march,
+ /// <summary>
+ /// April.
+ /// </summary>
+ april,
+ /// <summary>
+ /// May.
+ /// </summary>
+ may,
+ /// <summary>
+ /// June.
+ /// </summary>
+ june,
+ /// <summary>
+ /// July.
+ /// </summary>
+ july,
+ /// <summary>
+ /// August.
+ /// </summary>
+ august,
+ /// <summary>
+ /// September.
+ /// </summary>
+ september,
+ /// <summary>
+ /// October.
+ /// </summary>
+ october,
+ /// <summary>
+ /// November.
+ /// </summary>
+ november,
+ /// <summary>
+ /// December.
+ /// </summary>
+ december
+ };
+
+ /// <summary>
+ /// The method tells whether the year is a leap year.
+ /// </summary>
+ /// <param name="year">An integer representing the Julian year.
+ /// </param>
+ /// <returns>A boolean which is true if <paramref name="year"/> is
+ /// a leap year.
+ /// </returns>
+ public static bool is_leap_year(int year) {
+ return CCMath.mod(year, 4) == (year > 0 ? 0 : 3);
+ }
+
+ /// <summary>
+ /// The method returns the fixed day number of the given Julian
+ /// date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Julian year.
+ /// </param>
+ /// <param name="year">An integer representing the Julian year.
+ /// Positive and Negative values are allowed.
+ /// </param>
+ /// <returns>An integer value representing the fixed day number.
+ /// </returns>
+ public static int fixed_from_dmy(int day, int month, int year) {
+ int y = year < 0 ? year+1 : year;
+ int k = epoch - 1;
+ k += 365 * (y-1);
+ k += CCMath.div(y-1, 4);
+ k += CCMath.div(367*month-362, 12);
+ if (month > 2) {
+ k += is_leap_year(year) ? -1 : -2;
+ }
+ k += day;
+
+ return k;
+ }
+
+ /// <summary>
+ /// The method computes the Julian year from a fixed day number.
+ /// </summary>
+ /// <param name="date">The fixed day number.
+ /// </param>
+ /// <returns>An integer value giving the Julian year of the date.
+ /// </returns>
+ public static int year_from_fixed(int date) {
+ int approx = CCMath.div(4*(date-epoch)+1464, 1461);
+ return approx <= 0 ? approx - 1 : approx;
+ }
+
+ /// <summary>
+ /// The method computes the Julian year and month from a fixed day
+ /// number.
+ /// </summary>
+ /// <param name="month">The output value giving the Julian month.
+ /// </param>
+ /// <param name="year">The output value giving the Julian year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void my_from_fixed(out int month, out int year, int date)
+ {
+ year = year_from_fixed(date);
+
+ int prior_days = date - fixed_from_dmy(1, (int)Month.january,
+ year);
+
+ int correction;
+ if (date < fixed_from_dmy(1, (int)Month.march, year)) {
+ correction = 0;
+ } else if (is_leap_year(year)) {
+ correction = 1;
+ } else {
+ correction = 2;
+ }
+
+ month = CCMath.div(12 * (prior_days + correction) + 373, 367);
+ }
+
+
+ /// <summary>
+ /// The method computes the Julian year, month, and day from a
+ /// fixed day number.
+ /// </summary>
+ /// <param name="day">The output value returning the day of the
+ /// month.
+ /// </param>
+ /// <param name="month">The output value giving the Julian month.
+ /// </param>
+ /// <param name="year">The output value giving the Julian year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void dmy_from_fixed(out int day, out int month,
+ out int year, int date)
+ {
+ my_from_fixed(out month, out year, date);
+ day = date - fixed_from_dmy(1, month, year) + 1;
+ }
+
+ /// <summary>A method computing the Julian month from a fixed
+ /// day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the Julian month.
+ /// </returns>
+ public static int month_from_fixed(int date) {
+ int month, year;
+
+ my_from_fixed(out month, out year, date);
+ return month;
+ }
+
+ /// <summary>
+ /// A method computing the day of the month from a fixed day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the day of the month.
+ /// </returns>
+ public static int day_from_fixed(int date) {
+ int day;
+ int month;
+ int year;
+
+ dmy_from_fixed(out day, out month, out year, date);
+ return day;
+ }
+
+ /// <summary>
+ /// The method computes the difference between two Julian dates.
+ /// </summary>
+ /// <param name="dayA">The integer parameter gives the day of month
+ /// of the first date.
+ /// </param>
+ /// <param name="monthA">The integer parameter gives the Julian
+ /// month of the first date.
+ /// </param>
+ /// <param name="yearA">The integer parameter gives the Julian
+ /// year of the first date.
+ /// </param>
+ /// <param name="dayB">The integer parameter gives the day of month
+ /// of the second date.
+ /// </param>
+ /// <param name="monthB">The integer parameter gives the Julian
+ /// month of the second date.
+ /// </param>
+ /// <param name="yearB">The integer parameter gives the Julian
+ /// year of the second date.
+ /// </param>
+ /// <returns>An integer giving the difference of days from the first
+ /// the second date.
+ /// </returns>
+ public static int date_difference(int dayA, int monthA, int yearA,
+ int dayB, int monthB, int yearB)
+ {
+ return fixed_from_dmy(dayB, monthB, yearB) -
+ fixed_from_dmy(dayA, monthA, yearA);
+ }
+
+ /// <summary>
+ /// The method computes the number of the day in the year from
+ /// a Julian date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Julian year.
+ /// </param>
+ /// <param name="year">An integer representing the Julian year.
+ /// Negative values are allowed also.
+ /// </param>
+ /// <returns>An integer value giving the number of the day in the
+ /// Julian year, counting from 1.
+ /// </returns>
+ public static int day_number(int day, int month, int year) {
+ return date_difference(31, (int)Month.december, year-1,
+ day, month, year);
+ }
+
+ /// <summary>
+ /// The method computes the days remaining in the given Julian
+ /// year from a Julian date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Julian year.
+ /// </param>
+ /// <param name="year">An integer representing the Julian year.
+ /// Negative values are allowed also.
+ /// </param>
+ /// <returns>An integer value giving the number of days remaining in
+ /// the Julian year.
+ /// </returns>
+ public static int days_remaining(int day, int month, int year) {
+ return date_difference(day, month, year,
+ 31, (int)Month.december, year);
+ }
+} // class CCJulianCalendar
+
+/// <summary>
+/// A class encapsulating the functions of the Hebrew calendar as static
+/// methods.
+/// </summary>
+/// <remarks>
+/// <para>
+/// This class is not compatible to
+/// <see cref="T:System.Globalization.HebrewCalendar"/>.
+/// </para>
+/// <seealso cref="T:CCFixed"/>
+/// </remarks>
+internal class CCHebrewCalendar {
+ /// <summary>An integer defining the epoch of the Hebrew calendar
+ /// as fixed day number.</summary>
+ /// <remarks>The epoch is October 10, 3761 B.C.E. (Julian).</remarks>
+ const int epoch = -1373427;
+
+ /// <summary>The enumeration defines the months of the Gregorian
+ /// calendar.
+ /// </summary>
+ /// <remarks>
+ /// The enumaration differs from .NET which defines Tishri as month 1.
+ /// </remarks>
+ public enum Month {
+ /// <summary>
+ /// Nisan.
+ /// </summary>
+ nisan = 1,
+ /// <summary>
+ /// Iyyar.
+ /// </summary>
+ iyyar,
+ /// <summary>
+ /// Sivan.
+ /// </summary>
+ sivan,
+ /// <summary>
+ /// Tammuz.
+ /// </summary>
+ tammuz,
+ /// <summary>
+ /// Av.
+ /// </summary>
+ av,
+ /// <summary>
+ /// Elul.
+ /// </summary>
+ elul,
+ /// <summary>
+ /// Tishri.
+ /// </summary>
+ tishri,
+ /// <summary>
+ /// Heshvan.
+ /// </summary>
+ heshvan,
+ /// <summary>
+ /// Kislev.
+ /// </summary>
+ kislev,
+ /// <summary>
+ /// Teveth.
+ /// </summary>
+ teveth,
+ /// <summary>
+ /// Shevat.
+ /// </summary>
+ shevat,
+ /// <summary>
+ /// Adar.
+ /// </summary>
+ adar,
+ /// <summary>
+ /// Adar I. Only in years with Adar II.
+ /// </summary>
+ adar_I = 12,
+ /// <summary>
+ /// Adar II. Only in years wirh Adar I.
+ /// </summary>
+ adar_II = 13,
+ };
+
+ /// <summary>
+ /// The method tells whether the year is a leap year.
+ /// </summary>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>A boolean which is true if <paramref name="year"/> is
+ /// a leap year.
+ /// </returns>
+ public static bool is_leap_year(int year) {
+ return CCMath.mod(7*year+1, 19) < 7;
+ }
+
+ /// <summary>
+ /// The Method gives the number of the last month in a year, which
+ /// is equal with the number of month in a Hebrew year.
+ /// </summary>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>An integer giving the number of the last month of the
+ /// Hebrew year, which is the same as the numbers of month in the
+ /// year.
+ /// </returns>
+ public static int last_month_of_year(int year) {
+ return is_leap_year(year) ? 13 : 12;
+ }
+
+
+ /// <summary>The method is a helper function.</summary>
+ /// <param name="year">An integer specifying the Hebrew year.
+ /// </param>
+ /// <returns>An integer representing the number of elapsed days
+ /// until the Hebrew year.</returns>
+ public static int elapsed_days(int year) {
+ int months_elapsed = CCMath.div(235*year-234, 19);
+ int r;
+ int d = CCMath.div_mod(out r, months_elapsed, 1080);
+ int parts_elapsed = 204 + 793 * r;
+ int hours_elapsed = 11 + 12 * months_elapsed +
+ 793 * d + CCMath.div(parts_elapsed, 1080);
+
+ int day = 29*months_elapsed + CCMath.div(hours_elapsed, 24);
+
+ if (CCMath.mod(3*(day+1), 7) < 3) {
+ day += 1;
+ }
+
+ return day;
+ }
+
+ /// <summary>A method computing the delay of new year for the given
+ /// Hebrew year.
+ /// </summary>
+ /// <param name="year">An integer that gives the Hebrew year.
+ /// </param>
+ /// <returns>The new year delay in days of the given Hebrew year.
+ /// </returns>
+ public static int new_year_delay(int year) {
+ int ny1 = elapsed_days(year);
+ int ny2 = elapsed_days(year+1);
+
+ if (ny2 - ny1 == 356) {
+ return 2;
+ }
+ int ny0 = elapsed_days(year-1);
+ if (ny1 - ny0 == 382) {
+ return 1;
+ }
+ return 0;
+ }
+
+ /// <summary>
+ /// The method computes the last day of month (nummer of days in a
+ /// month) of the given Hebrew year.
+ /// </summary>
+ /// <param name="month">The Hebrew month, allowed value between
+ /// One and Thirteen.
+ /// </param>
+ /// <param name="year">An integer that gives the Hebrew year.
+ /// </param>
+ /// <returns>The number of the last day of the month of the given
+ /// Hebrew year, which gives automatically the number of days in the
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRange.Exception">
+ /// The exception is thrown if month not between One and Thirteen.
+ /// </exception>
+ public static int last_day_of_month(int month, int year) {
+ if (month < 1 || month > 13)
+ throw new System.ArgumentOutOfRangeException("month",
+ "Month should be between One and Thirteen.");
+ switch (month) {
+ case 2: return 29;
+ case 4: return 29;
+ case 6: return 29;
+ case 8:
+ if (!long_heshvan(year))
+ return 29;
+ break;
+ case 9:
+ if (short_kislev(year))
+ return 29;
+ break;
+ case 10: return 29;
+ case 12:
+ if (!is_leap_year(year))
+ return 29;
+ break;
+ case 13: return 29;
+ }
+ return 30;
+ }
+
+ /// <summary>
+ /// The functions checks whether the month Heshvan is a long one
+ /// in the given Hebrew year.
+ /// </summary>
+ /// <param name="year">An integer that gives the Hebrew year.
+ /// </param>
+ /// <returns>A boolean value: true if there is a long Heshvan
+ /// in the given Hebrew year; false otherwise.
+ /// </returns>
+ public static bool long_heshvan(int year) {
+ return CCMath.mod(days_in_year(year), 10) == 5;
+ }
+
+ /// <summary>
+ /// The functions checks whether the month Kislev is a short one
+ /// in the given Hebrew year.
+ /// </summary>
+ /// <param name="year">An integer that gives the Hebrew year.
+ /// </param>
+ /// <returns>A boolean value: true if there is a short Kislev
+ /// in the given Hebrew year; false otherwise.
+ /// </returns>
+ public static bool short_kislev(int year) {
+ return CCMath.mod(days_in_year(year), 10) == 3;
+ }
+
+ /// <summary>
+ /// The functions gives the number of days in the specified Hebrew
+ /// year.
+ /// </summary>
+ /// <param name="year">An integer that gives the Hebrew year.
+ /// </param>
+ /// <returns>The days of the Hebrew year as integer.
+ /// </returns>
+ public static int days_in_year(int year) {
+ return fixed_from_dmy(1, 7, year+1) -
+ fixed_from_dmy(1, 7, year);
+ }
+
+ /// <summary>
+ /// The method returns the fixed day number of the given Hebrew
+ /// date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Hebrew year.
+ /// </param>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value representing the fixed day number.
+ /// </returns>
+ public static int fixed_from_dmy(int day, int month, int year) {
+ int m;
+ int k = epoch-1;
+ k += elapsed_days(year);
+ k += new_year_delay(year);
+
+ if (month < 7) {
+ int l = last_month_of_year(year);
+ for (m = 7; m <= l; m++) {
+ k += last_day_of_month(m, year);
+ }
+ for (m = 1; m < month; m++) {
+ k += last_day_of_month(m, year);
+ }
+ }
+ else {
+ for (m = 7; m < month; m++) {
+ k += last_day_of_month(m, year);
+ }
+ }
+
+ k += day;
+
+ return k;
+ }
+
+ /// <summary>
+ /// The method computes the Hebrew year from a fixed day number.
+ /// </summary>
+ /// <param name="date">The fixed day number.
+ /// </param>
+ /// <returns>An integer value giving the Hebrew year of the date.
+ /// </returns>
+ public static int year_from_fixed(int date) {
+ int approx = (int)System.Math.Floor(
+ ((double)(date - epoch))/(35975351.0/98496.0));
+ int y;
+ for (y = approx; date >= fixed_from_dmy(1, 7, y); y++) {}
+ return y-1;
+ }
+
+ /// <summary>
+ /// The method computes the Hebrew year and month from a fixed day
+ /// number.
+ /// </summary>
+ /// <param name="month">The output value giving the Hebrew month.
+ /// </param>
+ /// <param name="year">The output value giving the Hebrew year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void my_from_fixed(out int month, out int year,
+ int date)
+ {
+ year = year_from_fixed(date);
+
+ int start = date < fixed_from_dmy(1, 1, year) ? 7 : 1;
+
+ for (month = start;
+ date > fixed_from_dmy(last_day_of_month(month, year),
+ month, year);
+ month++)
+ {}
+ }
+
+ /// <summary>
+ /// The method computes the Hebrew year, month, and day from a
+ /// fixed day number.
+ /// </summary>
+ /// <param name="day">The output value returning the day of the
+ /// month.
+ /// </param>
+ /// <param name="month">The output value giving the Hebrew month.
+ /// </param>
+ /// <param name="year">The output value giving the Hebrew year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void dmy_from_fixed(out int day, out int month,
+ out int year, int date)
+ {
+ my_from_fixed(out month, out year, date);
+ day = date - fixed_from_dmy(1, month, year) + 1;
+ }
+
+ /// <summary>A method computing the Hebrew month from a fixed
+ /// day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the Hebrew month.
+ /// </returns>
+ public static int month_from_fixed(int date) {
+ int month, year;
+
+ my_from_fixed(out month, out year, date);
+ return month;
+ }
+
+ /// <summary>
+ /// A method computing the day of the month from a fixed day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the day of the month.
+ /// </returns>
+ public static int day_from_fixed(int date) {
+ int day, month, year;
+
+ dmy_from_fixed(out day, out month, out year, date);
+ return day;
+ }
+
+ /// <summary>
+ /// The method computes the difference between two Hebrew dates.
+ /// </summary>
+ /// <param name="dayA">The integer parameter gives the day of month
+ /// of the first date.
+ /// </param>
+ /// <param name="monthA">The integer parameter gives the Hebrew
+ /// month of the first date.
+ /// </param>
+ /// <param name="yearA">The integer parameter gives the Hebrew
+ /// year of the first date.
+ /// </param>
+ /// <param name="dayB">The integer parameter gives the day of month
+ /// of the second date.
+ /// </param>
+ /// <param name="monthB">The integer parameter gives the Hebrew
+ /// month of the second date.
+ /// </param>
+ /// <param name="yearB">The integer parameter gives the Hebrew
+ /// year of the second date.
+ /// </param>
+ /// <returns>An integer giving the difference of days from the first
+ /// the second date.
+ /// </returns>
+ public static int date_difference(int dayA, int monthA, int yearA,
+ int dayB, int monthB, int yearB)
+ {
+ return fixed_from_dmy(dayB, monthB, yearB) -
+ fixed_from_dmy(dayA, monthA, yearA);
+ }
+
+ /// <summary>
+ /// The method computes the number of the day in the year from
+ /// a Hebrew date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Hebrew year.
+ /// </param>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>An integer value giving the number of the day in the
+ /// Hebrew year, counting from 1.
+ /// </returns>
+ public static int day_number(int day, int month, int year) {
+ return date_difference(1, 7, year,
+ day, month, year) + 1;
+ }
+
+ /// <summary>
+ /// The method computes the days remaining in the given Hebrew
+ /// year from a Hebrew date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Hebrew year.
+ /// </param>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>An integer value giving the number of days remaining in
+ /// the Hebrew year.
+ /// </returns>
+ public static int days_remaining(int day, int month, int year) {
+ return date_difference(day, month, year,
+ 1, 7, year+1)-1;
+ }
+} // class HebrewCalendar
+
+
+/// <summary>
+/// A class encapsulating the functions of the Islamic calendar as static
+/// methods.
+/// </summary>
+/// <remarks>
+/// <para>There is no difference here in using Hijri or Islamic calendar.
+/// </para>
+/// <para>The epoch of the Islamic calendar isn't fixed, because we cannot
+/// surely say today, when the crescent of the new moon has been observed
+/// around the July 16, 622 C.E. Julian. Even today the start and end of
+/// the month Ramadan is defined by religous authorities. So the calendar
+/// can be offset by two days.
+/// </para>
+/// <para>
+/// We don't support the offset here, however we changed the epoch from
+/// "Calendrical Calculations" to value, that .Net seems to be using.
+/// </para>
+/// <para>
+/// This class is not compatible to
+/// <see cref="T:System.Globalization.HijriCalendar"/>.
+/// </para>
+/// <seealso cref="T:CCFixed"/>
+/// </remarks>
+public class CCHijriCalendar {
+ /// <summary>An integer defining the epoch of the Gregorian calendar
+ /// as fixed day number.</summary>
+ /// <remarks>
+ /// <para>
+ /// The epoch is given as 16 July 622 C.E. Julian (R.D. 227015)
+ /// in Calendrical Calculations, the approximate date of
+ /// the emigration of
+ /// Muhammed to Medina. However there is no way to determine today
+ /// the observation of the crescent of the new moon in July 622 C.E.
+ /// (Julian). So there is some variability in the epoch.
+ /// Religous authorities determine the epoch by observing the
+ /// crescent of the new moon for the month Ramadan, so there might
+ /// be an offsets by two days of the epoch.
+ /// </para>
+ /// <para>Windows
+ /// supports an AddHijriDate parameter in the registry to adapt
+ /// for it. It seems that the .NET implementation of
+ /// HijriCalendar uses an epoch of 227014, so we use it here. The
+ /// ArgumentOutOfRangeException gives July, 18 622 as epoch,
+ /// which is 227014 supporting our theory.
+ /// </para>
+ /// </remarks>
+ const int epoch = 227014;
+
+ /// <summary>The enumeration defines the months of the Islamic
+ /// calendar.
+ /// </summary>
+ public enum Month {
+ /// <summary>
+ /// Muharram.
+ /// </summary>
+ muharram = 1,
+ /// <summary>
+ /// Safar.
+ /// </summary>
+ safar,
+ /// <summary>
+ /// Rabi I.
+ /// </summary>
+ rabi_I,
+ /// <summary>
+ /// Rabi II.
+ /// </summary>
+ rabi_II,
+ /// <summary>
+ /// Jumada I.
+ /// </summary>
+ jumada_I,
+ /// <summary>
+ /// Jumada II.
+ /// </summary>
+ jumada_II,
+ /// <summary>
+ /// Rajab.
+ /// </summary>
+ rajab,
+ /// <summary>
+ /// Shaban.
+ /// </summary>
+ shaban,
+ /// <summary>
+ /// Ramadan.
+ /// </summary>
+ ramadan,
+ /// <summary>
+ /// Shawwal.
+ /// </summary>
+ shawwal,
+ /// <summary>
+ /// Dhu Al-Quada.
+ /// </summary>
+ dhu_al_quada,
+ /// <summary>
+ /// Dhu Al-Hijja.
+ /// </summary>
+ dhu_al_hijja,
+ };
+
+ /// <summary>
+ /// The method tells whether the year is a leap year.
+ /// </summary>
+ /// <param name="year">An integer representing the Islamic year.
+ /// </param>
+ /// <returns>A boolean which is true if <paramref name="year"/> is
+ /// a leap year.
+ /// </returns>
+ public static bool is_leap_year(int year) {
+ return CCMath.mod(14+11*year, 30) < 11;
+ }
+
+ /// <summary>
+ /// The method returns the fixed day number of the given Islamic
+ /// date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Islamic year.
+ /// </param>
+ /// <param name="year">An integer representing the Islamic year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value representing the fixed day number.
+ /// </returns>
+ public static int fixed_from_dmy(int day, int month, int year) {
+ int k = epoch - 1;
+ k += 354 * (year-1);
+ k += CCMath.div(3+11*year, 30);
+ k += (int)System.Math.Ceiling(29.5 * (double)(month-1));
+ k += day;
+
+ return k;
+ }
+
+ /// <summary>
+ /// The method computes the Islamic year from a fixed day number.
+ /// </summary>
+ /// <param name="date">The fixed day number.
+ /// </param>
+ /// <returns>An integer value giving the Islamic year of the date.
+ /// </returns>
+ public static int year_from_fixed(int date) {
+ return CCMath.div(30*(date-epoch)+10646, 10631);
+ }
+
+ /// <summary>
+ /// The method computes the Islamic year and month from a fixed day
+ /// number.
+ /// </summary>
+ /// <param name="month">The output value giving the Islamic month.
+ /// </param>
+ /// <param name="year">The output value giving the Islamic year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void my_from_fixed(out int month, out int year, int date)
+ {
+ year = year_from_fixed(date);
+
+ int m = 1+(int)System.Math.Ceiling(
+ ((double)(date-29-fixed_from_dmy(1,1,year)))/29.5);
+
+ month = m < 12 ? m : 12;
+ }
+
+ /// <summary>
+ /// The method computes the Islamic year, month, and day from a
+ /// fixed day number.
+ /// </summary>
+ /// <param name="day">The output value returning the day of the
+ /// month.
+ /// </param>
+ /// <param name="month">The output value giving the Islamic month.
+ /// </param>
+ /// <param name="year">The output value giving the Islamic year.
+ /// </param>
+ /// <param name="date">An integer value specifying the fixed day
+ /// number.</param>
+ public static void dmy_from_fixed(out int day, out int month,
+ out int year, int date)
+ {
+ my_from_fixed(out month, out year, date);
+ day = date - fixed_from_dmy(1, month, year) + 1;
+ }
+
+ /// <summary>A method computing the Islamic month from a fixed
+ /// day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the Islamic month.
+ /// </returns>
+ public static int month_from_fixed(int date) {
+ int month, year;
+
+ my_from_fixed(out month, out year, date);
+ return month;
+ }
+
+ /// <summary>
+ /// A method computing the day of the month from a fixed day number.
+ /// </summary>
+ /// <param name="date">An integer specifying the fixed day number.
+ /// </param>
+ /// <returns>An integer value representing the day of the month.
+ /// </returns>
+ public static int day_from_fixed(int date) {
+ int day;
+ int month;
+ int year;
+
+ dmy_from_fixed(out day, out month, out year, date);
+ return day;
+ }
+
+ /// <summary>
+ /// The method computes the difference between two Islamic dates.
+ /// </summary>
+ /// <param name="dayA">The integer parameter gives the day of month
+ /// of the first date.
+ /// </param>
+ /// <param name="monthA">The integer parameter gives the Islamic
+ /// month of the first date.
+ /// </param>
+ /// <param name="yearA">The integer parameter gives the Islamic
+ /// year of the first date.
+ /// </param>
+ /// <param name="dayB">The integer parameter gives the day of month
+ /// of the second date.
+ /// </param>
+ /// <param name="monthB">The integer parameter gives the Islamic
+ /// month of the second date.
+ /// </param>
+ /// <param name="yearB">The integer parameter gives the Islamic
+ /// year of the second date.
+ /// </param>
+ /// <returns>An integer giving the difference of days from the first
+ /// the second date.
+ /// </returns>
+ public static int date_difference(int dayA, int monthA, int yearA,
+ int dayB, int monthB, int yearB)
+ {
+ return fixed_from_dmy(dayB, monthB, yearB) -
+ fixed_from_dmy(dayA, monthA, yearA);
+ }
+
+ /// <summary>
+ /// The method computes the number of the day in the year from
+ /// a Islamic date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Islamic year.
+ /// </param>
+ /// <param name="year">An integer representing the Islamic year.
+ /// </param>
+ /// <returns>An integer value giving the number of the day in the
+ /// Islamic year, counting from 1.
+ /// </returns>
+ public static int day_number(int day, int month, int year) {
+ return date_difference(31, 12, year-1, day, month, year);
+ }
+
+ /// <summary>
+ /// The method computes the days remaining in the given Islamic
+ /// year from a Islamic date.
+ /// </summary>
+ /// <param name="day">An integer representing the day of the month,
+ /// counting from 1.
+ /// </param>
+ /// <param name="month">An integer representing the month in the
+ /// Islamic year.
+ /// </param>
+ /// <param name="year">An integer representing the Islamic year.
+ /// Non-positive values are allowed also.
+ /// </param>
+ /// <returns>An integer value giving the number of days remaining in
+ /// the Islamic year.
+ /// </returns>
+ public static int days_remaining(int day, int month, int year) {
+ return date_difference(day, month, year,31, 12, year);
+ }
+} // class CCHijriCalendar
+
+/// <summary>
+/// A class that supports the Gregorian based calendars with other eras
+/// (e.g. <see cref="T:System.Gloablization.JapaneseCalendar"/>).
+/// </summary>
+[System.Serializable]
+public class CCGregorianEraHandler {
+ /// <summary>
+ /// A struct that represents a single era.
+ /// </summary>
+ [System.Serializable]
+ struct Era {
+ /// <summary>
+ /// The integer number identifying the era.
+ /// </summary>
+ private int _nr;
+
+ /// <value>
+ /// A get-only property that gives the era integer number.
+ /// </value>
+ public int Nr { get { return _nr; } }
+
+ /// <summary>This integer gives the first day of the era as
+ /// fixed day number.
+ /// </summary>
+ private int _start; // inclusive
+ /// <summary>
+ /// This integer gives the gregorian year of the
+ /// <see cref="M:_start"/> value.
+ /// </summary>
+ private int _gregorianYearStart;
+ /// <summary>
+ /// This integer gives the last day of the era as fixed day
+ /// number.
+ /// </summary>
+ private int _end; // inclusive
+ /// <summary>
+ /// This integer gives the largest year number of this era.
+ /// </summary>
+ private int _maxYear;
+
+ /// <summary>
+ /// This constructor creates the era structure.
+ /// </summary>
+ /// <param name="nr">The integer number of the era.
+ /// </param>
+ /// <param name="start">The fixed day number defining the
+ /// first day of the era.
+ /// </param>
+ /// <param name="end">The fixed day number that defines the
+ /// last day of the era.
+ /// </param>
+ public Era(int nr, int start, int end) {
+ if (nr == 0)
+ throw new System.ArgumentException(
+ "Era number shouldn't be zero.");
+ _nr = nr;
+ if (start > end) {
+ throw new System.ArgumentException(
+ "Era should start before end.");
+ }
+ _start = start;
+ _end = end;
+
+ _gregorianYearStart =
+ CCGregorianCalendar.year_from_fixed(_start);
+ int gregorianYearEnd =
+ CCGregorianCalendar.year_from_fixed(_end);
+ _maxYear = gregorianYearEnd - _gregorianYearStart + 1;
+ }
+
+ /// <summary>
+ /// This method computes the Gregorian year from the year
+ /// of this era.
+ /// </summary>
+ /// <param name="year">An integer giving the year in the
+ /// era.
+ /// </param>
+ /// <returns>
+ /// The Gregorian year as integer.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the year isn't valid in this
+ /// era.
+ /// </exception>
+ public int GregorianYear(int year) {
+ if (year < 1 || year > _maxYear) {
+ System.IO.StringWriter sw =
+ new System.IO.StringWriter();
+ sw.Write(
+ "Valid Values are between " +
+ "{0} and {1}, inclusive.",
+ 1, _maxYear);
+ throw new System.ArgumentOutOfRangeException(
+ "year", sw.ToString());
+ }
+ return year + _gregorianYearStart - 1;
+ }
+
+ /// <summary>
+ /// This function checks wether the given fixed day number is
+ /// ion the time span of the era.
+ /// </summary>
+ /// <param name="date">An integer giving the fixed day
+ /// number.
+ /// </param>
+ /// <returns>A boolean: true if the argument is in the time
+ /// span of the era.
+ /// </returns>
+ public bool Covers(int date) {
+ return _start <= date && date <= _end;
+ }
+
+ /// <summary>
+ /// This function returns the year of the era and sets
+ /// the era in an output parameter.
+ /// </summary>
+ /// <param name="era">An output parameter returning the
+ /// era number.
+ /// </param>
+ /// <param name="date">An integer giving the fixed day
+ /// number.
+ /// </param>
+ /// <returns>An integer giving the year of the era.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if date is outside of the time
+ /// span of the era.
+ /// </exception>
+ public int EraYear(out int era, int date) {
+ if (!Covers(date))
+ throw new System.ArgumentOutOfRangeException(
+ "date",
+ "Time was out of Era range.");
+ int gregorianYear =
+ CCGregorianCalendar.year_from_fixed(date);
+ era = _nr;
+ return gregorianYear - _gregorianYearStart + 1;
+ }
+ } // struct Era
+
+ /// <summary>
+ /// A private member storing the eras in a
+ /// <see cref="T:System.Collections.SortedList"/>.
+ /// </summary>
+ private SortedList _Eras;
+
+ /// <value>
+ /// The property returns the era numbers as an array of integers.
+ /// </value>
+ public int[] Eras {
+ get {
+ int[] a = new int[_Eras.Count];
+
+ for (int i = 0; i < _Eras.Count; i++) {
+ Era e = (Era)_Eras.GetByIndex(i);
+ a[i] = e.Nr;
+ }
+
+ return a;
+ }
+ }
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public CCGregorianEraHandler() {
+ _Eras = new SortedList();
+ }
+
+ /// <summary>
+ /// Method adds an era to the GregorianEraHandler instance.
+ /// </summary>
+ /// <param name="nr">The integer number of the era.
+ /// </param>
+ /// <param name="rd_start">The fixed day number defining the
+ /// first day of the era.
+ /// </param>
+ /// <param name="rd_end">The fixed day number that defines the
+ /// last day of the era.
+ /// </param>
+ public void appendEra(int nr, int rd_start, int rd_end) {
+ Era era = new Era(nr, rd_start, rd_end);
+ _Eras[(System.Object)nr] = era;
+ }
+ /// <summary>
+ /// Method adds a yet not-ended era to the GregorianEraHandler
+ /// instance.
+ /// </summary>
+ /// <param name="nr">The integer number of the era.
+ /// </param>
+ /// <param name="rd_start">The fixed day number defining the
+ /// first day of the era.
+ /// </param>
+ public void appendEra(int nr, int rd_start) {
+ appendEra(nr, rd_start,
+ CCFixed.FromDateTime(DateTime.MaxValue));
+ }
+
+ /// <summary>
+ /// This method computes the Gregorian year from the year
+ /// of the given era.
+ /// </summary>
+ /// <param name="year">An integer giving the year in the
+ /// era.
+ /// </param>
+ /// <param name="era">An integer giving the era number.
+ /// </param>
+ /// <returns>
+ /// The Gregorian year as integer.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the year isn't valid in this
+ /// era.
+ /// </exception>
+ public int GregorianYear(int year, int era) {
+ Era e = (Era)_Eras[(System.Object)era];
+ return e.GregorianYear(year);
+ }
+
+ /// <summary>
+ /// This function returns the year of the era and sets
+ /// the era in an output parameter.
+ /// </summary>
+ /// <param name="era">An output parameter returning the
+ /// era number.
+ /// </param>
+ /// <param name="date">An integer giving the fixed day
+ /// number.
+ /// </param>
+ /// <returns>An integer giving the year of the era.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the fixed day number is outside of the
+ /// time spans of all eras.
+ /// </exception>
+ public int EraYear(out int era, int date)
+ {
+ IList list = _Eras.GetValueList();
+
+ foreach (Era e in list) {
+ if (e.Covers(date))
+ return e.EraYear(out era, date);
+ }
+
+ throw new System.ArgumentOutOfRangeException("date",
+ "Time value was out of era range.");
+ }
+
+ /// <summary>
+ /// The method checks whether a given
+ /// <see cref="T:System.DateTime"/> is covered by any era.
+ /// </summary>
+ /// <param name="time">A
+ /// <see cref="T:System.DateTime"/> giving the date and time.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the argument isn't inside the time
+ /// span of any era.
+ /// </exception>
+ public void CheckDateTime(System.DateTime time) {
+ int date = CCFixed.FromDateTime(time);
+
+ if (!ValidDate(date))
+ throw new System.ArgumentOutOfRangeException("time",
+ "Time value was out of era range.");
+ }
+
+ /// <summary>
+ /// The method tests whether a given
+ /// fixed day number is covered by any era.
+ /// </summary>
+ /// <param name="date">An integer representing the fixed day number.
+ /// </param>
+ /// <returns> A boolean is returned: true if the argument is inside
+ /// the time span of one era; false otherwise.
+ /// </returns>
+ public bool ValidDate(int date) {
+ IList list = _Eras.GetValueList();
+
+ foreach (Era e in list) {
+ if (e.Covers(date))
+ return true;
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// The method tests, whether the era number does exist.
+ /// </summary>
+ /// <param name="era">An integer giving the era number.
+ /// </param>
+ /// <returns>A boole value: True if the era number does exist;
+ /// false otherwise.
+ /// </returns>
+ public bool ValidEra(int era) {
+ return _Eras.Contains((System.Object)era);
+ }
+} // class CCGregorianEraHandler
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/ChangeLog b/mcs/class/corlib/System.Globalization/ChangeLog
new file mode 100644
index 00000000000..7f587a9d535
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/ChangeLog
@@ -0,0 +1,92 @@
+2002-04-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * NumberFormatInfo.cs: always set the values for the invariant culture
+ until there are more cultures supported.
+
+2002-04-22 Nick Drochak <ndrochak@gol.com>
+
+ * NumberStyles.cs: Add [Serializable].
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * UnicodeCategory.cs: Fix typos in enum names.
+
+2002-03-04 Nick Drochak <ndrochak@gol.com>
+
+ * JulianCalendar.cs: JulianEra should be field, not a property.
+ Thanks CorCompare (and Piers).
+
+2002-02-12 Duncan Mak <duncan@ximian.com>
+
+ * CultureInfo.cs: Added the Calendar property to make the TimeZone
+ class build. It's marked as MonoTODO.
+
+2002-02-12 Nick Drochak <ndrochak@gol.com>
+
+ * UnicodeCategory.cs: Fix typo.
+
+2002-02-01 Radek Doulik <rodo@ximian.com>
+
+ * RegionInfo.cs: started work on RegionInfo
+ implemented RegionInfo (string) constructor
+
+ * CultureInfo.cs: added internal static function,
+ which could be used from RegionInfo.cs
+
+2002-01-16 Miguel de Icaza <miguel@ximian.com>
+
+ * CultureInfo.cs: Completed the tables. Now we need to actually
+ fill it in.
+
+2002-01-15 Duncan Mak <duncan@ximian.com>
+
+ * CultureInfo.cs: Convert it to unix text.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * GreogrianCalendar.cs : The same old MonoTODO attribute.
+
+2001-11-21 Miguel de Icaza <miguel@ximian.com>
+
+ * Locale.cs: New file, a place holder for Locale.GetText.
+
+Wed Nov 14 16:47:07 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Calendar.cs: CLSCompliant updates.
+
+2001-11-04 Martin Weindel <martin.weindel@t-online.de>
+ * NumberFormatInfo.cs: fixed minor bug in Clone with readonly flag
+
+ * DateTimeFormatInfo.cs: added
+
+ * CultureInfo.cs: some changed needed for compiling DateTimeFormatInfo.cs
+
+2001-10-26 Miguel de Icaza <miguel@ximian.com>
+
+ * NumberFormatInfo.cs: Provide an internal constructor that takes
+ as an argument a CultureInfo ID (LCID) so that we can construct
+ different ones here.
+
+ * CultureInfo.cs: Begun implementation.
+
+2001-10-09 Derek Holden <dholden@draper.com>
+
+ * NumberFormatInfo.cs: Small typo in PercentPositivePattern
+ and CurrencyPositivePattern
+
+2001-09-02 Miguel de Icaza <miguel@ximian.com>
+
+ * Calendar.cs: Implement a bunch of missing features.
+
+2001-07-24 Derek Holden <dholden@draper.com>
+
+ * NumberStyles.cs: Added ECMA values for Allow types and default
+ styles.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * DateTimeStyles.cs, NumberStyles.cs: Add.
+
+2001-07-06 Joe Shaw <joe@ximian.com>
+
+ * UnicodeCategory.cs: Added.
diff --git a/mcs/class/corlib/System.Globalization/CompareOptions.cs b/mcs/class/corlib/System.Globalization/CompareOptions.cs
new file mode 100755
index 00000000000..81be8d94504
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/CompareOptions.cs
@@ -0,0 +1,54 @@
+// CompareOptions.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:34:52 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Globalization {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum CompareOptions {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ IgnoreCase = 1,
+
+ /// <summary>
+ /// </summary>
+ IgnoreNonSpace = 2,
+
+ /// <summary>
+ /// </summary>
+ IgnoreSymbols = 4,
+
+ /// <summary>
+ /// </summary>
+ IgnoreKanaType = 8,
+
+ /// <summary>
+ /// </summary>
+ IgnoreWidth = 16,
+
+ /// <summary>
+ /// </summary>
+ StringSort = 536870912,
+
+ /// <summary>
+ /// </summary>
+ Ordinal = 1073741824,
+ } // CompareOptions
+
+} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/CultureInfo.cs b/mcs/class/corlib/System.Globalization/CultureInfo.cs
new file mode 100644
index 00000000000..36ed5d91c65
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/CultureInfo.cs
@@ -0,0 +1,850 @@
+//
+// System.Globalization.CultureInfo
+//
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. 2001 (http://www.ximian.com)
+//
+
+using System.Threading;
+
+namespace System.Globalization
+{
+ [Serializable]
+ public class CultureInfo : IFormatProvider
+ {
+ static CultureInfo invariant_culture_info;
+ bool is_read_only;
+ int lcid;
+ bool use_user_override;
+ NumberFormatInfo number_format;
+ DateTimeFormatInfo datetime_format;
+
+ private static readonly string MSG_READONLY = "This instance is read only";
+
+ // <summary>
+ // Returns the Invariant Culture Information ("iv")
+ // </summary>
+ static public CultureInfo InvariantCulture {
+ get {
+ if (invariant_culture_info != null)
+ return invariant_culture_info;
+
+ invariant_culture_info = new CultureInfo (0x07f, false);
+ invariant_culture_info.is_read_only = true;
+
+ return invariant_culture_info;
+ }
+ }
+
+ //
+ // Initializes the CultureInfo object for the specific culture_id
+ //
+ void InitializeByID (int culture_id, bool use_user_override)
+ {
+ switch (culture_id){
+ case 0x0001: // ar Arabic
+ case 0x0401: // ar-SA Arabic (Saudi Arabia)
+ case 0x0801: // ar-IQ Arabic (Iraq)
+ case 0x0C01: // ar-EG Arabic (Egypt)
+ case 0x1001: // ar-LY Arabic (Libya)
+ case 0x1401: // ar-DZ Arabic (Algeria)
+ case 0x1801: // ar-MA Arabic (Morocco)
+ case 0x1C01: // ar-TN Arabic (Tunisia)
+ case 0x2001: // ar-OM Arabic (Oman)
+ case 0x2401: // ar-YE Arabic (Yemen)
+ case 0x2801: // ar-SY Arabic (Syria)
+ case 0x2C01: // ar-JO Arabic (Jordan)
+ case 0x3001: // ar-LB Arabic (Lebanon)
+ case 0x3401: // ar-KW Arabic (Kuwait)
+ case 0x3801: // ar-AE Arabic (U.A.E.)
+ case 0x3C01: // ar-BH Arabic (Bahrain)
+ case 0x4001: // ar-QA Arabic (Qatar)
+ case 0x0002: // bg Bulgarian
+ case 0x0402: // bg-BG Bulgarian (Bulgaria)
+ case 0x0003: // ca Catalan
+ case 0x0403: // ca-ES Catalan (Spain)
+ case 0x0004: // zh-CHS Chinese (Simplified)
+ case 0x0404: // zh-TW Chinese (Taiwan)
+ case 0x0804: // zh-CN Chinese (People's Republic of China)
+ case 0x0C04: // zh-HK Chinese (Hong Kong S.A.R.)
+ case 0x1004: // zh-SG Chinese (Singapore)
+ case 0x1404: // zh-MO Chinese (Macau S.A.R.)
+ case 0x7C04: // zh-CHT Chinese (Traditional)
+ case 0x0005: // cs Czech
+ case 0x0405: // cs-CZ Czech (Czech Republic)
+ case 0x0006: // da Danish
+ case 0x0406: // da-DK Danish (Denmark)
+ case 0x0007: // de German
+ case 0x0407: // de-DE German (Germany)
+ case 0x0807: // de-CH German (Switzerland)
+ case 0x0C07: // de-AT German (Austria)
+ case 0x1007: // de-LU German (Luxembourg)
+ case 0x1407: // de-LI German (Liechtenstein)
+ case 0x0008: // el Greek
+ case 0x0408: // el-GR Greek (Greece)
+ case 0x0009: // en English
+ case 0x0409: // en-US English (United States)
+ case 0x0809: // en-GB English (United Kingdom)
+ case 0x0C09: // en-AU English (Australia)
+ case 0x1009: // en-CA English (Canada)
+ case 0x1409: // en-NZ English (New Zealand)
+ case 0x1809: // en-IE English (Ireland)
+ case 0x1C09: // en-ZA English (South Africa)
+ case 0x2009: // en-JM English (Jamaica)
+ case 0x2409: // en-CB English (Caribbean)
+ case 0x2809: // en-BZ English (Belize)
+ case 0x2C09: // en-TT English (Trinidad and Tobago)
+ case 0x3009: // en-ZW English (Zimbabwe)
+ case 0x3409: // en-PH English (Republic of the Philippines)
+ case 0x000A: // es Spanish
+ case 0x080A: // es-MX Spanish (Mexico)
+ case 0x0C0A: // es-ES Spanish (Spain)
+ case 0x100A: // es-GT Spanish (Guatemala)
+ case 0x140A: // es-CR Spanish (Costa Rica)
+ case 0x180A: // es-PA Spanish (Panama)
+ case 0x1C0A: // es-DO Spanish (Dominican Republic)
+ case 0x200A: // es-VE Spanish (Venezuela)
+ case 0x240A: // es-CO Spanish (Colombia)
+ case 0x280A: // es-PE Spanish (Peru)
+ case 0x2C0A: // es-AR Spanish (Argentina)
+ case 0x300A: // es-EC Spanish (Ecuador)
+ case 0x340A: // es-CL Spanish (Chile)
+ case 0x380A: // es-UY Spanish (Uruguay)
+ case 0x3C0A: // es-PY Spanish (Paraguay)
+ case 0x400A: // es-BO Spanish (Bolivia)
+ case 0x440A: // es-SV Spanish (El Salvador)
+ case 0x480A: // es-HN Spanish (Honduras)
+ case 0x4C0A: // es-NI Spanish (Nicaragua)
+ case 0x500A: // es-PR Spanish (Puerto Rico)
+ case 0x000B: // fi Finnish
+ case 0x040B: // fi-FI Finnish (Finland)
+ case 0x000C: // fr French
+ case 0x040C: // fr-FR French (France)
+ case 0x080C: // fr-BE French (Belgium)
+ case 0x0C0C: // fr-CA French (Canada)
+ case 0x100C: // fr-CH French (Switzerland)
+ case 0x140C: // fr-LU French (Luxembourg)
+ case 0x180C: // fr-MC French (Principality of Monaco)
+ case 0x000D: // he Hebrew
+ case 0x040D: // he-IL Hebrew (Israel)
+ case 0x000E: // hu Hungarian
+ case 0x040E: // hu-HU Hungarian (Hungary)
+ case 0x000F: // is Icelandic
+ case 0x040F: // is-IS Icelandic (Iceland)
+ case 0x0010: // it Italian
+ case 0x0410: // it-IT Italian (Italy)
+ case 0x0810: // it-CH Italian (Switzerland)
+ case 0x0011: // ja Japanese
+ case 0x0411: // ja-JP Japanese (Japan)
+ case 0x0012: // ko Korean
+ case 0x0412: // ko-KR Korean (Korea)
+ case 0x0013: // nl Dutch
+ case 0x0413: // nl-NL Dutch (Netherlands)
+ case 0x0813: // nl-BE Dutch (Belgium)
+ case 0x0014: // no Norwegian
+ case 0x0414: // nb-NO Norwegian (Bokmål) (Norway)
+ case 0x0814: // nn-NO Norwegian (Nynorsk) (Norway)
+ case 0x0015: // pl Polish
+ case 0x0415: // pl-PL Polish (Poland)
+ case 0x0016: // pt Portuguese
+ case 0x0416: // pt-BR Portuguese (Brazil)
+ case 0x0816: // pt-PT Portuguese (Portugal)
+ case 0x0018: // ro Romanian
+ case 0x0418: // ro-RO Romanian (Romania)
+ case 0x0019: // ru Russian
+ case 0x0419: // ru-RU Russian (Russia)
+ case 0x001A: // hr Croatian
+ case 0x041A: // hr-HR Croatian (Croatia)
+ case 0x081A: // Lt-sr-SP Serbian (Latin) (Serbia)
+ case 0x0C1A: // Cy-sr-SP Serbian (Cyrillic) (Serbia)
+ case 0x001B: // sk Slovak
+ case 0x041B: // sk-SK Slovak (Slovakia)
+ case 0x001C: // sq Albanian
+ case 0x041C: // sq-AL Albanian (Albania)
+ case 0x001D: // sv Swedish
+ case 0x041D: // sv-SE Swedish (Sweden)
+ case 0x081D: // sv-FI Swedish (Finland)
+ case 0x001E: // th Thai
+ case 0x041E: // th-TH Thai (Thailand)
+ case 0x001F: // tr Turkish
+ case 0x041F: // tr-TR Turkish (Turkey)
+ case 0x0020: // ur Urdu
+ case 0x0420: // ur-PK Urdu (Islamic Republic of Pakistan)
+ case 0x0021: // id Indonesian
+ case 0x0421: // id-ID Indonesian (Indonesia)
+ case 0x0022: // uk Ukrainian
+ case 0x0422: // uk-UA Ukrainian (Ukraine)
+ case 0x0023: // be Belarusian
+ case 0x0423: // be-BY Belarusian (Belarus)
+ case 0x0024: // sl Slovenian
+ case 0x0424: // sl-SI Slovenian (Slovenia)
+ case 0x0025: // et Estonian
+ case 0x0425: // et-EE Estonian (Estonia)
+ case 0x0026: // lv Latvian
+ case 0x0426: // lv-LV Latvian (Latvia)
+ case 0x0027: // lt Lithuanian
+ case 0x0427: // lt-LT Lithuanian (Lithuania)
+ case 0x0029: // fa Farsi
+ case 0x0429: // fa-IR Farsi (Iran)
+ case 0x002A: // vi Vietnamese
+ case 0x042A: // vi-VN Vietnamese (Viet Nam)
+ case 0x002B: // hy Armenian
+ case 0x042B: // hy-AM Armenian (Armenia)
+ case 0x002C: // az Azeri
+ case 0x042C: // Lt-az-AZ Azeri (Latin) (Azerbaijan)
+ case 0x082C: // Cy-az-AZ Azeri (Cyrillic) (Azerbaijan)
+ case 0x002D: // eu Basque
+ case 0x042D: // eu-ES Basque (Spain)
+ case 0x002F: // mk FYRO Macedonian
+ case 0x042F: // mk-MK FYRO Macedonian (Former Yugoslav Republic of Macedonia)
+ case 0x0036: // af Afrikaans
+ case 0x0436: // af-ZA Afrikaans (South Africa)
+ case 0x0037: // ka Georgian
+ case 0x0437: // ka-GE Georgian (Georgia)
+ case 0x0038: // fo Faeroese
+ case 0x0438: // fo-FO Faeroese (Faeroe Islands)
+ case 0x0039: // hi Hindi
+ case 0x0439: // hi-IN Hindi (India)
+ case 0x003E: // ms Malay
+ case 0x043E: // ms-MY Malay (Malaysia)
+ case 0x083E: // ms-BN Malay (Brunei Darussalam)
+ case 0x003F: // kk Kazakh
+ case 0x043F: // kk-KZ Kazakh (Kazakhstan)
+ case 0x0040: // ky Kyrgyz
+ case 0x0440: // ky-KZ Kyrgyz (Kyrgyzstan)
+ case 0x0041: // sw Swahili
+ case 0x0441: // sw-KE Swahili (Kenya)
+ case 0x0043: // uz Uzbek
+ case 0x0443: // Lt-uz-UZ Uzbek (Latin) (Uzbekistan)
+ case 0x0843: // Cy-uz-UZ Uzbek (Cyrillic) (Uzbekistan)
+ case 0x0044: // tt Tatar
+ case 0x0444: // tt-TA Tatar (Tatarstan)
+ case 0x0046: // pa Punjabi
+ case 0x0446: // pa-IN Punjabi (India)
+ case 0x0047: // gu Gujarati
+ case 0x0447: // gu-IN Gujarati (India)
+ case 0x0049: // ta Tamil
+ case 0x0449: // ta-IN Tamil (India)
+ case 0x004A: // te Telugu
+ case 0x044A: // te-IN Telugu (India)
+ case 0x004B: // kn Kannada
+ case 0x044B: // kn-IN Kannada (India)
+ case 0x004E: // mr Marathi
+ case 0x044E: // mr-IN Marathi (India)
+ case 0x004F: // sa Sanskrit
+ case 0x044F: // sa-IN Sanskrit (India)
+ case 0x0050: // mn Mongolian
+ case 0x0450: // mn-MN Mongolian (Mongolia)
+ case 0x0056: // gl Galician
+ case 0x0456: // gl-ES Galician (Spain)
+ case 0x0057: // kok Konkani
+ case 0x0457: // kok-IN Konkani (India)
+ case 0x005A: // syr Syriac
+ case 0x045A: // syr-SY Syriac (Syria)
+ case 0x0065: // div Divehi
+ case 0x0465: // div-MV Divehi (Maldives)
+ case 0x007F: // Invariant Language (Invariant Country)
+ break;
+
+ default:
+ throw new ArgumentException ("CultureInfoCode");
+ }
+ lcid = culture_id;
+ this.use_user_override = use_user_override;
+ }
+
+ //
+ // Maps a name to a culture id
+ //
+ static int NameToID (string name)
+ {
+ switch (name){
+ case "ar":
+ return 0x0001;
+ case "ar-SA":
+ return 0x0401;
+ case "ar-IQ":
+ return 0x0801;
+ case "ar-EG":
+ return 0x0C01;
+ case "ar-LY":
+ return 0x1001;
+ case "ar-DZ":
+ return 0x1401;
+ case "ar-MA":
+ return 0x1801;
+ case "ar-TN":
+ return 0x1C01;
+ case "ar-OM":
+ return 0x2001;
+ case "ar-YE":
+ return 0x2401;
+ case "ar-SY":
+ return 0x2801;
+ case "ar-JO":
+ return 0x2C01;
+ case "ar-LB":
+ return 0x3001;
+ case "ar-KW":
+ return 0x3401;
+ case "ar-AE":
+ return 0x3801;
+ case "ar-BH":
+ return 0x3C01;
+ case "ar-QA":
+ return 0x4001;
+ case "bg":
+ return 0x0002;
+ case "bg-BG":
+ return 0x0402;
+ case "ca":
+ return 0x0003;
+ case "ca-ES":
+ return 0x0403;
+ case "zh-CHS":
+ return 0x0004;
+ case "zh-TW":
+ return 0x0404;
+ case "zh-CN":
+ return 0x0804;
+ case "zh-HK":
+ return 0x0C04;
+ case "zh-SG":
+ return 0x1004;
+ case "zh-MO":
+ return 0x1404;
+ case "zh-CHT":
+ return 0x7C04;
+ case "cs":
+ return 0x0005;
+ case "cs-CZ":
+ return 0x0405;
+ case "da":
+ return 0x0006;
+ case "da-DK":
+ return 0x0406;
+ case "de":
+ return 0x0007;
+ case "de-DE":
+ return 0x0407;
+ case "de-CH":
+ return 0x0807;
+ case "de-AT":
+ return 0x0C07;
+ case "de-LU":
+ return 0x1007;
+ case "de-LI":
+ return 0x1407;
+ case "el":
+ return 0x0008;
+ case "el-GR":
+ return 0x0408;
+ case "en":
+ return 0x0009;
+ case "en-US":
+ return 0x0409;
+ case "en-GB":
+ return 0x0809;
+ case "en-AU":
+ return 0x0C09;
+ case "en-CA":
+ return 0x1009;
+ case "en-NZ":
+ return 0x1409;
+ case "en-IE":
+ return 0x1809;
+ case "en-ZA":
+ return 0x1C09;
+ case "en-JM":
+ return 0x2009;
+ case "en-CB":
+ return 0x2409;
+ case "en-BZ":
+ return 0x2809;
+ case "en-TT":
+ return 0x2C09;
+ case "en-ZW":
+ return 0x3009;
+ case "en-PH":
+ return 0x3409;
+ case "es":
+ return 0x000A;
+ case "es-MX":
+ return 0x080A;
+ case "es-ES":
+ return 0x0C0A;
+ case "es-GT":
+ return 0x100A;
+ case "es-CR":
+ return 0x140A;
+ case "es-PA":
+ return 0x180A;
+ case "es-DO":
+ return 0x1C0A;
+ case "es-VE":
+ return 0x200A;
+ case "es-CO":
+ return 0x240A;
+ case "es-PE":
+ return 0x280A;
+ case "es-AR":
+ return 0x2C0A;
+ case "es-EC":
+ return 0x300A;
+ case "es-CL":
+ return 0x340A;
+ case "es-UY":
+ return 0x380A;
+ case "es-PY":
+ return 0x3C0A;
+ case "es-BO":
+ return 0x400A;
+ case "es-SV":
+ return 0x440A;
+ case "es-HN":
+ return 0x480A;
+ case "es-NI":
+ return 0x4C0A;
+ case "es-PR":
+ return 0x500A;
+ case "fi":
+ return 0x000B;
+ case "fi-FI":
+ return 0x040B;
+ case "fr":
+ return 0x000C;
+ case "fr-FR":
+ return 0x040C;
+ case "fr-BE":
+ return 0x080C;
+ case "fr-CA":
+ return 0x0C0C;
+ case "fr-CH":
+ return 0x100C;
+ case "fr-LU":
+ return 0x140C;
+ case "fr-MC":
+ return 0x180C;
+ case "he":
+ return 0x000D;
+ case "he-IL":
+ return 0x040D;
+ case "hu":
+ return 0x000E;
+ case "hu-HU":
+ return 0x040E;
+ case "is":
+ return 0x000F;
+ case "is-IS":
+ return 0x040F;
+ case "it":
+ return 0x0010;
+ case "it-IT":
+ return 0x0410;
+ case "it-CH":
+ return 0x0810;
+ case "ja":
+ return 0x0011;
+ case "ja-JP":
+ return 0x0411;
+ case "ko":
+ return 0x0012;
+ case "ko-KR":
+ return 0x0412;
+ case "nl":
+ return 0x0013;
+ case "nl-NL":
+ return 0x0413;
+ case "nl-BE":
+ return 0x0813;
+ case "no":
+ return 0x0014;
+ case "nb-NO":
+ return 0x0414;
+ case "nn-NO":
+ return 0x0814;
+ case "pl":
+ return 0x0015;
+ case "pl-PL":
+ return 0x0415;
+ case "pt":
+ return 0x0016;
+ case "pt-BR":
+ return 0x0416;
+ case "pt-PT":
+ return 0x0816;
+ case "ro":
+ return 0x0018;
+ case "ro-RO":
+ return 0x0418;
+ case "ru":
+ return 0x0019;
+ case "ru-RU":
+ return 0x0419;
+ case "hr":
+ return 0x001A;
+ case "hr-HR":
+ return 0x041A;
+ case "Lt-sr-SP":
+ return 0x081A;
+ case "Cy-sr-SP":
+ return 0x0C1A;
+ case "sk":
+ return 0x001B;
+ case "sk-SK":
+ return 0x041B;
+ case "sq":
+ return 0x001C;
+ case "sq-AL":
+ return 0x041C;
+ case "sv":
+ return 0x001D;
+ case "sv-SE":
+ return 0x041D;
+ case "sv-FI":
+ return 0x081D;
+ case "th":
+ return 0x001E;
+ case "th-TH":
+ return 0x041E;
+ case "tr":
+ return 0x001F;
+ case "tr-TR":
+ return 0x041F;
+ case "ur":
+ return 0x0020;
+ case "ur-PK":
+ return 0x0420;
+ case "id":
+ return 0x0021;
+ case "id-ID":
+ return 0x0421;
+ case "uk":
+ return 0x0022;
+ case "uk-UA":
+ return 0x0422;
+ case "be":
+ return 0x0023;
+ case "be-BY":
+ return 0x0423;
+ case "sl":
+ return 0x0024;
+ case "sl-SI":
+ return 0x0424;
+ case "et":
+ return 0x0025;
+ case "et-EE":
+ return 0x0425;
+ case "lv":
+ return 0x0026;
+ case "lv-LV":
+ return 0x0426;
+ case "lt":
+ return 0x0027;
+ case "lt-LT":
+ return 0x0427;
+ case "fa":
+ return 0x0029;
+ case "fa-IR":
+ return 0x0429;
+ case "vi":
+ return 0x002A;
+ case "vi-VN":
+ return 0x042A;
+ case "hy":
+ return 0x002B;
+ case "hy-AM":
+ return 0x042B;
+ case "az":
+ return 0x002C;
+ case "Lt-az-AZ":
+ return 0x042C;
+ case "Cy-az-AZ":
+ return 0x082C;
+ case "eu":
+ return 0x002D;
+ case "eu-ES":
+ return 0x042D;
+ case "mk":
+ return 0x002F;
+ case "mk-MK":
+ return 0x042F;
+ case "af":
+ return 0x0036;
+ case "af-ZA":
+ return 0x0436;
+ case "ka":
+ return 0x0037;
+ case "ka-GE":
+ return 0x0437;
+ case "fo":
+ return 0x0038;
+ case "fo-FO":
+ return 0x0438;
+ case "hi":
+ return 0x0039;
+ case "hi-IN":
+ return 0x0439;
+ case "ms":
+ return 0x003E;
+ case "ms-MY":
+ return 0x043E;
+ case "ms-BN":
+ return 0x083E;
+ case "kk":
+ return 0x003F;
+ case "kk-KZ":
+ return 0x043F;
+ case "ky":
+ return 0x0040;
+ case "ky-KZ":
+ return 0x0440;
+ case "sw":
+ return 0x0041;
+ case "sw-KE":
+ return 0x0441;
+ case "uz":
+ return 0x0043;
+ case "Lt-uz-UZ":
+ return 0x0443;
+ case "Cy-uz-UZ":
+ return 0x0843;
+ case "tt":
+ return 0x0044;
+ case "tt-TA":
+ return 0x0444;
+ case "pa":
+ return 0x0046;
+ case "pa-IN":
+ return 0x0446;
+ case "gu":
+ return 0x0047;
+ case "gu-IN":
+ return 0x0447;
+ case "ta":
+ return 0x0049;
+ case "ta-IN":
+ return 0x0449;
+ case "te":
+ return 0x004A;
+ case "te-IN":
+ return 0x044A;
+ case "kn":
+ return 0x004B;
+ case "kn-IN":
+ return 0x044B;
+ case "mr":
+ return 0x004E;
+ case "mr-IN":
+ return 0x044E;
+ case "sa":
+ return 0x004F;
+ case "sa-IN":
+ return 0x044F;
+ case "mn":
+ return 0x0050;
+ case "mn-MN":
+ return 0x0450;
+ case "gl":
+ return 0x0056;
+ case "gl-ES":
+ return 0x0456;
+ case "kok":
+ return 0x0057;
+ case "kok-IN":
+ return 0x0457;
+ case "syr":
+ return 0x005A;
+ case "syr-SY":
+ return 0x045A;
+ case "div":
+ return 0x0065;
+ case "div-MV":
+ return 0x0465;
+ case "":
+ return 0x007F;
+ }
+ return -1;
+ }
+
+ // <summary>
+ // Creates a CultureInfo for a specific ID
+ // </summary>
+ public static CultureInfo CreateSpecificCulture (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ();
+
+ int id = NameToID (name);
+
+ if (id == -1)
+ throw new ArgumentException ("name");
+
+ return new CultureInfo (id, false);
+ }
+
+ /// <summary>
+ /// CultureInfo instance that represents the culture used by the current thread
+ /// </summary>
+ public static CultureInfo CurrentCulture
+ {
+ get
+ {
+ return Thread.CurrentThread.CurrentCulture;
+ }
+
+ set
+ {
+ Thread.CurrentThread.CurrentCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// CultureInfo instance that represents the current culture used by the ResourceManager to look up culture-specific resources at run time
+ /// </summary>
+ public static CultureInfo CurrentUICulture
+ {
+ get
+ {
+ return Thread.CurrentThread.CurrentUICulture;
+ }
+
+ set
+ {
+ Thread.CurrentThread.CurrentUICulture = value;
+ }
+ }
+
+
+ public virtual int LCID {
+ get {
+ return lcid;
+ }
+ }
+
+ // <summary>
+ // Gets the string-encoded name of the culture
+ // </summary>
+ public virtual string Name {
+ get {
+ switch (lcid){
+ case 0x007f:
+ return "iv";
+ }
+ throw new Exception ("Miss constructed object for LCID: " + lcid);
+ }
+ }
+
+ [MonoTODO]
+ public virtual Calendar Calendar
+ {
+ get { return null; }
+ }
+
+ internal static bool IsIDNeutralCulture (int lcid) {
+ return (lcid & 0xff00) == 0;
+ }
+
+ // <summary>
+ // Returns whether the current culture is neutral (neutral cultures
+ // only specify a language, not a country.
+ // </summary>
+ public virtual bool IsNeutralCulture {
+ get {
+ return IsIDNeutralCulture (lcid);
+ }
+ }
+ // <summary>
+ // Returns the NumberFormat for the current lcid
+ // </summary>
+ public virtual NumberFormatInfo NumberFormat {
+ get {
+ if (number_format == null){
+ lock (this){
+ if (number_format == null)
+ number_format = new NumberFormatInfo (lcid);
+ }
+ }
+
+ return number_format;
+ }
+
+ set {
+ if (is_read_only) throw new InvalidOperationException(MSG_READONLY);
+
+ if (value == null)
+ throw new ArgumentNullException ("NumberFormat");
+
+ number_format = value;
+ }
+ }
+
+ public virtual DateTimeFormatInfo DateTimeFormat
+ {
+ get
+ {
+ if (datetime_format == null)
+ {
+ lock (this)
+ {
+ if (datetime_format == null)
+ datetime_format = new DateTimeFormatInfo();
+ }
+ }
+
+ return datetime_format;
+ }
+
+ set
+ {
+ if (is_read_only) throw new InvalidOperationException(MSG_READONLY);
+
+ if (value == null)
+ throw new ArgumentNullException ("DateTimeFormat");
+
+ datetime_format = value;
+ }
+ }
+
+ //
+ // IFormatProvider implementation
+ //
+ public virtual object GetFormat( Type formatType )
+ {
+ object format = null;
+
+ if ( formatType == typeof(NumberFormatInfo) )
+ format = NumberFormat;
+ else if ( formatType == typeof(DateTimeFormatInfo) )
+ format = DateTimeFormat;
+
+ return format;
+ }
+
+ //
+ // Constructors
+ //
+ public CultureInfo (int culture, bool use_user_override)
+ {
+ if (culture < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ InitializeByID (culture, use_user_override);
+ }
+
+ public CultureInfo (int culture) : this (culture, false)
+ {
+ }
+
+ public CultureInfo (string name, bool use_user_override)
+ {
+ if (name == null)
+ throw new ArgumentNullException ();
+
+ InitializeByID (NameToID (name), use_user_override);
+ }
+
+ public CultureInfo (string name) : this (name, false) {}
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/CultureTypes.cs b/mcs/class/corlib/System.Globalization/CultureTypes.cs
new file mode 100755
index 00000000000..38f40796dae
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/CultureTypes.cs
@@ -0,0 +1,38 @@
+// CultureTypes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:35:02 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Globalization {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum CultureTypes {
+
+ /// <summary>
+ /// </summary>
+ NeutralCultures = 1,
+
+ /// <summary>
+ /// </summary>
+ SpecificCultures = 2,
+
+ /// <summary>
+ /// </summary>
+ AllCultures = 3,
+
+ /// <summary>
+ /// </summary>
+ InstalledWin32Cultures = 4,
+ } // CultureTypes
+
+} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs b/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
new file mode 100644
index 00000000000..5b45b1e490c
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/DateTimeFormatInfo.cs
@@ -0,0 +1,520 @@
+//
+// System.Globalization.DateTimeFormatInfo
+//
+// Some useful functions are missing in the ECMA specs.
+// They have been added following MS SDK Beta2
+//
+// Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) Martin Weindel (martin.weindel@t-online.de)
+
+using System;
+using System.Threading;
+
+namespace System.Globalization
+{
+ [Serializable]
+ public sealed class DateTimeFormatInfo : ICloneable, IFormatProvider {
+ private static readonly string MSG_READONLY = "This instance is read only";
+ private static readonly string MSG_ARRAYSIZE_MONTH = "An array with exactly 13 elements is needed";
+ private static readonly string MSG_ARRAYSIZE_DAY = "An array with exactly 7 elements is needed";
+ private static readonly string[] INVARIANT_ABBREVIATED_DAY_NAMES
+ = new string[7] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
+ private static readonly string[] INVARIANT_DAY_NAMES
+ = new string[7] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
+ private static readonly string[] INVARIANT_ABBREVIATED_MONTH_NAMES
+ = new string[13] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""};
+ private static readonly string[] INVARIANT_MONTH_NAMES
+ = new string[13] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""};
+
+ public static DateTimeFormatInfo theInvariantDateTimeFormatInfo;
+
+ private bool readOnly;
+ private string _AMDesignator;
+ private string _PMDesignator;
+ private string _DateSeparator;
+ private string _TimeSeparator;
+ private string _ShortDatePattern;
+ private string _LongDatePattern;
+ private string _ShortTimePattern;
+ private string _LongTimePattern;
+ private string _MonthDayPattern;
+ private string _YearMonthPattern;
+ private string _FullDateTimePattern;
+ private string _RFC1123Pattern;
+ private string _SortableDateTimePattern;
+ private string _UniversalSortableDateTimePattern;
+ private DayOfWeek _FirstDayOfWeek;
+ private Calendar _Calendar;
+ private CalendarWeekRule _CalendarWeekRule;
+ private string[] _AbbreviatedDayNames;
+ private string[] _DayNames;
+ private string[] _MonthNames;
+ private string[] _AbbreviatedMonthNames;
+
+ public DateTimeFormatInfo()
+ {
+ readOnly = false;
+ _AMDesignator = "AM";
+ _PMDesignator = "PM";
+ _DateSeparator = "/";
+ _TimeSeparator = ":";
+ _ShortDatePattern = "MM/dd/yyyy";
+ _LongDatePattern = "dddd, dd MMMM yyyy";
+ _ShortTimePattern = "HH:mm";
+ _LongTimePattern = "HH:mm:ss";
+ _MonthDayPattern = "MMMM dd";
+ _YearMonthPattern = "yyyy MMMM";
+ _FullDateTimePattern = "dddd, dd MMMM yyyy HH:mm:ss";
+
+ // FIXME for the following three pattern: "The default value of this property is derived from the calendar that is set for CultureInfo.CurrentCulture or the default calendar of CultureInfo.CurrentCulture."
+ _RFC1123Pattern = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
+ _SortableDateTimePattern = "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
+ _UniversalSortableDateTimePattern = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
+
+ _FirstDayOfWeek = DayOfWeek.Sunday;
+ _Calendar = new GregorianCalendar();
+ _CalendarWeekRule = CalendarWeekRule.FirstDay;
+
+ _AbbreviatedDayNames = INVARIANT_ABBREVIATED_DAY_NAMES;
+ _DayNames = INVARIANT_DAY_NAMES;
+ _AbbreviatedMonthNames = INVARIANT_ABBREVIATED_MONTH_NAMES;
+ _MonthNames = INVARIANT_MONTH_NAMES;
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public static DateTimeFormatInfo GetInstance(IFormatProvider provider)
+ {
+ if (provider != null) {
+ DateTimeFormatInfo dtfi;
+ dtfi = (DateTimeFormatInfo)provider.GetFormat(typeof(DateTimeFormatInfo));
+ if (dtfi != null)
+ return dtfi;
+ }
+
+ return CurrentInfo;
+ }
+
+ public bool IsReadOnly {
+ get {
+ return readOnly;
+ }
+ }
+
+ public static DateTimeFormatInfo ReadOnly(DateTimeFormatInfo dtfi)
+ {
+ DateTimeFormatInfo copy = (DateTimeFormatInfo)dtfi.Clone();
+ copy.readOnly = true;
+ return copy;
+ }
+
+ public object Clone ()
+ {
+ DateTimeFormatInfo clone = (DateTimeFormatInfo) MemberwiseClone();
+ // clone is not read only
+ clone.readOnly = false;
+ return clone;
+ }
+
+ public object GetFormat(Type formatType)
+ {
+ return (formatType == GetType()) ? this : null;
+ }
+
+ public string GetAbbreviatedEraName(int era)
+ {
+ if (era < _Calendar.Eras.Length || era >= _Calendar.Eras.Length)
+ throw new ArgumentOutOfRangeException();
+ notImplemented();
+ //FIXME: implement me
+ return null;
+ }
+
+ public string GetAbbreviatedMonthName(int month)
+ {
+ if (month < 1 || month > 13) throw new ArgumentOutOfRangeException();
+ return _AbbreviatedMonthNames[month-1];
+ }
+
+ public int GetEra(string eraName)
+ {
+ if (eraName == null) throw new ArgumentNullException();
+ eraName = eraName.ToUpper();
+ notImplemented();
+ //FIXME: implement me
+ return -1;
+ }
+
+ public string GetEraName(int era)
+ {
+ if (era < _Calendar.Eras.Length || era >= _Calendar.Eras.Length)
+ throw new ArgumentOutOfRangeException();
+ notImplemented();
+ //FIXME: implement me
+ return null;
+ }
+
+ public string GetMonthName(int month)
+ {
+ if (month < 1 || month > 13) throw new ArgumentOutOfRangeException();
+ return _MonthNames[month-1];
+ }
+
+ public string[] AbbreviatedDayNames
+ {
+ get
+ {
+ return (string[]) _AbbreviatedDayNames.Clone();
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ if (value.GetLength(0) != 7) throw new ArgumentException(MSG_ARRAYSIZE_DAY);
+ _AbbreviatedDayNames = (string[]) value.Clone();
+ }
+ }
+
+ public string[] AbbreviatedMonthNames
+ {
+ get
+ {
+ return (string[]) _AbbreviatedMonthNames.Clone();
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ if (value.GetLength(0) != 13) throw new ArgumentException(MSG_ARRAYSIZE_MONTH);
+ _AbbreviatedMonthNames = (string[]) value.Clone();
+ }
+ }
+
+ public string[] DayNames
+ {
+ get
+ {
+ return (string[]) _DayNames.Clone();
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ if (value.GetLength(0) != 7) throw new ArgumentException(MSG_ARRAYSIZE_DAY);
+ _DayNames = (string[]) value.Clone();
+ }
+ }
+
+ public string[] MonthNames
+ {
+ get
+ {
+ return (string[]) _MonthNames.Clone();
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ if (value.GetLength(0) != 13) throw new ArgumentException(MSG_ARRAYSIZE_MONTH);
+ _MonthNames = (string[]) value.Clone();
+ }
+ }
+
+ public string AMDesignator
+ {
+ get
+ {
+ return _AMDesignator;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _AMDesignator = value;
+ }
+ }
+
+ public string PMDesignator
+ {
+ get
+ {
+ return _PMDesignator;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _PMDesignator = value;
+ }
+ }
+
+ public string DateSeparator
+ {
+ get
+ {
+ return _DateSeparator;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _DateSeparator = value;
+ }
+ }
+
+ public string TimeSeparator
+ {
+ get
+ {
+ return _TimeSeparator;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _TimeSeparator = value;
+ }
+ }
+
+ public string LongDatePattern
+ {
+ get
+ {
+ return _LongDatePattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _LongDatePattern = value;
+ }
+ }
+
+ public string ShortDatePattern
+ {
+ get
+ {
+ return _ShortDatePattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _ShortDatePattern = value;
+ }
+ }
+
+ public string ShortTimePattern
+ {
+ get
+ {
+ return _ShortTimePattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _ShortTimePattern = value;
+ }
+ }
+
+ public string LongTimePattern
+ {
+ get
+ {
+ return _LongTimePattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _LongTimePattern = value;
+ }
+ }
+
+ public string MonthDayPattern
+ {
+ get
+ {
+ return _MonthDayPattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _MonthDayPattern = value;
+ }
+ }
+
+ public string YearMonthPattern
+ {
+ get
+ {
+ return _YearMonthPattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _YearMonthPattern = value;
+ }
+ }
+
+ public string FullDateTimePattern
+ {
+ get
+ {
+ return _FullDateTimePattern;
+ }
+
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _FullDateTimePattern = value;
+ }
+ }
+
+ public static DateTimeFormatInfo CurrentInfo
+ {
+ get
+ {
+ return Thread.CurrentThread.CurrentCulture.DateTimeFormat;
+ }
+ }
+
+ public static DateTimeFormatInfo InvariantInfo
+ {
+ get
+ {
+ if (theInvariantDateTimeFormatInfo == null)
+ {
+ theInvariantDateTimeFormatInfo =
+ DateTimeFormatInfo.ReadOnly(new DateTimeFormatInfo());
+ }
+ return theInvariantDateTimeFormatInfo;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public DayOfWeek FirstDayOfWeek
+ {
+ get
+ {
+ return _FirstDayOfWeek;
+ }
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if ((int) value < 0 || (int) value > 6) throw new ArgumentOutOfRangeException();
+ _FirstDayOfWeek = value;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public Calendar Calendar
+ {
+ get
+ {
+ return _Calendar;
+ }
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ if (value == null) throw new ArgumentNullException();
+ _Calendar = value;
+ }
+ }
+
+ public CalendarWeekRule CalendarWeekRule
+ {
+ get
+ {
+ return _CalendarWeekRule;
+ }
+ set
+ {
+ if (IsReadOnly) throw new InvalidOperationException(MSG_READONLY);
+ _CalendarWeekRule = value;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string RFC1123Pattern
+ {
+ get
+ {
+ return _RFC1123Pattern;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string SortableDateTimePattern
+ {
+ get
+ {
+ return _SortableDateTimePattern;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string UniversalSortableDateTimePattern
+ {
+ get
+ {
+ return _UniversalSortableDateTimePattern;
+ }
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string[] GetAllDateTimePatterns()
+ {
+ notImplemented();
+ //FIXME: implement me
+ return null;
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string[] GetAllDateTimePatterns(char format)
+ {
+ notImplemented();
+ //FIXME: implement me
+ return null;
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string GetDayName(DayOfWeek dayofweek)
+ {
+ int index = (int) dayofweek;
+ if (index < 0 || index > 6) throw new ArgumentOutOfRangeException();
+ return _DayNames[index];
+ }
+
+ // LAMESPEC: this is not in ECMA specs
+ public string GetAbbreviatedDayName(DayOfWeek dayofweek)
+ {
+ int index = (int) dayofweek;
+ if (index < 0 || index > 6) throw new ArgumentOutOfRangeException();
+ return _AbbreviatedDayNames[index];
+ }
+
+ private static void notImplemented()
+ {
+ throw new Exception("Not implemented");
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/DateTimeStyles.cs b/mcs/class/corlib/System.Globalization/DateTimeStyles.cs
new file mode 100644
index 00000000000..0e65c4d966d
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/DateTimeStyles.cs
@@ -0,0 +1,50 @@
+// DateTimeStyles.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:07 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Globalization {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum DateTimeStyles {
+
+ /// <summary>
+ /// </summary>
+ None = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ AllowLeadingWhite = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ AllowTrailingWhite = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ AllowInnerWhite = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ AllowWhiteSpaces = AllowLeadingWhite | AllowTrailingWhite | AllowInnerWhite,
+
+ /// <summary>
+ /// </summary>
+ NoCurrentDateDefault = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ AdjustToUniversal = 0x00000010,
+ } // DateTimeStyles
+
+} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/DaylightTime.cs b/mcs/class/corlib/System.Globalization/DaylightTime.cs
new file mode 100755
index 00000000000..64fc092f94f
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/DaylightTime.cs
@@ -0,0 +1,51 @@
+//
+// System.Globalization.DaylightTime
+//
+// Author:
+// Chris Hynes (chrish@assistedsolutions.com)
+//
+// (C) 2001 Chris Hynes
+//
+
+using System.Globalization;
+
+namespace System.Globalization
+{
+ [Serializable]
+ public class DaylightTime
+ {
+ DateTime start, end;
+ TimeSpan delta;
+
+ public DaylightTime(DateTime start, DateTime end, TimeSpan delta)
+ {
+ this.start = start;
+ this.end = end;
+ this.delta = delta;
+ }
+
+ public DateTime Start
+ {
+ get
+ {
+ return start;
+ }
+ }
+
+ public DateTime End
+ {
+ get
+ {
+ return end;
+ }
+ }
+
+ public TimeSpan Delta
+ {
+ get
+ {
+ return delta;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/GregorianCalendar.cs b/mcs/class/corlib/System.Globalization/GregorianCalendar.cs
new file mode 100644
index 00000000000..54c9f44de49
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/GregorianCalendar.cs
@@ -0,0 +1,448 @@
+// GregorianCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the Gregorian calendar.
+/// </summary>
+/// <remarks>
+/// <para>The Gregorian calendar supports only the Common Era from
+/// the Gregorian year 1 to the Gregorian year 9999.
+/// </para>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class GregorianCalendar : Calendar {
+ /// <summary>
+ /// The era number for the Common Era (C.E.) or Anno Domini (A.D.)
+ /// respective.
+ /// </summary>
+ public const int ADEra = 1;
+
+ /// <value>Overridden. Gives the eras supported by the Gregorian
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return new int[] { ADEra };
+ }
+ }
+
+ /// <summary>
+ /// A protected member storing the
+ /// <see cref="T:System.Globalization.GregorianCalendarTypes"/>.
+ /// </summary>
+ internal GregorianCalendarTypes M_CalendarType;
+
+ /// <value>
+ /// The property stores the
+ /// <see cref="T:System.Globalization.GregorianCalendarTypes"/>.
+ /// </value>
+ public virtual GregorianCalendarTypes CalendarType {
+ get { return M_CalendarType; }
+ set {
+ // mscorlib 1:0:33000:0 doesn't check anything here
+ M_CalendarType = value;
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:ADEra"/>.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = ADEra;
+ if (era != ADEra)
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:ADEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the allowed range.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckEra(ref era);
+ M_ArgumentInRange("year", year, 1, 9999);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:ADEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYME(int year, int month, ref int era) {
+ M_CheckYE(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:ADEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYMDE(int year, int month, int day, ref int era)
+ {
+ M_CheckYME(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, era));
+ }
+
+ /// <summary>
+ /// Overridden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddMonths(DateTime time, int months) {
+ return CCGregorianCalendar.AddMonths(time, months);
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddYears(DateTime time, int years) {
+ return CCGregorianCalendar.AddYears(time, years);
+ }
+
+ /// <summary>
+ /// Overridden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override int GetDayOfMonth(DateTime time) {
+ return CCGregorianCalendar.GetDayOfMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public override int GetDayOfYear(DateTime time) {
+ return CCGregorianCalendar.GetDayOfYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An intger that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ // mscorlib doesn't check year, probably a bug; we do
+ M_CheckYME(year, month, ref era);
+ return CCGregorianCalendar.GetDaysInMonth(year, month);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCGregorianCalendar.GetDaysInYear(year);
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ public override int GetEra(DateTime time) {
+ return ADEra;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public override int GetMonth(DateTime time) {
+ return CCGregorianCalendar.GetMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ public override int GetYear(DateTime time) {
+ return CCGregorianCalendar.GetYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ return CCGregorianCalendar.IsLeapDay(year, month, day);
+ }
+
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCGregorianCalendar.is_leap_year(year);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ return CCGregorianCalendar.ToDateTime(
+ year, month, day,
+ hour, minute, second, milliseconds);
+ }
+
+ /// <summary>
+ /// Constructor that sets the
+ /// Gregorian calendar type (
+ /// <see cref="T:System.Globalization.GregorianCalendarTypes"/>).
+ /// </summary>
+ /// <param name="type">The parameter specifies the Gregorian
+ /// calendar type.
+ /// </param>
+ public GregorianCalendar(GregorianCalendarTypes type) {
+ CalendarType = type;
+ M_AbbrEraNames = new string[] {"C.E."};
+ M_EraNames = new string[] {"Common Era"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 2029;
+ }
+
+ /// <summary>
+ /// Default constructor. Sets the Gregorian calendar type to
+ /// <see
+ /// cref="F:System.Globalization.GregorianCalendarTypes.Localized"/>.
+ /// </summary>
+ public GregorianCalendar() : this(GregorianCalendarTypes.Localized) {}
+} // class GregorianCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs b/mcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs
new file mode 100755
index 00000000000..2d571fdd13b
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/GregorianCalendarTypes.cs
@@ -0,0 +1,45 @@
+// GregorianCalendarTypes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:35:19 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Globalization {
+
+
+ /// <summary>
+ /// </summary>
+ public enum GregorianCalendarTypes {
+
+ /// <summary>
+ /// </summary>
+ Localized = 1,
+
+ /// <summary>
+ /// </summary>
+ USEnglish = 2,
+
+ /// <summary>
+ /// </summary>
+ MiddleEastFrench = 9,
+
+ /// <summary>
+ /// </summary>
+ Arabic = 10,
+
+ /// <summary>
+ /// </summary>
+ TransliteratedEnglish = 11,
+
+ /// <summary>
+ /// </summary>
+ TransliteratedFrench = 12,
+ } // GregorianCalendarTypes
+
+} // System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/HebrewCalendar.cs b/mcs/class/corlib/System.Globalization/HebrewCalendar.cs
new file mode 100644
index 00000000000..0162fd580bf
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/HebrewCalendar.cs
@@ -0,0 +1,861 @@
+// HebrewCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+using System.IO;
+
+/// <summary>
+/// This is the Hebrew calendar.
+/// </summary>
+/// <remarks>
+/// <para>The Hebrew calendar supports only years between 5343 A.M. and
+/// 6000 A.M. This has been done to be compatible with .NET.
+/// </para>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class HebrewCalendar : Calendar {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public HebrewCalendar() {
+ M_AbbrEraNames = new string[] {"A.M."};
+ M_EraNames = new string[] {"Anno Mundi"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 5790;
+ }
+
+ /// <summary>
+ /// The era number for the Anno Mundi (A.M.) era, called
+ /// plain HebrewEra.
+ /// </summary>
+ public static readonly int HebrewEra = 1;
+
+ /// <summary>
+ /// The
+ /// <see cref="T:System.DateTime"/> ticks for first day of year
+ /// 5343 A.M.
+ /// </summary>
+ internal const long M_MinTicks = 499147488000000000L;
+ /// <summary>
+ /// The number of
+ /// <see cref="T:System.DateTime"/> ticks for the last day of year
+ /// 6000 A.M.
+ /// </summary>
+ internal const long M_MaxTicks = 706783967999999999L;
+ /// <summary>
+ /// The minimum year in the A.M. era supported.
+ /// </summary>
+ internal const int M_MinYear = 5343;
+ /// <summary>
+ /// The maximum year supported in the A.M. era.
+ /// </summary>
+ internal override int M_MaxYear {
+ get { return 6000; }
+ }
+
+ /// <value>Overridden. Gives the eras supported by the Gregorian
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return new int[] { HebrewEra };
+ }
+ }
+
+ /// <summary>
+ /// A protected member checking a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/>
+ /// to check.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ internal void M_CheckDateTime(DateTime time) {
+ if (time.Ticks < M_MinTicks || time.Ticks > M_MaxTicks)
+ throw new ArgumentOutOfRangeException(
+ "time",
+ "Only hebrew years between 5343 and 6000," +
+ " inclusive, are supported.");
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HebrewEra"/>.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = HebrewEra;
+ if (era != HebrewEra)
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HebrewEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the allowed range.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckEra(ref era);
+ if (year < M_MinYear || year > M_MaxYear)
+ throw new ArgumentOutOfRangeException(
+ "year",
+ "Only hebrew years between 5343 and 6000," +
+ " inclusive, are supported.");
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HebrewEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYME(int year, int month, ref int era) {
+ M_CheckYE(year, ref era);
+ int l = CCHebrewCalendar.last_month_of_year(year);
+ if (month < 1 || month > l) {
+ StringWriter sw = new StringWriter();
+ sw.Write("Month must be between 1 and {0}.", l);
+ throw new ArgumentOutOfRangeException("month",
+ sw.ToString());
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HebrewEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYMDE(int year, int month, int day,
+ ref int era)
+ {
+ M_CheckYME(year, month, ref era);
+ M_ArgumentInRange("day", day, 1, GetDaysInMonth(year, month,
+ era));
+ }
+
+ /// <summary>
+ /// Overridden. Adds days to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// days.
+ /// </param>
+ /// <param name="days">The number of days to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="days"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddDays(DateTime time, int days) {
+ DateTime t = base.AddDays(time, days);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds hours to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// hours.
+ /// </param>
+ /// <param name="hours">The number of hours to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="hours"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddHours(DateTime time, int hours) {
+ DateTime t = base.AddHours(time, hours);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds milliseconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// milliseconds.
+ /// </param>
+ /// <param name="milliseconds">The number of milliseconds given as
+ /// double to add. Keep in mind the 100 nanosecond resolution of
+ /// <see cref="T:System.DateTime"/>.
+ /// </param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="milliseconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddMilliseconds(DateTime time,
+ double milliseconds)
+ {
+ DateTime t = base.AddMilliseconds(time, milliseconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds minutes to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// minutes.
+ /// </param>
+ /// <param name="minutes">The number of minutes to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="minutes"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddMinutes(DateTime time, int minutes) {
+ DateTime t = base.AddMinutes(time, minutes);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds seconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// seconds.
+ /// </param>
+ /// <param name="seconds">The number of seconds to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="seconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddSeconds(DateTime time, int seconds) {
+ DateTime t = base.AddSeconds(time, seconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds weeks to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// weeks.
+ /// </param>
+ /// <param name="weeks">The number of weeks to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="weeks"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddWeeks(DateTime time, int weeks) {
+ DateTime t = base.AddWeeks(time, weeks);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the hour of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the hour of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetHour(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetHour(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the milliseconds in the current second
+ /// of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the milliseconds in the seconds
+ /// of the specified time, starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override double GetMilliseconds(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMilliseconds(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the minute of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the minute of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetMinute(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the second of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the second of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetSecond(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddMonths(DateTime time, int months) {
+ int y, m, d;
+ DateTime t;
+
+ if (months == 0) {
+ t = time;
+ } else {
+ int rd = CCFixed.FromDateTime(time);
+ CCHebrewCalendar.dmy_from_fixed(
+ out d, out m, out y, rd);
+ m = M_Month(m, y);
+ if (months < 0) {
+ while (months < 0) {
+ if (m+months > 0) {
+ m += months;
+ months = 0;
+ } else {
+ months += m;
+ y -= 1;
+ m = GetMonthsInYear(y);
+ }
+ }
+ }
+ else {
+ while (months > 0) {
+ int my = GetMonthsInYear(y);
+ if (m+months <= my) {
+ m += months;
+ months = 0;
+ } else {
+ months -= my-m+1;
+ m = 1;
+ y += 1;
+ }
+ }
+ }
+ t = ToDateTime(y, m, d, 0, 0, 0, 0);
+ t = t.Add(time.TimeOfDay);
+ }
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DateTime AddYears(DateTime time, int years) {
+ int rd = CCFixed.FromDateTime(time);
+ int day, month, year;
+ CCHebrewCalendar.dmy_from_fixed(
+ out day, out month, out year, rd);
+ year += years;
+ rd = CCHebrewCalendar.fixed_from_dmy(day, month, year);
+ DateTime t = CCFixed.ToDateTime(rd);
+ t = t.Add(time.TimeOfDay);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetDayOfMonth(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ return CCHebrewCalendar.day_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetDayOfYear(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ int year = CCHebrewCalendar.year_from_fixed(rd);
+ int rd1_7 = CCHebrewCalendar.fixed_from_dmy(1, 7, year);
+ return rd - rd1_7 + 1;
+ }
+
+ /// <summary>
+ /// The method maps a .NET Hebrew month to a Calencdrical
+ /// Calculations Hebrew month.
+ /// </summary>
+ /// <param name="month">An integer representing a month in .NET
+ /// counting (starting with Tishri).
+ /// </param>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>The Hebrew month in Calendrical Calculations counting,
+ /// staring with the Hebrew month Nisan.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// In .NET the month counting starts with the Hebrew month Tishri.
+ /// Calendrical Calculations starts with the month Tisan. So we must
+ /// map here.
+ /// </para>
+ /// </remarks>
+ internal int M_CCMonth(int month, int year) {
+ if (month <= 6) {
+ return 6+month;
+ }
+ else {
+ int l = CCHebrewCalendar.last_month_of_year(year);
+ if (l == 12) {
+ return month-6;
+ }
+ else {
+ return month <= 7 ? 6+month : month-7;
+ }
+ }
+ }
+
+ /// <summary>
+ /// The method maps a Calendrical Calculations Hebrew month
+ /// to a .NET Hebrew month.
+ /// </summary>
+ /// <param name="ccmonth">An integer representing a month in
+ /// Calendrical Calculations counting, starting with Nisan.
+ /// </param>
+ /// <param name="year">An integer representing the Hebrew year.
+ /// </param>
+ /// <returns>The Hebrew month in .NET counting,
+ /// staring with the Hebrew month Tishri.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// In .NET the month counting starts with the Hebrew month Tishri.
+ /// Calendrical Calculations starts with the month Tisan. So we must
+ /// map here.
+ /// </para>
+ /// </remarks>
+ internal int M_Month(int ccmonth, int year) {
+ if (ccmonth >= 7) {
+ return ccmonth - 6;
+ } else {
+ int l = CCHebrewCalendar.last_month_of_year(year);
+ return ccmonth + (l == 12 ? 6 : 7);
+ }
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An integer that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ int ccmonth = M_CCMonth(month, year);
+ int rd1 = CCHebrewCalendar.fixed_from_dmy(1, ccmonth, year);
+ int rd2 = CCHebrewCalendar.fixed_from_dmy(1, ccmonth+1, year);
+ return rd2 - rd1;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> or <paramref name="era"/> are outside the
+ /// allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ int rd1 = CCHebrewCalendar.fixed_from_dmy(1, 7, year);
+ int rd2 = CCHebrewCalendar.fixed_from_dmy(1, 7, year+1);
+ return rd2 - rd1;
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetEra(DateTime time) {
+ M_CheckDateTime(time);
+ return HebrewEra;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetMonth(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ int ccmonth, year;
+ CCHebrewCalendar.my_from_fixed(out ccmonth, out year, rd);
+ return M_Month(ccmonth, year);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCHebrewCalendar.last_month_of_year(year);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the years
+ /// between 5343 A.M. and 6000 A.M., inclusive.
+ /// </exception>
+ public override int GetYear(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ return CCHebrewCalendar.year_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ /// <remarks>All days in Adar II are viewed as leap days and the
+ /// last day of Adar I.
+ /// </remarks>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ return IsLeapYear(year) &&
+ (month == 7 || (month == 6 && day == 30));
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ /// <remarks>
+ /// Adar II is viewed as leap month.
+ /// </remarks>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ return IsLeapYear(year) && month == 7;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCHebrewCalendar.is_leap_year(year);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ int ccm = M_CCMonth(month, year);
+ int rd = CCHebrewCalendar.fixed_from_dmy(day, ccm, year);
+ return CCFixed.ToDateTime(rd,
+ hour, minute, second, milliseconds);
+ }
+} // class HebrewCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/HijriCalendar.cs b/mcs/class/corlib/System.Globalization/HijriCalendar.cs
new file mode 100644
index 00000000000..9df3b005a3a
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/HijriCalendar.cs
@@ -0,0 +1,870 @@
+// HijriCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+using System.IO;
+
+/// <summary>
+/// This is the Hijri calendar which might be called Islamic calendar.
+/// </summary>
+/// <remarks>
+/// <para>The calendar supports only dates in the HijriEra starting with the
+/// epoch.
+/// </para>
+/// <para>
+/// The epoch of the Hijri Calendar might be adjusted by the
+/// <see cref="F:System.Globalization.HijriCalendar.AddHijriDate"/>
+/// property. See the discussion of the
+/// <see cref="F:CalendricalCalculations.HijriCalendar.epoch">
+/// epoch
+/// </see>
+/// of the Hijri calendar.
+/// </para>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class HijriCalendar : Calendar {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public HijriCalendar() {
+ M_AbbrEraNames = new string[] {"A.H."};
+ M_EraNames = new string[] {"Anno Hegirae"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 1451;
+ }
+
+ /// <summary>
+ /// The era number for the Anno Hegirae (A.H.) era.
+ /// </summary>
+ public static readonly int HijriEra = 1;
+
+ /// <summary>
+ /// The minimum fixed day number supported by the Hijri calendar.
+ /// </summary>
+ internal static readonly int M_MinFixed =
+ CCHijriCalendar.fixed_from_dmy(1, 1, 1);
+ /// <summary>
+ /// The maximum fixed day number supported by the Hijri calendar.
+ /// </summary>
+ internal static readonly int M_MaxFixed =
+ CCGregorianCalendar.fixed_from_dmy(31, 12, 9999);
+
+ /// <value>Overridden. Gives the eras supported by the Gregorian
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return new int[] { HijriEra };
+ }
+ }
+
+ /// <summary>
+ /// Protected field storing the
+ /// <see cref="F:AddHijriDate"/>.
+ /// </summary>
+ internal int M_AddHijriDate = 0;
+
+ // TODO: I don't know currently, which sign to use with the parameter.
+ /// <value>An integer property representing the adjustment to the epoch
+ /// of the Hijri calendar. Not supported by .NET.
+ /// </value>
+ public virtual int AddHijriDate {
+ get {
+ return M_AddHijriDate;
+ }
+ set {
+ if (value < -3 && value > 3)
+ throw new ArgumentOutOfRangeException(
+ "AddHijriDate",
+ "Value should be between -3 and 3.");
+ M_AddHijriDate = value;
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking an
+ /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
+ /// </summary>
+ /// <param name="param">A string giving the name of the parameter
+ /// to check.</param>
+ /// <param name="rdHijri">An integer giving the AddHijriDate adjusted
+ /// fixed day number.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// Exception is thrown, if the AddHijriDate adjusted fixed day
+ /// number is outside the supported range.
+ /// </exception>
+ internal void M_CheckFixedHijri(string param, int rdHijri) {
+ if (rdHijri < M_MinFixed || rdHijri > M_MaxFixed-AddHijriDate) {
+ StringWriter sw = new StringWriter();
+ int day, month, year;
+ CCHijriCalendar.dmy_from_fixed(out day, out month,
+ out year, M_MaxFixed-AddHijriDate);
+ if (AddHijriDate != 0) {
+ sw.Write("This HijriCalendar " +
+ "(AddHijriDate {0})" +
+ " allows dates from 1. 1. 1 to " +
+ "{1}. {2}. {3}.",
+ AddHijriDate,
+ day, month, year);
+ } else {
+ sw.Write("HijriCalendar allows dates from " +
+ "1.1.1 to {0}.{1}.{2}.",
+ day, month, year);
+ }
+ throw new ArgumentOutOfRangeException(param,
+ sw.ToString());
+ }
+ }
+
+ /// <summary>
+ /// A protected member checking a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/>
+ /// to check.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the supported
+ /// range of the Hijri calendar.
+ /// </exception>
+ internal void M_CheckDateTime(DateTime time) {
+ int rd = CCFixed.FromDateTime(time) - AddHijriDate;
+ M_CheckFixedHijri("time", rd);
+ }
+
+ /// <summary>
+ /// Protected member which computes the
+ /// <see cref="F:AddHijriDate"/>
+ /// adjusted fixed day number from a
+ /// <see cref="T:System.DateTime"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/>
+ /// to convert.
+ /// </param>
+ /// <returns>The
+ /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
+ /// </returns>
+ internal int M_FromDateTime(DateTime time) {
+ return CCFixed.FromDateTime(time) - AddHijriDate;
+ }
+
+ /// <summary>
+ /// Protected member which converts the
+ /// <see cref="F:AddHijriDate"/>
+ /// adjusted fixed day number the a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="rd">The
+ /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
+ /// </param>
+ /// <returns>The converted
+ /// <see cref="T:System.DateTime"/> value.
+ /// </returns>
+ internal DateTime M_ToDateTime(int rd) {
+ return CCFixed.ToDateTime(rd+AddHijriDate);
+ }
+
+ /// <summary>
+ /// Protected member which converts the
+ /// <see cref="F:AddHijriDate"/>
+ /// adjusted fixed day number the a
+ /// <see cref="T:System.DateTime"/> value using a number
+ /// of time parameters.
+ /// </summary>
+ /// <param name="date">The
+ /// <see cref="F:AddHijriDate"/> adjusted fixed day number.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <returns>The converted
+ /// <see cref="T:System.DateTime"/> value.
+ /// </returns>
+ internal DateTime M_ToDateTime(int date,
+ int hour, int minute, int second, int milliseconds)
+ {
+ return CCFixed.ToDateTime(date+AddHijriDate,
+ hour, minute, second, milliseconds);
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HijriEra"/>.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = HijriEra;
+ if (era != HijriEra)
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HijriEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the allowed range.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckEra(ref era);
+ M_ArgumentInRange("year", year, 1, 9666);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HijriEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYME(int year, int month, ref int era) {
+ M_CheckYE(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ if (year == 9666) {
+ int rd = CCHijriCalendar.fixed_from_dmy(1, month, year);
+ M_CheckFixedHijri("month", rd);
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="F:HijriEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYMDE(int year, int month, int day, ref int era)
+ {
+ M_CheckYME(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, HijriEra));
+ if (year == 9666) {
+ int rd = CCHijriCalendar.fixed_from_dmy(day, month,
+ year);
+ M_CheckFixedHijri("day", rd);
+ }
+ }
+
+ /// <summary>
+ /// Overridden. Adds days to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// days.
+ /// </param>
+ /// <param name="days">The number of days to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="days"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddDays(DateTime time, int days) {
+ DateTime t = base.AddDays(time, days);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds hours to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// hours.
+ /// </param>
+ /// <param name="hours">The number of hours to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="hours"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddHours(DateTime time, int hours) {
+ DateTime t = base.AddHours(time, hours);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds milliseconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// milliseconds.
+ /// </param>
+ /// <param name="milliseconds">The number of milliseconds given as
+ /// double to add. Keep in mind the 100 nanosecond resolution of
+ /// <see cref="T:System.DateTime"/>.
+ /// </param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="milliseconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddMilliseconds(DateTime time,
+ double milliseconds)
+ {
+ DateTime t = base.AddMilliseconds(time, milliseconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds minutes to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// minutes.
+ /// </param>
+ /// <param name="minutes">The number of minutes to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="minutes"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddMinutes(DateTime time, int minutes) {
+ DateTime t = base.AddMinutes(time, minutes);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds seconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// seconds.
+ /// </param>
+ /// <param name="seconds">The number of seconds to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="seconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddSeconds(DateTime time, int seconds) {
+ DateTime t = base.AddSeconds(time, seconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds weeks to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// weeks.
+ /// </param>
+ /// <param name="weeks">The number of weeks to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="weeks"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddWeeks(DateTime time, int weeks) {
+ DateTime t = base.AddWeeks(time, weeks);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the hour of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the hour of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetHour(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetHour(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the milliseconds in the current second
+ /// of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the milliseconds in the seconds
+ /// of the specified time, starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override double GetMilliseconds(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMilliseconds(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the minute of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the minute of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetMinute(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the second of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the second of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetSecond(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddMonths(DateTime time, int months) {
+ int rd = M_FromDateTime(time);
+ int day, month, year;
+ CCHijriCalendar.dmy_from_fixed(
+ out day, out month, out year, rd);
+ month += months;
+ year += CCMath.div_mod(out month, month, 12);
+ rd = CCHijriCalendar.fixed_from_dmy(day, month, year);
+ M_CheckFixedHijri("time", rd);
+ DateTime t = M_ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Overrideden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DateTime AddYears(DateTime time, int years) {
+ int rd = M_FromDateTime(time);
+ int day, month, year;
+ CCHijriCalendar.dmy_from_fixed(
+ out day, out month, out year, rd);
+ year += years;
+ rd = CCHijriCalendar.fixed_from_dmy(day, month, year);
+ M_CheckFixedHijri("time", rd);
+ DateTime t = M_ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetDayOfMonth(DateTime time) {
+ int rd = M_FromDateTime(time);
+ M_CheckFixedHijri("time", rd);
+ return CCHijriCalendar.day_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ int rd = M_FromDateTime(time);
+ M_CheckFixedHijri("time", rd);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetDayOfYear(DateTime time) {
+ int rd = M_FromDateTime(time);
+ M_CheckFixedHijri("time", rd);
+ int year = CCHijriCalendar.year_from_fixed(rd);
+ int rd1_1 = CCHijriCalendar.fixed_from_dmy(1, 1, year);
+ return rd - rd1_1 + 1;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An intger that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ int rd1 = CCHijriCalendar.fixed_from_dmy(1, month, year);
+ int rd2 = CCHijriCalendar.fixed_from_dmy(1, month+1, year);
+ return rd2 - rd1;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ int rd1 = CCHijriCalendar.fixed_from_dmy(1, 1, year);
+ int rd2 = CCHijriCalendar.fixed_from_dmy(1, 1, year+1);
+ return rd2 - rd1;
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetEra(DateTime time) {
+ M_CheckDateTime(time);
+ return HijriEra;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetMonth(DateTime time) {
+ int rd = M_FromDateTime(time);
+ M_CheckFixedHijri("time", rd);
+ return CCHijriCalendar.month_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is not in the
+ /// supported range of the Hijri calendar.
+ /// </exception>
+ public override int GetYear(DateTime time) {
+ int rd = M_FromDateTime(time);
+ M_CheckFixedHijri("time", rd);
+ return CCHijriCalendar.year_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ return IsLeapYear(year) && month == 12 && day == 30;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCHijriCalendar.is_leap_year(year);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ int rd = CCHijriCalendar.fixed_from_dmy(day, month, year);
+ return M_ToDateTime(rd,
+ hour, minute, second, milliseconds);
+ }
+} // class HijriCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/JapaneseCalendar.cs b/mcs/class/corlib/System.Globalization/JapaneseCalendar.cs
new file mode 100644
index 00000000000..52b994158f1
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/JapaneseCalendar.cs
@@ -0,0 +1,783 @@
+// JapaneseCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the Japanese calendar. It differs from the Gregorian calendar
+/// only in the years.
+/// </summary>
+/// <remarks>
+/// <para>The Japanese calendar support four eras.</para>
+/// <list type="table">
+/// <listheader>
+/// <term>era number</term>
+/// <term>Gregorian start date</term>
+/// <term>Gregorian end date</term>
+/// </listheader>
+/// <item>
+/// <term>1</term>
+/// <term>September 8, 1868</term>
+/// <term>July 29, 1912</term>
+/// </item>
+/// <item>
+/// <term>2</term>
+/// <term>July 30, 1912</term>
+/// <term>December 24, 1926</term>
+/// </item>
+/// <item>
+/// <term>3</term>
+/// <term>December 25, 1926</term>
+/// <term>January 7, 1989</term>
+/// </item>
+/// <item>
+/// <term>4</term>
+/// <term>January 8, 1989</term>
+/// <term>present</term>
+/// </item>
+/// </list>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class JapaneseCalendar : Calendar {
+ /// <summary>
+ /// Static protected field storing the
+ /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
+ /// </summary>
+ internal static readonly CCGregorianEraHandler M_EraHandler;
+
+ /// <summary>
+ /// Static constructor, who creates and initializes
+ /// <see cref="F:M_EraHandler"/>.
+ /// </summary>
+ static JapaneseCalendar() {
+ M_EraHandler = new CCGregorianEraHandler();
+ M_EraHandler.appendEra(1,
+ CCGregorianCalendar.fixed_from_dmy(8, 9, 1868),
+ CCGregorianCalendar.fixed_from_dmy(29, 7, 1912));
+ M_EraHandler.appendEra(2,
+ CCGregorianCalendar.fixed_from_dmy(30, 7, 1912),
+ CCGregorianCalendar.fixed_from_dmy(24, 12, 1926));
+ M_EraHandler.appendEra(3,
+ CCGregorianCalendar.fixed_from_dmy(25, 12, 1926),
+ CCGregorianCalendar.fixed_from_dmy(7, 1, 1989));
+ M_EraHandler.appendEra(4,
+ CCGregorianCalendar.fixed_from_dmy(8, 1, 1989));
+ }
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public JapaneseCalendar() {
+ M_AbbrEraNames = new string[] { "M", "T", "S", "H" };
+ M_EraNames = new string[] { "Meiji", "Taisho", "Showa",
+ "Heisei" };
+ }
+
+
+ /// <value>Overridden. Gives the eras supported by the
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return (int[])M_EraHandler.Eras.Clone();
+ }
+ }
+
+ /// <summary>
+ /// A protected member checking a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/>
+ /// to check.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ internal void M_CheckDateTime(DateTime time) {
+ M_EraHandler.CheckDateTime(time);
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number as reference. It is set
+ /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = 4;
+ if (!M_EraHandler.ValidEra(era))
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the supported range.
+ /// </exception>
+ internal int M_CheckYEG(int year, ref int era) {
+ M_CheckEra(ref era);
+ return M_EraHandler.GregorianYear(year, era);
+ }
+
+ /// <summary>
+ /// Checks whether the year is the era is valid, if era = CurrentEra
+ /// the right value is set.
+ /// </summary>
+ /// <param name="year">The year to check.</param>
+ /// <param name="era">The era to check.</Param>
+ /// <exception cref="T:ArgumentOutOfRangeException">
+ /// The exception will be thrown, if the year is not valid.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckYEG(year, ref era);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMEG(int year, int month, ref int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMDEG(int year, int month, int day, ref int era)
+ {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ M_ArgumentInRange("day", day, 1, GetDaysInMonth(year, month, era));
+ return gregorianYear;
+ }
+
+
+ /// <summary>
+ /// Overridden. Adds days to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// days.
+ /// </param>
+ /// <param name="days">The number of days to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="days"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddDays(DateTime time, int days) {
+ DateTime t = base.AddDays(time, days);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds hours to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// hours.
+ /// </param>
+ /// <param name="hours">The number of hours to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="hours"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddHours(DateTime time, int hours) {
+ DateTime t = base.AddHours(time, hours);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds milliseconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// milliseconds.
+ /// </param>
+ /// <param name="milliseconds">The number of milliseconds given as
+ /// double to add. Keep in mind the 100 nanosecond resolution of
+ /// <see cref="T:System.DateTime"/>.
+ /// </param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="milliseconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMilliseconds(DateTime time,
+ double milliseconds)
+ {
+ DateTime t = base.AddMilliseconds(time, milliseconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds minutes to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// minutes.
+ /// </param>
+ /// <param name="minutes">The number of minutes to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="minutes"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMinutes(DateTime time, int minutes) {
+ DateTime t = base.AddMinutes(time, minutes);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds seconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// seconds.
+ /// </param>
+ /// <param name="seconds">The number of seconds to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="seconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddSeconds(DateTime time, int seconds) {
+ DateTime t = base.AddSeconds(time, seconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+
+ /// <summary>
+ /// Overridden. Adds weeks to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// weeks.
+ /// </param>
+ /// <param name="weeks">The number of weeks to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="weeks"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddWeeks(DateTime time, int weeks) {
+ DateTime t = base.AddWeeks(time, weeks);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the hour of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the hour of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetHour(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetHour(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the milliseconds in the current second
+ /// of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the milliseconds in the seconds
+ /// of the specified time, starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override double GetMilliseconds(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMilliseconds(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the minute of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the minute of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetMinute(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the second of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the second of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetSecond(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMonths(DateTime time, int months) {
+ DateTime t = CCGregorianCalendar.AddMonths(time, months);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddYears(DateTime time, int years) {
+ DateTime t = CCGregorianCalendar.AddYears(time, years);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetDayOfMonth(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetDayOfMonth(time);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetDayOfYear(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetDayOfYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An integer that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> or <paramref name="era"/> are outside the
+ /// allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.GetDaysInYear(gregorianYear);
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetEra(DateTime time) {
+ // M_CheckDateTime not needed, because EraYear does the
+ // right thing.
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ M_EraHandler.EraYear(out era, rd);
+ return era;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetMonth(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetYear(DateTime time) {
+ // M_CheckDateTime not needed, because EraYeat does the
+ // right thing.
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ return M_EraHandler.EraYear(out era, rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYMEG(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.is_leap_year(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ return CCGregorianCalendar.ToDateTime(
+ gregorianYear, month, day,
+ hour, minute, second, milliseconds);
+ }
+
+
+ /// <summary>
+ /// This functions returns simply the year for the Japanese calendar.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <returns>The same argument as the year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the year is negative or the resulting
+ /// year is invalid.
+ /// </exception>
+ public override int ToFourDigitYear(int year) {
+ if (year < 0)
+ throw new ArgumentOutOfRangeException(
+ "year", "Non-negative number required.");
+ int era = CurrentEra;
+ M_CheckYE(year, ref era);
+ return year;
+ }
+} // class JapaneseCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/JulianCalendar.cs b/mcs/class/corlib/System.Globalization/JulianCalendar.cs
new file mode 100644
index 00000000000..8d1c98f21c7
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/JulianCalendar.cs
@@ -0,0 +1,443 @@
+// JulianCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the Julian calendar.
+/// </summary>
+/// <remarks>
+/// <para>The Julian calendar supports only the Common Era from
+/// January 1, 1 (Gregorian) to December 31, 9999 (Gregorian).
+/// </para>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class JulianCalendar : Calendar {
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public JulianCalendar() {
+ M_AbbrEraNames = new string[] {"C.E."};
+ M_EraNames = new string[] {"Common Era"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 2029;
+ }
+
+ /// <summary>
+ /// The era number for the Common Era (C.E.) or Anno Domini (A.D.)
+ /// respective.
+ /// </summary>
+ public static readonly int JulianEra = 1;
+
+ /// <value>Overridden. Gives the eras supported by the Julian
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return new int[] { JulianEra };
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:JulianEra"/>.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = JulianEra;
+ if (era != JulianEra)
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:JulianEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the allowed range.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckEra(ref era);
+ M_ArgumentInRange("year", year, 1, 9999);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:JulianEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYME(int year, int month, ref int era) {
+ M_CheckYE(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number.</param>
+ /// <exception cref="T:System.ArgumentException">
+ /// The exception is thrown if the era is not equal
+ /// <see cref="M:JulianEra"/>.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the allowed range.
+ /// </exception>
+ internal void M_CheckYMDE(int year, int month, int day, ref int era)
+ {
+ M_CheckYME(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, era));
+ if (year == 9999 && ((month == 10 && day > 19) || month > 10))
+ throw new ArgumentOutOfRangeException(
+ "The maximum Julian date is 19. 10. 9999.");
+ }
+
+ /// <summary>
+ /// Overridden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddMonths(DateTime time, int months) {
+ int rd = CCFixed.FromDateTime(time);
+ int day, month, year;
+ CCJulianCalendar.dmy_from_fixed(
+ out day, out month, out year, rd);
+ month += months;
+ rd = CCJulianCalendar.fixed_from_dmy(day, month, year);
+ DateTime t = CCFixed.ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddYears(DateTime time, int years) {
+ int rd = CCFixed.FromDateTime(time);
+ int day, month, year;
+ CCJulianCalendar.dmy_from_fixed(
+ out day, out month, out year, rd);
+ year += years;
+ rd = CCJulianCalendar.fixed_from_dmy(day, month, year);
+ DateTime t = CCFixed.ToDateTime(rd);
+ return t.Add(time.TimeOfDay);
+ }
+
+ /// <summary>
+ /// Overridden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override int GetDayOfMonth(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return CCJulianCalendar.day_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public override int GetDayOfYear(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int year = CCJulianCalendar.year_from_fixed(rd);
+ int rd1_1 = CCJulianCalendar.fixed_from_dmy(1, 1, year);
+ return rd - rd1_1 + 1;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An intger that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ int rd1 = CCJulianCalendar.fixed_from_dmy(1, month, year);
+ int rd2 = CCJulianCalendar.fixed_from_dmy(1, month+1, year);
+ return rd2 - rd1;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> is outside the allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ int rd1 = CCJulianCalendar.fixed_from_dmy(1, 1, year);
+ int rd2 = CCJulianCalendar.fixed_from_dmy(1, 1, year+1);
+ return rd2 - rd1;
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ public override int GetEra(DateTime time) {
+ // should change, if more than one era is supported
+ return JulianEra;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public override int GetMonth(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return CCJulianCalendar.month_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ public override int GetYear(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return CCJulianCalendar.year_from_fixed(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ return IsLeapYear(year) && month == 2 && day == 29;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYME(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return CCJulianCalendar.is_leap_year(year);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ M_CheckYMDE(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ int rd = CCJulianCalendar.fixed_from_dmy(day, month, year);
+ return CCFixed.ToDateTime(rd,
+ hour, minute, second, milliseconds);
+ }
+} // class JulianCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/KoreanCalendar.cs b/mcs/class/corlib/System.Globalization/KoreanCalendar.cs
new file mode 100644
index 00000000000..dd14c2a309a
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/KoreanCalendar.cs
@@ -0,0 +1,444 @@
+// KoreanCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the Korean calendar. It differs from the Gegorian calendar only
+/// in the year counting.
+/// </summary>
+/// <remarks>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class KoreanCalendar : Calendar {
+ /// <summary>
+ /// Static protected field storing the
+ /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
+ /// </summary>
+ internal static readonly CCGregorianEraHandler M_EraHandler;
+
+ /// <variable>
+ /// The standard era for the <see cref="T:KoreanCalendar"/>.
+ /// </variable>
+ public const int KoreanEra = 1;
+
+ /// <summary>
+ /// Static constructor, who creates and initializes
+ /// <see cref="F:M_EraHandler"/>.
+ /// </summary>
+ static KoreanCalendar() {
+ M_EraHandler = new CCGregorianEraHandler();
+ M_EraHandler.appendEra(KoreanEra,
+ CCGregorianCalendar.fixed_from_dmy(1, 1, -2332));
+ }
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public KoreanCalendar() {
+ M_AbbrEraNames = new string[] {"K.C.E."};
+ M_EraNames = new string[] {"Korean Current Era"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 4362;
+ }
+
+ /// <value>Overridden. Gives the eras supported by the
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return (int[])M_EraHandler.Eras.Clone();
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number as reference. It is set
+ /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = KoreanEra;
+ if (!M_EraHandler.ValidEra(era))
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the supported range.
+ /// </exception>
+ internal int M_CheckYEG(int year, ref int era) {
+ M_CheckEra(ref era);
+ return M_EraHandler.GregorianYear(year, era);
+ }
+
+ /// <summary>
+ /// Checks whether the year is the era is valid, if era = CurrentEra
+ /// the right value is set.
+ /// </summary>
+ /// <param name="year">The year to check.</param>
+ /// <param name="era">The era to check.</Param>
+ /// <exception cref="T:ArgumentOutOfRangeException">
+ /// The exception will be thrown, if the year is not valid.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckYEG(year, ref era);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMEG(int year, int month, ref int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMDEG(int year, int month, int day, ref int era)
+ {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, era));
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddMonths(DateTime time, int months) {
+ return CCGregorianCalendar.AddMonths(time, months);
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddYears(DateTime time, int years) {
+ return CCGregorianCalendar.AddYears(time, years);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override int GetDayOfMonth(DateTime time) {
+ return CCGregorianCalendar.GetDayOfMonth(time);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public override int GetDayOfYear(DateTime time) {
+ return CCGregorianCalendar.GetDayOfYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An integer that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> or <paramref name="era"/> are outside the
+ /// allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.GetDaysInYear(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ public override int GetEra(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ M_EraHandler.EraYear(out era, rd);
+ return era;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public override int GetMonth(DateTime time) {
+ return CCGregorianCalendar.GetMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYEG(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ public override int GetYear(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ return M_EraHandler.EraYear(out era, rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYMEG(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.is_leap_year(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ return CCGregorianCalendar.ToDateTime(gregorianYear,
+ month, day, hour, minute, second, milliseconds);
+ }
+} // class KoreanCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/Locale.cs b/mcs/class/corlib/System.Globalization/Locale.cs
new file mode 100755
index 00000000000..539184dbde4
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/Locale.cs
@@ -0,0 +1,22 @@
+//
+// System.Globalization.Locale.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.Globalization {
+
+ internal class Locale {
+
+ /// <summary>
+ /// Returns the translated message for the current locale
+ /// </summary>
+ public static string GetText (string msg)
+ {
+ return msg;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs b/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs
new file mode 100644
index 00000000000..64f4802308e
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs
@@ -0,0 +1,675 @@
+//
+// System.Globalization.NumberFormatInfo.cs
+//
+// Author:
+// Derek Holden (dholden@draper.com)
+// Bob Smith (bob@thestuff.net)
+//
+// (C) Derek Holden
+// (C) Bob Smith http://www.thestuff.net
+//
+
+//
+// NumberFormatInfo. One can only assume it is the class gotten
+// back from a GetFormat() method from an IFormatProvider /
+// IFormattable implementer. There are some discrepencies with the
+// ECMA spec and the SDK docs, surprisingly. See my conversation
+// with myself on it at:
+// http://lists.ximian.com/archives/public/mono-list/2001-July/000794.html
+//
+// Other than that this is totally ECMA compliant.
+//
+
+namespace System.Globalization {
+
+ [Serializable]
+ public sealed class NumberFormatInfo : ICloneable, IFormatProvider {
+ private bool readOnly;
+
+ // Currency Related Format Info
+ private int currencyDecimalDigits;
+ private string currencyDecimalSeparator;
+ private string currencyGroupSeparator;
+ private int[] currencyGroupSizes;
+ private int currencyNegativePattern;
+ private int currencyPositivePattern;
+ private string currencySymbol;
+
+ private string naNSymbol;
+ private string negativeInfinitySymbol;
+ private string negativeSign;
+
+ // Number Related Format Info
+ private int numberDecimalDigits;
+ private string numberDecimalSeparator;
+ private string numberGroupSeparator;
+ private int[] numberGroupSizes;
+ private int numberNegativePattern;
+
+ // Percent Related Format Info
+ private int percentDecimalDigits;
+ private string percentDecimalSeparator;
+ private string percentGroupSeparator;
+ private int[] percentGroupSizes;
+ private int percentNegativePattern;
+ private int percentPositivePattern;
+ private string percentSymbol;
+
+ private string perMilleSymbol;
+ private string positiveInfinitySymbol;
+ private string positiveSign;
+
+ internal NumberFormatInfo (int lcid)
+ {
+ //FIXME: should add more LCID
+ // CultureInfo uses this one also.
+ if (lcid != 0x007F)
+ lcid = 0x007F;
+
+ switch (lcid){
+
+ // The Invariant Culture Info ID.
+ case 0x007f:
+ readOnly = false;
+
+ // Currency Related Format Info
+ currencyDecimalDigits = 2;
+ currencyDecimalSeparator = ".";
+ currencyGroupSeparator = ",";
+ currencyGroupSizes = new int[1] { 3 };
+ currencyNegativePattern = 0;
+ currencyPositivePattern = 0;
+ currencySymbol = "$";
+
+ naNSymbol = "NaN";
+ negativeInfinitySymbol = "-Infinity";
+ negativeSign = "-";
+
+ // Number Related Format Info
+ numberDecimalDigits = 2;
+ numberDecimalSeparator = ".";
+ numberGroupSeparator = ",";
+ numberGroupSizes = new int[1] { 3 };
+ numberNegativePattern = 0;
+
+ // Percent Related Format Info
+ percentDecimalDigits = 2;
+ percentDecimalSeparator = ".";
+ percentGroupSeparator = ",";
+ percentGroupSizes = new int[1] { 3 };
+ percentNegativePattern = 0;
+ percentPositivePattern = 0;
+ percentSymbol= "%";
+
+ perMilleSymbol = "\u2030";
+ positiveInfinitySymbol = "Infinity";
+ positiveSign = "+";
+ break;
+ }
+ }
+
+ public NumberFormatInfo () : this (0x007f)
+ {
+ }
+
+ // =========== Currency Format Properties =========== //
+
+ public int CurrencyDecimalDigits {
+ get {
+ return currencyDecimalDigits;
+ }
+
+ set {
+ if (value < 0 || value > 99)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 99");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencyDecimalDigits = value;
+ }
+ }
+
+ public string CurrencyDecimalSeparator {
+ get {
+ return currencyDecimalSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencyDecimalSeparator = value;
+ }
+ }
+
+
+ public string CurrencyGroupSeparator {
+ get {
+ return currencyGroupSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencyGroupSeparator = value;
+ }
+ }
+
+ public int[] CurrencyGroupSizes {
+ get {
+ return currencyGroupSizes;
+ }
+
+ set {
+ if (value == null || value.Length == 0)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ // All elements except last need to be in range 1 - 9, last can be 0.
+ int last = value.Length - 1;
+
+ for (int i = 0; i < last; i++)
+ if (value[i] < 1 || value[i] > 9)
+ throw new ArgumentOutOfRangeException
+ ("One of the elements in the array specified is not between 1 and 9");
+
+ if (value[last] < 0 || value[last] > 9)
+ throw new ArgumentOutOfRangeException
+ ("Last element in the array specified is not between 0 and 9");
+
+ currencyGroupSizes = (int[]) value.Clone();
+ }
+ }
+
+ public int CurrencyNegativePattern {
+ get {
+ // See ECMA NumberFormatInfo page 8
+ return currencyNegativePattern;
+ }
+
+ set {
+ if (value < 0 || value > 15)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 15");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencyNegativePattern = value;
+ }
+ }
+
+ public int CurrencyPositivePattern {
+ get {
+ // See ECMA NumberFormatInfo page 11
+ return currencyPositivePattern;
+ }
+
+ set {
+ if (value < 0 || value > 3)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 3");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencyPositivePattern = value;
+ }
+ }
+
+ public string CurrencySymbol {
+ get {
+ return currencySymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ currencySymbol = value;
+ }
+ }
+
+ // =========== Static Read-Only Properties =========== //
+
+ public static NumberFormatInfo CurrentInfo {
+ get {
+ // This should be culture specific
+ NumberFormatInfo nfi = new NumberFormatInfo ();
+ nfi.readOnly = true;
+ return nfi;
+ }
+ }
+
+ public static NumberFormatInfo InvariantInfo {
+ get {
+ // This uses invariant info, which is same as in the constructor
+ NumberFormatInfo nfi = new NumberFormatInfo ();
+ nfi.readOnly = true;
+ return nfi;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return readOnly;
+ }
+ }
+
+
+
+ public string NaNSymbol {
+ get {
+ return naNSymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ naNSymbol = value;
+ }
+ }
+
+ public string NegativeInfinitySymbol {
+ get {
+ return negativeInfinitySymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ negativeInfinitySymbol = value;
+ }
+ }
+
+ public string NegativeSign {
+ get {
+ return negativeSign;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ negativeSign = value;
+ }
+ }
+
+ // =========== Number Format Properties =========== //
+
+ public int NumberDecimalDigits {
+ get {
+ return numberDecimalDigits;
+ }
+
+ set {
+ if (value < 0 || value > 99)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 99");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ numberDecimalDigits = value;
+ }
+ }
+
+ public string NumberDecimalSeparator {
+ get {
+ return numberDecimalSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ numberDecimalSeparator = value;
+ }
+ }
+
+
+ public string NumberGroupSeparator {
+ get {
+ return numberGroupSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ numberGroupSeparator = value;
+ }
+ }
+
+ public int[] NumberGroupSizes {
+ get {
+ return numberGroupSizes;
+ }
+
+ set {
+ if (value == null || value.Length == 0)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ // All elements except last need to be in range 1 - 9, last can be 0.
+ int last = value.Length - 1;
+
+ for (int i = 0; i < last; i++)
+ if (value[i] < 1 || value[i] > 9)
+ throw new ArgumentOutOfRangeException
+ ("One of the elements in the array specified is not between 1 and 9");
+
+ if (value[last] < 0 || value[last] > 9)
+ throw new ArgumentOutOfRangeException
+ ("Last element in the array specified is not between 0 and 9");
+
+ numberGroupSizes = (int[]) value.Clone();
+ }
+ }
+
+ public int NumberNegativePattern {
+ get {
+ // See ECMA NumberFormatInfo page 27
+ return numberNegativePattern;
+ }
+
+ set {
+ if (value < 0 || value > 4)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 15");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ numberNegativePattern = value;
+ }
+ }
+
+ // =========== Percent Format Properties =========== //
+
+ public int PercentDecimalDigits {
+ get {
+ return percentDecimalDigits;
+ }
+
+ set {
+ if (value < 0 || value > 99)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 99");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentDecimalDigits = value;
+ }
+ }
+
+ public string PercentDecimalSeparator {
+ get {
+ return percentDecimalSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentDecimalSeparator = value;
+ }
+ }
+
+
+ public string PercentGroupSeparator {
+ get {
+ return percentGroupSeparator;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentGroupSeparator = value;
+ }
+ }
+
+ public int[] PercentGroupSizes {
+ get {
+ return percentGroupSizes;
+ }
+
+ set {
+ if (value == null || value.Length == 0)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ // All elements except last need to be in range 1 - 9, last can be 0.
+ int last = value.Length - 1;
+
+ for (int i = 0; i < last; i++)
+ if (value[i] < 1 || value[i] > 9)
+ throw new ArgumentOutOfRangeException
+ ("One of the elements in the array specified is not between 1 and 9");
+
+ if (value[last] < 0 || value[last] > 9)
+ throw new ArgumentOutOfRangeException
+ ("Last element in the array specified is not between 0 and 9");
+
+ percentGroupSizes = (int[]) value.Clone();
+ }
+ }
+
+ public int PercentNegativePattern {
+ get {
+ // See ECMA NumberFormatInfo page 8
+ return percentNegativePattern;
+ }
+
+ set {
+ if (value < 0 || value > 2)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 15");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentNegativePattern = value;
+ }
+ }
+
+ public int PercentPositivePattern {
+ get {
+ // See ECMA NumberFormatInfo page 11
+ return percentPositivePattern;
+ }
+
+ set {
+ if (value < 0 || value > 2)
+ throw new ArgumentOutOfRangeException
+ ("The value specified for the property is less than 0 or greater than 3");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentPositivePattern = value;
+ }
+ }
+
+ public string PercentSymbol {
+ get {
+ return percentSymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ percentSymbol = value;
+ }
+ }
+
+ public string PerMilleSymbol {
+ get {
+ return perMilleSymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ perMilleSymbol = value;
+ }
+ }
+
+ public string PositiveInfinitySymbol {
+ get {
+ return positiveInfinitySymbol;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ positiveInfinitySymbol = value;
+ }
+ }
+
+ public string PositiveSign {
+ get {
+ return positiveSign;
+ }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException
+ ("The value specified for the property is a null reference");
+
+ if (readOnly)
+ throw new InvalidOperationException
+ ("The current instance is read-only and a set operation was attempted");
+
+ positiveSign = value;
+ }
+ }
+
+ public object GetFormat (Type formatType)
+ {
+ return (formatType == GetType()) ? this : null;
+ }
+
+ public object Clone ()
+ {
+ NumberFormatInfo clone = (NumberFormatInfo) MemberwiseClone();
+ // clone is not read only
+ clone.readOnly = false;
+ return clone;
+ }
+
+ public static NumberFormatInfo ReadOnly (NumberFormatInfo nfi)
+ {
+ NumberFormatInfo copy = (NumberFormatInfo)nfi.Clone();
+ copy.readOnly = true;
+ return copy;
+ }
+
+ public static NumberFormatInfo GetInstance(IFormatProvider provider)
+ {
+ if (provider != null) {
+ NumberFormatInfo nfi;
+ nfi = (NumberFormatInfo)provider.GetFormat(typeof(NumberFormatInfo));
+ if (nfi != null)
+ return nfi;
+ }
+
+ return CurrentInfo;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Globalization/NumberStyles.cs b/mcs/class/corlib/System.Globalization/NumberStyles.cs
new file mode 100644
index 00000000000..fbbccc86427
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/NumberStyles.cs
@@ -0,0 +1,46 @@
+//------------------------------------------------------------------------------
+//
+// System.Globalization.NumberStyles.cs
+//
+// Copyright (C) 2001 Michael Lambert, All Rights Reserved
+//
+// Author: Michael Lambert, michaellambert@email.com
+// Created: Thu 07/18/2001
+//
+// Modified: 7/20/01, Derek Holden (dholden@draper.com)
+// Added ECMA values for allows and masks for data types
+//
+//------------------------------------------------------------------------------
+
+namespace System.Globalization {
+
+ [Flags]
+ [Serializable]
+ public enum NumberStyles {
+ None = 0x00000000,
+ AllowLeadingWhite = 0x00000001,
+ AllowTrailingWhite = 0x00000002,
+ AllowLeadingSign = 0x00000004,
+ AllowTrailingSign = 0x00000008,
+ AllowParentheses = 0x00000010,
+ AllowDecimalPoint = 0x00000020,
+ AllowThousands = 0x00000040,
+ AllowExponent = 0x00000080,
+ AllowCurrencySymbol = 0x00000100,
+ AllowHexSpecifier = 0x00000200,
+
+ Integer = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign ),
+ HexNumber = ( AllowLeadingWhite | AllowTrailingWhite | AllowHexSpecifier ),
+ Number = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
+ AllowTrailingSign | AllowDecimalPoint | AllowThousands ),
+ Float = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
+ AllowDecimalPoint | AllowExponent ),
+ Currency = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
+ AllowTrailingSign | AllowParentheses | AllowDecimalPoint |
+ AllowThousands | AllowCurrencySymbol ),
+ Any = ( AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign |
+ AllowTrailingSign | AllowParentheses | AllowDecimalPoint |
+ AllowThousands | AllowExponent | AllowCurrencySymbol ),
+ }
+
+} // Namespace
diff --git a/mcs/class/corlib/System.Globalization/RegionInfo.cs b/mcs/class/corlib/System.Globalization/RegionInfo.cs
new file mode 100644
index 00000000000..c5b21ab4451
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/RegionInfo.cs
@@ -0,0 +1,1689 @@
+using System.Globalization;
+
+namespace System.Globalization {
+
+ [Serializable]
+ public class RegionInfo {
+ int NLS_id;
+
+ public RegionInfo (int culture) {
+
+ if (CultureInfo.IsIDNeutralCulture (culture))
+ throw new ArgumentException ("Culture ID " + culture
+ + " (0x" + culture.ToString ("X4")
+ + ") is a neutral culture. A region can not be created from it.");
+
+ switch (culture) {
+ case 0x0401: // ar-SA Arabic (Saudi Arabia)
+ NLS_id = 682;
+ break;
+ case 0x0801: // ar-IQ Arabic (Iraq)
+ NLS_id = 368;
+ break;
+ case 0x0C01: // ar-EG Arabic (Egypt)
+ NLS_id = 818;
+ break;
+ case 0x1001: // ar-LY Arabic (Libya)
+ NLS_id = 434;
+ break;
+ case 0x1401: // ar-DZ Arabic (Algeria)
+ NLS_id = 12;
+ break;
+ case 0x1801: // ar-MA Arabic (Morocco)
+ NLS_id = 504;
+ break;
+ case 0x1C01: // ar-TN Arabic (Tunisia)
+ NLS_id = 788;
+ break;
+ case 0x2001: // ar-OM Arabic (Oman)
+ NLS_id = 512;
+ break;
+ case 0x2401: // ar-YE Arabic (Yemen)
+ NLS_id = 887;
+ break;
+ case 0x2801: // ar-SY Arabic (Syria)
+ NLS_id = 760;
+ break;
+ case 0x2C01: // ar-JO Arabic (Jordan)
+ NLS_id = 400;
+ break;
+ case 0x3001: // ar-LB Arabic (Lebanon)
+ NLS_id = 422;
+ break;
+ case 0x3401: // ar-KW Arabic (Kuwait)
+ NLS_id = 414;
+ break;
+ case 0x3801: // ar-AE Arabic (U.A.E.)
+ NLS_id = 784;
+ break;
+ case 0x3C01: // ar-BH Arabic (Bahrain)
+ NLS_id = 48;
+ break;
+ case 0x4001: // ar-QA Arabic (Qatar)
+ NLS_id = 634;
+ break;
+ case 0x0402: // bg-BG Bulgarian (Bulgaria)
+ NLS_id = 100;
+ break;
+ case 0x0403: // ca-ES Catalan (Spain)
+ NLS_id = 724;
+ break;
+ case 0x0404: // zh-TW Chinese (Taiwan)
+ NLS_id = 158;
+ break;
+ case 0x0804: // zh-CN Chinese (People's Republic of China)
+ NLS_id = 156;
+ break;
+ case 0x0C04: // zh-HK Chinese (Hong Kong S.A.R.)
+ NLS_id = 344;
+ break;
+ case 0x1004: // zh-SG Chinese (Singapore)
+ NLS_id = 702;
+ break;
+ case 0x1404: // zh-MO Chinese (Macau S.A.R.)
+ NLS_id = 446;
+ break;
+ case 0x0405: // cs-CZ Czech (Czech Republic)
+ NLS_id = 203;
+ break;
+ case 0x0406: // da-DK Danish (Denmark)
+ NLS_id = 208;
+ break;
+ case 0x0407: // de-DE German (Germany)
+ NLS_id = 276;
+ break;
+ case 0x0807: // de-CH German (Switzerland)
+ NLS_id = 756;
+ break;
+ case 0x0C07: // de-AT German (Austria)
+ NLS_id = 40;
+ break;
+ case 0x1007: // de-LU German (Luxembourg)
+ NLS_id = 442;
+ break;
+ case 0x1407: // de-LI German (Liechtenstein)
+ NLS_id = 438;
+ break;
+ case 0x0408: // el-GR Greek (Greece)
+ NLS_id = 300;
+ break;
+ case 0x0409: // en-US English (United States)
+ NLS_id = 840;
+ break;
+ case 0x0809: // en-GB English (United Kingdom)
+ NLS_id = 826;
+ break;
+ case 0x0C09: // en-AU English (Australia)
+ NLS_id = 36;
+ break;
+ case 0x1009: // en-CA English (Canada)
+ NLS_id = 124;
+ break;
+ case 0x1409: // en-NZ English (New Zealand)
+ NLS_id = 554;
+ break;
+ case 0x1809: // en-IE English (Ireland)
+ NLS_id = 372;
+ break;
+ case 0x1C09: // en-ZA English (South Africa)
+ NLS_id = 710;
+ break;
+ case 0x2009: // en-JM English (Jamaica)
+ NLS_id = 388;
+ break;
+ case 0x2809: // en-BZ English (Belize)
+ NLS_id = 84;
+ break;
+ case 0x2C09: // en-TT English (Trinidad and Tobago)
+ NLS_id = 780;
+ break;
+ case 0x3009: // en-ZW English (Zimbabwe)
+ NLS_id = 716;
+ break;
+ case 0x3409: // en-PH English (Republic of the Philippines)
+ NLS_id = 608;
+ break;
+ case 0x080A: // es-MX Spanish (Mexico)
+ NLS_id = 484;
+ break;
+ case 0x0C0A: // es-ES Spanish (Spain)
+ NLS_id = 724;
+ break;
+ case 0x100A: // es-GT Spanish (Guatemala)
+ NLS_id = 320;
+ break;
+ case 0x140A: // es-CR Spanish (Costa Rica)
+ NLS_id = 188;
+ break;
+ case 0x180A: // es-PA Spanish (Panama)
+ NLS_id = 591;
+ break;
+ case 0x1C0A: // es-DO Spanish (Dominican Republic)
+ NLS_id = 214;
+ break;
+ case 0x200A: // es-VE Spanish (Venezuela)
+ NLS_id = 862;
+ break;
+ case 0x240A: // es-CO Spanish (Colombia)
+ NLS_id = 170;
+ break;
+ case 0x280A: // es-PE Spanish (Peru)
+ NLS_id = 604;
+ break;
+ case 0x2C0A: // es-AR Spanish (Argentina)
+ NLS_id = 32;
+ break;
+ case 0x300A: // es-EC Spanish (Ecuador)
+ NLS_id = 218;
+ break;
+ case 0x340A: // es-CL Spanish (Chile)
+ NLS_id = 152;
+ break;
+ case 0x380A: // es-UY Spanish (Uruguay)
+ NLS_id = 858;
+ break;
+ case 0x3C0A: // es-PY Spanish (Paraguay)
+ NLS_id = 600;
+ break;
+ case 0x400A: // es-BO Spanish (Bolivia)
+ NLS_id = 68;
+ break;
+ case 0x440A: // es-SV Spanish (El Salvador)
+ NLS_id = 222;
+ break;
+ case 0x480A: // es-HN Spanish (Honduras)
+ NLS_id = 340;
+ break;
+ case 0x4C0A: // es-NI Spanish (Nicaragua)
+ NLS_id = 558;
+ break;
+ case 0x500A: // es-PR Spanish (Puerto Rico)
+ NLS_id = 630;
+ break;
+ case 0x040B: // fi-FI Finnish (Finland)
+ NLS_id = 246;
+ break;
+ case 0x040C: // fr-FR French (France)
+ NLS_id = 250;
+ break;
+ case 0x080C: // fr-BE French (Belgium)
+ NLS_id = 56;
+ break;
+ case 0x0C0C: // fr-CA French (Canada)
+ NLS_id = 124;
+ break;
+ case 0x100C: // fr-CH French (Switzerland)
+ NLS_id = 756;
+ break;
+ case 0x140C: // fr-LU French (Luxembourg)
+ NLS_id = 442;
+ break;
+ case 0x180C: // fr-MC French (Principality of Monaco)
+ NLS_id = 492;
+ break;
+ case 0x040D: // he-IL Hebrew (Israel)
+ NLS_id = 376;
+ break;
+ case 0x040E: // hu-HU Hungarian (Hungary)
+ NLS_id = 348;
+ break;
+ case 0x040F: // is-IS Icelandic (Iceland)
+ NLS_id = 352;
+ break;
+ case 0x0410: // it-IT Italian (Italy)
+ NLS_id = 380;
+ break;
+ case 0x0810: // it-CH Italian (Switzerland)
+ NLS_id = 756;
+ break;
+ case 0x0411: // ja-JP Japanese (Japan)
+ NLS_id = 392;
+ break;
+ case 0x0412: // ko-KR Korean (Korea)
+ NLS_id = 410;
+ break;
+ case 0x0413: // nl-NL Dutch (Netherlands)
+ NLS_id = 528;
+ break;
+ case 0x0813: // nl-BE Dutch (Belgium)
+ NLS_id = 56;
+ break;
+ case 0x0414: // nb-NO Norwegian (Bokm†l) (Norway)
+ NLS_id = 578;
+ break;
+ case 0x0814: // nn-NO Norwegian (Nynorsk) (Norway)
+ NLS_id = 578;
+ break;
+ case 0x0415: // pl-PL Polish (Poland)
+ NLS_id = 616;
+ break;
+ case 0x0416: // pt-BR Portuguese (Brazil)
+ NLS_id = 76;
+ break;
+ case 0x0816: // pt-PT Portuguese (Portugal)
+ NLS_id = 620;
+ break;
+ case 0x0418: // ro-RO Romanian (Romania)
+ NLS_id = 642;
+ break;
+ case 0x0419: // ru-RU Russian (Russia)
+ NLS_id = 643;
+ break;
+ case 0x041A: // hr-HR Croatian (Croatia)
+ NLS_id = 191;
+ break;
+ case 0x041B: // sk-SK Slovak (Slovakia)
+ NLS_id = 703;
+ break;
+ case 0x041C: // sq-AL Albanian (Albania)
+ NLS_id = 8;
+ break;
+ case 0x041D: // sv-SE Swedish (Sweden)
+ NLS_id = 752;
+ break;
+ case 0x081D: // sv-FI Swedish (Finland)
+ NLS_id = 246;
+ break;
+ case 0x041E: // th-TH Thai (Thailand)
+ NLS_id = 764;
+ break;
+ case 0x041F: // tr-TR Turkish (Turkey)
+ NLS_id = 792;
+ break;
+ case 0x0420: // ur-PK Urdu (Islamic Republic of Pakistan)
+ NLS_id = 586;
+ break;
+ case 0x0421: // id-ID Indonesian (Indonesia)
+ NLS_id = 360;
+ break;
+ case 0x0422: // uk-UA Ukrainian (Ukraine)
+ NLS_id = 804;
+ break;
+ case 0x0423: // be-BY Belarusian (Belarus)
+ NLS_id = 112;
+ break;
+ case 0x0424: // sl-SI Slovenian (Slovenia)
+ NLS_id = 705;
+ break;
+ case 0x0425: // et-EE Estonian (Estonia)
+ NLS_id = 233;
+ break;
+ case 0x0426: // lv-LV Latvian (Latvia)
+ NLS_id = 428;
+ break;
+ case 0x0427: // lt-LT Lithuanian (Lithuania)
+ NLS_id = 440;
+ break;
+ case 0x0429: // fa-IR Farsi (Iran)
+ NLS_id = 364;
+ break;
+ case 0x042A: // vi-VN Vietnamese (Viet Nam)
+ NLS_id = 704;
+ break;
+ case 0x042B: // hy-AM Armenian (Armenia)
+ NLS_id = 51;
+ break;
+ case 0x042C: // Lt-az-AZ Azeri (Latin) (Azerbaijan)
+ NLS_id = 31;
+ break;
+ case 0x082C: // Cy-az-AZ Azeri (Cyrillic) (Azerbaijan)
+ NLS_id = 31;
+ break;
+ case 0x042D: // eu-ES Basque (Spain)
+ NLS_id = 724;
+ break;
+ case 0x042F: // mk-MK FYRO Macedonian (Former Yugoslav Republic of Macedonia)
+ NLS_id = 807;
+ break;
+ case 0x0436: // af-ZA Afrikaans (South Africa)
+ NLS_id = 710;
+ break;
+ case 0x0437: // ka-GE Georgian (Georgia)
+ NLS_id = 268;
+ break;
+ case 0x0438: // fo-FO Faeroese (Faeroe Islands)
+ NLS_id = 234;
+ break;
+ case 0x0439: // hi-IN Hindi (India)
+ NLS_id = 356;
+ break;
+ case 0x043E: // ms-MY Malay (Malaysia)
+ NLS_id = 458;
+ break;
+ case 0x083E: // ms-BN Malay (Brunei Darussalam)
+ NLS_id = 96;
+ break;
+ case 0x043F: // kk-KZ Kazakh (Kazakhstan)
+ NLS_id = 398;
+ break;
+ case 0x0440: // ky-KZ Kyrgyz (Kyrgyzstan)
+ NLS_id = 398;
+ break;
+ case 0x0441: // sw-KE Swahili (Kenya)
+ NLS_id = 404;
+ break;
+ case 0x0443: // Lt-uz-UZ Uzbek (Latin) (Uzbekistan)
+ NLS_id = 860;
+ break;
+ case 0x0843: // Cy-uz-UZ Uzbek (Cyrillic) (Uzbekistan)
+ NLS_id = 860;
+ break;
+ case 0x0446: // pa-IN Punjabi (India)
+ NLS_id = 356;
+ break;
+ case 0x0447: // gu-IN Gujarati (India)
+ NLS_id = 356;
+ break;
+ case 0x0449: // ta-IN Tamil (India)
+ NLS_id = 356;
+ break;
+ case 0x044A: // te-IN Telugu (India)
+ NLS_id = 356;
+ break;
+ case 0x044B: // kn-IN Kannada (India)
+ NLS_id = 356;
+ break;
+ case 0x044E: // mr-IN Marathi (India)
+ NLS_id = 356;
+ break;
+ case 0x044F: // sa-IN Sanskrit (India)
+ NLS_id = 356;
+ break;
+ case 0x0450: // mn-MN Mongolian (Mongolia)
+ NLS_id = 496;
+ break;
+ case 0x0456: // gl-ES Galician (Spain)
+ NLS_id = 724;
+ break;
+ case 0x0457: // kok-IN Konkani (India)
+ NLS_id = 356;
+ break;
+ case 0x045A: // syr-SY Syriac (Syria)
+ NLS_id = 760;
+ break;
+ case 0x0465: // div-MV Divehi (Maldives)
+ NLS_id = 462;
+ break;
+ case 0x007F: // Invariant Language (Invariant Country)
+ throw new ArgumentException ("There is no region associated with the Invariant Culture (Culture ID: 0x7F).");
+ default:
+ throw new ArgumentException ("Culture ID " + culture + " (0x" + culture.ToString ("X4")
+ + ") is not a supported culture.");
+ }
+ }
+
+ public RegionInfo (string name) {
+ switch (name.ToUpper ()) {
+ case "AF": // Afghanistan
+ NLS_id = 004;
+ break;
+ case "AL": // Albania
+ NLS_id = 008;
+ break;
+ case "DZ": // Algeria
+ NLS_id = 012;
+ break;
+ case "AS": // American Samoa
+ NLS_id = 016;
+ break;
+ case "AD": // Andorra
+ NLS_id = 020;
+ break;
+ case "AO": // Angola
+ NLS_id = 024;
+ break;
+ case "AI": // Anguilla
+ NLS_id = 660;
+ break;
+ case "AQ": // Antarctica
+ NLS_id = 010;
+ break;
+ case "AG": // Antigua and Barbuda
+ NLS_id = 028;
+ break;
+ case "AR": // Argentina
+ NLS_id = 032;
+ break;
+ case "AM": // Armenia
+ NLS_id = 051;
+ break;
+ case "AW": // Aruba
+ NLS_id = 533;
+ break;
+ case "AU": // Australia
+ NLS_id = 036;
+ break;
+ case "AT": // Austria
+ NLS_id = 040;
+ break;
+ case "AZ": // Azerbaijan
+ NLS_id = 031;
+ break;
+ case "BS": // Bahamas
+ NLS_id = 044;
+ break;
+ case "BH": // Bahrain
+ NLS_id = 048;
+ break;
+ case "BD": // Bangladesh
+ NLS_id = 050;
+ break;
+ case "BB": // Barbados
+ NLS_id = 052;
+ break;
+ case "BY": // Belarus
+ NLS_id = 112;
+ break;
+ case "BE": // Belgium
+ NLS_id = 056;
+ break;
+ case "BZ": // Belize
+ NLS_id = 084;
+ break;
+ case "BJ": // Benin
+ NLS_id = 204;
+ break;
+ case "BM": // Bermuda
+ NLS_id = 060;
+ break;
+ case "BT": // Bhutan
+ NLS_id = 064;
+ break;
+ case "BO": // Bolivia
+ NLS_id = 068;
+ break;
+ case "BA": // Bosnia and Herzegowina
+ NLS_id = 070;
+ break;
+ case "BW": // Botswana
+ NLS_id = 072;
+ break;
+ case "BV": // Bouvet Island
+ NLS_id = 074;
+ break;
+ case "BR": // Brazil
+ NLS_id = 076;
+ break;
+ case "IO": // British Indian Ocean Territory
+ NLS_id = 086;
+ break;
+ case "BN": // Brunei Darussalam
+ NLS_id = 096;
+ break;
+ case "BG": // Bulgaria
+ NLS_id = 100;
+ break;
+ case "BF": // Burkina Faso
+ NLS_id = 854;
+ break;
+ case "BI": // Burundi
+ NLS_id = 108;
+ break;
+ case "KH": // Cambodia
+ NLS_id = 116;
+ break;
+ case "CM": // Cameroon
+ NLS_id = 120;
+ break;
+ case "CA": // Canada
+ NLS_id = 124;
+ break;
+ case "CV": // Cape Verde
+ NLS_id = 132;
+ break;
+ case "KY": // Cayman Islands
+ NLS_id = 136;
+ break;
+ case "CF": // Central African Republic
+ NLS_id = 140;
+ break;
+ case "TD": // Chad
+ NLS_id = 148;
+ break;
+ case "CL": // Chile
+ NLS_id = 152;
+ break;
+ case "CN": // China
+ NLS_id = 156;
+ break;
+ case "CX": // Christmas Island
+ NLS_id = 162;
+ break;
+ case "CC": // Cocos (Keeling) Islands
+ NLS_id = 166;
+ break;
+ case "CO": // Colombia
+ NLS_id = 170;
+ break;
+ case "KM": // Comoros
+ NLS_id = 174;
+ break;
+ case "CG": // Congo
+ NLS_id = 178;
+ break;
+ case "CK": // Cook Islands
+ NLS_id = 184;
+ break;
+ case "CR": // Costa Rica
+ NLS_id = 188;
+ break;
+ case "CI": // Cote D'Ivoire
+ NLS_id = 384;
+ break;
+ case "HR": // Croatia (Local Name: Hrvatska)
+ NLS_id = 191;
+ break;
+ case "CU": // Cuba
+ NLS_id = 192;
+ break;
+ case "CY": // Cyprus
+ NLS_id = 196;
+ break;
+ case "CZ": // Czech Republic
+ NLS_id = 203;
+ break;
+ case "DK": // Denmark
+ NLS_id = 208;
+ break;
+ case "DJ": // Djibouti
+ NLS_id = 262;
+ break;
+ case "DM": // Dominica
+ NLS_id = 212;
+ break;
+ case "DO": // Dominican Republic
+ NLS_id = 214;
+ break;
+ case "TP": // East Timor
+ NLS_id = 626;
+ break;
+ case "EC": // Ecuador
+ NLS_id = 218;
+ break;
+ case "EG": // Egypt
+ NLS_id = 818;
+ break;
+ case "SV": // El Salvador
+ NLS_id = 222;
+ break;
+ case "GQ": // Equatorial Guinea
+ NLS_id = 226;
+ break;
+ case "ER": // Eritrea
+ NLS_id = 232;
+ break;
+ case "EE": // Estonia
+ NLS_id = 233;
+ break;
+ case "ET": // Ethiopia
+ NLS_id = 231;
+ break;
+ case "FK": // Falkland Islands (Malvinas)
+ NLS_id = 238;
+ break;
+ case "FO": // Faroe Islands
+ NLS_id = 234;
+ break;
+ case "FJ": // Fiji
+ NLS_id = 242;
+ break;
+ case "FI": // Finland
+ NLS_id = 246;
+ break;
+ case "FR": // France
+ NLS_id = 250;
+ break;
+ case "FX": // France, Metropolitan
+ NLS_id = 249;
+ break;
+ case "GF": // French Guiana
+ NLS_id = 254;
+ break;
+ case "PF": // French Polynesia
+ NLS_id = 258;
+ break;
+ case "TF": // French Southern Territories
+ NLS_id = 260;
+ break;
+ case "GA": // Gabon
+ NLS_id = 266;
+ break;
+ case "GM": // Gambia
+ NLS_id = 270;
+ break;
+ case "GE": // Georgia
+ NLS_id = 268;
+ break;
+ case "DE": // Germany
+ NLS_id = 276;
+ break;
+ case "GH": // Ghana
+ NLS_id = 288;
+ break;
+ case "GI": // Gibraltar
+ NLS_id = 292;
+ break;
+ case "GR": // Greece
+ NLS_id = 300;
+ break;
+ case "GL": // Greenland
+ NLS_id = 304;
+ break;
+ case "GD": // Grenada
+ NLS_id = 308;
+ break;
+ case "GP": // Guadeloupe
+ NLS_id = 312;
+ break;
+ case "GU": // Guam
+ NLS_id = 316;
+ break;
+ case "GT": // Guatemala
+ NLS_id = 320;
+ break;
+ case "GN": // Guinea
+ NLS_id = 324;
+ break;
+ case "GW": // Guinea-Bissau
+ NLS_id = 624;
+ break;
+ case "GY": // Guyana
+ NLS_id = 328;
+ break;
+ case "HT": // Haiti
+ NLS_id = 332;
+ break;
+ case "HM": // Heard and Mc Donald Islands
+ NLS_id = 334;
+ break;
+ case "VA": // Holy See (Vatican City State)
+ NLS_id = 336;
+ break;
+ case "HN": // Honduras
+ NLS_id = 340;
+ break;
+ case "HK": // Hong Kong
+ NLS_id = 344;
+ break;
+ case "HU": // Hungary
+ NLS_id = 348;
+ break;
+ case "IS": // Iceland
+ NLS_id = 352;
+ break;
+ case "IN": // India
+ NLS_id = 356;
+ break;
+ case "ID": // Indonesia
+ NLS_id = 360;
+ break;
+ case "IR": // Iran (Islamic Republic of)
+ NLS_id = 364;
+ break;
+ case "IQ": // Iraq
+ NLS_id = 368;
+ break;
+ case "IE": // Ireland
+ NLS_id = 372;
+ break;
+ case "IL": // Israel
+ NLS_id = 376;
+ break;
+ case "IT": // Italy
+ NLS_id = 380;
+ break;
+ case "JM": // Jamaica
+ NLS_id = 388;
+ break;
+ case "JP": // Japan
+ NLS_id = 392;
+ break;
+ case "JO": // Jordan
+ NLS_id = 400;
+ break;
+ case "KZ": // Kazakhstan
+ NLS_id = 398;
+ break;
+ case "KE": // Kenya
+ NLS_id = 404;
+ break;
+ case "KI": // Kiribati
+ NLS_id = 296;
+ break;
+ case "KP": // Korea, Democratic People's Republic of
+ NLS_id = 408;
+ break;
+ case "KR": // Korea, Republic of
+ NLS_id = 410;
+ break;
+ case "KW": // Kuwait
+ NLS_id = 414;
+ break;
+ case "KG": // Kyrgyzstan
+ NLS_id = 417;
+ break;
+ case "LA": // Lao People's Democratic Republic
+ NLS_id = 418;
+ break;
+ case "LV": // Latvia
+ NLS_id = 428;
+ break;
+ case "LB": // Lebanon
+ NLS_id = 422;
+ break;
+ case "LS": // Lesotho
+ NLS_id = 426;
+ break;
+ case "LR": // Liberia
+ NLS_id = 430;
+ break;
+ case "LY": // Libyan Arab Jamahiriya
+ NLS_id = 434;
+ break;
+ case "LI": // Liechtenstein
+ NLS_id = 438;
+ break;
+ case "LT": // Lithuania
+ NLS_id = 440;
+ break;
+ case "LU": // Luxembourg
+ NLS_id = 442;
+ break;
+ case "MO": // Macau
+ NLS_id = 446;
+ break;
+ case "MK": // Macedonia, The Former Yugoslav Republic of
+ NLS_id = 807;
+ break;
+ case "MG": // Madagascar
+ NLS_id = 450;
+ break;
+ case "MW": // Malawi
+ NLS_id = 454;
+ break;
+ case "MY": // Malaysia
+ NLS_id = 458;
+ break;
+ case "MV": // Maldives
+ NLS_id = 462;
+ break;
+ case "ML": // Mali
+ NLS_id = 466;
+ break;
+ case "MT": // Malta
+ NLS_id = 470;
+ break;
+ case "MH": // Marshall Islands
+ NLS_id = 584;
+ break;
+ case "MQ": // Martinique
+ NLS_id = 474;
+ break;
+ case "MR": // Mauritania
+ NLS_id = 478;
+ break;
+ case "MU": // Mauritius
+ NLS_id = 480;
+ break;
+ case "YT": // Mayotte
+ NLS_id = 175;
+ break;
+ case "MX": // Mexico
+ NLS_id = 484;
+ break;
+ case "FM": // Micronesia, Federated States of
+ NLS_id = 583;
+ break;
+ case "MD": // Moldova, Republic of
+ NLS_id = 498;
+ break;
+ case "MC": // Monaco
+ NLS_id = 492;
+ break;
+ case "MN": // Mongolia
+ NLS_id = 496;
+ break;
+ case "MS": // Montserrat
+ NLS_id = 500;
+ break;
+ case "MA": // Morocco
+ NLS_id = 504;
+ break;
+ case "MZ": // Mozambique
+ NLS_id = 508;
+ break;
+ case "MM": // Myanmar
+ NLS_id = 104;
+ break;
+ case "NA": // Namibia
+ NLS_id = 516;
+ break;
+ case "NR": // Nauru
+ NLS_id = 520;
+ break;
+ case "NP": // Nepal
+ NLS_id = 524;
+ break;
+ case "NL": // Netherlands
+ NLS_id = 528;
+ break;
+ case "AN": // Netherlands Antilles
+ NLS_id = 530;
+ break;
+ case "NC": // New Caledonia
+ NLS_id = 540;
+ break;
+ case "NZ": // New Zealand
+ NLS_id = 554;
+ break;
+ case "NI": // Nicaragua
+ NLS_id = 558;
+ break;
+ case "NE": // Niger
+ NLS_id = 562;
+ break;
+ case "NG": // Nigeria
+ NLS_id = 566;
+ break;
+ case "NU": // Niue
+ NLS_id = 570;
+ break;
+ case "NF": // Norfolk Island
+ NLS_id = 574;
+ break;
+ case "MP": // Northern Mariana Islands
+ NLS_id = 580;
+ break;
+ case "NO": // Norway
+ NLS_id = 578;
+ break;
+ case "OM": // Oman
+ NLS_id = 512;
+ break;
+ case "PK": // Pakistan
+ NLS_id = 586;
+ break;
+ case "PW": // Palau
+ NLS_id = 585;
+ break;
+ case "PA": // Panama
+ NLS_id = 591;
+ break;
+ case "PG": // Papua New Guinea
+ NLS_id = 598;
+ break;
+ case "PY": // Paraguay
+ NLS_id = 600;
+ break;
+ case "PE": // Peru
+ NLS_id = 604;
+ break;
+ case "PH": // Philippines
+ NLS_id = 608;
+ break;
+ case "PN": // Pitcairn
+ NLS_id = 612;
+ break;
+ case "PL": // Poland
+ NLS_id = 616;
+ break;
+ case "PT": // Portugal
+ NLS_id = 620;
+ break;
+ case "PR": // Puerto Rico
+ NLS_id = 630;
+ break;
+ case "QA": // Qatar
+ NLS_id = 634;
+ break;
+ case "RE": // Reunion
+ NLS_id = 638;
+ break;
+ case "RO": // Romania
+ NLS_id = 642;
+ break;
+ case "RU": // Russian Federation
+ NLS_id = 643;
+ break;
+ case "RW": // Rwanda
+ NLS_id = 646;
+ break;
+ case "KN": // Saint Kitts and Nevis
+ NLS_id = 659;
+ break;
+ case "LC": // Saint Lucia
+ NLS_id = 662;
+ break;
+ case "VC": // Saint Vincent and The Grenadines
+ NLS_id = 670;
+ break;
+ case "WS": // Samoa
+ NLS_id = 882;
+ break;
+ case "SM": // San Marino
+ NLS_id = 674;
+ break;
+ case "ST": // Sao Tome and Principe
+ NLS_id = 678;
+ break;
+ case "SA": // Saudi Arabia
+ NLS_id = 682;
+ break;
+ case "SN": // Senegal
+ NLS_id = 686;
+ break;
+ case "SC": // Seychelles
+ NLS_id = 690;
+ break;
+ case "SL": // Sierra Leone
+ NLS_id = 694;
+ break;
+ case "SG": // Singapore
+ NLS_id = 702;
+ break;
+ case "SK": // Slovakia (Slovak Republic)
+ NLS_id = 703;
+ break;
+ case "SI": // Slovenia
+ NLS_id = 705;
+ break;
+ case "SB": // Solomon Islands
+ NLS_id = 090;
+ break;
+ case "SO": // Somalia
+ NLS_id = 706;
+ break;
+ case "ZA": // South Africa
+ NLS_id = 710;
+ break;
+ case "GS": // South Georgia and The South Sandwich Islands
+ NLS_id = 239;
+ break;
+ case "ES": // Spain
+ NLS_id = 724;
+ break;
+ case "LK": // Sri Lanka
+ NLS_id = 144;
+ break;
+ case "SH": // St. Helena
+ NLS_id = 654;
+ break;
+ case "PM": // St. Pierre and Miquelon
+ NLS_id = 666;
+ break;
+ case "SD": // Sudan
+ NLS_id = 736;
+ break;
+ case "SR": // Suriname
+ NLS_id = 740;
+ break;
+ case "SJ": // Svalbard and Jan Mayen Islands
+ NLS_id = 744;
+ break;
+ case "SZ": // Swaziland
+ NLS_id = 748;
+ break;
+ case "SE": // Sweden
+ NLS_id = 752;
+ break;
+ case "CH": // Switzerland
+ NLS_id = 756;
+ break;
+ case "SY": // Syrian Arab Republic
+ NLS_id = 760;
+ break;
+ case "TW": // Taiwan, Province of China
+ NLS_id = 158;
+ break;
+ case "TJ": // Tajikistan
+ NLS_id = 762;
+ break;
+ case "TZ": // Tanzania, United Republic of
+ NLS_id = 834;
+ break;
+ case "TH": // Thailand
+ NLS_id = 764;
+ break;
+ case "TG": // Togo
+ NLS_id = 768;
+ break;
+ case "TK": // Tokelau
+ NLS_id = 772;
+ break;
+ case "TO": // Tonga
+ NLS_id = 776;
+ break;
+ case "TT": // Trinidad and Tobago
+ NLS_id = 780;
+ break;
+ case "TN": // Tunisia
+ NLS_id = 788;
+ break;
+ case "TR": // Turkey
+ NLS_id = 792;
+ break;
+ case "TM": // Turkmenistan
+ NLS_id = 795;
+ break;
+ case "TC": // Turks and Caicos Islands
+ NLS_id = 796;
+ break;
+ case "TV": // Tuvalu
+ NLS_id = 798;
+ break;
+ case "UG": // Uganda
+ NLS_id = 800;
+ break;
+ case "UA": // Ukraine
+ NLS_id = 804;
+ break;
+ case "AE": // United Arab Emirates
+ NLS_id = 784;
+ break;
+ case "GB": // United Kingdom
+ NLS_id = 826;
+ break;
+ case "US": // United States
+ NLS_id = 840;
+ break;
+ case "UM": // United States Minor Outlying Islands
+ NLS_id = 581;
+ break;
+ case "UY": // Uruguay
+ NLS_id = 858;
+ break;
+ case "UZ": // Uzbekistan
+ NLS_id = 860;
+ break;
+ case "VU": // Vanuatu
+ NLS_id = 548;
+ break;
+ case "VE": // Venezuela
+ NLS_id = 862;
+ break;
+ case "VN": // Viet Nam
+ NLS_id = 704;
+ break;
+ case "VG": // Virgin Islands (British)
+ NLS_id = 092;
+ break;
+ case "VI": // Virgin Islands (U.S.)
+ NLS_id = 850;
+ break;
+ case "WF": // Wallis and Futuna Islands
+ NLS_id = 876;
+ break;
+ case "EH": // Western Sahara
+ NLS_id = 732;
+ break;
+ case "YE": // Yemen
+ NLS_id = 887;
+ break;
+ case "YU": // Yugoslavia
+ NLS_id = 891;
+ break;
+ case "ZR": // Zaire
+ NLS_id = 180;
+ break;
+ case "ZM": // Zambia
+ NLS_id = 894;
+ break;
+ case "ZW": // Zimbabwe
+ NLS_id = 716;
+ break;
+ default:
+ throw new ArgumentException ("Region name " + name + " is not supported.");
+ }
+ }
+
+ public virtual string CurrencySymbol {
+ get {
+ switch (NLS_id) {
+ default:
+ throw new Exception ("Dunno what is currency symbol for " + NLS_id + " Region. FIXME.");
+ }
+ }
+ }
+
+ [MonoTODO]
+ public static RegionInfo CurrentRegion {
+ get {
+ return null;
+ }
+ }
+
+ public virtual string DisplayName {
+ get {
+ switch (NLS_id) {
+ case 203: // Czech republic
+ return "Èeská republika";
+ case 840: // United States
+ return "United States";
+ default:
+ throw new Exception ("FIXME. Please add your region name in language used in this region.");
+ }
+ }
+ }
+
+ public virtual string EnglishName {
+ get {
+ switch (NLS_id) {
+ case 004:
+ return "Afghanistan";
+ case 008:
+ return "Albania";
+ case 012:
+ return "Algeria";
+ case 016:
+ return "American Samoa";
+ case 020:
+ return "Andorra";
+ case 024:
+ return "Angola";
+ case 660:
+ return "Anguilla";
+ case 010:
+ return "Antarctica";
+ case 028:
+ return "Antigua and Barbuda";
+ case 032:
+ return "Argentina";
+ case 051:
+ return "Armenia";
+ case 533:
+ return "Aruba";
+ case 036:
+ return "Australia";
+ case 040:
+ return "Austria";
+ case 031:
+ return "Azerbaijan";
+ case 044:
+ return "Bahamas";
+ case 048:
+ return "Bahrain";
+ case 050:
+ return "Bangladesh";
+ case 052:
+ return "Barbados";
+ case 112:
+ return "Belarus";
+ case 056:
+ return "Belgium";
+ case 084:
+ return "Belize";
+ case 204:
+ return "Benin";
+ case 060:
+ return "Bermuda";
+ case 064:
+ return "Bhutan";
+ case 068:
+ return "Bolivia";
+ case 070:
+ return "Bosnia and Herzegowina";
+ case 072:
+ return "Botswana";
+ case 074:
+ return "Bouvet Island";
+ case 076:
+ return "Brazil";
+ case 086:
+ return "British Indian Ocean Territory";
+ case 096:
+ return "Brunei Darussalam";
+ case 100:
+ return "Bulgaria";
+ case 854:
+ return "Burkina Faso";
+ case 108:
+ return "Burundi";
+ case 116:
+ return "Cambodia";
+ case 120:
+ return "Cameroon";
+ case 124:
+ return "Canada";
+ case 132:
+ return "Cape Verde";
+ case 136:
+ return "Cayman Islands";
+ case 140:
+ return "Central African Republic";
+ case 148:
+ return "Chad";
+ case 152:
+ return "Chile";
+ case 156:
+ return "China";
+ case 162:
+ return "Christmas Island";
+ case 166:
+ return "Cocos (Keeling) Islands";
+ case 170:
+ return "Colombia";
+ case 174:
+ return "Comoros";
+ case 178:
+ return "Congo";
+ case 184:
+ return "Cook Islands";
+ case 188:
+ return "Costa Rica";
+ case 384:
+ return "Cote D'Ivoire";
+ case 191:
+ return "Croatia (Local Name: Hrvatska)";
+ case 192:
+ return "Cuba";
+ case 196:
+ return "Cyprus";
+ case 203:
+ return "Czech Republic";
+ case 208:
+ return "Denmark";
+ case 262:
+ return "Djibouti";
+ case 212:
+ return "Dominica";
+ case 214:
+ return "Dominican Republic";
+ case 626:
+ return "East Timor";
+ case 218:
+ return "Ecuador";
+ case 818:
+ return "Egypt";
+ case 222:
+ return "El Salvador";
+ case 226:
+ return "Equatorial Guinea";
+ case 232:
+ return "Eritrea";
+ case 233:
+ return "Estonia";
+ case 231:
+ return "Ethiopia";
+ case 238:
+ return "Falkland Islands (Malvinas)";
+ case 234:
+ return "Faroe Islands";
+ case 242:
+ return "Fiji";
+ case 246:
+ return "Finland";
+ case 250:
+ return "France";
+ case 249:
+ return "France, Metropolitan";
+ case 254:
+ return "French Guiana";
+ case 258:
+ return "French Polynesia";
+ case 260:
+ return "French Southern Territories";
+ case 266:
+ return "Gabon";
+ case 270:
+ return "Gambia";
+ case 268:
+ return "Georgia";
+ case 276:
+ return "Germany";
+ case 288:
+ return "Ghana";
+ case 292:
+ return "Gibraltar";
+ case 300:
+ return "Greece";
+ case 304:
+ return "Greenland";
+ case 308:
+ return "Grenada";
+ case 312:
+ return "Guadeloupe";
+ case 316:
+ return "Guam";
+ case 320:
+ return "Guatemala";
+ case 324:
+ return "Guinea";
+ case 624:
+ return "Guinea-Bissau";
+ case 328:
+ return "Guyana";
+ case 332:
+ return "Haiti";
+ case 334:
+ return "Heard and Mc Donald Islands";
+ case 336:
+ return "Holy See (Vatican City State)";
+ case 340:
+ return "Honduras";
+ case 344:
+ return "Hong Kong";
+ case 348:
+ return "Hungary";
+ case 352:
+ return "Iceland";
+ case 356:
+ return "India";
+ case 360:
+ return "Indonesia";
+ case 364:
+ return "Iran (Islamic Republic of)";
+ case 368:
+ return "Iraq";
+ case 372:
+ return "Ireland";
+ case 376:
+ return "Israel";
+ case 380:
+ return "Italy";
+ case 388:
+ return "Jamaica";
+ case 392:
+ return "Japan";
+ case 400:
+ return "Jordan";
+ case 398:
+ return "Kazakhstan";
+ case 404:
+ return "Kenya";
+ case 296:
+ return "Kiribati";
+ case 408:
+ return "Korea, Democratic People's Republic of";
+ case 410:
+ return "Korea, Republic of";
+ case 414:
+ return "Kuwait";
+ case 417:
+ return "Kyrgyzstan";
+ case 418:
+ return "Lao People's Democratic Republic";
+ case 428:
+ return "Latvia";
+ case 422:
+ return "Lebanon";
+ case 426:
+ return "Lesotho";
+ case 430:
+ return "Liberia";
+ case 434:
+ return "Libyan Arab Jamahiriya";
+ case 438:
+ return "Liechtenstein";
+ case 440:
+ return "Lithuania";
+ case 442:
+ return "Luxembourg";
+ case 446:
+ return "Macau";
+ case 807:
+ return "Macedonia, The Former Yugoslav Republic of";
+ case 450:
+ return "Madagascar";
+ case 454:
+ return "Malawi";
+ case 458:
+ return "Malaysia";
+ case 462:
+ return "Maldives";
+ case 466:
+ return "Mali";
+ case 470:
+ return "Malta";
+ case 584:
+ return "Marshall Islands";
+ case 474:
+ return "Martinique";
+ case 478:
+ return "Mauritania";
+ case 480:
+ return "Mauritius";
+ case 175:
+ return "Mayotte";
+ case 484:
+ return "Mexico";
+ case 583:
+ return "Micronesia, Federated States of";
+ case 498:
+ return "Moldova, Republic of";
+ case 492:
+ return "Monaco";
+ case 496:
+ return "Mongolia";
+ case 500:
+ return "Montserrat";
+ case 504:
+ return "Morocco";
+ case 508:
+ return "Mozambique";
+ case 104:
+ return "Myanmar";
+ case 516:
+ return "Namibia";
+ case 520:
+ return "Nauru";
+ case 524:
+ return "Nepal";
+ case 528:
+ return "Netherlands";
+ case 530:
+ return "Netherlands Antilles";
+ case 540:
+ return "New Caledonia";
+ case 554:
+ return "New Zealand";
+ case 558:
+ return "Nicaragua";
+ case 562:
+ return "Niger";
+ case 566:
+ return "Nigeria";
+ case 570:
+ return "Niue";
+ case 574:
+ return "Norfolk Island";
+ case 580:
+ return "Northern Mariana Islands";
+ case 578:
+ return "Norway";
+ case 512:
+ return "Oman";
+ case 586:
+ return "Pakistan";
+ case 585:
+ return "Palau";
+ case 591:
+ return "Panama";
+ case 598:
+ return "Papua New Guinea";
+ case 600:
+ return "Paraguay";
+ case 604:
+ return "Peru";
+ case 608:
+ return "Philippines";
+ case 612:
+ return "Pitcairn";
+ case 616:
+ return "Poland";
+ case 620:
+ return "Portugal";
+ case 630:
+ return "Puerto Rico";
+ case 634:
+ return "Qatar";
+ case 638:
+ return "Reunion";
+ case 642:
+ return "Romania";
+ case 643:
+ return "Russian Federation";
+ case 646:
+ return "Rwanda";
+ case 659:
+ return "Saint Kitts and Nevis";
+ case 662:
+ return "Saint Lucia";
+ case 670:
+ return "Saint Vincent and The Grenadines";
+ case 882:
+ return "Samoa";
+ case 674:
+ return "San Marino";
+ case 678:
+ return "Sao Tome and Principe";
+ case 682:
+ return "Saudi Arabia";
+ case 686:
+ return "Senegal";
+ case 690:
+ return "Seychelles";
+ case 694:
+ return "Sierra Leone";
+ case 702:
+ return "Singapore";
+ case 703:
+ return "Slovakia (Slovak Republic)";
+ case 705:
+ return "Slovenia";
+ case 090:
+ return "Solomon Islands";
+ case 706:
+ return "Somalia";
+ case 710:
+ return "South Africa";
+ case 239:
+ return "South Georgia and The South Sandwich Islands";
+ case 724:
+ return "Spain";
+ case 144:
+ return "Sri Lanka";
+ case 654:
+ return "St. Helena";
+ case 666:
+ return "St. Pierre and Miquelon";
+ case 736:
+ return "Sudan";
+ case 740:
+ return "Suriname";
+ case 744:
+ return "Svalbard and Jan Mayen Islands";
+ case 748:
+ return "Swaziland";
+ case 752:
+ return "Sweden";
+ case 756:
+ return "Switzerland";
+ case 760:
+ return "Syrian Arab Republic";
+ case 158:
+ return "Taiwan, Province of China";
+ case 762:
+ return "Tajikistan";
+ case 834:
+ return "Tanzania, United Republic of";
+ case 764:
+ return "Thailand";
+ case 768:
+ return "Togo";
+ case 772:
+ return "Tokelau";
+ case 776:
+ return "Tonga";
+ case 780:
+ return "Trinidad and Tobago";
+ case 788:
+ return "Tunisia";
+ case 792:
+ return "Turkey";
+ case 795:
+ return "Turkmenistan";
+ case 796:
+ return "Turks and Caicos Islands";
+ case 798:
+ return "Tuvalu";
+ case 800:
+ return "Uganda";
+ case 804:
+ return "Ukraine";
+ case 784:
+ return "United Arab Emirates";
+ case 826:
+ return "United Kingdom";
+ case 840:
+ return "United States";
+ case 581:
+ return "United States Minor Outlying Islands";
+ case 858:
+ return "Uruguay";
+ case 860:
+ return "Uzbekistan";
+ case 548:
+ return "Vanuatu";
+ case 862:
+ return "Venezuela";
+ case 704:
+ return "Viet Nam";
+ case 092:
+ return "Virgin Islands (British)";
+ case 850:
+ return "Virgin Islands (U.S.)";
+ case 876:
+ return "Wallis and Futuna Islands";
+ case 732:
+ return "Western Sahara";
+ case 887:
+ return "Yemen";
+ case 891:
+ return "Yugoslavia";
+ case 180:
+ return "Zaire";
+ case 894:
+ return "Zambia";
+ case 716:
+ return "Zimbabwe";
+ default:
+ throw new Exception ("This code should not be reached.");
+ }
+ }
+ }
+
+ public virtual bool IsMetric {
+ get {
+ switch (NLS_id) {
+ case 203: // Czech Republic
+ return true;
+ case 840: // United States
+ return false;
+ default:
+ throw new Exception ("FIXME. Please define.");
+ }
+ }
+ }
+
+ public virtual string ISOCurrencySymbol {
+ get {
+ switch (NLS_id) {
+ default:
+ throw new Exception ("This code should not be reached.");
+ }
+ }
+ }
+
+ //
+ // methods
+
+ public override bool Equals(object value) {
+ return value == this;
+ }
+
+ public override int GetHashCode () {
+ return NLS_id.GetHashCode ();
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Globalization/TaiwanCalendar.cs b/mcs/class/corlib/System.Globalization/TaiwanCalendar.cs
new file mode 100644
index 00000000000..f744e2bd0b0
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/TaiwanCalendar.cs
@@ -0,0 +1,745 @@
+// TaiwanCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the Japanese calendar. It differs from the Gregorian calendar
+/// only in the years.
+/// </summary>
+/// <remarks>
+/// <para>The Japanese calendar support a single era starting at January 1,
+/// 1912</para>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class TaiwanCalendar : Calendar {
+ /// <summary>
+ /// Static protected field storing the
+ /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
+ /// </summary>
+ internal static readonly CCGregorianEraHandler M_EraHandler;
+
+ /// <summary>
+ /// Static constructor, who creates and initializes
+ /// <see cref="F:M_EraHandler"/>.
+ /// </summary>
+ static TaiwanCalendar() {
+ M_EraHandler = new CCGregorianEraHandler();
+ M_EraHandler.appendEra(1,
+ CCGregorianCalendar.fixed_from_dmy(1, 1, 1912));
+ }
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public TaiwanCalendar() {
+ M_AbbrEraNames = new string[] {"T.C.E."};
+ M_EraNames = new string[] {"Taiwan current era"};
+ }
+
+ /// <value>Overridden. Gives the eras supported by the
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return (int[])M_EraHandler.Eras.Clone();
+ }
+ }
+
+ /// <summary>
+ /// A protected member checking a
+ /// <see cref="T:System.DateTime"/> value.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/>
+ /// to check.
+ /// </param>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ internal void M_CheckDateTime(DateTime time) {
+ M_EraHandler.CheckDateTime(time);
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number as reference. It is set
+ /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = 1;
+ if (!M_EraHandler.ValidEra(era))
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the supported range.
+ /// </exception>
+ internal int M_CheckYEG(int year, ref int era) {
+ M_CheckEra(ref era);
+ return M_EraHandler.GregorianYear(year, era);
+ }
+
+ /// <summary>
+ /// Checks whether the year is the era is valid, if era = CurrentEra
+ /// the right value is set.
+ /// </summary>
+ /// <param name="year">The year to check.</param>
+ /// <param name="era">The era to check.</Param>
+ /// <exception cref="T:ArgumentOutOfRangeException">
+ /// The exception will be thrown, if the year is not valid.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckYEG(year, ref era);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMEG(int year, int month, ref int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMDEG(int year, int month, int day, ref int era)
+ {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, era));
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// Overridden. Adds days to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// days.
+ /// </param>
+ /// <param name="days">The number of days to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="days"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddDays(DateTime time, int days) {
+ DateTime t = base.AddDays(time, days);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds hours to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// hours.
+ /// </param>
+ /// <param name="hours">The number of hours to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="hours"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddHours(DateTime time, int hours) {
+ DateTime t = base.AddHours(time, hours);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds milliseconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// milliseconds.
+ /// </param>
+ /// <param name="milliseconds">The number of milliseconds given as
+ /// double to add. Keep in mind the 100 nanosecond resolution of
+ /// <see cref="T:System.DateTime"/>.
+ /// </param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="milliseconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMilliseconds(DateTime time,
+ double milliseconds)
+ {
+ DateTime t = base.AddMilliseconds(time, milliseconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds minutes to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// minutes.
+ /// </param>
+ /// <param name="minutes">The number of minutes to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="minutes"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMinutes(DateTime time, int minutes) {
+ DateTime t = base.AddMinutes(time, minutes);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds seconds to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// seconds.
+ /// </param>
+ /// <param name="seconds">The number of seconds to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="seconds"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddSeconds(DateTime time, int seconds) {
+ DateTime t = base.AddSeconds(time, seconds);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+
+ /// <summary>
+ /// Overridden. Adds weeks to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// weeks.
+ /// </param>
+ /// <param name="weeks">The number of weeks to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="weeks"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddWeeks(DateTime time, int weeks) {
+ DateTime t = base.AddWeeks(time, weeks);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the hour of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the hour of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetHour(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetHour(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the milliseconds in the current second
+ /// of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the milliseconds in the seconds
+ /// of the specified time, starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override double GetMilliseconds(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMilliseconds(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the minute of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the minute of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetMinute(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the second of the specified time.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies the
+ /// time.
+ /// </param>
+ /// <returns>An integer that gives the second of the specified time,
+ /// starting with 0.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetSecond(DateTime time) {
+ M_CheckDateTime(time);
+ return base.GetMinute(time);
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddMonths(DateTime time, int months) {
+ DateTime t = CCGregorianCalendar.AddMonths(time, months);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if
+ /// <see cref="T:System.DateTime"/> return value is outside all
+ /// supported eras.
+ /// </exception>
+ public override DateTime AddYears(DateTime time, int years) {
+ DateTime t = CCGregorianCalendar.AddYears(time, years);
+ M_CheckDateTime(t);
+ return t;
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetDayOfMonth(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetDayOfMonth(time);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ M_CheckDateTime(time);
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetDayOfYear(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetDayOfYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An integer that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> or <paramref name="era"/> are outside the
+ /// allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.GetDaysInYear(gregorianYear);
+ }
+
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetEra(DateTime time) {
+ // M_CheckDateTime not needed, because EraYear does the
+ // right thing.
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ M_EraHandler.EraYear(out era, rd);
+ return era;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetMonth(DateTime time) {
+ M_CheckDateTime(time);
+ return CCGregorianCalendar.GetMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYEG(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the
+ /// <see cref="T:System.DateTime"/> parameter is outside all
+ /// supported eras.
+ /// </exception>
+ public override int GetYear(DateTime time) {
+ // M_CheckDateTime not needed, because EraYeat does the
+ // right thing.
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ return M_EraHandler.EraYear(out era, rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYMEG(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.is_leap_year(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ return CCGregorianCalendar.ToDateTime(
+ gregorianYear, month, day,
+ hour, minute, second, milliseconds);
+ }
+
+ /// <summary>
+ /// This functions returns simply the year for the Taiwan calendar.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <returns>The same argument as the year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the year is negative or the resulting
+ /// year is invalid.
+ /// </exception>
+ public override int ToFourDigitYear(int year) {
+ if (year < 0)
+ throw new ArgumentOutOfRangeException(
+ "year", "Non-negative number required.");
+ int era = CurrentEra;
+ M_CheckYE(year, ref era);
+ return year;
+ }
+} // class TaiwanCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs b/mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs
new file mode 100644
index 00000000000..e6a5cc5dff7
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/ThaiBuddhistCalendar.cs
@@ -0,0 +1,445 @@
+// ThaiBuddhistCalendar.cs
+//
+// (C) Ulrich Kunitz 2002
+//
+
+namespace System.Globalization {
+
+using System;
+
+/// <summary>
+/// This is the ThaiBudhist calendar. It differs from the Gegorian calendar
+/// only in the year counting.
+/// </summary>
+/// <remarks>
+/// <para>The implementation uses the
+/// <see cref="N:CalendricalCalculations"/> namespace.
+/// </para>
+/// </remarks>
+[Serializable]
+public class ThaiBuddhistCalendar : Calendar {
+ /// <summary>
+ /// Static protected field storing the
+ /// <see cref="T:CalendricalCalculations.GregorianEraHandler"/>.
+ /// </summary>
+ internal static readonly CCGregorianEraHandler M_EraHandler;
+
+ /// <value>
+ /// The standard era for this calendar.
+ /// </value>
+ public const int ThaiBuddhistEra = 1;
+
+ /// <summary>
+ /// Static constructor, who creates and initializes
+ /// <see cref="F:M_EraHandler"/>.
+ /// </summary>
+ static ThaiBuddhistCalendar() {
+ M_EraHandler = new CCGregorianEraHandler();
+ M_EraHandler.appendEra(ThaiBuddhistEra,
+ CCGregorianCalendar.fixed_from_dmy(1, 1, -542));
+ }
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public ThaiBuddhistCalendar() {
+ M_AbbrEraNames = new string[] {"T.B.C.E."};
+ M_EraNames = new string[] {"ThaiBuddhist current era"};
+ if (M_TwoDigitYearMax == 99)
+ M_TwoDigitYearMax = 2572;
+ }
+
+ /// <value>Overridden. Gives the eras supported by the
+ /// calendar as an array of integers.
+ /// </value>
+ public override int[] Eras {
+ get {
+ return (int[])M_EraHandler.Eras.Clone();
+ }
+ }
+
+ /// <summary>
+ /// A protected method checking the era number.
+ /// </summary>
+ /// <param name="era">The era number as reference. It is set
+ /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ internal void M_CheckEra(ref int era) {
+ if (era == CurrentEra)
+ era = ThaiBuddhistEra;
+ if (!M_EraHandler.ValidEra(era))
+ throw new ArgumentException("Era value was not valid.");
+ }
+
+ /// <summary>
+ /// A protected method checking calendar year and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year is outside of
+ /// the supported range.
+ /// </exception>
+ internal int M_CheckYEG(int year, ref int era) {
+ M_CheckEra(ref era);
+ return M_EraHandler.GregorianYear(year, era);
+ }
+
+ /// <summary>
+ /// Checks whether the year is the era is valid, if era = CurrentEra
+ /// the right value is set.
+ /// </summary>
+ /// <param name="year">The year to check.</param>
+ /// <param name="era">The era to check.</Param>
+ /// <exception cref="T:ArgumentOutOfRangeException">
+ /// The exception will be thrown, if the year is not valid.
+ /// </exception>
+ internal override void M_CheckYE(int year, ref int era) {
+ M_CheckYEG(year, ref era);
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar year, month, and
+ /// era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year or month is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMEG(int year, int month, ref int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ if (month < 1 || month > 12)
+ throw new ArgumentOutOfRangeException("month",
+ "Month must be between one and twelve.");
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// A protected method checking the calendar day, month, and year
+ /// and the era number.
+ /// </summary>
+ /// <param name="year">An integer representing the calendar year.
+ /// </param>
+ /// <param name="month">An integer giving the calendar month.
+ /// </param>
+ /// <param name="day">An integer giving the calendar day.
+ /// </param>
+ /// <param name="era">The era number as reference.</param>
+ /// <exception name="T:System.ArgumentException">
+ /// The exception is thrown if the era is not supported by the class.
+ /// </exception>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown if the calendar year, month, or day is
+ /// outside of the supported range.
+ /// </exception>
+ internal int M_CheckYMDEG(int year, int month, int day, ref int era)
+ {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ M_ArgumentInRange("day", day, 1,
+ GetDaysInMonth(year, month, era));
+ return gregorianYear;
+ }
+
+ /// <summary>
+ /// Overrideden. Adds months to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// months.
+ /// </param>
+ /// <param name="months">The number of months to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="months"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddMonths(DateTime time, int months) {
+ return CCGregorianCalendar.AddMonths(time, months);
+ }
+
+ /// <summary>
+ /// Overridden. Adds years to a given date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> to which to add
+ /// years.
+ /// </param>
+ /// <param name="years">The number of years to add.</param>
+ /// <returns>A new <see cref="T:System.DateTime"/> value, that
+ /// results from adding <paramref name="years"/> to the specified
+ /// DateTime.</returns>
+ public override DateTime AddYears(DateTime time, int years) {
+ return CCGregorianCalendar.AddYears(time, years);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the month from
+ /// <paramref name="time"/>.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override int GetDayOfMonth(DateTime time) {
+ return CCGregorianCalendar.GetDayOfMonth(time);
+ }
+
+ /// <summary>
+ /// Overriden. Gets the day of the week from the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer giving the day of months, starting with 1.
+ /// </returns>
+ public override DayOfWeek GetDayOfWeek(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ return (DayOfWeek)CCFixed.day_of_week(rd);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the day in the year.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the day of the year,
+ /// starting with 1.</returns>
+ public override int GetDayOfYear(DateTime time) {
+ return CCGregorianCalendar.GetDayOfYear(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days in the specified month
+ /// of the given year and era.
+ /// </summary>
+ /// <param name="year">An integer that gives the year.
+ /// </param>
+ /// <param name="month">An integer that gives the month, starting
+ /// with 1.</param>
+ /// <param name="era">An integer that gives the era of the specified
+ /// year.</param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified month.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if <paramref name="month"/>,
+ /// <paramref name="year"/> ,or <paramref name="era"/> is outside
+ /// the allowed range.
+ /// </exception>
+ public override int GetDaysInMonth(int year, int month, int era) {
+ int gregorianYear = M_CheckYMEG(year, month, ref era);
+ return CCGregorianCalendar.GetDaysInMonth(gregorianYear, month);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of days of the specified
+ /// year of the given era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An ineger that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of days of the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeExceiption">
+ /// The exception is thrown, if
+ /// <paramref name="year"/> or <paramref name="era"/> are outside the
+ /// allowed range.
+ /// </exception>
+ public override int GetDaysInYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.GetDaysInYear(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the era of the specified date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the era of the calendar.
+ /// </returns>
+ public override int GetEra(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ M_EraHandler.EraYear(out era, rd);
+ return era;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the month of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the month,
+ /// starting with 1.</returns>
+ public override int GetMonth(DateTime time) {
+ return CCGregorianCalendar.GetMonth(time);
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of months in the specified year
+ /// and era.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>An integer that gives the number of the months in the
+ /// specified year.</returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or the era are not valid.
+ /// </exception>
+ public override int GetMonthsInYear(int year, int era) {
+ M_CheckYE(year, ref era);
+ return 12;
+ }
+
+ /// <summary>
+ /// Overridden. Gives the number of the year of the specified
+ /// date.
+ /// </summary>
+ /// <param name="time">The
+ /// <see cref="T:System.DateTime"/> that specifies a
+ /// date.
+ /// </param>
+ /// <returns>An integer representing the year,
+ /// starting with 1.</returns>
+ public override int GetYear(DateTime time) {
+ int rd = CCFixed.FromDateTime(time);
+ int era;
+ return M_EraHandler.EraYear(out era, rd);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given day
+ /// is a leap day.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given day is a leap
+ /// day.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, day, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapDay(int year, int month, int day, int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ return CCGregorianCalendar.IsLeapDay(gregorianYear, month, day);
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given month
+ /// is a leap month.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given month is a leap
+ /// month.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year, month, or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapMonth(int year, int month, int era) {
+ M_CheckYMEG(year, month, ref era);
+ return false;
+ }
+
+ /// <summary>
+ /// Overridden. Tells whether the given year
+ /// is a leap year.
+ /// </summary>
+ /// <param name="year">An integer that specifies the year in the
+ /// given era.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A boolean that tells whether the given year is a leap
+ /// year.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if the year or era is not
+ /// valid.
+ /// </exception>
+ public override bool IsLeapYear(int year, int era) {
+ int gregorianYear = M_CheckYEG(year, ref era);
+ return CCGregorianCalendar.is_leap_year(gregorianYear);
+ }
+
+ /// <summary>
+ /// Overridden. Creates the
+ /// <see cref="T:System.DateTime"/> from the parameters.
+ /// </summary>
+ /// <param name="year">An integer that gives the year in the
+ /// <paramref name="era"/>.
+ /// </param>
+ /// <param name="month">An integer that specifies the month.
+ /// </param>
+ /// <param name="day">An integer that specifies the day.
+ /// </param>
+ /// <param name="hour">An integer that specifies the hour.
+ /// </param>
+ /// <param name="minute">An integer that specifies the minute.
+ /// </param>
+ /// <param name="second">An integer that gives the second.
+ /// </param>
+ /// <param name="milliseconds">An integer that gives the
+ /// milliseconds.
+ /// </param>
+ /// <param name="era">An integer that specifies the era.
+ /// </param>
+ /// <returns>A
+ /// <see cref="T:system.DateTime"/> representig the date and time.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentOutOfRangeException">
+ /// The exception is thrown, if at least one of the parameters
+ /// is out of range.
+ /// </exception>
+ public override DateTime ToDateTime(int year, int month, int day,
+ int hour, int minute, int second, int milliseconds,
+ int era)
+ {
+ int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
+ M_CheckHMSM(hour, minute, second, milliseconds);
+ return CCGregorianCalendar.ToDateTime(
+ gregorianYear, month, day,
+ hour, minute, second, milliseconds);
+ }
+} // class ThaiBuddhistCalendar
+
+} // namespace System.Globalization
diff --git a/mcs/class/corlib/System.Globalization/UnicodeCategory.cs b/mcs/class/corlib/System.Globalization/UnicodeCategory.cs
new file mode 100644
index 00000000000..2db258b3743
--- /dev/null
+++ b/mcs/class/corlib/System.Globalization/UnicodeCategory.cs
@@ -0,0 +1,44 @@
+//
+// System.Globalization.UnicodeCategory.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Globalization {
+
+ public enum UnicodeCategory {
+ UppercaseLetter = 0,
+ LowercaseLetter = 1,
+ TitlecaseLetter = 2,
+ ModifierLetter = 3,
+ OtherLetter = 4,
+ NonSpacingMark = 5,
+ SpacingCombiningMark = 6,
+ EnclosingMark = 7,
+ DecimalDigitNumber = 8,
+ LetterNumber = 9,
+ OtherNumber = 10,
+ SpaceSeparator = 11,
+ LineSeparator = 12,
+ ParagraphSeparator = 13,
+ Control = 14,
+ Format = 15,
+ Surrogate = 16,
+ PrivateUse = 17,
+ ConnectorPunctuation = 18,
+ DashPunctuation = 19,
+ OpenPunctuation = 20,
+ ClosePunctuation = 21,
+ InitialQuotePunctuation = 22,
+ FinalQuotePunctuation = 23,
+ OtherPunctuation = 24,
+ MathSymbol = 25,
+ CurrencySymbol = 26,
+ ModifierSymbol = 27,
+ OtherSymbol = 28,
+ OtherNotAssigned = 29,
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog b/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog
new file mode 100644
index 00000000000..da93dff9265
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/ChangeLog
@@ -0,0 +1,19 @@
+2002-02-19 Duncan Mak <duncan@ximian.com>
+
+ * IsolatedStorageFileStream.cs: Added MonoTODO here. This class
+ is completely stubbed out (over the summer) and didn't get
+ properly MonoTODO'd.
+
+2002-02-08 Duncan Mak <duncan@ximian.com>
+
+ * IsolatedStorage.cs: Looked at MemberInfo.cs, another fellow
+ abstract class. Oh, that's what it means! Removed unnesscessary
+ MonoTODO attributes.
+
+2002-02-07 Duncan Mak <duncan@ximian.com>
+
+ * IsolatedStorage.cs: Added to CVS, stubbed out the API.
+ * IsolatedStorageException.cs: Implemented.
+
+2002-01-07 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Created INormalizeForIsolatedStorage
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs b/mcs/class/corlib/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs
new file mode 100644
index 00000000000..56d9069d48e
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs
@@ -0,0 +1,18 @@
+//
+// System.IO.IsolatedStorage.INormalizeForIsolatedStorage
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (c) 2002 Duco Fijma
+//
+
+namespace System.IO.IsolatedStorage {
+
+public interface INormalizeForIsolatedStorage {
+
+ object Normalize ();
+
+}
+
+}
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorage.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorage.cs
new file mode 100644
index 00000000000..8a73db56cd8
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorage.cs
@@ -0,0 +1,78 @@
+//
+// System.IO.IsolatedStorage.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.IO.IsolatedStorage
+{
+ public abstract class IsolatedStorage : MarshalByRefObject
+ {
+ // Constructor
+ protected IsolatedStorage ()
+ : base ()
+ {
+ }
+
+ // Properties
+ [MonoTODO]
+ public object AssemblyIdentity
+ {
+ get { return null; }
+ }
+
+ [CLSCompliant (false)]
+ [MonoTODO]
+ public virtual ulong CurrentSize
+ {
+ get { return 0; }
+ }
+
+ [MonoTODO]
+ public object DomainIdentity
+ {
+ get { return null; }
+ }
+
+ [CLSCompliant (false)]
+ [MonoTODO]
+ public virtual ulong MaximumSize
+ {
+ get { return 0; }
+ }
+
+ [MonoTODO]
+ public IsolatedStorageScope Scope
+ {
+ get { return 0; }
+ }
+
+ [MonoTODO]
+ protected virtual char SeparatorExternal
+ {
+ get { return Char.MinValue; }
+ }
+
+ [MonoTODO]
+ protected virtual char SeparatorInternal
+ {
+ get { return Char.MinValue; }
+ }
+
+ // Methods
+ protected abstract IsolatedStoragePermission GetPermission (PermissionSet ps);
+
+ [MonoTODO]
+ protected void InitStore (IsolatedStorageScope scope, Type domainEvidenceType,
+ Type assemblyEvidenceType)
+ {
+ }
+
+ public abstract void Remove ();
+ }
+}
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageException.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageException.cs
new file mode 100644
index 00000000000..51268d65550
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageException.cs
@@ -0,0 +1,37 @@
+//
+// System.IO.IsolatedStorage.IsolatedstorageException
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002, Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.IO.IsolatedStorage
+{
+ [Serializable]
+ public class IsolatedStorageException : Exception
+ {
+ public IsolatedStorageException ()
+ : base (Locale.GetText ("An Isolated storage operation failed."))
+ {
+ }
+
+ public IsolatedStorageException (string message)
+ : base (message)
+ {
+ }
+
+ public IsolatedStorageException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected IsolatedStorageException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs
new file mode 100644
index 00000000000..a8ca0e96fe7
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFileStream.cs
@@ -0,0 +1,19 @@
+// System.IO.IsolatedStorage.IsolatedStorageFileStream
+//
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+
+using System.IO;
+
+namespace System.IO.IsolatedStorage
+{
+ [MonoTODO]
+ public class IsolatedStorageFileStream : FileStream
+ {
+ public IsolatedStorageFileStream (string name, FileMode mode)
+ : base(name, mode)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageScope.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageScope.cs
new file mode 100755
index 00000000000..84bb413c45c
--- /dev/null
+++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageScope.cs
@@ -0,0 +1,38 @@
+// IsolatedStorageScope.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:41:21 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO.IsolatedStorage {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum IsolatedStorageScope {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ User = 1,
+
+ /// <summary>
+ /// </summary>
+ Domain = 2,
+
+ /// <summary>
+ /// </summary>
+ Assembly = 4,
+ } // IsolatedStorageScope
+
+} // System.IO.IsolatedStorage
diff --git a/mcs/class/corlib/System.IO/BinaryReader.cs b/mcs/class/corlib/System.IO/BinaryReader.cs
new file mode 100644
index 00000000000..7090a6b5f87
--- /dev/null
+++ b/mcs/class/corlib/System.IO/BinaryReader.cs
@@ -0,0 +1,362 @@
+//
+// System.IO.BinaryReader
+//
+// Author:
+// Matt Kimball (matt@kimball.net)
+//
+
+using System;
+using System.Text;
+
+namespace System.IO {
+ public class BinaryReader : IDisposable {
+ Stream m_stream;
+ Encoding m_encoding;
+ int m_encoding_max_byte;
+
+ byte[] m_buffer;
+ int m_buffer_used;
+ int m_buffer_pos;
+
+
+ public BinaryReader(Stream input) : this(input, Encoding.UTF8) {
+ }
+
+ public BinaryReader(Stream input, Encoding encoding) {
+ if (input == null || encoding == null)
+ throw new ArgumentNullException();
+ if (!input.CanRead)
+ throw new ArgumentException();
+
+ m_stream = input;
+ m_encoding = encoding;
+ m_encoding_max_byte = m_encoding.GetMaxByteCount(1);
+ }
+
+ public virtual Stream BaseStream {
+ get {
+ return m_stream;
+ }
+ }
+
+ public virtual void Close() {
+ Dispose();
+ m_stream.Close();
+ }
+
+ public virtual void Dispose() {
+ m_buffer = null;
+ m_buffer_used = 0;
+ }
+
+ protected virtual void FillBuffer(int bytes) {
+ if (!EnsureBuffered(m_buffer_used - m_buffer_pos + bytes)) {
+ throw new EndOfStreamException();
+ }
+ }
+
+ public virtual int PeekChar() {
+ EnsureBuffered(m_encoding_max_byte);
+
+ int i;
+ for (i = 1; m_encoding.GetCharCount(m_buffer, m_buffer_pos, i) == 0; i++) {
+ if (m_buffer_pos + i >= m_buffer_used) {
+ return -1;
+ }
+ }
+
+ char[] decode = m_encoding.GetChars(m_buffer, m_buffer_pos, i);
+ return decode[0];
+ }
+
+ public virtual int Read() {
+ char[] decode = new char[1];
+
+ Read(decode, 0, 1);
+ return decode[0];
+ }
+
+ public virtual int Read(byte[] buffer, int index, int count) {
+ if (buffer == null) {
+ throw new ArgumentNullException();
+ }
+ if (buffer.Length - index < count) {
+ throw new ArgumentException();
+ }
+ if (index < 0 || count < 0) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ EnsureBuffered(count);
+
+ if (m_buffer_used - m_buffer_pos < count) {
+ count = m_buffer_used - m_buffer_pos;
+ }
+
+ Array.Copy(m_buffer, m_buffer_pos, buffer, index, count);
+
+ ConsumeBuffered(count);
+ return count;
+ }
+
+ public virtual int Read(char[] buffer, int index, int count) {
+ if (buffer == null) {
+ throw new ArgumentNullException();
+ }
+ if (buffer.Length - index < count) {
+ throw new ArgumentException();
+ }
+ if (index < 0 || count < 0) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ EnsureBuffered(m_encoding_max_byte * count);
+
+ int i;
+ for (i = 1; m_encoding.GetCharCount(m_buffer, m_buffer_pos, i) < count; i++) {
+ if (m_buffer_pos + i >= m_buffer_used) {
+ break;
+ }
+ }
+
+ count = m_encoding.GetCharCount(m_buffer, m_buffer_pos, i);
+
+ char[] dec = m_encoding.GetChars(m_buffer, m_buffer_pos, i);
+ Array.Copy(dec, 0, buffer, index, count);
+
+ ConsumeBuffered(i);
+ return count;
+ }
+
+ protected int Read7BitEncodedInt() {
+ int ret = 0;
+ int shift = 0;
+ int count = 0;
+ byte b;
+
+ do {
+ if (!EnsureBuffered(++count)) {
+ throw new EndOfStreamException();
+ }
+ b = m_buffer[m_buffer_pos + count - 1];
+
+ ret = ret | ((b & 0x7f) << shift);
+ shift += 7;
+ } while ((b & 0x80) == 0x80);
+
+ ConsumeBuffered(count);
+ return ret;
+ }
+
+ public virtual bool ReadBoolean() {
+ if (!EnsureBuffered(1)) {
+ throw new EndOfStreamException();
+ }
+
+ bool ret = BitConverter.ToBoolean(m_buffer, m_buffer_pos);
+ ConsumeBuffered(1);
+ return ret;
+ }
+
+ public virtual byte ReadByte() {
+ if (!EnsureBuffered(1)) {
+ throw new EndOfStreamException();
+ }
+
+ byte ret = m_buffer[m_buffer_pos];
+ ConsumeBuffered(1);
+ return ret;
+ }
+
+ public virtual byte[] ReadBytes(int count) {
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ EnsureBuffered(count);
+
+ if (count > m_buffer_used - m_buffer_pos) {
+ count = m_buffer_used - m_buffer_pos;
+ }
+
+ if (count == 0) {
+ throw new EndOfStreamException();
+ }
+
+ byte[] buf = new byte[count];
+ Read(buf, 0, count);
+ return buf;
+ }
+
+ public virtual char ReadChar() {
+ char[] buf = ReadChars(1);
+ return buf[0];
+ }
+
+ public virtual char[] ReadChars(int count) {
+ if (count < 0) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ char[] full = new char[count];
+ count = Read(full, 0, count);
+
+ if (count != full.Length) {
+ char[] ret = new char[count];
+ Array.Copy(full, 0, ret, 0, count);
+ return ret;
+ } else {
+ return full;
+ }
+ }
+
+ unsafe public virtual decimal ReadDecimal() {
+ if (!EnsureBuffered(16)) {
+ throw new EndOfStreamException();
+ }
+
+ decimal ret;
+ byte* ret_ptr = (byte *)&ret;
+ for (int i = 0; i < 16; i++) {
+ ret_ptr[i] = m_buffer[m_buffer_pos + i];
+ }
+
+ ConsumeBuffered(16);
+ return ret;
+ }
+
+ public virtual double ReadDouble() {
+ if (!EnsureBuffered(8)) {
+ throw new EndOfStreamException();
+ }
+
+ double ret = BitConverter.ToDouble(m_buffer, m_buffer_pos);
+ ConsumeBuffered(8);
+ return ret;
+ }
+
+ public virtual short ReadInt16() {
+ if (!EnsureBuffered(2)) {
+ throw new EndOfStreamException();
+ }
+
+ short ret = BitConverter.ToInt16(m_buffer, m_buffer_pos);
+ ConsumeBuffered(2);
+ return ret;
+ }
+
+ public virtual int ReadInt32() {
+ if (!EnsureBuffered(1)) {
+ throw new EndOfStreamException();
+ }
+
+ int ret = BitConverter.ToInt32(m_buffer, m_buffer_pos);
+ ConsumeBuffered(1);
+ return ret;
+ }
+
+ public virtual long ReadInt64() {
+ if (!EnsureBuffered(8)) {
+ throw new EndOfStreamException();
+ }
+
+ long ret = BitConverter.ToInt64(m_buffer, m_buffer_pos);
+ ConsumeBuffered(8);
+ return ret;
+ }
+
+ [CLSCompliant(false)]
+ unsafe public virtual sbyte ReadSByte() {
+ if (!EnsureBuffered(1)) {
+ throw new EndOfStreamException();
+ }
+
+ sbyte ret;
+ byte* ret_ptr = (byte *)&ret;
+ ret_ptr[0] = m_buffer[m_buffer_pos];
+
+ ConsumeBuffered(1);
+ return ret;
+ }
+
+ public virtual string ReadString() {
+ int len = Read7BitEncodedInt();
+
+ char[] str = ReadChars(len);
+ string ret = "";
+ for (int i = 0; i < str.Length; i++) {
+ ret = ret + str[i];
+ }
+
+ return ret;
+ }
+
+ public virtual float ReadSingle() {
+ if (!EnsureBuffered(4)) {
+ throw new EndOfStreamException();
+ }
+
+ float ret = BitConverter.ToSingle(m_buffer, m_buffer_pos);
+ ConsumeBuffered(4);
+ return ret;
+ }
+
+ [CLSCompliant(false)]
+ public virtual ushort ReadUInt16() {
+ if (!EnsureBuffered(2)) {
+ throw new EndOfStreamException();
+ }
+
+ ushort ret = BitConverter.ToUInt16(m_buffer, m_buffer_pos);
+ ConsumeBuffered(2);
+ return ret;
+ }
+
+ [CLSCompliant(false)]
+ public virtual uint ReadUInt32() {
+ if (!EnsureBuffered(4)) {
+ throw new EndOfStreamException();
+ }
+
+ uint ret = BitConverter.ToUInt32(m_buffer, m_buffer_pos);
+ ConsumeBuffered(4);
+ return ret;
+ }
+
+ [CLSCompliant(false)]
+ public virtual ulong ReadUInt64() {
+ if (!EnsureBuffered(8)) {
+ throw new EndOfStreamException();
+ }
+
+ ulong ret = BitConverter.ToUInt64(m_buffer, m_buffer_pos);
+ ConsumeBuffered(8);
+ return ret;
+ }
+
+
+ bool EnsureBuffered(int bytes) {
+ int needed = bytes - (m_buffer_used - m_buffer_pos);
+ if (needed <= 0)
+ return true;
+
+ if (m_buffer_used + needed > m_buffer.Length) {
+ byte[] old_buffer = m_buffer;
+ m_buffer = new byte[m_buffer_used + needed];
+ Array.Copy(old_buffer, 0, m_buffer, 0, m_buffer_used);
+ }
+
+ m_buffer_used += m_stream.Read(m_buffer, m_buffer_used, needed);
+
+ return (m_buffer_used >= m_buffer_pos + bytes);
+ }
+
+
+ void ConsumeBuffered(int bytes) {
+ m_buffer_pos += bytes;
+ if (m_buffer_pos == m_buffer_used) {
+ m_buffer_pos = 0;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/BinaryWriter.cs b/mcs/class/corlib/System.IO/BinaryWriter.cs
new file mode 100755
index 00000000000..d96a59ab6b8
--- /dev/null
+++ b/mcs/class/corlib/System.IO/BinaryWriter.cs
@@ -0,0 +1,165 @@
+//
+// System.IO.BinaryWriter
+//
+// Author:
+// Matt Kimball (matt@kimball.net)
+//
+
+using System;
+using System.Text;
+
+namespace System.IO {
+ [Serializable]
+ public class BinaryWriter : IDisposable {
+ public static readonly BinaryWriter Null;
+
+ protected Stream OutStream;
+ Encoding m_encoding;
+
+ protected BinaryWriter() {
+ m_encoding = Encoding.UTF8;
+ }
+
+ public BinaryWriter(Stream output) : this(output, Encoding.UTF8) {
+ }
+
+ public BinaryWriter(Stream output, Encoding encoding) {
+ if (output == null || encoding == null)
+ throw new ArgumentNullException();
+ if (!output.CanWrite)
+ throw new ArgumentException();
+
+ OutStream = output;
+ m_encoding = encoding;
+ }
+
+ public virtual Stream BaseStream {
+ get {
+ return OutStream;
+ }
+ }
+
+ public virtual void Close() {
+ Dispose();
+ }
+
+ public virtual void Dispose() {
+ OutStream.Close();
+ OutStream.Dispose();
+ }
+
+ public virtual void Flush() {
+ OutStream.Flush();
+ }
+
+ public virtual long Seek(int offset, SeekOrigin origin) {
+ return OutStream.Seek(offset, origin);
+ }
+
+ public virtual void Write(bool value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 1);
+ }
+
+ public virtual void Write(byte value) {
+ OutStream.WriteByte(value);
+ }
+
+ public virtual void Write(byte[] value) {
+ OutStream.Write(value, 0, value.Length);
+ }
+
+ public virtual void Write(byte[] value, int offset, int length) {
+ OutStream.Write(value, offset, length);
+ }
+
+ public virtual void Write(char value) {
+ char[] dec = new char[1];
+ dec[0] = value;
+ byte[] enc = m_encoding.GetBytes(dec, 0, 1);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ public virtual void Write(char[] value) {
+ byte[] enc = m_encoding.GetBytes(value, 0, value.Length);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ public virtual void Write(char[] value, int offset, int length) {
+ byte[] enc = m_encoding.GetBytes(value, offset, length);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ unsafe public virtual void Write(decimal value) {
+ byte[] to_write = new byte[16];
+ byte* value_ptr = (byte *)&value;
+ for (int i = 0; i < 16; i++) {
+ to_write[i] = value_ptr[i];
+ }
+
+ OutStream.Write(to_write, 0, 16);
+ }
+
+ public virtual void Write(double value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 8);
+ }
+
+ public virtual void Write(short value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 2);
+ }
+
+ public virtual void Write(int value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 4);
+ }
+
+ public virtual void Write(long value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 8);
+ }
+
+ [CLSCompliant(false)]
+ unsafe public virtual void Write(sbyte value) {
+ byte[] to_write = new byte[1];
+
+ to_write[0] = *(byte *)&value;
+ OutStream.Write(to_write, 0, 1);
+ }
+
+ public virtual void Write(float value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 4);
+ }
+
+ public virtual void Write(string value) {
+ Write7BitEncodedInt(value.Length);
+ byte[] enc = m_encoding.GetBytes(value);
+ OutStream.Write(enc, 0, enc.Length);
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write(ushort value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 2);
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write(uint value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 4);
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write(ulong value) {
+ OutStream.Write(BitConverter.GetBytes(value), 0, 8);
+ }
+
+ protected void Write7BitEncodedInt(int value) {
+ do {
+ int high = (value >> 7) & 0x01ffffff;
+ byte b = (byte)(value & 0x7f);
+
+ if (high != 0) {
+ b = (byte)(b | 0x80);
+ }
+
+ Write(b);
+ value = high;
+ } while(value != 0);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/BufferedStream.cs b/mcs/class/corlib/System.IO/BufferedStream.cs
new file mode 100644
index 00000000000..38e7ca181d2
--- /dev/null
+++ b/mcs/class/corlib/System.IO/BufferedStream.cs
@@ -0,0 +1,166 @@
+//
+// System.IO.BufferedStream
+//
+// Author:
+// Matt Kimball (matt@kimball.net)
+//
+
+namespace System.IO {
+ public sealed class BufferedStream : Stream {
+ Stream m_stream;
+ byte[] m_buffer;
+ int m_buffer_pos;
+ int m_buffer_read_ahead;
+ bool m_buffer_reading;
+
+ public BufferedStream(Stream stream) : this(stream, 4096) {
+ }
+
+ public BufferedStream(Stream stream, int buffer_size) {
+ m_stream = stream;
+ m_buffer = new byte[buffer_size];
+ }
+
+ public override bool CanRead {
+ get {
+ return m_stream.CanRead;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return m_stream.CanWrite;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return m_stream.CanSeek;
+ }
+ }
+
+ public override long Length {
+ get {
+ return m_stream.Length;
+ }
+ }
+
+ public override long Position {
+ get {
+ return m_stream.Position - m_buffer_read_ahead + m_buffer_pos;
+ }
+
+ set {
+ Flush();
+ m_stream.Position = value;
+ }
+ }
+
+ public override void Close() {
+ Flush();
+ m_stream.Close();
+ Dispose();
+ }
+
+ public override void Dispose() {
+ m_stream.Dispose();
+ m_buffer = null;
+ }
+
+ public override void Flush() {
+ if (m_buffer_reading) {
+ m_stream.Position = Position;
+ } else {
+ m_stream.Write(m_buffer, 0, m_buffer_pos);
+ }
+
+ m_buffer_read_ahead = 0;
+ m_buffer_pos = 0;
+ }
+
+ public override long Seek(long offset, SeekOrigin origin) {
+ Flush();
+ return m_stream.Seek(offset, origin);
+ }
+
+ public override void SetLength(long value) {
+ m_stream.SetLength(value);
+ }
+
+ public override int ReadByte() {
+ byte[] b = new byte[1];
+
+ if (Read(b, 0, 1) == 1) {
+ return b[0];
+ } else {
+ return -1;
+ }
+ }
+
+ public override void WriteByte(byte value) {
+ byte[] b = new byte[1];
+
+ b[0] = value;
+ Write(b, 0, 1);
+ }
+
+ public override int Read(byte[] array, int offset, int count) {
+ if (!m_buffer_reading) {
+ Flush();
+ m_buffer_reading = true;
+ }
+
+ if (count <= m_buffer_read_ahead - m_buffer_pos) {
+ Array.Copy(m_buffer, m_buffer_pos, array, offset, count);
+
+ m_buffer_pos += count;
+ if (m_buffer_pos == m_buffer_read_ahead) {
+ m_buffer_pos = 0;
+ m_buffer_read_ahead = 0;
+ }
+
+ return count;
+ }
+
+ int ret = m_buffer_read_ahead - m_buffer_pos;
+ Array.Copy(m_buffer, m_buffer_pos, array, offset, ret);
+ m_buffer_pos = 0;
+ m_buffer_read_ahead = 0;
+ offset += ret;
+ count -= ret;
+
+ if (count >= m_buffer.Length) {
+ ret += m_stream.Read(array, offset, count);
+ } else {
+ m_buffer_read_ahead = m_stream.Read(m_buffer, 0, m_buffer.Length);
+
+ if (count < m_buffer_read_ahead) {
+ Array.Copy(m_buffer, 0, array, offset, count);
+ m_buffer_pos = count;
+ ret += count;
+ } else {
+ Array.Copy(m_buffer, 0, array, offset, m_buffer_read_ahead);
+ ret += m_buffer_read_ahead;
+ m_buffer_read_ahead = 0;
+ }
+ }
+
+ return ret;
+ }
+
+ public override void Write(byte[] array, int offset, int count) {
+ if (m_buffer_reading) {
+ Flush();
+ m_buffer_reading = false;
+ }
+
+ if (m_buffer_pos + count >= m_buffer.Length) {
+ Flush();
+ m_stream.Write(array, offset, count);
+ } else {
+ Array.Copy(array, offset, m_buffer, m_buffer_pos, count);
+ m_buffer_pos += count;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/ChangeLog b/mcs/class/corlib/System.IO/ChangeLog
new file mode 100644
index 00000000000..7830fe71a00
--- /dev/null
+++ b/mcs/class/corlib/System.IO/ChangeLog
@@ -0,0 +1,255 @@
+2002-03-31 Dick Porter <dick@ximian.com>
+
+ * Directory.cs: Strip out "." and ".." from returned list
+
+ * FileAttributes.cs: Get the right enum values
+
+2002-03-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * TextWriter.cs (write): added check for null
+
+2002-03-28 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Directory.cs: Throws DirectoryNotFoundException.
+ * MonoIO.cs: Fixed to work around enum problem.
+
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * StreamReader.cs: Implemented ReadLine() and ReadEnd().
+
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Directory.cs, File.cs, FileSystemInfo.cs, FileInfo.cs,
+ DirectoryInfo.cs, Path.cs: Modified to use MonoIO class instead of
+ wrapper and PAL classes.
+
+ * MonoIO.cs, MonoIOStat.cs, MonoIOError.cs: Added.
+
+2002-03-25 Mike Kestner <mkestner@speakeasy.net>
+
+ * MemoryStream.cs (Read): Fixed bug in exception throw.
+
+2002-03-24 Mike Kestner <mkestner@speakeasy.net>
+
+ * StreamReader.cs (ReadBuffer): Fix buffer merging bugs.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * StreamReader.cs: Always do buffered reading, use 4k blocks.
+ (Read (char[], int, int)): Implemented.
+ (DiscardBufferedData): Implemented.
+
+2002-03-21 Mike Kestner <mkestner@speakeasy.net>
+
+ * StreamReader.cs : Fill out, add buffering, and use encoding.
+
+2002-03-19 Martin Baulig <martin@gnome.org>
+
+ * StreamWriter.cs (StreamWriter (string)): The default is to override
+ the file, not to append to it.
+ (StreamWriter (string path, bool append)): When appending, seek to the
+ end of the file, otherwise truncate the file to zero length.
+ (Dispose (bool)): Close the internalStream.
+ (Flush): Flush the interalStream.
+ (Write (char[], int, int)): Flush the internalStream in auto-flush-mode.
+
+2002-03-19 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * FileStream.cs: Flush buffer before FileSetLength.
+
+2002-02-28 Miguel de Icaza <miguel@ximian.com>
+
+ * Stream.cs (NullStream): Do not track position, this beast does
+ nothing in practice.
+
+2002-03-15 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * SearchPattern.cs: New class. Glob matching code for Directory.
+ * Directory.cs: Changed to use SearchPattern instead of mono_glob_*()
+
+2002/03/15 Nick Drochak <ndrochak@gol.com>
+
+ * DirectoryInfo.cs: Fixed the overloaded GetDirectories and GetFiles.
+ This code seemed to be copied from somewhere, and it was close,
+ but didn't match the docs. This was the last bit needed to get
+ NAnt to compile with our class libs.
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * EndOfStreamException.cs:
+ * FileLoadException.cs:
+ * FileNotFoundException.cs:
+ * PathTooLongException.cs: Changed the base classes to IOException
+ instead of SystemException.
+
+ * IOException.cs: Added missing constructors.
+
+2002-03-07 Nick Drochak <ndrochak@gol.com>
+
+ * FileMode.cs: Docs don't say this should be explicitly derived from
+ int, so just make it a normal Enum.
+
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * StringReader.cs: Fixed off-by-one error in Peek() and Read().
+
+2002-02-12 Nick Drochak <ndrochak@gol.com>
+
+ * PathTooLongException.cs: put it in the correct namespace
+ * EndOfStreamException.cs: put it in the correct namespace
+
+Thu Jan 31 17:32:32 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Directory.cs: handle opendir() return NULL and absolute filenames.
+
+2002-01-31 Duncan Mak <duncan@ximian.com>
+
+ * FileLoadException.cs:
+ * FileNotFoundException: Added missing bits for serialization.
+
+Thu Jan 24 17:42:54 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Directory.cs: allow directories in GetFiles() mask.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * FileInfo.c (CopyTo, MoveTo): Implement.
+
+ * FileStream.cs: Add argument checking to the constructor.
+
+ * File.cs: Rewrote most of the file. Implement Copy, Open, Create,
+ OpenText, OpenWrite, Move. Made pending methods flagged as MonoTODO.
+
+ * Directory.cs (Delete): reimplement without using DirectoryInfo.
+ (Delete): Implement the recursive version.
+ (GetCreationTime, GetLastWriteTime, GetLastAccessTime): Implement.
+ (Move): Reimplement.
+ (getNames): dead code removal.
+
+ * Path.cs: define an internal DirectorySeparatorStr that we use in
+ a few spots.
+
+ * Wrapper.cs: Updated to new version.
+
+ * DirectoryInfo (Delete): Implement using the Directory API.
+
+ * DirectoryInfo.cs (GetFiles, GetDirectories, GetFileSystemInfos,
+ Delete, Create, Parent, Exists, MoveTo): Implement.
+
+ * Directory.cs (GetListing): implement new utility function.
+ (GetDirectories): Implement.
+ (GetFileSystemEntries): Implement.
+ (GetFiles): Implement.
+
+ * CheckArgument.cs (Path): Do not allow null by default.
+
+Tue Jan 22 22:53:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * DirectoryInfo.cs, FileInfo.cs: do not use Debug from the system
+ assembly in corlib.
+
+2002-01-20 Nick Drochak <ndrochak@gol.com>
+
+ * SeekOrigin.cs: Added Serializable attribute.
+
+2002-01-19 Duncan Mak <duncan@ximian.com>
+
+ * PathTooLongException.cs:
+ * EndOfStreamException.cs: Added to CVS.
+
+Thu Jan 10 12:06:46 MST 2002 Matt Kimball <matt@kimball.net>
+
+ * BufferedStream.cs: Initial implemenation. The synchronous
+ methods for both reading and writing are implemented. I'll do the
+ asynchronous methods in a bit.
+
+Wed Jan 9 16:04:39 MST 2002 Matt Kimball <matt@kimball.net>
+
+ * BinaryWriter.cs: Initial implementation. And it's all there.
+
+ * BinaryReader.cs: The constructor now uses the passed in encoding,
+ not UTF8 always.
+
+Wed Jan 9 13:54:28 MST 2002 Matt Kimball <matt@kimbal.net>
+
+ * BinaryReader.cs: Initial implementation. I think it's complete.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * CheckArgument.cs, CheckPermission.cs, Directory.cs: MonoTODO
+ attribute decorations.
+
+ * DirectoryInfo.cs, File.cs, FileInfo.cs, FileSystemInfo.cs,
+ Path.cs, TextReader.cs, TextWriter.cs : Ditto.
+
+ * FileLoadException.cs, FileNotFoundException.cs, StreamReader.cs:
+ Ditto.
+
+2001-12-11 Dick Porter <dick@ximian.com>
+
+ * FileStream.cs: Use handles rather than casting file descriptors.
+ Added Handle property.
+
+Wed Nov 14 16:47:47 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * CheckPermission.cs: disable ModeAccess() code: it's wrong.
+ * FileStream.cs: only trow an exception if the read failed in ReadByte().
+ * StreamReader.cs: implement Peek and Read.
+ * TextWriter.cs: CLSCompliant updates.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * FileNotFoundException.cs: Added some constructors
+
+ * Path.cs (GetFullPath): Fixed implementation
+
+Fri Nov 2 18:27:58 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * DirectoryNotFoundException.cs: implemented.
+
+Tue Sep 25 18:54:06 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * File.cs: fix signatures of the Open() and OpenRead() functions
+ (they are static).
+
+Thu Sep 13 18:04:23 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * FileLoadException.cs, FileNotFoundException.cs: added.
+
+2001-08-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * TextReader.cs: implemented the Read method
+
+ * StreamReader.cs: impl. stubs
+
+ * StreamWriter.cs: impl.
+
+ * TextWriter.cs: implemented Write and WriteLine methods
+
+Sun Aug 26 23:01:41 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * FileAccess.cs, FileMode.cs: change values to be compatible with
+ the ms ones.
+
+Sun Aug 26 11:47:56 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * IOException.cs: Implemented System.IO.Exception.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ *SeekOrigin.cs.cs, FileShare.cs, FileMode.cs, FileAccess.cs: Add.
+
+2001-07-19 Marcin Szczepanski <marcins@zipworld.com.au>
+
+ * System.IO.MemoryStream.cs: Added. Had quite a few cases of
+ "LAMESPEC", but the tests work against the MS implementation so
+ the major functions are right (ie. Read/Write/Seek). Some more
+ tests required for the various constructors and exceptions.
+
+2001-07-16 Marcin Szczepanski <marcins@zipworld.com.au>
+
+ * StringReader.cs, StringWriter.cs, TextReader.cs, TextWriter.cs:
+ New class implemenations.
+
+ * StringReaderTest.cs, StringWriterTest.cs: Test suite for the above.
+
diff --git a/mcs/class/corlib/System.IO/CheckArgument.cs b/mcs/class/corlib/System.IO/CheckArgument.cs
new file mode 100644
index 00000000000..eaf20c0002e
--- /dev/null
+++ b/mcs/class/corlib/System.IO/CheckArgument.cs
@@ -0,0 +1,167 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.CheckArgument.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Created: Saturday, August 25, 2001
+//
+// NOTE: All contributors can freely add to this class or make modifications
+// that do not break existing usage of methods
+//------------------------------------------------------------------------------
+
+
+using System;
+using System.IO;
+
+namespace System.IO
+{
+ /// <summary>
+ /// A utility class to assist with various argument validations in System.IO
+ /// </summary>
+ internal sealed class CheckArgument
+ {
+ /// <summary>
+ /// Generates and exception if arg contains whitepace only
+ /// </summary>
+ public static void WhitespaceOnly (string arg, string desc)
+ {
+ if (arg != null && arg.Length > 0)
+ {
+ string temp = arg;
+ temp.Trim ();
+ if (temp.Length == 0)
+ {
+ throw new ArgumentException (desc);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if arg contains whitepace only
+ /// </summary>
+ public static void WhitespaceOnly (string arg)
+ {
+ WhitespaceOnly (arg, "Argument string consists of whitespace characters only.");
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is empty
+ /// </summary>
+ public static void Empty (string arg, string desc)
+ {
+ if (arg != null && arg.Length == 0)
+ {
+ throw new ArgumentException (desc);
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is empty
+ /// </summary>
+ public static void Empty (string arg)
+ {
+ Empty (arg, "Argument string is empty.");
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is null
+ /// </summary>
+ public static void Null (Object arg, string desc)
+ {
+ if (arg == null)
+ {
+ throw new ArgumentNullException (desc);
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if arg is null
+ /// </summary>
+ public static void Null (Object arg)
+ {
+ if (arg == null)
+ {
+ throw new ArgumentNullException ();
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if path contains invalid path characters
+ /// </summary>
+ public static void PathChars (string path, string desc)
+ {
+ if (path != null)
+ {
+ if (path.IndexOfAny (System.IO.Path.InvalidPathChars) > -1)
+ {
+ throw new ArgumentException (desc);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if path contains invalid path characters
+ /// </summary>
+ public static void PathChars (string path)
+ {
+ PathChars (path, "Path contains invalid characters");
+ }
+
+ /// <summary>
+ /// Generates and exception if path too long
+ /// </summary>
+ [MonoTODO]
+ public static void PathLength (string path, string desc)
+ {
+ //TODO: find out how long is too long
+ }
+
+ /// <summary>
+ /// Generates and exception if path too long
+ /// </summary>
+ public static void PathLength (string path)
+ {
+ PathLength (path);
+ }
+
+ /// <summary>
+ /// Generates and exception if path is illegal
+ /// </summary>
+ public static void Path (string path, bool bAllowNull, bool bLength)
+ {
+ if (path != null) //allow null
+ {
+ Empty (path, "Path cannot be the empty string"); // path can't be empty
+ WhitespaceOnly (path, "Path cannot be all whitespace"); // path can't be all whitespace
+ PathChars (path); // path can't contain invalid characters
+ if (bLength)
+ {
+ PathLength ("Path too long");
+ }
+ }
+ else if (!bAllowNull)
+ {
+ throw new ArgumentNullException ("Parameter name: path");
+ }
+ }
+
+ /// <summary>
+ /// Generates and exception if path is illegal
+ /// </summary>
+ public static void Path (string path, bool bAllowNull)
+ {
+ Path (path, bAllowNull, false);
+ }
+
+ /// <summary>
+ /// Generates and exception if path is illegal
+ /// </summary>
+ public static void Path (string path)
+ {
+ Path (path, false, false);
+ }
+
+ }
+} // namespace System.IO.Private
diff --git a/mcs/class/corlib/System.IO/CheckPermission.cs b/mcs/class/corlib/System.IO/CheckPermission.cs
new file mode 100644
index 00000000000..3418850c065
--- /dev/null
+++ b/mcs/class/corlib/System.IO/CheckPermission.cs
@@ -0,0 +1,87 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.CheckPermission.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Created: Saturday, August 25, 2001
+//
+// NOTE: All contributors can freely add to this class or make modifications
+// that do not break existing usage of methods
+//------------------------------------------------------------------------------
+
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.IO
+{
+ /// <summary>
+ /// A utility class to assist with various permission validation in System.IO
+ /// </summary>
+ internal sealed class CheckPermission
+ {
+ /// <summary>
+ /// Generates and exception if caller doesn't have flags access to filesystem item specified by path
+ /// </summary>
+ [MonoTODO]
+ public static void Demand(FileIOPermissionAccess flags, string path)
+ {
+ FileIOPermission ioPerm = new FileIOPermission(flags, path);
+ // FIXME: FileIOPermission is not yet implemented
+ //ioPerm.Demand();
+ }
+
+ public static void Access(FileAccess access, string path)
+ {
+ switch(access)
+ {
+ case FileAccess.Read:
+ Demand(FileIOPermissionAccess.Read, path);
+ break;
+ case FileAccess.Write:
+ Demand(FileIOPermissionAccess.Write, path);
+ break;
+ case FileAccess.ReadWrite:
+ Demand(FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, path);
+ break;
+ default:
+ // TODO: determine what best to do here
+ throw new ArgumentException("Invalid FileAccess parameter");
+ }
+ }
+
+ [MonoTODO]
+ public static void ModeAccess(FileMode mode, FileAccess access, string path, bool exists)
+ {
+#if false
+ // TODO: this logic isn't entirely complete and accurate, yet
+ if((mode & (FileMode.CreateNew | FileMode.Create)) != 0)
+ {
+ CheckPermission.Demand(FileIOPermissionAccess.Write, Path.GetDirectoryName(path));
+ }
+ else if((mode & FileMode.OpenOrCreate) != 0)
+ {
+ if(!exists)
+ {
+ CheckPermission.Demand(FileIOPermissionAccess.Write, Path.GetDirectoryName(path));
+ }
+ else
+ {
+ CheckPermission.Access(access, path);
+ }
+ }
+ else if(exists)
+ {
+ CheckPermission.Access(access, path);
+ }
+ else
+ {
+ throw new FileNotFoundException();
+ }
+#endif
+ }
+ }
+} // namespace System.IO.Private
diff --git a/mcs/class/corlib/System.IO/Directory.cs b/mcs/class/corlib/System.IO/Directory.cs
new file mode 100644
index 00000000000..f023bba4e46
--- /dev/null
+++ b/mcs/class/corlib/System.IO/Directory.cs
@@ -0,0 +1,237 @@
+//
+// System.IO.Directory.cs
+//
+// Authors:
+// Jim Richardson (develop@wtfo-guru.com)
+// Miguel de Icaza (miguel@ximian.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+// Copyright (C) 2002 Ximian, Inc.
+//
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Security.Permissions;
+using System.Collections;
+
+namespace System.IO
+{
+ public sealed class Directory : Object
+ {
+ private Directory () {}
+
+ public static DirectoryInfo CreateDirectory (string path)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path == "" || path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ();
+
+ if (!MonoIO.CreateDirectory (path))
+ throw MonoIO.GetException ();
+
+ return new DirectoryInfo (path);
+ }
+
+ public static void Delete (string path)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path == "" || path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ();
+
+ if (!MonoIO.RemoveDirectory (path))
+ throw MonoIO.GetException ();
+ }
+
+ static void RecursiveDelete (string path)
+ {
+ foreach (string dir in GetDirectories (path))
+ RecursiveDelete (dir);
+
+ foreach (string file in GetFiles (path))
+ File.Delete (file);
+
+ Directory.Delete (path);
+ }
+
+ public static void Delete (string path, bool recurse)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Path contains invalid characters");
+
+ if (recurse == false){
+ Delete (path);
+ return;
+ }
+
+ RecursiveDelete (path);
+ }
+
+ public static bool Exists (string path)
+ {
+ return MonoIO.ExistsDirectory (path);
+ }
+
+ public static DateTime GetLastAccessTime (string path)
+ {
+ return File.GetLastAccessTime (path);
+ }
+
+ public static DateTime GetLastWriteTime (string path)
+ {
+ return File.GetLastWriteTime (path);
+ }
+
+ public static DateTime GetCreationTime (string path)
+ {
+ return File.GetLastWriteTime (path);
+ }
+
+ public static string GetCurrentDirectory ()
+ {
+ /*
+ // Implementation complete 08/25/2001 14:24 except for
+ // LAMESPEC: documentation specifies invalid exceptions (i think)
+ // also shouldn't need Write to getcurrrent should we?
+ string str = Environment.CurrentDirectory;
+ CheckPermission.Demand (FileIOPermissionAccess.Read & FileIOPermissionAccess.Write, str);
+ */
+ return Environment.CurrentDirectory;
+ }
+
+ public static string [] GetDirectories (string path)
+ {
+ return GetDirectories (path, "*");
+ }
+
+ public static string [] GetDirectories (string path, string pattern)
+ {
+ return GetFileSystemEntries (path, pattern, FileAttributes.Directory, FileAttributes.Directory);
+ }
+
+ public static string GetDirectoryRoot (string path)
+ {
+ return "" + Path.DirectorySeparatorChar;
+ }
+
+ public static string [] GetFiles (string path)
+ {
+ return GetFiles (path, "*");
+ }
+
+ public static string [] GetFiles (string path, string pattern)
+ {
+ return GetFileSystemEntries (path, pattern, FileAttributes.Directory, 0);
+ }
+
+ public static string [] GetFileSystemEntries (string path)
+ {
+ return GetFileSystemEntries (path, "*");
+ }
+
+ public static string [] GetFileSystemEntries (string path, string pattern)
+ {
+ return GetFileSystemEntries (path, pattern, 0, 0);
+ }
+
+ public static string[] GetLogicalDrives ()
+ {
+ return new string [] { "A:\\", "C:\\" };
+ }
+
+ public static DirectoryInfo GetParent (string path)
+ {
+ return new DirectoryInfo (Path.GetDirectoryName (path));
+ }
+
+ public static void Move (string src, string dest)
+ {
+ File.Move (src, dest);
+ }
+
+ public static void SetCreationTime (string path, DateTime creation_time)
+ {
+ File.SetCreationTime (path, creation_time);
+ }
+
+ public static void SetCurrentDirectory (string path)
+ {
+ /*
+ // Implementation complete 08/25/2001 14:24 except for
+ // LAMESPEC: documentation specifies invalid exceptions IOException (i think)
+ CheckArgument.Path (path, true);
+ CheckPermission.Demand (FileIOPermissionAccess.Read & FileIOPermissionAccess.Write, path);
+ */
+ if (!Exists (path))
+ {
+ throw new DirectoryNotFoundException ("Directory \"" + path + "\" not found.");
+ }
+ Environment.CurrentDirectory = path;
+ }
+
+ public static void SetLastAccessTime (string path, DateTime last_access_time)
+ {
+ File.SetLastAccessTime (path, last_access_time);
+ }
+
+ public static void SetLastWriteTime (string path, DateTime last_write_time)
+ {
+ File.SetLastWriteTime (path, last_write_time);
+ }
+
+ // private
+
+ private static string [] GetFileSystemEntries (string path, string pattern, FileAttributes mask, FileAttributes attrs)
+ {
+ SearchPattern search;
+ MonoIOStat stat;
+ IntPtr find;
+
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Path contains invalid characters.");
+
+ search = new SearchPattern (pattern);
+
+ find = MonoIO.FindFirstFile (Path.Combine (path , "*"), out stat);
+ if (find == MonoIO.InvalidHandle) {
+ switch (MonoIO.GetLastError ()) {
+ case MonoIOError.ERROR_FILE_NOT_FOUND:
+ case MonoIOError.ERROR_PATH_NOT_FOUND:
+ string message = String.Format ("Could not find a part of the path \"{0}\"", path);
+ throw new DirectoryNotFoundException (message);
+
+ default:
+ throw MonoIO.GetException (path);
+ }
+ }
+
+ ArrayList entries = new ArrayList ();
+
+ while (true) {
+ // Ignore entries of "." and ".." -
+ // the documentation doesn't mention
+ // it (surprise!) but empirical
+ // testing indicates .net never
+ // returns "." or ".." in a
+ // GetDirectories() list.
+ if ((stat.Attributes & mask) == attrs &&
+ search.IsMatch (stat.Name) &&
+ stat.Name != "." &&
+ stat.Name != "..")
+ entries.Add (Path.Combine (path, stat.Name));
+
+ if (!MonoIO.FindNextFile (find, out stat))
+ break;
+ }
+ MonoIO.FindClose (find);
+
+ return (string []) entries.ToArray (typeof (string));
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/DirectoryInfo.cs b/mcs/class/corlib/System.IO/DirectoryInfo.cs
new file mode 100644
index 00000000000..21d0329b5a9
--- /dev/null
+++ b/mcs/class/corlib/System.IO/DirectoryInfo.cs
@@ -0,0 +1,135 @@
+//
+// System.IO.DirectoryInfo.cs
+//
+// Author:
+// Miguel de Icaza, miguel@ximian.com
+// Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis, dihlewis@yahoo.co.uk
+//
+// Copyright (C) 2002 Ximian, Inc.
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+
+using System;
+using System.Collections;
+
+namespace System.IO {
+
+ [Serializable]
+ public sealed class DirectoryInfo : FileSystemInfo {
+
+ public DirectoryInfo (string path) {
+ CheckPath (path);
+
+ OriginalPath = path;
+ FullPath = Path.GetFullPath (path);
+ }
+
+ // properties
+
+ public override bool Exists {
+ get {
+ Refresh (false);
+
+ if (stat.Attributes == MonoIO.InvalidFileAttributes)
+ return false;
+
+ if ((stat.Attributes & FileAttributes.Directory) == 0)
+ return false;
+
+ return true;
+ }
+ }
+
+ public override string Name {
+ get {
+ return Path.GetFileName (FullPath);
+ }
+ }
+
+ public DirectoryInfo Parent {
+ get {
+ return new DirectoryInfo (Path.GetDirectoryName (FullPath));
+ }
+ }
+
+ public DirectoryInfo Root {
+ get {
+ return new DirectoryInfo (Path.GetPathRoot (FullPath));
+ }
+ }
+
+ // creational methods
+
+ public void Create () {
+ Directory.CreateDirectory (FullPath);
+ }
+
+ public DirectoryInfo CreateSubdirectory (string name) {
+ string path = Path.Combine (FullPath, Path.GetFileName (name));
+ Directory.CreateDirectory (path);
+
+ return new DirectoryInfo (path);
+ }
+
+ // directory listing methods
+
+ public FileInfo [] GetFiles () {
+ return GetFiles ("*");
+ }
+
+ public FileInfo [] GetFiles (string pattern) {
+ string [] names = Directory.GetFiles (FullPath, pattern);
+
+ ArrayList infos = new ArrayList ();
+ foreach (string name in names)
+ infos.Add (new FileInfo (name));
+
+ return (FileInfo []) infos.ToArray (typeof (FileInfo));
+ }
+
+ public DirectoryInfo [] GetDirectories () {
+ return GetDirectories ("*");
+ }
+
+ public DirectoryInfo [] GetDirectories (string pattern) {
+ string [] names = Directory.GetDirectories (FullPath, pattern);
+
+ ArrayList infos = new ArrayList ();
+ foreach (string name in names)
+ infos.Add (new DirectoryInfo (name));
+
+ return (DirectoryInfo []) infos.ToArray (typeof (DirectoryInfo));
+ }
+
+ public FileSystemInfo [] GetFileSystemInfos () {
+ return GetFileSystemInfos ("*");
+ }
+
+ public FileSystemInfo [] GetFileSystemInfos (string pattern) {
+ ArrayList infos = new ArrayList ();
+ infos.AddRange (GetDirectories (pattern));
+ infos.AddRange (GetFiles (pattern));
+
+ return (FileSystemInfo []) infos.ToArray (typeof (FileSystemInfo));
+ }
+
+ // directory management methods
+
+ public override void Delete () {
+ Delete (false);
+ }
+
+ public void Delete (bool recurse) {
+ Directory.Delete (FullPath, recurse);
+ }
+
+ public void MoveTo (string dest) {
+ Directory.Move (FullPath, dest);
+ }
+
+ public override string ToString () {
+ return OriginalPath;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/DirectoryNotFoundException.cs b/mcs/class/corlib/System.IO/DirectoryNotFoundException.cs
new file mode 100755
index 00000000000..2f8f3996c2a
--- /dev/null
+++ b/mcs/class/corlib/System.IO/DirectoryNotFoundException.cs
@@ -0,0 +1,30 @@
+//
+// System.IO.DirectoryNotFoundException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.IO {
+
+ [Serializable]
+ public class DirectoryNotFoundException : IOException {
+ // Constructors
+ public DirectoryNotFoundException ()
+ : base ("Directory not found")
+ {
+ }
+
+ public DirectoryNotFoundException (string message)
+ : base (message)
+ {
+ }
+
+ public DirectoryNotFoundException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/EndOfStreamException.cs b/mcs/class/corlib/System.IO/EndOfStreamException.cs
new file mode 100644
index 00000000000..88f8460d87a
--- /dev/null
+++ b/mcs/class/corlib/System.IO/EndOfStreamException.cs
@@ -0,0 +1,43 @@
+//
+// System.IO.EndOfStreamException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO
+{
+ [Serializable]
+ public class EndOfStreamException : IOException
+ {
+ // Constructors
+ public EndOfStreamException ()
+ : base (Locale.GetText ("Failed to read past end of stream."))
+ {
+ }
+
+ public EndOfStreamException (string message)
+ : base (message)
+ {
+ }
+
+ protected EndOfStreamException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public EndOfStreamException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.IO/File.cs b/mcs/class/corlib/System.IO/File.cs
new file mode 100644
index 00000000000..7632041cc57
--- /dev/null
+++ b/mcs/class/corlib/System.IO/File.cs
@@ -0,0 +1,172 @@
+//
+// System.IO.File.cs
+//
+//
+// Authors:
+// Miguel de Icaza (miguel@ximian.com)
+// Jim Richardson (develop@wtfo-guru.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// Copyright 2002 Ximian, Inc. http://www.ximian.com
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+
+using System;
+
+namespace System.IO
+{
+ /// <summary>
+ ///
+ /// </summary>
+ public sealed class File : Object
+ {
+ private File () {}
+
+ public static StreamWriter AppendText (string path)
+ {
+ return new StreamWriter (path, true);
+ }
+
+ public static void Copy (string sourceFilename, string destFilename)
+ {
+ Copy (sourceFilename, destFilename, true);
+ }
+
+ public static void Copy (string src, string dest, bool overwrite)
+ {
+ if (src == null || dest == null)
+ throw new ArgumentNullException ();
+ if (src == "" || dest == null ||
+ src.IndexOfAny (Path.InvalidPathChars) != -1 ||
+ dest.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ();
+
+ if (!MonoIO.CopyFile (src, dest, overwrite))
+ throw MonoIO.GetException ();
+ }
+
+ public static FileStream Create (string path)
+ {
+ return Create (path, 8192);
+ }
+
+ public static FileStream Create (string path, int buffersize)
+ {
+ return new FileStream (path, FileMode.Create, FileAccess.ReadWrite,
+ FileShare.None, buffersize);
+ }
+
+ public static void Delete (string path)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path == "" || path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ();
+
+ if (!MonoIO.DeleteFile (path))
+ throw MonoIO.GetException ();
+ }
+
+ public static bool Exists (string path)
+ {
+ return MonoIO.ExistsFile (path);
+ }
+
+ public static FileAttributes GetAttributes (string path)
+ {
+ return MonoIO.GetFileAttributes (path);
+ }
+
+ public static DateTime GetCreationTime (string path)
+ {
+ MonoIOStat stat;
+
+ MonoIO.GetFileStat (path, out stat);
+ return DateTime.FromFileTime (stat.CreationTime);
+ }
+
+ public static DateTime GetLastAccessTime (string path)
+ {
+ MonoIOStat stat;
+
+ MonoIO.GetFileStat (path, out stat);
+ return DateTime.FromFileTime (stat.LastAccessTime);
+ }
+
+ public static DateTime GetLastWriteTime (string path)
+ {
+ MonoIOStat stat;
+
+ MonoIO.GetFileStat (path, out stat);
+ return DateTime.FromFileTime (stat.LastWriteTime);
+ }
+
+ public static void Move (string src, string dest)
+ {
+ if (src == null || dest == null)
+ throw new ArgumentNullException ();
+ if (src == "" || dest == null ||
+ src.IndexOfAny (Path.InvalidPathChars) != -1 ||
+ dest.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ();
+
+ if (!MonoIO.MoveFile (src, dest))
+ throw MonoIO.GetException ();
+ }
+
+ public static FileStream Open (string path, FileMode mode)
+ {
+ return new FileStream (path, mode, FileAccess.ReadWrite, FileShare.None);
+ }
+
+ public static FileStream Open (string path, FileMode mode, FileAccess access)
+ {
+ return new FileStream (path, mode, access, FileShare.None);
+ }
+
+ public static FileStream Open (string path, FileMode mode, FileAccess access,
+ FileShare share)
+ {
+ return new FileStream (path, mode, access, share);
+ }
+
+ public static FileStream OpenRead (string path)
+ {
+ return new FileStream (path, FileMode.Open, FileAccess.Read, FileShare.Read);
+ }
+
+ public static StreamReader OpenText (string path)
+ {
+ return new StreamReader (path);
+ }
+
+ public static FileStream OpenWrite (string path)
+ {
+ return new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
+ }
+
+ public static void SetAttributes (string path, FileAttributes attributes)
+ {
+ if (!MonoIO.SetFileAttributes (path, attributes))
+ throw MonoIO.GetException (path);
+ }
+
+ public static void SetCreationTime (string path, DateTime creation_time)
+ {
+ if (!MonoIO.SetFileTime (path, creation_time.Ticks, -1, -1))
+ throw MonoIO.GetException (path);
+ }
+
+ public static void SetLastAccessTime (string path, DateTime last_access_time)
+ {
+ if (!MonoIO.SetFileTime (path, -1, last_access_time.Ticks, -1))
+ throw MonoIO.GetException (path);
+ }
+
+ public static void SetLastWriteTime (string path, DateTime last_write_time)
+ {
+ if (!MonoIO.SetFileTime (path, -1, -1, last_write_time.Ticks))
+ throw MonoIO.GetException (path);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileAccess.cs b/mcs/class/corlib/System.IO/FileAccess.cs
new file mode 100644
index 00000000000..c6eefb3aa6f
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileAccess.cs
@@ -0,0 +1,34 @@
+// FileAccess.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:20 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum FileAccess : int {
+
+ /// <summary>
+ /// </summary>
+ Read = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ Write = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ ReadWrite = Read | Write,
+ } // FileAccess
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/FileAttributes.cs b/mcs/class/corlib/System.IO/FileAttributes.cs
new file mode 100644
index 00000000000..3f187be6910
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileAttributes.cs
@@ -0,0 +1,35 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.FileAttributes.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+
+namespace System.IO
+{
+ [Flags]
+ [Serializable]
+ public enum FileAttributes : int
+ {
+ Archive = 0x00020,
+ Compressed = 0x00800,
+ Device = 0x00040, // Reserved for future use (NOT the w32 value).
+ Directory = 0x00010,
+ Encrypted = 0x04000, // NOT the w32 value
+ Hidden = 0x00002,
+ Normal = 0x00080,
+ NotContentIndexed = 0x02000,
+ Offline = 0x01000,
+ ReadOnly = 0x00001,
+ ReparsePoint = 0x00400,
+ SparseFile = 0x00200,
+ System = 0x00004,
+ Temporary = 0x00100
+ }
+
+}
diff --git a/mcs/class/corlib/System.IO/FileInfo.cs b/mcs/class/corlib/System.IO/FileInfo.cs
new file mode 100644
index 00000000000..67bba7536c1
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileInfo.cs
@@ -0,0 +1,135 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.FileInfo.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.IO {
+
+ [Serializable]
+ public sealed class FileInfo : FileSystemInfo {
+
+ public FileInfo (string path) {
+ CheckPath (path);
+
+ OriginalPath = path;
+ FullPath = Path.GetFullPath (path);
+ }
+
+ // public properties
+
+ public override bool Exists {
+ get {
+ Refresh (false);
+
+ if (stat.Attributes == MonoIO.InvalidFileAttributes)
+ return false;
+
+ if ((stat.Attributes & FileAttributes.Directory) != 0)
+ return false;
+
+ return true;
+ }
+ }
+
+ public override string Name {
+ get {
+ return Path.GetFileName (FullPath);
+ }
+ }
+
+ public long Length {
+ get {
+ if (!Exists)
+ throw new FileNotFoundException ("Could not find file \"" + OriginalPath + "\".");
+
+ return stat.Length;
+ }
+ }
+
+ public string DirectoryName {
+ get {
+ return Path.GetDirectoryName (FullPath);
+ }
+ }
+
+ public DirectoryInfo Directory {
+ get {
+ return new DirectoryInfo (DirectoryName);
+ }
+ }
+
+ // streamreader methods
+
+ public StreamReader OpenText () {
+ return new StreamReader (Open (FileMode.Open, FileAccess.Read));
+ }
+
+ public StreamWriter CreateText () {
+ return new StreamWriter (Open (FileMode.Create, FileAccess.Write));
+ }
+
+ public StreamWriter AppendText () {
+ return new StreamWriter (Open (FileMode.Append, FileAccess.Write));
+ }
+
+ // filestream methods
+
+ public FileStream OpenRead () {
+ return Open (FileMode.Open, FileAccess.Read);
+ }
+
+ public FileStream OpenWrite () {
+ return Open (FileMode.OpenOrCreate, FileAccess.Write);
+ }
+
+ public FileStream Open (FileMode mode) {
+ return Open (mode, FileAccess.ReadWrite);
+ }
+
+ public FileStream Open (FileMode mode, FileAccess access) {
+ return Open (mode, access, FileShare.None);
+ }
+
+ public FileStream Open (FileMode mode, FileAccess access, FileShare share) {
+ return new FileStream (FullPath, mode, access, share);
+ }
+
+ // file methods
+
+ public override void Delete () {
+ if (!MonoIO.Exists (FullPath)) // a weird MS.NET behaviour
+ return;
+
+ if (!MonoIO.DeleteFile (FullPath))
+ throw MonoIO.GetException (OriginalPath);
+ }
+
+ public void MoveTo (string dest) {
+ File.Move (FullPath, dest);
+ }
+
+ public FileInfo CopyTo (string path) {
+ return CopyTo (path, false);
+ }
+
+ public FileInfo CopyTo (string path, bool overwrite) {
+ string dest = Path.GetFullPath (path);
+ File.Copy (FullPath, dest);
+
+ return new FileInfo (dest);
+ }
+
+ public override string ToString () {
+ return OriginalPath;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileLoadException.cs b/mcs/class/corlib/System.IO/FileLoadException.cs
new file mode 100755
index 00000000000..8190cf8991d
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileLoadException.cs
@@ -0,0 +1,76 @@
+//
+// System.IO.FileLoadException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO {
+ [Serializable]
+ public class FileLoadException : IOException {
+
+ // Fields
+ string msg;
+ Exception inner;
+ string fileName;
+ string fusionLog;
+
+ // Constructors
+ public FileLoadException ()
+ : base (Locale.GetText ("I/O Error"))
+ {
+ msg = Locale.GetText ("I/O Error");
+ }
+
+ public FileLoadException (string message)
+ : base (message)
+ {
+ msg = message;
+ }
+
+ public FileLoadException (string message, Exception inner)
+ : base (message, inner)
+ {
+ msg = message;
+ this.inner = inner;
+ }
+
+ protected FileLoadException (SerializationInfo info, StreamingContext context)
+ {
+ fileName = info.GetString ("FileLoad_FileName");
+ fusionLog = info.GetString ("FileLoad_FusionLog");
+ }
+
+ // Properties
+ public override string Message
+ {
+ get { return msg; }
+ }
+
+ public string FileName
+ {
+ get { return fileName; }
+ }
+
+ public string FusionLog
+ {
+ get { return fusionLog; }
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("FileLoad_FileName", fileName);
+ info.AddValue ("FileLoad_FusionLog", fusionLog);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileMode.cs b/mcs/class/corlib/System.IO/FileMode.cs
new file mode 100644
index 00000000000..c32a53408bf
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileMode.cs
@@ -0,0 +1,45 @@
+// FileMode.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:13 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ public enum FileMode {
+
+ /// <summary>
+ /// </summary>
+ CreateNew = 1,
+
+ /// <summary>
+ /// </summary>
+ Create = 2,
+
+ /// <summary>
+ /// </summary>
+ Open = 3,
+
+ /// <summary>
+ /// </summary>
+ OpenOrCreate = 4,
+
+ /// <summary>
+ /// </summary>
+ Truncate = 5,
+
+ /// <summary>
+ /// </summary>
+ Append = 6,
+ } // FileMode
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/FileNotFoundException.cs b/mcs/class/corlib/System.IO/FileNotFoundException.cs
new file mode 100755
index 00000000000..a3b3308367e
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileNotFoundException.cs
@@ -0,0 +1,92 @@
+//
+// System.IO.FileNotFoundException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO {
+
+ [Serializable]
+ public class FileNotFoundException : IOException {
+ private string fileName;
+ private string fusionLog;
+ private string msg;
+ private Exception inner;
+
+ // Constructors
+ public FileNotFoundException ()
+ : base (Locale.GetText ("File not found"))
+ {
+ msg = "File not found";
+ }
+
+ public FileNotFoundException (string message)
+ : base (message)
+ {
+ msg = message;
+ }
+
+ public FileNotFoundException (string message, Exception inner)
+ : base (message, inner)
+ {
+ msg = message;
+ this.inner = inner;
+ }
+
+ public FileNotFoundException (string message, string fileName)
+ : base (message)
+ {
+ msg = message;
+ this.fileName = fileName;
+ }
+
+ public FileNotFoundException (string message, string fileName, Exception innerException)
+ : base (message, innerException)
+ {
+ msg = message;
+ this.fileName = fileName;
+ inner = innerException;
+ }
+
+ protected FileNotFoundException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ fileName = info.GetString ("FileNotFound_FileName");
+ fusionLog = info.GetString ("FileNotFound_FusionLog");
+
+ }
+
+ public string FileName
+ {
+ get { return fileName; }
+ }
+
+ public string FusionLog
+ {
+ get { return fusionLog; }
+ }
+
+ public override string Message
+ {
+ get { return Locale.GetText (msg); }
+ }
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("FileNotFound_FileName", fileName);
+ info.AddValue ("FileNotFound_FusionLog", fusionLog);
+ }
+
+ public override string ToString ()
+ {
+ return inner.ToString();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileShare.cs b/mcs/class/corlib/System.IO/FileShare.cs
new file mode 100644
index 00000000000..626b369e75a
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileShare.cs
@@ -0,0 +1,38 @@
+// FileShare.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:26 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum FileShare : int {
+
+ /// <summary>
+ /// </summary>
+ None = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ Read = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ Write = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ ReadWrite = Read | Write,
+ } // FileShare
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/FileStream.cs b/mcs/class/corlib/System.IO/FileStream.cs
new file mode 100644
index 00000000000..cd0eda9f171
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileStream.cs
@@ -0,0 +1,339 @@
+//
+// System.IO/FileStream.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+// FIXME: emit the correct exceptions everywhere. add error handling.
+
+namespace System.IO
+{
+
+ public class FileStream : Stream
+ {
+ // construct from handle
+
+ public FileStream (IntPtr handle, FileAccess access)
+ : this (handle, access, true, DefaultBufferSize, false) {}
+
+ public FileStream (IntPtr handle, FileAccess access, bool ownsHandle)
+ : this (handle, access, ownsHandle, DefaultBufferSize, false) {}
+
+ public FileStream (IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize)
+ : this (handle, access, ownsHandle, bufferSize, false) {}
+
+ public FileStream (IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync)
+ {
+ this.handle = handle;
+ this.access = access;
+ this.owner = ownsHandle;
+ this.async = isAsync;
+
+ InitBuffer (bufferSize);
+ }
+
+ // construct from filename
+
+ public FileStream (string name, FileMode mode)
+ : this (name, mode, FileAccess.ReadWrite, FileShare.ReadWrite, DefaultBufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access)
+ : this (name, mode, access, FileShare.ReadWrite, DefaultBufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access, FileShare share)
+ : this (name, mode, access, share, DefaultBufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize)
+ : this (name, mode, access, share, bufferSize, false) { }
+
+ public FileStream (string name, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool isAsync)
+ {
+ if (name == null)
+ throw new ArgumentNullException ();
+ if (name == "" || name.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ();
+
+ // TODO: demand permissions
+
+ this.handle = MonoIO.Open (name, mode, access, share);
+ if (handle == MonoIO.InvalidHandle)
+ throw MonoIO.GetException ();
+
+ this.access = access;
+ this.owner = true;
+ this.async = isAsync;
+
+ InitBuffer (bufferSize);
+ }
+
+ // properties
+
+ public override bool CanRead {
+ get {
+ return access == FileAccess.Read ||
+ access == FileAccess.ReadWrite;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return access == FileAccess.Write ||
+ access == FileAccess.ReadWrite;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return true; // FIXME: false for pipes & streams
+ }
+ }
+
+ public override long Length {
+ get { return MonoIO.GetLength (handle); }
+ }
+
+ public override long Position {
+ get { return buf_start + buf_offset; }
+ set { Seek (value, SeekOrigin.Begin); }
+ }
+
+ public virtual IntPtr Handle {
+ get { return handle; }
+ }
+
+ // methods
+
+ public override int ReadByte ()
+ {
+ if (buf_offset >= buf_length) {
+ RefillBuffer ();
+
+ if (buf_length == 0)
+ return -1;
+ }
+
+ return buf [buf_offset ++];
+ }
+
+ public override void WriteByte (byte value)
+ {
+ if (buf_offset == buf_size)
+ FlushBuffer ();
+
+ buf [buf_offset ++] = value;
+ if (buf_offset > buf_length)
+ buf_length = buf_offset;
+
+ buf_dirty = true;
+ }
+
+ public override int Read (byte[] dest, int dest_offset, int count)
+ {
+ int copied = 0;
+ while (count > 0) {
+ int n = ReadSegment (dest, dest_offset + copied, count);
+ copied += n;
+ count -= n;
+
+ if (count == 0)
+ break;
+
+ if (count > buf_size) { // shortcut for long reads
+ FlushBuffer ();
+
+ MonoIO.Seek (handle, buf_start, SeekOrigin.Begin);
+ n = MonoIO.Read (handle, dest, dest_offset + copied, count);
+
+ copied += n;
+ buf_start += n;
+ break;
+ }
+
+ RefillBuffer ();
+ if (buf_length == 0)
+ break;
+ }
+
+ return copied;
+ }
+
+ public override void Write (byte[] src, int src_offset, int count)
+ {
+ int copied = 0;
+ while (count > 0) {
+ int n = WriteSegment (src, src_offset + copied, count);
+ copied += n;
+ count -= n;
+
+ if (count == 0)
+ break;
+
+ FlushBuffer ();
+
+ if (count > buf_size) { // shortcut for long writes
+ MonoIO.Write (handle, src, src_offset + copied, count);
+ buf_start += count;
+ break;
+ }
+ }
+ }
+
+ public override long Seek (long offset, SeekOrigin origin)
+ {
+ long pos;
+
+ // make absolute
+
+ switch (origin) {
+ case SeekOrigin.End:
+ pos = Length - offset;
+ break;
+
+ case SeekOrigin.Current:
+ pos = Position + offset;
+ break;
+
+ case SeekOrigin.Begin: default:
+ pos = offset;
+ break;
+ }
+
+ if (pos >= buf_start && pos <= buf_start + buf_length) {
+ buf_offset = (int) (pos - buf_start);
+ return pos;
+ }
+
+ FlushBuffer ();
+ buf_start = MonoIO.Seek (handle, pos, SeekOrigin.Begin);
+
+ return buf_start;
+ }
+
+ public override void SetLength (long length)
+ {
+ Flush ();
+ MonoIO.SetLength (handle, length);
+ }
+
+ public override void Flush ()
+ {
+ FlushBuffer ();
+ MonoIO.Flush (handle);
+ }
+
+ public override void Close ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this); // remove from finalize queue
+ }
+
+ public override void Dispose ()
+ {
+ Close ();
+ }
+
+ // protected
+
+ ~FileStream ()
+ {
+ Dispose (false);
+ }
+
+ protected override void Dispose (bool disposing) {
+ if (handle != MonoIO.InvalidHandle) {
+ Flush ();
+ MonoIO.Close (handle);
+
+ handle = MonoIO.InvalidHandle;
+ }
+
+ if (disposing)
+ buf = null;
+ }
+
+ // private
+
+ private int ReadSegment (byte [] dest, int dest_offset, int count)
+ {
+ if (count > buf_length - buf_offset)
+ count = buf_length - buf_offset;
+
+ if (count > 0) {
+ Buffer.BlockCopy (buf, buf_offset, dest, dest_offset, count);
+ buf_offset += count;
+ }
+
+ return count;
+ }
+
+ private int WriteSegment (byte [] src, int src_offset, int count)
+ {
+ if (count > buf_size - buf_offset)
+ count = buf_size - buf_offset;
+
+ if (count > 0) {
+ Buffer.BlockCopy (src, src_offset, buf, buf_offset, count);
+ buf_offset += count;
+ if (buf_offset > buf_length)
+ buf_length = buf_offset;
+
+ buf_dirty = true;
+ }
+
+ return count;
+ }
+
+ private void FlushBuffer ()
+ {
+ if (buf_dirty) {
+ MonoIO.Seek (handle, buf_start, SeekOrigin.Begin);
+ MonoIO.Write (handle, buf, 0, buf_length);
+ }
+
+ buf_start += buf_length;
+ buf_offset = buf_length = 0;
+ buf_dirty = false;
+ }
+
+ private void RefillBuffer ()
+ {
+ FlushBuffer ();
+
+ MonoIO.Seek (handle, buf_start, SeekOrigin.Begin);
+ buf_length = MonoIO.Read (handle, buf, 0, buf_size);
+ }
+
+ private void InitBuffer (int size)
+ {
+ buf = new byte [size];
+ buf_size = size;
+ buf_start = 0;
+ buf_offset = buf_length = 0;
+ buf_dirty = false;
+ }
+
+ // fields
+
+ private static int DefaultBufferSize = 8192;
+
+ private FileAccess access;
+ private bool owner;
+ private bool async;
+
+ private byte [] buf; // the buffer
+ private int buf_size; // capacity in bytes
+ private int buf_length; // number of valid bytes in buffer
+ private int buf_offset; // position of next byte
+ private bool buf_dirty; // true if buffer has been written to
+ private long buf_start; // location of buffer in file
+
+ IntPtr handle; // handle to underlying file
+ }
+}
diff --git a/mcs/class/corlib/System.IO/FileSystemInfo.cs b/mcs/class/corlib/System.IO/FileSystemInfo.cs
new file mode 100644
index 00000000000..b03e43395cd
--- /dev/null
+++ b/mcs/class/corlib/System.IO/FileSystemInfo.cs
@@ -0,0 +1,133 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.FileSystemInfo.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Created: Monday, August 13, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.IO {
+
+ [Serializable]
+ public abstract class FileSystemInfo : MarshalByRefObject {
+ // public properties
+
+ public abstract bool Exists { get; }
+
+ public abstract string Name { get; }
+
+ public virtual string FullName {
+ get {
+ return FullPath;
+ }
+ }
+
+ public string Extension {
+ get {
+ return Path.GetExtension (Name);
+ }
+ }
+
+ public FileAttributes Attributes {
+ get {
+ Refresh (false);
+ return stat.Attributes;
+ }
+
+ set {
+ if (!MonoIO.SetFileAttributes (FullName, value))
+ throw MonoIO.GetException ();
+ }
+ }
+
+ public DateTime CreationTime {
+ get {
+ Refresh (false);
+ return DateTime.FromFileTime (stat.CreationTime);
+ }
+
+ set {
+ long filetime = value.ToFileTime ();
+
+ if (!MonoIO.SetFileTime (FullName, filetime, -1, -1))
+ throw MonoIO.GetException ();
+ }
+ }
+
+ public DateTime LastAccessTime {
+ get {
+ Refresh (false);
+ return DateTime.FromFileTime (stat.LastAccessTime);
+ }
+
+ set {
+ long filetime = value.ToFileTime ();
+
+ if (!MonoIO.SetFileTime (FullName, -1, filetime, -1))
+ throw MonoIO.GetException ();
+ }
+ }
+
+ public DateTime LastWriteTime {
+ get {
+ Refresh (false);
+ return DateTime.FromFileTime (stat.LastWriteTime);
+ }
+
+ set {
+ long filetime = value.ToFileTime ();
+
+ if (!MonoIO.SetFileTime (FullName, -1, -1, filetime))
+ throw MonoIO.GetException ();
+ }
+ }
+
+ // public methods
+
+ public abstract void Delete ();
+
+ public void Refresh ()
+ {
+ Refresh (true);
+ }
+
+ // protected
+
+ protected FileSystemInfo ()
+ {
+ this.valid = false;
+ this.FullPath = null;
+ }
+
+ protected string FullPath;
+ protected string OriginalPath;
+
+ // internal
+
+ internal void Refresh (bool force)
+ {
+ if (valid && !force)
+ return;
+
+ MonoIO.GetFileStat (FullName, out stat);
+ valid = true;
+ }
+
+ internal void CheckPath (string path)
+ {
+ if (path == null)
+ throw new ArgumentNullException ();
+ if (path.IndexOfAny (Path.InvalidPathChars) != -1)
+ throw new ArgumentException ("Invalid characters in path.");
+ }
+
+ internal MonoIOStat stat;
+ internal bool valid;
+ }
+}
diff --git a/mcs/class/corlib/System.IO/IOException.cs b/mcs/class/corlib/System.IO/IOException.cs
new file mode 100644
index 00000000000..74593cd03cf
--- /dev/null
+++ b/mcs/class/corlib/System.IO/IOException.cs
@@ -0,0 +1,43 @@
+//
+// System.IO.IOException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System.IO {
+ [Serializable]
+ public class IOException : SystemException {
+
+ // Constructors
+ public IOException ()
+ : base ("I/O Error")
+ {
+ }
+
+ public IOException (string message)
+ : base (message)
+ {
+ }
+
+ public IOException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected IOException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public IOException (string message, int hresult)
+ : base (message)
+ {
+ this.HResult = hresult;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/MemoryStream.cs b/mcs/class/corlib/System.IO/MemoryStream.cs
new file mode 100644
index 00000000000..407a453e124
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MemoryStream.cs
@@ -0,0 +1,404 @@
+//
+// System.IO.MemoryStream
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Clarify some of the lamespec issues
+//
+
+namespace System.IO {
+ [Serializable]
+ public class MemoryStream : Stream {
+ private bool canRead;
+ private bool canSeek;
+ private bool canWrite;
+
+ private bool allowGetBuffer;
+
+ private int capacity;
+
+ private byte[] internalBuffer;
+
+ private int initialLength;
+ private bool expandable;
+
+ private bool streamClosed = false;
+
+ private long position = 0;
+
+ public MemoryStream() {
+ canRead = true;
+ canSeek = true;
+ canWrite = true;
+
+ capacity = 0;
+
+ internalBuffer = new byte[0];
+
+ allowGetBuffer = true;
+ expandable = true;
+ }
+
+ public MemoryStream( byte[] buffer ) {
+ InternalConstructor( buffer, 0, buffer.Length, true, false );
+ }
+
+ public MemoryStream( int capacity ) {
+
+ canRead = true;
+ canSeek = true;
+ canWrite = true;
+
+ this.capacity = capacity;
+ initialLength = capacity;
+ internalBuffer = new byte[ capacity ];
+
+ expandable = true;
+ allowGetBuffer = true;
+ }
+
+ public MemoryStream( byte[] buffer, bool writeable ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ }
+
+ InternalConstructor( buffer, 0, buffer.Length, writeable, true );
+
+ }
+
+ public MemoryStream( byte[] buffer, int index, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ }
+
+ InternalConstructor( buffer, index, count, true, false );
+ }
+
+ public MemoryStream( byte[] buffer, int index, int count, bool writeable ) {
+
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ }
+
+ InternalConstructor( buffer, index, count, writeable, true );
+ }
+
+ public MemoryStream( byte[] buffer, int index, int count, bool writeable, bool publicallyVisible ) {
+ InternalConstructor( buffer, index, count, writeable, publicallyVisible );
+ }
+
+ private void InternalConstructor( byte[] buffer, int index, int count, bool writeable, bool publicallyVisible ) {
+
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if ( index < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if ( buffer.Length - index < count ) {
+ throw new ArgumentException();
+ }
+
+ // LAMESPEC: The spec says to throw an UnauthorisedAccessException if
+ // publicallyVisibile is fale?! Doesn't that defy the point of having
+ // it there in the first place. I'll leave it out for now.
+
+ canRead = true;
+ canSeek = true;
+ canWrite = writeable;
+
+ initialLength = count;
+
+ internalBuffer = new byte[ count ];
+ capacity = count;
+
+ Array.Copy( buffer, index, internalBuffer, 0, count );
+
+ allowGetBuffer = publicallyVisible;
+ expandable = false;
+ }
+
+ public override bool CanRead {
+ get {
+ return this.canRead;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return this.canSeek;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return this.canWrite;
+ }
+ }
+
+ public virtual int Capacity {
+ get {
+ return this.capacity;
+ }
+
+ set {
+ if( value < 0 || value < capacity ) {
+ throw new ArgumentOutOfRangeException( "New capacity cannot be negative or less than the current capacity" );
+ } else if( !expandable ) {
+ throw new NotSupportedException( "Cannot expand this MemoryStream" );
+ }
+
+ byte[] newBuffer = new byte[ value ];
+ Array.Copy( internalBuffer, 0, newBuffer, 0, capacity );
+ capacity = value;
+ }
+ }
+
+ public override long Length {
+ get {
+ // LAMESPEC: The spec says to throw an IOException if the
+ // stream is closed and an ObjectDisposedException if
+ // "methods were called after the stream was closed". What
+ // is the difference?
+
+ if( streamClosed ) {
+ throw new IOException( "MemoryStream is closed" );
+ }
+
+ return internalBuffer.Length;
+ }
+ }
+
+ public override long Position {
+ get {
+ if( streamClosed ) {
+ throw new IOException( "MemoryStream is closed" );
+ }
+
+ return position;
+ }
+
+ set {
+
+ if( position < 0 ) {
+ throw new ArgumentOutOfRangeException( "Position cannot be negative" );
+ } else if( streamClosed ) {
+ throw new IOException( "MemoryStream is closed" );
+ }
+
+ position = value;
+
+ if( position > internalBuffer.Length + 1 ) {
+ position = internalBuffer.Length + 1;
+ }
+ }
+ }
+
+ public override void Close() {
+ if( streamClosed ) {
+ throw new IOException( "MemoryStream already closed" );
+ }
+
+ streamClosed = true;
+ Dispose( true );
+ }
+
+ protected override void Dispose( bool disposing ) { }
+
+ public override void Flush() { }
+
+ public virtual byte[] GetBuffer() {
+ if( !allowGetBuffer ) {
+ throw new UnauthorizedAccessException();
+ }
+
+ return internalBuffer;
+ }
+
+ public override int Read( byte[] buffer, int offset, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( offset < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if( buffer.Length - offset < count ) {
+ throw new ArgumentException();
+ } else if ( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+ long ReadTo;
+
+ if( position + count > internalBuffer.Length ) {
+ ReadTo = internalBuffer.Length;
+ } else {
+ ReadTo = position + (long)count;
+ }
+
+ Array.Copy( internalBuffer, (int)position, buffer, offset, (int)(ReadTo - position) );
+
+ int bytesRead = (int)(ReadTo - position);
+
+ position = ReadTo;
+
+ return bytesRead;
+ }
+
+ public override int ReadByte( ) {
+ if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+
+ // LAMESPEC: What happens if we're at the end of the stream? It's unspecified in the
+ // docs but tests against the MS impl. show it returns -1
+ //
+
+ if( position >= internalBuffer.Length ) {
+ return -1;
+ } else {
+ return internalBuffer[ position++ ];
+ }
+ }
+
+ public override long Seek( long offset, SeekOrigin loc ) {
+ long refPoint;
+
+ if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+ switch( loc ) {
+ case SeekOrigin.Begin:
+ refPoint = 0;
+ break;
+ case SeekOrigin.Current:
+ refPoint = position;
+ break;
+ case SeekOrigin.End:
+ refPoint = internalBuffer.Length;
+ break;
+ default:
+ throw new ArgumentException( "Invalid SeekOrigin" );
+ }
+
+ // LAMESPEC: My goodness, how may LAMESPECs are there in this
+ // class! :) In the spec for the Position property it's stated
+ // "The position must not be more than one byte beyond the end of the stream."
+ // In the spec for seek it says "Seeking to any location beyond the length of the
+ // stream is supported." That's a contradiction i'd say.
+ // I guess seek can go anywhere but if you use position it may get moved back.
+
+ if( refPoint + offset < 0 ) {
+ throw new IOException( "Attempted to seek before start of MemoryStream" );
+ } else if( offset > internalBuffer.Length ) {
+ throw new ArgumentOutOfRangeException( "Offset cannot be greater than length of MemoryStream" );
+ }
+
+ position = refPoint + offset;
+
+ return position;
+ }
+
+
+ public override void SetLength( long value ) {
+ if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ } else if( !expandable && value > capacity ) {
+ throw new NotSupportedException( "Expanding this MemoryStream is not supported" );
+ } else if( !canWrite ) {
+ throw new IOException( "Cannot write to this MemoryStream" );
+ } else if( value < 0 ) {
+
+ // LAMESPEC: AGAIN! It says to throw this exception if value is
+ // greater than "the maximum length of the MemoryStream". I haven't
+ // seen anywhere mention what the maximum length of a MemoryStream is and
+ // since we're this far this memory stream is expandable.
+
+ throw new ArgumentOutOfRangeException();
+ }
+
+ byte[] newBuffer;
+ newBuffer = new byte[ value ];
+
+ if( value < capacity ) {
+ // truncate
+ Array.Copy( internalBuffer, 0, newBuffer, 0, (int)value );
+ } else {
+ // expand
+ Array.Copy( internalBuffer, 0, newBuffer, 0, internalBuffer.Length );
+ }
+ internalBuffer = newBuffer;
+ capacity = (int)value;
+
+ }
+
+
+ public virtual byte[] ToArray() {
+
+ if( streamClosed ) {
+ throw new ArgumentException( "The MemoryStream has been closed" );
+ }
+
+ byte[] outBuffer = new byte[capacity];
+ Array.Copy( internalBuffer, 0, outBuffer, 0, capacity);
+ return outBuffer;
+ }
+
+ // LAMESPEC: !! It says that "offset" is "offset in buffer at which
+ // to begin writing", I presume this should be "offset in buffer at which
+ // to begin reading"
+
+ public override void Write( byte[] buffer, int offset, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( !canWrite ) {
+ throw new NotSupportedException();
+ } else if( buffer.Length - offset < count ) {
+ throw new ArgumentException();
+ } else if( offset < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+ if( position + count > capacity ) {
+ if( expandable ) {
+ // expand the buffer
+ SetLength( position + count );
+ } else {
+ // only write as many bytes as will fit
+ count = (int)((long)capacity - position);
+ }
+ }
+
+ Array.Copy( buffer, offset, internalBuffer, (int)position, count );
+ position += count;
+
+ }
+
+
+ public override void WriteByte( byte value ) {
+ if( streamClosed ) {
+ throw new ObjectDisposedException( "MemoryStream" );
+ }
+
+ if( position >= capacity ) {
+ SetLength( capacity + 1 );
+ }
+
+ internalBuffer[ position++ ] = value;
+ }
+
+
+ public virtual void WriteTo( Stream stream ) {
+ if( stream == null ) {
+ throw new ArgumentNullException();
+ }
+
+ stream.Write( internalBuffer, 0, internalBuffer.Length );
+
+ }
+
+
+ }
+
+
+}
diff --git a/mcs/class/corlib/System.IO/MonoIO.cs b/mcs/class/corlib/System.IO/MonoIO.cs
new file mode 100644
index 00000000000..e9cddbdb2db
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MonoIO.cs
@@ -0,0 +1,221 @@
+//
+// System.IO.MonoIO.cs: static interface to native filesystem.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.IO
+{
+ internal sealed class MonoIO {
+ public static readonly FileAttributes
+ InvalidFileAttributes = (FileAttributes)(-1);
+
+ public static readonly IntPtr
+ InvalidHandle = (IntPtr)(-1);
+
+ // error methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static MonoIOError GetLastError ();
+
+ public static Exception GetException ()
+ {
+ return GetException (String.Empty);
+ }
+
+ public static Exception GetException (string path)
+ {
+ MonoIOError error = GetLastError ();
+ string message;
+
+ switch (error) {
+ // FIXME: add more exception mappings here
+ case MonoIOError.ERROR_FILE_NOT_FOUND:
+ message = String.Format ("Could not find file \"{0}\"", path);
+ return new FileNotFoundException (message);
+
+ case MonoIOError.ERROR_PATH_NOT_FOUND:
+ message = String.Format ("Could not find a part of the path \"{0}\"", path);
+ return new DirectoryNotFoundException (message);
+
+ case MonoIOError.ERROR_ACCESS_DENIED:
+ message = String.Format ("Access to the path \"{0}\" is denied.", path);
+ return new UnauthorizedAccessException (message);
+
+ default:
+ message = String.Format ("Win32 IO returned {0}", error);
+ return new IOException (message);
+ }
+ }
+
+ // directory methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool CreateDirectory (string path);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool RemoveDirectory (string path);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static IntPtr FindFirstFile (string path, out MonoIOStat stat);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool FindNextFile (IntPtr find, out MonoIOStat stat);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool FindClose (IntPtr find);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static string GetCurrentDirectory ();
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetCurrentDirectory (string path);
+
+ // file methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool MoveFile (string path, string dest);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool CopyFile (string path, string dest, bool overwrite);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool DeleteFile (string path);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static FileAttributes GetFileAttributes (string path);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetFileAttributes (string path, FileAttributes attrs);
+
+ public static bool Exists (string path)
+ {
+ FileAttributes attrs = GetFileAttributes (path);
+ if (attrs == InvalidFileAttributes)
+ return false;
+
+ return true;
+ }
+
+ public static bool ExistsFile (string path)
+ {
+ FileAttributes attrs = GetFileAttributes (path);
+ if (attrs == InvalidFileAttributes)
+ return false;
+
+ if ((attrs & FileAttributes.Directory) != 0)
+ return false;
+
+ return true;
+ }
+
+ public static bool ExistsDirectory (string path)
+ {
+ FileAttributes attrs = GetFileAttributes (path);
+ if (attrs == InvalidFileAttributes)
+ return false;
+
+ if ((attrs & FileAttributes.Directory) == 0)
+ return false;
+
+ return true;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool GetFileStat (string path, out MonoIOStat stat);
+
+ // handle methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static IntPtr Open (string filename, FileMode mode, FileAccess access, FileShare share);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool Close (IntPtr handle);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static int Read (IntPtr handle, byte [] dest, int dest_offset, int count);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static int Write (IntPtr handle, byte [] src, int src_offset, int count);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static long Seek (IntPtr handle, long offset, SeekOrigin origin);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool Flush (IntPtr handle);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static long GetLength (IntPtr handle);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetLength (IntPtr handle, long length);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static bool SetFileTime (IntPtr handle, long creation_time, long last_access_time, long last_write_time);
+
+ public static bool SetFileTime (string path, long creation_time, long last_access_time, long last_write_time)
+ {
+ IntPtr handle;
+ bool result;
+
+ handle = Open (path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
+ if (handle == IntPtr.Zero)
+ return false;
+
+ result = SetFileTime (handle, creation_time, last_access_time, last_write_time);
+ Close (handle);
+
+ return result;
+ }
+
+ // console handles
+
+ public extern static IntPtr ConsoleOutput {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static IntPtr ConsoleInput {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static IntPtr ConsoleError {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ // path characters
+
+ public extern static char VolumeSeparatorChar {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char DirectorySeparatorChar {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char AltDirectorySeparatorChar {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char PathSeparator {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern static char [] InvalidPathChars {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/MonoIOError.cs b/mcs/class/corlib/System.IO/MonoIOError.cs
new file mode 100644
index 00000000000..6996b6b1253
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MonoIOError.cs
@@ -0,0 +1,1798 @@
+//
+// System.IO.MonoIOError.cs: Win32 error codes. Yuck.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.IO
+{
+ internal enum MonoIOError {
+ ERROR_SUCCESS = 0,
+ ERROR_INVALID_FUNCTION = 1,
+ ERROR_FILE_NOT_FOUND = 2,
+ ERROR_PATH_NOT_FOUND = 3,
+ ERROR_TOO_MANY_OPEN_FILES = 4,
+ ERROR_ACCESS_DENIED = 5,
+ ERROR_INVALID_HANDLE = 6,
+ ERROR_ARENA_TRASHED = 7,
+ ERROR_NOT_ENOUGH_MEMORY = 8,
+ ERROR_INVALID_BLOCK = 9,
+ ERROR_BAD_ENVIRONMENT = 10,
+ ERROR_BAD_FORMAT = 11,
+ ERROR_INVALID_ACCESS = 12,
+ ERROR_INVALID_DATA = 13,
+ ERROR_OUTOFMEMORY = 14,
+ ERROR_INVALID_DRIVE = 15,
+ ERROR_CURRENT_DIRECTORY = 16,
+ ERROR_NOT_SAME_DEVICE = 17,
+ ERROR_NO_MORE_FILES = 18,
+ ERROR_WRITE_PROTECT = 19,
+ ERROR_BAD_UNIT = 20,
+ ERROR_NOT_READY = 21,
+ ERROR_BAD_COMMAND = 22,
+ ERROR_CRC = 23,
+ ERROR_BAD_LENGTH = 24,
+ ERROR_SEEK = 25,
+ ERROR_NOT_DOS_DISK = 26,
+ ERROR_SECTOR_NOT_FOUND = 27,
+ ERROR_OUT_OF_PAPER = 28,
+ ERROR_WRITE_FAULT = 29,
+ ERROR_READ_FAULT = 30,
+ ERROR_GEN_FAILURE = 31,
+ ERROR_SHARING_VIOLATION = 32,
+ ERROR_LOCK_VIOLATION = 33,
+ ERROR_WRONG_DISK = 34,
+ ERROR_SHARING_BUFFER_EXCEEDED = 36,
+ ERROR_HANDLE_EOF = 38,
+ ERROR_HANDLE_DISK_FULL = 39,
+ ERROR_NOT_SUPPORTED = 50,
+ ERROR_REM_NOT_LIST = 51,
+ ERROR_DUP_NAME = 52,
+ ERROR_BAD_NETPATH = 53,
+ ERROR_NETWORK_BUSY = 54,
+ ERROR_DEV_NOT_EXIST = 55,
+ ERROR_TOO_MANY_CMDS = 56,
+ ERROR_ADAP_HDW_ERR = 57,
+ ERROR_BAD_NET_RESP = 58,
+ ERROR_UNEXP_NET_ERR = 59,
+ ERROR_BAD_REM_ADAP = 60,
+ ERROR_PRINTQ_FULL = 61,
+ ERROR_NO_SPOOL_SPACE = 62,
+ ERROR_PRINT_CANCELLED = 63,
+ ERROR_NETNAME_DELETED = 64,
+ ERROR_NETWORK_ACCESS_DENIED = 65,
+ ERROR_BAD_DEV_TYPE = 66,
+ ERROR_BAD_NET_NAME = 67,
+ ERROR_TOO_MANY_NAMES = 68,
+ ERROR_TOO_MANY_SESS = 69,
+ ERROR_SHARING_PAUSED = 70,
+ ERROR_REQ_NOT_ACCEP = 71,
+ ERROR_REDIR_PAUSED = 72,
+ ERROR_FILE_EXISTS = 80,
+ ERROR_CANNOT_MAKE = 82,
+ ERROR_FAIL_I24 = 83,
+ ERROR_OUT_OF_STRUCTURES = 84,
+ ERROR_ALREADY_ASSIGNED = 85,
+ ERROR_INVALID_PASSWORD = 86,
+ ERROR_INVALID_PARAMETER = 87,
+ ERROR_NET_WRITE_FAULT = 88,
+ ERROR_NO_PROC_SLOTS = 89,
+ ERROR_TOO_MANY_SEMAPHORES = 100,
+ ERROR_EXCL_SEM_ALREADY_OWNED = 101,
+ ERROR_SEM_IS_SET = 102,
+ ERROR_TOO_MANY_SEM_REQUESTS = 103,
+ ERROR_INVALID_AT_INTERRUPT_TIME = 104,
+ ERROR_SEM_OWNER_DIED = 105,
+ ERROR_SEM_USER_LIMIT = 106,
+ ERROR_DISK_CHANGE = 107,
+ ERROR_DRIVE_LOCKED = 108,
+ ERROR_BROKEN_PIPE = 109,
+ ERROR_OPEN_FAILED = 110,
+ ERROR_BUFFER_OVERFLOW = 111,
+ ERROR_DISK_FULL = 112,
+ ERROR_NO_MORE_SEARCH_HANDLES = 113,
+ ERROR_INVALID_TARGET_HANDLE = 114,
+ ERROR_INVALID_CATEGORY = 117,
+ ERROR_INVALID_VERIFY_SWITCH = 118,
+ ERROR_BAD_DRIVER_LEVEL = 119,
+ ERROR_CALL_NOT_IMPLEMENTED = 120,
+ ERROR_SEM_TIMEOUT = 121,
+ ERROR_INSUFFICIENT_BUFFER = 122,
+ ERROR_INVALID_NAME = 123,
+ ERROR_INVALID_LEVEL = 124,
+ ERROR_NO_VOLUME_LABEL = 125,
+ ERROR_MOD_NOT_FOUND = 126,
+ ERROR_PROC_NOT_FOUND = 127,
+ ERROR_WAIT_NO_CHILDREN = 128,
+ ERROR_CHILD_NOT_COMPLETE = 129,
+ ERROR_DIRECT_ACCESS_HANDLE = 130,
+ ERROR_NEGATIVE_SEEK = 131,
+ ERROR_SEEK_ON_DEVICE = 132,
+ ERROR_IS_JOIN_TARGET = 133,
+ ERROR_IS_JOINED = 134,
+ ERROR_IS_SUBSTED = 135,
+ ERROR_NOT_JOINED = 136,
+ ERROR_NOT_SUBSTED = 137,
+ ERROR_JOIN_TO_JOIN = 138,
+ ERROR_SUBST_TO_SUBST = 139,
+ ERROR_JOIN_TO_SUBST = 140,
+ ERROR_SUBST_TO_JOIN = 141,
+ ERROR_BUSY_DRIVE = 142,
+ ERROR_SAME_DRIVE = 143,
+ ERROR_DIR_NOT_ROOT = 144,
+ ERROR_DIR_NOT_EMPTY = 145,
+ ERROR_IS_SUBST_PATH = 146,
+ ERROR_IS_JOIN_PATH = 147,
+ ERROR_PATH_BUSY = 148,
+ ERROR_IS_SUBST_TARGET = 149,
+ ERROR_SYSTEM_TRACE = 150,
+ ERROR_INVALID_EVENT_COUNT = 151,
+ ERROR_TOO_MANY_MUXWAITERS = 152,
+ ERROR_INVALID_LIST_FORMAT = 153,
+ ERROR_LABEL_TOO_LONG = 154,
+ ERROR_TOO_MANY_TCBS = 155,
+ ERROR_SIGNAL_REFUSED = 156,
+ ERROR_DISCARDED = 157,
+ ERROR_NOT_LOCKED = 158,
+ ERROR_BAD_THREADID_ADDR = 159,
+ ERROR_BAD_ARGUMENTS = 160,
+ ERROR_BAD_PATHNAME = 161,
+ ERROR_SIGNAL_PENDING = 162,
+ ERROR_MAX_THRDS_REACHED = 164,
+ ERROR_LOCK_FAILED = 167,
+ ERROR_BUSY = 170,
+ ERROR_CANCEL_VIOLATION = 173,
+ ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174,
+ ERROR_INVALID_SEGMENT_NUMBER = 180,
+ ERROR_INVALID_ORDINAL = 182,
+ ERROR_ALREADY_EXISTS = 183,
+ ERROR_INVALID_FLAG_NUMBER = 186,
+ ERROR_SEM_NOT_FOUND = 187,
+ ERROR_INVALID_STARTING_CODESEG = 188,
+ ERROR_INVALID_STACKSEG = 189,
+ ERROR_INVALID_MODULETYPE = 190,
+ ERROR_INVALID_EXE_SIGNATURE = 191,
+ ERROR_EXE_MARKED_INVALID = 192,
+ ERROR_BAD_EXE_FORMAT = 193,
+ ERROR_ITERATED_DATA_EXCEEDS_64k = 194,
+ ERROR_INVALID_MINALLOCSIZE = 195,
+ ERROR_DYNLINK_FROM_INVALID_RING = 196,
+ ERROR_IOPL_NOT_ENABLED = 197,
+ ERROR_INVALID_SEGDPL = 198,
+ ERROR_AUTODATASEG_EXCEEDS_64k = 199,
+ ERROR_RING2SEG_MUST_BE_MOVABLE = 200,
+ ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201,
+ ERROR_INFLOOP_IN_RELOC_CHAIN = 202,
+ ERROR_ENVVAR_NOT_FOUND = 203,
+ ERROR_NO_SIGNAL_SENT = 205,
+ ERROR_FILENAME_EXCED_RANGE = 206,
+ ERROR_RING2_STACK_IN_USE = 207,
+ ERROR_META_EXPANSION_TOO_LONG = 208,
+ ERROR_INVALID_SIGNAL_NUMBER = 209,
+ ERROR_THREAD_1_INACTIVE = 210,
+ ERROR_LOCKED = 212,
+ ERROR_TOO_MANY_MODULES = 214,
+ ERROR_NESTING_NOT_ALLOWED = 215,
+ ERROR_EXE_MACHINE_TYPE_MISMATCH = 216,
+ ERROR_BAD_PIPE = 230,
+ ERROR_PIPE_BUSY = 231,
+ ERROR_NO_DATA = 232,
+ ERROR_PIPE_NOT_CONNECTED = 233,
+ ERROR_MORE_DATA = 234,
+ ERROR_VC_DISCONNECTED = 240,
+ ERROR_INVALID_EA_NAME = 254,
+ ERROR_EA_LIST_INCONSISTENT = 255,
+ WAIT_TIMEOUT = 258,
+ ERROR_NO_MORE_ITEMS = 259,
+ ERROR_CANNOT_COPY = 266,
+ ERROR_DIRECTORY = 267,
+ ERROR_EAS_DIDNT_FIT = 275,
+ ERROR_EA_FILE_CORRUPT = 276,
+ ERROR_EA_TABLE_FULL = 277,
+ ERROR_INVALID_EA_HANDLE = 278,
+ ERROR_EAS_NOT_SUPPORTED = 282,
+ ERROR_NOT_OWNER = 288,
+ ERROR_TOO_MANY_POSTS = 298,
+ ERROR_PARTIAL_COPY = 299,
+ ERROR_OPLOCK_NOT_GRANTED = 300,
+ ERROR_INVALID_OPLOCK_PROTOCOL = 301,
+ ERROR_DISK_TOO_FRAGMENTED = 302,
+ ERROR_DELETE_PENDING = 303,
+ ERROR_MR_MID_NOT_FOUND = 317,
+ ERROR_INVALID_ADDRESS = 487,
+ ERROR_ARITHMETIC_OVERFLOW = 534,
+ ERROR_PIPE_CONNECTED = 535,
+ ERROR_PIPE_LISTENING = 536,
+ ERROR_EA_ACCESS_DENIED = 994,
+ ERROR_OPERATION_ABORTED = 995,
+ ERROR_IO_INCOMPLETE = 996,
+ ERROR_IO_PENDING = 997,
+ ERROR_NOACCESS = 998,
+ ERROR_SWAPERROR = 999,
+ ERROR_STACK_OVERFLOW = 1001,
+ ERROR_INVALID_MESSAGE = 1002,
+ ERROR_CAN_NOT_COMPLETE = 1003,
+ ERROR_INVALID_FLAGS = 1004,
+ ERROR_UNRECOGNIZED_VOLUME = 1005,
+ ERROR_FILE_INVALID = 1006,
+ ERROR_FULLSCREEN_MODE = 1007,
+ ERROR_NO_TOKEN = 1008,
+ ERROR_BADDB = 1009,
+ ERROR_BADKEY = 1010,
+ ERROR_CANTOPEN = 1011,
+ ERROR_CANTREAD = 1012,
+ ERROR_CANTWRITE = 1013,
+ ERROR_REGISTRY_RECOVERED = 1014,
+ ERROR_REGISTRY_CORRUPT = 1015,
+ ERROR_REGISTRY_IO_FAILED = 1016,
+ ERROR_NOT_REGISTRY_FILE = 1017,
+ ERROR_KEY_DELETED = 1018,
+ ERROR_NO_LOG_SPACE = 1019,
+ ERROR_KEY_HAS_CHILDREN = 1020,
+ ERROR_CHILD_MUST_BE_VOLATILE = 1021,
+ ERROR_NOTIFY_ENUM_DIR = 1022,
+ ERROR_DEPENDENT_SERVICES_RUNNING = 1051,
+ ERROR_INVALID_SERVICE_CONTROL = 1052,
+ ERROR_SERVICE_REQUEST_TIMEOUT = 1053,
+ ERROR_SERVICE_NO_THREAD = 1054,
+ ERROR_SERVICE_DATABASE_LOCKED = 1055,
+ ERROR_SERVICE_ALREADY_RUNNING = 1056,
+ ERROR_INVALID_SERVICE_ACCOUNT = 1057,
+ ERROR_SERVICE_DISABLED = 1058,
+ ERROR_CIRCULAR_DEPENDENCY = 1059,
+ ERROR_SERVICE_DOES_NOT_EXIST = 1060,
+ ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061,
+ ERROR_SERVICE_NOT_ACTIVE = 1062,
+ ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063,
+ ERROR_EXCEPTION_IN_SERVICE = 1064,
+ ERROR_DATABASE_DOES_NOT_EXIST = 1065,
+ ERROR_SERVICE_SPECIFIC_ERROR = 1066,
+ ERROR_PROCESS_ABORTED = 1067,
+ ERROR_SERVICE_DEPENDENCY_FAIL = 1068,
+ ERROR_SERVICE_LOGON_FAILED = 1069,
+ ERROR_SERVICE_START_HANG = 1070,
+ ERROR_INVALID_SERVICE_LOCK = 1071,
+ ERROR_SERVICE_MARKED_FOR_DELETE = 1072,
+ ERROR_SERVICE_EXISTS = 1073,
+ ERROR_ALREADY_RUNNING_LKG = 1074,
+ ERROR_SERVICE_DEPENDENCY_DELETED = 1075,
+ ERROR_BOOT_ALREADY_ACCEPTED = 1076,
+ ERROR_SERVICE_NEVER_STARTED = 1077,
+ ERROR_DUPLICATE_SERVICE_NAME = 1078,
+ ERROR_DIFFERENT_SERVICE_ACCOUNT = 1079,
+ ERROR_CANNOT_DETECT_DRIVER_FAILURE = 1080,
+ ERROR_CANNOT_DETECT_PROCESS_ABORT = 1081,
+ ERROR_NO_RECOVERY_PROGRAM = 1082,
+ ERROR_SERVICE_NOT_IN_EXE = 1083,
+ ERROR_NOT_SAFEBOOT_SERVICE = 1084,
+ ERROR_END_OF_MEDIA = 1100,
+ ERROR_FILEMARK_DETECTED = 1101,
+ ERROR_BEGINNING_OF_MEDIA = 1102,
+ ERROR_SETMARK_DETECTED = 1103,
+ ERROR_NO_DATA_DETECTED = 1104,
+ ERROR_PARTITION_FAILURE = 1105,
+ ERROR_INVALID_BLOCK_LENGTH = 1106,
+ ERROR_DEVICE_NOT_PARTITIONED = 1107,
+ ERROR_UNABLE_TO_LOCK_MEDIA = 1108,
+ ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109,
+ ERROR_MEDIA_CHANGED = 1110,
+ ERROR_BUS_RESET = 1111,
+ ERROR_NO_MEDIA_IN_DRIVE = 1112,
+ ERROR_NO_UNICODE_TRANSLATION = 1113,
+ ERROR_DLL_INIT_FAILED = 1114,
+ ERROR_SHUTDOWN_IN_PROGRESS = 1115,
+ ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116,
+ ERROR_IO_DEVICE = 1117,
+ ERROR_SERIAL_NO_DEVICE = 1118,
+ ERROR_IRQ_BUSY = 1119,
+ ERROR_MORE_WRITES = 1120,
+ ERROR_COUNTER_TIMEOUT = 1121,
+ ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122,
+ ERROR_FLOPPY_WRONG_CYLINDER = 1123,
+ ERROR_FLOPPY_UNKNOWN_ERROR = 1124,
+ ERROR_FLOPPY_BAD_REGISTERS = 1125,
+ ERROR_DISK_RECALIBRATE_FAILED = 1126,
+ ERROR_DISK_OPERATION_FAILED = 1127,
+ ERROR_DISK_RESET_FAILED = 1128,
+ ERROR_EOM_OVERFLOW = 1129,
+ ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130,
+ ERROR_POSSIBLE_DEADLOCK = 1131,
+ ERROR_MAPPED_ALIGNMENT = 1132,
+ ERROR_SET_POWER_STATE_VETOED = 1140,
+ ERROR_SET_POWER_STATE_FAILED = 1141,
+ ERROR_TOO_MANY_LINKS = 1142,
+ ERROR_OLD_WIN_VERSION = 1150,
+ ERROR_APP_WRONG_OS = 1151,
+ ERROR_SINGLE_INSTANCE_APP = 1152,
+ ERROR_RMODE_APP = 1153,
+ ERROR_INVALID_DLL = 1154,
+ ERROR_NO_ASSOCIATION = 1155,
+ ERROR_DDE_FAIL = 1156,
+ ERROR_DLL_NOT_FOUND = 1157,
+ ERROR_NO_MORE_USER_HANDLES = 1158,
+ ERROR_MESSAGE_SYNC_ONLY = 1159,
+ ERROR_SOURCE_ELEMENT_EMPTY = 1160,
+ ERROR_DESTINATION_ELEMENT_FULL = 1161,
+ ERROR_ILLEGAL_ELEMENT_ADDRESS = 1162,
+ ERROR_MAGAZINE_NOT_PRESENT = 1163,
+ ERROR_DEVICE_REINITIALIZATION_NEEDED = 1164,
+ ERROR_DEVICE_REQUIRES_CLEANING = 1165,
+ ERROR_DEVICE_DOOR_OPEN = 1166,
+ ERROR_DEVICE_NOT_CONNECTED = 1167,
+ ERROR_NOT_FOUND = 1168,
+ ERROR_NO_MATCH = 1169,
+ ERROR_SET_NOT_FOUND = 1170,
+ ERROR_POINT_NOT_FOUND = 1171,
+ ERROR_NO_TRACKING_SERVICE = 1172,
+ ERROR_NO_VOLUME_ID = 1173,
+ ERROR_UNABLE_TO_REMOVE_REPLACED = 1175,
+ ERROR_UNABLE_TO_MOVE_REPLACEMENT = 1176,
+ ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 = 1177,
+ ERROR_JOURNAL_DELETE_IN_PROGRESS = 1178,
+ ERROR_JOURNAL_NOT_ACTIVE = 1179,
+ ERROR_POTENTIAL_FILE_FOUND = 1180,
+ ERROR_JOURNAL_ENTRY_DELETED = 1181,
+ ERROR_BAD_DEVICE = 1200,
+ ERROR_CONNECTION_UNAVAIL = 1201,
+ ERROR_DEVICE_ALREADY_REMEMBERED = 1202,
+ ERROR_NO_NET_OR_BAD_PATH = 1203,
+ ERROR_BAD_PROVIDER = 1204,
+ ERROR_CANNOT_OPEN_PROFILE = 1205,
+ ERROR_BAD_PROFILE = 1206,
+ ERROR_NOT_CONTAINER = 1207,
+ ERROR_EXTENDED_ERROR = 1208,
+ ERROR_INVALID_GROUPNAME = 1209,
+ ERROR_INVALID_COMPUTERNAME = 1210,
+ ERROR_INVALID_EVENTNAME = 1211,
+ ERROR_INVALID_DOMAINNAME = 1212,
+ ERROR_INVALID_SERVICENAME = 1213,
+ ERROR_INVALID_NETNAME = 1214,
+ ERROR_INVALID_SHARENAME = 1215,
+ ERROR_INVALID_PASSWORDNAME = 1216,
+ ERROR_INVALID_MESSAGENAME = 1217,
+ ERROR_INVALID_MESSAGEDEST = 1218,
+ ERROR_SESSION_CREDENTIAL_CONFLICT = 1219,
+ ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220,
+ ERROR_DUP_DOMAINNAME = 1221,
+ ERROR_NO_NETWORK = 1222,
+ ERROR_CANCELLED = 1223,
+ ERROR_USER_MAPPED_FILE = 1224,
+ ERROR_CONNECTION_REFUSED = 1225,
+ ERROR_GRACEFUL_DISCONNECT = 1226,
+ ERROR_ADDRESS_ALREADY_ASSOCIATED = 1227,
+ ERROR_ADDRESS_NOT_ASSOCIATED = 1228,
+ ERROR_CONNECTION_INVALID = 1229,
+ ERROR_CONNECTION_ACTIVE = 1230,
+ ERROR_NETWORK_UNREACHABLE = 1231,
+ ERROR_HOST_UNREACHABLE = 1232,
+ ERROR_PROTOCOL_UNREACHABLE = 1233,
+ ERROR_PORT_UNREACHABLE = 1234,
+ ERROR_REQUEST_ABORTED = 1235,
+ ERROR_CONNECTION_ABORTED = 1236,
+ ERROR_RETRY = 1237,
+ ERROR_CONNECTION_COUNT_LIMIT = 1238,
+ ERROR_LOGIN_TIME_RESTRICTION = 1239,
+ ERROR_LOGIN_WKSTA_RESTRICTION = 1240,
+ ERROR_INCORRECT_ADDRESS = 1241,
+ ERROR_ALREADY_REGISTERED = 1242,
+ ERROR_SERVICE_NOT_FOUND = 1243,
+ ERROR_NOT_AUTHENTICATED = 1244,
+ ERROR_NOT_LOGGED_ON = 1245,
+ ERROR_CONTINUE = 1246,
+ ERROR_ALREADY_INITIALIZED = 1247,
+ ERROR_NO_MORE_DEVICES = 1248,
+ ERROR_NO_SUCH_SITE = 1249,
+ ERROR_DOMAIN_CONTROLLER_EXISTS = 1250,
+ ERROR_ONLY_IF_CONNECTED = 1251,
+ ERROR_OVERRIDE_NOCHANGES = 1252,
+ ERROR_BAD_USER_PROFILE = 1253,
+ ERROR_NOT_SUPPORTED_ON_SBS = 1254,
+ ERROR_SERVER_SHUTDOWN_IN_PROGRESS = 1255,
+ ERROR_HOST_DOWN = 1256,
+ ERROR_NON_ACCOUNT_SID = 1257,
+ ERROR_NON_DOMAIN_SID = 1258,
+ ERROR_APPHELP_BLOCK = 1259,
+ ERROR_ACCESS_DISABLED_BY_POLICY = 1260,
+ ERROR_REG_NAT_CONSUMPTION = 1261,
+ ERROR_CSCSHARE_OFFLINE = 1262,
+ ERROR_PKINIT_FAILURE = 1263,
+ ERROR_SMARTCARD_SUBSYSTEM_FAILURE = 1264,
+ ERROR_DOWNGRADE_DETECTED = 1265,
+ SEC_E_SMARTCARD_CERT_REVOKED = 1266,
+ SEC_E_ISSUING_CA_UNTRUSTED = 1267,
+ SEC_E_REVOCATION_OFFLINE_C = 1268,
+ SEC_E_PKINIT_CLIENT_FAILUR = 1269,
+ SEC_E_SMARTCARD_CERT_EXPIRED = 1270,
+ ERROR_MACHINE_LOCKED = 1271,
+ ERROR_CALLBACK_SUPPLIED_INVALID_DATA = 1273,
+ ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED = 1274,
+ ERROR_DRIVER_BLOCKED = 1275,
+ ERROR_INVALID_IMPORT_OF_NON_DLL = 1276,
+ ERROR_NOT_ALL_ASSIGNED = 1300,
+ ERROR_SOME_NOT_MAPPED = 1301,
+ ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302,
+ ERROR_LOCAL_USER_SESSION_KEY = 1303,
+ ERROR_NULL_LM_PASSWORD = 1304,
+ ERROR_UNKNOWN_REVISION = 1305,
+ ERROR_REVISION_MISMATCH = 1306,
+ ERROR_INVALID_OWNER = 1307,
+ ERROR_INVALID_PRIMARY_GROUP = 1308,
+ ERROR_NO_IMPERSONATION_TOKEN = 1309,
+ ERROR_CANT_DISABLE_MANDATORY = 1310,
+ ERROR_NO_LOGON_SERVERS = 1311,
+ ERROR_NO_SUCH_LOGON_SESSION = 1312,
+ ERROR_NO_SUCH_PRIVILEGE = 1313,
+ ERROR_PRIVILEGE_NOT_HELD = 1314,
+ ERROR_INVALID_ACCOUNT_NAME = 1315,
+ ERROR_USER_EXISTS = 1316,
+ ERROR_NO_SUCH_USER = 1317,
+ ERROR_GROUP_EXISTS = 1318,
+ ERROR_NO_SUCH_GROUP = 1319,
+ ERROR_MEMBER_IN_GROUP = 1320,
+ ERROR_MEMBER_NOT_IN_GROUP = 1321,
+ ERROR_LAST_ADMIN = 1322,
+ ERROR_WRONG_PASSWORD = 1323,
+ ERROR_ILL_FORMED_PASSWORD = 1324,
+ ERROR_PASSWORD_RESTRICTION = 1325,
+ ERROR_LOGON_FAILURE = 1326,
+ ERROR_ACCOUNT_RESTRICTION = 1327,
+ ERROR_INVALID_LOGON_HOURS = 1328,
+ ERROR_INVALID_WORKSTATION = 1329,
+ ERROR_PASSWORD_EXPIRED = 1330,
+ ERROR_ACCOUNT_DISABLED = 1331,
+ ERROR_NONE_MAPPED = 1332,
+ ERROR_TOO_MANY_LUIDS_REQUESTED = 1333,
+ ERROR_LUIDS_EXHAUSTED = 1334,
+ ERROR_INVALID_SUB_AUTHORITY = 1335,
+ ERROR_INVALID_ACL = 1336,
+ ERROR_INVALID_SID = 1337,
+ ERROR_INVALID_SECURITY_DESCR = 1338,
+ ERROR_BAD_INHERITANCE_ACL = 1340,
+ ERROR_SERVER_DISABLED = 1341,
+ ERROR_SERVER_NOT_DISABLED = 1342,
+ ERROR_INVALID_ID_AUTHORITY = 1343,
+ ERROR_ALLOTTED_SPACE_EXCEEDED = 1344,
+ ERROR_INVALID_GROUP_ATTRIBUTES = 1345,
+ ERROR_BAD_IMPERSONATION_LEVEL = 1346,
+ ERROR_CANT_OPEN_ANONYMOUS = 1347,
+ ERROR_BAD_VALIDATION_CLASS = 1348,
+ ERROR_BAD_TOKEN_TYPE = 1349,
+ ERROR_NO_SECURITY_ON_OBJECT = 1350,
+ ERROR_CANT_ACCESS_DOMAIN_INFO = 1351,
+ ERROR_INVALID_SERVER_STATE = 1352,
+ ERROR_INVALID_DOMAIN_STATE = 1353,
+ ERROR_INVALID_DOMAIN_ROLE = 1354,
+ ERROR_NO_SUCH_DOMAIN = 1355,
+ ERROR_DOMAIN_EXISTS = 1356,
+ ERROR_DOMAIN_LIMIT_EXCEEDED = 1357,
+ ERROR_INTERNAL_DB_CORRUPTION = 1358,
+ ERROR_INTERNAL_ERROR = 1359,
+ ERROR_GENERIC_NOT_MAPPED = 1360,
+ ERROR_BAD_DESCRIPTOR_FORMAT = 1361,
+ ERROR_NOT_LOGON_PROCESS = 1362,
+ ERROR_LOGON_SESSION_EXISTS = 1363,
+ ERROR_NO_SUCH_PACKAGE = 1364,
+ ERROR_BAD_LOGON_SESSION_STATE = 1365,
+ ERROR_LOGON_SESSION_COLLISION = 1366,
+ ERROR_INVALID_LOGON_TYPE = 1367,
+ ERROR_CANNOT_IMPERSONATE = 1368,
+ ERROR_RXACT_INVALID_STATE = 1369,
+ ERROR_RXACT_COMMIT_FAILURE = 1370,
+ ERROR_SPECIAL_ACCOUNT = 1371,
+ ERROR_SPECIAL_GROUP = 1372,
+ ERROR_SPECIAL_USER = 1373,
+ ERROR_MEMBERS_PRIMARY_GROUP = 1374,
+ ERROR_TOKEN_ALREADY_IN_USE = 1375,
+ ERROR_NO_SUCH_ALIAS = 1376,
+ ERROR_MEMBER_NOT_IN_ALIAS = 1377,
+ ERROR_MEMBER_IN_ALIAS = 1378,
+ ERROR_ALIAS_EXISTS = 1379,
+ ERROR_LOGON_NOT_GRANTED = 1380,
+ ERROR_TOO_MANY_SECRETS = 1381,
+ ERROR_SECRET_TOO_LONG = 1382,
+ ERROR_INTERNAL_DB_ERROR = 1383,
+ ERROR_TOO_MANY_CONTEXT_IDS = 1384,
+ ERROR_LOGON_TYPE_NOT_GRANTED = 1385,
+ ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386,
+ ERROR_NO_SUCH_MEMBER = 1387,
+ ERROR_INVALID_MEMBER = 1388,
+ ERROR_TOO_MANY_SIDS = 1389,
+ ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390,
+ ERROR_NO_INHERITANCE = 1391,
+ ERROR_FILE_CORRUPT = 1392,
+ ERROR_DISK_CORRUPT = 1393,
+ ERROR_NO_USER_SESSION_KEY = 1394,
+ ERROR_LICENSE_QUOTA_EXCEEDED = 1395,
+ ERROR_WRONG_TARGET_NAME = 1396,
+ ERROR_MUTUAL_AUTH_FAILED = 1397,
+ ERROR_TIME_SKEW = 1398,
+ ERROR_CURRENT_DOMAIN_NOT_ALLOWED = 1399,
+ ERROR_INVALID_WINDOW_HANDLE = 1400,
+ ERROR_INVALID_MENU_HANDLE = 1401,
+ ERROR_INVALID_CURSOR_HANDLE = 1402,
+ ERROR_INVALID_ACCEL_HANDLE = 1403,
+ ERROR_INVALID_HOOK_HANDLE = 1404,
+ ERROR_INVALID_DWP_HANDLE = 1405,
+ ERROR_TLW_WITH_WSCHILD = 1406,
+ ERROR_CANNOT_FIND_WND_CLASS = 1407,
+ ERROR_WINDOW_OF_OTHER_THREAD = 1408,
+ ERROR_HOTKEY_ALREADY_REGISTERED = 1409,
+ ERROR_CLASS_ALREADY_EXISTS = 1410,
+ ERROR_CLASS_DOES_NOT_EXIST = 1411,
+ ERROR_CLASS_HAS_WINDOWS = 1412,
+ ERROR_INVALID_INDEX = 1413,
+ ERROR_INVALID_ICON_HANDLE = 1414,
+ ERROR_PRIVATE_DIALOG_INDEX = 1415,
+ ERROR_LISTBOX_ID_NOT_FOUND = 1416,
+ ERROR_NO_WILDCARD_CHARACTERS = 1417,
+ ERROR_CLIPBOARD_NOT_OPEN = 1418,
+ ERROR_HOTKEY_NOT_REGISTERED = 1419,
+ ERROR_WINDOW_NOT_DIALOG = 1420,
+ ERROR_CONTROL_ID_NOT_FOUND = 1421,
+ ERROR_INVALID_COMBOBOX_MESSAGE = 1422,
+ ERROR_WINDOW_NOT_COMBOBOX = 1423,
+ ERROR_INVALID_EDIT_HEIGHT = 1424,
+ ERROR_DC_NOT_FOUND = 1425,
+ ERROR_INVALID_HOOK_FILTER = 1426,
+ ERROR_INVALID_FILTER_PROC = 1427,
+ ERROR_HOOK_NEEDS_HMOD = 1428,
+ ERROR_GLOBAL_ONLY_HOOK = 1429,
+ ERROR_JOURNAL_HOOK_SET = 1430,
+ ERROR_HOOK_NOT_INSTALLED = 1431,
+ ERROR_INVALID_LB_MESSAGE = 1432,
+ ERROR_SETCOUNT_ON_BAD_LB = 1433,
+ ERROR_LB_WITHOUT_TABSTOPS = 1434,
+ ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435,
+ ERROR_CHILD_WINDOW_MENU = 1436,
+ ERROR_NO_SYSTEM_MENU = 1437,
+ ERROR_INVALID_MSGBOX_STYLE = 1438,
+ ERROR_INVALID_SPI_VALUE = 1439,
+ ERROR_SCREEN_ALREADY_LOCKED = 1440,
+ ERROR_HWNDS_HAVE_DIFF_PARENT = 1441,
+ ERROR_NOT_CHILD_WINDOW = 1442,
+ ERROR_INVALID_GW_COMMAND = 1443,
+ ERROR_INVALID_THREAD_ID = 1444,
+ ERROR_NON_MDICHILD_WINDOW = 1445,
+ ERROR_POPUP_ALREADY_ACTIVE = 1446,
+ ERROR_NO_SCROLLBARS = 1447,
+ ERROR_INVALID_SCROLLBAR_RANGE = 1448,
+ ERROR_INVALID_SHOWWIN_COMMAND = 1449,
+ ERROR_NO_SYSTEM_RESOURCES = 1450,
+ ERROR_NONPAGED_SYSTEM_RESOURCES = 1451,
+ ERROR_PAGED_SYSTEM_RESOURCES = 1452,
+ ERROR_WORKING_SET_QUOTA = 1453,
+ ERROR_PAGEFILE_QUOTA = 1454,
+ ERROR_COMMITMENT_LIMIT = 1455,
+ ERROR_MENU_ITEM_NOT_FOUND = 1456,
+ ERROR_INVALID_KEYBOARD_HANDLE = 1457,
+ ERROR_HOOK_TYPE_NOT_ALLOWED = 1458,
+ ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION = 1459,
+ ERROR_TIMEOUT = 1460,
+ ERROR_INVALID_MONITOR_HANDLE = 1461,
+ ERROR_EVENTLOG_FILE_CORRUPT = 1500,
+ ERROR_EVENTLOG_CANT_START = 1501,
+ ERROR_LOG_FILE_FULL = 1502,
+ ERROR_EVENTLOG_FILE_CHANGED = 1503,
+ ERROR_INSTALL_SERVICE_FAILURE = 1601,
+ ERROR_INSTALL_USEREXIT = 1602,
+ ERROR_INSTALL_FAILURE = 1603,
+ ERROR_INSTALL_SUSPEND = 1604,
+ ERROR_UNKNOWN_PRODUCT = 1605,
+ ERROR_UNKNOWN_FEATURE = 1606,
+ ERROR_UNKNOWN_COMPONENT = 1607,
+ ERROR_UNKNOWN_PROPERTY = 1608,
+ ERROR_INVALID_HANDLE_STATE = 1609,
+ ERROR_BAD_CONFIGURATION = 1610,
+ ERROR_INDEX_ABSENT = 1611,
+ ERROR_INSTALL_SOURCE_ABSENT = 1612,
+ ERROR_INSTALL_PACKAGE_VERSION = 1613,
+ ERROR_PRODUCT_UNINSTALLED = 1614,
+ ERROR_BAD_QUERY_SYNTAX = 1615,
+ ERROR_INVALID_FIELD = 1616,
+ ERROR_DEVICE_REMOVED = 1617,
+ ERROR_INSTALL_ALREADY_RUNNING = 1618,
+ ERROR_INSTALL_PACKAGE_OPEN_FAILED = 1619,
+ ERROR_INSTALL_PACKAGE_INVALID = 1620,
+ ERROR_INSTALL_UI_FAILURE = 1621,
+ ERROR_INSTALL_LOG_FAILURE = 1622,
+ ERROR_INSTALL_LANGUAGE_UNSUPPORTED = 1623,
+ ERROR_INSTALL_TRANSFORM_FAILURE = 1624,
+ ERROR_INSTALL_PACKAGE_REJECTED = 1625,
+ ERROR_FUNCTION_NOT_CALLED = 1626,
+ ERROR_FUNCTION_FAILED = 1627,
+ ERROR_INVALID_TABLE = 1628,
+ ERROR_DATATYPE_MISMATCH = 1629,
+ ERROR_UNSUPPORTED_TYPE = 1630,
+ ERROR_CREATE_FAILED = 1631,
+ ERROR_INSTALL_TEMP_UNWRITABLE = 1632,
+ ERROR_INSTALL_PLATFORM_UNSUPPORTED = 1633,
+ ERROR_INSTALL_NOTUSED = 1634,
+ ERROR_PATCH_PACKAGE_OPEN_FAILED = 1635,
+ ERROR_PATCH_PACKAGE_INVALID = 1636,
+ ERROR_PATCH_PACKAGE_UNSUPPORTED = 1637,
+ ERROR_PRODUCT_VERSION = 1638,
+ ERROR_INVALID_COMMAND_LINE = 1639,
+ ERROR_INSTALL_REMOTE_DISALLOWED = 1640,
+ ERROR_SUCCESS_REBOOT_INITIATED = 1641,
+ ERROR_PATCH_TARGET_NOT_FOUND = 1642,
+ ERROR_PATCH_PACKAGE_REJECTED = 1643,
+ ERROR_INSTALL_TRANSFORM_REJECTED = 1644,
+ RPC_S_INVALID_STRING_BINDING = 1700,
+ RPC_S_WRONG_KIND_OF_BINDING = 1701,
+ RPC_S_INVALID_BINDING = 1702,
+ RPC_S_PROTSEQ_NOT_SUPPORTED = 1703,
+ RPC_S_INVALID_RPC_PROTSEQ = 1704,
+ RPC_S_INVALID_STRING_UUID = 1705,
+ RPC_S_INVALID_ENDPOINT_FORMAT = 1706,
+ RPC_S_INVALID_NET_ADDR = 1707,
+ RPC_S_NO_ENDPOINT_FOUND = 1708,
+ RPC_S_INVALID_TIMEOUT = 1709,
+ RPC_S_OBJECT_NOT_FOUND = 1710,
+ RPC_S_ALREADY_REGISTERED = 1711,
+ RPC_S_TYPE_ALREADY_REGISTERED = 1712,
+ RPC_S_ALREADY_LISTENING = 1713,
+ RPC_S_NO_PROTSEQS_REGISTERED = 1714,
+ RPC_S_NOT_LISTENING = 1715,
+ RPC_S_UNKNOWN_MGR_TYPE = 1716,
+ RPC_S_UNKNOWN_IF = 1717,
+ RPC_S_NO_BINDINGS = 1718,
+ RPC_S_NO_PROTSEQS = 1719,
+ RPC_S_CANT_CREATE_ENDPOINT = 1720,
+ RPC_S_OUT_OF_RESOURCES = 1721,
+ RPC_S_SERVER_UNAVAILABLE = 1722,
+ RPC_S_SERVER_TOO_BUSY = 1723,
+ RPC_S_INVALID_NETWORK_OPTIONS = 1724,
+ RPC_S_NO_CALL_ACTIVE = 1725,
+ RPC_S_CALL_FAILED = 1726,
+ RPC_S_CALL_FAILED_DNE = 1727,
+ RPC_S_PROTOCOL_ERROR = 1728,
+ RPC_S_UNSUPPORTED_TRANS_SYN = 1730,
+ RPC_S_UNSUPPORTED_TYPE = 1732,
+ RPC_S_INVALID_TAG = 1733,
+ RPC_S_INVALID_BOUND = 1734,
+ RPC_S_NO_ENTRY_NAME = 1735,
+ RPC_S_INVALID_NAME_SYNTAX = 1736,
+ RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737,
+ RPC_S_UUID_NO_ADDRESS = 1739,
+ RPC_S_DUPLICATE_ENDPOINT = 1740,
+ RPC_S_UNKNOWN_AUTHN_TYPE = 1741,
+ RPC_S_MAX_CALLS_TOO_SMALL = 1742,
+ RPC_S_STRING_TOO_LONG = 1743,
+ RPC_S_PROTSEQ_NOT_FOUND = 1744,
+ RPC_S_PROCNUM_OUT_OF_RANGE = 1745,
+ RPC_S_BINDING_HAS_NO_AUTH = 1746,
+ RPC_S_UNKNOWN_AUTHN_SERVICE = 1747,
+ RPC_S_UNKNOWN_AUTHN_LEVEL = 1748,
+ RPC_S_INVALID_AUTH_IDENTITY = 1749,
+ RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750,
+ EPT_S_INVALID_ENTRY = 1751,
+ EPT_S_CANT_PERFORM_OP = 1752,
+ EPT_S_NOT_REGISTERED = 1753,
+ RPC_S_NOTHING_TO_EXPORT = 1754,
+ RPC_S_INCOMPLETE_NAME = 1755,
+ RPC_S_INVALID_VERS_OPTION = 1756,
+ RPC_S_NO_MORE_MEMBERS = 1757,
+ RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758,
+ RPC_S_INTERFACE_NOT_FOUND = 1759,
+ RPC_S_ENTRY_ALREADY_EXISTS = 1760,
+ RPC_S_ENTRY_NOT_FOUND = 1761,
+ RPC_S_NAME_SERVICE_UNAVAILABLE = 1762,
+ RPC_S_INVALID_NAF_ID = 1763,
+ RPC_S_CANNOT_SUPPORT = 1764,
+ RPC_S_NO_CONTEXT_AVAILABLE = 1765,
+ RPC_S_INTERNAL_ERROR = 1766,
+ RPC_S_ZERO_DIVIDE = 1767,
+ RPC_S_ADDRESS_ERROR = 1768,
+ RPC_S_FP_DIV_ZERO = 1769,
+ RPC_S_FP_UNDERFLOW = 1770,
+ RPC_S_FP_OVERFLOW = 1771,
+ RPC_X_NO_MORE_ENTRIES = 1772,
+ RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773,
+ RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774,
+ RPC_X_SS_IN_NULL_CONTEXT = 1775,
+ RPC_X_SS_CONTEXT_DAMAGED = 1777,
+ RPC_X_SS_HANDLES_MISMATCH = 1778,
+ RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779,
+ RPC_X_NULL_REF_POINTER = 1780,
+ RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781,
+ RPC_X_BYTE_COUNT_TOO_SMALL = 1782,
+ RPC_X_BAD_STUB_DATA = 1783,
+ ERROR_INVALID_USER_BUFFER = 1784,
+ ERROR_UNRECOGNIZED_MEDIA = 1785,
+ ERROR_NO_TRUST_LSA_SECRET = 1786,
+ ERROR_NO_TRUST_SAM_ACCOUNT = 1787,
+ ERROR_TRUSTED_DOMAIN_FAILURE = 1788,
+ ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789,
+ ERROR_TRUST_FAILURE = 1790,
+ RPC_S_CALL_IN_PROGRESS = 1791,
+ ERROR_NETLOGON_NOT_STARTED = 1792,
+ ERROR_ACCOUNT_EXPIRED = 1793,
+ ERROR_REDIRECTOR_HAS_OPEN_HANDLES = 1794,
+ ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795,
+ ERROR_UNKNOWN_PORT = 1796,
+ ERROR_UNKNOWN_PRINTER_DRIVER = 1797,
+ ERROR_UNKNOWN_PRINTPROCESSOR = 1798,
+ ERROR_INVALID_SEPARATOR_FILE = 1799,
+ ERROR_INVALID_PRIORITY = 1800,
+ ERROR_INVALID_PRINTER_NAME = 1801,
+ ERROR_PRINTER_ALREADY_EXISTS = 1802,
+ ERROR_INVALID_PRINTER_COMMAND = 1803,
+ ERROR_INVALID_DATATYPE = 1804,
+ ERROR_INVALID_ENVIRONMENT = 1805,
+ RPC_S_NO_MORE_BINDINGS = 1806,
+ ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807,
+ ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808,
+ ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809,
+ ERROR_DOMAIN_TRUST_INCONSISTENT = 1810,
+ ERROR_SERVER_HAS_OPEN_HANDLES = 1811,
+ ERROR_RESOURCE_DATA_NOT_FOUND = 1812,
+ ERROR_RESOURCE_TYPE_NOT_FOUND = 1813,
+ ERROR_RESOURCE_NAME_NOT_FOUND = 1814,
+ ERROR_RESOURCE_LANG_NOT_FOUND = 1815,
+ ERROR_NOT_ENOUGH_QUOTA = 1816,
+ RPC_S_NO_INTERFACES = 1817,
+ RPC_S_CALL_CANCELLED = 1818,
+ RPC_S_BINDING_INCOMPLETE = 1819,
+ RPC_S_COMM_FAILURE = 1820,
+ RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821,
+ RPC_S_NO_PRINC_NAME = 1822,
+ RPC_S_NOT_RPC_ERROR = 1823,
+ RPC_S_UUID_LOCAL_ONLY = 1824,
+ RPC_S_SEC_PKG_ERROR = 1825,
+ RPC_S_NOT_CANCELLED = 1826,
+ RPC_X_INVALID_ES_ACTION = 1827,
+ RPC_X_WRONG_ES_VERSION = 1828,
+ RPC_X_WRONG_STUB_VERSION = 1829,
+ RPC_X_INVALID_PIPE_OBJECT = 1830,
+ RPC_X_WRONG_PIPE_ORDER = 1831,
+ RPC_X_WRONG_PIPE_VERSION = 1832,
+ RPC_S_GROUP_MEMBER_NOT_FOUND = 1898,
+ EPT_S_CANT_CREATE = 1899,
+ RPC_S_INVALID_OBJECT = 1900,
+ ERROR_INVALID_TIME = 1901,
+ ERROR_INVALID_FORM_NAME = 1902,
+ ERROR_INVALID_FORM_SIZE = 1903,
+ ERROR_ALREADY_WAITING = 1904,
+ ERROR_PRINTER_DELETED = 1905,
+ ERROR_INVALID_PRINTER_STATE = 1906,
+ ERROR_PASSWORD_MUST_CHANGE = 1907,
+ ERROR_DOMAIN_CONTROLLER_NOT_FOUND = 1908,
+ ERROR_ACCOUNT_LOCKED_OUT = 1909,
+ OR_INVALID_OXID = 1910,
+ OR_INVALID_OID = 1911,
+ OR_INVALID_SET = 1912,
+ RPC_S_SEND_INCOMPLETE = 1913,
+ RPC_S_INVALID_ASYNC_HANDLE = 1914,
+ RPC_S_INVALID_ASYNC_CALL = 1915,
+ RPC_X_PIPE_CLOSED = 1916,
+ RPC_X_PIPE_DISCIPLINE_ERROR = 1917,
+ RPC_X_PIPE_EMPTY = 1918,
+ ERROR_NO_SITENAME = 1919,
+ ERROR_CANT_ACCESS_FILE = 1920,
+ ERROR_CANT_RESOLVE_FILENAME = 1921,
+ RPC_S_ENTRY_TYPE_MISMATCH = 1922,
+ RPC_S_NOT_ALL_OBJS_EXPORTED = 1923,
+ RPC_S_INTERFACE_NOT_EXPORTED = 1924,
+ RPC_S_PROFILE_NOT_ADDED = 1925,
+ RPC_S_PRF_ELT_NOT_ADDED = 1926,
+ RPC_S_PRF_ELT_NOT_REMOVED = 1927,
+ RPC_S_GRP_ELT_NOT_ADDED = 1928,
+ RPC_S_GRP_ELT_NOT_REMOVED = 1929,
+ ERROR_KM_DRIVER_BLOCKED = 1930,
+ ERROR_CONTEXT_EXPIRED = 1931,
+ ERROR_INVALID_PIXEL_FORMAT = 2000,
+ ERROR_BAD_DRIVER = 2001,
+ ERROR_INVALID_WINDOW_STYLE = 2002,
+ ERROR_METAFILE_NOT_SUPPORTED = 2003,
+ ERROR_TRANSFORM_NOT_SUPPORTED = 2004,
+ ERROR_CLIPPING_NOT_SUPPORTED = 2005,
+ ERROR_INVALID_CMM = 2010,
+ ERROR_INVALID_PROFILE = 2011,
+ ERROR_TAG_NOT_FOUND = 2012,
+ ERROR_TAG_NOT_PRESENT = 2013,
+ ERROR_DUPLICATE_TAG = 2014,
+ ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015,
+ ERROR_PROFILE_NOT_FOUND = 2016,
+ ERROR_INVALID_COLORSPACE = 2017,
+ ERROR_ICM_NOT_ENABLED = 2018,
+ ERROR_DELETING_ICM_XFORM = 2019,
+ ERROR_INVALID_TRANSFORM = 2020,
+ ERROR_COLORSPACE_MISMATCH = 2021,
+ ERROR_INVALID_COLORINDEX = 2022,
+ ERROR_CONNECTED_OTHER_PASSWORD = 2108,
+ ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT = 2109,
+ ERROR_BAD_USERNAME = 2202,
+ ERROR_NOT_CONNECTED = 2250,
+ ERROR_OPEN_FILES = 2401,
+ ERROR_ACTIVE_CONNECTIONS = 2402,
+ ERROR_DEVICE_IN_USE = 2404,
+ ERROR_UNKNOWN_PRINT_MONITOR = 3000,
+ ERROR_PRINTER_DRIVER_IN_USE = 3001,
+ ERROR_SPOOL_FILE_NOT_FOUND = 3002,
+ ERROR_SPL_NO_STARTDOC = 3003,
+ ERROR_SPL_NO_ADDJOB = 3004,
+ ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005,
+ ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006,
+ ERROR_INVALID_PRINT_MONITOR = 3007,
+ ERROR_PRINT_MONITOR_IN_USE = 3008,
+ ERROR_PRINTER_HAS_JOBS_QUEUED = 3009,
+ ERROR_SUCCESS_REBOOT_REQUIRED = 3010,
+ ERROR_SUCCESS_RESTART_REQUIRED = 3011,
+ ERROR_PRINTER_NOT_FOUND = 3012,
+ ERROR_PRINTER_DRIVER_WARNED = 3013,
+ ERROR_PRINTER_DRIVER_BLOCKED = 3014,
+ ERROR_WINS_INTERNAL = 4000,
+ ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001,
+ ERROR_STATIC_INIT = 4002,
+ ERROR_INC_BACKUP = 4003,
+ ERROR_FULL_BACKUP = 4004,
+ ERROR_REC_NON_EXISTENT = 4005,
+ ERROR_RPL_NOT_ALLOWED = 4006,
+ ERROR_DHCP_ADDRESS_CONFLICT = 4100,
+ ERROR_WMI_GUID_NOT_FOUND = 4200,
+ ERROR_WMI_INSTANCE_NOT_FOUND = 4201,
+ ERROR_WMI_ITEMID_NOT_FOUND = 4202,
+ ERROR_WMI_TRY_AGAIN = 4203,
+ ERROR_WMI_DP_NOT_FOUND = 4204,
+ ERROR_WMI_UNRESOLVED_INSTANCE_REF = 4205,
+ ERROR_WMI_ALREADY_ENABLED = 4206,
+ ERROR_WMI_GUID_DISCONNECTED = 4207,
+ ERROR_WMI_SERVER_UNAVAILABLE = 4208,
+ ERROR_WMI_DP_FAILED = 4209,
+ ERROR_WMI_INVALID_MOF = 4210,
+ ERROR_WMI_INVALID_REGINFO = 4211,
+ ERROR_WMI_ALREADY_DISABLED = 4212,
+ ERROR_WMI_READ_ONLY = 4213,
+ ERROR_WMI_SET_FAILURE = 4214,
+ ERROR_INVALID_MEDIA = 4300,
+ ERROR_INVALID_LIBRARY = 4301,
+ ERROR_INVALID_MEDIA_POOL = 4302,
+ ERROR_DRIVE_MEDIA_MISMATCH = 4303,
+ ERROR_MEDIA_OFFLINE = 4304,
+ ERROR_LIBRARY_OFFLINE = 4305,
+ ERROR_EMPTY = 4306,
+ ERROR_NOT_EMPTY = 4307,
+ ERROR_MEDIA_UNAVAILABLE = 4308,
+ ERROR_RESOURCE_DISABLED = 4309,
+ ERROR_INVALID_CLEANER = 4310,
+ ERROR_UNABLE_TO_CLEAN = 4311,
+ ERROR_OBJECT_NOT_FOUND = 4312,
+ ERROR_DATABASE_FAILURE = 4313,
+ ERROR_DATABASE_FULL = 4314,
+ ERROR_MEDIA_INCOMPATIBLE = 4315,
+ ERROR_RESOURCE_NOT_PRESENT = 4316,
+ ERROR_INVALID_OPERATION = 4317,
+ ERROR_MEDIA_NOT_AVAILABLE = 4318,
+ ERROR_DEVICE_NOT_AVAILABLE = 4319,
+ ERROR_REQUEST_REFUSED = 4320,
+ ERROR_INVALID_DRIVE_OBJECT = 4321,
+ ERROR_LIBRARY_FULL = 4322,
+ ERROR_MEDIUM_NOT_ACCESSIBLE = 4323,
+ ERROR_UNABLE_TO_LOAD_MEDIUM = 4324,
+ ERROR_UNABLE_TO_INVENTORY_DRIVE = 4325,
+ ERROR_UNABLE_TO_INVENTORY_SLOT = 4326,
+ ERROR_UNABLE_TO_INVENTORY_TRANSPORT = 4327,
+ ERROR_TRANSPORT_FULL = 4328,
+ ERROR_CONTROLLING_IEPORT = 4329,
+ ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA = 4330,
+ ERROR_CLEANER_SLOT_SET = 4331,
+ ERROR_CLEANER_SLOT_NOT_SET = 4332,
+ ERROR_CLEANER_CARTRIDGE_SPENT = 4333,
+ ERROR_UNEXPECTED_OMID = 4334,
+ ERROR_CANT_DELETE_LAST_ITEM = 4335,
+ ERROR_MESSAGE_EXCEEDS_MAX_SIZE = 4336,
+ ERROR_VOLUME_CONTAINS_SYS_FILES = 4337,
+ ERROR_INDIGENOUS_TYPE = 4338,
+ ERROR_NO_SUPPORTING_DRIVES = 4339,
+ ERROR_CLEANER_CARTRIDGE_INSTALLED = 4340,
+ ERROR_FILE_OFFLINE = 4350,
+ ERROR_REMOTE_STORAGE_NOT_ACTIVE = 4351,
+ ERROR_REMOTE_STORAGE_MEDIA_ERROR = 4352,
+ ERROR_NOT_A_REPARSE_POINT = 4390,
+ ERROR_REPARSE_ATTRIBUTE_CONFLICT = 4391,
+ ERROR_INVALID_REPARSE_DATA = 4392,
+ ERROR_REPARSE_TAG_INVALID = 4393,
+ ERROR_REPARSE_TAG_MISMATCH = 4394,
+ ERROR_VOLUME_NOT_SIS_ENABLED = 4500,
+ ERROR_DEPENDENT_RESOURCE_EXISTS = 5001,
+ ERROR_DEPENDENCY_NOT_FOUND = 5002,
+ ERROR_DEPENDENCY_ALREADY_EXISTS = 5003,
+ ERROR_RESOURCE_NOT_ONLINE = 5004,
+ ERROR_HOST_NODE_NOT_AVAILABLE = 5005,
+ ERROR_RESOURCE_NOT_AVAILABLE = 5006,
+ ERROR_RESOURCE_NOT_FOUND = 5007,
+ ERROR_SHUTDOWN_CLUSTER = 5008,
+ ERROR_CANT_EVICT_ACTIVE_NODE = 5009,
+ ERROR_OBJECT_ALREADY_EXISTS = 5010,
+ ERROR_OBJECT_IN_LIST = 5011,
+ ERROR_GROUP_NOT_AVAILABLE = 5012,
+ ERROR_GROUP_NOT_FOUND = 5013,
+ ERROR_GROUP_NOT_ONLINE = 5014,
+ ERROR_HOST_NODE_NOT_RESOURCE_OWNER = 5015,
+ ERROR_HOST_NODE_NOT_GROUP_OWNER = 5016,
+ ERROR_RESMON_CREATE_FAILED = 5017,
+ ERROR_RESMON_ONLINE_FAILED = 5018,
+ ERROR_RESOURCE_ONLINE = 5019,
+ ERROR_QUORUM_RESOURCE = 5020,
+ ERROR_NOT_QUORUM_CAPABLE = 5021,
+ ERROR_CLUSTER_SHUTTING_DOWN = 5022,
+ ERROR_INVALID_STATE = 5023,
+ ERROR_RESOURCE_PROPERTIES_STORED = 5024,
+ ERROR_NOT_QUORUM_CLASS = 5025,
+ ERROR_CORE_RESOURCE = 5026,
+ ERROR_QUORUM_RESOURCE_ONLINE_FAILED = 5027,
+ ERROR_QUORUMLOG_OPEN_FAILED = 5028,
+ ERROR_CLUSTERLOG_CORRUPT = 5029,
+ ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE = 5030,
+ ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE = 5031,
+ ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND = 5032,
+ ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE = 5033,
+ ERROR_QUORUM_OWNER_ALIVE = 5034,
+ ERROR_NETWORK_NOT_AVAILABLE = 5035,
+ ERROR_NODE_NOT_AVAILABLE = 5036,
+ ERROR_ALL_NODES_NOT_AVAILABLE = 5037,
+ ERROR_RESOURCE_FAILED = 5038,
+ ERROR_CLUSTER_INVALID_NODE = 5039,
+ ERROR_CLUSTER_NODE_EXISTS = 5040,
+ ERROR_CLUSTER_JOIN_IN_PROGRESS = 5041,
+ ERROR_CLUSTER_NODE_NOT_FOUND = 5042,
+ ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND = 5043,
+ ERROR_CLUSTER_NETWORK_EXISTS = 5044,
+ ERROR_CLUSTER_NETWORK_NOT_FOUND = 5045,
+ ERROR_CLUSTER_NETINTERFACE_EXISTS = 5046,
+ ERROR_CLUSTER_NETINTERFACE_NOT_FOUND = 5047,
+ ERROR_CLUSTER_INVALID_REQUEST = 5048,
+ ERROR_CLUSTER_INVALID_NETWORK_PROVIDER = 5049,
+ ERROR_CLUSTER_NODE_DOWN = 5050,
+ ERROR_CLUSTER_NODE_UNREACHABLE = 5051,
+ ERROR_CLUSTER_NODE_NOT_MEMBER = 5052,
+ ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS = 5053,
+ ERROR_CLUSTER_INVALID_NETWORK = 5054,
+ ERROR_CLUSTER_NODE_UP = 5056,
+ ERROR_CLUSTER_IPADDR_IN_USE = 5057,
+ ERROR_CLUSTER_NODE_NOT_PAUSED = 5058,
+ ERROR_CLUSTER_NO_SECURITY_CONTEXT = 5059,
+ ERROR_CLUSTER_NETWORK_NOT_INTERNAL = 5060,
+ ERROR_CLUSTER_NODE_ALREADY_UP = 5061,
+ ERROR_CLUSTER_NODE_ALREADY_DOWN = 5062,
+ ERROR_CLUSTER_NETWORK_ALREADY_ONLINE = 5063,
+ ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE = 5064,
+ ERROR_CLUSTER_NODE_ALREADY_MEMBER = 5065,
+ ERROR_CLUSTER_LAST_INTERNAL_NETWORK = 5066,
+ ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS = 5067,
+ ERROR_INVALID_OPERATION_ON_QUORUM = 5068,
+ ERROR_DEPENDENCY_NOT_ALLOWED = 5069,
+ ERROR_CLUSTER_NODE_PAUSED = 5070,
+ ERROR_NODE_CANT_HOST_RESOURCE = 5071,
+ ERROR_CLUSTER_NODE_NOT_READY = 5072,
+ ERROR_CLUSTER_NODE_SHUTTING_DOWN = 5073,
+ ERROR_CLUSTER_JOIN_ABORTED = 5074,
+ ERROR_CLUSTER_INCOMPATIBLE_VERSIONS = 5075,
+ ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED = 5076,
+ ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED = 5077,
+ ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND = 5078,
+ ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED = 5079,
+ ERROR_CLUSTER_RESNAME_NOT_FOUND = 5080,
+ ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED = 5081,
+ ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST = 5082,
+ ERROR_CLUSTER_DATABASE_SEQMISMATCH = 5083,
+ ERROR_RESMON_INVALID_STATE = 5084,
+ ERROR_CLUSTER_GUM_NOT_LOCKER = 5085,
+ ERROR_QUORUM_DISK_NOT_FOUND = 5086,
+ ERROR_DATABASE_BACKUP_CORRUPT = 5087,
+ ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT = 5088,
+ ERROR_RESOURCE_PROPERTY_UNCHANGEABLE = 5089,
+ ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE = 5890,
+ ERROR_CLUSTER_QUORUMLOG_NOT_FOUND = 5891,
+ ERROR_CLUSTER_MEMBERSHIP_HALT = 5892,
+ ERROR_CLUSTER_INSTANCE_ID_MISMATCH = 5893,
+ ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP = 5894,
+ ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH = 5895,
+ ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP = 5896,
+ ERROR_CLUSTER_PARAMETER_MISMATCH = 5897,
+ ERROR_NODE_CANNOT_BE_CLUSTERED = 5898,
+ ERROR_CLUSTER_WRONG_OS_VERSION = 5899,
+ ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME = 5900,
+ ERROR_ENCRYPTION_FAILED = 6000,
+ ERROR_DECRYPTION_FAILED = 6001,
+ ERROR_FILE_ENCRYPTED = 6002,
+ ERROR_NO_RECOVERY_POLICY = 6003,
+ ERROR_NO_EFS = 6004,
+ ERROR_WRONG_EFS = 6005,
+ ERROR_NO_USER_KEYS = 6006,
+ ERROR_FILE_NOT_ENCRYPTED = 6007,
+ ERROR_NOT_EXPORT_FORMAT = 6008,
+ ERROR_FILE_READ_ONLY = 6009,
+ ERROR_DIR_EFS_DISALLOWED = 6010,
+ ERROR_EFS_SERVER_NOT_TRUSTED = 6011,
+ ERROR_BAD_RECOVERY_POLICY = 6012,
+ ERROR_EFS_ALG_BLOB_TOO_BIG = 6013,
+ ERROR_VOLUME_NOT_SUPPORT_EFS = 6014,
+ ERROR_EFS_DISABLED = 6015,
+ ERROR_EFS_VERSION_NOT_SUPPORT = 6016,
+ ERROR_NO_BROWSER_SERVERS_FOUND = 6118,
+ SCHED_E_SERVICE_NOT_LOCALSYSTEM = 6200,
+ ERROR_CTX_WINSTATION_NAME_INVALID = 7001,
+ ERROR_CTX_INVALID_PD = 7002,
+ ERROR_CTX_PD_NOT_FOUND = 7003,
+ ERROR_CTX_WD_NOT_FOUND = 7004,
+ ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY = 7005,
+ ERROR_CTX_SERVICE_NAME_COLLISION = 7006,
+ ERROR_CTX_CLOSE_PENDING = 7007,
+ ERROR_CTX_NO_OUTBUF = 7008,
+ ERROR_CTX_MODEM_INF_NOT_FOUND = 7009,
+ ERROR_CTX_INVALID_MODEMNAME = 7010,
+ ERROR_CTX_MODEM_RESPONSE_ERROR = 7011,
+ ERROR_CTX_MODEM_RESPONSE_TIMEOUT = 7012,
+ ERROR_CTX_MODEM_RESPONSE_NO_CARRIER = 7013,
+ ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE = 7014,
+ ERROR_CTX_MODEM_RESPONSE_BUSY = 7015,
+ ERROR_CTX_MODEM_RESPONSE_VOICE = 7016,
+ ERROR_CTX_TD_ERROR = 7017,
+ ERROR_CTX_WINSTATION_NOT_FOUND = 7022,
+ ERROR_CTX_WINSTATION_ALREADY_EXISTS = 7023,
+ ERROR_CTX_WINSTATION_BUSY = 7024,
+ ERROR_CTX_BAD_VIDEO_MODE = 7025,
+ ERROR_CTX_GRAPHICS_INVALID = 7035,
+ ERROR_CTX_LOGON_DISABLED = 7037,
+ ERROR_CTX_NOT_CONSOLE = 7038,
+ ERROR_CTX_CLIENT_QUERY_TIMEOUT = 7040,
+ ERROR_CTX_CONSOLE_DISCONNECT = 7041,
+ ERROR_CTX_CONSOLE_CONNECT = 7042,
+ ERROR_CTX_SHADOW_DENIED = 7044,
+ ERROR_CTX_WINSTATION_ACCESS_DENIED = 7045,
+ ERROR_CTX_INVALID_WD = 7049,
+ ERROR_CTX_SHADOW_INVALID = 7050,
+ ERROR_CTX_SHADOW_DISABLED = 7051,
+ ERROR_CTX_CLIENT_LICENSE_IN_USE = 7052,
+ ERROR_CTX_CLIENT_LICENSE_NOT_SET = 7053,
+ ERROR_CTX_LICENSE_NOT_AVAILABLE = 7054,
+ ERROR_CTX_LICENSE_CLIENT_INVALID = 7055,
+ ERROR_CTX_LICENSE_EXPIRED = 7056,
+ ERROR_CTX_SHADOW_NOT_RUNNING = 7057,
+ ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE = 7058,
+ FRS_ERR_INVALID_API_SEQUENCE = 8001,
+ FRS_ERR_STARTING_SERVICE = 8002,
+ FRS_ERR_STOPPING_SERVICE = 8003,
+ FRS_ERR_INTERNAL_API = 8004,
+ FRS_ERR_INTERNAL = 8005,
+ FRS_ERR_SERVICE_COMM = 8006,
+ FRS_ERR_INSUFFICIENT_PRIV = 8007,
+ FRS_ERR_AUTHENTICATION = 8008,
+ FRS_ERR_PARENT_INSUFFICIENT_PRIV = 8009,
+ FRS_ERR_PARENT_AUTHENTICATION = 8010,
+ FRS_ERR_CHILD_TO_PARENT_COMM = 8011,
+ FRS_ERR_PARENT_TO_CHILD_COMM = 8012,
+ FRS_ERR_SYSVOL_POPULATE = 8013,
+ FRS_ERR_SYSVOL_POPULATE_TIMEOUT = 8014,
+ FRS_ERR_SYSVOL_IS_BUSY = 8015,
+ FRS_ERR_SYSVOL_DEMOTE = 8016,
+ FRS_ERR_INVALID_SERVICE_PARAMETER = 8017,
+ ERROR_DS_NOT_INSTALLED = 8200,
+ ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY = 8201,
+ ERROR_DS_NO_ATTRIBUTE_OR_VALUE = 8202,
+ ERROR_DS_INVALID_ATTRIBUTE_SYNTAX = 8203,
+ ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED = 8204,
+ ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS = 8205,
+ ERROR_DS_BUSY = 8206,
+ ERROR_DS_UNAVAILABLE = 8207,
+ ERROR_DS_NO_RIDS_ALLOCATED = 8208,
+ ERROR_DS_NO_MORE_RIDS = 8209,
+ ERROR_DS_INCORRECT_ROLE_OWNER = 8210,
+ ERROR_DS_RIDMGR_INIT_ERROR = 8211,
+ ERROR_DS_OBJ_CLASS_VIOLATION = 8212,
+ ERROR_DS_CANT_ON_NON_LEAF = 8213,
+ ERROR_DS_CANT_ON_RDN = 8214,
+ ERROR_DS_CANT_MOD_OBJ_CLASS = 8215,
+ ERROR_DS_CROSS_DOM_MOVE_ERROR = 8216,
+ ERROR_DS_GC_NOT_AVAILABLE = 8217,
+ ERROR_SHARED_POLICY = 8218,
+ ERROR_POLICY_OBJECT_NOT_FOUND = 8219,
+ ERROR_POLICY_ONLY_IN_DS = 8220,
+ ERROR_PROMOTION_ACTIVE = 8221,
+ ERROR_NO_PROMOTION_ACTIVE = 8222,
+ ERROR_DS_OPERATIONS_ERROR = 8224,
+ ERROR_DS_PROTOCOL_ERROR = 8225,
+ ERROR_DS_TIMELIMIT_EXCEEDED = 8226,
+ ERROR_DS_SIZELIMIT_EXCEEDED = 8227,
+ ERROR_DS_ADMIN_LIMIT_EXCEEDED = 8228,
+ ERROR_DS_COMPARE_FALSE = 8229,
+ ERROR_DS_COMPARE_TRUE = 8230,
+ ERROR_DS_AUTH_METHOD_NOT_SUPPORTED = 8231,
+ ERROR_DS_STRONG_AUTH_REQUIRED = 8232,
+ ERROR_DS_INAPPROPRIATE_AUTH = 8233,
+ ERROR_DS_AUTH_UNKNOWN = 8234,
+ ERROR_DS_REFERRAL = 8235,
+ ERROR_DS_UNAVAILABLE_CRIT_EXTENSION = 8236,
+ ERROR_DS_CONFIDENTIALITY_REQUIRED = 8237,
+ ERROR_DS_INAPPROPRIATE_MATCHING = 8238,
+ ERROR_DS_CONSTRAINT_VIOLATION = 8239,
+ ERROR_DS_NO_SUCH_OBJECT = 8240,
+ ERROR_DS_ALIAS_PROBLEM = 8241,
+ ERROR_DS_INVALID_DN_SYNTAX = 8242,
+ ERROR_DS_IS_LEAF = 8243,
+ ERROR_DS_ALIAS_DEREF_PROBLEM = 8244,
+ ERROR_DS_UNWILLING_TO_PERFORM = 8245,
+ ERROR_DS_LOOP_DETECT = 8246,
+ ERROR_DS_NAMING_VIOLATION = 8247,
+ ERROR_DS_OBJECT_RESULTS_TOO_LARGE = 8248,
+ ERROR_DS_AFFECTS_MULTIPLE_DSAS = 8249,
+ ERROR_DS_SERVER_DOWN = 8250,
+ ERROR_DS_LOCAL_ERROR = 8251,
+ ERROR_DS_ENCODING_ERROR = 8252,
+ ERROR_DS_DECODING_ERROR = 8253,
+ ERROR_DS_FILTER_UNKNOWN = 8254,
+ ERROR_DS_PARAM_ERROR = 8255,
+ ERROR_DS_NOT_SUPPORTED = 8256,
+ ERROR_DS_NO_RESULTS_RETURNED = 8257,
+ ERROR_DS_CONTROL_NOT_FOUND = 8258,
+ ERROR_DS_CLIENT_LOOP = 8259,
+ ERROR_DS_REFERRAL_LIMIT_EXCEEDED = 8260,
+ ERROR_DS_SORT_CONTROL_MISSING = 8261,
+ ERROR_DS_OFFSET_RANGE_ERROR = 8262,
+ ERROR_DS_ROOT_MUST_BE_NC = 8301,
+ ERROR_DS_ADD_REPLICA_INHIBITED = 8302,
+ ERROR_DS_ATT_NOT_DEF_IN_SCHEMA = 8303,
+ ERROR_DS_MAX_OBJ_SIZE_EXCEEDED = 8304,
+ ERROR_DS_OBJ_STRING_NAME_EXISTS = 8305,
+ ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA = 8306,
+ ERROR_DS_RDN_DOESNT_MATCH_SCHEMA = 8307,
+ ERROR_DS_NO_REQUESTED_ATTS_FOUND = 8308,
+ ERROR_DS_USER_BUFFER_TO_SMALL = 8309,
+ ERROR_DS_ATT_IS_NOT_ON_OBJ = 8310,
+ ERROR_DS_ILLEGAL_MOD_OPERATION = 8311,
+ ERROR_DS_OBJ_TOO_LARGE = 8312,
+ ERROR_DS_BAD_INSTANCE_TYPE = 8313,
+ ERROR_DS_MASTERDSA_REQUIRED = 8314,
+ ERROR_DS_OBJECT_CLASS_REQUIRED = 8315,
+ ERROR_DS_MISSING_REQUIRED_ATT = 8316,
+ ERROR_DS_ATT_NOT_DEF_FOR_CLASS = 8317,
+ ERROR_DS_ATT_ALREADY_EXISTS = 8318,
+ ERROR_DS_CANT_ADD_ATT_VALUES = 8320,
+ ERROR_DS_SINGLE_VALUE_CONSTRAINT = 8321,
+ ERROR_DS_RANGE_CONSTRAINT = 8322,
+ ERROR_DS_ATT_VAL_ALREADY_EXISTS = 8323,
+ ERROR_DS_CANT_REM_MISSING_ATT = 8324,
+ ERROR_DS_CANT_REM_MISSING_ATT_VAL = 8325,
+ ERROR_DS_ROOT_CANT_BE_SUBREF = 8326,
+ ERROR_DS_NO_CHAINING = 8327,
+ ERROR_DS_NO_CHAINED_EVAL = 8328,
+ ERROR_DS_NO_PARENT_OBJECT = 8329,
+ ERROR_DS_PARENT_IS_AN_ALIAS = 8330,
+ ERROR_DS_CANT_MIX_MASTER_AND_REPS = 8331,
+ ERROR_DS_CHILDREN_EXIST = 8332,
+ ERROR_DS_OBJ_NOT_FOUND = 8333,
+ ERROR_DS_ALIASED_OBJ_MISSING = 8334,
+ ERROR_DS_BAD_NAME_SYNTAX = 8335,
+ ERROR_DS_ALIAS_POINTS_TO_ALIAS = 8336,
+ ERROR_DS_CANT_DEREF_ALIAS = 8337,
+ ERROR_DS_OUT_OF_SCOPE = 8338,
+ ERROR_DS_OBJECT_BEING_REMOVED = 8339,
+ ERROR_DS_CANT_DELETE_DSA_OBJ = 8340,
+ ERROR_DS_GENERIC_ERROR = 8341,
+ ERROR_DS_DSA_MUST_BE_INT_MASTER = 8342,
+ ERROR_DS_CLASS_NOT_DSA = 8343,
+ ERROR_DS_INSUFF_ACCESS_RIGHTS = 8344,
+ ERROR_DS_ILLEGAL_SUPERIOR = 8345,
+ ERROR_DS_ATTRIBUTE_OWNED_BY_SAM = 8346,
+ ERROR_DS_NAME_TOO_MANY_PARTS = 8347,
+ ERROR_DS_NAME_TOO_LONG = 8348,
+ ERROR_DS_NAME_VALUE_TOO_LONG = 8349,
+ ERROR_DS_NAME_UNPARSEABLE = 8350,
+ ERROR_DS_NAME_TYPE_UNKNOWN = 8351,
+ ERROR_DS_NOT_AN_OBJECT = 8352,
+ ERROR_DS_SEC_DESC_TOO_SHORT = 8353,
+ ERROR_DS_SEC_DESC_INVALID = 8354,
+ ERROR_DS_NO_DELETED_NAME = 8355,
+ ERROR_DS_SUBREF_MUST_HAVE_PARENT = 8356,
+ ERROR_DS_NCNAME_MUST_BE_NC = 8357,
+ ERROR_DS_CANT_ADD_SYSTEM_ONLY = 8358,
+ ERROR_DS_CLASS_MUST_BE_CONCRETE = 8359,
+ ERROR_DS_INVALID_DMD = 8360,
+ ERROR_DS_OBJ_GUID_EXISTS = 8361,
+ ERROR_DS_NOT_ON_BACKLINK = 8362,
+ ERROR_DS_NO_CROSSREF_FOR_NC = 8363,
+ ERROR_DS_SHUTTING_DOWN = 8364,
+ ERROR_DS_UNKNOWN_OPERATION = 8365,
+ ERROR_DS_INVALID_ROLE_OWNER = 8366,
+ ERROR_DS_COULDNT_CONTACT_FSMO = 8367,
+ ERROR_DS_CROSS_NC_DN_RENAME = 8368,
+ ERROR_DS_CANT_MOD_SYSTEM_ONLY = 8369,
+ ERROR_DS_REPLICATOR_ONLY = 8370,
+ ERROR_DS_OBJ_CLASS_NOT_DEFINED = 8371,
+ ERROR_DS_OBJ_CLASS_NOT_SUBCLASS = 8372,
+ ERROR_DS_NAME_REFERENCE_INVALID = 8373,
+ ERROR_DS_CROSS_REF_EXISTS = 8374,
+ ERROR_DS_CANT_DEL_MASTER_CROSSREF = 8375,
+ ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD = 8376,
+ ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX = 8377,
+ ERROR_DS_DUP_RDN = 8378,
+ ERROR_DS_DUP_OID = 8379,
+ ERROR_DS_DUP_MAPI_ID = 8380,
+ ERROR_DS_DUP_SCHEMA_ID_GUID = 8381,
+ ERROR_DS_DUP_LDAP_DISPLAY_NAME = 8382,
+ ERROR_DS_SEMANTIC_ATT_TEST = 8383,
+ ERROR_DS_SYNTAX_MISMATCH = 8384,
+ ERROR_DS_EXISTS_IN_MUST_HAVE = 8385,
+ ERROR_DS_EXISTS_IN_MAY_HAVE = 8386,
+ ERROR_DS_NONEXISTENT_MAY_HAVE = 8387,
+ ERROR_DS_NONEXISTENT_MUST_HAVE = 8388,
+ ERROR_DS_AUX_CLS_TEST_FAIL = 8389,
+ ERROR_DS_NONEXISTENT_POSS_SUP = 8390,
+ ERROR_DS_SUB_CLS_TEST_FAIL = 8391,
+ ERROR_DS_BAD_RDN_ATT_ID_SYNTAX = 8392,
+ ERROR_DS_EXISTS_IN_AUX_CLS = 8393,
+ ERROR_DS_EXISTS_IN_SUB_CLS = 8394,
+ ERROR_DS_EXISTS_IN_POSS_SUP = 8395,
+ ERROR_DS_RECALCSCHEMA_FAILED = 8396,
+ ERROR_DS_TREE_DELETE_NOT_FINISHED = 8397,
+ ERROR_DS_CANT_DELETE = 8398,
+ ERROR_DS_ATT_SCHEMA_REQ_ID = 8399,
+ ERROR_DS_BAD_ATT_SCHEMA_SYNTAX = 8400,
+ ERROR_DS_CANT_CACHE_ATT = 8401,
+ ERROR_DS_CANT_CACHE_CLASS = 8402,
+ ERROR_DS_CANT_REMOVE_ATT_CACHE = 8403,
+ ERROR_DS_CANT_REMOVE_CLASS_CACHE = 8404,
+ ERROR_DS_CANT_RETRIEVE_DN = 8405,
+ ERROR_DS_MISSING_SUPREF = 8406,
+ ERROR_DS_CANT_RETRIEVE_INSTANCE = 8407,
+ ERROR_DS_CODE_INCONSISTENCY = 8408,
+ ERROR_DS_DATABASE_ERROR = 8409,
+ ERROR_DS_GOVERNSID_MISSING = 8410,
+ ERROR_DS_MISSING_EXPECTED_ATT = 8411,
+ ERROR_DS_NCNAME_MISSING_CR_REF = 8412,
+ ERROR_DS_SECURITY_CHECKING_ERROR = 8413,
+ ERROR_DS_SCHEMA_NOT_LOADED = 8414,
+ ERROR_DS_SCHEMA_ALLOC_FAILED = 8415,
+ ERROR_DS_ATT_SCHEMA_REQ_SYNTAX = 8416,
+ ERROR_DS_GCVERIFY_ERROR = 8417,
+ ERROR_DS_DRA_SCHEMA_MISMATCH = 8418,
+ ERROR_DS_CANT_FIND_DSA_OBJ = 8419,
+ ERROR_DS_CANT_FIND_EXPECTED_NC = 8420,
+ ERROR_DS_CANT_FIND_NC_IN_CACHE = 8421,
+ ERROR_DS_CANT_RETRIEVE_CHILD = 8422,
+ ERROR_DS_SECURITY_ILLEGAL_MODIFY = 8423,
+ ERROR_DS_CANT_REPLACE_HIDDEN_REC = 8424,
+ ERROR_DS_BAD_HIERARCHY_FILE = 8425,
+ ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED = 8426,
+ ERROR_DS_CONFIG_PARAM_MISSING = 8427,
+ ERROR_DS_COUNTING_AB_INDICES_FAILED = 8428,
+ ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED = 8429,
+ ERROR_DS_INTERNAL_FAILURE = 8430,
+ ERROR_DS_UNKNOWN_ERROR = 8431,
+ ERROR_DS_ROOT_REQUIRES_CLASS_TOP = 8432,
+ ERROR_DS_REFUSING_FSMO_ROLES = 8433,
+ ERROR_DS_MISSING_FSMO_SETTINGS = 8434,
+ ERROR_DS_UNABLE_TO_SURRENDER_ROLES = 8435,
+ ERROR_DS_DRA_GENERIC = 8436,
+ ERROR_DS_DRA_INVALID_PARAMETER = 8437,
+ ERROR_DS_DRA_BUSY = 8438,
+ ERROR_DS_DRA_BAD_DN = 8439,
+ ERROR_DS_DRA_BAD_NC = 8440,
+ ERROR_DS_DRA_DN_EXISTS = 8441,
+ ERROR_DS_DRA_INTERNAL_ERROR = 8442,
+ ERROR_DS_DRA_INCONSISTENT_DIT = 8443,
+ ERROR_DS_DRA_CONNECTION_FAILED = 8444,
+ ERROR_DS_DRA_BAD_INSTANCE_TYPE = 8445,
+ ERROR_DS_DRA_OUT_OF_MEM = 8446,
+ ERROR_DS_DRA_MAIL_PROBLEM = 8447,
+ ERROR_DS_DRA_REF_ALREADY_EXISTS = 8448,
+ ERROR_DS_DRA_REF_NOT_FOUND = 8449,
+ ERROR_DS_DRA_OBJ_IS_REP_SOURCE = 8450,
+ ERROR_DS_DRA_DB_ERROR = 8451,
+ ERROR_DS_DRA_NO_REPLICA = 8452,
+ ERROR_DS_DRA_ACCESS_DENIED = 8453,
+ ERROR_DS_DRA_NOT_SUPPORTED = 8454,
+ ERROR_DS_DRA_RPC_CANCELLED = 8455,
+ ERROR_DS_DRA_SOURCE_DISABLED = 8456,
+ ERROR_DS_DRA_SINK_DISABLED = 8457,
+ ERROR_DS_DRA_NAME_COLLISION = 8458,
+ ERROR_DS_DRA_SOURCE_REINSTALLED = 8459,
+ ERROR_DS_DRA_MISSING_PARENT = 8460,
+ ERROR_DS_DRA_PREEMPTED = 8461,
+ ERROR_DS_DRA_ABANDON_SYNC = 8462,
+ ERROR_DS_DRA_SHUTDOWN = 8463,
+ ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET = 8464,
+ ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA = 8465,
+ ERROR_DS_DRA_EXTN_CONNECTION_FAILED = 8466,
+ ERROR_DS_INSTALL_SCHEMA_MISMATCH = 8467,
+ ERROR_DS_DUP_LINK_ID = 8468,
+ ERROR_DS_NAME_ERROR_RESOLVING = 8469,
+ ERROR_DS_NAME_ERROR_NOT_FOUND = 8470,
+ ERROR_DS_NAME_ERROR_NOT_UNIQUE = 8471,
+ ERROR_DS_NAME_ERROR_NO_MAPPING = 8472,
+ ERROR_DS_NAME_ERROR_DOMAIN_ONLY = 8473,
+ ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 8474,
+ ERROR_DS_CONSTRUCTED_ATT_MOD = 8475,
+ ERROR_DS_WRONG_OM_OBJ_CLASS = 8476,
+ ERROR_DS_DRA_REPL_PENDING = 8477,
+ ERROR_DS_DS_REQUIRED = 8478,
+ ERROR_DS_INVALID_LDAP_DISPLAY_NAME = 8479,
+ ERROR_DS_NON_BASE_SEARCH = 8480,
+ ERROR_DS_CANT_RETRIEVE_ATTS = 8481,
+ ERROR_DS_BACKLINK_WITHOUT_LINK = 8482,
+ ERROR_DS_EPOCH_MISMATCH = 8483,
+ ERROR_DS_SRC_NAME_MISMATCH = 8484,
+ ERROR_DS_SRC_AND_DST_NC_IDENTICAL = 8485,
+ ERROR_DS_DST_NC_MISMATCH = 8486,
+ ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC = 8487,
+ ERROR_DS_SRC_GUID_MISMATCH = 8488,
+ ERROR_DS_CANT_MOVE_DELETED_OBJECT = 8489,
+ ERROR_DS_PDC_OPERATION_IN_PROGRESS = 8490,
+ ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD = 8491,
+ ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION = 8492,
+ ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS = 8493,
+ ERROR_DS_NC_MUST_HAVE_NC_PARENT = 8494,
+ ERROR_DS_DST_DOMAIN_NOT_NATIVE = 8496,
+ ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER = 8497,
+ ERROR_DS_CANT_MOVE_ACCOUNT_GROUP = 8498,
+ ERROR_DS_CANT_MOVE_RESOURCE_GROUP = 8499,
+ ERROR_DS_INVALID_SEARCH_FLAG = 8500,
+ ERROR_DS_NO_TREE_DELETE_ABOVE_NC = 8501,
+ ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE = 8502,
+ ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE = 8503,
+ ERROR_DS_SAM_INIT_FAILURE = 8504,
+ ERROR_DS_SENSITIVE_GROUP_VIOLATION = 8505,
+ ERROR_DS_CANT_MOD_PRIMARYGROUPID = 8506,
+ ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD = 8507,
+ ERROR_DS_NONSAFE_SCHEMA_CHANGE = 8508,
+ ERROR_DS_SCHEMA_UPDATE_DISALLOWED = 8509,
+ ERROR_DS_CANT_CREATE_UNDER_SCHEMA = 8510,
+ ERROR_DS_INSTALL_NO_SRC_SCH_VERSION = 8511,
+ ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE = 8512,
+ ERROR_DS_INVALID_GROUP_TYPE = 8513,
+ ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = 8514,
+ ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = 8515,
+ ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = 8516,
+ ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = 8517,
+ ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = 8518,
+ ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = 8519,
+ ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = 8520,
+ ERROR_DS_HAVE_PRIMARY_MEMBERS = 8521,
+ ERROR_DS_STRING_SD_CONVERSION_FAILED = 8522,
+ ERROR_DS_NAMING_MASTER_GC = 8523,
+ ERROR_DS_LOOKUP_FAILURE = 8524,
+ ERROR_DS_COULDNT_UPDATE_SPNS = 8525,
+ ERROR_DS_CANT_RETRIEVE_SD = 8526,
+ ERROR_DS_KEY_NOT_UNIQUE = 8527,
+ ERROR_DS_WRONG_LINKED_ATT_SYNTAX = 8528,
+ ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD = 8529,
+ ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY = 8530,
+ ERROR_DS_CANT_START = 8531,
+ ERROR_DS_INIT_FAILURE = 8532,
+ ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION = 8533,
+ ERROR_DS_SOURCE_DOMAIN_IN_FOREST = 8534,
+ ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST = 8535,
+ ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED = 8536,
+ ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN = 8537,
+ ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER = 8538,
+ ERROR_DS_SRC_SID_EXISTS_IN_FOREST = 8539,
+ ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH = 8540,
+ ERROR_SAM_INIT_FAILURE = 8541,
+ ERROR_DS_DRA_SCHEMA_INFO_SHIP = 8542,
+ ERROR_DS_DRA_SCHEMA_CONFLICT = 8543,
+ ERROR_DS_DRA_EARLIER_SCHEMA_CONLICT = 8544,
+ ERROR_DS_DRA_OBJ_NC_MISMATCH = 8545,
+ ERROR_DS_NC_STILL_HAS_DSAS = 8546,
+ ERROR_DS_GC_REQUIRED = 8547,
+ ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY = 8548,
+ ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS = 8549,
+ ERROR_DS_CANT_ADD_TO_GC = 8550,
+ ERROR_DS_NO_CHECKPOINT_WITH_PDC = 8551,
+ ERROR_DS_SOURCE_AUDITING_NOT_ENABLED = 8552,
+ ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC = 8553,
+ ERROR_DS_INVALID_NAME_FOR_SPN = 8554,
+ ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS = 8555,
+ ERROR_DS_UNICODEPWD_NOT_IN_QUOTES = 8556,
+ ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = 8557,
+ ERROR_DS_MUST_BE_RUN_ON_DST_DC = 8558,
+ ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER = 8559,
+ ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ = 8560,
+ ERROR_DS_INIT_FAILURE_CONSOLE = 8561,
+ ERROR_DS_SAM_INIT_FAILURE_CONSOLE = 8562,
+ ERROR_DS_FOREST_VERSION_TOO_HIGH = 8563,
+ ERROR_DS_DOMAIN_VERSION_TOO_HIGH = 8564,
+ ERROR_DS_FOREST_VERSION_TOO_LOW = 8565,
+ ERROR_DS_DOMAIN_VERSION_TOO_LOW = 8566,
+ ERROR_DS_INCOMPATIBLE_VERSION = 8567,
+ ERROR_DS_LOW_DSA_VERSION = 8568,
+ ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN = 8569,
+ ERROR_DS_NOT_SUPPORTED_SORT_ORDER = 8570,
+ ERROR_DS_NAME_NOT_UNIQUE = 8571,
+ ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 = 8572,
+ ERROR_DS_OUT_OF_VERSION_STORE = 8573,
+ ERROR_DS_INCOMPATIBLE_CONTROLS_USED = 8574,
+ ERROR_DS_NO_REF_DOMAIN = 8575,
+ ERROR_DS_RESERVED_LINK_ID = 8576,
+ ERROR_DS_LINK_ID_NOT_AVAILABLE = 8577,
+ ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = 8578,
+ ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE = 8579,
+ ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC = 8580,
+ ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG = 8581,
+ ERROR_DS_MODIFYDN_WRONG_GRANDPARENT = 8582,
+ ERROR_DS_NAME_ERROR_TRUST_REFERRAL = 8583,
+ ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER = 8584,
+ ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD = 8585,
+ ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE = 8586,
+ ERROR_DS_THREAD_LIMIT_EXCEEDED = 8587,
+ ERROR_DS_NOT_CLOSEST = 8588,
+ ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF = 8589,
+ ERROR_DS_SINGLE_USER_MODE_FAILED = 8590,
+ ERROR_DS_NTDSCRIPT_SYNTAX_ERROR = 8591,
+ ERROR_DS_NTDSCRIPT_PROCESS_ERROR = 8592,
+ ERROR_DS_DIFFERENT_REPL_EPOCHS = 8593,
+ ERROR_DS_DRS_EXTENSIONS_CHANGED = 8594,
+ ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR = 8595,
+ ERROR_DS_NO_MSDS_INTID = 8596,
+ ERROR_DS_DUP_MSDS_INTID = 8597,
+ ERROR_DS_EXISTS_IN_RDNATTID = 8598,
+ ERROR_DS_AUTHORIZATION_FAILED = 8599,
+ ERROR_DS_INVALID_SCRIPT = 8600,
+ ERROR_DS_REMOTE_CROSSREF_OP_FAILED = 8601,
+ DNS_ERROR_RCODE_FORMAT_ERROR = 9001,
+ DNS_ERROR_RCODE_SERVER_FAILURE = 9002,
+ DNS_ERROR_RCODE_NAME_ERROR = 9003,
+ DNS_ERROR_RCODE_NOT_IMPLEMENTED = 9004,
+ DNS_ERROR_RCODE_REFUSED = 9005,
+ DNS_ERROR_RCODE_YXDOMAIN = 9006,
+ DNS_ERROR_RCODE_YXRRSET = 9007,
+ DNS_ERROR_RCODE_NXRRSET = 9008,
+ DNS_ERROR_RCODE_NOTAUTH = 9009,
+ DNS_ERROR_RCODE_NOTZONE = 9010,
+ DNS_ERROR_RCODE_BADSIG = 9016,
+ DNS_ERROR_RCODE_BADKEY = 9017,
+ DNS_ERROR_RCODE_BADTIME = 9018,
+ DNS_INFO_NO_RECORDS = 9501,
+ DNS_ERROR_BAD_PACKET = 9502,
+ DNS_ERROR_NO_PACKET = 9503,
+ DNS_ERROR_RCODE = 9504,
+ DNS_ERROR_UNSECURE_PACKET = 9505,
+ DNS_ERROR_INVALID_TYPE = 9551,
+ DNS_ERROR_INVALID_IP_ADDRESS = 9552,
+ DNS_ERROR_INVALID_PROPERTY = 9553,
+ DNS_ERROR_TRY_AGAIN_LATER = 9554,
+ DNS_ERROR_NOT_UNIQUE = 9555,
+ DNS_ERROR_NON_RFC_NAME = 9556,
+ DNS_STATUS_FQDN = 9557,
+ DNS_STATUS_DOTTED_NAME = 9558,
+ DNS_STATUS_SINGLE_PART_NAME = 9559,
+ DNS_ERROR_INVALID_NAME_CHAR = 9560,
+ DNS_ERROR_NUMERIC_NAME = 9561,
+ DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER = 9562,
+ DNS_ERROR_ZONE_DOES_NOT_EXIST = 9601,
+ DNS_ERROR_NO_ZONE_INFO = 9602,
+ DNS_ERROR_INVALID_ZONE_OPERATION = 9603,
+ DNS_ERROR_ZONE_CONFIGURATION_ERROR = 9604,
+ DNS_ERROR_ZONE_HAS_NO_SOA_RECORD = 9605,
+ DNS_ERROR_ZONE_HAS_NO_NS_RECORDS = 9606,
+ DNS_ERROR_ZONE_LOCKED = 9607,
+ DNS_ERROR_ZONE_CREATION_FAILED = 9608,
+ DNS_ERROR_ZONE_ALREADY_EXISTS = 9609,
+ DNS_ERROR_AUTOZONE_ALREADY_EXISTS = 9610,
+ DNS_ERROR_INVALID_ZONE_TYPE = 9611,
+ DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP = 9612,
+ DNS_ERROR_ZONE_NOT_SECONDARY = 9613,
+ DNS_ERROR_NEED_SECONDARY_ADDRESSES = 9614,
+ DNS_ERROR_WINS_INIT_FAILED = 9615,
+ DNS_ERROR_NEED_WINS_SERVERS = 9616,
+ DNS_ERROR_NBSTAT_INIT_FAILED = 9617,
+ DNS_ERROR_SOA_DELETE_INVALID = 9618,
+ DNS_ERROR_FORWARDER_ALREADY_EXISTS = 9619,
+ DNS_ERROR_ZONE_REQUIRES_MASTER_IP = 9620,
+ DNS_ERROR_ZONE_IS_SHUTDOWN = 9621,
+ DNS_ERROR_PRIMARY_REQUIRES_DATAFILE = 9651,
+ DNS_ERROR_INVALID_DATAFILE_NAME = 9652,
+ DNS_ERROR_DATAFILE_OPEN_FAILURE = 9653,
+ DNS_ERROR_FILE_WRITEBACK_FAILED = 9654,
+ DNS_ERROR_DATAFILE_PARSING = 9655,
+ DNS_ERROR_RECORD_DOES_NOT_EXIST = 9701,
+ DNS_ERROR_RECORD_FORMAT = 9702,
+ DNS_ERROR_NODE_CREATION_FAILED = 9703,
+ DNS_ERROR_UNKNOWN_RECORD_TYPE = 9704,
+ DNS_ERROR_RECORD_TIMED_OUT = 9705,
+ DNS_ERROR_NAME_NOT_IN_ZONE = 9706,
+ DNS_ERROR_CNAME_LOOP = 9707,
+ DNS_ERROR_NODE_IS_CNAME = 9708,
+ DNS_ERROR_CNAME_COLLISION = 9709,
+ DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT = 9710,
+ DNS_ERROR_RECORD_ALREADY_EXISTS = 9711,
+ DNS_ERROR_SECONDARY_DATA = 9712,
+ DNS_ERROR_NO_CREATE_CACHE_DATA = 9713,
+ DNS_ERROR_NAME_DOES_NOT_EXIST = 9714,
+ DNS_WARNING_PTR_CREATE_FAILED = 9715,
+ DNS_WARNING_DOMAIN_UNDELETED = 9716,
+ DNS_ERROR_DS_UNAVAILABLE = 9717,
+ DNS_ERROR_DS_ZONE_ALREADY_EXISTS = 9718,
+ DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE = 9719,
+ DNS_INFO_AXFR_COMPLETE = 9751,
+ DNS_ERROR_AXFR = 9752,
+ DNS_INFO_ADDED_LOCAL_WINS = 9753,
+ DNS_STATUS_CONTINUE_NEEDED = 9801,
+ DNS_ERROR_NO_TCPIP = 9851,
+ DNS_ERROR_NO_DNS_SERVERS = 9852,
+ DNS_ERROR_DP_DOES_NOT_EXIST = 9901,
+ DNS_ERROR_DP_ALREADY_EXISTS = 9902,
+ DNS_ERROR_DP_NOT_ENLISTED = 9903,
+ DNS_ERROR_DP_ALREADY_ENLISTED = 9904,
+ WSAEINTR = 10004,
+ WSAEBADF = 10009,
+ WSAEACCES = 10013,
+ WSAEFAULT = 10014,
+ WSAEINVAL = 10022,
+ WSAEMFILE = 10024,
+ WSAEWOULDBLOCK = 10035,
+ WSAEINPROGRESS = 10036,
+ WSAEALREADY = 10037,
+ WSAENOTSOCK = 10038,
+ WSAEDESTADDRREQ = 10039,
+ WSAEMSGSIZE = 10040,
+ WSAEPROTOTYPE = 10041,
+ WSAENOPROTOOPT = 10042,
+ WSAEPROTONOSUPPORT = 10043,
+ WSAESOCKTNOSUPPORT = 10044,
+ WSAEOPNOTSUPP = 10045,
+ WSAEPFNOSUPPORT = 10046,
+ WSAEAFNOSUPPORT = 10047,
+ WSAEADDRINUSE = 10048,
+ WSAEADDRNOTAVAIL = 10049,
+ WSAENETDOWN = 10050,
+ WSAENETUNREACH = 10051,
+ WSAENETRESET = 10052,
+ WSAECONNABORTED = 10053,
+ WSAECONNRESET = 10054,
+ WSAENOBUFS = 10055,
+ WSAEISCONN = 10056,
+ WSAENOTCONN = 10057,
+ WSAESHUTDOWN = 10058,
+ WSAETOOMANYREFS = 10059,
+ WSAETIMEDOUT = 10060,
+ WSAECONNREFUSED = 10061,
+ WSAELOOP = 10062,
+ WSAENAMETOOLONG = 10063,
+ WSAEHOSTDOWN = 10064,
+ WSAEHOSTUNREACH = 10065,
+ WSAENOTEMPTY = 10066,
+ WSAEPROCLIM = 10067,
+ WSAEUSERS = 10068,
+ WSAEDQUOT = 10069,
+ WSAESTALE = 10070,
+ WSAEREMOTE = 10071,
+ WSASYSNOTREADY = 10091,
+ WSAVERNOTSUPPORTED = 10092,
+ WSANOTINITIALISED = 10093,
+ WSAEDISCON = 10101,
+ WSAENOMORE = 10102,
+ WSAECANCELLED = 10103,
+ WSAEINVALIDPROCTABLE = 10104,
+ WSAEINVALIDPROVIDER = 10105,
+ WSAEPROVIDERFAILEDINIT = 10106,
+ WSASYSCALLFAILURE = 10107,
+ WSASERVICE_NOT_FOUND = 10108,
+ WSATYPE_NOT_FOUND = 10109,
+ WSA_E_NO_MORE = 10110,
+ WSA_E_CANCELLED = 10111,
+ WSAEREFUSED = 10112,
+ WSAHOST_NOT_FOUND = 11001,
+ WSATRY_AGAIN = 11002,
+ WSANO_RECOVERY = 11003,
+ WSANO_DATA = 11004,
+ WSA_QOS_RECEIVERS = 11005,
+ WSA_QOS_SENDERS = 11006,
+ WSA_QOS_NO_SENDERS = 11007,
+ WSA_QOS_NO_RECEIVERS = 11008,
+ WSA_QOS_REQUEST_CONFIRMED = 11009,
+ WSA_QOS_ADMISSION_FAILURE = 11010,
+ WSA_QOS_POLICY_FAILURE = 11011,
+ WSA_QOS_BAD_STYLE = 11012,
+ WSA_QOS_BAD_OBJECT = 11013,
+ WSA_QOS_TRAFFIC_CTRL_ERROR = 11014,
+ WSA_QOS_GENERIC_ERROR = 11015,
+ WSA_QOS_ESERVICETYPE = 11016,
+ WSA_QOS_EFLOWSPEC = 11017,
+ WSA_QOS_EPROVSPECBUF = 11018,
+ WSA_QOS_EFILTERSTYLE = 11019,
+ WSA_QOS_EFILTERTYPE = 11020,
+ WSA_QOS_EFILTERCOUNT = 11021,
+ WSA_QOS_EOBJLENGTH = 11022,
+ WSA_QOS_EFLOWCOUNT = 11023,
+ WSA_QOS_EUNKNOWNPSOBJ = 11024,
+ WSA_QOS_EPOLICYOBJ = 11025,
+ WSA_QOS_EFLOWDESC = 11026,
+ WSA_QOS_EPSFLOWSPEC = 11027,
+ WSA_QOS_EPSFILTERSPEC = 11028,
+ WSA_QOS_ESDMODEOBJ = 11029,
+ WSA_QOS_ESHAPERATEOBJ = 11030,
+ WSA_QOS_RESERVED_PETYPE = 11031,
+ ERROR_IPSEC_QM_POLICY_EXISTS = 13000,
+ ERROR_IPSEC_QM_POLICY_NOT_FOUND = 13001,
+ ERROR_IPSEC_QM_POLICY_IN_USE = 13002,
+ ERROR_IPSEC_MM_POLICY_EXISTS = 13003,
+ ERROR_IPSEC_MM_POLICY_NOT_FOUND = 13004,
+ ERROR_IPSEC_MM_POLICY_IN_USE = 13005,
+ ERROR_IPSEC_MM_FILTER_EXISTS = 13006,
+ ERROR_IPSEC_MM_FILTER_NOT_FOUND = 13007,
+ ERROR_IPSEC_TRANSPORT_FILTER_EXISTS = 13008,
+ ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND = 13009,
+ ERROR_IPSEC_MM_AUTH_EXISTS = 13010,
+ ERROR_IPSEC_MM_AUTH_NOT_FOUND = 13011,
+ ERROR_IPSEC_MM_AUTH_IN_USE = 13012,
+ ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND = 13013,
+ ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND = 13014,
+ ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND = 13015,
+ ERROR_IPSEC_TUNNEL_FILTER_EXISTS = 13016,
+ ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND = 13017,
+ ERROR_IPSEC_MM_FILTER_PENDING_DELETION = 13018,
+ ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION = 13019,
+ ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION = 13020,
+ ERROR_IPSEC_MM_POLICY_PENDING_DELETION = 13021,
+ ERROR_IPSEC_MM_AUTH_PENDING_DELETION = 13022,
+ ERROR_IPSEC_QM_POLICY_PENDING_DELETION = 13023,
+ ERROR_IPSEC_IKE_AUTH_FAIL = 13801,
+ ERROR_IPSEC_IKE_ATTRIB_FAIL = 13802,
+ ERROR_IPSEC_IKE_NEGOTIATION_PENDING = 13803,
+ ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR = 13804,
+ ERROR_IPSEC_IKE_TIMED_OUT = 13805,
+ ERROR_IPSEC_IKE_NO_CERT = 13806,
+ ERROR_IPSEC_IKE_SA_DELETED = 13807,
+ ERROR_IPSEC_IKE_SA_REAPED = 13808,
+ ERROR_IPSEC_IKE_MM_ACQUIRE_DROP = 13809,
+ ERROR_IPSEC_IKE_QM_ACQUIRE_DROP = 13810,
+ ERROR_IPSEC_IKE_QUEUE_DROP_MM = 13811,
+ ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM = 13812,
+ ERROR_IPSEC_IKE_DROP_NO_RESPONSE = 13813,
+ ERROR_IPSEC_IKE_MM_DELAY_DROP = 13814,
+ ERROR_IPSEC_IKE_QM_DELAY_DROP = 13815,
+ ERROR_IPSEC_IKE_ERROR = 13816,
+ ERROR_IPSEC_IKE_CRL_FAILED = 13817,
+ ERROR_IPSEC_IKE_INVALID_KEY_USAGE = 13818,
+ ERROR_IPSEC_IKE_INVALID_CERT_TYPE = 13819,
+ ERROR_IPSEC_IKE_NO_PRIVATE_KEY = 13820,
+ ERROR_IPSEC_IKE_DH_FAIL = 13822,
+ ERROR_IPSEC_IKE_INVALID_HEADER = 13824,
+ ERROR_IPSEC_IKE_NO_POLICY = 13825,
+ ERROR_IPSEC_IKE_INVALID_SIGNATURE = 13826,
+ ERROR_IPSEC_IKE_KERBEROS_ERROR = 13827,
+ ERROR_IPSEC_IKE_NO_PUBLIC_KEY = 13828,
+ ERROR_IPSEC_IKE_PROCESS_ERR = 13829,
+ ERROR_IPSEC_IKE_PROCESS_ERR_SA = 13830,
+ ERROR_IPSEC_IKE_PROCESS_ERR_PROP = 13831,
+ ERROR_IPSEC_IKE_PROCESS_ERR_TRANS = 13832,
+ ERROR_IPSEC_IKE_PROCESS_ERR_KE = 13833,
+ ERROR_IPSEC_IKE_PROCESS_ERR_ID = 13834,
+ ERROR_IPSEC_IKE_PROCESS_ERR_CERT = 13835,
+ ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ = 13836,
+ ERROR_IPSEC_IKE_PROCESS_ERR_HASH = 13837,
+ ERROR_IPSEC_IKE_PROCESS_ERR_SIG = 13838,
+ ERROR_IPSEC_IKE_PROCESS_ERR_NONCE = 13839,
+ ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY = 13840,
+ ERROR_IPSEC_IKE_PROCESS_ERR_DELETE = 13841,
+ ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR = 13842,
+ ERROR_IPSEC_IKE_INVALID_PAYLOAD = 13843,
+ ERROR_IPSEC_IKE_LOAD_SOFT_SA = 13844,
+ ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN = 13845,
+ ERROR_IPSEC_IKE_INVALID_COOKIE = 13846,
+ ERROR_IPSEC_IKE_NO_PEER_CERT = 13847,
+ ERROR_IPSEC_IKE_PEER_CRL_FAILED = 13848,
+ ERROR_IPSEC_IKE_POLICY_CHANGE = 13849,
+ ERROR_IPSEC_IKE_NO_MM_POLICY = 13850,
+ ERROR_IPSEC_IKE_NOTCBPRIV = 13851,
+ ERROR_IPSEC_IKE_SECLOADFAIL = 13852,
+ ERROR_IPSEC_IKE_FAILSSPINIT = 13853,
+ ERROR_IPSEC_IKE_FAILQUERYSSP = 13854,
+ ERROR_IPSEC_IKE_SRVACQFAIL = 13855,
+ ERROR_IPSEC_IKE_SRVQUERYCRED = 13856,
+ ERROR_IPSEC_IKE_GETSPIFAIL = 13857,
+ ERROR_IPSEC_IKE_INVALID_FILTER = 13858,
+ ERROR_IPSEC_IKE_OUT_OF_MEMORY = 13859,
+ ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED = 13860,
+ ERROR_IPSEC_IKE_INVALID_POLICY = 13861,
+ ERROR_IPSEC_IKE_UNKNOWN_DOI = 13862,
+ ERROR_IPSEC_IKE_INVALID_SITUATION = 13863,
+ ERROR_IPSEC_IKE_DH_FAILURE = 13864,
+ ERROR_IPSEC_IKE_INVALID_GROUP = 13865,
+ ERROR_IPSEC_IKE_ENCRYPT = 13866,
+ ERROR_IPSEC_IKE_DECRYPT = 13867,
+ ERROR_IPSEC_IKE_POLICY_MATCH = 13868,
+ ERROR_IPSEC_IKE_UNSUPPORTED_ID = 13869,
+ ERROR_IPSEC_IKE_INVALID_HASH = 13870,
+ ERROR_IPSEC_IKE_INVALID_HASH_ALG = 13871,
+ ERROR_IPSEC_IKE_INVALID_HASH_SIZE = 13872,
+ ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG = 13873,
+ ERROR_IPSEC_IKE_INVALID_AUTH_ALG = 13874,
+ ERROR_IPSEC_IKE_INVALID_SIG = 13875,
+ ERROR_IPSEC_IKE_LOAD_FAILED = 13876,
+ ERROR_IPSEC_IKE_RPC_DELETE = 13877,
+ ERROR_IPSEC_IKE_BENIGN_REINIT = 13878,
+ ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY = 13879,
+ ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN = 13881,
+ ERROR_IPSEC_IKE_MM_LIMIT = 13882,
+ ERROR_IPSEC_IKE_NEGOTIATION_DISABLED = 13883,
+ ERROR_IPSEC_IKE_NEG_STATUS_END = 13884,
+ ERROR_SXS_SECTION_NOT_FOUND = 14000,
+ ERROR_SXS_CANT_GEN_ACTCTX = 14001,
+ ERROR_SXS_INVALID_ACTCTXDATA_FORMAT = 14002,
+ ERROR_SXS_ASSEMBLY_NOT_FOUND = 14003,
+ ERROR_SXS_MANIFEST_FORMAT_ERROR = 14004,
+ ERROR_SXS_MANIFEST_PARSE_ERROR = 14005,
+ ERROR_SXS_ACTIVATION_CONTEXT_DISABLED = 14006,
+ ERROR_SXS_KEY_NOT_FOUND = 14007,
+ ERROR_SXS_VERSION_CONFLICT = 14008,
+ ERROR_SXS_WRONG_SECTION_TYPE = 14009,
+ ERROR_SXS_THREAD_QUERIES_DISABLED = 14010,
+ ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET = 14011,
+ ERROR_SXS_UNKNOWN_ENCODING_GROUP = 14012,
+ ERROR_SXS_UNKNOWN_ENCODING = 14013,
+ ERROR_SXS_INVALID_XML_NAMESPACE_URI = 14014,
+ ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14015,
+ ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14016,
+ ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE = 14017,
+ ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE = 14018,
+ ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE = 14019,
+ ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT = 14020,
+ ERROR_SXS_DUPLICATE_DLL_NAME = 14021,
+ ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME = 14022,
+ ERROR_SXS_DUPLICATE_CLSID = 14023,
+ ERROR_SXS_DUPLICATE_IID = 14024,
+ ERROR_SXS_DUPLICATE_TLBID = 14025,
+ ERROR_SXS_DUPLICATE_PROGID = 14026,
+ ERROR_SXS_DUPLICATE_ASSEMBLY_NAME = 14027,
+ ERROR_SXS_FILE_HASH_MISMATCH = 14028,
+ ERROR_SXS_POLICY_PARSE_ERROR = 14029,
+ ERROR_SXS_XML_E_MISSINGQUOTE = 14030,
+ ERROR_SXS_XML_E_COMMENTSYNTAX = 14031,
+ ERROR_SXS_XML_E_BADSTARTNAMECHAR = 14032,
+ ERROR_SXS_XML_E_BADNAMECHAR = 14033,
+ ERROR_SXS_XML_E_BADCHARINSTRING = 14034,
+ ERROR_SXS_XML_E_XMLDECLSYNTAX = 14035,
+ ERROR_SXS_XML_E_BADCHARDATA = 14036,
+ ERROR_SXS_XML_E_MISSINGWHITESPACE = 14037,
+ ERROR_SXS_XML_E_EXPECTINGTAGEND = 14038,
+ ERROR_SXS_XML_E_MISSINGSEMICOLON = 14039,
+ ERROR_SXS_XML_E_UNBALANCEDPAREN = 14040,
+ ERROR_SXS_XML_E_INTERNALERROR = 14041,
+ ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE = 14042,
+ ERROR_SXS_XML_E_INCOMPLETE_ENCODING = 14043,
+ ERROR_SXS_XML_E_MISSING_PAREN = 14044,
+ ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE = 14045,
+ ERROR_SXS_XML_E_MULTIPLE_COLONS = 14046,
+ ERROR_SXS_XML_E_INVALID_DECIMAL = 14047,
+ ERROR_SXS_XML_E_INVALID_HEXIDECIMAL = 14048,
+ ERROR_SXS_XML_E_INVALID_UNICODE = 14049,
+ ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK = 14050,
+ ERROR_SXS_XML_E_UNEXPECTEDENDTAG = 14051,
+ ERROR_SXS_XML_E_UNCLOSEDTAG = 14052,
+ ERROR_SXS_XML_E_DUPLICATEATTRIBUTE = 14053,
+ ERROR_SXS_XML_E_MULTIPLEROOTS = 14054,
+ ERROR_SXS_XML_E_INVALIDATROOTLEVEL = 14055,
+ ERROR_SXS_XML_E_BADXMLDECL = 14056,
+ ERROR_SXS_XML_E_MISSINGROOT = 14057,
+ ERROR_SXS_XML_E_UNEXPECTEDEOF = 14058,
+ ERROR_SXS_XML_E_BADPEREFINSUBSET = 14059,
+ ERROR_SXS_XML_E_UNCLOSEDSTARTTAG = 14060,
+ ERROR_SXS_XML_E_UNCLOSEDENDTAG = 14061,
+ ERROR_SXS_XML_E_UNCLOSEDSTRING = 14062,
+ ERROR_SXS_XML_E_UNCLOSEDCOMMENT = 14063,
+ ERROR_SXS_XML_E_UNCLOSEDDECL = 14064,
+ ERROR_SXS_XML_E_UNCLOSEDCDATA = 14065,
+ ERROR_SXS_XML_E_RESERVEDNAMESPACE = 14066,
+ ERROR_SXS_XML_E_INVALIDENCODING = 14067,
+ ERROR_SXS_XML_E_INVALIDSWITCH = 14068,
+ ERROR_SXS_XML_E_BADXMLCASE = 14069,
+ ERROR_SXS_XML_E_INVALID_STANDALONE = 14070,
+ ERROR_SXS_XML_E_UNEXPECTED_STANDALONE = 14071,
+ ERROR_SXS_XML_E_INVALID_VERSION = 14072,
+ ERROR_SXS_XML_E_MISSINGEQUALS = 14073,
+ ERROR_SXS_PROTECTION_RECOVERY_FAILED = 14074,
+ ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT = 14075,
+ ERROR_SXS_PROTECTION_CATALOG_NOT_VALID = 14076,
+ ERROR_SXS_UNTRANSLATABLE_HRESULT = 14077,
+ ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING = 14078,
+ ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE = 14079,
+ ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME = 14080
+ }
+}
diff --git a/mcs/class/corlib/System.IO/MonoIOStat.cs b/mcs/class/corlib/System.IO/MonoIOStat.cs
new file mode 100644
index 00000000000..caf4ccc6e5c
--- /dev/null
+++ b/mcs/class/corlib/System.IO/MonoIOStat.cs
@@ -0,0 +1,22 @@
+//
+// System.IO.MonoIOStat.cs: Idealized structure for file information.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+
+namespace System.IO
+{
+ internal struct MonoIOStat {
+ public string Name;
+ public FileAttributes Attributes;
+ public long Length;
+ public long CreationTime;
+ public long LastAccessTime;
+ public long LastWriteTime;
+ }
+}
diff --git a/mcs/class/corlib/System.IO/Path.cs b/mcs/class/corlib/System.IO/Path.cs
new file mode 100644
index 00000000000..46aa0945420
--- /dev/null
+++ b/mcs/class/corlib/System.IO/Path.cs
@@ -0,0 +1,256 @@
+//------------------------------------------------------------------------------
+//
+// System.IO.Path.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Created: Saturday, August 11, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System.IO
+{
+ public sealed class Path
+ {
+ public static readonly char AltDirectorySeparatorChar;
+ public static readonly char DirectorySeparatorChar;
+ public static readonly char[] InvalidPathChars;
+ public static readonly char PathSeparator;
+ internal static readonly string DirectorySeparatorStr;
+ public static readonly char VolumeSeparatorChar;
+
+ private static readonly char[] PathSeparatorChars;
+
+ private Path () {}
+
+ // class methods
+ public static string ChangeExtension (string path, string extension)
+ {
+ if (path == null)
+ {
+ return null;
+ }
+
+ int iExt = findExtension (path);
+
+ if (iExt < 0)
+ {
+ return extension == null ? path : path + extension;
+ }
+ else if (iExt > 0)
+ {
+ string temp = path.Substring (0, iExt);
+ if (extension != null)
+ {
+ return temp + extension;
+ }
+ return temp;
+ }
+
+ return extension;
+ }
+
+ [MonoTODO]
+ public static string Combine (string path1, string path2)
+ {
+ if (path1 == null || path2 == null)
+ {
+ return null;
+ }
+
+ CheckArgument.Empty (path2);
+
+ // TODO: Check for invalid DirectoryInfo characters
+ // although I don't think it is necesary for linux
+
+ // TODO: Verify functionality further after NUnit tests written
+ // since the documentation was rather sketchy
+
+ if (IsPathRooted (path2))
+ {
+ if (path1.Equals (string.Empty))
+ {
+ return path2;
+ }
+ throw new ArgumentException ("Rooted path");
+ }
+
+ string dirSep = new string (DirectorySeparatorChar, 1);
+ string altSep = new string (AltDirectorySeparatorChar, 1);
+
+ bool b1 = path1.EndsWith (dirSep) || path1.EndsWith (dirSep);
+ bool b2 = path2.StartsWith (dirSep) || path2.StartsWith (altSep);
+ if (b1 && b2)
+ {
+ throw new ArgumentException ("Invalid combination");
+ }
+
+ if (!b1 && !b2)
+ {
+ return path1 + dirSep + path2;
+ }
+
+ return path1 + path2;
+ }
+
+ public static string GetDirectoryName (string path)
+ {
+ if (path != null)
+ {
+ CheckArgument.Empty (path);
+ CheckArgument.WhitespaceOnly (path);
+ CheckArgument.PathChars (path);
+
+ if (path.Length > 2)
+ {
+ int nLast = path.LastIndexOfAny (PathSeparatorChars, path.Length - 2);
+
+ if (nLast > 0)
+ {
+ return path.Substring (0, nLast);
+ }
+ }
+ }
+ return path;
+ }
+
+ public static string GetExtension (string path)
+ {
+ if (path == null)
+ {
+ return string.Empty;
+ }
+
+ CheckArgument.Empty (path);
+ CheckArgument.WhitespaceOnly (path);
+
+ int iExt = findExtension (path);
+ int iLastSep = path.LastIndexOfAny ( PathSeparatorChars );
+
+ if (iExt > -1)
+ { // okay it has an extension
+ return path.Substring (iExt);
+ }
+ return string.Empty;
+ }
+
+ public static string GetFileName (string path)
+ {
+ if (path == null)
+ {
+ return string.Empty;
+ }
+
+ CheckArgument.Empty (path);
+ CheckArgument.WhitespaceOnly (path);
+
+ int nLast = path.LastIndexOfAny (PathSeparatorChars);
+
+ if (nLast > 0)
+ {
+ return path.Substring (nLast + 1);
+ }
+
+ return nLast == 0 ? null : path;
+ }
+
+ public static string GetFileNameWithoutExtension (string path)
+ {
+ return ChangeExtension (GetFileName (path), null);
+ }
+
+ public static string GetFullPath (string path)
+ {
+ if (path == null)
+ throw (new ArgumentNullException (
+ "path",
+ "You must specify a path when calling System.IO.Path.GetFullPath"));
+
+ if (path.StartsWith (new string (DirectorySeparatorChar, 1)) ||
+ path.StartsWith (new string (AltDirectorySeparatorChar, 1)))
+ return path;
+
+ return Directory.GetCurrentDirectory () + new string (DirectorySeparatorChar, 1) + path;
+ }
+
+ public static string GetPathRoot (string path)
+ {
+ if (path != null ||
+ (path.StartsWith (new string (DirectorySeparatorChar, 1)) ||
+ path.StartsWith (new string (AltDirectorySeparatorChar, 1))))
+ {
+ return path.Substring (0, 1);
+ }
+ return null;
+ }
+
+ [MonoTODO]
+ public static string GetTempFileName ()
+ {
+ //TODO: Implement method
+ return string.Empty;
+ }
+
+ /// <summary>
+ /// Returns the path of the current systems temp directory
+ /// </summary>
+ [MonoTODO]
+ public static string GetTempPath ()
+ { // TODO: This might vary with distribution and there
+ // might be an api to provide it. Research is needed
+ return "/tmp";
+ }
+
+ public static bool HasExtension (string path)
+ {
+ CheckArgument.Null (path);
+ CheckArgument.Empty (path);
+ CheckArgument.WhitespaceOnly (path);
+
+ return findExtension (path) > -1;
+ }
+
+ public static bool IsPathRooted (string path)
+ {
+ return path.StartsWith (new string (VolumeSeparatorChar,1));
+ }
+
+ // private class methods
+
+ private static int findExtension (string path)
+ {
+ // method should return the index of the path extension
+ // start or -1 if no valid extension
+ if (path != null){
+ int iLastDot = path.LastIndexOf (".");
+ int iLastSep = path.LastIndexOfAny ( PathSeparatorChars );
+
+ if (iLastDot > iLastSep)
+ return iLastDot;
+ }
+ return -1;
+ }
+
+ static Path () {
+ VolumeSeparatorChar = MonoIO.VolumeSeparatorChar;
+ DirectorySeparatorChar = MonoIO.DirectorySeparatorChar;
+ AltDirectorySeparatorChar = MonoIO.AltDirectorySeparatorChar;
+
+ PathSeparator = MonoIO.PathSeparator;
+ InvalidPathChars = MonoIO.InvalidPathChars;
+
+ // internal fields
+
+ DirectorySeparatorStr = DirectorySeparatorChar.ToString ();
+ PathSeparatorChars = new char [] {
+ DirectorySeparatorChar,
+ AltDirectorySeparatorChar,
+ VolumeSeparatorChar
+ };
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/PathTooLongException.cs b/mcs/class/corlib/System.IO/PathTooLongException.cs
new file mode 100644
index 00000000000..5f5f5229a18
--- /dev/null
+++ b/mcs/class/corlib/System.IO/PathTooLongException.cs
@@ -0,0 +1,43 @@
+//
+// System.IO.PathTooLongException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.IO;
+using System.Runtime.Serialization;
+
+namespace System.IO
+{
+ [Serializable]
+ public class PathTooLongException : IOException
+ {
+ // Constructors
+ public PathTooLongException ()
+ : base (Locale.GetText ("Pathname is longer than the maximum length"))
+ {
+ }
+
+ public PathTooLongException (string message)
+ : base (message)
+ {
+ }
+
+ protected PathTooLongException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public PathTooLongException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.IO/SearchPattern.cs b/mcs/class/corlib/System.IO/SearchPattern.cs
new file mode 100644
index 00000000000..4db60d2fadc
--- /dev/null
+++ b/mcs/class/corlib/System.IO/SearchPattern.cs
@@ -0,0 +1,169 @@
+//
+// System.IO.SearchPattern.cs: Filename glob support.
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+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 SearchPattern {
+ public SearchPattern (string pattern) : this (pattern, false) { }
+
+ public SearchPattern (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
+
+ private static readonly char [] WildcardChars = { '*', '?' };
+ private 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/corlib/System.IO/SeekOrigin.cs b/mcs/class/corlib/System.IO/SeekOrigin.cs
new file mode 100644
index 00000000000..1cd2cf84165
--- /dev/null
+++ b/mcs/class/corlib/System.IO/SeekOrigin.cs
@@ -0,0 +1,34 @@
+// SeekOrigin.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:32:32 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.IO {
+
+
+ /// <summary>
+ /// </summary>
+ [Serializable]
+ public enum SeekOrigin : int {
+
+ /// <summary>
+ /// </summary>
+ Begin = 0,
+
+ /// <summary>
+ /// </summary>
+ Current = 1,
+
+ /// <summary>
+ /// </summary>
+ End = 2,
+ } // SeekOrigin
+
+} // System.IO
diff --git a/mcs/class/corlib/System.IO/Stream.cs b/mcs/class/corlib/System.IO/Stream.cs
new file mode 100755
index 00000000000..67d40c12efb
--- /dev/null
+++ b/mcs/class/corlib/System.IO/Stream.cs
@@ -0,0 +1,229 @@
+//
+// System.IO/Stream.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Threading;
+
+namespace System.IO
+{
+ [Serializable]
+ public abstract class Stream : MarshalByRefObject, IDisposable
+ {
+ public static readonly Stream Null;
+
+ static Stream ()
+ {
+ Null = new NullStream ();
+ }
+
+ protected Stream ()
+ {
+ }
+
+ public abstract bool CanRead
+ {
+ get;
+ }
+
+ public abstract bool CanSeek
+ {
+ get;
+ }
+
+ public abstract bool CanWrite
+ {
+ get;
+ }
+
+ public abstract long Length
+ {
+ get;
+ }
+
+ public abstract long Position
+ {
+ get;
+ set;
+ }
+
+
+ public virtual void Close ()
+ {
+ Flush ();
+ }
+
+ public virtual void Dispose ()
+ {
+ }
+
+ protected virtual WaitHandle CreateWaitHandle()
+ {
+ return new ManualResetEvent (false);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ }
+
+ ~Stream ()
+ {
+ }
+
+ public abstract void Flush ();
+
+ public abstract int Read (byte[] buffer,
+ int offset,
+ int count);
+
+ public virtual int ReadByte ()
+ {
+ byte[] buffer = new byte [1];
+
+ if (Read (buffer, 0, 1) == 1)
+ return buffer [0];
+
+ return -1;
+ }
+
+ public abstract long Seek (long offset,
+ SeekOrigin origin);
+
+ public abstract void SetLength (long value);
+
+ public abstract void Write (byte[] buffer,
+ int offset,
+ int count);
+
+ public virtual void WriteByte (byte value)
+ {
+ byte[] buffer = new byte [1];
+
+ buffer [0] = value;
+
+ Write (buffer, 0, 1);
+ }
+
+ delegate int ReadDelegate (byte [] buffer, int offset, int count);
+
+ [MonoTODO]
+ public virtual IAsyncResult
+ BeginRead (byte [] buffer, int offset, int count, AsyncCallback cback, object state)
+ {
+ if (!CanRead)
+ throw new NotSupportedException ("This stream does not support reading");
+
+ return null;
+ }
+
+ [MonoTODO]
+ public virtual IAsyncResult
+ BeginWrite (byte [] buffer, int offset, int count, AsyncCallback cback, object state)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ public virtual int EndRead (IAsyncResult async_result)
+ {
+ if (async_result == null)
+ throw new ArgumentNullException ("async_result");
+ return 0;
+ }
+
+ [MonoTODO]
+ public virtual void EndWrite (IAsyncResult async_result)
+ {
+ if (async_result == null)
+ throw new ArgumentNullException ("async_result");
+ }
+ }
+
+ class NullStream : Stream
+ {
+ public override bool CanRead
+ {
+ get {
+ return true;
+ }
+ }
+
+ public override bool CanSeek
+ {
+ get {
+ return true;
+ }
+ }
+
+ public override bool CanWrite
+ {
+ get {
+ return true;
+ }
+ }
+
+ public override long Length
+ {
+ get {
+ return 0;
+ }
+ }
+
+ public override long Position
+ {
+ get {
+ return 0;
+ }
+ set {
+ }
+ }
+
+ public override void Flush ()
+ {
+ }
+
+ public override int Read (byte[] buffer,
+ int offset,
+ int count)
+ {
+ return 0;
+ }
+
+ public override int ReadByte ()
+ {
+ return 0;
+ }
+
+ public override long Seek (long offset,
+ SeekOrigin origin)
+ {
+ return 0;
+ }
+
+ public override void SetLength (long value)
+ {
+ }
+
+ public override void Write (byte[] buffer,
+ int offset,
+ int count)
+ {
+ }
+
+ public override void WriteByte (byte value)
+ {
+ }
+ }
+}
+
+
+
+
+
+
+
diff --git a/mcs/class/corlib/System.IO/StreamReader.cs b/mcs/class/corlib/System.IO/StreamReader.cs
new file mode 100644
index 00000000000..44992e8bcb2
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StreamReader.cs
@@ -0,0 +1,243 @@
+//
+// System.IO.StreamReader.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Text;
+
+namespace System.IO {
+ [Serializable]
+ public class StreamReader : TextReader {
+
+ private const int DefaultBufferSize = 1024;
+ private const int DefaultFileBufferSize = 4096;
+ private const int MinimumBufferSize = 128;
+
+ // buffering members
+ private byte [] rgbEncoded;
+// private int cbEncoded;
+ private char [] rgchDecoded;
+ private int cchDecoded;
+
+ private int pos;
+
+
+ private Encoding internalEncoding;
+ private Decoder decoder;
+
+ private Stream internalStream;
+
+ public new static readonly StreamReader Null = new StreamReader((Stream)null);
+
+ public StreamReader(Stream stream)
+ : this (stream, null, false, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, bool detectEncodingFromByteOrderMarks)
+ : this (stream, null, detectEncodingFromByteOrderMarks, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, Encoding encoding)
+ : this (stream, encoding, false, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks)
+ : this (stream, encoding, detectEncodingFromByteOrderMarks, DefaultBufferSize) { }
+
+ public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)
+ {
+ Initialize (stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);
+ }
+
+ public StreamReader(string path)
+ : this (path, null, false, DefaultFileBufferSize) { }
+
+ public StreamReader(string path, bool detectEncodingFromByteOrderMarks)
+ : this (path, null, detectEncodingFromByteOrderMarks, DefaultFileBufferSize) { }
+
+ public StreamReader(string path, Encoding encoding)
+ : this (path, encoding, false, DefaultFileBufferSize) { }
+
+ public StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks)
+ : this (path, encoding, detectEncodingFromByteOrderMarks, DefaultFileBufferSize) { }
+
+ [MonoTODO]
+ public StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)
+ {
+ Stream stream = (Stream) File.OpenRead (path);
+ Initialize (stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);
+ }
+
+ [MonoTODO]
+ protected void Initialize (Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)
+ {
+ internalStream = stream;
+
+ // use detect encoding flag
+ if (encoding == null) {
+ internalEncoding = Encoding.UTF8;
+ decoder = Encoding.UTF8.GetDecoder ();
+ } else {
+ internalEncoding = encoding;
+ decoder = encoding.GetDecoder ();
+ }
+
+ if (bufferSize < MinimumBufferSize)
+ bufferSize = MinimumBufferSize;
+
+ rgbEncoded = new byte [bufferSize];
+ rgchDecoded = new char [internalEncoding.GetMaxCharCount (bufferSize)];
+ pos = 0;
+ cchDecoded = 0;
+ }
+
+ public virtual Stream BaseStream
+ {
+ get {
+ return internalStream;
+ }
+ }
+
+ public virtual Encoding CurrentEncoding
+ {
+ get {
+ return internalEncoding;
+ }
+ }
+
+ public override void Close ()
+ {
+ Dispose (true);
+ }
+
+ public void DiscardBufferedData ()
+ {
+ pos = 0;
+ cchDecoded = 0;
+
+/* I'm sure there's no need to do all this
+ if ((cchDecoded == null) || (pos == cchDecoded.Length))
+ return;
+
+ if (!internalStream.CanSeek)
+ return;
+
+ int seek_back = pos - cchDecoded.Length;
+ internalStream.Seek (seek_back, SeekOrigin.Current);
+*/
+ }
+
+
+ // the buffer is empty, fill it again
+ [MonoTODO ("handle byte order marks here")]
+ private int ReadBuffer ()
+ {
+ pos = 0;
+ int cbEncoded = 0;
+ cchDecoded = 0;
+ do // keep looping until the decoder gives us some chars
+ {
+ cbEncoded = internalStream.Read (rgbEncoded, 0, rgbEncoded.Length);
+ // TODO: remove this line when iconv is fixed
+ int bufcnt = decoder.GetCharCount (rgbEncoded, 0, cbEncoded);
+
+ if (cbEncoded == 0)
+ return 0;
+ // TODO: remove byte order marks here
+ cchDecoded += decoder.GetChars (rgbEncoded, 0, cbEncoded, rgchDecoded, 0);
+ } while (cchDecoded == 0);
+
+ return cchDecoded;
+ }
+
+ public override int Peek ()
+ {
+ if (!internalStream.CanSeek)
+ return -1;
+
+ if (pos >= cchDecoded && ReadBuffer () == 0)
+ return -1;
+
+ return rgchDecoded [pos];
+ }
+
+ public override int Read ()
+ {
+ if (pos >= cchDecoded && ReadBuffer () == 0)
+ return -1;
+
+ return rgchDecoded [pos++];
+ }
+
+ public override int Read (char[] dest_buffer, int index, int count)
+ {
+ if (dest_buffer == null)
+ throw new ArgumentException ();
+
+ if (index + count >= dest_buffer.Length)
+ throw new ArgumentException ();
+
+ if ((index < 0) || (count < 0))
+ throw new ArgumentOutOfRangeException ();
+
+ int cchRead = 0;
+ while (count > 0)
+ {
+ if (pos >= cchDecoded && ReadBuffer () == 0)
+ return -1;
+
+ int cch = Math.Min (cchDecoded - pos, count);
+ Array.Copy (rgchDecoded, pos, dest_buffer, index, cch);
+ pos += cch;
+ index += cch;
+ count -= cch;
+ cchRead += cch;
+ }
+ return cchRead;
+ }
+
+ public override string ReadLine()
+ {
+ StringBuilder text = new StringBuilder ();
+
+ while (true) {
+ int c = Read ();
+
+ if (c == -1) { // end of stream
+ if (text.Length == 0)
+ return null;
+
+ break;
+ }
+
+ if (c == '\n') // newline
+ break;
+
+ if (c == '\r' && Peek () == '\n') { // cr, newline
+ Read ();
+ break;
+ }
+
+ text.Append ((char) c);
+ }
+
+ return text.ToString ();
+ }
+
+ public override string ReadToEnd()
+ {
+ StringBuilder text = new StringBuilder ();
+
+ int c;
+ while ((c = Read ()) != -1) {
+ text.Append ((char) c);
+ }
+
+ if (text.Length == 0)
+ return null;
+ return text.ToString ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/StreamWriter.cs b/mcs/class/corlib/System.IO/StreamWriter.cs
new file mode 100644
index 00000000000..147a5170f4b
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StreamWriter.cs
@@ -0,0 +1,135 @@
+//
+// System.IO.StreamWriter.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Text;
+
+namespace System.IO {
+
+ [Serializable]
+ public class StreamWriter : TextWriter {
+
+ private Encoding internalEncoding;
+
+ private Stream internalStream;
+
+ private bool iflush;
+
+ // new public static readonly StreamWriter Null;
+
+ public StreamWriter (Stream stream)
+ : this (stream, null, 0) {}
+
+ public StreamWriter (Stream stream, Encoding encoding)
+ : this (stream, encoding, 0) {}
+
+ public StreamWriter (Stream stream, Encoding encoding, int bufferSize)
+ {
+ internalStream = stream;
+
+ if (encoding == null)
+ internalEncoding = Encoding.UTF8;
+ else
+ internalEncoding = encoding;
+ }
+
+ public StreamWriter (string path)
+ : this (path, false, null, 0) {}
+
+ public StreamWriter (string path, bool append)
+ : this (path, append, null, 0) {}
+
+ public StreamWriter (string path, bool append, Encoding encoding)
+ : this (path, append, encoding, 0) {}
+
+ public StreamWriter (string path, bool append, Encoding encoding, int bufferSize)
+ {
+ FileMode mode;
+
+ if (append)
+ mode = FileMode.Append;
+ else
+ mode = FileMode.Create;
+
+ internalStream = new FileStream (path, mode, FileAccess.Write);
+
+ if (append)
+ internalStream.Position = internalStream.Length;
+ else
+ internalStream.SetLength (0);
+
+ if (encoding == null)
+ internalEncoding = Encoding.UTF8;
+ else
+ internalEncoding = encoding;
+
+ }
+
+ public virtual bool AutoFlush
+ {
+
+ get {
+ return iflush;
+ }
+
+ set {
+ iflush = value;
+ }
+ }
+
+ public virtual Stream BaseStream
+ {
+ get {
+ return internalStream;
+ }
+ }
+
+ public override Encoding Encoding
+ {
+ get {
+ return internalEncoding;
+ }
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing && internalStream != null) {
+ internalStream.Close ();
+ internalStream = null;
+ }
+ }
+
+ public override void Flush ()
+ {
+ internalStream.Flush ();
+ }
+
+ public override void Write (char[] buffer, int index, int count)
+ {
+ byte[] res = new byte [internalEncoding.GetMaxByteCount (buffer.Length)];
+ int len;
+
+ len = internalEncoding.GetBytes (buffer, index, count, res, 0);
+
+ internalStream.Write (res, 0, len);
+
+ if (iflush)
+ Flush ();
+
+ }
+
+ public override void Write(string value)
+ {
+ Write (value.ToCharArray (), 0, value.Length);
+ }
+
+
+ }
+}
+
+
diff --git a/mcs/class/corlib/System.IO/StringReader.cs b/mcs/class/corlib/System.IO/StringReader.cs
new file mode 100644
index 00000000000..70df25ef170
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StringReader.cs
@@ -0,0 +1,131 @@
+//
+// System.IO.StringReader
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+
+
+using System;
+
+namespace System.IO {
+ [Serializable]
+ public class StringReader : TextReader {
+
+ protected string source;
+ protected char[] sourceChars;
+
+ protected int nextChar;
+ protected int sourceLength;
+
+ public StringReader( string s ) {
+ this.source = s;
+ nextChar = 0;
+ sourceLength = s.Length;
+ sourceChars = s.ToCharArray();
+ }
+
+ public override void Close() {
+ Dispose( true );
+ }
+
+ protected override void Dispose( bool disposing ) {
+ return;
+ }
+
+ public override int Peek() {
+ if( nextChar >= sourceLength ) {
+ return -1;
+ } else {
+ return (int)source[ nextChar ];
+ }
+ }
+
+ public override int Read() {
+ if( nextChar >= sourceLength ) {
+ return -1;
+ } else {
+ return (int)source[ nextChar++ ];
+ }
+ }
+
+
+ // The method will read up to count characters from the StringReader
+ // into the buffer character array starting at position index. Returns
+ // the actual number of characters read, or zero if the end of the string
+ // has been reached and no characters are read.
+
+ public override int Read( char[] buffer, int index, int count ) {
+
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( buffer.Length - index < count ) {
+ throw new ArgumentException();
+ } else if( index < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ int charsToRead;
+
+ if( nextChar + count > sourceLength ) {
+ charsToRead = sourceLength - nextChar;
+ } else {
+ charsToRead = count;
+ }
+
+ Array.Copy(sourceChars, nextChar, buffer, index, charsToRead );
+
+ nextChar += count;
+
+ return charsToRead;
+ }
+
+ public override string ReadLine() {
+ // Reads until next \r or \n or \r\n, otherwise return null
+
+ // LAMESPEC:
+ // The Beta 2 SDK help says that the ReadLine method returns
+ // "The next line from the input stream [...] A line is defined as a sequence of
+ // characters followed by a carriage return (\r), a line feed (\n), or a carriage
+ // return immediately followed by a line feed (\r\n). [...]
+ // The returned value is a null reference if the end of the input stream has been reached."
+ //
+ // HOWEVER, the MS implementation returns the rest of the string if no \r and/or \n is found
+ // in the string
+
+
+ int nextCR = source.IndexOf( '\r', nextChar );
+ int nextLF = source.IndexOf( '\n', nextChar );
+
+ if( nextCR == -1 && nextLF == -1 ) {
+ return ReadToEnd();
+ }
+
+ if( nextChar > sourceLength ) return null;
+
+ int readTo;
+
+ if( nextCR == -1 ) {
+ readTo = nextLF;
+ } else {
+ readTo = nextCR;
+ }
+
+ string nextLine = source.Substring( nextChar, readTo - nextChar );
+
+ if( nextLF == nextCR + 1 ) {
+ nextChar = readTo + 2;
+ } else {
+ nextChar = readTo + 1;
+ }
+
+ return nextLine;
+ }
+
+ public override string ReadToEnd() {
+ string toEnd = source.Substring( nextChar, sourceLength - nextChar );
+ nextChar = sourceLength;
+ return toEnd;
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.IO/StringWriter.cs b/mcs/class/corlib/System.IO/StringWriter.cs
new file mode 100644
index 00000000000..7e283b67b49
--- /dev/null
+++ b/mcs/class/corlib/System.IO/StringWriter.cs
@@ -0,0 +1,80 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+
+using System.Text;
+
+namespace System.IO {
+ [Serializable]
+ public class StringWriter : TextWriter {
+
+ protected StringBuilder internalString;
+
+ public StringWriter() {
+ internalString = new StringBuilder();
+ }
+
+ public StringWriter( IFormatProvider formatProvider ) {
+ internalFormatProvider = formatProvider;
+ }
+
+ public StringWriter( StringBuilder sb ) {
+ internalString = sb;
+ }
+
+ public StringWriter( StringBuilder sb, IFormatProvider formatProvider ) {
+ internalString = sb;
+ internalFormatProvider = formatProvider;
+ }
+
+ public override System.Text.Encoding Encoding {
+ get {
+ // TODO: Implement
+ return null;
+ }
+ }
+
+ public override void Close() {
+ Dispose( true );
+ }
+
+ protected override void Dispose( bool disposing ) { }
+
+ public virtual StringBuilder GetStringBuilder() {
+ return internalString;
+ }
+
+ public override string ToString() {
+ return internalString.ToString();
+ }
+
+ public override void Write( char value ) {
+ internalString.Append( value );
+ }
+
+ public override void Write( string value ) {
+ internalString.Append( value );
+ }
+
+ public override void Write( char[] buffer, int index, int count ) {
+ if( buffer == null ) {
+ throw new ArgumentNullException();
+ } else if( index < 0 || count < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ } else if( index > buffer.Length || index + count > buffer.Length ) {
+ throw new ArgumentException();
+ }
+
+ char[] writeBuffer = new char[ count ];
+
+ Array.Copy( buffer, index, writeBuffer, 0, count );
+
+ internalString.Append( writeBuffer );
+ }
+
+ }
+}
+
+
diff --git a/mcs/class/corlib/System.IO/TextReader.cs b/mcs/class/corlib/System.IO/TextReader.cs
new file mode 100644
index 00000000000..5b7c6c00c1d
--- /dev/null
+++ b/mcs/class/corlib/System.IO/TextReader.cs
@@ -0,0 +1,84 @@
+//
+// System.IO.TextReader
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Implement the Thread Safe stuff
+//
+
+using System;
+
+namespace System.IO {
+
+ [MonoTODO] [Serializable]
+ public abstract class TextReader : MarshalByRefObject, IDisposable {
+
+ protected TextReader() { }
+
+ public static readonly TextReader Null;
+
+ public virtual void Close()
+ {
+ Dispose(true);
+ }
+
+ void System.IDisposable.Dispose()
+ {
+ Dispose(true);
+ }
+
+ protected virtual void Dispose( bool disposing )
+ {
+ return;
+ }
+
+ public virtual int Peek()
+ {
+ return -1;
+ }
+
+ public virtual int Read()
+ {
+ return -1;
+ }
+
+ // LAMESPEC: The Beta2 docs say this should be Read( out char[] ...
+ // whereas the MS implementation is just Read( char[] ... )
+ // Not sure which one is right, we'll see in Beta3 :)
+
+ public virtual int Read (char[] buffer, int index, int count)
+ {
+ int c, i;
+
+ for (i = 0; i < count; i++) {
+ if ((c = Read ()) == -1)
+ return i;
+ buffer [index + i] = (char)c;
+ }
+
+ return i;
+ }
+
+ public virtual int ReadBlock( char[] buffer, int index, int count )
+ {
+ return 0;
+ }
+
+ public virtual string ReadLine()
+ {
+ return String.Empty;
+ }
+
+ public virtual string ReadToEnd()
+ {
+ return String.Empty;
+ }
+
+ [MonoTODO]
+ public static TextReader Synchronised( TextReader reader )
+ {
+ // TODO: Implement
+ return Null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.IO/TextWriter.cs b/mcs/class/corlib/System.IO/TextWriter.cs
new file mode 100644
index 00000000000..af8319bc5e4
--- /dev/null
+++ b/mcs/class/corlib/System.IO/TextWriter.cs
@@ -0,0 +1,271 @@
+//
+// System.IO.TextWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Implement the Thread Safe stuff
+
+namespace System.IO {
+
+ [MonoTODO] [Serializable]
+ public abstract class TextWriter : MarshalByRefObject, IDisposable {
+
+ protected TextWriter() {
+ coreNewLine = "\n".ToCharArray ();
+ }
+
+ protected TextWriter( IFormatProvider formatProvider ) {
+ internalFormatProvider = formatProvider;
+ }
+
+ protected char[] coreNewLine;
+
+ protected IFormatProvider internalFormatProvider;
+
+ public static readonly TextWriter Null;
+
+ public abstract System.Text.Encoding Encoding { get; }
+
+ public virtual IFormatProvider FormatProvider {
+ get {
+ return internalFormatProvider;
+ }
+ }
+
+ public virtual string NewLine {
+ get {
+ return new String(coreNewLine);
+ }
+
+ set {
+ coreNewLine = value.ToCharArray();
+ }
+ }
+
+ public virtual void Close () {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing) { }
+
+ void System.IDisposable.Dispose () {
+ Dispose (true);
+ }
+
+
+ public virtual void Flush()
+ {
+ // do nothing
+ }
+
+ [MonoTODO]
+ public static TextWriter Synchronised (TextWriter writer)
+ {
+ // TODO: Implement.
+
+ return Null;
+ }
+
+ public virtual void Write (bool value)
+ {
+ Write (value.ToString ());
+ }
+
+ public virtual void Write (char value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (char[] value)
+ {
+ Write (new String (value));
+ }
+
+ public virtual void Write (decimal value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (double value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (int value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (long value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (object value)
+ {
+ Write (value != null ? value.ToString () : String.Empty);
+ }
+
+ public virtual void Write (float value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (string value)
+ {
+ // do nothing
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write (uint value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ [CLSCompliant(false)]
+ public virtual void Write (ulong value)
+ {
+ Write (value.ToString (internalFormatProvider));
+ }
+
+ public virtual void Write (string format, object arg0)
+ {
+ Write (String.Format (format, arg0));
+ }
+
+ public virtual void Write (string format, params object[] arg)
+ {
+ Write (String.Format (format, arg));
+ }
+
+ public virtual void Write (char[] buffer, int index, int count)
+ {
+ Write (new String (buffer, index, count));
+ }
+
+ public virtual void Write (string format, object arg0, object arg1)
+ {
+ Write (String.Format (format, arg0, arg1));
+ }
+
+ public virtual void Write (string format, object arg0, object arg1, object arg2 )
+ {
+ Write (String.Format (format, arg0, arg1, arg2));
+ }
+
+ public virtual void WriteLine ()
+ {
+ Write (NewLine);
+ }
+
+ public virtual void WriteLine (bool value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (char value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (char[] value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (decimal value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (double value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (int value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (long value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (object value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (float value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ [CLSCompliant(false)]
+ public virtual void WriteLine (uint value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ [CLSCompliant(false)]
+ public virtual void WriteLine (ulong value)
+ {
+ Write (value);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, object arg0)
+ {
+ Write (format, arg0);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, params object[] arg)
+ {
+ Write (format, arg);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (char[] buffer, int index, int count)
+ {
+ Write (buffer, index, count);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, object arg0, object arg1)
+ {
+ Write (format, arg0, arg1);
+ WriteLine();
+ }
+
+ public virtual void WriteLine (string format, object arg0, object arg1, object arg2)
+ {
+ Write (format, arg0, arg1, arg2);
+ WriteLine();
+ }
+
+ }
+}
+
+
+
+
+
diff --git a/mcs/class/corlib/System.PAL/IOperatingSystem.cs b/mcs/class/corlib/System.PAL/IOperatingSystem.cs
new file mode 100644
index 00000000000..15c57faae36
--- /dev/null
+++ b/mcs/class/corlib/System.PAL/IOperatingSystem.cs
@@ -0,0 +1,194 @@
+/*---------------------------------------------------------------------
+
+ XX X XXX
+ XX XX
+ XXX XX XXX XXXXX XX
+ XX XXX XX XX XX
+ XX XX XX XX XXXXX XX
+ XX XX XX XX XX XX X XX
+ XXXX XX XX XXX XXXXXXX XXXX
+ XX
+ XXXXX
+
+Copyright (c) 2001 Intel Corporation. All Rights Reserved.
+
+CREATED: August 08, 2001
+OWNER: Scott D Smith, Joel Marcey
+VERSION: 1.0
+---------------------------------------------------------------------*/
+
+
+using System;
+using System.IO;
+using System.Collections;
+
+namespace System.PlatformAbstractionLayer
+{
+ /// <summary>
+ /// Definition of functionality needed by the library that can only be provided by the underlying OS.
+ /// </summary>
+ internal interface IOperatingSystem
+ {
+
+ // System.IO services
+
+ int ReadStdInput(byte[] buffer, int offset, int count);
+
+ void FlushStdOutput(byte[] byteBuf);
+
+
+
+ // System.File services
+
+ int ReadFile(IntPtr handle, byte[] buffer, int offset, int count);
+
+ int WriteFile(IntPtr handle, byte[] buffer, int offset, int count);
+
+ void FlushFile(IntPtr handle, byte[] byteBuf);
+
+ int SetLengthFile(IntPtr handle, long length);
+
+ IntPtr OpenFile(string path, FileMode mode, FileAccess access, FileShare share);
+
+ void CloseFile(IntPtr handle);
+
+ long SeekFile(IntPtr handle, long offset, SeekOrigin origin);
+
+ IntPtr CreateFile(string path, FileMode mode, FileAccess access, FileShare share);
+
+ void DeleteFile(string path);
+
+ bool ExistsFile(string path);
+
+ DateTime GetCreationTimeFile(string path);
+
+ DateTime GetLastAccessTimeFile(string path);
+
+ DateTime GetLastWriteTimeFile(string path);
+
+ void SetCreationTimeFile(string path, DateTime creationTime);
+
+ void SetLastAccessTimeFile(string path, DateTime lastAccessTime);
+
+ void SetLastWriteTimeFile(string path, DateTime lastWriteTime);
+
+ long FileLength(string path);
+
+ long FileLength(IntPtr handle);
+
+
+ // System.Environment services
+
+ string NewLineSequence {get;}
+
+ char DirectorySeparator {get;}
+
+ char AltDirectorySeparator {get;}
+
+ char PathSeparator {get;}
+
+ char VolumeSeparator {get;}
+
+ char[] DirVolSeparatorChars {get;}
+
+ char[] InvalidPathChars {get;}
+
+ string GetEnvironmentVariable(string eVar);
+
+ char ExtensionCharacter {get;}
+
+ string CommandLine {get;}
+
+ IDictionary EnvironmentVariables {get;}
+
+ string MachineName {get;}
+
+ OperatingSystem OSVersion {get;}
+
+ // System.Path services
+ // Note: Although some of these do not require direct acccess to the OS,
+ // some platforms don't support some of these methods
+
+ string ChangeExtension(string path, string extension);
+
+ string GetExtension(string path);
+
+ string GetFileName(string path);
+
+ string GetFileNameWithoutExtension(string path);
+
+ string GetPathRoot(string path);
+
+ string GetTempFileName();
+
+ string GetTempPath();
+
+ bool HasExtension(string path);
+
+ bool IsPathRooted(string path);
+
+ string GetFullPath(string path);
+
+
+ // System.Directory services
+
+ void DeleteDirectory(string path, bool recursive);
+
+ bool ExistsDirectory(string path);
+
+ DateTime GetCreationTimeDirectory(string path);
+
+ string GetCurrentDirectory();
+
+ string[] GetDirectories(string path, string searchPattern);
+
+ string[] GetFiles(string path, string searchPattern);
+
+ string[] GetFileSystemEntries(string path, string searchPattern);
+
+ DateTime GetLastAccessTimeDirectory(string path);
+
+ DateTime GetLastWriteTimeDirectory(string path);
+
+ void MoveDirectory(string sourceDirName, string destDirName);
+
+ void SetCreationTimeDirectory(string path, DateTime creationTime);
+
+ void SetCurrentDirectory(string path);
+
+ void SetLastAccessTimeDirectory(string path, DateTime lastAccessTime);
+
+ void SetLastWriteTimeDirectory(string path, DateTime lastWriteTime);
+
+ double Acos(double d);
+
+ double Asin(double d);
+
+ double Atan(double d);
+
+ double Atan2(double y, double x);
+
+ double Cos(double d);
+
+ double Cosh(double value);
+
+ double Exp(dobule d);
+
+ double Log(double d);
+
+ double Log10(double d);
+
+ double Pow(double x, double y);
+
+ double Sin(double d);
+
+ double Sinh(double d);
+
+ double Sqrt(double d);
+
+ double Tan(double d);
+
+ double Tanh(double d);
+
+ }
+}
diff --git a/mcs/class/corlib/System.PAL/Platform.cs b/mcs/class/corlib/System.PAL/Platform.cs
new file mode 100644
index 00000000000..bfaa276dbc5
--- /dev/null
+++ b/mcs/class/corlib/System.PAL/Platform.cs
@@ -0,0 +1,23 @@
+// Sean MacIsaac
+// Only want to have 1 OperatingSystemObject around.
+// We get the correct one from compile time.
+
+namespace System.PAL
+{
+ internal class Platform
+ {
+ private static OpSys _os;
+
+ public static OpSys OS
+ {
+
+ get
+ {
+ if (_os == null) {
+ _os = new OpSys ();
+ }
+ return _os;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
new file mode 100755
index 00000000000..1f44ad40ebd
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
@@ -0,0 +1,248 @@
+//
+// System.Reflection.Emit/AssemblyBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.IO;
+using System.Security.Policy;
+using System.Runtime.Serialization;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection.Emit {
+
+ public sealed class AssemblyBuilder : Assembly {
+ private IntPtr dynamic_assembly;
+ private MethodInfo entry_point;
+ private ModuleBuilder[] modules;
+ private string name;
+ private string dir;
+ private CustomAttributeBuilder[] cattrs;
+ private int[] table_indexes;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void basic_init (AssemblyBuilder ab);
+
+ internal AssemblyBuilder (AssemblyName n, string directory, AssemblyBuilderAccess access) {
+ name = n.Name;
+ dir = directory;
+ basic_init (this);
+ }
+
+ internal int get_next_table_index (int table, bool inc) {
+ if (table_indexes == null) {
+ table_indexes = new int [64];
+ for (int i=0; i < 64; ++i)
+ table_indexes [i] = 1;
+ /* allow room for .<Module> in TypeDef table */
+ table_indexes [0x02] = 2;
+ }
+ // Console.WriteLine ("getindex for table "+table.ToString()+" got "+table_indexes [table].ToString());
+ if (inc)
+ return table_indexes [table]++;
+ return table_indexes [table];
+ }
+
+ public override string CodeBase {
+ get {
+ return null;
+ }
+ }
+
+ public override MethodInfo EntryPoint {
+ get {
+ return entry_point;
+ }
+ }
+
+ public override string Location {
+ get {
+ return null;
+ }
+ }
+
+ public void AddResourceFile (string name, string fileName)
+ {
+ }
+
+ public void AddResourceFile (string name, string fileName, ResourceAttributes attribute)
+ {
+ }
+
+ public ModuleBuilder DefineDynamicModule (string name)
+ {
+ return DefineDynamicModule (name, name, false);
+ }
+
+ public ModuleBuilder DefineDynamicModule (string name, bool emitSymbolInfo)
+ {
+ return DefineDynamicModule (name, name, emitSymbolInfo);
+ }
+
+ public ModuleBuilder DefineDynamicModule(string name, string fileName)
+ {
+ return DefineDynamicModule (name, fileName, false);
+ }
+
+ public ModuleBuilder DefineDynamicModule (string name, string fileName,
+ bool emitSymbolInfo)
+ {
+ ModuleBuilder r = new ModuleBuilder (this, name, fileName, emitSymbolInfo);
+
+ if (modules != null) {
+ ModuleBuilder[] new_modules = new ModuleBuilder [modules.Length + 1];
+ System.Array.Copy(modules, new_modules, modules.Length);
+ new_modules [modules.Length] = r;
+ modules = new_modules;
+ } else {
+ modules = new ModuleBuilder [1];
+ modules [0] = r;
+ }
+ return r;
+ }
+
+ public IResourceWriter DefineResource (string name, string description, string fileName)
+ {
+ return null;
+ }
+
+ public IResourceWriter DefineResource (string name, string description,
+ string fileName, ResourceAttributes attribute)
+ {
+ return null;
+ }
+
+ public void DefineUnmanagedResource (byte[] resource)
+ {
+ }
+
+ public void DefineUnmanagedResource (string resourceFileName)
+ {
+ }
+
+ public void DefineVersionInfoResource ()
+ {
+ }
+
+ public void DefineVersionInfoResource (string product, string productVersion,
+ string company, string copyright, string trademark)
+ {
+ }
+
+ public ModuleBuilder GetDynamicModule (string name)
+ {
+ return null;
+ }
+
+ public override Type[] GetExportedTypes ()
+ {
+ return null;
+ }
+
+ public override FileStream GetFile (string name)
+ {
+ return null;
+ }
+
+ /*public virtual FileStream[] GetFiles() {
+ return null;
+ }
+ public override FileStream[] GetFiles(bool getResourceModules) {
+ return null;
+ }*/
+
+ /*public virtual ManifestResourceInfo GetManifestResourceInfo(string resourceName)
+ {
+ return null;
+ }
+ public virtual string[] GetManifestResourceNames() {
+ return null;
+ }
+ public virtual Stream GetManifestResourceStream(string name) {
+ return null;
+ }
+ public virtual Stream GetManifestResourceStream(Type type, string name) {
+ return null;
+ }*/
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int getUSIndex (AssemblyBuilder ab, string str);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int getToken (AssemblyBuilder ab, MemberInfo member);
+
+ internal int GetToken (string str) {
+ return getUSIndex (this, str);
+ }
+
+ internal int GetToken (MemberInfo member) {
+ return getToken (this, member);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int getPEHeader (AssemblyBuilder ab, byte[] buf, out int data_size);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int getDataChunk (AssemblyBuilder ab, byte[] buf);
+
+ public void Save (string assemblyFileName)
+ {
+ byte[] buf = new byte [2048];
+ FileStream file;
+ int count, data_size, total;
+
+ if (dir != null) {
+ assemblyFileName = String.Format ("{0}{1}{2}", dir, System.IO.Path.DirectorySeparatorChar, assemblyFileName);
+ }
+
+ file = new FileStream (assemblyFileName, FileMode.Create, FileAccess.Write);
+
+ total = count = getPEHeader (this, buf, out data_size);
+ file.Write (buf, 0, count);
+ buf = new byte [data_size];
+ count = getDataChunk (this, buf);
+ file.Write (buf, 0, count);
+ // pad to file alignment
+ total += count;
+ total %= 512;
+ total = 512 - total;
+ buf = new byte [total];
+ file.Write (buf, 0, total);
+
+ file.Close ();
+ }
+
+ public void SetEntryPoint (MethodInfo entryMethod)
+ {
+ entry_point = entryMethod;
+ }
+
+ public void SetEntryPoint (MethodInfo entryMethod, PEFileKinds fileKind)
+ {
+ entry_point = entryMethod;
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
new file mode 100644
index 00000000000..2c6a97d9aca
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
@@ -0,0 +1,16 @@
+//--------------------------
+// System.Reflection.Emit
+// Author: Mandar Nanivadekar
+//
+// Created: 29/08/2001
+//------------------------------
+
+namespace System.Reflection.Emit
+{
+ public enum AssemblyBuilderAccess
+ {
+ Run = 1,
+ Save = 2,
+ RunAndSave = 3
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/ChangeLog b/mcs/class/corlib/System.Reflection.Emit/ChangeLog
new file mode 100644
index 00000000000..47d3365b18c
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ChangeLog
@@ -0,0 +1,258 @@
+
+Tue Apr 16 13:02:28 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: pad output file to file alignment.
+ * FieldBuilder.cs: ReflectedType.
+ * ModuleBuilder.cs: added guid generation and array method creation.
+ * MonoArrayMethod.cs: array method support code.
+
+Wed Apr 10 12:57:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: use a stack to keep track of exception blocks.
+
+Mon Apr 8 06:19:01 2002 Piers Haken <piersh@friskit.com>
+
+ * ILGenerator.cs: added LabelField.label_base to allow for
+ arbitrary offsets (for switch statement)
+
+Fri Apr 5 15:41:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: simpler protocol wih the runtime to
+ get the assembly data.
+
+Tue Mar 26 20:10:24 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: use FileMode.Create.
+ * ILGenerator.cs: optimize localbuilder related opcodes.
+ Track parameters to adjust maxstack.
+ * LocalBuilder.cS: use unsigned for position.
+
+2002-03-23 Miguel de Icaza <miguel@ximian.com>
+
+ * LocalBuilder.cs: Drop the symbol_writer as LocalBuilder fields.
+ Do this lazily in SetLocalSymInfo.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * ModuleBuilder.cs (GetSymbolWriter): The MonoSymbolWriter's constructor
+ now takes a `string assembly_filename' argument, pass it our fully
+ qualified assembly name.
+
+2002-03-24 Nick Drochak <ndrochak@gol.com>
+
+ * ILGenerator.cs: Use #if-#endif instead of if(false){} to disable
+ code. This way there is no compiler warning.
+
+ * TypeBuilder.cs: Removed the returns that came after the throws.
+ This removes a few more compiler warnings. Also marked with MonoTODO
+ all places where we throw NotImplemented exceptions.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * SignatureHelper.cs (GetFieldSignatureHelper, GetLocalSignatureHelper):
+ Implemented.
+
+ * LocalBuilder.cs (LocalBuilder): This internal constructor now takes
+ a ModuleBuilder argument instead of a ISymbolWriter one.
+ (SetLocalSymInfo): Create and pass type signature to DefineLocalVariable.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * ILGenerator.cs (BeginScope, EndScope): Implemented.
+
+2002-03-20 Martin Baulig <martin@gnome.org>
+
+ * ModuleBuilder.cs (GetSymbolWriter): New internal function. Dynamically
+ loads the default symbol writer, catch all possible exceptions and return
+ null on failure.
+ (ModuleBuilder): Added `bool emitSymbolInfo' argument to this internal
+ constructor; if set, call GetSymbolWriter ().
+ (GetSymWriter): Implemented.
+
+ * LocalBuilder.cs (LocalBuilder): Added ISymbolWriter argument to this
+ internal method.
+ (SetLocalSymInfo): Implemented, call ISymbolWriter.DefineLocalVariable ()
+ if the symbol writer is not null.
+
+ * ILGenerator.cs (ILGenerator): Call ModuleBuilder.GetSymWriter () to get
+ and store the symbol writer.
+ (DeclareLocal): Pass the symbol writer to LocalBuilder's constructor.
+ (MarkSequencePoint): Implemented, call ISymbolWriter.DefineSequencePoints ()
+ if the symbol writer is not null.
+
+ * AssemblyBuilder.cs (DefineDynamicModule): Pass the `bool emitSymbolInfo'
+ to ModuleBuilder's constructor.
+
+Sat Mar 16 19:11:47 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ModuleBuilder.cs: handle modified types correctly.
+
+Thu Mar 7 17:10:42 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: allow saving bigger assemblies.
+ * ILGenerator.cs: add fixup table for fields and methods, since
+ at the end of the compile they may end up with a different table
+ index.
+ * ModuleBuilder.cs: add cache for type names to speed up the type
+ lookups from the compiler.
+ * TypeBuilder.cs: GetInterfaces () returns only interfaces in the
+ current type, not in parents (the docs are wrong).
+
+Tue Mar 5 18:09:34 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * EventBuilder.cs: implemented.
+ * TypeBuilder.cs: implemented DefineEvent() method and UnderlyingSystemType
+ property.
+
+Mon Mar 4 20:34:52 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: make enough room in the byte array for string
+ tokens.
+ * TypeBuilder.cs: fixed GetInterfaces().
+
+Mon Mar 4 11:30:40 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: implemented GetConstructors(), GetFields(),
+ GetMethods(), GetProperties().
+
+Thu Feb 28 19:15:10 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: call into the runtime to init some basic
+ assembly stuff. Reserve slot 1 of typedef table for .<Module>.
+ * ModuleBuilder.cs: call into the runtime if we need to create a
+ modief type, such as arrays, byref etc.
+ * TypeBuilder.cs: call into the runtime to create the MonoClass
+ representation for the type. Throw exceptions with not implemented
+ stuff.
+
+Wed Feb 27 18:48:47 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: fix nested exception blocks.
+
+Wed Feb 20 22:30:49 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: upped compiled assembly size limit.
+ Implemented SetCustomAttribute () methods.
+ * CustomAttributeBuilder.cs: implemented the needed constructor
+ stuff.
+ * Cosntructorbuilder.cs, EnumBuilder.cs, FieldBuilder.cs,
+ MethodBuilder.cs, ModuleBuilder.cs, ParameterBuilder.cs,
+ PropertyBuilder.cs, TypeBuilder.cs: Implemented SetCustomAttribute () methods.
+
+Wed Feb 20 14:54:01 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: add SetCustomAttribute () to keep the compiler
+ going.
+
+Fri Feb 15 18:15:04 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: finally block support and fixes.
+
+Thu Feb 14 18:55:52 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * FieldBuilder.cs: Add SetRVAData().
+ * ILGenerator.cs: speed up code array growth.
+ * TypeBuilder.cs: fix IsValueTypeImpl(). Add class_size member.
+ Implement DefineInitializedData().
+
+Tue Jan 22 23:01:11 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * EnumBuilder.cs, TypeBuilder.cs: updates for changes in Type.cs.
+ * ModuleBuilder.cs: fix lookup of nested types.
+
+Tue Jan 15 22:46:21 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: implement some of the exception support methods.
+
+Mon Jan 14 17:07:32 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ModulerBuilder.cs: search also for subtypes in GetTypes().
+ * TypeBuilder.cs: bugfix in FullName. Implemented DefineNestedType().
+
+Fri Jan 11 19:00:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MethodBuilder.cs, ConstructorBuilder.cs: save parameter info.
+
+Thu Jan 10 21:07:54 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: handle type tokens (used for box opcode).
+
+Wed Jan 9 19:37:55 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: emit float and doubles.
+ * ModuleBuilder.cs: off-by-one error fix and GetType()
+ implementations.
+ * TypeBuilder.cs: AttributesImpl added.
+ * UnmanagedMarshal.cs: stubbed out class.
+
+Sat Jan 5 15:59:05 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: fix emission of two-bytes opcodes.
+ Missing slot for locals array. Throw exceptions on unimplemented
+ methods.
+ * OpCode.cs: add a comment: the Value property is useless.
+ * OpCodes.cs: fix name of tail opcode (Tail -> Tailcall).
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * ConstructorBuilder.cs : Use the MonoTODO attribute.
+
+ * ILGenerator.cs, Label.cs, MethodBuilder.cs, ModuleBuilder.cs,
+ ParameterBuilder.cs, TypeBuilder.cs : Ditto.
+
+Thu Jan 3 23:26:15 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ILGenerator.cs: typo fix.
+
+Mon Dec 24 17:21:30 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs: added DefineMethodOverride().
+ * MethodBuilder.cs: add override_method member and setter.
+
+Mon Nov 19 13:58:01 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: add method to register a string in the "#US"
+ stream.
+ * EnumBuilder.cs, SignatureHelper.cs: added stubs.
+ * ILGenerator.cs: more stuff implemented.
+ * LocalBuilder.cs: keep track of local var index.
+
+Thu Nov 15 18:11:23 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ConstructorBuilder.cs: implement the interesting methods.
+ * ILGenerator.cs: adapt for use with both a MethodBuilder and a
+ ConstructorBuilder.
+ * MethodBuilder.cs: add ImplAttributes.
+ * ParameterBuilder.cs: adapt for ConstructorBuilder.
+ * TypeBuilder.cs: add constructors handling.
+
+Wed Nov 14 17:01:45 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ConstructorBuilder.cs: added missing stubs and some implementation.
+ * CustomAttributeBuilder.cs: added.
+ * EventBuilder.cs: added.
+ * FieldBuilder.cs: updates.
+ * MethodBuilder.cs: stuff to implement P/Invoke methods.
+ * ModuleBuilder.cs: added GetArrayMethod() stub.
+ * ParameterBuilder.cs, PropertyBuilder.cs: updates.
+ * TypeBuilder.cs: updates and stubs.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * TypeBuilder.cs: Added implementation for TypeHandle.
+
+Tue Nov 6 09:13:45 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AssemblyBuilder.cs: define an internal constructor.
+
+2001-10-07 Miguel de Icaza <miguel@ximian.com>
+
+ * AssemblyBuilder.cs: Reformatted.
+
+ Added override keywords to those that needed them.
+
+ Removed methods that we do not override, but just inherit
+
+Tue Sep 25 16:53:08 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * TypeBuilder.cs, ConstructorBuilder.cs, ModuleBuilder.cs: added.
diff --git a/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs
new file mode 100644
index 00000000000..098d0a5af12
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs
@@ -0,0 +1,143 @@
+//
+// System.Reflection.Emit/ConstructorBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Reflection.Emit {
+ public sealed class ConstructorBuilder : ConstructorInfo {
+ private ILGenerator ilgen;
+ private Type[] parameters;
+ private MethodAttributes attrs;
+ private MethodImplAttributes iattrs;
+ private int table_idx;
+ private CallingConventions call_conv;
+ private TypeBuilder type;
+ private ParameterBuilder[] pinfo;
+ private CustomAttributeBuilder[] cattrs;
+
+ internal ConstructorBuilder (TypeBuilder tb, MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes) {
+ attrs = attributes;
+ call_conv = callingConvention;
+ if (parameterTypes != null) {
+ this.parameters = new Type [parameterTypes.Length];
+ System.Array.Copy (parameterTypes, this.parameters, parameterTypes.Length);
+ }
+ type = tb;
+ table_idx = get_next_table_index (0x06, true);
+ }
+
+ internal TypeBuilder TypeBuilder {
+ get {return type;}
+ }
+
+ public override MethodImplAttributes GetMethodImplementationFlags() {
+ return iattrs;
+ }
+ public override ParameterInfo[] GetParameters() {
+ return null;
+ }
+ public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ return null;
+ }
+ public override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) {
+ return null;
+ }
+
+ public override RuntimeMethodHandle MethodHandle { get {return new RuntimeMethodHandle ();} }
+ public override MethodAttributes Attributes {
+ get {return attrs;}
+ }
+ public override Type ReflectedType { get {return type;}}
+ public override Type DeclaringType { get {return type;}}
+ public Type ReturnType { get {return null;}}
+ public override string Name {
+ get {return (attrs & MethodAttributes.Static) != 0 ? ".cctor" : ".ctor";}
+ }
+ public string Signature {
+ get {return "constructor signature";}
+ }
+
+ [MonoTODO]
+ public bool InitLocals { /* FIXME */
+ get {return false;}
+ set {return;}
+ }
+
+ public void AddDeclarativeSecurity( SecurityAction action, PermissionSet pset) {
+ }
+
+ [MonoTODO]
+ public ParameterBuilder DefineParameter(int iSequence, ParameterAttributes attributes, string strParamName)
+ {
+ ParameterBuilder pb = new ParameterBuilder (this, iSequence, attributes, strParamName);
+ // check iSequence
+ if (pinfo == null)
+ pinfo = new ParameterBuilder [parameters.Length + 1];
+ pinfo [iSequence] = pb;
+ return pb;
+ }
+
+ public override bool IsDefined (Type attribute_type, bool inherit) {return false;}
+
+ public override object [] GetCustomAttributes (bool inherit) {return null;}
+
+ public override object [] GetCustomAttributes (Type attribute_type, bool inherit) {return null;}
+
+ public ILGenerator GetILGenerator () {
+ return GetILGenerator (256);
+ }
+ public ILGenerator GetILGenerator (int size) {
+ ilgen = new ILGenerator (this, size);
+ return ilgen;
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+ public void SetImplementationFlags( MethodImplAttributes attributes) {
+ iattrs = attributes;
+ }
+ public Module GetModule() {
+ return null;
+ }
+ public MethodToken GetToken() {
+ return new MethodToken (0x06000000 | table_idx);
+ }
+ public void SetSymCustomAttribute( string name, byte[] data) {
+ }
+ public override string ToString() {
+ return "constructor";
+ }
+
+ internal void fixup () {
+ if (ilgen != null)
+ ilgen.label_fixup ();
+ }
+ internal override int get_next_table_index (int table, bool inc) {
+ return type.get_next_table_index (table, inc);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
new file mode 100755
index 00000000000..d0d8038aa84
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs
@@ -0,0 +1,45 @@
+
+//
+// System.Reflection.Emit/CustomAttributeBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection.Emit {
+ public class CustomAttributeBuilder {
+ ConstructorInfo ctor;
+ byte[] data;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern byte[] GetBlob(ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues, FieldInfo[] namedFields, object[] fieldValues);
+
+ internal CustomAttributeBuilder( ConstructorInfo con, byte[] cdata) {
+ ctor = con;
+ data = (byte[])cdata.Clone ();
+ /* should we check that the user supplied data is correct? */
+ }
+
+ public CustomAttributeBuilder( ConstructorInfo con, object[] constructorArgs)
+ : this (con, constructorArgs, null, null, null, null) {
+ }
+ public CustomAttributeBuilder( ConstructorInfo con, object[] constructorArgs, FieldInfo[] namedFields, object[] fieldValues)
+ : this (con, constructorArgs, null, null, namedFields, fieldValues) {
+ }
+ public CustomAttributeBuilder( ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues)
+ : this (con, constructorArgs, namedProperties, propertyValues, null, null) {
+ }
+ public CustomAttributeBuilder( ConstructorInfo con, object[] constructorArgs, PropertyInfo[] namedProperties, object[] propertyValues, FieldInfo[] namedFields, object[] fieldValues) {
+ ctor = con;
+ data = GetBlob (con, constructorArgs, namedProperties, propertyValues, namedFields, fieldValues);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs
new file mode 100755
index 00000000000..ffed7590c3e
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/EnumBuilder.cs
@@ -0,0 +1,195 @@
+
+//
+// System.Reflection.Emit/EnumBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection.Emit {
+ public sealed class EnumBuilder : Type {
+ CustomAttributeBuilder[] cattrs;
+
+ public override Assembly Assembly {
+ get {return null;}
+ }
+ public override string AssemblyQualifiedName {
+ get {return null;}
+ }
+ public override Type BaseType {
+ get {return null;}
+ }
+ public override Type DeclaringType {
+ get {return null;}
+ }
+ public override string FullName {
+ get {return null;}
+ }
+ public override Guid GUID {
+ get {return Guid.Empty;}
+ }
+ public override Module Module {
+ get {return null;}
+ }
+ public override string Name {
+ get {return null;}
+ }
+ public override string Namespace {
+ get {return null;}
+ }
+ public override Type ReflectedType {
+ get {return null;}
+ }
+ public override RuntimeTypeHandle TypeHandle {
+ get {return new RuntimeTypeHandle ();}
+ }
+ public TypeToken TypeToken {
+ get {return new TypeToken ();}
+ }
+ public FieldBuilder UnderlyingField {
+ get {return null;}
+ }
+ public override Type UnderlyingSystemType {
+ get {return null;}
+ }
+ public override MemberTypes MemberType {
+ get {return MemberTypes.TypeInfo;}
+ }
+
+ internal EnumBuilder (ModuleBuilder mb, string name, TypeAttributes visibility, Type underlyingType) {
+ }
+ public Type CreateType() {
+ return null;
+ }
+ public FieldBuilder DefineLiteral( string literalName, object literalValue) {
+ return null;
+ }
+ protected override TypeAttributes GetAttributeFlagsImpl() {
+ return (TypeAttributes)0;
+ }
+ protected override ConstructorInfo GetConstructorImpl( BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ return null;
+ }
+ public override ConstructorInfo[] GetConstructors( BindingFlags bindingAttr) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(bool inherit) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(Type attributeType, bool inherit) {
+ return null;
+ }
+ public override Type GetElementType() {
+ throw new NotSupportedException ();
+ }
+ public override EventInfo GetEvent( string name, BindingFlags bindingAttr) {
+ return null;
+ }
+ public override EventInfo[] GetEvents() {
+ return null;
+ }
+ public override EventInfo[] GetEvents( BindingFlags bindingAttr) {
+ return null;
+ }
+ public override FieldInfo GetField( string name, BindingFlags bindingAttr) {
+ return null;
+ }
+ public override FieldInfo[] GetFields( BindingFlags bindingAttr) {
+ return null;
+ }
+ public override Type GetInterface( string name, bool ignoreCase) {
+ return null;
+ }
+ public override InterfaceMapping GetInterfaceMap( Type interfaceType) {
+ throw new NotImplementedException ();
+ }
+ public override Type[] GetInterfaces() {
+ return null;
+ }
+ public override MemberInfo[] GetMember( string name, MemberTypes type, BindingFlags bindingAttr) {
+ return null;
+ }
+ public override MemberInfo[] GetMembers( BindingFlags bindingAttr) {
+ return null;
+ }
+ protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ // FIXME
+ return null;
+ }
+
+ public override MethodInfo[] GetMethods( BindingFlags bindingAttr) {
+ return null;
+ }
+ public override Type GetNestedType( string name, BindingFlags bindingAttr) {
+ return null;
+ }
+ public override Type[] GetNestedTypes( BindingFlags bindingAttr) {
+ return null;
+ }
+ public override PropertyInfo[] GetProperties( BindingFlags bindingAttr) {
+ return null;
+ }
+ protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ return null;
+ }
+ protected override bool HasElementTypeImpl() {
+ throw new NotSupportedException ();
+ }
+ public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
+ return null;
+ }
+ protected override bool IsArrayImpl() {
+ return false;
+ }
+ protected override bool IsByRefImpl() {
+ return false;
+ }
+ protected override bool IsCOMObjectImpl() {
+ return false;
+ }
+ protected override bool IsPointerImpl() {
+ return false;
+ }
+ protected override bool IsPrimitiveImpl() {
+ return false;
+ }
+ protected override bool IsValueTypeImpl() {
+ return true;
+ }
+ public override bool IsDefined( Type attributeType, bool inherit) {
+ return false;
+ }
+ /*protected override bool IsPointerImpl() {
+ return false;
+ }
+ protected override bool IsPrimitiveImpl() {
+ return false;
+ }
+ protected override bool IsValueTypeImpl() {
+ return true;
+ }*/
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/EventBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/EventBuilder.cs
new file mode 100755
index 00000000000..8298dcdc79b
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/EventBuilder.cs
@@ -0,0 +1,85 @@
+
+//
+// System.Reflection.Emit/EventBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection.Emit {
+ public sealed class EventBuilder {
+ string name;
+ Type type;
+ TypeBuilder typeb;
+ CustomAttributeBuilder[] cattrs;
+ MethodBuilder add_method;
+ MethodBuilder remove_method;
+ MethodBuilder raise_method;
+ MethodBuilder[] other_methods;
+ EventAttributes attrs;
+ int table_idx;
+
+ internal EventBuilder (TypeBuilder tb, string eventName, EventAttributes eventAttrs, Type eventType) {
+ name = eventName;
+ attrs = eventAttrs;
+ type = eventType;
+ typeb = tb;
+ table_idx = get_next_table_index (0x14, true);
+ }
+
+ internal int get_next_table_index (int table, bool inc) {
+ return typeb.get_next_table_index (table, inc);
+ }
+
+ public void AddOtherMethod( MethodBuilder mdBuilder) {
+ if (other_methods != null) {
+ MethodBuilder[] newv = new MethodBuilder [other_methods.Length + 1];
+ other_methods.CopyTo (newv, 0);
+ other_methods = newv;
+ } else {
+ other_methods = new MethodBuilder [1];
+ }
+ other_methods [other_methods.Length - 1] = mdBuilder;
+ }
+
+ public EventToken GetEventToken () {
+ return new EventToken (0x14000000 | table_idx);
+ }
+ public void SetAddOnMethod( MethodBuilder mdBuilder) {
+ add_method = mdBuilder;
+ }
+ public void SetRaiseMethod( MethodBuilder mdBuilder) {
+ raise_method = mdBuilder;
+ }
+ public void SetRemoveOnMethod( MethodBuilder mdBuilder) {
+ remove_method = mdBuilder;
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/EventToken.cs b/mcs/class/corlib/System.Reflection.Emit/EventToken.cs
new file mode 100644
index 00000000000..4cc97be7ea1
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/EventToken.cs
@@ -0,0 +1,70 @@
+// EventToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Event.
+ /// </summary>
+ [Serializable]
+ public struct EventToken {
+
+ internal int tokValue;
+
+ public static readonly EventToken Empty;
+
+
+ static EventToken ()
+ {
+ Empty = new EventToken ();
+ }
+
+
+ internal EventToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is EventToken;
+
+ if (res) {
+ EventToken that = (EventToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// EventToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Event.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs
new file mode 100755
index 00000000000..0a1a9e91d96
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs
@@ -0,0 +1,105 @@
+
+
+//
+// System.Reflection.Emit/FieldBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection.Emit {
+ public sealed class FieldBuilder : FieldInfo {
+ private FieldAttributes attrs;
+ private Type type;
+ private String name;
+ private object def_value;
+ private int offset;
+ private int table_idx;
+ internal TypeBuilder typeb;
+ private byte[] rva_data;
+ private CustomAttributeBuilder[] cattrs;
+
+ internal FieldBuilder (TypeBuilder tb, string fieldName, Type type, FieldAttributes attributes) {
+ attrs = attributes;
+ name = fieldName;
+ this.type = type;
+ offset = -1;
+ typeb = tb;
+ table_idx = tb.get_next_table_index (0x04, true);
+ }
+
+ public override FieldAttributes Attributes {
+ get {return attrs;}
+ }
+ public override Type DeclaringType {
+ get {return typeb;}
+ }
+ public override RuntimeFieldHandle FieldHandle {
+ get {return new RuntimeFieldHandle();}
+ }
+ public override Type FieldType {
+ get {return type;}
+ }
+ public override string Name {
+ get {return name;}
+ }
+ public override Type ReflectedType {
+ get {return typeb;}
+ }
+
+ public override object[] GetCustomAttributes(bool inherit) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(Type attributeType, bool inherit) {
+ return null;
+ }
+ public FieldToken GetToken() {
+ return new FieldToken (0x04000000 | table_idx);
+ }
+ public override object GetValue(object obj) {
+ return null;
+ }
+ public override bool IsDefined( Type attributeType, bool inherit) {
+ return false;
+ }
+ internal void SetRVAData (byte[] data) {
+ rva_data = (byte[])data.Clone ();
+ }
+ public void SetConstant( object defaultValue) {
+ /*if (defaultValue.GetType() != type)
+ throw new ArgumentException ("Constant doesn't match field type");*/
+ def_value = defaultValue;
+ }
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+ public void SetMarshal( UnmanagedMarshal unmanagedMarshal) {
+ }
+ public void SetOffset( int iOffset) {
+ offset = iOffset;
+ }
+ public override void SetValue( object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture) {
+ }
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/FieldToken.cs b/mcs/class/corlib/System.Reflection.Emit/FieldToken.cs
new file mode 100644
index 00000000000..b3f5a5dade1
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/FieldToken.cs
@@ -0,0 +1,70 @@
+// FieldToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Field.
+ /// </summary>
+ [Serializable]
+ public struct FieldToken {
+
+ internal int tokValue;
+
+ public static readonly FieldToken Empty;
+
+
+ static FieldToken ()
+ {
+ Empty = new FieldToken ();
+ }
+
+
+ internal FieldToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is FieldToken;
+
+ if (res) {
+ FieldToken that = (FieldToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// FieldToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Field.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/FlowControl.cs b/mcs/class/corlib/System.Reflection.Emit/FlowControl.cs
new file mode 100644
index 00000000000..b714362cb11
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/FlowControl.cs
@@ -0,0 +1,63 @@
+// FlowControl.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+
+namespace System.Reflection.Emit {
+
+ /// <summary>
+ /// Describes how an instruction alters the flow of control.
+ /// </summary>
+ public enum FlowControl {
+
+ /// <summary>
+ /// Branch instruction (ex: br, leave).
+ /// </summary>
+ Branch = 0,
+
+ /// <summary>
+ /// Break instruction (ex: break).
+ /// </summary>
+ Break = 1,
+
+ /// <summary>
+ /// Call instruction (ex: jmp, call, callvirt).
+ /// </summary>
+ Call = 2,
+
+ /// <summary>
+ /// Conditional branch instruction (ex: brtrue, brfalse).
+ /// </summary>
+ Cond_Branch = 3,
+
+ /// <summary>
+ /// Changes the behaviour of or provides additional
+ /// about a subsequent instruction.
+ /// (ex: prefixes such as volatile, unaligned).
+ /// </summary>
+ Meta = 4,
+
+ /// <summary>
+ /// Transition to the next instruction.
+ /// </summary>
+ Next = 5,
+
+ /// <summary>
+ /// Annotation for ann.phi instruction.
+ /// </summary>
+ Phi = 6,
+
+ /// <summary>
+ /// Return instruction.
+ /// </summary>
+ Return = 7,
+
+ /// <summary>
+ /// Throw instruction.
+ /// </summary>
+ Throw = 8
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs b/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs
new file mode 100644
index 00000000000..4c4dcdf94c3
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs
@@ -0,0 +1,611 @@
+
+//
+// System.Reflection.Emit/ILGenerator.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+using System.Diagnostics.SymbolStore;
+
+namespace System.Reflection.Emit {
+
+ internal struct ILExceptionBlock {
+ public const int CATCH = 0;
+ public const int FILTER = 1;
+ public const int FINALLY = 2;
+ public const int FAULT = 4;
+
+ internal Type extype;
+ internal int type;
+ internal int start;
+ internal int len;
+ internal int filter_offset;
+
+ internal void Debug () {
+#if NO
+ System.Console.Write ("\ttype="+type.ToString()+" start="+start.ToString()+" len="+len.ToString());
+ if (extype != null)
+ System.Console.WriteLine (" extype="+extype.ToString());
+ else
+ System.Console.WriteLine ("");
+#endif
+ }
+ }
+ internal struct ILExceptionInfo {
+ ILExceptionBlock[] handlers;
+ internal int start;
+ int len;
+ internal Label end;
+
+ internal int NumHandlers () {
+ return handlers.Length;
+ }
+
+ internal void AddCatch (Type extype, int offset) {
+ int i;
+ End (offset);
+ add_block (offset);
+ i = handlers.Length - 1;
+ handlers [i].type = ILExceptionBlock.CATCH;
+ handlers [i].start = offset;
+ handlers [i].extype = extype;
+ }
+
+ internal void AddFinally (int offset) {
+ int i;
+ End (offset);
+ add_block (offset);
+ i = handlers.Length - 1;
+ handlers [i].type = ILExceptionBlock.FINALLY;
+ handlers [i].start = offset;
+ handlers [i].extype = null;
+ }
+
+ internal void End (int offset) {
+ if (handlers == null)
+ return;
+ int i = handlers.Length - 1;
+ if (i >= 0)
+ handlers [i].len = offset - handlers [i].start;
+ }
+
+ internal int LastClauseType () {
+ if (handlers != null)
+ return handlers [handlers.Length-1].type;
+ else
+ return ILExceptionBlock.CATCH;
+ }
+
+ internal void Debug (int b) {
+#if NO
+ System.Console.WriteLine ("Handler {0} at {1}, len: {2}", b, start, len);
+ for (int i = 0; i < handlers.Length; ++i)
+ handlers [i].Debug ();
+#endif
+ }
+
+ void add_block (int offset) {
+ if (handlers != null) {
+ int i = handlers.Length;
+ ILExceptionBlock[] new_b = new ILExceptionBlock [i + 1];
+ System.Array.Copy (handlers, new_b, i);
+ handlers = new_b;
+ handlers [i].len = offset - handlers [i].start;
+ } else {
+ handlers = new ILExceptionBlock [1];
+ len = offset - start;
+ }
+ }
+ }
+
+ internal struct ILTokenInfo {
+ public MemberInfo member;
+ public int code_pos;
+ }
+
+ public class ILGenerator: Object {
+ private struct LabelFixup {
+ public int size;
+ public int pos; // the location of the fixup
+ public int label_base; // the base address for this fixup
+ public int label_idx;
+ };
+ static Type void_type = typeof (void);
+ private byte[] code;
+ private MethodBase mbuilder; /* a MethodBuilder or ConstructorBuilder */
+ private int code_len;
+ private int max_stack;
+ private int cur_stack;
+ private LocalBuilder[] locals;
+ private ILExceptionInfo[] ex_handlers;
+ private int num_token_fixups;
+ private ILTokenInfo[] token_fixups;
+ private int[] label_to_addr;
+ private int num_labels;
+ private LabelFixup[] fixups;
+ private int num_fixups;
+ private ModuleBuilder module;
+ private AssemblyBuilder abuilder;
+ private ISymbolWriter sym_writer;
+ private Stack scopes;
+ private int cur_block;
+ private Stack open_blocks;
+
+ internal ILGenerator (MethodBase mb, int size) {
+ if (size < 0)
+ size = 256;
+ code_len = 0;
+ code = new byte [size];
+ mbuilder = mb;
+ cur_stack = max_stack = 0;
+ num_fixups = num_labels = 0;
+ label_to_addr = new int [16];
+ fixups = new LabelFixup [16];
+ token_fixups = new ILTokenInfo [16];
+ scopes = new Stack ();
+ num_token_fixups = 0;
+ if (mb is MethodBuilder) {
+ module = (ModuleBuilder)((MethodBuilder)mb).TypeBuilder.Module;
+ } else if (mb is ConstructorBuilder) {
+ module = (ModuleBuilder)((ConstructorBuilder)mb).TypeBuilder.Module;
+ }
+ abuilder = (AssemblyBuilder)module.Assembly;
+ sym_writer = module.GetSymWriter ();
+ open_blocks = new Stack ();
+ }
+
+ private void add_token_fixup (MemberInfo mi) {
+ if (num_token_fixups == token_fixups.Length) {
+ ILTokenInfo[] ntf = new ILTokenInfo [num_token_fixups * 2];
+ token_fixups.CopyTo (ntf, 0);
+ token_fixups = ntf;
+ }
+ token_fixups [num_token_fixups].member = mi;
+ token_fixups [num_token_fixups++].code_pos = code_len;
+ }
+
+ private void make_room (int nbytes) {
+ if (code_len + nbytes < code.Length)
+ return;
+ byte[] new_code = new byte [(code_len + nbytes) * 2 + 128];
+ System.Array.Copy (code, 0, new_code, 0, code.Length);
+ code = new_code;
+ }
+ private void emit_int (int val) {
+ code [code_len++] = (byte) (val & 0xFF);
+ code [code_len++] = (byte) ((val >> 8) & 0xFF);
+ code [code_len++] = (byte) ((val >> 16) & 0xFF);
+ code [code_len++] = (byte) ((val >> 24) & 0xFF);
+ }
+ /* change to pass by ref to avoid copy */
+ private void ll_emit (OpCode opcode) {
+ /*
+ * there is already enough room allocated in code.
+ */
+ // access op1 and op2 directly since the Value property is useless
+ if (opcode.Size == 2)
+ code [code_len++] = opcode.op1;
+ code [code_len++] = opcode.op2;
+ /*
+ * We should probably keep track of stack needs here.
+ * Or we may want to run the verifier on the code before saving it
+ * (this may be needed anyway when the ILGenerator is not used...).
+ */
+ switch (opcode.StackBehaviourPush) {
+ case StackBehaviour.Push1:
+ case StackBehaviour.Pushi:
+ case StackBehaviour.Pushi8:
+ case StackBehaviour.Pushr4:
+ case StackBehaviour.Pushr8:
+ case StackBehaviour.Pushref:
+ case StackBehaviour.Varpush: /* again we are conservative and assume it pushes 1 */
+ cur_stack ++;
+ break;
+ case StackBehaviour.Push1_push1:
+ cur_stack += 2;
+ break;
+ }
+ if (max_stack < cur_stack)
+ max_stack = cur_stack;
+ /*
+ * Note that we adjust for the pop behaviour _after_ setting max_stack.
+ */
+ switch (opcode.StackBehaviourPop) {
+ case StackBehaviour.Varpop:
+ break; /* we are conservative and assume it doesn't decrease the stack needs */
+ case StackBehaviour.Pop1:
+ case StackBehaviour.Popi:
+ case StackBehaviour.Popref:
+ cur_stack --;
+ break;
+ case StackBehaviour.Pop1_pop1:
+ case StackBehaviour.Popi_pop1:
+ case StackBehaviour.Popi_popi:
+ case StackBehaviour.Popi_popi8:
+ case StackBehaviour.Popi_popr4:
+ case StackBehaviour.Popi_popr8:
+ case StackBehaviour.Popref_pop1:
+ case StackBehaviour.Popref_popi:
+ cur_stack -= 2;
+ break;
+ case StackBehaviour.Popi_popi_popi:
+ case StackBehaviour.Popref_popi_popi:
+ case StackBehaviour.Popref_popi_popi8:
+ case StackBehaviour.Popref_popi_popr4:
+ case StackBehaviour.Popref_popi_popr8:
+ case StackBehaviour.Popref_popi_popref:
+ cur_stack -= 3;
+ break;
+ }
+ }
+
+ private static int target_len (OpCode opcode) {
+ if (opcode.operandType == OperandType.InlineBrTarget)
+ return 4;
+ return 1;
+ }
+
+ private void InternalEndClause () {
+ switch (ex_handlers [cur_block].LastClauseType ()) {
+ case ILExceptionBlock.CATCH:
+ // how could we optimize code size here?
+ Emit (OpCodes.Leave, ex_handlers [cur_block].end);
+ break;
+ case ILExceptionBlock.FAULT:
+ case ILExceptionBlock.FINALLY:
+ Emit (OpCodes.Endfinally);
+ break;
+ case ILExceptionBlock.FILTER:
+ Emit (OpCodes.Endfilter);
+ break;
+ }
+ }
+
+ public virtual void BeginCatchBlock (Type exceptionType) {
+ if (open_blocks.Count <= 0)
+ throw new NotSupportedException ("Not in an exception block");
+ InternalEndClause ();
+ ex_handlers [cur_block].AddCatch (exceptionType, code_len);
+ //System.Console.WriteLine ("Begin catch Block: "+exceptionType.ToString());
+ //throw new NotImplementedException ();
+ }
+ public virtual void BeginExceptFilterBlock () {
+ throw new NotImplementedException ();
+ }
+ public virtual Label BeginExceptionBlock () {
+ //System.Console.WriteLine ("Begin Block");
+
+ if (ex_handlers != null) {
+ cur_block = ex_handlers.Length;
+ ILExceptionInfo[] new_ex = new ILExceptionInfo [cur_block + 1];
+ System.Array.Copy (ex_handlers, new_ex, cur_block);
+ ex_handlers = new_ex;
+ } else {
+ ex_handlers = new ILExceptionInfo [1];
+ cur_block = 0;
+ }
+ open_blocks.Push (cur_block);
+ ex_handlers [cur_block].start = code_len;
+ return ex_handlers [cur_block].end = DefineLabel ();
+ }
+ public virtual void BeginFaultBlock() {
+ if (open_blocks.Count <= 0)
+ throw new NotSupportedException ("Not in an exception block");
+ //System.Console.WriteLine ("Begin fault Block");
+ //throw new NotImplementedException ();
+ }
+ public virtual void BeginFinallyBlock() {
+ if (open_blocks.Count <= 0)
+ throw new NotSupportedException ("Not in an exception block");
+ InternalEndClause ();
+ //System.Console.WriteLine ("Begin finally Block");
+ ex_handlers [cur_block].AddFinally (code_len);
+ }
+ public virtual void BeginScope () {
+ if (sym_writer != null)
+ scopes.Push (sym_writer.OpenScope (code_len));
+ }
+ public LocalBuilder DeclareLocal (Type localType) {
+ LocalBuilder res = new LocalBuilder (module, localType);
+ if (locals != null) {
+ LocalBuilder[] new_l = new LocalBuilder [locals.Length + 1];
+ System.Array.Copy (locals, new_l, locals.Length);
+ new_l [locals.Length] = res;
+ locals = new_l;
+ } else {
+ locals = new LocalBuilder [1];
+ locals [0] = res;
+ }
+ res.position = (uint)(locals.Length - 1);
+ return res;
+ }
+ public virtual Label DefineLabel () {
+ if (num_labels >= label_to_addr.Length) {
+ int[] new_l = new int [label_to_addr.Length * 2];
+ System.Array.Copy (label_to_addr, new_l, label_to_addr.Length);
+ label_to_addr = new_l;
+ }
+ label_to_addr [num_labels] = -1;
+ return new Label (num_labels++);
+ }
+ public virtual void Emit (OpCode opcode) {
+ make_room (2);
+ ll_emit (opcode);
+ }
+ public virtual void Emit (OpCode opcode, Byte val) {
+ make_room (3);
+ ll_emit (opcode);
+ code [code_len++] = val;
+ }
+ public virtual void Emit (OpCode opcode, ConstructorInfo constructor) {
+ int token = abuilder.GetToken (constructor);
+ make_room (6);
+ ll_emit (opcode);
+ if (constructor is ConstructorBuilder)
+ add_token_fixup (constructor);
+ emit_int (token);
+ ParameterInfo[] mparams = constructor.GetParameters();
+ if (mparams != null)
+ cur_stack -= mparams.Length;
+ }
+ public virtual void Emit (OpCode opcode, Double val) {
+ byte[] s = System.BitConverter.GetBytes (val);
+ make_room (10);
+ ll_emit (opcode);
+ System.Array.Copy (s, 0, code, code_len, 8);
+ code_len += 8;
+ }
+ public virtual void Emit (OpCode opcode, FieldInfo field) {
+ int token = abuilder.GetToken (field);
+ make_room (6);
+ ll_emit (opcode);
+ if (field is FieldBuilder)
+ add_token_fixup (field);
+ emit_int (token);
+ }
+ public virtual void Emit (OpCode opcode, Int16 val) {
+ make_room (4);
+ ll_emit (opcode);
+ code [code_len++] = (byte) (val & 0xFF);
+ code [code_len++] = (byte) ((val >> 8) & 0xFF);
+ }
+ public virtual void Emit (OpCode opcode, Int32 val) {
+ make_room (6);
+ ll_emit (opcode);
+ emit_int (val);
+ }
+ public virtual void Emit (OpCode opcode, Int64 val) {
+ make_room (10);
+ ll_emit (opcode);
+ code [code_len++] = (byte) (val & 0xFF);
+ code [code_len++] = (byte) ((val >> 8) & 0xFF);
+ code [code_len++] = (byte) ((val >> 16) & 0xFF);
+ code [code_len++] = (byte) ((val >> 24) & 0xFF);
+ code [code_len++] = (byte) ((val >> 32) & 0xFF);
+ code [code_len++] = (byte) ((val >> 40) & 0xFF);
+ code [code_len++] = (byte) ((val >> 48) & 0xFF);
+ code [code_len++] = (byte) ((val >> 56) & 0xFF);
+ }
+ public virtual void Emit (OpCode opcode, Label label) {
+ int tlen = target_len (opcode);
+ make_room (6);
+ ll_emit (opcode);
+ if (num_fixups >= fixups.Length) {
+ LabelFixup[] newf = new LabelFixup [fixups.Length + 16];
+ System.Array.Copy (fixups, newf, fixups.Length);
+ fixups = newf;
+ }
+ fixups [num_fixups].size = tlen;
+ fixups [num_fixups].pos = code_len;
+ fixups [num_fixups].label_base = code_len;
+ fixups [num_fixups].label_idx = label.label;
+ num_fixups++;
+ code_len += tlen;
+
+ }
+ public virtual void Emit (OpCode opcode, Label[] labels) {
+ /* opcode needs to be switch. */
+ int count = labels.Length;
+ make_room (6 + count * 4);
+ ll_emit (opcode);
+ int switch_base = code_len + count*4;
+ emit_int (count);
+ if (num_fixups + count >= fixups.Length) {
+ LabelFixup[] newf = new LabelFixup [fixups.Length + count + 16];
+ System.Array.Copy (fixups, newf, fixups.Length);
+ fixups = newf;
+ }
+ for (int i = 0; i < count; ++i) {
+ fixups [num_fixups].size = 4;
+ fixups [num_fixups].pos = code_len;
+ fixups [num_fixups].label_base = switch_base;
+ fixups [num_fixups].label_idx = labels [i].label;
+ num_fixups++;
+ code_len += 4;
+ }
+ }
+ public virtual void Emit (OpCode opcode, LocalBuilder lbuilder) {
+ uint pos = lbuilder.position;
+ bool load_addr = false;
+ bool is_store = false;
+ make_room (6);
+ /* inline the code from ll_emit () to optimize il code size */
+ if (opcode.StackBehaviourPop == StackBehaviour.Pop1) {
+ cur_stack --;
+ is_store = true;
+ } else {
+ cur_stack++;
+ if (cur_stack > max_stack)
+ max_stack = cur_stack;
+ load_addr = opcode.StackBehaviourPush == StackBehaviour.Pushi;
+ }
+ if (load_addr) {
+ if (pos < 256) {
+ code [code_len++] = (byte)0x12;
+ code [code_len++] = (byte)pos;
+ } else {
+ code [code_len++] = (byte)0xfe;
+ code [code_len++] = (byte)0x0d;
+ code [code_len++] = (byte)(pos & 0xff);
+ code [code_len++] = (byte)((pos >> 8) & 0xff);
+ }
+ } else {
+ if (is_store) {
+ if (pos < 4) {
+ code [code_len++] = (byte)(0x0a + pos);
+ } else if (pos < 256) {
+ code [code_len++] = (byte)0x13;
+ code [code_len++] = (byte)pos;
+ } else {
+ code [code_len++] = (byte)0xfe;
+ code [code_len++] = (byte)0x0e;
+ code [code_len++] = (byte)(pos & 0xff);
+ code [code_len++] = (byte)((pos >> 8) & 0xff);
+ }
+ } else {
+ if (pos < 4) {
+ code [code_len++] = (byte)(0x06 + pos);
+ } else if (pos < 256) {
+ code [code_len++] = (byte)0x11;
+ code [code_len++] = (byte)pos;
+ } else {
+ code [code_len++] = (byte)0xfe;
+ code [code_len++] = (byte)0x0c;
+ code [code_len++] = (byte)(pos & 0xff);
+ code [code_len++] = (byte)((pos >> 8) & 0xff);
+ }
+ }
+ }
+ }
+ public virtual void Emit (OpCode opcode, MethodInfo method) {
+ int token = abuilder.GetToken (method);
+ make_room (6);
+ ll_emit (opcode);
+ if (method is MethodBuilder)
+ add_token_fixup (method);
+ emit_int (token);
+ if (method.ReturnType == void_type)
+ cur_stack --;
+ ParameterInfo[] mparams = method.GetParameters();
+ if (mparams != null)
+ cur_stack -= mparams.Length;
+ }
+ [CLSCompliant(false)]
+ public void Emit (OpCode opcode, sbyte val) {
+ make_room (3);
+ ll_emit (opcode);
+ code [code_len++] = (byte)val;
+ }
+
+ [MonoTODO]
+ public virtual void Emit (OpCode opcode, SignatureHelper shelper) {
+ int token = 0; // FIXME: request a token from the modulebuilder
+ make_room (6);
+ ll_emit (opcode);
+ emit_int (token);
+ }
+ public virtual void Emit (OpCode opcode, float val) {
+ byte[] s = System.BitConverter.GetBytes (val);
+ make_room (6);
+ ll_emit (opcode);
+ System.Array.Copy (s, 0, code, code_len, 4);
+ code_len += 4;
+ }
+ public virtual void Emit (OpCode opcode, string val) {
+ int token = abuilder.GetToken (val);
+ make_room (6);
+ ll_emit (opcode);
+ emit_int (token);
+ }
+ public virtual void Emit (OpCode opcode, Type type) {
+ make_room (6);
+ ll_emit (opcode);
+ emit_int (abuilder.GetToken (type));
+ }
+
+ public void EmitCall (OpCode opcode, MethodInfo methodinfo, Type[] optionalParamTypes) {
+ throw new NotImplementedException ();
+ }
+ public void EmitCalli (OpCode opcode, CallingConventions call_conv, Type returnType, Type[] paramTypes, Type[] optionalParamTypes) {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void EmitWriteLine (FieldInfo field) {
+ throw new NotImplementedException ();
+ }
+ public virtual void EmitWriteLine (LocalBuilder lbuilder) {
+ throw new NotImplementedException ();
+ }
+ public virtual void EmitWriteLine (string val) {
+ throw new NotImplementedException ();
+ }
+
+ public virtual void EndExceptionBlock () {
+ if (open_blocks.Count <= 0)
+ throw new NotSupportedException ("Not in an exception block");
+ InternalEndClause ();
+ MarkLabel (ex_handlers [cur_block].end);
+ ex_handlers [cur_block].End (code_len);
+ ex_handlers [cur_block].Debug (cur_block);
+ //System.Console.WriteLine ("End Block {0} (handlers: {1})", cur_block, ex_handlers [cur_block].NumHandlers ());
+ open_blocks.Pop ();
+ if (open_blocks.Count > 0)
+ cur_block = (int)open_blocks.Peek ();
+ //Console.WriteLine ("curblock restored to {0}", cur_block);
+ //throw new NotImplementedException ();
+ }
+ public virtual void EndScope () {
+ if (sym_writer != null) {
+ sym_writer.CloseScope (code_len);
+ scopes.Pop ();
+ }
+ }
+ public virtual void MarkLabel (Label loc) {
+ if (loc.label < 0 || loc.label >= num_labels)
+ throw new System.ArgumentException ("The label is not valid");
+ if (label_to_addr [loc.label] >= 0)
+ throw new System.ArgumentException ("The label was already defined");
+ label_to_addr [loc.label] = code_len;
+ }
+ public virtual void MarkSequencePoint (ISymbolDocumentWriter document, int startLine,
+ int startColumn, int endLine, int endColumn) {
+ if (sym_writer == null)
+ return;
+
+ int[] offsets = { code_len };
+ int[] startLines = { startLine };
+ int[] startColumns = { startColumn };
+ int[] endLines = { endLine };
+ int[] endColumns = { endColumn };
+
+ sym_writer.DefineSequencePoints (document, offsets, startLines, startColumns,
+ endLines, endColumns);
+ }
+ public virtual void ThrowException (Type exceptionType) {
+ throw new NotImplementedException ();
+ }
+ public void UsingNamespace (String usingNamespace) {
+ throw new NotImplementedException ();
+ }
+
+ internal void label_fixup () {
+ int i;
+ for (i = 0; i < num_fixups; ++i) {
+ int diff = label_to_addr [fixups [i].label_idx] - fixups [i].label_base;
+ if (fixups [i].size == 1) {
+ code [fixups [i].pos] = (byte)((sbyte) diff - 1);
+ } else {
+ int old_cl = code_len;
+ code_len = fixups [i].pos;
+ emit_int (diff - 4);
+ code_len = old_cl;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/Label.cs b/mcs/class/corlib/System.Reflection.Emit/Label.cs
new file mode 100644
index 00000000000..19be26c6dea
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/Label.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.Emit/Label.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection.Emit {
+ [Serializable]
+ public struct Label {
+ internal int label;
+
+ internal Label (int val) {
+ label = val;
+ }
+
+ [MonoTODO]
+ public override bool Equals (object obj) {
+ /* FIXME */
+ return false;
+ }
+
+ public override int GetHashCode () {
+ return label.GetHashCode ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs
new file mode 100755
index 00000000000..6e21ae2cca7
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/LocalBuilder.cs
@@ -0,0 +1,74 @@
+
+//
+// System.Reflection.Emit/LocalBuilder.cs
+//
+// Authors:
+// Paolo Molaro (lupus@ximian.com)
+// Martin Baulig (martin@gnome.org)
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Diagnostics.SymbolStore;
+
+namespace System.Reflection.Emit {
+ public sealed class LocalBuilder {
+ //
+ // These are kept in sync with reflection.h
+ //
+ #region Sync with reflection.h
+ private Type type;
+ private string name;
+ #endregion
+
+ //
+ // Order does not matter after here
+ //
+ private ModuleBuilder module;
+ internal uint position;
+
+ internal LocalBuilder (ModuleBuilder m, Type t)
+ {
+ this.module = m;
+ this.type = t;
+ }
+ public void SetLocalSymInfo (string lname, int startOffset, int endOffset)
+ {
+ ISymbolWriter symbol_writer = module.GetSymWriter ();
+ name = lname;
+
+ if (symbol_writer == null)
+ return;
+
+ SignatureHelper sig_helper = SignatureHelper.GetLocalVarSigHelper (module);
+
+ sig_helper.AddArgument (type);
+
+ byte[] signature = sig_helper.GetSignature ();
+
+ symbol_writer.DefineLocalVariable (name, FieldAttributes.Private,
+ signature, SymAddressKind.ILOffset,
+ (int)position, 0, 0,
+ startOffset, endOffset);
+ }
+
+ public void SetLocalSymInfo (string lname)
+ {
+ SetLocalSymInfo (lname, 0, 0);
+ }
+
+
+ public Type LocalType
+ {
+ get {
+ return type;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs
new file mode 100755
index 00000000000..bc27331ec71
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs
@@ -0,0 +1,156 @@
+
+//
+// System.Reflection.Emit/MethodBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection.Emit {
+ public sealed class MethodBuilder : MethodInfo {
+ private RuntimeMethodHandle mhandle;
+ private Type rtype;
+ private Type[] parameters;
+ private MethodAttributes attrs;
+ private MethodImplAttributes iattrs;
+ private string name;
+ private int table_idx;
+ private byte[] code;
+ private ILGenerator ilgen;
+ private TypeBuilder type;
+ private ParameterBuilder[] pinfo;
+ private CustomAttributeBuilder[] cattrs;
+ private MethodInfo override_method;
+ private string pi_dll;
+ private string pi_entry;
+ private CharSet ncharset;
+ private CallingConvention native_cc;
+ private CallingConventions call_conv;
+
+ internal MethodBuilder (TypeBuilder tb, string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) {
+ this.name = name;
+ this.attrs = attributes;
+ this.call_conv = callingConvention;
+ this.rtype = returnType;
+ if (parameterTypes != null) {
+ this.parameters = new Type [parameterTypes.Length];
+ System.Array.Copy (parameterTypes, this.parameters, parameterTypes.Length);
+ }
+ type = tb;
+ table_idx = get_next_table_index (0x06, true);
+ //Console.WriteLine ("index for "+name+" set to "+table_idx.ToString());
+ }
+
+ internal MethodBuilder (TypeBuilder tb, string name, MethodAttributes attributes,
+ CallingConventions callingConvention, Type returnType, Type[] parameterTypes,
+ String dllName, String entryName, CallingConvention nativeCConv, CharSet nativeCharset)
+ : this (tb, name, attributes, callingConvention, returnType, parameterTypes) {
+ pi_dll = dllName;
+ pi_entry = entryName;
+ native_cc = nativeCConv;
+ ncharset = nativeCharset;
+ }
+
+ internal TypeBuilder TypeBuilder {
+ get {return type;}
+ }
+
+ public override Type ReturnType {get {return rtype;}}
+ public override Type ReflectedType {get {return type;}}
+ public override Type DeclaringType {get {return type;}}
+ public override string Name {get {return name;}}
+ public override RuntimeMethodHandle MethodHandle {get {return mhandle;}}
+ public override MethodAttributes Attributes {get {return attrs;}}
+ public override ICustomAttributeProvider ReturnTypeCustomAttributes {
+ get {return null;}
+ }
+ public MethodToken GetToken() {
+ return new MethodToken(0x06000000 | table_idx);
+ }
+
+ public override MethodInfo GetBaseDefinition() {
+ return null;
+ }
+ public override MethodImplAttributes GetMethodImplementationFlags() {
+ return iattrs;
+ }
+ public override ParameterInfo[] GetParameters() {
+ return null;
+ }
+
+ public void CreateMethodBody( byte[] il, int count) {
+ code = new byte [count];
+ System.Array.Copy(il, code, count);
+ }
+ public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ return null;
+ }
+ public override bool IsDefined (Type attribute_type, bool inherit) {
+ return false;
+ }
+ public override object[] GetCustomAttributes( bool inherit) {
+ return null;
+ }
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return null;
+ }
+ public ILGenerator GetILGenerator () {
+ return GetILGenerator (256);
+ }
+ public ILGenerator GetILGenerator (int size) {
+ ilgen = new ILGenerator (this, size);
+ return ilgen;
+ }
+
+ [MonoTODO]
+ public ParameterBuilder DefineParameter (int position, ParameterAttributes attributes, string strParamName)
+ {
+ ParameterBuilder pb = new ParameterBuilder (this, position, attributes, strParamName);
+ // check position
+ if (pinfo == null)
+ pinfo = new ParameterBuilder [parameters.Length + 1];
+ pinfo [position] = pb;
+ return pb;
+ }
+
+ internal void fixup () {
+ if (ilgen != null)
+ ilgen.label_fixup ();
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+ public void SetImplementationFlags( MethodImplAttributes attributes) {
+ iattrs = attributes;
+ }
+ internal override int get_next_table_index (int table, bool inc) {
+ return type.get_next_table_index (table, inc);
+ }
+
+ internal void set_override (MethodInfo mdecl) {
+ override_method = mdecl;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/MethodToken.cs b/mcs/class/corlib/System.Reflection.Emit/MethodToken.cs
new file mode 100644
index 00000000000..a08d4247571
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/MethodToken.cs
@@ -0,0 +1,70 @@
+// MethodToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Method.
+ /// </summary>
+ [Serializable]
+ public struct MethodToken {
+
+ internal int tokValue;
+
+ public static readonly MethodToken Empty;
+
+
+ static MethodToken ()
+ {
+ Empty = new MethodToken ();
+ }
+
+
+ internal MethodToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is MethodToken;
+
+ if (res) {
+ MethodToken that = (MethodToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// MethodToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Method.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
new file mode 100644
index 00000000000..3e0d1253dad
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ModuleBuilder.cs
@@ -0,0 +1,210 @@
+
+//
+// System.Reflection.Emit/ModuleBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Diagnostics.SymbolStore;
+using System.IO;
+
+namespace System.Reflection.Emit {
+ public class ModuleBuilder : Module {
+ private TypeBuilder[] types;
+ private CustomAttributeBuilder[] cattrs;
+ private byte[] guid;
+ private int table_idx;
+ private AssemblyBuilder assemblyb;
+ private ISymbolWriter symbol_writer;
+ Hashtable name_cache;
+
+ internal ModuleBuilder (AssemblyBuilder assb, string name, string fullyqname, bool emitSymbolInfo) {
+ this.name = this.scopename = name;
+ this.fqname = fullyqname;
+ this.assembly = this.assemblyb = assb;
+ guid = Guid.NewGuid().ToByteArray ();
+ table_idx = get_next_table_index (0x00, true);
+ name_cache = new Hashtable ();
+
+ if (emitSymbolInfo)
+ symbol_writer = GetSymbolWriter (fullyqname);
+ }
+
+ internal ISymbolWriter GetSymbolWriter (string filename)
+ {
+ Assembly assembly;
+ try {
+ assembly = Assembly.Load ("Mono.CSharp.Debugger");
+ } catch (FileNotFoundException) {
+ return null;
+ }
+
+ Type type = assembly.GetType ("Mono.CSharp.Debugger.MonoSymbolWriter");
+ if (type == null)
+ return null;
+
+ Type[] arg_types = new Type [1];
+ arg_types [0] = typeof (string);
+ ConstructorInfo constructor = type.GetConstructor (arg_types);
+
+ object[] args = new object [1];
+ args [0] = filename;
+
+ if (constructor == null)
+ return null;
+
+ Object instance = constructor.Invoke (args);
+ if (instance == null)
+ return null;
+
+ if (!(instance is ISymbolWriter))
+ return null;
+
+ return (ISymbolWriter) instance;
+ }
+
+ public override string FullyQualifiedName {get { return fqname;}}
+
+ [MonoTODO]
+ public TypeBuilder DefineType (string name) {
+ // FIXME: LAMESPEC: what other attributes should we use here as default?
+ return DefineType (name, TypeAttributes.Public, typeof(object), null);
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr) {
+ return DefineType (name, attr, typeof(object), null);
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent) {
+ return DefineType (name, attr, parent, null);
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, Type[] interfaces) {
+ TypeBuilder res = new TypeBuilder (this, name, attr, parent, interfaces);
+ if (types != null) {
+ TypeBuilder[] new_types = new TypeBuilder [types.Length + 1];
+ System.Array.Copy (types, new_types, types.Length);
+ new_types [types.Length] = res;
+ types = new_types;
+ } else {
+ types = new TypeBuilder [1];
+ types [0] = res;
+ }
+ name_cache.Add (name, res);
+ return res;
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, int typesize) {
+ return DefineType (name, attr, parent, null);
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, PackingSize packsize) {
+ return DefineType (name, attr, parent, null);
+ }
+
+ public TypeBuilder DefineType (string name, TypeAttributes attr, Type parent, PackingSize packsize, int typesize) {
+ return DefineType (name, attr, parent, null);
+ }
+
+ public MethodInfo GetArrayMethod( Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) {
+ return new MonoArrayMethod (arrayClass, methodName, callingConvention, returnType, parameterTypes);
+ }
+
+ public EnumBuilder DefineEnum( string name, TypeAttributes visibility, Type underlyingType) {
+ EnumBuilder eb = new EnumBuilder (this, name, visibility, underlyingType);
+ return eb;
+ }
+
+ public override Type GetType( string className) {
+ return GetType (className, false, false);
+ }
+
+ public override Type GetType( string className, bool ignoreCase) {
+ return GetType (className, false, ignoreCase);
+ }
+
+ private TypeBuilder search_in_array (TypeBuilder[] arr, string className, bool ignoreCase) {
+ int i;
+ if (arr == types && !ignoreCase)
+ return (TypeBuilder)name_cache [className];
+ for (i = 0; i < arr.Length; ++i) {
+ if (String.Compare (className, arr [i].FullName, ignoreCase) == 0) {
+ return arr [i];
+ }
+ }
+ return null;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern Type create_modified_type (TypeBuilder tb, string modifiers);
+
+ static char[] type_modifiers = {'&', '[', '*'};
+
+ public override Type GetType( string className, bool throwOnError, bool ignoreCase) {
+ int subt;
+ string modifiers;
+ TypeBuilder result = null;
+
+ if (types == null && throwOnError)
+ throw new TypeLoadException (className);
+
+ subt = className.IndexOfAny (type_modifiers);
+ if (subt >= 0) {
+ modifiers = className.Substring (subt);
+ className = className.Substring (0, subt);
+ } else
+ modifiers = null;
+
+ subt = className.IndexOf ('+');
+ if (subt < 0) {
+ if (types != null)
+ result = search_in_array (types, className, ignoreCase);
+ } else {
+ string pname, rname;
+ pname = className.Substring (0, subt);
+ rname = className.Substring (subt + 1);
+ result = search_in_array (types, pname, ignoreCase);
+ if ((result != null) && (result.subtypes != null))
+ result = search_in_array (result.subtypes, rname, ignoreCase);
+ else
+ result = null;
+ }
+ if ((result == null) && throwOnError)
+ throw new TypeLoadException (className);
+ if (result != null && (modifiers != null))
+ return create_modified_type (result, modifiers);
+ return result;
+ }
+
+ internal int get_next_table_index (int table, bool inc) {
+ return assemblyb.get_next_table_index (table, inc);
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+
+ public ISymbolWriter GetSymWriter () {
+ return symbol_writer;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs b/mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs
new file mode 100755
index 00000000000..130cd3e5623
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs
@@ -0,0 +1,111 @@
+//
+// System.Reflection/MonoMethod.cs
+// The class used to represent methods from the mono runtime.
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection {
+ internal class MonoArrayMethod: MethodInfo {
+ internal RuntimeMethodHandle mhandle;
+ internal Type parent;
+ internal Type ret;
+ internal Type[] parameters;
+ internal string name;
+ internal int table_idx;
+ internal CallingConventions call_conv;
+
+ internal MonoArrayMethod (Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) {
+ name = methodName;
+ parent = arrayClass;
+ ret = returnType;
+ parameters = (Type[])parameterTypes.Clone();
+ call_conv = callingConvention;
+ }
+
+ [MonoTODO]
+ public override MethodInfo GetBaseDefinition() {
+ return this; /* FIXME */
+ }
+ public override Type ReturnType {
+ get {
+ return ret;
+ }
+ }
+ [MonoTODO]
+ public override ICustomAttributeProvider ReturnTypeCustomAttributes {
+ get {return null;}
+ }
+
+ [MonoTODO]
+ public override MethodImplAttributes GetMethodImplementationFlags() {
+ return (MethodImplAttributes)0;
+ }
+
+ [MonoTODO]
+ public override ParameterInfo[] GetParameters() {
+ return new ParameterInfo [0];
+ }
+
+ [MonoTODO]
+ public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ throw new NotImplementedException ();
+ }
+
+ public override RuntimeMethodHandle MethodHandle {
+ get {return mhandle;}
+ }
+ [MonoTODO]
+ public override MethodAttributes Attributes {
+ get {
+ return (MethodAttributes)0;
+ }
+ }
+
+ public override Type ReflectedType {
+ get {
+ return parent;
+ }
+ }
+ public override Type DeclaringType {
+ get {
+ return parent;
+ }
+ }
+ public override string Name {
+ get {
+ return name;
+ }
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes( bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public override string ToString () {
+ string parms = "";
+ ParameterInfo[] p = GetParameters ();
+ for (int i = 0; i < p.Length; ++i) {
+ if (i > 0)
+ parms = parms + ", ";
+ parms = parms + p [i].ParameterType.Name;
+ }
+ return ReturnType.Name+" "+Name+"("+parms+")";
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/OpCode.cs b/mcs/class/corlib/System.Reflection.Emit/OpCode.cs
new file mode 100644
index 00000000000..1bdd19fcc9b
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/OpCode.cs
@@ -0,0 +1,125 @@
+//
+// System.Reflection.Emit.OpCode
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+
+namespace System.Reflection.Emit {
+
+ public struct OpCode {
+
+ internal string name;
+ internal int size;
+ internal OpCodeType type;
+ internal OperandType operandType;
+ internal StackBehaviour pop;
+ internal StackBehaviour push;
+ internal FlowControl flowCtrl;
+ internal byte op1;
+ internal byte op2;
+
+ internal OpCode (string name, int size,
+ OpCodeType opcodeType,
+ OperandType operandType,
+ StackBehaviour pop,
+ StackBehaviour push,
+ FlowControl flowCtrl,
+ byte op1, byte op2)
+ {
+ this.name = name;
+ this.size = size;
+ this.type = opcodeType;
+ this.operandType = operandType;
+ this.pop = pop;
+ this.push = push;
+ this.flowCtrl = flowCtrl;
+ this.op1 = op1;
+ this.op2 = op2;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public string Name {
+ get {
+ return name;
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ public int Size {
+ get {
+ return size;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public OpCodeType OpCodeType {
+ get {
+ return type;
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ public OperandType OperandType {
+ get {
+ return operandType;
+ }
+ }
+
+ /// <summary>
+ /// </summary>
+ public FlowControl FlowControl {
+ get {
+ return flowCtrl;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public StackBehaviour StackBehaviourPop {
+ get {
+ return pop;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public StackBehaviour StackBehaviourPush {
+ get {
+ return push;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public short Value {
+ get {
+ if (size == 1) {
+ return op2;
+ } else {
+ // two byte instruction - combine
+ // give the same values as the mscorlib impl
+ // this makes the Value property useless
+ return (short) ((op1 << 2) | op2);
+ }
+ }
+ }
+
+ } // OpCode
+
+} // System.Reflection.Emit
diff --git a/mcs/class/corlib/System.Reflection.Emit/OpCodeType.cs b/mcs/class/corlib/System.Reflection.Emit/OpCodeType.cs
new file mode 100644
index 00000000000..2733369ecbe
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/OpCodeType.cs
@@ -0,0 +1,49 @@
+// OpCodeType.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+ /// <summary>
+ /// Describes the types of MSIL instructions.
+ /// </summary>
+ public enum OpCodeType {
+
+ /// <summary>
+ /// "Ignorable" instruction.
+ /// Such instruction are used to supply
+ /// additional information to particular
+ /// MSIL processor.
+ /// </summary>
+ Annotation = 0,
+
+ /// <summary>
+ /// Denotes "shorthand" instruction.
+ /// Such instructions take less space
+ /// than their full-size equivalents
+ /// (ex. ldarg.0 vs. ldarg 0).
+ /// </summary>
+ Macro = 1,
+
+ /// <summary>
+ /// Denotes instruction reserved for internal use.
+ /// </summary>
+ Nternal = 2,
+
+ /// <summary>
+ /// Denotes instruction to deal with objects.
+ /// (ex. ldobj).
+ /// </summary>
+ Objmodel = 3,
+
+ /// <summary>
+ /// </summary>
+ Prefix = 4,
+
+ /// <summary>
+ /// </summary>
+ Primitive = 5
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/OpCodes.cs b/mcs/class/corlib/System.Reflection.Emit/OpCodes.cs
new file mode 100644
index 00000000000..ff1ed953f6f
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/OpCodes.cs
@@ -0,0 +1,486 @@
+// OpCodes.cs
+// Mechanically generated - DO NOT EDIT!
+//
+// (C) Sergey Chaban (serge@wildwestsoftware.com)
+
+using System;
+using System.Reflection.Emit;
+
+namespace System.Reflection.Emit {
+
+
+
+ public class OpCodes {
+ public static readonly OpCode Add;
+ public static readonly OpCode Add_Ovf;
+ public static readonly OpCode Add_Ovf_Un;
+ public static readonly OpCode And;
+ public static readonly OpCode Arglist;
+ public static readonly OpCode Beq;
+ public static readonly OpCode Beq_S;
+ public static readonly OpCode Bge;
+ public static readonly OpCode Bge_S;
+ public static readonly OpCode Bge_Un;
+ public static readonly OpCode Bge_Un_S;
+ public static readonly OpCode Bgt;
+ public static readonly OpCode Bgt_S;
+ public static readonly OpCode Bgt_Un;
+ public static readonly OpCode Bgt_Un_S;
+ public static readonly OpCode Ble;
+ public static readonly OpCode Ble_S;
+ public static readonly OpCode Ble_Un;
+ public static readonly OpCode Ble_Un_S;
+ public static readonly OpCode Blt;
+ public static readonly OpCode Blt_S;
+ public static readonly OpCode Blt_Un;
+ public static readonly OpCode Blt_Un_S;
+ public static readonly OpCode Bne_Un;
+ public static readonly OpCode Bne_Un_S;
+ public static readonly OpCode Box;
+ public static readonly OpCode Boxval;
+ public static readonly OpCode Br;
+ public static readonly OpCode Br_S;
+ public static readonly OpCode Break;
+ public static readonly OpCode Brfalse;
+ public static readonly OpCode Brfalse_S;
+ public static readonly OpCode Brtrue;
+ public static readonly OpCode Brtrue_S;
+ public static readonly OpCode Call;
+ public static readonly OpCode Calli;
+ public static readonly OpCode Callvirt;
+ public static readonly OpCode Castclass;
+ public static readonly OpCode Ceq;
+ public static readonly OpCode Cgt;
+ public static readonly OpCode Cgt_Un;
+ public static readonly OpCode Ckfinite;
+ public static readonly OpCode Clt;
+ public static readonly OpCode Clt_Un;
+ public static readonly OpCode Conv_I;
+ public static readonly OpCode Conv_I1;
+ public static readonly OpCode Conv_I2;
+ public static readonly OpCode Conv_I4;
+ public static readonly OpCode Conv_I8;
+ public static readonly OpCode Conv_Ovf_I;
+ public static readonly OpCode Conv_Ovf_I_Un;
+ public static readonly OpCode Conv_Ovf_I1;
+ public static readonly OpCode Conv_Ovf_I1_Un;
+ public static readonly OpCode Conv_Ovf_I2;
+ public static readonly OpCode Conv_Ovf_I2_Un;
+ public static readonly OpCode Conv_Ovf_I4;
+ public static readonly OpCode Conv_Ovf_I4_Un;
+ public static readonly OpCode Conv_Ovf_I8;
+ public static readonly OpCode Conv_Ovf_I8_Un;
+ public static readonly OpCode Conv_Ovf_U;
+ public static readonly OpCode Conv_Ovf_U_Un;
+ public static readonly OpCode Conv_Ovf_U1;
+ public static readonly OpCode Conv_Ovf_U1_Un;
+ public static readonly OpCode Conv_Ovf_U2;
+ public static readonly OpCode Conv_Ovf_U2_Un;
+ public static readonly OpCode Conv_Ovf_U4;
+ public static readonly OpCode Conv_Ovf_U4_Un;
+ public static readonly OpCode Conv_Ovf_U8;
+ public static readonly OpCode Conv_Ovf_U8_Un;
+ public static readonly OpCode Conv_R_Un;
+ public static readonly OpCode Conv_R4;
+ public static readonly OpCode Conv_R8;
+ public static readonly OpCode Conv_U;
+ public static readonly OpCode Conv_U1;
+ public static readonly OpCode Conv_U2;
+ public static readonly OpCode Conv_U4;
+ public static readonly OpCode Conv_U8;
+ public static readonly OpCode Cpblk;
+ public static readonly OpCode Cpobj;
+ public static readonly OpCode Div;
+ public static readonly OpCode Div_Un;
+ public static readonly OpCode Dup;
+ public static readonly OpCode Endfilter;
+ public static readonly OpCode Endfinally;
+ public static readonly OpCode Initblk;
+ public static readonly OpCode Initobj;
+ public static readonly OpCode Isinst;
+ public static readonly OpCode Jmp;
+ public static readonly OpCode Ldarg;
+ public static readonly OpCode Ldarg_0;
+ public static readonly OpCode Ldarg_1;
+ public static readonly OpCode Ldarg_2;
+ public static readonly OpCode Ldarg_3;
+ public static readonly OpCode Ldarg_S;
+ public static readonly OpCode Ldarga;
+ public static readonly OpCode Ldarga_S;
+ public static readonly OpCode Ldc_I4;
+ public static readonly OpCode Ldc_I4_0;
+ public static readonly OpCode Ldc_I4_1;
+ public static readonly OpCode Ldc_I4_2;
+ public static readonly OpCode Ldc_I4_3;
+ public static readonly OpCode Ldc_I4_4;
+ public static readonly OpCode Ldc_I4_5;
+ public static readonly OpCode Ldc_I4_6;
+ public static readonly OpCode Ldc_I4_7;
+ public static readonly OpCode Ldc_I4_8;
+ public static readonly OpCode Ldc_I4_M1;
+ public static readonly OpCode Ldc_I4_S;
+ public static readonly OpCode Ldc_I8;
+ public static readonly OpCode Ldc_R4;
+ public static readonly OpCode Ldc_R8;
+ public static readonly OpCode Ldelem_I;
+ public static readonly OpCode Ldelem_I1;
+ public static readonly OpCode Ldelem_I2;
+ public static readonly OpCode Ldelem_I4;
+ public static readonly OpCode Ldelem_I8;
+ public static readonly OpCode Ldelem_R4;
+ public static readonly OpCode Ldelem_R8;
+ public static readonly OpCode Ldelem_Ref;
+ public static readonly OpCode Ldelem_U1;
+ public static readonly OpCode Ldelem_U2;
+ public static readonly OpCode Ldelem_U4;
+ public static readonly OpCode Ldelema;
+ public static readonly OpCode Ldfld;
+ public static readonly OpCode Ldflda;
+ public static readonly OpCode Ldftn;
+ public static readonly OpCode Ldind_I;
+ public static readonly OpCode Ldind_I1;
+ public static readonly OpCode Ldind_I2;
+ public static readonly OpCode Ldind_I4;
+ public static readonly OpCode Ldind_I8;
+ public static readonly OpCode Ldind_R4;
+ public static readonly OpCode Ldind_R8;
+ public static readonly OpCode Ldind_Ref;
+ public static readonly OpCode Ldind_U1;
+ public static readonly OpCode Ldind_U2;
+ public static readonly OpCode Ldind_U4;
+ public static readonly OpCode Ldlen;
+ public static readonly OpCode Ldloc;
+ public static readonly OpCode Ldloc_0;
+ public static readonly OpCode Ldloc_1;
+ public static readonly OpCode Ldloc_2;
+ public static readonly OpCode Ldloc_3;
+ public static readonly OpCode Ldloc_S;
+ public static readonly OpCode Ldloca;
+ public static readonly OpCode Ldloca_S;
+ public static readonly OpCode Ldnull;
+ public static readonly OpCode Ldobj;
+ public static readonly OpCode Ldsfld;
+ public static readonly OpCode Ldsflda;
+ public static readonly OpCode Ldstr;
+ public static readonly OpCode Ldtoken;
+ public static readonly OpCode Ldvirtftn;
+ public static readonly OpCode Leave;
+ public static readonly OpCode Leave_S;
+ public static readonly OpCode Localloc;
+ public static readonly OpCode Mkrefany;
+ public static readonly OpCode Mul;
+ public static readonly OpCode Mul_Ovf;
+ public static readonly OpCode Mul_Ovf_Un;
+ public static readonly OpCode Neg;
+ public static readonly OpCode Newarr;
+ public static readonly OpCode Newobj;
+ public static readonly OpCode Nop;
+ public static readonly OpCode Not;
+ public static readonly OpCode Or;
+ public static readonly OpCode Pop;
+ public static readonly OpCode Prefix1;
+ public static readonly OpCode Prefix2;
+ public static readonly OpCode Prefix3;
+ public static readonly OpCode Prefix4;
+ public static readonly OpCode Prefix5;
+ public static readonly OpCode Prefix6;
+ public static readonly OpCode Prefix7;
+ public static readonly OpCode Prefixref;
+ public static readonly OpCode Refanytype;
+ public static readonly OpCode Refanyval;
+ public static readonly OpCode Rem;
+ public static readonly OpCode Rem_Un;
+ public static readonly OpCode Ret;
+ public static readonly OpCode Rethrow;
+ public static readonly OpCode Shl;
+ public static readonly OpCode Shr;
+ public static readonly OpCode Shr_Un;
+ public static readonly OpCode Sizeof;
+ public static readonly OpCode Starg;
+ public static readonly OpCode Starg_S;
+ public static readonly OpCode Stelem_I;
+ public static readonly OpCode Stelem_I1;
+ public static readonly OpCode Stelem_I2;
+ public static readonly OpCode Stelem_I4;
+ public static readonly OpCode Stelem_I8;
+ public static readonly OpCode Stelem_R4;
+ public static readonly OpCode Stelem_R8;
+ public static readonly OpCode Stelem_Ref;
+ public static readonly OpCode Stfld;
+ public static readonly OpCode Stind_I;
+ public static readonly OpCode Stind_I1;
+ public static readonly OpCode Stind_I2;
+ public static readonly OpCode Stind_I4;
+ public static readonly OpCode Stind_I8;
+ public static readonly OpCode Stind_R4;
+ public static readonly OpCode Stind_R8;
+ public static readonly OpCode Stind_Ref;
+ public static readonly OpCode Stloc;
+ public static readonly OpCode Stloc_0;
+ public static readonly OpCode Stloc_1;
+ public static readonly OpCode Stloc_2;
+ public static readonly OpCode Stloc_3;
+ public static readonly OpCode Stloc_S;
+ public static readonly OpCode Stobj;
+ public static readonly OpCode Stsfld;
+ public static readonly OpCode Sub;
+ public static readonly OpCode Sub_Ovf;
+ public static readonly OpCode Sub_Ovf_Un;
+ public static readonly OpCode Switch;
+ public static readonly OpCode Tailcall;
+ public static readonly OpCode Throw;
+ public static readonly OpCode Unaligned;
+ public static readonly OpCode Unbox;
+ public static readonly OpCode Volatile;
+ public static readonly OpCode Xor;
+
+
+
+ static OpCodes ()
+ {
+
+ Nop = new OpCode("nop", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x0);
+ Arglist = new OpCode("arglist", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x0);
+ Break = new OpCode("break", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Break, 0xFF, 0x1);
+ Ceq = new OpCode("ceq", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x1);
+ Starg_S = new OpCode("starg.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x10);
+ Ldloc_S = new OpCode("ldloc.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x11);
+ Endfilter = new OpCode("endfilter", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Return, 0xFE, 0x11);
+ Ldloca_S = new OpCode("ldloca.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x12);
+ Unaligned = new OpCode("unaligned.", 2, OpCodeType.Prefix, OperandType.ShortInlineI, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFE, 0x12);
+ Stloc_S = new OpCode("stloc.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x13);
+ Volatile = new OpCode("volatile.", 2, OpCodeType.Prefix, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFE, 0x13);
+ Ldnull = new OpCode("ldnull", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x14);
+ Tailcall = new OpCode("tail.", 2, OpCodeType.Prefix, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFE, 0x14);
+ Ldc_I4_M1 = new OpCode("ldc.i4.m1", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x15);
+ Initobj = new OpCode("initobj", 2, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Next, 0xFE, 0x15);
+ Ldc_I4_0 = new OpCode("ldc.i4.0", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x16);
+ Ldc_I4_1 = new OpCode("ldc.i4.1", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x17);
+ Cpblk = new OpCode("cpblk", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFE, 0x17);
+ Ldc_I4_2 = new OpCode("ldc.i4.2", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x18);
+ Initblk = new OpCode("initblk", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFE, 0x18);
+ Ldc_I4_3 = new OpCode("ldc.i4.3", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x19);
+ Ldc_I4_4 = new OpCode("ldc.i4.4", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1A);
+ Rethrow = new OpCode("rethrow", 2, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Throw, 0xFE, 0x1A);
+ Ldc_I4_5 = new OpCode("ldc.i4.5", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1B);
+ Ldc_I4_6 = new OpCode("ldc.i4.6", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1C);
+ Sizeof = new OpCode("sizeof", 2, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x1C);
+ Ldc_I4_7 = new OpCode("ldc.i4.7", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1D);
+ Refanytype = new OpCode("refanytype", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x1D);
+ Ldc_I4_8 = new OpCode("ldc.i4.8", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1E);
+ Ldc_I4_S = new OpCode("ldc.i4.s", 1, OpCodeType.Macro, OperandType.ShortInlineI, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x1F);
+ Ldarg_0 = new OpCode("ldarg.0", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x2);
+ Cgt = new OpCode("cgt", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x2);
+ Ldc_I4 = new OpCode("ldc.i4", 1, OpCodeType.Primitive, OperandType.InlineI, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x20);
+ Ldc_I8 = new OpCode("ldc.i8", 1, OpCodeType.Primitive, OperandType.InlineI8, StackBehaviour.Pop0, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x21);
+ Ldc_R4 = new OpCode("ldc.r4", 1, OpCodeType.Primitive, OperandType.ShortInlineR, StackBehaviour.Pop0, StackBehaviour.Pushr4, FlowControl.Next, 0xFF, 0x22);
+ Ldc_R8 = new OpCode("ldc.r8", 1, OpCodeType.Primitive, OperandType.InlineR, StackBehaviour.Pop0, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0x23);
+ Dup = new OpCode("dup", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push1_push1, FlowControl.Next, 0xFF, 0x25);
+ Pop = new OpCode("pop", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x26);
+ Jmp = new OpCode("jmp", 1, OpCodeType.Primitive, OperandType.InlineMethod, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Call, 0xFF, 0x27);
+ Call = new OpCode("call", 1, OpCodeType.Primitive, OperandType.InlineMethod, StackBehaviour.Varpop, StackBehaviour.Varpush, FlowControl.Call, 0xFF, 0x28);
+ Calli = new OpCode("calli", 1, OpCodeType.Primitive, OperandType.InlineSig, StackBehaviour.Varpop, StackBehaviour.Varpush, FlowControl.Call, 0xFF, 0x29);
+ Ret = new OpCode("ret", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Varpop, StackBehaviour.Push0, FlowControl.Return, 0xFF, 0x2A);
+ Br_S = new OpCode("br.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Branch, 0xFF, 0x2B);
+ Brfalse_S = new OpCode("brfalse.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x2C);
+ Brtrue_S = new OpCode("brtrue.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x2D);
+ Beq_S = new OpCode("beq.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x2E);
+ Bge_S = new OpCode("bge.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x2F);
+ Ldarg_1 = new OpCode("ldarg.1", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x3);
+ Cgt_Un = new OpCode("cgt.un", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x3);
+ Bgt_S = new OpCode("bgt.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x30);
+ Ble_S = new OpCode("ble.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x31);
+ Blt_S = new OpCode("blt.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x32);
+ Bne_Un_S = new OpCode("bne.un.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x33);
+ Bge_Un_S = new OpCode("bge.un.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x34);
+ Bgt_Un_S = new OpCode("bgt.un.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x35);
+ Ble_Un_S = new OpCode("ble.un.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x36);
+ Blt_Un_S = new OpCode("blt.un.s", 1, OpCodeType.Macro, OperandType.ShortInlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x37);
+ Br = new OpCode("br", 1, OpCodeType.Primitive, OperandType.InlineBrTarget, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Branch, 0xFF, 0x38);
+ Brfalse = new OpCode("brfalse", 1, OpCodeType.Primitive, OperandType.InlineBrTarget, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x39);
+ Brtrue = new OpCode("brtrue", 1, OpCodeType.Primitive, OperandType.InlineBrTarget, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3A);
+ Beq = new OpCode("beq", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3B);
+ Bge = new OpCode("bge", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3C);
+ Bgt = new OpCode("bgt", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3D);
+ Ble = new OpCode("ble", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3E);
+ Blt = new OpCode("blt", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x3F);
+ Ldarg_2 = new OpCode("ldarg.2", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x4);
+ Clt = new OpCode("clt", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x4);
+ Bne_Un = new OpCode("bne.un", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x40);
+ Bge_Un = new OpCode("bge.un", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x41);
+ Bgt_Un = new OpCode("bgt.un", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x42);
+ Ble_Un = new OpCode("ble.un", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x43);
+ Blt_Un = new OpCode("blt.un", 1, OpCodeType.Macro, OperandType.InlineBrTarget, StackBehaviour.Pop1_pop1, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x44);
+ Switch = new OpCode("switch", 1, OpCodeType.Primitive, OperandType.InlineSwitch, StackBehaviour.Popi, StackBehaviour.Push0, FlowControl.Cond_Branch, 0xFF, 0x45);
+ Ldind_I1 = new OpCode("ldind.i1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x46);
+ Ldind_U1 = new OpCode("ldind.u1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x47);
+ Ldind_I2 = new OpCode("ldind.i2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x48);
+ Ldind_U2 = new OpCode("ldind.u2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x49);
+ Ldind_I4 = new OpCode("ldind.i4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x4A);
+ Ldind_U4 = new OpCode("ldind.u4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x4B);
+ Ldind_I8 = new OpCode("ldind.i8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x4C);
+ Ldind_I = new OpCode("ldind.i", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x4D);
+ Ldind_R4 = new OpCode("ldind.r4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushr4, FlowControl.Next, 0xFF, 0x4E);
+ Ldind_R8 = new OpCode("ldind.r8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0x4F);
+ Ldarg_3 = new OpCode("ldarg.3", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5);
+ Clt_Un = new OpCode("clt.un", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x5);
+ Ldind_Ref = new OpCode("ldind.ref", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x50);
+ Stind_Ref = new OpCode("stind.ref", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x51);
+ Stind_I1 = new OpCode("stind.i1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x52);
+ Stind_I2 = new OpCode("stind.i2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x53);
+ Stind_I4 = new OpCode("stind.i4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x54);
+ Stind_I8 = new OpCode("stind.i8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi8, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x55);
+ Stind_R4 = new OpCode("stind.r4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popr4, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x56);
+ Stind_R8 = new OpCode("stind.r8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popr8, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x57);
+ Add = new OpCode("add", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x58);
+ Sub = new OpCode("sub", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x59);
+ Mul = new OpCode("mul", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5A);
+ Div = new OpCode("div", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5B);
+ Div_Un = new OpCode("div.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5C);
+ Rem = new OpCode("rem", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5D);
+ Rem_Un = new OpCode("rem.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5E);
+ And = new OpCode("and", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x5F);
+ Ldloc_0 = new OpCode("ldloc.0", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x6);
+ Ldftn = new OpCode("ldftn", 2, OpCodeType.Primitive, OperandType.InlineMethod, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x6);
+ Or = new OpCode("or", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x60);
+ Xor = new OpCode("xor", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x61);
+ Shl = new OpCode("shl", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x62);
+ Shr = new OpCode("shr", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x63);
+ Shr_Un = new OpCode("shr.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x64);
+ Neg = new OpCode("neg", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x65);
+ Not = new OpCode("not", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x66);
+ Conv_I1 = new OpCode("conv.i1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x67);
+ Conv_I2 = new OpCode("conv.i2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x68);
+ Conv_I4 = new OpCode("conv.i4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x69);
+ Conv_I8 = new OpCode("conv.i8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x6A);
+ Conv_R4 = new OpCode("conv.r4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushr4, FlowControl.Next, 0xFF, 0x6B);
+ Conv_R8 = new OpCode("conv.r8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0x6C);
+ Conv_U4 = new OpCode("conv.u4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x6D);
+ Conv_U8 = new OpCode("conv.u8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x6E);
+ Callvirt = new OpCode("callvirt", 1, OpCodeType.Objmodel, OperandType.InlineMethod, StackBehaviour.Varpop, StackBehaviour.Varpush, FlowControl.Call, 0xFF, 0x6F);
+ Ldloc_1 = new OpCode("ldloc.1", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x7);
+ Ldvirtftn = new OpCode("ldvirtftn", 2, OpCodeType.Primitive, OperandType.InlineMethod, StackBehaviour.Popref, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0x7);
+ Cpobj = new OpCode("cpobj", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x70);
+ Ldobj = new OpCode("ldobj", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popi, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x71);
+ Ldstr = new OpCode("ldstr", 1, OpCodeType.Objmodel, OperandType.InlineString, StackBehaviour.Pop0, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x72);
+ Newobj = new OpCode("newobj", 1, OpCodeType.Objmodel, OperandType.InlineMethod, StackBehaviour.Varpop, StackBehaviour.Pushref, FlowControl.Call, 0xFF, 0x73);
+ Castclass = new OpCode("castclass", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popref, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x74);
+ Isinst = new OpCode("isinst", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popref, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x75);
+ Conv_R_Un = new OpCode("conv.r.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0x76);
+ Unbox = new OpCode("unbox", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Popref, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x79);
+ Throw = new OpCode("throw", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref, StackBehaviour.Push0, FlowControl.Throw, 0xFF, 0x7A);
+ Ldfld = new OpCode("ldfld", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Popref, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x7B);
+ Ldflda = new OpCode("ldflda", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Popref, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x7C);
+ Stfld = new OpCode("stfld", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Popref_pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x7D);
+ Ldsfld = new OpCode("ldsfld", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x7E);
+ Ldsflda = new OpCode("ldsflda", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x7F);
+ Ldloc_2 = new OpCode("ldloc.2", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x8);
+ Stsfld = new OpCode("stsfld", 1, OpCodeType.Objmodel, OperandType.InlineField, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x80);
+ Stobj = new OpCode("stobj", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Popi_pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x81);
+ Conv_Ovf_I1_Un = new OpCode("conv.ovf.i1.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x82);
+ Conv_Ovf_I2_Un = new OpCode("conv.ovf.i2.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x83);
+ Conv_Ovf_I4_Un = new OpCode("conv.ovf.i4.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x84);
+ Conv_Ovf_I8_Un = new OpCode("conv.ovf.i8.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x85);
+ Conv_Ovf_U1_Un = new OpCode("conv.ovf.u1.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x86);
+ Conv_Ovf_U2_Un = new OpCode("conv.ovf.u2.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x87);
+ Conv_Ovf_U4_Un = new OpCode("conv.ovf.u4.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x88);
+ Conv_Ovf_U8_Un = new OpCode("conv.ovf.u8.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x89);
+ Conv_Ovf_I_Un = new OpCode("conv.ovf.i.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x8A);
+ Conv_Ovf_U_Un = new OpCode("conv.ovf.u.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x8B);
+ Boxval = new OpCode("boxval", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Pop1, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x8C);
+ Box = new OpCode("box", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Pop1, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x8C);
+ Newarr = new OpCode("newarr", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popi, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x8D);
+ Ldlen = new OpCode("ldlen", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x8E);
+ Ldelema = new OpCode("ldelema", 1, OpCodeType.Objmodel, OperandType.InlineType, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x8F);
+ Ldloc_3 = new OpCode("ldloc.3", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0x9);
+ Ldarg = new OpCode("ldarg", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFE, 0x9);
+ Ldelem_I1 = new OpCode("ldelem.i1", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x90);
+ Ldelem_U1 = new OpCode("ldelem.u1", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x91);
+ Ldelem_I2 = new OpCode("ldelem.i2", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x92);
+ Ldelem_U2 = new OpCode("ldelem.u2", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x93);
+ Ldelem_I4 = new OpCode("ldelem.i4", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x94);
+ Ldelem_U4 = new OpCode("ldelem.u4", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x95);
+ Ldelem_I8 = new OpCode("ldelem.i8", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0x96);
+ Ldelem_I = new OpCode("ldelem.i", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0x97);
+ Ldelem_R4 = new OpCode("ldelem.r4", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushr4, FlowControl.Next, 0xFF, 0x98);
+ Ldelem_R8 = new OpCode("ldelem.r8", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0x99);
+ Ldelem_Ref = new OpCode("ldelem.ref", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi, StackBehaviour.Pushref, FlowControl.Next, 0xFF, 0x9A);
+ Stelem_I = new OpCode("stelem.i", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x9B);
+ Stelem_I1 = new OpCode("stelem.i1", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x9C);
+ Stelem_I2 = new OpCode("stelem.i2", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x9D);
+ Stelem_I4 = new OpCode("stelem.i4", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x9E);
+ Stelem_I8 = new OpCode("stelem.i8", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popi8, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0x9F);
+ Stloc_0 = new OpCode("stloc.0", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xA);
+ Ldarga = new OpCode("ldarga", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0xA);
+ Stelem_R4 = new OpCode("stelem.r4", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popr4, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xA0);
+ Stelem_R8 = new OpCode("stelem.r8", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popr8, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xA1);
+ Stelem_Ref = new OpCode("stelem.ref", 1, OpCodeType.Objmodel, OperandType.InlineNone, StackBehaviour.Popref_popi_popref, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xA2);
+ Stloc_1 = new OpCode("stloc.1", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xB);
+ Starg = new OpCode("starg", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFE, 0xB);
+ Conv_Ovf_I1 = new OpCode("conv.ovf.i1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB3);
+ Conv_Ovf_U1 = new OpCode("conv.ovf.u1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB4);
+ Conv_Ovf_I2 = new OpCode("conv.ovf.i2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB5);
+ Conv_Ovf_U2 = new OpCode("conv.ovf.u2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB6);
+ Conv_Ovf_I4 = new OpCode("conv.ovf.i4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB7);
+ Conv_Ovf_U4 = new OpCode("conv.ovf.u4", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xB8);
+ Conv_Ovf_I8 = new OpCode("conv.ovf.i8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0xB9);
+ Conv_Ovf_U8 = new OpCode("conv.ovf.u8", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi8, FlowControl.Next, 0xFF, 0xBA);
+ Stloc_2 = new OpCode("stloc.2", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xC);
+ Ldloc = new OpCode("ldloc", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFE, 0xC);
+ Refanyval = new OpCode("refanyval", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xC2);
+ Ckfinite = new OpCode("ckfinite", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushr8, FlowControl.Next, 0xFF, 0xC3);
+ Mkrefany = new OpCode("mkrefany", 1, OpCodeType.Primitive, OperandType.InlineType, StackBehaviour.Popi, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xC6);
+ Stloc_3 = new OpCode("stloc.3", 1, OpCodeType.Macro, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xD);
+ Ldloca = new OpCode("ldloca", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0xD);
+ Ldtoken = new OpCode("ldtoken", 1, OpCodeType.Primitive, OperandType.InlineTok, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD0);
+ Conv_U2 = new OpCode("conv.u2", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD1);
+ Conv_U1 = new OpCode("conv.u1", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD2);
+ Conv_I = new OpCode("conv.i", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD3);
+ Conv_Ovf_I = new OpCode("conv.ovf.i", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD4);
+ Conv_Ovf_U = new OpCode("conv.ovf.u", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xD5);
+ Add_Ovf = new OpCode("add.ovf", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xD6);
+ Add_Ovf_Un = new OpCode("add.ovf.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xD7);
+ Mul_Ovf = new OpCode("mul.ovf", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xD8);
+ Mul_Ovf_Un = new OpCode("mul.ovf.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xD9);
+ Sub_Ovf = new OpCode("sub.ovf", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xDA);
+ Sub_Ovf_Un = new OpCode("sub.ovf.un", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1_pop1, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xDB);
+ Endfinally = new OpCode("endfinally", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Return, 0xFF, 0xDC);
+ Leave = new OpCode("leave", 1, OpCodeType.Primitive, OperandType.InlineBrTarget, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Branch, 0xFF, 0xDD);
+ Leave_S = new OpCode("leave.s", 1, OpCodeType.Primitive, OperandType.ShortInlineBrTarget, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Branch, 0xFF, 0xDE);
+ Stind_I = new OpCode("stind.i", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi_popi, StackBehaviour.Push0, FlowControl.Next, 0xFF, 0xDF);
+ Ldarg_S = new OpCode("ldarg.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop0, StackBehaviour.Push1, FlowControl.Next, 0xFF, 0xE);
+ Stloc = new OpCode("stloc", 2, OpCodeType.Primitive, OperandType.InlineVar, StackBehaviour.Pop1, StackBehaviour.Push0, FlowControl.Next, 0xFE, 0xE);
+ Conv_U = new OpCode("conv.u", 1, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Pop1, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xE0);
+ Ldarga_S = new OpCode("ldarga.s", 1, OpCodeType.Macro, OperandType.ShortInlineVar, StackBehaviour.Pop0, StackBehaviour.Pushi, FlowControl.Next, 0xFF, 0xF);
+ Localloc = new OpCode("localloc", 2, OpCodeType.Primitive, OperandType.InlineNone, StackBehaviour.Popi, StackBehaviour.Pushi, FlowControl.Next, 0xFE, 0xF);
+ Prefix7 = new OpCode("prefix7", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xF8);
+ Prefix6 = new OpCode("prefix6", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xF9);
+ Prefix5 = new OpCode("prefix5", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFA);
+ Prefix4 = new OpCode("prefix4", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFB);
+ Prefix3 = new OpCode("prefix3", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFC);
+ Prefix2 = new OpCode("prefix2", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFD);
+ Prefix1 = new OpCode("prefix1", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFE);
+ Prefixref = new OpCode("prefixref", 1, OpCodeType.Nternal, OperandType.InlineNone, StackBehaviour.Pop0, StackBehaviour.Push0, FlowControl.Meta, 0xFF, 0xFF);
+
+
+ }
+
+ public static bool TakesSingleByteArgument (OpCode inst)
+ {
+ OperandType t = inst.OperandType;
+
+ // check for short-inline instructions
+ return ( t == OperandType.ShortInlineBrTarget
+ || t == OperandType.ShortInlineI
+ || t == OperandType.ShortInlineR
+ || t == OperandType.ShortInlineVar
+ );
+ }
+ }
+
+
+
+
+
+
+} // namespace System.Reflection.Emit
diff --git a/mcs/class/corlib/System.Reflection.Emit/OperandType.cs b/mcs/class/corlib/System.Reflection.Emit/OperandType.cs
new file mode 100644
index 00000000000..669ca53277e
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/OperandType.cs
@@ -0,0 +1,87 @@
+// OperandType.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+ /// <summary>
+ /// Describes the operand types of MSIL instructions.
+ /// </summary>
+ public enum OperandType {
+
+ /// <summary>
+ /// </summary>
+ InlineBrTarget = 0,
+
+ /// <summary>
+ /// </summary>
+ InlineField = 1,
+
+ /// <summary>
+ /// </summary>
+ InlineI = 2,
+
+ /// <summary>
+ /// </summary>
+ InlineI8 = 3,
+
+ /// <summary>
+ /// </summary>
+ InlineMethod = 4,
+
+ /// <summary>
+ /// </summary>
+ InlineNone = 5,
+
+ /// <summary>
+ /// </summary>
+ InlinePhi = 6,
+
+ /// <summary>
+ /// </summary>
+ InlineR = 7,
+
+ /// <summary>
+ /// </summary>
+ InlineSig = 9,
+
+ /// <summary>
+ /// </summary>
+ InlineString = 0x0A,
+
+ /// <summary>
+ /// </summary>
+ InlineSwitch = 0x0B,
+
+ /// <summary>
+ /// </summary>
+ InlineTok = 0x0C,
+
+ /// <summary>
+ /// </summary>
+ InlineType = 0x0D,
+
+ /// <summary>
+ /// </summary>
+ InlineVar = 0x0E,
+
+ /// <summary>
+ /// </summary>
+ ShortInlineBrTarget = 0x0F,
+
+ /// <summary>
+ /// </summary>
+ ShortInlineI = 0x10,
+
+ /// <summary>
+ /// </summary>
+ ShortInlineR = 0x11,
+
+ /// <summary>
+ /// </summary>
+ ShortInlineVar = 0x12
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/PEFileKinds.cs b/mcs/class/corlib/System.Reflection.Emit/PEFileKinds.cs
new file mode 100644
index 00000000000..0677897bc82
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/PEFileKinds.cs
@@ -0,0 +1,8 @@
+namespace System.Reflection.Emit {
+ public enum PEFileKinds {
+ Dll = 1,
+ ConsoleApplication = 2,
+ WindowApplication = 3
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/PackingSize.cs b/mcs/class/corlib/System.Reflection.Emit/PackingSize.cs
new file mode 100644
index 00000000000..82c74276386
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/PackingSize.cs
@@ -0,0 +1,41 @@
+// PackingSize.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+ /// <summary>
+ /// Specifies the packing size (data alignment) of a type.
+ /// </summary>
+ public enum PackingSize {
+
+ /// <summary>
+ /// The packing size is unspecified.
+ /// </summary>
+ Unspecified = 0,
+
+ /// <summary>
+ /// </summary>
+ Size1 = 1,
+
+ /// <summary>
+ /// </summary>
+ Size2 = 2,
+
+ /// <summary>
+ /// </summary>
+ Size4 = 4,
+
+ /// <summary>
+ /// </summary>
+ Size8 = 8,
+
+ /// <summary>
+ /// </summary>
+ Size16 = 16
+ }
+
+}
+
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.cs
new file mode 100755
index 00000000000..84b029aca7b
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ParameterBuilder.cs
@@ -0,0 +1,86 @@
+
+
+//
+// System.Reflection.Emit/ParameterBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection.Emit {
+ public class ParameterBuilder {
+ private MethodBase methodb; /* MethodBuilder or ConstructorBuilder */
+ private string name;
+ private CustomAttributeBuilder[] cattrs;
+ private ParameterAttributes attrs;
+ private int position;
+ private int table_idx;
+
+ internal ParameterBuilder (MethodBase mb, int pos, ParameterAttributes attributes, string strParamName) {
+ name = strParamName;
+ position = pos;
+ attrs = attributes;
+ methodb = mb;
+ table_idx = mb.get_next_table_index (0x08, true);
+ }
+
+ public virtual int Attributes {
+ get {return (int)attrs;}
+ }
+ public bool IsIn {
+ get {return ((int)attrs & (int)ParameterAttributes.In) != 0;}
+ }
+ public bool IsOut {
+ get {return ((int)attrs & (int)ParameterAttributes.Out) != 0;}
+ }
+ public bool IsOptional {
+ get {return ((int)attrs & (int)ParameterAttributes.Optional) != 0;}
+ }
+ public virtual string Name {
+ get {return name;}
+ }
+ public virtual int Position {
+ get {return position;}
+ }
+
+ public virtual ParameterToken GetToken() {
+ return new ParameterToken (0x08 | table_idx);
+ }
+
+ [MonoTODO]
+ public virtual void SetConstant( object defaultValue) {
+ /* FIXME */
+ }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+ public virtual void SetMarshal( UnmanagedMarshal unmanagedMarshal) {
+ }
+
+
+
+
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs b/mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs
new file mode 100644
index 00000000000..21d1895747d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs
@@ -0,0 +1,70 @@
+// ParameterToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Parameter.
+ /// </summary>
+ [Serializable]
+ public struct ParameterToken {
+
+ internal int tokValue;
+
+ public static readonly ParameterToken Empty;
+
+
+ static ParameterToken ()
+ {
+ Empty = new ParameterToken ();
+ }
+
+
+ internal ParameterToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is ParameterToken;
+
+ if (res) {
+ ParameterToken that = (ParameterToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// ParameterToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Parameter.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs
new file mode 100755
index 00000000000..57039b01c2c
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/PropertyBuilder.cs
@@ -0,0 +1,124 @@
+
+//
+// System.Reflection.Emit/PropertyBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection.Emit {
+ public sealed class PropertyBuilder : PropertyInfo {
+ private PropertyAttributes attrs;
+ private string name;
+ private Type type;
+ private Type[] parameters;
+ private CustomAttributeBuilder[] cattrs;
+ private object def_value;
+ private MethodBuilder set_method;
+ private MethodBuilder get_method;
+ private int table_idx = 0;
+ internal TypeBuilder typeb;
+
+ internal PropertyBuilder (TypeBuilder tb, string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes) {
+ this.name = name;
+ this.attrs = attributes;
+ this.type = returnType;
+ if (parameterTypes != null) {
+ this.parameters = new Type [parameterTypes.Length];
+ System.Array.Copy (parameterTypes, this.parameters, this.parameters.Length);
+ }
+ typeb = tb;
+ table_idx = tb.get_next_table_index (0x17, true);
+ }
+
+ public override PropertyAttributes Attributes {
+ get {return attrs;}
+ }
+ public override bool CanRead {
+ get {return get_method != null;}
+ }
+ public override bool CanWrite {
+ get {return set_method != null;}
+ }
+ public override Type DeclaringType {
+ get {return null;}
+ }
+ public override string Name {
+ get {return name;}
+ }
+ public PropertyToken PropertyToken {
+ get {return new PropertyToken ();}
+ }
+ public override Type PropertyType {
+ get {return type;}
+ }
+ public override Type ReflectedType {
+ get {return null;}
+ }
+ public void AddOtherMethod( MethodBuilder mdBuilder) {
+ }
+ public override MethodInfo[] GetAccessors( bool nonPublic) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(bool inherit) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(Type attributeType, bool inherit) {
+ return null;
+ }
+ public override MethodInfo GetGetMethod( bool nonPublic) {
+ return get_method;
+ }
+ public override ParameterInfo[] GetIndexParameters() {
+ return null;
+ }
+ public override MethodInfo GetSetMethod( bool nonPublic) {
+ return set_method;
+ }
+ public override object GetValue(object obj, object[] index) {
+ return null;
+ }
+ public override object GetValue( object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) {
+ return null;
+ }
+ public override bool IsDefined( Type attributeType, bool inherit) {
+ return false;
+ }
+ public void SetConstant( object defaultValue) {
+ def_value = defaultValue;
+ }
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+ public void SetGetMethod( MethodBuilder mdBuilder) {
+ get_method = mdBuilder;
+ }
+ public void SetSetMethod( MethodBuilder mdBuilder) {
+ set_method = mdBuilder;
+ }
+ public override void SetValue( object obj, object value, object[] index) {
+ }
+ public override void SetValue( object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) {
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs b/mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs
new file mode 100644
index 00000000000..38216a23996
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs
@@ -0,0 +1,70 @@
+// PropertyToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Property.
+ /// </summary>
+ [Serializable]
+ public struct PropertyToken {
+
+ internal int tokValue;
+
+ public static readonly PropertyToken Empty;
+
+
+ static PropertyToken ()
+ {
+ Empty = new PropertyToken ();
+ }
+
+
+ internal PropertyToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is PropertyToken;
+
+ if (res) {
+ PropertyToken that = (PropertyToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// PropertyToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Property.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs b/mcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs
new file mode 100755
index 00000000000..40e3b566a22
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/SignatureHelper.cs
@@ -0,0 +1,121 @@
+
+//
+// System.Reflection.Emit/SignatureHelper.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection.Emit {
+ [Serializable]
+ public sealed class SignatureHelper {
+ internal enum SignatureHelperType {
+ HELPER_FIELD,
+ HELPER_LOCAL,
+ HELPER_METHOD,
+ HELPER_PROPERTY
+ }
+
+ private ModuleBuilder module;
+ private Type[] arguments;
+ private SignatureHelperType type;
+
+ internal SignatureHelper (ModuleBuilder module, SignatureHelperType type)
+ {
+ this.type = type;
+ this.module = module;
+ }
+
+ public static SignatureHelper GetFieldSigHelper (Module mod)
+ {
+ if (!(mod is ModuleBuilder))
+ throw new NotImplementedException ();
+
+ return new SignatureHelper ((ModuleBuilder) mod, SignatureHelperType.HELPER_FIELD);
+ }
+ public static SignatureHelper GetLocalVarSigHelper (Module mod)
+ {
+ if (!(mod is ModuleBuilder))
+ throw new NotImplementedException ();
+
+ return new SignatureHelper ((ModuleBuilder) mod, SignatureHelperType.HELPER_LOCAL);
+ }
+ [MonoTODO]
+ public static SignatureHelper GetMethodSigHelper( Module mod, CallingConventions callingConvention, Type returnType)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static SignatureHelper GetMethodSigHelper( Module mod, Type returnType, Type[] parameterTypes)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static SignatureHelper GetPropertySigHelper( Module mod, Type returnType, Type[] parameterTypes)
+ {
+ throw new NotImplementedException ();
+ }
+ public void AddArgument (Type clsArgument)
+ {
+ if (arguments != null) {
+ Type[] new_a = new Type [arguments.Length + 1];
+ System.Array.Copy (arguments, new_a, arguments.Length);
+ new_a [arguments.Length] = clsArgument;
+ arguments = new_a;
+ } else {
+ arguments = new Type [1];
+ arguments [0] = clsArgument;
+ }
+ }
+ [MonoTODO]
+ public void AddSentinel ()
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override bool Equals (object obj)
+ {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern byte[] get_signature_local ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern byte[] get_signature_field ();
+
+ public byte[] GetSignature ()
+ {
+ switch (type) {
+ case SignatureHelperType.HELPER_LOCAL:
+ return get_signature_local ();
+ case SignatureHelperType.HELPER_FIELD:
+ return get_signature_field ();
+ default:
+ throw new NotImplementedException ();
+ }
+ }
+
+ public override string ToString() {
+ return "SignatureHelper";
+ }
+
+
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs b/mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs
new file mode 100644
index 00000000000..b8e7aa67bb5
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs
@@ -0,0 +1,70 @@
+// SignatureToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Signature.
+ /// </summary>
+ [Serializable]
+ public struct SignatureToken {
+
+ internal int tokValue;
+
+ public static readonly SignatureToken Empty;
+
+
+ static SignatureToken ()
+ {
+ Empty = new SignatureToken ();
+ }
+
+
+ internal SignatureToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is SignatureToken;
+
+ if (res) {
+ SignatureToken that = (SignatureToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// SignatureToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Signature.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/StackBehaviour.cs b/mcs/class/corlib/System.Reflection.Emit/StackBehaviour.cs
new file mode 100644
index 00000000000..78cb915e7a6
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/StackBehaviour.cs
@@ -0,0 +1,126 @@
+// StackBehaviour.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+ /// <summary>
+ /// Describes how values are pushed onto or popped off a stack.
+ /// </summary>
+ public enum StackBehaviour {
+
+ /// <summary>
+ /// </summary>
+ Pop0 = 0,
+
+ /// <summary>
+ /// </summary>
+ Pop1 = 1,
+
+ /// <summary>
+ /// </summary>
+ Pop1_pop1 = 2,
+
+ /// <summary>
+ /// </summary>
+ Popi = 3,
+
+ /// <summary>
+ /// </summary>
+ Popi_pop1 = 4,
+
+ /// <summary>
+ /// </summary>
+ Popi_popi = 5,
+
+ /// <summary>
+ /// </summary>
+ Popi_popi8 = 6,
+
+ /// <summary>
+ /// </summary>
+ Popi_popi_popi = 7,
+
+ /// <summary>
+ /// </summary>
+ Popi_popr4 = 8,
+
+ /// <summary>
+ /// </summary>
+ Popi_popr8 = 9,
+
+ /// <summary>
+ /// </summary>
+ Popref = 0x0A,
+
+ /// <summary>
+ /// </summary>
+ Popref_pop1 = 0x0B,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi = 0x0C,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi_popi = 0x0D,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi_popi8 = 0x0E,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi_popr4 = 0x0F,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi_popr8 = 0x10,
+
+ /// <summary>
+ /// </summary>
+ Popref_popi_popref = 0x11,
+
+ /// <summary>
+ /// </summary>
+ Push0 = 0x12,
+
+ /// <summary>
+ /// </summary>
+ Push1 = 0x13,
+
+ /// <summary>
+ /// </summary>
+ Push1_push1 = 0x14,
+
+ /// <summary>
+ /// </summary>
+ Pushi = 0x15,
+
+ /// <summary>
+ /// </summary>
+ Pushi8 = 0x16,
+
+ /// <summary>
+ /// </summary>
+ Pushr4 = 0x17,
+
+ /// <summary>
+ /// </summary>
+ Pushr8 = 0x18,
+
+ /// <summary>
+ /// </summary>
+ Pushref = 0x19,
+
+ /// <summary>
+ /// </summary>
+ Varpop = 0x1A,
+
+ /// <summary>
+ /// </summary>
+ Varpush = 0x1B
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/StringToken.cs b/mcs/class/corlib/System.Reflection.Emit/StringToken.cs
new file mode 100644
index 00000000000..a872b8967bd
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/StringToken.cs
@@ -0,0 +1,70 @@
+// StringToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a String.
+ /// </summary>
+ [Serializable]
+ public struct StringToken {
+
+ internal int tokValue;
+
+ public static readonly StringToken Empty;
+
+
+ static StringToken ()
+ {
+ Empty = new StringToken ();
+ }
+
+
+ internal StringToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is StringToken;
+
+ if (res) {
+ StringToken that = (StringToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// StringToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this String.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
new file mode 100644
index 00000000000..42be5258164
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
@@ -0,0 +1,599 @@
+//
+// System.Reflection.Emit/TypeBuilder.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Globalization;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Reflection.Emit {
+ public sealed class TypeBuilder : Type {
+ private string tname;
+ private string nspace;
+ private Type parent;
+ private Type[] interfaces;
+ private MethodBuilder[] methods;
+ private ConstructorBuilder[] ctors;
+ private PropertyBuilder[] properties;
+ private FieldBuilder[] fields;
+ private EventBuilder[] events;
+ private CustomAttributeBuilder[] cattrs;
+ internal TypeBuilder[] subtypes;
+ private TypeAttributes attrs;
+ private int table_idx;
+ private ModuleBuilder pmodule;
+ private int class_size;
+ private PackingSize packing_size;
+
+ public const int UnspecifiedTypeSize = -1;
+
+ protected override TypeAttributes GetAttributeFlagsImpl () {
+ return attrs;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void setup_internal_class (TypeBuilder tb);
+
+ internal TypeBuilder (ModuleBuilder mb, string name, TypeAttributes attr, Type parent, Type[] interfaces) {
+ int sep_index;
+ this.parent = parent;
+ this.attrs = attr;
+ packing_size = PackingSize.Unspecified;
+ sep_index = name.LastIndexOf('.');
+ if (sep_index != -1) {
+ this.tname = name.Substring (sep_index + 1);
+ this.nspace = name.Substring (0, sep_index);
+ } else {
+ this.tname = name;
+ this.nspace = "";
+ }
+ if (interfaces != null) {
+ this.interfaces = new Type[interfaces.Length];
+ System.Array.Copy (interfaces, this.interfaces, interfaces.Length);
+ }
+ pmodule = mb;
+ // skip .<Module> ?
+ table_idx = mb.get_next_table_index (0x02, true);
+ setup_internal_class (this);
+ }
+
+ public override Assembly Assembly {
+ get {return pmodule.Assembly;}
+ }
+ public override string AssemblyQualifiedName {get {return null;}}
+ public override Type BaseType {
+ get {
+ return parent;
+ }
+ }
+ public override Type DeclaringType {get {return null;}}
+ public override Type UnderlyingSystemType {
+ get {
+ if (fields != null) {
+ foreach (FieldBuilder f in fields) {
+ if ((f.Attributes & FieldAttributes.Static) == 0)
+ return f.FieldType;
+ }
+ }
+ throw new InvalidOperationException ();
+ }
+ }
+
+ public override string FullName {
+ get {
+ if ((nspace != null) && (nspace.Length > 0))
+ return String.Concat (nspace, ".", tname);
+ return tname;
+ }
+ }
+
+ public override Guid GUID {
+ get {return Guid.Empty;}
+ }
+
+ public override Module Module {
+ get {return pmodule;}
+ }
+ public override string Name {
+ get {return tname;}
+ }
+ public override string Namespace {
+ get {return nspace;}
+ }
+ public PackingSize PackingSize {
+ get {return packing_size;}
+ }
+ public override Type ReflectedType {get {return parent;}}
+ public override MemberTypes MemberType {
+ get {return MemberTypes.TypeInfo;}
+ }
+
+ [MonoTODO]
+ public void AddDeclarativeSecurity( SecurityAction action, PermissionSet pset) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void AddInterfaceImplementation( Type interfaceType) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ throw new NotImplementedException ();
+ }
+
+ public override bool IsDefined( Type attributeType, bool inherit) {
+ return false;
+ }
+ public override object[] GetCustomAttributes(bool inherit) {
+ return null;
+ }
+ public override object[] GetCustomAttributes(Type attributeType, bool inherit) {
+ return null;
+ }
+
+ [MonoTODO]
+ public TypeBuilder DefineNestedType (string name) {
+ // FIXME: LAMESPEC: what other attributes should we use here as default?
+ return DefineNestedType (name, TypeAttributes.Public, typeof(object), null);
+ }
+
+ public TypeBuilder DefineNestedType (string name, TypeAttributes attr) {
+ return DefineNestedType (name, attr, typeof(object), null);
+ }
+
+ public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent) {
+ return DefineNestedType (name, attr, parent, null);
+ }
+
+ public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, Type[] interfaces) {
+ TypeBuilder res = new TypeBuilder (pmodule, name, attr, parent, interfaces);
+ if (subtypes != null) {
+ TypeBuilder[] new_types = new TypeBuilder [subtypes.Length + 1];
+ System.Array.Copy (subtypes, new_types, subtypes.Length);
+ new_types [subtypes.Length] = res;
+ subtypes = new_types;
+ } else {
+ subtypes = new TypeBuilder [1];
+ subtypes [0] = res;
+ }
+ return res;
+ }
+
+ public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, int typesize) {
+ return DefineNestedType (name, attr, parent, null);
+ }
+
+ public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, PackingSize packsize) {
+ return DefineNestedType (name, attr, parent, null);
+ }
+
+ public TypeBuilder DefineNestedType (string name, TypeAttributes attr, Type parent, PackingSize packsize, int typesize) {
+ return DefineNestedType (name, attr, parent, null);
+ }
+
+ public ConstructorBuilder DefineConstructor( MethodAttributes attributes, CallingConventions callingConvention, Type[] parameterTypes) {
+ ConstructorBuilder cb = new ConstructorBuilder (this, attributes, callingConvention, parameterTypes);
+ if (ctors != null) {
+ ConstructorBuilder[] new_ctors = new ConstructorBuilder [ctors.Length+1];
+ System.Array.Copy (ctors, new_ctors, ctors.Length);
+ new_ctors [ctors.Length] = cb;
+ ctors = new_ctors;
+ } else {
+ ctors = new ConstructorBuilder [1];
+ ctors [0] = cb;
+ }
+ return cb;
+ }
+
+ public ConstructorBuilder DefineDefaultConstructor( MethodAttributes attributes) {
+ return DefineConstructor (attributes, CallingConventions.Standard, null);
+ }
+
+ public MethodBuilder DefineMethod( string name, MethodAttributes attributes, Type returnType, Type[] parameterTypes) {
+ return DefineMethod (name, attributes, CallingConventions.Standard, returnType, parameterTypes);
+ }
+
+ private void append_method (MethodBuilder mb) {
+ if (methods != null) {
+ MethodBuilder[] new_methods = new MethodBuilder [methods.Length+1];
+ System.Array.Copy (methods, new_methods, methods.Length);
+ new_methods [methods.Length] = mb;
+ methods = new_methods;
+ } else {
+ methods = new MethodBuilder [1];
+ methods [0] = mb;
+ }
+ }
+
+ public MethodBuilder DefineMethod( string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes) {
+ MethodBuilder res = new MethodBuilder (this, name, attributes, callingConvention, returnType, parameterTypes);
+ append_method (res);
+ return res;
+ }
+
+ public MethodBuilder DefinePInvokeMethod (string name, string dllName, string entryName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet) {
+ MethodBuilder res = new MethodBuilder (this, name, attributes, callingConvention, returnType, parameterTypes,
+ dllName, entryName, nativeCallConv, nativeCharSet);
+ append_method (res);
+ return res;
+ }
+
+ public MethodBuilder DefinePInvokeMethod (string name, string dllName, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet) {
+ return DefinePInvokeMethod (name, dllName, name, attributes, callingConvention, returnType, parameterTypes,
+ nativeCallConv, nativeCharSet);
+ }
+
+ public void DefineMethodOverride( MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration) {
+ if (methodInfoBody is MethodBuilder) {
+ MethodBuilder mb = (MethodBuilder)methodInfoBody;
+ mb.set_override (methodInfoDeclaration);
+ }
+ }
+
+ public FieldBuilder DefineField( string fieldName, Type type, FieldAttributes attributes) {
+ FieldBuilder res = new FieldBuilder (this, fieldName, type, attributes);
+ if (fields != null) {
+ FieldBuilder[] new_fields = new FieldBuilder [fields.Length+1];
+ System.Array.Copy (fields, new_fields, fields.Length);
+ new_fields [fields.Length] = res;
+ fields = new_fields;
+ } else {
+ fields = new FieldBuilder [1];
+ fields [0] = res;
+ }
+ return res;
+ }
+
+ public PropertyBuilder DefineProperty( string name, PropertyAttributes attributes, Type returnType, Type[] parameterTypes) {
+ PropertyBuilder res = new PropertyBuilder (this, name, attributes, returnType, parameterTypes);
+
+ if (properties != null) {
+ PropertyBuilder[] new_properties = new PropertyBuilder [properties.Length+1];
+ System.Array.Copy (properties, new_properties, properties.Length);
+ new_properties [properties.Length] = res;
+ properties = new_properties;
+ } else {
+ properties = new PropertyBuilder [1];
+ properties [0] = res;
+ }
+ return res;
+ }
+
+ [MonoTODO]
+ public ConstructorBuilder DefineTypeInitializer() {
+ throw new NotImplementedException ();
+ }
+
+ public Type CreateType() {
+ if (methods != null) {
+ foreach (MethodBuilder method in methods) {
+ method.fixup ();
+ }
+ }
+ if (ctors != null) {
+ foreach (ConstructorBuilder ctor in ctors) {
+ ctor.fixup ();
+ }
+ }
+ return this;
+ }
+
+ public override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr) {
+ if (ctors == null)
+ return new ConstructorInfo [0];
+ ArrayList l = new ArrayList ();
+ bool match;
+ MethodAttributes mattrs;
+
+ foreach (ConstructorBuilder c in ctors) {
+ match = false;
+ mattrs = c.Attributes;
+ if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
+ if ((bindingAttr & BindingFlags.Public) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.NonPublic) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ match = false;
+ if ((mattrs & MethodAttributes.Static) != 0) {
+ if ((bindingAttr & BindingFlags.Static) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.Instance) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ l.Add (c);
+ }
+ ConstructorInfo[] result = new ConstructorInfo [l.Count];
+ l.CopyTo (result);
+ return result;
+ }
+
+ public override Type GetElementType () { return null; }
+
+ [MonoTODO]
+ public override EventInfo GetEvent (string name, BindingFlags bindingAttr) {
+ throw new NotImplementedException ();
+ }
+
+ public override EventInfo[] GetEvents (BindingFlags bindingAttr) {
+ return new EventInfo [0];
+ }
+
+ [MonoTODO]
+ public override FieldInfo GetField( string name, BindingFlags bindingAttr) {
+ //FIXME
+ throw new NotImplementedException ();
+ }
+
+ public override FieldInfo[] GetFields (BindingFlags bindingAttr) {
+ if (fields == null)
+ return new FieldInfo [0];
+ ArrayList l = new ArrayList ();
+ bool match;
+ FieldAttributes mattrs;
+
+ foreach (FieldInfo c in fields) {
+ match = false;
+ mattrs = c.Attributes;
+ if ((mattrs & FieldAttributes.FieldAccessMask) == FieldAttributes.Public) {
+ if ((bindingAttr & BindingFlags.Public) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.NonPublic) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ match = false;
+ if ((mattrs & FieldAttributes.Static) != 0) {
+ if ((bindingAttr & BindingFlags.Static) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.Instance) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ l.Add (c);
+ }
+ FieldInfo[] result = new FieldInfo [l.Count];
+ l.CopyTo (result);
+ return result;
+ }
+
+ [MonoTODO]
+ public override Type GetInterface (string name, bool ignoreCase) {
+ throw new NotImplementedException ();
+ }
+
+ public override Type[] GetInterfaces () {
+ if (interfaces != null) {
+ Type[] ret = new Type [interfaces.Length];
+ interfaces.CopyTo (ret, 0);
+ return ret;
+ } else {
+ return Type.EmptyTypes;
+ }
+ }
+
+ [MonoTODO]
+ public override MemberInfo[] GetMembers( BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ public override MethodInfo[] GetMethods (BindingFlags bindingAttr) {
+ if (methods == null)
+ return new MethodInfo [0];
+ ArrayList l = new ArrayList ();
+ bool match;
+ MethodAttributes mattrs;
+
+ foreach (MethodInfo c in methods) {
+ match = false;
+ mattrs = c.Attributes;
+ if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
+ if ((bindingAttr & BindingFlags.Public) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.NonPublic) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ match = false;
+ if ((mattrs & MethodAttributes.Static) != 0) {
+ if ((bindingAttr & BindingFlags.Static) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.Instance) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ l.Add (c);
+ }
+ MethodInfo[] result = new MethodInfo [l.Count];
+ l.CopyTo (result);
+ return result;
+ }
+
+ [MonoTODO]
+ protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override Type GetNestedType( string name, BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override Type[] GetNestedTypes (BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ public override PropertyInfo[] GetProperties( BindingFlags bindingAttr) {
+ if (properties == null)
+ return new PropertyInfo [0];
+ ArrayList l = new ArrayList ();
+ bool match;
+ MethodAttributes mattrs;
+ MethodInfo accessor;
+
+ foreach (PropertyInfo c in properties) {
+ match = false;
+ accessor = c.GetGetMethod (true);
+ if (accessor == null)
+ accessor = c.GetSetMethod (true);
+ if (accessor == null)
+ continue;
+ mattrs = accessor.Attributes;
+ if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
+ if ((bindingAttr & BindingFlags.Public) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.NonPublic) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ match = false;
+ if ((mattrs & MethodAttributes.Static) != 0) {
+ if ((bindingAttr & BindingFlags.Static) != 0)
+ match = true;
+ } else {
+ if ((bindingAttr & BindingFlags.Instance) != 0)
+ match = true;
+ }
+ if (!match)
+ continue;
+ l.Add (c);
+ }
+ PropertyInfo[] result = new PropertyInfo [l.Count];
+ l.CopyTo (result);
+ return result;
+ }
+
+ [MonoTODO]
+ protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ protected override bool HasElementTypeImpl () {
+ return IsArrayImpl() || IsByRefImpl() || IsPointerImpl ();
+ }
+
+ [MonoTODO]
+ public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ protected override bool IsArrayImpl () {
+ // FIXME
+ return false;
+ }
+ protected override bool IsByRefImpl () {
+ // FIXME
+ return false;
+ }
+ protected override bool IsCOMObjectImpl () {
+ return false;
+ }
+ protected override bool IsPointerImpl () {
+ // FIXME
+ return false;
+ }
+ protected override bool IsPrimitiveImpl () {
+ // FIXME
+ return false;
+ }
+ protected override bool IsValueTypeImpl () {
+ // test this one
+ return type_is_subtype_of (this, typeof (System.ValueType), false);
+ }
+
+ public override RuntimeTypeHandle TypeHandle { get { return _impl; } }
+
+ public void SetCustomAttribute( CustomAttributeBuilder customBuilder) {
+ if (cattrs != null) {
+ CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
+ cattrs.CopyTo (new_array, 0);
+ new_array [cattrs.Length] = customBuilder;
+ cattrs = new_array;
+ } else {
+ cattrs = new CustomAttributeBuilder [1];
+ cattrs [0] = customBuilder;
+ }
+ }
+ public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
+ SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
+ }
+
+ public EventBuilder DefineEvent( string name, EventAttributes attributes, Type eventtype) {
+ EventBuilder res = new EventBuilder (this, name, attributes, eventtype);
+ if (events != null) {
+ EventBuilder[] new_events = new EventBuilder [events.Length+1];
+ System.Array.Copy (events, new_events, events.Length);
+ new_events [events.Length] = res;
+ events = new_events;
+ } else {
+ events = new EventBuilder [1];
+ events [0] = res;
+ }
+ return res;
+ }
+
+ static int InitializedDataCount = 0;
+
+ public FieldBuilder DefineInitializedData( string name, byte[] data, FieldAttributes attributes) {
+ TypeBuilder datablobtype = pmodule.DefineType ("$ArrayType$"+InitializedDataCount.ToString(),
+ TypeAttributes.Public|TypeAttributes.ExplicitLayout|TypeAttributes.Sealed,
+ typeof (System.ValueType), PackingSize.Size1, data.Length);
+ datablobtype.packing_size = PackingSize.Size1;
+ datablobtype.class_size = data.Length;
+ datablobtype.CreateType ();
+ FieldBuilder res = DefineField (name, datablobtype, attributes|FieldAttributes.Assembly|FieldAttributes.Static|FieldAttributes.HasFieldRVA);
+ res.SetRVAData (data);
+ InitializedDataCount++;
+ return res;
+ }
+
+ [MonoTODO]
+ public FieldBuilder DefineUninitializedData( string name, int size, FieldAttributes attributes) {
+ throw new NotImplementedException ();
+ }
+
+ public void SetParent (Type parentType) {
+ parent = parentType;
+ }
+ internal int get_next_table_index (int table, bool inc) {
+ return pmodule.get_next_table_index (table, inc);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeToken.cs b/mcs/class/corlib/System.Reflection.Emit/TypeToken.cs
new file mode 100644
index 00000000000..8fd6ae493b3
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/TypeToken.cs
@@ -0,0 +1,70 @@
+// TypeToken.cs
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+ /// <summary>
+ /// Represents the Token returned by the metadata to represent a Type.
+ /// </summary>
+ [Serializable]
+ public struct TypeToken {
+
+ internal int tokValue;
+
+ public static readonly TypeToken Empty;
+
+
+ static TypeToken ()
+ {
+ Empty = new TypeToken ();
+ }
+
+
+ internal TypeToken (int val)
+ {
+ tokValue = val;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override bool Equals (object obj)
+ {
+ bool res = obj is TypeToken;
+
+ if (res) {
+ TypeToken that = (TypeToken) obj;
+ res = (this.tokValue == that.tokValue);
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// Tests whether the given object is an instance of
+ /// TypeToken and has the same token value.
+ /// </summary>
+ public override int GetHashCode ()
+ {
+ return tokValue;
+ }
+
+
+ /// <summary>
+ /// Returns the metadata token for this Type.
+ /// </summary>
+ public int Token {
+ get {
+ return tokValue;
+ }
+ }
+
+ }
+
+}
+
diff --git a/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs b/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
new file mode 100755
index 00000000000..aa724f2a26d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection.Emit/UnmanagedMarshal.cs
@@ -0,0 +1,51 @@
+
+using System.Reflection.Emit;
+using System.Runtime.InteropServices;
+using System;
+
+namespace System.Reflection.Emit {
+
+ [Serializable]
+ public sealed class UnmanagedMarshal {
+ private int count;
+ private UnmanagedType t;
+
+ public UnmanagedType BaseType {
+ get {return t;}
+ }
+
+ public int ElementCount {
+ get {return count;}
+ }
+
+ public UnmanagedType GetUnmanagedType {
+ get {return t;}
+ }
+
+ public Guid IIDGuid {
+ get {return Guid.Empty;}
+ }
+
+ [MonoTODO]
+ public static UnmanagedMarshal DefineByValArray( int elemCount) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static UnmanagedMarshal DefineByValTStr( int elemCount) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static UnmanagedMarshal DefineLPArray( UnmanagedType elemType) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static UnmanagedMarshal DefineSafeArray( UnmanagedType elemType) {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ public static UnmanagedMarshal DefineUnmanagedMarshal( UnmanagedType unmanagedType) {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AmbiguousMatchException.cs b/mcs/class/corlib/System.Reflection/AmbiguousMatchException.cs
new file mode 100755
index 00000000000..3bfc25fccd2
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AmbiguousMatchException.cs
@@ -0,0 +1,32 @@
+//
+// System.Reflection.AmbiguousMatchException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public sealed class AmbiguousMatchException : SystemException {
+ // Constructors
+ public AmbiguousMatchException ()
+ : base ("Ambiguous matching in method resolution")
+ {
+ }
+
+ public AmbiguousMatchException (string message)
+ : base (message)
+ {
+ }
+
+ public AmbiguousMatchException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/Assembly.cs b/mcs/class/corlib/System.Reflection/Assembly.cs
new file mode 100644
index 00000000000..4835c68f01d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/Assembly.cs
@@ -0,0 +1,279 @@
+//
+// System.Reflection/Assembly.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Policy;
+using System.Runtime.Serialization;
+using System.Reflection.Emit;
+using System.IO;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public class Assembly : System.Reflection.ICustomAttributeProvider,
+ System.Security.IEvidenceFactory, System.Runtime.Serialization.ISerializable {
+ private IntPtr _mono_assembly;
+
+ internal Assembly () {}
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern string get_code_base ();
+
+ public virtual string CodeBase {
+ get {
+ return get_code_base ();
+ }
+ }
+
+ public virtual string CopiedCodeBase {
+ get {
+ return null;
+ }
+ }
+
+ public virtual string FullName {
+ get {
+ //
+ // FIXME: This is wrong, but it gets us going
+ // in the compiler for now
+ //
+ return CodeBase;
+ }
+ }
+
+ public virtual MethodInfo EntryPoint {
+ get {
+ return null;
+ }
+ }
+
+ public virtual Evidence Evidence {
+ get {
+ return null;
+ }
+ }
+
+ public virtual String Location {
+ get {
+ return null;
+ }
+ }
+
+ public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ }
+
+ public virtual bool IsDefined (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public virtual object [] GetCustomAttributes (bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+
+ public virtual object [] GetCustomAttributes (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public virtual FileStream[] GetFiles ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual FileStream GetFile (String name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual Stream GetManifestResourceStream (String name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual Stream GetManifestResourceStream (Type type, String name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern Type[] GetTypes (bool exportedOnly);
+
+ public virtual Type[] GetTypes ()
+ {
+ return GetTypes (false);
+ }
+
+ public virtual Type[] GetExportedTypes ()
+ {
+ return GetTypes (true);
+ }
+
+ public virtual Type GetType (String name, Boolean throwOnError)
+ {
+ return GetType (name, throwOnError, false);
+ }
+
+ public virtual Type GetType (String name) {
+ return GetType (name, false, false);
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern Type GetType (String name, Boolean throwOnError, Boolean ignoreCase);
+
+ public virtual AssemblyName GetName (Boolean copiedName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual AssemblyName GetName ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override String ToString ()
+ {
+ return GetName ().Name;
+ }
+
+ [MonoTODO]
+ public static String CreateQualifiedName (String assemblyName, String typeName)
+ {
+ return "FIXME: assembly";
+ }
+
+ [MonoTODO]
+ public static String nCreateQualifiedName (String assemblyName, String typeName)
+ {
+ return "FIXME: assembly";
+ }
+
+ [MonoTODO]
+ public static Assembly GetAssembly (Type type)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Assembly GetSatelliteAssembly (CultureInfo culture)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static Assembly LoadFrom (String assemblyFile)
+ {
+ return AppDomain.CurrentDomain.Load (assemblyFile);
+ }
+
+ public static Assembly Load (String assemblyString)
+ {
+ return AppDomain.CurrentDomain.Load (assemblyString);
+ }
+
+ public static Assembly Load (String assemblyString, Evidence assemblySecurity)
+ {
+ return AppDomain.CurrentDomain.Load (assemblyString, assemblySecurity);
+ }
+
+ public static Assembly Load (AssemblyName assemblyRef)
+ {
+ return AppDomain.CurrentDomain.Load (assemblyRef);
+ }
+
+ public static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
+ {
+ return AppDomain.CurrentDomain.Load (assemblyRef, assemblySecurity);
+ }
+
+ public static Assembly Load (Byte[] rawAssembly)
+ {
+ return AppDomain.CurrentDomain.Load (rawAssembly);
+ }
+
+ public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore)
+ {
+ return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
+ }
+
+ public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore,
+ Evidence securityEvidence)
+ {
+ return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
+ }
+
+ public static Assembly LoadWithPartialName (string partialName)
+ {
+ return LoadWithPartialName (partialName, null);
+ }
+
+ [MonoTODO]
+ public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
+ {
+ return AppDomain.CurrentDomain.Load (partialName, securityEvidence);
+ }
+
+
+ public Object CreateInstance (String typeName)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Object CreateInstance (String typeName, Boolean ignoreCase)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Object CreateInstance (String typeName, Boolean ignoreCase,
+ BindingFlags bindingAttr, Binder binder,
+ Object[] args, CultureInfo culture,
+ Object[] activationAttributes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Module[] GetLoadedModules ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Module[] GetModules ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public Module GetModule (String name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual String[] GetManifestResourceNames ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static Assembly GetExecutingAssembly ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public AssemblyName[] GetReferencedAssemblies ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public virtual ManifestResourceInfo GetManifestResourceInfo (String resourceName)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyAlgorithmIdAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyAlgorithmIdAttribute.cs
new file mode 100644
index 00000000000..39bd0c369a4
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyAlgorithmIdAttribute.cs
@@ -0,0 +1,39 @@
+//
+// System.Reflection.AssemblyAlgorithmIdAttribute.cs
+//
+// Author: Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Configuration.Assemblies;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyAlgorithmIdAttribute : Attribute
+ {
+ // Field
+ private uint id;
+
+ // Constructor
+ public AssemblyAlgorithmIdAttribute (AssemblyHashAlgorithm algorithmId)
+ {
+ id = (uint) algorithmId;
+ }
+
+ [CLSCompliant (false)]
+ public AssemblyAlgorithmIdAttribute (uint algorithmId)
+ {
+ id = algorithmId;
+ }
+
+ // Property
+ [CLSCompliant (false)]
+ public uint AlgorithmId
+ {
+ get { return id; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyCompanyAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyCompanyAttribute.cs
new file mode 100644
index 00000000000..b6dc24687a9
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyCompanyAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyCompanyAttribute.cs
+//
+// Author: Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyCompanyAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyCompanyAttribute (string company)
+ {
+ name = company;
+ }
+
+ // Properties
+ public string Company
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyConfigurationAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyConfigurationAttribute.cs
new file mode 100644
index 00000000000..8e48b485d2d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyConfigurationAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyConfigurationAttribute.cs
+//
+// Author: Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyConfigurationAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyConfigurationAttribute (string configuration)
+ {
+ name = configuration;
+ }
+
+ // Properties
+ public string Configuration
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyCopyrightAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyCopyrightAttribute.cs
new file mode 100644
index 00000000000..264a905f0ef
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyCopyrightAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyCopyrightAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyCopyrightAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyCopyrightAttribute (string copyright)
+ {
+ name = copyright;
+ }
+
+ // Properties
+ public string Copyright
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyCultureAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyCultureAttribute.cs
new file mode 100644
index 00000000000..16ce1f96cc4
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyCultureAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyCultureAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyCultureAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyCultureAttribute (string culture)
+ {
+ name = culture;
+ }
+
+ // Properties
+ public string Culture
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyDefaultAliasAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyDefaultAliasAttribute.cs
new file mode 100644
index 00000000000..f91c9314917
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyDefaultAliasAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyDefaultAliasAttribute.cs
+//
+// Author: Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyDefaultAliasAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyDefaultAliasAttribute (string defaultAlias)
+ {
+ name = defaultAlias;
+ }
+
+ // Properties
+ public string DefaultAlias
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyDelaySignAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyDelaySignAttribute.cs
new file mode 100644
index 00000000000..cec22e69659
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyDelaySignAttribute.cs
@@ -0,0 +1,32 @@
+//
+// System.Reflection.AssemblyDelaySignAttribute.cs
+//
+// Author: Duncan Mak <duncan@ximian.com>
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyDelaySignAttribute : Attribute
+ {
+ // Field
+ private bool delay;
+
+ // Constructor
+ public AssemblyDelaySignAttribute (bool delaySign)
+ {
+ delay = delaySign;
+ }
+
+ // Property
+ public bool DelaySign
+ {
+ get { return delay; }
+ }
+ }
+}
+
+
diff --git a/mcs/class/corlib/System.Reflection/AssemblyDescriptionAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyDescriptionAttribute.cs
new file mode 100644
index 00000000000..00beee47ec4
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyDescriptionAttribute.cs
@@ -0,0 +1,30 @@
+//
+// System.Reflection.AssemblyDescriptionAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyDescriptionAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyDescriptionAttribute (string description)
+ {
+ name = description;
+ }
+
+ // Property
+ public string Description
+ {
+ get { return name; }
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyFileVersionAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyFileVersionAttribute.cs
new file mode 100644
index 00000000000..c94407ff708
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyFileVersionAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyFileVersionAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyFileVersionAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyFileVersionAttribute (string version)
+ {
+ name = version;
+ }
+
+ // Property
+ public string Version
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyFlagsAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyFlagsAttribute.cs
new file mode 100644
index 00000000000..7a9589dde9f
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyFlagsAttribute.cs
@@ -0,0 +1,31 @@
+//
+// System.Reflection.AssemblyFlagsAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyFlagsAttribute : Attribute
+ {
+ // Field
+ private uint flags;
+
+ // Constructor
+ [CLSCompliant (false)]
+ public AssemblyFlagsAttribute (uint flags)
+ {
+ this.flags = flags;
+ }
+
+ // Property
+ [CLSCompliant (false)]
+ public uint Flags
+ {
+ get { return flags; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyInformationalVersionAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyInformationalVersionAttribute.cs
new file mode 100644
index 00000000000..e3a5742f539
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyInformationalVersionAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyInformationalVersionAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyInformationalVersionAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyInformationalVersionAttribute (string informationalVersion)
+ {
+ name = informationalVersion;
+ }
+
+ // Property
+ public string InformationalVersion
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyKeyFileAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyKeyFileAttribute.cs
new file mode 100644
index 00000000000..0e92688493e
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyKeyFileAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyKeyFileAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyKeyFileAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyKeyFileAttribute (string keyFile)
+ {
+ name = keyFile;
+ }
+
+ // Property
+ public string KeyFile
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyKeyNameAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyKeyNameAttribute.cs
new file mode 100644
index 00000000000..3323b14ed79
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyKeyNameAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyKeyNameAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyKeyNameAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyKeyNameAttribute (string keyName)
+ {
+ name = keyName;
+ }
+
+ // Property
+ public string KeyName
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyName.cs b/mcs/class/corlib/System.Reflection/AssemblyName.cs
new file mode 100755
index 00000000000..9387e1c157b
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyName.cs
@@ -0,0 +1,90 @@
+
+//
+// System.Reflection/AssemblyName.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public sealed class AssemblyName : ISerializable // ICloneable, , IDeserializationCallback
+ {
+ string name;
+ string codebase;
+ Version version;
+
+ public AssemblyName ()
+ {
+ name = null;
+ }
+
+ internal AssemblyName (SerializationInfo si, StreamingContext sc)
+ {
+ name = si.GetString ("_Name");
+ codebase = si.GetString ("_CodeBase");
+ version = (Version)si.GetValue ("_Version", typeof (Version));
+ }
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value;
+ }
+ }
+
+ public string CodeBase {
+ get {
+ return codebase;
+ }
+
+ set {
+ codebase = value;
+ }
+ }
+
+ public Version Version {
+ get {
+ return version;
+ }
+
+ set {
+ version = value;
+ }
+ }
+
+ public override int GetHashCode ()
+ {
+ return name.GetHashCode ();
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Reflection.AssemblyName))
+ return false;
+
+ AssemblyName an = (AssemblyName)o;
+
+ if (an.name == this.name)
+ return true;
+
+ return false;
+ }
+
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("_Name", name);
+ info.AddValue ("_CodeBase", codebase);
+ info.AddValue ("_Version", version);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyNameFlags.cs b/mcs/class/corlib/System.Reflection/AssemblyNameFlags.cs
new file mode 100755
index 00000000000..daa3cd97148
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyNameFlags.cs
@@ -0,0 +1,33 @@
+// AssemblyNameFlags.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:33 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ [Serializable]
+ public enum AssemblyNameFlags {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// Not sure about the ECMA spec, but this is what is in mscorlib...
+ /// Perhaps this has changed since the beta.
+ /// </summary>
+ PublicKey = 1,
+ } // AssemblyNameFlags
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/AssemblyNameProxy.cs b/mcs/class/corlib/System.Reflection/AssemblyNameProxy.cs
new file mode 100644
index 00000000000..cc02533a741
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyNameProxy.cs
@@ -0,0 +1,27 @@
+//
+// System.Reflection.AssemblyNameProxy.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection
+{
+ public class AssemblyNameProxy : MarshalByRefObject
+ {
+ // Constructor
+ public AssemblyNameProxy ()
+ {
+ }
+
+ // Method
+ [MonoTODO]
+ public AssemblyName GetAssemblyName (string assemblyFile)
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyProductAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyProductAttribute.cs
new file mode 100644
index 00000000000..67c85f9421b
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyProductAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyProductAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyProductAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyProductAttribute (string product)
+ {
+ name = product;
+ }
+
+ // Property
+ public string Product
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyTitleAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyTitleAttribute.cs
new file mode 100644
index 00000000000..f3ac196a789
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyTitleAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyTitleAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyTitleAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyTitleAttribute (string title)
+ {
+ name = title;
+ }
+
+ // Property
+ public string Title
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyTradeMarkAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyTradeMarkAttribute.cs
new file mode 100644
index 00000000000..7c2bcc8e712
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyTradeMarkAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyTrademarkAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyTrademarkAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyTrademarkAttribute (string trademark)
+ {
+ name = trademark;
+ }
+
+ // Property
+ public string Trademark
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/AssemblyVersionAttribute.cs b/mcs/class/corlib/System.Reflection/AssemblyVersionAttribute.cs
new file mode 100644
index 00000000000..d5f46894698
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/AssemblyVersionAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.AssemblyVersionAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class AssemblyVersionAttribute : Attribute
+ {
+ // Field
+ private string name;
+
+ // Constructor
+ public AssemblyVersionAttribute (string version)
+ {
+ name = version;
+ }
+
+ // Property
+ public string Version
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/Binder.cs b/mcs/class/corlib/System.Reflection/Binder.cs
new file mode 100644
index 00000000000..876556102e5
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/Binder.cs
@@ -0,0 +1,13 @@
+// System.Reflection.Binder
+//
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) Ximian, Inc. 2001
+
+namespace System.Reflection
+{
+ [Serializable]
+ public abstract class Binder
+ {
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/BindingFlags.cs b/mcs/class/corlib/System.Reflection/BindingFlags.cs
new file mode 100644
index 00000000000..6d02cfeb196
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/BindingFlags.cs
@@ -0,0 +1,92 @@
+// BindingFlags.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:54 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum BindingFlags {
+
+ Default = 0,
+
+ /// <summary>
+ /// </summary>
+ IgnoreCase = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ DeclaredOnly = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ Instance = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ Static = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ Public = 0x00000010,
+
+ /// <summary>
+ /// </summary>
+ NonPublic = 0x00000020,
+
+ FlattenHierarchy = 0x00000040,
+
+ /// <summary>
+ /// </summary>
+ InvokeMethod = 0x00000100,
+
+ /// <summary>
+ /// </summary>
+ CreateInstance = 0x00000200,
+
+ /// <summary>
+ /// </summary>
+ GetField = 0x00000400,
+
+ /// <summary>
+ /// </summary>
+ SetField = 0x00000800,
+
+ /// <summary>
+ /// </summary>
+ GetProperty = 0x00001000,
+
+ /// <summary>
+ /// </summary>
+ SetProperty = 0x00002000,
+
+ PutDispProperty = 0x00004000,
+
+ PutRefDispProperty = 0x00008000,
+
+ /// <summary>
+ /// </summary>
+ ExactBinding = 0x00010000,
+
+ /// <summary>
+ /// </summary>
+ SuppressChangeType = 0x00020000,
+
+ /// <summary>
+ /// </summary>
+ OptionalParamBinding = 0x00040000,
+
+ IgnoreReturn = 0x01000000
+ } // BindingFlags
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/CallingConventions.cs b/mcs/class/corlib/System.Reflection/CallingConventions.cs
new file mode 100755
index 00000000000..c42c2471c9d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/CallingConventions.cs
@@ -0,0 +1,42 @@
+// CallingConventions.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:43 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum CallingConventions {
+
+ /// <summary>
+ /// </summary>
+ Standard = 1,
+
+ /// <summary>
+ /// </summary>
+ VarArgs = 2,
+
+ /// <summary>
+ /// </summary>
+ Any = 3,
+
+ /// <summary>
+ /// </summary>
+ HasThis = 32,
+
+ /// <summary>
+ /// </summary>
+ ExplicitThis = 64,
+ } // CallingConventions
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/ChangeLog b/mcs/class/corlib/System.Reflection/ChangeLog
new file mode 100644
index 00000000000..914cd679b7b
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ChangeLog
@@ -0,0 +1,240 @@
+2002-04-24 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * MonoProperty.cs (GetValue) : basic implementation to support nunit
+ * PropertyInfo.cs (GetValue) : call MonoProperty::GetValue instead of returning null
+
+Thu Apr 18 16:40:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoMethod.c: cache the method name.
+
+2002-04-12 Duncan Mak <duncan@ximian.com>
+
+ * AssemblyAlgorithmIdAttribute.cs: Fixed typo in AlgorithmId
+ property.
+
+ * AssemblyDelaySignAttribute.cs: Fixed type in DelaySign
+ attribute.
+
+ * AssemblyFileVersionAttribute.cs: Renamed FileVersion property to
+ Version.
+
+ * BindingFlags.cs: Added missing value "PutRefDispProperty".
+
+ * FieldAttributes.cs: Removed value "HasSecurity".
+
+ * ManifestResourceInfo.cs: Added missing properties FileName,
+ ReferencedAssembly and ResourceLocation.
+
+ * TargetInvocationException.cs: Added the missing constructors.
+
+Fri Apr 12 18:32:34 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoMethod.cs: make Name property an icall.
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * DefaultMemberAttribute.cs: Add AttributeUsage attribute for class,
+ struct and interface.
+
+Fri Apr 5 15:40:24 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoEvent.cs: remove unused code.
+ * MonoProperty: implement ToString().
+
+Wed Apr 3 17:59:26 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: implement GetTypes() and GetExportedTypes().
+
+Mon Mar 25 18:54:58 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoEvent.cs: added the needed fields.
+
+2002-03-20 Martin Baulig <martin@gnome.org>
+
+ * ConstructorInfo.cs (Invoke): Implemented, call the abstract Invoke.
+
+ * MonoMethod.cs (MonoCMethod.Invoke): Implemented, call InternalInvoke.
+
+2002-03-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * MonoMethod.cs (Invoke): call InternalInvoke
+
+ * MethodBase.cs (Invoke): call virtual invoke function
+
+Thu Mar 7 17:14:20 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * EventInfo.cs: add compiler needed methods.
+ * MonoMethod.cs: make ToString() return the return type name, too.
+
+2002-03-07 Nick Drochak <ndrochak@gol.com>
+
+ * BindingFlags.cs: Add missing enum values. Thanks CorCompare.
+
+Tue Mar 5 20:33:14 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeAttributes.cs, MethodImplAttributes.cs: updates to latest spec.
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * StrongNameKeyPair.cs: Committed for Kevin Winchester (kwin@ns.sympatico.ca>.
+
+2002-02-24 Nick Drochak <ndrochak@gol.com>
+
+ * AssemblyNameFlags.cs: Use proper member name. Thanks corcompare!
+
+Fri Feb 22 18:54:13 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoField.cs: implement GetValue as an internalcall.
+ Implemented ToString().
+
+Tue Feb 19 20:36:04 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs, Module.cs, MonoField.cs, MonoMethod.cs,
+ MonoProperty.cs, ParameterInfo.cs: Implemented custom attributes
+ related methods.
+
+Thu Feb 14 18:55:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * TypeAttributes.cs: update to latest spec.
+
+Mon Feb 11 19:50:27 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: handle throwOnError in GetType() call.
+
+2002-02-07 Duncan Mak <duncan@ximian.com>
+
+ * AssemblyName.cs: Implemented ISerializable interface for the
+ fields that we have.
+
+2002-02-05 Duncan Mak <duncan@ximian.com>
+
+ * Missing.cs:
+ * TargetException.cs: Added in CVS.
+
+2002-01-31 Duncan Mak <duncan@ximian.com>
+
+ * ReflectionTypeLoadException.cs: Added missing bits.
+
+2002-01-23 Duncan Mak <duncan@ximian.com>
+
+ * AssemblyAlgorithmIdAttribute.cs:
+ * AssemblyCompanyAttribute.cs:
+ * AssemblyConfigurationAttribute.cs:
+ * AssemblyCopyrightAttribute.cs:
+ * AssemblyCultureAttribute.cs:
+ * AssemblyDefaultAliasAttribute.cs:
+ * AssemblyDelaySignAttribute.cs:
+ * AssemblyDescriptionAttribute.cs:
+ * AssemblyFileVersionAttribute.cs:
+ * AssemblyFlagsAttribute.cs:
+ * AssemblyInformationalVersionAttribute.cs:
+ * AssemblyKeyFileAttribute.cs:
+ * AssemblyKeyNameAttribute.cs:
+ * AssemblyNameProxy.cs:
+ * AssemblyProductAttribute.cs:
+ * AssemblyTitleAttribute.cs:
+ * AssemblyTradeMarkAttribute.cs:
+ * AssemblyVersionAttribute.cs:
+ * CustomAttributeFormatException.cs:
+ * InvalidFilterCriteriaException.cs:
+ * TargetParameterCountException.cs: Added.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * Assembly.cs (Assembly.CodeBase): Implement.
+ (Assembly.FullName): simplistic and broken implementation. Gets
+ us where we were yesterday.
+
+ Code style fix.
+
+Tue Jan 22 22:54:18 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * IReflect.cs: corrected GetMember() return type.
+ * InterfaceMapping.cs, TypeDelegator.cs: implemented.
+
+Wed Jan 9 19:37:14 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoMethod.cs: ToString () implementation.
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * Assembly.cs : Decorate missing bits with the MonoTODO
+ attribute.
+
+ * ConstructorInfo.cs, MonoMethod.cs, MonoProperty.cs, ParameterInfo.cs,
+ ReflectionTypeLoadException.cs : Ditto.
+
+ * FieldInfo.cs : Ditto.
+
+Thu Jan 3 23:25:34 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: trow unimplemented exceptions.
+
+Tue Dec 18 18:46:22 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * MonoMethod.cs: implemented GetParameters().
+ * MonoProperty.cs: PropertyInfo implementation.
+ * ParameterInfo.cs: implemented.
+ * PropertyInfo.cs: fixes.
+
+Thu Dec 13 20:18:05 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * FieldInfo.cs: implemented some Is* propeties.
+ * MethodBase.cs: fixed attribute accessors.
+ * MonoField.cs: runtime object to represent a field.
+ * MonoMethod.cs: runtime object to represent a method.
+ * AssemblyBuilder.cs: GetToken() methods to get tokens for
+ strings, fields, methods...
+ * ILGenerator.cs: handle tokens for methods.
+
+Mon Nov 19 13:56:55 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * MethodBase.cs: add internal get_next_table_index() for use in
+ Reflection.Emit.
+
+Wed Nov 14 16:53:28 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: implement some of the Load() methods.
+ * ConstructorInfo.cs: some missing stubs and fields.
+ * FieldInfo.cs: IsInitOnly property.
+ * ParameterInfo.cs: stubs for missing properties.
+ * ParameterModifier.cs: implemented class.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * Assembly.cs: Filled in some stub implementations
+
+ * ConstructorInfo.cs: Added some stub functions for NUnit
+
+Fri Nov 2 18:29:36 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AmbiguousMatchException.cs,
+ * Assembly.cs, Module.cs: updates.
+ * FieldInfo.cs: better compliance to the spec.
+ * MethodBase.cs: move call_conv out of the way.
+ * AssemblyBuilder.cs: don't use internalcalls, more stuff supported.
+ * FieldBuilder.cs: implemented.
+ * ILGenerator.cs: implemented some opcode handling.
+ * Label.cs: add constructor.
+ * LocalBuilder.cs: implemented.
+ * MethodBuilder.cs: don't use internalcalls, more implemented stuff.
+ * ModuleBuilder.cs: don't use internalcalls, more meat here, too.
+ * ParameterBuilder.cs: implemented.
+ * PropertyBuilder.cs: implemented.
+ * TypeBuilder.cs: don't use internalcalls, more stuff working.
+
+Tue Sep 25 16:48:50 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * ConstructorInfo.cs, MemberFilter.cs, Module.cs: added.
+
+Fri Sep 14 16:12:08 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * MethodBase.cs, MethodInfo.cs: added.
+
+Thu Sep 13 18:05:16 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Assembly.cs: added stub code.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * BindingFlags.cs: Add.
diff --git a/mcs/class/corlib/System.Reflection/ConstructorInfo.cs b/mcs/class/corlib/System.Reflection/ConstructorInfo.cs
new file mode 100644
index 00000000000..936f50ef8df
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ConstructorInfo.cs
@@ -0,0 +1,39 @@
+//
+// System.Reflection/ConstructorInfo.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+
+namespace System.Reflection {
+ [Serializable]
+ public abstract class ConstructorInfo : MethodBase {
+ public static readonly string ConstructorName = ".ctor";
+ public static readonly string TypeConstructorName = ".cctor";
+
+ protected ConstructorInfo() {
+ }
+
+ public override MemberTypes MemberType {
+ get {return MemberTypes.Constructor;}
+ }
+
+ public object Invoke (object[] parameters)
+ {
+ if (parameters == null)
+ parameters = new object [0];
+
+ return Invoke (BindingFlags.CreateInstance, null, parameters, null);
+ }
+
+ public abstract object Invoke (BindingFlags invokeAttr, Binder binder, object[] parameters,
+ CultureInfo culture);
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs b/mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs
new file mode 100644
index 00000000000..0e1c5c3692e
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/CustomAttributeFormatException.cs
@@ -0,0 +1,38 @@
+//
+// System.Reflection.CustomAttributeFormatException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class CustomAttributeFormatException : FormatException
+ {
+ // Constructors
+ public CustomAttributeFormatException ()
+ : base (Locale.GetText ("The Binary format of the custom attribute is invalid."))
+ {
+ }
+ public CustomAttributeFormatException (string message)
+ : base (message)
+ {
+ }
+
+ public CustomAttributeFormatException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected CustomAttributeFormatException (SerializationInfo info,
+ StreamingContext context)
+ {
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection/DefaultMemberAttribute.cs b/mcs/class/corlib/System.Reflection/DefaultMemberAttribute.cs
new file mode 100644
index 00000000000..855cff8ed7d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/DefaultMemberAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Reflection.DefaultMemberAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection {
+
+ [Serializable]
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Interface)]
+ public sealed class DefaultMemberAttribute : Attribute {
+ string member_name;
+
+ public DefaultMemberAttribute (string member_name)
+ {
+ this.member_name = member_name;
+ }
+
+ public string MemberName {
+ get {
+ return member_name;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/EventAttributes.cs b/mcs/class/corlib/System.Reflection/EventAttributes.cs
new file mode 100755
index 00000000000..efb1154e21c
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/EventAttributes.cs
@@ -0,0 +1,37 @@
+// EventAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:03 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ public enum EventAttributes {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ SpecialName = 512,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = 1024,
+
+ /// <summary>
+ /// </summary>
+ RTSpecialName = 1024,
+ } // EventAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/EventInfo.cs b/mcs/class/corlib/System.Reflection/EventInfo.cs
new file mode 100755
index 00000000000..f5e38cf3aee
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/EventInfo.cs
@@ -0,0 +1,73 @@
+//
+// System.Reflection/EventInfo.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+
+namespace System.Reflection {
+ public abstract class EventInfo : MemberInfo {
+
+ public abstract EventAttributes Attributes {get;}
+
+ public Type EventHandlerType {get {return null;}}
+ public bool IsMulticast {get {return true;}}
+ public bool IsSpecialName {get {return false;}}
+ public override MemberTypes MemberType {
+ get {return MemberTypes.Event;}
+ }
+
+ protected EventInfo() {
+ }
+
+ public void AddEventHandler( object target, Delegate handler) {
+ }
+ public MethodInfo GetAddMethod() {
+ return null;
+ }
+ public abstract MethodInfo GetAddMethod(bool nonPublic);
+ public MethodInfo GetRaiseMethod() {
+ return null;
+ }
+ public abstract MethodInfo GetRaiseMethod( bool nonPublic);
+ public MethodInfo GetRemoveMethod() {
+ return null;
+ }
+ public abstract MethodInfo GetRemoveMethod( bool nonPublic);
+ public void RemoveEventHandler( object target, Delegate handler) {
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes( bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+ public override Type ReflectedType {
+ get {
+ return null;
+ }
+ }
+ public override Type DeclaringType {
+ get {
+ return null;
+ }
+ }
+
+ public override String Name {
+ get {
+ return "Eventname";
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/FieldAttributes.cs b/mcs/class/corlib/System.Reflection/FieldAttributes.cs
new file mode 100755
index 00000000000..3424310ca9b
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/FieldAttributes.cs
@@ -0,0 +1,101 @@
+// FieldAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:12 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ public enum FieldAttributes {
+
+ /// <summary>
+ /// </summary>
+ FieldAccessMask = 7,
+
+ /// <summary>
+ /// </summary>
+ PrivateScope = 0,
+
+ /// <summary>
+ /// </summary>
+ Private = 1,
+
+ /// <summary>
+ /// </summary>
+ FamANDAssem = 2,
+
+ /// <summary>
+ /// </summary>
+ Assembly = 3,
+
+ /// <summary>
+ /// </summary>
+ Family = 4,
+
+ /// <summary>
+ /// </summary>
+ FamORAssem = 5,
+
+ /// <summary>
+ /// </summary>
+ Public = 6,
+
+ /// <summary>
+ /// </summary>
+ Static = 16,
+
+ /// <summary>
+ /// </summary>
+ InitOnly = 32,
+
+ /// <summary>
+ /// </summary>
+ Literal = 64,
+
+ /// <summary>
+ /// </summary>
+ NotSerialized = 128,
+
+ /// <summary>
+ /// </summary>
+ SpecialName = 512,
+
+ /// <summary>
+ /// </summary>
+ PinvokeImpl = 8192,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = 54528,
+
+ /// <summary>
+ /// </summary>
+ RTSpecialName = 1024,
+
+ /// <summary>
+ /// </summary>
+ HasFieldMarshal = 4096,
+
+ /// <summary>
+ /// </summary>
+ // HasSecurity = 16384,
+
+ /// <summary>
+ /// </summary>
+ HasDefault = 32768,
+
+ /// <summary>
+ /// </summary>
+ HasFieldRVA = 256,
+ } // FieldAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/FieldInfo.cs b/mcs/class/corlib/System.Reflection/FieldInfo.cs
new file mode 100755
index 00000000000..16dfd9c3941
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/FieldInfo.cs
@@ -0,0 +1,117 @@
+//
+// System.Reflection.FieldInfo.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public abstract class FieldInfo : MemberInfo {
+
+ public abstract FieldAttributes Attributes {get;}
+ public abstract RuntimeFieldHandle FieldHandle {get;}
+
+ public abstract Type FieldType { get; }
+
+ public abstract object GetValue(object obj);
+
+ public override MemberTypes MemberType {
+ get { return MemberTypes.Field;}
+ }
+
+ public bool IsLiteral
+ {
+ get {return (Attributes & FieldAttributes.Literal) != 0;}
+ }
+
+ public bool IsStatic
+ {
+ get {return (Attributes & FieldAttributes.Static) != 0;}
+ }
+
+ public bool IsInitOnly
+ {
+ get {return (Attributes & FieldAttributes.InitOnly) != 0;}
+ }
+ public Boolean IsPublic
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public;
+ }
+ }
+ public Boolean IsPrivate
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private;
+ }
+ }
+ public Boolean IsFamily
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family;
+ }
+ }
+ public Boolean IsAssembly
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly;
+ }
+ }
+ public Boolean IsFamilyAndAssembly
+ {
+ get {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamANDAssem;
+ }
+ }
+ public Boolean IsFamilyOrAssembly
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem;
+ }
+ }
+ public Boolean IsPinvokeImpl
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.PinvokeImpl) == FieldAttributes.PinvokeImpl;
+ }
+ }
+ public Boolean IsSpecialName
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.SpecialName) == FieldAttributes.SpecialName;
+ }
+ }
+ public Boolean IsNotSerialized
+ {
+ get
+ {
+ return (Attributes & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized;
+ }
+ }
+
+ public abstract void SetValue (object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture);
+
+ [MonoTODO]
+ public void SetValue( object obj, object value) {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/ICustomAttributeProvider.cs b/mcs/class/corlib/System.Reflection/ICustomAttributeProvider.cs
new file mode 100755
index 00000000000..c0c06c274ac
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ICustomAttributeProvider.cs
@@ -0,0 +1,25 @@
+//
+// System.Reflection.ICustomAttributeProvider.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+namespace System.Reflection {
+
+ public interface ICustomAttributeProvider {
+
+ object [] GetCustomAttributes (bool inherit);
+ object [] GetCustomAttributes (Type attribute_type, bool inherit);
+
+ /// <summary>
+ /// Probes whether one or more `attribute_type' types are
+ /// defined by this member
+ /// </summary>
+ bool IsDefined (Type attribute_type, bool inherit);
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/IReflect.cs b/mcs/class/corlib/System.Reflection/IReflect.cs
new file mode 100755
index 00000000000..e89c3298a69
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/IReflect.cs
@@ -0,0 +1,44 @@
+//
+// System.Reflection.IReflect.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+using System.Globalization;
+
+namespace System.Reflection {
+
+ public interface IReflect {
+
+ Type UnderlyingSystemType {
+ get;
+ }
+
+ FieldInfo GetField (string name, BindingFlags binding_attr);
+ FieldInfo [] GetFields (BindingFlags binding_attr);
+ MemberInfo[] GetMember (string name, BindingFlags binding_attr);
+ MemberInfo[] GetMembers (BindingFlags binding_attr);
+ MethodInfo GetMethod (string name, BindingFlags binding_attr);
+ MethodInfo GetMethod (string name, BindingFlags binding_attr,
+ Binder binder, Type [] types, ParameterModifier [] modifiers);
+ MethodInfo[] GetMethods (BindingFlags binding_attr);
+
+ PropertyInfo [] GetProperties (BindingFlags binding_attr);
+ PropertyInfo GetProperty (string name, BindingFlags binding_attr);
+ PropertyInfo GetProperty (string name, BindingFlags binding_attr,
+ Binder binder, Type return_type, Type [] types,
+ ParameterModifier [] modifiers);
+
+ object InvokeMember (string name, BindingFlags invoke_attr,
+ Binder binder, object target, object [] args,
+ ParameterModifier [] modifiers,
+ CultureInfo culture,
+ string [] named_parameters);
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/InterfaceMapping.cs b/mcs/class/corlib/System.Reflection/InterfaceMapping.cs
new file mode 100755
index 00000000000..8da05148398
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/InterfaceMapping.cs
@@ -0,0 +1,10 @@
+
+namespace System.Reflection {
+
+ public struct InterfaceMapping {
+ public MethodInfo[] InterfaceMethods;
+ public Type InterfaceType;
+ public MethodInfo[] TargetMethods;
+ public Type TargetType;
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/InvalidFilterCriteriaException.cs b/mcs/class/corlib/System.Reflection/InvalidFilterCriteriaException.cs
new file mode 100644
index 00000000000..f1a73377a28
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/InvalidFilterCriteriaException.cs
@@ -0,0 +1,37 @@
+//
+// System.Reflection.InvalidFilterCriteriaException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class InvalidFilterCriteriaException : ApplicationException
+ {
+ public InvalidFilterCriteriaException ()
+ : base (Locale.GetText ("Filter Criteria is not valid."))
+ {
+ }
+ public InvalidFilterCriteriaException (string message)
+ : base (message)
+ {
+ }
+
+ public InvalidFilterCriteriaException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected InvalidFilterCriteriaException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/ManifestResourceInfo.cs b/mcs/class/corlib/System.Reflection/ManifestResourceInfo.cs
new file mode 100644
index 00000000000..76565a0e609
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ManifestResourceInfo.cs
@@ -0,0 +1,27 @@
+// System.Reflection.ManifestResourceInfo
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. 2001
+
+namespace System.Reflection
+{
+ public class ManifestResourceInfo
+ {
+ [MonoTODO]
+ public virtual string FileName {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public virtual Assembly ReferencedAssembly {
+ get { return null; }
+ }
+
+ [MonoTODO]
+ public virtual ResourceLocation ResourceLocation {
+ get { return 0; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MemberFilter.cs b/mcs/class/corlib/System.Reflection/MemberFilter.cs
new file mode 100644
index 00000000000..74e73a69ce3
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MemberFilter.cs
@@ -0,0 +1,7 @@
+using System;
+using System.Reflection;
+
+namespace System.Reflection {
+ public delegate bool MemberFilter( MemberInfo m, object filterCriteria);
+
+}
diff --git a/mcs/class/corlib/System.Reflection/MemberInfo.cs b/mcs/class/corlib/System.Reflection/MemberInfo.cs
new file mode 100755
index 00000000000..9e3c52b8038
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MemberInfo.cs
@@ -0,0 +1,39 @@
+//
+// System.Reflection.MemberInfo.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+namespace System.Reflection {
+
+ [Serializable]
+ public abstract class MemberInfo : ICustomAttributeProvider {
+
+ public abstract Type DeclaringType {
+ get;
+ }
+
+ public abstract MemberTypes MemberType {
+ get;
+ }
+
+ public abstract string Name {
+ get;
+ }
+
+ public abstract Type ReflectedType {
+ get;
+ }
+
+ public abstract bool IsDefined (Type attribute_type, bool inherit);
+
+ public abstract object [] GetCustomAttributes (bool inherit);
+
+ public abstract object [] GetCustomAttributes (Type attribute_type, bool inherit);
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MemberTypes.cs b/mcs/class/corlib/System.Reflection/MemberTypes.cs
new file mode 100755
index 00000000000..00a1234ef36
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MemberTypes.cs
@@ -0,0 +1,57 @@
+// MemberTypes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:38:53 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ public enum MemberTypes {
+
+ /// <summary>
+ /// </summary>
+ Constructor = 1,
+
+ /// <summary>
+ /// </summary>
+ Event = 2,
+
+ /// <summary>
+ /// </summary>
+ Field = 4,
+
+ /// <summary>
+ /// </summary>
+ Method = 8,
+
+ /// <summary>
+ /// </summary>
+ Property = 16,
+
+ /// <summary>
+ /// </summary>
+ TypeInfo = 32,
+
+ /// <summary>
+ /// </summary>
+ Custom = 64,
+
+ /// <summary>
+ /// </summary>
+ NestedType = 128,
+
+ /// <summary>
+ /// </summary>
+ All = 191,
+ } // MemberTypes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/MethodAttributes.cs b/mcs/class/corlib/System.Reflection/MethodAttributes.cs
new file mode 100755
index 00000000000..51ac6f18a6a
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MethodAttributes.cs
@@ -0,0 +1,113 @@
+// MethodAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:32 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ public enum MethodAttributes {
+
+ /// <summary>
+ /// </summary>
+ MemberAccessMask = 7,
+
+ /// <summary>
+ /// </summary>
+ PrivateScope = 0,
+
+ /// <summary>
+ /// </summary>
+ Private = 1,
+
+ /// <summary>
+ /// </summary>
+ FamANDAssem = 2,
+
+ /// <summary>
+ /// </summary>
+ Assembly = 3,
+
+ /// <summary>
+ /// </summary>
+ Family = 4,
+
+ /// <summary>
+ /// </summary>
+ FamORAssem = 5,
+
+ /// <summary>
+ /// </summary>
+ Public = 6,
+
+ /// <summary>
+ /// </summary>
+ Static = 16,
+
+ /// <summary>
+ /// </summary>
+ Final = 32,
+
+ /// <summary>
+ /// </summary>
+ Virtual = 64,
+
+ /// <summary>
+ /// </summary>
+ HideBySig = 128,
+
+ /// <summary>
+ /// </summary>
+ VtableLayoutMask = 256,
+
+ /// <summary>
+ /// </summary>
+ ReuseSlot = 0,
+
+ /// <summary>
+ /// </summary>
+ NewSlot = 256,
+
+ /// <summary>
+ /// </summary>
+ Abstract = 1024,
+
+ /// <summary>
+ /// </summary>
+ SpecialName = 2048,
+
+ /// <summary>
+ /// </summary>
+ PinvokeImpl = 8192,
+
+ /// <summary>
+ /// </summary>
+ UnmanagedExport = 8,
+
+ /// <summary>
+ /// </summary>
+ RTSpecialName = 4096,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = 53248,
+
+ /// <summary>
+ /// </summary>
+ HasSecurity = 16384,
+
+ /// <summary>
+ /// </summary>
+ RequireSecObject = 32768,
+ } // MethodAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/MethodBase.cs b/mcs/class/corlib/System.Reflection/MethodBase.cs
new file mode 100644
index 00000000000..870bcc06052
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MethodBase.cs
@@ -0,0 +1,127 @@
+//
+// System.Reflection/MethodBase.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Reflection.Emit;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public abstract class MethodBase: MemberInfo {
+
+ public static MethodBase GetCurrentMethod()
+ {
+ return null;
+ }
+
+ public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle)
+ {
+ return null;
+ }
+
+ public abstract MethodImplAttributes GetMethodImplementationFlags();
+
+ public abstract ParameterInfo[] GetParameters();
+
+ public Object Invoke(Object obj, Object[] parameters) {
+ return Invoke (obj, 0, null, parameters, null);
+ }
+
+ public abstract Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture);
+
+ protected MethodBase()
+ {
+ }
+
+ public abstract RuntimeMethodHandle MethodHandle { get; }
+ public abstract MethodAttributes Attributes { get; }
+ public virtual CallingConventions CallingConvention { get {return CallingConventions.Standard;} }
+ public Boolean IsPublic {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public;
+ }
+ }
+ public Boolean IsPrivate {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private;
+ }
+ }
+ public Boolean IsFamily {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Family;
+ }
+ }
+ public Boolean IsAssembly {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assembly;
+ }
+ }
+ public Boolean IsFamilyAndAssembly {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamANDAssem;
+ }
+ }
+ public Boolean IsFamilyOrAssembly {
+ get {
+ return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamORAssem;
+ }
+ }
+ public Boolean IsStatic {
+ get {
+ return (Attributes & MethodAttributes.Static) != 0;
+ }
+ }
+ public Boolean IsFinal {
+ get {
+ return (Attributes & MethodAttributes.Final) != 0;
+ }
+ }
+ public Boolean IsVirtual {
+ get {
+ return (Attributes & MethodAttributes.Virtual) != 0;
+ }
+ }
+ public Boolean IsHideBySig {
+ get {
+ return (Attributes & MethodAttributes.HideBySig) != 0;
+ }
+ }
+ public Boolean IsAbstract {
+ get {
+ return (Attributes & MethodAttributes.Abstract) != 0;
+ }
+ }
+ public Boolean IsSpecialName {
+ get {
+ int attr = (int)Attributes;
+ return (attr & (int)MethodAttributes.SpecialName) != 0;
+ }
+ }
+ public Boolean IsConstructor {
+ get {
+ int attr = (int)Attributes;
+ return ((attr & (int)MethodAttributes.RTSpecialName) != 0
+ && (Name == ".ctor"));
+ }
+ }
+
+ internal virtual int get_next_table_index (int table, bool inc) {
+ if (this is MethodBuilder) {
+ MethodBuilder mb = (MethodBuilder)this;
+ return mb.get_next_table_index (table, inc);
+ }
+ if (this is ConstructorBuilder) {
+ ConstructorBuilder mb = (ConstructorBuilder)this;
+ return mb.get_next_table_index (table, inc);
+ }
+ throw new Exception ("Method is not a builder method");
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MethodImplAttributes.cs b/mcs/class/corlib/System.Reflection/MethodImplAttributes.cs
new file mode 100755
index 00000000000..aaa243ab6d3
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MethodImplAttributes.cs
@@ -0,0 +1,77 @@
+// MethodImplAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:42 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ public enum MethodImplAttributes {
+
+ /// <summary>
+ /// </summary>
+ CodeTypeMask = 3,
+
+ /// <summary>
+ /// </summary>
+ IL = 0,
+
+ /// <summary>
+ /// </summary>
+ Native = 1,
+
+ /// <summary>
+ /// </summary>
+ OPTIL = 2,
+
+ /// <summary>
+ /// </summary>
+ Runtime = 3,
+
+ /// <summary>
+ /// </summary>
+ ManagedMask = 4,
+
+ /// <summary>
+ /// </summary>
+ Unmanaged = 4,
+
+ /// <summary>
+ /// </summary>
+ Managed = 0,
+
+ /// <summary>
+ /// </summary>
+ ForwardRef = 16,
+
+ /// <summary>
+ /// </summary>
+ PreserveSig = 128,
+
+ /// <summary>
+ /// </summary>
+ InternalCall = 4096,
+
+ /// <summary>
+ /// </summary>
+ Synchronized = 32,
+
+ /// <summary>
+ /// </summary>
+ NoInlining = 8,
+
+ /// <summary>
+ /// </summary>
+ MaxMethodImplVal = 65535,
+ } // MethodImplAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/MethodInfo.cs b/mcs/class/corlib/System.Reflection/MethodInfo.cs
new file mode 100644
index 00000000000..505a9b626bd
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MethodInfo.cs
@@ -0,0 +1,26 @@
+//
+// System.Reflection/MethodInfo.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public abstract class MethodInfo: MethodBase {
+
+ public abstract MethodInfo GetBaseDefinition();
+
+ protected MethodInfo() {
+ }
+ public override MemberTypes MemberType { get {return MemberTypes.Method;} }
+ public abstract Type ReturnType { get; }
+ public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection/Missing.cs b/mcs/class/corlib/System.Reflection/Missing.cs
new file mode 100644
index 00000000000..dfce32dae3e
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/Missing.cs
@@ -0,0 +1,17 @@
+//
+// System.Reflection.Missing.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Reflection
+{
+ public sealed class Missing
+ {
+ public static readonly Missing Value;
+
+ internal Missing () {}
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/Module.cs b/mcs/class/corlib/System.Reflection/Module.cs
new file mode 100644
index 00000000000..2d1c8005446
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/Module.cs
@@ -0,0 +1,103 @@
+//
+// System.Reflection/Module.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Runtime.Serialization;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Reflection {
+ [Serializable]
+ public class Module : ISerializable, ICustomAttributeProvider {
+
+ public static readonly TypeFilter FilterTypeName;
+ public static readonly TypeFilter FilterTypeNameIgnoreCase;
+
+ private IntPtr _impl; /* a pointer to a MonoImage */
+ internal Assembly assembly;
+ internal string fqname;
+ internal string name;
+ internal string scopename;
+
+ internal Module () {}
+
+ public Assembly Assembly {get {return assembly;}}
+ public virtual string FullyQualifiedName {get {return fqname;}}
+ public string Name {get {return name;}}
+ public string ScopeName {get {return scopename;}}
+
+
+ public virtual Type[] FindTypes(TypeFilter filter, object filterCriteria) {
+ return null;
+ }
+ public virtual object[] GetCustomAttributes(bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+ public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+ public FieldInfo GetField(string name) {
+ return null;
+ }
+ public FieldInfo GetField(string name, BindingFlags flags) {
+ return null;
+ }
+ public FieldInfo[] GetFields() {
+ return null;
+ }
+
+ public MethodInfo GetMethod(string name) {
+ return null;
+ }
+ public MethodInfo GetMethod(string name, Type[] types) {
+ return null;
+ }
+ public MethodInfo GetMethod( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ return null;
+ }
+ protected virtual MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ return null;
+ }
+ public MethodInfo[] GetMethods() {
+ return null;
+ }
+ public virtual void GetObjectData( SerializationInfo info, StreamingContext context) {}
+ public X509Certificate GetSignerCertificate() {
+ return null;
+ }
+ public virtual Type GetType(string className) {
+ return null;
+ }
+ public virtual Type GetType(string className, bool ignoreCase) {
+ return null;
+ }
+ public virtual Type GetType(string className, bool throwOnError, bool ignoreCase) {
+ return null;
+ }
+ public virtual Type[] GetTypes() {
+ return null;
+ }
+ public virtual bool IsDefined( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+ public bool IsResource() {
+ return false;
+ }
+ public override string ToString() {
+ return "Reflection.Module: " + name;
+ }
+
+
+
+
+
+
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection/MonoEvent.cs b/mcs/class/corlib/System.Reflection/MonoEvent.cs
new file mode 100755
index 00000000000..75e8c1336dc
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MonoEvent.cs
@@ -0,0 +1,43 @@
+//
+// System.Reflection/MonoEvent.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+
+namespace System.Reflection {
+ internal sealed class MonoEvent: EventInfo {
+ IntPtr klass;
+ IntPtr handle;
+
+ public override EventAttributes Attributes {
+ get { return (EventAttributes)0;}
+ }
+
+ public override MethodInfo GetAddMethod(bool nonPublic) {
+ return null;
+ }
+ public override MethodInfo GetRaiseMethod( bool nonPublic) {
+ return null;
+ }
+ public override MethodInfo GetRemoveMethod( bool nonPublic) {
+ return null;
+ }
+
+ public override Type DeclaringType {
+ get {
+ return null;
+ }
+ }
+ public override string Name {
+ get {
+ return null;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MonoField.cs b/mcs/class/corlib/System.Reflection/MonoField.cs
new file mode 100755
index 00000000000..1c427e14164
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MonoField.cs
@@ -0,0 +1,99 @@
+
+//
+// System.Reflection/MonoField.cs
+// The class used to represent Fields from the mono runtime.
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection {
+
+ internal struct MonoFieldInfo {
+ public Type parent;
+ public Type type;
+ public String name;
+ public FieldAttributes attrs;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern void get_field_info (MonoField field, out MonoFieldInfo info);
+ }
+
+ internal class MonoField : FieldInfo {
+ internal IntPtr klass;
+ internal RuntimeFieldHandle fhandle;
+
+ public override FieldAttributes Attributes {
+ get {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return info.attrs;
+ }
+ }
+ public override RuntimeFieldHandle FieldHandle {
+ get {return fhandle;}
+ }
+
+ public override Type FieldType {
+ get {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return info.type;
+ }
+ }
+
+ public override Type ReflectedType {
+ get {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return info.parent;
+ }
+ }
+ public override Type DeclaringType {
+ get {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return info.parent;
+ }
+ }
+ public override string Name {
+ get {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return info.name;
+ }
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes( bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override object GetValue(object obj);
+
+ public override string ToString () {
+ MonoFieldInfo info;
+ MonoFieldInfo.get_field_info (this, out info);
+ return String.Format ("{0} {1}", info.type, info.name);
+ }
+
+ [MonoTODO]
+ public override void SetValue (object obj, object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MonoMethod.cs b/mcs/class/corlib/System.Reflection/MonoMethod.cs
new file mode 100755
index 00000000000..0c9e0975868
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MonoMethod.cs
@@ -0,0 +1,205 @@
+//
+// System.Reflection/MonoMethod.cs
+// The class used to represent methods from the mono runtime.
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection {
+ internal struct MonoMethodInfo {
+ internal Type parent;
+ internal Type ret;
+ internal MethodAttributes attrs;
+ internal MethodImplAttributes iattrs;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern void get_method_info (RuntimeMethodHandle handle, out MonoMethodInfo info);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern ParameterInfo[] get_parameter_info (RuntimeMethodHandle handle);
+ };
+
+ /*
+ * Note: most of this class needs to be duplicated for the contructor, since
+ * the .NET reflection class hierarchy is so broken.
+ */
+ internal class MonoMethod : MethodInfo {
+ internal RuntimeMethodHandle mhandle;
+ string name;
+
+ [MonoTODO]
+ public override MethodInfo GetBaseDefinition() {
+ return this; /* FIXME */
+ }
+ public override Type ReturnType {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.ret;
+ }
+ }
+ public override ICustomAttributeProvider ReturnTypeCustomAttributes {
+ get {return null;}
+ }
+
+ public override MethodImplAttributes GetMethodImplementationFlags() {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.iattrs;
+ }
+
+ public override ParameterInfo[] GetParameters() {
+ return MonoMethodInfo.get_parameter_info (mhandle);
+ }
+
+ /*
+ * InternalInvoke() receives the parameters corretcly converted by the binder
+ * to match the types of the method signature.
+ */
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern Object InternalInvoke (Object obj, Object[] parameters);
+
+ [MonoTODO]
+ public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ // fixme: consider all other parameters
+ return InternalInvoke (obj, parameters);
+ }
+
+ public override RuntimeMethodHandle MethodHandle {
+ get {return mhandle;}
+ }
+ public override MethodAttributes Attributes {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.attrs;
+ }
+ }
+
+ public override Type ReflectedType {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.parent;
+ }
+ }
+ public override Type DeclaringType {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.parent;
+ }
+ }
+ public override string Name {
+ get {
+ return name;
+ }
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes( bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public override string ToString () {
+ string parms = "";
+ ParameterInfo[] p = GetParameters ();
+ for (int i = 0; i < p.Length; ++i) {
+ if (i > 0)
+ parms = parms + ", ";
+ parms = parms + p [i].ParameterType.Name;
+ }
+ return ReturnType.Name+" "+Name+"("+parms+")";
+ }
+ }
+
+ internal class MonoCMethod : ConstructorInfo {
+ internal RuntimeMethodHandle mhandle;
+ string name;
+
+ public override MethodImplAttributes GetMethodImplementationFlags() {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.iattrs;
+ }
+
+ public override ParameterInfo[] GetParameters() {
+ return MonoMethodInfo.get_parameter_info (mhandle);
+ }
+
+ /*
+ * InternalInvoke() receives the parameters corretcly converted by the binder
+ * to match the types of the method signature.
+ */
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern Object InternalInvoke (Object obj, Object[] parameters);
+
+ public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ throw new NotImplementedException ();
+ }
+
+ public override Object Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ return InternalInvoke (null, parameters);
+ }
+
+ public override RuntimeMethodHandle MethodHandle {
+ get {return mhandle;}
+ }
+ public override MethodAttributes Attributes {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.attrs;
+ }
+ }
+
+ public override Type ReflectedType {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.parent;
+ }
+ }
+ public override Type DeclaringType {
+ get {
+ MonoMethodInfo info;
+ MonoMethodInfo.get_method_info (mhandle, out info);
+ return info.parent;
+ }
+ }
+ public override string Name {
+ get {
+ return name;
+ }
+ }
+
+ [MonoTODO]
+ public override bool IsDefined (Type attribute_type, bool inherit) {
+ return false;
+ }
+
+ [MonoTODO]
+ public override object[] GetCustomAttributes (bool inherit) {
+ return null;
+ }
+
+ [MonoTODO]
+ public override object[] GetCustomAttributes (Type attributeType, bool inherit) {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/MonoProperty.cs b/mcs/class/corlib/System.Reflection/MonoProperty.cs
new file mode 100755
index 00000000000..20d0124fe25
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/MonoProperty.cs
@@ -0,0 +1,164 @@
+//
+// System.Reflection/MonoProperty.cs
+// The class used to represent Properties from the mono runtime.
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Patrik Torstensson (patrik.torstensson@labs2.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System.Reflection {
+
+ internal struct MonoPropertyInfo {
+ public Type parent;
+ public String name;
+ public MethodInfo get_method;
+ public MethodInfo set_method;
+ public PropertyAttributes attrs;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern void get_property_info (MonoProperty prop, out MonoPropertyInfo info);
+ }
+
+ internal class MonoProperty : PropertyInfo {
+ internal IntPtr klass;
+ internal IntPtr prop;
+
+ public override PropertyAttributes Attributes {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.attrs;
+ }
+ }
+ public override bool CanRead {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return (info.get_method != null);
+ }
+ }
+ public override bool CanWrite {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return (info.set_method != null);
+ }
+ }
+
+ [MonoTODO]
+ public override Type PropertyType {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+
+ if (info.get_method != null) {
+ return info.get_method.ReturnType;
+ } else {
+ // FIXME: take the last param to set_method
+ return null;
+ }
+ }
+ }
+ public override Type ReflectedType {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.parent;
+ }
+ }
+ public override Type DeclaringType {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.parent;
+ }
+ }
+ public override string Name {
+ get {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.name;
+ }
+ }
+
+ [MonoTODO]
+ public override MethodInfo[] GetAccessors( bool nonPublic) {
+ // FIXME: check nonPublic
+ MonoPropertyInfo info;
+ int n = 0;
+ MonoPropertyInfo.get_property_info (this, out info);
+ if (info.set_method != null)
+ n++;
+ if (info.get_method != null)
+ n++;
+ MethodInfo[] res = new MethodInfo [n];
+ n = 0;
+ if (info.set_method != null)
+ res [n++] = info.set_method;
+ if (info.get_method != null)
+ res [n++] = info.get_method;
+ return res;
+ }
+
+ [MonoTODO]
+ public override MethodInfo GetGetMethod( bool nonPublic) {
+ // FIXME: check nonPublic
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.get_method;
+ }
+ public override ParameterInfo[] GetIndexParameters() {
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ if (info.get_method != null)
+ return info.get_method.GetParameters ();
+ return new ParameterInfo [0];
+ }
+ public override MethodInfo GetSetMethod( bool nonPublic) {
+ // FIXME: check nonPublic
+ MonoPropertyInfo info;
+ MonoPropertyInfo.get_property_info (this, out info);
+ return info.set_method;
+ }
+ public override bool IsDefined (Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes( bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+ public override object[] GetCustomAttributes( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public override object GetValue( object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) {
+ object ret = null;
+
+ if (index == null || index.Length == 0) {
+ MethodInfo method = GetGetMethod(false);
+
+ ret = method.Invoke(obj, invokeAttr, binder, null, culture);
+ }
+
+ // fixme: support indexed parameters..
+
+ return ret;
+ }
+
+ public override void SetValue( object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) {
+ }
+
+ public override string ToString () {
+ return PropertyType.ToString () + " " + Name;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Reflection/ParameterAttributes.cs b/mcs/class/corlib/System.Reflection/ParameterAttributes.cs
new file mode 100755
index 00000000000..eaf409d8b1c
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ParameterAttributes.cs
@@ -0,0 +1,66 @@
+// ParameterAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:52 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ParameterAttributes {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ In = 1,
+
+ /// <summary>
+ /// </summary>
+ Out = 2,
+
+ /// <summary>
+ /// </summary>
+ Lcid = 4,
+
+ /// <summary>
+ /// </summary>
+ Retval = 8,
+
+ /// <summary>
+ /// </summary>
+ Optional = 16,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = 61440,
+
+ /// <summary>
+ /// </summary>
+ HasDefault = 4096,
+
+ /// <summary>
+ /// </summary>
+ HasFieldMarshal = 8192,
+
+ /// <summary>
+ /// </summary>
+ Reserved3 = 16384,
+
+ /// <summary>
+ /// </summary>
+ Reserved4 = 32768,
+ } // ParameterAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/ParameterInfo.cs b/mcs/class/corlib/System.Reflection/ParameterInfo.cs
new file mode 100644
index 00000000000..69f296a9452
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ParameterInfo.cs
@@ -0,0 +1,78 @@
+// System.Reflection.ParameterInfo
+//
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class ParameterInfo : ICustomAttributeProvider
+ {
+ protected Type ClassImpl;
+ protected object DefaultValueImpl;
+ protected MemberInfo MemberImpl;
+ protected string NameImpl;
+ protected int PositionImpl;
+ protected ParameterAttributes AttrsImpl;
+
+ protected ParameterInfo () {
+ }
+
+ public virtual Type ParameterType {
+ get {return ClassImpl;}
+ }
+ public virtual ParameterAttributes Attributes {
+ get {return AttrsImpl;}
+ }
+ public virtual object DefaultValue {
+ get {return DefaultValueImpl;}
+ }
+
+ public bool IsIn {
+ get {return (AttrsImpl & ParameterAttributes.In) != 0;}
+ }
+
+ public bool IsLcid {
+ get {return (AttrsImpl & ParameterAttributes.Lcid) != 0;}
+ }
+
+ public bool IsOptional {
+ get {return (AttrsImpl & ParameterAttributes.Optional) != 0;}
+ }
+
+ public bool IsOut {
+ get {return (AttrsImpl & ParameterAttributes.Out) != 0;}
+ }
+
+ public bool IsRetval {
+ get {return (AttrsImpl & ParameterAttributes.Retval) != 0;}
+ }
+
+ public virtual MemberInfo Member {
+ get {return MemberImpl;}
+ }
+
+ public virtual string Name {
+ get {return NameImpl;}
+ }
+
+ public virtual int Position {
+ get {return PositionImpl;}
+ }
+
+ public virtual object[] GetCustomAttributes (bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+
+ public virtual object[] GetCustomAttributes (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public virtual bool IsDefined( Type attributeType, bool inherit) {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/ParameterModifier.cs b/mcs/class/corlib/System.Reflection/ParameterModifier.cs
new file mode 100755
index 00000000000..4615e1931dd
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ParameterModifier.cs
@@ -0,0 +1,26 @@
+//
+// System.Reflection/ParameterModifier.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// Copyright (c) 2001 Ximian, Inc
+
+using System;
+
+namespace System.Reflection {
+ public struct ParameterModifier {
+ private bool[] data;
+
+ public ParameterModifier (int paramaterCount) {
+ data = new bool [paramaterCount];
+ }
+
+ public bool this [int index] {
+ get {return data [index];}
+ set {data [index] = value;}
+ }
+
+ }
+
+}
diff --git a/mcs/class/corlib/System.Reflection/PropertyAttributes.cs b/mcs/class/corlib/System.Reflection/PropertyAttributes.cs
new file mode 100755
index 00000000000..7cb7359dba0
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/PropertyAttributes.cs
@@ -0,0 +1,54 @@
+// PropertyAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:40:02 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum PropertyAttributes {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ SpecialName = 512,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = 62464,
+
+ /// <summary>
+ /// </summary>
+ RTSpecialName = 1024,
+
+ /// <summary>
+ /// </summary>
+ HasDefault = 4096,
+
+ /// <summary>
+ /// </summary>
+ Reserved2 = 8192,
+
+ /// <summary>
+ /// </summary>
+ Reserved3 = 16384,
+
+ /// <summary>
+ /// </summary>
+ Reserved4 = 32768,
+ } // PropertyAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/PropertyInfo.cs b/mcs/class/corlib/System.Reflection/PropertyInfo.cs
new file mode 100755
index 00000000000..383bef59fc8
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/PropertyInfo.cs
@@ -0,0 +1,55 @@
+//
+// System.Reflection/PropertyInfo.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Globalization;
+
+namespace System.Reflection {
+ [Serializable]
+ public abstract class PropertyInfo : MemberInfo {
+
+ public abstract PropertyAttributes Attributes {get;}
+ public abstract bool CanRead {get;}
+ public abstract bool CanWrite {get;}
+
+ public bool IsSpecialName {
+ get {return (Attributes & PropertyAttributes.SpecialName) != 0;}
+ }
+
+ public override MemberTypes MemberType {
+ get {return MemberTypes.Property;}
+ }
+ public abstract Type PropertyType {get;}
+
+ protected PropertyInfo() {
+ }
+
+ public MethodInfo[] GetAccessors() {
+ return GetAccessors (false);
+ }
+ public abstract MethodInfo[] GetAccessors( bool nonPublic);
+ public MethodInfo GetGetMethod() {
+ return GetGetMethod (false);
+ }
+ public abstract MethodInfo GetGetMethod( bool nonPublic);
+ public abstract ParameterInfo[] GetIndexParameters();
+ public MethodInfo GetSetMethod() {
+ return GetSetMethod (false);
+ }
+ public abstract MethodInfo GetSetMethod( bool nonPublic);
+ public virtual object GetValue( object obj, object[] index) {
+ return GetValue(obj, BindingFlags.Default, null, index, null);
+ }
+ public abstract object GetValue( object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture);
+ public virtual void SetValue( object obj, object value, object[] index) {
+ }
+ public abstract void SetValue( object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture);
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/ReflectionTypeLoadException.cs b/mcs/class/corlib/System.Reflection/ReflectionTypeLoadException.cs
new file mode 100644
index 00000000000..7680b4c37b5
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ReflectionTypeLoadException.cs
@@ -0,0 +1,62 @@
+//
+// System.Reflection.ReflectionTypeLoadException
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Dunan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public sealed class ReflectionTypeLoadException : SystemException
+ {
+ // Fields
+ private Exception[] loaderExceptions;
+ private Type[] types;
+
+ // Constructors
+ public ReflectionTypeLoadException (Type[] classes, Exception[] exceptions)
+ : base (Locale.GetText ("The classes in the module cannot be loaded."))
+ {
+ loaderExceptions = exceptions;
+ types = classes;
+ }
+
+ public ReflectionTypeLoadException (Type[] classes, Exception[] exceptions, string message)
+ : base (message)
+ {
+ loaderExceptions = exceptions;
+ types = classes;
+ }
+
+ // Properties
+ public Type[] Types
+ {
+ get { return types; }
+ }
+
+ public Exception[] LoaderExceptions
+ {
+ get { return loaderExceptions; }
+ }
+
+ // Method
+ [MonoTODO]
+ //
+ // This one is a bit tough because need to serialize two arrays.
+ // The serialization output comes out as
+ // <Types href="#ref-4" />
+ // <Exceptions href="#ref-5" />
+ // and then goes on and appends new SOAP-ENCs, etc...
+ //
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/ResourceAttributes.cs b/mcs/class/corlib/System.Reflection/ResourceAttributes.cs
new file mode 100755
index 00000000000..ab02d11805d
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ResourceAttributes.cs
@@ -0,0 +1,30 @@
+// ResourceAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:40:12 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ResourceAttributes {
+
+ /// <summary>
+ /// </summary>
+ Public = 1,
+
+ /// <summary>
+ /// </summary>
+ Private = 2,
+ } // ResourceAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/ResourceLocation.cs b/mcs/class/corlib/System.Reflection/ResourceLocation.cs
new file mode 100755
index 00000000000..611c61828b5
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/ResourceLocation.cs
@@ -0,0 +1,34 @@
+// ResourceLocation.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:39:22 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ResourceLocation {
+
+ /// <summary>
+ /// </summary>
+ Embedded = 1,
+
+ /// <summary>
+ /// </summary>
+ ContainedInAnotherAssembly = 2,
+
+ /// <summary>
+ /// </summary>
+ ContainedInManifestFile = 4,
+ } // ResourceLocation
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/StrongNameKeyPair.cs b/mcs/class/corlib/System.Reflection/StrongNameKeyPair.cs
new file mode 100755
index 00000000000..cd16be2df68
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/StrongNameKeyPair.cs
@@ -0,0 +1,39 @@
+//
+// System.Reflection.StrongNameKeyPair.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+using System.IO;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public class StrongNameKeyPair
+ {
+ private byte[] keyPair;
+
+ public StrongNameKeyPair (byte[] keyPairArray)
+ {
+ keyPair = keyPairArray;
+ }
+
+ public StrongNameKeyPair (FileStream keyPairFile)
+ {
+
+ }
+
+ public StrongNameKeyPair (string keyPairContainer)
+ {
+
+ }
+
+ public byte[] PublicKey
+ {
+ get { return keyPair; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/TargetException.cs b/mcs/class/corlib/System.Reflection/TargetException.cs
new file mode 100644
index 00000000000..071bd091771
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TargetException.cs
@@ -0,0 +1,37 @@
+//
+// System.Reflection.TargetException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class TargetException : ApplicationException
+ {
+ public TargetException ()
+ : base (Locale.GetText ("Unable to invoke and invalid target."))
+ {
+ }
+
+ public TargetException (string message)
+ : base (message)
+ {
+ }
+
+ public TargetException (string message, Exception innerException)
+ : base (message, innerException)
+ {
+ }
+
+ protected TargetException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/TargetInvocationException.cs b/mcs/class/corlib/System.Reflection/TargetInvocationException.cs
new file mode 100644
index 00000000000..b5ec55d2cb8
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TargetInvocationException.cs
@@ -0,0 +1,23 @@
+// System.Reflection.TargetInvocationException
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+
+namespace System.Reflection
+{
+ [Serializable]
+ public sealed class TargetInvocationException : ApplicationException
+ {
+ public TargetInvocationException (Exception inner)
+ : base (inner.Message, inner)
+ {
+ }
+
+ public TargetInvocationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/TargetParameterCountException.cs b/mcs/class/corlib/System.Reflection/TargetParameterCountException.cs
new file mode 100644
index 00000000000..38a4528743f
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TargetParameterCountException.cs
@@ -0,0 +1,38 @@
+//
+// System.Reflection.TargetParameterCountException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public sealed class TargetParameterCountException : ApplicationException
+ {
+ public TargetParameterCountException ()
+ : base (Locale.GetText ("Number of parameter does not match expected count."))
+ {
+ }
+
+ public TargetParameterCountException (string message)
+ : base (message)
+ {
+ }
+
+ public TargetParameterCountException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ internal TargetParameterCountException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/TypeAttributes.cs b/mcs/class/corlib/System.Reflection/TypeAttributes.cs
new file mode 100755
index 00000000000..5647b709857
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TypeAttributes.cs
@@ -0,0 +1,138 @@
+// TypeAttributes.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:40:22 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum TypeAttributes {
+
+ /// <summary>
+ /// </summary>
+ VisibilityMask = 7,
+
+ /// <summary>
+ /// </summary>
+ NotPublic = 0,
+
+ /// <summary>
+ /// </summary>
+ Public = 1,
+
+ /// <summary>
+ /// </summary>
+ NestedPublic = 2,
+
+ /// <summary>
+ /// </summary>
+ NestedPrivate = 3,
+
+ /// <summary>
+ /// </summary>
+ NestedFamily = 4,
+
+ /// <summary>
+ /// </summary>
+ NestedAssembly = 5,
+
+ /// <summary>
+ /// </summary>
+ NestedFamANDAssem = 6,
+
+ /// <summary>
+ /// </summary>
+ NestedFamORAssem = 7,
+
+ /// <summary>
+ /// </summary>
+ LayoutMask = 24,
+
+ /// <summary>
+ /// </summary>
+ AutoLayout = 0,
+
+ /// <summary>
+ /// </summary>
+ SequentialLayout = 8,
+
+ /// <summary>
+ /// </summary>
+ ExplicitLayout = 16,
+
+ /// <summary>
+ /// </summary>
+ ClassSemanticsMask = 32,
+
+ /// <summary>
+ /// </summary>
+ Class = 0,
+
+ /// <summary>
+ /// </summary>
+ Interface = 32,
+
+ /// <summary>
+ /// </summary>
+ Abstract = 128,
+
+ /// <summary>
+ /// </summary>
+ Sealed = 256,
+
+ /// <summary>
+ /// </summary>
+ SpecialName = 1024,
+
+ /// <summary>
+ /// </summary>
+ Import = 4096,
+
+ /// <summary>
+ /// </summary>
+ Serializable = 8192,
+
+ /// <summary>
+ /// </summary>
+ StringFormatMask = 196608,
+
+ /// <summary>
+ /// </summary>
+ AnsiClass = 0,
+
+ /// <summary>
+ /// </summary>
+ UnicodeClass = 65536,
+
+ /// <summary>
+ /// </summary>
+ AutoClass = 131072,
+
+ /// <summary>
+ /// </summary>
+ BeforeFieldInit = 1048576,
+
+ /// <summary>
+ /// </summary>
+ ReservedMask = 264192,
+
+ /// <summary>
+ /// </summary>
+ RTSpecialName = 2048,
+
+ /// <summary>
+ /// </summary>
+ HasSecurity = 262144,
+ } // TypeAttributes
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Reflection/TypeDelegator.cs b/mcs/class/corlib/System.Reflection/TypeDelegator.cs
new file mode 100755
index 00000000000..b25962a4660
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TypeDelegator.cs
@@ -0,0 +1,204 @@
+// System.Reflection/TypeDelegator.cs
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+
+using System;
+using System.Reflection;
+using System.Globalization;
+
+namespace System.Reflection {
+
+ [Serializable]
+ public class TypeDelegator : Type {
+ protected Type typeImpl;
+
+ protected TypeDelegator () {
+ }
+
+ public TypeDelegator( Type delegatingType) {
+ if (delegatingType == null)
+ throw new ArgumentNullException ("delegatingType must be non-null");
+ typeImpl = delegatingType;
+ }
+
+ public override Assembly Assembly {
+ get {return typeImpl.Assembly;}
+ }
+
+ public override string AssemblyQualifiedName {
+ get {return typeImpl.AssemblyQualifiedName;}
+ }
+
+ public override Type BaseType {
+ get {return typeImpl.BaseType;}
+ }
+
+ public override string FullName {
+ get {return typeImpl.FullName;}
+ }
+
+ public override Guid GUID {
+ get {return typeImpl.GUID;}
+ }
+
+ public override Module Module {
+ get {return typeImpl.Module;}
+ }
+
+ public override string Name {
+ get {return typeImpl.Name;}
+ }
+
+ public override string Namespace {
+ get {return typeImpl.Namespace;}
+ }
+
+ public override RuntimeTypeHandle TypeHandle {
+ get {return typeImpl.TypeHandle;}
+ }
+
+ public override Type UnderlyingSystemType {
+ get {return typeImpl.UnderlyingSystemType;}
+ }
+
+ protected override TypeAttributes GetAttributeFlagsImpl () {
+ throw new NotImplementedException ();
+ //return typeImpl.GetAttributeFlagsImpl ();
+ }
+
+ protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ throw new NotImplementedException ();
+ //return typeImpl.GetConstructorImpl (bindingAttr, binder, callConvention, types, modifiers);
+ }
+
+ public override ConstructorInfo[] GetConstructors( BindingFlags bindingAttr) {
+ return typeImpl.GetConstructors (bindingAttr);
+ }
+
+ public override object[] GetCustomAttributes (bool inherit)
+ {
+ return typeImpl.GetCustomAttributes (inherit);
+ }
+
+ public override object[] GetCustomAttributes (Type attributeType, bool inherit)
+ {
+ return typeImpl.GetCustomAttributes (attributeType, inherit);
+ }
+
+ public override Type GetElementType() {
+ return typeImpl.GetElementType ();
+ }
+
+ public override EventInfo GetEvent( string name, BindingFlags bindingAttr) {
+ return typeImpl.GetEvent (name, bindingAttr);
+ }
+
+ public override EventInfo[] GetEvents() {
+ return GetEvents (BindingFlags.Public);
+ }
+
+ public override EventInfo[] GetEvents( BindingFlags bindingAttr) {
+ return typeImpl.GetEvents (bindingAttr);
+ }
+
+ public override FieldInfo GetField( string name, BindingFlags bindingAttr) {
+ return typeImpl.GetField (name, bindingAttr);
+ }
+
+ public override FieldInfo[] GetFields( BindingFlags bindingAttr) {
+ return typeImpl.GetFields (bindingAttr);
+ }
+
+ public override Type GetInterface( string name, bool ignoreCase) {
+ return typeImpl.GetInterface (name, ignoreCase);
+ }
+
+ public override InterfaceMapping GetInterfaceMap( Type interfaceType) {
+ return typeImpl.GetInterfaceMap (interfaceType);
+ }
+
+ public override Type[] GetInterfaces() {
+ return typeImpl.GetInterfaces ();
+ }
+
+ public override MemberInfo[] GetMember( string name, MemberTypes type, BindingFlags bindingAttr) {
+ return typeImpl.GetMember (name, type, bindingAttr);
+ }
+
+ public override MemberInfo[] GetMembers( BindingFlags bindingAttr) {
+ return typeImpl.GetMembers (bindingAttr);
+ }
+
+ protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ throw new NotImplementedException ();
+ //return typeImpl.GetMethodImpl (name, bindingAttr, binder, callConvention, types, modifiers);
+ }
+
+ public override MethodInfo[] GetMethods( BindingFlags bindingAttr) {
+ return typeImpl.GetMethods (bindingAttr);
+ }
+
+ public override Type GetNestedType( string name, BindingFlags bindingAttr) {
+ return typeImpl.GetNestedType (name, bindingAttr);
+ }
+
+ public override Type[] GetNestedTypes( BindingFlags bindingAttr) {
+ return typeImpl.GetNestedTypes (bindingAttr);
+ }
+
+ public override PropertyInfo[] GetProperties( BindingFlags bindingAttr) {
+ return typeImpl.GetProperties (bindingAttr);
+ }
+
+ protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ throw new NotImplementedException ();
+ //return typeImpl.GetPropertyImpl (name, bindingAttr, bindingAttr, returnType, types, modifiers);
+ }
+
+ protected override bool HasElementTypeImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.HasElementTypeImpl ();
+ }
+
+ public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
+ return typeImpl.InvokeMember (name, invokeAttr, binder, target, args, modifiers, culture, namedParameters);
+ }
+
+ protected override bool IsArrayImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsArrayImpl ();
+ }
+
+ protected override bool IsByRefImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsByRefImpl ();
+ }
+
+ protected override bool IsCOMObjectImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsCOMObjectImpl ();
+ }
+
+ public override bool IsDefined( Type attributeType, bool inherit) {
+ return typeImpl.IsDefined (attributeType, inherit);
+ }
+
+ protected override bool IsPointerImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsPointerImpl ();
+ }
+
+ protected override bool IsPrimitiveImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsPrimitiveImpl ();
+ }
+
+ protected override bool IsValueTypeImpl() {
+ throw new NotImplementedException ();
+ //return typeImpl.IsValueTypeImpl ();
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Reflection/TypeFilter.cs b/mcs/class/corlib/System.Reflection/TypeFilter.cs
new file mode 100644
index 00000000000..a7fb8baf957
--- /dev/null
+++ b/mcs/class/corlib/System.Reflection/TypeFilter.cs
@@ -0,0 +1,13 @@
+// TypeAttributes.cs
+//
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Reflection {
+
+
+ public delegate bool TypeFilter (Type m, object filterCriteria);
+
+} // System.Reflection
diff --git a/mcs/class/corlib/System.Resources/ChangeLog b/mcs/class/corlib/System.Resources/ChangeLog
new file mode 100644
index 00000000000..aad07bd2bef
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/ChangeLog
@@ -0,0 +1,128 @@
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * MissingManifestResourceException.cs: This should inherit from
+ SystemException, not Exception.
+
+2002-01-26 Nick Drochak <ndrochak@gol.com>
+
+ * ResourceReader.cs: Finsished reading resource files with just strings
+ in them. Need to figure out other types, and also resources with
+ multiple types in the same file.
+
+2002-01-24 Nick Drochak <ndrochak@gol.com>
+
+ * ResourceReader.cs: Implemented constructors. Started on the
+ GetEnumerator() method. Not done yet, but comitting for
+ 'disaster recovery' purposes.
+
+2002-01-19 Duncan Mak <duncan@ximian.com>
+
+ * *.cs: Fixed indentation. There was a stupid bug in my .emacs file.
+
+2002-1-17 Duncan Mak <duncan@duncan@ximian.com>
+
+ * ResourceSet.cs: Implemented GetObject (string, bool) and GetString
+ (string, bool). ResourceSet has no more MonoTODOs! Also added in the
+ Serializable attribute.
+
+ * *.cs: convert to Miguel's brace style.
+
+2002-01-17 Duncan Mak <duncan@ximian.com>
+
+ * ResourceManager.cs: Fixed GetNeutralResourcesLanguage () and added
+ new attributes documented in 1.0 SDK.
+
+2002-01-17 Duncan Mak <duncan@ximian.com>
+
+ * ResourceWriter.cs: Added MonoTODO decorations.
+
+ * SatelliteContractVersionAttribute.cs: added new attributes in 1.0 SDK.
+
+ * NeutralResoucesLanguageAttribute.cs: added new attributes in 1.0 SDK
+
+2002-01-16 Duncan Mak <duncan@ximian.com>
+
+ * ResourceReader.cs: Fixed some typos.
+
+ * ResourceManager.cs: After reading the tutorial from the SDK,
+ finished all the ResourceManager constructors and removed those
+ MonoTODO tags.
+
+ Removed MonoTODO from GetNeutralResourcesLanguage (Assembly)
+ because Miguel just implemented the whole class, including the
+ constructor that I needed (CultureInfo (string)).
+
+ Updated fields after reading the new docs from the final SDK.
+
+ * ResXFileRef.cs, ResXResourceReader.cs: Removed. They are part of
+ Windows.Forms and require System.Xml, which we don't have access to.
+
+2002-01-13 Duncan Mak <duncan@ximian.com>
+
+ * ResourceManager.cs: Added more MonoTODOs and cleaned up some
+ indenting.
+
+2002-01-09 Duncan Mak <duncan@ximian.com>
+
+ * ResourceManager.cs: Fixed the GetSatelliteContractVersion()
+ method. It was missing a cast before. Removed MonoTODO
+ attribute. ;-) It was tested by John Barnette, so this shouldn't break
+ the build.
+
+ * ResourceManager.cs: Removed MonoTODO attribute on GetString
+ (string), as I believe it's correct. However, GetString
+ (string, CultureInfo) is definitely broken, so I'm marking it with
+ MonoTODO there. I also added MonoTODO to IntenalGetResourceSet().
+
+2002-01-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Finalizing IResourceReader and IResourceWriter interfaces:
+ Added "new"-modifier to IResourceReader.GetEnumerator
+ * Fixed compilation issues in other *.cs, so that the
+ System.Resources namespaces can be included in the corlib build.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * ResourceManager.cs : MonoTODO attribute decoration.
+
+Tue Dec 18 13:18:32 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * *.cs: fixed some of the compilation issues: missing
+ using directives, typos.
+
+2001-12-11 Duncan Mak <duncan@ximian.com>
+
+ * Checked in to CVS.
+
+2001-12-10 Duncan Mak <duncan@ximian.com>
+
+ * ResourceManager.cs (GetNeutralResourcesLanguage):
+ (GetSatelliteContractVersion): Implemented.
+
+2001-12-09 Duncan Mak <duncan@ximian.com>
+
+ * ResXResourceReader.cs: Initial attempt.
+
+ * ResXFileRef.cs: Initial attempt.
+
+ * ResourceWriter.cs: Initial attempt.
+
+ * ResourceSet.cs (ReadResources): Implemented, with help from Radek Doulik.
+
+2001-11-28 Duncan Mak <duncan@ximian.com>
+
+ * ResourceManager.cs: First attempt.
+
+2001-11-27 Duncan Mak <duncan@ximian.com>
+
+ * ResourceSet.cs:
+ First attempt, can't continue until ResourceReader and ResourceWriter are implemented.
+
+ * SatelliteContractVersionAttribute.cs: First attempt. The spec is quite amibiguous here.
+
+ * NeutralResoucesLanguageAttribute.cs: Complete.
+
+ * MissingManifestResourceException.cs: Complete.
+
+ * IResourceReader.cs: Complete.
+
+ * IResourceWriter.cs: Complete.
diff --git a/mcs/class/corlib/System.Resources/IResourceReader.cs b/mcs/class/corlib/System.Resources/IResourceReader.cs
new file mode 100644
index 00000000000..871f202cfff
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/IResourceReader.cs
@@ -0,0 +1,20 @@
+//
+// System.Resources.IResourceReader.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+
+namespace System.Resources
+{
+ public interface IResourceReader : IEnumerable, IDisposable
+ {
+ void Close();
+ new IDictionaryEnumerator GetEnumerator();
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/IResourceWriter.cs b/mcs/class/corlib/System.Resources/IResourceWriter.cs
new file mode 100644
index 00000000000..ec847784749
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/IResourceWriter.cs
@@ -0,0 +1,25 @@
+//
+// System.Resources.IResourceWriter.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Resources
+{
+
+ public interface IResourceWriter : IDisposable
+ {
+ void AddResource (string name, byte[] value);
+ void AddResource (string name, object value);
+ void AddResource (string name, string value);
+
+ void Close();
+
+ void Generate();
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/MissingManifestResourceException.cs b/mcs/class/corlib/System.Resources/MissingManifestResourceException.cs
new file mode 100644
index 00000000000..b6b22b80c99
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/MissingManifestResourceException.cs
@@ -0,0 +1,42 @@
+//
+// System.Resources.MissingManifestResourceException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Resources
+{
+
+ [Serializable]
+ public class MissingManifestResourceException: SystemException
+ {
+ private string param;
+
+ // Constructors
+ public MissingManifestResourceException ()
+ : base (Locale.GetText ("The assembly does not contain the resources for the required culture."))
+ {
+ }
+
+ public MissingManifestResourceException (string message)
+ :base (message)
+ {
+ }
+
+ protected MissingManifestResourceException (SerializationInfo info, StreamingContext context)
+ :base (info, context)
+ {
+ }
+
+ public MissingManifestResourceException (String message, Exception e)
+ :base (message, e)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/NeutralResoucesLanguageAttribute.cs b/mcs/class/corlib/System.Resources/NeutralResoucesLanguageAttribute.cs
new file mode 100644
index 00000000000..abff4ca7116
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/NeutralResoucesLanguageAttribute.cs
@@ -0,0 +1,28 @@
+//
+// System.Resources.NeutralResourcesLanguageAttribute.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Resources
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class NeutralResourcesLanguageAttribute : Attribute
+ {
+
+ string culture;
+
+ // Constructors
+ public NeutralResourcesLanguageAttribute (string cultureName)
+ {
+ culture = cultureName;
+ }
+ public string CultureName
+ {
+ get { return culture; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/ResourceManager.cs b/mcs/class/corlib/System.Resources/ResourceManager.cs
new file mode 100644
index 00000000000..c592c2d5d2c
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/ResourceManager.cs
@@ -0,0 +1,163 @@
+//
+// System.Resources.ResourceManager.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2001 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+using System.Reflection;
+using System.Globalization;
+
+namespace System.Resources
+{
+ [Serializable]
+ public class ResourceManager
+ {
+ public static readonly int HeaderVersionNumber;
+ // public static readonly int MagicNumber = 0xBEEFCACE;
+
+ protected string BaseNameField;
+ protected Assembly MainAssembly;
+ protected Hashtable ResourceSets;
+
+ private bool ignoreCase;
+ private Type resourceSetType;
+
+ // constructors
+ protected ResourceManager () {}
+
+ public ResourceManager (Type resourceSource)
+ {
+ if (resourceSource == null)
+ throw new ArgumentNullException ("resourceSource is null.");
+
+ BaseNameField = resourceSource.FullName;
+ MainAssembly = resourceSource.Assembly;
+
+ ignoreCase = false;
+ resourceSetType = resourceSource;
+ }
+
+ public ResourceManager (string baseName, Assembly assembly)
+ {
+ if (baseName == null || assembly == null)
+ throw new ArgumentNullException ("The arguments are null.");
+
+ BaseNameField = baseName;
+ MainAssembly = assembly;
+ ignoreCase = false;
+ resourceSetType = typeof (ResourceSet);
+ }
+
+ public ResourceManager (string baseName, Assembly assembly, Type usingResourceSet)
+ {
+ if (baseName == null || assembly == null)
+ throw new ArgumentNullException ("The arguments are null.");
+
+ BaseNameField = baseName;
+ MainAssembly = assembly;
+
+ if (usingResourceSet == null) // defaults resourceSet type.
+ resourceSetType = typeof (ResourceSet);
+ else {
+ if (!usingResourceSet.IsSubclassOf (typeof (ResourceSet)))
+ throw new ArgumentException ("Type must be from ResourceSet.");
+
+ }
+ }
+
+ [MonoTODO]
+ public static ResourceManager CreateFileBasedResourceManager (string baseName,
+ string resourceDir, Type usingResourceSet)
+ {
+ return null;
+ }
+
+ public virtual string BaseName
+ {
+ get { return BaseNameField; }
+ }
+
+ public virtual bool IgnoreCase
+ {
+ get { return ignoreCase; }
+ set { ignoreCase = value; }
+ }
+
+ public virtual Type ResourceSetType
+ {
+ get { return resourceSetType; }
+ }
+
+ [MonoTODO]
+ public virtual ResourceSet GetResourceSet (CultureInfo culture,
+ bool createIfNotExists, bool tryParents)
+
+ {
+ if (culture == null)
+ throw new ArgumentNullException ("CultureInfo is a null reference.");
+ return null;
+ }
+
+ [MonoTODO]
+ public virtual string GetString (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("Name is null.");
+ if (ResourceSets.Contains (name)) {
+ if (!(ResourceSets[name] is string))
+ throw new InvalidOperationException ("The resource is " +
+ "not a string.");
+ return ResourceSets[name].ToString();
+ }
+ return null;
+ }
+
+ [MonoTODO]
+ public virtual string GetString (string name, CultureInfo culture)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("Name is null.");
+ return null;
+ }
+
+ protected virtual string GetResourceFileName (CultureInfo culture)
+ {
+ return culture.Name + ".resources";
+ }
+
+ [MonoTODO]
+ protected virtual ResourceSet InternalGetResourceSet (CultureInfo culture,
+ bool Createifnotexists, bool tryParents)
+ {
+ return null;
+ }
+
+ public virtual void ReleaseAllResources ()
+ {
+ foreach (ResourceSet r in ResourceSets)
+ r.Close();
+ }
+
+ protected static CultureInfo GetNeutralResourcesLanguage (Assembly a)
+ {
+ foreach (Attribute attribute in a.GetCustomAttributes (false)) {
+ if (attribute is NeutralResourcesLanguageAttribute)
+ return new CultureInfo ((attribute as NeutralResourcesLanguageAttribute).CultureName);
+ }
+ return null;
+ }
+
+ protected static Version GetSatelliteContractVersion (Assembly a)
+ {
+ foreach (Attribute attribute in a.GetCustomAttributes (false)) {
+ if (attribute is SatelliteContractVersionAttribute)
+ return new Version ((attribute as SatelliteContractVersionAttribute).Version);
+ }
+ return null; // return null if no version was found.
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/ResourceReader.cs b/mcs/class/corlib/System.Resources/ResourceReader.cs
new file mode 100644
index 00000000000..6c2efa3fcf2
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/ResourceReader.cs
@@ -0,0 +1,265 @@
+//
+// System.Resources.ResourceReader.cs
+//
+// Authors:
+// Duncan Mak <duncan@ximian.com>
+// Nick Drochak <ndrochak@gol.com>
+//
+// 2001 (C) Ximian Inc, http://www.ximian.com
+//
+// TODO: Finish this
+
+using System.Collections;
+using System.Resources;
+using System.IO;
+
+namespace System.Resources
+{
+ class MonoTODO : Attribute {}
+ public sealed class ResourceReader : IResourceReader, IDisposable
+ {
+ Stream stream;
+ internal ArrayList resourceNames = null;
+ internal ArrayList resourceValues = null;
+ BinaryReader binaryReader;
+ internal int resourceCount = 0;
+ int typeCount = 0;
+ ArrayList typeArray = new ArrayList();
+ ArrayList hashes = new ArrayList();
+ ArrayList positions = new ArrayList();
+ int dataSectionOffset;
+
+ // Constructors
+ public ResourceReader (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("Value cannot be null.");
+
+ if (!stream.CanRead)
+ throw new ArgumentException ("Stream was not readable.");
+
+ this.stream = stream;
+
+ if (!IsStreamValid()){
+ throw new ArgumentException("Stream is not a valid .resources file! It was possibly truncated.");
+ }
+ }
+
+ public ResourceReader (string fileName)
+ {
+ if (fileName == null)
+ throw new ArgumentException ("Path cannot be null.");
+
+ if (String.Empty == fileName)
+ throw new ArgumentException("Empty path name is not legal.");
+
+ if (!System.IO.File.Exists (fileName))
+ throw new FileNotFoundException ("Could not find file " + Path.GetFullPath(fileName));
+
+ stream = new FileStream (fileName, FileMode.Open);
+
+ if (!IsStreamValid()){
+ throw new ArgumentException("Stream is not a valid .resources file! It was possibly truncated.");
+ }
+ }
+
+ [MonoTODO]
+ private bool IsStreamValid() {
+ // not sure how much to check to determine if it's valid,
+ // but look at magic number, version numbers and class names
+ string readerClass;
+ string resourceSetClass;
+ try {
+ binaryReader = new BinaryReader(stream);
+ int magicNumber = binaryReader.ReadInt32();
+ if (-1091581234 != magicNumber) {
+ return false;
+ }
+ int versionNumber = binaryReader.ReadInt32();
+ if (1 != versionNumber){
+ return false;
+ }
+ // Ignore next 32bits. they contain the length of the class name strings
+ binaryReader.ReadInt32();
+
+ readerClass = binaryReader.ReadString();
+ if (!readerClass.StartsWith("System.Resources.ResourceReader")){
+ return false;
+ }
+ resourceSetClass = binaryReader.ReadString();
+ if (!resourceSetClass.StartsWith("System.Resources.RuntimeResourceSet")){
+ return false;
+ }
+ int versionNumber2 = binaryReader.ReadInt32();
+ if (1 != versionNumber2){
+ return false;
+ }
+
+ resourceCount = binaryReader.ReadInt32();
+ typeCount = binaryReader.ReadInt32();
+
+ for (int i = 0; i < typeCount; i++) {
+ typeArray.Add(binaryReader.ReadString());
+ }
+ for (int i = 0; i < resourceCount; i++) {
+ hashes.Add(binaryReader.ReadInt32());
+ }
+ for (int i = 0; i < resourceCount; i++) {
+ positions.Add(binaryReader.ReadInt32());
+ }
+
+ dataSectionOffset = binaryReader.ReadInt32();
+
+ // LAMESPEC: what is the next Int32 here?
+ binaryReader.ReadInt32();
+ }
+ catch{
+ return false;
+ }
+ return true;
+ }
+
+ private string ReadString(BinaryReader br) {
+ return br.ReadString();
+ }
+
+ public void Close ()
+ {
+ stream.Close ();
+ stream = null;
+ }
+
+ public IDictionaryEnumerator GetEnumerator () {
+ if (null == stream){
+ throw new InvalidOperationException("ResourceReader is closed.");
+ }
+ else {
+ // STRATEGY: if this is the first enumerator requested, fill the hash.
+ // delaying in this way seems ok since there's not much you can do with just
+ // a reader except close it. And if you close it, you cannot get the enumerator.
+ // So, create the hash for the first enumerator, and re-use it for all others.
+ if (null == resourceNames) {
+ FillResources();
+ }
+ return new ResourceEnumerator (this);
+ }
+ }
+
+ internal struct NameOffsetPair {
+ public string name;
+ public int offset;
+ }
+
+ [MonoTODO]
+ private void FillResources(){
+ NameOffsetPair pair;
+ resourceNames = new ArrayList();
+ resourceValues = new ArrayList();
+ BinaryReader unicodeReader =
+ new BinaryReader(binaryReader.BaseStream, System.Text.Encoding.Unicode);
+ // TODO: need to put these in an array and work out when to get the values.
+ // also need to figure out the hash and how/if to use it.
+ for (int index=0; index < resourceCount; index++){
+ pair = new NameOffsetPair();
+ pair.name = unicodeReader.ReadString();
+ pair.offset = binaryReader.ReadInt32();
+ resourceNames.Add(pair);
+ }
+ for (int index=0; index < resourceCount; index++){
+ // LAMESPEC: what the heck is this byte here? always 0? just a separator?
+ binaryReader.ReadByte();
+ resourceValues.Add(binaryReader.ReadString());
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return ((IResourceReader) this).GetEnumerator();
+ }
+
+ [MonoTODO]
+ void IDisposable.Dispose ()
+ {
+ // FIXME: is this all we need to do?
+ Close();
+ }
+
+ internal class ResourceEnumerator : IDictionaryEnumerator
+ {
+ protected ResourceReader reader;
+ protected int index = -1;
+
+
+ internal ResourceEnumerator(ResourceReader readerToEnumerate){
+ reader = readerToEnumerate;
+ }
+
+ public virtual DictionaryEntry Entry
+ {
+ get {
+ if (null == reader.stream)
+ throw new InvalidOperationException("ResourceReader is closed.");
+ if (index < 0)
+ throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
+
+ DictionaryEntry entry = new DictionaryEntry();
+ entry.Key = Key;
+ entry.Value = Value;
+ return entry;
+ }
+ }
+
+ public virtual object Key
+ {
+ get {
+ if (null == reader.stream)
+ throw new InvalidOperationException("ResourceReader is closed.");
+ if (index < 0)
+ throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
+ return ((NameOffsetPair)(reader.resourceNames[index])).name;
+ }
+ }
+
+ public virtual object Value
+ {
+ get {
+ if (null == reader.stream)
+ throw new InvalidOperationException("ResourceReader is closed.");
+ if (index < 0)
+ throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
+ return reader.resourceValues[index];
+ }
+ }
+
+ public virtual object Current
+ {
+ get {
+ if (null == reader.stream)
+ throw new InvalidOperationException("ResourceReader is closed.");
+ if (index < 0)
+ throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
+ return Entry;
+ }
+ }
+
+ public virtual bool MoveNext ()
+ {
+ if (null == reader.stream)
+ throw new InvalidOperationException("ResourceReader is closed.");
+ if (++index < reader.resourceCount){
+ return true;
+ }
+ else {
+ --index;
+ return false;
+ }
+ }
+
+ public void Reset () {
+ if (null == reader.stream)
+ throw new InvalidOperationException("ResourceReader is closed.");
+ index = -1;
+ }
+ } // internal class ResourceEnumerator
+ } // public sealed class ResourceReader
+} // namespace System.Resources
diff --git a/mcs/class/corlib/System.Resources/ResourceSet.cs b/mcs/class/corlib/System.Resources/ResourceSet.cs
new file mode 100644
index 00000000000..d96df5e5fa2
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/ResourceSet.cs
@@ -0,0 +1,127 @@
+//
+// System.Resources.ResourceSet.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+using System.IO;
+
+namespace System.Resources
+{
+ [Serializable]
+ public class ResourceSet : IDisposable
+ {
+
+ protected IResourceReader Reader;
+ protected Hashtable Table;
+
+ // Constructors
+ protected ResourceSet () {}
+ public ResourceSet (IResourceReader reader)
+ {
+ if (reader == null)
+ throw new ArgumentNullException ("The reader is null.");
+ Reader = reader;
+ }
+
+ public ResourceSet (Stream stream)
+ {
+ Reader = new ResourceReader (stream);
+ }
+
+ public ResourceSet (String fileName)
+ {
+ Reader = new ResourceReader (fileName);
+ }
+
+ public virtual void Close ()
+ {
+ Dispose (true);
+ }
+
+ public void Dispose()
+ {
+ Dispose (true);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (disposing) {
+ Reader = null;
+ Table = null;
+ }
+ }
+
+ public virtual Type GetDefaultReader ()
+ {
+ return (typeof (ResourceReader));
+ }
+ public virtual Type GetDefaultWriter ()
+ {
+ return (typeof (ResourceWriter));
+ }
+
+ public virtual object GetObject (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("The name parameter is null.");
+ if (Reader == null)
+ throw new InvalidOperationException ("The ResourceSet has been closed.");
+ if (Table == null) {
+ ReadResources ();
+ return Table[name];
+ } else
+ return Table[name];
+ }
+ public virtual object GetObject (string name, bool ignoreCase)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("The name parameter is null.");
+ if (Reader == null)
+ throw new InvalidOperationException ("ResourceSet has been closed.");
+ if (Table == null)
+ ReadResources ();
+ if (ignoreCase) {
+ foreach (DictionaryEntry de in Table) {
+ string key = (string) de.Key;
+ if (String.Compare (key, name, true) == 0)
+ return de.Value;
+ }
+ return null;
+ } else
+ return Table[name];
+ }
+
+ public virtual string GetString (string name)
+ {
+ Object o = GetObject (name);
+ if (o is string)
+ return (string) o;
+ return null;
+ }
+
+ public virtual string GetString (string name, bool ignoreCase)
+ {
+ Object o = GetObject (name, ignoreCase);
+ if (o is string)
+ return (string) o;
+ return null;
+ }
+
+ protected virtual void ReadResources ()
+ {
+ IDictionaryEnumerator i = Reader.GetEnumerator();
+
+ if (Table == null)
+ Table = new Hashtable ();
+ i.Reset ();
+
+ while (i.MoveNext ())
+ Table.Add (i.Key, i.Value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/ResourceWriter.cs b/mcs/class/corlib/System.Resources/ResourceWriter.cs
new file mode 100644
index 00000000000..d815ac76b3d
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/ResourceWriter.cs
@@ -0,0 +1,64 @@
+//
+// System.Resources.ResourceWriter.cs
+//
+// Author:
+// Duncan Mak <duncan@ximian.com>
+//
+// 2001 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.IO;
+
+namespace System.Resources
+{
+ public sealed class ResourceWriter : IResourceWriter
+ {
+ [MonoTODO]
+ public ResourceWriter (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException ("stream is null");
+ if (stream.CanWrite == false)
+ throw new ArgumentException ("stream is not writable.");
+ }
+
+ [MonoTODO]
+ public ResourceWriter (String fileName)
+ {
+ if (fileName == null)
+ throw new ArgumentNullException ("fileName is null.");
+ }
+
+ [MonoTODO]
+ public void AddResource (string name, byte[] value)
+ {
+ if (name == null || value == null)
+ throw new ArgumentNullException ("Parameter is a null reference.");
+ }
+
+ [MonoTODO]
+ public void AddResource (string name, object value)
+ {
+ if (name == null || value == null)
+ throw new ArgumentNullException ("Parameter is a null reference.");
+ }
+
+ [MonoTODO]
+ public void AddResource (string name, string value)
+ {
+ if (name == null || value == null)
+ throw new ArgumentNullException ("Parameter is a null reference.");
+ }
+
+ [MonoTODO]
+ public void Close () {}
+
+ public void Dispose ()
+ {
+ Close();
+ }
+
+ [MonoTODO]
+ public void Generate () {}
+ }
+}
diff --git a/mcs/class/corlib/System.Resources/SatelliteContractVersionAttribute.cs b/mcs/class/corlib/System.Resources/SatelliteContractVersionAttribute.cs
new file mode 100644
index 00000000000..a0bf1bd0614
--- /dev/null
+++ b/mcs/class/corlib/System.Resources/SatelliteContractVersionAttribute.cs
@@ -0,0 +1,27 @@
+//
+// System.Resources.SatelliteContractVersionAttribute.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Resources
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class SatelliteContractVersionAttribute : Attribute
+ {
+ private Version ver;
+
+ // Constructor
+ public SatelliteContractVersionAttribute (string version)
+ {
+ ver = new Version(version);
+ }
+ public string Version
+ {
+ get { return ver.ToString(); }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/ChangeLog b/mcs/class/corlib/System.Runtime.CompilerServices/ChangeLog
new file mode 100644
index 00000000000..f59f55bfc2e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/ChangeLog
@@ -0,0 +1,15 @@
+2002-04-15 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * MethodImplAttribute.cs: added constructor usage.
+
+Fri Feb 22 15:36:19 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * RuntimeHelpers.cs: added OffsetToStringData() property.
+
+Mon Nov 5 19:50:11 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * RuntimeHelpers.cs: make InitializeArray an internalcall.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * MethodCodeType.cs, MethodImplOptions.cs: Add.
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/IndexerNameAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/IndexerNameAttribute.cs
new file mode 100755
index 00000000000..cf61a66b979
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/IndexerNameAttribute.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.CompilerServices.IndexerNameAttributecs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.CompilerServices {
+
+ [AttributeUsage(AttributeTargets.Property, Inherited=false)] [Serializable]
+ public sealed class IndexerNameAttribute : Attribute {
+ public IndexerNameAttribute (string indexer_name)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/MethodCodeType.cs b/mcs/class/corlib/System.Runtime.CompilerServices/MethodCodeType.cs
new file mode 100644
index 00000000000..3608120e516
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/MethodCodeType.cs
@@ -0,0 +1,23 @@
+//------------------------------------------------------------------------------
+//
+// System.Runtime.CompilerServices.MethodCodeType.cs
+//
+// Copyright (C) 2001 Michael Lambert, All Rights Reserved
+//
+// Author: Michael Lambert, michaellambert@email.com
+// Created: Thu 07/18/2001
+//
+//------------------------------------------------------------------------------
+
+namespace System.Runtime.CompilerServices
+{
+
+public enum MethodCodeType
+{
+ IL,
+ Native,
+ OPTIL,
+ Runtime,
+}
+
+} // Namespace
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplAttribute.cs b/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplAttribute.cs
new file mode 100644
index 00000000000..41aed97dcab
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplAttribute.cs
@@ -0,0 +1,40 @@
+//
+// System.Runtime.CompilerServices.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Runtime.CompilerServices {
+
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited=false)] [Serializable]
+ public sealed class MethodImplAttribute : Attribute {
+ MethodImplOptions impl_options;
+
+ public MethodImplAttribute ()
+ {
+ }
+
+ public MethodImplAttribute (short options)
+ {
+ impl_options = (MethodImplOptions) options;
+ }
+
+ public MethodImplAttribute (MethodImplOptions options)
+ {
+ impl_options = options;
+ }
+
+ public MethodCodeType MethodCodeType;
+
+ public MethodImplOptions Value {
+ get {
+ return impl_options;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplOptions.cs b/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplOptions.cs
new file mode 100644
index 00000000000..347c38569a4
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/MethodImplOptions.cs
@@ -0,0 +1,41 @@
+// MethodImplOptions.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:23 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.CompilerServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum MethodImplOptions {
+
+ /// <summary>
+ /// </summary>
+ Unmanaged = 4,
+
+ /// <summary>
+ /// </summary>
+ ForwardRef = 16,
+
+ /// <summary>
+ /// </summary>
+ InternalCall = 4096,
+
+ /// <summary>
+ /// </summary>
+ Synchronized = 32,
+
+ /// <summary>
+ /// </summary>
+ NoInlining = 8,
+ } // MethodImplOptions
+
+} // System.Runtime.CompilerServices
diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs b/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs
new file mode 100644
index 00000000000..c87eb39d915
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.CompilerServices/RuntimeHelpers.cs
@@ -0,0 +1,26 @@
+// System.Runtime.CompilerServices.RuntimeHelpers
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) Ximian, Inc. 2001
+
+namespace System.Runtime.CompilerServices
+{
+ [Serializable]
+ public sealed class RuntimeHelpers
+ {
+ private RuntimeHelpers () {}
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern void InitializeArray (Array array, RuntimeFieldHandle fldHandle);
+
+ public static int OffsetToStringData {
+ get {
+ // FIXME: this requires the reimplementation of String
+ // as of my mail a few months ago, dum de dum
+ throw new NotImplementedException ();
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/AssemblyRegistrationFlags.cs b/mcs/class/corlib/System.Runtime.InteropServices/AssemblyRegistrationFlags.cs
new file mode 100755
index 00000000000..0360d868163
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/AssemblyRegistrationFlags.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.InteropServices.AssemblyRegistrationFlags.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices
+{
+ [Flags]
+ [Serializable]
+ public enum AssemblyRegistrationFlags {
+ None = 0,
+ SetCodeBase = 0,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/AutomationProxyAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/AutomationProxyAttribute.cs
new file mode 100755
index 00000000000..3dfdc572adb
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/AutomationProxyAttribute.cs
@@ -0,0 +1,28 @@
+//
+// System.Runtime.InteropServices.AutomationProxyAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Interface)]
+ public sealed class AutomationProxyAttribute : Attribute
+ {
+ bool val;
+
+ public AutomationProxyAttribute (bool val)
+ {
+ this.val = val;
+ }
+
+ public bool Value {
+ get { return val; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/CallingConvention.cs b/mcs/class/corlib/System.Runtime.InteropServices/CallingConvention.cs
new file mode 100644
index 00000000000..7f2c24d2b0c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/CallingConvention.cs
@@ -0,0 +1,41 @@
+// CallingConvention.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:29 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.InteropServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum CallingConvention {
+
+ /// <summary>
+ /// </summary>
+ Winapi = 1,
+
+ /// <summary>
+ /// </summary>
+ Cdecl = 2,
+
+ /// <summary>
+ /// </summary>
+ StdCall = 3,
+
+ /// <summary>
+ /// </summary>
+ ThisCall = 4,
+
+ /// <summary>
+ /// </summary>
+ FastCall = 5,
+ } // CallingConvention
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog b/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
new file mode 100644
index 00000000000..904dd6eadb5
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ChangeLog
@@ -0,0 +1,133 @@
+2002-04-23 Joe Shaw <joe@ximian.com>
+
+ * Marshal.cs: Stub out a few functions to get gtk# to build.
+
+2002-04-22 Duncan Mak <duncan@ximian.com>
+
+ * ImporterEventKind.cs:
+ * TypeLibFuncFlags.cs:
+ * TypeLibTypeFlags.cs:
+ * TypeLibVarFlags.cs: Fixed various typos and added missing elements.
+
+ * ComConventionLossAttribute.cs: Removed, there's a typo.
+ * ComConversionLossAttribute.cs: Same attribute, slight change of name.
+
+ * PreserveSigAttribute.cs:
+ * ImportedFromTypeLibAttribute.cs: Added missing AttributeUsage
+ attribute.
+
+ * TypeLibFuncAttribute.cs:
+ * TypeLibTypeAttribute.cs:
+ * TypeLibVarAttribute.cs: Added missing constructors.
+
+
+2002-04-22 Duncan Mak <duncan@ximian.com>
+
+ * AutomationProxyAttribute.cs:
+ * CoClassAttribute.cs:
+ * ComAliasNameAttribute.cs:
+ * ComConventionLossAttribute.cs:
+ * ComEventInterfaceAttribute.cs:
+ * ComImportAttribute.cs:
+ * ComRegisterFunctionAttribute.cs:
+ * ComUnregisterFunctionAttribute.cs:
+ * DispIdAttribute.cs:
+ * ImportedFromTypeLibAttribute.cs:
+ * LCIDConversionAttribute.cs:
+ * PreserveSigAttribute.cs:
+ * PrimaryInteropAssemblyAttribute.cs:
+ * ProgIdAttribute.cs:
+ * TypeLibFuncAttribute.cs:
+ * TypeLibFuncFlags.cs:
+ * TypeLibTypeAttribute.cs:
+ * TypeLibTypeFlags.cs:
+ * TypeLibVarAttribute.cs:
+ * TypeLibVarFlags.cs: Added to CVS.
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * Marshal.cs: Make class public.
+ * ComVisible.cs: New File.
+
+2002-03-24 Nick Drochak <ndrochak@gol.com>
+
+ * ClassInterfaceAttribute.cs:
+ * ClassInterfaceType.cs: New Files.
+
+2002-02-27 Duncan Mak <duncan@ximian.com>
+
+ * ExporterEventKind.cs:
+ * ITypeLibConverter.cs:
+ * ITypeLibImporterNotifySink.cs: Added to CVS for Kevin Winchester <kwin@ns.sympatico.ca>.
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * ComInterfaceType.cs: Added to CVS.
+
+ * AssemblyRegistrationFlags.cs:
+ * GuidAttribute.cs:
+ * ICustomAdapter.cs:
+ * ICustomFactory.cs:
+ * ICustomMarshaler.cs:
+ * IRegistrationServices.cs:
+ * ITypeLibExporterNameProvider.cs:
+ * ITypeLibImporterNotifySink.cs:
+ * InterfaceTypeAttribute.cs:
+ * TypeLibExporterFlags.cs: Committed for Kevin Winchester <kwin@ns.sympatico.ca>.
+
+ * GCHandle.cs: Added to CVS. Patch from Ajay kumar Dwivedi.
+
+ * GCHandleType.cs: Committed patch from Ajay.
+
+ * ImporterEventKind.cs: Added to CVS.
+
+2002-01-24 Miguel de Icaza <miguel@ximian.com>
+
+ * StructLayoutAttribute.cs: Flag attribute as targetting structs
+ or classes.
+
+ * InAttribute.cs: Flag attribute as targettting a paramter
+
+ * OutAttribute.cs: ditto.
+
+ * DllImportAttribute.cs: Flag attribute as targetting methods.
+
+ * MarshalAsAttribute.cs: Flag attribute as targetting fields,
+ parameters and returnvalues.
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * Marshal.cs: Added GetLastWin32Error()
+
+ * ExternalException.cs: Implemented
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * ExternalException.cs: Add ExternalException.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * OutAttribute.cs : Decorate with MonoTODO.
+
+Thu Dec 20 15:46:31 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * FieldOffsetAttribute.cs, InAttribute.cs, MarshalAsAttribute.cs,
+ OptionalAttribute.cs, StructLayoutAttribute.cs, VarEnum.cs:
+ more stuff needed by the compiler.
+
+Thu Dec 13 20:22:18 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * DllImportAttribute.cs: added.
+ * MethodImplOptions.cs: removed: this is already in CompilerServices.
+
+Wed Nov 14 17:02:57 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * CallingConvention.cs: add missing Winapi.
+
+2001-07-20 Miguel de Icaza <miguel@ximian.com>
+
+ * OutAttribute.cs: New file.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * CallingConvention.cs.cs, CharSet.cs, GCHandleType.cs, LayoutKind.cs: Add.
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/CharSet.cs b/mcs/class/corlib/System.Runtime.InteropServices/CharSet.cs
new file mode 100644
index 00000000000..df1443f63ee
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/CharSet.cs
@@ -0,0 +1,33 @@
+// CharSet.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:35 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.InteropServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum CharSet {
+
+ /// <summary>
+ /// </summary>
+ Ansi = 2,
+
+ /// <summary>
+ /// </summary>
+ Unicode = 3,
+
+ /// <summary>
+ /// </summary>
+ Auto = 4,
+ } // CharSet
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceAttribute.cs
new file mode 100644
index 00000000000..47aa4ebed92
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceAttribute.cs
@@ -0,0 +1,30 @@
+//
+// System.Runtime.InteropServices.ClassInterfaceAttribute.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2002 Nick Drochak
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class)]
+ public sealed class ClassInterfaceAttribute : Attribute {
+ private ClassInterfaceType ciType;
+
+ public ClassInterfaceAttribute ( short classInterfaceType ) {
+ ciType = (ClassInterfaceType)classInterfaceType;
+ }
+
+ public ClassInterfaceAttribute ( ClassInterfaceType classInterfaceType ) {
+ ciType = classInterfaceType;
+ }
+
+ public ClassInterfaceType Value {
+ get {return ciType;}
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceType.cs b/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceType.cs
new file mode 100644
index 00000000000..963c2880a1a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ClassInterfaceType.cs
@@ -0,0 +1,24 @@
+//
+// System.Runtime.InteropServices.ClassInterfaceType.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2002 Nick Drochak
+//
+
+
+namespace System.Runtime.InteropServices {
+
+ [Serializable]
+ public enum ClassInterfaceType
+ {
+ None = 0,
+
+ AutoDispatch = 1,
+
+ AutoDual = 2
+
+ } // ClassInterfaceType
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/CoClassAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/CoClassAttribute.cs
new file mode 100755
index 00000000000..c947887612d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/CoClassAttribute.cs
@@ -0,0 +1,26 @@
+//
+// System.Runtime.InteropServices.CoClassAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Interface)]
+ public sealed class CoClassAttribute : Attribute
+ {
+
+ Type klass;
+
+ public CoClassAttribute (Type coClass)
+ {
+ klass = coClass;
+ }
+
+ public Type CoClass {
+ get { return klass; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComAliasNameAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComAliasNameAttribute.cs
new file mode 100755
index 00000000000..60119849175
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComAliasNameAttribute.cs
@@ -0,0 +1,27 @@
+//
+// System.Runtime.InteropServices.ComAliasNameAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+ [AttributeUsage (AttributeTargets.Property | AttributeTargets.Field |
+ AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public sealed class ComAliasNameAttribute : Attribute
+ {
+ string val;
+
+ public ComAliasNameAttribute (string alias)
+ {
+ val = alias;
+ }
+
+ public string Value {
+ get { return val; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComConversionLossAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComConversionLossAttribute.cs
new file mode 100755
index 00000000000..2260d5ae488
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComConversionLossAttribute.cs
@@ -0,0 +1,21 @@
+//
+// System.Runtime.InteropServices.ComConversionLossAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.All)]
+ public sealed class ComConversionLossAttribute : Attribute
+ {
+ public ComConversionLossAttribute ()
+ {
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComEventInterfaceAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComEventInterfaceAttribute.cs
new file mode 100755
index 00000000000..f03e371c898
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComEventInterfaceAttribute.cs
@@ -0,0 +1,34 @@
+//
+// System.Runtime.InteropServices.ComEventInterfaceAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Interface)]
+ public sealed class ComEventInterfaceAttribute : Attribute
+ {
+ Type si, ep;
+
+ public ComEventInterfaceAttribute (Type SourceInterface,
+ Type EventProvider)
+ {
+ si = SourceInterface;
+ ep = EventProvider;
+ }
+
+ public Type EventProvider {
+ get { return ep; }
+ }
+
+ public Type SourceInterface {
+ get { return si; }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs
new file mode 100755
index 00000000000..325c5091f7b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComImportAttribute.cs
@@ -0,0 +1,21 @@
+//
+// System.Runtime.InteropServices.ComImportAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Class |
+ AttributeTargets.Interface)]
+ public sealed class ComImportAttribute : Attribute
+ {
+ public ComImportAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComInterfaceType.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComInterfaceType.cs
new file mode 100755
index 00000000000..8d7c7a6b669
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComInterfaceType.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.InteropServices.ComInterfaceType.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices
+{
+ [Serializable] public enum ComInterfaceType
+ {
+ InterfaceIsDual = 0,
+ InterfaceIsIUnknown = 1,
+ InterfaceIsIDispatch = 2,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComRegisterFunctionAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComRegisterFunctionAttribute.cs
new file mode 100755
index 00000000000..27a27076213
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComRegisterFunctionAttribute.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.InteropServices.ComRegisterFunctionAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class ComRegisterFunctionAttribute : Attribute
+ {
+ public ComRegisterFunctionAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComUnregisterFunctionAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComUnregisterFunctionAttribute.cs
new file mode 100755
index 00000000000..6d2fc1ed2e1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComUnregisterFunctionAttribute.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.InteropServices.ComUnregisterFunctionAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class ComUnregisterFunctionAttribute : Attribute
+ {
+ public ComUnregisterFunctionAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ComVisible.cs b/mcs/class/corlib/System.Runtime.InteropServices/ComVisible.cs
new file mode 100644
index 00000000000..ad22b254c23
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ComVisible.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.InteropServices.ComVisible.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2002 Nick Drochak
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
+ | AttributeTargets.Struct | AttributeTargets.Enum |
+ AttributeTargets.Method | AttributeTargets.Property |
+ AttributeTargets.Field | AttributeTargets.Interface |
+ AttributeTargets.Delegate)]
+ public sealed class ComVisibleAttribute : Attribute
+ {
+ private bool Visible = false;
+ public ComVisibleAttribute(bool value) {Visible = value;}
+ public bool Value { get {return Visible;} }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/DispIdAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/DispIdAttribute.cs
new file mode 100755
index 00000000000..139c331bb53
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/DispIdAttribute.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.InteropServices.DispIdAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method | AttributeTargets.Property |
+ AttributeTargets.Field | AttributeTargets.Event)]
+ public sealed class DispIdAttribute : Attribute
+ {
+ int id;
+
+ public DispIdAttribute (int dispId)
+ {
+ id = dispId;
+ }
+
+ public int Value {
+ get { return id; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/DllImportAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/DllImportAttribute.cs
new file mode 100755
index 00000000000..9d6466527ea
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/DllImportAttribute.cs
@@ -0,0 +1,33 @@
+//
+// System.Runtime.InteropServices/DllImportAttribute.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class DllImportAttribute: Attribute {
+ public CallingConvention CallingConvention;
+ public CharSet CharSet;
+ public string EntryPoint;
+ public bool ExactSpelling;
+ public bool PreserveSig;
+ public bool SetLastError;
+ private string Dll;
+
+ public string Value {
+ get {return Dll;}
+ }
+
+ public DllImportAttribute (string dllName) {
+ Dll = dllName;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ExporterEventKind.cs b/mcs/class/corlib/System.Runtime.InteropServices/ExporterEventKind.cs
new file mode 100644
index 00000000000..d80e2ed847d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ExporterEventKind.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.InteropServices.ExporterEventKind.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices
+{
+ [Serializable] public enum ExporterEventKind
+ {
+ NOTIF_TYPECONVERTED = 0,
+ NOTIF_CONVERTWARNING = 1,
+ ERROR_REFTOINVALIDASSEMBLY = 2,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ExternalException.cs b/mcs/class/corlib/System.Runtime.InteropServices/ExternalException.cs
new file mode 100755
index 00000000000..014074cef21
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ExternalException.cs
@@ -0,0 +1,50 @@
+//
+// System.Runtime.InteropServices.ExternalException.cs
+//
+// Author:
+// Miguel De Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System.Runtime.InteropServices {
+ [Serializable]
+ public class ExternalException : SystemException {
+ private int error_code;
+
+ // Constructors
+ public ExternalException ()
+ : base (Locale.GetText ("External exception"))
+ {
+ }
+
+ public ExternalException (string message)
+ : base (message)
+ {
+ }
+
+ protected ExternalException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public ExternalException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public ExternalException (string message, int errorCode)
+ : base (message)
+ {
+ error_code = errorCode;
+ }
+
+ public virtual int ErrorCode {
+ get {
+ return error_code;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/FieldOffsetAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/FieldOffsetAttribute.cs
new file mode 100755
index 00000000000..a5deebb0675
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/FieldOffsetAttribute.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Field)]
+ public sealed class FieldOffsetAttribute : Attribute {
+ private int val;
+
+ public FieldOffsetAttribute( int offset) {
+ val = offset;
+ }
+ public int Value {
+ get {return val;}
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs b/mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs
new file mode 100755
index 00000000000..4eafe919d9e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/GCHandle.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+namespace System.Runtime.InteropServices
+{
+ /// <summary>
+ /// Summary description for GCHandle.
+ /// </summary>
+ public struct GCHandle
+ {
+ // fields
+ private IntPtr handle;
+ private GCHandleType handleType;
+
+ // Constructors
+ private GCHandle(object obj)
+ : this(obj, GCHandleType.Normal)
+ {}
+
+ private GCHandle(object value, GCHandleType type)
+ {
+ handle = IntPtr.Zero;
+ handleType = type;
+ }
+
+ // Properties
+
+ public bool IsAllocated
+ {
+ get
+ {
+ return (handle != IntPtr.Zero);
+ }
+ }
+
+ public object Target
+ {
+ get
+ {
+ return GetTarget(handle);
+ }
+ set
+ {
+ SetTarget(handle,value);
+ }
+ }
+
+ // Methods
+ public IntPtr AddrOfPinnedObject()
+ {
+ if(this.handleType == System.Runtime.InteropServices.GCHandleType.Pinned)
+ {
+ throw new InvalidOperationException("The handle is not of Pinned type");
+ }
+ return GetAddrOfPinnedObject();
+ }
+
+ public static System.Runtime.InteropServices.GCHandle Alloc(object value)
+ {
+ return new GCHandle(value);
+ }
+
+ public static System.Runtime.InteropServices.GCHandle Alloc(object value, GCHandleType type)
+ {
+ return new GCHandle(value,type);
+ }
+
+ public void Free()
+ {
+ FreeHandle(handle);
+ handle = IntPtr.Zero;
+ }
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static explicit operator IntPtr(GCHandle value);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static explicit operator GCHandle(IntPtr value);
+
+ //TODO: Private Native Functions
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern object GetTarget(IntPtr pointer);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void SetTarget(IntPtr pointer,object obj);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void FreeHandle(IntPtr pointer);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern IntPtr GetAddrOfPinnedObject();
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/GCHandleType.cs b/mcs/class/corlib/System.Runtime.InteropServices/GCHandleType.cs
new file mode 100644
index 00000000000..bee7c8b8436
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/GCHandleType.cs
@@ -0,0 +1,38 @@
+// GCHandleType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:42 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.InteropServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum GCHandleType {
+
+
+ /// <summary>
+ /// </summary>
+ Weak = 0,
+
+ /// <summary>
+ /// </summary>
+ WeakTrackResurrection = 1,
+
+ /// <summary>
+ /// </summary>
+ Normal = 2,
+
+ /// <summary>
+ /// </summary>
+ Pinned = 3,
+ } // GCHandleType
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/GuidAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/GuidAttribute.cs
new file mode 100755
index 00000000000..1fd1a44f85e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/GuidAttribute.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.InteropServices.InAttribute.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate)]
+ public sealed class GuidAttribute : Attribute {
+
+ private string guidValue;
+
+ public GuidAttribute (string guid) {
+ guidValue = guid;
+ }
+
+ public string Value {
+ get {return guidValue;}
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ICustomAdapter.cs b/mcs/class/corlib/System.Runtime.InteropServices/ICustomAdapter.cs
new file mode 100755
index 00000000000..edde7b22cc0
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ICustomAdapter.cs
@@ -0,0 +1,15 @@
+//
+// System.Runtime.InteropServices.ICustomAdapter.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ public interface ICustomAdapter {
+ object GetUnderlyingObject ();
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ICustomFactory.cs b/mcs/class/corlib/System.Runtime.InteropServices/ICustomFactory.cs
new file mode 100755
index 00000000000..c5f1cb23eea
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ICustomFactory.cs
@@ -0,0 +1,15 @@
+//
+// System.Runtime.InteropServices.ICustomFactory.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ public interface ICustomFactory {
+ MarshalByRefObject CreateInstance (Type serverType);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ICustomMarshaler.cs b/mcs/class/corlib/System.Runtime.InteropServices/ICustomMarshaler.cs
new file mode 100755
index 00000000000..90a2b29b619
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ICustomMarshaler.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.InteropServices.ICustomMarshaler.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ public interface ICustomMarshaler {
+ void CleanUpManagedData (object ManagedObj);
+ void CleanUpNativeData (IntPtr pNativeData);
+ int GetNativeDataSize ();
+ IntPtr MarshalManagedToNative (object ManagedObj);
+ object MarshalNativeToManaged (IntPtr pNativeData);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/IRegistrationServices.cs b/mcs/class/corlib/System.Runtime.InteropServices/IRegistrationServices.cs
new file mode 100755
index 00000000000..a42e935895c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/IRegistrationServices.cs
@@ -0,0 +1,25 @@
+//
+// System.Runtime.InteropServices.IRegistrationServices.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+using System.Reflection;
+
+namespace System.Runtime.InteropServices {
+
+ //[Guid("")]
+ public interface IRegistrationServices {
+ Guid GetManagedCategoryGuid ();
+ string GetProgIdForType (Type type);
+ Type[] GetRegistrableTypesInAssembly (Assembly assembly);
+ bool RegisterAssembly (Assembly assembly, AssemblyRegistrationFlags flags);
+ void RegisterTypeForComClients (Type type, ref Guid g);
+ bool TypeRepresentsComType (Type type);
+ bool TypeRequiresRegistration (Type type);
+ bool UnregisterAssembly (Assembly assembly);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibConverter.cs b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibConverter.cs
new file mode 100644
index 00000000000..78be2912f6b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibConverter.cs
@@ -0,0 +1,22 @@
+//
+// System.Runtime.InteropServices.ITypeLibConverter.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+using System.Reflection;
+using System.Reflection.Emit;
+
+namespace System.Runtime.InteropServices {
+
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ITypeLibConverter {
+ object ConvertAssemblyToTypeLib (Assembly assembly, string typeLibName, TypeLibExporterFlags flags, ITypeLibExporterNotifySink notifySink);
+ AssemblyBuilder ConvertTypeLibToAssembly (object typeLib, string asmFileName, int flags, ITypeLibImporterNotifySink notifySink, byte[] publicKey, StrongNameKeyPair keyPair, bool unsafeInterfaces);
+ bool GetPrimaryInteropAssembly (Guid g, int major, int minor, int lcid, out string asmName, out string asmCodeBase);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs
new file mode 100755
index 00000000000..3e937ae4b22
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.InteropServices.ITypeLibExporterNameProvider.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ITypeLibExporterNameProvider {
+ string[] GetNames ();
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs
new file mode 100644
index 00000000000..547b87d73d3
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.InteropServices.ITypeLibExporterNotifySink.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+using System.Reflection;
+
+namespace System.Runtime.InteropServices {
+
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ITypeLibExporterNotifySink {
+ void ReportEvent (ExporterEventKind eventKind, int eventCode, string eventMsg);
+ object ResolveRef (Assembly assembly);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs
new file mode 100755
index 00000000000..3c9199e4063
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.InteropServices.ITypeLibImporterNotifySink.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+using System.Reflection;
+
+namespace System.Runtime.InteropServices {
+
+ //[Guid("")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ITypeLibImporterNotifySink {
+ void ReportEvent(ImporterEventKind eventKind, int eventCode, string eventMsg);
+ Assembly ResolveRef(object typeLib);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ImportedFromTypeLibAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ImportedFromTypeLibAttribute.cs
new file mode 100755
index 00000000000..f4403eb8c27
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ImportedFromTypeLibAttribute.cs
@@ -0,0 +1,26 @@
+//
+// System.Runtime.InteropServices.ImportedFromTypeLibAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class ImportedFromTypeLibAttribute : Attribute
+ {
+ string TlbFile;
+ public ImportedFromTypeLibAttribute (string tlbFile)
+ {
+ TlbFile = tlbFile;
+ }
+
+ public string Value {
+ get { return TlbFile; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ImporterEventKind.cs b/mcs/class/corlib/System.Runtime.InteropServices/ImporterEventKind.cs
new file mode 100755
index 00000000000..c896b7e053f
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ImporterEventKind.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.InteropServices.ImporterEventKind.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices
+{
+ [Serializable] public enum ImporterEventKind
+ {
+ NOTIF_TYPECONVERTED = 0,
+ NOTIF_CONVERTWARNING = 1,
+ ERROR_REFTOINVALIDTYPELIB = 2,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/InAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/InAttribute.cs
new file mode 100755
index 00000000000..b141d9dbc49
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/InAttribute.cs
@@ -0,0 +1,18 @@
+//
+// System.Runtime.InteropServices.InAttribute.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Parameter)]
+ public sealed class InAttribute : Attribute {
+ public InAttribute () {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/InterfaceTypeAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/InterfaceTypeAttribute.cs
new file mode 100755
index 00000000000..e8cbd5ae9b7
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/InterfaceTypeAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.Runtime.InteropServices.InterfaceTypeAttribute.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage(AttributeTargets.Interface)]
+ public sealed class InterfaceTypeAttribute : Attribute {
+
+ private ComInterfaceType intType;
+
+ public InterfaceTypeAttribute (ComInterfaceType interfaceType){
+ intType = interfaceType;
+ }
+
+ public InterfaceTypeAttribute (short interfaceType) {
+ intType = (ComInterfaceType)interfaceType;
+ }
+
+ public ComInterfaceType Value {
+ get {return intType;}
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/LCIDConversionAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/LCIDConversionAttribute.cs
new file mode 100755
index 00000000000..af04cccc1e4
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/LCIDConversionAttribute.cs
@@ -0,0 +1,27 @@
+//
+// System.Runtime.InteropServices.LCIDConversionAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class LCIDConversionAttribute : Attribute
+ {
+ int id;
+
+ public LCIDConversionAttribute (int lcid)
+ {
+ id = lcid;
+ }
+
+ public int Value {
+ get { return id; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/LayoutKind.cs b/mcs/class/corlib/System.Runtime.InteropServices/LayoutKind.cs
new file mode 100644
index 00000000000..960cc3d551e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/LayoutKind.cs
@@ -0,0 +1,33 @@
+// LayoutKind.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:33:48 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.InteropServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum LayoutKind {
+
+ /// <summary>
+ /// </summary>
+ Sequential = 0,
+
+ /// <summary>
+ /// </summary>
+ Explicit = 2,
+
+ /// <summary>
+ /// </summary>
+ Auto = 3,
+ } // LayoutKind
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs
new file mode 100644
index 00000000000..55cacc4c3b8
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs
@@ -0,0 +1,38 @@
+// System.Runtime.InteropServices.Marshal
+//
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+
+using System.Runtime.CompilerServices;
+
+namespace System.Runtime.InteropServices
+{
+ public sealed class Marshal
+ {
+ private Marshal () {}
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern string PtrToStringAuto (IntPtr ptr);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern IntPtr ReadIntPtr (IntPtr ptr);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern int GetLastWin32Error();
+
+ [MonoTODO]
+ public static IntPtr AllocHGlobal (IntPtr cb) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static IntPtr AllocHGlobal (int cb) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static void FreeHGlobal (IntPtr hglobal) {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/MarshalAsAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/MarshalAsAttribute.cs
new file mode 100755
index 00000000000..48e9f523d07
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/MarshalAsAttribute.cs
@@ -0,0 +1,27 @@
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
+ public sealed class MarshalAsAttribute : Attribute {
+ private UnmanagedType utype;
+ public UnmanagedType ArraySubType;
+ public string MarshalCookie;
+ public string MarshalType;
+ public Type MarshalTypeRef;
+ public VarEnum SafeArraySubType;
+ public int SizeConst;
+ public short SizeParamIndex;
+
+ public MarshalAsAttribute (short unmanagedType) {
+ utype = (UnmanagedType)unmanagedType;
+ }
+ public MarshalAsAttribute( UnmanagedType unmanagedType) {
+ utype = unmanagedType;
+ }
+ public UnmanagedType Value {
+ get {return utype;}
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/OptionalAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/OptionalAttribute.cs
new file mode 100755
index 00000000000..d53f5291fa0
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/OptionalAttribute.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Parameter)]
+ public sealed class OptionalAttribute : Attribute {
+ public OptionalAttribute () {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/OutAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/OutAttribute.cs
new file mode 100644
index 00000000000..868bc61468b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/OutAttribute.cs
@@ -0,0 +1,26 @@
+//
+// System.Runtime.InteropServices.OutAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Parameter)]
+ public sealed class OutAttribute : Attribute {
+
+ public OutAttribute ()
+ {
+ }
+
+ public override object TypeId {
+ get {
+ // TODO: Implement me
+ return null;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/PInvokeMap.cs b/mcs/class/corlib/System.Runtime.InteropServices/PInvokeMap.cs
new file mode 100755
index 00000000000..c35bac6bdf1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/PInvokeMap.cs
@@ -0,0 +1,78 @@
+// PInvokeMap.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.InteropServices {
+
+
+ /// <summary>
+ /// </summary>
+ /// <remarks>
+ /// </remarks>
+ public enum PInvokeMap {
+
+ /// <summary>
+ /// </summary>
+ NoMangle = 1,
+
+ /// <summary>
+ /// </summary>
+ CharSetMask = 6,
+
+ /// <summary>
+ /// </summary>
+ CharSetNotSpec = 0,
+
+ /// <summary>
+ /// </summary>
+ CharSetAnsi = 2,
+
+ /// <summary>
+ /// </summary>
+ CharSetUnicode = 4,
+
+ /// <summary>
+ /// </summary>
+ CharSetAuto = 6,
+
+ /// <summary>
+ /// </summary>
+ PinvokeOLE = 32,
+
+ /// <summary>
+ /// </summary>
+ SupportsLastError = 64,
+
+ /// <summary>
+ /// </summary>
+ CallConvMask = 1792,
+
+ /// <summary>
+ /// </summary>
+ CallConvWinapi = 256,
+
+ /// <summary>
+ /// </summary>
+ CallConvCdecl = 512,
+
+ /// <summary>
+ /// </summary>
+ CallConvStdcall = 768,
+
+ /// <summary>
+ /// </summary>
+ CallConvThiscall = 1024,
+
+ /// <summary>
+ /// </summary>
+ CallConvFastcall = 1280,
+ } // PInvokeMap
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/PreserveSigAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/PreserveSigAttribute.cs
new file mode 100755
index 00000000000..691cef7c7df
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/PreserveSigAttribute.cs
@@ -0,0 +1,19 @@
+// System.Runtime.InteropServices.PreserveSigAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class PreserveSigAttribute : Attribute
+ {
+ public PreserveSigAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/PrimaryInteropAssemblyAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/PrimaryInteropAssemblyAttribute.cs
new file mode 100755
index 00000000000..b39858e6cde
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/PrimaryInteropAssemblyAttribute.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public sealed class PrimaryInteropAssemblyAttribute : Attribute
+ {
+ int major, minor;
+
+ public PrimaryInteropAssemblyAttribute (int major, int minor)
+ {
+ this.major = major;
+ this.minor = minor;
+ }
+
+ public int MajorVersion {
+ get { return major; }
+ }
+
+ public int MinorVersion {
+ get { return minor; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ProgIdAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/ProgIdAttribute.cs
new file mode 100755
index 00000000000..7db764fef0c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/ProgIdAttribute.cs
@@ -0,0 +1,28 @@
+//
+// System.Runtime.InteropServices.ProgIdAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ public sealed class ProgIdAttribute : Attribute
+ {
+ string pid;
+
+ public ProgIdAttribute (string progId)
+ {
+ pid = progId;
+ }
+
+ public string Value {
+ get { return pid; }
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/StructLayoutAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/StructLayoutAttribute.cs
new file mode 100755
index 00000000000..420e70efa0c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/StructLayoutAttribute.cs
@@ -0,0 +1,23 @@
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct)]
+ public sealed class StructLayoutAttribute : Attribute {
+ public CharSet CharSet = CharSet.Auto;
+ public int Pack = 8;
+ public int Size = 0;
+ private LayoutKind lkind;
+
+ public StructLayoutAttribute( short layoutKind) {
+ lkind = (LayoutKind)layoutKind;
+ }
+ public StructLayoutAttribute( LayoutKind layoutKind) {
+ lkind = layoutKind;
+ }
+ public LayoutKind Value {
+ get {return lkind;}
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibExporterFlags.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibExporterFlags.cs
new file mode 100755
index 00000000000..7f7c7695412
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibExporterFlags.cs
@@ -0,0 +1,16 @@
+//
+// System.Runtime.InteropServices.TypeLibExporterFlags.cs
+//
+// Author:
+// Kevin Winchester (kwin@ns.sympatico.ca)
+//
+// (C) 2002 Kevin Winchester
+//
+
+namespace System.Runtime.InteropServices
+{
+ [Flags] [Serializable]
+ public enum TypeLibExporterFlags {
+ OnlyReferenceRegistered = 1,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncAttribute.cs
new file mode 100755
index 00000000000..c58eaccbec2
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncAttribute.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.InteropServices.TypeLibFuncAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class TypeLibFuncAttribute : Attribute
+ {
+ TypeLibFuncFlags flags;
+
+ public TypeLibFuncAttribute (short flags)
+ {
+ this.flags = (TypeLibFuncFlags) flags;
+ }
+
+ public TypeLibFuncAttribute (TypeLibFuncFlags flags)
+ {
+ this.flags = flags;
+ }
+
+ public TypeLibFuncFlags Value {
+ get { return flags; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncFlags.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncFlags.cs
new file mode 100755
index 00000000000..b0768bca301
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibFuncFlags.cs
@@ -0,0 +1,25 @@
+// System.Runtime.InteropServices.TypeLibFuncFlags.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices {
+ [Flags] [Serializable]
+ public enum TypeLibFuncFlags {
+ FRestricted = 1,
+ FSource = 2,
+ FBindable = 4,
+ FRequestEdit = 8,
+ FDisplayBind = 16,
+ FDefaultBind = 32,
+ FHidden = 64,
+ FUsesGetLastError = 128,
+ FDefaultCollelem = 256,
+ FUiDefault = 512,
+ FNonBrowsable = 1024,
+ FReplaceable = 2048,
+ FImmediateBind = 4096,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeAttribute.cs
new file mode 100755
index 00000000000..d76bfcd814b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeAttribute.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.InteropServices.TypeLibTypeAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class TypeLibTypeAttribute : Attribute
+ {
+ TypeLibTypeFlags flags;
+
+ public TypeLibTypeAttribute (short flags)
+ {
+ this.flags = (TypeLibTypeFlags) flags;
+ }
+
+ public TypeLibTypeAttribute (TypeLibTypeFlags flags)
+ {
+ this.flags = flags;
+ }
+
+ public TypeLibTypeFlags Value {
+ get { return flags; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeFlags.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeFlags.cs
new file mode 100755
index 00000000000..adf5297698a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibTypeFlags.cs
@@ -0,0 +1,26 @@
+// System.Runtime.InteropServices.TypeLibTypeFlags.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices {
+ [Flags] [Serializable]
+ public enum TypeLibTypeFlags {
+ FAppObject = 1,
+ FCanCreate = 2,
+ FLicensed = 4,
+ FPreDeclId = 8,
+ FHidden= 16,
+ FControl = 32,
+ FDual = 64,
+ FNonExtensible = 128,
+ FOleAutomation = 256,
+ FRestricted = 512,
+ FAggregatable = 1024,
+ FReplaceable = 2048,
+ FDispatchable = 4096,
+ FReverseBind = 8192,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarAttribute.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarAttribute.cs
new file mode 100755
index 00000000000..1e5f2a4792c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarAttribute.cs
@@ -0,0 +1,32 @@
+//
+// System.Runtime.InteropServices.TypeLibTypeAttribute.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+
+namespace System.Runtime.InteropServices {
+
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class TypeLibVarAttribute : Attribute
+ {
+ TypeLibVarFlags flags;
+
+ public TypeLibVarAttribute (short flags)
+ {
+ this.flags = (TypeLibVarFlags) flags;
+ }
+
+ public TypeLibVarAttribute (TypeLibVarFlags flags)
+ {
+ this.flags = flags;
+ }
+
+ public TypeLibVarFlags Value {
+ get { return flags; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarFlags.cs b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarFlags.cs
new file mode 100755
index 00000000000..5bf60e5a03a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/TypeLibVarFlags.cs
@@ -0,0 +1,26 @@
+// System.Runtime.InteropServices.TypeLibVarFlags.cs
+//
+// Name: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.InteropServices {
+
+ [Flags] [Serializable]
+ public enum TypeLibVarFlags {
+ FReadOnly = 1,
+ FSource = 2,
+ FBindable = 4,
+ FRequestEdit = 8,
+ FDisplayBind = 16,
+ FDefaultBind = 32,
+ FHidden = 64,
+ FRestricted = 128,
+ FDefaultCollelem = 256,
+ FUiDefault = 512,
+ FNonBrowsable = 1024,
+ FReplaceable = 2048,
+ FImmediateBind = 4096,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs b/mcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs
new file mode 100755
index 00000000000..a4062929834
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/UnmanagedType.cs
@@ -0,0 +1,168 @@
+// UnmanagedType.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.InteropServices {
+
+
+ /// <summary>
+ /// </summary>
+ public enum UnmanagedType {
+
+ /// <summary>
+ /// </summary>
+ Bool = 2,
+
+ /// <summary>
+ /// </summary>
+ I1 = 3,
+
+ /// <summary>
+ /// </summary>
+ U1 = 4,
+
+ /// <summary>
+ /// </summary>
+ I2 = 5,
+
+ /// <summary>
+ /// </summary>
+ U2 = 6,
+
+ /// <summary>
+ /// </summary>
+ I4 = 7,
+
+ /// <summary>
+ /// </summary>
+ U4 = 8,
+
+ /// <summary>
+ /// </summary>
+ I8 = 9,
+
+ /// <summary>
+ /// </summary>
+ U8 = 10,
+
+ /// <summary>
+ /// </summary>
+ R4 = 11,
+
+ /// <summary>
+ /// </summary>
+ R8 = 12,
+
+ /// <summary>
+ /// </summary>
+ BStr = 19,
+
+ /// <summary>
+ /// </summary>
+ LPStr = 20,
+
+ /// <summary>
+ /// </summary>
+ LPWStr = 21,
+
+ /// <summary>
+ /// </summary>
+ LPTStr = 22,
+
+ /// <summary>
+ /// </summary>
+ ByValTStr = 23,
+
+ /// <summary>
+ /// </summary>
+ IUnknown = 25,
+
+ /// <summary>
+ /// </summary>
+ IDispatch = 26,
+
+ /// <summary>
+ /// </summary>
+ Struct = 27,
+
+ /// <summary>
+ /// </summary>
+ Interface = 28,
+
+ /// <summary>
+ /// </summary>
+ SafeArray = 29,
+
+ /// <summary>
+ /// </summary>
+ ByValArray = 30,
+
+ /// <summary>
+ /// </summary>
+ SysInt = 31,
+
+ /// <summary>
+ /// </summary>
+ SysUInt = 32,
+
+ /// <summary>
+ /// </summary>
+ VBByRefStr = 34,
+
+ /// <summary>
+ /// </summary>
+ AnsiBStr = 35,
+
+ /// <summary>
+ /// </summary>
+ TBStr = 36,
+
+ /// <summary>
+ /// </summary>
+ VariantBool = 37,
+
+ /// <summary>
+ /// </summary>
+ FunctionPtr = 38,
+
+ /// <summary>
+ /// </summary>
+ LPVoid = 39,
+
+ /// <summary>
+ /// </summary>
+ AsAny = 40,
+
+ /// <summary>
+ /// </summary>
+ RPrecise = 41,
+
+ /// <summary>
+ /// </summary>
+ LPArray = 42,
+
+ /// <summary>
+ /// </summary>
+ LPStruct = 43,
+
+ /// <summary>
+ /// </summary>
+ CustomMarshaler = 44,
+
+ /// <summary>
+ /// </summary>
+ Error = 45,
+
+ /// <summary>
+ /// </summary>
+ NativeTypeMax = 80,
+ } // UnmanagedType
+
+} // System.Runtime.InteropServices
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/VarEnum.cs b/mcs/class/corlib/System.Runtime.InteropServices/VarEnum.cs
new file mode 100755
index 00000000000..4a8dc4168c1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.InteropServices/VarEnum.cs
@@ -0,0 +1,50 @@
+using System;
+
+namespace System.Runtime.InteropServices {
+ public enum VarEnum {
+ VT_EMPTY = 0,
+ VT_NULL = 1,
+ VT_I2 = 2,
+ VT_I4 = 3,
+ VT_R4 = 4,
+ VT_R8 = 5,
+ VT_CY = 6,
+ VT_DATE = 7,
+ VT_BSTR = 8,
+ VT_DISPATCH = 9,
+ VT_ERROR = 10,
+ VT_BOOL = 11,
+ VT_VARIANT = 12,
+ VT_UNKNOWN = 13,
+ VT_DECIMAL = 14,
+ VT_I1 = 16,
+ VT_UI1 = 17,
+ VT_UI2 = 18,
+ VT_UI4 = 19,
+ VT_I8 = 20,
+ VT_UI8 = 21,
+ VT_INT = 22,
+ VT_UINT = 23,
+ VT_VOID = 24,
+ VT_HRESULT = 25,
+ VT_PTR = 26,
+ VT_SAFEARRAY = 27,
+ VT_CARRAY = 28,
+ VT_USERDEFINED = 29,
+ VT_LPSTR = 30,
+ VT_LPWSTR = 31,
+ VT_RECORD = 36,
+ VT_FILETIME = 64,
+ VT_BLOB = 65,
+ VT_STREAM = 66,
+ VT_STORAGE = 67,
+ VT_STREAMED_OBJECT = 68,
+ VT_STORED_OBJECT = 69,
+ VT_BLOB_OBJECT = 70,
+ VT_CF = 71,
+ VT_CLSID = 72,
+ VT_VECTOR = 4096,
+ VT_ARRAY = 8192,
+ VT_BYREF = 16384
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/ActivatorLevel.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/ActivatorLevel.cs
new file mode 100644
index 00000000000..574f2de52bf
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/ActivatorLevel.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.Remoting.Contexts.ActivatorLevel..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Remoting.Activation {
+
+ public enum ActivatorLevel {
+ Construction = 4,
+ Context = 8,
+ AppDomain = 12,
+ Process = 16,
+ Machine = 20,
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/IActivator.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/IActivator.cs
new file mode 100644
index 00000000000..60bf6be961c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/IActivator.cs
@@ -0,0 +1,24 @@
+//
+// System.Runtime.Remoting.Contexts.IActivator..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Remoting.Activation {
+
+ public interface IActivator {
+ ActivatorLevel Level {
+ get;
+ }
+
+ IActivator NextActivator {
+ get; set;
+ }
+
+ IConstructionReturnMessage Activate (IConstructionCallMessage msg);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionCallMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionCallMessage.cs
new file mode 100644
index 00000000000..6bbb601e467
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionCallMessage.cs
@@ -0,0 +1,36 @@
+//
+// System.Runtime.Remoting.Activation.IConstructionCallMessage.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Activation {
+
+ public interface IConstructionCallMessage {
+ Type ActivationType {
+ get;
+ }
+
+ string ActivationTypeName {
+ get;
+ }
+
+ IActivator Activator {
+ get;
+ set;
+ }
+
+ object [] CallSiteActivationAttributes {
+ get;
+ }
+
+ IList ContextProperties {
+ get;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionReturnMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionReturnMessage.cs
new file mode 100644
index 00000000000..495736f8c44
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Activation/IConstructionReturnMessage.cs
@@ -0,0 +1,17 @@
+//
+// System.Runtime.Remoting.Contexts.IConstructionReturnMessage..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Activation {
+
+ public interface IConstructionReturnMessage :IMethodReturnMessage, IMethodMessage, IMessage {
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs
new file mode 100644
index 00000000000..6a923ac52b2
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs
@@ -0,0 +1,72 @@
+//
+// System.Runtime.Remoting.Contexts.Context..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public class Context {
+ static Context default_context;
+ ArrayList context_properties;
+ int context_id;
+ bool frozen;
+ static int global_count;
+
+ static Context ()
+ {
+ default_context = new Context ();
+ default_context.frozen = true;
+ }
+
+ public Context ()
+ {
+ context_id = global_count++;
+ }
+
+ public static Context DefaultContext {
+ get {
+ return default_context;
+ }
+ }
+
+ public virtual int ContextID {
+ get {
+ return context_id;
+ }
+ }
+
+ public virtual IContextProperty GetProperty (string name)
+ {
+ if (context_properties == null)
+ return null;
+
+ foreach (IContextProperty p in context_properties)
+ if (p.Name == name)
+ return p;
+
+ return null;
+ }
+
+ public virtual void SetProperty (IContextProperty prop)
+ {
+ if (prop == null)
+ throw new ArgumentNullException ("IContextProperty");
+ if (this == default_context)
+ throw new InvalidOperationException ("Can not add properties to " +
+ "default context");
+ if (frozen)
+ throw new InvalidOperationException ("Context is Frozen");
+
+ if (context_properties == null)
+ context_properties = new ArrayList ();
+
+ context_properties.Add (prop);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextAttribute.cs
new file mode 100644
index 00000000000..46705c6683d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/ContextAttribute.cs
@@ -0,0 +1,96 @@
+//
+// System.Runtime.Remoting.Contexts.ContextAttribute..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting.Activation;
+using System.Collections;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ [AttributeUsage (AttributeTargets.Class)]
+ [Serializable]
+ public class ContextAttribute : Attribute, IContextAttribute, IContextProperty {
+ protected string AttributeName;
+
+ public virtual string Name {
+ get {
+ return AttributeName;
+ }
+ }
+
+ public override bool Equals (object o)
+ {
+ if (o == null)
+ return false;
+
+ if (!(o is ContextAttribute))
+ return false;
+
+ ContextAttribute ca = (ContextAttribute) o;
+
+ if (ca.AttributeName != AttributeName)
+ return false;
+
+ return true;
+ }
+
+ public virtual void Freeze (Context ctx)
+ {
+ }
+
+ public override int GetHashCode ()
+ {
+ if (AttributeName == null)
+ return 0;
+
+ return AttributeName.GetHashCode ();
+ }
+
+ /// <summary>
+ /// Adds the current context property to the IConstructionCallMessage
+ /// </summary>
+ public virtual void GetPropertiesForNewContext (IConstructionCallMessage msg)
+ {
+ if (msg == null)
+ throw new ArgumentNullException ("IConstructionCallMessage");
+
+ IList list = msg.ContextProperties;
+
+ list.Add (this);
+ }
+
+ // <summary>
+ // True whether the context arguments satisfies the requirements
+ // of the current context.
+ // </summary>
+ public virtual bool IsContextOK (Context ctx, IConstructionCallMessage msg)
+ {
+ if (msg == null)
+ throw new ArgumentNullException ("IConstructionCallMessage");
+ if (ctx == null)
+ throw new ArgumentNullException ("Context");
+
+ if (!msg.ActivationType.IsContextful)
+ return true;
+
+ IContextProperty p = ctx.GetProperty (AttributeName);
+ if (p == null)
+ return false;
+
+ if (this != p)
+ return false;
+
+ return true;
+ }
+
+ public virtual bool IsNewContextOK (Context ctx)
+ {
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextAttribute.cs
new file mode 100644
index 00000000000..b998062642c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextAttribute.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.Remoting.Contexts.IContextAttribute..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting.Activation;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IContextAttribute {
+
+ void GetPropertiesForNewContext (IConstructionCallMessage msg);
+
+ bool IsContextOK (Context ctx, IConstructionCallMessage msg);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextProperty.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextProperty.cs
new file mode 100644
index 00000000000..7230c19b029
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IContextProperty.cs
@@ -0,0 +1,23 @@
+//
+// System.Runtime.Remoting.Contexts.IContextProperty..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IContextProperty {
+
+ string Name {
+ get;
+ }
+
+ void Freeze (Context ctx);
+
+ bool IsNewContextOK (Context ctx);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicMessageSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicMessageSink.cs
new file mode 100644
index 00000000000..daf169559d8
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicMessageSink.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.Remoting.Contexts.IDynamicMessageSink..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IDynamicMessageSink {
+
+ void ProcessMessageFinish (IMessage reply_msg, bool client_site, bool async);
+
+ void ProcessMessageStart (IMessage req_msg, bool client_site, bool async);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicProperty.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicProperty.cs
new file mode 100644
index 00000000000..e469e24b6f1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/IDynamicProperty.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.Remoting.Contexts.IDynamicProperty..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public interface IDynamicProperty {
+
+ string Name {
+ get;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/SynchronizationAttribute.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/SynchronizationAttribute.cs
new file mode 100644
index 00000000000..b6fda36d9bb
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/SynchronizationAttribute.cs
@@ -0,0 +1,96 @@
+//
+// System.Runtime.Remoting.Contexts.SynchronizationAttribute..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Activation;
+
+namespace System.Runtime.Remoting.Contexts {
+
+ public class SynchronizationAttribute : ContextAttribute
+ {
+ public const int NOT_SUPPORTED = 1;
+ public const int SUPPORTED = 2;
+ public const int REQUIRED = 4;
+ public const int REQUIRES_NEW = 8;
+
+ private bool _fReentrant = false;
+ private int _nBehavior = REQUIRED;
+ private bool _fLocked = false;
+
+ public SynchronizationAttribute ()
+ {
+ }
+
+ public SynchronizationAttribute (bool fReentrant)
+ {
+ _fReentrant = fReentrant;
+ }
+
+ public SynchronizationAttribute (int nBehavior)
+ {
+ if (nBehavior != NOT_SUPPORTED &&
+ nBehavior != SUPPORTED &&
+ nBehavior != REQUIRED &&
+ nBehavior != REQUIRES_NEW)
+ {
+ throw new ArgumentException ("Invalid Flag");
+ }
+ _nBehavior = nBehavior;
+ }
+
+ public SynchronizationAttribute (int nBehavior, bool fReentrant)
+ {
+ if (nBehavior != NOT_SUPPORTED &&
+ nBehavior != SUPPORTED &&
+ nBehavior != REQUIRED &&
+ nBehavior != REQUIRES_NEW)
+ {
+ throw new ArgumentException ("Invalid Flag");
+ }
+ _nBehavior = nBehavior;
+ _fReentrant = fReentrant;
+ }
+
+ public virtual bool IsReEntrant
+ {
+ get { return _fReentrant; }
+ }
+
+ public virtual bool Locked
+ {
+ get { return _fLocked; }
+ set { _fLocked = value; }
+ }
+
+ [MonoTODO]
+ public virtual IMessageSink GetClientContextSink (IMessageSink nextSink)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override void GetPropertiesForNewContext (IConstructionCallMessage ctorMsg)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual IMessageSink GetServerContextSink (IMessageSink nextSink)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override bool IsContextOK (Context ctx, IConstructionCallMessage msg)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs
new file mode 100644
index 00000000000..10eb384e846
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/AsyncResult.cs
@@ -0,0 +1,74 @@
+//
+// System.Runtime.Remoting.Messaging/AsyncResult.cs
+//
+// Authors:
+// Joe Shaw (joe@ximian.com)
+// Martin Baulig (martin@gnome.org)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Threading;
+using System.Runtime.CompilerServices;
+
+namespace System.Runtime.Remoting.Messaging {
+
+public class AsyncResult : IAsyncResult {
+
+ object async_state;
+ WaitHandle handle;
+ object async_delegate;
+ IntPtr data;
+ bool sync_completed;
+ bool completed;
+ bool endinvoke_called;
+
+ public virtual object AsyncState
+ {
+ get {
+ return async_state;
+ }
+ }
+
+ public virtual WaitHandle AsyncWaitHandle
+ {
+ get {
+ return handle;
+ }
+ }
+
+ public virtual bool CompletedSynchronously
+ {
+ get {
+ return sync_completed;
+ }
+ }
+
+ public virtual bool IsCompleted
+ {
+ get {
+ return completed;
+ }
+ }
+
+ public bool EndInvokeCalled
+ {
+ get {
+ return endinvoke_called;
+ }
+ set {
+ endinvoke_called = value;
+ }
+ }
+
+ public virtual object AsyncDelegate
+ {
+ get {
+ return async_delegate;
+ }
+ }
+
+}
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog
new file mode 100644
index 00000000000..f01e3ca8e90
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ChangeLog
@@ -0,0 +1,13 @@
+
+Thu Apr 4 13:13:20 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * IMethodReturnMessage.cs: added IMethodMessage, IMessage interfaces.
+ * ReturnMessage.cs: stubbed out Properties property.
+
+2002-03-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * AsyncResult.cs: impl.
+
+2002/03/04 Nick Drochak <ndrochak@gol.com>
+
+ * Header.cs: Change properties into fields where they should be.
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/Header.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/Header.cs
new file mode 100644
index 00000000000..0b08bfd3eb8
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/Header.cs
@@ -0,0 +1,50 @@
+//
+// System.Runtime.Remoting.Messaging.Header.cs
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ [Serializable]
+ public class Header {
+ public Header (string name, object value) :
+ this (name, value, true)
+ {
+ }
+
+ public Header (string name, object value, bool must_understand) :
+ this (name, value, must_understand, null)
+ {
+ }
+
+ public Header (string name, object value, bool must_understand, string header_namespace) {
+ this.name = name;
+ this.value = value;
+ this.must_understand = must_understand;
+ this.header_namespace = header_namespace;
+ }
+
+ // fields
+
+ public string HeaderNamespace;
+
+ public bool MustUnderstand;
+
+ public string Name;
+
+ public object Value;
+
+ // private
+
+ private string name;
+ private object value;
+ private bool must_understand;
+ private string header_namespace;
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessage.cs
new file mode 100644
index 00000000000..d1a5c0c1207
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessage.cs
@@ -0,0 +1,20 @@
+//
+// System.Runtime.Remoting.Messaging.IMessage.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public interface IMessage {
+
+ IDictionary Properties {
+ get;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageCtrl.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageCtrl.cs
new file mode 100644
index 00000000000..5fe21c32232
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageCtrl.cs
@@ -0,0 +1,19 @@
+//
+// System.Runtime.Remoting.Messaging.IMessageSink.cs
+//
+// Author:
+// Piers Haken (piersh@friskit.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting;
+
+namespace System.Runtime.Remoting.Messaging
+{
+ public interface IMessageCtrl
+ {
+ void Cancel (int msToCancel);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageSink.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageSink.cs
new file mode 100644
index 00000000000..8c25aac6b24
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMessageSink.cs
@@ -0,0 +1,21 @@
+//
+// System.Runtime.Remoting.Messaging.IMessageSink.cs
+//
+// Author:
+// Piers Haken (piersh@friskit.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting;
+
+namespace System.Runtime.Remoting.Messaging
+{
+ public interface IMessageSink
+ {
+ IMessage SyncProcessMessage (IMessage msg);
+ IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink);
+ IMessageSink NextSink { get; }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodCallMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodCallMessage.cs
new file mode 100644
index 00000000000..0f0846ca663
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodCallMessage.cs
@@ -0,0 +1,28 @@
+//
+// System.Runtime.Remoting.Messaging.IMethodCallMessage.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Reflection;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public interface IMethodCallMessage : IMethodMessage, IMessage {
+
+ int InArgCount {
+ get;
+ }
+
+ object [] InArgs {
+ get;
+ }
+
+ object GetInArg (int arg_num);
+ string GetInArgName (int arg_num);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodMessage.cs
new file mode 100644
index 00000000000..49cadf428ec
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodMessage.cs
@@ -0,0 +1,55 @@
+//
+// System.Runtime.Remoting.Messaging.IMethodMessage..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Reflection;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public interface IMethodMessage {
+ int ArgCount {
+ get;
+ }
+
+ object [] Args {
+ get;
+ }
+
+ bool HasVarArgs {
+ get;
+ }
+
+ LogicalCallContext LogicalCallContext {
+ get;
+ }
+
+ MethodBase MethodBase {
+ get;
+ }
+
+ string MethodName {
+ get;
+ }
+
+ object MethodSignature {
+ get;
+ }
+
+ string TypeName {
+ get;
+ }
+
+ string Uri {
+ get;
+ }
+
+ object GetArg (int arg_num);
+ string GetArgName (int arg_num);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodReturnMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodReturnMessage.cs
new file mode 100644
index 00000000000..d059ce9b5fc
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/IMethodReturnMessage.cs
@@ -0,0 +1,22 @@
+//
+// System.Runtime.Remoting.Messaging.IMethodReturnMessage..cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Remoting.Messaging {
+
+ public interface IMethodReturnMessage : IMethodMessage, IMessage {
+
+ Exception Exception { get; }
+ int OutArgCount { get; }
+ object [] OutArgs { get; }
+ object ReturnValue { get; }
+
+ object GetOutArg (int arg_num);
+ string GetOutArgName (int arg_num);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs
new file mode 100644
index 00000000000..a9e44a0ca4b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/LogicalCallContext.cs
@@ -0,0 +1,43 @@
+//
+// System.Runtime.Remoting.Messaging.LogicalCallContext.cs
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ [MonoTODO]
+ [Serializable]
+ public sealed class LogicalCallContext : ISerializable, ICloneable {
+
+ internal LogicalCallContext () {}
+
+ public bool HasInfo {
+ get { return false; }
+ }
+
+ public void FreeNamedDataSlot (string name) {
+ }
+
+ public object GetData (string name) {
+ return null;
+ }
+
+ public void GetObjectData (SerializationInfo info, StreamingContext context) {
+ }
+
+ public void SetData (string name, object data) {
+ }
+
+ public object Clone () {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs
new file mode 100644
index 00000000000..0ddd8487815
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MonoMethodMessage.cs
@@ -0,0 +1,232 @@
+//
+// System.Runtime.Remoting.Messaging.MonoMethodMessage.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ internal class MonoMethodMessage : IMethodCallMessage, IMethodReturnMessage {
+
+ MonoMethod method;
+
+ object [] args;
+
+ string [] names;
+
+ byte [] arg_types; /* 1 == IN; 2 == OUT ; 3 = INOUT */
+
+ public LogicalCallContext ctx;
+
+ public object rval;
+
+ public Exception exc;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern void InitMessage (MonoMethod method, object [] out_args);
+
+ public MonoMethodMessage (MonoMethod method, object [] out_args)
+ {
+ InitMessage (method, out_args);
+ }
+
+ public IDictionary Properties {
+ get {
+ return null;
+ }
+ }
+
+ public int ArgCount {
+ get {
+ return args.Length;
+ }
+ }
+
+ public object [] Args {
+ get {
+ return args;
+ }
+ }
+
+ public bool HasVarArgs {
+ get {
+ return false;
+ }
+ }
+
+ public LogicalCallContext LogicalCallContext {
+ get {
+ return ctx;
+ }
+ }
+
+ public MethodBase MethodBase {
+ get {
+ return method;
+ }
+ }
+
+ public string MethodName {
+ get {
+ return method.Name;
+ }
+ }
+
+ public object MethodSignature {
+ get {
+ return null;
+ }
+ }
+
+ public string TypeName {
+ get {
+ return null;
+ }
+ }
+
+ public string Uri {
+ get {
+ return null;
+ }
+ }
+
+ public object GetArg (int arg_num)
+ {
+ return args [arg_num];
+ }
+
+ public string GetArgName (int arg_num)
+ {
+ return names [arg_num];
+ }
+
+ public int InArgCount {
+ get {
+ int count = 0;
+
+ foreach (byte t in arg_types) {
+ if ((t & 1) != 0) count++;
+
+ }
+ return count;
+ }
+ }
+
+ public object [] InArgs {
+ get {
+ int i, j, count = InArgCount;
+ object [] inargs = new object [count];
+
+ i = j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 1) != 0)
+ inargs [j++] = args [i];
+ i++;
+ }
+
+ return inargs;
+ }
+ }
+
+ public object GetInArg (int arg_num)
+ {
+ int i = 0, j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 1) != 0) {
+ if (j++ == arg_num)
+ return args [i];
+ }
+ i++;
+ }
+ return null;
+ }
+
+ public string GetInArgName (int arg_num)
+ {
+ int i = 0, j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 1) != 0) {
+ if (j++ == arg_num)
+ return names [i];
+ }
+ i++;
+ }
+ return null;
+ }
+
+ public Exception Exception {
+ get {
+ return exc;
+ }
+ }
+
+ public int OutArgCount {
+ get {
+ int count = 0;
+
+ foreach (byte t in arg_types) {
+ if ((t & 2) != 0) count++;
+
+ }
+ return count;
+ }
+ }
+
+ public object [] OutArgs {
+ get {
+ int i, j, count = OutArgCount;
+ object [] outargs = new object [count];
+
+ i = j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 2) != 0)
+ outargs [j++] = args [i];
+ i++;
+ }
+
+ return outargs;
+ }
+ }
+
+ public object ReturnValue {
+ get {
+ return rval;
+ }
+ }
+
+ public object GetOutArg (int arg_num)
+ {
+ int i = 0, j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 2) != 0) {
+ if (j++ == arg_num)
+ return args [i];
+ }
+ i++;
+ }
+ return null;
+ }
+
+ public string GetOutArgName (int arg_num)
+ {
+ int i = 0, j = 0;
+ foreach (byte t in arg_types) {
+ if ((t & 2) != 0) {
+ if (j++ == arg_num)
+ return names [i];
+ }
+ i++;
+ }
+ return null;
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs
new file mode 100644
index 00000000000..aecd0a730cb
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs
@@ -0,0 +1,146 @@
+//
+// System.Runtime.Remoting.Messaging.ReturnMessage.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace System.Runtime.Remoting.Messaging {
+
+ internal class ReturnMessage : IMethodReturnMessage, IMethodMessage {
+
+ MonoMethodMessage msg;
+ IMethodCallMessage request;
+
+ public ReturnMessage (object returnValue, object [] outArgs,
+ int outArgCount, LogicalCallContext callCtx,
+ IMethodCallMessage request)
+ {
+ // fixme: why do we need outArgCount?
+ msg = new MonoMethodMessage ((MonoMethod)request.MethodBase, outArgs);
+ this.request = request;
+ msg.rval = returnValue;
+ msg.ctx = callCtx;
+ }
+
+ public ReturnMessage (Exception exc, IMethodCallMessage request)
+ {
+ msg = new MonoMethodMessage ((MonoMethod)request.MethodBase, null);
+ this.request = request;
+ msg.exc = exc;
+ msg.ctx = request.LogicalCallContext;
+ }
+
+ public int ArgCount {
+ get {
+ return msg.ArgCount;
+ }
+ }
+
+ public object [] Args {
+ get {
+ return msg.Args;
+ }
+ }
+
+ public bool HasVarArgs {
+ get {
+ return msg.HasVarArgs;
+ }
+ }
+
+ public LogicalCallContext LogicalCallContext {
+ get {
+ return msg.ctx;
+ }
+ }
+
+ public MethodBase MethodBase {
+ get {
+ return msg.MethodBase;
+ }
+ }
+
+ public string MethodName {
+ get {
+ return msg.MethodName;
+ }
+ }
+
+ public object MethodSignature {
+ get {
+ return msg.MethodSignature;
+ }
+ }
+
+ [MonoTODO]
+ public virtual IDictionary Properties {
+ get {
+ return null;
+ }
+ }
+
+ public string TypeName {
+ get {
+ return msg.TypeName;
+ }
+ }
+
+ public string Uri {
+ get {
+ return msg.Uri;
+ }
+ }
+
+ public object GetArg (int arg_num)
+ {
+ return msg.GetArg (arg_num);
+ }
+
+ public string GetArgName (int arg_num)
+ {
+ return msg.GetArgName (arg_num);
+ }
+
+ public Exception Exception {
+ get {
+ return msg.exc;
+ }
+ }
+
+ public int OutArgCount {
+ get {
+ return msg.OutArgCount;
+ }
+ }
+
+ public object [] OutArgs {
+ get {
+ return msg.OutArgs;
+ }
+ }
+
+ public virtual object ReturnValue {
+ get {
+ return msg.rval;
+ }
+ }
+
+ public object GetOutArg (int arg_num)
+ {
+ return msg.GetOutArg (arg_num);
+ }
+
+ public string GetOutArgName (int arg_num)
+ {
+ return msg.GetOutArgName (arg_num);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs
new file mode 100644
index 00000000000..16131866bc4
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs
@@ -0,0 +1,56 @@
+//
+// System.Runtime.Remoting.Proxies.RealProxy.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.CompilerServices;
+
+
+namespace System.Runtime.Remoting.Proxies
+{
+ internal class TransparentProxy {
+ public RealProxy _rp;
+ IntPtr _class;
+ }
+
+ public abstract class RealProxy {
+
+ Type class_to_proxy;
+
+ protected RealProxy () {
+ throw new NotImplementedException ();
+ }
+
+ protected RealProxy (Type classToProxy) {
+ this.class_to_proxy = classToProxy;
+ }
+
+ protected RealProxy (Type classToProxy, IntPtr stub, object stubData) {
+ throw new NotImplementedException ();
+ }
+
+ public abstract IMessage Invoke (IMessage msg);
+
+ /* this is called from unmanaged code */
+ internal static object PrivateInvoke (RealProxy rp, IMessage msg, out Exception exc,
+ out object [] out_args)
+ {
+ IMethodReturnMessage res_msg = (IMethodReturnMessage)rp.Invoke (msg);
+
+ exc = res_msg.Exception;
+ out_args = res_msg.OutArgs;
+ return res_msg.ReturnValue;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern virtual object GetTransparentProxy ();
+
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ChangeLog b/mcs/class/corlib/System.Runtime.Remoting/ChangeLog
new file mode 100755
index 00000000000..1d7c354a86b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/ChangeLog
@@ -0,0 +1,8 @@
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * ObjRef.cs : Strew the MonoTODO attribute.
+
+2001-09-02 Miguel de Icaza <miguel@ximian.com>
+
+ * ObjRef.cs: Include System.Runtime.Serialization
+
diff --git a/mcs/class/corlib/System.Runtime.Remoting/LeaseState.cs b/mcs/class/corlib/System.Runtime.Remoting/LeaseState.cs
new file mode 100755
index 00000000000..825e6130e0d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/LeaseState.cs
@@ -0,0 +1,41 @@
+// LeaseState.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:40:41 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Remoting {
+
+
+ /// <summary>
+ /// </summary>
+ public enum LeaseState {
+
+ /// <summary>
+ /// </summary>
+ Null = 0,
+
+ /// <summary>
+ /// </summary>
+ Initial = 1,
+
+ /// <summary>
+ /// </summary>
+ Active = 2,
+
+ /// <summary>
+ /// </summary>
+ Renewing = 3,
+
+ /// <summary>
+ /// </summary>
+ Expired = 4,
+ } // LeaseState
+
+} // System.Runtime.Remoting
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs b/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs
new file mode 100644
index 00000000000..6f564878969
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/ObjRef.cs
@@ -0,0 +1,72 @@
+//
+// System.Runtime.Remoting.ObjRef.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+// FIXME: This is just a skeleton for practical purposes.
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting {
+
+ [Serializable]
+ public class ObjRef : IObjectReference, ISerializable {
+ MarshalByRefObject mbr;
+ SerializationInfo si;
+ Type type;
+
+ public ObjRef ()
+ {
+ }
+
+ public ObjRef (MarshalByRefObject mbr, Type type)
+ {
+ this.mbr = mbr;
+ this.type = type;
+ }
+
+ [MonoTODO]
+ protected ObjRef (SerializationInfo si, StreamingContext sc)
+ {
+ // FIXME: Implement.
+ //
+ // This encarnates the object from serialized data.
+ }
+
+ [MonoTODO]
+ public virtual void GetObjectData (SerializationInfo si, StreamingContext sc)
+ {
+ // FIXME:
+ }
+
+ [MonoTODO]
+ public virtual object GetRealObject (StreamingContext sc)
+ {
+ // FIXME:
+
+ return null;
+ }
+
+ [MonoTODO]
+ public bool IsFromThisAppDomain ()
+ {
+ // FIXME:
+
+ return true;
+ }
+
+ [MonoTODO]
+ public bool IsFromThisProcess ()
+ {
+ // FIXME:
+
+ return true;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/ObjectHandle.cs b/mcs/class/corlib/System.Runtime.Remoting/ObjectHandle.cs
new file mode 100644
index 00000000000..56adef753d3
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/ObjectHandle.cs
@@ -0,0 +1,42 @@
+//
+// System.Runtime.Remoting.ObjectHandle.cs
+//
+// Author:
+// Dietmar Maurer (dietmr@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Remoting {
+
+ public class ObjectHandle : MarshalByRefObject, IObjectReference {
+
+ [MonoTODO]
+ public ObjectHandle (object o)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override object InitializeLifetimeService ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object Unwrap ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public object GetRealObject (StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
new file mode 100644
index 00000000000..25b1cc874a0
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs
@@ -0,0 +1,50 @@
+//
+// System.Runtime.Remoting.RemotingServices.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Reflection;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.CompilerServices;
+
+namespace System.Runtime.Remoting
+{
+ public sealed class RemotingServices {
+
+ private RemotingServices () {}
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static object InternalExecute (MonoMethod method, Object obj,
+ Object[] parameters, out object [] out_args);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static bool IsTransparentProxy (object proxy);
+
+ public static IMethodReturnMessage ExecuteMessage (
+ MarshalByRefObject target, IMethodCallMessage reqMsg)
+ {
+ ReturnMessage result;
+
+ MonoMethod method = (MonoMethod)reqMsg.MethodBase;
+
+ try {
+ object [] out_args;
+ object rval = InternalExecute (method, target, reqMsg.Args, out out_args);
+ result = new ReturnMessage (rval, out_args, out_args.Length,
+ reqMsg.LogicalCallContext, reqMsg);
+
+ } catch (Exception e) {
+ result = new ReturnMessage (e, reqMsg);
+ }
+
+ return result;
+ }
+
+
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Remoting/SoapMethodOption.cs b/mcs/class/corlib/System.Runtime.Remoting/SoapMethodOption.cs
new file mode 100755
index 00000000000..1a1919e2a9d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/SoapMethodOption.cs
@@ -0,0 +1,37 @@
+// SoapMethodOption.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:41:01 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Remoting {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SoapMethodOption {
+
+ /// <summary>
+ /// </summary>
+ SoapAction = 0,
+
+ /// <summary>
+ /// </summary>
+ MethodURI = 1,
+
+ /// <summary>
+ /// </summary>
+ ResponseName = 2,
+
+ /// <summary>
+ /// </summary>
+ ReturnElement = 3,
+ } // SoapMethodOption
+
+} // System.Runtime.Remoting
diff --git a/mcs/class/corlib/System.Runtime.Remoting/SoapOption.cs b/mcs/class/corlib/System.Runtime.Remoting/SoapOption.cs
new file mode 100755
index 00000000000..e334e53c239
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/SoapOption.cs
@@ -0,0 +1,30 @@
+// SoapOption.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:41:11 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Remoting {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum SoapOption {
+
+ /// <summary>
+ /// </summary>
+ AlwaysIncludeTypes = 1,
+
+ /// <summary>
+ /// </summary>
+ XsdString = 2,
+ } // SoapOption
+
+} // System.Runtime.Remoting
diff --git a/mcs/class/corlib/System.Runtime.Remoting/WellKnownObjectMode.cs b/mcs/class/corlib/System.Runtime.Remoting/WellKnownObjectMode.cs
new file mode 100755
index 00000000000..24898ead85e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Remoting/WellKnownObjectMode.cs
@@ -0,0 +1,29 @@
+// WellKnownObjectMode.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:40:51 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Remoting {
+
+
+ /// <summary>
+ /// </summary>
+ public enum WellKnownObjectMode {
+
+ /// <summary>
+ /// </summary>
+ Singleton = 1,
+
+ /// <summary>
+ /// </summary>
+ SingleCall = 2,
+ } // WellKnownObjectMode
+
+} // System.Runtime.Remoting
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryArrayTypeEnum.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryArrayTypeEnum.cs
new file mode 100755
index 00000000000..c73656e838a
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryArrayTypeEnum.cs
@@ -0,0 +1,45 @@
+// BinaryArrayTypeEnum.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:42:50 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters.Binary {
+
+
+ /// <summary>
+ /// </summary>
+ public enum BinaryArrayTypeEnum {
+
+ /// <summary>
+ /// </summary>
+ Single = 0,
+
+ /// <summary>
+ /// </summary>
+ Jagged = 1,
+
+ /// <summary>
+ /// </summary>
+ Rectangular = 2,
+
+ /// <summary>
+ /// </summary>
+ SingleOffset = 3,
+
+ /// <summary>
+ /// </summary>
+ JaggedOffset = 4,
+
+ /// <summary>
+ /// </summary>
+ RectangularOffset = 5,
+ } // BinaryArrayTypeEnum
+
+} // System.Runtime.Serialization.Formatters.Binary
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog
new file mode 100644
index 00000000000..97f1def7827
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ChangeLog
@@ -0,0 +1,5 @@
+2002-01-21 David Dawkins <david@dawkins.st>
+
+ * IFieldInfo.cs : New file
+ * ISoapMessage.cs : New file
+
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs
new file mode 100755
index 00000000000..944f8a68d2f
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs
@@ -0,0 +1,29 @@
+// FormatterAssemblyStyle.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:19 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum FormatterAssemblyStyle {
+
+ /// <summary>
+ /// </summary>
+ Simple = 0,
+
+ /// <summary>
+ /// </summary>
+ Full = 1,
+ } // FormatterAssemblyStyle
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs
new file mode 100755
index 00000000000..2bba90aaafa
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs
@@ -0,0 +1,29 @@
+// FormatterTopObjectStyle.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:42:59 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum FormatterTopObjectStyle {
+
+ /// <summary>
+ /// </summary>
+ Object = 0,
+
+ /// <summary>
+ /// </summary>
+ SoapMessage = 1,
+ } // FormatterTopObjectStyle
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs
new file mode 100755
index 00000000000..c719b3eea56
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs
@@ -0,0 +1,33 @@
+// FormatterTypeStyle.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:09 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum FormatterTypeStyle {
+
+ /// <summary>
+ /// </summary>
+ TypesWhenNeeded = 0,
+
+ /// <summary>
+ /// </summary>
+ TypesAlways = 1,
+
+ /// <summary>
+ /// </summary>
+ XsdString = 2,
+ } // FormatterTypeStyle
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs
new file mode 100644
index 00000000000..1aba9e2cd14
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/IFieldInfo.cs
@@ -0,0 +1,30 @@
+//
+// System.Runtime.Serialization.Formatters.IFieldInfo
+//
+// Author:
+// David Dawkins (david@dawkins.st)
+//
+// (C) David Dawkins
+//
+
+namespace System.Runtime.Serialization.Formatters {
+
+ /// <summary>
+ /// Interface for querying field information on serialized objects.</summary>
+ public interface IFieldInfo {
+
+ /// <summary>
+ /// Get or set the field names for serialized objects.</summary>
+ string[] FieldNames {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the field types for serialized objects.</summary>
+ Type[] FieldTypes {
+ get;
+ set;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs
new file mode 100644
index 00000000000..f43d55a6a73
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/ISoapMessage.cs
@@ -0,0 +1,60 @@
+//
+// System.Runtime.Serialization.Formatters.ISoapMessage
+//
+// Author:
+// David Dawkins (david@dawkins.st)
+//
+// (C) David Dawkins
+//
+
+using System.Runtime.Remoting.Messaging;
+
+namespace System.Runtime.Serialization.Formatters {
+
+ /// <summary>
+ /// Interface for making SOAP method calls</summary>
+ public interface ISoapMessage {
+
+ /// <summary>
+ /// Get or set the headers ("out-of-band" data) for the method call</summary>
+ Header[] Headers {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the method name</summary>
+ string MethodName {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the method parameter names</summary
+ string[] ParamNames {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the method parameter types</summary
+ Type[] ParamTypes {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the method parameter values</summary
+ object[] ParamValues {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the XML namespace for the location of the called object</summary
+ string XmlNameSpace {
+ get;
+ set;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs
new file mode 100755
index 00000000000..5c8f704520e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs
@@ -0,0 +1,41 @@
+// InternalArrayTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:29 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalArrayTypeE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ Single = 1,
+
+ /// <summary>
+ /// </summary>
+ Jagged = 2,
+
+ /// <summary>
+ /// </summary>
+ Rectangular = 3,
+
+ /// <summary>
+ /// </summary>
+ Base64 = 4,
+ } // InternalArrayTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs
new file mode 100755
index 00000000000..2112390e67d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalElementTypeE.cs
@@ -0,0 +1,33 @@
+// InternalElementTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:49 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalElementTypeE {
+
+ /// <summary>
+ /// </summary>
+ ObjectBegin = 0,
+
+ /// <summary>
+ /// </summary>
+ ObjectEnd = 1,
+
+ /// <summary>
+ /// </summary>
+ Member = 2,
+ } // InternalElementTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs
new file mode 100755
index 00000000000..4854703471e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs
@@ -0,0 +1,37 @@
+// InternalMemberTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:09 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalMemberTypeE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ Header = 1,
+
+ /// <summary>
+ /// </summary>
+ Field = 2,
+
+ /// <summary>
+ /// </summary>
+ Item = 3,
+ } // InternalMemberTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs
new file mode 100755
index 00000000000..3459d9e43b5
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalMemberValueE.cs
@@ -0,0 +1,41 @@
+// InternalMemberValueE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:18 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalMemberValueE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ InlineValue = 1,
+
+ /// <summary>
+ /// </summary>
+ Nested = 2,
+
+ /// <summary>
+ /// </summary>
+ Reference = 3,
+
+ /// <summary>
+ /// </summary>
+ Null = 4,
+ } // InternalMemberValueE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs
new file mode 100755
index 00000000000..6074981b751
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs
@@ -0,0 +1,61 @@
+// InternalNameSpaceE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:28 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalNameSpaceE {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ Soap = 1,
+
+ /// <summary>
+ /// </summary>
+ XdrPrimitive = 2,
+
+ /// <summary>
+ /// </summary>
+ XdrString = 3,
+
+ /// <summary>
+ /// </summary>
+ UrtSystem = 4,
+
+ /// <summary>
+ /// </summary>
+ UrtUser = 5,
+
+ /// <summary>
+ /// </summary>
+ UserNameSpace = 6,
+
+ /// <summary>
+ /// </summary>
+ MemberName = 7,
+
+ /// <summary>
+ /// </summary>
+ Interop = 8,
+
+ /// <summary>
+ /// </summary>
+ CallElement = 9,
+ } // InternalNameSpaceE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs
new file mode 100755
index 00000000000..9229202af82
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs
@@ -0,0 +1,37 @@
+// InternalObjectPositionE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:38 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalObjectPositionE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ Top = 1,
+
+ /// <summary>
+ /// </summary>
+ Child = 2,
+
+ /// <summary>
+ /// </summary>
+ Headers = 3,
+ } // InternalObjectPositionE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs
new file mode 100755
index 00000000000..986b6bd4bc1
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs
@@ -0,0 +1,33 @@
+// InternalObjectTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:48 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalObjectTypeE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ Object = 1,
+
+ /// <summary>
+ /// </summary>
+ Array = 2,
+ } // InternalObjectTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs
new file mode 100755
index 00000000000..87627fcc2bb
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseStateE.cs
@@ -0,0 +1,37 @@
+// InternalParseStateE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:44:58 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalParseStateE {
+
+ /// <summary>
+ /// </summary>
+ Initial = 0,
+
+ /// <summary>
+ /// </summary>
+ Object = 1,
+
+ /// <summary>
+ /// </summary>
+ Member = 2,
+
+ /// <summary>
+ /// </summary>
+ MemberChild = 3,
+ } // InternalParseStateE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs
new file mode 100755
index 00000000000..9747bffcbe8
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalParseTypeE.cs
@@ -0,0 +1,73 @@
+// InternalParseTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:45:08 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalParseTypeE {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ SerializedStreamHeader = 1,
+
+ /// <summary>
+ /// </summary>
+ Object = 2,
+
+ /// <summary>
+ /// </summary>
+ Member = 3,
+
+ /// <summary>
+ /// </summary>
+ ObjectEnd = 4,
+
+ /// <summary>
+ /// </summary>
+ MemberEnd = 5,
+
+ /// <summary>
+ /// </summary>
+ Headers = 6,
+
+ /// <summary>
+ /// </summary>
+ HeadersEnd = 7,
+
+ /// <summary>
+ /// </summary>
+ SerializedStreamHeaderEnd = 8,
+
+ /// <summary>
+ /// </summary>
+ Envelope = 9,
+
+ /// <summary>
+ /// </summary>
+ EnvelopeEnd = 10,
+
+ /// <summary>
+ /// </summary>
+ Body = 11,
+
+ /// <summary>
+ /// </summary>
+ BodyEnd = 12,
+ } // InternalParseTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs
new file mode 100755
index 00000000000..09adef22214
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs
@@ -0,0 +1,89 @@
+// InternalPrimitiveTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:39 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalPrimitiveTypeE {
+
+ /// <summary>
+ /// </summary>
+ Invalid = 0,
+
+ /// <summary>
+ /// </summary>
+ Boolean = 1,
+
+ /// <summary>
+ /// </summary>
+ Byte = 2,
+
+ /// <summary>
+ /// </summary>
+ Char = 3,
+
+ /// <summary>
+ /// </summary>
+ Currency = 4,
+
+ /// <summary>
+ /// </summary>
+ Decimal = 5,
+
+ /// <summary>
+ /// </summary>
+ Double = 6,
+
+ /// <summary>
+ /// </summary>
+ Int16 = 7,
+
+ /// <summary>
+ /// </summary>
+ Int32 = 8,
+
+ /// <summary>
+ /// </summary>
+ Int64 = 9,
+
+ /// <summary>
+ /// </summary>
+ SByte = 10,
+
+ /// <summary>
+ /// </summary>
+ Single = 11,
+
+ /// <summary>
+ /// </summary>
+ TimeSpan = 12,
+
+ /// <summary>
+ /// </summary>
+ DateTime = 13,
+
+ /// <summary>
+ /// </summary>
+ UInt16 = 14,
+
+ /// <summary>
+ /// </summary>
+ UInt32 = 15,
+
+ /// <summary>
+ /// </summary>
+ UInt64 = 16,
+ } // InternalPrimitiveTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs
new file mode 100755
index 00000000000..51f70341f93
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs
@@ -0,0 +1,29 @@
+// InternalSerializerTypeE.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:43:59 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization.Formatters {
+
+
+ /// <summary>
+ /// </summary>
+ public enum InternalSerializerTypeE {
+
+ /// <summary>
+ /// </summary>
+ Soap = 1,
+
+ /// <summary>
+ /// </summary>
+ Binary = 2,
+ } // InternalSerializerTypeE
+
+} // System.Runtime.Serialization.Formatters
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ChangeLog b/mcs/class/corlib/System.Runtime.Serialization/ChangeLog
new file mode 100644
index 00000000000..af317f9ce50
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/ChangeLog
@@ -0,0 +1,90 @@
+2002-04-12 Duncan Mak <duncan@ximian.com>
+
+ * SerializationException.cs: Added missing constructor for serialization.
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * IFormatter.cs: Fix the return type of the Serialize method.
+
+2002/03/07 Nick Drochak <ndrochak@gol.com>
+
+ * StreamingContextStates.cs: Add missing value (CrossAppDomain) and
+ adjust All value accordingly.
+
+2002-03-01 Duncan Mak <duncan@ximian.com>
+
+ * ObjectIDGenerator.cs: Implemented.
+
+2002-02-19 Duncan Mak <duncan@ximian.com>
+
+ * SurrogateSelector.cs: Implemented.
+
+ * SerializationInfoEnumerator.cs: oh, and simplified the Current
+ property too.
+
+ * SerializationInfo.cs: Forgot to finish up GetEnumerator ().
+
+2002-02-18 Duncan Mak <duncan@ximian.com>
+
+ * SerializationInfo.cs: Converted Type.GetType calls to the faster
+ typeof operator.
+
+2002-02-16 Duncan Mak <duncan@ximian.com>
+
+ * SurrogateSelector.cs: Stubbed out. Gonna be working on this
+ tomorrow.
+
+2002-02-15 Duncan Mak <duncan@ximian.com>
+
+ * SerializationEntry.cs: Added internal constructor for writing
+ bits in SerializationInfoEnumerator.
+ * SerializationInfo.cs: Completed.
+ * SerializationInfoEnumerator.cs: Implemented. Piggybacking on
+ Hashtable's GetEnumerator method.
+
+2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * SerializationInfoEnumerator.cs: New file (stub)
+
+2002-02-12 Duncan Mak <duncan@ximian.com>
+
+ * SerializationBinder.cs: Implemented.
+ * SerializationEntry.cs: Implemented.
+ * SerializationInfo.cs: Fixed the get portion of the AssemblyName
+ property. Implemented the FullTypename property.
+
+2002-01-06 David Dawkins <david@dawkins.st>
+
+ * IFormatter.cs : New file
+ * ISerializationSurrogate.cs : New file
+ * ISurrogateSelector.cs : New file
+
+2002-05-01 Ravi Pratap <ravi@ximian.com>
+
+ * SerializationInfo.cs : Insert MonoTODO attribute.
+
+2001-08-24 Nick Drochak <ndrochak@gol.com>
+
+ * IDeserializationCallback.cs: New File
+
+Wed Nov 14 17:03:30 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * IFormatterConverter.cs, SerializationInfo.cs: CLSCompliant updates.
+
+Fri Nov 2 18:40:12 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * SerializationException.cs: implemented.
+
+2001-08-24 Nick Drochak <ndrochak@gol.com>
+
+ * SerializationInfo.cs: Added all the public methods so that the compile would not break
+
+2001-07-20 Miguel de Icaza <miguel@ximian.com>
+
+ * SerializationInfo.cs: New file.
+
+ * IFormatterConverter.cs: New file.
+
+ * ISerializable.cs: New file.
+
+
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs b/mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs
new file mode 100644
index 00000000000..a889303f51b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/IDeserializationCallback.cs
@@ -0,0 +1,14 @@
+//
+// System.Runtime.Serialization.IDeserializationCallback.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Runtime.Serialization {
+ public interface IDeserializationCallback {
+ void OnDeserialization(object sender);
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs b/mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs
new file mode 100644
index 00000000000..214f720093e
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/IFormatter.cs
@@ -0,0 +1,66 @@
+//
+// System.Runtime.Serialization.IFormatter
+//
+// Author:
+// David Dawkins (david@dawkins.st)
+//
+// (C) David Dawkins
+//
+
+using System.IO;
+
+namespace System.Runtime.Serialization {
+
+ /// <summary>
+ /// Formatting for serialized objects</summary>
+ public interface IFormatter {
+
+ //
+ // Properties
+ //
+
+ /// <summary>
+ /// Get or set the SerializationBinder used
+ /// for looking up types during deserialization</summary>
+ SerializationBinder Binder
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the StreamingContext used for serialization
+ /// and deserialization</summary>
+ StreamingContext Context
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Get or set the SurrogateSelector used by the current
+ /// formatter</summary>
+ ISurrogateSelector SurrogateSelector
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Deserialize data from the specified stream, rebuilding
+ /// the object hierarchy</summary>
+ object Deserialize(
+ Stream serializationStream
+ );
+
+ /// <summary>
+ /// Serialize the specified object to the specified stream.
+ /// Object may be the root of a graph of objects to be
+ /// serialized</summary>
+ void Serialize(
+ Stream serializationStream,
+ object graph
+ );
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs b/mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs
new file mode 100644
index 00000000000..b902ec339a5
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/IFormatterConverter.cs
@@ -0,0 +1,33 @@
+//
+// System.Runtime.Serialization.IFormatterConverter.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.Runtime.Serialization {
+ [CLSCompliant(false)]
+ public interface IFormatterConverter {
+ object Convert (object o, Type t);
+ object Convert (object o, TypeCode tc);
+
+ bool ToBoolean (object o);
+ byte ToByte (object o);
+ char ToChar (object o);
+ DateTime ToDateTime (object o);
+ Decimal ToDecimal (object o);
+ double ToDouble (object o);
+ Int16 ToInt16 (object o);
+ Int32 ToInt32 (object o);
+ Int64 ToInt64 (object o);
+ sbyte ToSByte (object o);
+ float ToSingle (object o);
+ string ToString (object o);
+ UInt16 ToUInt16 (object o);
+ UInt32 ToUInt32 (object o);
+ UInt64 ToUInt64 (object o);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs b/mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs
new file mode 100644
index 00000000000..59f5a0200b4
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/IObjectReference.cs
@@ -0,0 +1,16 @@
+//
+// System.Runtime.Serialization.IObjectReference.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Serialization {
+
+ public interface IObjectReference {
+ object GetRealObject (StreamingContext context);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs b/mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs
new file mode 100644
index 00000000000..64773514eba
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/ISerializable.cs
@@ -0,0 +1,15 @@
+//
+// System.Runtime.Serialization.ISerializable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+namespace System.Runtime.Serialization {
+ public interface ISerializable {
+ void GetObjectData (SerializationInfo info, StreamingContext context);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs b/mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs
new file mode 100644
index 00000000000..21b4ecbb7dd
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/ISerializationSurrogate.cs
@@ -0,0 +1,43 @@
+//
+// System.Runtime.Serialization.ISerializationSurrogate
+//
+// Author:
+// David Dawkins (david@dawkins.st)
+//
+// (C) David Dawkins
+//
+
+namespace System.Runtime.Serialization {
+
+ /// <summary>
+ /// Interface for serialization surrogates</summary>
+ public interface ISerializationSurrogate {
+
+ /// <summary>
+ /// Get the SerializationInfo necessary to serialize
+ /// the specified object </summary>
+ /// <param name="obj">Object to be serialized</param>
+ /// <param name="info">SerializationInfo to be populated</param>
+ /// <param name="context">Destination for serialization</param>
+ void GetObjectData(
+ object obj,
+ SerializationInfo info,
+ StreamingContext context
+ );
+
+ /// <summary>
+ /// Populate an object using the specified SerializationInfo </summary>
+ /// <param name="obj">Object to be populated</param>
+ /// <param name="info">Data used for populating object</param>
+ /// <param name="context">Source for deserialization of object</param>
+ /// <param name="selector>Starting point for searching for compatible surrogates</param>
+ /// <returns>The deserialized object</returns>
+ object SetObjectData(
+ object obj,
+ SerializationInfo info,
+ StreamingContext context,
+ ISurrogateSelector selector
+ );
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ISurrogateSelector.cs b/mcs/class/corlib/System.Runtime.Serialization/ISurrogateSelector.cs
new file mode 100644
index 00000000000..442b01789ed
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/ISurrogateSelector.cs
@@ -0,0 +1,40 @@
+//
+// System.Runtime.Serialization.ISurrogateSelector
+//
+// Author:
+// David Dawkins (david@dawkins.st)
+//
+// (C) David Dawkins
+//
+
+namespace System.Runtime.Serialization {
+
+ /// <summary>
+ /// Creation of serialization surrogate selectors</summary>
+ public interface ISurrogateSelector {
+
+ /// <summary>
+ /// Insert specified selector into available surrogates</summary>
+ void ChainSelector( ISurrogateSelector selector );
+
+ /// <summary>
+ /// Return next surrogate in the surrogate chain</summary>
+ ISurrogateSelector GetNextSelector();
+
+ /// <summary>
+ /// Fetch the surrogate according the specified type, starting
+ /// the search from the surrogate selector for the specified
+ /// StreamingContext</summary>
+ /// <param name="type">Type of the object to be serialized</param>
+ /// <param name="context">Context for the serialization/deserialization</para,>
+ /// <param name="selector">Upon return, contains a reference to the selector where the returned surrogate was found</param>
+ /// <returns>The surrogate for the specified type and context</returns>
+ ISerializationSurrogate GetSurrogate(
+ Type type,
+ StreamingContext context,
+ out ISurrogateSelector selector
+ );
+
+ }
+
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs b/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs
new file mode 100755
index 00000000000..c2821892a26
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs
@@ -0,0 +1,62 @@
+//
+// System.Runtime.Serialization.ObjectIDGenerator.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Serialization
+{
+ [Serializable]
+ public class ObjectIDGenerator
+ {
+ // Private field
+ Hashtable table;
+ long current; // this is the current ID, starts at 1
+
+ // constructor
+ public ObjectIDGenerator ()
+ : base ()
+ {
+ table = new Hashtable ();
+ current = 1;
+ }
+
+ // Methods
+ public virtual long GetId (object obj, out bool firstTime)
+ {
+ if (obj == null)
+ throw new ArgumentNullException ("The obj parameter is null.");
+
+ if (table.ContainsKey (obj)) {
+ firstTime = false;
+ return (long) table [obj];
+
+ } else {
+ firstTime = true;
+ table.Add (obj, current);
+ return current ++;
+ }
+ }
+
+ public virtual long HasId (object obj, out bool firstTime)
+ {
+ if (obj == null)
+ throw new ArgumentNullException ("The obj parameter is null.");
+
+ if (table.ContainsKey (obj)) {
+ firstTime = false;
+ return (long) table [obj];
+
+ } else {
+ firstTime = true;
+ return 0L; // 0 is the null ID
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs
new file mode 100644
index 00000000000..30eef514b4d
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SerializationBinder.cs
@@ -0,0 +1,22 @@
+//
+// System.Runtime.Serialization.SerializationBinder.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+namespace System.Runtime.Serialization
+{
+ [Serializable]
+ public abstract class SerializationBinder
+ {
+ // Constructor
+ protected SerializationBinder ()
+ : base ()
+ {
+ }
+
+ public abstract Type BindToType (string assemblyName, string typeName);
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs
new file mode 100644
index 00000000000..8221509892f
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SerializationEntry.cs
@@ -0,0 +1,40 @@
+//
+// System.Runtime.Serialization.SerializationEntry.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Serialization
+{
+ public struct SerializationEntry
+ {
+ string name;
+ Type objectType;
+ object value;
+
+ // Properties
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public Type ObjectType
+ {
+ get { return objectType; }
+ }
+
+ public object Value
+ {
+ get { return value; }
+ }
+
+ internal SerializationEntry (string name, Type type, object value)
+ {
+ this.name = name;
+ this.objectType = type;
+ this.value = value;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs
new file mode 100755
index 00000000000..27b04b6db6c
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SerializationException.cs
@@ -0,0 +1,39 @@
+//
+// System.Runtime.Serialization/SerializationException.cd
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Serialization {
+
+ [Serializable]
+ public class SerializationException : SystemException {
+ // Constructors
+ public SerializationException ()
+ : base ("An error occurred during (de)serialization")
+ {
+ }
+
+ public SerializationException (string message)
+ : base (message)
+ {
+ }
+
+ public SerializationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public SerializationException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs
new file mode 100644
index 00000000000..2cfd4073b7b
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SerializationInfo.cs
@@ -0,0 +1,262 @@
+//
+// System.Runtime.Serialization.SerializationInfo.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+using System;
+using System.Collections;
+
+namespace System.Runtime.Serialization
+{
+ public sealed class SerializationInfo
+ {
+ Hashtable serialized = new Hashtable ();
+ string assemblyName; // the assembly being serialized
+ string fullTypeName; // the type being serialized.
+
+ [CLSCompliant (false)] IFormatterConverter converter;
+
+ // Constructor
+ [CLSCompliant (false)]
+ public SerializationInfo (Type type, IFormatterConverter converter)
+ {
+ if (type == null && converter == null)
+ throw new ArgumentNullException ("Null arguments.");
+
+ this.converter = converter;
+ assemblyName = type.Assembly.FullName;
+ fullTypeName = type.FullName;
+ }
+
+ // Properties
+ public string AssemblyName
+ {
+ get { return assemblyName; }
+
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("Argument is null.");
+ assemblyName = value;
+ }
+ }
+
+ public string FullTypeName
+ {
+ get { return fullTypeName; }
+
+ set {
+ if ( value == null)
+ throw new ArgumentNullException ("Argument is null.");
+ fullTypeName = value;
+ }
+ }
+
+ public int MemberCount
+ {
+ get { return serialized.Count; }
+ }
+
+ // Methods
+ public void AddValue (string name, object value, Type type)
+ {
+ if (serialized.ContainsKey (name))
+ throw new SerializationException ("Value has been serialized already.");
+
+ SerializationEntry values = new SerializationEntry (name, type, value);
+ serialized.Add (name, values);
+ }
+
+ public object GetValue (string name, Type type)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name is null.");
+ if (!serialized.ContainsKey (name))
+ throw new SerializationException ("No element named " + name + " could be found.");
+
+ SerializationEntry values = (SerializationEntry) serialized [name];
+
+ if (values.ObjectType != type)
+ throw new InvalidCastException ("Invalid Type casting.");
+
+ return values.Value;
+ }
+
+ public void SetType (Type type)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type is null.");
+
+ fullTypeName = type.FullName;
+ assemblyName = type.Assembly.FullName;
+ }
+
+ public SerializationInfoEnumerator GetEnumerator ()
+ {
+ return new SerializationInfoEnumerator (serialized);
+ }
+
+ [CLSCompliant(false)]
+ public void AddValue (string name, short value)
+ {
+ AddValue (name, value, typeof (System.Int16));
+ }
+
+ [CLSCompliant(false)]
+ public void AddValue (string name, UInt16 value)
+ {
+ AddValue (name, value, typeof (System.UInt16));
+ }
+
+ public void AddValue (string name, int value)
+ {
+ AddValue (name, value, typeof (System.Int32));
+ }
+
+ public void AddValue (string name, byte value)
+ {
+ AddValue (name, value, typeof (System.Byte));
+ }
+
+ public void AddValue (string name, bool value)
+ {
+ AddValue (name, value, typeof (System.Boolean));
+ }
+
+ public void AddValue (string name, char value)
+ {
+ AddValue (name, value, typeof (System.Char));
+ }
+
+ [CLSCompliant(false)]
+ public void AddValue (string name, SByte value)
+ {
+ AddValue (name, value, typeof (System.SByte));
+ }
+
+ public void AddValue (string name, double value)
+ {
+ AddValue (name, value, typeof (System.Double));
+ }
+
+ public void AddValue (string name, Decimal value)
+ {
+ AddValue (name, value, typeof (System.Decimal));
+ }
+
+ public void AddValue (string name, DateTime value)
+ {
+ AddValue (name, value, typeof (System.DateTime));
+ }
+
+ public void AddValue (string name, float value)
+ {
+ AddValue (name, value, typeof (System.Single));
+ }
+
+ [CLSCompliant(false)]
+ public void AddValue (string name, UInt32 value)
+ {
+ AddValue (name, value, typeof (System.UInt32));
+ }
+
+ public void AddValue (string name, long value)
+ {
+ AddValue (name, value, typeof (System.Int64));
+ }
+
+ [CLSCompliant(false)]
+ public void AddValue (string name, UInt64 value)
+ {
+ AddValue (name, value, typeof (System.UInt64));
+ }
+
+ public void AddValue (string name, object value)
+ {
+ AddValue (name, value, value.GetType ());
+ }
+
+ public bool GetBoolean (string name)
+ {
+ return (bool) GetValue (name, typeof (System.Boolean));
+ }
+
+ public byte GetByte (string name)
+ {
+ return (byte) GetValue (name, typeof (System.Byte));
+ }
+
+ public char GetChar (string name)
+ {
+ return (char) GetValue (name, typeof (System.Char));
+ }
+
+ public DateTime GetDateTime (string name)
+ {
+ return (DateTime) GetValue (name, typeof (System.DateTime));
+ }
+
+ public Decimal GetDecimal (string name)
+ {
+ return (Decimal) GetValue (name, typeof (System.Decimal));
+ }
+
+ public double GetDouble (string name)
+ {
+ return (double) GetValue (name, typeof (System.Double));
+ }
+
+ public short GetInt16 (string name)
+ {
+ return (short) GetValue (name, typeof (System.Int16));
+ }
+
+ public int GetInt32 (string name)
+ {
+ return (int) GetValue (name, typeof (System.Int32));
+ }
+
+ public long GetInt64 (string name)
+ {
+ return (long) GetValue (name, typeof (System.Int64));
+ }
+
+ [CLSCompliant(false)]
+ public SByte GetSByte (string name)
+ {
+ return (sbyte) GetValue (name, typeof (System.SByte));
+ }
+
+ public float GetSingle (string name)
+ {
+ return (float) GetValue (name, typeof (System.Single));
+ }
+
+ public string GetString (string name)
+ {
+ return (string) GetValue (name, typeof (System.String));
+ }
+
+ [CLSCompliant(false)]
+ public UInt16 GetUInt16 (string name)
+ {
+ return (UInt16) GetValue (name, typeof (System.UInt16));
+ }
+
+ [CLSCompliant(false)]
+ public UInt32 GetUInt32 (string name)
+ {
+ return (UInt32) GetValue (name, typeof (System.UInt32));
+ }
+ [CLSCompliant(false)]
+ public UInt64 GetUInt64 (string name)
+ {
+ return (UInt64) GetValue (name, typeof (System.UInt64));
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs b/mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs
new file mode 100644
index 00000000000..a4d50af1d70
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SerializationInfoEnumerator.cs
@@ -0,0 +1,62 @@
+//
+// System.Runtime.Serialization.SerializationInfoEnumerator.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace System.Runtime.Serialization
+{
+ public sealed class SerializationInfoEnumerator : IEnumerator
+ {
+ IDictionaryEnumerator ide;
+
+ // Constructor
+ internal SerializationInfoEnumerator (Hashtable collection)
+ {
+ ide = collection.GetEnumerator ();
+ }
+
+ // Properties
+ public SerializationEntry Current
+ {
+ get { return (SerializationEntry) ide.Value; }
+ }
+
+ object IEnumerator.Current
+ {
+ get { return ide.Value; }
+ }
+
+ public string Name
+ {
+ get { return this.Current.Name; }
+ }
+
+ public Type ObjectType
+ {
+ get { return this.Current.ObjectType; }
+ }
+
+ public object Value
+ {
+ get { return this.Current.Value; }
+ }
+
+ // Methods
+ public bool MoveNext ()
+ {
+ return ide.MoveNext ();
+ }
+
+ public void Reset ()
+ {
+ ide.Reset ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs b/mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs
new file mode 100644
index 00000000000..c1b5a530fde
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/StreamingContext.cs
@@ -0,0 +1,58 @@
+//
+// System.Runtime.Serialization.StreamingContext.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Runtime.Serialization {
+
+ [Serializable]
+ public struct StreamingContext {
+ StreamingContextStates state;
+ object additional;
+
+ public StreamingContext (StreamingContextStates state)
+ {
+ this.state = state;
+ additional = null;
+ }
+
+ public StreamingContext (StreamingContextStates state, object additional)
+ {
+ this.state = state;
+ this.additional = additional;
+ }
+
+ public object Context {
+ get {
+ return additional;
+ }
+ }
+
+ public StreamingContextStates State {
+ get {
+ return state;
+ }
+ }
+
+ override public bool Equals (Object o)
+ {
+ StreamingContext other;
+
+ if (!(o is StreamingContext))
+ return false;
+
+ other = (StreamingContext) o;
+
+ return (other.state == this.state) && (other.additional == this.additional);
+ }
+
+ override public int GetHashCode ()
+ {
+ return (int) state;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs b/mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs
new file mode 100644
index 00000000000..d5a3858d310
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/StreamingContextStates.cs
@@ -0,0 +1,56 @@
+// StreamingContextStates.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:45:18 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Runtime.Serialization {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum StreamingContextStates {
+
+ /// <summary>
+ /// </summary>
+ CrossProcess = 1,
+
+ /// <summary>
+ /// </summary>
+ CrossMachine = 2,
+
+ /// <summary>
+ /// </summary>
+ File = 4,
+
+ /// <summary>
+ /// </summary>
+ Persistence = 8,
+
+ /// <summary>
+ /// </summary>
+ Remoting = 16,
+
+ /// <summary>
+ /// </summary>
+ Other = 32,
+
+ /// <summary>
+ /// </summary>
+ Clone = 64,
+
+ CrossAppDomain = 128,
+
+ /// <summary>
+ /// </summary>
+ All = 255,
+ } // StreamingContextStates
+
+} // System.Runtime.Serialization
diff --git a/mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs b/mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs
new file mode 100644
index 00000000000..ec01dfe4d20
--- /dev/null
+++ b/mcs/class/corlib/System.Runtime.Serialization/SurrogateSelector.cs
@@ -0,0 +1,92 @@
+//
+// System.Runtime.Serialization.SurrogateSelector.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+
+namespace System.Runtime.Serialization
+{
+ public class SurrogateSelector : ISurrogateSelector
+ {
+ // Fields
+ Hashtable Surrogates = new Hashtable ();
+ string currentKey = null; // current key of Surrogates
+
+ internal struct Bundle
+ {
+ public ISerializationSurrogate surrogate;
+ public ArrayList selectors;
+
+ public Bundle (ISerializationSurrogate surrogate)
+ {
+ this.surrogate = surrogate;
+ selectors = new ArrayList ();
+ }
+ }
+
+ // Constructor
+ public SurrogateSelector()
+ : base ()
+ {
+ }
+
+ // Methods
+ public virtual void AddSurrogate (Type type,
+ StreamingContext context, ISerializationSurrogate surrogate)
+ {
+ if (type == null || surrogate == null)
+ throw new ArgumentNullException ("Null reference.");
+
+ currentKey = type.FullName + "#" + context.ToString ();
+
+ if (Surrogates.ContainsKey (currentKey))
+ throw new ArgumentException ("A surrogate for " + type.FullName + " already exists.");
+
+ Bundle values = new Bundle (surrogate);
+
+ Surrogates.Add (currentKey, values);
+ }
+
+ public virtual void ChainSelector (ISurrogateSelector selector)
+ {
+ if (selector == null)
+ throw new ArgumentNullException ("Selector is null.");
+
+ Bundle current = (Bundle) Surrogates [currentKey];
+ current.selectors.Add (selector);
+ }
+
+ public virtual ISurrogateSelector GetNextSelector ()
+ {
+ Bundle current = (Bundle) Surrogates [currentKey];
+ return (ISurrogateSelector) current.selectors [current.selectors.Count];
+ }
+
+ public virtual ISerializationSurrogate GetSurrogate (Type type,
+ StreamingContext context, out ISurrogateSelector selector)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type is null.");
+
+ string key = type.FullName + "#" + context.ToString ();
+ Bundle current = (Bundle) Surrogates [key];
+ selector = (ISurrogateSelector) current.selectors [current.selectors.Count - 1];
+
+ return (ISerializationSurrogate) current.surrogate;
+ }
+
+ public virtual void RemoveSurrogate (Type type, StreamingContext context)
+ {
+ if (type == null)
+ throw new ArgumentNullException ("type is null.");
+
+ string key = type.FullName + "#" + context.ToString ();
+ Surrogates.Remove (key);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/AsymmetricAlgorithm.cs b/mcs/class/corlib/System.Security.Cryptography/AsymmetricAlgorithm.cs
new file mode 100755
index 00000000000..e0f57333bab
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/AsymmetricAlgorithm.cs
@@ -0,0 +1,108 @@
+//
+// System.Security.Cryptography AsymmetricAlgorithm Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Abstract base class for all cryptographic asymmetric algorithms.
+ /// Available algorithms include:
+ /// RSA, DSA
+ /// </summary>
+ public abstract class AsymmetricAlgorithm {
+ protected int KeySizeValue; // The size of the secret key used by the symmetric algorithm in bits.
+ protected KeySizes[] LegalKeySizesValue; // Specifies the key sizes that are supported by the symmetric algorithm.
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ protected AsymmetricAlgorithm () {
+ throw new CryptographicException();
+ }
+
+ /// <summary>
+ /// Gets the key exchange algorithm
+ /// </summary>
+ public abstract string KeyExchangeAlgorithm {get;}
+
+ /// <summary>
+ /// Gets or sets the actual key size
+ /// </summary>
+ public virtual int KeySize {
+ get {
+ return this.KeySizeValue;
+ }
+ set {
+ if (!IsLegalKeySize(this.LegalKeySizesValue, value))
+ throw new CryptographicException("key size not supported by algorithm");
+
+ this.KeySizeValue = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets all legal key sizes
+ /// </summary>
+ public virtual KeySizes[] LegalKeySizes {
+ get {
+ return this.LegalKeySizesValue;
+ }
+ }
+
+ /// <summary>
+ /// Gets the signature algorithm
+ /// </summary>
+ public abstract string SignatureAlgorithm {get;}
+
+ /// <summary>
+ /// Reconstructs the AsymmetricAlgorithm Object from an XML-string
+ /// </summary>
+ public abstract void FromXmlString(string xmlString);
+
+ /// <summary>
+ /// Returns an XML string representation the current AsymmetricAlgorithm object
+ /// </summary>
+ public abstract string ToXmlString(bool includePrivateParameters);
+
+ private bool IsLegalKeySize(KeySizes[] LegalKeys, int Size) {
+ foreach (KeySizes LegalKeySize in LegalKeys) {
+ for (int i=LegalKeySize.MinSize; i<=LegalKeySize.MaxSize; i+=LegalKeySize.SkipSize) {
+ if (i == Size)
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Checks wether the given keyLength is valid for the current algorithm
+ /// </summary>
+ /// <param name="bitLength">the given keyLength</param>
+ public bool ValidKeySize(int bitLength) {
+ return IsLegalKeySize(LegalKeySizesValue, bitLength);
+ }
+
+ /// <summary>
+ /// Creates the default implementation of the default asymmetric algorithm (RSA).
+ /// </summary>
+ public static AsymmetricAlgorithm Create () {
+ return RSA.Create();;
+ }
+
+ /// <summary>
+ /// Creates a specific implementation of the given asymmetric algorithm.
+ /// </summary>
+ /// <param name="algName">the given algorithm</param>
+ [MonoTODO]
+ public static AsymmetricAlgorithm Create (string algName) {
+ // TODO: use reflection to create a new instance of the given algorithm
+ return null;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.cs b/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.cs
new file mode 100755
index 00000000000..78ee4ce669c
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.cs
@@ -0,0 +1,45 @@
+//
+// System.Security.Cryptography AsymmetricKeyExchangeDeformatter Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Abstract base class for all asymmetric key exchange deformatter.
+ /// Available derived classes:
+ /// RSAOAEPKeyExchangeDeformatter, RSAPKCS1KeyExchangeDeformatter
+ /// </summary>
+ public abstract class AsymmetricKeyExchangeDeformatter {
+
+ /// <summary>
+ /// constructor, no idea why it is here (abstract class) :-)
+ /// just for compatibility with MS
+ /// </summary>
+ public AsymmetricKeyExchangeDeformatter() {
+ }
+
+ /// <summary>
+ /// XML string containing the parameters of an asymmetric key exchange operation
+ /// </summary>
+ public abstract string Parameters {get; set;}
+
+ /// <summary>
+ /// get secret data
+ /// </summary>
+ public abstract byte[] DecryptKeyExchange(byte[] rgb);
+
+ /// <summary>
+ /// set the private key
+ /// </summary>
+ public abstract void SetKey(AsymmetricAlgorithm key);
+
+ } // AsymmetricKeyExchangeDeformatter
+
+} // System.Security.Cryptography
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.cs b/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.cs
new file mode 100755
index 00000000000..e1b5c0f16de
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.cs
@@ -0,0 +1,50 @@
+//
+// System.Security.Cryptography AsymmetricKeyExchangeFormatter Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Abstract base class for all asymmetric key exchange formatter.
+ /// Available derived classes:
+ /// RSAOAEPKeyExchangeFormatter, RSAPKCS1KeyExchangeFormatter
+ /// </summary>
+ public abstract class AsymmetricKeyExchangeFormatter {
+
+ /// <summary>
+ /// constructor, no idea why it is here (abstract class) :-)
+ /// just for compatibility with MS
+ /// </summary>
+ public AsymmetricKeyExchangeFormatter() {
+ }
+
+ /// <summary>
+ /// XML string containing the parameters of an asymmetric key exchange operation
+ /// </summary>
+ public abstract string Parameters {get;}
+
+ /// <summary>
+ /// create encrypted key exchange data
+ /// </summary>
+ public abstract byte[] CreateKeyExchange(byte[] data);
+
+ /// <summary>
+ /// create encrypted key exchange data
+ /// </summary>
+ public abstract byte[] CreateKeyExchange(byte[] data, Type symAlgType);
+
+ /// <summary>
+ /// set the private key
+ /// </summary>
+ public abstract void SetKey(AsymmetricAlgorithm key);
+
+ } // AsymmetricKeyExchangeFormatter
+
+} // System.Security.Cryptography
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureDeformatter.cs b/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureDeformatter.cs
new file mode 100755
index 00000000000..55abce71c5c
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureDeformatter.cs
@@ -0,0 +1,52 @@
+//
+// System.Security.Cryptography AsymmetricSignatureDeformatter Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Abstract base class for all asymmetric signature deformatter.
+ /// Available derived classes:
+ /// DSASignatureDeformatter, RSAPKCS1SignatureDeformatter
+ /// </summary>
+ public abstract class AsymmetricSignatureDeformatter {
+
+ /// <summary>
+ /// constructor, no idea why it is here (abstract class) :-)
+ /// just for compatibility with MS
+ /// </summary>
+ public AsymmetricSignatureDeformatter() {
+ }
+
+ /// <summary>
+ /// Sets the hash algorithm used for verifying a signature
+ /// </summary>
+ public abstract void SetHashAlgorithm(string strName);
+
+ /// <summary>
+ /// set the private key
+ /// </summary>
+ public abstract void SetKey(AsymmetricAlgorithm key);
+
+ /// <summary>
+ /// Verifies the given Signature
+ /// </summary>
+ public abstract bool VerifySignature(byte[] rgbHash, byte[] rgbSignature);
+
+ /// <summary>
+ /// Verifies the given Signature with the given hash algorithm
+ /// </summary>
+ public virtual bool VerifySignature(HashAlgorithm hash, byte[] rgbSignature) {
+ return VerifySignature(hash.Hash, rgbSignature);
+ }
+
+ } // AsymmetricSignatureDeformatter
+
+} // System.Security.Cryptography
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureFormatter.cs b/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureFormatter.cs
new file mode 100755
index 00000000000..541b8a4faa3
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/AsymmetricSignatureFormatter.cs
@@ -0,0 +1,52 @@
+//
+// System.Security.Cryptography AsymmetricSignatureFormatter Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.Security;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Abstract base class for all asymmetric signature formatter.
+ /// Available derived classes:
+ /// DSASignatureFormatter, RSAPKCS1SignatureFormatter
+ /// </summary>
+ public abstract class AsymmetricSignatureFormatter {
+
+ /// <summary>
+ /// constructor, no idea why it is here (abstract class) :-)
+ /// just for compatibility with MS
+ /// </summary>
+ public AsymmetricSignatureFormatter() {
+ }
+
+ /// <summary>
+ /// Sets the hash algorithm used for verifying a signature
+ /// </summary>
+ public abstract void SetHashAlgorithm(string strName);
+
+ /// <summary>
+ /// set the private key
+ /// </summary>
+ public abstract void SetKey(AsymmetricAlgorithm key);
+
+ /// <summary>
+ /// Create a signature from the given data
+ /// </summary>
+ public abstract byte[] CreateSignature(byte[] rgbHash);
+
+ /// <summary>
+ /// Create a signature from data with the specified hash algorithm
+ /// </summary>
+ public virtual byte[] CreateSignature(HashAlgorithm hash) {
+ return CreateSignature(hash.Hash);
+ }
+
+ } // AsymmetricSignatureFormatter
+
+} // System.Security.Cryptography
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/ChangeLog b/mcs/class/corlib/System.Security.Cryptography/ChangeLog
new file mode 100644
index 00000000000..674c5ea2b81
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/ChangeLog
@@ -0,0 +1,90 @@
+2002-02-21 Mark Crichton <crichton@gimp.org>
+
+ * RNGCryptoServiceProvider.cs: New file.
+ * RandomNumberGenerator.cs: Constructor is now marked public.
+
+2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * DSACryptoServiceProvider.cs, SHA384Managed.cs, SHA512Managed.cs,
+ Rijndael.cs, RSA.cs, RSAParameters.cs : New files (stubs)
+
+Mon Feb 11 13:26:17 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * X509Certificates: dummy class.
+
+2002-01-10 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Create (trivial) implementation of RandomNumberGenerator
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * CryptoAPITransform.cs, DESCryptoProvider.cs : MonoTODO attribute
+ decoration.
+
+ * HashAlgorithm.cs, MD5.cs, SHA1.cs, SHA256.cs, SHA384.cs : Ditto.
+
+ * SHA512.cs, SymmetricAlgorithm.cs, ToBase64Transform.cs,
+ AsymmetricAlgorithm.cs, CryptoStream.cs, DSA.cs, DSASignatureDeformatter.cs,
+ DSASignatureFormatter.cs, SignatureDescription.cs : Ditto.
+
+Wed Nov 14 17:04:30 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * MD5CryptoServiceProvider.cs, SHA1CryptoServiceProvider.cs,
+ SHA256Managed.cs: CLSCompliant updates.
+
+2001-10-11 Thomas Neidhart <tome@sbox.tugraz.at>
+
+ * CryptoAPITransform.cs: Initial version
+ * CryptoStream.cs: Initial version
+ * CspParameter.cs: Initial version
+ * CspProviderFlags.cs: Initial version
+ * DSA.cs: Initial version
+ * DSAParameters.cs: Initial version
+ * DSASignatureDeformatter.cs: Initial version
+ * DSASignatureFormatter.cs: Initial version
+ * DeriveBytes.cs: Initial version
+
+2001-10-06 Thomas Neidhart <tome@sbox.tugraz.at>
+
+ * AsymmetricAlgorithm.cs: Inital version
+ * AsymmetricKeyExchangeDeformatter.cs: Initial version
+ * AsymmetricKeyExchangeFormatter.cs: Initial version
+ * AsymmetricSignatureDeformatter.cs: Initial version
+ * AsymmetricSignatureFormatter.cs: Initial version
+ * PaddingMode.cs: Added PaddingMode.None
+ * SignatureDescription.cs: Initial version
+ * CryptographicException.cs: Initial version
+ * CryptographicUnknownOperationException.cs: Initial version
+ * SymmetricAlgorithm.cs: Implemented CreateDecryptor, CreateEncryptor
+ and Create() methods.
+
+2001-08-20 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * DES.cs encryption core is about 30% faster than previous version.
+ * DESCryptoServiceProvider.cs added PKCS-5 padding.
+
+2001-08-09 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * ToBase64Transform.cs: Base64Table now supports both encoding
+ and decoding tables. As a result Table was renamed to EncodeTable
+ and DecodeTable was added.
+ * FromBase64Transform.cs: Initial check-in.
+ * DES.cs: Initial check-in.
+ * DESCryptoServiceProvider.cs: Initial check-in.
+
+2001-08-01 Matthew S. Ford <Matthew.S.Ford@Rose-Hulman.Edu>
+
+ * CipherMode.cs: Initial version.
+ * CryptoStreamMode.cs: Initial version.
+ * HashAlgorithm.cs: Initial version.
+ * ICryptoTransform.cs: Initial version.
+ * KeySizes.cs: Initial version.
+ * MD5.cs: Initial version.
+ * MD5CryptoServiceProvider.cs: Initial version.
+ * PaddingMode.cs: Initial version.
+ * SHA1.cs: Initial version.
+ * SHA1CryptoServiceProvider.cs: Initial version.
+ * SHA256.cs: Initial version.
+ * SHA256Managed.cs: Initial version.
+ * SHA384.cs: Initial version.
+ * SHA512.cs: Initial version.
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/CipherMode.cs b/mcs/class/corlib/System.Security.Cryptography/CipherMode.cs
new file mode 100644
index 00000000000..e2cab26df53
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CipherMode.cs
@@ -0,0 +1,24 @@
+//
+// System.Security.Cryptography CipherMode enumeration
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Block cipher modes of operation.
+ /// </summary>
+ public enum CipherMode {
+ CBC, // Cipher Block Chaining
+ CFB, // Cipher Feedback
+ CTS, // Cipher Text Stealing
+ ECB, // Electronic Codebook
+ OFB // Output Feedback
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoAPITransform.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoAPITransform.cs
new file mode 100755
index 00000000000..ea16089740e
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoAPITransform.cs
@@ -0,0 +1,77 @@
+//
+// System.Security.Cryptography CryptoAPITransform.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.IO;
+
+namespace System.Security.Cryptography
+{
+
+ public sealed class CryptoAPITransform : ICryptoTransform
+ {
+ public CryptoAPITransform()
+ {
+ }
+
+ /// <summary>
+ /// Indicates if the Transform object can transform multiple blocks
+ /// </summary>
+ [MonoTODO]
+ public bool CanTransformMultipleBlocks
+ {
+ get
+ {
+ // FIXME: should not be always true
+ return true;
+ }
+ }
+
+ [MonoTODO]
+ public int InputBlockSize
+ {
+ get {
+ // TODO: implement
+ return 0;
+ }
+ }
+
+ [MonoTODO]
+ public IntPtr KeyHandle
+ {
+ get {
+ // TODO: implement
+ return IntPtr.Zero;
+ }
+ }
+
+ [MonoTODO]
+ public int OutputBlockSize
+ {
+ get {
+ // TODO: implement
+ return 0;
+ }
+ }
+
+ [MonoTODO]
+ public int TransformBlock(byte[] inputBuffer, int inputOffset,
+ int inputCount, byte[] outputBuffer, int outputOffset)
+ {
+ // TODO: implement
+ return 0;
+ }
+
+ [MonoTODO]
+ public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount)
+ {
+ // TODO: implement
+ return null;
+ }
+
+ } // CryptoAPITransform
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoStream.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoStream.cs
new file mode 100755
index 00000000000..6dad1ca628d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoStream.cs
@@ -0,0 +1,120 @@
+//
+// System.Security.Cryptography CryptoStream.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.IO;
+
+namespace System.Security.Cryptography
+{
+
+ public class CryptoStream : Stream
+ {
+ private CryptoStreamMode _mode;
+
+ public CryptoStream(Stream stream, ICryptoTransform transform, CryptoStreamMode mode)
+ {
+ _mode = mode;
+ }
+
+ public override bool CanRead
+ {
+ get {
+ switch (_mode) {
+ case CryptoStreamMode.Read:
+ return true;
+
+ case CryptoStreamMode.Write:
+ return false;
+
+ default:
+ return false;
+ }
+ }
+ }
+
+ public override bool CanSeek
+ {
+ get {
+ return false;
+ }
+ }
+
+ public override bool CanWrite
+ {
+ get {
+ switch (_mode) {
+ case CryptoStreamMode.Read:
+ return false;
+
+ case CryptoStreamMode.Write:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+ }
+
+ public override long Length
+ {
+ get {
+ throw new NotSupportedException("Length property not supported by CryptoStream");
+ }
+ }
+
+ public override long Position
+ {
+ get {
+ throw new NotSupportedException("Position property not supported by CryptoStream");
+ }
+ set {
+ throw new NotSupportedException("Position property not supported by CryptoStream");
+ }
+ }
+
+ [MonoTODO]
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ // TODO: implement
+ return 0;
+ }
+
+ [MonoTODO]
+ public override void Write(byte[] buffer, int offset, int count)
+ {
+ // TODO: implement
+ }
+
+ [MonoTODO]
+ public override void Flush()
+ {
+ // TODO: implement
+ }
+
+ [MonoTODO]
+ public void FlushFinalBlock()
+ {
+ if (_mode != CryptoStreamMode.Write)
+ throw new NotSupportedException("cannot flush a non-writeable CryptoStream");
+
+ // TODO: implement
+ }
+
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ throw new NotSupportedException("cannot seek a CryptoStream");
+ }
+
+ public override void SetLength(long value)
+ {
+ // LAMESPEC: should throw NotSupportedException like Seek??
+ return;
+ }
+
+ } // CryptoStream
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoStreamMode.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoStreamMode.cs
new file mode 100644
index 00000000000..6e08107b7d2
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoStreamMode.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.Cryptography CryptoStreamMode enumeration
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by authors.
+//
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// FIXME (the comment): Whether the crypto-stream is in read mode or write mode?
+ /// </summary>
+ public enum CryptoStreamMode {
+ Read,
+ Write
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptographicException.cs b/mcs/class/corlib/System.Security.Cryptography/CryptographicException.cs
new file mode 100755
index 00000000000..676a1b8ff02
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptographicException.cs
@@ -0,0 +1,40 @@
+//
+// System.Security.Cryptography.CryptographicException.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ [Serializable]
+ public class CryptographicException : SystemException {
+ // Constructors
+ public CryptographicException ()
+ : base ("Error occured during a cryptographic operation.")
+ {
+ }
+
+ public CryptographicException (int hr)
+ {
+ HResult = hr;
+ }
+
+ public CryptographicException (string message)
+ : base (message)
+ {
+ }
+
+ public CryptographicException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public CryptographicException (string format, string insert)
+ : base (String.Format(format, insert))
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs b/mcs/class/corlib/System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs
new file mode 100755
index 00000000000..7beeea48132
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs
@@ -0,0 +1,35 @@
+//
+// System.Security.Cryptography.CryptographicUnexpectedOperationException.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ [Serializable]
+ public class CryptographicUnexpectedOperationException : CryptographicException {
+ // Constructors
+ public CryptographicUnexpectedOperationException ()
+ : base ("Error occured during a cryptographic operation.")
+ {
+ }
+
+ public CryptographicUnexpectedOperationException (string message)
+ : base (message)
+ {
+ }
+
+ public CryptographicUnexpectedOperationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public CryptographicUnexpectedOperationException (string format, string insert)
+ : base (String.Format(format, insert))
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/CspParameters.cs b/mcs/class/corlib/System.Security.Cryptography/CspParameters.cs
new file mode 100755
index 00000000000..7c84eaff8af
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CspParameters.cs
@@ -0,0 +1,57 @@
+//
+// System.Security.Cryptography CspParameters.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography
+{
+
+ /// <summary>
+ /// Contains information passed to Crypto Service Providers (CSP)
+ /// </summary>
+ public sealed class CspParameters
+ {
+ private CspProviderFlags _Flags;
+
+ public CspParameters() : this(1) {}
+
+ public CspParameters(int dwTypeIn) : this(dwTypeIn, null) {}
+
+ public CspParameters(int dwTypeIn, string strProviderNameIn) : this(dwTypeIn, null, null) {}
+
+ public CspParameters(int dwTypeIn, string strProviderNameIn, string strContainerNameIn)
+ {
+ ProviderType = dwTypeIn;
+ ProviderName = strProviderNameIn;
+ KeyContainerName = strContainerNameIn;
+
+ // not defined in specs, only tested from M$ impl
+ KeyNumber = -1;
+ }
+
+ public string KeyContainerName;
+
+ public int KeyNumber;
+
+ public string ProviderName;
+
+ public int ProviderType;
+
+ public CspProviderFlags Flags
+ {
+ get {
+ return _Flags;
+ }
+
+ set {
+ _Flags = value;
+ }
+ }
+
+ } // CspParameters
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/CspProviderFlags.cs b/mcs/class/corlib/System.Security.Cryptography/CspProviderFlags.cs
new file mode 100755
index 00000000000..bdd36811df4
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/CspProviderFlags.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.Cryptography CspProviderFlags enumeration
+//
+// Authors:
+// Thomas Neidhart <tome@sbox.tugraz.at>
+//
+
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// CSP Provider Flags
+ /// </summary>
+ [Flags]
+ public enum CspProviderFlags {
+ UseDefaultKeyContainer,
+ UseMachineKeyStore
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/DES.cs b/mcs/class/corlib/System.Security.Cryptography/DES.cs
new file mode 100644
index 00000000000..f2d344f21c2
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DES.cs
@@ -0,0 +1,587 @@
+//
+// System.Security.Cryptography.DES
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+// References: FIPS PUB 46-3
+
+namespace System.Security.Cryptography {
+
+ internal sealed class DESCore {
+
+ internal static readonly int KEY_BIT_SIZE = 64;
+ internal static readonly int KEY_BYTE_SIZE = KEY_BIT_SIZE / 8;
+ internal static readonly int BLOCK_BIT_SIZE = 64;
+ internal static readonly int BLOCK_BYTE_SIZE = BLOCK_BIT_SIZE / 8;
+
+ private byte [] keySchedule;
+ private byte [] byteBuff;
+ private uint [] dwordBuff;
+
+ internal delegate void DESCall (byte [] block, byte [] output);
+
+
+ // Ek(Ek(m)) = m
+ internal static ulong [] weakKeys = {
+ 0x0101010101010101, /* 0000000 0000000 */
+ 0xFEFEFEFEFEFEFEFE, /* FFFFFFF FFFFFFF */
+ 0x1F1F1F1FE0E0E0E0, /* 0000000 FFFFFFF */
+ 0xE0E0E0E01F1F1F1F /* FFFFFFF 0000000 */
+ };
+
+ // Ek1(Ek2(m)) = m
+ internal static ulong [] semiweakKeys = {
+ 0x01FE01FE01FE01FE, 0xFE01FE01FE01FE01,
+ 0x1FE01FE00EF10EF1, 0xE01FE01FF10EF10E,
+ 0x01E001E001F101F1, 0xE001E001F101F101,
+ 0x1FFE1FFE0EFE0EFE, 0xFE1FFE1FFE0EFE0E,
+ 0x011F011F010E010E, 0x1F011F010E010E01,
+ 0xE0FEE0FEF1FEF1FE, 0xFEE0FEE0FEF1FEF1
+ };
+
+
+
+ // S-boxes from FIPS 46-3, Appendix 1, page 17
+ private static byte [] sBoxes = {
+ /* S1 */
+ 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
+ 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
+ 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
+ 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13,
+
+ /* S2 */
+ 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
+ 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
+ 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
+ 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9,
+
+ /* S3 */
+ 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
+ 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
+ 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
+ 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12,
+
+ /* S4 */
+ 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
+ 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
+ 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
+ 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14,
+
+ /* S5 */
+ 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
+ 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
+ 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
+ 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3,
+
+ /* S6 */
+ 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
+ 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
+ 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
+ 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13,
+
+ /* S7 */
+ 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
+ 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
+ 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
+ 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12,
+
+ /* S8 */
+ 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
+ 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
+ 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
+ 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
+ };
+
+
+ // P table from page 15, also in Appendix 1, page 18
+ private static byte [] pTab = {
+ 16-1, 7-1, 20-1, 21-1,
+ 29-1, 12-1, 28-1, 17-1,
+ 1-1, 15-1, 23-1, 26-1,
+ 5-1, 18-1, 31-1, 10-1,
+ 2-1, 8-1, 24-1, 14-1,
+ 32-1, 27-1, 3-1, 9-1,
+ 19-1, 13-1, 30-1, 6-1,
+ 22-1, 11-1, 4-1, 25-1
+ };
+
+
+ // Permuted choice 1 table, PC-1, page 19
+ // Translated to zero-based format.
+ private static byte [] PC1 = {
+ 57-1, 49-1, 41-1, 33-1, 25-1, 17-1, 9-1,
+ 1-1, 58-1, 50-1, 42-1, 34-1, 26-1, 18-1,
+ 10-1, 2-1, 59-1, 51-1, 43-1, 35-1, 27-1,
+ 19-1, 11-1, 3-1, 60-1, 52-1, 44-1, 36-1,
+
+ 63-1, 55-1, 47-1, 39-1, 31-1, 23-1, 15-1,
+ 7-1, 62-1, 54-1, 46-1, 38-1, 30-1, 22-1,
+ 14-1, 6-1, 61-1, 53-1, 45-1, 37-1, 29-1,
+ 21-1, 13-1, 5-1, 28-1, 20-1, 12-1, 4-1
+ };
+
+
+ private static byte [] leftRot = {
+ 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
+ };
+
+ private static byte [] leftRotTotal;
+
+
+
+ // Permuted choice 2 table, PC-2, page 21
+ // Translated to zero-based format.
+ private static byte [] PC2 = {
+ 14-1, 17-1, 11-1, 24-1, 1-1, 5-1,
+ 3-1, 28-1, 15-1, 6-1, 21-1, 10-1,
+ 23-1, 19-1, 12-1, 4-1, 26-1, 8-1,
+ 16-1, 7-1, 27-1, 20-1, 13-1, 2-1,
+ 41-1, 52-1, 31-1, 37-1, 47-1, 55-1,
+ 30-1, 40-1, 51-1, 45-1, 33-1, 48-1,
+ 44-1, 49-1, 39-1, 56-1, 34-1, 53-1,
+ 46-1, 42-1, 50-1, 36-1, 29-1, 32-1
+ };
+
+
+ // Initial permutation IP, page 10.
+ // Transposed to 0-based format.
+ private static byte [] ipBits = {
+ 58-1, 50-1, 42-1, 34-1, 26-1, 18-1, 10-1, 2-1,
+ 60-1, 52-1, 44-1, 36-1, 28-1, 20-1, 12-1, 4-1,
+ 62-1, 54-1, 46-1, 38-1, 30-1, 22-1, 14-1, 6-1,
+ 64-1, 56-1, 48-1, 40-1, 32-1, 24-1, 16-1, 8-1,
+ 57-1, 49-1, 41-1, 33-1, 25-1, 17-1, 9-1, 1-1,
+ 59-1, 51-1, 43-1, 35-1, 27-1, 19-1, 11-1, 3-1,
+ 61-1, 53-1, 45-1, 37-1, 29-1, 21-1, 13-1, 5-1,
+ 63-1, 55-1, 47-1, 39-1, 31-1, 23-1, 15-1, 7-1
+ };
+
+
+ // Final permutation FP = IP^(-1), page 10.
+ // Transposed to 0-based format.
+ private static byte [] fpBits = {
+ 40-1, 8-1, 48-1, 16-1, 56-1, 24-1, 64-1, 32-1,
+ 39-1, 7-1, 47-1, 15-1, 55-1, 23-1, 63-1, 31-1,
+ 38-1, 6-1, 46-1, 14-1, 54-1, 22-1, 62-1, 30-1,
+ 37-1, 5-1, 45-1, 13-1, 53-1, 21-1, 61-1, 29-1,
+ 36-1, 4-1, 44-1, 12-1, 52-1, 20-1, 60-1, 28-1,
+ 35-1, 3-1, 43-1, 11-1, 51-1, 19-1, 59-1, 27-1,
+ 34-1, 2-1, 42-1, 10-1, 50-1, 18-1, 58-1, 26-1,
+ 33-1, 1-1, 41-1, 9-1, 49-1, 17-1, 57-1, 25-1
+ };
+
+
+
+ private static uint [] spBoxes;
+ private static int [] ipTab;
+ private static int [] fpTab;
+
+
+ static DESCore ()
+ {
+ spBoxes = new uint [64 * 8];
+
+ int [] pBox = new int [32];
+
+ for (int p = 0; p < 32; p++) {
+ for (int i = 0; i < 32; i++) {
+ if (p == pTab [i]) {
+ pBox [p] = i;
+ break;
+ }
+ }
+ }
+
+
+ for (int s = 0; s < 8; s++) { // for each S-box
+ int sOff = s << 6;
+
+ for (int i = 0; i < 64; i++) { // inputs
+ uint sp=0;
+
+ int indx = (i & 0x20) | ((i & 1) << 4) | ((i >> 1) & 0xF);
+
+ for (int j = 0; j < 4; j++) { // for each bit in the output
+ if ((sBoxes [sOff + indx] & (8 >> j)) != 0) {
+ sp |= (uint) (1 << (31 - pBox [(s << 2) + j]));
+ }
+ }
+
+ spBoxes [sOff + i] = sp;
+ }
+ }
+
+
+ leftRotTotal = new byte [leftRot.Length];
+
+
+ for (int i = 0; i < leftRot.Length; i++) {
+ int r = 0;
+ for (int j = 0; j <= i; r += leftRot [j++]);
+ leftRotTotal [i] = (byte) r;
+ }
+
+
+ InitPermutationTable (ipBits, out ipTab);
+ InitPermutationTable (fpBits, out fpTab);
+
+ } // class constructor
+
+
+
+ // Default constructor.
+ internal DESCore ()
+ {
+ keySchedule = new byte [KEY_BYTE_SIZE * 16];
+ byteBuff = new byte [BLOCK_BYTE_SIZE];
+ dwordBuff = new uint [BLOCK_BYTE_SIZE / 4];
+ }
+
+
+
+
+ private static void InitPermutationTable (byte [] pBits, out int [] permTab)
+ {
+ permTab = new int [8*2 * 8*2 * (64/32)];
+
+ for (int i = 0; i < 16; i++) {
+ for (int j = 0; j < 16; j++) {
+ int offs = (i << 5) + (j << 1);
+ for (int n = 0; n < 64; n++) {
+ int bitNum = (int) pBits [n];
+ if ((bitNum >> 2 == i) &&
+ 0 != (j & (8 >> (bitNum & 3)))) {
+ permTab [offs + (n >> (3+2))] |= (int) ((0x80808080 & (0xFF << (n & (3 << 3)))) >> (n & 7));
+ }
+ }
+ }
+ }
+ }
+
+
+
+ internal static ulong PackKey (byte [] key)
+ {
+ ulong res = 0;
+ for (int i = 0, sh = 8*KEY_BYTE_SIZE; (sh = sh - 8) >= 0; i++) {
+ res |= (ulong) key [i] << sh;
+ }
+ return res;
+ }
+
+
+
+ internal static byte [] UnpackKey (ulong key)
+ {
+ byte [] res = new byte [KEY_BYTE_SIZE];
+ for (int i = 0, sh = 8*KEY_BYTE_SIZE; (sh = sh - 8) >= 0; i++) {
+ res [i] = (byte) (key >> sh);
+ }
+ return res;
+ }
+
+
+
+ internal static bool IsValidKeySize (byte [] key)
+ {
+ return (key.Length == KEY_BYTE_SIZE);
+ }
+
+
+
+ private uint CipherFunct(uint r, int n)
+ {
+ uint res = 0;
+ byte [] subkey = keySchedule;
+ int i = n << 3;
+
+ uint rt = (r >> 1) | (r << 31); // ROR32(r)
+ res |= spBoxes [0*64 + (((rt >> 26) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [1*64 + (((rt >> 22) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [2*64 + (((rt >> 18) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [3*64 + (((rt >> 14) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [4*64 + (((rt >> 10) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [5*64 + (((rt >> 6) ^ subkey [i++]) & 0x3F)];
+ res |= spBoxes [6*64 + (((rt >> 2) ^ subkey [i++]) & 0x3F)];
+ rt = (r << 1) | (r >> 31); // ROL32(r)
+ res |= spBoxes [7*64 + ((rt ^ subkey [i]) & 0x3F)];
+
+ return res;
+ }
+
+
+ private static void Permutation (byte [] input, byte [] _output, int [] permTab, bool preSwap)
+ {
+
+ if (preSwap) BSwap (input);
+
+ byte [] output = _output;
+
+ int offs1 = (((int)(input [0]) >> 4)) << 1;
+ int offs2 = (1 << 5) + ((((int)input [0]) & 0xF) << 1);
+
+ int d1 = permTab [offs1++] | permTab [offs2++];
+ int d2 = permTab [offs1] | permTab [offs2];
+
+
+ int max = BLOCK_BYTE_SIZE << 1;
+ for (int i = 2, indx = 1; i < max; i += 2, indx++) {
+ int ii = (int) input [indx];
+ offs1 = (i << 5) + ((ii >> 4) << 1);
+ offs2 = ((i + 1) << 5) + ((ii & 0xF) << 1);
+
+ d1 |= permTab [offs1++] | permTab [offs2++];
+ d2 |= permTab [offs1] | permTab [offs2];
+ }
+
+ if (preSwap) {
+ output [0] = (byte) (d1);
+ output [1] = (byte) (d1 >> 8);
+ output [2] = (byte) (d1 >> 16);
+ output [3] = (byte) (d1 >> 24);
+ output [4] = (byte) (d2);
+ output [5] = (byte) (d2 >> 8);
+ output [6] = (byte) (d2 >> 16);
+ output [7] = (byte) (d2 >> 24);
+ } else {
+ output [0] = (byte) (d1 >> 24);
+ output [1] = (byte) (d1 >> 16);
+ output [2] = (byte) (d1 >> 8);
+ output [3] = (byte) (d1);
+ output [4] = (byte) (d2 >> 24);
+ output [5] = (byte) (d2 >> 16);
+ output [6] = (byte) (d2 >> 8);
+ output [7] = (byte) (d2);
+ }
+ }
+
+
+
+
+ private static void BSwap (byte [] byteBuff)
+ {
+ byte t;
+
+ t = byteBuff [0];
+ byteBuff [0] = byteBuff [3];
+ byteBuff [3] = t;
+
+ t = byteBuff [1];
+ byteBuff [1] = byteBuff [2];
+ byteBuff [2] = t;
+
+ t = byteBuff [4];
+ byteBuff [4] = byteBuff [7];
+ byteBuff [7] = t;
+
+ t = byteBuff [5];
+ byteBuff [5] = byteBuff [6];
+ byteBuff [6] = t;
+ }
+
+
+
+ internal void SetKey (byte [] key)
+ {
+ // NOTE: see Fig. 3, Key schedule calculation, at page 20.
+
+ Array.Clear (keySchedule, 0, keySchedule.Length);
+
+ int keyBitSize = PC1.Length;
+
+ byte [] keyPC1 = new byte [keyBitSize]; // PC1-permuted key
+ byte [] keyRot = new byte [keyBitSize]; // PC1 & rotated
+
+ int indx = 0;
+
+ foreach (byte bitPos in PC1) {
+ keyPC1 [indx++] = (byte)((key [(int)bitPos >> 3] >> (7 ^ (bitPos & 7))) & 1);
+ }
+
+
+
+
+ int j;
+ for (int i = 0; i < KEY_BYTE_SIZE*2; i++) {
+ int b = keyBitSize >> 1;
+
+ for (j = 0; j < b; j++) {
+ int s = j + (int) leftRotTotal [i];
+ keyRot [j] = keyPC1 [s < b ? s : s - b];
+ }
+
+ for (j = b; j < keyBitSize; j++) {
+ int s = j + (int) leftRotTotal [i];
+ keyRot [j] = keyPC1 [s < keyBitSize ? s : s - b];
+ }
+
+ int keyOffs = i * KEY_BYTE_SIZE;
+
+ j = 0;
+ foreach (byte bitPos in PC2) {
+ if (keyRot [(int)bitPos] != 0) {
+ keySchedule [keyOffs + (j/6)] |= (byte) (0x80 >> ((j % 6) + 2));
+ }
+ j++;
+ }
+ }
+
+ }
+
+
+
+ internal void Encrypt (byte [] block, byte [] output)
+ {
+ byte [] dest = (output == null ? block : output);
+
+ byte [] byteBuff = this.byteBuff;
+ uint [] dwordBuff = this.dwordBuff;
+
+ Permutation (block, byteBuff, ipTab, false);
+
+ Buffer.BlockCopy (byteBuff, 0, dwordBuff, 0, BLOCK_BYTE_SIZE);
+
+ uint d0 = dwordBuff[0];
+ uint d1 = dwordBuff[1];
+
+ // 16 rounds
+ d0 ^= CipherFunct (d1, 0);
+ d1 ^= CipherFunct (d0, 1);
+ d0 ^= CipherFunct (d1, 2);
+ d1 ^= CipherFunct (d0, 3);
+ d0 ^= CipherFunct (d1, 4);
+ d1 ^= CipherFunct (d0, 5);
+ d0 ^= CipherFunct (d1, 6);
+ d1 ^= CipherFunct (d0, 7);
+ d0 ^= CipherFunct (d1, 8);
+ d1 ^= CipherFunct (d0, 9);
+ d0 ^= CipherFunct (d1, 10);
+ d1 ^= CipherFunct (d0, 11);
+ d0 ^= CipherFunct (d1, 12);
+ d1 ^= CipherFunct (d0, 13);
+ d0 ^= CipherFunct (d1, 14);
+ d1 ^= CipherFunct (d0, 15);
+
+
+ dwordBuff [0] = d1;
+ dwordBuff [1] = d0;
+ Buffer.BlockCopy (dwordBuff, 0, byteBuff, 0, BLOCK_BYTE_SIZE);
+
+ Permutation (byteBuff, dest, fpTab, true);
+ }
+
+
+ internal void Decrypt (byte [] block, byte [] output)
+ {
+ byte [] dest = (output == null ? block : output);
+
+ byte [] byteBuff = this.byteBuff;
+ uint [] dwordBuff = this.dwordBuff;
+
+ Permutation (block, byteBuff, ipTab, false);
+
+ Buffer.BlockCopy (byteBuff, 0, dwordBuff, 0, BLOCK_BYTE_SIZE);
+
+ uint d1 = dwordBuff [0];
+ uint d0 = dwordBuff [1];
+
+ // 16 rounds in reverse order
+ d1 ^= CipherFunct (d0, 15);
+ d0 ^= CipherFunct (d1, 14);
+ d1 ^= CipherFunct (d0, 13);
+ d0 ^= CipherFunct (d1, 12);
+ d1 ^= CipherFunct (d0, 11);
+ d0 ^= CipherFunct (d1, 10);
+ d1 ^= CipherFunct (d0, 9);
+ d0 ^= CipherFunct (d1, 8);
+ d1 ^= CipherFunct (d0, 7);
+ d0 ^= CipherFunct (d1, 6);
+ d1 ^= CipherFunct (d0, 5);
+ d0 ^= CipherFunct (d1, 4);
+ d1 ^= CipherFunct (d0, 3);
+ d0 ^= CipherFunct (d1, 2);
+ d1 ^= CipherFunct (d0, 1);
+ d0 ^= CipherFunct (d1, 0);
+
+ dwordBuff [0] = d0;
+ dwordBuff [1] = d1;
+
+
+ Buffer.BlockCopy (dwordBuff, 0, byteBuff, 0, BLOCK_BYTE_SIZE);
+
+ Permutation (byteBuff, dest, fpTab, true);
+ }
+
+
+ } // DESCore
+
+
+
+
+ public abstract class DES : SymmetricAlgorithm {
+ private byte [] key;
+
+ public DES ()
+ {
+ }
+
+ [MonoTODO]
+ public static new DES Create()
+ {
+ // TODO: implement
+ return null;
+ }
+
+ [MonoTODO]
+ public static new DES Create(string name)
+ {
+ // TODO: implement
+ return null;
+ }
+
+
+ public static bool IsWeakKey (byte [] rgbKey)
+ {
+ if (!DESCore.IsValidKeySize (rgbKey)) {
+ throw new CryptographicException ();
+ }
+
+ ulong lk = DESCore.PackKey (rgbKey);
+ foreach (ulong wk in DESCore.weakKeys) {
+ if (lk == wk) return true;
+ }
+ return false;
+ }
+
+
+ public static bool IsSemiWeakKey (byte [] rgbKey)
+ {
+ if (!DESCore.IsValidKeySize (rgbKey)) {
+ throw new CryptographicException ();
+ }
+
+ ulong lk = DESCore.PackKey (rgbKey);
+ foreach (ulong swk in DESCore.semiweakKeys) {
+ if (lk == swk) return true;
+ }
+ return false;
+ }
+
+ public override byte[] Key {
+ get {
+ return this.key;
+ }
+ set {
+ this.key = new byte [DESCore.KEY_BYTE_SIZE];
+ Array.Copy (value, 0, this.key, 0, DESCore.KEY_BYTE_SIZE);
+ }
+ }
+
+ } // DES
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DESCryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/DESCryptoServiceProvider.cs
new file mode 100644
index 00000000000..e04c3d36227
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DESCryptoServiceProvider.cs
@@ -0,0 +1,250 @@
+//
+// System.Security.Cryptography.DESCryptoServiceProvider
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+
+
+using System;
+using System.Security.Cryptography;
+
+
+namespace System.Security.Cryptography {
+
+
+ internal class DESTransformBase : ICryptoTransform {
+
+ internal enum Mode : int {
+ ENCRYPTOR = 0,
+ DECRYPTOR = 1
+ }
+
+ protected delegate void Filter (byte [] workBuff);
+
+ private DESCore core;
+
+ private DESCore.DESCall cryptFn;
+ private Filter preprocess;
+ private Filter postprocess;
+
+ private byte [] iv;
+ private byte [] tmpBlock;
+
+ protected DESTransformBase (Mode mode, byte [] key, byte [] iv)
+ {
+ core = new DESCore ();
+
+ if (mode == Mode.ENCRYPTOR) {
+ cryptFn = new DESCore.DESCall (core.Encrypt);
+ preprocess = new Filter (this.EncPreprocess);
+ postprocess = new Filter (this.EncPostprocess);
+ } else {
+ cryptFn = new DESCore.DESCall (core.Decrypt);
+ preprocess = new Filter (this.DecPreprocess);
+ postprocess = new Filter (this.DecPostprocess);
+ }
+
+ core.SetKey (key);
+ this.iv = new byte [DESCore.BLOCK_BYTE_SIZE];
+ Array.Copy (iv, 0, this.iv, 0, DESCore.BLOCK_BYTE_SIZE);
+
+ tmpBlock = new byte [DESCore.BLOCK_BYTE_SIZE];
+ }
+
+
+ public virtual bool CanTransformMultipleBlocks {
+ get {
+ return true;
+ }
+ }
+
+
+ public virtual int InputBlockSize {
+ get {
+ return DESCore.BLOCK_BYTE_SIZE;
+ }
+ }
+
+ public virtual int OutputBlockSize {
+ get {
+ return DESCore.BLOCK_BYTE_SIZE;
+ }
+ }
+
+ private void EncPreprocess (byte [] workBuff)
+ {
+ byte [] iv = this.iv;
+ for (int i = 0; i < DESCore.BLOCK_BYTE_SIZE; i++) {
+ workBuff [i] ^= iv [i];
+ }
+ }
+
+ private void EncPostprocess (byte [] workBuff)
+ {
+ Array.Copy (workBuff, 0, iv, 0, DESCore.BLOCK_BYTE_SIZE);
+ }
+
+
+ private void DecPreprocess (byte [] workBuff)
+ {
+ Array.Copy (workBuff, 0, tmpBlock, 0, DESCore.BLOCK_BYTE_SIZE);
+ }
+
+ private void DecPostprocess (byte [] workBuff)
+ {
+ EncPreprocess (workBuff);
+ Array.Copy (tmpBlock, 0, iv, 0, DESCore.BLOCK_BYTE_SIZE);
+ }
+
+
+
+ private void Transform (byte [] workBuff)
+ {
+ preprocess (workBuff);
+ cryptFn (workBuff, null);
+ postprocess (workBuff);
+ }
+
+
+ public virtual int TransformBlock (byte [] inputBuffer, int inputOffset, int inputCount, byte [] outputBuffer, int outputOffset)
+ {
+ if ((inputCount & (DESCore.BLOCK_BYTE_SIZE-1)) != 0)
+ throw new CryptographicException ("Invalid input block size.");
+
+ if (outputOffset + inputCount > outputBuffer.Length)
+ throw new CryptographicException ("Insufficient output buffer size.");
+
+ int step = InputBlockSize;
+ int offs = inputOffset;
+ int full = inputCount / step;
+
+ byte [] workBuff = new byte [step];
+
+ for (int i = 0; i < full; i++) {
+ Array.Copy (inputBuffer, offs, workBuff, 0, step);
+ Transform (workBuff);
+ Array.Copy (workBuff, 0, outputBuffer, outputOffset, step);
+ offs += step;
+ outputOffset += step;
+ }
+
+ return (full * step);
+ }
+
+
+ [MonoTODO]
+ public virtual byte [] TransformFinalBlock (byte [] inputBuffer, int inputOffset, int inputCount)
+ {
+ // TODO: add decryption support
+
+ int num = (inputCount + DESCore.BLOCK_BYTE_SIZE) & (~(DESCore.BLOCK_BYTE_SIZE-1));
+ byte [] res = new byte [num];
+ int full = num - DESCore.BLOCK_BYTE_SIZE;
+
+ TransformBlock (inputBuffer, inputOffset, full, res, 0);
+
+ int rem = inputCount & (DESCore.BLOCK_BYTE_SIZE-1);
+
+ // PKCS-5 padding
+ for (int i = num; --i >= (num - rem);) {
+ res [i] = (byte) rem;
+ }
+
+ Array.Copy (inputBuffer, inputOffset + full, res, full, rem);
+
+ // the last padded block will be transformed in-place
+ TransformBlock (res, full, DESCore.BLOCK_BYTE_SIZE, res, full);
+
+ /*
+ byte [] workBuff = new byte [DESCore.BLOCK_BYTE_SIZE];
+ Array.Copy (res, full, workBuff, 0, DESCore.BLOCK_BYTE_SIZE);
+ preprocess (workBuff);
+ cryptFn (workBuff, null);
+ Array.Copy (workBuff, 0, res, full, DESCore.BLOCK_BYTE_SIZE);
+ */
+
+ return res;
+ }
+
+
+ } // DESTransformBase
+
+
+ internal sealed class DESEncryptor : DESTransformBase {
+ internal DESEncryptor (byte [] key, byte [] iv)
+ : base (DESTransformBase.Mode.ENCRYPTOR, key, iv)
+ {
+ }
+ } // DESEncryptor
+
+
+ internal sealed class DESDecryptor : DESTransformBase {
+ internal DESDecryptor (byte [] key, byte [] iv)
+ : base (DESTransformBase.Mode.DECRYPTOR, key, iv)
+ {
+ }
+ } // DESDecryptor
+
+
+ public sealed class DESCryptoServiceProvider {
+ private byte [] iv;
+ private byte [] key;
+
+ public DESCryptoServiceProvider ()
+ {
+ }
+
+
+ //
+ // Factories
+ //
+
+ public ICryptoTransform CreateEncryptor()
+ {
+ return new DESEncryptor (key, iv);
+ }
+
+ public ICryptoTransform CreateDecryptor()
+ {
+ return new DESDecryptor (key, iv);
+ }
+
+
+
+ // FIXME: Ought to be in DES.cs
+
+ [MonoTODO ("Ought to be in DES.cs")]
+ public /*override*/ byte[] Key {
+ get {
+ return this.key;
+ }
+ set {
+ this.key = new byte [DESCore.KEY_BYTE_SIZE];
+ Array.Copy (value, 0, this.key, 0, DESCore.KEY_BYTE_SIZE);
+ }
+ }
+
+ public byte[] IV {
+ get {
+ return this.iv;
+ }
+ set {
+ this.iv = new byte [DESCore.KEY_BYTE_SIZE];
+ Array.Copy (value, 0, this.iv, 0, DESCore.KEY_BYTE_SIZE);
+ }
+ }
+
+
+
+
+
+ public override string ToString ()
+ {
+ return "mono::System.Security.Cryptography.DESCryptoServiceProvider";
+ }
+
+ } // DESCryptoServiceProvider
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DSA.cs b/mcs/class/corlib/System.Security.Cryptography/DSA.cs
new file mode 100755
index 00000000000..26f366888a0
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DSA.cs
@@ -0,0 +1,101 @@
+//
+// System.Security.Cryptography DSA.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using System.Text;
+
+namespace System.Security.Cryptography
+{
+
+ /// <summary>
+ /// Abstract base class for all implementations of the DSA algorithm
+ /// </summary>
+ public abstract class DSA : AsymmetricAlgorithm
+ {
+ internal DSA () {}
+
+ public static new DSA Create()
+ {
+ return new DSACryptoServiceProvider();
+ }
+
+ [MonoTODO]
+ public static new DSA Create(string algName)
+ {
+ // TODO: implement
+ return null;
+ }
+
+ public abstract byte[] CreateSignature(byte[] rgbHash);
+
+ public abstract DSAParameters ExportParameters(bool includePrivateParameters);
+
+ [MonoTODO]
+ public override void FromXmlString(string xmlString)
+ {
+ if (xmlString == null)
+ throw new ArgumentNullException();
+
+ // TODO: implement
+ }
+
+ public abstract void ImportParameters(DSAParameters parameters);
+
+ public override string ToXmlString(bool includePrivateParameters)
+ {
+ DSAParameters dsaParams = ExportParameters(includePrivateParameters);
+
+ StringBuilder sb = new StringBuilder();
+
+ sb.Append("<DSAKeyValue>");
+
+ sb.Append("<P>");
+ sb.Append(Convert.ToBase64String(dsaParams.P));
+ sb.Append("</P>");
+
+ sb.Append("<Q>");
+ sb.Append(Convert.ToBase64String(dsaParams.Q));
+ sb.Append("</Q>");
+
+ sb.Append("<G>");
+ sb.Append(Convert.ToBase64String(dsaParams.G));
+ sb.Append("</G>");
+
+ sb.Append("<Y>");
+ sb.Append(Convert.ToBase64String(dsaParams.Y));
+ sb.Append("</Y>");
+
+ sb.Append("<J>");
+ sb.Append(Convert.ToBase64String(dsaParams.J));
+ sb.Append("</J>");
+
+ sb.Append("<Seed>");
+ sb.Append(Convert.ToBase64String(dsaParams.Seed));
+ sb.Append("</Seed>");
+
+ sb.Append("<PgenCounter>");
+ string cnt = Convert.ToString(dsaParams.Counter);
+ byte[] inArr = new ASCIIEncoding().GetBytes(cnt);
+ sb.Append(Convert.ToBase64String(inArr));
+ sb.Append("</PgenCounter>");
+
+ if (dsaParams.X != null) {
+ sb.Append("<X>");
+ sb.Append(Convert.ToBase64String(dsaParams.X));
+ sb.Append("</X>");
+ }
+
+ sb.Append("</DSAKeyValue>");
+
+ return sb.ToString();
+ }
+
+ public abstract bool VerifySignature(byte[] rgbHash, byte[] rgbSignature);
+
+ } // DSA
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs
new file mode 100644
index 00000000000..c7c7158fb67
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs
@@ -0,0 +1,87 @@
+//
+// System.Security.Cryptography.DSACryptoServiceProvider.cs
+//
+// Authors:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System;
+using System.IO;
+
+namespace System.Security.Cryptography {
+
+ [MonoTODO]
+ public class DSACryptoServiceProvider : DSA {
+ public DSACryptoServiceProvider () { }
+ public DSACryptoServiceProvider (CspParameters parameters) { }
+ public DSACryptoServiceProvider (int key_size) { }
+ public DSACryptoServiceProvider (int key_size, CspParameters parameters) { }
+
+ public override string KeyExchangeAlgorithm {
+ get { return null; }
+ }
+
+ public override int KeySize {
+ get { return 0; }
+ }
+
+ public override KeySizes[] LegalKeySizes {
+ get { return null; }
+ }
+
+ public override string SignatureAlgorithm {
+ get { return null; }
+ }
+
+ public bool PersistKeyInCsp {
+ get { return false; }
+ set { }
+ }
+
+ public override byte[] CreateSignature (byte[] rgb) {
+ return null;
+ }
+
+ public override bool VerifySignature(byte[] hash, byte[] sig) {
+ return false;
+ }
+
+ public byte[] SignData (byte[] data) {
+ return SignData (data, 0, data.Length);
+ }
+
+ public byte[] SignData (byte[] data, int offset, int count) {
+ return null;
+ }
+
+ public byte[] SignData (Stream data) {
+ return null;
+ }
+
+ public byte[] SignHash (byte[] hash, string str) {
+ return null;
+ }
+
+ public bool VerifyData (byte[] data, byte[] sig) {
+ return false;
+ }
+
+ public override DSAParameters ExportParameters (bool include) {
+ return new DSAParameters ();
+ }
+
+ public override void ImportParameters (DSAParameters parameters) {
+ }
+
+ public override void FromXmlString(string xmlString) {
+ }
+
+ public override string ToXmlString(bool includePrivateParameters) {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/DSAParameters.cs b/mcs/class/corlib/System.Security.Cryptography/DSAParameters.cs
new file mode 100755
index 00000000000..cc8560ddcf2
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DSAParameters.cs
@@ -0,0 +1,38 @@
+//
+// System.Security.Cryptography DSAParameters.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography
+{
+
+ /// <summary>
+ /// DSA Parameters
+ /// </summary>
+ [Serializable]
+ public struct DSAParameters
+ {
+ public int Counter;
+
+ public byte[] G;
+
+ public byte[] J;
+
+ public byte[] P;
+
+ public byte[] Q;
+
+ public byte[] Seed;
+
+ [NonSerialized]
+ public byte[] X;
+
+ public byte[] Y;
+
+ } // DSAParameters
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DSASignatureDeformatter.cs b/mcs/class/corlib/System.Security.Cryptography/DSASignatureDeformatter.cs
new file mode 100755
index 00000000000..999381a9afe
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DSASignatureDeformatter.cs
@@ -0,0 +1,51 @@
+//
+// System.Security.Cryptography DSASignatureDeformatter.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography
+{
+
+ /// <summary>
+ /// DSA Signature Deformatter
+ /// </summary>
+ public class DSASignatureDeformatter : AsymmetricSignatureDeformatter
+ {
+ [MonoTODO]
+ public DSASignatureDeformatter()
+ {
+ // TODO: implement
+ }
+
+ [MonoTODO]
+ public DSASignatureDeformatter(AsymmetricAlgorithm key)
+ {
+ // TODO: implement
+ }
+
+
+ public override void SetHashAlgorithm(string strName)
+ {
+ throw new CryptographicException("This method is not used");
+ }
+
+ [MonoTODO]
+ public override void SetKey(AsymmetricAlgorithm key)
+ {
+ // TODO: implement
+ }
+
+ [MonoTODO]
+ public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
+ {
+ // TODO: implement
+ return false;
+ }
+
+ } // DSASignatureDeformatter
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DSASignatureFormatter.cs b/mcs/class/corlib/System.Security.Cryptography/DSASignatureFormatter.cs
new file mode 100755
index 00000000000..2d1a241a8f7
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DSASignatureFormatter.cs
@@ -0,0 +1,52 @@
+//
+// System.Security.Cryptography DSASignatureFormatter.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography
+{
+
+ /// <summary>
+ /// DSA Signature Formatter
+ /// </summary>
+ public class DSASignatureFormatter : AsymmetricSignatureFormatter
+ {
+
+ [MonoTODO]
+ public DSASignatureFormatter()
+ {
+ // TODO: implement
+ }
+
+ [MonoTODO]
+ public DSASignatureFormatter(AsymmetricAlgorithm key)
+ {
+ // TODO: implement
+ }
+
+ [MonoTODO]
+ public override byte[] CreateSignature(byte[] rgbHash)
+ {
+ // TODO: implement
+ return null;
+ }
+
+ [MonoTODO]
+ public override void SetHashAlgorithm(string strName)
+ {
+ // TODO: implement
+ }
+
+ [MonoTODO]
+ public override void SetKey(AsymmetricAlgorithm key)
+ {
+ // TODO: implement
+ }
+
+ } // DSASignatureFormatter
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/DeriveBytes.cs b/mcs/class/corlib/System.Security.Cryptography/DeriveBytes.cs
new file mode 100755
index 00000000000..048c4182cd7
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/DeriveBytes.cs
@@ -0,0 +1,27 @@
+//
+// System.Security.Cryptography DeriveBytes.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography
+{
+
+ /// <summary>
+ /// Abstract base class for all classes that derive byte information from an integer
+ /// </summary>
+ public abstract class DeriveBytes
+ {
+
+ protected DeriveBytes() {}
+
+ public abstract byte[] GetBytes(int cb);
+
+ public abstract void Reset();
+
+ } // DeriveBytes
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs b/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs
new file mode 100644
index 00000000000..d67fce6e678
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/FromBase64Transform.cs
@@ -0,0 +1,264 @@
+//
+// System.Security.Cryptography.FromBase64Transform
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+
+namespace System.Security.Cryptography {
+
+ public enum FromBase64TransformMode : int {
+ IgnoreWhiteSpaces,
+ DoNotIgnoreWhiteSpaces
+ }
+
+ public class FromBase64Transform : ICryptoTransform {
+
+ private FromBase64TransformMode mode;
+ private byte [] accumulator;
+ private byte [] filterBuffer;
+ private int accPtr;
+
+
+ /// <summary>
+ /// Creates a new instance of the decoder
+ /// with the default transformation mode (IgnoreWhiteSpaces).
+ /// </summary>
+ public FromBase64Transform ()
+ : this (FromBase64TransformMode.IgnoreWhiteSpaces)
+ {
+ }
+
+
+ /// <summary>
+ /// Creates a new instance of the decoder
+ /// with the specified transformation mode.
+ /// </summary>
+ public FromBase64Transform (FromBase64TransformMode mode)
+ {
+ this.mode = mode;
+ accumulator = new byte [4];
+ filterBuffer = new byte [4];
+ accPtr = 0;
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public bool CanTransformMultipleBlocks {
+ get {
+ return false;
+ }
+ }
+
+
+ /// <summary>
+ /// Returns the input block size for the Base64 decoder.
+ /// </summary>
+ /// <remarks>
+ /// The input block size for Base64 decoder is always 1 byte.
+ /// </remarks>
+ public int InputBlockSize {
+ get {
+ return 1;
+ }
+ }
+
+
+ /// <summary>
+ /// Returns the output block size for the Base64 decoder.
+ /// </summary>
+ /// <remarks>
+ /// The value returned by this property is always 3.
+ /// </remarks>
+ public int OutputBlockSize {
+ get {
+ return 3;
+ }
+ }
+
+
+
+ private int Filter (byte [] buffer, int offset, int count)
+ {
+ int end = offset + count;
+ int len = filterBuffer.Length;
+ int ptr = 0;
+ byte [] filter = this.filterBuffer;
+
+ for (int i = offset; i < end; i++) {
+ byte b = buffer [i];
+ if (!Char.IsWhiteSpace ((char) b)) {
+ if (ptr >= len) {
+ len <<= 1;
+ this.filterBuffer = new byte [len];
+ Array.Copy(filter, 0, this.filterBuffer, 0, len >> 1);
+ filter = this.filterBuffer;
+ }
+ filter [ptr++] = b;
+ }
+ }
+
+ return ptr;
+ }
+
+
+
+
+ private int DoTransform (byte [] inputBuffer,
+ int inputOffset,
+ int inputCount,
+ byte [] outputBuffer,
+ int outputOffset)
+ {
+ int full = inputCount >> 2;
+ if (full == 0) return 0;
+
+ int rem = 0;
+
+ if (inputBuffer[inputCount - 1] == (byte)'=') {
+ ++rem;
+ --full;
+ }
+
+ if (inputBuffer[inputCount - 2] == (byte)'=') ++rem;
+
+ byte [] lookup = 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++]];
+
+ outputBuffer [outputOffset++] = (byte) ((b0 << 2) | (b1 >> 4));
+ outputBuffer [outputOffset++] = (byte) ((b1 << 4) | (b2 >> 2));
+ outputBuffer [outputOffset++] = (byte) ((b2 << 6) | b3);
+ }
+
+ int res = full * 3;
+
+ switch (rem) {
+ case 0:
+ break;
+ case 1:
+ 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++]];
+ outputBuffer [outputOffset++] = (byte) ((b0 << 2) | (b1 >> 4));
+ ++res;
+ break;
+ default:
+ break;
+ }
+
+ return res;
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public int TransformBlock (byte [] inputBuffer,
+ int inputOffset,
+ int inputCount,
+ byte [] outputBuffer,
+ int outputOffset)
+ {
+ int n;
+ byte [] src;
+ int srcOff;
+ int res = 0;
+
+ if (mode == FromBase64TransformMode.IgnoreWhiteSpaces) {
+ n = Filter (inputBuffer, inputOffset, inputCount);
+ src = filterBuffer;
+ srcOff = 0;
+ } else {
+ n = inputCount;
+ src = inputBuffer;
+ srcOff = inputOffset;
+ }
+
+
+ int count = accPtr + n;
+
+ if (count < 4) {
+ Array.Copy (src, srcOff, accumulator, accPtr, n);
+ accPtr = count;
+ } else {
+ byte [] tmpBuff = new byte [count];
+ Array.Copy (accumulator, 0, tmpBuff, 0, accPtr);
+ 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);
+ }
+
+
+ return res;
+ }
+
+
+
+
+
+ /// <summary>
+ /// </summary>
+ public byte [] TransformFinalBlock (byte [] inputBuffer,
+ int inputOffset,
+ int inputCount)
+ {
+ byte [] src;
+ int srcOff;
+ int n;
+
+ if (mode == FromBase64TransformMode.IgnoreWhiteSpaces) {
+ n = Filter (inputBuffer, inputOffset, inputCount);
+ src = filterBuffer;
+ srcOff = 0;
+ } else {
+ n = inputCount;
+ src = inputBuffer;
+ srcOff = inputOffset;
+ }
+
+
+ int dataLen = accPtr + n;
+ byte [] tmpBuf = new byte [dataLen];
+
+ int resLen = ((dataLen) >> 2) * 3;
+ byte [] res = new byte [resLen];
+
+ Array.Copy (accumulator, 0, tmpBuf, 0, accPtr);
+ Array.Copy (src, srcOff, tmpBuf, accPtr, n);
+
+ DoTransform (tmpBuf, 0, dataLen, res, 0);
+
+ accPtr = 0;
+ return res;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString ()
+ {
+ return "mono::System.Security.Cryptography.FromBase64Transform";
+ }
+
+ } // FromBase64Transform
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/HashAlgorithm.cs b/mcs/class/corlib/System.Security.Cryptography/HashAlgorithm.cs
new file mode 100644
index 00000000000..c2564eb236e
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/HashAlgorithm.cs
@@ -0,0 +1,157 @@
+//
+// System.Security.Cryptography HashAlgorithm Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+ public abstract class HashAlgorithm : ICryptoTransform {
+ protected byte[] HashValue; // Caches the hash after it is calculated. Accessed through the Hash property.
+ protected int HashSizeValue; // The size of the hash in bits.
+ protected int State; // nonzero when in use; zero when not in use
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ protected HashAlgorithm () {
+
+ }
+
+
+ /// <summary>
+ /// FIXME: Always true for hashes?
+ /// Get whether or not the hash can transform multiple blocks at a time.
+ /// </summary>
+ [MonoTODO]
+ public virtual bool CanTransformMultipleBlocks {
+ get {
+ return true;
+ }
+ }
+
+ /// <summary>
+ /// Computes the entire hash of all the bytes in the byte array.
+ /// </summary>
+ public byte[] ComputeHash (byte[] input) {
+ // inputData = input.Clone();
+ HashCore (input, 0, input.Length);
+ HashValue = HashFinal ();
+ Initialize ();
+
+ return HashValue;
+ }
+
+ /// <summary>
+ /// Creates the default implementation of the default hash algorithm (SHA1).
+ /// </summary>
+ public static HashAlgorithm Create () {
+ return SHA1.Create ();
+ }
+
+ /// <summary>
+ /// Creates a specific implementation of the general hash idea.
+ /// </summary>
+ /// <param name="st">FIXME: No clue. Specifies which derived class to create.</param>
+ [MonoTODO]
+ public static HashAlgorithm Create (string st) {
+ return Create ();
+ }
+
+ /// <summary>
+ /// Gets the previously computed hash.
+ /// </summary>
+ public virtual byte[] Hash {
+ get {
+ return HashValue;
+ }
+ }
+
+ /// <summary>
+ /// When overridden in a derived class, drives the hashing function.
+ /// </summary>
+ /// <param name="rgb"></param>
+ /// <param name="start"></param>
+ /// <param name="size"></param>
+ protected abstract void HashCore (byte[] rgb, int start, int size);
+
+ /// <summary>
+ /// When overridden in a derived class, this pads and hashes whatever data might be left in the buffers and then returns the hash created.
+ /// </summary>
+ protected abstract byte[] HashFinal ();
+
+ /// <summary>
+ /// Returns the size in bits of the hash.
+ /// </summary>
+ public virtual int HashSize {
+ get {
+ return HashSizeValue;
+ }
+ }
+
+ /// <summary>
+ /// When overridden in a derived class, initializes the object to prepare for hashing.
+ /// </summary>
+ public abstract void Initialize ();
+
+ /// <summary>
+ /// FIXME: Not quire valid for the hashes? Returns 1?
+ /// </summary>
+ [MonoTODO]
+ public virtual int InputBlockSize {
+ get {
+ return 1;
+ }
+ }
+
+ /// <summary>
+ /// FIXME: Not quire valid for the hashes? Returns 1?
+ /// </summary>
+ [MonoTODO]
+ public virtual int OutputBlockSize {
+ get {
+ return 1;
+ }
+ }
+
+ /// <summary>
+ /// Used for stream chaining. Computes hash as data passes through it.
+ /// </summary>
+ /// <param name="inputBuffer">The buffer from which to grab the data to be copied.</param>
+ /// <param name="inputOffset">The offset into the input buffer to start reading at.</param>
+ /// <param name="inputCount">The number of bytes to be copied.</param>
+ /// <param name="outputBuffer">The buffer to write the copied data to.</param>
+ /// <param name="outputOffset">At what point in the outputBuffer to write the data at.</param>
+ public int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset) {
+
+ Buffer.BlockCopy (inputBuffer, inputOffset, outputBuffer, outputOffset, inputCount);
+ HashCore (inputBuffer, inputOffset, inputCount);
+
+ return inputCount;
+ }
+
+ /// <summary>
+ /// Used for stream chaining. Computes hash as data passes through it. Finishes off the hash.
+ /// </summary>
+ /// <param name="inputBuffer">The buffer from which to grab the data to be copied.</param>
+ /// <param name="inputOffset">The offset into the input buffer to start reading at.</param>
+ /// <param name="inputCount">The number of bytes to be copied.</param>
+ public byte[] TransformFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount) {
+ byte[] outputBuffer = new byte[inputCount];
+
+ Buffer.BlockCopy (inputBuffer, inputOffset, outputBuffer, 0, inputCount);
+
+ HashCore (inputBuffer, inputOffset, inputCount);
+ HashValue = HashFinal ();
+ Initialize ();
+
+ return outputBuffer;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/ICryptoTransform.cs b/mcs/class/corlib/System.Security.Cryptography/ICryptoTransform.cs
new file mode 100644
index 00000000000..f3d1f0e0df8
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/ICryptoTransform.cs
@@ -0,0 +1,49 @@
+//
+// System.Security.Cryptography ICryptoTransform interface
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Crytographic functions that can process a stream of bytes implement this interface.
+ /// This works by stringing together one or more ICryptoTransform classes with a stream.
+ /// Data is passed from one to the next without the need of outside buffering/intervention.
+ /// </summary>
+ public interface ICryptoTransform {
+
+ /// <summary>
+ /// Whether the function can transform multiple blocks at a time.
+ /// </summary>
+ bool CanTransformMultipleBlocks {get;}
+
+ /// <summary>
+ /// Size of input blocks for the function.
+ /// </summary>
+ int InputBlockSize {get;}
+
+ /// <summary>
+ /// Size of the output blocks of the function.
+ /// </summary>
+ int OutputBlockSize {get;}
+
+ /// <summary>
+ /// FIXME: Process some data. A block at a time? Less than a block at a time?
+ /// </summary>
+ int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset);
+
+ /// <summary>
+ /// Processes the final part of the data. Also finalizes the function if needed.
+ /// </summary>
+ byte[] TransformFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount);
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/KeySizes.cs b/mcs/class/corlib/System.Security.Cryptography/KeySizes.cs
new file mode 100644
index 00000000000..5fef7ec0908
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/KeySizes.cs
@@ -0,0 +1,61 @@
+//
+// System.Security.Cryptography KeySizes Class implementation
+//
+// Author:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// This class represents valid ranges of key sizes for ciphers. It is also used to represent block sizes in the same fashion for block ciphers.
+ /// </summary>
+ public class KeySizes {
+ private int _maxSize;
+ private int _minSize;
+ private int _skipSize;
+
+ /// <summary>
+ /// Creates a new KeySizes object.
+ /// </summary>
+ /// <param name="minSize">The minimum size key allowed for this cipher.</param>
+ /// <param name="maxSize">The maximum size key allowed for this cipher.</param>
+ /// <param name="skipSize">The jump/skip between the valid key sizes.</param>
+ public KeySizes (int minSize, int maxSize, int skipSize) {
+ _maxSize = maxSize;
+ _minSize = minSize;
+ _skipSize = skipSize;
+ }
+
+ /// <summary>
+ /// Returns the maximum valid key size;
+ /// </summary>
+ public int MaxSize {
+ get {
+ return _maxSize;
+ }
+ }
+
+ /// <summary>
+ /// Returns the minimum valid key size;
+ /// </summary>
+ public int MinSize {
+ get {
+ return _minSize;
+ }
+ }
+
+ /// <summary>
+ /// Returns the skip between valid key sizes;
+ /// </summary>
+ public int SkipSize {
+ get {
+ return _skipSize;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/MD5.cs b/mcs/class/corlib/System.Security.Cryptography/MD5.cs
new file mode 100644
index 00000000000..039a3f4bb1d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/MD5.cs
@@ -0,0 +1,44 @@
+//
+// System.Security.Cryptography MD5 Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Common base class for all derived MD5 iplementations.
+ /// </summary>
+ public abstract class MD5 : HashAlgorithm {
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ protected MD5 () {
+
+ }
+
+ /// <summary>
+ /// Creates the default derived class.
+ /// </summary>
+ public static new MD5 Create () {
+ return new MD5CryptoServiceProvider();
+ }
+
+ /// <summary>
+ /// Creates a new derived implementation.
+ /// </summary>
+ /// <param name="st">FIXME: No clue. Specifies which derived class to create?</param>
+ [MonoTODO]
+ public static new MD5 Create (string st) {
+ return Create();
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/MD5CryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/MD5CryptoServiceProvider.cs
new file mode 100644
index 00000000000..6a9dca05e25
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/MD5CryptoServiceProvider.cs
@@ -0,0 +1,482 @@
+//
+// System.Security.Cryptography MD5CryptoServiceProvider Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// C# implementation of the MD5 cryptographic hash function.
+ /// </summary>
+ public class MD5CryptoServiceProvider : MD5 {
+ private const int BLOCK_SIZE_BYTES = 64;
+ private const int HASH_SIZE_BYTES = 16;
+ private const int HASH_SIZE_BITS = 128;
+ [CLSCompliant(false)] protected uint[] _H;
+ [CLSCompliant(false)] protected uint count;
+ private byte[] _ProcessingBuffer; // Used to start data when passed less than a block worth.
+ private int _ProcessingBufferCount; // Counts how much data we have stored that still needs processed.
+
+ /// <summary>
+ /// Creates a new MD5CryptoServiceProvider.
+ /// </summary>
+ public MD5CryptoServiceProvider () {
+ _H = new uint[4];
+ HashSizeValue = HASH_SIZE_BITS;
+ _ProcessingBuffer = new byte[BLOCK_SIZE_BYTES];
+
+ Initialize();
+ }
+
+ /// <summary>
+ /// Drives the hashing function.
+ /// </summary>
+ /// <param name="rgb">Byte array containing the data to hash.</param>
+ /// <param name="start">Where in the input buffer to start.</param>
+ /// <param name="size">Size in bytes of the data in the buffer to hash.</param>
+ protected override void HashCore (byte[] rgb, int start, int size) {
+ int i;
+ State = 1;
+
+ if (_ProcessingBufferCount != 0) {
+ if (size < (BLOCK_SIZE_BYTES - _ProcessingBufferCount)) {
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, size);
+ _ProcessingBufferCount += size;
+ return;
+ }
+ else {
+ i = (BLOCK_SIZE_BYTES - _ProcessingBufferCount);
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, i);
+ ProcessBlock (_ProcessingBuffer, 0);
+ _ProcessingBufferCount = 0;
+ start += i;
+ size -= i;
+ }
+ }
+
+ for (i=0; i<size-size%BLOCK_SIZE_BYTES; i += BLOCK_SIZE_BYTES) {
+ ProcessBlock (rgb, start+i);
+ }
+
+ if (size%BLOCK_SIZE_BYTES != 0) {
+ System.Buffer.BlockCopy (rgb, size-size%BLOCK_SIZE_BYTES+start, _ProcessingBuffer, 0, size%BLOCK_SIZE_BYTES);
+ _ProcessingBufferCount = size%BLOCK_SIZE_BYTES;
+ }
+ }
+
+ /// <summary>
+ /// This finalizes the hash. Takes the data from the chaining variables and returns it.
+ /// </summary>
+ protected override byte[] HashFinal () {
+ byte[] hash = new byte[16];
+ int i, j;
+
+ ProcessFinalBlock(_ProcessingBuffer, 0, _ProcessingBufferCount);
+
+ for (i=0; i<4; i++) {
+ for (j=0; j<4; j++) {
+ hash[i*4+j] = (byte)(_H[i] >> j*8);
+ }
+ }
+
+ return hash;
+ }
+
+ /// <summary>
+ /// Resets the class after use. Called automatically after hashing is done.
+ /// </summary>
+ public override void Initialize () {
+ count = 0;
+ _ProcessingBufferCount = 0;
+
+ _H[0] = 0x67452301;
+ _H[1] = 0xefcdab89;
+ _H[2] = 0x98badcfe;
+ _H[3] = 0x10325476;
+ }
+
+ /// <summary>
+ /// This is the meat of the hash function. It is what processes each block one at a time.
+ /// </summary>
+ /// <param name="inputBuffer">Byte array to process data from.</param>
+ /// <param name="inputOffset">Where in the byte array to start processing.</param>
+ private void ProcessBlock(byte[] inputBuffer, int inputOffset) {
+ uint[] buff = new uint[16];
+ uint a, b, c, d;
+ int i;
+
+ count += BLOCK_SIZE_BYTES;
+
+ for (i=0; i<16; i++) {
+ buff[i] = (uint)(inputBuffer[inputOffset+4*i])
+ | (((uint)(inputBuffer[inputOffset+4*i+1])) << 8)
+ | (((uint)(inputBuffer[inputOffset+4*i+2])) << 16)
+ | (((uint)(inputBuffer[inputOffset+4*i+3])) << 24);
+ }
+
+ a = _H[0];
+ b = _H[1];
+ c = _H[2];
+ d = _H[3];
+
+ // This function was unrolled because it seems to be doubling our performance with current compiler/VM.
+ // Possibly roll up if this changes.
+
+
+ // ---- Round 1 --------
+
+ a += (((c ^ d) & b) ^ d) + (uint) Constants.C0 + buff [0];
+ a = (a << 7) | (a >> 25);
+ a += b;
+
+ d += (((b ^ c) & a) ^ c) + (uint) Constants.C1 + buff [1];
+ d = (d << 12) | (d >> 20);
+ d += a;
+
+ c += (((a ^ b) & d) ^ b) + (uint) Constants.C2 + buff [2];
+ c = (c << 17) | (c >> 15);
+ c += d;
+
+ b += (((d ^ a) & c) ^ a) + (uint) Constants.C3 + buff [3];
+ b = (b << 22) | (b >> 10);
+ b += c;
+
+ a += (((c ^ d) & b) ^ d) + (uint) Constants.C4 + buff [4];
+ a = (a << 7) | (a >> 25);
+ a += b;
+
+ d += (((b ^ c) & a) ^ c) + (uint) Constants.C5 + buff [5];
+ d = (d << 12) | (d >> 20);
+ d += a;
+
+ c += (((a ^ b) & d) ^ b) + (uint) Constants.C6 + buff [6];
+ c = (c << 17) | (c >> 15);
+ c += d;
+
+ b += (((d ^ a) & c) ^ a) + (uint) Constants.C7 + buff [7];
+ b = (b << 22) | (b >> 10);
+ b += c;
+
+ a += (((c ^ d) & b) ^ d) + (uint) Constants.C8 + buff [8];
+ a = (a << 7) | (a >> 25);
+ a += b;
+
+ d += (((b ^ c) & a) ^ c) + (uint) Constants.C9 + buff [9];
+ d = (d << 12) | (d >> 20);
+ d += a;
+
+ c += (((a ^ b) & d) ^ b) + (uint) Constants.C10 + buff [10];
+ c = (c << 17) | (c >> 15);
+ c += d;
+
+ b += (((d ^ a) & c) ^ a) + (uint) Constants.C11 + buff [11];
+ b = (b << 22) | (b >> 10);
+ b += c;
+
+ a += (((c ^ d) & b) ^ d) + (uint) Constants.C12 + buff [12];
+ a = (a << 7) | (a >> 25);
+ a += b;
+
+ d += (((b ^ c) & a) ^ c) + (uint) Constants.C13 + buff [13];
+ d = (d << 12) | (d >> 20);
+ d += a;
+
+ c += (((a ^ b) & d) ^ b) + (uint) Constants.C14 + buff [14];
+ c = (c << 17) | (c >> 15);
+ c += d;
+
+ b += (((d ^ a) & c) ^ a) + (uint) Constants.C15 + buff [15];
+ b = (b << 22) | (b >> 10);
+ b += c;
+
+
+ // ---- Round 2 --------
+
+ a += (((b ^ c) & d) ^ c) + (uint) Constants.C16 + buff [1];
+ a = (a << 5) | (a >> 27);
+ a += b;
+
+ d += (((a ^ b) & c) ^ b) + (uint) Constants.C17 + buff [6];
+ d = (d << 9) | (d >> 23);
+ d += a;
+
+ c += (((d ^ a) & b) ^ a) + (uint) Constants.C18 + buff [11];
+ c = (c << 14) | (c >> 18);
+ c += d;
+
+ b += (((c ^ d) & a) ^ d) + (uint) Constants.C19 + buff [0];
+ b = (b << 20) | (b >> 12);
+ b += c;
+
+ a += (((b ^ c) & d) ^ c) + (uint) Constants.C20 + buff [5];
+ a = (a << 5) | (a >> 27);
+ a += b;
+
+ d += (((a ^ b) & c) ^ b) + (uint) Constants.C21 + buff [10];
+ d = (d << 9) | (d >> 23);
+ d += a;
+
+ c += (((d ^ a) & b) ^ a) + (uint) Constants.C22 + buff [15];
+ c = (c << 14) | (c >> 18);
+ c += d;
+
+ b += (((c ^ d) & a) ^ d) + (uint) Constants.C23 + buff [4];
+ b = (b << 20) | (b >> 12);
+ b += c;
+
+ a += (((b ^ c) & d) ^ c) + (uint) Constants.C24 + buff [9];
+ a = (a << 5) | (a >> 27);
+ a += b;
+
+ d += (((a ^ b) & c) ^ b) + (uint) Constants.C25 + buff [14];
+ d = (d << 9) | (d >> 23);
+ d += a;
+
+ c += (((d ^ a) & b) ^ a) + (uint) Constants.C26 + buff [3];
+ c = (c << 14) | (c >> 18);
+ c += d;
+
+ b += (((c ^ d) & a) ^ d) + (uint) Constants.C27 + buff [8];
+ b = (b << 20) | (b >> 12);
+ b += c;
+
+ a += (((b ^ c) & d) ^ c) + (uint) Constants.C28 + buff [13];
+ a = (a << 5) | (a >> 27);
+ a += b;
+
+ d += (((a ^ b) & c) ^ b) + (uint) Constants.C29 + buff [2];
+ d = (d << 9) | (d >> 23);
+ d += a;
+
+ c += (((d ^ a) & b) ^ a) + (uint) Constants.C30 + buff [7];
+ c = (c << 14) | (c >> 18);
+ c += d;
+
+ b += (((c ^ d) & a) ^ d) + (uint) Constants.C31 + buff [12];
+ b = (b << 20) | (b >> 12);
+ b += c;
+
+
+ // ---- Round 3 --------
+
+ a += (b ^ c ^ d) + (uint) Constants.C32 + buff [5];
+ a = (a << 4) | (a >> 28);
+ a += b;
+
+ d += (a ^ b ^ c) + (uint) Constants.C33 + buff [8];
+ d = (d << 11) | (d >> 21);
+ d += a;
+
+ c += (d ^ a ^ b) + (uint) Constants.C34 + buff [11];
+ c = (c << 16) | (c >> 16);
+ c += d;
+
+ b += (c ^ d ^ a) + (uint) Constants.C35 + buff [14];
+ b = (b << 23) | (b >> 9);
+ b += c;
+
+ a += (b ^ c ^ d) + (uint) Constants.C36 + buff [1];
+ a = (a << 4) | (a >> 28);
+ a += b;
+
+ d += (a ^ b ^ c) + (uint) Constants.C37 + buff [4];
+ d = (d << 11) | (d >> 21);
+ d += a;
+
+ c += (d ^ a ^ b) + (uint) Constants.C38 + buff [7];
+ c = (c << 16) | (c >> 16);
+ c += d;
+
+ b += (c ^ d ^ a) + (uint) Constants.C39 + buff [10];
+ b = (b << 23) | (b >> 9);
+ b += c;
+
+ a += (b ^ c ^ d) + (uint) Constants.C40 + buff [13];
+ a = (a << 4) | (a >> 28);
+ a += b;
+
+ d += (a ^ b ^ c) + (uint) Constants.C41 + buff [0];
+ d = (d << 11) | (d >> 21);
+ d += a;
+
+ c += (d ^ a ^ b) + (uint) Constants.C42 + buff [3];
+ c = (c << 16) | (c >> 16);
+ c += d;
+
+ b += (c ^ d ^ a) + (uint) Constants.C43 + buff [6];
+ b = (b << 23) | (b >> 9);
+ b += c;
+
+ a += (b ^ c ^ d) + (uint) Constants.C44 + buff [9];
+ a = (a << 4) | (a >> 28);
+ a += b;
+
+ d += (a ^ b ^ c) + (uint) Constants.C45 + buff [12];
+ d = (d << 11) | (d >> 21);
+ d += a;
+
+ c += (d ^ a ^ b) + (uint) Constants.C46 + buff [15];
+ c = (c << 16) | (c >> 16);
+ c += d;
+
+ b += (c ^ d ^ a) + (uint) Constants.C47 + buff [2];
+ b = (b << 23) | (b >> 9);
+ b += c;
+
+
+ // ---- Round 4 --------
+
+ a += (((~d) | b) ^ c) + (uint) Constants.C48 + buff [0];
+ a = (a << 6) | (a >> 26);
+ a += b;
+
+ d += (((~c) | a) ^ b) + (uint) Constants.C49 + buff [7];
+ d = (d << 10) | (d >> 22);
+ d += a;
+
+ c += (((~b) | d) ^ a) + (uint) Constants.C50 + buff [14];
+ c = (c << 15) | (c >> 17);
+ c += d;
+
+ b += (((~a) | c) ^ d) + (uint) Constants.C51 + buff [5];
+ b = (b << 21) | (b >> 11);
+ b += c;
+
+ a += (((~d) | b) ^ c) + (uint) Constants.C52 + buff [12];
+ a = (a << 6) | (a >> 26);
+ a += b;
+
+ d += (((~c) | a) ^ b) + (uint) Constants.C53 + buff [3];
+ d = (d << 10) | (d >> 22);
+ d += a;
+
+ c += (((~b) | d) ^ a) + (uint) Constants.C54 + buff [10];
+ c = (c << 15) | (c >> 17);
+ c += d;
+
+ b += (((~a) | c) ^ d) + (uint) Constants.C55 + buff [1];
+ b = (b << 21) | (b >> 11);
+ b += c;
+
+ a += (((~d) | b) ^ c) + (uint) Constants.C56 + buff [8];
+ a = (a << 6) | (a >> 26);
+ a += b;
+
+ d += (((~c) | a) ^ b) + (uint) Constants.C57 + buff [15];
+ d = (d << 10) | (d >> 22);
+ d += a;
+
+ c += (((~b) | d) ^ a) + (uint) Constants.C58 + buff [6];
+ c = (c << 15) | (c >> 17);
+ c += d;
+
+ b += (((~a) | c) ^ d) + (uint) Constants.C59 + buff [13];
+ b = (b << 21) | (b >> 11);
+ b += c;
+
+ a += (((~d) | b) ^ c) + (uint) Constants.C60 + buff [4];
+ a = (a << 6) | (a >> 26);
+ a += b;
+
+ d += (((~c) | a) ^ b) + (uint) Constants.C61 + buff [11];
+ d = (d << 10) | (d >> 22);
+ d += a;
+
+ c += (((~b) | d) ^ a) + (uint) Constants.C62 + buff [2];
+ c = (c << 15) | (c >> 17);
+ c += d;
+
+ b += (((~a) | c) ^ d) + (uint) Constants.C63 + buff [9];
+ b = (b << 21) | (b >> 11);
+ b += c;
+
+
+ _H[0] += a;
+ _H[1] += b;
+ _H[2] += c;
+ _H[3] += d;
+ }
+
+ /// <summary>
+ /// Pads and then processes the final block.
+ /// </summary>
+ /// <param name="inputBuffer">Buffer to grab data from.</param>
+ /// <param name="inputOffset">Position in buffer in bytes to get data from.</param>
+ /// <param name="inputCount">How much data in bytes in the buffer to use.</param>
+ private void ProcessFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount) {
+ byte[] fooBuffer;
+ int paddingSize;
+ int i;
+ uint size;
+
+ paddingSize = (int)(56 - (inputCount + count) % BLOCK_SIZE_BYTES);
+
+ if (paddingSize < 1)
+ paddingSize += BLOCK_SIZE_BYTES;
+
+
+ fooBuffer = new byte[inputCount+paddingSize+8];
+
+ for (i=0; i<inputCount; i++) {
+ fooBuffer[i] = inputBuffer[i+inputOffset];
+ }
+
+ fooBuffer[inputCount] = 0x80;
+ for (i=inputCount+1; i<inputCount+paddingSize; i++) {
+ fooBuffer[i] = 0x00;
+ }
+
+ size = (uint)(count+inputCount);
+ size *= 8;
+ fooBuffer[inputCount+paddingSize] = (byte)((size) >> 0);
+ fooBuffer[inputCount+paddingSize+1] = (byte)((size) >> 8);
+ fooBuffer[inputCount+paddingSize+2] = (byte)((size) >> 16);
+ fooBuffer[inputCount+paddingSize+3] = (byte)((size) >> 24);
+
+ fooBuffer[inputCount+paddingSize+4] = 0x00;
+ fooBuffer[inputCount+paddingSize+5] = 0x00;
+ fooBuffer[inputCount+paddingSize+6] = 0x00;
+ fooBuffer[inputCount+paddingSize+7] = 0x00;
+
+ ProcessBlock(fooBuffer, 0);
+
+ if (inputCount+paddingSize+8 == 128) {
+ ProcessBlock(fooBuffer, 64);
+ }
+ }
+
+ private enum Constants : uint {
+ C0 = 0xd76aa478, C1 = 0xe8c7b756, C2 = 0x242070db,
+ C3 = 0xc1bdceee, C4 = 0xf57c0faf, C5 = 0x4787c62a,
+ C6 = 0xa8304613, C7 = 0xfd469501, C8 = 0x698098d8,
+ C9 = 0x8b44f7af,C10 = 0xffff5bb1,C11 = 0x895cd7be,
+ C12 = 0x6b901122,C13 = 0xfd987193,C14 = 0xa679438e,
+ C15 = 0x49b40821,C16 = 0xf61e2562,C17 = 0xc040b340,
+ C18 = 0x265e5a51,C19 = 0xe9b6c7aa,C20 = 0xd62f105d,
+ C21 = 0x02441453,C22 = 0xd8a1e681,C23 = 0xe7d3fbc8,
+ C24 = 0x21e1cde6,C25 = 0xc33707d6,C26 = 0xf4d50d87,
+ C27 = 0x455a14ed,C28 = 0xa9e3e905,C29 = 0xfcefa3f8,
+ C30 = 0x676f02d9,C31 = 0x8d2a4c8a,C32 = 0xfffa3942,
+ C33 = 0x8771f681,C34 = 0x6d9d6122,C35 = 0xfde5380c,
+ C36 = 0xa4beea44,C37 = 0x4bdecfa9,C38 = 0xf6bb4b60,
+ C39 = 0xbebfbc70,C40 = 0x289b7ec6,C41 = 0xeaa127fa,
+ C42 = 0xd4ef3085,C43 = 0x04881d05,C44 = 0xd9d4d039,
+ C45 = 0xe6db99e5,C46 = 0x1fa27cf8,C47 = 0xc4ac5665,
+ C48 = 0xf4292244,C49 = 0x432aff97,C50 = 0xab9423a7,
+ C51 = 0xfc93a039,C52 = 0x655b59c3,C53 = 0x8f0ccc92,
+ C54 = 0xffeff47d,C55 = 0x85845dd1,C56 = 0x6fa87e4f,
+ C57 = 0xfe2ce6e0,C58 = 0xa3014314,C59 = 0x4e0811a1,
+ C60 = 0xf7537e82,C61 = 0xbd3af235,C62 = 0x2ad7d2bb,
+ C63 = 0xeb86d391
+ }
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/PaddingMode.cs b/mcs/class/corlib/System.Security.Cryptography/PaddingMode.cs
new file mode 100644
index 00000000000..891911e2218
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/PaddingMode.cs
@@ -0,0 +1,22 @@
+//
+// System.Security.Cryptography PaddingMode enumeration
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// How to pad the message processed by block ciphers when they don't come out to the being the size of the block.
+ /// </summary>
+ public enum PaddingMode {
+ None,
+ PKCS7, // Each byte contains the value of the number of padding bytes.
+ Zeros // Append zeros to the message.
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs
new file mode 100644
index 00000000000..bf71a10bb17
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RNGCryptoServiceProvider.cs
@@ -0,0 +1,52 @@
+//
+// System.Security.Cryptography.RNGCryptoServiceProvider
+//
+// Author: Mark Crichton (crichton@gimp.org)
+//
+// (C) 2002
+//
+
+// "In the beginning there was Chaos,
+// and within this Chaos was Power,
+// Great Power without form."
+// -- The Verrah Rubicon of Verena, Book One
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Security.Cryptography {
+
+ public class RNGCryptoServiceProvider : RandomNumberGenerator {
+
+ [MonoTODO]
+ public RNGCryptoServiceProvider () {
+ // This will get some meaning when I figure out what the other
+ // three constructors do.
+ }
+
+ [MonoTODO]
+ public RNGCryptoServiceProvider (byte[] rgb) {
+ // Ok, not called by app code... someone must call it, though.
+ }
+
+ [MonoTODO]
+ public RNGCryptoServiceProvider (CspParameters cspParams) {
+ // Why do I have this feeling this is the MS CryptAPI...
+ }
+
+ [MonoTODO]
+ public RNGCryptoServiceProvider (string str) {
+ // More !application code. Interesting...
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override void GetBytes (byte[] data);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override void GetNonZeroBytes (byte[] data);
+
+ ~RNGCryptoServiceProvider () {
+ // FIN?
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RSA.cs b/mcs/class/corlib/System.Security.Cryptography/RSA.cs
new file mode 100644
index 00000000000..a02dd19cc2b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RSA.cs
@@ -0,0 +1,36 @@
+//
+// System.Security.Cryptography.RSA.cs
+//
+// Authors:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ [MonoTODO]
+ public abstract class RSA : AsymmetricAlgorithm {
+ public static new RSA Create () { return null; }
+ public static new RSA Create (string alg) { return Create (); }
+
+ public RSA () { }
+
+ public abstract byte[] EncryptValue (byte[] rgb);
+ public abstract byte[] DecryptValue (byte[] rgb);
+
+ public abstract RSAParameters ExportParameters (bool include);
+ public abstract void ImportParameters (RSAParameters parameters);
+
+ public override void FromXmlString (string xml) {
+ }
+
+ public override string ToXmlString (bool include) {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RSAParameters.cs b/mcs/class/corlib/System.Security.Cryptography/RSAParameters.cs
new file mode 100644
index 00000000000..6bc4aafca59
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RSAParameters.cs
@@ -0,0 +1,36 @@
+//
+// System.Security.Cryptography.RSAParameters.cs
+//
+// Authors:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ [MonoTODO]
+ [Serializable]
+ public struct RSAParameters {
+ [NonSerialized]
+ public byte[] P;
+ [NonSerialized]
+ public byte[] Q;
+ [NonSerialized]
+ public byte[] D;
+ [NonSerialized]
+ public byte[] DP;
+ [NonSerialized]
+ public byte[] DQ;
+ [NonSerialized]
+ public byte[] InverseQ;
+ [NonSerialized]
+
+ public byte[] Modulus;
+ public byte[] Exponent;
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs b/mcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs
new file mode 100755
index 00000000000..f6bc1c51608
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RandomNumberGenerator.cs
@@ -0,0 +1,36 @@
+//
+// System.Security.Cryptography.RandomNumberGenerator
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using System.Globalization;
+
+namespace System.Security.Cryptography {
+
+public abstract class RandomNumberGenerator {
+
+ public RandomNumberGenerator () {
+ }
+
+ public static RandomNumberGenerator Create () {
+ // create the default random number generator
+ return Create ("System.Security.Cryptography.RandomNumberGenerator");
+ }
+
+ [MonoTODO]
+ public static RandomNumberGenerator Create (string rngName) {
+ return null;
+ // return (RandomNumberGenerator) (CryptoConfig.CreateFromName (rngName));
+ }
+
+ public abstract void GetBytes (byte[] data);
+
+ public abstract void GetNonZeroBytes (byte[] data);
+
+}
+
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/Rijndael.cs b/mcs/class/corlib/System.Security.Cryptography/Rijndael.cs
new file mode 100644
index 00000000000..e4412164e82
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/Rijndael.cs
@@ -0,0 +1,25 @@
+//
+// System.Security.Cryptography.Rijndael.cs
+//
+// Authors: Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ [MonoTODO]
+ public abstract class Rijndael : SymmetricAlgorithm {
+ public static new Rijndael Create () { return null; }
+ public static new Rijndael Create (string alg) { return Create (); }
+
+ public Rijndael () {
+ KeySizeValue = 256;
+ BlockSizeValue = 128;
+ FeedbackSizeValue = 128;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/RijndaelManaged.cs b/mcs/class/corlib/System.Security.Cryptography/RijndaelManaged.cs
new file mode 100644
index 00000000000..9b2428f13d9
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/RijndaelManaged.cs
@@ -0,0 +1,744 @@
+//
+// System.Security.Cryptography.RijndaelManaged.cs
+//
+// Authors: Mark Crichton (crichton@gimp.org)
+//
+// (C) 2002
+//
+//
+
+
+using System;
+using System.Security.Cryptography;
+
+
+/// <summary>
+/// TODO - Add class summary
+/// </summary>
+/// <remarks>
+/// created by - crichton
+/// created on - 2/23/2002 6:21:44 PM
+/// </remarks>
+namespace System.Security.Cryptography {
+ public sealed class RijndaelManaged : Rijndael {
+
+ /// <summary>
+ /// RijndaelManaged constructor.
+ /// </summary>
+ public RijndaelManaged() {
+ }
+
+ /// <summary>
+ /// Generates a random IV for block feedback modes
+ /// </summary>
+ /// <remarks>
+ /// Method is inherited from SymmetricAlgorithm
+ ///
+ /// </remarks>
+ [MonoTODO]
+ public override void GenerateIV() {
+ throw new System.NotImplementedException();
+ }
+
+ /// <summary>
+ /// Generates a random key for Rijndael. Uses the current KeySize.
+ /// </summary>
+ /// <remarks>
+ /// Inherited method from base class SymmetricAlgorithm
+ ///
+ /// </remarks>
+ [MonoTODO]
+ public override void GenerateKey() {
+ throw new System.NotImplementedException();
+ }
+
+ /// <summary>
+ /// Creates a symmetric Rijndael decryptor object
+ /// </summary>
+ /// <remarks>
+ /// Inherited method from base class SymmetricAlgorithm
+ ///
+ /// </remarks>
+ /// <param name='rgbKey'>Key for Rijndael</param>
+ /// <param name='rgbIV'>IV for chaining mode</param>
+ [MonoTODO]
+ public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV) {
+ throw new System.NotImplementedException();
+ }
+
+ /// <summary>
+ /// Creates a symmetric Rijndael encryptor object
+ /// </summary>
+ /// <remarks>
+ /// Inherited method from base class SymmetricAlgorithm
+ ///
+ /// </remarks>
+ /// <param name='rgbKey'>Key for Rijndael</param>
+ /// <param name='rgbIV'>IV for chaining mode</param>
+ [MonoTODO]
+ public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV) {
+ throw new System.NotImplementedException();
+ }
+
+
+ // Note, the following tables are autogenerated.
+ // DO NOT EDIT.
+ // These are the 5 T boxes needed for Rijndael
+
+
+
+ internal static uint [,] ft_tab = {{
+ 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d,
+ 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554,
+ 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d,
+ 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a,
+ 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87,
+ 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b,
+ 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea,
+ 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b,
+ 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a,
+ 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f,
+ 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108,
+ 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f,
+ 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e,
+ 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5,
+ 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d,
+ 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f,
+ 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e,
+ 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb,
+ 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce,
+ 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497,
+ 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c,
+ 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed,
+ 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b,
+ 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a,
+ 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16,
+ 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594,
+ 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81,
+ 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3,
+ 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a,
+ 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504,
+ 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163,
+ 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d,
+ 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f,
+ 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739,
+ 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47,
+ 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395,
+ 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f,
+ 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883,
+ 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c,
+ 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76,
+ 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e,
+ 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4,
+ 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6,
+ 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b,
+ 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7,
+ 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0,
+ 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25,
+ 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818,
+ 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72,
+ 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651,
+ 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21,
+ 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85,
+ 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa,
+ 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12,
+ 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0,
+ 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9,
+ 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133,
+ 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7,
+ 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920,
+ 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a,
+ 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17,
+ 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8,
+ 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11,
+ 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a,
+ },{
+ 0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b,
+ 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5,
+ 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b,
+ 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676,
+ 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d,
+ 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0,
+ 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf,
+ 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0,
+ 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626,
+ 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc,
+ 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1,
+ 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515,
+ 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3,
+ 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a,
+ 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2,
+ 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575,
+ 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a,
+ 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0,
+ 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3,
+ 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484,
+ 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded,
+ 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b,
+ 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939,
+ 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf,
+ 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb,
+ 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585,
+ 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f,
+ 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8,
+ 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f,
+ 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5,
+ 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121,
+ 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2,
+ 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec,
+ 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717,
+ 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d,
+ 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373,
+ 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc,
+ 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888,
+ 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414,
+ 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb,
+ 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a,
+ 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c,
+ 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262,
+ 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979,
+ 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d,
+ 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9,
+ 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea,
+ 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808,
+ 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e,
+ 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6,
+ 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f,
+ 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a,
+ 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666,
+ 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e,
+ 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9,
+ 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e,
+ 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111,
+ 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494,
+ 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9,
+ 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf,
+ 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d,
+ 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868,
+ 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f,
+ 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616,
+ },{
+ 0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b,
+ 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5,
+ 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b,
+ 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76,
+ 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d,
+ 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0,
+ 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af,
+ 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0,
+ 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26,
+ 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc,
+ 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1,
+ 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15,
+ 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3,
+ 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a,
+ 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2,
+ 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75,
+ 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a,
+ 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0,
+ 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3,
+ 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384,
+ 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed,
+ 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b,
+ 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239,
+ 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf,
+ 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb,
+ 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185,
+ 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f,
+ 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8,
+ 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f,
+ 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5,
+ 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221,
+ 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2,
+ 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec,
+ 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17,
+ 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d,
+ 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673,
+ 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc,
+ 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88,
+ 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814,
+ 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb,
+ 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a,
+ 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c,
+ 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462,
+ 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279,
+ 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d,
+ 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9,
+ 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea,
+ 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008,
+ 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e,
+ 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6,
+ 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f,
+ 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a,
+ 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66,
+ 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e,
+ 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9,
+ 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e,
+ 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211,
+ 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394,
+ 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9,
+ 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df,
+ 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d,
+ 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068,
+ 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f,
+ 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16,
+ },{
+ 0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6,
+ 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491,
+ 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56,
+ 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec,
+ 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa,
+ 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb,
+ 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45,
+ 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b,
+ 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c,
+ 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83,
+ 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9,
+ 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a,
+ 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d,
+ 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f,
+ 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf,
+ 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea,
+ 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34,
+ 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b,
+ 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d,
+ 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713,
+ 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1,
+ 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6,
+ 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72,
+ 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85,
+ 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed,
+ 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411,
+ 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe,
+ 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b,
+ 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05,
+ 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1,
+ 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342,
+ 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf,
+ 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3,
+ 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e,
+ 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a,
+ 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6,
+ 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3,
+ 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b,
+ 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28,
+ 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad,
+ 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14,
+ 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8,
+ 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4,
+ 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2,
+ 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da,
+ 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049,
+ 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf,
+ 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810,
+ 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c,
+ 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197,
+ 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e,
+ 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f,
+ 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc,
+ 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c,
+ 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069,
+ 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927,
+ 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322,
+ 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733,
+ 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9,
+ 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5,
+ 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a,
+ 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0,
+ 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e,
+ 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c,
+ },{
+ 0x63636363, 0x7c7c7c7c, 0x77777777, 0x7b7b7b7b,
+ 0xf2f2f2f2, 0x6b6b6b6b, 0x6f6f6f6f, 0xc5c5c5c5,
+ 0x30303030, 0x01010101, 0x67676767, 0x2b2b2b2b,
+ 0xfefefefe, 0xd7d7d7d7, 0xabababab, 0x76767676,
+ 0xcacacaca, 0x82828282, 0xc9c9c9c9, 0x7d7d7d7d,
+ 0xfafafafa, 0x59595959, 0x47474747, 0xf0f0f0f0,
+ 0xadadadad, 0xd4d4d4d4, 0xa2a2a2a2, 0xafafafaf,
+ 0x9c9c9c9c, 0xa4a4a4a4, 0x72727272, 0xc0c0c0c0,
+ 0xb7b7b7b7, 0xfdfdfdfd, 0x93939393, 0x26262626,
+ 0x36363636, 0x3f3f3f3f, 0xf7f7f7f7, 0xcccccccc,
+ 0x34343434, 0xa5a5a5a5, 0xe5e5e5e5, 0xf1f1f1f1,
+ 0x71717171, 0xd8d8d8d8, 0x31313131, 0x15151515,
+ 0x04040404, 0xc7c7c7c7, 0x23232323, 0xc3c3c3c3,
+ 0x18181818, 0x96969696, 0x05050505, 0x9a9a9a9a,
+ 0x07070707, 0x12121212, 0x80808080, 0xe2e2e2e2,
+ 0xebebebeb, 0x27272727, 0xb2b2b2b2, 0x75757575,
+ 0x09090909, 0x83838383, 0x2c2c2c2c, 0x1a1a1a1a,
+ 0x1b1b1b1b, 0x6e6e6e6e, 0x5a5a5a5a, 0xa0a0a0a0,
+ 0x52525252, 0x3b3b3b3b, 0xd6d6d6d6, 0xb3b3b3b3,
+ 0x29292929, 0xe3e3e3e3, 0x2f2f2f2f, 0x84848484,
+ 0x53535353, 0xd1d1d1d1, 0x00000000, 0xedededed,
+ 0x20202020, 0xfcfcfcfc, 0xb1b1b1b1, 0x5b5b5b5b,
+ 0x6a6a6a6a, 0xcbcbcbcb, 0xbebebebe, 0x39393939,
+ 0x4a4a4a4a, 0x4c4c4c4c, 0x58585858, 0xcfcfcfcf,
+ 0xd0d0d0d0, 0xefefefef, 0xaaaaaaaa, 0xfbfbfbfb,
+ 0x43434343, 0x4d4d4d4d, 0x33333333, 0x85858585,
+ 0x45454545, 0xf9f9f9f9, 0x02020202, 0x7f7f7f7f,
+ 0x50505050, 0x3c3c3c3c, 0x9f9f9f9f, 0xa8a8a8a8,
+ 0x51515151, 0xa3a3a3a3, 0x40404040, 0x8f8f8f8f,
+ 0x92929292, 0x9d9d9d9d, 0x38383838, 0xf5f5f5f5,
+ 0xbcbcbcbc, 0xb6b6b6b6, 0xdadadada, 0x21212121,
+ 0x10101010, 0xffffffff, 0xf3f3f3f3, 0xd2d2d2d2,
+ 0xcdcdcdcd, 0x0c0c0c0c, 0x13131313, 0xecececec,
+ 0x5f5f5f5f, 0x97979797, 0x44444444, 0x17171717,
+ 0xc4c4c4c4, 0xa7a7a7a7, 0x7e7e7e7e, 0x3d3d3d3d,
+ 0x64646464, 0x5d5d5d5d, 0x19191919, 0x73737373,
+ 0x60606060, 0x81818181, 0x4f4f4f4f, 0xdcdcdcdc,
+ 0x22222222, 0x2a2a2a2a, 0x90909090, 0x88888888,
+ 0x46464646, 0xeeeeeeee, 0xb8b8b8b8, 0x14141414,
+ 0xdededede, 0x5e5e5e5e, 0x0b0b0b0b, 0xdbdbdbdb,
+ 0xe0e0e0e0, 0x32323232, 0x3a3a3a3a, 0x0a0a0a0a,
+ 0x49494949, 0x06060606, 0x24242424, 0x5c5c5c5c,
+ 0xc2c2c2c2, 0xd3d3d3d3, 0xacacacac, 0x62626262,
+ 0x91919191, 0x95959595, 0xe4e4e4e4, 0x79797979,
+ 0xe7e7e7e7, 0xc8c8c8c8, 0x37373737, 0x6d6d6d6d,
+ 0x8d8d8d8d, 0xd5d5d5d5, 0x4e4e4e4e, 0xa9a9a9a9,
+ 0x6c6c6c6c, 0x56565656, 0xf4f4f4f4, 0xeaeaeaea,
+ 0x65656565, 0x7a7a7a7a, 0xaeaeaeae, 0x08080808,
+ 0xbabababa, 0x78787878, 0x25252525, 0x2e2e2e2e,
+ 0x1c1c1c1c, 0xa6a6a6a6, 0xb4b4b4b4, 0xc6c6c6c6,
+ 0xe8e8e8e8, 0xdddddddd, 0x74747474, 0x1f1f1f1f,
+ 0x4b4b4b4b, 0xbdbdbdbd, 0x8b8b8b8b, 0x8a8a8a8a,
+ 0x70707070, 0x3e3e3e3e, 0xb5b5b5b5, 0x66666666,
+ 0x48484848, 0x03030303, 0xf6f6f6f6, 0x0e0e0e0e,
+ 0x61616161, 0x35353535, 0x57575757, 0xb9b9b9b9,
+ 0x86868686, 0xc1c1c1c1, 0x1d1d1d1d, 0x9e9e9e9e,
+ 0xe1e1e1e1, 0xf8f8f8f8, 0x98989898, 0x11111111,
+ 0x69696969, 0xd9d9d9d9, 0x8e8e8e8e, 0x94949494,
+ 0x9b9b9b9b, 0x1e1e1e1e, 0x87878787, 0xe9e9e9e9,
+ 0xcececece, 0x55555555, 0x28282828, 0xdfdfdfdf,
+ 0x8c8c8c8c, 0xa1a1a1a1, 0x89898989, 0x0d0d0d0d,
+ 0xbfbfbfbf, 0xe6e6e6e6, 0x42424242, 0x68686868,
+ 0x41414141, 0x99999999, 0x2d2d2d2d, 0x0f0f0f0f,
+ 0xb0b0b0b0, 0x54545454, 0xbbbbbbbb, 0x16161616,
+ }};
+
+ internal static uint [,] it_tab = {{
+ 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96,
+ 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393,
+ 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25,
+ 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f,
+ 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1,
+ 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6,
+ 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da,
+ 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844,
+ 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd,
+ 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4,
+ 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45,
+ 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94,
+ 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7,
+ 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a,
+ 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5,
+ 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c,
+ 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1,
+ 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a,
+ 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75,
+ 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051,
+ 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46,
+ 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff,
+ 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77,
+ 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb,
+ 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000,
+ 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e,
+ 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927,
+ 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a,
+ 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e,
+ 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16,
+ 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d,
+ 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8,
+ 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd,
+ 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34,
+ 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163,
+ 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120,
+ 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d,
+ 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0,
+ 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422,
+ 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef,
+ 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36,
+ 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4,
+ 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662,
+ 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5,
+ 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3,
+ 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b,
+ 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8,
+ 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6,
+ 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6,
+ 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0,
+ 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815,
+ 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f,
+ 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df,
+ 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f,
+ 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e,
+ 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713,
+ 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89,
+ 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c,
+ 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf,
+ 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86,
+ 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f,
+ 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541,
+ 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190,
+ 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742,
+ },{
+ 0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e,
+ 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303,
+ 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c,
+ 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3,
+ 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0,
+ 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9,
+ 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259,
+ 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8,
+ 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971,
+ 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a,
+ 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f,
+ 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b,
+ 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8,
+ 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab,
+ 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708,
+ 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682,
+ 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2,
+ 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe,
+ 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb,
+ 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10,
+ 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd,
+ 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015,
+ 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e,
+ 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee,
+ 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000,
+ 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72,
+ 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39,
+ 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e,
+ 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91,
+ 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a,
+ 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17,
+ 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9,
+ 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60,
+ 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e,
+ 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1,
+ 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611,
+ 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1,
+ 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3,
+ 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964,
+ 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390,
+ 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b,
+ 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf,
+ 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46,
+ 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af,
+ 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512,
+ 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb,
+ 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a,
+ 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8,
+ 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c,
+ 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266,
+ 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8,
+ 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6,
+ 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604,
+ 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551,
+ 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41,
+ 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647,
+ 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c,
+ 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1,
+ 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737,
+ 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db,
+ 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340,
+ 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95,
+ 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1,
+ 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857,
+ },{
+ 0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27,
+ 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3,
+ 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502,
+ 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562,
+ 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe,
+ 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3,
+ 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552,
+ 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9,
+ 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9,
+ 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce,
+ 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253,
+ 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908,
+ 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b,
+ 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655,
+ 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337,
+ 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16,
+ 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69,
+ 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6,
+ 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6,
+ 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e,
+ 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6,
+ 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050,
+ 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9,
+ 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8,
+ 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000,
+ 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a,
+ 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d,
+ 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436,
+ 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b,
+ 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12,
+ 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b,
+ 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e,
+ 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f,
+ 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb,
+ 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4,
+ 0xdccad731, 0x85104263, 0x22401397, 0x112084c6,
+ 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729,
+ 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1,
+ 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9,
+ 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233,
+ 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4,
+ 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad,
+ 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e,
+ 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3,
+ 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25,
+ 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b,
+ 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f,
+ 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15,
+ 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0,
+ 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2,
+ 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7,
+ 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791,
+ 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496,
+ 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665,
+ 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b,
+ 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6,
+ 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13,
+ 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47,
+ 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7,
+ 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844,
+ 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3,
+ 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d,
+ 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456,
+ 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8,
+ },{
+ 0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a,
+ 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b,
+ 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5,
+ 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5,
+ 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d,
+ 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b,
+ 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95,
+ 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e,
+ 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27,
+ 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d,
+ 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562,
+ 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9,
+ 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752,
+ 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66,
+ 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3,
+ 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced,
+ 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e,
+ 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4,
+ 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4,
+ 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd,
+ 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d,
+ 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60,
+ 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767,
+ 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79,
+ 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000,
+ 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c,
+ 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736,
+ 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24,
+ 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b,
+ 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c,
+ 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12,
+ 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814,
+ 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3,
+ 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b,
+ 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8,
+ 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084,
+ 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7,
+ 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077,
+ 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247,
+ 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22,
+ 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698,
+ 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f,
+ 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254,
+ 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582,
+ 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf,
+ 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb,
+ 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883,
+ 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef,
+ 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629,
+ 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035,
+ 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533,
+ 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17,
+ 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4,
+ 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46,
+ 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb,
+ 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d,
+ 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb,
+ 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a,
+ 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73,
+ 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678,
+ 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2,
+ 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff,
+ 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064,
+ 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0,
+ },{
+ 0x52525252, 0x09090909, 0x6a6a6a6a, 0xd5d5d5d5,
+ 0x30303030, 0x36363636, 0xa5a5a5a5, 0x38383838,
+ 0xbfbfbfbf, 0x40404040, 0xa3a3a3a3, 0x9e9e9e9e,
+ 0x81818181, 0xf3f3f3f3, 0xd7d7d7d7, 0xfbfbfbfb,
+ 0x7c7c7c7c, 0xe3e3e3e3, 0x39393939, 0x82828282,
+ 0x9b9b9b9b, 0x2f2f2f2f, 0xffffffff, 0x87878787,
+ 0x34343434, 0x8e8e8e8e, 0x43434343, 0x44444444,
+ 0xc4c4c4c4, 0xdededede, 0xe9e9e9e9, 0xcbcbcbcb,
+ 0x54545454, 0x7b7b7b7b, 0x94949494, 0x32323232,
+ 0xa6a6a6a6, 0xc2c2c2c2, 0x23232323, 0x3d3d3d3d,
+ 0xeeeeeeee, 0x4c4c4c4c, 0x95959595, 0x0b0b0b0b,
+ 0x42424242, 0xfafafafa, 0xc3c3c3c3, 0x4e4e4e4e,
+ 0x08080808, 0x2e2e2e2e, 0xa1a1a1a1, 0x66666666,
+ 0x28282828, 0xd9d9d9d9, 0x24242424, 0xb2b2b2b2,
+ 0x76767676, 0x5b5b5b5b, 0xa2a2a2a2, 0x49494949,
+ 0x6d6d6d6d, 0x8b8b8b8b, 0xd1d1d1d1, 0x25252525,
+ 0x72727272, 0xf8f8f8f8, 0xf6f6f6f6, 0x64646464,
+ 0x86868686, 0x68686868, 0x98989898, 0x16161616,
+ 0xd4d4d4d4, 0xa4a4a4a4, 0x5c5c5c5c, 0xcccccccc,
+ 0x5d5d5d5d, 0x65656565, 0xb6b6b6b6, 0x92929292,
+ 0x6c6c6c6c, 0x70707070, 0x48484848, 0x50505050,
+ 0xfdfdfdfd, 0xedededed, 0xb9b9b9b9, 0xdadadada,
+ 0x5e5e5e5e, 0x15151515, 0x46464646, 0x57575757,
+ 0xa7a7a7a7, 0x8d8d8d8d, 0x9d9d9d9d, 0x84848484,
+ 0x90909090, 0xd8d8d8d8, 0xabababab, 0x00000000,
+ 0x8c8c8c8c, 0xbcbcbcbc, 0xd3d3d3d3, 0x0a0a0a0a,
+ 0xf7f7f7f7, 0xe4e4e4e4, 0x58585858, 0x05050505,
+ 0xb8b8b8b8, 0xb3b3b3b3, 0x45454545, 0x06060606,
+ 0xd0d0d0d0, 0x2c2c2c2c, 0x1e1e1e1e, 0x8f8f8f8f,
+ 0xcacacaca, 0x3f3f3f3f, 0x0f0f0f0f, 0x02020202,
+ 0xc1c1c1c1, 0xafafafaf, 0xbdbdbdbd, 0x03030303,
+ 0x01010101, 0x13131313, 0x8a8a8a8a, 0x6b6b6b6b,
+ 0x3a3a3a3a, 0x91919191, 0x11111111, 0x41414141,
+ 0x4f4f4f4f, 0x67676767, 0xdcdcdcdc, 0xeaeaeaea,
+ 0x97979797, 0xf2f2f2f2, 0xcfcfcfcf, 0xcececece,
+ 0xf0f0f0f0, 0xb4b4b4b4, 0xe6e6e6e6, 0x73737373,
+ 0x96969696, 0xacacacac, 0x74747474, 0x22222222,
+ 0xe7e7e7e7, 0xadadadad, 0x35353535, 0x85858585,
+ 0xe2e2e2e2, 0xf9f9f9f9, 0x37373737, 0xe8e8e8e8,
+ 0x1c1c1c1c, 0x75757575, 0xdfdfdfdf, 0x6e6e6e6e,
+ 0x47474747, 0xf1f1f1f1, 0x1a1a1a1a, 0x71717171,
+ 0x1d1d1d1d, 0x29292929, 0xc5c5c5c5, 0x89898989,
+ 0x6f6f6f6f, 0xb7b7b7b7, 0x62626262, 0x0e0e0e0e,
+ 0xaaaaaaaa, 0x18181818, 0xbebebebe, 0x1b1b1b1b,
+ 0xfcfcfcfc, 0x56565656, 0x3e3e3e3e, 0x4b4b4b4b,
+ 0xc6c6c6c6, 0xd2d2d2d2, 0x79797979, 0x20202020,
+ 0x9a9a9a9a, 0xdbdbdbdb, 0xc0c0c0c0, 0xfefefefe,
+ 0x78787878, 0xcdcdcdcd, 0x5a5a5a5a, 0xf4f4f4f4,
+ 0x1f1f1f1f, 0xdddddddd, 0xa8a8a8a8, 0x33333333,
+ 0x88888888, 0x07070707, 0xc7c7c7c7, 0x31313131,
+ 0xb1b1b1b1, 0x12121212, 0x10101010, 0x59595959,
+ 0x27272727, 0x80808080, 0xecececec, 0x5f5f5f5f,
+ 0x60606060, 0x51515151, 0x7f7f7f7f, 0xa9a9a9a9,
+ 0x19191919, 0xb5b5b5b5, 0x4a4a4a4a, 0x0d0d0d0d,
+ 0x2d2d2d2d, 0xe5e5e5e5, 0x7a7a7a7a, 0x9f9f9f9f,
+ 0x93939393, 0xc9c9c9c9, 0x9c9c9c9c, 0xefefefef,
+ 0xa0a0a0a0, 0xe0e0e0e0, 0x3b3b3b3b, 0x4d4d4d4d,
+ 0xaeaeaeae, 0x2a2a2a2a, 0xf5f5f5f5, 0xb0b0b0b0,
+ 0xc8c8c8c8, 0xebebebeb, 0xbbbbbbbb, 0x3c3c3c3c,
+ 0x83838383, 0x53535353, 0x99999999, 0x61616161,
+ 0x17171717, 0x2b2b2b2b, 0x04040404, 0x7e7e7e7e,
+ 0xbabababa, 0x77777777, 0xd6d6d6d6, 0x26262626,
+ 0xe1e1e1e1, 0x69696969, 0x14141414, 0x63636363,
+ 0x55555555, 0x21212121, 0x0c0c0c0c, 0x7d7d7d7d,
+ }};
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA1.cs b/mcs/class/corlib/System.Security.Cryptography/SHA1.cs
new file mode 100644
index 00000000000..605c4d9baa9
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA1.cs
@@ -0,0 +1,44 @@
+//
+// System.Security.Cryptography SHA1 Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Common base class for all derived SHA1 iplementations.
+ /// </summary>
+ public abstract class SHA1 : HashAlgorithm {
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ protected SHA1 () {
+
+ }
+
+
+ /// <summary>
+ /// Creates the default derived class.
+ /// </summary>
+ public static new SHA1 Create () {
+ return new SHA1CryptoServiceProvider();
+ }
+
+ /// <summary>
+ /// Creates a new derived class.
+ /// </summary>
+ /// <param name="st">FIXME: No clue. Specifies which derived class to create?</param>
+ [MonoTODO]
+ public static new SHA1 Create (string st) {
+ return Create();
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA1CryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/SHA1CryptoServiceProvider.cs
new file mode 100644
index 00000000000..d7061e496ae
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA1CryptoServiceProvider.cs
@@ -0,0 +1,455 @@
+//
+// System.Security.Cryptography SHA1CryptoServiceProvider Class implementation
+//
+// Author:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// C# implementation of the SHA1 cryptographic hash function.
+ /// LAMESPEC?: Basically the same thing as SHA1Managed except for how its implemented.
+ /// </summary>
+ public sealed class SHA1CryptoServiceProvider : SHA1 {
+ private const int BLOCK_SIZE_BYTES = 64;
+ private const int HASH_SIZE_BYTES = 20;
+ private const int HASH_SIZE_BITS = 160;
+ [CLSCompliant(false)] private uint[] _H; // these are my chaining variables
+ [CLSCompliant(false)] private uint count;
+ private byte[] _ProcessingBuffer; // Used to start data when passed less than a block worth.
+ private int _ProcessingBufferCount; // Counts how much data we have stored that still needs processed.
+
+ /// <summary>
+ /// Creates a new SHA1CryptoServiceProvider.
+ /// </summary>
+ public SHA1CryptoServiceProvider () {
+ _H = new uint[5];
+ HashSizeValue = HASH_SIZE_BITS;
+ _ProcessingBuffer = new byte[BLOCK_SIZE_BYTES];
+
+ Initialize();
+ }
+
+ /// <summary>
+ /// Drives the hashing function.
+ /// </summary>
+ /// <param name="rgb">Byte array containing the data to hash.</param>
+ /// <param name="start">Where in the input buffer to start.</param>
+ /// <param name="size">Size in bytes of the data in the buffer to hash.</param>
+ protected override void HashCore (byte[] rgb, int start, int size) {
+ int i;
+ State = 1;
+
+ if (_ProcessingBufferCount != 0) {
+ if (size < (BLOCK_SIZE_BYTES - _ProcessingBufferCount)) {
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, size);
+ _ProcessingBufferCount += size;
+ return;
+ }
+ else {
+ i = (BLOCK_SIZE_BYTES - _ProcessingBufferCount);
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, i);
+ ProcessBlock (_ProcessingBuffer, 0);
+ _ProcessingBufferCount = 0;
+ start += i;
+ size -= i;
+ }
+ }
+
+ for (i=0; i<size-size%BLOCK_SIZE_BYTES; i += BLOCK_SIZE_BYTES) {
+ ProcessBlock (rgb, start+i);
+ }
+
+ if (size%BLOCK_SIZE_BYTES != 0) {
+ System.Buffer.BlockCopy (rgb, size-size%BLOCK_SIZE_BYTES+start, _ProcessingBuffer, 0, size%BLOCK_SIZE_BYTES);
+ _ProcessingBufferCount = size%BLOCK_SIZE_BYTES;
+ }
+ }
+
+ /// <summary>
+ /// This finalizes the hash. Takes the data from the chaining variables and returns it.
+ /// </summary>
+ protected override byte[] HashFinal () {
+ byte[] hash = new byte[20];
+ int i, j;
+
+ ProcessFinalBlock(_ProcessingBuffer, 0, _ProcessingBufferCount);
+
+ for (i=0; i<5; i++) {
+ for (j=0; j<4; j++) {
+ hash[i*4+j] = (byte)(_H[i] >> (8*(3-j)));
+ }
+ }
+
+ State = 0;
+ return hash;
+ }
+
+
+ /// <summary>
+ /// Resets the class after use. Called automatically after hashing is done.
+ /// </summary>
+ public override void Initialize () {
+ count = 0;
+ _ProcessingBufferCount = 0;
+
+ _H[0] = 0x67452301;
+ _H[1] = 0xefcdab89;
+ _H[2] = 0x98badcfe;
+ _H[3] = 0x10325476;
+ _H[4] = 0xC3D2E1F0;
+ }
+
+ /// <summary>
+ /// This is the meat of the hash function. It is what processes each block one at a time.
+ /// </summary>
+ /// <param name="inputBuffer">Byte array to process data from.</param>
+ /// <param name="inputOffset">Where in the byte array to start processing.</param>
+ private void ProcessBlock(byte[] inputBuffer, int inputOffset) {
+ uint[] buff = new uint[80];
+ uint a, b, c, d, e;
+ int i;
+
+ count += BLOCK_SIZE_BYTES;
+
+ for (i=0; i<16; i++) {
+ buff[i] = ((uint)(inputBuffer[inputOffset+4*i]) << 24)
+ | ((uint)(inputBuffer[inputOffset+4*i+1]) << 16)
+ | ((uint)(inputBuffer[inputOffset+4*i+2]) << 8)
+ | ((uint)(inputBuffer[inputOffset+4*i+3]));
+ }
+
+ for (i=16; i<80; i++) {
+ buff[i] = ((buff[i-3] ^ buff[i-8] ^ buff[i-14] ^ buff[i-16]) << 1)
+ | ((buff[i-3] ^ buff[i-8] ^ buff[i-14] ^ buff[i-16]) >> 31);
+ }
+
+ a = _H[0];
+ b = _H[1];
+ c = _H[2];
+ d = _H[3];
+ e = _H[4];
+
+
+ // This function was unrolled because it seems to be doubling our performance with current compiler/VM.
+ // Possibly roll up if this changes.
+
+ // ---- Round 1 --------
+
+ e += ((a << 5) | (a >> 27)) + (((c ^ d) & b) ^ d) + 0x5A827999 + buff[0];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (((b ^ c) & a) ^ c) + 0x5A827999 + buff[1];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (((a ^ b) & e) ^ b) + 0x5A827999 + buff[2];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (((e ^ a) & d) ^ a) + 0x5A827999 + buff[3];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (((d ^ e) & c) ^ e) + 0x5A827999 + buff[4];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (((c ^ d) & b) ^ d) + 0x5A827999 + buff[5];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (((b ^ c) & a) ^ c) + 0x5A827999 + buff[6];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (((a ^ b) & e) ^ b) + 0x5A827999 + buff[7];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (((e ^ a) & d) ^ a) + 0x5A827999 + buff[8];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (((d ^ e) & c) ^ e) + 0x5A827999 + buff[9];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (((c ^ d) & b) ^ d) + 0x5A827999 + buff[10];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (((b ^ c) & a) ^ c) + 0x5A827999 + buff[11];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (((a ^ b) & e) ^ b) + 0x5A827999 + buff[12];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (((e ^ a) & d) ^ a) + 0x5A827999 + buff[13];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (((d ^ e) & c) ^ e) + 0x5A827999 + buff[14];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (((c ^ d) & b) ^ d) + 0x5A827999 + buff[15];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (((b ^ c) & a) ^ c) + 0x5A827999 + buff[16];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (((a ^ b) & e) ^ b) + 0x5A827999 + buff[17];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (((e ^ a) & d) ^ a) + 0x5A827999 + buff[18];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (((d ^ e) & c) ^ e) + 0x5A827999 + buff[19];
+ c = (c << 30) | (c >> 2);
+
+
+
+ // ---- Round 2 --------
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0x6ED9EBA1 + buff[20];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0x6ED9EBA1 + buff[21];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0x6ED9EBA1 + buff[22];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0x6ED9EBA1 + buff[23];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0x6ED9EBA1 + buff[24];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0x6ED9EBA1 + buff[25];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0x6ED9EBA1 + buff[26];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0x6ED9EBA1 + buff[27];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0x6ED9EBA1 + buff[28];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0x6ED9EBA1 + buff[29];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0x6ED9EBA1 + buff[30];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0x6ED9EBA1 + buff[31];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0x6ED9EBA1 + buff[32];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0x6ED9EBA1 + buff[33];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0x6ED9EBA1 + buff[34];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0x6ED9EBA1 + buff[35];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0x6ED9EBA1 + buff[36];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0x6ED9EBA1 + buff[37];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0x6ED9EBA1 + buff[38];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0x6ED9EBA1 + buff[39];
+ c = (c << 30) | (c >> 2);
+
+
+
+ // ---- Round 3 --------
+
+ e += ((a << 5) | (a >> 27)) + ((b&c) | (b&d) | (c&d)) + 0x8F1BBCDC + buff[40];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + ((a&b) | (a&c) | (b&c)) + 0x8F1BBCDC + buff[41];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + ((e&a) | (e&b) | (a&b)) + 0x8F1BBCDC + buff[42];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + ((d&e) | (d&a) | (e&a)) + 0x8F1BBCDC + buff[43];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + ((c&d) | (c&e) | (d&e)) + 0x8F1BBCDC + buff[44];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + ((b&c) | (b&d) | (c&d)) + 0x8F1BBCDC + buff[45];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + ((a&b) | (a&c) | (b&c)) + 0x8F1BBCDC + buff[46];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + ((e&a) | (e&b) | (a&b)) + 0x8F1BBCDC + buff[47];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + ((d&e) | (d&a) | (e&a)) + 0x8F1BBCDC + buff[48];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + ((c&d) | (c&e) | (d&e)) + 0x8F1BBCDC + buff[49];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + ((b&c) | (b&d) | (c&d)) + 0x8F1BBCDC + buff[50];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + ((a&b) | (a&c) | (b&c)) + 0x8F1BBCDC + buff[51];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + ((e&a) | (e&b) | (a&b)) + 0x8F1BBCDC + buff[52];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + ((d&e) | (d&a) | (e&a)) + 0x8F1BBCDC + buff[53];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + ((c&d) | (c&e) | (d&e)) + 0x8F1BBCDC + buff[54];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + ((b&c) | (b&d) | (c&d)) + 0x8F1BBCDC + buff[55];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + ((a&b) | (a&c) | (b&c)) + 0x8F1BBCDC + buff[56];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + ((e&a) | (e&b) | (a&b)) + 0x8F1BBCDC + buff[57];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + ((d&e) | (d&a) | (e&a)) + 0x8F1BBCDC + buff[58];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + ((c&d) | (c&e) | (d&e)) + 0x8F1BBCDC + buff[59];
+ c = (c << 30) | (c >> 2);
+
+
+
+ // ---- Round 4 --------
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0xCA62C1D6 + buff[60];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0xCA62C1D6 + buff[61];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0xCA62C1D6 + buff[62];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0xCA62C1D6 + buff[63];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0xCA62C1D6 + buff[64];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0xCA62C1D6 + buff[65];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0xCA62C1D6 + buff[66];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0xCA62C1D6 + buff[67];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0xCA62C1D6 + buff[68];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0xCA62C1D6 + buff[69];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0xCA62C1D6 + buff[70];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0xCA62C1D6 + buff[71];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0xCA62C1D6 + buff[72];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0xCA62C1D6 + buff[73];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0xCA62C1D6 + buff[74];
+ c = (c << 30) | (c >> 2);
+
+ e += ((a << 5) | (a >> 27)) + (b ^ c ^ d) + 0xCA62C1D6 + buff[75];
+ b = (b << 30) | (b >> 2);
+
+ d += ((e << 5) | (e >> 27)) + (a ^ b ^ c) + 0xCA62C1D6 + buff[76];
+ a = (a << 30) | (a >> 2);
+
+ c += ((d << 5) | (d >> 27)) + (e ^ a ^ b) + 0xCA62C1D6 + buff[77];
+ e = (e << 30) | (e >> 2);
+
+ b += ((c << 5) | (c >> 27)) + (d ^ e ^ a) + 0xCA62C1D6 + buff[78];
+ d = (d << 30) | (d >> 2);
+
+ a += ((b << 5) | (b >> 27)) + (c ^ d ^ e) + 0xCA62C1D6 + buff[79];
+ c = (c << 30) | (c >> 2);
+
+
+ _H[0] += a;
+ _H[1] += b;
+ _H[2] += c;
+ _H[3] += d;
+ _H[4] += e;
+ }
+
+ /// <summary>
+ /// Pads and then processes the final block.
+ /// Non-standard.
+ /// </summary>
+ /// <param name="inputBuffer">Buffer to grab data from.</param>
+ /// <param name="inputOffset">Position in buffer in bytes to get data from.</param>
+ /// <param name="inputCount">How much data in bytes in the buffer to use.</param>
+ private void ProcessFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount) {
+ byte[] fooBuffer;
+ int paddingSize;
+ int i;
+ uint size;
+
+ paddingSize = (int)(56 - (inputCount + count) % BLOCK_SIZE_BYTES);
+
+ if (paddingSize < 1)
+ paddingSize += BLOCK_SIZE_BYTES;
+
+ fooBuffer = new byte[inputCount+paddingSize+8];
+
+ for (i=0; i<inputCount; i++) {
+ fooBuffer[i] = inputBuffer[i+inputOffset];
+ }
+
+ fooBuffer[inputCount] = 0x80;
+ for (i=inputCount+1; i<inputCount+paddingSize; i++) {
+ fooBuffer[i] = 0x00;
+ }
+
+ size = (uint)(count+inputCount);
+ size *= 8; // I deal in bytes. They algorythm deals in bits.
+
+ fooBuffer[inputCount+paddingSize] = 0x00;
+ fooBuffer[inputCount+paddingSize+1] = 0x00;
+ fooBuffer[inputCount+paddingSize+2] = 0x00;
+ fooBuffer[inputCount+paddingSize+3] = 0x00;
+
+ fooBuffer[inputCount+paddingSize+4] = (byte)((size) >> 24);
+ fooBuffer[inputCount+paddingSize+5] = (byte)((size) >> 16);
+ fooBuffer[inputCount+paddingSize+6] = (byte)((size) >> 8);
+ fooBuffer[inputCount+paddingSize+7] = (byte)((size) >> 0);
+
+ ProcessBlock(fooBuffer, 0);
+
+ if (inputCount+paddingSize+8 == 128) {
+ ProcessBlock(fooBuffer, 64);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA256.cs b/mcs/class/corlib/System.Security.Cryptography/SHA256.cs
new file mode 100644
index 00000000000..c3fbb573e07
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA256.cs
@@ -0,0 +1,45 @@
+//
+// System.Security.Cryptography SHA256 Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Common base class for all derived SHA256 iplementations.
+ /// Abstract.
+ /// </summary>
+ public abstract class SHA256 : HashAlgorithm {
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ public SHA256 () {
+
+ }
+
+ /// <summary>
+ /// Creates the default derived class.
+ /// </summary>
+ public static new SHA256 Create () {
+ return new SHA256Managed ();
+ }
+
+ /// <summary>
+ /// Creates a new derived class.
+ /// </summary>
+ /// <param name="st">FIXME: No clue. Specifies which derived class to create?</param>
+ [MonoTODO]
+ public static new SHA256 Create (string st) {
+ return Create ();
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA256Managed.cs b/mcs/class/corlib/System.Security.Cryptography/SHA256Managed.cs
new file mode 100644
index 00000000000..bcfd16b3479
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA256Managed.cs
@@ -0,0 +1,290 @@
+//
+// System.Security.Cryptography SHA256Managed Class implementation
+//
+// Author:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// (C) 2001
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// C# implementation of the SHA1 cryptographic hash function.
+ /// LAMESPEC?: Basically the same thing as SHA1Managed except for how its implemented.
+ /// </summary>
+ public class SHA256Managed : SHA256 {
+ private const int BLOCK_SIZE_BYTES = 64;
+ private const int HASH_SIZE_BYTES = 32;
+ private const int HASH_SIZE_BITS = 256;
+ [CLSCompliant(false)] protected uint[] _H;
+ [CLSCompliant(false)] private uint[] K;
+ [CLSCompliant(false)] protected uint count;
+ private byte[] _ProcessingBuffer; // Used to start data when passed less than a block worth.
+ private int _ProcessingBufferCount; // Counts how much data we have stored that still needs processed.
+
+ /// <summary>
+ /// Creates a new SHA256Managed class.
+ /// </summary>
+ public SHA256Managed () {
+ _H = new uint[8];
+ HashSizeValue = HASH_SIZE_BITS;
+ _ProcessingBuffer = new byte[BLOCK_SIZE_BYTES];
+
+ K = new uint[64];
+ K[0] = 0x428A2F98; K[1] = 0x71374491; K[2] = 0xB5C0FBCF; K[3] = 0xE9B5DBA5;
+ K[4] = 0x3956C25B; K[5] = 0x59F111F1; K[6] = 0x923F82A4; K[7] = 0xAB1C5ED5;
+ K[8] = 0xD807AA98; K[9] = 0x12835B01; K[10] = 0x243185BE; K[11] = 0x550C7DC3;
+ K[12] = 0x72BE5D74; K[13] = 0x80DEB1FE; K[14] = 0x9BDC06A7; K[15] = 0xC19BF174;
+ K[16] = 0xE49B69C1; K[17] = 0xEFBE4786; K[18] = 0x0FC19DC6; K[19] = 0x240CA1CC;
+ K[20] = 0x2DE92C6F; K[21] = 0x4A7484AA; K[22] = 0x5CB0A9DC; K[23] = 0x76F988DA;
+ K[24] = 0x983E5152; K[25] = 0xA831C66D; K[26] = 0xB00327C8; K[27] = 0xBF597FC7;
+ K[28] = 0xC6E00BF3; K[29] = 0xD5A79147; K[30] = 0x06CA6351; K[31] = 0x14292967;
+ K[32] = 0x27B70A85; K[33] = 0x2E1B2138; K[34] = 0x4D2C6DFC; K[35] = 0x53380D13;
+ K[36] = 0x650A7354; K[37] = 0x766A0ABB; K[38] = 0x81C2C92E; K[39] = 0x92722C85;
+ K[40] = 0xA2BFE8A1; K[41] = 0xA81A664B; K[42] = 0xC24B8B70; K[43] = 0xC76C51A3;
+ K[44] = 0xD192E819; K[45] = 0xD6990624; K[46] = 0xF40E3585; K[47] = 0x106AA070;
+ K[48] = 0x19A4C116; K[49] = 0x1E376C08; K[50] = 0x2748774C; K[51] = 0x34B0BCB5;
+ K[52] = 0x391C0CB3; K[53] = 0x4ED8AA4A; K[54] = 0x5B9CCA4F; K[55] = 0x682E6FF3;
+ K[56] = 0x748F82EE; K[57] = 0x78A5636F; K[58] = 0x84C87814; K[59] = 0x8CC70208;
+ K[60] = 0x90BEFFFA; K[61] = 0xA4506CEB; K[62] = 0xBEF9A3F7; K[63] = 0xC67178F2;
+
+ Initialize();
+ }
+
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Ch (uint u, uint v, uint w) {
+ return (u&v) ^ (~u&w);
+ }
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Maj (uint u, uint v, uint w) {
+ return (u&v) ^ (u&w) ^ (v&w);
+ }
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Ro0 (uint x) {
+ return ((x >> 7) | (x << 25))
+ ^ ((x >> 18) | (x << 14))
+ ^ (x >> 3);
+ }
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Ro1 (uint x) {
+ return ((x >> 17) | (x << 15))
+ ^ ((x >> 19) | (x << 13))
+ ^ (x >> 10);
+ }
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Sig0 (uint x) {
+ return ((x >> 2) | (x << 30))
+ ^ ((x >> 13) | (x << 19))
+ ^ ((x >> 22) | (x << 10));
+ }
+
+ /// <summary>
+ /// Internal function handling a subset of the algorithm.
+ /// </summary>
+ private uint Sig1 (uint x) {
+ return ((x >> 6) | (x << 26))
+ ^ ((x >> 11) | (x << 21))
+ ^ ((x >> 25) | (x << 7));
+ }
+
+ /// <summary>
+ /// Drives the hashing function.
+ /// </summary>
+ /// <param name="rgb">Byte array containing the data to hash.</param>
+ /// <param name="start">Where in the input buffer to start.</param>
+ /// <param name="size">Size in bytes of the data in the buffer to hash.</param>
+ protected override void HashCore (byte[] rgb, int start, int size) {
+ int i;
+ State = 1;
+
+ if (_ProcessingBufferCount != 0) {
+ if (size < (BLOCK_SIZE_BYTES - _ProcessingBufferCount)) {
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, size);
+ _ProcessingBufferCount += size;
+ return;
+ }
+ else {
+ i = (BLOCK_SIZE_BYTES - _ProcessingBufferCount);
+ System.Buffer.BlockCopy (rgb, start, _ProcessingBuffer, _ProcessingBufferCount, i);
+ ProcessBlock (_ProcessingBuffer, 0);
+ _ProcessingBufferCount = 0;
+ start += i;
+ size -= i;
+ }
+ }
+
+ for (i=0; i<size-size%BLOCK_SIZE_BYTES; i += BLOCK_SIZE_BYTES) {
+ ProcessBlock (rgb, start+i);
+ }
+
+ if (size%BLOCK_SIZE_BYTES != 0) {
+ System.Buffer.BlockCopy (rgb, size-size%BLOCK_SIZE_BYTES+start, _ProcessingBuffer, 0, size%BLOCK_SIZE_BYTES);
+ _ProcessingBufferCount = size%BLOCK_SIZE_BYTES;
+ }
+ }
+
+ /// <summary>
+ /// This finalizes the hash. Takes the data from the chaining variables and returns it.
+ /// </summary>
+ protected override byte[] HashFinal () {
+ byte[] hash = new byte[32];
+ int i, j;
+
+ ProcessFinalBlock(_ProcessingBuffer, 0, _ProcessingBufferCount);
+
+ for (i=0; i<8; i++) {
+ for (j=0; j<4; j++) {
+ hash[i*4+j] = (byte)(_H[i] >> (24-j*8));
+ }
+ }
+
+ State = 0;
+ return hash;
+ }
+
+ /// <summary>
+ /// Resets the class after use. Called automatically after hashing is done.
+ /// </summary>
+ public override void Initialize () {
+ count = 0;
+ _ProcessingBufferCount = 0;
+
+ _H[0] = 0x6A09E667;
+ _H[1] = 0xBB67AE85;
+ _H[2] = 0x3C6EF372;
+ _H[3] = 0xA54FF53A;
+ _H[4] = 0x510E527F;
+ _H[5] = 0x9B05688C;
+ _H[6] = 0x1F83D9AB;
+ _H[7] = 0x5BE0CD19;
+ }
+
+ /// <summary>
+ /// This is the meat of the hash function. It is what processes each block one at a time.
+ /// </summary>
+ /// <param name="inputBuffer">Byte array to process data from.</param>
+ /// <param name="inputOffset">Where in the byte array to start processing.</param>
+ public void ProcessBlock(byte[] inputBuffer, int inputOffset) {
+ uint a, b, c, d, e, f, g, h;
+ uint t1, t2;
+ int i;
+ uint[] buff;
+
+ count += BLOCK_SIZE_BYTES;
+
+ buff = new uint[64];
+
+ for (i=0; i<16; i++) {
+ buff[i] = ((uint)(inputBuffer[inputOffset+4*i]) << 24)
+ | ((uint)(inputBuffer[inputOffset+4*i+1]) << 16)
+ | ((uint)(inputBuffer[inputOffset+4*i+2]) << 8)
+ | ((uint)(inputBuffer[inputOffset+4*i+3]));
+ }
+
+
+ for (i=16; i<64; i++) {
+ buff[i] = Ro1(buff[i-2]) + buff[i-7] + Ro0(buff[i-15]) + buff[i-16];
+ }
+
+ a = _H[0];
+ b = _H[1];
+ c = _H[2];
+ d = _H[3];
+ e = _H[4];
+ f = _H[5];
+ g = _H[6];
+ h = _H[7];
+
+ for (i=0; i<64; i++) {
+ t1 = h + Sig1(e) + Ch(e,f,g) + K[i] + buff[i];
+ t2 = Sig0(a) + Maj(a,b,c);
+ h = g;
+ g = f;
+ f = e;
+ e = d + t1;
+ d = c;
+ c = b;
+ b = a;
+ a = t1 + t2;
+ }
+
+ _H[0] += a;
+ _H[1] += b;
+ _H[2] += c;
+ _H[3] += d;
+ _H[4] += e;
+ _H[5] += f;
+ _H[6] += g;
+ _H[7] += h;
+ }
+
+ /// <summary>
+ /// Pads and then processes the final block.
+ /// Non-standard.
+ /// </summary>
+ /// <param name="inputBuffer">Buffer to grab data from.</param>
+ /// <param name="inputOffset">Position in buffer in bytes to get data from.</param>
+ /// <param name="inputCount">How much data in bytes in the buffer to use.</param>
+ public void ProcessFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount) {
+ byte[] fooBuffer;
+ int paddingSize;
+ int i;
+ uint size;
+
+ paddingSize = (int)(56 - (inputCount + count) % BLOCK_SIZE_BYTES);
+
+ if (paddingSize < 1)
+ paddingSize += BLOCK_SIZE_BYTES;
+
+ fooBuffer = new byte[inputCount+paddingSize+8];
+
+ for (i=0; i<inputCount; i++) {
+ fooBuffer[i] = inputBuffer[i+inputOffset];
+ }
+
+ fooBuffer[inputCount] = 0x80;
+ for (i=inputCount+1; i<inputCount+paddingSize; i++) {
+ fooBuffer[i] = 0x00;
+ }
+
+ size = (uint)(count+inputCount);
+ size *= 8;
+
+ fooBuffer[inputCount+paddingSize] = 0x00;
+ fooBuffer[inputCount+paddingSize+1] = 0x00;
+ fooBuffer[inputCount+paddingSize+2] = 0x00;
+ fooBuffer[inputCount+paddingSize+3] = 0x00;
+
+ fooBuffer[inputCount+paddingSize+4] = (byte)((size) >> 24);
+ fooBuffer[inputCount+paddingSize+5] = (byte)((size) >> 16);
+ fooBuffer[inputCount+paddingSize+6] = (byte)((size) >> 8);
+ fooBuffer[inputCount+paddingSize+7] = (byte)((size) >> 0);
+
+ ProcessBlock(fooBuffer, 0);
+
+ if (inputCount+paddingSize+8 == 128) {
+ ProcessBlock(fooBuffer, 64);
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA384.cs b/mcs/class/corlib/System.Security.Cryptography/SHA384.cs
new file mode 100644
index 00000000000..368d5d76ada
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA384.cs
@@ -0,0 +1,45 @@
+//
+// System.Security.Cryptography SHA384 Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Common base class for all derived SHA384 iplementations.
+ /// </summary>
+ public abstract class SHA384 : HashAlgorithm {
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ public SHA384 () {
+
+ }
+
+
+ /// <summary>
+ /// Creates the default derived class.
+ /// </summary>
+ public static new SHA384 Create () {
+ return new SHA384Managed();
+ }
+
+ /// <summary>
+ /// Creates a new derived class.
+ /// </summary>
+ /// <param name="st">FIXME: No clue. Specifies which derived class to create?</param>
+ [MonoTODO]
+ public static new SHA384 Create (string st) {
+ return Create();
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA384Managed.cs b/mcs/class/corlib/System.Security.Cryptography/SHA384Managed.cs
new file mode 100644
index 00000000000..d5679038c80
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA384Managed.cs
@@ -0,0 +1,33 @@
+//
+// System.Security.Cryptography.SHA384Managed.cs
+//
+// Authors:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ [MonoTODO]
+ public class SHA384Managed : SHA384 {
+ public SHA384Managed () {
+ }
+
+ public override void Initialize () {
+ }
+
+ // protected
+
+ protected override void HashCore (byte[] rgb, int start, int count) {
+ }
+
+ protected override byte[] HashFinal () {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA512.cs b/mcs/class/corlib/System.Security.Cryptography/SHA512.cs
new file mode 100644
index 00000000000..49f266701e7
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA512.cs
@@ -0,0 +1,45 @@
+//
+// System.Security.Cryptography SHA512 Class implementation
+//
+// Authors:
+// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
+//
+// Copyright 2001 by Matthew S. Ford.
+//
+
+
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Common base class for all derived SHA512 iplementations.
+ /// </summary>
+ public abstract class SHA512 : HashAlgorithm {
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ public SHA512 () {
+
+ }
+
+
+ /// <summary>
+ /// Creates the default derived class.
+ /// </summary>
+ public static new SHA512 Create () {
+ return new SHA512Managed();
+ }
+
+ /// <summary>
+ /// Creates a new derived class.
+ /// </summary>
+ /// <param name="st">FIXME: No clue. Specifies which derived class to create?</param>
+ [MonoTODO]
+ public static new SHA512 Create (string st) {
+ return Create();
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/SHA512Managed.cs b/mcs/class/corlib/System.Security.Cryptography/SHA512Managed.cs
new file mode 100644
index 00000000000..3b3a010a2fe
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SHA512Managed.cs
@@ -0,0 +1,33 @@
+//
+// System.Security.Cryptography.SHA512Managed.cs
+//
+// Authors:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ [MonoTODO]
+ public class SHA512Managed : SHA512 {
+ public SHA512Managed () {
+ }
+
+ public override void Initialize () {
+ }
+
+ // protected
+
+ protected override void HashCore (byte[] rgb, int start, int count) {
+ }
+
+ protected override byte[] HashFinal () {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Cryptography/SignatureDescription.cs b/mcs/class/corlib/System.Security.Cryptography/SignatureDescription.cs
new file mode 100755
index 00000000000..f867f763316
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SignatureDescription.cs
@@ -0,0 +1,107 @@
+//
+// System.Security.Cryptography SignatureDescription Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+// LAMESPEC: documentation of this class is completely missing in the sdk doc
+// TODO: Implement AsymmetricSignatureFormatter & AsymmetricSignatureDeformatter methods
+
+using System;
+using System.Security;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// LAMESPEC: no sdk doc available for this class by the time of beta 2
+ /// </summary>
+ [MonoTODO]
+ public class SignatureDescription {
+ private string _DeformatterAlgorithm;
+ private string _DigestAlgorithm;
+ private string _FormatterAlgorithm;
+ private string _KeyAlgorithm;
+
+ /// <summary>
+ /// LAMESPEC: no idea what param el should do??
+ /// </summary>
+ public SignatureDescription (SecurityElement el) {
+ if (el == null)
+ throw new CryptographicException();
+ }
+
+
+ /// <summary>
+ /// LAMESPEC: what to do if setting null values?
+ /// </summary>
+ public string DeformatterAlgorithm {
+ get {
+ return _DeformatterAlgorithm;
+ }
+ set {
+ _DeformatterAlgorithm = value;
+ }
+ }
+
+ /// <summary>
+ /// LAMESPEC: what to do if setting null values?
+ /// </summary>
+ public string DigestAlgorithm {
+ get {
+ return _DigestAlgorithm;
+ }
+ set {
+ _DigestAlgorithm = value;
+ }
+ }
+
+ /// <summary>
+ /// LAMESPEC: what to do if setting null values?
+ /// </summary>
+ public string FormatterAlgorithm {
+ get {
+ return _FormatterAlgorithm;
+ }
+ set {
+ _FormatterAlgorithm = value;
+ }
+ }
+
+ /// <summary>
+ /// LAMESPEC: what to do if setting null values?
+ /// </summary>
+ public string KeyAlgorithm {
+ get {
+ return _KeyAlgorithm;
+ }
+ set {
+ _KeyAlgorithm = value;
+ }
+ }
+
+ [MonoTODO]
+ public virtual AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key)
+ {
+ // TODO: Implement
+ return null;
+ }
+
+ /// <summary>
+ /// Create the hash algorithm assigned with this object
+ /// </summary>
+ public virtual HashAlgorithm CreateDigest()
+ {
+ return HashAlgorithm.Create(_DigestAlgorithm);
+ }
+
+ [MonoTODO]
+ public virtual AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key)
+ {
+ // TODO: Implement
+ return null;
+ }
+
+ } // SignatureDescription
+
+} // System.Security.Cryptography
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs b/mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs
new file mode 100755
index 00000000000..508c25d5810
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/SymmetricAlgorithm.cs
@@ -0,0 +1,256 @@
+//
+// System.Security.Cryptography SymmetricAlgorithm Class implementation
+//
+// Authors:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ /// <summary>
+ /// Abstract base class for all cryptographic symmetric algorithms.
+ /// Available algorithms include:
+ /// DES, RC2, Rijndael, TripleDES
+ /// </summary>
+ public abstract class SymmetricAlgorithm {
+ protected int BlockSizeValue; // The block size of the cryptographic operation in bits.
+ protected int FeedbackSizeValue; // The feedback size of the cryptographic operation in bits.
+ protected byte[] IVValue; // The initialization vector ( IV) for the symmetric algorithm.
+ protected int KeySizeValue; // The size of the secret key used by the symmetric algorithm in bits.
+ protected byte[] KeyValue; // The secret key for the symmetric algorithm.
+ protected KeySizes[] LegalBlockSizesValue; // Specifies the block sizes that are supported by the symmetric algorithm.
+ protected KeySizes[] LegalKeySizesValue; // Specifies the key sizes that are supported by the symmetric algorithm.
+ protected CipherMode ModeValue; // Represents the cipher mode used in the symmetric algorithm.
+ protected PaddingMode PaddingValue; // Represents the padding mode used in the symmetric algorithm.
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ public SymmetricAlgorithm () {
+ throw new CryptographicException();
+ }
+
+ /// <summary>
+ /// Called from constructor of derived class.
+ /// </summary>
+ ~SymmetricAlgorithm () {
+ if (KeyValue != null) {
+ Array.Clear(KeyValue, 0, KeyValue.Length);
+ KeyValue = null;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual BlockSize
+ /// </summary>
+ public virtual int BlockSize {
+ get {
+ return this.BlockSizeValue;
+ }
+ set {
+ if (IsLegalKeySize(this.LegalBlockSizesValue, value))
+ this.BlockSizeValue = value;
+ else
+ throw new CryptographicException("block size not supported by algorithm");
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual FeedbackSize
+ /// </summary>
+ public virtual int FeedbackSize {
+ get {
+ return this.FeedbackSizeValue;
+ }
+ set {
+ if (value > this.BlockSizeValue)
+ throw new CryptographicException("feedback size larger than block size");
+ else
+ this.FeedbackSizeValue = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual Initial Vector
+ /// </summary>
+ [MonoTODO]
+ public virtual byte[] IV {
+ get {
+ if (this.IVValue == null)
+ GenerateIV();
+
+ return this.IVValue;
+ }
+ set {
+ if (value == null)
+ throw new ArgumentNullException("tried setting initial vector to null");
+
+ // FIXME: dont know if to compare with block or key size
+ if (value.Length != this.KeySizeValue)
+ throw new CryptographicException("tried setting initial vector with illegal size");
+
+ this.IVValue = new byte [value.Length];
+ System.Array.Copy (value, 0, this.IVValue, 0, value.Length);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual key
+ /// </summary>
+ public virtual byte[] Key {
+ get {
+ if (this.KeyValue == null)
+ GenerateKey();
+
+ return this.KeyValue;
+ }
+ set {
+ if (value == null)
+ throw new ArgumentNullException("tried setting key to null");
+
+ if (!IsLegalKeySize(this.LegalKeySizesValue, value.Length))
+ throw new CryptographicException("key size not supported by algorithm");
+
+ this.KeySizeValue = value.Length;
+ this.KeyValue = new byte [this.KeySizeValue];
+ System.Array.Copy (value, 0, this.KeyValue, 0, this.KeySizeValue);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual key size
+ /// </summary>
+ public virtual int KeySize {
+ get {
+ return this.KeySizeValue;
+ }
+ set {
+ if (!IsLegalKeySize(this.LegalKeySizesValue, value))
+ throw new CryptographicException("key size not supported by algorithm");
+
+ this.KeyValue = null;
+ this.KeySizeValue = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets all legal block sizes
+ /// </summary>
+ public virtual KeySizes[] LegalBlockSizes {
+ get {
+ return this.LegalBlockSizesValue;
+ }
+ }
+
+ /// <summary>
+ /// Gets all legal key sizes
+ /// </summary>
+ public virtual KeySizes[] LegalKeySizes {
+ get {
+ return this.LegalKeySizesValue;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual cipher mode
+ /// </summary>
+ public virtual CipherMode Mode {
+ get {
+ return this.ModeValue;
+ }
+ set {
+ if (Enum.IsDefined(ModeValue.GetType(), value))
+ this.ModeValue = value;
+ else
+ throw new CryptographicException("padding mode not available");
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the actual padding
+ /// </summary>
+ public virtual PaddingMode Padding {
+ get {
+ return this.PaddingValue;
+ }
+ set {
+ if (Enum.IsDefined(PaddingValue.GetType(), value))
+ this.PaddingValue = value;
+ else
+ throw new CryptographicException("padding mode not available");
+ }
+ }
+
+ /// <summary>
+ /// Gets an Decryptor transform object to work with a CryptoStream
+ /// </summary>
+ public virtual ICryptoTransform CreateDecryptor() {
+ return CreateDecryptor(Key, IV);
+ }
+
+ /// <summary>
+ /// Gets an Decryptor transform object to work with a CryptoStream
+ /// </summary>
+ public abstract ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV);
+
+ /// <summary>
+ /// Gets an Encryptor transform object to work with a CryptoStream
+ /// </summary>
+ public virtual ICryptoTransform CreateEncryptor() {
+ return CreateEncryptor(Key, IV);
+ }
+
+ /// <summary>
+ /// Gets an Encryptor transform object to work with a CryptoStream
+ /// </summary>
+ public abstract ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV);
+
+ /// <summary>
+ /// used to generate an inital vector if none is specified
+ /// </summary>
+ public abstract void GenerateIV();
+
+ /// </summary>
+ /// used to generate a random key if none is specified
+ /// </summary>
+ public abstract void GenerateKey();
+
+ internal bool IsLegalKeySize(KeySizes[] LegalKeys, int Size) {
+ foreach (KeySizes LegalKeySize in LegalKeys) {
+ for (int i=LegalKeySize.MinSize; i<=LegalKeySize.MaxSize; i+=LegalKeySize.SkipSize) {
+ if (i == Size)
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Checks wether the given keyLength is valid for the current algorithm
+ /// </summary>
+ /// <param name="bitLength">the given keyLength</param>
+ public bool ValidKeySize(int bitLength) {
+ return IsLegalKeySize(LegalKeySizesValue, bitLength);
+ }
+
+ /// <summary>
+ /// Creates the default implementation of the default symmetric algorithm (RC2).
+ /// </summary>
+ public static SymmetricAlgorithm Create () {
+ return Rijndael.Create();
+ }
+
+ /// <summary>
+ /// Creates a specific implementation of the given symmetric algorithm.
+ /// </summary>
+ /// <param name="algName">the given algorithm</param>
+ [MonoTODO]
+ public static SymmetricAlgorithm Create (string algName) {
+ // TODO: Use Reflection to create a new algorithm instance
+ return null;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Cryptography/ToBase64Transform.cs b/mcs/class/corlib/System.Security.Cryptography/ToBase64Transform.cs
new file mode 100644
index 00000000000..8f72bbee4ee
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/ToBase64Transform.cs
@@ -0,0 +1,234 @@
+//
+// System.Security.Cryptography.ToBase64Transform
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+using System;
+using System.Security.Cryptography;
+
+
+namespace System.Security.Cryptography {
+
+ public class ToBase64Transform : ICryptoTransform {
+
+
+ /// <summary>
+ /// Default constructor.
+ /// </summary>
+ public ToBase64Transform ()
+ {
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public bool CanTransformMultipleBlocks {
+ get {
+ return false;
+ }
+ }
+
+
+ /// <summary>
+ /// Returns the input block size for the Base64 encoder.
+ /// </summary>
+ /// <remarks>
+ /// The returned value is always 3.
+ /// </remarks>
+ public int InputBlockSize {
+ get {
+ return 3;
+ }
+ }
+
+
+ /// <summary>
+ /// Returns the output block size for the Base64 encoder.
+ /// </summary>
+ /// <remarks>
+ /// The value returned by this property is always 4.
+ /// </remarks>
+ public int OutputBlockSize {
+ get {
+ return 4;
+ }
+ }
+
+
+ /// <summary>
+ /// </summary>
+ public int TransformBlock (byte [] inputBuffer,
+ int inputOffset,
+ int inputCount,
+ byte [] outputBuffer,
+ int outputOffset)
+ {
+ if (inputCount != this.InputBlockSize)
+ throw new CryptographicException();
+
+ byte [] lookup = Base64Table.EncodeTable;
+
+ int b1 = inputBuffer [inputOffset];
+ int b2 = inputBuffer [inputOffset + 1];
+ int b3 = inputBuffer [inputOffset + 2];
+
+ outputBuffer [outputOffset] = lookup [b1 >> 2];
+ outputBuffer [outputOffset+1] = lookup [((b1 << 4) & 0x30) | (b2 >> 4)];
+ outputBuffer [outputOffset+2] = lookup [((b2 << 2) & 0x3c) | (b3 >> 6)];
+ outputBuffer [outputOffset+3] = lookup [b3 & 0x3f];
+
+ return this.OutputBlockSize;
+ }
+
+
+
+
+ // LAMESPEC: It's not clear from Beta2 docs what should be
+ // happening here if inputCount > InputBlockSize.
+ // It just "Converts the specified region of the specified
+ // byte array" and that's all.
+ // Beta2 implementation throws some strange (and undocumented)
+ // exception in such case. The exception is thrown by
+ // System.Convert and not the method itself.
+ // Anyhow, this implementation just encodes blocks of any size,
+ // like any usual Base64 encoder.
+
+ /// <summary>
+ /// </summary>
+ public byte [] TransformFinalBlock (byte [] inputBuffer,
+ int inputOffset,
+ int inputCount)
+ {
+ int blockLen = this.InputBlockSize;
+ int outLen = this.OutputBlockSize;
+ int fullBlocks = inputCount / blockLen;
+ int tail = inputCount % blockLen;
+
+ byte [] res = new byte [(inputCount != 0)
+ ? ((inputCount + 2) / blockLen) * outLen
+ : 0];
+
+ int outputOffset = 0;
+
+ for (int i = 0; i < fullBlocks; i++) {
+
+ TransformBlock (inputBuffer, inputOffset,
+ blockLen, res, outputOffset);
+
+ inputOffset += blockLen;
+ outputOffset += outLen;
+ }
+
+
+ byte [] lookup = Base64Table.EncodeTable;
+ int b1,b2;
+
+
+ // When fewer than 24 input bits are available
+ // in an input group, zero bits are added
+ // (on the right) to form an integral number of
+ // 6-bit groups.
+ switch (tail) {
+ case 0:
+ break;
+ case 1:
+ b1 = inputBuffer [inputOffset];
+ res [outputOffset] = lookup [b1 >> 2];
+ res [outputOffset+1] = lookup [(b1 << 4) & 0x30];
+
+ // padding
+ res [outputOffset+2] = (byte)'=';
+ res [outputOffset+3] = (byte)'=';
+ break;
+
+ case 2:
+ b1 = inputBuffer [inputOffset];
+ b2 = inputBuffer [inputOffset + 1];
+ res [outputOffset] = lookup [b1 >> 2];
+ res [outputOffset+1] = lookup [((b1 << 4) & 0x30) | (b2 >> 4)];
+ res [outputOffset+2] = lookup [(b2 << 2) & 0x3c];
+
+ // one-byte padding
+ res [outputOffset+3] = (byte)'=';
+ break;
+
+ default:
+ break;
+ }
+
+ return res;
+ }
+
+
+
+ /// <summary>
+ /// </summary>
+ public override string ToString ()
+ {
+ return "mono::System.Security.Cryptography.ToBase64Transform";
+ }
+
+ } // ToBase64Transform
+
+
+
+
+ [MonoTODO ("Put me in a separate file")]
+ internal sealed class Base64Table {
+
+ // This is the Base64 alphabet as described in RFC 2045
+ // (Table 1, page 25).
+ private static string ALPHABET =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+ private static byte[] encodeTable;
+ private static byte[] decodeTable;
+
+
+ static Base64Table ()
+ {
+ int len = ALPHABET.Length;
+
+ encodeTable = new byte [len];
+
+ for (int i=0; i < len; i++) {
+ encodeTable [i] = (byte) ALPHABET [i];
+ }
+
+
+ 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;
+ }
+ }
+
+
+ private Base64Table ()
+ {
+ // Never instantiated.
+ }
+
+
+ internal static byte [] EncodeTable {
+ get {
+ return encodeTable;
+ }
+ }
+
+ internal static byte [] DecodeTable {
+ get {
+ return decodeTable;
+ }
+ }
+
+ } // Base64Table
+
+} // System.Security.Cryptography
diff --git a/mcs/class/corlib/System.Security.Cryptography/X509Certificates.cs b/mcs/class/corlib/System.Security.Cryptography/X509Certificates.cs
new file mode 100755
index 00000000000..342b0cacf31
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Cryptography/X509Certificates.cs
@@ -0,0 +1,10 @@
+using System.Security.Cryptography;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+ [Serializable]
+ public class X509Certificate {
+ internal X509Certificate () {}
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Permissions/ChangeLog b/mcs/class/corlib/System.Security.Permissions/ChangeLog
new file mode 100644
index 00000000000..bb38b4adff4
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/ChangeLog
@@ -0,0 +1,68 @@
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * SiteIdentityPermissionAttribute.cs:
+ * UIPermissionAttribute.cs: These should inherit from
+ CodeAccessSecurityAttribute, not IsolatedStoragePermissionAttribute.
+
+2002-02-17 Duncan Mak <duncan@ximian.com>
+
+ * FileDialogPermissionAccess.cs: Add in namespace declaration, so
+ that this one little unique enum wouldn't show up in the System
+ namespace when we ildasm corlib.dll ;-) Oops, my bad.
+
+2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * SecurityPermission.cs,
+ IsolatedStoragePermissionAttribute.cs: New files
+
+2002-01-23 Duncan Mak <duncan@ximian.com>
+
+ * FileDialogPermissionAccess.cs: Add to CVS.
+
+2002-01-20 Duncan Mak <duncan@ximian.com>
+
+ * *Attribute.cs: Implemented all the properties in the attributes
+ and removed the relevent MonoTODO attributes.
+
+ * *Attribute.cs: Fixed indentation.
+
+2002-01-18 Duncan Mak <duncan@ximian.com>
+
+ * EnvironmentPermissionAttribute.cs:
+ * FileDialogPermissionAttribute.cs:
+ * FileIOPermissionAttribute.cs:
+ * IsolatedStorageAttribute.cs:
+ * IsolatedStorageFilePermissionAttribute.cs:
+ * PermissionSetAttribute.cs:
+ * PrinciplePermissionAttribute.cs:
+ * ReflectionPermissionAttribute.cs:
+ * RegistryPermissionAttribute.cs:
+ * SiteIdentityPermissionAttribute.cs:
+ * StrongNamePermissionAttribute.cs:
+ * UIPermissionAttribute.cs:
+ * UrlIdentityPermissionAttribute.cs:
+ * ZoneIdentityPermissionAttribute.cs: New files. Stubbed out with MonoTODOs
+
+ * Note: These are all the Attributes in the
+ System.Security.Permissions namespace. The only missing one is
+ PublishIdentityPermissionAttribute.cs because we don't have
+ anything for the X509Certificate class.
+
+2002-01-14 Nick Drochak <ndrochak@gol.com>
+
+ * FileIOPermission.cs: New file. Implemented.
+
+2002-01-08 Nick Drochak <ndrochak@gol.com>
+
+ * CodeAccessSecurityAttribute.cs, SecurityAttribute.cs,
+ SecurityPermissionAttribute.cs: New Files
+
+ * SecurityPermissionFlag.cs: Add missing enum values
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * IUnrestrictedPermission.cs: Added missing interface class
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * EnvironmentPermissionAccess.cs, FileIOPermissionAccess.cs, ReflectionPermissionFlag.cs: Add.
diff --git a/mcs/class/corlib/System.Security.Permissions/CodeAccessSecurityAttribute.cs b/mcs/class/corlib/System.Security.Permissions/CodeAccessSecurityAttribute.cs
new file mode 100644
index 00000000000..ced28962930
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/CodeAccessSecurityAttribute.cs
@@ -0,0 +1,33 @@
+//------------------------------------------------------------------------------
+//
+// System.Security.Permissions.SecurityPermissionAttribute.cs
+//
+// Copyright (C) 2001 Nick Drochak, All Rights Reserved
+//
+// Author: Nick Drochak, ndrochak@gol.com
+// Created: 2002-01-06
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [System.AttributeUsage(
+ System.AttributeTargets.Assembly
+ | System.AttributeTargets.Class
+ | System.AttributeTargets.Struct
+ | System.AttributeTargets.Constructor
+ | System.AttributeTargets.Method,
+ AllowMultiple=true,
+ Inherited=false)
+ ]
+ [Serializable]
+ public abstract class CodeAccessSecurityAttribute : SecurityAttribute {
+
+ public CodeAccessSecurityAttribute(SecurityAction action) : base(action) {}
+
+ } // public abstract class CodeAccessSecurityAttribute
+} // namespace System.Security.Permissions
+
diff --git a/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAccess.cs b/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAccess.cs
new file mode 100644
index 00000000000..06517ebc7c6
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAccess.cs
@@ -0,0 +1,38 @@
+// EnvironmentPermissionAccess.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:29:59 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum EnvironmentPermissionAccess {
+
+ /// <summary>
+ /// </summary>
+ NoAccess = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ Read = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ Write = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ AllAccess = Read | Write,
+ } // EnvironmentPermissionAccess
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAttribute.cs
new file mode 100644
index 00000000000..3b16e90eb16
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/EnvironmentPermissionAttribute.cs
@@ -0,0 +1,53 @@
+//
+// System.Security.Permissions.EnvironmentPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class EnvironmentPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string all;
+ private string read;
+ private string write;
+
+ // Constructor
+ public EnvironmentPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public string All
+ {
+ set { all = value; }
+ }
+
+ public string Read
+ {
+ get { return read; }
+ set { read = value; }
+ }
+
+ public string Write
+ {
+ get { return write; }
+ set { write = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAccess.cs b/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAccess.cs
new file mode 100644
index 00000000000..d2196cba0b3
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAccess.cs
@@ -0,0 +1,21 @@
+//
+// System.Security.Permissions.FileDialogPermissionAccess
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System.Security.Permissions
+{
+ [Flags] [Serializable]
+ public enum FileDialogPermissionAccess
+ {
+ None = 0,
+ Open = 1,
+ Save = 2,
+ OpenSave = 3,
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAttribute.cs
new file mode 100644
index 00000000000..58ee4a5fe0a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/FileDialogPermissionAttribute.cs
@@ -0,0 +1,47 @@
+//
+// System.Security.Permissions.FileDialogPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class FileDialogPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private bool canOpen;
+ private bool canSave;
+
+ // Constructor
+ public FileDialogPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public bool Open
+ {
+ get { return canOpen; }
+ set { canOpen = value; }
+ }
+
+ public bool Save
+ {
+ get { return canSave; }
+ set { canSave = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs b/mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs
new file mode 100644
index 00000000000..57a7ede89bc
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs
@@ -0,0 +1,411 @@
+//------------------------------------------------------------------------------
+//
+// System.Security.Permissions.FileIOPermission.cs
+//
+// Copyright (C) 2001 Nick Drochak, All Rights Reserved
+//
+// Author: Nick Drochak, ndrochak@gol.com
+// Created: 2002-01-09
+//
+//------------------------------------------------------------------------------
+
+using System.Collections;
+using System.Text;
+using System.Security.Permissions;
+using System.IO;
+
+namespace System.Security.Permissions {
+
+ [SerializableAttribute()]
+ public sealed class FileIOPermission : CodeAccessPermission, IUnrestrictedPermission {
+
+ private static char[] m_badCharacters = {'\"','<', '>', '|', '*', '?'};
+ private bool m_Unrestricted = false;
+ private Hashtable m_PathList = new Hashtable();
+ private FileIOPermissionAccess m_AllFilesAccess = FileIOPermissionAccess.NoAccess;
+ private FileIOPermissionAccess m_AllLocalFilesAccess = FileIOPermissionAccess.NoAccess;
+
+ public FileIOPermission(PermissionState state) {
+ if (!Enum.IsDefined(typeof(PermissionState), state)){
+ throw new ArgumentException("Invalid permission state.", "state");
+ }
+ m_Unrestricted = (PermissionState.Unrestricted == state);
+ if (m_Unrestricted) {
+ m_AllFilesAccess = FileIOPermissionAccess.AllAccess;
+ m_AllLocalFilesAccess = FileIOPermissionAccess.AllAccess;
+ }
+ }
+
+ public FileIOPermission(FileIOPermissionAccess access, string path){
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
+ }
+
+ if (path.LastIndexOfAny(m_badCharacters) >= 0){
+ throw new ArgumentException("Illegal characters found in input. Security checks can not contain wild card characters.", "path");
+ }
+
+ AddPathList(access, path);
+ }
+
+ public FileIOPermission(FileIOPermissionAccess access, string[] pathList){
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
+ }
+
+ AddPathList(access, pathList);
+ }
+
+ public FileIOPermissionAccess AllFiles {
+ get {
+ return m_AllFilesAccess;
+ }
+ set {
+ // if we are already set to unrestricted, don't change this property
+ if (!m_Unrestricted){
+ m_AllFilesAccess = value;
+ }
+ }
+ }
+
+ public FileIOPermissionAccess AllLocalFiles {
+ get {
+ return m_AllLocalFilesAccess;
+ }
+ set {
+ // if we are already set to unrestricted, don't change this property
+ if (!m_Unrestricted){
+ m_AllLocalFilesAccess = value;
+ }
+ }
+ }
+
+ public void AddPathList(FileIOPermissionAccess access, string path){
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: {0}.",access.ToString());
+ }
+
+ if (path.LastIndexOfAny(m_badCharacters) >= 0){
+ throw new ArgumentException("Invalid characters in path: '{0}'", path);
+ }
+
+ // LAMESPEC: docs don't say it must be a rooted path, but the MS implementation enforces it, so we will too.
+ if(!Path.IsPathRooted(path)) {
+ throw new ArgumentException("Absolute path information is required.");
+ }
+
+ // don't add the same path twice, instead overwrite access entry for that path
+ if (m_PathList.ContainsKey(path)) {
+ FileIOPermissionAccess currentPermission = (FileIOPermissionAccess)m_PathList[path];
+ currentPermission |= access;
+ m_PathList[path] = currentPermission;
+ }
+ else {
+ m_PathList.Add(path, access);
+ }
+ }
+
+ public void AddPathList(FileIOPermissionAccess access, string[] pathList ){
+ foreach(string path in pathList){
+ AddPathList(access, path);
+ }
+
+ }
+
+ // private constructor used by Copy() method
+ private FileIOPermission(Hashtable pathList, FileIOPermissionAccess allFiles,
+ FileIOPermissionAccess allLocalFiles, bool unrestricted){
+ m_PathList = pathList;
+ m_AllFilesAccess = allFiles;
+ m_AllLocalFilesAccess = allLocalFiles;
+ m_Unrestricted = unrestricted;
+ }
+
+ public override IPermission Copy(){
+ if (m_Unrestricted) {
+ return new FileIOPermission(PermissionState.Unrestricted);
+ }
+ else{
+ FileIOPermission retVal = new FileIOPermission(m_PathList, m_AllFilesAccess, m_AllLocalFilesAccess, m_Unrestricted);
+ return retVal;
+ }
+ }
+
+ /* XML Schema for FileIOPermission
+ <IPermission class=”FileIOPermission”
+ version=”1”
+ (
+ Read=”[list of files or folders]” |
+ Write=”[list of files or folders]” |
+ Append=”[list of files or folders]”
+ ) v Unrestricted=”true”
+ />
+ */
+ public override void FromXml(SecurityElement esd){
+ if (null == esd) {
+ throw new ArgumentNullException();
+ }
+ if (esd.Tag != "IPermission" || (string)esd.Attributes["class"] != "FileIOPermission"
+ || (string)esd.Attributes["version"] != "1"){
+ throw new ArgumentException("Not a valid permission element");
+ }
+ m_PathList.Clear();
+ if ("true" == (string)esd.Attributes["Unrestricted"]){
+ m_Unrestricted = true;
+ }
+ else{
+ m_Unrestricted = false;
+ string fileList;
+ fileList = (string)esd.Attributes["Read"];
+ string[] files;
+ if (fileList != null){
+ files = fileList.Split(';');
+ AddPathList(FileIOPermissionAccess.Read, files);
+ }
+ fileList = (string)esd.Attributes["Write"];
+ if (fileList != null){
+ files = fileList.Split(';');
+ AddPathList(FileIOPermissionAccess.Write, files);
+ }
+ fileList = (string)esd.Attributes["Append"];
+ if (fileList != null){
+ files = fileList.Split(';');
+ AddPathList(FileIOPermissionAccess.Append, files);
+ }
+ }
+ }
+
+ public string[] GetPathList(FileIOPermissionAccess access){
+ //LAMESPEC: docs says it returns (semicolon separated) list, but return
+ //type is array. I think docs are wrong and it just returns an array
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
+ }
+
+ ArrayList matchingPaths = new ArrayList();
+ System.Collections.IDictionaryEnumerator pathListIterator = m_PathList.GetEnumerator();
+ while (pathListIterator.MoveNext()) {
+ if (((FileIOPermissionAccess)pathListIterator.Value & access) != 0) {
+ matchingPaths.Add((string)pathListIterator.Key);
+ }
+ }
+ if (matchingPaths.Count == 0) {
+ return null;
+ }
+ else {
+ return (string[])matchingPaths.ToArray(typeof(string));
+ }
+ }
+
+ public override IPermission Intersect(IPermission target){
+ if (null == target){
+ return null;
+ }
+ else {
+ if (target.GetType() != typeof(FileIOPermission)){
+ throw new ArgumentException();
+ }
+ }
+ FileIOPermission FIOPTarget = (FileIOPermission)target;
+ if (FIOPTarget.IsUnrestricted() && m_Unrestricted){
+ return new FileIOPermission(PermissionState.Unrestricted);
+ }
+ else if (FIOPTarget.IsUnrestricted()){
+ return Copy();
+ }
+ else if (m_Unrestricted){
+ return FIOPTarget.Copy();
+ }
+ else{
+ FileIOPermission retVal = new FileIOPermission(PermissionState.None);
+ retVal.AllFiles = m_AllFilesAccess & FIOPTarget.AllFiles;
+ retVal.AllLocalFiles = m_AllLocalFilesAccess & FIOPTarget.AllLocalFiles;
+
+ string[] paths;
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Append);
+ if (null != paths) {
+ foreach (string path in paths){
+ if (m_PathList.ContainsKey(path)
+ && ((FileIOPermissionAccess)m_PathList[path] & FileIOPermissionAccess.Append) != 0){
+ retVal.AddPathList(FileIOPermissionAccess.Append, path);
+ }
+ }
+ }
+
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Read);
+ if (null != paths) {
+ foreach (string path in paths){
+ if (m_PathList.ContainsKey(path)
+ && ((FileIOPermissionAccess)m_PathList[path] & FileIOPermissionAccess.Read) != 0){
+ retVal.AddPathList(FileIOPermissionAccess.Read, path);
+ }
+ }
+ }
+
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Write);
+ if (null != paths) {
+ foreach (string path in paths){
+ if (m_PathList.ContainsKey(path)
+ && ((FileIOPermissionAccess)m_PathList[path] & FileIOPermissionAccess.Write) != 0){
+ retVal.AddPathList(FileIOPermissionAccess.Write, path);
+ }
+ }
+ }
+
+ return retVal;
+ }
+ }
+
+
+ public override bool IsSubsetOf(IPermission target){
+ // X.IsSubsetOf(Y) is true if permission Y includes everything allowed by X.
+ if (target != null && target.GetType() != typeof(FileIOPermission)){
+ throw new ArgumentException();
+ }
+ FileIOPermission FIOPTarget = (FileIOPermission)target;
+ if (FIOPTarget.IsUnrestricted()){
+ return true;
+ }
+ else if (m_Unrestricted){
+ return false;
+ }
+ else if ((m_AllFilesAccess & FIOPTarget.AllFiles) != m_AllFilesAccess) {
+ return false;
+ }
+ else if ((m_AllLocalFilesAccess & FIOPTarget.AllLocalFiles) != m_AllLocalFilesAccess) {
+ return false;
+ }
+ else{
+ string[] pathsNeeded;
+ string[] pathsInTarget;
+
+ pathsNeeded = GetPathList(FileIOPermissionAccess.Append);
+ if (null != pathsNeeded) {
+ pathsInTarget = FIOPTarget.GetPathList(FileIOPermissionAccess.Append);
+ foreach (string path in pathsNeeded){
+ if (Array.IndexOf(pathsInTarget, path) <0) {
+ return false;
+ }
+ }
+ }
+
+ pathsNeeded = GetPathList(FileIOPermissionAccess.Read);
+ if (null != pathsNeeded) {
+ pathsInTarget = FIOPTarget.GetPathList(FileIOPermissionAccess.Read);
+ foreach (string path in pathsNeeded){
+ if (Array.IndexOf(pathsInTarget, path) <0) {
+ return false;
+ }
+ }
+ }
+
+ pathsNeeded = GetPathList(FileIOPermissionAccess.Write);
+ if (null != pathsNeeded) {
+ pathsInTarget = FIOPTarget.GetPathList(FileIOPermissionAccess.Write);
+ foreach (string path in pathsNeeded){
+ if (Array.IndexOf(pathsInTarget, path) <0) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+
+ public bool IsUnrestricted(){
+ return m_Unrestricted;
+ }
+
+ public void SetPathList(FileIOPermissionAccess access, string path){
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
+ }
+ if (path.LastIndexOfAny(m_badCharacters) >= 0){
+ throw new ArgumentException("Invalid characters in path: '{0}'", path);
+ }
+
+ m_PathList.Clear();
+ AddPathList(access, path);
+ }
+
+ public void SetPathList(FileIOPermissionAccess access, string[] pathList){
+ if ((FileIOPermissionAccess.AllAccess & access) != access){
+ throw new ArgumentException("Illegal enum value: "+access.ToString()+".");
+ }
+ foreach(string path in pathList){
+ if (path.LastIndexOfAny(m_badCharacters) >= 0){
+ throw new ArgumentException("Invalid characters in path entry: '{0}'", path);
+ }
+ }
+
+ m_PathList.Clear();
+ AddPathList(access, pathList);
+ }
+
+ public override SecurityElement ToXml(){
+ //Encode the the current permission to XML using the
+ //security element class.
+ SecurityElement element = new SecurityElement("IPermission");
+ Type type = this.GetType();
+ StringBuilder AsmName = new StringBuilder(type.Assembly.ToString());
+ AsmName.Replace('\"', '\'');
+ element.AddAttribute("class", type.FullName + ", " + AsmName);
+ element.AddAttribute("version", "1");
+ if(m_Unrestricted){
+ element.AddAttribute("Unrestricted", "true");
+ }
+ else {
+ string[] paths;
+ paths = GetPathList(FileIOPermissionAccess.Append);
+ if (null != paths && paths.Length >0){
+ element.AddAttribute("Append", String.Join(";",paths));
+ }
+ paths = GetPathList(FileIOPermissionAccess.Read);
+ if (null != paths && paths.Length >0){
+ element.AddAttribute("Read", String.Join(";",paths));
+ }
+ paths = GetPathList(FileIOPermissionAccess.Write);
+ if (null != paths && paths.Length >0){
+ element.AddAttribute("Write", String.Join(";",paths));
+ }
+ }
+ return element;
+ }
+
+ public override IPermission Union(IPermission other){
+ if (null == other){
+ return null;
+ }
+ else {
+ if (other.GetType() != typeof(FileIOPermission)){
+ throw new ArgumentException();
+ }
+ }
+ FileIOPermission FIOPTarget = (FileIOPermission)other;
+ if (FIOPTarget.IsUnrestricted() || m_Unrestricted){
+ return new FileIOPermission(PermissionState.Unrestricted);
+ }
+ else{
+ FileIOPermission retVal = (FileIOPermission)Copy();
+ retVal.AllFiles |= FIOPTarget.AllFiles;
+ retVal.AllLocalFiles |= FIOPTarget.AllLocalFiles;
+ string[] paths;
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Append);
+ if (null != paths){
+ retVal.AddPathList(FileIOPermissionAccess.Append, paths);
+ }
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Read);
+ if (null != paths){
+ retVal.AddPathList(FileIOPermissionAccess.Read, paths);
+ }
+ paths = FIOPTarget.GetPathList(FileIOPermissionAccess.Write);
+ if (null != paths){
+ retVal.AddPathList(FileIOPermissionAccess.Write, paths);
+ }
+ return retVal;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAccess.cs b/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAccess.cs
new file mode 100644
index 00000000000..dd255cd3b1c
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAccess.cs
@@ -0,0 +1,46 @@
+// FileIOPermissionAccess.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:30:11 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum FileIOPermissionAccess {
+
+ /// <summary>
+ /// </summary>
+ NoAccess = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ Read = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ Write = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ Append = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ PathDiscovery = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ AllAccess = Read | Write | Append | PathDiscovery,
+ } // FileIOPermissionAccess
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAttribute.cs
new file mode 100644
index 00000000000..64540caf30a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/FileIOPermissionAttribute.cs
@@ -0,0 +1,68 @@
+//
+// System.Security.Permissions.FileIOPermissionAttribute.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class FileIOPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string all;
+ private string append;
+ private string path;
+ private string read;
+ private string write;
+
+ // Constructor
+ public FileIOPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public string All
+ {
+ set { all = value; }
+ }
+
+ public string Append
+ {
+ get { return append; }
+ set { append = value; }
+ }
+
+ public string PathDiscovery
+ {
+ get { return path; }
+ set { path = value; }
+ }
+
+ public string Read
+ {
+ get { return read; }
+ set { read = value; }
+ }
+
+ public string Write
+ {
+ get { return write; }
+ set { write = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/IUnrestrictedPermission.cs b/mcs/class/corlib/System.Security.Permissions/IUnrestrictedPermission.cs
new file mode 100644
index 00000000000..f9b6b9eae0e
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/IUnrestrictedPermission.cs
@@ -0,0 +1,15 @@
+//
+// System.Security.Permissions.IUnrestrictedPermission.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security.Permissions {
+
+ public interface IUnrestrictedPermission {
+ bool IsUnrestricted();
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/IsolatedStorageContainment.cs b/mcs/class/corlib/System.Security.Permissions/IsolatedStorageContainment.cs
new file mode 100755
index 00000000000..d4cedbf9d4f
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/IsolatedStorageContainment.cs
@@ -0,0 +1,56 @@
+// IsolatedStorageContainment.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:41:57 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ [MonoTODO ("These values are WRONG!!!, and incomplete")]
+ /// <summary>
+ /// </summary>
+ public enum IsolatedStorageContainment {
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// </summary>
+ DomainIsolationByUser = 1,
+
+ /// <summary>
+ /// </summary>
+ AssemblyIsolationByUser = 2,
+
+ /// <summary>
+ /// </summary>
+ AdministerIsolatedStorageByUser = 5,
+
+ /// <summary>
+ /// </summary>
+ UnrestrictedIsolatedStorage = 7,
+ } // IsolatedStorageContainment
+
+/* here are the correct ones (from msdn)
+ [Serializable]
+ public enum IsolatedStorageContainment
+ {
+ None = 0x00,
+ DomainIsolationByUser = 0x10,
+ AssemblyIsolationByUser = 0x20,
+ DomainIsolationByRoamingUser = 0x50,
+ AssemblyIsolationByRoamingUser = 0x60,
+ AdministerIsolatedStorageByUser = 0x70,
+ UnrestrictedIsolatedStorage = 0xF0,
+ };
+*/
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.cs
new file mode 100644
index 00000000000..a9a879f06fc
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.cs
@@ -0,0 +1,34 @@
+//
+// System.Security.Permissions.IsolatedStorageFilePermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class IsolatedStorageFilePermissionAttribute : IsolatedStoragePermissionAttribute
+ {
+ // Constructor
+ public IsolatedStorageFilePermissionAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermission.cs b/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermission.cs
new file mode 100644
index 00000000000..907d7de3615
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermission.cs
@@ -0,0 +1,84 @@
+//
+// System.Security.Permissions.IsolatedStoragePermission.cs
+//
+// Piers Haken <piersh@friskit.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [Serializable]
+ public abstract class IsolatedStoragePermission : CodeAccessPermission, IUnrestrictedPermission
+ {
+ internal long m_userQuota;
+ internal long m_machineQuota;
+ internal long m_expirationDays;
+ internal bool m_permanentData;
+ internal IsolatedStorageContainment m_allowed;
+
+ public IsolatedStoragePermission (PermissionState state)
+ {
+ if (state == PermissionState.None)
+ {
+ m_userQuota = 0;
+ m_machineQuota = 0;
+ m_expirationDays = 0;
+ m_permanentData = false;
+ m_allowed = IsolatedStorageContainment.None;
+ }
+ else if (state == PermissionState.Unrestricted)
+ {
+ m_userQuota = Int64.MaxValue;
+ m_machineQuota = Int64.MaxValue;
+ m_expirationDays = Int64.MaxValue ;
+ m_permanentData = true;
+ m_allowed = IsolatedStorageContainment.UnrestrictedIsolatedStorage;
+ }
+ else
+ {
+ throw new ArgumentException("Invalid Permission state");
+ }
+ }
+
+ public long UserQuota
+ {
+ set { m_userQuota = value; }
+ get { return m_userQuota; }
+ }
+
+
+ public IsolatedStorageContainment UsageAllowed
+ {
+ set { m_allowed = value; }
+ get { return m_allowed; }
+ }
+
+
+ public bool IsUnrestricted ()
+ {
+ return IsolatedStorageContainment.UnrestrictedIsolatedStorage == m_allowed;
+ }
+
+ [MonoTODO]
+ public override SecurityElement ToXml ()
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ [MonoTODO]
+ public override void FromXml (SecurityElement esd)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
+
+
+
+
+
diff --git a/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermissionAttribute.cs
new file mode 100644
index 00000000000..21563b6b516
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/IsolatedStoragePermissionAttribute.cs
@@ -0,0 +1,44 @@
+//
+// System.Security.Permissions.IsolatedStoragePermissionAttributes.cs
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions {
+
+ [AttributeUsage ( AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public abstract class IsolatedStoragePermissionAttribute : CodeAccessSecurityAttribute {
+
+ public IsolatedStoragePermissionAttribute (SecurityAction action) : base (action) {
+ }
+
+ public IsolatedStorageContainment UsageAllowed {
+ get { return usage_allowed; }
+ set { usage_allowed = value; }
+ }
+
+ public long UserQuota {
+ get { return user_quota; }
+ set { user_quota = value; }
+ }
+
+ [MonoTODO]
+ public override IPermission CreatePermission () {
+ return null;
+ }
+
+ // private
+
+ private IsolatedStorageContainment usage_allowed;
+ private long user_quota;
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs b/mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs
new file mode 100644
index 00000000000..ee654f7e00b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/PermissionSetAttribute.cs
@@ -0,0 +1,69 @@
+//
+// System.Security.Permissions.PermissionSetAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class PermissionSetAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string file;
+ private string name;
+ private bool isUnicodeEncoded;
+ private string xml;
+
+ // Constructor
+ public PermissionSetAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ // Properties
+ public string File
+ {
+ get { return file; }
+ set { file = value; }
+ }
+
+ public string Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public bool UnicodeEncoded
+ {
+ get { return isUnicodeEncoded; }
+ set { isUnicodeEncoded = value; }
+ }
+
+ public string XML
+ {
+ get { return xml; }
+ set { xml = value; }
+ }
+
+ // Methods
+ public override IPermission CreatePermission ()
+ {
+ return null; // Not used, used for inheritance from SecurityAttribute
+ }
+
+ [MonoTODO]
+ public PermissionSet CreatePermissionSet ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/PermissionState.cs b/mcs/class/corlib/System.Security.Permissions/PermissionState.cs
new file mode 100755
index 00000000000..66c3d03eb6f
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/PermissionState.cs
@@ -0,0 +1,29 @@
+// PermissionState.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:30:05 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ public enum PermissionState {
+
+ /// <summary>
+ /// </summary>
+ Unrestricted = 1,
+
+ /// <summary>
+ /// </summary>
+ None = 0,
+ } // PermissionState
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/PrincipalPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/PrincipalPermissionAttribute.cs
new file mode 100644
index 00000000000..fee707d002d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/PrincipalPermissionAttribute.cs
@@ -0,0 +1,60 @@
+//
+// System.Security.Permissions.PrincipalPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class PrincipalPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private bool authenticated;
+ private string name;
+ private string role;
+
+ // Constructor
+ public PrincipalPermissionAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ // Properties
+ [MonoTODO]
+ public bool Authenticated
+ {
+ get { return authenticated; }
+ set { authenticated = value; }
+ }
+
+ [MonoTODO]
+ public string Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ [MonoTODO]
+ public string Role
+ {
+ get { return role; }
+ set { role = value; }
+ }
+
+ // Method
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionAttribute.cs
new file mode 100644
index 00000000000..b7a94b4c29d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionAttribute.cs
@@ -0,0 +1,61 @@
+//
+// System.Security.Permissions.ReflectionPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class ReflectionPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private ReflectionPermissionFlag flags;
+ private bool memberAccess;
+ private bool reflectionEmit;
+ private bool typeInfo;
+
+ //Constructor
+ public ReflectionPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public ReflectionPermissionFlag Flags
+ {
+ get { return flags; }
+ set { flags = value; }
+ }
+
+ public bool MemberAccess
+ {
+ get { return memberAccess; }
+ set { memberAccess = value; }
+ }
+
+ public bool ReflectionEmit
+ {
+ get { return reflectionEmit; }
+ set { reflectionEmit = value; }
+ }
+
+ public bool TypeInformation
+ {
+ get { return typeInfo; }
+ set { typeInfo = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionFlag.cs b/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionFlag.cs
new file mode 100644
index 00000000000..bb0414a22d9
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/ReflectionPermissionFlag.cs
@@ -0,0 +1,38 @@
+// ReflectionPermissionFlag.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:31:14 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ReflectionPermissionFlag {
+
+ /// <summary>
+ /// </summary>
+ NoFlags = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ TypeInformation = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ MemberAccess = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ AllFlags = TypeInformation | MemberAccess,
+ } // ReflectionPermissionFlag
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAccess.cs b/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAccess.cs
new file mode 100755
index 00000000000..f45f481390a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAccess.cs
@@ -0,0 +1,42 @@
+// RegistryPermissionAccess.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:42:13 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum RegistryPermissionAccess {
+
+ /// <summary>
+ /// </summary>
+ NoAccess = 0,
+
+ /// <summary>
+ /// </summary>
+ Read = 1,
+
+ /// <summary>
+ /// </summary>
+ Write = 2,
+
+ /// <summary>
+ /// </summary>
+ Create = 4,
+
+ /// <summary>
+ /// </summary>
+ AllAccess = 7,
+ } // RegistryPermissionAccess
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAttribute.cs
new file mode 100644
index 00000000000..3ab3eeb160d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/RegistryPermissionAttribute.cs
@@ -0,0 +1,60 @@
+//
+// System.Security.Permissions.RegistryPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class RegistryPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string all;
+ private string create;
+ private string read;
+ private string write;
+
+ // Constructor
+ public RegistryPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public string All
+ {
+ set { all = value; }
+ }
+
+ public string Create
+ {
+ get { return create; }
+ set { create = value; }
+ }
+
+ public string Read
+ {
+ get { return read; }
+ set { read = value; }
+ }
+
+ public string Write
+ {
+ get { return write; }
+ set { write = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/SecurityAction.cs b/mcs/class/corlib/System.Security.Permissions/SecurityAction.cs
new file mode 100755
index 00000000000..7cd81e1c500
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SecurityAction.cs
@@ -0,0 +1,57 @@
+// SecurityAction.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:29:52 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ public enum SecurityAction {
+
+ /// <summary>
+ /// </summary>
+ Demand = 2,
+
+ /// <summary>
+ /// </summary>
+ Assert = 3,
+
+ /// <summary>
+ /// </summary>
+ Deny = 4,
+
+ /// <summary>
+ /// </summary>
+ PermitOnly = 5,
+
+ /// <summary>
+ /// </summary>
+ LinkDemand = 6,
+
+ /// <summary>
+ /// </summary>
+ InheritanceDemand = 7,
+
+ /// <summary>
+ /// </summary>
+ RequestMinimum = 8,
+
+ /// <summary>
+ /// </summary>
+ RequestOptional = 9,
+
+ /// <summary>
+ /// </summary>
+ RequestRefuse = 10,
+ } // SecurityAction
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/SecurityAttribute.cs b/mcs/class/corlib/System.Security.Permissions/SecurityAttribute.cs
new file mode 100644
index 00000000000..d914835f140
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SecurityAttribute.cs
@@ -0,0 +1,59 @@
+//------------------------------------------------------------------------------
+//
+// System.Security.Permissions.SecurityPermissionAttribute.cs
+//
+// Copyright (C) 2001 Nick Drochak, All Rights Reserved
+//
+// Author: Nick Drochak, ndrochak@gol.com
+// Created: 2002-01-06
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions {
+ [System.AttributeUsage(
+ System.AttributeTargets.Assembly
+ | System.AttributeTargets.Class
+ | System.AttributeTargets.Struct
+ | System.AttributeTargets.Constructor
+ | System.AttributeTargets.Method,
+ AllowMultiple=true,
+ Inherited=false)
+ ]
+
+ [Serializable]
+ public abstract class SecurityAttribute : Attribute {
+
+ private SecurityAction m_Action;
+ private bool m_Unrestricted;
+
+ public SecurityAttribute(SecurityAction action) {
+ if (!SecurityAction.IsDefined(typeof(SecurityAction), action)) {
+ throw new System.ArgumentException();
+ }
+ }
+
+ public abstract IPermission CreatePermission();
+
+ public bool Unrestricted {
+ get {
+ return m_Unrestricted;
+ }
+ set {
+ m_Unrestricted = value;
+ }
+ }
+
+ public SecurityAction Action {
+ get {
+ return m_Action;
+ }
+ set {
+ m_Action = value;
+ }
+ }
+ } // public abstract class SecurityAttribute
+} // namespace System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/SecurityPermission.cs b/mcs/class/corlib/System.Security.Permissions/SecurityPermission.cs
new file mode 100644
index 00000000000..9a6a32ab25f
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SecurityPermission.cs
@@ -0,0 +1,66 @@
+//
+// System.Security.Permissions.SecurityPermission.cs
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions {
+
+ [MonoTODO]
+ [Serializable]
+ public sealed class SecurityPermission :
+ CodeAccessPermission, IUnrestrictedPermission
+ {
+ public SecurityPermission (PermissionState state) {
+ this.flags = SecurityPermissionFlag.NoFlags;
+ }
+
+ public SecurityPermission (SecurityPermissionFlag flags) {
+ this.flags = flags;
+ }
+
+ public SecurityPermissionFlag Flags {
+ get { return flags; }
+ set { flags = value; }
+ }
+
+ public bool IsUnrestricted () {
+ return false;
+ }
+
+ public override IPermission Copy () {
+ return null;
+ }
+
+ public override IPermission Intersect (IPermission target) {
+ return null;
+ }
+
+ public override IPermission Union (IPermission target) {
+ return null;
+ }
+
+ public override bool IsSubsetOf (IPermission target) {
+ return false;
+ }
+
+ public override void FromXml (SecurityElement e) {
+ }
+
+ public override SecurityElement ToXml () {
+ return null;
+ }
+
+ // private
+
+ private SecurityPermissionFlag flags;
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/SecurityPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/SecurityPermissionAttribute.cs
new file mode 100644
index 00000000000..868b199f267
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SecurityPermissionAttribute.cs
@@ -0,0 +1,216 @@
+//------------------------------------------------------------------------------
+//
+// System.Security.Permissions.SecurityPermissionAttribute.cs
+//
+// Copyright (C) 2001 Nick Drochak, All Rights Reserved
+//
+// Author: Nick Drochak, ndrochak@gol.com
+// Created: 2002-01-06
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions {
+ [System.AttributeUsage(
+ System.AttributeTargets.Assembly
+ | System.AttributeTargets.Class
+ | System.AttributeTargets.Struct
+ | System.AttributeTargets.Constructor
+ | System.AttributeTargets.Method,
+ AllowMultiple=true,
+ Inherited=false)
+ ]
+ public sealed class SecurityPermissionAttribute : CodeAccessSecurityAttribute {
+ private SecurityPermissionFlag m_Flags = SecurityPermissionFlag.NoFlags;
+
+ public SecurityPermissionAttribute(SecurityAction action) : base(action) {
+ if (!SecurityAction.IsDefined(typeof(SecurityAction), action)) {
+ throw new System.ArgumentException();
+ }
+ }
+
+ public bool Assertion {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.Assertion) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.Assertion;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.Assertion;
+ }
+ }
+ }
+
+ public bool ControlAppDomain {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlAppDomain) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlAppDomain;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlAppDomain;
+ }
+ }
+ }
+
+ public bool ControlDomainPolicy {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlDomainPolicy) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlDomainPolicy;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlDomainPolicy;
+ }
+ }
+ }
+
+ public bool ControlEvidence {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlEvidence) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlEvidence;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlEvidence;
+ }
+ }
+ }
+
+ public bool ControlPolicy {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlPolicy) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlPolicy;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlPolicy;
+ }
+ }
+ }
+
+ public bool ControlPrincipal {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlPrincipal) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlPrincipal;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlPrincipal;
+ }
+ }
+ }
+
+ public bool ControlThread {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.ControlThread) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.ControlThread;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.ControlThread;
+ }
+ }
+ }
+
+ public bool Execution {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.Execution) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.Execution;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.Execution;
+ }
+ }
+ }
+
+ public bool Infrastructure {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.Infrastructure) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.Infrastructure;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.Infrastructure;
+ }
+ }
+ }
+
+ public bool RemotingConfiguration {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.RemotingConfiguration) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.RemotingConfiguration;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.RemotingConfiguration;
+ }
+ }
+ }
+
+ public bool SerializationFormatter {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.SerializationFormatter) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.SerializationFormatter;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.SerializationFormatter;
+ }
+ }
+ }
+
+ public bool SkipVerification {
+ get{
+ return ((m_Flags & SecurityPermissionFlag.SkipVerification) != 0);
+ }
+ set{
+ if (value){
+ m_Flags |= SecurityPermissionFlag.SkipVerification;
+ }
+ else{
+ m_Flags -= SecurityPermissionFlag.SkipVerification;
+ }
+ }
+ }
+
+ public override IPermission CreatePermission() {
+ return new SecurityPermission(m_Flags);
+ }
+
+ public SecurityPermissionFlag Flags {
+ get {
+ return m_Flags;
+ }
+ set {
+ m_Flags = value;
+ }
+ }
+ } // public sealed class SecurityPermissionAttribute
+} // namespace System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/SecurityPermissionFlag.cs b/mcs/class/corlib/System.Security.Permissions/SecurityPermissionFlag.cs
new file mode 100755
index 00000000000..84b561eb48d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SecurityPermissionFlag.cs
@@ -0,0 +1,68 @@
+// SecurityPermissionFlag.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:30:18 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum SecurityPermissionFlag {
+
+ /// <summary>
+ /// </summary>
+ NoFlags = 0x00000000,
+
+ /// <summary>
+ /// </summary>
+ Assertion = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ UnmanagedCode = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ SkipVerification = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ Execution = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ ControlThread = 0x00000010,
+
+ ControlAppDomain = 0x00000020,
+
+ ControlDomainPolicy = 0x00000040,
+
+ ControlEvidence = 0x00000080,
+
+ ControlPolicy = 0x00000100,
+
+ ControlPrincipal = 0x00000200,
+
+ Infrastructure = 0x00000400,
+
+ RemotingConfiguration = 0x00000800,
+
+ SerializationFormatter = 0x00001000,
+
+ /// <summary>
+ /// </summary>
+ AllFlags = Assertion | UnmanagedCode | SkipVerification | Execution | ControlThread
+ | ControlAppDomain | ControlDomainPolicy | ControlEvidence | ControlPolicy
+ | ControlPrincipal | Infrastructure | RemotingConfiguration | SerializationFormatter,
+ } // SecurityPermissionFlag
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/SiteIdentityPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/SiteIdentityPermissionAttribute.cs
new file mode 100644
index 00000000000..d5bbbe06e42
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/SiteIdentityPermissionAttribute.cs
@@ -0,0 +1,43 @@
+//
+// System.Security.Permissions.SiteIdentityPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class SiteIdentityPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string site;
+
+ // Constructor
+ public SiteIdentityPermissionAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ // Properties
+ public string Site
+ {
+ get { return site; }
+ set { site = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/StrongNamePermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/StrongNamePermissionAttribute.cs
new file mode 100644
index 00000000000..6fa4d197bf9
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/StrongNamePermissionAttribute.cs
@@ -0,0 +1,56 @@
+//
+// System.Security.Permissions.StrongNameIdentityPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class StrongNameIdentityPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string name;
+ private string key;
+ private string version;
+
+ // Constructor
+ public StrongNameIdentityPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public string Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public string PublicKey
+ {
+ get { return key; }
+ set { key = value; }
+ }
+
+ public string Version
+ {
+ get { return version; }
+ set { version = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/UIPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/UIPermissionAttribute.cs
new file mode 100644
index 00000000000..6b998eea3b5
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/UIPermissionAttribute.cs
@@ -0,0 +1,48 @@
+//
+// System.Security.Permissions.UIPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class UIPermissionAttribute : CodeAccessSecurityAttribute
+ {
+
+ // Fields
+ private UIPermissionClipboard clipboard;
+ private UIPermissionWindow window;
+
+ // Constructor
+ public UIPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public UIPermissionClipboard Clipboard
+ {
+ get { return clipboard; }
+ set { clipboard = value; }
+ }
+
+ public UIPermissionWindow Window
+ {
+ get { return window; }
+ set { window = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/UIPermissionClipboard.cs b/mcs/class/corlib/System.Security.Permissions/UIPermissionClipboard.cs
new file mode 100755
index 00000000000..6ae9a795dc0
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/UIPermissionClipboard.cs
@@ -0,0 +1,33 @@
+// UIPermissionClipboard.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:42:40 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ public enum UIPermissionClipboard {
+
+ /// <summary>
+ /// </summary>
+ NoClipboard = 0,
+
+ /// <summary>
+ /// </summary>
+ OwnClipboard = 1,
+
+ /// <summary>
+ /// </summary>
+ AllClipboard = 2,
+ } // UIPermissionClipboard
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/UIPermissionWindow.cs b/mcs/class/corlib/System.Security.Permissions/UIPermissionWindow.cs
new file mode 100755
index 00000000000..4d65080e744
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/UIPermissionWindow.cs
@@ -0,0 +1,37 @@
+// UIPermissionWindow.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:42:30 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Security.Permissions {
+
+
+ /// <summary>
+ /// </summary>
+ public enum UIPermissionWindow {
+
+ /// <summary>
+ /// </summary>
+ NoWindows = 0,
+
+ /// <summary>
+ /// </summary>
+ SafeSubWindows = 1,
+
+ /// <summary>
+ /// </summary>
+ SafeTopLevelWindows = 2,
+
+ /// <summary>
+ /// </summary>
+ AllWindows = 3,
+ } // UIPermissionWindow
+
+} // System.Security.Permissions
diff --git a/mcs/class/corlib/System.Security.Permissions/UrlIdentityPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/UrlIdentityPermissionAttribute.cs
new file mode 100644
index 00000000000..29f4006cdc3
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/UrlIdentityPermissionAttribute.cs
@@ -0,0 +1,40 @@
+//
+// System.Security.Permissions.UrlIdentityPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class UrlIdentityPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private string url;
+
+ // Constructor
+ public UrlIdentityPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public string Url
+ {
+ get { return url; }
+ set { url = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermissionAttribute.cs b/mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermissionAttribute.cs
new file mode 100644
index 00000000000..48b97970ac2
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Permissions/ZoneIdentityPermissionAttribute.cs
@@ -0,0 +1,40 @@
+//
+// System.Security.Permissions.ZoneIdentityPermissionAttribute.cs
+//
+// Duncan Mak <duncan@ximian.com>
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security.Permissions
+{
+ [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
+ AttributeTargets.Struct | AttributeTargets.Constructor |
+ AttributeTargets.Method)]
+ [Serializable]
+ public sealed class ZoneIdentityPermissionAttribute : CodeAccessSecurityAttribute
+ {
+ // Fields
+ private SecurityZone zone;
+
+ // Constructor
+ public ZoneIdentityPermissionAttribute (SecurityAction action) : base (action) {}
+
+ // Properties
+ public SecurityZone Zone
+ {
+ get { return zone; }
+ set { zone = value; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs
new file mode 100755
index 00000000000..858ef857c00
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/AllMembershipCondition.cs
@@ -0,0 +1,86 @@
+//
+// System.Security.Policy.AllMembershipCondition.cs
+//
+// Author:
+// Ajay kumar Dwivedi (adwiv@yahoo.com)
+//
+
+using System;
+using System.Security;
+
+
+namespace System.Security.Policy
+{
+ /// <summary>
+ /// Summary description for AllMembershipCondition.
+ /// </summary>
+ [Serializable]
+ public sealed class AllMembershipCondition : IMembershipCondition,
+ ISecurityEncodable, ISecurityPolicyEncodable
+ {
+ // Tag for Xml Data
+ private static readonly string XmlTag = "IMembershipCondition";
+
+ public AllMembershipCondition()
+ {}
+
+ //Always returns true
+ public bool Check(Evidence evidence)
+ {
+ return true;
+ }
+
+ public IMembershipCondition Copy()
+ {
+ return new AllMembershipCondition();
+ }
+
+ public override bool Equals(object o)
+ {
+ if(o is System.Security.Policy.AllMembershipCondition)
+ return true;
+ return false;
+ }
+
+ public void FromXml(SecurityElement e)
+ {
+ FromXml(e, null);
+ }
+
+ //Fixme: is there a need for all this????
+ public void FromXml(SecurityElement e, PolicyLevel level)
+ {
+ if(e == null)
+ throw new ArgumentNullException("e");
+ if(e.Tag != XmlTag)
+ throw new ArgumentException("e","The Tag of SecurityElement must be "
+ + AllMembershipCondition.XmlTag);
+ }
+
+ //What's the use of a hashcode here. Equals is always true.
+ public override int GetHashCode()
+ {
+ return 0;
+ }
+
+ public override string ToString()
+ {
+ return "All Code";
+ }
+
+ public SecurityElement ToXml()
+ {
+ return ToXml(null);
+ }
+
+ public SecurityElement ToXml(PolicyLevel level)
+ {
+ SecurityElement se = new SecurityElement(XmlTag);
+ Type type = this.GetType();
+ string classString = type.FullName + ", " + type.Assembly;
+ se.AddAttribute("class",classString);
+ se.AddAttribute("version","1");
+ return se;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs
new file mode 100644
index 00000000000..0bae803ce0e
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/ApplicationDirectoryMembershipCondition.cs
@@ -0,0 +1,66 @@
+// System.Security.Policy.ApplicationDirectoryMembershipCondition
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2002 Nick Drochak, All rights reserved.
+
+using System.Security;
+
+namespace System.Security.Policy
+{
+
+ // FIXME: This class is mostly just method stubs.
+
+ [Serializable]
+ public sealed class ApplicationDirectoryMembershipCondition :
+ IMembershipCondition,
+ ISecurityEncodable,
+ ISecurityPolicyEncodable
+ {
+ // Methods
+ [MonoTODO]
+ public bool Check(Evidence evidence) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public IMembershipCondition Copy() {
+ throw new NotImplementedException ();
+ }
+
+ public override bool Equals(object o) {
+ return o is ApplicationDirectoryMembershipCondition;
+ }
+
+ [MonoTODO]
+ public void FromXml(SecurityElement e) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void FromXml(SecurityElement e, PolicyLevel level) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override int GetHashCode() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public override string ToString() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SecurityElement ToXml() {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public SecurityElement ToXml(PolicyLevel level) {
+ throw new NotImplementedException ();
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Policy/ChangeLog b/mcs/class/corlib/System.Security.Policy/ChangeLog
new file mode 100644
index 00000000000..9296cfe6822
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/ChangeLog
@@ -0,0 +1,60 @@
+2002-03-17 Nick Drochak <ndrochak@gol.com>
+
+ * ApplicationDirectoryMembershipCondition.cs: New file (stub)
+
+2002-02-14 Nick Drochak <ndrochak@gol.com>
+
+ * FileCodeGroup.cs: Finish Equals()
+
+2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * PolicyStatement: New file (stub)
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * FileCodeGroup.cs: New file. All done except for GetHashCode and
+ Resolve.
+ * CodeGroup.cs: Fix small bug in ToXml()
+ * Evidence.cs: Added method stub needed by FileCodeGroup.cs. Added
+ MonoTODO's too.
+
+2002-02-07 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroup.cs: Went as far as I can for now. Need to look at
+ the (To|From)XML methods when I understand PolicyLevels better.
+
+2002-02-02 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroup.cs: Not done, but checking in now just in case
+
+2002-01-30 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroup.cs: New file. Not nearly done with this, but saving it
+ in cvs just in case.
+ * PolicyLevel.cs: Sarted just a bit on this then relized i need CodeGroup
+ first (among others). Checking in for disaster recovery.
+
+2002-01-29 Nick Drochak <ndrochak@gol.com>
+
+ * PolicyStatementAttribute.cs: New file.
+ * PolicyException.cs: Use correct namespace
+ * PolicyLevel.cs: Add [Serializable] to class
+
+2002-01-19 Duncan Mak <duncan@ximian.com>
+
+ * PolicyException.cs: New File.
+
+2002-01-03 Nick Drochak <ndrochak@gol.com>
+
+ * IIdentityPermissionFactory.cs: New File
+ * IMembershipCondition: New File
+
+2001-12-29 Nick Drochak <ndrochak@gol.com>
+
+ * PolicyLevel.cs: New file
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * SecurityElement.cs, CodeAccessPermission.cs IPermission.cs
+ IStackWalk.cs SecurityElement.cs ISecurityEncodable.cs: New files.
+
diff --git a/mcs/class/corlib/System.Security.Policy/CodeGroup.cs b/mcs/class/corlib/System.Security.Policy/CodeGroup.cs
new file mode 100644
index 00000000000..f2103476096
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/CodeGroup.cs
@@ -0,0 +1,252 @@
+// System.Security.Policy.CodeGroup
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak, All rights reserved.
+
+using System.Security.Policy;
+using System.Security.Permissions;
+using System.Collections;
+using System; // for MonoTODO attribute
+
+namespace System.Security.Policy
+{
+ [Serializable]
+ public abstract class CodeGroup
+ {
+ PolicyStatement m_policy = null;
+ IMembershipCondition m_membershipCondition = null;
+ string m_description = null;
+ string m_name = null;
+ ArrayList m_children = new ArrayList();
+ PolicyLevel m_level;
+
+ public CodeGroup(IMembershipCondition membershipCondition,
+ PolicyStatement policy)
+ {
+ if (null == membershipCondition)
+ throw new ArgumentNullException("Value cannot be null.");
+ m_policy = policy;
+ m_membershipCondition = membershipCondition;
+ }
+
+ public abstract CodeGroup Copy();
+ public abstract string MergeLogic {get;}
+ public abstract PolicyStatement Resolve( Evidence evidence);
+ public abstract CodeGroup ResolveMatchingCodeGroups(Evidence evidence);
+
+ public PolicyStatement PolicyStatement
+ {
+ get
+ {
+ return m_policy;
+ }
+ set
+ {
+ m_policy = value;
+ }
+ }
+
+ public string Description
+ {
+ get
+ {
+ return m_description;
+ }
+ set
+ {
+ m_description = value;
+ }
+ }
+
+ public IMembershipCondition MembershipCondition
+ {
+ get
+ {
+ return m_membershipCondition;
+ }
+ set
+ {
+ if (null == value)
+ throw new ArgumentException("Value cannot be null");
+ m_membershipCondition = value;
+ }
+ }
+
+ public string Name
+ {
+ get
+ {
+ return m_name;
+ }
+ set
+ {
+ m_name = value;
+ }
+ }
+
+ public IList Children
+ {
+ get
+ {
+ return m_children;
+ }
+ set
+ {
+ if (null == value)
+ throw new ArgumentException("Value cannot be null");
+ m_children = new ArrayList(value);
+ }
+ }
+
+ public virtual string AttributeString
+ {
+ get
+ {
+ if (null != m_policy)
+ return m_policy.AttributeString;
+
+ return null;
+ }
+ }
+
+ public virtual string PermissionSetName
+ {
+ get
+ {
+ if (m_policy.PermissionSet is Security.NamedPermissionSet)
+ return ((NamedPermissionSet)(m_policy.PermissionSet)).Name;
+
+ return null;
+ }
+ }
+
+ public void AddChild(CodeGroup group)
+ {
+ if (null == group)
+ throw new ArgumentNullException("The group parameter cannot be null");
+ m_children.Add(group);
+ }
+
+ public override bool Equals(object o)
+ {
+ if (!(o is CodeGroup))
+ return false;
+
+ return Equals((CodeGroup)o, false);
+ }
+
+ public bool Equals(CodeGroup cg, bool compareChildren)
+ {
+ if (cg.Name != this.Name)
+ return false;
+
+ if (cg.Description != this.Description)
+ return false;
+
+ if (cg.MembershipCondition != this.MembershipCondition)
+ return false;
+
+ if (compareChildren)
+ {
+ int childCount = cg.Children.Count;
+ if (this.Children.Count != childCount)
+ return false;
+
+ 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
+ // we shouldn't
+ if (!((CodeGroup)(this.Children[index])).Equals((CodeGroup)(cg.Children[index]), true))
+ return false;
+ }
+ }
+
+ return true;
+
+ }
+
+ public void RemoveChild(CodeGroup group)
+ {
+ if (!m_children.Contains(group))
+ throw new ArgumentException();
+
+ m_children.Remove(group);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ return 42;
+ }
+
+ public void FromXml(SecurityElement e)
+ {
+ FromXml(e, (PolicyLevel)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;
+ m_membershipCondition = null;
+
+ m_name = e.Attribute("Name");
+ m_description = e.Attribute("Description");
+
+ // seems like we might need this to Resolve() in subclasses
+ m_level = level;
+
+ ParseXml(e, level);
+ }
+
+ protected virtual void ParseXml(SecurityElement e, PolicyLevel level)
+ {
+ }
+
+ public SecurityElement ToXml()
+ {
+ return ToXml(null);
+ }
+
+ [MonoTODO("Not sure what to do with PolicyLevel parameter")]
+ public SecurityElement ToXml(PolicyLevel level)
+ {
+ SecurityElement e = new SecurityElement("CodeGroup");
+ e.AddAttribute("class", this.GetType().AssemblyQualifiedName);
+ e.AddAttribute("version", "1");
+
+ if (null != Name)
+ e.AddAttribute("Name", Name);
+
+ if (null != Description)
+ e.AddAttribute("Description", Description);
+
+ if (null != MembershipCondition)
+ e.AddChild(MembershipCondition.ToXml());
+
+ if (null != PolicyStatement)
+ e.AddChild(PolicyStatement.PermissionSet.ToXml());
+
+ foreach (CodeGroup child in Children)
+ e.AddChild(child.ToXml());
+
+ CreateXml(e, level);
+ return e;
+ }
+
+ protected virtual void CreateXml(SecurityElement element, PolicyLevel level)
+ {
+ }
+ } // public abstract class CodeGroup
+
+} // namespace System.Security.Policy \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security.Policy/Evidence.cs b/mcs/class/corlib/System.Security.Policy/Evidence.cs
new file mode 100644
index 00000000000..701d1d4344d
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/Evidence.cs
@@ -0,0 +1,27 @@
+// System.Security.Policy.Evidence
+//
+// Authors:
+// Sean MacIsaac (macisaac@ximian.com)
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Ximian, Inc.
+
+using System.Collections;
+
+namespace System.Security.Policy
+{
+ [MonoTODO]
+ [Serializable]
+ public sealed class Evidence
+ {
+
+ [MonoTODO]
+ public Evidence () {
+ }
+
+ [MonoTODO]
+ public IEnumerator GetHostEnumerator() {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs b/mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs
new file mode 100644
index 00000000000..debd7d3543a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/FileCodeGroup.cs
@@ -0,0 +1,135 @@
+// System.Security.Policy.FileCodeGroup
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak, All rights reserved.
+
+using System.Security.Policy;
+using System.Security.Permissions;
+using System.Collections;
+using System; // for MonoTODO attribute
+
+namespace System.Security.Policy
+{
+ [Serializable]
+ public sealed class FileCodeGroup : CodeGroup
+ {
+ FileIOPermissionAccess m_access;
+
+ [MonoTODO("Check if membershipCondition is valid")]
+ public FileCodeGroup(IMembershipCondition membershipCondition,
+ FileIOPermissionAccess access)
+ : base(membershipCondition, null)
+ {
+ if (!Enum.IsDefined(typeof(FileIOPermissionAccess), access))
+ throw new ArgumentException("Value not defined for FileIOPermissionAccess","access");
+
+ m_access = access;
+ }
+
+ public override CodeGroup Copy()
+ {
+ FileCodeGroup copy = new FileCodeGroup(MembershipCondition, m_access);
+ foreach (CodeGroup child in Children)
+ {
+ AddChild(child.Copy());
+ }
+
+ return copy;
+ }
+
+ public override string MergeLogic
+ {
+ get
+ {
+ return "Union";
+ }
+ }
+
+ [MonoTODO]
+ public override PolicyStatement Resolve( Evidence evidence)
+ {
+ if (null == evidence)
+ throw new ArgumentNullException("evidence");
+
+ if (null == PolicyStatement)
+ throw new PolicyException();
+
+ if (!MembershipCondition.Check(evidence))
+ return null;
+
+ IEnumerator hostEnumerator = evidence.GetHostEnumerator();
+ while (hostEnumerator.MoveNext())
+ {
+ // FIXME: not sure what to do here
+ // How do we check the URL and make a PolicyStatement?
+ }
+ throw new NotImplementedException();
+ }
+
+ public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
+ {
+ if (null == evidence)
+ throw new ArgumentNullException("evidence");
+
+ if (!MembershipCondition.Check(evidence))
+ return null;
+
+ FileCodeGroup matchRoot = new FileCodeGroup(MembershipCondition, m_access);
+
+ foreach (CodeGroup child in Children)
+ {
+ CodeGroup childMatchingCodeGroup = child.ResolveMatchingCodeGroups(evidence);
+ if (childMatchingCodeGroup != null)
+ AddChild(childMatchingCodeGroup);
+ }
+
+ return matchRoot;
+ }
+
+ public override string AttributeString
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public override string PermissionSetName
+ {
+ get
+ {
+ return "Same directory FileIO - " + m_access.ToString();
+ }
+ }
+
+ public override bool Equals(object o)
+ {
+ if (!(o is FileCodeGroup))
+ return false;
+
+ if (this.m_access != ((FileCodeGroup)o).m_access)
+ return false;
+
+ return Equals((CodeGroup)o, false);
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ throw new NotImplementedException();
+ }
+
+ protected override void ParseXml(SecurityElement e, PolicyLevel level)
+ {
+ m_access = (FileIOPermissionAccess)Enum.Parse(typeof(FileIOPermissionAccess), e.Attribute("Access"), true);
+ }
+
+ protected override void CreateXml(SecurityElement element, PolicyLevel level)
+ {
+ 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/IIdentityPermissionFactory.cs b/mcs/class/corlib/System.Security.Policy/IIdentityPermissionFactory.cs
new file mode 100644
index 00000000000..5b82d9d934a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/IIdentityPermissionFactory.cs
@@ -0,0 +1,13 @@
+// System.Security.Policy.IIdentityPermissionFactory
+//
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak
+
+namespace System.Security.Policy
+{
+ public interface IIdentityPermissionFactory
+ {
+ IPermission CreateIdentityPermission(Evidence evidence);
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/IMembershipCondition.cs b/mcs/class/corlib/System.Security.Policy/IMembershipCondition.cs
new file mode 100644
index 00000000000..030e1b1d283
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/IMembershipCondition.cs
@@ -0,0 +1,17 @@
+// System.Security.Policy.IMembershipCondition.cs
+//
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak
+
+namespace System.Security.Policy
+{
+ public interface IMembershipCondition : ISecurityEncodable,
+ ISecurityPolicyEncodable
+ {
+ bool Check(Evidence evidence);
+ IMembershipCondition Copy();
+ string ToString();
+ }
+}
+
diff --git a/mcs/class/corlib/System.Security.Policy/PolicyException.cs b/mcs/class/corlib/System.Security.Policy/PolicyException.cs
new file mode 100644
index 00000000000..3fc12347231
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/PolicyException.cs
@@ -0,0 +1,42 @@
+//
+// System.PolicyException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System.Security.Policy
+{
+ [Serializable]
+ public class PolicyException : SystemException
+ {
+ // Constructors
+ public PolicyException ()
+ : base (Locale.GetText ("Cannot run because of policy."))
+ {
+ }
+
+ public PolicyException (string message)
+ : base (message)
+ {
+ }
+
+ protected PolicyException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public PolicyException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/PolicyLevel.cs b/mcs/class/corlib/System.Security.Policy/PolicyLevel.cs
new file mode 100644
index 00000000000..215b42c23b4
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/PolicyLevel.cs
@@ -0,0 +1,62 @@
+// System.Security.Policy.PolicyLevel
+//
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak
+
+using System.Collections; // for IList
+
+namespace System.Security.Policy
+{
+ [MonoTODO]
+ [Serializable]
+ public sealed class PolicyLevel
+ {
+ internal PolicyLevel () {}
+
+ public IList FullTrustAssemblies
+ {
+ get
+ {
+ return (IList)null;
+ }
+ }
+
+ public string Label
+ {
+ get
+ {
+ return "";
+ }
+ }
+
+ public IList NamedPermissionSets
+ {
+ get
+ {
+ return (IList)null;
+ }
+ }
+
+ public CodeGroup RootCodeGroup
+ {
+ get
+ {
+ return (CodeGroup)null;
+ }
+
+ set
+ {
+
+ }
+ }
+
+ public string StoreLocation
+ {
+ get
+ {
+ return "";
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/PolicyStatement.cs b/mcs/class/corlib/System.Security.Policy/PolicyStatement.cs
new file mode 100644
index 00000000000..95a37d39b56
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/PolicyStatement.cs
@@ -0,0 +1,61 @@
+//
+// System.Security.Policy.PolicyStatement
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+
+namespace System.Security.Policy {
+
+ [Serializable]
+ public sealed class PolicyStatement : ISecurityEncodable, ISecurityPolicyEncodable {
+ public PolicyStatement (PermissionSet perms) :
+ this (perms, PolicyStatementAttribute.Nothing)
+ {
+ }
+
+ public PolicyStatement (PermissionSet perms, PolicyStatementAttribute attrs) {
+ this.perms = perms;
+ this.attrs = attrs;
+ }
+
+ public PermissionSet PermissionSet {
+ get { return perms; }
+ set { perms = value; }
+ }
+
+ public PolicyStatementAttribute Attributes {
+ get { return attrs; }
+ set { attrs = value; }
+ }
+
+ public string AttributeString {
+ get { return attrs.ToString ("F"); }
+ }
+
+ // ISecurityEncodable
+
+ [MonoTODO]
+ public void FromXml (SecurityElement e) {
+ }
+
+ [MonoTODO]
+ public void FromXml (SecurityElement e, PolicyLevel level) {
+ }
+
+ [MonoTODO]
+ public SecurityElement ToXml () {
+ return null;
+ }
+
+ [MonoTODO]
+ public SecurityElement ToXml (PolicyLevel level) {
+ return null;
+ }
+
+ private PermissionSet perms;
+ private PolicyStatementAttribute attrs;
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Policy/PolicyStatementAttribute.cs b/mcs/class/corlib/System.Security.Policy/PolicyStatementAttribute.cs
new file mode 100644
index 00000000000..be194224be9
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/PolicyStatementAttribute.cs
@@ -0,0 +1,17 @@
+// System.Security.Policy.PolicyStatementAttribute
+//
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak
+
+namespace System.Security.Policy
+{
+ [Flags]
+ [Serializable]
+ public enum PolicyStatementAttribute {
+ Nothing = 0,
+ Exclusive = 1,
+ LevelFinal = 2,
+ All = 3
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/ChangeLog b/mcs/class/corlib/System.Security.Principal/ChangeLog
new file mode 100644
index 00000000000..ca072f91da8
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/ChangeLog
@@ -0,0 +1,3 @@
+2002-01-07 Nick Drochak <ndrochak@gol.com>
+
+ * PrincipalPolicy.cs: made enum public like it should be to get _AppDomain to compile.
diff --git a/mcs/class/corlib/System.Security.Principal/GenericIdentity.cs b/mcs/class/corlib/System.Security.Principal/GenericIdentity.cs
new file mode 100644
index 00000000000..0b5aea58c8a
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/GenericIdentity.cs
@@ -0,0 +1,46 @@
+//
+// System.Security.Principal.GenericIdentity.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ [Serializable]
+ public class GenericIdentity : IIdentity {
+ string user_name;
+ string authentication_type;
+
+ public GenericIdentity (string user_name, string authentication_type)
+ {
+ this.user_name = user_name;
+ this.authentication_type = authentication_type;
+ }
+
+ public GenericIdentity (string name)
+ {
+ this.user_name = user_name;
+ }
+
+ public virtual string AuthenticationType {
+ get {
+ return authentication_type;
+ }
+ }
+
+ public virtual string Name {
+ get {
+ return user_name;
+ }
+ }
+
+ public virtual bool IsAuthenticated {
+ get {
+ return true;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/GenericPrincipal.cs b/mcs/class/corlib/System.Security.Principal/GenericPrincipal.cs
new file mode 100644
index 00000000000..5fa85b9e72b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/GenericPrincipal.cs
@@ -0,0 +1,38 @@
+//
+// System.Security.Principal.GenericPrincipal.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ [Serializable]
+ public class GenericPrincipal : IPrincipal {
+ IIdentity identity;
+ string [] roles;
+
+ public GenericPrincipal (IIdentity identity, string [] roles)
+ {
+ this.identity = identity;
+ this.roles = roles;
+ }
+
+ public virtual IIdentity Identity {
+ get {
+ return identity;
+ }
+ }
+
+ public virtual bool IsInRole (string role)
+ {
+ foreach (string r in roles)
+ if (role == r)
+ return true;
+
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/IIdentity.cs b/mcs/class/corlib/System.Security.Principal/IIdentity.cs
new file mode 100644
index 00000000000..e31f8eddd34
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/IIdentity.cs
@@ -0,0 +1,26 @@
+//
+// System.Security.Principal.IIdentity.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ public interface IIdentity {
+
+ string AuthenticationType {
+ get;
+ }
+
+ bool IsAuthenticated {
+ get;
+ }
+
+ string Name {
+ get;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/IPrincipal.cs b/mcs/class/corlib/System.Security.Principal/IPrincipal.cs
new file mode 100644
index 00000000000..55aece3a4dc
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/IPrincipal.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.Principal.IPrincipal.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ public interface IPrincipal {
+
+ IIdentity Identity {
+ get;
+ }
+
+ bool IsInRole (string role);
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/PrincipalPolicy.cs b/mcs/class/corlib/System.Security.Principal/PrincipalPolicy.cs
new file mode 100644
index 00000000000..0fc36b14087
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/PrincipalPolicy.cs
@@ -0,0 +1,17 @@
+//
+// System.Security.Principal.PrincipalPolicy.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ public enum PrincipalPolicy {
+ UnauthenticatedPrincipal,
+ NoPrincipal,
+ WindowsPrincipal
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/WindowsAccountType.cs b/mcs/class/corlib/System.Security.Principal/WindowsAccountType.cs
new file mode 100644
index 00000000000..43b4c063797
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/WindowsAccountType.cs
@@ -0,0 +1,18 @@
+//
+// System.Security.Principal.WindowsAccountType.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ internal enum WindowsAccountType {
+ Normal,
+ Guest,
+ System,
+ Anonymous
+ }
+}
diff --git a/mcs/class/corlib/System.Security.Principal/WindowsBuiltInRole.cs b/mcs/class/corlib/System.Security.Principal/WindowsBuiltInRole.cs
new file mode 100644
index 00000000000..d1541cb951b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Principal/WindowsBuiltInRole.cs
@@ -0,0 +1,23 @@
+//
+// System.Security.Principal.WindowsBuiltInRole.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security.Principal {
+
+ internal enum WindowsBuiltInRole {
+ Administrator = 544,
+ User = 545,
+ Guest = 546,
+ PowerUser = 547,
+ AccountOperator = 548,
+ SystemOperator = 549,
+ PrintOperator = 550,
+ BackupOperator = 551,
+ Replicator = 552,
+ }
+}
diff --git a/mcs/class/corlib/System.Security/ChangeLog b/mcs/class/corlib/System.Security/ChangeLog
new file mode 100755
index 00000000000..d4ed1abd67e
--- /dev/null
+++ b/mcs/class/corlib/System.Security/ChangeLog
@@ -0,0 +1,46 @@
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * SecurityException.cs: Inherit from SystemException, not Exception.
+
+2002-02-23 Nick Drochak <ndrochak@gol.com>
+
+ * SecurityElement.cs: fixed typo
+
+2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * NamedPermissionSet.cs: New file (stub)
+
+2002-02-07 Duncan Mak <duncan@ximian.com>
+
+ * SecurityException.cs: Reformatted to fit the form of other
+ Exceptions. Added serialization bits.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * SecurityElement.cs : Insert MonoTODO attribute.
+
+2002-01-02 Nick Drochak <ndrochak@gol.com>
+
+ * CodeAccessPermission.cs: Fix syntax error hidden by exclusion in .build file
+
+2001-12-30 Nick Drochak <ndrochak@gol.com>
+
+ * PermissionSet.cs SecurityManager.cs: New Files
+ * CodeAccessPermission.cs: Add Skeleton code
+ * IPermission.cs: Make public and inherit from ISecurityEncodable
+ * ISecurityEncodable.cs: Make interface public
+ * ISecurityPolicyEncodable.cs: Ditto
+ * IStackWalk.cs: Ditto
+
+2001-12-29 Nick Drochak <ndrochak@gol.com>
+
+ * ISecurityPolicyEncodable.cs, PolicyLevelType.cs,
+ SecurityZone.cs, SecurityException.cs, UnverifiableCodeAttribute.cs,
+ SuppressUnmanagedCodeSecurityAttribute.cs,
+ VerificationException.cs, XmlSyntaxException.cs: New files
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * SecurityElement.cs, CodeAccessPermission.cs IPermission.cs
+ IStackWalk.cs SecurityElement.cs ISecurityEncodable.cs: New files.
+
diff --git a/mcs/class/corlib/System.Security/CodeAccessPermission.cs b/mcs/class/corlib/System.Security/CodeAccessPermission.cs
new file mode 100755
index 00000000000..9fe27e19de1
--- /dev/null
+++ b/mcs/class/corlib/System.Security/CodeAccessPermission.cs
@@ -0,0 +1,85 @@
+//
+// System.Security.CodeAccessPermission.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ [Serializable]
+ public abstract class CodeAccessPermission : IPermission, ISecurityEncodable, IStackWalk
+ {
+ ///<summary>Constructs a new instance of the System.Security.CodeAccessPermission class.</summary>
+ protected CodeAccessPermission(){}
+
+ ///<summary> Asserts that calling code can access the resource identified by the current instance through the code that calls this method, even if callers have not been granted permission to access the resource. </summary>
+ ///<exception cref="System.Security.SecurityException">The calling code does not have System.Security.Permissions.SecurityPermissionFlag.Assertion. </exception>
+ public void Assert()
+ {
+ }
+
+ ///<summary> Returns a System.Security.CodeAccessPermission containing the same values as the current instance.</summary>
+ ///<returns> A new System.Security.CodeAccessPermission instance that is value equal to the current instance.</returns>
+ public abstract IPermission Copy();
+
+ ///<summary>Forces a System.Security.SecurityException if all callers do not have the permission specified by the current instance.</summary>
+ ///<exception cref="System.Security.SecurityException"> A caller does not have the permission specified by the current instance. A caller has called System.Security.CodeAccessPermission.Deny for the resource protected by the current instance. </exception>
+ public void Demand()
+ {
+ }
+
+ ///<summary> Denies access to the resources specified by the current instance through the code that calls this method.</summary>
+ public void Deny(){}
+
+ ///<summary> Reconstructs the state of a System.Security.CodeAccessPermission object using the specified XML encoding.</summary>
+ ///<param name="elem">A System.Security.SecurityElement instance containing the XML encoding to use to reconstruct the state of a System.Security.CodeAccessPermission object.</param>
+ ///<exception cref="System.ArgumentException">elem does not contain the XML encoding for a instance of the same type as the current instance.The version number of elem is not valid.</exception>
+ public abstract void FromXml(SecurityElement elem);
+
+ ///<summary> Returns a System.Security.CodeAccessPermission object that is the intersection of the current instance and the specified object.</summary>
+ ///<param name="target">A System.Security.CodeAccessPermission instance to intersect with the current instance.</param>
+ ///<returns> A new System.Security.CodeAccessPermission instance that represents the intersection of the current instance andtarget. If the intersection is empty or target is null, returns null. If the current instance is unrestricted, returns a copy of target. Iftarget is unrestricted, returns a copy of the current instance.</returns>
+ ///<exception cref="System.ArgumentException">target is not null and is not a System.Security.CodeAccessPermission object.</exception>
+ public abstract IPermission Intersect(IPermission target);
+
+ ///<summary>Determines whether the current instance is a subset of the specified object.</summary>
+ ///<param name="target">A System.Security.CodeAccessPermission instance that is to be tested for the subset relationship.</param>
+ ///<returns>true if the current instance is a subset of target; otherwise, false. If the current instance is unrestricted, and target is not, returnsfalse. If target is unrestricted, returns true.</returns>
+ ///<exception cref="System.ArgumentException">target is not null and is not of type System.Security.CodeAccessPermission.</exception>
+ public abstract bool IsSubsetOf(IPermission target);
+
+ ///<summary> Returns the XML representation of the state of the current instance.</summary>
+ ///<returns> A System.String containing the XML representation of the state of the current instance.</returns>
+ public override string ToString()
+ {
+ return null;
+ }
+
+ ///<summary> Returns the XML encoding of the current instance.</summary>
+ ///<returns>A System.Security.SecurityElement containing an XML encoding of the state of the current instance.</returns>
+ public abstract SecurityElement ToXml();
+
+ ///<summary> Returns a System.Security.CodeAccessPermission object that is the union of the current instance and the specified object.</summary>
+ ///<param name="other">A System.Security.IPermission object of the same type as the current instance to be combined with the current instance.</param>
+ ///<returns>If other is null, returns a copy of the current instance using the System.Security.IPermission.Copy method.</returns>
+ ///<exception cref="System.ArgumentException">other is not of type System.Security.CodeAccessPermission.</exception>
+ ///<exception cref="System.NotSupportedException">other is not null.</exception>
+ 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.
+ }
+ return null;
+ }
+
+ public void PermitOnly(){}
+ }
+}
diff --git a/mcs/class/corlib/System.Security/IEvidenceFactory.cs b/mcs/class/corlib/System.Security/IEvidenceFactory.cs
new file mode 100644
index 00000000000..3687f6d6f95
--- /dev/null
+++ b/mcs/class/corlib/System.Security/IEvidenceFactory.cs
@@ -0,0 +1,12 @@
+// System.Security.IEvidenceFactory
+//
+// Sean MacIsaac (macisaac@ximian.com)
+//
+// (C) Ximian, Inc. 2001
+
+namespace System.Security
+{
+ public interface IEvidenceFactory
+ {
+ }
+}
diff --git a/mcs/class/corlib/System.Security/IPermission.cs b/mcs/class/corlib/System.Security/IPermission.cs
new file mode 100755
index 00000000000..63aabfd4c4a
--- /dev/null
+++ b/mcs/class/corlib/System.Security/IPermission.cs
@@ -0,0 +1,24 @@
+//
+// System.Security.IPermission.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ public interface IPermission : ISecurityEncodable {
+
+ IPermission Copy ();
+
+ void Demand ();
+
+ IPermission Intersect (IPermission target);
+
+ bool IsSubsetOf (IPermission target);
+
+ IPermission Union (IPermission target);
+ }
+}
diff --git a/mcs/class/corlib/System.Security/ISecurityEncodable.cs b/mcs/class/corlib/System.Security/ISecurityEncodable.cs
new file mode 100755
index 00000000000..55b9ebe2f55
--- /dev/null
+++ b/mcs/class/corlib/System.Security/ISecurityEncodable.cs
@@ -0,0 +1,18 @@
+//
+// System.Security.ISecurityEncodable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ public interface ISecurityEncodable {
+
+ void FromXml (SecurityElement e);
+
+ SecurityElement ToXml ();
+ }
+}
diff --git a/mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs b/mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs
new file mode 100644
index 00000000000..66418ab91d0
--- /dev/null
+++ b/mcs/class/corlib/System.Security/ISecurityPolicyEncodable.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.ISecurityPolicyEncodable.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Security.Policy;
+
+namespace System.Security {
+
+ public interface ISecurityPolicyEncodable {
+
+ void FromXml (SecurityElement e, PolicyLevel level);
+
+ SecurityElement ToXml (PolicyLevel level);
+ }
+}
diff --git a/mcs/class/corlib/System.Security/IStackWalk.cs b/mcs/class/corlib/System.Security/IStackWalk.cs
new file mode 100755
index 00000000000..f5b717ac57a
--- /dev/null
+++ b/mcs/class/corlib/System.Security/IStackWalk.cs
@@ -0,0 +1,22 @@
+//
+// System.Security.IStackWalk.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Security {
+
+ public interface IStackWalk {
+
+ void Assert ();
+
+ void Demand ();
+
+ void Deny ();
+
+ void PermitOnly ();
+ }
+}
diff --git a/mcs/class/corlib/System.Security/NamedPermissionSet.cs b/mcs/class/corlib/System.Security/NamedPermissionSet.cs
new file mode 100644
index 00000000000..0f500e6de98
--- /dev/null
+++ b/mcs/class/corlib/System.Security/NamedPermissionSet.cs
@@ -0,0 +1,66 @@
+//
+// System.Security.NamedPermissionSet
+//
+// Author:
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2002
+//
+// Stubbed.
+//
+
+using System;
+using System.Security.Permissions;
+
+namespace System.Security {
+
+ [MonoTODO]
+ [Serializable]
+ public sealed class NamedPermissionSet : PermissionSet {
+ public NamedPermissionSet (string name, PermissionSet set) : base (set) {
+ this.name = name;
+ this.description = "";
+ }
+
+ public NamedPermissionSet (string name, PermissionState state) : base (state) {
+ this.name = name;
+ this.description = "";
+ }
+
+ public NamedPermissionSet (NamedPermissionSet set) : this (set.name, set) {
+ }
+
+ public NamedPermissionSet (string name) : this (name, PermissionState.None) {
+ }
+
+ public string Description {
+ get { return description; }
+ set { description = value; }
+ }
+
+ public string Name {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public override PermissionSet Copy () {
+ return null;
+ }
+
+ public NamedPermissionSet Copy (string name) {
+ return null;
+ }
+
+ public override void FromXml (SecurityElement e) {
+ }
+
+ public override SecurityElement ToXml () {
+ return null;
+ }
+
+ // private
+
+ private string name;
+ private string description;
+ }
+}
diff --git a/mcs/class/corlib/System.Security/PermissionSet.cs b/mcs/class/corlib/System.Security/PermissionSet.cs
new file mode 100644
index 00000000000..96c9667b9be
--- /dev/null
+++ b/mcs/class/corlib/System.Security/PermissionSet.cs
@@ -0,0 +1,202 @@
+//
+// System.Security.PermissionSet.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System;
+using System.Collections;
+using System.Security.Permissions;
+using System.Security;
+using System.Runtime.Serialization;
+
+namespace System.Security
+{
+ ///<summary> Represents a collection that can contain different kinds of permissions and perform security operations.</summary>
+ [Serializable]
+ public class PermissionSet: ISecurityEncodable, ICollection, IEnumerable, IStackWalk, IDeserializationCallback
+ {
+ ///<summary> Constructs a new instance of the System.Security.PermissionSet class with the specified value.</summary>
+ ///<param name="state">A System.Security.Permissions.PermissionState value. This value is either System.Security.Permissions.PermissionState.None or System.Security.Permissions.PermissionState.Unrestricted, to specify fully restricted or fully unrestricted access. </param>
+ ///<exception cref="System.ArgumentException">state is not a valid System.Security.Permissions.PermissionState value.</exception>
+ public PermissionSet(PermissionState state)
+ {
+ if (!Enum.IsDefined(typeof(System.Security.Permissions.PermissionState), state))
+ {
+ throw new System.ArgumentException(); // state is not a valid System.Security.Permissions.PermissionState value.
+ }
+ }
+
+ ///<summary> Constructs a new instance of the System.Security.PermissionSet class with the values of the specified System.Security.PermissionSet instance. </summary>
+ ///<param name="permSet">The System.Security.PermissionSet instance with which to initialize the values of the new instance, or null to initialize an empty permission set.</param>
+ ///<exception cref="System.ArgumentException">permSet is not an instance of System.Security.PermissionSet.</exception>
+ public PermissionSet(PermissionSet permSet)
+ {
+ // LAMESPEC: This would be handled by the compiler. No way permSet is not a PermissionSet.
+ //if (false)
+ //{
+ // throw new System.ArgumentException(); // permSet is not an instance of System.Security.PermissionSet.
+ //}
+ }
+
+ ///<summary> Adds the specified System.Security.IPermission object to the current instance if that permission does not already exist in the current instance.</summary>
+ ///<param name="perm">The System.Security.IPermission object to add.</param>
+ ///<returns>The System.Security.IPermission is added if perm is notnull and a permission of the same type as perm does not already exist in the current instance. If perm is null, returns null. If a permission of the same type asperm already exists in the current instance, the union of the existing permission and perm is added to the current instance and is returned.</returns>
+ ///<exception cref="System.ArgumentException">perm is not a System.Security.IPermission object.</exception>
+ public virtual IPermission AddPermission(IPermission perm)
+ {
+ // LAMESPEC: This would be handled by the compiler. No way perm is not an IPermission.
+ //if (false)
+ //{
+ // throw new System.ArgumentException(); // perm is not a System.Security.IPermission object.
+ //}
+ return null;
+ }
+
+ ///<summary>Asserts that calling code can access the resources identified by the permissions contained in the current instance through the code that calls this method, even if callers have not been granted permission to access the resource. </summary>
+ ///<exception cref="System.Security.SecurityException">The asserting code does not have sufficient permission to call this method.-or-This method was called with permissions already asserted for the current stack frame.</exception>
+ public virtual void Assert()
+ {
+ throw new System.Security.SecurityException(); // The asserting code does not have sufficient permission to call this method.-or-This method was called with permissions already asserted for the current stack frame.
+ }
+
+ ///<summary>Returns a new System.Security.PermissionSet containing copies of the objects in the current instance.</summary>
+ ///<returns>A new System.Security.PermissionSet that is value equal to the current instance.</returns>
+ public virtual PermissionSet Copy()
+ {
+ return null;
+ }
+
+ ///<summary>Copies the permission objects in the current instance to the specified location in the specified System.Array.</summary>
+ ///<param name="array">The destination System.Array.</param>
+ ///<param name="index">A System.Int32 that specifies the zero-based starting position in the array at which to begin copying.</param>
+ ///<exception cref="System.ArgumentException">array has more than one dimension.</exception>
+ ///<exception cref="System.IndexOutOfRangeException">index is outside the range of allowable values for array.</exception>
+ ///<exception cref="System.ArgumentNullException">array is null.</exception>
+ public virtual void CopyTo(Array array, int index)
+ {
+ if (array.Rank > 1)
+ {
+ throw new System.ArgumentException("Array has more than one dimension"); // array has more than one dimension.
+ }
+ if (index < 0 || index >= array.Length)
+ {
+ throw new System.IndexOutOfRangeException(); // index is outside the range of allowable values for array.
+ }
+ if (null == array)
+ {
+ throw new System.ArgumentNullException(); // array is null.
+ }
+ }
+
+ ///<summary>Forces a System.Security.SecurityException if all callers do not have the permissions specified by the objects contained in the current instance.</summary>
+ ///<exception cref="System.Security.SecurityException">A caller does not have the permission specified by the current instance.</exception>
+ public virtual void Demand()
+ {
+ throw new System.Security.SecurityException(); // A caller does not have the permission specified by the current instance.
+ }
+
+ ///<summary>Denies access to the resources secured by the objects contained in the current instance through the code that calls this method.</summary>
+ ///<exception cref="System.Security.SecurityException">A previous call to Deny has already restricted the permissions for the current stack frame.</exception>
+ public virtual void Deny()
+ {
+ throw new System.Security.SecurityException(); // A previous call to Deny has already restricted the permissions for the current stack frame.
+ }
+
+ ///<summary>Reconstructs the state of a System.Security.PermissionSet object using the specified XML encoding.</summary>
+ ///<param name="et">A System.Security.SecurityElement instance containing the XML encoding to use to reconstruct the state of a System.Security.PermissionSet object.</param>
+ ///<exception cref="System.ArgumentNullException">et is null.</exception>
+ ///<exception cref="System.ArgumentException">et does not contain an XML encoding for a System.Security.PermissionSet instance.An error occurred while reconstructing et.</exception>
+ public virtual void FromXml(SecurityElement et)
+ {
+ if (null == et)
+ {
+ throw new System.ArgumentNullException("et"); // et is null.
+ }
+ if (true)
+ {
+ throw new System.ArgumentException("et does not contain an XML encoding for a System.Security.PermissionSet instance."); // et does not contain an XML encoding for a System.Security.PermissionSet instance.An error occurred while reconstructing et.
+ }
+ }
+
+ ///<summary> Returns an enumerator used to iterate over the permissions in the current instance.</summary>
+ ///<returns>A System.Collections.IEnumerator object for the permissions of the set.</returns>
+ public virtual IEnumerator GetEnumerator()
+ {
+ return null;
+ }
+
+ ///<summary> Determines whether the current instance is a subset of the specified object.</summary>
+ ///<param name="target">A System.Security.PermissionSet instance that is to be tested for the subset relationship. </param>
+ ///<returns>true if the current instance is a subset of target; otherwise, false. If the current instance is unrestricted, andtarget is not, returns false. If target is unrestricted, returns true.</returns>
+ public virtual bool IsSubsetOf(PermissionSet target)
+ {
+ return false;
+ }
+
+ ///<summary> Specifies that only the resources described by the current instance can be accessed by calling code, even if the code has been granted permission to access other resources.</summary>
+ ///<exception cref="System.Security.SecurityException">A previous call to PermitOnly has already set the permissions for the current stack frame.</exception>
+ public virtual void PermitOnly()
+ {
+ if (true)
+ {
+ throw new System.Security.SecurityException(); // A previous call to PermitOnly has already set the permissions for the current stack frame.
+ }
+ }
+
+ ///<summary> Returns a System.String representation of the state of the current instance.</summary>
+ ///<returns>A System.Stringcontaining the XML representation of the state of the current instance.</returns>
+ public override string ToString()
+ {
+ return null;
+ }
+
+ ///<summary>Returns the XML encoding of the current instance.</summary>
+ ///<returns>A System.Security.SecurityElement containing an XML encoding of the state of the current instance.</returns>
+ public virtual SecurityElement ToXml()
+ {
+ return null;
+ }
+
+ ///<summary> Returns a System.Security.PermissionSet object that is the union of the current instance and the specified object.</summary>
+ ///<param name="other">A System.Security.PermissionSet instance to be combined with the current instance.</param>
+ ///<returns> A new System.Security.PermissionSet instance that represents the union of the current instance and other. If the current instance or other is unrestricted, returns a System.Security.PermissionSet instance that is unrestricted.</returns>
+ public virtual PermissionSet Union(PermissionSet other)
+ {
+ return null;
+ }
+
+ ///<summary>Implemented to support the System.Collections.ICollection interface. [Note: For more information, see System.Collections.ICollection.Count.]</summary>
+ int ICollection.Count
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ ///<summary>Implemented to support the System.Collections.ICollection interface. [Note: For more information, see System.Collections.ICollection.IsSynchronized.]</summary>
+ bool ICollection.IsSynchronized
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ ///<summary>Implemented to support the System.Collections.ICollection interface. [Note: For more information, see System.Collections.ICollection.SyncRoot.]</summary>
+ object ICollection.SyncRoot
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ void IDeserializationCallback.OnDeserialization(object sender){}
+
+ }
+}
diff --git a/mcs/class/corlib/System.Security/PolicyLevelType.cs b/mcs/class/corlib/System.Security/PolicyLevelType.cs
new file mode 100644
index 00000000000..d9e8e5c50bf
--- /dev/null
+++ b/mcs/class/corlib/System.Security/PolicyLevelType.cs
@@ -0,0 +1,18 @@
+//
+// System.Security.PolicyLevelType.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ public enum PolicyLevelType {
+ AppDomain,
+ Enterprise,
+ Machine,
+ User
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security/SecurityElement.cs b/mcs/class/corlib/System.Security/SecurityElement.cs
new file mode 100755
index 00000000000..375d1f17f67
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityElement.cs
@@ -0,0 +1,206 @@
+//
+// System.Security.SecurityElement.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+
+using System.Globalization;
+using System.Collections;
+using System.Text;
+
+namespace System.Security {
+
+ [MonoTODO ("See bottom of the class for missing methods")]
+ [Serializable]
+ public sealed class SecurityElement {
+ string text;
+ string tag;
+
+ public SecurityElement (string tag, string text)
+ {
+ if (tag.IndexOfAny (invalid_chars) != -1)
+ throw new ArgumentException (Locale.GetText ("Invalid XML string"));
+ if (text.IndexOfAny (invalid_chars) != -1 ||
+ tag.IndexOfAny (invalid_chars) != -1)
+ throw new ArgumentException (Locale.GetText ("Invalid XML string"));
+
+ this.tag = tag;
+ this.text = text;
+ }
+ public SecurityElement (string tag)
+ {
+ if (tag.IndexOfAny (invalid_chars) != -1)
+ throw new ArgumentException (Locale.GetText ("Invalid XML string"));
+
+ this.tag = tag;
+ }
+
+ Hashtable attributes;
+ public Hashtable Attributes {
+ get {
+ return attributes;
+ }
+
+ set {
+ attributes = value;
+ }
+ }
+
+ ArrayList children;
+ public ArrayList Children {
+ get {
+ return children;
+ }
+
+ set {
+ if (value != null){
+ foreach (object o in children){
+ if (o == null)
+ throw new ArgumentNullException ();
+ }
+ }
+ children = value;
+ }
+ }
+
+ public string Tag {
+ get {
+ return tag;
+ }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ();
+ if (tag.IndexOfAny (invalid_chars) != -1)
+ throw new ArgumentException (Locale.GetText ("Invalid XML string"));
+ tag = value;
+ }
+ }
+
+ public string Text {
+ get {
+ return text;
+ }
+
+ set {
+ if (value != null && (value.IndexOfAny (invalid_chars) != -1))
+ throw new ArgumentException (Locale.GetText ("Invalid XML string"));
+
+ text = value;
+ }
+ }
+
+ public void AddAttribute (string name, string value)
+ {
+ if (name == null || value == null)
+ throw new ArgumentNullException ();
+
+ if (attributes == null)
+ attributes = new Hashtable ();
+
+ //
+ // The hashtable will throw ArgumentException if name is already there
+ //
+
+ if (name.IndexOfAny (invalid_chars) != -1)
+ throw new ArgumentException (Locale.GetText ("Invalid XML string"));
+
+ if (value.IndexOfAny (invalid_chars) != -1)
+ throw new ArgumentException (Locale.GetText ("Invalid XML string"));
+
+ attributes.Add (name, value);
+ }
+
+ public void AddChild (SecurityElement child)
+ {
+ if (child == null)
+ throw new ArgumentNullException ();
+
+ if (children == null)
+ children = new ArrayList ();
+
+ children.Add (child);
+ }
+
+ public string Attribute (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ();
+
+ if (attributes != null)
+ return (string) attributes [name];
+ else
+ return null;
+ }
+
+ public bool Equal (SecurityElement other)
+ {
+ if (other == null)
+ return false;
+
+ if (text != other.text)
+ return false;
+
+ if (tag != other.tag)
+ return false;
+
+ throw new Exception ("IMPLEMENT ME: Compare attributes and children");
+ }
+
+ static char [] invalid_chars = new char [] { '<', '>', '"', '\'', '&' };
+
+ public static string Escape (string str)
+ {
+ StringBuilder sb;
+
+ if (str.IndexOfAny (invalid_chars) == -1)
+ return str;
+
+ sb = new StringBuilder ();
+ int len = str.Length;
+
+ for (int i = 0; i < len; i++){
+ char c = str [i];
+
+ switch (c){
+ case '<': sb.Append ("&lt;"); break;
+ case '>': sb.Append ("&gt;"); break;
+ case '"': sb.Append ("&quot;"); break;
+ case '\'': sb.Append ("&apos;"); break;
+ case '&': sb.Append ("&amp;"); break;
+ default: sb.Append (c); break;
+ }
+ }
+
+ return sb.ToString ();
+ }
+
+ public static bool IsInvalidAttributeName (string name)
+ {
+ return name.IndexOfAny (invalid_chars) != -1;
+ }
+
+ public static bool IsInvalidAttributeValue (string value)
+ {
+ return value.IndexOfAny (invalid_chars) != -1;
+ }
+
+ public static bool IsInvalidTag (string value)
+ {
+ return value.IndexOfAny (invalid_chars) != -1;
+ }
+
+ public static bool IsInvalidText (string value)
+ {
+ return value.IndexOfAny (invalid_chars) != -1;
+ }
+
+ //
+ // TODO:
+ //
+ // SearchForChildByTag
+ // SearchForTextOfTag
+ // ToString
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityException.cs b/mcs/class/corlib/System.Security/SecurityException.cs
new file mode 100644
index 00000000000..aaa0086bbe2
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityException.cs
@@ -0,0 +1,79 @@
+//
+// 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;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityManager.cs b/mcs/class/corlib/System.Security/SecurityManager.cs
new file mode 100644
index 00000000000..d29a2845c63
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityManager.cs
@@ -0,0 +1,88 @@
+//
+// System.Security.SecurityManager.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Security.Policy;
+using System.Collections;
+
+namespace System.Security {
+
+ public sealed class SecurityManager {
+ private static bool checkExecutionRights;
+ private static bool securityEnabled;
+
+ private SecurityManager () {}
+
+ public static bool CheckExecutionRights {
+ get{
+ return checkExecutionRights;
+ }
+ set{
+ checkExecutionRights = value;
+ }
+ }
+
+ public static bool SecurityEnabled {
+ get{
+ return securityEnabled;
+ }
+ set{
+ securityEnabled = value;
+ }
+ }
+
+ public static bool IsGranted(IPermission perm){
+ return false;
+ }
+
+ public static PolicyLevel LoadPolicyLevelFromFile(
+ string path,
+ PolicyLevelType type)
+ {
+ return null;
+ }
+
+ public static PolicyLevel LoadPolicyLevelFromString(
+ string str,
+ PolicyLevelType type)
+ {
+ if (null == str){
+ throw new ArgumentNullException("str");
+ }
+ return null;
+ }
+
+ public static IEnumerator PolicyHierarchy(){
+ return null;
+ }
+
+ public static PermissionSet ResolvePolicy(Evidence evidence){
+ return null;
+ }
+
+ public static PermissionSet ResolvePolicy(
+ Evidence evidence,
+ PermissionSet reqdPset,
+ PermissionSet optPset,
+ PermissionSet denyPset,
+ out PermissionSet denied)
+ {
+ denied = null;
+ return null;
+ }
+
+ public static IEnumerator ResolvePolicyGroups(Evidence evidence){
+ return null;
+ }
+
+ public static void SavePolicy(){}
+
+ public static void SavePolicyLevel(PolicyLevel level){}
+
+ }
+}
diff --git a/mcs/class/corlib/System.Security/SecurityZone.cs b/mcs/class/corlib/System.Security/SecurityZone.cs
new file mode 100644
index 00000000000..4d999f3f227
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SecurityZone.cs
@@ -0,0 +1,20 @@
+//
+// System.Security.SecurityZone.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ public enum SecurityZone {
+ Internet,
+ Intranet,
+ MyComputer,
+ NoZone,
+ Trusted,
+ Untrusted
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs b/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs
new file mode 100644
index 00000000000..155ed996722
--- /dev/null
+++ b/mcs/class/corlib/System.Security/SuppressUnmanagedCodeSecurityAttribute.cs
@@ -0,0 +1,13 @@
+//
+// System.Security.SuppressUnmanagedCodeSecurityAttribute.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ public sealed class SuppressUnmanagedCodeSecurityAttribute : Attribute {}
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs b/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs
new file mode 100644
index 00000000000..1fd2f2b67ef
--- /dev/null
+++ b/mcs/class/corlib/System.Security/UnverifiableCodeAttribute.cs
@@ -0,0 +1,13 @@
+//
+// System.Security.UnverifiableCodeAttribute.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+namespace System.Security {
+
+ public sealed class UnverifiableCodeAttribute : Attribute {}
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System.Security/VerificationException.cs b/mcs/class/corlib/System.Security/VerificationException.cs
new file mode 100644
index 00000000000..277ea55cd37
--- /dev/null
+++ b/mcs/class/corlib/System.Security/VerificationException.cs
@@ -0,0 +1,26 @@
+//
+// System.Security.VerificationException.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System.Security {
+ [Serializable]
+ public class VerificationException : SystemException {
+
+ // Constructors
+ public VerificationException(){}
+ public VerificationException(string message)
+ : base (message){}
+ protected VerificationException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {}
+ public VerificationException(string message, Exception inner)
+ : base (message, inner) {}
+ }
+}
diff --git a/mcs/class/corlib/System.Security/XmlSyntaxException.cs b/mcs/class/corlib/System.Security/XmlSyntaxException.cs
new file mode 100644
index 00000000000..91e2c5bc9fa
--- /dev/null
+++ b/mcs/class/corlib/System.Security/XmlSyntaxException.cs
@@ -0,0 +1,27 @@
+//
+// System.Security.XmlSyntaxException.cs
+//
+// Author:
+// Nick Drochak(ndrochak@gol.com)
+//
+// (C) Nick Drochak
+//
+
+using System.Globalization;
+
+namespace System.Security {
+ [Serializable]
+ public sealed class XmlSyntaxException : SystemException {
+
+ // Constructors
+ public XmlSyntaxException(){}
+ public XmlSyntaxException(int lineNumber)
+ : base (Locale.GetText("Invalid syntax on line ") + lineNumber.ToString() + "."){}
+ public XmlSyntaxException(int lineNumber, string message)
+ : base (Locale.GetText("Invalid syntax on line ") + lineNumber.ToString() + " - " + message ){}
+ public XmlSyntaxException(string message)
+ : base (message){}
+ public XmlSyntaxException(string message, Exception inner)
+ : base (message, inner) {}
+ }
+}
diff --git a/mcs/class/corlib/System.Text/ASCIIEncoding.cs b/mcs/class/corlib/System.Text/ASCIIEncoding.cs
new file mode 100755
index 00000000000..eb5e79ec2ab
--- /dev/null
+++ b/mcs/class/corlib/System.Text/ASCIIEncoding.cs
@@ -0,0 +1,166 @@
+//
+// System.Text.ASCIIEncoding.cs
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Text {
+
+ [Serializable]
+ public class ASCIIEncoding : Encoding
+ {
+ public ASCIIEncoding () : base ()
+ {
+ encoding_name = "US-ASCII";
+ body_name = "us-ascii";
+ header_name = "us-ascii";
+ web_name = "us-ascii";
+ is_browser_display = false;
+ is_browser_save = false;
+ is_mail_news_display = true;
+ is_mail_news_save = true;
+ }
+
+ public override int GetByteCount (string chars)
+ {
+ if (chars == null)
+ throw new ArgumentNullException ();
+
+ return chars.Length;
+ }
+
+ public override int GetByteCount (char[] chars)
+ {
+ if (chars == null)
+ throw new ArgumentNullException ();
+
+ return chars.Length;
+ }
+
+ public override int GetByteCount (char[] chars, int index, int count)
+ {
+ if (chars == null)
+ throw new ArgumentNullException ();
+
+ if ((index < 0) || (count <= 0) || ((index + count) > chars.Length))
+ throw new ArgumentOutOfRangeException ();
+
+ return count;
+ }
+
+ public override int GetBytes (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ if ((bytes == null) || (chars == null))
+ throw new ArgumentNullException ();
+
+ if ((byteIndex < 0) || (charIndex < 0) || (charCount < 0) ||
+ ((charIndex + charCount) > chars.Length) ||
+ (byteIndex >= bytes.Length))
+ throw new ArgumentOutOfRangeException ();
+
+ if ((bytes.Length - byteIndex) < charCount)
+ throw new ArgumentException ();
+
+ for (int i = 0; i < charCount; i++)
+ if (chars[charIndex+i] > 0x7f)
+ bytes[byteIndex+i] = (byte) '?';
+ else
+ bytes[byteIndex+i] = (byte) chars[charIndex+i];
+
+ return charCount;
+ }
+
+ public override int GetBytes (string chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ return GetBytes (chars.ToCharArray (), charIndex, charCount,
+ bytes, byteIndex);
+ }
+
+ public override int GetCharCount (byte[] bytes)
+ {
+ if (bytes == null)
+ throw new ArgumentNullException ();
+
+ return bytes.Length;
+ }
+
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ if (bytes == null)
+ throw new ArgumentNullException ();
+
+ if ((index < 0) || (count <= 0) || ((index + count) > bytes.Length))
+ throw new ArgumentOutOfRangeException ();
+
+ return count;
+ }
+
+ public override int GetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex)
+ {
+ if ((bytes == null) || (chars == null))
+ throw new ArgumentNullException ();
+
+ if ((byteIndex < 0) || (charIndex < 0) || (byteCount < 0) ||
+ ((byteIndex + byteCount) > bytes.Length) ||
+ (charIndex >= chars.Length))
+ throw new ArgumentOutOfRangeException ();
+
+ if ((chars.Length - charIndex) < byteCount)
+ throw new ArgumentException ();
+
+ for (int i = 0; i < byteCount; i++)
+ if (bytes[byteIndex+i] > 0x7f)
+ chars[charIndex+i] = '?';
+ else
+ chars[charIndex+i] = (char) bytes[byteIndex+i];
+
+ return byteCount;
+ }
+
+ public override int GetMaxByteCount (int charCount)
+ {
+ if (charCount < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ return charCount;
+ }
+
+ public override int GetMaxCharCount (int byteCount)
+ {
+ if (byteCount < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ return byteCount;
+ }
+
+ public override string GetString (byte[] bytes)
+ {
+ if (bytes == null)
+ throw new ArgumentNullException ();
+
+ return new String (GetChars (bytes, 0, bytes.Length));
+ }
+
+ public override string GetString (byte[] bytes, int byteIndex, int byteCount)
+ {
+ if (bytes == null)
+ throw new ArgumentNullException ();
+
+ if ((byteIndex < 0) || (byteCount <= 0) ||
+ ((byteIndex + byteCount) > bytes.Length))
+ throw new ArgumentOutOfRangeException ();
+
+ return new String (GetChars (bytes, byteIndex, byteCount));
+ }
+
+ }
+}
+
diff --git a/mcs/class/corlib/System.Text/ChangeLog b/mcs/class/corlib/System.Text/ChangeLog
new file mode 100755
index 00000000000..63683f4342e
--- /dev/null
+++ b/mcs/class/corlib/System.Text/ChangeLog
@@ -0,0 +1,106 @@
+2002/04/02 Nick Drochak <ndrochak@gol.com>
+
+ * StringBuilder.cs (Append): Removed obsolete overload.
+
+2002-03-21 Mike Kestner <mkestner@speakeasy.net>
+
+ * ASCIIEncoding.cs : Fix off by one error in Get(Char|Byte)Count.
+
+Thu Mar 21 17:38:19 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * StringBuilder.cs: no need to intern the string returned by ToString().
+
+2002-03-17 Mike Kestner <mkestner@speakeasy.net>
+
+ * ASCIIEncoding.cs: Implement all the overridden methods. No longer
+ dependent on iconv icalls.
+ * Encoding.cs: Fix count bugs in GetBytes and GetChars. Add virtual
+ to GetBytes.
+
+Wed Mar 13 00:26:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * StringBuilder.cs: make ToString() return a interned string, this
+ seems to be required to make switch on string work.
+
+Fri Mar 8 17:29:58 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * StringBuilder.cs: make Append(char) do the smart thing.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * ASCIIEncoding.cs, Encoding.cs, UTF7Encoding.cs,
+ UnicodeEncoding.cs: MonoTODO attribute marking.
+
+ * StringBuilder.cs : Ditto.
+
+Wed Nov 14 17:05:22 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Encoding.cs: renamed some fields.
+ * StringBuilder.cs: CLSCompliant updates.
+
+2001-10-29 Nick Drochak <ndrochak@gol.com>
+
+ * StringBuilder.cs: Throw exceptions when constructor paramter(s) are
+ invalid. Just like MS does (as best as I can tell).
+
+ Tests for these exceptions are now added to the unit tests as well.
+
+2001-10-25 Nick Drochak <ndrochak@gol.com>
+
+ * StringBuilder.cs: Throw exception if they try to make a StringBuilder
+ whose capacity is greater than the MaxCapacity.
+
+ I added some tests for the constructors and the above exception. More
+ coming soon.
+
+2001-10-23 Nick Drochak <ndrochak@gol.com>
+
+ * StringBuilder.cs: Refactored constructor code into just one
+ constructor. All the other construtors call it. Also supplied missing
+ constructors so the class has all those in the spec.
+
+ Added the MaxCapacity property as well, however this needs to be
+ completed to return a value is related to the available system memory.
+
+2001-10-07 Miguel de Icaza <miguel@ximian.com>
+
+ * Encoding.cs, UTF8Encoding.cs, UTF7Encoding.cs, ASCIIEncoding.cs,
+ UnicodeEncoding.cs: Corrected API.
+
+ * UTF8Encoding.cs: Checked in changes from Rafael.
+
+2001-08-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * UTF8Encoding.cs: impl. clumsy GetBytes
+
+2001-07-16 Marcin Szczepanski <marcins@zipworld.com.au>
+
+ * StringBuilder.cs (Text): Fixed.
+
+ * StringBuilderTest.cs: Implement Test suite.
+
+2001-07-12 Marcin Szczepanski <marcins@zipworld.com.au>
+
+ * StringBuilder.cs: Implemented.
+
+ The only methods left unimplemented are the AppendFormat( ... )
+ ones just because it's probably better to wait until some of the
+ Format related classes are implemented. I've put that as a TODO
+ comment at the top and created the methods with a "nop" body.
+
+2001-06-26 Sean MacIsaac <macisaac@ximian.com>
+
+ * UnicodeEncoding.cs: Members added so that a clean compile is
+ possible.
+
+ * ASCIIEncoding.cs: Members added so that a clean compile is
+ possible.
+
+ * UTF7Encoding.cs: Members added so that a clean compile is
+ possible.
+
+ * UTF8Encoding.cs: Members added so that a clean compile is
+ possible.
+
+ * Encoding.cs: All public members included. Most members
+ unimplemented.
diff --git a/mcs/class/corlib/System.Text/Decoder.cs b/mcs/class/corlib/System.Text/Decoder.cs
new file mode 100644
index 00000000000..f7a4457bfe1
--- /dev/null
+++ b/mcs/class/corlib/System.Text/Decoder.cs
@@ -0,0 +1,71 @@
+//
+// System.Text.Decoder.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Text
+{
+
+ [Serializable]
+ public abstract class Decoder
+ {
+
+ protected Decoder ()
+ {
+ // fixme: dont know what do do here
+ }
+
+ public abstract int GetCharCount (byte[] bytes, int index, int count);
+
+ public abstract int GetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex);
+ }
+
+ internal class DefaultDecoder : Decoder {
+
+ public Encoding encoding;
+
+ public DefaultDecoder (Encoding enc)
+ {
+ encoding = enc;
+ }
+
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ return encoding.GetCharCount (bytes, index, count);
+ }
+
+ public override int GetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex)
+ {
+ return encoding.GetChars (bytes, byteIndex, byteCount, chars, charIndex);
+ }
+
+ }
+
+ internal class IConvDecoder : Decoder {
+
+ private IntPtr converter;
+
+ public IConvDecoder (string name, bool big_endian)
+ {
+ converter = Encoding.IConvNewDecoder (name, big_endian);
+ }
+
+ public override int GetCharCount (byte[] bytes, int index, int count)
+ {
+ return Encoding.IConvGetCharCount (converter, bytes, index, count);
+ }
+
+ public override int GetChars (byte[] bytes, int byteIndex, int byteCount,
+ char[] chars, int charIndex)
+ {
+ return Encoding.IConvGetChars (converter, bytes, byteIndex, byteCount,
+ chars, charIndex);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Text/Encoder.cs b/mcs/class/corlib/System.Text/Encoder.cs
new file mode 100644
index 00000000000..5eff7299441
--- /dev/null
+++ b/mcs/class/corlib/System.Text/Encoder.cs
@@ -0,0 +1,81 @@
+//
+// System.Text.Encoder.cs
+//
+// Authors:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Text
+{
+
+ [Serializable]
+ public abstract class Encoder
+ {
+
+ protected Encoder()
+ {
+ // fixme: dont know what do do here
+ }
+
+ public abstract int GetByteCount (char[] chars, int index, int count, bool flush);
+
+ public abstract int GetBytes (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex, bool flush);
+ }
+
+ internal class DefaultEncoder : Encoder {
+
+ public Encoding encoding;
+
+ public DefaultEncoder (Encoding enc)
+ {
+ encoding = enc;
+ }
+
+ public override int GetByteCount (char[] chars, int index, int count, bool flush)
+ {
+ return encoding.GetByteCount (chars, index, count);
+ }
+
+ public override int GetBytes (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex, bool flush)
+ {
+ return encoding.GetBytes (chars, charIndex, charCount, bytes, byteIndex);
+ }
+
+ }
+
+ internal class IConvEncoder : Encoder {
+
+ private IntPtr converter;
+
+ public IConvEncoder (string name, bool big_endian)
+ {
+ converter = Encoding.IConvNewEncoder (name, big_endian);
+ }
+
+ public override int GetByteCount (char[] chars, int index, int count, bool flush)
+ {
+ int res = Encoding.IConvGetByteCount (converter, chars, index, count);
+
+ if (flush)
+ Encoding.IConvReset (converter);
+
+ return res;
+ }
+
+ public override int GetBytes (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex, bool flush)
+ {
+ int res = Encoding.IConvGetBytes (converter, chars, charIndex, charCount,
+ bytes, byteIndex);
+
+ if (flush)
+ Encoding.IConvReset (converter);
+
+ return res;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Text/Encoding.cs b/mcs/class/corlib/System.Text/Encoding.cs
new file mode 100755
index 00000000000..a4eaf87bbae
--- /dev/null
+++ b/mcs/class/corlib/System.Text/Encoding.cs
@@ -0,0 +1,384 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Text.Encoding.cs
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System.Text {
+
+ [Serializable]
+ public abstract class Encoding {
+ private static ASCIIEncoding ascii_encoding;
+ private static UnicodeEncoding big_endian_unicode;
+ private static UnicodeEncoding unicode_encoding;
+ private static UTF7Encoding utf7_encoding;
+ private static UTF8Encoding utf8_encoding;
+
+ private int codepage;
+
+ protected string body_name;
+ protected string encoding_name;
+ protected string header_name;
+ protected string web_name;
+
+ protected bool is_browser_display = false;
+ protected bool is_browser_save = false;
+ protected bool is_mail_news_display = false;
+ protected bool is_mail_news_save = false;
+
+ private Encoder default_encoder = null;
+ private Decoder default_decoder = null;
+
+ // used for iconv
+ private string iconv_name;
+ private bool big_endian;
+ private Encoder iconv_encoder = null;
+ private Decoder iconv_decoder = null;
+
+ protected Encoding()
+ {
+ }
+
+ protected Encoding (int codepage)
+ {
+ this.codepage = codepage;
+ }
+
+ internal protected Encoding (string name, bool big_endian)
+ {
+ this.iconv_name = name;
+ this.big_endian = big_endian;
+
+ iconv_decoder = new IConvDecoder (iconv_name, big_endian);
+ iconv_encoder = new IConvEncoder (iconv_name, big_endian);
+ }
+
+ public static Encoding Unicode {
+ get {
+ if (unicode_encoding == null) {
+ unicode_encoding = new UnicodeEncoding();
+ }
+ return unicode_encoding;
+ }
+ }
+
+ public static Encoding UTF7 {
+ get {
+ if (utf7_encoding == null) {
+ utf7_encoding = new UTF7Encoding();
+ }
+ return utf7_encoding;
+ }
+ }
+
+ public static Encoding UTF8 {
+ get {
+ if (utf8_encoding == null) {
+ utf8_encoding = new UTF8Encoding();
+ }
+ return utf8_encoding;
+ }
+ }
+
+ public static Encoding ASCII {
+ get {
+ if (ascii_encoding == null)
+ ascii_encoding = new ASCIIEncoding ();
+ return ascii_encoding;
+ }
+ }
+
+ public static Encoding BigEndianUnicode {
+ get {
+ if (big_endian_unicode == null)
+ big_endian_unicode = new UnicodeEncoding (true, true);
+ return big_endian_unicode;
+ }
+ }
+
+ public virtual string BodyName {
+ get {
+ return body_name;
+ }
+ }
+
+ public virtual int CodePage {
+ get {
+ return codepage;
+ }
+ }
+
+ public static Encoding Default {
+ get {
+ return ASCII;
+ }
+ }
+
+ public virtual string EncodingName {
+ get {
+ return encoding_name;
+ }
+ }
+
+ public virtual string HeaderName {
+ get {
+ return header_name;
+ }
+ }
+
+ public virtual bool IsBrowserDisplay {
+ get {
+ return is_browser_display;
+ }
+ }
+
+ public virtual bool IsBrowserSave {
+ get {
+ return is_browser_save;
+ }
+ }
+
+ public virtual bool IsMailNewsDisplay {
+ get {
+ return is_mail_news_display;
+ }
+ }
+
+ public virtual bool IsMailNewsSave {
+ get {
+ return is_mail_news_save;
+ }
+ }
+
+ public virtual string WebName {
+ get {
+ return web_name;
+ }
+ }
+
+ [MonoTODO]
+ public virtual int WindowsCodePage {
+ get {
+ // FIXME
+ return 0;
+ }
+ }
+
+ public static byte[] Convert(Encoding srcEncoding, Encoding dstEncoding, byte[] bytes)
+ {
+ return dstEncoding.GetBytes (srcEncoding.GetChars (bytes));
+ }
+
+ public static byte[] Convert(Encoding srcEncoding, Encoding dstEncoding,
+ byte[] bytes, int index, int count)
+ {
+ return dstEncoding.GetBytes (srcEncoding.GetChars (bytes, index, count));
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is Encoding))
+ return false;
+
+ Encoding e = (Encoding) value;
+
+ if (e.codepage != codepage)
+ return false;
+
+ if (e.body_name != body_name)
+ return false;
+
+ if (e.encoding_name != encoding_name)
+ return false;
+
+ if (e.header_name != header_name)
+ return false;
+
+ return true;
+ }
+
+ public virtual int GetByteCount (char[] chars)
+ {
+ return GetByteCount (chars, 0, chars.Length);
+ }
+
+ public virtual int GetByteCount (string s)
+ {
+ char [] chars = s.ToCharArray ();
+
+ return GetByteCount (chars, 0, chars.Length);
+ }
+
+ public virtual int GetByteCount (char[] chars, int index, int count)
+ {
+ return iconv_encoder.GetByteCount (chars, index, count, false);
+ }
+
+ public virtual byte[] GetBytes(char[] chars)
+ {
+ return GetBytes (chars, 0, chars.Length);
+ }
+
+ public virtual byte[] GetBytes(string s)
+ {
+ char [] chars = s.ToCharArray ();
+ return GetBytes (chars, 0, chars.Length);
+ }
+
+ public virtual byte[] GetBytes(char[] chars, int index, int count)
+ {
+ int bc = GetMaxByteCount (count);
+ byte [] bytes = new byte [bc];
+
+ int len = GetBytes (chars, index, count, bytes, 0);
+ byte [] res = new byte [len];
+
+ Array.Copy (bytes, res, len);
+
+ return res;
+ }
+
+ public virtual int GetBytes (char[] chars, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ return iconv_encoder.GetBytes (chars, charIndex, charCount, bytes, byteIndex, true);
+ }
+
+ public virtual int GetBytes(string s, int charIndex, int charCount,
+ byte[] bytes, int byteIndex)
+ {
+ return GetBytes (s.ToCharArray (), charIndex, charCount, bytes, byteIndex);
+ }
+
+ public virtual int GetCharCount (byte[] bytes)
+ {
+ return GetCharCount (bytes, 0, bytes.Length);
+ }
+
+ public virtual int GetCharCount (byte[] bytes, int index, int count)
+ {
+ return iconv_decoder.GetCharCount (bytes, index, count);
+ }
+
+ public virtual char[] GetChars (byte[] bytes)
+ {
+ return GetChars (bytes, 0, bytes.Length);
+ }
+
+ public virtual char[] GetChars (byte[] bytes, int index, int count)
+ {
+ int cc = GetMaxCharCount (count);
+ char [] chars = new char [cc];
+
+ int len = GetChars (bytes, index, count, chars, 0);
+ char [] res = new char [len];
+
+ Array.Copy (chars, res, len);
+
+ return res;
+ }
+
+ public virtual int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
+ {
+ return iconv_decoder.GetChars (bytes, byteIndex, byteCount, chars, charIndex);
+ }
+
+ public virtual Decoder GetDecoder()
+ {
+ if (iconv_name != null)
+ return new IConvDecoder (iconv_name, big_endian);
+
+ if (default_decoder == null)
+ default_decoder = new DefaultDecoder (this);
+
+ return default_decoder;
+ }
+
+ public virtual Encoder GetEncoder()
+ {
+ if (iconv_name != null)
+ return new IConvEncoder (iconv_name, big_endian);
+
+ if (default_encoder == null)
+ default_encoder = new DefaultEncoder (this);
+
+ return default_encoder;
+ }
+
+ [MonoTODO]
+ public static Encoding GetEncoding (int codepage)
+ {
+ // FIXME
+ return null;
+ }
+
+ [MonoTODO]
+ public static Encoding GetEncoding (string name)
+ {
+ // FIXME
+ return null;
+ }
+
+ [MonoTODO]
+ public override int GetHashCode()
+ {
+ // FIXME
+ return 0;
+ }
+
+ public abstract int GetMaxByteCount (int charCount);
+
+ public abstract int GetMaxCharCount (int byteCount);
+
+ [MonoTODO]
+ public virtual byte[] GetPreamble()
+ {
+ // FIXME
+ return null;
+ }
+
+ public virtual string GetString(byte[] bytes)
+ {
+ return GetString (bytes, 0, bytes.Length);
+ }
+
+ public virtual string GetString(byte[] bytes, int index, int count)
+ {
+ char [] chars = GetChars (bytes, index, count);
+
+ return chars.ToString ();
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ internal extern static IntPtr IConvNewEncoder (string name, bool big_endian);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ internal extern static IntPtr IConvNewDecoder (string name, bool big_endian);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ internal extern static void IConvReset (IntPtr converter);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ internal extern static int IConvGetByteCount (IntPtr converter, char[] chars,
+ int index, int count);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ internal extern static int IConvGetBytes (IntPtr converter, char[] chars, int charIndex,
+ int charCount, byte[] bytes, int byteIndex);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ internal extern static int IConvGetCharCount (IntPtr converter, byte[] bytes,
+ int index, int count);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ internal extern static int IConvGetChars (IntPtr converter, byte[] bytes, int byteIndex,
+ int byteCount, char[] chars, int charIndex);
+ }
+}
diff --git a/mcs/class/corlib/System.Text/StringBuilder.cs b/mcs/class/corlib/System.Text/StringBuilder.cs
new file mode 100644
index 00000000000..78b872e6c5a
--- /dev/null
+++ b/mcs/class/corlib/System.Text/StringBuilder.cs
@@ -0,0 +1,619 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Text.StringBuilder
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Implement the AppendFormat methods. Wasn't sure how
+// best to do this at this early stage, might want to see
+// how the String class and the IFormatProvider / IFormattable interfaces
+// pan out first.
+//
+// TODO: Make sure the coding complies to the ECMA draft, there's some
+// variable names that probably don't (like sString)
+//
+namespace System.Text {
+
+ [MonoTODO ("Implement AppendFormat methods and IFormatProvider, IFormattable")]
+ [Serializable]
+ public sealed class StringBuilder {
+
+ private const int defaultCapacity = 16;
+
+ private int sCapacity;
+ private int sLength;
+ private char[] sString;
+ private int sMaxCapacity = Int32.MaxValue;
+
+ public StringBuilder(string value, int startIndex, int length, int capacity) {
+ // first, check the parameters and throw appropriate exceptions if needed
+ if(null==value) {
+ throw new System.ArgumentNullException("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.");
+ }
+
+ // 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.");
+ }
+
+ // the capacity must be at least as big as the default capacity
+ sCapacity = Math.Max(capacity, defaultCapacity);
+
+ // 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
+ char[] tString = value.ToCharArray(startIndex, sLength);
+ Array.Copy( tString, sString, sLength);
+ }
+ }
+
+ public StringBuilder() : this(String.Empty, 0, 0, 0) {}
+
+ public StringBuilder( int capacity ) : this("", 0, 0, capacity) {}
+
+ public StringBuilder( int capacity, int maxCapacity ) : this("", 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) {}
+
+ [MonoTODO]
+ public int MaxCapacity {
+ get {
+ // TODO: Need to look at the memory of the system to return a useful value here
+ 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;
+ } 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 );
+ Array.Copy( padding.ToCharArray(), 0, tString, sLength, padLength );
+ sString = tString;
+ sLength = sString.Length;
+ sCapacity = value;
+ }
+ }
+ }
+ }
+
+ 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;
+ }
+ }
+
+ public override string ToString() {
+ return 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( 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, length );
+
+ sLength -= length;
+ 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;
+ }
+ }
+
+ 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();
+ string newString;
+
+ 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 = nextIndex; // 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
+ 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 ) );
+ }
+ }
+
+ newString = newStringB.ToString();
+
+ EnsureCapacity( newString.Length );
+ sString = newString.ToCharArray();
+ sLength = newString.Length;
+ return this;
+ }
+
+
+ /* The Append Methods */
+
+ // TODO: Currently most of these methods convert the
+ // parameter to a CharArray (via a String) and then pass
+ // it to Append( char[] ). There might be a faster way
+ // of doing this, but it's probably adequate and anything else
+ // would make it too messy.
+ //
+ // As an example, a sample test run of appending a 100 character
+ // string to the StringBuilder, and loooping this 50,000 times
+ // results in an elapsed time of 2.4s using the MS StringBuilder
+ // and 2.7s using this StringBuilder. Note that this results
+ // in a 5 million character string. I believe MS uses a lot
+ // of "native" DLLs for the "meat" of the base classes.
+
+ [MonoTODO ("Look at all Append methods and complete them if necessary")]
+ 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;
+
+ return this;
+ }
+
+ public StringBuilder Append( string value ) {
+ if( value != null ) {
+ return Append( value.ToCharArray() );
+ } else {
+ return null;
+ }
+ }
+
+ public StringBuilder Append( bool value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Append( byte value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Append( decimal value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Append( double value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Append( short value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Append( int value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Append( long value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Append( object value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append( sbyte value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Append( float value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append( ushort value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append( uint value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Append( ulong value ) {
+ return Append( value.ToString().ToCharArray() );
+ }
+
+ 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++;
+
+ return this;
+ }
+
+ public StringBuilder Append( char value, int repeatCount ) {
+ if( repeatCount < 0 ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ return Append( new String( value, repeatCount) );
+ }
+
+ 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();
+ }
+
+ return Append( value.Substring( startIndex, count ).ToCharArray() );
+ }
+
+ [MonoTODO]
+ public StringBuilder AppendFormat( string format, object arg0 ) {
+ // TODO: Implement
+ return this;
+ }
+
+ [MonoTODO]
+ public StringBuilder AppendFormat( string format, params object[] args ) {
+ // TODO: Implement
+ return this;
+ }
+
+ [MonoTODO]
+ public StringBuilder AppendFormat( IFormatProvider provider, string format,
+ params object[] args ) {
+ // TODO: Implement
+ return this;
+ }
+
+ [MonoTODO]
+ public StringBuilder AppendFormat( string format, object arg0, object arg1 ) {
+ // TODO: Implement;
+ return this;
+ }
+
+ [MonoTODO]
+ public StringBuilder AppendFormat( string format, object arg0, object arg1, object arg2 ) {
+ // TODO Implement
+ return this;
+ }
+
+ /* The Insert Functions */
+
+ // Similarly to the Append functions, get everything down to a CharArray
+ // and insert that.
+
+ 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;
+ return this;
+ }
+ }
+
+ public StringBuilder Insert( int index, string value ) {
+ return Insert( index, value.ToCharArray() );
+ }
+
+ public StringBuilder Insert( int index, bool value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Insert( int index, byte value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Insert( int index, char value) {
+ char[] insertChar = new char[1];
+
+ insertChar[0] = value;
+ return Insert( index, insertChar );
+ }
+
+ public StringBuilder Insert( int index, decimal value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Insert( int index, double value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Insert( int index, short value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Insert( int index, int value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Insert( int index, long value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Insert( int index, object value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert( int index, sbyte value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ public StringBuilder Insert( int index, float value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert( int index, ushort value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert( int index, uint value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ [CLSCompliant(false)]
+ public StringBuilder Insert( int index, ulong value ) {
+ return Insert( index, value.ToString().ToCharArray() );
+ }
+
+ 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.ToCharArray() );
+ }
+ }
+ }
+ 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;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Text/UTF7Encoding.cs b/mcs/class/corlib/System.Text/UTF7Encoding.cs
new file mode 100755
index 00000000000..91fd3604236
--- /dev/null
+++ b/mcs/class/corlib/System.Text/UTF7Encoding.cs
@@ -0,0 +1,42 @@
+//
+// System.Text.UTF7Encoding.cs
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Text {
+
+ public class UTF7Encoding : Encoding
+ {
+ public UTF7Encoding () : base ("UTF-7", false)
+ {
+ encoding_name = "Unicode (UTF-7)";
+ body_name = "utf-7";
+ header_name = "utf-7";
+ web_name = "utf-7";
+ is_browser_display = false;
+ is_browser_save = false;
+ is_mail_news_display = true;
+ is_mail_news_save = true;
+
+ }
+
+ [MonoTODO]
+ public override int GetMaxByteCount (int charCount)
+ {
+ // FIXME: dont know if this is right
+ return charCount*6;
+ }
+
+ public override int GetMaxCharCount (int byteCount)
+ {
+ return byteCount;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System.Text/UTF8Encoding.cs b/mcs/class/corlib/System.Text/UTF8Encoding.cs
new file mode 100755
index 00000000000..4f1e58a3f5f
--- /dev/null
+++ b/mcs/class/corlib/System.Text/UTF8Encoding.cs
@@ -0,0 +1,38 @@
+//
+// System.Text.UTF8Encoding.cs
+//
+// Authors:
+// Sean MacIsaac (macisaac@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System.Text
+{
+ [Serializable]
+ public class UTF8Encoding : Encoding
+ {
+ public UTF8Encoding () : base ("UTF-8", false)
+ {
+ encoding_name = "Unicode (UTF-8)";
+ body_name = "utf-8";
+ header_name = "utf-8";
+ web_name = "utf-8";
+ is_browser_display = true;
+ is_browser_save = true;
+ is_mail_news_display = true;
+ is_mail_news_save = true;
+ }
+
+ public override int GetMaxByteCount (int charCount)
+ {
+ return charCount*6;
+ }
+
+ public override int GetMaxCharCount (int byteCount)
+ {
+ return byteCount;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Text/UnicodeEncoding.cs b/mcs/class/corlib/System.Text/UnicodeEncoding.cs
new file mode 100755
index 00000000000..8758c6b2623
--- /dev/null
+++ b/mcs/class/corlib/System.Text/UnicodeEncoding.cs
@@ -0,0 +1,55 @@
+// -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+//
+// System.Text.UnicodeEncoding.cs
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+// FIXME: implement byteOrderMark
+
+namespace System.Text {
+
+ [MonoTODO]
+ [Serializable]
+ public class UnicodeEncoding : Encoding
+ {
+ private bool byteOrderMark;
+
+ private void init (bool byteOrderMark)
+ {
+ this.byteOrderMark = byteOrderMark;
+ encoding_name = "Unicode";
+ body_name = "utf-16";
+ header_name = "utf-16";
+ web_name = "utf-16";
+ is_browser_display = false;
+ is_browser_save = true;
+ is_mail_news_display = false;
+ is_mail_news_save = false;
+ }
+
+ public UnicodeEncoding () : base ("UNICODE", false)
+ {
+ init (false);
+ }
+
+ public UnicodeEncoding (bool bigEndian, bool byteOrderMark) : base ("UNICODE", bigEndian)
+ {
+ init (byteOrderMark);
+ }
+
+ public override int GetMaxByteCount (int charCount)
+ {
+ return charCount;
+ }
+
+ public override int GetMaxCharCount (int byteCount)
+ {
+ return byteCount / 2;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ApartmentState.cs b/mcs/class/corlib/System.Threading/ApartmentState.cs
new file mode 100755
index 00000000000..0dfc50785b4
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ApartmentState.cs
@@ -0,0 +1,18 @@
+//
+// System.Threading.ApartmentState.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public enum ApartmentState {
+ STA = 0,
+ MTA = 1,
+ Unknown = 2
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/AutoResetEvent.cs b/mcs/class/corlib/System.Threading/AutoResetEvent.cs
new file mode 100755
index 00000000000..3b5d71e63be
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/AutoResetEvent.cs
@@ -0,0 +1,35 @@
+//
+// System.Threading.AutoResetEvent.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+// Veronica De Santis (veron78@interfree.it)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+
+ public sealed class AutoResetEvent : WaitHandle
+ {
+ // Constructor
+ public AutoResetEvent(bool initialState) {
+ os_handle = NativeEventCalls.CreateEvent_internal(false,initialState,null);
+ }
+
+ // Methods
+
+ public bool Set() {
+ return(NativeEventCalls.SetEvent_internal(os_handle));
+ }
+
+ public bool Reset() {
+ return(NativeEventCalls.ResetEvent_internal(os_handle));
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ChangeLog b/mcs/class/corlib/System.Threading/ChangeLog
new file mode 100644
index 00000000000..3be8c9f67be
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ChangeLog
@@ -0,0 +1,141 @@
+2002-04-14 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * Interlocked.cs: made all methods icalls.
+
+2002-04-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IOCompletionCallback.cs: added attributes to the delegate
+ (CLSCompliant(false) and Serializable).
+
+2002-04-14 Patrik Torstensson <patrik.torstensson@labs2.com>
+ * Thread.cs: Fixed IsThreadPoolThread to use a internal property instead of extending
+ the threadstate enum.
+ * ThreadPool.cs: Now using the internal Isthreadpoolthread property
+ * ThreadState.cs: removed non-standard enum (ThreadPoolThread)
+
+2002-04-14 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * ThreadState.cs: Added enum for threadpool thread
+ * Thread.cs: changed the set/clr_state to be internal (used from threadpool)
+ * Thread.cs: Added IsThreadPoolThread
+ * ThreadPool.cs: Implementation of QueueUserWorkItem
+
+Wed Feb 13 21:51:30 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Thread.cs: implement CurrentCulture property needed by
+ Convert.ChangeType() (used when compiling enums).
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * ManualResetEvent.cs:
+ * AutoResetEvent.cs: Fixed DOS line endings
+
+2002-01-22 Veronica De Santis <veron78@interfree.it>
+
+ * NativeEventCalls : Class that contains internal calls shared by Auto
+ and Manual Reset Events
+ * AutoResetEvents.cs : Added class AutoResetEvents and its implementation
+ * ManualResetEvents.cs : Added class ManualResetEvents and its implementation
+
+2002-01-16 Veronica De Santis <veron78@interfree.it>
+
+ * WaitHandle.cs : Renamed handle to os_handle and make it protected
+ instead of private.
+ * Mutex.cs : Write the System.Threading.Mutex methods ( constructors
+ and the ReleaseMutex)
+
+2002-01-15 Dick Porter <dick@ximian.com>
+
+ * WaitHandle.cs:
+ * Thread.cs: Make the runtime's idea of infinite timeouts coincide
+ with the class library's
+
+2002-01-10 Dick Porter <dick@ximian.com>
+
+ * WaitHandle.cs: Added checks for too many handles and null
+ handles in WaitAll() and WaitAny
+
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * AutoResetEvent.cs, ManualResetEvent.cs, Monitor.cs : MonoTODO
+ decoration.
+
+ * Mutex.cs, Overlapped.cs, ReaderWriterLock.cs, RegisteredWaitHandle.cs,
+ Thread.cs, ThreadAbortException.cs, ThreadPool.cs, Timer.cs, WaitHandler.cs : Ditto.
+
+2001-12-11 Dick Porter <dick@ximian.com>
+
+ * WaitHandle.cs: Implemented WaitAll(), WaitAny() and WaitOne() as
+ internal calls.
+
+2001-11-26 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: DataSlot uses a single system TLS slot, and a
+ hashtable per thread. Some minor changes to reflect the new
+ internal calls using the new IO library, and the newly-supported
+ bool returns from internal calls.
+
+ * Monitor.cs: Use bool returns from internal calls now they are
+ supported by the runtime. Coalesce enter with the try_enter
+ internal call.
+
+Wed Nov 14 17:06:18 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Overlapped.cs, ThreadPool.cs, Timer.cs: CLSCompliant updates.
+
+2001-10-03 Dick Porter <dick@ximian.com>
+
+ * Monitor.cs: Implemented all methods except the two Wait()
+ methods that take boolean parameters
+
+2001-09-28 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: Implemented AllocateDataSlot(),
+ AllocateNamedDataSlot(), FreeNamedDataSlot(), GetData(),
+ GetNamedDataSlot(), SetData(), IsBackground. Reworked Thread()
+ and Start() to avoid a race condition. Added thread-safe state
+ changing private operations.
+
+ * Monitor.cs: Comment out the GetType() calls because it isn't implemented yet
+
+2001-09-25 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: Implement Join and timed Join, set correct state
+ around Start, Join and Sleep calls, implement IsAlive and
+ ThreadState properties.
+
+ * ThreadState.cs (Threading): Added StopRequested,
+ SuspendRequested, Suspended values
+
+2001-09-23 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: Implemented CurrentThread and Sleep (both versions)
+ with internal calls, and Name.
+
+2001-09-21 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: Implement Thread(ThreadStart) constructor and Start()
+ with an internal call
+
+ * WaitHandle.cs: Close calls Dispose(false)
+
+2001-09-13 Dick Porter <dick@ximian.com>
+
+ * ApartmentState.cs (Threading): Set the correct enum values
+
+2001-09-13 Dick Porter <dick@ximian.com>
+
+ * ApartmentState.cs, AutoResetEvent.cs, IOCompletionCallback.cs,
+ Interlocked.cs, LockCookie.cs, ManualResetEvent.cs, Monitor.cs,
+ Mutex.cs, NativeOverlapped.cs, Overlapped.cs, ReaderWriterLock.cs,
+ RegisteredWaitHandle.cs, SynchronizationLockException.cs,
+ Thread.cs, ThreadAbortException.cs, ThreadInterruptedException.cs,
+ ThreadPool.cs, ThreadStart.cs, ThreadStateException.cs,
+ Timeout.cs, Timer.cs, TimerCallback.cs, WaitCallback.cs,
+ WaitHandle.cs, WaitOrTimerCallback.cs: System.Threading class
+ stubs.
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * ThreadPriority.cs, ThreadState.cs: Add.
diff --git a/mcs/class/corlib/System.Threading/IOCompletionCallback.cs b/mcs/class/corlib/System.Threading/IOCompletionCallback.cs
new file mode 100755
index 00000000000..d384f8a29b7
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/IOCompletionCallback.cs
@@ -0,0 +1,18 @@
+//
+// System.Threading.IOCompletionCallback.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ // 'unsafe' wasn't in the spec, but the compiler insists because of
+ // the pointer.
+ [Serializable]
+ [CLSCompliant(false)]
+ public unsafe delegate void IOCompletionCallback(uint errorCode, uint numBytes, NativeOverlapped *pOVERLAP);
+}
diff --git a/mcs/class/corlib/System.Threading/Interlocked.cs b/mcs/class/corlib/System.Threading/Interlocked.cs
new file mode 100755
index 00000000000..d5d6a28df3a
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Interlocked.cs
@@ -0,0 +1,51 @@
+//
+// System.Threading.Interlocked.cs
+//
+// Author:
+// Patrik Torstensson (patrik.torstensson@labs2.com)
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+ public sealed class Interlocked
+ {
+ private Interlocked () {}
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static int CompareExchange(ref int location1, int value, int comparand);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static object CompareExchange(ref object location1, object value, object comparand);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static float CompareExchange(ref float location1, float value, float comparand);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static int Decrement(ref int location);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static long Decrement(ref long location);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static int Increment(ref int location);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static long Increment(ref long location);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static int Exchange(ref int location1, int value);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static object Exchange(ref object location1, object value);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern static float Exchange(ref float location1, float value);
+ }
+}
+
diff --git a/mcs/class/corlib/System.Threading/LockCookie.cs b/mcs/class/corlib/System.Threading/LockCookie.cs
new file mode 100755
index 00000000000..e3d226c8b0e
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/LockCookie.cs
@@ -0,0 +1,17 @@
+//
+// System.Threading.LockCookie.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ [Serializable]
+ public struct LockCookie
+ {
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ManualResetEvent.cs b/mcs/class/corlib/System.Threading/ManualResetEvent.cs
new file mode 100755
index 00000000000..a3a3be44112
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ManualResetEvent.cs
@@ -0,0 +1,38 @@
+//
+// System.Threading.ManualResetEvent.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+// Veronica De Santis (veron78@interfree.it)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+
+ public sealed class ManualResetEvent : WaitHandle
+ {
+ // Constructor
+ public ManualResetEvent (bool initialState)
+ {
+ os_handle = NativeEventCalls.CreateEvent_internal (true, initialState, null);
+ }
+
+ // Methods
+
+ public bool Set()
+ {
+ return (NativeEventCalls.SetEvent_internal (os_handle));
+ }
+
+ public bool Reset()
+ {
+ return(NativeEventCalls.ResetEvent_internal (os_handle));
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Monitor.cs b/mcs/class/corlib/System.Threading/Monitor.cs
new file mode 100755
index 00000000000..14fe105e6f1
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Monitor.cs
@@ -0,0 +1,219 @@
+//
+// System.Threading.Monitor.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+ public sealed class Monitor
+ {
+ private Monitor () {}
+
+ // Grabs the mutex on object 'obj', with a maximum
+ // wait time 'ms' but doesn't block - if it can't get
+ // the lock it returns false, true if it can
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool Monitor_try_enter(object obj, int ms);
+ public static void Enter(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ //if(obj.GetType().IsValueType==true) {
+ // throw new ArgumentException("Value type");
+ //}
+
+ Monitor_try_enter(obj, Timeout.Infinite);
+ }
+
+ // Releases the mutex on object 'obj'
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Monitor_exit(object obj);
+
+ // Checks whether the current thread currently owns
+ // the lock on object 'obj'
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool Monitor_test_owner(object obj);
+
+ public static void Exit(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ //if(obj.GetType().IsValueType==true) {
+ // throw new ArgumentException("Value type");
+ //}
+
+ if(Monitor_test_owner(obj)==false) {
+ throw new SynchronizationLockException("The current thread does not own the lock");
+ }
+
+ Monitor_exit(obj);
+ }
+
+ // Signals one of potentially many objects waiting on
+ // object 'obj'
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Monitor_pulse(object obj);
+
+ // Checks whether object 'obj' is currently synchronised
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool Monitor_test_synchronised(object obj);
+
+ public static void Pulse(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ if(Monitor_test_synchronised(obj)==false) {
+ throw new SynchronizationLockException("Object is not synchronised");
+ }
+
+ Monitor_pulse(obj);
+ }
+
+ // Signals all of potentially many objects waiting on
+ // object 'obj'
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Monitor_pulse_all(object obj);
+
+ public static void PulseAll(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ if(Monitor_test_synchronised(obj)==false) {
+ throw new SynchronizationLockException("Object is not synchronised");
+ }
+
+ Monitor_pulse_all(obj);
+ }
+
+ public static bool TryEnter(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ //if(obj.GetType().IsValueType==true) {
+ // throw new ArgumentException("Value type");
+ //}
+
+ return(Monitor_try_enter(obj, 0));
+ }
+
+ public static bool TryEnter(object obj, int millisecondsTimeout) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ //if(obj.GetType().IsValueType==true) {
+ // throw new ArgumentException("Value type");
+ //}
+
+ // LAMESPEC: should throw an exception when ms<0, but
+ // Timeout.Infinite is -1
+ if(millisecondsTimeout == Timeout.Infinite) {
+ Enter(obj);
+ return(true);
+ }
+
+ if(millisecondsTimeout<0) {
+ throw new ArgumentException("millisecondsTimeout negative");
+ }
+
+ return(Monitor_try_enter(obj, millisecondsTimeout));
+ }
+
+ public static bool TryEnter(object obj, TimeSpan timeout) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ //if(obj.GetType().IsValueType==true) {
+ // throw new ArgumentException("Value type");
+ //}
+
+ // LAMESPEC: should throw an exception when ms<0, but
+ // Timeout.Infinite is -1
+ if(timeout.Milliseconds == Timeout.Infinite) {
+ Enter(obj);
+ return(true);
+ }
+
+ if(timeout.Milliseconds < 0 ||
+ timeout.Milliseconds > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("timeout out of range");
+ }
+
+ return(Monitor_try_enter(obj, timeout.Milliseconds));
+ }
+
+ // Waits for a signal on object 'obj' with maximum
+ // wait time 'ms'. Returns true if the object was
+ // signalled, false if it timed out
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool Monitor_wait(object obj, int ms);
+
+ public static bool Wait(object obj) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ if(Monitor_test_synchronised(obj)==false) {
+ throw new SynchronizationLockException("Object is not synchronised");
+ }
+
+ return(Monitor_wait(obj, 0));
+ }
+
+ public static bool Wait(object obj, int millisecondsTimeout) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ if(Monitor_test_synchronised(obj)==false) {
+ throw new SynchronizationLockException("Object is not synchronised");
+ }
+ // LAMESPEC: no mention of timeout sanity checking
+
+ return(Monitor_wait(obj, millisecondsTimeout));
+ }
+
+ public static bool Wait(object obj, TimeSpan timeout) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ // LAMESPEC: says to throw ArgumentException too
+ if(timeout.Milliseconds < 0 || timeout.Milliseconds > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("timeout out of range");
+ }
+ if(Monitor_test_synchronised(obj)==false) {
+ throw new SynchronizationLockException("Object is not synchronised");
+ }
+
+ return(Monitor_wait(obj, timeout.Milliseconds));
+ }
+
+ [MonoTODO]
+ public static bool Wait(object obj, int millisecondsTimeout, bool exitContext) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ // FIXME when I understand what a
+ // "synchronisation domain" is and does
+ return(false);
+ }
+
+ [MonoTODO]
+ public static bool Wait(object obj, TimeSpan timeout, bool exitContext) {
+ if(obj==null) {
+ throw new ArgumentNullException("Object is null");
+ }
+ // LAMESPEC: says to throw ArgumentException too
+ if(timeout.Milliseconds < 0 || timeout.Milliseconds > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("timeout out of range");
+ }
+
+ // FIXME when I understand what a
+ // "synchronisation domain" is and does
+ return(false);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Mutex.cs b/mcs/class/corlib/System.Threading/Mutex.cs
new file mode 100755
index 00000000000..f0926bf023a
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Mutex.cs
@@ -0,0 +1,49 @@
+//
+// System.Threading.Mutex.cs
+//
+// Author:
+//
+// Dick Porter (dick@ximian.com)
+// Veronica De Santis (veron78@interfree.it)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+ public sealed class Mutex : WaitHandle
+ {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern IntPtr CreateMutex_internal(
+ bool initiallyOwned,
+ string name);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void ReleaseMutex_internal(IntPtr handle);
+
+ public Mutex() {
+ os_handle=CreateMutex_internal(false,null);
+ }
+
+ public Mutex(bool initiallyOwned) {
+ os_handle=CreateMutex_internal(initiallyOwned,null);
+ }
+
+ public Mutex(bool initiallyOwned, string name) {
+ os_handle=CreateMutex_internal(initiallyOwned,name);
+ }
+
+
+ public Mutex(bool initiallyOwned, string name, out bool gotOwnership) {
+ os_handle=CreateMutex_internal(initiallyOwned,name);
+ gotOwnership=false;
+ }
+
+ public void ReleaseMutex() {
+ ReleaseMutex_internal(os_handle);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/NativeEventCalls.cs b/mcs/class/corlib/System.Threading/NativeEventCalls.cs
new file mode 100755
index 00000000000..08dd8363f23
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/NativeEventCalls.cs
@@ -0,0 +1,28 @@
+//
+// System.Threading.AutoResetEvent.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+// Veronica De Santis (veron78@interfree.it)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+ internal sealed class NativeEventCalls
+ {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern IntPtr CreateEvent_internal(bool manual,bool initial,string name);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern bool SetEvent_internal(IntPtr handle);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern bool ResetEvent_internal(IntPtr handle);
+
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/NativeOverlapped.cs b/mcs/class/corlib/System.Threading/NativeOverlapped.cs
new file mode 100755
index 00000000000..2f681fba4ba
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/NativeOverlapped.cs
@@ -0,0 +1,27 @@
+//
+// System.Threading.NativeOverlapped.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.InteropServices;
+
+namespace System.Threading
+{
+ public struct NativeOverlapped {
+ public int EventHandle;
+ public int InternalHigh;
+ public int InternalLow;
+ public int OffsetHigh;
+ public int OffsetLow;
+
+ // (fields disappeared beta2 -> 1.0)
+
+ // public GCHandle ReservedClassLib;
+ // public int ReservedCOR1;
+ // public GCHandle ReservedCOR2;
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Overlapped.cs b/mcs/class/corlib/System.Threading/Overlapped.cs
new file mode 100755
index 00000000000..25f33bf8d5d
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Overlapped.cs
@@ -0,0 +1,92 @@
+//
+// System.Threading.Overlapped.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public class Overlapped
+ {
+ [CLSCompliant(false)][MonoTODO]
+ unsafe public static void Free(NativeOverlapped *nativeOverlappedPtr) {
+ // FIXME
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ unsafe public static Overlapped Unpack(NativeOverlapped *nativeOverlappedPtr) {
+ // FIXME
+ return(new Overlapped());
+ }
+
+ [MonoTODO]
+ public Overlapped() {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public Overlapped(int offsetLo, int offsetHi, int hEvent, IAsyncResult ar) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public IAsyncResult AsyncResult {
+ get {
+ // FIXME
+ return(null);
+ }
+
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public int EventHandle {
+ get {
+ // FIXME
+ return(0);
+ }
+
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public int OffsetHigh {
+ get {
+ // FIXME
+ return(0);
+ }
+
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public int OffsetLow {
+ get {
+ // FIXME
+ return(0);
+ }
+
+ set {
+ }
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ unsafe public NativeOverlapped *Pack(IOCompletionCallback iocb) {
+ // FIXME
+ return(null);
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ unsafe public NativeOverlapped *UnsafePack(IOCompletionCallback iocb) {
+ // FIXME
+ return(null);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ReaderWriterLock.cs b/mcs/class/corlib/System.Threading/ReaderWriterLock.cs
new file mode 100755
index 00000000000..95784811682
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ReaderWriterLock.cs
@@ -0,0 +1,109 @@
+//
+// System.Threading.ReaderWriterLock.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public sealed class ReaderWriterLock
+ {
+ [MonoTODO]
+ public ReaderWriterLock() {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public bool IsReaderLockHeld {
+ get {
+ // FIXME
+ return(false);
+ }
+ }
+
+ [MonoTODO]
+ public bool IsWriterLockHeld {
+ get {
+ // FIXME
+ return(false);
+ }
+ }
+
+ [MonoTODO]
+ public int WriterSeqNum {
+ get {
+ // FIXME
+ return(0);
+ }
+ }
+
+
+ [MonoTODO]
+ public void AcquireReaderLock(int millisecondsTimeout) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void AcquireReaderLock(TimeSpan timeout) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void AcquireWriterLock(int millisecondsTimeout) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void AcquireWriterLock(TimeSpan timeout) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public bool AnyWritersSince(int seqNum) {
+ // FIXME
+ return(false);
+ }
+
+ [MonoTODO]
+ public void DowngradeFromWriterLock(ref LockCookie lockCookie) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public LockCookie ReleaseLock() {
+ // FIXME
+ return(new LockCookie());
+ }
+
+ [MonoTODO]
+ public void ReleaseReaderLock() {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void ReleaseWriterLock() {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void RestoreLock(ref LockCookie lockCookie) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public LockCookie UpgradeToWriterLock(int millisecondsTimeout) {
+ // FIXME
+ return(new LockCookie());
+ }
+
+ [MonoTODO]
+ public LockCookie UpgradeToWriterLock(TimeSpan timeout) {
+ // FIXME
+ return(new LockCookie());
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/RegisteredWaitHandle.cs b/mcs/class/corlib/System.Threading/RegisteredWaitHandle.cs
new file mode 100755
index 00000000000..8cf4d449da8
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/RegisteredWaitHandle.cs
@@ -0,0 +1,28 @@
+//
+// System.Threading.RegisteredWaitHandle.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public sealed class RegisteredWaitHandle : MarshalByRefObject
+ {
+ internal RegisteredWaitHandle () {}
+
+ [MonoTODO]
+ public bool Unregister(WaitHandle waitObject) {
+ // FIXME
+ return(false);
+ }
+
+ [MonoTODO]
+ ~RegisteredWaitHandle() {
+ // FIXME
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/SynchronizationLockException.cs b/mcs/class/corlib/System.Threading/SynchronizationLockException.cs
new file mode 100755
index 00000000000..7d5c8090e17
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/SynchronizationLockException.cs
@@ -0,0 +1,33 @@
+//
+// System.Threading.SynchronizationLockException.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Threading
+{
+ [Serializable]
+ public class SynchronizationLockException : SystemException
+ {
+ public SynchronizationLockException()
+ : base ("Synchronization Error") {
+ }
+
+ public SynchronizationLockException(string message)
+ : base (message) {
+ }
+
+ protected SynchronizationLockException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public SynchronizationLockException(string message, Exception innerException)
+ : base (message, innerException) {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs
new file mode 100755
index 00000000000..4cffb28d374
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Thread.cs
@@ -0,0 +1,426 @@
+//
+// System.Threading.Thread.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting.Contexts;
+using System.Security.Principal;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Collections;
+
+namespace System.Threading
+{
+ public sealed class Thread
+ {
+ private bool threadpool_thread = false;
+ private CultureInfo current_culture;
+
+ [MonoTODO]
+ public static Context CurrentContext {
+ get {
+ // FIXME -
+ // System.Runtime.Remoting.Context not
+ // yet implemented
+ return(null);
+ }
+ }
+
+ [MonoTODO]
+ public static IPrincipal CurrentPrincipal {
+ get {
+ // FIXME -
+ // System.Security.Principal.IPrincipal
+ // not yet implemented
+ return(null);
+ }
+
+ set {
+ }
+ }
+
+ // Looks up the object associated with the current thread
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static Thread CurrentThread_internal();
+
+ public static Thread CurrentThread {
+ get {
+ return(CurrentThread_internal());
+ }
+ }
+
+ // Looks up the slot hash for the current thread
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static Hashtable SlotHash_lookup();
+
+ // Stores the slot hash for the current thread
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void SlotHash_store(Hashtable slothash);
+
+ private static Hashtable GetTLSSlotHash() {
+ Hashtable slothash=SlotHash_lookup();
+ if(slothash==null) {
+ // Not synchronised, because this is
+ // thread specific anyway.
+ slothash=new Hashtable();
+ SlotHash_store(slothash);
+ }
+
+ return(slothash);
+ }
+
+ public static LocalDataStoreSlot AllocateDataSlot() {
+ LocalDataStoreSlot slot = new LocalDataStoreSlot();
+
+ return(slot);
+ }
+
+ // Stores a hash keyed by strings of LocalDataStoreSlot objects
+ static Hashtable datastorehash = Hashtable.Synchronized(new Hashtable());
+
+ public static LocalDataStoreSlot AllocateNamedDataSlot(string name) {
+ LocalDataStoreSlot slot = (LocalDataStoreSlot)datastorehash[name];
+ if(slot!=null) {
+ // This exception isnt documented (of
+ // course) but .net throws it
+ throw new ArgumentException("Named data slot already added");
+ }
+
+ slot = new LocalDataStoreSlot();
+
+ datastorehash.Add(name, slot);
+
+ return(slot);
+ }
+
+ public static void FreeNamedDataSlot(string name) {
+ LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name];
+
+ if(slot!=null) {
+ datastorehash.Remove(slot);
+ }
+ }
+
+ public static object GetData(LocalDataStoreSlot slot) {
+ Hashtable slothash=GetTLSSlotHash();
+ return(slothash[slot]);
+ }
+
+ [MonoTODO]
+ public static AppDomain GetDomain() {
+ // FIXME
+ return(null);
+ }
+
+ [MonoTODO]
+ public static int GetDomainID() {
+ // FIXME
+ return(0);
+ }
+
+ public static LocalDataStoreSlot GetNamedDataSlot(string name) {
+ LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name];
+
+ if(slot==null) {
+ slot=AllocateNamedDataSlot(name);
+ }
+
+ return(slot);
+ }
+
+ [MonoTODO]
+ public static void ResetAbort() {
+ // FIXME
+ }
+
+ public static void SetData(LocalDataStoreSlot slot,
+ object data) {
+ Hashtable slothash=GetTLSSlotHash();
+ slothash.Add(slot, data);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static void Sleep_internal(int ms);
+
+ public static void Sleep(int millisecondsTimeout) {
+ if(millisecondsTimeout<0) {
+ throw new ArgumentException("Negative timeout");
+ }
+ Thread thread=CurrentThread;
+
+ thread.set_state(ThreadState.WaitSleepJoin);
+
+ Sleep_internal(millisecondsTimeout);
+ thread.clr_state(ThreadState.WaitSleepJoin);
+ }
+
+ public static void Sleep(TimeSpan timeout) {
+ // LAMESPEC: says to throw ArgumentException too
+ if(timeout.Milliseconds < 0 || timeout.Milliseconds > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("Timeout out of range");
+ }
+
+ Thread thread=CurrentThread;
+
+ thread.set_state(ThreadState.WaitSleepJoin);
+ Sleep_internal(timeout.Milliseconds);
+ thread.clr_state(ThreadState.WaitSleepJoin);
+ }
+
+ // stores a thread handle
+ private IntPtr system_thread_handle;
+
+ // Returns the system thread handle
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern IntPtr Thread_internal(ThreadStart start);
+
+ public Thread(ThreadStart start) {
+ if(start==null) {
+ throw new ArgumentNullException("Null ThreadStart");
+ }
+
+ // 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);
+ }
+
+ [MonoTODO]
+ public ApartmentState ApartmentState {
+ get {
+ // FIXME
+ return(ApartmentState.Unknown);
+ }
+
+ set {
+ }
+ }
+
+ [MonoTODO]
+ public CultureInfo CurrentCulture {
+ get {
+ if (current_culture == null)
+ current_culture = new CultureInfo ("");
+ return current_culture;
+ }
+
+ set {
+ current_culture = value;
+ }
+ }
+
+ [MonoTODO]
+ public CultureInfo CurrentUICulture {
+ get {
+ // FIXME
+ return(null);
+ }
+
+ set {
+ }
+ }
+
+ public bool IsThreadPoolThread {
+ get {
+ return IsThreadPoolThreadInternal;
+ }
+ }
+
+ internal bool IsThreadPoolThreadInternal {
+ get {
+ return threadpool_thread;
+ }
+ set {
+ threadpool_thread = value;
+ }
+ }
+
+ public bool IsAlive {
+ get {
+ // LAMESPEC: is a Stopped or Suspended
+ // thread dead?
+ ThreadState curstate=state;
+
+ if((curstate & ThreadState.Aborted) != 0 ||
+ (curstate & ThreadState.AbortRequested) != 0 ||
+ (curstate & ThreadState.Unstarted) != 0) {
+ return(false);
+ } else {
+ return(true);
+ }
+ }
+ }
+
+ public bool IsBackground {
+ get {
+ if((state & ThreadState.Background) != 0) {
+ return(true);
+ } else {
+ return(false);
+ }
+ }
+
+ set {
+ if(value==true) {
+ set_state(ThreadState.Background);
+ } else {
+ clr_state(ThreadState.Background);
+ }
+ }
+ }
+
+ private string thread_name=null;
+
+ public string Name {
+ get {
+ return(thread_name);
+ }
+
+ set {
+ thread_name=value;
+ }
+ }
+
+ [MonoTODO]
+ public ThreadPriority Priority {
+ get {
+ // FIXME
+ return(ThreadPriority.Lowest);
+ }
+
+ set {
+ }
+ }
+
+ private ThreadState state=ThreadState.Unstarted;
+
+ public ThreadState ThreadState {
+ get {
+ return(state);
+ }
+ }
+
+ [MonoTODO]
+ public void Abort() {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void Abort(object stateInfo) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public void Interrupt() {
+ // FIXME
+ }
+
+ // The current thread joins with 'this'. Set ms to 0 to block
+ // until this actually exits.
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern bool Join_internal(int ms, IntPtr handle);
+
+ public void Join() {
+ if((state & ThreadState.Unstarted) != 0) {
+ throw new ThreadStateException("Thread has not been started");
+ }
+
+ Thread thread=CurrentThread;
+
+ thread.set_state(ThreadState.WaitSleepJoin);
+ Join_internal(Timeout.Infinite, system_thread_handle);
+ thread.clr_state(ThreadState.WaitSleepJoin);
+ }
+
+ public bool Join(int millisecondsTimeout) {
+ if(millisecondsTimeout<0) {
+ throw new ArgumentException("Timeout less than zero");
+ }
+ if((state & ThreadState.Unstarted) != 0) {
+ throw new ThreadStateException("Thread has not been started");
+ }
+
+ Thread thread=CurrentThread;
+
+ thread.set_state(ThreadState.WaitSleepJoin);
+ bool ret=Join_internal(millisecondsTimeout,
+ system_thread_handle);
+ thread.clr_state(ThreadState.WaitSleepJoin);
+
+ return(ret);
+ }
+
+ public bool Join(TimeSpan timeout) {
+ // LAMESPEC: says to throw ArgumentException too
+ if(timeout.Milliseconds < 0 || timeout.Milliseconds > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("timeout out of range");
+ }
+ if((state & ThreadState.Unstarted) != 0) {
+ throw new ThreadStateException("Thread has not been started");
+ }
+
+ Thread thread=CurrentThread;
+
+ thread.set_state(ThreadState.WaitSleepJoin);
+ bool ret=Join_internal(timeout.Milliseconds,
+ system_thread_handle);
+ thread.clr_state(ThreadState.WaitSleepJoin);
+
+ return(ret);
+ }
+
+ [MonoTODO]
+ public void Resume() {
+ // FIXME
+ }
+
+ // Launches the thread
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void Start_internal(IntPtr handle);
+
+ public void Start() {
+ if((state & ThreadState.Unstarted) == 0) {
+ throw new ThreadStateException("Thread has already been started");
+ }
+
+ // Mark the thread state as Running (which is
+ // all bits cleared). Therefore just remove
+ // the Unstarted bit
+ clr_state(ThreadState.Unstarted);
+
+ // Launch this thread
+ Start_internal(system_thread_handle);
+ }
+
+ [MonoTODO]
+ public void Suspend() {
+ if((state & ThreadState.Unstarted) != 0 || !IsAlive) {
+ throw new ThreadStateException("Thread has not been started, or is dead");
+ }
+
+ set_state(ThreadState.SuspendRequested);
+ // FIXME - somehow let the interpreter know that
+ // this thread should now suspend
+ }
+
+ [MonoTODO]
+ ~Thread() {
+ // FIXME
+ }
+
+ private void set_state(ThreadState set) {
+ lock(this) {
+ state |= set;
+ }
+ }
+ private void clr_state(ThreadState clr) {
+ lock(this) {
+ state &= ~clr;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ThreadAbortException.cs b/mcs/class/corlib/System.Threading/ThreadAbortException.cs
new file mode 100755
index 00000000000..d91ef0a79df
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadAbortException.cs
@@ -0,0 +1,26 @@
+//
+// System.Threading.ThreadAbortException.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ [Serializable]
+ public sealed class ThreadAbortException : SystemException
+ {
+ private ThreadAbortException () {}
+
+ [MonoTODO]
+ public object ExceptionState {
+ get {
+ // FIXME
+ return(null);
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ThreadInterruptedException.cs b/mcs/class/corlib/System.Threading/ThreadInterruptedException.cs
new file mode 100755
index 00000000000..f6a82ec6aad
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadInterruptedException.cs
@@ -0,0 +1,33 @@
+//
+// System.Threading.ThreadInterruptedException.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Threading
+{
+ [Serializable]
+ public class ThreadInterruptedException : SystemException
+ {
+ public ThreadInterruptedException()
+ : base ("Thread interrupted") {
+ }
+
+ public ThreadInterruptedException(string message)
+ : base (message) {
+ }
+
+ protected ThreadInterruptedException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public ThreadInterruptedException(string message, Exception innerException)
+ : base (message, innerException) {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ThreadPool.cs b/mcs/class/corlib/System.Threading/ThreadPool.cs
new file mode 100755
index 00000000000..af79eac307b
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadPool.cs
@@ -0,0 +1,245 @@
+//
+// System.Threading.ThreadPool
+//
+// Author:
+// Patrik Torstensson (patrik.torstensson@labs2.com)
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+// (C) Patrik Torstensson
+//
+using System;
+using System.Collections;
+
+namespace System.Threading
+{
+ /// <summary> (Patrik T notes)
+ /// This threadpool is focused on saving resources not giving max performance.
+ ///
+ /// Note, this class is not perfect but it works. ;-) Should also replace
+ /// the queue with an internal one (performance)
+ ///
+ /// This class should also use a specialized queue to increase performance..
+ /// </summary
+ ///
+ public sealed class ThreadPool {
+ internal struct ThreadPoolWorkItem {
+ public WaitCallback _CallBack;
+ public object _Context;
+ }
+
+ private int _ThreadTimeout;
+
+ private long _MaxThreads;
+ private long _CurrentThreads;
+ private long _ThreadsInUse;
+ private long _RequestInQueue;
+ private long _ThreadCreateTriggerRequests;
+
+ private Thread _MonitorThread;
+ private Queue _RequestQueue;
+
+ private ArrayList _Threads;
+ private ManualResetEvent _DataInQueue;
+
+ static ThreadPool _Threadpool;
+
+ static ThreadPool() {
+ _Threadpool = new ThreadPool();
+ }
+
+ private ThreadPool() {
+ // 30 sec timeout default
+ _ThreadTimeout = 30 * 1000;
+
+ // Used to signal that there is data in the queue
+ _DataInQueue = new ManualResetEvent(false);
+
+ _Threads = ArrayList.Synchronized(new ArrayList());
+
+ // Holds requests..
+ _RequestQueue = Queue.Synchronized(new Queue(128));
+
+ _MaxThreads = 64;
+ _CurrentThreads = 0;
+ _RequestInQueue = 0;
+ _ThreadsInUse = 0;
+ _ThreadCreateTriggerRequests = 5;
+
+ // Keeps track of requests in the queue and inreases the number of threads if neededs
+ _MonitorThread = new Thread(new ThreadStart(MonitorThread));
+ _MonitorThread.Start();
+ }
+
+ internal void RemoveThread() {
+ Interlocked.Decrement(ref _CurrentThreads);
+ _Threads.Remove(Thread.CurrentThread);
+ }
+
+ internal void CheckIfStartThread() {
+ bool bCreateThread = false;
+
+ if (_CurrentThreads == 0) {
+ bCreateThread = true;
+ }
+
+ if ((_MaxThreads == -1 || _CurrentThreads < _MaxThreads) && _ThreadsInUse > 0 && _RequestInQueue > _ThreadCreateTriggerRequests) {
+ bCreateThread = true;
+ }
+
+ if (bCreateThread) {
+ Interlocked.Increment(ref _CurrentThreads);
+
+ Thread Start = new Thread(new ThreadStart(WorkerThread));
+ Start.Start();
+ Start.IsThreadPoolThreadInternal = true;
+
+ _Threads.Add(Start);
+ }
+ }
+
+ internal void AddItem(ref ThreadPoolWorkItem Item) {
+ CheckIfStartThread();
+
+ if (Interlocked.Increment(ref _RequestInQueue) == 1) {
+ _DataInQueue.Set();
+ }
+
+ _RequestQueue.Enqueue(Item);
+ }
+
+ // Work Thread main function
+ internal void WorkerThread() {
+ bool bWaitForData = true;
+
+ while (true) {
+ if (bWaitForData) {
+ if (!_DataInQueue.WaitOne(_ThreadTimeout, false)) {
+ // timeout
+ RemoveThread();
+ return;
+ }
+ }
+
+ Interlocked.Increment(ref _ThreadsInUse);
+
+ try {
+ ThreadPoolWorkItem oItem = (ThreadPoolWorkItem) _RequestQueue.Dequeue();
+
+ if (Interlocked.Decrement(ref _RequestInQueue) == 0) {
+ _DataInQueue.Reset();
+ }
+
+ oItem._CallBack(oItem._Context);
+ }
+ catch (InvalidOperationException) {
+ // Queue empty
+ bWaitForData = true;
+ }
+ catch (ThreadAbortException) {
+ // We will leave here.. (thread abort can't be handled)
+ RemoveThread();
+ }
+ finally {
+ Interlocked.Decrement(ref _ThreadsInUse);
+ }
+ }
+ }
+
+ internal void MonitorThread() {
+ while (true) {
+ Thread.Sleep(500);
+
+ CheckIfStartThread();
+ }
+ }
+
+ internal bool QueueUserWorkItemInternal(WaitCallback callback) {
+ return QueueUserWorkItem(callback, null);
+ }
+
+ internal bool QueueUserWorkItemInternal(WaitCallback callback, object context) {
+ ThreadPoolWorkItem Item = new ThreadPoolWorkItem();
+
+ Item._CallBack = callback;
+ Item._Context = context;
+
+ AddItem(ref Item);
+
+ // LAMESPEC: Return value? should use exception here if anything goes wrong
+ return true;
+ }
+
+ public static bool BindHandle(IntPtr osHandle) {
+ throw new NotSupportedException("This is a win32 specific method, not supported Mono");
+ }
+
+ public static bool QueueUserWorkItem(WaitCallback callback) {
+ return _Threadpool.QueueUserWorkItemInternal(callback);
+ }
+
+ public static bool QueueUserWorkItem(WaitCallback callback, object state) {
+ return _Threadpool.QueueUserWorkItemInternal(callback, state);
+ }
+
+ public static bool UnsafeQueueUserWorkItem(WaitCallback callback, object state) {
+ return _Threadpool.QueueUserWorkItemInternal(callback, state);
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, int millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ if (millisecondsTimeOutInterval < -1) {
+ throw new ArgumentOutOfRangeException("timeout < -1");
+ }
+
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, long millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ if (millisecondsTimeOutInterval < -1) {
+ throw new ArgumentOutOfRangeException("timeout < -1");
+ }
+
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, TimeSpan timeout, bool executeOnlyOnce) {
+ // LAMESPEC: I assume it means "timeout" when it says "millisecondsTimeOutInterval"
+ if (timeout.Milliseconds < -1) {
+ throw new ArgumentOutOfRangeException("timeout < -1");
+ }
+ if (timeout.Milliseconds > Int32.MaxValue) {
+ throw new NotSupportedException("timeout too large");
+ }
+
+ throw new NotImplementedException();
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ public static RegisteredWaitHandle RegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, int millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, long millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, TimeSpan timeout, bool executeOnlyOnce) {
+ throw new NotImplementedException();
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject(WaitHandle waitObject, WaitOrTimerCallback callback, object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/ThreadPriority.cs b/mcs/class/corlib/System.Threading/ThreadPriority.cs
new file mode 100644
index 00000000000..ec7a32cae26
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadPriority.cs
@@ -0,0 +1,41 @@
+// ThreadPriority.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:30:24 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Threading {
+
+
+ /// <summary>
+ /// </summary>
+ public enum ThreadPriority {
+
+ /// <summary>
+ /// </summary>
+ Lowest = 0,
+
+ /// <summary>
+ /// </summary>
+ BelowNormal = 1,
+
+ /// <summary>
+ /// </summary>
+ Normal = 2,
+
+ /// <summary>
+ /// </summary>
+ AboveNormal = 3,
+
+ /// <summary>
+ /// </summary>
+ Highest = 4,
+ } // ThreadPriority
+
+} // System.Threading
diff --git a/mcs/class/corlib/System.Threading/ThreadStart.cs b/mcs/class/corlib/System.Threading/ThreadStart.cs
new file mode 100755
index 00000000000..ebd6bc9f764
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadStart.cs
@@ -0,0 +1,14 @@
+//
+// System.Threading.ThreadStart.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public delegate void ThreadStart();
+}
diff --git a/mcs/class/corlib/System.Threading/ThreadState.cs b/mcs/class/corlib/System.Threading/ThreadState.cs
new file mode 100644
index 00000000000..7693dae3c81
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadState.cs
@@ -0,0 +1,55 @@
+// ThreadState.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:30:30 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System.Threading {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum ThreadState {
+
+ /// <summary>
+ /// </summary>
+ Running = 0x00000000,
+
+ StopRequested = 0x00000001,
+ SuspendRequested = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ Background = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ Unstarted = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ Stopped = 0x00000010,
+
+ /// <summary>
+ /// </summary>
+ WaitSleepJoin = 0x00000020,
+
+ Suspended = 0x00000040,
+
+ /// <summary>
+ /// </summary>
+ AbortRequested = 0x00000080,
+
+ /// <summary>
+ /// </summary>
+ Aborted = 0x00000100,
+ } // ThreadState
+
+} // System.Threading
diff --git a/mcs/class/corlib/System.Threading/ThreadStateException.cs b/mcs/class/corlib/System.Threading/ThreadStateException.cs
new file mode 100755
index 00000000000..c359fe011b1
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/ThreadStateException.cs
@@ -0,0 +1,33 @@
+//
+// System.Threading.ThreadStateException.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System.Threading
+{
+ [Serializable]
+ public class ThreadStateException : SystemException
+ {
+ public ThreadStateException()
+ : base ("Thread State Error") {
+ }
+
+ public ThreadStateException(string message)
+ : base (message) {
+ }
+
+ protected ThreadStateException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public ThreadStateException(string message, Exception innerException)
+ : base (message, innerException) {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Timeout.cs b/mcs/class/corlib/System.Threading/Timeout.cs
new file mode 100755
index 00000000000..397e213ddf7
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Timeout.cs
@@ -0,0 +1,18 @@
+//
+// System.Threading.Timeout.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public sealed class Timeout
+ {
+ private Timeout () {}
+ public const int Infinite=-1;
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/Timer.cs b/mcs/class/corlib/System.Threading/Timer.cs
new file mode 100755
index 00000000000..f134d66612a
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/Timer.cs
@@ -0,0 +1,112 @@
+//
+// System.Threading.Timer.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public sealed class Timer : MarshalByRefObject, IDisposable
+ {
+ [MonoTODO]
+ public Timer(TimerCallback callback, object state, int dueTime, int period) {
+ if(dueTime < -1) {
+ throw new ArgumentOutOfRangeException("Due time < -1");
+ }
+ if(period < -1) {
+ throw new ArgumentOutOfRangeException("Period < -1");
+ }
+
+ // FIXME
+ }
+
+ [MonoTODO]
+ public Timer(TimerCallback callback, object state, long dueTime, long period) {
+ if(dueTime < -1) {
+ throw new ArgumentOutOfRangeException("Due time < -1");
+ }
+ if(period < -1) {
+ throw new ArgumentOutOfRangeException("Period < -1");
+ }
+ // FIXME
+ }
+
+ [MonoTODO]
+ public Timer(TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period) {
+ if(dueTime.Milliseconds < 0 || dueTime.Milliseconds > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("Due time out of range");
+ }
+ if(period.Milliseconds < 0 || period.Milliseconds > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("Period out of range");
+ }
+ // FIXME
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ public Timer(TimerCallback callback, object state, uint dueTime, uint period) {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public bool Change(int dueTime, int period) {
+ if(dueTime < -1) {
+ throw new ArgumentOutOfRangeException("Due time < -1");
+ }
+ if(period < -1) {
+ throw new ArgumentOutOfRangeException("Period < -1");
+ }
+ // FIXME
+ return(false);
+ }
+
+ [MonoTODO]
+ public bool Change(long dueTime, long period) {
+ if(dueTime < -1) {
+ throw new ArgumentOutOfRangeException("Due time < -1");
+ }
+ if(period < -1) {
+ throw new ArgumentOutOfRangeException("Period < -1");
+ }
+ if(dueTime > 4294967294) {
+ throw new NotSupportedException("Due time too large");
+ }
+ if(period > 4294967294) {
+ throw new NotSupportedException("Period too large");
+ }
+ // FIXME
+ return(false);
+ }
+
+ [MonoTODO]
+ public bool Change(TimeSpan dueTime, TimeSpan period) {
+ // FIXME
+ return(false);
+ }
+
+ [CLSCompliant(false)][MonoTODO]
+ public bool Change(uint dueTime, uint period) {
+ // FIXME
+ return(false);
+ }
+
+ [MonoTODO]
+ public void Dispose() {
+ // FIXME
+ }
+
+ [MonoTODO]
+ public bool Dispose(WaitHandle notifyObject) {
+ // FIXME
+ return(false);
+ }
+
+ [MonoTODO]
+ ~Timer() {
+ // FIXME
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/TimerCallback.cs b/mcs/class/corlib/System.Threading/TimerCallback.cs
new file mode 100755
index 00000000000..3afe1fc71f2
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/TimerCallback.cs
@@ -0,0 +1,14 @@
+//
+// System.Threading.TimerCallback.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public delegate void TimerCallback(object state);
+}
diff --git a/mcs/class/corlib/System.Threading/WaitCallback.cs b/mcs/class/corlib/System.Threading/WaitCallback.cs
new file mode 100755
index 00000000000..ed1e39c0e28
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/WaitCallback.cs
@@ -0,0 +1,14 @@
+//
+// System.Threading.WaitCallback.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public delegate void WaitCallback(object state);
+}
diff --git a/mcs/class/corlib/System.Threading/WaitHandle.cs b/mcs/class/corlib/System.Threading/WaitHandle.cs
new file mode 100755
index 00000000000..1d6ec67ee80
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/WaitHandle.cs
@@ -0,0 +1,204 @@
+//
+// System.Threading.WaitHandle.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System.Threading
+{
+ public abstract class WaitHandle : MarshalByRefObject, IDisposable
+ {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern bool WaitAll_internal(WaitHandle[] handles, int ms, bool exitContext);
+
+ public static bool WaitAll(WaitHandle[] waitHandles) {
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAll_internal(waitHandles, Timeout.Infinite,
+ false));
+ }
+
+ public static bool WaitAll(WaitHandle[] waitHandles,
+ int millisecondsTimeout,
+ bool exitContext) {
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAll_internal(waitHandles, millisecondsTimeout, false));
+ }
+
+ public static bool WaitAll(WaitHandle[] waitHandles,
+ TimeSpan timeout,
+ bool exitContext) {
+ if(timeout.Milliseconds < 0 ||
+ timeout.Milliseconds > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("Timeout out of range");
+ }
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAll_internal(waitHandles,
+ timeout.Milliseconds,
+ exitContext));
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int WaitAny_internal(WaitHandle[] handles, int ms, bool exitContext);
+
+ // LAMESPEC: Doesn't specify how to signal failures
+ public static int WaitAny(WaitHandle[] waitHandles) {
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAny_internal(waitHandles, Timeout.Infinite,
+ false));
+ }
+
+ public static int WaitAny(WaitHandle[] waitHandles,
+ int millisecondsTimeout,
+ bool exitContext) {
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAny_internal(waitHandles,
+ millisecondsTimeout,
+ exitContext));
+ }
+
+ public static int WaitAny(WaitHandle[] waitHandles,
+ TimeSpan timeout, bool exitContext) {
+ if(timeout.Milliseconds < 0 ||
+ timeout.Milliseconds > Int32.MaxValue) {
+ throw new ArgumentOutOfRangeException("Timeout out of range");
+ }
+ if(waitHandles.Length>64) {
+ throw new NotSupportedException("Too many handles");
+ }
+ for(int i=0; i<waitHandles.Length; i++) {
+ if(waitHandles[i]==null) {
+ throw new ArgumentNullException("null handle");
+ }
+ }
+
+ return(WaitAny_internal(waitHandles,
+ timeout.Milliseconds,
+ exitContext));
+ }
+
+ [MonoTODO]
+ public WaitHandle() {
+ // FIXME
+ }
+
+ public const int WaitTimeout = 258;
+
+ protected IntPtr os_handle = IntPtr.Zero;
+
+ public virtual IntPtr Handle {
+ get {
+ return(os_handle);
+ }
+
+ set {
+ os_handle=value;
+ }
+ }
+
+ public virtual void Close() {
+ Dispose(false);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ protected virtual extern bool WaitOne_internal(IntPtr handle, int ms, bool exitContext);
+
+ public virtual bool WaitOne() {
+ return(WaitOne_internal(os_handle, Timeout.Infinite,
+ false));
+ }
+
+ public virtual bool WaitOne(int millisecondsTimeout, bool exitContext) {
+ return(WaitOne_internal(os_handle,
+ millisecondsTimeout,
+ exitContext));
+ }
+
+ public virtual bool WaitOne(TimeSpan timeout, bool exitContext) {
+ return(WaitOne_internal(os_handle,
+ timeout.Milliseconds,
+ exitContext));
+ }
+
+ protected static readonly IntPtr InvalidHandle;
+
+ private bool disposed = false;
+
+ public void Dispose() {
+ Dispose(true);
+ // Take yourself off the Finalization queue
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool explicitDisposing) {
+ // Check to see if Dispose has already been called.
+ if(!this.disposed) {
+ // If this is a call to Dispose,
+ // dispose all managed resources.
+ if(explicitDisposing) {
+ // Free up stuff here
+ //Components.Dispose();
+ }
+
+ // Release unmanaged resources
+ // Note that this is not thread safe.
+ // Another thread could start
+ // disposing the object after the
+ // managed resources are disposed, but
+ // before the disposed flag is set to
+ // true.
+ this.disposed=true;
+ //Release(handle);
+ //handle=IntPtr.Zero;
+ }
+ }
+
+ ~WaitHandle() {
+ Dispose(false);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System.Threading/WaitOrTimerCallback.cs b/mcs/class/corlib/System.Threading/WaitOrTimerCallback.cs
new file mode 100755
index 00000000000..03a03d7a318
--- /dev/null
+++ b/mcs/class/corlib/System.Threading/WaitOrTimerCallback.cs
@@ -0,0 +1,14 @@
+//
+// System.Threading.WaitOrTimerCallback.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+namespace System.Threading
+{
+ public delegate void WaitOrTimerCallback(object state, bool timedOut);
+}
diff --git a/mcs/class/corlib/System/Activator.cs b/mcs/class/corlib/System/Activator.cs
new file mode 100644
index 00000000000..8bf03f1ef48
--- /dev/null
+++ b/mcs/class/corlib/System/Activator.cs
@@ -0,0 +1,111 @@
+//
+// System.Activator.cs
+//
+// Author:
+// Nick Drochak II (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+using System.Runtime.Remoting;
+using System.Reflection;
+using System.Globalization;
+using System.Security.Policy;
+
+namespace System
+{
+ // FIXME: This class is just stubs to get System.dll to compile
+ public sealed class Activator
+ {
+ [MonoTODO]
+ public static ObjectHandle CreateComInstanceFrom(string assemblyName,
+ string typeName) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static ObjectHandle CreateInstanceFrom(string assemblyFile,
+ string typeName) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static ObjectHandle CreateInstanceFrom(string assemblyFile,
+ string typeName, object[] activationAttributes) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static ObjectHandle CreateInstanceFrom(string assemblyFile,
+ string typeName, bool ignoreCase, BindingFlags bindingAttr,
+ Binder binder, object[] args, CultureInfo culture, object[] activationAttributes,
+ Evidence securityInfo) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static ObjectHandle CreateInstance(string assemblyName,
+ string typeName) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static ObjectHandle CreateInstance(string assemblyName,
+ string typeName, object[] activationAttributes) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static ObjectHandle CreateInstance(string assemblyName,
+ string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder,
+ object[] args, CultureInfo culture, object[] activationAttributes,
+ Evidence securityInfo) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static object CreateInstance(Type type) { throw new NotImplementedException(); }
+
+ [MonoTODO]
+ public static object CreateInstance(Type type,
+ object[] args) { throw new NotImplementedException(); }
+
+ [MonoTODO]
+ public static object CreateInstance(Type type,
+ object[] args, object[] activationAttributes) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static object CreateInstance(Type type,
+ BindingFlags bindingAttr, Binder binder, object[] args,
+ CultureInfo culture) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static object CreateInstance(Type type,
+ BindingFlags bindingAttr, Binder binder, object[] args,
+ CultureInfo culture, object[] activationAttributes) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static object CreateInstance(Type type,
+ bool nonPublic) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static object GetObject(Type type,
+ string url) {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO]
+ public static object GetObject(Type type,
+ string url, object state) {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/AppDomain.cs b/mcs/class/corlib/System/AppDomain.cs
new file mode 100755
index 00000000000..31cc6bcca04
--- /dev/null
+++ b/mcs/class/corlib/System/AppDomain.cs
@@ -0,0 +1,462 @@
+//
+// System/AppDomain.cs
+//
+// Authors:
+// Paolo Molaro (lupus@ximian.com)
+// Dietmar Maurer (dietmar@ximian.com)
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.CompilerServices;
+using System.Runtime.Remoting;
+using System.Security.Principal;
+using System.Security.Policy;
+using System.Security;
+
+namespace System {
+
+ public sealed class AppDomain : MarshalByRefObject , _AppDomain , IEvidenceFactory {
+
+ IntPtr _mono_app_domain;
+
+ // Evidence evidence;
+
+ private AppDomain () {}
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern AppDomainSetup getSetup ();
+
+ public AppDomainSetup SetupInformation {
+
+ get {
+ return getSetup ();
+ }
+ }
+
+ public string BaseDirectory {
+
+ get {
+ return SetupInformation.ApplicationBase;
+ }
+ }
+
+ public string RelativeSearchPath {
+
+ get {
+ return SetupInformation.PrivateBinPath;
+ }
+ }
+
+ public string DynamicDirectory {
+
+ get {
+ // fixme: dont know if this is right?
+ return SetupInformation.DynamicBase;
+ }
+ }
+
+ public bool ShadowCopyFiles {
+
+ get {
+ if (SetupInformation.ShadowCopyFiles == "true")
+ return true;
+ return false;
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern string getFriendlyName ();
+
+ public string FriendlyName {
+
+ get {
+ return getFriendlyName ();
+ }
+ }
+
+ public Evidence Evidence {
+
+ get {
+ return null;
+ //return evidence;
+ }
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private static extern AppDomain getCurDomain ();
+
+ public static AppDomain CurrentDomain
+ {
+ get {
+ return getCurDomain ();
+ }
+ }
+
+ [MonoTODO]
+ public void AppendPrivatePath (string path)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ClearPrivatePath ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void ClearShadowCopyPath ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public ObjectHandle CreateInstance (string assemblyName, string typeName)
+ {
+ return CreateInstance (assemblyName, typeName, false, 0,
+ null, null, null, null, null);
+ }
+
+ public ObjectHandle CreateInstance (string assemblyName, string typeName,
+ object[] activationAttributes)
+ {
+ return CreateInstance (assemblyName, typeName, false, 0,
+ null, null, null, activationAttributes, null);
+ }
+
+ [MonoTODO]
+ public ObjectHandle CreateInstance (string assemblyName,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object[] args,
+ CultureInfo culture,
+ object[] activationAttributes,
+ Evidence securityAttribtutes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public ObjectHandle CreateInstanceFrom (string assemblyName, string typeName)
+ {
+ return CreateInstanceFrom (assemblyName, typeName, false, 0,
+ null, null, null, null, null);
+ }
+
+ public ObjectHandle CreateInstanceFrom (string assemblyName, string typeName,
+ object[] activationAttributes)
+ {
+ return CreateInstanceFrom (assemblyName, typeName, false, 0,
+ null, null, null, activationAttributes, null);
+ }
+
+ [MonoTODO]
+ public ObjectHandle CreateInstanceFrom (string assemblyName,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object[] args,
+ CultureInfo culture,
+ object[] activationAttributes,
+ Evidence securityAttribtutes)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access)
+ {
+ return DefineDynamicAssembly (name, access, null, null,
+ null, null, null, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ Evidence evidence)
+ {
+ return DefineDynamicAssembly (name, access, null, evidence,
+ null, null, null, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir)
+ {
+ return DefineDynamicAssembly (name, access, dir, null,
+ null, null, null, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence)
+ {
+ return DefineDynamicAssembly (name, access, dir, evidence,
+ null, null, null, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions)
+ {
+ return DefineDynamicAssembly (name, access, null, null,
+ requiredPermissions, optionalPermissions,
+ refusedPersmissions, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions)
+ {
+ return DefineDynamicAssembly (name, access, null, evidence,
+ requiredPermissions, optionalPermissions,
+ refusedPersmissions, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions)
+ {
+ return DefineDynamicAssembly (name, access, dir, null,
+ requiredPermissions, optionalPermissions,
+ refusedPersmissions, false);
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions)
+ {
+ return DefineDynamicAssembly (name, access, dir, evidence,
+ requiredPermissions, optionalPermissions,
+ refusedPersmissions, false);
+
+ }
+
+ public AssemblyBuilder DefineDynamicAssembly (AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions,
+ bool isSynchronized)
+ {
+ // FIXME: examine all other parameters
+
+ AssemblyBuilder ab = new AssemblyBuilder (name, dir, access);
+ return ab;
+ }
+
+
+ [MonoTODO]
+ public void DoCallBack (CrossAppDomainDelegate theDelegate)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool Equals (object other)
+ {
+ if (!(other is AppDomain))
+ return false;
+
+ return this._mono_app_domain == ((AppDomain)other)._mono_app_domain;
+ }
+
+ public int ExecuteAssembly (string assemblyFile)
+ {
+ return ExecuteAssembly (assemblyFile, new Evidence (), null);
+ }
+
+ public int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity)
+ {
+ return ExecuteAssembly (assemblyFile, new Evidence (), null);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity, string[] args);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern Assembly [] GetAssemblies ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern object GetData (string name);
+
+ public override int GetHashCode ()
+ {
+ return (int)_mono_app_domain;
+ }
+
+ [MonoTODO]
+ public override object InitializeLifetimeService ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern Assembly LoadAssembly (AssemblyName assemblyRef, Evidence securityEvidence);
+
+ public Assembly Load (AssemblyName assemblyRef)
+ {
+ return Load (assemblyRef, new Evidence ());
+ }
+
+ public Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
+ {
+ return LoadAssembly (assemblyRef, assemblySecurity);
+ }
+
+ public Assembly Load (string assemblyString)
+ {
+ AssemblyName an = new AssemblyName ();
+ an.Name = assemblyString;
+
+ return Load (an, new Evidence ());
+ }
+
+ public Assembly Load (string assemblyString, Evidence assemblySecurity)
+ {
+ AssemblyName an = new AssemblyName ();
+ an.Name = assemblyString;
+
+ return Load (an, assemblySecurity);
+ }
+
+ public Assembly Load (byte[] rawAssembly)
+ {
+ return Load (rawAssembly, null, new Evidence ());
+ }
+
+ public Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore)
+ {
+ return Load (rawAssembly, rawSymbolStore, new Evidence ());
+ }
+
+ [MonoTODO]
+ public Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore, Evidence securityEvidence)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetAppDomainPolicy (PolicyLevel domainPolicy)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void SetCachePath (string s)
+ {
+ SetupInformation.CachePath = s;
+ }
+
+ [MonoTODO]
+ public void SetPrincipalPolicy (PrincipalPolicy policy)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetShadowCopyPath (string s)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public void SetThreadPrincipal (IPrincipal principal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static AppDomain CreateDomain (string friendlyName)
+ {
+ return CreateDomain (friendlyName, new Evidence (), new AppDomainSetup ());
+ }
+
+ public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo)
+ {
+ return CreateDomain (friendlyName, securityInfo, new AppDomainSetup ());
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private static extern AppDomain createDomain (string friendlyName, AppDomainSetup info);
+
+ public static AppDomain CreateDomain (string friendlyName,
+ Evidence securityInfo,
+ AppDomainSetup info)
+ {
+ if (friendlyName == null || securityInfo == null || info == null)
+ throw new System.ArgumentNullException();
+
+ AppDomain ad = createDomain (friendlyName, info);
+
+ // ad.evidence = securityInfo;
+
+ return ad;
+ }
+
+ public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo,
+ string appBasePath, string appRelativeSearchPath,
+ bool shadowCopyFiles)
+ {
+ AppDomainSetup info = new AppDomainSetup ();
+
+ info.ApplicationBase = appBasePath;
+ info.PrivateBinPath = appRelativeSearchPath;
+
+ if (shadowCopyFiles)
+ info.ShadowCopyFiles = "true";
+ else
+ info.ShadowCopyFiles = "false";
+
+ return CreateDomain (friendlyName, securityInfo, info);
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern void Unload (AppDomain domain);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern void SetData (string name, object data);
+
+ [MonoTODO]
+ public static int GetCurrentThreadId ()
+ {
+ throw new NotImplementedException ();
+ }
+
+
+ public event AssemblyLoadEventHandler AssemblyLoad;
+
+ public event ResolveEventHandler AssemblyResolve;
+
+ public event EventHandler DomainUnload;
+
+ public event EventHandler ProcessExit;
+
+ public event ResolveEventHandler ResourceResolve;
+
+ public event ResolveEventHandler TypeResolve;
+
+ public event UnhandledExceptionEventHandler UnhandledException;
+
+ }
+}
diff --git a/mcs/class/corlib/System/AppDomainSetup.cs b/mcs/class/corlib/System/AppDomainSetup.cs
new file mode 100755
index 00000000000..38620b7a5a3
--- /dev/null
+++ b/mcs/class/corlib/System/AppDomainSetup.cs
@@ -0,0 +1,161 @@
+//
+// System/AppDomainSetup.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+
+ [Serializable]
+ public sealed class AppDomainSetup : IAppDomainSetup {
+ string application_base;
+ string application_name;
+ string cache_path;
+ string configuration_file;
+ string dynamic_base;
+ string license_file;
+ string private_bin_path;
+ string private_bin_path_probe;
+ string shadow_copy_directories;
+ string shadow_copy_files;
+ bool publisher_policy;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern AppDomainSetup InitAppDomainSetup (AppDomainSetup setup);
+
+ public AppDomainSetup ()
+ {
+ InitAppDomainSetup (this);
+ }
+
+ public string ApplicationBase {
+
+ get {
+ return application_base;
+ }
+
+ set {
+ application_base = value;
+ }
+ }
+
+ public string ApplicationName {
+
+ get {
+ return application_name;
+ }
+
+ set {
+ application_name = value;
+ }
+ }
+
+ public string CachePath {
+
+ get {
+ return cache_path;
+ }
+
+ set {
+ cache_path = value;
+ }
+ }
+
+ public string ConfigurationFile {
+
+ get {
+ return configuration_file;
+ }
+
+ set {
+ configuration_file = value;
+ }
+ }
+
+ public bool DisallowPublisherPolicy {
+ get {
+ return publisher_policy;
+ }
+
+ set {
+ publisher_policy = value;
+ }
+ }
+
+ public string DynamicBase {
+
+ get {
+ return dynamic_base;
+ }
+
+ set {
+ dynamic_base = value;
+ }
+ }
+
+ public string LicenseFile {
+
+ get {
+ return license_file;
+ }
+
+ set {
+ license_file = value;
+ }
+ }
+
+
+
+ public string PrivateBinPath {
+
+ get {
+ return private_bin_path;
+ }
+
+ set {
+ private_bin_path = value;
+ }
+ }
+
+ public string PrivateBinPathProbe {
+
+ get {
+ return private_bin_path_probe;
+ }
+
+ set {
+ private_bin_path_probe = value;
+ }
+ }
+
+ public string ShadowCopyDirectories {
+
+ get {
+ return shadow_copy_directories;
+ }
+
+ set {
+ shadow_copy_directories = value;
+ }
+ }
+
+ public string ShadowCopyFiles {
+
+ get {
+ return shadow_copy_files;
+ }
+
+ set {
+ shadow_copy_files = value;
+ }
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/AppDomainUnloadedException.cs b/mcs/class/corlib/System/AppDomainUnloadedException.cs
new file mode 100644
index 00000000000..9ca65e65c9c
--- /dev/null
+++ b/mcs/class/corlib/System/AppDomainUnloadedException.cs
@@ -0,0 +1,42 @@
+//
+// System.AppDomainUnloadedException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class AppDomainUnloadedException : SystemException
+ {
+ // Constructors
+ public AppDomainUnloadedException ()
+ : base (Locale.GetText ("Can't access an unloaded application domain."))
+ {
+ }
+
+ public AppDomainUnloadedException (string message)
+ : base (message)
+ {
+ }
+
+ protected AppDomainUnloadedException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public AppDomainUnloadedException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/ApplicationException.cs b/mcs/class/corlib/System/ApplicationException.cs
new file mode 100644
index 00000000000..9420c119430
--- /dev/null
+++ b/mcs/class/corlib/System/ApplicationException.cs
@@ -0,0 +1,42 @@
+//
+// System.ApplicationException.cs
+//
+// Authors:
+// Joe Shaw (joe@ximian.com)
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Reflection;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+
+ [Serializable]
+ public class ApplicationException : Exception
+ {
+ // Constructors
+ public ApplicationException ()
+ : base (Locale.GetText ("An application exception has occurred."))
+ {
+ }
+
+ public ApplicationException (string message)
+ : base (message)
+ {
+ }
+
+ public ApplicationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected ApplicationException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ArgumentException.cs b/mcs/class/corlib/System/ArgumentException.cs
new file mode 100644
index 00000000000..d5d22ebc57e
--- /dev/null
+++ b/mcs/class/corlib/System/ArgumentException.cs
@@ -0,0 +1,65 @@
+//
+// System.ArgumentException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public class ArgumentException : SystemException {
+ private string param_name;
+
+ // Constructors
+ public ArgumentException ()
+ : base (Locale.GetText ("An invalid argument was specified."))
+ {
+ }
+
+ public ArgumentException (string message)
+ : base (message)
+ {
+ }
+
+ public ArgumentException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ public ArgumentException (string message, string param_name)
+ : base (message)
+ {
+ this.param_name = param_name;
+ }
+
+ public ArgumentException (string message, string param_name, Exception inner)
+ : base (message, inner)
+ {
+ this.param_name = param_name;
+ }
+
+ protected ArgumentException (SerializationInfo info, StreamingContext sc)
+ : base (info, sc)
+ {
+ param_name = info.GetString ("ParamName");
+ }
+
+ // Properties
+ public virtual string ParamName {
+ get {
+ return param_name;
+ }
+ }
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("ParamName", param_name);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ArgumentNullException.cs b/mcs/class/corlib/System/ArgumentNullException.cs
new file mode 100644
index 00000000000..4963f560830
--- /dev/null
+++ b/mcs/class/corlib/System/ArgumentNullException.cs
@@ -0,0 +1,38 @@
+//
+// System.ArgumentNullException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public class ArgumentNullException : ArgumentException {
+ // Constructors
+ public ArgumentNullException ()
+ : base (Locale.GetText ("Argument cannot be null"))
+ {
+ }
+
+ public ArgumentNullException (string param_name)
+ : base (Locale.GetText ("Argument {0} cannot be null"), param_name)
+ {
+ }
+
+ public ArgumentNullException (string param_name, string message)
+ : base (message, param_name)
+ {
+ }
+
+ protected ArgumentNullException (SerializationInfo info, StreamingContext sc)
+ : base (info, sc)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ArgumentOutOfRangeException.cs b/mcs/class/corlib/System/ArgumentOutOfRangeException.cs
new file mode 100644
index 00000000000..361f816f9bb
--- /dev/null
+++ b/mcs/class/corlib/System/ArgumentOutOfRangeException.cs
@@ -0,0 +1,63 @@
+//
+// System.ArgumentOutOfRangeException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class ArgumentOutOfRangeException : ArgumentException {
+ private object actual_value;
+
+ // Constructors
+ public ArgumentOutOfRangeException ()
+ : base (Locale.GetText ("Argument is out of range"))
+ {
+ }
+
+ public ArgumentOutOfRangeException (string param_name)
+ : base (Locale.GetText ("Argument is out of range"), param_name)
+ {
+ }
+
+ public ArgumentOutOfRangeException (string param_name, string message)
+ : base (message, param_name)
+ {
+ }
+
+ public ArgumentOutOfRangeException (string param_name, object actual_value, string message)
+ : base (message, param_name)
+ {
+ this.actual_value = actual_value;
+ }
+
+ protected ArgumentOutOfRangeException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ actual_value = info.GetString ("ActualValue");
+ }
+
+ // Properties
+ public virtual object ActualValue {
+ get {
+ return actual_value;
+ }
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("ActualValue", actual_value);
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/ArithmeticException.cs b/mcs/class/corlib/System/ArithmeticException.cs
new file mode 100644
index 00000000000..ff6c98cbb35
--- /dev/null
+++ b/mcs/class/corlib/System/ArithmeticException.cs
@@ -0,0 +1,38 @@
+//
+// System.ArithmeticException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+ [Serializable]
+ public class ArithmeticException : SystemException {
+ // Constructors
+ public ArithmeticException ()
+ : base (Locale.GetText ("The arithmetic operation is not allowed"))
+ {
+ }
+
+ public ArithmeticException (string message)
+ : base (message)
+ {
+ }
+
+ public ArithmeticException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected ArithmeticException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Array.cs b/mcs/class/corlib/System/Array.cs
new file mode 100644
index 00000000000..52a32217665
--- /dev/null
+++ b/mcs/class/corlib/System/Array.cs
@@ -0,0 +1,835 @@
+//
+// System.Array.cs
+//
+// Authors:
+// Joe Shaw (joe@ximian.com)
+// Martin Baulig (martin@gnome.org)
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Collections;
+using System.Runtime.CompilerServices;
+
+namespace System
+{
+
+ [Serializable]
+ public abstract class Array : ICloneable, ICollection, IList, IEnumerable
+ {
+ // Constructor
+ private Array ()
+ {
+ /* empty */
+ }
+
+ // Properties
+ public int Length
+ {
+ get
+ {
+ int length = this.GetLength (0);
+
+ for (int i = 1; i < this.Rank; i++) {
+ length *= this.GetLength (i);
+ }
+
+ return length;
+ }
+ }
+
+ public int Rank
+ {
+ get
+ {
+ return this.GetRank ();
+ }
+ }
+
+ // IList interface
+ public object this [int index] {
+ get {
+ return GetValueImpl (index);
+ }
+ set {
+ SetValueImpl (value, index);
+ }
+ }
+
+ int IList.Add (object value) {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Clear () {
+ Array.Clear (this, this.GetLowerBound(0), this.Length);
+ }
+
+ bool IList.Contains (object value) {
+ int length = this.Length;
+ for (int i = 0; i < length; i++) {
+ if (value.Equals (this.GetValueImpl (i)))
+ return true;
+ }
+ return false;
+ }
+
+ int IList.IndexOf (object value) {
+ if (this.Rank > 1)
+ throw new RankException ();
+
+ int length = this.Length;
+ for (int i = 0; i < length; i++) {
+ if (value.Equals (this.GetValueImpl (i)))
+ // array index may not be zero-based.
+ // use lower bound
+ return i + this.GetLowerBound (0);
+ }
+
+ int retVal;
+ unchecked {
+ // lower bound may be MinValue
+ retVal = this.GetLowerBound (0) - 1;
+ }
+
+ return retVal;
+ }
+
+ void IList.Insert (int index, object value) {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Remove (object value) {
+ throw new NotSupportedException ();
+ }
+
+ void IList.RemoveAt (int index) {
+ throw new NotSupportedException ();
+ }
+
+ // InternalCall Methods
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int GetRank ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern int GetLength (int dimension);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern int GetLowerBound (int dimension);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern object GetValue (int[] idxs);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern void SetValue (object value, int[] idxs);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern object GetValueImpl (int pos);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern void SetValueImpl (object value, int pos);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static void FastCopy (Array source, int source_idx, Array dest, int dest_idx, int length);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static Array CreateInstanceImpl(Type elementType, int[] lengths, int [] bounds);
+
+ // Properties
+ public virtual int Count {
+ get {
+ return Length;
+ }
+ }
+
+ [MonoTODO]
+ public virtual bool IsSynchronized {
+ get {
+ // FIXME?
+ return false;
+ }
+ }
+
+ [MonoTODO]
+ public virtual object SyncRoot {
+ get {
+ // FIXME
+ return null;
+ }
+ }
+
+ public virtual bool IsFixedSize
+ {
+ get {
+ return true;
+ }
+ }
+
+ public virtual bool IsReadOnly
+ {
+ get{
+ return false;
+ }
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return new SimpleEnumerator(this);
+ }
+
+ public int GetUpperBound (int dimension)
+ {
+ return GetLowerBound (dimension) +
+ GetLength (dimension) - 1;
+ }
+
+ public object GetValue (int idx)
+ {
+ int[] ind = new int [1];
+
+ ind [0] = idx;
+
+ return GetValue (ind);
+ }
+
+ public object GetValue (int idx1, int idx2)
+ {
+ int[] ind = new int [2];
+
+ ind [0] = idx1;
+ ind [1] = idx2;
+
+ return GetValue (ind);
+ }
+
+ public object GetValue (int idx1, int idx2, int idx3)
+ {
+ int[] ind = new int [3];
+
+ ind [0] = idx1;
+ ind [1] = idx2;
+ ind [2] = idx3;
+
+ return GetValue (ind);
+ }
+
+ // This function is currently unused, but just in case we need it later on ... */
+ internal int IndexToPos (int[] idxs)
+ {
+ if (idxs == null)
+ throw new ArgumentNullException ();
+
+ if ((idxs.Rank != 1) || (idxs.Length != Rank))
+ throw new ArgumentException ();
+
+ if ((idxs [0] < GetLowerBound (0)) || (idxs [0] > GetUpperBound (0)))
+ throw new IndexOutOfRangeException();
+
+ int pos = idxs [0] - GetLowerBound (0);
+ for (int i = 1; i < Rank; i++) {
+ if ((idxs [i] < GetLowerBound (i)) || (idxs [i] > GetUpperBound (i)))
+ throw new IndexOutOfRangeException();
+
+ pos *= GetLength (i);
+ pos += idxs [i] - GetLowerBound (i);
+ }
+
+ return pos;
+ }
+
+ public void SetValue (object value, int idx)
+ {
+ int[] ind = new int [1];
+
+ ind [0] = idx;
+
+ SetValue (value, ind);
+ }
+
+ public void SetValue (object value, int idx1, int idx2)
+ {
+ int[] ind = new int [2];
+
+ ind [0] = idx1;
+ ind [1] = idx2;
+
+ SetValue (value, ind);
+ }
+
+ public void SetValue (object value, int idx1, int idx2, int idx3)
+ {
+ int[] ind = new int [3];
+
+ ind [0] = idx1;
+ ind [1] = idx2;
+ ind [2] = idx3;
+
+ SetValue (value, ind);
+ }
+
+ public static Array CreateInstance(Type elementType, int length)
+ {
+ int[] lengths = new int [1];
+ int[] bounds = null;
+
+ lengths [0] = length;
+
+ return CreateInstanceImpl (elementType, lengths, bounds);
+ }
+
+ public static Array CreateInstance(Type elementType, int l1, int l2)
+ {
+ int[] lengths = new int [2];
+ int[] bounds = null;
+
+ lengths [0] = l1;
+ lengths [1] = l2;
+
+ return CreateInstanceImpl (elementType, lengths, bounds);
+ }
+
+ public static Array CreateInstance(Type elementType, int l1, int l2, int l3)
+ {
+ int[] lengths = new int [3];
+ int[] bounds = null;
+
+ lengths [0] = l1;
+ lengths [1] = l2;
+ lengths [2] = l3;
+
+ return CreateInstanceImpl (elementType, lengths, bounds);
+ }
+
+ public static Array CreateInstance(Type elementType, int[] lengths)
+ {
+ int[] bounds = null;
+
+ return CreateInstanceImpl (elementType, lengths, bounds);
+ }
+
+ public static Array CreateInstance(Type elementType, int[] lengths, int [] bounds)
+ {
+ if (bounds == null)
+ throw new ArgumentNullException("bounds");
+
+ return CreateInstanceImpl (elementType, lengths, bounds);
+ }
+
+
+ public static int BinarySearch (Array array, object value)
+ {
+ if (array == null)
+ throw new ArgumentNullException("array");
+
+ if (array.Rank > 1)
+ throw new RankException();
+
+ if (!(value is IComparable))
+ throw new ArgumentException("value does not support IComparable");
+
+ return BinarySearch (array, array.GetLowerBound (0), array.GetLength (0),
+ value, null);
+ }
+
+ public static int BinarySearch (Array array, object value, IComparer comparer)
+ {
+ if (array == null)
+ throw new ArgumentNullException("array");
+
+ if (array.Rank > 1)
+ throw new RankException();
+
+ if ((comparer == null) && !(value is IComparable))
+ throw new ArgumentException("comparer is null and value does not support IComparable");
+
+ return BinarySearch (array, array.GetLowerBound (0), array.GetLength (0),
+ value, comparer);
+ }
+
+ public static int BinarySearch (Array array, int index, int length, object value)
+ {
+ if (array == null)
+ throw new ArgumentNullException("array");
+
+ if (array.Rank > 1)
+ throw new RankException();
+
+ if (index < array.GetLowerBound (0))
+ throw new ArgumentOutOfRangeException("index is less than the lower bound of array.");
+ if (length < 0)
+ throw new ArgumentOutOfRangeException("length is less than zero.");
+
+ if (index + length > array.GetLowerBound (0) + array.GetLength (0))
+ throw new ArgumentException("index and length do not specify a valid range in array.");
+ if (!(value is IComparable))
+ throw new ArgumentException("value does not support IComparable");
+
+ return BinarySearch (array, index, length, value, null);
+ }
+
+ public static int BinarySearch (Array array, int index,
+ int length, object value,
+ IComparer comparer)
+ {
+ if (array == null)
+ throw new ArgumentNullException ("array");
+
+ if (array.Rank > 1)
+ throw new RankException ();
+
+ if (index < array.GetLowerBound (0))
+ throw new ArgumentOutOfRangeException("index is less than the lower bound of array.");
+ if (length < 0)
+ throw new ArgumentOutOfRangeException("length is less than zero.");
+
+ if (index + length > array.GetLowerBound (0) + array.GetLength (0))
+ throw new ArgumentException("index and length do not specify a valid range in array.");
+
+ if ((comparer == null) && !(value is IComparable))
+ throw new ArgumentException("comparer is null and value does not support IComparable");
+
+ // cache this in case we need it
+ IComparable valueCompare = value as IComparable;
+
+ int iMin = index;
+ int iMax = index + length;
+ int iCmp = 0;
+ try
+ {
+ // there's a subtle balance here between
+ // 1) the while condition
+ // 2) the rounding down of the '/ 2'
+ // 3) the asymetrical recursion
+ // 4) the fact that iMax starts beyond the end of the array
+ while (iMin < iMax)
+ {
+ int iMid = (iMin + iMax) / 2;
+ object elt = array.GetValueImpl (iMid);
+
+ // this order is from MSDN
+ if (comparer != null)
+ iCmp = comparer.Compare (value, elt);
+ else
+ {
+ IComparable eltCompare = elt as IComparable;
+ if (eltCompare != null)
+ iCmp = -eltCompare.CompareTo (value);
+ else
+ iCmp = valueCompare.CompareTo (elt);
+ }
+
+ if (iCmp == 0)
+ return iMid;
+ else if (iCmp < 0)
+ iMax = iMid;
+ else
+ iMin = iMid + 1; // compensate for the rounding down
+ }
+ }
+ catch (InvalidCastException e)
+ {
+ throw new ArgumentException ("array", e);
+ }
+
+ if (iCmp > 0)
+ return ~iMax;
+ else
+ return ~iMin;
+ }
+
+ public static void Clear (Array array, int index, int length)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ if (array.Rank > 1)
+ throw new RankException ();
+
+ if (index < array.GetLowerBound (0) || length < 0 ||
+ index + length > array.GetUpperBound (0) + 1)
+ throw new ArgumentOutOfRangeException ();
+
+ for (int i = 0; i < length; i++)
+ {
+ array.SetValueImpl(null, index + i);
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public virtual extern object Clone ();
+
+ public static void Copy (Array source, Array dest, int length)
+ {
+ // need these checks here because we are going to use
+ // GetLowerBound() on source and dest.
+ if (source == null)
+ throw new ArgumentNullException ("null");
+
+ if (dest == null)
+ throw new ArgumentNullException ("dest");
+
+ Copy (source, source.GetLowerBound (0), dest, dest.GetLowerBound (0), length);
+ }
+
+ public static void Copy (Array source, int source_idx, Array dest, int dest_idx, int length)
+ {
+ if (source == null)
+ throw new ArgumentNullException ("null");
+
+ if (dest == null)
+ throw new ArgumentNullException ("dest");
+
+ if (length < 0)
+ throw new ArgumentOutOfRangeException ("length");
+
+ if (source_idx < 0)
+ throw new ArgumentException ("source_idx");
+
+ if (dest_idx < 0)
+ throw new ArgumentException ("dest_idx");
+
+ int source_pos = source_idx - source.GetLowerBound (0);
+ int dest_pos = dest_idx - dest.GetLowerBound (0);
+
+
+ if (source_pos + length > source.Length || dest_pos + length > dest.Length)
+ throw new ArgumentException ("length");
+
+ if (source.Rank != dest.Rank)
+ throw new RankException ();
+
+ Type src_type = source.GetType ().GetElementType ();
+ Type dst_type = dest.GetType ().GetElementType ();
+
+ if (src_type == dst_type) {
+ FastCopy (source, source_pos, dest, dest_pos, length);
+ return;
+ }
+
+ if (!Object.ReferenceEquals (source, dest) || source_pos > dest_pos)
+ {
+ for (int i = 0; i < length; i++)
+ {
+ Object srcval = source.GetValueImpl (source_pos + i);
+
+ try {
+ dest.SetValueImpl (srcval, dest_pos + i);
+ } catch {
+ if ((dst_type.IsValueType || dst_type.Equals (typeof (String))) &&
+ (src_type.Equals (typeof (Object))))
+ throw new InvalidCastException ();
+ else
+ throw new ArrayTypeMismatchException (
+ String.Format ("(Types: source={0}; target={1})", src_type.FullName, dst_type.FullName));
+ }
+ }
+ }
+ else
+ {
+ for (int i = length - 1; i >= 0; i--)
+ {
+ Object srcval = source.GetValueImpl (source_pos + i);
+
+ try {
+ dest.SetValueImpl (srcval, dest_pos + i);
+ } catch {
+ if ((dst_type.IsValueType || dst_type.Equals (typeof (String))) &&
+ (src_type.Equals (typeof (Object))))
+ throw new InvalidCastException ();
+ else
+ throw new ArrayTypeMismatchException (
+ String.Format ("(Types: source={0}; target={1})", src_type.FullName, dst_type.FullName));
+ }
+ }
+ }
+ }
+
+ public static int IndexOf (Array array, object value)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ return IndexOf (array, value, 0, array.Length);
+ }
+
+ public static int IndexOf (Array array, object value, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ return IndexOf (array, value, index, array.Length - index);
+ }
+
+ public static int IndexOf (Array array, object value, int index, int length)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ if (array.Rank > 1)
+ throw new RankException ();
+
+ if (length < 0 || index < array.GetLowerBound (0) ||
+ index+length-1 > array.GetUpperBound (0))
+ throw new ArgumentOutOfRangeException ();
+
+ for (int i = 0; i < length; i++)
+ {
+ if (array.GetValueImpl(index + i).Equals(value))
+ return index + i;
+ }
+
+ return array.GetLowerBound (0) - 1;
+ }
+
+ public static int LastIndexOf (Array array, object value)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ return LastIndexOf (array, value, array.Length-1);
+ }
+
+ public static int LastIndexOf (Array array, object value, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ return LastIndexOf (array, value, index, index-array.GetLowerBound(0)+1);
+ }
+
+ public static int LastIndexOf (Array array, object value, int index, int length)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ if (array.Rank > 1)
+ throw new RankException ();
+
+ if (length < 0 || index-length+1 < array.GetLowerBound (0) ||
+ index > array.GetUpperBound (0))
+ throw new ArgumentOutOfRangeException ();
+
+ for (int i = index; i >= index-length+1; i--)
+ {
+ if (array.GetValueImpl(i).Equals(value))
+ return i;
+ }
+
+ return array.GetLowerBound (0) - 1;
+ }
+
+ public static void Reverse (Array array)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ Reverse (array, array.GetLowerBound (0), array.GetLength (0));
+ }
+
+ public static void Reverse (Array array, int index, int length)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ if (array.Rank > 1)
+ throw new RankException ();
+
+ if (index < array.GetLowerBound (0) || length < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (index + length > array.GetUpperBound (0) + 1)
+ throw new ArgumentException ();
+
+ for (int i = 0; i < length/2; i++)
+ {
+ object tmp;
+
+ tmp = array.GetValueImpl (index + i);
+ array.SetValueImpl(array.GetValueImpl (index + length - i - 1), index + i);
+ array.SetValueImpl(tmp, index + length - i - 1);
+ }
+ }
+
+ public static void Sort (Array array)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ Sort (array, null, array.GetLowerBound (0), array.GetLength (0), null);
+ }
+
+ public static void Sort (Array keys, Array items)
+ {
+ if (keys == null)
+ throw new ArgumentNullException ();
+
+ Sort (keys, items, keys.GetLowerBound (0), keys.GetLength (0), null);
+ }
+
+ public static void Sort (Array array, IComparer comparer)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ Sort (array, null, array.GetLowerBound (0), array.GetLength (0), comparer);
+ }
+
+ public static void Sort (Array array, int index, int length)
+ {
+ Sort (array, null, index, length, null);
+ }
+
+ public static void Sort (Array keys, Array items, IComparer comparer)
+ {
+ if (keys == null)
+ throw new ArgumentNullException ();
+
+ Sort (keys, items, keys.GetLowerBound (0), keys.GetLength (0), comparer);
+ }
+
+ public static void Sort (Array keys, Array items, int index, int length)
+ {
+ Sort (keys, items, index, length, null);
+ }
+
+ public static void Sort (Array array, int index, int length, IComparer comparer)
+ {
+ Sort (array, null, index, length, comparer);
+ }
+
+ public static void Sort (Array keys, Array items, int index, int length, IComparer comparer)
+ {
+ int low0 = index;
+ int high0 = index + length - 1;
+
+ qsort (keys, items, index, index + length - 1, comparer);
+ }
+
+ private static void qsort (Array keys, Array items, int low0, int high0, IComparer comparer)
+ {
+ if (keys == null)
+ throw new ArgumentNullException ();
+
+ if (keys.Rank > 1 || (items != null && items.Rank > 1))
+ throw new RankException ();
+
+ if (low0 >= high0)
+ return;
+
+ int low = low0;
+ int high = high0;
+
+ object objPivot = keys.GetValueImpl ((low + high) / 2);
+
+ while (low <= high)
+ {
+ // Move the walls in
+ while (low < high0 && compare (keys.GetValueImpl (low), objPivot, comparer) < 0)
+ ++low;
+ while (high > low0 && compare (objPivot, keys.GetValueImpl (high), comparer) < 0)
+ --high;
+
+ if (low <= high)
+ {
+ swap (keys, items, low, high);
+ ++low;
+ --high;
+ }
+ }
+
+ if (low0 < high)
+ qsort (keys, items, low0, high, comparer);
+ if (low < high0)
+ qsort (keys, items, low, high0, comparer);
+ }
+
+ private static void swap (Array keys, Array items, int i, int j)
+ {
+ object tmp;
+
+ tmp = keys.GetValueImpl (i);
+ keys.SetValueImpl (keys.GetValue (j), i);
+ keys.SetValueImpl (tmp, j);
+
+ if (items != null)
+ {
+ tmp = items.GetValueImpl (i);
+ items.SetValueImpl (items.GetValueImpl (j), i);
+ items.SetValueImpl (tmp, j);
+ }
+ }
+
+ private static int compare (object value1, object value2, IComparer comparer)
+ {
+ if (comparer == null)
+ return ((IComparable) value1).CompareTo(value2);
+ else
+ return comparer.Compare(value1, value2);
+ }
+
+ public virtual void CopyTo (Array array, int index)
+ {
+ if (array == null)
+ throw new ArgumentNullException ();
+
+ // The order of these exception checks may look strange,
+ // but that's how the microsoft runtime does it.
+ if (this.Rank > 1)
+ throw new RankException ();
+ if (index + this.GetLength (0) > array.GetLowerBound (0) + array.GetLength (0))
+ throw new ArgumentException ();
+ if (array.Rank > 1)
+ throw new RankException ();
+ if (index < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ Copy (this, this.GetLowerBound(0), array, index, this.GetLength (0));
+ }
+
+ internal class SimpleEnumerator : IEnumerator {
+ Array enumeratee;
+ int currentpos;
+ int length;
+
+ public SimpleEnumerator (Array arrayToEnumerate) {
+ this.enumeratee = arrayToEnumerate;
+ this.currentpos = -1;
+ this.length = arrayToEnumerate.Length;
+ }
+
+ public object Current {
+ get {
+ // Exception messages based on MS implementation
+ if (currentpos < 0 ) {
+ throw new InvalidOperationException
+ ("Enumeration has not started");
+ }
+ if (currentpos >= length) {
+ throw new InvalidOperationException
+ ("Enumeration has already ended");
+ }
+ // Current should not increase the position. So no ++ over here.
+ return enumeratee.GetValueImpl(currentpos);
+ }
+ }
+
+ public bool MoveNext() {
+ //The docs say Current should throw an exception if last
+ //call to MoveNext returned false. This means currentpos
+ //should be set to length when returning false.
+ if (currentpos < length) {
+ currentpos++;
+ }
+ if(currentpos < length)
+ return true;
+ else
+ return false;
+ }
+
+ public void Reset() {
+ currentpos= -1;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ArrayTypeMismatchException.cs b/mcs/class/corlib/System/ArrayTypeMismatchException.cs
new file mode 100644
index 00000000000..2938300de61
--- /dev/null
+++ b/mcs/class/corlib/System/ArrayTypeMismatchException.cs
@@ -0,0 +1,38 @@
+//
+// System.ArrayTypeMismatchException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+ [Serializable]
+ public class ArrayTypeMismatchException : SystemException {
+ // Constructors
+ public ArrayTypeMismatchException ()
+ : base (Locale.GetText ("Source array type cannot be assigned to destination array type"))
+ {
+ }
+
+ public ArrayTypeMismatchException (string message)
+ : base (message)
+ {
+ }
+
+ public ArrayTypeMismatchException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected ArrayTypeMismatchException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+
+ }
+}
diff --git a/mcs/class/corlib/System/AssemblyLoadEventArgs.cs b/mcs/class/corlib/System/AssemblyLoadEventArgs.cs
new file mode 100755
index 00000000000..dec3463c6aa
--- /dev/null
+++ b/mcs/class/corlib/System/AssemblyLoadEventArgs.cs
@@ -0,0 +1,34 @@
+//
+// System.AssemblyLoadEventArgs.cs
+//
+// Author:
+// Chris Hynes (chrish@assistedsolutions.com)
+//
+// (C) 2001 Chris Hynes
+//
+
+using System;
+using System.Reflection;
+
+namespace System
+{
+ public class AssemblyLoadEventArgs: EventArgs
+ {
+ private Assembly m_loadedAssembly;
+
+ public AssemblyLoadEventArgs(Assembly loadedAssembly)
+ {
+ this.m_loadedAssembly = loadedAssembly;
+ }
+
+ public Assembly LoadedAssembly
+ {
+ get
+ {
+ return m_loadedAssembly;
+ }
+ }
+ }
+}
+
+
diff --git a/mcs/class/corlib/System/AssemblyLoadEventHandler.cs b/mcs/class/corlib/System/AssemblyLoadEventHandler.cs
new file mode 100755
index 00000000000..46074f9523d
--- /dev/null
+++ b/mcs/class/corlib/System/AssemblyLoadEventHandler.cs
@@ -0,0 +1,10 @@
+// System.AssemblyLoadEventHandler.cs
+//
+// Paolo Molaro
+//
+// (C) 2002 Ximian, Inc.
+
+namespace System
+{
+ public delegate void AssemblyLoadEventHandler (object sender, AssemblyLoadEventArgs args);
+}
diff --git a/mcs/class/corlib/System/AsyncCallback.cs b/mcs/class/corlib/System/AsyncCallback.cs
new file mode 100644
index 00000000000..ba9ead8e6f2
--- /dev/null
+++ b/mcs/class/corlib/System/AsyncCallback.cs
@@ -0,0 +1,13 @@
+//
+// System/AsyncCallback.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+ public delegate void AsyncCallback (IAsyncResult ar);
+}
+
diff --git a/mcs/class/corlib/System/Attribute.cs b/mcs/class/corlib/System/Attribute.cs
new file mode 100644
index 00000000000..cdad17adbda
--- /dev/null
+++ b/mcs/class/corlib/System/Attribute.cs
@@ -0,0 +1,386 @@
+//
+// System.Attribute.cs
+//
+// Authors:
+// Miguel de Icaza (miguel@ximian.com) - Original
+// Nick D. Drochak II (ndrochak@gol.com) - Implemented most of the guts
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+
+namespace System {
+
+ [AttributeUsage(AttributeTargets.All)]
+ [Serializable]
+ public abstract class Attribute {
+
+ protected Attribute ()
+ {
+ }
+
+ public virtual object TypeId {
+ get {
+ // Derived classes should override this default behaviour as appropriate
+ return this.GetType ();
+ }
+ }
+
+ private static void CheckParameters (object element, Type attribute_type)
+ {
+ // neither parameter is allowed to be null
+ if (null == element)
+ {
+ throw new ArgumentNullException ("element");
+ }
+
+ if (null == attribute_type)
+ {
+ throw new ArgumentNullException ("attribute_type");
+ }
+ }
+
+ private static System.Attribute FindAttribute (object[] attributes)
+ {
+ // if there exists more than one attribute of the given type, throw an exception
+ if (attributes.Length > 1) {
+ throw new System.Reflection.AmbiguousMatchException (
+ Locale.GetText ("<element> has more than one attribute of type <attribute_type>"));
+ }
+
+ if (attributes.Length < 1)
+ return null;
+
+ // tested above for '> 1' and and '< 1', so only '== 1' is left,
+ // i.e. we found the attribute
+
+ return (System.Attribute) attributes[0];
+ }
+
+ private static void CheckAncestry (Type attribute_type)
+ {
+ // attribute_type must be derived from type System.Attribute
+ Type t = typeof (System.Attribute);
+
+ /* fixme: thgi does not work for target monolib2
+ if (!attribute_type.IsSubclassOf (t))
+ {
+ throw new ArgumentException ("Parameter is not a type derived from System.Attribute", "attribute_type");
+ }
+ */
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.ParameterInfo element,
+ Type attribute_type)
+ {
+ return GetCustomAttribute (element, attribute_type, true);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.MemberInfo element,
+ Type attribute_type)
+ {
+ return GetCustomAttribute (element, attribute_type, true);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.Assembly element,
+ Type attribute_type)
+ {
+ return GetCustomAttribute (element, attribute_type, true);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.Module element,
+ Type attribute_type)
+ {
+ return GetCustomAttribute (element, attribute_type, true);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.Module element,
+ Type attribute_type, bool inherit)
+ {
+ // neither parameter is allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // attribute_type must be derived from type System.Attribute
+ CheckAncestry (attribute_type);
+
+ // Module inheritance hierarchies CAN NOT be searched for attributes, so the second
+ // parameter of GetCustomAttributes () is INGNORED.
+ object[] attributes = element.GetCustomAttributes (attribute_type, inherit);
+
+ return FindAttribute (attributes);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.Assembly element,
+ Type attribute_type, bool inherit)
+ {
+ // neither parameter is allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // attribute_type must be derived from type System.Attribute
+ CheckAncestry (attribute_type);
+
+ // Assembly inheritance hierarchies CAN NOT be searched for attributes, so the second
+ // parameter of GetCustomAttributes () is INGNORED.
+ object[] attributes = element.GetCustomAttributes (attribute_type, inherit);
+
+ return FindAttribute (attributes);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.ParameterInfo element,
+ Type attribute_type, bool inherit)
+ {
+ // neither parameter is allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // attribute_type must be derived from type System.Attribute
+ CheckAncestry (attribute_type);
+
+ // ParameterInfo inheritance hierarchies CAN NOT be searched for attributes, so the second
+ // parameter of GetCustomAttributes () is INGNORED.
+ object[] attributes = element.GetCustomAttributes (attribute_type, inherit);
+
+ return FindAttribute (attributes);
+ }
+
+ public static Attribute GetCustomAttribute (System.Reflection.MemberInfo element,
+ Type attribute_type, bool inherit)
+ {
+ // neither parameter is allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // attribute_type must be derived from type System.Attribute
+ CheckAncestry (attribute_type);
+
+ // MemberInfo inheritance hierarchies can be searched for attributes, so the second
+ // parameter of GetCustomAttributes () is respected.
+ object[] attributes = element.GetCustomAttributes (attribute_type, inherit);
+
+ return FindAttribute (attributes);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Assembly element)
+ {
+ return System.Attribute.GetCustomAttributes (element, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.ParameterInfo element)
+ {
+ return System.Attribute.GetCustomAttributes (element, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.MemberInfo element){
+ return System.Attribute.GetCustomAttributes (element, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Module element){
+ return System.Attribute.GetCustomAttributes (element, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Assembly element,
+ Type attribute_type)
+ {
+ return System.Attribute.GetCustomAttributes (element, attribute_type, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Module element,
+ Type attribute_type)
+ {
+ return System.Attribute.GetCustomAttributes (element, attribute_type, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.ParameterInfo element,
+ Type attribute_type)
+ {
+ return System.Attribute.GetCustomAttributes (element, attribute_type, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.MemberInfo element,
+ Type attribute_type)
+ {
+ return System.Attribute.GetCustomAttributes (element, attribute_type, true);
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Assembly element,
+ Type attribute_type, bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes;
+
+ attributes = (System.Attribute[]) element.GetCustomAttributes (
+ attribute_type, inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.ParameterInfo element,
+ Type attribute_type, bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ attribute_type, inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Module element,
+ Type attribute_type, bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ attribute_type, inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.MemberInfo element,
+ Type attribute_type, bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, attribute_type);
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ attribute_type, inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Module element,
+ bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, typeof (System.Attribute));
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.Assembly element,
+ bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, typeof (System.Attribute));
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.MemberInfo element,
+ bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, typeof (System.Attribute));
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ inherit);
+
+ return attributes;
+ }
+
+ public static Attribute[] GetCustomAttributes (System.Reflection.ParameterInfo element,
+ bool inherit)
+ {
+ // element parameter is not allowed to be null
+ CheckParameters (element, typeof (System.Attribute));
+
+ // make a properly typed array to return containing the custom attributes
+ System.Attribute[] attributes = (System.Attribute[]) element.GetCustomAttributes (
+ inherit);
+
+ return attributes;
+ }
+
+ public override int GetHashCode ()
+ {
+ return ((Object) this).GetHashCode ();
+ }
+
+ public virtual bool IsDefaultAttribute ()
+ {
+ // Derived classes should override this default behaviour as appropriate
+ return false;
+ }
+
+ public static bool IsDefined (System.Reflection.Module element, Type attribute_type)
+ {
+ return (System.Attribute.GetCustomAttributes (element, attribute_type).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.ParameterInfo element, Type attribute_type)
+ {
+ return (System.Attribute.GetCustomAttributes (element, attribute_type).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.MemberInfo element, Type attribute_type)
+ {
+ return (System.Attribute.GetCustomAttributes (element, attribute_type).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.Assembly element, Type attribute_type)
+ {
+ return (System.Attribute.GetCustomAttributes (element, attribute_type).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.MemberInfo element, Type attribute_type,
+ bool inherit)
+ {
+ return (System.Attribute.GetCustomAttributes (
+ element, attribute_type, inherit).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.Assembly element, Type attribute_type,
+ bool inherit)
+ {
+ return (System.Attribute.GetCustomAttributes (
+ element, attribute_type, inherit).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.Module element, Type attribute_type,
+ bool inherit)
+ {
+ return (System.Attribute.GetCustomAttributes (
+ element, attribute_type, inherit).Length > 0);
+ }
+
+ public static bool IsDefined (System.Reflection.ParameterInfo element,
+ Type attribute_type, bool inherit)
+ {
+ return (System.Attribute.GetCustomAttributes (
+ element, attribute_type, inherit).Length > 0);
+ }
+
+ public virtual bool Match (object obj)
+ {
+ // default action is the same as Equals.
+ // Derived classes should override as appropriate
+
+ return this.Equals (obj);
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (obj == null || !(obj is Attribute))
+ return false;
+
+ return ((Attribute) obj) == this;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/AttributeTargets.cs b/mcs/class/corlib/System/AttributeTargets.cs
new file mode 100644
index 00000000000..a9cb1554ca6
--- /dev/null
+++ b/mcs/class/corlib/System/AttributeTargets.cs
@@ -0,0 +1,82 @@
+// AttributeTargets.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Fri, 7 Sep 2001 16:31:48 UTC
+// Source file: AllTypes.xml
+// URL: http://msdn.microsoft.com/net/ecma/AllTypes.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System {
+
+
+ /// <summary>
+ /// </summary>
+ [Flags]
+ public enum AttributeTargets {
+
+ /// <summary>
+ /// </summary>
+ Assembly = 0x00000001,
+
+ /// <summary>
+ /// </summary>
+ Module = 0x00000002,
+
+ /// <summary>
+ /// </summary>
+ Class = 0x00000004,
+
+ /// <summary>
+ /// </summary>
+ Struct = 0x00000008,
+
+ /// <summary>
+ /// </summary>
+ Enum = 0x00000010,
+
+ /// <summary>
+ /// </summary>
+ Constructor = 0x00000020,
+
+ /// <summary>
+ /// </summary>
+ Method = 0x00000040,
+
+ /// <summary>
+ /// </summary>
+ Property = 0x00000080,
+
+ /// <summary>
+ /// </summary>
+ Field = 0x00000100,
+
+ /// <summary>
+ /// </summary>
+ Event = 0x00000200,
+
+ /// <summary>
+ /// </summary>
+ Interface = 0x00000400,
+
+ /// <summary>
+ /// </summary>
+ Parameter = 0x00000800,
+
+ /// <summary>
+ /// </summary>
+ Delegate = 0x00001000,
+
+ /// <summary>
+ /// </summary>
+ ReturnValue = 0x00002000,
+
+ /// <summary>
+ /// </summary>
+ All = Assembly | Class | Struct | Enum | Constructor | Method | Property | Field | Event | Interface | Parameter | Delegate | ReturnValue,
+ } // AttributeTargets
+
+} // System
diff --git a/mcs/class/corlib/System/AttributeUsage.cs b/mcs/class/corlib/System/AttributeUsage.cs
new file mode 100644
index 00000000000..c0bcb0616a2
--- /dev/null
+++ b/mcs/class/corlib/System/AttributeUsage.cs
@@ -0,0 +1,50 @@
+//
+// System.AttributeUsage.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ [AttributeUsage(AttributeTargets.All)]
+ [Serializable]
+ public sealed class AttributeUsageAttribute : Attribute {
+ AttributeTargets valid_on;
+ bool allow_multiple, inherited;
+
+ public AttributeUsageAttribute (AttributeTargets validOn)
+ {
+ valid_on = validOn;
+ }
+
+ public bool AllowMultiple {
+ get {
+ return allow_multiple;
+ }
+
+ set {
+ allow_multiple = value;
+ }
+ }
+
+ public bool Inherited {
+ get {
+ return inherited;
+ }
+
+ set {
+ inherited = value;
+ }
+ }
+
+ public AttributeTargets ValidOn {
+ get {
+ return valid_on;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System/BadImageFormatException.cs b/mcs/class/corlib/System/BadImageFormatException.cs
new file mode 100644
index 00000000000..8ea5857f5fa
--- /dev/null
+++ b/mcs/class/corlib/System/BadImageFormatException.cs
@@ -0,0 +1,93 @@
+// System.BadImageFormatException
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class BadImageFormatException : SystemException
+ {
+ // Fields
+ private string msg; // we need this because System.Exception's message is private.
+ private Exception inner;
+ private string fileName;
+ private string fusionLog;
+
+ // Constructors
+ public BadImageFormatException ()
+ : base (Locale.GetText ("Invalid file image."))
+ {
+ msg = "Invalid file image.";
+ }
+
+ public BadImageFormatException (string message)
+ : base (message)
+ {
+ msg = message;
+ }
+
+ protected BadImageFormatException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ fileName = info.GetString ("BadImageFormat_FileName");
+ fusionLog = info.GetString ("BadImageFormat_FusionLog");
+ }
+
+ public BadImageFormatException (string message, Exception inner)
+ : base (message, inner)
+ {
+ msg = message;
+ this.inner = inner;
+ }
+
+ public BadImageFormatException (string message, string fileName)
+ : base (message)
+ {
+ msg = message;
+ this.fileName = fileName;
+ }
+
+ public BadImageFormatException (string message, string fileName, Exception inner)
+ : base (message, inner)
+ {
+ msg = message;
+ this.inner = inner;
+ this.fileName = fileName;
+ }
+
+ // Properties
+ public override string Message
+ {
+ get { return Locale.GetText (msg); }
+ }
+
+ public string FileName
+ {
+ get { return fileName; }
+ }
+
+ public string FusionLog
+ {
+ get { return fusionLog; }
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("BadImageFormat_FileName", fileName);
+ info.AddValue ("BadImageFormat_FusionLog", fusionLog);
+ }
+
+ public override string ToString ()
+ {
+ return inner.ToString();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/BitConverter.cs b/mcs/class/corlib/System/BitConverter.cs
new file mode 100755
index 00000000000..c7a5e7bddde
--- /dev/null
+++ b/mcs/class/corlib/System/BitConverter.cs
@@ -0,0 +1,270 @@
+//
+// System.BitConverter
+//
+// Author:
+// Matt Kimball (matt@kimball.net)
+//
+
+using System;
+
+namespace System {
+ public sealed class BitConverter {
+
+ private BitConverter () {}
+
+ static bool AmILittleEndian()
+ {
+ byte[] one = GetBytes((int)1);
+ return (one[0] == 1);
+ }
+
+ public static readonly bool IsLittleEndian = AmILittleEndian ();
+
+ public static long DoubleToInt64Bits(double value)
+ {
+ return ToInt64(GetBytes(value), 0);
+ }
+
+ public static double Int64BitsToDouble(long value)
+ {
+ return ToDouble(GetBytes(value), 0);
+ }
+
+ unsafe static byte[] GetBytes(byte *ptr, int count)
+ {
+ byte[] ret = new byte[count];
+
+ for (int i = 0; i < count; i++) {
+ ret[i] = ptr[i];
+ }
+
+ return ret;
+ }
+
+ unsafe public static byte[] GetBytes(bool value)
+ {
+ return GetBytes((byte *)&value, 1);
+ }
+
+ unsafe public static byte[] GetBytes(char value)
+ {
+ return GetBytes((byte *)&value, 2);
+ }
+
+ unsafe public static byte[] GetBytes(short value)
+ {
+ return GetBytes((byte *)&value, 2);
+ }
+
+ unsafe public static byte[] GetBytes(int value)
+ {
+ return GetBytes((byte *)&value, 4);
+ }
+
+ unsafe public static byte[] GetBytes(long value)
+ {
+ return GetBytes((byte *)&value, 8);
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static byte[] GetBytes(ushort value)
+ {
+ return GetBytes((byte *)&value, 2);
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static byte[] GetBytes(uint value)
+ {
+ return GetBytes((byte *)&value, 4);
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static byte[] GetBytes(ulong value)
+ {
+ return GetBytes((byte *)&value, 8);
+ }
+
+ unsafe public static byte[] GetBytes(float value)
+ {
+ return GetBytes((byte *)&value, 4);
+ }
+
+ unsafe public static byte[] GetBytes(double value)
+ {
+ return GetBytes((byte *)&value, 8);
+ }
+
+ unsafe static void PutBytes(byte *dst, byte[] src, int start_index, int count)
+ {
+ if (src == null) {
+ throw new ArgumentNullException();
+ }
+
+ if (src.Length < start_index + count) {
+ // LAMESPEC:
+ // the docs say it should be ArgumentOutOfRangeException, but
+ // the mscorlib throws an ArgumentException.
+ throw new ArgumentException();
+ }
+
+ for (int i = 0; i < count; i++) {
+ dst[i] = src[i + start_index];
+ }
+ }
+
+ unsafe public static bool ToBoolean(byte[] value, int start_index)
+ {
+ bool ret;
+
+ PutBytes((byte *)&ret, value, start_index, 1);
+
+ return ret;
+ }
+
+ unsafe public static char ToChar(byte[] value, int start_index)
+ {
+ char ret;
+
+ PutBytes((byte *)&ret, value, start_index, 2);
+
+ return ret;
+ }
+
+ unsafe public static short ToInt16(byte[] value, int start_index)
+ {
+ short ret;
+
+ PutBytes((byte *)&ret, value, start_index, 2);
+
+ return ret;
+ }
+
+ unsafe public static int ToInt32(byte[] value, int start_index)
+ {
+ int ret;
+
+ PutBytes((byte *)&ret, value, start_index, 4);
+
+ return ret;
+ }
+
+ unsafe public static long ToInt64(byte[] value, int start_index)
+ {
+ long ret;
+
+ PutBytes((byte *)&ret, value, start_index, 8);
+
+ return ret;
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static ushort ToUInt16(byte[] value, int start_index)
+ {
+ ushort ret;
+
+ PutBytes((byte *)&ret, value, start_index, 2);
+
+ return ret;
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static uint ToUInt32(byte[] value, int start_index)
+ {
+ uint ret;
+
+ PutBytes((byte *)&ret, value, start_index, 4);
+
+ return ret;
+ }
+
+ [CLSCompliant(false)]
+ unsafe public static ulong ToUInt64(byte[] value, int start_index)
+ {
+ ulong ret;
+
+ PutBytes((byte *)&ret, value, start_index, 8);
+
+ return ret;
+ }
+
+ unsafe public static float ToSingle(byte[] value, int start_index)
+ {
+ float ret;
+
+ PutBytes((byte *)&ret, value, start_index, 4);
+
+ return ret;
+ }
+
+ unsafe public static double ToDouble(byte[] value, int start_index)
+ {
+ double ret;
+
+ PutBytes((byte *)&ret, value, start_index, 8);
+
+ return ret;
+ }
+
+ public static string ToString(byte[] value)
+ {
+ if (value == null) {
+ throw new ArgumentNullException();
+ }
+
+ return ToString(value, 0, value.Length);
+ }
+
+ public static string ToString(byte[] value, int start_index)
+ {
+ if (value == null) {
+ throw new ArgumentNullException();
+ }
+
+ return ToString(value, start_index, value.Length - start_index);
+ }
+
+ public static string ToString(byte[] value, int start_index, int length)
+ {
+ if (value == null) {
+ throw new ArgumentNullException();
+ }
+
+ // The 4th and last clause (start_index >= value.Length)
+ // was added as a small fix to a very obscure bug.
+ // It makes a small difference when start_index is
+ // outside the range and length==0.
+ if (start_index < 0 || length < 0 || start_index + length > value.Length || start_index >= value.Length) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ string ret = "";
+ int end = start_index + length;
+
+ for (int i = start_index; i < end; i++) {
+ if (i > start_index)
+ ret = ret + '-';
+
+ char high = (char)((value[i] >> 4) & 0x0f);
+ char low = (char)(value[i] & 0x0f);
+
+ if (high < 10)
+ high += '0';
+ else {
+ high -= (char) 10;
+ high += 'A';
+ }
+
+ if (low < 10)
+ low += '0';
+ else {
+ low -= (char) 10;
+ low += 'A';
+ }
+
+ ret = ret + high + low;
+ }
+
+ return ret;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Boolean.cs b/mcs/class/corlib/System/Boolean.cs
new file mode 100644
index 00000000000..e3336b18d08
--- /dev/null
+++ b/mcs/class/corlib/System/Boolean.cs
@@ -0,0 +1,266 @@
+//
+// System.Boolean.cs
+//
+// Author:
+// Derek Holden (dholden@draper.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+//
+// I guess this is the Boolean class. This was written word for word
+// off the Library specification for System.Boolean in the ECMA
+// TC39 TG2 and TG3 working documents.
+//
+// The XML style documentation isn't that elegant, but it seems to
+// be the standard way according to the poorly documented C#
+// Programmer's Reference section on XML Documentation.
+//
+// This header and the one above it can be formatted however, just trying
+// to keep it consistent w/ the existing mcs headers.
+//
+// Even though it's not in the ECMA docs, the .NET Framework Class Library
+// says this implements IConvertible, but if it does it has some other
+// member functions to implement.
+//
+
+using System.Globalization;
+namespace System {
+
+ /// <summary>
+ /// Represents the boolean values of logical true and false.
+ /// </summary>
+ [Serializable]
+ public struct Boolean : IComparable, IConvertible {
+
+ /// <value>
+ /// The String representation of Boolean False
+ /// </value>
+ public static readonly string FalseString;
+
+ /// <value>
+ /// The String representation of Boolean True
+ /// </value>
+ public static readonly string TrueString;
+
+ /// <value>
+ /// Internal bool value for for this instance
+ /// </value>
+ //
+ // HACK: we tag it as public, so the source will compile.
+ public bool value;
+
+ static Boolean ()
+ {
+ FalseString = "False";
+ TrueString = "True";
+ }
+
+ /// <summary>
+ /// Compares the current Boolean instance against another object.
+ /// </summary>
+ /// <remarks>
+ /// Throws an ArgumentException if <c>obj</c> isn't null or
+ /// a Boolean.
+ /// </remarks>
+ /// <param name="obj">
+ /// The object to compare against
+ /// </param>
+ /// <returns>
+ /// An int reflecting the sort order of this instance as
+ /// compared to <c>obj</c>
+ /// -1 if this instance is false and <c>obj</c> is true
+ /// 0 if this instance is equal to <c>obj</c>
+ /// 1 if this instance is true and <c>obj</c> is false,
+ /// or <c>obj</c> is null
+ /// </returns>
+ public int CompareTo (object obj)
+ {
+ if (obj == null)
+ return 1;
+
+ if (!(obj is System.Boolean))
+ throw new ArgumentException
+ (Locale.GetText ("Object is not a Boolean and is not a null reference"));
+
+ // for case #3
+ if (obj == null || (value == true && (bool)obj == false))
+ return 1;
+
+ // for case #2, else it's #1
+ return (value == (bool)obj) ? 0 : -1;
+ }
+
+ /// <summary>
+ /// Determines whether this instance and another object represent the
+ /// same type and value.
+ /// </summary>
+ /// <param name="obj">
+ /// The object to check against
+ /// </param>
+ /// <returns>
+ /// true if this instnace and <c>obj</c> are same value,
+ /// otherwise false if it is not or null
+ /// </returns>
+ public override bool Equals (Object obj)
+ {
+ if (obj == null || !(obj is System.Boolean))
+ return false;
+
+ return ((bool)obj) == value;
+ }
+
+ /// <summary>
+ /// Generates a hashcode for this object.
+ /// </summary>
+ /// <returns>
+ /// An Int32 value holding the hash code
+ /// </returns>
+ public override int GetHashCode ()
+ {
+ // Guess there's not too many ways to hash a Boolean
+ return value ? 1 : 0;
+ }
+
+ /// <summary>
+ /// Returns a given string as a boolean value. The string must be
+ /// equivalent to either TrueString or FalseString, with leading and/or
+ /// trailing spaces, and is parsed case-insensitively.
+ /// </summary>
+ /// <remarks>
+ /// Throws an ArgumentNullException if <c>val</c> is null, or a
+ /// FormatException if <c>val</c> doesn't match <c>TrueString</c>
+ /// or <c>FalseString</c>
+ /// </remarks>
+ /// <param name="val">
+ /// The string value to parse
+ /// </param>
+ /// <returns>
+ /// true if <c>val</c> is equivalent to TrueString,
+ /// otherwise false
+ /// </returns>
+ public static bool Parse (string val)
+ {
+ if (val == null)
+ throw new ArgumentNullException (
+ Locale.GetText ("Value is a null reference"));
+
+ val = val.Trim ();
+
+ if (String.Compare (val, TrueString, true) == 0)
+ return true;
+
+ if (String.Compare (val, FalseString, true) == 0)
+ return false;
+
+ throw new FormatException (Locale.GetText (
+ "Value is not equivalent to either TrueString or FalseString"));
+ }
+
+ /// <summary>
+ /// Returns a string representation of this Boolean object.
+ /// </summary>
+ /// <returns>
+ /// <c>FalseString</c> if the instance value is false, otherwise
+ /// <c>TrueString</c>
+ /// </returns>
+ public override string ToString ()
+ {
+ return value ? TrueString : FalseString;
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Boolean;
+ }
+
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType(value, conversionType, provider);
+ }
+
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ return value;
+ }
+
+ public byte ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte(value);
+ }
+
+ public char ToChar (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ [CLSCompliant(false)]
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal(value);
+ }
+
+ public double ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble(value);
+ }
+
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16(value);
+ }
+
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32(value);
+ }
+
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64(value);
+ }
+
+ [CLSCompliant(false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte(value);
+ }
+
+ public float ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle(value);
+ }
+
+ public string ToString (IFormatProvider provider)
+ {
+ return ToString();
+ }
+
+ [CLSCompliant(false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16(value);
+ }
+
+ [CLSCompliant(false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32(value);
+ }
+
+ [CLSCompliant(false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64(value);
+ }
+
+ } // System.Boolean
+
+} // Namespace System
diff --git a/mcs/class/corlib/System/Buffer.cs b/mcs/class/corlib/System/Buffer.cs
new file mode 100755
index 00000000000..16a48b66592
--- /dev/null
+++ b/mcs/class/corlib/System/Buffer.cs
@@ -0,0 +1,70 @@
+//
+// System/Buffer.cs
+//
+// Authors:
+// Paolo Molaro (lupus@ximian.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System {
+ public sealed class Buffer {
+
+ private Buffer () {}
+
+ public static int ByteLength (Array array) {
+ // note: the other methods in this class also use ByteLength to test for
+ // null and non-primitive arguments as a side-effect.
+
+ if (array == null)
+ throw new ArgumentNullException (); // default message
+
+ int length = ByteLengthInternal (array);
+ if (length < 0)
+ throw new ArgumentException ("Object must be array of primitives.");
+
+ return length;
+ }
+
+ public static byte GetByte (Array array, int index) {
+ if (index < 0 || index >= ByteLength (array))
+ throw new ArgumentException ("Index was out of range. Must be non-negative and less than the size of the collection.");
+
+ return GetByteInternal (array, index);
+ }
+
+ public static void SetByte (Array array, int index, byte value) {
+ if (index < 0 || index >= ByteLength (array))
+ throw new ArgumentException ("Index was out of range. Must be non-negative and less than the size of the collection.");
+
+ SetByteInternal (array, index, value);
+ }
+
+ public static void BlockCopy (Array src, int src_offset, Array dest, int dest_offset, int count) {
+ if (src_offset < 0 || dest_offset < 0 || count < 0)
+ throw new ArgumentOutOfRangeException ("Non-negative number required.");
+
+ if (src_offset + count > ByteLength (src) || dest_offset + count > ByteLength (dest))
+ throw new ArgumentException ("Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.");
+
+ BlockCopyInternal (src, src_offset, dest, dest_offset, count);
+ }
+
+ // private
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static int ByteLengthInternal (Array array);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static byte GetByteInternal (Array array, int index);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static void SetByteInternal (Array array, int index, int value);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static void BlockCopyInternal (Array src, int src_offset, Array dest, int dest_offset, int count);
+ }
+}
diff --git a/mcs/class/corlib/System/Byte.cs b/mcs/class/corlib/System/Byte.cs
new file mode 100644
index 00000000000..914ef550692
--- /dev/null
+++ b/mcs/class/corlib/System/Byte.cs
@@ -0,0 +1,249 @@
+//
+// System.Byte.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public struct Byte : IComparable, IFormattable, IConvertible {
+
+ public const byte MinValue = 0;
+ public const byte MaxValue = 255;
+
+ // VES needs to know about value. public is workaround
+ // so source will compile
+ public byte value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Byte))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Byte"));
+
+ byte xv = (byte) v;
+
+ if (value == xv)
+ return 0;
+ if (value > xv)
+ return 1;
+ else
+ return -1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Byte))
+ return false;
+
+ return ((byte) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ public static byte Parse (string s)
+ {
+ byte val = 0;
+ int len;
+ int i;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ // look for the first non-whitespace character
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ // if it's all whitespace, then throw exception
+ if (i == len)
+ throw new FormatException ();
+
+ // look for the optional '+' sign
+ if (s [i] == '+')
+ i++;
+
+ // we should just have numerals followed by whitespace now
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ // shift left and accumulate every time we find a numeral
+ byte d = (byte) (c - '0');
+
+ val = checked ((byte) (val * 10 + d));
+ digits_seen = true;
+ } else {
+ // after the last numeral, only whitespace is allowed
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+
+ // if all we had was a '+' sign, then throw exception
+ if (!digits_seen)
+ throw new FormatException ();
+
+ return val;
+ }
+
+ public static byte Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ public static byte Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ public static byte Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ uint tmpResult = UInt32.Parse (s, style, fp);
+ if (tmpResult > Byte.MaxValue || tmpResult < Byte.MinValue)
+ throw new OverflowException ("Value too large or too small.");
+
+ return (byte) tmpResult;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (IFormatProvider provider)
+ {
+ return ToString (null, provider);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Byte;
+ }
+
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType(value, conversionType, provider);
+ }
+
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean(value);
+ }
+
+ public byte ToByte (IFormatProvider provider)
+ {
+ return value;
+ }
+
+ public char ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar(value);
+ }
+
+ [CLSCompliant(false)]
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal(value);
+ }
+
+ public double ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble(value);
+ }
+
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16(value);
+ }
+
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32(value);
+ }
+
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64(value);
+ }
+
+ [CLSCompliant(false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte(value);
+ }
+
+ public float ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle(value);
+ }
+
+ string IConvertible.ToString (IFormatProvider provider)
+ {
+ return ToString("G", provider);
+ }
+
+ [CLSCompliant(false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16(value);
+ }
+
+ [CLSCompliant(false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32(value);
+ }
+
+ [CLSCompliant(false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64(value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/CLSCompliantAttribute.cs b/mcs/class/corlib/System/CLSCompliantAttribute.cs
new file mode 100755
index 00000000000..aae9120a250
--- /dev/null
+++ b/mcs/class/corlib/System/CLSCompliantAttribute.cs
@@ -0,0 +1,35 @@
+//
+// System.CLSCompliantAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// Used to indicate if an element of a program is CLS compliant.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// </remarks>
+ [AttributeUsage(AttributeTargets.All)]
+ [Serializable]
+ public sealed class CLSCompliantAttribute : Attribute {
+
+ bool is_compliant;
+
+ public CLSCompliantAttribute (bool is_compliant)
+ {
+ this.is_compliant = is_compliant;
+ }
+
+ public bool IsCompliant {
+ get {
+ return is_compliant;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/CannotUnloadAppDomainException.cs b/mcs/class/corlib/System/CannotUnloadAppDomainException.cs
new file mode 100644
index 00000000000..1cd03735a35
--- /dev/null
+++ b/mcs/class/corlib/System/CannotUnloadAppDomainException.cs
@@ -0,0 +1,41 @@
+//
+// System.CannotUnloadAppDomainException
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class CannotUnloadAppDomainException : SystemException
+ {
+ // Constructors
+ public CannotUnloadAppDomainException ()
+ : base (Locale.GetText ("Attempt to unload application domain failed."))
+ {
+ }
+
+ public CannotUnloadAppDomainException (string message)
+ : base (message)
+ {
+ }
+
+ protected CannotUnloadAppDomainException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public CannotUnloadAppDomainException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog
new file mode 100644
index 00000000000..78f3bda1665
--- /dev/null
+++ b/mcs/class/corlib/System/ChangeLog
@@ -0,0 +1,1901 @@
+2002-04-22 Miguel de Icaza <miguel@ximian.com>
+
+ * ValueType.cs: Add Serializable attribute.
+
+ * String.cs: ifdef-out out the __arglist Concat function until I
+ add support for that to mcs.
+
+2002-04-24 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * AppDomain.cs (GetValue): usage of the correct icall (bug)
+
+Wed Apr 24 21:15:44 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * GC.cs: implement most of the methods as icalls.
+
+2002-04-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * DecimalFormatter.cs (ToString): return correct value when the
+ decimal number is 0.
+
+2002-04-24 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * Type.cs (GetProperty): fixed call syntax (needs an empty array not null)
+ * MonoType.cs (GetPropertyImpl) : basic implementation (ignores types, bindingAttr, modifiers)
+
+2002-04-24 Nick Drochak <ndrochak@gol.com>
+
+ * Double.cs (Parse): Handle case where there are no digits before the
+ decimal point, such as ".1".
+
+2002-04-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Int32.cs:
+ * UInt32.cs:
+ * Int64.cs:
+ * UInt64.cs: fixed bug #23738 (hex numbers parsed wrong).
+
+2002-04-23 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * String.cs (Split): fixed invalid split of count 0 and 1.
+
+2002-04-23 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * String.cs (LastIndexOf): fixed argument checking.
+ * String.cs (Equals): made internal for performace.
+
+2002-04-23 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs (Join): check argument and throw exception if needed
+
+2002-04-23 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs (StartsWith): check argument and throw exception if needed
+
+2002-04-22 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs (IndexOfAny): check arguments and throw exceptions as
+ neccessary. ALso remove some debug WriteLines.
+
+2002-04-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * String.cs: use internal constructors
+ buf fix in Concat.
+
+Thu Apr 18 17:16:15 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: make GetElementType its own icall.
+
+2002-04-18 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs: Modified file. Re-add methods needed by the unit tests.
+
+Thu Apr 18 12:38:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: some code speedups and restored GetTypeCode().
+
+2002-04-17 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * String.cs: New implementation using internal calls.
+
+2002-04-16 Nick Drochak <ndrochak@gol.com>
+
+ * DecimalFormatter.cs: Trim off excess null characters from the string
+ that decimal2string gives back.
+
+2002-04-16 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs (SubString): revert my change. I can't reproduce the
+ problem anymore.
+
+2002-04-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Attribute.cs: added GetHashCode and Equals.
+
+2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Enum.cs: little improvements to Format ().
+
+Thu Apr 11 12:28:13 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: internalcall GetHashCode().
+ * Array.cS: optimize access to elements.
+
+Wed Apr 10 21:20:19 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: make IndexOfAny() use an internalcall.
+
+2002-04-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Int32.cs:
+ * UInt32.cs:
+ * Int64.cs:
+ * UInt64.cs: fixed error when testing for validity of flags.
+
+2002-04-11 Nick Drochak <ndrochak@gol.com>
+
+ * Double.cs: Use an internal call for ToString(). This is just a simple
+ implementation to get away from throwing a NotImplementedException.
+
+2002-04-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Int32.cs:
+ * UInt32.cs:
+ * Int64.cs:
+ * UInt64.cs: changed Type.GetType () by typeof (), as suggested by
+ lupus.
+
+ * Int32.cs:
+ * Int64.cs: throw an OverFlowException when parsing a string
+ containing a dot followed by any non '0' number.
+
+2002-04-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Byte.cs:
+ * UInt16.cs:
+ * UInt32.cs:
+ * UInt64.cs: added complex Parse ().
+
+2002-04-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * SByte.cs:
+ * Int16.cs:
+ * Int32.cs:
+ * Int64.cs: added complex Parse ().
+
+2002-04-09 Nick Drochak <ndrochak@gol.com>
+
+ * Array.cs (BinarySearch): Add checks on paramters before using them
+ and throw exceptions as needed.
+
+ * Enum.cs (Format): Check if [Flags] is applied to enum and convert
+ "G" format to "F" if so.
+
+Tue Apr 9 13:12:09 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoCustomAttrs.cs: return arrays of type Attribute[]
+ instead of object[].
+
+2002/04/09 Nick Drochak <ndrochak@gol.com>
+
+ * String.cs (Substring): Copy only non-null characters to the new
+ string.
+
+2002-04-09 Nick Drochak <ndrochak@gol.com>
+
+ * IntegerFormatter.cs: Don't use a format character to indicate a
+ custom format was passed in. It was using 'z' to indicate a custom
+ format, but really it should throw a format exception if the user
+ tries to use "z" as the format string. Now it does.
+
+ * Activator.cs: New File.
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs (ToString): Big ugly fix for the case where [Flags] is
+ applied to an enum. Need to handle the different possible integer
+ types of an enum somehow. Can anyone say generics?
+
+Mon Apr 8 06:22:42 2002 Piers Haken <piersh@friskit.com>
+
+ * Convert.cs: switched the To*(object) methods to use
+ IConvertible directly instead of calling ChangeType
+
+Sat Apr 6 20:08:41 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * ValueType.cs: make Equals() an internalcall.
+
+Fri Apr 5 15:38:54 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: also look for nested types in FindMembers.
+ * MonoType.cs: make GetNestedTypes() an internalcall.
+
+2002-04-05 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs (Parse): Handle different underlying types.
+
+2002/04/04 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs (IsDefined): Throw exception when type of value to look for
+ is not the correct one. Attempt to have it work with string values
+ too, but not sure if the unit tests are getting that far yet.
+
+2002-04-04 Nick Drochak <ndrochak@gol.com>
+
+ * Decimal.cs: Fix a couple of typos.
+
+Wed Apr 3 19:46:00 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Enum.cs: the values array is of the enum and not of the underlying
+ type. Updates and some bug fixes.
+ * MonoType.cs: make the internalcall return FullName instead of the
+ assembly qualified name.
+ * Type.cs: make ToString () simply return FullName.
+
+2002-04-03 Nick Drochak <ndrochak@gol.com>
+
+ * Type.cs (GetTypeCode): provide some of the implementation for this
+ method. It's still too simplistic to be considered complete.
+
+2002-04-02 Dietmar Maurer <dietmar@ximian.com>
+
+ * Object.cs: fixed FieldGetter/FieldSetter signature
+
+2002-04-02 Nick Drochak <ndrochak@gol.com>
+
+ * Environment.cs: add MonoTODO's on parts that should have it.
+
+2002-04-01 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs: added reality checks (check parameters to most methods that
+ need them).
+
+2002-03-30 Dietmar Maurer <dietmar@ximian.com>
+
+ * Object.cs: added FieldGetter/FieldSetter
+
+2002-03-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IntegerFormatter.cs: fixed initialization error in static
+ constructor.
+
+2002-03-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * Delegate.cs: added new field to store a trampoline function
+
+2002-03-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IntegerFormatter.cs: added workaround for bug #22668. First patch to
+ make custom format strings work (not fully functional yet).
+
+2002/03/28 Nick Drochak <ndrochak@gol.com>
+
+ * IntegerFormatter.cs: Change class from internal to public. Add
+ necessary [CLSCompliant(false)] attributes.
+
+2002-03-27 Duco Fijma <duco@lorentz.xs4all.nl>
+ * _AppDomain.cs, AppDomain.cs: renamed method GetDate to GetData
+ (was a typo)
+
+2002-03-28 Nick Drochak <ndrochak@gol.com>
+
+ * Type.cs: Added MonoTODO tags on members that have FIXME, etc.
+
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Console.cs: Modified to get std handles from MonoIO.
+ * Environment.cs: removed PAL dependencies.
+
+2002-03-25 Miguel de Icaza <miguel@ximian.com>
+
+ * IntPtr.cs: Temporary work-around until I fix the assembly
+ attributes bug.
+
+ * String.cs (System): Removed enumeration, because it is pretty
+ hard to support enumerations in /nostdlib mode for the core types.
+
+Tue Mar 19 18:18:49 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Array.cs: move error handling in the catch block.
+ * MulticastDelegate.cs: remove == and != operators that were
+ removed with the delegate changes (when you add stuff, please do not
+ remove existing functionality!).
+ * Type.cs: if a property is not found in a type, search for it
+ in the parent types, too.
+
+2002-03-18 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * Math.cs: changed to use icall instead of PAL.
+
+2002-03-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * Double.cs: added check for NaN (Bug [22082])
+
+2002-03-19 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs (Equals): check for null and throw if it is.
+ * Enum.cs (Format): check for null parameters and throw if necessary.
+ This method still needs more argument checking.
+
+2002-03-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * Enum.cs (Equals): check if Enums are of the same type
+
+2002-03-18 Nick Drochak <ndrochak@gol.com>
+
+ * Double.cs: Explicitly handle comparisons in CompareTo() for
+ Positive/Negative Infinity and NaN. Unit Test now passes on Linux.
+
+ * Enum.cs(CompareTo): Check types of values before trying to compare.
+ Throw exceptions if types are invalid or don't match.
+
+2002-03-14 Miguel de Icaza <miguel@ximian.com>
+
+ * Array.cs: Add some extra debugging information.
+
+2002-03-15 Nick Drochak <ndrochak@gol.com>
+
+ * Array.cs: Added IList and IEnumerable.
+
+2002-03-14 Miguel de Icaza <miguel@ximian.com>
+
+ * UInt64.cs, UInt32.cs, UInt16.cs: Mark public parse methods as
+ NonCLSCompliant.
+
+2002-03-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * Delegate.cs (Equals): also compare method_ptr
+ (GetHashCode): returm method_ptr as hash
+
+2002-03-13 Duco Fijma <duco@lorentz.xs4all.n>
+ * TimeSpan.cs: removed the use of Custom Numeric Format Strings,
+ such as 42.ToString("0000000"), as these are (currently) not implemented
+ in System.IntegerFormatter. TimeSpan luckely can do with Standard
+ Numeric Format Strings, such as 42.ToString("D7").
+
+2002-03-12 Duncan Mak <duncan@ximian.com>
+
+ * FieldAccessException.cs:
+ * MethodAccessException.cs:
+ * PlatformNotSupportedException.cs: Inherit from
+ MemberAccessException, not SystemException.
+
+ * ObsoleteAttribute.cs: Made Message and IsError properties
+ instead of fields.
+
+Tue Mar 12 19:21:18 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * GC.cs: make SuppressFinalize() a nop.
+ * Delegate.cs: fix == operator.
+
+2002-03-13 Nick Drochak <ndrochak@gol.com>
+
+ * Enum.cs: Add IConvertible methods. Cyclic dependancy fixed in the
+ runtime that goes with this patch.
+
+2002-03-10 Martin Baulig <martin@gnome.org>
+
+ * Int32.cs (Parse): Correctly parse negative numbers.
+
+2002-03-08 Martin Baulig <martin@gnome.org>
+
+ * String.cs (Split): Really fix it this time. Also adding several new
+ testcase to the testsuite.
+
+2002-03-08 Martin Baulig <martin@gnome.org>
+
+ * Array.cs (Copy): Optimized: removed duplicate null check, removed
+ two duplicate GetLowerBound() calls and one duplicate IsValueType.
+
+Fri Mar 8 18:49:19 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Object.cs: commit my hacked GetHashCode(): it's good enough for now.
+ * String.cs: use the dumb code for IndexOf(string): this is worth
+ 15-20 % speedup in mcs compile with mint.
+
+Fri Mar 8 12:45:44 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: revert change to Split() that broke the compiler (hi martin!:-).
+
+2002-03-07 Martin Baulig <martin@gnome.org>
+
+ * String.cs (Join): Throw an ArgumentNullException.
+ (LastIndexOf (string,int,int)): This method does a backwards search,
+ so startIndex points to the end of value, not to its beginning. Don't
+ throw an exception if startIndex equals this.Length. Always return -1
+ if startIndex is smaller than the length of value.
+ (Replace (string,string)): Replace all occurences of oldValue.
+ If newValue is null, all occurences of oldValue are to be removed.
+ (Split (char[],int)): Return an empty array if maxCount is zero, throw
+ an ArgumentOutOfRangeException if it's less than zero. Return maxValue
+ elements, not maxValue+1.
+
+Thu Mar 7 17:16:06 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: make GetEvents() an internal call.
+ * MulticastDelegate.cs: copy the passed in array.
+
+2002-03-06 Martin Baulig <martin@gnome.org>
+
+ * Array.cs (Copy): Use FastCopy when appropriate and do correct
+ exception handling.
+
+2002-03-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * CharEnumerator.cs: fixes to CharEnumertor.MoveNext, fixing
+ some of the failures found be new tests (see ChangeLog in
+ Test/System). Comments added to this method, based on
+ the representation invariant of this class, that (try to) explain
+ why it now should be correct.
+
+2002-03-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * Int64.cs (Parse): bug fix for max. negative value.
+
+2002-03-07 Nick Drochak <ndrochak@gol.com>
+
+ * RuntimeTypeHandle.cs: Add Serializable attribute as the docs say.
+ I need to understand what the difference between the attribute and
+ the interface is.
+
+2002-03-06 Martin Baulig <martin@gnome.org>
+
+ * Array.cs (Copy): Always throw an ArrayTypeMismatchException, not
+ an InvalidCastException if the widening conversion failed. See
+ testcases #M94-#M96.
+
+ * Array.cs (CopyTo): Bug fix from Ajay Dwivedi, correctly handle
+ arrays with non-zero lower bounds. Also adding testcases #F10-#F13
+ for this.
+
+ * Array.cs (CopyTo): Reverted my last change, it was incorrect.
+ (Copy): Actually allow copying multi-dimensional arrays.
+
+2002-03-05 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs:
+ (DBNull) Added the missing field.
+ (IsDBNull) Fixed typo.
+ (ToByte (string, int)) Implemented.
+ (ToString (byte, int)) Implemented.
+ (ConvertToBase)
+ (BuildConvertedString) internal functions used for converting values to
+ a specific base.
+
+ * Int16.cs:
+ * Int32.cs:
+ * Int64.cs:
+ * Single.cs:
+ * UInt16.cs:
+ * UInt32.cs: Implemented the IConvertible interface.
+
+ * CharEnumerator.cs: Renamed to variables to be clearer and
+ changed some of the tests to conform to the 1.0 spec.
+
+2002-03-06 Martin Baulig <martin@gnome.org>
+
+ * Array.cs (Copy): Calculate absolute array position here and use
+ GetValueImpl() and SetValueImpl() with that position. We can now
+ copy multi-dimensional arrays.
+ (CopyTo): Small bug fix.
+
+2002-03-05 Duco Fijma <duco@lorentz.xs4all.nl>
+
+ * Version.cs: CompareTo changed according the LAMESPEC discovered by
+ Nick (See VersionTest.cs).
+ * CharEnumerator.cs: fixed two bugs in MoveNext. It had an off-by-one
+ error comparing the current position (idx) against the length of the
+ string iterated and it set idx to an unrecognized special value (-2)
+
+Tue Mar 5 17:34:14 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * SByte.cs, UInt64.cs: implement IConvertible interface. Nobody wants
+ to do this dirty work, but someone has to do it (and I need it to pass
+ the "200 sample tests compiled on linux" mark).
+
+2002-03-06 Nick Drochak <ndrochak@gol.com>
+
+ * Attribute.cs
+ * DecimalFormatter.cs
+ * Delegate.cs
+ * Double.cs
+ * GC.cs
+ * Int16.cs
+ * Int32.cs
+ * MonoType.cs
+ * RuntimeMethodHandle.cs
+ * RuntimeTypeHandle.cs
+ * String.cs
+ * Type.cs:
+ Add [MonoTODO]'s to places where we currently throw a
+ NotImplementedException.
+
+2002-03-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * Int16.cs (Parse): do not overflow on max negative value
+
+ * Int32.cs (Parse): do not overflow on max negative value
+
+Mon Mar 4 20:36:05 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: fixed IsClass.
+ * MonoType.cs: fixed MemberType, IsPrimitiveImpl, IsPointerImpl,
+ IsByRefImpl. Added GetInterfaces().
+ * IServiceProvider.cs: compilation fix.
+
+Mon Mar 4 18:37:03 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Array.cs: allow copying an empty array to an empty array.
+
+Mon Mar 4 17:59:16 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: fixed LastIndexOf (string) to do a bit of argument
+ checking.
+
+2002-03-04 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Version.cs: many fixes to failures found by the newly created
+ test cases for this class. Specifically, the CompareTo member
+ returned wrong values due to the use of Int32.MaxValue as a special
+ value indicating an "undefined" version component. Also implemented the
+ missing operators (==, <, >, etc.), one missing constructor and
+ and some exception throwing.
+
+2002-03-04 Nick Drochak <ndrochak@gol.com>
+
+ * IServiceProvider.cs: Add missing attribute: ComVisible(false)
+ * Attribute.cs: Add missing attributes: Serializable and
+ AttributeUsage(AttributeTargets.All)
+
+Mon Mar 4 11:26:49 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: implemented GetConstructors(), GetFields(),
+ GetMethods(), GetProperties().
+ * Object.cs: added debugging icall obj_address().
+ * Type.cs: fixed the binding flags for some Get* methods.
+ Implemented FindMembers() as calls to the specific GetMember
+ methods.
+
+2002-03-01 Duco Fijma <duco@lorentz.xs4all.nl>
+ * BitConverter.cs: fixed one little bug: ToString(s, n, 0)
+ should give an exception for n>=s.Length.
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * Array.cs: More argument checking and bug fixing.
+
+2002-03-01 Miguel de Icaza <miguel@ximian.com>
+
+ * BitConverter.cs: Indentation match
+
+ * AppDomain.cs: Added MonoTODOs to this too.
+
+ * Buffer.cs: Added MonoTODOs to this.
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * Array.cs: Added argument checking to all methods where it was missing.
+
+2002-03-01 Duco Fijma <duco@lorentz.xs4all.nl>
+
+ * BitConverter.cs: Fixed bugs in ToString methods
+
+Fri Mar 1 15:20:00 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MulticastDelegate.cs: implement operators so mcs3 can be used on linux.
+
+2002-03-01 Nick Drochak <ndrochak@gol.com>
+
+ * BitConverter.cs: Throw ArgumentException like mscorlib, instead of
+ ArgumentOutOfRangeException like the docs say.
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * Enum.cs (CompareTo): Correctly override this method from IComparable.
+
+ * Console.cs (setIn, setOut, setError): It's called SetIn, SetOut, SetError.
+
+2002-02-28 Martin Baulig <martin@gnome.org>
+
+ * String.cs: This file now passes the testsuite on Linux :-)
+
+ * String.cs (Intern, IsInterned): The interncalls are now called _Intern and _IsInterned;
+ make them private and provide C# wrappers which do proper argument checking.
+
+ * String.cs (Format): Correctly handle escaped brackets.
+
+ * String.cs (_CompareChar): New internal function which compares two chars.
+ (_Compare): Provide an internal compare method which can do all sorts of
+ comparision and call it from all the Compare() methods. Also fixed a lot of
+ bugs here, this code now actually passes the testsuite.
+
+2002-02-28 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs: Added the missing methods. The new class status page
+ kicks ass, it even found my typos! Woohoo!
+ (ConvertFromBase): Moved the Exception throwing in here and
+ removed the other occurances so it's all centralized now.
+ (ISDBNull): Implemented.
+ (GetTypeCode): Implemented.
+
+2002-02-27 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs: Guid.ToString("") and Guid.ToString(null) is now understood as Guid.ToString("D")
+ just as in mscorlib. There is (probably) a documentation bug in the MS FrameWork SDK, which
+ states that a lacking format should be interpreted as "N".
+ Also added [Serializable] attribute
+ * TimeSpan.cs: some formatting and added the [Serializable] attribute
+
+2002-02-26 Duncan Mak <duncan@ximian.com>
+
+ * WeakReference.cs: Committed for Ajay Kumar Dwivedi.
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * TimeZone.cs: Use an internal enum rather than magic numbers to access the
+ fields of the interncall GetTimeZoneData.
+
+ * DateTime.cs: Implemented Parse and fixed a few bugs.
+
+ * String.cs (TrimStart): Small fix.
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * DateTime.cs: ParseExact is now fully functional.
+
+ * String.cs (TrimEnd): Small fix.
+
+2002-02-26 Duco Fijma <duco@lorentz.xs4all.nl>
+ * TimeSpan.cs: Added method TimeSpan.FromMilliseconds, mysteriously
+ missing for about six months.
+
+Tue Feb 26 14:21:19 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * UInt64.cs: fixed Parse method () to handle some of the NumberStyle flags.
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * DateTime.cs: Miguel already committed this, but there was still a
+ ChangeLog entry for this missing ....
+ We're now reusing functionality from TimeSpan, printing dates is
+ fully implemented, currently working on parsing.
+
+ * TimeZone.cs: Fully implemented this. There's a new InternCall in the
+ runtime for this.
+
+Fri Feb 22 18:47:08 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: disable constructor.
+ * Object.cs: make GetType() an internalcall.
+ * Type.cs: added correct bindingflags to GetMethods ().
+ All such calls should be reviewed to use the correct flags.
+
+Thu Feb 21 19:23:46 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs, MonoType.cs: type_is_subtype_of () changed to include extra
+ argument.
+
+Thu Feb 21 16:56:51 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: implemented IsAssignableFrom.
+
+2002-02-21 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs: fixed Guid.Guid(string) ctor. Changed format:
+ "{0xdddddddd,0xdddd,0xdddd,{0xdd},{0xdd},{0xdd},{0xdd},{0xdd},{0xdd}}"
+ to "{0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}"
+ The former is documented by Microsoft. The latter is how they
+ actually implemented it in mscorlib:-)
+
+Tue Feb 19 20:34:35 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoCustomAttrs.cs: hooks to get the custom attributes from the
+ runtime.
+ * MonoType.cs: Implemented custom attributes methods.
+
+
+2002-02-21 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs:
+
+Tue Feb 19 20:34:35 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoCustomAttrs.cs: hooks to get the custom attributes from the
+ runtime.
+ * MonoType.cs: Implemented custom attributes methods.
+
+2002-02-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * Array.cs (CopyTo): use GetLength() instead of GetUpperBound()
+
+2002-02-19 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs: Finished up the missing methods in Convert. Added a
+ new private method ConvertFromBase.
+
+2002-02-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * String.cs: impl. IConvertible interface
+
+2002-02-18 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs: actual implementation for Guid.Guid(string) Ctor
+
+2002-02-18 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs: Changed from using Type.GetType (string) to just
+ typeof (). Probably will speed things up a bit?
+
+2002-02-18 Ajay Kumar Dwivedi <AjayKumar.Dwivedi@dresdner-bank.com>
+
+ * Array.cs:
+ 1. Fix for GetUpperBound to return correct values
+ 2. made some Properties virtual
+ 3. Adds IsFixedSize and IsReadOnly properties.
+ 4. changes CreateInstance(Type,int[],int[]) to throw Exception
+ when third arg is null. InternalCall CreateInstance changed to
+ CreateInstanceImpl
+ 5. Fixed array.GetUpperBound at a couple of places
+ 6. IndexOf and LastIndexOf now use Object.Equals instead of "=="
+ 7. Added two FIXME's in BinarySearch functions.
+
+2002-02-17 Duncan Mak <duncan@ximian.com>
+
+ * TimeZone.cs: Applied the rest of Ajay's patch for
+ IsDaylightSavingTime. Thanks a lot for the nice explanation of how
+ it works!
+
+2002-02-17 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs: added stub for Guid(string) ctor
+
+2002-02-17 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs: Near-complete implementation of Convert.cs
+
+ Added all the To* methods taking (object) and
+ (object, IFormatProvider) as parameters.
+
+ Added [CLSCompliant (false)] attributes to methods dealing with
+ unsigned types.
+
+ Added the missing section on converting to and from DateTime. Only
+ 6 missing methods, all marked with MonoTODOs. Will tackle them later.
+
+2002-02-16 Duncan Mak <duncan@ximian.com>
+
+ * TimeZone.cs: patch from Ajay Kumar Dwivedi (adwiv@yahoo.com) to
+ make IsDaylightSavingTime (DateTime) call
+ IsDaylightSavingTime (DateTime, DaylightTime).
+
+ Added internal class CurrentTimeZone from Ajay. It needs more work
+ to fill in the appropriate internal calls.
+
+Sat Feb 16 12:41:41 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: fix IsClass.
+
+Sat Feb 16 12:02:02 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: fix Trim().
+
+Fri Feb 15 21:02:46 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: fix more off by one errors.
+
+Thu Feb 14 18:54:09 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: fix IsValueTypeImpl.
+ * Type.cs: fix IsEnum. Implement Equals methods.
+
+Wed Feb 13 21:50:13 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Int32.cs: implement IConvertible interface.
+
+2002-02-12 Duncan Mak <duncan@ximian.com>
+
+ * TimeZone.cs: Implemented and added to CVS.
+
+2002-02-11 Duncan Mak <duncan@ximian.com>
+
+ * Convert.cs: Implemented the ChangeType () methods.
+
+Mon Feb 11 19:48:58 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Array.cs: make Clone() an internal call.
+
+2002-02-09 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Changed Guid.NewGuid so that it can use both System.Random and
+ System.Security.Cryptography.RandomNumberGenerator
+
+2002-02-09 Duco Fijma <duco@lorentz.xs4all.nl>
+ * First version of Guid.NewGuid
+
+2002-02-08 Duncan Mak <duncan@ximian.com>
+
+ * RuntimeArgumentHandle.cs: Added to CVS.
+
+Fri Feb 8 19:14:54 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * CrossAppDomainDelegate.cs, AssemblyLoadEventHandler.cs,
+ UnhandledExceptionEventHandler.cs: added delegates.
+
+Fri Feb 8 18:06:20 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MarshalByRefObject.cs: add ToString () method
+ (apparently needed by nunit).
+ * _AppDomain.cs: uncomment ToString(): dietmar fixed the bug triggered
+ by it in the runtime.
+
+2002-02-08 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * String.cs (Format): implemented
+
+2002-02-07 Duncan Mak <duncan@ximian.com>
+
+ * DuplicateWaitObjectException:
+ * InvalidCastException:
+ * NotImplementedException:
+ * NotSupportedException:
+ * NullReferenceException:
+ * OutOfMemoryException:
+ * OverflowException:
+ * RankException:
+ * StackOverflowException.cs:
+ * UnauthorizedAccessException: Added missing constructor used for serialization.
+
+2002-02-07 Dietmar Maurer <dietmar@ximian.com>
+
+ * String.cs (System.Compare): bug fix
+
+2002-02-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * Enum.cs (Parse, GetHashCode): impl.
+
+2002-02-05 Duncan Mak <duncan@ximian.com>
+
+ * DBNull.cs: This is my first crack at the DBNull class. I think I
+ actually got most of the IConvertible methods right, but I haven't
+ done the research to test whether or not this is the correct
+ behavior. IConvertible.ToType () is the most iffy of all, IMHO.
+
+ * DllNotFoundException.cs: Inherits from TypeLoadException, not SystemException.
+
+2002-02-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * Enum.cs: added more functionality (GetName, ToObject, Equals)
+
+2002-01-31 Duncan Mak <duncan@ximian.com>
+
+ * InvalidOperationException.cs:
+ * NotFiniteNumberException.cs:
+ * ObjectDisposedException.cs:
+ * TypeInitializationException.cs: Added missing bits for serialization/
+
+ * AppDomainUnloadedException.cs:
+ * ApplicationException.cs:
+ * ArgumentOutOfRangeException.cs:
+ * ArithmeticException.cs:
+ * ArrayTypeMismatchException:
+ * BadImageFormatException.cs:
+ * Exception.cs:
+ * MissingMemberException.cs:
+ * TypeLoadException.cs: Added missing bits for serialization.
+
+2002-01-30 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Guid.cs: implemented everything but Guid.NewGuid
+
+Tue Jan 29 22:32:36 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * _AppDomain.cs: remove ToString() method: it doesn't seem right
+ to have it in this interface and it screws up the method vtable setup.
+
+2002-01-28 Andrei Zmievski <andrei@php.net>
+
+ * Double.cs: implemented IConvertible interface.
+
+2002-01-28 Miguel de Icaza <miguel@ximian.com>
+
+ * ArgumentException.cs: Implement serialization constructor.
+ (GetObjectData): Implement serializer.
+
+ * ArgumentNullException.cs: Implement serialization constructor.
+
+ * Exception.cs: Implement serialization constructor.
+ (GetObjectData): Implement serializer.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * DateTime.cs (UnixEpoch): The Begining of the Unix epoch.
+
+2002-01-23 Duncan Mak <duncan@ximian.com>
+
+ * EntryPointNotFoundException.cs:
+ * FormatException: Added missing constructor and related bits.
+
+ * TypeLoadException: Added missing constructor, methods and properties.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * AppDomain.cs (GetAssemblies): Use foreach construct instead of
+ manually getting the enumerator.
+
+ (AppDomain.AppDomain): Prime the loaded assemblies with the
+ assemblies loaded by the runtime in our behalf.
+
+ * AppDomainSetup.cs: Remove private keyword, that is the default.
+ Add a new property DisallowPublisherPolicy.
+
+ * AppDomain.cs (AppDomain.GetAssemblies): Implement.
+
+Tue Jan 22 22:51:48 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs, Type.cs: many updates, corrected implementation,
+ completed stubs.
+
+2002-01-20 Andrei Zmievski <andrei@php.net>
+
+ * Byte.cs:
+ * Char.cs: implemented IConvertible interface.
+
+ * Boolean.cs: use our own ToString() method directly.
+
+2002-01-20 Duncan Mak <duncan@ximian.com>
+
+ * Files I commited recently: Fixed indentation style.
+
+2002-01-20 Nick Drochak <ndrochak@gol.com>
+
+ * SerializableAttribute.cs: this attrib can be used on enums, structs,
+ and delegates too. Added the appropriate usage flags.
+
+2002-01-18 Duncan Mak <duncan@ximian.com>
+
+ * CharEnumerator.cs: Implemented.
+ * String.cs (System): Fixed the GetEnumerator () method(s).
+
+ * ObsoleteAttribute.cs:
+ * STAThreadAttribute.cs:
+ * MTAThreadAttribute.cs:
+ * ThreadStaticAttribute.cs:
+ * LoaderOptimizationAttribute.cs:
+ * PlatformNotSupportedException.cs:
+ * LoaderOptimization.cs: Added to CVS.
+
+2002-01-18 Duncan Mak <duncan@ximian.com>
+
+ * AppDomainUnloadedException.cs:
+ * MethodAccessException.cs:
+ * ContextMarshalException.cs:
+ * CannotUnloadAppDomainException.cs:
+ * DllNotFoundException.cs:
+ * EntryPointNotFoundException.cs:
+ * FieldAccessException.cs:
+ * TypeUnloadedException.cs:
+ * MissingFieldException.cs: Added to CVS.
+
+ * ApplicationException.cs:
+ * MemberAccessException.cs:
+ * MissingMemberException.cs
+ * MissingMethodException.cs:
+ * SystemException.cs: Added [Serializable] attribute.
+
+ * Exception.cs: Added [Serializable] attribute, made properties
+ 'Message', 'Source' and 'StackTrace' virtual methods, per 1.0
+ spec.
+
+ * ContextStaticAttribute.cs: Added [Serializable] attribute and
+ put in the missing constructor.
+
+ * Environment.cs: Commented out references to
+ EnvironmentPermissionAttribute, because they're just stubbed out
+ right now and has no implementation.
+
+2002-01-16 Andrei Zmievski <andrei@php.net>
+
+ * Boolean.cs: implemented IConvertible interface
+
+2002-01-15 Nick Drochak <ndrochak@gol.com>
+
+ * ResolveEventArgs.cs: class should derive from EventArgs.
+
+2002-01-14 Miguel de Icaza <miguel@ximian.com>
+
+ * String.cs (System): Use DefaultMemberName for the String class.
+
+Mon Jan 14 17:06:40 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: use IndexerName in index char accessor.
+
+Thu Jan 10 21:05:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MonoType.cs: add rank to MonoTypeInfo and implement GetArrayRank.
+ * String.c: eliminate 64k+ method calls in search.
+ * Type.cs: handle byref and array types in ToString ().
+
+2002-01-09 Duco Fijma <duco@lorentz.xs4all.nl>
+
+ * Guid.cs: created first version
+
+2002-01-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * MonoType.cs: added missing TypeAttributes to MonoTypeInfo
+
+Wed Jan 9 19:35:07 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * MulticastDelegate.cs: add == and != operator stubs.
+ * String.cs: check for null in == operator.
+ * Type.cs: use a virtual method to get TypeAttributes.
+
+Tue Jan 8 23:30:19 EST 2002 Matt Kimball <matt@kimball.net>
+ * String.cs: Fixed several off-by-one errors in LastIndexOf* methods
+
+2002-01-09 Nick Drochak <ndrochak@gol.com>
+
+ * Environment.cs: Comment out Security attribute and put a MonoTODO
+ there as a reminder. We need mcs magic to handle security attributes in
+ corlib.
+
+2002-01-07 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Created IAppDomainSetup.cs
+
+2002-01-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Created System._AppDomain interface in _AppDomain.cs
+
+2002-01-06 Nick Drochak <ndrochak@gol.com>
+
+ * ResolveEventArgs.cs: New File, completely implemented! ;)
+
+Sat Jan 5 15:53:50 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Enum.cs: dummy ToString impl.
+ * String.cs: dummy format implementations to get compiler errors
+ somewhat working.
+ * Type.cs: implemented filter delegates. FindMembers runs the filter, now.
+
+2002-01-05 Ravi Pratap <ravi@ximian.com>
+
+ * TODOAttribute.cs : Augment some more; provide two constructors
+ with support for a comment too.
+
+2002-01-05 Nick Drochak <ndrochak@gol.com>
+
+ * Uncommented those MonoTODO's now that Ravi's got
+ the class in there
+
+2001-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * TODOAttribute.cs : Actually add this time ;-)
+
+ Change name to MonoTODO.
+
+2002-01-04 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs (Trim): Fixed a few logic bugs in the code that
+ calculated how much to trim off the end of the string.
+
+2001-01-04 Nick Drochak <ndrochak@gol.com>
+
+ * Commented out the [TODO] attributes for now. We don't have the
+ class written. Also changed it to [MonoTODO]
+
+2002-01-04 Ravi Pratap <ravi@ximian.com>
+
+ * TODOAttribute.cs : Add. We use this attribute to tag all bits in
+ our class libraries that are incomplete.
+
+ * Array.cs : Apply attribute wherever we find a FIXME which says
+ we need something to be implemented there.
+
+ * Int32.cs : Ditto.
+
+ * MulticastDelegate.cs : Ditto.
+
+ * RuntimeFieldHandler.cs, RuntimeMethodHandle.cs,
+ RuntimeTypeHandle.cs : Ditto.
+
+ * String.cs : Ditto.
+
+ * Type.cs : Ditto.
+
+ * Byte.cs, Char.cs, ContextBoundObject.cs, DateTime.cs, Delegate.cs : Ditto.
+
+ * Enum.cs, Environment.cs, Exception.cs, Int64.cs, SByte.cs, Single.cs,
+ UInt16.cs, UInt32.cs, ValueType.cs: Ditto.
+
+ * Byte.cs, Char.cs, ContextBoundObject.cs, DateTime.cs,
+ Delegate.cs : Ditto.
+
+ * Enum.cs, Environment.cs, Exception.cs, Int64.cs, SByte.cs,
+ Single.cs, UInt16.cs, UInt32.cs, ValueType.cs: Ditto.
+
+Thu Jan 3 23:24:04 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Delegate.cs: add Remove() stub.
+ * Enum.cs: add ToObject().
+ * Type.cs: add IsEnum property.
+
+2002-01-03 Kristian Rietveld <kris@gtk.org>
+
+ * Convert.cs: add non-CLS-compliant ToBoolean methods for char,
+ DateTime and object.
+
+2001-12-30 Nick Drochak <ndrochak@gol.com>
+
+ * Byte.cs (Parse): Add comments to aid in testing.
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * Char.cs (Parse): Implement.
+
+ * Byte.cs (Parse): Implement a fast parser.
+
+ * SByte.cs (Parse): Implement a fast parser.
+
+ * UInt16.cs (Parse): Implement a fast parser.
+
+ * Int16.cs (Parse): Implement a fast parser.
+
+ * UInt32.cs (Parse): Implement a fast parser.
+
+ * Int32.cs (Parse): Implement a fast parser.
+
+Fri Dec 21 15:14:52 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Array.cs: fix null ref in sort code.
+ * UInt64.cs: add bare-bones parse.
+
+Thu Dec 20 15:29:52 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Byte.cs: removed use of Regexes.
+
+Tue Dec 18 18:39:54 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Enum.cs: implemented GetValues(), GetNames(), GetName(),
+ IsDefined(), GetUnderlyingType().
+ * String.cs: fix one instance of Compare().
+ * Type.cs: implemented GetProperties(), GetProperty().
+
+Thu Dec 13 20:10:57 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Array.cs: implement CopyTo ().
+ * Char.cs: implement ToString ().
+ * Exception.cs: bugfix.
+ * Int32.cs: bare-bones Parse ().
+ * MonoType.cs: query the needed info with an internalcall.
+ * String.cs: speedups, bugfixes, reduced copies.
+ * Type.cs: added missing fields. Implemented many of the Is*
+ properties. Implemented GetMethod(), GetConstructor(), GetMethods(),
+ GetFields(), FindMembers(), ToString().
+
+2001-12-11 Dick Porter <dick@ximian.com>
+
+ * DateTime.cs: Implemented FromFileTime() and ToFileTime()
+
+ * Console.cs: Use handles rather than casting file descriptors
+
+2001-12-08 Nick Drochak <ndrochak@gol.com>
+
+ * Byte.cs (Parse): Start implementation. Parse(string) works, but
+ now we need to handle other formats
+
+2001-12-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * DateTime.cs: added an icall to GetNow()
+
+2001-12-04 Dietmar Maurer <dietmar@ximian.com>
+
+ * Double.cs: added the parse method from Bob Smith
+
+2001-11-28 Miguel de Icaza <miguel@ximian.com>
+
+ * UInt64.cs: ditto.
+
+ * UInt32.cs: ditto.
+
+ * Int32.cs (Int32.CompareTo): Fix because we can not just
+ substract the values.
+
+ Return possitive value if the object is null.
+
+ * Boolean.cs: (Boolean.CompareTo): ditto.
+
+ * Int16.cs (Int16.CompareTo): ditto.
+
+ * Byte.cs (Byte.CompareTo): ditto.
+
+ * SByte.cs (SByte.CompareTo): ditto.
+
+ * Char.cs (Char.CompareTo): ditto.
+
+ * Decimal.cs (Decimal.CompareTo): ditto.
+
+ * Int64.cs (Int64.CompareTo): ditto.
+
+ * Single.cs: Ditto.
+
+ * UInt16.cs: Ditto.
+
+2001-11-28 Nick Drochak <ndrochak@gol.com>
+
+ * Byte.cs: Throw NotImplementedException for Parse.
+
+2001-11-27 Derek Holden <dholden@draper.com>
+
+ * IntegerFormatter.cs: Formatting of type "Number" was not
+ using NumberFormatInfo.NumberNegativePattern.
+
+2001-11-26 Dick Porter <dick@ximian.com>
+
+ * LocalDataStoreSlot.cs: No need to delete a system TLS slot in
+ the finalise routine any more
+
+2001-11-21 Miguel de Icaza <miguel@ximian.com>
+
+ * ApplicationException.cs: internationalize by adding calls to
+ Locale.GetText (). And throw NotImplementedExceptions on calls
+ that we have to implement.
+
+ * Version.cs: Ditto.
+
+ * ValueType.cs: ditto.
+
+ * UnauthorizedAccessException.cs: ditto.
+
+ * UInt32.cs: ditto.
+
+ * UInt64.cs: ditto.
+
+ * UInt16.cs: ditto.
+
+ * TypeLoadException.cs: ditto
+
+ * TypeInitializationException.cs: ditto.
+
+ * Type.cs: ditto.
+
+ * TimeSpan.cs: ditto.
+
+ * SystemException.cs: ditto.
+
+ * String.cs: ditto.
+
+ * StackOverflowException.cs: ditto.x
+
+ * Single.cs: ditto.
+
+ * SByte.cs: ditto.
+
+ * RuntimeTypeHandle.cs: ditto.
+
+ * RuntimeMethodHandle.cs: ditto.
+
+ * RuntimeFieldHandle.cs: ditto.
+
+ * Random.cs: ditto.
+
+ * OutOfMemoryException.cs: ditto.
+
+ * OperatingSystem.cs: ditto.
+
+ * ObjectDisposedException.cs: ditto.
+
+ * NullReferenceException.cs: ditto.
+
+ * NotImplementedException.cs: ditto.
+
+ * NotFiniteNumberException.cs: ditto.o
+
+ * MulticastNotSupportedException.cs: ditto.
+
+ * MissingMethodException.cs: ditto.
+
+ * MemberAccessException.cs: ditto.
+
+ * Math.cs: ditto.
+
+ * InvalidCastException.cs: ditto.
+
+ * IntegerFormatter.cs: ditto.
+
+ * Int32.cs: ditto.
+
+ * Int16.cs: ditto.
+
+ * IndexOutOfRangeException.cs: ditto.
+
+ * Environment.cs: ditto
+
+ * Enum.cs: ditto.
+
+ * DuplicateWaitObjectException.cs: ditto.
+
+ * DivideByZeroException.cs: ditto.
+
+ * Delegate.cs: ditto
+
+ * DecimalFormatter.cs: ditto.
+
+ * Decimal.cs: ditto.
+
+ * DateTime.cs: ditto.
+
+ * Convert.cs: ditto.
+
+ * Char.cs: ditto.
+
+ * Byte.cs: ditto.
+
+ * Boolean.cs: ditto.
+
+ * ArrayTypeMismatchException.cs: ditto.
+
+ * ArithmeticException.cs: ditto.
+
+ * ArgumentOutOfRangeException.cs: ditto.
+
+ * ArgumentNullException.cs: ditto.
+
+ * Enum.cs: Make it derive from ValueType, add CompareTo method.
+
+ * Attribute.cs: Reformat.
+
+2001-11-14 Miguel de Icaza <miguel@ximian.com>
+
+ * Decimal.cs, Double.cs, Byte.cs, Char.cs, Int16, UInt16, Int32,
+ UInt32, Int64, UInt64, SByte, Single (CompareTo): Throw the
+ exception if the value is null too.
+
+ * Char.cs (CompareTo): ditto.
+
+ * ApplicationException.cs: Added constructor that does serialization.
+
+ * ParamArrayAttribute.cs: Define attribute correctly.
+
+Wed Nov 14 16:31:19 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AppDomain.cs: rename dummy interface _AppDomain to AppDomain_Intf.
+ * Array.cs: fix Array.Copy.
+ * AssemblyLoadEventArgs.cs: rename field.
+ * CLSCompliantAttribute.cs: use correct name for the class.
+ * Char.cs: fix IsLetter.
+ * Console.cs, DateTime.cs, Decimal.cs, IConvertible.cs, Math.cs,
+ SByte.cs, UInt16.cs, UInt32.cs, UInt64.cs, UIntPtr.cs: CLSCompliant updates.
+ * Convert.cs: CLSCompliant updates, add ChangeType() methods.
+ * Delegate.cs: renamed target field to m_target.
+ * Enum.cs: added missing methods.
+ * MonoType.cs: add a constructor and some needed properties.
+ * Object.cs: implement GetType().
+ * String.cs: CLSCompliant updates. Fixes everywhere to remove the
+ ending 0 char.
+ * Type.cs: add missing methods/properties.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * AttributeUseage.cs: Should define AttributeUsageAttribute.
+
+ * CLSCompliant.cs: Marked with AttributeUsage attribute.
+
+ * Decimal.cs: Fixed CLSCompliant attributes.
+
+ * Type.cs: changed _impl to internal (needs to be accessable by
+ subclasses).
+
+ (TypeHandle): Marked as abstract, implementation removed.
+
+ (IsNotPublic, IsPublic, GetMethods, GetPropery, GetConstructor,
+ GetMethod): Added stub implementations so NUnit would link against
+ corlib
+
+Tue Nov 6 09:11:43 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AppDomain.cs: use an internal constructor for AssemblyBuilder.
+
+2001-11-05 Miguel de Icaza <miguel@ximian.com>
+
+ * NonSerializedAttribute.cs: Add AttributeUsage rules for this
+ attribute.
+
+Fri Nov 2 18:23:15 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: fix a couple of bugs.
+ * AppDomain.cs: use new AppBuilder constructor.
+ * Buffer.cs, GC.cs, NonSerializedAttribute.cs,
+ NotImplementedException.cs, ObjectDisposedException.cs,
+ UnauthorizedAccessException.cs: add implementation.
+ * OverflowException.cs: fix class name.
+
+2001-10-28 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs: Don't use a terminating nil char for our internal
+ array.
+
+2001-10-27 Miguel de Icaza <miguel@ximian.com>
+
+ * Delegate.cs (Delegate.CombineImpl): Implement.
+ (Delegate.Combine): Implement.
+
+ * MulticastDelegate.cs (MulticastDelegate.Equals): Implement.
+
+ (MulticastDelegate.CombineImpl): This was not as trivial as I
+ thought.
+
+ * ContextStaticAttribute.cs: Added AttributeUsage to
+ ContextStaticAttribute.
+
+ * FlagsAttribute.cs: Add AttributeUsage to FlagsAttribute
+
+2001-10-15 Martin Weindel <martin.weindel@t-online.de>
+
+ * added Decimal.cs * added DecimalFormatter.cs (internal class
+ used from System.Decimal)
+
+2001-10-11 Thomas Neidhart <tome@sbox.tugraz.at>
+
+ * Convert.cs: Added methods for Base64 transforming just used the
+ existing System.Security.Cryptography.ToBase64Transform, should
+ be changed to use a stand-alone class, e.g. Base64Encoder
+
+2001-10-10 Derek Holden <dholden@draper.com>
+
+ * IntegerFormatter.cs: Added. Implements ToString for all the
+ integer data types for all the format types.
+
+ * Byte.cs: Using IntegerFormatter for ToString's.
+
+ * SByte.cs: Using IntegerFormatter for ToString's.
+
+ * Int16.cs: Using IntegerFormatter for ToString's.
+
+ * Int32.cs: Using IntegerFormatter for ToString's.
+
+ * Int64.cs: Using IntegerFormatter for ToString's.
+
+ * UInt16.cs: Using IntegerFormatter for ToString's.
+
+ * UInt32.cs: Using IntegerFormatter for ToString's.
+
+ * UInt64.cs: Using IntegerFormatter for ToString's.
+
+2001-10-07 Miguel de Icaza <miguel@ximian.com>
+
+ * Exception.cs: Implement bits of serialization.
+
+ * RuntimeFieldHandle.cs: Implement Serialization features.
+
+ * Type.cs: Implement TypeHandle property.
+
+2001-09-28 Dick Porter <dick@ximian.com>
+
+ * LocalDataStoreSlot.cs: Implemented
+
+Tue Sep 25 19:58:14 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: fix off-by-one error in Trim().
+
+Tue Sep 25 18:52:14 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Type.cs: added GetType () method.
+
+Tue Sep 25 17:29:02 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * MissingMethodException.cs, MissingMemberException.cs,
+ MemberAccessException.cs: added.
+
+Tue Sep 25 16:46:43 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: don't access the string array out of bounds in
+ LastIndexOf. * Type.cs: fix return type of the Assembly property.
+
+Mon Sep 24 20:35:24 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * String.cs: make Intern and IsIntern internalcalls.
+
+2001-09-13 Dick Porter <dick@ximian.com>
+
+ * Type.cs: Added a stub for the IsValueType property.
+
+ * SystemException.cs (System): Added the other constructor, so
+ that System.Threading exceptions can inherit it.
+
+2001-09-08 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs (TrimStart): Don't keep looping through the trimchars
+ once we've found a match.
+ (TrimEnd): Same here.
+ (Trim): And finally here.
+
+2001-09-07 Ravi Pratap <ravi@ximian.com>
+
+ * Char.cs (IsLetterOrDigit): Implement.
+ (IsLower): Implement, but we need to be Unicode aware.
+ (IsNumber): Implement.
+ (IsPunctuation): Implement.
+ (IsWhiteSpace): Implement.
+ (ToUpper): Fix to subtract 32 from the ASCII value, not 33 :)
+ (ToLower): Same here.
+
+2001-09-04 Miguel de Icaza <miguel@ximian.com>
+
+ * Object.cs: Shortcut, if (a == b) then return true.
+
+Fri Sep 7 18:34:48 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Delegate.cs: we need a pointer to the method thunk in
+ the delegate object.
+
+Fri Sep 7 12:28:01 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * AsyncCallback.cs, common.src: add AsyncCallback delegate.
+
+2001-09-06 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs (System): Don't mix uint and int.
+
+2001-09-04 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs (BoyerMoore): Modified to not use pointers and to instead
+ use indexes.
+ (IndexOf): Use BoyerMoore.
+
+2001-09-02 Miguel de Icaza <miguel@ximian.com>
+
+ * All over: Use the autogenerated enumerations from the ECMA
+ documentation that Sergey wrote.
+
+ * PlatformID.cs: Add Unix definition.
+
+ * OperatingSystem.cs: Use Unix instead of Linux here.
+
+ * MarshalByRefObject.cs: Mark class as [Serializable].
+
+2001-08-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * Console.cs: impl. (write only)
+ implemented the stdin stuff
+
+ * Int32.cs: impl. real op_Equal
+
+2001-08-24 Miguel de Icaza <miguel@ximian.com>
+
+ * (common.src): Removed IAsyncResult as it is not on CVS yet.
+
+ * UIntPtr.cs: Removed CLSCompliant attribute before the namespace,
+ as it breaks the build.
+
+2001-08-23 Michael Lambert <michaellambert@email.com>
+
+ * IntPtr.cs: Optimized unsafe declaration, implemented GetObjectData,
+ added CLSCompliant attribute
+
+ * IAsyncResult.cs: Added
+
+ * common.src: Added IAsyncResult.cs
+
+2001-08-23 Michael Lambert <michaellambert@email.com>
+
+ * UIntPtr.cs: Added
+
+ * common.src: Added UIntPtr.cs
+
+2001-08-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * Attribute.cs: uncomment some code to make it compile again
+
+ * mono.src: removed duplicated Attribute.cs
+
+2001-08-16 Nick Drochak <ndrochak@gol.com>
+
+ * Attribute.cs: implemented all methods except GetHashCode()
+
+ * common.src: added Attribute.cs so it would compile in
+
+2001-08-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * Object.cs: changed MemberWiseClone to MemberwiseClone, and
+ marked it as InternalCall
+
+ * common.src: removed UriFormatException.cs because the file is
+ not there.
+
+ * RuntimeTypeHandle.cs: replaced IntrPtr with IntPtr
+ * Char.cs: replaced byte with char
+
+ * Array.cs: make it work with the mono interpreter
+
+2001-08-06 Miguel de Icaza <miguel@ximian.com>
+
+ * Version.cs: Make the class sealed
+
+2001-08-08 Bob Smith <bob@thestuff.net>
+
+ * Random.cs: Many compile fixes.
+ * Random.cs: I read a bad spec. Class updated to match real spec.
+
+2001-08-06 Miguel de Icaza <miguel@ximian.com>
+
+ * IntPtr.cs: Added and Completed implementation.
+
+ * Uri.cs: Add a note.
+
+2001-08-06 Bob Smith <bob@thestuff.net>
+
+ * Random.cs: Compile fix. Needs more testing.
+
+2001-08-06 Garrett Rooney <rooneg@electricjellyfish.net>
+
+ * Uri.cs: Initial Implementation. Parsing needs to be fixed to take
+ into account IPv6 addresses, url encoding needs to be implemented, and
+ various minor methods need to be written, but this is a decent start.
+
+2001-08-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * common.src: added Object.cs
+
+ * mono.src: added ValueType.cs
+
+2001-08-02 Dietmar Maurer <dietmar@ximian.com>
+
+ * Math.cs: replaced libc with libm
+
+2001-08-02 Bob Smith <bob@thestuff.net>
+
+ * Random.cs: Implemented. Needs testing.
+
+2001-08-02 Miguel de Icaza <miguel@ximian.com>
+
+ * IServiceProvider.cs, EventHandler.cs: New files.
+
+2001-08-02 Marcel Narings <marcel@narings.nl>
+
+ * DateTime.cs: Cleaned up a bit. Added the Add* family members.
+ Added exceptions. Added IConvertible. Still needs some platform
+ dependend stuff, the Parse and ToString members
+
+2001-08-01 Dietmar Maurer <dietmar@ximian.com>
+
+ * Type.cs (GetTypeFromHandle): added placeholder
+
+2001-07-24 Derek Holden <dholden@draper.com>
+
+ * Boolean.cs: Formatted to code style standard. Added GetTypeCode
+ which is really an IConvertible defined method.
+
+ * Byte.cs: Added a missing Parse method. Put in Parse and ToString
+ behavior, still need to do the main Parse and ToString.
+
+ * Char.cs: Added a bunch of missing ECMA methods. Commented a
+ specification discrepency. Still didn't any unicode stuff, though
+ every IsFoo(char c) method has an IsFoo(string, index)
+ counterpart, added wrappers for those.
+
+ * Convert.cs: Fixed NaN/Inf checking and double/float
+ rounding. Added ToType for IConvertible classes
+
+ * Double.cs: Fixed ECMA min and max values. Added IsInfinity /
+ IsNaN methods. Changed Inf/NaN internals.
+
+ * IConvertible.cs: Added comments for using
+ Convert.ToType. Changed return values to draft base values.
+
+ * Int16.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+ * Int32.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+ * Int64.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+ * Single.cs: Put in ECMA epsilon value. Added IsInfinity / IsNaN
+ methods. Changed Inf/NaN internals.
+
+ * SByte.cs: Added a missing Parse method. Put in Parse and
+ ToString behavior, still need to do the main Parse and ToString.
+
+ * UInt16.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+ * UInt32.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+ * UInt64.cs: Added a missing Parse statement. Put in behavior for
+ overloaded ToString and Parse methods.
+
+2001-07-20 Miguel de Icaza <miguel@ximian.com>
+
+ * MulticastDelegate.cs: New File.
+
+ * Delegate.cs: New file.
+
+ * Enum.cs: New file.
+
+ * Attribute.cs: New file.
+
+ * Type.cs: New file.
+
+ * ParamArrayAttribute.cs: New file.
+
+ * RuntimeTypeHandle.cs: New file.
+
+ * MulticastDelegate.cs: Added.
+
+ * DateTime.cs: Added
+
+ * Delegate.cs: Added
+
+2001-07-18 Michael Lambert <michaellambert@email.com>
+
+ * AttributeTargets.cs: Add.
+
+2001-07-19 Jeffrey Stedfast <fejj@ximian.com>
+
+ * Char.cs: Made ToUpper and ToLower public methods.
+
+ * String.cs: Lots and lots of compile fixes - just need to write
+ DateTime.cs and this should build completely now.
+
+2001-07-19 Bob Smith (bob@thestuff.net)
+
+ * Math.cs: Implemented.
+
+2001-07-19 Miguel de Icaza <miguel@ximian.com>
+
+ * String.cs: Removed tolower and toupper.
+
+ * Char.cs: Moved ToLower and ToUpper from string to here.
+
+ * Convert.cs ToByte (float value), ToByte (double value) Use IsNan
+ instead of comparing the value to Nan.
+
+2001-07-19 Duco Fijma (duco@lorentz.xs4all.nl)
+
+ * TimeSpan.cs: New implementation.
+
+2001-07-18 Scott Sanders <scott@stonecobra.com>
+
+ * UriFormatExcpetion.cs: Add - 85% complete
+
+2001-07-17 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs (IndexOf): Slight optimization that allows skipping
+ over a few chars here and there. This isn't as good as using my
+ Boyer-Moore implementation, however, Boyer-Moore is only really
+ good for long strings (I plan on making the code decide which
+ string search algorithm it should use on-the-fly at some point).
+ (LastIndexOf): Fix to work correctly.
+ (BoyerMoore): Took out some unneeded code and fixed an edge-case.
+
+2001-07-16 Michael Lambert <michaellambert@email.com>
+
+ * EventArgs.cs: Add.
+
+2001-07-16 Miguel de Icaza <miguel@ximian.com>
+
+ * Version.cs: Remove my buggy comment.
+
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * String.cs: Spelling error of IComparable, object's
+ MemberwiseClone cannot be overridden. Made indexer valid for now,
+ but not sure what to do about this in the long run. Seems to be a
+ couple bugs in csc.exe having to do with multiple pointer defs in
+ the same statement, and returning subclasses of a class in the
+ return type of an interface function implementation. Also moved
+ operators inside of class definition.
+
+2001-07-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs: A tom of compile fixes, although we still don't compile.
+
+ * IConvertible.cs: The To*Int64() methods return *Int64's, not
+ *Int32's. Also, it's ToDateTime() not ToDateType().
+
+2001-07-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs: Apparently I needed to at least write stubs for the
+ IConvertible interfaces. *sigh*
+
+2001-07-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * String.cs: Many logic/other fixes and better usage of the
+ features of c#
+ (tolower): New convenience method to help condense code.
+ (toupper): Another new helper method.
+ (Compare): Use the new helper methods.
+ (ToLower): use tolower().
+ (ToUpper): use toupper().
+ (LastIndexOfAny): Implemented.
+ (BoyerMoore): New private helper method that implements a modified
+ version of the Boyer-Moore search algorithm. Noothing uses it yet
+ as I'm not 100% sure it even works properly with unicode strings
+ not to mention it uses a huge lookup-table :-)
+ (Split): Implemented.
+
+2001-07-13 Jeffrey Stedfast <fejj@ximian.com>
+
+ * TODO: Added things that need to be finished in System.String
+
+ * String.cs: New source file implementing the System.String class
+
+2001-07-12 Sean MacIsaac <macisaac@ximian.com>
+
+ * TypeCode.cs: UInt64 was UInt63.
+
+ * Object.cs: Fixed a numer of compiler errors.
+
+ * Array.cs: Fixed some compiler errors.
+
+ * IComparable.cs: Fixed some compiler errors.
+
+ * ICloneable.cs: Fixed some compiler errors.
+
+ * IConvertible.cs: Fixed some compiler errors.
+
+ * IFormattable.cs: Fixed a compiler error.
+
+ * IFormatProvider.cs: Fixed a compiler error.
+
+ * IDisposable.cs: Fixed a compiler error.
+
+ * IFormatProvider.cs: Added public accesability type to
+ IFormatProvider.
+
+ * Exception.cs: Added a using statement to remove compile time
+ error.
+
+ * ApplicationException.cs: Removed a ; that was causing a compiler
+ error.
+
+ * Int16.cs: Fixed some compiler errors.
+
+ * Int32.cs: Fixed some compiler errors.
+
+ * Int64.cs: Fixed some compiler errors.
+
+ * SystemException.cs: Fixed a compiler error.
+
+ * UInt16.cs: Fixed some compiler errors.
+
+ * UInt32.cs: Fixed some compiler errors.
+
+ * UInt64.cs: Fixed some compiler errors.
+
+ * Void.cs: Fixed a compiler error.
+
+2001-07-12 Joe Shaw <joe@ximian.com>
+
+ * Array.cs: Fix backwards parameters to Array.SetValue()
+ throughout.
+ (BinarySearch): Fix backward logic surrounding whether to call
+ value.CompareTo or comparer.Compare.
+ (LastIndexOf): Stop being stupid. I am so not used to strongly
+ bounded arrays...
+ (Sort): Implement a quicksort.
+
+2001-07-11 Joe Shaw <joe@ximian.com>
+
+ * Array.cs: Change all instances of trying to access an array with
+ the index operator to calls to GetValue and SetValue, and add
+ InternalGetValue and InternalSetValue which are internal calls
+ into the runtime. Ew.
+
+2001-07-10 Joe Shaw <joe@ximian.com>
+
+ * Array.cs: Implemented everything but Sort().
+
+2001-07-09 Jeffrey Stedfast <fejj@ximian.com>
+
+ * Object.cs (Object::Equals): Object variable name is `o'.
+
+2001-07-06 Joe Shaw <joe@ximian.com>
+
+ * Int16.cs, Int32.cs, Int64.cs, UInt16.cs, UInt32.cs, UInt64.cs:
+ Implement the IComparable and IFormattable interfaces. Fix a typo
+ (publig -> public)
+
+ * ApplicationException.cs, ArgumentException.cs,
+ ArgumentNullException.cs, ArgumentOutOfRangeException.cs,
+ ArtithmeticException.cs, ArrayTypeMismatchException.cs,
+ DivideByZeroException.cs, DuplicateWaitObjectException.cs,
+ ExecutionEngineException.cs, FormatException.cs,
+ IndexOutOfRangeException.cs, InvalidCastException.cs,
+ InvalidOperationException.cs, InvalidProgramException.cs,
+ MulticateNotSupportedException.cs, NotFiniteNumberException.cs,
+ NotSupportedException.cs, NullReferenceException.cs,
+ OutOfMemoryException.cs, OverflowException.cs, RankException.cs,
+ StackOverflowException.cs, SystemException.cs,
+ TypeInitializationException.cs: Added all of the exceptions
+ specified by the language spec. Mmmm... bloat.
+
+2001-07-06 Miguel de Icaza <miguel@ximian.com>
+
+ * Int64.cs, Int32.cs: Put. Parsing and ToString missing. Should
+ do a generic routine all of these guys use.
+
+ * Int16.cs: identified missing methods.
+
+ * UInt16.cs, UInt32.cs, UInt64.cs: Add.
+
+2001-06-26 Miguel de Icaza <miguel@ximian.com>
+
+ * TypeCode.cs: Implement
+
+ * Void.cs: Implement.
+
+ * TODO: Add file to keep track of pending tasks.
+
+ * Object.cs, ValueType.cs: Implement.
diff --git a/mcs/class/corlib/System/Char.cs b/mcs/class/corlib/System/Char.cs
new file mode 100644
index 00000000000..7255faa0e7f
--- /dev/null
+++ b/mcs/class/corlib/System/Char.cs
@@ -0,0 +1,403 @@
+//
+// System.Char.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+// Note about the ToString()'s. ECMA says there's only a ToString() method,
+// BUT it is just a wrapper for ToString(null). However there is no other ToString
+// in the docs. Turning to the NET framework sdk reveals that there is a
+// ToString(formatprovider) method, as well as a 'static ToString (char c)' method,
+// which appears to just be a Convert.ToString(char c) type method. ECMA also
+// doesn't list this class as implementing IFormattable.
+
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ [Serializable]
+ public struct Char : IComparable, IConvertible { //, IFormattable {
+ public const char MaxValue = (char) 0xffff;
+ public const char MinValue = (char) 0;
+
+ // VES needs to know about value. public is workaround
+ // so source will compile
+ public char value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Char))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Char"));
+
+ char xv = (char) v;
+ if (value == xv)
+ return 0;
+
+ if (value > xv)
+ return 1;
+ else
+ return -1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Char))
+ return false;
+
+ return ((Char) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern double GetNumericValue (char c);
+
+ public static double GetNumericValue (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+
+ return GetNumericValue (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern UnicodeCategory GetUnicodeCategory (char c);
+
+ public static UnicodeCategory GetUnicodeCategory (string str, int index) {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText ("The value of index is less "+
+ "than zero, or greater than or equal to the length of str"));
+
+ return GetUnicodeCategory (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsControl (char c);
+
+ public static bool IsControl (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("Str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsControl (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsDigit (char c);
+
+ public static bool IsDigit (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("Str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsDigit (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsLetter (char c);
+
+ public static bool IsLetter (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsLetter (str[index]);
+ }
+
+ public static bool IsLetterOrDigit (char c)
+ {
+ if (IsLetter (c) == false && IsDigit (c) == false)
+ return false;
+ else
+ return true;
+ }
+
+ public static bool IsLetterOrDigit (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsLetterOrDigit (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsLower (char c);
+
+ public static bool IsLower (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsLower (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsNumber (char c);
+
+ public static bool IsNumber (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsNumber (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsPunctuation (char c);
+
+ public static bool IsPunctuation (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsPunctuation (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsSeparator (char c);
+
+ public static bool IsSeparator (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsSeparator (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsSurrogate (char c);
+
+ public static bool IsSurrogate (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsSurrogate (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsSymbol (char c);
+
+ public static bool IsSymbol (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsSymbol (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsUpper (char c);
+
+ public static bool IsUpper (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsUpper (str[index]);
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern bool IsWhiteSpace (char c);
+
+ public static bool IsWhiteSpace (string str, int index)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ if (index < 0 || index >= str.Length)
+ throw new ArgumentOutOfRangeException (Locale.GetText (
+ "The value of index is less than zero, or greater than or equal to the length of str"));
+
+ return IsWhiteSpace (str[index]);
+ }
+
+ public static char Parse (string str)
+ {
+ if (str == null)
+ throw new ArgumentNullException (Locale.GetText ("str is a null reference"));
+
+ int len = str.Length;
+ if (len != 1){
+ if (len < 1)
+ throw new ArgumentNullException ();
+ else
+ throw new FormatException ();
+ }
+ return str [0];
+ }
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern char ToLower (char c);
+
+ [MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
+ public static extern char ToUpper (char c);
+
+ public override string ToString ()
+ {
+ // LAMESPEC: ECMA draft lists this as returning ToString (null),
+ // However it doesn't list another ToString() method.
+ return new String (value, 1);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ // LAMESPEC: ECMA draft doesn't say Char implements IFormattable
+ return new String (value, 1);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Char;
+ }
+
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType(value, conversionType, provider);
+ }
+
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public byte ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte(value);
+ }
+
+ public char ToChar (IFormatProvider provider)
+ {
+ return value;
+ }
+
+ [CLSCompliant(false)]
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public double ToDouble (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16(value);
+ }
+
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32(value);
+ }
+
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64(value);
+ }
+
+ [CLSCompliant(false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte(value);
+ }
+
+ public float ToSingle (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ string IConvertible.ToString (IFormatProvider provider)
+ {
+ return ToString(provider);
+ }
+
+ [CLSCompliant(false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16(value);
+ }
+
+ [CLSCompliant(false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32(value);
+ }
+
+ [CLSCompliant(false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64(value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/CharEnumerator.cs b/mcs/class/corlib/System/CharEnumerator.cs
new file mode 100644
index 00000000000..7689a5a3b4c
--- /dev/null
+++ b/mcs/class/corlib/System/CharEnumerator.cs
@@ -0,0 +1,90 @@
+//
+// System.CharEnumerator.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System.Collections;
+
+namespace System
+{
+ [Serializable]
+ public sealed class CharEnumerator : IEnumerator, ICloneable
+ {
+ private string str;
+ private int index;
+ private int length;
+ // Representation invariant:
+ // length == str.Length
+ // -1 <= index <= length
+
+ // Constructor
+ internal CharEnumerator (string s)
+ {
+ str = s;
+ index = -1;
+ length = s.Length;
+ }
+
+ // Property
+ public char Current
+ {
+ get {
+ if (index == -1 || index == length)
+ throw new InvalidOperationException
+ ("The position is not valid.");
+
+ return str [index];
+ }
+ }
+
+ object IEnumerator.Current
+ {
+ get {
+ if (index == -1 || index == length)
+ throw new InvalidOperationException
+ ("The position is not valid");
+
+ return str [index];
+ }
+ }
+
+ // Methods
+ public object Clone ()
+ {
+ CharEnumerator x = new CharEnumerator (str);
+ x.index = index;
+ return x;
+ }
+
+ public bool MoveNext ()
+ {
+ // Representation invariant holds: -1 <= index <= length
+
+ index ++;
+
+ // Now: 0 <= index <= length+1;
+ // <=>
+ // 0 <= index < length (OK) ||
+ // length <= index <= length+1 (Out of bounds)
+
+ if (index >= length) {
+ index = length;
+ // Invariant restored:
+ // length == index
+ // =>
+ // -1 <= index <= length
+ return false;
+ }
+ else
+ return true;
+ }
+
+ public void Reset ()
+ {
+ index = -1;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Console.cs b/mcs/class/corlib/System/Console.cs
new file mode 100644
index 00000000000..9f38c660898
--- /dev/null
+++ b/mcs/class/corlib/System/Console.cs
@@ -0,0 +1,317 @@
+//
+// System.Console.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.IO;
+
+namespace System {
+
+ public sealed class Console {
+
+ private static TextWriter stdout;
+ private static TextWriter stderr;
+ private static TextReader stdin;
+
+ static Console ()
+ {
+ stderr = new StreamWriter (OpenStandardError ());
+ stdout = new StreamWriter (OpenStandardOutput ());
+ stdin = new StreamReader (OpenStandardInput ());
+ }
+
+ private Console () {}
+
+ public static TextWriter Error
+ {
+ get {
+ return stderr;
+ }
+ }
+
+ public static TextWriter Out
+ {
+ get {
+ return stdout;
+ }
+ }
+
+ public static TextReader In
+ {
+ get {
+ return stdin;
+ }
+ }
+
+ public static Stream OpenStandardError ()
+ {
+ return OpenStandardError (0);
+ }
+
+ public static Stream OpenStandardError (int bufferSize)
+ {
+ return new FileStream (MonoIO.ConsoleError,
+ FileAccess.Write,
+ false, bufferSize);
+ }
+
+ public static Stream OpenStandardInput ()
+ {
+ return OpenStandardInput (0);
+ }
+
+ public static Stream OpenStandardInput (int bufferSize)
+ {
+ return new FileStream (MonoIO.ConsoleInput,
+ FileAccess.Read,
+ false, bufferSize);
+ }
+
+ public static Stream OpenStandardOutput ()
+ {
+ return OpenStandardOutput (0);
+ }
+
+ public static Stream OpenStandardOutput (int bufferSize)
+ {
+ return new FileStream (MonoIO.ConsoleOutput,
+ FileAccess.Write,
+ false, bufferSize);
+ }
+
+ public static void SetError (TextWriter newError)
+ {
+ if (newError == null)
+ throw new ArgumentNullException ();
+
+ stderr = newError;
+ }
+
+ public static void SetIn (TextReader newIn)
+ {
+ if (newIn == null)
+ throw new ArgumentNullException ();
+
+ stdin = newIn;
+ }
+
+ public static void SetOut (TextWriter newOut)
+ {
+ if (newOut == null)
+ throw new ArgumentNullException ();
+
+ stdout = newOut;
+ }
+
+ public static void Write (bool value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (char value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (char[] value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (decimal value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (double value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (int value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (long value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (object value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (float value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (string value)
+ {
+ stdout.Write (value);
+ }
+
+ [CLSCompliant(false)]
+ public static void Write (uint value)
+ {
+ stdout.Write (value);
+ }
+
+ [CLSCompliant(false)]
+ public static void Write (ulong value)
+ {
+ stdout.Write (value);
+ }
+
+ public static void Write (string format, object arg0)
+ {
+ stdout.Write (format, arg0);
+ }
+
+ public static void Write (string format, params object[] arg)
+ {
+ stdout.Write (format, arg);
+ }
+
+ public static void Write (char[] buffer, int index, int count)
+ {
+ stdout.Write (buffer, index, count);
+ }
+
+ public static void Write (string format, object arg0, object arg1)
+ {
+ stdout.Write (format, arg0, arg1);
+ }
+
+ public static void Write (string format, object arg0, object arg1, object arg2 )
+ {
+ stdout.Write (format, arg0, arg1, arg2);
+ }
+
+ public static void WriteLine ()
+ {
+ stdout.WriteLine ();
+ }
+
+ public static void WriteLine (bool value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (char value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (char[] value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (decimal value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (double value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (int value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (long value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (object value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (float value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (string value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ [CLSCompliant(false)]
+ public static void WriteLine (uint value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ [CLSCompliant(false)]
+ public static void WriteLine (ulong value)
+ {
+ stdout.Write (value);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (string format, object arg0)
+ {
+ stdout.Write (format, arg0);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (string format, params object[] arg)
+ {
+ stdout.Write (format, arg);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (char[] buffer, int index, int count)
+ {
+ stdout.Write (buffer, index, count);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (string format, object arg0, object arg1)
+ {
+ stdout.Write (format, arg0, arg1);
+ stdout.WriteLine();
+ }
+
+ public static void WriteLine (string format, object arg0, object arg1, object arg2)
+ {
+ stdout.Write (format, arg0, arg1, arg2);
+ stdout.WriteLine();
+ }
+
+ public static int Read ()
+ {
+ return stdin.Read ();
+ }
+
+ public static string ReadLine ()
+ {
+ return stdin.ReadLine ();
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/ContextBoundObject.cs b/mcs/class/corlib/System/ContextBoundObject.cs
new file mode 100644
index 00000000000..92e95e454aa
--- /dev/null
+++ b/mcs/class/corlib/System/ContextBoundObject.cs
@@ -0,0 +1,25 @@
+//
+// System.ContextBoundObject.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+namespace System {
+
+ /// <summary>
+ /// Base class for all the context-bound classes
+ /// </summary>
+ [MonoTODO]
+ [Serializable]
+ public abstract class ContextBoundObject : MarshalByRefObject {
+
+ protected ContextBoundObject ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ContextMarshalException.cs b/mcs/class/corlib/System/ContextMarshalException.cs
new file mode 100644
index 00000000000..bb058cf2e09
--- /dev/null
+++ b/mcs/class/corlib/System/ContextMarshalException.cs
@@ -0,0 +1,42 @@
+//
+// System.ContextMarshalException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class ContextMarshalException : SystemException
+ {
+ // Constructors
+ public ContextMarshalException ()
+ : base (Locale.GetText ("Attempt to marshal and object across a context failed."))
+ {
+ }
+
+ public ContextMarshalException (string message)
+ : base (message)
+ {
+ }
+
+ protected ContextMarshalException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public ContextMarshalException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/ContextStaticAttribute.cs b/mcs/class/corlib/System/ContextStaticAttribute.cs
new file mode 100755
index 00000000000..054c9845e6f
--- /dev/null
+++ b/mcs/class/corlib/System/ContextStaticAttribute.cs
@@ -0,0 +1,28 @@
+//
+// System.ContextStaticAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The ContextStatic attribute is used to flag fields as being unique
+ /// </summary>
+ ///
+ /// <remarks>
+ ///
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.Field)]
+ [Serializable]
+ public class ContextStaticAttribute : Attribute {
+
+ public ContextStaticAttribute () : base ()
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/Convert.cs b/mcs/class/corlib/System/Convert.cs
new file mode 100644
index 00000000000..05de1aab5ee
--- /dev/null
+++ b/mcs/class/corlib/System/Convert.cs
@@ -0,0 +1,2371 @@
+//
+// System.Convert.cs
+//
+// Author:
+// Derek Holden (dholden@draper.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+//
+// System.Convert class. This was written word for word off the
+// Library specification for System.Convert in the ECMA TC39 TG2
+// and TG3 working documents. The first page of which has a table
+// for all legal conversion scenerios.
+//
+// This header and the one above it can be formatted however, just trying
+// to keep it consistent w/ the existing mcs headers.
+//
+// This Convert class could be written another way, with each type
+// implementing IConvertible and defining their own conversion functions,
+// and this class just calling the type's implementation. Or, they can
+// be defined here and the implementing type can use these functions when
+// defining their IConvertible interface. Byte's ToBoolean() calls
+// Convert.ToBoolean(byte), or Convert.ToBoolean(byte) calls
+// byte.ToBoolean(). The first case is what is done here.
+//
+// See http://lists.ximian.com/archives/public/mono-list/2001-July/000525.html
+//
+// There are also conversion functions that are not defined in
+// the ECMA draft, such as there is no bool ToBoolean(DateTime value),
+// and placing that somewhere won't compile w/ this Convert since the
+// function doesn't exist. However calling that when using Microsoft's
+// System.Convert doesn't produce any compiler errors, it just throws
+// an InvalidCastException at runtime.
+//
+// Whenever a decimal, double, or single is converted to an integer
+// based type, it is even rounded. This uses Math.Round which only
+// has Round(decimal) and Round(double), so in the Convert from
+// single cases the value is passed to Math as a double. This
+// may not be completely necessary.
+//
+// The .NET Framework SDK lists DBNull as a member of this class
+// as 'public static readonly object DBNull;'.
+//
+// It should also be decided if all the cast return values should be
+// returned as unchecked or not.
+//
+// All the XML function comments were auto generated which is why they
+// sound someone redundant.
+//
+// TYPE | BOOL BYTE CHAR DT DEC DBL I16 I32 I64 SBYT SNGL STR UI16 UI32 UI64
+// -----+--------------------------------------------------------------------
+// BOOL | X X X X X X X X X X X X X
+// BYTE | X X X X X X X X X X X X X X
+// CHAR | X X X X X X X X X X
+// DT | X X
+// DEC | X X X X X X X X X X X X X
+// DBL | X X X X X X X X X X X X X
+// I16 | X X X X X X X X X X X X X X
+// I32 | X X X X X X X X X X X X X X
+// I64 | X X X X X X X X X X X X X X
+// SBYT | X X X X X X X X X X X X X X
+// SNGL | X X X X X X X X X X X X X
+// STR | X X X X X X X X X X X X X X X
+// UI16 | X X X X X X X X X X X X X X
+// UI32 | X X X X X X X X X X X X X X
+// UI64 | X X X X X X X X X X X X X X
+//
+
+using System.Globalization;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace System {
+
+ [CLSCompliant(false)]
+ public sealed class Convert {
+
+ // Fields
+ public static readonly object DBNull;
+
+ private Convert () {}
+
+ // ========== BASE 64 Conversions ========== //
+ // the BASE64 convert methods are using the Base64 converting methods
+ // from System.Security.Cryptography.ToBase64Transform and
+ // System.Security.Cryptography.FromBase64Transform
+ //
+ // should be changed to a stand-alone class Base64Encoder & Base64Decoder
+
+ public static byte[] FromBase64CharArray(char[] inArray, int offset, int length)
+ {
+ if (inArray == null)
+ throw new ArgumentNullException();
+
+ int len = inArray.Length;
+ if (len < 4 || len % 4 != 0)
+ throw new FormatException();
+
+ byte[] inArr = new System.Text.UnicodeEncoding().GetBytes(inArray);
+ FromBase64Transform t = new FromBase64Transform();
+
+ return t.TransformFinalBlock(inArr, 0, inArr.Length);
+ }
+
+ public static byte[] FromBase64String(string s)
+ {
+ if (s == null)
+ throw new ArgumentNullException();
+
+ char[] inArr = s.ToCharArray();
+
+ return FromBase64CharArray(inArr, 0, inArr.Length);
+ }
+
+ public static TypeCode GetTypeCode (object value)
+ {
+ if (value == null)
+ return TypeCode.Empty;
+ else
+ return Type.GetTypeCode (value.GetType ());
+ }
+
+ public static bool IsDBNull (object value)
+ {
+ TypeCode tc = Type.GetTypeCode (value.GetType ());
+
+ if (tc == TypeCode.DBNull)
+ return true;
+ else
+ return false;
+ }
+
+ public static int ToBase64CharArray(byte[] inArray, int offsetIn, int length,
+ char[] outArray, int offsetOut)
+ {
+ if (inArray == null || outArray == null)
+ throw new ArgumentNullException();
+
+ if (offsetIn < 0 || length < 0 || offsetOut < 0 || (offsetIn + length) > inArray.Length)
+ throw new ArgumentOutOfRangeException();
+
+ ToBase64Transform t = new ToBase64Transform();
+ byte[] outArr = t.TransformFinalBlock(inArray, offsetIn, length);
+
+ char[] cOutArr = new System.Text.ASCIIEncoding().GetChars(outArr);
+
+ if ((offsetOut + cOutArr.Length) > outArray.Length)
+ throw new ArgumentOutOfRangeException();
+
+ Array.Copy(cOutArr, 0, outArray, offsetOut, cOutArr.Length);
+
+ return cOutArr.Length;
+ }
+
+ public static string ToBase64String(byte[] inArray)
+ {
+ if (inArray == null)
+ throw new ArgumentNullException();
+
+ return ToBase64String(inArray, 0, inArray.Length);
+ }
+
+ public static string ToBase64String(byte[] inArray, int offset, int length)
+ {
+ if (inArray == null)
+ throw new ArgumentNullException();
+
+ if (offset < 0 || length < 0 || (offset + length) > inArray.Length)
+ throw new ArgumentOutOfRangeException();
+
+ // FIXME: change to stand alone Base64 Encoder class
+ ToBase64Transform t = new ToBase64Transform();
+ byte[] outArr = t.TransformFinalBlock(inArray, offset, length);
+
+ return (new System.Text.ASCIIEncoding().GetString(outArr));
+ }
+
+ // ========== Boolean Conversions ========== //
+
+ public static bool ToBoolean (bool value)
+ {
+ return value;
+ }
+
+ public static bool ToBoolean (byte value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (char value)
+ {
+ throw new InvalidCastException (Locale.GetText ("Can't convert char to bool"));
+ }
+
+ public static bool ToBoolean (DateTime value)
+ {
+ throw new InvalidCastException (Locale.GetText ("Can't convert date to bool"));
+ }
+
+ public static bool ToBoolean (decimal value)
+ {
+ return (value != 0M);
+ }
+
+ public static bool ToBoolean (double value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (float value)
+ {
+ return (value != 0f);
+ }
+
+ public static bool ToBoolean (int value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (long value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (sbyte value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (short value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (string value)
+ {
+ return Boolean.Parse (value);
+ }
+
+ public static bool ToBoolean (string value, IFormatProvider provider)
+ {
+ return Boolean.Parse (value); // provider is ignored.
+ }
+
+ public static bool ToBoolean (uint value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (ulong value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (ushort value)
+ {
+ return (value != 0);
+ }
+
+ public static bool ToBoolean (object value)
+ {
+ return ToBoolean (value, null);
+ }
+
+ public static bool ToBoolean (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return false;
+ return ((IConvertible) value).ToBoolean (provider);
+ }
+
+ // ========== Byte Conversions ========== //
+
+ public static byte ToByte (bool value)
+ {
+ return (byte)(value ? 1 : 0);
+ }
+
+ public static byte ToByte (byte value)
+ {
+ return value;
+ }
+
+ public static byte ToByte (char value)
+ {
+ if (value > Byte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static byte ToByte (decimal value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.MinValue"));
+
+ // Returned Even-Rounded
+ return (byte)(Math.Round (value));
+ }
+
+ public static byte ToByte (double value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.MinValue"));
+
+ // This and the float version of ToByte are the only ones
+ // the spec listed as checking for .NaN and Infinity overflow
+ if (Double.IsNaN(value) || Double.IsInfinity(value))
+ throw new OverflowException (Locale.GetText (
+ "Value is equal to Double.NaN, Double.PositiveInfinity, or Double.NegativeInfinity"));
+
+ // Returned Even-Rounded
+ return (byte)(Math.Round (value));
+ }
+
+ public static byte ToByte (float value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.Minalue"));
+
+ // This and the double version of ToByte are the only ones
+ // the spec listed as checking for .NaN and Infinity overflow
+ if (Single.IsNaN(value) || Single.IsInfinity(value))
+ throw new OverflowException (Locale.GetText (
+ "Value is equal to Single.NaN, Single.PositiveInfinity, or Single.NegativeInfinity"));
+
+ // Returned Even-Rounded, pass it as a double, could have this
+ // method just call Convert.ToByte ( (double)value)
+ return (byte)(Math.Round ( (double)value));
+ }
+
+ public static byte ToByte (int value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.MinValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (long value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.MinValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (sbyte value)
+ {
+ if (value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than Byte.MinValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (short value)
+ {
+ if (value > Byte.MaxValue || value < Byte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue or less than Byte.MinValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (string value)
+ {
+ return Byte.Parse (value);
+ }
+
+ public static byte ToByte (string value, IFormatProvider provider)
+ {
+ return Byte.Parse (value, provider);
+ }
+
+ public static byte ToByte (string value, int fromBase)
+ {
+ return (byte) ConvertFromBase (value, fromBase);
+ }
+
+ public static byte ToByte (uint value)
+ {
+ if (value > Byte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (ulong value)
+ {
+ if (value > Byte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (ushort value)
+ {
+ if (value > Byte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Byte.MaxValue"));
+
+ return (byte)value;
+ }
+
+ public static byte ToByte (object value)
+ {
+ return ToByte (value, null);
+ }
+
+ public static byte ToByte (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToByte (provider);
+ }
+
+ // ========== Char Conversions ========== //
+
+ public static char ToChar (bool value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static char ToChar (byte value)
+ {
+ return (char)value;
+ }
+
+ public static char ToChar (char value)
+ {
+ return value;
+ }
+
+ public static char ToChar (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static char ToChar (decimal value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static char ToChar (double value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static char ToChar (int value)
+ {
+ if (value > Char.MaxValue || value < Char.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Char.MaxValue or less than Char.MinValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (long value)
+ {
+ if (value > Char.MaxValue || value < Char.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Char.MaxValue or less than Char.MinValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (float value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static char ToChar (sbyte value)
+ {
+ if (value < Char.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than Char.MinValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (short value)
+ {
+ if (value < Char.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than Char.MinValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (string value)
+ {
+ return Char.Parse (value);
+ }
+
+ public static char ToChar (string value, IFormatProvider provider)
+ {
+ return Char.Parse (value); // provider is ignored.
+ }
+
+ public static char ToChar (uint value)
+ {
+ if (value > Char.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Char.MaxValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (ulong value)
+ {
+ if (value > Char.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Char.MaxValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (ushort value)
+ {
+ if (value > Char.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Char.MaxValue"));
+
+ return (char)value;
+ }
+
+ public static char ToChar (object value)
+ {
+ return ToChar (value, null);
+ }
+
+ public static char ToChar (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return (char) 0;
+ return ((IConvertible) value).ToChar (provider);
+ }
+
+ // ========== DateTime Conversions ========== //
+
+ public static DateTime ToDateTime (string value)
+ {
+ return DateTime.Parse (value);
+ }
+
+ public static DateTime ToDateTime (string value, IFormatProvider provider)
+ {
+ return DateTime.Parse (value, provider);
+ }
+
+ public static DateTime ToDateTime (bool value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (byte value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (char value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (DateTime value)
+ {
+ return value;
+ }
+
+ public static DateTime ToDateTime (decimal value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (double value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (short value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (int value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (long value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (float value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static DateTime ToDateTime (object value)
+ {
+ return ToDateTime (value, null);
+ }
+
+ public static DateTime ToDateTime (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return DateTime.MinValue;
+ return ((IConvertible) value).ToDateTime (provider);
+ }
+
+ [CLSCompliant (false)]
+ public static DateTime ToDateTime (sbyte value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+ [CLSCompliant (false)]
+ public static DateTime ToDateTime (ushort value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static DateTime ToDateTime (uint value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static DateTime ToDateTime (ulong value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ // ========== Decimal Conversions ========== //
+
+ public static decimal ToDecimal (bool value)
+ {
+ return value ? 1 : 0;
+ }
+
+ public static decimal ToDecimal (byte value)
+ {
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (char value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static decimal ToDecimal (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static decimal ToDecimal (decimal value)
+ {
+ return value;
+ }
+
+ public static decimal ToDecimal (double value)
+ {
+ if (value > (double)Decimal.MaxValue || value < (double)Decimal.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Decimal.MaxValue or less than Decimal.MinValue"));
+
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (float value)
+ {
+ return (decimal) Math.Round (value);
+ }
+
+ public static decimal ToDecimal (int value)
+ {
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (long value)
+ {
+ return (decimal)value;
+ }
+
+ [CLSCompliant (false)]
+ public static decimal ToDecimal (sbyte value)
+ {
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (short value)
+ {
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (string value)
+ {
+ return Decimal.Parse (value);
+ }
+
+ public static decimal ToDecimal (string value, IFormatProvider provider)
+ {
+ return Decimal.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static decimal ToDecimal (uint value)
+ {
+ return (decimal)value;
+ }
+
+ [CLSCompliant (false)]
+ public static decimal ToDecimal (ulong value)
+ {
+ return (decimal)value;
+ }
+
+ [CLSCompliant (false)]
+ public static decimal ToDecimal (ushort value)
+ {
+ return (decimal)value;
+ }
+
+ public static decimal ToDecimal (object value)
+ {
+ return ToDecimal (value, null);
+ }
+
+ public static decimal ToDecimal (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return new Decimal (0);
+ return ((IConvertible) value).ToDecimal (provider);
+ }
+
+
+ // ========== Double Conversions ========== //
+
+ public static double ToDouble (bool value)
+ {
+ return value ? 1 : 0;
+ }
+
+ public static double ToDouble (byte value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static double ToDouble (char value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static double ToDouble (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static double ToDouble (decimal value)
+ {
+ return (double)value;
+ }
+
+ public static double ToDouble (double value)
+ {
+ return value;
+ }
+
+ public static double ToDouble (float value)
+ {
+ return (double) Math.Round (value);
+ }
+
+ public static double ToDouble (int value)
+ {
+ return (double)value;
+ }
+
+ public static double ToDouble (long value)
+ {
+ return (double)value;
+ }
+
+ [CLSCompliant (false)]
+ public static double ToDouble (sbyte value)
+ {
+ return (double)value;
+ }
+
+ public static double ToDouble (short value)
+ {
+ return (double)value;
+ }
+
+ public static double ToDouble (string value)
+ {
+ return Double.Parse (value);
+ }
+
+ public static double ToDouble (string value, IFormatProvider provider)
+ {
+ return Double.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static double ToDouble (uint value)
+ {
+ return (double)value;
+ }
+
+ [CLSCompliant (false)]
+ public static double ToDouble (ulong value)
+ {
+ return (double)value;
+ }
+
+ [CLSCompliant (false)]
+ public static double ToDouble (ushort value)
+ {
+ return (double)value;
+ }
+
+ public static double ToDouble (object value)
+ {
+ return ToDouble (value, null);
+ }
+
+ public static double ToDouble (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0.0;
+ return ((IConvertible) value).ToDouble (provider);
+ }
+
+ // ========== Int16 Conversions ========== //
+
+ public static short ToInt16 (bool value)
+ {
+ return (short)(value ? 1 : 0);
+ }
+
+ public static short ToInt16 (byte value)
+ {
+ return (short)value;
+ }
+
+ public static short ToInt16 (char value)
+ {
+ if (value > Int16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue"));
+
+ return (short)value;
+ }
+
+ public static short ToInt16 (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static short ToInt16 (decimal value)
+ {
+ if (value > Int16.MaxValue || value < Int16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue or less than Int16.MinValue"));
+
+ // Returned Even-Rounded
+ return (short)(Math.Round (value));
+ }
+
+ public static short ToInt16 (double value)
+ {
+ if (value > Int16.MaxValue || value < Int16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue or less than Int16.MinValue"));
+
+ // Returned Even-Rounded
+ return (short)(Math.Round (value));
+ }
+
+ public static short ToInt16 (float value)
+ {
+ if (value > Int16.MaxValue || value < Int16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue or less than Int16.MinValue"));
+
+ // Returned Even-Rounded, use Math.Round pass as a double.
+ return (short)Math.Round ( (double)value);
+ }
+
+ public static short ToInt16 (int value)
+ {
+ if (value > Int16.MaxValue || value < Int16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue or less than Int16.MinValue"));
+
+ return (short)value;
+ }
+
+ public static short ToInt16 (long value)
+ {
+ if (value > Int16.MaxValue || value < Int16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue or less than Int16.MinValue"));
+
+ return (short)value;
+ }
+
+ [CLSCompliant (false)]
+ public static short ToInt16 (sbyte value)
+ {
+ return (short)value;
+ }
+
+ public static short ToInt16 (short value)
+ {
+ return value;
+ }
+
+ public static short ToInt16 (string value)
+ {
+ return Int16.Parse (value);
+ }
+
+ public static short ToInt16 (string value, IFormatProvider provider)
+ {
+ return Int16.Parse (value, provider);
+ }
+
+
+ public static short ToInt16 (string value, int fromBase)
+ {
+ return (short) ConvertFromBase (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static short ToInt16 (uint value)
+ {
+ if (value > Int16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue"));
+
+ return (short)value;
+ }
+
+ [CLSCompliant (false)]
+ public static short ToInt16 (ulong value)
+ {
+ if (value > (ulong)Int16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue"));
+ return (short)value;
+ }
+
+ [CLSCompliant (false)]
+ public static short ToInt16 (ushort value)
+ {
+ if (value > Int16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int16.MaxValue"));
+
+ return (short)value;
+ }
+
+ public static short ToInt16 (object value)
+ {
+ return ToInt16 (value, null);
+ }
+
+ public static short ToInt16 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToInt16 (provider);
+ }
+
+ // ========== Int32 Conversions ========== //
+
+ public static int ToInt32 (bool value)
+ {
+ return value ? 1 : 0;
+ }
+
+ public static int ToInt32 (byte value)
+ {
+ return (int)value;
+ }
+
+ public static int ToInt32 (char value)
+ {
+ return (int)value;
+ }
+
+ public static int ToInt32 (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static int ToInt32 (decimal value)
+ {
+ if (value > Int32.MaxValue || value < Int32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue or less than Int32.MinValue"));
+
+ // Returned Even-Rounded
+ return (int)(Math.Round (value));
+ }
+
+ public static int ToInt32 (double value)
+ {
+ if (value > Int32.MaxValue || value < Int32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue or less than Int32.MinValue"));
+
+ // Returned Even-Rounded
+ return (int)(Math.Round (value));
+ }
+
+ public static int ToInt32 (float value)
+ {
+ if (value > Int32.MaxValue || value < Int32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue or less than Int32.MinValue"));
+
+ // Returned Even-Rounded, pass as a double, could just call
+ // Convert.ToInt32 ( (double)value);
+ return (int)(Math.Round ( (double)value));
+ }
+
+ public static int ToInt32 (int value)
+ {
+ return value;
+ }
+
+ public static int ToInt32 (long value)
+ {
+ if (value > Int32.MaxValue || value < Int32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue or less than Int32.MinValue"));
+
+ return (int)value;
+ }
+
+ [CLSCompliant (false)]
+ public static int ToInt32 (sbyte value)
+ {
+ return (int)value;
+ }
+
+ public static int ToInt32 (short value)
+ {
+ return (int)value;
+ }
+
+ public static int ToInt32 (string value)
+ {
+ return Int32.Parse (value);
+ }
+
+ public static int ToInt32 (string value, IFormatProvider provider)
+ {
+ return Int32.Parse (value, provider);
+ }
+
+
+ public static int ToInt32 (string value, int fromBase)
+ {
+ return ConvertFromBase (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static int ToInt32 (uint value)
+ {
+ if (value > Int32.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue"));
+
+ return (int)value;
+ }
+
+ [CLSCompliant (false)]
+ public static int ToInt32 (ulong value)
+ {
+ if (value > Int32.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int32.MaxValue"));
+
+ return (int)value;
+ }
+
+ [CLSCompliant (false)]
+ public static int ToInt32 (ushort value)
+ {
+ return (int)value;
+ }
+
+ public static int ToInt32 (object value)
+ {
+ return ToInt32 (value, null);
+ }
+
+ public static int ToInt32 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToInt32 (provider);
+ }
+
+ // ========== Int64 Conversions ========== //
+
+ public static long ToInt64 (bool value)
+ {
+ return value ? 1 : 0;
+ }
+
+ public static long ToInt64 (byte value)
+ {
+ return (long)(ulong)value;
+ }
+
+ public static long ToInt64 (char value)
+ {
+ return (long)value;
+ }
+
+ public static long ToInt64 (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static long ToInt64 (decimal value)
+ {
+ if (value > Int64.MaxValue || value < Int64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int64.MaxValue or less than Int64.MinValue"));
+
+ // Returned Even-Rounded
+ return (long)(Math.Round (value));
+ }
+
+ public static long ToInt64 (double value)
+ {
+ if (value > Int64.MaxValue || value < Int64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int64.MaxValue or less than Int64.MinValue"));
+
+ // Returned Even-Rounded
+ return (long)(Math.Round (value));
+ }
+
+ public static long ToInt64 (float value)
+ {
+ if (value > Int64.MaxValue || value < Int64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int64.MaxValue or less than Int64.MinValue"));
+
+ // Returned Even-Rounded, pass to Math as a double, could
+ // just call Convert.ToInt64 ( (double)value);
+ return (long)(Math.Round ( (double)value));
+ }
+
+ public static long ToInt64 (int value)
+ {
+ return (long)value;
+ }
+
+ public static long ToInt64 (long value)
+ {
+ return value;
+ }
+
+ [CLSCompliant (false)]
+ public static long ToInt64 (sbyte value)
+ {
+ return (long)value;
+ }
+
+ public static long ToInt64 (short value)
+ {
+ return (long)value;
+ }
+
+ public static long ToInt64 (string value)
+ {
+ return Int64.Parse (value);
+ }
+
+ public static long ToInt64 (string value, IFormatProvider provider)
+ {
+ return Int64.Parse (value, provider);
+ }
+
+ public static long ToInt64 (string value, int fromBase)
+ {
+ if (NotValidBase (fromBase))
+ throw new ArgumentException ("fromBase is not valid.");
+
+ return (long) ConvertFromBase (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static long ToInt64 (uint value)
+ {
+ return (long)(ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static long ToInt64 (ulong value)
+ {
+ if (value > Int64.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Int64.MaxValue"));
+
+ return (long)value;
+ }
+
+ [CLSCompliant (false)]
+ public static long ToInt64 (ushort value)
+ {
+ return (long)(ulong)value;
+ }
+
+ public static long ToInt64 (object value)
+ {
+ return ToInt64 (value, null);
+ }
+
+ public static long ToInt64 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToInt64 (provider);
+ }
+
+ // ========== SByte Conversions ========== //
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (bool value)
+ {
+ return (sbyte)(value ? 1 : 0);
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (byte value)
+ {
+ if (value > SByte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (char value)
+ {
+ if (value > SByte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (decimal value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.MinValue"));
+
+ // Returned Even-Rounded
+ return (sbyte)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (double value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.MinValue"));
+
+ // Returned Even-Rounded
+ return (sbyte)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (float value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.Minalue"));
+
+ // Returned Even-Rounded, pass as double to Math
+ return (sbyte)(Math.Round ( (double)value));
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (int value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.MinValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (long value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.MinValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (sbyte value)
+ {
+ return value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (short value)
+ {
+ if (value > SByte.MaxValue || value < SByte.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue or less than SByte.MinValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (string value)
+ {
+ return SByte.Parse (value);
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (string value, IFormatProvider provider)
+ {
+ return SByte.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (string value, int fromBase)
+ {
+ return (sbyte) ConvertFromBase (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (uint value)
+ {
+ if (value > SByte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (ulong value)
+ {
+ if (value > (ulong)SByte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (ushort value)
+ {
+ if (value > SByte.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than SByte.MaxValue"));
+
+ return (sbyte)value;
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (object value)
+ {
+ return ToSByte (value, null);
+ }
+
+ [CLSCompliant (false)]
+ public static sbyte ToSByte (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToSByte (provider);
+ }
+
+ // ========== Single Conversions ========== //
+
+ public static float ToSingle (bool value)
+ {
+ return value ? 1 : 0;
+ }
+
+ public static float ToSingle (byte value)
+ {
+ return (float)value;
+ }
+
+ public static float ToSingle (Char value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static float ToSingle (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ public static float ToSingle (decimal value)
+ {
+ return (float)value;
+ }
+
+ public static float ToSingle (double value)
+ {
+ if (value > Single.MaxValue || value < Single.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than Single.MaxValue or less than Single.MinValue"));
+
+ return (float)value;
+ }
+
+ public static float ToSingle (float value)
+ {
+ return value;
+ }
+
+ public static float ToSingle (int value)
+ {
+ return (float)value;
+ }
+
+ public static float ToSingle (long value)
+ {
+ return (float)value;
+ }
+
+ [CLSCompliant (false)]
+ public static float ToSingle (sbyte value)
+ {
+ return (float)value;
+ }
+
+ public static float ToSingle (short value)
+ {
+ return (float)value;
+ }
+
+ public static float ToSingle (string value)
+ {
+ return Single.Parse (value);
+ }
+
+ public static float ToSingle (string value, IFormatProvider provider)
+ {
+ return Single.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static float ToSingle (uint value)
+ {
+ return (float)value;
+ }
+
+ [CLSCompliant (false)]
+ public static float ToSingle (ulong value)
+ {
+ return (float)value;
+ }
+
+ [CLSCompliant (false)]
+ public static float ToSingle (ushort value)
+ {
+ return (float)value;
+ }
+
+ [CLSCompliant (false)]
+ public static float ToSingle (object value)
+ {
+ return ToSingle (value, null);
+ }
+
+ [CLSCompliant (false)]
+ public static float ToSingle (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToSingle (provider);
+ }
+
+ // ========== String Conversions ========== //
+
+ public static string ToString (bool value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (bool value, IFormatProvider provider)
+ {
+ return value.ToString (); // the same as ToString (bool).
+ }
+
+ public static string ToString (byte value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (byte value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (byte value, int toBase)
+ {
+ if (NotValidBase (toBase))
+ throw new ArgumentException ("toBase is not valid.");
+
+ return ConvertToBase ((int) value, toBase);
+ }
+
+ public static string ToString (char value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (char value, IFormatProvider provider)
+ {
+ return value.ToString (); // the same as ToString (char)
+ }
+
+ public static string ToString (DateTime value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (DateTime value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (decimal value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (decimal value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (double value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (double value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (float value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (float value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (int value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (int value, int fromBase)
+ {
+ int retVal = ConvertFromBase (value.ToString (), fromBase);
+ return retVal.ToString ();
+ }
+
+ public static string ToString (int value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (long value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (long value, int fromBase)
+ {
+ return (ConvertFromBase (value.ToString (), fromBase)).ToString ();
+ }
+
+ public static string ToString (long value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (object value)
+ {
+ return ToString (value, null);
+ }
+
+ public static string ToString (object value, IFormatProvider provider)
+ {
+ if (value is IConvertible)
+ return ((IConvertible) value).ToString (provider);
+ else if (value != null)
+ return value.ToString ();
+ return String.Empty;
+ }
+
+ public static string ToString (sbyte value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (sbyte value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (short value)
+ {
+ return value.ToString ();
+ }
+
+ public static string ToString (short value, int fromBase)
+ {
+ return (ConvertFromBase (value.ToString (), fromBase)).ToString ();
+ }
+
+ public static string ToString (short value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ public static string ToString (string value)
+ {
+ return value;
+ }
+
+ public static string ToString (string value, IFormatProvider provider)
+ {
+ return value; // provider is ignored.
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (uint value)
+ {
+ return value.ToString ();
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (uint value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (ulong value)
+ {
+ return value.ToString ();
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (ulong value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (ushort value)
+ {
+ return value.ToString ();
+ }
+
+ [CLSCompliant (false)]
+ public static string ToString (ushort value, IFormatProvider provider)
+ {
+ return value.ToString (provider);
+ }
+
+ // ========== UInt16 Conversions ========== //
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (bool value)
+ {
+ return (ushort)(value ? 1 : 0);
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (byte value)
+ {
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (char value)
+ {
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (decimal value)
+ {
+ if (value > UInt16.MaxValue || value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue or less than UInt16.MinValue"));
+
+ // Returned Even-Rounded
+ return (ushort)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (double value)
+ {
+ if (value > UInt16.MaxValue || value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue or less than UInt16.MinValue"));
+
+ // Returned Even-Rounded
+ return (ushort)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (float value)
+ {
+ if (value > UInt16.MaxValue || value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue or less than UInt16.MinValue"));
+
+ // Returned Even-Rounded, pass as double to Math
+ return (ushort)(Math.Round ( (double)value));
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (int value)
+ {
+ if (value > UInt16.MaxValue || value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue or less than UInt16.MinValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (long value)
+ {
+ if (value > UInt16.MaxValue || value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue or less than UInt16.MinValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (sbyte value)
+ {
+ if (value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt16.MinValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (short value)
+ {
+ if (value < UInt16.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt16.MinValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (string value)
+ {
+ return UInt16.Parse (value);
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (string value, IFormatProvider provider)
+ {
+ return UInt16.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (string value, int fromBase)
+ {
+ return (ushort) ConvertFromBase (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (uint value)
+ {
+ if (value > UInt16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (ulong value)
+ {
+ if (value > (ulong)UInt16.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt16.MaxValue"));
+
+ return (ushort)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (ushort value)
+ {
+ return value;
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (object value)
+ {
+ return ToUInt16 (value, null);
+ }
+
+ [CLSCompliant (false)]
+ public static ushort ToUInt16 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToUInt16 (provider);
+ }
+
+ // ========== UInt32 Conversions ========== //
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (bool value)
+ {
+ return (uint)(value ? 1 : 0);
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (byte value)
+ {
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (char value)
+ {
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (DateTime value)
+ {
+ throw new InvalidCastException ("This conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (decimal value)
+ {
+ if (value > UInt32.MaxValue || value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt32.MaxValue or less than UInt32.MinValue"));
+
+ // Returned Even-Rounded
+ return (uint)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (double value)
+ {
+ if (value > UInt32.MaxValue || value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt32.MaxValue or less than UInt32.MinValue"));
+
+ // Returned Even-Rounded
+ return (uint)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (float value)
+ {
+ if (value > UInt32.MaxValue || value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt32.MaxValue or less than UInt32.MinValue"));
+
+ // Returned Even-Rounded, pass as double to Math
+ return (uint)(Math.Round ( (double)value));
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (int value)
+ {
+ if (value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt32.MinValue"));
+
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (long value)
+ {
+ if (value > UInt32.MaxValue || value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt32.MaxValue or less than UInt32.MinValue"));
+
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (sbyte value)
+ {
+ if (value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt32.MinValue"));
+
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (short value)
+ {
+ if (value < UInt32.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt32.MinValue"));
+
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (string value)
+ {
+ return UInt32.Parse (value);
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (string value, IFormatProvider provider)
+ {
+ return UInt32.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (string value, int fromBase)
+ {
+ return (uint) ConvertFromBase (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (uint value)
+ {
+ return value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (ulong value)
+ {
+ if (value > UInt32.MaxValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt32.MaxValue"));
+
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (ushort value)
+ {
+ return (uint)value;
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (object value)
+ {
+ return ToUInt32 (value, null);
+ }
+
+ [CLSCompliant (false)]
+ public static uint ToUInt32 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToUInt32 (provider);
+ }
+
+
+ // ========== UInt64 Conversions ========== //
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (bool value)
+ {
+ return (ulong)(value ? 1 : 0);
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (byte value)
+ {
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (char value)
+ {
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (DateTime value)
+ {
+ throw new InvalidCastException ("The conversion is not supported.");
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (decimal value)
+ {
+ if (value > UInt64.MaxValue || value < UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt64.MaxValue or less than UInt64.MinValue"));
+
+ // Returned Even-Rounded
+ return (ulong)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (double value)
+ {
+ if (value > UInt64.MaxValue || value < UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt64.MaxValue or less than UInt64.MinValue"));
+
+ // Returned Even-Rounded
+ return (ulong)(Math.Round (value));
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (float value)
+ {
+ if (value > UInt64.MaxValue || value < UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is greater than UInt64.MaxValue or less than UInt64.MinValue"));
+
+ // Returned Even-Rounded, pass as a double to Math
+ return (ulong)(Math.Round ( (double)value));
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (int value)
+ {
+ if (value < (int)UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt64.MinValue"));
+
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (long value)
+ {
+ if (value < (long)UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt64.MinValue"));
+
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (sbyte value)
+ {
+ if (value < (sbyte)UInt64.MinValue)
+ throw new OverflowException
+ ("Value is less than UInt64.MinValue");
+
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (short value)
+ {
+ if (value < (short)UInt64.MinValue)
+ throw new OverflowException (Locale.GetText (
+ "Value is less than UInt64.MinValue"));
+
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (string value)
+ {
+ return UInt64.Parse (value);
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (string value, IFormatProvider provider)
+ {
+ return UInt64.Parse (value, provider);
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (string value, int fromBase)
+ {
+ return (ulong) ConvertFromBase (value, fromBase);
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (uint value)
+ {
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (ulong value)
+ {
+ return value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (ushort value)
+ {
+ return (ulong)value;
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (object value)
+ {
+ return ToUInt64 (value, null);
+ }
+
+ [CLSCompliant (false)]
+ public static ulong ToUInt64 (object value, IFormatProvider provider)
+ {
+ if (value == null)
+ return 0;
+ return ((IConvertible) value).ToUInt64 (provider);
+ }
+
+
+ // ========== Conversion / Helper Functions ========== //
+
+ public static object ChangeType (object value, Type conversionType)
+ {
+ CultureInfo ci = CultureInfo.CurrentCulture;
+ NumberFormatInfo number = ci.NumberFormat;
+ return ToType (value, conversionType, number);
+ }
+
+ public static object ChangeType (object value, TypeCode typeCode)
+ {
+ CultureInfo ci = CultureInfo.CurrentCulture;
+ Type conversionType = conversionTable [(int)typeCode];
+ NumberFormatInfo number = ci.NumberFormat;
+ return ToType (value, conversionType, number);
+ }
+
+ public static object ChangeType (object value, Type conversionType, IFormatProvider provider)
+ {
+ return ToType (value, conversionType, provider);
+ }
+
+ public static object ChangeType (object value, TypeCode typeCode, IFormatProvider provider)
+ {
+ Type conversionType = conversionTable [(int)typeCode];
+ return ToType (value, conversionType, provider);
+ }
+
+ private static bool NotValidBase (int value)
+ {
+ if ((value == 2) || (value == 8) ||
+ (value == 10) || (value == 16))
+ return false;
+
+ return true;
+ }
+
+ private static int ConvertFromBase (string value, int fromBase)
+ {
+ if (NotValidBase (fromBase))
+ throw new ArgumentException ("fromBase is not valid.");
+
+ int result = 0;
+
+ foreach (char c in value) {
+ if (Char.IsLetter (c))
+ result = (fromBase) * result + c - 'a' + 10;
+ else
+ result = (fromBase) * result + c - '0';
+ }
+ return result;
+ }
+
+ private static string ConvertToBase (int value, int toBase)
+ {
+ StringBuilder sb = new StringBuilder ();
+ BuildConvertedString (sb, value, toBase);
+ return sb.ToString ();
+ }
+
+ internal static void BuildConvertedString (StringBuilder sb, int value, int toBase)
+ {
+ int divided = value / toBase;
+ int reminder = value % toBase;
+
+ if (divided > 0)
+ BuildConvertedString (sb, divided, toBase);
+
+ if (reminder >= 10)
+ sb.Append ((char) (reminder + 'a' - 10));
+ else
+ sb.Append ((char) (reminder + '0'));
+ }
+ // Lookup table for the conversion ToType method. Order
+ // is important! Used by ToType for comparing the target
+ // type, and uses hardcoded array indexes.
+ private static Type[] conversionTable = {
+ // Valid ICovnertible Types
+ typeof (Boolean), // 0 TypeCode.Boolean
+ typeof (Byte), // 1 TypeCode.Byte
+ typeof (Char), // 2 TypeCode.Char
+ typeof (DateTime), // 3 TypeCode.DateTime
+ typeof (Decimal), // 4 TypeCode.Decimal
+ typeof (Double), // 5 TypeCode.Double
+ typeof (Int16), // 6 TypeCode.Int16
+ typeof (Int32), // 7 TypeCode.Int32
+ typeof (Int64), // 8 TypeCode.Int64
+ typeof (SByte), // 9 TypeCode.Sbyte
+ typeof (Single), // 10 TypeCode.Single
+ typeof (String), // 11 TypeCode.String
+ typeof (UInt16), // 12 TypeCode.UInt16
+ typeof (UInt32), // 13 TypeCode.UInt32
+ typeof (UInt64), // 14 TypeCode.UInt64
+
+ // Invalid IConvertible Interface Types
+ typeof (Object) // 15 TypeCode.Object
+ };
+
+ // Function to convert an object to another type and return
+ // it as an object. In place for the core data types to use
+ // when implementing IConvertible. Uses hardcoded indexes in
+ // the conversionTypes array, so if modify carefully.
+ internal static object ToType (object value, Type conversionType,
+ IFormatProvider provider)
+ {
+ if (value == null)
+ throw new ArgumentException (Locale.GetText (
+ "Invalid conversion from null value"));
+
+ if (value is IConvertible) {
+ IConvertible convertValue = (IConvertible)value;
+
+ if (conversionType == conversionTable[0]) {
+ // 0 TypeCode.Boolean
+ return (object)(convertValue.ToBoolean (provider));
+
+ } else if (conversionType == conversionTable[1]) {
+ // 1 TypeCode.Byte
+ return (object)(convertValue.ToByte (provider));
+
+ } else if (conversionType == conversionTable[2]) {
+ // 2 TypeCode.Char
+ return (object)(convertValue.ToChar (provider));
+
+ } else if (conversionType == conversionTable[3]) {
+ // 3 TypeCode.DateTime
+ return (object)(convertValue.ToDateTime (provider));
+
+ } else if (conversionType == conversionTable[4]) {
+ // 4 TypeCode.Decimal
+ return (object)(convertValue.ToDecimal (provider));
+
+ } else if (conversionType == conversionTable[5]) {
+ // 5 TypeCode.Double
+ return (object)(convertValue.ToDouble (provider));
+
+ } else if (conversionType == conversionTable[6]) {
+ // 6 TypeCode.Int16
+ return (object)(convertValue.ToInt16 (provider));
+
+ } else if (conversionType == conversionTable[7]) {
+ // 7 TypeCode.Int32
+ return (object)(convertValue.ToInt32 (provider));
+
+ } else if (conversionType == conversionTable[8]) {
+ // 8 TypeCode.Int64
+ return (object)(convertValue.ToInt64 (provider));
+
+ } else if (conversionType == conversionTable[9]) {
+ // 9 TypeCode.Sbyte
+ return (object)(convertValue.ToSByte (provider));
+
+ } else if (conversionType == conversionTable[10]) {
+ // 10 TypeCode.Single
+ return (object)(convertValue.ToSingle (provider));
+
+ } else if (conversionType == conversionTable[11]) {
+ // 11 TypeCode.String
+ return (object)(convertValue.ToString (provider));
+
+ } else if (conversionType == conversionTable[12]) {
+ // 12 TypeCode.UInt16
+ return (object)(convertValue.ToUInt16 (provider));
+
+ } else if (conversionType == conversionTable[13]) {
+ // 13 TypeCode.UInt32
+ return (object)(convertValue.ToUInt32 (provider));
+
+ } else if (conversionType == conversionTable[14]) {
+ // 14 TypeCode.UInt64
+ return (object)(convertValue.ToUInt64 (provider));
+
+ } else if (conversionType == conversionTable[15]) {
+ // 15 TypeCode.Object
+ return (object)(value);
+
+ } else {
+ // Not in the conversion table
+ throw new InvalidCastException (Locale.GetText (
+ "Unknown target conversion type"));
+ }
+ } else {
+ // Value is not IConvertible
+ throw new ArgumentException (Locale.GetText (
+ "Value is not a convertible object: "+ value.GetType().ToString()+" to "+conversionType.ToString()));
+ }
+ }
+ }
+}
+
+
+
+
diff --git a/mcs/class/corlib/System/CrossAppDomainDelegate.cs b/mcs/class/corlib/System/CrossAppDomainDelegate.cs
new file mode 100755
index 00000000000..d8cded40afa
--- /dev/null
+++ b/mcs/class/corlib/System/CrossAppDomainDelegate.cs
@@ -0,0 +1,10 @@
+// System.CrossAppDomainDelegate.cs
+//
+// Paolo Molaro
+//
+// (C) 2002 Ximian, Inc.
+
+namespace System
+{
+ public delegate void CrossAppDomainDelegate ();
+}
diff --git a/mcs/class/corlib/System/DBNull.cs b/mcs/class/corlib/System/DBNull.cs
new file mode 100644
index 00000000000..f1a98085350
--- /dev/null
+++ b/mcs/class/corlib/System/DBNull.cs
@@ -0,0 +1,133 @@
+//
+// System.DBNull.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public sealed class DBNull : ISerializable, IConvertible
+ {
+ // Fields
+ public static readonly DBNull Value = new DBNull ();
+
+ // Private constructor
+ private DBNull () {}
+
+ // Methods
+ [MonoTODO]
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ }
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.DBNull;
+ }
+
+ [MonoTODO]
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ return false;
+ }
+
+ [MonoTODO]
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ return Byte.MinValue;
+ }
+
+ [MonoTODO]
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ return Char.MinValue;
+ }
+
+ [MonoTODO]
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ return DateTime.MinValue;
+ }
+
+ [MonoTODO]
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ return Decimal.MinValue;
+ }
+
+ [MonoTODO]
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ return Double.MinValue;
+ }
+
+ [MonoTODO]
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ return Int16.MinValue;
+ }
+
+ [MonoTODO]
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ return Int32.MinValue;
+ }
+
+ [MonoTODO]
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ return Int64.MinValue;
+ }
+
+ [MonoTODO]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ return SByte.MinValue;
+ }
+
+ [MonoTODO]
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ return Single.MinValue;
+ }
+
+ [MonoTODO]
+ object IConvertible.ToType (Type type, IFormatProvider provider)
+ {
+ return null;
+ }
+
+ [MonoTODO]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider)
+ {
+ return UInt16.MinValue;
+ }
+
+ [MonoTODO]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ return UInt32.MinValue;
+ }
+
+ [MonoTODO]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ return UInt64.MinValue;
+ }
+
+ public override string ToString ()
+ {
+ return String.Empty;
+ }
+
+ public string ToString (IFormatProvider provider)
+ {
+ return String.Empty;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/DateTime.cs b/mcs/class/corlib/System/DateTime.cs
new file mode 100644
index 00000000000..941d6336a67
--- /dev/null
+++ b/mcs/class/corlib/System/DateTime.cs
@@ -0,0 +1,1462 @@
+//
+// System.DateTime.cs
+//
+// author:
+// Marcel Narings (marcel@narings.nl)
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2001 Marcel Narings
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+
+namespace System
+{
+ /// <summary>
+ /// The DateTime structure represents dates and time ranging from
+ /// 1-1-0001 12:00:00 AM to 31-12-9999 23:59:00 Common Era.
+ /// </summary>
+ ///
+ [Serializable]
+ public struct DateTime : IComparable , IFormattable , IConvertible
+ {
+ private TimeSpan ticks;
+
+ private const int dp400 = 146097;
+ private const int dp100 = 36524;
+ private const int dp4 = 1461;
+
+ // w32 file time starts counting from 1/1/1601 00:00 GMT
+ // which is the constant ticks from the .NET epoch
+ private const long w32file_epoch = 504911232000000000L;
+
+ //
+ // The UnixEpoch, it begins on Jan 1, 1970 at 0:0:0, expressed
+ // in Ticks
+ //
+ internal const long UnixEpoch = 621355968000000000L;
+
+ public static readonly DateTime MaxValue = new DateTime (false,TimeSpan.MaxValue);
+ public static readonly DateTime MinValue = new DateTime (false,TimeSpan.MinValue);
+
+ private enum Which
+ {
+ Day,
+ DayYear,
+ Month,
+ Year
+ };
+
+ private static int[] daysmonth = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ private static int[] daysmonthleap = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+
+ private static int AbsoluteDays (int year, int month, int day)
+ {
+ int[] days;
+ int temp = 0, m=1 ;
+
+ days = (IsLeapYear(year) ? daysmonthleap : daysmonth);
+
+ while (m < month)
+ temp += days[m++];
+ return ((day-1) + temp + (365* (year-1)) + ((year-1)/4) - ((year-1)/100) + ((year-1)/400));
+ }
+
+ private int FromTicks(Which what)
+ {
+ int num400, num100, num4, numyears;
+ int M =1;
+
+ int[] days = daysmonth;
+ int totaldays = this.ticks.Days;
+
+ num400 = (totaldays / dp400);
+ totaldays -= num400 * dp400;
+
+ num100 = (totaldays / dp100);
+ if (num100 == 4) // leap
+ num100 = 3;
+ totaldays -= (num100 * dp100);
+
+ num4 = totaldays / dp4;
+ totaldays -= (num4 * dp4);
+
+ numyears = totaldays / 365 ;
+
+ if (numyears == 4) //leap
+ numyears =3 ;
+ if (what == Which.Year )
+ return num400*400 + num100*100 + num4*4 + numyears + 1;
+
+ totaldays -= (numyears * 365) ;
+ if (what == Which.DayYear )
+ return totaldays + 1;
+
+ if ((numyears==3) && ((num100 == 3) || !(num4 == 24)) ) //31 dec leapyear
+ days = daysmonthleap;
+
+ while (totaldays >= days[M])
+ totaldays -= days[M++];
+
+ if (what == Which.Month )
+ return M;
+
+ return totaldays +1;
+ }
+
+
+ // Constructors
+
+ /// <summary>
+ /// Constructs a DateTime for specified ticks
+ /// </summary>
+ ///
+ public DateTime (long newticks)
+ // `local' must default to false here to avoid
+ // a recursion loop.
+ : this (false, newticks) {}
+
+ internal DateTime (bool local, long newticks)
+ : this (true, new TimeSpan (newticks))
+ {
+ if (local) {
+ TimeZone tz = TimeZone.CurrentTimeZone;
+
+ TimeSpan utcoffset = tz.GetUtcOffset (this);
+
+ ticks = ticks + utcoffset;
+ }
+ }
+
+ public DateTime (int year, int month, int day)
+ : this (year, month, day,0,0,0,0) {}
+
+ public DateTime (int year, int month, int day, int hour, int minute, int second)
+ : this (year, month, day, hour, minute, second, 0) {}
+
+ public DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond)
+ {
+ if ( year < 1 || year > 9999 ||
+ month < 1 || month >12 ||
+ day < 1 || day > DaysInMonth(year, month) ||
+ hour < 0 || hour > 23 ||
+ minute < 0 || minute > 59 ||
+ second < 0 || second > 59 )
+ throw new ArgumentOutOfRangeException() ;
+
+ ticks = new TimeSpan (AbsoluteDays(year,month,day), hour, minute, second, millisecond);
+ }
+
+ public DateTime (int year, int month, int day, Calendar calendar)
+ : this (year, month, day, 0, 0, 0, 0, calendar) {}
+
+
+ public DateTime (int year, int month, int day, int hour, int minute, int second, Calendar calendar)
+ : this (year, month, day, hour, minute, second, 0, calendar) {}
+
+
+ public DateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar)
+ : this (year, month, day, hour, minute, second, millisecond)
+ {
+ if (calendar == null)
+ throw new ArgumentNullException();
+ }
+
+ internal DateTime (bool check, TimeSpan value)
+ {
+ if (check && (value.Ticks < MinValue.Ticks || value.Ticks > MaxValue.Ticks))
+ throw new ArgumentOutOfRangeException ();
+
+ ticks = value;
+ }
+
+ /* Properties */
+
+ public DateTime Date
+ {
+ get
+ {
+ return new DateTime (Year, Month, Day);
+ }
+ }
+
+ public int Month
+ {
+ get
+ {
+ return FromTicks(Which.Month);
+ }
+ }
+
+
+ public int Day
+ {
+ get
+ {
+ return FromTicks(Which.Day);
+ }
+ }
+
+ public DayOfWeek DayOfWeek
+ {
+ get
+ {
+ return ( (DayOfWeek) ((ticks.Days+1) % 7) );
+ }
+ }
+
+ public int DayOfYear
+ {
+ get
+ {
+ return FromTicks(Which.DayYear);
+ }
+ }
+
+ public TimeSpan TimeOfDay
+ {
+ get
+ {
+ return new TimeSpan(ticks.Ticks % TimeSpan.TicksPerDay );
+ }
+
+ }
+
+ public int Hour
+ {
+ get
+ {
+ return ticks.Hours;
+ }
+ }
+
+ public int Minute
+ {
+ get
+ {
+ return ticks.Minutes;
+ }
+ }
+
+ public int Second
+ {
+ get
+ {
+ return ticks.Seconds;
+ }
+ }
+
+ public int Millisecond
+ {
+ get
+ {
+ return ticks.Milliseconds;
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern long GetNow ();
+
+ public static DateTime Now
+ {
+ get
+ {
+ return new DateTime (true, GetNow ());
+ }
+ }
+
+ public long Ticks
+ {
+ get
+ {
+ return ticks.Ticks;
+ }
+ }
+
+ public static DateTime Today
+ {
+ get
+ {
+ return new DateTime (false, (GetNow () / TimeSpan.TicksPerDay) * TimeSpan.TicksPerDay);
+ }
+ }
+
+ public static DateTime UtcNow
+ {
+ get {
+ return new DateTime (GetNow ());
+ }
+ }
+
+ public int Year
+ {
+ get
+ {
+ return FromTicks(Which.Year);
+ }
+ }
+
+ /* methods */
+
+ public DateTime Add (TimeSpan ts)
+ {
+ return new DateTime (true, ticks) + ts;
+ }
+
+ public DateTime AddDays (double days)
+ {
+ return AddMilliseconds (days * 86400000);
+ }
+
+ public DateTime AddTicks (long t)
+ {
+ return Add (new TimeSpan (t));
+ }
+
+ public DateTime AddHours (double hours)
+ {
+ return AddMilliseconds (hours * 3600000);
+ }
+
+ public DateTime AddMilliseconds (double ms)
+ {
+ long msticks;
+
+ msticks = (long) (ms += ms > 0 ? 0.5 : -0.5) * TimeSpan.TicksPerMillisecond ;
+
+ return AddTicks (msticks);
+ }
+
+ public DateTime AddMinutes (double minutes)
+ {
+ return AddMilliseconds (minutes * 60000);
+ }
+
+ public DateTime AddMonths (int months)
+ {
+ int day, month, year, maxday ;
+ DateTime temp ;
+
+ day = this.Day;
+ month = this.Month + (months % 12);
+ year = this.Year + months/12 ;
+
+ if (month < 1)
+ {
+ month = 12 + month ;
+ year -- ;
+ }
+ else if (month>12)
+ {
+ month = month -12;
+ year ++;
+ }
+ maxday = DaysInMonth(year, month);
+ if (day > maxday)
+ day = maxday;
+
+ temp = new DateTime (year, month, day);
+ return temp.Add (this.TimeOfDay);
+ }
+
+ public DateTime AddSeconds (double seconds)
+ {
+ return AddMilliseconds (seconds*1000);
+ }
+
+ public DateTime AddYears (int years )
+ {
+ return AddMonths(years * 12);
+ }
+
+ public static int Compare (DateTime t1, DateTime t2)
+ {
+ if (t1.ticks < t2.ticks)
+ return -1;
+ else if (t1.ticks > t2.ticks)
+ return 1;
+ else
+ return 0;
+ }
+
+ public int CompareTo (object v)
+ {
+ if ( v == null)
+ return 1;
+
+ if (!(v is System.DateTime))
+ throw new ArgumentException (Locale.GetText (
+ "Value is not a System.DateTime"));
+
+ return Compare (this, (DateTime) v);
+ }
+
+ public static int DaysInMonth (int year, int month)
+ {
+ int[] days ;
+
+ if (month < 1 || month >12)
+ throw new ArgumentOutOfRangeException ();
+
+ days = (IsLeapYear(year) ? daysmonthleap : daysmonth);
+ return days[month];
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.DateTime))
+ return false;
+
+ return ((DateTime) o).ticks == ticks;
+ }
+
+ public static bool Equals (DateTime t1, DateTime t2 )
+ {
+ return (t1.ticks == t2.ticks );
+ }
+
+ public static DateTime FromFileTime (long fileTime)
+ {
+ return new DateTime (w32file_epoch + fileTime);
+ }
+
+ // TODO: Implement me.
+ [MonoTODO]
+ public static DateTime FromOADate (double d)
+ {
+ return new DateTime(0);
+ }
+
+ // TODO: Implement me.
+ [MonoTODO]
+ public string[] GetDateTimeFormats()
+ {
+ return null;
+ }
+
+ //TODO: implement me
+ [MonoTODO]
+ public string[] GetDateTimeFormats(char format)
+ {
+ return null;
+ }
+
+ // TODO: implement me
+ [MonoTODO]
+ public string[] GetDateTimeFormats(IFormatProvider provider)
+ {
+ return null;
+ }
+
+ //TODO: implement me
+ [MonoTODO]
+ public string[] GetDateTimeFormats(char format,IFormatProvider provider )
+ {
+ return null;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) ticks.Ticks;
+ }
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.DateTime;
+ }
+
+ public static bool IsLeapYear (int year)
+ {
+ return ( (year % 4 == 0 && year % 100 != 0) || year % 400 == 0) ;
+ }
+
+ public static DateTime Parse (string s)
+ {
+ return Parse (s, null);
+ }
+
+ public static DateTime Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, null, DateTimeStyles.AllowWhiteSpaces);
+ }
+
+ public static DateTime Parse (string s, IFormatProvider fp, DateTimeStyles styles)
+ {
+ string[] formats = {
+ // Full date and time
+ "F", "G", "r", "s", "u", "U",
+ // Full date and time, but no seconds
+ "f", "g",
+ // Only date
+ "d", "D",
+ // Only time
+ "T", "t",
+ // Only date, but no year
+ "m", "M",
+ // Only date, but no day
+ "y", "Y"
+ };
+
+ return ParseExact (s, formats, fp, styles);
+ }
+
+ public static DateTime ParseExact (string s, string format, IFormatProvider fp)
+ {
+ return ParseExact (s, format, fp, DateTimeStyles.None);
+ }
+
+ internal static int _ParseNumber (string s, int digits, bool leadingzero,
+ bool sloppy_parsing, out int num_parsed)
+ {
+ int number = 0, i;
+
+ if (sloppy_parsing)
+ leadingzero = false;
+
+ if (!leadingzero) {
+ int real_digits = 0;
+ for (i = 0; i < digits; i++) {
+ if ((i >= s.Length) || !Char.IsDigit (s[i]))
+ break;
+
+ real_digits++;
+ }
+
+ digits = real_digits;
+ }
+
+ if (s.Length < digits) {
+ num_parsed = -1;
+ return 0;
+ }
+
+ for (i = 0; i < digits; i++) {
+ char c = s[i];
+ if (!Char.IsDigit (c)) {
+ num_parsed = -1;
+ return 0;
+ }
+
+ number = number * 10 + (byte) (c - '0');
+ }
+
+ num_parsed = digits;
+ return number;
+ }
+
+ internal static int _ParseEnum (string s, string[] values, out int num_parsed)
+ {
+ int i;
+
+ for (i = 0; i < values.Length; i++) {
+ if (s.Length < values[i].Length)
+ continue;
+ String tmp = s.Substring (0, values[i].Length);
+ if (String.Compare (tmp, values[i], true) == 0) {
+ num_parsed = values[i].Length;
+ return i;
+ }
+ }
+
+ num_parsed = -1;
+ return -1;
+ }
+
+ internal static bool _ParseString (string s, int maxlength, string value, out int num_parsed)
+ {
+ if (maxlength > 0)
+ value = value.Substring (0, maxlength);
+
+ s = s.Substring (0, value.Length);
+
+ if (String.Compare (s, value, true) == 0) {
+ num_parsed = value.Length;
+ return true;
+ }
+
+ num_parsed = -1;
+ return false;
+ }
+
+ internal static bool _DoParse (string s, string format, bool exact,
+ out DateTime result,
+ DateTimeFormatInfo dfi,
+ DateTimeStyles style)
+ {
+ bool useutc = false, use_localtime = true;
+ bool sloppy_parsing = false;
+
+ if (format.Length == 1)
+ format = _GetStandardPattern (format[0], dfi, out useutc);
+
+ if ((style & DateTimeStyles.AllowLeadingWhite) != 0) {
+ format = format.TrimStart (null);
+ s = s.TrimStart (null);
+ }
+
+ if ((style & DateTimeStyles.AllowTrailingWhite) != 0) {
+ format = format.TrimEnd (null);
+ s = s.TrimEnd (null);
+ }
+
+ if ((style & DateTimeStyles.AllowInnerWhite) != 0)
+ sloppy_parsing = true;
+
+ char[] chars = format.ToCharArray ();
+ int len = format.Length, pos = 0, num = 0;
+
+ int day = -1, dayofweek = -1, month = -1, year = -1;
+ int hour = -1, minute = -1, second = -1, millisecond = -1;
+ int ampm = -1, century = (Now.Year / 100) * 100;
+ int tzsign = -1, tzoffset = -1, tzoffmin = -1;
+
+ result = new DateTime (0);
+
+ while (pos+num < len)
+ {
+ if (s.Length == 0)
+ return false;
+
+ if (Char.IsWhiteSpace (s[0])) {
+ s = s.Substring (1);
+
+ if (Char.IsWhiteSpace (chars[pos])) {
+ pos++;
+ continue;
+ }
+
+ if ((style & DateTimeStyles.AllowInnerWhite) == 0)
+ return false;
+ }
+
+ if (chars[pos] == '\'') {
+ num = 1;
+ while (pos+num < len) {
+ if (chars[pos+num] == '\'')
+ break;
+
+ if (s.Length == 0)
+ return false;
+ if (s[0] != chars[pos+num])
+ return false;
+ s = s.Substring (1);
+
+ num++;
+ }
+ if (pos+num > len)
+ return false;
+
+ pos += num + 1;
+ num = 0;
+ continue;
+ } else if (chars[pos] == '\\') {
+ if (pos+1 >= len)
+ return false;
+
+ if (s[0] != chars[pos+num])
+ return false;
+ s = s.Substring (1);
+ if (s.Length == 0)
+ return false;
+
+ pos++;
+ continue;
+ } else if (chars[pos] == '%') {
+ pos++;
+ continue;
+ }
+
+ if ((pos+num+1 < len) && (chars[pos+num+1] == chars[pos+num])) {
+ num++;
+ continue;
+ }
+
+ int num_parsed = 0;
+
+ switch (chars[pos])
+ {
+ case 'd':
+ if (day != -1)
+ return false;
+ if (num == 0)
+ day = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else if (num == 1)
+ day = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ else if (num == 2)
+ dayofweek = _ParseEnum (s, dfi.AbbreviatedDayNames, out num_parsed);
+ else
+ {
+ dayofweek = _ParseEnum (s, dfi.DayNames, out num_parsed);
+ num = 3;
+ }
+ break;
+ case 'M':
+ if (month != -1)
+ return false;
+ if (num == 0)
+ month = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else if (num == 1)
+ month = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ else if (num == 2)
+ month = _ParseEnum (s, dfi.AbbreviatedMonthNames , out num_parsed) + 1;
+ else
+ {
+ month = _ParseEnum (s, dfi.MonthNames, out num_parsed) + 1;
+ num = 3;
+ }
+ if ((month < 1) || (month > 12))
+ return false;
+ break;
+ case 'y':
+ if (year != -1)
+ return false;
+ if (num == 0)
+ year = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed) + century;
+ else if (num < 3)
+ year = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed) + century;
+ else
+ {
+ year = _ParseNumber (s, 4, false, sloppy_parsing, out num_parsed);
+ num = 3;
+ }
+ break;
+ case 'h':
+ if (hour != -1)
+ return false;
+ if (num == 0)
+ hour = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else
+ {
+ hour = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ num = 1;
+ }
+ if (hour >= 12)
+ return false;
+ break;
+ case 'H':
+ if ((hour != -1) || (ampm >= 0))
+ return false;
+ if (num == 0)
+ hour = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else
+ {
+ hour = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ num = 1;
+ }
+ if (hour >= 24)
+ return false;
+ ampm = -2;
+ break;
+ case 'm':
+ if (minute != -1)
+ return false;
+ if (num == 0)
+ minute = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else
+ {
+ minute = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ num = 1;
+ }
+ if (minute >= 60)
+ return false;
+ break;
+ case 's':
+ if (second != -1)
+ return false;
+ if (num == 0)
+ second = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else
+ {
+ second = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ num = 1;
+ }
+ if (second >= 60)
+ return false;
+ break;
+ case 'f':
+ if (millisecond != -1)
+ return false;
+ num = Math.Min (num, 6);
+ millisecond = _ParseNumber (s, num+1, true, sloppy_parsing, out num_parsed);
+ break;
+ case 't':
+ if (ampm != -1)
+ return false;
+ if (num == 0)
+ {
+ if (_ParseString (s, 1, dfi.AMDesignator, out num_parsed))
+ ampm = 0;
+ else if (_ParseString (s, 1, dfi.PMDesignator, out num_parsed))
+ ampm = 1;
+ else
+ return false;
+ }
+ else
+ {
+ if (_ParseString (s, 0, dfi.AMDesignator, out num_parsed))
+ ampm = 0;
+ else if (_ParseString (s, 0, dfi.PMDesignator, out num_parsed))
+ ampm = 1;
+ else
+ return false;
+ num = 1;
+ }
+ break;
+ case 'z':
+ if (tzsign != -1)
+ return false;
+ if (s[0] == '+')
+ tzsign = 0;
+ else if (s[0] == '-')
+ tzsign = 1;
+ else
+ return false;
+ s = s.Substring (1);
+ if (num == 0)
+ tzoffset = _ParseNumber (s, 2, false, sloppy_parsing, out num_parsed);
+ else if (num == 1)
+ tzoffset = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ else
+ {
+ tzoffset = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ if (num_parsed < 0)
+ return false;
+ s = s.Substring (num_parsed);
+ if (!_ParseString (s, 0, dfi.TimeSeparator, out num_parsed))
+ return false;
+ s = s.Substring (num_parsed);
+ tzoffmin = _ParseNumber (s, 2, true, sloppy_parsing, out num_parsed);
+ if (num_parsed < 0)
+ return false;
+ num = 2;
+ }
+ break;
+ case ':':
+ if (!_ParseString (s, 0, dfi.TimeSeparator, out num_parsed))
+ return false;
+ break;
+ case '/':
+ if (!_ParseString (s, 0, dfi.DateSeparator, out num_parsed))
+ return false;
+ break;
+ default:
+ if (s[0] != chars[pos])
+ return false;
+ num = 0;
+ num_parsed = 1;
+ break;
+ }
+
+ if (num_parsed < 0)
+ return false;
+
+ s = s.Substring (num_parsed);
+
+ pos = pos + num + 1;
+ num = 0;
+ }
+
+ if (hour == -1)
+ hour = 0;
+ if (minute == -1)
+ minute = 0;
+ if (second == -1)
+ second = 0;
+ if (millisecond == -1)
+ millisecond = 0;
+
+ // If no date was given
+ if ((day == -1) && (month == -1) && (year == -1)) {
+ if ((style & DateTimeStyles.NoCurrentDateDefault) != 0) {
+ day = 1;
+ month = 1;
+ year = 1;
+ } else {
+ day = Today.Day;
+ month = Today.Month;
+ year = Today.Year;
+ }
+ }
+
+ if (day == -1)
+ day = 1;
+ if (month == -1)
+ month = 1;
+ if (year == -1) {
+ if ((style & DateTimeStyles.NoCurrentDateDefault) != 0)
+ year = 1;
+ else
+ year = Today.Year;
+ }
+
+ if (ampm == 1)
+ hour = hour + 12;
+
+ result = new DateTime (year, month, day, hour, minute, second, millisecond);
+
+ if ((dayofweek != -1) && (dayofweek != (int) result.DayOfWeek))
+ throw new FormatException (Locale.GetText ("String was not recognized as valid DateTime because the day of week was incorrect."));
+
+ // If no timezone was specified, default to the local timezone.
+ TimeSpan utcoffset;
+ if (useutc)
+ utcoffset = new TimeSpan (0, 0, 0);
+ else if (tzsign == -1) {
+ TimeZone tz = TimeZone.CurrentTimeZone;
+ utcoffset = tz.GetUtcOffset (result);
+ } else {
+ if ((style & DateTimeStyles.AdjustToUniversal) != 0)
+ use_localtime = false;
+
+ if (tzoffmin == -1)
+ tzoffmin = 0;
+ if (tzoffset == -1)
+ tzoffset = 0;
+ if (tzsign == 1)
+ tzoffset = -tzoffset;
+
+ utcoffset = new TimeSpan (tzoffset, tzoffmin, 0);
+ }
+
+ long newticks = (result.ticks - utcoffset).Ticks;
+
+ result = new DateTime (use_localtime, newticks);
+
+ return true;
+ }
+
+
+ public static DateTime ParseExact (string s, string format,
+ IFormatProvider fp, DateTimeStyles style)
+ {
+ string[] formats;
+
+ formats = new string [1];
+ formats[0] = format;
+
+ return ParseExact (s, formats, fp, style);
+ }
+
+ public static DateTime ParseExact (string s, string[] formats,
+ IFormatProvider fp,
+ DateTimeStyles style)
+ {
+ DateTimeFormatInfo dfi = DateTimeFormatInfo.GetInstance (fp);
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+ if (formats.Length == 0)
+ throw new ArgumentNullException (Locale.GetText ("format is null"));
+
+ int i;
+ for (i = 0; i < formats.Length; i++)
+ {
+ DateTime result;
+
+ if (_DoParse (s, formats[i], true, out result, dfi, style))
+ return result;
+ }
+
+ throw new FormatException ();
+ }
+
+ public TimeSpan Subtract(DateTime dt)
+ {
+ return new TimeSpan(ticks.Ticks) - dt.ticks;
+ }
+
+ public DateTime Subtract(TimeSpan ts)
+ {
+ TimeSpan newticks;
+
+ newticks = (new TimeSpan (ticks.Ticks)) - ts;
+ return new DateTime(true,newticks);
+ }
+
+ public long ToFileTime()
+ {
+ if(ticks.Ticks < w32file_epoch) {
+ throw new ArgumentOutOfRangeException("file time is not valid");
+ }
+
+ return(ticks.Ticks - w32file_epoch);
+ }
+
+ public string ToLongDateString()
+ {
+ return ToString ("D");
+ }
+
+ public string ToLongTimeString()
+ {
+ return ToString ("T");
+ }
+
+ [MonoTODO]
+ public double ToOADate()
+ {
+ // TODO implement me
+ return 0;
+ }
+
+ public string ToShortDateString()
+ {
+ return ToString ("d");
+ }
+
+ public string ToShortTimeString()
+ {
+ return ToString ("t");
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ internal static string _GetStandardPattern (char format, DateTimeFormatInfo dfi, out bool useutc)
+ {
+ String pattern;
+
+ useutc = false;
+
+ switch (format)
+ {
+ case 'd':
+ pattern = dfi.ShortDatePattern;
+ break;
+ case 'D':
+ pattern = dfi.LongDatePattern;
+ break;
+ case 'f':
+ pattern = dfi.LongDatePattern + " " + dfi.ShortTimePattern;
+ break;
+ case 'F':
+ pattern = dfi.FullDateTimePattern;
+ break;
+ case 'g':
+ pattern = dfi.ShortDatePattern + " " + dfi.ShortTimePattern;
+ break;
+ case 'G':
+ pattern = dfi.ShortDatePattern + " " + dfi.LongTimePattern;
+ break;
+ case 'm':
+ case 'M':
+ pattern = dfi.MonthDayPattern;
+ break;
+ case 'r':
+ case 'R':
+ pattern = dfi.RFC1123Pattern;
+ useutc= true;
+ break;
+ case 's':
+ pattern = dfi.SortableDateTimePattern;
+ break;
+ case 't':
+ pattern = dfi.ShortTimePattern;
+ break;
+ case 'T':
+ pattern = dfi.LongTimePattern;
+ break;
+ case 'u':
+ pattern = dfi.UniversalSortableDateTimePattern;
+ useutc = true;
+ break;
+ case 'U':
+ pattern = dfi.LongDatePattern + " " + dfi.LongTimePattern;
+ useutc = true;
+ break;
+ case 'y':
+ case 'Y':
+ pattern = dfi.YearMonthPattern;
+ break;
+ default:
+ pattern = null;
+ break;
+ }
+
+ return pattern;
+ }
+
+ internal string _ToString (string format, DateTimeFormatInfo dfi)
+ {
+ String str = null, result = null;
+ char[] chars = format.ToCharArray ();
+ int len = format.Length, pos = 0, num = 0;
+
+ TimeZone tz = TimeZone.CurrentTimeZone;
+ TimeSpan utcoffset = tz.GetUtcOffset (this);
+
+ while (pos < len)
+ {
+ if (chars[pos] == '\'') {
+ num = 1;
+ while (pos+num <= len) {
+ if (chars[pos+num] == '\'')
+ break;
+
+ result += chars[pos+num];
+ num++;
+ }
+ if (pos+num > len)
+ throw new FormatException (Locale.GetText ("The specified format is invalid"));
+
+ pos += num+1;
+ num = 0;
+ continue;
+ } else if (chars[pos] == '\\') {
+ if (pos+1 >= len)
+ throw new FormatException (Locale.GetText ("The specified format is invalid"));
+
+ result += chars[pos+1];
+ pos += 2;
+ continue;
+ } else if (chars[pos] == '%') {
+ pos++;
+ continue;
+ }
+
+ if ((pos+num+1 < len) && (chars[pos+num+1] == chars[pos+num])) {
+ num++;
+ continue;
+ }
+
+ switch (chars[pos])
+ {
+ case 'd':
+ if (num == 0)
+ str = Day.ToString ("d");
+ else if (num == 1)
+ str = Day.ToString ("d02");
+ else if (num == 2)
+ str = dfi.GetAbbreviatedDayName (DayOfWeek);
+ else {
+ str = dfi.GetDayName (DayOfWeek);
+ num = 3;
+ }
+ break;
+ case 'M':
+ if (num == 0)
+ str = Month.ToString ("d");
+ else if (num == 1)
+ str = Month.ToString ("d02");
+ else if (num == 2)
+ str = dfi.GetAbbreviatedMonthName (Month);
+ else {
+ str = dfi.GetMonthName (Month);
+ num = 3;
+ }
+ break;
+ case 'y':
+ if (num == 0) {
+ int shortyear = Year % 100;
+ str = shortyear.ToString ("d");
+ } else if (num == 1) {
+ int shortyear = Year % 100;
+ str = shortyear.ToString ("d02");
+ } else {
+ str = Year.ToString ("d");
+ num = 3;
+ }
+ break;
+ case 'g':
+ // FIXME
+ break;
+ case 'f':
+ num = Math.Min (num, 6);
+
+ long ms = (long) Millisecond;
+ long exp = 10;
+ for (int i = 0; i < num; i++)
+ exp = exp * 10;
+ long maxexp = TimeSpan.TicksPerMillisecond;
+
+ exp = Math.Min (exp, maxexp);
+ ms = ms * exp / maxexp;
+
+ String prec = (num+1).ToString ("d02");
+ str = ms.ToString (String.Concat ("d", prec));
+
+ break;
+ case 'h':
+ if (num == 0) {
+ int shorthour = Hour % 12;
+ str = shorthour.ToString ("d");
+ } else {
+ int shorthour = Hour % 12;
+ str = shorthour.ToString ("d02");
+ num = 1;
+ }
+ break;
+ case 'H':
+ if (num == 0)
+ str = Hour.ToString ("d");
+ else {
+ str = Hour.ToString ("d02");
+ num = 1;
+ }
+ break;
+ case 'm':
+ if (num == 0)
+ str = Minute.ToString ("d");
+ else {
+ str = Minute.ToString ("d02");
+ num = 1;
+ }
+ break;
+ case 's':
+ if (num == 0)
+ str = Second.ToString ("d");
+ else {
+ str = Second.ToString ("d02");
+ num = 1;
+ }
+ break;
+ case 't':
+ if (Hour < 12)
+ str = dfi.AMDesignator;
+ else
+ str = dfi.PMDesignator;
+
+ if (num == 0)
+ str = str.Substring (0,1);
+ else
+ num = 1;
+ break;
+ case 'z':
+ if (num == 0) {
+ int offset = utcoffset.Hours;
+ str = offset.ToString ("d");
+ if (offset > 0)
+ str = String.Concat ("+", str);
+ } else if (num == 1) {
+ int offset = utcoffset.Hours;
+ str = offset.ToString ("d02");
+ if (offset > 0)
+ str = String.Concat ("+", str);
+ } else if (num == 2) {
+ int offhour = utcoffset.Hours;
+ int offminute = utcoffset.Minutes;
+ str = offhour.ToString ("d02");
+ str = String.Concat (str, dfi.TimeSeparator);
+ str = String.Concat (str, offminute.ToString ("d02"));
+ if (offhour > 0)
+ str = String.Concat ("+", str);
+ num = 2;
+ }
+ break;
+ case ':':
+ str = dfi.TimeSeparator;
+ num = 0;
+ break;
+ case '/':
+ str = dfi.DateSeparator;
+ num = 0;
+ break;
+ default:
+ str = String.Concat (chars [pos]);
+ num = 0;
+ break;
+ }
+
+ result = String.Concat (result, str);
+
+ pos += num + 1;
+ num = 0;
+ }
+
+ return result;
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ DateTimeFormatInfo dfi = DateTimeFormatInfo.GetInstance(fp);
+
+ if (format == null)
+ format = dfi.FullDateTimePattern;
+
+ bool useutc = false;
+
+ if (format.Length == 1) {
+ char fchar = (format.ToCharArray ())[0];
+ format = _GetStandardPattern (fchar, dfi, out useutc);
+ }
+
+ if (useutc)
+ return this.ToUniversalTime ()._ToString (format, dfi);
+ else
+ return this._ToString (format, dfi);
+ }
+
+ public DateTime ToLocalTime()
+ {
+ TimeZone tz = TimeZone.CurrentTimeZone;
+
+ TimeSpan offset = tz.GetUtcOffset (this);
+
+ return new DateTime (true, ticks + offset);
+ }
+
+ public DateTime ToUniversalTime()
+ {
+ TimeZone tz = TimeZone.CurrentTimeZone;
+
+ TimeSpan offset = tz.GetUtcOffset (this);
+
+ return new DateTime (true, ticks - offset);
+ }
+
+ /* OPERATORS */
+
+ public static DateTime operator +(DateTime d, TimeSpan t)
+ {
+ return new DateTime (true, d.ticks + t);
+ }
+
+ public static bool operator ==(DateTime d1, DateTime d2)
+ {
+ return (d1.ticks == d2.ticks);
+ }
+
+ public static bool operator >(DateTime t1,DateTime t2)
+ {
+ return (t1.ticks > t2.ticks);
+ }
+
+ public static bool operator >=(DateTime t1,DateTime t2)
+ {
+ return (t1.ticks >= t2.ticks);
+ }
+
+ public static bool operator !=(DateTime d1, DateTime d2)
+ {
+ return (d1.ticks != d2.ticks);
+ }
+
+ public static bool operator <(DateTime t1, DateTime t2)
+ {
+ return (t1.ticks < t2.ticks );
+ }
+
+ public static bool operator <=(DateTime t1,DateTime t2)
+ {
+ return (t1.ticks <= t2.ticks);
+ }
+
+ public static TimeSpan operator -(DateTime d1,DateTime d2)
+ {
+ return new TimeSpan((d1.ticks - d2.ticks).Ticks);
+ }
+
+ public static DateTime operator -(DateTime d,TimeSpan t)
+ {
+ return new DateTime (true, d.ticks - t);
+ }
+
+ public bool ToBoolean(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public byte ToByte(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public char ToChar(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ // TODO Implement me
+ [MonoTODO]
+ public System.DateTime ToDateTime(IFormatProvider provider)
+ {
+ return new System.DateTime(true,this.ticks);
+ }
+
+ public decimal ToDecimal(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public double ToDouble(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public Int16 ToInt16(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public Int32 ToInt32(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public Int64 ToInt64(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ [CLSCompliant(false)]
+ public SByte ToSByte(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public Single ToSingle(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public object ToType(Type conversionType,IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ UInt16 System.IConvertible.ToUInt16(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ [CLSCompliant(false)]
+ public UInt32 ToUInt32(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ [CLSCompliant(false)]
+ public UInt64 ToUInt64(IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+ }
+}
+
+namespace System
+{
+ public enum DayOfWeek
+ {
+ Sunday,
+ Monday,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday
+ }
+}
diff --git a/mcs/class/corlib/System/Decimal.cs b/mcs/class/corlib/System/Decimal.cs
new file mode 100644
index 00000000000..f286420c054
--- /dev/null
+++ b/mcs/class/corlib/System/Decimal.cs
@@ -0,0 +1,1028 @@
+//
+// System.Decimal.cs
+//
+// Represents a floating-point decimal data type with up to 29
+// significant digits, suitable for financial and commercial calculations.
+//
+// Author:
+// Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) 2001 Martin Weindel
+//
+
+using System;
+using System.Globalization;
+using System.Text;
+using System.Runtime.CompilerServices;
+#if MSTEST
+using System.Runtime.InteropServices;
+#endif
+
+
+namespace System
+{
+ /// <summary>
+ /// Represents a floating-point decimal data type with up to 29 significant
+ /// digits, suitable for financial and commercial calculations
+ /// </summary>
+ [Serializable]
+ public struct Decimal: IComparable, IFormattable
+ {
+ public static readonly Decimal MinValue = new Decimal(-1, -1, -1, true, 0);
+ public static readonly Decimal MaxValue = new Decimal(-1, -1, -1, false, 0);
+ public static readonly Decimal MinusOne = new Decimal(1, 0, 0, true, 0);
+ public static readonly Decimal One = new Decimal(1, 0, 0, false, 0);
+ public static readonly Decimal Zero = new Decimal(0, 0, 0, false, 0);
+
+ // maximal decimal value as double
+ private static readonly double dDecMaxValue = 7.922816251426433759354395033e28;
+ // epsilon decimal value as double
+ private static readonly double dDecEpsilon = 0.5e-28; // == 0.5 * 1 / 10^28
+
+ // some constants
+ private const int DECIMAL_DIVIDE_BY_ZERO = 5;
+ private const uint MAX_SCALE = 28;
+ private const int iMAX_SCALE = 28;
+ private const uint SIGN_FLAG = 0x80000000;
+ private const uint SCALE_MASK = 0x00FF0000;
+ private const int SCALE_SHIFT = 16;
+ private const uint RESERVED_SS32_BITS = 0x7F00FFFF;
+
+ // internal representation of decimal
+ private uint ss32;
+ private uint hi32;
+ private uint lo32;
+ private uint mid32;
+
+ // LAMESPEC: this constructor is missing in specification
+ // but exists in MS Csharp implementation
+ public Decimal(int lo, int mid, int hi, bool isNegative, byte scale)
+ {
+ unchecked
+ {
+ lo32 = (uint) lo;
+ mid32 = (uint) mid;
+ hi32 = (uint) hi;
+
+ if (scale > MAX_SCALE)
+ {
+ throw new ArgumentOutOfRangeException (Locale.GetText ("scale must be between 0 and 28"));
+ }
+
+ ss32 = scale;
+ ss32 <<= SCALE_SHIFT;
+ if (isNegative) ss32 |= SIGN_FLAG;
+ }
+ }
+
+ public Decimal(int val)
+ {
+ unchecked
+ {
+ hi32 = mid32 = 0;
+ if (val < 0)
+ {
+ ss32 = SIGN_FLAG;
+ lo32 = ((uint)~val) + 1;
+ }
+ else
+ {
+ ss32 = 0;
+ lo32 = (uint) val;
+ }
+ }
+ }
+
+ [CLSCompliant(false)]
+ public Decimal(uint val)
+ {
+ lo32 = val;
+ ss32 = hi32 = mid32 = 0;
+ }
+
+ public Decimal(long val)
+ {
+ unchecked
+ {
+ hi32 = 0;
+ if (val < 0)
+ {
+ ss32 = SIGN_FLAG;
+ ulong u = ((ulong)~val) + 1;
+ lo32 = (uint)u;
+ mid32 = (uint)(u >> 32);
+ }
+ else
+ {
+ ss32 = 0;
+ ulong u = (ulong)val;
+ lo32 = (uint)u;
+ mid32 = (uint)(u >> 32);
+ }
+ }
+ }
+
+ [CLSCompliant(false)]
+ public Decimal(ulong uval)
+ {
+ unchecked
+ {
+ ss32 = hi32 = 0;
+ lo32 = (uint)uval;
+ mid32 = (uint)(uval >> 32);
+ }
+ }
+
+ public Decimal(float val)
+ {
+ if (double2decimal(out this, val, 7) != 0)
+ {
+ throw new OverflowException();
+ }
+ }
+
+ public Decimal(double val)
+ {
+ if (double2decimal(out this, val, 15) != 0)
+ {
+ throw new OverflowException();
+ }
+ }
+
+ public Decimal(int[] bits)
+ {
+ if (bits == null)
+ {
+ throw new ArgumentNullException(Locale.GetText ("Bits is a null reference"));
+ }
+
+ if (bits.GetLength(0) != 4)
+ {
+ throw new ArgumentException(Locale.GetText ("bits does not contain four values"));
+ }
+
+ unchecked {
+ lo32 = (uint) bits[0];
+ mid32 = (uint) bits[1];
+ hi32 = (uint) bits[2];
+ ss32 = (uint) bits[3];
+ byte scale = (byte)(ss32 >> SCALE_SHIFT);
+ if (scale > MAX_SCALE || (ss32 & RESERVED_SS32_BITS) != 0)
+ {
+ throw new ArgumentException(Locale.GetText ("Invalid bits[3]"));
+ }
+ }
+ }
+
+ public static int[] GetBits(Decimal d)
+ {
+ unchecked
+ {
+ return new int[] { (int)d.lo32, (int)d.mid32, (int)d.hi32,
+ (int)d.ss32 };
+ }
+ }
+
+ public static Decimal Negate(Decimal d)
+ {
+ d.ss32 ^= SIGN_FLAG;
+ return d;
+ }
+
+
+ public static Decimal Add(Decimal d1, Decimal d2)
+ {
+ if (decimalIncr(ref d1, ref d2) == 0)
+ return d1;
+ else
+ throw new OverflowException(Locale.GetText ("Overflow on adding decimal number"));
+ }
+
+ public static Decimal Subtract(Decimal d1, Decimal d2)
+ {
+ d2.ss32 ^= SIGN_FLAG;
+ int result = decimalIncr(ref d1, ref d2);
+ if (result == 0)
+ return d1;
+ else
+ throw new OverflowException(Locale.GetText ("Overflow on subtracting decimal numbers ("+result+")"));
+ }
+
+ public override int GetHashCode()
+ {
+ return (int)lo32;
+ }
+
+ public static Decimal operator +(Decimal d1, Decimal d2)
+ {
+ return Add(d1, d2);
+ }
+
+ public static Decimal operator --(Decimal d)
+ {
+ return Add(d, MinusOne);
+ }
+
+ public static Decimal operator ++(Decimal d)
+ {
+ return Add(d, One);
+ }
+
+ public static Decimal operator -(Decimal d1, Decimal d2)
+ {
+ return Subtract(d1, d2);
+ }
+
+ public static Decimal operator -(Decimal d)
+ {
+ return Negate(d);
+ }
+
+ public static Decimal operator +(Decimal d)
+ {
+ return d;
+ }
+
+ public static Decimal operator *(Decimal d1, Decimal d2)
+ {
+ return Multiply(d1, d2);
+ }
+
+ public static Decimal operator /(Decimal d1, Decimal d2)
+ {
+ return Divide(d1, d2);
+ }
+
+ public static Decimal operator %(Decimal d1, Decimal d2)
+ {
+ return Remainder(d1, d2);
+ }
+
+ public static explicit operator byte(Decimal val)
+ {
+ ulong result;
+
+ if (decimal2UInt64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > Byte.MaxValue || result < Byte.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (byte) result;
+ }
+
+ [CLSCompliant(false)]
+ public static explicit operator sbyte(Decimal val)
+ {
+ long result;
+
+ if (decimal2Int64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > SByte.MaxValue || result < SByte.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (sbyte) result;
+ }
+
+ public static explicit operator char(Decimal val)
+ {
+ ulong result;
+
+ if (decimal2UInt64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > Char.MaxValue || result < Char.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (char) result;
+ }
+
+ public static explicit operator short(Decimal val)
+ {
+ long result;
+
+ if (decimal2Int64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > Int16.MaxValue || result < Int16.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (short) result;
+ }
+
+ [CLSCompliant(false)]
+ public static explicit operator ushort(Decimal val)
+ {
+ ulong result;
+
+ if (decimal2UInt64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > UInt16.MaxValue || result < UInt16.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (ushort) result;
+ }
+
+ public static explicit operator int(Decimal val)
+ {
+ long result;
+
+ if (decimal2Int64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > Int32.MaxValue || result < Int32.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (int) result;
+ }
+
+ [CLSCompliant(false)]
+ public static explicit operator uint(Decimal val)
+ {
+ ulong result;
+
+ if (decimal2UInt64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ if (result > UInt32.MaxValue || result < UInt32.MinValue)
+ {
+ throw new System.OverflowException();
+ }
+
+ return (uint) result;
+ }
+
+ public static explicit operator long(Decimal val)
+ {
+ long result;
+
+ if (decimal2Int64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ return result;
+ }
+
+ [CLSCompliant(false)]
+ public static explicit operator ulong(Decimal val)
+ {
+ ulong result;
+
+ if (decimal2UInt64(ref val, out result) != 0)
+ {
+ throw new System.OverflowException();
+ }
+
+ return result;
+ }
+
+ public static implicit operator Decimal(byte val)
+ {
+ return new Decimal(val);
+ }
+
+ [CLSCompliant(false)]
+ public static implicit operator Decimal(sbyte val)
+ {
+ return new Decimal(val);
+ }
+
+ public static implicit operator Decimal(short val)
+ {
+ return new Decimal(val);
+ }
+
+ [CLSCompliant(false)]
+ public static implicit operator Decimal(ushort val)
+ {
+ return new Decimal(val);
+ }
+
+ public static implicit operator Decimal(char val)
+ {
+ return new Decimal(val);
+ }
+
+ public static implicit operator Decimal(int val)
+ {
+ return new Decimal(val);
+ }
+
+ [CLSCompliant(false)]
+ public static implicit operator Decimal(uint val)
+ {
+ return new Decimal(val);
+ }
+
+ public static implicit operator Decimal(long val)
+ {
+ return new Decimal(val);
+ }
+
+ [CLSCompliant(false)]
+ public static implicit operator Decimal(ulong val)
+ {
+ return new Decimal(val);
+ }
+
+ public static explicit operator Decimal(float val)
+ {
+ return new Decimal(val);
+ }
+
+ public static explicit operator Decimal(double val)
+ {
+ return new Decimal(val);
+ }
+
+ public static explicit operator float(Decimal val)
+ {
+ return (float) (double) val;
+ }
+
+ public static explicit operator double(Decimal val)
+ {
+ return decimal2double(ref val);
+ }
+
+
+ public static bool operator !=(Decimal d1, Decimal d2)
+ {
+ return !Equals(d1, d2);
+ }
+
+ public static bool operator ==(Decimal d1, Decimal d2)
+ {
+ return Equals(d1, d2);
+ }
+
+ public static bool operator >(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2) > 0;
+ }
+
+ public static bool operator >=(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2) >= 0;
+ }
+
+ public static bool operator <(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2) < 0;
+ }
+
+ public static bool operator <=(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2) <= 0;
+ }
+
+ public static bool Equals(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2) == 0;
+ }
+
+ public override bool Equals(object o)
+ {
+ if (!(o is Decimal))
+ return false;
+
+ return Equals((Decimal) o, this);
+ }
+
+ public static Decimal Floor(Decimal d)
+ {
+ decimalFloorAndTrunc(ref d, 1);
+ return d;
+ }
+
+ public static Decimal Truncate(Decimal d)
+ {
+ decimalFloorAndTrunc(ref d, 0);
+ return d;
+ }
+
+ public static Decimal Round(Decimal d, int decimals)
+ {
+ if (decimals < 0 || decimals > iMAX_SCALE)
+ {
+ throw new ArgumentOutOfRangeException(Locale.GetText ("decimals must be between 0 and 28"));
+ }
+
+ decimalRound(ref d, decimals);
+ return d;
+ }
+
+ public static Decimal Multiply(Decimal d1, Decimal d2)
+ {
+ if (decimalMult(ref d1, ref d2) != 0)
+ {
+ throw new OverflowException();
+ }
+
+ return d1;
+ }
+
+ public static Decimal Divide(Decimal d1, Decimal d2)
+ {
+ Decimal d3;
+ int rc = decimalDiv(out d3, ref d1, ref d2);
+
+ if (rc != 0)
+ {
+ if (rc == DECIMAL_DIVIDE_BY_ZERO)
+ throw new DivideByZeroException();
+ else
+ throw new OverflowException();
+ }
+
+ return d3;
+ }
+
+ public static Decimal Remainder(Decimal d1, Decimal d2)
+ {
+ Decimal d3;
+ int rc = decimalIntDiv(out d3, ref d1, ref d2);
+
+ if (rc != 0)
+ {
+ if (rc == DECIMAL_DIVIDE_BY_ZERO)
+ throw new DivideByZeroException();
+ else
+ throw new OverflowException();
+ }
+
+ return d1 - d3 * d2;
+ }
+
+ public static int Compare(Decimal d1, Decimal d2)
+ {
+ return decimalCompare(ref d1, ref d2);
+ }
+
+ public int CompareTo(object val)
+ {
+ if (val == null)
+ return 1;
+
+ if (!(val is Decimal))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Decimal"));
+
+ Decimal d2 = (Decimal)val;
+ return decimalCompare(ref this, ref d2);
+ }
+
+ public static Decimal Parse(string s)
+ {
+ return Parse(s, NumberStyles.Number, null);
+ }
+
+ public static Decimal Parse(string s, NumberStyles style)
+ {
+ return Parse(s, style, null);
+ }
+
+ public static Decimal Parse(string s, IFormatProvider provider)
+ {
+ return Parse(s, NumberStyles.Number, provider);
+ }
+
+ private static NumberFormatInfo GetNumberFormatInfoFromIFormatProvider(IFormatProvider provider)
+ {
+ NumberFormatInfo nfi = null;
+
+ if (provider != null)
+ {
+ nfi = (NumberFormatInfo) provider.GetFormat(typeof(System.Decimal));
+ if (nfi == null && provider is NumberFormatInfo)
+ {
+ nfi = (NumberFormatInfo) provider;
+ }
+ }
+
+ if (nfi == null)
+ {
+ nfi = NumberFormatInfo.CurrentInfo;
+ }
+
+ return nfi;
+ }
+
+ private static string stripStyles(string s, NumberStyles style, NumberFormatInfo nfi,
+ out int decPos, out bool isNegative, out bool expFlag, out int exp)
+ {
+ string invalidChar = Locale.GetText ("Invalid character at position ");
+ string invalidExponent = Locale.GetText ("Invalid exponent");
+ isNegative = false;
+ expFlag = false;
+ exp = 0;
+ decPos = -1;
+
+ bool hasSign = false;
+ bool hasOpeningParentheses = false;
+ bool hasDecimalPoint = false;
+ bool allowedLeadingWhiteSpace = ((style & NumberStyles.AllowLeadingWhite) != 0);
+ bool allowedTrailingWhiteSpace = ((style & NumberStyles.AllowTrailingWhite) != 0);
+ bool allowedLeadingSign = ((style & NumberStyles.AllowLeadingSign) != 0);
+ bool allowedTrailingSign = ((style & NumberStyles.AllowTrailingSign) != 0);
+ bool allowedParentheses = ((style & NumberStyles.AllowParentheses) != 0);
+ bool allowedThousands = ((style & NumberStyles.AllowThousands) != 0);
+ bool allowedDecimalPoint = ((style & NumberStyles.AllowDecimalPoint) != 0);
+ bool allowedExponent = ((style & NumberStyles.AllowExponent) != 0);
+
+ /* get rid of currency symbol */
+ bool hasCurrency = false;
+ if ((style & NumberStyles.AllowCurrencySymbol) != 0)
+ {
+ int index = s.IndexOf(nfi.CurrencySymbol);
+ if (index >= 0)
+ {
+ s = s.Remove(index, nfi.CurrencySymbol.Length);
+ hasCurrency = true;
+ }
+ }
+
+ string decimalSep = (hasCurrency) ? nfi.CurrencyDecimalSeparator : nfi.NumberDecimalSeparator;
+ string groupSep = (hasCurrency) ? nfi.CurrencyGroupSeparator : nfi.NumberGroupSeparator;
+
+ int pos = 0;
+ int len = s.Length;
+
+ StringBuilder sb = new StringBuilder(len);
+
+ // leading
+ while (pos < len)
+ {
+ char ch = s[pos];
+ if (Char.IsDigit(ch))
+ {
+ break; // end of leading
+ }
+ else if (allowedLeadingWhiteSpace && Char.IsWhiteSpace(ch))
+ {
+ pos++;
+ }
+ else if (allowedParentheses && ch == '(' && !hasSign && !hasOpeningParentheses)
+ {
+ hasOpeningParentheses = true;
+ hasSign = true;
+ isNegative = true;
+ pos++;
+ }
+ else if (allowedLeadingSign && ch == nfi.NegativeSign[0] && !hasSign)
+ {
+ int slen = nfi.NegativeSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.NegativeSign, pos, slen) == pos)
+ {
+ hasSign = true;
+ isNegative = true;
+ pos += slen;
+ }
+ }
+ else if (allowedLeadingSign && ch == nfi.PositiveSign[0] && !hasSign)
+ {
+ int slen = nfi.PositiveSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.PositiveSign, pos, slen) == pos)
+ {
+ hasSign = true;
+ pos += slen;
+ }
+ }
+ else if (allowedDecimalPoint && ch == decimalSep[0])
+ {
+ int slen = decimalSep.Length;
+ if (slen != 1 && s.IndexOf(decimalSep, pos, slen) != pos)
+ {
+ throw new FormatException(invalidChar + pos);
+ }
+ break;
+ }
+ else
+ {
+ throw new FormatException(invalidChar + pos);
+ }
+ }
+
+ if (pos == len)
+ throw new FormatException(Locale.GetText ("No digits found"));
+
+ // digits
+ while (pos < len)
+ {
+ char ch = s[pos];
+ if (Char.IsDigit(ch))
+ {
+ sb.Append(ch);
+ pos++;
+ }
+ else if (allowedThousands && ch == groupSep[0])
+ {
+ int slen = groupSep.Length;
+ if (slen != 1 && s.IndexOf(groupSep, pos, slen) != pos)
+ {
+ throw new FormatException(invalidChar + pos);
+ }
+ pos += slen;
+ }
+ else if (allowedDecimalPoint && ch == decimalSep[0] && !hasDecimalPoint)
+ {
+ int slen = decimalSep.Length;
+ if (slen == 1 || s.IndexOf(decimalSep, pos, slen) == pos)
+ {
+ decPos = sb.Length;
+ hasDecimalPoint = true;
+ pos += slen;
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ // exponent
+ if (pos < len)
+ {
+ char ch = s[pos];
+ if (allowedExponent && Char.ToUpper(ch) == 'E')
+ {
+ expFlag = true;
+ pos++; if (pos >= len) throw new FormatException(invalidExponent);
+ ch = s[pos];
+ bool isNegativeExp = false;
+ if (ch == nfi.PositiveSign[0])
+ {
+ int slen = nfi.PositiveSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.PositiveSign, pos, slen) == pos)
+ {
+ pos += slen; if (pos >= len) throw new FormatException(invalidExponent);
+ }
+ }
+ else if (ch == nfi.NegativeSign[0])
+ {
+ int slen = nfi.NegativeSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.NegativeSign, pos, slen) == pos)
+ {
+ pos += slen; if (pos >= len) throw new FormatException(invalidExponent);
+ isNegativeExp = true;
+ }
+ }
+ ch = s[pos];
+ if (!Char.IsDigit(ch)) throw new FormatException(invalidExponent);
+ exp = ch - '0';
+ pos++;
+ while (pos < len && Char.IsDigit(s[pos]))
+ {
+ exp *= 10;
+ exp += s[pos] - '0';
+ pos++;
+ }
+ if (isNegativeExp) exp *= -1;
+ }
+ }
+
+ // trailing
+ while (pos < len)
+ {
+ char ch = s[pos];
+ if (allowedTrailingWhiteSpace && Char.IsWhiteSpace(ch))
+ {
+ pos++;
+ }
+ else if (allowedParentheses && ch == ')' && hasOpeningParentheses)
+ {
+ hasOpeningParentheses = false;
+ pos++;
+ }
+ else if (allowedTrailingSign && ch == nfi.NegativeSign[0] && !hasSign)
+ {
+ int slen = nfi.NegativeSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.NegativeSign, pos, slen) == pos)
+ {
+ hasSign = true;
+ isNegative = true;
+ pos += slen;
+ }
+ }
+ else if (allowedTrailingSign && ch == nfi.PositiveSign[0] && !hasSign)
+ {
+ int slen = nfi.PositiveSign.Length;
+ if (slen == 1 || s.IndexOf(nfi.PositiveSign, pos, slen) == pos)
+ {
+ hasSign = true;
+ pos += slen;
+ }
+ }
+ else
+ {
+ throw new FormatException(invalidChar + pos);
+ }
+ }
+
+ if (hasOpeningParentheses) throw new FormatException (
+ Locale.GetText ("Closing Parentheses not found"));
+
+ if (!hasDecimalPoint) decPos = sb.Length;
+
+ return sb.ToString();
+ }
+
+ public static Decimal Parse(string s, NumberStyles style, IFormatProvider provider)
+ {
+ NumberFormatInfo nfi = GetNumberFormatInfoFromIFormatProvider(provider);
+
+ if (s == null) throw new ArgumentNullException (Locale.GetText ("string s"));
+
+ int iDecPos, exp;
+ bool isNegative, expFlag;
+ s = stripStyles(s, style, nfi, out iDecPos, out isNegative, out expFlag, out exp);
+
+ if (iDecPos < 0)
+ throw new Exception (Locale.GetText ("Error in System.Decimal.Parse"));
+ uint decPos = (uint) iDecPos;
+
+ Decimal d;
+ int digits = s.Length;
+ int sign = (isNegative) ? 1 : 0;
+ if (string2decimal(out d, s, decPos, sign) != 0)
+ {
+ throw new OverflowException();
+ }
+
+ if (expFlag)
+ {
+ if (decimalSetExponent(ref d, exp) != 0)
+ throw new OverflowException();
+ }
+
+ return d;
+ }
+
+ public string ToString(string format, IFormatProvider provider)
+ {
+ NumberFormatInfo nfi = GetNumberFormatInfoFromIFormatProvider(provider);
+
+ if (format == null) format = "G";
+
+ return DecimalFormatter.NumberToString(format, nfi, this);
+ }
+
+ public override string ToString()
+ {
+ return ToString("G", null);
+ }
+
+ public string ToString(string format)
+ {
+ return ToString(format, null);
+ }
+
+ public string ToString(IFormatProvider provider)
+ {
+ return ToString("G", provider);
+ }
+
+#if !MSTEST
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimal2UInt64(ref Decimal val,
+ out ulong result);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimal2Int64(ref Decimal val,
+ out long result);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int double2decimal(out Decimal erg,
+ double val, int digits);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimalIncr(ref Decimal d1, ref Decimal d2);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern int decimal2string(ref Decimal val,
+ int digits, int decimals, char[] bufDigits, int bufSize, out int decPos, out int sign);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern int string2decimal(out Decimal val, String sDigits, uint decPos, int sign);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern int decimalSetExponent(ref Decimal val, int exp);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern double decimal2double(ref Decimal val);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void decimalFloorAndTrunc(ref Decimal val,
+ int floorFlag);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void decimalRound(ref Decimal val, int decimals);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimalMult(ref Decimal pd1, ref Decimal pd2);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimalDiv(out Decimal pc, ref Decimal pa, ref Decimal pb);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimalIntDiv(out Decimal pc, ref Decimal pa, ref Decimal pb);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern int decimalCompare(ref Decimal d1, ref Decimal d2);
+#else
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimal2UInt64")]
+ private static extern int decimal2UInt64(ref Decimal val,
+ out ulong result);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimal2Int64")]
+ private static extern int decimal2Int64(ref Decimal val,
+ out long result);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="double2decimal")]
+ private static extern int double2decimal(out Decimal erg,
+ double val, int digits);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalIncr")]
+ private static extern int decimalIncr(ref Decimal d1, ref Decimal d2);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimal2string")]
+ internal static extern int decimal2string(ref Decimal val,
+ int digits, int decimals,
+ [MarshalAs(UnmanagedType.LPWStr)]StringBuilder bufDigits,
+ int bufSize, out int decPos, out int sign);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="string2decimal")]
+ internal static extern int string2decimal(out Decimal val,
+ [MarshalAs(UnmanagedType.LPWStr)]String sDigits,
+ uint decPos, int sign);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalSetExponent")]
+ internal static extern int decimalSetExponent(ref Decimal val, int exp);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimal2double")]
+ private static extern double decimal2double(ref Decimal val);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalFloorAndTrunc")]
+ private static extern void decimalFloorAndTrunc(ref Decimal val,
+ int floorFlag);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalRound")]
+ private static extern void decimalRound(ref Decimal val, int decimals);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalMult")]
+ private static extern int decimalMult(ref Decimal pd1, ref Decimal pd2);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalDiv")]
+ private static extern int decimalDiv(out Decimal pc, ref Decimal pa, ref Decimal pb);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalIntDiv")]
+ private static extern int decimalIntDiv(out Decimal pc, ref Decimal pa, ref Decimal pb);
+
+ //![MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [DllImport("libdec", EntryPoint="decimalCompare")]
+ private static extern int decimalCompare(ref Decimal d1, ref Decimal d2);
+
+#endif
+ }
+}
diff --git a/mcs/class/corlib/System/DecimalFormatter.cs b/mcs/class/corlib/System/DecimalFormatter.cs
new file mode 100644
index 00000000000..4003b91adfa
--- /dev/null
+++ b/mcs/class/corlib/System/DecimalFormatter.cs
@@ -0,0 +1,389 @@
+//
+// System.DecimalFormatter.cs
+//
+// Author:
+// Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) Martin Weindel, Derek Holden dholden@draper.com
+//
+
+//
+// Internal class for formatting decimal numbers.
+
+using System.Globalization;
+using System.Text;
+using S = System; // only used for switching test implementation
+
+namespace System
+{
+
+ internal sealed class DecimalFormatter
+ {
+
+ private static bool ParseFormat (string format, out char specifier, out int precision)
+ {
+ precision = -1;
+ specifier = '\0';
+
+ int length = format.Length;
+ if (length < 1 || length > 3)
+ return false;
+
+ char[] chars = format.ToCharArray ();
+ specifier = Char.ToUpper(chars[0]);
+
+ if (length == 1)
+ return true;
+
+ if (length == 2)
+ {
+ if (chars[1] < '0' || chars[1] > '9')
+ return false;
+
+ precision = chars[1] - '0';
+ }
+ else
+ {
+ if (chars[1] < '0' || chars[2] < '0' || chars[1] > '9' || chars[2] > '9')
+ return false;
+
+ precision = (chars[1] - '0') * 10 + (chars[2] - '0');
+ }
+
+ return true;
+ }
+
+ public static string NumberToString(string format, NumberFormatInfo nfi, S.Decimal value)
+ {
+ char specifier;
+ int precision;
+ if (!DecimalFormatter.ParseFormat(format, out specifier, out precision))
+ {
+ throw new FormatException (Locale.GetText ("The specified format is invalid"));
+ }
+
+ int digits = -1;
+ int decimals = 0;
+ // first calculate number of digits or decimals needed for format
+ switch (specifier)
+ {
+ case 'C':
+ decimals = (precision >= 0) ? precision : nfi.CurrencyDecimalDigits;
+ break;
+ case 'F': goto case 'N';
+ case 'N':
+ decimals = (precision >= 0) ? precision : nfi.NumberDecimalDigits;
+ break;
+ case 'G':
+ digits = (precision >= 0) ? precision : 0;
+ break;
+ case 'E':
+ digits = (precision >= 0) ? precision+1 : 7;
+ break;
+ case 'P':
+ decimals = (precision >= 0) ? precision+2 : nfi.PercentDecimalDigits+2;
+ break;
+ case 'Z':
+ digits = 0;
+ break;
+ }
+
+ // get digit string
+ const int bufSize = 40;
+ int decPos = 0, sign = 0;
+#if !MSTEST
+ char[] buf = new char[bufSize];
+ if (S.Decimal.decimal2string(ref value, digits, decimals, buf, bufSize, out decPos, out sign) != 0)
+ {
+ throw new FormatException(); // should never happen
+ }
+
+ string TempString = new String(buf);
+ TempString = TempString.Trim(new char[] {(char)0x0});
+ StringBuilder sb = new StringBuilder(TempString, TempString.Length);
+#else
+ StringBuilder sb = new StringBuilder(bufSize);
+ if (S.Decimal.decimal2string(ref value, digits, decimals, sb, bufSize, out decPos, out sign) != 0)
+ {
+ throw new FormatException(); // should never happen
+ }
+#endif
+
+ if (sb.ToString () == String.Empty && decPos > 0 && sign == 0)
+ sb.Append ('0');
+
+ // now build the format
+ switch (specifier)
+ {
+ case 'C': return FormatCurrency(nfi, sb, decimals, decPos, sign);
+ case 'N': return FormatNumber(nfi, sb, decimals, decPos, sign);
+ case 'F': return FormatFixedPoint(nfi, sb, decimals, decPos, sign);
+ case 'G': return FormatGeneral(nfi, sb, digits, decPos, sign, format[0]);
+ case 'E': return FormatExponential(nfi, sb, digits, decPos, sign, format[0], true);
+ case 'P': return FormatPercent(nfi, sb, decimals, decPos, sign);
+ case 'Z': return FormatNormalized(nfi, sb, digits, decPos, sign);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format is invalid"));
+ }
+ }
+
+ private static string FormatFixedPoint(NumberFormatInfo nfi, StringBuilder sb,
+ int decimals, int decPos, int sign)
+ {
+ if (decimals > 0)
+ {
+ sb.Insert((decPos <= 0) ? 1 : decPos, nfi.NumberDecimalSeparator);
+ }
+
+ if (sign != 0)
+ {
+ sb.Insert(0, nfi.NegativeSign);
+ }
+
+ return sb.ToString();
+ }
+
+ private static string FormatExponential(NumberFormatInfo nfi, StringBuilder sb,
+ int digits, int decPos, int sign, char echar, bool exp3flag)
+ {
+ // insert decimal separator
+ if (digits > 1 || (digits == 0 && sb.Length > 1))
+ {
+ sb.Insert(1, nfi.NumberDecimalSeparator);
+ }
+
+ // insert sign
+ if (sign != 0)
+ {
+ sb.Insert(0, nfi.NegativeSign);
+ }
+
+ // append exponent
+ sb.Append(echar);
+ decPos--;
+ sb.Append((decPos >= 0) ? nfi.PositiveSign : nfi.NegativeSign);
+ if (decPos < 0) decPos *= -1;
+ if (exp3flag) sb.Append('0');
+ sb.Append((char)('0' + decPos/10));
+ sb.Append((char)('0' + decPos%10));
+
+ return sb.ToString();
+ }
+
+ private static string FormatGeneral(NumberFormatInfo nfi, StringBuilder sb,
+ int digits, int decPos, int sign, char gchar)
+ {
+ int dig = digits;
+ bool bFix = (digits == 0 && decPos >= -3) || (digits >= decPos && decPos >= -3 && digits != 0);
+
+ // remove trailing digits
+ while (sb.Length > 1 && (sb.Length > decPos || !bFix) && sb[sb.Length-1] == '0')
+ {
+ sb.Remove(sb.Length-1, 1);
+ if (dig != 0) dig--;
+ }
+
+ if (bFix)
+ {
+ while (decPos <= 0)
+ {
+ sb.Insert(0, '0');
+ if (dig != 0 && decPos != 0) dig++;
+ decPos++;
+ }
+ return FormatFixedPoint(nfi, sb, sb.Length - decPos, decPos, sign);
+ }
+ else
+ {
+ return FormatExponential(nfi, sb, dig, decPos, sign, (char)(gchar-2), false);
+ }
+ }
+
+ private static string FormatGroupAndDec(StringBuilder sb, int decimals, int decPos,
+ int[] groupSizes, string groupSeparator, string decSeparator)
+ {
+ int offset = 0;
+
+ // Groups
+ if (decPos > 0)
+ {
+ if (groupSizes != null)
+ {
+ int lastSize = 0;
+ int digitCount = 0;
+ for (int i = 0; i < groupSizes.GetLength(0); i++)
+ {
+ int size = groupSizes[i];
+ if (size > 0)
+ {
+ digitCount += size;
+ if (digitCount < decPos)
+ {
+ sb.Insert(decPos - digitCount, groupSeparator);
+ offset += groupSeparator.Length;
+ }
+ }
+ lastSize = size;
+ }
+
+ if (lastSize > 0)
+ {
+ while (true)
+ {
+ digitCount +=lastSize;
+ if (digitCount >= decPos) break;
+ sb.Insert(decPos - digitCount, groupSeparator);
+ offset += groupSeparator.Length;
+ }
+ }
+ }
+ }
+
+ if (decimals > 0)
+ {
+ sb.Insert(offset + ((decPos <= 0) ? 1 : decPos), decSeparator);
+ }
+
+ return sb.ToString();
+ }
+
+ private static string FormatNumber(NumberFormatInfo nfi, StringBuilder sb,
+ int decimals, int decPos, int sign)
+ {
+ string s = FormatGroupAndDec(sb, decimals, decPos,
+ nfi.NumberGroupSizes, nfi.NumberGroupSeparator, nfi.NumberDecimalSeparator);
+
+ // sign
+ if (sign != 0)
+ {
+ switch (nfi.NumberNegativePattern)
+ {
+ case 0:
+ return "(" + s + ")";
+ case 1:
+ return nfi.NegativeSign + s;
+ case 2:
+ return nfi.NegativeSign + " " + s;
+ case 3:
+ return s + nfi.NegativeSign;
+ case 4:
+ return s + " " + nfi.NegativeSign;
+ default:
+ throw new ArgumentException(Locale.GetText ("Invalid NumberNegativePattern"));
+ }
+ }
+ else
+ {
+ return s;
+ }
+ }
+
+ private static string FormatCurrency(NumberFormatInfo nfi, StringBuilder sb,
+ int decimals, int decPos, int sign)
+ {
+ string s = FormatGroupAndDec(sb, decimals, decPos,
+ nfi.CurrencyGroupSizes, nfi.CurrencyGroupSeparator, nfi.CurrencyDecimalSeparator);
+
+ if (sign != 0)
+ { // negative
+ switch (nfi.CurrencyNegativePattern)
+ {
+ case 0:
+ return "(" + nfi.CurrencySymbol + s + ")";
+ case 1:
+ return nfi.NegativeSign + nfi.CurrencySymbol + s;
+ case 2:
+ return nfi.CurrencySymbol + nfi.NegativeSign + s;
+ case 3:
+ return nfi.CurrencySymbol + s + nfi.NegativeSign;
+ case 4:
+ return "(" + s + nfi.CurrencySymbol + ")";
+ case 5:
+ return nfi.NegativeSign + s + nfi.CurrencySymbol;
+ case 6:
+ return s + nfi.NegativeSign + nfi.CurrencySymbol;
+ case 7:
+ return s + nfi.CurrencySymbol + nfi.NegativeSign;
+ case 8:
+ return nfi.NegativeSign + s + " " + nfi.CurrencySymbol;
+ case 9:
+ return nfi.NegativeSign + nfi.CurrencySymbol + " " + s;
+ case 10:
+ return s + " " + nfi.CurrencySymbol + nfi.NegativeSign;
+ case 11:
+ return nfi.CurrencySymbol + " " + s + nfi.NegativeSign;
+ case 12:
+ return nfi.CurrencySymbol + " " + nfi.NegativeSign + s;
+ case 13:
+ return s + nfi.NegativeSign + " " + nfi.CurrencySymbol;
+ case 14:
+ return "(" + nfi.CurrencySymbol + " " + s + ")";
+ case 15:
+ return "(" + s + " " + nfi.CurrencySymbol + ")";
+ default:
+ throw new ArgumentException(Locale.GetText ("Invalid CurrencyNegativePattern"));
+ }
+ }
+ else
+ {
+ switch (nfi.CurrencyPositivePattern)
+ {
+ case 0:
+ return nfi.CurrencySymbol + s;
+ case 1:
+ return s + nfi.CurrencySymbol;
+ case 2:
+ return nfi.CurrencySymbol + " " + s;
+ case 3:
+ return s + " " + nfi.CurrencySymbol;
+ default:
+ throw new ArgumentException(Locale.GetText ("Invalid CurrencyPositivePattern"));
+ }
+ }
+ }
+
+ private static string FormatPercent(NumberFormatInfo nfi, StringBuilder sb,
+ int decimals, int decPos, int sign)
+ {
+ string s = FormatGroupAndDec(sb, decimals, decPos+2,
+ nfi.PercentGroupSizes, nfi.PercentGroupSeparator, nfi.PercentDecimalSeparator);
+
+ if (sign != 0)
+ { // negative
+ switch (nfi.PercentNegativePattern)
+ {
+ case 0:
+ return nfi.NegativeSign + s + " " + nfi.PercentSymbol;
+ case 1:
+ return nfi.NegativeSign + s + nfi.PercentSymbol;
+ case 2:
+ return nfi.NegativeSign + nfi.PercentSymbol + s;
+ default:
+ throw new ArgumentException(Locale.GetText ("Invalid PercentNegativePattern"));
+ }
+ }
+ else
+ {
+ switch (nfi.PercentPositivePattern)
+ {
+ case 0:
+ return s + " " + nfi.PercentSymbol;
+ case 1:
+ return s + nfi.PercentSymbol;
+ case 2:
+ return nfi.PercentSymbol + s;
+ default:
+ throw new ArgumentException("Invalid PercentPositivePattern");
+ }
+ }
+ }
+
+ [MonoTODO]
+ private static string FormatNormalized(NumberFormatInfo nfi, StringBuilder sb,
+ int digits, int decPos, int sign)
+ {
+ //LAMESPEC: how should this format look like ? Is this a fixed point format ?
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Delegate.cs b/mcs/class/corlib/System/Delegate.cs
new file mode 100644
index 00000000000..7477a7cca6d
--- /dev/null
+++ b/mcs/class/corlib/System/Delegate.cs
@@ -0,0 +1,196 @@
+//
+// System.Delegate.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement
+//
+
+using System;
+using System.Globalization;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [MonoTODO]
+ public abstract class Delegate : ICloneable, ISerializable {
+ protected Type target_type;
+ protected object m_target;
+ protected string method_name;
+ protected IntPtr method_ptr;
+ protected IntPtr delegate_trampoline;
+ protected MethodInfo method_info;
+
+ protected Delegate (object target, string method)
+ {
+ if (target == null)
+ throw new ArgumentNullException (Locale.GetText ("Target object is null"));
+
+ if (method == null)
+ throw new ArgumentNullException (Locale.GetText ("method name is null"));
+
+ this.target_type = null;
+ this.method_ptr = IntPtr.Zero;
+ this.m_target = target;
+ this.method_name = method;
+ }
+
+ protected Delegate (Type target_type, string method)
+ {
+ if (m_target == null)
+ throw new ArgumentNullException (Locale.GetText ("Target type is null"));
+
+ if (method == null)
+ throw new ArgumentNullException (Locale.GetText ("method string is null"));
+
+ this.target_type = target_type;
+ this.method_ptr = IntPtr.Zero;
+ this.m_target = null;
+ this.method_name = method;
+ }
+
+ public MethodInfo Method {
+ get {
+ return method_info;
+ }
+ }
+
+ public object Target {
+ get {
+ return m_target;
+ }
+ }
+
+ //
+ // Methods
+ //
+
+ public object DynamicInvoke( object[] args )
+ {
+ return DynamicInvokeImpl( args );
+ }
+
+ public virtual object DynamicInvokeImpl( object[] args )
+ {
+ return Method.Invoke( m_target, args );
+ }
+
+ public virtual object Clone()
+ {
+ return MemberwiseClone();
+ }
+
+ public override bool Equals (object o)
+ {
+ if ( o == null )
+ return false;
+
+ if ( o.GetType() != this.GetType() )
+ return false;
+
+ Delegate d = (Delegate) o;
+ if ((d.target_type == target_type) &&
+ (d.m_target == m_target) &&
+ (d.method_name == method_name) &&
+ (d.method_ptr == method_ptr))
+ return true;
+
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)method_ptr;
+ }
+
+ // This is from ISerializable
+ [MonoTODO]
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ // TODO: IMPLEMENT ME
+ }
+
+ public virtual Delegate[] GetInvocationList()
+ {
+ return new Delegate[] { this };
+ }
+
+ /// <symmary>
+ /// Returns a new MulticastDelegate holding the
+ /// concatenated invocation lists of MulticastDelegates a and b
+ /// </symmary>
+ public static Delegate Combine (Delegate a, Delegate b)
+ {
+ if (a == null){
+ if (b == null)
+ return null;
+ return b;
+ } else
+ if (b == null)
+ return a;
+
+ if (a.GetType () != b.GetType ())
+ throw new ArgumentException (Locale.GetText ("Incompatible Delegate Types"));
+
+ return a.CombineImpl (b);
+ }
+
+ /// <symmary>
+ /// Returns a new MulticastDelegate holding the
+ /// concatenated invocation lists of an Array of MulticastDelegates
+ /// </symmary>
+ public static Delegate Combine( Delegate[] delegates )
+ {
+ Delegate retval = null;
+
+ foreach ( Delegate next in delegates ) {
+ retval = Combine( retval, next );
+ }
+
+ return retval;
+ }
+
+
+ protected virtual Delegate CombineImpl (Delegate d)
+ {
+ throw new MulticastNotSupportedException ("");
+ }
+
+ [MonoTODO]
+ public static Delegate Remove( Delegate source, Delegate value) {
+ if ( source == null )
+ return null;
+
+ if ( value == null )
+ return source;
+
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected virtual Delegate RemoveImpl(Delegate d)
+ {
+ throw new NotImplementedException();
+ }
+
+ public static bool operator ==( Delegate a, Delegate b )
+ {
+ if ((object)a == null) {
+ if ((object)b == null)
+ return true;
+ return false;
+ }
+ return a.Equals( b );
+ }
+
+ public static bool operator !=( Delegate a, Delegate b )
+ {
+ return !(a == b);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/DivideByZeroException.cs b/mcs/class/corlib/System/DivideByZeroException.cs
new file mode 100644
index 00000000000..e9a162b255e
--- /dev/null
+++ b/mcs/class/corlib/System/DivideByZeroException.cs
@@ -0,0 +1,31 @@
+//
+// System.DivideByZeroException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+namespace System {
+
+ [Serializable]
+ public class DivideByZeroException : ArithmeticException {
+ // Constructors
+ public DivideByZeroException ()
+ : base (Locale.GetText ("Division by zero"))
+ {
+ }
+
+ public DivideByZeroException (string message)
+ : base (message)
+ {
+ }
+
+ public DivideByZeroException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/DllNotFoundException.cs b/mcs/class/corlib/System/DllNotFoundException.cs
new file mode 100644
index 00000000000..cc332020623
--- /dev/null
+++ b/mcs/class/corlib/System/DllNotFoundException.cs
@@ -0,0 +1,42 @@
+//
+// System.DllNotFoundException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class DllNotFoundException : TypeLoadException
+ {
+ // Constructors
+ public DllNotFoundException ()
+ : base (Locale.GetText ("DLL not found."))
+ {
+ }
+
+ public DllNotFoundException (string message)
+ : base (message)
+ {
+ }
+
+ protected DllNotFoundException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public DllNotFoundException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/Double.cs b/mcs/class/corlib/System/Double.cs
new file mode 100644
index 00000000000..7b23344d0a6
--- /dev/null
+++ b/mcs/class/corlib/System/Double.cs
@@ -0,0 +1,297 @@
+//
+// System.Double.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Bob Smith (bob@thestuff.net)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+// (C) Bob Smith. http://www.thestuff.net
+//
+
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ [Serializable]
+ public struct Double : IComparable, IFormattable, IConvertible {
+ public const double Epsilon = 4.9406564584124650e-324;
+ public const double MaxValue = 1.7976931348623157e308;
+ public const double MinValue = -1.7976931348623157e308;
+ public const double NaN = 0.0d / 0.0d;
+ public const double NegativeInfinity = -1.0d / 0.0d;
+ public const double PositiveInfinity = 1.0d / 0.0d;
+
+ // VES needs to know about value. public is workaround
+ // so source will compile
+ public double value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Double))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Double"));
+
+ if (IsPositiveInfinity(value) && IsPositiveInfinity((double) v)){
+ return 0;
+ }
+
+ if (IsNegativeInfinity(value) && IsNegativeInfinity((double) v)){
+ return 0;
+ }
+
+ if (IsNaN((double) v)) {
+ if (IsNaN(value))
+ return 0;
+ else
+ return 1;
+ }
+
+ return (int) (value - ((double) v));
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Double))
+ return false;
+
+ if (IsNaN ((double)o)) {
+ if (IsNaN(value))
+ return true;
+ else
+ return false;
+ }
+
+ return ((double) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) value;
+ }
+
+ public static bool IsInfinity (double d)
+ {
+ return (d == PositiveInfinity || d == NegativeInfinity);
+ }
+
+ public static bool IsNaN (double d)
+ {
+ return (d != d);
+ }
+
+ public static bool IsNegativeInfinity (double d)
+ {
+ return (d < 0.0d && (d == NegativeInfinity || d == PositiveInfinity));
+ }
+
+ public static bool IsPositiveInfinity (double d)
+ {
+ return (d > 0.0d && (d == NegativeInfinity || d == PositiveInfinity));
+ }
+
+ public static double Parse (string s)
+ {
+ return Parse (s, (NumberStyles.Float | NumberStyles.AllowThousands), null);
+ }
+
+ public static double Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, (NumberStyles.Float | NumberStyles.AllowThousands), fp);
+ }
+
+ public static double Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ [MonoTODO]
+ public static double Parse (string s, NumberStyles style, IFormatProvider provider)
+ {
+ if (s == null) throw new ArgumentNullException();
+ if (style > NumberStyles.Any)
+ {
+ throw new ArgumentException();
+ }
+ NumberFormatInfo format = NumberFormatInfo.GetInstance(provider);
+ if (format == null) throw new Exception("How did this happen?");
+ if (s == format.NaNSymbol) return Double.NaN;
+ if (s == format.PositiveInfinitySymbol) return Double.PositiveInfinity;
+ if (s == format.NegativeInfinitySymbol) return Double.NegativeInfinity;
+ string[] sl;
+ long integral = 0;
+ long fraction = 0;
+ long exponent = 1;
+ double retval = 0;
+ if ((style & NumberStyles.AllowLeadingWhite) != 0)
+ {
+ s.TrimStart(null);
+ }
+ if ((style & NumberStyles.AllowTrailingWhite) != 0)
+ {
+ s.TrimEnd(null);
+ }
+ sl = s.Split(new Char[] {'e', 'E'}, 2);
+ if (sl.Length > 1)
+ {
+ if ((style & NumberStyles.AllowExponent) == 0)
+ {
+ throw new FormatException();
+ }
+ exponent = long.Parse(sl[1], NumberStyles.AllowLeadingSign, format);
+ }
+ s = sl[0];
+ sl = s.Split(format.NumberDecimalSeparator.ToCharArray(), 2);
+ if (sl.Length > 1)
+ {
+ if ((style & NumberStyles.AllowDecimalPoint) == 0)
+ {
+ throw new FormatException();
+ }
+ fraction = long.Parse(sl[1], NumberStyles.None, format);
+ }
+ NumberStyles tempstyle = NumberStyles.None;
+ if ((style & NumberStyles.AllowLeadingSign) != 0){
+ tempstyle = NumberStyles.AllowLeadingSign;
+ }
+
+ if (sl[0].Length > 0)
+ integral = long.Parse(sl[0], tempstyle, format);
+ else
+ integral = 0;
+
+ retval = fraction;
+
+ // FIXME: what about the zeros between the decimal point
+ // and the first non-zero digit?
+ while (retval >1) retval /= 10;
+ if (integral < 0){
+ retval -= integral;
+ retval = -retval;
+ }
+ else retval += integral;
+ if (exponent != 1) retval *= Math.Pow(10, exponent);
+ return retval;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ [MonoTODO]
+ public string ToString (string format, IFormatProvider fp)
+ {
+ // FIXME: Need to pass format and provider info to this call too.
+ return ToStringImpl(value);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern string ToStringImpl (double value);
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Double;
+ }
+
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType(value, conversionType, provider);
+ }
+
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean(value);
+ }
+
+ public byte ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte(value);
+ }
+
+ public char ToChar (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ [CLSCompliant(false)]
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ throw new InvalidCastException();
+ }
+
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal(value);
+ }
+
+ public double ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble(value);
+ }
+
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16(value);
+ }
+
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32(value);
+ }
+
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64(value);
+ }
+
+ [CLSCompliant(false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte(value);
+ }
+
+ public float ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle(value);
+ }
+
+ string IConvertible.ToString (IFormatProvider provider)
+ {
+ return ToString(provider);
+ }
+
+ [CLSCompliant(false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16(value);
+ }
+
+ [CLSCompliant(false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32(value);
+ }
+
+ [CLSCompliant(false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64(value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/DuplicateWaitObjectException.cs b/mcs/class/corlib/System/DuplicateWaitObjectException.cs
new file mode 100644
index 00000000000..beddfd0c5ac
--- /dev/null
+++ b/mcs/class/corlib/System/DuplicateWaitObjectException.cs
@@ -0,0 +1,39 @@
+//
+// System.DuplicateWaitObjectException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class DuplicateWaitObjectException : ArgumentException {
+ // Constructors
+ public DuplicateWaitObjectException ()
+ : base (Locale.GetText ("Duplicate objects in argument"))
+ {
+ }
+
+ public DuplicateWaitObjectException (string param_name)
+ : base (Locale.GetText ("Duplicate objects in argument"), param_name)
+ {
+ }
+
+ public DuplicateWaitObjectException (string param_name, string message)
+ : base (message, param_name)
+ {
+ }
+
+ protected DuplicateWaitObjectException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/EntryPointNotFoundException.cs b/mcs/class/corlib/System/EntryPointNotFoundException.cs
new file mode 100644
index 00000000000..672d5261490
--- /dev/null
+++ b/mcs/class/corlib/System/EntryPointNotFoundException.cs
@@ -0,0 +1,42 @@
+//
+// System.EntryPointNotFoundException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class EntryPointNotFoundException : TypeLoadException
+ {
+ // Constructors
+ public EntryPointNotFoundException ()
+ : base (Locale.GetText ("Cannot load class because of missing entry method."))
+ {
+ }
+
+ public EntryPointNotFoundException (string message)
+ : base (message)
+ {
+ }
+
+ protected EntryPointNotFoundException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public EntryPointNotFoundException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/Enum.cs b/mcs/class/corlib/System/Enum.cs
new file mode 100644
index 00000000000..993fde384e8
--- /dev/null
+++ b/mcs/class/corlib/System/Enum.cs
@@ -0,0 +1,571 @@
+//
+// System.Enum.cs
+//
+// Authors:
+// Miguel de Icaza (miguel@ximian.com)
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+using System.Collections;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+ internal struct MonoEnumInfo {
+ internal Type utype;
+ internal Array values;
+ internal string[] names;
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void get_enum_info (Type enumType, out MonoEnumInfo info);
+
+ internal static void GetInfo (Type enumType, out MonoEnumInfo info) {
+ get_enum_info (enumType, out info);
+ Array.Sort (info.values, info.names);
+ }
+ };
+
+ [MonoTODO]
+ public abstract class Enum : ValueType, IComparable, IConvertible {
+
+ // IConvertible methods Start -->
+
+ [CLSCompliant(false)]
+ public TypeCode GetTypeCode () {
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (this.GetType (), out info);
+ return Type.GetTypeCode (info.utype);
+ }
+
+ [MonoTODO]
+ bool IConvertible.ToBoolean (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ byte IConvertible.ToByte (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ char IConvertible.ToChar (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ DateTime IConvertible.ToDateTime (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ decimal IConvertible.ToDecimal (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ double IConvertible.ToDouble (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ short IConvertible.ToInt16 (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ int IConvertible.ToInt32 (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ long IConvertible.ToInt64 (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ [CLSCompliant(false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ float IConvertible.ToSingle (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ [CLSCompliant(false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ [CLSCompliant(false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ [CLSCompliant(false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+
+ // <-- End IConvertible methods
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern object get_value ();
+
+ public static Array GetValues (Type enumType) {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (enumType, out info);
+ return info.values;
+ }
+
+ public static string[] GetNames (Type enumType) {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (enumType, out info);
+ return info.names;
+ }
+
+ public static string GetName (Type enumType, object value) {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+ if (null == value)
+ throw new ArgumentNullException ("value cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ MonoEnumInfo info;
+ int i;
+ value = ToObject (enumType, value);
+ MonoEnumInfo.GetInfo (enumType, out info);
+ for (i = 0; i < info.values.Length; ++i) {
+ if (value.Equals (info.values.GetValue (i)))
+ return info.names [i];
+ }
+ return null;
+ }
+
+ public static bool IsDefined (Type enumType, object value) {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+ if (null == value)
+ throw new ArgumentNullException ("value cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (enumType, out info);
+
+ Type vType = value.GetType ();
+ if (vType == typeof(String)) {
+ return ((IList)(info.names)).Contains (value);
+ } else if (vType == info.utype) {
+ int i;
+ value = ToObject (enumType, value);
+ MonoEnumInfo.GetInfo (enumType, out info);
+ for (i = 0; i < info.values.Length; ++i) {
+ if (value.Equals (info.values.GetValue (i)))
+ return true;
+ }
+ return false;
+ } else {
+ throw new ArgumentException("The value parameter is not the correct type."
+ + "It must be type String or the same type as the underlying type"
+ + "of the Enum.");
+ }
+
+
+ }
+
+ public static Type GetUnderlyingType (Type enumType) {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (enumType, out info);
+ return info.utype;
+ }
+
+ public static object Parse (Type enumType, string value)
+ {
+ // Note: Parameters are checked in the other overload
+ return Parse (enumType, value, false);
+ }
+
+ public static object Parse (Type enumType, string value, bool ignoreCase)
+ {
+ if (null == enumType)
+ throw new ArgumentNullException ("enumType cannot be null.");
+
+ if (null == value)
+ throw new ArgumentNullException ("value cannot be null.");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException ("enumType is not an Enum type.");
+
+ if (String.Empty == value.Trim())
+ throw new ArgumentException ("value cannot be empty string.");
+
+ MonoEnumInfo info;
+ int i;
+ MonoEnumInfo.GetInfo (enumType, out info);
+
+ long retVal = 0;
+ string[] names = value.Split(new char[] {','});
+ TypeCode typeCode = ((Enum) info.values.GetValue (0)).GetTypeCode ();
+ foreach (string name in names) {
+ bool found = false;
+ for (i = 0; i < info.values.Length; ++i) {
+ if (String.Compare (name, info.names [i], ignoreCase) == 0) {
+ switch (typeCode) {
+ case TypeCode.Byte:
+ retVal |= (long)((byte)info.values.GetValue (i));
+ break;
+ case TypeCode.SByte:
+ retVal |= (long)((SByte)info.values.GetValue (i));
+ break;
+ case TypeCode.Int16:
+ retVal |= (long)((short)info.values.GetValue (i));
+ break;
+ case TypeCode.Int32:
+ retVal |= (long)((int)info.values.GetValue (i));
+ break;
+ case TypeCode.Int64:
+ retVal |= (long)info.values.GetValue (i);
+ break;
+ case TypeCode.UInt16:
+ retVal |= (long)((UInt16)info.values.GetValue (i));
+ break;
+ case TypeCode.UInt32:
+ retVal |= (long)((UInt32)info.values.GetValue (i));
+ break;
+ case TypeCode.UInt64:
+ retVal |= (long)((UInt64)info.values.GetValue (i));
+ break;
+ }
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ throw new ArgumentException ("The requested value was not found");
+
+ }
+ return ToObject(enumType, retVal);
+ }
+
+ /// <summary>
+ /// Compares the enum value with another enum value of the same type.
+ /// </summary>
+ ///
+ /// <remarks>
+ ///
+ public int CompareTo (object obj)
+ {
+ Type thisType;
+
+ if (obj == null)
+ return 1;
+
+ thisType = this.GetType();
+ if (obj.GetType() != thisType){
+ throw new ArgumentException(
+ "Object must be the same type as the "
+ + "enum. The type passed in was "
+ + obj.GetType().ToString()
+ + "; the enum type was "
+ + thisType.ToString() + ".");
+ }
+
+ object value1, value2;
+
+ value1 = this.get_value ();
+ value2 = ((Enum)obj).get_value();
+
+ return ((IComparable)value1).CompareTo (value2);
+ }
+
+ public override string ToString ()
+ {
+ return ToString ("G", null);
+ }
+
+ public string ToString (IFormatProvider provider)
+ {
+ return ToString ("G", provider);
+ }
+
+ public string ToString (String format)
+ {
+ return ToString (format, null);
+ }
+
+ [MonoTODO]
+ public string ToString (String format, IFormatProvider provider)
+ {
+ // provider is not used for Enums
+
+ if (format == String.Empty || format == null){
+ format = "G";
+ }
+ return Format (this.GetType(), this.get_value (), format);
+ }
+
+ public static object ToObject(Type enumType, byte value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+
+ public static object ToObject(Type enumType, short value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+ public static object ToObject(Type enumType, int value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+ public static object ToObject(Type enumType, long value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern object ToObject(Type enumType, object value);
+
+ [CLSCompliant(false)]
+ public static object ToObject(Type enumType, sbyte value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+ [CLSCompliant(false)]
+ public static object ToObject(Type enumType, ushort value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+ [CLSCompliant(false)]
+ public static object ToObject(Type enumType, uint value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+ [CLSCompliant(false)]
+ public static object ToObject(Type enumType, ulong value)
+ {
+ return ToObject (enumType, (object)value);
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (null == obj)
+ return false;
+
+ if (obj.GetType() != this.GetType())
+ return false;
+
+ object v1 = this.get_value ();
+ object v2 = ((Enum)obj).get_value ();
+
+ return v1.Equals (v2);
+ }
+
+ public override int GetHashCode ()
+ {
+ object v = this.get_value ();
+ return v.GetHashCode ();
+ }
+
+ [MonoTODO]
+ public static string Format (Type enumType, object value, string format)
+ {
+ if (null == enumType)
+ throw new ArgumentNullException("enumType cannot be null");
+ if (null == value)
+ throw new ArgumentNullException("value cannot be null");
+ if (null == format)
+ throw new ArgumentNullException("format cannot be null");
+
+ if (!enumType.IsEnum)
+ throw new ArgumentException("enumType is not an Enum Type");
+
+ Type vType = value.GetType();
+ if (vType != enumType && vType != Enum.GetUnderlyingType(enumType))
+ throw new ArgumentException();
+
+
+ if (format.Length != 1)
+ throw new FormatException ("Format String can be only \"G\",\"g\",\"X\"," +
+ "\"x\",\"F\",\"f\",\"D\" or \"d\".");
+
+ char formatChar = format [0];
+ if ((formatChar == 'G' || formatChar == 'g')
+ && Attribute.IsDefined(enumType, typeof(FlagsAttribute)))
+ formatChar = 'F';
+
+ string retVal = "";
+ switch (formatChar) {
+ case 'G':
+ case 'g':
+ retVal = GetName (enumType, value);
+ if (retVal == null)
+ retVal = value.ToString();
+ break;
+ case 'X':
+ case 'x':
+ retVal = value.ToString();
+ long xValue = Int64.Parse(retVal);
+ // FIXME: Not sure if padding should always be with precision
+ // 8, if it's culture specific, or what. This works for me.
+ retVal = xValue.ToString("x8");
+ break;
+ case 'D':
+ case 'd':
+ retVal = value.ToString();
+ break;
+ case 'F':
+ case 'f':
+ MonoEnumInfo info;
+ MonoEnumInfo.GetInfo (enumType, out info);
+ // This is ugly, yes. We need to handle the different integer
+ // types for enums. If someone else has a better idea, be my guest.
+ switch (((Enum)info.values.GetValue (0)).GetTypeCode()) {
+ case TypeCode.Byte:
+ byte byteFlag = (byte)value;
+ byte byteenumValue;
+ for (int i = info.values.Length-1; i>=0 && byteFlag != 0; i--) {
+ byteenumValue = (byte)info.values.GetValue (i);
+ if ((byteenumValue & byteFlag) == byteenumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ byteFlag -= byteenumValue;
+ }
+ }
+ break;
+ case TypeCode.SByte:
+ SByte sbyteFlag = (SByte)value;
+ SByte sbyteenumValue;
+ for (int i = info.values.Length-1; i>=0 && sbyteFlag != 0; i--) {
+ sbyteenumValue = (SByte)info.values.GetValue (i);
+ if ((sbyteenumValue & sbyteFlag) == sbyteenumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ sbyteFlag -= sbyteenumValue;
+ }
+ }
+ break;
+ case TypeCode.Int16:
+ short Int16Flag = (short)value;
+ short Int16enumValue;
+ for (int i = info.values.Length-1; i>=0 && Int16Flag != 0; i--) {
+ Int16enumValue = (short)info.values.GetValue (i);
+ if ((Int16enumValue & Int16Flag) == Int16enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ Int16Flag -= Int16enumValue;
+ }
+ }
+ break;
+ case TypeCode.Int32:
+ int Int32Flag = (int)value;
+ int Int32enumValue;
+ for (int i = info.values.Length-1; i>=0 && Int32Flag != 0; i--) {
+ Int32enumValue = (int)info.values.GetValue (i);
+ if ((Int32enumValue & Int32Flag) == Int32enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ Int32Flag -= Int32enumValue;
+ }
+ }
+ break;
+ case TypeCode.Int64:
+ long Int64Flag = (long)value;
+ long Int64enumValue;
+ for (int i = info.values.Length-1; i>=0 && Int64Flag != 0; i--) {
+ Int64enumValue = (long)info.values.GetValue (i);
+ if ((Int64enumValue & Int64Flag) == Int64enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ Int64Flag -= Int64enumValue;
+ }
+ }
+ break;
+ case TypeCode.UInt16:
+ UInt16 UInt16Flag = (UInt16)value;
+ UInt16 UInt16enumValue;
+ for (int i = info.values.Length-1; i>=0 && UInt16Flag != 0; i--) {
+ UInt16enumValue = (UInt16)info.values.GetValue (i);
+ if ((UInt16enumValue & UInt16Flag) == UInt16enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ UInt16Flag -= UInt16enumValue;
+ }
+ }
+ break;
+ case TypeCode.UInt32:
+ UInt32 UInt32Flag = (UInt32)value;
+ UInt32 UInt32enumValue;
+ for (int i = info.values.Length-1; i>=0 && UInt32Flag != 0; i--) {
+ UInt32enumValue = (UInt32)info.values.GetValue (i);
+ if ((UInt32enumValue & UInt32Flag) == UInt32enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ UInt32Flag -= UInt32enumValue;
+ }
+ }
+ break;
+ case TypeCode.UInt64:
+ UInt64 UInt64Flag = (UInt64)value;
+ UInt64 UInt64enumValue;
+ for (int i = info.values.Length-1; i>=0 && UInt64Flag != 0; i--) {
+ UInt64enumValue = (UInt64)info.values.GetValue (i);
+ if ((UInt64enumValue & UInt64Flag) == UInt64enumValue){
+ retVal = info.names[i] + (retVal == String.Empty ? "" : ", ") + retVal;
+ UInt64Flag -= UInt64enumValue;
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ throw new FormatException ("Format String can be only \"G\",\"g\",\"X\"," +
+ "\"x\",\"F\",\"f\",\"D\" or \"d\".");
+ }
+
+ return retVal;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Environment.cs b/mcs/class/corlib/System/Environment.cs
new file mode 100644
index 00000000000..2195524435a
--- /dev/null
+++ b/mcs/class/corlib/System/Environment.cs
@@ -0,0 +1,305 @@
+//------------------------------------------------------------------------------
+//
+// System.Environment.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Dan Lewis (dihlewis@yahoo.co.uk)
+// Created: Saturday, August 11, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.IO;
+//using System.Diagnostics;
+using System.Collections;
+using System.Security;
+using System.Security.Permissions;
+using System.Runtime.CompilerServices;
+
+namespace System
+{
+ public sealed class Environment
+ {
+ private Environment () {}
+
+ [MonoTODO]
+ public enum SpecialFolder
+ { // TODO: Determine if these windoze style folder identifiers
+ // have unix/linux counterparts
+ ApplicationData,
+ CommonApplicationData,
+ CommonProgramFiles,
+ Cookies,
+ DesktopDirectory,
+ Favorites,
+ History,
+ InternetCache,
+ LocalApplicationData,
+ Personal,
+ ProgramFiles,
+ Programs,
+ Recent,
+ SendTo,
+ StartMenu,
+ Startup,
+ System,
+ Templates
+ }
+
+ // TODO: Make sure the security attributes do what I expect
+
+ /// <summary>
+ /// Gets the command line for this process
+ /// </summary>
+ public static string CommandLine
+ { // TODO: Coordinate with implementor of EnvironmentPermissionAttribute
+ // [EnvironmentPermissionAttribute(SecurityAction.Demand, Read = "COMMANDLINE")]
+ get
+ {
+ return GetCommandLine ();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the current directory. Actually this is supposed to get
+ /// and/or set the process start directory acording to the documentation
+ /// but actually test revealed at beta2 it is just Getting/Setting the CurrentDirectory
+ /// </summary>
+ public static string CurrentDirectory
+ {
+ // originally it was my thought that the external call would be made in
+ // the directory class however that class has additional security requirements
+ // so the Directory class will call this class for its get/set current directory
+
+ // [EnvironmentPermissionAttribute(SecurityAction.Demand, Unrestricted = true)]
+ get
+ {
+ return MonoIO.GetCurrentDirectory ();
+ }
+ [MonoTODO("disabled because of compile error. Need mcs magic.")]
+ //[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ set
+ {
+ MonoIO.SetCurrentDirectory (value);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the exit code of this process
+ /// </summary>
+ [MonoTODO]
+ public static int ExitCode
+ { // TODO: find a way to implement this property
+ get
+ {
+ throw new NotImplementedException ();
+ }
+ set
+ {
+ throw new NotImplementedException ();
+ }
+ }
+
+ /// <summary>
+ /// Gets the name of the local computer
+ /// </summary>
+ public extern static string MachineName {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ /// <summary>
+ /// Gets the standard new line value
+ /// </summary>
+ public extern static string NewLine {
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ /// <summary>
+ /// Gets the current OS version information
+ /// </summary>
+ [MonoTODO]
+ public static OperatingSystem OSVersion {
+ get
+ {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Get StackTrace
+ /// </summary>
+ [MonoTODO]
+ public static string StackTrace
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Get a fully qualified path to the system directory
+ /// </summary>
+ public static string SystemDirectory
+ {
+ get
+ {
+ return GetFolderPath(SpecialFolder.System);
+ }
+ }
+
+ /// <summary>
+ /// Get the number of milliseconds that have elapsed since the system was booted
+ /// </summary>
+ [MonoTODO]
+ public static int TickCount
+ {
+ get
+ {
+ return 0;
+ //return getTickCount();
+ }
+ }
+
+ /// <summary>
+ /// Get UserDomainName
+ /// </summary>
+ [MonoTODO]
+ public static string UserDomainName
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Gets a flag indicating whether the process is in interactive mode
+ /// </summary>
+ [MonoTODO]
+ public static bool UserInteractive
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Get the user name of current process is running under
+ /// </summary>
+ [MonoTODO]
+ public static string UserName
+ {
+ get
+ {
+ // TODO: needs more research/work/thought
+ string result = GetEnvironmentVariable("USERNAME");
+ if(result == null || result.Equals(string.Empty))
+ {
+ result = GetEnvironmentVariable("USER");
+ }
+ return result;
+ }
+ }
+
+ /// <summary>
+ /// Get the version of an assembly
+ /// </summary>
+ [MonoTODO]
+ public static Version Version
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Get the amount of physical memory mapped to process
+ /// </summary>
+ [MonoTODO]
+ public static long WorkingSet
+ {
+ get
+ {
+ return 0;
+ }
+ }
+
+ [MonoTODO]
+ public static void Exit(int exitCode)
+ {
+ }
+
+ /// <summary>
+ /// Substitute environment variables in the argument "name"
+ /// </summary>
+ [MonoTODO]
+ public static string ExpandEnvironmentVariables(string name)
+ {
+ return name;
+ }
+
+ /// <summary>
+ /// Return an array of the command line arguments of the current process
+ /// </summary>
+ public static string[] GetCommandLineArgs()
+ {
+ char[] delimiter = new char[1];
+ delimiter[0] = ' ';
+ return CommandLine.Split (delimiter);
+ }
+
+ /// <summary>
+ /// Return a string containing the value of the environment
+ /// variable identifed by parameter "variable"
+ /// </summary>
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static string GetEnvironmentVariable (string name);
+
+ /// <summary>
+ /// Return a set of all environment variables and their values
+ /// </summary>
+
+ public static IDictionary GetEnvironmentVariables()
+ {
+ Hashtable vars = new Hashtable ();
+ foreach (string name in GetEnvironmentVariableNames ())
+ vars [name] = GetEnvironmentVariable (name);
+
+ return vars;
+ }
+
+ /// <summary>
+ /// Returns the fully qualified path of the
+ /// folder specified by the "folder" parameter
+ /// </summary>
+ [MonoTODO]
+ public static string GetFolderPath(SpecialFolder folder)
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// Returns an array of the logical drives
+ /// </summary>
+ [MonoTODO]
+ public static string[] GetLogicalDrives()
+ {
+ return null;
+ }
+
+ // private methods
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static string [] GetEnvironmentVariableNames ();
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ private extern static string GetCommandLine ();
+ }
+}
diff --git a/mcs/class/corlib/System/EventArgs.cs b/mcs/class/corlib/System/EventArgs.cs
new file mode 100644
index 00000000000..c2460152d2e
--- /dev/null
+++ b/mcs/class/corlib/System/EventArgs.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// System.EventArgs.cs
+//
+// Copyright (C) 2001 Michael Lambert, All Rights Reserved
+//
+// Author: Michael Lambert, michaellambert@email.com
+// Created: Mon 07/16/2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System {
+
+ [Serializable]
+ public class EventArgs
+ {
+ public static readonly EventArgs Empty = new EventArgs();
+
+ public EventArgs() { }
+ }
+
+} // System
+
+
diff --git a/mcs/class/corlib/System/EventHandler.cs b/mcs/class/corlib/System/EventHandler.cs
new file mode 100644
index 00000000000..407255b604e
--- /dev/null
+++ b/mcs/class/corlib/System/EventHandler.cs
@@ -0,0 +1,16 @@
+//
+// System.EventHandler.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public delegate void EventHandler (object sender, EventArgs e);
+
+}
+
+
diff --git a/mcs/class/corlib/System/Exception.cs b/mcs/class/corlib/System/Exception.cs
new file mode 100644
index 00000000000..6a70f9f55b0
--- /dev/null
+++ b/mcs/class/corlib/System/Exception.cs
@@ -0,0 +1,159 @@
+//
+// System.Exception.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Reflection;
+
+namespace System {
+
+ [Serializable]
+// [ClassInterface (ClassInterfaceType.AutoDual)] (no implementation yet)
+ [MonoTODO]
+ public class Exception : ISerializable {
+ Exception inner_exception;
+ string message;
+ string help_link;
+ string class_name;
+ string stack_trace = "TODO: implement stack traces";
+ string remote_stack_trace = "TODO: Implement remote stack trace";
+ int remote_stack_index;
+ int hresult;
+ string source;
+
+ public Exception ()
+ {
+ inner_exception = null;
+ message = "";
+ }
+
+ public Exception (string msg)
+ {
+ inner_exception = null;
+ message = msg;
+ }
+
+ protected Exception (SerializationInfo info, StreamingContext sc)
+ {
+ if (info == null)
+ throw new ArgumentNullException ("info");
+
+ class_name = info.GetString ("ClassName");
+ message = info.GetString ("Message");
+ inner_exception = (Exception) info.GetValue ("InnerException", typeof (Exception));
+ help_link = info.GetString ("HelpURL");
+ stack_trace = info.GetString ("StackTraceString");
+ remote_stack_trace = info.GetString ("RemoteStackTrace");
+ remote_stack_index = info.GetInt32 ("RemoteStackIndex");
+ hresult = info.GetInt32 ("HResult");
+ source = info.GetString ("Source");
+ }
+
+ public Exception (string msg, Exception e)
+ {
+ inner_exception = e;
+ message = msg;
+ }
+
+ public Exception InnerException {
+ get {
+ return inner_exception;
+ }
+ }
+
+ public virtual string HelpLink {
+ get {
+ return help_link;
+ }
+
+ set {
+ help_link = value;
+ }
+ }
+
+ protected int HResult {
+ get {
+ return hresult;
+ }
+
+ set {
+ hresult = value;
+ }
+ }
+
+ public virtual string Message {
+ get {
+ return message;
+ }
+ }
+
+ [MonoTODO]
+ public virtual string Source {
+ get {
+ // TODO: if source is null, we must return
+ // the name of the assembly where the error
+ // originated.
+ return source;
+ }
+
+ set {
+ source = value;
+ }
+ }
+
+ public virtual string StackTrace {
+ get {
+ return stack_trace;
+ }
+ }
+
+ [MonoTODO]
+ public MethodBase TargetSite {
+ get {
+ // TODO: Implement this.
+ return null;
+ }
+ }
+
+ public virtual Exception GetBaseException ()
+ {
+ Exception inner = inner_exception;
+
+ while (inner != null){
+ if (inner.InnerException != null)
+ inner = inner.InnerException;
+ else
+ return inner;
+ }
+
+ return this;
+ }
+
+ public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("ClassName", class_name);
+ info.AddValue ("Message", message);
+ info.AddValue ("InnerException", inner_exception);
+ info.AddValue ("HelpURL", help_link);
+ info.AddValue ("StackTraceString", stack_trace);
+ info.AddValue ("RemoteStackTrace", remote_stack_trace);
+ info.AddValue ("RemoteStackIndex", remote_stack_index);
+ info.AddValue ("HResult", hresult);
+ info.AddValue ("Source", source);
+ }
+
+ public override string ToString ()
+ {
+ return this.GetType ().FullName + "\n" +
+ message +
+ GetBaseException ().GetType ().FullName +
+ stack_trace;
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/System/ExecutionEngineException.cs b/mcs/class/corlib/System/ExecutionEngineException.cs
new file mode 100644
index 00000000000..f005ecb70f0
--- /dev/null
+++ b/mcs/class/corlib/System/ExecutionEngineException.cs
@@ -0,0 +1,31 @@
+//
+// System.ExecutionEngineException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+namespace System {
+
+ [Serializable]
+ public sealed class ExecutionEngineException : SystemException {
+ // Constructors
+ public ExecutionEngineException ()
+ : base (Locale.GetText ("Internal error occurred")) // Haha. Nice.
+ {
+ }
+
+ public ExecutionEngineException (string message)
+ : base (message)
+ {
+ }
+
+ public ExecutionEngineException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/FieldAccessException.cs b/mcs/class/corlib/System/FieldAccessException.cs
new file mode 100644
index 00000000000..342a405ddd6
--- /dev/null
+++ b/mcs/class/corlib/System/FieldAccessException.cs
@@ -0,0 +1,41 @@
+//
+// System.FieldAccessException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class FieldAccessException : MemberAccessException
+ {
+ // Constructors
+ public FieldAccessException ()
+ : base (Locale.GetText ("Attempt to access a private/protected field failed."))
+ {
+ }
+
+ public FieldAccessException (string message)
+ : base (message)
+ {
+ }
+
+ protected FieldAccessException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public FieldAccessException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/FlagsAttribute.cs b/mcs/class/corlib/System/FlagsAttribute.cs
new file mode 100755
index 00000000000..8c2b40defa0
--- /dev/null
+++ b/mcs/class/corlib/System/FlagsAttribute.cs
@@ -0,0 +1,29 @@
+//
+// System.FlagsAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The FlagsAttribute tags enumerations as bitfields.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The FlagsAttribute can be used to tag an enumeration to be
+ /// a bit field. This will allow the compiler and visual tools
+ /// to treat the bits in an enumeration as a set of flags.
+ /// </remarks>
+
+ [AttributeUsage (AttributeTargets.Enum)]
+ [Serializable]
+ public class FlagsAttribute : Attribute {
+
+ // No methods.
+
+ }
+}
diff --git a/mcs/class/corlib/System/FormatException.cs b/mcs/class/corlib/System/FormatException.cs
new file mode 100644
index 00000000000..2140db44359
--- /dev/null
+++ b/mcs/class/corlib/System/FormatException.cs
@@ -0,0 +1,39 @@
+//
+// System.FormatException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class FormatException : SystemException {
+ // Constructors
+ public FormatException ()
+ : base (Locale.GetText ("Invalid format"))
+ {
+ }
+
+ public FormatException (string message)
+ : base (message)
+ {
+ }
+
+ public FormatException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected FormatException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/GC.cs b/mcs/class/corlib/System/GC.cs
new file mode 100755
index 00000000000..f478a1f1589
--- /dev/null
+++ b/mcs/class/corlib/System/GC.cs
@@ -0,0 +1,65 @@
+
+
+//
+// System/GC.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System {
+ public sealed class GC {
+
+ private GC () {}
+
+ /* as long as we use Boehm... */
+ public static int MaxGeneration {
+ get {return 0;}
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ extern static void InternalCollect (int generation);
+
+ public static void Collect () {
+ InternalCollect (MaxGeneration);
+ }
+
+ public static void Collect (int generation) {
+ if (generation < 0 || generation > MaxGeneration)
+ throw new ArgumentOutOfRangeException ("generation");
+ InternalCollect (generation);
+ }
+
+ public static int GetGeneration (object obj) {
+ return 0;
+ }
+
+ public static int GetGeneration (WeakReference wo) {
+ if (!wo.IsAlive)
+ throw new ArgumentException ();
+ return 0;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static long GetTotalMemory (bool forceFullCollection);
+
+ /* this icall has weird semantics check the docs... */
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void KeepAlive (object obj);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void ReRegisterForFinalize (object obj);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void SuppressFinalize (object obj);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static void WaitForPendingFinalizers();
+
+ }
+}
diff --git a/mcs/class/corlib/System/Guid.cs b/mcs/class/corlib/System/Guid.cs
new file mode 100755
index 00000000000..5f15c707ce0
--- /dev/null
+++ b/mcs/class/corlib/System/Guid.cs
@@ -0,0 +1,654 @@
+//
+// System.Guid
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using System.Globalization;
+using System.Security.Cryptography;
+
+namespace System {
+
+[Serializable]
+public struct Guid : IFormattable, IComparable {
+
+ private uint _timeLow;
+ private ushort _timeMid;
+ private ushort _timeHighAndVersion;
+ private byte _clockSeqHiAndReserved;
+ private byte _clockSeqLow;
+ private byte _node0;
+ private byte _node1;
+ private byte _node2;
+ private byte _node3;
+ private byte _node4;
+ private byte _node5;
+
+ internal class GuidState {
+ protected Random _prnd; // Pseudo RNG
+ protected RandomNumberGenerator _rnd; // Strong RNG
+ protected bool _usePRnd; // 'true' for pseudo RNG
+ protected ushort _clockSeq;
+ protected ulong _lastTimestamp;
+ protected byte[] _mac;
+
+ public int NextInt(uint x)
+ {
+ if (_usePRnd) {
+ return _prnd.Next ((int) x);
+ }
+ else {
+ byte[] b = new byte[4];
+ _rnd.GetBytes (b);
+
+ uint res = BitConverter.ToUInt32 (b, 0);
+ res = (res % x);
+ return (int) res;
+ }
+ }
+
+ public void NextBytes(byte[] b)
+ {
+ if ( _usePRnd ) {
+ _prnd . NextBytes (b);
+ }
+ else {
+ _rnd . GetBytes (b);
+ }
+ }
+
+ [MonoTODO("Get real MAC address")]
+ public GuidState (bool usePRnd)
+ {
+ _usePRnd = usePRnd;
+ if ( _usePRnd ) {
+ _prnd = new Random (unchecked((int) DateTime.Now.Ticks));
+ }
+ else {
+ _rnd = RandomNumberGenerator.Create ();
+ }
+ _clockSeq = (ushort) NextInt (0x4000); // 14 bits
+ _lastTimestamp = 0ul;
+ _mac = new byte[6];
+ NextBytes (_mac);
+ _mac[0] |= 0x80;
+ }
+
+ public ulong NewTimestamp ()
+ {
+ ulong timestamp;
+
+ do {
+ timestamp = (ulong) (DateTime.UtcNow - new DateTime (1582, 10, 15, 0, 0, 0)).Ticks;
+ if (timestamp < _lastTimestamp) {
+ // clock moved backwards!
+ _clockSeq++;
+ _clockSeq = (ushort) (_clockSeq & 0x3fff);
+ return timestamp;
+ }
+ if (timestamp > _lastTimestamp) {
+ _lastTimestamp = timestamp;
+ return timestamp;
+ }
+ }
+ while (true);
+ }
+
+ public ushort ClockSeq {
+ get {
+ return _clockSeq;
+ }
+ }
+
+ public byte[] MAC {
+ get {
+ return _mac;
+ }
+
+ }
+
+ };
+
+ internal class GuidParser {
+
+ private string _src;
+ private int _length;
+ private int _cur;
+
+ public GuidParser (string src)
+ {
+ _src = src;
+ Reset ();
+ }
+
+ private void Reset ()
+ {
+ _cur = 0;
+ _length = _src.Length;
+ }
+
+ private bool AtEnd ()
+ {
+ return _cur >= _length;
+ }
+
+ private void ThrowFormatException ()
+ {
+ throw new FormatException (Locale.GetText ("Invalid format for Guid.Guid(string)"));
+ }
+
+ private ulong ParseHex(int length, bool strictLength)
+ {
+ ulong res = 0;
+ int i;
+ bool end = false;
+
+ for (i=0; (!end) && i<length; ++i) {
+ if (AtEnd ()) {
+ if (strictLength || i==0) {
+ ThrowFormatException ();
+ }
+ else {
+ end = true;
+ }
+ }
+ else {
+ char c = Char.ToLower (_src[_cur]);
+ if (Char.IsDigit (c)) {
+ res = res * 16 + c - '0';
+ _cur++;
+ }
+ else if (c >= 'a' && c <= 'f') {
+ res = res * 16 + c - 'a' + 10;
+ _cur++;
+ }
+ else {
+ if (strictLength || i==0) {
+ ThrowFormatException ();
+ }
+ else {
+ end = true;
+ }
+ }
+ }
+ }
+
+ return res;
+ }
+
+ private bool ParseOptChar (char c)
+ {
+ if (!AtEnd() && _src[_cur] == c) {
+ _cur++;
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private void ParseChar (char c)
+ {
+ bool b = ParseOptChar (c);
+ if (!b) {
+ ThrowFormatException ();
+ }
+ }
+
+ private Guid ParseGuid1 ()
+ {
+ bool openBrace;
+ int a;
+ short b;
+ short c;
+ byte[] d = new byte[8];
+ int i;
+
+ openBrace = ParseOptChar ('{');
+ a = (int) ParseHex(8, true);
+ ParseChar('-');
+ b = (short) ParseHex(4, true);
+ ParseChar('-');
+ c = (short) ParseHex(4, true);
+ ParseChar('-');
+ for (i=0; i<8; ++i) {
+ d[i] = (byte) ParseHex(2, true);
+ if (i == 1) {
+ ParseChar('-');
+ }
+ }
+
+ if (openBrace && !ParseOptChar('}')) {
+ ThrowFormatException ();
+ }
+
+ return new Guid(a, b, c, d);
+ }
+
+ private void ParseHexPrefix ()
+ {
+ ParseChar ('0');
+ ParseChar ('x');
+ }
+
+ private Guid ParseGuid2 ()
+ {
+ int a;
+ short b;
+ short c;
+ byte[] d = new byte [8];
+ int i;
+
+ ParseChar ('{');
+ ParseHexPrefix ();
+ a = (int) ParseHex (8, false);
+ ParseChar (',');
+ ParseHexPrefix ();
+ b = (short) ParseHex (4, false);
+ ParseChar (',');
+ ParseHexPrefix ();
+ c = (short) ParseHex (4, false);
+ ParseChar (',');
+ ParseChar ('{');
+ for (i=0; i<8; ++i) {
+ ParseHexPrefix ();
+ d[i] = (byte) ParseHex (2, false);
+ if (i != 7) {
+ ParseChar (',');
+ }
+
+ }
+ ParseChar ('}');
+ ParseChar ('}');
+
+ return new Guid (a,b,c,d);
+
+ }
+
+ public Guid Parse ()
+ {
+ Guid g;
+
+ try {
+ g = ParseGuid1 ();
+ }
+ catch (FormatException) {
+ Reset ();
+ g = ParseGuid2 ();
+ }
+ if (!AtEnd () ) {
+ ThrowFormatException ();
+ }
+ return g;
+ }
+
+ }
+
+ private static GuidState _guidState = new GuidState ( true /* use pseudo RNG? */ );
+
+ private static void CheckNull (object o)
+ {
+ if (o == null) {
+ throw new ArgumentNullException (Locale.GetText ("Value cannot be null."));
+ }
+ }
+
+ private static void CheckLength (byte[] o, int l)
+ {
+ if (o . Length != l) {
+ throw new ArgumentException (String.Format (Locale.GetText ("Array should be exactly {0} bytes long."), l));
+ }
+ }
+
+ private static void CheckArray (byte[] o, int l)
+ {
+ CheckNull (o);
+ CheckLength (o, l);
+ }
+
+ public Guid (byte[] b)
+ {
+ CheckArray (b, 16);
+ _timeLow = System.BitConverter.ToUInt32 (b, 0);
+ _timeMid = System.BitConverter.ToUInt16 (b, 4);
+ _timeHighAndVersion = System.BitConverter.ToUInt16 (b, 6);
+ _clockSeqHiAndReserved = b[8];
+ _clockSeqLow = b[9];
+ _node0 = b[10];
+ _node1 = b[11];
+ _node2 = b[12];
+ _node3 = b[13];
+ _node4 = b[14];
+ _node5 = b[15];
+ }
+
+ public Guid (string g)
+ {
+ CheckNull (g);
+
+ GuidParser p = new GuidParser (g);
+ Guid guid = p.Parse();
+
+ this = guid;
+ }
+
+ public Guid (int a, short b, short c, byte[] d)
+ {
+ CheckArray(d, 8);
+ _timeLow = (uint) a;
+ _timeMid = (ushort) b;
+ _timeHighAndVersion = (ushort) c;
+ _clockSeqHiAndReserved = d[0];
+ _clockSeqLow = d[1];
+ _node0 = d[2];
+ _node1 = d[3];
+ _node2 = d[4];
+ _node3 = d[5];
+ _node4 = d[6];
+ _node5 = d[7];
+ }
+
+ public Guid (
+ int a,
+ short b,
+ short c,
+ byte d,
+ byte e,
+ byte f,
+ byte g,
+ byte h,
+ byte i,
+ byte j,
+ byte k)
+ : this((uint) a, (ushort) b, (ushort) c, d, e, f, g, h, i, j, k) {}
+
+ [CLSCompliant(false)]
+ public Guid (
+ uint a,
+ ushort b,
+ ushort c,
+ byte d,
+ byte e,
+ byte f,
+ byte g,
+ byte h,
+ byte i,
+ byte j,
+ byte k)
+ {
+ _timeLow = a;
+ _timeMid = b;
+ _timeHighAndVersion = c;
+ _clockSeqHiAndReserved = d;
+ _clockSeqLow = e;
+ _node0 = f;
+ _node1 = g;
+ _node2 = h;
+ _node3 = i;
+ _node4 = j;
+ _node5 = k;
+ }
+
+ public static readonly Guid Empty = new Guid(0,0,0,0,0,0,0,0,0,0,0);
+
+ private static int Compare (uint x, uint y)
+ {
+ if (x < y) {
+ return -1;
+ }
+ else {
+ return 1;
+ }
+ }
+
+ public int CompareTo (object value )
+ {
+ if (value == null )
+ return 1;
+
+ if (!(value is Guid)) {
+ throw new ArgumentException (Locale.GetText (
+ "Argument of System.Guid.CompareTo should be a Guid"));
+ }
+
+ Guid v = (Guid) value;
+
+ if (_timeLow != v._timeLow ) {
+ return Compare(_timeLow, v._timeLow);
+ }
+ else if (_timeMid != v._timeMid) {
+ return Compare(_timeMid, v._timeMid);
+ }
+ else if (_timeHighAndVersion != v._timeHighAndVersion) {
+ return Compare(_timeHighAndVersion, v._timeHighAndVersion);
+ }
+ else if (_clockSeqHiAndReserved != v._clockSeqHiAndReserved) {
+ return Compare(_clockSeqHiAndReserved, v._clockSeqHiAndReserved);
+ }
+ else if (_clockSeqLow != v._clockSeqLow) {
+ return Compare(_clockSeqLow, v._clockSeqLow);
+ }
+ else if (_node0 != v._node0) {
+ return Compare(_node0, v._node0);
+ }
+ else if (_node1 != v._node1) {
+ return Compare(_node1, v._node1);
+ }
+ else if (_node2 != v._node2) {
+ return Compare(_node2, v._node2);
+ }
+ else if (_node3 != v._node3) {
+ return Compare(_node3, v._node3);
+ }
+ else if (_node4 != v._node4) {
+ return Compare(_node4, v._node4);
+ }
+ else if (_node5 != v._node5) {
+ return Compare(_node5, v._node5);
+ }
+
+ return 0;
+ }
+
+ public override bool Equals ( object o )
+ {
+ try {
+ return CompareTo (o) == 0;
+ }
+ catch ( ArgumentException ) {
+ return false;
+ }
+ }
+
+ public override int GetHashCode ()
+ {
+ int res;
+
+ res = (int) _timeLow;
+ res = res ^ ((int) _timeMid << 16 | _timeHighAndVersion);
+ res = res ^ ((int) _clockSeqHiAndReserved << 24);
+ res = res ^ ((int) _clockSeqLow << 16);
+ res = res ^ ((int) _node0 << 8);
+ res = res ^ ((int) _node1);
+ res = res ^ ((int) _node2 << 24);
+ res = res ^ ((int) _node3 << 16);
+ res = res ^ ((int) _node4 << 8);
+ res = res ^ ((int) _node5);
+
+ return res;
+ }
+
+ private static Guid NewTimeGuid()
+ {
+ ulong timestamp = _guidState.NewTimestamp ();
+
+ // Bit [31..0] (32 bits) for timeLow
+ uint timeLow = (uint) (timestamp & 0x00000000fffffffful);
+ // Bit [47..32] (16 bits) for timeMid
+ ushort timeMid = (ushort) ((timestamp & 0x0000ffff00000000ul) >> 32);
+ // Bit [59..48] (12 bits) for timeHi
+ ushort timeHi = (ushort) ((timestamp & 0x0fff000000000000ul) >> 48);
+ // Bit [7..0] (8 bits) for clockSeqLo
+ byte clockSeqLow = (byte) (Guid._guidState.ClockSeq & 0x00ffu);
+ // Bit [13..8] (6 bits) for clockSeqHi
+ byte clockSeqHi = (byte) ((Guid._guidState.ClockSeq & 0x3f00u) >> 8);
+ byte[] mac = _guidState.MAC;
+
+ clockSeqHi = (byte) (clockSeqHi | 0x80u); // Bit[7] = 1, Bit[6] = 0 (Variant)
+ timeHi = (ushort) (timeHi | 0x1000u); // Bit[15..13] = 1 (Guid is time-based)
+
+ return new Guid(timeLow, timeMid, timeHi, clockSeqHi, clockSeqLow, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+ }
+
+ private static Guid NewRandomGuid ()
+ {
+ byte[] b = new byte[16];
+
+ _guidState.NextBytes (b);
+
+ Guid res = new Guid(b);
+ // Mask in Variant 1-0 in Bit[7..6]
+ res._clockSeqHiAndReserved = (byte) ((res._clockSeqHiAndReserved & 0x3fu) | 0x80u);
+ // Mask in Version 4 (random based Guid) in Bits[15..13]
+ res._timeHighAndVersion = (ushort) ((res._timeHighAndVersion & 0x0fffu) | 0x4000u);
+ return res;
+ }
+
+ [MonoTODO]
+ public static Guid NewGuid ()
+ {
+ return NewRandomGuid();
+ }
+
+ public byte[] ToByteArray ()
+ {
+ byte[] res = new byte[16];
+ byte[] tmp;
+ int d = 0;
+ int s;
+
+ tmp = BitConverter.GetBytes(_timeLow);
+ for (s=0; s<4; ++s) {
+ res[d++] = tmp[s];
+ }
+
+ tmp = BitConverter.GetBytes(_timeMid);
+ for (s=0; s<2; ++s) {
+ res[d++] = tmp[s];
+ }
+
+ tmp = BitConverter.GetBytes(_timeHighAndVersion);
+ for (s=0; s<2; ++s) {
+ res[d++] = tmp[s];
+ }
+
+ res[8] = _clockSeqHiAndReserved;
+ res[9] = _clockSeqLow;
+ res[10] = _node0;
+ res[11] = _node1;
+ res[12] = _node2;
+ res[13] = _node3;
+ res[14] = _node4;
+ res[15] = _node5;
+
+ return res;
+ }
+
+ private string BaseToString(bool h, bool p, bool b)
+ {
+ string res = "";
+
+ if (p) {
+ res += "(";
+ }
+ else if (b) {
+ res += "{";
+ }
+
+ res += _timeLow.ToString ("x8");
+ if (h) {
+ res += "-";
+ }
+ res += _timeMid.ToString ("x4");
+ if (h) {
+ res += "-";
+ }
+ res += _timeHighAndVersion.ToString ("x4");
+ if (h) {
+ res += "-";
+ }
+ res += _clockSeqHiAndReserved.ToString ("x2");
+ res += _clockSeqLow.ToString ("x2");
+ if (h) {
+ res += "-";
+ }
+ res += _node0.ToString ("x2");
+ res += _node1.ToString ("x2");
+ res += _node2.ToString ("x2");
+ res += _node3.ToString ("x2");
+ res += _node4.ToString ("x2");
+ res += _node5.ToString ("x2");
+
+ if (p) {
+ res += ")";
+ }
+ else if (b) {
+ res += "}";
+ }
+
+ return res;
+ }
+
+ public override string ToString ()
+ {
+ return BaseToString (true, false, false);
+ }
+
+ public string ToString (string format)
+ {
+ string f;
+ bool h = true;
+ bool p = false;
+ bool b = false;
+
+ if (format != null) {
+ f = format.ToLower();
+
+ if (f == "b") {
+ b = true;
+ }
+ else if (f == "p") {
+ p = true;
+ }
+ else if (f == "n") {
+ h = false;
+ }
+ else if (f != "d" && f != "") {
+ throw new FormatException ( Locale.GetText ("Argument to Guid.ToString(string format) should be \"b\", \"B\", \"d\", \"D\", \"n\", \"N\", \"p\" or \"P\""));
+ }
+ }
+
+ return BaseToString (h, p, b);
+ }
+
+ public string ToString (string format, IFormatProvider provider)
+ {
+ return ToString (format);
+ }
+
+ public static bool operator == (Guid a, Guid b)
+ {
+ return a.Equals(b);
+ }
+
+ public static bool operator != (Guid a, Guid b)
+ {
+ return !( a.Equals (b) );
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/System/IAppDomainSetup.cs b/mcs/class/corlib/System/IAppDomainSetup.cs
new file mode 100644
index 00000000000..31eddcd62b7
--- /dev/null
+++ b/mcs/class/corlib/System/IAppDomainSetup.cs
@@ -0,0 +1,37 @@
+
+//
+// System/IAppDomainSetup.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+
+namespace System {
+
+ public interface IAppDomainSetup {
+
+ string ApplicationBase { get; set; }
+
+ string ApplicationName { get; set; }
+
+ string CachePath { get; set; }
+
+ string ConfigurationFile { get; set; }
+
+ string DynamicBase { get; set; }
+
+ string LicenseFile { get; set; }
+
+ string PrivateBinPath { get; set; }
+
+ string PrivateBinPathProbe { get; set; }
+
+ string ShadowCopyDirectories { get; set; }
+
+ string ShadowCopyFiles { get; set; }
+ }
+}
diff --git a/mcs/class/corlib/System/IAsyncResult.cs b/mcs/class/corlib/System/IAsyncResult.cs
new file mode 100644
index 00000000000..74ec69b8c7a
--- /dev/null
+++ b/mcs/class/corlib/System/IAsyncResult.cs
@@ -0,0 +1,43 @@
+//------------------------------------------------------------------------------
+//
+// System.IAsyncResult.cs
+//
+// Copyright (C) 2001 Michael Lambert, All Rights Reserved
+//
+// Author: Michael Lambert, michaellambert@email.com
+// Created: Mon 08/24/2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Threading;
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ public interface IAsyncResult
+ {
+ object AsyncState
+ {
+ get;
+ }
+
+ WaitHandle AsyncWaitHandle
+ {
+ get;
+ }
+
+ bool CompletedSynchronously
+ {
+ get;
+ }
+
+ bool IsCompleted
+ {
+ get;
+ }
+ }
+
+} // Namespace System
+
+
diff --git a/mcs/class/corlib/System/ICloneable.cs b/mcs/class/corlib/System/ICloneable.cs
new file mode 100644
index 00000000000..792550db1f5
--- /dev/null
+++ b/mcs/class/corlib/System/ICloneable.cs
@@ -0,0 +1,15 @@
+//
+// System.ICloneable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface ICloneable {
+ object Clone ();
+ }
+}
diff --git a/mcs/class/corlib/System/IComparable.cs b/mcs/class/corlib/System/IComparable.cs
new file mode 100644
index 00000000000..50af10d15e2
--- /dev/null
+++ b/mcs/class/corlib/System/IComparable.cs
@@ -0,0 +1,15 @@
+//
+// System.IComparable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface IComparable {
+ int CompareTo (object obj);
+ }
+}
diff --git a/mcs/class/corlib/System/IConvertible.cs b/mcs/class/corlib/System/IConvertible.cs
new file mode 100644
index 00000000000..95612b04c21
--- /dev/null
+++ b/mcs/class/corlib/System/IConvertible.cs
@@ -0,0 +1,55 @@
+//
+// System.IConvertible.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+//
+// Functions Implementing this interface should check out
+// System.Convert. Most of these methods are implemented
+// there for all these data types.
+//
+// System.Convert has ToType helper method for the object
+// ToType (Type conversionType, IFormatProvider provider)
+// method. In most cases you can specify your ToType function
+// as calling
+//
+// public Type value; // value of this data type
+// public object ToType(Type conversionType, IFormatProvider provider) {
+// Convert.ToType (value, conversionType, provider);
+// }
+//
+// Which is just a wrapper for your ToType methods.
+//
+// See http://lists.ximian.com/archives/public/mono-list/2001-July/000525.html
+// for more discussion on the topic
+//
+
+namespace System {
+
+ [CLSCompliant(false)]
+ public interface IConvertible {
+
+ TypeCode GetTypeCode ();
+
+ bool ToBoolean (IFormatProvider provider);
+ byte ToByte (IFormatProvider provider);
+ char ToChar (IFormatProvider provider);
+ DateTime ToDateTime (IFormatProvider provider);
+ decimal ToDecimal (IFormatProvider provider);
+ double ToDouble (IFormatProvider provider);
+ short ToInt16 (IFormatProvider provider);
+ int ToInt32 (IFormatProvider provider);
+ long ToInt64 (IFormatProvider provider);
+ sbyte ToSByte (IFormatProvider provider);
+ float ToSingle (IFormatProvider provider);
+ string ToString (IFormatProvider provider);
+ object ToType (Type conversionType, IFormatProvider provider);
+ ushort ToUInt16 (IFormatProvider provider);
+ uint ToUInt32 (IFormatProvider provider);
+ ulong ToUInt64 (IFormatProvider provider);
+ }
+}
diff --git a/mcs/class/corlib/System/ICustomFormatter.cs b/mcs/class/corlib/System/ICustomFormatter.cs
new file mode 100644
index 00000000000..1c51ab9c025
--- /dev/null
+++ b/mcs/class/corlib/System/ICustomFormatter.cs
@@ -0,0 +1,15 @@
+//
+// System.ICustomFormatter.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface ICustomFormatter {
+ string Format (string format, object arg, IFormatProvider formatProvider);
+ }
+}
diff --git a/mcs/class/corlib/System/IDisposable.cs b/mcs/class/corlib/System/IDisposable.cs
new file mode 100644
index 00000000000..6c3ca1b6367
--- /dev/null
+++ b/mcs/class/corlib/System/IDisposable.cs
@@ -0,0 +1,17 @@
+//
+// System.IDisposable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface IDisposable {
+
+ void Dispose ();
+
+ }
+}
diff --git a/mcs/class/corlib/System/IFormatProvider.cs b/mcs/class/corlib/System/IFormatProvider.cs
new file mode 100644
index 00000000000..266c62d1295
--- /dev/null
+++ b/mcs/class/corlib/System/IFormatProvider.cs
@@ -0,0 +1,15 @@
+//
+// System.IFormatProvider.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface IFormatProvider {
+ object GetFormat (Type format_type);
+ }
+}
diff --git a/mcs/class/corlib/System/IFormattable.cs b/mcs/class/corlib/System/IFormattable.cs
new file mode 100644
index 00000000000..1769f4034c0
--- /dev/null
+++ b/mcs/class/corlib/System/IFormattable.cs
@@ -0,0 +1,15 @@
+//
+// System.IFormattable.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public interface IFormattable {
+ string ToString (string format, IFormatProvider format_provider);
+ }
+}
diff --git a/mcs/class/corlib/System/IServiceProvider.cs b/mcs/class/corlib/System/IServiceProvider.cs
new file mode 100644
index 00000000000..8c07d993379
--- /dev/null
+++ b/mcs/class/corlib/System/IServiceProvider.cs
@@ -0,0 +1,18 @@
+//
+// System.IServiceProvider.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+// [ComVisible(false)]
+ public interface IServiceProvider {
+
+ object GetService (Type serviceType);
+
+ }
+}
diff --git a/mcs/class/corlib/System/IndexOutOfRangeException.cs b/mcs/class/corlib/System/IndexOutOfRangeException.cs
new file mode 100644
index 00000000000..7246ddefb7e
--- /dev/null
+++ b/mcs/class/corlib/System/IndexOutOfRangeException.cs
@@ -0,0 +1,31 @@
+//
+// System.IndexOutOfRangeException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+namespace System {
+
+ [Serializable]
+ public sealed class IndexOutOfRangeException : SystemException {
+ // Constructors
+ public IndexOutOfRangeException ()
+ : base (Locale.GetText ("Array index is out of range"))
+ {
+ }
+
+ public IndexOutOfRangeException (string message)
+ : base (message)
+ {
+ }
+
+ public IndexOutOfRangeException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Int16.cs b/mcs/class/corlib/System/Int16.cs
new file mode 100644
index 00000000000..9b03f15f59f
--- /dev/null
+++ b/mcs/class/corlib/System/Int16.cs
@@ -0,0 +1,237 @@
+//
+// System.Int16.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public struct Int16 : IComparable, IFormattable, IConvertible {
+
+ public const short MaxValue = 32767;
+ public const short MinValue = -32768;
+
+ // VES needs to know about value. public is workaround
+ // so source will compile
+ public short value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Int16))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Int16"));
+
+ short xv = (short) v;
+ if (value == xv)
+ return 0;
+ if (value > xv)
+ return 1;
+ else
+ return -1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Int16))
+ return false;
+
+ return ((short) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ public static short Parse (string s)
+ {
+ short val = 0;
+ int len;
+ int i, sign = 1;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ c = s [i];
+ if (c == '+')
+ i++;
+ else if (c == '-'){
+ sign = -1;
+ i++;
+ }
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ val = checked ((short) (val * 10 + (c - '0') * sign));
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ return val;
+ }
+
+ public static short Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ public static short Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ public static short Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ int tmpResult = Int32.Parse (s, style, fp);
+ if (tmpResult > Int16.MaxValue || tmpResult < Int16.MinValue)
+ throw new OverflowException ("Value too large or too small.");
+
+ return (short) tmpResult;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Int16;
+ }
+
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+
+ public byte ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+
+ public char ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+
+ public double ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+
+ [CLSCompliant (false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+
+ public float ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant (false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+
+ [CLSCompliant (false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+
+ [CLSCompliant (false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Int32.cs b/mcs/class/corlib/System/Int32.cs
new file mode 100644
index 00000000000..931ce9bcda2
--- /dev/null
+++ b/mcs/class/corlib/System/Int32.cs
@@ -0,0 +1,490 @@
+//
+// System.Int32.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Threading;
+
+namespace System {
+
+ [Serializable]
+ public struct Int32 : IComparable, IFormattable, IConvertible {
+
+ public const int MaxValue = 0x7fffffff;
+ public const int MinValue = -2147483648;
+
+ public int value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Int32))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Int32"));
+
+ int xv = (int) v;
+ if (value == xv)
+ return 0;
+ if (value > xv)
+ return 1;
+ else
+ return -1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Int32))
+ return false;
+
+ return ((int) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ public static int Parse (string s)
+ {
+ int val = 0;
+ int len;
+ int i, sign = 1;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ c = s [i];
+ if (c == '+')
+ i++;
+ else if (c == '-'){
+ sign = -1;
+ i++;
+ }
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ val = checked (val * 10 + (c - '0') * sign);
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ return val;
+ }
+
+ public static int Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ public static int Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ private delegate bool IsAnything (Char c);
+
+ private static void CheckStyle (NumberStyles style)
+ {
+ if ((style & NumberStyles.AllowHexSpecifier) != 0) {
+ NumberStyles ne = style ^ NumberStyles.AllowHexSpecifier;
+ if ((ne & NumberStyles.AllowLeadingWhite) != 0)
+ ne ^= NumberStyles.AllowLeadingWhite;
+ if ((ne & NumberStyles.AllowTrailingWhite) != 0)
+ ne ^= NumberStyles.AllowTrailingWhite;
+ if (ne != 0)
+ throw new ArgumentException (
+ "With AllowHexSpecifier only " +
+ "AllowLeadingWhite and AllowTrailingWhite " +
+ "are permitted.");
+ }
+ }
+
+ private static int JumpOverWhite (int pos, string s, bool excp)
+ {
+ while (pos < s.Length && Char.IsWhiteSpace (s [pos]))
+ pos++;
+
+ if (excp && pos >= s.Length)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ return pos;
+ }
+
+ private static void FindSign (ref int pos, string s, NumberFormatInfo nfi,
+ ref bool foundSign, ref bool negative)
+ {
+ if ((pos + nfi.NegativeSign.Length) <= s.Length &&
+ s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign) {
+ negative = true;
+ foundSign = true;
+ pos += nfi.NegativeSign.Length;
+ }
+ else if ((pos + nfi.PositiveSign.Length) < s.Length &&
+ s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign) {
+ negative = false;
+ pos += nfi.PositiveSign.Length;
+ foundSign = true;
+ }
+ }
+
+ private static void FindCurrency (ref int pos,
+ string s,
+ NumberFormatInfo nfi,
+ ref bool foundCurrency)
+ {
+ if ((pos + nfi.CurrencySymbol.Length) <= s.Length &&
+ s.Substring (pos, nfi.CurrencySymbol.Length) == nfi.CurrencySymbol) {
+ foundCurrency = true;
+ pos += nfi.CurrencySymbol.Length;
+ }
+ }
+
+ private static bool FindOther (ref int pos,
+ string s,
+ string other)
+ {
+ if ((pos + other.Length) <= s.Length &&
+ s.Substring (pos, other.Length) == other) {
+ pos += other.Length;
+ return true;
+ }
+
+ return false;
+ }
+
+ public static int Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ if (s == null)
+ throw new ArgumentNullException ();
+
+ if (s.Length == 0)
+ throw new FormatException ("Input string was not " +
+ "in the correct format.");
+
+ NumberFormatInfo nfi;
+ if (fp != null) {
+ Type typeNFI = typeof (System.Globalization.NumberFormatInfo);
+ nfi = (NumberFormatInfo) fp.GetFormat (typeNFI);
+ }
+ else
+ nfi = Thread.CurrentThread.CurrentCulture.NumberFormat;
+
+ CheckStyle (style);
+
+ bool AllowCurrencySymbol = (style & NumberStyles.AllowCurrencySymbol) != 0;
+ bool AllowExponent = (style & NumberStyles.AllowExponent) != 0;
+ bool AllowHexSpecifier = (style & NumberStyles.AllowHexSpecifier) != 0;
+ bool AllowThousands = (style & NumberStyles.AllowThousands) != 0;
+ bool AllowDecimalPoint = (style & NumberStyles.AllowDecimalPoint) != 0;
+ bool AllowParentheses = (style & NumberStyles.AllowParentheses) != 0;
+ bool AllowTrailingSign = (style & NumberStyles.AllowTrailingSign) != 0;
+ bool AllowLeadingSign = (style & NumberStyles.AllowLeadingSign) != 0;
+ bool AllowTrailingWhite = (style & NumberStyles.AllowTrailingWhite) != 0;
+ bool AllowLeadingWhite = (style & NumberStyles.AllowLeadingWhite) != 0;
+
+ int pos = 0;
+
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+
+ bool foundOpenParentheses = false;
+ bool negative = false;
+ bool foundSign = false;
+ bool foundCurrency = false;
+
+ // Pre-number stuff
+ if (AllowParentheses && s [pos] == '(') {
+ foundOpenParentheses = true;
+ foundSign = true;
+ negative = true; // MS always make the number negative when there parentheses
+ // even when NumberFormatInfo.NumberNegativePattern != 0!!!
+ pos++;
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+
+ if (s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign)
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ if (s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign)
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ }
+
+ if (AllowLeadingSign && !foundSign) {
+ // Sign + Currency
+ FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol) {
+ FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ if (foundCurrency && AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (foundCurrency) {
+ if (!foundSign && AllowLeadingSign) {
+ FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ if (foundSign && AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+ }
+
+ IsAnything validDigit;
+ if (AllowHexSpecifier)
+ validDigit = new IsAnything (Char.IsNumber);
+ else
+ validDigit = new IsAnything (Char.IsDigit);
+
+ int number = 0;
+ int nDigits = 0;
+ bool decimalPointFound = false;
+ int digitValue;
+ char hexDigit;
+
+ // Number stuff
+ do {
+
+ if (!validDigit (s [pos])) {
+ if (AllowThousands &&
+ FindOther (ref pos, s, nfi.NumberGroupSeparator))
+ continue;
+ else
+ if (!decimalPointFound && AllowDecimalPoint &&
+ FindOther (ref pos, s, nfi.NumberDecimalSeparator)) {
+ decimalPointFound = true;
+ continue;
+ }
+
+ break;
+ }
+ else if (AllowHexSpecifier) {
+ nDigits++;
+ hexDigit = s [pos++];
+ if (Char.IsDigit (hexDigit))
+ digitValue = (int) (hexDigit - '0');
+ else if (Char.IsLower (hexDigit))
+ digitValue = (int) (hexDigit - 'a' + 10);
+ else
+ digitValue = (int) (hexDigit - 'A' + 10);
+
+ number = checked (number * 16 - digitValue);
+ }
+ else if (decimalPointFound) {
+ nDigits++;
+ // Allows decimal point as long as it's only
+ // followed by zeroes.
+ if (s [pos++] != '0')
+ throw new OverflowException ("Value too large or too " +
+ "small.");
+ }
+ else {
+ nDigits++;
+
+ try {
+ // Calculations done as negative
+ // (abs (MinValue) > abs (MaxValue))
+ number = checked (
+ number * 10 -
+ (int) (s [pos++] - '0')
+ );
+ } catch (OverflowException) {
+ throw new OverflowException ("Value too large or too " +
+ "small.");
+ }
+ }
+ } while (pos < s.Length);
+
+ // Post number stuff
+ if (nDigits == 0)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ if (AllowTrailingSign && !foundSign) {
+ // Sign + Currency
+ FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowTrailingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol)
+ FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowTrailingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (!foundSign && AllowTrailingSign)
+ FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ }
+ }
+
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = JumpOverWhite (pos, s, false);
+
+ if (foundOpenParentheses) {
+ if (pos >= s.Length || s [pos++] != ')')
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = JumpOverWhite (pos, s, false);
+ }
+
+ if (pos < s.Length)
+ throw new FormatException ("Input string was not in the correct format.");
+
+
+ if (!negative)
+ number = -number;
+
+ return number;
+ }
+
+ public override string ToString ()
+ {
+ return IntegerFormatter.FormatGeneral(value, 0, null, true);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp )
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString (format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Int32;
+ }
+
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+ public byte ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+ public char ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+ public double ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return value;
+ }
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+ [CLSCompliant(false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+ public float ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant(false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+ [CLSCompliant(false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+ [CLSCompliant(false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Int64.cs b/mcs/class/corlib/System/Int64.cs
new file mode 100644
index 00000000000..ecfd2976cf0
--- /dev/null
+++ b/mcs/class/corlib/System/Int64.cs
@@ -0,0 +1,503 @@
+//
+// System.Int64.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Threading;
+
+namespace System {
+
+ [Serializable]
+ public struct Int64 : IComparable, IFormattable, IConvertible {
+
+ public const long MaxValue = 0x7fffffffffffffff;
+ public const long MinValue = -9223372036854775808;
+
+ public long value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Int64))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Int64"));
+
+ if (value == (long) v)
+ return 0;
+
+ if (value < (long) v)
+ return -1;
+
+ return 1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Int64))
+ return false;
+
+ return ((long) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)(value & 0xffffffff) ^ (int)(value >> 32);
+ }
+
+ public static long Parse (string s)
+ {
+ long val = 0;
+ int len;
+ int i;
+ int sign = 1;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ c = s [i];
+ if (c == '+')
+ i++;
+ else if (c == '-'){
+ sign = -1;
+ i++;
+ }
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ val = checked (val * 10 + (c - '0') * sign);
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ return val;
+ }
+
+ public static long Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ public static long Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ private delegate bool IsAnything (Char c);
+
+ private static void CheckStyle (NumberStyles style)
+ {
+ if ((style & NumberStyles.AllowHexSpecifier) != 0) {
+ NumberStyles ne = style ^ NumberStyles.AllowHexSpecifier;
+ if ((ne & NumberStyles.AllowLeadingWhite) != 0)
+ ne ^= NumberStyles.AllowLeadingWhite;
+ if ((ne & NumberStyles.AllowTrailingWhite) != 0)
+ ne ^= NumberStyles.AllowTrailingWhite;
+ if (ne != 0)
+ throw new ArgumentException (
+ "With AllowHexSpecifier only " +
+ "AllowLeadingWhite and AllowTrailingWhite " +
+ "are permitted.");
+ }
+ }
+
+ private static int JumpOverWhite (int pos, string s, bool excp)
+ {
+ while (pos < s.Length && Char.IsWhiteSpace (s [pos]))
+ pos++;
+
+ if (excp && pos >= s.Length)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ return pos;
+ }
+
+ private static void FindSign (ref int pos, string s, NumberFormatInfo nfi,
+ ref bool foundSign, ref bool negative)
+ {
+ if ((pos + nfi.NegativeSign.Length) <= s.Length &&
+ s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign) {
+ negative = true;
+ foundSign = true;
+ pos += nfi.NegativeSign.Length;
+ }
+ else if ((pos + nfi.PositiveSign.Length) < s.Length &&
+ s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign) {
+ negative = false;
+ pos += nfi.PositiveSign.Length;
+ foundSign = true;
+ }
+ }
+
+ private static void FindCurrency (ref int pos,
+ string s,
+ NumberFormatInfo nfi,
+ ref bool foundCurrency)
+ {
+ if ((pos + nfi.CurrencySymbol.Length) <= s.Length &&
+ s.Substring (pos, nfi.CurrencySymbol.Length) == nfi.CurrencySymbol) {
+ foundCurrency = true;
+ pos += nfi.CurrencySymbol.Length;
+ }
+ }
+
+ private static bool FindOther (ref int pos,
+ string s,
+ string other)
+ {
+ if ((pos + other.Length) <= s.Length &&
+ s.Substring (pos, other.Length) == other) {
+ pos += other.Length;
+ return true;
+ }
+
+ return false;
+ }
+
+ public static long Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ if (s == null)
+ throw new ArgumentNullException ();
+
+ if (s.Length == 0)
+ throw new FormatException ("Input string was not " +
+ "in the correct format.");
+
+ NumberFormatInfo nfi;
+ if (fp != null) {
+ Type typeNFI = typeof (System.Globalization.NumberFormatInfo);
+ nfi = (NumberFormatInfo) fp.GetFormat (typeNFI);
+ }
+ else
+ nfi = Thread.CurrentThread.CurrentCulture.NumberFormat;
+
+ CheckStyle (style);
+
+ bool AllowCurrencySymbol = (style & NumberStyles.AllowCurrencySymbol) != 0;
+ bool AllowExponent = (style & NumberStyles.AllowExponent) != 0;
+ bool AllowHexSpecifier = (style & NumberStyles.AllowHexSpecifier) != 0;
+ bool AllowThousands = (style & NumberStyles.AllowThousands) != 0;
+ bool AllowDecimalPoint = (style & NumberStyles.AllowDecimalPoint) != 0;
+ bool AllowParentheses = (style & NumberStyles.AllowParentheses) != 0;
+ bool AllowTrailingSign = (style & NumberStyles.AllowTrailingSign) != 0;
+ bool AllowLeadingSign = (style & NumberStyles.AllowLeadingSign) != 0;
+ bool AllowTrailingWhite = (style & NumberStyles.AllowTrailingWhite) != 0;
+ bool AllowLeadingWhite = (style & NumberStyles.AllowLeadingWhite) != 0;
+
+ int pos = 0;
+
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+
+ bool foundOpenParentheses = false;
+ bool negative = false;
+ bool foundSign = false;
+ bool foundCurrency = false;
+
+ // Pre-number stuff
+ if (AllowParentheses && s [pos] == '(') {
+ foundOpenParentheses = true;
+ foundSign = true;
+ negative = true; // MS always make the number negative when there parentheses
+ // even when NumberFormatInfo.NumberNegativePattern != 0!!!
+ pos++;
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+
+ if (s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign)
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ if (s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign)
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ }
+
+ if (AllowLeadingSign && !foundSign) {
+ // Sign + Currency
+ FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol) {
+ FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ if (foundCurrency && AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (foundCurrency) {
+ if (!foundSign && AllowLeadingSign) {
+ FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ if (foundSign && AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+ }
+
+ IsAnything validDigit;
+ if (AllowHexSpecifier)
+ validDigit = new IsAnything (Char.IsNumber);
+ else
+ validDigit = new IsAnything (Char.IsDigit);
+
+ long number = 0;
+ int nDigits = 0;
+ bool decimalPointFound = false;
+ int digitValue;
+ char hexDigit;
+
+ // Number stuff
+ do {
+
+ if (!validDigit (s [pos])) {
+ if (AllowThousands &&
+ FindOther (ref pos, s, nfi.NumberGroupSeparator))
+ continue;
+ else
+ if (!decimalPointFound && AllowDecimalPoint &&
+ FindOther (ref pos, s, nfi.NumberDecimalSeparator)) {
+ decimalPointFound = true;
+ continue;
+ }
+
+ break;
+ }
+ else if (AllowHexSpecifier) {
+ nDigits++;
+ hexDigit = s [pos++];
+ if (Char.IsDigit (hexDigit))
+ digitValue = (int) (hexDigit - '0');
+ else if (Char.IsLower (hexDigit))
+ digitValue = (int) (hexDigit - 'a' + 10);
+ else
+ digitValue = (int) (hexDigit - 'A' + 10);
+
+ number = checked (number * 16 - digitValue);
+ }
+ else if (decimalPointFound) {
+ nDigits++;
+ // Allows decimal point as long as it's only
+ // followed by zeroes.
+ if (s [pos++] != '0')
+ throw new OverflowException ("Value too large or too " +
+ "small.");
+ }
+ else {
+ nDigits++;
+
+ try {
+ // Calculations done as negative
+ // (abs (MinValue) > abs (MaxValue))
+ number = checked (
+ number * 10 -
+ (long) (s [pos++] - '0')
+ );
+ } catch (OverflowException) {
+ throw new OverflowException ("Value too large or too " +
+ "small.");
+ }
+ }
+ } while (pos < s.Length);
+
+ // Post number stuff
+ if (nDigits == 0)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ if (AllowTrailingSign && !foundSign) {
+ // Sign + Currency
+ FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowTrailingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol)
+ FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowTrailingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (!foundSign && AllowTrailingSign)
+ FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ }
+ }
+
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = JumpOverWhite (pos, s, false);
+
+ if (foundOpenParentheses) {
+ if (pos >= s.Length || s [pos++] != ')')
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = JumpOverWhite (pos, s, false);
+ }
+
+ if (pos < s.Length)
+ throw new FormatException ("Input string was not in the correct format.");
+
+
+ if (!negative)
+ number = -number;
+
+ return number;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString (format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Int64;
+ }
+
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+
+ public byte ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+
+ public char ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+
+ public double ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+
+ [CLSCompliant (false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+
+ public float ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant (false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+
+ [CLSCompliant (false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+
+ [CLSCompliant (false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/IntPtr.cs b/mcs/class/corlib/System/IntPtr.cs
new file mode 100644
index 00000000000..bb12f2482f1
--- /dev/null
+++ b/mcs/class/corlib/System/IntPtr.cs
@@ -0,0 +1,165 @@
+//
+// System.IntPtr.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// Maintainer:
+// Michael Lambert, michaellambert@email.com
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// Remarks: Requires '/unsafe' compiler option. This class uses void*,
+// in overloaded constructors, conversion, and cast members in
+// the public interface. Using pointers is not valid CLS and
+// the methods in question have been marked with the
+// CLSCompliant attribute that avoid compiler warnings.
+//
+// FIXME: How do you specify a native int in C#? I am going to have to do some figuring out
+//
+
+using System;
+using System.Runtime.Serialization;
+
+#if __MonoCS__
+#else
+[
+ assembly: System.CLSCompliant(true)
+]
+#endif
+
+namespace System {
+
+ [
+ CLSCompliant(true)
+ ]
+ [Serializable]
+ public unsafe struct IntPtr : ISerializable {
+
+ private void *value;
+
+ public static readonly IntPtr Zero;
+
+ static IntPtr ()
+ {
+ Zero.value = (void *) 0;
+ }
+
+ public IntPtr (int i32)
+ {
+ value = (void *) i32;
+ }
+
+ public IntPtr (long i64)
+ {
+ value = (void *) i64;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ unsafe public IntPtr (void *ptr)
+ {
+ value = ptr;
+ }
+
+ public static int Size {
+ get {
+ return sizeof (void *);
+ }
+ }
+
+ public void GetObjectData (SerializationInfo si, StreamingContext sc)
+ {
+ if( si == null )
+ throw new ArgumentNullException( "si" );
+
+ si.AddValue("value", (long) value);
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.IntPtr))
+ return false;
+
+ return ((IntPtr) o).value == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) value;
+ }
+
+ public int ToInt32 ()
+ {
+ return (int) value;
+ }
+
+ public long ToInt64 ()
+ {
+ return (long) value;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ unsafe public void *ToPointer ()
+ {
+ return value;
+ }
+
+ override public string ToString ()
+ {
+ if (Size == 4)
+ return ((int) value).ToString ();
+ else
+ return ((long) value).ToString ();
+ }
+
+ public static bool operator == (IntPtr a, IntPtr b)
+ {
+ return (a.value == b.value);
+ }
+
+ public static bool operator != (IntPtr a, IntPtr b)
+ {
+ return (a.value != b.value);
+ }
+
+ public static explicit operator IntPtr (int value)
+ {
+ return new IntPtr (value);
+ }
+
+ public static explicit operator IntPtr (long value)
+ {
+ return new IntPtr (value);
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ unsafe public static explicit operator IntPtr (void *value)
+ {
+ return new IntPtr (value);
+ }
+
+ public static explicit operator int (IntPtr value)
+ {
+ return (int) value.value;
+ }
+
+ public static explicit operator long (IntPtr value)
+ {
+ return (long) value.value;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ unsafe public static explicit operator void * (IntPtr value)
+ {
+ return value.value;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/IntegerFormatter.cs b/mcs/class/corlib/System/IntegerFormatter.cs
new file mode 100644
index 00000000000..cf162fac9a6
--- /dev/null
+++ b/mcs/class/corlib/System/IntegerFormatter.cs
@@ -0,0 +1,4027 @@
+//
+// System.IntegerFormatter.cs
+//
+// Author:
+// Derek Holden (dholden@draper.com)
+//
+// (C) Derek Holden dholden@draper.com
+//
+
+//
+// Format integer types. Completely based off ECMA docs
+// for IFormattable specification. Has been tested w/
+// all integral types, from boundry to boundry, w/ all
+// formats A## ("G", "G0" ... "G99", "P", "P0" ... "P99").
+//
+// If you make any changes, please make sure to check the
+// boundry format precisions (0, 99) and the min / max values
+// of the data types (Int32.[Max/Min]Value).
+//
+// Using int as an example, it is currently set up as
+//
+// Int32 {
+// int value;
+// public string ToString (string format, NumberFormatInfo nfi) {
+// return IntegerFormatter.NumberToString (format, nfi, value);
+// }
+//
+// IntegerFormatter {
+// public string NumberToString (string format, NumberFormatInfo nfi, int value) {
+// ParseFormat (format);
+// switch (format type) {
+// case 'G' FormatGeneral(value, precision);
+// case 'R' throw Exception("Invalid blah blah");
+// case 'C' FromatCurrency(value, precision, nfi);
+// etc...
+// }
+// }
+// }
+//
+// There is a property in NumberFormatInfo for NegativeSign, though the
+// definition of IFormattable just uses '-' in context. So all the
+// hardcoded uses of '-' in here may need to be changed to nfi.NegativeSign
+//
+// For every integral type.
+//
+// Before every Format<Format Type> block there is a small paragraph
+// detailing its requirements, and a blurb of what I was thinking
+// at the time.
+//
+// Some speedup suggestions to be done when after this appears
+// to be working properly:
+//
+// * Deal w/ out of range numbers better. Specifically with
+// regards to boundry cases such as Long.MinValue etc.
+// The previous way of if (value < 0) value = -value;
+// fails under this assumption, since the largest
+// possible MaxValue is < absolute value of the MinValue.
+// I do the first iteration outside of the loop, and then
+// convert the number to positive, then continue in the loop.
+//
+// * Replace all occurances of max<Type>Length with their
+// numerical values. Plus the places where things are set
+// to max<Type>Length - 1. Hardcode these to numbers.
+//
+// * Move the code for all the NumberToString()'s into the
+// the main ToString (string, NumberFormatInfo) method in
+// the data types themselves. That way they'd be throwing
+// their own exceptions on error and it'd save a function
+// call.
+//
+// * For integer to char buffer transformation, you could
+// implement the calculations of the 10's and 100's place
+// the same time w/ another table to shorten loop time.
+//
+// * Someone smarter can prolly find a much more efficient
+// way of formatting the exponential notation. It's still
+// done in pass, just may have too many repositioning
+// calculations.
+//
+// * Decide whether it be better to have functions that
+// handle formatting for all types, or just cast their
+// values out and format them. Just if library size is
+// more important than speed in saving a cast and a
+// function call.
+//
+
+using System;
+using System.Collections;
+using System.Globalization;
+
+namespace System {
+
+ public sealed class IntegerFormatter {
+
+ private static int maxByteLength = 4;
+ private static int maxShortLength = 6;
+ private static int maxIntLength = 12;
+ private static int maxLongLength = 22;
+
+ private static char[] digitLowerTable;
+/**
+ * This makes a TypeNotInitialized exception be thrown.
+ * { '0', '1', '2', '3', '4', '5', '6', '7',
+ * '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+ */
+
+ private static char[] digitUpperTable;
+/*
+ * { '0', '1', '2', '3', '4', '5', '6', '7',
+ * '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+ */
+
+ static IntegerFormatter ()
+ {
+ int i;
+
+ digitLowerTable = new char[16];
+ digitUpperTable = new char[16];
+
+ for (i = 0; i < 10; i++){
+ digitLowerTable[i] = (char) ('0' + i);
+ digitUpperTable[i] = (char) ('0' + i);
+ }
+
+ char lc = (char ) ('a' - i);
+ char uc = (char ) ('A' - i);
+ while (i < 16){
+ digitLowerTable[i] = (char) (lc + i);
+ digitUpperTable[i] = (char) (uc + i);
+ i++;
+ }
+ }
+
+ private static bool IsDigit (char c)
+ {
+ return !(c < '0' || c > '9');
+ }
+
+ private static bool IsLetter (char c)
+ {
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
+ }
+
+ private static bool ParseFormat (string format, out char specifier, out int precision, out bool custom)
+ {
+ precision = -1;
+ specifier = '\0';
+ custom = false;
+
+ int length = format.Length;
+ // TODO: Could an empty string be a custom format string?
+ if (length < 1)
+ return false;
+
+ char[] chars = format.ToCharArray ();
+ specifier = chars[0];
+
+ // TODO: IsLetter() and IsDigit() should be replaced by Char.Is*()
+ if (IsLetter(specifier) && length <= 3) {
+ switch (length){
+ case 1:
+ return true;
+ case 2:
+ if (IsDigit(chars[1])) {
+ precision = chars[1] - '0';
+ return true;
+ }
+ break;
+ case 3:
+ if (IsDigit(chars[1]) && IsDigit(chars[2])) {
+ precision = chars[1] - '0';
+ precision = precision * 10 + chars[2] - '0';
+ return true;
+ }
+ break;
+ }
+
+ }
+
+ // We've got a custom format string.
+ custom = true;
+ return true;
+ }
+
+ // ============ Public Interface to all the integer types ============ //
+
+ public static string NumberToString (string format, NumberFormatInfo nfi, byte value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ public static string NumberToString (string format, NumberFormatInfo nfi, short value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this insance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ public static string NumberToString (string format, NumberFormatInfo nfi, int value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ public static string NumberToString (string format, NumberFormatInfo nfi, long value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ [CLSCompliant (false)]
+ public static string NumberToString (string format, NumberFormatInfo nfi, sbyte value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ [CLSCompliant (false)]
+ public static string NumberToString (string format, NumberFormatInfo nfi, ushort value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ [CLSCompliant (false)]
+ public static string NumberToString (string format, NumberFormatInfo nfi, uint value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ [CLSCompliant (false)]
+ public static string NumberToString (string format, NumberFormatInfo nfi, ulong value)
+ {
+ char specifier;
+ int precision;
+ bool custom;
+
+ if (!ParseFormat (format, out specifier, out precision, out custom))
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+
+ if (custom){
+ return FormatCustom (format, value, nfi);
+ }
+
+ switch(specifier) {
+ case 'c': return FormatCurrency (value, precision, nfi);
+ case 'C': return FormatCurrency (value, precision, nfi);
+ case 'd': return FormatDecimal (value, precision);
+ case 'D': return FormatDecimal (value, precision);
+ case 'e': return FormatExponential (value, precision, false);
+ case 'E': return FormatExponential (value, precision, true);
+ case 'f': return FormatFixedPoint (value, precision, nfi);
+ case 'F': return FormatFixedPoint (value, precision, nfi);
+ case 'g': return FormatGeneral (value, precision, nfi, false);
+ case 'G': return FormatGeneral (value, precision, nfi, true);
+ case 'n': return FormatNumber (value, precision, nfi);
+ case 'N': return FormatNumber (value, precision, nfi);
+ case 'p': return FormatPercent (value, precision, nfi);
+ case 'P': return FormatPercent (value, precision, nfi);
+ case 'r': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'R': throw new FormatException (Locale.GetText ("The specified format cannot be used in this instance"));
+ case 'x': return FormatHexadecimal (value, precision, false);
+ case 'X': return FormatHexadecimal (value, precision, true);
+ default:
+ throw new FormatException (Locale.GetText ("The specified format '" + format + "' is invalid"));
+ }
+ }
+
+ // ============ Currency Type Formating ============ //
+
+ //
+ // Currency Format: Used for strings containing a monetary value. The
+ // CurrencySymbol, CurrencyGroupSizes, CurrencyGroupSeparator, and
+ // CurrencyDecimalSeparator members of a NumberFormatInfo supply
+ // the currency symbol, size and separator for digit groupings, and
+ // decimal separator, respectively.
+ // CurrencyNegativePattern and CurrencyPositivePattern determine the
+ // symbols used to represent negative and positive values. For example,
+ // a negative value may be prefixed with a minus sign, or enclosed in
+ // parentheses.
+ // If the precision specifier is omitted
+ // NumberFormatInfo.CurrencyDecimalDigits determines the number of
+ // decimal places in the string. Results are rounded to the nearest
+ // representable value when necessary.
+ //
+ // The pattern of the NumberFormatInfo determines how the output looks, where
+ // the dollar sign goes, where the negative sign goes, etc.
+ // IFormattable documentation lists the patterns and their values,
+ // I have them commented out in the large switch statement
+ //
+
+ private static string FormatCurrency (byte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatCurrency ((uint)value, precision, nfi);
+ }
+
+ private static string FormatCurrency (short value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatCurrency ((int)value, precision, nfi);
+ }
+
+ private static string FormatCurrency (int value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ bool negative = (value < 0);
+
+ char[] groupSeparator = nfi.CurrencyGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.CurrencyDecimalSeparator.ToCharArray ();
+ char[] currencySymbol = nfi.CurrencySymbol.ToCharArray ();
+ int[] groupSizes = nfi.CurrencyGroupSizes;
+ int pattern = negative ? nfi.CurrencyNegativePattern : nfi.CurrencyPositivePattern;
+ int symbolLength = currencySymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.CurrencyDecimalDigits;
+ int size = maxIntLength + (groupSeparator.Length * maxIntLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // ($nnn)
+ buffy[--position] = ')';
+ break;
+ // case 1: // -$nnn
+ // break;
+ // case 2: // $-nnn
+ // break;
+ case 3: // $nnn-
+ buffy[--position] = '-';
+ break;
+ case 4: // (nnn$)
+ buffy[--position] = ')';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 5: // -nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 6: // nnn-$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ case 7: // nnn$-
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 8: // -nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ // case 9: // -$ nnn
+ // break;
+ case 10: // nnn $-
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 11: // $ nnn-
+ buffy[--position] = '-';
+ break;
+ // case 12: // $ -nnn
+ // break;
+ case 13: // nnn- $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ buffy[--position] = '-';
+ break;
+ case 14: // ($ nnn)
+ buffy[--position] = ')';
+ break;
+ case 15: // (nnn $)
+ buffy[--position] = ')';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // $nnn
+ // break;
+ case 1: // nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // $ nnn
+ // break;
+ case 3: // nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ // just in place to take care of the negative boundries (Int32.MinValue)
+ if (negative) {
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+ }
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // ($nnn)
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '(';
+ break;
+ case 1: // -$nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ case 2: // $-nnn
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 3: // $nnn-
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 4: // (nnn$)
+ buffy[--position] = '(';
+ break;
+ case 5: // -nnn$
+ buffy[--position] = '-';
+ break;
+ // case 6: // nnn-$
+ // break;
+ // case 7: // nnn$-
+ // break;
+ case 8: // -nnn $
+ buffy[--position] = '-';
+ break;
+ // case 9: // -$ nnn
+ // break;
+ // case 10: // nnn $-
+ // break;
+ case 11: // $ nnn-
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 12: // $ -nnn
+ buffy[--position] = '-';
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 13: // nnn- $
+ // break;
+ case 14: // ($ nnn)
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '(';
+ break;
+ case 15: // (nnn $)
+ buffy[--position] = '(';
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // $nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 1: // nnn$
+ // break;
+ case 2: // $ nnn
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 3: // nnn $
+ // break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatCurrency (long value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ bool negative = (value < 0);
+
+ char[] groupSeparator = nfi.CurrencyGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.CurrencyDecimalSeparator.ToCharArray ();
+ char[] currencySymbol = nfi.CurrencySymbol.ToCharArray ();
+ int[] groupSizes = nfi.CurrencyGroupSizes;
+ int pattern = negative ? nfi.CurrencyNegativePattern : nfi.CurrencyPositivePattern;
+ int symbolLength = currencySymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.CurrencyDecimalDigits;
+ int size = maxLongLength + (groupSeparator.Length * maxLongLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // ($nnn)
+ buffy[--position] = ')';
+ break;
+ // case 1: // -$nnn
+ // break;
+ // case 2: // $-nnn
+ // break;
+ case 3: // $nnn-
+ buffy[--position] = '-';
+ break;
+ case 4: // (nnn$)
+ buffy[--position] = ')';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 5: // -nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 6: // nnn-$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ case 7: // nnn$-
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 8: // -nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ // case 9: // -$ nnn
+ // break;
+ case 10: // nnn $-
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 11: // $ nnn-
+ buffy[--position] = '-';
+ break;
+ // case 12: // $ -nnn
+ // break;
+ case 13: // nnn- $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ buffy[--position] = '-';
+ break;
+ case 14: // ($ nnn)
+ buffy[--position] = ')';
+ break;
+ case 15: // (nnn $)
+ buffy[--position] = ')';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // $nnn
+ // break;
+ case 1: // nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // $ nnn
+ // break;
+ case 3: // nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ if (negative) {
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+ }
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // ($nnn)
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '(';
+ break;
+ case 1: // -$nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ case 2: // $-nnn
+ buffy[--position] = '-';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 3: // $nnn-
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 4: // (nnn$)
+ buffy[--position] = '(';
+ break;
+ case 5: // -nnn$
+ buffy[--position] = '-';
+ break;
+ // case 6: // nnn-$
+ // break;
+ // case 7: // nnn$-
+ // break;
+ case 8: // -nnn $
+ buffy[--position] = '-';
+ break;
+ // case 9: // -$ nnn
+ // break;
+ // case 10: // nnn $-
+ // break;
+ case 11: // $ nnn-
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ case 12: // $ -nnn
+ buffy[--position] = '-';
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 13: // nnn- $
+ // break;
+ case 14: // ($ nnn)
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '(';
+ break;
+ case 15: // (nnn $)
+ buffy[--position] = '(';
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // $nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 1: // nnn$
+ // break;
+ case 2: // $ nnn
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 3: // nnn $
+ // break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatCurrency (sbyte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatCurrency ((int)value, precision, nfi);
+ }
+
+ private static string FormatCurrency (ushort value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatCurrency ((uint)value, precision, nfi);
+ }
+
+ private static string FormatCurrency (uint value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+
+ char[] groupSeparator = nfi.CurrencyGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.CurrencyDecimalSeparator.ToCharArray ();
+ char[] currencySymbol = nfi.CurrencySymbol.ToCharArray ();
+ int[] groupSizes = nfi.CurrencyGroupSizes;
+ int pattern = nfi.CurrencyPositivePattern;
+ int symbolLength = currencySymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.CurrencyDecimalDigits;
+ int size = maxIntLength + (groupSeparator.Length * maxIntLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible, no negative
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // $nnn
+ // break;
+ case 1: // nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // $ nnn
+ // break;
+ case 3: // nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // $nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 1: // nnn$
+ // break;
+ case 2: // $ nnn
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 3: // nnn $
+ // break;
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatCurrency (ulong value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+
+ char[] groupSeparator = nfi.CurrencyGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.CurrencyDecimalSeparator.ToCharArray ();
+ char[] currencySymbol = nfi.CurrencySymbol.ToCharArray ();
+ int[] groupSizes = nfi.CurrencyGroupSizes;
+ int pattern = nfi.CurrencyPositivePattern;
+ int symbolLength = currencySymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.CurrencyDecimalDigits;
+ int size = maxLongLength + (groupSeparator.Length * maxLongLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible, no negative
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // $nnn
+ // break;
+ case 1: // nnn$
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // $ nnn
+ // break;
+ case 3: // nnn $
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // $nnn
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 1: // nnn$
+ // break;
+ case 2: // $ nnn
+ buffy[--position] = ' ';
+ do {
+ buffy[--position] = currencySymbol[--i];
+ } while (i > 0);
+ break;
+ // case 3: // nnn $
+ // break;
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ // ============ Format Decimal Types ============ //
+
+ //
+ // Used only for integral data types. Negative values are
+ // represented by using a '-' sign. The precision specifies
+ // how many digits are to appear in the string. If it is >
+ // how many digits we need, the left side is padded w/ 0's.
+ // If it is smaller than what we need, it is discarded.
+ //
+ // Fairly simple implementation. Fill the buffer from right
+ // to left w/ numbers, then if we still have precision left
+ // over, pad w/ zeros.
+ //
+
+ private static string FormatDecimal (byte value, int precision)
+ {
+ return FormatDecimal ((uint)value, precision);
+ }
+
+ private static string FormatDecimal (short value, int precision)
+ {
+ return FormatDecimal ((int)value, precision);
+ }
+
+ private static string FormatDecimal (int value, int precision)
+ {
+ int size = (precision > 0) ? (maxIntLength + precision) : maxIntLength;
+ char[] buffy = new char[size];
+ int position = size;
+ bool negative = (value < 0);
+
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+ } else value = -value;
+
+ // get our value into a buffer from right to left
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // if we have precision left over, fill with 0's
+ precision -= (size - position);
+ while (precision-- > 0 && position > 1)
+ buffy[--position] = '0';
+
+ if (negative)
+ buffy[--position] = '-';
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatDecimal (long value, int precision)
+ {
+ int size = (precision > 0) ? (maxLongLength + precision) : maxLongLength;
+ char[] buffy = new char[size];
+ int position = size;
+ bool negative = (value < 0);
+
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+ } else value = -value;
+
+ // get our value into a buffer from right to left
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // if we have precision left over, fill with 0's
+ precision -= (size - position);
+ while (precision-- > 0 && position > 1)
+ buffy[--position] = '0';
+
+ if (negative)
+ buffy[--position] = '-';
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatDecimal (sbyte value, int precision)
+ {
+ return FormatDecimal ((int)value, precision);
+ }
+
+ private static string FormatDecimal (ushort value, int precision)
+ {
+ return FormatDecimal ((uint)value, precision);
+ }
+
+ private static string FormatDecimal (uint value, int precision)
+ {
+ int size = (precision > 0) ? (maxIntLength + precision) : maxIntLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // get our value into a buffer from right to left
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // if we have precision left over, fill with 0's
+ precision -= (size - position);
+ while (precision-- > 0 && position > 1)
+ buffy[--position] = '0';
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatDecimal (ulong value, int precision)
+ {
+ int size = (precision > 0) ? (maxLongLength + precision) : maxLongLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // get our value into a buffer from right to left
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // if we have precision left over, fill with 0's
+ precision -= (size - position);
+ while (precision-- > 0 && position > 1)
+ buffy[--position] = '0';
+
+ return new string (buffy, position, (size - position));
+ }
+
+ // ============ Format Exponentials ============ //
+
+ //
+ // Used for strings in the format [-]M.DDDDDDe+XXX.
+ // Exaclty one non-zero digit must appear in M, w/
+ // a '-' sign if negative. The precision determines
+ // number of decimal places, if not given go 6 places.
+ // If precision > the number of places we need, it
+ // is right padded w/ 0's. If it is smaller than what
+ // we need, we cut off and round. The format specifier
+ // decides whether we use an uppercase E or lowercase e.
+ //
+ // Tried to do this in one pass of one buffer, but it
+ // wasn't happening. Get a buffer + 7 extra slots for
+ // the -, ., E, +, and XXX. Parse the value into another
+ // temp buffer, then build the new string. For the
+ // integral data types, there are a couple things that
+ // can be hardcoded. Since an int and a long can't be
+ // larger than 20 something spaces, the first X w/
+ // always be 0, and the the exponential value will only
+ // be 2 digits long. Also integer types w/ always
+ // have a positive exponential.
+ //
+
+ private static string FormatExponential (byte value, int precision, bool upper)
+ {
+ return FormatExponential ((uint)value, precision, upper);
+ }
+
+ private static string FormatExponential (short value, int precision, bool upper)
+ {
+ return FormatExponential ((int)value, precision, upper);
+ }
+
+ private static string FormatExponential (int value, int precision, bool upper)
+ {
+ bool negative = (value < 0);
+ int padding = (precision >= 0) ? precision : 6;
+ char[] buffy = new char[(padding + 8)];
+ char[] tmp = new char [maxIntLength];
+ int exponent = 0, position = maxIntLength;
+ int exp = 0, idx = 0;
+ ulong pow = 10;
+
+ // ugly, but doing it since abs(Int32.MinValue) > Int.MaxValue
+ uint number = (negative) ? (uint)((-(value + 1)) + 1) : (uint)value;
+
+ // need to calculate the number of places to know if we need to round later
+ if (negative && value <= -10) {
+ value /= -10;
+ exp++;
+ }
+
+ while (value >= 10) {
+ value /= 10;
+ exp++;
+ }
+
+ if (exp > padding) {
+
+ // highest number we should goto before we round
+ while (idx++ <= padding)
+ pow *= 10;
+
+ // get our value into a buffer
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+ }
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number% 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+ idx = 0;
+
+ // go left to right in filling up new string
+ if (negative)
+ buffy[idx++] = '-';
+
+ // we know we have at least one in there, followed
+ // by a decimal point
+ buffy[idx++] = tmp[position++];
+ if (precision != 0)
+ buffy[idx++] = '.';
+
+ // copy over the remaining digits until we run out,
+ // or we've passed our specified precision
+ while (padding > 0 && position < maxIntLength) {
+ buffy[idx++] = tmp[position++];
+ padding--;
+ }
+
+ // if we still have more precision to go, add some
+ // zeros
+ while (padding > 0) {
+ buffy[idx++] = '0';
+ padding--;
+ }
+
+ // we know these next 3 spots
+ buffy[idx++] = upper ? 'E' : 'e';
+ buffy[idx++] = '+';
+ buffy[idx++] = '0';
+
+ // next two digits depend on our length
+ if (exponent >= 10) {
+ buffy[idx++] = digitLowerTable[(exponent / 10)];
+ buffy[idx] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[idx++] = '0';
+ buffy[idx] = digitLowerTable[exponent];
+ }
+
+ return new string(buffy, 0, ++idx);
+ }
+
+ private static string FormatExponential (long value, int precision, bool upper)
+ {
+ bool negative = (value < 0);
+ int padding = (precision >= 0) ? precision : 6;
+ char[] buffy = new char[(padding + 8)];
+ char[] tmp = new char [maxLongLength];
+ int exponent = 0, position = maxLongLength;
+ int exp = 0, idx = 0;
+ ulong pow = 10;
+
+ // ugly, but doing it since abs(Int32.MinValue) > Int.MaxValue
+ ulong number = (negative) ? (ulong)((-(value + 1)) + 1) : (ulong)value;
+
+ // need to calculate the number of places to know if we need to round later
+ if (negative && value <= -10) {
+ value /= -10;
+ exp++;
+ }
+
+ while (value >= 10) {
+ value /= 10;
+ exp++;
+ }
+
+ if (exp > padding) {
+
+ // highest number we should goto before we round
+ while (idx++ <= padding)
+ pow *= 10;
+
+ // get our value into a buffer
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+ }
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number% 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+ idx = 0;
+
+ // go left to right in filling up new string
+ if (negative)
+ buffy[idx++] = '-';
+
+ // we know we have at least one in there, followed
+ // by a decimal point
+ buffy[idx++] = tmp[position++];
+ if (precision != 0)
+ buffy[idx++] = '.';
+
+ // copy over the remaining digits until we run out,
+ // or we've passed our specified precision
+ while (padding > 0 && position < maxLongLength) {
+ buffy[idx++] = tmp[position++];
+ padding--;
+ }
+
+ // if we still have more precision to go, add some
+ // zeros
+ while (padding > 0) {
+ buffy[idx++] = '0';
+ padding--;
+ }
+
+ // we know these next 3 spots
+ buffy[idx++] = upper ? 'E' : 'e';
+ buffy[idx++] = '+';
+ buffy[idx++] = '0';
+
+ // next two digits depend on our length
+ if (exponent >= 10) {
+ buffy[idx++] = digitLowerTable[(exponent / 10)];
+ buffy[idx] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[idx++] = '0';
+ buffy[idx] = digitLowerTable[exponent];
+ }
+
+ return new string(buffy, 0, ++idx);
+ }
+
+ private static string FormatExponential (sbyte value, int precision, bool upper)
+ {
+ return FormatExponential ((int)value, precision, upper);
+ }
+
+ private static string FormatExponential (ushort value, int precision, bool upper)
+ {
+ return FormatExponential ((uint)value, precision, upper);
+ }
+
+ private static string FormatExponential (uint value, int precision, bool upper)
+ {
+ int padding = (precision >= 0) ? precision : 6;
+ char[] buffy = new char[(padding + 8)];
+ char[] tmp = new char [maxIntLength];
+ int exponent = 0, position = maxIntLength;
+ int exp = 0, idx = 0;
+ ulong pow = 10;
+ ulong number = (ulong)value;
+
+ // need to calculate the number of places to know if we need to round later
+ while (value >= 10) {
+ value /= 10;
+ exp++;
+ }
+
+ if (exp > padding) {
+
+ // highest number we should goto before we round
+ while (idx++ <= padding)
+ pow *= 10;
+
+ // get our value into a buffer
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+ }
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number% 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+ idx = 0;
+
+ // we know we have at least one in there, followed
+ // by a decimal point
+ buffy[idx++] = tmp[position++];
+ if (precision != 0)
+ buffy[idx++] = '.';
+
+ // copy over the remaining digits until we run out,
+ // or we've passed our specified precision
+ while (padding > 0 && position < maxIntLength) {
+ buffy[idx++] = tmp[position++];
+ padding--;
+ }
+
+ // if we still have more precision to go, add some
+ // zeros
+ while (padding > 0) {
+ buffy[idx++] = '0';
+ padding--;
+ }
+
+ // we know these next 3 spots
+ buffy[idx++] = upper ? 'E' : 'e';
+ buffy[idx++] = '+';
+ buffy[idx++] = '0';
+
+ // next two digits depend on our length
+ if (exponent >= 10) {
+ buffy[idx++] = digitLowerTable[(exponent / 10)];
+ buffy[idx] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[idx++] = '0';
+ buffy[idx] = digitLowerTable[exponent];
+ }
+
+ return new string(buffy, 0, ++idx);
+ }
+
+ private static string FormatExponential (ulong value, int precision, bool upper)
+ {
+ int padding = (precision >= 0) ? precision : 6;
+ char[] buffy = new char[(padding + 8)];
+ char[] tmp = new char [maxLongLength];
+ int exponent = 0, position = maxLongLength;
+ int exp = 0, idx = 0;
+ ulong pow = 10;
+ ulong number = value;
+
+ // need to calculate the number of places to know if we need to round later
+ while (value >= 10) {
+ value /= 10;
+ exp++;
+ }
+
+ if (exp > padding) {
+
+ // highest number we should goto before we round
+ while (idx++ <= padding)
+ pow *= 10;
+
+ // get our value into a buffer
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+ }
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number% 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+ idx = 0;
+
+ // we know we have at least one in there, followed
+ // by a decimal point
+ buffy[idx++] = tmp[position++];
+ if (precision != 0)
+ buffy[idx++] = '.';
+
+ // copy over the remaining digits until we run out,
+ // or we've passed our specified precision
+ while (padding > 0 && position < maxLongLength) {
+ buffy[idx++] = tmp[position++];
+ padding--;
+ }
+
+ // if we still have more precision to go, add some
+ // zeros
+ while (padding > 0) {
+ buffy[idx++] = '0';
+ padding--;
+ }
+
+ // we know these next 3 spots
+ buffy[idx++] = upper ? 'E' : 'e';
+ buffy[idx++] = '+';
+ buffy[idx++] = '0';
+
+ // next two digits depend on our length
+ if (exponent >= 10) {
+ buffy[idx++] = digitLowerTable[(exponent / 10)];
+ buffy[idx] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[idx++] = '0';
+ buffy[idx] = digitLowerTable[exponent];
+ }
+
+ return new string(buffy, 0, ++idx);
+ }
+
+ // ============ Format Fixed Points ============ //
+
+ //
+ // Used for strings in the following form "[-]M.DD...D"
+ // At least one non-zero digit precedes the '.', w/ a
+ // '-' before that if negative. Precision specifies number
+ // of decimal places 'D' to go. If not given, use
+ // NumberFormatInfo.NumbeDecimalDigits. Results are rounded
+ // if necessary.
+ //
+ // Fairly simple implementation for integral types. Going
+ // from right to left, fill up precision number of 0's,
+ // plop a . down, then go for our number.
+ //
+
+ private static string FormatFixedPoint (byte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatFixedPoint ((uint)value, precision, nfi);
+ }
+
+ private static string FormatFixedPoint (short value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatFixedPoint ((int)value, precision, nfi);
+ }
+
+ private static string FormatFixedPoint (int value, int precision, NumberFormatInfo nfi)
+ {
+ int padding = (precision >= 0) ? (precision + maxIntLength) : (nfi.NumberDecimalDigits + maxIntLength);
+ char[] buffy = new char[padding];
+ int position = padding;
+ bool negative = (value < 0);
+
+ // fill up w/ precision # of 0's
+ while (position > (maxIntLength - 1))
+ buffy[--position] = '0';
+
+ if (precision != 0)
+ buffy[position--] = '.';
+
+ if (negative)
+ if (value <= -10) {
+ buffy[position--] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+ } else value = -value;
+
+ // fill up w/ the value
+ while (value >= 10) {
+ buffy[position--] = digitLowerTable[(value % 10)];
+ value = value / 10;
+ }
+
+ buffy[position] = digitLowerTable[value];
+
+ if (negative)
+ buffy[--position] = '-';
+
+ return new string (buffy, position, (padding - position));
+ }
+
+ private static string FormatFixedPoint (long value, int precision, NumberFormatInfo nfi)
+ {
+ int padding = (precision >= 0) ? (precision + maxLongLength) : (nfi.NumberDecimalDigits + maxLongLength);
+ char[] buffy = new char[padding];
+ int position = padding;
+ bool negative = (value < 0);
+
+ // fill up w/ precision # of 0's
+ while (position > (maxLongLength - 1))
+ buffy[--position] = '0';
+
+ if (precision != 0)
+ buffy[position--] = '.';
+
+ if (negative)
+ if (value <= -10) {
+ buffy[position--] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+ } else value = -value;
+
+ // fill up w/ the value
+ while (value >= 10) {
+ buffy[position--] = digitLowerTable[(value % 10)];
+ value = value / 10;
+ }
+
+ buffy[position] = digitLowerTable[value];
+
+ if (negative)
+ buffy[--position] = '-';
+
+ return new string (buffy, position, (padding - position));
+ }
+
+ private static string FormatFixedPoint (sbyte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatFixedPoint ((int)value, precision, nfi);
+ }
+
+ private static string FormatFixedPoint (ushort value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatFixedPoint ((uint)value, precision, nfi);
+ }
+
+ private static string FormatFixedPoint (uint value, int precision, NumberFormatInfo nfi)
+ {
+ int padding = (precision >= 0) ? (precision + maxIntLength) : (nfi.NumberDecimalDigits + maxIntLength);
+ char[] buffy = new char[padding];
+ int position = padding;
+
+ // fill up w/ precision # of 0's
+ while (position > (maxIntLength - 1))
+ buffy[--position] = '0';
+
+ if (precision != 0)
+ buffy[position--] = '.';
+
+ // fill up w/ the value
+ while (value >= 10) {
+ buffy[position--] = digitLowerTable[(value % 10)];
+ value = value / 10;
+ }
+
+ buffy[position] = digitLowerTable[value];
+
+ return new string (buffy, position, (padding - position));
+ }
+
+ private static string FormatFixedPoint (ulong value, int precision, NumberFormatInfo nfi)
+ {
+ int padding = (precision >= 0) ? (precision + maxLongLength) : (nfi.NumberDecimalDigits + maxLongLength);
+ char[] buffy = new char[padding];
+ int position = padding;
+
+ // fill up w/ precision # of 0's
+ while (position > (maxLongLength - 1))
+ buffy[--position] = '0';
+
+ if (precision != 0)
+ buffy[position--] = '.';
+
+ // fill up w/ the value
+ while (value >= 10) {
+ buffy[position--] = digitLowerTable[(value % 10)];
+ value = value / 10;
+ }
+
+ buffy[position] = digitLowerTable[value];
+
+ return new string (buffy, position, (padding - position));
+ }
+
+ // ============ Format General ============ //
+
+ //
+ // Strings are formatted in either Fixed Point or Exponential
+ // format. Results are rounded when needed. If no precision is
+ // given, the defaults are:
+ //
+ // short & ushort: 5
+ // int & uint: 10
+ // long & ulong: 19
+ // float: 7
+ // double: 15
+ // decimal: 29
+ //
+ // The value is formatted using fixed-point if exponent >= -4
+ // and exponent < precision, where exponent is he exponenent of
+ // the value in exponential format. The decimal point and trailing
+ // zeros are removed when possible.
+ //
+ // For all other values, exponential format is used. The case of
+ // the format specifier determines whether 'e' or 'E' prefixes
+ // the exponent.
+ //
+ // In either case, the number of digits that appear in the result
+ // (not including the exponent) will not exceed the value of the
+ // precision. The result is rounded as needed.
+ //
+ // Integral values are formatted using Fixed Point whenever
+ // precision is omitted. (This actually doesn't make sense when
+ // coupled w/ the 1st paragraph).
+ //
+ // Okay, so the decimal point is removed along with any trailing
+ // zeros. So, ignoring the last paragraph, we can consider an int
+ // ToString() to format it w/ exponential format w/ a default
+ // precision of 10, but since it will just be .00000000, it's
+ // discarded.
+ //
+
+ internal static string FormatGeneral (byte value, int precision, NumberFormatInfo nfi, bool upper) {
+ return FormatGeneral ((uint)value, precision, nfi, upper);
+ }
+
+ internal static string FormatGeneral (short value, int precision, NumberFormatInfo nfi, bool upper) {
+ return FormatGeneral ((int)value, precision, nfi, upper);
+ }
+
+ internal static string FormatGeneral (int value, int precision, NumberFormatInfo nfi, bool upper)
+ {
+ bool negative = (value < 0);
+ char[] tmp = new char [maxIntLength];
+ int exponent = 0;
+ int position = maxIntLength;
+
+ // ugly, but doing it since abs(Int32.MinValue) > Int.MaxValue
+ uint number = (negative) ? (uint)((-(value + 1)) + 1) : (uint)value;
+
+ // get number into a buffer, going to be doing this no matter what
+ if (negative)
+ if (value <= -10) {
+ tmp[--position] = digitLowerTable[-(value % 10)];
+ value /= -10;
+ exponent++;
+ } else value = -value;
+
+ while (value >= 10) {
+ tmp[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[value];
+
+ // integral values are formatted using fixed point when precision
+ // is not specified. But also trailing decimal point and zeros are
+ // discared. So for int's it will always be .00, so just compute
+ // here and save the call to FormatFixedPoint & trim.
+ if (precision <= 0 || exponent < precision) {
+ if (negative)
+ tmp[--position] = '-';
+
+ return new string (tmp, position, (maxIntLength - position));
+ }
+
+ // else our exponent was > precision, use exponential format
+ // precision = number of digits to show.
+ int idx = 0;
+ ulong pow = 1;
+
+ exponent = 0;
+ position = maxIntLength;
+
+ // Loop through while our number is less than the 10 ^ precision, then
+ // add 5 to that to round it out, and keep continuing
+ while (idx++ <= precision)
+ pow *= 10;
+
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+
+ // finally, make our final buffer, at least precision + 6 for 'E+XX' and '-'
+ // and reuse pow for size
+ idx = position;
+ position = 0;
+ pow = (ulong)(precision + 6);
+ char[] buffy = new char[pow];
+
+ if (negative)
+ buffy[position++] = '-';
+
+ buffy[position++] = tmp[idx++];
+ buffy[position] = '.';
+
+ // for the remaining precisions copy over rounded tmp
+ precision--;
+ while (precision-- > 0)
+ buffy[++position] = tmp[idx++];
+
+ // get rid of ending zeros
+ while (buffy[position] == '0')
+ position--;
+
+ // if we backed up all the way to the ., over write it
+ if (buffy[position] != '.')
+ position++;
+
+ // ints can only be +, e or E depending on format, plus XX
+ buffy[position++] = upper ? 'E' : 'e';
+ buffy[position++] = '+';
+
+ if (exponent >= 10) {
+ buffy[position++] = digitLowerTable[(exponent / 10)];
+ buffy[position++] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[position++] = '0';
+ buffy[position++] = digitLowerTable[exponent];
+ }
+
+ return new string (buffy, 0, position);
+ }
+
+ internal static string FormatGeneral (long value, int precision, NumberFormatInfo nfi, bool upper)
+ {
+ bool negative = (value < 0);
+ char[] tmp = new char [maxLongLength];
+ int exponent = 0;
+ int position = maxLongLength;
+
+ // ugly, but doing it since abs(Int32.MinValue) > Int.MaxValue
+ ulong number = (negative) ? (ulong)(-(value + 1) + 1) : (ulong)value;
+
+ // get number into a buffer, going to be doing this no matter what
+ if (negative)
+ if (value <= -10) {
+ tmp[--position] = digitLowerTable[-(value % 10)];
+ value /= -10;
+ } else value = -value;
+
+ while (value >= 10) {
+ tmp[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ tmp[--position] = digitLowerTable[value];
+ exponent = (maxLongLength - position) - 1;
+
+ // integral values are formatted using fixed point when precision
+ // is not specified. But also trailing decimal point and zeros are
+ // discared. So for int's it will always be .00, so just compute
+ // here and save the call to FormatFixedPoint & trim.
+ if (precision <= 0 || exponent < precision) {
+ if (negative)
+ tmp[--position] = '-';
+
+ return new string (tmp, position, (maxLongLength - position));
+ }
+
+ // else our exponent was > precision, use exponential format
+ // precision = number of digits to show.
+ int idx = 0;
+ ulong pow = 1;
+
+ exponent = 0;
+ position = maxLongLength;
+
+ // Loop through while our number is less than the 10 ^ precision, then
+ // add 5 to that to round it out, and keep continuing
+ while (idx++ <= precision)
+ pow *= 10;
+
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+
+ // finally, make our final buffer, at least precision + 6 for 'E+XX' and '-'
+ // and reuse pow for size
+ idx = position;
+ position = 0;
+ pow = (ulong)precision + 6;
+ char[] buffy = new char[pow];
+
+ if (negative)
+ buffy[position++] = '-';
+
+ buffy[position++] = tmp[idx++];
+ buffy[position] = '.';
+
+ // for the remaining precisions copy over rounded tmp
+ precision--;
+ while (precision-- > 0)
+ buffy[++position] = tmp[idx++];
+
+ // get rid of ending zeros
+ while (buffy[position] == '0')
+ position--;
+
+ // if we backed up all the way to the ., over write it
+ if (buffy[position] != '.')
+ position++;
+
+ // ints can only be +, e or E depending on format, plus XX
+ buffy[position++] = upper ? 'E' : 'e';
+ buffy[position++] = '+';
+
+ if (exponent >= 10) {
+ buffy[position++] = digitLowerTable[(exponent / 10)];
+ buffy[position++] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[position++] = '0';
+ buffy[position++] = digitLowerTable[exponent];
+ }
+
+ return new string (buffy, 0, position);
+ }
+
+ internal static string FormatGeneral (sbyte value, int precision, NumberFormatInfo nfi, bool upper) {
+ return FormatGeneral ((int)value, precision, nfi, upper);
+ }
+
+ internal static string FormatGeneral (ushort value, int precision, NumberFormatInfo nfi, bool upper) {
+ return FormatGeneral ((uint)value, precision, nfi, upper);
+ }
+
+ internal static string FormatGeneral (uint value, int precision, NumberFormatInfo nfi, bool upper)
+ {
+ char[] tmp = new char [maxIntLength];
+ int exponent = 0;
+ int position = maxIntLength;
+ ulong number = (ulong)value;
+
+ // get number into a buffer, going to be doing this no matter what
+ while (value >= 10) {
+ tmp[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ }
+
+ tmp[--position] = digitLowerTable[value];
+ exponent = (maxIntLength - position) - 1;
+
+ // integral values are formatted using fixed point when precision
+ // is not specified. But also trailing decimal point and zeros are
+ // discared. So for int's it will always be .00, so just compute
+ // here and save the call to FormatFixedPoint & trim.
+ if (precision <= 0 || exponent < precision)
+ return new string (tmp, position, (maxIntLength - position));
+
+ // else our exponent was > precision, use exponential format
+ // precision = number of digits to show.
+ int idx = 0;
+ ulong pow = 1;
+
+ exponent = 0;
+ position = maxIntLength;
+
+ // Loop through while our number is less than the 10 ^ precision, then
+ // add 5 to that to round it out, and keep continuing
+ while (idx++ <= precision)
+ pow *= 10;
+
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+
+ // finally, make our final buffer, at least precision + 6 for 'E+XX' and '-'
+ // and reuse pow for size
+ idx = position;
+ position = 0;
+ pow = (ulong)(precision + 6);
+ char[] buffy = new char[pow];
+
+ buffy[position++] = tmp[idx++];
+ buffy[position] = '.';
+
+ // for the remaining precisions copy over rounded tmp
+ precision--;
+ while (precision-- > 0)
+ buffy[++position] = tmp[idx++];
+
+ // get rid of ending zeros
+ while (buffy[position] == '0')
+ position--;
+
+ // if we backed up all the way to the ., over write it
+ if (buffy[position] != '.')
+ position++;
+
+ // ints can only be +, e or E depending on format, plus XX
+ buffy[position++] = upper ? 'E' : 'e';
+ buffy[position++] = '+';
+
+ if (exponent >= 10) {
+ buffy[position++] = digitLowerTable[(exponent / 10)];
+ buffy[position++] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[position++] = '0';
+ buffy[position++] = digitLowerTable[exponent];
+ }
+
+ return new string (buffy, 0, position);
+ }
+
+ internal static string FormatGeneral (ulong value, int precision, NumberFormatInfo nfi, bool upper)
+ {
+ char[] tmp = new char [maxLongLength];
+ int exponent = 0;
+ int position = maxLongLength;
+ ulong number = value;
+
+ // get number into a buffer, going to be doing this no matter what
+ while (value >= 10) {
+ tmp[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[value];
+
+ // integral values are formatted using fixed point when precision
+ // is not specified. But also trailing decimal point and zeros are
+ // discared. So for int's it will always be .00, so just compute
+ // here and save the call to FormatFixedPoint & trim.
+ if (precision <= 0 || exponent < precision)
+ return new string (tmp, position, (maxLongLength - position));
+
+ // else our exponent was > precision, use exponential format
+ // precision = number of digits to show.
+ int idx = 0;
+ ulong pow = 1;
+
+ exponent = 0;
+ position = maxLongLength;
+
+ // Loop through while our number is less than the 10 ^ precision, then
+ // add 5 to that to round it out, and keep continuing
+ while (idx++ <= precision)
+ pow *= 10;
+
+ while (number > pow) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ number += 5;
+
+ while (number >= 10) {
+ tmp[--position] = digitLowerTable[(number % 10)];
+ number /= 10;
+ exponent++;
+ }
+
+ tmp[--position] = digitLowerTable[number];
+
+ // finally, make our final buffer, at least precision + 6 for 'E+XX' and '-'
+ // and reuse pow for size
+ idx = position;
+ position = 0;
+ pow = (ulong)precision + 6;
+ char[] buffy = new char[pow];
+
+ buffy[position++] = tmp[idx++];
+ buffy[position] = '.';
+
+ // for the remaining precisions copy over rounded tmp
+ precision--;
+ while (precision-- > 0)
+ buffy[++position] = tmp[idx++];
+
+ // get rid of ending zeros
+ while (buffy[position] == '0')
+ position--;
+
+ // if we backed up all the way to the ., over write it
+ if (buffy[position] != '.')
+ position++;
+
+ // ints can only be +, e or E depending on format, plus XX
+ buffy[position++] = upper ? 'E' : 'e';
+ buffy[position++] = '+';
+
+ if (exponent >= 10) {
+ buffy[position++] = digitLowerTable[(exponent / 10)];
+ buffy[position++] = digitLowerTable[(exponent % 10)];
+ } else {
+ buffy[position++] = '0';
+ buffy[position++] = digitLowerTable[exponent];
+ }
+
+ return new string (buffy, 0, position);
+ }
+
+ // ============ Format Number ============ //
+
+ //
+ // Used for strings in the following form "[-]d,ddd,ddd.dd...d"
+ // The minus sign only appears if it is negative. At least one
+ // non-zero digit preceeds the decimal separator. The precision
+ // specifier determines the number of decimal places. If it is
+ // not given, use NumberFormatInfo.NumberDecimalDigits.
+ // The NumberGroupSizes, NumberGroupSeparator, and NumberDecimalSeparator
+ // members of NumberFormatInfo supply the size and separator
+ // for digit groupings. See IFormattable.
+ //
+ // The group sizes is an array of ints that determine the grouping
+ // of numbers. All digits are in the range 1-9, with the last digit
+ // being between 0-9. The number formats the string backwards, with
+ // the last digit being the group size for the rest of (leftmost) the
+ // the string, 0 being none.
+ //
+ // For instance:
+ // groupSizes = { 3, 2, 1, 0 };
+ // int n = 1234567890 => "1234,5,67,890"
+ // groupSizes = { 3, 2, 1 };
+ // int n = 1234567890 => "1,2,3,4,5,67,890"
+ // groupSizes = { 2, 0 };
+ // int n = 1234567890 => "1234567,90";
+ //
+ // Not too difficult, jsut keep track of where you are in the array
+ // and when to print the separator
+ //
+ // The max size of the buffer is assume we have a separator every
+ // number, plus the precision on the end, plus a spot for the negative
+ // and a spot for decimal separator.
+ //
+
+ private static string FormatNumber (byte value, int precision, NumberFormatInfo nfi) {
+ return FormatNumber ((uint)value, precision, nfi);
+ }
+
+ private static string FormatNumber (short value, int precision, NumberFormatInfo nfi) {
+ return FormatNumber ((int)value, precision, nfi);
+ }
+
+ private static string FormatNumber (int value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ char[] groupSeparator = nfi.NumberGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.NumberDecimalSeparator.ToCharArray ();
+ int[] groupSizes = nfi.NumberGroupSizes;
+
+ int padding = (precision >= 0) ? precision : nfi.NumberDecimalDigits;
+ int pattern = nfi.NumberNegativePattern;
+ int size = maxIntLength + (maxIntLength * groupSeparator.Length) + padding +
+ decimalSeparator.Length + 4;
+ char[] buffy = new char[size];
+ int position = size;
+ bool negative = (value < 0);
+
+ // pattern for negative values, defined in NumberFormatInfo
+ if (negative) {
+ switch (pattern) {
+ case 0: // (nnn)
+ buffy[--position] = ')';
+ break;
+ // case 1: // -nnn
+ // break;
+ // case 2: // - nnn
+ // break;
+ case 3: // nnn-
+ buffy[--position] = '-';
+ break;
+ case 4: // nnn -
+ buffy[--position] = '-';
+ buffy[--position] = ' ';
+ break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator
+ if (position != size) {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ // negative hack for numbers past MinValue
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // pattern for negative values, defined in NumberFormatInfo
+ if (negative) {
+ switch (pattern) {
+ case 0: // (nnn)
+ buffy[--position] = '(';
+ break;
+ case 1: // -nnn
+ buffy[--position] = '-';
+ break;
+ case 2: // - nnn
+ buffy[--position] = ' ';
+ buffy[--position] = '-';
+ break;
+ // case 3: // nnn-
+ // break;
+ // case 4: // nnn -
+ // break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatNumber (long value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ char[] groupSeparator = nfi.NumberGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.NumberDecimalSeparator.ToCharArray ();
+ int[] groupSizes = nfi.NumberGroupSizes;
+
+ int padding = (precision >= 0) ? precision : nfi.NumberDecimalDigits;
+ int pattern = nfi.NumberNegativePattern;
+ int size = maxLongLength + (maxLongLength * groupSeparator.Length) + padding +
+ decimalSeparator.Length + 4;
+ char[] buffy = new char[size];
+ int position = size;
+ bool negative = (value < 0);
+
+ // pattern for negative values, defined in NumberFormatInfo
+ if (negative) {
+ switch (pattern) {
+ case 0: // (nnn)
+ buffy[--position] = ')';
+ break;
+ // case 1: // -nnn
+ // break;
+ // case 2: // - nnn
+ // break;
+ case 3: // nnn-
+ buffy[--position] = '-';
+ break;
+ case 4: // nnn -
+ buffy[--position] = '-';
+ buffy[--position] = ' ';
+ break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator
+ if (position != size) {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ // negative hack for numbers past MinValue
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // pattern for negative values, defined in NumberFormatInfo
+ if (negative) {
+ switch (pattern) {
+ case 0: // (nnn)
+ buffy[--position] = '(';
+ break;
+ case 1: // -nnn
+ buffy[--position] = '-';
+ break;
+ case 2: // - nnn
+ buffy[--position] = ' ';
+ buffy[--position] = '-';
+ break;
+ // case 3: // nnn-
+ // break;
+ // case 4: // nnn -
+ // break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatNumber (sbyte value, int precision, NumberFormatInfo nfi) {
+ return FormatNumber ((int)value, precision, nfi);
+ }
+
+ private static string FormatNumber (ushort value, int precision, NumberFormatInfo nfi) {
+ return FormatNumber ((uint)value, precision, nfi);
+ }
+
+ private static string FormatNumber (uint value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ char[] groupSeparator = nfi.NumberGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.NumberDecimalSeparator.ToCharArray ();
+ int[] groupSizes = nfi.NumberGroupSizes;
+
+ int padding = (precision >= 0) ? precision : nfi.NumberDecimalDigits;
+ int size = maxIntLength + (maxIntLength * groupSeparator.Length) + padding +
+ decimalSeparator.Length + 2;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator
+ if (position != size) {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatNumber (ulong value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ char[] groupSeparator = nfi.NumberGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.NumberDecimalSeparator.ToCharArray ();
+ int[] groupSizes = nfi.NumberGroupSizes;
+
+ int padding = (precision >= 0) ? precision : nfi.NumberDecimalDigits;
+ int size = maxLongLength + (maxLongLength * groupSeparator.Length) + padding +
+ decimalSeparator.Length + 2;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator
+ if (position != size) {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ return new string (buffy, position, (size - position));
+ }
+
+ // ============ Percent Formatting ============ //
+
+ //
+ // Percent Format: Used for strings containing a percentage. The
+ // PercentSymbol, PercentGroupSizes, PercentGroupSeparator, and
+ // PercentDecimalSeparator members of a NumberFormatInfo supply
+ // the Percent symbol, size and separator for digit groupings, and
+ // decimal separator, respectively.
+ // PercentNegativePattern and PercentPositivePattern determine the
+ // symbols used to represent negative and positive values. For example,
+ // a negative value may be prefixed with a minus sign, or enclosed in
+ // parentheses.
+ // If no precision is specified, the number of decimal places in the result
+ // is set by NumberFormatInfo.PercentDecimalDigits. Results are
+ // rounded to the nearest representable value when necessary.
+ // The result is scaled by 100 (.99 becomes 99%).
+ //
+ // The pattern of the number determines how the output looks, where
+ // the percent sign goes, where the negative sign goes, etc.
+ // IFormattable documentation lists the patterns and their values,
+ // I have them commented out in the switch statement
+ //
+
+ private static string FormatPercent (byte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatPercent ((uint)value, precision, nfi);
+ }
+
+ private static string FormatPercent (short value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatPercent ((int)value, precision, nfi);
+ }
+
+ private static string FormatPercent (int value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ bool negative = (value < 0);
+
+ char[] groupSeparator = nfi.PercentGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.PercentDecimalSeparator.ToCharArray ();
+ char[] percentSymbol = nfi.PercentSymbol.ToCharArray ();
+ int[] groupSizes = nfi.PercentGroupSizes;
+ int pattern = negative ? nfi.PercentNegativePattern : nfi.PercentPositivePattern;
+ int symbolLength = percentSymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.PercentDecimalDigits;
+ int size = maxIntLength + (groupSeparator.Length * maxIntLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // -nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // -nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // -%nnn
+ // break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // %nnn
+ // break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ // all values are multiplied by 100, so tack on two 0's
+ if (value != 0)
+ for (int c = 0; c < 2; c++) {
+ buffy[--position] = '0';
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ // negative hack for numbers past MinValue
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // -nnn %
+ buffy[--position] = '-';
+ break;
+ case 1: // -nnn%
+ buffy[--position] = '-';
+ break;
+ case 2: // -%nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // nnn %
+ // break;
+ // case 1: // nnn%
+ // break;
+ case 2: // %nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatPercent (long value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+ bool negative = (value < 0);
+
+ char[] groupSeparator = nfi.PercentGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.PercentDecimalSeparator.ToCharArray ();
+ char[] percentSymbol = nfi.PercentSymbol.ToCharArray ();
+ int[] groupSizes = nfi.PercentGroupSizes;
+ int pattern = negative ? nfi.PercentNegativePattern : nfi.PercentPositivePattern;
+ int symbolLength = percentSymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.PercentDecimalDigits;
+ int size = maxLongLength + (groupSeparator.Length * maxLongLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // -nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // -nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // -%nnn
+ // break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // %nnn
+ // break;
+ }
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ // all values are multiplied by 100, so tack on two 0's
+ if (value != 0)
+ for (int c = 0; c < 2; c++) {
+ buffy[--position] = '0';
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ // negative hack for numbers past MinValue
+ if (negative)
+ if (value <= -10) {
+ buffy[--position] = digitLowerTable[-(value % 10)];
+ value = value / -10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ } else value = -value;
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ // end the pattern on the left hand side
+ if (negative) {
+ i = symbolLength;
+
+ switch (pattern) {
+ case 0: // -nnn %
+ buffy[--position] = '-';
+ break;
+ case 1: // -nnn%
+ buffy[--position] = '-';
+ break;
+ case 2: // -%nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = '-';
+ break;
+ }
+ } else {
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // nnn %
+ // break;
+ // case 1: // nnn%
+ // break;
+ case 2: // %nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ }
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatPercent (sbyte value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatPercent ((int)value, precision, nfi);
+ }
+
+ private static string FormatPercent (ushort value, int precision, NumberFormatInfo nfi)
+ {
+ return FormatPercent ((uint)value, precision, nfi);
+ }
+
+ private static string FormatPercent (uint value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+
+ char[] groupSeparator = nfi.PercentGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.PercentDecimalSeparator.ToCharArray ();
+ char[] percentSymbol = nfi.PercentSymbol.ToCharArray ();
+ int[] groupSizes = nfi.PercentGroupSizes;
+ int pattern = nfi.PercentPositivePattern;
+ int symbolLength = percentSymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.PercentDecimalDigits;
+ int size = maxIntLength + (groupSeparator.Length * maxIntLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // -nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // -nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // -%nnn
+ // break;
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ if (value != 0)
+ for (int c = 0; c < 2; c++) {
+ buffy[--position] = '0';
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // nnn %
+ // break;
+ // case 1: // nnn%
+ // break;
+ case 2: // %nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ private static string FormatPercent (ulong value, int precision, NumberFormatInfo nfi)
+ {
+ int i, j, k;
+
+ char[] groupSeparator = nfi.PercentGroupSeparator.ToCharArray ();
+ char[] decimalSeparator = nfi.PercentDecimalSeparator.ToCharArray ();
+ char[] percentSymbol = nfi.PercentSymbol.ToCharArray ();
+ int[] groupSizes = nfi.PercentGroupSizes;
+ int pattern = nfi.PercentPositivePattern;
+ int symbolLength = percentSymbol.Length;
+
+ int padding = (precision >= 0) ? precision : nfi.PercentDecimalDigits;
+ int size = maxLongLength + (groupSeparator.Length * maxLongLength) + padding + 2 +
+ decimalSeparator.Length + symbolLength;
+ char[] buffy = new char[size];
+ int position = size;
+
+ // set up the pattern from IFormattible
+ i = symbolLength;
+ switch (pattern) {
+ case 0: // -nnn %
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ buffy[--position] = ' ';
+ break;
+ case 1: // -nnn%
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ // case 2: // -%nnn
+ // break;
+ }
+
+ // right pad it w/ precision 0's
+ while (padding-- > 0)
+ buffy[--position] = '0';
+
+ // put on decimal separator if we moved over and put a 0
+ if (position < size && buffy[position] == '0') {
+ i = decimalSeparator.Length;
+ do {
+ buffy[--position] = decimalSeparator[--i];
+ } while (i > 0);
+ }
+
+ // loop through, keeping track of where you are in the
+ // group sizes array and putting out the group separator
+ // when needed
+ j = 0;
+ k = groupSizes[j++];
+
+ if (value != 0)
+ for (int c = 0; c < 2; c++) {
+ buffy[--position] = '0';
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ while (value >= 10) {
+ buffy[--position] = digitLowerTable[(value % 10)];
+ value /= 10;
+
+ if (--k == 0) {
+ i = groupSeparator.Length;
+ do {
+ buffy[--position] = groupSeparator[--i];
+ } while (i > 0);
+
+ k = (j < groupSizes.Length) ?
+ groupSizes[j++] : groupSizes[(groupSizes.Length - 1)];
+ }
+ }
+
+ buffy[--position] = digitLowerTable[value];
+
+ i = symbolLength;
+ switch (pattern) {
+ // case 0: // nnn %
+ // break;
+ // case 1: // nnn%
+ // break;
+ case 2: // %nnn
+ do {
+ buffy[--position] = percentSymbol[--i];
+ } while (i > 0);
+ break;
+ }
+
+ return new string (buffy, position, (size - position));
+ }
+
+ // ============ Format Hexadecimal ============ //
+
+ //
+ // For strings in base 16. Only valid w/ integers. Precision
+ // specifies number of digits in the string, if it specifies
+ // more digits than we need, left pad w/ 0's. The case of the
+ // the format specifier 'X' or 'x' determines lowercase or
+ // capital digits in the output.
+ //
+ // Whew. Straight forward Hex formatting, however only
+ // go 8 places max when dealing with an int (not counting
+ // precision padding) and 16 when dealing with a long. This
+ // is to cut off the loop when dealing with negative values,
+ // which will loop forever when you hit -1;
+ //
+
+ private static string FormatHexadecimal (byte value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxByteLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ ushort mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. Don't worry about negative
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = (byte)(value >> 4);
+ } while (value != 0);
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (short value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxShortLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ short mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. If value is negavite stop after 4 F's
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = (short)(value >> 4);
+ } while (value != 0 && position > (size - 4));
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (int value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxIntLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ int mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. If value is negavite stop after 8 F's
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = value >> 4;
+ } while (value != 0 && position > (size - 8));
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (long value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxLongLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ long mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. If value is negavite stop after 16 F's
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = value >> 4;
+ } while (value != 0 && position > (size - 16));
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (sbyte value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxByteLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ short mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. If value is negavite stop after 2 F's
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = (sbyte)(value >> 4);
+ } while (value != 0 && position > (size - 2));
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (ushort value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxShortLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ int mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. Don't worry about negative
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = (ushort)(value >> 4);
+ } while (value != 0);
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (uint value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxIntLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ uint mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. Don't worry about negative
+ do {
+ buffy[--position] = table[(value & mask)];
+ value = value >> 4;
+ } while (value != 0);
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ private static string FormatHexadecimal (ulong value, int precision, bool upper)
+ {
+ if (precision < 0) precision = 0;
+ int size = maxLongLength + precision;
+ char[] buffy = new char[size];
+ char[] table = upper ? digitUpperTable : digitLowerTable;
+ int position = size;
+ ulong mask = (1 << 4) - 1;
+
+ // loop through right to left, shifting and looking up
+ // our value. Don't worry about negative
+ do {
+ buffy[--position] = table[value & mask];
+ value = value >> 4;
+ } while (value != 0);
+
+ // pad w/ 0's if they want more length, if not, ignore
+ precision -= (size - position);
+ while (precision > 0 && position > 1) {
+ buffy[--position] = '0';
+ precision--;
+ }
+
+ return new string(buffy, position, (size - position));
+ }
+
+ // ============ Format Custom ============ //
+
+ private static string FormatCustom (string format, sbyte number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ int sign = (number < 0) ? -1 : (number > 0) ? 1 : 0;
+ return fp.FormatNumber (strnum, sign);
+ }
+
+ private static string FormatCustom (string format, short number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ int sign = (number < 0) ? -1 : (number > 0) ? 1 : 0;
+ return fp.FormatNumber (strnum, sign);
+ }
+
+ private static string FormatCustom (string format, int number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ int sign = (number < 0) ? -1 : (number > 0) ? 1 : 0;
+ return fp.FormatNumber (strnum, sign);
+ }
+
+ private static string FormatCustom (string format, long number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ int sign = (number < 0) ? -1 : (number > 0) ? 1 : 0;
+ return fp.FormatNumber (strnum, sign);
+ }
+
+ private static string FormatCustom (string format, byte number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ return fp.FormatNumber (strnum, (number == 0) ? 0 : 1);
+ }
+
+ private static string FormatCustom (string format, ushort number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ return fp.FormatNumber (strnum, (number == 0) ? 0 : 1);
+ }
+
+ private static string FormatCustom (string format, uint number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ return fp.FormatNumber (strnum, (number == 0) ? 0 : 1);
+ }
+
+ private static string FormatCustom (string format, ulong number, NumberFormatInfo nfi)
+ {
+ string strnum = FormatGeneral (number, -1, nfi, true);
+ FormatParse fp = new FormatParse (format); // FIXME: use nfi!
+ return fp.FormatNumber (strnum, (number == 0) ? 0 : 1);
+ }
+ }
+
+class FormatSection {
+ public int nph;
+ public int nphPreDot;
+ public int npercent;
+ public int ndividers;
+ public int ntokens;
+ public string [] tokens;
+ public int [] TokenTypes;
+ public bool HaveDot;
+ public bool HaveSci;
+ public bool sciSignAlways = false;
+ public int sciDigits;
+ public int numCommas;
+}
+
+class FormatParse {
+ const int AS_IS = 0;
+ const int PH_0 = 1;
+ const int PH_NUMBER = 2;
+ const int COMMA = 3;
+ const int PERCENT = 4;
+ const int DIVIDERS = 5;
+ const int DOT = 6;
+ const int ESCAPE_SEQ = 7;
+ const int SCIENTIFIC = 8;
+ const int NEW_SECTION = 9;
+ private FormatSection [] sections = new FormatSection[3];
+ private int nsections = 0;
+ private int pos; // Position in the format string
+ private int group = 0; // Used in FormatPlain to insert a comma between groups of digits
+ private bool isNegative;
+
+ private FormatParse ()
+ {
+ }
+
+ public FormatParse (string format)
+ {
+ parseFormat (format);
+ }
+
+ private void FormatSci (char [] digits, ArrayList outputList, FormatSection sec)
+ {
+ int tokidx = sec.ntokens - 1;
+
+ // Output everything until we get to the SCIENTIFIC
+ while (tokidx >= 0 && sec.TokenTypes [tokidx] != SCIENTIFIC){
+ outputList.Add ((string) sec.tokens [tokidx--]);
+ }
+
+ // Exponent
+ int exponent = digits.Length - sec.nph;
+ outputList.Add ((string) exponent.ToString ());
+ if (sec.sciSignAlways && exponent > 0)
+ outputList.Add ("+");
+ outputList.Add ((string) sec.tokens [tokidx--]);
+
+ if (exponent < 0) {
+ char [] newDigits;
+ exponent = -exponent;
+ newDigits = new char [digits.Length + exponent];
+ Array.Copy (digits, 0, newDigits, exponent, digits.Length);
+ for (int i = 0; i < exponent; i++)
+ newDigits[i] = '0';
+ digits = newDigits;
+ }
+
+ // Now format the rest
+ int digitIdx = 0;
+ if (sec.HaveDot)
+ FormatDot (digits, ref digitIdx, outputList, sec, tokidx, 0);
+ else
+ FormatPlain (digits, ref digitIdx, outputList, sec, tokidx, 0, sec.numCommas > 0);
+ }
+
+ private void FormatDot (char [] digits, ref int digitIdx, ArrayList outputList,
+ FormatSection sec, int lastToken, int firstToken)
+ {
+ int tokidx = lastToken;
+ int type;
+
+ while (tokidx >= firstToken) {
+ type = sec.TokenTypes [tokidx];
+ if (type == DOT || type == PH_NUMBER || type == PH_0)
+ break;
+ tokidx--;
+ }
+
+ if (tokidx > 0) {
+ char [] postDotDigits = new char [sec.nph - sec.nphPreDot];
+ int max = (postDotDigits.Length > digits.Length) ? digits.Length : postDotDigits.Length;
+ Array.Copy (digits, 0, postDotDigits, 0, max);
+ int postDotDigitsIdx = 0;
+ FormatPlain (postDotDigits, ref postDotDigitsIdx, outputList, sec, lastToken, tokidx, false);
+ tokidx--;
+ digitIdx += max;
+ FormatPlain (digits, ref digitIdx, outputList, sec, tokidx, 0, sec.numCommas > 0);
+ }
+ }
+
+ private void FormatPlain (char [] digits, ref int digitIdx, ArrayList outputList,
+ FormatSection sec, int lastToken, int firstToken, bool insertComma)
+ {
+ int tokidx = lastToken;
+ int type;
+
+ while (tokidx >= firstToken) {
+ type = sec.TokenTypes [tokidx];
+ if (type == PH_0 || type == PH_NUMBER) {
+ //FIXME: PH_NUMBER should also check for significant digits
+ // Console.WriteLine ("group : {0}", group);
+ int i = sec.tokens [tokidx].Length - 1;
+ while (i >= 0) {
+ if (insertComma && group == 3) {
+ outputList.Add (","); // FIXME: from NumberFormatInfo
+ group = 0;
+ }
+
+ if (digitIdx < digits.Length)
+ outputList.Add ((string) digits[digitIdx++].ToString ());
+ else
+ outputList.Add ("0");
+ i--;
+ if (insertComma)
+ group++;
+ sec.nph--;
+ while (sec.nph == 0 && digitIdx < digits.Length) {
+ // Flush the numbers left
+ if (insertComma && group == 3){
+ outputList.Add (","); // FIXME: from NumberFormatInfo
+ group = 0;
+ }
+ outputList.Add ((string) digits [digitIdx++].ToString ());
+ if (insertComma)
+ group++;
+ }
+
+ if (sec.nph == 0 && isNegative)
+ outputList.Add ("-");
+ }
+ } else {
+ outputList.Add ((string) sec.tokens [tokidx]);
+ }
+ tokidx--;
+ }
+
+ }
+
+ private char [] AdjustDigits (string number, FormatSection sec)
+ {
+ char [] digits = number.ToCharArray ();
+ char [] newDigits = digits;
+ int decPointIdx = 0;
+ int postDot = 0;
+
+ decPointIdx -= sec.ndividers * 3;
+ decPointIdx += sec.npercent * 2;
+ if (sec.HaveDot){
+ postDot = sec.nph - sec.nphPreDot;
+ decPointIdx += postDot;
+ }
+
+ if (decPointIdx > 0) {
+ newDigits = new char [digits.Length + decPointIdx];
+ Array.Copy (digits, 0, newDigits, 0, digits.Length);
+ for (int i = 0; i < decPointIdx; i++)
+ newDigits[digits.Length + i] = '0';
+ } else if (decPointIdx < 0) {
+ decPointIdx = -decPointIdx;
+ if (decPointIdx >= digits.Length) {
+ if (sec.HaveSci){
+ } else {
+ // The numbers turns into 0 when formatting applied
+ digits = new char [1] {'0'};
+ }
+ } else {
+ int newLength = digits.Length - decPointIdx + postDot - 1;
+ newDigits = new char [newLength];
+ int max = digits.Length >= newLength ? newLength : digits.Length;
+ Array.Copy (digits, 0, newDigits, 0, max);
+ if (newLength > digits.Length)
+ for (int i = 0; i < decPointIdx; i++)
+ newDigits[digits.Length + i] = '0';
+ }
+ }
+
+ return newDigits;
+ }
+
+ public string FormatNumber (string number, int signValue)
+ {
+ char [] digits;
+
+ isNegative = signValue < 0;
+ int section = 0;
+ if (signValue < 0 && nsections > 0)
+ section = 1;
+ if (signValue == 0 && nsections > 1)
+ section = 2;
+
+ FormatSection sec = sections [section];
+ digits = AdjustDigits (number.ToString (), sec);
+ if (digits.Length == 1 && digits [0] == '0')
+ if (nsections > 2)
+ sec = sections [2]; // Format as a 0
+ else
+ sec = sections [0]; // Format as positive
+
+ ArrayList outputList = new ArrayList ();
+
+ int digitIdx = 0;
+ Array.Reverse (digits);
+
+ if (sec.HaveSci)
+ FormatSci (digits, outputList, sec);
+ else if (sec.HaveDot)
+ FormatDot (digits, ref digitIdx, outputList, sec, sec.ntokens - 1, 0);
+ else
+ FormatPlain (digits, ref digitIdx, outputList, sec, sec.ntokens - 1, 0, sec.numCommas > 0);
+
+ string result = "";
+ for (int i = outputList.Count - 1; i >= 0; i--) {
+ result += (string) outputList[i];
+ }
+
+ return result;
+ }
+
+ private void parseFormat (string format)
+ {
+ char [] fmt_chars = format.ToCharArray ();
+ int fmtlen = fmt_chars.Length;
+ int type = AS_IS;
+ int prevType = AS_IS;
+ string token;
+
+ sections[0] = new FormatSection();
+ while (pos < fmtlen) {
+
+ token = getNextToken (fmt_chars, fmtlen, out type);
+ if (type == NEW_SECTION) {
+ nsections++;
+ if (nsections > 3)
+ break;
+ sections[nsections] = new FormatSection();
+ } else {
+ prevType = AddToken (token, type, prevType);
+ }
+ }
+ }
+
+ private int AddToken (string token, int type, int prevType)
+ {
+ FormatSection sec = sections[nsections];
+ string [] newTokens = new string [sec.ntokens + 1];
+ int [] newTokenTypes = new int [sec.ntokens + 1];
+ for (int i = 0; i < sec.ntokens; i++) {
+ newTokens[i] = sec.tokens[i];
+ newTokenTypes[i] = sec.TokenTypes[i];
+ }
+
+ switch (type) {
+ case ESCAPE_SEQ :
+ type = AS_IS;
+ break;
+ case COMMA :
+ if (!sec.HaveDot && (prevType == PH_0 || prevType == PH_NUMBER)) {
+ sec.numCommas++;
+ } else
+ type = AS_IS;
+
+ token = "";
+ break;
+ case DOT :
+ if (!sec.HaveDot && (prevType == PH_0 || prevType == PH_NUMBER ||
+ prevType == DIVIDERS || prevType == COMMA)) {
+ sec.HaveDot = true;
+ sec.nphPreDot = sec.nph;
+ } else
+ type = AS_IS;
+
+ break;
+ case PERCENT :
+ sec.npercent++;
+ break;
+ case DIVIDERS :
+ token = "";
+ if (!sec.HaveDot)
+ sec.ndividers = token.Length;
+ else
+ type = AS_IS;
+ break;
+ case PH_0 :
+ if (!sec.HaveSci)
+ sec.nph += token.Length;
+ else
+ type = AS_IS;
+ break;
+ case PH_NUMBER :
+ if (!sec.HaveSci)
+ sec.nph += token.Length;
+ else
+ type = AS_IS;
+ break;
+ case SCIENTIFIC :
+ if (!sec.HaveSci && sec.nph > 0) {
+ sec.HaveSci = true;
+ char [] sci = token.ToCharArray ();
+ sec.sciSignAlways = sci[1] == '+' ? true : false;
+ int expLen = sci[1] == '0' ? token.Length - 1 : token.Length - 2;
+ sec.sciDigits = expLen;
+ token = sci[0].ToString ();
+ } else {
+ type = AS_IS;
+ }
+ break;
+ }
+
+ newTokens[sec.ntokens] = token;
+ newTokenTypes[sec.ntokens] = type;
+ sec.tokens = newTokens;
+ sec.TokenTypes = newTokenTypes;
+ sec.ntokens++;
+ return type;
+ }
+
+ private string getNextToken (char [] fmt_chars, int fmtlen, out int type)
+ {
+ int curpos = pos;
+ string result = null;
+ char current;
+
+ type = AS_IS; // Default
+ current = fmt_chars[curpos];
+ if (current == ';'){
+ type = NEW_SECTION;
+ result = "NEW_SECTION";
+ pos++;
+ }
+ else if (current == '\'' || current == '"') {
+ char Quote = current;
+ curpos++;
+ int endpos = Array.IndexOf (fmt_chars, current, curpos);
+ if (endpos == -1)
+ endpos = fmtlen;
+ result = new string (fmt_chars, curpos, endpos - curpos);
+ pos = endpos + 1;
+ }
+ else if (current == '\\') { //MS seems not to translate escape seqs!
+ type = ESCAPE_SEQ;
+ current = fmt_chars[++pos];
+ result = current.ToString ();
+ pos++;
+ }
+ else if (current == '%') {
+ type = PERCENT;
+ result = "%";
+ pos++;
+ }
+ else if (current == '.') {
+ type = DOT;
+ result = ".";
+ pos++;
+ }
+ else if (current == ',') {
+ int begpos = curpos;
+
+ while (++curpos < fmtlen && fmt_chars[curpos] == ',');
+ if (curpos == fmtlen || fmt_chars[curpos] == '.') {
+ // ,,,,
+ result = new string (fmt_chars, begpos, curpos - begpos);
+ type = DIVIDERS;
+ pos = curpos;
+ } else {
+ result = ",";
+ type = COMMA;
+ pos++;
+ }
+ }
+ else if (current == '0' || current == '#') {
+ char placeHolder = current;
+ int begpos = curpos;
+ type = placeHolder == '0' ? PH_0 : PH_NUMBER;
+ curpos++;
+ while (curpos < fmtlen && fmt_chars [curpos] == placeHolder)
+ curpos++;
+ result = new string (fmt_chars, begpos, curpos - begpos);
+ pos = curpos;
+ }
+ else if (current == 'e' || current == 'E') {
+ if (fmtlen <= curpos + 1){
+ result = current.ToString ();
+ pos++;
+ }
+ else {
+ char next1 = fmt_chars [curpos + 1];
+
+ if (next1 != '-' && next1 != '+' && next1 != '0') {
+ result = new string (fmt_chars, curpos, 2);
+ pos += 2;
+ }
+ else {
+ int begpos = curpos;
+
+ if (next1 == '-' || next1 == '+')
+ curpos++;
+
+ curpos++;
+
+ if (curpos < fmtlen && fmt_chars [curpos] == '0'){
+ type = SCIENTIFIC;
+ while (curpos < fmtlen && fmt_chars [curpos] == '0')
+ curpos++;
+ }
+
+ result = new string (fmt_chars, begpos, curpos - begpos);
+ pos = curpos;
+ }
+ }
+ }
+ else {
+ char [] format_spec = { '0', '#', ',', '.', '%', 'E', 'e', '"', '\'', '\\' };
+ int nextFE;
+
+ while (curpos < fmtlen) {
+ current = fmt_chars[curpos];
+ nextFE = Array.IndexOf (format_spec, current);
+ if (nextFE != -1)
+ break;
+ curpos++;
+ }
+
+ result = new string (fmt_chars, pos, curpos - pos);
+ pos = curpos;
+ }
+
+ return result;
+ }
+}
+
+}
diff --git a/mcs/class/corlib/System/InvalidCastException.cs b/mcs/class/corlib/System/InvalidCastException.cs
new file mode 100644
index 00000000000..1d16ad5ce4d
--- /dev/null
+++ b/mcs/class/corlib/System/InvalidCastException.cs
@@ -0,0 +1,39 @@
+//
+// System.InvalidCastException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class InvalidCastException : SystemException {
+ // Constructors
+ public InvalidCastException ()
+ : base (Locale.GetText ("Cannot cast from source type to destination type"))
+ {
+ }
+
+ public InvalidCastException (string message)
+ : base (message)
+ {
+ }
+
+ public InvalidCastException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected InvalidCastException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/InvalidOperationException.cs b/mcs/class/corlib/System/InvalidOperationException.cs
new file mode 100644
index 00000000000..fddef520eb6
--- /dev/null
+++ b/mcs/class/corlib/System/InvalidOperationException.cs
@@ -0,0 +1,38 @@
+//
+// System.InvalidOperationException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+ [Serializable]
+ public class InvalidOperationException : SystemException {
+ // Constructors
+ public InvalidOperationException ()
+ : base (Locale.GetText ("The requested operation cannot be performed"))
+ {
+ }
+
+ public InvalidOperationException (string message)
+ : base (message)
+ {
+ }
+
+ public InvalidOperationException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected InvalidOperationException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/InvalidProgramException.cs b/mcs/class/corlib/System/InvalidProgramException.cs
new file mode 100644
index 00000000000..da235f0bf8e
--- /dev/null
+++ b/mcs/class/corlib/System/InvalidProgramException.cs
@@ -0,0 +1,31 @@
+//
+// System.InvalidProgramException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+namespace System {
+
+ [Serializable]
+ public sealed class InvalidProgramException : SystemException {
+ // Constructors
+ public InvalidProgramException ()
+ : base (Locale.GetText ("Metadata is incorrect"))
+ {
+ }
+
+ public InvalidProgramException (string message)
+ : base (message)
+ {
+ }
+
+ public InvalidProgramException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/LoaderOptimization.cs b/mcs/class/corlib/System/LoaderOptimization.cs
new file mode 100644
index 00000000000..23b865a32e5
--- /dev/null
+++ b/mcs/class/corlib/System/LoaderOptimization.cs
@@ -0,0 +1,18 @@
+//
+// System.LoaderOptimization.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ public enum LoaderOptimization
+ {
+ NotSpecified = 0,
+ SingleDomain = 1,
+ MultiDomain = 2,
+ MultiDomainHost = 3
+ }
+}
diff --git a/mcs/class/corlib/System/LoaderOptimizationAttribute.cs b/mcs/class/corlib/System/LoaderOptimizationAttribute.cs
new file mode 100644
index 00000000000..5a531965306
--- /dev/null
+++ b/mcs/class/corlib/System/LoaderOptimizationAttribute.cs
@@ -0,0 +1,34 @@
+//
+// System.LoaderOptimizationAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class LoaderOptimizationAttribute : Attribute
+ {
+ private LoaderOptimization lo;
+
+ // Constructors
+ public LoaderOptimizationAttribute (byte value)
+ {
+ lo = (LoaderOptimization) value;
+ }
+
+ public LoaderOptimizationAttribute (LoaderOptimization value)
+ {
+ lo = value;
+ }
+
+ // Properties
+ public LoaderOptimization Value
+ {
+ get { return lo; }
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/LocalDataStoreSlot.cs b/mcs/class/corlib/System/LocalDataStoreSlot.cs
new file mode 100755
index 00000000000..721d3ca880e
--- /dev/null
+++ b/mcs/class/corlib/System/LocalDataStoreSlot.cs
@@ -0,0 +1,18 @@
+//
+// System.LocalDataStoreSlot.cs
+//
+// Author:
+// Dick Porter (dick@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace System
+{
+ public sealed class LocalDataStoreSlot
+ {
+ }
+}
diff --git a/mcs/class/corlib/System/MTAThreadAttribute.cs b/mcs/class/corlib/System/MTAThreadAttribute.cs
new file mode 100644
index 00000000000..514bca495a4
--- /dev/null
+++ b/mcs/class/corlib/System/MTAThreadAttribute.cs
@@ -0,0 +1,19 @@
+//
+// System.MTAThreadAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class MTAThreadAttribute : Attribute
+ {
+ // Constructors
+ public MTAThreadAttribute () : base ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MarshalByRefObject.cs b/mcs/class/corlib/System/MarshalByRefObject.cs
new file mode 100644
index 00000000000..53051ceba32
--- /dev/null
+++ b/mcs/class/corlib/System/MarshalByRefObject.cs
@@ -0,0 +1,36 @@
+//
+// System.MarshalByRefObject.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Remoting;
+
+namespace System {
+
+ [Serializable]
+ public abstract class MarshalByRefObject {
+
+ public virtual ObjRef CreateObjRef (Type type)
+ {
+ return null;
+ }
+
+ public object GetLifetimeService ()
+ {
+ return null;
+ }
+
+ public virtual object InitializeLifetimeService ()
+ {
+ return null;
+ }
+
+ protected MarshalByRefObject ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Math.cs b/mcs/class/corlib/System/Math.cs
new file mode 100644
index 00000000000..e5eb68a2b42
--- /dev/null
+++ b/mcs/class/corlib/System/Math.cs
@@ -0,0 +1,312 @@
+//
+// System.Math.cs
+//
+// Author:
+// Bob Smith (bob@thestuff.net)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2001 Bob Smith. http://www.thestuff.net
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System
+{
+ [CLSCompliant(false)]
+ public sealed class Math
+ {
+ public const double E = 2.7182818284590452354;
+ public const double PI = 3.14159265358979323846;
+
+ private Math () {}
+
+ public static decimal Abs(decimal value)
+ {
+ return (value < 0)? -value: value;
+ }
+ public static double Abs(double value)
+ {
+ return (value < 0)? -value: value;
+ }
+ public static float Abs(float value)
+ {
+ return (value < 0)? -value: value;
+ }
+ public static int Abs(int value)
+ {
+ if (value == Int32.MinValue)
+ throw new OverflowException (Locale.GetText (Locale.GetText ("Value is too small")));
+ return (value < 0)? -value: value;
+ }
+ public static long Abs(long value)
+ {
+ if (value == Int64.MinValue)
+ throw new OverflowException(Locale.GetText ("Value is too small"));
+ return (value < 0)? -value: value;
+ }
+ public static sbyte Abs(sbyte value)
+ {
+ if (value == SByte.MinValue)
+ throw new OverflowException(Locale.GetText ("Value is too small"));
+ return (sbyte)((value < 0)? -value: value);
+ }
+ public static short Abs(short value)
+ {
+ if (value == Int16.MinValue)
+ throw new OverflowException(Locale.GetText ("Value is too small"));
+ return (short)((value < 0)? -value: value);
+ }
+
+ public static double Ceiling(double a)
+ {
+ double b = (double)((long)a);
+ return (b < a)? b+1: b;
+ }
+ public static double Floor(double d) {
+ return (double)((long)d) ;
+ }
+ public static double IEEERemainder(double x, double y)
+ {
+ double r;
+ if (y == 0) return Double.NaN;
+ r = x - (y * Math.Round(x/y));
+ if (r != 0) return r;
+ return (x > 0)? 0: -0;
+ }
+ public static double Log(double a, double newBase)
+ {
+ if (a == 0) return Double.NegativeInfinity;
+ else if (a < 0) return Double.NaN;
+ return Log(a)/Log(newBase);
+ }
+
+ public static byte Max(byte val1, byte val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static decimal Max(decimal val1, decimal val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static double Max(double val1, double val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static float Max(float val1, float val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static int Max(int val1, int val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static long Max(long val1, long val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static sbyte Max(sbyte val1, sbyte val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static short Max(short val1, short val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static uint Max(uint val1, uint val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static ulong Max(ulong val1, ulong val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static ushort Max(ushort val1, ushort val2)
+ {
+ return (val1 > val2)? val1: val2;
+ }
+ public static byte Min(byte val1, byte val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static decimal Min(decimal val1, decimal val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static double Min(double val1, double val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static float Min(float val1, float val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static int Min(int val1, int val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static long Min(long val1, long val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static sbyte Min(sbyte val1, sbyte val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static short Min(short val1, short val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static uint Min(uint val1, uint val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static ulong Min(ulong val1, ulong val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+ public static ushort Min(ushort val1, ushort val2)
+ {
+ return (val1 < val2)? val1: val2;
+ }
+
+ public static decimal Round(decimal d)
+ {
+ decimal r = (decimal)((long)d);
+ decimal a = d-r;
+ if (a > .5M) return ++r;
+ else if (a <.5M) return r;
+ else
+ {
+ if (r%2 == 0) return r;
+ else return ++r;
+ }
+ }
+ public static decimal Round(decimal d, int decimals)
+ {
+ long p = 10;
+ int c;
+ decimal retval = d;
+ if (decimals < 0 || decimals > 15)
+ throw new ArgumentOutOfRangeException(Locale.GetText (
+ "Value is too small or too big."));
+ else if (decimals == 0)
+ return Math.Round(d);
+ for (c=0; c<decimals; c++) p*=10;
+ retval*=p;
+ retval=Math.Round(retval);
+ retval/=p;
+ return retval;
+ }
+ public static double Round(double d)
+ {
+ double r = (double)((long)d);
+ double a = d-r;
+ if (a > .5) return ++r;
+ else if (a <.5) return r;
+ else
+ {
+ if (r%2 == 0) return r;
+ else return ++r;
+ }
+ }
+ public static double Round(double value, int digits) {
+ long p = 10;
+ int c;
+ double retval = value;
+ if (digits < 0 || digits > 15)
+ throw new ArgumentOutOfRangeException(Locale.GetText (
+ "Value is too small or too big."));
+ else if (digits == 0)
+ return Math.Round(value);
+ for (c=0; c<digits; c++) p*=10;
+ retval*=p;
+ retval=Math.Round(retval);
+ retval/=p;
+ return retval;
+ }
+ public static int Sign(decimal value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+ public static int Sign(double value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+ public static int Sign(float value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+ public static int Sign(int value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+ public static int Sign(long value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+ public static int Sign(sbyte value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+ public static int Sign(short value)
+ {
+ if (value > 0) return 1;
+ return (value == 0)? 0: -1;
+ }
+
+ // internal calls
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Sin (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Cos (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Tan (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Sinh (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Cosh (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Tanh (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Acos (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Asin (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Atan (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Atan2 (double y, double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Exp (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Log (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Log10 (double x);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Pow (double x, double y);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ public extern static double Sqrt (double x);
+ }
+}
diff --git a/mcs/class/corlib/System/MemberAccessException.cs b/mcs/class/corlib/System/MemberAccessException.cs
new file mode 100644
index 00000000000..97a556fb7e4
--- /dev/null
+++ b/mcs/class/corlib/System/MemberAccessException.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class MemberAccessException : SystemException {
+
+ public MemberAccessException ()
+ : base (Locale.GetText ("A member access exception has occurred."))
+ {
+ }
+
+ public MemberAccessException (string message)
+ : base (message)
+ {
+ }
+
+ protected MemberAccessException (SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public MemberAccessException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MethodAccessException.cs b/mcs/class/corlib/System/MethodAccessException.cs
new file mode 100644
index 00000000000..16295606174
--- /dev/null
+++ b/mcs/class/corlib/System/MethodAccessException.cs
@@ -0,0 +1,42 @@
+//
+// System.MethodAccessException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class MethodAccessException : MemberAccessException
+ {
+ // Constructors
+ public MethodAccessException ()
+ : base (Locale.GetText ("Attempt to access a private/protected method failed."))
+ {
+ }
+
+ public MethodAccessException (string message)
+ : base (message)
+ {
+ }
+
+ protected MethodAccessException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public MethodAccessException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/MissingFieldException.cs b/mcs/class/corlib/System/MissingFieldException.cs
new file mode 100644
index 00000000000..d53b65bd976
--- /dev/null
+++ b/mcs/class/corlib/System/MissingFieldException.cs
@@ -0,0 +1,45 @@
+//
+// System.MissingFieldException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class MissingFieldException : MissingMemberException
+ {
+ // Constructors
+ public MissingFieldException ()
+ : base (Locale.GetText ("Field does not exist."))
+ {
+ }
+
+ public MissingFieldException (string message)
+ : base (message)
+ {
+ }
+
+ protected MissingFieldException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public MissingFieldException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ public MissingFieldException (string className, string fieldName)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MissingMemberException.cs b/mcs/class/corlib/System/MissingMemberException.cs
new file mode 100644
index 00000000000..5f1f72d9d7a
--- /dev/null
+++ b/mcs/class/corlib/System/MissingMemberException.cs
@@ -0,0 +1,73 @@
+//
+// System.MissingMemberException.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class MissingMemberException : MemberAccessException {
+
+ // Fields
+ protected string ClassName;
+ protected string MemberName;
+ protected byte[] Signature;
+ private string msg;
+
+ // Constructors
+ public MissingMemberException ()
+ : base (Locale.GetText ("A missing member exception has occurred."))
+ {
+ msg = Locale.GetText ("A missing member exception has occured.");
+ }
+
+ public MissingMemberException (string message)
+ : base (message)
+ {
+ msg = message;
+ }
+
+ protected MissingMemberException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ ClassName = info.GetString ("MMClassName");
+ MemberName = info.GetString ("MMMemberName");
+ Signature = (byte[]) info.GetValue ("MMSignature", Signature.GetType ());
+ }
+
+ public MissingMemberException (string message, Exception inner)
+ : base (message, inner)
+ {
+ msg = message;
+ }
+
+ public MissingMemberException (string className, string memberName)
+ {
+ ClassName = className;
+ MemberName = memberName;
+ }
+
+ // Properties
+ public override string Message
+ {
+ get { return msg; }
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("MMClassName", ClassName);
+ info.AddValue ("MMMemberName", MemberName);
+ info.AddValue ("MMSignature", Signature);
+
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/MissingMethodException.cs b/mcs/class/corlib/System/MissingMethodException.cs
new file mode 100644
index 00000000000..ea246fc3869
--- /dev/null
+++ b/mcs/class/corlib/System/MissingMethodException.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Runtime.Serialization;
+using System.Globalization;
+
+
+namespace System
+{
+ [Serializable]
+ public class MissingMethodException : MissingMemberException
+ {
+ public MissingMethodException ()
+ : base (Locale.GetText ("A missing method exception has occurred."))
+ {
+ }
+
+ public MissingMethodException (string message)
+ : base (message)
+ {
+ }
+
+ protected MissingMethodException (SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public MissingMethodException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
+
+
diff --git a/mcs/class/corlib/System/MonoCustomAttrs.cs b/mcs/class/corlib/System/MonoCustomAttrs.cs
new file mode 100755
index 00000000000..c8b874c5932
--- /dev/null
+++ b/mcs/class/corlib/System/MonoCustomAttrs.cs
@@ -0,0 +1,60 @@
+// System.MonoCustomAttrs.cs
+// Hooks into the runtime to get custom attributes for reflection handles
+//
+// Paolo Molaro (lupus@ximian.com)
+//
+// (c) 2002 Ximian, Inc.
+
+using System;
+using System.Reflection;
+using System.Collections;
+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) {
+ 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 object[] GetCustomAttributes (ICustomAttributeProvider obj, Type attributeType, bool inherit) {
+ // handle inherit
+ object[] res = from_cache (obj);
+ // shortcut
+ if (res.Length == 1 && res[0].GetType () == attributeType)
+ return (object[])res.Clone ();
+ ArrayList a = new ArrayList ();
+ foreach (object attr in res) {
+ if (attributeType.Equals (attr.GetType ()))
+ a.Add (attr);
+ }
+ Attribute[] r = new Attribute [a.Count];
+ a.CopyTo (r);
+ return r;
+ }
+
+ internal static object[] GetCustomAttributes (ICustomAttributeProvider obj, bool inherit) {
+ // handle inherit
+ return (Object[])from_cache (obj).Clone ();
+ }
+ internal static bool IsDefined (ICustomAttributeProvider obj, Type attributeType, bool inherit) {
+ // handle inherit
+ object[] res = from_cache (obj);
+ foreach (object attr in res) {
+ if (attributeType.Equals (attr.GetType ()))
+ return true;
+ }
+ return false;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MonoDummy.cs b/mcs/class/corlib/System/MonoDummy.cs
new file mode 100644
index 00000000000..6d79023ee44
--- /dev/null
+++ b/mcs/class/corlib/System/MonoDummy.cs
@@ -0,0 +1,20 @@
+//
+// System.MonoDummy.cs
+//
+// Author:
+// Dietmar Maurer (dietmar@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ public class MonoDummy {
+
+ public MonoDummy ()
+ {
+ throw new ExecutionEngineException ();
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/MonoType.cs b/mcs/class/corlib/System/MonoType.cs
new file mode 100644
index 00000000000..9b5aba71f75
--- /dev/null
+++ b/mcs/class/corlib/System/MonoType.cs
@@ -0,0 +1,285 @@
+// System.MonoType
+//
+// Sean MacIsaac (macisaac@ximian.com)
+// Paolo Molaro (lupus@ximian.com)
+// Patrik Torstensson (patrik.torstensson@labs2.com)
+//
+// (C) 2001 Ximian, Inc.
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Globalization;
+
+namespace System
+{
+ internal struct MonoTypeInfo {
+ public string name;
+ public string name_space;
+ public Type parent;
+ public Type etype;
+ public Assembly assembly;
+ public TypeAttributes attrs;
+ public int rank;
+ public bool isbyref;
+ public bool ispointer;
+ public bool isprimitive;
+ }
+
+ internal class MonoType : Type
+ {
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void type_from_obj (MonoType type, Object obj);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void get_type_info (RuntimeTypeHandle type, out MonoTypeInfo info);
+
+ [MonoTODO]
+ internal MonoType (Object obj) {
+ // this should not be used - lupus
+ type_from_obj (this, obj);
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern TypeAttributes get_attributes (Type type);
+
+ protected override TypeAttributes GetAttributeFlagsImpl () {
+ return get_attributes (this);
+ }
+
+ [MonoTODO]
+ protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr);
+
+ [MonoTODO]
+ public override EventInfo GetEvent (string name, BindingFlags bindingAttr) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override EventInfo[] GetEvents (BindingFlags bindingAttr);
+
+ public override FieldInfo GetField( string name, BindingFlags bindingAttr) {
+ //FIXME
+ return null;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [MonoTODO]
+ public extern override FieldInfo[] GetFields (BindingFlags bindingAttr);
+
+ public override Type GetInterface (string name, bool ignoreCase) {
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ [MonoTODO]
+ public extern override Type[] GetInterfaces();
+
+ public override MemberInfo[] GetMembers( BindingFlags bindingAttr) {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override MethodInfo[] GetMethods (BindingFlags bindingAttr);
+
+ protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ // FIXME
+ return null;
+ }
+
+ public override Type GetNestedType( string name, BindingFlags bindingAttr) {
+ // FIXME
+ return null;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override Type[] GetNestedTypes (BindingFlags bindingAttr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override PropertyInfo[] GetProperties( BindingFlags bindingAttr);
+
+ [MonoTODO]
+ protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ // fixme: needs to use the binder, and send the modifiers to that binder
+ if (null == name || types == null)
+ throw new ArgumentNullException();
+
+ bool found = false;
+ PropertyInfo ret = null;
+ PropertyInfo [] props = GetProperties(bindingAttr);
+
+ foreach (PropertyInfo info in props) {
+ if (info.Name != name)
+ continue;
+
+ if (returnType != null)
+ if (info.GetGetMethod().ReturnType != returnType)
+ continue;
+
+ if (types.Length > 0) {
+ if (info.GetIndexParameters().Length != types.Length)
+ continue;
+
+ // fixme: compare parameters
+ }
+
+ if (null != ret)
+ throw new AmbiguousMatchException();
+
+ ret = info;
+ }
+
+ return ret;
+ }
+
+ protected override bool HasElementTypeImpl () {
+ return IsArrayImpl() || IsByRefImpl() || IsPointerImpl ();
+ }
+
+ protected override bool IsArrayImpl () {
+ return type_is_subtype_of (this, typeof (System.Array), false);
+ }
+ protected override bool IsByRefImpl () {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.isbyref;
+ }
+ protected override bool IsCOMObjectImpl () {
+ return false;
+ }
+ protected override bool IsPointerImpl () {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.ispointer;
+ }
+ protected override bool IsPrimitiveImpl () {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.isprimitive;
+ }
+ protected override bool IsValueTypeImpl () {
+ return type_is_subtype_of (this, typeof (System.ValueType), false) &&
+ this != typeof (System.ValueType) &&
+ this != typeof (System.Enum);
+ }
+
+ public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
+ // FIXME
+ return null;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override Type GetElementType();
+
+ public override Type UnderlyingSystemType {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.etype;
+ }
+ }
+
+ public override Assembly Assembly {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.assembly;
+ }
+ }
+
+ public override string AssemblyQualifiedName {
+ get {
+ return getFullName () + "," + Assembly.ToString ();
+ }
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern string getFullName();
+
+ public override Type BaseType {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.parent;
+ }
+ }
+
+ public override string FullName {
+ get {
+ return getFullName ();
+ }
+ }
+
+ public override Guid GUID {
+ get {return Guid.Empty;}
+ }
+
+ public override bool IsDefined (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
+ }
+
+ public override object[] GetCustomAttributes (bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, inherit);
+ }
+
+ public override object[] GetCustomAttributes (Type attributeType, bool inherit)
+ {
+ return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
+ }
+
+ public override MemberTypes MemberType {
+ get {
+ return MemberTypes.TypeInfo;
+ }
+ }
+
+ public override string Name {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.name;
+ }
+ }
+
+ public override string Namespace {
+ get {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.name_space;
+ }
+ }
+
+ public override Module Module {
+ get {
+ return null;
+ }
+ }
+
+ public override Type ReflectedType {
+ get {
+ return null;
+ }
+ }
+
+ public override RuntimeTypeHandle TypeHandle {
+ get {
+ return _impl;
+ }
+ }
+
+ public override int GetArrayRank () {
+ MonoTypeInfo info;
+ get_type_info (_impl, out info);
+ return info.rank;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MulticastDelegate.cs b/mcs/class/corlib/System/MulticastDelegate.cs
new file mode 100644
index 00000000000..8a4d937807b
--- /dev/null
+++ b/mcs/class/corlib/System/MulticastDelegate.cs
@@ -0,0 +1,151 @@
+//
+// System.MultiCastDelegate.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+// Daniel Stodden (stodden@in.tum.de)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Remove Missing
+//
+
+using System.Globalization;
+
+namespace System {
+
+ public abstract class MulticastDelegate : Delegate
+ {
+ private MulticastDelegate prev;
+
+ protected MulticastDelegate (object target, string method)
+ : base (target, method)
+ {
+ prev = null;
+ }
+
+ protected MulticastDelegate (Type target_type, string method)
+ : base (target_type, method)
+ {
+ prev = null;
+ }
+
+#if NOTYET
+ private MulticastDelegate (Type target_type, string method, Delegate [] list)
+ : base (target_type, method)
+ {
+ invocation_list = (Delegate[])list.Clone ();
+ }
+#endif
+
+#if NOTYET
+ public MethodInfo Method {
+ get {
+ return null;
+ }
+ }
+#endif
+
+ public override object DynamicInvokeImpl( object[] args )
+ {
+ if ( prev != null )
+ prev.DynamicInvokeImpl( args );
+
+ return base.DynamicInvokeImpl( args );
+ }
+
+ // <remarks>
+ // Equals: two multicast delegates are equal if their base is equal
+ // and their invocations list is equal.
+ // </remarks>
+ public override bool Equals (object o)
+ {
+ if ( ! base.Equals( o ) )
+ return false;
+
+ MulticastDelegate d = this;
+ MulticastDelegate c = (MulticastDelegate) o;
+ do {
+ if ( d != c )
+ return false;
+
+ c = c.prev;
+ d = d.prev;
+ } while ( (object)d != null );
+
+ if ( (object)c == null )
+ return true;
+
+ return false;
+ }
+
+ //
+ // FIXME: This could use some improvements.
+ //
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ // <summary>
+ // Return, in order of invocation, the invocation list
+ // of a MulticastDelegate
+ // </summary>
+ public override Delegate[] GetInvocationList()
+ {
+ throw new NotImplementedException();
+ }
+
+ // <summary>
+ // Combines this MulticastDelegate with the (Multicast)Delegate `follow'.
+ // This does _not_ combine with Delegates. ECMA states the whole delegate
+ // thing should have better been a simple System.Delegate class.
+ // Compiler generated delegates are always MulticastDelegates.
+ // </summary>
+ protected override Delegate CombineImpl( Delegate follow )
+ {
+ MulticastDelegate combined, orig, clone;
+
+ if ( this.GetType() != follow.GetType() )
+ throw new ArgumentException( Locale.GetText("Incompatible Delegate Types") );
+
+ combined = (MulticastDelegate)follow.Clone();
+
+ for ( clone = combined, orig = ((MulticastDelegate)follow).prev;
+ (object)orig != null; orig = orig.prev ) {
+
+ clone.prev = (MulticastDelegate)orig.Clone();
+ clone = clone.prev;
+ }
+
+ clone.prev = (MulticastDelegate)this.Clone();
+
+ for ( clone = clone.prev, orig = this.prev;
+ (object)orig != null; orig = orig.prev ) {
+
+ clone.prev = (MulticastDelegate)orig.Clone();
+ clone = clone.prev;
+ }
+
+ return combined;
+ }
+
+ protected override Delegate RemoveImpl( Delegate value )
+ {
+ throw new NotImplementedException();
+ }
+
+ public static bool operator == (MulticastDelegate a, MulticastDelegate b) {
+ if ((object)a == null) {
+ if ((object)b == null)
+ return true;
+ return false;
+ }
+ return a.Equals (b);
+ }
+
+ public static bool operator != (MulticastDelegate a, MulticastDelegate b) {
+ return !(a == b);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/MulticastNotSupportedException.cs b/mcs/class/corlib/System/MulticastNotSupportedException.cs
new file mode 100644
index 00000000000..6417207fa72
--- /dev/null
+++ b/mcs/class/corlib/System/MulticastNotSupportedException.cs
@@ -0,0 +1,31 @@
+//
+// System.MulticastNotSupportedException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+namespace System {
+
+ [Serializable]
+ public sealed class MulticastNotSupportedException : SystemException {
+ // Constructors
+ public MulticastNotSupportedException ()
+ : base (Locale.GetText ("This operation cannot be performed with the specified delagates"))
+ {
+ }
+
+ public MulticastNotSupportedException (string message)
+ : base (message)
+ {
+ }
+
+ public MulticastNotSupportedException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/NonSerializedAttribute.cs b/mcs/class/corlib/System/NonSerializedAttribute.cs
new file mode 100755
index 00000000000..7ac82dfe67a
--- /dev/null
+++ b/mcs/class/corlib/System/NonSerializedAttribute.cs
@@ -0,0 +1,18 @@
+
+//
+// System/NonSerializedAttribute.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
+ public sealed class NonSerializedAttribute : Attribute {
+ public NonSerializedAttribute() {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/NotFiniteNumberException.cs b/mcs/class/corlib/System/NotFiniteNumberException.cs
new file mode 100644
index 00000000000..dd3cc054b48
--- /dev/null
+++ b/mcs/class/corlib/System/NotFiniteNumberException.cs
@@ -0,0 +1,67 @@
+//
+// System.NotFiniteNumberException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class NotFiniteNumberException : ArithmeticException {
+ double offending_number;
+
+ // Constructors
+ public NotFiniteNumberException ()
+ : base (Locale.GetText ("The number encountered was not a finite quantity"))
+ {
+ }
+
+ public NotFiniteNumberException (double offending_number)
+ {
+ this.offending_number = offending_number;
+ }
+
+ public NotFiniteNumberException (string message)
+ : base (message)
+ {
+ }
+
+ public NotFiniteNumberException (string message, double offending_number)
+ {
+ this.offending_number = offending_number;
+ }
+
+ public NotFiniteNumberException (string message, double offending_number, Exception inner)
+ : base (message, inner)
+ {
+ this.offending_number = offending_number;
+ }
+
+ protected NotFiniteNumberException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ offending_number = info.GetDouble ("OffendingNumber");
+ }
+
+ // Properties
+ public double OffendingNumber {
+ get {
+ return offending_number;
+ }
+ }
+
+ // Method
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("OffendingNumber", offending_number);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/NotImplementedException.cs b/mcs/class/corlib/System/NotImplementedException.cs
new file mode 100755
index 00000000000..5a7f80b3338
--- /dev/null
+++ b/mcs/class/corlib/System/NotImplementedException.cs
@@ -0,0 +1,39 @@
+//
+// System.NotImplementedException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class NotImplementedException : SystemException {
+ // Constructors
+ public NotImplementedException ()
+ : base (Locale.GetText ("The requested feature is not yet implemented"))
+ {
+ }
+
+ public NotImplementedException (string message)
+ : base (message)
+ {
+ }
+
+ public NotImplementedException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected NotImplementedException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/NotSupportedException.cs b/mcs/class/corlib/System/NotSupportedException.cs
new file mode 100644
index 00000000000..de3fb785b5b
--- /dev/null
+++ b/mcs/class/corlib/System/NotSupportedException.cs
@@ -0,0 +1,39 @@
+//
+// System.NotSupportedException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class NotSupportedException : SystemException {
+ // Constructors
+ public NotSupportedException ()
+ : base (Locale.GetText ("Operation is not supported"))
+ {
+ }
+
+ public NotSupportedException (string message)
+ : base (message)
+ {
+ }
+
+ public NotSupportedException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected NotSupportedException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/NullReferenceException.cs b/mcs/class/corlib/System/NullReferenceException.cs
new file mode 100644
index 00000000000..009732ce07b
--- /dev/null
+++ b/mcs/class/corlib/System/NullReferenceException.cs
@@ -0,0 +1,39 @@
+//
+// System.NullReferenceException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class NullReferenceException : SystemException {
+ // Constructors
+ public NullReferenceException ()
+ : base (Locale.GetText ("A null value was found where an object instance was required"))
+ {
+ }
+
+ public NullReferenceException (string message)
+ : base (message)
+ {
+ }
+
+ public NullReferenceException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected NullReferenceException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Object.cs b/mcs/class/corlib/System/Object.cs
new file mode 100644
index 00000000000..54850461227
--- /dev/null
+++ b/mcs/class/corlib/System/Object.cs
@@ -0,0 +1,108 @@
+//
+// System.Object.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ public class Object {
+
+ // <summary>
+ // Compares this object to the specified object.
+ // Returns true if they are equal, false otherwise.
+ // </summary>
+ public virtual bool Equals (object o)
+ {
+ return this == o;
+ }
+
+ // <summary>
+ // Compares two objects for equality
+ // </summary>
+ public static bool Equals (object a, object b)
+ {
+ if (a == b)
+ return true;
+
+ if (a == null || b == null)
+ return false;
+
+ return a.Equals (b);
+ }
+
+ // <summary>
+ // Initializes a new instance of the object class.
+ // </summary>
+ public Object ()
+ {
+ }
+
+ // <summary>
+ // Object destructor.
+ // </summary>
+ ~Object ()
+ {
+ }
+
+ // <summary>
+ // Returns a hashcode for this object. Each derived
+ // class should return a hash code that makes sense
+ // for that particular implementation of the object.
+ // </summary>
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern virtual int GetHashCode ();
+
+ // <summary>
+ // Returns the Type associated with the object.
+ // </summary>
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern Type GetType ();
+
+ // <summary>
+ // Shallow copy of the object.
+ // </summary>
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ protected extern object MemberwiseClone ();
+
+ // <summary>
+ // Returns a stringified representation of the object.
+ // This is not supposed to be used for user presentation,
+ // use Format() for that and IFormattable.
+ //
+ // ToString is mostly used for debugging purposes.
+ // </summary>
+ public virtual string ToString ()
+ {
+ return GetType().FullName;
+ }
+
+ // <summary>
+ // Tests whether a is equal to b.
+ // Can not figure out why this even exists
+ // </summary>
+ public static bool ReferenceEquals (object a, object b)
+ {
+ return (a == b);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern IntPtr obj_address ();
+
+ void FieldGetter (string typeName, string fieldName, ref object val)
+ {
+ /* never called */
+ }
+
+ void FieldSetter (string typeName, string fieldName, object val)
+ {
+ /* never called */
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ObjectDisposedException.cs b/mcs/class/corlib/System/ObjectDisposedException.cs
new file mode 100755
index 00000000000..b1e390aa5be
--- /dev/null
+++ b/mcs/class/corlib/System/ObjectDisposedException.cs
@@ -0,0 +1,60 @@
+//
+// System.ObjectDisposedException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class ObjectDisposedException : InvalidOperationException {
+ private string obj_name;
+ private string msg;
+
+ // Constructors
+ public ObjectDisposedException (string objectName)
+ : base (Locale.GetText ("The object was used after being disposed"))
+ {
+ obj_name = objectName;
+ msg = Locale.GetText ("The object was used after being disposed");
+ }
+
+ public ObjectDisposedException (string objectName, string message)
+ : base (message)
+ {
+ obj_name = objectName;
+ msg = message;
+ }
+
+ protected ObjectDisposedException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ obj_name = info.GetString ("ObjectName");
+ }
+
+ // Properties
+ public override string Message
+ {
+ get { return msg; }
+ }
+
+ public string ObjectName
+ {
+ get { return obj_name; }
+ }
+
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("ObjectName", obj_name);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ObsoleteAttribute.cs b/mcs/class/corlib/System/ObsoleteAttribute.cs
new file mode 100644
index 00000000000..6215c9379fd
--- /dev/null
+++ b/mcs/class/corlib/System/ObsoleteAttribute.cs
@@ -0,0 +1,48 @@
+//
+// System.ObsoleteAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct |
+ AttributeTargets.Enum | AttributeTargets.Constructor |
+ AttributeTargets.Method | AttributeTargets.Property |
+ AttributeTargets.Field | AttributeTargets.Event |
+ AttributeTargets.Interface | AttributeTargets.Delegate)]
+ [Serializable]
+ public sealed class ObsoleteAttribute : Attribute
+ {
+ private string message;
+ private bool isError = false;
+
+ // Constructors
+ public ObsoleteAttribute ()
+ : base ()
+ {
+ }
+
+ public ObsoleteAttribute (string message)
+ {
+ this.message = message;
+ }
+
+ public ObsoleteAttribute (string message, bool error)
+ {
+ this.message = message;
+ this.isError = error;
+ }
+
+ // Properties
+ public string Message {
+ get { return message; }
+ }
+
+ public bool IsError {
+ get { return isError; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/OperatingSystem.cs b/mcs/class/corlib/System/OperatingSystem.cs
new file mode 100644
index 00000000000..93729bb4a45
--- /dev/null
+++ b/mcs/class/corlib/System/OperatingSystem.cs
@@ -0,0 +1,106 @@
+//------------------------------------------------------------------------------
+//
+// System.OperatingSystem.cs
+//
+// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
+//
+// Author: Jim Richardson, develop@wtfo-guru.com
+// Created: Saturday, August 11, 2001
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Globalization;
+
+namespace System
+{
+ /// <summary>
+ /// Class representing a specific operating system version for a specific platform
+ /// </summary>
+ [Serializable]
+ public sealed class OperatingSystem : ICloneable
+ {
+ private System.PlatformID itsPlatform;
+ private Version itsVersion;
+
+ public OperatingSystem(PlatformID platform, Version version)
+ {
+ if(version == null)
+ {
+ throw new ArgumentNullException();
+ }
+
+ itsPlatform = platform;
+ itsVersion = version;
+ }
+
+ /// <summary>
+ /// Get the PlatformID
+ /// </summary>
+ public PlatformID Platform
+ {
+ get
+ {
+ return itsPlatform;
+ }
+ }
+
+ /// <summary>
+ /// Gets the version object
+ /// </summary>
+ public Version Version
+ {
+ get
+ {
+ return itsVersion;
+ }
+ }
+
+ /// <summary>
+ /// Return a clone of this object
+ /// </summary>
+ public object Clone()
+ {
+ return new OperatingSystem(itsPlatform, itsVersion);
+ }
+
+ /// <summary>
+ /// Return true if obj equals this object
+ /// </summary>
+ public override bool Equals(object obj)
+ {
+ //Check for null and compare run-time types.
+ if (obj == null || GetType() != obj.GetType()) return false;
+ OperatingSystem os = (OperatingSystem)obj;
+ return (itsPlatform == os.itsPlatform) &&
+ (os.itsVersion.Equals(itsVersion));
+ }
+
+ /// <summary>
+ /// Return hash code
+ /// </summary>
+ public override int GetHashCode()
+ { // this leave us enuf for 256 unique platforms which should suffice for a good while
+ return ((int)itsPlatform << 24) | itsVersion.GetHashCode() >> 8;
+ }
+
+ /// <summary>
+ /// Return a string reprentation of this instance
+ /// </summary>
+ public override string ToString()
+ {
+ string str;
+
+ switch(itsPlatform)
+ {
+ case System.PlatformID.Win32NT: str = "Microsoft Windows NT"; break;
+ case System.PlatformID.Win32S: str = "Microsoft Win32S"; break;
+ case System.PlatformID.Win32Windows: str = "Microsoft Windows 98"; break;
+ case System.PlatformID.Unix: str = "Unix"; break;
+ default: str = Locale.GetText ("<unknown>"); break;
+ }
+
+ return str + " " + itsVersion.ToString();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/OutOfMemoryException.cs b/mcs/class/corlib/System/OutOfMemoryException.cs
new file mode 100644
index 00000000000..a4f2388390d
--- /dev/null
+++ b/mcs/class/corlib/System/OutOfMemoryException.cs
@@ -0,0 +1,39 @@
+//
+// System.OutOfMemoryException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class OutOfMemoryException : SystemException {
+ // Constructors
+ public OutOfMemoryException ()
+ : base (Locale.GetText ("There is insufficient memory to continue execution"))
+ {
+ }
+
+ public OutOfMemoryException (string message)
+ : base (message)
+ {
+ }
+
+ public OutOfMemoryException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected OutOfMemoryException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/OverflowException.cs b/mcs/class/corlib/System/OverflowException.cs
new file mode 100644
index 00000000000..61e63e1e3a1
--- /dev/null
+++ b/mcs/class/corlib/System/OverflowException.cs
@@ -0,0 +1,39 @@
+//
+// System.OverflowExceptionException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class OverflowException : ArithmeticException {
+ // Constructors
+ public OverflowException ()
+ : base (Locale.GetText ("Number overflow"))
+ {
+ }
+
+ public OverflowException (string message)
+ : base (message)
+ {
+ }
+
+ public OverflowException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected OverflowException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ParamArrayAttribute.cs b/mcs/class/corlib/System/ParamArrayAttribute.cs
new file mode 100644
index 00000000000..322def26b8b
--- /dev/null
+++ b/mcs/class/corlib/System/ParamArrayAttribute.cs
@@ -0,0 +1,23 @@
+//
+// System.ParamArrayAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// Used to flag that the method will take a variable number
+ /// of arguments
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Parameter)]
+ public sealed class ParamArrayAttribute : Attribute {
+
+ public ParamArrayAttribute ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/PlatformID.cs b/mcs/class/corlib/System/PlatformID.cs
new file mode 100644
index 00000000000..56d2299e9fb
--- /dev/null
+++ b/mcs/class/corlib/System/PlatformID.cs
@@ -0,0 +1,37 @@
+// PlatformID.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:35:29 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System {
+
+
+ /// <summary>
+ /// </summary>
+ public enum PlatformID {
+
+ /// <summary>
+ /// </summary>
+ Win32S = 0,
+
+ /// <summary>
+ /// </summary>
+ Win32Windows = 1,
+
+ /// <summary>
+ /// </summary>
+ Win32NT = 2,
+
+ /// <summary>
+ /// </summary>
+ Unix = 128
+ } // PlatformID
+
+} // System
diff --git a/mcs/class/corlib/System/PlatformNotSupportedException.cs b/mcs/class/corlib/System/PlatformNotSupportedException.cs
new file mode 100644
index 00000000000..18960191d0a
--- /dev/null
+++ b/mcs/class/corlib/System/PlatformNotSupportedException.cs
@@ -0,0 +1,41 @@
+//
+// System.PlatformNotSupportedException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class PlatformNotSupportedException : NotSupportedException
+ {
+ // Constructors
+ public PlatformNotSupportedException ()
+ : base (Locale.GetText ("This platform is not supported."))
+ {
+ }
+
+ public PlatformNotSupportedException (string message)
+ : base (message)
+ {
+ }
+
+ protected PlatformNotSupportedException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public PlatformNotSupportedException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Random.cs b/mcs/class/corlib/System/Random.cs
new file mode 100644
index 00000000000..ed56c2c8ca8
--- /dev/null
+++ b/mcs/class/corlib/System/Random.cs
@@ -0,0 +1,83 @@
+//
+// System.Random.cs
+//
+// Author:
+// Bob Smith (bob@thestuff.net)
+//
+// (C) 2001 Bob Smith. http://www.thestuff.net
+//
+
+using System;
+using System.Globalization;
+
+namespace System
+{
+ [Serializable]
+ public class Random
+ {
+ private int S = 1;
+ private const int A = 16807;
+ private const int M = 2147483647;
+ private const int Q = 127773;
+ private const int R = 2836;
+
+ public Random()
+ {
+ S = (int)(DateTime.Now.Ticks);
+ }
+
+ public Random(int Seed)
+ {
+ S = Seed;
+ }
+
+ public virtual int Next()
+ {
+ return (int)(this.Sample()*Int32.MaxValue);
+ }
+
+ public virtual int Next(int maxValue)
+ {
+ if (maxValue < 0)
+ throw new ArgumentOutOfRangeException(Locale.GetText (
+ "Max value is less then min value."));
+ else if (maxValue == 0)
+ return 0;
+ return (int)(this.Sample()*maxValue);
+ }
+
+ public virtual int Next(int minValue, int maxValue)
+ {
+ if (minValue > maxValue)
+ throw new ArgumentOutOfRangeException(Locale.GetText (
+ "Min value is greater then max value."));
+ else if (minValue == maxValue)
+ return minValue;
+ return (int)(this.Sample()*maxValue)+minValue;
+ }
+ public virtual void NextBytes(byte[] buffer)
+ {
+ int i, l;
+ if (buffer == null)
+ throw new ArgumentNullException();
+ l = buffer.GetUpperBound(0);
+ for (i = buffer.GetLowerBound(0); i < l; i++)
+ {
+ buffer[i] = (byte)(this.Sample()*Byte.MaxValue);
+ }
+ }
+
+ public virtual double NextDouble ()
+ {
+ return this.Sample();
+ }
+
+ protected virtual double Sample ()
+ {
+ S = A*(S%Q)-R*(S/Q);
+ if (S < 0)
+ S+=M;
+ return S/(double)Int32.MaxValue;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/RankException.cs b/mcs/class/corlib/System/RankException.cs
new file mode 100644
index 00000000000..89813a4a123
--- /dev/null
+++ b/mcs/class/corlib/System/RankException.cs
@@ -0,0 +1,40 @@
+//
+// System.RankException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class RankException : SystemException {
+ // Constructors
+ public RankException ()
+ : base (Locale.GetText ("Two arrays must have the same number of dimensions"))
+ {
+ }
+
+ public RankException (string message)
+ : base (message)
+ {
+ }
+
+ public RankException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected RankException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/ResolveEventArgs.cs b/mcs/class/corlib/System/ResolveEventArgs.cs
new file mode 100644
index 00000000000..e0c10a65950
--- /dev/null
+++ b/mcs/class/corlib/System/ResolveEventArgs.cs
@@ -0,0 +1,29 @@
+//------------------------------------------------------------------------------
+//
+// System.ResolveEventArgs.cs
+//
+// Copyright (C) 2001 Nick Drochak, All Rights Reserved
+//
+// Author: Nick Drochak, ndrochak@gol.com
+// Created: 2002-01-06
+//
+//------------------------------------------------------------------------------
+
+using System;
+
+namespace System {
+
+ public class ResolveEventArgs : EventArgs
+ {
+ private string m_Name;
+ public string Name {get{return m_Name;}}
+
+ public ResolveEventArgs(string name){
+ m_Name = name;
+ }
+
+ } // ResolveEventArgs
+
+} // System
+
+
diff --git a/mcs/class/corlib/System/ResolveEventHandler.cs b/mcs/class/corlib/System/ResolveEventHandler.cs
new file mode 100644
index 00000000000..36471295a85
--- /dev/null
+++ b/mcs/class/corlib/System/ResolveEventHandler.cs
@@ -0,0 +1,10 @@
+// System.ResolveEventHandler
+//
+// Sean MacIsaac
+//
+// (C) 2001 Ximian, Inc.
+
+namespace System
+{
+ public delegate Reflection.Assembly ResolveEventHandler (object sender, ResolveEventArgs args);
+}
diff --git a/mcs/class/corlib/System/RuntimeArgumentHandle.cs b/mcs/class/corlib/System/RuntimeArgumentHandle.cs
new file mode 100644
index 00000000000..790f3c1a24d
--- /dev/null
+++ b/mcs/class/corlib/System/RuntimeArgumentHandle.cs
@@ -0,0 +1,16 @@
+//
+// System.RuntimeArgumentHandle.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ public struct RuntimeArgumentHandle
+ {
+ // This class has no members, its only use is for supporting
+ // va_args from C and C++.
+ }
+}
diff --git a/mcs/class/corlib/System/RuntimeFieldHandle.cs b/mcs/class/corlib/System/RuntimeFieldHandle.cs
new file mode 100755
index 00000000000..f4536856af9
--- /dev/null
+++ b/mcs/class/corlib/System/RuntimeFieldHandle.cs
@@ -0,0 +1,45 @@
+//
+// System.RuntimeFieldHandle.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System {
+
+ [MonoTODO]
+ [Serializable]
+ public struct RuntimeFieldHandle : ISerializable {
+ IntPtr value;
+
+ public IntPtr Value {
+ get {
+ return (IntPtr) value;
+ }
+ }
+
+ RuntimeFieldHandle (SerializationInfo info, StreamingContext context)
+ {
+ Type t;
+
+ if (info == null)
+ throw new ArgumentNullException ("info");
+
+ t = (Type) info.GetValue ("TypeObj", typeof (Type));
+
+ value = t.TypeHandle.Value;
+ if (value == (IntPtr) 0)
+ throw new SerializationException (Locale.GetText ("Insufficient state"));
+ }
+
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("TypeObj", value, value.GetType ());
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/RuntimeMethodHandle.cs b/mcs/class/corlib/System/RuntimeMethodHandle.cs
new file mode 100755
index 00000000000..649f7aa2c79
--- /dev/null
+++ b/mcs/class/corlib/System/RuntimeMethodHandle.cs
@@ -0,0 +1,34 @@
+//
+// System.RuntimeMethodHandle.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System {
+
+ //[MonoTODO]
+ [Serializable]
+ public struct RuntimeMethodHandle : ISerializable {
+ IntPtr value;
+
+ public IntPtr Value {
+ get {
+ return (IntPtr) value;
+ }
+ }
+
+ // This is from ISerializable
+ [MonoTODO]
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
+ }
+}
diff --git a/mcs/class/corlib/System/RuntimeTypeHandle.cs b/mcs/class/corlib/System/RuntimeTypeHandle.cs
new file mode 100644
index 00000000000..f81d5a3730d
--- /dev/null
+++ b/mcs/class/corlib/System/RuntimeTypeHandle.cs
@@ -0,0 +1,31 @@
+//
+// System.RuntimeTypeHandle.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public struct RuntimeTypeHandle : ISerializable {
+ IntPtr value;
+
+ public IntPtr Value {
+ get {
+ return (IntPtr) value;
+ }
+ }
+
+ [MonoTODO]
+ public void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/SByte.cs b/mcs/class/corlib/System/SByte.cs
new file mode 100644
index 00000000000..48c89062317
--- /dev/null
+++ b/mcs/class/corlib/System/SByte.cs
@@ -0,0 +1,227 @@
+//
+// System.SByte.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+
+namespace System {
+
+ [CLSCompliant(false)]
+ [Serializable]
+ public struct SByte : IComparable, IFormattable, IConvertible {
+
+ public const sbyte MinValue = -128;
+ public const sbyte MaxValue = 127;
+
+ // VES needs to know about value. public is workaround
+ // so source will compile
+ public sbyte value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.SByte))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.SByte"));
+
+ sbyte xv = (sbyte) v;
+ if (value == xv)
+ return 0;
+ if (value > xv)
+ return 1;
+ else
+ return -1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.SByte))
+ return false;
+
+ return ((sbyte) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ public static sbyte Parse (string s)
+ {
+ sbyte val = 0;
+ int len;
+ int i;
+ bool neg = false;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ c = s [i];
+ if (c == '+')
+ i++;
+ else if (c == '-'){
+ neg = true;
+ i++;
+ }
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ val = checked ((sbyte) (val * 10 + (c - '0')));
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ if (neg)
+ val = checked ((sbyte) -val);
+
+ return val;
+ }
+
+ public static sbyte Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ public static sbyte Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ public static sbyte Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ int tmpResult = Int32.Parse (s, style, fp);
+ if (tmpResult > SByte.MaxValue || tmpResult < SByte.MinValue)
+ throw new OverflowException ("Value too large or too small.");
+
+ return (sbyte) tmpResult;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== ICovnertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.SByte;
+ }
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+ public byte ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+ public char ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+ public double ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+ [CLSCompliant(false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return value;
+ }
+ public float ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+ [CLSCompliant(false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+ [CLSCompliant(false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+ [CLSCompliant(false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/STAThreadAttribute.cs b/mcs/class/corlib/System/STAThreadAttribute.cs
new file mode 100644
index 00000000000..da8e92cd0df
--- /dev/null
+++ b/mcs/class/corlib/System/STAThreadAttribute.cs
@@ -0,0 +1,19 @@
+//
+// System.STAThreadAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ [AttributeUsage (AttributeTargets.Method)]
+ public sealed class STAThreadAttribute : Attribute
+ {
+ // Constructors
+ public STAThreadAttribute () : base ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/SerializableAttribute.cs b/mcs/class/corlib/System/SerializableAttribute.cs
new file mode 100755
index 00000000000..e283d4afc39
--- /dev/null
+++ b/mcs/class/corlib/System/SerializableAttribute.cs
@@ -0,0 +1,38 @@
+//
+// System.SerializableAttribute.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// Serialization Attribute for classes.
+ /// </summary>
+
+ /// <remarks>
+ /// Use SerializableAttribute to mark classes that do not implement
+ /// the ISerializable interface but that want to be serialized.
+ ///
+ /// Failing to do so will cause the system to throw an exception.
+ ///
+ /// When a class is market with the SerializableAttribute, all the
+ /// fields are automatically serialized with the exception of those
+ /// that are tagged with the NonSerializedAttribute.
+ ///
+ /// SerializableAttribute should only be used for classes that contain
+ /// simple data types that can be serialized and deserialized by the
+ /// runtime (typically you would use NonSerializedAttribute on data
+ /// that can be reconstructed at any point: like caches or precomputed
+ /// tables).
+ /// </remarks>
+
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct
+ | AttributeTargets.Enum | AttributeTargets.Delegate,
+ Inherited=false, AllowMultiple=false)]
+ public sealed class SerializableAttribute : Attribute {
+ }
+}
diff --git a/mcs/class/corlib/System/Single.cs b/mcs/class/corlib/System/Single.cs
new file mode 100644
index 00000000000..9ee119841f0
--- /dev/null
+++ b/mcs/class/corlib/System/Single.cs
@@ -0,0 +1,201 @@
+//
+// System.Single.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public struct Single : IComparable, IFormattable, IConvertible {
+ public const float Epsilon = 1.4e-45f;
+ public const float MaxValue = 3.40282346638528859e38f;
+ public const float MinValue = -3.40282346638528859e38f;
+ public const float NaN = 0.0f / 0.0f;
+ public const float PositiveInfinity = 1.0f / 0.0f;
+ public const float NegativeInfinity = -1.0f / 0.0f;
+
+ // VES needs to know about value. public is workaround
+ // so source will compile
+ public float value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.Single))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.Single"));
+
+ return (int) (value - ((float) v));
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.Single))
+ return false;
+
+ return ((float) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) value;
+ }
+
+ public static bool IsInfinity (float f)
+ {
+ return (f == PositiveInfinity || f == NegativeInfinity);
+ }
+
+ public static bool IsNaN (float f)
+ {
+ return (f != f);
+ }
+
+ public static bool IsNegativeInfinity (float f)
+ {
+ return (f < 0.0f && (f == NegativeInfinity || f == PositiveInfinity));
+ }
+
+ public static bool IsPositiveInfinity (float f)
+ {
+ return (f > 0.0f && (f == NegativeInfinity || f == PositiveInfinity));
+ }
+
+ public static float Parse (string s)
+ {
+ return Parse (s, (NumberStyles.Float | NumberStyles.AllowThousands), null);
+ }
+
+ public static float Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, (NumberStyles.Float | NumberStyles.AllowThousands), fp);
+ }
+
+ public static float Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ [MonoTODO]
+ public static float Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ // TODO: Implement me
+ throw new NotImplementedException ();
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ [MonoTODO]
+ public string ToString (string format, IFormatProvider fp)
+ {
+ // TODO: Implement me.
+ throw new NotImplementedException ();
+ }
+
+ // ============= IConvertible Methods ============ //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.Single;
+ }
+
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+
+ public byte ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+
+ public char ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+
+ public double ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+
+ [CLSCompliant (false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+
+ public float ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant (false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+
+ [CLSCompliant (false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+
+ [CLSCompliant (false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/StackOverflowException.cs b/mcs/class/corlib/System/StackOverflowException.cs
new file mode 100644
index 00000000000..82edf55c607
--- /dev/null
+++ b/mcs/class/corlib/System/StackOverflowException.cs
@@ -0,0 +1,39 @@
+//
+// System.StackOverflowException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public sealed class StackOverflowException : SystemException {
+ // Constructors
+ public StackOverflowException ()
+ : base (Locale.GetText ("The requested operation caused a stack overflow"))
+ {
+ }
+
+ public StackOverflowException (string message)
+ : base (message)
+ {
+ }
+
+ public StackOverflowException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ internal StackOverflowException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/String.cs b/mcs/class/corlib/System/String.cs
new file mode 100644
index 00000000000..7941d37b8ad
--- /dev/null
+++ b/mcs/class/corlib/System/String.cs
@@ -0,0 +1,1090 @@
+//
+// System.String.cs
+//
+// Authors:
+// Patrik Torstensson (patrik.torstensson@labs2.com)
+// Jeffrey Stedfast (fejj@ximian.com)
+// Dan Lewis (dihlewis@yahoo.co.uk)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Text;
+using System.Collections;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+ public sealed class String : IConvertible, IComparable, ICloneable, IEnumerable {
+ private int length;
+
+ public static readonly String Empty = "";
+
+ [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)]
+ unsafe public extern String(char *value);
+
+ [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)]
+ unsafe public extern String(char *value, int sindex, int length);
+
+ [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)]
+ unsafe public extern String(sbyte *value);
+
+ [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)]
+ unsafe public extern String(sbyte *value, int sindex, int length);
+
+ [CLSCompliant(false), MethodImplAttribute(MethodImplOptions.InternalCall)]
+ unsafe public extern String(sbyte *value, int sindex, int length, Encoding enc);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern String(char [] val, int sindex, int length);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern String(char [] val);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern String(char c, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override int GetHashCode();
+
+ public static bool Equals(String str1, String str2) {
+ if ((Object) str1 == (Object) str2)
+ return true;
+
+ if (null == (Object) str1 || null == (Object) str2)
+ return false;
+
+ if (str1.length != str2.length)
+ return false;
+
+ return InternalEquals(str1, str2);
+ }
+
+ public static bool operator == (String str1, String str2) {
+ return Equals(str1, str2);
+ }
+
+ public static bool operator != (String str1, String str2) {
+ return !Equals(str1, str2);
+ }
+
+ public override bool Equals(Object obj) {
+ if (null == obj)
+ return false;
+
+ if (!(obj is String))
+ return false;
+
+ return InternalEquals(this, (String) obj);
+ }
+
+ public bool Equals(String value) {
+ if (null == value)
+ return false;
+
+ if (length != value.length)
+ return false;
+
+ return InternalEquals(this, value);
+ }
+
+ [IndexerName("Chars")]
+ public extern char this[int index] {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public Object Clone() {
+ return this;
+ }
+
+ public TypeCode GetTypeCode () {
+ return TypeCode.String;
+ }
+
+ public void CopyTo(int sindex, char[] dest, int dindex, int count) {
+ // LAMESPEC: should I null-terminate?
+
+ if (dest == null)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || dindex < 0 || count < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex + count > Length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (dindex + count > dest.Length)
+ throw new ArgumentOutOfRangeException ();
+
+ InternalCopyTo(sindex, dest, dindex, count);
+ }
+
+ public char[] ToCharArray() {
+ return ToCharArray(0, length);
+ }
+
+ public char[] ToCharArray(int sindex, int length) {
+ if (sindex < 0 || length < 0 || sindex + length > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ char [] tmp = new char[length];
+
+ InternalCopyTo(sindex, tmp, 0, length);
+
+ return tmp;
+ }
+
+ public String [] Split(params char [] separator) {
+ return Split(separator, Int32.MaxValue);
+ }
+
+ public String[] Split(char[] separator, int count) {
+ if (null == separator) {
+ separator = WhiteChars;
+ }
+
+ if (count < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (count == 0)
+ return new String[0];
+
+ if (count == 1)
+ return new String[1] { ToString() };
+
+ return InternalSplit(separator, count);
+ }
+
+ public String Substring (int sindex) {
+ if (sindex < 0 || sindex > this.length) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ string tmp = InternalAllocateStr(this.length - sindex);
+ InternalStrcpy(tmp, 0, this, sindex, length - sindex);
+
+ return tmp;
+ }
+
+ public String Substring (int sindex, int length) {
+ if (length < 0 || sindex < 0 || sindex + length > this.length) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ if (length == 0)
+ return String.Empty;
+
+ string tmp = InternalAllocateStr(length);
+ InternalStrcpy(tmp, 0, this, sindex, length);
+
+ return tmp;
+ }
+
+ private static readonly char[] WhiteChars = { (char) 0x9, (char) 0xA, (char) 0xB, (char) 0xC, (char) 0xD, (char) 0x20, (char) 0xA0, (char) 0x2000, (char) 0x2001, (char) 0x2002, (char) 0x2003, (char) 0x2004, (char) 0x2005,
+ (char) 0x2006, (char) 0x2007, (char) 0x2008, (char) 0x2009, (char) 0x200A, (char) 0x200B, (char) 0x3000, (char) 0xFEFF };
+
+ public String Trim(params char[] chars) {
+ if (null == chars || chars.Length == 0)
+ chars = WhiteChars;
+
+ return InternalTrim(chars, 0);
+ }
+
+ public String TrimStart(params char[] chars) {
+ if (null == chars || chars.Length == 0)
+ chars = WhiteChars;
+
+ return InternalTrim(chars, 1);
+ }
+
+ public String TrimEnd(params char[] chars) {
+ if (null == chars || chars.Length == 0)
+ chars = WhiteChars;
+
+ return InternalTrim(chars, 2);
+ }
+
+ public static int Compare(String s1, String s2) {
+ return Compare(s1, s2, false);
+ }
+
+ public static int Compare(String s1, String s2, bool inCase) {
+ if (null == s1) {
+ if (null == s2)
+ return 0;
+ else
+ return -1;
+ } else if (null == s2)
+ return 1;
+
+ return InternalCompare(s1, 0, s2, 0, Math.Max(s1.length, s2.length), inCase);
+ }
+
+ [MonoTODO()]
+ public static int Compare(String s1, String s2, bool inCase, CultureInfo culture) {
+ return Compare(s1, s2, inCase);
+ }
+
+ public static int Compare(String s1, int i1, String s2, int i2, int length) {
+ return Compare(s1, i1, s2, i2, length, false);
+ }
+
+ public static int Compare(String s1, int i1, String s2, int i2, int length, bool inCase) {
+ if (null == s1) {
+ if (null == s2)
+ return 0;
+ else
+ return -1;
+ } else if (null == s2)
+ return 1;
+
+ if (length < 0 || i1 < 0 || i2 < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (i1 > s1.length || i2 > s2.length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (length == 0)
+ return 0;
+
+ return InternalCompare(s1, i1, s2, i2, length, inCase);
+ }
+
+ [MonoTODO()]
+ public static int Compare(String s1, int i1, String s2, int i2, int length, bool inCase, CultureInfo culture) {
+ return Compare(s1, i1, s2, i2, length, inCase);
+ }
+
+ public int CompareTo(Object value) {
+ if (null == value)
+ return 1;
+
+ if (!(value is String))
+ throw new ArgumentException();
+
+ return String.Compare(this, (String) value, false);
+ }
+
+ public int CompareTo(String str) {
+ if (null == str)
+ return 1;
+
+ return Compare(this, str, false);
+ }
+
+ public static int CompareOrdinal(String s1, String s2) {
+ if (null == s1 || null == s2) {
+ if ((Object)s1 == (Object) s2) {
+ return 0;
+ }
+
+ return (s1 == null) ? -1 : 1;
+ }
+
+ return InternalCompare(s1, 0, s2, 0, Math.Max(s1.length, s2.length), false);
+ }
+
+ public static int CompareOrdinal(String s1, int i1, String s2, int i2, int length) {
+ if (null == s1 || null == s2) {
+ if ((Object)s1 == (Object) s2) {
+ return 0;
+ }
+
+ return (s1 == null) ? -1 : 1;
+ }
+
+ if (i1 < 0 || i2 < 0 || length < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (i1 > s1.length || i2 > s2.length)
+ throw new ArgumentOutOfRangeException ();
+
+ return InternalCompare(s1, i1, s2, i2, length, false);
+ }
+
+ public bool EndsWith(String value) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (value.length > this.length) {
+ return false;
+ }
+
+ return (0 == Compare(this, length - value.length, value, 0, value.length));
+ }
+
+ public int IndexOfAny(char [] arr) {
+ if (null == arr)
+ throw new ArgumentNullException();
+
+ return InternalIndexOfAny(arr, 0, this.length);
+ }
+
+ public int IndexOfAny(char [] arr, int sindex) {
+ if (null == arr)
+ throw new ArgumentNullException();
+ if (sindex < 0 || sindex >= this.length)
+ throw new ArgumentOutOfRangeException();
+
+ return InternalIndexOfAny(arr, sindex, this.length - sindex);
+ }
+
+ public int IndexOfAny(char [] arr, int sindex, int count) {
+ if (null == arr)
+ throw new ArgumentNullException();
+ if (sindex < 0 || count < 0 || sindex + count > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ return InternalIndexOfAny(arr, sindex, count);
+ }
+
+ public int IndexOf(char value) {
+ return InternalIndexOf(value, 0, this.length);
+ }
+
+ public int IndexOf(String value) {
+ return IndexOf(value, 0, this.length);
+ }
+
+ public int IndexOf(char value, int sindex) {
+ if (sindex < 0 || sindex >= this.length) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ return InternalIndexOf(value, sindex, this.length - sindex);
+ }
+
+ public int IndexOf(String value, int sindex) {
+ return IndexOf(value, sindex, this.length - sindex);
+ }
+
+ public int IndexOf(char value, int sindex, int count) {
+ if (sindex < 0 || count < 0 || sindex + count > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex == 0 && this.length == 0)
+ return -1;
+
+ return InternalIndexOf(value, sindex, count);
+ }
+
+ public int IndexOf(String value, int sindex, int count) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || count < 0 || sindex + count > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex == 0 && this.length == 0)
+ return -1;
+
+ return InternalIndexOf(value, sindex, count);
+ }
+
+ public int LastIndexOfAny(char [] arr) {
+ if (null == arr)
+ throw new ArgumentNullException();
+
+ return InternalLastIndexOfAny(arr, this.length - 1, this.length);
+ }
+
+ public int LastIndexOfAny(char [] arr, int sindex) {
+ if (null == arr)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || sindex > this.length)
+ throw new ArgumentOutOfRangeException();
+
+ if (this.length == 0)
+ return -1;
+
+ return InternalLastIndexOfAny(arr, sindex, sindex + 1);
+ }
+
+ public int LastIndexOfAny(char [] arr, int sindex, int count) {
+ if (null == arr)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || count < 0 || sindex > this.length || sindex - count < -1)
+ throw new ArgumentOutOfRangeException();
+
+ if (this.length == 0)
+ return -1;
+
+ return InternalLastIndexOfAny(arr, sindex, count);
+ }
+
+ public int LastIndexOf(char value) {
+ return InternalLastIndexOf(value, this.length - 1, this.length);
+ }
+
+ public int LastIndexOf(String value) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (value.length == 0)
+ return 0;
+
+ if (this.length == 0)
+ return -1;
+
+ return InternalLastIndexOf(value, this.length - 1, this.length);
+ }
+
+ public int LastIndexOf(char value, int sindex){
+ return LastIndexOf(value, sindex, sindex + 1);
+ }
+
+ public int LastIndexOf(String value, int sindex) {
+ return LastIndexOf(value, sindex, sindex + 1);
+ }
+
+ public int LastIndexOf(char value, int sindex, int count) {
+ if (sindex < 0 || count < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex >= this.length || sindex - count + 1 < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex == 0 && this.length == 0)
+ return -1;
+
+ return InternalLastIndexOf(value, sindex, count);
+ }
+
+ public int LastIndexOf(String value, int sindex, int count) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || sindex > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (count < 0 || sindex - count + 1 < 0)
+ throw new ArgumentOutOfRangeException ();
+
+ if (value.length > sindex)
+ return -1;
+
+ if (value == String.Empty)
+ return sindex;
+
+ if (sindex == 0 && this.length == 0)
+ return -1;
+
+ return InternalLastIndexOf(value, sindex, count);
+ }
+
+ public String PadLeft(int width) {
+ return PadLeft(width, ' ');
+ }
+
+ public String PadLeft(int width, char chr) {
+ if (width < 0)
+ throw new ArgumentException();
+
+ if (width < this.length)
+ return String.Copy(this);
+
+ return InternalPad(width, chr, false);
+ }
+
+ public String PadRight(int width) {
+ return PadRight(width, ' ');
+ }
+
+ public String PadRight(int width, char chr) {
+ if (width < 0)
+ throw new ArgumentException();
+
+ if (width < this.length)
+ return String.Copy(this);
+
+ return InternalPad(width, chr, true);
+ }
+
+ public bool StartsWith(String value) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (this.length < value.length)
+ return false;
+
+ return (0 == Compare(this, 0, value, 0 , value.length));
+ }
+
+
+ public String Replace (char oldChar, char newChar) {
+ return InternalReplace(oldChar, newChar);
+ }
+
+ public String Replace(String oldValue, String newValue) {
+ if (null == oldValue)
+ throw new ArgumentNullException();
+
+ return InternalReplace(oldValue, newValue);
+ }
+
+ public String Remove(int sindex, int count) {
+ if (sindex < 0 || count < 0 || sindex + count > this.length)
+ throw new ArgumentOutOfRangeException ();
+
+ return InternalRemove(sindex, count);
+ }
+
+ public String ToLower() {
+ return InternalToLower();
+ }
+
+ public String ToLower(CultureInfo culture) {
+ throw new NotImplementedException();
+ }
+
+ public String ToUpper() {
+ return InternalToUpper();
+ }
+
+ public String ToUpper(CultureInfo culture) {
+ throw new NotImplementedException();
+ }
+
+ public override String ToString() {
+ return this;
+ }
+
+ public String ToString(IFormatProvider provider) {
+ return this;
+ }
+
+ public String Trim() {
+ return Trim(null);
+ }
+
+ public static String Format(String format, Object arg0) {
+ return Format(null, format, new Object[] {arg0});
+ }
+
+ public static String Format(String format, Object arg0, Object arg1) {
+ return Format(null, format, new Object[] {arg0, arg1});
+ }
+
+ public static String Format(String format, Object arg0, Object arg1, Object arg2) {
+ return Format(null, format, new Object[] {arg0, arg1, arg2});
+ }
+
+ public static string Format (string format, params object[] args) {
+ return Format (null, format, args);
+ }
+
+ public static string Format (IFormatProvider provider, string format, params object[] args) {
+ if (format == null || args == null)
+ throw new ArgumentNullException ();
+
+ StringBuilder result = new StringBuilder ();
+
+ int ptr = 0;
+ int start = ptr;
+ while (ptr < format.length) {
+ char c = format[ptr ++];
+
+ if (c == '{') {
+ result.Append (format, start, ptr - start - 1);
+
+ // check for escaped open bracket
+
+ if (format[ptr] == '{') {
+ start = ptr ++;
+ continue;
+ }
+
+ // parse specifier
+
+ int n, width;
+ bool left_align;
+ string arg_format;
+
+ ParseFormatSpecifier (format, ref ptr, out n, out width, out left_align, out arg_format);
+ if (n >= args.Length)
+ throw new FormatException ("Index (zero based) must be greater than or equal to zero and less than the size of the argument list.");
+
+ // format argument
+
+ object arg = args[n];
+
+ string str;
+ if (arg == null)
+ str = "";
+ else if (arg is IFormattable)
+ str = ((IFormattable)arg).ToString (arg_format, provider);
+ else
+ str = arg.ToString ();
+
+ // pad formatted string and append to result
+
+ if (width > str.length) {
+ string pad = new String (' ', width - str.length);
+
+ if (left_align) {
+ result.Append (str);
+ result.Append (pad);
+ }
+ else {
+ result.Append (pad);
+ result.Append (str);
+ }
+ }
+ else
+ result.Append (str);
+
+ start = ptr;
+ }
+ else if (c == '}' && format[ptr] == '}') {
+ result.Append (format, start, ptr - start - 1);
+ start = ptr ++;
+ }
+ }
+
+ if (start < format.length)
+ result.Append (format.Substring (start));
+
+ return result.ToString ();
+ }
+
+ public static String Copy (String str) {
+ if (str == null)
+ throw new ArgumentNullException ();
+
+ int length = str.length;
+
+ String tmp = InternalAllocateStr(length);
+ InternalStrcpy(tmp, 0, str);
+ return tmp;
+ }
+
+ public static String Concat(Object obj) {
+ if (null == obj)
+ return String.Empty;
+
+ return obj.ToString();
+ }
+
+ public static String Concat(Object obj1, Object obj2) {
+ if (null == obj1)
+ obj1 = String.Empty;
+
+ if (null == obj2)
+ obj2 = String.Empty;
+
+ return Concat(obj1.ToString(), obj2.ToString());
+ }
+
+ public static String Concat(Object obj1, Object obj2, Object obj3) {
+ if (null == obj1)
+ obj1 = String.Empty;
+
+ if (null == obj2)
+ obj2 = String.Empty;
+
+ if (null == obj3)
+ obj3 = String.Empty;
+
+ return Concat(obj1.ToString(), obj2.ToString(), obj3.ToString());
+ }
+
+ //
+ // I can not find the "__arglist" argument on the spec
+ //
+#if !__MonoCS__
+ [CLSCompliant(false)]
+ public static String Concat (Object arg0, Object arg1, Object arg2, Object arg3, __arglist) {
+ throw new NotImplementedException();
+ }
+#endif
+
+ public static String Concat(String s1, String s2) {
+ if (null == s1) {
+ if (null == s2) { return String.Empty; }
+ return s2;
+ }
+
+ if (null == s2) { return s1; }
+
+ String tmp = InternalAllocateStr(s1.length + s2.length);
+
+ InternalStrcpy(tmp, 0, s1);
+ InternalStrcpy(tmp, s1.length, s2);
+
+ return tmp;
+ }
+
+ public static String Concat(String s1, String s2, String s3) {
+ if (null == s1 && null == s2 && null == s3) {
+ return String.Empty;
+ }
+
+ if (null == s1) { s1 = String.Empty; }
+ if (null == s2) { s2 = String.Empty; }
+ if (null == s3) { s3 = String.Empty; }
+
+ String tmp = InternalAllocateStr(s1.length + s2.length + s3.length);
+
+ InternalStrcpy(tmp, 0, s1);
+ InternalStrcpy(tmp, s1.length, s2);
+ InternalStrcpy(tmp, s1.length + s2.length, s3);
+
+ return tmp;
+ }
+
+ public static String Concat(String s1, String s2, String s3, String s4) {
+ if (null == s1 && null == s2 && null == s3 && null == s4) {
+ return String.Empty;
+ }
+
+ if (null == s1) { s1 = String.Empty; }
+ if (null == s2) { s2 = String.Empty; }
+ if (null == s3) { s3 = String.Empty; }
+ if (null == s4) { s4 = String.Empty; }
+
+ String tmp = InternalAllocateStr(s1.length + s2.length + s3.length + s4.length);
+
+ InternalStrcpy(tmp, 0, s1);
+ InternalStrcpy(tmp, s1.length, s2);
+ InternalStrcpy(tmp, s1.length + s2.length, s3);
+ InternalStrcpy(tmp, s1.length + s2.length + s3.length, s4);
+
+ return tmp;
+ }
+
+ public static String Concat(params Object[] args) {
+ string [] strings;
+ int len, i, currentpos;
+
+ if (null == args)
+ throw new ArgumentNullException ();
+
+ strings = new string [args.Length];
+ len = 0;
+ i = 0;
+ foreach (object arg in args) {
+ /* use Empty for each null argument */
+ if (arg == null)
+ strings[i] = String.Empty;
+ else
+ strings[i] = arg.ToString ();
+ len += strings[i].length;
+ i++;
+ }
+
+ if (len == 0)
+ return String.Empty;
+
+ currentpos = 0;
+
+ String tmp = InternalAllocateStr(len);
+ for (i = 0; i < strings.Length; i++) {
+ InternalStrcpy(tmp, currentpos, strings[i]);
+ currentpos += strings[i].length;
+ }
+
+ return tmp;
+ }
+
+ public static String Concat(params String[] values) {
+ int len, i, currentpos;
+
+ if (values == null)
+ throw new ArgumentNullException ();
+
+ len = 0;
+ foreach (string value in values)
+ len += value != null ? value.length : 0;
+
+ if (len == 0)
+ return String.Empty;
+
+ currentpos = 0;
+
+ String tmp = InternalAllocateStr(len);
+ for (i = 0; i < values.Length; i++) {
+ if (values[i] == null)
+ continue;
+
+ InternalStrcpy(tmp, currentpos, values[i]);
+ currentpos += values[i].length;
+ }
+
+ return tmp;
+ }
+
+ public String Insert(int sindex, String value) {
+ if (null == value)
+ throw new ArgumentNullException();
+
+ if (sindex < 0 || sindex > this.length)
+ throw new ArgumentOutOfRangeException();
+
+ return InternalInsert(sindex, value);
+ }
+
+
+ public static string Intern (string str) {
+ if (null == str)
+ throw new ArgumentNullException ();
+
+ return InternalIntern(str);
+ }
+
+ public static string IsInterned (string str) {
+ if (null == str)
+ throw new ArgumentNullException();
+
+ return InternalIsInterned(str);
+ }
+
+ public static string Join (string separator, string [] value) {
+ if (value == null)
+ throw new ArgumentNullException ();
+
+ return Join(separator, value, 0, value.Length);
+ }
+
+ public static string Join(string separator, string[] value, int sindex, int count) {
+ if (value == null)
+ throw new ArgumentNullException ();
+
+ if (sindex + count > value.Length)
+ throw new ArgumentOutOfRangeException ();
+
+ if (sindex == value.Length)
+ return String.Empty;
+
+ return InternalJoin(separator, value, sindex, count);
+ }
+
+ bool IConvertible.ToBoolean (IFormatProvider provider) {
+ return Convert.ToBoolean (this);
+ }
+
+ byte IConvertible.ToByte (IFormatProvider provider) {
+ return Convert.ToByte (this);
+ }
+
+ char IConvertible.ToChar (IFormatProvider provider) {
+ return Convert.ToChar (this);
+ }
+
+ DateTime IConvertible.ToDateTime (IFormatProvider provider) {
+ return Convert.ToDateTime (this);
+ }
+
+ decimal IConvertible.ToDecimal (IFormatProvider provider) {
+ return Convert.ToDecimal (this);
+ }
+
+ double IConvertible.ToDouble (IFormatProvider provider) {
+ return Convert.ToDouble (this);
+ }
+
+ short IConvertible.ToInt16 (IFormatProvider provider) {
+ return Convert.ToInt16 (this);
+ }
+
+ int IConvertible.ToInt32 (IFormatProvider provider) {
+ return Convert.ToInt32 (this);
+ }
+
+ long IConvertible.ToInt64 (IFormatProvider provider) {
+ return Convert.ToInt64 (this);
+ }
+
+ [CLSCompliant(false)]
+ sbyte IConvertible.ToSByte (IFormatProvider provider) {
+ return Convert.ToSByte (this);
+ }
+
+ float IConvertible.ToSingle (IFormatProvider provider) {
+ return Convert.ToSingle (this);
+ }
+ string IConvertible.ToString (IFormatProvider format) {
+ return this;
+ }
+
+ object IConvertible.ToType (Type conversionType, IFormatProvider provider) {
+ return Convert.ToType (this, conversionType, provider);
+ }
+
+ [CLSCompliant(false)]
+ ushort IConvertible.ToUInt16 (IFormatProvider provider) {
+ return Convert.ToUInt16 (this);
+ }
+
+ [CLSCompliant(false)]
+ uint IConvertible.ToUInt32 (IFormatProvider provider) {
+ return Convert.ToUInt32 (this);
+ }
+
+ [CLSCompliant(false)]
+ ulong IConvertible.ToUInt64 (IFormatProvider provider) {
+ return Convert.ToUInt64 (this);
+ }
+
+ TypeCode IConvertible.GetTypeCode () {
+ return TypeCode.String;
+ }
+
+ public int Length {
+ get {
+ return length;
+ }
+ }
+
+ public CharEnumerator GetEnumerator () {
+ return new CharEnumerator (this);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator () {
+ return new CharEnumerator (this);
+ }
+
+ private static void ParseFormatSpecifier (string str, ref int ptr, out int n, out int width, out bool left_align, out string format) {
+ // parses format specifier of form:
+ // N,[[-]M][:F]}
+ //
+ // where:
+
+ try {
+ // N = argument number (non-negative integer)
+
+ n = ParseDecimal (str, ref ptr);
+ if (n < 0)
+ throw new FormatException ("Input string was not in correct format.");
+
+ // M = width (non-negative integer)
+
+ if (str[ptr] == ',') {
+ left_align = (str[++ ptr] == '-');
+ if (left_align)
+ ++ ptr;
+
+ width = ParseDecimal (str, ref ptr);
+ if (width < 0)
+ throw new FormatException ("Input string was not in correct format.");
+ }
+ else {
+ width = 0;
+ left_align = false;
+ }
+
+ // F = argument format (string)
+
+ if (str[ptr] == ':') {
+ int start = ++ ptr;
+ while (str[ptr] != '}')
+ ++ ptr;
+
+ format = str.Substring (start, ptr - start);
+ }
+ else
+ format = null;
+
+ if (str[ptr ++] != '}')
+ throw new FormatException ("Input string was not in correct format.");
+ }
+ catch (IndexOutOfRangeException) {
+ throw new FormatException ("Input string was not in correct format.");
+ }
+ }
+
+ private static int ParseDecimal (string str, ref int ptr) {
+ int p = ptr;
+ int n = 0;
+ while (true) {
+ char c = str[p];
+ if (c < '0' || '9' < c)
+ break;
+
+ n = n * 10 + c - '0';
+ ++ p;
+ }
+
+ if (p == ptr)
+ return -1;
+
+ ptr = p;
+ return n;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static string InternalJoin(string separator, string[] value, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalInsert(int sindex, String value);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalReplace(char oldChar, char newChar);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalReplace(String oldValue, String newValue);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalRemove(int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern void InternalCopyTo(int sindex, char[] dest, int dindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String[] InternalSplit(char[] separator, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalTrim(char[] chars, int typ);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalIndexOf(char value, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalIndexOf(string value, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalIndexOfAny(char [] arr, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalLastIndexOf(char value, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalLastIndexOf(String value, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern int InternalLastIndexOfAny(char [] anyOf, int sindex, int count);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalPad(int width, char chr, bool right);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalToLower();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern String InternalToUpper();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static String InternalAllocateStr(int length);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private 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);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static string InternalIntern(string str);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static string InternalIsInterned(string str);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static int InternalCompare(String s1, int i1, String s2, int i2, int length, bool inCase);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool InternalEquals(String s1, String s2);
+ }
+}
diff --git a/mcs/class/corlib/System/SystemException.cs b/mcs/class/corlib/System/SystemException.cs
new file mode 100644
index 00000000000..7e41953645f
--- /dev/null
+++ b/mcs/class/corlib/System/SystemException.cs
@@ -0,0 +1,38 @@
+//
+// System.SystemException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.Serialization;
+using System;
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public class SystemException : Exception {
+ // Constructors
+ public SystemException ()
+ : base (Locale.GetText ("A system exception has occurred."))
+ {
+ }
+
+ public SystemException (string message)
+ : base (message)
+ {
+ }
+
+ protected SystemException(SerializationInfo info, StreamingContext context)
+ : base (info, context) {
+ }
+
+ public SystemException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/TODO b/mcs/class/corlib/System/TODO
new file mode 100644
index 00000000000..065809deedb
--- /dev/null
+++ b/mcs/class/corlib/System/TODO
@@ -0,0 +1,22 @@
+System.Object:
+ Need a mechanism for getting an object underlying type.
+
+System.ValueType:
+ Need to lock memory and "scan" the actual contents to compute
+ hash code and do comparissions. Should be simple to do with
+ C#, the problem is figuring out the size of the object.
+
+System.String:
+ Need to implement the Format() and CompareOrdinal() methods
+ as we all implement all of the methods that take into account
+ CultureInfo or Encoding stuff.
+
+System.Array:
+ It's not possible to test to see if the whole thing works, as
+ GetValue() and SetValue() make calls into the runtime. However,
+ I've tried my implementations of things like BinarySearch() and
+ Sort() on the MS-provided System.Array and they seem to work fine.
+ According to the spec, System.Array implements the IList interface.
+ The spec doesn't have the methods for those interfaces, however,
+ the class doesn't (yet) implement that interface and those methods
+ are not (yet) written.
diff --git a/mcs/class/corlib/System/TODOAttribute.cs b/mcs/class/corlib/System/TODOAttribute.cs
new file mode 100644
index 00000000000..0920ce8f92d
--- /dev/null
+++ b/mcs/class/corlib/System/TODOAttribute.cs
@@ -0,0 +1,37 @@
+//
+// TODOAttribute.cs
+//
+// Author:
+// Ravi Pratap (ravi@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ /// <summary>
+ /// The TODO attribute is used to flag all incomplete bits in our class libraries
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Use this to decorate any element which you think is not complete
+ /// </remarks>
+ [AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
+ public class MonoTODOAttribute : Attribute {
+
+ private string comment;
+
+ public MonoTODOAttribute ()
+ {}
+
+ public MonoTODOAttribute (string comment)
+ {
+ this.comment = comment;
+ }
+
+ public string Comment
+ {
+ get { return comment; }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/ThreadStaticAttribute.cs b/mcs/class/corlib/System/ThreadStaticAttribute.cs
new file mode 100644
index 00000000000..97d06667a6b
--- /dev/null
+++ b/mcs/class/corlib/System/ThreadStaticAttribute.cs
@@ -0,0 +1,20 @@
+//
+// System.ThreadStaticAttribute.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System
+{
+ [AttributeUsage (AttributeTargets.Field)]
+ [Serializable]
+ public class ThreadStaticAttribute : Attribute
+ {
+ // Constructors
+ public ThreadStaticAttribute () : base ()
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/TimeSpan.cs b/mcs/class/corlib/System/TimeSpan.cs
new file mode 100644
index 00000000000..447390d69ea
--- /dev/null
+++ b/mcs/class/corlib/System/TimeSpan.cs
@@ -0,0 +1,551 @@
+//
+// System.TimeSpan.cs
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2001 Duco Fijma
+//
+
+using System.Globalization;
+
+namespace System {
+
+[Serializable]
+public struct TimeSpan : IComparable {
+
+ private long _ticks;
+
+ public TimeSpan (long value) { _ticks = value; }
+ public TimeSpan (int hours, int minutes, int seconds)
+ : this(false, 0, hours, minutes, seconds, 0, 0) {}
+ public TimeSpan (int days, int hours, int minutes, int seconds)
+ : this(false, days, hours, minutes, seconds, 0, 0) {}
+ public TimeSpan (int days, int hours, int minutes, int seconds, int milliseconds)
+ : this(false, days, hours, minutes, seconds, milliseconds, 0) {}
+
+ internal TimeSpan (bool sign, int days, int hours, int minutes, int seconds, int milliseconds, long ticks)
+ {
+ checked {
+ _ticks = TicksPerDay * days +
+ TicksPerHour * hours +
+ TicksPerMinute * minutes +
+ TicksPerSecond * seconds +
+ TicksPerMillisecond * milliseconds +
+ ticks;
+ if ( sign ) {
+ _ticks = -_ticks;
+ }
+ }
+ }
+
+ public static readonly TimeSpan MaxValue = new TimeSpan (long.MaxValue);
+ public static readonly TimeSpan MinValue = new TimeSpan (long.MinValue);
+ public const long TicksPerDay = 864000000000L;
+ public const long TicksPerHour = 36000000000L;
+ public const long TicksPerMillisecond = 10000L;
+ public const long TicksPerMinute = 600000000L;
+ public const long TicksPerSecond = 10000000L;
+ public static readonly TimeSpan Zero = new TimeSpan (0L);
+
+ public int Days
+ {
+ get {
+ return (int) TotalDays;
+ }
+ }
+
+ public int Hours
+ {
+ get {
+ return (int) (_ticks % TicksPerDay / TicksPerHour);
+ }
+ }
+
+ public int Milliseconds
+ {
+ get
+ {
+ return (int) (_ticks % TicksPerSecond / TicksPerMillisecond);
+ }
+ }
+
+ public int Minutes
+ {
+ get
+ {
+ return (int) (_ticks % TicksPerHour / TicksPerMinute);
+ }
+ }
+
+ public int Seconds
+ {
+ get
+ {
+ return (int) (_ticks % TicksPerMinute / TicksPerSecond);
+ }
+ }
+
+ public long Ticks
+ {
+ get
+ {
+ return _ticks;
+ }
+ }
+
+ public double TotalDays
+ {
+ get
+ {
+ return (double) _ticks / TicksPerDay;
+ }
+ }
+
+ public double TotalHours
+ {
+ get
+ {
+ return (double) _ticks / TicksPerHour;
+ }
+ }
+
+ public double TotalMilliseconds
+ {
+ get
+ {
+ return (double) _ticks / TicksPerMillisecond;
+ }
+ }
+
+ public double TotalMinutes
+ {
+ get {
+ return (double) _ticks / TicksPerMinute;
+ }
+ }
+
+ public double TotalSeconds
+ {
+ get {
+ return (double) _ticks / TicksPerSecond;
+ }
+ }
+
+ public TimeSpan Add (TimeSpan ts)
+ {
+ checked {
+ return new TimeSpan (_ticks + ts.Ticks);
+ }
+ }
+
+ public static int Compare (TimeSpan t1, TimeSpan t2)
+ {
+ if (t1._ticks < t2._ticks) {
+ return -1;
+ }
+ else if (t1._ticks > t2._ticks) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ public int CompareTo (object value)
+ {
+ if (value == null )
+ return 1;
+
+ if (!(value is TimeSpan)) {
+ throw new ArgumentException (Locale.GetText (
+ "Argument of System.TimeSpan.CompareTo should be a TimeSpan"));
+ }
+
+ return Compare(this, (TimeSpan) value);
+ }
+
+ public TimeSpan Duration ()
+ {
+ checked {
+ return new TimeSpan (Math.Abs (_ticks));
+ }
+ }
+
+ public override bool Equals (object value)
+ {
+ if (!(value is TimeSpan)) {
+ return false;
+ }
+ return Equals (this, (TimeSpan) value);
+ }
+
+ public static bool Equals (TimeSpan t1, TimeSpan t2)
+ {
+ return t1._ticks == t2._ticks;
+ }
+
+ // Implementing FromDays -> FromHours -> FromMinutes -> FromSeconds ->
+ // FromMilliseconds as done here is probably not the most efficient
+ // way.
+ public static TimeSpan FromDays (double value)
+ {
+ if (Double.IsNaN (value) || Double.IsNegativeInfinity (value)) {
+ return MinValue;
+ }
+
+ if (Double.IsPositiveInfinity (value)) {
+ return MaxValue;
+ }
+
+ return new TimeSpan ((int) value,0,0,0,0) + FromHours ((value - ((int) value)) * 24);
+ }
+
+ public static TimeSpan FromHours (double value)
+ {
+ if (Double.IsNaN (value) || Double.IsNegativeInfinity (value)) {
+ return MinValue;
+ }
+
+ if (Double.IsPositiveInfinity (value)) {
+ return MaxValue;
+ }
+
+ return new TimeSpan ((int) value,0,0) + FromMinutes ((value - ((int) value)) * 60);
+ }
+
+ public static TimeSpan FromMinutes (double value)
+ {
+ if (Double.IsNaN (value) || Double.IsNegativeInfinity (value)) {
+ return MinValue;
+ }
+
+ if (Double.IsPositiveInfinity (value)) {
+ return MaxValue;
+ }
+
+ return new TimeSpan (0, (int) value, 0) + FromSeconds((value - ((int) value)) * 60);
+ }
+
+ public static TimeSpan FromSeconds (double value)
+ {
+ if (Double.IsNaN (value) || Double.IsNegativeInfinity (value)) {
+ return MinValue;
+ }
+
+ if (Double.IsPositiveInfinity (value)) {
+ return MaxValue;
+ }
+
+ return new TimeSpan (0, 0, 0, (int) value) + FromMilliseconds((value - ((int) value)) * 1000);
+
+ }
+
+ public static TimeSpan FromMilliseconds (double value)
+ {
+ if (Double.IsNaN (value) || Double.IsNegativeInfinity (value)) {
+ return MinValue;
+ }
+
+ if (Double.IsPositiveInfinity (value)) {
+ return MaxValue;
+ }
+
+ return new TimeSpan (0, 0, 0, 0, (int) value);
+ }
+
+ public static TimeSpan FromTicks (long value)
+ {
+ return new TimeSpan (value);
+ }
+
+ public override int GetHashCode ()
+ {
+ return _ticks.GetHashCode ();
+ }
+
+ public TimeSpan Negate ()
+ {
+ checked {
+ return new TimeSpan (-_ticks);
+ }
+ }
+
+ public static TimeSpan Parse (string s)
+ {
+ if (s == null) {
+ throw new ArgumentNullException (
+ Locale.GetText ("null reference passed to TimeSpan.Parse"));
+ }
+
+ Parser p = new Parser (s);
+ return p.Execute ();
+ }
+
+ public TimeSpan Subtract (TimeSpan ts)
+ {
+ checked {
+ return new TimeSpan (_ticks - ts.Ticks);
+ }
+ }
+
+ public override string ToString ()
+ {
+ string res = "";
+
+ if (_ticks < 0) {
+ res += "-";
+ }
+
+ // We need to take absolute values of all components.
+ // Can't handle negative timespans by negating the TimeSpan
+ // as a whole. This would lead to an overflow for the
+ // degenerate case "TimeSpan.MinValue.ToString()".
+ if (Days != 0) {
+ res += Math.Abs (Days) + "." ;
+ }
+
+ res += string.Format ("{0:D2}:{1:D2}:{2:D2}", Math.Abs(Hours), Math.Abs(Minutes), Math.Abs(Seconds));
+
+ int fractional = (int) Math.Abs (_ticks % TicksPerSecond);
+ if (fractional != 0) {
+ res += string.Format (".{0:D7}", fractional);
+ }
+
+ return res;
+ }
+
+ public static TimeSpan operator + (TimeSpan t1, TimeSpan t2)
+ {
+ return t1.Add (t2);
+ }
+
+ public static bool operator == (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) == 0;
+ }
+
+ public static bool operator > (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) == 1;
+ }
+
+ public static bool operator >= (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) != -1;
+ }
+
+ public static bool operator != (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) != 0;
+ }
+
+ public static bool operator < (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) == -1;
+ }
+
+ public static bool operator <= (TimeSpan t1, TimeSpan t2)
+ {
+ return Compare (t1, t2) != 1;
+ }
+
+ public static TimeSpan operator - (TimeSpan t1, TimeSpan t2)
+ {
+ return t1.Subtract (t2);
+ }
+
+ public static TimeSpan operator - (TimeSpan t)
+ {
+ return t.Negate ();
+ }
+
+ public static TimeSpan operator + (TimeSpan t)
+ {
+ return t;
+ }
+}
+
+// Class Parser implements simple parser for TimeSpan::Parse
+internal class Parser {
+
+ private string _src;
+ private int _cur;
+ private int _length;
+
+ public Parser (string src)
+ {
+ _src = src;
+ Reset ();
+ }
+
+ public void Reset ()
+ {
+ _cur = 0;
+ _length = _src.Length;
+ }
+
+ public bool AtEnd
+ {
+ get {
+ return _cur >= _length;
+ }
+ }
+
+ private void ThrowFormatException()
+ {
+ throw new FormatException (Locale.GetText ("Invalid format for TimeSpan.Parse"));
+ }
+
+ // All "Parse" functions throw a FormatException on syntax error.
+ // Their return value is semantic value of the item parsed.
+
+ // Range checking is spread over three different places:
+ // 1) When parsing "int" values, an exception is thrown immediately
+ // when the value parsed exceeds the maximum value for an int.
+ // 2) An explicit check is built in that checks for hours > 23 and
+ // for minutes and seconds > 59.
+ // 3) Throwing an exceptions for a final TimeSpan value > MaxValue
+ // or < MinValue is left to the TimeSpan constructor called.
+
+ // Parse zero or more whitespace chars.
+ private void ParseWhiteSpace ()
+ {
+ while (!AtEnd && Char.IsWhiteSpace (_src, _cur)) {
+ _cur++;
+ }
+ }
+
+ // Parse optional sign character.
+ private bool ParseSign ()
+ {
+ bool res = false;
+
+ if (!AtEnd && _src[_cur] == '-') {
+ res = true;
+ _cur++;
+ }
+
+ return res;
+ }
+
+ // Parse simple int value
+ private int ParseInt ()
+ {
+ int res = 0;
+ int count = 0;
+
+ while (!AtEnd && Char.IsDigit (_src, _cur)) {
+ checked {
+ res = res*10 + _src[_cur] - '0';
+ }
+ _cur++;
+ count++;
+ }
+
+ if (count == 0) {
+ ThrowFormatException ();
+ }
+
+ return res;
+ }
+
+ // Parse optional dot
+ private bool ParseOptDot ()
+ {
+ if (AtEnd) {
+ return false;
+ }
+
+ if (_src[_cur] == '.') {
+ _cur++;
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ // Parse NON-optional colon
+ private void ParseColon ()
+ {
+ if (!AtEnd && _src[_cur] == ':') {
+ _cur++;
+ }
+ else {
+ ThrowFormatException ();
+ }
+ }
+
+ // Parse [1..7] digits, representing fractional seconds (ticks)
+ private long ParseTicks ()
+ {
+ long mag = 1000000;
+ long res = 0;
+ bool digitseen = false;
+
+ while ( mag > 0 && !AtEnd && Char.IsDigit (_src, _cur) ) {
+ res = res + (_src[_cur] - '0') * mag;
+ _cur++;
+ mag = mag / 10;
+ digitseen = true;
+ }
+
+ if (!digitseen) {
+ ThrowFormatException ();
+ }
+
+ return res;
+ }
+
+ public TimeSpan Execute ()
+ {
+ bool sign;
+ int days;
+ int hours;
+ int minutes;
+ int seconds;
+ long ticks;
+
+ // Parse [ws][dd.]hh:mm:ss[.ff][ws]
+ ParseWhiteSpace ();
+ sign = ParseSign ();
+ days = ParseInt ();
+ if (ParseOptDot ()) {
+ hours = ParseInt ();
+ }
+ else {
+ hours = days;
+ days = 0;
+ }
+ ParseColon();
+ minutes = ParseInt ();
+ ParseColon();
+ seconds = ParseInt ();
+ if ( ParseOptDot () ) {
+ ticks = ParseTicks ();
+ }
+ else {
+ ticks = 0;
+ }
+ ParseWhiteSpace ();
+
+ if ( !AtEnd ) {
+ ThrowFormatException ();
+ }
+
+ if ( hours > 23 || minutes > 59 || seconds > 59 ) {
+ throw new OverflowException (Locale.GetText (
+ "Value outside range in TimeSpan.Parse" ));
+ }
+
+ TimeSpan ts = new TimeSpan (sign, days, hours, minutes, seconds, 0, ticks);
+
+ return ts;
+ }
+
+}
+
+}
+
+
diff --git a/mcs/class/corlib/System/TimeZone.cs b/mcs/class/corlib/System/TimeZone.cs
new file mode 100644
index 00000000000..0a2908efe1e
--- /dev/null
+++ b/mcs/class/corlib/System/TimeZone.cs
@@ -0,0 +1,193 @@
+//
+// System.TimeZone.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+// Ajay Kumar Dwivedi (adwiv@yahoo.com)
+// Martin Baulig (martin@gnome.org)
+//
+// (C) Ximian, Inc.
+//
+
+using System.Collections;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ [Serializable]
+ public abstract class TimeZone
+ {
+ // Fields
+ private static TimeZone currentTimeZone;
+
+ // Constructor
+ protected TimeZone ()
+ {
+ }
+
+ // Properties
+ public static TimeZone CurrentTimeZone
+ {
+ get {
+ if (currentTimeZone == null)
+ currentTimeZone = new CurrentTimeZone ();
+
+ return currentTimeZone;
+ }
+ }
+
+ public abstract string DaylightName
+ {
+ get;
+ }
+
+ public abstract string StandardName
+ {
+ get;
+ }
+
+ // Methods
+ public abstract DaylightTime GetDaylightChanges (int year);
+
+ public abstract TimeSpan GetUtcOffset (DateTime time);
+
+ public virtual bool IsDaylightSavingTime (DateTime time)
+ {
+ return IsDaylightSavingTime (time, GetDaylightChanges (time.Year));
+ }
+
+ public static bool IsDaylightSavingTime (DateTime time, DaylightTime daylightTimes)
+ {
+ if (daylightTimes == null)
+ throw new ArgumentNullException ("daylightTimes");
+
+ // If Start == End, then DST is off
+ if (daylightTimes.Start.Ticks == daylightTimes.End.Ticks)
+ return false;
+
+ //We are in the northern hemisphere.
+ if (daylightTimes.Start.Ticks < daylightTimes.End.Ticks) {
+ if (daylightTimes.Start.Ticks < time.Ticks
+ && daylightTimes.End.Ticks > time.Ticks)
+ return true; // time lies between Start and End
+
+ } else { // We are in the southern hemisphere.
+ if (time.Year == daylightTimes.Start.Year && time.Year == daylightTimes.End.Year)
+ if (time.Ticks < daylightTimes.End.Ticks
+ || time.Ticks > daylightTimes.Start.Ticks)
+ return true; // time is less than End OR more than Start
+ }
+
+ return false;
+ }
+
+ public virtual DateTime ToLocalTime (DateTime time)
+ {
+ return time + GetUtcOffset (time);
+ }
+
+ public virtual DateTime ToUniversalTime (DateTime time)
+ {
+ return time - GetUtcOffset (time);
+ }
+ }
+
+ internal class CurrentTimeZone : TimeZone
+ {
+ // Fields
+ private static string daylightName;
+ private static string standardName;
+
+ // A yearwise cache of DaylightTime.
+ private static Hashtable daylightCache = new Hashtable (1);
+
+ // the offset when daylightsaving is not on.
+ private static TimeSpan utcOffsetWithOutDLS;
+
+ // the offset when daylightsaving is on.
+ private static TimeSpan utcOffsetWithDLS;
+
+ internal enum TimeZoneData {
+ DaylightSavingStartIdx,
+ DaylightSavingEndIdx,
+ UtcOffsetIdx,
+ AdditionalDaylightOffsetIdx
+ };
+
+ internal enum TimeZoneNames {
+ StandardNameIdx,
+ DaylightNameIdx
+ };
+
+ // Internal method to get timezone data.
+ // data[0]: start of daylight saving time (in DateTime ticks).
+ // data[1]: end of daylight saving time (in DateTime ticks).
+ // data[2]: utcoffset (in TimeSpan ticks).
+ // data[3]: additional offset when daylight saving (in TimeSpan ticks).
+ // name[0]: name of this timezone when not daylight saving.
+ // name[1]: name of this timezone when daylight saving.
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern bool GetTimeZoneData (int year,
+ out Int64[] data,
+ out string[] names);
+
+ // Constructor
+ internal CurrentTimeZone ()
+ : base ()
+ {
+ Int64[] data;
+ string[] names;
+
+ if (!GetTimeZoneData (2002, out data, out names))
+ throw new NotSupportedException (Locale.GetText ("Can't get timezone name"));
+
+ standardName = Locale.GetText (names[(int)TimeZoneNames.StandardNameIdx]);
+ daylightName = Locale.GetText (names[(int)TimeZoneNames.DaylightNameIdx]);
+
+ utcOffsetWithOutDLS = new TimeSpan (data[(int)TimeZoneData.UtcOffsetIdx]);
+ utcOffsetWithDLS = new TimeSpan (data[(int)TimeZoneData.UtcOffsetIdx] + data[(int)TimeZoneData.AdditionalDaylightOffsetIdx]);
+ }
+
+ // Properties
+ public override string DaylightName
+ {
+ get { return daylightName; }
+ }
+
+ public override string StandardName
+ {
+ get { return standardName; }
+ }
+
+ // Methods
+ [MonoTODO]
+ public override DaylightTime GetDaylightChanges (int year)
+ {
+ if (year < 1 || year > 9999)
+ throw new ArgumentOutOfRangeException (year + " is not in a range between 1 and 9999.");
+
+ if (daylightCache [year] == null) {
+ Int64[] data;
+ string[] names;
+
+ if (!GetTimeZoneData (year, out data, out names))
+ throw new ArgumentException (Locale.GetText ("Can't get timezone data for " + year));
+
+ DaylightTime dlt = new DaylightTime (new DateTime (data[(int)TimeZoneData.DaylightSavingStartIdx]),
+ new DateTime (data[(int)TimeZoneData.DaylightSavingEndIdx]),
+ new TimeSpan (data[(int)TimeZoneData.AdditionalDaylightOffsetIdx]));
+ daylightCache.Add (year, dlt);
+ }
+
+ return (DaylightTime) daylightCache [year];
+ }
+
+ public override TimeSpan GetUtcOffset (DateTime time)
+ {
+ if (IsDaylightSavingTime (time))
+ return utcOffsetWithDLS;
+
+ return utcOffsetWithOutDLS;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Type.cs b/mcs/class/corlib/System/Type.cs
new file mode 100644
index 00000000000..4364bd468f4
--- /dev/null
+++ b/mcs/class/corlib/System/Type.cs
@@ -0,0 +1,840 @@
+//
+// System.Type.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// TODO: Mucho left to implement.
+//
+
+using System.Reflection;
+using System.Collections;
+using System.Runtime.CompilerServices;
+using System.Globalization;
+
+namespace System {
+
+ //
+ // FIXME: Implement the various IReflect dependencies
+ //
+
+ [MonoTODO]
+ [Serializable]
+ public abstract class Type : MemberInfo, IReflect {
+
+ internal RuntimeTypeHandle _impl;
+
+ public static readonly char Delimiter = '.';
+ public static readonly Type[] EmptyTypes = {};
+ public static readonly MemberFilter FilterAttribute = new MemberFilter (FilterAttribute_impl);
+ public static readonly MemberFilter FilterName = new MemberFilter (FilterName_impl);
+ public static readonly MemberFilter FilterNameIgnoreCase = new MemberFilter (FilterNameIgnoreCase_impl);
+ public static readonly object Missing;
+
+ private const BindingFlags DefaultBindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;
+
+ /* implementation of the delegates for MemberFilter */
+ static bool FilterName_impl (MemberInfo m, object filterCriteria) {
+ string name = (string) filterCriteria;
+ return name.Equals (m.Name);
+ }
+
+ static bool FilterNameIgnoreCase_impl (MemberInfo m, object filterCriteria) {
+ string name = (string) filterCriteria;
+ return String.Compare (name, m.Name, true) == 0;
+ }
+
+ [MonoTODO]
+ static bool FilterAttribute_impl (MemberInfo m, object filterCriteria) {
+ throw new NotImplementedException ("FilterAttribute_impl");
+ }
+
+ protected Type () {
+ }
+
+ /// <summary>
+ /// The assembly where the type is defined.
+ /// </summary>
+ public abstract Assembly Assembly {
+ get;
+ }
+
+ /// <summary>
+ /// Gets the fully qualified name for the type including the
+ /// assembly name where the type is defined.
+ /// </summary>
+ public abstract string AssemblyQualifiedName {
+ get;
+ }
+
+ /// <summary>
+ /// Returns the Attributes associated with the type.
+ /// </summary>
+ public TypeAttributes Attributes {
+ get {
+ return GetAttributeFlagsImpl ();
+ }
+ }
+
+ /// <summary>
+ /// Returns the basetype for this type
+ /// </summary>
+ public abstract Type BaseType {
+ get;
+ }
+
+ /// <summary>
+ /// Returns the class that declares the member.
+ /// </summary>
+ public override Type DeclaringType {
+ get {
+ return this;
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ [MonoTODO]
+ public static Binder DefaultBinder {
+ get {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// The full name of the type including its namespace
+ /// </summary>
+ public abstract string FullName {
+ get;
+ }
+
+ public abstract Guid GUID {
+ get;
+ }
+
+ public bool HasElementType {
+ get {return HasElementTypeImpl ();}
+ }
+
+ public bool IsAbstract {
+ get {
+ return (Attributes & TypeAttributes.Abstract) != 0;
+ }
+ }
+
+ public bool IsAnsiClass {
+ get {
+ return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AnsiClass;
+ }
+ }
+
+ public bool IsArray {
+ get {
+ return IsArrayImpl ();
+ }
+ }
+
+ public bool IsAutoClass {
+ get {
+ return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AutoClass;
+ }
+ }
+
+ public bool IsAutoLayout {
+ get {
+ return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.AutoLayout;
+ }
+ }
+
+ public bool IsByRef {
+ get {
+ return IsByRefImpl ();
+ }
+ }
+
+ public bool IsClass {
+ get {
+ if (this == typeof (System.Enum) || this == typeof (System.ValueType))
+ return true;
+ if (IsInterface)
+ return false;
+ return !type_is_subtype_of (this, typeof (System.ValueType), false);
+ }
+ }
+
+ public bool IsCOMObject {
+ get {
+ return IsCOMObjectImpl ();
+ }
+ }
+
+ public bool IsContextful {
+ get {
+ return IsContextfulImpl ();
+ }
+ }
+
+ public bool IsEnum {
+ get {
+ return type_is_subtype_of (this, typeof (System.Enum), false) &&
+ this != typeof (System.Enum);
+ }
+ }
+
+ public bool IsExplicitLayout {
+ get {
+ return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout;
+ }
+ }
+
+ public bool IsImport {
+ get {
+ return (Attributes & TypeAttributes.Import) != 0;
+ }
+ }
+
+ public bool IsInterface {
+ get {
+ return (Attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface;
+ }
+ }
+
+ public bool IsLayoutSequential {
+ get {
+ return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout;
+ }
+ }
+
+ public bool IsMarshalByRef {
+ get {
+ return IsMarshalByRefImpl ();
+ }
+ }
+
+ public bool IsNestedAssembly {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedAssembly;
+ }
+ }
+
+ public bool IsNestedFamANDAssem {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamANDAssem;
+ }
+ }
+
+ public bool IsNestedFamily {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamily;
+ }
+ }
+
+ public bool IsNestedFamORAssem {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamORAssem;
+ }
+ }
+
+ public bool IsNestedPrivate {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate;
+ }
+ }
+
+ public bool IsNestedPublic {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic;
+ }
+ }
+
+ public bool IsNotPublic {
+ get {
+ return !IsPublic;
+ }
+ }
+
+ public bool IsPointer {
+ get {
+ return IsPointerImpl ();
+ }
+ }
+
+ public bool IsPrimitive {
+ get {
+ return IsPrimitiveImpl ();
+ }
+ }
+
+ public bool IsPublic {
+ get {
+ return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.Public;
+ }
+ }
+
+ public bool IsSealed {
+ get {
+ return (Attributes & TypeAttributes.Sealed) != 0;
+ }
+ }
+
+ public bool IsSerializable {
+ get {
+ return (Attributes & TypeAttributes.Serializable) != 0;
+ }
+ }
+
+ public bool IsSpecialName {
+ get {
+ return (Attributes & TypeAttributes.SpecialName) != 0;
+ }
+ }
+
+ public bool IsUnicodeClass {
+ get {
+ return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.UnicodeClass;
+ }
+ }
+
+ public bool IsValueType {
+ get {
+ return IsValueTypeImpl ();
+ }
+ }
+
+ public override MemberTypes MemberType {
+ get {return MemberTypes.TypeInfo;}
+ }
+
+ public abstract Module Module {get;}
+
+ public abstract string Namespace {get;}
+
+ public override Type ReflectedType {
+ get {
+ return this;
+ }
+ }
+
+ public abstract RuntimeTypeHandle TypeHandle {get;}
+
+ public ConstructorInfo TypeInitializer {
+ get {
+ return GetConstructorImpl (
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static,
+ null,
+ CallingConventions.Any,
+ EmptyTypes,
+ null);
+ }
+ }
+
+ public abstract Type UnderlyingSystemType {get;}
+
+ public override bool Equals (object o) {
+ if (o == null)
+ return false;
+ // TODO: return UnderlyingSystemType == o.UnderlyingSystemType;
+ Type cmp = o as Type;
+ if (cmp == null)
+ return false;
+ return Equals (cmp);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern bool Equals (Type type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern Type internal_from_handle (RuntimeTypeHandle handle);
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern Type internal_from_name (string name);
+
+ public static Type GetType(string typeName)
+ {
+ return internal_from_name (typeName);
+ }
+
+ public static Type GetType(string typeName, bool throwOnError)
+ {
+ // LAMESPEC: what kinds of errors cause exception to be thrown?
+ return internal_from_name (typeName);
+ }
+
+ [MonoTODO]
+ public static Type GetType(string typeName, bool throwOnError, bool ignoreCase)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static Type[] GetTypeArray (object[] args) {
+ if (args == null)
+ throw new ArgumentNullException ("args");
+
+ Type[] ret;
+ ret = new Type [args.Length];
+ for (int i = 0; i < args.Length; ++i)
+ ret [i] = args[i].GetType ();
+ return ret;
+ }
+
+ [MonoTODO]
+ public static TypeCode GetTypeCode (Type type)
+ {
+ // FIXME -- this is most likely too simplistic for all cases;
+ // e.g. Enums
+
+ Type ust = type.UnderlyingSystemType;
+
+ if (ust == typeof (Boolean))
+ return TypeCode.Boolean;
+ if (ust == typeof (Byte))
+ return TypeCode.Byte;
+ if (ust == typeof (Char))
+ return TypeCode.Char;
+ if (ust == typeof (DateTime))
+ return TypeCode.DateTime;
+ if (ust == typeof (DBNull))
+ return TypeCode.DBNull;
+ if (ust == typeof (Decimal))
+ return TypeCode.Decimal;
+ if (ust == typeof (Double))
+ return TypeCode.Double;
+ if (ust == typeof (Int16))
+ return TypeCode.Int16;
+ if (ust == typeof (Int32))
+ return TypeCode.Int32;
+ if (ust == typeof (Int64))
+ return TypeCode.Int64;
+ if (ust == typeof (SByte))
+ return TypeCode.SByte;
+ if (ust == typeof (Single))
+ return TypeCode.Single;
+ if (ust == typeof (String))
+ return TypeCode.String;
+ if (ust == typeof (UInt16))
+ return TypeCode.UInt16;
+ if (ust == typeof (UInt32))
+ return TypeCode.UInt32;
+ if (ust == typeof (UInt64))
+ return TypeCode.UInt64;
+
+ return TypeCode.Empty;
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromCLSID (Guid clsid) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromCLSID (Guid clsid, bool throwOnError) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromCLSID (Guid clsid, string server) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromCLSID (Guid clsid, string server, bool throwOnError) {
+ throw new NotImplementedException ();
+ }
+
+ public static Type GetTypeFromHandle (RuntimeTypeHandle handle)
+ {
+ return internal_from_handle (handle);
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromProgID (string progID) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromProgID (string progID, bool throwOnError) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromProgID (string progID, string server) {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public static Type GetTypeFromProgID (string progID, string server, bool throwOnError) {
+ throw new NotImplementedException ();
+ }
+
+ public static RuntimeTypeHandle GetTypeHandle (object o) {
+ return o.GetType().TypeHandle;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern bool type_is_subtype_of (Type a, Type b, bool check_interfaces);
+
+ public virtual bool IsSubclassOf (Type c)
+ {
+ return type_is_subtype_of (this, c, false);
+ }
+
+ [MonoTODO]
+ public virtual Type[] FindInterfaces (TypeFilter filter, object filterCriteria)
+ {
+ // FIXME
+ throw new NotImplementedException ();
+ }
+
+ public Type GetInterface (string name) {
+ return GetInterface (name, false);
+ }
+
+ public abstract Type GetInterface (string name, bool ignoreCase);
+
+ public virtual InterfaceMapping GetInterfaceMap (Type interfaceType) {
+ throw new NotImplementedException ();
+ }
+
+ public abstract Type[] GetInterfaces ();
+
+ [MonoTODO]
+ public virtual bool IsAssignableFrom (Type c)
+ {
+ // FIXME
+ return type_is_subtype_of (c, this, true);
+ }
+
+ public virtual bool IsInstanceOfType (object o) {
+ if (o != null) {
+ return o.GetType().IsSubclassOf (this);
+ }
+ return false;
+ }
+
+ public virtual int GetArrayRank ()
+ {
+ throw new NotSupportedException (); // according to MSDN
+ }
+
+ public abstract Type GetElementType ();
+
+ public EventInfo GetEvent (string name) {
+ return GetEvent (name, DefaultBindingFlags);
+ }
+
+ public abstract EventInfo GetEvent (string name, BindingFlags bindingAttr);
+
+ public virtual EventInfo[] GetEvents () {
+ return GetEvents (DefaultBindingFlags);
+ }
+
+ public abstract EventInfo[] GetEvents (BindingFlags bindingAttr);
+
+ public FieldInfo GetField( string name) {
+ return GetField (name, DefaultBindingFlags);
+ }
+
+ public abstract FieldInfo GetField( string name, BindingFlags bindingAttr);
+
+ public FieldInfo[] GetFields ()
+ {
+ return GetFields (DefaultBindingFlags);
+ }
+
+ public abstract FieldInfo[] GetFields (BindingFlags bindingAttr);
+
+ public override int GetHashCode() {
+ return (int)_impl.Value;
+ }
+
+ public MemberInfo[] GetMember( string name) {
+ return GetMember (name, DefaultBindingFlags);
+ }
+
+ public virtual MemberInfo[] GetMember( string name, BindingFlags bindingAttr) {
+ return GetMember (name, MemberTypes.All, bindingAttr);
+ }
+
+ public virtual MemberInfo[] GetMember( string name, MemberTypes type, BindingFlags bindingAttr) {
+ throw new NotSupportedException (); // according to MSDN
+ }
+
+ public MemberInfo[] GetMembers() {
+ return GetMembers (DefaultBindingFlags);
+ }
+
+ public abstract MemberInfo[] GetMembers( BindingFlags bindingAttr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern MethodInfo get_method (Type type, string name, Type[] types);
+
+ public MethodInfo GetMethod( string name) {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ return GetMethodImpl (name, DefaultBindingFlags, null, CallingConventions.Any, null, null);
+ }
+
+ public MethodInfo GetMethod( string name, BindingFlags bindingAttr) {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ return GetMethodImpl (name, bindingAttr, null, CallingConventions.Any, null, null);
+ }
+
+ [MonoTODO]
+ public MethodInfo GetMethod (string name, Type[] types)
+ {
+ //TODO: return GetMethod (name, DefaultBindingFlags, null, CallingConventions.Any, types, null);
+ return get_method (this, name, types);
+ }
+
+ public MethodInfo GetMethod( string name, Type[] types, ParameterModifier[] modifiers) {
+ return GetMethod (name, DefaultBindingFlags, null, CallingConventions.Any, types, modifiers);
+ }
+
+ public MethodInfo GetMethod( string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) {
+ return GetMethod (name, bindingAttr, binder, CallingConventions.Any, types, modifiers);
+ }
+
+ public MethodInfo GetMethod( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (types == null)
+ throw new ArgumentNullException ("types");
+ return GetMethodImpl (name, bindingAttr, binder, callConvention, types, modifiers);
+ }
+
+ protected abstract MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
+
+ public MethodInfo[] GetMethods ()
+ {
+ return GetMethods (DefaultBindingFlags);
+ }
+
+ public abstract MethodInfo[] GetMethods (BindingFlags bindingAttr);
+
+ public Type GetNestedType( string name) {
+ return GetNestedType (name, DefaultBindingFlags);
+ }
+
+ public abstract Type GetNestedType( string name, BindingFlags bindingAttr);
+
+ public Type[] GetNestedTypes () {
+ return GetNestedTypes (DefaultBindingFlags);
+ }
+
+ public abstract Type[] GetNestedTypes (BindingFlags bindingAttr);
+
+
+ public PropertyInfo[] GetProperties ()
+ {
+ return GetProperties (DefaultBindingFlags);
+ }
+
+ public abstract PropertyInfo[] GetProperties( BindingFlags bindingAttr);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern PropertyInfo get_property (Type type, string name, Type[] types);
+
+
+ public PropertyInfo GetProperty (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ return GetPropertyImpl (name, DefaultBindingFlags, null, null, new Type[0], null);
+ }
+
+ public PropertyInfo GetProperty( string name, BindingFlags bindingAttr) {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ return GetPropertyImpl (name, bindingAttr, null, null, new Type[0], null);
+ }
+
+ public PropertyInfo GetProperty( string name, Type returnType) {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ return GetPropertyImpl (name, DefaultBindingFlags, null, returnType, new Type[0], null);
+ }
+
+ [MonoTODO]
+ public PropertyInfo GetProperty (string name, Type[] types)
+ {
+ // TODO: return GetProperty (name, DefaultBindingFlags, null, null, types, null);
+ return get_property (this, name, types);
+ }
+
+ public PropertyInfo GetProperty (string name, Type returnType, Type[] types)
+ {
+ return GetProperty (name, DefaultBindingFlags, null, returnType, types, null);
+ }
+
+ public PropertyInfo GetProperty( string name, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ return GetProperty (name, DefaultBindingFlags, null, returnType, types, modifiers);
+ }
+
+ public PropertyInfo GetProperty( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (types == null)
+ throw new ArgumentNullException ("types");
+ return GetPropertyImpl (name, bindingAttr, binder, returnType, types, modifiers);
+ }
+
+ protected abstract PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern ConstructorInfo get_constructor (Type type, Type[] types);
+
+ protected abstract ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
+
+ protected abstract TypeAttributes GetAttributeFlagsImpl ();
+ protected abstract bool HasElementTypeImpl ();
+ protected abstract bool IsArrayImpl ();
+ protected abstract bool IsByRefImpl ();
+ protected abstract bool IsCOMObjectImpl ();
+ protected virtual bool IsContextfulImpl () {
+ return typeof (ContextBoundObject).IsAssignableFrom (this);
+ }
+ protected virtual bool IsMarshalByRefImpl () {
+ return typeof (MarshalByRefObject).IsAssignableFrom (this);
+ }
+ protected abstract bool IsPointerImpl ();
+ protected abstract bool IsPrimitiveImpl ();
+ protected abstract bool IsValueTypeImpl ();
+
+ [MonoTODO]
+ public ConstructorInfo GetConstructor (Type[] types)
+ {
+ // TODO: return GetConstructor (BindingFlags.Public | BindingFlags.NonPublic, null, types, null);
+ return get_constructor (this, types);
+ }
+
+ public ConstructorInfo GetConstructor (BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) {
+ return GetConstructor (bindingAttr, binder, CallingConventions.Any, types, modifiers);
+ }
+
+ public ConstructorInfo GetConstructor( BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) {
+ if (types == null)
+ throw new ArgumentNullException ("types");
+ return GetConstructorImpl (bindingAttr, binder, callConvention, types, modifiers);
+ }
+
+ public ConstructorInfo[] GetConstructors () {
+ return GetConstructors (BindingFlags.Public | BindingFlags.NonPublic);
+ }
+
+ public abstract ConstructorInfo[] GetConstructors (BindingFlags bindingAttr);
+
+ [MonoTODO]
+ public virtual MemberInfo[] GetDefaultMembers () {
+ throw new NotImplementedException ();
+ }
+
+ public virtual MemberInfo[] FindMembers( MemberTypes memberType, BindingFlags bindingAttr,
+ MemberFilter filter, object filterCriteria) {
+ MemberInfo[] result;
+ ArrayList l = new ArrayList ();
+
+ //Console.WriteLine ("FindMembers for {0} (Type: {1}): {2}", this.FullName, this.GetType().FullName, this.obj_address());
+
+ if ((memberType & MemberTypes.Constructor) != 0) {
+ ConstructorInfo[] c = GetConstructors (bindingAttr);
+ if (filter != null) {
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria))
+ l.Add (m);
+ }
+ } else {
+ l.AddRange (c);
+ }
+ }
+ if ((memberType & MemberTypes.Event) != 0) {
+ EventInfo[] c = GetEvents (bindingAttr);
+ if (filter != null) {
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria))
+ l.Add (m);
+ }
+ } else {
+ l.AddRange (c);
+ }
+ }
+ if ((memberType & MemberTypes.Field) != 0) {
+ FieldInfo[] c = GetFields (bindingAttr);
+ if (filter != null) {
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria))
+ l.Add (m);
+ }
+ } else {
+ l.AddRange (c);
+ }
+ }
+ if ((memberType & MemberTypes.Method) != 0) {
+ MethodInfo[] c = GetMethods (bindingAttr);
+ if (filter != null) {
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria))
+ l.Add (m);
+ }
+ } else {
+ l.AddRange (c);
+ }
+ }
+ if ((memberType & MemberTypes.Property) != 0) {
+ PropertyInfo[] c;
+ int count = l.Count;
+ Type ptype;
+ if (filter != null) {
+ ptype = this;
+ while ((l.Count == count) && (ptype != null)) {
+ c = ptype.GetProperties (bindingAttr);
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria))
+ l.Add (m);
+ }
+ ptype = ptype.BaseType;
+ }
+ } else {
+ c = GetProperties (bindingAttr);
+ l.AddRange (c);
+ }
+ }
+ if ((memberType & MemberTypes.NestedType) != 0) {
+ Type[] c = GetNestedTypes (bindingAttr);
+ if (filter != null) {
+ foreach (MemberInfo m in c) {
+ if (filter (m, filterCriteria)) {
+ l.Add (m);
+ }
+ }
+ } else {
+ l.AddRange (c);
+ }
+ }
+ result = new MemberInfo [l.Count];
+ l.CopyTo (result);
+ return result;
+ }
+
+ [MonoTODO]
+ public object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args) {
+ // FIXME
+ return null;
+ }
+
+ [MonoTODO]
+ public object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, CultureInfo culture) {
+ // FIXME
+ return null;
+ }
+
+ public abstract object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters);
+
+ public override string ToString()
+ {
+ return FullName;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/TypeCode.cs b/mcs/class/corlib/System/TypeCode.cs
new file mode 100644
index 00000000000..e2ef3f4a746
--- /dev/null
+++ b/mcs/class/corlib/System/TypeCode.cs
@@ -0,0 +1,93 @@
+// TypeCode.cs
+//
+// This code was automatically generated from
+// ECMA CLI XML Library Specification.
+// Generator: libgen.xsl [1.0; (C) Sergey Chaban (serge@wildwestsoftware.com)]
+// Created: Wed, 5 Sep 2001 06:34:09 UTC
+// Source file: all.xml
+// URL: http://devresource.hp.com/devresource/Docs/TechPapers/CSharp/all.xml
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+
+
+namespace System {
+
+
+ /// <summary>
+ /// </summary>
+ public enum TypeCode {
+
+ /// <summary>
+ /// </summary>
+ Empty = 0,
+
+ /// <summary>
+ /// </summary>
+ Object = 1,
+
+ /// <summary>
+ /// </summary>
+ DBNull = 2,
+
+ /// <summary>
+ /// </summary>
+ Boolean = 3,
+
+ /// <summary>
+ /// </summary>
+ Char = 4,
+
+ /// <summary>
+ /// </summary>
+ SByte = 5,
+
+ /// <summary>
+ /// </summary>
+ Byte = 6,
+
+ /// <summary>
+ /// </summary>
+ Int16 = 7,
+
+ /// <summary>
+ /// </summary>
+ UInt16 = 8,
+
+ /// <summary>
+ /// </summary>
+ Int32 = 9,
+
+ /// <summary>
+ /// </summary>
+ UInt32 = 10,
+
+ /// <summary>
+ /// </summary>
+ Int64 = 11,
+
+ /// <summary>
+ /// </summary>
+ UInt64 = 12,
+
+ /// <summary>
+ /// </summary>
+ Single = 13,
+
+ /// <summary>
+ /// </summary>
+ Double = 14,
+
+ /// <summary>
+ /// </summary>
+ Decimal = 15,
+
+ /// <summary>
+ /// </summary>
+ DateTime = 16,
+
+ /// <summary>
+ /// </summary>
+ String = 18,
+ } // TypeCode
+
+} // System
diff --git a/mcs/class/corlib/System/TypeInitializationException.cs b/mcs/class/corlib/System/TypeInitializationException.cs
new file mode 100644
index 00000000000..cae537d64b5
--- /dev/null
+++ b/mcs/class/corlib/System/TypeInitializationException.cs
@@ -0,0 +1,40 @@
+//
+// System.TypeInitializationException.cs
+//
+// Author:
+// Joe Shaw (joe@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+using System.Globalization;
+using System.Runtime.Serialization;
+namespace System {
+
+ [Serializable]
+ public sealed class TypeInitializationException : SystemException {
+ string type_name;
+
+ // Constructors
+ public TypeInitializationException (string type_name, Exception inner)
+ : base (Locale.GetText ("An exception was thrown by the type initializer for ") + type_name, inner)
+ {
+ this.type_name = type_name;
+ }
+
+ // Properties
+ public string TypeName {
+ get {
+ return type_name;
+ }
+ }
+
+ // Methods
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+ info.AddValue ("TypeName", type_name);
+ }
+ }
+
+}
diff --git a/mcs/class/corlib/System/TypeLoadException.cs b/mcs/class/corlib/System/TypeLoadException.cs
new file mode 100644
index 00000000000..91458786b3a
--- /dev/null
+++ b/mcs/class/corlib/System/TypeLoadException.cs
@@ -0,0 +1,73 @@
+//
+// System.TypeLoadException
+//
+// Author:
+// Sean MacIsaac (macisaac@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ [Serializable]
+ public class TypeLoadException : SystemException {
+
+ // Fields
+ private string msg;
+ private string type;
+
+ // Constructors
+ public TypeLoadException ()
+ : base (Locale.GetText ("A type load exception has occurred."))
+ {
+ msg = Locale.GetText ("A type load exception has occured.");
+ }
+
+ public TypeLoadException (string message)
+ : base (message)
+ {
+ msg = message;
+ }
+
+ public TypeLoadException (string message, Exception inner)
+ : base (message, inner)
+ {
+ msg = message;
+ }
+
+ protected TypeLoadException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ // Properties
+ public override string Message
+ {
+ get { return msg; }
+ }
+
+ public string TypeName
+ {
+ get { return type; }
+ }
+
+ // Methods
+ //
+ // It seems like this object serializes more fields than those described.
+ // Those fields are TypeLoadClassName, TypeLoadAssemblyName,
+ // TypeLoadMessageArg and TypeLoadResourceID.
+ //
+ [MonoTODO]
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ throw new ArgumentNullException ("info is null.");
+ base.GetObjectData (info, context);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/TypeUnloadedException.cs b/mcs/class/corlib/System/TypeUnloadedException.cs
new file mode 100644
index 00000000000..10929e3fe68
--- /dev/null
+++ b/mcs/class/corlib/System/TypeUnloadedException.cs
@@ -0,0 +1,43 @@
+//
+// System.TypeUnloadedException.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+//
+// 2002 (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public class TypeUnloadedException : SystemException
+ {
+ // Constructors
+ public TypeUnloadedException ()
+ : base (Locale.GetText ("Cannot access an unloaded class."))
+ {
+ }
+
+ public TypeUnloadedException (string message)
+ : base (message)
+ {
+ }
+
+ protected TypeUnloadedException (SerializationInfo info,
+ StreamingContext context)
+ : base (info, context)
+ {
+ }
+
+ public TypeUnloadedException (string message, Exception innerException)
+ :base (message, innerException)
+ {
+ }
+
+ }
+}
+
diff --git a/mcs/class/corlib/System/UInt16.cs b/mcs/class/corlib/System/UInt16.cs
new file mode 100644
index 00000000000..125aa104b4d
--- /dev/null
+++ b/mcs/class/corlib/System/UInt16.cs
@@ -0,0 +1,232 @@
+//
+// System.UInt16.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+
+namespace System {
+
+ [CLSCompliant(false)]
+ [Serializable]
+ public struct UInt16 : IComparable, IFormattable, IConvertible {
+
+ public const ushort MaxValue = 0xffff;
+ public const ushort MinValue = 0;
+
+ public ushort value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if(!(v is System.UInt16))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.UInt16"));
+
+ return value - ((ushort) v);
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.UInt16))
+ return false;
+
+ return ((ushort) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return value;
+ }
+
+ [CLSCompliant(false)]
+ public static ushort Parse (string s)
+ {
+ ushort val = 0;
+ int len;
+ int i;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ if (s [i] == '+')
+ i++;
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ ushort d = (ushort) (c - '0');
+
+ val = checked ((ushort) (val * 10 + d));
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ return val;
+
+ }
+
+ [CLSCompliant(false)]
+ public static ushort Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ [CLSCompliant(false)]
+ public static ushort Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ [CLSCompliant(false)]
+ public static ushort Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ uint tmpResult = UInt32.Parse (s, style, fp);
+ if (tmpResult > UInt16.MaxValue || tmpResult < UInt16.MinValue)
+ throw new OverflowException ("Value too large or too small.");
+
+ return (ushort) tmpResult;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.UInt16;
+ }
+
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+
+ public byte ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+
+ public char ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+
+ public double ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+
+ [CLSCompliant (false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+
+ public float ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant (false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+
+ [CLSCompliant (false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+
+ [CLSCompliant (false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/UInt32.cs b/mcs/class/corlib/System/UInt32.cs
new file mode 100644
index 00000000000..109031ba178
--- /dev/null
+++ b/mcs/class/corlib/System/UInt32.cs
@@ -0,0 +1,498 @@
+//
+// System.UInt32.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Threading;
+
+namespace System {
+
+ [CLSCompliant(false)]
+ [Serializable]
+ public struct UInt32 : IComparable, IFormattable, IConvertible {
+
+ public const uint MaxValue = 0xffffffff;
+ public const uint MinValue = 0;
+
+ public uint value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.UInt32))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.UInt32"));
+
+ if (value == (uint) v)
+ return 0;
+
+ if (value < (uint) v)
+ return -1;
+
+ return 1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.UInt32))
+ return false;
+
+ return ((uint) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int) value;
+ }
+
+ [CLSCompliant(false)]
+ public static uint Parse (string s)
+ {
+ uint val = 0;
+ int len;
+ int i;
+ bool digits_seen = false;
+
+ if (s == null)
+ throw new ArgumentNullException (Locale.GetText ("s is null"));
+
+ len = s.Length;
+
+ char c;
+ for (i = 0; i < len; i++){
+ c = s [i];
+ if (!Char.IsWhiteSpace (c))
+ break;
+ }
+
+ if (i == len)
+ throw new FormatException ();
+
+ if (s [i] == '+')
+ i++;
+
+ for (; i < len; i++){
+ c = s [i];
+
+ if (c >= '0' && c <= '9'){
+ uint d = (uint) (c - '0');
+
+ val = checked (val * 10 + d);
+ digits_seen = true;
+ } else {
+ if (Char.IsWhiteSpace (c)){
+ for (i++; i < len; i++){
+ if (!Char.IsWhiteSpace (s [i]))
+ throw new FormatException ();
+ }
+ break;
+ } else
+ throw new FormatException ();
+ }
+ }
+ if (!digits_seen)
+ throw new FormatException ();
+
+ return val;
+
+ }
+
+ [CLSCompliant(false)]
+ public static uint Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ [CLSCompliant(false)]
+ public static uint Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ private delegate bool IsAnything (Char c);
+
+ private static void CheckStyle (NumberStyles style)
+ {
+ if ((style & NumberStyles.AllowHexSpecifier) != 0) {
+ NumberStyles ne = style ^ NumberStyles.AllowHexSpecifier;
+ if ((ne & NumberStyles.AllowLeadingWhite) != 0)
+ ne ^= NumberStyles.AllowLeadingWhite;
+ if ((ne & NumberStyles.AllowTrailingWhite) != 0)
+ ne ^= NumberStyles.AllowTrailingWhite;
+ if (ne != 0)
+ throw new ArgumentException (
+ "With AllowHexSpecifier only " +
+ "AllowLeadingWhite and AllowTrailingWhite " +
+ "are permitted.");
+ }
+ }
+
+ private static int JumpOverWhite (int pos, string s, bool excp)
+ {
+ while (pos < s.Length && Char.IsWhiteSpace (s [pos]))
+ pos++;
+
+ if (excp && pos >= s.Length)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ return pos;
+ }
+
+ private static void FindSign (ref int pos, string s, NumberFormatInfo nfi,
+ ref bool foundSign, ref bool negative)
+ {
+ if ((pos + nfi.NegativeSign.Length) <= s.Length &&
+ s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign) {
+ negative = true;
+ foundSign = true;
+ pos += nfi.NegativeSign.Length;
+ }
+ else if ((pos + nfi.PositiveSign.Length) < s.Length &&
+ s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign) {
+ negative = false;
+ pos += nfi.PositiveSign.Length;
+ foundSign = true;
+ }
+ }
+
+ private static void FindCurrency (ref int pos,
+ string s,
+ NumberFormatInfo nfi,
+ ref bool foundCurrency)
+ {
+ if ((pos + nfi.CurrencySymbol.Length) <= s.Length &&
+ s.Substring (pos, nfi.CurrencySymbol.Length) == nfi.CurrencySymbol) {
+ foundCurrency = true;
+ pos += nfi.CurrencySymbol.Length;
+ }
+ }
+
+ private static bool FindOther (ref int pos,
+ string s,
+ string other)
+ {
+ if ((pos + other.Length) <= s.Length &&
+ s.Substring (pos, other.Length) == other) {
+ pos += other.Length;
+ return true;
+ }
+
+ return false;
+ }
+
+ [CLSCompliant(false)]
+ public static uint Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ if (s == null)
+ throw new ArgumentNullException ();
+
+ if (s.Length == 0)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ NumberFormatInfo nfi;
+ if (fp != null) {
+ Type typeNFI = typeof (System.Globalization.NumberFormatInfo);
+ nfi = (NumberFormatInfo) fp.GetFormat (typeNFI);
+ }
+ else
+ nfi = Thread.CurrentThread.CurrentCulture.NumberFormat;
+
+ CheckStyle (style);
+
+ bool AllowCurrencySymbol = (style & NumberStyles.AllowCurrencySymbol) != 0;
+ bool AllowExponent = (style & NumberStyles.AllowExponent) != 0;
+ bool AllowHexSpecifier = (style & NumberStyles.AllowHexSpecifier) != 0;
+ bool AllowThousands = (style & NumberStyles.AllowThousands) != 0;
+ bool AllowDecimalPoint = (style & NumberStyles.AllowDecimalPoint) != 0;
+ bool AllowParentheses = (style & NumberStyles.AllowParentheses) != 0;
+ bool AllowTrailingSign = (style & NumberStyles.AllowTrailingSign) != 0;
+ bool AllowLeadingSign = (style & NumberStyles.AllowLeadingSign) != 0;
+ bool AllowTrailingWhite = (style & NumberStyles.AllowTrailingWhite) != 0;
+ bool AllowLeadingWhite = (style & NumberStyles.AllowLeadingWhite) != 0;
+
+ int pos = 0;
+
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+
+ bool foundOpenParentheses = false;
+ bool negative = false;
+ bool foundSign = false;
+ bool foundCurrency = false;
+
+ // Pre-number stuff
+ if (AllowParentheses && s [pos] == '(') {
+ foundOpenParentheses = true;
+ foundSign = true;
+ negative = true; // MS always make the number negative when there parentheses
+ // even when NumberFormatInfo.NumberNegativePattern != 0!!!
+ pos++;
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+
+ if (s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign)
+ throw new FormatException ("Input string was not in the correct format.");
+ if (s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign)
+ throw new FormatException ("Input string was not in the correct format.");
+ }
+
+ if (AllowLeadingSign && !foundSign) {
+ // Sign + Currency
+ FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol) {
+ FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ if (foundCurrency && AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (foundCurrency) {
+ if (!foundSign && AllowLeadingSign) {
+ FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ if (foundSign && AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+ }
+
+ IsAnything validDigit;
+ if (AllowHexSpecifier)
+ validDigit = new IsAnything (Char.IsNumber);
+ else
+ validDigit = new IsAnything (Char.IsDigit);
+
+ uint number = 0;
+ int nDigits = 0;
+ bool decimalPointFound = false;
+ uint digitValue;
+ char hexDigit;
+
+ // Number stuff
+ // Just the same as Int32, but this one adds instead of substract
+ do {
+
+ if (!validDigit (s [pos])) {
+ if (AllowThousands &&
+ FindOther (ref pos, s, nfi.NumberGroupSeparator))
+ continue;
+ else
+ if (!decimalPointFound && AllowDecimalPoint &&
+ FindOther (ref pos, s, nfi.NumberDecimalSeparator)) {
+ decimalPointFound = true;
+ continue;
+ }
+
+ break;
+ }
+ else if (AllowHexSpecifier) {
+ nDigits++;
+ hexDigit = s [pos++];
+ if (Char.IsDigit (hexDigit))
+ digitValue = (uint) (hexDigit - '0');
+ else if (Char.IsLower (hexDigit))
+ digitValue = (uint) (hexDigit - 'a' + 10);
+ else
+ digitValue = (uint) (hexDigit - 'A' + 10);
+
+ number = checked (number * 16 + digitValue);
+ }
+ else if (decimalPointFound) {
+ nDigits++;
+ // Allows decimal point as long as it's only
+ // followed by zeroes.
+ if (s [pos++] != '0')
+ throw new OverflowException ("Value too large or too small.");
+ }
+ else {
+ nDigits++;
+
+ try {
+ number = checked (
+ number * 10 +
+ (uint) (s [pos++] - '0')
+ );
+ } catch (OverflowException) {
+ throw new OverflowException ("Value too large or too small.");
+ }
+ }
+ } while (pos < s.Length);
+
+ // Post number stuff
+ if (nDigits == 0)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ if (AllowTrailingSign && !foundSign) {
+ // Sign + Currency
+ FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowTrailingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol)
+ FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowTrailingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (!foundSign && AllowTrailingSign)
+ FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ }
+ }
+
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = JumpOverWhite (pos, s, false);
+
+ if (foundOpenParentheses) {
+ if (pos >= s.Length || s [pos++] != ')')
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = JumpOverWhite (pos, s, false);
+ }
+
+ if (pos < s.Length)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ if (negative)
+ throw new OverflowException ( "Value too large or too small.");
+
+ return number;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.UInt32;
+ }
+
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+
+ public byte ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+
+ public char ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ return System.Convert.ToDateTime (value);
+ }
+
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+
+ public double ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+
+ [CLSCompliant (false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+
+ public float ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ return System.Convert.ToType (value, conversionType, provider);
+ }
+
+ [CLSCompliant (false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+
+ [CLSCompliant (false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+
+ [CLSCompliant (false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt64 (value);
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/UInt64.cs b/mcs/class/corlib/System/UInt64.cs
new file mode 100644
index 00000000000..4ae319ccdf6
--- /dev/null
+++ b/mcs/class/corlib/System/UInt64.cs
@@ -0,0 +1,436 @@
+//
+// System.UInt64.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Threading;
+
+namespace System {
+
+ [CLSCompliant(false)]
+ [Serializable]
+ public struct UInt64 : IComparable, IFormattable, IConvertible {
+ public const ulong MaxValue = 0xffffffffffffffff;
+ public const ulong MinValue = 0;
+
+ public ulong value;
+
+ public int CompareTo (object v)
+ {
+ if (v == null)
+ return 1;
+
+ if (!(v is System.UInt64))
+ throw new ArgumentException (Locale.GetText ("Value is not a System.UInt64"));
+
+ if (value == (ulong) v)
+ return 0;
+
+ if (value < (ulong) v)
+ return -1;
+
+ return 1;
+ }
+
+ public override bool Equals (object o)
+ {
+ if (!(o is System.UInt64))
+ return false;
+
+ return ((ulong) o) == value;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (int)(value & 0xffffffff) ^ (int)(value >> 32);
+ }
+
+ [CLSCompliant(false)]
+ public static ulong Parse (string s)
+ {
+ return Parse (s, NumberStyles.Integer, null);
+ }
+
+ [CLSCompliant(false)]
+ public static ulong Parse (string s, IFormatProvider fp)
+ {
+ return Parse (s, NumberStyles.Integer, fp);
+ }
+
+ [CLSCompliant(false)]
+ public static ulong Parse (string s, NumberStyles style)
+ {
+ return Parse (s, style, null);
+ }
+
+ private delegate bool IsAnything (Char c);
+
+ private static void CheckStyle (NumberStyles style)
+ {
+ if ((style & NumberStyles.AllowHexSpecifier) != 0) {
+ NumberStyles ne = style ^ NumberStyles.AllowHexSpecifier;
+ if ((ne & NumberStyles.AllowLeadingWhite) != 0)
+ ne ^= NumberStyles.AllowLeadingWhite;
+ if ((ne & NumberStyles.AllowTrailingWhite) != 0)
+ ne ^= NumberStyles.AllowTrailingWhite;
+ if (ne != 0)
+ throw new ArgumentException (
+ "With AllowHexSpecifier only " +
+ "AllowLeadingWhite and AllowTrailingWhite " +
+ "are permitted.");
+ }
+ }
+
+ private static int JumpOverWhite (int pos, string s, bool excp)
+ {
+ while (pos < s.Length && Char.IsWhiteSpace (s [pos]))
+ pos++;
+
+ if (excp && pos >= s.Length)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ return pos;
+ }
+
+ private static void FindSign (ref int pos, string s, NumberFormatInfo nfi,
+ ref bool foundSign, ref bool negative)
+ {
+ if ((pos + nfi.NegativeSign.Length) <= s.Length &&
+ s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign) {
+ negative = true;
+ foundSign = true;
+ pos += nfi.NegativeSign.Length;
+ }
+ else if ((pos + nfi.PositiveSign.Length) < s.Length &&
+ s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign) {
+ negative = false;
+ pos += nfi.PositiveSign.Length;
+ foundSign = true;
+ }
+ }
+
+ private static void FindCurrency (ref int pos,
+ string s,
+ NumberFormatInfo nfi,
+ ref bool foundCurrency)
+ {
+ if ((pos + nfi.CurrencySymbol.Length) <= s.Length &&
+ s.Substring (pos, nfi.CurrencySymbol.Length) == nfi.CurrencySymbol) {
+ foundCurrency = true;
+ pos += nfi.CurrencySymbol.Length;
+ }
+ }
+
+ private static bool FindOther (ref int pos,
+ string s,
+ string other)
+ {
+ if ((pos + other.Length) <= s.Length &&
+ s.Substring (pos, other.Length) == other) {
+ pos += other.Length;
+ return true;
+ }
+
+ return false;
+ }
+
+ [CLSCompliant(false)]
+ public static ulong Parse (string s, NumberStyles style, IFormatProvider fp)
+ {
+ if (s == null)
+ throw new ArgumentNullException ();
+
+ if (s.Length == 0)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ NumberFormatInfo nfi;
+ if (fp != null) {
+ Type typeNFI = typeof (System.Globalization.NumberFormatInfo);
+ nfi = (NumberFormatInfo) fp.GetFormat (typeNFI);
+ }
+ else
+ nfi = Thread.CurrentThread.CurrentCulture.NumberFormat;
+
+ CheckStyle (style);
+
+ bool AllowCurrencySymbol = (style & NumberStyles.AllowCurrencySymbol) != 0;
+ bool AllowExponent = (style & NumberStyles.AllowExponent) != 0;
+ bool AllowHexSpecifier = (style & NumberStyles.AllowHexSpecifier) != 0;
+ bool AllowThousands = (style & NumberStyles.AllowThousands) != 0;
+ bool AllowDecimalPoint = (style & NumberStyles.AllowDecimalPoint) != 0;
+ bool AllowParentheses = (style & NumberStyles.AllowParentheses) != 0;
+ bool AllowTrailingSign = (style & NumberStyles.AllowTrailingSign) != 0;
+ bool AllowLeadingSign = (style & NumberStyles.AllowLeadingSign) != 0;
+ bool AllowTrailingWhite = (style & NumberStyles.AllowTrailingWhite) != 0;
+ bool AllowLeadingWhite = (style & NumberStyles.AllowLeadingWhite) != 0;
+
+ int pos = 0;
+
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+
+ bool foundOpenParentheses = false;
+ bool negative = false;
+ bool foundSign = false;
+ bool foundCurrency = false;
+
+ // Pre-number stuff
+ if (AllowParentheses && s [pos] == '(') {
+ foundOpenParentheses = true;
+ foundSign = true;
+ negative = true; // MS always make the number negative when there parentheses
+ // even when NumberFormatInfo.NumberNegativePattern != 0!!!
+ pos++;
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+
+ if (s.Substring (pos, nfi.NegativeSign.Length) == nfi.NegativeSign)
+ throw new FormatException ("Input string was not in the correct format.");
+ if (s.Substring (pos, nfi.PositiveSign.Length) == nfi.PositiveSign)
+ throw new FormatException ("Input string was not in the correct format.");
+ }
+
+ if (AllowLeadingSign && !foundSign) {
+ // Sign + Currency
+ FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol) {
+ FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ if (foundCurrency && AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (foundCurrency) {
+ if (!foundSign && AllowLeadingSign) {
+ FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ if (foundSign && AllowLeadingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ }
+ }
+ }
+ }
+
+ IsAnything validDigit;
+ if (AllowHexSpecifier)
+ validDigit = new IsAnything (Char.IsNumber);
+ else
+ validDigit = new IsAnything (Char.IsDigit);
+
+ ulong number = 0;
+ int nDigits = 0;
+ bool decimalPointFound = false;
+ ulong digitValue;
+ char hexDigit;
+
+ // Number stuff
+ // Just the same as Int32, but this one adds instead of substract
+ do {
+
+ if (!validDigit (s [pos])) {
+ if (AllowThousands &&
+ FindOther (ref pos, s, nfi.NumberGroupSeparator))
+ continue;
+ else
+ if (!decimalPointFound && AllowDecimalPoint &&
+ FindOther (ref pos, s, nfi.NumberDecimalSeparator)) {
+ decimalPointFound = true;
+ continue;
+ }
+
+ break;
+ }
+ else if (AllowHexSpecifier) {
+ nDigits++;
+ hexDigit = s [pos++];
+ if (Char.IsDigit (hexDigit))
+ digitValue = (ulong) (hexDigit - '0');
+ else if (Char.IsLower (hexDigit))
+ digitValue = (ulong) (hexDigit - 'a' + 10);
+ else
+ digitValue = (ulong) (hexDigit - 'A' + 10);
+
+ number = checked (number * 16 + digitValue);
+ }
+ else if (decimalPointFound) {
+ nDigits++;
+ // Allows decimal point as long as it's only
+ // followed by zeroes.
+ if (s [pos++] != '0')
+ throw new OverflowException ("Value too large or too small.");
+ }
+ else {
+ nDigits++;
+
+ try {
+ number = checked (
+ number * 10 +
+ (ulong) (s [pos++] - '0')
+ );
+ } catch (OverflowException) {
+ throw new OverflowException ("Value too large or too small.");
+ }
+ }
+ } while (pos < s.Length);
+
+ // Post number stuff
+ if (nDigits == 0)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ if (AllowTrailingSign && !foundSign) {
+ // Sign + Currency
+ FindSign (ref pos, s, nfi, ref foundSign, ref negative);
+ if (foundSign) {
+ if (AllowTrailingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (AllowCurrencySymbol)
+ FindCurrency (ref pos, s, nfi,
+ ref foundCurrency);
+ }
+ }
+
+ if (AllowCurrencySymbol && !foundCurrency) {
+ // Currency + sign
+ FindCurrency (ref pos, s, nfi, ref foundCurrency);
+ if (foundCurrency) {
+ if (AllowTrailingWhite)
+ pos = JumpOverWhite (pos, s, true);
+ if (!foundSign && AllowTrailingSign)
+ FindSign (ref pos, s, nfi, ref foundSign,
+ ref negative);
+ }
+ }
+
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = JumpOverWhite (pos, s, false);
+
+ if (foundOpenParentheses) {
+ if (pos >= s.Length || s [pos++] != ')')
+ throw new FormatException ("Input string was not in the correct " +
+ "format.");
+ if (AllowTrailingWhite && pos < s.Length)
+ pos = JumpOverWhite (pos, s, false);
+ }
+
+ if (pos < s.Length)
+ throw new FormatException ("Input string was not in the correct format.");
+
+ if (negative)
+ throw new OverflowException ( "Value too large or too small.");
+
+ return number;
+ }
+
+ public override string ToString ()
+ {
+ return ToString (null, null);
+ }
+
+ public string ToString (IFormatProvider fp)
+ {
+ return ToString (null, fp);
+ }
+
+ public string ToString (string format)
+ {
+ return ToString (format, null);
+ }
+
+ public string ToString (string format, IFormatProvider fp)
+ {
+ NumberFormatInfo nfi = NumberFormatInfo.GetInstance( fp );
+
+ if ( format == null )
+ format = "G";
+
+ return IntegerFormatter.NumberToString(format, nfi, value);
+ }
+
+ // =========== IConvertible Methods =========== //
+
+ public TypeCode GetTypeCode ()
+ {
+ return TypeCode.UInt64;
+ }
+ public bool ToBoolean (IFormatProvider provider)
+ {
+ return System.Convert.ToBoolean (value);
+ }
+ public byte ToByte (IFormatProvider provider)
+ {
+ return System.Convert.ToByte (value);
+ }
+ public char ToChar (IFormatProvider provider)
+ {
+ return System.Convert.ToChar (value);
+ }
+ public DateTime ToDateTime (IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+ public decimal ToDecimal (IFormatProvider provider)
+ {
+ return System.Convert.ToDecimal (value);
+ }
+ public double ToDouble (IFormatProvider provider)
+ {
+ return System.Convert.ToDouble (value);
+ }
+ public short ToInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt16 (value);
+ }
+ public int ToInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt32 (value);
+ }
+ public long ToInt64 (IFormatProvider provider)
+ {
+ return System.Convert.ToInt64 (value);
+ }
+ [CLSCompliant(false)]
+ public sbyte ToSByte (IFormatProvider provider)
+ {
+ return System.Convert.ToSByte (value);
+ }
+ public float ToSingle (IFormatProvider provider)
+ {
+ return System.Convert.ToSingle (value);
+ }
+ public object ToType (Type conversionType, IFormatProvider provider)
+ {
+ throw new NotImplementedException ();
+ }
+ [CLSCompliant(false)]
+ public ushort ToUInt16 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt16 (value);
+ }
+ [CLSCompliant(false)]
+ public uint ToUInt32 (IFormatProvider provider)
+ {
+ return System.Convert.ToUInt32 (value);
+ }
+ [CLSCompliant(false)]
+ public ulong ToUInt64 (IFormatProvider provider)
+ {
+ return value;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/UIntPtr.cs b/mcs/class/corlib/System/UIntPtr.cs
new file mode 100644
index 00000000000..cbbe6ca928a
--- /dev/null
+++ b/mcs/class/corlib/System/UIntPtr.cs
@@ -0,0 +1,180 @@
+//------------------------------------------------------------------------------
+//
+// System.UIntPtr.cs
+//
+// Copyright (C) 2001 Michael Lambert, All Rights Reserved
+//
+// Author: Michael Lambert, michaellambert@email.com
+// Created: Thu 07/31/2001
+//
+// Remarks: Requires '/unsafe' compiler option. This class uses void*,
+// ulong, and uint in overloaded constructors, conversion, and
+// cast members in the public interface. Using pointers is not
+// valid CLS and the methods in question have been marked with
+// the CLSCompliant attribute that avoid compiler warnings.
+//
+//------------------------------------------------------------------------------
+
+using System.Runtime.Serialization;
+using System.Runtime.InteropServices;
+
+
+namespace System
+{
+
+[
+ StructLayout(LayoutKind.Auto),
+ CLSCompliant(false)
+]
+[Serializable]
+public unsafe struct UIntPtr : ISerializable
+{
+ public static readonly UIntPtr Zero = new UIntPtr(0);
+ private void* _pointer;
+
+ [
+ CLSCompliant(false)
+ ]
+ public UIntPtr(ulong value)
+ {
+ _pointer = (void*) value;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public UIntPtr(uint value)
+ {
+ _pointer = (void*)value;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public unsafe UIntPtr(void* value)
+ {
+ _pointer = value;
+ }
+
+ public override bool Equals(object obj)
+ {
+ if( obj is UIntPtr )
+ {
+ UIntPtr obj2 = (UIntPtr)obj;
+ return this._pointer == obj2._pointer;
+ }
+
+ return false;
+ }
+ public override int GetHashCode()
+ {
+ return (int)_pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public uint ToUInt32()
+ {
+ return (uint) _pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public ulong ToUInt64()
+ {
+ return (ulong) _pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public unsafe void* ToPointer()
+ {
+ return _pointer;
+ }
+ public override string ToString()
+ {
+ return ((uint) _pointer).ToString();
+ }
+
+ // Interface ISerializable
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ if( info == null )
+ throw new ArgumentNullException( "info" );
+ // if( context == null ) -- context is struct can't be null.
+ // throw new ArgumentNullException( "context" );
+
+ info.AddValue("pointer", (ulong)_pointer);
+ }
+
+ public static bool operator ==(UIntPtr value1, UIntPtr value2)
+ {
+ return value1._pointer == value2._pointer;
+ }
+ public static bool operator !=(UIntPtr value1, UIntPtr value2)
+ {
+ return value1._pointer != value2._pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public static explicit operator ulong(UIntPtr value)
+ {
+ return (ulong)value._pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public static explicit operator uint(UIntPtr value)
+ {
+ return (uint)value._pointer;
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public static explicit operator UIntPtr(ulong value)
+ {
+ return new UIntPtr(value);
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public unsafe static explicit operator UIntPtr(void* value)
+ {
+ return new UIntPtr(value);
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public unsafe static explicit operator void*(UIntPtr value)
+ {
+ return value.ToPointer();
+ }
+
+ [
+ CLSCompliant(false)
+ ]
+ public static explicit operator UIntPtr(uint value)
+ {
+ return new UIntPtr(value);
+ }
+
+ public static int Size
+ {
+ get
+ {
+ return sizeof(void*);
+ }
+ }
+}
+
+} // Namespace
+
diff --git a/mcs/class/corlib/System/UnauthorizedAccessException.cs b/mcs/class/corlib/System/UnauthorizedAccessException.cs
new file mode 100755
index 00000000000..9ac213779d4
--- /dev/null
+++ b/mcs/class/corlib/System/UnauthorizedAccessException.cs
@@ -0,0 +1,38 @@
+//
+// System.UnauthorizedAccessException.cs
+//
+// Author:
+// Paolo Molaro (lupus@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+//
+// (C) 2001 Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace System {
+
+ public class UnauthorizedAccessException : SystemException {
+ // Constructors
+ public UnauthorizedAccessException ()
+ : base (Locale.GetText ("Access to the requested resource is not authorized"))
+ {
+ }
+
+ public UnauthorizedAccessException (string message)
+ : base (message)
+ {
+ }
+
+ public UnauthorizedAccessException (string message, Exception inner)
+ : base (message, inner)
+ {
+ }
+
+ protected UnauthorizedAccessException (SerializationInfo info, StreamingContext context)
+ : base (info, context)
+ {
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/UnhandledExceptionEventArgs.cs b/mcs/class/corlib/System/UnhandledExceptionEventArgs.cs
new file mode 100755
index 00000000000..81e318eeec4
--- /dev/null
+++ b/mcs/class/corlib/System/UnhandledExceptionEventArgs.cs
@@ -0,0 +1,43 @@
+//
+// System.UnhandledExceptionEventArgs.cs
+//
+// Author:
+// Chris Hynes (chrish@assistedsolutions.com)
+//
+// (C) 2001 Chris Hynes
+//
+
+using System;
+using System.Reflection;
+
+namespace System
+{
+ [Serializable]
+ public class UnhandledExceptionEventArgs: EventArgs
+ {
+ private object exception;
+ private bool m_isTerminating;
+
+ public UnhandledExceptionEventArgs(object exception, bool isTerminating)
+ {
+ this.exception = exception;
+ this.m_isTerminating = isTerminating;
+ }
+
+ public object ExceptionObject
+ {
+ get
+ {
+ return exception;
+ }
+ }
+
+ public bool IsTerminating
+ {
+ get
+ {
+ return m_isTerminating;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/UnhandledExceptionEventHandler.cs b/mcs/class/corlib/System/UnhandledExceptionEventHandler.cs
new file mode 100755
index 00000000000..710af2b4713
--- /dev/null
+++ b/mcs/class/corlib/System/UnhandledExceptionEventHandler.cs
@@ -0,0 +1,10 @@
+// System.UnhandledExceptionEventHandler.cs
+//
+// Paolo Molaro
+//
+// (C) 2002 Ximian, Inc.
+
+namespace System
+{
+ public delegate void UnhandledExceptionEventHandler (object sender, UnhandledExceptionEventArgs args);
+}
diff --git a/mcs/class/corlib/System/ValueType.cs b/mcs/class/corlib/System/ValueType.cs
new file mode 100644
index 00000000000..733491f38b0
--- /dev/null
+++ b/mcs/class/corlib/System/ValueType.cs
@@ -0,0 +1,48 @@
+//
+// System.ValueType.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Runtime.CompilerServices;
+
+namespace System {
+
+ [Serializable]
+ public abstract class ValueType {
+
+ // <summary>
+ // ValueType constructor
+ // </summary>
+ protected ValueType ()
+ {
+ }
+
+ // <summary>
+ // True if this instance and o represent the same type
+ // and have the same value.
+ // </summary>
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override bool Equals (object o);
+
+ // <summary>
+ // Gets a hashcode for this value type using the
+ // bits in the structure
+ // </summary>
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override int GetHashCode ();
+
+ // <summary>
+ // Stringified representation of this ValueType.
+ // Must be overriden for better results, by default
+ // it just returns the Type name.
+ // </summary>
+ public override string ToString ()
+ {
+ return GetType().FullName;
+ }
+ }
+}
diff --git a/mcs/class/corlib/System/Version.cs b/mcs/class/corlib/System/Version.cs
new file mode 100644
index 00000000000..616e7d5d030
--- /dev/null
+++ b/mcs/class/corlib/System/Version.cs
@@ -0,0 +1,277 @@
+//
+// System.Version.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System.Globalization;
+
+namespace System {
+
+ [Serializable]
+ public sealed class Version : ICloneable, IComparable {
+
+ int major, minor, build, revision;
+
+ private const int UNDEFINED = -1;
+
+ private void CheckedSet (int defined, int major, int minor, int build, int revision)
+ {
+ // defined should be 2, 3 or 4
+
+ if (major < 0) {
+ throw new ArgumentOutOfRangeException ("major");
+ }
+ this.major = major;
+
+ if (minor < 0) {
+ throw new ArgumentOutOfRangeException ("minor");
+ }
+ this.minor = minor;
+
+ if (defined == 2) {
+ this.build = UNDEFINED;
+ this.revision = UNDEFINED;
+ return;
+ }
+
+ if (build < 0) {
+ throw new ArgumentOutOfRangeException ("build");
+ }
+ this.build = build;
+
+ if (defined == 3) {
+ this.revision = UNDEFINED;
+ return;
+ }
+
+ if (revision < 0) {
+ throw new ArgumentOutOfRangeException ("revision");
+ }
+ this.revision = revision;
+ }
+
+ public Version ()
+ {
+ CheckedSet (2, 0, 0, -1, -1);
+ }
+
+ public Version (string version)
+ {
+ int n;
+ string [] vals;
+ int major = -1, minor = -1, build = -1, revision = -1;
+
+ if (version == null) {
+ throw new ArgumentNullException ("version");
+ }
+
+ vals = version.Split (new Char [] {'.'});
+ n = vals.Length;
+
+ if (n < 2 || n > 4) {
+ throw new ArgumentException (Locale.GetText ("There must be 2, 3 or 4 components in the version string"));
+ }
+
+ if (n > 0)
+ major = int.Parse (vals [0]);
+ if (n > 1)
+ minor = int.Parse (vals [1]);
+ if (n > 2)
+ build = int.Parse (vals [2]);
+ if (n > 3)
+ revision = int.Parse (vals [3]);
+
+ CheckedSet (n, major, minor, build, revision);
+ }
+
+ public Version (int major, int minor)
+ {
+ CheckedSet (2, major, minor, 0, 0);
+ }
+
+ public Version (int major, int minor, int build)
+ {
+ CheckedSet (3, major, minor, build, 0);
+ }
+
+ public Version (int major, int minor, int build, int revision)
+ {
+ CheckedSet (4, major, minor, build, revision);
+ }
+
+ public int Build {
+ get {
+ return build;
+ }
+ }
+
+ public int Major {
+ get {
+ return major;
+ }
+ }
+
+ public int Minor {
+ get {
+ return minor;
+ }
+ }
+
+ public int Revision {
+ get {
+ return revision;
+ }
+ }
+
+ public object Clone ()
+ {
+ return new Version (major, minor, build, revision);
+ }
+
+ public int CompareTo (object version)
+ {
+ Version v;
+
+ // LAMESPEC: Docs are unclear whether an
+ // ArgumentNullException should be thrown are
+ // that a value > 0 should be returned.
+ if (version == null)
+ return 1;
+ // throw new ArgumentNullException ("version");
+
+ if (! (version is Version))
+ throw new ArgumentException (Locale.GetText ("Argument to Version.CompareTo must be a Version"));
+
+ v = version as Version;
+
+ if (this.major > v.major)
+ return 1;
+ else if (this.major < v.major)
+ return -1;
+
+ if (this.minor > v.minor)
+ return 1;
+ else if (this.minor < v.minor)
+ return -1;
+
+ if (this.build > v.build)
+ return 1;
+ else if (this.build < v.build)
+ return -1;
+
+ if (this.revision > v.revision)
+ return 1;
+ else if (this.revision < v.revision)
+ return -1;
+
+ return 0;
+ }
+
+ public override bool Equals (object obj)
+ {
+ Version x;
+
+ if (obj == null || !(obj is Version))
+ return false;
+
+ x = (Version) obj;
+
+ if ((x.major == major) &&
+ (x.minor == minor) &&
+ (x.build == build) &&
+ (x.revision == revision))
+ return true;
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return (revision << 24) | (build << 16) | (minor << 8) | major;
+ }
+
+ // <summary>
+ // Returns a stringified representation of the version, format:
+ // major.minor[.build[.revision]]
+ // </summary>
+ public override string ToString ()
+ {
+ string mm = major.ToString () + "." + minor.ToString ();
+
+ if (build != UNDEFINED)
+ mm = mm + "." + build.ToString ();
+ if (revision != UNDEFINED)
+ mm = mm + "." + revision.ToString ();
+
+ return mm;
+ }
+
+ // <summary>
+ // LAME: This API is lame, since there is no way of knowing
+ // how many fields a Version object has, it is unfair to throw
+ // an ArgumentException, but this is what the spec claims.
+ //
+ // ie, Version a = new Version (1, 2); a.ToString (3) should
+ // throw the expcetion.
+ // </summary>
+ public string ToString (int fields)
+ {
+ if (fields == 0)
+ return "";
+ if (fields == 1)
+ return major.ToString ();
+ if (fields == 2)
+ return major.ToString () + "." + minor.ToString ();
+ if (fields == 3){
+ if (build == UNDEFINED)
+ throw new ArgumentException (Locale.GetText ("fields is larger than the number of components defined in this instance"));
+ return major.ToString () + "." + minor.ToString () + "." +
+ build.ToString ();
+ }
+ if (fields == 4){
+ if (build == UNDEFINED || revision == UNDEFINED)
+ throw new ArgumentException (Locale.GetText ("fields is larger than the number of components defined in this instance"));
+ return major.ToString () + "." + minor.ToString () + "." +
+ build.ToString () + "." + revision.ToString ();
+ }
+ throw new ArgumentException (Locale.GetText ("Invalid fields parameter: ") + fields.ToString());
+ }
+
+ public static bool operator== (Version v1, Version v2)
+ {
+ return v1.Equals (v2);
+ }
+
+ public static bool operator!= (Version v1, Version v2)
+ {
+ return !v1.Equals (v2);
+ }
+
+ public static bool operator> (Version v1, Version v2)
+ {
+ return v1.CompareTo (v2) > 0;
+ }
+
+ public static bool operator>= (Version v1, Version v2)
+ {
+ return v1.CompareTo (v2) >= 0;
+ }
+
+ public static bool operator< (Version v1, Version v2)
+ {
+ return v1.CompareTo (v2) < 0;
+ }
+
+ public static bool operator<= (Version v1, Version v2)
+ {
+ return v1.CompareTo (v2) <= 0;
+ }
+
+ }
+}
+
+
+
diff --git a/mcs/class/corlib/System/Void.cs b/mcs/class/corlib/System/Void.cs
new file mode 100644
index 00000000000..768d75e7141
--- /dev/null
+++ b/mcs/class/corlib/System/Void.cs
@@ -0,0 +1,15 @@
+//
+// System.Void.cs
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+namespace System {
+
+ [Serializable]
+ public struct Void {
+ }
+}
diff --git a/mcs/class/corlib/System/WeakReference.cs b/mcs/class/corlib/System/WeakReference.cs
new file mode 100755
index 00000000000..12541ac7c6f
--- /dev/null
+++ b/mcs/class/corlib/System/WeakReference.cs
@@ -0,0 +1,119 @@
+//
+// System.WeakReference.cs
+//
+// Author:
+// Ajay kumar Dwivedi (adwiv@yahoo.com)
+//
+
+using System.Runtime.Serialization;
+using System.Runtime.InteropServices;
+
+namespace System
+{
+ /// <summary>
+ /// Summary description for WeakReference.
+ /// </summary>
+ [Serializable]
+ public class WeakReference : ISerializable
+ {
+ //Fields
+ private bool isLongReference;
+ private GCHandle gcHandle;
+
+ // Helper method for constructors
+ //Should not be called from any other method.
+ private void AllocateHandle(Object target)
+ {
+ if(this.isLongReference)
+ {
+ this.gcHandle = GCHandle.Alloc(target, GCHandleType.WeakTrackResurrection);
+ }
+ else
+ {
+ this.gcHandle = GCHandle.Alloc(target, GCHandleType.Weak);
+ }
+ }
+
+
+ //Constructors
+ public WeakReference(object target)
+ : this(target,false)
+ {}
+
+
+ public WeakReference(object target, bool trackResurrection)
+ {
+ this.isLongReference = trackResurrection;
+ AllocateHandle(target);
+ }
+
+
+ protected WeakReference(SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ throw new ArgumentNullException ("info");
+
+ this.isLongReference = info.GetBoolean("IsLongReference");
+ //TODO: How to load the exact type?
+ //Does that matter? No idea :(
+ Object target = info.GetValue("TargetObject",typeof(System.Object));
+
+ AllocateHandle(target);
+ }
+
+
+ // Properties
+ public virtual bool IsAlive
+ {
+ get
+ {
+ //Target property takes care of the exception
+ return (Target != null);
+ }
+ }
+
+ public virtual object Target
+ {
+ get
+ {
+ //Exception is thrown by gcHandle's Target
+ return this.gcHandle.Target;
+ }
+ set
+ {
+ this.gcHandle.Target = value;
+ }
+ }
+
+ public virtual bool TrackResurrection
+ {
+ get
+ {
+ return this.isLongReference;
+ }
+ }
+
+ //Methods
+ ~WeakReference()
+ {
+ gcHandle.Free();
+ }
+
+ //TODO
+ public virtual void GetObjectData(SerializationInfo info,StreamingContext context)
+ {
+ if (info == null)
+ throw new ArgumentNullException ("info");
+
+ info.AddValue("IsLongReference",this.isLongReference);
+ try
+ {
+ info.AddValue("TargetObject",Target);
+ }
+ catch(Exception)
+ {
+ info.AddValue("TargetObject",null);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/class/corlib/System/_AppDomain.cs b/mcs/class/corlib/System/_AppDomain.cs
new file mode 100755
index 00000000000..08ef787b2ea
--- /dev/null
+++ b/mcs/class/corlib/System/_AppDomain.cs
@@ -0,0 +1,161 @@
+//
+// System._AppDomain
+//
+// Author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+
+using System.Security;
+using System.Security.Policy;
+using System.Security.Principal;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Globalization;
+using System.Runtime.Remoting;
+
+namespace System
+{
+
+[CLSCompliant(false)]
+public interface _AppDomain {
+
+ string BaseDirectory {get; }
+ string DynamicDirectory {get; }
+ Evidence Evidence {get; }
+ string FriendlyName {get; }
+ string RelativeSearchPath {get; }
+ bool ShadowCopyFiles {get; }
+
+ void AppendPrivatePath (string path);
+ void ClearPrivatePath ();
+ void ClearShadowCopyPath ();
+
+ ObjectHandle CreateInstance (string assemblyName, string typeName);
+ ObjectHandle CreateInstance (
+ string assemblyName,
+ string typeName,
+ object[] activationAttributes);
+ ObjectHandle CreateInstance (
+ string assemblyName,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object[] args,
+ CultureInfo culture,
+ object[] activationAttributes,
+ Evidence securityAttribtutes);
+
+ ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName);
+ ObjectHandle CreateInstanceFrom (
+ string assemblyName, string typeName,
+ object[] activationAttributes);
+ ObjectHandle CreateInstanceFrom (string assemblyName,
+ string typeName,
+ bool ignoreCase,
+ BindingFlags bindingAttr,
+ Binder binder,
+ object[] args,
+ CultureInfo culture,
+ object[] activationAttributes,
+ Evidence securityAttribtutes);
+
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ Evidence evidence);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access, string dir);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions);
+ AssemblyBuilder DefineDynamicAssembly (
+ AssemblyName name,
+ AssemblyBuilderAccess access,
+ string dir,
+ Evidence evidence,
+ PermissionSet requiredPermissions,
+ PermissionSet optionalPermissions,
+ PermissionSet refusedPersmissions,
+ bool isSynchronized);
+
+ void DoCallBack (CrossAppDomainDelegate theDelegate);
+ bool Equals (object other);
+
+ int ExecuteAssembly (string assemblyFile);
+ int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity);
+ int ExecuteAssembly (
+ string assemblyFile,
+ Evidence assemblySecurity,
+ string[] args);
+
+ Assembly[] GetAssemblies ();
+ object GetData (string name);
+ int GetHashCode();
+ object GetLifetimeService ();
+ Type GetType ();
+ object InitializeLifetimeService ();
+
+ Assembly Load (AssemblyName assemblyRef);
+ Assembly Load (byte[] rawAssembly);
+ Assembly Load (string assemblyString);
+ Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity);
+ Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore);
+ Assembly Load (string assemblyString, Evidence assemblySecurity);
+ Assembly Load (
+ byte[] rawAssembly,
+ byte[] rawSymbolStore,
+ Evidence securityEvidence);
+
+ void SetAppDomainPolicy (PolicyLevel domainPolicy);
+ void SetCachePath (string s);
+ void SetData (string name, object data);
+ void SetPrincipalPolicy (PrincipalPolicy policy);
+ void SetShadowCopyPath (string s);
+ void SetThreadPrincipal (IPrincipal principal);
+ //string ToString ();
+
+ event AssemblyLoadEventHandler AssemblyLoad;
+ event ResolveEventHandler AssemblyResolve;
+ event EventHandler DomainUnload;
+ event EventHandler ProcessExit;
+ event ResolveEventHandler ResourceResolve;
+ event ResolveEventHandler TypeResolve;
+ event UnhandledExceptionEventHandler UnhandledException;
+}
+
+}
diff --git a/mcs/class/corlib/Test/.cvsignore b/mcs/class/corlib/Test/.cvsignore
new file mode 100644
index 00000000000..335c71fd7fa
--- /dev/null
+++ b/mcs/class/corlib/Test/.cvsignore
@@ -0,0 +1,2 @@
+*.dll
+*.pdb
diff --git a/mcs/class/corlib/Test/AllTests.cs b/mcs/class/corlib/Test/AllTests.cs
new file mode 100644
index 00000000000..a5c11a2f96c
--- /dev/null
+++ b/mcs/class/corlib/Test/AllTests.cs
@@ -0,0 +1,38 @@
+//
+// Mono.Tests.AllTests.cs
+//
+// Author:
+// Alexander Klyubin (klyubin@aqris.com)
+//
+// (C) 2001
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(System.AllTests.Suite);
+ suite.AddTest(System.Collections.AllTests.Suite);
+ suite.AddTest(System.Security.Cryptography.AllTests.Suite);
+ suite.AddTest(System.IO.AllTests.Suite);
+ suite.AddTest(System.Net.AllTests.Suite);
+ suite.AddTest(System.Text.AllTests.Suite);
+ suite.AddTest(System.Security.Permissions.AllTests.Suite);
+ suite.AddTest(System.Resources.AllTests.Suite);
+// suite.AddTest(System.Security.Policy.AllTests.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/ChangeLog b/mcs/class/corlib/Test/ChangeLog
new file mode 100644
index 00000000000..8d52a940566
--- /dev/null
+++ b/mcs/class/corlib/Test/ChangeLog
@@ -0,0 +1,185 @@
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * System.Net/: added directory.
+ * AllTests.cs: added System.Net suite.
+
+2002/04/04 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Again; disable running of NUnit tests against mono
+ corlib. There are so many icalls now, that these tests need
+ to be run inside mint and mono. Will change this soon to run
+ the tests using both. It still runs the tests against the mscorlib
+ to validate the tests themselves.
+
+2002-03-31 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * corlib_test.build: don't exclude IntegerFormatterTest.
+
+ * System/AllTests.cs: added IntegerFormatterTest suite.
+
+ * System/IntegerFormatterTest.cs: totally reworked to use NUnit. Right
+ now it fails cause I haven't implemented Parse () methods yet. With
+ corlib_reference.dll runs ok.
+
+2002/03/28 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Re-exclude it in a couple of places where it was
+ breaking the build. This test is not an NUnit test. So, it doesn't
+ belong in these dll's until it's made a proper NUnit test.
+
+2002-03-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * corlib_test.build: remove two more lines that excluded
+ IntegerFormatterTest.
+
+2002/03/28 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Don't exclude IntegerFormatterTest any more.
+
+2002-03-20 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: On 'clean' remove all the dll's and pdb's
+
+2002/03/19 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Re-include tests into the build.
+
+2002-03-18 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: build RunTests.corlib.exe with only mono class
+ libs. This tells what we are missing to run the tests.
+
+2002/03/18 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: disable running of NUnit tests against mono
+ corlib. There are so many icalls now, that these tests need
+ to be run inside mint and mono. Will change this soon to run
+ the tests using both. It still runs the tests against the mscorlib
+ to validate the tests themselves.
+
+2002/03/07 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: resolve chicken and egg problem. Only build and
+ execute test assemblies when 'make test' is specified. Need to do a
+ 'make' first now before 'make test'.
+
+2002-03-03 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Turn on debug flag for complier so that...well...
+ debugging is easier.
+
+2002-03-01 Duncan Mak <duncan@ximian.com>
+
+ * System.Runtime.Serialization/ObjectIDGeneratorTests.cs: Added
+ test for System.Runtime.Serialization.ObjectIDGenerator.
+
+2002-02-27 Martin Baulig <martin@gnome.org>
+
+ * RunTests.cs: Removed. This is now in the nant directory.
+
+ * corlib_test.build: Don't link TheTests.cs into the dlls, renamed
+ RunTests.exe to RunTests.corlib.exe and link it against NUnitBase.dll.
+
+2002-02-27 Martin Baulig <martin@gnome.org>
+
+ * scan-tests.pl: Moved to ../../../tools/.
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * MartinTests.cs: New file. This contains all the tests which already
+ work on Linux.
+
+ * RunTests.cs: A small custom testrunner to run the tests on Linux.
+
+ * scan-tests.pl: Call this perl script with either MartinTests.cs or
+ AllTests.cs as argument and redirect the output the TheTests.cs - it'll
+ create a file which calls all the tests.
+
+ * TheTests.cs: This is automatically generated from scan-tests.pl but
+ needs some manual editing, so it's in CVS.
+
+ * corlib_test.build: In addition to the libraries, create an executable
+ called RunTests.exe which contains all the tests and the custom test
+ runner. You can run this executable on Windows to test things with
+ mscorlib or on Linux using the mono runtime.
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * */*.cs: added zero-args constructors for all the test classes.
+
+2002-02-21 Mark Crichton <crichton@gimp.org>
+
+ * System.Security.Cryptography.RNGCryptoServiceProviderTest.cs:
+ Fixed typo
+
+2002-02-21 Mark Crichton <crichton@gimp.org>
+
+ * Addded System.Security.Cryptography.RNGCryptoServiceProviderTest.cs
+ * System.Security.Cryptography/AllTests.cs: Added
+ RNGCryptoServiceProviderTest.
+
+2002-02-17 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Added System/GuidTest.cs
+
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Remove duplicate excludes for
+ * AllTests.cs: Add System.Security.Policy tests. However, commented
+ this out because NUnit is throwing an exception. Need to figure
+ that out first.
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: compile with mscorlib to test the tests. This
+ will be our "reference" check to make sure the tests work.
+
+2002-01-25 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Add System.Resources.AllTests.Suite
+
+2002-01-14 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Add System.Security.Permissions.AllTests.Suite
+
+2002-01-05 Nick Drochak <ndrochak@gol.com>
+
+ * .cvsignore: ignore the debug files *.pdb
+
+2002-01-04 Duco Fijma <duco@lorentz.xs4all.nl>
+ * Added System/TimeSpanTest.cs
+
+2002-01-04 John R. Hicks <angryjohn69@nc.rr.com>
+ * Added DebugTest to System.Diagnostics tests.
+2001-11-08 Nick Drochak <ndrochak@gol.com>
+
+ * corlib_test.build: Include test for Queue in the dll
+
+2001-10-15 Martin Weindel <martin.weindel@t-online.de>
+
+ * added System/DecimalTest.cs and System/DecimalTest2.cs
+
+2001-10-11 Jeffrey Stedfast <fejj@ximian.com>
+
+ * System/StringTest.cs: Added.
+
+2001-10-10 Thomas Neidhart <tome@sbox.tugraz.at>
+
+ * added directory System.Security.Cryptography
+ * added TestSuite for all Crypto classes
+ * added tests for System.Security.Cryptography.AsymmetricAlgorithm
+ and System.Security.Cryptography.SymmetricAlgorithm
+
+2001-10-02 Martin Weindel <martin.weindel@t-online.de>
+
+ * added directory System
+ * added tests for System.Int64
+
+2001-08-29 Alexander Klyubin <klyubin@aqris.com>
+
+ * Added tests for System.Diagnostics.StackFrame and
+ System.Diagnostics.StackTrace. The tests only run against
+ Microsoft's implementation as StackTrace and StackFrame classes in
+ Mono are not yet properly implemented.
+
+ Note that StackFrameTest runs properly only if compiled with
+ /debug switch.
diff --git a/mcs/class/corlib/Test/MartinTests.cs b/mcs/class/corlib/Test/MartinTests.cs
new file mode 100755
index 00000000000..803abe4043d
--- /dev/null
+++ b/mcs/class/corlib/Test/MartinTests.cs
@@ -0,0 +1,30 @@
+//
+// Mono.Tests.MartinTests.cs
+//
+// Author:
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2002 Martin Baulig
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class MartinTests : TestCase {
+ public MartinTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(System.MartinTests.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Collections/AllTests.cs b/mcs/class/corlib/Test/System.Collections/AllTests.cs
new file mode 100644
index 00000000000..fbad2eead56
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/AllTests.cs
@@ -0,0 +1,37 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(HashtableTest.Suite);
+ suite.AddTest(CaseInsensitiveComparerTest.Suite);
+ suite.AddTest(CaseInsensitiveHashCodeProviderTest.Suite);
+ suite.AddTest(ArrayListTest.Suite);
+ suite.AddTest(BitArrayTest.Suite);
+ suite.AddTest(CollectionBaseTest.Suite);
+ suite.AddTest(ReadOnlyCollectionBaseTest.Suite);
+ suite.AddTest(ComparerTest.Suite);
+ suite.AddTest(StackTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Collections/ArrayListTest.cs b/mcs/class/corlib/Test/System.Collections/ArrayListTest.cs
new file mode 100644
index 00000000000..816b89712ef
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/ArrayListTest.cs
@@ -0,0 +1,1376 @@
+// ArrayListTest.cs - NUnit Test Cases for the System.Collections.ArrayList class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace MonoTests.System.Collections {
+
+
+/// <summary>ArrayList test.</summary>
+public class ArrayListTest : TestCase {
+ public ArrayListTest() : base ("MonoTests.System.ArrayListTest testsuite") {}
+ public ArrayListTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(ArrayListTest));
+ }
+ }
+
+ public void TestCtor() {
+ {
+ ArrayList al1 = new ArrayList();
+ AssertNotNull("no basic ArrayList", al1);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null icollection error not thrown",
+ errorThrown);
+ }
+ {
+ // what can I say? I like chars. [--DB]
+ char[] coll = {'a', 'b', 'c', 'd'};
+ ArrayList al1 = new ArrayList(coll);
+ AssertNotNull("no icollection ArrayList", al1);
+ for (int i = 0; i < coll.Length; i++) {
+ AssertEquals(i + " not ctor'ed properly.",
+ coll[i], al1[i]);
+ }
+ }
+ // TODO - multi-dim ICollection ctor?
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative capacity error not thrown",
+ errorThrown);
+ }
+ }
+
+ public void TestCapacity() {
+ for (int i = 0; i < 100; i++) {
+ ArrayList al1 = new ArrayList(i);
+ AssertEquals("Bad capacity of " + i,
+ i, al1.Capacity);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ AssertEquals("Bad default capacity",
+ 16, al1.Capacity);
+ }
+ }
+
+ public void TestCount() {
+ {
+ ArrayList al1 = new ArrayList();
+ AssertEquals("Bad initial count",
+ 0, al1.Count);
+ for (int i = 1; i <= 100; i++) {
+ al1.Add(i);
+ AssertEquals("Bad count " + i,
+ i, al1.Count);
+ }
+ }
+ for (int i = 0; i < 100; i++) {
+ char[] coll = new Char[i];
+ ArrayList al1 = new ArrayList(coll);
+ AssertEquals("Bad count for " + i,
+ i, al1.Count);
+ }
+ }
+
+ public void TestIsFixed() {
+ ArrayList al1 = new ArrayList();
+ Assert("should not be fixed by default", !al1.IsFixedSize);
+ ArrayList al2 = ArrayList.FixedSize(al1);
+ Assert("fixed-size wrapper not working", al2.IsFixedSize);
+ }
+
+ public void TestIsReadOnly() {
+ ArrayList al1 = new ArrayList();
+ Assert("should not be ReadOnly by default", !al1.IsReadOnly);
+ ArrayList al2 = ArrayList.ReadOnly(al1);
+ Assert("read-only wrapper not working", al2.IsReadOnly);
+ }
+
+ public void TestIsSynchronized() {
+ ArrayList al1 = new ArrayList();
+ Assert("should not be synchronized by default",
+ !al1.IsSynchronized);
+ ArrayList al2 = ArrayList.Synchronized(al1);
+ Assert("synchronized wrapper not working", al2.IsSynchronized);
+ }
+
+ public void TestItem() {
+ ArrayList al1 = new ArrayList();
+ {
+ bool errorThrown = false;
+ try {
+ object o = al1[-1];
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative item error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ object o = al1[1];
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("past-end item error not thrown",
+ errorThrown);
+ }
+ for (int i = 0; i <= 100; i++) {
+ al1.Add(i);
+ }
+ for (int i = 0; i <= 100; i++) {
+ AssertEquals("item not fetched for " + i,
+ i, al1[i]);
+ }
+ }
+
+ public void TestAdapter() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = ArrayList.Adapter(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null adapter error not thrown",
+ errorThrown);
+ }
+ {
+ char[] list = {'a', 'b', 'c', 'd'};
+ ArrayList al1 = ArrayList.Adapter(list);
+ AssertNotNull("Couldn't get an adapter", al1);
+ for (int i = 0; i < list.Length; i++) {
+ AssertEquals("adapter not adapting", list[i], al1[i]);
+ }
+ list[0] = 'z';
+ for (int i = 0; i < list.Length; i++) {
+ AssertEquals("adapter not adapting", list[i], al1[i]);
+ }
+ }
+ // TODO - test other adapter types?
+ }
+
+ public void TestAdd() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList());
+ al1.Add("Hi!");
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("add to fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.Add("Hi!");
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("add to read only error not thrown",
+ errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ for (int i = 1; i <= 100; i++) {
+ al1.Add(i);
+ AssertEquals("add failed " + i,
+ i, al1.Count);
+ AssertEquals("add failed " + i,
+ i, al1[i-1]);
+
+ }
+ }
+ }
+
+ public void TestAddRange() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList());
+ String[] s1 = {"Hi!"};
+ al1.AddRange(s1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("add to fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ String[] s1 = {"Hi!"};
+ al1.AddRange(s1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("add to read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList();
+ al1.AddRange(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("add to read only error not thrown",
+ errorThrown);
+ }
+
+ {
+ ArrayList a1 = new ArrayList();
+ AssertEquals("ArrayList should start empty",
+ 0, a1.Count);
+ char[] coll = {'a', 'b', 'c'};
+ a1.AddRange(coll);
+ AssertEquals("ArrayList has wrong elements",
+ 3, a1.Count);
+ a1.AddRange(coll);
+ AssertEquals("ArrayList has wrong elements",
+ 6, a1.Count);
+ }
+ }
+
+ public void TestBinarySearch() {
+ //{
+ //bool errorThrown = false;
+ //try {
+ // ArrayList al1 = new ArrayList();
+ // String[] s1 = {"This", "is", "a", "test"};
+ // al1.AddRange(s1);
+ // al1.BinarySearch(42);
+ //} catch (ArgumentException) {
+ // errorThrown = true;
+ //}
+ //Assert("search-for-wrong-type error not thrown",
+ // errorThrown);
+ //}
+
+ {
+ char[] bad = {'d', 'a', 'd', 'a', 'c', 'a'};
+ ArrayList al1 = new ArrayList(bad);
+ AssertEquals("shouldn't find elem in badly-sorted array", -1, al1.BinarySearch('c'));
+ }
+ {
+ char[] bad = {'a', 'd', 'a', 'd', 'a', 'c', 'a'};
+ ArrayList al1 = new ArrayList(bad);
+ AssertEquals("shouldn't find elem in badly-sorted array", -2, al1.BinarySearch('c'));
+ }
+ {
+ char[] arr = {'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ ArrayList al1 = new ArrayList(arr);
+ Assert("couldn't find elem",
+ al1.BinarySearch('c') >= 3);
+ Assert("couldn't find elem",
+ al1.BinarySearch('c') < 6);
+ }
+ {
+ char[] arr = {'a', 'b', 'b', 'd', 'd', 'd', 'e', 'e'};
+ ArrayList al1 = new ArrayList(arr);
+ AssertEquals("couldn't find next-higher elem",
+ -4, al1.BinarySearch('c'));
+ }
+ {
+ char[] arr = {'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ ArrayList al1 = new ArrayList(arr);
+ AssertEquals("couldn't find end",
+ -9, al1.BinarySearch('e'));
+ }
+
+ }
+
+ // TODO - BinarySearch with IComparer
+
+ public void TestClear() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList());
+ al1.Clear();
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("add to fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.Clear();
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("add to read only error not thrown",
+ errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ al1.Add('c');
+ AssertEquals("should have one element",
+ 1, al1.Count);
+ al1.Clear();
+ AssertEquals("should be empty",
+ 0, al1.Count);
+ }
+ {
+ int[] i1 = {1,2,3,4};
+ ArrayList al1 = new ArrayList(i1);
+ AssertEquals("should have elements",
+ i1.Length, al1.Count);
+ al1.Clear();
+ AssertEquals("should be empty again",
+ 0, al1.Count);
+ }
+ }
+
+ public void TestClone() {
+ {
+ char[] c1 = {'a', 'b', 'c'};
+ ArrayList al1 = new ArrayList(c1);
+ ArrayList al2 = (ArrayList)al1.Clone();
+ AssertEquals("ArrayList match", al1[0], al2[0]);
+ AssertEquals("ArrayList match", al1[1], al2[1]);
+ AssertEquals("ArrayList match", al1[2], al2[2]);
+ }
+ {
+ char[] d10 = {'a', 'b'};
+ char[] d11 = {'a', 'c'};
+ char[] d12 = {'b', 'c'};
+ char[][] d1 = {d10, d11, d12};
+ ArrayList al1 = new ArrayList(d1);
+ ArrayList al2 = (ArrayList)al1.Clone();
+ AssertEquals("Array match", al1[0], al2[0]);
+ AssertEquals("Array match", al1[1], al2[1]);
+ AssertEquals("Array match", al1[2], al2[2]);
+
+ ((char[])al1[0])[0] = 'z';
+ AssertEquals("shallow copy", al1[0], al2[0]);
+ }
+ }
+
+ public void TestContains() {
+ char[] c1 = {'a', 'b', 'c'};
+ ArrayList al1 = new ArrayList(c1);
+ Assert("never find a null", !al1.Contains(null));
+ Assert("can't find value", al1.Contains('b'));
+ Assert("shouldn't find value", !al1.Contains('?'));
+ }
+
+ public void TestCopyTo() {
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ ArrayList al1 = new ArrayList(c1);
+ al1.CopyTo(null, 2);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ ArrayList al1 = new ArrayList(c1);
+ Char[,] c2 = new Char[2,2];
+ al1.CopyTo(c2, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[,] c1 = new Char[2,2];
+ ArrayList al1 = new ArrayList(c1);
+ Char[] c2 = new Char[2];
+ al1.CopyTo(c2, 2);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ ArrayList al1 = new ArrayList(c1);
+ Char[] c2 = new Char[2];
+ al1.CopyTo(c2, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ ArrayList al1 = new ArrayList(c1);
+ Char[] c2 = new Char[2];
+ al1.CopyTo(c2, 3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ ArrayList al1 = new ArrayList(c1);
+ Char[] c2 = new Char[2];
+ al1.CopyTo(c2, 1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String[] c1 = new String[2];
+ ArrayList al1 = new ArrayList(c1);
+ Char[] c2 = new Char[2];
+ al1.CopyTo(c2, 0);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ }
+
+ Char[] orig = {'a', 'b', 'c', 'd'};
+ ArrayList al = new ArrayList(orig);
+ Char[] copy = new Char[10];
+ Array.Clear(copy, 0, copy.Length);
+ al.CopyTo(copy, 3);
+ AssertEquals("Wrong CopyTo 0", (char)0, copy[0]);
+ AssertEquals("Wrong CopyTo 1", (char)0, copy[1]);
+ AssertEquals("Wrong CopyTo 2", (char)0, copy[2]);
+ AssertEquals("Wrong CopyTo 3", orig[0], copy[3]);
+ AssertEquals("Wrong CopyTo 4", orig[1], copy[4]);
+ AssertEquals("Wrong CopyTo 5", orig[2], copy[5]);
+ AssertEquals("Wrong CopyTo 6", orig[3], copy[6]);
+ AssertEquals("Wrong CopyTo 7", (char)0, copy[7]);
+ AssertEquals("Wrong CopyTo 8", (char)0, copy[8]);
+ AssertEquals("Wrong CopyTo 9", (char)0, copy[9]);
+ }
+
+ public void TestFixedSize() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = ArrayList.FixedSize(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null arg error not thrown", errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ AssertEquals("arrays start un-fixed.",
+ false, al1.IsFixedSize);
+ ArrayList al2 = ArrayList.FixedSize(al1);
+ AssertEquals("should be fixed.",
+ true, al2.IsFixedSize);
+ }
+ }
+
+ public void TestGetEnumerator() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ IEnumerator en = a.GetEnumerator(-1,1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ IEnumerator en = a.GetEnumerator(1,-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ IEnumerator en = a.GetEnumerator(1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("out-of-range index error not thrown",
+ errorThrown);
+ }
+ {
+ String[] s1 = {"this", "is", "a", "test"};
+ ArrayList al1 = new ArrayList(s1);
+ IEnumerator en = al1.GetEnumerator();
+ AssertNotNull("No enumerator", en);
+
+ for (int i = 0; i < s1.Length; i++) {
+ en.MoveNext();
+ AssertEquals("Not enumerating",
+ al1[i], en.Current);
+ }
+ }
+ {
+ String[] s1 = {"this", "is", "a", "test"};
+ ArrayList al1 = new ArrayList(s1);
+ IEnumerator en = al1.GetEnumerator(1,2);
+ AssertNotNull("No enumerator", en);
+
+ for (int i = 0; i < 2; i++) {
+ en.MoveNext();
+ AssertEquals("Not enumerating",
+ al1[i+1], en.Current);
+ }
+ }
+ }
+
+ public void TestGetRange() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ ArrayList b = a.GetRange(-1,1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ ArrayList b = a.GetRange(1,-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList();
+ ArrayList b = a.GetRange(1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("out-of-range index error not thrown",
+ errorThrown);
+ }
+ {
+ char[] chars = {'a', 'b', 'c', 'd', 'e', 'f'};
+ ArrayList a = new ArrayList(chars);
+ ArrayList b = a.GetRange(1, 3);
+ AssertEquals("GetRange returned wrong size ArrayList", 3, b.Count);
+ for (int i = 0; i < b.Count; i++) {
+ AssertEquals("range didn't work",
+ chars[i+1], b[i]);
+ }
+
+ a[2] = '?'; // should screw up ArrayList b.
+ bool errorThrown = false;
+ try {
+ int i = b.Count;
+ } catch (InvalidOperationException) {
+ errorThrown = true;
+ }
+ AssertEquals("Munging 'a' should mess up 'b'",
+ true, errorThrown);
+ }
+ }
+
+ public void TestIndexOf() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(1);
+ int i = a.IndexOf('a', -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative indexof error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(1);
+ int i = a.IndexOf('a', 2);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("past-end indexof error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(1);
+ int i = a.IndexOf('a', 0, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative indexof error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(1);
+ int i = a.IndexOf('a', 0, 2);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("past-end indexof error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(2);
+ int i = a.IndexOf('a', 1, 2);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("past-end indexof error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c = {'a', 'b', 'c', 'd', 'e'};
+ ArrayList a = new ArrayList(c);
+ AssertEquals("never find null",
+ -1, a.IndexOf(null));
+ AssertEquals("never find null",
+ -1, a.IndexOf(null, 0));
+ AssertEquals("never find null",
+ -1, a.IndexOf(null, 0, 5));
+ AssertEquals("can't find elem",
+ 2, a.IndexOf('c'));
+ AssertEquals("can't find elem",
+ 2, a.IndexOf('c', 2));
+ AssertEquals("can't find elem",
+ 2, a.IndexOf('c', 2, 2));
+ AssertEquals("shouldn't find elem",
+ -1, a.IndexOf('c', 3, 2));
+ AssertEquals("shouldn't find", -1, a.IndexOf('?'));
+ AssertEquals("shouldn't find", -1, a.IndexOf(3));
+ }
+ }
+
+ public void TestInsert() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList());
+ al1.Insert(0, "Hi!");
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("insert to fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.Insert(0, "Hi!");
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("insert to read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.Insert(-1, "Hi!");
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("insert to read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.Insert(4, "Hi!");
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("insert to read only error not thrown",
+ errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ AssertEquals("arraylist starts empty", 0, al1.Count);
+ al1.Insert(0, 'a');
+ al1.Insert(1, 'b');
+ al1.Insert(0, 'c');
+ AssertEquals("arraylist needs stuff", 3, al1.Count);
+ AssertEquals("arraylist got stuff", 'c', al1[0]);
+ AssertEquals("arraylist got stuff", 'a', al1[1]);
+ AssertEquals("arraylist got stuff", 'b', al1[2]);
+ }
+ }
+
+ public void TestInsertRange() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList());
+ string[] s = {"Hi!"};
+ al1.InsertRange(0, s);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("insert to fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ string[] s = {"Hi!"};
+ al1.InsertRange(0, s);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("insert to read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ string[] s = {"Hi!"};
+ al1.InsertRange(-1, s);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("negative index insert error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ string[] s = {"Hi!"};
+ al1.InsertRange(4, s);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out-of-range insert error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.InsertRange(0, null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null insert error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c = {'a', 'b', 'c'};
+ ArrayList a = new ArrayList(c);
+ a.InsertRange(1, c);
+ AssertEquals("bad insert", 'a', a[0]);
+ AssertEquals("bad insert", 'a', a[1]);
+ AssertEquals("bad insert", 'b', a[2]);
+ AssertEquals("bad insert", 'c', a[3]);
+ AssertEquals("bad insert", 'b', a[4]);
+ AssertEquals("bad insert", 'c', a[5]);
+ }
+ }
+
+ public void TestLastIndexOf() {
+ //{
+ //bool errorThrown = false;
+ //try {
+ //ArrayList a = new ArrayList(1);
+ //int i = a.LastIndexOf('a', -1);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("first negative lastindexof error not thrown",
+ //errorThrown);
+ //}
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList a = new ArrayList(1);
+ int i = a.LastIndexOf('a', 2);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("past-end lastindexof error not thrown",
+ errorThrown);
+ }
+ //{
+ //bool errorThrown = false;
+ //try {
+ //ArrayList a = new ArrayList(1);
+ //int i = a.LastIndexOf('a', 0, -1);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("second negative lastindexof error not thrown",
+ //errorThrown);
+ //}
+ //{
+ //bool errorThrown = false;
+ //try {
+ //ArrayList a = new ArrayList(1);
+ //int i = a.LastIndexOf('a', 0, 2);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("past-end lastindexof error not thrown",
+ //errorThrown);
+ //}
+ //{
+ //bool errorThrown = false;
+ //try {
+ //ArrayList a = new ArrayList(2);
+ //int i = a.LastIndexOf('a', 0, 2);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("past-end lastindexof error not thrown",
+ //errorThrown);
+ //}
+ {
+ char[] c = {'a', 'b', 'c', 'd', 'e'};
+ ArrayList a = new ArrayList(c);
+ AssertEquals("never find null",
+ -1, a.LastIndexOf(null));
+ AssertEquals("never find null",
+ -1, a.LastIndexOf(null, 4));
+ AssertEquals("never find null",
+ -1, a.LastIndexOf(null, 4, 5));
+ AssertEquals("can't find elem",
+ 2, a.LastIndexOf('c'));
+ AssertEquals("can't find elem",
+ 2, a.LastIndexOf('c', 4));
+ AssertEquals("can't find elem",
+ 2, a.LastIndexOf('c', 3, 2));
+ AssertEquals("shouldn't find elem",
+ -1, a.LastIndexOf('c', 4, 2));
+ AssertEquals("shouldn't find", -1, a.LastIndexOf('?'));
+ AssertEquals("shouldn't find", -1, a.LastIndexOf(1));
+ }
+ }
+
+ public void TestReadOnly() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = ArrayList.ReadOnly(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null arg error not thrown", errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ AssertEquals("arrays start writeable.",
+ false, al1.IsReadOnly);
+ ArrayList al2 = ArrayList.ReadOnly(al1);
+ AssertEquals("should be readonly.",
+ true, al2.IsReadOnly);
+ }
+ }
+
+ public void TestRemove() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList(3));
+ al1.Remove(1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("remove fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList(3));
+ al1.Remove(1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("remove read only error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c = {'a','b','c'};
+ ArrayList a = new ArrayList(c);
+ a.Remove(1);
+ a.Remove('?');
+ AssertEquals("should be unchanged", c.Length, a.Count);
+ a.Remove('a');
+ AssertEquals("should be changed", 2, a.Count);
+ AssertEquals("should have shifted", 'b', a[0]);
+ AssertEquals("should have shifted", 'c', a[1]);
+ }
+ }
+
+ public void TestRemoveAt() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList(3));
+ al1.RemoveAt(1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("remove from fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList(3));
+ al1.RemoveAt(1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("remove from read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.RemoveAt(-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("remove at negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.RemoveAt(4);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("remove at out-of-range index error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c = {'a','b','c'};
+ ArrayList a = new ArrayList(c);
+ a.RemoveAt(0);
+ AssertEquals("should be changed", 2, a.Count);
+ AssertEquals("should have shifted", 'b', a[0]);
+ AssertEquals("should have shifted", 'c', a[1]);
+ }
+ }
+
+ public void TestRemoveRange() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.FixedSize(new ArrayList(3));
+ al1.RemoveRange(0, 1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("removerange from fixed size error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList(3));
+ al1.RemoveRange(0, 1);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("removerange from read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.RemoveRange(-1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("removerange at negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.RemoveRange(0, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("removerange at negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.RemoveRange(2, 3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("removerange at bad range error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c = {'a','b','c'};
+ ArrayList a = new ArrayList(c);
+ a.RemoveRange(1,2);
+ AssertEquals("should be changed", 1, a.Count);
+ AssertEquals("should have shifted", 'a', a[0]);
+ }
+ }
+
+ public void TestRepeat() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = ArrayList.Repeat('c', -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("repeat negative copies error not thrown",
+ errorThrown);
+ }
+ {
+ ArrayList al1 = ArrayList.Repeat("huh?", 0);
+ AssertEquals("should be nothing in array",
+ 0, al1.Count);
+ }
+ {
+ ArrayList al1 = ArrayList.Repeat("huh?", 3);
+ AssertEquals("should be something in array",
+ 3, al1.Count);
+ AssertEquals("array elem doesn't check",
+ "huh?", al1[0]);
+ AssertEquals("array elem doesn't check",
+ "huh?", al1[1]);
+ AssertEquals("array elem doesn't check",
+ "huh?", al1[2]);
+ }
+ }
+
+ public void TestReverse() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.Reverse();
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("reverse on read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ ArrayList al1 = new ArrayList(c);
+ al1.Reverse(0, 3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ ArrayList al1 = new ArrayList(c);
+ al1.Reverse(3, 0);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ }
+ {
+ char[] c = {'a', 'b', 'c', 'd', 'e'};
+ ArrayList al1 = new ArrayList(c);
+ al1.Reverse(2,1);
+ for (int i = 0; i < al1.Count; i++) {
+ AssertEquals("Should be no change yet",
+ c[i], al1[i]);
+ }
+ al1.Reverse();
+ for (int i = 0; i < al1.Count; i++) {
+ AssertEquals("Should be reversed",
+ c[i], al1[4-i]);
+ }
+ al1.Reverse();
+ for (int i = 0; i < al1.Count; i++) {
+ AssertEquals("Should be back to normal",
+ c[i], al1[i]);
+ }
+ al1.Reverse(1,3);
+ AssertEquals("Should be back to normal", c[0], al1[0]);
+ AssertEquals("Should be back to normal", c[3], al1[1]);
+ AssertEquals("Should be back to normal", c[2], al1[2]);
+ AssertEquals("Should be back to normal", c[1], al1[3]);
+ AssertEquals("Should be back to normal", c[4], al1[4]);
+ }
+ }
+
+ public void TestSetRange() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList(3));
+ al1.SetRange(0, c);
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("setrange on read only error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.SetRange(0, null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("setrange with null error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ ArrayList al1 = new ArrayList(3);
+ al1.SetRange(-1, c);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("setrange with negative index error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ ArrayList al1 = new ArrayList(3);
+ al1.SetRange(2, c);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("setrange with too much error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c = {'a', 'b', 'c'};
+ ArrayList al1 = ArrayList.Repeat('?', 3);
+ Assert("no match yet", c[0] != (char)al1[0]);
+ Assert("no match yet", c[1] != (char)al1[1]);
+ Assert("no match yet", c[2] != (char)al1[2]);
+ al1.SetRange(0, c);
+ AssertEquals("should match", c[0], al1[0]);
+ AssertEquals("should match", c[1], al1[1]);
+ AssertEquals("should match", c[2], al1[2]);
+ }
+ }
+
+ public void TestSort() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.Sort();
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("sort on read only error not thrown",
+ errorThrown);
+ }
+ {
+ char[] starter = {'d', 'b', 'f', 'e', 'a', 'c'};
+ ArrayList al1 = new ArrayList(starter);
+ al1.Sort();
+ AssertEquals("Should be sorted", 'a', al1[0]);
+ AssertEquals("Should be sorted", 'b', al1[1]);
+ AssertEquals("Should be sorted", 'c', al1[2]);
+ AssertEquals("Should be sorted", 'd', al1[3]);
+ AssertEquals("Should be sorted", 'e', al1[4]);
+ AssertEquals("Should be sorted", 'f', al1[5]);
+ }
+ }
+
+ // TODO - Sort with IComparers
+
+ // TODO - Synchronize
+
+ public void TestToArray() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 = new ArrayList(3);
+ al1.ToArray(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("toarray with null error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ string s = "huh?";
+ ArrayList al1 = new ArrayList(c);
+ al1.ToArray(s.GetType());
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+ Assert("toarray with bad type error not thrown",
+ errorThrown);
+ }
+ {
+ char[] c1 = {'a', 'b', 'c', 'd', 'e'};
+ ArrayList al1 = new ArrayList(c1);
+ object[] o2 = al1.ToArray();
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("should be copy", c1[i], o2[i]);
+ }
+ Array c2 = al1.ToArray(c1[0].GetType());
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("should be copy",
+ c1[i], c2.GetValue(i));
+ }
+ }
+ }
+
+ public void TestTrimToSize() {
+ {
+ bool errorThrown = false;
+ try {
+ ArrayList al1 =
+ ArrayList.ReadOnly(new ArrayList());
+ al1.TrimToSize();
+ } catch (NotSupportedException) {
+ errorThrown = true;
+ }
+ Assert("trim read only error not thrown",
+ errorThrown);
+ }
+ {
+ ArrayList al1 = new ArrayList();
+ int capacity = al1.Capacity;
+ while (al1.Capacity <= capacity) {
+ al1.Add('?');
+ }
+ al1.RemoveAt(0);
+ AssertEquals("size not good", capacity, al1.Count);
+ Assert("capacity not good", al1.Capacity > capacity);
+ al1.TrimToSize();
+ AssertEquals("no capacity match",
+ capacity, al1.Capacity);
+
+ al1.Clear();
+ al1.TrimToSize();
+ AssertEquals("no default capacity",
+ capacity, al1.Capacity);
+ }
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/BitArrayTest.cs b/mcs/class/corlib/Test/System.Collections/BitArrayTest.cs
new file mode 100644
index 00000000000..7d29eb44911
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/BitArrayTest.cs
@@ -0,0 +1,300 @@
+//
+// BitArrayTest.cs - NUnit Test Cases for the System.Collections.BitArray class
+//
+// Author: David Menestrina (dmenest@yahoo.com)
+//
+
+using NUnit.Framework;
+using System.Collections;
+using System;
+
+namespace MonoTests.System.Collections
+{
+
+public class BitArrayTest : TestCase
+{
+ private BitArray testBa;
+ private bool [] testPattern;
+ private BitArray op1;
+ private BitArray op2;
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite(typeof(BitArrayTest));
+ }
+ }
+
+ private void verifyPattern(BitArray ba, bool[] pattern)
+ {
+ AssertEquals(ba.Length, pattern.Length);
+ for (int i = 0; i < pattern.Length; i++)
+ AssertEquals(ba[i], pattern[i]);
+ }
+
+ public BitArrayTest() : base ("MonoTests.System.Collections.BitArrayTest testcase") {}
+ public BitArrayTest( string name ) : base(name) { }
+
+ protected override void SetUp()
+ {
+ testPattern = new bool[70];
+
+ int i;
+ for(i = 0; i < testPattern.Length/2; i++)
+ testPattern[i] = ((i % 2) == 0);
+ for(; i < testPattern.Length; i++)
+ testPattern[i] = ((i % 2) != 0);
+
+ testBa = new BitArray(70);
+ for(i = 0; i < testBa.Length/2; i++)
+ testBa[i] = ((i % 2) == 0);
+ for(; i < testBa.Length; i++)
+ testBa[i] = ((i % 2) != 0);
+
+ // for TestAnd, TestOr, TestNot, TestXor
+ op1 = new BitArray(new int[] { 0x33333333, 0x33333333 });
+ op2 = new BitArray(new int[] { 0x66666666, 0x66666666 });
+ }
+
+ public void TestBoolConstructor()
+ {
+ BitArray ba = new BitArray(testPattern);
+ verifyPattern(ba, testPattern);
+ }
+
+ public void TestCopyConstructor()
+ {
+ BitArray ba = new BitArray(testBa);
+
+ verifyPattern(ba, testPattern);
+ }
+
+ public void TestByteConstructor()
+ {
+ byte [] byteArr = new byte[] { 0xaa, 0x55, 0xaa, 0x55, 0x80 };
+ BitArray ba = new BitArray(byteArr);
+
+ AssertEquals("Lengths not equal", ba.Length, byteArr.Length * 8);
+
+ // spot check
+ Assert("7 not true", ba[7]);
+ Assert("6 not false", !ba[6]);
+ Assert("15 not false", !ba[15]);
+ Assert("14 not true", ba[14]);
+ Assert("39 not true", ba[39]);
+ Assert("35 not false", !ba[35]);
+
+ }
+
+ public void TestIntConstructor()
+ {
+ int [] intArr = new int[] { ~0x55555555, 0x55555551 };
+ BitArray ba = new BitArray(intArr);
+
+ AssertEquals(ba.Length, intArr.Length * 32);
+
+ // spot check
+
+ Assert(ba[31]);
+ Assert(!ba[30]);
+ Assert(!ba[63]);
+ Assert(ba[62]);
+ Assert(ba[32]);
+ Assert(!ba[35]);
+ }
+
+ public void TestValConstructor()
+ {
+ BitArray ba = new BitArray(64, false);
+
+ AssertEquals(ba.Length, 64);
+ foreach (bool b in ba)
+ Assert(!b);
+
+ ba = new BitArray(64, true);
+
+ AssertEquals(ba.Length, 64);
+ foreach (bool b in ba)
+ Assert(b);
+ }
+
+ public void TestClone()
+ {
+ BitArray ba = (BitArray)testBa.Clone();
+
+ verifyPattern(ba, testPattern);
+
+ // ensure that changes in ba don't get propagated to testBa
+ ba[0] = false;
+ ba[1] = false;
+ ba[2] = false;
+
+ verifyPattern(testBa, testPattern);
+ }
+
+ public void TestSetLength()
+ {
+ int origLen = testBa.Length;
+ testBa.Length += 33;
+
+ AssertEquals(origLen + 33, testBa.Length);
+ for (int i = origLen; i < testBa.Length; i++)
+ testBa[i] = true;
+
+ testBa.Length -= 33;
+ verifyPattern(testBa, testPattern);
+ }
+
+ public void TestAnd()
+ {
+ BitArray result = op1.And(op2);
+ AssertEquals(result.Length, op1.Length);
+ for (int i = 0; i < result.Length; )
+ {
+ Assert(!result[i++]);
+ Assert(result[i++]);
+ Assert(!result[i++]);
+ Assert(!result[i++]);
+ }
+ }
+
+ public void TestOr()
+ {
+ BitArray result = op1.Or(op2);
+ AssertEquals(result.Length, op1.Length);
+ for (int i = 0; i < result.Length; )
+ {
+ Assert(result[i++]);
+ Assert(result[i++]);
+ Assert(result[i++]);
+ Assert(!result[i++]);
+ }
+ }
+
+ public void TestNot()
+ {
+ BitArray result = op1.Not();
+ AssertEquals(result.Length, op1.Length);
+ for (int i = 0; i < result.Length; )
+ {
+ Assert(!result[i++]);
+ Assert(!result[i++]);
+ Assert(result[i++]);
+ Assert(result[i++]);
+ }
+ }
+
+ public void TestXor()
+ {
+ BitArray result = op1.Xor(op2);
+ AssertEquals(result.Length, op1.Length);
+ for (int i = 0; i < result.Length; )
+ {
+ Assert(result[i++]);
+ Assert(!result[i++]);
+ Assert(result[i++]);
+ Assert(!result[i++]);
+ }
+ }
+
+ public void TestSetAll()
+ {
+ testBa.SetAll(false);
+ foreach(bool b in testBa)
+ Assert(!b);
+ testBa.SetAll(true);
+ foreach(bool b in testBa)
+ Assert(b);
+ }
+
+ public void TestCopyToBool()
+ {
+ try {
+ bool[] barray = new bool[testBa.Length + 10];
+
+ testBa.CopyTo(barray, 5);
+
+ for (int i = 0; i < testBa.Length; i++)
+ AssertEquals(testBa[i], barray[i+5]);
+ }
+ catch(Exception e){
+ Fail("Unexpected exception thrown: " + e.ToString());
+ }
+ }
+
+ public void TestCopyToByte()
+ {
+ try {
+ testBa.Length = 34;
+ byte[] barray = new byte[5 + 10];
+
+ testBa.CopyTo(barray, 5);
+
+ for (int i = 5; i < 9; i++)
+ AssertEquals(0x55, barray[i] & 0xff);
+
+ // FIXME: MS fails on the next line. This is because
+ // we truncated testBa.Length, and MS's internal array still
+ // has the old bits set. CopyTo() doesn't say specifically
+ // whether the "junk" bits (bits past Length, but within Length
+ // rounded up to 32) will be copied as 0, or if those bits are
+ // undefined.
+ //AssertEquals(0x01, barray[9] & 0xff);
+ }
+ catch(Exception e){
+ Fail("Unexpected exception thrown: " + e.ToString());
+ }
+ }
+
+ public void TestCopyToInt()
+ {
+ try {
+ testBa.Length = 34;
+ int[] iarray = new int[2 + 10];
+
+ testBa.CopyTo(iarray, 5);
+
+ AssertEquals(0x55555555, iarray[5]);
+ // FIXME: Same thing here as in TestCopyToByte
+ //AssertEquals(0x01, iarray[6]);
+ }
+ catch(Exception e){
+ Fail("Unexpected exception thrown: " + e.ToString());
+ }
+ }
+
+ public void TestEnumerator()
+ {
+
+ try {
+ IEnumerator e = testBa.GetEnumerator();
+
+ for (int i = 0; e.MoveNext(); i++)
+ AssertEquals(e.Current, testPattern[i]);
+
+ Assert(!e.MoveNext());
+ // read, to make sure reading isn't considered a write.
+ bool b = testBa[0];
+
+ e.Reset();
+ for (int i = 0; e.MoveNext(); i++)
+ AssertEquals(e.Current, testPattern[i]);
+
+ try
+ {
+ e.Reset();
+ testBa[0] = !testBa[0];
+ e.MoveNext();
+ Fail("IEnumerator.MoveNext() should throw when collection modified.");
+ }
+ catch (InvalidOperationException)
+ {
+ }
+ }
+ catch(Exception ex){
+ Fail("Unexpected exception thrown: " + ex.ToString());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/CaseInsensitiveComparerTest.cs b/mcs/class/corlib/Test/System.Collections/CaseInsensitiveComparerTest.cs
new file mode 100644
index 00000000000..9bd8ba35ec9
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/CaseInsensitiveComparerTest.cs
@@ -0,0 +1,50 @@
+// CaseInsensitiveComparerTest
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace MonoTests.System.Collections {
+
+
+ /// <summary>CaseInsensitiveComparer test suite.</summary>
+ public class CaseInsensitiveComparerTest : TestCase {
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(CaseInsensitiveComparerTest));
+ }
+ }
+
+ public CaseInsensitiveComparerTest() : base ("MonoTests.System.Collections.CaseInsensitiveComparerTest testcase") {}
+
+ public CaseInsensitiveComparerTest(String name) : base(name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ }
+
+ public void TestDefaultInstance ()
+ {
+ // Make sure the instance returned by Default
+ // is really a CaseInsensitiveComparer.
+ Assert((CaseInsensitiveComparer.Default
+ as CaseInsensitiveComparer) != null);
+ }
+
+ public void TestCompare () {
+ CaseInsensitiveComparer cic = new CaseInsensitiveComparer ();
+
+ Assert(cic.Compare ("WILD WEST", "Wild West") == 0);
+ Assert(cic.Compare ("WILD WEST", "wild west") == 0);
+ Assert(cic.Compare ("Zeus", "Mars") > 0);
+ Assert(cic.Compare ("Earth", "Venus") < 0);
+ }
+
+ }
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/CaseInsensitiveHashCodeProviderTest.cs b/mcs/class/corlib/Test/System.Collections/CaseInsensitiveHashCodeProviderTest.cs
new file mode 100644
index 00000000000..86419a02ce4
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/CaseInsensitiveHashCodeProviderTest.cs
@@ -0,0 +1,57 @@
+// CaseInsensitiveHashCodeProviderTest
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace MonoTests.System.Collections {
+
+
+ /// <summary>CaseInsensitiveHashCodeProvider test suite.</summary>
+ public class CaseInsensitiveHashCodeProviderTest : TestCase {
+ public CaseInsensitiveHashCodeProviderTest() : base ("MonoTests.System.Collections.CaseInsensitiveHashCodeProviderTest testcase") {}
+
+ public CaseInsensitiveHashCodeProviderTest(String name) : base(name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ }
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite(typeof(CaseInsensitiveHashCodeProviderTest));
+ }
+ }
+
+ public void TestDefaultInstance ()
+ {
+ // Make sure the instance returned by Default
+ // is really a CaseInsensitiveHashCodeProvider.
+ Assert((CaseInsensitiveHashCodeProvider.Default
+ as CaseInsensitiveHashCodeProvider) != null);
+ }
+
+ public void TestHashCode () {
+ CaseInsensitiveHashCodeProvider cih = new CaseInsensitiveHashCodeProvider ();
+ int h1 = cih.GetHashCode ("Test String");
+ int h2 = cih.GetHashCode ("test string");
+ int h3 = cih.GetHashCode ("TEST STRING");
+
+ Assert("Mixed Case != lower case", h1 == h2);
+ Assert("Mixed Case != UPPER CASE", h1 == h3);
+
+ h1 = cih.GetHashCode ("one");
+ h2 = cih.GetHashCode ("another");
+ // Actually this is quite possible.
+ Assert(h1 != h2);
+ }
+
+ }
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/ChangeLog b/mcs/class/corlib/Test/System.Collections/ChangeLog
new file mode 100644
index 00000000000..dcd52096052
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/ChangeLog
@@ -0,0 +1,28 @@
+2002-03-24 Duncan Mak <duncan@ximian.com>
+
+ * SortedListTest.cs: Committed to CVS for Jaak Simm <jaaksimm@firm.ee>.
+
+2002-02-28 Nick Drochak <ndrochak@gol.com>
+
+ * HashtableTest.cs: make the second test class public. The was showing
+ as an error whe run against the mscorlib. Might be because of the
+ new NUnit that was just checked in.
+
+2002-02-20 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayListTest.cs: Add a small assert for a bug that I found and fixed
+ in ArrayList. Make sure it doesn't come up again.
+
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * QueueTest.cs: Put in correct namespace.
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * StackTest.cs: Removed test for IsReadonly. Doesn't exist in .NET 1.0
+
+2002-01-20 Nick Drochak <ndrochak@gol.com>
+
+ * BitArrayTest.cs: wrapped try-catch blocks around several of the tests.
+ NUnit doesn't properly catch exception here anymore. Must be something
+ to do with upgrading to .NET.1.0. \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Collections/CollectionBaseTest.cs b/mcs/class/corlib/Test/System.Collections/CollectionBaseTest.cs
new file mode 100644
index 00000000000..12ca737e391
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/CollectionBaseTest.cs
@@ -0,0 +1,236 @@
+//
+// System.Collections.CollectionBase
+// Test suite for System.Collections.CollectionBase
+//
+// Author:
+// Nick D. Drochak II
+//
+// (C) 2001 Nick D. Drochak II
+//
+
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections
+{
+
+public class CollectionBaseTest : TestCase
+{
+ public CollectionBaseTest () : base ("System.Collection.CollectionBase testsuite") {}
+ public CollectionBaseTest (String name) : base (name) {}
+
+ // We need a concrete class to test the abstract base class
+ public class ConcreteCollection : CollectionBase
+ {
+ // These fields are used as markers to test the On* hooks.
+ public bool onClearFired;
+ public bool onClearCompleteFired;
+
+ public bool onInsertFired;
+ public int onInsertIndex;
+ public bool onInsertCompleteFired;
+ public int onInsertCompleteIndex;
+
+ public bool onRemoveFired;
+ public int onRemoveIndex;
+ public bool onRemoveCompleteFired;
+ public int onRemoveCompleteIndex;
+
+ public bool onSetFired;
+ public int onSetOldValue;
+ public int onSetNewValue;
+ public bool onSetCompleteFired;
+ public int onSetCompleteOldValue;
+ public int onSetCompleteNewValue;
+
+ // This constructor is used to test OnValid()
+ public ConcreteCollection()
+ {
+ IList listObj;
+ listObj = this;
+ listObj.Add(null);
+ }
+
+ // This constructor puts consecutive integers into the list
+ public ConcreteCollection(int i) {
+ IList listObj;
+ listObj = this;
+
+ int j;
+ for (j = 0; j< i; j++) {
+ listObj.Add(j);
+ }
+ }
+
+ // A helper method to look at a value in the list at a specific index
+ public int PeekAt(int index)
+ {
+ IList listObj;
+ listObj = this;
+ return (int) listObj[index];
+ }
+
+ // Mark the flag if this hook is fired
+ protected override void OnClear() {
+ this.onClearFired = true;
+ }
+
+ // Mark the flag if this hook is fired
+ protected override void OnClearComplete()
+ {
+ this.onClearCompleteFired = true;
+ }
+
+ // Mark the flag, and save the paramter if this hook is fired
+ protected override void OnInsert(int index, object value)
+ {
+ this.onInsertFired = true;
+ this.onInsertIndex = index;
+ }
+
+ // Mark the flag, and save the paramter if this hook is fired
+ protected override void OnInsertComplete(int index, object value)
+ {
+ this.onInsertCompleteFired = true;
+ this.onInsertCompleteIndex = index;
+ }
+
+ // Mark the flag, and save the paramter if this hook is fired
+ protected override void OnRemove(int index, object value)
+ {
+ this.onRemoveFired = true;
+ this.onRemoveIndex = index;
+ }
+
+ // Mark the flag, and save the paramter if this hook is fired
+ protected override void OnRemoveComplete(int index, object value)
+ {
+ this.onRemoveCompleteFired = true;
+ this.onRemoveCompleteIndex = index;
+ }
+
+ // Mark the flag, and save the paramters if this hook is fired
+ protected override void OnSet(int index, object oldValue, object newValue)
+ {
+ this.onSetFired = true;
+ this.onSetOldValue = (int) oldValue;
+ this.onSetNewValue = (int) newValue;
+ }
+
+ // Mark the flag, and save the paramters if this hook is fired
+ protected override void OnSetComplete(int index, object oldValue, object newValue)
+ {
+ this.onSetCompleteFired = true;
+ this.onSetCompleteOldValue = (int) oldValue;
+ this.onSetCompleteNewValue = (int) newValue;
+ }
+ } // public class ConcreteCollection
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof(CollectionBaseTest));
+ }
+ }
+
+ // Check the count property
+ public void TestCount() {
+ ConcreteCollection myCollection;
+ myCollection = new ConcreteCollection(4);
+ Assert(4 == myCollection.Count);
+ }
+
+ // Make sure GetEnumerator returns an object
+ public void TestGetEnumerator() {
+ ConcreteCollection myCollection;
+ myCollection = new ConcreteCollection(4);
+ Assert(null != myCollection.GetEnumerator());
+ }
+
+ // OnValid disallows nulls
+ public void TestOnValid() {
+ ConcreteCollection myCollection;
+ try {
+ myCollection = new ConcreteCollection();
+ }
+ catch (ArgumentNullException) {
+ }
+ }
+
+ // Test various Insert paths
+ public void TestInsert() {
+ ConcreteCollection myCollection;
+ int numberOfItems;
+ numberOfItems = 3;
+ // The constructor inserts
+ myCollection = new ConcreteCollection(numberOfItems);
+ Assert(myCollection.onInsertFired);
+ Assert(myCollection.onInsertCompleteFired);
+
+ // Using the IList interface, check inserts in the middle
+ IList listObj = myCollection;
+ listObj.Insert(1, 9);
+ Assert(myCollection.onInsertIndex == 1);
+ Assert(myCollection.onInsertCompleteIndex == 1);
+ Assert(myCollection.PeekAt(1) == 9);
+ }
+
+ // Test Clear and it's hooks
+ public void TestClear()
+ {
+ ConcreteCollection myCollection;
+ int numberOfItems;
+ numberOfItems = 1;
+ myCollection = new ConcreteCollection(numberOfItems);
+ myCollection.Clear();
+ Assert(myCollection.Count == 0);
+ Assert(myCollection.onClearFired);
+ Assert(myCollection.onClearCompleteFired);
+ }
+
+ // Test RemoveAt, other removes and the hooks
+ public void TestRemove()
+ {
+ ConcreteCollection myCollection;
+ int numberOfItems;
+ numberOfItems = 3;
+ // Set up a test collection
+ myCollection = new ConcreteCollection(numberOfItems);
+
+ // The list is 0-based. So if we remove the second one
+ myCollection.RemoveAt(1);
+
+ // We should see the original third one in it's place
+ Assert(myCollection.PeekAt(1) == 2);
+ Assert(myCollection.onRemoveFired);
+ Assert(myCollection.onRemoveIndex == 1);
+ Assert(myCollection.onRemoveCompleteFired);
+ Assert(myCollection.onRemoveCompleteIndex == 1);
+ IList listObj = myCollection;
+ listObj.Remove(0);
+ // Confirm parameters are being passed to the hooks
+ Assert(myCollection.onRemoveIndex == 0);
+ Assert(myCollection.onRemoveCompleteIndex == 0);
+ }
+
+ // Test the random access feature
+ public void TestSet()
+ {
+ ConcreteCollection myCollection;
+ int numberOfItems;
+ numberOfItems = 3;
+ myCollection = new ConcreteCollection(numberOfItems);
+ IList listObj = myCollection;
+ listObj[0] = 99;
+ Assert((int) listObj[0] == 99);
+ Assert(myCollection.onSetFired);
+ Assert(myCollection.onSetCompleteFired);
+ Assert(myCollection.onSetOldValue == 0);
+ Assert(myCollection.onSetCompleteOldValue == 0);
+ Assert(myCollection.onSetNewValue == 99);
+ Assert(myCollection.onSetCompleteNewValue == 99);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/ComparerTest.cs b/mcs/class/corlib/Test/System.Collections/ComparerTest.cs
new file mode 100644
index 00000000000..38b78de39e7
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/ComparerTest.cs
@@ -0,0 +1,60 @@
+// ComparerTest
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace MonoTests.System.Collections {
+
+
+ /// <summary>Comparer test suite.</summary>
+ public class ComparerTest : TestCase {
+ public ComparerTest() : base ("MonoTests.System.Collections.ComparerTest testcase") {}
+ public ComparerTest(String name) : base(name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ }
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite(typeof(ComparerTest));
+ }
+ }
+
+ public void TestDefaultInstance ()
+ {
+ // Make sure the instance returned by Default
+ // is really a Comparer.
+ Assert((Comparer.Default as Comparer) != null);
+ }
+
+ public void TestCompare ()
+ {
+ Comparer c = Comparer.Default;
+
+ bool thrown = false;
+
+ try {
+ c.Compare (new Object (), new Object ());
+ } catch (ArgumentException) {
+ thrown = true;
+ }
+
+ Assert("ArgumentException expected", thrown);
+
+ Assert(c.Compare (1, 2) < 0);
+ Assert(c.Compare (2, 2) == 0);
+ Assert(c.Compare (3, 2) > 0);
+
+ }
+
+ }
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/HashtableTest.cs b/mcs/class/corlib/Test/System.Collections/HashtableTest.cs
new file mode 100644
index 00000000000..b37b16ffd1b
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/HashtableTest.cs
@@ -0,0 +1,761 @@
+// HashtableTest.cs - NUnit Test Cases for the System.Collections.Hashtable class
+//
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace MonoTests.System.Collections {
+
+
+/// <summary>Hashtable test.</summary>
+public class HashtableTest : TestCase {
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite();
+
+ suite.AddTest(new TestSuite(typeof(HashtableTest)));
+ suite.AddTest(new TestSuite(typeof(HashtableTest2)));
+ return suite;
+ }
+ }
+
+ public void TestCtor1() {
+ Hashtable h = new Hashtable();
+ AssertNotNull("No hash table", h);
+ }
+ public void TestCtor2() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null hashtable error not thrown",
+ errorThrown);
+ }
+ {
+ string[] keys = {"this", "is", "a", "test"};
+ char[] values = {'a', 'b', 'c', 'd'};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < keys.Length; i++) {
+ h1[keys[i]] = values[i];
+ }
+ Hashtable h2 = new Hashtable(h1);
+ for (int i = 0; i < keys.Length; i++) {
+ AssertEquals("No match for key " + keys[i],
+ values[i], h2[keys[i]]);
+ }
+ }
+ }
+ // TODO - Ctors for capacity and load (how to test? any access?)
+ // TODO - Ctors with IComparer, IHashCodeProvider, Serialization
+
+ public void TestCount() {
+ Hashtable h = new Hashtable();
+ AssertEquals("new table - count zero", 0, h.Count);
+ int max = 100;
+ for (int i = 1; i <= max; i++) {
+ h[i] = i;
+ AssertEquals("Count wrong for " + i,
+ i, h.Count);
+ }
+ for (int i = 1; i <= max; i++) {
+ h[i] = i * 2;
+ AssertEquals("Count shouldn't change at " + i,
+ max, h.Count);
+ }
+ }
+
+ public void TestIsFixedSize() {
+ Hashtable h = new Hashtable();
+ AssertEquals("hashtable not fixed by default",
+ false, h.IsFixedSize);
+ // TODO - any way to get a fixed-size hashtable?
+ }
+
+ public void TestIsReadOnly() {
+ Hashtable h = new Hashtable();
+ AssertEquals("hashtable not read-only by default",
+ false, h.IsReadOnly);
+ // TODO - any way to get a read-only hashtable?
+ }
+
+ public void TestIsSynchronized() {
+ Hashtable h = new Hashtable();
+ Assert("hashtable not synced by default", !h.IsSynchronized);
+ Hashtable h2 = Hashtable.Synchronized(h);
+ Assert("hashtable should by synced", h2.IsSynchronized);
+ }
+
+ public void TestItem() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ Object o = h[null];
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null hashtable error not thrown",
+ errorThrown);
+ }
+ // TODO - if read-only and/or fixed-size is possible,
+ // test 'NotSupportedException' here
+
+ {
+ Hashtable h = new Hashtable();
+ int max = 100;
+ for (int i = 1; i <= max; i++) {
+ h[i] = i;
+ AssertEquals("value wrong for " + i,
+ i, h[i]);
+ }
+ }
+ }
+
+ public void TestKeys() {
+ string[] keys = {"this", "is", "a", "test"};
+ char[] values1 = {'a', 'b', 'c', 'd'};
+ char[] values2 = {'e', 'f', 'g', 'h'};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < keys.Length; i++) {
+ h1[keys[i]] = values1[i];
+ }
+ AssertEquals("keys wrong size",
+ keys.Length, h1.Keys.Count);
+ for (int i = 0; i < keys.Length; i++) {
+ h1[keys[i]] = values2[i];
+ }
+ AssertEquals("keys wrong size 2",
+ keys.Length, h1.Keys.Count);
+ }
+
+ // TODO - SyncRoot
+
+ public void TestValues() {
+ string[] keys = {"this", "is", "a", "test"};
+ char[] values1 = {'a', 'b', 'c', 'd'};
+ char[] values2 = {'e', 'f', 'g', 'h'};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < keys.Length; i++) {
+ h1[keys[i]] = values1[i];
+ }
+ AssertEquals("values wrong size",
+ keys.Length, h1.Values.Count);
+ for (int i = 0; i < keys.Length; i++) {
+ h1[keys[i]] = values2[i];
+ }
+ AssertEquals("values wrong size 2",
+ keys.Length, h1.Values.Count);
+ }
+
+ public void TestAdd() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h.Add(null, "huh?");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null add error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h.Add('a', 1);
+ h.Add('a', 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("re-add error not thrown",
+ errorThrown);
+ }
+ // TODO - hit NotSupportedException
+ {
+ Hashtable h = new Hashtable();
+ int max = 100;
+ for (int i = 1; i <= max; i++) {
+ h.Add(i, i);
+ AssertEquals("value wrong for " + i,
+ i, h[i]);
+ }
+ }
+ }
+
+ public void TestClear() {
+ // TODO - hit NotSupportedException
+ Hashtable h = new Hashtable();
+ AssertEquals("new table - count zero", 0, h.Count);
+ int max = 100;
+ for (int i = 1; i <= max; i++) {
+ h[i] = i;
+ }
+ Assert("table don't gots stuff", h.Count > 0);
+ h.Clear();
+ AssertEquals("Table should be cleared",
+ 0, h.Count);
+ }
+
+ public void TestClone() {
+ {
+ char[] c1 = {'a', 'b', 'c'};
+ char[] c2 = {'d', 'e', 'f'};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < c1.Length; i++) {
+ h1[c1[i]] = c2[i];
+ }
+ Hashtable h2 = (Hashtable)h1.Clone();
+ AssertNotNull("got no clone!", h2);
+ AssertNotNull("clone's got nothing!", h2[c1[0]]);
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("Hashtable match",
+ h1[c1[i]], h2[c1[i]]);
+ }
+ }
+ {
+ char[] c1 = {'a', 'b', 'c'};
+ char[] c20 = {'1', '2'};
+ char[] c21 = {'3', '4'};
+ char[] c22 = {'5', '6'};
+ char[][] c2 = {c20, c21, c22};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < c1.Length; i++) {
+ h1[c1[i]] = c2[i];
+ }
+ Hashtable h2 = (Hashtable)h1.Clone();
+ AssertNotNull("got no clone!", h2);
+ AssertNotNull("clone's got nothing!", h2[c1[0]]);
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("Hashtable match",
+ h1[c1[i]], h2[c1[i]]);
+ }
+
+ ((char[])h1[c1[0]])[0] = 'z';
+ AssertEquals("shallow copy", h1[c1[0]], h2[c1[0]]);
+ }
+ }
+
+ public void TestContains() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ bool result = h.Contains(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null add error not thrown",
+ errorThrown);
+ }
+ {
+ Hashtable h = new Hashtable();
+ h['a'] = "blue";
+ Assert("'a'? it's in there!", h.Contains('a'));
+ Assert("'b'? no way!", !h.Contains('b'));
+ }
+ }
+
+ public void TestContainsKey() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ bool result = h.ContainsKey(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null add error not thrown",
+ errorThrown);
+ }
+ {
+ Hashtable h = new Hashtable();
+ h['a'] = "blue";
+ Assert("'a'? it's in there!", h.ContainsKey('a'));
+ Assert("'b'? no way!", !h.ContainsKey('b'));
+ }
+ }
+
+ public void TestContainsValue() {
+ {
+ Hashtable h = new Hashtable();
+ h['a'] = "blue";
+ Assert("blue? it's in there!",
+ h.ContainsValue("blue"));
+ Assert("green? no way!",
+ !h.ContainsValue("green"));
+ }
+ }
+
+ public void TestCopyTo() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h.CopyTo(null, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null hashtable error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ Object[] o = new Object[1];
+ h.CopyTo(o, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ Object[,] o = new Object[1,1];
+ h.CopyTo(o, 1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("multi-dim array error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h['a'] = 1; // no error if table is empty
+ Object[] o = new Object[5];
+ h.CopyTo(o, 5);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("no room in array error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h['a'] = 1;
+ h['b'] = 2;
+ h['c'] = 2;
+ Object[] o = new Object[2];
+ h.CopyTo(o, 0);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("table too big error not thrown",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h["blue"] = 1;
+ h["green"] = 2;
+ h["red"] = 3;
+ Char[] o = new Char[3];
+ h.CopyTo(o, 0);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+ Assert("invalid cast error not thrown",
+ errorThrown);
+ }
+
+ {
+ Hashtable h = new Hashtable();
+ h['a'] = 1;
+ h['b'] = 2;
+ DictionaryEntry[] o = new DictionaryEntry[2];
+ h.CopyTo(o,0);
+ AssertEquals("first copy fine.", 'a', o[0].Key);
+ AssertEquals("first copy fine.", 1, o[0].Value);
+ AssertEquals("second copy fine.", 'b', o[1].Key);
+ AssertEquals("second copy fine.", 2, o[1].Value);
+ }
+ }
+
+ public void TestGetEnumerator() {
+ String[] s1 = {"this", "is", "a", "test"};
+ Char[] c1 = {'a', 'b', 'c', 'd'};
+ Hashtable h1 = new Hashtable();
+ for (int i = 0; i < s1.Length; i++) {
+ h1[s1[i]] = c1[i];
+ }
+ IDictionaryEnumerator en = h1.GetEnumerator();
+ AssertNotNull("No enumerator", en);
+
+ for (int i = 0; i < s1.Length; i++) {
+ en.MoveNext();
+ Assert("Not enumerating for " + en.Key,
+ Array.IndexOf(s1, en.Key) >= 0);
+ Assert("Not enumerating for " + en.Value,
+ Array.IndexOf(c1, en.Value) >= 0);
+ }
+ }
+
+ // TODO - GetObjectData
+ // TODO - OnDeserialization
+
+ public void TestRemove() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = new Hashtable();
+ h.Remove(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null hashtable error not thrown",
+ errorThrown);
+ }
+ {
+ string[] keys = {"this", "is", "a", "test"};
+ char[] values = {'a', 'b', 'c', 'd'};
+ Hashtable h = new Hashtable();
+ for (int i = 0; i < keys.Length; i++) {
+ h[keys[i]] = values[i];
+ }
+ AssertEquals("not enough in table",
+ 4, h.Count);
+ h.Remove("huh?");
+ AssertEquals("not enough in table",
+ 4, h.Count);
+ h.Remove("this");
+ AssertEquals("Wrong count in table",
+ 3, h.Count);
+ h.Remove("this");
+ AssertEquals("Wrong count in table",
+ 3, h.Count);
+ }
+ }
+
+ public void TestSynchronized() {
+ {
+ bool errorThrown = false;
+ try {
+ Hashtable h = Hashtable.Synchronized(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null hashtable error not thrown",
+ errorThrown);
+ }
+ {
+ Hashtable h = new Hashtable();
+ Assert("hashtable not synced by default",
+ !h.IsSynchronized);
+ Hashtable h2 = Hashtable.Synchronized(h);
+ Assert("hashtable should by synced",
+ h2.IsSynchronized);
+ }
+ }
+
+
+ protected Hashtable ht;
+ private static Random rnd;
+
+ public HashtableTest() : base ("MonoTests.System.Collections.HashtableTest testcase") {}
+ public HashtableTest(String name) : base(name) {}
+
+ protected override void SetUp() {
+ ht=new Hashtable();
+ rnd=new Random();
+ }
+
+ private void SetDefaultData() {
+ ht.Clear();
+ ht.Add("k1","another");
+ ht.Add("k2","yet");
+ ht.Add("k3","hashtable");
+ }
+
+
+ public void TestAddRemoveClear() {
+ ht.Clear();
+ Assert(ht.Count==0);
+
+ SetDefaultData();
+ Assert(ht.Count==3);
+
+ bool thrown=false;
+ try {
+ ht.Add("k2","cool");
+ } catch (ArgumentException) {thrown=true;}
+ Assert("Must throw ArgumentException!",thrown);
+
+ ht["k2"]="cool";
+ Assert(ht.Count==3);
+ Assert(ht["k2"].Equals("cool"));
+
+ }
+
+ public void TestCopyTo2() {
+ SetDefaultData();
+ Object[] entries=new Object[ht.Count];
+ ht.CopyTo(entries,0);
+ Assert("Not an entry.",entries[0] is DictionaryEntry);
+ }
+
+
+ public void TestUnderHeavyLoad() {
+ ht.Clear();
+ int max=100000;
+ String[] cache=new String[max*2];
+ int n=0;
+
+ for (int i=0;i<max;i++) {
+ int id=rnd.Next()&0xFFFF;
+ String key=""+id+"-key-"+id;
+ String val="value-"+id;
+ if (ht[key]==null) {
+ ht[key]=val;
+ cache[n]=key;
+ cache[n+max]=val;
+ n++;
+ }
+ }
+
+ Assert(ht.Count==n);
+
+ for (int i=0;i<n;i++) {
+ String key=cache[i];
+ String val=ht[key] as String;
+ String err="ht[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+
+ int r1=(n/3);
+ int r2=r1+(n/5);
+
+ for (int i=r1;i<r2;i++) {
+ ht.Remove(cache[i]);
+ }
+
+
+ for (int i=0;i<n;i++) {
+ if (i>=r1 && i<r2) {
+ Assert(ht[cache[i]]==null);
+ } else {
+ String key=cache[i];
+ String val=ht[key] as String;
+ String err="ht[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+ }
+
+ ICollection keys=ht.Keys;
+ int nKeys=0;
+ foreach (Object key in keys) {
+ Assert((key as String) != null);
+ nKeys++;
+ }
+ Assert(nKeys==ht.Count);
+
+
+ ICollection vals=ht.Values;
+ int nVals=0;
+ foreach (Object val in vals) {
+ Assert((val as String) != null);
+ nVals++;
+ }
+ Assert(nVals==ht.Count);
+
+ }
+
+
+ public class HashtableTest2 : TestCase {
+
+ protected Hashtable ht;
+ private static Random rnd;
+
+ public HashtableTest2 (String name) : base(name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ ht=new Hashtable ();
+ rnd=new Random ();
+ }
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof(HashtableTest2));
+ }
+ }
+
+ private void SetDefaultData ()
+ {
+ ht.Clear ();
+ ht.Add ("k1","another");
+ ht.Add ("k2","yet");
+ ht.Add ("k3","hashtable");
+ }
+
+
+ public void TestAddRemoveClear ()
+ {
+ ht.Clear ();
+ Assert (ht.Count == 0);
+
+ SetDefaultData ();
+ Assert (ht.Count == 3);
+
+ bool thrown=false;
+ try {
+ ht.Add ("k2","cool");
+ } catch (ArgumentException) {thrown=true;}
+ Assert("Must throw ArgumentException!",thrown);
+
+ ht["k2"]="cool";
+ Assert(ht.Count == 3);
+ Assert(ht["k2"].Equals("cool"));
+
+ }
+
+ public void TestCopyTo ()
+ {
+ SetDefaultData ();
+ Object[] entries=new Object[ht.Count];
+ ht.CopyTo (entries,0);
+ Assert("Not an entry.",entries[0] is DictionaryEntry);
+ }
+
+
+ public void TestUnderHeavyLoad ()
+ {
+ ht.Clear ();
+
+ int max=100000;
+ String[] cache=new String[max*2];
+ int n=0;
+
+ for (int i=0;i<max;i++) {
+ int id=rnd.Next()&0xFFFF;
+ String key=""+id+"-key-"+id;
+ String val="value-"+id;
+ if (ht[key]==null) {
+ ht[key]=val;
+ cache[n]=key;
+ cache[n+max]=val;
+ n++;
+ }
+ }
+
+ Assert(ht.Count==n);
+
+ for (int i=0;i<n;i++) {
+ String key=cache[i];
+ String val=ht[key] as String;
+ String err="ht[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+
+ int r1=(n/3);
+ int r2=r1+(n/5);
+
+ for (int i=r1;i<r2;i++) {
+ ht.Remove(cache[i]);
+ }
+
+
+ for (int i=0;i<n;i++) {
+ if (i>=r1 && i<r2) {
+ Assert(ht[cache[i]]==null);
+ } else {
+ String key=cache[i];
+ String val=ht[key] as String;
+ String err="ht[\""+key+"\"]=\""+val+
+ "\", expected \""+cache[i+max]+"\"";
+ Assert(err,val!=null && val.Equals(cache[i+max]));
+ }
+ }
+
+ ICollection keys=ht.Keys;
+ int nKeys=0;
+ foreach (Object key in keys) {
+ Assert((key as String) != null);
+ nKeys++;
+ }
+ Assert(nKeys==ht.Count);
+
+
+ ICollection vals=ht.Values;
+ int nVals=0;
+ foreach (Object val in vals) {
+ Assert((val as String) != null);
+ nVals++;
+ }
+ Assert(nVals==ht.Count);
+
+ }
+
+ /// <summary>
+ /// Test hashtable with CaseInsensitiveHashCodeProvider
+ /// and CaseInsensitive comparer.
+ /// </summary>
+ public void TestCaseInsensitive ()
+ {
+ // Not very meaningfull test, just to make
+ // sure that hcp is set properly set.
+ Hashtable ciHashtable = new Hashtable(11,1.0f,CaseInsensitiveHashCodeProvider.Default,CaseInsensitiveComparer.Default);
+ ciHashtable ["key1"] = "value";
+ ciHashtable ["key2"] = "VALUE";
+ Assert(ciHashtable ["key1"].Equals ("value"));
+ Assert(ciHashtable ["key2"].Equals ("VALUE"));
+
+ ciHashtable ["KEY1"] = "new_value";
+ Assert(ciHashtable ["key1"].Equals ("new_value"));
+
+ }
+
+
+ public void TestCopyConstructor ()
+ {
+ SetDefaultData ();
+
+ Hashtable htCopy = new Hashtable (ht);
+
+ Assert(ht.Count == htCopy.Count);
+ }
+
+
+ public void TestEnumerator ()
+ {
+ SetDefaultData ();
+
+ IEnumerator e = ht.GetEnumerator ();
+
+ while (e.MoveNext ()) {}
+
+ Assert (!e.MoveNext ());
+
+ }
+
+
+ }
+
+
+}
+}
diff --git a/mcs/class/corlib/Test/System.Collections/QueueTest.cs b/mcs/class/corlib/Test/System.Collections/QueueTest.cs
new file mode 100644
index 00000000000..2a50df18b95
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/QueueTest.cs
@@ -0,0 +1,179 @@
+//
+// System.Collections.QueueTest
+// Test suite for System.Collections.Queue
+//
+// Author:
+// Ricardo Fernández Pascual
+//
+// (C) 2001 Ricardo Fernández Pascual
+//
+
+
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections {
+
+ public class QueueTest : TestCase {
+
+ public QueueTest ()
+ : base ("System.Collection.Queue testsuite") {}
+ public QueueTest (String name) : base (name) {}
+
+ protected Queue q1;
+ protected Queue q2;
+ protected Queue emptyQueue;
+
+ protected override void SetUp () {
+ q1 = new Queue (10);
+ for (int i = 0; i < 100; i++)
+ q1.Enqueue (i);
+
+ q2 = new Queue (50, 1.5f);
+ for (int i = 50; i < 100; i++)
+ q2.Enqueue (i);
+
+ emptyQueue = new Queue ();
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (QueueTest));
+ }
+ }
+
+ public void TestConstructors () {
+ Assert (q1.Count == 100);
+ Assert (q2.Count == 50);
+ Assert (emptyQueue.Count == 0);
+ // TODO: Test Queue (ICollection)
+ }
+
+ // TODO: should test all methods from ICollection,
+ // but it should be done in ICollectionTest.cs... ??
+
+ public void TestCopyTo () {
+ int[] a1 = new int[100];
+ int[] a2 = new int[60];
+
+ q1.CopyTo (a1, 0);
+ for (int i = 0; i < 100; i++)
+ AssertEquals (i, a1[i]);
+
+ // Remove some items from q2 and add other
+ // items, to avoid having an "easy" just created
+ // Queue
+ for (int i = 50; i < 60; i++)
+ Assert (i == (int) q2.Dequeue ());
+ for (int i = 100; i < 110; i++)
+ q2.Enqueue (i);
+
+ q2.CopyTo (a2, 10);
+ for (int i = 60; i < 110; i++)
+ Assert (i == a2[i - 60 + 10]);
+
+ // Copying an empty Queue should not modify the array
+ emptyQueue.CopyTo (a2, 10);
+ for (int i = 60; i < 110; i++)
+ Assert (i == a2[i - 60 + 10]);
+ }
+
+ public void TestEnumerator () {
+ int i;
+ IEnumerator e;
+ e = q1.GetEnumerator ();
+ i = 0;
+ while (e.MoveNext ()) {
+ Assert (((int) e.Current) == i);
+ i++;
+ }
+ e = q2.GetEnumerator ();
+ i = 50;
+ while (e.MoveNext ()) {
+ Assert (((int) e.Current) == i++);
+ i++;
+ }
+ e = emptyQueue.GetEnumerator ();
+ while (e.MoveNext ()) {
+ Fail ("Empty Queue enumerator returning elements!");
+ }
+ e = q1.GetEnumerator ();
+ try {
+ e.MoveNext ();
+ q1.Enqueue (0);
+ e.MoveNext ();
+ Fail ("Should have thrown InvalidOperationException");
+ } catch (InvalidOperationException) { }
+ e = q1.GetEnumerator ();
+ try {
+ e.MoveNext ();
+ q1.Enqueue (0);
+ object o = e.Current;
+ Fail ("Should have thrown InvalidOperationException");
+ } catch (InvalidOperationException) { }
+ }
+
+ public void TestClone () {
+ Queue q3 = (Queue) q2.Clone ();
+ Assert (q3.Count == q2.Count);
+ for (int i = 0; i < 50; i++)
+ Assert (q2.Dequeue ().Equals (q3.Dequeue ()));
+ Assert (q3.Count == 0);
+ Assert (q2.Count == 0);
+ }
+
+ public void ClearTest () {
+ q1.Clear ();
+ Assert (q1.Count == 0);
+ q2.Clear ();
+ Assert (q2.Count == 0);
+ emptyQueue.Clear ();
+ Assert (emptyQueue.Count == 0);
+ }
+
+ public void ContainsTest () {
+ for (int i = 0; i < 100; i++) {
+ Assert (q1.Contains (i));
+ Assert (!emptyQueue.Contains (i));
+ if (i < 50)
+ Assert (!q2.Contains (i));
+ else
+ Assert (q2.Contains (i));
+ }
+ }
+
+ public void EnqueueDequeuePeekTest () {
+ int q1size = q1.Count;
+ int q2size = q2.Count;
+ q2.Enqueue (null);
+ Assert (q2.Count == ++q2size);
+ for (int i = 0; i < 50; i++) {
+ int k = (int) q1.Peek ();
+ Assert (q1.Count == q1size);
+ int j = (int) q1.Dequeue ();
+ Assert (q1.Count == --q1size);
+ Assert (i == j);
+ Assert (j == k);
+ q2.Enqueue (j);
+ Assert (q2.Count == ++q2size);
+ }
+ for (int i = 50; i < 100; i++) {
+ Assert (((int) q2.Dequeue ()) == i);
+ Assert (q2.Count == --q2size);
+ }
+ Assert (q2.Peek () == null);
+ Assert (q2.Dequeue () == null);
+ Assert (q2.Count == --q2size);
+ for (int i = 0; i < 50; i++) {
+ Assert (((int) q2.Dequeue ()) == i);
+ Assert (q2.Count == --q2size);
+ }
+ }
+
+ // TODO: test Syncronized operation
+
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Collections/ReadOnlyCollectionBaseTest.cs b/mcs/class/corlib/Test/System.Collections/ReadOnlyCollectionBaseTest.cs
new file mode 100644
index 00000000000..1ec201d2db2
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/ReadOnlyCollectionBaseTest.cs
@@ -0,0 +1,49 @@
+//
+// System.Collections.ReadOnlyCollectionBase
+// Test suite for System.Collections.ReadOnlyCollectionBase
+//
+// Author:
+// Nick D. Drochak II
+//
+// (C) 2001 Nick D. Drochak II
+//
+
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections {
+ public class ReadOnlyCollectionBaseTest : TestCase {
+ public ReadOnlyCollectionBaseTest () : base ("System.Collection.ReadOnlyCollectionBase testsuite") {}
+ public ReadOnlyCollectionBaseTest (String name) : base (name) {}
+
+ // We need a concrete class to test the abstract base class
+ public class ConcreteReadOnlyCollection : ReadOnlyCollectionBase
+ {
+ }
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof(ReadOnlyCollectionBaseTest));
+ }
+ }
+
+ // Make sure that the Count is 0 for a new object
+ public void TestZeroCountOnNew()
+ {
+ ConcreteReadOnlyCollection myCollection;
+ myCollection = new ConcreteReadOnlyCollection();
+ Assert(0 == myCollection.Count);
+ }
+
+ // Make sure we get an object from GetEnumerator()
+ public void TestGetEnumerator()
+ {
+ ConcreteReadOnlyCollection myCollection;
+ myCollection = new ConcreteReadOnlyCollection();
+ Assert(null != myCollection.GetEnumerator());
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Collections/SortedListTest.cs b/mcs/class/corlib/Test/System.Collections/SortedListTest.cs
new file mode 100755
index 00000000000..95a8921ab0d
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/SortedListTest.cs
@@ -0,0 +1,625 @@
+// SortedListTest.cs - NUnit Test Cases for the System.Collections.SortedList class
+//
+// Jaak Simm
+//
+// Thanks go to David Brandt (bucky@keystreams.com),
+// because this file is based on his ArrayListTest.cs
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+// main TODO: additional tests for functions affected by
+// fixedsize and read-only properties
+
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+namespace MonoTests.System.Collections {
+
+
+/// <summary>SortedList test.</summary>
+public class SortedListTest : TestCase {
+ public SortedListTest() : base ("MonoTests.System.SortedListTest testsuite") {}
+ public SortedListTest(string name) : base(name) {}
+
+ protected SortedList sl1;
+ protected SortedList sl2;
+ protected SortedList emptysl;
+ protected const int icap=16;
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SortedListTest));
+ }
+ }
+
+ public void TestConstructor1() {
+ SortedList temp1 = new SortedList();
+ AssertNotNull("sl.constructor-1: returns null", temp1);
+ AssertEquals("sl.constructor-1: incorrect initial capacity", temp1.Capacity, icap);
+ }
+
+ public void TestConstructor2() {
+ Comparer c = Comparer.Default;
+ SortedList temp1 = new SortedList(c);
+ AssertNotNull("sl.constructor-2: returns null", temp1);
+ AssertEquals("sl.constructor-2: incorrect initial capacity", temp1.Capacity, icap);
+ }
+
+ public void TestConstructor3() {
+ Hashtable d = new Hashtable();
+ d.Add("one", "Mircosoft");
+ d.Add("two", "will");
+ d.Add("three", "rule");
+ d.Add("four", "the world");
+
+ SortedList temp1 = new SortedList(d);
+ AssertNotNull("sl.constructor-3: returns null", temp1);
+ AssertEquals("sl.constructor-3: incorrect initial capacity", temp1.Capacity, 4);
+ AssertEquals("sl.constructor-3: incorrect count", temp1.Count, 4);
+
+ try {
+ d=null;
+ temp1 = new SortedList(d);
+ Fail ("sl.constructor-3: does not throw ArgumentNullException");
+ } catch (ArgumentNullException) {}
+ try {
+ d = new Hashtable();
+ d.Add("one", "Mircosoft");
+ d.Add("two", "will");
+ d.Add("three", "rule");
+ d.Add("four", "the world");
+ d.Add(7987,"lkj");
+ temp1 = new SortedList(d);
+ Fail ("sl.constructor-3: does not throw InvalidCastException");
+ } catch (InvalidCastException) { // IS NOT THROWN as stated in MSDN
+ //Console.WriteLine("InvalidCastException Handler: {0}", e.ToString());
+ } catch (InvalidOperationException e) { // instead it throws this
+ Console.WriteLine("sl.constructor-3: [undocumented] InvalidOperationException Handler: {0}", e.ToString());
+ }
+ }
+
+ public void TestConstructor4() {
+ SortedList temp1 = new SortedList(17);
+ AssertNotNull("sl.constructor-4: returns null", temp1);
+ AssertEquals("sl.constructor-4: incorrect initial capacity", temp1.Capacity, 17);
+ try {
+ temp1 = new SortedList(-6);
+ Fail ("sl.constructor-4: does not throw ArgumentOutOfRangeException, with negative values");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ temp1 = new SortedList(0);
+ } catch (ArgumentOutOfRangeException) {
+ Fail ("sl.constructor-4: throws ArgumentOutOfRangeException with 0");
+ }
+ }
+
+ public void TestConstructor5() {
+ Comparer c = Comparer.Default;
+ SortedList temp1 = new SortedList(c,27);
+ AssertNotNull("sl.constructor-5: returns null", temp1);
+ AssertEquals("sl.constructor-5: incorrect initial capacity", temp1.Capacity, 27);
+ try {
+ temp1 = new SortedList(-12);
+ Fail ("sl.constructor-5: does not throw ArgumentOutOfRangeException, with negative values");
+ } catch (ArgumentOutOfRangeException) {}
+ }
+
+ public void TestIsSynchronized() {
+ SortedList sl1 = new SortedList();
+ Assert("sl: should not be synchronized by default",
+ !sl1.IsSynchronized);
+ SortedList sl2 = SortedList.Synchronized(sl1);
+ Assert("sl: synchronized wrapper not working", sl2.IsSynchronized);
+ }
+
+ public void TestCapacity() {
+ for (int i = 0; i < 100; i++) {
+ SortedList sl1 = new SortedList(i);
+ AssertEquals("Bad capacity of " + i,
+ i, sl1.Capacity);
+ }
+ }
+
+ public void TestCount() {
+ {
+ SortedList sl1 = new SortedList();
+ AssertEquals("Bad initial count",
+ 0, sl1.Count);
+ for (int i = 1; i <= 100; i++) {
+ sl1.Add(""+i,""+i);
+ AssertEquals("Bad count " + i,
+ i, sl1.Count);
+ }
+ }
+ }
+
+ public void TestIsFixed() {
+ SortedList sl1 = new SortedList();
+ Assert("should not be fixed by default", !sl1.IsFixedSize);
+ }
+
+ public void TestIsReadOnly() {
+ SortedList sl1 = new SortedList();
+ Assert("should not be ReadOnly by default", !sl1.IsReadOnly);
+ }
+
+
+ public void TestItem() {
+ SortedList sl1 = new SortedList();
+ string key = null;
+ {
+ try {
+ object o = sl1[-1];
+ } catch (ArgumentNullException) {
+ Fail ("sl.Item: throws ArgumentNullException with negative values");
+ }
+ try {
+ object o = sl1[key];
+ Fail ("sl.Item: does not throw ArgumentNullException with null key");
+ } catch (ArgumentNullException) {}
+ }
+
+ for (int i = 0; i <= 100; i++) {
+ sl1.Add("kala "+i,i);
+ }
+ for (int i = 0; i <= 100; i++) {
+ AssertEquals("sl.Item: item not fetched for " + i,
+ i, sl1["kala "+i]);
+ }
+ }
+
+ public void TestSyncRoot()
+ {
+ SortedList sl1 = new SortedList();
+ AssertEquals("sl.SyncRoot: does not function",false, sl1.SyncRoot == null);
+ /*
+ lock( sl1.SyncRoot ) {
+ foreach ( Object item in sl1 ) {
+ item="asdf";
+ Assert ("sl.SyncRoot: item not read-only",item.IsReadOnly);
+ }
+ }
+ */
+ }
+
+ public void TestValues()
+ {
+ SortedList sl1 = new SortedList();
+ ICollection ic1 = sl1.Values;
+ for (int i = 0; i <= 100; i++) {
+ sl1.Add("kala "+i,i);
+ AssertEquals("sl.Values: .Values has different count",ic1.Count,sl1.Count);
+ }
+ }
+
+
+ // TODO: Add with IComparer
+ public void TestAdd() {
+ // seems SortedList cannot be set fixedsize or readonly
+ SortedList sl1 = new SortedList();
+ string key = null;
+ {
+ try {
+ sl1.Add(key,"kala");
+ Fail ("sl.Add: does not throw ArgumentNullException with null key");
+ } catch (ArgumentNullException) {}
+ }
+
+ {
+ for (int i = 1; i <= 100; i++) {
+ sl1.Add("kala "+i,i);
+ AssertEquals("sl.Add: incorrect count",i,sl1.Count);
+ AssertEquals("sl.Add: incorrect value",i,sl1["kala "+i]);
+ }
+ }
+ {
+ try {
+ sl1.Add("kala",10);
+ sl1.Add("kala",11);
+ Fail ("sl.Add: does not throw ArgumentException when adding existing key");
+ } catch (ArgumentException) {}
+ }
+ }
+
+
+ public void TestClear() {
+ {
+ SortedList sl1 = new SortedList(10);
+ sl1.Add("kala",'c');
+ sl1.Add("kala2",'d');
+ AssertEquals("sl.Clear: capacity is incorrect",10, sl1.Capacity);
+ AssertEquals("sl.Clear: should have one element", 2, sl1.Count);
+ sl1.Clear();
+ AssertEquals("sl.Clear: is not cleared",0, sl1.Count);
+ AssertEquals("sl.Clear: capacity is altered",10, sl1.Capacity);
+ }
+ }
+
+ public void TestClone() {
+ {
+ SortedList sl1 = new SortedList(10);
+ for (int i = 0; i <= 50; i++) {sl1.Add("kala "+i,i);}
+ SortedList sl2 = (SortedList)sl1.Clone();
+ for (int i = 0; i <= 50; i++) {
+ AssertEquals("sl.Clone: copying failed @"+i, sl1["kala "+i], sl2["kala "+i]);
+ }
+ }
+ {
+ char[] d10 = {'a', 'b'};
+ char[] d11 = {'a', 'c'};
+ char[] d12 = {'b', 'c'};
+ //char[][] d1 = {d10, d11, d12};
+ SortedList sl1 = new SortedList();
+ sl1.Add("d1",d10);
+ sl1.Add("d2",d11);
+ sl1.Add("d3",d12);
+ SortedList sl2 = (SortedList)sl1.Clone();
+ AssertEquals("sl.Clone: Array not matching", sl1["d1"], sl2["d1"]);
+ AssertEquals("sl.Clone: Array not matching", sl1["d2"], sl2["d2"]);
+ AssertEquals("sl.Clone: Array not matching", sl1["d3"], sl2["d3"]);
+
+ ((char[])sl1["d1"])[0] = 'z';
+ AssertEquals("s1.Clone: shallow copy", sl1["d1"], sl2["d1"]);
+ }
+ }
+
+ public void TestContains() {
+ SortedList sl1 = new SortedList(55);
+ for (int i = 0; i <= 50; i++) {sl1.Add("kala "+i,i);}
+
+ try {
+ if (sl1.Contains(null)){}
+ Fail ("sl.Contains: does not throw ArgumentNullException with null key");
+ } catch (ArgumentNullException) {}
+
+ Assert("sl.Contains: can't find existing key", sl1.Contains("kala 17"));
+ Assert("sl.Contains: finds non-existing key", !sl1.Contains("ohoo"));
+ }
+
+ public void TestContainsKey() {
+ SortedList sl1 = new SortedList(55);
+ for (int i = 0; i <= 50; i++) {sl1.Add("kala "+i,i);}
+
+ try {
+ if (sl1.ContainsKey(null)){}
+ Fail ("sl.ContainsKey: does not throw ArgumentNullException with null key");
+ } catch (ArgumentNullException) {}
+
+ Assert("sl.ContainsKey: can't find existing key", sl1.ContainsKey("kala 17"));
+ Assert("sl.ContainsKey: finds non-existing key", !sl1.ContainsKey("ohoo"));
+ }
+
+ public void TestContainsValue() {
+ SortedList sl1 = new SortedList(55);
+ sl1.Add(0, "zero");
+ sl1.Add(1, "one");
+ sl1.Add(2, "two");
+ sl1.Add(3, "three");
+ sl1.Add(4, "four");
+ Assert("sl.ContainsValue: can't find existing value", sl1.ContainsValue("zero"));
+ Assert("sl.ContainsValue: finds non-existing value", !sl1.ContainsValue("ohoo"));
+ Assert("sl.ContainsValue: finds non-existing value", !sl1.ContainsValue(null));
+ }
+
+ public void TestCopyTo() {
+ SortedList sl1 = new SortedList();
+ for (int i = 0; i <= 10; i++) {sl1.Add("kala "+i,i);}
+ {
+ try {
+ sl1.CopyTo(null, 2);
+ Fail("sl.CopyTo: does not throw ArgumentNullException when target null");
+ } catch (ArgumentNullException) {}
+ }
+ {
+ try {
+ Char[,] c2 = new Char[2,2];
+ sl1.CopyTo(c2, 2);
+ Fail("sl.CopyTo: does not throw ArgumentException when target is multiarray");
+ } catch (ArgumentException) {}
+ }
+ {
+ try {
+ Char[] c1 = new Char[2];
+ sl1.CopyTo(c1, -2);
+ Fail("sl.CopyTo: does not throw ArgumentOutOfRangeException when index is negative");
+ } catch (ArgumentOutOfRangeException) {}
+ }
+ {
+ try {
+ Char[] c1 = new Char[2];
+ sl1.CopyTo(c1, 3);
+ Fail("sl.CopyTo: does not throw ArgumentException when index is too large");
+ } catch (ArgumentException) {}
+ }
+ {
+ try {
+ Char[] c1 = new Char[2];
+ sl1.CopyTo(c1, 1);
+ Fail("sl.CopyTo: does not throw ArgumentException when SortedList too big for the array");
+ } catch (ArgumentException) {}
+ }
+ {
+ try {
+ Char[] c2 = new Char[15];
+ sl1.CopyTo(c2, 0);
+ Fail("sl.CopyTo: does not throw InvalidCastException when incompatible data types");
+ } catch (InvalidCastException) {}
+ }
+
+ // CopyTo function does not work well with SortedList
+ // even example at MSDN gave InvalidCastException
+ // thus, it is NOT testet here
+ /*
+ sl1.Clear();
+ for (int i = 0; i <= 5; i++) {sl1.Add(i,""+i);}
+ Char[] copy = new Char[15];
+ Array.Clear(copy,0,copy.Length);
+ copy.SetValue( "The", 0 );
+ copy.SetValue( "quick", 1 );
+ copy.SetValue( "brown", 2 );
+ copy.SetValue( "fox", 3 );
+ copy.SetValue( "jumped", 4 );
+ copy.SetValue( "over", 5 );
+ copy.SetValue( "the", 6 );
+ copy.SetValue( "lazy", 7 );
+ copy.SetValue( "dog", 8 );
+ sl1.CopyTo(copy,1);
+ AssertEquals("sl.CopyTo: incorrect copy(1).","The", copy.GetValue(0));
+ AssertEquals("sl.CopyTo: incorrect copy(1).","quick", copy.GetValue(1));
+ for (int i=2; i<8; i++) AssertEquals("sl.CopyTo: incorrect copy(2).",sl1["kala "+(i-2)], copy.GetValue(i));
+ AssertEquals("sl.CopyTo: incorrect copy(3).","dog", copy.GetValue(8));
+ */
+ }
+
+ public SortedList DefaultSL() {
+ SortedList sl1 = new SortedList();
+ sl1.Add( 1.0, "The" );
+ sl1.Add( 1.1, "quick" );
+ sl1.Add( 34.0, "brown" );
+ sl1.Add( -100.75, "fox" );
+ sl1.Add( 1.4, "jumped" );
+ sl1.Add( 1.5, "over" );
+ sl1.Add( 1.6, "the" );
+ sl1.Add( 1.7, "lazy" );
+ sl1.Add( 1.8, "dog" );
+ return sl1;
+ }
+
+ public IList DefaultValues() {
+ IList il = new ArrayList();
+ il.Add( "fox" );
+ il.Add( "The" );
+ il.Add( "quick" );
+ il.Add( "jumped" );
+ il.Add( "over" );
+ il.Add( "the" );
+ il.Add( "lazy" );
+ il.Add( "dog" );
+ il.Add( "brown" );
+ return il;
+ }
+
+ public void TestGetByIndex() {
+ SortedList sl1 = DefaultSL();
+ AssertEquals("cl.GetByIndex: failed(1)",sl1.GetByIndex(4),"over");
+ AssertEquals("cl.GetByIndex: failed(2)",sl1.GetByIndex(8),"brown");
+ try {
+ sl1.GetByIndex(-1);
+ Fail("sl.GetByIndex: does not throw ArgumentOutOfRangeException with negative index");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ sl1.GetByIndex(100);
+ Fail("sl.GetByIndex: does not throw ArgumentOutOfRangeException with too large index");
+ } catch (ArgumentOutOfRangeException) {}
+ }
+
+ public void TestGetEnumerator() {
+ SortedList sl1 = DefaultSL();
+ IDictionaryEnumerator e = sl1.GetEnumerator();
+ AssertNotNull("sl.GetEnumerator: does not return enumerator", e);
+ AssertEquals("sl.GetEnumerator: enumerator not working(1)",e.MoveNext(),true);
+ AssertNotNull("sl.GetEnumerator: enumerator not working(2)",e.Current);
+ }
+
+ public void TestGetKey() {
+ SortedList sl1 = DefaultSL();
+ AssertEquals("sl.GetKey: failed(1)",sl1.GetKey(4),1.5);
+ AssertEquals("sl.GetKey: failed(2)",sl1.GetKey(8),34.0);
+ try {
+ sl1.GetKey(-1);
+ Fail("sl.GetKey: does not throw ArgumentOutOfRangeException with negative index");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ sl1.GetKey(100);
+ Fail("sl.GetKey: does not throw ArgumentOutOfRangeException with too large index");
+ } catch (ArgumentOutOfRangeException) {}
+ }
+
+ public void TestGetKeyList() {
+ SortedList sl1 = DefaultSL();
+ IList keys = sl1.GetKeyList();
+ AssertNotNull("sl.GetKeyList: does not return keylist", keys);
+ Assert("sl.GetKeyList: keylist is not readonly", keys.IsReadOnly);
+ AssertEquals("sl.GetKeyList: incorrect keylist size",keys.Count,9);
+ AssertEquals("sl.GetKeyList: incorrect key(1)",keys[3],1.4);
+ sl1.Add(33.9,"ehhe");
+ AssertEquals("sl.GetKeyList: incorrect keylist size",keys.Count,10);
+ AssertEquals("sl.GetKeyList: incorrect key(2)",keys[8],33.9);
+ }
+
+ public void TestGetValueList() {
+ SortedList sl1 = DefaultSL();
+ IList originalvals = DefaultValues();
+ IList vals = sl1.GetValueList();
+ AssertNotNull("sl.GetValueList: does not return valuelist", vals);
+ Assert("sl.GetValueList: valuelist is not readonly", vals.IsReadOnly);
+ AssertEquals("sl.GetValueList: incorrect valuelist size",vals.Count,sl1.Count);
+ for (int i=0; i<sl1.Count; i++) {
+ AssertEquals("sl.GetValueList: incorrect key(1)",vals[i],originalvals[i]);
+ }
+
+ sl1.Add(0.01,"ehhe");
+ AssertEquals("sl.GetValueList: incorrect valuelist size",vals.Count,10);
+ AssertEquals("sl.GetValueList: incorrect value(2)",vals[8],"dog");
+ }
+
+ // TODO: IEnumerable.GetEnumerator [Explicit Interface Implementation]
+ /*
+ public void TestIEnumerable_GetEnumerator() {
+ SortedList sl1 = DefaultSL();
+ IEnumerator e = sl1.IEnumerable.GetEnumerator();
+ AssertNotNull("sl.GetEnumerator: does not return enumerator", e);
+ AssertEquals("sl.GetEnumerator: enumerator not working(1)",e.MoveNext(),true);
+ AssertNotNull("sl.GetEnumerator: enumerator not working(2)",e.Current);
+ }
+ */
+
+ public void TestIndexOfKey() {
+ SortedList sl1 = new SortedList(24);
+ string s=null;
+ int t;
+ for (int i = 0; i <= 50; i++) {
+ s=string.Format("{0:D2}", i);
+ sl1.Add("kala "+s,i);
+ }
+ AssertEquals("sl.IndexOfKey: does not return -1 for non-existing key",sl1.IndexOfKey("kala "),-1);
+ s=null;
+ try {
+ t=sl1.IndexOfKey(s);
+ Fail("sl.IndexOfKey: ArgumentNullException not caught, when key is null");
+ }
+ catch (ArgumentNullException) {}
+ try {
+ t=sl1.IndexOfKey(10);
+ Fail("sl.IndexOfKey: InvalidOperationException not caught, when key invalid");
+ }
+ catch (InvalidOperationException) {}
+ for (int i=0; i<=50; i++) {
+ s=string.Format("{0:D2}", i);
+ AssertEquals("sl.IndexOfKey: incorrect index key",sl1.IndexOfKey("kala "+s),i);
+ }
+ }
+
+ public void TestIndexOfValue() {
+ SortedList sl1 = new SortedList(24);
+ string s=null;
+ for (int i = 0; i < 50; i++) {
+ s=string.Format("{0:D2}", i);
+ sl1.Add("kala "+s,100+i*i);
+ }
+ for (int i = 0; i < 50; i++) {
+ s=string.Format("{0:D2}", i+50);
+ sl1.Add("kala "+s,100+i*i);
+ }
+ AssertEquals("sl.IndexOfValue: does not return -1 for non-existing value(1)",sl1.IndexOfValue(102),-1);
+ AssertEquals("sl.IndexOfValue: does not return -1 for non-existing value(2)",sl1.IndexOfValue(null),-1);
+ for (int i=0; i<50; i++) {
+ AssertEquals("sl.IndexOfValue: incorrect index key",sl1.IndexOfValue(100+i*i),i);
+ }
+ }
+
+
+ public void TestRemove() {
+ SortedList sl1 = new SortedList(24);
+ string s=null;
+ int k;
+ for (int i = 0; i < 50; i++) sl1.Add("kala "+i,i);
+
+ try {
+ sl1.Remove(s);
+ Fail("sl.Remove: ArgumentNullException not caught, when key is null");
+ } catch (ArgumentNullException) {}
+ k=sl1.Count;
+ sl1.Remove("kala ");
+ AssertEquals("sl.Remove: removes an item, when non-existing key given",sl1.Count,k);
+ try {
+ sl1.Remove(15);
+ Fail("sl.Remove: IComparer exception is not thrown");
+ } catch (Exception) {}
+
+ for (int i=15; i<20; i++) sl1.Remove("kala "+i);
+ for (int i=45; i<55; i++) sl1.Remove("kala "+i);
+
+ AssertEquals("sl.Remove: removing failed",sl1.Count,40);
+ for (int i=45; i<55; i++)
+ AssertEquals("sl.Remove: removing failed(2)",sl1["kala "+i],null);
+ }
+
+ public void TestRemoveAt() {
+ SortedList sl1 = new SortedList(24);
+ int k;
+ string s=null;
+ for (int i = 0; i < 50; i++) {
+ s=string.Format("{0:D2}", i);
+ sl1.Add("kala "+s,i);
+ }
+
+ try {
+ sl1.RemoveAt(-1);
+ Fail("sl.RemoveAt: ArgumentOutOfRangeException not caught, when key is out of range");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ sl1.RemoveAt(100);
+ Fail("sl.RemoveAt: ArgumentOutOfRangeException not caught, when key is out of range");
+ } catch (ArgumentOutOfRangeException) {}
+ k=sl1.Count;
+
+ for (int i=0; i<20; i++) sl1.RemoveAt(9);
+
+ AssertEquals("sl.RemoveAt: removing failed",sl1.Count,30);
+ for (int i=0; i<9; i++)
+ AssertEquals("sl.RemoveAt: removing failed(2)",sl1["kala "+string.Format("{0:D2}", i)],i);
+ for (int i=9; i<29; i++)
+ AssertEquals("sl.RemoveAt: removing failed(3)",sl1["kala "+string.Format("{0:D2}", i)],null);
+ for (int i=29; i<50; i++)
+ AssertEquals("sl.RemoveAt: removing failed(4)",sl1["kala "+string.Format("{0:D2}", i)],i);
+ }
+
+ public void TestSetByIndex() {
+ SortedList sl1 = new SortedList(24);
+ for (int i = 49; i>=0; i--) sl1.Add(100+i,i);
+
+ try {
+ sl1.SetByIndex(-1,77);
+ Fail("sl.SetByIndex: ArgumentOutOfRangeException not caught, when key is out of range");
+ } catch (ArgumentOutOfRangeException) {}
+ try {
+ sl1.SetByIndex(100,88);
+ Fail("sl.SetByIndex: ArgumentOutOfRangeException not caught, when key is out of range");
+ } catch (ArgumentOutOfRangeException) {}
+
+ for(int i=5; i<25; i++) sl1.SetByIndex(i,-1);
+ for(int i=0; i<5; i++)
+ AssertEquals("sl.SetByIndex: set failed(1)",sl1[100+i],i);
+ for(int i=5; i<25; i++)
+ AssertEquals("sl.SetByIndex: set failed(2)",sl1[100+i],-1);
+ for(int i=25; i<50; i++)
+ AssertEquals("sl.SetByIndex: set failed(3)",sl1[100+i],i);
+
+ }
+
+ public void TestTrimToSize() {
+ SortedList sl1 = new SortedList(24);
+
+ sl1.TrimToSize();
+ AssertEquals("sl.TrimToSize: incorrect capacity after trimming empty list",icap,sl1.Capacity);
+
+ for (int i = 72; i>=0; i--) sl1.Add(100+i,i);
+ sl1.TrimToSize();
+ AssertEquals("sl.TrimToSize: incorrect capacity after trimming a list",73,sl1.Capacity);
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Collections/StackTest.cs b/mcs/class/corlib/Test/System.Collections/StackTest.cs
new file mode 100644
index 00000000000..fdcc3b07cce
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Collections/StackTest.cs
@@ -0,0 +1,270 @@
+//
+// StackTest.cs
+//
+// Author:
+// Chris Hynes <chrish@assistedsolutions.com>
+//
+// (C) 2001 Chris Hynes
+//
+
+using System;
+
+using System.Collections;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Collections
+{
+ public class StackTest: TestCase
+ {
+ private Stack stack1;
+ private Stack stack2;
+ private Stack stackInt;
+
+ public void TestConstructor()
+ {
+ AssertEquals(false, stack1 == null);
+ }
+
+ public void TestICollectionConstructor()
+ {
+ Stack stackTest = new Stack(new int[] {0, 1, 2, 3, 4});
+
+ for (int i = 4; i >= 0; i--)
+ AssertEquals(i, stackTest.Pop());
+
+ AssertEquals(0, stackTest.Count);
+ }
+
+ public void TestIntConstructor()
+ {
+ Stack stackTest = new Stack(50);
+
+ AssertEquals(false, stackTest == null);
+ }
+
+ public void TestCount()
+ {
+ Stack stackTest = new Stack();
+
+ stackTest.Push(50);
+ stackTest.Push(5);
+ stackTest.Push(0);
+ stackTest.Push(50);
+
+ AssertEquals(4, stackTest.Count);
+ }
+
+ public void TestIsSyncronized()
+ {
+ AssertEquals(false, stack1.IsSynchronized);
+ AssertEquals(true, Stack.Synchronized(stack1).IsSynchronized);
+ }
+
+ public void TestSyncRoot()
+ {
+ AssertEquals(false, stack1.SyncRoot == null);
+ }
+
+ public void TestGetEnumerator()
+ {
+ stackInt.Pop();
+
+ int j = 3;
+
+ foreach (int i in stackInt)
+ {
+ AssertEquals(j--, i);
+ }
+
+ stackInt.Clear();
+
+ IEnumerator e = stackInt.GetEnumerator();
+
+ AssertEquals(false, e.MoveNext());
+ }
+
+ public void TestClear()
+ {
+ stackInt.Clear();
+
+ AssertEquals(0, stackInt.Count);
+ }
+
+ public void TestClone()
+ {
+ Stack clone = (Stack)stackInt.Clone();
+
+ while (stackInt.Count > 0)
+ {
+ AssertEquals(stackInt.Pop(), clone.Pop());
+ }
+ }
+
+ public void TestContains()
+ {
+ string toLocate = "test";
+
+ stackInt.Push(toLocate);
+
+ stackInt.Push("chaff");
+
+ Assert(stackInt.Contains(toLocate));
+
+ stackInt.Pop();
+
+ Assert(stackInt.Contains(toLocate));
+
+ stackInt.Pop();
+
+ Assert(!stackInt.Contains(toLocate));
+ }
+
+ public void TestCopyTo()
+ {
+ int[] arr = new int[stackInt.Count - 1];
+ int[,] arrMulti;
+
+ try
+ {
+ stackInt.CopyTo(null, 0);
+ Fail("Should throw an ArgumentNullException");
+ }
+ catch (ArgumentNullException) {}
+
+ try
+ {
+ stackInt.CopyTo(arr, -1);
+ Fail("Should throw an ArgumentOutOfRangeException");
+ }
+ catch (ArgumentOutOfRangeException) {}
+
+ try
+ {
+ stackInt.CopyTo(arrMulti = new int[1, 1], 1);
+ Fail("Should throw an ArgumentException");
+ }
+ catch (ArgumentException) {}
+
+ try
+ {
+ stackInt.CopyTo(arr = new int[2], 3);
+ Fail("Should throw an ArgumentException");
+ }
+ catch (ArgumentException) {}
+
+ try
+ {
+ stackInt.CopyTo(arr = new int[3], 2);
+ Fail("Should throw an ArgumentException");
+ }
+ catch (ArgumentException) {}
+
+ try
+ {
+ stackInt.CopyTo(arr = new int[2], 3);
+ Fail("Should throw an ArgumentException");
+ }
+ catch (ArgumentException) {}
+
+ arr = new int[stackInt.Count];
+
+ stackInt.CopyTo(arr, 0);
+
+ int j = 4;
+
+ for (int i = 0; i < 4; i++)
+ {
+ AssertEquals(j--, arr[i]);
+ }
+ }
+
+ public void TestSyncronized()
+ {
+ Stack syncStack = Stack.Synchronized(stackInt);
+
+ syncStack.Push(5);
+
+ for (int i = 5; i >= 0; i--)
+ AssertEquals(i, syncStack.Pop());
+ }
+
+ public void TestPushPeekPop()
+ {
+ stackInt.Pop();
+
+ int topVal = (int)stackInt.Peek();
+
+ AssertEquals(3, topVal);
+
+ AssertEquals(4, stackInt.Count);
+
+ AssertEquals(topVal, stackInt.Pop());
+
+ AssertEquals(2, stackInt.Pop());
+
+ Stack test = new Stack();
+ test.Push(null);
+
+ AssertEquals(null, test.Pop());
+ }
+
+ public void TestToArray()
+ {
+ object[] arr = stackInt.ToArray();
+
+ AssertEquals(stackInt.Count, arr.Length);
+
+ for (int i = 0; i < 5; i++)
+ AssertEquals(arr[i], stackInt.Pop());
+ }
+
+ static void Main(string[] args)
+ {
+ //
+ // TODO: Add code to start application here
+ //
+ }
+
+ protected override void SetUp()
+ {
+ stack1 = new Stack();
+ stack2 = new Stack();
+
+ stackInt = new Stack();
+
+ for (int i = 0; i < 5; i++)
+ stackInt.Push(i);
+ }
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite stackSuite = new TestSuite();
+
+ stackSuite.AddTest(new StackTest("TestConstructor"));
+ stackSuite.AddTest(new StackTest("TestICollectionConstructor"));
+ stackSuite.AddTest(new StackTest("TestIntConstructor"));
+
+ stackSuite.AddTest(new StackTest("TestCount"));
+ stackSuite.AddTest(new StackTest("TestIsSyncronized"));
+ stackSuite.AddTest(new StackTest("TestSyncRoot"));
+
+ stackSuite.AddTest(new StackTest("TestGetEnumerator"));
+ stackSuite.AddTest(new StackTest("TestClear"));
+ stackSuite.AddTest(new StackTest("TestClone"));
+ stackSuite.AddTest(new StackTest("TestContains"));
+ stackSuite.AddTest(new StackTest("TestPushPeekPop"));
+ stackSuite.AddTest(new StackTest("TestCopyTo"));
+ stackSuite.AddTest(new StackTest("TestSyncronized"));
+ stackSuite.AddTest(new StackTest("TestToArray"));
+
+ return stackSuite;
+ }
+ }
+
+ public StackTest() : base ("MonoTests.System.Collections.StackTest testcase") {}
+ public StackTest(string name): base(name) {}
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Diagnostics/AllTests.cs b/mcs/class/corlib/Test/System.Diagnostics/AllTests.cs
new file mode 100644
index 00000000000..d97f4ad2277
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/AllTests.cs
@@ -0,0 +1,31 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(StackTraceTest.Suite);
+ suite.AddTest(StackFrameTest.Suite);
+ suite.AddTest(TextWriterTraceListenerTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Diagnostics/ChangeLog b/mcs/class/corlib/Test/System.Diagnostics/ChangeLog
new file mode 100644
index 00000000000..a679bf57b2e
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/ChangeLog
@@ -0,0 +1,4 @@
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * DebugTest.cs: Put in correct namespace.
+ * TextWriterTraceListenerTest.cs: Put in correct namespace. \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Diagnostics/DebugTest.cs b/mcs/class/corlib/Test/System.Diagnostics/DebugTest.cs
new file mode 100644
index 00000000000..5d620ea5813
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/DebugTest.cs
@@ -0,0 +1,89 @@
+//
+// MonoTests.System.Diagnostics.DebugTest.cs
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+//
+// (C) 2002
+using System;
+using System.Diagnostics;
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics
+{
+ public class DebugTest
+ {
+ private DebugTest()
+ {
+
+ }
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(DebugTest1.Suite);
+ return suite;
+ }
+ }
+
+ private class DebugTest1 : TestCase
+ {
+ public DebugTest1(string name) : base(name)
+ {
+
+ }
+
+ internal static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(DebugTest1));
+ }
+ }
+
+ protected override void SetUp()
+ {
+ Debug.Listeners.Add(new TextWriterTraceListener(Console.Error));
+ }
+
+ protected override void TearDown()
+ {
+
+ }
+
+ public void TestAssert()
+ {
+ Debug.Assert(false, "Testing Assertions");
+ }
+
+ public void TestFail()
+ {
+ Debug.Fail("Testing Fail method");
+ }
+
+ public void TestWrite()
+ {
+ Debug.Write("Testing Write", "Testing the output of the Write method");
+ }
+
+ public void TestWriteIf()
+ {
+ Debug.WriteIf(true, "Testing WriteIf");
+ Debug.WriteIf(false, "Testing WriteIf", "Passed false");
+ }
+
+ public void TestWriteLine()
+ {
+ Debug.WriteLine("Testing WriteLine method");
+ }
+
+ public void TestWriteLineIf()
+ {
+ Debug.WriteLineIf(true, "Testing WriteLineIf");
+ Debug.WriteLineIf(false, "Testing WriteLineIf", "Passed false");
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs b/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs
new file mode 100644
index 00000000000..36666a39471
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/StackFrameTest.cs
@@ -0,0 +1,350 @@
+//
+// Ximian.Mono.Tests.StackFrameTest.cs
+//
+// Author:
+// Alexander Klyubin (klyubin@aqris.com)
+//
+// (C) 2001
+//
+
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics {
+ public class StackFrameTest {
+ private StackFrameTest() {}
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(StackFrameTest1.Suite);
+ suite.AddTest(StackFrameTest2.Suite);
+ suite.AddTest(StackFrameTest3.Suite);
+ return suite;
+ }
+ }
+
+ /// <summary>
+ /// Tests the case where StackFrame is created for specified file name and
+ /// location inside it.
+ /// </summary>
+ private class StackFrameTest1 : TestCase {
+ public StackFrameTest1(string name) : base(name) {}
+
+ private StackFrame frame1;
+ private StackFrame frame2;
+
+ internal static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(StackFrameTest1));
+ }
+ }
+
+ protected override void SetUp() {
+ frame1 = new StackFrame("dir/someFile", 13, 45);
+ frame2 = new StackFrame("SomeFile2.cs", 24);
+ }
+
+ protected override void TearDown() {
+ frame1 = null;
+ frame2 = null;
+ }
+
+
+
+ /// <summary>
+ /// Tests whether getting file name works.
+ /// </summary>
+ public void TestGetFileName() {
+ AssertEquals("File name (1)",
+ "dir/someFile",
+ frame1.GetFileName());
+
+ AssertEquals("File name (2)",
+ "SomeFile2.cs",
+ frame2.GetFileName());
+ }
+
+ /// <summary>
+ /// Tests whether getting file line number works.
+ /// </summary>
+ public void TestGetFileLineNumber() {
+ AssertEquals("Line number (1)",
+ 13,
+ frame1.GetFileLineNumber());
+
+ AssertEquals("Line number (2)",
+ 24,
+ frame2.GetFileLineNumber());
+ }
+
+ /// <summary>
+ /// Tests whether getting file column number works.
+ /// </summary>
+ public void TestGetFileColumnNumber() {
+ AssertEquals("Column number (1)",
+ 45,
+ frame1.GetFileColumnNumber());
+
+ AssertEquals("Column number (2)",
+ 0,
+ frame2.GetFileColumnNumber());
+ }
+
+
+ /// <summary>
+ /// Tests whether getting method associated with frame works.
+ /// </summary>
+ public void TestGetMethod() {
+ Assert("Method not null (1)", (frame1.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (1)",
+ this.GetType(),
+ frame1.GetMethod().DeclaringType);
+ AssertEquals("Method name (1)",
+ "SetUp",
+ frame1.GetMethod().Name);
+
+ Assert("Method not null (2)", (frame2.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (2)",
+ this.GetType(),
+ frame2.GetMethod().DeclaringType);
+ AssertEquals("Method name (2)",
+ "SetUp",
+ frame2.GetMethod().Name);
+ }
+ }
+
+ /// <summary>
+ /// Tests the case where StackFrame is created for current method.
+ /// </summary>
+ /// <remarks>
+ /// FIXME: Must be compiled with /debug switch. Otherwise some file
+ /// information will be incorrect for the following test cases.
+ /// What's the best way to do both types of tests with and without
+ /// debug information?
+ /// </remarks>
+ private class StackFrameTest2 : TestCase {
+ public StackFrameTest2(string name) : base(name) {}
+
+ private StackFrame frame1;
+ private StackFrame frame2;
+ private StackFrame frame3;
+
+ internal static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(StackFrameTest2));
+ }
+ }
+
+ protected override void SetUp() {
+ frame1 = new StackFrame();
+ frame2 = new StackFrame(true);
+ frame3 = new StackFrame(0);
+ }
+
+ protected override void TearDown() {
+ frame1 = null;
+ frame2 = null;
+ frame3 = null;
+ }
+
+
+
+ /// <summary>
+ /// Tests whether getting file name works.
+ /// </summary>
+ public void TestGetFileName() {
+ AssertNull("File name (1)",
+ frame1.GetFileName());
+
+ Assert("File name (2) " + frame2.GetFileName()
+ + " ends with StackFrameTest.cs",
+ frame2.GetFileName().EndsWith("StackFrameTest.cs"));
+ }
+
+ /// <summary>
+ /// Tests whether getting file line number works.
+ /// </summary>
+ public void TestGetFileLineNumber() {
+ AssertEquals("Line number (1)",
+ 0,
+ frame1.GetFileLineNumber());
+
+ AssertEquals("Line number (2)",
+ 154,
+ frame2.GetFileLineNumber());
+
+ AssertEquals("Line number (3)",
+ 0,
+ frame3.GetFileLineNumber());
+ }
+
+ /// <summary>
+ /// Tests whether getting file column number works.
+ /// </summary>
+ public void TestGetFileColumnNumber() {
+ AssertEquals("Column number (1)",
+ 0,
+ frame1.GetFileColumnNumber());
+
+ AssertEquals("Column number (2)",
+ 25,
+ frame2.GetFileColumnNumber());
+
+ AssertEquals("Column number (3)",
+ 0,
+ frame3.GetFileColumnNumber());
+ }
+
+
+ /// <summary>
+ /// Tests whether getting method associated with frame works.
+ /// </summary>
+ public void TestGetMethod() {
+ Assert("Method not null (1)",
+ (frame1.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (1)",
+ this.GetType(),
+ frame1.GetMethod().DeclaringType);
+ AssertEquals("Method name (1)",
+ "SetUp",
+ frame1.GetMethod().Name);
+
+ Assert("Method not null (2)",
+ (frame2.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (2)",
+ this.GetType(),
+ frame2.GetMethod().DeclaringType);
+ AssertEquals("Method name (2)",
+ "SetUp",
+ frame2.GetMethod().Name);
+
+ Assert("Method not null (3)",
+ (frame3.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (3)",
+ this.GetType(),
+ frame3.GetMethod().DeclaringType);
+ AssertEquals("Method name (3)",
+ "SetUp",
+ frame3.GetMethod().Name);
+ }
+ }
+
+
+ /// <summary>
+ /// Tests the case where StackFrame is created for current method but
+ /// skipping some frames.
+ /// </summary>
+ /// <remarks>
+ /// FIXME: Must be compiled with /debug switch. Otherwise some file
+ /// information will be incorrect for the following test cases.
+ /// What's the best way to do both types of tests with and without
+ /// debug information?
+ /// </remarks>
+ private class StackFrameTest3 : TestCase {
+ public StackFrameTest3(string name) : base(name) {}
+
+ private StackFrame frame1;
+ private StackFrame frame2;
+
+ internal static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(StackFrameTest3));
+ }
+ }
+
+ protected override void SetUp() {
+ // In order to get better test cases with stack traces
+ NestedSetUp();
+ }
+
+ private void NestedSetUp() {
+ frame1 = new StackFrame(2);
+ frame2 = new StackFrame(1, true);
+ }
+
+ protected override void TearDown() {
+ frame1 = null;
+ frame2 = null;
+ }
+
+
+
+ /// <summary>
+ /// Tests whether getting file name works.
+ /// </summary>
+ public void TestGetFileName() {
+ AssertNull("File name (1)",
+ frame1.GetFileName());
+
+ Assert("File name (2) " + frame2.GetFileName()
+ + " ends with StackFrameTest.cs",
+ frame2.GetFileName().EndsWith("StackFrameTest.cs"));
+ }
+
+ /// <summary>
+ /// Tests whether getting file line number works.
+ /// </summary>
+ public void TestGetFileLineNumber() {
+ AssertEquals("Line number (1)",
+ 0,
+ frame1.GetFileLineNumber());
+
+ AssertEquals("Line number (2)",
+ 277,
+ frame2.GetFileLineNumber());
+ }
+
+ /// <summary>
+ /// Tests whether getting file column number works.
+ /// </summary>
+ public void TestGetFileColumnNumber() {
+ AssertEquals("Column number (1)",
+ 0,
+ frame1.GetFileColumnNumber());
+
+ AssertEquals("Column number (2)",
+ 17,
+ frame2.GetFileColumnNumber());
+ }
+
+
+ /// <summary>
+ /// Tests whether getting method associated with frame works.
+ /// </summary>
+ public void TestGetMethod() {
+ Assert("Method not null (1)", (frame1.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (1)",
+ typeof(NUnit.Framework.TestCase),
+ frame1.GetMethod().DeclaringType);
+ AssertEquals("Method name (1)",
+ "RunBare",
+ frame1.GetMethod().Name);
+
+ Assert("Method not null (2)", (frame2.GetMethod() != null));
+
+ AssertEquals("Class declaring the method (2)",
+ this.GetType(),
+ frame2.GetMethod().DeclaringType);
+ AssertEquals("Method name (2)",
+ "SetUp",
+ frame2.GetMethod().Name);
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Diagnostics/StackTraceTest.cs b/mcs/class/corlib/Test/System.Diagnostics/StackTraceTest.cs
new file mode 100644
index 00000000000..1469a7c83aa
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/StackTraceTest.cs
@@ -0,0 +1,98 @@
+//
+// Ximian.Mono.Tests.StackTraceTest.cs
+//
+// Author:
+// Alexander Klyubin (klyubin@aqris.com)
+//
+// (C) 2001
+//
+
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics {
+ public class StackTraceTest {
+ private StackTraceTest() {}
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(StackTraceTest1.Suite);
+ return suite;
+ }
+ }
+
+ /// <summary>
+ /// Tests the case where StackTrace is created for specified
+ /// stack frame.
+ /// </summary>
+ private class StackTraceTest1 : TestCase {
+ public StackTraceTest1(string name) : base(name) {}
+
+ private StackTrace trace;
+ private StackFrame frame;
+
+ internal static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(StackTraceTest1));
+ }
+ }
+
+ protected override void SetUp() {
+ frame = new StackFrame("dir/someFile",
+ 13,
+ 45);
+ trace = new StackTrace(frame);
+ }
+
+ protected override void TearDown() {
+ trace = null;
+ }
+
+
+
+ /// <summary>
+ /// Tests whether getting number of frames works.
+ /// </summary>
+ public void TestFrameCount() {
+ AssertEquals("Frame count",
+ 1,
+ trace.FrameCount);
+ }
+
+ /// <summary>
+ /// Tests whether getting frames by index which is out of
+ /// range works.
+ /// </summary>
+ public void TestGetFrameOutOfRange() {
+ Assert("Frame with index -1 == null",
+ (trace.GetFrame(-1) == null));
+
+ Assert("Frame with index -129 = null",
+ (trace.GetFrame(-129) == null));
+
+ Assert("Frame with index 1 = null",
+ (trace.GetFrame(1) == null));
+
+ Assert("Frame with index 145 = null",
+ (trace.GetFrame(145) == null));
+
+ }
+
+
+ /// <summary>
+ /// Tests whether getting frames by index works.
+ /// </summary>
+ public void TestGetFrame() {
+ AssertEquals("Frame with index 0",
+ frame,
+ trace.GetFrame(0));
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Diagnostics/TextWriterTraceListenerTest.cs b/mcs/class/corlib/Test/System.Diagnostics/TextWriterTraceListenerTest.cs
new file mode 100644
index 00000000000..c7cc8e35b90
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Diagnostics/TextWriterTraceListenerTest.cs
@@ -0,0 +1,83 @@
+//
+// MonoTests.System.Diagnostics.TextWriterTraceListenerTest.cs
+//
+// Author:
+// John R. Hicks (angryjohn69@nc.rr.com)
+//
+// (C) 2001
+
+using System;
+using System.IO;
+using System.Text;
+using System.Diagnostics;
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics
+{
+
+ public class TextWriterTraceListenerTest
+ {
+ private TextWriterTraceListenerTest()
+ {
+
+ }
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(TextWriterTraceListenerTest1.Suite);
+ return suite;
+ }
+ }
+
+ private class TextWriterTraceListenerTest1 : TestCase
+ {
+ public TextWriterTraceListenerTest1(string name) : base(name)
+ {
+ }
+
+ private TextWriterTraceListener listener;
+
+ internal static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(TextWriterTraceListenerTest1));
+ }
+ }
+
+ protected override void SetUp()
+ {
+ listener = new TextWriterTraceListener();
+ listener.Writer = Console.Out;
+ }
+
+ protected override void TearDown()
+ {
+ listener = null;
+ }
+
+ public void TestWrite()
+ {
+ Assert("Null Listener", !(listener == null));
+ Assert("Null Writer", !(listener.Writer == null));
+ listener.Write("Test Message\n");
+
+ }
+
+ public void TestWriteLine()
+ {
+ Assert("Null Listener", !(listener == null));
+ Assert("Null Writer", !(listener.Writer == null));
+ listener.WriteLine("Test WriteLine Message");
+ }
+
+ public void TestFlush()
+ {
+ listener.Flush();
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Globalization/AllTests.cs b/mcs/class/corlib/Test/System.Globalization/AllTests.cs
new file mode 100644
index 00000000000..7d80e617556
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Globalization/AllTests.cs
@@ -0,0 +1,28 @@
+// System.Globalization/AllTests.cs
+//
+// (C) 2002 Ulrich Kunitz
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Globalization {
+
+/// <summary>
+/// Combines all available unit tests into one test suite.
+/// </summary>
+public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(CalendarTest.Suite);
+ return suite;
+ }
+ }
+} // class AllTests
+
+} // namespace MonoTests.System.Globalization
diff --git a/mcs/class/corlib/Test/System.Globalization/CalendarTest.cs b/mcs/class/corlib/Test/System.Globalization/CalendarTest.cs
new file mode 100644
index 00000000000..83d6b68ea91
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Globalization/CalendarTest.cs
@@ -0,0 +1,602 @@
+// CalendarTest.cs
+//
+// (C) 2002 Ulrich Kunitz
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+using System.IO;
+
+namespace MonoTests.System.Globalization
+{
+
+sealed class Date {
+ private int _day, _month, _year, _era;
+
+ public int Day {
+ get {
+ return _day;
+ }
+ set {
+ if (value < 1 || value > 31)
+ throw new ArgumentOutOfRangeException(
+ "Day",
+ "Day must be between 1 and 31.");
+ _day = value;
+ }
+ }
+
+ public int Month {
+ get {
+ return _month;
+ }
+ set {
+ if (value < 1 || value > 13)
+ throw new ArgumentOutOfRangeException(
+ "Month",
+ "Month must be between 1 and 13.");
+ _month = value;
+ }
+ }
+
+ public int Year {
+ get {
+ return _year;
+ }
+ set {
+ _year = value;
+ }
+ }
+
+ public int Era {
+ get {
+ return _era;
+ }
+ set {
+ if (value < 1 || value > 10)
+ throw new ArgumentOutOfRangeException(
+ "Era",
+ "Era must be between 1 and 10.");
+ _era = value;
+ }
+ }
+
+ public Date(int day, int month, int year, int era) {
+ Day = day;
+ Month = month;
+ Year = year;
+ Era = era;
+ }
+ public Date(int day, int month, int year) : this(day,month,year,1) {}
+ public Date() : this(1,1,1,1) {}
+
+ public DateTime ToDateTime(Calendar cal) {
+ return cal.ToDateTime(Year,Month,Day,0,0,0,0,Era);
+ }
+
+ public void FromDateTime(Calendar cal, DateTime time) {
+ Date dmy = new Date();
+ dmy.Day = cal.GetDayOfMonth(time);
+ dmy.Month = cal.GetMonth(time);
+ dmy.Year = cal.GetYear(time);
+ dmy.Era = cal.GetEra(time);
+ Day = dmy.Day;
+ Month = dmy.Month;
+ Year = dmy.Year;
+ Era = dmy.Era;
+ }
+
+ public override string ToString() {
+ StringWriter sw = new StringWriter();
+ sw.Write("{0}.{1}.{2}", Day, Month, Year);
+ if (Era != 1) {
+ sw.Write(" era {0}", Era);
+ }
+ return sw.ToString();
+ }
+
+ public override bool Equals(Object b) {
+ if (b == null || GetType() != b.GetType())
+ return false;
+ return Equals(this, (Date)b);
+ }
+
+ public static bool Equals(Date a, Date b) {
+ if (a == b)
+ return true;
+ if (a.Year != b.Year)
+ return false;
+ if (a.Month != b.Month)
+ return false;
+ if (a.Day != b.Day)
+ return false;
+ if (a.Era != b.Era)
+ return false;
+ return true;
+ }
+
+ public override int GetHashCode() {
+ return ToString().GetHashCode();
+ }
+} // class Date
+
+public class CalendarTest : TestCase {
+ public CalendarTest() : base("System.Globalization.CalendarTest") {}
+ public CalendarTest(string name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(CalendarTest));
+ }
+ }
+
+ private Calendar[] acal;
+ private GregorianCalendar gcal;
+ private JulianCalendar jucal;
+ private HijriCalendar hical;
+ private HebrewCalendar hecal;
+ private JapaneseCalendar jacal;
+ private TaiwanCalendar tacal;
+ private KoreanCalendar kcal;
+ private ThaiBuddhistCalendar tbcal;
+
+ protected override void SetUp() {
+ gcal = new GregorianCalendar();
+ jucal = new JulianCalendar();
+ hical = new HijriCalendar();
+ hecal = new HebrewCalendar();
+ jacal = new JapaneseCalendar();
+ tacal = new TaiwanCalendar();
+ kcal = new KoreanCalendar();
+ tbcal = new ThaiBuddhistCalendar();
+ acal = new Calendar[] {
+ gcal, jucal, hical, hecal, jacal,
+ tacal, kcal, tbcal};
+ }
+
+ private void RowCheck(params Date[] adate) {
+ if (adate.Length != acal.Length)
+ throw new ArgumentException(
+ "Number of Date arguments doesn't match " +
+ "length of calendar array.");
+
+ DateTime timeG = adate[0].ToDateTime(gcal);
+ for (int i = 0; i < acal.Length; i++) {
+ Date date = adate[i];
+ if (date == null)
+ continue;
+ Calendar cal = acal[i];
+
+ DateTime time = date.ToDateTime(cal);
+ StringWriter sw = new StringWriter();
+ sw.Write("Calendar {0} computes wrong DateTime.",
+ cal);
+ AssertEquals(sw.ToString(), timeG, time);
+
+ sw = new StringWriter();
+ Date ndate = new Date();
+ ndate.FromDateTime(cal, time);
+ sw.Write("Calendar {0} computes wrong date", cal);
+ AssertEquals(sw.ToString(), date, ndate);
+ }
+ }
+
+ // We are testing the implementation against the reference dates in
+ // Calendrical Calcualation. Please note that the CLR uses another
+ // epoch for the HijriCalendar, which might be the perfect thing
+ // to do.
+ public void TestCCTable() {
+ // Gr Ju Hi He Ja Ta Ko TB
+ RowCheck(new Date(24,9,70,1),
+ new Date(26,9,70,1),
+ null,
+ null,
+ null,
+ null,
+ new Date(24,9,2403,1),
+ new Date(24,9,613,1));
+ RowCheck(new Date(2,10,135,1),
+ new Date(3,10,135,1),
+ null,
+ null,
+ null,
+ null,
+ new Date(2,10,2468,1),
+ new Date(2,10,678,1));
+ RowCheck(new Date(8,1,470,1),
+ new Date(7,1,470,1),
+ null,
+ null,
+ null,
+ null,
+ new Date(8,1,2803,1),
+ new Date(8,1,1013,1));
+ RowCheck(new Date(20,5,576,1),
+ new Date(18,5,576,1),
+ null,
+ null,
+ null,
+ null,
+ new Date(20,5,2909,1),
+ new Date(20,5,1119,1));
+ RowCheck(new Date(10,11,694,1),
+ new Date(7,11,694,1),
+ new Date(14,7,75,1),
+ null,
+ null,
+ null,
+ new Date(10,11,3027,1),
+ new Date(10,11,1237,1));
+ RowCheck(new Date(25,4,1013,1),
+ new Date(19,4,1013,1),
+ new Date(6,10,403,1),
+ null,
+ null,
+ null,
+ new Date(25,4,3346,1),
+ new Date(25,4,1556,1));
+ RowCheck(new Date(24,5,1096,1),
+ new Date(18,5,1096,1),
+ new Date(23,5,489,1),
+ null,
+ null,
+ null,
+ new Date(24,5,3429,1),
+ new Date(24,5,1639,1));
+ RowCheck(new Date(23,3,1190,1),
+ new Date(16,3,1190,1),
+ new Date(8,2,586,1),
+ null,
+ null,
+ null,
+ new Date(23,3,3523,1),
+ new Date(23,3,1733,1));
+ RowCheck(new Date(10,3,1240,1),
+ new Date(3,3,1240,1),
+ new Date(8,8,637,1),
+ null,
+ null,
+ null,
+ new Date(10,3,3573,1),
+ new Date(10,3,1783,1));
+ RowCheck(new Date(2,4,1288,1),
+ new Date(26,3,1288,1),
+ new Date(21,2,687,1),
+ null,
+ null,
+ null,
+ new Date(2,4,3621,1),
+ new Date(2,4,1831,1));
+ RowCheck(new Date(27,4,1298,1),
+ new Date(20,4,1298,1),
+ new Date(8,7,697,1),
+ null,
+ null,
+ null,
+ new Date(27,4,3631,1),
+ new Date(27,4,1841,1));
+ RowCheck(new Date(12,6,1391,1),
+ new Date(4,6,1391,1),
+ new Date(2,7,793,1),
+ null,
+ null,
+ null,
+ new Date(12,6,3724,1),
+ new Date(12,6,1934,1));
+ RowCheck(new Date(3,2,1436,1),
+ new Date(25,1,1436,1),
+ new Date(7,7,839,1),
+ null,
+ null,
+ null,
+ new Date(3,2,3769,1),
+ new Date(3,2,1979,1));
+ RowCheck(new Date(9,4,1492,1),
+ new Date(31,3,1492,1),
+ new Date(2,6,897,1),
+ null,
+ null,
+ null,
+ new Date(9,4,3825,1),
+ new Date(9,4,2035,1));
+ RowCheck(new Date(19,9,1553,1),
+ new Date(9,9,1553,1),
+ new Date(1,10,960,1),
+ null,
+ null,
+ null,
+ new Date(19,9,3886,1),
+ new Date(19,9,2096,1));
+ RowCheck(new Date(5,3,1560,1),
+ new Date(24,2,1560,1),
+ new Date(28,5,967,1),
+ null,
+ null,
+ null,
+ new Date(5,3,3893,1),
+ new Date(5,3,2103,1));
+ RowCheck(new Date(10,6,1648,1),
+ new Date(31,5,1648,1),
+ new Date(19,5,1058,1),
+ new Date(20,9,5408,1),
+ null,
+ null,
+ new Date(10,6,3981,1),
+ new Date(10,6,2191,1));
+ RowCheck(new Date(30,6,1680,1),
+ new Date(20,6,1680,1),
+ new Date(3,6,1091,1),
+ new Date(3,11,5440,1),
+ null,
+ null,
+ new Date(30,6,4013,1),
+ new Date(30,6,2223,1));
+ RowCheck(new Date(24,7,1716,1),
+ new Date(13,7,1716,1),
+ new Date(5,8,1128,1),
+ new Date(5,11,5476,1),
+ null,
+ null,
+ new Date(24,7,4049,1),
+ new Date(24,7,2259,1));
+ RowCheck(new Date(19,6,1768,1),
+ new Date(8,6,1768,1),
+ new Date(4,2,1182,1),
+ new Date(4,10,5528,1),
+ null,
+ null,
+ new Date(19,6,4101,1),
+ new Date(19,6,2311,1));
+ RowCheck(new Date(2,8,1819,1),
+ new Date(21,7,1819,1),
+ new Date(11,10,1234,1),
+ new Date(11,11,5579,1),
+ null,
+ null,
+ new Date(2,8,4152,1),
+ new Date(2,8,2362,1));
+ RowCheck(new Date(27,3,1839,1),
+ new Date(15,3,1839,1),
+ new Date(12,1,1255,1),
+ new Date(12,7,5599,1),
+ null,
+ null,
+ new Date(27,3,4172,1),
+ new Date(27,3,2382,1));
+ RowCheck(new Date(19,4,1903,1),
+ new Date(6,4,1903,1),
+ new Date(22,1,1321,1),
+ new Date(22,7,5663,1),
+ new Date(19,4,36,1),
+ null,
+ new Date(19,4,4236,1),
+ new Date(19,4,2446,1));
+ RowCheck(new Date(25,8,1929,1),
+ new Date(12,8,1929,1),
+ new Date(20,3,1348,1),
+ new Date(19,12,5689,1),
+ new Date(25,8,4,3),
+ new Date(25,8,18,1),
+ new Date(25,8,4262,1),
+ new Date(25,8,2472,1));
+ RowCheck(new Date(29,9,1941,1),
+ new Date(16,9,1941,1),
+ new Date(9,9,1360,1),
+ new Date(8,1,5702,1),
+ new Date(29,9,16,3),
+ new Date(29,9,30,1),
+ new Date(29,9,4274,1),
+ new Date(29,9,2484,1));
+ RowCheck(new Date(19,4,1943,1),
+ new Date(6,4,1943,1),
+ new Date(14,4,1362,1),
+ new Date(14,8,5703,1),
+ new Date(19,4,18,3),
+ new Date(19,4,32,1),
+ new Date(19,4,4276,1),
+ new Date(19,4,2486,1));
+ RowCheck(new Date(7,10,1943,1),
+ new Date(24,9,1943,1),
+ new Date(8,10,1362,1),
+ new Date(8,1,5704,1),
+ new Date(7,10,18,3),
+ new Date(7,10,32,1),
+ new Date(7,10,4276,1),
+ new Date(7,10,2486,1));
+ RowCheck(new Date(17,3,1992,1),
+ new Date(4,3,1992,1),
+ new Date(14,9,1412,1),
+ new Date(12,7,5752,1),
+ new Date(17,3,4,4),
+ new Date(17,3,81,1),
+ new Date(17,3,4325,1),
+ new Date(17,3,2535,1));
+ RowCheck(new Date(25,5,1996,1),
+ new Date(12,5,1996,1),
+ new Date(8,1,1417,1),
+ new Date(7,9,5756,1),
+ new Date(25,5,8,4),
+ new Date(25,5,85,1),
+ new Date(25,5,4329,1),
+ new Date(25,5,2539,1));
+ RowCheck(new Date(10,11,2038,1),
+ new Date(28,10,2038,1),
+ new Date(13,10,1460,1),
+ new Date(12,2,5799,1),
+ new Date(10,11,50,4),
+ new Date(10,11,127,1),
+ new Date(10,11,4371,1),
+ new Date(10,11,2581,1));
+ RowCheck(new Date(18,7,2094,1),
+ new Date(5,7,2094,1),
+ new Date(6,3,1518,1),
+ new Date(5,11,5854,1),
+ new Date(18,7,106,4),
+ new Date(18,7,183,1),
+ new Date(18,7,4427,1),
+ new Date(18,7,2637,1));
+ }
+
+ public void TestCalendarType() {
+ GregorianCalendar gc = new GregorianCalendar(
+ GregorianCalendarTypes.Arabic);
+ AssertEquals("A01 Gregorian ctor " +
+ "with GregorianCalendarTypes parameter",
+ GregorianCalendarTypes.Arabic,
+ gc.CalendarType);
+ gc.CalendarType = GregorianCalendarTypes.MiddleEastFrench;
+ AssertEquals("A02 GregorianCalendar.CalendarType",
+ GregorianCalendarTypes.MiddleEastFrench,
+ gc.CalendarType);
+ }
+
+ public void TestStandardEras() {
+ AssertEquals("B01 ADEra", 1, GregorianCalendar.ADEra);
+ AssertEquals("B02 HebrewEra", 1, HebrewCalendar.HebrewEra);
+ AssertEquals("B03 HjriEra", 1, HijriCalendar.HijriEra);
+ AssertEquals("B04 JulianEra", 1, JulianCalendar.JulianEra);
+ AssertEquals("B05 KoreanEra", 1, KoreanCalendar.KoreanEra);
+ AssertEquals("B06 ThaiBuddhistEra", 1,
+ ThaiBuddhistCalendar.ThaiBuddhistEra);
+ }
+
+ public void TestCurrentEra() {
+ AssertEquals("C01 GregorianCalendar.CurrentEra",
+ 0, GregorianCalendar.CurrentEra);
+ AssertEquals("C02 HebrewCalendar.CurrentEra",
+ 0, HebrewCalendar.CurrentEra);
+ AssertEquals("C03 HijriCalendar.CurrentEra",
+ 0, HijriCalendar.CurrentEra);
+ AssertEquals("C04 JapaneseCalendar.CurrentEra",
+ 0, JapaneseCalendar.CurrentEra);
+ AssertEquals("C05 JulianCalendar.CurrentEra",
+ 0, JulianCalendar.CurrentEra);
+ AssertEquals("C06 KoreanCalendar.CurrentEra",
+ 0, KoreanCalendar.CurrentEra);
+ AssertEquals("C07 TaiwanCalendar.CurrentEra",
+ 0, TaiwanCalendar.CurrentEra);
+ AssertEquals("C08 ThaiBuddhistCalendar.CurrentEra",
+ 0,
+ ThaiBuddhistCalendar.CurrentEra);
+ }
+
+ public void TestErasProperty() {
+ foreach (Calendar cal in acal) {
+ int check = 1;
+ if (cal is JapaneseCalendar)
+ check = 4;
+ AssertEquals(String.Format("D01 {0}.Eras.Length", cal),
+ check, cal.Eras.Length);
+ cal.Eras[0] = 29;
+ Assert(String.Format("D02 {0}.Eras readonly", cal),
+ cal.Eras[0] != 29);
+ }
+ }
+
+ public void TestTwoDigitYearMax() {
+ AssertEquals("E01 TwoDigitYearMax GregorianCalendar",
+ 2029, gcal.TwoDigitYearMax);
+ AssertEquals("E02 TwoDigitYearMax HebrewCalendar",
+ 5790, hecal.TwoDigitYearMax);
+ AssertEquals("E03 TwoDigitYearMax HijriCalendar",
+ 1451, hical.TwoDigitYearMax);
+ AssertEquals("E04 TwoDigitYearMax JapaneseCalendar",
+ 99, jacal.TwoDigitYearMax);
+ AssertEquals("E05 TwoDigitYearMax JulianCalendar",
+ 2029, jucal.TwoDigitYearMax);
+ AssertEquals("E06 TwoDigitYearMax KoreanCalendar",
+ 4362, kcal.TwoDigitYearMax);
+ AssertEquals("E07 TwoDigitYearMax TaiwanCalendar",
+ 99, tacal.TwoDigitYearMax);
+ AssertEquals("E08 TwoDigitYearMax ThaiBuddhistCalendar",
+ 2572, tbcal.TwoDigitYearMax);
+ foreach (Calendar cal in acal) {
+ bool exception = false;
+ try {
+ cal.TwoDigitYearMax = 99;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert(String.Format("E09 {0}.TwoDigitYearMax 99 " +
+ " out of range exception", cal),
+ exception);
+
+ exception = false;
+ int m = 10000;
+ try {
+ m = cal.GetYear(DateTime.MaxValue)+1;
+ cal.TwoDigitYearMax = m;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert(String.Format("E10 {0}.TwoDigitYearMax out " +
+ " of range exception value {1}",
+ cal, m),
+ exception);
+ }
+ }
+
+ /* UK TODO: breaks with current DateTime implementation.
+ * I've a newer one that works, but that requires to much changes.
+ * for now.
+ public void TestToFourDigitYear() {
+ foreach (Calendar cal in acal) {
+ bool working = true;
+ int mod = 2000;
+ if (cal is HebrewCalendar)
+ mod = 5500;
+ if (cal is KoreanCalendar)
+ mod = 3000;
+ if (cal is JapaneseCalendar)
+ working = false;
+ if (cal is TaiwanCalendar)
+ working = false;
+ cal.TwoDigitYearMax = mod + 229;
+ AssertEquals(
+ String.Format("F01 {0}.TwoDigitYearMax", cal),
+ mod+229 , cal.TwoDigitYearMax);
+ AssertEquals(
+ String.Format("F02 {0}.ToFourDigitYear(29)",
+ cal),
+ working ? mod+229 : 29,
+ cal.ToFourDigitYear(29));
+ AssertEquals(
+ String.Format("F03 {0}.ToFourDigitYear(30)",
+ cal),
+ working ? mod+130 : 30,
+ cal.ToFourDigitYear(30));
+ AssertEquals(
+ String.Format("F04 {0}.ToFourDigitYear({1})",
+ cal, mod),
+ mod, cal.ToFourDigitYear(mod));
+ bool exception = false;
+ try {
+ cal.ToFourDigitYear(-1);
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert(String.Format(
+ "F05 {0}.ToFourDigitYear(-1) exception",
+ cal), exception);
+ exception = false;
+ try {
+ cal.ToFourDigitYear(15000);
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert(String.Format(
+ "F05 {0}.ToFourDigitYear(15000) exception",
+ cal), exception);
+ }
+ }
+ */
+
+ // TODO: more tests :-)
+} // class CalendarTest
+
+} // namespace MonoTests.System.Globalization
diff --git a/mcs/class/corlib/Test/System.IO/AllTests.cs b/mcs/class/corlib/Test/System.IO/AllTests.cs
new file mode 100644
index 00000000000..91cdb4924c5
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/AllTests.cs
@@ -0,0 +1,34 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.IO {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(MemoryStreamTest.Suite);
+ suite.AddTest(StreamReaderTest.Suite);
+ suite.AddTest(StreamWriterTest.Suite);
+ suite.AddTest(PathTest.Suite);
+ suite.AddTest(StringReaderTest.Suite);
+ suite.AddTest(StringWriterTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.IO/ChangeLog b/mcs/class/corlib/Test/System.IO/ChangeLog
new file mode 100644
index 00000000000..511d063b5c3
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/ChangeLog
@@ -0,0 +1,24 @@
+2002-03-02 Jason Diamond <jason@injektilo.org>
+
+ * StringReader.cs: Added test for peeking and reading at the end of
+ a string.
+
+2002-02-28 Nick Drochak <ndrochak@gol.com>
+
+ * MemoryStreamTest.cs
+ * StreamWriterTest.cs
+ * StringReaderTest.cs: Fix test bugs found by running against mscorlib.
+ AssertEquals() requires the expected and atual values to be the same
+ type if they are to be considered equal.
+
+2002-02-05 Duncan Mak <duncan@ximian.com>
+
+ * FileTest.cs: Added to CVS. However, this portion of the code
+ can't be tested right now.
+
+2002-01-20 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: removed duplicate MemoryStream test
+ * MemoryStreamTest.cs: wrapped try-catch blocks around read/write/seek
+ tests. These were throwing exceptions that NUnit wasn't catching. I
+ don't think it used to behave this way before .NET.1.0. \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.IO/FileTest.cs b/mcs/class/corlib/Test/System.IO/FileTest.cs
new file mode 100644
index 00000000000..d91865c4d33
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/FileTest.cs
@@ -0,0 +1,72 @@
+//
+// FileTest.cs: Test cases for System.IO.File
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) 2002 Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+
+namespace MonoTests.System.IO
+{
+ public class FileTest : TestCase
+ {
+ public FileTest ()
+ : base ("System.IO.File testsuite")
+ {
+ }
+
+ public FileTest (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ }
+
+ protected override void TearDown ()
+ {
+ }
+
+ public static ITest Suite
+ {
+ get { return new TestSuite (typeof (FileTest)); }
+ }
+
+ public void TestExists ()
+ {
+ Assert ("File filetest/test should exist", File.Exists ("filetest/test"));
+ }
+
+ public void TestCreate ()
+ {
+ File.Create ("filetest/foo");
+ Assert ("File should exist", File.Exists ("filetest/foo"));
+ }
+
+ public void TestCopy ()
+ {
+ File.Copy ("filetest/foo", "filetest/bar", false);
+ Assert ("File foo should exist", File.Exists ("filetest/foo"));
+ Assert ("File bar should exist", File.Exists ("filetest/bar"));
+ }
+
+ public void TestDelete ()
+ {
+ File.Delete ("filetest/foo");
+ Assert ("File should not exist", !File.Exists ("filetest/foo"));
+ }
+
+ public void TestMove ()
+ {
+ Assert ("File filetest/bar should exist", File.Exists ("filetest/bar"));
+ File.Move ("filetest/bar", "filetest/baz");
+ Assert ("File filetest/bar should not exist", !File.Exists ("filetest/bar"));
+ Assert ("File filetest/baz should exist", File.Exists ("filetest/baz"));
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.IO/MemoryStreamTest.cs b/mcs/class/corlib/Test/System.IO/MemoryStreamTest.cs
new file mode 100644
index 00000000000..c9ff831877d
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/MemoryStreamTest.cs
@@ -0,0 +1,154 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Add some testing for exceptions
+//
+// TODO: Add some testing for the CanXXX properties, exceptions,
+// various different constructors.
+//
+
+using NUnit.Framework;
+using System.IO;
+using System;
+using System.Text;
+
+namespace MonoTests.System.IO
+{
+
+public class MemoryStreamTest : TestCase {
+
+ private MemoryStream testStream;
+ private byte[] testStreamData;
+
+ public MemoryStreamTest() : base ("MonoTests.System.IO.MemoryStream testcase") { }
+ public MemoryStreamTest( string name ): base(name) { }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(MemoryStreamTest));
+ }
+ }
+
+ protected override void SetUp() {
+ testStreamData = new byte[100];
+
+ for( int i = 0; i < 100; i++ ) {
+ testStreamData[i] = (byte)(100 - i);
+ }
+
+ testStream = new MemoryStream( testStreamData );
+ }
+
+ //
+ // Verify that the first count bytes in testBytes are the same as
+ // the count bytes from index start in testStreamData
+ //
+ private void VerifyTestData( byte[] testBytes, int start, int count) {
+ if( testBytes == null ) {
+ throw new ArgumentNullException();
+ } else if( ( start < 0 || count < 0 ) || start + count > testStreamData.Length || start > testStreamData.Length ) {
+ throw new ArgumentOutOfRangeException();
+ }
+
+ for( int test = 0; test < count; test++ ) {
+ if( testBytes[ test ] != testStreamData[ start + test ] ) {
+ string failStr = String.Format( "testByte {0} (testStream {1}) was <{2}>, expecting <{3}>", test, start+test,
+ testBytes[ test ], testStreamData[ start+test] );
+ Fail( failStr );
+ }
+ }
+ }
+
+ public void TestConstructors() {
+ MemoryStream ms = new MemoryStream();
+
+ AssertEquals("A1", 0L, ms.Length );
+ AssertEquals("A2", 0, ms.Capacity );
+ AssertEquals("A3", true, ms.CanWrite );
+
+ ms = new MemoryStream( 10 );
+
+ AssertEquals("A4", 0L, ms.Length );
+ AssertEquals("A5", 10, ms.Capacity );
+ }
+
+ public void TestRead() {
+ byte[] readBytes = new byte[20];
+
+ try {
+ /* Test simple read */
+ testStream.Read( readBytes, 0, 10 );
+ VerifyTestData( readBytes, 0, 10 );
+
+ /* Seek back to beginning */
+
+ testStream.Seek( 0, SeekOrigin.Begin );
+
+ /* Read again, bit more this time */
+ testStream.Read( readBytes, 0, 20 );
+ VerifyTestData( readBytes, 0, 20 );
+
+ /* Seek to 20 bytes from End */
+ testStream.Seek( -20, SeekOrigin.End );
+ testStream.Read( readBytes, 0, 20);
+ VerifyTestData( readBytes, 80, 20);
+
+ int readByte = testStream.ReadByte();
+ AssertEquals( -1, readByte );
+ }
+ catch(Exception e){
+ Fail("Threw an unexpected exception:"+e.ToString());
+ return;
+ }
+ }
+
+ public void TestWriteBytes() {
+ byte[] readBytes = new byte[100];
+
+ try {
+ MemoryStream ms = new MemoryStream( 100 );
+
+ for( int i = 0; i < 100; i++ ) {
+ ms.WriteByte( testStreamData[i] );
+ }
+
+ ms.Seek( 0, SeekOrigin.Begin);
+
+ testStream.Read( readBytes, 0, 100 );
+
+ VerifyTestData( readBytes, 0, 100 );
+ }
+ catch(Exception e){
+ Fail("Threw an unexpected exception:"+e.ToString());
+ return;
+ }
+ }
+
+ public void TestWriteBlock() {
+ byte[] readBytes = new byte[100];
+
+ try {
+ MemoryStream ms = new MemoryStream( 100 );
+
+ ms.Write( testStreamData, 0, 100 );
+
+ ms.Seek( 0, SeekOrigin.Begin);
+
+ testStream.Read( readBytes, 0, 100 );
+
+ VerifyTestData( readBytes, 0, 100 );
+
+ byte[] arrayBytes = testStream.ToArray();
+
+ VerifyTestData( arrayBytes, 0, 100 );
+ }
+ catch(Exception e){
+ Fail("Threw an unexpected exception:"+e.ToString());
+ return;
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.IO/PathTest.cs b/mcs/class/corlib/Test/System.IO/PathTest.cs
new file mode 100644
index 00000000000..0735807a3cf
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/PathTest.cs
@@ -0,0 +1,149 @@
+//
+// System.IO.Path Test Cases
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Add a more thorough workout for some
+// of the "trickier" functions.
+
+#define WINDOWS
+
+using NUnit.Framework;
+using System.IO;
+using System;
+using System.Text;
+
+namespace MonoTests.System.IO
+{
+
+public class PathTest : TestCase {
+
+ string path1;
+ string path2;
+ string path3;
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(PathTest));
+ }
+ }
+
+ public PathTest() : base ("MonoTests.System.IO.PathTest testcase") { }
+ public PathTest( string name ): base(name) { }
+
+ protected override void SetUp() {
+
+ #if WINDOWS
+
+ path1 = "c:\\foo\\test.txt";
+ path2 = "c:\\winnt";
+ path3 = "system32";
+
+ #elif UNIX
+
+ path1 = "/foo/test.txt";
+ path2 = "/etc";
+ path3 = "init.d"
+
+ #elif MAC
+
+ path1 = "foo:test.txt";
+ path2 = "foo";
+ path3 = "bar";
+
+ #endif
+
+ }
+
+
+ public void TestChangeExtension() {
+ string testPath = Path.ChangeExtension( path1, "doc" );
+
+ #if WINDOWS
+ AssertEquals( "c:\\foo\\test.doc", testPath );
+ #elif UNIX
+ AssertEquals( "/foo/test.doc", testPath );
+ #elif MAC
+ AssertEquals( "foo:test.doc", testPath );
+ #endif
+ }
+
+ public void TestCombine() {
+ string testPath = Path.Combine( path2, path3 );
+
+ #if WINDOWS
+ AssertEquals( "c:\\winnt\\system32", testPath );
+ #elif UNIX
+ AssertEquals( "/etc/init.d", testPath );
+ #elif MAC
+ AssertEquals( "foo:bar", testPath );
+ #endif
+ }
+
+ public void TestDirectoryName() {
+ string testDirName = Path.GetDirectoryName( path1 );
+
+ #if WINDOWS
+ AssertEquals( "c:\\foo", testDirName );
+ #elif UNIX
+ AssertEquals( "/etc", testDirName );
+ #elif MAC
+ AssertEquals( "foo", testDirName );
+ #endif
+ }
+
+ public void TestGetExtension() {
+ string testExtn = Path.GetExtension( path1 );
+
+ AssertEquals( ".txt", testExtn );
+
+ testExtn = Path.GetExtension( path2 );
+
+ AssertEquals ( "", testExtn );
+ }
+
+ public void TestGetFileName() {
+ string testFileName = Path.GetFileName( path1 );
+
+ AssertEquals( "test.txt", testFileName );
+ }
+
+ public void TestGetFileNameWithoutExtension() {
+ string testFileName = Path.GetFileNameWithoutExtension( path1 );
+
+ AssertEquals( "test", testFileName );
+ }
+
+ public void TestGetFullPath() {
+ string testFullPath = Path.GetFullPath( "foo.txt" );
+ // AssertEquals( "foo.txt", testFullPath );
+ }
+
+ public void TestGetTempPath() {
+ string getTempPath = Path.GetTempPath();
+ AssertEquals( Environment.GetEnvironmentVariable( "TEMP" ) + '\\', getTempPath );
+ }
+
+ /*
+ // Not sure what's an appropriate test for this function? Maybe just
+ // check if the temp file exists as advertised
+ //
+ public void TestGetTempFileName() {
+ string getTempFileName = Path.GetTempFileName();
+ //Console.WriteLine( getTempFileName );
+ }*/
+
+ public void TestHasExtension() {
+ AssertEquals( true, Path.HasExtension( "foo.txt" ) );
+ AssertEquals( false, Path.HasExtension( "foo" ) );
+ AssertEquals( true, Path.HasExtension( path1 ) );
+ AssertEquals( false, Path.HasExtension( path2 ) );
+ }
+
+ public void TestRooted() {
+ AssertEquals( true, Path.IsPathRooted( "c:\\winnt\\" ) );
+ AssertEquals( false, Path.IsPathRooted( "system32\\drivers\\" ) );
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.IO/StreamReaderTest.cs b/mcs/class/corlib/Test/System.IO/StreamReaderTest.cs
new file mode 100644
index 00000000000..0e340620451
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/StreamReaderTest.cs
@@ -0,0 +1,488 @@
+// StreamReaderTest.cs - NUnit Test Cases for the SystemIO.StreamReader class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Text;
+
+namespace MonoTests.System.IO
+{
+
+public class StreamReaderTest : TestCase
+{
+ public StreamReaderTest() :
+ base ("MonoTests.System.StreamReaderTest testsuite") {}
+ public StreamReaderTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(StreamReaderTest));
+ }
+ }
+
+ // assume testing pwd is corlib/Test
+ private string _codeFileName = "System.IO/StreamReaderTest.cs";
+
+ public void TestCtor1() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((Stream)null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ FileStream f = new FileStream(_codeFileName, FileMode.Open, FileAccess.Write);
+ try {
+ StreamReader r = new StreamReader(f);
+ r.Close();
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ f.Close();
+ Assert("no read error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Open,
+ FileAccess.Read);
+ StreamReader r = new StreamReader(f);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ f.Close();
+ }
+ }
+ public void TestCtor2() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("");
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((string)null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentfile");
+ } catch (FileNotFoundException) {
+ errorThrown = true;
+ }
+ Assert("fileNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentdir/file");
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("!$what? what? Huh? !$*#");
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ }
+ Assert("invalid filename error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ StreamReader r = new StreamReader(_codeFileName);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ }
+ }
+ public void TestCtor3() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((Stream)null, false);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ FileStream f = new FileStream(_codeFileName, FileMode.Open, FileAccess.Write);
+ try {
+ StreamReader r = new StreamReader(f, false);
+ r.Close();
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ f.Close();
+ Assert("no read error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Open,
+ FileAccess.Read);
+ StreamReader r = new StreamReader(f, false);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ f.Close();
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((Stream)null, true);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ FileStream f = new FileStream(_codeFileName, FileMode.Open, FileAccess.Write);
+ try {
+ StreamReader r = new StreamReader(f, true);
+ r.Close();
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ f.Close();
+ Assert("no read error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Open,
+ FileAccess.Read);
+ StreamReader r = new StreamReader(f, true);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ f.Close();
+ }
+ }
+ public void TestCtor4() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("", false);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((string)null, false);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentfile", false);
+ } catch (FileNotFoundException) {
+ errorThrown = true;
+ }
+ Assert("fileNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentdir/file", false);
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("!$what? what? Huh? !$*#", false);
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ }
+ Assert("invalid filename error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ StreamReader r = new StreamReader(_codeFileName, false);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("", true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader((string)null, true);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentfile", true);
+ } catch (FileNotFoundException) {
+ errorThrown = true;
+ }
+ Assert("fileNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("nonexistentdir/file", true);
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamReader r = new StreamReader("!$what? what? Huh? !$*#", true);
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ }
+ Assert("invalid filename error not thrown", errorThrown);
+ }
+ {
+ // this is probably incestuous, but, oh well.
+ StreamReader r = new StreamReader(_codeFileName, true);
+ AssertNotNull("no stream reader", r);
+ r.Close();
+ }
+ }
+
+ // TODO - Ctor with Encoding
+
+ public void TestBaseStream() {
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Open,
+ FileAccess.Read);
+ StreamReader r = new StreamReader(f);
+ //AssertEquals("wrong base stream ", f.Name, ((FileStream)r.BaseStream).Name);
+ AssertEquals("wrong base stream ", f, r.BaseStream);
+ r.Close();
+ f.Close();
+ }
+
+ public void TestCurrentEncoding() {
+ StreamReader r = new StreamReader(_codeFileName);
+ AssertEquals("wrong encoding",
+ Encoding.UTF8, r.CurrentEncoding);
+ }
+
+ // TODO - Close - annoying spec - won't commit to any exceptions. How to test?
+ // TODO - DiscardBufferedData - I have no clue how to test this function.
+
+ public void TestPeek() {
+ // FIXME - how to get an IO Exception?
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ MemoryStream m = new MemoryStream(b);
+ StreamReader r = new StreamReader(m);
+ m.Close();
+ int nothing = r.Peek();
+ } catch (ObjectDisposedException) {
+ errorThrown = true;
+ }
+ Assert("nothing-to-peek-at error not thrown", errorThrown);
+ }
+ {
+ Byte[] b = {1, 2, 3, 4, 5, 6};
+ MemoryStream m = new MemoryStream(b);
+
+ StreamReader r = new StreamReader(m);
+ for (int i = 1; i <= 6; i++) {
+ AssertEquals("peek incorrect", i, r.Peek());
+ r.Read();
+ }
+ AssertEquals("should be none left", -1, r.Peek());
+ }
+ }
+
+ public void TestRead() {
+ // FIXME - how to get an IO Exception?
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ MemoryStream m = new MemoryStream(b);
+ StreamReader r = new StreamReader(m);
+ m.Close();
+ int nothing = r.Read();
+ } catch (ObjectDisposedException) {
+ errorThrown = true;
+ }
+ Assert("nothing-to-read error not thrown", errorThrown);
+ }
+ {
+ Byte[] b = {1, 2, 3, 4, 5, 6};
+ MemoryStream m = new MemoryStream(b);
+
+ StreamReader r = new StreamReader(m);
+ for (int i = 1; i <= 6; i++) {
+ AssertEquals("read incorrect", i, r.Read());
+ }
+ AssertEquals("Should be none left", -1, r.Read());
+ }
+
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ StreamReader r = new StreamReader(new MemoryStream(b));
+ r.Read(null, 0, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("null buffer error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ StreamReader r = new StreamReader(new MemoryStream(b));
+ Char[] c = new Char[1];
+ r.Read(c, 0, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("too-long range error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ StreamReader r = new StreamReader(new MemoryStream(b));
+ Char[] c = new Char[1];
+ r.Read(c, -1, 2);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Byte[] b = {};
+ StreamReader r = new StreamReader(new MemoryStream(b));
+ Char[] c = new Char[1];
+ r.Read(c, 0, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error not thrown", errorThrown);
+ }
+ {
+ Byte[] b = {(byte)'a', (byte)'b', (byte)'c',
+ (byte)'d', (byte)'e', (byte)'f',
+ (byte)'g'};
+ MemoryStream m = new MemoryStream(b);
+ StreamReader r = new StreamReader(m);
+
+ char[] buffer = new Char[7];
+ char[] target = {'g','d','e','f','b','c','a'};
+ r.Read(buffer, 6, 1);
+ r.Read(buffer, 4, 2);
+ r.Read(buffer, 1, 3);
+ r.Read(buffer, 0, 1);
+ for (int i = 0; i < target.Length; i++) {
+ AssertEquals("read no work",
+ target[i], buffer[i]);
+ }
+ }
+ }
+
+ public void TestReadLine() {
+ // TODO Out Of Memory Exc? IO Exc?
+ Byte[] b = new Byte[8];
+ b[0] = (byte)'a';
+ b[1] = (byte)'\n';
+ b[2] = (byte)'b';
+ b[3] = (byte)'\n';
+ b[4] = (byte)'c';
+ b[5] = (byte)'\n';
+ b[6] = (byte)'d';
+ b[7] = (byte)'\n';
+ MemoryStream m = new MemoryStream(b);
+ StreamReader r = new StreamReader(m);
+ AssertEquals("line doesn't match", "a", r.ReadLine());
+ AssertEquals("line doesn't match", "b", r.ReadLine());
+ AssertEquals("line doesn't match", "c", r.ReadLine());
+ AssertEquals("line doesn't match", "d", r.ReadLine());
+ AssertEquals("line doesn't match", null, r.ReadLine());
+ }
+
+ public void TestReadToEnd() {
+ // TODO Out Of Memory Exc? IO Exc?
+ Byte[] b = new Byte[8];
+ b[0] = (byte)'a';
+ b[1] = (byte)'\n';
+ b[2] = (byte)'b';
+ b[3] = (byte)'\n';
+ b[4] = (byte)'c';
+ b[5] = (byte)'\n';
+ b[6] = (byte)'d';
+ b[7] = (byte)'\n';
+ MemoryStream m = new MemoryStream(b);
+ StreamReader r = new StreamReader(m);
+ AssertEquals("line doesn't match", "a\nb\nc\nd\n", r.ReadToEnd());
+ AssertEquals("line doesn't match", "", r.ReadToEnd());
+ }
+}
+}
diff --git a/mcs/class/corlib/Test/System.IO/StreamWriterTest.cs b/mcs/class/corlib/Test/System.IO/StreamWriterTest.cs
new file mode 100644
index 00000000000..b3567abc6a5
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/StreamWriterTest.cs
@@ -0,0 +1,319 @@
+// StreamWriterTest.cs - NUnit Test Cases for the SystemIO.StreamWriter class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Text;
+
+namespace MonoTests.System.IO
+{
+
+public class StreamWriterTest : TestCase
+{
+ public StreamWriterTest() :
+ base ("MonoTests.System.StreamWriterTest testsuite") {}
+ public StreamWriterTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(StreamWriterTest));
+ }
+ }
+
+ private string _codeFileName = "StreamWriterTest.temp";
+ private string _thisCodeFileName = "System.IO/StreamReaderTest.cs";
+
+ // TODO - ctors
+ public void TestCtor1() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter((Stream)null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ FileStream f = new FileStream(_thisCodeFileName,
+ FileMode.Open,
+ FileAccess.Read);
+ try {
+ StreamWriter r = new StreamWriter(f);
+ r.Close();
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ f.Close();
+ Assert("no read error not thrown", errorThrown);
+ }
+ {
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Append,
+ FileAccess.Write);
+ StreamWriter r = new StreamWriter(f);
+ AssertNotNull("no stream writer", r);
+ r.Close();
+ f.Close();
+ }
+ }
+ public void TestCtor2() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("");
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter((string)null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("nonexistentdir/file");
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("!$what? what? Huh? !$*#");
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ }
+ Assert("invalid filename error not thrown", errorThrown);
+ }
+ // TODO - Security/Auth exceptions
+ {
+ StreamWriter r = new StreamWriter(_codeFileName);
+ AssertNotNull("no stream writer", r);
+ r.Close();
+ }
+ }
+ public void TestCtor3() {
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("", false);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter((string)null, false);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("nonexistentdir/file", false);
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("!$what? what? Huh? !$*#", false);
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ }
+ Assert("invalid filename error not thrown", errorThrown);
+ }
+ {
+ StreamWriter r = new StreamWriter(_codeFileName, false);
+ AssertNotNull("no stream writer", r);
+ r.Close();
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("", true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("empty string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter((string)null, true);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("nonexistentdir/file", true);
+ } catch (DirectoryNotFoundException) {
+ errorThrown = true;
+ }
+ Assert("dirNotFound error not thrown", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ StreamWriter r = new StreamWriter("!$what? what? Huh? !$*#", true);
+ } catch (IOException) {
+ errorThrown = true;
+ } catch (ArgumentException) {
+ // FIXME - the spec says 'IOExc', but the
+ // compiler says 'ArgExc'...
+ errorThrown = true;
+ }
+ Assert("invalid filename error not thrown", errorThrown);
+ }
+ {
+ StreamWriter r = new StreamWriter(_codeFileName, true);
+ AssertNotNull("no stream writer", r);
+ r.Close();
+ }
+ }
+
+ // TODO - ctors with Encoding
+
+ // TODO - AutoFlush
+ public void TestAutoFlush() {
+ {
+ MemoryStream m = new MemoryStream();
+ StreamWriter w = new StreamWriter(m);
+ w.AutoFlush = false;
+ w.Write(1);
+ w.Write(2);
+ w.Write(3);
+ w.Write(4);
+ AssertEquals("Should be nothing before flush",
+ 0L, m.Length);
+ w.Flush();
+ AssertEquals("Should be something after flush",
+ 4L, m.Length);
+ }
+ {
+ MemoryStream m = new MemoryStream();
+ StreamWriter w = new StreamWriter(m);
+ w.AutoFlush = true;
+ w.Write(1);
+ w.Write(2);
+ w.Write(3);
+ w.Write(4);
+ AssertEquals("Should be something before flush",
+ 4L, m.Length);
+ w.Flush();
+ AssertEquals("Should be something after flush",
+ 4L, m.Length);
+ }
+ }
+
+ public void TestBaseStream() {
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Append,
+ FileAccess.Write);
+ StreamWriter r = new StreamWriter(f);
+ AssertEquals("wrong base stream ", f, r.BaseStream);
+ r.Close();
+ f.Close();
+ }
+
+ public void TestEncoding() {
+ StreamWriter r = new StreamWriter(_codeFileName);
+ AssertEquals("wrong encoding",
+ Encoding.UTF8.GetType(), r.Encoding.GetType());
+ r.Close();
+ }
+
+ // TODO - Close - not entirely sure how to test Close
+ //public void TestClose() {
+ //{
+ //MemoryStream m = new MemoryStream();
+ //StreamWriter w = new StreamWriter(m);
+ //StreamReader r = new StreamReader(m);
+ //w.Write(1);
+ //w.Write(2);
+ //w.Write(3);
+ //w.Write(4);
+ //AssertEquals("Should be nothing before close",
+ //0, m.Length);
+ //AssertEquals("Should be nothing in reader",
+ //-1, r.Peek());
+ //w.Close();
+ //AssertEquals("Should be something after close",
+ //1, r.Peek());
+ //}
+ //}
+
+ // TODO - Flush
+ public void TestFlush() {
+ {
+ bool errorThrown = false;
+ try {
+ FileStream f = new FileStream(_codeFileName,
+ FileMode.Append,
+ FileAccess.Write);
+ StreamWriter r = new StreamWriter(f);
+ r.Close();
+ r.Flush();
+ } catch (ObjectDisposedException) {
+ errorThrown = true;
+ }
+ Assert("can't flush closed error not thrown", errorThrown);
+ }
+ {
+ MemoryStream m = new MemoryStream();
+ StreamWriter w = new StreamWriter(m);
+ w.Write(1);
+ w.Write(2);
+ w.Write(3);
+ w.Write(4);
+ AssertEquals("Should be nothing before flush",
+ 0L, m.Length);
+ w.Flush();
+ AssertEquals("Should be something after flush",
+ 4L, m.Length);
+ }
+ }
+
+ // TODO - Write - test errors, functionality tested in TestFlush.
+}
+}
diff --git a/mcs/class/corlib/Test/System.IO/StringReaderTest.cs b/mcs/class/corlib/Test/System.IO/StringReaderTest.cs
new file mode 100644
index 00000000000..dc4e85ea563
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/StringReaderTest.cs
@@ -0,0 +1,122 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Add some testing for exceptions
+//
+// TODO: Some of the tests could be a bit more thorough
+//
+
+using NUnit.Framework;
+using System.IO;
+using System;
+
+namespace MonoTests.System.IO {
+
+public class StringReaderTest : TestCase {
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(StringReaderTest));
+ }
+ }
+
+ public StringReaderTest() : base ("MonoTests.System.IO.StringReaderTest testcase") { }
+ public StringReaderTest( string name ): base(name) { }
+
+ public void TestPeekRead() {
+ StringReader reader = new StringReader( "Test String" );
+
+ char c = (char)reader.Peek();
+ AssertEquals("A1", 'T', c );
+
+ char read = (char)reader.Read();
+
+ AssertEquals("A2", 'T', read );
+
+ c = (char)reader.Peek();
+
+ AssertEquals("A3", 'e', c );
+ }
+
+ public void TestPeekAndReadAtEndOfString() {
+ StringReader reader = new StringReader("x");
+
+ char c = (char)reader.Peek();
+ AssertEquals("A1", 'x', c );
+
+ c = (char)reader.Read();
+ AssertEquals("A2", 'x', c);
+
+ int i = reader.Peek();
+ AssertEquals("A3", -1, i);
+
+ i = reader.Read();
+ AssertEquals("A4", -1, i);
+
+ i = reader.Peek();
+ AssertEquals("A5", -1, i);
+ }
+
+ public void TestPeekAndReadEmptyString() {
+ StringReader reader = new StringReader("");
+
+ int i = reader.Peek();
+ AssertEquals("A1", -1, i);
+
+ i = reader.Read();
+ AssertEquals("A2", -1, i);
+ }
+
+ public void TestRead() {
+ StringReader reader = new StringReader( "Test String" );
+
+ /* Read from start of string */
+ char[] test = new char[5];
+
+ int charsRead = reader.Read( test, 0, 5 );
+
+ AssertEquals( 5, charsRead );
+ AssertEquals( "Test ", new String(test) );
+
+ /* Read to end of string */
+ //reader = new StringReader( "Test String" );
+
+ test = new char[6];
+ charsRead = reader.Read( test, 0, 6 );
+ AssertEquals( 6, charsRead);
+ AssertEquals( "String", new String( test ) );
+
+ /* Read past end of string */
+
+ test = new char[6];
+ reader = new StringReader( "Foo" );
+ charsRead = reader.Read( test, 0, 6 );
+ AssertEquals( 3, charsRead );
+ AssertEquals( "Foo\0\0\0", new String( test ) );
+
+ }
+
+ public void TestReadEOL() {
+ StringReader reader = new StringReader( "Line1\rLine2\r\nLine3\nLine4" );
+
+ string test = reader.ReadLine();
+
+ AssertEquals( "Line1", test );
+
+ test = reader.ReadLine();
+
+ AssertEquals( "Line2", test );
+
+ test = reader.ReadLine();
+
+ AssertEquals( "Line3", test );
+
+ test = reader.ReadLine();
+
+ AssertEquals( "Line4", test );
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.IO/StringWriterTest.cs b/mcs/class/corlib/Test/System.IO/StringWriterTest.cs
new file mode 100644
index 00000000000..bf254ace832
--- /dev/null
+++ b/mcs/class/corlib/Test/System.IO/StringWriterTest.cs
@@ -0,0 +1,56 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// TODO: Add some testing for exceptions
+//
+
+using NUnit.Framework;
+using System.IO;
+using System;
+using System.Text;
+
+namespace MonoTests.System.IO {
+
+public class StringWriterTest : TestCase {
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(StringWriterTest));
+ }
+ }
+
+ public StringWriterTest() : base ("MonoTests.System.IO.StringWriterTest testcase") { }
+ public StringWriterTest( string name ): base(name) { }
+
+ public void TestConstructors() {
+ StringBuilder sb = new StringBuilder("Test String");
+
+ StringWriter writer = new StringWriter( sb );
+ AssertEquals( sb, writer.GetStringBuilder() );
+ }
+
+ public void TestWrite() {
+ StringWriter writer = new StringWriter();
+
+ AssertEquals( String.Empty, writer.ToString() );
+
+ writer.Write( 'A' );
+ AssertEquals( "A", writer.ToString() );
+
+ writer.Write( " foo" );
+ AssertEquals( "A foo", writer.ToString() );
+
+
+ char[] testBuffer = "Test String".ToCharArray();
+
+ writer.Write( testBuffer, 0, 4 );
+ AssertEquals( "A fooTest", writer.ToString() );
+
+ writer.Write( testBuffer, 5, 6 );
+ AssertEquals( "A fooTestString", writer.ToString() );
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System.Net/AllTests.cs b/mcs/class/corlib/Test/System.Net/AllTests.cs
new file mode 100644
index 00000000000..9b997e8a220
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Net/AllTests.cs
@@ -0,0 +1,30 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Net {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (IPAddressTest.Suite);
+ suite.AddTest (IPEndPointTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Net/ChangeLog b/mcs/class/corlib/Test/System.Net/ChangeLog
new file mode 100644
index 00000000000..48de8c30fc0
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Net/ChangeLog
@@ -0,0 +1,27 @@
+2002-04-24 Nick Drochak <ndrochak@gol.com>
+
+ * IPAddressTest.cs: Make test conform to MS behavior. Also, if wrong
+ exception is thrown, let eveyone know which one.
+
+2002-04-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddressTest.cs: use BitConverter to set localhost, catch
+ OverflowException in TestParseWrong() and changed some constants.
+
+2002-04-19 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * AllTests.cs: added IPEndPointTest.
+ * IPEndPointTest.cs: added file (author: Lawrence Pit).
+ * IPAdressTest.cs: use Fail is expected exception are not raised.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * IPAddressTest.cs: use System.BitConverter.IsLittleEndian (suggested
+ by Paolo) instead of guessing the endianness.
+
+2002-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ChangeLog:
+ * AllTests.cs:
+ * IPAddressTest.cs: added files.
+
diff --git a/mcs/class/corlib/Test/System.Net/IPAddressTest.cs b/mcs/class/corlib/Test/System.Net/IPAddressTest.cs
new file mode 100644
index 00000000000..2d3d92550f7
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Net/IPAddressTest.cs
@@ -0,0 +1,175 @@
+//
+// IPAddressTest.cs - NUnit Test Cases for System.Net.IPAddress
+//
+// Author:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Runtime.InteropServices;
+
+namespace MonoTests.System.Net
+{
+
+public class IPAddressTest : TestCase
+{
+ public IPAddressTest () :
+ base ("[MonoTests.System.Net.IPAddressTest]") {}
+
+ public IPAddressTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(IPAddressTest));
+ }
+ }
+
+ public void TestPublicFields ()
+ {
+ AssertEquals ("Any", IPAddress.Any.Address, (long) 0);
+ AssertEquals ("Broadcast", IPAddress.Broadcast.Address, (long) 0xFFFFFFFF);
+ long loopback = IPAddress.HostToNetworkOrder (BitConverter.IsLittleEndian ?
+ 0x7f000001 :
+ 0x0100007f);
+ AssertEquals ("Loopback", IPAddress.Loopback.Address, loopback);
+ AssertEquals ("None", IPAddress.None.Address, (long) 0xFFFFFFFF);
+ }
+
+ public void TestToString ()
+ {
+ IPAddress ip = IPAddress.Parse ("192.168.1.1");
+ AssertEquals ("ToString #1", "192.168.1.1", ip.ToString ());
+ AssertEquals ("ToString #2", "0.0.0.0", IPAddress.Any.ToString ());
+ AssertEquals ("ToString #3", "255.255.255.255", IPAddress.Broadcast.ToString ());
+ AssertEquals ("ToString #4", "127.0.0.1", IPAddress.Loopback.ToString ());
+ AssertEquals ("ToString #5", "255.255.255.255", IPAddress.None.ToString ());
+ }
+
+ public void TestParseOk ()
+ {
+ IPAddress ip = IPAddress.Parse ("192.168.1.1");
+ Assert ("Parse #1", ip.ToString () == "192.168.1.1");
+
+ ip = IPAddress.Parse ("0.0.0.0");
+ AssertEquals ("Parse #2", ip, IPAddress.Any);
+
+ ip = IPAddress.Parse ("255.255.255.255");
+ AssertEquals ("Parse #3", ip, IPAddress.Broadcast);
+ AssertEquals ("Parse #4", ip, IPAddress.None);
+
+ ip = IPAddress.Parse ("127.0.0.1");
+ AssertEquals ("Parse #5", IPAddress.IsLoopback (ip), true);
+
+ ip = IPAddress.Parse ("12.1.1.3 ");
+ AssertEquals ("Parse #6", IPAddress.Parse ("12.1.1.3"), ip);
+
+ // These have a strange behavior !?
+ ip = IPAddress.Parse (" 12.1.1.1");
+ AssertEquals ("Parse #7", IPAddress.Parse ("0.0.0.0"), ip);
+
+ ip = IPAddress.Parse ("12.1 .1.2");
+ AssertEquals ("Parse #8", IPAddress.Parse ("12.0.0.1"), ip);
+
+ ip = IPAddress.Parse (".1.1.6");
+ AssertEquals ("Parse #9", IPAddress.Parse ("0.1.1.6"), ip);
+
+ ip = IPAddress.Parse ("12.1.7");
+ AssertEquals ("Parse #10", IPAddress.Parse ("12.1.0.7"), ip);
+
+ ip = IPAddress.Parse ("12.1.8. ");
+ AssertEquals ("Parse #10", IPAddress.Parse ("12.1.8.0"), ip);
+ }
+
+ public void TestParseWrong ()
+ {
+ bool failure = false;
+ IPAddress ip = IPAddress.None;
+
+ failure = false;
+ try {
+ ip = IPAddress.Parse ("12.+1.1.4");
+ Fail("Should raise a FormatException #1");
+ } catch (FormatException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #1:" + e.ToString());
+ }
+
+
+ failure = false;
+ try {
+ ip = IPAddress.Parse ("12.1.-1.5");
+ Fail("Should raise a FormatException #2");
+ } catch (FormatException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #2:" + e.ToString());
+ }
+
+ failure = false;
+ try {
+ ip = IPAddress.Parse ("257.1.1.9");
+ Fail("Should raise a FormatException #3");
+ } catch (FormatException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #3:" + e.ToString());
+ }
+
+ failure = false;
+ try {
+ ip = IPAddress.Parse (null);
+ Fail("Should raise a ArgumentNullException #1");
+ } catch (ArgumentNullException) {
+ } catch (Exception e) {
+ Fail ("ParseWrong #4:" + e.ToString());
+ }
+ }
+
+ public void TestNetworkHost ()
+ {
+ long [] tested = new long [] { 0, 1, 1, 1};
+ long [] expectedLE = new long [] {0, 256, 16777216, 72057594037927936 };
+ long [] expected;
+
+ expected = BitConverter.IsLittleEndian ? expectedLE : tested;
+
+ short short0 = IPAddress.NetworkToHostOrder ((short) tested [0]);
+ AssertEquals ("NetworkToHostOrder #1", short0, (short) expected [0]);
+ short0 = IPAddress.HostToNetworkOrder (short0);
+ AssertEquals ("HostToNetworkOrder #1", short0, (short) tested [0]);
+
+ int int0 = IPAddress.NetworkToHostOrder ((int) tested [0]);
+ AssertEquals ("NetworkToHostOrder #2", int0, (int) expected [0]);
+ int0 = IPAddress.HostToNetworkOrder (int0);
+ AssertEquals ("HostToNetworkOrder #2", int0, (int) tested [0]);
+
+ long long0 = IPAddress.NetworkToHostOrder (tested [0]);
+ AssertEquals ("NetworkToHostOrder #3", long0, expected [0]);
+ long0 = IPAddress.HostToNetworkOrder (long0);
+ AssertEquals ("HostToNetworkOrder #3", long0, tested [0]);
+
+ short0 = IPAddress.NetworkToHostOrder ((short) tested [1]);
+ AssertEquals ("NetworkToHostOrder #4", short0, (short) expected [1]);
+ short0 = IPAddress.HostToNetworkOrder (short0);
+ AssertEquals ("HostToNetworkOrder #4", short0, (short) tested [1]);
+
+ int0 = IPAddress.NetworkToHostOrder ((int) tested [2]);
+ AssertEquals ("NetworkToHostOrder #5", int0, (int) expected [2]);
+ int0 = IPAddress.HostToNetworkOrder (int0);
+ AssertEquals ("HostToNetworkOrder #5", int0, (int) tested [2]);
+
+ long0 = IPAddress.NetworkToHostOrder (tested [3]);
+ AssertEquals ("NetworkToHostOrder #6", long0, expected [3]);
+ long0 = IPAddress.HostToNetworkOrder (long0);
+ AssertEquals ("HostToNetworkOrder #6", long0, tested [3]);
+ }
+}
+
+}
+
diff --git a/mcs/class/corlib/Test/System.Net/IPEndPointTest.cs b/mcs/class/corlib/Test/System.Net/IPEndPointTest.cs
new file mode 100644
index 00000000000..004fe04cd8c
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Net/IPEndPointTest.cs
@@ -0,0 +1,134 @@
+//
+// IPEndPointTest.cs - NUnit Test Cases for System.Net.IPEndPoint
+//
+// Author:
+// Lawrence Pit (loz@cable.a2000.nl)
+//
+
+using NUnit.Framework;
+using System;
+using System.Net;
+using System.Runtime.InteropServices;
+
+namespace MonoTests.System.Net
+{
+
+public class IPEndPointTest : TestCase
+{
+ private const int MyPort = 42;
+ private const int MyMaxPort = 65535;
+ private const int MyMinPort = 0;
+ private const string MyIPAddressString = "192.168.1.1";
+
+ private IPAddress ipAddress;
+ private long ip;
+ private IPEndPoint endPoint1;
+ private IPEndPoint endPoint2;
+
+ public IPEndPointTest () :
+ base ("[MonoTests.System.Net.IPEndPointTest]") {}
+
+ public IPEndPointTest (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ ipAddress = IPAddress.Parse (MyIPAddressString);
+ ip = ipAddress.Address;
+ endPoint1 = new IPEndPoint(ipAddress, MyPort);
+ endPoint2 = new IPEndPoint(ip, MyPort);
+ }
+
+ protected override void TearDown () {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite(typeof(IPEndPointTest));
+ }
+ }
+
+ public void TestPublicFields ()
+ {
+ AssertEquals ("MinPort", IPEndPoint.MinPort, MyMinPort);
+ AssertEquals ("MaxPort", IPEndPoint.MaxPort, MyMaxPort);
+ }
+
+ public void TestConstructors ()
+ {
+ try {
+ new IPEndPoint(null, 0);
+ Fail("Should raise an ArgumentNullException");
+ } catch (ArgumentNullException) {
+ }
+ try {
+ new IPEndPoint(ipAddress, MyMinPort - 1);
+ Fail("Should raise an ArgumentOutOfRangeException #1");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ new IPEndPoint(ipAddress, MyMaxPort + 1);
+ Fail("Should raise an ArgumentOutOfRangeException #2");
+ } catch (ArgumentOutOfRangeException) {
+ }
+
+ try {
+ new IPEndPoint(ip, MyMinPort -1);
+ Fail("Should raise an ArgumentOutOfRangeException #3");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ new IPEndPoint(ip, MyMaxPort + 1);
+ Fail("Should raise an ArgumentOutOfRangeException #4");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ }
+
+ public void TestPortProperty ()
+ {
+ try {
+ endPoint1.Port = MyMinPort - 1;
+ Fail("Should raise an ArgumentOutOfRangeException #1");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ try {
+ endPoint1.Port = MyMaxPort + 1;
+ Fail("Should raise an ArgumentOutOfRangeException #2");
+ } catch (ArgumentOutOfRangeException) {
+ }
+ }
+
+ public void TestCreateAndSerialize()
+ {
+ SocketAddress addr = endPoint1.Serialize();
+ EndPoint endPoint3 = endPoint2.Create(addr);
+ Assert("#1", endPoint1.Equals(endPoint3));
+
+ IPAddress ipAddress = IPAddress.Parse ("255.255.255.255");
+ IPEndPoint endPoint4 = new IPEndPoint(ipAddress, MyMaxPort);
+ addr = endPoint4.Serialize();
+ EndPoint endPoint5 = endPoint2.Create(addr);
+ Assert("#2", endPoint4.Equals(endPoint5));
+ AssertEquals("#3", endPoint5.ToString(), "255.255.255.255:" + MyMaxPort);
+ }
+
+ public void TestEquals ()
+ {
+ Assert("Equals", endPoint1.Equals(endPoint2));
+ Assert("Not Equals", !endPoint1.Equals(new IPEndPoint(ip, MyPort + 1)));
+ }
+
+ public void TestGetHashCode ()
+ {
+ AssertEquals(endPoint1.GetHashCode(), endPoint2.GetHashCode());
+ }
+
+ public void TestToString ()
+ {
+ AssertEquals("ToString #1", endPoint1.ToString(), MyIPAddressString + ":" + MyPort);
+ AssertEquals("ToString #2", endPoint2.ToString(), MyIPAddressString + ":" + MyPort);
+ }
+
+}
+
+}
+
diff --git a/mcs/class/corlib/Test/System.Resources/AllTests.cs b/mcs/class/corlib/Test/System.Resources/AllTests.cs
new file mode 100644
index 00000000000..0ea192b33a9
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Resources/AllTests.cs
@@ -0,0 +1,27 @@
+//
+// MonoTests.System.Resources.AllTests.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Resources {
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(ResourceReaderTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Resources/ChangeLog b/mcs/class/corlib/Test/System.Resources/ChangeLog
new file mode 100644
index 00000000000..10a4a8f4928
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Resources/ChangeLog
@@ -0,0 +1,17 @@
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * ResourceReaderTest.cs: Fix path name to resource files
+
+2002-01-25 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs:
+ * Empty.resources:
+ * MyResources.resources: Added files
+ * ResourceReaderTest.cs: Test the enumerator
+
+2002-01-24 Nick Drochak <ndrochak@gol.com>
+
+ * ResourceReaderTest.cs: Add new file. This test is not done yet.
+ Wanted to save it in cvs for 'disaster recovery' purposes.
+ Just in case.
+
diff --git a/mcs/class/corlib/Test/System.Resources/Empty.resources b/mcs/class/corlib/Test/System.Resources/Empty.resources
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Resources/Empty.resources
diff --git a/mcs/class/corlib/Test/System.Resources/MyResources.resources b/mcs/class/corlib/Test/System.Resources/MyResources.resources
new file mode 100644
index 00000000000..b486e9e5111
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Resources/MyResources.resources
Binary files differ
diff --git a/mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs b/mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs
new file mode 100644
index 00000000000..5c15a5f63a3
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Resources/ResourceReaderTest.cs
@@ -0,0 +1,144 @@
+//
+// MonoTests.System.Resources.ResourceReaderTest.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+
+using System;
+using System.Resources;
+using System.IO;
+
+using System.Collections;
+using MonoTests.System.Resources;
+using NUnit.Framework;
+
+namespace MonoTests.System.Resources {
+
+ public class ResourceReaderTest : TestCase {
+ private static string m_ResourceFile = "System.Resources\\MyResources.resources";
+ private static string m_BadResourceFile = "System.Resources\\Empty.resources";
+
+ public ResourceReaderTest() : base ("MonoTests.System.Resources.ResourceReaderTest testcase") { }
+ public ResourceReaderTest(String name) : base(name) {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(ResourceReaderTest));
+ }
+ }
+
+ protected override void SetUp() {
+ }
+
+ public void TestConstructorStringExceptions() {
+ ResourceReader r;
+ try {
+ r = new ResourceReader((String)null);
+ Fail("Should throw exception on null");
+ } catch{}
+ try {
+ r = new ResourceReader("");
+ Fail("Should throw exception on empty path");
+ } catch{}
+ try {
+ // use a file name that is *very* unlikely to exsist
+ r = new ResourceReader("j38f8axvnn9h38hfa9nxn93f8hav4zvag87vvah32o");
+ Fail("Should throw exception on file not found");
+ } catch{}
+ try {
+ r = new ResourceReader(m_BadResourceFile);
+ Fail("Should throw exception on bad resource file");
+ }
+ catch {}
+ }
+
+ public void TestConstructorString() {
+ if (!File.Exists(m_ResourceFile)) {
+ Fail("Resource file is not where it should be:" + Directory.GetCurrentDirectory()+ "\\" + m_ResourceFile);
+ }
+ ResourceReader r = null;
+ try {
+ r = new ResourceReader(m_ResourceFile);
+ }
+ catch {
+ Fail("Should have been able to open resource file.");
+ }
+ finally {
+ if (null != r)
+ r.Close();
+ }
+ Assert("String constructor should not be null", null != r);
+ }
+
+ public void TestConstructorStreamExceptions() {
+ ResourceReader r;
+ try {
+ r = new ResourceReader((Stream)null);
+ Fail("Should throw exception on null");
+ } catch{}
+
+ try {
+ Stream stream = new FileStream (m_ResourceFile, FileMode.Open);
+ stream.Close();
+ r = new ResourceReader(stream);
+ Fail("Should throw exception on cannot read");
+ } catch{}
+ }
+
+ public void TestStream(){
+ ResourceReader r = null;
+ try {
+ Stream stream = new FileStream (m_ResourceFile, FileMode.Open);
+ r = new ResourceReader(stream);
+ }
+ catch{
+ Fail("Should not throw exception constructing from stream");
+ }
+ finally {
+ if (null != r) {
+ r.Close();
+ }
+ }
+ }
+
+ public void TestClose() {
+ ResourceReader r = null;
+ Stream stream = new FileStream (m_ResourceFile, FileMode.Open);
+ r = new ResourceReader(stream);
+ r.Close();
+ try {
+ stream = new FileStream (m_ResourceFile, FileMode.Open);
+ }
+ catch{
+ Fail("Should be able to open the stream again after close");
+ }
+ finally {
+ if (null != stream) {
+ stream.Close();
+ }
+ }
+ }
+
+ public void TestEnumerator(){
+ ResourceReader reader = null;
+ Stream stream = new FileStream (m_ResourceFile, FileMode.Open);
+ reader = new ResourceReader(stream);
+ IDictionaryEnumerator en = reader.GetEnumerator();
+ // Goes through the enumerator, printing out the key and value pairs.
+ while (en.MoveNext()) {
+ DictionaryEntry de = (DictionaryEntry)en.Current;
+ Assert("Current.Key should not be empty",String.Empty != (string)de.Key);
+ Assert("Current.Value should not be empty",String.Empty != (string)de.Value);
+ Assert("Current.Value should not be empty",String.Empty != (string)de.Value);
+ Assert("Entry.Key should not be empty",String.Empty != (string)en.Key);
+ Assert("Entry.Value should not be empty",String.Empty != (string)en.Value);
+ }
+ reader.Close();
+ }
+ } // class ResourceReaderTest
+} // namespace MonoTests.System.Resources \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Runtime.Serialization/ObjectIDGeneratorTests.cs b/mcs/class/corlib/Test/System.Runtime.Serialization/ObjectIDGeneratorTests.cs
new file mode 100755
index 00000000000..4ae49a2a282
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Runtime.Serialization/ObjectIDGeneratorTests.cs
@@ -0,0 +1,87 @@
+//
+// System.Runtime.Serialization.ObjectIDGeneratorTests.cs
+//
+// Author: Duncan Mak (duncan@ximian.com)
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Diagnostics;
+using System.Runtime.Serialization;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Runtime.Serialization
+{
+ public class ObjectIDGeneratorTests : TestCase
+ {
+ ObjectIDGenerator generator;
+
+ string obj1 = "obj1";
+ int obj2 = 42;
+ long id;
+
+ public static ITest Suite {
+ get { return new TestSuite (typeof (ObjectIDGeneratorTests)); }
+ }
+
+ public ObjectIDGeneratorTests (string name)
+ : base (name)
+ {
+ }
+
+ protected override void SetUp ()
+ {
+ generator = new ObjectIDGenerator ();
+ }
+
+ //
+ // Tests adding an ID for a new object
+ //
+ public void TestGetId1 ()
+ {
+ bool testBool1;
+ id = generator.GetId (obj1, out testBool1);
+
+ AssertEquals ("A1", 1L, id); // should start at 1
+ AssertEquals ("A2", true, testBool1); // firstTime should be true
+ }
+
+ //
+ // Tests getting the ID for an existing object
+ //
+ public void TestGetId2 ()
+ {
+ bool testBool2;
+ long testId1 = generator.GetId (obj1, out testBool2);
+
+ AssertEquals ("B1", testId1, id); // same object, same ID
+ AssertEquals ("B2", false, testBool2); // no longer firstTime
+ }
+
+ //
+ // Tests getting the ID for an existing object
+ //
+ public void TestHasId1 ()
+ {
+ bool testBool3;
+ long testId2 = generator.HasId (obj1, out testBool3);
+
+ AssertEquals ("C1", false, testBool3); // this has been inserted before
+ AssertEquals ("C2", id, testId2); // we should get the same ID
+ }
+
+ //
+ // Tests getting the ID for a non-existent object
+ //
+ public void TestHasId2 ()
+ {
+ bool testBool4;
+ long testId3 = generator.HasId (obj2, out testBool4);
+
+ AssertEquals ("D1", 0L, testId3);
+ AssertEquals ("D2", true, testBool4);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/AllTests.cs b/mcs/class/corlib/Test/System.Security.Cryptography/AllTests.cs
new file mode 100644
index 00000000000..96b1e4f2500
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/AllTests.cs
@@ -0,0 +1,30 @@
+//
+// TestSuite.System.Security.Cryptography.AllCryptoTests.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography {
+ /// <summary>
+ /// Combines all available crypto unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(SymmetricAlgorithmTest.Suite);
+ suite.AddTest(AsymmetricAlgorithmTest.Suite);
+ suite.AddTest(RNGCryptoServiceProviderTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/AsymmetricAlgorithmTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/AsymmetricAlgorithmTest.cs
new file mode 100755
index 00000000000..37da7bf16fe
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/AsymmetricAlgorithmTest.cs
@@ -0,0 +1,54 @@
+//
+// TestSuite.System.Security.Cryptography.AsymmetricAlgorithmTest.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+
+using System;
+using System.Security.Cryptography;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography {
+
+ public class AsymmetricAlgorithmTest : TestCase {
+ private AsymmetricAlgorithm _algo;
+
+ public AsymmetricAlgorithmTest() : base ("MonoTests.System.Security.Cryptography.AsymmetricAlgorithmTest testcase") {
+ _algo = null;
+ }
+ public AsymmetricAlgorithmTest(String name) : base(name) {
+ _algo = null;
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(AsymmetricAlgorithmTest));
+ }
+ }
+
+ protected override void SetUp() {
+ _algo = AsymmetricAlgorithm.Create();
+ }
+
+ private void SetDefaultData() {
+ }
+
+ public void TestProperties() {
+ Assert("Properties (1)", _algo != null);
+
+ bool thrown = false;
+ try {
+ KeySizes[] keys = _algo.LegalKeySizes;
+ foreach (KeySizes myKey in keys) {
+ for (int i=myKey.MinSize; i<=myKey.MaxSize; i+=myKey.SkipSize) {
+ _algo.KeySize = i;
+ }
+ }
+ } catch (CryptographicException) {thrown=true;}
+ Assert("Properties (2)", !thrown);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/RNGCryptoServiceProviderTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/RNGCryptoServiceProviderTest.cs
new file mode 100644
index 00000000000..f9d16d58df1
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/RNGCryptoServiceProviderTest.cs
@@ -0,0 +1,55 @@
+//
+// TestSuite.System.Security.Cryptography.RNGCryptoServiceProviderTest.cs
+//
+// Author:
+// Mark Crichton (crichton@gimp.org)
+//
+
+
+using System;
+using System.Security.Cryptography;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography {
+
+ public class RNGCryptoServiceProviderTest : TestCase {
+ private RNGCryptoServiceProvider _algo;
+
+ public RNGCryptoServiceProviderTest() : base ("MonoTests.System.Security.Cryptography.RNGCryptoServiceProviderTest testcase") {
+ _algo = null;
+ }
+ public RNGCryptoServiceProviderTest(String name) : base(name) {
+ _algo = null;
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(RNGCryptoServiceProviderTest));
+ }
+ }
+
+ protected override void SetUp() {
+ _algo = new RNGCryptoServiceProvider();
+ }
+
+ private void SetDefaultData() {
+ }
+
+ public void TestProperties() {
+ Assert("Properties (1)", _algo != null);
+
+ byte[] random = new Byte[25];
+
+ // The C code doesn't throw an exception yet.
+ _algo.GetBytes(random);
+
+ // This one we can check...
+ _algo.GetNonZeroBytes(random);
+
+ foreach (Byte rnd_byte in random) {
+ Assert("Properties (2)", rnd_byte != 0);
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SymmetricAlgorithmTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SymmetricAlgorithmTest.cs
new file mode 100755
index 00000000000..0c4c8786925
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/SymmetricAlgorithmTest.cs
@@ -0,0 +1,65 @@
+//
+// TestSuite.System.Security.Cryptography.SymmetricAlgorithmTest.cs
+//
+// Author:
+// Thomas Neidhart (tome@sbox.tugraz.at)
+//
+
+
+using System;
+using System.Security.Cryptography;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Cryptography {
+
+ public class SymmetricAlgorithmTest : TestCase {
+ private SymmetricAlgorithm _algo;
+
+ public SymmetricAlgorithmTest() : base ("MonoTests.System.Security.Cryptography.SymmetricAlgorithmTest testcase") {
+ _algo = null;
+ }
+ public SymmetricAlgorithmTest(String name) : base(name) {
+ _algo = null;
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SymmetricAlgorithmTest));
+ }
+ }
+
+ protected override void SetUp() {
+ _algo = SymmetricAlgorithm.Create();
+ }
+
+ private void SetDefaultData() {
+ }
+
+ public void TestProperties() {
+ Assert("Properties (1)", _algo != null);
+
+ bool thrown = false;
+ try
+ {
+ // try setting an illegal blocksize -> must throw an exception
+ _algo.BlockSize = 12;
+ } catch (CryptographicException) {thrown = true;}
+ Assert("Properties (2)", thrown);
+
+ byte[] key = _algo.Key;
+ Assert("Properties (3)", key != null);
+
+ thrown = false;
+ try {
+ KeySizes[] keys = _algo.LegalKeySizes;
+ foreach (KeySizes myKey in keys) {
+ for (int i=myKey.MinSize; i<=myKey.MaxSize; i+=myKey.SkipSize) {
+ _algo.KeySize = i;
+ }
+ }
+ } catch (CryptographicException) {thrown=true;}
+ Assert("Properties (4)", !thrown);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Permissions/AllTests.cs b/mcs/class/corlib/Test/System.Security.Permissions/AllTests.cs
new file mode 100644
index 00000000000..95782000656
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Permissions/AllTests.cs
@@ -0,0 +1,27 @@
+//
+// MonoTests.System.Security.Permissions.AllTests.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Permissions {
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(FileIOPermissionTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Permissions/ChangeLog b/mcs/class/corlib/Test/System.Security.Permissions/ChangeLog
new file mode 100644
index 00000000000..bcb7d5ab136
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Permissions/ChangeLog
@@ -0,0 +1,11 @@
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * FileIOPermissionTest.cs: Remove intersect test where it was trying
+ to intersect a permission with itself. This throws an exception
+ with mscorlib.
+
+2002-01-14 Nick Drochak <ndrochak@gol.com>
+
+ * FileIOPermissionTest.cs: New File.
+ * AllTests.cs: New File.
+
diff --git a/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs b/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs
new file mode 100644
index 00000000000..e9338e56591
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Permissions/FileIOPermissionTest.cs
@@ -0,0 +1,284 @@
+//
+// MonoTests.System.Security.Permissions.FileIOPermissionTest.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Permissions {
+
+ public class FileIOPermissionTest : TestCase {
+
+ public FileIOPermissionTest() : base ("MonoTests.System.Security.Permissions.FileIOPermissionTest testcase") { }
+ public FileIOPermissionTest(String name) : base(name) {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(FileIOPermissionTest));
+ }
+ }
+
+ protected override void SetUp() {
+ }
+
+ private void SetDefaultData() {
+ }
+
+ public void TestConstructorPermissionState() {
+ FileIOPermission p;
+ p = new FileIOPermission(PermissionState.None);
+ AssertEquals("Should be Restricted", false, p.IsUnrestricted());
+ p = new FileIOPermission(PermissionState.Unrestricted);
+ AssertEquals("Should be Unrestricted", true, p.IsUnrestricted());
+ try{
+ p = new FileIOPermission((PermissionState)77);
+ Fail("Should have thrown an exception on invalid PermissionState");
+ }
+ catch{
+ // we should be here if things are working. nothing to do
+ }
+ }
+
+ public void TestConstructorString() {
+ FileIOPermission p;
+ try{
+ p = new FileIOPermission(FileIOPermissionAccess.Append, "this path is not rooted");
+ Fail("Should have thrown an exception on path not rooted");
+ }
+ catch{}
+
+ 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{}
+
+ try{
+ p = new FileIOPermission((FileIOPermissionAccess)77, "c:\\temp");
+ Fail("Should have thrown an exception on invalid access value");
+ }
+ catch{}
+
+ string pathToAdd = "c:\\temp";
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathToAdd);
+ string[] pathsInPermission = p.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Does not contain correct number of paths. Expected 1 but got: "+pathsInPermission.Length, pathsInPermission.Length == 1);
+ Assert("Does not contain expected path from constructor: "+pathToAdd, pathsInPermission[0] == pathToAdd);
+ }
+
+ public void TestConstructorStringArray() {
+ FileIOPermission p;
+ string[] pathArrayGood = {"c:\\temp1", "d:\\temp2"};
+ string[] pathArrayBad = {"c:\\temp1", "d:\\temp*"};
+ string[] pathsInPermission;
+
+ try{
+ p = new FileIOPermission(FileIOPermissionAccess.Append, pathArrayBad);
+ Fail("Should have thrown an exception on wildcards not allowed in path");
+ }
+ catch{}
+
+ try{
+ p = new FileIOPermission((FileIOPermissionAccess)77, pathArrayGood);
+ Fail("Should have thrown an exception on invalid access value");
+ }
+ catch{}
+
+ 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() {
+ FileIOPermission p;
+ string[] pathArrayGood = {"c:\\temp1", "d:\\temp2"};
+ string[] pathsInPermission;
+
+ 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);
+ }
+
+ p.AddPathList(FileIOPermissionAccess.Append, pathArrayGood);
+ pathsInPermission = p.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Should still contain correct number Read 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);
+ }
+ pathsInPermission = p.GetPathList(FileIOPermissionAccess.Append);
+ Assert("Should contain correct number of Append 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 TestIntersect() {
+ FileIOPermission p;
+ FileIOPermission p2;
+ FileIOPermission unrestricted;
+ FileIOPermission intersection;
+ string[] pathArrayGood = {"c:\\temp1\\", "d:\\temp2\\"};
+ string[] pathArrayGood2 = {"c:\\temp1\\", "d:\\temp2\\", "z:\\something"};
+ string[] pathsInPermission;
+
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
+ p.AllFiles = FileIOPermissionAccess.Append;
+ p.AllLocalFiles = FileIOPermissionAccess.Write;
+
+ unrestricted = new FileIOPermission(PermissionState.Unrestricted);
+
+ 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);
+ Assert("Should have Write bit in AllLocalFiles.", (intersection.AllLocalFiles & FileIOPermissionAccess.Write) != 0);
+
+ intersection = (FileIOPermission)unrestricted.Intersect(p);
+ 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);
+ Assert("Should have Write bit in AllLocalFiles.", (intersection.AllLocalFiles & FileIOPermissionAccess.Write) != 0);
+
+ p2 = new FileIOPermission(FileIOPermissionAccess.Append | FileIOPermissionAccess.Read, pathArrayGood2);
+ p2.AllFiles = FileIOPermissionAccess.Append | FileIOPermissionAccess.Write;
+ p2.AllLocalFiles = FileIOPermissionAccess.Write | FileIOPermissionAccess.Read;
+ intersection = (FileIOPermission)p.Intersect(p2);
+ 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 only Append bit in AllFiles.", intersection.AllFiles == FileIOPermissionAccess.Append);
+ Assert("Should have only Write bit in AllLocalFiles.", intersection.AllLocalFiles == FileIOPermissionAccess.Write);
+
+ intersection = (FileIOPermission)p2.Intersect(p);
+ 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 only Append bit in AllFiles.", intersection.AllFiles == FileIOPermissionAccess.Append);
+ Assert("Should have only Write bit in AllLocalFiles.", intersection.AllLocalFiles == FileIOPermissionAccess.Write);
+ }
+
+ public void TestIsSubsetOf() {
+ FileIOPermission p;
+ FileIOPermission p2;
+ FileIOPermission unrestricted;
+ string[] pathArrayGood = {"c:\\temp1\\", "d:\\temp2\\"};
+ string[] pathArrayGood2 = {"c:\\temp1\\", "d:\\temp2\\", "z:\\something"};
+
+ unrestricted = new FileIOPermission(PermissionState.Unrestricted);
+ Assert("IsSubsetOf reflective test failed", unrestricted.IsSubsetOf(unrestricted));
+
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
+ p.AllFiles = FileIOPermissionAccess.Append;
+ p.AllLocalFiles = FileIOPermissionAccess.Write;
+ Assert("IsSubsetOf reflective test failed", p.IsSubsetOf(p));
+ Assert("IsSubsetOf false test failed", !unrestricted.IsSubsetOf(p));
+ Assert("IsSubsetOf true test failed", p.IsSubsetOf(unrestricted));
+
+ p2 = new FileIOPermission(FileIOPermissionAccess.Append | FileIOPermissionAccess.Read, pathArrayGood2);
+ p2.AllFiles = FileIOPermissionAccess.Append | FileIOPermissionAccess.Write;
+ p2.AllLocalFiles = FileIOPermissionAccess.Write | FileIOPermissionAccess.Read;
+ Assert("IsSubsetOf reflective test failed", p2.IsSubsetOf(p2));
+
+ Assert("IsSubsetOf true test failed", p.IsSubsetOf(p2));
+ Assert("IsSubsetOf false test failed", !p2.IsSubsetOf(p));
+ }
+
+ public void TestUnion() {
+ FileIOPermission p;
+ FileIOPermission p2;
+ FileIOPermission unrestricted;
+ FileIOPermission union;
+ string[] pathArrayGood = {"c:\\temp1\\", "d:\\temp2\\"};
+ string[] pathArrayGood2 = {"c:\\temp1\\", "d:\\temp2\\", "z:\\something"};
+ string[] pathsInPermission;
+
+ unrestricted = new FileIOPermission(PermissionState.Unrestricted);
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
+ 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);
+
+ union = (FileIOPermission)p.Union(unrestricted);
+ pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Should get an unrestricted permission", union.IsUnrestricted());
+ Assert("Path list should be empty", pathsInPermission == null);
+
+ p2 = new FileIOPermission(FileIOPermissionAccess.Append, pathArrayGood2);
+
+ union = (FileIOPermission)p.Union(p2);
+ pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Path list should have 2 for Read", pathsInPermission.Length == pathArrayGood.Length);
+ pathsInPermission = union.GetPathList(FileIOPermissionAccess.Append);
+ Assert("Path list should have 3 for Append", pathsInPermission.Length == pathArrayGood2.Length);
+
+ union = (FileIOPermission)p2.Union(p);
+ pathsInPermission = union.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Path list should have 2 for Read", pathsInPermission.Length == pathArrayGood.Length);
+ pathsInPermission = union.GetPathList(FileIOPermissionAccess.Append);
+ Assert("Path list should have 3 for Append", pathsInPermission.Length == pathArrayGood2.Length);
+ }
+
+ public void TestFromXML() {
+ FileIOPermission p = new FileIOPermission(PermissionState.None);
+ SecurityElement esd;
+ string[] pathsInPermission;
+
+ esd = new SecurityElement("IPermission");
+ esd.AddAttribute("class", "FileIOPermission");
+ esd.AddAttribute("version", "1");
+ esd.AddAttribute("Unrestricted", "true");
+ p.FromXml(esd);
+ Assert("Should get an unrestricted permission", p.IsUnrestricted());
+
+ esd = new SecurityElement("IPermission");
+ esd.AddAttribute("class", "FileIOPermission");
+ esd.AddAttribute("version", "1");
+ esd.AddAttribute("Read", "c:\\temp;d:\\temp2");
+ esd.AddAttribute("Write", "c:\\temp;d:\\temp2;z:\\temp3");
+
+ p = new FileIOPermission(PermissionState.None);
+ p.FromXml(esd);
+ pathsInPermission = p.GetPathList(FileIOPermissionAccess.Read);
+ Assert("Path list should have 2 for Read", pathsInPermission.Length == 2);
+ pathsInPermission = p.GetPathList(FileIOPermissionAccess.Write);
+ Assert("Path list should have 2 for Write", pathsInPermission.Length == 3);
+ }
+
+ public void TestToXML() {
+ FileIOPermission p;
+ SecurityElement esd;
+ string[] pathsInPermission;
+ string read;
+ string[] pathArrayGood = {"c:\\temp1\\", "d:\\temp2\\"};
+ p = new FileIOPermission(FileIOPermissionAccess.Read, pathArrayGood);
+ esd = p.ToXml();
+ Assert("Esd tag incorrect", esd.Tag == "IPermission");
+ Assert("Esd version incorrect", (String)esd.Attributes["version"] == "1");
+ read = (String)esd.Attributes["Read"];
+ pathsInPermission = read.Split(';');
+ Assert("Path list should have 2 for Read", pathsInPermission.Length == 2);
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Security.Policy/AllTests.cs b/mcs/class/corlib/Test/System.Security.Policy/AllTests.cs
new file mode 100644
index 00000000000..a0632fdd70c
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/AllTests.cs
@@ -0,0 +1,27 @@
+//
+// MonoTests.System.Security.Policy.AllTests.cs
+//
+// Author:
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak II
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Security.Policy {
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest(CodeGroupTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
diff --git a/mcs/class/corlib/Test/System.Security.Policy/ChangeLog b/mcs/class/corlib/Test/System.Security.Policy/ChangeLog
new file mode 100644
index 00000000000..51b9aae2eab
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/ChangeLog
@@ -0,0 +1,15 @@
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Add new file.
+
+2002-02-07 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroupTest.cs: Tests everything except the (To|From)Xml methods.
+
+2002-02-01 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroupTest.cs: Still not done, checking in now just in case
+
+2002-01-30 Nick Drochak <ndrochak@gol.com>
+
+ * CodeGroupTest.cs: New File. Not done, but checking in now just in case \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs b/mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs
new file mode 100644
index 00000000000..73415017c3d
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Security.Policy/CodeGroupTest.cs
@@ -0,0 +1,248 @@
+//
+// MonoTests.System.Security.Policy.CodeGroupTest
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.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
+ {
+
+ public CodeGroupTest( string name ): base(name)
+ {
+ }
+
+ public CodeGroupTest() : base("CodeGroupTest")
+ {
+ }
+
+ public static ITest Suite
+ {
+ get
+ {
+ return new TestSuite(typeof(CodeGroupTest));
+ }
+ }
+
+ protected override void SetUp()
+ {
+ }
+
+ 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 (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
+
+} // namespace MonoTests.System.Security.Policy \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs b/mcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs
new file mode 100755
index 00000000000..971a37fc633
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Text/ASCIIEncodingTest.cs
@@ -0,0 +1,192 @@
+// ASCIIEncodingTest - NUnit Test Cases for the System.Text.ASCIIEncoding class
+//
+// Author: Mike Kestner <mkestner@speakeasy.net>
+//
+// <c> 2002 Mike Kestner
+
+using NUnit.Framework;
+using System.Text;
+using System;
+
+
+namespace MonoTests.System.Text {
+
+ public class ASCIIEncodingTest : TestCase {
+
+ private char[] testchars;
+ private byte[] testbytes;
+
+ public static ITest Suite {
+ get {
+ TestSuite suite = new TestSuite ();
+ suite.AddTest (new ASCIIEncodingTest ("TestGetBytes1"));
+ suite.AddTest (new ASCIIEncodingTest ("TestGetBytes2"));
+ suite.AddTest (new ASCIIEncodingTest ("TestGetBytes3"));
+ suite.AddTest (new ASCIIEncodingTest ("TestGetBytes4"));
+ suite.AddTest (new ASCIIEncodingTest ("TestGetBytes5"));
+ suite.AddTest (new ASCIIEncodingTest ("TestGetBytes6"));
+ suite.AddTest (new ASCIIEncodingTest ("TestGetChars1"));
+ suite.AddTest (new ASCIIEncodingTest ("TestGetChars2"));
+ suite.AddTest (new ASCIIEncodingTest ("TestGetChars3"));
+ suite.AddTest (new ASCIIEncodingTest ("TestGetChars4"));
+ suite.AddTest (new ASCIIEncodingTest ("TestGetString1"));
+ suite.AddTest (new ASCIIEncodingTest ("TestGetString2"));
+ suite.AddTest (new ASCIIEncodingTest ("TestDecoder"));
+ suite.AddTest (new ASCIIEncodingTest ("TestEncoder"));
+ return suite;
+ }
+ }
+
+ public ASCIIEncodingTest (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ testchars = new char[4];
+ testchars[0] = 'T';
+ testchars[1] = 'e';
+ testchars[2] = 's';
+ testchars[3] = 't';
+ testbytes = new byte[4];
+ testbytes[0] = (byte) 'T';
+ testbytes[1] = (byte) 'e';
+ testbytes[2] = (byte) 's';
+ testbytes[3] = (byte) 't';
+ }
+
+ // Test GetBytes(char[])
+ public void TestGetBytes1 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = ascii_encoding.GetBytes(testchars);
+ for (int i = 0; i < testchars.Length; i++)
+ AssertEquals (testchars[i], (char) bytes[i]);
+ }
+
+ // Test GetBytes(char[], int, int)
+ public void TestGetBytes2 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = ascii_encoding.GetBytes(testchars, 1, 1);
+ AssertEquals (1, bytes.Length);
+ AssertEquals (testchars[1], (char) bytes[0]);
+ }
+
+ // Test non-ASCII char in char[]
+ public void TestGetBytes3 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ testchars[2] = (char) 0x80;
+ byte[] bytes = ascii_encoding.GetBytes(testchars);
+ AssertEquals ('T', (char) bytes[0]);
+ AssertEquals ('e', (char) bytes[1]);
+ AssertEquals ('?', (char) bytes[2]);
+ AssertEquals ('t', (char) bytes[3]);
+ }
+
+ // Test GetBytes(char[], int, int, byte[], int)
+ public void TestGetBytes4 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = new Byte[1];
+ int cnt = ascii_encoding.GetBytes(testchars, 1, 1, bytes, 0);
+ AssertEquals (1, cnt);
+ AssertEquals (testchars[1], (char) bytes[0]);
+ }
+
+ // Test GetBytes(string, int, int, byte[], int)
+ public void TestGetBytes5 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = new Byte[1];
+ int cnt = ascii_encoding.GetBytes("Test", 1, 1, bytes, 0);
+ AssertEquals ('e', (char) bytes[0]);
+ }
+
+ // Test GetBytes(string)
+ public void TestGetBytes6 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = ascii_encoding.GetBytes("Test");
+ for (int i = 0; i < testchars.Length; i++)
+ AssertEquals (testchars[i], (char) bytes[i]);
+ }
+
+ // Test GetChars(byte[])
+ public void TestGetChars1 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ char[] chars = ascii_encoding.GetChars(testbytes);
+ for (int i = 0; i < testbytes.Length; i++)
+ AssertEquals (testbytes[i], (byte) chars[i]);
+ }
+
+ // Test GetChars(byte[], int, int)
+ public void TestGetChars2 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ char[] chars = ascii_encoding.GetChars(testbytes, 1, 1);
+ AssertEquals (1, chars.Length);
+ AssertEquals (testbytes[1], (byte) chars[0]);
+ }
+
+ // Test non-ASCII char in byte[]
+ public void TestGetChars3 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ testbytes[2] = 0x80;
+ char[] chars = ascii_encoding.GetChars(testbytes);
+ AssertEquals ('T', chars[0]);
+ AssertEquals ('e', chars[1]);
+ AssertEquals ('?', chars[2]);
+ AssertEquals ('t', chars[3]);
+ }
+
+ // Test GetChars(byte[], int, int, char[], int)
+ public void TestGetChars4 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ char[] chars = new char[1];
+ int cnt = ascii_encoding.GetChars(testbytes, 1, 1, chars, 0);
+ AssertEquals (1, cnt);
+ AssertEquals (testbytes[1], (byte) chars[0]);
+ }
+
+ // Test GetString(char[])
+ public void TestGetString1 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ string str = ascii_encoding.GetString(testbytes);
+ AssertEquals ("Test", str);
+ }
+
+ // Test GetString(char[], int, int)
+ public void TestGetString2 ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ string str = ascii_encoding.GetString(testbytes, 1, 2);
+ AssertEquals ("es", str);
+ }
+
+ // Test Decoder
+ public void TestDecoder ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ char[] chars = new char[1];
+ int cnt = ascii_encoding.GetDecoder().GetChars(testbytes, 1, 1, chars, 0);
+ AssertEquals (1, cnt);
+ AssertEquals (testbytes[1], (byte) chars[0]);
+ }
+
+ // Test Decoder
+ public void TestEncoder ()
+ {
+ Encoding ascii_encoding = Encoding.ASCII;
+ byte[] bytes = new Byte[1];
+ int cnt = ascii_encoding.GetEncoder().GetBytes(testchars, 1, 1, bytes, 0, false);
+ AssertEquals (1, cnt);
+ AssertEquals (testchars[1], (char) bytes[0]);
+ }
+
+ }
+
+}
diff --git a/mcs/class/corlib/Test/System.Text/AllTests.cs b/mcs/class/corlib/Test/System.Text/AllTests.cs
new file mode 100644
index 00000000000..1069b3a3f91
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Text/AllTests.cs
@@ -0,0 +1,30 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Text {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ //suite.AddTest(StringBuilderTest.Suite);
+ suite.AddTest(ASCIIEncodingTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System.Text/ChangeLog b/mcs/class/corlib/Test/System.Text/ChangeLog
new file mode 100644
index 00000000000..46c490e50a2
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Text/ChangeLog
@@ -0,0 +1,13 @@
+2002-03-17 Mike Kestner <mkestner@speakeasy.net>
+
+ * ASCIIEncodingTest.cs : New suite for ASCIIEncoding.
+ * AllTests.cs : Add the new suite.
+
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Remove StringBuilderTest suite. There's a major failure
+ when it's included and the test errors aren't displayed.
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * StringBuilderTest.cs: Fixed tests that were failing against mscorlib.
diff --git a/mcs/class/corlib/Test/System.Text/StringBuilderTest.cs b/mcs/class/corlib/Test/System.Text/StringBuilderTest.cs
new file mode 100644
index 00000000000..9f2677e1f1c
--- /dev/null
+++ b/mcs/class/corlib/Test/System.Text/StringBuilderTest.cs
@@ -0,0 +1,238 @@
+//
+// StringBuilderTest.dll - NUnit Test Cases for the System.Text.StringBuilder class
+//
+// Author: Marcin Szczepanski (marcins@zipworld.com.au)
+//
+// NOTES: I've also run all these tests against the MS implementation of
+// System.Text.StringBuilder to confirm that they return the same results
+// and they do.
+//
+// TODO: Add tests for the AppendFormat methods once the AppendFormat methods
+// are implemented in the StringBuilder class itself
+//
+// TODO: Potentially add more variations on Insert / Append tests for all the
+// possible types. I don't really think that's necessary as they all
+// pretty much just do .ToString().ToCharArray() and then use the Append / Insert
+// CharArray function. The ToString() bit for each type should be in the unit
+// tests for those types, and the unit test for ToCharArray should be in the
+// string test type. If someone wants to add those tests here for completness
+// (and some double checking) then feel free :)
+//
+
+using NUnit.Framework;
+using System.Text;
+using System;
+
+namespace MonoTests.System.Text {
+
+public class StringBuilderTest : TestCase {
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(StringBuilderTest));
+ }
+ }
+
+ public StringBuilderTest( string name ) : base(name) { }
+
+
+ private StringBuilder sb;
+
+ public void TestConstructor1()
+ {
+ // check the parameterless ctor
+ sb = new StringBuilder();
+ AssertEquals(String.Empty, sb.ToString());
+ AssertEquals(0, sb.Length);
+ AssertEquals(16, sb.Capacity);
+ }
+
+ public void TestConstructor2()
+ {
+ // check ctor that specifies the capacity
+ sb = new StringBuilder(10);
+ AssertEquals(String.Empty, sb.ToString());
+ AssertEquals(0, sb.Length);
+ // check that capacity is not less than default
+ AssertEquals(10, sb.Capacity);
+
+ sb = new StringBuilder(42);
+ AssertEquals(String.Empty, sb.ToString());
+ AssertEquals(0, sb.Length);
+ // check that capacity is set
+ AssertEquals(42, sb.Capacity);
+ }
+
+ public void TestConstructor3() {
+ // check ctor that specifies the capacity & maxCapacity
+ sb = new StringBuilder(444, 1234);
+ AssertEquals(String.Empty, sb.ToString());
+ AssertEquals(0, sb.Length);
+ AssertEquals(444, sb.Capacity);
+ AssertEquals(1234, sb.MaxCapacity);
+ }
+
+ public void TestConstructor4()
+ {
+ // check for exception in ctor that specifies the capacity & maxCapacity
+ try {
+ sb = new StringBuilder(9999, 15);
+ }
+ catch (ArgumentOutOfRangeException) {
+ return;
+ }
+ // if we didn't catch an exception, then we have a problem Houston.
+ NUnit.Framework.Assertion.Fail("Capacity exeeds MaxCapacity");
+ }
+
+ public void TestConstructor5() {
+ String someString = null;
+ sb = new StringBuilder(someString);
+ AssertEquals("Should be empty string", String.Empty, sb.ToString());
+ }
+
+ public void TestConstructor6() {
+ // check for exception in ctor that prevents startIndex less than zero
+ try {
+ String someString = "someString";
+ sb = new StringBuilder(someString, -1, 3, 18);
+ }
+ catch (ArgumentOutOfRangeException) {
+ return;
+ }
+ // if we didn't catch an exception, then we have a problem Houston.
+ NUnit.Framework.Assertion.Fail("StartIndex not allowed to be less than zero.");
+ }
+
+ public void TestConstructor7() {
+ // check for exception in ctor that prevents length less than zero
+ try {
+ String someString = "someString";
+ sb = new StringBuilder(someString, 2, -222, 18);
+ }
+ catch (ArgumentOutOfRangeException) {
+ return;
+ }
+ // if we didn't catch an exception, then we have a problem Houston.
+ NUnit.Framework.Assertion.Fail("Length not allowed to be less than zero.");
+ }
+
+ public void TestConstructor8() {
+ // check for exception in ctor that ensures substring is contained in given string
+ // check that startIndex is not too big
+ try {
+ String someString = "someString";
+ sb = new StringBuilder(someString, 10000, 4, 18);
+ }
+ catch (ArgumentOutOfRangeException) {
+ return;
+ }
+ // if we didn't catch an exception, then we have a problem Houston.
+ NUnit.Framework.Assertion.Fail("StartIndex and length must refer to a location within the string.");
+ }
+
+ public void TestConstructor9() {
+ // check for exception in ctor that ensures substring is contained in given string
+ // check that length doesn't go beyond end of string
+ try {
+ String someString = "someString";
+ sb = new StringBuilder(someString, 4, 4000, 18);
+ }
+ catch (ArgumentOutOfRangeException) {
+ return;
+ }
+ // if we didn't catch an exception, then we have a problem Houston.
+ NUnit.Framework.Assertion.Fail("StartIndex and length must refer to a location within the string.");
+ }
+
+ public void TestConstructor10() {
+ // check that substring is taken properly and made into a StringBuilder
+ String someString = "someString";
+ sb = new StringBuilder(someString, 4, 6, 18);
+ string expected = "String";
+ AssertEquals( expected, sb.ToString());
+ }
+
+ public void TestAppend() {
+ StringBuilder sb = new StringBuilder( "Foo" );
+ sb.Append( "Two" );
+ string expected = "FooTwo";
+ AssertEquals( expected, sb.ToString() );
+ }
+
+ public void TestInsert() {
+ StringBuilder sb = new StringBuilder();
+
+ AssertEquals( String.Empty, sb.ToString() );
+ /* Test empty StringBuilder conforms to spec */
+
+ sb.Insert( 0, "Foo" ); /* Test insert at start of empty string */
+
+ AssertEquals( "Foo", sb.ToString() );
+
+ sb.Insert( 1, "!!" ); /* Test insert not at start of string */
+
+ AssertEquals( "F!!oo", sb.ToString() );
+
+ sb.Insert( 5, ".." ); /* Test insert at end of string */
+
+ AssertEquals( "F!!oo..", sb.ToString() );
+
+ sb.Insert( 0, 1234 ); /* Test insert of a number (at start of string) */
+
+ // FIX: Why does this test fail?
+ //AssertEquals( "1234F!!oo..", sb.ToString() );
+
+ sb.Insert( 5, 1.5 ); /* Test insert of a decimal (and end of string) */
+
+ // FIX: Why does this test fail?
+ //AssertEquals( "1234F1.5!!oo..", sb.ToString() );
+
+ sb.Insert( 4, 'A' ); /* Test char insert in middle of string */
+
+ // FIX: Why does this test fail?
+ //AssertEquals( "1234AF1.5!!oo..", sb.ToString() );
+
+ }
+
+ public void TestReplace() {
+ StringBuilder sb = new StringBuilder( "Foobarbaz" );
+
+ sb.Replace( "bar", "!!!" ); /* Test same length replace in middle of string */
+
+ AssertEquals( "Foo!!!baz", sb.ToString() );
+
+ sb.Replace( "Foo", "ABcD" ); /* Test longer replace at start of string */
+
+ AssertEquals( "ABcD!!!baz", sb.ToString() );
+
+ sb.Replace( "baz", "00" ); /* Test shorter replace at end of string */
+
+ AssertEquals( "ABcD!!!00", sb.ToString() );
+
+ sb.Replace( sb.ToString(), null ); /* Test string clear as in spec */
+
+ AssertEquals( String.Empty, sb.ToString() );
+
+ /* | 10 20 30
+ /* |0123456789012345678901234567890| */
+ sb.Append( "abc this is testing abc the abc abc partial replace abc" );
+
+ sb.Replace( "abc", "!!!", 0, 31 ); /* Partial replace at start of string */
+
+ AssertEquals( "!!! this is testing !!! the !!! abc partial replace abc", sb.ToString() );
+
+ sb.Replace( "testing", "", 0, 15 ); /* Test replace across boundary */
+
+ AssertEquals( "!!! this is testing !!! the !!! abc partial replace abc", sb.ToString() );
+
+ sb.Replace( "!!!", "" ); /* Test replace with empty string */
+
+ AssertEquals(" this is testing the abc partial replace abc", sb.ToString() );
+ }
+
+ public void TestAppendFormat() {
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/AllTests.cs b/mcs/class/corlib/Test/System/AllTests.cs
new file mode 100644
index 00000000000..de7d7410418
--- /dev/null
+++ b/mcs/class/corlib/Test/System/AllTests.cs
@@ -0,0 +1,56 @@
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class AllTests : TestCase {
+
+ public AllTests(string name) : base(name) {}
+
+ public static ITest Suite {
+ get
+ {
+ TestSuite suite = new TestSuite();
+ suite.AddTest (ArrayTest.Suite);
+ suite.AddTest (AttributeTest.Suite);
+ suite.AddTest (BitConverterTest.Suite);
+ suite.AddTest (BooleanTest.Suite);
+ suite.AddTest (ByteTest.Suite);
+ suite.AddTest (CharEnumeratorTest.Suite);
+ suite.AddTest (CharTest.Suite);
+ suite.AddTest (ConsoleTest.Suite);
+ suite.AddTest (DateTimeTest.Suite);
+ suite.AddTest (DoubleTest.Suite);
+ suite.AddTest (EnumTest.Suite);
+ suite.AddTest (GuidTest.Suite);
+ suite.AddTest (Int16Test.Suite);
+ suite.AddTest (Int32Test.Suite);
+ suite.AddTest (Int64Test.Suite);
+ suite.AddTest (IntegerFormatterTest.Suite);
+ suite.AddTest (MathTest.Suite);
+ suite.AddTest (ObjectTest.Suite);
+ suite.AddTest (RandomTest.Suite);
+ suite.AddTest (ResolveEventArgsTest.Suite);
+ suite.AddTest (SByteTest.Suite);
+ suite.AddTest (StringTest.Suite);
+ suite.AddTest (TimeSpanTest.Suite);
+ suite.AddTest (TimeZoneTest.Suite);
+ suite.AddTest (UInt16Test.Suite);
+ suite.AddTest (UInt32Test.Suite);
+ suite.AddTest (UInt64Test.Suite);
+ suite.AddTest (VersionTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System/ArrayTest.cs b/mcs/class/corlib/Test/System/ArrayTest.cs
new file mode 100644
index 00000000000..33e76c49a37
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ArrayTest.cs
@@ -0,0 +1,1996 @@
+// ArrayTest.cs - NUnit Test Cases for the System.Array class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Collections;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class ArrayTest : TestCase
+{
+ public ArrayTest() : base ("MonoTests.System.ArrayTest testsuite") {}
+ public ArrayTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(ArrayTest));
+ }
+ }
+
+ public void TestIsFixedSize() {
+ char[] a1 = {'a'};
+ Assert("All arrays are fixed", a1.IsFixedSize);
+ }
+
+ public void TestIsReadOnly() {
+ char[] a1 = {'a'};
+ Assert("No array is readonly", !a1.IsReadOnly);
+ }
+
+ public void TestIsSynchronized() {
+ char[] a1 = {'a'};
+ Assert("No array is synchronized", !a1.IsSynchronized);
+ }
+
+ public void TestLength() {
+ {
+ char[] a1 = { };
+ AssertEquals("Zero length array", 0, a1.Length);
+ }
+ {
+ char[] a1 = {'c'};
+ AssertEquals("One-length array", 1, a1.Length);
+ }
+ {
+ char[] a1 = {'c', 'c'};
+ AssertEquals("Two-length array", 2, a1.Length);
+ }
+ }
+
+ public void TestRank() {
+ char[] a1 = { 'c', 'd', 'e' };
+ AssertEquals("Rank one", 1, a1.Rank);
+
+ char[,] a2 = new Char[3,3];
+ AssertEquals("Rank two", 2, a2.Rank);
+
+ char[,,] a3 = new Char[3,3,3];
+ AssertEquals("Rank three", 3, a3.Rank);
+ }
+
+ public void TestBinarySearch1() {
+ bool errorThrown = false;
+ try {
+ Array.BinarySearch(null, "blue");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#B01", errorThrown);
+ errorThrown = false;
+ try {
+ char[,] c1 = new Char[2,2];
+ Array.BinarySearch(c1, "needle");
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#B02", errorThrown);
+
+ {
+ char[] arr = {'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ Assert("#B05",
+ Array.BinarySearch(arr, 'c') >= 3);
+ Assert("#B06",
+ Array.BinarySearch(arr, 'c') < 6);
+ }
+ {
+ char[] arr = {'a', 'b', 'b', 'd', 'd', 'd', 'e', 'e'};
+ AssertEquals("#B07",
+ -4, Array.BinarySearch(arr, 'c'));
+ }
+ {
+ char[] arr = {'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ AssertEquals("#B08",
+ -9, Array.BinarySearch(arr, 'e'));
+ }
+ }
+ public void TestBinarySearch2() {
+ bool errorThrown = false;
+ try {
+ Array.BinarySearch(null, 0, 1, "blue");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#B20", errorThrown);
+ errorThrown = false;
+ try {
+ char[,] c1 = new Char[2,2];
+ Array.BinarySearch(c1, 0, 1, "needle");
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#B21", errorThrown);
+ errorThrown = false;
+ try {
+ char[] c1 = {'a'};
+ Array.BinarySearch(c1, -1, 1, 'a');
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#B22", errorThrown);
+ errorThrown = false;
+ try {
+ char[] c1 = {'a'};
+ Array.BinarySearch(c1, 0, -1, 'a');
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#B23", errorThrown);
+ errorThrown = false;
+ try {
+ char[] c1 = {'a'};
+ Array.BinarySearch(c1, 0, 4, 'a');
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#B24", errorThrown);
+
+ {
+ char[] arr = {'z', 'z', 'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ Assert("#B26",
+ Array.BinarySearch(arr, 2, 8, 'c') >= 5);
+ Assert("#B27",
+ Array.BinarySearch(arr, 2, 8, 'c') < 8);
+ }
+ {
+ char[] arr = {'z', 'z', 'a', 'b', 'b', 'd', 'd', 'd', 'e', 'e'};
+ AssertEquals("#B28",
+ -6, Array.BinarySearch(arr, 2, 8, 'c'));
+ }
+ {
+ char[] arr = {'z', 'z', 'a', 'b', 'b', 'c', 'c', 'c', 'd', 'd'};
+ AssertEquals("#B29",
+ -11, Array.BinarySearch(arr, 2, 8, 'e'));
+ }
+ }
+
+ // TODO - testBinarySearch with explicit IComparer args
+
+ public void TestClear() {
+ bool errorThrown = false;
+ try {
+ Array.Clear(null, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#C01", errorThrown);
+
+ int[] i1 = { 1, 2, 3, 4 };
+ {
+ int[] compare = {1,2,3,4};
+ AssertEquals("#C02", compare[0], i1[0]);
+ AssertEquals("#C03", compare[1], i1[1]);
+ AssertEquals("#C04", compare[2], i1[2]);
+ AssertEquals("#C05", compare[3], i1[3]);
+ }
+ Array.Clear(i1, 3, 1);
+ {
+ int[] compare = {1,2,3,0};
+ AssertEquals("#C06", compare[0], i1[0]);
+ AssertEquals("#C07", compare[1], i1[1]);
+ AssertEquals("#C08", compare[2], i1[2]);
+ AssertEquals("#C09", compare[3], i1[3]);
+ }
+ Array.Clear(i1, 1, 1);
+ {
+ int[] compare = {1,0,3,0};
+ AssertEquals("#C10", compare[0], i1[0]);
+ AssertEquals("#C11", compare[1], i1[1]);
+ AssertEquals("#C12", compare[2], i1[2]);
+ AssertEquals("#C13", compare[3], i1[3]);
+ }
+ Array.Clear(i1, 1, 3);
+ {
+ int[] compare = {1,0,0,0};
+ AssertEquals("#C14", compare[0], i1[0]);
+ AssertEquals("#C15", compare[1], i1[1]);
+ AssertEquals("#C16", compare[2], i1[2]);
+ AssertEquals("#C17", compare[3], i1[3]);
+ }
+
+ string[] s1 = { "red", "green", "blue" };
+ Array.Clear(s1, 0, 3);
+ {
+ string[] compare = {null, null, null};
+ AssertEquals("#C18", compare[0], s1[0]);
+ AssertEquals("#C19", compare[1], s1[1]);
+ AssertEquals("#C20", compare[2], s1[2]);
+ }
+ }
+
+ public void TestClone() {
+ char[] c1 = {'a', 'b', 'c'};
+ char[] c2 = (char[])c1.Clone();
+ AssertEquals("#D01", c1[0], c2[0]);
+ AssertEquals("#D02", c1[1], c2[1]);
+ AssertEquals("#D03", c1[2], c2[2]);
+
+ char[] d10 = {'a', 'b'};
+ char[] d11 = {'a', 'c'};
+ char[] d12 = {'b', 'c'};
+ char[][] d1 = {d10, d11, d12};
+ char[][] d2 = (char[][])d1.Clone();
+ AssertEquals("#D04", d1[0], d2[0]);
+ AssertEquals("#D05", d1[1], d2[1]);
+ AssertEquals("#D06", d1[2], d2[2]);
+
+ d1[0][0] = 'z';
+ AssertEquals("#D07", d1[0], d2[0]);
+ }
+
+ public void TestCopy() {
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = {};
+ Array.Copy(c1, null, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#E01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = {};
+ Array.Copy(null, c1, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#E02", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ Char[,] c2 = new Char[1,1];
+ Array.Copy(c1, c2, 1);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#E03", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ string[] s1 = new String[1];
+ Array.Copy(c1, s1, 1);
+ } catch (ArrayTypeMismatchException) {
+ errorThrown = true;
+ }
+ Assert("#E04", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ Object[] o1 = new Object[1];
+ o1[0] = "hello";
+ Array.Copy(o1, c1, 1);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+ Assert("#E05", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ Char[] c2 = new Char[1];
+ Array.Copy(c1, c2, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#E06", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ Char[] c2 = new Char[2];
+ Array.Copy(c1, c2, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E07", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[1];
+ Char[] c2 = new Char[2];
+ Array.Copy(c2, c1, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E08", errorThrown);
+ }
+
+ char[] orig = {'a', 'b', 'd', 'a'};
+ char[] copy = new Char[4];
+ Array.Copy(orig, copy, 4);
+ for (int i = 0; i < orig.Length; i++) {
+ AssertEquals("#E09(" + i + ")",
+ orig[i], copy[i]);
+ }
+ Array.Clear(copy, 0, copy.Length);
+ for (int i = 0; i < orig.Length; i++) {
+ AssertEquals("#E10(" + i + ")",
+ (char)0, copy[i]);
+ }
+ Array.Copy(orig, copy, 2);
+ AssertEquals("#E11", orig[0], copy[0]);
+ AssertEquals("#E12", orig[1], copy[1]);
+ Assert("#E13", orig[2] != copy[2]);
+ Assert("#E14", orig[3] != copy[3]);
+ }
+ public void TestCopy2() {
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[] c2 = new Char[2];
+ Array.Copy(c2, 1, c1, 0, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E31", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[] c2 = new Char[2];
+ Array.Copy(c2, 0, c1, 1, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E32", errorThrown);
+ }
+
+ char[] orig = {'a', 'b', 'd', 'a'};
+ char[] copy = new Char[4];
+ Array.Copy(orig, 1, copy, 1, 3);
+ Assert("#E33", copy[0] != orig[0]);
+ for (int i = 1; i < orig.Length; i++) {
+ AssertEquals("#E34(" + i + ")",
+ orig[i], copy[i]);
+ }
+ Array.Clear(copy, 0, copy.Length);
+ Array.Copy(orig, 1, copy, 0, 2);
+ AssertEquals("#E35", orig[1], copy[0]);
+ AssertEquals("#E36", orig[2], copy[1]);
+ Assert("#E37", copy[2] != orig[2]);
+ Assert("#E38", copy[3] != orig[3]);
+ }
+
+ public void TestCopyTo() {
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ c1.CopyTo(null, 2);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#E61", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[,] c2 = new Char[2,2];
+ c1.CopyTo(c2, 2);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E62", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[,] c1 = new Char[2,2];
+ Char[] c2 = new Char[2];
+ c1.CopyTo(c2, -1);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#E63", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[,] c1 = new Char[2,2];
+ Char[] c2 = new Char[2];
+ c1.CopyTo(c2, 2);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#E64", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[] c2 = new Char[2];
+ c1.CopyTo(c2, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#E65", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[] c2 = new Char[2];
+ c1.CopyTo(c2, 3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E66", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Char[] c1 = new Char[2];
+ Char[] c2 = new Char[2];
+ c1.CopyTo(c2, 1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E67", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String[] c1 = new String[2];
+ Char[] c2 = new Char[2];
+ // FIXME: Our implementation doesn't throw an exception if
+ // this is uninitialized.
+ c1[0] = "Hello";
+ c1[1] = "World";
+ c1.CopyTo(c2, 0);
+ } catch (ArrayTypeMismatchException) {
+ errorThrown = true;
+ }
+ Assert("#E68", errorThrown);
+ }
+
+ Char[] orig = {'a', 'b', 'c', 'd'};
+ Char[] copy = new Char[10];
+ Array.Clear(copy, 0, copy.Length);
+ orig.CopyTo(copy, 3);
+ AssertEquals("#E69", (char)0, copy[0]);
+ AssertEquals("#E70", (char)0, copy[1]);
+ AssertEquals("#E71", (char)0, copy[2]);
+ AssertEquals("#E72", orig[0], copy[3]);
+ AssertEquals("#E73", orig[1], copy[4]);
+ AssertEquals("#E74", orig[2], copy[5]);
+ AssertEquals("#E75", orig[3], copy[6]);
+ AssertEquals("#E76", (char)0, copy[7]);
+ AssertEquals("#E77", (char)0, copy[8]);
+ AssertEquals("#E78", (char)0, copy[9]);
+
+ {
+ // The following is valid and must not throw an exception.
+ bool errorThrown = false;
+ try {
+ int[] src = new int [0];
+ int[] dest = new int [0];
+ src.CopyTo (dest, 0);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#E79", !errorThrown);
+ }
+ }
+
+ public void TestCreateInstance() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.CreateInstance(null, 12);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#F01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Array.CreateInstance(Type.GetType("System.Char"), -3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#F02", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Array.CreateInstance(Type.GetType("System.Char"), null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#F03", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Array.CreateInstance(Type.GetType("System.Char"), null, null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#F04", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ int[] lengths = new int [0];
+ Array.CreateInstance(Type.GetType("System.Char"), lengths);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#F05", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ int[] lengths = new int [1];
+ int[] bounds = new int [2];
+ // FIXME: Broken
+ // Array.CreateInstance(Type.GetType("System.Char"), lengths, bounds);
+ errorThrown = true;
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#F06", errorThrown);
+ }
+
+ char[] c1 = (char[])Array.CreateInstance(Type.GetType("System.Char"), 12);
+ AssertEquals("#F07", 12, c1.Length);
+
+ Array c2 = Array.CreateInstance(Type.GetType("System.Char"), 12, 5);
+ AssertEquals("#F08", 2, c2.Rank);
+ AssertEquals("#F09", 60, c2.Length);
+
+
+ {
+ int[] lengths = { 3 };
+ int[] bounds = { 5 };
+ int[] src = { 512, 718, 912 };
+ Array array = Array.CreateInstance(typeof(int), lengths, bounds);
+
+ AssertEquals("#F10", 3, array.Length);
+ AssertEquals("#F11", 5, array.GetLowerBound(0));
+ AssertEquals("#F12", 7, array.GetUpperBound(0));
+
+ src.CopyTo (array, 5);
+
+ for (int i = 0; i < src.Length; i++)
+ AssertEquals("#F13(" + i + ")", src[i], array.GetValue(i+5));
+ }
+
+ }
+
+ public void TestGetEnumerator() {
+ String[] s1 = {"this", "is", "a", "test"};
+ IEnumerator en = s1.GetEnumerator ();
+ AssertNotNull ("#G01", en);
+
+ Assert ("#G02", en.MoveNext ());
+ AssertEquals ("#G03", "this", en.Current);
+ Assert ("#G04", en.MoveNext ());
+ AssertEquals ("#G05", "is", en.Current);
+ Assert ("#G06", en.MoveNext ());
+ AssertEquals ("#G07", "a", en.Current);
+ Assert ("#G08", en.MoveNext ());
+ AssertEquals ("#G09", "test", en.Current);
+ Assert ("#G10", !en.MoveNext ());
+
+ en.Reset ();
+ Assert("#G11", en.MoveNext ());
+ AssertEquals ("#G12", "this", en.Current);
+
+ // mutation does not invalidate array enumerator!
+ s1.SetValue ("change", 1);
+ Assert ("#G13", en.MoveNext ());
+ AssertEquals ("#G14", "change", en.Current);
+ }
+
+ public void TestGetEnumeratorMultipleDimension() {
+ String[,] s1 = {{"this", "is"}, {"a", "test"}};
+ IEnumerator en = s1.GetEnumerator ();
+ AssertNotNull ("#AA01", en);
+
+ Assert ("#AA02", en.MoveNext ());
+ AssertEquals ("#AA03", "this", en.Current);
+ Assert ("#AA04", en.MoveNext ());
+ AssertEquals ("#AA05", "is", en.Current);
+ Assert ("#AA06", en.MoveNext ());
+ AssertEquals ("#AA07", "a", en.Current);
+ Assert ("#AA08", en.MoveNext ());
+ AssertEquals ("#AA09", "test", en.Current);
+ Assert ("#AA10", !en.MoveNext ());
+
+ en.Reset ();
+ Assert("#AA11", en.MoveNext ());
+ AssertEquals ("#AA12", "this", en.Current);
+
+ int[] idxs = {0,1};
+ // mutation does not invalidate array enumerator!
+ s1.SetValue ("change", idxs);
+ Assert ("#AA13", en.MoveNext ());
+ AssertEquals ("#AA14", "change", en.Current);
+ }
+
+ public void TestGetEnumeratorNonZeroLowerBounds() {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance( typeof(String), myLengthsArray, myBoundsArray );
+ for ( int i = myArray.GetLowerBound(0); i <= myArray.GetUpperBound(0); i++ )
+ for ( int j = myArray.GetLowerBound(1); j <= myArray.GetUpperBound(1); j++ ) {
+ int[] myIndicesArray = new int[2] { i, j };
+ myArray.SetValue( Convert.ToString(i) + j, myIndicesArray );
+ }
+ IEnumerator en = myArray.GetEnumerator ();
+ AssertNotNull ("#AB01", en);
+
+ // check the first couple of values
+ Assert ("#AB02", en.MoveNext ());
+ AssertEquals ("#AB03", "23", en.Current);
+ Assert ("#AB04", en.MoveNext ());
+ AssertEquals ("#AB05", "24", en.Current);
+
+ // then check the last element's value
+ string lastElement;
+ do {
+ lastElement = (string)en.Current;
+ } while (en.MoveNext());
+ AssertEquals ("#AB06", "47", lastElement);
+ }
+
+ public void TestIList_Add () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+ try {
+ ((IList)myArray).Add ("can not");
+ Fail ("IList.Add should throw");
+ }
+ catch (NotSupportedException) {
+ return;
+ }
+ catch (Exception) {
+ Fail ("IList.Add threw wrong exception type");
+ }
+
+ Fail("IList.Add shouldn't get this far");
+ }
+
+ public void TestIList_Insert () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+ try {
+ ((IList)myArray).Insert (0, "can not");
+ Fail ("IList.Insert should throw");
+ }
+ catch (NotSupportedException) {
+ return;
+ }
+ catch (Exception) {
+ Fail ("IList.Insert threw wrong exception type");
+ }
+
+ Fail("IList.Insert shouldn't get this far");
+ }
+
+ public void TestIList_Remove () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+ try {
+ ((IList)myArray).Remove ("can not");
+ Fail ("IList.Remove should throw");
+ }
+ catch (NotSupportedException) {
+ return;
+ }
+ catch (Exception) {
+ Fail ("IList.Remove threw wrong exception type");
+ }
+
+ Fail("IList.Remove shouldn't get this far");
+ }
+
+ public void TestIList_RemoveAt () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+ try {
+ ((IList)myArray).RemoveAt (0);
+ Fail ("IList.RemoveAt should throw");
+ }
+ catch (NotSupportedException) {
+ return;
+ }
+ catch (Exception) {
+ Fail ("IList.RemoveAt threw wrong exception type");
+ }
+
+ Fail("IList.RemoveAt shouldn't get this far");
+ }
+
+ public void TestIList_Contains () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+
+ try {
+ bool b = ((IList)myArray).Contains ("23");
+ Fail("IList.Contains should throw with multi-dimensional arrays");
+ }
+ catch (RankException) {
+ int[] iArr = new int[3] { 1, 2, 3};
+ // check the first and last items
+ Assert("AC01", ((IList)iArr).Contains (1));
+ Assert("AC02", ((IList)iArr).Contains (3));
+
+ // and one that is definately not there
+ Assert("AC03", !((IList)iArr).Contains (42));
+ return;
+ }
+
+ Fail("Should not get here");
+ }
+
+ public void TestIList_IndexOf () {
+ int[] myLengthsArray = new int[2] { 3, 5 };
+ int[] myBoundsArray = new int[2] { 2, 3 };
+
+ Array myArray=Array.CreateInstance ( typeof(String), myLengthsArray, myBoundsArray );
+
+ try {
+ bool b = ((IList)myArray).Contains ("23");
+ Fail("IList.Contains should throw with multi-dimensional arrays");
+ }
+ catch (RankException) {
+ int[] iArr = new int[3] { 1, 2, 3};
+ // check the first and last items
+ AssertEquals("AD01", 0, ((IList)iArr).IndexOf (1));
+ AssertEquals("AD02", 2, ((IList)iArr).IndexOf (3));
+
+ // and one that is definately not there
+ AssertEquals("AD03", -1, ((IList)iArr).IndexOf (42));
+ }
+ catch (Exception) {
+ Fail("Should not get here");
+ }
+
+ // check that wierd case whem lowerbound is Int32.MinValue,
+ // so that IndexOf() needs to return Int32.MaxValue when it cannot find the object
+ int[] myLengthArray = new int[1] { 3 };
+ int[] myBoundArray = new int[1] { Int32.MinValue };
+ Array myExtremeArray=Array.CreateInstance ( typeof(String), myLengthArray, myBoundArray );
+ AssertEquals("AD04", Int32.MaxValue, ((IList)myExtremeArray).IndexOf (42));
+
+ }
+
+ public void TestGetLength() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c1 = {'a', 'b', 'c'};
+ c1.GetLength(-1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c1 = {'a', 'b', 'c'};
+ c1.GetLength(1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H02", errorThrown);
+ }
+
+ char[] c2 = new Char[5];
+ AssertEquals("#H03",
+ 5, c2.GetLength(0));
+
+ char[,] c3 = new Char[6,7];
+ AssertEquals("#H04",
+ 6, c3.GetLength(0));
+ AssertEquals("#H05",
+ 7, c3.GetLength(1));
+ }
+
+ public void TestGetLowerBound() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetLowerBound(-1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H31", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetLowerBound(1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H32", errorThrown);
+ }
+
+ char[] c1 = new Char[5];
+ AssertEquals("#H33",
+ 0, c1.GetLowerBound(0));
+
+ char[,] c2 = new Char[4,4];
+ AssertEquals("#H34",
+ 0, c2.GetLowerBound(0));
+ AssertEquals("#H35",
+ 0, c2.GetLowerBound(1));
+ }
+
+ public void TestGetUpperBound() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetUpperBound(-1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H61", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetUpperBound(1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#H62", errorThrown);
+ }
+
+ char[] c1 = new Char[5];
+ AssertEquals("#H63",
+ 4, c1.GetUpperBound(0));
+
+ char[,] c2 = new Char[4,6];
+ AssertEquals("#H64",
+ 3, c2.GetUpperBound(0));
+ AssertEquals("#H65",
+ 5, c2.GetUpperBound(1));
+ }
+
+ public void TestGetValue1() {
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.GetValue(1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#I01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetValue(-1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I02", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.GetValue(4);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I03", errorThrown);
+ }
+
+ char[] c1 = {'a', 'b', 'c', 'd'};
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("#I04(" + i + ")", c1[i], c1.GetValue(i));
+ }
+ }
+ public void TestGetValue2() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.GetValue(1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#I21", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.GetValue(-1, 1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I22", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.GetValue(4,1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I23", errorThrown);
+ }
+
+ char[,] c1 = new Char[4,6];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int second = i % 6;
+ c1[first,second] = (char)(((int)'a')+i);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ AssertEquals("#I24(" + i + "," + j + ")",
+ c1[i,j], c1.GetValue(i, j));
+ }
+ }
+ }
+ public void TestGetValue3() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.GetValue(1,1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#I41", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,,] c = new Char[2,2,2];
+ c.GetValue(-1, 1, 1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I42", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,,] c = new Char[2,2,2];
+ c.GetValue(4,1,1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I43", errorThrown);
+ }
+
+ char[,,] c1 = new Char[4,2,3];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int remains = i % 6;
+ int second = remains / 3;
+ int third = remains % 3;
+ c1[first,second, third] = (char)(((int)'a')+i);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ for (int k = 0; k < c1.GetLength(2); k++) {
+ AssertEquals("#I44(" + i + "," + j + ")",
+ c1[i,j,k], c1.GetValue(i,j,k));
+ }
+ }
+ }
+ }
+ public void TestGetValueN() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.GetValue(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#I61", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ int[] coords = {1, 1};
+ c.GetValue(coords);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#I62", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ int[] coords = {-1, 1};
+ c.GetValue(coords);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I63", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ int[] coords = {4, 1};
+ c.GetValue(coords);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#I64", errorThrown);
+ }
+
+ char[,] c1 = new Char[4,6];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int second = i % 6;
+ c1[first,second] = (char)(((int)'a')+i);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ int[] coords = {i, j};
+ AssertEquals("#I65(" + i + "," + j + ")",
+ c1[i,j], c1.GetValue(coords));
+ }
+ }
+ }
+
+ public void TestIndexOf1() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.IndexOf(null, "huh?");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#J01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.IndexOf(c, "huh?");
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#J02", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "a", "test"};
+ AssertEquals("#J03", -1, Array.IndexOf(s1, null));
+ AssertEquals("#J04", -1, Array.IndexOf(s1, "nothing"));
+ AssertEquals("#J05", 0, Array.IndexOf(s1, "this"));
+ AssertEquals("#J06", 3, Array.IndexOf(s1, "test"));
+ }
+ public void TestIndexOf2() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.IndexOf(null, "huh?", 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#J21", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.IndexOf(c, "huh?", 0);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#J22", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.IndexOf(c, "huh?", 3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#J23", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "really", "a", "test"};
+ AssertEquals("#J24", -1, Array.IndexOf(s1, null, 1));
+ AssertEquals("#J25", -1, Array.IndexOf(s1, "nothing", 1));
+ AssertEquals("#J26", -1, Array.IndexOf(s1, "this", 1));
+ AssertEquals("#J27", 1, Array.IndexOf(s1, "is", 1));
+ AssertEquals("#J28", 4, Array.IndexOf(s1, "test", 1));
+ }
+ public void TestIndexOf3() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.IndexOf(null, "huh?", 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#J41", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.IndexOf(c, "huh?", 0, 1);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#J42", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.IndexOf(c, "huh?", 3, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#J43", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.IndexOf(c, "huh?", 0, 5);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#J44", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "really", "a", "test"};
+ AssertEquals("#J45", -1, Array.IndexOf(s1, null, 1, 3));
+ AssertEquals("#J46", -1, Array.IndexOf(s1, "nothing", 1, 3));
+ AssertEquals("#J47", -1, Array.IndexOf(s1, "this", 1, 3));
+ AssertEquals("#J48", 1, Array.IndexOf(s1, "is", 1, 3));
+ AssertEquals("#J49", -1, Array.IndexOf(s1, "test", 1, 3));
+ AssertEquals("#J50", 3, Array.IndexOf(s1, "a", 1, 3));
+ }
+
+ public void TestLastIndexOf1() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.LastIndexOf(null, "huh?");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#K01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.LastIndexOf(c, "huh?");
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#K02", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "a", "a", "test"};
+ AssertEquals("#K03", -1, Array.LastIndexOf(s1, null));
+ AssertEquals("#K04", -1, Array.LastIndexOf(s1, "nothing"));
+ AssertEquals("#K05", 0, Array.LastIndexOf(s1, "this"));
+ AssertEquals("#K06", 4, Array.LastIndexOf(s1, "test"));
+ AssertEquals("#K07", 3, Array.LastIndexOf(s1, "a"));
+ }
+ public void TestLastIndexOf2() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.LastIndexOf(null, "huh?", 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#K21", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.LastIndexOf(c, "huh?", 0);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#K22", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.LastIndexOf(c, "huh?", 3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#K23", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "really", "a", "test"};
+ AssertEquals("#K24", -1, Array.LastIndexOf(s1, null, 3));
+ AssertEquals("#K25", -1, Array.LastIndexOf(s1, "nothing", 3));
+ AssertEquals("#K26", -1, Array.LastIndexOf(s1, "test", 3));
+ AssertEquals("#K27", 3, Array.LastIndexOf(s1, "a", 3));
+ AssertEquals("#K28", 0, Array.LastIndexOf(s1, "this", 3));
+ }
+ public void TestLastIndexOf3() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.LastIndexOf(null, "huh?", 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#K41", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.LastIndexOf(c, "huh?", 0, 1);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#K42", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.LastIndexOf(c, "huh?", 3, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#K43", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ Array.LastIndexOf(c, "huh?", 0, 5);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#K44", errorThrown);
+ }
+
+ String[] s1 = {"this", "is", "really", "a", "test"};
+ AssertEquals("#K45",
+ -1, Array.LastIndexOf(s1, null, 3, 3));
+ AssertEquals("#K46",
+ -1, Array.LastIndexOf(s1, "nothing", 3, 3));
+ AssertEquals("#K47",
+ -1, Array.LastIndexOf(s1, "this", 3, 3));
+ AssertEquals("#K48",
+ 1, Array.LastIndexOf(s1, "is", 3, 3));
+ AssertEquals("#K49",
+ -1, Array.LastIndexOf(s1, "test", 3, 3));
+ AssertEquals("#K50",
+ 3, Array.LastIndexOf(s1, "a", 3, 3));
+ }
+
+ public void TestReverse() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.Reverse(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#L01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.Reverse(c);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#L02", errorThrown);
+ }
+
+ char[] c1 = {'a', 'b', 'c', 'd'};
+ Array.Reverse(c1);
+ AssertEquals("#L03", 'd', c1[0]);
+ AssertEquals("#L04", 'c', c1[1]);
+ AssertEquals("#L05", 'b', c1[2]);
+ AssertEquals("#L06", 'a', c1[3]);
+
+ {
+ bool errorThrown = false;
+ try {
+ Array.Reverse(null, 0, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#L07", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ Array.Reverse(c, 0, 0);
+ } catch (RankException) {
+ errorThrown = true;
+ }
+ Assert("#L08", errorThrown);
+ }
+ //{
+ //bool errorThrown = false;
+ //try {
+ // char[] c = new Char[2];
+ // Array.Reverse(c, 0, 3);
+ //} catch (ArgumentOutOfRangeException) {
+ // errorThrown = true;
+ //}
+ //Assert("#L09", errorThrown);
+ //}
+ //{
+ //bool errorThrown = false;
+ //try {
+ // char[] c = new Char[2];
+ // Array.Reverse(c, 3, 0);
+ //} catch (ArgumentOutOfRangeException) {
+ // errorThrown = true;
+ //}
+ //Assert("#L10", errorThrown);
+ //}
+
+ char[] c2 = { 'a', 'b', 'c', 'd'};
+ Array.Reverse(c2, 1, 2);
+ AssertEquals("#L11", 'a', c2[0]);
+ AssertEquals("#L12", 'c', c2[1]);
+ AssertEquals("#L13", 'b', c2[2]);
+ AssertEquals("#L14", 'd', c2[3]);
+ }
+
+ public void TestSetValue1() {
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.SetValue("buh", 1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#M01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.SetValue("buh", -1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M02", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = {'a', 'b', 'c'};
+ c.SetValue("buh", 4);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M03", errorThrown);
+ }
+
+ char[] c1 = {'a', 'b', 'c', 'd'};
+ char[] c2 = new char[4];
+ for (int i = 0; i < c1.Length; i++) {
+ c2.SetValue(c1[i], i);
+ }
+ for (int i = 0; i < c1.Length; i++) {
+ AssertEquals("#M04(" + i + ")", c1[i], c2[i]);
+ }
+
+ int[] c3 = { 1, 2, 3 };
+ long[] c4 = new long [3];
+
+ for (int i = 0; i < c3.Length; i++)
+ c4.SetValue (c3 [i], i);
+ c3.CopyTo (c4, 0);
+ for (int i = 0; i < c3.Length; i++)
+ Assert ("#M05(" + i + ")", c3[i] == c4[i]);
+
+ Object[] c5 = new Object [3];
+ long[] c6 = new long [3];
+
+ c4.CopyTo (c5, 0);
+
+ c5.CopyTo (c6, 0);
+ // for (int i = 0; i < c5.Length; i++)
+ // Assert ("#M06(" + i + ")", c5[i] == c6[i]);
+ }
+
+ public void TestSetValue2() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.SetValue("buh", 1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#M21", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.SetValue("buh", -1, 1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M22", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ c.SetValue("buh", 4,1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M23", errorThrown);
+ }
+
+ char[,] c1 = new Char[4,6];
+ char[,] c2 = new Char[4,6];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int second = i % 6;
+ c1[first,second] = (char)(((int)'a')+i);
+ c2.SetValue(c1[first,second], first, second);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ AssertEquals("#M24(" + i + "," + j + ")",
+ c1[i,j], c2[i, j]);
+ }
+ }
+ }
+ public void TestSetValue3() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.SetValue("buh", 1,1,1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#M41", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,,] c = new Char[2,2,2];
+ c.SetValue("buh", -1, 1, 1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M42", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,,] c = new Char[2,2,2];
+ c.SetValue("buh", 4,1,1);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M43", errorThrown);
+ }
+
+ char[,,] c1 = new Char[4,2,3];
+ char[,,] c2 = new Char[4,2,3];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int remains = i % 6;
+ int second = remains / 3;
+ int third = remains % 3;
+ c1[first,second, third] = (char)(((int)'a')+i);
+ c2.SetValue(c1[first, second, third], first, second, third);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ for (int k = 0; k < c1.GetLength(2); k++) {
+ AssertEquals("#M44(" + i + "," + j + " )",
+ c1[i,j,k], c2[i,j,k]);
+ }
+ }
+ }
+ }
+ public void TestSetValueN() {
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ c.SetValue("buh", null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#M61", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c = new Char[2];
+ int[] coords = {1, 1};
+ c.SetValue("buh", coords);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#M62", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ int[] coords = {-1, 1};
+ c.SetValue("buh", coords);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M63", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[,] c = new Char[2,2];
+ int[] coords = {4, 1};
+ c.SetValue("buh", coords);
+ } catch (IndexOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("#M64", errorThrown);
+ }
+
+ char[,] c1 = new Char[4,6];
+ char[,] c2 = new Char[4,6];
+ for (int i = 0; i < 24; i++) {
+ int first = i / 6;
+ int second = i % 6;
+ c1[first,second] = (char)(((int)'a')+i);
+ int[] coords = {first, second};
+ c2.SetValue(c1[first,second], coords);
+ }
+ for (int i = 0; i < c1.GetLength(0); i++) {
+ for (int j = 0; j < c1.GetLength(1); j++) {
+ AssertEquals("#M65(" + i + "," + j + ")",
+ c1[i,j], c2[i,j]);
+ }
+ }
+ }
+
+ public void TestSetValue4() {
+ {
+ int[] c1 = { 1, 2, 3 };
+ long[] c2 = new long [3];
+
+ for (int i = 0; i < c1.Length; i++)
+ c2.SetValue (c1 [i], i);
+
+ for (int i = 0; i < c1.Length; i++) {
+ Assert ("#M81(" + i + ")", c1[i] == c2[i]);
+ AssertEquals ("#M82(" + i + ")", typeof (long), c2[i].GetType ());
+ }
+ }
+ {
+ long[] c1 = { 1, 2, 3 };
+ int[] c2 = new int [3];
+ bool errorThrown = false;
+ try {
+ c2.SetValue (c1 [0], 0);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#M83", errorThrown);
+ }
+ {
+ int[] c1 = { 1, 2, 3 };
+ Object[] c2 = new Object [3];
+
+ for (int i = 0; i < c1.Length; i++)
+ c2.SetValue (c1 [i], i);
+
+ for (int i = 0; i < c1.Length; i++)
+ AssertEquals ("#M84(" + i + ")", c1[i], Convert.ToInt32 (c2[i]));
+ }
+ {
+ Object[] c1 = new Object [3];
+ Object[] c2 = new Object [3];
+ c1[0] = new Object ();
+
+ for (int i = 0; i < c1.Length; i++)
+ c2.SetValue (c1 [i], i);
+
+ for (int i = 0; i < c1.Length; i++)
+ AssertEquals ("#M85(" + i + ")", c1[i], c2[i]);
+ }
+ {
+ Object[] c1 = new Object [3];
+ string[] c2 = new String [3];
+ string test = "hello";
+ c1[0] = test;
+
+ c2.SetValue (c1 [0], 0);
+ AssertEquals ("#M86", c1[0], c2[0]);
+ AssertEquals ("#M87", "hello", c2[0]);
+ }
+ {
+ char[] c1 = { 'a', 'b', 'c' };
+ string[] c2 = new string [3];
+ bool errorThrown = false;
+ try {
+ c2.SetValue (c1 [0], 0);
+ // FIXME
+ errorThrown = true;
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+ Assert("#M88", errorThrown);
+ }
+ {
+ Single[] c1 = { 1.2F, 2.3F, 3.4F, 4.5F };
+ long[] c2 = new long [3];
+ bool errorThrown = false;
+ try {
+ c2.SetValue (c1 [0], 0);
+ // FIXME
+ errorThrown = true;
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("#M89", errorThrown);
+ }
+ {
+ Type[] types = {
+ typeof (Boolean),
+ typeof (Byte),
+ typeof (Char),
+ typeof (Double),
+ typeof (Int16),
+ typeof (Int32),
+ typeof (Int64),
+ typeof (SByte),
+ typeof (Single),
+ typeof (UInt16),
+ typeof (UInt32),
+ typeof (UInt64)
+ };
+
+ bool v1 = true;
+ Byte v2 = 1;
+ Char v3 = 'a';
+ Double v4 = -1.2;
+ Int16 v5 = -32;
+ Int32 v6 = -234;
+ Int64 v7 = -34523;
+ SByte v8 = -1;
+ Single v9 = -4.8F;
+ UInt16 v10 = 24234;
+ UInt32 v11 = 235354;
+ UInt64 v12 = 234552;
+
+ Object[] va1 = { v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12 };
+ Object[] va2 = { "true", "1", "a", "-1.2", "-32", "-234", "-34523", "-1",
+ "-4.8F", "24234", "235354", "234552" };
+
+ Object[][] vt = { va1, va1, va1, va1, va1, va1, va1, va1, va1, va1, va1, va1 };
+
+ int[] arg_ex = {
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0,
+ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1,
+ 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1,
+ 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
+ 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0,
+ 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0,
+ 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0
+ };
+
+ // SetValue
+
+ for (int i = 0; i < types.Length; i++) {
+ for (int j = 0; j < types.Length; j++) {
+ Array array = Array.CreateInstance (types [j], 2);
+
+ Object value = vt[j][i];
+
+ bool errorThrown = false;
+ try {
+ array.SetValue (value, 0);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+
+ int ex_index = (i * types.Length) + j;
+
+ AssertEquals ("#M90(" + types [i] + "," + types [j] + ")",
+ errorThrown, arg_ex [ex_index] == 1);
+ }
+ }
+
+ for (int i = 0; i < types.Length; i++) {
+ String[] array = new String [2];
+
+ Object value = va1 [i];
+
+ bool errorThrown = false;
+ try {
+ array.SetValue (value, 0);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+
+ Assert ("#M91(" + types [i] + ")", errorThrown);
+ }
+
+ for (int i = 0; i < types.Length; i++) {
+ Array array = Array.CreateInstance (types [i], 2);
+
+ Object value = va2 [i];
+
+ bool errorThrown = false;
+ try {
+ array.SetValue (value, 0);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+
+ Assert ("#M92(" + types [i] + ")", errorThrown);
+ }
+
+ for (int i = 0; i < types.Length; i++) {
+ Array array = Array.CreateInstance (types [i], 2);
+
+ Object value = null;
+
+ bool errorThrown = false;
+ try {
+ array.SetValue (value, 0);
+ } catch (InvalidCastException) {
+ errorThrown = true;
+ }
+
+ Assert ("#M93(" + types [i] + ")", !errorThrown);
+ }
+
+ // Copy
+
+ for (int i = 0; i < types.Length; i++) {
+ for (int j = 0; j < types.Length; j++) {
+ Array source = Array.CreateInstance (types [i], 2);
+ Array array = Array.CreateInstance (types [j], 2);
+
+ source.SetValue (vt[j][i], 0);
+ source.SetValue (vt[j][i], 1);
+
+ bool errorThrown = false;
+ try {
+ Array.Copy (source, array, 2);
+ } catch (ArrayTypeMismatchException) {
+ errorThrown = true;
+ }
+
+ int ex_index = (i * types.Length) + j;
+
+ AssertEquals ("#M94(" + types [i] + "," + types [j] + ")",
+ errorThrown, arg_ex [ex_index] == 1);
+ }
+ }
+
+ for (int i = 0; i < types.Length; i++) {
+ Array source = Array.CreateInstance (types [i], 2);
+ String[] array = new String [2];
+
+ source.SetValue (va1 [i], 0);
+ source.SetValue (va1 [i], 1);
+
+ bool errorThrown = false;
+ try {
+ Array.Copy (source, array, 2);
+ } catch (ArrayTypeMismatchException) {
+ errorThrown = true;
+ }
+
+ Assert ("#M95(" + types [i] + ")", errorThrown);
+ }
+
+ for (int i = 0; i < types.Length; i++) {
+ String[] source = new String [2];
+ Array array = Array.CreateInstance (types [i], 2);
+
+ source.SetValue (va2 [i], 0);
+ source.SetValue (va2 [i], 1);
+
+ bool errorThrown = false;
+ try {
+ Array.Copy (source, array, 2);
+ } catch (ArrayTypeMismatchException) {
+ errorThrown = true;
+ }
+
+ Assert ("#M96(" + types [i] + ")", errorThrown);
+ }
+ }
+ }
+
+
+ public void TestSort() {
+ {
+ bool errorThrown = false;
+ try {
+ Array.Sort(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#N01", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Array.Sort(null, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#N02", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c1 = new Char[2];
+ Array.Sort(null, c1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#N03", errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ char[] c1 = new Char[2];
+ Array.Sort(null, c1, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("#N04", errorThrown);
+ }
+
+ // note: null second array => just sort first array
+ char[] starter = {'d', 'b', 'f', 'e', 'a', 'c'};
+ int[] starter1 = {1,2,3,4,5,6};
+ {
+ char[] c1 = (char[])starter.Clone();
+ Array.Sort(c1);
+ AssertEquals("#N21", 'a', c1[0]);
+ AssertEquals("#N22", 'b', c1[1]);
+ AssertEquals("#N23", 'c', c1[2]);
+ AssertEquals("#N24", 'd', c1[3]);
+ AssertEquals("#N25", 'e', c1[4]);
+ AssertEquals("#N26", 'f', c1[5]);
+ }
+ {
+ char[] c1 = (char[])starter.Clone();
+ int[] i1 = (int[])starter1.Clone();
+ Array.Sort(c1, i1);
+ AssertEquals("#N41", 'a', c1[0]);
+ AssertEquals("#N42", 'b', c1[1]);
+ AssertEquals("#N43", 'c', c1[2]);
+ AssertEquals("#N44", 'd', c1[3]);
+ AssertEquals("#N45", 'e', c1[4]);
+ AssertEquals("#N46", 'f', c1[5]);
+ AssertEquals("#N47", 5, i1[0]);
+ AssertEquals("#N48", 2, i1[1]);
+ AssertEquals("#N49", 6, i1[2]);
+ AssertEquals("#N50", 1, i1[3]);
+ AssertEquals("#N51", 4, i1[4]);
+ AssertEquals("#N52", 3, i1[5]);
+ }
+ {
+ char[] c1 = (char[])starter.Clone();
+ Array.Sort(c1, 1, 4);
+ AssertEquals("#N61", 'd', c1[0]);
+ AssertEquals("#N62", 'a', c1[1]);
+ AssertEquals("#N63", 'b', c1[2]);
+ AssertEquals("#N64", 'e', c1[3]);
+ AssertEquals("#N65", 'f', c1[4]);
+ AssertEquals("#N66", 'c', c1[5]);
+ }
+ {
+ char[] c1 = (char[])starter.Clone();
+ int[] i1 = (int[])starter1.Clone();
+ Array.Sort(c1, i1, 1, 4);
+ AssertEquals("#N81", 'd', c1[0]);
+ AssertEquals("#N82", 'a', c1[1]);
+ AssertEquals("#N83", 'b', c1[2]);
+ AssertEquals("#N84", 'e', c1[3]);
+ AssertEquals("#N85", 'f', c1[4]);
+ AssertEquals("#N86", 'c', c1[5]);
+ AssertEquals("#N87", 1, i1[0]);
+ AssertEquals("#N88", 5, i1[1]);
+ AssertEquals("#N89", 2, i1[2]);
+ AssertEquals("#N90", 4, i1[3]);
+ AssertEquals("#N91", 3, i1[4]);
+ AssertEquals("#N92", 6, i1[5]);
+ }
+ }
+
+ // TODO - TestSort passed-in IComparable versions
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/AttributeTest.cs b/mcs/class/corlib/Test/System/AttributeTest.cs
new file mode 100755
index 00000000000..25d4329623b
--- /dev/null
+++ b/mcs/class/corlib/Test/System/AttributeTest.cs
@@ -0,0 +1,155 @@
+//
+// AttributeTest.cs - NUnit Test Cases for the System.Attribute class
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+// Inner namespace for some test helper classes
+using MonoTests.System.AttributeTestInternals;
+
+namespace AttributeTestInternals
+{
+
+[AttributeUsage(AttributeTargets.Class, AllowMultiple=true, Inherited=false)]
+internal class MyCustomAttribute : Attribute {
+
+ private string _info;
+
+ public MyCustomAttribute (string info)
+ {
+ _info = info;
+ }
+
+ public string Info
+ {
+ get {
+ return _info;
+ }
+ }
+
+}
+
+[AttributeUsage(AttributeTargets.Class)]
+internal class YourCustomAttribute : Attribute {
+
+ private int _value;
+
+ public YourCustomAttribute (int value)
+ {
+ _value = value;
+ }
+
+ public int Value
+ {
+ get {
+ return _value;
+ }
+ }
+}
+
+[AttributeUsage(AttributeTargets.Class)]
+internal class UnusedAttribute : Attribute {
+}
+
+[MyCustomAttribute("MyBaseClass"), YourCustomAttribute(37)]
+internal class MyClass {
+ int Value { get { return 42; }}
+}
+
+[MyCustomAttribute("MyDerivedClass")]
+internal class MyDerivedClass : MyClass {
+ public void Do () {}
+}
+
+} // Namespace MonoTests.System.AttributeTestInternals
+
+public class AttributeTest : TestCase {
+
+ public AttributeTest () : base("MonoTests.System.AttributeTest testcase") {}
+ public AttributeTest (string name) : base(name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(AttributeTest));
+ }
+ }
+
+ public void TestIsDefined ()
+ {
+ AssertEquals ("A1", true, Attribute.IsDefined(typeof(MyDerivedClass), typeof(MyCustomAttribute)));
+ AssertEquals ("A2", true, Attribute.IsDefined(typeof(MyDerivedClass), typeof(YourCustomAttribute)));
+ AssertEquals ("A3", false, Attribute.IsDefined(typeof(MyDerivedClass), typeof(UnusedAttribute)));
+ AssertEquals ("A4", true, Attribute.IsDefined(typeof(MyDerivedClass), typeof(MyCustomAttribute), true));
+ AssertEquals ("A5", true, Attribute.IsDefined(typeof(MyDerivedClass), typeof(YourCustomAttribute), true));
+ AssertEquals ("A6", false, Attribute.IsDefined(typeof(MyDerivedClass), typeof(UnusedAttribute), false));
+ AssertEquals ("A7", true, Attribute.IsDefined(typeof(MyDerivedClass), typeof(MyCustomAttribute), false));
+ AssertEquals ("A8", false, Attribute.IsDefined(typeof(MyDerivedClass), typeof(YourCustomAttribute), false));
+ AssertEquals ("A9", false, Attribute.IsDefined(typeof(MyDerivedClass), typeof(UnusedAttribute), false));
+ }
+
+/*
+ public static void TestIsDefaultAttribute ()
+ {
+ Console.WriteLine(">>>IsDefaultAttribute");
+
+ Attribute a = Attribute.GetCustomAttribute(typeof(MyClass), typeof(MyCustomAttribute));
+ Console.WriteLine (a.IsDefaultAttribute() );
+ }
+
+ private static void WriteAttribute (Attribute a)
+ {
+ if (a == null) {
+ Console.WriteLine ("NULL");
+ }
+ else {
+ Console.WriteLine (a);
+ }
+ }
+*/
+
+ public void TestGetCustomAttribute ()
+ {
+ AssertEquals ("A3", "MyDerivedClass", ((MyCustomAttribute) (Attribute.GetCustomAttribute(typeof(MyDerivedClass), typeof(MyCustomAttribute), false))).Info);
+ AssertEquals("A4", null, ((YourCustomAttribute) (Attribute.GetCustomAttribute(typeof(MyDerivedClass), typeof(YourCustomAttribute), false))));
+ AssertEquals ("A1", "MyDerivedClass", ((MyCustomAttribute) (Attribute.GetCustomAttribute(typeof(MyDerivedClass), typeof(MyCustomAttribute)))).Info);
+ AssertEquals("A2", 37, ((YourCustomAttribute) (Attribute.GetCustomAttribute(typeof(MyDerivedClass), typeof(YourCustomAttribute)))).Value);
+ }
+/*
+
+ public static void WriteAttributes (Attribute[] attrs)
+ {
+ Console.WriteLine("length = {0}", attrs.Length);
+ foreach (Attribute a in attrs) {
+ WriteAttribute (a);
+ }
+ }
+
+
+ private static void TestGetCustomAttributes ()
+ {
+ Console.WriteLine(">>>GetCustomAttributes");
+
+
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass), typeof(MyCustomAttribute)));
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass), typeof(MyCustomAttribute), true));
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass), typeof(MyCustomAttribute), false));
+
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass)));
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass), true));
+ WriteAttributes (Attribute.GetCustomAttributes(typeof(MyDerivedClass), false));
+ }
+
+*/
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/BitConverterTest.cs b/mcs/class/corlib/Test/System/BitConverterTest.cs
new file mode 100755
index 00000000000..6510b83255e
--- /dev/null
+++ b/mcs/class/corlib/Test/System/BitConverterTest.cs
@@ -0,0 +1,545 @@
+//
+// BitConverterTest.cs - NUnit Test Cases for System.BitConverter
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+public class BitConverterTest : TestCase {
+
+ public BitConverterTest () : base ("System.BitConverter testsuite") {}
+ public BitConverterTest (string name) : base(name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown() {}
+
+ // this property is required. You need change the parameter for
+ // typeof() below to be your class.
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(BitConverterTest));
+ }
+ }
+
+ public void TestIsLittleEndian ()
+ {
+ byte[] b;
+
+ b = BitConverter.GetBytes (1);
+ AssertEquals ("A1", b[0] == 1, BitConverter.IsLittleEndian );
+ }
+
+ private void PrivateTestSingle (float v1)
+ {
+ float v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 4, b.Length);
+
+ v2 = BitConverter.ToSingle (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToSingle (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToSingle (larger, 8);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToSingle ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestSingle()
+ {
+ PrivateTestSingle (0.1f);
+ PrivateTestSingle (24.1e30f);
+ }
+
+ private void PrivateTestDouble (double v1)
+ {
+ double v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 8, b.Length);
+
+ v2 = BitConverter.ToDouble (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToDouble (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToDouble (larger, 3);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToDouble ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestDouble ()
+ {
+ double d = 123.321;
+
+ AssertEquals("A1", d, BitConverter.Int64BitsToDouble (BitConverter.DoubleToInt64Bits (d)));
+
+ PrivateTestDouble (0.1);
+ PrivateTestDouble (24.1e77);
+ }
+
+ private void PrivateTestBool (bool v1)
+ {
+ bool v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 1, b.Length);
+
+ v2 = BitConverter.ToBoolean (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToBoolean (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToBoolean (larger, 4);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToBoolean ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestBool () {
+ PrivateTestBool(true);
+ PrivateTestBool(false);
+ }
+
+ private void PrivateTestChar (char v1)
+ {
+ char v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 2, b.Length);
+
+ v2 = BitConverter.ToChar (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToChar (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToChar (larger, 3);
+ exception = false;
+ }
+ // LAMESPEC:
+ // the docs say it should be ArgumentOutOfRangeException, but
+ // the mscorlib throws an ArgumentException.
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToChar ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestChar ()
+ {
+ PrivateTestChar('A');
+ PrivateTestChar('\x01ff');
+ }
+
+ private void PrivateTestInt16 (short v1)
+ {
+ short v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 2, b.Length);
+
+ v2 = BitConverter.ToInt16 (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToInt16 (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToInt16 (larger, 3);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToInt16 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestInt16 ()
+ {
+ PrivateTestInt16 (0);
+ PrivateTestInt16 (1000);
+ PrivateTestInt16 (-32768);
+ PrivateTestInt16 (32767);
+ }
+
+ private void PrivateTestUInt16 (ushort v1)
+ {
+ ushort v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 2, b.Length);
+
+ v2 = BitConverter.ToUInt16 (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToUInt16 (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToUInt16 (larger, 3);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToUInt16 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestUInt16 ()
+ {
+ PrivateTestUInt16 (0);
+ PrivateTestUInt16 (1000);
+ PrivateTestUInt16 (65535);
+ }
+
+ private void PrivateTestInt32 (int v1)
+ {
+ int v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 4, b.Length);
+
+ v2 = BitConverter.ToInt32 (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToInt32 (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToInt32 (larger, 8);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToInt32 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestInt32 ()
+ {
+ PrivateTestInt32 (0);
+ PrivateTestInt32 (1000);
+ PrivateTestInt32 (-2147483648);
+ PrivateTestInt32 (2147483647);
+ }
+
+ private void PrivateTestUInt32 (uint v1)
+ {
+ uint v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals ("A1", 4, b.Length);
+
+ v2 = BitConverter.ToUInt32 (b, 0);
+ AssertEquals ("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToUInt32 (larger, 1);
+ AssertEquals ("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToUInt32 (larger, 8);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToUInt32 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestUInt32 ()
+ {
+ PrivateTestUInt32 (0u);
+ PrivateTestUInt32 (1000u);
+ PrivateTestUInt32 (4294967295u);
+ }
+
+ private void PrivateTestInt64 (long v1)
+ {
+ long v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals ("A1", 8, b.Length);
+
+ v2 = BitConverter.ToInt64 (b, 0);
+ AssertEquals ("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToInt64 (larger, 1);
+ AssertEquals ("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToInt64 (larger, 8);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToInt64 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestInt64 ()
+ {
+ PrivateTestInt64 (0);
+ PrivateTestInt64 (1000);
+ PrivateTestInt64 (-9223372036854775808);
+ PrivateTestInt64 (9223372036854775807);
+ }
+
+ private void PrivateTestUInt64 (ulong v1)
+ {
+ ulong v2;
+ byte[] b;
+ byte[] larger = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
+ bool exception;
+
+ b = BitConverter.GetBytes (v1);
+ AssertEquals("A1", 8, b.Length);
+
+ v2 = BitConverter.ToUInt64 (b, 0);
+ AssertEquals("A2", v1, v2);
+
+ b.CopyTo (larger, 1);
+ v2 = BitConverter.ToUInt64 (larger, 1);
+ AssertEquals("A3", v1, v2);
+
+ try {
+ v2 = BitConverter.ToUInt64 (larger, 8);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ v2 = BitConverter.ToUInt64 ((byte[]) null, 77);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+ }
+
+ public void TestUInt64 ()
+ {
+ PrivateTestUInt64 (0);
+ PrivateTestUInt64 (1000);
+ PrivateTestUInt64 (18446744073709551615);
+ }
+
+ public void TestToString ()
+ {
+ string s;
+ bool exception;
+
+ byte[] b = new byte[] {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
+
+ AssertEquals ("A1", "00-11-22-33-44-55-66-77-88-99-AA-BB-CC-DD-EE-FF", BitConverter.ToString (b));
+ AssertEquals ("A2", "66-77-88-99-AA-BB-CC-DD-EE-FF", BitConverter.ToString (b, 6));
+ AssertEquals ("A3", "66-77-88", BitConverter.ToString (b, 6, 3));
+
+ try {
+ s = BitConverter.ToString ((byte[]) null);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ s = BitConverter.ToString (b, 20);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+
+ try {
+ s = BitConverter.ToString ((byte[]) null, 20);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A6", exception);
+
+ try {
+ s = BitConverter.ToString (b, 20, 3);
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A7", exception);
+
+ try {
+ s = BitConverter.ToString ((byte[]) null, 20, 3);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A8", exception);
+
+ try {
+ s = BitConverter.ToString (b, 16, 0);
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A9", exception);
+
+
+ }
+
+}
+}
diff --git a/mcs/class/corlib/Test/System/BooleanTest.cs b/mcs/class/corlib/Test/System/BooleanTest.cs
new file mode 100644
index 00000000000..a7bae95c993
--- /dev/null
+++ b/mcs/class/corlib/Test/System/BooleanTest.cs
@@ -0,0 +1,113 @@
+// BooleanTest.cs - NUnit Test Cases for the System.Boolean class
+//
+// Bob Doan <bdoan@sicompos.com>
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class BooleanTest : TestCase
+{
+ public BooleanTest () : base ("MonoTests.System.BooleanTests testcase") {}
+ public BooleanTest (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (BooleanTest));
+ }
+ }
+
+ public void TestStrings ()
+ {
+ AssertEquals("Wrong False string", "False", Boolean.FalseString);
+ AssertEquals("Wrong True string", "True", Boolean.TrueString);
+ }
+
+ public void TestCompareTo() {
+ Boolean t=true,f=false;
+ String s = "What Ever";
+ AssertEquals("CompareTo Failed", true, f.CompareTo(t) < 0);
+ AssertEquals("CompareTo Failed", 0, f.CompareTo(f));
+ AssertEquals("CompareTo Failed", 0, t.CompareTo(t));
+ AssertEquals("CompareTo Failed", true, t.CompareTo(f) > 0);
+ AssertEquals("CompareTo Failed", true, t.CompareTo(null) > 0);
+ try {
+ t.CompareTo(s);
+ Fail("CompareTo should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert("CompareTo should be a System.ArgumentException", typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals() {
+ Boolean t=true, f=false;
+ String s = "What Ever";
+ AssertEquals("Equals Failed", true, t.Equals(t));
+ AssertEquals("Equals Failed", true, f.Equals(f));
+ AssertEquals("Equals Failed", false, f.Equals(t));
+ AssertEquals("Equals Failed", false, t.Equals(null));
+ AssertEquals("Equals Failed", false, t.Equals(s));
+ }
+
+ public void TestGetHashCode() {
+ Boolean t=true, f=false;
+ AssertEquals("GetHashCode True failed", 1, t.GetHashCode());
+ AssertEquals("GetHashCode True failed", 0, f.GetHashCode());
+ }
+
+ public void TestGetType() {
+ Boolean t=true, f=false;
+ AssertEquals("GetType failed", true, Object.ReferenceEquals(t.GetType(), f.GetType()));
+ }
+
+ public void TestGetTypeCode() {
+ Boolean b=true;
+ AssertEquals("GetTypeCode failed", TypeCode.Boolean, b.GetTypeCode());
+ }
+
+ public void TestParse() {
+ AssertEquals("Parse True failed", true, Boolean.Parse("True"));
+ AssertEquals("Parse True failed", true, Boolean.Parse(" True"));
+ AssertEquals("Parse True failed", true, Boolean.Parse("True "));
+ AssertEquals("Parse True failed", true, Boolean.Parse("tRuE"));
+ AssertEquals("Parse False failed", false, Boolean.Parse("False"));
+ AssertEquals("Parse False failed", false, Boolean.Parse(" False"));
+ AssertEquals("Parse False failed", false, Boolean.Parse("False "));
+ AssertEquals("Parse False failed", false, Boolean.Parse("fAlSe"));
+
+ try {
+ Boolean.Parse("not-t-or-f");
+ Fail("Parse should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("Parse should be a System.FormatException", typeof(FormatException) == e.GetType());
+ }
+
+ try {
+ Boolean.Parse(null);
+ Fail("Parse should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert("Parse should be a System.ArgumentNullException", typeof(ArgumentNullException) == e.GetType());
+ }
+ }
+
+ public void TestToString() {
+ Boolean t=true,f=false;
+ AssertEquals("ToString True Failed", Boolean.TrueString, t.ToString());
+ AssertEquals("ToString False Failed", Boolean.FalseString, f.ToString());
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/ByteTest.cs b/mcs/class/corlib/Test/System/ByteTest.cs
new file mode 100644
index 00000000000..271c6f95265
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ByteTest.cs
@@ -0,0 +1,182 @@
+// ByteTest.cs - NUnit Test Cases for the System.Byte struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class ByteTest : TestCase
+{
+ private const Byte MyByte1 = 42;
+ private const Byte MyByte2 = 0;
+ private const Byte MyByte3 = 255;
+ private const string MyString1 = "42";
+ private const string MyString2 = "0";
+ private const string MyString3 = "255";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {NumberFormatInfo.CurrentInfo.CurrencySymbol+"0.00",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] Results1_Nfi = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"0.00",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] Results2 = {NumberFormatInfo.CurrentInfo.CurrencySymbol+"255.00000",
+ "00255", "2.55000e+002", "255.00000",
+ "255", "255.00000", "25,500.00000 %", "000ff"};
+ private string[] Results2_Nfi = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"255.00000",
+ "00255", "2.55000e+002", "255.00000",
+ "255", "255.00000", "25,500.00000 %", "000ff"};
+
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public ByteTest() : base ("MonoTests.System.ByteTests testcase") {}
+ public ByteTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(ByteTest));
+ }
+ }
+
+ public void TestMinMax()
+ {
+ AssertEquals(Byte.MinValue, MyByte2);
+ AssertEquals(Byte.MaxValue, MyByte3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyByte3.CompareTo(MyByte2) > 0);
+ Assert(MyByte2.CompareTo(MyByte2) == 0);
+ Assert(MyByte1.CompareTo((Byte)42) == 0);
+ Assert(MyByte2.CompareTo(MyByte3) < 0);
+ try {
+ MyByte2.CompareTo(100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyByte1.Equals(MyByte1));
+ Assert(MyByte1.Equals((Byte)42));
+ Assert(MyByte1.Equals((Int16)42) == false);
+ Assert(MyByte1.Equals(MyByte2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyByte1.GetHashCode();
+ MyByte2.GetHashCode();
+ MyByte3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert("MyByte1="+MyByte1+", MyString1="+MyString1+", Parse="+Byte.Parse(MyString1) , MyByte1 == Byte.Parse(MyString1));
+ Assert("MyByte2", MyByte2 == Byte.Parse(MyString2));
+ Assert("MyByte3", MyByte3 == Byte.Parse(MyString3));
+
+ try {
+ Byte.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert("Should get ArgumentNullException", typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ Byte.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("not-a-number", typeof(FormatException) == e.GetType());
+ }
+ try {
+ int OverInt = Byte.MaxValue + 1;
+ Byte.Parse(OverInt.ToString());
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert("OverflowException", typeof(OverflowException) == e.GetType());
+ }
+
+ //test Parse(string s, NumberStyles style)
+ AssertEquals(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ",
+ (byte)42, Byte.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ",
+ NumberStyles.Currency));
+ try {
+ Byte.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 and NumberStyles.Integer", typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(" 42 and Nfi", 42 == Byte.Parse(" 42 ", Nfi));
+ try {
+ Byte.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("%42 and Nfi", typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert("NumberStyles.HexNumber", 16 == Byte.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ Byte.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42, NumberStyles.Integer, Nfi", typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ AssertEquals("Compare failed for MyString1 and MyByte1", MyString1, MyByte1.ToString());
+ AssertEquals("Compare failed for MyString2 and MyByte2", MyString2, MyByte2.ToString());
+ AssertEquals("Compare failed for MyString3 and MyByte3", MyString3, MyByte3.ToString());
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("Compare failed for Formats1["+i.ToString()+"]", Results1[i], MyByte2.ToString(Formats1[i]));
+ AssertEquals("Compare failed for Formats2["+i.ToString()+"]", Results2[i], MyByte3.ToString(Formats2[i]));
+ }
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("Compare failed for Formats1["+i.ToString()+"] with Nfi", Results1_Nfi[i], MyByte2.ToString(Formats1[i], Nfi));
+ AssertEquals("Compare failed for Formats2["+i.ToString()+"] with Nfi", Results2_Nfi[i], MyByte3.ToString(Formats2[i], Nfi));
+ }
+ try {
+ MyByte1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ AssertEquals("Exception is the wrong type", typeof(FormatException), e.GetType());
+ }
+
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/ChangeLog b/mcs/class/corlib/Test/System/ChangeLog
new file mode 100644
index 00000000000..111c5bf1103
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ChangeLog
@@ -0,0 +1,301 @@
+2002/04/24 Nick Drochak <ndrochak@gol.com>
+
+ * IntegerFormatterTest.cs: Remove Console.WriteLines and use
+ AssertEquals() instead.
+
+2002-04-22 Nick Drochak <ndrochak@gol.com>
+
+ * StringTest.cs: Add unique markers to Assert messages.
+
+2002-04-09 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayTest.cs: Remove BinarySearch test on unsorted arrays. The
+ behavior is undefined if the array isn't sorted.
+
+2002/04/09 Nick Drochak <ndrochak@gol.com>
+
+ * DecimalTest.cs: Use AssertEquals() for better diagnostic message.
+
+2002-04-09 Nick Drochak <ndrochak@gol.com>
+
+ * ByteTest.cs: Use AssertEquals() for better diagnostic message.
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * EnumTest.cs: Add a few tests for differently underlying types and
+ the [Flags] attribute to test ToString().
+
+2002-04-08 Nick Drochak <ndrochak@gol.com>
+
+ * EnumTest.cs: Add test for ToString for the case where the enum
+ has [Flags] on it, and a mask value is used.
+
+2002-04-04 Nick Drochak <ndrochak@gol.com>
+
+ * EnumTest.cs: Change one Assert() message string so the two are
+ unique. And clean up exception catching logic.
+
+2002/03/28 Nick Drochak <ndrochak@gol.com>
+
+ * IntegerFormatterTest.cs: Eliminate warnings about unused exception
+ variables.
+
+2002-03-28 Nick Drochak <ndrochak@gol.com>
+
+ * EnumTest.cs(TestFormat): Use Fail() instead of AssertEquals() in
+ try-catch blocks. Add test to check if correct exception is being
+ thrown.
+
+2002/03/18 Nick Drochak <ndrochak@gol.com>
+
+ * ByteTest.cs:
+ * Int64Test.cs:
+ * SByteTest.cs: Do not hard code the "$" as the currency symbol to
+ use for Parse tests. This isn not really the fix we need. These
+ number formats vary wildly depending on the culture the system
+ runs with. We need a much better strategy here for testing this.
+ * Int32Test.cs: Use #if NOTYET-#endif to disable a test. This removes
+ an annoying compile warning.
+
+2002-03-18 Nick Drochak <ndrochak@gol.com>
+
+ * DoubleTest.cs:
+ * EnumTest.cs: Add unique identifier to Assert()'s. Needed to find
+ which one was faling on Linux.
+
+2002-03-12 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayTest.cs: Add tests for IList methods and for enumerator on
+ an array with non-zero lower bounds.
+
+2002-03-09 Nick Drochak <ndrochak@gol.com>
+
+ * ArrayTest.cs: Enable the enumerator test and include test for
+ Multi-dimensional array enumerator. Also include test for
+ mutation _not_ invalidating the enumerator.
+
+2002-03-09 Martin Baulig <martin@gnome.org>
+
+ * Int16Test.cs, Int32Tests.cs, UInt16Tests.cs: Use "en-US" culture and
+ don't let the user override.
+
+ * Int32Tests.cs: Cleanup. Use unique names in Assert()s, use AssertEquals()
+ where appropriate etc.
+
+2002-03-08 Martin Baulig <martin@gnome.org>
+
+ * StringTest.cs: More String.Split tests.
+
+2002-03-07 Martin Baulig <martin@gnome.org>
+
+ * StringTest.cs: Added a few more tests for the bug fixes I just
+ committed to String.cs.
+
+2002-03-07 Martin Baulig <martin@gnome.org>
+
+ * ArrayTest.cs: Fixed the FIXME in test #E05.
+
+2002-03-06 Duco Fijma <duco@lorentz.xs4all.nl>
+ * CharEnumeratorTest.cs: made test regarding out-of-bounds checking
+ a bit stronger (new failures fixed in CharEnumerator.cs).
+
+2002-03-06 Martin Baulig <martin@gnome.org>
+
+ * ArrayTest.cs (TestSetValue4): Added testcases #M94-#M96 for Array.Copy.
+
+ * ArrayTest.cs (TestCopyTo): Added testcases #F10-#F13 for arrays with
+ non-zero lower bounds.
+
+ * ArrayTest.cs (TestCopyTo): Added test for copying an empty array
+ to an empty array.
+
+2002-03-06 Martin Baulig <martin@gnome.org>
+
+ * ArrayTest.cs: Use unique labels for all the tests.
+ (TestSetValue4): A big new testcase.
+
+2002-03-06 Nick Drochak <ndrochak@gol.com>
+
+ * VersionTest.cs: Fix for mscorlib behavior vs. docs. CompareTo(null)
+ is legal.
+ * UInt16Test.cs:
+ * UInt32Test.cs:
+ * UInt64Test.cs: Use NumberFormatInfo.InvariantInfo.CurrencySymbol
+ where "$" was used. Should help suppress false negatives on systems
+ where "$" is not the currency symbol.
+
+2002-03-04 Duco Fijma <duco@lorentz.xs4all.nl>
+ * VersionTest.cs: created test cases for System.Version
+
+2002-03-03 Duco Fijma <duco@lorentz.xs4all.nl>
+ * CharEnumeratorTest.cs: completed the test cases
+
+2002-03-03 Nick Drochak <ndrochak@gol.com>
+
+ * DateTimeTest.cs: make static member non-static -- wouldn't work on
+ Windows if it was static. Doesn't _need_ to be static anyway.
+
+2002-03-01 Duco Fijma <duco@lorentz.xs4all.nl>
+ * AttributeTest.cs: created, far from complete.
+ * CharEnumeratorTest.cs: created. Contains just the basic case.
+ * AllTests.cs: added the two new tests above
+
+2002-03-01 Duco Fijma <duco@lorentz.xs4all.nl>
+ * BitConverterTest.cs: added one test for bug fix made to BitConverter
+ * class.
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * ArrayTest.cs: Commented out a few bits which are not yet implemented and
+ marked them with FIXME's.
+
+ * DecimalTest.cs, DecimalTest2.cs: Added zero-arg constructors.
+
+ * MartinTests.cs: Enabled ArrayTests.cs.
+
+2002-03-01 Duco Fijma <duco@lorentz.xs4all.nl>
+
+ * BitConverterTest.cs: completed test cases
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * MartinTests.cs: 15 tests currently work on Linux, call them all and
+ provide comments for the non-working tests.
+
+2002-02-28 Duncan Mak <duncan@ximian.com>
+
+ * MathTest.cs: Committed for Jon Guymon <gnarg@slackworks.com>.
+
+2002-02-28 Martin Baulig <martin@gnome.org>
+
+ * String.cs (TestCompare): Added a few tests.
+ (TestFormat): Please don't compare two strings with Assert (... == ...),
+ use AssertEquals instead - this gives you a better idea what went wrong
+ if the test fails.
+
+2002-02-28 Nick Drochak <ndrochak@gol.com>
+
+ * BitConverterTest.cs: Test was trying to catch the wrong Exception.
+ The MSDN docs clearly say ArgumentOutOfRangeException, but that's
+ not what get's thrown.
+
+ * DoubleTest.cs: Get working against mscorlib reference.
+
+2002-02-27 Duco Fijma <duco@lorentz.xs4all.nl>
+ * GuidTest.cs: changed to reflect new meaning of Guid.ToString("")
+ and Guid.ToString(null)
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * MartinTests.cs: New file. This contains all the test which already
+ work on Linux.
+
+ * String.cs: Added two testcases to TestTrim(), TestTrimStart() and
+ TestTrimEnd().
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * DateTimeTest.cs: Added testcases for the parsers. Use the invariant
+ culture to run this test suite.
+
+ * TimeZoneTest.cs: Use the invariant culture to run this test suite.
+
+2002-02-26 Duco Fijma <duco@lorentz.xs4all>
+ * TimeSpanTest.cs: added test from TimeSpan.FromMilliseconds
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * DateTimeTest.cs: New test.
+
+ * TimeZoneTest.cs: New test.
+
+2002-02-25 Duco Fijma <duco@lorentz.xs4all.nl>
+ * GuidTest.cs: all methods of System.Guid are now covered
+ * BitConverterTest.cs: created, not yet complete
+
+2002-02-21 Duco Fijma <duco@lorentz.xs4all.nl>
+ * GuidTest.cs: changed according to fix in System.Guid
+
+2002-02-20 Nick Drochak <ndrochak@gol.com>
+
+ * Int64Test.cs: One array was giving us trouble. Not sure why, but
+ it's related to the number of elements in an Array. For short Arrays
+ the compiler doesn't use the PrivateImplmentationDetails struct,
+ but for longer ones it does. That's when our corlib fails. I paired
+ down the array for now.
+
+2002-02-19 Duco Fijma <duco@lorentz.xs4all.nl>
+ * GuidTest.cs: added a few cases
+
+2002-02-18 Nick Drochak <ndrochak@gol.com>
+
+ * GuidTest.cs: Fix compile error. Needed to cast the null in the call to
+ constructor to avoid ambiguity.
+
+2002-02-11 Nick Drochak <ndrochak@gol.com>
+
+ * Int64Test.cs: Various fixes to make tests work against the ms corlib.
+ Currency Symbol tests seem to be system dependant. Not sure if this
+ will work on other systems, so please test it if you can. The most
+ disturbing one is negative numbers. Should they be (n) or -n ?
+
+2002-02-10 Nick Drochak <ndrochak@gol.com>
+
+ * AllTests.cs: Add Int64Test to the Suite
+ * Int64Test.cs: Change static member to instance member. This was
+ causing NUnitConsole some grief. Should be instance member anyway.
+
+2002-02-09 Nick Drochak <ndrochak@gol.com>
+
+ * ByteTest.cs:
+ * Int16Test.cs:
+ * Int32Test.cs:
+ * SByteTest.cs:
+ * UInt16Test.cs:
+ * UInt32Test.cs:
+ * UInt64Test.cs: Fixed tests where a "$" was hard coded. Change it to
+ use NumberFormatInfo.CurrentInfo.CurrencySymbol. Also used
+ NumberFormatInfo.InvariantInfo.CurrencySymbol where appropriate. These
+ tests all pass now with mscorlib.
+
+2002-01-06 Nick Drochak <ndrochak@gol.com>
+
+ * ResolveEventArgsTest.cs: New test.
+ * AllTests.cs: Added new test to suite.
+
+2001-12-27 Nick Drochak <ndrochak@gol.com>
+
+ * UInt32Test.cs: Added messages to Asserts()'s to find out which one was faliing.
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * UInt32Test.cs: Added tests for UInt32.Parse.
+
+ * Int32Test.cs: Added tests for Int32.Parse for various cases.
+
+2001-12-08 Nick Drochak <ndrochak@gol.com>
+
+ * ByteTest.cs: Added messages to Assert()'s to find out which one was failing.
+
+2001-11-28 Nick Drochak <ndrochak@gol.com>
+
+ * Int16Test.cs Int32Test.cs SByteTest.cs: Surgically removed tests that rely on culture of system. These need to be crafted a bit differently.
+
+2001-11-27 Nick Drochak <ndrochak@gol.com>
+
+ * SByteTest.cs: Add messages to Assert()'s so we can tell where the tests fail.
+
+2002-02-21 Bob Doan <bdoan@sicompos.com>
+
+ * BooleanTest.cs: Added New test suite
+ * AllTests.cs: Added new Boolean test to suite.
+
+2002-02-24 Bob Doan <bdoan@sicompos.com>
+
+ * BooleanTest.cs: Use correct argument order in AssertEquals
+ * AllTests.cs: Added new Double test to suite.
+ * DoubleTest.cs: Add new test suite
+
+2002-02-24 Bob Doan <bdoan@sicompos.com>
+
+ * DoubleTest.cs: Added parse tests to Double test suite, removed GetHashCodeTests
diff --git a/mcs/class/corlib/Test/System/CharEnumeratorTest.cs b/mcs/class/corlib/Test/System/CharEnumeratorTest.cs
new file mode 100755
index 00000000000..da7fecbc221
--- /dev/null
+++ b/mcs/class/corlib/Test/System/CharEnumeratorTest.cs
@@ -0,0 +1,123 @@
+//
+// CharEnumeratorTest.cs - NUnit Test Cases for the System.CharEnumerator class
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+public class CharEnumeratorTest : TestCase
+{
+ public CharEnumeratorTest () : base ("MonoTests.System.CharEnumeratorTest testcase") {}
+ public CharEnumeratorTest (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (CharEnumeratorTest));
+ }
+ }
+
+ string _s;
+
+ protected override void SetUp ()
+ {
+ _s = "Emma en Sophie";
+ }
+
+ private string GetFromEnumerator (CharEnumerator ce)
+ {
+ string res = "";
+ bool cont = true;
+
+ while (cont) {
+ res += ce.Current;
+ cont = ce.MoveNext ();
+ }
+
+ return res;
+ }
+
+ public void TestBasic ()
+ {
+ CharEnumerator ce = _s.GetEnumerator ();
+
+ ce.MoveNext ();
+
+ AssertEquals ("A1", _s, GetFromEnumerator (ce));
+ }
+
+ public void TestClone ()
+ {
+ CharEnumerator ce1, ce2=null;
+ bool cont;
+
+ ce1 = _s.GetEnumerator ();
+ cont = ce1.MoveNext ();
+ while (cont) {
+ if (ce1.Current == 'S') {
+ ce2 = (CharEnumerator) (ce1.Clone ());
+ }
+ cont = ce1.MoveNext ();
+ }
+
+ AssertEquals ("A1", "Sophie", GetFromEnumerator(ce2));
+ }
+
+ public void TestReadOutOfBounds ()
+ {
+ char c;
+ bool exception;
+ CharEnumerator ce = _s.GetEnumerator ();
+
+ try {
+ c = ce.Current;
+ exception = false;
+ }
+ catch (InvalidOperationException) {
+ exception = true;
+ }
+ Assert ("A1", exception);
+
+ AssertEquals("A2", true, ce.MoveNext ());
+
+ AssertEquals ("A3", _s, GetFromEnumerator (ce));
+
+ try {
+ c = ce.Current;
+ }
+ catch (InvalidOperationException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ AssertEquals("A5", false, ce.MoveNext() );
+ AssertEquals("A6", false, ce.MoveNext() );
+
+ ce.Reset ();
+
+ try {
+ c = ce.Current;
+ }
+ catch (InvalidOperationException) {
+ exception = true;
+ }
+ Assert ("A7", exception);
+
+ AssertEquals ("A8", true, ce.MoveNext ());
+
+ AssertEquals ("A9", _s, GetFromEnumerator (ce));
+
+ AssertEquals ("A10", false, ce.MoveNext ());
+ AssertEquals ("A11", false, ce.MoveNext ());
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/CharTest.cs b/mcs/class/corlib/Test/System/CharTest.cs
new file mode 100644
index 00000000000..3f89fd24381
--- /dev/null
+++ b/mcs/class/corlib/Test/System/CharTest.cs
@@ -0,0 +1,500 @@
+// CharTest.cs - NUnit Test Cases for the System.Char struct
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class CharTest : TestCase
+{
+ public CharTest() : base ("MonoTests.System.CharTest testsuite") {}
+ public CharTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(CharTest));
+ }
+ }
+
+ public void TestCompareTo()
+ {
+ Char c1 = 'a';
+ Char c2 = 'b';
+ Char c3 = 'b';
+ Assert("Less than", c1.CompareTo(c2) == -1);
+ Assert("Greater than", c2.CompareTo(c1) == 1);
+ Assert("Equal 1", c2.CompareTo(c3) == 0);
+ Assert("Equal 2", c1.CompareTo(c1) == 0);
+ }
+
+ public void TestEquals()
+ {
+ Char c1 = 'a';
+ Char c2 = 'b';
+ Char c3 = 'b';
+ Assert("Same", c1.Equals(c1));
+ Assert("Same value", c2.Equals(c3));
+ Assert("Not same", !c1.Equals(c2));
+ }
+
+ public void TestGetHashValue()
+ {
+ Char c1 = ' ';
+ AssertEquals("deterministic hash code ", c1.GetHashCode(), c1.GetHashCode());
+ // TODO - the spec doesn't say what algorithm is used to get hash codes. So far, just a weak test for determinism and mostly-uniqueness.
+ }
+
+ public void TestGetNumericValue()
+ {
+ Char c1 = ' ';
+ Char c2 = '3';
+ AssertEquals("code 1", -1.0, Char.GetNumericValue(c1), 0.1);
+ AssertEquals("code 2", 3.0, Char.GetNumericValue(c2), 0.1);
+
+ string s1 = " 3 ";
+ AssertEquals("space not number", -1.0, Char.GetNumericValue(s1, 0), 0.1);
+ AssertEquals("space not number", 3.0, Char.GetNumericValue(s1, 1), 0.1);
+ AssertEquals("space not number", -1.0, Char.GetNumericValue(s1, 2), 0.1);
+ }
+
+ public void TestGetUnicodeCategory()
+ {
+ {
+ char Pe1 = ']';
+ char Pe2 = '}';
+ char Pe3 = ')';
+ AssertEquals("Close Punctuation",
+ UnicodeCategory.ClosePunctuation,
+ Char.GetUnicodeCategory(Pe1));
+ AssertEquals("Close Punctuation",
+ UnicodeCategory.ClosePunctuation,
+ Char.GetUnicodeCategory(Pe2));
+ AssertEquals("Close Punctuation",
+ UnicodeCategory.ClosePunctuation,
+ Char.GetUnicodeCategory(Pe3));
+ }
+ // TODO - ConnectorPunctuation
+ {
+ char c1 = (char)0; // 0000-001F, 007F-009F
+ char c2 = (char)0x001F;
+ char c3 = (char)0x007F;
+ char c4 = (char)0x00F;
+ AssertEquals("Control",
+ UnicodeCategory.Control,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("Control",
+ UnicodeCategory.Control,
+ Char.GetUnicodeCategory(c2));
+ AssertEquals("Control",
+ UnicodeCategory.Control,
+ Char.GetUnicodeCategory(c3));
+ AssertEquals("Control",
+ UnicodeCategory.Control,
+ Char.GetUnicodeCategory(c4));
+ }
+ {
+ // TODO - more currencies?
+ char c1 = '$';
+ AssertEquals("Currency",
+ UnicodeCategory.CurrencySymbol,
+ Char.GetUnicodeCategory(c1));
+ }
+ {
+ char c1 = '-';
+ AssertEquals("Dash Punctuation",
+ UnicodeCategory.DashPunctuation,
+ Char.GetUnicodeCategory(c1));
+ }
+ {
+ char c1 = '2';
+ char c2 = '7';
+ AssertEquals("Decimal Digit",
+ UnicodeCategory.DecimalDigitNumber,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("Decimal Digit",
+ UnicodeCategory.DecimalDigitNumber,
+ Char.GetUnicodeCategory(c2));
+ }
+ // TODO - EnclosingMark
+ // TODO - FinalQuotePunctuation
+ // TODO - Format
+ // TODO - InitialQuotePunctuation
+ // TODO - LetterNumber
+ // TODO - LineSeparator (not '\n', that's a control char)
+ {
+ char c1 = 'a';
+ char c2 = 'z';
+ AssertEquals("LowercaseLetter",
+ UnicodeCategory.LowercaseLetter,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("LowercaseLetter",
+ UnicodeCategory.LowercaseLetter,
+ Char.GetUnicodeCategory(c2));
+ }
+ {
+ char c1 = '+';
+ char c2 = '=';
+ AssertEquals("MathSymbol",
+ UnicodeCategory.MathSymbol,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("MathSymbol",
+ UnicodeCategory.MathSymbol,
+ Char.GetUnicodeCategory(c2));
+ }
+ // TODO - ModifierSymbol
+ // TODO - NonSpacingMark
+ // TODO - OpenPunctuation
+ {
+ char c1 = '[';
+ char c2 = '{';
+ char c3 = '(';
+ AssertEquals("OpenPunctuation",
+ UnicodeCategory.OpenPunctuation,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("OpenPunctuation",
+ UnicodeCategory.OpenPunctuation,
+ Char.GetUnicodeCategory(c2));
+ AssertEquals("OpenPunctuation",
+ UnicodeCategory.OpenPunctuation,
+ Char.GetUnicodeCategory(c3));
+ }
+ // TODO - OtherLetter
+ // TODO - OtherNotAssigned
+ // TODO - OtherNumber
+ {
+ char c1 = '/';
+ AssertEquals("OtherPunctuation",
+ UnicodeCategory.OtherPunctuation,
+ Char.GetUnicodeCategory(c1));
+ }
+ // TODO - OtherSymbol
+ // TODO - ParagraphSeparator
+ // TODO - PrivateUse
+ {
+ char c1 = ' ';
+ AssertEquals("SpaceSeparator",
+ UnicodeCategory.SpaceSeparator,
+ Char.GetUnicodeCategory(c1));
+ }
+ // TODO - SpacingCombiningMark
+ {
+ char c1 = (char)0xD800; // D800-DBFF
+ char c2 = (char)0xDBFF; // D800-DBFF
+ char c3 = (char)0xDC01; // DC00-DEFF
+ char c4 = (char)0xDEFF; // DC00-DEFF
+ AssertEquals("High Surrogate",
+ UnicodeCategory.Surrogate,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("High Surrogate",
+ UnicodeCategory.Surrogate,
+ Char.GetUnicodeCategory(c2));
+ AssertEquals("Low Surrogate",
+ UnicodeCategory.Surrogate,
+ Char.GetUnicodeCategory(c3));
+ AssertEquals("Low Surrogate",
+ UnicodeCategory.Surrogate,
+ Char.GetUnicodeCategory(c4));
+ }
+ // TODO - TitlecaseLetter
+ // TODO - UppercaseLetter
+ {
+ char c1 = 'A';
+ char c2 = 'Z';
+ AssertEquals("UppercaseLetter",
+ UnicodeCategory.UppercaseLetter,
+ Char.GetUnicodeCategory(c1));
+ AssertEquals("UppercaseLetter",
+ UnicodeCategory.UppercaseLetter,
+ Char.GetUnicodeCategory(c2));
+ }
+ }
+
+ public void TestIsControl()
+ {
+ // control is 0000-001F, 007F-009F
+ char c1 = (char)0;
+ char c2 = (char)0x001F;
+ char c3 = (char)0x007F;
+ char c4 = (char)0x009F;
+ Assert("Not control", !Char.IsControl(' '));
+ Assert("control", Char.IsControl(c1));
+ Assert("control", Char.IsControl(c2));
+ Assert("control", Char.IsControl(c3));
+ Assert("control", Char.IsControl(c4));
+
+ string s1 = " " + c1 + c2 + c3 + c4;
+ Assert("Not control", !Char.IsControl(s1, 0));
+ Assert("control", Char.IsControl(s1, 1));
+ Assert("control", Char.IsControl(s1, 2));
+ Assert("control", Char.IsControl(s1, 3));
+ Assert("control", Char.IsControl(s1, 4));
+ }
+
+ public void TestIsDigit()
+ {
+ char c1 = '0';
+ char c2 = '9';
+ Assert("Not digit", !Char.IsDigit(' '));
+ Assert("digit", Char.IsDigit(c1));
+ Assert("digit", Char.IsDigit(c2));
+
+ string s1 = " " + c1 + c2;
+ Assert("Not digit", !Char.IsDigit(s1, 0));
+ Assert("digit", Char.IsDigit(s1, 1));
+ Assert("digit", Char.IsDigit(s1, 2));
+ }
+
+ public void TestIsLetter()
+ {
+ char c1 = 'a';
+ char c2 = 'z';
+ char c3 = 'A';
+ char c4 = 'Z';
+ Assert("Not letter", !Char.IsLetter(' '));
+ Assert("letter", Char.IsLetter(c1));
+ Assert("letter", Char.IsLetter(c2));
+ Assert("letter", Char.IsLetter(c3));
+ Assert("letter", Char.IsLetter(c4));
+
+ string s1 = " " + c1 + c2 + c3 + c4;
+ Assert("Not letter", !Char.IsLetter(s1, 0));
+ Assert("letter", Char.IsLetter(s1, 1));
+ Assert("letter", Char.IsLetter(s1, 2));
+ Assert("letter", Char.IsLetter(s1, 3));
+ Assert("letter", Char.IsLetter(s1, 4));
+ }
+
+ public void TestIsLetterOrDigit()
+ {
+ char c1 = 'a';
+ char c2 = 'z';
+ char c3 = 'A';
+ char c4 = 'Z';
+ char c5 = '0';
+ char c6 = '9';
+ Assert("Not letterordigit", !Char.IsLetterOrDigit(' '));
+ Assert("letterordigit", Char.IsLetterOrDigit(c1));
+ Assert("letterordigit", Char.IsLetterOrDigit(c2));
+ Assert("letterordigit", Char.IsLetterOrDigit(c3));
+ Assert("letterordigit", Char.IsLetterOrDigit(c4));
+ Assert("letterordigit", Char.IsLetterOrDigit(c5));
+ Assert("letterordigit", Char.IsLetterOrDigit(c6));
+
+ string s1 = " " + c1 + c2 + c3 + c4 + c5 + c6;
+ Assert("Not letterordigit", !Char.IsLetterOrDigit(s1, 0));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 1));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 2));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 3));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 4));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 5));
+ Assert("letterordigit", Char.IsLetterOrDigit(s1, 6));
+ }
+
+ public void TestIsLower()
+ {
+ char c1 = 'a';
+ char c2 = 'z';
+ Assert("Not lower", !Char.IsLower(' '));
+ Assert("lower", Char.IsLower(c1));
+ Assert("lower", Char.IsLower(c2));
+
+ string s1 = " " + c1 + c2;
+ Assert("Not lower", !Char.IsLower(s1, 0));
+ Assert("lower", Char.IsLower(s1, 1));
+ Assert("lower", Char.IsLower(s1, 2));
+ }
+
+ public void TestIsNumber()
+ {
+ char c1 = '0';
+ char c2 = '9';
+ // TODO - IsNumber of less obvious characters
+
+ Assert("Not number", !Char.IsNumber(' '));
+ Assert("number", Char.IsNumber(c1));
+ Assert("number", Char.IsNumber(c2));
+
+ string s1 = " " + c1 + c2;
+ Assert("Not number", !Char.IsNumber(s1, 0));
+ Assert("number", Char.IsNumber(s1, 1));
+ Assert("number", Char.IsNumber(s1, 2));
+ }
+
+ public void TestIsPunctuation()
+ {
+ char c1 = '.';
+ char c2 = '?';
+ Assert("Not punctuation", !Char.IsPunctuation(' '));
+ Assert("punctuation", Char.IsPunctuation(c1));
+ Assert("punctuation", Char.IsPunctuation(c2));
+
+ string s1 = " " + c1 + c2;
+ Assert("Not punctuation", !Char.IsPunctuation(s1, 0));
+ Assert("punctuation", Char.IsPunctuation(s1, 1));
+ Assert("punctuation", Char.IsPunctuation(s1, 2));
+ }
+
+ public void TestIsSeparator()
+ {
+ char c1 = ' ';
+
+ Assert("Not separator", !Char.IsSeparator('.'));
+ Assert("separator1", Char.IsSeparator(c1));
+
+ string s1 = "." + c1;
+ Assert("Not separator", !Char.IsSeparator(s1, 0));
+ Assert("separator1-2", Char.IsSeparator(s1, 1));
+ }
+
+ public void TestIsSurrogate()
+ {
+ // high surrogate - D800-DBFF
+ // low surrogate - DC00-DEFF
+ char c1 = (char)0xD800;
+ char c2 = (char)0xDBFF;
+ char c3 = (char)0xDC00;
+ char c4 = (char)0xDEFF;
+ Assert("Not surrogate", !Char.IsSurrogate(' '));
+ Assert("surrogate1", Char.IsSurrogate(c1));
+ Assert("surrogate2", Char.IsSurrogate(c2));
+ Assert("surrogate3", Char.IsSurrogate(c3));
+ Assert("surrogate4", Char.IsSurrogate(c4));
+
+ string s1 = " " + c1 + c2 + c3 + c4;
+ Assert("Not surrogate", !Char.IsSurrogate(s1, 0));
+ Assert("surrogate1-2", Char.IsSurrogate(s1, 1));
+ Assert("surrogate2-2", Char.IsSurrogate(s1, 2));
+ Assert("surrogate3-2", Char.IsSurrogate(s1, 3));
+ Assert("surrogate4-2", Char.IsSurrogate(s1, 4));
+ }
+
+ public void TestIsSymbol()
+ {
+ char c1 = '+';
+ char c2 = '=';
+ Assert("Not symbol", !Char.IsSymbol(' '));
+ Assert("symbol", Char.IsSymbol(c1));
+ Assert("symbol", Char.IsSymbol(c2));
+
+ string s1 = " " + c1 + c2;
+ Assert("Not symbol", !Char.IsSymbol(s1, 0));
+ Assert("symbol", Char.IsSymbol(s1, 1));
+ Assert("symbol", Char.IsSymbol(s1, 2));
+ }
+
+ public void TestIsUpper()
+ {
+ char c1 = 'A';
+ char c2 = 'Z';
+ Assert("Not upper", !Char.IsUpper('a'));
+ Assert("upper", Char.IsUpper(c1));
+ Assert("upper", Char.IsUpper(c2));
+
+ string s1 = "a" + c1 + c2;
+ Assert("Not upper", !Char.IsUpper(s1, 0));
+ Assert("upper", Char.IsUpper(s1, 1));
+ Assert("upper", Char.IsUpper(s1, 2));
+ }
+
+ public void TestIsWhiteSpace()
+ {
+ char c1 = ' ';
+ char c2 = '\n';
+ char c3 = '\t';
+
+ Assert("Not whitespace", !Char.IsWhiteSpace('.'));
+ Assert("whitespace1", Char.IsWhiteSpace(c1));
+ Assert("whitespace2", Char.IsWhiteSpace(c2));
+ Assert("whitespace3", Char.IsWhiteSpace(c3));
+
+ string s1 = "." + c1 + c2 + c3;
+ Assert("Not whitespace", !Char.IsWhiteSpace(s1, 0));
+ Assert("whitespace1-2", Char.IsWhiteSpace(s1, 1));
+ Assert("whitespace2-2", Char.IsWhiteSpace(s1, 2));
+ Assert("whitespace3-2", Char.IsWhiteSpace(s1, 3));
+ }
+
+
+ public void TestParse()
+ {
+ char c1 = 'a';
+ string s1 = "a";
+ Assert(c1.Equals(Char.Parse(s1)));
+ }
+
+ public void TestToLower()
+ {
+ char a1 = 'a';
+ char a2 = 'A';
+ char a3 = 'z';
+ char a4 = 'Z';
+ char a5 = ' ';
+ char a6 = '+';
+ char b1 = 'a';
+ char b2 = 'a';
+ char b3 = 'z';
+ char b4 = 'z';
+ char b5 = ' ';
+ char b6 = '+';
+ AssertEquals("char lowered", b1, Char.ToLower(a1));
+ AssertEquals("char lowered", b2, Char.ToLower(a2));
+ AssertEquals("char lowered", b3, Char.ToLower(a3));
+ AssertEquals("char lowered", b4, Char.ToLower(a4));
+ AssertEquals("char lowered", b5, Char.ToLower(a5));
+ AssertEquals("char lowered", b6, Char.ToLower(a6));
+ }
+
+ public void TestToUpper()
+ {
+ char a1 = 'a';
+ char a2 = 'A';
+ char a3 = 'z';
+ char a4 = 'Z';
+ char a5 = ' ';
+ char a6 = '+';
+ char b1 = 'A';
+ char b2 = 'A';
+ char b3 = 'Z';
+ char b4 = 'Z';
+ char b5 = ' ';
+ char b6 = '+';
+ AssertEquals("char uppered", b1, Char.ToUpper(a1));
+ AssertEquals("char uppered", b2, Char.ToUpper(a2));
+ AssertEquals("char uppered", b3, Char.ToUpper(a3));
+ AssertEquals("char uppered", b4, Char.ToUpper(a4));
+ AssertEquals("char uppered", b5, Char.ToUpper(a5));
+ AssertEquals("char uppered", b6, Char.ToUpper(a6));
+ }
+
+
+ public void TestToString()
+ {
+ char c1 = 'a';
+ string s1 = "a";
+ Assert(s1.Equals(c1.ToString()));
+ }
+
+ public void TestGetTypeCode()
+ {
+ char c1 = 'a';
+ Assert(c1.GetTypeCode().Equals(TypeCode.Char));
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/ConsoleTest.cs b/mcs/class/corlib/Test/System/ConsoleTest.cs
new file mode 100644
index 00000000000..da331fa6fff
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ConsoleTest.cs
@@ -0,0 +1,286 @@
+// ConsoleTest.cs - NUnit Test Cases for the System.Console class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+
+
+namespace MonoTests.System
+{
+
+public class ConsoleTest : TestCase
+{
+ public ConsoleTest() : base ("MonoTests.System.ConsoleTest testsuite") {}
+ public ConsoleTest(string name) : base(name) {}
+
+ TextWriter _err;
+ TextReader _in;
+ TextWriter _out;
+ protected override void SetUp()
+ {
+ _err = Console.Error;
+ _in = Console.In;
+ _out = Console.Out;
+ }
+
+ protected override void TearDown()
+ {
+ Console.SetError(_err);
+ Console.SetIn(_in);
+ Console.SetOut(_out);
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(ConsoleTest));
+ }
+ }
+
+ public void TestError() {
+ AssertNotNull("No error", Console.Error);
+ }
+
+ public void TestIn() {
+ AssertNotNull("No in", Console.In);
+ }
+
+ public void TestOut() {
+ AssertNotNull("No out", Console.Out);
+ }
+
+ public void TestOpenStandardError() {
+ {
+ Stream err = Console.OpenStandardError();
+ AssertNotNull("Can't open error", err);
+ }
+ {
+ Stream err = Console.OpenStandardError(512);
+ AssertNotNull("Can't open error", err);
+ }
+ // Spec says these are here, MS implementation says no.
+ //{
+ //bool errorThrown = false;
+ //try {
+ //Stream err = Console.OpenStandardError(-1);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("negative buffer error not thrown",
+ //errorThrown);
+ //}
+ //{
+ //bool errorThrown = false;
+ //try {
+ //Stream err = Console.OpenStandardError(0);
+ //} catch (ArgumentOutOfRangeException) {
+ //errorThrown = true;
+ //}
+ //Assert("zero buffer error not thrown", errorThrown);
+ //}
+ }
+
+ public void TestOpenStandardInput() {
+ {
+ Stream in1 = Console.OpenStandardInput();
+ AssertNotNull("Can't open input", in1);
+ }
+ {
+ Stream in1 = Console.OpenStandardInput(512);
+ AssertNotNull("Can't open input", in1);
+ }
+ // see commented-out tests in TestOpenStandardError
+ }
+
+ public void TestOpenStandardOutput() {
+ {
+ Stream out1 = Console.OpenStandardOutput();
+ AssertNotNull("Can't open output", out1);
+ }
+ {
+ Stream out1 = Console.OpenStandardOutput(512);
+ AssertNotNull("Can't open output", out1);
+ }
+ // see commented-out tests in TestOpenStandardError
+ }
+
+ public void TestRead() {
+ String testStr = "This is a readline test";
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetIn(r);
+ w.WriteLine(testStr);
+ s.Position = 0;
+ char val = (char) Console.Read();
+ AssertEquals("Wrong read", 'T', val);
+ }
+
+ public void TestReadLine() {
+ String testStr = "This is a readline test";
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetIn(r);
+ w.WriteLine(testStr);
+ s.Position = 0;
+ String line = Console.ReadLine();
+ AssertEquals("Wrong line", testStr, line);
+ }
+
+ public void TestSetError() {
+ {
+ bool errorThrown = false;
+ try {
+ Console.SetError(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null error error not thrown", errorThrown);
+ }
+ {
+ String testStr = "This is a stderr test";
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetError(w);
+ Console.Error.WriteLine(testStr);
+ s.Position = 0;
+ String line = r.ReadLine();
+ AssertEquals("Wrong line", testStr, line);
+ }
+ }
+
+ public void TestSetIn() {
+ {
+ bool errorThrown = false;
+ try {
+ Console.SetIn(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null in error not thrown", errorThrown);
+ }
+ {
+ String testStr = "This is a stdin test";
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetIn(r);
+ w.WriteLine(testStr);
+ s.Position = 0;
+ String line = Console.In.ReadLine();
+ AssertEquals("Wrong line", testStr, line);
+ }
+ }
+
+ public void TestSetOut() {
+ {
+ bool errorThrown = false;
+ try {
+ Console.SetOut(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null out error not thrown", errorThrown);
+ }
+ {
+ String testStr = "This is a stdout test";
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetOut(w);
+ Console.Out.WriteLine(testStr);
+ s.Position = 0;
+ String line = r.ReadLine();
+ AssertEquals("Wrong line", testStr, line);
+ }
+ }
+
+ public void TestWrite() {
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetOut(w);
+
+ long endPos = 0;
+
+ String testStr = "This is a stdout write test";
+ Console.Write(testStr);
+ s.Position = endPos;
+ String line = r.ReadToEnd();
+ AssertEquals("Wrong line", testStr, line);
+ endPos = s.Position;
+
+ Boolean[] booleans = {true, false};
+ foreach (bool b in booleans ) {
+ Console.Write(b);
+ s.Position = endPos;
+ line = r.ReadToEnd();
+ AssertEquals("Wrong boolean", b.ToString(), line);
+ endPos = s.Position;
+ }
+
+ Char[] chars = {'a', ';', '?'};
+ foreach (Char c in chars ) {
+ Console.Write(c);
+ s.Position = endPos;
+ line = r.ReadToEnd();
+ AssertEquals("Wrong char", c.ToString(), line);
+ endPos = s.Position;
+ }
+
+ // TODO - Likewise for char[], decimal, double, int, long, object, single, uint32, uint64
+ // TODO - write with format string
+ }
+
+ public void TestWriteLine() {
+ Stream s = new MemoryStream();
+ TextWriter w = new StreamWriter(s);
+ ((StreamWriter)w).AutoFlush = true;
+ TextReader r = new StreamReader(s);
+ Console.SetOut(w);
+
+ long endPos = 0;
+
+ String testStr = "This is a stdout writeline test";
+ Console.WriteLine(testStr);
+ s.Position = endPos;
+ String line = r.ReadLine();
+ AssertEquals("Wrong line", testStr, line);
+ endPos = s.Position;
+
+ Boolean[] booleans = {true, false};
+ foreach (bool b in booleans ) {
+ Console.WriteLine(b);
+ s.Position = endPos;
+ line = r.ReadLine();
+ AssertEquals("Wrong boolean", b.ToString(), line);
+ endPos = s.Position;
+ }
+
+ Char[] chars = {'a', ';', '?'};
+ foreach (Char c in chars ) {
+ Console.WriteLine(c);
+ s.Position = endPos;
+ line = r.ReadLine();
+ AssertEquals("Wrong char", c.ToString(), line);
+ endPos = s.Position;
+ }
+
+ // TODO - Likewise for char[], decimal, double, int, long, object, single, uint32, uint64
+ // TODO - write with format string
+ }
+
+}
+}
diff --git a/mcs/class/corlib/Test/System/DateTimeTest.cs b/mcs/class/corlib/Test/System/DateTimeTest.cs
new file mode 100755
index 00000000000..6d2aeeefdf4
--- /dev/null
+++ b/mcs/class/corlib/Test/System/DateTimeTest.cs
@@ -0,0 +1,327 @@
+//
+// DateTimeTest.cs - NUnit Test Cases for the System.DateTime struct
+//
+// author:
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2002 Free Software Foundation
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class DateTimeTest : TestCase
+{
+ long[] myTicks = {
+ 631501920000000000L, // 25 Feb 2002 - 00:00:00
+ 631502475130080000L, // 25 Feb 2002 - 15:25:13,8
+ 631502115130080000L, // 25 Feb 2002 - 05:25:13,8
+ 631502115000000000L, // 25 Feb 2002 - 05:25:00
+ 631502115130000000L, // 25 Feb 2002 - 05:25:13
+ 631502079130000000L // 25 Feb 2002 - 04:25:13
+ };
+
+ public DateTimeTest() : base ("MonoTests.System.DateTimeTest testcase") {}
+ public DateTimeTest (string name): base(name) {}
+
+ public static ITest Suite
+ {
+ get {
+ TestSuite suite = new TestSuite ();
+ return suite;
+ }
+ }
+
+ public void TestCtors ()
+ {
+ DateTime t1 = new DateTime (2002,2,25);
+ AssertEquals("A01", myTicks[0], t1.Ticks);
+ DateTime t2 = new DateTime (2002,2,25,15,25,13,8);
+ AssertEquals("A02", myTicks[1], t2.Ticks);
+ AssertEquals("A03", myTicks[0], t2.Date.Ticks);
+ AssertEquals("A04", 2002, t2.Year);
+ AssertEquals("A05", 2, t2.Month);
+ AssertEquals("A06", 25, t2.Day);
+ AssertEquals("A07", 15, t2.Hour);
+ AssertEquals("A08", 25, t2.Minute);
+ AssertEquals("A09", 13, t2.Second);
+ AssertEquals("A10", 8, t2.Millisecond);
+ DateTime t3 = new DateTime (2002,2,25,5,25,13,8);
+ AssertEquals("A11", myTicks[2], t3.Ticks);
+ }
+
+ public void TestToString ()
+ {
+ DateTime t1 = new DateTime (myTicks[2]);
+ DateTime t2 = new DateTime (myTicks[1]);
+ // Standard patterns
+ AssertEquals("B01", "02/25/2002", t1.ToString ("d"));
+ AssertEquals("B02", "Monday, 25 February 2002", t1.ToString ("D"));
+ AssertEquals("B03", "Monday, 25 February 2002 05:25", t1.ToString ("f"));
+ AssertEquals("B04", "Monday, 25 February 2002 05:25:13", t1.ToString ("F"));
+ AssertEquals("B05", "02/25/2002 05:25", t1.ToString ("g"));
+ AssertEquals("B06", "02/25/2002 05:25:13", t1.ToString ("G"));
+ AssertEquals("B07", "February 25", t1.ToString ("m"));
+ AssertEquals("B08", "February 25", t1.ToString ("M"));
+ AssertEquals("B09", "Mon, 25 Feb 2002 04:25:13 GMT", t1.ToString ("r"));
+ AssertEquals("B10", "Mon, 25 Feb 2002 04:25:13 GMT", t1.ToString ("R"));
+ AssertEquals("B11", "2002-02-25T05:25:13", t1.ToString ("s"));
+ AssertEquals("B12", "05:25", t1.ToString ("t"));
+ AssertEquals("B13", "05:25:13", t1.ToString ("T"));
+ AssertEquals("B14", "2002-02-25 04:25:13Z", t1.ToString ("u"));
+ AssertEquals("B15", "Monday, 25 February 2002 04:25:13", t1.ToString ("U"));
+ AssertEquals("B16", "2002 February", t1.ToString ("y"));
+ AssertEquals("B17", "2002 February", t1.ToString ("Y"));
+
+ // Custom patterns
+ AssertEquals("C01", "25", t1.ToString ("%d"));
+ AssertEquals("C02", "25", t1.ToString ("dd"));
+ AssertEquals("C03", "Mon", t1.ToString ("ddd"));
+ AssertEquals("C04", "Monday", t1.ToString ("dddd"));
+ AssertEquals("C05", "2", t1.ToString ("%M"));
+ AssertEquals("C06", "02", t1.ToString ("MM"));
+ AssertEquals("C07", "Feb", t1.ToString ("MMM"));
+ AssertEquals("C08", "February", t1.ToString ("MMMM"));
+ AssertEquals("C09", "2", t1.ToString ("%y"));
+ AssertEquals("C10", "02", t1.ToString ("yy"));
+ AssertEquals("C11", "2002", t1.ToString ("yyyy"));
+ AssertEquals("C12", "5", t1.ToString ("%h"));
+ AssertEquals("C13", "05", t1.ToString ("hh"));
+ AssertEquals("C14", "3", t2.ToString ("%h"));
+ AssertEquals("C15", "03", t2.ToString ("hh"));
+ AssertEquals("C16", "15", t2.ToString ("%H"));
+ AssertEquals("C17", "15", t2.ToString ("HH"));
+ AssertEquals("C18", "25", t2.ToString ("%m"));
+ AssertEquals("C19", "25", t2.ToString ("mm"));
+ AssertEquals("C20", "13", t2.ToString ("%s"));
+ AssertEquals("C21", "13", t2.ToString ("ss"));
+ AssertEquals("C22", "A", t1.ToString ("%t"));
+ AssertEquals("C23", "P", t2.ToString ("%t"));
+ AssertEquals("C24", "AM", t1.ToString ("tt"));
+ AssertEquals("C25", "PM", t2.ToString ("tt"));
+ AssertEquals("C26", "+1", t1.ToString ("%z"));
+ AssertEquals("C27", "+01", t1.ToString ("zz"));
+ AssertEquals("C28", "+01:00", t1.ToString ("zzz"));
+ AssertEquals("C29", " : ", t1.ToString (" : "));
+ AssertEquals("C30", " / ", t1.ToString (" / "));
+ AssertEquals("C31", " yyy ", t1.ToString (" 'yyy' "));
+ AssertEquals("C32", " d", t1.ToString (" \\d"));
+ }
+
+ public void TestParseExact ()
+ {
+ // Standard patterns
+ DateTime t1 = DateTime.ParseExact ("02/25/2002", "d", null);
+ AssertEquals ("D01", myTicks[0], t1.Ticks);
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002", "D", null);
+ AssertEquals ("D02", myTicks[0], t1.Ticks);
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002 05:25", "f", null);
+ AssertEquals ("D03", myTicks[3], t1.Ticks);
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002 05:25:13", "F", null);
+ AssertEquals ("D04", myTicks[4], t1.Ticks);
+ t1 = DateTime.ParseExact ("02/25/2002 05:25", "g", null);
+ AssertEquals ("D05", myTicks[3], t1.Ticks);
+ t1 = DateTime.ParseExact ("02/25/2002 05:25:13", "G", null);
+ AssertEquals ("D06", myTicks[4], t1.Ticks);
+ t1 = DateTime.ParseExact ("2002-02-25 04:25:13Z", "u", null);
+ AssertEquals ("D07", myTicks[4], t1.Ticks);
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002 04:25:13", "U", null);
+ AssertEquals ("D08", myTicks[4], t1.Ticks);
+
+ DateTime t2 = new DateTime (DateTime.Today.Year, 2, 25);
+ t1 = DateTime.ParseExact ("February 25", "m", null);
+ AssertEquals ("D09", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (DateTime.Today.Year, 2, 25);
+ t1 = DateTime.ParseExact ("February 25", "M", null);
+ AssertEquals ("D10", t2.Ticks, t1.Ticks);
+
+ t1 = DateTime.ParseExact ("Mon, 25 Feb 2002 04:25:13 GMT", "r", null);
+ AssertEquals ("D11", myTicks[4], t1.Ticks);
+ t1 = DateTime.ParseExact ("Mon, 25 Feb 2002 04:25:13 GMT", "R", null);
+ AssertEquals ("D12", myTicks[4], t1.Ticks);
+
+ t1 = DateTime.ParseExact ("2002-02-25T05:25:13", "s", null);
+ AssertEquals ("D13", myTicks[4], t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,0);
+ t1 = DateTime.ParseExact ("05:25", "t", null);
+ AssertEquals("D14", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,13);
+ t1 = DateTime.ParseExact ("05:25:13", "T", null);
+ AssertEquals("D15", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (2002, 2, 1);
+ t1 = DateTime.ParseExact ("2002 February", "y", null);
+ AssertEquals ("D16", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (2002, 2, 1);
+ t1 = DateTime.ParseExact ("2002 February", "Y", null);
+ AssertEquals ("D16", t2.Ticks, t1.Ticks);
+
+ // Custom patterns
+ t2 = new DateTime (2002, 1, 25);
+ t1 = DateTime.ParseExact ("25", "%d", null);
+ AssertEquals ("E01", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("25", "dd", null);
+ AssertEquals ("E02", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (DateTime.Today.Year, 2, 1);
+ t1 = DateTime.ParseExact ("2", "%M", null);
+ AssertEquals ("E03", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("02", "MM", null);
+ AssertEquals ("E04", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("Feb", "MMM", null);
+ AssertEquals ("E05", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("February", "MMMM", null);
+ AssertEquals ("E06", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (2005, 1, 1);
+ t1 = DateTime.ParseExact ("5", "%y", null);
+ AssertEquals ("E07", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("05", "yy", null);
+ AssertEquals ("E08", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("2005", "yyyy", null);
+ AssertEquals ("E09", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5, 0, 0);
+ t1 = DateTime.ParseExact ("5A", "ht", null);
+ AssertEquals ("E10", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("05A", "hht", null);
+ AssertEquals ("E11", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (15, 0, 0);
+ t1 = DateTime.ParseExact ("3P", "ht", null);
+ AssertEquals ("E12", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("03P", "hht", null);
+ AssertEquals ("E13", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5, 0, 0);
+ t1 = DateTime.ParseExact ("5", "%H", null);
+ AssertEquals ("E14", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (15, 0, 0);
+ t1 = DateTime.ParseExact ("15", "%H", null);
+ AssertEquals ("E15", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("15", "HH", null);
+ AssertEquals ("E16", t2.Ticks, t1.Ticks);
+
+ // Time zones
+ t2 = DateTime.Today + new TimeSpan (17, 18, 0);
+ t1 = DateTime.ParseExact ("11:18AM -5", "h:mmtt z", null);
+ AssertEquals ("F01", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("11:18AM -05:00", "h:mmtt zzz", null);
+ AssertEquals ("F02", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("7:18PM +03", "h:mmtt zz", null);
+ AssertEquals ("F03", t2.Ticks, t1.Ticks);
+ t1 = DateTime.ParseExact ("7:48PM +03:30", "h:mmtt zzz", null);
+ AssertEquals ("F04", t2.Ticks, t1.Ticks);
+
+ // Options
+ t2 = DateTime.Today + new TimeSpan (16, 18, 0);
+ t1 = DateTime.ParseExact ("11:18AM -5", "h:mmtt z",
+ null, DateTimeStyles.AdjustToUniversal);
+ AssertEquals ("G01", t2.Ticks, t1.Ticks);
+
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002 05:25:13", "F",
+ null, DateTimeStyles.AdjustToUniversal);
+ AssertEquals ("G02", myTicks[4], t1.Ticks);
+ t1 = DateTime.ParseExact ("Monday, 25 February 2002 05:25:13",
+ "dddd, dd MMMM yyyy HH:mm:ss",
+ null, DateTimeStyles.AdjustToUniversal);
+ AssertEquals ("G03", myTicks[4], t1.Ticks);
+
+ t1 = DateTime.ParseExact ("02/25/2002", "d", null,
+ DateTimeStyles.AllowWhiteSpaces);
+ AssertEquals ("G04", myTicks[0], t1.Ticks);
+
+ t1 = DateTime.ParseExact (" 02/25/2002", "d", null,
+ DateTimeStyles.AllowLeadingWhite);
+ AssertEquals ("G05", myTicks[0], t1.Ticks);
+
+ t1 = DateTime.ParseExact ("02/25/2002 ", "d", null,
+ DateTimeStyles.AllowTrailingWhite);
+ AssertEquals ("G06", myTicks[0], t1.Ticks);
+
+ t1 = DateTime.ParseExact (" 02 / 25 / 2002 ", "d", null,
+ DateTimeStyles.AllowWhiteSpaces);
+ AssertEquals ("G07", myTicks[0], t1.Ticks);
+ }
+
+ public void TestParse ()
+ {
+ // Standard patterns
+ DateTime t1 = DateTime.Parse ("02/25/2002");
+ AssertEquals ("H01", myTicks[0], t1.Ticks);
+ t1 = DateTime.Parse ("Monday, 25 February 2002");
+ AssertEquals ("H02", myTicks[0], t1.Ticks);
+ t1 = DateTime.Parse ("Monday, 25 February 2002 05:25");
+ AssertEquals ("H03", myTicks[3], t1.Ticks);
+ t1 = DateTime.Parse ("Monday, 25 February 2002 05:25:13");
+ AssertEquals ("H04", myTicks[4], t1.Ticks);
+ t1 = DateTime.Parse ("02/25/2002 05:25");
+ AssertEquals ("H05", myTicks[3], t1.Ticks);
+ t1 = DateTime.Parse ("02/25/2002 05:25:13");
+ AssertEquals ("H06", myTicks[4], t1.Ticks);
+ t1 = DateTime.Parse ("2002-02-25 04:25:13Z");
+ AssertEquals ("H07", myTicks[4], t1.Ticks);
+
+ DateTime t2 = new DateTime (DateTime.Today.Year, 2, 25);
+ t1 = DateTime.Parse ("February 25");
+ AssertEquals ("H08", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (DateTime.Today.Year, 2, 8);
+ t1 = DateTime.Parse ("February 08");
+ AssertEquals ("H09", t2.Ticks, t1.Ticks);
+
+ t1 = DateTime.Parse ("Mon, 25 Feb 2002 04:25:13 GMT");
+ AssertEquals ("H10", myTicks[4], t1.Ticks);
+
+ t1 = DateTime.Parse ("2002-02-25T05:25:13");
+ AssertEquals ("H11", myTicks[4], t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,0);
+ t1 = DateTime.Parse ("05:25");
+ AssertEquals("H12", t2.Ticks, t1.Ticks);
+
+ t2 = DateTime.Today + new TimeSpan (5,25,13);
+ t1 = DateTime.Parse ("05:25:13");
+ AssertEquals("H13", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (2002, 2, 1);
+ t1 = DateTime.Parse ("2002 February");
+ AssertEquals ("H14", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (2002, 2, 1);
+ t1 = DateTime.Parse ("2002 February");
+ AssertEquals ("H15", t2.Ticks, t1.Ticks);
+
+ t2 = new DateTime (DateTime.Today.Year, 2, 8);
+ t1 = DateTime.Parse ("February 8");
+ AssertEquals ("H16", t2.Ticks, t1.Ticks);
+ }
+
+
+ protected override void RunTest ()
+ {
+ CultureInfo oldcult = Thread.CurrentThread.CurrentCulture;
+
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("");
+
+ TestCtors ();
+ TestToString ();
+ TestParseExact ();
+ TestParse ();
+
+ Thread.CurrentThread.CurrentCulture = oldcult;
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/DecimalTest.cs b/mcs/class/corlib/Test/System/DecimalTest.cs
new file mode 100644
index 00000000000..21706370f88
--- /dev/null
+++ b/mcs/class/corlib/Test/System/DecimalTest.cs
@@ -0,0 +1,855 @@
+// DecimalTest.cs - NUnit Test Cases for the System.Decimal struct
+//
+// Author: Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) Martin Weindel, 2001
+//
+
+using NUnit.Framework;
+using System;
+using S = System; // for implementation switching only
+
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace MonoTests.System {
+ internal struct ParseTest
+ {
+ public ParseTest(String str, bool exceptionFlag)
+ {
+ this.str = str;
+ this.exceptionFlag = exceptionFlag;
+ this.style = NumberStyles.Number;
+ this.d = 0;
+ }
+
+ public ParseTest(String str, S.Decimal d)
+ {
+ this.str = str;
+ this.exceptionFlag = false;
+ this.style = NumberStyles.Number;
+ this.d = d;
+ }
+
+ public ParseTest(String str, S.Decimal d, NumberStyles style)
+ {
+ this.str = str;
+ this.exceptionFlag = false;
+ this.style = style;
+ this.d = d;
+ }
+
+ public String str;
+ public S.Decimal d;
+ public NumberStyles style;
+ public bool exceptionFlag;
+ }
+
+ internal struct ToStringTest
+ {
+ public ToStringTest(String format, S.Decimal d, String str)
+ {
+ this.format = format;
+ this.d = d;
+ this.str = str;
+ }
+
+ public String format;
+ public S.Decimal d;
+ public String str;
+ }
+
+ /// <summary>
+ /// Tests for System.Decimal
+ /// </summary>
+ public class DecimalTest : TestCase
+ {
+ public DecimalTest() : base ("MonoTests.System.DecimalTest testcase") {}
+ public DecimalTest(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get { return new TestSuite(typeof(DecimalTest)); }
+ }
+
+ private const int negativeBitValue = unchecked ((int)0x80000000);
+ private const int negativeScale4Value = unchecked ((int)0x80040000);
+ private int [] parts0 = {0,0,0,0}; //Positive Zero.
+ private int [] parts1 = {1,0,0,0};
+ private int [] parts2 = {0,1,0,0};
+ private int [] parts3 = {0,0,1,0};
+ private int [] parts4 = {0,0,0,negativeBitValue}; // Negative zero.
+ private int [] parts5 = {1,1,1,0};
+ private int [] partsMaxValue = {-1,-1,-1,0};
+ private int [] partsMinValue = {-1,-1,-1,negativeBitValue};
+ private int [] parts6 = {1234, 5678, 8888, negativeScale4Value};
+ private NumberFormatInfo NfiUser;
+
+ protected override void SetUp()
+ {
+ NfiUser = new NumberFormatInfo();
+ NfiUser.CurrencyDecimalDigits = 3;
+ NfiUser.CurrencyDecimalSeparator = ",";
+ NfiUser.CurrencyGroupSeparator = "_";
+ NfiUser.CurrencyGroupSizes = new int[] { 2,1,0 };
+ NfiUser.CurrencyNegativePattern = 10;
+ NfiUser.CurrencyPositivePattern = 3;
+ NfiUser.CurrencySymbol = "XYZ";
+ NfiUser.NumberDecimalSeparator = "##";
+ NfiUser.NumberDecimalDigits = 4;
+ NfiUser.NumberGroupSeparator = "__";
+ NfiUser.NumberGroupSizes = new int[] { 2,1 };
+ NfiUser.PercentDecimalDigits = 1;
+ NfiUser.PercentDecimalSeparator = ";";
+ NfiUser.PercentGroupSeparator = "~";
+ NfiUser.PercentGroupSizes = new int[] {1};
+ NfiUser.PercentNegativePattern = 2;
+ NfiUser.PercentPositivePattern = 2;
+ NfiUser.PercentSymbol = "%%%";
+ }
+
+ public void TestToString()
+ {
+ ToStringTest[] tab = {
+ new ToStringTest("F", 12.345678m, "12.35"),
+ new ToStringTest("F3", 12.345678m, "12.346"),
+ new ToStringTest("F0", 12.345678m, "12"),
+ new ToStringTest("F7", 12.345678m, "12.3456780"),
+ new ToStringTest("g", 12.345678m, "12.345678"),
+ new ToStringTest("E", 12.345678m, "1.234568E+001"),
+ new ToStringTest("E3", 12.345678m, "1.235E+001"),
+ new ToStringTest("E0", 12.345678m, "1E+001"),
+ new ToStringTest("e8", 12.345678m, "1.23456780e+001"),
+ new ToStringTest("F", 0.0012m, "0.00"),
+ new ToStringTest("F3", 0.0012m, "0.001"),
+ new ToStringTest("F0", 0.0012m, "0"),
+ new ToStringTest("F6", 0.0012m, "0.001200"),
+ new ToStringTest("e", 0.0012m, "1.200000e-003"),
+ new ToStringTest("E3", 0.0012m, "1.200E-003"),
+ new ToStringTest("E0", 0.0012m, "1E-003"),
+ new ToStringTest("E6", 0.0012m, "1.200000E-003"),
+ new ToStringTest("F4", -0.001234m, "-0.0012"),
+ new ToStringTest("E3", -0.001234m, "-1.234E-003"),
+ new ToStringTest("g", -0.000012m, "-1.2e-05"),
+ new ToStringTest("g", -0.00012m, "-0.00012"),
+ new ToStringTest("g4", -0.00012m, "-0.00012"),
+ new ToStringTest("g7", -0.00012m, "-0.00012"),
+ new ToStringTest("g", -0.0001234m, "-0.0001234"),
+ new ToStringTest("g", -0.0012m, "-0.0012"),
+ new ToStringTest("g", -0.001234m, "-0.001234"),
+ new ToStringTest("g", -0.012m, "-0.012"),
+ new ToStringTest("g4", -0.012m, "-0.012"),
+ new ToStringTest("g", -0.12m, "-0.12"),
+ new ToStringTest("g", -1.2m, "-1.2"),
+ new ToStringTest("g4", -120m, "-120"),
+ new ToStringTest("g", -12m, "-12"),
+ new ToStringTest("g", -120m, "-120"),
+ new ToStringTest("g", -1200m, "-1200"),
+ new ToStringTest("g4", -1200m, "-1200"),
+ new ToStringTest("g", -1234m, "-1234"),
+ new ToStringTest("g", -12000m, "-12000"),
+ new ToStringTest("g4", -12000m, "-1.2e+04"),
+ new ToStringTest("g5", -12000m, "-12000"),
+ new ToStringTest("g", -12345m, "-12345"),
+ new ToStringTest("g", -120000m, "-120000"),
+ new ToStringTest("g4", -120000m, "-1.2e+05"),
+ new ToStringTest("g5", -120000m, "-1.2e+05"),
+ new ToStringTest("g6", -120000m, "-120000"),
+ new ToStringTest("g", -123456.1m, "-123456.1"),
+ new ToStringTest("g5", -123456.1m, "-1.2346e+05"),
+ new ToStringTest("g6", -123456.1m, "-123456"),
+ new ToStringTest("g", -1200000m, "-1200000"),
+ new ToStringTest("g", -123456.1m, "-123456.1"),
+ new ToStringTest("g", -123456.1m, "-123456.1"),
+ new ToStringTest("g", -1234567.1m, "-1234567.1"),
+ new ToStringTest("g", -12000000m, "-12000000"),
+ new ToStringTest("g", -12345678.1m, "-12345678.1"),
+ new ToStringTest("g", -12000000000000000000m, "-12000000000000000000"),
+ new ToStringTest("F", -123, "-123.00"),
+ new ToStringTest("F3", -123, "-123.000"),
+ new ToStringTest("F0", -123, "-123"),
+ new ToStringTest("E3", -123, "-1.230E+002"),
+ new ToStringTest("E0", -123, "-1E+002"),
+ new ToStringTest("E", -123, "-1.230000E+002"),
+ new ToStringTest("F3", S.Decimal.MinValue, "-79228162514264337593543950335.000"),
+ new ToStringTest("F", S.Decimal.MinValue, "-79228162514264337593543950335.00"),
+ new ToStringTest("F0", S.Decimal.MinValue, "-79228162514264337593543950335"),
+ new ToStringTest("E", S.Decimal.MinValue, "-7.922816E+028"),
+ new ToStringTest("E3", S.Decimal.MinValue, "-7.923E+028"),
+ new ToStringTest("E28", S.Decimal.MinValue, "-7.9228162514264337593543950335E+028"),
+ new ToStringTest("E30", S.Decimal.MinValue, "-7.922816251426433759354395033500E+028"),
+ new ToStringTest("E0", S.Decimal.MinValue, "-8E+028"),
+ new ToStringTest("N3", S.Decimal.MinValue, "(79,228,162,514,264,337,593,543,950,335.000)"),
+ new ToStringTest("N0", S.Decimal.MinValue, "(79,228,162,514,264,337,593,543,950,335)"),
+ new ToStringTest("N", S.Decimal.MinValue, "(79,228,162,514,264,337,593,543,950,335.00)"),
+ new ToStringTest("C", 123456.7890m, "$123,456.79"),
+ new ToStringTest("C", -123456.7890m, "($123,456.79)"),
+ new ToStringTest("C3", 1123456.7890m, "$1,123,456.789"),
+ new ToStringTest("P", 123456.7891m, "12,345,678.91 %"),
+ new ToStringTest("P", -123456.7892m, "-12,345,678.92 %"),
+ new ToStringTest("P3", 1234.56789m, "123,456.789 %"),
+ };
+
+ NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;
+
+ for (int i = 0; i < tab.Length; i++)
+ {
+ try
+ {
+ string s = tab[i].d.ToString(tab[i].format, nfi);
+ int expectedLength = tab[i].str.Length;
+ AssertEquals("A01 tab[" + i + "].format = '" + tab[i].format + "')", tab[i].str, s.Substring(0,expectedLength));
+ }
+ catch (OverflowException)
+ {
+ Fail(tab[i].d.ToString(tab[i].format, nfi) + " (format = '" + tab[i].format + "'): unexpected exception !");
+ }
+ }
+ }
+
+ public void TestCurrencyPattern()
+ {
+ NumberFormatInfo nfi2 = (NumberFormatInfo)NfiUser.Clone();
+ S.Decimal d = -1234567.8976m;
+ string[] ergCurrencyNegativePattern = new String[16] {
+ "(XYZ1234_5_67,898)", "-XYZ1234_5_67,898", "XYZ-1234_5_67,898", "XYZ1234_5_67,898-",
+ "(1234_5_67,898XYZ)", "-1234_5_67,898XYZ", "1234_5_67,898-XYZ", "1234_5_67,898XYZ-",
+ "-1234_5_67,898 XYZ", "-XYZ 1234_5_67,898", "1234_5_67,898 XYZ-", "XYZ 1234_5_67,898-",
+ "XYZ -1234_5_67,898", "1234_5_67,898- XYZ", "(XYZ 1234_5_67,898)", "(1234_5_67,898 XYZ)",
+ };
+
+ for (int i = 0; i < ergCurrencyNegativePattern.Length; i++)
+ {
+ nfi2.CurrencyNegativePattern = i;
+ if (d.ToString("C", nfi2) != ergCurrencyNegativePattern[i])
+ {
+ Fail("CurrencyNegativePattern #" + i + " failed: " +
+ d.ToString("C", nfi2) + " != " + ergCurrencyNegativePattern[i]);
+ }
+ }
+
+ d = 1234567.8976m;
+ string[] ergCurrencyPositivePattern = new String[4] {
+ "XYZ1234_5_67,898", "1234_5_67,898XYZ", "XYZ 1234_5_67,898", "1234_5_67,898 XYZ",
+ };
+
+ for (int i = 0; i < ergCurrencyPositivePattern.Length; i++)
+ {
+ nfi2.CurrencyPositivePattern = i;
+ if (d.ToString("C", nfi2) != ergCurrencyPositivePattern[i])
+ {
+ Fail("CurrencyPositivePattern #" + i + " failed: " +
+ d.ToString("C", nfi2) + " != " + ergCurrencyPositivePattern[i]);
+ }
+ }
+ }
+
+ public void TestNumberNegativePattern()
+ {
+ NumberFormatInfo nfi2 = (NumberFormatInfo)NfiUser.Clone();
+ S.Decimal d = -1234.89765m;
+ string[] ergNumberNegativePattern = new String[5] {
+ "(1__2__34##8976)", "-1__2__34##8976", "- 1__2__34##8976", "1__2__34##8976-", "1__2__34##8976 -",
+ };
+
+ for (int i = 0; i < ergNumberNegativePattern.Length; i++)
+ {
+ nfi2.NumberNegativePattern = i;
+ if (d.ToString("N", nfi2) != ergNumberNegativePattern[i])
+ {
+ Fail("NumberNegativePattern #" + i + " failed: " +
+ d.ToString("N", nfi2) + " != " + ergNumberNegativePattern[i]);
+ }
+ }
+ }
+
+ public void TestPercentPattern()
+ {
+ NumberFormatInfo nfi2 = (NumberFormatInfo)NfiUser.Clone();
+ S.Decimal d = -1234.8976m;
+ string[] ergPercentNegativePattern = new String[3] {
+ "-1~2~3~4~8~9;8 %%%", "-1~2~3~4~8~9;8%%%", "-%%%1~2~3~4~8~9;8"
+ };
+
+ for (int i = 0; i < ergPercentNegativePattern.Length; i++)
+ {
+ nfi2.PercentNegativePattern = i;
+ if (d.ToString("P", nfi2) != ergPercentNegativePattern[i])
+ {
+ Fail("PercentNegativePattern #" + i + " failed: " +
+ d.ToString("P", nfi2) + " != " + ergPercentNegativePattern[i]);
+ }
+ }
+
+ d = 1234.8976m;
+ string[] ergPercentPositivePattern = new String[3] {
+ "1~2~3~4~8~9;8 %%%", "1~2~3~4~8~9;8%%%", "%%%1~2~3~4~8~9;8"
+ };
+
+ for (int i = 0; i < ergPercentPositivePattern.Length; i++)
+ {
+ nfi2.PercentPositivePattern = i;
+ if (d.ToString("P", nfi2) != ergPercentPositivePattern[i])
+ {
+ Fail("PercentPositivePattern #" + i + " failed: " +
+ d.ToString("P", nfi2) + " != " + ergPercentPositivePattern[i]);
+ }
+ }
+ }
+
+ public void TestParse()
+ {
+ ParseTest[] tab = {
+ new ParseTest("1.2345", 1.2345m),
+ new ParseTest("-9876543210", -9876543210m),
+ new ParseTest("$ ( 79,228,162,514,264,337,593,543,950,335.000 ) ", S.Decimal.MinValue, NumberStyles.Currency),
+ new ParseTest("1.234567890e-10", (S.Decimal)1.234567890e-10, NumberStyles.Float),
+ new ParseTest("1.234567890e-24", 1.2346e-24m, NumberStyles.Float),
+ new ParseTest(" 47896396.457983645462346E10 ", 478963964579836454.62346m, NumberStyles.Float),
+ new ParseTest("-7922816251426433759354395033.250000000000001", -7922816251426433759354395033.3m),
+ new ParseTest("-00000000000000795033.2500000000000000", -795033.25m),
+ new ParseTest("-000000000000001922816251426433759354395033.300000000000000", -1922816251426433759354395033.3m),
+ new ParseTest("-7922816251426433759354395033.150000000000", -7922816251426433759354395033.2m),
+ new ParseTest("-7922816251426433759354395033.2400000000000", -7922816251426433759354395033.2m),
+ new ParseTest("-7922816251426433759354395033.2600000000000", -7922816251426433759354395033.3m)
+ };
+
+ S.Decimal d;
+ for (int i = 0; i < tab.Length; i++)
+ {
+ try
+ {
+ d = S.Decimal.Parse(tab[i].str, tab[i].style, NumberFormatInfo.InvariantInfo);
+ if (tab[i].exceptionFlag)
+ {
+ Fail(tab[i].str + ": missing exception !");
+ }
+ else if (d != tab[i].d)
+ {
+ Fail(tab[i].str + " != " + d);
+ }
+ }
+ catch (OverflowException)
+ {
+ if (!tab[i].exceptionFlag)
+ {
+ Fail(tab[i].str + ": unexpected exception !");
+ }
+ }
+ }
+
+ try
+ {
+ d = S.Decimal.Parse(null);
+ Fail("Expected ArgumentNullException");
+ }
+ catch (ArgumentNullException)
+ {
+ //ok
+ }
+
+ try
+ {
+ d = S.Decimal.Parse("123nx");
+ Fail("Expected FormatException");
+ }
+ catch (FormatException)
+ {
+ //ok
+ }
+
+ try
+ {
+ d = S.Decimal.Parse("79228162514264337593543950336");
+ Fail("Expected OverflowException" + d);
+ }
+ catch (OverflowException)
+ {
+ //ok
+ }
+ }
+
+ public void TestConstants()
+ {
+ Assert(0m == (decimal)S.Decimal.Zero);
+ Assert(1m == (decimal)S.Decimal.One);
+ Assert(-1m == (decimal)S.Decimal.MinusOne);
+ Assert(0m == (decimal)S.Decimal.Zero);
+ Assert(79228162514264337593543950335m == (decimal)S.Decimal.MaxValue);
+ Assert(-79228162514264337593543950335m == (decimal)S.Decimal.MinValue);
+ }
+
+ public void TestConstructInt32()
+ {
+ decimal[] dtab = {0m, 1m, -1m, 123456m, -1234567m};
+ int[] itab = {0, 1, -1, 123456, -1234567};
+
+ S.Decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = new S.Decimal(itab[i]);
+ if ((decimal)d != dtab[i])
+ {
+ Fail("Int32 -> Decimal: " + itab[i] + " != " + d);
+ }
+ else
+ {
+ int n = (int) d;
+ if (n != itab[i])
+ {
+ Fail("Decimal -> Int32: " + d + " != " + itab[i]);
+ }
+ }
+ }
+
+ d = new S.Decimal(Int32.MaxValue);
+ Assert((int)d == Int32.MaxValue);
+
+ d = new S.Decimal(Int32.MinValue);
+ Assert((int)d == Int32.MinValue);
+ }
+
+ public void TestConstructUInt32()
+ {
+ decimal[] dtab = {0m, 1m, 123456m, 123456789m};
+ uint[] itab = {0, 1, 123456, 123456789};
+
+ S.Decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = new S.Decimal(itab[i]);
+ if ((decimal)d != dtab[i])
+ {
+ Fail("UInt32 -> Decimal: " + itab[i] + " != " + d);
+ }
+ else
+ {
+ uint n = (uint) d;
+ if (n != itab[i])
+ {
+ Fail("Decimal -> UInt32: " + d + " != " + itab[i]);
+ }
+ }
+ }
+
+ d = new S.Decimal(UInt32.MaxValue);
+ Assert((uint)d == UInt32.MaxValue);
+
+ d = new Decimal(UInt32.MinValue);
+ Assert((uint)d == UInt32.MinValue);
+ }
+
+ public void TestConstructInt64()
+ {
+ decimal[] dtab = {0m, 1m, -1m, 9876543m, -9876543210m, 12345678987654321m};
+ long[] itab = {0, 1, -1, 9876543, -9876543210L, 12345678987654321L};
+
+ S.Decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = new S.Decimal(itab[i]);
+ if ((decimal)d != dtab[i])
+ {
+ Fail("Int64 -> Decimal: " + itab[i] + " != " + d);
+ }
+ else
+ {
+ long n = (long) d;
+ if (n != itab[i])
+ {
+ Fail("Decimal -> Int64: " + d + " != " + itab[i]);
+ }
+ }
+ }
+
+ d = new S.Decimal(Int64.MaxValue);
+ Assert((long)d == Int64.MaxValue);
+
+ d = new Decimal(Int64.MinValue);
+ Assert((long)d == Int64.MinValue);
+ }
+
+ public void TestConstructUInt64()
+ {
+ decimal[] dtab = {0m, 1m, 987654321m, 123456789876543210m};
+ ulong[] itab = {0, 1, 987654321, 123456789876543210L};
+
+ S.Decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = new S.Decimal(itab[i]);
+ if ((decimal)d != dtab[i])
+ {
+ Fail("UInt64 -> Decimal: " + itab[i] + " != " + d);
+ }
+ else
+ {
+ ulong n = (ulong) d;
+ if (n != itab[i])
+ {
+ Fail("Decimal -> UInt64: " + d + " != " + itab[i]);
+ }
+ }
+ }
+
+ d = new S.Decimal(UInt64.MaxValue);
+ Assert((ulong)d == UInt64.MaxValue);
+
+ d = new Decimal(UInt64.MinValue);
+ Assert((ulong)d == UInt64.MinValue);
+ }
+
+ public void TestConstructSingle()
+ {
+ S.Decimal d;
+
+ d = new S.Decimal(-1.2345678f);
+ Assert((decimal)d == -1.234568m);
+
+ d=3;
+ Assert(3.0f == (float)d);
+
+ d = new S.Decimal(0.0f);
+ Assert((decimal)d == 0m);
+ Assert(0.0f == (float)d);
+
+ d = new S.Decimal(1.0f);
+ Assert((decimal)d == 1m);
+ Assert(1.0f == (float)d);
+
+ d = new S.Decimal(-1.2345678f);
+ Assert((decimal)d == -1.234568m);
+ Assert(-1.234568f == (float)d);
+
+ d = new S.Decimal(1.2345673f);
+ Assert((decimal)d == 1.234567m);
+
+ d = new S.Decimal(1.2345673e7f);
+ Assert((decimal)d == 12345670m);
+
+ d = new S.Decimal(1.2345673e-17f);
+ Assert((decimal)d == 0.00000000000000001234567m);
+ Assert(1.234567e-17f == (float)d);
+
+ // test exceptions
+ try
+ {
+ d = new S.Decimal(Single.MaxValue);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+
+ try
+ {
+ d = new S.Decimal(Single.NaN);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+
+ try
+ {
+ d = new S.Decimal(Single.PositiveInfinity);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+ }
+
+ public void TestConstructSingleRounding()
+ {
+ decimal d;
+
+ d = new S.Decimal(1765.2356f);
+ Assert(d == 1765.236m);
+
+ d = new S.Decimal(1765.23554f);
+ Assert("failed banker's rule rounding test 1", d == 1765.236m);
+
+ d = new S.Decimal(1765.2354f);
+ Assert(d == 1765.235m);
+
+ d = new S.Decimal(1765.2346f);
+ Assert(d == 1765.235m);
+
+ d = new S.Decimal(1765.23454f);
+ Assert("failed banker's rule rounding test 2", d == 1765.234m);
+
+ d = new S.Decimal(1765.2344f);
+ Assert(d == 1765.234m);
+
+ d = new S.Decimal(0.00017652356f);
+ Assert(d == 0.0001765236m);
+
+ d = new S.Decimal(0.000176523554f);
+ Assert("failed banker's rule rounding test 3", d == 0.0001765236m);
+
+ d = new S.Decimal(0.00017652354f);
+ Assert(d == 0.0001765235m);
+
+ d = new S.Decimal(0.00017652346f);
+ Assert(d == 0.0001765235m);
+
+ d = new S.Decimal(0.000176523454f);
+ Assert("failed banker's rule rounding test 4", d == 0.0001765234m);
+
+ d = new S.Decimal(0.00017652344f);
+ Assert(d == 0.0001765234m);
+
+ d = new S.Decimal(3.7652356e10f);
+ Assert(d == 37652360000m);
+
+ d = new S.Decimal(3.7652356e20f);
+ Assert(d == 376523600000000000000m);
+
+ d = new S.Decimal(3.76523554e20f);
+ Assert("failed banker's rule rounding test 5", d == 376523600000000000000m);
+
+ d = new S.Decimal(3.7652352e20f);
+ Assert(d == 376523500000000000000m);
+
+ d = new S.Decimal(3.7652348e20f);
+ Assert(d == 376523500000000000000m);
+
+ d = new S.Decimal(3.76523454e20f);
+ Assert("failed banker's rule rounding test 6", d == 376523400000000000000m);
+
+ d = new S.Decimal(3.7652342e20f);
+ Assert(d == 376523400000000000000m);
+ }
+
+ public void TestConstructDouble()
+ {
+ S.Decimal d;
+
+ d = new S.Decimal(0.0);
+ Assert((decimal)d == 0m);
+
+ d = new S.Decimal(1.0);
+ Assert((decimal)d == 1m);
+ Assert(1.0 == (double)d);
+
+ d = new S.Decimal(-1.2345678901234);
+ Assert((decimal)d == -1.2345678901234m);
+ Assert(-1.2345678901234 == (double)d);
+
+ d = new S.Decimal(1.2345678901234);
+ Assert((decimal)d == 1.2345678901234m);
+
+ d = new S.Decimal(1.2345678901234e8);
+ Assert((decimal)d == 123456789.01234m);
+ Assert(1.2345678901234e8 == (double)d);
+
+ d = new S.Decimal(1.2345678901234e16);
+ Assert((decimal)d == 12345678901234000m);
+ Assert(1.2345678901234e16 == (double)d);
+
+ d = new S.Decimal(1.2345678901234e24);
+ Assert((decimal)d == 1234567890123400000000000m);
+ Assert(1.2345678901234e24 == (double)d);
+
+ d = new S.Decimal(1.2345678901234e28);
+ Assert((decimal)d == 1.2345678901234e28m);
+ Assert(1.2345678901234e28 == (double)d);
+
+ d = new S.Decimal(7.2345678901234e28);
+ Assert((decimal)d == 7.2345678901234e28m);
+ Assert(new S.Decimal((double)d) == d);
+
+ d = new S.Decimal(1.2345678901234e-8);
+ Assert((decimal)d == 1.2345678901234e-8m);
+
+ d = new S.Decimal(1.2345678901234e-14);
+ Assert((decimal)d == 1.2345678901234e-14m);
+ Assert(1.2345678901234e-14 == (double)d);
+
+ d = new S.Decimal(1.2342278901234e-25);
+ Assert((decimal)d == 1.234e-25m);
+
+ // test exceptions
+ try
+ {
+ d = new S.Decimal(8e28);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+
+ try
+ {
+ d = new S.Decimal(8e48);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+
+ try
+ {
+ d = new S.Decimal(Double.NaN);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+
+ try
+ {
+ d = new S.Decimal(Double.PositiveInfinity);
+ Fail();
+ }
+ catch (OverflowException)
+ {
+ }
+ }
+
+ public void TestConstructDoubleRound()
+ {
+ decimal d;
+
+ d = new S.Decimal(1765.231234567857);
+ Assert(d == 1765.23123456786m);
+
+ d = new S.Decimal(1765.2312345678554);
+ Assert("failed banker's rule rounding test 1", d == 1765.23123456786m);
+ Assert(1765.23123456786 == (double)d);
+
+ d = new S.Decimal(1765.231234567853);
+ Assert(d == 1765.23123456785m);
+
+ d = new S.Decimal(1765.231234567847);
+ Assert(d == 1765.23123456785m);
+
+ d = new S.Decimal(1765.231234567843);
+ Assert(d == 1765.23123456784m);
+
+ d = new S.Decimal(1.765231234567857e-9);
+ Assert(d == 1.76523123456786e-9m);
+
+ d = new S.Decimal(1.7652312345678554e-9);
+ Assert("failed banker's rule rounding test 3", d == 1.76523123456786e-9m);
+
+ d = new S.Decimal(1.765231234567853e-9);
+ Assert(d == 1.76523123456785e-9m);
+
+ d = new S.Decimal(1.765231234567857e+24);
+ Assert(d == 1.76523123456786e+24m);
+
+ d = new S.Decimal(1.7652312345678554e+24);
+ Assert("failed banker's rule rounding test 4", d == 1.76523123456786e+24m);
+
+ d = new S.Decimal(1.765231234567853e+24);
+ Assert(d == 1.76523123456785e+24m);
+
+ d = new S.Decimal(1765.2312345678454);
+ Assert(d == 1765.23123456785m);
+ }
+
+ public void TestNegate()
+ {
+ decimal d;
+
+ d = new S.Decimal(12345678);
+ Assert((decimal)S.Decimal.Negate(d) == -12345678m);
+ }
+
+ public void TestPartConstruct()
+ {
+ decimal d;
+
+ d = new Decimal(parts0);
+ Assert(d == 0);
+
+ d = new Decimal(parts1);
+ Assert(d == 1);
+
+ d = new Decimal(parts2);
+ Assert(d == 4294967296m);
+
+ d = new Decimal(parts3);
+ Assert(d == 18446744073709551616m);
+
+ d = new Decimal(parts4);
+ Assert(d == 0m);
+
+ d = new Decimal(parts5);
+ Assert(d == 18446744078004518913m);
+
+ d = new Decimal(partsMaxValue);
+ Assert(d == Decimal.MaxValue);
+
+ d = new Decimal(partsMinValue);
+ Assert(d == Decimal.MinValue);
+
+ d = new Decimal(parts6);
+ int[] erg = Decimal.GetBits(d);
+ for (int i = 0; i < 4; i++)
+ {
+ Assert(erg[i] == parts6[i]);
+ }
+ }
+
+ public void TestFloorTruncate()
+ {
+ decimal[,] dtab = {
+ {0m, 0m, 0m}, {1m, 1m, 1m}, {-1m, -1m, -1m}, {1.1m, 1m, 1m},
+ {-1.000000000001m, -2m, -1m}, {12345.67890m,12345m,12345m},
+ {-123456789012345.67890m, -123456789012346m, -123456789012345m},
+ {S.Decimal.MaxValue, S.Decimal.MaxValue, S.Decimal.MaxValue},
+ {S.Decimal.MinValue, S.Decimal.MinValue, S.Decimal.MinValue},
+ {6.999999999m, 6m, 6m}, {-6.999999999m, -7m, -6m},
+ {0.00001m, 0m, 0m}, {-0.00001m, -1m, 0m}
+ };
+
+ decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = S.Decimal.Floor(dtab[i,0]);
+ if (d != dtab[i,1])
+ {
+ Fail("Floor: Floor(" + dtab[i,0] + ") != " + d);
+ }
+ d = S.Decimal.Truncate(dtab[i,0]);
+ if (d != dtab[i,2])
+ {
+ Fail("Truncate: Truncate(" + dtab[i,0] + ") != " + d);
+ }
+ }
+ }
+
+ public void TestRound()
+ {
+ decimal[,] dtab = {
+ {1m, 0, 1m}, {1.234567890m, 1, 1.2m},
+ {1.234567890m, 2, 1.23m}, {1.23450000001m, 3, 1.235m},
+ {1.2345m, 3, 1.234m}, {1.2355m, 3, 1.236m},
+ {1.234567890m, 4, 1.2346m}, {1.23567890m, 2, 1.24m},
+ {47893764694.4578563236436621m, 7, 47893764694.4578563m},
+ {-47893764694.4578563236436621m, 9, -47893764694.457856324m},
+ {-47893764694.4578m, 5, -47893764694.4578m}
+ };
+
+ decimal d;
+
+ for (int i = 0; i < dtab.GetLength(0); i++)
+ {
+ d = S.Decimal.Round(dtab[i,0], (int)dtab[i,1]);
+ if (d != dtab[i,2])
+ {
+ Fail("Round: Round(" + dtab[i,0] + "," + (int)dtab[i,1] + ") != " + d);
+ }
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/mcs/class/corlib/Test/System/DecimalTest2.cs b/mcs/class/corlib/Test/System/DecimalTest2.cs
new file mode 100644
index 00000000000..e14628797a1
--- /dev/null
+++ b/mcs/class/corlib/Test/System/DecimalTest2.cs
@@ -0,0 +1,3126 @@
+// DecimalTest.cs - NUnit Test Cases for the System.Decimal struct
+//
+// Author: Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) Martin Weindel, 2001
+//
+
+using NUnit.Framework;
+using System;
+using S = System; // used for implementation switching
+using System.Globalization;
+using System.Runtime.CompilerServices;
+
+namespace MonoTests.System
+{
+
+ public enum TestResultInfo
+ {
+ Ok = 0,
+ Overflow = 1,
+ ReverseRound = 2,
+ DivideByZero = 3,
+ ReverseOverflow = 4
+ }
+
+ public struct TestResult
+ {
+ public TestResult(int i, decimal v)
+ {
+ info = (TestResultInfo) i;
+ val = v;
+ }
+
+ public TestResultInfo info;
+ public decimal val;
+ }
+
+
+ /// <summary>
+ /// Tests for System.Decimal
+ /// </summary>
+ public class DecimalTest2 : TestCase
+ {
+ public DecimalTest2() : base ("MonoTests.System.DecimalTest2 testcase") {}
+ public DecimalTest2(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get { return new TestSuite(typeof(DecimalTest2)); }
+ }
+
+ private void ReportOpError(string msg, int i, int j, decimal d1, decimal d2, decimal d3, decimal d3b)
+ {
+ Console.WriteLine("*** " + msg + " for " + d1 + " #" + i + " " + d2 + " #" + j);
+ Console.WriteLine("Ist:" + d3 + " Soll:" + d3b + " delta=" + (d3 - d3b) + " ==" + (d3 == d3b));
+ }
+
+ public void TestCompare()
+ {
+ const int size = 14;
+ decimal[] data = new decimal[size] {
+ 0m, 1m, -1m, 2m, 10m, 0.1m, 0.11m,
+ 79228162514264337593543950335m,
+ -79228162514264337593543950335m,
+ 27703302467091960609331879.532m,
+ -3203854.9559968181492513385018m,
+ -3203854.9559968181492513385017m,
+ -48466870444188873796420.0286m,
+ -48466870444188873796420.02860m
+ };
+
+ short[,] cmpTable = new short[size,size] {
+ {0,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,1,1},
+ {1,0,1,-1,-1,1,1,-1,1,-1,1,1,1,1},
+ {-1,-1,0,-1,-1,-1,-1,-1,1,-1,1,1,1,1},
+ {1,1,1,0,-1,1,1,-1,1,-1,1,1,1,1},
+ {1,1,1,1,0,1,1,-1,1,-1,1,1,1,1},
+ {1,-1,1,-1,-1,0,-1,-1,1,-1,1,1,1,1},
+ {1,-1,1,-1,-1,1,0,-1,1,-1,1,1,1,1},
+ {1,1,1,1,1,1,1,0,1,1,1,1,1,1},
+ {-1,-1,-1,-1,-1,-1,-1,-1,0,-1,-1,-1,-1,-1},
+ {1,1,1,1,1,1,1,-1,1,0,1,1,1,1},
+ {-1,-1,-1,-1,-1,-1,-1,-1,1,-1,0,-1,1,1},
+ {-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,0,1,1},
+ {-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,0,0},
+ {-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,0,0}
+ };
+
+ for (int i = 0; i < size; i++)
+ {
+ S.Decimal d1 = data[i];
+ for (int j = 0; j < size; j++)
+ {
+ Assert(cmpTable[i,j] == -cmpTable[j,i]);
+ int x = cmpTable[i,j];
+ S.Decimal d2 = data[j];
+
+ int y = S.Decimal.Compare(d1, d2);
+ if (y < 0) y = -1;
+ else if (y > 0) y = 1;
+ Assert(x == y);
+
+ y = d1.CompareTo(d2);
+ if (y < 0) y = -1;
+ else if (y > 0) y = 1;
+ Assert(x == y);
+
+ bool b = d1 < d2;
+ if (x != -1) b = !b;
+ Assert(b);
+
+ b = d1 <= d2;
+ if (x == 1) b = !b;
+ Assert(b);
+
+ b = d1 >= d2;
+ if (x == -1) b = !b;
+ Assert(b);
+
+ b = d1 > d2;
+ if (x != 1) b = !b;
+ Assert(b);
+
+ b = d1 == d2;
+ if (x != 0) b = !b;
+ Assert(b);
+
+ b = d1.Equals(d2);
+ if (x != 0) b = !b;
+ Assert(b);
+
+ b = S.Decimal.Equals(d1, d2);
+ if (x != 0) b = !b;
+ Assert(b);
+ }
+ }
+ }
+
+ public void TestRemainder()
+ {
+ Assert((decimal)S.Decimal.Remainder(3.6m, 1.3m) == 1.0m);
+ Assert((decimal)S.Decimal.Remainder(79228162514264337593543950335m ,
+ 27703302467091960609331879.53200m) == 24420760848422211464106753m);
+
+ Assert((decimal)S.Decimal.Remainder(45937986975432m, 43987453m)
+ == 42334506m);
+ Assert((decimal)S.Decimal.Remainder(45937986975000m, 5000m)
+ == 0m);
+ Assert((decimal)S.Decimal.Remainder(-54789548973.6234m, 1.3356m)
+ == -0.1074m);
+ }
+
+ public void TestAdd()
+ {
+ decimal[] args = auto_build2;
+ TestResult[] trs = trAuto_Add_build2;
+ int errOverflow = 0;
+ int errOp = 0;
+ int count = args.GetLength(0);
+ int n = 0;
+ for (int i = 0; i < count; i++)
+ {
+ decimal d1 = args[i];
+ for (int j = 0; j < count; j++, n++)
+ {
+ decimal d2 = args[j];
+ decimal d3 = 0;
+ decimal d4 = 0;
+ TestResult tr = trs[n];
+ try
+ {
+ d3 = S.Decimal.Add(d1, d2);
+ if (d3 != tr.val)
+ {
+ if (tr.info == TestResultInfo.Overflow)
+ {
+ ReportOpError("Add: expected overflow", i, j, d1, d2, d3, tr.val);
+ errOverflow++;
+ }
+ else
+ {
+ ReportOpError("Add: result mismatch", i, j, d1, d2, d3, tr.val);
+ errOp++;
+ }
+ }
+ else if (tr.info == TestResultInfo.Ok)
+ {
+ d4 = S.Decimal.Subtract(d3, d2);
+ if (d4 != d1)
+ {
+ ReportOpError("Subtract: result mismatch", i, j, d3, d2, d4, d1);
+ errOp++;
+ }
+ }
+ }
+ catch (OverflowException)
+ {
+ if (tr.info != TestResultInfo.Overflow)
+ {
+ ReportOpError("Add: unexpected overflow", i, j, d1, d2, d3, 0);
+ errOverflow++;
+ }
+ }
+ }
+ }
+
+ if (errOverflow + errOp > 0)
+ {
+ Fail("" + errOp + " wrong additions, " + errOverflow + " wrong overflows");
+ }
+ }
+
+ public void TestMult()
+ {
+ decimal[] args = auto_build2;
+ TestResult[] trs = trAuto_Mult_build2;
+ int errOverflow = 0;
+ int errOp = 0;
+ int count = args.GetLength(0);
+ int n = 0;
+ for (int i = 0; i < count; i++)
+ {
+ decimal d1 = args[i];
+ for (int j = 0; j < count; j++, n++)
+ {
+ decimal d2 = args[j];
+ decimal d3 = 0;
+ decimal d4 = 0;
+ TestResult tr = trs[n];
+ try
+ {
+ d3 = S.Decimal.Multiply(d1, d2);
+ if (d3 != tr.val)
+ {
+ if (tr.info == TestResultInfo.Overflow)
+ {
+ ReportOpError("Mult: expected overflow", i, j, d1, d2, d3, tr.val);
+ errOverflow++;
+ }
+ else
+ {
+ ReportOpError("Mult: result mismatch", i, j, d1, d2, d3, tr.val);
+ errOp++;
+ }
+ }
+ }
+ catch (OverflowException)
+ {
+ if (tr.info != TestResultInfo.Overflow)
+ {
+ ReportOpError("Mult: unexpected overflow", i, j, d1, d2, d3, 0);
+ errOverflow++;
+ }
+ }
+
+ if (d2 != 0 && tr.info != TestResultInfo.Overflow)
+ {
+ try
+ {
+ d4 = S.Decimal.Divide(d3, d2);
+ if (d4 != d1 && tr.info != TestResultInfo.ReverseRound)
+ {
+ ReportOpError("MultDiv: result mismatch", i, j, d3, d2, d4, d1);
+ errOp++;
+ }
+ }
+ catch (OverflowException)
+ {
+ if (tr.info != TestResultInfo.ReverseOverflow)
+ {
+ ReportOpError("MultDiv: unexpected overflow", i, j, d3, d2, d4, d1);
+ errOverflow++;
+ }
+ }
+ }
+
+ }
+ }
+
+ if (errOverflow + errOp > 0)
+ {
+ Fail("" + errOp + " wrong multiplications, " + errOverflow + " wrong overflows");
+ }
+ }
+
+ public void TestDiv()
+ {
+ decimal[] args = auto_build2;
+ TestResult[] trs = trAuto_Div_build2;
+ int errOverflow = 0;
+ int errDivideByZero = 0;
+ int errOp = 0;
+ int count = args.GetLength(0);
+ int n = 0;
+ for (int i = 0; i < count; i++)
+ {
+ decimal d1 = args[i];
+ for (int j = 0; j < count; j++, n++)
+ {
+ decimal d2 = args[j];
+ decimal d3 = 0;
+ decimal d4 = 0;
+ TestResult tr = trs[n];
+ try
+ {
+ d3 = S.Decimal.Divide(d1, d2);
+ if (d3 != tr.val)
+ {
+ if (tr.info == TestResultInfo.Overflow)
+ {
+ ReportOpError("Div: expected overflow", i, j, d1, d2, d3, tr.val);
+ errOverflow++;
+ }
+ else if (tr.info == TestResultInfo.DivideByZero)
+ {
+ ReportOpError("Div: expected divide by zero", i, j, d1, d2, d3, tr.val);
+ errDivideByZero++;
+ }
+ else
+ {
+ ReportOpError("Div: result mismatch", i, j, d1, d2, d3, tr.val);
+ errOp++;
+ }
+ }
+ }
+ catch (OverflowException)
+ {
+ if (tr.info != TestResultInfo.Overflow)
+ {
+ ReportOpError("Div: unexpected overflow", i, j, d1, d2, d3, 0);
+ errOverflow++;
+ }
+ }
+ catch (DivideByZeroException)
+ {
+ if (tr.info != TestResultInfo.DivideByZero)
+ {
+ ReportOpError("Div: unexpected divide by zero", i, j, d1, d2, d3, 0);
+ errDivideByZero++;
+ }
+ }
+
+ if (d3 != 0)
+ {
+ try
+ {
+ d4 = S.Decimal.Multiply(d3, d2);
+ if (d4 != d1 && tr.info != TestResultInfo.ReverseRound)
+ {
+ ReportOpError("DivMult: result mismatch", i, j, d3, d2, d4, d1);
+ errOp++;
+ }
+ }
+ catch (OverflowException)
+ {
+ if (tr.info != TestResultInfo.ReverseOverflow)
+ {
+ ReportOpError("DivMult: unexpected overflow", i, j, d3, d2, d4, d1);
+ errOverflow++;
+ }
+ }
+ }
+ }
+ }
+
+ if (errOverflow + errOp > 0)
+ {
+ Fail("" + errOp + " wrong division, " + errOverflow + " wrong overflows, " + errDivideByZero + " wrong divide by zero, ");
+ }
+ }
+
+ #region Data
+
+
+ // generated argument list build2
+ decimal[] auto_build2 = new decimal[] {
+ 0m, // 0
+ 1m, // 1
+ -1m, // 2
+ 2m, // 3
+ 10m, // 4
+ 0.1m, // 5
+ 79228162514264337593543950335m, // 6
+ -79228162514264337593543950335m, // 7
+ 27703302467091960609331879.532m, // 8
+ -3203854.9559968181492513385018m, // 9
+ -48466870444188873796420.028868m, // 10
+ -545193693242804794.30331374676m, // 11
+ 0.7629234053338741809892531431m, // 12
+ -400453059665371395972.33474452m, // 13
+ 222851627785191714190050.61676m, // 14
+ 14246043379204153213661335.584m, // 15
+ -421123.30446308691436596648186m, // 16
+ 24463288738299545.200508898642m, // 17
+ -5323259153836385912697776.001m, // 18
+ 102801066199805834724673169.19m, // 19
+ 7081320760.3793287174700927968m, // 20
+ 415752273939.77704245656837041m, // 21
+ -6389392489892.6362673670820462m, // 22
+ 442346282742915.0596416330681m, // 23
+ -512833780867323.89020837443764m, // 24
+ 608940580690915704.1450897514m, // 25
+ -42535053313319986966115.037787m, // 26
+ -7808274522591953107485.8812311m, // 27
+ 1037807626804273037330059471.7m, // 28
+ -4997122966.448652425771563042m, // 29
+ };
+
+
+ // generated result list build2
+ TestResult[] trAuto_Add_build2 = new TestResult[] {
+ new TestResult(0, 0m), // 0 + 0
+ new TestResult(0, 1m), // 0 + 1
+ new TestResult(0, -1m), // 0 + 2
+ new TestResult(0, 2m), // 0 + 3
+ new TestResult(0, 10m), // 0 + 4
+ new TestResult(0, 0.1m), // 0 + 5
+ new TestResult(0, 79228162514264337593543950335m), // 0 + 6
+ new TestResult(0, -79228162514264337593543950335m), // 0 + 7
+ new TestResult(0, 27703302467091960609331879.532m), // 0 + 8
+ new TestResult(0, -3203854.9559968181492513385018m), // 0 + 9
+ new TestResult(0, -48466870444188873796420.028868m), // 0 + 10
+ new TestResult(0, -545193693242804794.30331374676m), // 0 + 11
+ new TestResult(0, 0.7629234053338741809892531431m), // 0 + 12
+ new TestResult(0, -400453059665371395972.33474452m), // 0 + 13
+ new TestResult(0, 222851627785191714190050.61676m), // 0 + 14
+ new TestResult(0, 14246043379204153213661335.584m), // 0 + 15
+ new TestResult(0, -421123.30446308691436596648186m), // 0 + 16
+ new TestResult(0, 24463288738299545.200508898642m), // 0 + 17
+ new TestResult(0, -5323259153836385912697776.001m), // 0 + 18
+ new TestResult(0, 102801066199805834724673169.19m), // 0 + 19
+ new TestResult(0, 7081320760.3793287174700927968m), // 0 + 20
+ new TestResult(0, 415752273939.77704245656837041m), // 0 + 21
+ new TestResult(0, -6389392489892.6362673670820462m), // 0 + 22
+ new TestResult(0, 442346282742915.0596416330681m), // 0 + 23
+ new TestResult(0, -512833780867323.89020837443764m), // 0 + 24
+ new TestResult(0, 608940580690915704.1450897514m), // 0 + 25
+ new TestResult(0, -42535053313319986966115.037787m), // 0 + 26
+ new TestResult(0, -7808274522591953107485.8812311m), // 0 + 27
+ new TestResult(0, 1037807626804273037330059471.7m), // 0 + 28
+ new TestResult(0, -4997122966.448652425771563042m), // 0 + 29
+ new TestResult(0, 1m), // 1 + 0
+ new TestResult(0, 2m), // 1 + 1
+ new TestResult(0, 0m), // 1 + 2
+ new TestResult(0, 3m), // 1 + 3
+ new TestResult(0, 11m), // 1 + 4
+ new TestResult(0, 1.1m), // 1 + 5
+ new TestResult(1, 0m), // 1 + 6
+ new TestResult(0, -79228162514264337593543950334m), // 1 + 7
+ new TestResult(0, 27703302467091960609331880.532m), // 1 + 8
+ new TestResult(0, -3203853.9559968181492513385018m), // 1 + 9
+ new TestResult(0, -48466870444188873796419.028868m), // 1 + 10
+ new TestResult(0, -545193693242804793.30331374676m), // 1 + 11
+ new TestResult(0, 1.7629234053338741809892531431m), // 1 + 12
+ new TestResult(0, -400453059665371395971.33474452m), // 1 + 13
+ new TestResult(0, 222851627785191714190051.61676m), // 1 + 14
+ new TestResult(0, 14246043379204153213661336.584m), // 1 + 15
+ new TestResult(0, -421122.30446308691436596648186m), // 1 + 16
+ new TestResult(0, 24463288738299546.200508898642m), // 1 + 17
+ new TestResult(0, -5323259153836385912697775.001m), // 1 + 18
+ new TestResult(0, 102801066199805834724673170.19m), // 1 + 19
+ new TestResult(0, 7081320761.3793287174700927968m), // 1 + 20
+ new TestResult(0, 415752273940.77704245656837041m), // 1 + 21
+ new TestResult(0, -6389392489891.6362673670820462m), // 1 + 22
+ new TestResult(0, 442346282742916.0596416330681m), // 1 + 23
+ new TestResult(0, -512833780867322.89020837443764m), // 1 + 24
+ new TestResult(0, 608940580690915705.1450897514m), // 1 + 25
+ new TestResult(0, -42535053313319986966114.037787m), // 1 + 26
+ new TestResult(0, -7808274522591953107484.8812311m), // 1 + 27
+ new TestResult(0, 1037807626804273037330059472.7m), // 1 + 28
+ new TestResult(0, -4997122965.448652425771563042m), // 1 + 29
+ new TestResult(0, -1m), // 2 + 0
+ new TestResult(0, 0m), // 2 + 1
+ new TestResult(0, -2m), // 2 + 2
+ new TestResult(0, 1m), // 2 + 3
+ new TestResult(0, 9m), // 2 + 4
+ new TestResult(0, -0.9m), // 2 + 5
+ new TestResult(0, 79228162514264337593543950334m), // 2 + 6
+ new TestResult(1, 0m), // 2 + 7
+ new TestResult(0, 27703302467091960609331878.532m), // 2 + 8
+ new TestResult(0, -3203855.9559968181492513385018m), // 2 + 9
+ new TestResult(0, -48466870444188873796421.028868m), // 2 + 10
+ new TestResult(0, -545193693242804795.30331374676m), // 2 + 11
+ new TestResult(0, -0.2370765946661258190107468569m), // 2 + 12
+ new TestResult(0, -400453059665371395973.33474452m), // 2 + 13
+ new TestResult(0, 222851627785191714190049.61676m), // 2 + 14
+ new TestResult(0, 14246043379204153213661334.584m), // 2 + 15
+ new TestResult(0, -421124.30446308691436596648186m), // 2 + 16
+ new TestResult(0, 24463288738299544.200508898642m), // 2 + 17
+ new TestResult(0, -5323259153836385912697777.001m), // 2 + 18
+ new TestResult(0, 102801066199805834724673168.19m), // 2 + 19
+ new TestResult(0, 7081320759.3793287174700927968m), // 2 + 20
+ new TestResult(0, 415752273938.77704245656837041m), // 2 + 21
+ new TestResult(0, -6389392489893.6362673670820462m), // 2 + 22
+ new TestResult(0, 442346282742914.0596416330681m), // 2 + 23
+ new TestResult(0, -512833780867324.89020837443764m), // 2 + 24
+ new TestResult(0, 608940580690915703.1450897514m), // 2 + 25
+ new TestResult(0, -42535053313319986966116.037787m), // 2 + 26
+ new TestResult(0, -7808274522591953107486.8812311m), // 2 + 27
+ new TestResult(0, 1037807626804273037330059470.7m), // 2 + 28
+ new TestResult(0, -4997122967.448652425771563042m), // 2 + 29
+ new TestResult(0, 2m), // 3 + 0
+ new TestResult(0, 3m), // 3 + 1
+ new TestResult(0, 1m), // 3 + 2
+ new TestResult(0, 4m), // 3 + 3
+ new TestResult(0, 12m), // 3 + 4
+ new TestResult(0, 2.1m), // 3 + 5
+ new TestResult(1, 0m), // 3 + 6
+ new TestResult(0, -79228162514264337593543950333m), // 3 + 7
+ new TestResult(0, 27703302467091960609331881.532m), // 3 + 8
+ new TestResult(0, -3203852.9559968181492513385018m), // 3 + 9
+ new TestResult(0, -48466870444188873796418.028868m), // 3 + 10
+ new TestResult(0, -545193693242804792.30331374676m), // 3 + 11
+ new TestResult(0, 2.7629234053338741809892531431m), // 3 + 12
+ new TestResult(0, -400453059665371395970.33474452m), // 3 + 13
+ new TestResult(0, 222851627785191714190052.61676m), // 3 + 14
+ new TestResult(0, 14246043379204153213661337.584m), // 3 + 15
+ new TestResult(0, -421121.30446308691436596648186m), // 3 + 16
+ new TestResult(0, 24463288738299547.200508898642m), // 3 + 17
+ new TestResult(0, -5323259153836385912697774.001m), // 3 + 18
+ new TestResult(0, 102801066199805834724673171.19m), // 3 + 19
+ new TestResult(0, 7081320762.3793287174700927968m), // 3 + 20
+ new TestResult(0, 415752273941.77704245656837041m), // 3 + 21
+ new TestResult(0, -6389392489890.6362673670820462m), // 3 + 22
+ new TestResult(0, 442346282742917.0596416330681m), // 3 + 23
+ new TestResult(0, -512833780867321.89020837443764m), // 3 + 24
+ new TestResult(0, 608940580690915706.1450897514m), // 3 + 25
+ new TestResult(0, -42535053313319986966113.037787m), // 3 + 26
+ new TestResult(0, -7808274522591953107483.8812311m), // 3 + 27
+ new TestResult(0, 1037807626804273037330059473.7m), // 3 + 28
+ new TestResult(0, -4997122964.448652425771563042m), // 3 + 29
+ new TestResult(0, 10m), // 4 + 0
+ new TestResult(0, 11m), // 4 + 1
+ new TestResult(0, 9m), // 4 + 2
+ new TestResult(0, 12m), // 4 + 3
+ new TestResult(0, 20m), // 4 + 4
+ new TestResult(0, 10.1m), // 4 + 5
+ new TestResult(1, 0m), // 4 + 6
+ new TestResult(0, -79228162514264337593543950325m), // 4 + 7
+ new TestResult(0, 27703302467091960609331889.532m), // 4 + 8
+ new TestResult(0, -3203844.9559968181492513385018m), // 4 + 9
+ new TestResult(0, -48466870444188873796410.028868m), // 4 + 10
+ new TestResult(0, -545193693242804784.30331374676m), // 4 + 11
+ new TestResult(0, 10.762923405333874180989253143m), // 4 + 12
+ new TestResult(0, -400453059665371395962.33474452m), // 4 + 13
+ new TestResult(0, 222851627785191714190060.61676m), // 4 + 14
+ new TestResult(0, 14246043379204153213661345.584m), // 4 + 15
+ new TestResult(0, -421113.30446308691436596648186m), // 4 + 16
+ new TestResult(0, 24463288738299555.200508898642m), // 4 + 17
+ new TestResult(0, -5323259153836385912697766.001m), // 4 + 18
+ new TestResult(0, 102801066199805834724673179.19m), // 4 + 19
+ new TestResult(0, 7081320770.3793287174700927968m), // 4 + 20
+ new TestResult(0, 415752273949.77704245656837041m), // 4 + 21
+ new TestResult(0, -6389392489882.6362673670820462m), // 4 + 22
+ new TestResult(0, 442346282742925.0596416330681m), // 4 + 23
+ new TestResult(0, -512833780867313.89020837443764m), // 4 + 24
+ new TestResult(0, 608940580690915714.1450897514m), // 4 + 25
+ new TestResult(0, -42535053313319986966105.037787m), // 4 + 26
+ new TestResult(0, -7808274522591953107475.8812311m), // 4 + 27
+ new TestResult(0, 1037807626804273037330059481.7m), // 4 + 28
+ new TestResult(0, -4997122956.448652425771563042m), // 4 + 29
+ new TestResult(0, 0.1m), // 5 + 0
+ new TestResult(0, 1.1m), // 5 + 1
+ new TestResult(0, -0.9m), // 5 + 2
+ new TestResult(0, 2.1m), // 5 + 3
+ new TestResult(0, 10.1m), // 5 + 4
+ new TestResult(0, 0.2m), // 5 + 5
+ new TestResult(2, 79228162514264337593543950335m), // 5 + 6
+ new TestResult(2, -79228162514264337593543950335m), // 5 + 7
+ new TestResult(0, 27703302467091960609331879.632m), // 5 + 8
+ new TestResult(0, -3203854.8559968181492513385018m), // 5 + 9
+ new TestResult(0, -48466870444188873796419.928868m), // 5 + 10
+ new TestResult(0, -545193693242804794.20331374676m), // 5 + 11
+ new TestResult(0, 0.8629234053338741809892531431m), // 5 + 12
+ new TestResult(0, -400453059665371395972.23474452m), // 5 + 13
+ new TestResult(0, 222851627785191714190050.71676m), // 5 + 14
+ new TestResult(0, 14246043379204153213661335.684m), // 5 + 15
+ new TestResult(0, -421123.20446308691436596648186m), // 5 + 16
+ new TestResult(0, 24463288738299545.300508898642m), // 5 + 17
+ new TestResult(0, -5323259153836385912697775.901m), // 5 + 18
+ new TestResult(0, 102801066199805834724673169.29m), // 5 + 19
+ new TestResult(0, 7081320760.4793287174700927968m), // 5 + 20
+ new TestResult(0, 415752273939.87704245656837041m), // 5 + 21
+ new TestResult(0, -6389392489892.5362673670820462m), // 5 + 22
+ new TestResult(0, 442346282742915.1596416330681m), // 5 + 23
+ new TestResult(0, -512833780867323.79020837443764m), // 5 + 24
+ new TestResult(0, 608940580690915704.2450897514m), // 5 + 25
+ new TestResult(0, -42535053313319986966114.937787m), // 5 + 26
+ new TestResult(0, -7808274522591953107485.7812311m), // 5 + 27
+ new TestResult(0, 1037807626804273037330059471.8m), // 5 + 28
+ new TestResult(0, -4997122966.348652425771563042m), // 5 + 29
+ new TestResult(0, 79228162514264337593543950335m), // 6 + 0
+ new TestResult(1, 0m), // 6 + 1
+ new TestResult(0, 79228162514264337593543950334m), // 6 + 2
+ new TestResult(1, 0m), // 6 + 3
+ new TestResult(1, 0m), // 6 + 4
+ new TestResult(0, 79228162514264337593543950335m), // 6 + 5
+ new TestResult(1, 0m), // 6 + 6
+ new TestResult(0, 0m), // 6 + 7
+ new TestResult(1, 0m), // 6 + 8
+ new TestResult(0, 79228162514264337593540746480m), // 6 + 9
+ new TestResult(0, 79228114047393893404670153915m), // 6 + 10
+ new TestResult(0, 79228162513719143900301145541m), // 6 + 11
+ new TestResult(1, 0m), // 6 + 12
+ new TestResult(0, 79228162113811277928172554363m), // 6 + 13
+ new TestResult(1, 0m), // 6 + 14
+ new TestResult(1, 0m), // 6 + 15
+ new TestResult(0, 79228162514264337593543529212m), // 6 + 16
+ new TestResult(1, 0m), // 6 + 17
+ new TestResult(0, 79222839255110501207631252559m), // 6 + 18
+ new TestResult(1, 0m), // 6 + 19
+ new TestResult(1, 0m), // 6 + 20
+ new TestResult(1, 0m), // 6 + 21
+ new TestResult(0, 79228162514264331204151460442m), // 6 + 22
+ new TestResult(1, 0m), // 6 + 23
+ new TestResult(0, 79228162514263824759763083011m), // 6 + 24
+ new TestResult(1, 0m), // 6 + 25
+ new TestResult(0, 79228119979211024273556984220m), // 6 + 26
+ new TestResult(0, 79228154705989815001590842849m), // 6 + 27
+ new TestResult(1, 0m), // 6 + 28
+ new TestResult(0, 79228162514264337588546827369m), // 6 + 29
+ new TestResult(0, -79228162514264337593543950335m), // 7 + 0
+ new TestResult(0, -79228162514264337593543950334m), // 7 + 1
+ new TestResult(1, 0m), // 7 + 2
+ new TestResult(0, -79228162514264337593543950333m), // 7 + 3
+ new TestResult(0, -79228162514264337593543950325m), // 7 + 4
+ new TestResult(0, -79228162514264337593543950335m), // 7 + 5
+ new TestResult(0, 0m), // 7 + 6
+ new TestResult(1, 0m), // 7 + 7
+ new TestResult(0, -79200459211797245632934618455m), // 7 + 8
+ new TestResult(1, 0m), // 7 + 9
+ new TestResult(1, 0m), // 7 + 10
+ new TestResult(1, 0m), // 7 + 11
+ new TestResult(0, -79228162514264337593543950334m), // 7 + 12
+ new TestResult(1, 0m), // 7 + 13
+ new TestResult(0, -79227939662636552401829760284m), // 7 + 14
+ new TestResult(0, -79213916470885133440330288999m), // 7 + 15
+ new TestResult(1, 0m), // 7 + 16
+ new TestResult(0, -79228162514239874304805650790m), // 7 + 17
+ new TestResult(1, 0m), // 7 + 18
+ new TestResult(0, -79125361448064531758819277166m), // 7 + 19
+ new TestResult(0, -79228162514264337586462629575m), // 7 + 20
+ new TestResult(0, -79228162514264337177791676395m), // 7 + 21
+ new TestResult(1, 0m), // 7 + 22
+ new TestResult(0, -79228162514263895247261207420m), // 7 + 23
+ new TestResult(1, 0m), // 7 + 24
+ new TestResult(0, -79228162513655397012853034631m), // 7 + 25
+ new TestResult(1, 0m), // 7 + 26
+ new TestResult(1, 0m), // 7 + 27
+ new TestResult(0, -78190354887460064556213890863m), // 7 + 28
+ new TestResult(1, 0m), // 7 + 29
+ new TestResult(0, 27703302467091960609331879.532m), // 8 + 0
+ new TestResult(0, 27703302467091960609331880.532m), // 8 + 1
+ new TestResult(0, 27703302467091960609331878.532m), // 8 + 2
+ new TestResult(0, 27703302467091960609331881.532m), // 8 + 3
+ new TestResult(0, 27703302467091960609331889.532m), // 8 + 4
+ new TestResult(0, 27703302467091960609331879.632m), // 8 + 5
+ new TestResult(1, 0m), // 8 + 6
+ new TestResult(2, -79200459211797245632934618455m), // 8 + 7
+ new TestResult(0, 55406604934183921218663759.064m), // 8 + 8
+ new TestResult(0, 27703302467091960606128024.576m), // 8 + 9
+ new TestResult(0, 27654835596647771735535459.503m), // 8 + 10
+ new TestResult(0, 27703301921898267366527085.229m), // 8 + 11
+ new TestResult(0, 27703302467091960609331880.295m), // 8 + 12
+ new TestResult(0, 27702902014032295237935907.197m), // 8 + 13
+ new TestResult(0, 27926154094877152323521930.149m), // 8 + 14
+ new TestResult(0, 41949345846296113822993215.116m), // 8 + 15
+ new TestResult(0, 27703302467091960608910756.228m), // 8 + 16
+ new TestResult(0, 27703302491555249347631424.733m), // 8 + 17
+ new TestResult(0, 22380043313255574696634103.531m), // 8 + 18
+ new TestResult(2, 130504368666897795334005048.72m), // 8 + 19
+ new TestResult(0, 27703302467091967690652639.911m), // 8 + 20
+ new TestResult(0, 27703302467092376361605819.309m), // 8 + 21
+ new TestResult(0, 27703302467085571216841986.896m), // 8 + 22
+ new TestResult(0, 27703302467534306892074794.592m), // 8 + 23
+ new TestResult(0, 27703302466579126828464555.642m), // 8 + 24
+ new TestResult(0, 27703303076032541300247583.677m), // 8 + 25
+ new TestResult(0, 27660767413778640622365764.494m), // 8 + 26
+ new TestResult(0, 27695494192569368656224393.651m), // 8 + 27
+ new TestResult(2, 1065510929271364997939391351.2m), // 8 + 28
+ new TestResult(0, 27703302467091955612208913.083m), // 8 + 29
+ new TestResult(0, -3203854.9559968181492513385018m), // 9 + 0
+ new TestResult(0, -3203853.9559968181492513385018m), // 9 + 1
+ new TestResult(0, -3203855.9559968181492513385018m), // 9 + 2
+ new TestResult(0, -3203852.9559968181492513385018m), // 9 + 3
+ new TestResult(0, -3203844.9559968181492513385018m), // 9 + 4
+ new TestResult(0, -3203854.8559968181492513385018m), // 9 + 5
+ new TestResult(2, 79228162514264337593540746480m), // 9 + 6
+ new TestResult(1, 0m), // 9 + 7
+ new TestResult(2, 27703302467091960606128024.576m), // 9 + 8
+ new TestResult(0, -6407709.9119936362985026770036m), // 9 + 9
+ new TestResult(2, -48466870444188877000274.984865m), // 9 + 10
+ new TestResult(2, -545193693246008649.25931056491m), // 9 + 11
+ new TestResult(0, -3203854.1930734128153771575125m), // 9 + 12
+ new TestResult(2, -400453059665374599827.29074134m), // 9 + 13
+ new TestResult(2, 222851627785191710986195.66076m), // 9 + 14
+ new TestResult(2, 14246043379204153210457480.628m), // 9 + 15
+ new TestResult(0, -3624978.2604599050636173049837m), // 9 + 16
+ new TestResult(2, 24463288735095690.244512080493m), // 9 + 17
+ new TestResult(2, -5323259153836385915901630.957m), // 9 + 18
+ new TestResult(2, 102801066199805834721469314.23m), // 9 + 19
+ new TestResult(2, 7078116905.4233318993208414583m), // 9 + 20
+ new TestResult(2, 415749070084.82104563841911907m), // 9 + 21
+ new TestResult(2, -6389395693747.5922641852312975m), // 9 + 22
+ new TestResult(2, 442346279539060.10364481491885m), // 9 + 23
+ new TestResult(2, -512833784071178.84620519258689m), // 9 + 24
+ new TestResult(2, 608940580687711849.18909293325m), // 9 + 25
+ new TestResult(2, -42535053313319990169969.993784m), // 9 + 26
+ new TestResult(2, -7808274522591956311340.8372279m), // 9 + 27
+ new TestResult(2, 1037807626804273037326855616.7m), // 9 + 28
+ new TestResult(2, -5000326821.4046492439208143805m), // 9 + 29
+ new TestResult(0, -48466870444188873796420.028868m), // 10 + 0
+ new TestResult(0, -48466870444188873796419.028868m), // 10 + 1
+ new TestResult(0, -48466870444188873796421.028868m), // 10 + 2
+ new TestResult(0, -48466870444188873796418.028868m), // 10 + 3
+ new TestResult(0, -48466870444188873796410.028868m), // 10 + 4
+ new TestResult(0, -48466870444188873796419.928868m), // 10 + 5
+ new TestResult(2, 79228114047393893404670153915m), // 10 + 6
+ new TestResult(1, 0m), // 10 + 7
+ new TestResult(2, 27654835596647771735535459.503m), // 10 + 8
+ new TestResult(0, -48466870444188877000274.984865m), // 10 + 9
+ new TestResult(2, -96933740888377747592840.05774m), // 10 + 10
+ new TestResult(0, -48467415637882116601214.332182m), // 10 + 11
+ new TestResult(0, -48466870444188873796419.265945m), // 10 + 12
+ new TestResult(0, -48867323503854245192392.363613m), // 10 + 13
+ new TestResult(2, 174384757341002840393630.58789m), // 10 + 14
+ new TestResult(2, 14197576508759964339864915.555m), // 10 + 15
+ new TestResult(0, -48466870444188874217543.333331m), // 10 + 16
+ new TestResult(0, -48466845980900135496874.828359m), // 10 + 17
+ new TestResult(2, -5371726024280574786494196.0299m), // 10 + 18
+ new TestResult(2, 102752599329361645850876749.16m), // 10 + 19
+ new TestResult(0, -48466870444181792475659.649539m), // 10 + 20
+ new TestResult(0, -48466870443773121522480.251826m), // 10 + 21
+ new TestResult(0, -48466870450578266286312.665135m), // 10 + 22
+ new TestResult(0, -48466870001842591053504.969226m), // 10 + 23
+ new TestResult(0, -48466870957022654663743.919076m), // 10 + 24
+ new TestResult(0, -48466261503608182880715.883778m), // 10 + 25
+ new TestResult(2, -91001923757508860762535.06666m), // 10 + 26
+ new TestResult(0, -56275144966780826903905.910099m), // 10 + 27
+ new TestResult(2, 1037759159933828848456263051.7m), // 10 + 28
+ new TestResult(0, -48466870444193870919386.47752m), // 10 + 29
+ new TestResult(0, -545193693242804794.30331374676m), // 11 + 0
+ new TestResult(0, -545193693242804793.30331374676m), // 11 + 1
+ new TestResult(0, -545193693242804795.30331374676m), // 11 + 2
+ new TestResult(0, -545193693242804792.30331374676m), // 11 + 3
+ new TestResult(0, -545193693242804784.30331374676m), // 11 + 4
+ new TestResult(0, -545193693242804794.20331374676m), // 11 + 5
+ new TestResult(2, 79228162513719143900301145541m), // 11 + 6
+ new TestResult(1, 0m), // 11 + 7
+ new TestResult(2, 27703301921898267366527085.229m), // 11 + 8
+ new TestResult(0, -545193693246008649.25931056491m), // 11 + 9
+ new TestResult(2, -48467415637882116601214.332182m), // 11 + 10
+ new TestResult(2, -1090387386485609588.6066274935m), // 11 + 11
+ new TestResult(0, -545193693242804793.54039034143m), // 11 + 12
+ new TestResult(2, -400998253358614200766.63805827m), // 11 + 13
+ new TestResult(2, 222851082591498471385256.31345m), // 11 + 14
+ new TestResult(2, 14246042834010459970856541.281m), // 11 + 15
+ new TestResult(0, -545193693243225917.60777683367m), // 11 + 16
+ new TestResult(0, -520730404504505249.10280484812m), // 11 + 17
+ new TestResult(2, -5323259699030079155502570.3043m), // 11 + 18
+ new TestResult(2, 102801065654612141481868374.89m), // 11 + 19
+ new TestResult(0, -545193686161484033.92398502929m), // 11 + 20
+ new TestResult(0, -545193277490530854.52627129019m), // 11 + 21
+ new TestResult(0, -545200082635294686.93958111384m), // 11 + 22
+ new TestResult(0, -544751346960061879.24367211369m), // 11 + 23
+ new TestResult(0, -545706527023672118.1935221212m), // 11 + 24
+ new TestResult(0, 63746887448110909.84177600464m), // 11 + 25
+ new TestResult(2, -42535598507013229770909.341101m), // 11 + 26
+ new TestResult(2, -7808819716285195912280.1845448m), // 11 + 27
+ new TestResult(2, 1037807626259079344087254677.4m), // 11 + 28
+ new TestResult(0, -545193698239927760.75196617253m), // 11 + 29
+ new TestResult(0, 0.7629234053338741809892531431m), // 12 + 0
+ new TestResult(0, 1.7629234053338741809892531431m), // 12 + 1
+ new TestResult(0, -0.2370765946661258190107468569m), // 12 + 2
+ new TestResult(0, 2.7629234053338741809892531431m), // 12 + 3
+ new TestResult(2, 10.762923405333874180989253143m), // 12 + 4
+ new TestResult(0, 0.8629234053338741809892531431m), // 12 + 5
+ new TestResult(1, 0m), // 12 + 6
+ new TestResult(2, -79228162514264337593543950334m), // 12 + 7
+ new TestResult(2, 27703302467091960609331880.295m), // 12 + 8
+ new TestResult(2, -3203854.1930734128153771575125m), // 12 + 9
+ new TestResult(2, -48466870444188873796419.265945m), // 12 + 10
+ new TestResult(2, -545193693242804793.54039034143m), // 12 + 11
+ new TestResult(0, 1.5258468106677483619785062862m), // 12 + 12
+ new TestResult(2, -400453059665371395971.57182111m), // 12 + 13
+ new TestResult(2, 222851627785191714190051.37968m), // 12 + 14
+ new TestResult(2, 14246043379204153213661336.347m), // 12 + 15
+ new TestResult(2, -421122.54153968158049178549261m), // 12 + 16
+ new TestResult(2, 24463288738299545.963432303976m), // 12 + 17
+ new TestResult(2, -5323259153836385912697775.2381m), // 12 + 18
+ new TestResult(2, 102801066199805834724673169.95m), // 12 + 19
+ new TestResult(2, 7081320761.1422521228039669778m), // 12 + 20
+ new TestResult(2, 415752273940.53996586190224459m), // 12 + 21
+ new TestResult(2, -6389392489891.873343961748172m), // 12 + 22
+ new TestResult(2, 442346282742915.82256503840197m), // 12 + 23
+ new TestResult(2, -512833780867323.12728496910377m), // 12 + 24
+ new TestResult(2, 608940580690915704.90801315673m), // 12 + 25
+ new TestResult(2, -42535053313319986966114.274864m), // 12 + 26
+ new TestResult(2, -7808274522591953107485.1183077m), // 12 + 27
+ new TestResult(2, 1037807626804273037330059472.5m), // 12 + 28
+ new TestResult(2, -4997122965.685729020437688861m), // 12 + 29
+ new TestResult(0, -400453059665371395972.33474452m), // 13 + 0
+ new TestResult(0, -400453059665371395971.33474452m), // 13 + 1
+ new TestResult(0, -400453059665371395973.33474452m), // 13 + 2
+ new TestResult(0, -400453059665371395970.33474452m), // 13 + 3
+ new TestResult(0, -400453059665371395962.33474452m), // 13 + 4
+ new TestResult(0, -400453059665371395972.23474452m), // 13 + 5
+ new TestResult(2, 79228162113811277928172554363m), // 13 + 6
+ new TestResult(1, 0m), // 13 + 7
+ new TestResult(2, 27702902014032295237935907.197m), // 13 + 8
+ new TestResult(0, -400453059665374599827.29074134m), // 13 + 9
+ new TestResult(2, -48867323503854245192392.363613m), // 13 + 10
+ new TestResult(0, -400998253358614200766.63805827m), // 13 + 11
+ new TestResult(0, -400453059665371395971.57182111m), // 13 + 12
+ new TestResult(2, -800906119330742791944.669489m), // 13 + 13
+ new TestResult(2, 222451174725526342794078.28202m), // 13 + 14
+ new TestResult(2, 14245642926144487842265363.249m), // 13 + 15
+ new TestResult(0, -400453059665371817095.63920761m), // 13 + 16
+ new TestResult(0, -400428596376633096427.13423562m), // 13 + 17
+ new TestResult(2, -5323659606896051284093748.3357m), // 13 + 18
+ new TestResult(2, 102800665746746169353277196.86m), // 13 + 19
+ new TestResult(0, -400453059658290075211.9554158m), // 13 + 20
+ new TestResult(0, -400453059249619122032.55770206m), // 13 + 21
+ new TestResult(0, -400453066054763885864.97101189m), // 13 + 22
+ new TestResult(0, -400452617319088653057.27510289m), // 13 + 23
+ new TestResult(0, -400453572499152263296.22495289m), // 13 + 24
+ new TestResult(0, -399844119084680480268.18965477m), // 13 + 25
+ new TestResult(2, -42935506372985358362087.372532m), // 13 + 26
+ new TestResult(2, -8208727582257324503458.215976m), // 13 + 27
+ new TestResult(2, 1037807226351213371958663499.4m), // 13 + 28
+ new TestResult(0, -400453059670368518938.78339695m), // 13 + 29
+ new TestResult(0, 222851627785191714190050.61676m), // 14 + 0
+ new TestResult(0, 222851627785191714190051.61676m), // 14 + 1
+ new TestResult(0, 222851627785191714190049.61676m), // 14 + 2
+ new TestResult(0, 222851627785191714190052.61676m), // 14 + 3
+ new TestResult(0, 222851627785191714190060.61676m), // 14 + 4
+ new TestResult(0, 222851627785191714190050.71676m), // 14 + 5
+ new TestResult(1, 0m), // 14 + 6
+ new TestResult(2, -79227939662636552401829760284m), // 14 + 7
+ new TestResult(2, 27926154094877152323521930.149m), // 14 + 8
+ new TestResult(0, 222851627785191710986195.66076m), // 14 + 9
+ new TestResult(0, 174384757341002840393630.58789m), // 14 + 10
+ new TestResult(0, 222851082591498471385256.31345m), // 14 + 11
+ new TestResult(0, 222851627785191714190051.37968m), // 14 + 12
+ new TestResult(0, 222451174725526342794078.28202m), // 14 + 13
+ new TestResult(0, 445703255570383428380101.23352m), // 14 + 14
+ new TestResult(2, 14468895006989344927851386.201m), // 14 + 15
+ new TestResult(0, 222851627785191713768927.3123m), // 14 + 16
+ new TestResult(0, 222851652248480452489595.81727m), // 14 + 17
+ new TestResult(2, -5100407526051194198507725.3842m), // 14 + 18
+ new TestResult(2, 103023917827591026438863219.81m), // 14 + 19
+ new TestResult(0, 222851627785198795510810.99609m), // 14 + 20
+ new TestResult(0, 222851627785607466463990.3938m), // 14 + 21
+ new TestResult(0, 222851627778802321700157.98049m), // 14 + 22
+ new TestResult(0, 222851628227537996932965.6764m), // 14 + 23
+ new TestResult(0, 222851627272357933322726.72655m), // 14 + 24
+ new TestResult(0, 222852236725772405105754.76185m), // 14 + 25
+ new TestResult(0, 180316574471871727223935.57897m), // 14 + 26
+ new TestResult(0, 215043353262599761082564.73553m), // 14 + 27
+ new TestResult(2, 1038030478432058229044249522.3m), // 14 + 28
+ new TestResult(0, 222851627785186717067084.16811m), // 14 + 29
+ new TestResult(0, 14246043379204153213661335.584m), // 15 + 0
+ new TestResult(0, 14246043379204153213661336.584m), // 15 + 1
+ new TestResult(0, 14246043379204153213661334.584m), // 15 + 2
+ new TestResult(0, 14246043379204153213661337.584m), // 15 + 3
+ new TestResult(0, 14246043379204153213661345.584m), // 15 + 4
+ new TestResult(0, 14246043379204153213661335.684m), // 15 + 5
+ new TestResult(1, 0m), // 15 + 6
+ new TestResult(2, -79213916470885133440330288999m), // 15 + 7
+ new TestResult(0, 41949345846296113822993215.116m), // 15 + 8
+ new TestResult(0, 14246043379204153210457480.628m), // 15 + 9
+ new TestResult(0, 14197576508759964339864915.555m), // 15 + 10
+ new TestResult(0, 14246042834010459970856541.281m), // 15 + 11
+ new TestResult(0, 14246043379204153213661336.347m), // 15 + 12
+ new TestResult(0, 14245642926144487842265363.249m), // 15 + 13
+ new TestResult(0, 14468895006989344927851386.201m), // 15 + 14
+ new TestResult(0, 28492086758408306427322671.168m), // 15 + 15
+ new TestResult(0, 14246043379204153213240212.28m), // 15 + 16
+ new TestResult(0, 14246043403667441951960880.785m), // 15 + 17
+ new TestResult(0, 8922784225367767300963559.583m), // 15 + 18
+ new TestResult(2, 117047109579009987938334504.77m), // 15 + 19
+ new TestResult(0, 14246043379204160294982095.963m), // 15 + 20
+ new TestResult(0, 14246043379204568965935275.361m), // 15 + 21
+ new TestResult(0, 14246043379197763821171442.948m), // 15 + 22
+ new TestResult(0, 14246043379646499496404250.644m), // 15 + 23
+ new TestResult(0, 14246043378691319432794011.694m), // 15 + 24
+ new TestResult(0, 14246043988144733904577039.729m), // 15 + 25
+ new TestResult(0, 14203508325890833226695220.546m), // 15 + 26
+ new TestResult(0, 14238235104681561260553849.703m), // 15 + 27
+ new TestResult(2, 1052053670183477190543720807.3m), // 15 + 28
+ new TestResult(0, 14246043379204148216538369.135m), // 15 + 29
+ new TestResult(0, -421123.30446308691436596648186m), // 16 + 0
+ new TestResult(0, -421122.30446308691436596648186m), // 16 + 1
+ new TestResult(0, -421124.30446308691436596648186m), // 16 + 2
+ new TestResult(0, -421121.30446308691436596648186m), // 16 + 3
+ new TestResult(0, -421113.30446308691436596648186m), // 16 + 4
+ new TestResult(0, -421123.20446308691436596648186m), // 16 + 5
+ new TestResult(2, 79228162514264337593543529212m), // 16 + 6
+ new TestResult(1, 0m), // 16 + 7
+ new TestResult(2, 27703302467091960608910756.228m), // 16 + 8
+ new TestResult(2, -3624978.2604599050636173049837m), // 16 + 9
+ new TestResult(2, -48466870444188874217543.333331m), // 16 + 10
+ new TestResult(2, -545193693243225917.60777683367m), // 16 + 11
+ new TestResult(0, -421122.54153968158049178549261m), // 16 + 12
+ new TestResult(2, -400453059665371817095.63920761m), // 16 + 13
+ new TestResult(2, 222851627785191713768927.3123m), // 16 + 14
+ new TestResult(2, 14246043379204153213240212.28m), // 16 + 15
+ new TestResult(2, -842246.6089261738287319329637m), // 16 + 16
+ new TestResult(2, 24463288737878421.896045811728m), // 16 + 17
+ new TestResult(2, -5323259153836385913118899.3055m), // 16 + 18
+ new TestResult(2, 102801066199805834724252045.89m), // 16 + 19
+ new TestResult(2, 7080899637.0748656305557268303m), // 16 + 20
+ new TestResult(2, 415751852816.47257936965400444m), // 16 + 21
+ new TestResult(2, -6389392911015.9407304539964122m), // 16 + 22
+ new TestResult(2, 442346282321791.75517854615373m), // 16 + 23
+ new TestResult(2, -512833781288447.19467146135201m), // 16 + 24
+ new TestResult(2, 608940580690494580.84062666449m), // 16 + 25
+ new TestResult(2, -42535053313319987387238.34225m), // 16 + 26
+ new TestResult(2, -7808274522591953528609.1856942m), // 16 + 27
+ new TestResult(2, 1037807626804273037329638348.4m), // 16 + 28
+ new TestResult(2, -4997544089.7531155126859290085m), // 16 + 29
+ new TestResult(0, 24463288738299545.200508898642m), // 17 + 0
+ new TestResult(0, 24463288738299546.200508898642m), // 17 + 1
+ new TestResult(0, 24463288738299544.200508898642m), // 17 + 2
+ new TestResult(0, 24463288738299547.200508898642m), // 17 + 3
+ new TestResult(0, 24463288738299555.200508898642m), // 17 + 4
+ new TestResult(0, 24463288738299545.300508898642m), // 17 + 5
+ new TestResult(1, 0m), // 17 + 6
+ new TestResult(2, -79228162514239874304805650790m), // 17 + 7
+ new TestResult(2, 27703302491555249347631424.733m), // 17 + 8
+ new TestResult(0, 24463288735095690.244512080493m), // 17 + 9
+ new TestResult(2, -48466845980900135496874.828359m), // 17 + 10
+ new TestResult(2, -520730404504505249.10280484812m), // 17 + 11
+ new TestResult(0, 24463288738299545.963432303976m), // 17 + 12
+ new TestResult(2, -400428596376633096427.13423562m), // 17 + 13
+ new TestResult(2, 222851652248480452489595.81727m), // 17 + 14
+ new TestResult(2, 14246043403667441951960880.785m), // 17 + 15
+ new TestResult(0, 24463288737878421.896045811728m), // 17 + 16
+ new TestResult(0, 48926577476599090.401017797284m), // 17 + 17
+ new TestResult(2, -5323259129373097174398230.8005m), // 17 + 18
+ new TestResult(2, 102801066224269123462972714.39m), // 17 + 19
+ new TestResult(0, 24463295819620305.579837616112m), // 17 + 20
+ new TestResult(0, 24463704490573484.97755135521m), // 17 + 21
+ new TestResult(0, 24456899345809652.56424153156m), // 17 + 22
+ new TestResult(0, 24905635021042460.26015053171m), // 17 + 23
+ new TestResult(0, 23950454957432221.310300524204m), // 17 + 24
+ new TestResult(2, 633403869429215249.34559865004m), // 17 + 25
+ new TestResult(2, -42535028850031248666569.837278m), // 17 + 26
+ new TestResult(2, -7808250059303214807940.6807222m), // 17 + 27
+ new TestResult(2, 1037807626828736326068359016.9m), // 17 + 28
+ new TestResult(0, 24463283741176578.75185647287m), // 17 + 29
+ new TestResult(0, -5323259153836385912697776.001m), // 18 + 0
+ new TestResult(0, -5323259153836385912697775.001m), // 18 + 1
+ new TestResult(0, -5323259153836385912697777.001m), // 18 + 2
+ new TestResult(0, -5323259153836385912697774.001m), // 18 + 3
+ new TestResult(0, -5323259153836385912697766.001m), // 18 + 4
+ new TestResult(0, -5323259153836385912697775.901m), // 18 + 5
+ new TestResult(2, 79222839255110501207631252559m), // 18 + 6
+ new TestResult(1, 0m), // 18 + 7
+ new TestResult(0, 22380043313255574696634103.531m), // 18 + 8
+ new TestResult(0, -5323259153836385915901630.957m), // 18 + 9
+ new TestResult(0, -5371726024280574786494196.0299m), // 18 + 10
+ new TestResult(0, -5323259699030079155502570.3043m), // 18 + 11
+ new TestResult(0, -5323259153836385912697775.2381m), // 18 + 12
+ new TestResult(0, -5323659606896051284093748.3357m), // 18 + 13
+ new TestResult(0, -5100407526051194198507725.3842m), // 18 + 14
+ new TestResult(0, 8922784225367767300963559.583m), // 18 + 15
+ new TestResult(0, -5323259153836385913118899.3055m), // 18 + 16
+ new TestResult(0, -5323259129373097174398230.8005m), // 18 + 17
+ new TestResult(0, -10646518307672771825395552.002m), // 18 + 18
+ new TestResult(2, 97477807045969448811975393.19m), // 18 + 19
+ new TestResult(0, -5323259153836378831377015.6217m), // 18 + 20
+ new TestResult(0, -5323259153835970160423836.224m), // 18 + 21
+ new TestResult(0, -5323259153842775305187668.6373m), // 18 + 22
+ new TestResult(0, -5323259153394039629954860.9414m), // 18 + 23
+ new TestResult(0, -5323259154349219693565099.8912m), // 18 + 24
+ new TestResult(0, -5323258544895805221782071.8559m), // 18 + 25
+ new TestResult(0, -5365794207149705899663891.0388m), // 18 + 26
+ new TestResult(0, -5331067428358977865805261.8822m), // 18 + 27
+ new TestResult(2, 1032484367650436651417361695.7m), // 18 + 28
+ new TestResult(0, -5323259153836390909820742.4497m), // 18 + 29
+ new TestResult(0, 102801066199805834724673169.19m), // 19 + 0
+ new TestResult(0, 102801066199805834724673170.19m), // 19 + 1
+ new TestResult(0, 102801066199805834724673168.19m), // 19 + 2
+ new TestResult(0, 102801066199805834724673171.19m), // 19 + 3
+ new TestResult(0, 102801066199805834724673179.19m), // 19 + 4
+ new TestResult(0, 102801066199805834724673169.29m), // 19 + 5
+ new TestResult(1, 0m), // 19 + 6
+ new TestResult(2, -79125361448064531758819277166m), // 19 + 7
+ new TestResult(0, 130504368666897795334005048.72m), // 19 + 8
+ new TestResult(0, 102801066199805834721469314.23m), // 19 + 9
+ new TestResult(0, 102752599329361645850876749.16m), // 19 + 10
+ new TestResult(0, 102801065654612141481868374.89m), // 19 + 11
+ new TestResult(0, 102801066199805834724673169.95m), // 19 + 12
+ new TestResult(0, 102800665746746169353277196.86m), // 19 + 13
+ new TestResult(0, 103023917827591026438863219.81m), // 19 + 14
+ new TestResult(0, 117047109579009987938334504.77m), // 19 + 15
+ new TestResult(0, 102801066199805834724252045.89m), // 19 + 16
+ new TestResult(0, 102801066224269123462972714.39m), // 19 + 17
+ new TestResult(0, 97477807045969448811975393.19m), // 19 + 18
+ new TestResult(0, 205602132399611669449346338.38m), // 19 + 19
+ new TestResult(0, 102801066199805841805993929.57m), // 19 + 20
+ new TestResult(0, 102801066199806250476947108.97m), // 19 + 21
+ new TestResult(0, 102801066199799445332183276.55m), // 19 + 22
+ new TestResult(0, 102801066200248181007416084.25m), // 19 + 23
+ new TestResult(0, 102801066199293000943805845.3m), // 19 + 24
+ new TestResult(0, 102801066808746415415588873.34m), // 19 + 25
+ new TestResult(0, 102758531146492514737707054.15m), // 19 + 26
+ new TestResult(0, 102793257925283242771565683.31m), // 19 + 27
+ new TestResult(2, 1140608693004078872054732640.9m), // 19 + 28
+ new TestResult(0, 102801066199805829727550202.74m), // 19 + 29
+ new TestResult(0, 7081320760.3793287174700927968m), // 20 + 0
+ new TestResult(0, 7081320761.3793287174700927968m), // 20 + 1
+ new TestResult(0, 7081320759.3793287174700927968m), // 20 + 2
+ new TestResult(0, 7081320762.3793287174700927968m), // 20 + 3
+ new TestResult(0, 7081320770.3793287174700927968m), // 20 + 4
+ new TestResult(0, 7081320760.4793287174700927968m), // 20 + 5
+ new TestResult(1, 0m), // 20 + 6
+ new TestResult(2, -79228162514264337586462629575m), // 20 + 7
+ new TestResult(2, 27703302467091967690652639.911m), // 20 + 8
+ new TestResult(0, 7078116905.4233318993208414583m), // 20 + 9
+ new TestResult(2, -48466870444181792475659.649539m), // 20 + 10
+ new TestResult(2, -545193686161484033.92398502929m), // 20 + 11
+ new TestResult(0, 7081320761.1422521228039669778m), // 20 + 12
+ new TestResult(2, -400453059658290075211.9554158m), // 20 + 13
+ new TestResult(2, 222851627785198795510810.99609m), // 20 + 14
+ new TestResult(2, 14246043379204160294982095.963m), // 20 + 15
+ new TestResult(0, 7080899637.0748656305557268303m), // 20 + 16
+ new TestResult(2, 24463295819620305.579837616112m), // 20 + 17
+ new TestResult(2, -5323259153836378831377015.6217m), // 20 + 18
+ new TestResult(2, 102801066199805841805993929.57m), // 20 + 19
+ new TestResult(2, 14162641520.758657434940185594m), // 20 + 20
+ new TestResult(2, 422833594700.15637117403846321m), // 20 + 21
+ new TestResult(2, -6382311169132.2569386496119534m), // 20 + 22
+ new TestResult(2, 442353364063675.43897035053819m), // 20 + 23
+ new TestResult(2, -512826699546563.51087965696755m), // 20 + 24
+ new TestResult(2, 608940587772236464.52441846887m), // 20 + 25
+ new TestResult(2, -42535053313312905645354.658458m), // 20 + 26
+ new TestResult(2, -7808274522584871786725.5019024m), // 20 + 27
+ new TestResult(2, 1037807626804273044411380232.1m), // 20 + 28
+ new TestResult(0, 2084197793.9306762916985297548m), // 20 + 29
+ new TestResult(0, 415752273939.77704245656837041m), // 21 + 0
+ new TestResult(0, 415752273940.77704245656837041m), // 21 + 1
+ new TestResult(0, 415752273938.77704245656837041m), // 21 + 2
+ new TestResult(0, 415752273941.77704245656837041m), // 21 + 3
+ new TestResult(0, 415752273949.77704245656837041m), // 21 + 4
+ new TestResult(0, 415752273939.87704245656837041m), // 21 + 5
+ new TestResult(1, 0m), // 21 + 6
+ new TestResult(2, -79228162514264337177791676395m), // 21 + 7
+ new TestResult(2, 27703302467092376361605819.309m), // 21 + 8
+ new TestResult(0, 415749070084.82104563841911907m), // 21 + 9
+ new TestResult(2, -48466870443773121522480.251826m), // 21 + 10
+ new TestResult(2, -545193277490530854.52627129019m), // 21 + 11
+ new TestResult(0, 415752273940.53996586190224459m), // 21 + 12
+ new TestResult(2, -400453059249619122032.55770206m), // 21 + 13
+ new TestResult(2, 222851627785607466463990.3938m), // 21 + 14
+ new TestResult(2, 14246043379204568965935275.361m), // 21 + 15
+ new TestResult(0, 415751852816.47257936965400444m), // 21 + 16
+ new TestResult(2, 24463704490573484.97755135521m), // 21 + 17
+ new TestResult(2, -5323259153835970160423836.224m), // 21 + 18
+ new TestResult(2, 102801066199806250476947108.97m), // 21 + 19
+ new TestResult(0, 422833594700.15637117403846321m), // 21 + 20
+ new TestResult(2, 831504547879.5540849131367408m), // 21 + 21
+ new TestResult(2, -5973640215952.8592249105136758m), // 21 + 22
+ new TestResult(2, 442762035016854.83668408963647m), // 21 + 23
+ new TestResult(2, -512418028593384.11316591786927m), // 21 + 24
+ new TestResult(2, 608940996443189643.92213220797m), // 21 + 25
+ new TestResult(2, -42535053312904234692175.260745m), // 21 + 26
+ new TestResult(2, -7808274522176200833546.1041886m), // 21 + 27
+ new TestResult(2, 1037807626804273453082333411.5m), // 21 + 28
+ new TestResult(0, 410755150973.32839003079680737m), // 21 + 29
+ new TestResult(0, -6389392489892.6362673670820462m), // 22 + 0
+ new TestResult(0, -6389392489891.6362673670820462m), // 22 + 1
+ new TestResult(0, -6389392489893.6362673670820462m), // 22 + 2
+ new TestResult(0, -6389392489890.6362673670820462m), // 22 + 3
+ new TestResult(0, -6389392489882.6362673670820462m), // 22 + 4
+ new TestResult(0, -6389392489892.5362673670820462m), // 22 + 5
+ new TestResult(2, 79228162514264331204151460442m), // 22 + 6
+ new TestResult(1, 0m), // 22 + 7
+ new TestResult(2, 27703302467085571216841986.896m), // 22 + 8
+ new TestResult(0, -6389395693747.5922641852312975m), // 22 + 9
+ new TestResult(2, -48466870450578266286312.665135m), // 22 + 10
+ new TestResult(2, -545200082635294686.93958111384m), // 22 + 11
+ new TestResult(0, -6389392489891.873343961748172m), // 22 + 12
+ new TestResult(2, -400453066054763885864.97101189m), // 22 + 13
+ new TestResult(2, 222851627778802321700157.98049m), // 22 + 14
+ new TestResult(2, 14246043379197763821171442.948m), // 22 + 15
+ new TestResult(0, -6389392911015.9407304539964122m), // 22 + 16
+ new TestResult(2, 24456899345809652.56424153156m), // 22 + 17
+ new TestResult(2, -5323259153842775305187668.6373m), // 22 + 18
+ new TestResult(2, 102801066199799445332183276.55m), // 22 + 19
+ new TestResult(0, -6382311169132.2569386496119534m), // 22 + 20
+ new TestResult(0, -5973640215952.8592249105136758m), // 22 + 21
+ new TestResult(2, -12778784979785.272534734164092m), // 22 + 22
+ new TestResult(2, 435956890253022.42337426598605m), // 22 + 23
+ new TestResult(2, -519223173357216.52647574151969m), // 22 + 24
+ new TestResult(2, 608934191298425811.50882238432m), // 22 + 25
+ new TestResult(2, -42535053319709379456007.674054m), // 22 + 26
+ new TestResult(2, -7808274528981345597378.5174985m), // 22 + 27
+ new TestResult(2, 1037807626804266647937569579.1m), // 22 + 28
+ new TestResult(0, -6394389612859.0849197928536092m), // 22 + 29
+ new TestResult(0, 442346282742915.0596416330681m), // 23 + 0
+ new TestResult(0, 442346282742916.0596416330681m), // 23 + 1
+ new TestResult(0, 442346282742914.0596416330681m), // 23 + 2
+ new TestResult(0, 442346282742917.0596416330681m), // 23 + 3
+ new TestResult(0, 442346282742925.0596416330681m), // 23 + 4
+ new TestResult(0, 442346282742915.1596416330681m), // 23 + 5
+ new TestResult(1, 0m), // 23 + 6
+ new TestResult(2, -79228162514263895247261207420m), // 23 + 7
+ new TestResult(2, 27703302467534306892074794.592m), // 23 + 8
+ new TestResult(0, 442346279539060.10364481491885m), // 23 + 9
+ new TestResult(2, -48466870001842591053504.969226m), // 23 + 10
+ new TestResult(2, -544751346960061879.24367211369m), // 23 + 11
+ new TestResult(0, 442346282742915.82256503840197m), // 23 + 12
+ new TestResult(2, -400452617319088653057.27510289m), // 23 + 13
+ new TestResult(2, 222851628227537996932965.6764m), // 23 + 14
+ new TestResult(2, 14246043379646499496404250.644m), // 23 + 15
+ new TestResult(0, 442346282321791.75517854615373m), // 23 + 16
+ new TestResult(2, 24905635021042460.26015053171m), // 23 + 17
+ new TestResult(2, -5323259153394039629954860.9414m), // 23 + 18
+ new TestResult(2, 102801066200248181007416084.25m), // 23 + 19
+ new TestResult(0, 442353364063675.43897035053819m), // 23 + 20
+ new TestResult(0, 442762035016854.83668408963647m), // 23 + 21
+ new TestResult(0, 435956890253022.42337426598605m), // 23 + 22
+ new TestResult(0, 884692565485830.1192832661362m), // 23 + 23
+ new TestResult(0, -70487498124408.83056674136954m), // 23 + 24
+ new TestResult(2, 609382926973658619.20473138447m), // 23 + 25
+ new TestResult(2, -42535052870973704223199.978145m), // 23 + 26
+ new TestResult(2, -7808274080245670364570.8215895m), // 23 + 27
+ new TestResult(2, 1037807626804715383612802386.8m), // 23 + 28
+ new TestResult(0, 442341285619948.61098920729654m), // 23 + 29
+ new TestResult(0, -512833780867323.89020837443764m), // 24 + 0
+ new TestResult(0, -512833780867322.89020837443764m), // 24 + 1
+ new TestResult(0, -512833780867324.89020837443764m), // 24 + 2
+ new TestResult(0, -512833780867321.89020837443764m), // 24 + 3
+ new TestResult(0, -512833780867313.89020837443764m), // 24 + 4
+ new TestResult(0, -512833780867323.79020837443764m), // 24 + 5
+ new TestResult(2, 79228162514263824759763083011m), // 24 + 6
+ new TestResult(1, 0m), // 24 + 7
+ new TestResult(2, 27703302466579126828464555.642m), // 24 + 8
+ new TestResult(0, -512833784071178.84620519258689m), // 24 + 9
+ new TestResult(2, -48466870957022654663743.919076m), // 24 + 10
+ new TestResult(2, -545706527023672118.1935221212m), // 24 + 11
+ new TestResult(0, -512833780867323.12728496910377m), // 24 + 12
+ new TestResult(2, -400453572499152263296.22495289m), // 24 + 13
+ new TestResult(2, 222851627272357933322726.72655m), // 24 + 14
+ new TestResult(2, 14246043378691319432794011.694m), // 24 + 15
+ new TestResult(0, -512833781288447.19467146135201m), // 24 + 16
+ new TestResult(2, 23950454957432221.310300524204m), // 24 + 17
+ new TestResult(2, -5323259154349219693565099.8912m), // 24 + 18
+ new TestResult(2, 102801066199293000943805845.3m), // 24 + 19
+ new TestResult(0, -512826699546563.51087965696755m), // 24 + 20
+ new TestResult(0, -512418028593384.11316591786927m), // 24 + 21
+ new TestResult(0, -519223173357216.52647574151969m), // 24 + 22
+ new TestResult(0, -70487498124408.83056674136954m), // 24 + 23
+ new TestResult(2, -1025667561734647.7804167488753m), // 24 + 24
+ new TestResult(2, 608427746910048380.25488137696m), // 24 + 25
+ new TestResult(2, -42535053826153767833438.927995m), // 24 + 26
+ new TestResult(2, -7808275035425733974809.7714395m), // 24 + 27
+ new TestResult(2, 1037807626803760203549192147.8m), // 24 + 28
+ new TestResult(0, -512838777990290.3388608002092m), // 24 + 29
+ new TestResult(0, 608940580690915704.1450897514m), // 25 + 0
+ new TestResult(0, 608940580690915705.1450897514m), // 25 + 1
+ new TestResult(0, 608940580690915703.1450897514m), // 25 + 2
+ new TestResult(0, 608940580690915706.1450897514m), // 25 + 3
+ new TestResult(0, 608940580690915714.1450897514m), // 25 + 4
+ new TestResult(0, 608940580690915704.2450897514m), // 25 + 5
+ new TestResult(1, 0m), // 25 + 6
+ new TestResult(2, -79228162513655397012853034631m), // 25 + 7
+ new TestResult(2, 27703303076032541300247583.677m), // 25 + 8
+ new TestResult(0, 608940580687711849.18909293325m), // 25 + 9
+ new TestResult(2, -48466261503608182880715.883778m), // 25 + 10
+ new TestResult(0, 63746887448110909.84177600464m), // 25 + 11
+ new TestResult(0, 608940580690915704.90801315673m), // 25 + 12
+ new TestResult(2, -399844119084680480268.18965477m), // 25 + 13
+ new TestResult(2, 222852236725772405105754.76185m), // 25 + 14
+ new TestResult(2, 14246043988144733904577039.729m), // 25 + 15
+ new TestResult(0, 608940580690494580.84062666449m), // 25 + 16
+ new TestResult(0, 633403869429215249.34559865004m), // 25 + 17
+ new TestResult(2, -5323258544895805221782071.8559m), // 25 + 18
+ new TestResult(2, 102801066808746415415588873.34m), // 25 + 19
+ new TestResult(0, 608940587772236464.52441846887m), // 25 + 20
+ new TestResult(0, 608940996443189643.92213220797m), // 25 + 21
+ new TestResult(0, 608934191298425811.50882238432m), // 25 + 22
+ new TestResult(0, 609382926973658619.20473138447m), // 25 + 23
+ new TestResult(0, 608427746910048380.25488137696m), // 25 + 24
+ new TestResult(0, 1217881161381831408.2901795028m), // 25 + 25
+ new TestResult(2, -42534444372739296050410.892697m), // 25 + 26
+ new TestResult(2, -7807665582011262191781.7361413m), // 25 + 27
+ new TestResult(2, 1037807627413213618020975175.8m), // 25 + 28
+ new TestResult(0, 608940575693792737.69643732563m), // 25 + 29
+ new TestResult(0, -42535053313319986966115.037787m), // 26 + 0
+ new TestResult(0, -42535053313319986966114.037787m), // 26 + 1
+ new TestResult(0, -42535053313319986966116.037787m), // 26 + 2
+ new TestResult(0, -42535053313319986966113.037787m), // 26 + 3
+ new TestResult(0, -42535053313319986966105.037787m), // 26 + 4
+ new TestResult(0, -42535053313319986966114.937787m), // 26 + 5
+ new TestResult(2, 79228119979211024273556984220m), // 26 + 6
+ new TestResult(1, 0m), // 26 + 7
+ new TestResult(2, 27660767413778640622365764.494m), // 26 + 8
+ new TestResult(0, -42535053313319990169969.993784m), // 26 + 9
+ new TestResult(2, -91001923757508860762535.06666m), // 26 + 10
+ new TestResult(0, -42535598507013229770909.341101m), // 26 + 11
+ new TestResult(0, -42535053313319986966114.274864m), // 26 + 12
+ new TestResult(0, -42935506372985358362087.372532m), // 26 + 13
+ new TestResult(2, 180316574471871727223935.57897m), // 26 + 14
+ new TestResult(2, 14203508325890833226695220.546m), // 26 + 15
+ new TestResult(0, -42535053313319987387238.34225m), // 26 + 16
+ new TestResult(0, -42535028850031248666569.837278m), // 26 + 17
+ new TestResult(2, -5365794207149705899663891.0388m), // 26 + 18
+ new TestResult(2, 102758531146492514737707054.15m), // 26 + 19
+ new TestResult(0, -42535053313312905645354.658458m), // 26 + 20
+ new TestResult(0, -42535053312904234692175.260745m), // 26 + 21
+ new TestResult(0, -42535053319709379456007.674054m), // 26 + 22
+ new TestResult(0, -42535052870973704223199.978145m), // 26 + 23
+ new TestResult(0, -42535053826153767833438.927995m), // 26 + 24
+ new TestResult(0, -42534444372739296050410.892697m), // 26 + 25
+ new TestResult(2, -85070106626639973932230.07557m), // 26 + 26
+ new TestResult(0, -50343327835911940073600.919018m), // 26 + 27
+ new TestResult(2, 1037765091750959717343093356.7m), // 26 + 28
+ new TestResult(0, -42535053313324984089081.486439m), // 26 + 29
+ new TestResult(0, -7808274522591953107485.8812311m), // 27 + 0
+ new TestResult(0, -7808274522591953107484.8812311m), // 27 + 1
+ new TestResult(0, -7808274522591953107486.8812311m), // 27 + 2
+ new TestResult(0, -7808274522591953107483.8812311m), // 27 + 3
+ new TestResult(0, -7808274522591953107475.8812311m), // 27 + 4
+ new TestResult(0, -7808274522591953107485.7812311m), // 27 + 5
+ new TestResult(2, 79228154705989815001590842849m), // 27 + 6
+ new TestResult(1, 0m), // 27 + 7
+ new TestResult(2, 27695494192569368656224393.651m), // 27 + 8
+ new TestResult(0, -7808274522591956311340.8372279m), // 27 + 9
+ new TestResult(2, -56275144966780826903905.910099m), // 27 + 10
+ new TestResult(0, -7808819716285195912280.1845448m), // 27 + 11
+ new TestResult(0, -7808274522591953107485.1183077m), // 27 + 12
+ new TestResult(2, -8208727582257324503458.215976m), // 27 + 13
+ new TestResult(2, 215043353262599761082564.73553m), // 27 + 14
+ new TestResult(2, 14238235104681561260553849.703m), // 27 + 15
+ new TestResult(0, -7808274522591953528609.1856942m), // 27 + 16
+ new TestResult(0, -7808250059303214807940.6807222m), // 27 + 17
+ new TestResult(2, -5331067428358977865805261.8822m), // 27 + 18
+ new TestResult(2, 102793257925283242771565683.31m), // 27 + 19
+ new TestResult(0, -7808274522584871786725.5019024m), // 27 + 20
+ new TestResult(0, -7808274522176200833546.1041886m), // 27 + 21
+ new TestResult(0, -7808274528981345597378.5174985m), // 27 + 22
+ new TestResult(0, -7808274080245670364570.8215895m), // 27 + 23
+ new TestResult(0, -7808275035425733974809.7714395m), // 27 + 24
+ new TestResult(0, -7807665582011262191781.7361413m), // 27 + 25
+ new TestResult(2, -50343327835911940073600.919018m), // 27 + 26
+ new TestResult(2, -15616549045183906214971.762462m), // 27 + 27
+ new TestResult(2, 1037799818529750445376951985.8m), // 27 + 28
+ new TestResult(0, -7808274522596950230452.3298835m), // 27 + 29
+ new TestResult(0, 1037807626804273037330059471.7m), // 28 + 0
+ new TestResult(0, 1037807626804273037330059472.7m), // 28 + 1
+ new TestResult(0, 1037807626804273037330059470.7m), // 28 + 2
+ new TestResult(0, 1037807626804273037330059473.7m), // 28 + 3
+ new TestResult(0, 1037807626804273037330059481.7m), // 28 + 4
+ new TestResult(0, 1037807626804273037330059471.8m), // 28 + 5
+ new TestResult(1, 0m), // 28 + 6
+ new TestResult(2, -78190354887460064556213890863m), // 28 + 7
+ new TestResult(0, 1065510929271364997939391351.2m), // 28 + 8
+ new TestResult(0, 1037807626804273037326855616.7m), // 28 + 9
+ new TestResult(0, 1037759159933828848456263051.7m), // 28 + 10
+ new TestResult(0, 1037807626259079344087254677.4m), // 28 + 11
+ new TestResult(0, 1037807626804273037330059472.5m), // 28 + 12
+ new TestResult(0, 1037807226351213371958663499.4m), // 28 + 13
+ new TestResult(0, 1038030478432058229044249522.3m), // 28 + 14
+ new TestResult(0, 1052053670183477190543720807.3m), // 28 + 15
+ new TestResult(0, 1037807626804273037329638348.4m), // 28 + 16
+ new TestResult(0, 1037807626828736326068359016.9m), // 28 + 17
+ new TestResult(0, 1032484367650436651417361695.7m), // 28 + 18
+ new TestResult(0, 1140608693004078872054732640.9m), // 28 + 19
+ new TestResult(0, 1037807626804273044411380232.1m), // 28 + 20
+ new TestResult(0, 1037807626804273453082333411.5m), // 28 + 21
+ new TestResult(0, 1037807626804266647937569579.1m), // 28 + 22
+ new TestResult(0, 1037807626804715383612802386.8m), // 28 + 23
+ new TestResult(0, 1037807626803760203549192147.8m), // 28 + 24
+ new TestResult(0, 1037807627413213618020975175.8m), // 28 + 25
+ new TestResult(0, 1037765091750959717343093356.7m), // 28 + 26
+ new TestResult(0, 1037799818529750445376951985.8m), // 28 + 27
+ new TestResult(0, 2075615253608546074660118943.4m), // 28 + 28
+ new TestResult(0, 1037807626804273032332936505.3m), // 28 + 29
+ new TestResult(0, -4997122966.448652425771563042m), // 29 + 0
+ new TestResult(0, -4997122965.448652425771563042m), // 29 + 1
+ new TestResult(0, -4997122967.448652425771563042m), // 29 + 2
+ new TestResult(0, -4997122964.448652425771563042m), // 29 + 3
+ new TestResult(0, -4997122956.448652425771563042m), // 29 + 4
+ new TestResult(0, -4997122966.348652425771563042m), // 29 + 5
+ new TestResult(2, 79228162514264337588546827369m), // 29 + 6
+ new TestResult(1, 0m), // 29 + 7
+ new TestResult(2, 27703302467091955612208913.083m), // 29 + 8
+ new TestResult(0, -5000326821.4046492439208143805m), // 29 + 9
+ new TestResult(2, -48466870444193870919386.47752m), // 29 + 10
+ new TestResult(2, -545193698239927760.75196617253m), // 29 + 11
+ new TestResult(0, -4997122965.685729020437688861m), // 29 + 12
+ new TestResult(2, -400453059670368518938.78339695m), // 29 + 13
+ new TestResult(2, 222851627785186717067084.16811m), // 29 + 14
+ new TestResult(2, 14246043379204148216538369.135m), // 29 + 15
+ new TestResult(0, -4997544089.7531155126859290085m), // 29 + 16
+ new TestResult(2, 24463283741176578.75185647287m), // 29 + 17
+ new TestResult(2, -5323259153836390909820742.4497m), // 29 + 18
+ new TestResult(2, 102801066199805829727550202.74m), // 29 + 19
+ new TestResult(0, 2084197793.9306762916985297548m), // 29 + 20
+ new TestResult(2, 410755150973.32839003079680737m), // 29 + 21
+ new TestResult(2, -6394389612859.0849197928536092m), // 29 + 22
+ new TestResult(2, 442341285619948.61098920729654m), // 29 + 23
+ new TestResult(2, -512838777990290.3388608002092m), // 29 + 24
+ new TestResult(2, 608940575693792737.69643732563m), // 29 + 25
+ new TestResult(2, -42535053313324984089081.486439m), // 29 + 26
+ new TestResult(2, -7808274522596950230452.3298835m), // 29 + 27
+ new TestResult(2, 1037807626804273032332936505.3m), // 29 + 28
+ new TestResult(0, -9994245932.897304851543126084m), // 29 + 29
+ };
+
+
+ // generated result list build2
+ TestResult[] trAuto_Mult_build2 = new TestResult[] {
+ new TestResult(0, 0m), // 0 * 0
+ new TestResult(0, 0m), // 0 * 1
+ new TestResult(0, 0m), // 0 * 2
+ new TestResult(0, 0m), // 0 * 3
+ new TestResult(0, 0m), // 0 * 4
+ new TestResult(0, 0m), // 0 * 5
+ new TestResult(0, 0m), // 0 * 6
+ new TestResult(0, 0m), // 0 * 7
+ new TestResult(0, 0m), // 0 * 8
+ new TestResult(0, 0m), // 0 * 9
+ new TestResult(0, 0m), // 0 * 10
+ new TestResult(0, 0m), // 0 * 11
+ new TestResult(0, 0m), // 0 * 12
+ new TestResult(0, 0m), // 0 * 13
+ new TestResult(0, 0m), // 0 * 14
+ new TestResult(0, 0m), // 0 * 15
+ new TestResult(0, 0m), // 0 * 16
+ new TestResult(0, 0m), // 0 * 17
+ new TestResult(0, 0m), // 0 * 18
+ new TestResult(0, 0m), // 0 * 19
+ new TestResult(0, 0m), // 0 * 20
+ new TestResult(0, 0m), // 0 * 21
+ new TestResult(0, 0m), // 0 * 22
+ new TestResult(0, 0m), // 0 * 23
+ new TestResult(0, 0m), // 0 * 24
+ new TestResult(0, 0m), // 0 * 25
+ new TestResult(0, 0m), // 0 * 26
+ new TestResult(0, 0m), // 0 * 27
+ new TestResult(0, 0m), // 0 * 28
+ new TestResult(0, 0m), // 0 * 29
+ new TestResult(0, 0m), // 1 * 0
+ new TestResult(0, 1m), // 1 * 1
+ new TestResult(0, -1m), // 1 * 2
+ new TestResult(0, 2m), // 1 * 3
+ new TestResult(0, 10m), // 1 * 4
+ new TestResult(0, 0.1m), // 1 * 5
+ new TestResult(0, 79228162514264337593543950335m), // 1 * 6
+ new TestResult(0, -79228162514264337593543950335m), // 1 * 7
+ new TestResult(0, 27703302467091960609331879.532m), // 1 * 8
+ new TestResult(0, -3203854.9559968181492513385018m), // 1 * 9
+ new TestResult(0, -48466870444188873796420.028868m), // 1 * 10
+ new TestResult(0, -545193693242804794.30331374676m), // 1 * 11
+ new TestResult(0, 0.7629234053338741809892531431m), // 1 * 12
+ new TestResult(0, -400453059665371395972.33474452m), // 1 * 13
+ new TestResult(0, 222851627785191714190050.61676m), // 1 * 14
+ new TestResult(0, 14246043379204153213661335.584m), // 1 * 15
+ new TestResult(0, -421123.30446308691436596648186m), // 1 * 16
+ new TestResult(0, 24463288738299545.200508898642m), // 1 * 17
+ new TestResult(0, -5323259153836385912697776.001m), // 1 * 18
+ new TestResult(0, 102801066199805834724673169.19m), // 1 * 19
+ new TestResult(0, 7081320760.3793287174700927968m), // 1 * 20
+ new TestResult(0, 415752273939.77704245656837041m), // 1 * 21
+ new TestResult(0, -6389392489892.6362673670820462m), // 1 * 22
+ new TestResult(0, 442346282742915.0596416330681m), // 1 * 23
+ new TestResult(0, -512833780867323.89020837443764m), // 1 * 24
+ new TestResult(0, 608940580690915704.1450897514m), // 1 * 25
+ new TestResult(0, -42535053313319986966115.037787m), // 1 * 26
+ new TestResult(0, -7808274522591953107485.8812311m), // 1 * 27
+ new TestResult(0, 1037807626804273037330059471.7m), // 1 * 28
+ new TestResult(0, -4997122966.448652425771563042m), // 1 * 29
+ new TestResult(0, 0m), // 2 * 0
+ new TestResult(0, -1m), // 2 * 1
+ new TestResult(0, 1m), // 2 * 2
+ new TestResult(0, -2m), // 2 * 3
+ new TestResult(0, -10m), // 2 * 4
+ new TestResult(0, -0.1m), // 2 * 5
+ new TestResult(0, -79228162514264337593543950335m), // 2 * 6
+ new TestResult(0, 79228162514264337593543950335m), // 2 * 7
+ new TestResult(0, -27703302467091960609331879.532m), // 2 * 8
+ new TestResult(0, 3203854.9559968181492513385018m), // 2 * 9
+ new TestResult(0, 48466870444188873796420.028868m), // 2 * 10
+ new TestResult(0, 545193693242804794.30331374676m), // 2 * 11
+ new TestResult(0, -0.7629234053338741809892531431m), // 2 * 12
+ new TestResult(0, 400453059665371395972.33474452m), // 2 * 13
+ new TestResult(0, -222851627785191714190050.61676m), // 2 * 14
+ new TestResult(0, -14246043379204153213661335.584m), // 2 * 15
+ new TestResult(0, 421123.30446308691436596648186m), // 2 * 16
+ new TestResult(0, -24463288738299545.200508898642m), // 2 * 17
+ new TestResult(0, 5323259153836385912697776.001m), // 2 * 18
+ new TestResult(0, -102801066199805834724673169.19m), // 2 * 19
+ new TestResult(0, -7081320760.3793287174700927968m), // 2 * 20
+ new TestResult(0, -415752273939.77704245656837041m), // 2 * 21
+ new TestResult(0, 6389392489892.6362673670820462m), // 2 * 22
+ new TestResult(0, -442346282742915.0596416330681m), // 2 * 23
+ new TestResult(0, 512833780867323.89020837443764m), // 2 * 24
+ new TestResult(0, -608940580690915704.1450897514m), // 2 * 25
+ new TestResult(0, 42535053313319986966115.037787m), // 2 * 26
+ new TestResult(0, 7808274522591953107485.8812311m), // 2 * 27
+ new TestResult(0, -1037807626804273037330059471.7m), // 2 * 28
+ new TestResult(0, 4997122966.448652425771563042m), // 2 * 29
+ new TestResult(0, 0m), // 3 * 0
+ new TestResult(0, 2m), // 3 * 1
+ new TestResult(0, -2m), // 3 * 2
+ new TestResult(0, 4m), // 3 * 3
+ new TestResult(0, 20m), // 3 * 4
+ new TestResult(0, 0.2m), // 3 * 5
+ new TestResult(1, 0m), // 3 * 6
+ new TestResult(1, 0m), // 3 * 7
+ new TestResult(0, 55406604934183921218663759.064m), // 3 * 8
+ new TestResult(0, -6407709.9119936362985026770036m), // 3 * 9
+ new TestResult(2, -96933740888377747592840.05774m), // 3 * 10
+ new TestResult(0, -1090387386485609588.6066274935m), // 3 * 11
+ new TestResult(0, 1.5258468106677483619785062862m), // 3 * 12
+ new TestResult(2, -800906119330742791944.669489m), // 3 * 13
+ new TestResult(0, 445703255570383428380101.23352m), // 3 * 14
+ new TestResult(0, 28492086758408306427322671.168m), // 3 * 15
+ new TestResult(0, -842246.6089261738287319329637m), // 3 * 16
+ new TestResult(0, 48926577476599090.401017797284m), // 3 * 17
+ new TestResult(0, -10646518307672771825395552.002m), // 3 * 18
+ new TestResult(0, 205602132399611669449346338.38m), // 3 * 19
+ new TestResult(2, 14162641520.758657434940185594m), // 3 * 20
+ new TestResult(0, 831504547879.5540849131367408m), // 3 * 21
+ new TestResult(2, -12778784979785.272534734164092m), // 3 * 22
+ new TestResult(0, 884692565485830.1192832661362m), // 3 * 23
+ new TestResult(0, -1025667561734647.7804167488753m), // 3 * 24
+ new TestResult(0, 1217881161381831408.2901795028m), // 3 * 25
+ new TestResult(2, -85070106626639973932230.07557m), // 3 * 26
+ new TestResult(0, -15616549045183906214971.762462m), // 3 * 27
+ new TestResult(0, 2075615253608546074660118943.4m), // 3 * 28
+ new TestResult(0, -9994245932.897304851543126084m), // 3 * 29
+ new TestResult(0, 0m), // 4 * 0
+ new TestResult(0, 10m), // 4 * 1
+ new TestResult(0, -10m), // 4 * 2
+ new TestResult(0, 20m), // 4 * 3
+ new TestResult(0, 100m), // 4 * 4
+ new TestResult(0, 1m), // 4 * 5
+ new TestResult(1, 0m), // 4 * 6
+ new TestResult(1, 0m), // 4 * 7
+ new TestResult(0, 277033024670919606093318795.32m), // 4 * 8
+ new TestResult(0, -32038549.559968181492513385018m), // 4 * 9
+ new TestResult(0, -484668704441888737964200.28868m), // 4 * 10
+ new TestResult(0, -5451936932428047943.0331374676m), // 4 * 11
+ new TestResult(0, 7.629234053338741809892531431m), // 4 * 12
+ new TestResult(0, -4004530596653713959723.3474452m), // 4 * 13
+ new TestResult(0, 2228516277851917141900506.1676m), // 4 * 14
+ new TestResult(0, 142460433792041532136613355.84m), // 4 * 15
+ new TestResult(0, -4211233.0446308691436596648186m), // 4 * 16
+ new TestResult(0, 244632887382995452.00508898642m), // 4 * 17
+ new TestResult(0, -53232591538363859126977760.01m), // 4 * 18
+ new TestResult(0, 1028010661998058347246731691.9m), // 4 * 19
+ new TestResult(0, 70813207603.793287174700927968m), // 4 * 20
+ new TestResult(0, 4157522739397.7704245656837041m), // 4 * 21
+ new TestResult(0, -63893924898926.362673670820462m), // 4 * 22
+ new TestResult(0, 4423462827429150.596416330681m), // 4 * 23
+ new TestResult(0, -5128337808673238.9020837443764m), // 4 * 24
+ new TestResult(0, 6089405806909157041.450897514m), // 4 * 25
+ new TestResult(0, -425350533133199869661150.37787m), // 4 * 26
+ new TestResult(0, -78082745225919531074858.812311m), // 4 * 27
+ new TestResult(0, 10378076268042730373300594717m), // 4 * 28
+ new TestResult(0, -49971229664.48652425771563042m), // 4 * 29
+ new TestResult(0, 0m), // 5 * 0
+ new TestResult(0, 0.1m), // 5 * 1
+ new TestResult(0, -0.1m), // 5 * 2
+ new TestResult(0, 0.2m), // 5 * 3
+ new TestResult(0, 1m), // 5 * 4
+ new TestResult(0, 0.01m), // 5 * 5
+ new TestResult(0, 7922816251426433759354395033.5m), // 5 * 6
+ new TestResult(0, -7922816251426433759354395033.5m), // 5 * 7
+ new TestResult(0, 2770330246709196060933187.9532m), // 5 * 8
+ new TestResult(0, -320385.49559968181492513385018m), // 5 * 9
+ new TestResult(0, -4846687044418887379642.0028868m), // 5 * 10
+ new TestResult(0, -54519369324280479.430331374676m), // 5 * 11
+ new TestResult(0, 0.0762923405333874180989253143m), // 5 * 12
+ new TestResult(0, -40045305966537139597.233474452m), // 5 * 13
+ new TestResult(0, 22285162778519171419005.061676m), // 5 * 14
+ new TestResult(0, 1424604337920415321366133.5584m), // 5 * 15
+ new TestResult(0, -42112.330446308691436596648186m), // 5 * 16
+ new TestResult(0, 2446328873829954.5200508898642m), // 5 * 17
+ new TestResult(0, -532325915383638591269777.6001m), // 5 * 18
+ new TestResult(0, 10280106619980583472467316.919m), // 5 * 19
+ new TestResult(0, 708132076.03793287174700927968m), // 5 * 20
+ new TestResult(0, 41575227393.977704245656837041m), // 5 * 21
+ new TestResult(0, -638939248989.26362673670820462m), // 5 * 22
+ new TestResult(0, 44234628274291.50596416330681m), // 5 * 23
+ new TestResult(0, -51283378086732.389020837443764m), // 5 * 24
+ new TestResult(0, 60894058069091570.41450897514m), // 5 * 25
+ new TestResult(0, -4253505331331998696611.5037787m), // 5 * 26
+ new TestResult(0, -780827452259195310748.58812311m), // 5 * 27
+ new TestResult(0, 103780762680427303733005947.17m), // 5 * 28
+ new TestResult(0, -499712296.6448652425771563042m), // 5 * 29
+ new TestResult(0, 0m), // 6 * 0
+ new TestResult(0, 79228162514264337593543950335m), // 6 * 1
+ new TestResult(0, -79228162514264337593543950335m), // 6 * 2
+ new TestResult(1, 0m), // 6 * 3
+ new TestResult(1, 0m), // 6 * 4
+ new TestResult(0, 7922816251426433759354395033.5m), // 6 * 5
+ new TestResult(1, 0m), // 6 * 6
+ new TestResult(1, 0m), // 6 * 7
+ new TestResult(1, 0m), // 6 * 8
+ new TestResult(1, 0m), // 6 * 9
+ new TestResult(1, 0m), // 6 * 10
+ new TestResult(1, 0m), // 6 * 11
+ new TestResult(4, 60445019543728147377669509413m), // 6 * 12
+ new TestResult(1, 0m), // 6 * 13
+ new TestResult(1, 0m), // 6 * 14
+ new TestResult(1, 0m), // 6 * 15
+ new TestResult(1, 0m), // 6 * 16
+ new TestResult(1, 0m), // 6 * 17
+ new TestResult(1, 0m), // 6 * 18
+ new TestResult(1, 0m), // 6 * 19
+ new TestResult(1, 0m), // 6 * 20
+ new TestResult(1, 0m), // 6 * 21
+ new TestResult(1, 0m), // 6 * 22
+ new TestResult(1, 0m), // 6 * 23
+ new TestResult(1, 0m), // 6 * 24
+ new TestResult(1, 0m), // 6 * 25
+ new TestResult(1, 0m), // 6 * 26
+ new TestResult(1, 0m), // 6 * 27
+ new TestResult(1, 0m), // 6 * 28
+ new TestResult(1, 0m), // 6 * 29
+ new TestResult(0, 0m), // 7 * 0
+ new TestResult(0, -79228162514264337593543950335m), // 7 * 1
+ new TestResult(0, 79228162514264337593543950335m), // 7 * 2
+ new TestResult(1, 0m), // 7 * 3
+ new TestResult(1, 0m), // 7 * 4
+ new TestResult(0, -7922816251426433759354395033.5m), // 7 * 5
+ new TestResult(1, 0m), // 7 * 6
+ new TestResult(1, 0m), // 7 * 7
+ new TestResult(1, 0m), // 7 * 8
+ new TestResult(1, 0m), // 7 * 9
+ new TestResult(1, 0m), // 7 * 10
+ new TestResult(1, 0m), // 7 * 11
+ new TestResult(4, -60445019543728147377669509413m), // 7 * 12
+ new TestResult(1, 0m), // 7 * 13
+ new TestResult(1, 0m), // 7 * 14
+ new TestResult(1, 0m), // 7 * 15
+ new TestResult(1, 0m), // 7 * 16
+ new TestResult(1, 0m), // 7 * 17
+ new TestResult(1, 0m), // 7 * 18
+ new TestResult(1, 0m), // 7 * 19
+ new TestResult(1, 0m), // 7 * 20
+ new TestResult(1, 0m), // 7 * 21
+ new TestResult(1, 0m), // 7 * 22
+ new TestResult(1, 0m), // 7 * 23
+ new TestResult(1, 0m), // 7 * 24
+ new TestResult(1, 0m), // 7 * 25
+ new TestResult(1, 0m), // 7 * 26
+ new TestResult(1, 0m), // 7 * 27
+ new TestResult(1, 0m), // 7 * 28
+ new TestResult(1, 0m), // 7 * 29
+ new TestResult(0, 0m), // 8 * 0
+ new TestResult(0, 27703302467091960609331879.532m), // 8 * 1
+ new TestResult(0, -27703302467091960609331879.532m), // 8 * 2
+ new TestResult(0, 55406604934183921218663759.064m), // 8 * 3
+ new TestResult(0, 277033024670919606093318795.32m), // 8 * 4
+ new TestResult(0, 2770330246709196060933187.9532m), // 8 * 5
+ new TestResult(1, 0m), // 8 * 6
+ new TestResult(1, 0m), // 8 * 7
+ new TestResult(1, 0m), // 8 * 8
+ new TestResult(1, 0m), // 8 * 9
+ new TestResult(1, 0m), // 8 * 10
+ new TestResult(1, 0m), // 8 * 11
+ new TestResult(2, 21135497857188116458095236.68m), // 8 * 12
+ new TestResult(1, 0m), // 8 * 13
+ new TestResult(1, 0m), // 8 * 14
+ new TestResult(1, 0m), // 8 * 15
+ new TestResult(1, 0m), // 8 * 16
+ new TestResult(1, 0m), // 8 * 17
+ new TestResult(1, 0m), // 8 * 18
+ new TestResult(1, 0m), // 8 * 19
+ new TestResult(1, 0m), // 8 * 20
+ new TestResult(1, 0m), // 8 * 21
+ new TestResult(1, 0m), // 8 * 22
+ new TestResult(1, 0m), // 8 * 23
+ new TestResult(1, 0m), // 8 * 24
+ new TestResult(1, 0m), // 8 * 25
+ new TestResult(1, 0m), // 8 * 26
+ new TestResult(1, 0m), // 8 * 27
+ new TestResult(1, 0m), // 8 * 28
+ new TestResult(1, 0m), // 8 * 29
+ new TestResult(0, 0m), // 9 * 0
+ new TestResult(0, -3203854.9559968181492513385018m), // 9 * 1
+ new TestResult(0, 3203854.9559968181492513385018m), // 9 * 2
+ new TestResult(0, -6407709.9119936362985026770036m), // 9 * 3
+ new TestResult(0, -32038549.559968181492513385018m), // 9 * 4
+ new TestResult(0, -320385.49559968181492513385018m), // 9 * 5
+ new TestResult(1, 0m), // 9 * 6
+ new TestResult(1, 0m), // 9 * 7
+ new TestResult(1, 0m), // 9 * 8
+ new TestResult(2, 10264686579065.373559419307221m), // 9 * 9
+ new TestResult(1, 0m), // 9 * 10
+ new TestResult(2, 1746721516074169126608222.1692m), // 9 * 11
+ new TestResult(2, -2444295.933224902121034426698m), // 9 * 12
+ new TestResult(2, 1282993519852989666698903060.5m), // 9 * 13
+ new TestResult(1, 0m), // 9 * 14
+ new TestResult(1, 0m), // 9 * 15
+ new TestResult(0, 1349217986089.8179781485646335m), // 9 * 16
+ new TestResult(0, -78376828864182146369609.767831m), // 9 * 17
+ new TestResult(1, 0m), // 9 * 18
+ new TestResult(1, 0m), // 9 * 19
+ new TestResult(0, -22687524613144469.045656755412m), // 9 * 20
+ new TestResult(0, -1332009983328901461.3254059884m), // 9 * 21
+ new TestResult(0, 20470686794551372519.831909846m), // 9 * 22
+ new TestResult(0, -1417213330232658207868.9685141m), // 9 * 23
+ new TestResult(0, 1643045050434361863551.7087135m), // 9 * 24
+ new TestResult(0, -1950957297354170624860913.7855m), // 9 * 25
+ new TestResult(1, 0m), // 9 * 26
+ new TestResult(0, 25016579026989918165002777574m), // 9 * 27
+ new TestResult(1, 0m), // 9 * 28
+ new TestResult(2, 16010057181782036.694377696165m), // 9 * 29
+ new TestResult(0, 0m), // 10 * 0
+ new TestResult(0, -48466870444188873796420.028868m), // 10 * 1
+ new TestResult(0, 48466870444188873796420.028868m), // 10 * 2
+ new TestResult(2, -96933740888377747592840.05774m), // 10 * 3
+ new TestResult(0, -484668704441888737964200.28868m), // 10 * 4
+ new TestResult(0, -4846687044418887379642.0028868m), // 10 * 5
+ new TestResult(1, 0m), // 10 * 6
+ new TestResult(1, 0m), // 10 * 7
+ new TestResult(1, 0m), // 10 * 8
+ new TestResult(1, 0m), // 10 * 9
+ new TestResult(1, 0m), // 10 * 10
+ new TestResult(1, 0m), // 10 * 11
+ new TestResult(0, -36976509845156274734545.845161m), // 10 * 12
+ new TestResult(1, 0m), // 10 * 13
+ new TestResult(1, 0m), // 10 * 14
+ new TestResult(1, 0m), // 10 * 15
+ new TestResult(2, 20410528638441139616161910791m), // 10 * 16
+ new TestResult(1, 0m), // 10 * 17
+ new TestResult(1, 0m), // 10 * 18
+ new TestResult(1, 0m), // 10 * 19
+ new TestResult(1, 0m), // 10 * 20
+ new TestResult(1, 0m), // 10 * 21
+ new TestResult(1, 0m), // 10 * 22
+ new TestResult(1, 0m), // 10 * 23
+ new TestResult(1, 0m), // 10 * 24
+ new TestResult(1, 0m), // 10 * 25
+ new TestResult(1, 0m), // 10 * 26
+ new TestResult(1, 0m), // 10 * 27
+ new TestResult(1, 0m), // 10 * 28
+ new TestResult(1, 0m), // 10 * 29
+ new TestResult(0, 0m), // 11 * 0
+ new TestResult(0, -545193693242804794.30331374676m), // 11 * 1
+ new TestResult(0, 545193693242804794.30331374676m), // 11 * 2
+ new TestResult(2, -1090387386485609588.6066274935m), // 11 * 3
+ new TestResult(0, -5451936932428047943.0331374676m), // 11 * 4
+ new TestResult(0, -54519369324280479.430331374676m), // 11 * 5
+ new TestResult(1, 0m), // 11 * 6
+ new TestResult(1, 0m), // 11 * 7
+ new TestResult(1, 0m), // 11 * 8
+ new TestResult(2, 1746721516074169126608222.1692m), // 11 * 9
+ new TestResult(1, 0m), // 11 * 10
+ new TestResult(1, 0m), // 11 * 11
+ new TestResult(0, -415941029015352223.2321562927m), // 11 * 12
+ new TestResult(1, 0m), // 11 * 13
+ new TestResult(1, 0m), // 11 * 14
+ new TestResult(1, 0m), // 11 * 15
+ new TestResult(0, 229593769670844494339647.60593m), // 11 * 16
+ new TestResult(1, 0m), // 11 * 17
+ new TestResult(1, 0m), // 11 * 18
+ new TestResult(1, 0m), // 11 * 19
+ new TestResult(0, -3860691418388152934958161711.9m), // 11 * 20
+ new TestResult(1, 0m), // 11 * 21
+ new TestResult(1, 0m), // 11 * 22
+ new TestResult(1, 0m), // 11 * 23
+ new TestResult(1, 0m), // 11 * 24
+ new TestResult(1, 0m), // 11 * 25
+ new TestResult(1, 0m), // 11 * 26
+ new TestResult(1, 0m), // 11 * 27
+ new TestResult(1, 0m), // 11 * 28
+ new TestResult(2, 2724399925666581324856736883m), // 11 * 29
+ new TestResult(0, 0m), // 12 * 0
+ new TestResult(0, 0.7629234053338741809892531431m), // 12 * 1
+ new TestResult(0, -0.7629234053338741809892531431m), // 12 * 2
+ new TestResult(0, 1.5258468106677483619785062862m), // 12 * 3
+ new TestResult(0, 7.629234053338741809892531431m), // 12 * 4
+ new TestResult(2, 0.0762923405333874180989253143m), // 12 * 5
+ new TestResult(0, 60445019543728147377669509413m), // 12 * 6
+ new TestResult(0, -60445019543728147377669509413m), // 12 * 7
+ new TestResult(0, 21135497857188116458095236.68m), // 12 * 8
+ new TestResult(0, -2444295.933224902121034426698m), // 12 * 9
+ new TestResult(0, -36976509845156274734545.845161m), // 12 * 10
+ new TestResult(0, -415941029015352223.2321562927m), // 12 * 11
+ new TestResult(0, 0.5820521224062348791152865214m), // 12 * 12
+ new TestResult(0, -305515011956274243325.23330625m), // 12 * 13
+ new TestResult(0, 170018722754075475876563.00661m), // 12 * 14
+ new TestResult(0, 10868639927396524825477357.557m), // 12 * 15
+ new TestResult(0, -321284.82550643216389212760083m), // 12 * 16
+ new TestResult(0, 18663615549889303.426127037208m), // 12 * 17
+ new TestResult(0, -4061239001119573143590088.0528m), // 12 * 18
+ new TestResult(0, 78429339497108899549297058.831m), // 12 * 19
+ new TestResult(0, 5402505348.7700567259404098662m), // 12 * 20
+ new TestResult(0, 317187140609.43641612785737895m), // 12 * 21
+ new TestResult(0, -4874617076403.5713301079734445m), // 12 * 22
+ new TestResult(0, 337476332367005.49979200414696m), // 12 * 23
+ new TestResult(0, -391252894469544.55412631906773m), // 12 * 24
+ new TestResult(0, 464575021466700199.22364418475m), // 12 * 25
+ new TestResult(0, -32450987719855972399063.033158m), // 12 * 26
+ new TestResult(0, -5957115388557583551533.0994303m), // 12 * 27
+ new TestResult(0, 791767728722982425613218218.59m), // 12 * 28
+ new TestResult(0, -3812422070.43511700405678157m), // 12 * 29
+ new TestResult(0, 0m), // 13 * 0
+ new TestResult(0, -400453059665371395972.33474452m), // 13 * 1
+ new TestResult(0, 400453059665371395972.33474452m), // 13 * 2
+ new TestResult(2, -800906119330742791944.669489m), // 13 * 3
+ new TestResult(0, -4004530596653713959723.3474452m), // 13 * 4
+ new TestResult(0, -40045305966537139597.233474452m), // 13 * 5
+ new TestResult(1, 0m), // 13 * 6
+ new TestResult(1, 0m), // 13 * 7
+ new TestResult(1, 0m), // 13 * 8
+ new TestResult(2, 1282993519852989666698903060.5m), // 13 * 9
+ new TestResult(1, 0m), // 13 * 10
+ new TestResult(1, 0m), // 13 * 11
+ new TestResult(0, -305515011956274243325.23330625m), // 13 * 12
+ new TestResult(1, 0m), // 13 * 13
+ new TestResult(1, 0m), // 13 * 14
+ new TestResult(1, 0m), // 13 * 15
+ new TestResult(2, 168640115768634908407809010.03m), // 13 * 16
+ new TestResult(1, 0m), // 13 * 17
+ new TestResult(1, 0m), // 13 * 18
+ new TestResult(1, 0m), // 13 * 19
+ new TestResult(1, 0m), // 13 * 20
+ new TestResult(1, 0m), // 13 * 21
+ new TestResult(1, 0m), // 13 * 22
+ new TestResult(1, 0m), // 13 * 23
+ new TestResult(1, 0m), // 13 * 24
+ new TestResult(1, 0m), // 13 * 25
+ new TestResult(1, 0m), // 13 * 26
+ new TestResult(1, 0m), // 13 * 27
+ new TestResult(1, 0m), // 13 * 28
+ new TestResult(1, 0m), // 13 * 29
+ new TestResult(0, 0m), // 14 * 0
+ new TestResult(0, 222851627785191714190050.61676m), // 14 * 1
+ new TestResult(0, -222851627785191714190050.61676m), // 14 * 2
+ new TestResult(0, 445703255570383428380101.23352m), // 14 * 3
+ new TestResult(0, 2228516277851917141900506.1676m), // 14 * 4
+ new TestResult(0, 22285162778519171419005.061676m), // 14 * 5
+ new TestResult(1, 0m), // 14 * 6
+ new TestResult(1, 0m), // 14 * 7
+ new TestResult(1, 0m), // 14 * 8
+ new TestResult(1, 0m), // 14 * 9
+ new TestResult(1, 0m), // 14 * 10
+ new TestResult(1, 0m), // 14 * 11
+ new TestResult(0, 170018722754075475876563.00661m), // 14 * 12
+ new TestResult(1, 0m), // 14 * 13
+ new TestResult(1, 0m), // 14 * 14
+ new TestResult(1, 0m), // 14 * 15
+ new TestResult(1, 0m), // 14 * 16
+ new TestResult(1, 0m), // 14 * 17
+ new TestResult(1, 0m), // 14 * 18
+ new TestResult(1, 0m), // 14 * 19
+ new TestResult(1, 0m), // 14 * 20
+ new TestResult(1, 0m), // 14 * 21
+ new TestResult(1, 0m), // 14 * 22
+ new TestResult(1, 0m), // 14 * 23
+ new TestResult(1, 0m), // 14 * 24
+ new TestResult(1, 0m), // 14 * 25
+ new TestResult(1, 0m), // 14 * 26
+ new TestResult(1, 0m), // 14 * 27
+ new TestResult(1, 0m), // 14 * 28
+ new TestResult(1, 0m), // 14 * 29
+ new TestResult(0, 0m), // 15 * 0
+ new TestResult(0, 14246043379204153213661335.584m), // 15 * 1
+ new TestResult(0, -14246043379204153213661335.584m), // 15 * 2
+ new TestResult(0, 28492086758408306427322671.168m), // 15 * 3
+ new TestResult(0, 142460433792041532136613355.84m), // 15 * 4
+ new TestResult(0, 1424604337920415321366133.5584m), // 15 * 5
+ new TestResult(1, 0m), // 15 * 6
+ new TestResult(1, 0m), // 15 * 7
+ new TestResult(1, 0m), // 15 * 8
+ new TestResult(1, 0m), // 15 * 9
+ new TestResult(1, 0m), // 15 * 10
+ new TestResult(1, 0m), // 15 * 11
+ new TestResult(0, 10868639927396524825477357.557m), // 15 * 12
+ new TestResult(1, 0m), // 15 * 13
+ new TestResult(1, 0m), // 15 * 14
+ new TestResult(1, 0m), // 15 * 15
+ new TestResult(1, 0m), // 15 * 16
+ new TestResult(1, 0m), // 15 * 17
+ new TestResult(1, 0m), // 15 * 18
+ new TestResult(1, 0m), // 15 * 19
+ new TestResult(1, 0m), // 15 * 20
+ new TestResult(1, 0m), // 15 * 21
+ new TestResult(1, 0m), // 15 * 22
+ new TestResult(1, 0m), // 15 * 23
+ new TestResult(1, 0m), // 15 * 24
+ new TestResult(1, 0m), // 15 * 25
+ new TestResult(1, 0m), // 15 * 26
+ new TestResult(1, 0m), // 15 * 27
+ new TestResult(1, 0m), // 15 * 28
+ new TestResult(1, 0m), // 15 * 29
+ new TestResult(0, 0m), // 16 * 0
+ new TestResult(0, -421123.30446308691436596648186m), // 16 * 1
+ new TestResult(0, 421123.30446308691436596648186m), // 16 * 2
+ new TestResult(2, -842246.6089261738287319329637m), // 16 * 3
+ new TestResult(0, -4211233.0446308691436596648186m), // 16 * 4
+ new TestResult(0, -42112.330446308691436596648186m), // 16 * 5
+ new TestResult(1, 0m), // 16 * 6
+ new TestResult(1, 0m), // 16 * 7
+ new TestResult(1, 0m), // 16 * 8
+ new TestResult(0, 1349217986089.8179781485646335m), // 16 * 9
+ new TestResult(2, 20410528638441139616161910791m), // 16 * 10
+ new TestResult(0, 229593769670844494339647.60593m), // 16 * 11
+ new TestResult(0, -321284.82550643216389212760083m), // 16 * 12
+ new TestResult(2, 168640115768634908407809010.03m), // 16 * 13
+ new TestResult(1, 0m), // 16 * 14
+ new TestResult(1, 0m), // 16 * 15
+ new TestResult(2, 177344837561.90979904837123025m), // 16 * 16
+ new TestResult(2, -10302060991507324713598.483586m), // 16 * 17
+ new TestResult(1, 0m), // 16 * 18
+ new TestResult(1, 0m), // 16 * 19
+ new TestResult(2, -2982109198574002.1833628108505m), // 16 * 20
+ new TestResult(2, -175082971439561442.82206371811m), // 16 * 21
+ new TestResult(2, 2690722078855217643.0013135833m), // 16 * 22
+ new TestResult(2, -186282328305659347664.31347679m), // 16 * 23
+ new TestResult(2, 215966256439146035447.16512997m), // 16 * 24
+ new TestResult(0, -256439069562229438659442.67473m), // 16 * 25
+ new TestResult(2, 17912502206818886711664532432m), // 16 * 26
+ new TestResult(0, 3288246369108855691627019039.6m), // 16 * 27
+ new TestResult(1, 0m), // 16 * 28
+ new TestResult(2, 2104404936439239.9111285468803m), // 16 * 29
+ new TestResult(0, 0m), // 17 * 0
+ new TestResult(0, 24463288738299545.200508898642m), // 17 * 1
+ new TestResult(0, -24463288738299545.200508898642m), // 17 * 2
+ new TestResult(0, 48926577476599090.401017797284m), // 17 * 3
+ new TestResult(0, 244632887382995452.00508898642m), // 17 * 4
+ new TestResult(0, 2446328873829954.5200508898642m), // 17 * 5
+ new TestResult(1, 0m), // 17 * 6
+ new TestResult(1, 0m), // 17 * 7
+ new TestResult(1, 0m), // 17 * 8
+ new TestResult(0, -78376828864182146369609.767831m), // 17 * 9
+ new TestResult(1, 0m), // 17 * 10
+ new TestResult(1, 0m), // 17 * 11
+ new TestResult(0, 18663615549889303.426127037208m), // 17 * 12
+ new TestResult(1, 0m), // 17 * 13
+ new TestResult(1, 0m), // 17 * 14
+ new TestResult(1, 0m), // 17 * 15
+ new TestResult(2, -10302060991507324713598.483586m), // 17 * 16
+ new TestResult(1, 0m), // 17 * 17
+ new TestResult(1, 0m), // 17 * 18
+ new TestResult(1, 0m), // 17 * 19
+ new TestResult(0, 173232394409674404469121757.58m), // 17 * 20
+ new TestResult(2, 10170667920993375211218037940m), // 17 * 21
+ new TestResult(1, 0m), // 17 * 22
+ new TestResult(1, 0m), // 17 * 23
+ new TestResult(1, 0m), // 17 * 24
+ new TestResult(1, 0m), // 17 * 25
+ new TestResult(1, 0m), // 17 * 26
+ new TestResult(1, 0m), // 17 * 27
+ new TestResult(1, 0m), // 17 * 28
+ new TestResult(0, -122246061989021334943606343.1m), // 17 * 29
+ new TestResult(0, 0m), // 18 * 0
+ new TestResult(0, -5323259153836385912697776.001m), // 18 * 1
+ new TestResult(0, 5323259153836385912697776.001m), // 18 * 2
+ new TestResult(0, -10646518307672771825395552.002m), // 18 * 3
+ new TestResult(0, -53232591538363859126977760.01m), // 18 * 4
+ new TestResult(0, -532325915383638591269777.6001m), // 18 * 5
+ new TestResult(1, 0m), // 18 * 6
+ new TestResult(1, 0m), // 18 * 7
+ new TestResult(1, 0m), // 18 * 8
+ new TestResult(1, 0m), // 18 * 9
+ new TestResult(1, 0m), // 18 * 10
+ new TestResult(1, 0m), // 18 * 11
+ new TestResult(2, -4061239001119573143590088.0528m), // 18 * 12
+ new TestResult(1, 0m), // 18 * 13
+ new TestResult(1, 0m), // 18 * 14
+ new TestResult(1, 0m), // 18 * 15
+ new TestResult(1, 0m), // 18 * 16
+ new TestResult(1, 0m), // 18 * 17
+ new TestResult(1, 0m), // 18 * 18
+ new TestResult(1, 0m), // 18 * 19
+ new TestResult(1, 0m), // 18 * 20
+ new TestResult(1, 0m), // 18 * 21
+ new TestResult(1, 0m), // 18 * 22
+ new TestResult(1, 0m), // 18 * 23
+ new TestResult(1, 0m), // 18 * 24
+ new TestResult(1, 0m), // 18 * 25
+ new TestResult(1, 0m), // 18 * 26
+ new TestResult(1, 0m), // 18 * 27
+ new TestResult(1, 0m), // 18 * 28
+ new TestResult(1, 0m), // 18 * 29
+ new TestResult(0, 0m), // 19 * 0
+ new TestResult(0, 102801066199805834724673169.19m), // 19 * 1
+ new TestResult(0, -102801066199805834724673169.19m), // 19 * 2
+ new TestResult(0, 205602132399611669449346338.38m), // 19 * 3
+ new TestResult(0, 1028010661998058347246731691.9m), // 19 * 4
+ new TestResult(0, 10280106619980583472467316.919m), // 19 * 5
+ new TestResult(1, 0m), // 19 * 6
+ new TestResult(1, 0m), // 19 * 7
+ new TestResult(1, 0m), // 19 * 8
+ new TestResult(1, 0m), // 19 * 9
+ new TestResult(1, 0m), // 19 * 10
+ new TestResult(1, 0m), // 19 * 11
+ new TestResult(0, 78429339497108899549297058.831m), // 19 * 12
+ new TestResult(1, 0m), // 19 * 13
+ new TestResult(1, 0m), // 19 * 14
+ new TestResult(1, 0m), // 19 * 15
+ new TestResult(1, 0m), // 19 * 16
+ new TestResult(1, 0m), // 19 * 17
+ new TestResult(1, 0m), // 19 * 18
+ new TestResult(1, 0m), // 19 * 19
+ new TestResult(1, 0m), // 19 * 20
+ new TestResult(1, 0m), // 19 * 21
+ new TestResult(1, 0m), // 19 * 22
+ new TestResult(1, 0m), // 19 * 23
+ new TestResult(1, 0m), // 19 * 24
+ new TestResult(1, 0m), // 19 * 25
+ new TestResult(1, 0m), // 19 * 26
+ new TestResult(1, 0m), // 19 * 27
+ new TestResult(1, 0m), // 19 * 28
+ new TestResult(1, 0m), // 19 * 29
+ new TestResult(0, 0m), // 20 * 0
+ new TestResult(0, 7081320760.3793287174700927968m), // 20 * 1
+ new TestResult(0, -7081320760.3793287174700927968m), // 20 * 2
+ new TestResult(2, 14162641520.758657434940185594m), // 20 * 3
+ new TestResult(0, 70813207603.793287174700927968m), // 20 * 4
+ new TestResult(0, 708132076.03793287174700927968m), // 20 * 5
+ new TestResult(1, 0m), // 20 * 6
+ new TestResult(1, 0m), // 20 * 7
+ new TestResult(1, 0m), // 20 * 8
+ new TestResult(0, -22687524613144469.045656755412m), // 20 * 9
+ new TestResult(1, 0m), // 20 * 10
+ new TestResult(0, -3860691418388152934958161711.9m), // 20 * 11
+ new TestResult(0, 5402505348.7700567259404098662m), // 20 * 12
+ new TestResult(1, 0m), // 20 * 13
+ new TestResult(1, 0m), // 20 * 14
+ new TestResult(1, 0m), // 20 * 15
+ new TestResult(2, -2982109198574002.1833628108505m), // 20 * 16
+ new TestResult(2, 173232394409674404469121757.58m), // 20 * 17
+ new TestResult(1, 0m), // 20 * 18
+ new TestResult(1, 0m), // 20 * 19
+ new TestResult(0, 50145103711379274243.914175878m), // 20 * 20
+ new TestResult(2, 2944075208624656937377.9493098m), // 20 * 21
+ new TestResult(0, -45245337684888495429839.445203m), // 20 * 22
+ new TestResult(2, 3132395915264028802867467.4171m), // 20 * 23
+ new TestResult(2, -3631540499079604049748263.216m), // 20 * 24
+ new TestResult(0, 4312103575884025168661620716.9m), // 20 * 25
+ new TestResult(1, 0m), // 20 * 26
+ new TestResult(1, 0m), // 20 * 27
+ new TestResult(1, 0m), // 20 * 28
+ new TestResult(2, -35386230604481178142.543841269m), // 20 * 29
+ new TestResult(0, 0m), // 21 * 0
+ new TestResult(0, 415752273939.77704245656837041m), // 21 * 1
+ new TestResult(0, -415752273939.77704245656837041m), // 21 * 2
+ new TestResult(2, 831504547879.5540849131367408m), // 21 * 3
+ new TestResult(0, 4157522739397.7704245656837041m), // 21 * 4
+ new TestResult(0, 41575227393.977704245656837041m), // 21 * 5
+ new TestResult(1, 0m), // 21 * 6
+ new TestResult(1, 0m), // 21 * 7
+ new TestResult(1, 0m), // 21 * 8
+ new TestResult(2, -1332009983328901461.3254059884m), // 21 * 9
+ new TestResult(1, 0m), // 21 * 10
+ new TestResult(1, 0m), // 21 * 11
+ new TestResult(0, 317187140609.43641612785737895m), // 21 * 12
+ new TestResult(1, 0m), // 21 * 13
+ new TestResult(1, 0m), // 21 * 14
+ new TestResult(1, 0m), // 21 * 15
+ new TestResult(2, -175082971439561442.82206371811m), // 21 * 16
+ new TestResult(2, 10170667920993375211218037940m), // 21 * 17
+ new TestResult(1, 0m), // 21 * 18
+ new TestResult(1, 0m), // 21 * 19
+ new TestResult(2, 2944075208624656937377.9493098m), // 21 * 20
+ new TestResult(2, 172849953286095412912252.49708m), // 21 * 21
+ new TestResult(2, -2656404456766597431365611.212m), // 21 * 22
+ new TestResult(0, 183906472919174492029733196.17m), // 21 * 23
+ new TestResult(0, -213211810548723232636647639.7m), // 21 * 24
+ new TestResult(1, 0m), // 21 * 25
+ new TestResult(1, 0m), // 21 * 26
+ new TestResult(1, 0m), // 21 * 27
+ new TestResult(1, 0m), // 21 * 28
+ new TestResult(0, -2077565236457711426002.3992246m), // 21 * 29
+ new TestResult(0, 0m), // 22 * 0
+ new TestResult(0, -6389392489892.6362673670820462m), // 22 * 1
+ new TestResult(0, 6389392489892.6362673670820462m), // 22 * 2
+ new TestResult(2, -12778784979785.272534734164092m), // 22 * 3
+ new TestResult(0, -63893924898926.362673670820462m), // 22 * 4
+ new TestResult(0, -638939248989.26362673670820462m), // 22 * 5
+ new TestResult(1, 0m), // 22 * 6
+ new TestResult(1, 0m), // 22 * 7
+ new TestResult(1, 0m), // 22 * 8
+ new TestResult(2, 20470686794551372519.831909846m), // 22 * 9
+ new TestResult(1, 0m), // 22 * 10
+ new TestResult(1, 0m), // 22 * 11
+ new TestResult(0, -4874617076403.5713301079734445m), // 22 * 12
+ new TestResult(1, 0m), // 22 * 13
+ new TestResult(1, 0m), // 22 * 14
+ new TestResult(1, 0m), // 22 * 15
+ new TestResult(2, 2690722078855217643.0013135833m), // 22 * 16
+ new TestResult(1, 0m), // 22 * 17
+ new TestResult(1, 0m), // 22 * 18
+ new TestResult(1, 0m), // 22 * 19
+ new TestResult(0, -45245337684888495429839.445203m), // 22 * 20
+ new TestResult(2, -2656404456766597431365611.212m), // 22 * 21
+ new TestResult(2, 40824336389896422046045259.169m), // 22 * 22
+ new TestResult(2, -2826324016889506134750576955.1m), // 22 * 23
+ new TestResult(2, 3276696308036925201560804370m), // 22 * 24
+ new TestResult(1, 0m), // 22 * 25
+ new TestResult(1, 0m), // 22 * 26
+ new TestResult(1, 0m), // 22 * 27
+ new TestResult(1, 0m), // 22 * 28
+ new TestResult(2, 31928579952897032005741.500403m), // 22 * 29
+ new TestResult(0, 0m), // 23 * 0
+ new TestResult(0, 442346282742915.0596416330681m), // 23 * 1
+ new TestResult(0, -442346282742915.0596416330681m), // 23 * 2
+ new TestResult(0, 884692565485830.1192832661362m), // 23 * 3
+ new TestResult(0, 4423462827429150.596416330681m), // 23 * 4
+ new TestResult(0, 44234628274291.50596416330681m), // 23 * 5
+ new TestResult(1, 0m), // 23 * 6
+ new TestResult(1, 0m), // 23 * 7
+ new TestResult(1, 0m), // 23 * 8
+ new TestResult(2, -1417213330232658207868.9685141m), // 23 * 9
+ new TestResult(1, 0m), // 23 * 10
+ new TestResult(1, 0m), // 23 * 11
+ new TestResult(2, 337476332367005.49979200414696m), // 23 * 12
+ new TestResult(1, 0m), // 23 * 13
+ new TestResult(1, 0m), // 23 * 14
+ new TestResult(1, 0m), // 23 * 15
+ new TestResult(2, -186282328305659347664.31347679m), // 23 * 16
+ new TestResult(1, 0m), // 23 * 17
+ new TestResult(1, 0m), // 23 * 18
+ new TestResult(1, 0m), // 23 * 19
+ new TestResult(2, 3132395915264028802867467.4171m), // 23 * 20
+ new TestResult(0, 183906472919174492029733196.17m), // 23 * 21
+ new TestResult(2, -2826324016889506134750576955.1m), // 23 * 22
+ new TestResult(1, 0m), // 23 * 23
+ new TestResult(1, 0m), // 23 * 24
+ new TestResult(1, 0m), // 23 * 25
+ new TestResult(1, 0m), // 23 * 26
+ new TestResult(1, 0m), // 23 * 27
+ new TestResult(1, 0m), // 23 * 28
+ new TestResult(2, -2210458768617810051106106.871m), // 23 * 29
+ new TestResult(0, 0m), // 24 * 0
+ new TestResult(0, -512833780867323.89020837443764m), // 24 * 1
+ new TestResult(0, 512833780867323.89020837443764m), // 24 * 2
+ new TestResult(2, -1025667561734647.7804167488753m), // 24 * 3
+ new TestResult(0, -5128337808673238.9020837443764m), // 24 * 4
+ new TestResult(0, -51283378086732.389020837443764m), // 24 * 5
+ new TestResult(1, 0m), // 24 * 6
+ new TestResult(1, 0m), // 24 * 7
+ new TestResult(1, 0m), // 24 * 8
+ new TestResult(0, 1643045050434361863551.7087135m), // 24 * 9
+ new TestResult(1, 0m), // 24 * 10
+ new TestResult(1, 0m), // 24 * 11
+ new TestResult(0, -391252894469544.55412631906773m), // 24 * 12
+ new TestResult(1, 0m), // 24 * 13
+ new TestResult(1, 0m), // 24 * 14
+ new TestResult(1, 0m), // 24 * 15
+ new TestResult(2, 215966256439146035447.16512997m), // 24 * 16
+ new TestResult(1, 0m), // 24 * 17
+ new TestResult(1, 0m), // 24 * 18
+ new TestResult(1, 0m), // 24 * 19
+ new TestResult(2, -3631540499079604049748263.216m), // 24 * 20
+ new TestResult(0, -213211810548723232636647639.7m), // 24 * 21
+ new TestResult(2, 3276696308036925201560804370m), // 24 * 22
+ new TestResult(1, 0m), // 24 * 23
+ new TestResult(1, 0m), // 24 * 24
+ new TestResult(1, 0m), // 24 * 25
+ new TestResult(1, 0m), // 24 * 26
+ new TestResult(1, 0m), // 24 * 27
+ new TestResult(1, 0m), // 24 * 28
+ new TestResult(2, 2562693464342799730524457.4865m), // 24 * 29
+ new TestResult(0, 0m), // 25 * 0
+ new TestResult(0, 608940580690915704.1450897514m), // 25 * 1
+ new TestResult(0, -608940580690915704.1450897514m), // 25 * 2
+ new TestResult(0, 1217881161381831408.2901795028m), // 25 * 3
+ new TestResult(0, 6089405806909157041.450897514m), // 25 * 4
+ new TestResult(0, 60894058069091570.41450897514m), // 25 * 5
+ new TestResult(1, 0m), // 25 * 6
+ new TestResult(1, 0m), // 25 * 7
+ new TestResult(1, 0m), // 25 * 8
+ new TestResult(0, -1950957297354170624860913.7855m), // 25 * 9
+ new TestResult(1, 0m), // 25 * 10
+ new TestResult(1, 0m), // 25 * 11
+ new TestResult(0, 464575021466700199.22364418475m), // 25 * 12
+ new TestResult(1, 0m), // 25 * 13
+ new TestResult(1, 0m), // 25 * 14
+ new TestResult(1, 0m), // 25 * 15
+ new TestResult(0, -256439069562229438659442.67473m), // 25 * 16
+ new TestResult(1, 0m), // 25 * 17
+ new TestResult(1, 0m), // 25 * 18
+ new TestResult(1, 0m), // 25 * 19
+ new TestResult(0, 4312103575884025168661620716.9m), // 25 * 20
+ new TestResult(1, 0m), // 25 * 21
+ new TestResult(1, 0m), // 25 * 22
+ new TestResult(1, 0m), // 25 * 23
+ new TestResult(1, 0m), // 25 * 24
+ new TestResult(1, 0m), // 25 * 25
+ new TestResult(1, 0m), // 25 * 26
+ new TestResult(1, 0m), // 25 * 27
+ new TestResult(1, 0m), // 25 * 28
+ new TestResult(0, -3042950960973153681431212945.8m), // 25 * 29
+ new TestResult(0, 0m), // 26 * 0
+ new TestResult(0, -42535053313319986966115.037787m), // 26 * 1
+ new TestResult(0, 42535053313319986966115.037787m), // 26 * 2
+ new TestResult(2, -85070106626639973932230.07557m), // 26 * 3
+ new TestResult(0, -425350533133199869661150.37787m), // 26 * 4
+ new TestResult(0, -4253505331331998696611.5037787m), // 26 * 5
+ new TestResult(1, 0m), // 26 * 6
+ new TestResult(1, 0m), // 26 * 7
+ new TestResult(1, 0m), // 26 * 8
+ new TestResult(1, 0m), // 26 * 9
+ new TestResult(1, 0m), // 26 * 10
+ new TestResult(1, 0m), // 26 * 11
+ new TestResult(0, -32450987719855972399063.033158m), // 26 * 12
+ new TestResult(1, 0m), // 26 * 13
+ new TestResult(1, 0m), // 26 * 14
+ new TestResult(1, 0m), // 26 * 15
+ new TestResult(2, 17912502206818886711664532432m), // 26 * 16
+ new TestResult(1, 0m), // 26 * 17
+ new TestResult(1, 0m), // 26 * 18
+ new TestResult(1, 0m), // 26 * 19
+ new TestResult(1, 0m), // 26 * 20
+ new TestResult(1, 0m), // 26 * 21
+ new TestResult(1, 0m), // 26 * 22
+ new TestResult(1, 0m), // 26 * 23
+ new TestResult(1, 0m), // 26 * 24
+ new TestResult(1, 0m), // 26 * 25
+ new TestResult(1, 0m), // 26 * 26
+ new TestResult(1, 0m), // 26 * 27
+ new TestResult(1, 0m), // 26 * 28
+ new TestResult(1, 0m), // 26 * 29
+ new TestResult(0, 0m), // 27 * 0
+ new TestResult(0, -7808274522591953107485.8812311m), // 27 * 1
+ new TestResult(0, 7808274522591953107485.8812311m), // 27 * 2
+ new TestResult(2, -15616549045183906214971.762462m), // 27 * 3
+ new TestResult(0, -78082745225919531074858.812311m), // 27 * 4
+ new TestResult(0, -780827452259195310748.58812311m), // 27 * 5
+ new TestResult(1, 0m), // 27 * 6
+ new TestResult(1, 0m), // 27 * 7
+ new TestResult(1, 0m), // 27 * 8
+ new TestResult(0, 25016579026989918165002777574m), // 27 * 9
+ new TestResult(1, 0m), // 27 * 10
+ new TestResult(1, 0m), // 27 * 11
+ new TestResult(0, -5957115388557583551533.0994303m), // 27 * 12
+ new TestResult(1, 0m), // 27 * 13
+ new TestResult(1, 0m), // 27 * 14
+ new TestResult(1, 0m), // 27 * 15
+ new TestResult(0, 3288246369108855691627019039.6m), // 27 * 16
+ new TestResult(1, 0m), // 27 * 17
+ new TestResult(1, 0m), // 27 * 18
+ new TestResult(1, 0m), // 27 * 19
+ new TestResult(1, 0m), // 27 * 20
+ new TestResult(1, 0m), // 27 * 21
+ new TestResult(1, 0m), // 27 * 22
+ new TestResult(1, 0m), // 27 * 23
+ new TestResult(1, 0m), // 27 * 24
+ new TestResult(1, 0m), // 27 * 25
+ new TestResult(1, 0m), // 27 * 26
+ new TestResult(1, 0m), // 27 * 27
+ new TestResult(1, 0m), // 27 * 28
+ new TestResult(1, 0m), // 27 * 29
+ new TestResult(0, 0m), // 28 * 0
+ new TestResult(0, 1037807626804273037330059471.7m), // 28 * 1
+ new TestResult(0, -1037807626804273037330059471.7m), // 28 * 2
+ new TestResult(0, 2075615253608546074660118943.4m), // 28 * 3
+ new TestResult(0, 10378076268042730373300594717m), // 28 * 4
+ new TestResult(0, 103780762680427303733005947.17m), // 28 * 5
+ new TestResult(1, 0m), // 28 * 6
+ new TestResult(1, 0m), // 28 * 7
+ new TestResult(1, 0m), // 28 * 8
+ new TestResult(1, 0m), // 28 * 9
+ new TestResult(1, 0m), // 28 * 10
+ new TestResult(1, 0m), // 28 * 11
+ new TestResult(0, 791767728722982425613218218.59m), // 28 * 12
+ new TestResult(1, 0m), // 28 * 13
+ new TestResult(1, 0m), // 28 * 14
+ new TestResult(1, 0m), // 28 * 15
+ new TestResult(1, 0m), // 28 * 16
+ new TestResult(1, 0m), // 28 * 17
+ new TestResult(1, 0m), // 28 * 18
+ new TestResult(1, 0m), // 28 * 19
+ new TestResult(1, 0m), // 28 * 20
+ new TestResult(1, 0m), // 28 * 21
+ new TestResult(1, 0m), // 28 * 22
+ new TestResult(1, 0m), // 28 * 23
+ new TestResult(1, 0m), // 28 * 24
+ new TestResult(1, 0m), // 28 * 25
+ new TestResult(1, 0m), // 28 * 26
+ new TestResult(1, 0m), // 28 * 27
+ new TestResult(1, 0m), // 28 * 28
+ new TestResult(1, 0m), // 28 * 29
+ new TestResult(0, 0m), // 29 * 0
+ new TestResult(0, -4997122966.448652425771563042m), // 29 * 1
+ new TestResult(0, 4997122966.448652425771563042m), // 29 * 2
+ new TestResult(0, -9994245932.897304851543126084m), // 29 * 3
+ new TestResult(0, -49971229664.48652425771563042m), // 29 * 4
+ new TestResult(0, -499712296.6448652425771563042m), // 29 * 5
+ new TestResult(1, 0m), // 29 * 6
+ new TestResult(1, 0m), // 29 * 7
+ new TestResult(1, 0m), // 29 * 8
+ new TestResult(2, 16010057181782036.694377696165m), // 29 * 9
+ new TestResult(1, 0m), // 29 * 10
+ new TestResult(2, 2724399925666581324856736883m), // 29 * 11
+ new TestResult(2, -3812422070.43511700405678157m), // 29 * 12
+ new TestResult(1, 0m), // 29 * 13
+ new TestResult(1, 0m), // 29 * 14
+ new TestResult(1, 0m), // 29 * 15
+ new TestResult(2, 2104404936439239.9111285468803m), // 29 * 16
+ new TestResult(2, -122246061989021334943606343.1m), // 29 * 17
+ new TestResult(1, 0m), // 29 * 18
+ new TestResult(1, 0m), // 29 * 19
+ new TestResult(0, -35386230604481178142.543841269m), // 29 * 20
+ new TestResult(0, -2077565236457711426002.3992246m), // 29 * 21
+ new TestResult(2, 31928579952897032005741.500403m), // 29 * 22
+ new TestResult(2, -2210458768617810051106106.871m), // 29 * 23
+ new TestResult(2, 2562693464342799730524457.4865m), // 29 * 24
+ new TestResult(0, -3042950960973153681431212945.8m), // 29 * 25
+ new TestResult(1, 0m), // 29 * 26
+ new TestResult(1, 0m), // 29 * 27
+ new TestResult(1, 0m), // 29 * 28
+ new TestResult(0, 24971237941808579837.350664893m), // 29 * 29
+ };
+
+
+ // generated result list build2
+ TestResult[] trAuto_Div_build2 = new TestResult[] {
+ new TestResult(3, 0m), // 0 / 0
+ new TestResult(0, 0m), // 0 / 1
+ new TestResult(0, 0m), // 0 / 2
+ new TestResult(0, 0m), // 0 / 3
+ new TestResult(0, 0m), // 0 / 4
+ new TestResult(0, 0m), // 0 / 5
+ new TestResult(0, 0m), // 0 / 6
+ new TestResult(0, 0m), // 0 / 7
+ new TestResult(0, 0m), // 0 / 8
+ new TestResult(0, 0m), // 0 / 9
+ new TestResult(0, 0m), // 0 / 10
+ new TestResult(0, 0m), // 0 / 11
+ new TestResult(0, 0m), // 0 / 12
+ new TestResult(0, 0m), // 0 / 13
+ new TestResult(0, 0m), // 0 / 14
+ new TestResult(0, 0m), // 0 / 15
+ new TestResult(0, 0m), // 0 / 16
+ new TestResult(0, 0m), // 0 / 17
+ new TestResult(0, 0m), // 0 / 18
+ new TestResult(0, 0m), // 0 / 19
+ new TestResult(0, 0m), // 0 / 20
+ new TestResult(0, 0m), // 0 / 21
+ new TestResult(0, 0m), // 0 / 22
+ new TestResult(0, 0m), // 0 / 23
+ new TestResult(0, 0m), // 0 / 24
+ new TestResult(0, 0m), // 0 / 25
+ new TestResult(0, 0m), // 0 / 26
+ new TestResult(0, 0m), // 0 / 27
+ new TestResult(0, 0m), // 0 / 28
+ new TestResult(0, 0m), // 0 / 29
+ new TestResult(3, 0m), // 1 / 0
+ new TestResult(0, 1m), // 1 / 1
+ new TestResult(0, -1m), // 1 / 2
+ new TestResult(0, 0.5m), // 1 / 3
+ new TestResult(0, 0.1m), // 1 / 4
+ new TestResult(0, 10m), // 1 / 5
+ new TestResult(0, 0m), // 1 / 6
+ new TestResult(0, 0m), // 1 / 7
+ new TestResult(2, 3.61E-26m), // 1 / 8
+ new TestResult(2, -3.121239924198969049581E-07m), // 1 / 9
+ new TestResult(2, -2.06327E-23m), // 1 / 10
+ new TestResult(2, -1.8342105061E-18m), // 1 / 11
+ new TestResult(0, 1.3107475704751451797758879069m), // 1 / 12
+ new TestResult(2, -2.4971716E-21m), // 1 / 13
+ new TestResult(2, 4.4873E-24m), // 1 / 14
+ new TestResult(2, 7.02E-26m), // 1 / 15
+ new TestResult(2, -2.3746014276625098667414E-06m), // 1 / 16
+ new TestResult(2, 4.08775782642E-17m), // 1 / 17
+ new TestResult(2, -1.879E-25m), // 1 / 18
+ new TestResult(2, 9.7E-27m), // 1 / 19
+ new TestResult(2, 1.412165941691409118E-10m), // 1 / 20
+ new TestResult(2, 2.4052784859689137E-12m), // 1 / 21
+ new TestResult(2, -1.565094023542766E-13m), // 1 / 22
+ new TestResult(2, 2.2606723262128E-15m), // 1 / 23
+ new TestResult(2, -1.9499495495573E-15m), // 1 / 24
+ new TestResult(2, 1.6421963517E-18m), // 1 / 25
+ new TestResult(2, -2.351E-23m), // 1 / 26
+ new TestResult(2, -1.280693E-22m), // 1 / 27
+ new TestResult(2, 1E-27m), // 1 / 28
+ new TestResult(2, -2.00115147598754898E-10m), // 1 / 29
+ new TestResult(3, 0m), // 2 / 0
+ new TestResult(0, -1m), // 2 / 1
+ new TestResult(0, 1m), // 2 / 2
+ new TestResult(0, -0.5m), // 2 / 3
+ new TestResult(0, -0.1m), // 2 / 4
+ new TestResult(0, -10m), // 2 / 5
+ new TestResult(0, 0m), // 2 / 6
+ new TestResult(0, 0m), // 2 / 7
+ new TestResult(2, -3.61E-26m), // 2 / 8
+ new TestResult(2, 3.121239924198969049581E-07m), // 2 / 9
+ new TestResult(2, 2.06327E-23m), // 2 / 10
+ new TestResult(2, 1.8342105061E-18m), // 2 / 11
+ new TestResult(0, -1.3107475704751451797758879069m), // 2 / 12
+ new TestResult(2, 2.4971716E-21m), // 2 / 13
+ new TestResult(2, -4.4873E-24m), // 2 / 14
+ new TestResult(2, -7.02E-26m), // 2 / 15
+ new TestResult(2, 2.3746014276625098667414E-06m), // 2 / 16
+ new TestResult(2, -4.08775782642E-17m), // 2 / 17
+ new TestResult(2, 1.879E-25m), // 2 / 18
+ new TestResult(2, -9.7E-27m), // 2 / 19
+ new TestResult(2, -1.412165941691409118E-10m), // 2 / 20
+ new TestResult(2, -2.4052784859689137E-12m), // 2 / 21
+ new TestResult(2, 1.565094023542766E-13m), // 2 / 22
+ new TestResult(2, -2.2606723262128E-15m), // 2 / 23
+ new TestResult(2, 1.9499495495573E-15m), // 2 / 24
+ new TestResult(2, -1.6421963517E-18m), // 2 / 25
+ new TestResult(2, 2.351E-23m), // 2 / 26
+ new TestResult(2, 1.280693E-22m), // 2 / 27
+ new TestResult(2, -1E-27m), // 2 / 28
+ new TestResult(2, 2.00115147598754898E-10m), // 2 / 29
+ new TestResult(3, 0m), // 3 / 0
+ new TestResult(0, 2m), // 3 / 1
+ new TestResult(0, -2m), // 3 / 2
+ new TestResult(0, 1m), // 3 / 3
+ new TestResult(0, 0.2m), // 3 / 4
+ new TestResult(0, 20m), // 3 / 5
+ new TestResult(0, 0m), // 3 / 6
+ new TestResult(0, 0m), // 3 / 7
+ new TestResult(2, 7.22E-26m), // 3 / 8
+ new TestResult(2, -6.242479848397938099161E-07m), // 3 / 9
+ new TestResult(2, -4.12653E-23m), // 3 / 10
+ new TestResult(2, -3.6684210122E-18m), // 3 / 11
+ new TestResult(0, 2.6214951409502903595517758138m), // 3 / 12
+ new TestResult(2, -4.9943432E-21m), // 3 / 13
+ new TestResult(2, 8.9746E-24m), // 3 / 14
+ new TestResult(2, 1.404E-25m), // 3 / 15
+ new TestResult(2, -4.7492028553250197334829E-06m), // 3 / 16
+ new TestResult(2, 8.17551565284E-17m), // 3 / 17
+ new TestResult(2, -3.757E-25m), // 3 / 18
+ new TestResult(2, 1.95E-26m), // 3 / 19
+ new TestResult(2, 2.824331883382818237E-10m), // 3 / 20
+ new TestResult(2, 4.8105569719378275E-12m), // 3 / 21
+ new TestResult(2, -3.130188047085533E-13m), // 3 / 22
+ new TestResult(2, 4.5213446524256E-15m), // 3 / 23
+ new TestResult(2, -3.8998990991146E-15m), // 3 / 24
+ new TestResult(2, 3.2843927034E-18m), // 3 / 25
+ new TestResult(2, -4.702E-23m), // 3 / 26
+ new TestResult(2, -2.561385E-22m), // 3 / 27
+ new TestResult(2, 1.9E-27m), // 3 / 28
+ new TestResult(2, -4.002302951975097959E-10m), // 3 / 29
+ new TestResult(3, 0m), // 4 / 0
+ new TestResult(0, 10m), // 4 / 1
+ new TestResult(0, -10m), // 4 / 2
+ new TestResult(0, 5m), // 4 / 3
+ new TestResult(0, 1m), // 4 / 4
+ new TestResult(0, 100m), // 4 / 5
+ new TestResult(2, 1E-28m), // 4 / 6
+ new TestResult(2, -1E-28m), // 4 / 7
+ new TestResult(2, 3.61E-25m), // 4 / 8
+ new TestResult(2, -3.1212399241989690495806E-06m), // 4 / 9
+ new TestResult(2, -2.063265E-22m), // 4 / 10
+ new TestResult(2, -1.83421050609E-17m), // 4 / 11
+ new TestResult(0, 13.107475704751451797758879069m), // 4 / 12
+ new TestResult(2, -2.49717158E-20m), // 4 / 13
+ new TestResult(2, 4.48729E-23m), // 4 / 14
+ new TestResult(2, 7.019E-25m), // 4 / 15
+ new TestResult(2, -2.37460142766250986674143E-05m), // 4 / 16
+ new TestResult(2, 4.087757826422E-16m), // 4 / 17
+ new TestResult(2, -1.8785E-24m), // 4 / 18
+ new TestResult(2, 9.73E-26m), // 4 / 19
+ new TestResult(2, 1.4121659416914091185E-09m), // 4 / 20
+ new TestResult(2, 2.40527848596891375E-11m), // 4 / 21
+ new TestResult(2, -1.5650940235427663E-12m), // 4 / 22
+ new TestResult(2, 2.26067232621278E-14m), // 4 / 23
+ new TestResult(2, -1.94994954955729E-14m), // 4 / 24
+ new TestResult(2, 1.64219635168E-17m), // 4 / 25
+ new TestResult(2, -2.351002E-22m), // 4 / 26
+ new TestResult(2, -1.2806927E-21m), // 4 / 27
+ new TestResult(2, 9.6E-27m), // 4 / 28
+ new TestResult(2, -2.0011514759875489796E-09m), // 4 / 29
+ new TestResult(3, 0m), // 5 / 0
+ new TestResult(0, 0.1m), // 5 / 1
+ new TestResult(0, -0.1m), // 5 / 2
+ new TestResult(0, 0.05m), // 5 / 3
+ new TestResult(0, 0.01m), // 5 / 4
+ new TestResult(0, 1m), // 5 / 5
+ new TestResult(0, 0m), // 5 / 6
+ new TestResult(0, 0m), // 5 / 7
+ new TestResult(2, 3.6E-27m), // 5 / 8
+ new TestResult(2, -3.12123992419896904958E-08m), // 5 / 9
+ new TestResult(2, -2.0633E-24m), // 5 / 10
+ new TestResult(2, -1.834210506E-19m), // 5 / 11
+ new TestResult(0, 0.1310747570475145179775887907m), // 5 / 12
+ new TestResult(2, -2.497172E-22m), // 5 / 13
+ new TestResult(2, 4.487E-25m), // 5 / 14
+ new TestResult(2, 7E-27m), // 5 / 15
+ new TestResult(2, -2.374601427662509866741E-07m), // 5 / 16
+ new TestResult(2, 4.0877578264E-18m), // 5 / 17
+ new TestResult(2, -1.88E-26m), // 5 / 18
+ new TestResult(2, 1E-27m), // 5 / 19
+ new TestResult(2, 1.41216594169140912E-11m), // 5 / 20
+ new TestResult(2, 2.405278485968914E-13m), // 5 / 21
+ new TestResult(2, -1.56509402354277E-14m), // 5 / 22
+ new TestResult(2, 2.260672326213E-16m), // 5 / 23
+ new TestResult(2, -1.949949549557E-16m), // 5 / 24
+ new TestResult(2, 1.642196352E-19m), // 5 / 25
+ new TestResult(2, -2.351E-24m), // 5 / 26
+ new TestResult(2, -1.28069E-23m), // 5 / 27
+ new TestResult(2, 1E-28m), // 5 / 28
+ new TestResult(2, -2.00115147598754898E-11m), // 5 / 29
+ new TestResult(3, 0m), // 6 / 0
+ new TestResult(0, 79228162514264337593543950335m), // 6 / 1
+ new TestResult(0, -79228162514264337593543950335m), // 6 / 2
+ new TestResult(4, 39614081257132168796771975168m), // 6 / 3
+ new TestResult(0, 7922816251426433759354395033.5m), // 6 / 4
+ new TestResult(1, 0m), // 6 / 5
+ new TestResult(0, 1m), // 6 / 6
+ new TestResult(0, -1m), // 6 / 7
+ new TestResult(2, 2859.8815108190596050496514036m), // 6 / 8
+ new TestResult(2, -24729010396044602218186.765763m), // 6 / 9
+ new TestResult(0, -1634686.9890330150250120997619m), // 6 / 10
+ new TestResult(2, -145321128061.87519668639091926m), // 6 / 11
+ new TestResult(1, 0m), // 6 / 12
+ new TestResult(0, -197846315.8215581473367403789m), // 6 / 13
+ new TestResult(0, 355519.78373087286985534915017m), // 6 / 14
+ new TestResult(0, 5561.4152228343398478498516935m), // 6 / 15
+ new TestResult(0, -188135307817449443294332.61564m), // 6 / 16
+ new TestResult(4, 3238655413907.0152158135371692m), // 6 / 17
+ new TestResult(0, -14883.393842880239095927799143m), // 6 / 18
+ new TestResult(0, 770.69397665852204557888702506m), // 6 / 19
+ new TestResult(4, 11188331272543609822.484506627m), // 6 / 20
+ new TestResult(0, 190565794778408772.72439011791m), // 6 / 21
+ new TestResult(4, -12399952364735014.543439368391m), // 6 / 22
+ new TestResult(2, 179108914452685.79816067884477m), // 6 / 23
+ new TestResult(2, -154490919806941.48506503891762m), // 6 / 24
+ new TestResult(2, 130108199431.16705963085822836m), // 6 / 25
+ new TestResult(2, -1862655.7707746844883926874832m), // 6 / 26
+ new TestResult(2, -10146692.753313261555369747673m), // 6 / 27
+ new TestResult(0, 76.341858036091015923443233609m), // 6 / 28
+ new TestResult(2, -15854755435520147876.101506668m), // 6 / 29
+ new TestResult(3, 0m), // 7 / 0
+ new TestResult(0, -79228162514264337593543950335m), // 7 / 1
+ new TestResult(0, 79228162514264337593543950335m), // 7 / 2
+ new TestResult(4, -39614081257132168796771975168m), // 7 / 3
+ new TestResult(0, -7922816251426433759354395033.5m), // 7 / 4
+ new TestResult(1, 0m), // 7 / 5
+ new TestResult(0, -1m), // 7 / 6
+ new TestResult(0, 1m), // 7 / 7
+ new TestResult(2, -2859.8815108190596050496514036m), // 7 / 8
+ new TestResult(2, 24729010396044602218186.765763m), // 7 / 9
+ new TestResult(0, 1634686.9890330150250120997619m), // 7 / 10
+ new TestResult(2, 145321128061.87519668639091926m), // 7 / 11
+ new TestResult(1, 0m), // 7 / 12
+ new TestResult(0, 197846315.8215581473367403789m), // 7 / 13
+ new TestResult(0, -355519.78373087286985534915017m), // 7 / 14
+ new TestResult(0, -5561.4152228343398478498516935m), // 7 / 15
+ new TestResult(0, 188135307817449443294332.61564m), // 7 / 16
+ new TestResult(4, -3238655413907.0152158135371692m), // 7 / 17
+ new TestResult(0, 14883.393842880239095927799143m), // 7 / 18
+ new TestResult(0, -770.69397665852204557888702506m), // 7 / 19
+ new TestResult(4, -11188331272543609822.484506627m), // 7 / 20
+ new TestResult(0, -190565794778408772.72439011791m), // 7 / 21
+ new TestResult(4, 12399952364735014.543439368391m), // 7 / 22
+ new TestResult(2, -179108914452685.79816067884477m), // 7 / 23
+ new TestResult(2, 154490919806941.48506503891762m), // 7 / 24
+ new TestResult(2, -130108199431.16705963085822836m), // 7 / 25
+ new TestResult(2, 1862655.7707746844883926874832m), // 7 / 26
+ new TestResult(2, 10146692.753313261555369747673m), // 7 / 27
+ new TestResult(0, -76.341858036091015923443233609m), // 7 / 28
+ new TestResult(2, 15854755435520147876.101506668m), // 7 / 29
+ new TestResult(3, 0m), // 8 / 0
+ new TestResult(0, 27703302467091960609331879.532m), // 8 / 1
+ new TestResult(0, -27703302467091960609331879.532m), // 8 / 2
+ new TestResult(0, 13851651233545980304665939.766m), // 8 / 3
+ new TestResult(0, 2770330246709196060933187.9532m), // 8 / 4
+ new TestResult(0, 277033024670919606093318795.32m), // 8 / 5
+ new TestResult(2, 0.0003496648361888264585379374m), // 8 / 6
+ new TestResult(2, -0.0003496648361888264585379374m), // 8 / 7
+ new TestResult(0, 1m), // 8 / 8
+ new TestResult(2, -8646865369244722339.540450168m), // 8 / 9
+ new TestResult(0, -571.59255824023515226354006889m), // 8 / 10
+ new TestResult(0, -50813688.438531062464476589278m), // 8 / 11
+ new TestResult(0, 36312036402878882966329689.018m), // 8 / 12
+ new TestResult(0, -69179.899612307954004328275068m), // 8 / 13
+ new TestResult(2, 124.31276694014267187689413445m), // 8 / 14
+ new TestResult(0, 1.9446313428704152390534655913m), // 8 / 15
+ new TestResult(0, -65784301589322901428.917817252m), // 8 / 16
+ new TestResult(2, 1132443914.7758524269197245123m), // 8 / 17
+ new TestResult(0, -5.2041994700045071214948001057m), // 8 / 18
+ new TestResult(2, 0.2694845831000173532986745484m), // 8 / 19
+ new TestResult(0, 3912166021640285.6025706982227m), // 8 / 20
+ new TestResult(0, 66634157414385.824002109431498m), // 8 / 21
+ new TestResult(0, -4335827312364.3201348613764117m), // 8 / 22
+ new TestResult(0, 62628089232.056911382057917869m), // 8 / 23
+ new TestResult(0, -54020042166.955319300276527479m), // 8 / 24
+ new TestResult(0, 45494262.240922193719761217507m), // 8 / 25
+ new TestResult(0, -651.30522496410233725620872491m), // 8 / 26
+ new TestResult(0, -3547.9416594456341168641639951m), // 8 / 27
+ new TestResult(2, 0.0266940632845404098551052086m), // 8 / 28
+ new TestResult(0, -5543850462175058.4016671641533m), // 8 / 29
+ new TestResult(3, 0m), // 9 / 0
+ new TestResult(0, -3203854.9559968181492513385018m), // 9 / 1
+ new TestResult(0, 3203854.9559968181492513385018m), // 9 / 2
+ new TestResult(0, -1601927.4779984090746256692509m), // 9 / 3
+ new TestResult(0, -320385.49559968181492513385018m), // 9 / 4
+ new TestResult(0, -32038549.559968181492513385018m), // 9 / 5
+ new TestResult(2, -4.04383E-23m), // 9 / 6
+ new TestResult(2, 4.04383E-23m), // 9 / 7
+ new TestResult(2, -1.156488458E-19m), // 9 / 8
+ new TestResult(0, 1m), // 9 / 9
+ new TestResult(2, 6.61040196455E-17m), // 9 / 10
+ new TestResult(2, 5.8765444202781065E-12m), // 9 / 11
+ new TestResult(0, -4199445.0997275825559060668592m), // 9 / 12
+ new TestResult(2, 8.0005755447943E-15m), // 9 / 13
+ new TestResult(2, -1.43766280186E-17m), // 9 / 14
+ new TestResult(2, -2.248943704E-19m), // 9 / 15
+ new TestResult(0, 7.6078785525336521046280405305m), // 9 / 16
+ new TestResult(2, -1.309658317109623269E-10m), // 9 / 17
+ new TestResult(2, 6.018596622E-19m), // 9 / 18
+ new TestResult(2, -3.1165581E-20m), // 9 / 19
+ new TestResult(2, -0.0004524374850977934825669157m), // 9 / 20
+ new TestResult(2, -7.7061633978240275370839E-06m), // 9 / 21
+ new TestResult(2, 5.014334243928492665444E-07m), // 9 / 22
+ new TestResult(2, -7.242866236221657103E-09m), // 9 / 23
+ new TestResult(2, 6.2473555282928855602E-09m), // 9 / 24
+ new TestResult(2, -5.261358920047113E-12m), // 9 / 25
+ new TestResult(2, 7.53226975501E-17m), // 9 / 26
+ new TestResult(2, 4.103153579868E-16m), // 9 / 27
+ new TestResult(2, -3.0871376E-21m), // 9 / 28
+ new TestResult(2, 0.0006411399074043056427231896m), // 9 / 29
+ new TestResult(3, 0m), // 10 / 0
+ new TestResult(0, -48466870444188873796420.028868m), // 10 / 1
+ new TestResult(0, 48466870444188873796420.028868m), // 10 / 2
+ new TestResult(0, -24233435222094436898210.014434m), // 10 / 3
+ new TestResult(0, -4846687044418887379642.0028868m), // 10 / 4
+ new TestResult(0, -484668704441888737964200.28868m), // 10 / 5
+ new TestResult(2, -6.11737908669317400216E-07m), // 10 / 6
+ new TestResult(2, 6.11737908669317400216E-07m), // 10 / 7
+ new TestResult(2, -0.001749497934470499347067655m), // 10 / 8
+ new TestResult(2, 15127673103138133.38384122385m), // 10 / 9
+ new TestResult(0, 1m), // 10 / 10
+ new TestResult(2, 88898.44296603758700885485801m), // 10 / 11
+ new TestResult(0, -63527832683254186820073.01815m), // 10 / 12
+ new TestResult(2, 121.03009147860926410013615872m), // 10 / 13
+ new TestResult(2, -0.217484928990092181791376891m), // 10 / 14
+ new TestResult(2, -0.0034021285176583848675539818m), // 10 / 15
+ new TestResult(2, 115089499751104803.45385549602m), // 10 / 16
+ new TestResult(2, -1981208.2898040400164777217752m), // 10 / 17
+ new TestResult(2, 0.0091047362233453526323903968m), // 10 / 18
+ new TestResult(2, -0.0004714627215051239953535366m), // 10 / 19
+ new TestResult(0, -6844326374165.3505116694016252m), // 10 / 20
+ new TestResult(2, -116576320761.65010852644993727m), // 10 / 21
+ new TestResult(0, 7585520927.2021546507200976307m), // 10 / 22
+ new TestResult(2, -109567712.75131768812510902617m), // 10 / 23
+ new TestResult(2, 94507952.1910976087542637813m), // 10 / 24
+ new TestResult(0, -79592.11782075260884714858998m), // 10 / 25
+ new TestResult(0, 1.1394571457845409462816707224m), // 10 / 26
+ new TestResult(0, 6.2071166048219727069770728387m), // 10 / 27
+ new TestResult(2, -4.67012085789282405269787E-05m), // 10 / 28
+ new TestResult(2, 9698954932588.587842740128447m), // 10 / 29
+ new TestResult(3, 0m), // 11 / 0
+ new TestResult(0, -545193693242804794.30331374676m), // 11 / 1
+ new TestResult(0, 545193693242804794.30331374676m), // 11 / 2
+ new TestResult(0, -272596846621402397.15165687338m), // 11 / 3
+ new TestResult(0, -54519369324280479.430331374676m), // 11 / 4
+ new TestResult(0, -5451936932428047943.0331374676m), // 11 / 5
+ new TestResult(2, -6.8813118459568899E-12m), // 11 / 6
+ new TestResult(2, 6.8813118459568899E-12m), // 11 / 7
+ new TestResult(2, -1.96797365184322821747E-08m), // 11 / 8
+ new TestResult(2, 170168032177.09280206999941461m), // 11 / 9
+ new TestResult(2, 1.12487909420644868170014E-05m), // 11 / 10
+ new TestResult(0, 1m), // 11 / 11
+ new TestResult(0, -714611308856377959.50595110446m), // 11 / 12
+ new TestResult(2, 0.0013614421967418161221277362m), // 11 / 13
+ new TestResult(2, -2.4464424992592870530962E-06m), // 11 / 14
+ new TestResult(2, -3.82698324531749191876E-08m), // 11 / 15
+ new TestResult(2, 1294617722326.9607230936474447m), // 11 / 16
+ new TestResult(0, -22.286197864690758108786295635m), // 11 / 17
+ new TestResult(2, 1.024172743590536270877E-07m), // 11 / 18
+ new TestResult(2, -5.3033855911879105358E-09m), // 11 / 19
+ new TestResult(0, -76990396.522244266468310204941m), // 11 / 20
+ new TestResult(2, -1311342.6610428539176292952583m), // 11 / 21
+ new TestResult(2, 85327.93909675220473779587097m), // 11 / 22
+ new TestResult(2, -1232.5042947397459817875590485m), // 11 / 23
+ new TestResult(2, 1063.1001965602823514109428061m), // 11 / 24
+ new TestResult(2, -0.8953150940018113683593315845m), // 11 / 25
+ new TestResult(2, 1.28175152203717976446025E-05m), // 11 / 26
+ new TestResult(2, 6.98225570406594773014162E-05m), // 11 / 27
+ new TestResult(2, -5.253321320461122964E-10m), // 11 / 28
+ new TestResult(2, 109101516.393194182269828744m), // 11 / 29
+ new TestResult(3, 0m), // 12 / 0
+ new TestResult(0, 0.7629234053338741809892531431m), // 12 / 1
+ new TestResult(0, -0.7629234053338741809892531431m), // 12 / 2
+ new TestResult(2, 0.3814617026669370904946265716m), // 12 / 3
+ new TestResult(2, 0.0762923405333874180989253143m), // 12 / 4
+ new TestResult(0, 7.629234053338741809892531431m), // 12 / 5
+ new TestResult(0, 0m), // 12 / 6
+ new TestResult(0, 0m), // 12 / 7
+ new TestResult(2, 2.75E-26m), // 12 / 8
+ new TestResult(2, -2.381266991833920788159E-07m), // 12 / 9
+ new TestResult(2, -1.57411E-23m), // 12 / 10
+ new TestResult(2, -1.3993621254E-18m), // 12 / 11
+ new TestResult(0, 1m), // 12 / 12
+ new TestResult(2, -1.9051506E-21m), // 12 / 13
+ new TestResult(2, 3.4235E-24m), // 12 / 14
+ new TestResult(2, 5.36E-26m), // 12 / 15
+ new TestResult(2, -1.8116390075029613252172E-06m), // 12 / 16
+ new TestResult(2, 3.11864612111E-17m), // 12 / 17
+ new TestResult(2, -1.433E-25m), // 12 / 18
+ new TestResult(2, 7.4E-27m), // 12 / 19
+ new TestResult(2, 1.077374449131727051E-10m), // 12 / 20
+ new TestResult(2, 1.8350432532917088E-12m), // 12 / 21
+ new TestResult(2, -1.194046862108942E-13m), // 12 / 22
+ new TestResult(2, 1.7247198294583E-15m), // 12 / 23
+ new TestResult(2, -1.4876621505775E-15m), // 12 / 24
+ new TestResult(2, 1.2528700328E-18m), // 12 / 25
+ new TestResult(2, -1.79363E-23m), // 12 / 26
+ new TestResult(2, -9.7707E-23m), // 12 / 27
+ new TestResult(2, 7E-28m), // 12 / 28
+ new TestResult(2, -1.526725298649329415E-10m), // 12 / 29
+ new TestResult(3, 0m), // 13 / 0
+ new TestResult(0, -400453059665371395972.33474452m), // 13 / 1
+ new TestResult(0, 400453059665371395972.33474452m), // 13 / 2
+ new TestResult(0, -200226529832685697986.16737226m), // 13 / 3
+ new TestResult(0, -40045305966537139597.233474452m), // 13 / 4
+ new TestResult(0, -4004530596653713959723.3474452m), // 13 / 5
+ new TestResult(2, -5.0544282103383796846E-09m), // 13 / 6
+ new TestResult(2, 5.0544282103383796846E-09m), // 13 / 7
+ new TestResult(2, -1.44550657865090008770424E-05m), // 13 / 8
+ new TestResult(0, 124991007759518.90460797449561m), // 13 / 9
+ new TestResult(2, 0.0082624080324415766315344098m), // 13 / 10
+ new TestResult(0, 734.51520923413833710945795487m), // 13 / 11
+ new TestResult(0, -524892875045723911444.75281192m), // 13 / 12
+ new TestResult(0, 1m), // 13 / 13
+ new TestResult(2, -0.0017969492242227235536064218m), // 13 / 14
+ new TestResult(2, -2.81097739916991934127E-05m), // 13 / 15
+ new TestResult(0, 950916407193211.1625559901416m), // 13 / 16
+ new TestResult(2, -16369.551287616739221174657438m), // 13 / 17
+ new TestResult(2, 7.52270457050304262522489E-05m), // 13 / 18
+ new TestResult(2, -3.8954173771607025488213E-06m), // 13 / 19
+ new TestResult(0, -56550617210.555523949138629466m), // 13 / 20
+ new TestResult(2, -963201129.053543593301215979m), // 13 / 21
+ new TestResult(0, 62674669.039168758653283589393m), // 13 / 22
+ new TestResult(2, -905293.1499327386264702284996m), // 13 / 23
+ new TestResult(0, 780863.26331332938464898250347m), // 13 / 24
+ new TestResult(0, -657.62255360122271090761257385m), // 13 / 25
+ new TestResult(2, 0.0094146598739531437042039072m), // 13 / 26
+ new TestResult(2, 0.0512857300939825548661107378m), // 13 / 27
+ new TestResult(2, -3.858644408872661628546E-07m), // 13 / 28
+ new TestResult(2, 80136723141.3087985919301071m), // 13 / 29
+ new TestResult(3, 0m), // 14 / 0
+ new TestResult(0, 222851627785191714190050.61676m), // 14 / 1
+ new TestResult(0, -222851627785191714190050.61676m), // 14 / 2
+ new TestResult(0, 111425813892595857095025.30838m), // 14 / 3
+ new TestResult(0, 22285162778519171419005.061676m), // 14 / 4
+ new TestResult(0, 2228516277851917141900506.1676m), // 14 / 5
+ new TestResult(2, 2.8127829891936371496034E-06m), // 14 / 6
+ new TestResult(2, -2.8127829891936371496034E-06m), // 14 / 7
+ new TestResult(2, 0.0080442260647412496180191824m), // 14 / 8
+ new TestResult(0, -69557339781586865.090190294226m), // 14 / 9
+ new TestResult(0, -4.5980197554082303507855592074m), // 14 / 10
+ new TestResult(0, -408756.79698287266169556154972m), // 14 / 11
+ new TestResult(0, 292102229695871398106087.53771m), // 14 / 12
+ new TestResult(0, -556.49875161751071295835933612m), // 14 / 13
+ new TestResult(0, 1m), // 14 / 14
+ new TestResult(2, 0.0156430541346309720805875037m), // 14 / 15
+ new TestResult(0, -529183793495630496.21134784463m), // 14 / 16
+ new TestResult(0, 9109634.856097530429701051341m), // 14 / 17
+ new TestResult(2, -0.0418637570227228532534385582m), // 14 / 18
+ new TestResult(2, 0.0021677949074190888565424407m), // 14 / 19
+ new TestResult(0, 31470347880873.8650457716423m), // 14 / 20
+ new TestResult(0, 536020225874.87383772032904409m), // 14 / 21
+ new TestResult(0, -34878375078.338063831579069802m), // 14 / 22
+ new TestResult(0, 503794507.78545299809142202221m), // 14 / 23
+ new TestResult(0, -434549431.21784335466036244264m), // 14 / 24
+ new TestResult(0, 365966.13011459996262470838791m), // 14 / 25
+ new TestResult(0, -5.2392464667583952349382510034m), // 14 / 26
+ new TestResult(0, -28.540444773093892153704750451m), // 14 / 27
+ new TestResult(2, 0.0002147330796473523774307252m), // 14 / 28
+ new TestResult(0, -44595986386856.427962855912902m), // 14 / 29
+ new TestResult(3, 0m), // 15 / 0
+ new TestResult(0, 14246043379204153213661335.584m), // 15 / 1
+ new TestResult(0, -14246043379204153213661335.584m), // 15 / 2
+ new TestResult(0, 7123021689602076606830667.792m), // 15 / 3
+ new TestResult(0, 1424604337920415321366133.5584m), // 15 / 4
+ new TestResult(0, 142460433792041532136613355.84m), // 15 / 5
+ new TestResult(2, 0.000179810346814988644017588m), // 15 / 6
+ new TestResult(2, -0.000179810346814988644017588m), // 15 / 7
+ new TestResult(2, 0.5142362863101488055319975668m), // 15 / 8
+ new TestResult(0, -4446531935704239606.853757764m), // 15 / 9
+ new TestResult(0, -293.9336344319759696558350238m), // 15 / 10
+ new TestResult(0, -26130242.436351157631251931791m), // 15 / 11
+ new TestResult(0, 18672966748175371201221341.455m), // 15 / 12
+ new TestResult(0, -35574.814663942145387025413585m), // 15 / 13
+ new TestResult(0, 63.926135612238008074953534656m), // 15 / 14
+ new TestResult(0, 1m), // 15 / 15
+ new TestResult(0, -33828674946800228646.235978357m), // 15 / 16
+ new TestResult(0, 582343753.18886100200299543357m), // 15 / 17
+ new TestResult(0, -2.676188208672362394790189458m), // 15 / 18
+ new TestResult(2, 0.1385787512311916118536189686m), // 15 / 19
+ new TestResult(0, 2011777726397049.7148998294303m), // 15 / 20
+ new TestResult(0, 34265701650179.633435597272951m), // 15 / 21
+ new TestResult(0, -2229639735192.3415269889385254m), // 15 / 22
+ new TestResult(0, 32205636025.393565317814400562m), // 15 / 23
+ new TestResult(0, -27779065870.252746877787654023m), // 15 / 24
+ new TestResult(0, 23394800.463191857206004010592m), // 15 / 25
+ new TestResult(0, -334.92478013993600679391750784m), // 15 / 26
+ new TestResult(0, -1824.480342998389574945394373m), // 15 / 27
+ new TestResult(2, 0.0137270559699701534233028604m), // 15 / 28
+ new TestResult(0, -2850849073527704.1131980257228m), // 15 / 29
+ new TestResult(3, 0m), // 16 / 0
+ new TestResult(0, -421123.30446308691436596648186m), // 16 / 1
+ new TestResult(0, 421123.30446308691436596648186m), // 16 / 2
+ new TestResult(0, -210561.65223154345718298324093m), // 16 / 3
+ new TestResult(0, -42112.330446308691436596648186m), // 16 / 4
+ new TestResult(0, -4211233.0446308691436596648186m), // 16 / 5
+ new TestResult(2, -5.3153E-24m), // 16 / 6
+ new TestResult(2, 5.3153E-24m), // 16 / 7
+ new TestResult(2, -1.52011951E-20m), // 16 / 8
+ new TestResult(2, 0.1314426870900784765046305445m), // 16 / 9
+ new TestResult(2, 8.6888899697E-18m), // 16 / 10
+ new TestResult(2, 7.724287894055618E-13m), // 16 / 11
+ new TestResult(0, -551986.34819545603591091806686m), // 16 / 12
+ new TestResult(2, 1.0516171478749E-15m), // 16 / 13
+ new TestResult(2, -1.8897026181E-18m), // 16 / 14
+ new TestResult(2, -2.95607204E-20m), // 16 / 15
+ new TestResult(0, 1m), // 16 / 16
+ new TestResult(2, -1.72145008370758982E-11m), // 16 / 17
+ new TestResult(2, 7.91100512E-20m), // 16 / 18
+ new TestResult(2, -4.0964877E-21m), // 16 / 19
+ new TestResult(2, -5.94695987815313124908788E-05m), // 16 / 20
+ new TestResult(2, -1.012918824165199591208E-06m), // 16 / 21
+ new TestResult(2, 6.59097566989758101184E-08m), // 16 / 22
+ new TestResult(2, -9.520218003229776933E-10m), // 16 / 23
+ new TestResult(2, 8.211691978458736692E-10m), // 16 / 24
+ new TestResult(2, -6.915671541963459E-13m), // 16 / 25
+ new TestResult(2, 9.9006177649E-18m), // 16 / 26
+ new TestResult(2, 5.39329532081E-17m), // 16 / 27
+ new TestResult(2, -4.057817E-22m), // 16 / 28
+ new TestResult(2, 8.42731522299060351340978E-05m), // 16 / 29
+ new TestResult(3, 0m), // 17 / 0
+ new TestResult(0, 24463288738299545.200508898642m), // 17 / 1
+ new TestResult(0, -24463288738299545.200508898642m), // 17 / 2
+ new TestResult(0, 12231644369149772.600254449321m), // 17 / 3
+ new TestResult(0, 2446328873829954.5200508898642m), // 17 / 4
+ new TestResult(0, 244632887382995452.00508898642m), // 17 / 5
+ new TestResult(2, 3.087701135804474E-13m), // 17 / 6
+ new TestResult(2, -3.087701135804474E-13m), // 17 / 7
+ new TestResult(2, 8.830459389222225669E-10m), // 17 / 8
+ new TestResult(0, -7635579348.7187565660747357791m), // 17 / 9
+ new TestResult(2, -5.047424872722036356353E-07m), // 17 / 10
+ new TestResult(2, -0.0448708212173039475800037318m), // 17 / 11
+ new TestResult(0, 32065196279558108.529140993113m), // 17 / 12
+ new TestResult(2, -6.10890294076955781848965E-05m), // 17 / 13
+ new TestResult(2, 1.097738840026777145636E-07m), // 17 / 14
+ new TestResult(2, 1.7171988100225883459E-09m), // 17 / 15
+ new TestResult(0, -58090560363.286299748647320613m), // 17 / 16
+ new TestResult(0, 1m), // 17 / 17
+ new TestResult(2, -4.5955472073286630491E-09m), // 17 / 18
+ new TestResult(2, 2.379672667086185355E-10m), // 17 / 19
+ new TestResult(0, 3454622.3177989620890093190782m), // 17 / 20
+ new TestResult(0, 58841.022098277508341771781449m), // 17 / 21
+ new TestResult(0, -3828.7347000513678647353825371m), // 17 / 22
+ new TestResult(0, 55.303479858826432190514052161m), // 17 / 23
+ new TestResult(0, -47.702178855937114485246771806m), // 17 / 24
+ new TestResult(2, 0.0401735235161089558399723624m), // 17 / 25
+ new TestResult(2, -5.751324339033751411128E-07m), // 17 / 26
+ new TestResult(2, -3.1329954739064384030107E-06m), // 17 / 27
+ new TestResult(2, 2.35720841767462147E-11m), // 17 / 28
+ new TestResult(0, -4895474.6366157719700764456737m), // 17 / 29
+ new TestResult(3, 0m), // 18 / 0
+ new TestResult(0, -5323259153836385912697776.001m), // 18 / 1
+ new TestResult(0, 5323259153836385912697776.001m), // 18 / 2
+ new TestResult(0, -2661629576918192956348888.0005m), // 18 / 3
+ new TestResult(0, -532325915383638591269777.6001m), // 18 / 4
+ new TestResult(0, -53232591538363859126977760.01m), // 18 / 5
+ new TestResult(2, -6.71889765571425396685425E-05m), // 18 / 6
+ new TestResult(2, 6.71889765571425396685425E-05m), // 18 / 7
+ new TestResult(2, -0.1921525117866271842350897941m), // 18 / 8
+ new TestResult(2, 1661516899781174928.9093780261m), // 18 / 9
+ new TestResult(2, 109.83294578440517035615430815m), // 18 / 10
+ new TestResult(0, 9763977.866606841461047851247m), // 18 / 11
+ new TestResult(0, -6977449002900619940294072.5616m), // 18 / 12
+ new TestResult(2, 13293.091475651689504900168879m), // 18 / 13
+ new TestResult(2, -23.887010414694002921991680138m), // 18 / 14
+ new TestResult(2, -0.3736657970315521134142448751m), // 18 / 15
+ new TestResult(2, 12640618786517406225.453062932m), // 18 / 16
+ new TestResult(2, -217601942.68166121398235985303m), // 18 / 17
+ new TestResult(0, 1m), // 18 / 18
+ new TestResult(2, -0.0517821395304403973786481636m), // 18 / 19
+ new TestResult(0, -751732527584477.35915419894761m), // 18 / 20
+ new TestResult(2, -12803920717959.743225565448731m), // 18 / 21
+ new TestResult(2, 833140108743.8650907762143944m), // 18 / 22
+ new TestResult(2, -12034144654.336754703603784598m), // 18 / 23
+ new TestResult(2, 10380086789.199979490407779016m), // 18 / 24
+ new TestResult(2, -8741836.761472709884309939817m), // 18 / 25
+ new TestResult(2, 125.14993491660654415586289072m), // 18 / 26
+ new TestResult(0, 681.74590153489282094280759828m), // 18 / 27
+ new TestResult(2, -0.0051293313099156230719389272m), // 18 / 28
+ new TestResult(2, 1065264791276391.4723331595476m), // 18 / 29
+ new TestResult(3, 0m), // 19 / 0
+ new TestResult(0, 102801066199805834724673169.19m), // 19 / 1
+ new TestResult(0, -102801066199805834724673169.19m), // 19 / 2
+ new TestResult(0, 51400533099902917362336584.595m), // 19 / 3
+ new TestResult(0, 10280106619980583472467316.919m), // 19 / 4
+ new TestResult(0, 1028010661998058347246731691.9m), // 19 / 5
+ new TestResult(2, 0.0012975318742410238535080931m), // 19 / 6
+ new TestResult(2, -0.0012975318742410238535080931m), // 19 / 7
+ new TestResult(0, 3.7107874168403053465719309061m), // 19 / 8
+ new TestResult(0, -32086679207305516282.844795417m), // 19 / 9
+ new TestResult(0, -2121.0584726774239906503858037m), // 19 / 10
+ new TestResult(0, -188558795.66094477019222763757m), // 19 / 11
+ new TestResult(0, 134746247763650063417846672.74m), // 19 / 12
+ new TestResult(0, -256711.90097962787395549999647m), // 19 / 13
+ new TestResult(0, 461.29825131408293475234811789m), // 19 / 14
+ new TestResult(0, 7.2161135175168023022995955438m), // 19 / 15
+ new TestResult(0, -244111558563287122929.04506056m), // 19 / 16
+ new TestResult(0, 4202258629.2276083227657702227m), // 19 / 17
+ new TestResult(0, -19.311677908019711128996883838m), // 19 / 18
+ new TestResult(0, 1m), // 19 / 19
+ new TestResult(0, 14517216445692969.517326696553m), // 19 / 20
+ new TestResult(0, 247265192865059.0518154425151m), // 19 / 21
+ new TestResult(0, -16089333432314.039236231362245m), // 19 / 22
+ new TestResult(0, 232399525463.06860877964908684m), // 19 / 23
+ new TestResult(0, -200456892730.3205001486617745m), // 19 / 24
+ new TestResult(0, 168819535.86204710848979659043m), // 19 / 25
+ new TestResult(0, -2416.8552333191352676140967438m), // 19 / 26
+ new TestResult(0, -13165.657265554370962757268367m), // 19 / 27
+ new TestResult(2, 0.0990559941406113443335355768m), // 19 / 28
+ new TestResult(0, -20572050535883517.889932557941m), // 19 / 29
+ new TestResult(3, 0m), // 20 / 0
+ new TestResult(0, 7081320760.3793287174700927968m), // 20 / 1
+ new TestResult(0, -7081320760.3793287174700927968m), // 20 / 2
+ new TestResult(0, 3540660380.1896643587350463984m), // 20 / 3
+ new TestResult(0, 708132076.03793287174700927968m), // 20 / 4
+ new TestResult(0, 70813207603.793287174700927968m), // 20 / 5
+ new TestResult(2, 8.93788337E-20m), // 20 / 6
+ new TestResult(2, -8.93788337E-20m), // 20 / 7
+ new TestResult(2, 2.556128739088E-16m), // 20 / 8
+ new TestResult(0, -2210.250107335496183875574735m), // 20 / 9
+ new TestResult(2, -1.461064165166945E-13m), // 20 / 10
+ new TestResult(2, -1.2988632935681496171E-08m), // 20 / 11
+ new TestResult(2, 9281823982.422412820396304075m), // 20 / 12
+ new TestResult(2, -1.76832729566273202E-11m), // 20 / 13
+ new TestResult(2, 3.17759436211301E-14m), // 20 / 14
+ new TestResult(2, 4.970728062443E-16m), // 20 / 15
+ new TestResult(2, -16815.314387332923907118773285m), // 20 / 16
+ new TestResult(2, 2.894672435964370128732E-07m), // 20 / 17
+ new TestResult(2, -1.3302603829227E-15m), // 20 / 18
+ new TestResult(2, 6.88837287603E-17m), // 20 / 19
+ new TestResult(0, 1m), // 20 / 20
+ new TestResult(2, 0.0170325484771854288433021822m), // 20 / 21
+ new TestResult(2, -0.0011082932800859005017661851m), // 20 / 22
+ new TestResult(2, 1.60085458760255588702037E-05m), // 20 / 23
+ new TestResult(2, -1.38082182269723557757959E-05m), // 20 / 24
+ new TestResult(2, 1.16289191177647018971E-08m), // 20 / 25
+ new TestResult(2, -1.6648200034492E-13m), // 20 / 26
+ new TestResult(2, -9.068995640318096E-13m), // 20 / 27
+ new TestResult(2, 6.8233462325E-18m), // 20 / 28
+ new TestResult(2, -1.4170795491574366313541174399m), // 20 / 29
+ new TestResult(3, 0m), // 21 / 0
+ new TestResult(0, 415752273939.77704245656837041m), // 21 / 1
+ new TestResult(0, -415752273939.77704245656837041m), // 21 / 2
+ new TestResult(2, 207876136969.8885212282841852m), // 21 / 3
+ new TestResult(0, 41575227393.977704245656837041m), // 21 / 4
+ new TestResult(0, 4157522739397.7704245656837041m), // 21 / 5
+ new TestResult(2, 5.2475314427E-18m), // 21 / 6
+ new TestResult(2, -5.2475314427E-18m), // 21 / 7
+ new TestResult(2, 1.50073181503771E-14m), // 21 / 8
+ new TestResult(2, -129766.25959973387113808743405m), // 21 / 9
+ new TestResult(2, -8.5780713738991847E-12m), // 21 / 10
+ new TestResult(2, -7.625771887911763590261E-07m), // 21 / 11
+ new TestResult(0, 544946282986.07977368508338172m), // 21 / 12
+ new TestResult(2, -1.0382047630930577807E-09m), // 21 / 13
+ new TestResult(2, 1.8656012436244067E-12m), // 21 / 14
+ new TestResult(2, 2.91837012476515E-14m), // 21 / 15
+ new TestResult(2, -987245.9432513294606844938685m), // 21 / 16
+ new TestResult(2, 1.69949461164997956913075E-05m), // 21 / 17
+ new TestResult(2, -7.81010771643817E-14m), // 21 / 18
+ new TestResult(2, 4.0442408752037E-15m), // 21 / 19
+ new TestResult(0, 58.711120143850993772970798576m), // 21 / 20
+ new TestResult(0, 1m), // 21 / 21
+ new TestResult(2, -0.0650691399217460043995169619m), // 21 / 22
+ new TestResult(2, 0.0009398796602556869430220663m), // 21 / 23
+ new TestResult(2, -0.0008106959592962871308194687m), // 21 / 24
+ new TestResult(2, 6.827468674662091164433E-07m), // 21 / 25
+ new TestResult(2, -9.7743447240392408E-12m), // 21 / 26
+ new TestResult(2, -5.32450892622776623E-11m), // 21 / 27
+ new TestResult(2, 4.006063004374E-16m), // 21 / 28
+ new TestResult(2, -83.19832766397646235747803502m), // 21 / 29
+ new TestResult(3, 0m), // 22 / 0
+ new TestResult(0, -6389392489892.6362673670820462m), // 22 / 1
+ new TestResult(0, 6389392489892.6362673670820462m), // 22 / 2
+ new TestResult(0, -3194696244946.3181336835410231m), // 22 / 3
+ new TestResult(0, -638939248989.26362673670820462m), // 22 / 4
+ new TestResult(0, -63893924898926.362673670820462m), // 22 / 5
+ new TestResult(2, -8.06454710942E-17m), // 22 / 6
+ new TestResult(2, 8.06454710942E-17m), // 22 / 7
+ new TestResult(2, -2.306364917136659E-13m), // 22 / 8
+ new TestResult(2, 1994282.6930829954142428134453m), // 22 / 9
+ new TestResult(2, 1.31830102322167113E-10m), // 22 / 10
+ new TestResult(2, 1.17194908324940723524544E-05m), // 22 / 11
+ new TestResult(2, -8374880682938.911591614017805m), // 22 / 12
+ new TestResult(2, 1.59554093436863052632E-08m), // 22 / 13
+ new TestResult(2, -2.8671060442293101E-11m), // 22 / 14
+ new TestResult(2, -4.485029505960676E-13m), // 22 / 15
+ new TestResult(2, 15172260.52839517272431927284m), // 22 / 16
+ new TestResult(2, -0.0002611828915663923103773216m), // 22 / 17
+ new TestResult(2, 1.2002783079399592E-12m), // 22 / 18
+ new TestResult(2, -6.21529788171079E-14m), // 22 / 19
+ new TestResult(2, -902.2882462325251912660653119m), // 22 / 20
+ new TestResult(2, -15.368268294350108200187006165m), // 22 / 21
+ new TestResult(0, 1m), // 22 / 22
+ new TestResult(2, -0.0144443227832120251558802997m), // 22 / 23
+ new TestResult(2, 0.0124589930076108753677011728m), // 22 / 24
+ new TestResult(2, -1.04926370363477969575619E-05m), // 22 / 25
+ new TestResult(2, 1.50214752120500522E-10m), // 22 / 26
+ new TestResult(2, 8.182848171393031905E-10m), // 22 / 27
+ new TestResult(2, -6.156625105529E-15m), // 22 / 28
+ new TestResult(2, 1278.6142211812409691677177837m), // 22 / 29
+ new TestResult(3, 0m), // 23 / 0
+ new TestResult(0, 442346282742915.0596416330681m), // 23 / 1
+ new TestResult(0, -442346282742915.0596416330681m), // 23 / 2
+ new TestResult(0, 221173141371457.52982081653405m), // 23 / 3
+ new TestResult(0, 44234628274291.50596416330681m), // 23 / 4
+ new TestResult(0, 4423462827429150.596416330681m), // 23 / 5
+ new TestResult(2, 5.5831950244116E-15m), // 23 / 6
+ new TestResult(2, -5.5831950244116E-15m), // 23 / 7
+ new TestResult(2, 1.59672762216117307E-11m), // 23 / 8
+ new TestResult(0, -138066887.80181919317571960944m), // 23 / 9
+ new TestResult(2, -9.1267762636395250963E-09m), // 23 / 10
+ new TestResult(2, -0.0008113561991369439495762269m), // 23 / 11
+ new TestResult(0, 579804315413987.55317875373327m), // 23 / 12
+ new TestResult(2, -1.104614566093091384748E-06m), // 23 / 13
+ new TestResult(2, 1.9849362876061009571E-09m), // 23 / 14
+ new TestResult(2, 3.10504658008156699E-11m), // 23 / 15
+ new TestResult(2, -1050396114.5225303515983863327m), // 23 / 16
+ new TestResult(2, 0.018082044792709369766201304m), // 23 / 17
+ new TestResult(2, -8.30968904499273382E-11m), // 23 / 18
+ new TestResult(2, 4.3029347758238576E-12m), // 23 / 19
+ new TestResult(0, 62466.635492334295970467255163m), // 23 / 20
+ new TestResult(2, 1063.9659972298557739709718754m), // 23 / 21
+ new TestResult(0, -69.231352345729507070036842909m), // 23 / 22
+ new TestResult(0, 1m), // 23 / 23
+ new TestResult(2, -0.8625529347828887027197930493m), // 23 / 24
+ new TestResult(2, 0.000726419451699245356034835m), // 23 / 25
+ new TestResult(2, -1.03995704315807902618E-08m), // 23 / 26
+ new TestResult(2, -5.66509644945319386873E-08m), // 23 / 27
+ new TestResult(2, 4.262314819414408E-13m), // 23 / 28
+ new TestResult(0, -88520.19166085901375500091819m), // 23 / 29
+ new TestResult(3, 0m), // 24 / 0
+ new TestResult(0, -512833780867323.89020837443764m), // 24 / 1
+ new TestResult(0, 512833780867323.89020837443764m), // 24 / 2
+ new TestResult(0, -256416890433661.94510418721882m), // 24 / 3
+ new TestResult(0, -51283378086732.389020837443764m), // 24 / 4
+ new TestResult(0, -5128337808673238.9020837443764m), // 24 / 5
+ new TestResult(2, -6.4728723296466E-15m), // 24 / 6
+ new TestResult(2, 6.4728723296466E-15m), // 24 / 7
+ new TestResult(2, -1.85116478974485417E-11m), // 24 / 8
+ new TestResult(0, 160067727.13209967231293920454m), // 24 / 9
+ new TestResult(2, 1.05811201789450821647E-08m), // 24 / 10
+ new TestResult(2, 0.0009406451087447388135269385m), // 24 / 11
+ new TestResult(0, -672195632329427.78049892650167m), // 24 / 12
+ new TestResult(2, 1.280633943203881720602E-06m), // 24 / 13
+ new TestResult(2, -2.3012341707535026743E-09m), // 24 / 14
+ new TestResult(2, -3.59983307095596564E-11m), // 24 / 15
+ new TestResult(2, 1217775828.2011100471829103026m), // 24 / 16
+ new TestResult(2, -0.0209634030139388041036175456m), // 24 / 17
+ new TestResult(2, 9.63383081768117492E-11m), // 24 / 18
+ new TestResult(2, -4.988603716138233E-12m), // 24 / 19
+ new TestResult(0, -72420.639908967018993409156115m), // 24 / 20
+ new TestResult(2, -1233.5080599982704934889448056m), // 24 / 21
+ new TestResult(2, 80.26330855062892819843621147m), // 24 / 22
+ new TestResult(0, -1.1593491363538259770624590073m), // 24 / 23
+ new TestResult(0, 1m), // 24 / 24
+ new TestResult(2, -0.0008421737639581399076256596m), // 24 / 25
+ new TestResult(2, 1.20567329983039744731E-08m), // 24 / 26
+ new TestResult(2, 6.56782467603468627053E-08m), // 24 / 27
+ new TestResult(2, -4.941511004756208E-13m), // 24 / 28
+ new TestResult(2, 102625.80775189204591883200668m), // 24 / 29
+ new TestResult(3, 0m), // 25 / 0
+ new TestResult(0, 608940580690915704.1450897514m), // 25 / 1
+ new TestResult(0, -608940580690915704.1450897514m), // 25 / 2
+ new TestResult(0, 304470290345457852.0725448757m), // 25 / 3
+ new TestResult(0, 60894058069091570.41450897514m), // 25 / 4
+ new TestResult(0, 6089405806909157041.450897514m), // 25 / 5
+ new TestResult(2, 7.6859106833543095E-12m), // 25 / 6
+ new TestResult(2, -7.6859106833543095E-12m), // 25 / 7
+ new TestResult(2, 2.19807938571316735336E-08m), // 25 / 8
+ new TestResult(2, -190064965191.73899284873850192m), // 25 / 9
+ new TestResult(2, -1.2564058192949139177057E-05m), // 25 / 10
+ new TestResult(2, -1.1169252106878663178369471734m), // 25 / 11
+ new TestResult(2, 798167386704341861.9682340376m), // 25 / 12
+ new TestResult(2, -0.0015206291124352045188095451m), // 25 / 13
+ new TestResult(2, 2.7324933039209294299951E-06m), // 25 / 14
+ new TestResult(2, 4.27445406757517405142E-08m), // 25 / 15
+ new TestResult(0, -1445991172270.2862199666258075m), // 25 / 16
+ new TestResult(2, 24.892016245451201449485802529m), // 25 / 17
+ new TestResult(2, -1.143924357415629812325E-07m), // 25 / 18
+ new TestResult(2, 5.9234850687965514433E-09m), // 25 / 19
+ new TestResult(2, 85992514.8565500475609760009m), // 25 / 20
+ new TestResult(2, 1464671.6779692768786214751455m), // 25 / 21
+ new TestResult(2, -95304.9263532013818698238713m), // 25 / 22
+ new TestResult(2, 1376.6151190758908669955780933m), // 25 / 23
+ new TestResult(2, -1187.4034110254054607086172841m), // 25 / 24
+ new TestResult(0, 1m), // 25 / 25
+ new TestResult(2, -1.43162058880087033607313E-05m), // 25 / 26
+ new TestResult(2, -7.79865742334041504368931E-05m), // 25 / 27
+ new TestResult(2, 5.867567022667099857E-10m), // 25 / 28
+ new TestResult(2, -121858234.18383411295432055833m), // 25 / 29
+ new TestResult(3, 0m), // 26 / 0
+ new TestResult(0, -42535053313319986966115.037787m), // 26 / 1
+ new TestResult(0, 42535053313319986966115.037787m), // 26 / 2
+ new TestResult(2, -21267526656659993483057.518894m), // 26 / 3
+ new TestResult(0, -4253505331331998696611.5037787m), // 26 / 4
+ new TestResult(0, -425350533133199869661150.37787m), // 26 / 5
+ new TestResult(2, -5.368678505659136383798E-07m), // 26 / 6
+ new TestResult(2, 5.368678505659136383798E-07m), // 26 / 7
+ new TestResult(2, -0.0015353784395866262203076433m), // 26 / 8
+ new TestResult(2, 13276210657946598.343741130625m), // 26 / 9
+ new TestResult(2, 0.8776108901502200170717671109m), // 26 / 10
+ new TestResult(0, 78018.241664392812128305230978m), // 26 / 11
+ new TestResult(0, -55752717790464947101601.359896m), // 26 / 12
+ new TestResult(2, 106.21732631750483463727976216m), // 26 / 13
+ new TestResult(2, -0.1908671421252521905897157731m), // 26 / 14
+ new TestResult(2, -0.0029857450367876236635795704m), // 26 / 15
+ new TestResult(2, 101003798323510611.65980529603m), // 26 / 16
+ new TestResult(0, -1738729.9707879186275737174853m), // 26 / 17
+ new TestResult(2, 0.0079904156615530673319808542m), // 26 / 18
+ new TestResult(2, -0.0004137608186927571471957746m), // 26 / 19
+ new TestResult(0, -6006655361709.8810944800037905m), // 26 / 20
+ new TestResult(2, -102308648634.06932650747319597m), // 26 / 21
+ new TestResult(0, 6657135773.1750052361186583781m), // 26 / 22
+ new TestResult(2, -96157817.91940752862823678187m), // 26 / 23
+ new TestResult(2, 82941208.04870360868726566113m), // 26 / 24
+ new TestResult(0, -69850.909369611886817979504214m), // 26 / 25
+ new TestResult(0, 1m), // 26 / 26
+ new TestResult(0, 5.4474331288240229212686639513m), // 26 / 27
+ new TestResult(2, -4.09854892320443047650146E-05m), // 26 / 28
+ new TestResult(0, 8511908471915.937756062101659m), // 26 / 29
+ new TestResult(3, 0m), // 27 / 0
+ new TestResult(0, -7808274522591953107485.8812311m), // 27 / 1
+ new TestResult(0, 7808274522591953107485.8812311m), // 27 / 2
+ new TestResult(2, -3904137261295976553742.9406156m), // 27 / 3
+ new TestResult(0, -780827452259195310748.58812311m), // 27 / 4
+ new TestResult(0, -78082745225919531074858.812311m), // 27 / 5
+ new TestResult(2, -9.85542801296968307756E-08m), // 27 / 6
+ new TestResult(2, 9.85542801296968307756E-08m), // 27 / 7
+ new TestResult(2, -0.000281853563555002197999826m), // 27 / 8
+ new TestResult(2, 2437149817901964.8960845694514m), // 27 / 9
+ new TestResult(2, 0.1611053994415304138070003376m), // 27 / 10
+ new TestResult(2, 14322.019163773595213651372685m), // 27 / 11
+ new TestResult(2, -10234676860090376638967.506512m), // 27 / 12
+ new TestResult(2, 19.498601232106311831598265533m), // 27 / 13
+ new TestResult(2, -0.0350379963574616786880617938m), // 27 / 14
+ new TestResult(2, -0.0005481012737887758520091497m), // 27 / 15
+ new TestResult(2, 18541539828927654.501195934005m), // 27 / 16
+ new TestResult(2, -319183.3529057512147016471775m), // 27 / 17
+ new TestResult(2, 0.0014668221660718241029342142m), // 27 / 18
+ new TestResult(2, -7.59551900698740123366376E-05m), // 27 / 19
+ new TestResult(2, -1102657934418.1103423727465413m), // 27 / 20
+ new TestResult(2, -18781074721.729615778535996388m), // 27 / 21
+ new TestResult(2, 1222068378.9489912725931951927m), // 27 / 22
+ new TestResult(2, -17651950.128695901472129097893m), // 27 / 23
+ new TestResult(0, 15225741.38814783974528909088m), // 27 / 24
+ new TestResult(2, -12822.719933909700245783228909m), // 27 / 25
+ new TestResult(2, 0.1835726986181246222761380025m), // 27 / 26
+ new TestResult(0, 1m), // 27 / 27
+ new TestResult(2, -7.5238168625104611316081E-06m), // 27 / 28
+ new TestResult(2, 1562554008580.0861321324839011m), // 27 / 29
+ new TestResult(3, 0m), // 28 / 0
+ new TestResult(0, 1037807626804273037330059471.7m), // 28 / 1
+ new TestResult(0, -1037807626804273037330059471.7m), // 28 / 2
+ new TestResult(0, 518903813402136518665029735.85m), // 28 / 3
+ new TestResult(0, 103780762680427303733005947.17m), // 28 / 4
+ new TestResult(0, 10378076268042730373300594717m), // 28 / 5
+ new TestResult(2, 0.013098973822817421173845813m), // 28 / 6
+ new TestResult(2, -0.013098973822817421173845813m), // 28 / 7
+ new TestResult(0, 37.461513046578399246836695461m), // 28 / 8
+ new TestResult(0, -323924659841968113506.41166762m), // 28 / 9
+ new TestResult(0, -21412.722077843692663812014719m), // 28 / 10
+ new TestResult(0, -1903557652.3848013647110715272m), // 28 / 11
+ new TestResult(0, 1360303825454277040707598638.1m), // 28 / 12
+ new TestResult(0, -2591583.7118874583629347087379m), // 28 / 13
+ new TestResult(0, 4656.9443405844146143879311m), // 28 / 14
+ new TestResult(0, 72.848832421725332869329889807m), // 28 / 15
+ new TestResult(0, -2464379472248467996678.919247m), // 28 / 16
+ new TestResult(0, 42423062487.893912564215173398m), // 28 / 17
+ new TestResult(0, -194.95718634257023426451589779m), // 28 / 18
+ new TestResult(0, 10.095300225653040883323838635m), // 28 / 19
+ new TestResult(0, 146555658460058271.30028503504m), // 28 / 20
+ new TestResult(0, 2496216357326773.3203945609668m), // 28 / 21
+ new TestResult(0, -162426651429846.93508891542812m), // 28 / 22
+ new TestResult(0, 2346142981848.9761467960716552m), // 28 / 23
+ new TestResult(0, -2023672514414.1119557698582125m), // 28 / 24
+ new TestResult(0, 1704283898.4827658021193146276m), // 28 / 25
+ new TestResult(0, -24398.879182297399040382596287m), // 28 / 26
+ new TestResult(0, -132911.26276382163838029345835m), // 28 / 27
+ new TestResult(0, 1m), // 28 / 28
+ new TestResult(0, -207681026417050638.7817636979m), // 28 / 29
+ new TestResult(3, 0m), // 29 / 0
+ new TestResult(0, -4997122966.448652425771563042m), // 29 / 1
+ new TestResult(0, 4997122966.448652425771563042m), // 29 / 2
+ new TestResult(0, -2498561483.224326212885781521m), // 29 / 3
+ new TestResult(0, -499712296.6448652425771563042m), // 29 / 4
+ new TestResult(0, -49971229664.48652425771563042m), // 29 / 5
+ new TestResult(2, -6.30725591E-20m), // 29 / 6
+ new TestResult(2, 6.30725591E-20m), // 29 / 7
+ new TestResult(2, -1.803800457503E-16m), // 29 / 8
+ new TestResult(0, 1559.7219709011119254589559305m), // 29 / 9
+ new TestResult(2, 1.031038918059089E-13m), // 29 / 10
+ new TestResult(2, 9.1657754452841005337E-09m), // 29 / 11
+ new TestResult(0, -6549966787.6381215871101448624m), // 29 / 12
+ new TestResult(2, 1.24786734570697837E-11m), // 29 / 13
+ new TestResult(2, -2.24235425880102E-14m), // 29 / 14
+ new TestResult(2, -3.507726905944E-16m), // 29 / 15
+ new TestResult(2, 11866.175330334086443056587349m), // 29 / 16
+ new TestResult(2, -2.042702851569255038994E-07m), // 29 / 17
+ new TestResult(2, 9.387337384931E-16m), // 29 / 18
+ new TestResult(2, -4.86096414286E-17m), // 29 / 19
+ new TestResult(2, -0.705676685966272906628710787m), // 29 / 20
+ new TestResult(2, -0.0120194723629401016807892544m), // 29 / 21
+ new TestResult(2, 0.0007820967289697085504718691m), // 29 / 22
+ new TestResult(2, -1.1296857600932761513324E-05m), // 29 / 23
+ new TestResult(2, 9.7441376775089367720444E-06m), // 29 / 24
+ new TestResult(2, -8.2062571043940289217E-09m), // 29 / 25
+ new TestResult(2, 1.17482466276439E-13m), // 29 / 26
+ new TestResult(2, 6.399778788502251E-13m), // 29 / 27
+ new TestResult(2, -4.8150763565E-18m), // 29 / 28
+ new TestResult(0, 1m), // 29 / 29
+ };
+
+ #endregion
+ }
+}
diff --git a/mcs/class/corlib/Test/System/DoubleTest.cs b/mcs/class/corlib/Test/System/DoubleTest.cs
new file mode 100644
index 00000000000..c0c443f7da4
--- /dev/null
+++ b/mcs/class/corlib/Test/System/DoubleTest.cs
@@ -0,0 +1,169 @@
+// BooleanTest.cs - NUnit Test Cases for the System.Double class
+//
+// Bob Doan <bdoan@sicompos.com>
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class DoubleTest : TestCase
+{
+ private const Double d_zero = 0.0;
+ private const Double d_neg = -1234.5678;
+ private const Double d_pos = 1234.9999;
+ private const Double d_pos2 = 1234.9999;
+ private const Double d_nan = Double.NaN;
+ private const Double d_pinf = Double.PositiveInfinity;
+ private const Double d_ninf = Double.NegativeInfinity;
+ private const String s = "What Ever";
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+
+ private string[] string_values = {"1", ".1", "1.1", "-12", "44.444432", ".000021121",
+ " .00001", " .223 ", " -221.3233",
+ " 1.7976931348623157e308 ", "+1.7976931348623157E308", "-1.7976931348623157e308",
+ "4.9406564584124650e-324"};
+ private double[] double_values = {1, .1, 1.1, -12, 44.444432, .000021121,
+ .00001, .223, -221.3233,
+ 1.7976931348623157e308, 1.7976931348623157e308, -1.7976931348623157e308,
+ 4.9406564584124650e-324};
+
+ public DoubleTest () : base ("MonoTests.System.DoubleTests testcase") {}
+ public DoubleTest (string name) : base (name) {}
+
+
+ protected override void SetUp ()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (DoubleTest));
+ }
+ }
+
+ public void TestPublicFields ()
+ {
+ AssertEquals("Epsilon Field has wrong value", 3.9406564584124654e-324, Double.Epsilon);
+ AssertEquals("MaxValue Field has wrong value", 1.7976931348623157e+308, Double.MaxValue);
+ AssertEquals("MinValue Field has wrong value", -1.7976931348623157e+308, Double.MinValue);
+ AssertEquals("NegativeInfinity Field has wrong value", (double)-1.0 / (double)(0.0), Double.NegativeInfinity);
+ AssertEquals("PositiveInfinity Field has wrong value", (double)1.0 / (double)(0.0), Double.PositiveInfinity);
+ }
+
+ public void TestCompareTo () {
+ //If you do int foo = d_ninf.CompareTo(d_pinf); Assert(".." foo < 0, true) this works.... WHY???
+ AssertEquals("CompareTo Infinity failed", d_ninf.CompareTo(d_pinf) < 0, true);
+
+ AssertEquals("CompareTo Failed01", d_neg.CompareTo(d_pos) < 0, true);
+ AssertEquals("CompareTo NaN Failed", d_nan.CompareTo(d_neg) < 0, true);
+
+ AssertEquals("CompareTo Failed02", 0, d_pos.CompareTo(d_pos2));
+ AssertEquals("CompareTo Failed03", 0, d_pinf.CompareTo(d_pinf));
+ AssertEquals("CompareTo Failed04", 0, d_ninf.CompareTo(d_ninf));
+ AssertEquals("CompareTo Failed05", 0, d_nan.CompareTo(d_nan));
+
+ Assert("CompareTo Failed06", d_pos.CompareTo(d_neg) > 0);
+ Assert("CompareTo Failed07", d_pos.CompareTo(d_nan) > 0);
+ Assert("CompareTo Failed08", d_pos.CompareTo(null) > 0);
+
+ try {
+ d_pos.CompareTo(s);
+ Fail("CompareTo should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert("CompareTo should be a System.ArgumentException", typeof(ArgumentException) == e.GetType());
+ }
+
+ }
+
+ public void TestEquals () {
+ AssertEquals("Equals Failed", true, d_pos.Equals(d_pos2));
+ AssertEquals("Equals Failed", false, d_pos.Equals(d_neg));
+ AssertEquals("Equals Failed", false, d_pos.Equals(s));
+
+ }
+
+ public void TestTypeCode () {
+ AssertEquals("GetTypeCode Failed", TypeCode.Double, d_pos.GetTypeCode());
+ }
+
+ public void TestIsInfinity() {
+ AssertEquals("IsInfinity Failed", true, Double.IsInfinity(Double.PositiveInfinity));
+ AssertEquals("IsInfinity Failed", true, Double.IsInfinity(Double.NegativeInfinity));
+ AssertEquals("IsInfinity Failed", false, Double.IsInfinity(12));
+ }
+
+ public void TestIsNan() {
+ AssertEquals("IsNan Failed", true, Double.IsNaN(Double.NaN));
+ AssertEquals("IsNan Failed", false, Double.IsNaN(12));
+ AssertEquals("IsNan Failed", false, Double.IsNaN(Double.PositiveInfinity));
+ }
+
+ public void TestIsNegativeInfinity() {
+ AssertEquals("IsNegativeInfinity Failed", true, Double.IsNegativeInfinity(Double.NegativeInfinity));
+ AssertEquals("IsNegativeInfinity Failed", false, Double.IsNegativeInfinity(12));
+ }
+
+ public void TestIsPositiveInfinity() {
+ AssertEquals("IsPositiveInfinity Failed", true, Double.IsPositiveInfinity(Double.PositiveInfinity));
+ AssertEquals("IsPositiveInfinity Failed", false, Double.IsPositiveInfinity(12));
+ }
+
+ public void TestParse() {
+ int i=0;
+ for(i=0;i<string_values.Length;i++) {
+ AssertEquals("Parse Failed", double_values[i], Double.Parse(string_values[i]));
+ }
+
+ AssertEquals("Parse Failed NumberStyles.Float", 10.1111, Double.Parse(" 10.1111 ", NumberStyles.Float, Nfi));
+ AssertEquals("Parse Failed NumberStyles.AllowThousands", 1234.5678, Double.Parse("1,234.5678", NumberStyles.Float | NumberStyles.AllowThousands, Nfi));
+
+ try {
+ Double.Parse(null);
+ Fail("Parse should raise a ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert("Parse should be a ArgumentNullException", typeof(ArgumentNullException) == e.GetType());
+ }
+
+ try {
+ Double.Parse("save the elk");
+ Fail("Parse should raise a FormatException");
+ }
+ catch (Exception e) {
+ Assert("Parse should be a FormatException", typeof(FormatException) == e.GetType());
+ }
+
+ try {
+ Double.Parse("1.79769313486232e308");
+ Fail("Parse should have raised an OverflowException +");
+ }
+ catch (Exception e) {
+ AssertEquals("Should be an OverflowException +", typeof(OverflowException), e.GetType());
+ }
+
+ try {
+ Double.Parse("-1.79769313486232e308");
+ Fail("Parse should have raised an OverflowException -");
+ }
+ catch (Exception e) {
+ AssertEquals("Should be an OverflowException -", typeof(OverflowException), e.GetType());
+ }
+
+
+ }
+
+ public void TestToString() {
+ //ToString is not yet Implemented......
+ //AssertEquals("ToString Failed", "1234.9999", d_pos.ToString());
+ }
+
+}
+}
diff --git a/mcs/class/corlib/Test/System/EnumTest.cs b/mcs/class/corlib/Test/System/EnumTest.cs
new file mode 100644
index 00000000000..4b6ac0f786c
--- /dev/null
+++ b/mcs/class/corlib/Test/System/EnumTest.cs
@@ -0,0 +1,728 @@
+// EnumTest.cs - NUnit Test Cases for the System.Enum class
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+
+
+namespace MonoTests.System
+{
+
+public class EnumTest : TestCase
+{
+ public EnumTest() : base ("MonoTests.System.EnumTest testsuite") {}
+ public EnumTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(EnumTest));
+ }
+ }
+
+ enum TestingEnum {This, Is, A, Test};
+ enum TestingEnum2 {This, Is, A, Test};
+
+ public void TestCompareTo() {
+ Enum e1 = new TestingEnum();
+ Enum e2 = new TestingEnum();
+ Enum e3 = new TestingEnum2();
+
+ AssertEquals("An enum should equal itself",
+ 0, e1.CompareTo(e1));
+ AssertEquals("An enum should equal a copy",
+ 0, e1.CompareTo(e2));
+
+ TestingEnum x = TestingEnum.This;
+ TestingEnum y = TestingEnum.Is;
+ AssertEquals("should equal", 0, x.CompareTo(x));
+ AssertEquals("less than", -1, x.CompareTo(y));
+ AssertEquals("greater than", 1, y.CompareTo(x));
+
+ {
+ bool errorThrown = false;
+ try {
+ e1.CompareTo(e3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("1) Compare type mismatch not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ ((Enum)e1).CompareTo((Enum)e3);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("2) Compare type mismatch not caught.",
+ errorThrown);
+ }
+ }
+
+ public void TestEquals() {
+ Enum e1 = new TestingEnum();
+ Enum e2 = new TestingEnum();
+ Enum e3 = new TestingEnum2();
+
+ Assert("An enum should equal itself", e1.Equals(e1));
+ Assert("An enum should equal a copy", e1.Equals(e2));
+
+ Assert("Shouldn't match", !e1.Equals(e3));
+ Assert("Shouldn't match null", !e1.Equals(null));
+ }
+
+ public void TestFormat() {
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Format(null, x, "G");
+ Fail("null first arg not caught.");
+ } catch (ArgumentNullException) {
+ return;
+ } catch (Exception e) {
+ Fail("first arg null, wrong exception: " + e.ToString());
+ }
+ Fail ("01 - Should not be here");
+
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Format(x.GetType(), null, "G");
+ Fail("null second arg not caught.");
+ } catch (ArgumentNullException) {
+ return;
+ } catch (Exception e) {
+ Fail("second arg null, wrong exception: " + e.ToString());
+ }
+ Fail ("02 - Should not be here");
+
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Format(x.GetType(), x, null);
+ Fail("null third arg not caught.");
+ } catch (ArgumentNullException) {
+ return;
+ } catch (Exception e) {
+ Fail("third arg null, wrong exception: " + e.ToString());
+ }
+ Fail ("03 - Should not be here");
+
+ try {
+ String bad = "huh?";
+ TestingEnum x = TestingEnum.Test;
+ Enum.Format(bad.GetType(), x, "G");
+ Fail("bad type arg not caught.");
+ } catch (ArgumentNullException) {
+ return;
+ } catch (Exception e) {
+ Fail("bad type, wrong exception: " + e.ToString());
+ }
+ Fail ("04 - Should not be here");
+
+ try {
+ TestingEnum x = TestingEnum.Test;
+ TestingEnum2 y = TestingEnum2.Test;
+ Enum.Format(y.GetType(), x, "G");
+ Fail("wrong enum type not caught.");
+ } catch (ArgumentNullException) {
+ return;
+ } catch (Exception e) {
+ Fail("wrong enum type, wrong exception: " + e.ToString());
+ }
+ Fail ("05 - Should not be here");
+
+ try {
+ String bad = "huh?";
+ TestingEnum x = TestingEnum.Test;
+ Enum.Format(x.GetType(), bad, "G");
+ Fail("non-enum object not caught.");
+ } catch (ArgumentNullException) {
+ return;
+ } catch (Exception e) {
+ Fail("non-enum object, wrong exception: " + e.ToString());
+ }
+ Fail ("06 - Should not be here");
+
+ string[] codes = {"a", "b", "c", "ad", "e", "af", "ag", "h",
+ "i", "j", "k", "l", "m", "n", "o", "p",
+ "q", "r", "s", "t", "u", "v", "w", "ax",
+ "y", "z"};
+ foreach (string code in codes) {
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Format(x.GetType(), x, code);
+ Fail ("bad format code not caught - " + code);
+ } catch (FormatException) {
+
+ } catch (Exception e) {
+ Fail ("bad format code, wrong exception: " + e.ToString());
+ }
+ }
+
+ {
+ TestingEnum x = TestingEnum.Test;
+ AssertEquals("decimal format wrong",
+ "3", Enum.Format(x.GetType(), x, "d"));
+ AssertEquals("named format wrong",
+ "Test", Enum.Format(x.GetType(), x, "g"));
+ AssertEquals("hex format wrong",
+ "00000003", Enum.Format(x.GetType(), x, "x"));
+ AssertEquals("bitfield format wrong",
+ "Test", Enum.Format(x.GetType(), x, "f"));
+ }
+ }
+
+ public void TestGetHashCode() {
+ Enum e1 = new TestingEnum();
+ Enum e2 = new TestingEnum2();
+
+ AssertEquals("hash code is deterministic",
+ e1.GetHashCode(), e1.GetHashCode());
+ }
+
+ public void GetName() {
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.GetName(null, x);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null first arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.GetName(x.GetType(), null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null second arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ TestingEnum x = TestingEnum.Test;
+ Enum.GetName(bad.GetType(), x);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ TestingEnum2 y = TestingEnum2.Test;
+ Enum.GetName(y.GetType(), x);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("wrong enum type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ TestingEnum x = TestingEnum.Test;
+ Enum.GetName(x.GetType(), bad);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum object not caught.",
+ errorThrown);
+ }
+ {
+ TestingEnum x = TestingEnum.This;
+ TestingEnum y = TestingEnum.Is;
+ TestingEnum z = TestingEnum.A;
+
+ AssertEquals("first name doesn't match",
+ "This", Enum.GetName(x.GetType(), x));
+ AssertEquals("second name doesn't match",
+ "Is", Enum.GetName(y.GetType(), y));
+ AssertEquals("third name doesn't match",
+ "A", Enum.GetName(z.GetType(), z));
+ }
+ }
+
+ public void TestGetNames() {
+ {
+ bool errorThrown = false;
+ try {
+ Enum.GetNames(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null type not caught.",
+ errorThrown);
+ }
+ {
+ TestingEnum x = TestingEnum.This;
+ string[] match = {"This", "Is", "A", "Test"};
+ string[] names = Enum.GetNames(x.GetType());
+ AssertNotNull("Got no names", names);
+ AssertEquals("names wrong size",
+ match.Length, names.Length);
+ for (int i = 0; i < names.Length; i++) {
+ AssertEquals("name mismatch",
+ match[i], names[i]);
+ }
+ }
+ }
+
+ public void TestGetTypeCode() {
+ TestingEnum x = TestingEnum.This;
+ TestingEnum y = new TestingEnum();
+ AssertEquals("01 bad type code",
+ TypeCode.Int32, x.GetTypeCode());
+ AssertEquals("02 bad type code",
+ TypeCode.Int32, y.GetTypeCode());
+ }
+
+ enum TestShortEnum : short { zero, one, two, three, four, five, six};
+ public void TestGetUnderlyingType() {
+ {
+ bool errorThrown = false;
+ try {
+ Enum.GetUnderlyingType(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ Enum.GetUnderlyingType(bad.GetType());
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+ {
+ short sh = 5;
+ int i = 5;
+ Enum t1 = new TestingEnum();
+ Enum t2 = new TestShortEnum();
+ AssertEquals("Wrong default underlying type",
+ i.GetType(),
+ Enum.GetUnderlyingType(t1.GetType()));
+ AssertEquals("Not short underlying type",
+ sh.GetType(),
+ Enum.GetUnderlyingType(t2.GetType()));
+ }
+ }
+
+ public void TestGetValues() {
+ {
+ bool errorThrown = false;
+ try {
+ Enum.GetValues(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ Enum.GetValues(bad.GetType());
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+ {
+ Enum t1 = new TestingEnum();
+ Array a1 = Enum.GetValues(t1.GetType());
+ for (int i= 0; i < a1.Length; i++) {
+ AssertEquals("wrong enum value",
+ (TestingEnum)i,
+ a1.GetValue(i));
+ }
+ }
+ {
+ Enum t1 = new TestShortEnum();
+ Array a1 = Enum.GetValues(t1.GetType());
+ for (short i= 0; i < a1.Length; i++) {
+ AssertEquals("wrong short enum value",
+ (TestShortEnum)i,
+ a1.GetValue(i));
+ }
+ }
+ }
+
+ public void TestIsDefined() {
+ {
+ bool errorThrown = false;
+ try {
+ Enum.IsDefined(null, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null first arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.IsDefined(x.GetType(), null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null second arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ int i = 4;
+ Enum.IsDefined(bad.GetType(), i);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+
+ try {
+ TestingEnum x = TestingEnum.Test;
+ short i = 4;
+ Enum.IsDefined(x.GetType(), i);
+ Fail("wrong underlying type not caught.");
+ } catch (ArgumentException) {
+ } catch (Exception e) {
+ Fail("wrong Exception thrown ("+e.ToString()+")for underlying type not caught.");
+ }
+
+ // spec says yes, MS impl says no.
+ //{
+ //bool errorThrown = false;
+ //try {
+ //String bad = "huh?";
+ //TestingEnum x = TestingEnum.Test;
+ //Enum.IsDefined(x.GetType(), bad);
+ //} catch (ExecutionEngineException) {
+ //errorThrown = true;
+ //}
+ //Assert("non-enum object not caught.",
+ //errorThrown);
+ //}
+ {
+ Enum t1 = new TestingEnum();
+ int i = 0;
+ for (i = 0;
+ i < Enum.GetValues(t1.GetType()).Length; i++) {
+ Assert("should have value for i=" + i,
+ Enum.IsDefined(t1.GetType(), i));
+ }
+ Assert("Shouldn't have value",
+ !Enum.IsDefined(t1.GetType(), i));
+ }
+ }
+
+ public void TestParse1() {
+ {
+ bool errorThrown = false;
+ try {
+ String name = "huh?";
+ Enum.Parse(null, name);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null first arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Parse(x.GetType(), null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null second arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ Enum.Parse(bad.GetType(), bad);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ String bad = "";
+ Enum.Parse(x.GetType(), bad);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("empty string not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ String bad = " ";
+ Enum.Parse(x.GetType(), bad);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("space-only string not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ String bad = "huh?";
+ TestingEnum x = TestingEnum.Test;
+ Enum.Parse(x.GetType(), bad);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("not-in-enum error not caught.",
+ errorThrown);
+ }
+ {
+ TestingEnum t1 = new TestingEnum();
+ AssertEquals("parse first enum",
+ TestingEnum.This,
+ Enum.Parse(t1.GetType(), "This"));
+ AssertEquals("parse second enum",
+ TestingEnum.Is,
+ Enum.Parse(t1.GetType(), "Is"));
+ AssertEquals("parse third enum",
+ TestingEnum.A,
+ Enum.Parse(t1.GetType(), "A"));
+ AssertEquals("parse last enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "Test"));
+
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Is,
+ Enum.Parse(t1.GetType(), "This,Is"));
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "This,Test"));
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "This,Is,A"));
+ }
+ }
+ public void TestParse2() {
+ {
+ bool errorThrown = true;
+ try {
+ String name = "huh?";
+ Enum.Parse(null, name, true);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null first arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ Enum.Parse(x.GetType(), null, true);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null second arg not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ String bad = "huh?";
+ Enum.Parse(bad.GetType(), bad, true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("non-enum type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ String bad = "";
+ Enum.Parse(x.GetType(), bad, true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("empty string not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ TestingEnum x = TestingEnum.Test;
+ String bad = " ";
+ Enum.Parse(x.GetType(), bad, true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("space-only string not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ String bad = "huh?";
+ TestingEnum x = TestingEnum.Test;
+ Enum.Parse(x.GetType(), bad, true);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("not-in-enum error not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = true;
+ try {
+ String bad = "test";
+ TestingEnum x = TestingEnum.Test;
+ Enum.Parse(x.GetType(), bad, false);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("not-in-enum error not caught.",
+ errorThrown);
+ }
+ {
+ TestingEnum t1 = new TestingEnum();
+ AssertEquals("parse first enum",
+ TestingEnum.This,
+ Enum.Parse(t1.GetType(), "this", true));
+ AssertEquals("parse second enum",
+ TestingEnum.Is,
+ Enum.Parse(t1.GetType(), "is", true));
+ AssertEquals("parse third enum",
+ TestingEnum.A,
+ Enum.Parse(t1.GetType(), "a", true));
+ AssertEquals("parse last enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "test", true));
+
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Is,
+ Enum.Parse(t1.GetType(), "This,is", true));
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "This,test", true));
+ AssertEquals("parse bitwise-or enum",
+ TestingEnum.Test,
+ Enum.Parse(t1.GetType(), "This,is,A", true));
+ }
+ }
+
+ public void TestToObject() {
+ {
+ bool errorThrown = false;
+ try {
+ Enum.ToObject(null, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null type not caught.",
+ errorThrown);
+ }
+ {
+ bool errorThrown = false;
+ try {
+ Enum.ToObject("huh?".GetType(), 1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("null type not caught.",
+ errorThrown);
+ }
+ {
+ TestingEnum t1 = new TestingEnum();
+ AssertEquals("Should get object",
+ TestingEnum.This,
+ Enum.ToObject(t1.GetType(), 0));
+ }
+ // TODO - should probably test all the different underlying types
+ }
+
+ [Flags]
+ enum SomeEnum {a,b,c};
+
+ [Flags]
+ enum SomeByteEnum : byte {a,b,c};
+
+ [Flags]
+ enum SomeInt64Enum : long {a,b,c};
+
+ public void TestToString() {
+ AssertEquals("invalid string", "This",
+ TestingEnum.This.ToString());
+ AssertEquals("invalid string", "Is",
+ TestingEnum.Is.ToString());
+ AssertEquals("invalid string", "A",
+ TestingEnum.A.ToString());
+ AssertEquals("invalid string", "Test",
+ TestingEnum.Test.ToString());
+
+ Enum is1 = TestingEnum.Is;
+
+ AssertEquals("decimal parse wrong",
+ "1", is1.ToString("d"));
+ AssertEquals("named format wrong",
+ "Is", is1.ToString("g"));
+ AssertEquals("hex format wrong",
+ "00000001", is1.ToString("x"));
+ AssertEquals("bitfield format wrong",
+ "Is", is1.ToString("f"));
+
+
+ AssertEquals("bitfield with flags format wrong for Int32 enum",
+ "b, c", ((SomeEnum)3).ToString("f"));
+ AssertEquals("bitfield with flags format wrong for Byte enum",
+ "b, c", ((SomeByteEnum)3).ToString("f"));
+ AssertEquals("bitfield with flags format wrong for Int64 enum",
+ "b, c", ((SomeInt64Enum)3).ToString("f"));
+ }
+
+ // TODO - ToString with IFormatProviders
+}
+}
diff --git a/mcs/class/corlib/Test/System/GuidTest.cs b/mcs/class/corlib/Test/System/GuidTest.cs
new file mode 100755
index 00000000000..e3b19008886
--- /dev/null
+++ b/mcs/class/corlib/Test/System/GuidTest.cs
@@ -0,0 +1,247 @@
+//
+// GuidTest.cs - NUnit Test Cases for the System.Guid struct
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+public class GuidTest : TestCase
+{
+ public GuidTest () : base ("MonoTests.System.GuidTest testcase") {}
+ public GuidTest (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (GuidTest));
+ }
+ }
+
+ public void TestCtor1 ()
+ {
+ Guid g = new Guid (new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f});
+ bool exception;
+
+ if (BitConverter.IsLittleEndian) {
+ AssertEquals ("A1", "03020100-0504-0706-0809-0a0b0c0d0e0f", g.ToString ());
+ }
+ else {
+ AssertEquals ("A1", "00010203-0405-0607-0809-0a0b0c0d0e0f", g.ToString ());
+ }
+
+ try {
+ Guid g1 = new Guid ((byte[]) null);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A2", exception);
+
+ try {
+ Guid g1 = new Guid (new byte[] {0x00, 0x01, 0x02});
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A3", exception);
+ }
+
+ public void TestCtor2 ()
+ {
+ Guid g1 = new Guid ("00010203-0405-0607-0809-0a0b0c0d0e0f");
+ Guid g2 = new Guid ("{00010203-0405-0607-0809-0A0B0C0D0E0F}");
+ Guid g3 = new Guid ("{0x00010203,0x0405,0x0607,{0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}}");
+ Guid g4;
+ Guid g5;
+
+ bool exception;
+
+ AssertEquals ("A1", "00010203-0405-0607-0809-0a0b0c0d0e0f", g1.ToString ());
+ AssertEquals ("A2", "00010203-0405-0607-0809-0a0b0c0d0e0f", g2.ToString ());
+ AssertEquals ("A3", "00010203-0405-0607-0809-0a0b0c0d0e0f", g3.ToString ());
+
+ try {
+ g4 = new Guid ((string) null);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ try {
+ g5 = new Guid ("invalid");
+ exception = false;
+ }
+ catch (FormatException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+
+ }
+
+ public void TestCtor4 ()
+ {
+ Guid g1 = new Guid (0x00010203, (short) 0x0405, (short) 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (unchecked ((int) 0xffffffff), unchecked ((short) 0xffff), unchecked((short) 0xffff), 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
+
+ AssertEquals ("A1", "00010203-0405-0607-0809-0a0b0c0d0e0f", g1.ToString ());
+ AssertEquals ("A2", "ffffffff-ffff-ffff-ffff-ffffffffffff", g2.ToString ());
+
+ }
+
+ public void TestCtor5 ()
+ {
+ Guid g1 = new Guid (0x00010203u, (ushort) 0x0405u, (ushort) 0x0607u, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (0xffffffffu, (ushort) 0xffffu, (ushort) 0xffffu, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
+
+ AssertEquals ("A1", "00010203-0405-0607-0809-0a0b0c0d0e0f", g1.ToString ());
+ AssertEquals ("A2", "ffffffff-ffff-ffff-ffff-ffffffffffff", g2.ToString ());
+
+ }
+
+ public void TestEmpty ()
+ {
+ AssertEquals ("A1", "00000000-0000-0000-0000-000000000000", Guid.Empty.ToString ());
+ }
+
+ public void TestNewGuid ()
+ {
+ Guid g1 = Guid.NewGuid ();
+ Guid g2 = Guid.NewGuid ();
+
+ Assert ("A1", g1 != g2);
+ }
+
+ public void TestEqualityOp ()
+ {
+ Guid g1 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g3 = new Guid (0x11223344, 0x5566, 0x6677, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff);
+
+ AssertEquals ("A1", true, g1 == g1);
+ AssertEquals ("A2", true, g1 == g2);
+ AssertEquals ("A3", false, g1 == g3);
+ }
+
+ public void TestInequalityOp ()
+ {
+ Guid g1 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g3 = new Guid (0x11223344, 0x5566, 0x6677, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff);
+
+ AssertEquals ("A1", false, g1 != g1);
+ AssertEquals ("A2", false, g1 != g2);
+ AssertEquals ("A3", true, g1 != g3);
+ }
+
+ public void TestEquals ()
+ {
+ Guid g1 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g3 = new Guid (0x11223344, 0x5566, 0x6677, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff);
+ string s = "This is not a Guid!";
+
+ AssertEquals ("A1", true, g1.Equals (g1));
+ AssertEquals ("A2", true, g1.Equals (g2));
+ AssertEquals ("A3", false, g1.Equals (g3));
+ AssertEquals ("A4", false, g1.Equals (null));
+ AssertEquals ("A5", false, g1.Equals (s));
+ }
+
+ public void TestCompareTo ()
+ {
+ Guid g1 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g2 = new Guid (0x00010204, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g3 = new Guid (0x00010203, 0x0405, 0x0607, 0x09, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ Guid g4 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x1f);
+ bool exception;
+
+ Assert ("A1", g1.CompareTo (g2) < 0);
+ Assert ("A2", g1.CompareTo (g3) < 0);
+ Assert ("A3", g1.CompareTo (g4) < 0);
+ Assert ("A4", g2.CompareTo (g1) > 0);
+ Assert ("A5", g3.CompareTo (g1) > 0);
+ Assert ("A6", g4.CompareTo (g1) > 0);
+ Assert ("A7", g1.CompareTo (g1) == 0);
+ Assert ("A8", g1.CompareTo (null) > 0);
+
+ try {
+ g1.CompareTo ("Say what?");
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A9", exception);
+ }
+
+ public void TestGetHashCode ()
+ {
+ // We don't test anything but the availibility of this member
+ int res = Guid.NewGuid ().GetHashCode ();
+
+ Assert ("A1", true);
+ }
+
+ public void TestToByteArray ()
+ {
+ Guid g1 = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ byte[] b = g1.ToByteArray ();
+
+ AssertEquals ("A1", 0x00010203, BitConverter.ToInt32 (b, 0));
+ AssertEquals ("A2", (short) 0x0405, BitConverter.ToInt16 (b, 4));
+ AssertEquals ("A3", (short) 0x0607, BitConverter.ToInt16 (b, 6));
+ for (int i=8; i<16; ++i) {
+ AssertEquals ("A1", (byte) i, b [i]);
+ }
+
+ }
+
+ public void TestToString ()
+ {
+ Guid g = new Guid (0x00010203, 0x0405, 0x0607, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f);
+ bool exception;
+
+ AssertEquals ("A1", "00010203-0405-0607-0809-0a0b0c0d0e0f", g.ToString ());
+ AssertEquals ("A2", "000102030405060708090a0b0c0d0e0f", g.ToString ("N"));
+ AssertEquals ("A3", "00010203-0405-0607-0809-0a0b0c0d0e0f", g.ToString ("D"));
+ AssertEquals ("A4", "{00010203-0405-0607-0809-0a0b0c0d0e0f}", g.ToString ("B"));
+ AssertEquals ("A5", "(00010203-0405-0607-0809-0a0b0c0d0e0f)", g.ToString ("P"));
+ AssertEquals ("A6", "00010203-0405-0607-0809-0a0b0c0d0e0f", g.ToString (""));
+ AssertEquals ("A7", "00010203-0405-0607-0809-0a0b0c0d0e0f", g.ToString ((string)null));
+
+ try {
+ g.ToString ("X");
+ exception = false;
+ }
+ catch (FormatException) {
+ exception = true;
+ }
+ Assert ("A8", exception);
+
+ try {
+ g.ToString ("This is invalid");
+ exception = false;
+ }
+ catch (FormatException) {
+ exception = true;
+ }
+ Assert ("A9", exception);
+
+ AssertEquals ("A10", "{00010203-0405-0607-0809-0a0b0c0d0e0f}", g.ToString ("B", null));
+
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/Int16Test.cs b/mcs/class/corlib/Test/System/Int16Test.cs
new file mode 100644
index 00000000000..717b35420b6
--- /dev/null
+++ b/mcs/class/corlib/Test/System/Int16Test.cs
@@ -0,0 +1,193 @@
+// Int16Test.cs - NUnit Test Cases for the System.Int16 struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class Int16Test : TestCase
+{
+ private const Int16 MyInt16_1 = -42;
+ private const Int16 MyInt16_2 = -32768;
+ private const Int16 MyInt16_3 = 32767;
+ private const string MyString1 = "-42";
+ private const string MyString2 = "-32768";
+ private const string MyString3 = "32767";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {null, "-32768", "-3.276800e+004", "-32768.00",
+ "-32768", "-32,768.00", "-3,276,800.00 %", "8000"};
+ private string[] Results2 = {null, "32767", "3.27670e+004", "32767.00000",
+ "32767", "32,767.00000", "3,276,700.00000 %", "07fff"};
+ private string[] ResultsNfi1 = {"("+NumberFormatInfo.InvariantInfo.CurrencySymbol+"32,768.00)", "-32768", "-3.276800e+004", "-32768.00",
+ "-32768", "-32,768.00", "-3,276,800.00 %", "8000"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"32,767.00000", "32767", "3.27670e+004", "32767.00000",
+ "32767", "32,767.00000", "3,276,700.00000 %", "07fff"};
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public Int16Test() : base ("MonoTests.System.Int16Test testcase") {}
+ public Int16Test(string name) : base(name) {}
+
+ private CultureInfo old_culture;
+
+ protected override void SetUp()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ // Set culture to en-US and don't let the user override.
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+
+ // We can't initialize this until we set the culture.
+ Results1 [0] = "("+NumberFormatInfo.CurrentInfo.CurrencySymbol+"32,768.00)";
+ Results2 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"32,767.00000";
+ }
+
+ protected override void TearDown()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(Int16Test));
+ }
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals(Int16.MinValue, MyInt16_2);
+ AssertEquals(Int16.MaxValue, MyInt16_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyInt16_3.CompareTo(MyInt16_2) > 0);
+ Assert(MyInt16_2.CompareTo(MyInt16_2) == 0);
+ Assert(MyInt16_1.CompareTo((Int16)(-42)) == 0);
+ Assert(MyInt16_2.CompareTo(MyInt16_3) < 0);
+ try {
+ MyInt16_2.CompareTo(100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyInt16_1.Equals(MyInt16_1));
+ Assert(MyInt16_1.Equals((Int16)(-42)));
+ Assert(MyInt16_1.Equals((SByte)(-42)) == false);
+ Assert(MyInt16_1.Equals(MyInt16_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyInt16_1.GetHashCode();
+ MyInt16_2.GetHashCode();
+ MyInt16_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert(MyInt16_1 == Int16.Parse(MyString1));
+ Assert(MyInt16_2 == Int16.Parse(MyString2));
+ Assert(MyInt16_3 == Int16.Parse(MyString3));
+ try {
+ Int16.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ Int16.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ try {
+ int OverInt = Int16.MaxValue + 1;
+ Int16.Parse(OverInt.ToString());
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ Assert(42 == Int16.Parse(" $42 ", NumberStyles.Currency));
+ try {
+ Int16.Parse("$42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(-42 == Int16.Parse(" -42 ", Nfi));
+ try {
+ Int16.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == Int16.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ Int16.Parse("$42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ Assert(String.Compare(MyString1, MyInt16_1.ToString()) == 0);
+ Assert(String.Compare(MyString2, MyInt16_2.ToString()) == 0);
+ Assert(String.Compare(MyString3, MyInt16_3.ToString()) == 0);
+ //test ToString(string format)
+ /*
+ TODO: These tests are culture sensitive. Need to find a way to determine the culture
+ of the system to decide the correct expected result.
+ for (int i=0; i < Formats1.Length; i++) {
+ Assert(String.Compare(Results1[i], MyInt16_2.ToString(Formats1[i])) == 0);
+ Assert(String.Compare(Results2[i], MyInt16_3.ToString(Formats2[i])) == 0);
+ }
+ */
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ Assert("i="+i+", ResultsNfi1[i]="+ResultsNfi1[i]+", MyInt16_2.ToString(Formats1[i]="+Formats1[i]+"): Expected "+ResultsNfi1[i]+" but got "+MyInt16_2.ToString(Formats1[i], Nfi), String.Compare(ResultsNfi1[i], MyInt16_2.ToString(Formats1[i], Nfi)) == 0);
+ Assert("i="+i+", ResultsNfi2[i]="+ResultsNfi2[i]+", MyInt16_3.ToString(Formats2[i]="+Formats2[i]+"): Expected "+ResultsNfi2[i]+" but got "+MyInt16_3.ToString(Formats2[i], Nfi), String.Compare(ResultsNfi2[i], MyInt16_3.ToString(Formats2[i], Nfi)) == 0);
+ }
+ try {
+ MyInt16_1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/Int32Test.cs b/mcs/class/corlib/Test/System/Int32Test.cs
new file mode 100644
index 00000000000..a74247b2d35
--- /dev/null
+++ b/mcs/class/corlib/Test/System/Int32Test.cs
@@ -0,0 +1,238 @@
+// Int32Test.cs - NUnit Test Cases for the System.Int32 struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class Int32Test : TestCase
+{
+ private const Int32 MyInt32_1 = -42;
+ private const Int32 MyInt32_2 = -2147483648;
+ private const Int32 MyInt32_3 = 2147483647;
+ private const string MyString1 = "-42";
+ private const string MyString2 = "-2147483648";
+ private const string MyString3 = "2147483647";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {null,
+ "-2147483648", "-2.147484e+009", "-2147483648.00",
+ "-2147483648", "-2,147,483,648.00", "-214,748,364,800.00 %", "80000000"};
+ private string[] Results2 = {null,
+ "2147483647", "2.14748e+009", "2147483647.00000",
+ "2.1475e+09", "2,147,483,647.00000", "214,748,364,700.00000 %", "7fffffff"};
+ private string[] ResultsNfi1 = {"("+NumberFormatInfo.InvariantInfo.CurrencySymbol+"2,147,483,648.00)",
+ "-2147483648", "-2.147484e+009", "-2147483648.00",
+ "-2147483648", "-2,147,483,648.00", "-214,748,364,800.00 %", "80000000"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"2,147,483,647.00000",
+ "2147483647", "2.14748e+009", "2147483647.00000",
+ "2.1475e+09", "2,147,483,647.00000", "214,748,364,700.00000 %", "7fffffff"};
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public Int32Test() : base ("MonoTests.System.Int32Test testcase") {}
+ public Int32Test(string name) : base(name) {}
+
+ private CultureInfo old_culture;
+
+ protected override void SetUp()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ // Set culture to en-US and don't let the user override.
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+
+ // We can't initialize this until we set the culture.
+ Results1 [0] = "("+NumberFormatInfo.CurrentInfo.CurrencySymbol+"2,147,483,648.00)";
+ Results2 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"2,147,483,647.00000";
+ }
+
+ protected override void TearDown()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(Int32Test));
+ }
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals("#A01", Int32.MinValue, MyInt32_2);
+ AssertEquals("#A02", Int32.MaxValue, MyInt32_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert("MyInt32_3.CompareTo(MyInt32_2) > 0", MyInt32_3.CompareTo(MyInt32_2) > 0);
+ Assert("MyInt32_2.CompareTo(MyInt32_2) == 0", MyInt32_2.CompareTo(MyInt32_2) == 0);
+ Assert("MyInt32_1.CompareTo((Int32)(-42)) == 0", MyInt32_1.CompareTo((Int32)(-42)) == 0);
+ Assert("MyInt32_2.CompareTo(MyInt32_3) < 0", MyInt32_2.CompareTo(MyInt32_3) < 0);
+ try {
+ MyInt32_2.CompareTo((Int16)100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert("typeof(ArgumentException) == e.GetType()", typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert ("#B01", MyInt32_1.Equals (MyInt32_1));
+ Assert ("#B02", MyInt32_1.Equals ((Int32)(-42)));
+ Assert ("#B03", MyInt32_1.Equals ((SByte)(-42)) == false);
+ Assert ("#B04", MyInt32_1.Equals (MyInt32_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyInt32_1.GetHashCode();
+ MyInt32_2.GetHashCode();
+ MyInt32_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ AssertEquals ("#C01", MyInt32_1, Int32.Parse (MyString1));
+ AssertEquals ("#C02", MyInt32_2, Int32.Parse (MyString2));
+ AssertEquals ("#C03", MyInt32_3, Int32.Parse (MyString3));
+
+ AssertEquals ("#C04", 1, Int32.Parse ("1"));
+ AssertEquals ("#C05", 1, Int32.Parse (" 1"));
+ AssertEquals ("#C06", 1, Int32.Parse (" 1"));
+ AssertEquals ("#C07", 1, Int32.Parse ("1 "));
+ AssertEquals ("#C08", 1, Int32.Parse ("+1"));
+ AssertEquals ("#C09", -1, Int32.Parse ("-1"));
+ AssertEquals ("#C10", -1, Int32.Parse (" -1"));
+ AssertEquals ("#C11", -1, Int32.Parse (" -1 "));
+ AssertEquals ("#C12", -1, Int32.Parse (" -1 "));
+
+ try {
+ Int32.Parse(null);
+ Fail ("#C13: Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert ("#C14", typeof (ArgumentNullException) == e.GetType());
+ }
+ try {
+ Int32.Parse("not-a-number");
+ Fail ("#C15: Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert ("#C16", typeof (FormatException) == e.GetType());
+ }
+ try {
+ double OverInt = (double)Int32.MaxValue + 1;
+ Int32.Parse(OverInt.ToString());
+ Fail ("#C17: Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ AssertEquals ("#C18", typeof (OverflowException), e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ AssertEquals ("#C19", 42, Int32.Parse (" $42 ", NumberStyles.Currency));
+ try {
+ Int32.Parse("$42", NumberStyles.Integer);
+ Fail ("#C20: Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert ("#C21", typeof (FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ AssertEquals ("#C22", -42, Int32.Parse (" -42 ", Nfi));
+ try {
+ Int32.Parse("%42", Nfi);
+ Fail ("#C23: Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert ("#C24", typeof (FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ AssertEquals ("#C25", 16, Int32.Parse (" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ Int32.Parse("$42", NumberStyles.Integer, Nfi);
+ Fail ("#C26: Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("#C27", typeof (FormatException) == e.GetType());
+ }
+
+ try {
+ Int32.Parse (" - 1 ");
+ Fail ("#C28: Should raise FormatException");
+ } catch (Exception e){
+ Assert ("#C29", typeof (FormatException) == e.GetType ());
+ }
+
+ try {
+ Int32.Parse (" - ");
+ Fail ("#C30: Should raise FormatException");
+ } catch (Exception e){
+ Assert ("#C31", typeof (FormatException) == e.GetType ());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ AssertEquals ("#D01", MyString1, MyInt32_1.ToString ());
+ AssertEquals ("#D02", MyString2, MyInt32_2.ToString ());
+ AssertEquals ("#D03", MyString3, MyInt32_3.ToString ());
+
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals ("#D04(" + i + "," + Formats1 [i] + ")",
+ ResultsNfi1 [i], MyInt32_2.ToString (Formats1 [i], Nfi));
+ AssertEquals ("#D05(" + i + "," + Formats2 [i] + ")",
+ ResultsNfi2 [i], MyInt32_3.ToString (Formats2 [i], Nfi));
+ }
+
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals ("#D06(" + i + ")", Results1 [i],
+ MyInt32_2.ToString(Formats1[i]));
+ AssertEquals ("#D07(" + i + ")", Results2 [i],
+ MyInt32_3.ToString(Formats2[i]));
+ }
+
+ try {
+ MyInt32_1.ToString("z");
+ Fail ("#D08: Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert ("#D09", typeof (FormatException) == e.GetType());
+ }
+ }
+
+ public void TestCustomToString()
+ {
+ // FIXME: Not yet implemented.
+#if NOTYET
+ // culture sensitive?
+
+ int i = 123;
+
+ AssertEquals ("Custom format string 00000", "00123", i.ToString ("00000"));
+ AssertEquals ("Custom format string ####", "123", i.ToString ("####"));
+#endif
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/Int64Test.cs b/mcs/class/corlib/Test/System/Int64Test.cs
new file mode 100644
index 00000000000..134f9daf0e0
--- /dev/null
+++ b/mcs/class/corlib/Test/System/Int64Test.cs
@@ -0,0 +1,330 @@
+// Int64Test.cs - NUnit Test Cases for the System.Int64 struct
+//
+// Author: Martin Weindel (martin.weindel@t-online.de)
+//
+// (C) Martin Weindel, 2001
+//
+// tests ToString and Parse function with the culture independent
+// NumberFormatInfo.InvariantInfo
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+ /// <summary>
+ /// Tests for System.Int64
+ /// </summary>
+namespace MonoTests.System
+{
+
+public class Int64Test : TestCase
+{
+ private const Int64 MyInt64_1 = -42;
+ private const Int64 MyInt64_2 = -9223372036854775808;
+ private const Int64 MyInt64_3 = 9223372036854775807;
+ private const string MyString1 = "-42";
+ private const string MyString2 = "-9223372036854775808";
+ private const string MyString3 = "9223372036854775807";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {"("+NumberFormatInfo.CurrentInfo.CurrencySymbol+"9,223,372,036,854,775,808.00)", "-9223372036854775808", "-9.223372e+018", "-9223372036854775808.00",
+ "-9223372036854775808", "-9,223,372,036,854,775,808.00", "-922,337,203,685,477,580,800.00 %", "8000000000000000"};
+ private string[] Results2 = {NumberFormatInfo.CurrentInfo.CurrencySymbol+"9,223,372,036,854,775,807.00000", "9223372036854775807", "9.22337e+018", "9223372036854775807.00000",
+ "9.2234e+18", "9,223,372,036,854,775,807.00000", "922,337,203,685,477,580,700.00000 %", "7fffffffffffffff"};
+ private string[] ResultsNfi1 = {"("+NumberFormatInfo.InvariantInfo.CurrencySymbol+"9,223,372,036,854,775,808.00)", "-9223372036854775808", "-9.223372e+018", "-9223372036854775808.00",
+ "-9223372036854775808", "-9,223,372,036,854,775,808.00", "-922,337,203,685,477,580,800.00 %", "8000000000000000"};
+ private string[] ResultsNfi2 = {""+NumberFormatInfo.InvariantInfo.CurrencySymbol+"9,223,372,036,854,775,807.00000", "9223372036854775807", "9.22337e+018", "9223372036854775807.00000",
+ "9.2234e+18", "9,223,372,036,854,775,807.00000", "922,337,203,685,477,580,700.00000 %", "7fffffffffffffff"};
+
+ // FIXME: This is failing with an ArgumentException. Seems to be related to the number of elements in the arrary,
+ // not the values themselves
+/* private long[] vals
+ = { 0, Int64.MaxValue, Int64.MinValue,
+ 1L, 12L, 123L, 1234L, -123L,
+ 1234567890123456L, 6543210987654321L };
+*/
+ private long[] vals
+ = { 0, Int64.MaxValue, Int64.MinValue };
+
+ private const long val1 = -1234567L;
+ private const long val2 = 1234567L;
+ private const string sval1Test1 = " -1,234,567 ";
+ private const string sval1Test2 = " -1234567 ";
+ //private const string sval1Test3 = " -12345,,,,67 "; // interesting: this case works on SDK Beta2, but the specification says nothing about this case
+ private const string sval1Test4 = " -12345 67 ";
+ private string sval1Test5 = " -"+NumberFormatInfo.InvariantInfo.CurrencySymbol+"1,234,567.00 ";
+ private string sval1Test6 = "("+NumberFormatInfo.InvariantInfo.CurrencySymbol+"1,234,567.00)";
+ private const string sval1Test7 = "-1,234,567.00";
+ private const string sval1UserCur1 = "1234/5/67:000 XYZ-";
+ private const string sval2UserCur1 = "1234/5/67:000 XYZ";
+ private const string sval1UserPercent1 = "-%%%1~2~3~4~5~6~7~0~0;0";
+ private const string sval2UserPercent1 = "%%%1~2~3~4~5~6~7~0~0;0";
+ private const NumberStyles style1 = NumberStyles.AllowLeadingWhite | NumberStyles.AllowLeadingSign
+ | NumberStyles.AllowTrailingWhite | NumberStyles.AllowThousands;
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+ private NumberFormatInfo NfiUser;
+
+ public Int64Test() : base("MonoTests.System.Int64Test") {}
+ public Int64Test(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get { return new TestSuite(typeof(Int64Test)); }
+ }
+
+ protected override void SetUp()
+ {
+ NfiUser = new NumberFormatInfo();
+ NfiUser.CurrencyDecimalDigits = 3;
+ NfiUser.CurrencyDecimalSeparator = ":";
+ NfiUser.CurrencyGroupSeparator = "/";
+ NfiUser.CurrencyGroupSizes = new int[] { 2,1,0 };
+ NfiUser.CurrencyNegativePattern = 10; // n $-
+ NfiUser.CurrencyPositivePattern = 3; // n $
+ NfiUser.CurrencySymbol = "XYZ";
+ NfiUser.PercentDecimalDigits = 1;
+ NfiUser.PercentDecimalSeparator = ";";
+ NfiUser.PercentGroupSeparator = "~";
+ NfiUser.PercentGroupSizes = new int[] {1};
+ NfiUser.PercentNegativePattern = 2;
+ NfiUser.PercentPositivePattern = 2;
+ NfiUser.PercentSymbol = "%%%";
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals(Int64.MinValue, MyInt64_2);
+ AssertEquals(Int64.MaxValue, MyInt64_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyInt64_3.CompareTo(MyInt64_2) > 0);
+ Assert(MyInt64_2.CompareTo(MyInt64_2) == 0);
+ Assert(MyInt64_1.CompareTo((Int64)(-42)) == 0);
+ Assert(MyInt64_2.CompareTo(MyInt64_3) < 0);
+ try {
+ MyInt64_2.CompareTo((Int16)100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyInt64_1.Equals(MyInt64_1));
+ Assert(MyInt64_1.Equals((Int64)(-42)));
+ Assert(MyInt64_1.Equals((SByte)(-42)) == false);
+ Assert(MyInt64_1.Equals(MyInt64_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyInt64_1.GetHashCode();
+ MyInt64_2.GetHashCode();
+ MyInt64_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestRoundTripGeneral()
+ {
+ foreach(long lv in vals)
+ {
+ string s = lv.ToString(Nfi);
+ long lv2 = Int64.Parse(s);
+ Assert(lv == lv2);
+ long lv3 = Int64.Parse(s, NumberStyles.Integer, Nfi);
+ Assert(lv == lv3);
+ }
+ }
+
+ public void TestRoundTripHex()
+ {
+ foreach(long lv in vals)
+ {
+ string s = lv.ToString("x", Nfi);
+ long lv2 = Int64.Parse(s, NumberStyles.HexNumber, Nfi);
+ Assert(lv == lv2);
+ }
+ }
+
+ public void TestParseNull()
+ {
+ try
+ {
+ Int64.Parse(null);
+ Fail("Should raise System.ArgumentNullException");
+ }
+ catch (ArgumentNullException)
+ {
+ // ok
+ }
+ }
+
+ public void TestParse()
+ {
+ long lv;
+
+ lv = Int64.Parse(sval1Test1, style1, Nfi);
+ AssertEquals("Long value should be equal for Test1", val1, lv);
+
+ try
+ {
+ lv = Int64.Parse(sval1Test1, Nfi);
+ Fail("Should raise FormatException 1");
+ }
+ catch (FormatException)
+ {
+ // ok
+ }
+
+ lv = Int64.Parse(sval1Test2, style1, Nfi);
+ AssertEquals("Value should be the same for Test2 with style1", val1, lv);
+ lv = Int64.Parse(sval1Test2, Nfi);
+ AssertEquals("Value should be the same for Test2 without style1", val1, lv);
+
+ try
+ {
+ lv = Int64.Parse(sval1Test4, style1, Nfi);
+ Fail("Should raise FormatException 3");
+ }
+ catch (FormatException)
+ {
+ // ok
+ }
+
+ lv = Int64.Parse(sval1Test5, NumberStyles.Currency, Nfi);
+ AssertEquals("Value should be the same for Test5 and currency style", val1, lv);
+
+ //test Parse(string s)
+ Assert(MyInt64_1 == Int64.Parse(MyString1));
+ Assert(MyInt64_2 == Int64.Parse(MyString2));
+ Assert(MyInt64_3 == Int64.Parse(MyString3));
+ try {
+ Int64.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ Int64.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ try {
+ double OverInt = (double)Int64.MaxValue + 1;
+ Int64.Parse(OverInt.ToString(), NumberStyles.Float);
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ try {
+ double OverInt = (double)Int64.MaxValue + 1;
+ Int64.Parse(OverInt.ToString(), NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ AssertEquals("A1", (long)42, Int64.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ", NumberStyles.Currency));
+ try {
+ Int64.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(-42 == Int64.Parse(" -42 ", Nfi));
+ try {
+ Int64.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == Int64.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ Int64.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ string s;
+
+ s = val1.ToString("c", Nfi);
+ Assert("val1 does not become sval1Test6", s.Equals(sval1Test6));
+
+ s = val1.ToString("n", Nfi);
+ AssertEquals("val1 does not become sval1Test7", sval1Test7, s);
+
+ //test ToString()
+ AssertEquals("MyInt64_1.ToString()", MyString1, MyInt64_1.ToString());
+ AssertEquals("MyInt64_2.ToString()", MyString2, MyInt64_2.ToString());
+ AssertEquals("MyInt64_3.ToString()", MyString3, MyInt64_3.ToString());
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("MyInt64_2.ToString(Formats1["+i+"])", Results1[i], MyInt64_2.ToString(Formats1[i]));
+ AssertEquals("MyInt64_3.ToString(Formats2["+i+"])", Results2[i], MyInt64_3.ToString(Formats2[i]));
+ }
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("MyInt64_2.ToString(Formats1["+i+"], Nfi)", ResultsNfi1[i], MyInt64_2.ToString(Formats1[i], Nfi));
+ AssertEquals("MyInt64_3.ToString(Formats2["+i+"], Nfi)", ResultsNfi2[i], MyInt64_3.ToString(Formats2[i], Nfi));
+ }
+ try {
+ MyInt64_1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ AssertEquals("Exception is wrong type", typeof(FormatException), e.GetType());
+ }
+ }
+
+ public void TestUserCurrency()
+ {
+ string s;
+ long v;
+
+ s = val1.ToString("c", NfiUser);
+ AssertEquals("Currency value type 1 is not what we want to try to parse", sval1UserCur1, s);
+ v = Int64.Parse(s, NumberStyles.Currency, NfiUser);
+ Assert(v == val1);
+
+ s = val2.ToString("c", NfiUser);
+ AssertEquals("Currency value type 1 is not what we want to try to parse", sval2UserCur1, s);
+ v = Int64.Parse(s, NumberStyles.Currency, NfiUser);
+ Assert(v == val2);
+ }
+
+ public void TestUserPercent()
+ {
+ string s;
+
+ s = val1.ToString("p", NfiUser);
+ Assert(s.Equals(sval1UserPercent1));
+
+ s = val2.ToString("p", NfiUser);
+ Assert(s.Equals(sval2UserPercent1));
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/IntegerFormatterTest.cs b/mcs/class/corlib/Test/System/IntegerFormatterTest.cs
new file mode 100644
index 00000000000..33f352aecf9
--- /dev/null
+++ b/mcs/class/corlib/Test/System/IntegerFormatterTest.cs
@@ -0,0 +1,2016 @@
+//
+// IntegerFormatterTest.cs - NUnit Test Cases for System.IntegerFormatter
+//
+// Author:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+using System.IO;
+using System.Threading;
+
+namespace MonoTests.System
+{
+
+public class IntegerFormatterTest : TestCase
+{
+ private const int INT32 = 0;
+ private const int INT64 = 1;
+ private const int UINT32 = 2;
+ private const int UINT64 = 3;
+ private int testType;
+
+ public IntegerFormatterTest () :
+ base ("[MonoTests.System.IntegerFormatterTest]") {}
+
+ public IntegerFormatterTest (string name) : base (name) {}
+
+ protected override void SetUp () {}
+
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(IntegerFormatterTest));
+ }
+ }
+
+ public void TestStandard ()
+ {
+ // Make the test Culture insensitive
+ NumberFormatInfo nfi = new NumberFormatInfo ();
+ nfi.CurrencySymbol = "$";
+
+ StringReader sr = new StringReader (tutti);
+
+ string inputLine;
+ while ((inputLine = sr.ReadLine ()) != null) {
+ if (inputLine.IndexOf ('(') != -1)
+ ProcessLine (inputLine, nfi);
+ else
+ ChangeType (inputLine);
+ }
+
+ sr.Close ();
+ }
+
+ private void ProcessLine (string testLine, NumberFormatInfo nfi)
+ {
+ string number = "0";
+ string format = "X";
+ string expected = "XXX";
+ int idxStart;
+ int idxEnd;
+
+ idxStart = testLine.IndexOf ('(');
+ if (idxStart != -1){
+ idxStart++;
+ idxEnd = testLine.IndexOf (')');
+ number = testLine.Substring (idxStart,
+ idxEnd - idxStart);
+ }
+
+ idxStart = testLine.IndexOf ('(', idxStart);
+ if (idxStart != -1) {
+ idxStart++;
+ idxEnd = testLine.IndexOf (')', idxStart);
+ format = testLine.Substring (idxStart,
+ idxEnd - idxStart);
+ }
+
+ idxStart = testLine.IndexOf ('(', idxStart);
+ if (idxStart != -1) {
+ idxStart++;
+ idxEnd = testLine.LastIndexOf (')');
+ expected = testLine.Substring (idxStart,
+ idxEnd - idxStart);
+ }
+
+ DoTest (number, format, expected, nfi);
+ }
+
+ private void DoTest (string number,
+ string format,
+ string expected,
+ NumberFormatInfo nfi)
+ {
+ string id = number + " " + format;
+
+ switch (testType) {
+ case INT32:
+ int i32 = Int32.Parse (number, nfi);
+ AssertEquals(id, expected, i32.ToString (format, nfi));
+ break;
+ case INT64:
+ long i64 = Int64.Parse (number, nfi);
+ AssertEquals(id, expected, i64.ToString (format, nfi));
+ break;
+ case UINT32:
+ uint ui32 = UInt32.Parse (number, nfi);
+ AssertEquals(id, expected, ui32.ToString (format, nfi));
+ break;
+ case UINT64:
+ ulong ui64 = UInt64.Parse (number, nfi);
+ AssertEquals(id, expected, ui64.ToString (format, nfi));
+ break;
+ }
+ }
+
+ private void ChangeType (string newType)
+ {
+ if (newType == "Int32")
+ testType = INT32;
+ else if (newType == "Int64")
+ testType = INT64;
+ else if (newType == "UInt32")
+ testType = UINT32;
+ else if (newType == "UInt64")
+ testType = UINT64;
+ else throw new Exception ("Test of type '" + newType + "' not supported.");
+
+ }
+
+ private static string tutti = "Int32\n" +
+"(-2147483648) (C) (($2,147,483,648.00))\n" +
+"(-2147483648) (C0) (($2,147,483,648))\n" +
+"(-2147483648) (C1) (($2,147,483,648.0))\n" +
+"(-2147483648) (C2) (($2,147,483,648.00))\n" +
+"(-2147483648) (C3) (($2,147,483,648.000))\n" +
+"(-2147483648) (C4) (($2,147,483,648.0000))\n" +
+"(-2147483648) (C5) (($2,147,483,648.00000))\n" +
+"(-2147483648) (C6) (($2,147,483,648.000000))\n" +
+"(-2147483648) (C7) (($2,147,483,648.0000000))\n" +
+"(-2147483648) (C8) (($2,147,483,648.00000000))\n" +
+"(-2147483648) (C9) (($2,147,483,648.000000000))\n" +
+"(-2147483648) (C10) (($2,147,483,648.0000000000))\n" +
+"(-2147483648) (C99) (($2,147,483,648.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n" +
+"(-2147483648) (D) (-2147483648)\n" +
+"(-2147483648) (D0) (-2147483648)\n" +
+"(-2147483648) (D1) (-2147483648)\n" +
+"(-2147483648) (D2) (-2147483648)\n" +
+"(-2147483648) (D3) (-2147483648)\n" +
+"(-2147483648) (D4) (-2147483648)\n" +
+"(-2147483648) (D5) (-2147483648)\n" +
+"(-2147483648) (D6) (-2147483648)\n" +
+"(-2147483648) (D7) (-2147483648)\n" +
+"(-2147483648) (D8) (-2147483648)\n" +
+"(-2147483648) (D9) (-2147483648)\n" +
+"(-2147483648) (D10) (-2147483648)\n" +
+"(-2147483648) (D99) (-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002147483648)\n" +
+"(-2147483648) (E) (-2.147484E+009)\n" +
+"(-2147483648) (E0) (-2E+009)\n" +
+"(-2147483648) (E1) (-2.1E+009)\n" +
+"(-2147483648) (E2) (-2.15E+009)\n" +
+"(-2147483648) (E3) (-2.147E+009)\n" +
+"(-2147483648) (E4) (-2.1475E+009)\n" +
+"(-2147483648) (E5) (-2.14748E+009)\n" +
+"(-2147483648) (E6) (-2.147484E+009)\n" +
+"(-2147483648) (E7) (-2.1474836E+009)\n" +
+"(-2147483648) (E8) (-2.14748365E+009)\n" +
+"(-2147483648) (E9) (-2.147483648E+009)\n" +
+"(-2147483648) (E10) (-2.1474836480E+009)\n" +
+"(-2147483648) (E99) (-2.147483648000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+009)\n" +
+"(-2147483648) (F) (-2147483648.00)\n" +
+"(-2147483648) (F0) (-2147483648)\n" +
+"(-2147483648) (F1) (-2147483648.0)\n" +
+"(-2147483648) (F2) (-2147483648.00)\n" +
+"(-2147483648) (F3) (-2147483648.000)\n" +
+"(-2147483648) (F4) (-2147483648.0000)\n" +
+"(-2147483648) (F5) (-2147483648.00000)\n" +
+"(-2147483648) (F6) (-2147483648.000000)\n" +
+"(-2147483648) (F7) (-2147483648.0000000)\n" +
+"(-2147483648) (F8) (-2147483648.00000000)\n" +
+"(-2147483648) (F9) (-2147483648.000000000)\n" +
+"(-2147483648) (F10) (-2147483648.0000000000)\n" +
+"(-2147483648) (F99) (-2147483648.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-2147483648) (G) (-2147483648)\n" +
+"(-2147483648) (G0) (-2147483648)\n" +
+"(-2147483648) (G1) (-2E+09)\n" +
+"(-2147483648) (G2) (-2.1E+09)\n" +
+"(-2147483648) (G3) (-2.15E+09)\n" +
+"(-2147483648) (G4) (-2.147E+09)\n" +
+"(-2147483648) (G5) (-2.1475E+09)\n" +
+"(-2147483648) (G6) (-2.14748E+09)\n" +
+"(-2147483648) (G7) (-2.147484E+09)\n" +
+"(-2147483648) (G8) (-2.1474836E+09)\n" +
+"(-2147483648) (G9) (-2.14748365E+09)\n" +
+"(-2147483648) (G10) (-2147483648)\n" +
+"(-2147483648) (G99) (-2147483648)\n" +
+"(-2147483648) (N) (-2,147,483,648.00)\n" +
+"(-2147483648) (N0) (-2,147,483,648)\n" +
+"(-2147483648) (N1) (-2,147,483,648.0)\n" +
+"(-2147483648) (N2) (-2,147,483,648.00)\n" +
+"(-2147483648) (N3) (-2,147,483,648.000)\n" +
+"(-2147483648) (N4) (-2,147,483,648.0000)\n" +
+"(-2147483648) (N5) (-2,147,483,648.00000)\n" +
+"(-2147483648) (N6) (-2,147,483,648.000000)\n" +
+"(-2147483648) (N7) (-2,147,483,648.0000000)\n" +
+"(-2147483648) (N8) (-2,147,483,648.00000000)\n" +
+"(-2147483648) (N9) (-2,147,483,648.000000000)\n" +
+"(-2147483648) (N10) (-2,147,483,648.0000000000)\n" +
+"(-2147483648) (N99) (-2,147,483,648.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-2147483648) (P) (-214,748,364,800.00 %)\n" +
+"(-2147483648) (P0) (-214,748,364,800 %)\n" +
+"(-2147483648) (P1) (-214,748,364,800.0 %)\n" +
+"(-2147483648) (P2) (-214,748,364,800.00 %)\n" +
+"(-2147483648) (P3) (-214,748,364,800.000 %)\n" +
+"(-2147483648) (P4) (-214,748,364,800.0000 %)\n" +
+"(-2147483648) (P5) (-214,748,364,800.00000 %)\n" +
+"(-2147483648) (P6) (-214,748,364,800.000000 %)\n" +
+"(-2147483648) (P7) (-214,748,364,800.0000000 %)\n" +
+"(-2147483648) (P8) (-214,748,364,800.00000000 %)\n" +
+"(-2147483648) (P9) (-214,748,364,800.000000000 %)\n" +
+"(-2147483648) (P10) (-214,748,364,800.0000000000 %)\n" +
+"(-2147483648) (P99) (-214,748,364,800.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(-2147483648) (X) (80000000)\n" +
+"(-2147483648) (X0) (80000000)\n" +
+"(-2147483648) (X1) (80000000)\n" +
+"(-2147483648) (X2) (80000000)\n" +
+"(-2147483648) (X3) (80000000)\n" +
+"(-2147483648) (X4) (80000000)\n" +
+"(-2147483648) (X5) (80000000)\n" +
+"(-2147483648) (X6) (80000000)\n" +
+"(-2147483648) (X7) (80000000)\n" +
+"(-2147483648) (X8) (80000000)\n" +
+"(-2147483648) (X9) (080000000)\n" +
+"(-2147483648) (X10) (0080000000)\n" +
+"(-2147483648) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000)\n" +
+"(2147483647) (C) ($2,147,483,647.00)\n" +
+"(2147483647) (C0) ($2,147,483,647)\n" +
+"(2147483647) (C1) ($2,147,483,647.0)\n" +
+"(2147483647) (C2) ($2,147,483,647.00)\n" +
+"(2147483647) (C3) ($2,147,483,647.000)\n" +
+"(2147483647) (C4) ($2,147,483,647.0000)\n" +
+"(2147483647) (C5) ($2,147,483,647.00000)\n" +
+"(2147483647) (C6) ($2,147,483,647.000000)\n" +
+"(2147483647) (C7) ($2,147,483,647.0000000)\n" +
+"(2147483647) (C8) ($2,147,483,647.00000000)\n" +
+"(2147483647) (C9) ($2,147,483,647.000000000)\n" +
+"(2147483647) (C10) ($2,147,483,647.0000000000)\n" +
+"(2147483647) (C99) ($2,147,483,647.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(2147483647) (D) (2147483647)\n" +
+"(2147483647) (D0) (2147483647)\n" +
+"(2147483647) (D1) (2147483647)\n" +
+"(2147483647) (D2) (2147483647)\n" +
+"(2147483647) (D3) (2147483647)\n" +
+"(2147483647) (D4) (2147483647)\n" +
+"(2147483647) (D5) (2147483647)\n" +
+"(2147483647) (D6) (2147483647)\n" +
+"(2147483647) (D7) (2147483647)\n" +
+"(2147483647) (D8) (2147483647)\n" +
+"(2147483647) (D9) (2147483647)\n" +
+"(2147483647) (D10) (2147483647)\n" +
+"(2147483647) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002147483647)\n" +
+"(2147483647) (E) (2.147484E+009)\n" +
+"(2147483647) (E0) (2E+009)\n" +
+"(2147483647) (E1) (2.1E+009)\n" +
+"(2147483647) (E2) (2.15E+009)\n" +
+"(2147483647) (E3) (2.147E+009)\n" +
+"(2147483647) (E4) (2.1475E+009)\n" +
+"(2147483647) (E5) (2.14748E+009)\n" +
+"(2147483647) (E6) (2.147484E+009)\n" +
+"(2147483647) (E7) (2.1474836E+009)\n" +
+"(2147483647) (E8) (2.14748365E+009)\n" +
+"(2147483647) (E9) (2.147483647E+009)\n" +
+"(2147483647) (E10) (2.1474836470E+009)\n" +
+"(2147483647) (E99) (2.147483647000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+009)\n" +
+"(2147483647) (F) (2147483647.00)\n" +
+"(2147483647) (F0) (2147483647)\n" +
+"(2147483647) (F1) (2147483647.0)\n" +
+"(2147483647) (F2) (2147483647.00)\n" +
+"(2147483647) (F3) (2147483647.000)\n" +
+"(2147483647) (F4) (2147483647.0000)\n" +
+"(2147483647) (F5) (2147483647.00000)\n" +
+"(2147483647) (F6) (2147483647.000000)\n" +
+"(2147483647) (F7) (2147483647.0000000)\n" +
+"(2147483647) (F8) (2147483647.00000000)\n" +
+"(2147483647) (F9) (2147483647.000000000)\n" +
+"(2147483647) (F10) (2147483647.0000000000)\n" +
+"(2147483647) (F99) (2147483647.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(2147483647) (G) (2147483647)\n" +
+"(2147483647) (G0) (2147483647)\n" +
+"(2147483647) (G1) (2E+09)\n" +
+"(2147483647) (G2) (2.1E+09)\n" +
+"(2147483647) (G3) (2.15E+09)\n" +
+"(2147483647) (G4) (2.147E+09)\n" +
+"(2147483647) (G5) (2.1475E+09)\n" +
+"(2147483647) (G6) (2.14748E+09)\n" +
+"(2147483647) (G7) (2.147484E+09)\n" +
+"(2147483647) (G8) (2.1474836E+09)\n" +
+"(2147483647) (G9) (2.14748365E+09)\n" +
+"(2147483647) (G10) (2147483647)\n" +
+"(2147483647) (G99) (2147483647)\n" +
+"(2147483647) (N) (2,147,483,647.00)\n" +
+"(2147483647) (N0) (2,147,483,647)\n" +
+"(2147483647) (N1) (2,147,483,647.0)\n" +
+"(2147483647) (N2) (2,147,483,647.00)\n" +
+"(2147483647) (N3) (2,147,483,647.000)\n" +
+"(2147483647) (N4) (2,147,483,647.0000)\n" +
+"(2147483647) (N5) (2,147,483,647.00000)\n" +
+"(2147483647) (N6) (2,147,483,647.000000)\n" +
+"(2147483647) (N7) (2,147,483,647.0000000)\n" +
+"(2147483647) (N8) (2,147,483,647.00000000)\n" +
+"(2147483647) (N9) (2,147,483,647.000000000)\n" +
+"(2147483647) (N10) (2,147,483,647.0000000000)\n" +
+"(2147483647) (N99) (2,147,483,647.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(2147483647) (P) (214,748,364,700.00 %)\n" +
+"(2147483647) (P0) (214,748,364,700 %)\n" +
+"(2147483647) (P1) (214,748,364,700.0 %)\n" +
+"(2147483647) (P2) (214,748,364,700.00 %)\n" +
+"(2147483647) (P3) (214,748,364,700.000 %)\n" +
+"(2147483647) (P4) (214,748,364,700.0000 %)\n" +
+"(2147483647) (P5) (214,748,364,700.00000 %)\n" +
+"(2147483647) (P6) (214,748,364,700.000000 %)\n" +
+"(2147483647) (P7) (214,748,364,700.0000000 %)\n" +
+"(2147483647) (P8) (214,748,364,700.00000000 %)\n" +
+"(2147483647) (P9) (214,748,364,700.000000000 %)\n" +
+"(2147483647) (P10) (214,748,364,700.0000000000 %)\n" +
+"(2147483647) (P99) (214,748,364,700.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(2147483647) (X) (7FFFFFFF)\n" +
+"(2147483647) (X0) (7FFFFFFF)\n" +
+"(2147483647) (X1) (7FFFFFFF)\n" +
+"(2147483647) (X2) (7FFFFFFF)\n" +
+"(2147483647) (X3) (7FFFFFFF)\n" +
+"(2147483647) (X4) (7FFFFFFF)\n" +
+"(2147483647) (X5) (7FFFFFFF)\n" +
+"(2147483647) (X6) (7FFFFFFF)\n" +
+"(2147483647) (X7) (7FFFFFFF)\n" +
+"(2147483647) (X8) (7FFFFFFF)\n" +
+"(2147483647) (X9) (07FFFFFFF)\n" +
+"(2147483647) (X10) (007FFFFFFF)\n" +
+"(2147483647) (X99) (00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007FFFFFFF)\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (C) (($100.00))\n" +
+"(-100) (C0) (($100))\n" +
+"(-100) (C1) (($100.0))\n" +
+"(-100) (C2) (($100.00))\n" +
+"(-100) (C3) (($100.000))\n" +
+"(-100) (C4) (($100.0000))\n" +
+"(-100) (C5) (($100.00000))\n" +
+"(-100) (C6) (($100.000000))\n" +
+"(-100) (C7) (($100.0000000))\n" +
+"(-100) (C8) (($100.00000000))\n" +
+"(-100) (C9) (($100.000000000))\n" +
+"(-100) (C10) (($100.0000000000))\n" +
+"(-100) (C99) (($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n" +
+"(-100) (D) (-100)\n" +
+"(-100) (D0) (-100)\n" +
+"(-100) (D1) (-100)\n" +
+"(-100) (D2) (-100)\n" +
+"(-100) (D3) (-100)\n" +
+"(-100) (D4) (-0100)\n" +
+"(-100) (D5) (-00100)\n" +
+"(-100) (D6) (-000100)\n" +
+"(-100) (D7) (-0000100)\n" +
+"(-100) (D8) (-00000100)\n" +
+"(-100) (D9) (-000000100)\n" +
+"(-100) (D10) (-0000000100)\n" +
+"(-100) (D99) (-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(-100) (E) (-1.000000E+002)\n" +
+"(-100) (E0) (-1E+002)\n" +
+"(-100) (E1) (-1.0E+002)\n" +
+"(-100) (E2) (-1.00E+002)\n" +
+"(-100) (E3) (-1.000E+002)\n" +
+"(-100) (E4) (-1.0000E+002)\n" +
+"(-100) (E5) (-1.00000E+002)\n" +
+"(-100) (E6) (-1.000000E+002)\n" +
+"(-100) (E7) (-1.0000000E+002)\n" +
+"(-100) (E8) (-1.00000000E+002)\n" +
+"(-100) (E9) (-1.000000000E+002)\n" +
+"(-100) (E10) (-1.0000000000E+002)\n" +
+"(-100) (E99) (-1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(-100) (F) (-100.00)\n" +
+"(-100) (F0) (-100)\n" +
+"(-100) (F1) (-100.0)\n" +
+"(-100) (F2) (-100.00)\n" +
+"(-100) (F3) (-100.000)\n" +
+"(-100) (F4) (-100.0000)\n" +
+"(-100) (F5) (-100.00000)\n" +
+"(-100) (F6) (-100.000000)\n" +
+"(-100) (F7) (-100.0000000)\n" +
+"(-100) (F8) (-100.00000000)\n" +
+"(-100) (F9) (-100.000000000)\n" +
+"(-100) (F10) (-100.0000000000)\n" +
+"(-100) (F99) (-100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (G) (-100)\n" +
+"(-100) (G0) (-100)\n" +
+"(-100) (G1) (-1E+02)\n" +
+"(-100) (G2) (-1E+02)\n" +
+"(-100) (G3) (-100)\n" +
+"(-100) (G4) (-100)\n" +
+"(-100) (G5) (-100)\n" +
+"(-100) (G6) (-100)\n" +
+"(-100) (G7) (-100)\n" +
+"(-100) (G8) (-100)\n" +
+"(-100) (G9) (-100)\n" +
+"(-100) (G10) (-100)\n" +
+"(-100) (G99) (-100)\n" +
+"(-100) (N) (-100.00)\n" +
+"(-100) (N0) (-100)\n" +
+"(-100) (N1) (-100.0)\n" +
+"(-100) (N2) (-100.00)\n" +
+"(-100) (N3) (-100.000)\n" +
+"(-100) (N4) (-100.0000)\n" +
+"(-100) (N5) (-100.00000)\n" +
+"(-100) (N6) (-100.000000)\n" +
+"(-100) (N7) (-100.0000000)\n" +
+"(-100) (N8) (-100.00000000)\n" +
+"(-100) (N9) (-100.000000000)\n" +
+"(-100) (N10) (-100.0000000000)\n" +
+"(-100) (N99) (-100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (P) (-10,000.00 %)\n" +
+"(-100) (P0) (-10,000 %)\n" +
+"(-100) (P1) (-10,000.0 %)\n" +
+"(-100) (P2) (-10,000.00 %)\n" +
+"(-100) (P3) (-10,000.000 %)\n" +
+"(-100) (P4) (-10,000.0000 %)\n" +
+"(-100) (P5) (-10,000.00000 %)\n" +
+"(-100) (P6) (-10,000.000000 %)\n" +
+"(-100) (P7) (-10,000.0000000 %)\n" +
+"(-100) (P8) (-10,000.00000000 %)\n" +
+"(-100) (P9) (-10,000.000000000 %)\n" +
+"(-100) (P10) (-10,000.0000000000 %)\n" +
+"(-100) (P99) (-10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(-100) (X) (FFFFFF9C)\n" +
+"(-100) (X0) (FFFFFF9C)\n" +
+"(-100) (X1) (FFFFFF9C)\n" +
+"(-100) (X2) (FFFFFF9C)\n" +
+"(-100) (X3) (FFFFFF9C)\n" +
+"(-100) (X4) (FFFFFF9C)\n" +
+"(-100) (X5) (FFFFFF9C)\n" +
+"(-100) (X6) (FFFFFF9C)\n" +
+"(-100) (X7) (FFFFFF9C)\n" +
+"(-100) (X8) (FFFFFF9C)\n" +
+"(-100) (X9) (0FFFFFF9C)\n" +
+"(-100) (X10) (00FFFFFF9C)\n" +
+"(-100) (X99) (0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFF9C)\n" +
+"(100) (C) ($100.00)\n" +
+"(100) (C0) ($100)\n" +
+"(100) (C1) ($100.0)\n" +
+"(100) (C2) ($100.00)\n" +
+"(100) (C3) ($100.000)\n" +
+"(100) (C4) ($100.0000)\n" +
+"(100) (C5) ($100.00000)\n" +
+"(100) (C6) ($100.000000)\n" +
+"(100) (C7) ($100.0000000)\n" +
+"(100) (C8) ($100.00000000)\n" +
+"(100) (C9) ($100.000000000)\n" +
+"(100) (C10) ($100.0000000000)\n" +
+"(100) (C99) ($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (D) (100)\n" +
+"(100) (D0) (100)\n" +
+"(100) (D1) (100)\n" +
+"(100) (D2) (100)\n" +
+"(100) (D3) (100)\n" +
+"(100) (D4) (0100)\n" +
+"(100) (D5) (00100)\n" +
+"(100) (D6) (000100)\n" +
+"(100) (D7) (0000100)\n" +
+"(100) (D8) (00000100)\n" +
+"(100) (D9) (000000100)\n" +
+"(100) (D10) (0000000100)\n" +
+"(100) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(100) (E) (1.000000E+002)\n" +
+"(100) (E0) (1E+002)\n" +
+"(100) (E1) (1.0E+002)\n" +
+"(100) (E2) (1.00E+002)\n" +
+"(100) (E3) (1.000E+002)\n" +
+"(100) (E4) (1.0000E+002)\n" +
+"(100) (E5) (1.00000E+002)\n" +
+"(100) (E6) (1.000000E+002)\n" +
+"(100) (E7) (1.0000000E+002)\n" +
+"(100) (E8) (1.00000000E+002)\n" +
+"(100) (E9) (1.000000000E+002)\n" +
+"(100) (E10) (1.0000000000E+002)\n" +
+"(100) (E99) (1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(100) (F) (100.00)\n" +
+"(100) (F0) (100)\n" +
+"(100) (F1) (100.0)\n" +
+"(100) (F2) (100.00)\n" +
+"(100) (F3) (100.000)\n" +
+"(100) (F4) (100.0000)\n" +
+"(100) (F5) (100.00000)\n" +
+"(100) (F6) (100.000000)\n" +
+"(100) (F7) (100.0000000)\n" +
+"(100) (F8) (100.00000000)\n" +
+"(100) (F9) (100.000000000)\n" +
+"(100) (F10) (100.0000000000)\n" +
+"(100) (F99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (G) (100)\n" +
+"(100) (G0) (100)\n" +
+"(100) (G1) (1E+02)\n" +
+"(100) (G2) (1E+02)\n" +
+"(100) (G3) (100)\n" +
+"(100) (G4) (100)\n" +
+"(100) (G5) (100)\n" +
+"(100) (G6) (100)\n" +
+"(100) (G7) (100)\n" +
+"(100) (G8) (100)\n" +
+"(100) (G9) (100)\n" +
+"(100) (G10) (100)\n" +
+"(100) (G99) (100)\n" +
+"(100) (N) (100.00)\n" +
+"(100) (N0) (100)\n" +
+"(100) (N1) (100.0)\n" +
+"(100) (N2) (100.00)\n" +
+"(100) (N3) (100.000)\n" +
+"(100) (N4) (100.0000)\n" +
+"(100) (N5) (100.00000)\n" +
+"(100) (N6) (100.000000)\n" +
+"(100) (N7) (100.0000000)\n" +
+"(100) (N8) (100.00000000)\n" +
+"(100) (N9) (100.000000000)\n" +
+"(100) (N10) (100.0000000000)\n" +
+"(100) (N99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (P) (10,000.00 %)\n" +
+"(100) (P0) (10,000 %)\n" +
+"(100) (P1) (10,000.0 %)\n" +
+"(100) (P2) (10,000.00 %)\n" +
+"(100) (P3) (10,000.000 %)\n" +
+"(100) (P4) (10,000.0000 %)\n" +
+"(100) (P5) (10,000.00000 %)\n" +
+"(100) (P6) (10,000.000000 %)\n" +
+"(100) (P7) (10,000.0000000 %)\n" +
+"(100) (P8) (10,000.00000000 %)\n" +
+"(100) (P9) (10,000.000000000 %)\n" +
+"(100) (P10) (10,000.0000000000 %)\n" +
+"(100) (P99) (10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(100) (X) (64)\n" +
+"(100) (X0) (64)\n" +
+"(100) (X1) (64)\n" +
+"(100) (X2) (64)\n" +
+"(100) (X3) (064)\n" +
+"(100) (X4) (0064)\n" +
+"(100) (X5) (00064)\n" +
+"(100) (X6) (000064)\n" +
+"(100) (X7) (0000064)\n" +
+"(100) (X8) (00000064)\n" +
+"(100) (X9) (000000064)\n" +
+"(100) (X10) (0000000064)\n" +
+"(100) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064)\n" +
+"Int64\n" +
+"(-9223372036854775808) (C) (($9,223,372,036,854,775,808.00))\n" +
+"(-9223372036854775808) (C0) (($9,223,372,036,854,775,808))\n" +
+"(-9223372036854775808) (C1) (($9,223,372,036,854,775,808.0))\n" +
+"(-9223372036854775808) (C2) (($9,223,372,036,854,775,808.00))\n" +
+"(-9223372036854775808) (C3) (($9,223,372,036,854,775,808.000))\n" +
+"(-9223372036854775808) (C4) (($9,223,372,036,854,775,808.0000))\n" +
+"(-9223372036854775808) (C5) (($9,223,372,036,854,775,808.00000))\n" +
+"(-9223372036854775808) (C6) (($9,223,372,036,854,775,808.000000))\n" +
+"(-9223372036854775808) (C7) (($9,223,372,036,854,775,808.0000000))\n" +
+"(-9223372036854775808) (C8) (($9,223,372,036,854,775,808.00000000))\n" +
+"(-9223372036854775808) (C9) (($9,223,372,036,854,775,808.000000000))\n" +
+"(-9223372036854775808) (C10) (($9,223,372,036,854,775,808.0000000000))\n" +
+"(-9223372036854775808) (C99) (($9,223,372,036,854,775,808.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n" +
+"(-9223372036854775808) (D) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D0) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D1) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D2) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D3) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D4) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D5) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D6) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D7) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D8) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D9) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D10) (-9223372036854775808)\n" +
+"(-9223372036854775808) (D99) (-000000000000000000000000000000000000000000000000000000000000000000000000000000009223372036854775808)\n" +
+"(-9223372036854775808) (E) (-9.223372E+018)\n" +
+"(-9223372036854775808) (E0) (-9E+018)\n" +
+"(-9223372036854775808) (E1) (-9.2E+018)\n" +
+"(-9223372036854775808) (E2) (-9.22E+018)\n" +
+"(-9223372036854775808) (E3) (-9.223E+018)\n" +
+"(-9223372036854775808) (E4) (-9.2234E+018)\n" +
+"(-9223372036854775808) (E5) (-9.22337E+018)\n" +
+"(-9223372036854775808) (E6) (-9.223372E+018)\n" +
+"(-9223372036854775808) (E7) (-9.2233720E+018)\n" +
+"(-9223372036854775808) (E8) (-9.22337204E+018)\n" +
+"(-9223372036854775808) (E9) (-9.223372037E+018)\n" +
+"(-9223372036854775808) (E10) (-9.2233720369E+018)\n" +
+"(-9223372036854775808) (E99) (-9.223372036854775808000000000000000000000000000000000000000000000000000000000000000000000000000000000E+018)\n" +
+"(-9223372036854775808) (F) (-9223372036854775808.00)\n" +
+"(-9223372036854775808) (F0) (-9223372036854775808)\n" +
+"(-9223372036854775808) (F1) (-9223372036854775808.0)\n" +
+"(-9223372036854775808) (F2) (-9223372036854775808.00)\n" +
+"(-9223372036854775808) (F3) (-9223372036854775808.000)\n" +
+"(-9223372036854775808) (F4) (-9223372036854775808.0000)\n" +
+"(-9223372036854775808) (F5) (-9223372036854775808.00000)\n" +
+"(-9223372036854775808) (F6) (-9223372036854775808.000000)\n" +
+"(-9223372036854775808) (F7) (-9223372036854775808.0000000)\n" +
+"(-9223372036854775808) (F8) (-9223372036854775808.00000000)\n" +
+"(-9223372036854775808) (F9) (-9223372036854775808.000000000)\n" +
+"(-9223372036854775808) (F10) (-9223372036854775808.0000000000)\n" +
+"(-9223372036854775808) (F99) (-9223372036854775808.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-9223372036854775808) (G) (-9223372036854775808)\n" +
+"(-9223372036854775808) (G0) (-9223372036854775808)\n" +
+"(-9223372036854775808) (G1) (-9E+18)\n" +
+"(-9223372036854775808) (G2) (-9.2E+18)\n" +
+"(-9223372036854775808) (G3) (-9.22E+18)\n" +
+"(-9223372036854775808) (G4) (-9.223E+18)\n" +
+"(-9223372036854775808) (G5) (-9.2234E+18)\n" +
+"(-9223372036854775808) (G6) (-9.22337E+18)\n" +
+"(-9223372036854775808) (G7) (-9.223372E+18)\n" +
+"(-9223372036854775808) (G8) (-9.223372E+18)\n" +
+"(-9223372036854775808) (G9) (-9.22337204E+18)\n" +
+"(-9223372036854775808) (G10) (-9.223372037E+18)\n" +
+"(-9223372036854775808) (G99) (-9223372036854775808)\n" +
+"(-9223372036854775808) (N) (-9,223,372,036,854,775,808.00)\n" +
+"(-9223372036854775808) (N0) (-9,223,372,036,854,775,808)\n" +
+"(-9223372036854775808) (N1) (-9,223,372,036,854,775,808.0)\n" +
+"(-9223372036854775808) (N2) (-9,223,372,036,854,775,808.00)\n" +
+"(-9223372036854775808) (N3) (-9,223,372,036,854,775,808.000)\n" +
+"(-9223372036854775808) (N4) (-9,223,372,036,854,775,808.0000)\n" +
+"(-9223372036854775808) (N5) (-9,223,372,036,854,775,808.00000)\n" +
+"(-9223372036854775808) (N6) (-9,223,372,036,854,775,808.000000)\n" +
+"(-9223372036854775808) (N7) (-9,223,372,036,854,775,808.0000000)\n" +
+"(-9223372036854775808) (N8) (-9,223,372,036,854,775,808.00000000)\n" +
+"(-9223372036854775808) (N9) (-9,223,372,036,854,775,808.000000000)\n" +
+"(-9223372036854775808) (N10) (-9,223,372,036,854,775,808.0000000000)\n" +
+"(-9223372036854775808) (N99) (-9,223,372,036,854,775,808.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-9223372036854775808) (P) (-922,337,203,685,477,580,800.00 %)\n" +
+"(-9223372036854775808) (P0) (-922,337,203,685,477,580,800 %)\n" +
+"(-9223372036854775808) (P1) (-922,337,203,685,477,580,800.0 %)\n" +
+"(-9223372036854775808) (P2) (-922,337,203,685,477,580,800.00 %)\n" +
+"(-9223372036854775808) (P3) (-922,337,203,685,477,580,800.000 %)\n" +
+"(-9223372036854775808) (P4) (-922,337,203,685,477,580,800.0000 %)\n" +
+"(-9223372036854775808) (P5) (-922,337,203,685,477,580,800.00000 %)\n" +
+"(-9223372036854775808) (P6) (-922,337,203,685,477,580,800.000000 %)\n" +
+"(-9223372036854775808) (P7) (-922,337,203,685,477,580,800.0000000 %)\n" +
+"(-9223372036854775808) (P8) (-922,337,203,685,477,580,800.00000000 %)\n" +
+"(-9223372036854775808) (P9) (-922,337,203,685,477,580,800.000000000 %)\n" +
+"(-9223372036854775808) (P10) (-922,337,203,685,477,580,800.0000000000 %)\n" +
+"(-9223372036854775808) (P99) (-922,337,203,685,477,580,800.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(-9223372036854775808) (X) (8000000000000000)\n" +
+"(-9223372036854775808) (X0) (8000000000000000)\n" +
+"(-9223372036854775808) (X1) (8000000000000000)\n" +
+"(-9223372036854775808) (X2) (8000000000000000)\n" +
+"(-9223372036854775808) (X3) (8000000000000000)\n" +
+"(-9223372036854775808) (X4) (8000000000000000)\n" +
+"(-9223372036854775808) (X5) (8000000000000000)\n" +
+"(-9223372036854775808) (X6) (8000000000000000)\n" +
+"(-9223372036854775808) (X7) (8000000000000000)\n" +
+"(-9223372036854775808) (X8) (8000000000000000)\n" +
+"(-9223372036854775808) (X9) (8000000000000000)\n" +
+"(-9223372036854775808) (X10) (8000000000000000)\n" +
+"(-9223372036854775808) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000)\n" +
+"(9223372036854775807) (C) ($9,223,372,036,854,775,807.00)\n" +
+"(9223372036854775807) (C0) ($9,223,372,036,854,775,807)\n" +
+"(9223372036854775807) (C1) ($9,223,372,036,854,775,807.0)\n" +
+"(9223372036854775807) (C2) ($9,223,372,036,854,775,807.00)\n" +
+"(9223372036854775807) (C3) ($9,223,372,036,854,775,807.000)\n" +
+"(9223372036854775807) (C4) ($9,223,372,036,854,775,807.0000)\n" +
+"(9223372036854775807) (C5) ($9,223,372,036,854,775,807.00000)\n" +
+"(9223372036854775807) (C6) ($9,223,372,036,854,775,807.000000)\n" +
+"(9223372036854775807) (C7) ($9,223,372,036,854,775,807.0000000)\n" +
+"(9223372036854775807) (C8) ($9,223,372,036,854,775,807.00000000)\n" +
+"(9223372036854775807) (C9) ($9,223,372,036,854,775,807.000000000)\n" +
+"(9223372036854775807) (C10) ($9,223,372,036,854,775,807.0000000000)\n" +
+"(9223372036854775807) (C99) ($9,223,372,036,854,775,807.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(9223372036854775807) (D) (9223372036854775807)\n" +
+"(9223372036854775807) (D0) (9223372036854775807)\n" +
+"(9223372036854775807) (D1) (9223372036854775807)\n" +
+"(9223372036854775807) (D2) (9223372036854775807)\n" +
+"(9223372036854775807) (D3) (9223372036854775807)\n" +
+"(9223372036854775807) (D4) (9223372036854775807)\n" +
+"(9223372036854775807) (D5) (9223372036854775807)\n" +
+"(9223372036854775807) (D6) (9223372036854775807)\n" +
+"(9223372036854775807) (D7) (9223372036854775807)\n" +
+"(9223372036854775807) (D8) (9223372036854775807)\n" +
+"(9223372036854775807) (D9) (9223372036854775807)\n" +
+"(9223372036854775807) (D10) (9223372036854775807)\n" +
+"(9223372036854775807) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000009223372036854775807)\n" +
+"(9223372036854775807) (E) (9.223372E+018)\n" +
+"(9223372036854775807) (E0) (9E+018)\n" +
+"(9223372036854775807) (E1) (9.2E+018)\n" +
+"(9223372036854775807) (E2) (9.22E+018)\n" +
+"(9223372036854775807) (E3) (9.223E+018)\n" +
+"(9223372036854775807) (E4) (9.2234E+018)\n" +
+"(9223372036854775807) (E5) (9.22337E+018)\n" +
+"(9223372036854775807) (E6) (9.223372E+018)\n" +
+"(9223372036854775807) (E7) (9.2233720E+018)\n" +
+"(9223372036854775807) (E8) (9.22337204E+018)\n" +
+"(9223372036854775807) (E9) (9.223372037E+018)\n" +
+"(9223372036854775807) (E10) (9.2233720369E+018)\n" +
+"(9223372036854775807) (E99) (9.223372036854775807000000000000000000000000000000000000000000000000000000000000000000000000000000000E+018)\n" +
+"(9223372036854775807) (F) (9223372036854775807.00)\n" +
+"(9223372036854775807) (F0) (9223372036854775807)\n" +
+"(9223372036854775807) (F1) (9223372036854775807.0)\n" +
+"(9223372036854775807) (F2) (9223372036854775807.00)\n" +
+"(9223372036854775807) (F3) (9223372036854775807.000)\n" +
+"(9223372036854775807) (F4) (9223372036854775807.0000)\n" +
+"(9223372036854775807) (F5) (9223372036854775807.00000)\n" +
+"(9223372036854775807) (F6) (9223372036854775807.000000)\n" +
+"(9223372036854775807) (F7) (9223372036854775807.0000000)\n" +
+"(9223372036854775807) (F8) (9223372036854775807.00000000)\n" +
+"(9223372036854775807) (F9) (9223372036854775807.000000000)\n" +
+"(9223372036854775807) (F10) (9223372036854775807.0000000000)\n" +
+"(9223372036854775807) (F99) (9223372036854775807.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(9223372036854775807) (G) (9223372036854775807)\n" +
+"(9223372036854775807) (G0) (9223372036854775807)\n" +
+"(9223372036854775807) (G1) (9E+18)\n" +
+"(9223372036854775807) (G2) (9.2E+18)\n" +
+"(9223372036854775807) (G3) (9.22E+18)\n" +
+"(9223372036854775807) (G4) (9.223E+18)\n" +
+"(9223372036854775807) (G5) (9.2234E+18)\n" +
+"(9223372036854775807) (G6) (9.22337E+18)\n" +
+"(9223372036854775807) (G7) (9.223372E+18)\n" +
+"(9223372036854775807) (G8) (9.223372E+18)\n" +
+"(9223372036854775807) (G9) (9.22337204E+18)\n" +
+"(9223372036854775807) (G10) (9.223372037E+18)\n" +
+"(9223372036854775807) (G99) (9223372036854775807)\n" +
+"(9223372036854775807) (N) (9,223,372,036,854,775,807.00)\n" +
+"(9223372036854775807) (N0) (9,223,372,036,854,775,807)\n" +
+"(9223372036854775807) (N1) (9,223,372,036,854,775,807.0)\n" +
+"(9223372036854775807) (N2) (9,223,372,036,854,775,807.00)\n" +
+"(9223372036854775807) (N3) (9,223,372,036,854,775,807.000)\n" +
+"(9223372036854775807) (N4) (9,223,372,036,854,775,807.0000)\n" +
+"(9223372036854775807) (N5) (9,223,372,036,854,775,807.00000)\n" +
+"(9223372036854775807) (N6) (9,223,372,036,854,775,807.000000)\n" +
+"(9223372036854775807) (N7) (9,223,372,036,854,775,807.0000000)\n" +
+"(9223372036854775807) (N8) (9,223,372,036,854,775,807.00000000)\n" +
+"(9223372036854775807) (N9) (9,223,372,036,854,775,807.000000000)\n" +
+"(9223372036854775807) (N10) (9,223,372,036,854,775,807.0000000000)\n" +
+"(9223372036854775807) (N99) (9,223,372,036,854,775,807.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(9223372036854775807) (P) (922,337,203,685,477,580,700.00 %)\n" +
+"(9223372036854775807) (P0) (922,337,203,685,477,580,700 %)\n" +
+"(9223372036854775807) (P1) (922,337,203,685,477,580,700.0 %)\n" +
+"(9223372036854775807) (P2) (922,337,203,685,477,580,700.00 %)\n" +
+"(9223372036854775807) (P3) (922,337,203,685,477,580,700.000 %)\n" +
+"(9223372036854775807) (P4) (922,337,203,685,477,580,700.0000 %)\n" +
+"(9223372036854775807) (P5) (922,337,203,685,477,580,700.00000 %)\n" +
+"(9223372036854775807) (P6) (922,337,203,685,477,580,700.000000 %)\n" +
+"(9223372036854775807) (P7) (922,337,203,685,477,580,700.0000000 %)\n" +
+"(9223372036854775807) (P8) (922,337,203,685,477,580,700.00000000 %)\n" +
+"(9223372036854775807) (P9) (922,337,203,685,477,580,700.000000000 %)\n" +
+"(9223372036854775807) (P10) (922,337,203,685,477,580,700.0000000000 %)\n" +
+"(9223372036854775807) (P99) (922,337,203,685,477,580,700.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(9223372036854775807) (X) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X0) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X1) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X2) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X3) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X4) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X5) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X6) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X7) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X8) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X9) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X10) (7FFFFFFFFFFFFFFF)\n" +
+"(9223372036854775807) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000007FFFFFFFFFFFFFFF)\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (C) (($100.00))\n" +
+"(-100) (C0) (($100))\n" +
+"(-100) (C1) (($100.0))\n" +
+"(-100) (C2) (($100.00))\n" +
+"(-100) (C3) (($100.000))\n" +
+"(-100) (C4) (($100.0000))\n" +
+"(-100) (C5) (($100.00000))\n" +
+"(-100) (C6) (($100.000000))\n" +
+"(-100) (C7) (($100.0000000))\n" +
+"(-100) (C8) (($100.00000000))\n" +
+"(-100) (C9) (($100.000000000))\n" +
+"(-100) (C10) (($100.0000000000))\n" +
+"(-100) (C99) (($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000))\n" +
+"(-100) (D) (-100)\n" +
+"(-100) (D0) (-100)\n" +
+"(-100) (D1) (-100)\n" +
+"(-100) (D2) (-100)\n" +
+"(-100) (D3) (-100)\n" +
+"(-100) (D4) (-0100)\n" +
+"(-100) (D5) (-00100)\n" +
+"(-100) (D6) (-000100)\n" +
+"(-100) (D7) (-0000100)\n" +
+"(-100) (D8) (-00000100)\n" +
+"(-100) (D9) (-000000100)\n" +
+"(-100) (D10) (-0000000100)\n" +
+"(-100) (D99) (-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(-100) (E) (-1.000000E+002)\n" +
+"(-100) (E0) (-1E+002)\n" +
+"(-100) (E1) (-1.0E+002)\n" +
+"(-100) (E2) (-1.00E+002)\n" +
+"(-100) (E3) (-1.000E+002)\n" +
+"(-100) (E4) (-1.0000E+002)\n" +
+"(-100) (E5) (-1.00000E+002)\n" +
+"(-100) (E6) (-1.000000E+002)\n" +
+"(-100) (E7) (-1.0000000E+002)\n" +
+"(-100) (E8) (-1.00000000E+002)\n" +
+"(-100) (E9) (-1.000000000E+002)\n" +
+"(-100) (E10) (-1.0000000000E+002)\n" +
+"(-100) (E99) (-1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(-100) (F) (-100.00)\n" +
+"(-100) (F0) (-100)\n" +
+"(-100) (F1) (-100.0)\n" +
+"(-100) (F2) (-100.00)\n" +
+"(-100) (F3) (-100.000)\n" +
+"(-100) (F4) (-100.0000)\n" +
+"(-100) (F5) (-100.00000)\n" +
+"(-100) (F6) (-100.000000)\n" +
+"(-100) (F7) (-100.0000000)\n" +
+"(-100) (F8) (-100.00000000)\n" +
+"(-100) (F9) (-100.000000000)\n" +
+"(-100) (F10) (-100.0000000000)\n" +
+"(-100) (F99) (-100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (G) (-100)\n" +
+"(-100) (G0) (-100)\n" +
+"(-100) (G1) (-1E+02)\n" +
+"(-100) (G2) (-1E+02)\n" +
+"(-100) (G3) (-100)\n" +
+"(-100) (G4) (-100)\n" +
+"(-100) (G5) (-100)\n" +
+"(-100) (G6) (-100)\n" +
+"(-100) (G7) (-100)\n" +
+"(-100) (G8) (-100)\n" +
+"(-100) (G9) (-100)\n" +
+"(-100) (G10) (-100)\n" +
+"(-100) (G99) (-100)\n" +
+"(-100) (N) (-100.00)\n" +
+"(-100) (N0) (-100)\n" +
+"(-100) (N1) (-100.0)\n" +
+"(-100) (N2) (-100.00)\n" +
+"(-100) (N3) (-100.000)\n" +
+"(-100) (N4) (-100.0000)\n" +
+"(-100) (N5) (-100.00000)\n" +
+"(-100) (N6) (-100.000000)\n" +
+"(-100) (N7) (-100.0000000)\n" +
+"(-100) (N8) (-100.00000000)\n" +
+"(-100) (N9) (-100.000000000)\n" +
+"(-100) (N10) (-100.0000000000)\n" +
+"(-100) (N99) (-100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(-100) (P) (-10,000.00 %)\n" +
+"(-100) (P0) (-10,000 %)\n" +
+"(-100) (P1) (-10,000.0 %)\n" +
+"(-100) (P2) (-10,000.00 %)\n" +
+"(-100) (P3) (-10,000.000 %)\n" +
+"(-100) (P4) (-10,000.0000 %)\n" +
+"(-100) (P5) (-10,000.00000 %)\n" +
+"(-100) (P6) (-10,000.000000 %)\n" +
+"(-100) (P7) (-10,000.0000000 %)\n" +
+"(-100) (P8) (-10,000.00000000 %)\n" +
+"(-100) (P9) (-10,000.000000000 %)\n" +
+"(-100) (P10) (-10,000.0000000000 %)\n" +
+"(-100) (P99) (-10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(-100) (X) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X0) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X1) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X2) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X3) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X4) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X5) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X6) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X7) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X8) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X9) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X10) (FFFFFFFFFFFFFF9C)\n" +
+"(-100) (X99) (00000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFF9C)\n" +
+"(100) (C) ($100.00)\n" +
+"(100) (C0) ($100)\n" +
+"(100) (C1) ($100.0)\n" +
+"(100) (C2) ($100.00)\n" +
+"(100) (C3) ($100.000)\n" +
+"(100) (C4) ($100.0000)\n" +
+"(100) (C5) ($100.00000)\n" +
+"(100) (C6) ($100.000000)\n" +
+"(100) (C7) ($100.0000000)\n" +
+"(100) (C8) ($100.00000000)\n" +
+"(100) (C9) ($100.000000000)\n" +
+"(100) (C10) ($100.0000000000)\n" +
+"(100) (C99) ($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (D) (100)\n" +
+"(100) (D0) (100)\n" +
+"(100) (D1) (100)\n" +
+"(100) (D2) (100)\n" +
+"(100) (D3) (100)\n" +
+"(100) (D4) (0100)\n" +
+"(100) (D5) (00100)\n" +
+"(100) (D6) (000100)\n" +
+"(100) (D7) (0000100)\n" +
+"(100) (D8) (00000100)\n" +
+"(100) (D9) (000000100)\n" +
+"(100) (D10) (0000000100)\n" +
+"(100) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(100) (E) (1.000000E+002)\n" +
+"(100) (E0) (1E+002)\n" +
+"(100) (E1) (1.0E+002)\n" +
+"(100) (E2) (1.00E+002)\n" +
+"(100) (E3) (1.000E+002)\n" +
+"(100) (E4) (1.0000E+002)\n" +
+"(100) (E5) (1.00000E+002)\n" +
+"(100) (E6) (1.000000E+002)\n" +
+"(100) (E7) (1.0000000E+002)\n" +
+"(100) (E8) (1.00000000E+002)\n" +
+"(100) (E9) (1.000000000E+002)\n" +
+"(100) (E10) (1.0000000000E+002)\n" +
+"(100) (E99) (1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(100) (F) (100.00)\n" +
+"(100) (F0) (100)\n" +
+"(100) (F1) (100.0)\n" +
+"(100) (F2) (100.00)\n" +
+"(100) (F3) (100.000)\n" +
+"(100) (F4) (100.0000)\n" +
+"(100) (F5) (100.00000)\n" +
+"(100) (F6) (100.000000)\n" +
+"(100) (F7) (100.0000000)\n" +
+"(100) (F8) (100.00000000)\n" +
+"(100) (F9) (100.000000000)\n" +
+"(100) (F10) (100.0000000000)\n" +
+"(100) (F99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (G) (100)\n" +
+"(100) (G0) (100)\n" +
+"(100) (G1) (1E+02)\n" +
+"(100) (G2) (1E+02)\n" +
+"(100) (G3) (100)\n" +
+"(100) (G4) (100)\n" +
+"(100) (G5) (100)\n" +
+"(100) (G6) (100)\n" +
+"(100) (G7) (100)\n" +
+"(100) (G8) (100)\n" +
+"(100) (G9) (100)\n" +
+"(100) (G10) (100)\n" +
+"(100) (G99) (100)\n" +
+"(100) (N) (100.00)\n" +
+"(100) (N0) (100)\n" +
+"(100) (N1) (100.0)\n" +
+"(100) (N2) (100.00)\n" +
+"(100) (N3) (100.000)\n" +
+"(100) (N4) (100.0000)\n" +
+"(100) (N5) (100.00000)\n" +
+"(100) (N6) (100.000000)\n" +
+"(100) (N7) (100.0000000)\n" +
+"(100) (N8) (100.00000000)\n" +
+"(100) (N9) (100.000000000)\n" +
+"(100) (N10) (100.0000000000)\n" +
+"(100) (N99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (P) (10,000.00 %)\n" +
+"(100) (P0) (10,000 %)\n" +
+"(100) (P1) (10,000.0 %)\n" +
+"(100) (P2) (10,000.00 %)\n" +
+"(100) (P3) (10,000.000 %)\n" +
+"(100) (P4) (10,000.0000 %)\n" +
+"(100) (P5) (10,000.00000 %)\n" +
+"(100) (P6) (10,000.000000 %)\n" +
+"(100) (P7) (10,000.0000000 %)\n" +
+"(100) (P8) (10,000.00000000 %)\n" +
+"(100) (P9) (10,000.000000000 %)\n" +
+"(100) (P10) (10,000.0000000000 %)\n" +
+"(100) (P99) (10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(100) (X) (64)\n" +
+"(100) (X0) (64)\n" +
+"(100) (X1) (64)\n" +
+"(100) (X2) (64)\n" +
+"(100) (X3) (064)\n" +
+"(100) (X4) (0064)\n" +
+"(100) (X5) (00064)\n" +
+"(100) (X6) (000064)\n" +
+"(100) (X7) (0000064)\n" +
+"(100) (X8) (00000064)\n" +
+"(100) (X9) (000000064)\n" +
+"(100) (X10) (0000000064)\n" +
+"(100) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064)\n" +
+"UInt32\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(4294967295) (C) ($4,294,967,295.00)\n" +
+"(4294967295) (C0) ($4,294,967,295)\n" +
+"(4294967295) (C1) ($4,294,967,295.0)\n" +
+"(4294967295) (C2) ($4,294,967,295.00)\n" +
+"(4294967295) (C3) ($4,294,967,295.000)\n" +
+"(4294967295) (C4) ($4,294,967,295.0000)\n" +
+"(4294967295) (C5) ($4,294,967,295.00000)\n" +
+"(4294967295) (C6) ($4,294,967,295.000000)\n" +
+"(4294967295) (C7) ($4,294,967,295.0000000)\n" +
+"(4294967295) (C8) ($4,294,967,295.00000000)\n" +
+"(4294967295) (C9) ($4,294,967,295.000000000)\n" +
+"(4294967295) (C10) ($4,294,967,295.0000000000)\n" +
+"(4294967295) (C99) ($4,294,967,295.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(4294967295) (D) (4294967295)\n" +
+"(4294967295) (D0) (4294967295)\n" +
+"(4294967295) (D1) (4294967295)\n" +
+"(4294967295) (D2) (4294967295)\n" +
+"(4294967295) (D3) (4294967295)\n" +
+"(4294967295) (D4) (4294967295)\n" +
+"(4294967295) (D5) (4294967295)\n" +
+"(4294967295) (D6) (4294967295)\n" +
+"(4294967295) (D7) (4294967295)\n" +
+"(4294967295) (D8) (4294967295)\n" +
+"(4294967295) (D9) (4294967295)\n" +
+"(4294967295) (D10) (4294967295)\n" +
+"(4294967295) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004294967295)\n" +
+"(4294967295) (E) (4.294967E+009)\n" +
+"(4294967295) (E0) (4E+009)\n" +
+"(4294967295) (E1) (4.3E+009)\n" +
+"(4294967295) (E2) (4.29E+009)\n" +
+"(4294967295) (E3) (4.295E+009)\n" +
+"(4294967295) (E4) (4.2950E+009)\n" +
+"(4294967295) (E5) (4.29497E+009)\n" +
+"(4294967295) (E6) (4.294967E+009)\n" +
+"(4294967295) (E7) (4.2949673E+009)\n" +
+"(4294967295) (E8) (4.29496730E+009)\n" +
+"(4294967295) (E9) (4.294967295E+009)\n" +
+"(4294967295) (E10) (4.2949672950E+009)\n" +
+"(4294967295) (E99) (4.294967295000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+009)\n" +
+"(4294967295) (F) (4294967295.00)\n" +
+"(4294967295) (F0) (4294967295)\n" +
+"(4294967295) (F1) (4294967295.0)\n" +
+"(4294967295) (F2) (4294967295.00)\n" +
+"(4294967295) (F3) (4294967295.000)\n" +
+"(4294967295) (F4) (4294967295.0000)\n" +
+"(4294967295) (F5) (4294967295.00000)\n" +
+"(4294967295) (F6) (4294967295.000000)\n" +
+"(4294967295) (F7) (4294967295.0000000)\n" +
+"(4294967295) (F8) (4294967295.00000000)\n" +
+"(4294967295) (F9) (4294967295.000000000)\n" +
+"(4294967295) (F10) (4294967295.0000000000)\n" +
+"(4294967295) (F99) (4294967295.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(4294967295) (G) (4294967295)\n" +
+"(4294967295) (G0) (4294967295)\n" +
+"(4294967295) (G1) (4E+09)\n" +
+"(4294967295) (G2) (4.3E+09)\n" +
+"(4294967295) (G3) (4.29E+09)\n" +
+"(4294967295) (G4) (4.295E+09)\n" +
+"(4294967295) (G5) (4.295E+09)\n" +
+"(4294967295) (G6) (4.29497E+09)\n" +
+"(4294967295) (G7) (4.294967E+09)\n" +
+"(4294967295) (G8) (4.2949673E+09)\n" +
+"(4294967295) (G9) (4.2949673E+09)\n" +
+"(4294967295) (G10) (4294967295)\n" +
+"(4294967295) (G99) (4294967295)\n" +
+"(4294967295) (N) (4,294,967,295.00)\n" +
+"(4294967295) (N0) (4,294,967,295)\n" +
+"(4294967295) (N1) (4,294,967,295.0)\n" +
+"(4294967295) (N2) (4,294,967,295.00)\n" +
+"(4294967295) (N3) (4,294,967,295.000)\n" +
+"(4294967295) (N4) (4,294,967,295.0000)\n" +
+"(4294967295) (N5) (4,294,967,295.00000)\n" +
+"(4294967295) (N6) (4,294,967,295.000000)\n" +
+"(4294967295) (N7) (4,294,967,295.0000000)\n" +
+"(4294967295) (N8) (4,294,967,295.00000000)\n" +
+"(4294967295) (N9) (4,294,967,295.000000000)\n" +
+"(4294967295) (N10) (4,294,967,295.0000000000)\n" +
+"(4294967295) (N99) (4,294,967,295.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(4294967295) (P) (429,496,729,500.00 %)\n" +
+"(4294967295) (P0) (429,496,729,500 %)\n" +
+"(4294967295) (P1) (429,496,729,500.0 %)\n" +
+"(4294967295) (P2) (429,496,729,500.00 %)\n" +
+"(4294967295) (P3) (429,496,729,500.000 %)\n" +
+"(4294967295) (P4) (429,496,729,500.0000 %)\n" +
+"(4294967295) (P5) (429,496,729,500.00000 %)\n" +
+"(4294967295) (P6) (429,496,729,500.000000 %)\n" +
+"(4294967295) (P7) (429,496,729,500.0000000 %)\n" +
+"(4294967295) (P8) (429,496,729,500.00000000 %)\n" +
+"(4294967295) (P9) (429,496,729,500.000000000 %)\n" +
+"(4294967295) (P10) (429,496,729,500.0000000000 %)\n" +
+"(4294967295) (P99) (429,496,729,500.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(4294967295) (X) (FFFFFFFF)\n" +
+"(4294967295) (X0) (FFFFFFFF)\n" +
+"(4294967295) (X1) (FFFFFFFF)\n" +
+"(4294967295) (X2) (FFFFFFFF)\n" +
+"(4294967295) (X3) (FFFFFFFF)\n" +
+"(4294967295) (X4) (FFFFFFFF)\n" +
+"(4294967295) (X5) (FFFFFFFF)\n" +
+"(4294967295) (X6) (FFFFFFFF)\n" +
+"(4294967295) (X7) (FFFFFFFF)\n" +
+"(4294967295) (X8) (FFFFFFFF)\n" +
+"(4294967295) (X9) (0FFFFFFFF)\n" +
+"(4294967295) (X10) (00FFFFFFFF)\n" +
+"(4294967295) (X99) (0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFF)\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (C) ($100.00)\n" +
+"(100) (C0) ($100)\n" +
+"(100) (C1) ($100.0)\n" +
+"(100) (C2) ($100.00)\n" +
+"(100) (C3) ($100.000)\n" +
+"(100) (C4) ($100.0000)\n" +
+"(100) (C5) ($100.00000)\n" +
+"(100) (C6) ($100.000000)\n" +
+"(100) (C7) ($100.0000000)\n" +
+"(100) (C8) ($100.00000000)\n" +
+"(100) (C9) ($100.000000000)\n" +
+"(100) (C10) ($100.0000000000)\n" +
+"(100) (C99) ($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (D) (100)\n" +
+"(100) (D0) (100)\n" +
+"(100) (D1) (100)\n" +
+"(100) (D2) (100)\n" +
+"(100) (D3) (100)\n" +
+"(100) (D4) (0100)\n" +
+"(100) (D5) (00100)\n" +
+"(100) (D6) (000100)\n" +
+"(100) (D7) (0000100)\n" +
+"(100) (D8) (00000100)\n" +
+"(100) (D9) (000000100)\n" +
+"(100) (D10) (0000000100)\n" +
+"(100) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(100) (E) (1.000000E+002)\n" +
+"(100) (E0) (1E+002)\n" +
+"(100) (E1) (1.0E+002)\n" +
+"(100) (E2) (1.00E+002)\n" +
+"(100) (E3) (1.000E+002)\n" +
+"(100) (E4) (1.0000E+002)\n" +
+"(100) (E5) (1.00000E+002)\n" +
+"(100) (E6) (1.000000E+002)\n" +
+"(100) (E7) (1.0000000E+002)\n" +
+"(100) (E8) (1.00000000E+002)\n" +
+"(100) (E9) (1.000000000E+002)\n" +
+"(100) (E10) (1.0000000000E+002)\n" +
+"(100) (E99) (1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(100) (F) (100.00)\n" +
+"(100) (F0) (100)\n" +
+"(100) (F1) (100.0)\n" +
+"(100) (F2) (100.00)\n" +
+"(100) (F3) (100.000)\n" +
+"(100) (F4) (100.0000)\n" +
+"(100) (F5) (100.00000)\n" +
+"(100) (F6) (100.000000)\n" +
+"(100) (F7) (100.0000000)\n" +
+"(100) (F8) (100.00000000)\n" +
+"(100) (F9) (100.000000000)\n" +
+"(100) (F10) (100.0000000000)\n" +
+"(100) (F99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (G) (100)\n" +
+"(100) (G0) (100)\n" +
+"(100) (G1) (1E+02)\n" +
+"(100) (G2) (1E+02)\n" +
+"(100) (G3) (100)\n" +
+"(100) (G4) (100)\n" +
+"(100) (G5) (100)\n" +
+"(100) (G6) (100)\n" +
+"(100) (G7) (100)\n" +
+"(100) (G8) (100)\n" +
+"(100) (G9) (100)\n" +
+"(100) (G10) (100)\n" +
+"(100) (G99) (100)\n" +
+"(100) (N) (100.00)\n" +
+"(100) (N0) (100)\n" +
+"(100) (N1) (100.0)\n" +
+"(100) (N2) (100.00)\n" +
+"(100) (N3) (100.000)\n" +
+"(100) (N4) (100.0000)\n" +
+"(100) (N5) (100.00000)\n" +
+"(100) (N6) (100.000000)\n" +
+"(100) (N7) (100.0000000)\n" +
+"(100) (N8) (100.00000000)\n" +
+"(100) (N9) (100.000000000)\n" +
+"(100) (N10) (100.0000000000)\n" +
+"(100) (N99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (P) (10,000.00 %)\n" +
+"(100) (P0) (10,000 %)\n" +
+"(100) (P1) (10,000.0 %)\n" +
+"(100) (P2) (10,000.00 %)\n" +
+"(100) (P3) (10,000.000 %)\n" +
+"(100) (P4) (10,000.0000 %)\n" +
+"(100) (P5) (10,000.00000 %)\n" +
+"(100) (P6) (10,000.000000 %)\n" +
+"(100) (P7) (10,000.0000000 %)\n" +
+"(100) (P8) (10,000.00000000 %)\n" +
+"(100) (P9) (10,000.000000000 %)\n" +
+"(100) (P10) (10,000.0000000000 %)\n" +
+"(100) (P99) (10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(100) (X) (64)\n" +
+"(100) (X0) (64)\n" +
+"(100) (X1) (64)\n" +
+"(100) (X2) (64)\n" +
+"(100) (X3) (064)\n" +
+"(100) (X4) (0064)\n" +
+"(100) (X5) (00064)\n" +
+"(100) (X6) (000064)\n" +
+"(100) (X7) (0000064)\n" +
+"(100) (X8) (00000064)\n" +
+"(100) (X9) (000000064)\n" +
+"(100) (X10) (0000000064)\n" +
+"(100) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064)\n" +
+"UInt64\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(18446744073709551615) (C) ($18,446,744,073,709,551,615.00)\n" +
+"(18446744073709551615) (C0) ($18,446,744,073,709,551,615)\n" +
+"(18446744073709551615) (C1) ($18,446,744,073,709,551,615.0)\n" +
+"(18446744073709551615) (C2) ($18,446,744,073,709,551,615.00)\n" +
+"(18446744073709551615) (C3) ($18,446,744,073,709,551,615.000)\n" +
+"(18446744073709551615) (C4) ($18,446,744,073,709,551,615.0000)\n" +
+"(18446744073709551615) (C5) ($18,446,744,073,709,551,615.00000)\n" +
+"(18446744073709551615) (C6) ($18,446,744,073,709,551,615.000000)\n" +
+"(18446744073709551615) (C7) ($18,446,744,073,709,551,615.0000000)\n" +
+"(18446744073709551615) (C8) ($18,446,744,073,709,551,615.00000000)\n" +
+"(18446744073709551615) (C9) ($18,446,744,073,709,551,615.000000000)\n" +
+"(18446744073709551615) (C10) ($18,446,744,073,709,551,615.0000000000)\n" +
+"(18446744073709551615) (C99) ($18,446,744,073,709,551,615.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(18446744073709551615) (D) (18446744073709551615)\n" +
+"(18446744073709551615) (D0) (18446744073709551615)\n" +
+"(18446744073709551615) (D1) (18446744073709551615)\n" +
+"(18446744073709551615) (D2) (18446744073709551615)\n" +
+"(18446744073709551615) (D3) (18446744073709551615)\n" +
+"(18446744073709551615) (D4) (18446744073709551615)\n" +
+"(18446744073709551615) (D5) (18446744073709551615)\n" +
+"(18446744073709551615) (D6) (18446744073709551615)\n" +
+"(18446744073709551615) (D7) (18446744073709551615)\n" +
+"(18446744073709551615) (D8) (18446744073709551615)\n" +
+"(18446744073709551615) (D9) (18446744073709551615)\n" +
+"(18446744073709551615) (D10) (18446744073709551615)\n" +
+"(18446744073709551615) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000018446744073709551615)\n" +
+"(18446744073709551615) (E) (1.844674E+019)\n" +
+"(18446744073709551615) (E0) (2E+019)\n" +
+"(18446744073709551615) (E1) (1.8E+019)\n" +
+"(18446744073709551615) (E2) (1.84E+019)\n" +
+"(18446744073709551615) (E3) (1.845E+019)\n" +
+"(18446744073709551615) (E4) (1.8447E+019)\n" +
+"(18446744073709551615) (E5) (1.84467E+019)\n" +
+"(18446744073709551615) (E6) (1.844674E+019)\n" +
+"(18446744073709551615) (E7) (1.8446744E+019)\n" +
+"(18446744073709551615) (E8) (1.84467441E+019)\n" +
+"(18446744073709551615) (E9) (1.844674407E+019)\n" +
+"(18446744073709551615) (E10) (1.8446744074E+019)\n" +
+"(18446744073709551615) (E99) (1.844674407370955161500000000000000000000000000000000000000000000000000000000000000000000000000000000E+019)\n" +
+"(18446744073709551615) (F) (18446744073709551615.00)\n" +
+"(18446744073709551615) (F0) (18446744073709551615)\n" +
+"(18446744073709551615) (F1) (18446744073709551615.0)\n" +
+"(18446744073709551615) (F2) (18446744073709551615.00)\n" +
+"(18446744073709551615) (F3) (18446744073709551615.000)\n" +
+"(18446744073709551615) (F4) (18446744073709551615.0000)\n" +
+"(18446744073709551615) (F5) (18446744073709551615.00000)\n" +
+"(18446744073709551615) (F6) (18446744073709551615.000000)\n" +
+"(18446744073709551615) (F7) (18446744073709551615.0000000)\n" +
+"(18446744073709551615) (F8) (18446744073709551615.00000000)\n" +
+"(18446744073709551615) (F9) (18446744073709551615.000000000)\n" +
+"(18446744073709551615) (F10) (18446744073709551615.0000000000)\n" +
+"(18446744073709551615) (F99) (18446744073709551615.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(18446744073709551615) (G) (18446744073709551615)\n" +
+"(18446744073709551615) (G0) (18446744073709551615)\n" +
+"(18446744073709551615) (G1) (2E+19)\n" +
+"(18446744073709551615) (G2) (1.8E+19)\n" +
+"(18446744073709551615) (G3) (1.84E+19)\n" +
+"(18446744073709551615) (G4) (1.845E+19)\n" +
+"(18446744073709551615) (G5) (1.8447E+19)\n" +
+"(18446744073709551615) (G6) (1.84467E+19)\n" +
+"(18446744073709551615) (G7) (1.844674E+19)\n" +
+"(18446744073709551615) (G8) (1.8446744E+19)\n" +
+"(18446744073709551615) (G9) (1.84467441E+19)\n" +
+"(18446744073709551615) (G10) (1.844674407E+19)\n" +
+"(18446744073709551615) (G99) (18446744073709551615)\n" +
+"(18446744073709551615) (N) (18,446,744,073,709,551,615.00)\n" +
+"(18446744073709551615) (N0) (18,446,744,073,709,551,615)\n" +
+"(18446744073709551615) (N1) (18,446,744,073,709,551,615.0)\n" +
+"(18446744073709551615) (N2) (18,446,744,073,709,551,615.00)\n" +
+"(18446744073709551615) (N3) (18,446,744,073,709,551,615.000)\n" +
+"(18446744073709551615) (N4) (18,446,744,073,709,551,615.0000)\n" +
+"(18446744073709551615) (N5) (18,446,744,073,709,551,615.00000)\n" +
+"(18446744073709551615) (N6) (18,446,744,073,709,551,615.000000)\n" +
+"(18446744073709551615) (N7) (18,446,744,073,709,551,615.0000000)\n" +
+"(18446744073709551615) (N8) (18,446,744,073,709,551,615.00000000)\n" +
+"(18446744073709551615) (N9) (18,446,744,073,709,551,615.000000000)\n" +
+"(18446744073709551615) (N10) (18,446,744,073,709,551,615.0000000000)\n" +
+"(18446744073709551615) (N99) (18,446,744,073,709,551,615.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(18446744073709551615) (P) (1,844,674,407,370,955,161,500.00 %)\n" +
+"(18446744073709551615) (P0) (1,844,674,407,370,955,161,500 %)\n" +
+"(18446744073709551615) (P1) (1,844,674,407,370,955,161,500.0 %)\n" +
+"(18446744073709551615) (P2) (1,844,674,407,370,955,161,500.00 %)\n" +
+"(18446744073709551615) (P3) (1,844,674,407,370,955,161,500.000 %)\n" +
+"(18446744073709551615) (P4) (1,844,674,407,370,955,161,500.0000 %)\n" +
+"(18446744073709551615) (P5) (1,844,674,407,370,955,161,500.00000 %)\n" +
+"(18446744073709551615) (P6) (1,844,674,407,370,955,161,500.000000 %)\n" +
+"(18446744073709551615) (P7) (1,844,674,407,370,955,161,500.0000000 %)\n" +
+"(18446744073709551615) (P8) (1,844,674,407,370,955,161,500.00000000 %)\n" +
+"(18446744073709551615) (P9) (1,844,674,407,370,955,161,500.000000000 %)\n" +
+"(18446744073709551615) (P10) (1,844,674,407,370,955,161,500.0000000000 %)\n" +
+"(18446744073709551615) (P99) (1,844,674,407,370,955,161,500.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(18446744073709551615) (X) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X0) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X1) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X2) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X3) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X4) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X5) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X6) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X7) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X8) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X9) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X10) (FFFFFFFFFFFFFFFF)\n" +
+"(18446744073709551615) (X99) (00000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFF)\n" +
+"(0) (C) ($0.00)\n" +
+"(0) (C0) ($0)\n" +
+"(0) (C1) ($0.0)\n" +
+"(0) (C2) ($0.00)\n" +
+"(0) (C3) ($0.000)\n" +
+"(0) (C4) ($0.0000)\n" +
+"(0) (C5) ($0.00000)\n" +
+"(0) (C6) ($0.000000)\n" +
+"(0) (C7) ($0.0000000)\n" +
+"(0) (C8) ($0.00000000)\n" +
+"(0) (C9) ($0.000000000)\n" +
+"(0) (C10) ($0.0000000000)\n" +
+"(0) (C99) ($0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (D) (0)\n" +
+"(0) (D0) (0)\n" +
+"(0) (D1) (0)\n" +
+"(0) (D2) (00)\n" +
+"(0) (D3) (000)\n" +
+"(0) (D4) (0000)\n" +
+"(0) (D5) (00000)\n" +
+"(0) (D6) (000000)\n" +
+"(0) (D7) (0000000)\n" +
+"(0) (D8) (00000000)\n" +
+"(0) (D9) (000000000)\n" +
+"(0) (D10) (0000000000)\n" +
+"(0) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (E) (0.000000E+000)\n" +
+"(0) (E0) (0E+000)\n" +
+"(0) (E1) (0.0E+000)\n" +
+"(0) (E2) (0.00E+000)\n" +
+"(0) (E3) (0.000E+000)\n" +
+"(0) (E4) (0.0000E+000)\n" +
+"(0) (E5) (0.00000E+000)\n" +
+"(0) (E6) (0.000000E+000)\n" +
+"(0) (E7) (0.0000000E+000)\n" +
+"(0) (E8) (0.00000000E+000)\n" +
+"(0) (E9) (0.000000000E+000)\n" +
+"(0) (E10) (0.0000000000E+000)\n" +
+"(0) (E99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+000)\n" +
+"(0) (F) (0.00)\n" +
+"(0) (F0) (0)\n" +
+"(0) (F1) (0.0)\n" +
+"(0) (F2) (0.00)\n" +
+"(0) (F3) (0.000)\n" +
+"(0) (F4) (0.0000)\n" +
+"(0) (F5) (0.00000)\n" +
+"(0) (F6) (0.000000)\n" +
+"(0) (F7) (0.0000000)\n" +
+"(0) (F8) (0.00000000)\n" +
+"(0) (F9) (0.000000000)\n" +
+"(0) (F10) (0.0000000000)\n" +
+"(0) (F99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (G) (0)\n" +
+"(0) (G0) (0)\n" +
+"(0) (G1) (0)\n" +
+"(0) (G2) (0)\n" +
+"(0) (G3) (0)\n" +
+"(0) (G4) (0)\n" +
+"(0) (G5) (0)\n" +
+"(0) (G6) (0)\n" +
+"(0) (G7) (0)\n" +
+"(0) (G8) (0)\n" +
+"(0) (G9) (0)\n" +
+"(0) (G10) (0)\n" +
+"(0) (G99) (0)\n" +
+"(0) (N) (0.00)\n" +
+"(0) (N0) (0)\n" +
+"(0) (N1) (0.0)\n" +
+"(0) (N2) (0.00)\n" +
+"(0) (N3) (0.000)\n" +
+"(0) (N4) (0.0000)\n" +
+"(0) (N5) (0.00000)\n" +
+"(0) (N6) (0.000000)\n" +
+"(0) (N7) (0.0000000)\n" +
+"(0) (N8) (0.00000000)\n" +
+"(0) (N9) (0.000000000)\n" +
+"(0) (N10) (0.0000000000)\n" +
+"(0) (N99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(0) (P) (0.00 %)\n" +
+"(0) (P0) (0 %)\n" +
+"(0) (P1) (0.0 %)\n" +
+"(0) (P2) (0.00 %)\n" +
+"(0) (P3) (0.000 %)\n" +
+"(0) (P4) (0.0000 %)\n" +
+"(0) (P5) (0.00000 %)\n" +
+"(0) (P6) (0.000000 %)\n" +
+"(0) (P7) (0.0000000 %)\n" +
+"(0) (P8) (0.00000000 %)\n" +
+"(0) (P9) (0.000000000 %)\n" +
+"(0) (P10) (0.0000000000 %)\n" +
+"(0) (P99) (0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(0) (X) (0)\n" +
+"(0) (X0) (0)\n" +
+"(0) (X1) (0)\n" +
+"(0) (X2) (00)\n" +
+"(0) (X3) (000)\n" +
+"(0) (X4) (0000)\n" +
+"(0) (X5) (00000)\n" +
+"(0) (X6) (000000)\n" +
+"(0) (X7) (0000000)\n" +
+"(0) (X8) (00000000)\n" +
+"(0) (X9) (000000000)\n" +
+"(0) (X10) (0000000000)\n" +
+"(0) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (C) ($100.00)\n" +
+"(100) (C0) ($100)\n" +
+"(100) (C1) ($100.0)\n" +
+"(100) (C2) ($100.00)\n" +
+"(100) (C3) ($100.000)\n" +
+"(100) (C4) ($100.0000)\n" +
+"(100) (C5) ($100.00000)\n" +
+"(100) (C6) ($100.000000)\n" +
+"(100) (C7) ($100.0000000)\n" +
+"(100) (C8) ($100.00000000)\n" +
+"(100) (C9) ($100.000000000)\n" +
+"(100) (C10) ($100.0000000000)\n" +
+"(100) (C99) ($100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (D) (100)\n" +
+"(100) (D0) (100)\n" +
+"(100) (D1) (100)\n" +
+"(100) (D2) (100)\n" +
+"(100) (D3) (100)\n" +
+"(100) (D4) (0100)\n" +
+"(100) (D5) (00100)\n" +
+"(100) (D6) (000100)\n" +
+"(100) (D7) (0000100)\n" +
+"(100) (D8) (00000100)\n" +
+"(100) (D9) (000000100)\n" +
+"(100) (D10) (0000000100)\n" +
+"(100) (D99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100)\n" +
+"(100) (E) (1.000000E+002)\n" +
+"(100) (E0) (1E+002)\n" +
+"(100) (E1) (1.0E+002)\n" +
+"(100) (E2) (1.00E+002)\n" +
+"(100) (E3) (1.000E+002)\n" +
+"(100) (E4) (1.0000E+002)\n" +
+"(100) (E5) (1.00000E+002)\n" +
+"(100) (E6) (1.000000E+002)\n" +
+"(100) (E7) (1.0000000E+002)\n" +
+"(100) (E8) (1.00000000E+002)\n" +
+"(100) (E9) (1.000000000E+002)\n" +
+"(100) (E10) (1.0000000000E+002)\n" +
+"(100) (E99) (1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E+002)\n" +
+"(100) (F) (100.00)\n" +
+"(100) (F0) (100)\n" +
+"(100) (F1) (100.0)\n" +
+"(100) (F2) (100.00)\n" +
+"(100) (F3) (100.000)\n" +
+"(100) (F4) (100.0000)\n" +
+"(100) (F5) (100.00000)\n" +
+"(100) (F6) (100.000000)\n" +
+"(100) (F7) (100.0000000)\n" +
+"(100) (F8) (100.00000000)\n" +
+"(100) (F9) (100.000000000)\n" +
+"(100) (F10) (100.0000000000)\n" +
+"(100) (F99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (G) (100)\n" +
+"(100) (G0) (100)\n" +
+"(100) (G1) (1E+02)\n" +
+"(100) (G2) (1E+02)\n" +
+"(100) (G3) (100)\n" +
+"(100) (G4) (100)\n" +
+"(100) (G5) (100)\n" +
+"(100) (G6) (100)\n" +
+"(100) (G7) (100)\n" +
+"(100) (G8) (100)\n" +
+"(100) (G9) (100)\n" +
+"(100) (G10) (100)\n" +
+"(100) (G99) (100)\n" +
+"(100) (N) (100.00)\n" +
+"(100) (N0) (100)\n" +
+"(100) (N1) (100.0)\n" +
+"(100) (N2) (100.00)\n" +
+"(100) (N3) (100.000)\n" +
+"(100) (N4) (100.0000)\n" +
+"(100) (N5) (100.00000)\n" +
+"(100) (N6) (100.000000)\n" +
+"(100) (N7) (100.0000000)\n" +
+"(100) (N8) (100.00000000)\n" +
+"(100) (N9) (100.000000000)\n" +
+"(100) (N10) (100.0000000000)\n" +
+"(100) (N99) (100.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)\n" +
+"(100) (P) (10,000.00 %)\n" +
+"(100) (P0) (10,000 %)\n" +
+"(100) (P1) (10,000.0 %)\n" +
+"(100) (P2) (10,000.00 %)\n" +
+"(100) (P3) (10,000.000 %)\n" +
+"(100) (P4) (10,000.0000 %)\n" +
+"(100) (P5) (10,000.00000 %)\n" +
+"(100) (P6) (10,000.000000 %)\n" +
+"(100) (P7) (10,000.0000000 %)\n" +
+"(100) (P8) (10,000.00000000 %)\n" +
+"(100) (P9) (10,000.000000000 %)\n" +
+"(100) (P10) (10,000.0000000000 %)\n" +
+"(100) (P99) (10,000.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 %)\n" +
+"(100) (X) (64)\n" +
+"(100) (X0) (64)\n" +
+"(100) (X1) (64)\n" +
+"(100) (X2) (64)\n" +
+"(100) (X3) (064)\n" +
+"(100) (X4) (0064)\n" +
+"(100) (X5) (00064)\n" +
+"(100) (X6) (000064)\n" +
+"(100) (X7) (0000064)\n" +
+"(100) (X8) (00000064)\n" +
+"(100) (X9) (000000064)\n" +
+"(100) (X10) (0000000064)\n" +
+"(100) (X99) (000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064)\n";
+}
+
+}
+
diff --git a/mcs/class/corlib/Test/System/MartinTests.cs b/mcs/class/corlib/Test/System/MartinTests.cs
new file mode 100755
index 00000000000..917b69517e7
--- /dev/null
+++ b/mcs/class/corlib/Test/System/MartinTests.cs
@@ -0,0 +1,73 @@
+// Testsuite.System.MartinSystemTests.cs
+//
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2002 Martin Baulig
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System {
+ /// <summary>
+ /// Combines all available unit tests into one test suite.
+ /// </summary>
+ public class MartinTests : TestCase {
+ public MartinTests(string name) : base(name) {}
+
+ public static ITest Suite
+ {
+ get
+ {
+ TestSuite suite = new TestSuite();
+
+ suite.AddTest(ArrayTest.Suite);
+ suite.AddTest(BitConverterTest.Suite);
+ suite.AddTest(BooleanTest.Suite);
+ suite.AddTest(ByteTest.Suite);
+ suite.AddTest(CharTest.Suite);
+ suite.AddTest(ConsoleTest.Suite);
+ suite.AddTest(EnumTest.Suite);
+ suite.AddTest(DecimalTest.Suite);
+ suite.AddTest(DecimalTest2.Suite);
+ suite.AddTest(GuidTest.Suite);
+ suite.AddTest(Int16Test.Suite);
+ suite.AddTest(Int32Test.Suite);
+ suite.AddTest(Int64Test.Suite);
+
+ // MathTest: jit.c: line 1026 (mono_store_tree): assertion failed: (s->svt != VAL_UNKNOWN)
+ suite.AddTest(ObjectTest.Suite);
+
+ // RandomTest: tree mismatch
+ // (STIND_I4 ADDR_L[10] (CGT (LDIND_R8 ADDR_L[3]) CONST_R8))
+ //
+ // (STIND_I4 ADDR_L[10] (CGT (LDIND_R8 ADDR_L[3]) CONST_R8))
+ // BR
+ // file emit-x86.c: line 561 (mono_label_cfg): should not be reached
+
+ suite.AddTest(ResolveEventArgsTest.Suite);
+
+ // SByteTest: tree mismatch
+ // (STIND_I4 ADDR_L[18] (MUL_OVF (CONV_OVF_I4 (LDIND_I1 ADDR_L[1])) CONST_I4))
+ //
+ // (STIND_I4 ADDR_L[18] (MUL_OVF (CONV_OVF_I4 (LDIND_I1 ADDR_L[1])) CONST_I4))
+ // (STIND_I1 ADDR_L[1] (CONV_OVF_I1 (ADD_OVF (LDIND_I4 ADDR_L[18]) (SUB_OVF (LDIND_U2 ADDR_L[6]) CONST_I4))))
+ // (STIND_I1 ADDR_L[5] CONST_I4)
+ // BR
+ // file emit-x86.c: line 561 (mono_label_cfg): should not be reached
+
+ suite.AddTest(StringTest.Suite);
+ suite.AddTest(TimeSpanTest.Suite);
+ suite.AddTest(UInt16Test.Suite);
+ suite.AddTest(UInt32Test.Suite);
+ suite.AddTest(UInt64Test.Suite);
+ suite.AddTest(DoubleTest.Suite);
+ suite.AddTest(TimeZoneTest.Suite);
+ suite.AddTest(DateTimeTest.Suite);
+
+ return suite;
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/corlib/Test/System/MathTest.cs b/mcs/class/corlib/Test/System/MathTest.cs
new file mode 100755
index 00000000000..61d9f553840
--- /dev/null
+++ b/mcs/class/corlib/Test/System/MathTest.cs
@@ -0,0 +1,589 @@
+// MathTest.cs
+//
+// Jon Guymon (guymon@slackworks.com)
+//
+// (C) 2002 Jon Guymon
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System
+{
+
+public class MathTest : TestCase {
+
+ public MathTest() : base ("System.Math testsuite") {}
+ public MathTest(string name) : base(name) {}
+
+ protected override void SetUp() {}
+ protected override void TearDown() {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(MathTest));
+ }
+ }
+
+ static double x = 0.1234;
+ static double y = 12.345;
+
+ public void TestDecimalAbs() {
+ decimal a = -9.0M;
+
+ Assert(9.0M == Math.Abs(a));
+ }
+
+
+ public void TestDoubleAbs() {
+ double a = -9.0D;
+
+ Assert(9.0D == Math.Abs(a));
+ }
+
+ public void TestFloatAbs() {
+ float a = -9.0F;
+
+ Assert(9.0F == Math.Abs(a));
+ }
+
+ public void TestLongAbs() {
+ long a = -9L;
+ long b = Int64.MinValue;
+
+ Assert(9L == Math.Abs(a));
+ try {
+ Math.Abs(b);
+ Fail("Should raise System.OverflowException");
+ } catch(Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ }
+
+ public void TestIntAbs() {
+ int a = -9;
+ int b = Int32.MinValue;
+
+ Assert(9 == Math.Abs(a));
+ try {
+ Math.Abs(b);
+ Fail("Should raise System.OverflowException");
+ } catch(Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ }
+
+ public void TestSbyteAbs() {
+ sbyte a = -9;
+ sbyte b = SByte.MinValue;
+
+ Assert(9 == Math.Abs(a));
+ try {
+ Math.Abs(b);
+ Fail("Should raise System.OverflowException");
+ } catch(Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ }
+
+ public void TestShortAbs() {
+ short a = -9;
+ short b = Int16.MinValue;
+
+ Assert(9 == Math.Abs(a));
+ try {
+ Math.Abs(b);
+ Fail("Should raise System.OverflowException");
+ } catch(Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ }
+
+ public void TestAcos() {
+ double a = Math.Acos(x);
+ double b = 1.4470809809523457;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Acos(-1.01D)));
+ Assert(double.IsNaN(Math.Acos(1.01D)));
+ }
+
+ public void TestAsin() {
+ double a = Math.Asin(x);
+ double b = 0.12371534584255098;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Asin(-1.01D)));
+ Assert(double.IsNaN(Math.Asin(1.01D)));
+ }
+
+ public void TestAtan() {
+ double a = Math.Atan(x);
+ double b = 0.12277930094473837;
+ double c = 1.5707963267948966;
+ double d = -1.5707963267948966;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert("should return NaN",
+ double.IsNaN(Math.Atan(double.NaN)));
+ Assert(Math.Atan(double.PositiveInfinity).ToString("G99")+" != "+c.ToString("G99"),
+ Math.Abs((double)Math.Atan(double.PositiveInfinity) - c) <= double.Epsilon);
+ Assert(Math.Atan(double.NegativeInfinity).ToString("G99")+" != "+d.ToString("G99"),
+ Math.Abs((double)Math.Atan(double.NegativeInfinity) - d) <= double.Epsilon);
+ }
+
+ public void TestAtan2() {
+ double a = Math.Atan2(x, y);
+ double b = 0.0099956168687207747;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Acos(-2D)));
+ Assert(double.IsNaN(Math.Acos(2D)));
+ }
+
+ public void TestCos() {
+ double a = Math.Cos(x);
+ double b = 0.99239587670489104;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestCosh() {
+ double a = Math.Cosh(x);
+ double b = 1.0076234465130722;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(Math.Cosh(double.NegativeInfinity) == double.PositiveInfinity);
+ Assert(Math.Cosh(double.PositiveInfinity) == double.PositiveInfinity);
+ Assert(double.IsNaN(Math.Cosh(double.NaN)));
+ }
+
+ public void TestSin() {
+ double a = Math.Sin(x);
+ double b = 0.12308705821137626;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestSinh() {
+ double a = Math.Sinh(x);
+ double b = 0.12371341868561381;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestTan() {
+ double a = Math.Tan(x);
+ double b = 0.12403019913793806;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestTanh() {
+ double a = Math.Tanh(x);
+ double b = 0.12277743150353424;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestSqrt() {
+ double a = Math.Sqrt(x);
+ double b = 0.35128336140500593;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ }
+
+ public void TestExp() {
+ double a = Math.Exp(x);
+ double b = 1.1313368651986859;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Exp(double.NaN)));
+ Assert(Math.Exp(double.NegativeInfinity) == 0);
+ Assert(Math.Exp(double.PositiveInfinity) == double.PositiveInfinity);
+ }
+
+ public void TestCeiling() {
+ double a = Math.Ceiling(1.5);
+ double b = 2;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(Math.Ceiling(double.NegativeInfinity) == double.NegativeInfinity);
+ Assert(Math.Ceiling(double.PositiveInfinity) == double.PositiveInfinity);
+ Assert(double.IsNaN(Math.Ceiling(double.NaN)));
+ }
+
+ public void TestFloor() {
+ double a = Math.Floor(1.5);
+ double b = 1;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(Math.Floor(double.NegativeInfinity) == double.NegativeInfinity);
+ Assert(Math.Floor(double.PositiveInfinity) == double.PositiveInfinity);
+ Assert(double.IsNaN(Math.Floor(double.NaN)));
+ }
+
+ public void TestIEEERemainder() {
+ double a = Math.IEEERemainder(y, x);
+ double b = 0.0050000000000007816;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.IEEERemainder(y, 0)));
+ }
+
+ public void TestLog() {
+ double a = Math.Log(y);
+ double b = 2.513251122797143;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Log(-1)));
+ Assert(double.IsNaN(Math.Log(double.NaN)));
+
+ // MS docs say this should be PositiveInfinity
+ Assert(Math.Log(0) == double.NegativeInfinity);
+ Assert(Math.Log(double.PositiveInfinity) == double.PositiveInfinity);
+ }
+
+ public void TestLog2() {
+ double a = Math.Log(x, y);
+ double b = -0.83251695325303621;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Log(-1, y)));
+ Assert(double.IsNaN(Math.Log(double.NaN, y)));
+ Assert(double.IsNaN(Math.Log(x, double.NaN)));
+ Assert(double.IsNaN(Math.Log(double.NegativeInfinity, y)));
+ Assert(double.IsNaN(Math.Log(x, double.NegativeInfinity)));
+ Assert(double.IsNaN(Math.Log(double.PositiveInfinity, double.PositiveInfinity)));
+
+ // MS docs say this should be PositiveInfinity
+ Assert(Math.Log(0, y) == double.NegativeInfinity);
+ Assert(Math.Log(double.PositiveInfinity, y) == double.PositiveInfinity);
+ Assert(Math.Log(x, double.PositiveInfinity) == 0);
+ }
+
+ public void TestLog10() {
+ double a = Math.Log10(x);
+ double b = -0.90868484030277719;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Log10(-1)));
+ Assert(double.IsNaN(Math.Log10(double.NaN)));
+
+ // MS docs say this should be PositiveInfinity
+ Assert(Math.Log10(0) == double.NegativeInfinity);
+ Assert(Math.Log10(double.PositiveInfinity) == double.PositiveInfinity);
+
+ }
+
+ public void TestPow() {
+ double a = Math.Pow(y, x);
+ double b = 1.363609446060212;
+
+ Assert(a.ToString("G99") + " != " + b.ToString("G99"),
+ (Math.Abs(a - b) <= double.Epsilon));
+ Assert(double.IsNaN(Math.Pow(y, double.NaN)));
+ Assert(double.IsNaN(Math.Pow(double.NaN, x)));
+ Assert(Math.Pow(double.NegativeInfinity, 1) == double.NegativeInfinity);
+ Assert(Math.Pow(double.NegativeInfinity, 2) == double.PositiveInfinity);
+
+ // MS docs say this should be 0
+ Assert(double.IsNaN(Math.Pow(1, double.NegativeInfinity)));
+ Assert(Math.Pow(double.PositiveInfinity, double.NegativeInfinity) == 0);
+ Assert(Math.Pow(double.PositiveInfinity, 1) == double.PositiveInfinity);
+
+ // MS docs say this should be PositiveInfinity
+ Assert(double.IsNaN(Math.Pow(1, double.PositiveInfinity)));
+ }
+
+ public void TestByteMax() {
+ byte a = 1;
+ byte b = 2;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestDecimalMax() {
+ decimal a = 1.5M;
+ decimal b = 2.5M;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestDoubleMax() {
+ double a = 1.5D;
+ double b = 2.5D;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestFloatMax() {
+ float a = 1.5F;
+ float b = 2.5F;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestIntMax() {
+ int a = 1;
+ int b = 2;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestLongMax() {
+ long a = 1L;
+ long b = 2L;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestSbyteMax() {
+ sbyte a = 1;
+ sbyte b = 2;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestShortMax() {
+ short a = 1;
+ short b = 2;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestUintMax() {
+ uint a = 1U;
+ uint b = 2U;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestUlongMax() {
+ ulong a = 1UL;
+ ulong b = 2UL;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestUshortMax() {
+ ushort a = 1;
+ ushort b = 2;
+
+ Assert(b == Math.Max(a, b));
+ Assert(b == Math.Max(b, a));
+ }
+
+ public void TestByteMin() {
+ byte a = 1;
+ byte b = 2;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestDecimalMin() {
+ decimal a = 1.5M;
+ decimal b = 2.5M;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestDoubleMin() {
+ double a = 1.5D;
+ double b = 2.5D;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestFloatMin() {
+ float a = 1.5F;
+ float b = 2.5F;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestIntMin() {
+ int a = 1;
+ int b = 2;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestLongMin() {
+ long a = 1L;
+ long b = 2L;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestSbyteMin() {
+ sbyte a = 1;
+ sbyte b = 2;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestShortMin() {
+ short a = 1;
+ short b = 2;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestUintMin() {
+ uint a = 1U;
+ uint b = 2U;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestUlongMin() {
+ ulong a = 1UL;
+ ulong b = 2UL;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestUshortMin() {
+ ushort a = 1;
+ ushort b = 2;
+
+ Assert(a == Math.Min(a, b));
+ Assert(a == Math.Min(b, a));
+ }
+
+ public void TestDecimalRound() {
+ decimal a = 1.5M;
+ decimal b = 2.5M;
+
+ Assert(Math.Round(a) + " != 2", Math.Round(a) == 2);
+ Assert(Math.Round(b) + " != 2", Math.Round(b) == 2);
+ }
+
+ public void TestDecimalRound2() {
+ decimal a = 3.45M;
+ decimal b = 3.46M;
+
+ Assert(Math.Round(a, 1) == 3.4M);
+ Assert(Math.Round(b, 1) == 3.5M);
+ }
+
+ public void TestDoubleRound() {
+ double a = 1.5D;
+ double b = 2.5D;
+
+ Assert(Math.Round(a) + " != 2", Math.Round(a) == 2);
+ Assert(Math.Round(b) + " != 2", Math.Round(b) == 2);
+ }
+
+ public void TestDoubleRound2() {
+ double a = 3.45D;
+ double b = 3.46D;
+
+ Assert(Math.Round(a, 1) == 3.4D);
+ Assert(Math.Round(b, 1) == 3.5D);
+ }
+
+ public void TestDecimalSign() {
+ decimal a = -5M;
+ decimal b = 5M;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0M) == 0);
+ }
+
+ public void TestDoubleSign() {
+ double a = -5D;
+ double b = 5D;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0D) == 0);
+ }
+
+ public void TestFloatSign() {
+ float a = -5F;
+ float b = 5F;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0F) == 0);
+ }
+
+ public void TestIntSign() {
+ int a = -5;
+ int b = 5;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ }
+
+ public void TestLongSign() {
+ long a = -5L;
+ long b = 5L;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0L) == 0);
+ }
+
+ public void TestSbyteSign() {
+ sbyte a = -5;
+ sbyte b = 5;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0) == 0);
+ }
+
+ public void TestShortSign() {
+ short a = -5;
+ short b = 5;
+
+ Assert(Math.Sign(a) == -1);
+ Assert(Math.Sign(b) == 1);
+ Assert(Math.Sign(0) == 0);
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/ObjectTest.cs b/mcs/class/corlib/Test/System/ObjectTest.cs
new file mode 100644
index 00000000000..5a9545f390a
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ObjectTest.cs
@@ -0,0 +1,121 @@
+// ObjectTest.cs - NUnit Test Cases for the System.Object struct
+//
+// David Brandt (bucky@keystreams.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class ObjectTest : TestCase
+{
+ public ObjectTest() : base ("MonoTests.System.ObjectTest testsuite") {}
+ public ObjectTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ }
+
+ protected override void TearDown()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(ObjectTest));
+ }
+ }
+
+ public void TestCtor() {
+ Object o = new Object();
+ AssertNotNull("Can I at least get an _Object_, please?", o);
+ }
+
+ public void TestEquals1() {
+ {
+ Object x = new Object();
+ Object y = new Object();
+ Assert("Object should equal itself",
+ x.Equals(x));
+ Assert("object should not equal null",
+ !x.Equals(null));
+ Assert("Different objects should not equal 1",
+ !x.Equals(y));
+ Assert("Different objects should not equal 2",
+ !y.Equals(x));
+ }
+ {
+ double x = Double.NaN;
+ double y = Double.NaN;
+ Assert("NaNs should always equal each other",
+ ((Object)x).Equals(y));
+ }
+ }
+ public void TestEquals2() {
+ {
+ Object x = new Object();
+ Object y = new Object();
+ Assert("Object should equal itself",
+ Object.Equals(x,x));
+ Assert("object should not equal null",
+ !Object.Equals(x,null));
+ Assert("null should not equal object",
+ !Object.Equals(null,x));
+ Assert("Different objects should not equal 1",
+ !Object.Equals(x,y));
+ Assert("Different objects should not equal 2",
+ !Object.Equals(y,x));
+ Assert("null should not equal null",
+ Object.Equals(null,null));
+ }
+ {
+ double x = Double.NaN;
+ double y = Double.NaN;
+ Assert("NaNs should always equal each other",
+ Object.Equals(x,y));
+ }
+ }
+
+ public void TestGetHashCode() {
+ Object x = new Object();
+ AssertEquals("Object's hash code should not change",
+ x.GetHashCode(), x.GetHashCode());
+ }
+
+ public void TestGetType() {
+ Object x = new Object();
+ AssertNotNull("Should get a type for Object", x.GetType());
+ AssertEquals("Bad name for Object type", "System.Object",
+ x.GetType().ToString());
+ }
+
+ public void TestReferenceEquals() {
+ Object x = new Object();
+ Object y = new Object();
+ Assert("Object should equal itself",
+ Object.ReferenceEquals(x,x));
+ Assert("object should not equal null",
+ !Object.ReferenceEquals(x,null));
+ Assert("null should not equal object",
+ !Object.ReferenceEquals(null,x));
+ Assert("Different objects should not equal 1",
+ !Object.ReferenceEquals(x,y));
+ Assert("Different objects should not equal 2",
+ !Object.ReferenceEquals(y,x));
+ Assert("null should not equal null",
+ Object.ReferenceEquals(null,null));
+ }
+
+ public void TestToString() {
+ Object x = new Object();
+ Object y = new Object();
+ AssertEquals("All Objects should have same string rep",
+ x.ToString(), y.ToString());
+ }
+}
+}
diff --git a/mcs/class/corlib/Test/System/RandomTest.cs b/mcs/class/corlib/Test/System/RandomTest.cs
new file mode 100644
index 00000000000..faf07306a0a
--- /dev/null
+++ b/mcs/class/corlib/Test/System/RandomTest.cs
@@ -0,0 +1,79 @@
+//
+// System.Random Test Cases
+//
+// Author: Bob Smith <bob@thestuff.net>
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System {
+
+public class RandomTest : TestCase
+{
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(RandomTest));
+ }
+ }
+
+ public RandomTest() : base ("MonoTests.System.RandomTest testcase") {}
+ public RandomTest(string name): base(name){}
+ public void TestDouble()
+ {
+ Random r = new Random();
+ int i;
+ double c=0;
+ for (i=0; i<20; i++) c+=r.NextDouble();
+ c/=i;
+ Assert (c.ToString() + " is out of range.", c < .7 && c > .3);
+ }
+ public void TestSeed()
+ {
+ Random r = new Random(42);
+ Random r2 = new Random(42);
+ int i;
+ double c=0, c2=0;
+ for (i=0; i<20; i++)
+ {
+ c += r.NextDouble();
+ c2 += r2.NextDouble();
+ }
+ AssertEquals(c, c2);
+ }
+ public void TestNext()
+ {
+ Random r = new Random();
+ int i;
+ long c;
+ for (i=0; i<20; i++)
+ {
+ c = r.Next();
+ Assert (c < Int32.MaxValue && c >= 0);
+ }
+ }
+ public void TestNextMax()
+ {
+ Random r = new Random();
+ int i;
+ long c;
+ for (i=0; i<20; i++)
+ {
+ c = r.Next(10);
+ Assert (c < 10 && c >= 0);
+ }
+ }
+ public void TestNextMinMax()
+ {
+ Random r = new Random();
+ int i;
+ long c;
+ for (i=0; i<20; i++)
+ {
+ c = r.Next(1, 10);
+ Assert (c < 10 && c >= 1);
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/ResolveEventArgsTest.cs b/mcs/class/corlib/Test/System/ResolveEventArgsTest.cs
new file mode 100644
index 00000000000..728408b3b1d
--- /dev/null
+++ b/mcs/class/corlib/Test/System/ResolveEventArgsTest.cs
@@ -0,0 +1,30 @@
+//
+// System.ResolveEventArgs Test Cases
+//
+// Author: Nick Drochak <ndrochak@gol.com>
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System {
+
+public class ResolveEventArgsTest : TestCase
+{
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(RandomTest));
+ }
+ }
+
+ public ResolveEventArgsTest() : base ("MonoTests.System.ResolveEventArgsTest testcase") {}
+ public ResolveEventArgsTest(string name): base(name){}
+
+ public void TestTheWholeThing()
+ {
+ ResolveEventArgs REA = new ResolveEventArgs("REA_Name");
+ Assert ("Name property not correct", REA.Name == "REA_Name");
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/SByteTest.cs b/mcs/class/corlib/Test/System/SByteTest.cs
new file mode 100644
index 00000000000..0005eb55c63
--- /dev/null
+++ b/mcs/class/corlib/Test/System/SByteTest.cs
@@ -0,0 +1,180 @@
+// SByteTest.cs - NUnit Test Cases for the System.SByte struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class SByteTest : TestCase
+{
+ private const SByte MySByte1 = -42;
+ private const SByte MySByte2 = -128;
+ private const SByte MySByte3 = 127;
+ private const string MyString1 = "-42";
+ private const string MyString2 = "-128";
+ private const string MyString3 = "127";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {"("+NumberFormatInfo.CurrentInfo.CurrencySymbol+"128.00)",
+ "-128", "-1.280000e+002", "-128.00",
+ "-128", "-128.00", "-12,800.00 %", "80"};
+ private string[] Results2 = {NumberFormatInfo.CurrentInfo.CurrencySymbol+"127.00000",
+ "00127", "1.27000e+002", "127.00000",
+ "127", "127.00000", "12,700.00000 %", "0007f"};
+ private string[] ResultsNfi1 = {"("+NumberFormatInfo.InvariantInfo.CurrencySymbol+"128.00)",
+ "-128", "-1.280000e+002", "-128.00",
+ "-128", "-128.00", "-12,800.00 %", "80"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"127.00000",
+ "00127", "1.27000e+002", "127.00000",
+ "127", "127.00000", "12,700.00000 %", "0007f"};
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public SByteTest() : base ("MonoTests.System.SByteTest testcase") {}
+ public SByteTest(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(SByteTest));
+ }
+ }
+
+ public void TestMinMax()
+ {
+ AssertEquals(SByte.MinValue, MySByte2);
+ AssertEquals(SByte.MaxValue, MySByte3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MySByte3.CompareTo(MySByte2) > 0);
+ Assert(MySByte2.CompareTo(MySByte2) == 0);
+ Assert(MySByte1.CompareTo((SByte)(-42)) == 0);
+ Assert(MySByte2.CompareTo(MySByte3) < 0);
+ try {
+ MySByte2.CompareTo(100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MySByte1.Equals(MySByte1));
+ Assert(MySByte1.Equals((SByte)(-42)));
+ Assert(MySByte1.Equals((Int16)(-42)) == false);
+ Assert(MySByte1.Equals(MySByte2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MySByte1.GetHashCode();
+ MySByte2.GetHashCode();
+ MySByte3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert(MySByte1 == SByte.Parse(MyString1));
+ Assert(MySByte2 == SByte.Parse(MyString2));
+ Assert(MySByte3 == SByte.Parse(MyString3));
+ try {
+ SByte.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ SByte.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ try {
+ int OverInt = SByte.MaxValue + 1;
+ SByte.Parse(OverInt.ToString());
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ AssertEquals("A1", (sbyte)42, SByte.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ", NumberStyles.Currency));
+ try {
+ SByte.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(-42 == SByte.Parse(" -42 ", Nfi));
+ try {
+ SByte.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == SByte.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ SByte.Parse(NumberFormatInfo.CurrentInfo.CurrencySymbol+"42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ Assert("MyString1, MySByte1.ToString()", String.Compare(MyString1, MySByte1.ToString()) == 0);
+ Assert("MyString2, MySByte2.ToString()", String.Compare(MyString2, MySByte2.ToString()) == 0);
+ Assert("MyString3, MySByte3.ToString()", String.Compare(MyString3, MySByte3.ToString()) == 0);
+ //test ToString(string format)
+ /*
+ TODO: These tests depend on the culture of the system running the test.
+ So, this needs to be tested in a different way.
+ for (int i=0; i < Formats1.Length; i++) {
+ Assert("i="+i+", Results1[i]="+Results1[i]+", MySByte2.ToString(Formats1[i])="+MySByte2.ToString(Formats1[i]), String.Compare(Results1[i], MySByte2.ToString(Formats1[i])) == 0);
+ Assert("Results2[i], MySByte3.ToString(Formats2[i])", String.Compare(Results2[i], MySByte3.ToString(Formats2[i])) == 0);
+ }
+ */
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ Assert("i="+i+", ResultsNfi1[i]="+ResultsNfi1[i]+", MySByte2.ToString(Formats1[i]="+Formats1[i]+"): Expected "+ResultsNfi1[i]+" but got "+MySByte2.ToString(Formats1[i], Nfi), String.Compare(ResultsNfi1[i], MySByte2.ToString(Formats1[i], Nfi)) == 0);
+ Assert("ResultsNfi2[i], MySByte3.ToString(Formats2[i], Nfi):"+ResultsNfi2[i]+"<==>"+MySByte3.ToString(Formats2[i], Nfi), String.Compare(ResultsNfi2[i], MySByte3.ToString(Formats2[i], Nfi)) == 0);
+ }
+ try {
+ MySByte1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("typeof(FormatException) == e.GetType()", typeof(FormatException) == e.GetType());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/StringTest.cs b/mcs/class/corlib/Test/System/StringTest.cs
new file mode 100644
index 00000000000..020d00f8994
--- /dev/null
+++ b/mcs/class/corlib/Test/System/StringTest.cs
@@ -0,0 +1,1077 @@
+// StringTest.cs - NUnit Test Cases for the System.String class
+//
+// Jeffrey Stedfast <fejj@ximian.com>
+// David Brandt <bucky@keystreams.com>
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class StringTest : TestCase
+{
+ public StringTest() : base ("MonoTests.System.StringTest testcase") {}
+ public StringTest (string name) : base (name) {}
+
+ protected override void SetUp ()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (StringTest));
+ }
+ }
+
+ public void TestLength ()
+ {
+ string str = "test string";
+
+ AssertEquals("wrong length", 11, str.Length);
+ }
+
+ public void TestCompare ()
+ {
+ string lesser = "abc";
+ string medium = "abcd";
+ string greater = "xyz";
+ string caps = "ABC";
+
+ AssertEquals(0, String.Compare(null, null));
+ AssertEquals(1, String.Compare(lesser, null));
+
+ Assert (String.Compare (lesser, greater) < 0);
+ Assert (String.Compare (greater, lesser) > 0);
+ Assert (String.Compare (lesser, lesser) == 0);
+ Assert (String.Compare (lesser, medium) < 0);
+
+ Assert (String.Compare (lesser, caps, true) == 0);
+ Assert (String.Compare (lesser, caps, false) != 0);
+ AssertEquals ("A01", String.Compare ("a", "b"), -1);
+ AssertEquals ("A02", String.Compare ("b", "a"), 1);
+ AssertEquals ("A03", String.Compare ("A", "a"), 1);
+ AssertEquals ("A04", String.Compare ("a", "A"), -1);
+
+
+ // TODO - test with CultureInfo
+
+ string needle = "ab";
+ string haystack = "abbcbacab";
+ AssertEquals("basic substring check #1", 0,
+ String.Compare(needle, 0, haystack, 0, 2));
+ AssertEquals("basic substring check #2", -1,
+ String.Compare(needle, 0, haystack, 0, 3));
+ AssertEquals("basic substring check #3", 0,
+ String.Compare("ab", 0, "ab", 0, 2));
+ AssertEquals("basic substring check #4", 0,
+ String.Compare("ab", 0, "ab", 0, 3));
+ AssertEquals("basic substring check #5", 0,
+ String.Compare("abc", 0, "ab", 0, 2));
+ AssertEquals("basic substring check #6", 1,
+ String.Compare("abc", 0, "ab", 0, 5));
+ AssertEquals("basic substring check #7", -1,
+ String.Compare("ab", 0, "abc", 0, 5));
+
+ for (int i = 1; i <= (haystack.Length - needle.Length); i++) {
+ if (i != 7) {
+ Assert("loop substring check #1/" + i, String.Compare(needle, 0, haystack, i, 2) != 0);
+ Assert("loop substring check #2/" + i, String.Compare(needle, 0, haystack, i, 3) != 0);
+ } else {
+ AssertEquals("loop substring check #3/" + i, 0, String.Compare(needle, 0, haystack, i, 2));
+ AssertEquals("loop substring check #4/" + i, 0, String.Compare(needle, 0, haystack, i, 3));
+ }
+ }
+
+ needle = "AB";
+ AssertEquals("basic substring check #8", 0,
+ String.Compare(needle, 0, haystack, 0, 2, true));
+ AssertEquals("basic substring check #9", 1,
+ String.Compare(needle, 0, haystack, 0, 2, false));
+ for (int i = 1; i <= (haystack.Length - needle.Length); i++) {
+ if (i != 7) {
+ Assert("loop substring check #5/" + i, String.Compare(needle, 0, haystack, i, 2, true) != 0);
+ Assert("loop substring check #6/" + i, String.Compare(needle, 0, haystack, i, 2, false) != 0);
+ } else {
+ AssertEquals("loop substring check #7/" + i, 0, String.Compare(needle, 0, haystack, i, 2, true));
+ AssertEquals("loop substring check #8/" + i, 1, String.Compare(needle, 0, haystack, i, 2, false));
+ }
+ }
+
+ // TODO - extended format call with CultureInfo
+ }
+
+ public void TestCompareOrdinal ()
+ {
+ string lesser = "abc";
+ string medium = "abcd";
+ string greater = "xyz";
+
+ AssertEquals(0, String.CompareOrdinal(null, null));
+ AssertEquals(1, String.CompareOrdinal(lesser, null));
+
+ Assert (String.CompareOrdinal (lesser, greater) < 0);
+ Assert (String.CompareOrdinal (greater, lesser) > 0);
+ Assert (String.CompareOrdinal (lesser, lesser) == 0);
+ Assert (String.CompareOrdinal (lesser, medium) < 0);
+
+ string needle = "ab";
+ string haystack = "abbcbacab";
+ AssertEquals("basic substring check", 0,
+ String.CompareOrdinal(needle, 0, haystack, 0, 2));
+ AssertEquals("basic substring miss", -1,
+ String.CompareOrdinal(needle, 0, haystack, 0, 3));
+ for (int i = 1; i <= (haystack.Length - needle.Length); i++) {
+ if (i != 7) {
+ Assert("loop substring check " + i, String.CompareOrdinal(needle, 0, haystack, i, 2) != 0);
+ Assert("loop substring check " + i, String.CompareOrdinal(needle, 0, haystack, i, 3) != 0);
+ } else {
+ AssertEquals("loop substring check " + i, 0, String.CompareOrdinal(needle, 0, haystack, i, 2));
+ AssertEquals("loop substring check " + i, 0, String.CompareOrdinal(needle, 0, haystack, i, 3));
+ }
+ }
+ }
+
+ public void TestCompareTo ()
+ {
+ string lower = "abc";
+ string greater = "xyz";
+ string lesser = "abc";
+
+ Assert (lower.CompareTo (greater) < 0);
+ Assert (lower.CompareTo (lower) == 0);
+ Assert (greater.CompareTo (lesser) > 0);
+ }
+
+ public void TestConcat ()
+ {
+ string string1 = "string1";
+ string string2 = "string2";
+ string concat = "string1string2";
+
+ Assert (String.Concat (string1, string2) == concat);
+ }
+
+ public void TestCopy()
+ {
+ string s1 = "original";
+ string s2 = String.Copy(s1);
+ AssertEquals("String copy no good", s1, s2);
+
+ bool errorThrown = false;
+ try {
+ string s = String.Copy(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null copy shouldn't be good", errorThrown);
+ }
+
+ public void TestCopyTo()
+ {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ s1.CopyTo(0, (char[])null, 0, s1.Length);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null CopyTo shouldn't be good", errorThrown);
+
+ char[] c1 = new char[s1.Length];
+ string s2 = new String(c1);
+ Assert("char string not bad to start", !s1.Equals(s2));
+ for (int i = 0; i < s1.Length; i++) {
+ s1.CopyTo(i, c1, i, 1);
+ }
+ s2 = new String(c1);
+ AssertEquals("char-by-char copy bad", s1, s2);
+ }
+
+ public void TestEndsWith()
+ {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ bool huh = s1.EndsWith(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null EndsWith shouldn't be good", errorThrown);
+
+ Assert("should match", s1.EndsWith("l"));
+ Assert("should match 2", s1.EndsWith("inal"));
+ Assert("should fail", !s1.EndsWith("ina"));
+ }
+
+ public void TestEquals()
+ {
+ string s1 = "original";
+ string yes = "original";
+ object y = yes;
+ string no = "copy";
+
+ Assert("No match for null", !s1.Equals(null));
+ Assert("Should match object", s1.Equals(y));
+ Assert("Should match", s1.Equals(yes));
+ Assert("Shouldn't match", !s1.Equals(no));
+
+ Assert("Static nulls should match", String.Equals(null, null));
+ Assert("Should match", String.Equals(s1, yes));
+ Assert("Shouldn't match", !String.Equals(s1, no));
+ }
+
+ public void TestFormat ()
+ {
+ AssertEquals ("Empty format string.", "", String.Format ("", 0));
+ AssertEquals ("Single argument.", "100", String.Format ("{0}", 100));
+ AssertEquals ("Single argument, right justified.", "X 37X", String.Format ("X{0,5}X", 37));
+ AssertEquals ("Single argument, left justified.", "X37 X", String.Format ("X{0,-5}X", 37));
+ AssertEquals ("Two arguments.", "The 3 wise men.", String.Format ("The {0} wise {1}.", 3, "men"));
+ AssertEquals ("Three arguments.", "do re me fa so.", String.Format ("{0} re {1} fa {2}.", "do", "me", "so"));
+ AssertEquals ("Formatted argument.", "###00c0ffee#", String.Format ("###{0:x8}#", 0xc0ffee));
+ AssertEquals ("Formatted argument, right justified.", "# 033#", String.Format ("#{0,5:x3}#", 0x33));
+ AssertEquals ("Formatted argument, left justified.", "#033 #", String.Format ("#{0,-5:x3}#", 0x33));
+ AssertEquals ("Escaped bracket", "typedef struct _MonoObject { ... } MonoObject;", String.Format ("typedef struct _{0} {{ ... }} MonoObject;", "MonoObject"));
+
+
+ // TODO test format exceptions
+
+ // TODO test argument null exceptions
+ // This should work, but it doesn't currently.
+ // I think I broke the spec...
+ //bool errorThrown = false;
+ //try {
+ //string s = String.Format(null, " ");
+ //} catch (ArgumentNullException) {
+ //errorThrown = true;
+ //}
+ //Assert("error not thrown 1", errorThrown);
+ //errorThrown = false;
+ //try {
+ //string s = String.Format(null, " ", " ");
+ //} catch (ArgumentNullException) {
+ //errorThrown = true;
+ //}
+ //Assert("error not thrown 2", errorThrown);
+ //errorThrown = false;
+ //try {
+ //string s = String.Format(" ", null);
+ //} catch (ArgumentNullException) {
+ //errorThrown = true;
+ //}
+ //Assert("error not thrown 3", errorThrown);
+ }
+
+ public void TestGetEnumerator()
+ {
+ string s1 = "original";
+ char[] c1 = new char[s1.Length];
+ string s2 = new String(c1);
+ Assert("pre-enumerated string should not match", !s1.Equals(s2));
+ CharEnumerator en = s1.GetEnumerator();
+ AssertNotNull("null enumerator", en);
+
+ for (int i = 0; i < s1.Length; i++) {
+ en.MoveNext();
+ c1[i] = en.Current;
+ }
+ s2 = new String(c1);
+ AssertEquals("enumerated string should match", s1, s2);
+ }
+
+ public void TestGetHashCode()
+ {
+ string s1 = "original";
+ // TODO - weak test, currently. Just verifies determinicity.
+ AssertEquals("same string, same hash code",
+ s1.GetHashCode(), s1.GetHashCode());
+ }
+
+ public void TestGetType() {
+ string s1 = "original";
+ AssertEquals("String type", "System.String", s1.GetType().ToString());
+ }
+
+ public void TestGetTypeCode() {
+ string s1 = "original";
+ Assert(s1.GetTypeCode().Equals(TypeCode.String));
+ }
+
+ public void TestIndexOf() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ int i = s1.IndexOf('q', s1.Length + 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error for char", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf('q', s1.Length + 1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error for char", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf("huh", s1.Length + 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range for string", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf("huh", s1.Length + 1, 3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range for string", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf(null, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOf(null, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ AssertEquals("basic char index", 1, s1.IndexOf('r'));
+ AssertEquals("basic char index", 2, s1.IndexOf('i'));
+ AssertEquals("basic char index - no", -1, s1.IndexOf('q'));
+
+ AssertEquals("basic string index", 1, s1.IndexOf("rig"));
+ AssertEquals("basic string index", 2, s1.IndexOf("i"));
+ AssertEquals("basic string index - no", -1, s1.IndexOf("rag"));
+
+ AssertEquals("stepped char index", 1, s1.IndexOf('r', 1));
+ AssertEquals("stepped char index", 2, s1.IndexOf('i', 1));
+ AssertEquals("stepped char index", 4, s1.IndexOf('i', 3));
+ AssertEquals("stepped char index", -1, s1.IndexOf('i', 5));
+
+ AssertEquals("stepped limited char index",
+ 1, s1.IndexOf('r', 1, 1));
+ AssertEquals("stepped limited char index",
+ -1, s1.IndexOf('r', 0, 1));
+ AssertEquals("stepped limited char index",
+ 2, s1.IndexOf('i', 1, 3));
+ AssertEquals("stepped limited char index",
+ 4, s1.IndexOf('i', 3, 3));
+ AssertEquals("stepped limited char index",
+ -1, s1.IndexOf('i', 5, 3));
+
+ s1 = "original original";
+ AssertEquals("stepped string index 1",
+ 0, s1.IndexOf("original", 0));
+ AssertEquals("stepped string index 2",
+ 9, s1.IndexOf("original", 1));
+ AssertEquals("stepped string index 3",
+ -1, s1.IndexOf("original", 10));
+ AssertEquals("stepped limited string index 1",
+ 1, s1.IndexOf("rig", 0, 5));
+ AssertEquals("stepped limited string index 2",
+ -1, s1.IndexOf("rig", 0, 3));
+ AssertEquals("stepped limited string index 3",
+ 10, s1.IndexOf("rig", 2, 15));
+ AssertEquals("stepped limited string index 4",
+ -1, s1.IndexOf("rig", 2, 3));
+ }
+
+ public void TestIndexOfAny() {
+ string s1 = "abcdefghijklm";
+
+ bool errorThrown = false;
+ try {
+ int i = s1.IndexOfAny(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOfAny(null, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOfAny(null, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ char[] c1 = {'a', 'e', 'i', 'o', 'u'};
+ AssertEquals("first vowel", 0, s1.IndexOfAny(c1));
+ AssertEquals("second vowel", 4, s1.IndexOfAny(c1, 1));
+ AssertEquals("out of vowels", -1, s1.IndexOfAny(c1, 9));
+ AssertEquals("second vowel in range",
+ 4, s1.IndexOfAny(c1, 1, 4));
+ AssertEquals("second vowel out of range",
+ -1, s1.IndexOfAny(c1, 1, 3));
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOfAny(c1, s1.Length+1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Out of range error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.IndexOfAny(c1, s1.Length+1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Out of range error", errorThrown);
+ }
+
+ public void TestInsert() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ string result = s1.Insert(0, null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("Null arg error", errorThrown);
+
+ errorThrown = false;
+ try {
+ string result = s1.Insert(s1.Length+1, "Hi!");
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Out of range error", errorThrown);
+
+ AssertEquals("front insert",
+ "Hi!original", s1.Insert(0, "Hi!"));
+ AssertEquals("back insert",
+ "originalHi!", s1.Insert(s1.Length, "Hi!"));
+ AssertEquals("middle insert",
+ "origHi!inal", s1.Insert(4, "Hi!"));
+ }
+
+ public void TestIntern() {
+ bool errorThrown = false;
+ try {
+ string s = String.Intern(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null arg error", errorThrown);
+
+ string s1 = "original";
+ AssertEquals("One string's reps are both the same",
+ String.Intern(s1), String.Intern(s1));
+
+ string s2 = "originally";
+ Assert("Different strings, different reps",
+ String.Intern(s1) != String.Intern(s2));
+ }
+
+ public void TestIsInterned() {
+ bool errorThrown = false;
+ try {
+ string s = String.IsInterned(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null arg error", errorThrown);
+
+ // FIXME - it seems like this should work, but no.
+ // I don't know how it's possible to get a null
+ // returned from IsInterned.
+ //Assert("no intern for regular string",
+ //String.IsInterned("original") == null);
+
+ string s1 = "original";
+ AssertEquals("is interned", s1, String.IsInterned(s1));
+ }
+
+ public void TestJoin() {
+ bool errorThrown = false;
+ try {
+ string s = String.Join(" ", null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null arg error", errorThrown);
+
+ string[] chunks = {"this", "is", "a", "test"};
+ AssertEquals("Basic join", "this is a test",
+ String.Join(" ", chunks));
+ AssertEquals("Basic join", "this.is.a.test",
+ String.Join(".", chunks));
+
+ AssertEquals("Subset join", "is a",
+ String.Join(" ", chunks, 1, 2));
+ AssertEquals("Subset join", "is.a",
+ String.Join(".", chunks, 1, 2));
+ AssertEquals("Subset join", "is a test",
+ String.Join(" ", chunks, 1, 3));
+
+ errorThrown = false;
+ try {
+ string s = String.Join(" ", chunks, 2, 3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error", errorThrown);
+ }
+
+ public void TestLastIndexOf() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ int i = s1.LastIndexOf('q', -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error for char", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf('q', -1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error for char", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf("huh", s1.Length + 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range for string", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf("huh", s1.Length + 1, 3);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range for string", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf(null, 0);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOf(null, 0, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null string error", errorThrown);
+
+ AssertEquals("basic char index", 1, s1.LastIndexOf('r'));
+ AssertEquals("basic char index", 4, s1.LastIndexOf('i'));
+ AssertEquals("basic char index - no", -1, s1.LastIndexOf('q'));
+
+ AssertEquals("basic string index", 1, s1.LastIndexOf("rig"));
+ AssertEquals("basic string index", 4, s1.LastIndexOf("i"));
+ AssertEquals("basic string index - no", -1,
+ s1.LastIndexOf("rag"));
+
+
+
+ AssertEquals("stepped char index", 1,
+ s1.LastIndexOf('r', s1.Length-1));
+ AssertEquals("stepped char index", 4,
+ s1.LastIndexOf('i', s1.Length-1));
+ AssertEquals("stepped char index", 2,
+ s1.LastIndexOf('i', 3));
+ AssertEquals("stepped char index", -1,
+ s1.LastIndexOf('i', 1));
+
+ AssertEquals("stepped limited char index",
+ 1, s1.LastIndexOf('r', 1, 1));
+ AssertEquals("stepped limited char index",
+ -1, s1.LastIndexOf('r', 0, 1));
+ AssertEquals("stepped limited char index",
+ 4, s1.LastIndexOf('i', 6, 3));
+ AssertEquals("stepped limited char index",
+ 2, s1.LastIndexOf('i', 3, 3));
+ AssertEquals("stepped limited char index",
+ -1, s1.LastIndexOf('i', 1, 2));
+
+ s1 = "original original";
+ AssertEquals("stepped string index",
+ 9, s1.LastIndexOf("original", s1.Length));
+ AssertEquals("stepped string index",
+ 0, s1.LastIndexOf("original", s1.Length-2));
+ AssertEquals("stepped string index",
+ -1, s1.LastIndexOf("original", s1.Length-11));
+ AssertEquals("stepped string index",
+ -1, s1.LastIndexOf("translator", 2));
+ AssertEquals("stepped limited string index",
+ 10, s1.LastIndexOf("rig", s1.Length-1, 10));
+ AssertEquals("stepped limited string index",
+ -1, s1.LastIndexOf("rig", s1.Length, 3));
+ AssertEquals("stepped limited string index",
+ 10, s1.LastIndexOf("rig", s1.Length-2, 15));
+ AssertEquals("stepped limited string index",
+ -1, s1.LastIndexOf("rig", s1.Length-2, 3));
+ }
+
+ public void TestLastIndexOfAny() {
+ string s1 = ".bcdefghijklm";
+
+ bool errorThrown = false;
+ try {
+ int i = s1.LastIndexOfAny(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOfAny(null, s1.Length);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOfAny(null, s1.Length, 1);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null char[] error", errorThrown);
+
+ char[] c1 = {'a', 'e', 'i', 'o', 'u'};
+ AssertEquals("first vowel", 8, s1.LastIndexOfAny(c1));
+ AssertEquals("second vowel", 4, s1.LastIndexOfAny(c1, 7));
+ AssertEquals("out of vowels", -1, s1.LastIndexOfAny(c1, 3));
+ AssertEquals("second vowel in range",
+ 4, s1.LastIndexOfAny(c1, s1.Length-6, 4));
+ AssertEquals("second vowel out of range",
+ -1, s1.LastIndexOfAny(c1, s1.Length-6, 3));
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOfAny(c1, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Out of range error", errorThrown);
+
+ errorThrown = false;
+ try {
+ int i = s1.LastIndexOfAny(c1, -1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Out of range error", errorThrown);
+ }
+
+ public void TestPadLeft() {
+ string s1 = "Hi!";
+
+ bool errorThrown = false;
+ try {
+ string s = s1.PadLeft(-1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("Bad argument error", errorThrown);
+
+ AssertEquals("Too little padding",
+ s1, s1.PadLeft(s1.Length-1));
+ AssertEquals("Some padding",
+ " Hi!", s1.PadLeft(5));
+ }
+
+ public void TestPadRight() {
+ string s1 = "Hi!";
+
+ bool errorThrown = false;
+ try {
+ string s = s1.PadRight(-1);
+ } catch (ArgumentException) {
+ errorThrown = true;
+ }
+ Assert("Bad argument error", errorThrown);
+
+ AssertEquals("Too little padding",
+ s1, s1.PadRight(s1.Length-1));
+ AssertEquals("Some padding",
+ "Hi! ", s1.PadRight(5));
+ }
+
+ public void TestRemove() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ s1.Remove(-1,1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error", errorThrown);
+ errorThrown = false;
+ try {
+ s1.Remove(1,-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error", errorThrown);
+ errorThrown = false;
+ try {
+ s1.Remove(s1.Length,s1.Length);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("out of range error", errorThrown);
+
+ AssertEquals("basic remove", "oinal",
+ s1.Remove(1, 3));
+ }
+
+ public void TestReplace() {
+ string s1 = "original";
+
+ AssertEquals("non-hit char", s1, s1.Replace('q','s'));
+ AssertEquals("single char", "oxiginal", s1.Replace('r', 'x'));
+ AssertEquals("double char", "orxgxnal", s1.Replace('i', 'x'));
+
+ bool errorThrown = false;
+ try {
+ string s = s1.Replace(null, "feh");
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("should get null arg exception", errorThrown);
+
+ AssertEquals("replace as remove", "ornal",
+ s1.Replace("igi", null));
+ AssertEquals("non-hit string", s1, s1.Replace("spam", "eggs"));
+ AssertEquals("single string", "orirumal",
+ s1.Replace("gin", "rum"));
+ AssertEquals("double string", "oreigeinal",
+ s1.Replace("i", "ei"));
+ }
+
+ public void TestSplit() {
+ string s1 = "abcdefghijklm";
+ char[] c1 = {'q', 'r'};
+ AssertEquals("No splitters", s1, (s1.Split(c1))[0]);
+
+ char[] c2 = {'a', 'e', 'i', 'o', 'u'};
+ string[] chunks = s1.Split(c2);
+ AssertEquals("First chunk", "", chunks[0]);
+ AssertEquals("Second chunk", "bcd", chunks[1]);
+ AssertEquals("Third chunk", "fgh", chunks[2]);
+ AssertEquals("Fourth chunk", "jklm", chunks[3]);
+
+ {
+ bool errorThrown = false;
+ try {
+ chunks = s1.Split(c2, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("Split out of range", errorThrown);
+ }
+
+ chunks = s1.Split(c2, 2);
+ AssertEquals("Limited chunk", 2, chunks.Length);
+ AssertEquals("First limited chunk", "", chunks[0]);
+ AssertEquals("Second limited chunk", "bcdefghijklm", chunks[1]);
+
+ string s3 = "1.0";
+ char[] c3 = {'.'};
+ chunks = s3.Split(c3,2);
+ AssertEquals("1.0 split length", 2, chunks.Length);
+ AssertEquals("1.0 split first chunk", "1", chunks[0]);
+ AssertEquals("1.0 split second chunk", "0", chunks[1]);
+
+ string s4 = "1.0.0";
+ char[] c4 = {'.'};
+ chunks = s4.Split(c4,2);
+ AssertEquals("1.0.0 split length", 2, chunks.Length);
+ AssertEquals("1.0.0 split first chunk", "1", chunks[0]);
+ AssertEquals("1.0.0 split second chunk", "0.0", chunks[1]);
+
+ string s5 = ".0.0";
+ char[] c5 = {'.'};
+ chunks = s5.Split (c5, 2);
+ AssertEquals(".0.0 split length", 2, chunks.Length);
+ AssertEquals(".0.0 split first chunk", "", chunks[0]);
+ AssertEquals(".0.0 split second chunk", "0.0", chunks[1]);
+
+ string s6 = ".0";
+ char[] c6 = {'.'};
+ chunks = s6.Split (c6, 2);
+ AssertEquals(".0 split length", 2, chunks.Length);
+ AssertEquals(".0 split first chunk", "", chunks[0]);
+ AssertEquals(".0 split second chunk", "0", chunks[1]);
+
+ string s7 = "0.";
+ char[] c7 = {'.'};
+ chunks = s7.Split (c7, 2);
+ AssertEquals("0. split length", 2, chunks.Length);
+ AssertEquals("0. split first chunk", "0", chunks[0]);
+ AssertEquals("0. split second chunk", "", chunks[1]);
+
+ string s8 = "0.0000";
+ char[] c8 = {'.'};
+ chunks = s8.Split (c8, 2);
+ AssertEquals("0.0000/2 split length", 2, chunks.Length);
+ AssertEquals("0.0000/2 split first chunk", "0", chunks[0]);
+ AssertEquals("0.0000/2 split second chunk", "0000", chunks[1]);
+
+ chunks = s8.Split (c8, 3);
+ AssertEquals("0.0000/3 split length", 2, chunks.Length);
+ AssertEquals("0.0000/3 split first chunk", "0", chunks[0]);
+ AssertEquals("0.0000/3 split second chunk", "0000", chunks[1]);
+
+ chunks = s8.Split (c8, 1);
+ AssertEquals("0.0000/1 split length", 1, chunks.Length);
+ AssertEquals("0.0000/1 split first chunk", "0.0000", chunks[0]);
+
+ chunks = s1.Split(c2, 1);
+ AssertEquals("Single split", 1, chunks.Length);
+ AssertEquals("Single chunk", s1, chunks[0]);
+
+ chunks = s1.Split(c2, 0);
+ AssertEquals("Zero split", 0, chunks.Length);
+ }
+
+ public void TestStartsWith() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ bool huh = s1.StartsWith(null);
+ } catch (ArgumentNullException) {
+ errorThrown = true;
+ }
+ Assert("null StartsWith shouldn't be good", errorThrown);
+
+ Assert("should match", s1.StartsWith("o"));
+ Assert("should match 2", s1.StartsWith("orig"));
+ Assert("should fail", !s1.StartsWith("rig"));
+ }
+
+ public void TestSubstring() {
+ string s1 = "original";
+
+ bool errorThrown = false;
+ try {
+ string s = s1.Substring(s1.Length+1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ string s = s1.Substring(-1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+
+ errorThrown = false;
+ try {
+ string s = s1.Substring(1, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ string s = s1.Substring(-1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ string s = s1.Substring(s1.Length, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ string s = s1.Substring(1, s1.Length);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+
+ AssertEquals("basic substring", "inal",
+ s1.Substring(4));
+ AssertEquals("midstring", "igin",
+ s1.Substring(2, 4));
+ }
+
+ public void TestToCharArray() {
+ string s1 = "original";
+ char[] c1 = s1.ToCharArray();
+ AssertEquals("right array size", s1.Length, c1.Length);
+ AssertEquals("basic char array", s1,
+ new String(c1));
+
+ bool errorThrown = false;
+ try {
+ s1.ToCharArray(s1.Length, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ s1.ToCharArray(1, s1.Length);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ s1.ToCharArray(-1, 1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+ errorThrown = false;
+ try {
+ s1.ToCharArray(1, -1);
+ } catch (ArgumentOutOfRangeException) {
+ errorThrown = true;
+ }
+ Assert("error not thrown", errorThrown);
+
+ c1 = s1.ToCharArray(0, 3);
+ AssertEquals("Starting char array", "ori", new String(c1));
+ }
+
+ public void TestToLower() {
+ string s1 = "OrIgInAl";
+ AssertEquals("lowercase failed", "original", s1.ToLower());
+
+ // TODO - Again, with CultureInfo
+ }
+
+ public void TestToString() {
+ string s1 = "original";
+ AssertEquals("ToString failed!", s1, s1.ToString());
+ }
+
+ public void TestToUpper() {
+ string s1 = "OrIgInAl";
+ AssertEquals("uppercase failed", "ORIGINAL", s1.ToUpper());
+
+ // TODO - Again, with CultureInfo
+ }
+
+ public void TestTrim() {
+ string s1 = " original\t\n";
+ AssertEquals("basic trim failed", "original", s1.Trim());
+ AssertEquals("basic trim failed", "original", s1.Trim(null));
+
+ s1 = "original";
+ AssertEquals("basic trim failed", "original", s1.Trim());
+ AssertEquals("basic trim failed", "original", s1.Trim(null));
+
+ s1 = " \t \n ";
+ AssertEquals("empty trim failed", "", s1.Trim());
+ AssertEquals("empty trim failed", "", s1.Trim(null));
+
+ s1 = "aaaoriginalbbb";
+ char[] delims = {'a', 'b'};
+ AssertEquals("custom trim failed",
+ "original", s1.Trim(delims));
+ }
+
+ public void TestTrimEnd() {
+ string s1 = " original\t\n";
+ AssertEquals("basic TrimEnd failed",
+ " original", s1.TrimEnd(null));
+
+ s1 = " original";
+ AssertEquals("basic TrimEnd failed",
+ " original", s1.TrimEnd(null));
+
+ s1 = " \t \n \n ";
+ AssertEquals("empty TrimEnd failed",
+ "", s1.TrimEnd(null));
+
+ s1 = "aaaoriginalbbb";
+ char[] delims = {'a', 'b'};
+ AssertEquals("custom TrimEnd failed",
+ "aaaoriginal", s1.TrimEnd(delims));
+ }
+
+ public void TestTrimStart() {
+ string s1 = " original\t\n";
+ AssertEquals("basic TrimStart failed",
+ "original\t\n", s1.TrimStart(null));
+
+ s1 = "original\t\n";
+ AssertEquals("basic TrimStart failed",
+ "original\t\n", s1.TrimStart(null));
+
+ s1 = " \t \n \n ";
+ AssertEquals("empty TrimStart failed",
+ "", s1.TrimStart(null));
+
+ s1 = "aaaoriginalbbb";
+ char[] delims = {'a', 'b'};
+ AssertEquals("custom TrimStart failed",
+ "originalbbb", s1.TrimStart(delims));
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/TimeSpanTest.cs b/mcs/class/corlib/Test/System/TimeSpanTest.cs
new file mode 100755
index 00000000000..c3e59151ac3
--- /dev/null
+++ b/mcs/class/corlib/Test/System/TimeSpanTest.cs
@@ -0,0 +1,266 @@
+//
+// TimeSpanTest.cs - NUnit Test Cases for the System.TimeSpan struct
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2001 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+public class TimeSpanTest : TestCase
+{
+ public TimeSpanTest() : base ("MonoTests.System.TimeSpanTest testcase") {}
+ public TimeSpanTest (string name): base (name) {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof(TimeSpanTest));
+ }
+ }
+
+ public void TestCtors ()
+ {
+ TimeSpan t1 = new TimeSpan (1234567890);
+
+ AssertEquals ("A1", "00:02:03.4567890", t1.ToString ());
+ t1 = new TimeSpan (1,2,3);
+ AssertEquals ("A2", "01:02:03", t1.ToString ());
+ t1 = new TimeSpan (1,2,3,4);
+ AssertEquals ("A3", "1.02:03:04", t1.ToString ());
+ t1 = new TimeSpan (1,2,3,4,5);
+ AssertEquals ("A4", "1.02:03:04.0050000", t1.ToString ());
+ t1 = new TimeSpan (-1,2,-3,4,-5);
+ AssertEquals ("A5", "-22:02:56.0050000", t1.ToString ());
+ t1 = new TimeSpan (0,25,0,0,0);
+ AssertEquals ("A6", "1.01:00:00", t1.ToString ());
+ }
+
+ public void TestProperties ()
+ {
+ TimeSpan t1 = new TimeSpan (1,2,3,4,5);
+ TimeSpan t2 = -t1;
+
+ AssertEquals ("A1", 1, t1.Days);
+ AssertEquals ("A2", 2, t1.Hours);
+ AssertEquals ("A3", 3, t1.Minutes);
+ AssertEquals ("A4", 4, t1.Seconds);
+ AssertEquals ("A5", 5, t1.Milliseconds);
+ AssertEquals ("A6", -1, t2.Days);
+ AssertEquals ("A7", -2, t2.Hours);
+ AssertEquals ("A8", -3, t2.Minutes);
+ AssertEquals ("A9", -4, t2.Seconds);
+ AssertEquals ("A10", -5, t2.Milliseconds);
+ }
+
+ public void TestAdd ()
+ {
+ TimeSpan t1 = new TimeSpan (2,3,4,5,6);
+ TimeSpan t2 = new TimeSpan (1,2,3,4,5);
+ TimeSpan t3 = t1 + t2;
+ TimeSpan t4 = t1.Add (t2);
+ TimeSpan t5;
+ bool exception;
+
+ AssertEquals ("A1", 3, t3.Days);
+ AssertEquals ("A2", 5, t3.Hours);
+ AssertEquals ("A3", 7, t3.Minutes);
+ AssertEquals ("A4", 9, t3.Seconds);
+ AssertEquals ("A5", 11, t3.Milliseconds);
+ AssertEquals ("A6", "3.05:07:09.0110000", t4.ToString ());
+ try
+ {
+ t5 = TimeSpan.MaxValue + new TimeSpan (1);
+ exception = false;
+ }
+ catch (OverflowException)
+ {
+ exception = true;
+ }
+ Assert ("A7", exception);
+ }
+
+ public void TestCompare ()
+ {
+ TimeSpan t1 = new TimeSpan (-1);
+ TimeSpan t2 = new TimeSpan (1);
+ int res;
+ bool exception;
+
+ AssertEquals ("A1", -1, TimeSpan.Compare (t1, t2));
+ AssertEquals ("A2", 1, TimeSpan.Compare (t2, t1));
+ AssertEquals ("A3", 0, TimeSpan.Compare (t2, t2));
+ AssertEquals ("A4", -1, TimeSpan.Compare (TimeSpan.MinValue, TimeSpan.MaxValue));
+ AssertEquals ("A5", -1, t1.CompareTo (t2));
+ AssertEquals ("A6", 1, t2.CompareTo (t1));
+ AssertEquals ("A7", 0, t2.CompareTo (t2));
+ AssertEquals ("A8", -1, TimeSpan.Compare (TimeSpan.MinValue, TimeSpan.MaxValue));
+
+ AssertEquals ("A9", 1, TimeSpan.Zero.CompareTo (null));
+
+ try
+ {
+ res = TimeSpan.Zero.CompareTo("");
+ exception = false;
+ }
+ catch (ArgumentException)
+ {
+ exception = true;
+ }
+ Assert ("A10", exception);
+
+ AssertEquals ("A11", false, t1 == t2);
+ AssertEquals ("A12", false, t1 > t2);
+ AssertEquals ("A13", false, t1 >= t2);
+ AssertEquals ("A14", true, t1 != t2);
+ AssertEquals ("A15", true, t1 < t2);
+ AssertEquals ("A16", true, t1 <= t2);
+ }
+
+ public void TestNegateAndDuration ()
+ {
+ TimeSpan t1;
+ bool exception;
+
+ AssertEquals ("A1", "-00:00:00.0012345", new TimeSpan (12345).Negate ().ToString ());
+ AssertEquals ("A2", "00:00:00.0012345", new TimeSpan (-12345).Duration ().ToString ());
+
+ try
+ {
+ t1 = TimeSpan.MinValue.Negate ();
+ exception = false;
+ }
+ catch (OverflowException)
+ {
+ exception = true;
+ }
+ Assert ("A3", exception);
+
+ try
+ {
+ t1 = TimeSpan.MinValue.Duration ();
+ exception = false;
+ }
+ catch (OverflowException) {
+ exception = true;
+ }
+ Assert ("A4", exception);
+
+ AssertEquals ("A5", "-00:00:00.0000077", (-(new TimeSpan (77))).ToString ());
+ AssertEquals("A6", "00:00:00.0000077", (+(new TimeSpan(77))).ToString());
+ }
+
+ public void TestEquals ()
+ {
+ TimeSpan t1 = new TimeSpan (1);
+ TimeSpan t2 = new TimeSpan (2);
+ string s = "justastring";
+
+ AssertEquals ("A1", true, t1.Equals (t1));
+ AssertEquals ("A2", false, t1.Equals (t2));
+ AssertEquals ("A3", false, t1.Equals (s));
+ AssertEquals ("A4", false, t1.Equals (null));
+ AssertEquals ("A5", true, TimeSpan.Equals (t1, t1));
+ AssertEquals ("A6", false, TimeSpan.Equals (t1, t2));
+ AssertEquals ("A7", false, TimeSpan.Equals (t1, null));
+ AssertEquals ("A8", false, TimeSpan.Equals (t1, s));
+ AssertEquals ("A9", false, TimeSpan.Equals (s, t2));
+ AssertEquals ("A10", true, TimeSpan.Equals (null,null));
+ }
+
+ public void TestFromXXXX ()
+ {
+ AssertEquals ("A1", "12.08:16:48", TimeSpan.FromDays (12.345).ToString ());
+ AssertEquals ("A2", "12:20:42", TimeSpan.FromHours (12.345).ToString ());
+ AssertEquals ("A3", "00:12:20.7000000", TimeSpan.FromMinutes (12.345).ToString ());
+ AssertEquals ("A4", "00:00:12.3450000", TimeSpan.FromSeconds (12.345).ToString ());
+ AssertEquals ("A5", "00:00:00.0120000", TimeSpan.FromMilliseconds (12.345).ToString ());
+ AssertEquals ("A6", "00:00:00.0012345", TimeSpan.FromTicks (12345).ToString ());
+ }
+
+ public void TestGetHashCode ()
+ {
+ AssertEquals ("A1", 77, new TimeSpan (77).GetHashCode ());
+ }
+
+ private void TestParseHelper (string s, bool expectFormat, bool expectOverflow, string expect)
+ {
+ bool formatException = false;
+ bool overflowException = false;
+ string result = "junk ";
+
+ try {
+ result = TimeSpan.Parse (s).ToString ();
+ }
+ catch (OverflowException) {
+ overflowException = true;
+ }
+ catch (FormatException) {
+ formatException = true;
+ }
+ AssertEquals ("A1", expectFormat, formatException);
+ AssertEquals ("A2", expectOverflow, overflowException);
+
+ if (!expectOverflow && !expectFormat) {
+ AssertEquals ("A3", expect, result);
+ }
+ }
+
+ public void TestParse ()
+ {
+ TestParseHelper (" 13:45:15 ",false, false, "13:45:15");
+ TestParseHelper (" -1:2:3 ", false, false, "-01:02:03");
+
+ TestParseHelper (" 25:0:0 ",false, true, "dontcare");
+ TestParseHelper ("aaa", true, false, "dontcare");
+
+ TestParseHelper ("-21.23:59:59.9999999", false, false, "-21.23:59:59.9999999");
+
+ TestParseHelper ("100000000000000.1:1:1", false, true, "dontcare");
+ TestParseHelper ("24:60:60", false, true, "dontcare");
+ TestParseHelper ("0001:0002:0003.12 ", false, false, "01:02:03.1200000");
+
+ TestParseHelper (" 1:2:3:12345678 ", true, false, "dontcare");
+ }
+
+ public void TestSubstract ()
+ {
+ TimeSpan t1 = new TimeSpan (2,3,4,5,6);
+ TimeSpan t2 = new TimeSpan (1,2,3,4,5);
+ TimeSpan t3 = t1 - t2;
+ TimeSpan t4 = t1.Subtract (t2);
+ TimeSpan t5;
+ bool exception;
+
+ AssertEquals ("A1", "1.01:01:01.0010000", t3.ToString ());
+ AssertEquals ("A2", "1.01:01:01.0010000", t4.ToString ());
+ try {
+ t5 = TimeSpan.MinValue - new TimeSpan (1);
+ exception = false;
+ }
+ catch (OverflowException) {
+ exception = true;
+ }
+ Assert ("A3", exception);
+ }
+
+ public void TestToString ()
+ {
+ TimeSpan t1 = new TimeSpan (1,2,3,4,5);
+ TimeSpan t2 = -t1;
+
+ AssertEquals ("A1", "1.02:03:04.0050000", t1.ToString ());
+ AssertEquals ("A2", "-1.02:03:04.0050000", t2.ToString ());
+ AssertEquals ("A3", "10675199.02:48:05.4775807", TimeSpan.MaxValue.ToString ());
+ AssertEquals ("A4", "-10675199.02:48:05.4775808", TimeSpan.MinValue.ToString ());
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/TimeZoneTest.cs b/mcs/class/corlib/Test/System/TimeZoneTest.cs
new file mode 100644
index 00000000000..1fb301b474d
--- /dev/null
+++ b/mcs/class/corlib/Test/System/TimeZoneTest.cs
@@ -0,0 +1,71 @@
+//
+// TimeZoneTest.cs - NUnit Test Cases for the System.TimeZone struct
+//
+// author:
+// Martin Baulig (martin@gnome.org)
+//
+// (C) 2002 Martin Baulig
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class TimeZoneTest : TestCase
+{
+ public TimeZoneTest() : base ("MonoTests.System.TimeZoneTest testcase") {}
+ public TimeZoneTest (string name): base(name) {}
+
+ public static ITest Suite
+ {
+ get {
+ return new TestSuite (typeof(TimeZoneTest));
+ }
+ }
+
+ public void TestCtors ()
+ {
+ TimeZone t1 = TimeZone.CurrentTimeZone;
+ AssertEquals("A01", "CET", t1.StandardName);
+ AssertEquals("A02", "CEST", t1.DaylightName);
+
+ DaylightTime d1 = t1.GetDaylightChanges (2002);
+ AssertEquals("A03", "03/31/2002 01:00:00", d1.Start.ToString ("G"));
+ AssertEquals("A04", "10/27/2002 01:00:00", d1.End.ToString ("G"));
+ AssertEquals("A05", 36000000000L, d1.Delta.Ticks);
+
+ DaylightTime d2 = t1.GetDaylightChanges (1996);
+ AssertEquals("A06", "03/31/1996 01:00:00", d2.Start.ToString ("G"));
+ AssertEquals("A07", "10/27/1996 01:00:00", d2.End.ToString ("G"));
+ AssertEquals("A08", 36000000000L, d2.Delta.Ticks);
+
+ DateTime d3 = new DateTime (2002,2,25);
+ AssertEquals("A09", false, t1.IsDaylightSavingTime (d3));
+ DateTime d4 = new DateTime (2002,4,2);
+ AssertEquals("A10", true, t1.IsDaylightSavingTime (d4));
+ DateTime d5 = new DateTime (2002,11,4);
+ AssertEquals("A11", false, t1.IsDaylightSavingTime (d5));
+
+ AssertEquals("A12", 36000000000L, t1.GetUtcOffset (d3).Ticks);
+ AssertEquals("A13", 72000000000L, t1.GetUtcOffset (d4).Ticks);
+ AssertEquals("A14", 36000000000L, t1.GetUtcOffset (d5).Ticks);
+ }
+
+ protected override void RunTest ()
+ {
+ CultureInfo oldcult = Thread.CurrentThread.CurrentCulture;
+
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("");
+
+ TestCtors ();
+
+ Thread.CurrentThread.CurrentCulture = oldcult;
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/UInt16Test.cs b/mcs/class/corlib/Test/System/UInt16Test.cs
new file mode 100644
index 00000000000..cc62b30384e
--- /dev/null
+++ b/mcs/class/corlib/Test/System/UInt16Test.cs
@@ -0,0 +1,194 @@
+// UInt16Test.cs - NUnit Test Cases for the System.UInt16 struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class UInt16Test : TestCase
+{
+ private const UInt16 MyUInt16_1 = 42;
+ private const UInt16 MyUInt16_2 = 0;
+ private const UInt16 MyUInt16_3 = 65535;
+ private const string MyString1 = "42";
+ private const string MyString2 = "0";
+ private const string MyString3 = "65535";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {null,
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] Results2 = {null,
+ "65535", "6.55350e+004", "65535.00000",
+ "65535", "65,535.00000", "6,553,500.00000 %", "0ffff"};
+ private string[] ResultsNfi1 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"0.00",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"65,535.00000",
+ "65535", "6.55350e+004", "65535.00000",
+ "65535", "65,535.00000", "6,553,500.00000 %", "0ffff"};
+
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public UInt16Test() : base ("MonoTests.System.UInt16Test testcase") {}
+ public UInt16Test(string name) : base(name) {}
+
+ private CultureInfo old_culture;
+
+ protected override void SetUp()
+ {
+ old_culture = Thread.CurrentThread.CurrentCulture;
+
+ // Set culture to en-US and don't let the user override.
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+
+ Results1 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"0.00";
+ Results2 [0] = NumberFormatInfo.CurrentInfo.CurrencySymbol+"65,535.00000";
+ }
+
+ protected override void TearDown()
+ {
+ Thread.CurrentThread.CurrentCulture = old_culture;
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(UInt16Test));
+ }
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals(UInt16.MinValue, MyUInt16_2);
+ AssertEquals(UInt16.MaxValue, MyUInt16_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyUInt16_3.CompareTo(MyUInt16_2) > 0);
+ Assert(MyUInt16_2.CompareTo(MyUInt16_2) == 0);
+ Assert(MyUInt16_1.CompareTo((UInt16)(42)) == 0);
+ Assert(MyUInt16_2.CompareTo(MyUInt16_3) < 0);
+ try {
+ MyUInt16_2.CompareTo(100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyUInt16_1.Equals(MyUInt16_1));
+ Assert(MyUInt16_1.Equals((UInt16)(42)));
+ Assert(MyUInt16_1.Equals((SByte)(42)) == false);
+ Assert(MyUInt16_1.Equals(MyUInt16_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyUInt16_1.GetHashCode();
+ MyUInt16_2.GetHashCode();
+ MyUInt16_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert(MyUInt16_1 == UInt16.Parse(MyString1));
+ Assert(MyUInt16_2 == UInt16.Parse(MyString2));
+ Assert(MyUInt16_3 == UInt16.Parse(MyString3));
+ try {
+ UInt16.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ UInt16.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ try {
+ int OverInt = UInt16.MaxValue + 1;
+ UInt16.Parse(OverInt.ToString());
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ Assert(42 == UInt16.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ", NumberStyles.Currency));
+ try {
+ UInt16.Parse("$42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(42 == UInt16.Parse(" 42 ", Nfi));
+ try {
+ UInt16.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == UInt16.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ UInt16.Parse("$42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ AssertEquals("A1", MyString1, MyUInt16_1.ToString());
+ AssertEquals("A2", MyString2, MyUInt16_2.ToString());
+ AssertEquals("A3", MyString3, MyUInt16_3.ToString());
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("A4:"+i.ToString(), Results1[i], MyUInt16_2.ToString(Formats1[i]));
+ AssertEquals("A5:"+i.ToString(), Results2[i], MyUInt16_3.ToString(Formats2[i]));
+ }
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals("A6:"+i.ToString(), ResultsNfi1[i], MyUInt16_2.ToString(Formats1[i], Nfi));
+ AssertEquals("A7:"+i.ToString(), ResultsNfi2[i], MyUInt16_3.ToString(Formats2[i], Nfi));
+ }
+ try {
+ MyUInt16_1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("A8", typeof(FormatException) == e.GetType());
+ }
+ }
+}
+
+
+}
diff --git a/mcs/class/corlib/Test/System/UInt32Test.cs b/mcs/class/corlib/Test/System/UInt32Test.cs
new file mode 100644
index 00000000000..1f82313ffe7
--- /dev/null
+++ b/mcs/class/corlib/Test/System/UInt32Test.cs
@@ -0,0 +1,200 @@
+// UInt32Test.cs - NUnit Test Cases for the System.UInt32 struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class UInt32Test : TestCase
+{
+ private const UInt32 MyUInt32_1 = 42;
+ private const UInt32 MyUInt32_2 = 0;
+ private const UInt32 MyUInt32_3 = 4294967295;
+ private const string MyString1 = "42";
+ private const string MyString2 = "0";
+ private const string MyString3 = "4294967295";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"0.00",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] ResultsNfi1 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"0.00",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] Results2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"4,294,967,295.00000",
+ "4294967295", "4.29497e+009", "4294967295.00000",
+ "4.295e+09", "4,294,967,295.00000", "429,496,729,500.00000 %", "ffffffff"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"4,294,967,295.00000",
+ "4294967295", "4.29497e+009", "4294967295.00000",
+ "4.295e+09", "4,294,967,295.00000", "429,496,729,500.00000 %", "ffffffff"};
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public UInt32Test() : base ("MonoTests.System.UInt32Test testcase") {}
+ public UInt32Test(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(UInt32Test));
+ }
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals(UInt32.MinValue, MyUInt32_2);
+ AssertEquals(UInt32.MaxValue, MyUInt32_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyUInt32_3.CompareTo(MyUInt32_2) > 0);
+ Assert(MyUInt32_2.CompareTo(MyUInt32_2) == 0);
+ Assert(MyUInt32_1.CompareTo((UInt32)(42)) == 0);
+ Assert(MyUInt32_2.CompareTo(MyUInt32_3) < 0);
+ Assert (1 == UInt32.Parse ("1"));
+ Assert (1 == UInt32.Parse (" 1"));
+ Assert (1 == UInt32.Parse (" 1"));
+ Assert (1 == UInt32.Parse ("1 "));
+ Assert (1 == UInt32.Parse ("+1"));
+
+ try {
+ UInt32.Parse (" + 1 ");
+ Fail ("Should raise FormatException1");
+ } catch (Exception e){
+ Assert (typeof (FormatException) == e.GetType ());
+ }
+
+ try {
+ UInt32.Parse (" + ");
+ Fail ("Should raise FormatException");
+ } catch (Exception e){
+ Assert (typeof (FormatException) == e.GetType ());
+ }
+ try {
+ MyUInt32_2.CompareTo((Int16)100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyUInt32_1.Equals(MyUInt32_1));
+ Assert(MyUInt32_1.Equals((UInt32)(42)));
+ Assert(MyUInt32_1.Equals((SByte)(42)) == false);
+ Assert(MyUInt32_1.Equals(MyUInt32_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyUInt32_1.GetHashCode();
+ MyUInt32_2.GetHashCode();
+ MyUInt32_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert("Parse problem on \""+MyString1+"\"", MyUInt32_1 == UInt32.Parse(MyString1));
+ Assert("Parse problem on \""+MyString2+"\"", MyUInt32_2 == UInt32.Parse(MyString2));
+ Assert("Parse problem on \""+MyString3+"\"", MyUInt32_3 == UInt32.Parse(MyString3));
+ try {
+ UInt32.Parse(null);
+ Fail("Should raise a System.ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert("Did not get ArgumentNullException type", typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ UInt32.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert("Did not get FormatException type", typeof(FormatException) == e.GetType());
+ }
+ try {
+ // TODO: Use this after ToString() is completed. For now, hard code string that generates
+ // exception.
+ //double OverInt = (double)UInt32.MaxValue + 1;
+ //UInt32.Parse(OverInt.ToString());
+ UInt32.Parse("4294967296");
+ Fail("Should raise a System.OverflowException");
+ }
+ catch (Exception e) {
+ Assert("Did not get OverflowException type on '"+"4294967296"+"'. Instead, got: '"+e.GetType()+"'", typeof(OverflowException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ Assert(42 == UInt32.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ", NumberStyles.Currency));
+ try {
+ UInt32.Parse("$42", NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(42 == UInt32.Parse(" 42 ", Nfi));
+ try {
+ UInt32.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == UInt32.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ UInt32.Parse("$42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ AssertEquals(MyString1, MyUInt32_1.ToString());
+ AssertEquals(MyString2, MyUInt32_2.ToString());
+ AssertEquals(MyString3, MyUInt32_3.ToString());
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals(Results1[i], MyUInt32_2.ToString(Formats1[i]));
+ AssertEquals(Results2[i], MyUInt32_3.ToString(Formats2[i]));
+ }
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals(ResultsNfi1[i], MyUInt32_2.ToString(Formats1[i], Nfi));
+ AssertEquals(ResultsNfi2[i], MyUInt32_3.ToString(Formats2[i], Nfi));
+ }
+ try {
+ MyUInt32_1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+}
+
+
+}
diff --git a/mcs/class/corlib/Test/System/UInt64Test.cs b/mcs/class/corlib/Test/System/UInt64Test.cs
new file mode 100644
index 00000000000..7ef4c485912
--- /dev/null
+++ b/mcs/class/corlib/Test/System/UInt64Test.cs
@@ -0,0 +1,188 @@
+// UInt64Test.cs - NUnit Test Cases for the System.UInt64 struct
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using NUnit.Framework;
+using System;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+
+public class UInt64Test : TestCase
+{
+ private const UInt64 MyUInt64_1 = 42;
+ private const UInt64 MyUInt64_2 = 0;
+ private const UInt64 MyUInt64_3 = 18446744073709551615;
+ private const string MyString1 = "42";
+ private const string MyString2 = "0";
+ private const string MyString3 = "18446744073709551615";
+ private string[] Formats1 = {"c", "d", "e", "f", "g", "n", "p", "x" };
+ private string[] Formats2 = {"c5", "d5", "e5", "f5", "g5", "n5", "p5", "x5" };
+ private string[] Results1 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"0.00",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] ResultsNfi1 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"0.00",
+ "0", "0.000000e+000", "0.00",
+ "0", "0.00", "0.00 %", "0"};
+ private string[] Results2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"18,446,744,073,709,551,615.00000",
+ "18446744073709551615", "1.84467e+019", "18446744073709551615.00000",
+ "1.8447e+19", "18,446,744,073,709,551,615.00000",
+ "1,844,674,407,370,955,161,500.00000 %", "ffffffffffffffff"};
+ private string[] ResultsNfi2 = {NumberFormatInfo.InvariantInfo.CurrencySymbol+"18,446,744,073,709,551,615.00000",
+ "18446744073709551615", "1.84467e+019", "18446744073709551615.00000",
+ "1.8447e+19", "18,446,744,073,709,551,615.00000",
+ "1,844,674,407,370,955,161,500.00000 %", "ffffffffffffffff"};
+
+ private NumberFormatInfo Nfi = NumberFormatInfo.InvariantInfo;
+
+ public UInt64Test() : base ("MonoTests.System.UInt64Test testcase") {}
+ public UInt64Test(string name) : base(name) {}
+
+ protected override void SetUp()
+ {
+ }
+
+ public static ITest Suite {
+ get {
+ return new TestSuite(typeof(UInt64Test));
+ }
+ }
+
+ public void TestMinMax()
+ {
+
+ AssertEquals(UInt64.MinValue, MyUInt64_2);
+ AssertEquals(UInt64.MaxValue, MyUInt64_3);
+ }
+
+ public void TestCompareTo()
+ {
+ Assert(MyUInt64_3.CompareTo(MyUInt64_2) > 0);
+ Assert(MyUInt64_2.CompareTo(MyUInt64_2) == 0);
+ Assert(MyUInt64_1.CompareTo((UInt64)(42)) == 0);
+ Assert(MyUInt64_2.CompareTo(MyUInt64_3) < 0);
+ try {
+ MyUInt64_2.CompareTo((Int16)100);
+ Fail("Should raise a System.ArgumentException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentException) == e.GetType());
+ }
+ }
+
+ public void TestEquals()
+ {
+ Assert(MyUInt64_1.Equals(MyUInt64_1));
+ Assert(MyUInt64_1.Equals((UInt64)(42)));
+ Assert(MyUInt64_1.Equals((SByte)(42)) == false);
+ Assert(MyUInt64_1.Equals(MyUInt64_2) == false);
+ }
+
+ public void TestGetHashCode()
+ {
+ try {
+ MyUInt64_1.GetHashCode();
+ MyUInt64_2.GetHashCode();
+ MyUInt64_3.GetHashCode();
+ }
+ catch {
+ Fail("GetHashCode should not raise an exception here");
+ }
+ }
+
+ public void TestParse()
+ {
+ //test Parse(string s)
+ Assert(MyUInt64_1 == UInt64.Parse(MyString1));
+ Assert(MyUInt64_2 == UInt64.Parse(MyString2));
+ Assert(MyUInt64_3 == UInt64.Parse(MyString3));
+ try {
+ UInt64.Parse(null);
+ Fail("Should raise a ArgumentNullException");
+ }
+ catch (Exception e) {
+ Assert(typeof(ArgumentNullException) == e.GetType());
+ }
+ try {
+ UInt64.Parse("not-a-number");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style)
+ try {
+ double OverInt = (double)UInt64.MaxValue + 1;
+ UInt64.Parse(OverInt.ToString(), NumberStyles.Float);
+ Fail("Should raise a OverflowException");
+ }
+ catch (Exception e) {
+ Assert(typeof(OverflowException) == e.GetType());
+ }
+ try {
+ double OverInt = (double)UInt64.MaxValue + 1;
+ UInt64.Parse(OverInt.ToString(), NumberStyles.Integer);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ Assert(42 == UInt64.Parse(" "+NumberFormatInfo.CurrentInfo.CurrencySymbol+"42 ", NumberStyles.Currency));
+ try {
+ UInt64.Parse("$42", NumberStyles.Integer);
+ Fail("Should raise a FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, IFormatProvider provider)
+ Assert(42 == UInt64.Parse(" 42 ", Nfi));
+ try {
+ UInt64.Parse("%42", Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ //test Parse(string s, NumberStyles style, IFormatProvider provider)
+ Assert(16 == UInt64.Parse(" 10 ", NumberStyles.HexNumber, Nfi));
+ try {
+ UInt64.Parse("$42", NumberStyles.Integer, Nfi);
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+
+ public void TestToString()
+ {
+ //test ToString()
+ AssertEquals(MyString1, MyUInt64_1.ToString());
+ AssertEquals(MyString2, MyUInt64_2.ToString());
+ AssertEquals(MyString3, MyUInt64_3.ToString());
+ //test ToString(string format)
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals(Results1[i], MyUInt64_2.ToString(Formats1[i]));
+ AssertEquals(Results2[i], MyUInt64_3.ToString(Formats2[i]));
+ }
+ //test ToString(string format, IFormatProvider provider);
+ for (int i=0; i < Formats1.Length; i++) {
+ AssertEquals(ResultsNfi1[i], MyUInt64_2.ToString(Formats1[i], Nfi));
+ AssertEquals(ResultsNfi2[i], MyUInt64_3.ToString(Formats2[i], Nfi));
+ }
+ try {
+ MyUInt64_1.ToString("z");
+ Fail("Should raise a System.FormatException");
+ }
+ catch (Exception e) {
+ Assert(typeof(FormatException) == e.GetType());
+ }
+ }
+}
+
+}
diff --git a/mcs/class/corlib/Test/System/VersionTest.cs b/mcs/class/corlib/Test/System/VersionTest.cs
new file mode 100644
index 00000000000..32f4c17d6e5
--- /dev/null
+++ b/mcs/class/corlib/Test/System/VersionTest.cs
@@ -0,0 +1,244 @@
+//
+// VersionTest.cs - NUnit Test Cases for the System.Version class
+//
+// author:
+// Duco Fijma (duco@lorentz.xs4all.nl)
+//
+// (C) 2002 Duco Fijma
+//
+
+using NUnit.Framework;
+using System;
+
+namespace MonoTests.System
+{
+
+public class VersionTest : TestCase
+{
+ public VersionTest () : base ("MonoTests.System.VersionTest testcase") {}
+ public VersionTest (string name) : base (name) {}
+
+ public static ITest Suite {
+ get {
+ return new TestSuite (typeof (VersionTest));
+ }
+ }
+
+
+ public void TestCtors ()
+ {
+ Version v1;
+ bool exception;
+
+ /*
+ v1 = new Version ();
+ AssertEquals ("A1", 0, v1.Major);
+ AssertEquals ("A2", 0, v1.Minor);
+ AssertEquals ("A3", -1, v1.Build);
+ AssertEquals ("A4", -1, v1.Revision);
+ */
+
+ v1 = new Version (23, 7);
+ AssertEquals ("A5", 23, v1.Major);
+ AssertEquals ("A6", 7, v1.Minor);
+ AssertEquals ("A7", -1, v1.Build);
+ AssertEquals ("A8", -1, v1.Revision);
+
+ v1 = new Version (23, 7, 99);
+ AssertEquals ("A9", 23, v1.Major);
+ AssertEquals ("A10", 7, v1.Minor);
+ AssertEquals ("A11", 99, v1.Build);
+ AssertEquals ("A12", -1, v1.Revision);
+
+ v1 = new Version (23, 7, 99, 42);
+ AssertEquals ("A13", 23, v1.Major);
+ AssertEquals ("A14", 7, v1.Minor);
+ AssertEquals ("A15", 99, v1.Build);
+ AssertEquals ("A16", 42, v1.Revision);
+
+ try {
+ v1 = new Version (23, -1);
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A17", exception);
+
+ try {
+ v1 = new Version (23, 7, -1);
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A18", exception);
+
+ try {
+ v1 = new Version (23, 7, 99, -1);
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A19", exception);
+
+ }
+
+ public void TestStringCtor ()
+ {
+ Version v1;
+ bool exception;
+
+ v1 = new Version("1.42.79");
+ AssertEquals ("A1", 1, v1.Major);
+ AssertEquals ("A2", 42, v1.Minor);
+ AssertEquals ("A3", 79, v1.Build);
+ AssertEquals ("A4", -1, v1.Revision);
+
+
+ try {
+ v1 = new Version ("1.42.-79");
+ exception = false;
+ }
+ catch (ArgumentOutOfRangeException) {
+ exception = true;
+ }
+ Assert ("A5", exception);
+
+ try {
+ v1 = new Version ("1");
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A6", exception);
+
+ try {
+ v1 = new Version ("1.2.3.4.5");
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A7", exception);
+
+ try {
+ v1 = new Version ((string) null);
+ exception = false;
+ }
+ catch (ArgumentNullException) {
+ exception = true;
+ }
+ Assert ("A6", exception);
+
+
+ }
+
+ public void TestClone ()
+ {
+ Version v1 = new Version (1, 2, 3, 4);
+ Version v2 = (Version) v1.Clone ();
+
+ Assert ("A1", v1.Equals (v2));
+ Assert ("A2", !ReferenceEquals (v1, v2));
+ }
+
+ public void TestCompareTo ()
+ {
+ Assert ("A1", new Version (1, 2).CompareTo (new Version (1, 1)) > 0);
+ Assert ("A2", new Version (1, 2, 3).CompareTo (new Version (2, 2, 3)) < 0);
+ Assert ("A3", new Version (1, 2, 3, 4).CompareTo (new Version (1, 2, 2, 1)) > 0);
+
+ Assert ("A4", new Version (1, 3).CompareTo (new Version (1, 2, 2, 1)) > 0);
+ Assert ("A5", new Version (1, 2, 2).CompareTo (new Version (1, 2, 2, 1)) < 0);
+
+ Assert ("A6", new Version (1, 2).CompareTo (new Version (1, 2)) == 0);
+ Assert ("A7", new Version (1, 2, 3).CompareTo (new Version (1, 2, 3)) == 0);
+
+ Assert ("A8", new Version (1, 1) < new Version (1, 2));
+ Assert ("A9", new Version (1, 2) <= new Version (1, 2));
+ Assert ("A10", new Version (1, 2) <= new Version (1, 3));
+ Assert ("A11", new Version (1, 2) >= new Version (1, 2));
+ Assert ("A12", new Version (1, 3) >= new Version (1, 2));
+ Assert ("A13", new Version (1, 3) > new Version (1, 2));
+
+ Version v1 = new Version(1, 2);
+ bool exception;
+
+ // LAMESPEC: Docs say this should throw a ArgumentNullException,
+ // but it simply works. Seems any version is subsequent to null
+ Assert ("A14:", v1.CompareTo (null) > 0);
+
+ try {
+ v1.CompareTo ("A string is not a version");
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A15", exception);
+
+ }
+
+
+ public void TestEquals ()
+ {
+ Version v1 = new Version (1, 2);
+ Version v2 = new Version (1, 2, 3, 4);
+ Version v3 = new Version (1, 2, 3, 4);
+
+ AssertEquals ("A1", true, v2.Equals (v3));
+ AssertEquals ("A2", true, v2.Equals (v2));
+ AssertEquals ("A3", false, v1.Equals (v3));
+
+ AssertEquals ("A4", true, v2 == v3);
+ AssertEquals ("A5", true, v2 == v2);
+ AssertEquals ("A6", false, v1 == v3);
+
+ AssertEquals ("A7", false, v2.Equals ((Version) null));
+ AssertEquals ("A8", false, v2.Equals ("A string"));
+
+ }
+
+ public void TestToString ()
+ {
+ Version v1 = new Version (1,2);
+ Version v2 = new Version (1,2,3);
+ Version v3 = new Version (1,2,3,4);
+
+ AssertEquals ("A1", "1.2", v1.ToString ());
+ AssertEquals ("A2", "1.2.3", v2.ToString ());
+ AssertEquals ("A3", "1.2.3.4", v3.ToString ());
+
+ AssertEquals ("A4", "" , v3.ToString (0));
+ AssertEquals ("A5", "1" , v3.ToString (1));
+ AssertEquals ("A6", "1.2" , v3.ToString (2));
+ AssertEquals ("A7", "1.2.3" , v3.ToString (3));
+ AssertEquals ("A8", "1.2.3.4" , v3.ToString (4));
+
+ bool exception;
+
+ try {
+ v2.ToString (4);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A9", exception);
+
+ try {
+ v3.ToString (42);
+ exception = false;
+ }
+ catch (ArgumentException) {
+ exception = true;
+ }
+ Assert ("A10", exception);
+ }
+
+}
+
+}
diff --git a/mcs/class/corlib/Test/TheTests.cs b/mcs/class/corlib/Test/TheTests.cs
new file mode 100755
index 00000000000..f0ca5b3387c
--- /dev/null
+++ b/mcs/class/corlib/Test/TheTests.cs
@@ -0,0 +1,560 @@
+using NUnit.Framework;
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace MonoTests.System
+{
+ public class RunArrayTest : ArrayTest
+ {
+ protected override void RunTest ()
+ {
+ TestIsFixedSize ();
+ TestIsReadOnly ();
+ TestIsSynchronized ();
+ TestLength ();
+ TestRank ();
+ TestBinarySearch1 ();
+ TestBinarySearch2 ();
+ TestClear ();
+ TestClone ();
+ TestCopy ();
+ TestCopy2 ();
+ TestCopyTo ();
+ TestCreateInstance ();
+ TestGetEnumerator ();
+ TestGetLength ();
+ TestGetLowerBound ();
+ TestGetUpperBound ();
+ TestGetValue1 ();
+ TestGetValue2 ();
+ TestGetValue3 ();
+ TestGetValueN ();
+ TestIndexOf1 ();
+ TestIndexOf2 ();
+ TestIndexOf3 ();
+ TestLastIndexOf1 ();
+ TestLastIndexOf2 ();
+ TestLastIndexOf3 ();
+ TestReverse ();
+ TestSetValue1 ();
+ TestSetValue2 ();
+ TestSetValue3 ();
+ TestSetValueN ();
+ TestSetValue4 ();
+ TestSort ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunBitConverterTest : BitConverterTest
+ {
+ protected override void RunTest ()
+ {
+ TestIsLittleEndian ();
+ TestSingle ();
+ TestDouble ();
+ TestBool ();
+ TestChar ();
+ TestInt16 ();
+ TestUInt16 ();
+ TestInt32 ();
+ TestUInt32 ();
+ TestInt64 ();
+ TestUInt64 ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunBooleanTest : BooleanTest
+ {
+ protected override void RunTest ()
+ {
+ TestStrings ();
+ TestCompareTo ();
+ TestEquals ();
+ TestGetHashCode ();
+ TestGetType ();
+ TestGetTypeCode ();
+ TestParse ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunByteTest : ByteTest
+ {
+ protected override void RunTest ()
+ {
+ TestMinMax ();
+ TestCompareTo ();
+ TestEquals ();
+ TestGetHashCode ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunCharTest : CharTest
+ {
+ protected override void RunTest ()
+ {
+ TestCompareTo ();
+ TestEquals ();
+ TestGetHashValue ();
+ TestGetNumericValue ();
+ TestGetUnicodeCategory ();
+ TestIsControl ();
+ TestIsDigit ();
+ TestIsLetter ();
+ TestIsLetterOrDigit ();
+ TestIsLower ();
+ TestIsNumber ();
+ TestIsPunctuation ();
+ TestIsSeparator ();
+ TestIsSurrogate ();
+ TestIsSymbol ();
+ TestIsUpper ();
+ TestIsWhiteSpace ();
+ TestParse ();
+ TestToLower ();
+ TestToUpper ();
+ TestToString ();
+ TestGetTypeCode ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunConsoleTest : ConsoleTest
+ {
+ protected override void RunTest ()
+ {
+ TestError ();
+ TestIn ();
+ TestOut ();
+ TestOpenStandardError ();
+ TestOpenStandardInput ();
+ TestOpenStandardOutput ();
+ TestRead ();
+ TestReadLine ();
+ TestSetError ();
+ TestSetIn ();
+ TestSetOut ();
+ TestWrite ();
+ TestWriteLine ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunEnumTest : EnumTest
+ {
+ protected override void RunTest ()
+ {
+ TestCompareTo ();
+ TestEquals ();
+ TestFormat ();
+ TestGetHashCode ();
+ TestGetNames ();
+ TestGetTypeCode ();
+ TestGetUnderlyingType ();
+ TestGetValues ();
+ TestIsDefined ();
+ TestParse1 ();
+ TestParse2 ();
+ TestToObject ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunDecimalTest : DecimalTest
+ {
+ protected override void RunTest ()
+ {
+ TestToString ();
+ TestCurrencyPattern ();
+ TestNumberNegativePattern ();
+ TestPercentPattern ();
+ TestParse ();
+ TestConstants ();
+ TestConstructInt32 ();
+ TestConstructUInt32 ();
+ TestConstructInt64 ();
+ TestConstructUInt64 ();
+ TestConstructSingle ();
+ TestConstructSingleRounding ();
+ TestConstructDouble ();
+ TestConstructDoubleRound ();
+ TestNegate ();
+ TestPartConstruct ();
+ TestFloorTruncate ();
+ TestRound ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunDecimalTest2 : DecimalTest2
+ {
+ protected override void RunTest ()
+ {
+ TestCompare ();
+ TestRemainder ();
+ TestAdd ();
+ TestMult ();
+ TestDiv ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunGuidTest : GuidTest
+ {
+ protected override void RunTest ()
+ {
+ TestCtor1 ();
+ TestCtor2 ();
+ TestCtor4 ();
+ TestCtor5 ();
+ TestEmpty ();
+ TestNewGuid ();
+ TestEqualityOp ();
+ TestInequalityOp ();
+ TestEquals ();
+ TestCompareTo ();
+ TestGetHashCode ();
+ TestToByteArray ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunInt16Test : Int16Test
+ {
+ protected override void RunTest ()
+ {
+ TestMinMax ();
+ TestCompareTo ();
+ TestEquals ();
+ TestGetHashCode ();
+ TestParse ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunInt32Test : Int32Test
+ {
+ protected override void RunTest ()
+ {
+ TestMinMax ();
+ TestCompareTo ();
+ TestEquals ();
+ TestGetHashCode ();
+ TestParse ();
+ TestToString ();
+ TestCustomToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunInt64Test : Int64Test
+ {
+ protected override void RunTest ()
+ {
+ TestMinMax ();
+ TestCompareTo ();
+ TestEquals ();
+ TestGetHashCode ();
+ TestRoundTripGeneral ();
+ TestRoundTripHex ();
+ TestParseNull ();
+ TestParse ();
+ TestToString ();
+ TestUserCurrency ();
+ TestUserPercent ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunObjectTest : ObjectTest
+ {
+ protected override void RunTest ()
+ {
+ TestCtor ();
+ TestEquals1 ();
+ TestEquals2 ();
+ TestGetHashCode ();
+ TestGetType ();
+ TestReferenceEquals ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunResolveEventArgsTest : ResolveEventArgsTest
+ {
+ protected override void RunTest ()
+ {
+ TestTheWholeThing ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunStringTest : StringTest
+ {
+ protected override void RunTest ()
+ {
+ TestLength ();
+ TestCompare ();
+ TestCompareOrdinal ();
+ TestCompareTo ();
+ TestConcat ();
+ TestCopy ();
+ TestCopyTo ();
+ TestEndsWith ();
+ TestEquals ();
+ TestFormat ();
+ TestGetEnumerator ();
+ TestGetHashCode ();
+ TestGetType ();
+ TestGetTypeCode ();
+ TestIndexOf ();
+ TestIndexOfAny ();
+ TestInsert ();
+ TestIntern ();
+ TestIsInterned ();
+ TestJoin ();
+ TestLastIndexOf ();
+ TestLastIndexOfAny ();
+ TestPadLeft ();
+ TestPadRight ();
+ TestRemove ();
+ TestReplace ();
+ TestSplit ();
+ TestStartsWith ();
+ TestSubstring ();
+ TestToCharArray ();
+ TestToLower ();
+ TestToString ();
+ TestToUpper ();
+ TestTrim ();
+ TestTrimEnd ();
+ TestTrimStart ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunTimeSpanTest : TimeSpanTest
+ {
+ protected override void RunTest ()
+ {
+ TestCtors ();
+ TestProperties ();
+ TestAdd ();
+ TestCompare ();
+ TestNegateAndDuration ();
+ TestEquals ();
+ TestFromXXXX ();
+ TestGetHashCode ();
+ TestParse ();
+ TestSubstract ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunUInt16Test : UInt16Test
+ {
+ protected override void RunTest ()
+ {
+ TestMinMax ();
+ TestCompareTo ();
+ TestEquals ();
+ TestGetHashCode ();
+ TestParse ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunUInt32Test : UInt32Test
+ {
+ protected override void RunTest ()
+ {
+ TestMinMax ();
+ TestCompareTo ();
+ TestEquals ();
+ TestGetHashCode ();
+ TestParse ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunUInt64Test : UInt64Test
+ {
+ protected override void RunTest ()
+ {
+ TestMinMax ();
+ TestCompareTo ();
+ TestEquals ();
+ TestGetHashCode ();
+ TestParse ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunDoubleTest : DoubleTest
+ {
+ protected override void RunTest ()
+ {
+ TestPublicFields ();
+ TestCompareTo ();
+ TestEquals ();
+ TestTypeCode ();
+ TestIsInfinity ();
+ TestIsNan ();
+ TestIsNegativeInfinity ();
+ TestIsPositiveInfinity ();
+ TestParse ();
+ TestToString ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunTimeZoneTest : TimeZoneTest
+ {
+ protected override void RunTest ()
+ {
+ TestCtors ();
+
+ }
+ }
+}
+
+namespace MonoTests.System
+{
+ public class RunDateTimeTest : DateTimeTest
+ {
+ protected override void RunTest ()
+ {
+ TestCtors ();
+ TestToString ();
+ TestParseExact ();
+ TestParse ();
+
+ }
+ }
+}
+
+namespace MonoTests
+{
+ public class RunAllTests
+ {
+ public static void AddAllTests (TestSuite suite)
+ {
+ suite.AddTest (new MonoTests.System.RunArrayTest ());
+ suite.AddTest (new MonoTests.System.RunBitConverterTest ());
+ suite.AddTest (new MonoTests.System.RunBooleanTest ());
+ suite.AddTest (new MonoTests.System.RunByteTest ());
+ suite.AddTest (new MonoTests.System.RunCharTest ());
+ suite.AddTest (new MonoTests.System.RunConsoleTest ());
+ suite.AddTest (new MonoTests.System.RunEnumTest ());
+ suite.AddTest (new MonoTests.System.RunDecimalTest ());
+ suite.AddTest (new MonoTests.System.RunDecimalTest2 ());
+ suite.AddTest (new MonoTests.System.RunGuidTest ());
+ suite.AddTest (new MonoTests.System.RunInt16Test ());
+ suite.AddTest (new MonoTests.System.RunInt32Test ());
+ suite.AddTest (new MonoTests.System.RunInt64Test ());
+ suite.AddTest (new MonoTests.System.RunObjectTest ());
+ suite.AddTest (new MonoTests.System.RunResolveEventArgsTest ());
+ suite.AddTest (new MonoTests.System.RunStringTest ());
+ suite.AddTest (new MonoTests.System.RunTimeSpanTest ());
+ suite.AddTest (new MonoTests.System.RunUInt16Test ());
+ suite.AddTest (new MonoTests.System.RunUInt32Test ());
+ suite.AddTest (new MonoTests.System.RunUInt64Test ());
+ suite.AddTest (new MonoTests.System.RunDoubleTest ());
+ suite.AddTest (new MonoTests.System.RunTimeZoneTest ());
+ suite.AddTest (new MonoTests.System.RunDateTimeTest ());
+ }
+ }
+}
+
+class MainApp
+{
+ public static void Main()
+ {
+ Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");
+
+ TestResult result = new TestResult ();
+ TestSuite suite = new TestSuite ();
+ MonoTests.RunAllTests.AddAllTests (suite);
+ suite.Run (result);
+ MonoTests.MyTestRunner.Print (result);
+ }
+}
+
diff --git a/mcs/class/corlib/Test/corlib_test.build b/mcs/class/corlib/Test/corlib_test.build
new file mode 100644
index 00000000000..4789f8cb473
--- /dev/null
+++ b/mcs/class/corlib/Test/corlib_test.build
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for corlib_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="corlib_test" default="build">
+ <property name="debug" value="true"/>
+ <property name="nunit_home" value="..\..\..\nunit"/>
+
+ <target name="build">
+ </target>
+
+ <target name="assemblies">
+ <csc target="library" output="corlib_test.dll" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="TheTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore.dll"/>
+ </references>
+ <arg value="/r:corlib_res.dll"/>
+ <arg value="/nowarn:1595"/>
+ </csc>
+
+ <csc target="library" output="corlib_reference.dll" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="TheTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore.dll"/>
+ </references>
+ <arg value="/nowarn:1595"/>
+ </csc>
+
+ <csc target="exe" output="RunTests.corlib.exe" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="System.Collections/StackTest.cs"/>
+ <excludes name="**/AllTests.cs"/>
+ <excludes name="**/MartinTests.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitBase.dll"/>
+ </references>
+ <arg value="/r:..\..\lib\corlib.dll"/>
+ <arg value="/r:..\..\lib\System.dll"/>
+ <arg value="/nowarn:1595"/>
+ <arg value="/nostdlib"/> <!-- don't reference mscorlib -->
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ </csc>
+
+ <csc target="library" output="corlib_linux_test.dll" debug="${debug}">
+ <sources>
+ <includes name="**/*.cs"/>
+ <excludes name="**/MartinTests.cs"/>
+ <excludes name="TheTests.cs"/>
+ <excludes name="System.Security.Policy/*.cs"/>
+ </sources>
+ <references basedir="..\..\..\nunit">
+ <includes name="NUnitCore_mono.dll"/>
+ </references>
+ <arg value="/r:..\..\lib\corlib.dll"/>
+ <arg value="/r:..\..\lib\System.dll"/>
+ <arg value="/nowarn:1595"/>
+ <arg value="/nostdlib"/> <!-- don't reference mscorlib -->
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ </csc>
+
+</target>
+
+
+ <target name="test" depends="assemblies">
+<!-- Do not run the unit tests with mono corlib on ms.net. With all the icalls the results provide no useful info -->
+<!-- Change this to be "mint NUnitConsole" or "mono NUnitConsole" when those are ready to be run on Windows -->
+<!-- <exec program="..\..\..\nunit\NUnitConsole" commandline="MonoTests.AllTests,corlib_test.dll" failonerror="false"/> -->
+ <exec program="..\..\..\nunit\NUnitConsole" commandline="MonoTests.AllTests,corlib_reference.dll" failonerror="false"/>
+ </target>
+
+ <target name="clean">
+ <delete file="corlib_test.dll" failonerror="false"/>
+ <delete file="RunTests.corlib.exe" failonerror="false"/>
+ <delete file="corlib_linux_test.dll" failonerror="false"/>
+ <delete file="corlib_reference.dll" failonerror="false"/>
+
+ <delete file="corlib_test.pdb" failonerror="false"/>
+ <delete file="RunTests.corlib.pdb" failonerror="false"/>
+ <delete file="corlib_linux_test.pdb" failonerror="false"/>
+ <delete file="corlib_reference.pdb" failonerror="false"/>
+
+ </target>
+</project>
diff --git a/mcs/class/corlib/Unix/Errno.cs b/mcs/class/corlib/Unix/Errno.cs
new file mode 100755
index 00000000000..36c3b4bc698
--- /dev/null
+++ b/mcs/class/corlib/Unix/Errno.cs
@@ -0,0 +1,139 @@
+//
+// Errno.cs: used to provide better information
+//
+
+namespace System.Private {
+
+ internal class Errno {
+
+ internal static string Message (int code)
+ {
+ switch (code){
+ case Wrapper.EPERM:
+ return "No permission";
+ case Wrapper.ENOENT:
+ return "The name does not exist";
+ case Wrapper.EISDIR:
+ return "error: Is a directory";
+ case Wrapper.EBADF:
+ return "Bad file descriptor";
+ case Wrapper.ENOMEM:
+ return "Out of memory";
+ case Wrapper.EEXIST:
+ return "File already exists";
+ case Wrapper.ENOTEMPTY:
+ return "Directory is not empty";
+
+ case Wrapper.ESRCH:
+ case Wrapper.EINTR:
+ case Wrapper.EIO:
+ case Wrapper.ENXIO:
+ case Wrapper.E2BIG:
+ case Wrapper.ENOEXEC:
+ case Wrapper.ECHILD:
+ case Wrapper.EAGAIN:
+ case Wrapper.EACCES:
+ case Wrapper.EFAULT:
+ case Wrapper.ENOTBLK:
+ case Wrapper.EBUSY:
+ case Wrapper.EXDEV:
+ case Wrapper.ENODEV:
+ case Wrapper.EINVAL:
+ case Wrapper.ENFILE:
+ case Wrapper.EMFILE:
+ case Wrapper.ENOTTY:
+ case Wrapper.ETXTBSY:
+ case Wrapper.EFBIG:
+ case Wrapper.ENOSPC:
+ case Wrapper.ESPIPE:
+ case Wrapper.EROFS:
+ case Wrapper.EMLINK:
+ case Wrapper.EPIPE:
+ case Wrapper.EDOM:
+ case Wrapper.ERANGE:
+ case Wrapper.EDEADLK:
+ case Wrapper.ENAMETOOLONG:
+ case Wrapper.ENOLCK:
+ case Wrapper.ENOSYS:
+ case Wrapper.ELOOP:
+ case Wrapper.ENOMSG:
+ case Wrapper.EIDRM:
+ case Wrapper.ECHRNG:
+ case Wrapper.EL2NSYNC:
+ case Wrapper.EL3HLT:
+ case Wrapper.EL3RST:
+ case Wrapper.ELNRNG:
+ case Wrapper.EUNATCH:
+ case Wrapper.ENOCSI:
+ case Wrapper.EL2HLT:
+ case Wrapper.EBADE:
+ case Wrapper.EBADR:
+ case Wrapper.EXFULL:
+ case Wrapper.ENOANO:
+ case Wrapper.EBADRQC:
+ case Wrapper.EBADSLT:
+ case Wrapper.EBFONT:
+ case Wrapper.ENOSTR:
+ case Wrapper.ENODATA:
+ case Wrapper.ETIME:
+ case Wrapper.ENOSR:
+ case Wrapper.ENONET:
+ case Wrapper.ENOPKG:
+ case Wrapper.EREMOTE:
+ case Wrapper.ENOLINK:
+ case Wrapper.EADV:
+ case Wrapper.ESRMNT:
+ case Wrapper.ECOMM:
+ case Wrapper.EPROTO:
+ case Wrapper.EMULTIHOP:
+ case Wrapper.EDOTDOT:
+ case Wrapper.EBADMSG:
+ case Wrapper.ENOTUNIQ:
+ case Wrapper.EBADFD:
+ case Wrapper.EREMCHG:
+ case Wrapper.ELIBACC:
+ case Wrapper.ELIBBAD:
+ case Wrapper.ELIBSCN:
+ case Wrapper.ELIBMAX:
+ case Wrapper.ELIBEXEC:
+ case Wrapper.EUSERS:
+ case Wrapper.ENOTSOCK:
+ case Wrapper.EDESTADDRREQ:
+ case Wrapper.EMSGSIZE:
+ case Wrapper.EPROTOTYPE:
+ case Wrapper.ENOPROTOOPT:
+ case Wrapper.EPROTONOSUPPORT:
+ case Wrapper.ESOCKTNOSUPPORT:
+ case Wrapper.EOPNOTSUPP:
+ case Wrapper.EPFNOSUPPORT:
+ case Wrapper.EAFNOSUPPORT:
+ case Wrapper.EADDRINUSE:
+ case Wrapper.EADDRNOTAVAIL:
+ case Wrapper.ENETDOWN:
+ case Wrapper.ENETUNREACH:
+ case Wrapper.ENETRESET:
+ case Wrapper.ECONNABORTED:
+ case Wrapper.ECONNRESET:
+ case Wrapper.ENOBUFS:
+ case Wrapper.EISCONN:
+ case Wrapper.ENOTCONN:
+ case Wrapper.ESHUTDOWN:
+ case Wrapper.ETOOMANYREFS:
+ case Wrapper.ETIMEDOUT:
+ case Wrapper.ECONNREFUSED:
+ case Wrapper.EHOSTDOWN:
+ case Wrapper.EHOSTUNREACH:
+ case Wrapper.EALREADY:
+ case Wrapper.EINPROGRESS:
+ case Wrapper.ESTALE:
+ case Wrapper.EDQUOT:
+ case Wrapper.ENOMEDIUM:
+ break;
+
+ case Wrapper.ENOTDIR:
+ return "Not a directory";
+ }
+ return String.Format ("Errno code={0}", code);
+ }
+ }
+}
diff --git a/mcs/class/corlib/Unix/Wrapper.cs b/mcs/class/corlib/Unix/Wrapper.cs
new file mode 100644
index 00000000000..76512a67223
--- /dev/null
+++ b/mcs/class/corlib/Unix/Wrapper.cs
@@ -0,0 +1,237 @@
+/*
+ * Generated automatically: do not edit this file.
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace System.Private {
+
+[CLSCompliant(false)]
+public struct stat {
+ public uint st_dev;
+ public uint st_mode;
+ public uint st_nlink;
+ public uint st_uid;
+ public uint st_gid;
+ public long st_size;
+ public uint st_atime;
+ public uint st_mtime;
+ public uint st_ctime;
+};
+
+public class Wrapper {
+
+ public const int SEEK_SET = 0;
+ public const int SEEK_CUR = 1;
+ public const int SEEK_END = 2;
+ public const int O_RDONLY = 0x00000000;
+ public const int O_WRONLY = 0x00000001;
+ public const int O_RDWR = 0x00000002;
+ public const int O_CREAT = 0x00000040;
+ public const int O_EXCL = 0x00000080;
+ public const int O_NOCTTY = 0x00000100;
+ public const int O_TRUNC = 0x00000200;
+ public const int O_SYNC = 0x00001000;
+ public const int O_APPEND = 0x00000400;
+ public const int STDIN_FILENO = 0x00000000;
+ public const int STDOUT_FILENO = 0x00000001;
+ public const int STDERR_FILENO = 0x00000002;
+ public const int S_IFMT = 0x0000f000;
+ public const int S_IFSOCK = 0x0000c000;
+ public const int S_IFLNK = 0x0000a000;
+ public const int S_IFREG = 0x00008000;
+ public const int S_IFBLK = 0x00006000;
+ public const int S_IFDIR = 0x00004000;
+ public const int S_IFCHR = 0x00002000;
+ public const int S_IFIFO = 0x00001000;
+ public const int S_ISUID = 0x00000800;
+ public const int S_ISGID = 0x00000400;
+ public const int S_ISVTX = 0x00000200;
+ public const int S_IRWXU = 0x000001c0;
+ public const int S_IRUSR = 0x00000100;
+ public const int S_IWUSR = 0x00000080;
+ public const int S_IXUSR = 0x00000040;
+ public const int S_IRWXG = 0x00000038;
+ public const int S_IRGRP = 0x00000020;
+ public const int S_IWGRP = 0x00000010;
+ public const int S_IXGRP = 0x00000008;
+ public const int S_IRWXO = 0x00000007;
+ public const int S_IROTH = 0x00000004;
+ public const int S_IWOTH = 0x00000002;
+ public const int S_IXOTH = 0x00000001;
+ public const int EPERM = 1;
+ public const int ENOENT = 2;
+ public const int ESRCH = 3;
+ public const int EINTR = 4;
+ public const int EIO = 5;
+ public const int ENXIO = 6;
+ public const int E2BIG = 7;
+ public const int ENOEXEC = 8;
+ public const int EBADF = 9;
+ public const int ECHILD = 10;
+ public const int EAGAIN = 11;
+ public const int ENOMEM = 12;
+ public const int EACCES = 13;
+ public const int EFAULT = 14;
+ public const int ENOTBLK = 15;
+ public const int EBUSY = 16;
+ public const int EEXIST = 17;
+ public const int EXDEV = 18;
+ public const int ENODEV = 19;
+ public const int EISDIR = 21;
+ public const int EINVAL = 22;
+ public const int ENFILE = 23;
+ public const int EMFILE = 24;
+ public const int ENOTTY = 25;
+ public const int ETXTBSY = 26;
+ public const int EFBIG = 27;
+ public const int ENOSPC = 28;
+ public const int ESPIPE = 29;
+ public const int EROFS = 30;
+ public const int EMLINK = 31;
+ public const int EPIPE = 32;
+ public const int EDOM = 33;
+ public const int ERANGE = 34;
+ public const int EDEADLK = 35;
+ public const int ENAMETOOLONG = 36;
+ public const int ENOLCK = 37;
+ public const int ENOSYS = 38;
+ public const int ENOTEMPTY = 39;
+ public const int ELOOP = 40;
+ public const int EWOULDBLOCK = 11;
+ public const int ENOMSG = 42;
+ public const int EIDRM = 43;
+ public const int ECHRNG = 44;
+ public const int EL2NSYNC = 45;
+ public const int EL3HLT = 46;
+ public const int EL3RST = 47;
+ public const int ELNRNG = 48;
+ public const int EUNATCH = 49;
+ public const int ENOCSI = 50;
+ public const int EL2HLT = 51;
+ public const int EBADE = 52;
+ public const int EBADR = 53;
+ public const int EXFULL = 54;
+ public const int ENOANO = 55;
+ public const int EBADRQC = 56;
+ public const int EBADSLT = 57;
+ public const int EDEADLOCK = 35;
+ public const int EBFONT = 59;
+ public const int ENOSTR = 60;
+ public const int ENODATA = 61;
+ public const int ETIME = 62;
+ public const int ENOSR = 63;
+ public const int ENONET = 64;
+ public const int ENOPKG = 65;
+ public const int EREMOTE = 66;
+ public const int ENOLINK = 67;
+ public const int EADV = 68;
+ public const int ESRMNT = 69;
+ public const int ECOMM = 70;
+ public const int EPROTO = 71;
+ public const int EMULTIHOP = 72;
+ public const int EDOTDOT = 73;
+ public const int EBADMSG = 74;
+ public const int ENOTUNIQ = 76;
+ public const int EBADFD = 77;
+ public const int EREMCHG = 78;
+ public const int ELIBACC = 79;
+ public const int ELIBBAD = 80;
+ public const int ELIBSCN = 81;
+ public const int ELIBMAX = 82;
+ public const int ELIBEXEC = 83;
+ public const int EUSERS = 87;
+ public const int ENOTSOCK = 88;
+ public const int EDESTADDRREQ = 89;
+ public const int EMSGSIZE = 90;
+ public const int EPROTOTYPE = 91;
+ public const int ENOPROTOOPT = 92;
+ public const int EPROTONOSUPPORT = 93;
+ public const int ESOCKTNOSUPPORT = 94;
+ public const int EOPNOTSUPP = 95;
+ public const int EPFNOSUPPORT = 96;
+ public const int EAFNOSUPPORT = 97;
+ public const int EADDRINUSE = 98;
+ public const int EADDRNOTAVAIL = 99;
+ public const int ENETDOWN = 100;
+ public const int ENETUNREACH = 101;
+ public const int ENETRESET = 102;
+ public const int ECONNABORTED = 103;
+ public const int ECONNRESET = 104;
+ public const int ENOBUFS = 105;
+ public const int EISCONN = 106;
+ public const int ENOTCONN = 107;
+ public const int ESHUTDOWN = 108;
+ public const int ETOOMANYREFS = 109;
+ public const int ETIMEDOUT = 110;
+ public const int ECONNREFUSED = 111;
+ public const int EHOSTDOWN = 112;
+ public const int EHOSTUNREACH = 113;
+ public const int EALREADY = 114;
+ public const int EINPROGRESS = 115;
+ public const int ESTALE = 116;
+ public const int EDQUOT = 122;
+ public const int ENOMEDIUM = 123;
+ public const int ENOTDIR = 20;
+
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_seek", CharSet=CharSet.Ansi)]
+ public unsafe static extern long seek (IntPtr fd, long offset, int whence);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_mkdir", CharSet=CharSet.Ansi)]
+ public unsafe static extern int mkdir (string path, int mode);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_rmdir", CharSet=CharSet.Ansi)]
+ public unsafe static extern int rmdir (string path);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_read", CharSet=CharSet.Ansi)]
+ [CLSCompliant(false)]
+ public unsafe static extern int read (IntPtr fd, void * buf, int count);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_write", CharSet=CharSet.Ansi)]
+ [CLSCompliant(false)]
+ public unsafe static extern int write (IntPtr fd, void * buf, int count);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_fstat", CharSet=CharSet.Ansi)]
+ [CLSCompliant(false)]
+ public unsafe static extern int fstat (IntPtr fd, stat * buf);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_ftruncate", CharSet=CharSet.Ansi)]
+ public unsafe static extern int ftruncate (IntPtr fd, long length);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_open", CharSet=CharSet.Ansi)]
+ public unsafe static extern IntPtr open (string path, int flags, int mode);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_close", CharSet=CharSet.Ansi)]
+ public unsafe static extern int close (IntPtr fd);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_stat", CharSet=CharSet.Ansi)]
+ [CLSCompliant(false)]
+ public unsafe static extern int stat (string path, stat * buf);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_unlink", CharSet=CharSet.Ansi)]
+ public unsafe static extern int unlink (string path);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_opendir", CharSet=CharSet.Ansi)]
+ public unsafe static extern IntPtr opendir (string path);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_readdir", CharSet=CharSet.Ansi)]
+ public unsafe static extern string readdir (IntPtr dir);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_closedir", CharSet=CharSet.Ansi)]
+ public unsafe static extern int closedir (IntPtr dir);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_getenv", CharSet=CharSet.Ansi)]
+ public unsafe static extern IntPtr getenv (string variable);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_environ", CharSet=CharSet.Ansi)]
+ public unsafe static extern IntPtr environ ();
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_rename", CharSet=CharSet.Ansi)]
+ public unsafe static extern int rename (string source, string target);
+
+ [DllImport("monowrapper", EntryPoint="mono_wrapper_utime", CharSet=CharSet.Ansi)]
+ public unsafe static extern int utime (string path, int atime, int mtime);
+}
+}
diff --git a/mcs/class/corlib/Unix/common.src b/mcs/class/corlib/Unix/common.src
new file mode 100644
index 00000000000..14f9533ef75
--- /dev/null
+++ b/mcs/class/corlib/Unix/common.src
@@ -0,0 +1 @@
+Wrapper.cs \ No newline at end of file
diff --git a/mcs/class/corlib/Unix/mono.src b/mcs/class/corlib/Unix/mono.src
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mcs/class/corlib/Unix/mono.src
diff --git a/mcs/class/corlib/Unix/windows.src b/mcs/class/corlib/Unix/windows.src
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/mcs/class/corlib/Unix/windows.src
diff --git a/mcs/class/corlib/Windows/Windows.cs b/mcs/class/corlib/Windows/Windows.cs
new file mode 100644
index 00000000000..891c26f0b68
--- /dev/null
+++ b/mcs/class/corlib/Windows/Windows.cs
@@ -0,0 +1,694 @@
+/*---------------------------------------------------------------------
+
+ XX X XXX
+ XX XX
+ XXX XX XXX XXXXX XX
+ XX XXX XX XX XX
+ XX XX XX XX XXXXX XX
+ XX XX XX XX XX XX X XX
+ XXXX XX XX XXX XXXXXXX XXXX
+ XX
+ XXXXX
+
+Copyright (c) 2001 Intel Corporation. All Rights Reserved.
+
+CREATED: August 15, 2001
+OWNER: Scott D Smith, Joel Marcey
+VERSION: 1.0
+---------------------------------------------------------------------*/
+
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.IO;
+using System.Collections;
+
+namespace System.PAL
+{
+ /// <summary>
+ /// Class that implements IOperatingSystem, providing the requested functionality through calls into APIs available in Windows (this class is a work in progress).
+ /// </summary>
+ internal class OpSys
+ {
+
+ //OS Calls (P/Invoke)
+
+
+ /*DWORD GetFullPathName(
+ LPCTSTR lpFileName, // file name
+ DWORD nBufferLength, // size of path buffer
+ LPTSTR lpBuffer, // path buffer
+ LPTSTR *lpFilePart // address of file name in path
+ );*/
+
+ [DllImport("kernel32.dll")]
+ private static extern uint GetFullPathName(string path, uint bufLength, System.Text.StringBuilder buffer, ref System.Text.StringBuilder fNameAddr);
+
+ /*UINT GetTempFileName(
+ LPCTSTR lpPathName, // directory name
+ LPCTSTR lpPrefixString, // file name prefix
+ UINT uUnique, // integer
+ LPTSTR lpTempFileName // file name buffer
+ );*/
+
+ [DllImport("kernel32.dll")]
+ private static extern uint GetTempFileName(string path, string prefix, uint unique, System.Text.StringBuilder buffer);
+
+ /*DWORD GetTempPath(
+ DWORD nBufferLength, // size of buffer
+ LPTSTR lpBuffer // path buffer
+ );*/
+
+ [DllImport("kernel32.dll")]
+ private static extern int GetTempPath(int bufferLength, System.Text.StringBuilder buffer);
+
+
+
+
+ // Class Constants
+
+ private const int EOF = -1; // In stdio.h, EOF is defined as -1
+
+
+
+ // For StdInputStream and StdOutputStream
+
+ private const int STDOUT = 1; // In stdio.h, the handle to standard out is 1
+ private const int STDIN = 0; // In stdio.h, the standard input handle is defined as 0. Will this always be true?
+
+
+ // Class Fields
+
+ private static bool isNextCharacterResidualNewline = false;
+ private static byte residualNewlineByte = 0;
+
+
+
+ // Class Constructor
+
+ public OpSys()
+ {
+ }
+
+
+ // System.Environment Services
+
+ public string NewLineSequence
+ {
+ get
+ {
+ return "\r\n";
+ }
+ }
+
+ public char DirectorySeparator
+ {
+ get
+ {
+ return (char) 0x005C; // This is a \
+ }
+ }
+
+ public char AltDirectorySeparator
+ {
+ get
+ {
+ return (char) 0x002F; // This is a /
+ }
+ }
+
+ public char VolumeSeparator
+ {
+ get
+ {
+ return (char) 0x003A; // This is a :
+ }
+ }
+
+ public char PathSeparator
+ {
+ get
+ {
+ return (char) 0x003B; // This is a ;
+ }
+ }
+
+ public char[] InvalidPathChars
+ {
+ get
+ {
+ char[] ipc = {'"', '<', '>', '|', '\0'};
+ return ipc;
+ }
+ }
+
+ public char[] DirVolSeparatorChars
+ {
+ get
+ {
+ char[] dsc = new char[] {this.DirectorySeparator, this.AltDirectorySeparator, this.VolumeSeparator};
+ return dsc;
+ }
+ }
+ public char ExtensionCharacter
+ {
+ get
+ {
+ return (char) 0x002E; // This is a .
+ }
+ }
+
+ public string GetEnvironmentVariable(string eVar)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetEnvironmentVariable(System.String): Stub Method");
+ // Call Windows API to get environment variable;
+ return null;
+ }
+
+ public string CommandLine
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public IDictionary EnvironmentVariables
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public string MachineName
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public OperatingSystem OSVersion
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ // System.Path services
+
+ public string ChangeExtension(string path, string extension)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:ChangeExtension(System.String, System.String): Stub Method");
+ if (path == null || path.Equals(string.Empty))
+ {
+ return path;
+ }
+ if (!this.HasExtension(path) && extension != null)
+ {
+ return string.Concat(path, extension);
+ }
+ string pathNoExt = path.Substring(0, path.LastIndexOf(this.ExtensionCharacter));
+ // If extension is null, concat replaces it with string.Empty
+ return string.Concat(pathNoExt, extension);
+ }
+
+ public string GetExtension(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetExtension(System.String): Stub Method");
+ if (path == null)
+ {
+ return path;
+ }
+ if (!this.HasExtension(path))
+ {
+ return string.Empty;
+ }
+ // It has an extension
+ return path.Substring(path.LastIndexOf(this.ExtensionCharacter));
+ }
+
+ public string GetFileName(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetFileName(System.String): Stub Method");
+ if (path == null)
+ {
+ return null;
+ }
+ int dvLast = path.LastIndexOfAny(this.DirVolSeparatorChars);
+ if (dvLast == -1)
+ {
+ return path;
+ }
+ return dvLast + 1 == path.Length ? string.Empty : path.Substring(dvLast + 1);
+ }
+
+ public long FileLength(string path)
+ {
+ return 0;
+ }
+
+ public long FileLength(IntPtr handle)
+ {
+ return 0;
+ }
+
+ public string GetFileNameWithoutExtension(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetFileNameWithoutExtension(System.String): Stub Method");
+ return this.ChangeExtension(this.GetFileName(path), null);
+ }
+
+ // TODO: Windows: GetFullPath: Verify logic here. This seems TOO simplistic
+ public string GetFullPath(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetFullPath(System.String): Stub Method");
+ if (path == null)
+ {
+ return null;
+ }
+ // TODO: GetFullPath: What should the size of the buffer be?
+ System.Text.StringBuilder buffer = new System.Text.StringBuilder(256);
+ // Just temporary to pass in as final parameter
+ System.Text.StringBuilder temp = new System.Text.StringBuilder();
+ // TODO: GetFullPath: ECMA spec says that an ArgumentException is thrown if system can not retrieve the path. That does not seem right. Returning null for now
+ return GetFullPathName(path, (uint) buffer.Capacity, buffer, ref temp) != 0 ? buffer.ToString() : null;
+ }
+
+ public string GetPathRoot(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetPathRoot(System.String): Stub Method");
+ if (path == null)
+ {
+ return null;
+ }
+ // TODO: Windows: GetPathRoot: Check logic. Assuming that if there is not dir or vol separators in the first three characters, then relative.
+ int dvFirst = path.IndexOfAny(this.DirVolSeparatorChars, 0, 3);
+ if (dvFirst == -1)
+ {
+ return string.Empty;
+ }
+ if (dvFirst == 0 && path[dvFirst].Equals(this.VolumeSeparator))
+ {
+ return string.Empty;
+ }
+ return dvFirst == 1 && path[dvFirst].Equals(this.VolumeSeparator) && (path[dvFirst+1].Equals(this.DirectorySeparator) || path[dvFirst+1].Equals(this.AltDirectorySeparator)) ? path.Substring(0, dvFirst+2) : path.Substring(0, dvFirst+1);
+
+ }
+
+ public string GetTempFileName()
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetTempFileName(): Stub Method");
+ string tPath = this.GetTempPath();
+ string prefix = "tmp";
+ // TODO: Windows: GetTempFileName: Remove System once our implementation of StringBuilder is done. Same for parameter to P/Invoke
+ // TODO: Windows: GetTempFileName: What is the proper length?
+ System.Text.StringBuilder buffer = new System.Text.StringBuilder(256);
+ // TODO: Windows: GetTempFileName: If an error is returned, what should we do? Right now return null;
+ return GetTempFileName(tPath, prefix, 0, buffer) != 0 ? buffer.ToString() : null;
+ }
+
+ public string GetTempPath()
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:GetTempPath(): Stub Method");
+ // TODO: Windows: GetTempPath: Remove System once our implementation of StringBuilder is done. Same for parameter to P/Invoke
+ // According to docs, LPTSTR maps to StringBuilder for In/Out
+ System.Text.StringBuilder buffer = new System.Text.StringBuilder(256);
+ // TODO: Windows: GetTempPath: What is the proper length?
+ // TODO: Windows: GetTempPath: If an error is returned, what should we do? Right now return null;
+ return GetTempPath(buffer.Capacity, buffer) != 0 ? buffer.ToString() : null;
+ }
+
+ public bool HasExtension(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:HasExtension(System.String): Stub Method");
+ int dvLast = path.LastIndexOfAny(this.DirVolSeparatorChars);
+ int exLast = path.LastIndexOf(this.ExtensionCharacter);
+ if (exLast > dvLast)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public bool IsPathRooted(string path)
+ {
+ //System.Diagnostics.Debug.WriteLine("Windows:IsPathRooted(System.String): Stub Method");
+ return (this.GetPathRoot(path) == null) || (this.GetPathRoot(path).Equals(string.Empty)) ? false : true;
+ }
+
+
+ // System.Directory service
+
+ public void DeleteDirectory(string path, bool recursive)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:DeleteDirectory(System.String, System.Boolean): Stub Method");
+ }
+
+ public bool ExistsDirectory(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:ExistsDirectory(System.String): Stub Method");
+ return false;
+ }
+
+ public DateTime GetCreationTimeDirectory(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetCreationTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public string GetCurrentDirectory()
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetCurrentDirectory(): Stub Method");
+ return null;
+ }
+
+ public string[] GetDirectories(string path, string searchPattern)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetDirectories(System.String,System.String): Stub Method");
+ return null;
+ }
+
+ public string[] GetFiles(string path, string searchPattern)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetFiles(System.String, System.String): Stub Method");
+ return null;
+ }
+
+ public string[] GetFileSystemEntries(string path, string searchPattern)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetFileSystemEntries(System.String, System.String): Stub Method");
+ return null;
+ }
+
+ public DateTime GetLastAccessTimeDirectory(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetLastAccessTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public DateTime GetLastWriteTimeDirectory(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetLastWriteTimeDirectory(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public void MoveDirectory(string sourceDirName, string destDirName)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:MoveDirectory(System.String, System.String): Stub Method");
+ }
+
+ public void SetCreationTimeDirectory(string path, DateTime creationTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetCreationTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetCurrentDirectory(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetCurrentDirectory(System.String): Stub Method");
+ }
+
+ public void SetLastAccessTimeDirectory(string path, DateTime lastAccessTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetLastAccessTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetLastWriteTimeDirectory(string path, DateTime lastWriteTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetLastWriteTimeDirectory(System.String, System.DateTime): Stub Method");
+ }
+
+
+ // I/O Services
+
+
+ public int ReadStdInput(byte[] buffer, int offset, int count)
+ {
+ return ReadFile(new IntPtr(STDIN), buffer, offset, count);
+ }
+
+ public void FlushStdOutput(byte[] byteBuf)
+ {
+ FlushFile (new IntPtr(STDOUT), byteBuf);
+ }
+
+ public unsafe int ReadFile(IntPtr handle, byte[] buffer, int offset, int count)
+ {
+ int res;
+
+ fixed (void *p = &buffer[offset]) {
+ res = _read(handle, p, count);
+ }
+ return res;
+ }
+
+ public unsafe int WriteFile(IntPtr handle, byte[] buffer, int offset, int count)
+ {
+ int res;
+
+ fixed (void *p = &buffer [offset]) {
+ res = _write(handle, p, count);
+ }
+ return res;
+ }
+
+ public int SetLengthFile(IntPtr handle, long length)
+ {
+ return _ftruncate (handle, (int)length);
+ }
+
+ public void FlushFile(IntPtr handle, byte[] byteBuf)
+ {
+ WriteFile (handle, byteBuf, 0, byteBuf.Length);
+ }
+
+ public IntPtr OpenFile(string path, FileMode mode, FileAccess access, FileShare share)
+ {
+ int flags = _getUnixFlags (mode, access);
+
+ return _open (path, flags, 0x1a4);
+ }
+
+ public void CloseFile(IntPtr handle)
+ {
+ _close (handle);
+ }
+
+ public long SeekFile(IntPtr handle, long offset, SeekOrigin origin)
+ {
+ switch (origin) {
+ case SeekOrigin.End:
+ return _lseek (handle, (int)offset, SEEK_END);
+ case SeekOrigin.Current:
+ return _lseek (handle, (int)offset, SEEK_CUR);
+ default:
+ return _lseek (handle, (int)offset, SEEK_SET);
+ }
+ }
+
+ public IntPtr CreateFile(string path, FileMode mode, FileAccess access, FileShare share)
+ {
+ return OpenFile(path, FileMode.CreateNew, access, share);
+ }
+
+ public void DeleteFile(string path)
+ {
+ _unlink(path);
+ }
+
+ public bool ExistsFile(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:ExistsFile(System.String): Stub Method");
+ return false;
+ }
+
+ public DateTime GetCreationTimeFile(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetCreationTimeFile(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public DateTime GetLastAccessTimeFile(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetLastAccessTimeFile(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public DateTime GetLastWriteTimeFile(string path)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:GetLastWriteFile(System.String): Stub Method");
+ return new DateTime(0);
+ }
+
+ public void SetCreationTimeFile(string path, DateTime creationTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetCreationTimeFile(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetLastAccessTimeFile(string path, DateTime lastAccessTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetLastAccessTimeFile(System.String, System.DateTime): Stub Method");
+ }
+
+ public void SetLastWriteTimeFile(string path, DateTime lastWriteTime)
+ {
+ System.Diagnostics.Debug.WriteLine("Windows:SetCLastWriteTimeFile(System.String, System.DateTime): Stub Method");
+ }
+
+ // DONE: Determine if this should be in a utility class
+ /// <summary>
+ /// Determines if a byte is part of the newline sequence
+ /// </summary>
+ /// <param name="c">The byte to compare</param>
+ /// <returns>A System.Boolean stating whether the byte is part of the newline</returns>
+ private static bool IsPartOfNewlineSequence(byte c)
+ {
+ char[] newLineArray = System.Environment.NewLine.ToCharArray();
+ for (int i = 0; i < newLineArray.Length; i++)
+ {
+ if (c == (byte) newLineArray[i]) // Or do I need Equals()
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Determines if a character is a newline character
+ /// </summary>
+ /// <param name="c">The character to check to see if it is a newline character</param>
+ /// <returns></returns>
+ public static bool IsPartOfNewlineSequence(char c)
+ {
+ // DONE: Determine if this method can be moved into TextReader or maybe a utility class (a class with a bunch of static methods...System.IO.IOUtility)
+ char[] newLineArray = System.Environment.NewLine.ToCharArray();
+ for (int i = 0; i < newLineArray.Length; i++)
+ {
+ if (c == newLineArray[i]) // TODO: Determine if .Equals() should be used here.
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ [ DllImport("msvcrt", EntryPoint="acos") ]
+ public extern static double Acos(double d);
+
+ [ DllImport("msvcrt", EntryPoint="asin") ]
+ public extern static double Asin(double d);
+
+ [ DllImport("msvcrt", EntryPoint="atan") ]
+ public extern static double Atan(double d);
+
+ [ DllImport("msvcrt", EntryPoint="atan2") ]
+ public extern static double Atan2(double y, double x);
+
+ [ DllImport("msvcrt", EntryPoint="cos") ]
+ public extern static double Cos(double d);
+
+ [ DllImport("msvcrt", EntryPoint="cosh") ]
+ public extern static double Cosh(double d);
+
+ [ DllImport("msvcrt", EntryPoint="exp") ]
+ public extern static double Exp(double d);
+
+ [ DllImport("msvcrt", EntryPoint="log") ]
+ public extern static double Log(double d);
+
+ [ DllImport("msvcrt", EntryPoint="log10") ]
+ public extern static double Log10(double d);
+
+ [ DllImport("msvcrt", EntryPoint="pow") ]
+ public extern static double Pow(double x, double y);
+
+ [ DllImport("msvcrt", EntryPoint="sin") ]
+ public extern static double Sin(double d);
+
+ [ DllImport("msvcrt", EntryPoint="sinh") ]
+ public extern static double Sinh(double d);
+
+ [ DllImport("msvcrt", EntryPoint="sqrt") ]
+ public extern static double Sqrt(double d);
+
+ [ DllImport("msvcrt", EntryPoint="tan") ]
+ public extern static double Tan(double d);
+
+ [ DllImport("msvcrt", EntryPoint="tanh") ]
+ public extern static double Tanh(double d);
+
+ [ DllImport("msvcrt", EntryPoint="_read", CharSet=CharSet.Ansi) ]
+ private unsafe static extern int _read(IntPtr fd, void *buf, int count);
+
+ [ DllImport("msvcrt", EntryPoint="_write", CharSet=CharSet.Ansi) ]
+ private unsafe static extern int _write(IntPtr fd, void *buf, int count);
+
+ [ DllImport("msvcrt", EntryPoint="_lseek", CharSet=CharSet.Ansi) ]
+ private unsafe static extern int _lseek(IntPtr fd, int offset, int whence);
+
+ [ DllImport("msvcrt", EntryPoint="_chsize", CharSet=CharSet.Ansi) ]
+ private unsafe static extern int _ftruncate (IntPtr fd, int count);
+
+ [ DllImport("msvcrt", EntryPoint="_close", CharSet=CharSet.Ansi) ]
+ private unsafe static extern void _close(IntPtr fd);
+
+ [ DllImport("msvcrt", EntryPoint="_open", CharSet=CharSet.Ansi) ]
+ private unsafe static extern IntPtr _open(string path, int flags, int mode);
+
+ [ DllImport("msvcrt", EntryPoint="_unlink", CharSet=CharSet.Ansi) ]
+ private unsafe static extern int _unlink(string path);
+
+ private const int O_RDONLY = 0x000;
+ private const int O_WRONLY = 0x001;
+ private const int O_RDWR = 0x002;
+ private const int O_CREAT = 0x040;
+ private const int O_EXCL = 0x080;
+ private const int O_TRUNC = 0x200;
+ private const int O_APPEND = 0x400;
+
+ private const int SEEK_SET = 0;
+ private const int SEEK_CUR = 1;
+ private const int SEEK_END = 2;
+
+ private int _getUnixFlags (FileMode mode, FileAccess access)
+ {
+ int flags = 0;
+ switch (access) {
+ case FileAccess.Read:
+ flags = O_RDONLY;
+ break;
+ case FileAccess.Write:
+ flags = O_WRONLY;
+ break;
+ case FileAccess.ReadWrite:
+ flags = O_RDWR;
+ break;
+ }
+
+ switch (mode) {
+ case FileMode.Append:
+ flags |= O_APPEND;
+ break;
+ case FileMode.Create:
+ flags |= O_CREAT;
+ break;
+ case FileMode.CreateNew:
+ flags |= O_CREAT | O_EXCL;
+ break;
+ case FileMode.Open:
+ break;
+ case FileMode.OpenOrCreate:
+ flags |= O_CREAT;
+ break;
+ case FileMode.Truncate:
+ flags |= O_TRUNC;
+ break;
+ }
+
+ return flags;
+ }
+ }
+}
diff --git a/mcs/class/corlib/corlib.build b/mcs/class/corlib/corlib.build
new file mode 100644
index 00000000000..766f9a87e6d
--- /dev/null
+++ b/mcs/class/corlib/corlib.build
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for corlib.dll -->
+<!-- Target windows builds libraries _for_ windows -->
+<!-- Target linux builds libraries _for_ linux -->
+
+<project name="corlib" default="build">
+ <property name="debug" value="true"/>
+
+ <target name="build">
+ <mkdir dir="../lib"/>
+ <csc target="library" output="../lib/corlib.dll" debug="${debug}">
+ <!-- keep in sync with corlib_cmp.dll below -->
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0649"/> <!-- field never assigned to -->
+ <arg value="/nowarn:0169"/> <!-- field never used -->
+ <arg value="/nowarn:0679"/> <!-- internal may be overriden -->
+ <arg value="/unsafe"/>
+
+ <arg value="/nostdlib"/> <!-- don't reference mscorlib -->
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+
+ <sources>
+ <includes name="**/*.cs"/>
+
+ <excludes name="Test/**"/>
+ <excludes name="System.Security.Permissions/SecurityPermissionAttribute.cs"/> <!-- custom security attributes problem -->
+
+ <excludes name="Unix/**"/>
+ <excludes name="Linux/**"/>
+ <excludes name="Windows/**"/>
+ <excludes name="System.PAL/**"/>
+ </sources>
+ </csc>
+ <csc target="library" output="../lib/corlib_cmp.dll" debug="${debug}">
+ <!-- This dll is used to compare with mscorlib -->
+ <!-- It should be the same as corlib.dll minus Object and ValueTyp -->
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0649"/> <!-- field never assigned to -->
+ <arg value="/nowarn:0169"/> <!-- field never used -->
+ <arg value="/nowarn:0679"/> <!-- internal may be overriden -->
+ <arg value="/unsafe"/>
+
+ <arg value="/nostdlib"/>
+ <arg value="/noconfig"/>
+ <arg value="/r:mscorlib.dll"/>
+
+ <sources>
+ <includes name="**/*.cs"/>
+
+ <excludes name="Test/**"/>
+ <excludes name="System.Security.Permissions/SecurityPermissionAttribute.cs"/>
+
+ <excludes name="Unix/**"/>
+ <excludes name="Linux/**"/>
+ <excludes name="Windows/**"/>
+ <excludes name="System.PAL/**"/>
+
+ <excludes name="System/Object.cs"/>
+ <excludes name="System/ValueType.cs"/>
+ <excludes name="System/Enum.cs"/>
+ <excludes name="System/Delegate.cs"/>
+ <excludes name="System/MulticastDelegate.cs"/>
+ <excludes name="System/Exception.cs"/>
+ </sources>
+ </csc>
+ <!-- NUnit can only run under windows right now, so build for windows
+ even though this is inside the linux target -->
+ <csc target="library" output="Test/corlib_res.dll" debug="${debug}">
+ <arg value="/nowarn:1595"/>
+ <arg value="/nowarn:0649"/> <!-- field never assigned to -->
+ <arg value="/nowarn:0169"/> <!-- field never used -->
+ <arg value="/nowarn:0679"/> <!-- internal may be overriden -->
+ <arg value="/unsafe"/>
+ <sources>
+ <includes name="**/*.cs"/>
+
+ <excludes name="Test/**"/>
+
+ <excludes name="Unix/**"/>
+ <excludes name="Linux/**"/>
+ <excludes name="Windows/**"/>
+ <excludes name="System.PAL/**"/>
+
+ <excludes name="System/Object.cs"/>
+ <excludes name="System/ValueType.cs"/>
+ <excludes name="System/Enum.cs"/>
+ <excludes name="System/Delegate.cs"/>
+ <excludes name="System/MulticastDelegate.cs"/>
+ <excludes name="System/Exception.cs"/>
+ <excludes name="System/Type.cs"/>
+ <excludes name="System/MonoType.cs"/>
+ <excludes name="System/Array.cs"/>
+ <excludes name="System/String.cs"/>
+ <excludes name="System/Console.cs"/>
+ <excludes name="System/AppDomain.cs"/>
+ <excludes name="System/RuntimeTypeHandle.cs"/>
+ <excludes name="System/ICloneable.cs"/>
+
+ <excludes name="System.Collections/Queue.cs"/>
+ <excludes name="System.Collections/ICollection.cs"/>
+ <excludes name="System.Collections/IEnumerator.cs"/>
+ <excludes name="System.Collections/IEnumerable.cs"/>
+ <excludes name="System.Collections/IList.cs"/>
+ <excludes name="System.PAL/IOperatingSystem.cs"/>
+ <excludes name="System.Reflection.Emit/**"/>
+ <excludes name="System.Runtime.CompilerServices/**"/>
+ <excludes name="System.Security.Permissions/SecurityPermissionAttribute.cs"/>
+ </sources>
+ </csc>
+ <nant basedir="Test" target="build"/>
+ </target>
+
+ <target name="test" depends="build">
+ <nant basedir="Test" target="test"/>
+ </target>
+
+ <target name="clean">
+ <delete file="../lib/corlib.dll" failonerror="false"/>
+ <delete file="../lib/corlib.pdb" failonerror="false"/>
+ <delete file="../lib/corlib_cmp.dll" failonerror="false"/>
+ <delete file="../lib/corlib_cmp.pdb" failonerror="false"/>
+ <delete file="Test/corlib_res.dll" failonerror="false"/>
+ <delete file="Test/corlib_res.pdb" failonerror="false"/>
+ <nant basedir="Test" target="clean"/>
+ </target>
+</project>
diff --git a/mcs/class/corlib/list b/mcs/class/corlib/list
new file mode 100755
index 00000000000..0924fb26534
--- /dev/null
+++ b/mcs/class/corlib/list
@@ -0,0 +1,587 @@
+--unsafe --nostdlib
+Linux/Linux.cs
+System.Collections/ArrayList.cs
+System.Collections/BitArray.cs
+System.Collections/CaseInsensitiveComparer.cs
+System.Collections/CaseInsensitiveHashCodeProvider.cs
+System.Collections/CollectionBase.cs
+System.Collections/Comparer.cs
+System.Collections/DictionaryBase.cs
+System.Collections/DictionaryEntry.cs
+System.Collections/Hashtable.cs
+System.Collections/ICollection.cs
+System.Collections/IComparer.cs
+System.Collections/IDictionary.cs
+System.Collections/IDictionaryEnumerator.cs
+System.Collections/IEnumerable.cs
+System.Collections/IEnumerator.cs
+System.Collections/IHashCodeProvider.cs
+System.Collections/IList.cs
+System.Collections/Queue.cs
+System.Collections/ReadOnlyCollectionBase.cs
+System.Collections/SortedList.cs
+System.Collections/Stack.cs
+System.Configuration.Assemblies/AssemblyHash.cs
+System.Configuration.Assemblies/AssemblyHashAlgorithm.cs
+System.Configuration.Assemblies/AssemblyVersionCompatibility.cs
+System.Configuration.Assemblies/ProcessorID.cs
+System.Diagnostics.SymbolStore/ISymbolBinder.cs
+System.Diagnostics.SymbolStore/ISymbolDocument.cs
+System.Diagnostics.SymbolStore/ISymbolDocumentWriter.cs
+System.Diagnostics.SymbolStore/ISymbolMethod.cs
+System.Diagnostics.SymbolStore/ISymbolNamespace.cs
+System.Diagnostics.SymbolStore/ISymbolReader.cs
+System.Diagnostics.SymbolStore/ISymbolScope.cs
+System.Diagnostics.SymbolStore/ISymbolVariable.cs
+System.Diagnostics.SymbolStore/ISymbolWriter.cs
+System.Diagnostics.SymbolStore/SymAddressKind.cs
+System.Diagnostics.SymbolStore/SymDocumentType.cs
+System.Diagnostics.SymbolStore/SymLanguageType.cs
+System.Diagnostics.SymbolStore/SymLanguageVendor.cs
+System.Diagnostics.SymbolStore/SymbolToken.cs
+System.Diagnostics/ConditionalAttribute.cs
+System.Diagnostics/DebuggableAttribute.cs
+System.Diagnostics/Debugger.cs
+System.Diagnostics/DebuggerHiddenAttribute.cs
+System.Diagnostics/DebuggerStepThroughAttribute.cs
+System.Diagnostics/StackFrame.cs
+System.Diagnostics/StackTrace.cs
+System.Globalization/Calendar.cs
+System.Globalization/CalendarWeekRule.cs
+System.Globalization/CompareOptions.cs
+System.Globalization/CultureInfo.cs
+System.Globalization/CultureTypes.cs
+System.Globalization/DateTimeFormatInfo.cs
+System.Globalization/DateTimeStyles.cs
+System.Globalization/DaylightTime.cs
+System.Globalization/GregorianCalendar.cs
+System.Globalization/GregorianCalendarTypes.cs
+System.Globalization/JulianCalendar.cs
+System.Globalization/Locale.cs
+System.Globalization/NumberFormatInfo.cs
+System.Globalization/NumberStyles.cs
+System.Globalization/RegionInfo.cs
+System.Globalization/UnicodeCategory.cs
+System.IO.IsolatedStorage/INormalizeForIsolatedStorage.cs
+System.IO.IsolatedStorage/IsolatedStorage.cs
+System.IO.IsolatedStorage/IsolatedStorageException.cs
+System.IO.IsolatedStorage/IsolatedStorageFileStream.cs
+System.IO.IsolatedStorage/IsolatedStorageScope.cs
+System.IO/BinaryReader.cs
+System.IO/BinaryWriter.cs
+System.IO/BufferedStream.cs
+System.IO/CheckArgument.cs
+System.IO/CheckPermission.cs
+System.IO/Directory.cs
+System.IO/DirectoryInfo.cs
+System.IO/DirectoryNotFoundException.cs
+System.IO/EndOfStreamException.cs
+System.IO/File.cs
+System.IO/FileAccess.cs
+System.IO/FileAttributes.cs
+System.IO/FileInfo.cs
+System.IO/FileLoadException.cs
+System.IO/FileMode.cs
+System.IO/FileNotFoundException.cs
+System.IO/FileShare.cs
+System.IO/FileStream.cs
+System.IO/FileSystemInfo.cs
+System.IO/IOException.cs
+System.IO/MemoryStream.cs
+System.IO/Path.cs
+System.IO/PathTooLongException.cs
+System.IO/SeekOrigin.cs
+System.IO/Stream.cs
+System.IO/StreamReader.cs
+System.IO/StreamWriter.cs
+System.IO/StringReader.cs
+System.IO/StringWriter.cs
+System.IO/TextReader.cs
+System.IO/TextWriter.cs
+System.PAL/Platform.cs
+System.Reflection.Emit/AssemblyBuilder.cs
+System.Reflection.Emit/AssemblyBuilderAccess.cs
+System.Reflection.Emit/ConstructorBuilder.cs
+System.Reflection.Emit/CustomAttributeBuilder.cs
+System.Reflection.Emit/EnumBuilder.cs
+System.Reflection.Emit/EventBuilder.cs
+System.Reflection.Emit/EventToken.cs
+System.Reflection.Emit/FieldBuilder.cs
+System.Reflection.Emit/FieldToken.cs
+System.Reflection.Emit/FlowControl.cs
+System.Reflection.Emit/ILGenerator.cs
+System.Reflection.Emit/Label.cs
+System.Reflection.Emit/LocalBuilder.cs
+System.Reflection.Emit/MethodBuilder.cs
+System.Reflection.Emit/MethodToken.cs
+System.Reflection.Emit/ModuleBuilder.cs
+System.Reflection.Emit/OpCode.cs
+System.Reflection.Emit/OpCodeType.cs
+System.Reflection.Emit/OpCodes.cs
+System.Reflection.Emit/OperandType.cs
+System.Reflection.Emit/PEFileKinds.cs
+System.Reflection.Emit/PackingSize.cs
+System.Reflection.Emit/ParameterBuilder.cs
+System.Reflection.Emit/ParameterToken.cs
+System.Reflection.Emit/PropertyBuilder.cs
+System.Reflection.Emit/PropertyToken.cs
+System.Reflection.Emit/SignatureHelper.cs
+System.Reflection.Emit/SignatureToken.cs
+System.Reflection.Emit/StackBehaviour.cs
+System.Reflection.Emit/StringToken.cs
+System.Reflection.Emit/TypeBuilder.cs
+System.Reflection.Emit/TypeToken.cs
+System.Reflection.Emit/UnmanagedMarshal.cs
+System.Reflection/AmbiguousMatchException.cs
+System.Reflection/Assembly.cs
+System.Reflection/AssemblyAlgorithmIdAttribute.cs
+System.Reflection/AssemblyCompanyAttribute.cs
+System.Reflection/AssemblyConfigurationAttribute.cs
+System.Reflection/AssemblyCopyrightAttribute.cs
+System.Reflection/AssemblyCultureAttribute.cs
+System.Reflection/AssemblyDefaultAliasAttribute.cs
+System.Reflection/AssemblyDelaySignAttribute.cs
+System.Reflection/AssemblyDescriptionAttribute.cs
+System.Reflection/AssemblyFileVersionAttribute.cs
+System.Reflection/AssemblyFlagsAttribute.cs
+System.Reflection/AssemblyInformationalVersionAttribute.cs
+System.Reflection/AssemblyKeyFileAttribute.cs
+System.Reflection/AssemblyKeyNameAttribute.cs
+System.Reflection/AssemblyName.cs
+System.Reflection/AssemblyNameFlags.cs
+System.Reflection/AssemblyNameProxy.cs
+System.Reflection/AssemblyProductAttribute.cs
+System.Reflection/AssemblyTitleAttribute.cs
+System.Reflection/AssemblyTradeMarkAttribute.cs
+System.Reflection/AssemblyVersionAttribute.cs
+System.Reflection/Binder.cs
+System.Reflection/BindingFlags.cs
+System.Reflection/CallingConventions.cs
+System.Reflection/ConstructorInfo.cs
+System.Reflection/CustomAttributeFormatException.cs
+System.Reflection/DefaultMemberAttribute.cs
+System.Reflection/EventAttributes.cs
+System.Reflection/EventInfo.cs
+System.Reflection/FieldAttributes.cs
+System.Reflection/FieldInfo.cs
+System.Reflection/ICustomAttributeProvider.cs
+System.Reflection/IReflect.cs
+System.Reflection/InterfaceMapping.cs
+System.Reflection/InvalidFilterCriteriaException.cs
+System.Reflection/ManifestResourceInfo.cs
+System.Reflection/MemberFilter.cs
+System.Reflection/MemberInfo.cs
+System.Reflection/MemberTypes.cs
+System.Reflection/MethodAttributes.cs
+System.Reflection/MethodBase.cs
+System.Reflection/MethodImplAttributes.cs
+System.Reflection/MethodInfo.cs
+System.Reflection/Missing.cs
+System.Reflection/Module.cs
+System.Reflection/MonoField.cs
+System.Reflection/MonoMethod.cs
+System.Reflection/MonoProperty.cs
+System.Reflection/ParameterAttributes.cs
+System.Reflection/ParameterInfo.cs
+System.Reflection/ParameterModifier.cs
+System.Reflection/PropertyAttributes.cs
+System.Reflection/PropertyInfo.cs
+System.Reflection/ReflectionTypeLoadException.cs
+System.Reflection/ResourceAttributes.cs
+System.Reflection/ResourceLocation.cs
+System.Reflection/StrongNameKeyPair.cs
+System.Reflection/TargetException.cs
+System.Reflection/TargetInvocationException.cs
+System.Reflection/TargetParameterCountException.cs
+System.Reflection/TypeAttributes.cs
+System.Reflection/TypeDelegator.cs
+System.Reflection/TypeFilter.cs
+System.Resources/IResourceReader.cs
+System.Resources/IResourceWriter.cs
+System.Resources/MissingManifestResourceException.cs
+System.Resources/NeutralResoucesLanguageAttribute.cs
+System.Resources/ResourceManager.cs
+System.Resources/ResourceReader.cs
+System.Resources/ResourceSet.cs
+System.Resources/ResourceWriter.cs
+System.Resources/SatelliteContractVersionAttribute.cs
+System.Runtime.CompilerServices/IndexerNameAttribute.cs
+System.Runtime.CompilerServices/MethodCodeType.cs
+System.Runtime.CompilerServices/MethodImplAttribute.cs
+System.Runtime.CompilerServices/MethodImplOptions.cs
+System.Runtime.CompilerServices/RuntimeHelpers.cs
+System.Runtime.InteropServices/AssemblyRegistrationFlags.cs
+System.Runtime.InteropServices/CallingConvention.cs
+System.Runtime.InteropServices/CharSet.cs
+System.Runtime.InteropServices/ComInterfaceType.cs
+System.Runtime.InteropServices/DllImportAttribute.cs
+System.Runtime.InteropServices/ExporterEventKind.cs
+System.Runtime.InteropServices/ExternalException.cs
+System.Runtime.InteropServices/FieldOffsetAttribute.cs
+System.Runtime.InteropServices/GCHandle.cs
+System.Runtime.InteropServices/GCHandleType.cs
+System.Runtime.InteropServices/GuidAttribute.cs
+System.Runtime.InteropServices/ICustomAdapter.cs
+System.Runtime.InteropServices/ICustomFactory.cs
+System.Runtime.InteropServices/ICustomMarshaler.cs
+System.Runtime.InteropServices/IRegistrationServices.cs
+System.Runtime.InteropServices/ITypeLibConverter.cs
+System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs
+System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs
+System.Runtime.InteropServices/ITypeLibImporterNotifySink.cs
+System.Runtime.InteropServices/ImporterEventKind.cs
+System.Runtime.InteropServices/InAttribute.cs
+System.Runtime.InteropServices/InterfaceTypeAttribute.cs
+System.Runtime.InteropServices/LayoutKind.cs
+System.Runtime.InteropServices/Marshal.cs
+System.Runtime.InteropServices/MarshalAsAttribute.cs
+System.Runtime.InteropServices/OptionalAttribute.cs
+System.Runtime.InteropServices/OutAttribute.cs
+System.Runtime.InteropServices/PInvokeMap.cs
+System.Runtime.InteropServices/StructLayoutAttribute.cs
+System.Runtime.InteropServices/TypeLibExporterFlags.cs
+System.Runtime.InteropServices/UnmanagedType.cs
+System.Runtime.InteropServices/VarEnum.cs
+System.Runtime.Remoting.Activation/ActivatorLevel.cs
+System.Runtime.Remoting.Activation/IActivator.cs
+System.Runtime.Remoting.Activation/IConstructionCallMessage.cs
+System.Runtime.Remoting.Activation/IConstructionReturnMessage.cs
+System.Runtime.Remoting.Contexts/Context.cs
+System.Runtime.Remoting.Contexts/ContextAttribute.cs
+System.Runtime.Remoting.Contexts/IContextAttribute.cs
+System.Runtime.Remoting.Contexts/IContextProperty.cs
+System.Runtime.Remoting.Contexts/IDynamicMessageSink.cs
+System.Runtime.Remoting.Contexts/IDynamicProperty.cs
+System.Runtime.Remoting.Contexts/SynchronizationAttribute.cs
+System.Runtime.Remoting.Messaging/Header.cs
+System.Runtime.Remoting.Messaging/IMessage.cs
+System.Runtime.Remoting.Messaging/IMethodMessage.cs
+System.Runtime.Remoting.Messaging/IMethodReturnMessage.cs
+System.Runtime.Remoting.Messaging/LogicalCallContext.cs
+System.Runtime.Remoting.Messaging/IMessageSink.cs
+System.Runtime.Remoting.Messaging/IMessageCtrl.cs
+System.Runtime.Remoting/LeaseState.cs
+System.Runtime.Remoting/ObjRef.cs
+System.Runtime.Remoting/ObjectHandle.cs
+System.Runtime.Remoting/SoapMethodOption.cs
+System.Runtime.Remoting/SoapOption.cs
+System.Runtime.Remoting/WellKnownObjectMode.cs
+System.Runtime.Serialization.Formatters.Binary/BinaryArrayTypeEnum.cs
+System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.cs
+System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.cs
+System.Runtime.Serialization.Formatters/FormatterTypeStyle.cs
+System.Runtime.Serialization.Formatters/IFieldInfo.cs
+System.Runtime.Serialization.Formatters/ISoapMessage.cs
+System.Runtime.Serialization.Formatters/InternalArrayTypeE.cs
+System.Runtime.Serialization.Formatters/InternalElementTypeE.cs
+System.Runtime.Serialization.Formatters/InternalMemberTypeE.cs
+System.Runtime.Serialization.Formatters/InternalMemberValueE.cs
+System.Runtime.Serialization.Formatters/InternalNameSpaceE.cs
+System.Runtime.Serialization.Formatters/InternalObjectPositionE.cs
+System.Runtime.Serialization.Formatters/InternalObjectTypeE.cs
+System.Runtime.Serialization.Formatters/InternalParseStateE.cs
+System.Runtime.Serialization.Formatters/InternalParseTypeE.cs
+System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.cs
+System.Runtime.Serialization.Formatters/InternalSerializerTypeE.cs
+System.Runtime.Serialization/IDeserializationCallback.cs
+System.Runtime.Serialization/IFormatter.cs
+System.Runtime.Serialization/IFormatterConverter.cs
+System.Runtime.Serialization/IObjectReference.cs
+System.Runtime.Serialization/ISerializable.cs
+System.Runtime.Serialization/ISerializationSurrogate.cs
+System.Runtime.Serialization/ISurrogateSelector.cs
+System.Runtime.Serialization/SerializationBinder.cs
+System.Runtime.Serialization/SerializationEntry.cs
+System.Runtime.Serialization/SerializationException.cs
+System.Runtime.Serialization/SerializationInfo.cs
+System.Runtime.Serialization/SerializationInfoEnumerator.cs
+System.Runtime.Serialization/StreamingContext.cs
+System.Runtime.Serialization/StreamingContextStates.cs
+System.Runtime.Serialization/SurrogateSelector.cs
+System.Security.Cryptography/AsymmetricAlgorithm.cs
+System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.cs
+System.Security.Cryptography/AsymmetricKeyExchangeFormatter.cs
+System.Security.Cryptography/AsymmetricSignatureDeformatter.cs
+System.Security.Cryptography/AsymmetricSignatureFormatter.cs
+System.Security.Cryptography/CipherMode.cs
+System.Security.Cryptography/CryptoAPITransform.cs
+System.Security.Cryptography/CryptoStream.cs
+System.Security.Cryptography/CryptoStreamMode.cs
+System.Security.Cryptography/CryptographicException.cs
+System.Security.Cryptography/CryptographicUnexpectedOperationExcpetion.cs
+System.Security.Cryptography/CspParameters.cs
+System.Security.Cryptography/CspProviderFlags.cs
+System.Security.Cryptography/DES.cs
+System.Security.Cryptography/DESCryptoServiceProvider.cs
+System.Security.Cryptography/DSA.cs
+System.Security.Cryptography/DSACryptoServiceProvider.cs
+System.Security.Cryptography/DSAParameters.cs
+System.Security.Cryptography/DSASignatureDeformatter.cs
+System.Security.Cryptography/DSASignatureFormatter.cs
+System.Security.Cryptography/DeriveBytes.cs
+System.Security.Cryptography/FromBase64Transform.cs
+System.Security.Cryptography/HashAlgorithm.cs
+System.Security.Cryptography/ICryptoTransform.cs
+System.Security.Cryptography/KeySizes.cs
+System.Security.Cryptography/MD5.cs
+System.Security.Cryptography/MD5CryptoServiceProvider.cs
+System.Security.Cryptography/PaddingMode.cs
+System.Security.Cryptography/RNGCryptoServiceProvider.cs
+System.Security.Cryptography/RSA.cs
+System.Security.Cryptography/RSAParameters.cs
+System.Security.Cryptography/RandomNumberGenerator.cs
+System.Security.Cryptography/Rijndael.cs
+System.Security.Cryptography/RijndaelManaged.cs
+System.Security.Cryptography/SHA1.cs
+System.Security.Cryptography/SHA1CryptoServiceProvider.cs
+System.Security.Cryptography/SHA256.cs
+System.Security.Cryptography/SHA256Managed.cs
+System.Security.Cryptography/SHA384.cs
+System.Security.Cryptography/SHA384Managed.cs
+System.Security.Cryptography/SHA512.cs
+System.Security.Cryptography/SHA512Managed.cs
+System.Security.Cryptography/SignatureDescription.cs
+System.Security.Cryptography/SymmetricAlgorithm.cs
+System.Security.Cryptography/ToBase64Transform.cs
+System.Security.Cryptography/X509Certificates.cs
+System.Security.Permissions/CodeAccessSecurityAttribute.cs
+System.Security.Permissions/EnvironmentPermissionAccess.cs
+System.Security.Permissions/EnvironmentPermissionAttribute.cs
+System.Security.Permissions/FileDialogPermissionAccess.cs
+System.Security.Permissions/FileDialogPermissionAttribute.cs
+System.Security.Permissions/FileIOPermission.cs
+System.Security.Permissions/FileIOPermissionAccess.cs
+System.Security.Permissions/FileIOPermissionAttribute.cs
+System.Security.Permissions/IUnrestrictedPermission.cs
+System.Security.Permissions/IsolatedStorageContainment.cs
+System.Security.Permissions/IsolatedStorageFilePermissionAttribute.cs
+System.Security.Permissions/IsolatedStoragePermission.cs
+System.Security.Permissions/IsolatedStoragePermissionAttribute.cs
+System.Security.Permissions/PermissionSetAttribute.cs
+System.Security.Permissions/PermissionState.cs
+System.Security.Permissions/PrinciplePermissionAttribute.cs
+System.Security.Permissions/ReflectionPermissionAttribute.cs
+System.Security.Permissions/ReflectionPermissionFlag.cs
+System.Security.Permissions/RegistryPermissionAccess.cs
+System.Security.Permissions/RegistryPermissionAttribute.cs
+System.Security.Permissions/SecurityAction.cs
+System.Security.Permissions/SecurityAttribute.cs
+System.Security.Permissions/SecurityPermission.cs
+System.Security.Permissions/SecurityPermissionFlag.cs
+System.Security.Permissions/SiteIdentityPermissionAttribute.cs
+System.Security.Permissions/StrongNamePermissionAttribute.cs
+System.Security.Permissions/UIPermissionAttribute.cs
+System.Security.Permissions/UIPermissionClipboard.cs
+System.Security.Permissions/UIPermissionWindow.cs
+System.Security.Permissions/UrlIdentityPermissionAttribute.cs
+System.Security.Permissions/ZoneIdentityPermissionAttribute.cs
+System.Security.Policy/AllMembershipCondition.cs
+System.Security.Policy/CodeGroup.cs
+System.Security.Policy/Evidence.cs
+System.Security.Policy/FileCodeGroup.cs
+System.Security.Policy/IIdentityPermissionFactory.cs
+System.Security.Policy/IMembershipCondition.cs
+System.Security.Policy/PolicyException.cs
+System.Security.Policy/PolicyLevel.cs
+System.Security.Policy/PolicyStatement.cs
+System.Security.Policy/PolicyStatementAttribute.cs
+System.Security.Principal/GenericIdentity.cs
+System.Security.Principal/GenericPrincipal.cs
+System.Security.Principal/IIdentity.cs
+System.Security.Principal/IPrincipal.cs
+System.Security.Principal/PrincipalPolicy.cs
+System.Security.Principal/WindowsAccountType.cs
+System.Security.Principal/WindowsBuiltInRole.cs
+System.Security/CodeAccessPermission.cs
+System.Security/IEvidenceFactory.cs
+System.Security/IPermission.cs
+System.Security/ISecurityEncodable.cs
+System.Security/ISecurityPolicyEncodable.cs
+System.Security/IStackWalk.cs
+System.Security/NamedPermissionSet.cs
+System.Security/PermissionSet.cs
+System.Security/PolicyLevelType.cs
+System.Security/SecurityElement.cs
+System.Security/SecurityException.cs
+System.Security/SecurityManager.cs
+System.Security/SecurityZone.cs
+System.Security/SuppressUnmanagedCodeSecurityAttribute.cs
+System.Security/UnverifiableCodeAttribute.cs
+System.Security/VerificationException.cs
+System.Security/XmlSyntaxException.cs
+System.Text/ASCIIEncoding.cs
+System.Text/Decoder.cs
+System.Text/Encoder.cs
+System.Text/Encoding.cs
+System.Text/StringBuilder.cs
+System.Text/UTF7Encoding.cs
+System.Text/UTF8Encoding.cs
+System.Text/UnicodeEncoding.cs
+System.Threading/ApartmentState.cs
+System.Threading/AutoResetEvent.cs
+System.Threading/IOCompletionCallback.cs
+System.Threading/Interlocked.cs
+System.Threading/LockCookie.cs
+System.Threading/ManualResetEvent.cs
+System.Threading/Monitor.cs
+System.Threading/Mutex.cs
+System.Threading/NativeEventCalls.cs
+System.Threading/NativeOverlapped.cs
+System.Threading/Overlapped.cs
+System.Threading/ReaderWriterLock.cs
+System.Threading/RegisteredWaitHandle.cs
+System.Threading/SynchronizationLockException.cs
+System.Threading/Thread.cs
+System.Threading/ThreadAbortException.cs
+System.Threading/ThreadInterruptedException.cs
+System.Threading/ThreadPool.cs
+System.Threading/ThreadPriority.cs
+System.Threading/ThreadStart.cs
+System.Threading/ThreadState.cs
+System.Threading/ThreadStateException.cs
+System.Threading/Timeout.cs
+System.Threading/Timer.cs
+System.Threading/TimerCallback.cs
+System.Threading/WaitCallback.cs
+System.Threading/WaitHandle.cs
+System.Threading/WaitOrTimerCallback.cs
+System/AppDomain.cs
+System/AppDomainSetup.cs
+System/AppDomainUnloadedException.cs
+System/ApplicationException.cs
+System/ArgumentException.cs
+System/ArgumentNullException.cs
+System/ArgumentOutOfRangeException.cs
+System/ArithmeticException.cs
+System/Array.cs
+System/ArrayTypeMismatchException.cs
+System/AssemblyLoadEventArgs.cs
+System/AssemblyLoadEventHandler.cs
+System/AsyncCallback.cs
+System/Attribute.cs
+System/AttributeTargets.cs
+System/AttributeUsage.cs
+System/BadImageFormatException.cs
+System/BitConverter.cs
+System/Boolean.cs
+System/Buffer.cs
+System/Byte.cs
+System/CLSCompliantAttribute.cs
+System/CannotUnloadAppDomainException.cs
+System/Char.cs
+System/CharEnumerator.cs
+System/Console.cs
+System/ContextBoundObject.cs
+System/ContextMarshalException.cs
+System/ContextStaticAttribute.cs
+System/Convert.cs
+System/CrossAppDomainDelegate.cs
+System/DBNull.cs
+System/DateTime.cs
+System/Decimal.cs
+System/DecimalFormatter.cs
+System/Delegate.cs
+System/DivideByZeroException.cs
+System/DllNotFoundException.cs
+System/Double.cs
+System/DuplicateWaitObjectException.cs
+System/EntryPointNotFoundException.cs
+System/Enum.cs
+System/Environment.cs
+System/EventArgs.cs
+System/EventHandler.cs
+System/Exception.cs
+System/ExecutionEngineException.cs
+System/FieldAccessException.cs
+System/FlagsAttribute.cs
+System/FormatException.cs
+System/GC.cs
+System/Guid.cs
+System/IAppDomainSetup.cs
+System/IAsyncResult.cs
+System/ICloneable.cs
+System/IComparable.cs
+System/IConvertible.cs
+System/ICustomFormatter.cs
+System/IDisposable.cs
+System/IFormatProvider.cs
+System/IFormattable.cs
+System/IServiceProvider.cs
+System/IndexOutOfRangeException.cs
+System/Int16.cs
+System/Int32.cs
+System/Int64.cs
+System/IntPtr.cs
+System/IntegerFormatter.cs
+System/InvalidCastException.cs
+System/InvalidOperationException.cs
+System/InvalidProgramException.cs
+System/LoaderOptimization.cs
+System/LoaderOptimizationAttribute.cs
+System/LocalDataStoreSlot.cs
+System/MTAThreadAttribute.cs
+System/MarshalByRefObject.cs
+System/Math.cs
+System/MemberAccessException.cs
+System/MethodAccessException.cs
+System/MissingFieldException.cs
+System/MissingMemberException.cs
+System/MissingMethodException.cs
+System/MonoCustomAttrs.cs
+System/MonoDummy.cs
+System/MonoType.cs
+System/MulticastDelegate.cs
+System/MulticastNotSupportedException.cs
+System/NonSerializedAttribute.cs
+System/NotFiniteNumberException.cs
+System/NotImplementedException.cs
+System/NotSupportedException.cs
+System/NullReferenceException.cs
+System/Object.cs
+System/ObjectDisposedException.cs
+System/ObsoleteAttribute.cs
+System/OperatingSystem.cs
+System/OutOfMemoryException.cs
+System/OverflowException.cs
+System/ParamArrayAttribute.cs
+System/PlatformID.cs
+System/PlatformNotSupportedException.cs
+System/Random.cs
+System/RankException.cs
+System/ResolveEventArgs.cs
+System/ResolveEventHandler.cs
+System/RuntimeArgumentHandle.cs
+System/RuntimeFieldHandle.cs
+System/RuntimeMethodHandle.cs
+System/RuntimeTypeHandle.cs
+System/SByte.cs
+System/STAThreadAttribute.cs
+System/SerializableAttribute.cs
+System/Single.cs
+System/StackOverflowException.cs
+System/String.cs
+System/SystemException.cs
+System/TODOAttribute.cs
+System/ThreadStaticAttribute.cs
+System/TimeSpan.cs
+System/TimeZone.cs
+System/Type.cs
+System/TypeCode.cs
+System/TypeInitializationException.cs
+System/TypeLoadException.cs
+System/TypeUnloadedException.cs
+System/UInt16.cs
+System/UInt32.cs
+System/UInt64.cs
+System/UIntPtr.cs
+System/UnauthorizedAccessException.cs
+System/UnhandledExceptionEventArgs.cs
+System/UnhandledExceptionEventHandler.cs
+System/ValueType.cs
+System/Version.cs
+System/Void.cs
+System/WeakReference.cs
+System/_AppDomain.cs
+System/a.cs
+Unix/Errno.cs
+Unix/Wrapper.cs
diff --git a/mcs/class/library.build b/mcs/class/library.build
new file mode 100644
index 00000000000..2e810169f5b
--- /dev/null
+++ b/mcs/class/library.build
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for class libraries -->
+<!-- Target windows builds libraries _for_ windows -->
+<!-- Target linux builds libraries _for_ linux -->
+
+<project name="corlib" default="build">
+ <property name="debug" value="false"/>
+
+ <target name="build">
+ <nant basedir="corlib" target="build"/>
+ <nant basedir="System" target="build"/>
+ <!--nant basedir="System.Drawing" target="build"/-->
+ <nant basedir="System.XML" target="build"/>
+ <nant basedir="System.Data" target="build"/>
+ <nant basedir="System.Web" target="build"/>
+ </target>
+
+ <target name="test">
+ <nant basedir="corlib" target="test"/>
+ <nant basedir="System" target="test"/>
+ <nant basedir="System.XML" target="test"/>
+ </target>
+
+ <target name="clean">
+ <delete failonerror="false">
+ <fileset basedir="lib">
+ <includes name="*.dll"/>
+ </fileset>
+ </delete>
+ <nant basedir="corlib" target="clean"/>
+ <nant basedir="System" target="clean"/>
+ <nant basedir="System.XML" target="clean"/>
+ <nant basedir="System.Data" target="clean"/>
+ </target>
+</project>
diff --git a/mcs/class/makefile b/mcs/class/makefile
new file mode 100644
index 00000000000..35e5bb0b0a4
--- /dev/null
+++ b/mcs/class/makefile
@@ -0,0 +1,13 @@
+all: linux
+
+linux:
+ ../nant/NAnt.exe
+
+push:
+ scp lib/*.dll mono-cvs:libs
+
+test:
+ ../nant/NAnt.exe test
+
+clean:
+ ../nant/NAnt.exe clean
diff --git a/mcs/class/notes/BitVecto32.txt b/mcs/class/notes/BitVecto32.txt
new file mode 100644
index 00000000000..fad747dfe76
--- /dev/null
+++ b/mcs/class/notes/BitVecto32.txt
@@ -0,0 +1,6 @@
+* Why does CreateSection take a short for the range number?
+
+ It would seem like it should be possible to have numbers between 0
+ and UInt32.MaxValue in there. Why is the API limiting things to 16
+ bits?
+
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom.Compiler/CodeGenerator.xml b/mcs/docs/apidocs/xml/en/System.CodeDom.Compiler/CodeGenerator.xml
new file mode 100644
index 00000000000..2c8646250ba
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom.Compiler/CodeGenerator.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.Compiler.CodeGenerator" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="isCurrentClass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="isCurrentDelegate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="isCurrentEnum">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="isCurrentInterface">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="isCurrentStruct">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="CurrentClassName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentMember">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentMemberName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Indent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsCurrentClass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsCurrentDelegate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsCurrentEnum">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsCurrentInterface">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsCurrentStruct">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Output">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ValidateIdentifier(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsValidIdentifier(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GenerateCodeFromStatement(System.IO.TextWriter, System.CodeDom.CodeStatement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="output">TODO</param>
+ <param name="expression">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GenerateCodeFromNamespace(System.IO.TextWriter, System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="output">TODO</param>
+ <param name="expression">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GenerateCodeFromExpression(System.IO.TextWriter, System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="output">TODO</param>
+ <param name="expression">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsValidLanguateIndependentIdentifier(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom.Compiler/ICodeGenerator.xml b/mcs/docs/apidocs/xml/en/System.CodeDom.Compiler/ICodeGenerator.xml
new file mode 100644
index 00000000000..462a3d7624f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom.Compiler/ICodeGenerator.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.CodeDom.Compiler.ICodeGenerator" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeArrayCreateExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeArrayCreateExpression.xml
new file mode 100644
index 00000000000..b8e8b9878e0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeArrayCreateExpression.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeArrayCreateExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeArrayCreateExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeArrayCreateExpression(System.String, System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="createType">TODO</param>
+ <param name="size">TODO</param>
+ </constructor>
+ <constructor name="CodeArrayCreateExpression(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="createType">TODO</param>
+ <param name="size">TODO</param>
+ </constructor>
+ <constructor name="CodeArrayCreateExpression(System.String, System.CodeDom.CodeExpression[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="createType">TODO</param>
+ <param name="initializers">TODO</param>
+ </constructor>
+ <property name="SizeExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Size">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Initializers">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CreateType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAssignStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAssignStatement.xml
new file mode 100644
index 00000000000..262a7392730
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAssignStatement.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeAssignStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeAssignStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeAssignStatement(System.CodeDom.CodeExpression, System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="left">TODO</param>
+ <param name="right">TODO</param>
+ </constructor>
+ <property name="Left">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Right">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttachEventStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttachEventStatement.xml
new file mode 100644
index 00000000000..d1266e6fc4f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttachEventStatement.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeAttachEventStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeAttachEventStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeAttachEventStatement(System.CodeDom.CodeExpression, System.String, System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ <param name="eventName">TODO</param>
+ <param name="newListener">TODO</param>
+ </constructor>
+ <property name="EventName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NewListener">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TargetObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeArgument.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeArgument.xml
new file mode 100644
index 00000000000..0bae2c15f09
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeArgument.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeAttributeArgument" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeAttributeArgument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeAttributeArgument(System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="CodeAttributeArgument(System.String, System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="val">TODO</param>
+ </constructor>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeArgumentCollection.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeArgumentCollection.xml
new file mode 100644
index 00000000000..fb1a8ea598d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeArgumentCollection.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeAttributeArgumentCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeAttributeArgumentCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.CodeDom.CodeAttributeArgument)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.CodeDom.CodeAttributeArgument[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeBlock.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeBlock.xml
new file mode 100644
index 00000000000..a5be704038c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeBlock.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeAttributeBlock" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeAttributeBlock">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeAttributeBlock(System.CodeDom.CodeAttributeDeclaration[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributes">TODO</param>
+ </constructor>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeDeclaration.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeDeclaration.xml
new file mode 100644
index 00000000000..be68281d8c6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeDeclaration.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeAttributeDeclaration" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeAttributeDeclaration">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeAttributeDeclaration(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <constructor name="CodeAttributeDeclaration(System.String, System.CodeDom.CodeAttributeArgument[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="arguments">TODO</param>
+ </constructor>
+ <property name="Arguments">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeDeclarationCollection.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeDeclarationCollection.xml
new file mode 100644
index 00000000000..81d85a06dda
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeAttributeDeclarationCollection.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeAttributeDeclarationCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeAttributeDeclarationCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.CodeDom.CodeAttributeDeclaration)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.CodeDom.CodeAttributeDeclaration[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeBaseReferenceExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeBaseReferenceExpression.xml
new file mode 100644
index 00000000000..53d58e722d3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeBaseReferenceExpression.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeBaseReferenceExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeBaseReferenceExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeBinaryOperatorExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeBinaryOperatorExpression.xml
new file mode 100644
index 00000000000..3384b74114f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeBinaryOperatorExpression.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeBinaryOperatorExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeBinaryOperatorType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeBinaryOperatorType(System.CodeDom.CodeExpression, System.CodeDom.CodeBinaryOperatorExpression.CodeBinaryOperatorType, System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="left">TODO</param>
+ <param name="oper">TODO</param>
+ <param name="right">TODO</param>
+ </constructor>
+ <property name="Left">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Right">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Operator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeBinaryOperatorType.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeBinaryOperatorType.xml
new file mode 100644
index 00000000000..3fd58201cfa
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeBinaryOperatorType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.CodeDom.CodeBinaryOperatorType" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCastExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCastExpression.xml
new file mode 100644
index 00000000000..381b67c4524
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCastExpression.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeCastExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeCastExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeCastExpression(System.String, System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetType">TODO</param>
+ <param name="expression">TODO</param>
+ </constructor>
+ <property name="Expression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TargetType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCatchClause.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCatchClause.xml
new file mode 100644
index 00000000000..132696ca756
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCatchClause.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeCatchClause" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeCatchClause">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeCatchClause(System.CodeDom.CodeParameterDeclarationExpression, System.CodeDom.CodeStatement[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="statements">TODO</param>
+ </constructor>
+ <property name="Statements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Condition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCatchClauseCollection.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCatchClauseCollection.xml
new file mode 100644
index 00000000000..079b59bd95b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCatchClauseCollection.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeCatchClauseCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeCatchClauseCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.CodeDom.CodeCatchClause)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.CodeDom.CodeCatchClause[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClass.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClass.xml
new file mode 100644
index 00000000000..482bec6431e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClass.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeClass" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeClass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeClass(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <property name="attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseTypes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsClass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsEnum">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsInterface">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsStruct">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Members">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassCollection.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassCollection.xml
new file mode 100644
index 00000000000..d25d3381423
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassCollection.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeClassCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeClassCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.CodeDom.CodeClass)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.CodeDom.CodeClass[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassConstructor.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassConstructor.xml
new file mode 100644
index 00000000000..27653767f21
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassConstructor.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeClassConstructor" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeClassConstructor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassDelegate.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassDelegate.xml
new file mode 100644
index 00000000000..a7e89a7e86d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassDelegate.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeClassDelegate" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeClassDelegate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeClassDelegate(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <property name="Parameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReturnType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassMember.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassMember.xml
new file mode 100644
index 00000000000..a98be1bef8c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassMember.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeClassMember" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MemberAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CustomAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassMemberCollection.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassMemberCollection.xml
new file mode 100644
index 00000000000..08a240e200b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeClassMemberCollection.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeClassMemberCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeClassMemberCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.CodeDom.CodeClassMember)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.CodeDom.CodeClassMember[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCommentStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCommentStatement.xml
new file mode 100644
index 00000000000..c42ebe9f451
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeCommentStatement.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeCommentStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeCommentStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeCommentStatement(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ </constructor>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeConstructor.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeConstructor.xml
new file mode 100644
index 00000000000..940d88a4c68
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeConstructor.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeConstructor" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeConstructor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BaseConstructorArgs">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ChainedConstructorArgs">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateCreateExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateCreateExpression.xml
new file mode 100644
index 00000000000..ce19eec4cd4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateCreateExpression.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeDelegateCreateExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeDelegateCreateExpression(System.String, System.CodeDom.CodeExpression, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="delegateType">TODO</param>
+ <param name="targetObject">TODO</param>
+ <param name="methodName">TODO</param>
+ </constructor>
+ <constructor name="CodeDelegateCreateExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="DelegateType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MethodName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TargetObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateInvokeExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateInvokeExpression.xml
new file mode 100644
index 00000000000..932732ada24
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateInvokeExpression.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeDelegateInvokeExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeDelegateInvokeExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeDelegateInvokeExpression(System.CodeDom.CodeExpression, System.CodeDom.CodeExpression[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ <param name="parameters">TODO</param>
+ </constructor>
+ <constructor name="CodeDelegateInvokeExpression(System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ </constructor>
+ <property name="TargetObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Parameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateInvokeStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateInvokeStatement.xml
new file mode 100644
index 00000000000..05c9e77b862
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDelegateInvokeStatement.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeDelegateInvokeStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeDelegateInvokeStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeDelegateInvokeStatement(System.CodeDom.CodeStatement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ </constructor>
+ <constructor name="CodeDelegateInvokeStatement(System.CodeDom.CodeDelegateInvokeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="delegateInvoke">TODO</param>
+ </constructor>
+ <constructor name="CodeDelegateInvokeStatement(System.CodeDom.CodeStatement, System.CodeDom.CodeStatement[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ <param name="parameters">TODO</param>
+ </constructor>
+ <property name="DelegateInvoke">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDetachEventStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDetachEventStatement.xml
new file mode 100644
index 00000000000..1aafb197b69
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeDetachEventStatement.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeDetachEventStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeDetachEventStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeDetachEventStatement(System.CodeDom.CodeExpression, System.String, System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ <param name="eventName">TODO</param>
+ <param name="newListener">TODO</param>
+ </constructor>
+ <property name="EventName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TargetObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NewListener">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeExpression.xml
new file mode 100644
index 00000000000..524b3c32db9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeExpression.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="UserData">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeExpressionCollection.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeExpressionCollection.xml
new file mode 100644
index 00000000000..9e539c2d417
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeExpressionCollection.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeExpressionCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeExpressionCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.CodeDom.CodeExpression[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeFieldReferenceExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeFieldReferenceExpression.xml
new file mode 100644
index 00000000000..82dd3f04fb4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeFieldReferenceExpression.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeFieldReferenceExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FieldDirection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="FieldDirection(System.CodeDom.CodeExpression, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ <param name="fieldName">TODO</param>
+ </constructor>
+ <property name="Direction">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FieldName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TargetObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeForLoopStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeForLoopStatement.xml
new file mode 100644
index 00000000000..86993c7c619
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeForLoopStatement.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeForLoopStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeForLoopStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeForLoopStatement(System.CodeDom.CodeStatement, System.CodeDom.CodeExpression, System.CodeDom.CodeStatement, System.CodeDom.CodeStatement[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="initStatement">TODO</param>
+ <param name="testExpression">TODO</param>
+ <param name="incrementStatement">TODO</param>
+ <param name="statements">TODO</param>
+ </constructor>
+ <property name="InitStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IncrementStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Statements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TestExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeIfStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeIfStatement.xml
new file mode 100644
index 00000000000..629b29d2b62
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeIfStatement.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeIfStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeIfStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeIfStatement(System.CodeDom.CodeExpression, System.CodeDom.CodeStatement[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="trueStatements">TODO</param>
+ </constructor>
+ <constructor name="CodeIfStatement(System.CodeDom.CodeExpression, System.CodeDom.CodeStatement[], System.CodeDom.CodeStatement[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="trueStatements">TODO</param>
+ <param name="falseStatements">TODO</param>
+ </constructor>
+ <property name="Condition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FalseStatements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TrueStatements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeIndexerExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeIndexerExpression.xml
new file mode 100644
index 00000000000..549f7400d38
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeIndexerExpression.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeIndexerExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeIndexerExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeIndexerExpression(System.CodeDom.CodeExpression, System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ <param name="index">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLinePragma.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLinePragma.xml
new file mode 100644
index 00000000000..3c55370827b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLinePragma.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeLinePragma" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeLinePragma(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileName">TODO</param>
+ <param name="lineNumber">TODO</param>
+ </constructor>
+ <property name="FileName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LineNumber">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralClassMember.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralClassMember.xml
new file mode 100644
index 00000000000..2f3cee8fd07
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralClassMember.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeLiteralClassMember" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeLiteralClassMember">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeLiteralClassMember(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ </constructor>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralExpression.xml
new file mode 100644
index 00000000000..ef4396e998f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralExpression.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeLiteralExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeLiteralExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeLiteralExpression(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralNamespace.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralNamespace.xml
new file mode 100644
index 00000000000..e7281bd205a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralNamespace.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeLiteralNamespace" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeLiteralNamespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LinePragma">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralStatement.xml
new file mode 100644
index 00000000000..e4f0e56a91b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeLiteralStatement.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeLiteralStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeLiteralStatement(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberEvent.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberEvent.xml
new file mode 100644
index 00000000000..3c4e9b3f5be
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberEvent.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeMemberEvent" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeMemberEvent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ImplementsType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PrivateImplements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Type">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberField.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberField.xml
new file mode 100644
index 00000000000..a0959219825
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberField.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeMemberField" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeMemberField">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeMemberField(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="name">TODO</param>
+ </constructor>
+ <property name="InitExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Type">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberMethod.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberMethod.xml
new file mode 100644
index 00000000000..e75321039b8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberMethod.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeMemberMethod" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeMemberMethod">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ImplementsType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PrivateImplements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReturnType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Parameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Statements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberProperty.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberProperty.xml
new file mode 100644
index 00000000000..424571ce0ca
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMemberProperty.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeMemberProperty" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeMemberProperty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ImplementsType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PrivateImplements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Parameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SetStatements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="GetStatements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Type">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasGet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasSet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodInvokeExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodInvokeExpression.xml
new file mode 100644
index 00000000000..eaec26ed0ac
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodInvokeExpression.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeMethodInvokeExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeMethodInvokeExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeMethodInvokeExpression(System.CodeDom.CodeExpression, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ <param name="methodName">TODO</param>
+ </constructor>
+ <constructor name="CodeMethodInvokeExpression(System.CodeDom.CodeExpression, System.String, System.CodeDom.CodeExpression[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ <param name="methodName">TODO</param>
+ <param name="parameters">TODO</param>
+ </constructor>
+ <property name="MethodName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Parameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TargetObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodInvokeStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodInvokeStatement.xml
new file mode 100644
index 00000000000..23d691ef7a6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodInvokeStatement.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeMethodInvokeStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeMethodInvokeStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeMethodInvokeStatement(System.CodeDom.CodeMethodInvokeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="methodInvoke">TODO</param>
+ </constructor>
+ <constructor name="CodeMethodInvokeStatement(System.CodeDom.CodeExpression, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ <param name="methodName">TODO</param>
+ </constructor>
+ <constructor name="CodeMethodInvokeStatement(System.CodeDom.CodeExpression, System.String, System.CodeDom.CodeExpression[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ <param name="methodName">TODO</param>
+ <param name="parameters">TODO</param>
+ </constructor>
+ <property name="MethodName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Parameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TargetObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MethodInvoke">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodReturnStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodReturnStatement.xml
new file mode 100644
index 00000000000..640bf702d64
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeMethodReturnStatement.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeMethodReturnStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeMethodReturnStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespace.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespace.xml
new file mode 100644
index 00000000000..ceb7d8a7064
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespace.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeNamespace" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeNamespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeNamespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <property name="AllowLateBound">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Classes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Imports">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RequireVariableDeclaration">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UserData">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespaceImport.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespaceImport.xml
new file mode 100644
index 00000000000..273bbf57612
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespaceImport.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeNamespaceImport" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeNamespaceImport">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeNamespaceImport(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nameSpace">TODO</param>
+ </constructor>
+ <property name="Namespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespaceImportCollection.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespaceImportCollection.xml
new file mode 100644
index 00000000000..7b5d18880fa
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeNamespaceImportCollection.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeNamespaceImportCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeNamespaceImportCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.CodeDom.CodeNamespaceImport)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.CodeDom.CodeNamespaceImport[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeObject.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeObject.xml
new file mode 100644
index 00000000000..5ddcb0761d1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeObject.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeObject" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeObjectCreateExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeObjectCreateExpression.xml
new file mode 100644
index 00000000000..a02b887ca4c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeObjectCreateExpression.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeObjectCreateExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeObjectCreateExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeObjectCreateExpression(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="createType">TODO</param>
+ </constructor>
+ <constructor name="CodeObjectCreateExpression(System.String, System.CodeDom.CodeExpression[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="createType">TODO</param>
+ <param name="parameters">TODO</param>
+ </constructor>
+ <property name="CreateType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Parameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeParameterDeclarationExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeParameterDeclarationExpression.xml
new file mode 100644
index 00000000000..3fe1477c25f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeParameterDeclarationExpression.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeParameterDeclarationExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeParameterDeclarationExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeParameterDeclarationExpression(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="name">TODO</param>
+ </constructor>
+ <property name="Type">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CustomAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Direction">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeParameterDeclarationExpressionCollection.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeParameterDeclarationExpressionCollection.xml
new file mode 100644
index 00000000000..6031ed5aae4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeParameterDeclarationExpressionCollection.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeParameterDeclarationExpressionCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeParameterDeclarationExpressionCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.CodeDom.CodeParameterDeclarationExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.CodeDom.CodeParameterDeclarationExpression[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodePrimitiveExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodePrimitiveExpression.xml
new file mode 100644
index 00000000000..14093e2ea80
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodePrimitiveExpression.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodePrimitiveExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodePrimitiveExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodePrimitiveExpression(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodePropertyReferenceExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodePropertyReferenceExpression.xml
new file mode 100644
index 00000000000..223cf538fc6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodePropertyReferenceExpression.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodePropertyReferenceExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodePropertyReferenceExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodePropertyReferenceExpression(System.CodeDom.CodeExpression, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetObject">TODO</param>
+ <param name="propertyName">TODO</param>
+ </constructor>
+ <property name="Parameter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PropertyName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TargetObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeStatement.xml
new file mode 100644
index 00000000000..defd73cc6ce
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeStatement.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeStatementCollection.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeStatementCollection.xml
new file mode 100644
index 00000000000..ace507bd91b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeStatementCollection.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeStatementCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeStatementCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.CodeDom.CodeStatement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.CodeDom.CodeStatement[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeThisReferenceExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeThisReferenceExpression.xml
new file mode 100644
index 00000000000..a74de0cd721
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeThisReferenceExpression.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeThisReferenceExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeThisReferenceExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeThrowExceptionStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeThrowExceptionStatement.xml
new file mode 100644
index 00000000000..e3d1f2b8e7c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeThrowExceptionStatement.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeThrowExceptionStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeThrowExceptionStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeThrowExceptionStatement(System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="toThrow">TODO</param>
+ </constructor>
+ <property name="ToThrow">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTryCatchFinallyStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTryCatchFinallyStatement.xml
new file mode 100644
index 00000000000..95a52fafa35
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTryCatchFinallyStatement.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeTryCatchFinallyStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeTryCatchFinallyStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeTryCatchFinallyStatement(System.CodeDom.CodeStatement[], System.CodeDom.CodeCatchClause[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="tryStatements">TODO</param>
+ <param name="catchClauses">TODO</param>
+ </constructor>
+ <constructor name="CodeTryCatchFinallyStatement(System.CodeDom.CodeStatement[], System.CodeDom.CodeCatchClause[], System.CodeDom.CodeStatement[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="tryStatements">TODO</param>
+ <param name="catchClauses">TODO</param>
+ <param name="finallyStatements">TODO</param>
+ </constructor>
+ <property name="FinallyStatements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TryStatements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CatchClauses">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeDeclaration.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeDeclaration.xml
new file mode 100644
index 00000000000..45b5bdc6f92
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeDeclaration.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeTypeDeclaration" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeTypeDeclaration">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeMember.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeMember.xml
new file mode 100644
index 00000000000..72f38c7e168
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeMember.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeTypeMember" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeTypeMember">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeOfExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeOfExpression.xml
new file mode 100644
index 00000000000..f6f925a645e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeOfExpression.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeTypeOfExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeTypeOfExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeTypeOfExpression(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ </constructor>
+ <property name="Type">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeReferenceExpression.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeReferenceExpression.xml
new file mode 100644
index 00000000000..a03beb96551
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeTypeReferenceExpression.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeTypeReferenceExpression" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeTypeReferenceExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeTypeReferenceExpression(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ </constructor>
+ <property name="Type">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/CodeVariableDeclarationStatement.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeVariableDeclarationStatement.xml
new file mode 100644
index 00000000000..bd9ff46e94f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/CodeVariableDeclarationStatement.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CodeDom.CodeVariableDeclarationStatement" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeVariableDeclarationStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CodeVariableDeclarationStatement(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="name">TODO</param>
+ </constructor>
+ <constructor name="CodeVariableDeclarationStatement(System.String, System.String, System.CodeDom.CodeExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="name">TODO</param>
+ <param name="initExpression">TODO</param>
+ </constructor>
+ <property name="InitExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Type">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/FieldDirection.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/FieldDirection.xml
new file mode 100644
index 00000000000..87bac0fb1da
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/FieldDirection.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.CodeDom.FieldDirection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.CodeDom/MemberAttributes.xml b/mcs/docs/apidocs/xml/en/System.CodeDom/MemberAttributes.xml
new file mode 100644
index 00000000000..6fb7fe86f6a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.CodeDom/MemberAttributes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.CodeDom.MemberAttributes" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections.Specialized/BitVector32.xml b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/BitVector32.xml
new file mode 100644
index 00000000000..5fb7ba0b3fe
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/BitVector32.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Collections.Specialized.BitVector32" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Section(System.Collections.Specialized.BitVector32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="source">TODO</param>
+ </constructor>
+ <constructor name="Section(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="init">TODO</param>
+ </constructor>
+ <property name="Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateSection(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="maxval">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateMask">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateMask(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prev">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections.Specialized/KeysCollection.xml b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/KeysCollection.xml
new file mode 100644
index 00000000000..4af9734b852
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/KeysCollection.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.Specialized.NameObjectCollectionBase+KeysCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="arr">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Get(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections.Specialized/ListDictionary.xml b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/ListDictionary.xml
new file mode 100644
index 00000000000..46cfa7e744d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/ListDictionary.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.Specialized.ListDictionary" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ListDictionary">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ListDictionary(System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="comparer">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Keys">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Values">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections.Specialized/NameObjectCollectionBase.xml b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/NameObjectCollectionBase.xml
new file mode 100644
index 00000000000..11dc715d6ef
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/NameObjectCollectionBase.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.Specialized.NameObjectCollectionBase" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Comparer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HashCodeProvider">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Keys">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="OnDeserialization(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="sender">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="arr">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections.Specialized/NameValueCollection.xml b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/NameValueCollection.xml
new file mode 100644
index 00000000000..bd371f4af57
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/NameValueCollection.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.Specialized.NameValueCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NameValueCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="NameValueCollection(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ </constructor>
+ <constructor name="NameValueCollection(System.Collections.Specialized.NameValueCollection)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="col">TODO</param>
+ </constructor>
+ <constructor name="NameValueCollection(System.Collections.IHashCodeProvider, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hashProvider">TODO</param>
+ <param name="comparer">TODO</param>
+ </constructor>
+ <constructor name="NameValueCollection(System.Int32, System.Collections.IHashCodeProvider, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ <param name="hashProvider">TODO</param>
+ <param name="comparer">TODO</param>
+ </constructor>
+ <property name="AllKeys">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Set(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValues(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValues(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetKey(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Get(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Get(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dest">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Collections.Specialized.NameValueCollection)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="HasKeys">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections.Specialized/Section.xml b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/Section.xml
new file mode 100644
index 00000000000..a839c3ac72d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/Section.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Collections.Specialized.BitVector32+Section" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="maxval">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringCollection.xml b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringCollection.xml
new file mode 100644
index 00000000000..e3cc77d5eb6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringCollection.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.Specialized.StringCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StringCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.String[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringDictionary.xml b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringDictionary.xml
new file mode 100644
index 00000000000..5d9cca465ea
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringDictionary.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.Specialized.StringDictionary" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StringDictionary">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Keys">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Values">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ContainsValue(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ContainsKey(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringEnumerator.xml b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringEnumerator.xml
new file mode 100644
index 00000000000..cc708fbe37b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections.Specialized/StringEnumerator.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.Specialized.StringEnumerator" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Current">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="MoveNext">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Reset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/ArrayList.xml b/mcs/docs/apidocs/xml/en/System.Collections/ArrayList.xml
new file mode 100644
index 00000000000..70c4b7872d0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/ArrayList.xml
@@ -0,0 +1,326 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.ArrayList" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ArrayList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ArrayList(System.Collections.ICollection)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ </constructor>
+ <constructor name="ArrayList(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ </constructor>
+ <property name="Capacity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="arrayIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TrimToSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToArray(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToArray">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sort(System.Int32, System.Int32, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <param name="comparer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sort(System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="comparer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sort">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetRange(System.Int32, System.Collections.ICollection)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Reverse(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Reverse">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveRange(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.Object, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="StartIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.Object, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="InsertRange(System.Int32, System.Collections.ICollection)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Object, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetRange(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Int32, System.Array, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="array">TODO</param>
+ <param name="arrayIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BinarySearch(System.Int32, System.Int32, System.Object, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <param name="value">TODO</param>
+ <param name="comparer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BinarySearch(System.Object, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="comparer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BinarySearch(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.Collections.ICollection)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadOnly(System.Collections.ArrayList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="list">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadOnly(System.Collections.IList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="list">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Synchronized(System.Collections.ArrayList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="list">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Synchronized(System.Collections.IList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="list">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FixedSize(System.Collections.ArrayList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="list">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FixedSize(System.Collections.IList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="list">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Repeat(System.Object, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Adapter(System.Collections.IList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="list">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/BitArray.xml b/mcs/docs/apidocs/xml/en/System.Collections/BitArray.xml
new file mode 100644
index 00000000000..b89d3c6b434
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/BitArray.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.BitArray" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="BitArray(System.Collections.BitArray)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="orig">TODO</param>
+ </constructor>
+ <constructor name="BitArray(System.Boolean[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bits">TODO</param>
+ </constructor>
+ <constructor name="BitArray(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ </constructor>
+ <constructor name="BitArray(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ </constructor>
+ <constructor name="BitArray(System.Int32[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="words">TODO</param>
+ </constructor>
+ <constructor name="BitArray(System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ <param name="value">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="And(System.Collections.BitArray)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="operand">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Get(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Not">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Or(System.Collections.BitArray)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="operand">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Set(System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetAll(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Xor(System.Collections.BitArray)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="operand">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/CaseInsensitiveComparer.xml b/mcs/docs/apidocs/xml/en/System.Collections/CaseInsensitiveComparer.xml
new file mode 100644
index 00000000000..a9b0f801b65
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/CaseInsensitiveComparer.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.CaseInsensitiveComparer" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CaseInsensitiveComparer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Default">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Compare(System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/CaseInsensitiveHashCodeProvider.xml b/mcs/docs/apidocs/xml/en/System.Collections/CaseInsensitiveHashCodeProvider.xml
new file mode 100644
index 00000000000..befb667b8ee
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/CaseInsensitiveHashCodeProvider.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.CaseInsensitiveHashCodeProvider" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CaseInsensitiveHashCodeProvider">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Default">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/CollectionBase.xml b/mcs/docs/apidocs/xml/en/System.Collections/CollectionBase.xml
new file mode 100644
index 00000000000..b751f54a4c9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/CollectionBase.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.CollectionBase" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="List">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/Comparer.xml b/mcs/docs/apidocs/xml/en/System.Collections/Comparer.xml
new file mode 100644
index 00000000000..31b591364dd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/Comparer.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.Comparer" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Default">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="Compare(System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/DictionaryBase.xml b/mcs/docs/apidocs/xml/en/System.Collections/DictionaryBase.xml
new file mode 100644
index 00000000000..173c93d2e0e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/DictionaryBase.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.DictionaryBase" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Dictionary">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerHashtable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/DictionaryEntry.xml b/mcs/docs/apidocs/xml/en/System.Collections/DictionaryEntry.xml
new file mode 100644
index 00000000000..8dba7909ce7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/DictionaryEntry.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Collections.DictionaryEntry" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DictionaryEntry(System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="k">TODO</param>
+ <param name="value">TODO</param>
+ </constructor>
+ <property name="Key">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/EnumeratorMode.xml b/mcs/docs/apidocs/xml/en/System.Collections/EnumeratorMode.xml
new file mode 100644
index 00000000000..8515eb3742f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/EnumeratorMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Collections.SortedList+EnumeratorMode" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/Hashtable.xml b/mcs/docs/apidocs/xml/en/System.Collections/Hashtable.xml
new file mode 100644
index 00000000000..03b8ccd913d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/Hashtable.xml
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.Hashtable" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="EnumeratorMode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Int32, System.Single, System.Collections.IHashCodeProvider, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ <param name="loadFactor">TODO</param>
+ <param name="hcp">TODO</param>
+ <param name="comparer">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Int32, System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ <param name="loadFactor">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Int32, System.Collections.IHashCodeProvider, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ <param name="hcp">TODO</param>
+ <param name="comparer">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Collections.IDictionary, System.Single, System.Collections.IHashCodeProvider, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <param name="loadFactor">TODO</param>
+ <param name="hcp">TODO</param>
+ <param name="comparer">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Collections.IDictionary, System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <param name="loadFactor">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Collections.IDictionary)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Collections.IDictionary, System.Collections.IHashCodeProvider, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <param name="hcp">TODO</param>
+ <param name="comparer">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Collections.IHashCodeProvider, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hcp">TODO</param>
+ <param name="comparer">TODO</param>
+ </constructor>
+ <property name="comparer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="hcp">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Keys">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Values">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="OnDeserialization(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="sender">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="arrayIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ContainsValue(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ContainsKey(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Synchronized(System.Collections.Hashtable)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="table">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/ICollection.xml b/mcs/docs/apidocs/xml/en/System.Collections/ICollection.xml
new file mode 100644
index 00000000000..2d0140d7f18
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/ICollection.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Collections.ICollection" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/IComparer.xml b/mcs/docs/apidocs/xml/en/System.Collections/IComparer.xml
new file mode 100644
index 00000000000..80fe52dbe49
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/IComparer.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Collections.IComparer" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/IDictionary.xml b/mcs/docs/apidocs/xml/en/System.Collections/IDictionary.xml
new file mode 100644
index 00000000000..6ac8a6bf6ef
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/IDictionary.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Collections.IDictionary" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/IDictionaryEnumerator.xml b/mcs/docs/apidocs/xml/en/System.Collections/IDictionaryEnumerator.xml
new file mode 100644
index 00000000000..92c12957f48
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/IDictionaryEnumerator.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Collections.IDictionaryEnumerator" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/IEnumerable.xml b/mcs/docs/apidocs/xml/en/System.Collections/IEnumerable.xml
new file mode 100644
index 00000000000..5a2e568d0ed
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/IEnumerable.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Collections.IEnumerable" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/IEnumerator.xml b/mcs/docs/apidocs/xml/en/System.Collections/IEnumerator.xml
new file mode 100644
index 00000000000..1b21234fc49
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/IEnumerator.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Collections.IEnumerator" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/IHashCodeProvider.xml b/mcs/docs/apidocs/xml/en/System.Collections/IHashCodeProvider.xml
new file mode 100644
index 00000000000..333254394f0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/IHashCodeProvider.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Collections.IHashCodeProvider" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/IList.xml b/mcs/docs/apidocs/xml/en/System.Collections/IList.xml
new file mode 100644
index 00000000000..1688ccb2848
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/IList.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Collections.IList" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/Queue.xml b/mcs/docs/apidocs/xml/en/System.Collections/Queue.xml
new file mode 100644
index 00000000000..bd61d3aff3e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/Queue.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.Queue" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Queue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="Queue(System.Collections.ICollection)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="collection">TODO</param>
+ </constructor>
+ <constructor name="Queue(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="initialCapacity">TODO</param>
+ </constructor>
+ <constructor name="Queue(System.Int32, System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="initialCapacity">TODO</param>
+ <param name="growFactor">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToArray">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Peek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Enqueue(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Dequeue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Synchronized(System.Collections.Queue)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="queue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/ReadOnlyCollectionBase.xml b/mcs/docs/apidocs/xml/en/System.Collections/ReadOnlyCollectionBase.xml
new file mode 100644
index 00000000000..fe75e6e9964
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/ReadOnlyCollectionBase.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.ReadOnlyCollectionBase" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/SortedList.xml b/mcs/docs/apidocs/xml/en/System.Collections/SortedList.xml
new file mode 100644
index 00000000000..e9e3f80c1d1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/SortedList.xml
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.SortedList" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="EnumeratorMode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="initialCapacity">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Collections.IComparer, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="comparer">TODO</param>
+ <param name="initialCapacity">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="comparer">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Collections.IDictionary)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ </constructor>
+ <constructor name="EnumeratorMode(System.Collections.IDictionary, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <param name="comparer">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Keys">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Values">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Capacity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="arrayIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TrimToSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetKey(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetByIndex(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetByIndex(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ContainsValue(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ContainsKey(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOfValue(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOfKey(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValueList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetKeyList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Synchronized(System.Collections.SortedList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="list">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Collections/Stack.xml b/mcs/docs/apidocs/xml/en/System.Collections/Stack.xml
new file mode 100644
index 00000000000..e45abc3472e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Collections/Stack.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Collections.Stack" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Stack">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="Stack(System.Collections.ICollection)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="collection">TODO</param>
+ </constructor>
+ <constructor name="Stack(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToArray">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Push(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Pop">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Peek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Synchronized(System.Collections.Stack)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/BrowsableAttribute.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/BrowsableAttribute.xml
new file mode 100644
index 00000000000..39f3d383dc7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/BrowsableAttribute.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.BrowsableAttribute" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="BrowsableAttribute(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="browsable">TODO</param>
+ </constructor>
+ <field name="No">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Yes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Browsable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/CategoryAttribute.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/CategoryAttribute.xml
new file mode 100644
index 00000000000..e2e2fb20da1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/CategoryAttribute.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.CategoryAttribute" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CategoryAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="category">TODO</param>
+ </constructor>
+ <constructor name="CategoryAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Category">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Action">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Appearance">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Behaviour">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Default">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Design">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DragDrop">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Focus">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Format">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Key">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Layout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Mouse">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="WindowStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/Component.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/Component.xml
new file mode 100644
index 00000000000..134113aecac
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/Component.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.Component" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Component">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Container">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DesignMode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Events">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Site">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <event name="Disposed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/ComponentCollection.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/ComponentCollection.xml
new file mode 100644
index 00000000000..0ba0c3930a9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/ComponentCollection.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.ComponentCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ComponentCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/Container.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/Container.xml
new file mode 100644
index 00000000000..962bed57f6e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/Container.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.Container" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Container">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Components">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.ComponentModel.IComponent)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="component">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.ComponentModel.IComponent, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="component">TODO</param>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.ComponentModel.IComponent)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="component">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/DescriptionAttribute.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/DescriptionAttribute.xml
new file mode 100644
index 00000000000..e459b406927
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/DescriptionAttribute.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.DescriptionAttribute" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DescriptionAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <constructor name="DescriptionAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Description">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DescriptionValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/DesignOnlyAttribute.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/DesignOnlyAttribute.xml
new file mode 100644
index 00000000000..426cc021f6e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/DesignOnlyAttribute.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.DesignOnlyAttribute" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DesignOnlyAttribute(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="design_only">TODO</param>
+ </constructor>
+ <field name="No">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Yes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="IsDesignOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/DesignerSerializationVisibility.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/DesignerSerializationVisibility.xml
new file mode 100644
index 00000000000..80e8b5a3631
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/DesignerSerializationVisibility.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.ComponentModel.DesignerSerializationVisibility" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/DesignerSerializationVisibilityAttribute.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/DesignerSerializationVisibilityAttribute.xml
new file mode 100644
index 00000000000..6d47e78f9d7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/DesignerSerializationVisibilityAttribute.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.DesignerSerializationVisibilityAttribute" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="vis">TODO</param>
+ </constructor>
+ <field name="Content">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Hidden">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Visible">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Visibility">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/EventHandlerList.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/EventHandlerList.xml
new file mode 100644
index 00000000000..0f0e46f70ed
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/EventHandlerList.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.EventHandlerList" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="EventHandlerList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddHandler(System.Object, System.Delegate)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveHandler(System.Object, System.Delegate)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/IComponent.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/IComponent.xml
new file mode 100644
index 00000000000..3b1b0c84faa
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/IComponent.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.ComponentModel.IComponent" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/IContainer.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/IContainer.xml
new file mode 100644
index 00000000000..c41ef2cce1a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/IContainer.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.ComponentModel.IContainer" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/ISite.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/ISite.xml
new file mode 100644
index 00000000000..56352c9374a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/ISite.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.ComponentModel.ISite" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/LocalizableAttribute.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/LocalizableAttribute.xml
new file mode 100644
index 00000000000..e387b6a0981
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/LocalizableAttribute.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.LocalizableAttribute" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="LocalizableAttribute(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localizable">TODO</param>
+ </constructor>
+ <field name="No">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Yes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="IsLocalizable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/MemberDescriptor.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/MemberDescriptor.xml
new file mode 100644
index 00000000000..98e3d772c2b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/MemberDescriptor.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.MemberDescriptor" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="AttributeArray">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Category">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Description">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DesignTimeOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DisplayName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsBrowsable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NameHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/PropertyDescriptor.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/PropertyDescriptor.xml
new file mode 100644
index 00000000000..d7c40c5910b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/PropertyDescriptor.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.PropertyDescriptor" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="ComponentType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Converter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsLocalizable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PropertyType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SerializationVisibility">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="AddValueChanged(System.Object, System.EventHandler)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="component">TODO</param>
+ <param name="handler">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/TypeConverter.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/TypeConverter.xml
new file mode 100644
index 00000000000..9b5c8a93e4d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/TypeConverter.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.TypeConverter" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TypeConverter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.ComponentModel/Win32Exception.xml b/mcs/docs/apidocs/xml/en/System.ComponentModel/Win32Exception.xml
new file mode 100644
index 00000000000..3f32bfa828e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.ComponentModel/Win32Exception.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ComponentModel.Win32Exception" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Win32Exception">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="Win32Exception(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="error">TODO</param>
+ </constructor>
+ <constructor name="Win32Exception(System.Int32, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="error">TODO</param>
+ <param name="message">TODO</param>
+ </constructor>
+ <property name="NativeErrorCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyHash.xml b/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyHash.xml
new file mode 100644
index 00000000000..233449aaf6b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyHash.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Configuration.Assemblies.AssemblyHash" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyHash(System.Configuration.Assemblies.AssemblyHashAlgorithm, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="algorithm">TODO</param>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="AssemblyHash(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Algorithm">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetValue(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyHashAlgorithm.xml b/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyHashAlgorithm.xml
new file mode 100644
index 00000000000..8cdf7a2e1a3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyHashAlgorithm.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Configuration.Assemblies.AssemblyHashAlgorithm" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyVersionCompatibility.xml b/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyVersionCompatibility.xml
new file mode 100644
index 00000000000..cb17e7340de
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/AssemblyVersionCompatibility.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Configuration.Assemblies.AssemblyVersionCompatibility" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/ProcessorID.xml b/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/ProcessorID.xml
new file mode 100644
index 00000000000..95829b3800a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Configuration.Assemblies/ProcessorID.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Configuration.Assemblies.ProcessorID" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Configuration/ConfigurationException.xml b/mcs/docs/apidocs/xml/en/System.Configuration/ConfigurationException.xml
new file mode 100644
index 00000000000..b2bba67364f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Configuration/ConfigurationException.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Configuration.ConfigurationException" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ConfigurationException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ConfigurationException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ConfigurationException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <constructor name="ConfigurationException(System.String, System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="node">TODO</param>
+ </constructor>
+ <constructor name="ConfigurationException(System.String, System.Exception, System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ <param name="node">TODO</param>
+ </constructor>
+ <constructor name="ConfigurationException(System.String, System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="filename">TODO</param>
+ <param name="line">TODO</param>
+ </constructor>
+ <constructor name="ConfigurationException(System.String, System.Exception, System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ <param name="filename">TODO</param>
+ <param name="line">TODO</param>
+ </constructor>
+ <property name="BareMessage">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Filename">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Line">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Message">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetXmlNodeFilename(System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="node">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetXmlNodeLineNumber(System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="node">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Configuration/ConfigurationSettings.xml b/mcs/docs/apidocs/xml/en/System.Configuration/ConfigurationSettings.xml
new file mode 100644
index 00000000000..d65c097ebe6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Configuration/ConfigurationSettings.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Configuration.ConfigurationSettings" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="AppSettings">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetConfig(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="sectionName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Configuration/DictionarySectionHandler.xml b/mcs/docs/apidocs/xml/en/System.Configuration/DictionarySectionHandler.xml
new file mode 100644
index 00000000000..1a6bb2c81d2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Configuration/DictionarySectionHandler.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Configuration.DictionarySectionHandler" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DictionarySectionHandler">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="KeyAttributeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ValueAttributeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Create(System.Object, System.Object, System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parent">TODO</param>
+ <param name="context">TODO</param>
+ <param name="section">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Configuration/IConfigurationSectionHandler.xml b/mcs/docs/apidocs/xml/en/System.Configuration/IConfigurationSectionHandler.xml
new file mode 100644
index 00000000000..7109e0931a8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Configuration/IConfigurationSectionHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Configuration.IConfigurationSectionHandler" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Configuration/IgnoreSectionHandler.xml b/mcs/docs/apidocs/xml/en/System.Configuration/IgnoreSectionHandler.xml
new file mode 100644
index 00000000000..e297b7a77a6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Configuration/IgnoreSectionHandler.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Configuration.IgnoreSectionHandler" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IgnoreSectionHandler">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Create(System.Object, System.Object, System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parent">TODO</param>
+ <param name="configContext">TODO</param>
+ <param name="section">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Configuration/NameValueSectionHandler.xml b/mcs/docs/apidocs/xml/en/System.Configuration/NameValueSectionHandler.xml
new file mode 100644
index 00000000000..c55186a1bb1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Configuration/NameValueSectionHandler.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Configuration.NameValueSectionHandler" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NameValueSectionHandler">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="KeyAttributeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ValueAttributeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Create(System.Object, System.Object, System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parent">TODO</param>
+ <param name="context">TODO</param>
+ <param name="section">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Configuration/SingleTagSectionHandler.xml b/mcs/docs/apidocs/xml/en/System.Configuration/SingleTagSectionHandler.xml
new file mode 100644
index 00000000000..46a2dddb41e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Configuration/SingleTagSectionHandler.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Configuration.SingleTagSectionHandler" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SingleTagSectionHandler">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Create(System.Object, System.Object, System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parent">TODO</param>
+ <param name="context">TODO</param>
+ <param name="section">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/AcceptRejectRule.xml b/mcs/docs/apidocs/xml/en/System.Data/AcceptRejectRule.xml
new file mode 100644
index 00000000000..f2e691f0586
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/AcceptRejectRule.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.AcceptRejectRule" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/CommandBehavior.xml b/mcs/docs/apidocs/xml/en/System.Data/CommandBehavior.xml
new file mode 100644
index 00000000000..bf85abfdaef
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/CommandBehavior.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.CommandBehavior" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/CommandType.xml b/mcs/docs/apidocs/xml/en/System.Data/CommandType.xml
new file mode 100644
index 00000000000..f26c16afa37
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/CommandType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.CommandType" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/ConnectionState.xml b/mcs/docs/apidocs/xml/en/System.Data/ConnectionState.xml
new file mode 100644
index 00000000000..6d908a83e9c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/ConnectionState.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.ConnectionState" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/DataColumnChangeEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Data/DataColumnChangeEventArgs.xml
new file mode 100644
index 00000000000..e677fed9724
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/DataColumnChangeEventArgs.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Data.DataColumnChangeEventArgs" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataColumnChangeEventArgs(System.Data.DataRow, System.Data.DataColumn, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="row">TODO</param>
+ <param name="column">TODO</param>
+ <param name="value">TODO</param>
+ </constructor>
+ <property name="Column">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProposedValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Row">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/DataColumnChangeEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Data/DataColumnChangeEventHandler.xml
new file mode 100644
index 00000000000..b64826ff7d1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/DataColumnChangeEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Data.DataColumnChangeEventHandler" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/DataColumnCollection.xml b/mcs/docs/apidocs/xml/en/System.Data/DataColumnCollection.xml
new file mode 100644
index 00000000000..730c7f4f2af
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/DataColumnCollection.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Data.DataColumnCollection" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="List">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="IndexOf(System.Data.DataColumn)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="column">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String, System.Type, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="columnName">TODO</param>
+ <param name="type">TODO</param>
+ <param name="expression">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="columnName">TODO</param>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="columnName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Data.DataColumn)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="column">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.Data.DataColumn[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="columns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CanRemove(System.Data.DataColumn)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="column">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="columnName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Data.DataColumn)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="column">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <event name="CollectionChanged">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/DataRowAction.xml b/mcs/docs/apidocs/xml/en/System.Data/DataRowAction.xml
new file mode 100644
index 00000000000..0a8c6853d90
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/DataRowAction.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.DataRowAction" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/DataRowChangeEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Data/DataRowChangeEventHandler.xml
new file mode 100644
index 00000000000..a117750af16
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/DataRowChangeEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Data.DataRowChangeEventHandler" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/DataRowState.xml b/mcs/docs/apidocs/xml/en/System.Data/DataRowState.xml
new file mode 100644
index 00000000000..b0ab018917b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/DataRowState.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.DataRowState" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/DataRowVersion.xml b/mcs/docs/apidocs/xml/en/System.Data/DataRowVersion.xml
new file mode 100644
index 00000000000..30a1c714767
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/DataRowVersion.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.DataRowVersion" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/DataViewRowState.xml b/mcs/docs/apidocs/xml/en/System.Data/DataViewRowState.xml
new file mode 100644
index 00000000000..049c21032b1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/DataViewRowState.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.DataViewRowState" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/DbType.xml b/mcs/docs/apidocs/xml/en/System.Data/DbType.xml
new file mode 100644
index 00000000000..2de868e090a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/DbType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.DbType" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/FillErrorEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Data/FillErrorEventHandler.xml
new file mode 100644
index 00000000000..1d072a5d68e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/FillErrorEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Data.FillErrorEventHandler" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IColumnMapping.xml b/mcs/docs/apidocs/xml/en/System.Data/IColumnMapping.xml
new file mode 100644
index 00000000000..b9e5b505955
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IColumnMapping.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IColumnMapping" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IColumnMappingCollection.xml b/mcs/docs/apidocs/xml/en/System.Data/IColumnMappingCollection.xml
new file mode 100644
index 00000000000..e60cca139a3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IColumnMappingCollection.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IColumnMappingCollection" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IDBCommand.xml b/mcs/docs/apidocs/xml/en/System.Data/IDBCommand.xml
new file mode 100644
index 00000000000..654519a85dd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IDBCommand.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IDBCommand" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IDBConnection.xml b/mcs/docs/apidocs/xml/en/System.Data/IDBConnection.xml
new file mode 100644
index 00000000000..4f1a37dbdf1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IDBConnection.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IDBConnection" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IDataAdapter.xml b/mcs/docs/apidocs/xml/en/System.Data/IDataAdapter.xml
new file mode 100644
index 00000000000..45e921c3cc2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IDataAdapter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IDataAdapter" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IDataParameter.xml b/mcs/docs/apidocs/xml/en/System.Data/IDataParameter.xml
new file mode 100644
index 00000000000..fe855c9a99c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IDataParameter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IDataParameter" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IDataParameterCollection.xml b/mcs/docs/apidocs/xml/en/System.Data/IDataParameterCollection.xml
new file mode 100644
index 00000000000..8c42ad49474
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IDataParameterCollection.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IDataParameterCollection" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IDataReader.xml b/mcs/docs/apidocs/xml/en/System.Data/IDataReader.xml
new file mode 100644
index 00000000000..b1f02cd7a1a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IDataReader.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IDataReader" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IDataRecord.xml b/mcs/docs/apidocs/xml/en/System.Data/IDataRecord.xml
new file mode 100644
index 00000000000..fb5636d770e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IDataRecord.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IDataRecord" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IDbDataAdapter.xml b/mcs/docs/apidocs/xml/en/System.Data/IDbDataAdapter.xml
new file mode 100644
index 00000000000..d4b6117ccee
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IDbDataAdapter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IDbDataAdapter" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IDbDataParameter.xml b/mcs/docs/apidocs/xml/en/System.Data/IDbDataParameter.xml
new file mode 100644
index 00000000000..a2c0a569d03
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IDbDataParameter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IDbDataParameter" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IDbTransaction.xml b/mcs/docs/apidocs/xml/en/System.Data/IDbTransaction.xml
new file mode 100644
index 00000000000..f0d467db7bf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IDbTransaction.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.IDbTransaction" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/ITableMapping.xml b/mcs/docs/apidocs/xml/en/System.Data/ITableMapping.xml
new file mode 100644
index 00000000000..fa2c1704357
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/ITableMapping.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.ITableMapping" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/ITableMappingCollection.xml b/mcs/docs/apidocs/xml/en/System.Data/ITableMappingCollection.xml
new file mode 100644
index 00000000000..5c08fdec75b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/ITableMappingCollection.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Data.ITableMappingCollection" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/IsolationLevel.xml b/mcs/docs/apidocs/xml/en/System.Data/IsolationLevel.xml
new file mode 100644
index 00000000000..0effdb7b0d1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/IsolationLevel.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.IsolationLevel" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/MappingType.xml b/mcs/docs/apidocs/xml/en/System.Data/MappingType.xml
new file mode 100644
index 00000000000..9de6778792c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/MappingType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.MappingType" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/MergeFailedEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Data/MergeFailedEventHandler.xml
new file mode 100644
index 00000000000..fec6b1537a8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/MergeFailedEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Data.MergeFailedEventHandler" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/MissingMappingAction.xml b/mcs/docs/apidocs/xml/en/System.Data/MissingMappingAction.xml
new file mode 100644
index 00000000000..8c1a6366783
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/MissingMappingAction.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.MissingMappingAction" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/MissingSchemaAction.xml b/mcs/docs/apidocs/xml/en/System.Data/MissingSchemaAction.xml
new file mode 100644
index 00000000000..7b8fc38f10e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/MissingSchemaAction.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.MissingSchemaAction" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/ParameterDirection.xml b/mcs/docs/apidocs/xml/en/System.Data/ParameterDirection.xml
new file mode 100644
index 00000000000..d4fc5bcfaa0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/ParameterDirection.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.ParameterDirection" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/PropertyAttributes.xml b/mcs/docs/apidocs/xml/en/System.Data/PropertyAttributes.xml
new file mode 100644
index 00000000000..618b6166390
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/PropertyAttributes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.PropertyAttributes" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/Rule.xml b/mcs/docs/apidocs/xml/en/System.Data/Rule.xml
new file mode 100644
index 00000000000..ed0162ab860
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/Rule.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.Rule" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/SchemaType.xml b/mcs/docs/apidocs/xml/en/System.Data/SchemaType.xml
new file mode 100644
index 00000000000..b68a372ceb7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/SchemaType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.SchemaType" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/SqlDbType.xml b/mcs/docs/apidocs/xml/en/System.Data/SqlDbType.xml
new file mode 100644
index 00000000000..7b126ae8c3c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/SqlDbType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.SqlDbType" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/StateChangeEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Data/StateChangeEventHandler.xml
new file mode 100644
index 00000000000..32ec8625f60
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/StateChangeEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Data.StateChangeEventHandler" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/StatementType.xml b/mcs/docs/apidocs/xml/en/System.Data/StatementType.xml
new file mode 100644
index 00000000000..f43605df5be
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/StatementType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.StatementType" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/UpdateRowSource.xml b/mcs/docs/apidocs/xml/en/System.Data/UpdateRowSource.xml
new file mode 100644
index 00000000000..8961d90d9de
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/UpdateRowSource.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.UpdateRowSource" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/UpdateStatus.xml b/mcs/docs/apidocs/xml/en/System.Data/UpdateStatus.xml
new file mode 100644
index 00000000000..11e01b1fa1c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/UpdateStatus.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.UpdateStatus" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/XmlReadMode.xml b/mcs/docs/apidocs/xml/en/System.Data/XmlReadMode.xml
new file mode 100644
index 00000000000..89cee021213
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/XmlReadMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.XmlReadMode" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Data/XmlWriteMode.xml b/mcs/docs/apidocs/xml/en/System.Data/XmlWriteMode.xml
new file mode 100644
index 00000000000..c75e22b1975
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Data/XmlWriteMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Data.XmlWriteMode" assembly="System.Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolBinder.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolBinder.xml
new file mode 100644
index 00000000000..115912ea214
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolBinder.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Diagnostics.SymbolStore.ISymbolBinder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolDocument.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolDocument.xml
new file mode 100644
index 00000000000..38a65b583d9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolDocument.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Diagnostics.SymbolStore.ISymbolDocument" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.xml
new file mode 100644
index 00000000000..6dc28c91683
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolDocumentWriter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Diagnostics.SymbolStore.ISymbolDocumentWriter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolMethod.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolMethod.xml
new file mode 100644
index 00000000000..9f6db0c68dd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolMethod.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Diagnostics.SymbolStore.ISymbolMethod" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolNamespace.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolNamespace.xml
new file mode 100644
index 00000000000..44deb236b5a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolNamespace.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Diagnostics.SymbolStore.ISymbolNamespace" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolReader.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolReader.xml
new file mode 100644
index 00000000000..2146f6de489
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolReader.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Diagnostics.SymbolStore.ISymbolReader" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolScope.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolScope.xml
new file mode 100644
index 00000000000..404d17a0f1e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolScope.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Diagnostics.SymbolStore.ISymbolScope" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolVariable.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolVariable.xml
new file mode 100644
index 00000000000..01a88418d55
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolVariable.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Diagnostics.SymbolStore.ISymbolVariable" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolWriter.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolWriter.xml
new file mode 100644
index 00000000000..3c95ae985e1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/ISymbolWriter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Diagnostics.SymbolStore.ISymbolWriter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymAddressKind.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymAddressKind.xml
new file mode 100644
index 00000000000..f2af6e6c6d7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymAddressKind.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Diagnostics.SymbolStore.SymAddressKind" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymDocumentType.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymDocumentType.xml
new file mode 100644
index 00000000000..6574e80fd54
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymDocumentType.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.SymbolStore.SymDocumentType" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SymDocumentType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymLanguageType.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymLanguageType.xml
new file mode 100644
index 00000000000..61aa8365b89
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymLanguageType.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.SymbolStore.SymLanguageType" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SymLanguageType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="Basic">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="C">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Cobol">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="CPlusPlus">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="CSharp">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="ILAssembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Java">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="JScript">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MCPlusPlus">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Pascal">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SMC">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymLanguageVendor.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymLanguageVendor.xml
new file mode 100644
index 00000000000..1921c6fd94d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymLanguageVendor.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.SymbolStore.SymLanguageVendor" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SymLanguageVendor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="Microsoft">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymbolToken.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymbolToken.xml
new file mode 100644
index 00000000000..4e770fca04f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics.SymbolStore/SymbolToken.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Diagnostics.SymbolStore.SymbolToken" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SymbolToken(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ </constructor>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetToken">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/BooleanSwitch.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/BooleanSwitch.xml
new file mode 100644
index 00000000000..b436e63d16e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/BooleanSwitch.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.BooleanSwitch" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="BooleanSwitch(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="displayName">TODO</param>
+ <param name="description">TODO</param>
+ </constructor>
+ <property name="Enabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/ConditionalAttribute.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/ConditionalAttribute.xml
new file mode 100644
index 00000000000..38122a680ca
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/ConditionalAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.ConditionalAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ConditionalAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conditionString">TODO</param>
+ </constructor>
+ <property name="ConditionString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/Debug.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/Debug.xml
new file mode 100644
index 00000000000..6f3597b43dd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/Debug.xml
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.Debug" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="AutoFlush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IndentLevel">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IndentSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Listeners">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Assert(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Assert(System.Boolean, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Assert(System.Boolean, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <param name="detailMessage">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Fail(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Fail(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="detailMessage">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Indent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Unindent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Object, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteIf(System.Boolean, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteIf(System.Boolean, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteIf(System.Boolean, System.Object, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="value">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteIf(System.Boolean, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Object, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLineIf(System.Boolean, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLineIf(System.Boolean, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLineIf(System.Boolean, System.Object, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="value">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLineIf(System.Boolean, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggableAttribute.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggableAttribute.xml
new file mode 100644
index 00000000000..8a0e6cbc5eb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggableAttribute.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.DebuggableAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DebuggableAttribute(System.Boolean, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="isJITTrackingEnabled">TODO</param>
+ <param name="isJITOptimizerDisabled">TODO</param>
+ </constructor>
+ <property name="IsJITTrackingEnabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsJITOptimizerDisabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/Debugger.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/Debugger.xml
new file mode 100644
index 00000000000..c67b1655518
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/Debugger.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.Debugger" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Debugger">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="DefaultCategory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="IsAttached">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Break">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLogging">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Launch">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Log(System.Int32, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <param name="category">TODO</param>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggerHiddenAttribute.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggerHiddenAttribute.xml
new file mode 100644
index 00000000000..a09c3842390
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggerHiddenAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.DebuggerHiddenAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DebuggerHiddenAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggerStepThroughAttribute.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggerStepThroughAttribute.xml
new file mode 100644
index 00000000000..c0b79ccbd8d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/DebuggerStepThroughAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.DebuggerStepThroughAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DebuggerStepThroughAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/DefaultTraceListener.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/DefaultTraceListener.xml
new file mode 100644
index 00000000000..2d1cfc4ec70
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/DefaultTraceListener.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.DefaultTraceListener" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DefaultTraceListener">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AssertUiEnabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LogFileName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteLine(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Fail(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="detailMessage">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Fail(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/DiagnosticsConfigurationHandler.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/DiagnosticsConfigurationHandler.xml
new file mode 100644
index 00000000000..bd9d208735b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/DiagnosticsConfigurationHandler.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.DiagnosticsConfigurationHandler" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DiagnosticsConfigurationHandler">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Create(System.Object, System.Object, System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parent">TODO</param>
+ <param name="configContext">TODO</param>
+ <param name="section">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/FileVersionInfo.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/FileVersionInfo.xml
new file mode 100644
index 00000000000..273c6e1acdc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/FileVersionInfo.xml
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.FileVersionInfo" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FileVersionInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Comments">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CompanyName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FileBuildPart">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FileDescription">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FileMajorPart">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FileMinorPart">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FileName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FilePrivatePart">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FileVersion">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InternalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsDebug">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsPatched">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsPreRelease">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsPrivateBuild">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSpecialBuild">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Language">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LegalCopyright">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LegalTrademarks">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OriginalFilename">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PrivateBuild">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProductBuildPart">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProductMajorPart">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProductMinorPart">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProductName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProductPrivatePart">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProductVersion">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SpecialBuild">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetVersionInfo(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/Process.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/Process.xml
new file mode 100644
index 00000000000..5b09088540a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/Process.xml
@@ -0,0 +1,340 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.Process" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Process">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BasePriority">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EnableRaisingEvents">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ExitCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ExitTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Handle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HandleCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasExited">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Id">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MachineName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MainModule">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MainWindowHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MainWindowTitle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MaxWorkingSet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MinWorkingSet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Modules">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NonpagedSystemMemorySize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PagedMemorySize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PagedSystemMemorySize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PeakPagedMemorySize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PeakVirtualMemorySize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PeakWorkingSet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PriorityBoostEnabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PriorityClass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PrivateMemorySize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PrivilegedProcessorTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProcessName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProcessorAffinity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Responding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="StandardError">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="StandardInput">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="StandardOutput">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="StartInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="StartTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SynchronizingObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Threads">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TotalProcessorTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UserProcessorTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="VirtualMemorySize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="WorkingSet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloseMainWindow">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="EnterDebugMode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCurrentProcess">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProcessById(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="processId">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProcessById(System.Int32, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="processId">TODO</param>
+ <param name="machineName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProcesses">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProcesses(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="machineName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProcessesByName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="processName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProcessesByName(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="processName">TODO</param>
+ <param name="machineName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Kill">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="LeaveDebugMode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Refresh">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Start">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Start(System.Diagnostics.ProcessStartInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="startInfo">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Start(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Start(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileName">TODO</param>
+ <param name="arguments">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitForExit">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitForExit(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="milliseconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitForInputIdle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitForInputIdle(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="milliseconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <event name="Exited">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/ProcessModule.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/ProcessModule.xml
new file mode 100644
index 00000000000..9aac6ffaa38
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/ProcessModule.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.ProcessModule" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ProcessModule">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BaseAddress">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EntryPointAddress">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FileName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FileVersionInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ModuleMemorySize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ModuleName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/ProcessPriorityClass.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/ProcessPriorityClass.xml
new file mode 100644
index 00000000000..ae60fedc540
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/ProcessPriorityClass.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Diagnostics.ProcessPriorityClass" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/StackFrame.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/StackFrame.xml
new file mode 100644
index 00000000000..66c76a28ca3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/StackFrame.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.StackFrame" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StackFrame">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="StackFrame(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="needFileInfo">TODO</param>
+ </constructor>
+ <constructor name="StackFrame(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="skipFrames">TODO</param>
+ </constructor>
+ <constructor name="StackFrame(System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="skipFrames">TODO</param>
+ <param name="needFileInfo">TODO</param>
+ </constructor>
+ <constructor name="StackFrame(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileName">TODO</param>
+ <param name="lineNumber">TODO</param>
+ </constructor>
+ <constructor name="StackFrame(System.String, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileName">TODO</param>
+ <param name="lineNumber">TODO</param>
+ <param name="colNumber">TODO</param>
+ </constructor>
+ <field name="OFFSET_UNKNOWN">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="GetNativeOffset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethod">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetILOffset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFileName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFileColumnNumber">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFileLineNumber">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/StackTrace.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/StackTrace.xml
new file mode 100644
index 00000000000..128664384a3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/StackTrace.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.StackTrace" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StackTrace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="StackTrace(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="needFileInfo">TODO</param>
+ </constructor>
+ <constructor name="StackTrace(System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ </constructor>
+ <constructor name="StackTrace(System.Exception, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <param name="needFileInfo">TODO</param>
+ </constructor>
+ <constructor name="StackTrace(System.Exception, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <param name="skipFrames">TODO</param>
+ </constructor>
+ <constructor name="StackTrace(System.Exception, System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <param name="skipFrames">TODO</param>
+ <param name="needFileInfo">TODO</param>
+ </constructor>
+ <constructor name="StackTrace(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="skipFrames">TODO</param>
+ </constructor>
+ <constructor name="StackTrace(System.Diagnostics.StackFrame)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="frame">TODO</param>
+ </constructor>
+ <constructor name="StackTrace(System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="skipFrames">TODO</param>
+ <param name="needFileInfo">TODO</param>
+ </constructor>
+ <constructor name="StackTrace(System.Threading.Thread, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="targetThread">TODO</param>
+ <param name="needFileInfo">TODO</param>
+ </constructor>
+ <field name="METHODS_TO_SKIP">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="FrameCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetFrame(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/Switch.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/Switch.xml
new file mode 100644
index 00000000000..af94de5c1e8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/Switch.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.Switch" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Description">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DisplayName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SwitchSetting">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/TextWriterTraceListener.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/TextWriterTraceListener.xml
new file mode 100644
index 00000000000..a6fd9e20ca8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/TextWriterTraceListener.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.TextWriterTraceListener" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TextWriterTraceListener">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="TextWriterTraceListener(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ </constructor>
+ <constructor name="TextWriterTraceListener(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileName">TODO</param>
+ </constructor>
+ <constructor name="TextWriterTraceListener(System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ </constructor>
+ <constructor name="TextWriterTraceListener(System.IO.Stream, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <param name="name">TODO</param>
+ </constructor>
+ <constructor name="TextWriterTraceListener(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileName">TODO</param>
+ <param name="name">TODO</param>
+ </constructor>
+ <constructor name="TextWriterTraceListener(System.IO.TextWriter, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <param name="name">TODO</param>
+ </constructor>
+ <property name="Writer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteLine(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/Trace.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/Trace.xml
new file mode 100644
index 00000000000..222411108ad
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/Trace.xml
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.Trace" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="AutoFlush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IndentLevel">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IndentSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Listeners">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Assert(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Assert(System.Boolean, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Assert(System.Boolean, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <param name="detailMessage">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Fail(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Fail(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="detailMessage">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Indent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Unindent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Object, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteIf(System.Boolean, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteIf(System.Boolean, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteIf(System.Boolean, System.Object, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="value">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteIf(System.Boolean, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Object, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLineIf(System.Boolean, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLineIf(System.Boolean, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLineIf(System.Boolean, System.Object, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="value">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLineIf(System.Boolean, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="condition">TODO</param>
+ <param name="message">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceLevel.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceLevel.xml
new file mode 100644
index 00000000000..aab8e5a1b60
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceLevel.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Diagnostics.TraceLevel" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceListener.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceListener.xml
new file mode 100644
index 00000000000..f0c8738ed35
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceListener.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.TraceListener" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="IndentLevel">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IndentSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NeedIndent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Object, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Object, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <param name="category">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Fail(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="detailMessage">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Fail(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceListenerCollection.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceListenerCollection.xml
new file mode 100644
index 00000000000..4bb0cbf7205
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceListenerCollection.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.TraceListenerCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Diagnostics.TraceListener)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="listener">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.Diagnostics.TraceListener[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.Diagnostics.TraceListenerCollection)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Diagnostics.TraceListener)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="listener">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Diagnostics.TraceListener[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="listeners">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Diagnostics.TraceListener)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="listener">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Diagnostics.TraceListener)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="listener">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Diagnostics.TraceListener)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="listener">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceSwitch.xml b/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceSwitch.xml
new file mode 100644
index 00000000000..432f84d80de
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Diagnostics/TraceSwitch.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Diagnostics.TraceSwitch" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TraceSwitch(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="displayName">TODO</param>
+ <param name="description">TODO</param>
+ </constructor>
+ <property name="Level">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TraceError">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TraceInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TraceVerbose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TraceWarning">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/CCGregorianEraHandler.xml b/mcs/docs/apidocs/xml/en/System.Globalization/CCGregorianEraHandler.xml
new file mode 100644
index 00000000000..f87a6eb2f34
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/CCGregorianEraHandler.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.CCGregorianEraHandler" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CCGregorianEraHandler">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Eras">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="appendEra(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nr">TODO</param>
+ <param name="rd_start">TODO</param>
+ <param name="rd_end">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="appendEra(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nr">TODO</param>
+ <param name="rd_start">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GregorianYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EraYear(System.Int32&amp;, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="era">TODO</param>
+ <param name="date">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CheckDateTime(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ValidDate(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="date">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ValidEra(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/CCHijriCalendar.xml b/mcs/docs/apidocs/xml/en/System.Globalization/CCHijriCalendar.xml
new file mode 100644
index 00000000000..b9f072d73d2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/CCHijriCalendar.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.CCHijriCalendar" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Month">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="is_leap_year(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="fixed_from_dmy(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="day">TODO</param>
+ <param name="month">TODO</param>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="year_from_fixed(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="date">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="my_from_fixed(System.Int32&amp;, System.Int32&amp;, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="month">TODO</param>
+ <param name="year">TODO</param>
+ <param name="date">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="dmy_from_fixed(System.Int32&amp;, System.Int32&amp;, System.Int32&amp;, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="day">TODO</param>
+ <param name="month">TODO</param>
+ <param name="year">TODO</param>
+ <param name="date">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="month_from_fixed(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="date">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="day_from_fixed(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="date">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="date_difference(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dayA">TODO</param>
+ <param name="monthA">TODO</param>
+ <param name="yearA">TODO</param>
+ <param name="dayB">TODO</param>
+ <param name="monthB">TODO</param>
+ <param name="yearB">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="day_number(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="day">TODO</param>
+ <param name="month">TODO</param>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="days_remaining(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="day">TODO</param>
+ <param name="month">TODO</param>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/Calendar.xml b/mcs/docs/apidocs/xml/en/System.Globalization/Calendar.xml
new file mode 100644
index 00000000000..7e3fa317545
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/Calendar.xml
@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.Calendar" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="CurrentEra">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="M_DaysInWeek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Eras">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="M_MaxYear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TwoDigitYearMax">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AbbreviatedEraNames">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EraNames">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToFourDigitYear(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapYear(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapMonth(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapDay(System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapDay(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetWeekOfYear(System.DateTime, System.Globalization.CalendarWeekRule, System.DayOfWeek)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="rule">TODO</param>
+ <param name="firstDayOfWeek">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSecond(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonthsInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonthsInYear(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMinute(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMilliseconds(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHour(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEra(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInYear(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInMonth(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfWeek(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddYears(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="years">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddWeeks(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="weeks">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddSeconds(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="seconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMonths(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="months">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMinutes(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="minutes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMilliseconds(System.DateTime, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddHours(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="hours">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddDays(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="days">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/CalendarWeekRule.xml b/mcs/docs/apidocs/xml/en/System.Globalization/CalendarWeekRule.xml
new file mode 100644
index 00000000000..664ec5679a4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/CalendarWeekRule.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Globalization.CalendarWeekRule" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/CompareOptions.xml b/mcs/docs/apidocs/xml/en/System.Globalization/CompareOptions.xml
new file mode 100644
index 00000000000..376dcf18f96
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/CompareOptions.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Globalization.CompareOptions" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/CultureInfo.xml b/mcs/docs/apidocs/xml/en/System.Globalization/CultureInfo.xml
new file mode 100644
index 00000000000..b4c0c72f9b9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/CultureInfo.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.CultureInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CultureInfo(System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="culture">TODO</param>
+ <param name="use_user_override">TODO</param>
+ </constructor>
+ <constructor name="CultureInfo(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="culture">TODO</param>
+ </constructor>
+ <constructor name="CultureInfo(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="use_user_override">TODO</param>
+ </constructor>
+ <constructor name="CultureInfo(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <property name="InvariantCulture">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentCulture">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentUICulture">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LCID">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Calendar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsNeutralCulture">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NumberFormat">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DateTimeFormat">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetFormat(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="formatType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateSpecificCulture(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/CultureTypes.xml b/mcs/docs/apidocs/xml/en/System.Globalization/CultureTypes.xml
new file mode 100644
index 00000000000..46f502874f6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/CultureTypes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Globalization.CultureTypes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/DateTimeFormatInfo.xml b/mcs/docs/apidocs/xml/en/System.Globalization/DateTimeFormatInfo.xml
new file mode 100644
index 00000000000..06066ed0cd2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/DateTimeFormatInfo.xml
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.DateTimeFormatInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DateTimeFormatInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="theInvariantDateTimeFormatInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AbbreviatedDayNames">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AbbreviatedMonthNames">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DayNames">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MonthNames">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AMDesignator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PMDesignator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DateSeparator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TimeSeparator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LongDatePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShortDatePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShortTimePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LongTimePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MonthDayPattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="YearMonthPattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FullDateTimePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InvariantInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FirstDayOfWeek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Calendar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CalendarWeekRule">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RFC1123Pattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SortableDateTimePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UniversalSortableDateTimePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetFormat(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="formatType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInstance(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadOnly(System.Globalization.DateTimeFormatInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dtfi">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAbbreviatedEraName(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAbbreviatedMonthName(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="month">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEra(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="eraName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEraName(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonthName(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="month">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAllDateTimePatterns">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAllDateTimePatterns(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayName(System.DayOfWeek)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dayofweek">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAbbreviatedDayName(System.DayOfWeek)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dayofweek">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/DateTimeStyles.xml b/mcs/docs/apidocs/xml/en/System.Globalization/DateTimeStyles.xml
new file mode 100644
index 00000000000..fa9abdf7930
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/DateTimeStyles.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Globalization.DateTimeStyles" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/DaylightTime.xml b/mcs/docs/apidocs/xml/en/System.Globalization/DaylightTime.xml
new file mode 100644
index 00000000000..f0ae3190441
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/DaylightTime.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.DaylightTime" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DaylightTime(System.DateTime, System.DateTime, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="start">TODO</param>
+ <param name="end">TODO</param>
+ <param name="delta">TODO</param>
+ </constructor>
+ <property name="Start">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="End">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Delta">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/GregorianCalendar.xml b/mcs/docs/apidocs/xml/en/System.Globalization/GregorianCalendar.xml
new file mode 100644
index 00000000000..47abf133fcf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/GregorianCalendar.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.GregorianCalendar" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="GregorianCalendar(System.Globalization.GregorianCalendarTypes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ </constructor>
+ <constructor name="GregorianCalendar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="ADEra">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Eras">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CalendarType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToDateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapDay(System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonthsInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEra(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfWeek(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddYears(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="years">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMonths(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="months">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/GregorianCalendarTypes.xml b/mcs/docs/apidocs/xml/en/System.Globalization/GregorianCalendarTypes.xml
new file mode 100644
index 00000000000..79e0a20437c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/GregorianCalendarTypes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Globalization.GregorianCalendarTypes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/HebrewCalendar.xml b/mcs/docs/apidocs/xml/en/System.Globalization/HebrewCalendar.xml
new file mode 100644
index 00000000000..a9ffa3486d8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/HebrewCalendar.xml
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.HebrewCalendar" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="HebrewCalendar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="HebrewEra">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="M_MaxYear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Eras">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToDateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapDay(System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSecond(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonthsInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMinute(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMilliseconds(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHour(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEra(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfWeek(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddYears(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="years">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddWeeks(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="weeks">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddSeconds(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="seconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMonths(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="months">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMinutes(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="minutes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMilliseconds(System.DateTime, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddHours(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="hours">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddDays(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="days">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/HijriCalendar.xml b/mcs/docs/apidocs/xml/en/System.Globalization/HijriCalendar.xml
new file mode 100644
index 00000000000..2f6709e84ae
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/HijriCalendar.xml
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.HijriCalendar" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="HijriCalendar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="HijriEra">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Eras">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AddHijriDate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToDateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapDay(System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSecond(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonthsInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMinute(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMilliseconds(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHour(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEra(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfWeek(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddYears(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="years">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddWeeks(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="weeks">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddSeconds(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="seconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMonths(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="months">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMinutes(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="minutes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMilliseconds(System.DateTime, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddHours(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="hours">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddDays(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="days">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/JapaneseCalendar.xml b/mcs/docs/apidocs/xml/en/System.Globalization/JapaneseCalendar.xml
new file mode 100644
index 00000000000..3266f82be86
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/JapaneseCalendar.xml
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.JapaneseCalendar" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="JapaneseCalendar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Eras">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToFourDigitYear(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapDay(System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSecond(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonthsInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMinute(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMilliseconds(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHour(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEra(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfWeek(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddYears(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="years">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddWeeks(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="weeks">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddSeconds(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="seconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMonths(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="months">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMinutes(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="minutes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMilliseconds(System.DateTime, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddHours(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="hours">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddDays(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="days">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/JulianCalendar.xml b/mcs/docs/apidocs/xml/en/System.Globalization/JulianCalendar.xml
new file mode 100644
index 00000000000..4728d1bc250
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/JulianCalendar.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.JulianCalendar" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="JulianCalendar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="JulianEra">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Eras">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToDateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapDay(System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonthsInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEra(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfWeek(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddYears(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="years">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMonths(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="months">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/KoreanCalendar.xml b/mcs/docs/apidocs/xml/en/System.Globalization/KoreanCalendar.xml
new file mode 100644
index 00000000000..ea4a29f9804
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/KoreanCalendar.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.KoreanCalendar" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="KoreanCalendar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="KoreanEra">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Eras">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToDateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapDay(System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonthsInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEra(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfWeek(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddYears(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="years">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMonths(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="months">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/Month.xml b/mcs/docs/apidocs/xml/en/System.Globalization/Month.xml
new file mode 100644
index 00000000000..b41a9cf3e8c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/Month.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Globalization.CCHijriCalendar+Month" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/NumberFormatInfo.xml b/mcs/docs/apidocs/xml/en/System.Globalization/NumberFormatInfo.xml
new file mode 100644
index 00000000000..93fd76421fb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/NumberFormatInfo.xml
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.NumberFormatInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NumberFormatInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="CurrencyDecimalDigits">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrencyDecimalSeparator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrencyGroupSeparator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrencyGroupSizes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrencyNegativePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrencyPositivePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrencySymbol">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InvariantInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NaNSymbol">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NegativeInfinitySymbol">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NegativeSign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NumberDecimalDigits">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NumberDecimalSeparator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NumberGroupSeparator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NumberGroupSizes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NumberNegativePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PercentDecimalDigits">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PercentDecimalSeparator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PercentGroupSeparator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PercentGroupSizes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PercentNegativePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PercentPositivePattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PercentSymbol">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PerMilleSymbol">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PositiveInfinitySymbol">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PositiveSign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetFormat(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="formatType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadOnly(System.Globalization.NumberFormatInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nfi">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInstance(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/NumberStyles.xml b/mcs/docs/apidocs/xml/en/System.Globalization/NumberStyles.xml
new file mode 100644
index 00000000000..63ca4e8dd1a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/NumberStyles.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Globalization.NumberStyles" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/RegionInfo.xml b/mcs/docs/apidocs/xml/en/System.Globalization/RegionInfo.xml
new file mode 100644
index 00000000000..2fa311d7f37
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/RegionInfo.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.RegionInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RegionInfo(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="culture">TODO</param>
+ </constructor>
+ <constructor name="RegionInfo(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <property name="CurrencySymbol">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentRegion">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DisplayName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EnglishName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsMetric">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ISOCurrencySymbol">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/TaiwanCalendar.xml b/mcs/docs/apidocs/xml/en/System.Globalization/TaiwanCalendar.xml
new file mode 100644
index 00000000000..d0fd2875971
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/TaiwanCalendar.xml
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.TaiwanCalendar" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TaiwanCalendar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Eras">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToFourDigitYear(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapDay(System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSecond(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonthsInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMinute(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMilliseconds(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHour(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEra(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfWeek(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddYears(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="years">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddWeeks(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="weeks">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddSeconds(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="seconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMonths(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="months">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMinutes(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="minutes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMilliseconds(System.DateTime, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddHours(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="hours">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddDays(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="days">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/ThaiBuddhistCalendar.xml b/mcs/docs/apidocs/xml/en/System.Globalization/ThaiBuddhistCalendar.xml
new file mode 100644
index 00000000000..0531aaa8e1d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/ThaiBuddhistCalendar.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Globalization.ThaiBuddhistCalendar" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ThaiBuddhistCalendar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="ThaiBuddhistEra">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Eras">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToDateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="milliseconds">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapDay(System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonthsInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEra(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInYear(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaysInMonth(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="era">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfYear(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfWeek(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDayOfMonth(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddYears(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="years">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMonths(System.DateTime, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="months">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Globalization/UnicodeCategory.xml b/mcs/docs/apidocs/xml/en/System.Globalization/UnicodeCategory.xml
new file mode 100644
index 00000000000..183f7478747
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Globalization/UnicodeCategory.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Globalization.UnicodeCategory" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.xml b/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.xml
new file mode 100644
index 00000000000..4802a848f0d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/INormalizeForIsolatedStorage.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.IO.IsolatedStorage.INormalizeForIsolatedStorage" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorage.xml b/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorage.xml
new file mode 100644
index 00000000000..cce0d682e0b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorage.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.IsolatedStorage.IsolatedStorage" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="AssemblyIdentity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DomainIdentity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MaximumSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Scope">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SeparatorExternal">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SeparatorInternal">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Remove">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageException.xml b/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageException.xml
new file mode 100644
index 00000000000..3eb3b6f7df5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.IsolatedStorage.IsolatedStorageException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IsolatedStorageException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="IsolatedStorageException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="IsolatedStorageException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageFileStream.xml b/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageFileStream.xml
new file mode 100644
index 00000000000..d766ed2ee11
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageFileStream.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.IsolatedStorage.IsolatedStorageFileStream" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IsolatedStorageFileStream(System.String, System.IO.FileMode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="mode">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageScope.xml b/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageScope.xml
new file mode 100644
index 00000000000..d8883cb005f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO.IsolatedStorage/IsolatedStorageScope.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.IO.IsolatedStorage.IsolatedStorageScope" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/BinaryReader.xml b/mcs/docs/apidocs/xml/en/System.IO/BinaryReader.xml
new file mode 100644
index 00000000000..b93ba0e3448
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/BinaryReader.xml
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.BinaryReader" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="BinaryReader(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ </constructor>
+ <constructor name="BinaryReader(System.IO.Stream, System.Text.Encoding)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="encoding">TODO</param>
+ </constructor>
+ <property name="BaseStream">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadUInt64">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadUInt32">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadUInt16">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadSingle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadSByte">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadInt64">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadInt32">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadInt16">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadDouble">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadDecimal">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadChars(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadBytes(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadByte">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadBoolean">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="PeekChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/BinaryWriter.xml b/mcs/docs/apidocs/xml/en/System.IO/BinaryWriter.xml
new file mode 100644
index 00000000000..427201d6d3e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/BinaryWriter.xml
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.BinaryWriter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="BinaryWriter(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="output">TODO</param>
+ </constructor>
+ <constructor name="BinaryWriter(System.IO.Stream, System.Text.Encoding)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="output">TODO</param>
+ <param name="encoding">TODO</param>
+ </constructor>
+ <field name="Null">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="BaseStream">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Seek(System.Int32, System.IO.SeekOrigin)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <param name="origin">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/BufferedStream.xml b/mcs/docs/apidocs/xml/en/System.IO/BufferedStream.xml
new file mode 100644
index 00000000000..82ed7514db7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/BufferedStream.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.BufferedStream" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="BufferedStream(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ </constructor>
+ <constructor name="BufferedStream(System.IO.Stream, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <param name="buffer_size">TODO</param>
+ </constructor>
+ <property name="CanRead">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanWrite">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanSeek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Position">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteByte(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetLength(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Seek(System.Int64, System.IO.SeekOrigin)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <param name="origin">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadByte">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/Directory.xml b/mcs/docs/apidocs/xml/en/System.IO/Directory.xml
new file mode 100644
index 00000000000..263548893f8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/Directory.xml
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.Directory" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="CreateDirectory(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Delete(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Delete(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="recurse">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Exists(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLastAccessTime(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLastWriteTime(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCreationTime(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCurrentDirectory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDirectories(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDirectories(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="pattern">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDirectoryRoot(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFiles(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFiles(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="pattern">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFileSystemEntries(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFileSystemEntries(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="pattern">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLogicalDrives">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetParent(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Move(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="src">TODO</param>
+ <param name="dest">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCreationTime(System.String, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="creation_time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCurrentDirectory(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetLastAccessTime(System.String, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="last_access_time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetLastWriteTime(System.String, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="last_write_time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/DirectoryInfo.xml b/mcs/docs/apidocs/xml/en/System.IO/DirectoryInfo.xml
new file mode 100644
index 00000000000..1458e89d9d1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/DirectoryInfo.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.DirectoryInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DirectoryInfo(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ </constructor>
+ <property name="Exists">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Parent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Root">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Delete">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateSubdirectory(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFiles">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFiles(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="pattern">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDirectories">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDirectories(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="pattern">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFileSystemInfos">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFileSystemInfos(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="pattern">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Delete(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="recurse">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveTo(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dest">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/DirectoryNotFoundException.xml b/mcs/docs/apidocs/xml/en/System.IO/DirectoryNotFoundException.xml
new file mode 100644
index 00000000000..0a0a5e40678
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/DirectoryNotFoundException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.DirectoryNotFoundException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DirectoryNotFoundException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="DirectoryNotFoundException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="DirectoryNotFoundException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/EndOfStreamException.xml b/mcs/docs/apidocs/xml/en/System.IO/EndOfStreamException.xml
new file mode 100644
index 00000000000..4f98bedfca8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/EndOfStreamException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.EndOfStreamException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="EndOfStreamException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="EndOfStreamException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="EndOfStreamException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/File.xml b/mcs/docs/apidocs/xml/en/System.IO/File.xml
new file mode 100644
index 00000000000..65a57e3f0b0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/File.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.File" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="AppendText(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="sourceFilename">TODO</param>
+ <param name="destFilename">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy(System.String, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="src">TODO</param>
+ <param name="dest">TODO</param>
+ <param name="overwrite">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="buffersize">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Delete(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Exists(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttributes(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCreationTime(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLastAccessTime(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLastWriteTime(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Move(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="src">TODO</param>
+ <param name="dest">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Open(System.String, System.IO.FileMode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="mode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Open(System.String, System.IO.FileMode, System.IO.FileAccess)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="mode">TODO</param>
+ <param name="access">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Open(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="mode">TODO</param>
+ <param name="access">TODO</param>
+ <param name="share">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="OpenRead(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="OpenText(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="OpenWrite(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetAttributes(System.String, System.IO.FileAttributes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="attributes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCreationTime(System.String, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="creation_time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetLastAccessTime(System.String, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="last_access_time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetLastWriteTime(System.String, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="last_write_time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/FileAccess.xml b/mcs/docs/apidocs/xml/en/System.IO/FileAccess.xml
new file mode 100644
index 00000000000..e3bb30c1902
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/FileAccess.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.IO.FileAccess" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/FileAttributes.xml b/mcs/docs/apidocs/xml/en/System.IO/FileAttributes.xml
new file mode 100644
index 00000000000..db7bdb6b53e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/FileAttributes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.IO.FileAttributes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/FileInfo.xml b/mcs/docs/apidocs/xml/en/System.IO/FileInfo.xml
new file mode 100644
index 00000000000..161ebdc2d51
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/FileInfo.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.FileInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FileInfo(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ </constructor>
+ <property name="Exists">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DirectoryName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Directory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Delete">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="OpenText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AppendText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="OpenRead">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="OpenWrite">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Open(System.IO.FileMode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Open(System.IO.FileMode, System.IO.FileAccess)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mode">TODO</param>
+ <param name="access">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Open(System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mode">TODO</param>
+ <param name="access">TODO</param>
+ <param name="share">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveTo(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dest">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="overwrite">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/FileLoadException.xml b/mcs/docs/apidocs/xml/en/System.IO/FileLoadException.xml
new file mode 100644
index 00000000000..5a1328cecea
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/FileLoadException.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.FileLoadException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FileLoadException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="FileLoadException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="FileLoadException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <property name="Message">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FileName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FusionLog">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/FileMode.xml b/mcs/docs/apidocs/xml/en/System.IO/FileMode.xml
new file mode 100644
index 00000000000..58ccd2f9ccf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/FileMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.IO.FileMode" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/FileNotFoundException.xml b/mcs/docs/apidocs/xml/en/System.IO/FileNotFoundException.xml
new file mode 100644
index 00000000000..1c1129ea7ed
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/FileNotFoundException.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.FileNotFoundException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FileNotFoundException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="FileNotFoundException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="FileNotFoundException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <constructor name="FileNotFoundException(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="fileName">TODO</param>
+ </constructor>
+ <constructor name="FileNotFoundException(System.String, System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="fileName">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ <property name="FileName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FusionLog">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Message">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/FileShare.xml b/mcs/docs/apidocs/xml/en/System.IO/FileShare.xml
new file mode 100644
index 00000000000..253ff07e320
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/FileShare.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.IO.FileShare" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/FileStream.xml b/mcs/docs/apidocs/xml/en/System.IO/FileStream.xml
new file mode 100644
index 00000000000..7d429a0df74
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/FileStream.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.FileStream" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FileStream(System.IntPtr, System.IO.FileAccess)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="handle">TODO</param>
+ <param name="access">TODO</param>
+ </constructor>
+ <constructor name="FileStream(System.IntPtr, System.IO.FileAccess, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="handle">TODO</param>
+ <param name="access">TODO</param>
+ <param name="ownsHandle">TODO</param>
+ </constructor>
+ <constructor name="FileStream(System.IntPtr, System.IO.FileAccess, System.Boolean, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="handle">TODO</param>
+ <param name="access">TODO</param>
+ <param name="ownsHandle">TODO</param>
+ <param name="bufferSize">TODO</param>
+ </constructor>
+ <constructor name="FileStream(System.IntPtr, System.IO.FileAccess, System.Boolean, System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="handle">TODO</param>
+ <param name="access">TODO</param>
+ <param name="ownsHandle">TODO</param>
+ <param name="bufferSize">TODO</param>
+ <param name="isAsync">TODO</param>
+ </constructor>
+ <constructor name="FileStream(System.String, System.IO.FileMode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="mode">TODO</param>
+ </constructor>
+ <constructor name="FileStream(System.String, System.IO.FileMode, System.IO.FileAccess)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="mode">TODO</param>
+ <param name="access">TODO</param>
+ </constructor>
+ <constructor name="FileStream(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="mode">TODO</param>
+ <param name="access">TODO</param>
+ <param name="share">TODO</param>
+ </constructor>
+ <constructor name="FileStream(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="mode">TODO</param>
+ <param name="access">TODO</param>
+ <param name="share">TODO</param>
+ <param name="bufferSize">TODO</param>
+ </constructor>
+ <constructor name="FileStream(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="mode">TODO</param>
+ <param name="access">TODO</param>
+ <param name="share">TODO</param>
+ <param name="bufferSize">TODO</param>
+ <param name="isAsync">TODO</param>
+ </constructor>
+ <property name="CanRead">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanWrite">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanSeek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Position">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Handle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteByte(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="src">TODO</param>
+ <param name="src_offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetLength(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Seek(System.Int64, System.IO.SeekOrigin)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <param name="origin">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadByte">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dest">TODO</param>
+ <param name="dest_offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/FileSystemInfo.xml b/mcs/docs/apidocs/xml/en/System.IO/FileSystemInfo.xml
new file mode 100644
index 00000000000..f8e78d87eab
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/FileSystemInfo.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.FileSystemInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Exists">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FullName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Extension">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CreationTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LastAccessTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LastWriteTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Delete">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Refresh">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/IOException.xml b/mcs/docs/apidocs/xml/en/System.IO/IOException.xml
new file mode 100644
index 00000000000..9b808f609f1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/IOException.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.IOException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IOException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="IOException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="IOException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <constructor name="IOException(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="hresult">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/MemoryStream.xml b/mcs/docs/apidocs/xml/en/System.IO/MemoryStream.xml
new file mode 100644
index 00000000000..bb28a2f2b5e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/MemoryStream.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.MemoryStream" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MemoryStream">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="MemoryStream(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ </constructor>
+ <constructor name="MemoryStream(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ </constructor>
+ <constructor name="MemoryStream(System.Byte[], System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="writeable">TODO</param>
+ </constructor>
+ <constructor name="MemoryStream(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ </constructor>
+ <constructor name="MemoryStream(System.Byte[], System.Int32, System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <param name="writeable">TODO</param>
+ </constructor>
+ <constructor name="MemoryStream(System.Byte[], System.Int32, System.Int32, System.Boolean, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <param name="writeable">TODO</param>
+ <param name="publicallyVisible">TODO</param>
+ </constructor>
+ <property name="CanRead">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanSeek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanWrite">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Capacity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Position">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToArray">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBuffer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteByte(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetLength(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Seek(System.Int64, System.IO.SeekOrigin)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <param name="loc">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadByte">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/Path.xml b/mcs/docs/apidocs/xml/en/System.IO/Path.xml
new file mode 100644
index 00000000000..5c8cceb292c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/Path.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.Path" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="AltDirectorySeparatorChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="DirectorySeparatorChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="InvalidPathChars">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="PathSeparator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="VolumeSeparatorChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ChangeExtension(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="extension">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Combine(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path1">TODO</param>
+ <param name="path2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDirectoryName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetExtension(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFileName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFileNameWithoutExtension(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFullPath(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetPathRoot(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTempFileName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTempPath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="HasExtension(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsPathRooted(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/PathTooLongException.xml b/mcs/docs/apidocs/xml/en/System.IO/PathTooLongException.xml
new file mode 100644
index 00000000000..1741279772d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/PathTooLongException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.PathTooLongException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="PathTooLongException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="PathTooLongException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="PathTooLongException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/SeekOrigin.xml b/mcs/docs/apidocs/xml/en/System.IO/SeekOrigin.xml
new file mode 100644
index 00000000000..bb813b853a0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/SeekOrigin.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.IO.SeekOrigin" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/Stream.xml b/mcs/docs/apidocs/xml/en/System.IO/Stream.xml
new file mode 100644
index 00000000000..bf097c21b55
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/Stream.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.Stream" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Null">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="CanRead">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanSeek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanWrite">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Position">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndWrite(System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="async_result">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndRead(System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="async_result">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <param name="cback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <param name="cback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteByte(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetLength(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Seek(System.Int64, System.IO.SeekOrigin)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <param name="origin">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadByte">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/StreamReader.xml b/mcs/docs/apidocs/xml/en/System.IO/StreamReader.xml
new file mode 100644
index 00000000000..8d33e6decc9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/StreamReader.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.StreamReader" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StreamReader(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ </constructor>
+ <constructor name="StreamReader(System.IO.Stream, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <param name="detectEncodingFromByteOrderMarks">TODO</param>
+ </constructor>
+ <constructor name="StreamReader(System.IO.Stream, System.Text.Encoding)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <param name="encoding">TODO</param>
+ </constructor>
+ <constructor name="StreamReader(System.IO.Stream, System.Text.Encoding, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <param name="encoding">TODO</param>
+ <param name="detectEncodingFromByteOrderMarks">TODO</param>
+ </constructor>
+ <constructor name="StreamReader(System.IO.Stream, System.Text.Encoding, System.Boolean, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <param name="encoding">TODO</param>
+ <param name="detectEncodingFromByteOrderMarks">TODO</param>
+ <param name="bufferSize">TODO</param>
+ </constructor>
+ <constructor name="StreamReader(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ </constructor>
+ <constructor name="StreamReader(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="detectEncodingFromByteOrderMarks">TODO</param>
+ </constructor>
+ <constructor name="StreamReader(System.String, System.Text.Encoding)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="encoding">TODO</param>
+ </constructor>
+ <constructor name="StreamReader(System.String, System.Text.Encoding, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="encoding">TODO</param>
+ <param name="detectEncodingFromByteOrderMarks">TODO</param>
+ </constructor>
+ <constructor name="StreamReader(System.String, System.Text.Encoding, System.Boolean, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="encoding">TODO</param>
+ <param name="detectEncodingFromByteOrderMarks">TODO</param>
+ <param name="bufferSize">TODO</param>
+ </constructor>
+ <field name="Null">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="BaseStream">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentEncoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ReadToEnd">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadLine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dest_buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Peek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="DiscardBufferedData">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/StreamWriter.xml b/mcs/docs/apidocs/xml/en/System.IO/StreamWriter.xml
new file mode 100644
index 00000000000..880ddd36a97
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/StreamWriter.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.StreamWriter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StreamWriter(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ </constructor>
+ <constructor name="StreamWriter(System.IO.Stream, System.Text.Encoding)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <param name="encoding">TODO</param>
+ </constructor>
+ <constructor name="StreamWriter(System.IO.Stream, System.Text.Encoding, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <param name="encoding">TODO</param>
+ <param name="bufferSize">TODO</param>
+ </constructor>
+ <constructor name="StreamWriter(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ </constructor>
+ <constructor name="StreamWriter(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="append">TODO</param>
+ </constructor>
+ <constructor name="StreamWriter(System.String, System.Boolean, System.Text.Encoding)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="append">TODO</param>
+ <param name="encoding">TODO</param>
+ </constructor>
+ <constructor name="StreamWriter(System.String, System.Boolean, System.Text.Encoding, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="append">TODO</param>
+ <param name="encoding">TODO</param>
+ <param name="bufferSize">TODO</param>
+ </constructor>
+ <property name="AutoFlush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseStream">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Encoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Write(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/StringReader.xml b/mcs/docs/apidocs/xml/en/System.IO/StringReader.xml
new file mode 100644
index 00000000000..60a19b61ee9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/StringReader.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.StringReader" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StringReader(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ </constructor>
+ <method name="ReadToEnd">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadLine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Peek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/StringWriter.xml b/mcs/docs/apidocs/xml/en/System.IO/StringWriter.xml
new file mode 100644
index 00000000000..cd1d33ace1b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/StringWriter.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.StringWriter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StringWriter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="StringWriter(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="formatProvider">TODO</param>
+ </constructor>
+ <constructor name="StringWriter(System.Text.StringBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="sb">TODO</param>
+ </constructor>
+ <constructor name="StringWriter(System.Text.StringBuilder, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="sb">TODO</param>
+ <param name="formatProvider">TODO</param>
+ </constructor>
+ <property name="Encoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetStringBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/TextReader.xml b/mcs/docs/apidocs/xml/en/System.IO/TextReader.xml
new file mode 100644
index 00000000000..b20ccb2b4cd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/TextReader.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.TextReader" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Null">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ReadToEnd">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadLine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadBlock(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Peek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Synchronised(System.IO.TextReader)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="reader">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.IO/TextWriter.xml b/mcs/docs/apidocs/xml/en/System.IO/TextWriter.xml
new file mode 100644
index 00000000000..f35eb655cec
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.IO/TextWriter.xml
@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IO.TextWriter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Null">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Encoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FormatProvider">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NewLine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteLine(System.String, System.Object, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <param name="arg2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.Object, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <param name="arg2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Synchronised(System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/AddressFamily.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/AddressFamily.xml
new file mode 100644
index 00000000000..4e18c966b06
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/AddressFamily.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.Sockets.AddressFamily" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/LingerOption.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/LingerOption.xml
new file mode 100644
index 00000000000..c5b2191bac4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/LingerOption.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.Sockets.LingerOption" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="LingerOption(System.Boolean, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="enable">TODO</param>
+ <param name="secs">TODO</param>
+ </constructor>
+ <property name="Enabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LingerTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/MulticastOption.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/MulticastOption.xml
new file mode 100644
index 00000000000..489e8403e2a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/MulticastOption.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.Sockets.MulticastOption" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MulticastOption(System.Net.IPAddress)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="grp">TODO</param>
+ </constructor>
+ <constructor name="MulticastOption(System.Net.IPAddress, System.Net.IPAddress)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="grp">TODO</param>
+ <param name="addr">TODO</param>
+ </constructor>
+ <property name="Group">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalAddress">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/NetworkStream.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/NetworkStream.xml
new file mode 100644
index 00000000000..895a52e7640
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/NetworkStream.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.Sockets.NetworkStream" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NetworkStream(System.Net.Sockets.Socket)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="socket">TODO</param>
+ </constructor>
+ <constructor name="NetworkStream(System.Net.Sockets.Socket, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="socket">TODO</param>
+ <param name="owns_socket">TODO</param>
+ </constructor>
+ <constructor name="NetworkStream(System.Net.Sockets.Socket, System.IO.FileAccess)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="socket">TODO</param>
+ <param name="access">TODO</param>
+ </constructor>
+ <constructor name="NetworkStream(System.Net.Sockets.Socket, System.IO.FileAccess, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="socket">TODO</param>
+ <param name="access">TODO</param>
+ <param name="owns_socket">TODO</param>
+ </constructor>
+ <property name="CanRead">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanSeek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanWrite">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataAvailable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Position">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Readable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Socket">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Writeable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Write(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetLength(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Seek(System.Int64, System.IO.SeekOrigin)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <param name="origin">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndWrite(System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ar">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndRead(System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ar">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/ProtocolFamily.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/ProtocolFamily.xml
new file mode 100644
index 00000000000..19a8603779f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/ProtocolFamily.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.Sockets.ProtocolFamily" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/ProtocolType.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/ProtocolType.xml
new file mode 100644
index 00000000000..da33090e437
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/ProtocolType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.Sockets.ProtocolType" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/SelectMode.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SelectMode.xml
new file mode 100644
index 00000000000..273faae5544
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SelectMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.Sockets.SelectMode" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/Socket.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/Socket.xml
new file mode 100644
index 00000000000..48d79259ec7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/Socket.xml
@@ -0,0 +1,396 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.Sockets.Socket" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Socket(System.Net.Sockets.AddressFamily, System.Net.Sockets.SocketType, System.Net.Sockets.ProtocolType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="family">TODO</param>
+ <param name="type">TODO</param>
+ <param name="proto">TODO</param>
+ </constructor>
+ <property name="AddressFamily">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Available">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Blocking">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Connected">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Handle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalEndPoint">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProtocolType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RemoteEndPoint">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SocketType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Select(System.Collections.IList, System.Collections.IList, System.Collections.IList, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="read_list">TODO</param>
+ <param name="write_list">TODO</param>
+ <param name="err_list">TODO</param>
+ <param name="time_us">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Accept">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginAccept(System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginConnect(System.Net.EndPoint, System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="end_point">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginReceive(System.Byte[], System.Int32, System.Int32, System.Net.Sockets.SocketFlags, System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <param name="socket_flags">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginReceiveFrom(System.Byte[], System.Int32, System.Int32, System.Net.Sockets.SocketFlags, System.Net.EndPoint&amp;, System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <param name="socket_flags">TODO</param>
+ <param name="remote_end">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginSend(System.Byte[], System.Int32, System.Int32, System.Net.Sockets.SocketFlags, System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <param name="socket_flags">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginSendTo(System.Byte[], System.Int32, System.Int32, System.Net.Sockets.SocketFlags, System.Net.EndPoint, System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <param name="socket_flags">TODO</param>
+ <param name="remote_end">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Bind(System.Net.EndPoint)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="local_end">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Connect(System.Net.EndPoint)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="remote_end">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndAccept(System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="result">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndConnect(System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="result">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndReceive(System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="result">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndReceiveFrom(System.IAsyncResult, System.Net.EndPoint&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="result">TODO</param>
+ <param name="end_point">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndSend(System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="result">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndSendTo(System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="result">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSocketOption(System.Net.Sockets.SocketOptionLevel, System.Net.Sockets.SocketOptionName)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSocketOption(System.Net.Sockets.SocketOptionLevel, System.Net.Sockets.SocketOptionName, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <param name="name">TODO</param>
+ <param name="opt_value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSocketOption(System.Net.Sockets.SocketOptionLevel, System.Net.Sockets.SocketOptionName, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <param name="name">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IOControl(System.Int32, System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ioctl_code">TODO</param>
+ <param name="in_value">TODO</param>
+ <param name="out_value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Listen(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="backlog">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Poll(System.Int32, System.Net.Sockets.SelectMode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time_us">TODO</param>
+ <param name="mode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Receive(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Receive(System.Byte[], System.Net.Sockets.SocketFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <param name="flags">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Receive(System.Byte[], System.Int32, System.Net.Sockets.SocketFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <param name="size">TODO</param>
+ <param name="flags">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Receive(System.Byte[], System.Int32, System.Int32, System.Net.Sockets.SocketFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <param name="flags">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReceiveFrom(System.Byte[], System.Net.EndPoint&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <param name="remote_end">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReceiveFrom(System.Byte[], System.Net.Sockets.SocketFlags, System.Net.EndPoint&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <param name="flags">TODO</param>
+ <param name="remote_end">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReceiveFrom(System.Byte[], System.Int32, System.Net.Sockets.SocketFlags, System.Net.EndPoint&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <param name="size">TODO</param>
+ <param name="flags">TODO</param>
+ <param name="remote_end">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReceiveFrom(System.Byte[], System.Int32, System.Int32, System.Net.Sockets.SocketFlags, System.Net.EndPoint&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <param name="flags">TODO</param>
+ <param name="remote_end">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Send(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Send(System.Byte[], System.Net.Sockets.SocketFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <param name="flags">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Send(System.Byte[], System.Int32, System.Net.Sockets.SocketFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <param name="size">TODO</param>
+ <param name="flags">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Send(System.Byte[], System.Int32, System.Int32, System.Net.Sockets.SocketFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buf">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <param name="flags">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SendTo(System.Byte[], System.Net.EndPoint)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="remote_end">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SendTo(System.Byte[], System.Net.Sockets.SocketFlags, System.Net.EndPoint)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="flags">TODO</param>
+ <param name="remote_end">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SendTo(System.Byte[], System.Int32, System.Net.Sockets.SocketFlags, System.Net.EndPoint)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="size">TODO</param>
+ <param name="flags">TODO</param>
+ <param name="remote_end">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SendTo(System.Byte[], System.Int32, System.Int32, System.Net.Sockets.SocketFlags, System.Net.EndPoint)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="size">TODO</param>
+ <param name="flags">TODO</param>
+ <param name="remote_end">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetSocketOption(System.Net.Sockets.SocketOptionLevel, System.Net.Sockets.SocketOptionName, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <param name="name">TODO</param>
+ <param name="opt_value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetSocketOption(System.Net.Sockets.SocketOptionLevel, System.Net.Sockets.SocketOptionName, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <param name="name">TODO</param>
+ <param name="opt_value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetSocketOption(System.Net.Sockets.SocketOptionLevel, System.Net.Sockets.SocketOptionName, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <param name="name">TODO</param>
+ <param name="opt_value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Shutdown(System.Net.Sockets.SocketShutdown)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="how">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketException.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketException.xml
new file mode 100644
index 00000000000..fa82470f5f3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketException.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.Sockets.SocketException" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SocketException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="SocketException(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="error">TODO</param>
+ </constructor>
+ <property name="ErrorCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketFlags.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketFlags.xml
new file mode 100644
index 00000000000..96397cb2661
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketFlags.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.Sockets.SocketFlags" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketOptionLevel.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketOptionLevel.xml
new file mode 100644
index 00000000000..94711691826
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketOptionLevel.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.Sockets.SocketOptionLevel" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketOptionName.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketOptionName.xml
new file mode 100644
index 00000000000..6904c8d9883
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketOptionName.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.Sockets.SocketOptionName" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketShutdown.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketShutdown.xml
new file mode 100644
index 00000000000..ba09ba7e49c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketShutdown.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.Sockets.SocketShutdown" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketType.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketType.xml
new file mode 100644
index 00000000000..fd2f1e36280
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/SocketType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.Sockets.SocketType" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/TcpClient.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/TcpClient.xml
new file mode 100644
index 00000000000..24e8bd7872e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/TcpClient.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.Sockets.TcpClient" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TcpClient">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="TcpClient(System.Net.IPEndPoint)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="local_end_point">TODO</param>
+ </constructor>
+ <constructor name="TcpClient(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hostname">TODO</param>
+ <param name="port">TODO</param>
+ </constructor>
+ <property name="Active">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Client">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LingerState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NoDelay">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReceiveBufferSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReceiveTimeout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SendBufferSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SendTimeout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Connect(System.Net.IPEndPoint)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="remote_end_point">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Connect(System.Net.IPAddress, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="address">TODO</param>
+ <param name="port">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Connect(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hostname">TODO</param>
+ <param name="port">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetStream">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net.Sockets/TcpListener.xml b/mcs/docs/apidocs/xml/en/System.Net.Sockets/TcpListener.xml
new file mode 100644
index 00000000000..0479294751b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net.Sockets/TcpListener.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.Sockets.TcpListener" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TcpListener(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="port">TODO</param>
+ </constructor>
+ <constructor name="TcpListener(System.Net.IPEndPoint)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="local_end_point">TODO</param>
+ </constructor>
+ <constructor name="TcpListener(System.Net.IPAddress, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="listen_ip">TODO</param>
+ <param name="port">TODO</param>
+ </constructor>
+ <property name="Active">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalEndPoint">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Server">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="AcceptSocket">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AcceptTcpClient">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Pending">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Start">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Stop">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/Authorization.xml b/mcs/docs/apidocs/xml/en/System.Net/Authorization.xml
new file mode 100644
index 00000000000..ebe5779fecf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/Authorization.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.Authorization" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Authorization(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="token">TODO</param>
+ </constructor>
+ <constructor name="Authorization(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="token">TODO</param>
+ <param name="complete">TODO</param>
+ </constructor>
+ <property name="Complete">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/ConnectionModes.xml b/mcs/docs/apidocs/xml/en/System.Net/ConnectionModes.xml
new file mode 100644
index 00000000000..df03b257adf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/ConnectionModes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.ConnectionModes" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/Dns.xml b/mcs/docs/apidocs/xml/en/System.Net/Dns.xml
new file mode 100644
index 00000000000..ad2e6c6eac2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/Dns.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.Dns" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="BeginGetHostByName(System.String, System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hostName">TODO</param>
+ <param name="requestCallback">TODO</param>
+ <param name="stateObject">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginResolve(System.String, System.AsyncCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hostName">TODO</param>
+ <param name="requestCallback">TODO</param>
+ <param name="stateObject">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndGetHostByName(System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="asyncResult">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndResolve(System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="asyncResult">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHostByAddress(System.Net.IPAddress)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="address">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHostByAddress(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="address">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHostByName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hostName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHostName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Resolve(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hostName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/EndPoint.xml b/mcs/docs/apidocs/xml/en/System.Net/EndPoint.xml
new file mode 100644
index 00000000000..05ac52e956d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/EndPoint.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.EndPoint" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="AddressFamily">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Serialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.Net.SocketAddress)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="address">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/HttpStatusCode.xml b/mcs/docs/apidocs/xml/en/System.Net/HttpStatusCode.xml
new file mode 100644
index 00000000000..6c39c57bfe8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/HttpStatusCode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.HttpStatusCode" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/ICredentials.xml b/mcs/docs/apidocs/xml/en/System.Net/ICredentials.xml
new file mode 100644
index 00000000000..d1609e6556b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/ICredentials.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Net.ICredentials" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/IPAddress.xml b/mcs/docs/apidocs/xml/en/System.Net/IPAddress.xml
new file mode 100644
index 00000000000..73a7c90ea60
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/IPAddress.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.IPAddress" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IPAddress(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="addr">TODO</param>
+ </constructor>
+ <field name="Any">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Broadcast">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Loopback">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="None">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Address">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AddressFamily">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="other">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="HostToNetworkOrder(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="host">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="HostToNetworkOrder(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="host">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="HostToNetworkOrder(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="host">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="NetworkToHostOrder(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="network">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="NetworkToHostOrder(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="network">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="NetworkToHostOrder(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="network">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ip">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLoopback(System.Net.IPAddress)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="addr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/IPEndPoint.xml b/mcs/docs/apidocs/xml/en/System.Net/IPEndPoint.xml
new file mode 100644
index 00000000000..5f50096899f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/IPEndPoint.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.IPEndPoint" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IPEndPoint(System.Net.IPAddress, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="address">TODO</param>
+ <param name="port">TODO</param>
+ </constructor>
+ <constructor name="IPEndPoint(System.Int64, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="iaddr">TODO</param>
+ <param name="port">TODO</param>
+ </constructor>
+ <field name="MaxPort">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinPort">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Address">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AddressFamily">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Port">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Serialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.Net.SocketAddress)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="sockaddr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/IPHostEntry.xml b/mcs/docs/apidocs/xml/en/System.Net/IPHostEntry.xml
new file mode 100644
index 00000000000..a5e918b5306
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/IPHostEntry.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.IPHostEntry" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IPHostEntry">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AddressList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Aliases">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HostName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/NetworkAccess.xml b/mcs/docs/apidocs/xml/en/System.Net/NetworkAccess.xml
new file mode 100644
index 00000000000..988e5817574
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/NetworkAccess.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.NetworkAccess" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/NetworkCredential.xml b/mcs/docs/apidocs/xml/en/System.Net/NetworkCredential.xml
new file mode 100644
index 00000000000..ff3e0ca2dce
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/NetworkCredential.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.NetworkCredential" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NetworkCredential">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="NetworkCredential(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="userName">TODO</param>
+ <param name="password">TODO</param>
+ </constructor>
+ <constructor name="NetworkCredential(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="userName">TODO</param>
+ <param name="password">TODO</param>
+ <param name="domain">TODO</param>
+ </constructor>
+ <property name="Domain">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UserName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Password">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetCredential(System.Uri, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="uri">TODO</param>
+ <param name="authType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/ProxyUseType.xml b/mcs/docs/apidocs/xml/en/System.Net/ProxyUseType.xml
new file mode 100644
index 00000000000..62ce163226e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/ProxyUseType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.ProxyUseType" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/SocketAddress.xml b/mcs/docs/apidocs/xml/en/System.Net/SocketAddress.xml
new file mode 100644
index 00000000000..7b47eea3484
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/SocketAddress.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Net.SocketAddress" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SocketAddress(System.Net.Sockets.AddressFamily, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="family">TODO</param>
+ <param name="size">TODO</param>
+ </constructor>
+ <constructor name="SocketAddress(System.Net.Sockets.AddressFamily)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="family">TODO</param>
+ </constructor>
+ <property name="Family">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Size">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/TransportType.xml b/mcs/docs/apidocs/xml/en/System.Net/TransportType.xml
new file mode 100644
index 00000000000..cd8d90deda7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/TransportType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.TransportType" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/WebExceptionStatus.xml b/mcs/docs/apidocs/xml/en/System.Net/WebExceptionStatus.xml
new file mode 100644
index 00000000000..c0b358699ab
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/WebExceptionStatus.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.WebExceptionStatus" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Net/WebStatus.xml b/mcs/docs/apidocs/xml/en/System.Net/WebStatus.xml
new file mode 100644
index 00000000000..257242f549d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Net/WebStatus.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Net.WebStatus" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/AssemblyBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/AssemblyBuilder.xml
new file mode 100644
index 00000000000..c2e3c7eaeab
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/AssemblyBuilder.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.AssemblyBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="CodeBase">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EntryPoint">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Location">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetExportedTypes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFile(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddResourceFile(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="fileName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddResourceFile(System.String, System.String, System.Reflection.ResourceAttributes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="fileName">TODO</param>
+ <param name="attribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicModule(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicModule(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="emitSymbolInfo">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicModule(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="fileName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicModule(System.String, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="fileName">TODO</param>
+ <param name="emitSymbolInfo">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineResource(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="description">TODO</param>
+ <param name="fileName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineResource(System.String, System.String, System.String, System.Reflection.ResourceAttributes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="description">TODO</param>
+ <param name="fileName">TODO</param>
+ <param name="attribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineUnmanagedResource(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="resource">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineUnmanagedResource(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="resourceFileName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineVersionInfoResource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineVersionInfoResource(System.String, System.String, System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="product">TODO</param>
+ <param name="productVersion">TODO</param>
+ <param name="company">TODO</param>
+ <param name="copyright">TODO</param>
+ <param name="trademark">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDynamicModule(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Save(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyFileName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetEntryPoint(System.Reflection.MethodInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="entryMethod">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetEntryPoint(System.Reflection.MethodInfo, System.Reflection.Emit.PEFileKinds)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="entryMethod">TODO</param>
+ <param name="fileKind">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="customBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.ConstructorInfo, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="binaryAttribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/AssemblyBuilderAccess.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/AssemblyBuilderAccess.xml
new file mode 100644
index 00000000000..75b595e4c4b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/AssemblyBuilderAccess.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.Emit.AssemblyBuilderAccess" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ConstructorBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ConstructorBuilder.xml
new file mode 100644
index 00000000000..c457c2ac8f1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ConstructorBuilder.xml
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.ConstructorBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="TypeBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MethodHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReflectedType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DeclaringType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReturnType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Signature">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InitLocals">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="parameters">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="parameters">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetParameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethodImplementationFlags">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddDeclarativeSecurity(System.Security.Permissions.SecurityAction, System.Security.PermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ <param name="pset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineParameter(System.Int32, System.Reflection.ParameterAttributes, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="iSequence">TODO</param>
+ <param name="attributes">TODO</param>
+ <param name="strParamName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetILGenerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetILGenerator(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="size">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="customBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.ConstructorInfo, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="binaryAttribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetImplementationFlags(System.Reflection.MethodImplAttributes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetModule">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetToken">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetSymCustomAttribute(System.String, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/CustomAttributeBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/CustomAttributeBuilder.xml
new file mode 100644
index 00000000000..6e20c63d239
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/CustomAttributeBuilder.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.CustomAttributeBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CustomAttributeBuilder(System.Reflection.ConstructorInfo, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="constructorArgs">TODO</param>
+ </constructor>
+ <constructor name="CustomAttributeBuilder(System.Reflection.ConstructorInfo, System.Object[], System.Reflection.FieldInfo[], System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="constructorArgs">TODO</param>
+ <param name="namedFields">TODO</param>
+ <param name="fieldValues">TODO</param>
+ </constructor>
+ <constructor name="CustomAttributeBuilder(System.Reflection.ConstructorInfo, System.Object[], System.Reflection.PropertyInfo[], System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="constructorArgs">TODO</param>
+ <param name="namedProperties">TODO</param>
+ <param name="propertyValues">TODO</param>
+ </constructor>
+ <constructor name="CustomAttributeBuilder(System.Reflection.ConstructorInfo, System.Object[], System.Reflection.PropertyInfo[], System.Object[], System.Reflection.FieldInfo[], System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="constructorArgs">TODO</param>
+ <param name="namedProperties">TODO</param>
+ <param name="propertyValues">TODO</param>
+ <param name="namedFields">TODO</param>
+ <param name="fieldValues">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/EnumBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/EnumBuilder.xml
new file mode 100644
index 00000000000..5ff112c663f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/EnumBuilder.xml
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.EnumBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Assembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AssemblyQualifiedName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DeclaringType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FullName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="GUID">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Module">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Namespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReflectedType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TypeHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TypeToken">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UnderlyingField">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UnderlyingSystemType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MemberType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="InvokeMember(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object, System.Object[], System.Reflection.ParameterModifier[], System.Globalization.CultureInfo, System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="target">TODO</param>
+ <param name="args">TODO</param>
+ <param name="modifiers">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="namedParameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperties(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethods(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMembers(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFields(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetField(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetConstructors(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNestedTypes(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNestedType(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMember(System.String, System.Reflection.MemberTypes, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="type">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvents(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvents">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvent(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetElementType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterfaces">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterfaceMap(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="interfaceType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterface(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineLiteral(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="literalName">TODO</param>
+ <param name="literalValue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="customBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.ConstructorInfo, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="binaryAttribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/EventBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/EventBuilder.xml
new file mode 100644
index 00000000000..b543eeb814d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/EventBuilder.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.EventBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="AddOtherMethod(System.Reflection.Emit.MethodBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mdBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEventToken">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetAddOnMethod(System.Reflection.Emit.MethodBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mdBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetRaiseMethod(System.Reflection.Emit.MethodBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mdBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetRemoveOnMethod(System.Reflection.Emit.MethodBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mdBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="customBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.ConstructorInfo, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="binaryAttribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/EventToken.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/EventToken.xml
new file mode 100644
index 00000000000..0e1960e45cf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/EventToken.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.Emit.EventToken" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Token">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/FieldBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/FieldBuilder.xml
new file mode 100644
index 00000000000..58e4b3a3273
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/FieldBuilder.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.FieldBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DeclaringType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FieldHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FieldType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReflectedType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SetValue(System.Object, System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="val">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetToken">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetConstant(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="defaultValue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="customBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.ConstructorInfo, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="binaryAttribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetMarshal(System.Reflection.Emit.UnmanagedMarshal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="unmanagedMarshal">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetOffset(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="iOffset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/FieldToken.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/FieldToken.xml
new file mode 100644
index 00000000000..8e8225055bc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/FieldToken.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.Emit.FieldToken" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Token">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/FlowControl.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/FlowControl.xml
new file mode 100644
index 00000000000..f40afcadc08
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/FlowControl.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.Emit.FlowControl" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ILGenerator.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ILGenerator.xml
new file mode 100644
index 00000000000..9d3b7a454aa
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ILGenerator.xml
@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.ILGenerator" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="UsingNamespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="usingNamespace">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ThrowException(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="exceptionType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MarkSequencePoint(System.Diagnostics.SymbolStore.ISymbolDocumentWriter, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="document">TODO</param>
+ <param name="startLine">TODO</param>
+ <param name="startColumn">TODO</param>
+ <param name="endLine">TODO</param>
+ <param name="endColumn">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MarkLabel(System.Reflection.Emit.Label)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="loc">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndScope">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndExceptionBlock">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="EmitWriteLine(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EmitWriteLine(System.Reflection.Emit.LocalBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="lbuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EmitWriteLine(System.Reflection.FieldInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="field">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Reflection.Emit.SignatureHelper)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="shelper">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Reflection.MethodInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="method">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Reflection.Emit.LocalBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="lbuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Reflection.Emit.Label[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="labels">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Reflection.Emit.Label)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="label">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Reflection.FieldInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="field">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Reflection.ConstructorInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="constructor">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode, System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Emit(System.Reflection.Emit.OpCode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineLabel">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="DeclareLocal(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginScope">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginFinallyBlock">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginFaultBlock">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginExceptionBlock">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginExceptFilterBlock">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="BeginCatchBlock(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="exceptionType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EmitCall(System.Reflection.Emit.OpCode, System.Reflection.MethodInfo, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="methodinfo">TODO</param>
+ <param name="optionalParamTypes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EmitCalli(System.Reflection.Emit.OpCode, System.Reflection.CallingConventions, System.Type, System.Type[], System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="opcode">TODO</param>
+ <param name="call_conv">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="paramTypes">TODO</param>
+ <param name="optionalParamTypes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/Label.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/Label.xml
new file mode 100644
index 00000000000..b74c4625cbe
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/Label.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.Emit.Label" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/LocalBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/LocalBuilder.xml
new file mode 100644
index 00000000000..9509fc3d3e5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/LocalBuilder.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.LocalBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="LocalType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SetLocalSymInfo(System.String, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="lname">TODO</param>
+ <param name="startOffset">TODO</param>
+ <param name="endOffset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetLocalSymInfo(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="lname">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/MethodBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/MethodBuilder.xml
new file mode 100644
index 00000000000..9aad40e60d4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/MethodBuilder.xml
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.MethodBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="TypeBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReturnType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReflectedType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DeclaringType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MethodHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReturnTypeCustomAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetBaseDefinition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="parameters">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetParameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethodImplementationFlags">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetToken">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateMethodBody(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="il">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetILGenerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetILGenerator(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="size">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineParameter(System.Int32, System.Reflection.ParameterAttributes, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="position">TODO</param>
+ <param name="attributes">TODO</param>
+ <param name="strParamName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="customBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.ConstructorInfo, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="binaryAttribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetImplementationFlags(System.Reflection.MethodImplAttributes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/MethodToken.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/MethodToken.xml
new file mode 100644
index 00000000000..e1b32b43cae
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/MethodToken.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.Emit.MethodToken" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Token">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ModuleBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ModuleBuilder.xml
new file mode 100644
index 00000000000..1e82dc25201
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ModuleBuilder.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.ModuleBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="FullyQualifiedName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetType(System.String, System.Boolean, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="className">TODO</param>
+ <param name="throwOnError">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetType(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="className">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetType(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="className">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineType(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineType(System.String, System.Reflection.TypeAttributes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineType(System.String, System.Reflection.TypeAttributes, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <param name="parent">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineType(System.String, System.Reflection.TypeAttributes, System.Type, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <param name="parent">TODO</param>
+ <param name="interfaces">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineType(System.String, System.Reflection.TypeAttributes, System.Type, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <param name="parent">TODO</param>
+ <param name="typesize">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineType(System.String, System.Reflection.TypeAttributes, System.Type, System.Reflection.Emit.PackingSize)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <param name="parent">TODO</param>
+ <param name="packsize">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineType(System.String, System.Reflection.TypeAttributes, System.Type, System.Reflection.Emit.PackingSize, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <param name="parent">TODO</param>
+ <param name="packsize">TODO</param>
+ <param name="typesize">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetArrayMethod(System.Type, System.String, System.Reflection.CallingConventions, System.Type, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="arrayClass">TODO</param>
+ <param name="methodName">TODO</param>
+ <param name="callingConvention">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="parameterTypes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineEnum(System.String, System.Reflection.TypeAttributes, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="visibility">TODO</param>
+ <param name="underlyingType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="customBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.ConstructorInfo, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="binaryAttribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSymWriter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCode.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCode.xml
new file mode 100644
index 00000000000..6f7e1899907
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCode.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.Emit.OpCode" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Size">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OpCodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OperandType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FlowControl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="StackBehaviourPop">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="StackBehaviourPush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCodeType.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCodeType.xml
new file mode 100644
index 00000000000..7f4f406ae8b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCodeType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.Emit.OpCodeType" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCodes.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCodes.xml
new file mode 100644
index 00000000000..073b8d5bb00
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OpCodes.xml
@@ -0,0 +1,906 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.OpCodes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="OpCodes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="Add">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Add_Ovf">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Add_Ovf_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="And">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Arglist">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Beq">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Beq_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Bge">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Bge_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Bge_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Bge_Un_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Bgt">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Bgt_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Bgt_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Bgt_Un_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ble">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ble_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ble_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ble_Un_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Blt">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Blt_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Blt_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Blt_Un_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Bne_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Bne_Un_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Box">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Boxval">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Br">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Br_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Break">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Brfalse">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Brfalse_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Brtrue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Brtrue_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Call">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Calli">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Callvirt">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Castclass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ceq">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Cgt">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Cgt_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ckfinite">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Clt">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Clt_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_I">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_I1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_I2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_I4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_I8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_I">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_I_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_I1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_I1_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_I2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_I2_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_I4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_I4_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_I8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_I8_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_U">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_U_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_U1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_U1_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_U2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_U2_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_U4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_U4_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_U8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_Ovf_U8_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_R_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_R4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_R8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_U">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_U1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_U2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_U4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Conv_U8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Cpblk">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Cpobj">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Div">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Div_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Dup">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Endfilter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Endfinally">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Initblk">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Initobj">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Isinst">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Jmp">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldarg">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldarg_0">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldarg_1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldarg_2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldarg_3">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldarg_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldarga">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldarga_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4_0">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4_1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4_2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4_3">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4_4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4_5">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4_6">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4_7">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4_8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4_M1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I4_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_I8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_R4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldc_R8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelem_I">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelem_I1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelem_I2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelem_I4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelem_I8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelem_R4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelem_R8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelem_Ref">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelem_U1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelem_U2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelem_U4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldelema">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldfld">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldflda">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldftn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldind_I">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldind_I1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldind_I2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldind_I4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldind_I8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldind_R4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldind_R8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldind_Ref">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldind_U1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldind_U2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldind_U4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldlen">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldloc">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldloc_0">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldloc_1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldloc_2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldloc_3">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldloc_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldloca">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldloca_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldnull">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldobj">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldsfld">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldsflda">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldstr">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldtoken">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ldvirtftn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Leave">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Leave_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Localloc">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Mkrefany">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Mul">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Mul_Ovf">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Mul_Ovf_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Neg">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Newarr">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Newobj">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Nop">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Not">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Or">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Pop">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Prefix1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Prefix2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Prefix3">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Prefix4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Prefix5">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Prefix6">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Prefix7">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Prefixref">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Refanytype">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Refanyval">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Rem">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Rem_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Ret">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Rethrow">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Shl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Shr">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Shr_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Sizeof">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Starg">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Starg_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stelem_I">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stelem_I1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stelem_I2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stelem_I4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stelem_I8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stelem_R4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stelem_R8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stelem_Ref">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stfld">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stind_I">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stind_I1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stind_I2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stind_I4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stind_I8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stind_R4">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stind_R8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stind_Ref">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stloc">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stloc_0">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stloc_1">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stloc_2">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stloc_3">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stloc_S">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stobj">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Stsfld">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Sub">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Sub_Ovf">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Sub_Ovf_Un">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Switch">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Tailcall">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Throw">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Unaligned">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Unbox">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Volatile">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Xor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="TakesSingleByteArgument(System.Reflection.Emit.OpCode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inst">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OperandType.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OperandType.xml
new file mode 100644
index 00000000000..e0c868f8dc4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/OperandType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.Emit.OperandType" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PEFileKinds.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PEFileKinds.xml
new file mode 100644
index 00000000000..a09166ae5a7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PEFileKinds.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.Emit.PEFileKinds" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PackingSize.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PackingSize.xml
new file mode 100644
index 00000000000..71f79d630f3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PackingSize.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.Emit.PackingSize" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ParameterBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ParameterBuilder.xml
new file mode 100644
index 00000000000..6af1e4167bb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ParameterBuilder.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.ParameterBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsIn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsOut">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsOptional">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Position">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SetMarshal(System.Reflection.Emit.UnmanagedMarshal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="unmanagedMarshal">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetConstant(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="defaultValue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetToken">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="customBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.ConstructorInfo, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="binaryAttribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ParameterToken.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ParameterToken.xml
new file mode 100644
index 00000000000..c6c21f46333
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/ParameterToken.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.Emit.ParameterToken" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Token">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PropertyBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PropertyBuilder.xml
new file mode 100644
index 00000000000..08c9ab1e657
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PropertyBuilder.xml
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.PropertyBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanRead">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanWrite">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DeclaringType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PropertyToken">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PropertyType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReflectedType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SetValue(System.Object, System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="value">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="index">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetValue(System.Object, System.Object, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="value">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="index">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue(System.Object, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSetMethod(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetIndexParameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetGetMethod(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAccessors(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddOtherMethod(System.Reflection.Emit.MethodBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mdBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetConstant(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="defaultValue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="customBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.ConstructorInfo, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="binaryAttribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetGetMethod(System.Reflection.Emit.MethodBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mdBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetSetMethod(System.Reflection.Emit.MethodBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mdBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PropertyToken.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PropertyToken.xml
new file mode 100644
index 00000000000..12faff1b7dc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/PropertyToken.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.Emit.PropertyToken" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Token">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/SignatureHelper.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/SignatureHelper.xml
new file mode 100644
index 00000000000..d11c41ad967
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/SignatureHelper.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.SignatureHelper" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFieldSigHelper(System.Reflection.Module)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mod">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLocalVarSigHelper(System.Reflection.Module)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mod">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethodSigHelper(System.Reflection.Module, System.Reflection.CallingConventions, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mod">TODO</param>
+ <param name="callingConvention">TODO</param>
+ <param name="returnType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethodSigHelper(System.Reflection.Module, System.Type, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mod">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="parameterTypes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetPropertySigHelper(System.Reflection.Module, System.Type, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mod">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="parameterTypes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddArgument(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="clsArgument">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddSentinel">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSignature">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/SignatureToken.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/SignatureToken.xml
new file mode 100644
index 00000000000..040d1c1cd76
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/SignatureToken.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.Emit.SignatureToken" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Token">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/StackBehaviour.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/StackBehaviour.xml
new file mode 100644
index 00000000000..f4f84e6398a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/StackBehaviour.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.Emit.StackBehaviour" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/StringToken.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/StringToken.xml
new file mode 100644
index 00000000000..a83f8dba6c2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/StringToken.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.Emit.StringToken" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Token">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/TypeBuilder.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/TypeBuilder.xml
new file mode 100644
index 00000000000..cd832ad0f9c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/TypeBuilder.xml
@@ -0,0 +1,403 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.TypeBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="UnspecifiedTypeSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Assembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AssemblyQualifiedName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DeclaringType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UnderlyingSystemType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FullName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="GUID">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Module">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Namespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PackingSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReflectedType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MemberType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TypeHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="InvokeMember(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object, System.Object[], System.Reflection.ParameterModifier[], System.Globalization.CultureInfo, System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="target">TODO</param>
+ <param name="args">TODO</param>
+ <param name="modifiers">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="namedParameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperties(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethods(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMembers(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFields(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetField(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetConstructors(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNestedTypes(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNestedType(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvents(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvent(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetElementType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterfaces">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterface(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddDeclarativeSecurity(System.Security.Permissions.SecurityAction, System.Security.PermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ <param name="pset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddInterfaceImplementation(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="interfaceType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineNestedType(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineNestedType(System.String, System.Reflection.TypeAttributes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineNestedType(System.String, System.Reflection.TypeAttributes, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <param name="parent">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineNestedType(System.String, System.Reflection.TypeAttributes, System.Type, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <param name="parent">TODO</param>
+ <param name="interfaces">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineNestedType(System.String, System.Reflection.TypeAttributes, System.Type, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <param name="parent">TODO</param>
+ <param name="typesize">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineNestedType(System.String, System.Reflection.TypeAttributes, System.Type, System.Reflection.Emit.PackingSize)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <param name="parent">TODO</param>
+ <param name="packsize">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineNestedType(System.String, System.Reflection.TypeAttributes, System.Type, System.Reflection.Emit.PackingSize, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attr">TODO</param>
+ <param name="parent">TODO</param>
+ <param name="packsize">TODO</param>
+ <param name="typesize">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineConstructor(System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributes">TODO</param>
+ <param name="callingConvention">TODO</param>
+ <param name="parameterTypes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDefaultConstructor(System.Reflection.MethodAttributes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineMethod(System.String, System.Reflection.MethodAttributes, System.Type, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attributes">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="parameterTypes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineMethod(System.String, System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attributes">TODO</param>
+ <param name="callingConvention">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="parameterTypes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefinePInvokeMethod(System.String, System.String, System.String, System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type, System.Type[], System.Runtime.InteropServices.CallingConvention, System.Runtime.InteropServices.CharSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="dllName">TODO</param>
+ <param name="entryName">TODO</param>
+ <param name="attributes">TODO</param>
+ <param name="callingConvention">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="parameterTypes">TODO</param>
+ <param name="nativeCallConv">TODO</param>
+ <param name="nativeCharSet">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefinePInvokeMethod(System.String, System.String, System.Reflection.MethodAttributes, System.Reflection.CallingConventions, System.Type, System.Type[], System.Runtime.InteropServices.CallingConvention, System.Runtime.InteropServices.CharSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="dllName">TODO</param>
+ <param name="attributes">TODO</param>
+ <param name="callingConvention">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="parameterTypes">TODO</param>
+ <param name="nativeCallConv">TODO</param>
+ <param name="nativeCharSet">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineMethodOverride(System.Reflection.MethodInfo, System.Reflection.MethodInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="methodInfoBody">TODO</param>
+ <param name="methodInfoDeclaration">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineField(System.String, System.Type, System.Reflection.FieldAttributes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fieldName">TODO</param>
+ <param name="type">TODO</param>
+ <param name="attributes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineProperty(System.String, System.Reflection.PropertyAttributes, System.Type, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attributes">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="parameterTypes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineTypeInitializer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="customBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCustomAttribute(System.Reflection.ConstructorInfo, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="con">TODO</param>
+ <param name="binaryAttribute">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineEvent(System.String, System.Reflection.EventAttributes, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="attributes">TODO</param>
+ <param name="eventtype">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineInitializedData(System.String, System.Byte[], System.Reflection.FieldAttributes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="data">TODO</param>
+ <param name="attributes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineUninitializedData(System.String, System.Int32, System.Reflection.FieldAttributes)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="size">TODO</param>
+ <param name="attributes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetParent(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parentType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/TypeToken.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/TypeToken.xml
new file mode 100644
index 00000000000..59bff0c653c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/TypeToken.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.Emit.TypeToken" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Token">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection.Emit/UnmanagedMarshal.xml b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/UnmanagedMarshal.xml
new file mode 100644
index 00000000000..319e6d226f2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection.Emit/UnmanagedMarshal.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Emit.UnmanagedMarshal" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UnmanagedMarshal">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BaseType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ElementCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="GetUnmanagedType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IIDGuid">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="DefineByValArray(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="elemCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineByValTStr(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="elemCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineLPArray(System.Runtime.InteropServices.UnmanagedType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="elemType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineSafeArray(System.Runtime.InteropServices.UnmanagedType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="elemType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineUnmanagedMarshal(System.Runtime.InteropServices.UnmanagedType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="unmanagedType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AmbiguousMatchException.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AmbiguousMatchException.xml
new file mode 100644
index 00000000000..3a5d3af8d94
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AmbiguousMatchException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AmbiguousMatchException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AmbiguousMatchException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="AmbiguousMatchException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="AmbiguousMatchException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/Assembly.xml b/mcs/docs/apidocs/xml/en/System.Reflection/Assembly.xml
new file mode 100644
index 00000000000..1242389ea58
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/Assembly.xml
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Assembly" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="CodeBase">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CopiedCodeBase">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FullName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EntryPoint">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Evidence">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Location">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetName(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="copiedName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetType(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetType(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="throwOnError">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetExportedTypes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetManifestResourceStream(System.Type, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetManifestResourceStream(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFile(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFiles">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetType(System.String, System.Boolean, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="throwOnError">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateQualifiedName(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyName">TODO</param>
+ <param name="typeName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="nCreateQualifiedName(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyName">TODO</param>
+ <param name="typeName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAssembly(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSatelliteAssembly(System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LoadFrom(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyFile">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyString">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.String, System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyString">TODO</param>
+ <param name="assemblySecurity">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.Reflection.AssemblyName)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyRef">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.Reflection.AssemblyName, System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyRef">TODO</param>
+ <param name="assemblySecurity">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rawAssembly">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rawAssembly">TODO</param>
+ <param name="rawSymbolStore">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.Byte[], System.Byte[], System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rawAssembly">TODO</param>
+ <param name="rawSymbolStore">TODO</param>
+ <param name="securityEvidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstance(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="typeName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstance(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="typeName">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstance(System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="typeName">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="args">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="activationAttributes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLoadedModules">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetModules">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetModule(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetManifestResourceNames">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetExecutingAssembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetReferencedAssemblies">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetManifestResourceInfo(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="resourceName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyAlgorithmIdAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyAlgorithmIdAttribute.xml
new file mode 100644
index 00000000000..0bacf8f7897
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyAlgorithmIdAttribute.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyAlgorithmIdAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyAlgorithmIdAttribute(System.Configuration.Assemblies.AssemblyHashAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="algorithmId">TODO</param>
+ </constructor>
+ <constructor name="AssemblyAlgorithmIdAttribute(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="algorithmId">TODO</param>
+ </constructor>
+ <property name="Algorithmid">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCompanyAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCompanyAttribute.xml
new file mode 100644
index 00000000000..c423f9322dc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCompanyAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyCompanyAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyCompanyAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="company">TODO</param>
+ </constructor>
+ <property name="Company">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyConfigurationAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyConfigurationAttribute.xml
new file mode 100644
index 00000000000..45c0463df99
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyConfigurationAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyConfigurationAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyConfigurationAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="configuration">TODO</param>
+ </constructor>
+ <property name="Configuration">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCopyrightAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCopyrightAttribute.xml
new file mode 100644
index 00000000000..512143e5958
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCopyrightAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyCopyrightAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyCopyrightAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="copyright">TODO</param>
+ </constructor>
+ <property name="Copyright">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCultureAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCultureAttribute.xml
new file mode 100644
index 00000000000..a79cd465a79
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyCultureAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyCultureAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyCultureAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="culture">TODO</param>
+ </constructor>
+ <property name="Culture">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDefaultAliasAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDefaultAliasAttribute.xml
new file mode 100644
index 00000000000..00f488258b8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDefaultAliasAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyDefaultAliasAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyDefaultAliasAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="defaultAlias">TODO</param>
+ </constructor>
+ <property name="DefaultAlias">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDelaySignAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDelaySignAttribute.xml
new file mode 100644
index 00000000000..50e99963c1c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDelaySignAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyDelaySignAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyDelaySignAttribute(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="delaySign">TODO</param>
+ </constructor>
+ <property name="DelaySIgn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDescriptionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDescriptionAttribute.xml
new file mode 100644
index 00000000000..5c54d463523
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyDescriptionAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyDescriptionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyDescriptionAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="description">TODO</param>
+ </constructor>
+ <property name="Description">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyFileVersionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyFileVersionAttribute.xml
new file mode 100644
index 00000000000..0d560bf351d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyFileVersionAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyFileVersionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyFileVersionAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="version">TODO</param>
+ </constructor>
+ <property name="FileVersion">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyFlagsAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyFlagsAttribute.xml
new file mode 100644
index 00000000000..ad58ed31774
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyFlagsAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyFlagsAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyFlagsAttribute(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="flags">TODO</param>
+ </constructor>
+ <property name="Flags">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyInformationalVersionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyInformationalVersionAttribute.xml
new file mode 100644
index 00000000000..792c7c81036
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyInformationalVersionAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyInformationalVersionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyInformationalVersionAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="informationalVersion">TODO</param>
+ </constructor>
+ <property name="InformationalVersion">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyKeyFileAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyKeyFileAttribute.xml
new file mode 100644
index 00000000000..17f3c538355
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyKeyFileAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyKeyFileAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyKeyFileAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="keyFile">TODO</param>
+ </constructor>
+ <property name="KeyFile">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyKeyNameAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyKeyNameAttribute.xml
new file mode 100644
index 00000000000..aaa3cd01b05
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyKeyNameAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyKeyNameAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyKeyNameAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="keyName">TODO</param>
+ </constructor>
+ <property name="KeyName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyName.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyName.xml
new file mode 100644
index 00000000000..619bb0c2c9b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyName.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyName" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CodeBase">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Version">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyNameFlags.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyNameFlags.xml
new file mode 100644
index 00000000000..13bde38d9cf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyNameFlags.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.AssemblyNameFlags" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyNameProxy.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyNameProxy.xml
new file mode 100644
index 00000000000..41626ac2931
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyNameProxy.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyNameProxy" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyNameProxy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="GetAssemblyName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyFile">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyProductAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyProductAttribute.xml
new file mode 100644
index 00000000000..81e087103de
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyProductAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyProductAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyProductAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="product">TODO</param>
+ </constructor>
+ <property name="Product">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyTitleAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyTitleAttribute.xml
new file mode 100644
index 00000000000..c1471166205
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyTitleAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyTitleAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyTitleAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="title">TODO</param>
+ </constructor>
+ <property name="Title">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyTrademarkAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyTrademarkAttribute.xml
new file mode 100644
index 00000000000..6e4c3ceb0e9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyTrademarkAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyTrademarkAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyTrademarkAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="trademark">TODO</param>
+ </constructor>
+ <property name="Trademark">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyVersionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyVersionAttribute.xml
new file mode 100644
index 00000000000..695007dab21
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/AssemblyVersionAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.AssemblyVersionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyVersionAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="version">TODO</param>
+ </constructor>
+ <property name="Version">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/Binder.xml b/mcs/docs/apidocs/xml/en/System.Reflection/Binder.xml
new file mode 100644
index 00000000000..c448c3df786
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/Binder.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Binder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/BindingFlags.xml b/mcs/docs/apidocs/xml/en/System.Reflection/BindingFlags.xml
new file mode 100644
index 00000000000..31ca9cc2b39
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/BindingFlags.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.BindingFlags" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/CallingConventions.xml b/mcs/docs/apidocs/xml/en/System.Reflection/CallingConventions.xml
new file mode 100644
index 00000000000..62900cc2d27
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/CallingConventions.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.CallingConventions" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/ConstructorInfo.xml b/mcs/docs/apidocs/xml/en/System.Reflection/ConstructorInfo.xml
new file mode 100644
index 00000000000..e925326cfe5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/ConstructorInfo.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.ConstructorInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="ConstructorName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="TypeConstructorName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="MemberType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Invoke(System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="parameters">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Invoke(System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/CustomAttributeFormatException.xml b/mcs/docs/apidocs/xml/en/System.Reflection/CustomAttributeFormatException.xml
new file mode 100644
index 00000000000..92f44cd0b5a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/CustomAttributeFormatException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.CustomAttributeFormatException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CustomAttributeFormatException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CustomAttributeFormatException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="CustomAttributeFormatException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/DefaultMemberAttribute.xml b/mcs/docs/apidocs/xml/en/System.Reflection/DefaultMemberAttribute.xml
new file mode 100644
index 00000000000..bcb877ba308
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/DefaultMemberAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.DefaultMemberAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DefaultMemberAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="member_name">TODO</param>
+ </constructor>
+ <property name="MemberName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/EventAttributes.xml b/mcs/docs/apidocs/xml/en/System.Reflection/EventAttributes.xml
new file mode 100644
index 00000000000..0d90a2e4aae
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/EventAttributes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.EventAttributes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/EventInfo.xml b/mcs/docs/apidocs/xml/en/System.Reflection/EventInfo.xml
new file mode 100644
index 00000000000..3f31dbae2ea
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/EventInfo.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.EventInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EventHandlerType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsMulticast">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSpecialName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MemberType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReflectedType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DeclaringType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetRemoveMethod(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetRaiseMethod(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAddMethod(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddEventHandler(System.Object, System.Delegate)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <param name="handler">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAddMethod">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetRaiseMethod">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetRemoveMethod">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveEventHandler(System.Object, System.Delegate)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <param name="handler">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/FieldAttributes.xml b/mcs/docs/apidocs/xml/en/System.Reflection/FieldAttributes.xml
new file mode 100644
index 00000000000..2e5155405c8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/FieldAttributes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.FieldAttributes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/FieldInfo.xml b/mcs/docs/apidocs/xml/en/System.Reflection/FieldInfo.xml
new file mode 100644
index 00000000000..3b3c317e29d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/FieldInfo.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.FieldInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FieldHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FieldType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MemberType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsLiteral">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsStatic">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsInitOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SetValue(System.Object, System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="val">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetValue(System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/ICustomAttributeProvider.xml b/mcs/docs/apidocs/xml/en/System.Reflection/ICustomAttributeProvider.xml
new file mode 100644
index 00000000000..9b7c98fe670
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/ICustomAttributeProvider.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Reflection.ICustomAttributeProvider" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/IReflect.xml b/mcs/docs/apidocs/xml/en/System.Reflection/IReflect.xml
new file mode 100644
index 00000000000..c04c002c107
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/IReflect.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Reflection.IReflect" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/InterfaceMapping.xml b/mcs/docs/apidocs/xml/en/System.Reflection/InterfaceMapping.xml
new file mode 100644
index 00000000000..27962317fdc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/InterfaceMapping.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.InterfaceMapping" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="InterfaceMethods">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="InterfaceType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="TargetMethods">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="TargetType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/InvalidFilterCriteriaException.xml b/mcs/docs/apidocs/xml/en/System.Reflection/InvalidFilterCriteriaException.xml
new file mode 100644
index 00000000000..7ad6a818bc8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/InvalidFilterCriteriaException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.InvalidFilterCriteriaException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="InvalidFilterCriteriaException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="InvalidFilterCriteriaException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="InvalidFilterCriteriaException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/ManifestResourceInfo.xml b/mcs/docs/apidocs/xml/en/System.Reflection/ManifestResourceInfo.xml
new file mode 100644
index 00000000000..f7e8f5a4053
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/ManifestResourceInfo.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.ManifestResourceInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ManifestResourceInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/MemberFilter.xml b/mcs/docs/apidocs/xml/en/System.Reflection/MemberFilter.xml
new file mode 100644
index 00000000000..35f2264e974
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/MemberFilter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Reflection.MemberFilter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/MemberInfo.xml b/mcs/docs/apidocs/xml/en/System.Reflection/MemberInfo.xml
new file mode 100644
index 00000000000..7eee5b7f37b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/MemberInfo.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.MemberInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="DeclaringType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MemberType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReflectedType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/MemberTypes.xml b/mcs/docs/apidocs/xml/en/System.Reflection/MemberTypes.xml
new file mode 100644
index 00000000000..d83d3710f38
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/MemberTypes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.MemberTypes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/MethodAttributes.xml b/mcs/docs/apidocs/xml/en/System.Reflection/MethodAttributes.xml
new file mode 100644
index 00000000000..88166ec4277
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/MethodAttributes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.MethodAttributes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/MethodBase.xml b/mcs/docs/apidocs/xml/en/System.Reflection/MethodBase.xml
new file mode 100644
index 00000000000..54ce51269ff
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/MethodBase.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.MethodBase" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="MethodHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CallingConvention">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsPublic">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsPrivate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFamily">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsAssembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFamilyAndAssembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFamilyOrAssembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsStatic">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFinal">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsVirtual">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsHideBySig">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsAbstract">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSpecialName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsConstructor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="parameters">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetParameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethodImplementationFlags">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCurrentMethod">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethodFromHandle(System.RuntimeMethodHandle)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="handle">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Invoke(System.Object, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="parameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/MethodImplAttributes.xml b/mcs/docs/apidocs/xml/en/System.Reflection/MethodImplAttributes.xml
new file mode 100644
index 00000000000..3ab67ac5c47
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/MethodImplAttributes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.MethodImplAttributes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/MethodInfo.xml b/mcs/docs/apidocs/xml/en/System.Reflection/MethodInfo.xml
new file mode 100644
index 00000000000..2515971330c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/MethodInfo.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.MethodInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="MemberType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReturnType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReturnTypeCustomAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetBaseDefinition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/Missing.xml b/mcs/docs/apidocs/xml/en/System.Reflection/Missing.xml
new file mode 100644
index 00000000000..441f3aaff0e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/Missing.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Missing" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/Module.xml b/mcs/docs/apidocs/xml/en/System.Reflection/Module.xml
new file mode 100644
index 00000000000..22815103cd2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/Module.xml
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.Module" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="FilterTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="FilterTypeNameIgnoreCase">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Assembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FullyQualifiedName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ScopeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetType(System.String, System.Boolean, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="className">TODO</param>
+ <param name="throwOnError">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetType(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="className">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetType(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="className">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FindTypes(System.Reflection.TypeFilter, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="filter">TODO</param>
+ <param name="filterCriteria">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetField(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetField(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="flags">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFields">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethod(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethod(System.String, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="types">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethod(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Reflection.CallingConventions, System.Type[], System.Reflection.ParameterModifier[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="callConvention">TODO</param>
+ <param name="types">TODO</param>
+ <param name="modifiers">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethods">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSignerCertificate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsResource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/MonoEvent.xml b/mcs/docs/apidocs/xml/en/System.Reflection/MonoEvent.xml
new file mode 100644
index 00000000000..11cd9de2dde
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/MonoEvent.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.MonoEvent" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MonoEvent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DeclaringType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetRemoveMethod(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetRaiseMethod(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAddMethod(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/ParameterAttributes.xml b/mcs/docs/apidocs/xml/en/System.Reflection/ParameterAttributes.xml
new file mode 100644
index 00000000000..ec76a3e1bc5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/ParameterAttributes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.ParameterAttributes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/ParameterInfo.xml b/mcs/docs/apidocs/xml/en/System.Reflection/ParameterInfo.xml
new file mode 100644
index 00000000000..9f5ad7c1708
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/ParameterInfo.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.ParameterInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="ParameterType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DefaultValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsIn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsLcid">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsOptional">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsOut">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsRetval">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Member">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Position">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/ParameterModifier.xml b/mcs/docs/apidocs/xml/en/System.Reflection/ParameterModifier.xml
new file mode 100644
index 00000000000..bd5e0a98ab3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/ParameterModifier.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Reflection.ParameterModifier" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ParameterModifier(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="paramaterCount">TODO</param>
+ </constructor>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/PropertyAttributes.xml b/mcs/docs/apidocs/xml/en/System.Reflection/PropertyAttributes.xml
new file mode 100644
index 00000000000..ce1472de9fd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/PropertyAttributes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.PropertyAttributes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/PropertyInfo.xml b/mcs/docs/apidocs/xml/en/System.Reflection/PropertyInfo.xml
new file mode 100644
index 00000000000..ec54c0b3bdb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/PropertyInfo.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.PropertyInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanRead">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanWrite">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSpecialName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MemberType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PropertyType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SetValue(System.Object, System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="value">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="index">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetValue(System.Object, System.Object, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="value">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="index">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue(System.Object, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSetMethod(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetIndexParameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetGetMethod(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAccessors(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nonPublic">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAccessors">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetGetMethod">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSetMethod">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/ReflectionTypeLoadException.xml b/mcs/docs/apidocs/xml/en/System.Reflection/ReflectionTypeLoadException.xml
new file mode 100644
index 00000000000..850cc64bb84
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/ReflectionTypeLoadException.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.ReflectionTypeLoadException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ReflectionTypeLoadException(System.Type[], System.Exception[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="classes">TODO</param>
+ <param name="exceptions">TODO</param>
+ </constructor>
+ <constructor name="ReflectionTypeLoadException(System.Type[], System.Exception[], System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="classes">TODO</param>
+ <param name="exceptions">TODO</param>
+ <param name="message">TODO</param>
+ </constructor>
+ <property name="Types">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LoaderExceptions">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/ResourceAttributes.xml b/mcs/docs/apidocs/xml/en/System.Reflection/ResourceAttributes.xml
new file mode 100644
index 00000000000..dacb03d5d06
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/ResourceAttributes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.ResourceAttributes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/ResourceLocation.xml b/mcs/docs/apidocs/xml/en/System.Reflection/ResourceLocation.xml
new file mode 100644
index 00000000000..dc74eff20a5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/ResourceLocation.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.ResourceLocation" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/StrongNameKeyPair.xml b/mcs/docs/apidocs/xml/en/System.Reflection/StrongNameKeyPair.xml
new file mode 100644
index 00000000000..70a35904b43
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/StrongNameKeyPair.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.StrongNameKeyPair" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StrongNameKeyPair(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="keyPairArray">TODO</param>
+ </constructor>
+ <constructor name="StrongNameKeyPair(System.IO.FileStream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="keyPairFile">TODO</param>
+ </constructor>
+ <constructor name="StrongNameKeyPair(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="keyPairContainer">TODO</param>
+ </constructor>
+ <property name="PublicKey">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/TargetException.xml b/mcs/docs/apidocs/xml/en/System.Reflection/TargetException.xml
new file mode 100644
index 00000000000..875ef0d6d44
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/TargetException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.TargetException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TargetException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="TargetException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="TargetException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/TargetInvocationException.xml b/mcs/docs/apidocs/xml/en/System.Reflection/TargetInvocationException.xml
new file mode 100644
index 00000000000..a91825216d2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/TargetInvocationException.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.TargetInvocationException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/TargetParameterCountException.xml b/mcs/docs/apidocs/xml/en/System.Reflection/TargetParameterCountException.xml
new file mode 100644
index 00000000000..bcb8293f2cb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/TargetParameterCountException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.TargetParameterCountException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TargetParameterCountException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="TargetParameterCountException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="TargetParameterCountException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/TypeAttributes.xml b/mcs/docs/apidocs/xml/en/System.Reflection/TypeAttributes.xml
new file mode 100644
index 00000000000..4df8773a742
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/TypeAttributes.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Reflection.TypeAttributes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/TypeDelegator.xml b/mcs/docs/apidocs/xml/en/System.Reflection/TypeDelegator.xml
new file mode 100644
index 00000000000..f7083032310
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/TypeDelegator.xml
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Reflection.TypeDelegator" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TypeDelegator(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="delegatingType">TODO</param>
+ </constructor>
+ <property name="Assembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AssemblyQualifiedName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FullName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="GUID">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Module">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Namespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TypeHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UnderlyingSystemType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="InvokeMember(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object, System.Object[], System.Reflection.ParameterModifier[], System.Globalization.CultureInfo, System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="target">TODO</param>
+ <param name="args">TODO</param>
+ <param name="modifiers">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="namedParameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperties(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethods(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMembers(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFields(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetField(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetConstructors(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNestedTypes(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNestedType(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMember(System.String, System.Reflection.MemberTypes, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="type">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvents(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvents">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvent(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetElementType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterfaces">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterfaceMap(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="interfaceType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterface(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="attributeType">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Reflection/TypeFilter.xml b/mcs/docs/apidocs/xml/en/System.Reflection/TypeFilter.xml
new file mode 100644
index 00000000000..b924d176016
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Reflection/TypeFilter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Reflection.TypeFilter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Resources/IResourceReader.xml b/mcs/docs/apidocs/xml/en/System.Resources/IResourceReader.xml
new file mode 100644
index 00000000000..b99fa0f108d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Resources/IResourceReader.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Resources.IResourceReader" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Resources/IResourceWriter.xml b/mcs/docs/apidocs/xml/en/System.Resources/IResourceWriter.xml
new file mode 100644
index 00000000000..c6ffe6cfbaa
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Resources/IResourceWriter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Resources.IResourceWriter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Resources/MissingManifestResourceException.xml b/mcs/docs/apidocs/xml/en/System.Resources/MissingManifestResourceException.xml
new file mode 100644
index 00000000000..678e30ce10f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Resources/MissingManifestResourceException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Resources.MissingManifestResourceException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MissingManifestResourceException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="MissingManifestResourceException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="MissingManifestResourceException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="e">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Resources/NeutralResourcesLanguageAttribute.xml b/mcs/docs/apidocs/xml/en/System.Resources/NeutralResourcesLanguageAttribute.xml
new file mode 100644
index 00000000000..f798d9d0b32
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Resources/NeutralResourcesLanguageAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Resources.NeutralResourcesLanguageAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NeutralResourcesLanguageAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cultureName">TODO</param>
+ </constructor>
+ <property name="CultureName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Resources/ResourceManager.xml b/mcs/docs/apidocs/xml/en/System.Resources/ResourceManager.xml
new file mode 100644
index 00000000000..69acbb88c98
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Resources/ResourceManager.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Resources.ResourceManager" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ResourceManager(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="resourceSource">TODO</param>
+ </constructor>
+ <constructor name="ResourceManager(System.String, System.Reflection.Assembly)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="baseName">TODO</param>
+ <param name="assembly">TODO</param>
+ </constructor>
+ <constructor name="ResourceManager(System.String, System.Reflection.Assembly, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="baseName">TODO</param>
+ <param name="assembly">TODO</param>
+ <param name="usingResourceSet">TODO</param>
+ </constructor>
+ <field name="HeaderVersionNumber">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="BaseName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IgnoreCase">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ResourceSetType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ReleaseAllResources">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetString(System.String, System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetResourceSet(System.Globalization.CultureInfo, System.Boolean, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="culture">TODO</param>
+ <param name="createIfNotExists">TODO</param>
+ <param name="tryParents">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateFileBasedResourceManager(System.String, System.String, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="baseName">TODO</param>
+ <param name="resourceDir">TODO</param>
+ <param name="usingResourceSet">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Resources/ResourceReader.xml b/mcs/docs/apidocs/xml/en/System.Resources/ResourceReader.xml
new file mode 100644
index 00000000000..5be53e6154d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Resources/ResourceReader.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Resources.ResourceReader" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ResourceReader(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ </constructor>
+ <constructor name="ResourceReader(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileName">TODO</param>
+ </constructor>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Resources/ResourceSet.xml b/mcs/docs/apidocs/xml/en/System.Resources/ResourceSet.xml
new file mode 100644
index 00000000000..7e2c97f547e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Resources/ResourceSet.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Resources.ResourceSet" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ResourceSet(System.Resources.IResourceReader)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="reader">TODO</param>
+ </constructor>
+ <constructor name="ResourceSet(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ </constructor>
+ <constructor name="ResourceSet(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileName">TODO</param>
+ </constructor>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetString(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetObject(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetObject(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDefaultWriter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDefaultReader">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Resources/ResourceWriter.xml b/mcs/docs/apidocs/xml/en/System.Resources/ResourceWriter.xml
new file mode 100644
index 00000000000..e1737e13baf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Resources/ResourceWriter.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Resources.ResourceWriter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ResourceWriter(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ </constructor>
+ <constructor name="ResourceWriter(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileName">TODO</param>
+ </constructor>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Generate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddResource(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddResource(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddResource(System.String, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Resources/SatelliteContractVersionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Resources/SatelliteContractVersionAttribute.xml
new file mode 100644
index 00000000000..98b849f3cd1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Resources/SatelliteContractVersionAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Resources.SatelliteContractVersionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SatelliteContractVersionAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="version">TODO</param>
+ </constructor>
+ <property name="Version">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/IndexerNameAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/IndexerNameAttribute.xml
new file mode 100644
index 00000000000..511ebe32b23
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/IndexerNameAttribute.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.CompilerServices.IndexerNameAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IndexerNameAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="indexer_name">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodCodeType.xml b/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodCodeType.xml
new file mode 100644
index 00000000000..f00e79e4038
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodCodeType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.CompilerServices.MethodCodeType" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodImplAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodImplAttribute.xml
new file mode 100644
index 00000000000..4564595c8ab
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodImplAttribute.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.CompilerServices.MethodImplAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MethodImplAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="MethodImplAttribute(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="options">TODO</param>
+ </constructor>
+ <constructor name="MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="options">TODO</param>
+ </constructor>
+ <field name="MethodCodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodImplOptions.xml b/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodImplOptions.xml
new file mode 100644
index 00000000000..67ac30f5ee5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/MethodImplOptions.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.CompilerServices.MethodImplOptions" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/RuntimeHelpers.xml b/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/RuntimeHelpers.xml
new file mode 100644
index 00000000000..222ea016a06
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.CompilerServices/RuntimeHelpers.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.CompilerServices.RuntimeHelpers" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="OffsetToStringData">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="InitializeArray(System.Array, System.RuntimeFieldHandle)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="fldHandle">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/AssemblyRegistrationFlags.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/AssemblyRegistrationFlags.xml
new file mode 100644
index 00000000000..fc74cc58d59
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/AssemblyRegistrationFlags.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.AssemblyRegistrationFlags" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/CallingConvention.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/CallingConvention.xml
new file mode 100644
index 00000000000..6d77ef477b3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/CallingConvention.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.CallingConvention" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/CharSet.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/CharSet.xml
new file mode 100644
index 00000000000..98791441587
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/CharSet.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.CharSet" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ClassInterfaceAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ClassInterfaceAttribute.xml
new file mode 100644
index 00000000000..57b6a3a5291
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ClassInterfaceAttribute.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.InteropServices.ClassInterfaceAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ClassInterfaceAttribute(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="classInterfaceType">TODO</param>
+ </constructor>
+ <constructor name="ClassInterfaceAttribute(System.Runtime.InteropServices.ClassInterfaceType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="classInterfaceType">TODO</param>
+ </constructor>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ClassInterfaceType.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ClassInterfaceType.xml
new file mode 100644
index 00000000000..aa3d7b2644f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ClassInterfaceType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.ClassInterfaceType" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ComInterfaceType.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ComInterfaceType.xml
new file mode 100644
index 00000000000..38bb54f1713
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ComInterfaceType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.ComInterfaceType" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/DllImportAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/DllImportAttribute.xml
new file mode 100644
index 00000000000..268829d1efe
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/DllImportAttribute.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.InteropServices.DllImportAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DllImportAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dllName">TODO</param>
+ </constructor>
+ <field name="CallingConvention">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="CharSet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="EntryPoint">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="ExactSpelling">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="PreserveSig">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SetLastError">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ExporterEventKind.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ExporterEventKind.xml
new file mode 100644
index 00000000000..239ee958cba
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ExporterEventKind.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.ExporterEventKind" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ExternalException.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ExternalException.xml
new file mode 100644
index 00000000000..11f3477f1c4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ExternalException.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.InteropServices.ExternalException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ExternalException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ExternalException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ExternalException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <constructor name="ExternalException(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="errorCode">TODO</param>
+ </constructor>
+ <property name="ErrorCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/FieldOffsetAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/FieldOffsetAttribute.xml
new file mode 100644
index 00000000000..4141b765c65
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/FieldOffsetAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.InteropServices.FieldOffsetAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FieldOffsetAttribute(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ </constructor>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GCHandle.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GCHandle.xml
new file mode 100644
index 00000000000..b02d62413a6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GCHandle.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Runtime.InteropServices.GCHandle" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="IsAllocated">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Target">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="AddrOfPinnedObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Alloc(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Alloc(System.Object, System.Runtime.InteropServices.GCHandleType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Free">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Explicit(System.Runtime.InteropServices.GCHandle)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.IntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GCHandleType.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GCHandleType.xml
new file mode 100644
index 00000000000..74bfc108fb4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GCHandleType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.GCHandleType" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GuidAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GuidAttribute.xml
new file mode 100644
index 00000000000..39415881982
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/GuidAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.InteropServices.GuidAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="GuidAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="guid">TODO</param>
+ </constructor>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomAdapter.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomAdapter.xml
new file mode 100644
index 00000000000..3a3c60c2c07
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomAdapter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.InteropServices.ICustomAdapter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomFactory.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomFactory.xml
new file mode 100644
index 00000000000..735f6098d42
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomFactory.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.InteropServices.ICustomFactory" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomMarshaler.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomMarshaler.xml
new file mode 100644
index 00000000000..b38477dd864
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ICustomMarshaler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.InteropServices.ICustomMarshaler" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/IRegistrationServices.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/IRegistrationServices.xml
new file mode 100644
index 00000000000..b4c92087a63
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/IRegistrationServices.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.InteropServices.IRegistrationServices" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibConverter.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibConverter.xml
new file mode 100644
index 00000000000..482844a771c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibConverter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.InteropServices.ITypeLibConverter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibExporterNameProvider.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibExporterNameProvider.xml
new file mode 100644
index 00000000000..ca3a2ce1bee
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibExporterNameProvider.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.InteropServices.ITypeLibExporterNameProvider" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibExporterNotifySink.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibExporterNotifySink.xml
new file mode 100644
index 00000000000..ed6aea5e761
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibExporterNotifySink.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.InteropServices.ITypeLibExporterNotifySink" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibImporterNotifySink.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibImporterNotifySink.xml
new file mode 100644
index 00000000000..d8f0d83b095
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ITypeLibImporterNotifySink.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.InteropServices.ITypeLibImporterNotifySink" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ImporterEventKind.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ImporterEventKind.xml
new file mode 100644
index 00000000000..6cb53b31f07
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/ImporterEventKind.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.ImporterEventKind" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/InAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/InAttribute.xml
new file mode 100644
index 00000000000..411fa8d0134
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/InAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.InteropServices.InAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="InAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/InterfaceTypeAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/InterfaceTypeAttribute.xml
new file mode 100644
index 00000000000..4e40deadc2e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/InterfaceTypeAttribute.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.InteropServices.InterfaceTypeAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="interfaceType">TODO</param>
+ </constructor>
+ <constructor name="InterfaceTypeAttribute(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="interfaceType">TODO</param>
+ </constructor>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/LayoutKind.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/LayoutKind.xml
new file mode 100644
index 00000000000..0468dfdf90e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/LayoutKind.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.LayoutKind" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/MarshalAsAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/MarshalAsAttribute.xml
new file mode 100644
index 00000000000..65f76224c86
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/MarshalAsAttribute.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.InteropServices.MarshalAsAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MarshalAsAttribute(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="unmanagedType">TODO</param>
+ </constructor>
+ <constructor name="MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="unmanagedType">TODO</param>
+ </constructor>
+ <field name="ArraySubType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MarshalCookie">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MarshalType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MarshalTypeRef">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SafeArraySubType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SizeConst">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SizeParamIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/OptionalAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/OptionalAttribute.xml
new file mode 100644
index 00000000000..d5f4bc3583e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/OptionalAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.InteropServices.OptionalAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="OptionalAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/OutAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/OutAttribute.xml
new file mode 100644
index 00000000000..44803c141a8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/OutAttribute.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.InteropServices.OutAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="OutAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="TypeId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/PInvokeMap.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/PInvokeMap.xml
new file mode 100644
index 00000000000..8513a5f5696
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/PInvokeMap.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.PInvokeMap" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/StructLayoutAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/StructLayoutAttribute.xml
new file mode 100644
index 00000000000..6479cd91597
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/StructLayoutAttribute.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.InteropServices.StructLayoutAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StructLayoutAttribute(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="layoutKind">TODO</param>
+ </constructor>
+ <constructor name="StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="layoutKind">TODO</param>
+ </constructor>
+ <field name="CharSet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Pack">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Size">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/TypeLibExporterFlags.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/TypeLibExporterFlags.xml
new file mode 100644
index 00000000000..0402473075e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/TypeLibExporterFlags.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.TypeLibExporterFlags" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/UnmanagedType.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/UnmanagedType.xml
new file mode 100644
index 00000000000..201b0268721
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/UnmanagedType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.UnmanagedType" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/VarEnum.xml b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/VarEnum.xml
new file mode 100644
index 00000000000..a0f3aaf4e23
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.InteropServices/VarEnum.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.InteropServices.VarEnum" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/ActivatorLevel.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/ActivatorLevel.xml
new file mode 100644
index 00000000000..19cbde98683
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/ActivatorLevel.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Remoting.Activation.ActivatorLevel" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IActivator.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IActivator.xml
new file mode 100644
index 00000000000..07a950d4128
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IActivator.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Activation.IActivator" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IConstructionCallMessage.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IConstructionCallMessage.xml
new file mode 100644
index 00000000000..58bf5868119
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IConstructionCallMessage.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Activation.IConstructionCallMessage" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IConstructionReturnMessage.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IConstructionReturnMessage.xml
new file mode 100644
index 00000000000..f2f8d4e42db
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Activation/IConstructionReturnMessage.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Activation.IConstructionReturnMessage" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/Context.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/Context.xml
new file mode 100644
index 00000000000..c300f6fdbb3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/Context.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Remoting.Contexts.Context" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Context">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="DefaultContext">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ContextID">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetProperty(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetProperty(System.Runtime.Remoting.Contexts.IContextProperty)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prop">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/ContextAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/ContextAttribute.xml
new file mode 100644
index 00000000000..7eee55e5d81
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/ContextAttribute.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Remoting.Contexts.ContextAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ContextAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="IsNewContextOK(System.Runtime.Remoting.Contexts.Context)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ctx">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Freeze(System.Runtime.Remoting.Contexts.Context)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ctx">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsContextOK(System.Runtime.Remoting.Contexts.Context, System.Runtime.Remoting.Activation.IConstructionCallMessage)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ctx">TODO</param>
+ <param name="msg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetPropertiesForNewContext(System.Runtime.Remoting.Activation.IConstructionCallMessage)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="msg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IContextAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IContextAttribute.xml
new file mode 100644
index 00000000000..afa3202b2f1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IContextAttribute.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Contexts.IContextAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IContextProperty.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IContextProperty.xml
new file mode 100644
index 00000000000..2893cc7da0b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IContextProperty.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Contexts.IContextProperty" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IDynamicMessageSink.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IDynamicMessageSink.xml
new file mode 100644
index 00000000000..436c49d3529
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IDynamicMessageSink.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Contexts.IDynamicMessageSink" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IDynamicProperty.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IDynamicProperty.xml
new file mode 100644
index 00000000000..2be4ee71ad4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/IDynamicProperty.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Contexts.IDynamicProperty" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/SynchronizationAttribute.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/SynchronizationAttribute.xml
new file mode 100644
index 00000000000..ec87c6f2479
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Contexts/SynchronizationAttribute.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Contexts.SynchronizationAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/AsyncResult.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/AsyncResult.xml
new file mode 100644
index 00000000000..ce3f8077321
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/AsyncResult.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Remoting.Messaging.AsyncResult" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AsyncResult">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AsyncState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AsyncWaitHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CompletedSynchronously">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsCompleted">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EndInvokeCalled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AsyncDelegate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/Header.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/Header.xml
new file mode 100644
index 00000000000..b1883983449
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/Header.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Remoting.Messaging.Header" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Header(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="Header(System.String, System.Object, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <param name="must_understand">TODO</param>
+ </constructor>
+ <constructor name="Header(System.String, System.Object, System.Boolean, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <param name="must_understand">TODO</param>
+ <param name="header_namespace">TODO</param>
+ </constructor>
+ <field name="HeaderNamespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MustUnderstand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessage.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessage.xml
new file mode 100644
index 00000000000..a5198ddfc75
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessage.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Messaging.IMessage" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessageCtrl.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessageCtrl.xml
new file mode 100644
index 00000000000..5369b4cbd10
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessageCtrl.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Messaging.IMessageCtrl" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessageSink.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessageSink.xml
new file mode 100644
index 00000000000..49111124191
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMessageSink.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Messaging.IMessageSink" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodCallMessage.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodCallMessage.xml
new file mode 100644
index 00000000000..34d4fcc7bf7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodCallMessage.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Messaging.IMethodCallMessage" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodMessage.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodMessage.xml
new file mode 100644
index 00000000000..d98ed321044
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodMessage.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Messaging.IMethodMessage" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodReturnMessage.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodReturnMessage.xml
new file mode 100644
index 00000000000..0ee99aa9705
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/IMethodReturnMessage.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Remoting.Messaging.IMethodReturnMessage" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/LogicalCallContext.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/LogicalCallContext.xml
new file mode 100644
index 00000000000..d0245ae4f3b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Messaging/LogicalCallContext.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Remoting.Messaging.LogicalCallContext" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="HasInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FreeNamedDataSlot(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetData(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetData(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Proxies/RealProxy.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Proxies/RealProxy.xml
new file mode 100644
index 00000000000..bcccb181787
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting.Proxies/RealProxy.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Remoting.Proxies.RealProxy" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="GetTransparentProxy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Invoke(System.Runtime.Remoting.Messaging.IMessage)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="msg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/LeaseState.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/LeaseState.xml
new file mode 100644
index 00000000000..dc93d01b373
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/LeaseState.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Remoting.LeaseState" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/ObjRef.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/ObjRef.xml
new file mode 100644
index 00000000000..52385994d0d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/ObjRef.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Remoting.ObjRef" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ObjRef">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ObjRef(System.MarshalByRefObject, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mbr">TODO</param>
+ <param name="type">TODO</param>
+ </constructor>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="si">TODO</param>
+ <param name="sc">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetRealObject(System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="sc">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsFromThisAppDomain">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsFromThisProcess">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/ObjectHandle.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/ObjectHandle.xml
new file mode 100644
index 00000000000..2f1cc7ca2f5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/ObjectHandle.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Remoting.ObjectHandle" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ObjectHandle(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ </constructor>
+ <method name="GetRealObject(System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="InitializeLifetimeService">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Unwrap">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/RemotingServices.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/RemotingServices.xml
new file mode 100644
index 00000000000..b0a6eebb280
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/RemotingServices.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Remoting.RemotingServices" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="IsTransparentProxy(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="proxy">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ExecuteMessage(System.MarshalByRefObject, System.Runtime.Remoting.Messaging.IMethodCallMessage)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <param name="reqMsg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/SoapMethodOption.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/SoapMethodOption.xml
new file mode 100644
index 00000000000..9c979904565
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/SoapMethodOption.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Remoting.SoapMethodOption" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/SoapOption.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/SoapOption.xml
new file mode 100644
index 00000000000..58c26f41096
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/SoapOption.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Remoting.SoapOption" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/WellKnownObjectMode.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/WellKnownObjectMode.xml
new file mode 100644
index 00000000000..417743c6825
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Remoting/WellKnownObjectMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Remoting.WellKnownObjectMode" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters.Binary/BinaryArrayTypeEnum.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters.Binary/BinaryArrayTypeEnum.xml
new file mode 100644
index 00000000000..7df6dc6cc2a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters.Binary/BinaryArrayTypeEnum.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.Binary.BinaryArrayTypeEnum" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.xml
new file mode 100644
index 00000000000..052efa2666e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterAssemblyStyle.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.FormatterAssemblyStyle" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.xml
new file mode 100644
index 00000000000..31602ed7218
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterTopObjectStyle.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.FormatterTopObjectStyle" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterTypeStyle.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterTypeStyle.xml
new file mode 100644
index 00000000000..1553903e86b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/FormatterTypeStyle.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.FormatterTypeStyle" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/IFieldInfo.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/IFieldInfo.xml
new file mode 100644
index 00000000000..1aaee4042ef
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/IFieldInfo.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Serialization.Formatters.IFieldInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/ISoapMessage.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/ISoapMessage.xml
new file mode 100644
index 00000000000..246b434a4e8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/ISoapMessage.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Serialization.Formatters.ISoapMessage" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalArrayTypeE.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalArrayTypeE.xml
new file mode 100644
index 00000000000..22b95598d58
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalArrayTypeE.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.InternalArrayTypeE" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalElementTypeE.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalElementTypeE.xml
new file mode 100644
index 00000000000..4684f6d26c2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalElementTypeE.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.InternalElementTypeE" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalMemberTypeE.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalMemberTypeE.xml
new file mode 100644
index 00000000000..0789e88cfc4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalMemberTypeE.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.InternalMemberTypeE" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalMemberValueE.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalMemberValueE.xml
new file mode 100644
index 00000000000..fd498783d87
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalMemberValueE.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.InternalMemberValueE" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalNameSpaceE.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalNameSpaceE.xml
new file mode 100644
index 00000000000..bdb54cdef63
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalNameSpaceE.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.InternalNameSpaceE" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalObjectPositionE.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalObjectPositionE.xml
new file mode 100644
index 00000000000..54166dc2a90
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalObjectPositionE.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.InternalObjectPositionE" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalObjectTypeE.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalObjectTypeE.xml
new file mode 100644
index 00000000000..c49438620a1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalObjectTypeE.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.InternalObjectTypeE" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalParseStateE.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalParseStateE.xml
new file mode 100644
index 00000000000..472d9a7e0df
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalParseStateE.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.InternalParseStateE" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalParseTypeE.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalParseTypeE.xml
new file mode 100644
index 00000000000..1e4bc057823
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalParseTypeE.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.InternalParseTypeE" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.xml
new file mode 100644
index 00000000000..8ce02d3b4c1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalPrimitiveTypeE.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.InternalPrimitiveTypeE" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.xml
new file mode 100644
index 00000000000..77ff630b3bd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization.Formatters/InternalSerializerTypeE.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.Formatters.InternalSerializerTypeE" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IDeserializationCallback.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IDeserializationCallback.xml
new file mode 100644
index 00000000000..0b81efa9154
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IDeserializationCallback.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Serialization.IDeserializationCallback" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IFormatter.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IFormatter.xml
new file mode 100644
index 00000000000..21de0da6997
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IFormatter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Serialization.IFormatter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IFormatterConverter.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IFormatterConverter.xml
new file mode 100644
index 00000000000..8948ff8e7dc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IFormatterConverter.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Serialization.IFormatterConverter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IObjectReference.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IObjectReference.xml
new file mode 100644
index 00000000000..ee6170675bd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/IObjectReference.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Serialization.IObjectReference" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISerializable.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISerializable.xml
new file mode 100644
index 00000000000..ae2284955d5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISerializable.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Serialization.ISerializable" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISerializationSurrogate.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISerializationSurrogate.xml
new file mode 100644
index 00000000000..c2ddff92c37
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISerializationSurrogate.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Serialization.ISerializationSurrogate" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISurrogateSelector.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISurrogateSelector.xml
new file mode 100644
index 00000000000..fca838cece7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ISurrogateSelector.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Runtime.Serialization.ISurrogateSelector" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ObjectIDGenerator.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ObjectIDGenerator.xml
new file mode 100644
index 00000000000..27a5fc49ad4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/ObjectIDGenerator.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Serialization.ObjectIDGenerator" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ObjectIDGenerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="HasId(System.Object, System.Boolean&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="firstTime">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetId(System.Object, System.Boolean&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="firstTime">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationBinder.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationBinder.xml
new file mode 100644
index 00000000000..95053f10901
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationBinder.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Serialization.SerializationBinder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="BindToType(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyName">TODO</param>
+ <param name="typeName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationEntry.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationEntry.xml
new file mode 100644
index 00000000000..98d68bc8212
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationEntry.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Runtime.Serialization.SerializationEntry" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ObjectType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationException.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationException.xml
new file mode 100644
index 00000000000..db5561dca81
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Serialization.SerializationException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SerializationException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="SerializationException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="SerializationException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationInfo.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationInfo.xml
new file mode 100644
index 00000000000..952d009b17a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationInfo.xml
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Serialization.SerializationInfo" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SerializationInfo(System.Type, System.Runtime.Serialization.IFormatterConverter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="converter">TODO</param>
+ </constructor>
+ <property name="AssemblyName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FullTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MemberCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="AddValue(System.String, System.Object, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue(System.String, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetType(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddValue(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBoolean(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetByte(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetChar(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDateTime(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDecimal(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDouble(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInt16(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInt32(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInt64(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSByte(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetSingle(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetUInt16(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetUInt32(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetUInt64(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationInfoEnumerator.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationInfoEnumerator.xml
new file mode 100644
index 00000000000..4e8f179e92d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SerializationInfoEnumerator.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Serialization.SerializationInfoEnumerator" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Current">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ObjectType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Reset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveNext">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/StreamingContext.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/StreamingContext.xml
new file mode 100644
index 00000000000..ac32c8c8f61
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/StreamingContext.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Runtime.Serialization.StreamingContext" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StreamingContext(System.Runtime.Serialization.StreamingContextStates)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="state">TODO</param>
+ </constructor>
+ <constructor name="StreamingContext(System.Runtime.Serialization.StreamingContextStates, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="state">TODO</param>
+ <param name="additional">TODO</param>
+ </constructor>
+ <property name="Context">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="State">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/StreamingContextStates.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/StreamingContextStates.xml
new file mode 100644
index 00000000000..240c7b3f6ef
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/StreamingContextStates.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Runtime.Serialization.StreamingContextStates" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SurrogateSelector.xml b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SurrogateSelector.xml
new file mode 100644
index 00000000000..812a666b336
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Runtime.Serialization/SurrogateSelector.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Runtime.Serialization.SurrogateSelector" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SurrogateSelector">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="GetSurrogate(System.Type, System.Runtime.Serialization.StreamingContext, System.Runtime.Serialization.ISurrogateSelector&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="context">TODO</param>
+ <param name="selector">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNextSelector">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ChainSelector(System.Runtime.Serialization.ISurrogateSelector)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="selector">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveSurrogate(System.Type, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddSurrogate(System.Type, System.Runtime.Serialization.StreamingContext, System.Runtime.Serialization.ISerializationSurrogate)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="context">TODO</param>
+ <param name="surrogate">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography.X509Certificates/X509Certificate.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography.X509Certificates/X509Certificate.xml
new file mode 100644
index 00000000000..50f18faad5a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography.X509Certificates/X509Certificate.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.X509Certificates.X509Certificate" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricAlgorithm.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricAlgorithm.xml
new file mode 100644
index 00000000000..02d8efddc2a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricAlgorithm.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.AsymmetricAlgorithm" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="KeyExchangeAlgorithm">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="KeySize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LegalKeySizes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SignatureAlgorithm">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToXmlString(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="includePrivateParameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXmlString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xmlString">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ValidKeySize(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bitLength">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="algName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.xml
new file mode 100644
index 00000000000..2ab68118867
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricKeyExchangeDeformatter.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.AsymmetricKeyExchangeDeformatter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AsymmetricKeyExchangeDeformatter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Parameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SetKey(System.Security.Cryptography.AsymmetricAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DecryptKeyExchange(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgb">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.xml
new file mode 100644
index 00000000000..2a61e48e7eb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricKeyExchangeFormatter.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.AsymmetricKeyExchangeFormatter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AsymmetricKeyExchangeFormatter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Parameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SetKey(System.Security.Cryptography.AsymmetricAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateKeyExchange(System.Byte[], System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <param name="symAlgType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateKeyExchange(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricSignatureDeformatter.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricSignatureDeformatter.xml
new file mode 100644
index 00000000000..fda968216ff
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricSignatureDeformatter.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.AsymmetricSignatureDeformatter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AsymmetricSignatureDeformatter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="VerifySignature(System.Security.Cryptography.HashAlgorithm, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hash">TODO</param>
+ <param name="rgbSignature">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="VerifySignature(System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbHash">TODO</param>
+ <param name="rgbSignature">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetKey(System.Security.Cryptography.AsymmetricAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetHashAlgorithm(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricSignatureFormatter.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricSignatureFormatter.xml
new file mode 100644
index 00000000000..403ec7b7d0a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/AsymmetricSignatureFormatter.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.AsymmetricSignatureFormatter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AsymmetricSignatureFormatter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="CreateSignature(System.Security.Cryptography.HashAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hash">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateSignature(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbHash">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetKey(System.Security.Cryptography.AsymmetricAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetHashAlgorithm(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CipherMode.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CipherMode.xml
new file mode 100644
index 00000000000..a9eb966cd75
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CipherMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Cryptography.CipherMode" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoAPITransform.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoAPITransform.xml
new file mode 100644
index 00000000000..33ca36db19c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoAPITransform.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.CryptoAPITransform" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CryptoAPITransform">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="CanTransformMultipleBlocks">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InputBlockSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="KeyHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OutputBlockSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="TransformFinalBlock(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inputBuffer">TODO</param>
+ <param name="inputOffset">TODO</param>
+ <param name="inputCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TransformBlock(System.Byte[], System.Int32, System.Int32, System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inputBuffer">TODO</param>
+ <param name="inputOffset">TODO</param>
+ <param name="inputCount">TODO</param>
+ <param name="outputBuffer">TODO</param>
+ <param name="outputOffset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoStream.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoStream.xml
new file mode 100644
index 00000000000..da818e23e7c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoStream.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.CryptoStream" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CryptoStream(System.IO.Stream, System.Security.Cryptography.ICryptoTransform, System.Security.Cryptography.CryptoStreamMode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <param name="transform">TODO</param>
+ <param name="mode">TODO</param>
+ </constructor>
+ <property name="CanRead">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanSeek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanWrite">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Position">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Write(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetLength(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Seek(System.Int64, System.IO.SeekOrigin)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <param name="origin">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="FlushFinalBlock">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoStreamMode.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoStreamMode.xml
new file mode 100644
index 00000000000..9d69ee5360a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptoStreamMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Cryptography.CryptoStreamMode" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptographicException.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptographicException.xml
new file mode 100644
index 00000000000..661f9b52c76
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptographicException.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.CryptographicException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CryptographicException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CryptographicException(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hr">TODO</param>
+ </constructor>
+ <constructor name="CryptographicException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="CryptographicException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <constructor name="CryptographicException(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="insert">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptographicUnexpectedOperationException.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptographicUnexpectedOperationException.xml
new file mode 100644
index 00000000000..bb7606e72d1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CryptographicUnexpectedOperationException.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.CryptographicUnexpectedOperationException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CryptographicUnexpectedOperationException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CryptographicUnexpectedOperationException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="CryptographicUnexpectedOperationException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <constructor name="CryptographicUnexpectedOperationException(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="insert">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CspParameters.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CspParameters.xml
new file mode 100644
index 00000000000..c977f370d51
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CspParameters.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.CspParameters" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CspParameters">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CspParameters(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dwTypeIn">TODO</param>
+ </constructor>
+ <constructor name="CspParameters(System.Int32, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dwTypeIn">TODO</param>
+ <param name="strProviderNameIn">TODO</param>
+ </constructor>
+ <constructor name="CspParameters(System.Int32, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dwTypeIn">TODO</param>
+ <param name="strProviderNameIn">TODO</param>
+ <param name="strContainerNameIn">TODO</param>
+ </constructor>
+ <field name="KeyContainerName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="KeyNumber">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="ProviderName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="ProviderType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Flags">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CspProviderFlags.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CspProviderFlags.xml
new file mode 100644
index 00000000000..802305f7cd7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/CspProviderFlags.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Cryptography.CspProviderFlags" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DES.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DES.xml
new file mode 100644
index 00000000000..3d3ef8f5476
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DES.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.DES" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DES">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Key">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsWeakKey(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbKey">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSemiWeakKey(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbKey">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DESCryptoServiceProvider.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DESCryptoServiceProvider.xml
new file mode 100644
index 00000000000..ca18e1f8352
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DESCryptoServiceProvider.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.DESCryptoServiceProvider" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DESCryptoServiceProvider">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Key">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IV">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreateDecryptor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateEncryptor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSA.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSA.xml
new file mode 100644
index 00000000000..2b2f2061e85
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSA.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.DSA" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="VerifySignature(System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbHash">TODO</param>
+ <param name="rgbSignature">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ImportParameters(System.Security.Cryptography.DSAParameters)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ExportParameters(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="includePrivateParameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateSignature(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbHash">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXmlString(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="includePrivateParameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXmlString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xmlString">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="algName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSACryptoServiceProvider.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSACryptoServiceProvider.xml
new file mode 100644
index 00000000000..fd791164701
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSACryptoServiceProvider.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.DSACryptoServiceProvider" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DSACryptoServiceProvider">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="DSACryptoServiceProvider(System.Security.Cryptography.CspParameters)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parameters">TODO</param>
+ </constructor>
+ <constructor name="DSACryptoServiceProvider(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key_size">TODO</param>
+ </constructor>
+ <constructor name="DSACryptoServiceProvider(System.Int32, System.Security.Cryptography.CspParameters)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key_size">TODO</param>
+ <param name="parameters">TODO</param>
+ </constructor>
+ <property name="KeyExchangeAlgorithm">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="KeySize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LegalKeySizes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SignatureAlgorithm">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PersistKeyInCsp">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="VerifySignature(System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hash">TODO</param>
+ <param name="sig">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ImportParameters(System.Security.Cryptography.DSAParameters)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ExportParameters(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="include">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateSignature(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgb">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXmlString(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="includePrivateParameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXmlString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xmlString">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SignData(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SignData(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SignData(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SignHash(System.Byte[], System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hash">TODO</param>
+ <param name="str">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="VerifyData(System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <param name="sig">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSAParameters.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSAParameters.xml
new file mode 100644
index 00000000000..5afed41ddaf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSAParameters.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Security.Cryptography.DSAParameters" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Counter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="G">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="J">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="P">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Q">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Seed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="X">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Y">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSASignatureDeformatter.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSASignatureDeformatter.xml
new file mode 100644
index 00000000000..dee4d1f2426
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSASignatureDeformatter.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.DSASignatureDeformatter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DSASignatureDeformatter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="DSASignatureDeformatter(System.Security.Cryptography.AsymmetricAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ </constructor>
+ <method name="VerifySignature(System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbHash">TODO</param>
+ <param name="rgbSignature">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetKey(System.Security.Cryptography.AsymmetricAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetHashAlgorithm(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSASignatureFormatter.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSASignatureFormatter.xml
new file mode 100644
index 00000000000..a806aee80fa
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DSASignatureFormatter.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.DSASignatureFormatter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DSASignatureFormatter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="DSASignatureFormatter(System.Security.Cryptography.AsymmetricAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ </constructor>
+ <method name="CreateSignature(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbHash">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetKey(System.Security.Cryptography.AsymmetricAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetHashAlgorithm(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DeriveBytes.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DeriveBytes.xml
new file mode 100644
index 00000000000..932f27ab9ea
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/DeriveBytes.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.DeriveBytes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="Reset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cb">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/FromBase64Transform.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/FromBase64Transform.xml
new file mode 100644
index 00000000000..6decaea7d0e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/FromBase64Transform.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.FromBase64Transform" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FromBase64Transform">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="FromBase64Transform(System.Security.Cryptography.FromBase64TransformMode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="mode">TODO</param>
+ </constructor>
+ <property name="CanTransformMultipleBlocks">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InputBlockSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OutputBlockSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="TransformFinalBlock(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inputBuffer">TODO</param>
+ <param name="inputOffset">TODO</param>
+ <param name="inputCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TransformBlock(System.Byte[], System.Int32, System.Int32, System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inputBuffer">TODO</param>
+ <param name="inputOffset">TODO</param>
+ <param name="inputCount">TODO</param>
+ <param name="outputBuffer">TODO</param>
+ <param name="outputOffset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/FromBase64TransformMode.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/FromBase64TransformMode.xml
new file mode 100644
index 00000000000..b0aa37a6b17
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/FromBase64TransformMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Cryptography.FromBase64TransformMode" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/HashAlgorithm.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/HashAlgorithm.xml
new file mode 100644
index 00000000000..cc5bfe55873
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/HashAlgorithm.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.HashAlgorithm" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="CanTransformMultipleBlocks">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Hash">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HashSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InputBlockSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OutputBlockSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="TransformFinalBlock(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inputBuffer">TODO</param>
+ <param name="inputOffset">TODO</param>
+ <param name="inputCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TransformBlock(System.Byte[], System.Int32, System.Int32, System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inputBuffer">TODO</param>
+ <param name="inputOffset">TODO</param>
+ <param name="inputCount">TODO</param>
+ <param name="outputBuffer">TODO</param>
+ <param name="outputOffset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Initialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ComputeHash(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="st">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/ICryptoTransform.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/ICryptoTransform.xml
new file mode 100644
index 00000000000..046b56497e3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/ICryptoTransform.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Security.Cryptography.ICryptoTransform" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/KeySizes.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/KeySizes.xml
new file mode 100644
index 00000000000..b5c77c35abf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/KeySizes.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.KeySizes" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="KeySizes(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="minSize">TODO</param>
+ <param name="maxSize">TODO</param>
+ <param name="skipSize">TODO</param>
+ </constructor>
+ <property name="MaxSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MinSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SkipSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/MD5.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/MD5.xml
new file mode 100644
index 00000000000..708d9408b53
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/MD5.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.MD5" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="st">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/MD5CryptoServiceProvider.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/MD5CryptoServiceProvider.xml
new file mode 100644
index 00000000000..3e0f44a78d2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/MD5CryptoServiceProvider.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.MD5CryptoServiceProvider" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MD5CryptoServiceProvider">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Initialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/PaddingMode.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/PaddingMode.xml
new file mode 100644
index 00000000000..4c5839eaa59
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/PaddingMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Cryptography.PaddingMode" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RNGCryptoServiceProvider.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RNGCryptoServiceProvider.xml
new file mode 100644
index 00000000000..7443ba71c7f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RNGCryptoServiceProvider.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.RNGCryptoServiceProvider" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RNGCryptoServiceProvider">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="RNGCryptoServiceProvider(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgb">TODO</param>
+ </constructor>
+ <constructor name="RNGCryptoServiceProvider(System.Security.Cryptography.CspParameters)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cspParams">TODO</param>
+ </constructor>
+ <constructor name="RNGCryptoServiceProvider(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ </constructor>
+ <method name="GetNonZeroBytes(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RSA.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RSA.xml
new file mode 100644
index 00000000000..5df368682a0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RSA.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.RSA" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RSA">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="ImportParameters(System.Security.Cryptography.RSAParameters)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ExportParameters(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="include">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DecryptValue(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgb">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EncryptValue(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgb">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXmlString(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="include">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXmlString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xml">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="alg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RSAParameters.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RSAParameters.xml
new file mode 100644
index 00000000000..da9cfec6e24
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RSAParameters.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Security.Cryptography.RSAParameters" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="P">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Q">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="D">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="DP">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="DQ">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="InverseQ">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Modulus">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Exponent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RandomNumberGenerator.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RandomNumberGenerator.xml
new file mode 100644
index 00000000000..a7ad8a52873
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RandomNumberGenerator.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.RandomNumberGenerator" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RandomNumberGenerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="GetNonZeroBytes(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rngName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/Rijndael.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/Rijndael.xml
new file mode 100644
index 00000000000..db27d4af897
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/Rijndael.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.Rijndael" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Rijndael">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="alg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RijndaelManaged.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RijndaelManaged.xml
new file mode 100644
index 00000000000..62ea1fb6f71
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/RijndaelManaged.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.RijndaelManaged" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RijndaelManaged">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="GenerateKey">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GenerateIV">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateEncryptor(System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbKey">TODO</param>
+ <param name="rgbIV">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateDecryptor(System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbKey">TODO</param>
+ <param name="rgbIV">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA1.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA1.xml
new file mode 100644
index 00000000000..4d7ff76537b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA1.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.SHA1" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="st">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA1CryptoServiceProvider.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA1CryptoServiceProvider.xml
new file mode 100644
index 00000000000..30b1ff908f9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA1CryptoServiceProvider.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.SHA1CryptoServiceProvider" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SHA1CryptoServiceProvider">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Initialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA256.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA256.xml
new file mode 100644
index 00000000000..211c74b9967
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA256.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.SHA256" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SHA256">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="st">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA256Managed.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA256Managed.xml
new file mode 100644
index 00000000000..90d7ac1fe77
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA256Managed.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.SHA256Managed" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SHA256Managed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Initialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ProcessBlock(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inputBuffer">TODO</param>
+ <param name="inputOffset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ProcessFinalBlock(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inputBuffer">TODO</param>
+ <param name="inputOffset">TODO</param>
+ <param name="inputCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA384.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA384.xml
new file mode 100644
index 00000000000..35d336b2215
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA384.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.SHA384" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SHA384">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="st">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA384Managed.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA384Managed.xml
new file mode 100644
index 00000000000..310fb4d59c8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA384Managed.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.SHA384Managed" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SHA384Managed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Initialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA512.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA512.xml
new file mode 100644
index 00000000000..d230aee7d3b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA512.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.SHA512" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SHA512">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="st">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA512Managed.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA512Managed.xml
new file mode 100644
index 00000000000..96fe63a6806
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SHA512Managed.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.SHA512Managed" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SHA512Managed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Initialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SignatureDescription.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SignatureDescription.xml
new file mode 100644
index 00000000000..35fa2d7cf46
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SignatureDescription.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.SignatureDescription" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SignatureDescription(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="el">TODO</param>
+ </constructor>
+ <property name="DeformatterAlgorithm">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DigestAlgorithm">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FormatterAlgorithm">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="KeyAlgorithm">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreateFormatter(System.Security.Cryptography.AsymmetricAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateDigest">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateDeformatter(System.Security.Cryptography.AsymmetricAlgorithm)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SymmetricAlgorithm.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SymmetricAlgorithm.xml
new file mode 100644
index 00000000000..dc790e00af6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/SymmetricAlgorithm.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.SymmetricAlgorithm" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SymmetricAlgorithm">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BlockSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FeedbackSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IV">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Key">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="KeySize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LegalBlockSizes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LegalKeySizes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Mode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Padding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GenerateKey">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GenerateIV">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateEncryptor(System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbKey">TODO</param>
+ <param name="rgbIV">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateEncryptor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateDecryptor(System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rgbKey">TODO</param>
+ <param name="rgbIV">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateDecryptor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ValidKeySize(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bitLength">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Create(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="algName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Cryptography/ToBase64Transform.xml b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/ToBase64Transform.xml
new file mode 100644
index 00000000000..5c721a06fe2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Cryptography/ToBase64Transform.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Cryptography.ToBase64Transform" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ToBase64Transform">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="CanTransformMultipleBlocks">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InputBlockSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OutputBlockSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="TransformFinalBlock(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inputBuffer">TODO</param>
+ <param name="inputOffset">TODO</param>
+ <param name="inputCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TransformBlock(System.Byte[], System.Int32, System.Int32, System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inputBuffer">TODO</param>
+ <param name="inputOffset">TODO</param>
+ <param name="inputCount">TODO</param>
+ <param name="outputBuffer">TODO</param>
+ <param name="outputOffset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/CodeAccessSecurityAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/CodeAccessSecurityAttribute.xml
new file mode 100644
index 00000000000..6b3049f54f3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/CodeAccessSecurityAttribute.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.CodeAccessSecurityAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeAccessSecurityAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/EnvironmentPermissionAccess.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/EnvironmentPermissionAccess.xml
new file mode 100644
index 00000000000..605683160b7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/EnvironmentPermissionAccess.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Permissions.EnvironmentPermissionAccess" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/EnvironmentPermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/EnvironmentPermissionAttribute.xml
new file mode 100644
index 00000000000..ef59656253d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/EnvironmentPermissionAttribute.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.EnvironmentPermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="EnvironmentPermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="All">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Read">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Write">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileDialogPermissionAccess.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileDialogPermissionAccess.xml
new file mode 100644
index 00000000000..29bc1ec1860
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileDialogPermissionAccess.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Permissions.FileDialogPermissionAccess" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileDialogPermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileDialogPermissionAttribute.xml
new file mode 100644
index 00000000000..a8922ff6386
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileDialogPermissionAttribute.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.FileDialogPermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FileDialogPermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="Open">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Save">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermission.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermission.xml
new file mode 100644
index 00000000000..fec369d2a80
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermission.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.FileIOPermission" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FileIOPermission(System.Security.Permissions.PermissionState)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="state">TODO</param>
+ </constructor>
+ <constructor name="FileIOPermission(System.Security.Permissions.FileIOPermissionAccess, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="access">TODO</param>
+ <param name="path">TODO</param>
+ </constructor>
+ <constructor name="FileIOPermission(System.Security.Permissions.FileIOPermissionAccess, System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="access">TODO</param>
+ <param name="pathList">TODO</param>
+ </constructor>
+ <property name="AllFiles">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AllLocalFiles">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="IsUnrestricted">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="esd">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Union(System.Security.IPermission)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="other">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSubsetOf(System.Security.IPermission)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Intersect(System.Security.IPermission)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddPathList(System.Security.Permissions.FileIOPermissionAccess, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="access">TODO</param>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddPathList(System.Security.Permissions.FileIOPermissionAccess, System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="access">TODO</param>
+ <param name="pathList">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetPathList(System.Security.Permissions.FileIOPermissionAccess)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="access">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetPathList(System.Security.Permissions.FileIOPermissionAccess, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="access">TODO</param>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetPathList(System.Security.Permissions.FileIOPermissionAccess, System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="access">TODO</param>
+ <param name="pathList">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermissionAccess.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermissionAccess.xml
new file mode 100644
index 00000000000..de2a6e11e7c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermissionAccess.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Permissions.FileIOPermissionAccess" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermissionAttribute.xml
new file mode 100644
index 00000000000..7606b85ed43
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/FileIOPermissionAttribute.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.FileIOPermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FileIOPermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="All">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Append">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PathDiscovery">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Read">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Write">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/IUnrestrictedPermission.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/IUnrestrictedPermission.xml
new file mode 100644
index 00000000000..4e08349777e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/IUnrestrictedPermission.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Security.Permissions.IUnrestrictedPermission" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStorageContainment.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStorageContainment.xml
new file mode 100644
index 00000000000..0c852cd883b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStorageContainment.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Permissions.IsolatedStorageContainment" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.xml
new file mode 100644
index 00000000000..acc229238c5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStorageFilePermissionAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.IsolatedStorageFilePermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IsolatedStorageFilePermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStoragePermission.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStoragePermission.xml
new file mode 100644
index 00000000000..5bfd52b0b6b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStoragePermission.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.IsolatedStoragePermission" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IsolatedStoragePermission(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="UsageAllowed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UserQuota">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStoragePermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStoragePermissionAttribute.xml
new file mode 100644
index 00000000000..f991426a3f4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/IsolatedStoragePermissionAttribute.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.IsolatedStoragePermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IsolatedStoragePermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="UsageAllowed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UserQuota">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/PermissionSetAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/PermissionSetAttribute.xml
new file mode 100644
index 00000000000..f7385e96d8c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/PermissionSetAttribute.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.PermissionSetAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="PermissionSetAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="File">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UnicodeEncoded">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XML">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreatePermissionSet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/PermissionState.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/PermissionState.xml
new file mode 100644
index 00000000000..ffbdfaa99e3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/PermissionState.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Permissions.PermissionState" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/PrinciplePermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/PrinciplePermissionAttribute.xml
new file mode 100644
index 00000000000..d9c2686c516
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/PrinciplePermissionAttribute.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.PrinciplePermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="PrinciplePermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="Authenticated">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Role">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/ReflectionPermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/ReflectionPermissionAttribute.xml
new file mode 100644
index 00000000000..1855bcb8f92
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/ReflectionPermissionAttribute.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.ReflectionPermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ReflectionPermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="Flags">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MemberAccess">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReflectionEmit">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TypeInformation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/ReflectionPermissionFlag.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/ReflectionPermissionFlag.xml
new file mode 100644
index 00000000000..7412d5c74d3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/ReflectionPermissionFlag.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Permissions.ReflectionPermissionFlag" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/RegistryPermissionAccess.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/RegistryPermissionAccess.xml
new file mode 100644
index 00000000000..3d621d82ec0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/RegistryPermissionAccess.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Permissions.RegistryPermissionAccess" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/RegistryPermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/RegistryPermissionAttribute.xml
new file mode 100644
index 00000000000..f094e17692e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/RegistryPermissionAttribute.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.RegistryPermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RegistryPermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="All">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Create">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Read">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Write">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityAction.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityAction.xml
new file mode 100644
index 00000000000..b36fcc87cc4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityAction.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Permissions.SecurityAction" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityAttribute.xml
new file mode 100644
index 00000000000..701eb0bae33
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityAttribute.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.SecurityAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SecurityAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="Unrestricted">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Action">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityPermission.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityPermission.xml
new file mode 100644
index 00000000000..b14f2391e2e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityPermission.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.SecurityPermission" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SecurityPermission(System.Security.Permissions.PermissionState)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="state">TODO</param>
+ </constructor>
+ <constructor name="SecurityPermission(System.Security.Permissions.SecurityPermissionFlag)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="flags">TODO</param>
+ </constructor>
+ <property name="Flags">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="IsUnrestricted">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Union(System.Security.IPermission)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSubsetOf(System.Security.IPermission)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Intersect(System.Security.IPermission)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityPermissionFlag.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityPermissionFlag.xml
new file mode 100644
index 00000000000..05948d77703
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/SecurityPermissionFlag.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Permissions.SecurityPermissionFlag" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/SiteIdentityPermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/SiteIdentityPermissionAttribute.xml
new file mode 100644
index 00000000000..97246589911
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/SiteIdentityPermissionAttribute.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.SiteIdentityPermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SiteIdentityPermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="Site">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/StrongNameIdentityPermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/StrongNameIdentityPermissionAttribute.xml
new file mode 100644
index 00000000000..133b1917b04
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/StrongNameIdentityPermissionAttribute.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.StrongNameIdentityPermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StrongNameIdentityPermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PublicKey">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Version">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionAttribute.xml
new file mode 100644
index 00000000000..0ef02ed6eeb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionAttribute.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.UIPermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UIPermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="Clipboard">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Window">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionClipboard.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionClipboard.xml
new file mode 100644
index 00000000000..a6390ca1a51
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionClipboard.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Permissions.UIPermissionClipboard" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionWindow.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionWindow.xml
new file mode 100644
index 00000000000..9376807dcda
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/UIPermissionWindow.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Permissions.UIPermissionWindow" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/UrlIdentityPermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/UrlIdentityPermissionAttribute.xml
new file mode 100644
index 00000000000..0a80842b254
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/UrlIdentityPermissionAttribute.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.UrlIdentityPermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UrlIdentityPermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="Url">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Permissions/ZoneIdentityPermissionAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Permissions/ZoneIdentityPermissionAttribute.xml
new file mode 100644
index 00000000000..2ae65a7e9d0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Permissions/ZoneIdentityPermissionAttribute.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Permissions.ZoneIdentityPermissionAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ZoneIdentityPermissionAttribute(System.Security.Permissions.SecurityAction)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="action">TODO</param>
+ </constructor>
+ <property name="Zone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreatePermission">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Policy/AllMembershipCondition.xml b/mcs/docs/apidocs/xml/en/System.Security.Policy/AllMembershipCondition.xml
new file mode 100644
index 00000000000..465173c55db
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Policy/AllMembershipCondition.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Policy.AllMembershipCondition" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AllMembershipCondition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="ToXml(System.Security.Policy.PolicyLevel)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement, System.Security.Policy.PolicyLevel)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <param name="level">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Check(System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="evidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Policy/ApplicationDirectoryMembershipCondition.xml b/mcs/docs/apidocs/xml/en/System.Security.Policy/ApplicationDirectoryMembershipCondition.xml
new file mode 100644
index 00000000000..d034a869755
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Policy/ApplicationDirectoryMembershipCondition.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Policy.ApplicationDirectoryMembershipCondition" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ApplicationDirectoryMembershipCondition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="ToXml(System.Security.Policy.PolicyLevel)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement, System.Security.Policy.PolicyLevel)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <param name="level">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Check(System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="evidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Policy/CodeGroup.xml b/mcs/docs/apidocs/xml/en/System.Security.Policy/CodeGroup.xml
new file mode 100644
index 00000000000..dc8ba9558c5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Policy/CodeGroup.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Policy.CodeGroup" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CodeGroup(System.Security.Policy.IMembershipCondition, System.Security.Policy.PolicyStatement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="membershipCondition">TODO</param>
+ <param name="policy">TODO</param>
+ </constructor>
+ <property name="MergeLogic">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PolicyStatement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Description">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MembershipCondition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Children">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AttributeString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PermissionSetName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ResolveMatchingCodeGroups(System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="evidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Resolve(System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="evidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddChild(System.Security.Policy.CodeGroup)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="group">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Security.Policy.CodeGroup, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cg">TODO</param>
+ <param name="compareChildren">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveChild(System.Security.Policy.CodeGroup)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="group">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement, System.Security.Policy.PolicyLevel)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <param name="level">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXml(System.Security.Policy.PolicyLevel)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Policy/Evidence.xml b/mcs/docs/apidocs/xml/en/System.Security.Policy/Evidence.xml
new file mode 100644
index 00000000000..c0e73d71f4a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Policy/Evidence.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Policy.Evidence" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Evidence">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="GetHostEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Policy/FileCodeGroup.xml b/mcs/docs/apidocs/xml/en/System.Security.Policy/FileCodeGroup.xml
new file mode 100644
index 00000000000..bbd9f14146a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Policy/FileCodeGroup.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Policy.FileCodeGroup" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FileCodeGroup(System.Security.Policy.IMembershipCondition, System.Security.Permissions.FileIOPermissionAccess)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="membershipCondition">TODO</param>
+ <param name="access">TODO</param>
+ </constructor>
+ <property name="MergeLogic">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AttributeString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PermissionSetName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ResolveMatchingCodeGroups(System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="evidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Resolve(System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="evidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Policy/IIdentityPermissionFactory.xml b/mcs/docs/apidocs/xml/en/System.Security.Policy/IIdentityPermissionFactory.xml
new file mode 100644
index 00000000000..1aef2080d7d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Policy/IIdentityPermissionFactory.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Security.Policy.IIdentityPermissionFactory" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Policy/IMembershipCondition.xml b/mcs/docs/apidocs/xml/en/System.Security.Policy/IMembershipCondition.xml
new file mode 100644
index 00000000000..bd39f0e165a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Policy/IMembershipCondition.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Security.Policy.IMembershipCondition" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyException.xml b/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyException.xml
new file mode 100644
index 00000000000..cd225c24822
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Policy.PolicyException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="PolicyException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="PolicyException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="PolicyException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyLevel.xml b/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyLevel.xml
new file mode 100644
index 00000000000..6a649b8489f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyLevel.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Policy.PolicyLevel" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="FullTrustAssemblies">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Label">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NamedPermissionSets">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RootCodeGroup">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="StoreLocation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyStatement.xml b/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyStatement.xml
new file mode 100644
index 00000000000..21e95083418
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyStatement.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Policy.PolicyStatement" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="PolicyStatement(System.Security.PermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="perms">TODO</param>
+ </constructor>
+ <constructor name="PolicyStatement(System.Security.PermissionSet, System.Security.Policy.PolicyStatementAttribute)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="perms">TODO</param>
+ <param name="attrs">TODO</param>
+ </constructor>
+ <property name="PermissionSet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AttributeString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToXml(System.Security.Policy.PolicyLevel)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement, System.Security.Policy.PolicyLevel)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <param name="level">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyStatementAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyStatementAttribute.xml
new file mode 100644
index 00000000000..0c11d7ff951
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Policy/PolicyStatementAttribute.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Policy.PolicyStatementAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Principal/GenericIdentity.xml b/mcs/docs/apidocs/xml/en/System.Security.Principal/GenericIdentity.xml
new file mode 100644
index 00000000000..c5a547fe4f1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Principal/GenericIdentity.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Principal.GenericIdentity" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="GenericIdentity(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="user_name">TODO</param>
+ <param name="authentication_type">TODO</param>
+ </constructor>
+ <constructor name="GenericIdentity(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <property name="AuthenticationType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsAuthenticated">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Principal/GenericPrincipal.xml b/mcs/docs/apidocs/xml/en/System.Security.Principal/GenericPrincipal.xml
new file mode 100644
index 00000000000..9525f160e83
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Principal/GenericPrincipal.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.Principal.GenericPrincipal" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="GenericPrincipal(System.Security.Principal.IIdentity, System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="identity">TODO</param>
+ <param name="roles">TODO</param>
+ </constructor>
+ <property name="Identity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="IsInRole(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="role">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Principal/IIdentity.xml b/mcs/docs/apidocs/xml/en/System.Security.Principal/IIdentity.xml
new file mode 100644
index 00000000000..145d84fc399
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Principal/IIdentity.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Security.Principal.IIdentity" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Principal/IPrincipal.xml b/mcs/docs/apidocs/xml/en/System.Security.Principal/IPrincipal.xml
new file mode 100644
index 00000000000..f200a22c91c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Principal/IPrincipal.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Security.Principal.IPrincipal" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security.Principal/PrincipalPolicy.xml b/mcs/docs/apidocs/xml/en/System.Security.Principal/PrincipalPolicy.xml
new file mode 100644
index 00000000000..add9d8e8fdb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security.Principal/PrincipalPolicy.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.Principal.PrincipalPolicy" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/CodeAccessPermission.xml b/mcs/docs/apidocs/xml/en/System.Security/CodeAccessPermission.xml
new file mode 100644
index 00000000000..78cae7a757b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/CodeAccessPermission.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.CodeAccessPermission" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="PermitOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Deny">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Assert">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="elem">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Union(System.Security.IPermission)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="other">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSubsetOf(System.Security.IPermission)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Intersect(System.Security.IPermission)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Demand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/IEvidenceFactory.xml b/mcs/docs/apidocs/xml/en/System.Security/IEvidenceFactory.xml
new file mode 100644
index 00000000000..dcd67a37c75
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/IEvidenceFactory.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Security.IEvidenceFactory" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/IPermission.xml b/mcs/docs/apidocs/xml/en/System.Security/IPermission.xml
new file mode 100644
index 00000000000..1c46e999ed2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/IPermission.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Security.IPermission" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/ISecurityEncodable.xml b/mcs/docs/apidocs/xml/en/System.Security/ISecurityEncodable.xml
new file mode 100644
index 00000000000..fe467a5962c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/ISecurityEncodable.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Security.ISecurityEncodable" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/ISecurityPolicyEncodable.xml b/mcs/docs/apidocs/xml/en/System.Security/ISecurityPolicyEncodable.xml
new file mode 100644
index 00000000000..40e3a06f3ba
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/ISecurityPolicyEncodable.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Security.ISecurityPolicyEncodable" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/IStackWalk.xml b/mcs/docs/apidocs/xml/en/System.Security/IStackWalk.xml
new file mode 100644
index 00000000000..82361fdefe2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/IStackWalk.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Security.IStackWalk" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/NamedPermissionSet.xml b/mcs/docs/apidocs/xml/en/System.Security/NamedPermissionSet.xml
new file mode 100644
index 00000000000..1146445d9d9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/NamedPermissionSet.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.NamedPermissionSet" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NamedPermissionSet(System.String, System.Security.PermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="set">TODO</param>
+ </constructor>
+ <constructor name="NamedPermissionSet(System.String, System.Security.Permissions.PermissionState)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="state">TODO</param>
+ </constructor>
+ <constructor name="NamedPermissionSet(System.Security.NamedPermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="set">TODO</param>
+ </constructor>
+ <constructor name="NamedPermissionSet(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <property name="Description">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/PermissionSet.xml b/mcs/docs/apidocs/xml/en/System.Security/PermissionSet.xml
new file mode 100644
index 00000000000..705da9c6274
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/PermissionSet.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.PermissionSet" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="PermissionSet(System.Security.Permissions.PermissionState)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="state">TODO</param>
+ </constructor>
+ <constructor name="PermissionSet(System.Security.PermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="permSet">TODO</param>
+ </constructor>
+ <method name="PermitOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Deny">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Demand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Assert">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromXml(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="et">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Union(System.Security.PermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="other">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSubsetOf(System.Security.PermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddPermission(System.Security.IPermission)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="perm">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/PolicyLevelType.xml b/mcs/docs/apidocs/xml/en/System.Security/PolicyLevelType.xml
new file mode 100644
index 00000000000..41c92d3e854
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/PolicyLevelType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.PolicyLevelType" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/SecurityElement.xml b/mcs/docs/apidocs/xml/en/System.Security/SecurityElement.xml
new file mode 100644
index 00000000000..0ccd638126c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/SecurityElement.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.SecurityElement" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SecurityElement(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="tag">TODO</param>
+ <param name="text">TODO</param>
+ </constructor>
+ <constructor name="SecurityElement(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="tag">TODO</param>
+ </constructor>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Children">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Tag">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="AddAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddChild(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="child">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Attribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equal(System.Security.SecurityElement)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="other">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Escape(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsInvalidAttributeName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsInvalidAttributeValue(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsInvalidTag(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsInvalidText(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/SecurityException.xml b/mcs/docs/apidocs/xml/en/System.Security/SecurityException.xml
new file mode 100644
index 00000000000..2bbfbb3dda5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/SecurityException.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.SecurityException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SecurityException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="SecurityException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="SecurityException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <constructor name="SecurityException(System.String, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="type">TODO</param>
+ </constructor>
+ <constructor name="SecurityException(System.String, System.Type, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="type">TODO</param>
+ <param name="state">TODO</param>
+ </constructor>
+ <property name="PermissionState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PermissionType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/SecurityManager.xml b/mcs/docs/apidocs/xml/en/System.Security/SecurityManager.xml
new file mode 100644
index 00000000000..bcb2f2ca8b1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/SecurityManager.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.SecurityManager" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="CheckExecutionRights">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SecurityEnabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="IsGranted(System.Security.IPermission)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="perm">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LoadPolicyLevelFromFile(System.String, System.Security.PolicyLevelType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LoadPolicyLevelFromString(System.String, System.Security.PolicyLevelType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="PolicyHierarchy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ResolvePolicy(System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="evidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ResolvePolicy(System.Security.Policy.Evidence, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="evidence">TODO</param>
+ <param name="reqdPset">TODO</param>
+ <param name="optPset">TODO</param>
+ <param name="denyPset">TODO</param>
+ <param name="denied">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ResolvePolicyGroups(System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="evidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SavePolicy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="SavePolicyLevel(System.Security.Policy.PolicyLevel)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="level">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/SecurityZone.xml b/mcs/docs/apidocs/xml/en/System.Security/SecurityZone.xml
new file mode 100644
index 00000000000..435d97ae587
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/SecurityZone.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Security.SecurityZone" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/SuppressUnmanagedCodeSecurityAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security/SuppressUnmanagedCodeSecurityAttribute.xml
new file mode 100644
index 00000000000..7d2e9c2a941
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/SuppressUnmanagedCodeSecurityAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.SuppressUnmanagedCodeSecurityAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SuppressUnmanagedCodeSecurityAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/UnverifiableCodeAttribute.xml b/mcs/docs/apidocs/xml/en/System.Security/UnverifiableCodeAttribute.xml
new file mode 100644
index 00000000000..56af407c5a8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/UnverifiableCodeAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.UnverifiableCodeAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UnverifiableCodeAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/VerificationException.xml b/mcs/docs/apidocs/xml/en/System.Security/VerificationException.xml
new file mode 100644
index 00000000000..a61342f9cbc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/VerificationException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.VerificationException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="VerificationException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="VerificationException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="VerificationException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Security/XmlSyntaxException.xml b/mcs/docs/apidocs/xml/en/System.Security/XmlSyntaxException.xml
new file mode 100644
index 00000000000..234292d528e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Security/XmlSyntaxException.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Security.XmlSyntaxException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSyntaxException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="XmlSyntaxException(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="lineNumber">TODO</param>
+ </constructor>
+ <constructor name="XmlSyntaxException(System.Int32, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="lineNumber">TODO</param>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="XmlSyntaxException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="XmlSyntaxException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Capture.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Capture.xml
new file mode 100644
index 00000000000..ff181a92125
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Capture.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.RegularExpressions.Capture" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Index">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Previous">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Checkpoint">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsDefined">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/CaptureCollection.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/CaptureCollection.xml
new file mode 100644
index 00000000000..e9c6c5edb01
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/CaptureCollection.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.RegularExpressions.CaptureCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/CostDelegate.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/CostDelegate.xml
new file mode 100644
index 00000000000..1a0d2903071
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/CostDelegate.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Text.RegularExpressions.IntervalCollection+CostDelegate" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Group.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Group.xml
new file mode 100644
index 00000000000..b64687bda40
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Group.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.RegularExpressions.Group" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Captures">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Success">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Synchronized(System.Text.RegularExpressions.Group)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inner">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/GroupCollection.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/GroupCollection.xml
new file mode 100644
index 00000000000..291deabd7dd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/GroupCollection.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.RegularExpressions.GroupCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Match.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Match.xml
new file mode 100644
index 00000000000..23c8b82f033
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Match.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.RegularExpressions.Match" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Groups">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Regex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Result(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="replacement">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Synchronized(System.Text.RegularExpressions.Match)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inner">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="NextMatch">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/MatchCollection.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/MatchCollection.xml
new file mode 100644
index 00000000000..3aa2bbd8b97
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/MatchCollection.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.RegularExpressions.MatchCollection" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/MatchEvaluator.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/MatchEvaluator.xml
new file mode 100644
index 00000000000..74f3c12c364
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/MatchEvaluator.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Text.RegularExpressions.MatchEvaluator" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Regex.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Regex.xml
new file mode 100644
index 00000000000..73dcc274a37
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/Regex.xml
@@ -0,0 +1,291 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.RegularExpressions.Regex" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Regex(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="pattern">TODO</param>
+ </constructor>
+ <constructor name="Regex(System.String, System.Text.RegularExpressions.RegexOptions)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="pattern">TODO</param>
+ <param name="options">TODO</param>
+ </constructor>
+ <property name="Options">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RightToLeft">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="GroupCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompileToAssembly(System.Text.RegularExpressions.RegexCompilationInfo[], System.Reflection.AssemblyName)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="regexes">TODO</param>
+ <param name="aname">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompileToAssembly(System.Text.RegularExpressions.RegexCompilationInfo[], System.Reflection.AssemblyName, System.Reflection.Emit.CustomAttributeBuilder[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="regexes">TODO</param>
+ <param name="aname">TODO</param>
+ <param name="attribs">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompileToAssembly(System.Text.RegularExpressions.RegexCompilationInfo[], System.Reflection.AssemblyName, System.Reflection.Emit.CustomAttributeBuilder[], System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="regexes">TODO</param>
+ <param name="aname">TODO</param>
+ <param name="attribs">TODO</param>
+ <param name="resourceFile">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Escape(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Unescape(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsMatch(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="pattern">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Match(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="pattern">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Match(System.String, System.String, System.Text.RegularExpressions.RegexOptions)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="pattern">TODO</param>
+ <param name="options">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.String, System.Text.RegularExpressions.MatchEvaluator)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="pattern">TODO</param>
+ <param name="evaluator">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.String, System.Text.RegularExpressions.MatchEvaluator, System.Text.RegularExpressions.RegexOptions)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="pattern">TODO</param>
+ <param name="evaluator">TODO</param>
+ <param name="options">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="pattern">TODO</param>
+ <param name="replacement">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.String, System.String, System.Text.RegularExpressions.RegexOptions)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="pattern">TODO</param>
+ <param name="replacement">TODO</param>
+ <param name="options">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Split(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="pattern">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Split(System.String, System.String, System.Text.RegularExpressions.RegexOptions)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="pattern">TODO</param>
+ <param name="options">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetGroupNames">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetGroupNumbers">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GroupNameFromNumber(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="i">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GroupNumberFromName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsMatch(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsMatch(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="startat">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Match(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Match(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="startat">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Match(System.String, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="startat">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Matches(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Matches(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="startat">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.Text.RegularExpressions.MatchEvaluator)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="evaluator">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.Text.RegularExpressions.MatchEvaluator, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="evaluator">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.Text.RegularExpressions.MatchEvaluator, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="evaluator">TODO</param>
+ <param name="count">TODO</param>
+ <param name="startat">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="replacement">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="replacement">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.String, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="replacement">TODO</param>
+ <param name="count">TODO</param>
+ <param name="startat">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Split(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Split(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Split(System.String, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="count">TODO</param>
+ <param name="startat">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexCollectionBase.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexCollectionBase.xml
new file mode 100644
index 00000000000..b9a8d90c386
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexCollectionBase.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.RegularExpressions.RegexCollectionBase" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexCompilationInfo.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexCompilationInfo.xml
new file mode 100644
index 00000000000..70d435212e0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexCompilationInfo.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.RegularExpressions.RegexCompilationInfo" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RegexCompilationInfo(System.String, System.Text.RegularExpressions.RegexOptions, System.String, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="pattern">TODO</param>
+ <param name="options">TODO</param>
+ <param name="name">TODO</param>
+ <param name="full_namespace">TODO</param>
+ <param name="is_public">TODO</param>
+ </constructor>
+ <property name="IsPublic">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Namespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Options">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Pattern">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexOptions.xml b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexOptions.xml
new file mode 100644
index 00000000000..c1501e1b2a8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text.RegularExpressions/RegexOptions.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Text.RegularExpressions.RegexOptions" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text/ASCIIEncoding.xml b/mcs/docs/apidocs/xml/en/System.Text/ASCIIEncoding.xml
new file mode 100644
index 00000000000..9cf9c7dec81
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text/ASCIIEncoding.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.ASCIIEncoding" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ASCIIEncoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="GetString(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <param name="byteIndex">TODO</param>
+ <param name="byteCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetString(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMaxCharCount(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="byteCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMaxByteCount(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="charCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetChars(System.Byte[], System.Int32, System.Int32, System.Char[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <param name="byteIndex">TODO</param>
+ <param name="byteCount">TODO</param>
+ <param name="chars">TODO</param>
+ <param name="charIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCharCount(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCharCount(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.String, System.Int32, System.Int32, System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <param name="charIndex">TODO</param>
+ <param name="charCount">TODO</param>
+ <param name="bytes">TODO</param>
+ <param name="byteIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Char[], System.Int32, System.Int32, System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <param name="charIndex">TODO</param>
+ <param name="charCount">TODO</param>
+ <param name="bytes">TODO</param>
+ <param name="byteIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetByteCount(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetByteCount(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetByteCount(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text/Decoder.xml b/mcs/docs/apidocs/xml/en/System.Text/Decoder.xml
new file mode 100644
index 00000000000..000fc7223e4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text/Decoder.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.Decoder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="GetChars(System.Byte[], System.Int32, System.Int32, System.Char[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <param name="byteIndex">TODO</param>
+ <param name="byteCount">TODO</param>
+ <param name="chars">TODO</param>
+ <param name="charIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCharCount(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text/Encoder.xml b/mcs/docs/apidocs/xml/en/System.Text/Encoder.xml
new file mode 100644
index 00000000000..46903b52236
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text/Encoder.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.Encoder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="GetBytes(System.Char[], System.Int32, System.Int32, System.Byte[], System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <param name="charIndex">TODO</param>
+ <param name="charCount">TODO</param>
+ <param name="bytes">TODO</param>
+ <param name="byteIndex">TODO</param>
+ <param name="flush">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetByteCount(System.Char[], System.Int32, System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <param name="flush">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text/Encoding.xml b/mcs/docs/apidocs/xml/en/System.Text/Encoding.xml
new file mode 100644
index 00000000000..0b8f9263d96
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text/Encoding.xml
@@ -0,0 +1,268 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.Encoding" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Unicode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UTF7">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UTF8">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ASCII">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BigEndianUnicode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BodyName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CodePage">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Default">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EncodingName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HeaderName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsBrowserDisplay">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsBrowserSave">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsMailNewsDisplay">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsMailNewsSave">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="WebName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="WindowsCodePage">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetString(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetString(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetPreamble">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMaxCharCount(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="byteCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMaxByteCount(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="charCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEncoding(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEncoding(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="codepage">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEncoder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDecoder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetChars(System.Byte[], System.Int32, System.Int32, System.Char[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <param name="byteIndex">TODO</param>
+ <param name="byteCount">TODO</param>
+ <param name="chars">TODO</param>
+ <param name="charIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetChars(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetChars(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCharCount(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCharCount(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bytes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.String, System.Int32, System.Int32, System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="charIndex">TODO</param>
+ <param name="charCount">TODO</param>
+ <param name="bytes">TODO</param>
+ <param name="byteIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Char[], System.Int32, System.Int32, System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <param name="charIndex">TODO</param>
+ <param name="charCount">TODO</param>
+ <param name="bytes">TODO</param>
+ <param name="byteIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetByteCount(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetByteCount(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetByteCount(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="chars">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Convert(System.Text.Encoding, System.Text.Encoding, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="srcEncoding">TODO</param>
+ <param name="dstEncoding">TODO</param>
+ <param name="bytes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Convert(System.Text.Encoding, System.Text.Encoding, System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="srcEncoding">TODO</param>
+ <param name="dstEncoding">TODO</param>
+ <param name="bytes">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text/StringBuilder.xml b/mcs/docs/apidocs/xml/en/System.Text/StringBuilder.xml
new file mode 100644
index 00000000000..82371ab354d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text/StringBuilder.xml
@@ -0,0 +1,412 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.StringBuilder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StringBuilder(System.String, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="length">TODO</param>
+ <param name="capacity">TODO</param>
+ </constructor>
+ <constructor name="StringBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="StringBuilder(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ </constructor>
+ <constructor name="StringBuilder(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ <param name="maxCapacity">TODO</param>
+ </constructor>
+ <constructor name="StringBuilder(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="StringBuilder(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="capacity">TODO</param>
+ </constructor>
+ <property name="MaxCapacity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Capacity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="startIndex">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EnsureCapacity(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="capacity">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Text.StringBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="sb">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="startIndex">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.Char, System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="oldChar">TODO</param>
+ <param name="newChar">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.Char, System.Char, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="oldChar">TODO</param>
+ <param name="newChar">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="oldValue">TODO</param>
+ <param name="newValue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.String, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="oldValue">TODO</param>
+ <param name="newValue">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Char, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="repeatCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="charCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.String, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AppendFormat(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AppendFormat(System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="args">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AppendFormat(System.IFormatProvider, System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <param name="format">TODO</param>
+ <param name="args">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AppendFormat(System.String, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AppendFormat(System.String, System.Object, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <param name="arg2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="charCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text/UTF7Encoding.xml b/mcs/docs/apidocs/xml/en/System.Text/UTF7Encoding.xml
new file mode 100644
index 00000000000..61031c80d33
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text/UTF7Encoding.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.UTF7Encoding" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UTF7Encoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="GetMaxCharCount(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="byteCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMaxByteCount(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="charCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text/UTF8Encoding.xml b/mcs/docs/apidocs/xml/en/System.Text/UTF8Encoding.xml
new file mode 100644
index 00000000000..503d3146f79
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text/UTF8Encoding.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.UTF8Encoding" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UTF8Encoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="GetMaxCharCount(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="byteCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMaxByteCount(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="charCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Text/UnicodeEncoding.xml b/mcs/docs/apidocs/xml/en/System.Text/UnicodeEncoding.xml
new file mode 100644
index 00000000000..cff9430dfdb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Text/UnicodeEncoding.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Text.UnicodeEncoding" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UnicodeEncoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="UnicodeEncoding(System.Boolean, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bigEndian">TODO</param>
+ <param name="byteOrderMark">TODO</param>
+ </constructor>
+ <method name="GetMaxCharCount(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="byteCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMaxByteCount(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="charCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ApartmentState.xml b/mcs/docs/apidocs/xml/en/System.Threading/ApartmentState.xml
new file mode 100644
index 00000000000..86b945e7c22
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ApartmentState.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Threading.ApartmentState" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/AutoResetEvent.xml b/mcs/docs/apidocs/xml/en/System.Threading/AutoResetEvent.xml
new file mode 100644
index 00000000000..f766bc65756
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/AutoResetEvent.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.AutoResetEvent" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AutoResetEvent(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="initialState">TODO</param>
+ </constructor>
+ <method name="Set">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Reset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/IOCompletionCallback.xml b/mcs/docs/apidocs/xml/en/System.Threading/IOCompletionCallback.xml
new file mode 100644
index 00000000000..e45c2f2ead2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/IOCompletionCallback.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Threading.IOCompletionCallback" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/Interlocked.xml b/mcs/docs/apidocs/xml/en/System.Threading/Interlocked.xml
new file mode 100644
index 00000000000..ac9ac6418d4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/Interlocked.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.Interlocked" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="CompareExchange(System.Int32&amp;, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="location1">TODO</param>
+ <param name="value">TODO</param>
+ <param name="comparand">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareExchange(System.Object&amp;, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="location1">TODO</param>
+ <param name="value">TODO</param>
+ <param name="comparand">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareExchange(System.Single&amp;, System.Single, System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="location1">TODO</param>
+ <param name="value">TODO</param>
+ <param name="comparand">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Decrement(System.Int32&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="location">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Decrement(System.Int64&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="location">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Exchange(System.Int32&amp;, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="location1">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Exchange(System.Object&amp;, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="location1">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Exchange(System.Single&amp;, System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="location1">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Increment(System.Int32&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="location">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Increment(System.Int64&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="location">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/LockCookie.xml b/mcs/docs/apidocs/xml/en/System.Threading/LockCookie.xml
new file mode 100644
index 00000000000..4c890edd520
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/LockCookie.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Threading.LockCookie" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ManualResetEvent.xml b/mcs/docs/apidocs/xml/en/System.Threading/ManualResetEvent.xml
new file mode 100644
index 00000000000..f040a0a1641
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ManualResetEvent.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.ManualResetEvent" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ManualResetEvent(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="initialState">TODO</param>
+ </constructor>
+ <method name="Set">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Reset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/Monitor.xml b/mcs/docs/apidocs/xml/en/System.Threading/Monitor.xml
new file mode 100644
index 00000000000..6073e366007
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/Monitor.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.Monitor" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="Enter(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Exit(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Pulse(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="PulseAll(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TryEnter(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TryEnter(System.Object, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="millisecondsTimeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TryEnter(System.Object, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="timeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Wait(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Wait(System.Object, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="millisecondsTimeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Wait(System.Object, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="timeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Wait(System.Object, System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="millisecondsTimeout">TODO</param>
+ <param name="exitContext">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Wait(System.Object, System.TimeSpan, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <param name="timeout">TODO</param>
+ <param name="exitContext">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/Mutex.xml b/mcs/docs/apidocs/xml/en/System.Threading/Mutex.xml
new file mode 100644
index 00000000000..d9221ff3346
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/Mutex.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.Mutex" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Mutex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="Mutex(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="initiallyOwned">TODO</param>
+ </constructor>
+ <constructor name="Mutex(System.Boolean, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="initiallyOwned">TODO</param>
+ <param name="name">TODO</param>
+ </constructor>
+ <constructor name="Mutex(System.Boolean, System.String, System.Boolean&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="initiallyOwned">TODO</param>
+ <param name="name">TODO</param>
+ <param name="gotOwnership">TODO</param>
+ </constructor>
+ <method name="ReleaseMutex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/NativeOverlapped.xml b/mcs/docs/apidocs/xml/en/System.Threading/NativeOverlapped.xml
new file mode 100644
index 00000000000..fa6ddd27379
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/NativeOverlapped.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Threading.NativeOverlapped" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="EventHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="InternalHigh">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="InternalLow">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="OffsetHigh">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="OffsetLow">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/Overlapped.xml b/mcs/docs/apidocs/xml/en/System.Threading/Overlapped.xml
new file mode 100644
index 00000000000..4bf80f64f79
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/Overlapped.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.Overlapped" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Overlapped">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="Overlapped(System.Int32, System.Int32, System.Int32, System.IAsyncResult)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offsetLo">TODO</param>
+ <param name="offsetHi">TODO</param>
+ <param name="hEvent">TODO</param>
+ <param name="ar">TODO</param>
+ </constructor>
+ <property name="AsyncResult">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EventHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OffsetHigh">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OffsetLow">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Free(System.Threading.NativeOverlapped*)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nativeOverlappedPtr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Unpack(System.Threading.NativeOverlapped*)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nativeOverlappedPtr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Pack(System.Threading.IOCompletionCallback)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="iocb">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UnsafePack(System.Threading.IOCompletionCallback)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="iocb">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ReaderWriterLock.xml b/mcs/docs/apidocs/xml/en/System.Threading/ReaderWriterLock.xml
new file mode 100644
index 00000000000..c55a4aec1ca
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ReaderWriterLock.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.ReaderWriterLock" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ReaderWriterLock">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="IsReaderLockHeld">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsWriterLockHeld">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="WriterSeqNum">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="AcquireReaderLock(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="millisecondsTimeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AcquireReaderLock(System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="timeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AcquireWriterLock(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="millisecondsTimeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AcquireWriterLock(System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="timeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AnyWritersSince(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="seqNum">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DowngradeFromWriterLock(System.Threading.LockCookie&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="lockCookie">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReleaseLock">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReleaseReaderLock">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReleaseWriterLock">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="RestoreLock(System.Threading.LockCookie&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="lockCookie">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UpgradeToWriterLock(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="millisecondsTimeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UpgradeToWriterLock(System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="timeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/RegisteredWaitHandle.xml b/mcs/docs/apidocs/xml/en/System.Threading/RegisteredWaitHandle.xml
new file mode 100644
index 00000000000..0d5864f1d0b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/RegisteredWaitHandle.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.RegisteredWaitHandle" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="Unregister(System.Threading.WaitHandle)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitObject">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/SynchronizationLockException.xml b/mcs/docs/apidocs/xml/en/System.Threading/SynchronizationLockException.xml
new file mode 100644
index 00000000000..b61c07ab162
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/SynchronizationLockException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.SynchronizationLockException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SynchronizationLockException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="SynchronizationLockException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="SynchronizationLockException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/Thread.xml b/mcs/docs/apidocs/xml/en/System.Threading/Thread.xml
new file mode 100644
index 00000000000..dcd23005007
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/Thread.xml
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.Thread" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Thread(System.Threading.ThreadStart)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="start">TODO</param>
+ </constructor>
+ <property name="CurrentContext">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentPrincipal">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentThread">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ApartmentState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentCulture">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentUICulture">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsAlive">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsBackground">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Priority">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ThreadState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="AllocateDataSlot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AllocateNamedDataSlot(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FreeNamedDataSlot(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetData(System.LocalDataStoreSlot)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="slot">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDomain">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDomainID">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNamedDataSlot(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ResetAbort">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetData(System.LocalDataStoreSlot, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="slot">TODO</param>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sleep(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="millisecondsTimeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sleep(System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="timeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Abort">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Abort(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stateInfo">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Interrupt">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Join">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Join(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="millisecondsTimeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Join(System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="timeout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Resume">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Start">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Suspend">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ThreadAbortException.xml b/mcs/docs/apidocs/xml/en/System.Threading/ThreadAbortException.xml
new file mode 100644
index 00000000000..ba0c8be21a3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ThreadAbortException.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.ThreadAbortException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="ExceptionState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ThreadExceptionEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Threading/ThreadExceptionEventArgs.xml
new file mode 100644
index 00000000000..9696b298749
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ThreadExceptionEventArgs.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.ThreadExceptionEventArgs" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ThreadExceptionEventArgs(System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t">TODO</param>
+ </constructor>
+ <property name="Exception">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ThreadExceptionEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Threading/ThreadExceptionEventHandler.xml
new file mode 100644
index 00000000000..103b641714d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ThreadExceptionEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Threading.ThreadExceptionEventHandler" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ThreadInterruptedException.xml b/mcs/docs/apidocs/xml/en/System.Threading/ThreadInterruptedException.xml
new file mode 100644
index 00000000000..47bffca396d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ThreadInterruptedException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.ThreadInterruptedException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ThreadInterruptedException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ThreadInterruptedException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ThreadInterruptedException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ThreadPool.xml b/mcs/docs/apidocs/xml/en/System.Threading/ThreadPool.xml
new file mode 100644
index 00000000000..18b1ab0a88a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ThreadPool.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.ThreadPool" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="BindHandle(System.IntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="osHandle">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="QueueUserWorkItem(System.Threading.WaitCallback)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="callback">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="QueueUserWorkItem(System.Threading.WaitCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RegisterWaitForSingleObject(System.Threading.WaitHandle, System.Threading.WaitOrTimerCallback, System.Object, System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitObject">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="millisecondsTimeOutInterval">TODO</param>
+ <param name="executeOnlyOnce">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RegisterWaitForSingleObject(System.Threading.WaitHandle, System.Threading.WaitOrTimerCallback, System.Object, System.Int64, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitObject">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="millisecondsTimeOutInterval">TODO</param>
+ <param name="executeOnlyOnce">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RegisterWaitForSingleObject(System.Threading.WaitHandle, System.Threading.WaitOrTimerCallback, System.Object, System.TimeSpan, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitObject">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="timeout">TODO</param>
+ <param name="executeOnlyOnce">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RegisterWaitForSingleObject(System.Threading.WaitHandle, System.Threading.WaitOrTimerCallback, System.Object, System.UInt32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitObject">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="millisecondsTimeOutInterval">TODO</param>
+ <param name="executeOnlyOnce">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UnsafeQueueUserWorkItem(System.Threading.WaitCallback, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UnsafeRegisterWaitForSingleObject(System.Threading.WaitHandle, System.Threading.WaitOrTimerCallback, System.Object, System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitObject">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="millisecondsTimeOutInterval">TODO</param>
+ <param name="executeOnlyOnce">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UnsafeRegisterWaitForSingleObject(System.Threading.WaitHandle, System.Threading.WaitOrTimerCallback, System.Object, System.Int64, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitObject">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="millisecondsTimeOutInterval">TODO</param>
+ <param name="executeOnlyOnce">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UnsafeRegisterWaitForSingleObject(System.Threading.WaitHandle, System.Threading.WaitOrTimerCallback, System.Object, System.TimeSpan, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitObject">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="timeout">TODO</param>
+ <param name="executeOnlyOnce">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UnsafeRegisterWaitForSingleObject(System.Threading.WaitHandle, System.Threading.WaitOrTimerCallback, System.Object, System.UInt32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitObject">TODO</param>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="millisecondsTimeOutInterval">TODO</param>
+ <param name="executeOnlyOnce">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ThreadPriority.xml b/mcs/docs/apidocs/xml/en/System.Threading/ThreadPriority.xml
new file mode 100644
index 00000000000..4f33a75c6ac
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ThreadPriority.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Threading.ThreadPriority" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ThreadStart.xml b/mcs/docs/apidocs/xml/en/System.Threading/ThreadStart.xml
new file mode 100644
index 00000000000..a916cc25ddc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ThreadStart.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Threading.ThreadStart" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ThreadState.xml b/mcs/docs/apidocs/xml/en/System.Threading/ThreadState.xml
new file mode 100644
index 00000000000..b9f216ebd38
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ThreadState.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Threading.ThreadState" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/ThreadStateException.xml b/mcs/docs/apidocs/xml/en/System.Threading/ThreadStateException.xml
new file mode 100644
index 00000000000..4d77ecbc916
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/ThreadStateException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.ThreadStateException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ThreadStateException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ThreadStateException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ThreadStateException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/Timeout.xml b/mcs/docs/apidocs/xml/en/System.Threading/Timeout.xml
new file mode 100644
index 00000000000..3b3ae9ba4d7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/Timeout.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.Timeout" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Infinite">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/Timer.xml b/mcs/docs/apidocs/xml/en/System.Threading/Timer.xml
new file mode 100644
index 00000000000..066fb6487f7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/Timer.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.Timer" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Timer(System.Threading.TimerCallback, System.Object, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="dueTime">TODO</param>
+ <param name="period">TODO</param>
+ </constructor>
+ <constructor name="Timer(System.Threading.TimerCallback, System.Object, System.Int64, System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="dueTime">TODO</param>
+ <param name="period">TODO</param>
+ </constructor>
+ <constructor name="Timer(System.Threading.TimerCallback, System.Object, System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="dueTime">TODO</param>
+ <param name="period">TODO</param>
+ </constructor>
+ <constructor name="Timer(System.Threading.TimerCallback, System.Object, System.UInt32, System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="callback">TODO</param>
+ <param name="state">TODO</param>
+ <param name="dueTime">TODO</param>
+ <param name="period">TODO</param>
+ </constructor>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Change(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dueTime">TODO</param>
+ <param name="period">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Change(System.Int64, System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dueTime">TODO</param>
+ <param name="period">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Change(System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dueTime">TODO</param>
+ <param name="period">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Change(System.UInt32, System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dueTime">TODO</param>
+ <param name="period">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Dispose(System.Threading.WaitHandle)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="notifyObject">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/TimerCallback.xml b/mcs/docs/apidocs/xml/en/System.Threading/TimerCallback.xml
new file mode 100644
index 00000000000..677fb5a8417
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/TimerCallback.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Threading.TimerCallback" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/WaitCallback.xml b/mcs/docs/apidocs/xml/en/System.Threading/WaitCallback.xml
new file mode 100644
index 00000000000..be00fa1081e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/WaitCallback.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Threading.WaitCallback" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/WaitHandle.xml b/mcs/docs/apidocs/xml/en/System.Threading/WaitHandle.xml
new file mode 100644
index 00000000000..43cee182318
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/WaitHandle.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Threading.WaitHandle" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="WaitHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="WaitTimeout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Handle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitOne(System.TimeSpan, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="timeout">TODO</param>
+ <param name="exitContext">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitOne(System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="millisecondsTimeout">TODO</param>
+ <param name="exitContext">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitOne">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitAll(System.Threading.WaitHandle[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitHandles">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitAll(System.Threading.WaitHandle[], System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitHandles">TODO</param>
+ <param name="millisecondsTimeout">TODO</param>
+ <param name="exitContext">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitAll(System.Threading.WaitHandle[], System.TimeSpan, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitHandles">TODO</param>
+ <param name="timeout">TODO</param>
+ <param name="exitContext">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitAny(System.Threading.WaitHandle[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitHandles">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitAny(System.Threading.WaitHandle[], System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitHandles">TODO</param>
+ <param name="millisecondsTimeout">TODO</param>
+ <param name="exitContext">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WaitAny(System.Threading.WaitHandle[], System.TimeSpan, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="waitHandles">TODO</param>
+ <param name="timeout">TODO</param>
+ <param name="exitContext">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Threading/WaitOrTimerCallback.xml b/mcs/docs/apidocs/xml/en/System.Threading/WaitOrTimerCallback.xml
new file mode 100644
index 00000000000..29ebc232baf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Threading/WaitOrTimerCallback.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Threading.WaitOrTimerCallback" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/Cache.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/Cache.xml
new file mode 100644
index 00000000000..deb2c68d103
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/Cache.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.Caching.Cache" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Cache">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="NoAbsoluteExpiration">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="NoSlidingExpiration">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="SingletonCache">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Touch(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strKey">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String, System.Object, System.Web.Caching.CacheDependency, System.DateTime, System.TimeSpan, System.Web.Caching.CacheItemPriority, System.Web.Caching.CacheItemPriorityDecay, System.Web.Caching.CacheItemRemovedCallback)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strKey">TODO</param>
+ <param name="objItem">TODO</param>
+ <param name="objDependency">TODO</param>
+ <param name="absolutExpiration">TODO</param>
+ <param name="slidingExpiration">TODO</param>
+ <param name="enumPriority">TODO</param>
+ <param name="enumPriorityDecay">TODO</param>
+ <param name="eventRemoveCallback">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strKey">TODO</param>
+ <param name="objItem">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.String, System.Object, System.Web.Caching.CacheDependency)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strKey">TODO</param>
+ <param name="objItem">TODO</param>
+ <param name="objDependency">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.String, System.Object, System.Web.Caching.CacheDependency, System.DateTime, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strKey">TODO</param>
+ <param name="objItem">TODO</param>
+ <param name="objDependency">TODO</param>
+ <param name="absolutExpiration">TODO</param>
+ <param name="slidingExpiration">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.String, System.Object, System.Web.Caching.CacheDependency, System.DateTime, System.TimeSpan, System.Web.Caching.CacheItemPriority, System.Web.Caching.CacheItemPriorityDecay, System.Web.Caching.CacheItemRemovedCallback)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strKey">TODO</param>
+ <param name="objItem">TODO</param>
+ <param name="objDependency">TODO</param>
+ <param name="absolutExpiration">TODO</param>
+ <param name="slidingExpiration">TODO</param>
+ <param name="enumPriority">TODO</param>
+ <param name="enumPriorityDecay">TODO</param>
+ <param name="eventRemoveCallback">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strKey">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Get(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strKey">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheDependency.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheDependency.xml
new file mode 100644
index 00000000000..df5ea4b025f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheDependency.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.Caching.CacheDependency" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CacheDependencyCallback">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CacheDependencyCallback(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="filename">TODO</param>
+ </constructor>
+ <constructor name="CacheDependencyCallback(System.String[], System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="filenames">TODO</param>
+ <param name="cachekeys">TODO</param>
+ </constructor>
+ <property name="IsDisposed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasEvents">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="OnChanged">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Signal">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <event name="Changed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheDependencyCallback.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheDependencyCallback.xml
new file mode 100644
index 00000000000..e30271d091f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheDependencyCallback.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.Caching.CacheDependency+CacheDependencyCallback" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheEntry.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheEntry.xml
new file mode 100644
index 00000000000..a6b5d209b5b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheEntry.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.Caching.CacheEntry" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Flags(System.Web.Caching.Cache, System.String, System.Object, System.Web.Caching.CacheDependency, System.Web.Caching.CacheItemRemovedCallback, System.DateTime, System.TimeSpan, System.Int64, System.Boolean, System.Web.Caching.CacheItemPriority)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objManager">TODO</param>
+ <param name="strKey">TODO</param>
+ <param name="objItem">TODO</param>
+ <param name="objDependency">TODO</param>
+ <param name="eventRemove">TODO</param>
+ <param name="dtExpires">TODO</param>
+ <param name="tsSpan">TODO</param>
+ <param name="longMinHits">TODO</param>
+ <param name="boolPublic">TODO</param>
+ <param name="enumPriority">TODO</param>
+ </constructor>
+ <property name="HasUsage">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasAbsoluteExpiration">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasSlidingExpiration">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ExpiresBucket">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ExpiresIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Expires">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SlidingExpiration">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Key">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Hits">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MinimumHits">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Priority">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="OnChanged(System.Web.Caching.CacheDependency)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objDependency">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close(System.Web.Caching.CacheItemRemovedReason)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="enumReason">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TestFlag(System.Web.Caching.CacheEntry.Flags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="oFlag">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetFlag(System.Web.Caching.CacheEntry.Flags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="oFlag">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheExpires.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheExpires.xml
new file mode 100644
index 00000000000..4d7ec30464a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheExpires.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.Caching.CacheExpires" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CacheExpires(System.Web.Caching.Cache)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objManager">TODO</param>
+ </constructor>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Web.Caching.CacheEntry)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objEntry">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Web.Caching.CacheEntry)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objEntry">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Update(System.Web.Caching.CacheEntry, System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objEntry">TODO</param>
+ <param name="ticksExpires">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GarbageCleanup(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="State">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemPriority.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemPriority.xml
new file mode 100644
index 00000000000..54e64a182ef
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemPriority.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.Caching.CacheItemPriority" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemPriorityDecay.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemPriorityDecay.xml
new file mode 100644
index 00000000000..aaec2241d10
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemPriorityDecay.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.Caching.CacheItemPriorityDecay" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemRemovedCallback.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemRemovedCallback.xml
new file mode 100644
index 00000000000..b98a41cafef
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemRemovedCallback.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.Caching.CacheItemRemovedCallback" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemRemovedReason.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemRemovedReason.xml
new file mode 100644
index 00000000000..1d1824bd2c1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/CacheItemRemovedReason.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.Caching.CacheItemRemovedReason" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/ExpiresBucket.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/ExpiresBucket.xml
new file mode 100644
index 00000000000..ef83f386dce
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/ExpiresBucket.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.Caching.ExpiresBucket" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ExpiresBucket(System.Byte, System.Web.Caching.Cache)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bucket">TODO</param>
+ <param name="objManager">TODO</param>
+ </constructor>
+ <property name="Size">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Add(System.Web.Caching.CacheEntry)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objEntry">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Web.Caching.CacheEntry)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objEntry">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Update(System.Web.Caching.CacheEntry, System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objEntry">TODO</param>
+ <param name="ticksExpires">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FlushExpiredItems">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/ExpiresEntry.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/ExpiresEntry.xml
new file mode 100644
index 00000000000..db235e346e7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/ExpiresEntry.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Web.Caching.ExpiresEntry" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="_objEntry">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="_ticksExpires">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="_intNext">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Caching/Flags.xml b/mcs/docs/apidocs/xml/en/System.Web.Caching/Flags.xml
new file mode 100644
index 00000000000..8122abe8e88
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Caching/Flags.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.Caching.CacheEntry+Flags" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Configuration/AuthenticationMode.xml b/mcs/docs/apidocs/xml/en/System.Web.Configuration/AuthenticationMode.xml
new file mode 100644
index 00000000000..6d5f2dc9730
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Configuration/AuthenticationMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.Configuration.AuthenticationMode" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Configuration/ClientTargetSectionHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.Configuration/ClientTargetSectionHandler.xml
new file mode 100644
index 00000000000..c5d4a62ba96
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Configuration/ClientTargetSectionHandler.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.Configuration.ClientTargetSectionHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ClientTargetSectionHandler">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="KeyAttributeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ValueAttributeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Configuration/FormsAuthPasswordFormat.xml b/mcs/docs/apidocs/xml/en/System.Web.Configuration/FormsAuthPasswordFormat.xml
new file mode 100644
index 00000000000..e4226dfcab7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Configuration/FormsAuthPasswordFormat.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.Configuration.FormsAuthPasswordFormat" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Configuration/FormsProtectionEnum.xml b/mcs/docs/apidocs/xml/en/System.Web.Configuration/FormsProtectionEnum.xml
new file mode 100644
index 00000000000..a125159b178
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Configuration/FormsProtectionEnum.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.Configuration.FormsProtectionEnum" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdCreatedEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdCreatedEventArgs.xml
new file mode 100644
index 00000000000..012e1779ccc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdCreatedEventArgs.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.AdCreatedEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AdCreatedEventArgs(System.Collections.IDictionary)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="adProperties">TODO</param>
+ </constructor>
+ <property name="AdProperties">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AlternateText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ImageUrl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NavigateUrl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdCreatedEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdCreatedEventHandler.xml
new file mode 100644
index 00000000000..53e7c326040
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdCreatedEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.AdCreatedEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdRotator.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdRotator.xml
new file mode 100644
index 00000000000..73d6b28a8bd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/AdRotator.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.AdRotator" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AdRotator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AdvertisementFile">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Font">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="KeywordFilter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Target">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <event name="AdCreated">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseCompareValidator.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseCompareValidator.xml
new file mode 100644
index 00000000000..b496b8fe9eb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseCompareValidator.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.BaseCompareValidator" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Type">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CutoffYear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CanConvert(System.String, System.Web.UI.WebControls.ValidationDataType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseDataList.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseDataList.xml
new file mode 100644
index 00000000000..c209e508b77
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseDataList.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.BaseDataList" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="BaseDataList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Controls">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CellPadding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CellSpacing">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataKeyField">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataKeys">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataMember">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="GridLines">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HorizontalAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataKeysArray">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="DataBind">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsBindableType(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <event name="SelectedIndexChanged">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseValidator.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseValidator.xml
new file mode 100644
index 00000000000..1862b9813f4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BaseValidator.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.BaseValidator" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="ControlToValidate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Display">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EnableClientScript">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Enabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ErrorMessage">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ForeColor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsValid">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PropertiesValid">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RenderUplevel">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Validate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValidationProperty(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="component">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BorderStyle.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BorderStyle.xml
new file mode 100644
index 00000000000..856bce48377
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BorderStyle.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.BorderStyle" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BoundColumn.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BoundColumn.xml
new file mode 100644
index 00000000000..0cf960afc99
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/BoundColumn.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.BoundColumn" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="BoundColumn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="thisExpr">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="DataField">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataFormatString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="InitializeCell(System.Web.UI.WebControls.TableCell, System.Int32, System.Web.UI.WebControls.ListItemType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cell">TODO</param>
+ <param name="columnIndex">TODO</param>
+ <param name="itemType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Initialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Button.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Button.xml
new file mode 100644
index 00000000000..a8f71a6fdf9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Button.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.Button" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Button">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="CausesValidation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CommandArgument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <event name="Click">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="Command">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ButtonColumn.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ButtonColumn.xml
new file mode 100644
index 00000000000..2cc6c5a0019
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ButtonColumn.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.ButtonColumn" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ButtonColumn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ButtonType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataTextField">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataTextFormatString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="InitializeCell(System.Web.UI.WebControls.TableCell, System.Int32, System.Web.UI.WebControls.ListItemType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cell">TODO</param>
+ <param name="columnIndex">TODO</param>
+ <param name="itemType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Initialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ButtonColumnType.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ButtonColumnType.xml
new file mode 100644
index 00000000000..c6e4916800b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ButtonColumnType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.ButtonColumnType" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Calendar.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Calendar.xml
new file mode 100644
index 00000000000..c3695b83e35
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Calendar.xml
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.Calendar" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Calendar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="CellPadding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CellSpacing">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DayHeaderStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DayNameFormat">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DayStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FirstDayOfWeek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NextMonthText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NextPrevFormat">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NextPrevStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OtherMonthDayStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PrevMonthText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedDate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedDates">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedDayStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectionMode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectMonthText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectorStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectWeekText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShowDayHeader">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShowGridLines">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShowNextPrevMonth">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShowTitle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TitleFormat">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TitleStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TodayDayStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TodaysDate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="VisibleDate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="WeekendDayStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <event name="DayRender">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="SelectionChanged">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="VisibleMonthChanged">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CalendarDay.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CalendarDay.xml
new file mode 100644
index 00000000000..2c1b5095405
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CalendarDay.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.CalendarDay" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CalendarDay(System.DateTime, System.Boolean, System.Boolean, System.Boolean, System.Boolean, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="date">TODO</param>
+ <param name="isWeekend">TODO</param>
+ <param name="isToday">TODO</param>
+ <param name="isSelected">TODO</param>
+ <param name="isOtherMonth">TODO</param>
+ <param name="dayNumberText">TODO</param>
+ </constructor>
+ <property name="Date">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DayNumberText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsOtherMonth">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSelectable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSelected">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsToday">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsWeekend">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CalendarSelectionMode.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CalendarSelectionMode.xml
new file mode 100644
index 00000000000..9fb88552b82
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CalendarSelectionMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.CalendarSelectionMode" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CheckBox.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CheckBox.xml
new file mode 100644
index 00000000000..1e612307213
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CheckBox.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.CheckBox" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CheckBox">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AutoPostBack">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Checked">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SaveCheckedViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TextAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <event name="CheckedChanged">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CheckBoxList.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CheckBoxList.xml
new file mode 100644
index 00000000000..51a8ae6db4d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CheckBoxList.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.CheckBoxList" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CheckBoxList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="CellPadding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CellSpacing">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatColumns">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatDirection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatLayout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TextAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CommandEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CommandEventArgs.xml
new file mode 100644
index 00000000000..2ad9335af55
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CommandEventArgs.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.CommandEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CommandEventArgs(System.Web.UI.WebControls.CommandEventArgs)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="e">TODO</param>
+ </constructor>
+ <constructor name="CommandEventArgs(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="commandName">TODO</param>
+ <param name="argument">TODO</param>
+ </constructor>
+ <property name="CommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CommandArgument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CommandEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CommandEventHandler.xml
new file mode 100644
index 00000000000..1c2a998efbe
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CommandEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.CommandEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CompareValidator.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CompareValidator.xml
new file mode 100644
index 00000000000..b5a6275291b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CompareValidator.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.CompareValidator" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CompareValidator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ControlToCompare">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Operator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ValueToCompare">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CustomValidator.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CustomValidator.xml
new file mode 100644
index 00000000000..91ef681da24
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/CustomValidator.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.CustomValidator" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CustomValidator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ClientValidationFunction">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <event name="ServerValidate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGrid.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGrid.xml
new file mode 100644
index 00000000000..9ed82c0bd92
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGrid.xml
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataGrid" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataGrid">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="CancelCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="DeleteCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="EditCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="NextPageCommandArgument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="PageCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="PrevPageCommandArgument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SelectCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SortCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="UpdateCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="AllowCustomPaging">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AllowPaging">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AllowSorting">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AlternatingItemStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AutoGenerateColumns">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BackImageUrl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Columns">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentPageIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EditItemIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EditItemStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FooterStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HeaderStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Items">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PageCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PagerStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PageSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedItem">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedItemStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShowFooter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShowHeader">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="VirtualItemCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <event name="CancelCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="DeleteCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="EditCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="ItemCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="ItemCreated">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="ItemDataBound">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="PageIndexChanged">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="SortCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="UpdateCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridColumn.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridColumn.xml
new file mode 100644
index 00000000000..66ba99aabd1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridColumn.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataGridColumn" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataGridColumn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="FooterStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HeaderStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FooterText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HeaderImageUrl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HeaderText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SortExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Visible">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DesignMode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Owner">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsTrackingViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="InitializeCell(System.Web.UI.WebControls.TableCell, System.Int32, System.Web.UI.WebControls.ListItemType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cell">TODO</param>
+ <param name="columnIndex">TODO</param>
+ <param name="itemType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Initialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridColumnCollection.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridColumnCollection.xml
new file mode 100644
index 00000000000..3dd558a9ce7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridColumnCollection.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataGridColumnCollection" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataGridColumnCollection(System.Web.UI.WebControls.DataGrid, System.Collections.ArrayList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="owner">TODO</param>
+ <param name="columns">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Web.UI.WebControls.DataGridColumn)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="column">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddAt(System.Int32, System.Web.UI.WebControls.DataGridColumn)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="column">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Web.UI.WebControls.DataGridColumn)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="column">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Web.UI.WebControls.DataGridColumn)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="column">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridCommandEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridCommandEventArgs.xml
new file mode 100644
index 00000000000..860aade8bb9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridCommandEventArgs.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataGridCommandEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataGridCommandEventArgs(System.Web.UI.WebControls.DataGridItem, System.Object, System.Web.UI.WebControls.CommandEventArgs)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <param name="commandSource">TODO</param>
+ <param name="originalArgs">TODO</param>
+ </constructor>
+ <property name="CommandSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridCommandEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridCommandEventHandler.xml
new file mode 100644
index 00000000000..cacf0f7aa78
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridCommandEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.DataGridCommandEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItem.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItem.xml
new file mode 100644
index 00000000000..ee949082f87
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItem.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataGridItem" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataGridItem(System.Int32, System.Int32, System.Web.UI.WebControls.ListItemType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="itemIndex">TODO</param>
+ <param name="dataSetIndex">TODO</param>
+ <param name="itemType">TODO</param>
+ </constructor>
+ <property name="DataItem">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataSetIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemCollection.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemCollection.xml
new file mode 100644
index 00000000000..a22c4c552b9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemCollection.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataGridItemCollection" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataGridItemCollection(System.Collections.ArrayList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="items">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemEventArgs.xml
new file mode 100644
index 00000000000..d23ea7db5e4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemEventArgs.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataGridItemEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataGridItemEventArgs(System.Web.UI.WebControls.DataGridItem)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ </constructor>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemEventHandler.xml
new file mode 100644
index 00000000000..be441b64acb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridItemEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.DataGridItemEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPageChangedEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPageChangedEventArgs.xml
new file mode 100644
index 00000000000..112468b9e3f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPageChangedEventArgs.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataGridPageChangedEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataGridPageChangedEventArgs(System.Object, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="commandSource">TODO</param>
+ <param name="newPageIndex">TODO</param>
+ </constructor>
+ <property name="CommandSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NewPageIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPageChangedEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPageChangedEventHandler.xml
new file mode 100644
index 00000000000..4d03f497d9c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPageChangedEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.DataGridPageChangedEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPagerStyle.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPagerStyle.xml
new file mode 100644
index 00000000000..5e7d082c24e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridPagerStyle.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataGridPagerStyle" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Mode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NextPageText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PrevPageText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PageButtonCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Position">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Visible">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Reset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MergeWith(System.Web.UI.WebControls.Style)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyFrom(System.Web.UI.WebControls.Style)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridSortCommandEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridSortCommandEventArgs.xml
new file mode 100644
index 00000000000..f9afd9a5c9e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridSortCommandEventArgs.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataGridSortCommandEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataGridSortCommandEventArgs(System.Object, System.Web.UI.WebControls.DataGridCommandEventArgs)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="commandSource">TODO</param>
+ <param name="dce">TODO</param>
+ </constructor>
+ <property name="CommandSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SortExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridSortCommandEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridSortCommandEventHandler.xml
new file mode 100644
index 00000000000..5acd31112c7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataGridSortCommandEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.DataGridSortCommandEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataKeyCollection.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataKeyCollection.xml
new file mode 100644
index 00000000000..eebf56fb108
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataKeyCollection.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataKeyCollection" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataKeyCollection(System.Collections.ArrayList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="keys">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataList.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataList.xml
new file mode 100644
index 00000000000..9f56e3af5c4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataList.xml
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataList" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="CancelCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="DeleteCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="EditCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SelectCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="UpdateCommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="AlternatingItemStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AlternatingItemTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EditItemIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EditItemStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EditItemTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ExtractTemplateRows">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FooterStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FooterTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="GridLines">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HeaderStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HeaderTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Items">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatColumns">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatDirection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatLayout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedItem">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedItemStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedItemTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SeparatorStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SeparatorTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SeparatorItemTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShowHeader">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShowFooter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <event name="CancelCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="DeleteCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="EditCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="ItemCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="ItemCreated">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="ItemDataBound">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="UpdateCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListCommandEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListCommandEventArgs.xml
new file mode 100644
index 00000000000..3b01947fea0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListCommandEventArgs.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataListCommandEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataListCommandEventArgs(System.Web.UI.WebControls.DataListItem, System.Object, System.Web.UI.WebControls.CommandEventArgs)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <param name="commandSource">TODO</param>
+ <param name="originalArgs">TODO</param>
+ </constructor>
+ <property name="CommandSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListCommandEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListCommandEventHandler.xml
new file mode 100644
index 00000000000..1d8d65bce37
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListCommandEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.DataListCommandEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItem.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItem.xml
new file mode 100644
index 00000000000..fc3cb186399
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItem.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataListItem" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataListItem(System.Int32, System.Web.UI.WebControls.ListItemType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="itemIndex">TODO</param>
+ <param name="itemType">TODO</param>
+ </constructor>
+ <property name="DataItem">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="RenderItem(System.Web.UI.HtmlTextWriter, System.Boolean, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <param name="extractRows">TODO</param>
+ <param name="tableLayout">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemCollection.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemCollection.xml
new file mode 100644
index 00000000000..8a8cb7e83ee
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemCollection.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataListItemCollection" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataListItemCollection(System.Collections.ArrayList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="items">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemEventArgs.xml
new file mode 100644
index 00000000000..5798d8dc566
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemEventArgs.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DataListItemEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataListItemEventArgs(System.Web.UI.WebControls.DataListItem)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ </constructor>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemEventHandler.xml
new file mode 100644
index 00000000000..3fd13672382
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DataListItemEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.DataListItemEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayNameFormat.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayNameFormat.xml
new file mode 100644
index 00000000000..1f39d31d5c0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayNameFormat.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.DayNameFormat" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayRenderEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayRenderEventArgs.xml
new file mode 100644
index 00000000000..1fa1421fd57
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayRenderEventArgs.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DayRenderEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DayRenderEventArgs(System.Web.UI.WebControls.TableCell, System.Web.UI.WebControls.CalendarDay)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cell">TODO</param>
+ <param name="day">TODO</param>
+ </constructor>
+ <property name="Cell">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Day">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayRenderEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayRenderEventHandler.xml
new file mode 100644
index 00000000000..f782ca24c0a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DayRenderEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.DayRenderEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DropDownList.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DropDownList.xml
new file mode 100644
index 00000000000..9caa38c4651
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/DropDownList.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.DropDownList" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DropDownList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BorderColor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BorderStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BorderWidth">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ToolTip">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/EditCommandColumn.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/EditCommandColumn.xml
new file mode 100644
index 00000000000..6606f538d48
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/EditCommandColumn.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.EditCommandColumn" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="EditCommandColumn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ButtonType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CancelText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EditText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UpdateText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="InitializeCell(System.Web.UI.WebControls.TableCell, System.Int32, System.Web.UI.WebControls.ListItemType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cell">TODO</param>
+ <param name="columnIndex">TODO</param>
+ <param name="itemType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FirstDayOfWeek.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FirstDayOfWeek.xml
new file mode 100644
index 00000000000..f6f1c512d3c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FirstDayOfWeek.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.FirstDayOfWeek" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontInfo.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontInfo.xml
new file mode 100644
index 00000000000..4c4b3915f54
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontInfo.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.FontInfo" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Bold">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Italic">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Overline">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Strikeout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Underline">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Size">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Names">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Owner">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyFrom(System.Web.UI.WebControls.FontInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="source">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MergeWith(System.Web.UI.WebControls.FontInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="with">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ShouldSerializeNames">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontNamesConverter.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontNamesConverter.xml
new file mode 100644
index 00000000000..8ad052fc23b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontNamesConverter.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.FontNamesConverter" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FontNamesConverter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="ConvertTo(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="value">TODO</param>
+ <param name="destinationType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ConvertFrom(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CanConvertFrom(System.ComponentModel.ITypeDescriptorContext, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <param name="sourceType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontSize.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontSize.xml
new file mode 100644
index 00000000000..5cef1900068
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontSize.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.FontSize" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontUnit.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontUnit.xml
new file mode 100644
index 00000000000..d9fd7f2a5d4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontUnit.xml
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Web.UI.WebControls.FontUnit" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FontUnit(System.Web.UI.WebControls.FontSize)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ </constructor>
+ <constructor name="FontUnit(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="FontUnit(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="FontUnit(System.Web.UI.WebControls.Unit)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="FontUnit(System.String, System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="culture">TODO</param>
+ </constructor>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Large">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Larger">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Medium">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Small">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Smaller">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="XLarge">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="XSmall">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="XXLarge">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="XXSmall">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="IsEmpty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Type">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Unit">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Point(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="n">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Equality(System.Web.UI.WebControls.FontUnit, System.Web.UI.WebControls.FontUnit)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="left">TODO</param>
+ <param name="right">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Inequality(System.Web.UI.WebControls.FontUnit, System.Web.UI.WebControls.FontUnit)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="left">TODO</param>
+ <param name="right">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Implicit(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="n">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontUnitConverter.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontUnitConverter.xml
new file mode 100644
index 00000000000..7f2e45ebe00
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/FontUnitConverter.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.FontUnitConverter" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FontUnitConverter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetStandardValues(System.ComponentModel.ITypeDescriptorContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ConvertTo(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="value">TODO</param>
+ <param name="destinationType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ConvertFrom(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CanConvertFrom(System.ComponentModel.ITypeDescriptorContext, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <param name="sourceType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/GridLines.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/GridLines.xml
new file mode 100644
index 00000000000..58baa8e165b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/GridLines.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.GridLines" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HorizontalAlign.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HorizontalAlign.xml
new file mode 100644
index 00000000000..1fa9733d61b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HorizontalAlign.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.HorizontalAlign" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLink.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLink.xml
new file mode 100644
index 00000000000..1eb59990035
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLink.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.HyperLink" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="HyperLink">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ImageUrl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NavigateUrl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Target">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLinkColumn.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLinkColumn.xml
new file mode 100644
index 00000000000..e71995dc55d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLinkColumn.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.HyperLinkColumn" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="HyperLinkColumn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="DataNavigateUrlField">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataNavigateUrlFormatString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataTextField">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataTextFormatString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NavigateUrl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Target">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="InitializeCell(System.Web.UI.WebControls.TableCell, System.Int32, System.Web.UI.WebControls.ListItemType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cell">TODO</param>
+ <param name="columnIndex">TODO</param>
+ <param name="itemType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Initialize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLinkControlBuilder.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLinkControlBuilder.xml
new file mode 100644
index 00000000000..2999f2d7b28
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/HyperLinkControlBuilder.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.HyperLinkControlBuilder" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="HyperLinkControlBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="AllowWhitespaceLiterals">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/IRepeatInfoUser.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/IRepeatInfoUser.xml
new file mode 100644
index 00000000000..25fa2633699
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/IRepeatInfoUser.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Web.UI.WebControls.IRepeatInfoUser" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Image.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Image.xml
new file mode 100644
index 00000000000..71f8ccf52d5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Image.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.Image" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Image">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AlternateText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Enabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Font">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ImageAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ImageUrl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ImageAlign.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ImageAlign.xml
new file mode 100644
index 00000000000..6482c1bfc58
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ImageAlign.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.ImageAlign" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ImageButton.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ImageButton.xml
new file mode 100644
index 00000000000..71a6196222a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ImageButton.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.ImageButton" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ImageButton">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="CausesValidation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CommandArgument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TagKey">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <event name="Click">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="Command">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Label.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Label.xml
new file mode 100644
index 00000000000..7a1a74c46f7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Label.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.Label" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Label">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LabelControlBuilder.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LabelControlBuilder.xml
new file mode 100644
index 00000000000..44c93a55267
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LabelControlBuilder.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.LabelControlBuilder" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="LabelControlBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="AllowWhitespaceLiterals">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LinkButton.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LinkButton.xml
new file mode 100644
index 00000000000..04f143a5894
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LinkButton.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.LinkButton" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="LinkButton">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="CausesValidation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CommandArgument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CommandName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <event name="Click">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="Command">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LinkButtonControlBuilder.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LinkButtonControlBuilder.xml
new file mode 100644
index 00000000000..13d87cc1b8b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LinkButtonControlBuilder.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.LinkButtonControlBuilder" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="LinkButtonControlBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="AllowWhitespaceLiterals">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListBox.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListBox.xml
new file mode 100644
index 00000000000..8b6e0c4eacd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListBox.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.ListBox" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ListBox">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BorderColor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BorderStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BorderWidth">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Rows">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectionMode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ToolTip">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListControl.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListControl.xml
new file mode 100644
index 00000000000..68082d44820
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListControl.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.ListControl" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ListControl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AutoPostBack">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataMember">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataTextField">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataTextFormatString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataValueField">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Items">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedItem">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SelectedIndices">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SaveSelectedIndicesViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ClearSelection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <event name="SelectedIndexChanged">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItem.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItem.xml
new file mode 100644
index 00000000000..a13df37e66d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItem.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.ListItem" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ListItem(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="ListItem(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ </constructor>
+ <constructor name="ListItem">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Selected">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Dirty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsTrackingViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="FromString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemCollection.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemCollection.xml
new file mode 100644
index 00000000000..da2774dcd51
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemCollection.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.ListItemCollection" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ListItemCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Capacity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Web.UI.WebControls.ListItem)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.Web.UI.WebControls.ListItem[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="items">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Web.UI.WebControls.ListItem)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FindByText(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FindByValue(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Web.UI.WebControls.ListItem)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Web.UI.WebControls.ListItem)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Web.UI.WebControls.ListItem)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemControlBuilder.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemControlBuilder.xml
new file mode 100644
index 00000000000..5b1027ef790
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemControlBuilder.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.ListItemControlBuilder" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ListItemControlBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="HtmlDecodeLiterals">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AllowWhitespaceLiterals">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemType.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemType.xml
new file mode 100644
index 00000000000..8382b3c0738
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListItemType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.ListItemType" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListSelectionMode.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListSelectionMode.xml
new file mode 100644
index 00000000000..bf46ca30284
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ListSelectionMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.ListSelectionMode" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Literal.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Literal.xml
new file mode 100644
index 00000000000..74bb0c4f226
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Literal.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.Literal" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Literal">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LiteralControlBuilder.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LiteralControlBuilder.xml
new file mode 100644
index 00000000000..2088f45dabb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/LiteralControlBuilder.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.LiteralControlBuilder" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="LiteralControlBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="AppendSubBuilder(System.Web.UI.ControlBuilder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="subBuilder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AllowWhitespaceLiterals">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/MonthChangedEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/MonthChangedEventArgs.xml
new file mode 100644
index 00000000000..51f3fb2269e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/MonthChangedEventArgs.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.MonthChangedEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MonthChangedEventArgs(System.DateTime, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newDate">TODO</param>
+ <param name="previousDate">TODO</param>
+ </constructor>
+ <property name="NewDate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PreviousDate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/MonthChangedEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/MonthChangedEventHandler.xml
new file mode 100644
index 00000000000..62939c7efaa
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/MonthChangedEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.MonthChangedEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/NextPrevFormat.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/NextPrevFormat.xml
new file mode 100644
index 00000000000..b710a1c2074
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/NextPrevFormat.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.NextPrevFormat" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagedDataSource.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagedDataSource.xml
new file mode 100644
index 00000000000..d65603c64cb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagedDataSource.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.PagedDataSource" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="PagedDataSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AllowCustomPaging">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AllowPaging">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentPageIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataSourceCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FirstIndexInPage">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsCustomPagingEnabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFirstPage">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsLastPage">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsPagingEnabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PageCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PageSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="VirtualCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetItemProperties(System.ComponentModel.PropertyDescriptor[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="listAccessors">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetListName(System.ComponentModel.PropertyDescriptor[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="listAccessors">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagerMode.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagerMode.xml
new file mode 100644
index 00000000000..5924b8703ee
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagerMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.PagerMode" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagerPosition.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagerPosition.xml
new file mode 100644
index 00000000000..f7de2c87434
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PagerPosition.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.PagerPosition" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Panel.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Panel.xml
new file mode 100644
index 00000000000..d44b366aae9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Panel.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.Panel" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Panel">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BackImageUrl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HorizontalAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Wrap">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PlaceHolder.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PlaceHolder.xml
new file mode 100644
index 00000000000..265c249c755
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PlaceHolder.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.PlaceHolder" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="PlaceHolder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PlaceHolderControlBuilder.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PlaceHolderControlBuilder.xml
new file mode 100644
index 00000000000..19b91fdb1d1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/PlaceHolderControlBuilder.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.PlaceHolderControlBuilder" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="PlaceHolderControlBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="AllowWhitespaceLiterals">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RadioButton.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RadioButton.xml
new file mode 100644
index 00000000000..e9a85763de1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RadioButton.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.RadioButton" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RadioButton">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="GroupName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UniqueGroupNamePrivate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ValueAttributePrivate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RadioButtonList.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RadioButtonList.xml
new file mode 100644
index 00000000000..084c16f5d07
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RadioButtonList.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.RadioButtonList" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RadioButtonList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="CellPadding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CellSpacing">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatColumns">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatDirection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatLayout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TextAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RangeValidator.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RangeValidator.xml
new file mode 100644
index 00000000000..a0a18ba3167
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RangeValidator.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.RangeValidator" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RangeValidator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="MaximumValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MinimumValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RegularExpressionValidator.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RegularExpressionValidator.xml
new file mode 100644
index 00000000000..62ef297b9dc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RegularExpressionValidator.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.RegularExpressionValidator" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RegularExpressionValidator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ValidationExpression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatDirection.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatDirection.xml
new file mode 100644
index 00000000000..085919ea6e4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatDirection.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.RepeatDirection" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatInfo.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatInfo.xml
new file mode 100644
index 00000000000..5358d08e881
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatInfo.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.RepeatInfo" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RepeatInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="OuterTableImplied">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatColumns">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatDirection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RepeatLayout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="RenderRepeater(System.Web.UI.HtmlTextWriter, System.Web.UI.WebControls.IRepeatInfoUser, System.Web.UI.WebControls.Style, System.Web.UI.WebControls.WebControl)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <param name="user">TODO</param>
+ <param name="controlStyle">TODO</param>
+ <param name="baseControl">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatLayout.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatLayout.xml
new file mode 100644
index 00000000000..a6a6bb35a97
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeatLayout.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.RepeatLayout" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Repeater.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Repeater.xml
new file mode 100644
index 00000000000..9c59361e3e8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Repeater.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.Repeater" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Repeater">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AlternatingItemTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Controls">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataMember">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DataSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FooterTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HeaderTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Items">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SeparatorTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="DataBind">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <event name="ItemCommand">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="ItemCreated">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="ItemDataBound">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterCommandEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterCommandEventArgs.xml
new file mode 100644
index 00000000000..a12980be588
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterCommandEventArgs.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.RepeaterCommandEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RepeaterCommandEventArgs(System.Web.UI.WebControls.RepeaterItem, System.Object, System.Web.UI.WebControls.CommandEventArgs)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <param name="commandSource">TODO</param>
+ <param name="originalArgs">TODO</param>
+ </constructor>
+ <property name="CommandSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterCommandEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterCommandEventHandler.xml
new file mode 100644
index 00000000000..93511d98951
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterCommandEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.RepeaterCommandEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItem.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItem.xml
new file mode 100644
index 00000000000..2e65dded93c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItem.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.RepeaterItem" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RepeaterItem(System.Int32, System.Web.UI.WebControls.ListItemType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="itemIndex">TODO</param>
+ <param name="itemType">TODO</param>
+ </constructor>
+ <property name="DataItem">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemCollection.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemCollection.xml
new file mode 100644
index 00000000000..f1ee3d0d605
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemCollection.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.RepeaterItemCollection" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RepeaterItemCollection(System.Collections.ArrayList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="items">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemEventArgs.xml
new file mode 100644
index 00000000000..2d16ae80510
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemEventArgs.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.RepeaterItemEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RepeaterItemEventArgs(System.Web.UI.WebControls.RepeaterItem)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ </constructor>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemEventHandler.xml
new file mode 100644
index 00000000000..699cba83b44
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RepeaterItemEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.RepeaterItemEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RequiredFieldValidator.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RequiredFieldValidator.xml
new file mode 100644
index 00000000000..68ed9a3fe34
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/RequiredFieldValidator.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.RequiredFieldValidator" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RequiredFieldValidator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="InitialValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/SelectedDatesCollection.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/SelectedDatesCollection.xml
new file mode 100644
index 00000000000..c3cfeb1795a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/SelectedDatesCollection.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.SelectedDatesCollection" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SelectedDatesCollection(System.Collections.ArrayList)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dateList">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="date">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="date">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="date">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SelectRange(System.DateTime, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fromDate">TODO</param>
+ <param name="toDate">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ServerValidateEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ServerValidateEventArgs.xml
new file mode 100644
index 00000000000..7090ac1b1af
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ServerValidateEventArgs.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.ServerValidateEventArgs" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ServerValidateEventArgs(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="isValid">TODO</param>
+ </constructor>
+ <property name="IsValid">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ServerValidateEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ServerValidateEventHandler.xml
new file mode 100644
index 00000000000..d2b2250bb26
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ServerValidateEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.WebControls.ServerValidateEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Style.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Style.xml
new file mode 100644
index 00000000000..a6026260f02
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Style.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.Style" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Style">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="Style(System.Web.UI.StateBag)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bag">TODO</param>
+ </constructor>
+ <property name="ViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BackColor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BorderColor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BorderStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BorderWidth">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CssClass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ForeColor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Height">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Width">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Font">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsEmpty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsTrackingViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Reset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MergeWith(System.Web.UI.WebControls.Style)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="with">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyFrom(System.Web.UI.WebControls.Style)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="source">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddAttributesToRender(System.Web.UI.HtmlTextWriter, System.Web.UI.WebControls.WebControl)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <param name="owner">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddAttributesToRender(System.Web.UI.HtmlTextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Table.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Table.xml
new file mode 100644
index 00000000000..34edf1058c6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Table.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.Table" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Table">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BackImageUrl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CellPadding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CellSpacing">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="GridLines">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HorizontalAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Rows">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCell.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCell.xml
new file mode 100644
index 00000000000..1a4cda11393
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCell.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TableCell" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TableCell">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ColumnSpan">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RowSpan">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HorizontalAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="VerticalAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Wrap">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCellCollection.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCellCollection.xml
new file mode 100644
index 00000000000..761d44c229c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCellCollection.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TableCellCollection" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Web.UI.WebControls.TableCell)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cell">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddAt(System.Int32, System.Web.UI.WebControls.TableCell)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="cell">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.Web.UI.WebControls.TableCell[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cells">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCellIndex(System.Web.UI.WebControls.TableCell)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cell">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Web.UI.WebControls.TableCell)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cell">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCellControlBuilder.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCellControlBuilder.xml
new file mode 100644
index 00000000000..a0b244c39a7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableCellControlBuilder.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TableCellControlBuilder" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TableCellControlBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="AllowWhitespaceLiterals">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableHeaderCell.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableHeaderCell.xml
new file mode 100644
index 00000000000..f28dfdec4ee
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableHeaderCell.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TableHeaderCell" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TableHeaderCell">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableItemStyle.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableItemStyle.xml
new file mode 100644
index 00000000000..b302c502c74
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableItemStyle.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TableItemStyle" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TableItemStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="TableItemStyle(System.Web.UI.StateBag)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bag">TODO</param>
+ </constructor>
+ <property name="HorizontalAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="VerticalAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Wrap">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Reset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MergeWith(System.Web.UI.WebControls.Style)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyFrom(System.Web.UI.WebControls.Style)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddAttributesToRender(System.Web.UI.HtmlTextWriter, System.Web.UI.WebControls.WebControl)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <param name="owner">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableRow.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableRow.xml
new file mode 100644
index 00000000000..7934db63bb6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableRow.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TableRow" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TableRow">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Cells">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HorizontalAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="VerticalAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableRowCollection.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableRowCollection.xml
new file mode 100644
index 00000000000..40125de0f5f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableRowCollection.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TableRowCollection" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Web.UI.WebControls.TableRow)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="row">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddAt(System.Int32, System.Web.UI.WebControls.TableRow)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="row">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddRange(System.Web.UI.WebControls.TableRow[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rows">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetRowIndex(System.Web.UI.WebControls.TableRow)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="row">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Web.UI.WebControls.TableRow)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="row">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableStyle.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableStyle.xml
new file mode 100644
index 00000000000..6b88020e958
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TableStyle.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TableStyle" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TableStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="TableStyle(System.Web.UI.StateBag)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bag">TODO</param>
+ </constructor>
+ <property name="BackImageUrl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CellPadding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CellSpacing">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="GridLines">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HorizontalAlign">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Reset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MergeWith(System.Web.UI.WebControls.Style)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyFrom(System.Web.UI.WebControls.Style)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddAttributesToRender(System.Web.UI.HtmlTextWriter, System.Web.UI.WebControls.WebControl)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <param name="owner">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TargetConverter.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TargetConverter.xml
new file mode 100644
index 00000000000..e1af0f07093
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TargetConverter.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TargetConverter" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TargetConverter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetStandardValues(System.ComponentModel.ITypeDescriptorContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TemplateColumn.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TemplateColumn.xml
new file mode 100644
index 00000000000..1a759c5108b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TemplateColumn.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TemplateColumn" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TemplateColumn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="EditItemTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FooterTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HeaderTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemTemplate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="InitializeCell(System.Web.UI.WebControls.TableCell, System.Int32, System.Web.UI.WebControls.ListItemType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cell">TODO</param>
+ <param name="columnIndex">TODO</param>
+ <param name="itemType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextAlign.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextAlign.xml
new file mode 100644
index 00000000000..9d974b4527b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextAlign.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.TextAlign" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBox.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBox.xml
new file mode 100644
index 00000000000..3c396c9ee48
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBox.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TextBox" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TextBox">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AutoPostBack">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Columns">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MaxLength">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Rows">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TextMode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Wrap">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TagKey">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <event name="TextChanged">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBoxControlBuilder.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBoxControlBuilder.xml
new file mode 100644
index 00000000000..fe14b700460
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBoxControlBuilder.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.TextBoxControlBuilder" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TextBoxControlBuilder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="HtmlDecodeLiterals">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AllowWhitespaceLiterals">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBoxMode.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBoxMode.xml
new file mode 100644
index 00000000000..78d879f9748
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TextBoxMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.TextBoxMode" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TitleFormat.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TitleFormat.xml
new file mode 100644
index 00000000000..2a0d32e23e0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/TitleFormat.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.TitleFormat" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Unit.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Unit.xml
new file mode 100644
index 00000000000..28294efe9ea
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Unit.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Web.UI.WebControls.Unit" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Unit(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="Unit(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="Unit(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="Unit(System.Double, System.Web.UI.WebControls.UnitType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="type">TODO</param>
+ </constructor>
+ <constructor name="Unit(System.String, System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="culture">TODO</param>
+ </constructor>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="IsEmpty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Type">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Percentage(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="n">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Pixel(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="n">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Point(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="n">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Equality(System.Web.UI.WebControls.Unit, System.Web.UI.WebControls.Unit)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="left">TODO</param>
+ <param name="right">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Inequality(System.Web.UI.WebControls.Unit, System.Web.UI.WebControls.Unit)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="left">TODO</param>
+ <param name="right">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Implicit(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="n">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/UnitConverter.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/UnitConverter.xml
new file mode 100644
index 00000000000..6a97eb416da
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/UnitConverter.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.UnitConverter" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UnitConverter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="ConvertTo(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="value">TODO</param>
+ <param name="destinationType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ConvertFrom(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CanConvertFrom(System.ComponentModel.ITypeDescriptorContext, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <param name="sourceType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/UnitType.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/UnitType.xml
new file mode 100644
index 00000000000..827bc30c564
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/UnitType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.UnitType" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidatedControlConverter.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidatedControlConverter.xml
new file mode 100644
index 00000000000..b4141cd470a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidatedControlConverter.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.ValidatedControlConverter" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ValidatedControlConverter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="GetStandardValuesSupported(System.ComponentModel.ITypeDescriptorContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetStandardValuesExclusive(System.ComponentModel.ITypeDescriptorContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetStandardValues(System.ComponentModel.ITypeDescriptorContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationCompareOperator.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationCompareOperator.xml
new file mode 100644
index 00000000000..37f8ccffd84
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationCompareOperator.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.ValidationCompareOperator" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationDataType.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationDataType.xml
new file mode 100644
index 00000000000..af6cb6b1eed
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationDataType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.ValidationDataType" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationSummary.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationSummary.xml
new file mode 100644
index 00000000000..5f41b3e3cf5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationSummary.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.ValidationSummary" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ValidationSummary">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="DisplayMode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EnableClientScript">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ForeColor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShowMessageBox">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShowSummary">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HeaderText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationSummaryDisplayMode.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationSummaryDisplayMode.xml
new file mode 100644
index 00000000000..2c0f858c4a1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidationSummaryDisplayMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.ValidationSummaryDisplayMode" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidatorDisplay.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidatorDisplay.xml
new file mode 100644
index 00000000000..c5c0fb1b269
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/ValidatorDisplay.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.ValidatorDisplay" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/VerticalAlign.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/VerticalAlign.xml
new file mode 100644
index 00000000000..d566d156b84
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/VerticalAlign.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.WebControls.VerticalAlign" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/WebColorConverter.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/WebColorConverter.xml
new file mode 100644
index 00000000000..62641617e4e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/WebColorConverter.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.WebColorConverter" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="WebColorConverter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="ConvertTo(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="value">TODO</param>
+ <param name="destinationType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ConvertFrom(System.ComponentModel.ITypeDescriptorContext, System.Globalization.CultureInfo, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="context">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/WebControl.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/WebControl.xml
new file mode 100644
index 00000000000..46e2f9d3e92
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/WebControl.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.WebControl" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="WebControl(System.Web.UI.HtmlTextWriterTag)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="tag">TODO</param>
+ </constructor>
+ <property name="AccessKey">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BackColor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BorderColor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BorderStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BorderWidth">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ControlStyle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ControlStyleCreated">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CssClass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Enabled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Font">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ForeColor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Height">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Style">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TabIndex">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ToolTip">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Width">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TagKey">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TagName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="RenderEndTag(System.Web.UI.HtmlTextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RenderBeginTag(System.Web.UI.HtmlTextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ApplyStyle(System.Web.UI.WebControls.Style)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyBaseAttributes(System.Web.UI.WebControls.WebControl)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="controlSrc">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MergeStyle(System.Web.UI.WebControls.Style)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Xml.xml b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Xml.xml
new file mode 100644
index 00000000000..aff03e77704
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI.WebControls/Xml.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.WebControls.Xml" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Document">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DocumentContent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DocumentSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Transform">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TransformSource">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TransformArgumentList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/BuildMethod.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/BuildMethod.xml
new file mode 100644
index 00000000000..9f01cdea29b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/BuildMethod.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.BuildMethod" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/BuildTemplateMethod.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/BuildTemplateMethod.xml
new file mode 100644
index 00000000000..1b9162e5ccc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/BuildTemplateMethod.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.BuildTemplateMethod" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/Control.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/Control.xml
new file mode 100644
index 00000000000..1ad9759f6b6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/Control.xml
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.Control" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Control">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ClientID">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Controls">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EnableViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ID">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NamingContainer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Page">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Parent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Site">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TemplateSourceDirectory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UniqueID">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Visible">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ChildControlsCreated">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Context">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Events">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasChildViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsTrackingViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ViewStateIgnoresCase">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Dispose">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="HasControls">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="FindControl(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="id">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DataBind">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="RenderControl(System.Web.UI.HtmlTextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ResolveUrl(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="relativeUrl">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetRenderMethodDelegate(System.Web.UI.RenderMethod)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="renderMethod">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <event name="DataBinding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="Disposed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="Init">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="Load">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="PreRender">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="Unload">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/DataBindingHandlerAttribute.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/DataBindingHandlerAttribute.xml
new file mode 100644
index 00000000000..7717da85b4b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/DataBindingHandlerAttribute.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.DataBindingHandlerAttribute" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DataBindingHandlerAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="DataBindingHandlerAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="typeName">TODO</param>
+ </constructor>
+ <constructor name="DataBindingHandlerAttribute(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ </constructor>
+ <field name="Default">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="HandlerTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/DesignTimeParseData.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/DesignTimeParseData.xml
new file mode 100644
index 00000000000..df5d993d5ec
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/DesignTimeParseData.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.DesignTimeParseData" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DesignTimeParseData">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="InDesigner">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriter.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriter.xml
new file mode 100644
index 00000000000..95f2ca2a694
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriter.xml
@@ -0,0 +1,409 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.HtmlTextWriter" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="HtmlTextWriter(System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ </constructor>
+ <constructor name="HtmlTextWriter(System.IO.TextWriter, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <param name="tabString">TODO</param>
+ </constructor>
+ <field name="DefaultTabString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="DoubleQuoteChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="EndTagLeftChars">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="EqualsChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="EqualsDoubleQuoteString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SelfClosingChars">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SelfClosingTagEnd">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SemicolonChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SingleQuoteChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SlashChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="SpaceChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="StyleEqualsChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="TagLeftChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="TagRightChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Encoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Indent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerWriter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NewLine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TagKey">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TagName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteStyleAttribute(System.String, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <param name="fEncode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStyleAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteFullBeginTag(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="tagName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteEndTag(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="tagName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteBeginTag(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="tagName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteAttribute(System.String, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <param name="fEncode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RenderEndTag">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="RenderBeginTag(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="tagName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RenderBeginTag(System.Web.UI.HtmlTextWriterTag)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="tagKey">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddStyleAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddStyleAttribute(System.Web.UI.HtmlTextWriterStyle, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddAttribute(System.String, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <param name="fEndode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddAttribute(System.Web.UI.HtmlTextWriterAttribute, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="value">TODO</param>
+ <param name="fEncode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddAttribute(System.Web.UI.HtmlTextWriterAttribute, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLineNoTabs(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterAttribute.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterAttribute.xml
new file mode 100644
index 00000000000..bb2ca9d4e9f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterAttribute.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.HtmlTextWriterAttribute" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterStyle.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterStyle.xml
new file mode 100644
index 00000000000..203137709e8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterStyle.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.HtmlTextWriterStyle" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterTag.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterTag.xml
new file mode 100644
index 00000000000..a392625cbcc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/HtmlTextWriterTag.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.HtmlTextWriterTag" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/IAttributeAccessor.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/IAttributeAccessor.xml
new file mode 100644
index 00000000000..e5b654baa73
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/IAttributeAccessor.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Web.UI.IAttributeAccessor" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/IDataBindingsAccessor.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/IDataBindingsAccessor.xml
new file mode 100644
index 00000000000..e1dd05c4f90
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/IDataBindingsAccessor.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Web.UI.IDataBindingsAccessor" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/INamingContainer.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/INamingContainer.xml
new file mode 100644
index 00000000000..f9523b4563f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/INamingContainer.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Web.UI.INamingContainer" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/IParserAccessor.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/IParserAccessor.xml
new file mode 100644
index 00000000000..bea43a15a98
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/IParserAccessor.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Web.UI.IParserAccessor" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/IPostBackDataHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/IPostBackDataHandler.xml
new file mode 100644
index 00000000000..f4fbb2344a5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/IPostBackDataHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Web.UI.IPostBackDataHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/IPostBackEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/IPostBackEventHandler.xml
new file mode 100644
index 00000000000..6a8eb1746ba
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/IPostBackEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Web.UI.IPostBackEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/IStateManager.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/IStateManager.xml
new file mode 100644
index 00000000000..82787116fdd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/IStateManager.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Web.UI.IStateManager" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/ITagNameToTypeMapper.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/ITagNameToTypeMapper.xml
new file mode 100644
index 00000000000..cf4cc78ea5e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/ITagNameToTypeMapper.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Web.UI.ITagNameToTypeMapper" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/ITemplate.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/ITemplate.xml
new file mode 100644
index 00000000000..b229b42f18b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/ITemplate.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Web.UI.ITemplate" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/IValidator.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/IValidator.xml
new file mode 100644
index 00000000000..6d17c690ac2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/IValidator.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Web.UI.IValidator" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/ImageClickEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/ImageClickEventHandler.xml
new file mode 100644
index 00000000000..eac19e160c2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/ImageClickEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.UI.ImageClickEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/LiteralControl.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/LiteralControl.xml
new file mode 100644
index 00000000000..275e1291473
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/LiteralControl.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.LiteralControl" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="LiteralControl">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="LiteralControl(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ </constructor>
+ <property name="Text">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/OutputCacheLocation.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/OutputCacheLocation.xml
new file mode 100644
index 00000000000..eaac300ce41
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/OutputCacheLocation.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.OutputCacheLocation" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/Pair.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/Pair.xml
new file mode 100644
index 00000000000..2bdb4e8a463
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/Pair.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.Pair" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Pair(System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="first">TODO</param>
+ <param name="second">TODO</param>
+ </constructor>
+ <constructor name="Pair">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="First">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Second">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/PersistenceMode.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/PersistenceMode.xml
new file mode 100644
index 00000000000..6a164cb1d23
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/PersistenceMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.UI.PersistenceMode" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/PropertyConverter.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/PropertyConverter.xml
new file mode 100644
index 00000000000..b024c9104e5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/PropertyConverter.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.PropertyConverter" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="EnumFromString(System.Type, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="enumType">TODO</param>
+ <param name="enumValue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EnumToString(System.Type, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="enumType">TODO</param>
+ <param name="enumValue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ObjectFromString(System.Type, System.Reflection.MemberInfo, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objType">TODO</param>
+ <param name="propertyInfo">TODO</param>
+ <param name="objValue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/StateBag.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/StateBag.xml
new file mode 100644
index 00000000000..57f89903859
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/StateBag.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.StateBag" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StateBag(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ignoreCase">TODO</param>
+ </constructor>
+ <constructor name="StateBag">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Keys">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Values">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsTrackingViewState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsItemDirty(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetItemDirty(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="dirty">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/StateItem.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/StateItem.xml
new file mode 100644
index 00000000000..01e44ddaaac
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/StateItem.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.StateItem" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="IsDirty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.UI/ToolboxDataAttribute.xml b/mcs/docs/apidocs/xml/en/System.Web.UI/ToolboxDataAttribute.xml
new file mode 100644
index 00000000000..d0ae0f2182e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.UI/ToolboxDataAttribute.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.UI.ToolboxDataAttribute" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ToolboxDataAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ </constructor>
+ <field name="Default">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="IsDefaultAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Utils/FileAction.xml b/mcs/docs/apidocs/xml/en/System.Web.Utils/FileAction.xml
new file mode 100644
index 00000000000..085d6f56cb9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Utils/FileAction.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.Utils.FileAction" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Utils/FileChangeEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.Utils/FileChangeEventHandler.xml
new file mode 100644
index 00000000000..b255403ac43
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Utils/FileChangeEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.Utils.FileChangeEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Utils/NativeFileChangeEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web.Utils/NativeFileChangeEventHandler.xml
new file mode 100644
index 00000000000..b21ed12a57e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Utils/NativeFileChangeEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.Utils.NativeFileChangeEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Utils/WebEqualComparer.xml b/mcs/docs/apidocs/xml/en/System.Web.Utils/WebEqualComparer.xml
new file mode 100644
index 00000000000..01eef6d0228
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Utils/WebEqualComparer.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.Utils.WebEqualComparer" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="WebEqualComparer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Default">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web.Utils/WebHashCodeProvider.xml b/mcs/docs/apidocs/xml/en/System.Web.Utils/WebHashCodeProvider.xml
new file mode 100644
index 00000000000..9cc1abdd2ca
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web.Utils/WebHashCodeProvider.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.Utils.WebHashCodeProvider" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="WebHashCodeProvider">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Default">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/BeginEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web/BeginEventHandler.xml
new file mode 100644
index 00000000000..0c60b68a4ea
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/BeginEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.BeginEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/EndEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Web/EndEventHandler.xml
new file mode 100644
index 00000000000..711987b13e0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/EndEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.EndEventHandler" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/EndOfSendNotification.xml b/mcs/docs/apidocs/xml/en/System.Web/EndOfSendNotification.xml
new file mode 100644
index 00000000000..8cf577faf3a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/EndOfSendNotification.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Web.HttpWorkerRequest+EndOfSendNotification" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/HttpCacheRevalidation.xml b/mcs/docs/apidocs/xml/en/System.Web/HttpCacheRevalidation.xml
new file mode 100644
index 00000000000..967947fc262
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/HttpCacheRevalidation.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.HttpCacheRevalidation" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/HttpCacheability.xml b/mcs/docs/apidocs/xml/en/System.Web/HttpCacheability.xml
new file mode 100644
index 00000000000..b10489cef05
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/HttpCacheability.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.HttpCacheability" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/HttpCookie.xml b/mcs/docs/apidocs/xml/en/System.Web/HttpCookie.xml
new file mode 100644
index 00000000000..7bfaa9332d7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/HttpCookie.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.HttpCookie" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="HttpCookie(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <constructor name="HttpCookie(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ </constructor>
+ <property name="Domain">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Expires">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasKeys">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Path">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Secure">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Values">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/HttpCookieCollection.xml b/mcs/docs/apidocs/xml/en/System.Web/HttpCookieCollection.xml
new file mode 100644
index 00000000000..938631012d4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/HttpCookieCollection.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.HttpCookieCollection" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="HttpCookieCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AllKeys">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Add(System.Web.HttpCookie)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cookie">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dest">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetKey(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Set(System.Web.HttpCookie)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="cookie">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/HttpRuntime.xml b/mcs/docs/apidocs/xml/en/System.Web/HttpRuntime.xml
new file mode 100644
index 00000000000..5277ade0168
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/HttpRuntime.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.HttpRuntime" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="HttpRuntime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Cache">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AppDomainAppId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AppDomainAppPath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AppDomainAppVirtualPath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AppDomainId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AspInstallDirectory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BinDirectory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ClrInstallDirectory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CodegenDir">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsOnUNCShare">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MachineConfigurationDirectory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AppPathDiscovery">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ControlPrincipal">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Reflection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SensitiveInformation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UnmanagedCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Unrestricted">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/HttpServerUtility.xml b/mcs/docs/apidocs/xml/en/System.Web/HttpServerUtility.xml
new file mode 100644
index 00000000000..99708dc3a92
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/HttpServerUtility.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.HttpServerUtility" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="HttpServerUtility">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="MachineName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ScriptTimeout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ClearError">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateObject(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="progID">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateObject(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateObjectFromClsid(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="clsid">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Execute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Execute(System.String, System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="writer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLastError">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="HtmlDecode(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="HtmlDecode(System.String, System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="output">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="HtmlEncode(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="HtmlEncode(System.String, System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="output">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MapPath(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Transfer(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Transfer(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <param name="preserveForm">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UrlDecode(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UrlDecode(System.String, System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="output">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UrlEncode(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UrlEncode(System.String, System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="output">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="UrlPathEncode(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/HttpValidationStatus.xml b/mcs/docs/apidocs/xml/en/System.Web/HttpValidationStatus.xml
new file mode 100644
index 00000000000..2ed1766c4b4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/HttpValidationStatus.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.HttpValidationStatus" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/HttpWorkerRequest.xml b/mcs/docs/apidocs/xml/en/System.Web/HttpWorkerRequest.xml
new file mode 100644
index 00000000000..8bf2dd0c926
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/HttpWorkerRequest.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Web.HttpWorkerRequest" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="EndOfSendNotification">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/ProcessShutdownReason.xml b/mcs/docs/apidocs/xml/en/System.Web/ProcessShutdownReason.xml
new file mode 100644
index 00000000000..75d7eb81a61
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/ProcessShutdownReason.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.ProcessShutdownReason" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/ProcessStatus.xml b/mcs/docs/apidocs/xml/en/System.Web/ProcessStatus.xml
new file mode 100644
index 00000000000..7d85fa562c0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/ProcessStatus.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.ProcessStatus" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Web/TraceMode.xml b/mcs/docs/apidocs/xml/en/System.Web/TraceMode.xml
new file mode 100644
index 00000000000..1fe58d1a5f2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Web/TraceMode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Web.TraceMode" assembly="System.Web">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/ValidationEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/ValidationEventArgs.xml
new file mode 100644
index 00000000000..0074606703b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/ValidationEventArgs.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.ValidationEventArgs" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Exception">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Message">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Severity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/ValidationEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/ValidationEventHandler.xml
new file mode 100644
index 00000000000..2406235558b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/ValidationEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Xml.Schema.ValidationEventHandler" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchema.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchema.xml
new file mode 100644
index 00000000000..48ab802eb39
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchema.xml
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchema" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchema">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="InstanceNamespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Namespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="AttributeFormDefault">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AttributeGroups">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BlockDefault">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ElementFormDefault">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Elements">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FinalDefault">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Groups">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Id">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Includes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsCompiled">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Items">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Notations">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SchemaTypes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TargetNamespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UnhandledAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Version">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Language">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Compile(System.Xml.Schema.ValidationEventHandler)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="validationEventHandler">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.IO.TextReader, System.Xml.Schema.ValidationEventHandler)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="reader">TODO</param>
+ <param name="validationEventHandler">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.IO.Stream, System.Xml.Schema.ValidationEventHandler)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <param name="validationEventHandler">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read(System.Xml.XmlReader, System.Xml.Schema.ValidationEventHandler)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="reader">TODO</param>
+ <param name="validationEventHandler">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.IO.Stream, System.Xml.XmlNamespaceManager)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="stream">TODO</param>
+ <param name="namespaceManager">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.IO.TextWriter, System.Xml.XmlNamespaceManager)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <param name="namespaceManager">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Xml.XmlWriter, System.Xml.XmlNamespaceManager)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <param name="namespaceManager">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAll.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAll.xml
new file mode 100644
index 00000000000..b9ed588375f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAll.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaAll" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaAll">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Items">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnnotated.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnnotated.xml
new file mode 100644
index 00000000000..ba8b400c76c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnnotated.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaAnnotated" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaAnnotated">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Annotation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Id">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UnhandledAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnnotation.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnnotation.xml
new file mode 100644
index 00000000000..4257581a80d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnnotation.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaAnnotation" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaAnnotation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Id">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Items">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UnhandledAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAny.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAny.xml
new file mode 100644
index 00000000000..e822dda3812
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAny.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaAny" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaAny">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Namespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProcessContents">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnyAttribute.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnyAttribute.xml
new file mode 100644
index 00000000000..ad401ea0a57
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAnyAttribute.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaAnyAttribute" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaAnyAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Namespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ProcessContents">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAppInfo.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAppInfo.xml
new file mode 100644
index 00000000000..77912b20c4b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAppInfo.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaAppInfo" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaAppInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Markup">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Source">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttribute.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttribute.xml
new file mode 100644
index 00000000000..c3112798ee1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttribute.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaAttribute" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AttributeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DefaultValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FixedValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Form">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="QualifiedName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RefName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SchemaType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SchemaTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Use">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttributeGroup.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttributeGroup.xml
new file mode 100644
index 00000000000..71a4f94f483
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttributeGroup.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaAttributeGroup" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaAttributeGroup">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AnyAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RedefinedAttributeGroup">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttributeGroupRef.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttributeGroupRef.xml
new file mode 100644
index 00000000000..3b43321dc77
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaAttributeGroupRef.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaAttributeGroupRef" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaAttributeGroupRef">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="RefName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaChoice.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaChoice.xml
new file mode 100644
index 00000000000..1bd5f6d9804
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaChoice.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaChoice" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaChoice">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Items">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaCollection.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaCollection.xml
new file mode 100644
index 00000000000..363bf38bab6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaCollection.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaCollection" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="XmlSchemaCollection(System.Xml.XmlNameTable)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nametable">TODO</param>
+ </constructor>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NameTable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Add(System.String, System.Xml.XmlReader)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ns">TODO</param>
+ <param name="reader">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ns">TODO</param>
+ <param name="uri">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Xml.Schema.XmlSchema)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="schema">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Xml.Schema.XmlSchemaCollection)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="schema">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Xml.Schema.XmlSchema)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="schema">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Xml.Schema.XmlSchema[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <event name="ValidationEventHandler">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaCollectionEnumerator.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaCollectionEnumerator.xml
new file mode 100644
index 00000000000..399a6f2be2c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaCollectionEnumerator.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaCollectionEnumerator" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Current">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="MoveNext">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContent.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContent.xml
new file mode 100644
index 00000000000..7d945f9a4ce
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContent.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaComplexContent" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaComplexContent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Content">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsMixed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContentExtension.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContentExtension.xml
new file mode 100644
index 00000000000..710d219e57f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContentExtension.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaComplexContentExtension" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaComplexContentExtension">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BaseTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AnyAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Particle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContentRestriction.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContentRestriction.xml
new file mode 100644
index 00000000000..0f717fd3e35
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexContentRestriction.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaComplexContentRestriction" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaComplexContentRestriction">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BaseTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AnyAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Particle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexType.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexType.xml
new file mode 100644
index 00000000000..2f426b78c08
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaComplexType.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaComplexType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaComplexType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Block">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsAbstract">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsMixed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AnyAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ContentModel">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Particle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AttributeUses">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AttributeWildcard">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BlockResolved">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ContentType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ContentTypeParticle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContent.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContent.xml
new file mode 100644
index 00000000000..c89646367a4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContent.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaContent" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentModel.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentModel.xml
new file mode 100644
index 00000000000..6d5c2088765
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentModel.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaContentModel" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Content">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentProcessing.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentProcessing.xml
new file mode 100644
index 00000000000..e36b7e84ad7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentProcessing.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.Schema.XmlSchemaContentProcessing" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentType.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentType.xml
new file mode 100644
index 00000000000..d73d8537db5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaContentType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.Schema.XmlSchemaContentType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDatatype.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDatatype.xml
new file mode 100644
index 00000000000..afe65a6b627
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDatatype.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaDatatype" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="TokenizedType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ValueType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ParseValue(System.String, System.Xml.XmlNameTable, System.Xml.XmlNamespaceManager)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="nameTable">TODO</param>
+ <param name="nsmgr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDerivationMethod.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDerivationMethod.xml
new file mode 100644
index 00000000000..ea0df9878bb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDerivationMethod.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.Schema.XmlSchemaDerivationMethod" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDocumentation.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDocumentation.xml
new file mode 100644
index 00000000000..442ecacd2d3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaDocumentation.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaDocumentation" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaDocumentation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Markup">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Source">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Language">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaElement.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaElement.xml
new file mode 100644
index 00000000000..2326615f301
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaElement.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaElement" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="IsAbstract">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Block">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DefaultValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Final">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FixedValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Form">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsNillable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RefName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SchemaTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SubstitutionGroup">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Constraints">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SchemaType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BlockResolved">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ElementType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FinalResolved">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="QualifiedName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaEnumerationFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaEnumerationFacet.xml
new file mode 100644
index 00000000000..29f758db2d0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaEnumerationFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaEnumerationFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaEnumerationFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaException.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaException.xml
new file mode 100644
index 00000000000..9ab0f104ca5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaException.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaException" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ <property name="LineNumber">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LinePosition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Message">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SourceSchemaObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SourceUri">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaExternal.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaExternal.xml
new file mode 100644
index 00000000000..8cde2f06706
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaExternal.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaExternal" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Id">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Schema">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SchemaLocation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UnhandledAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaFacet.xml
new file mode 100644
index 00000000000..dba18bd2392
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaFacet.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="IsFixed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaForm.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaForm.xml
new file mode 100644
index 00000000000..e861d5bc52e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaForm.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.Schema.XmlSchemaForm" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaFractionDigitsFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaFractionDigitsFacet.xml
new file mode 100644
index 00000000000..edecd71515b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaFractionDigitsFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaFractionDigitsFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaFractionDigitsFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroup.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroup.xml
new file mode 100644
index 00000000000..6fc3195382d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroup.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaGroup" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaGroup">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Particle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroupBase.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroupBase.xml
new file mode 100644
index 00000000000..0f70d69626b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroupBase.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaGroupBase" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Items">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroupRef.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroupRef.xml
new file mode 100644
index 00000000000..69dbedf187f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaGroupRef.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaGroupRef" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaGroupRef">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Particle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RefName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaIdentityConstraint.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaIdentityConstraint.xml
new file mode 100644
index 00000000000..45aae6a1390
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaIdentityConstraint.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaIdentityConstraint" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaIdentityConstraint">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Fields">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Selector">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="QualifiedName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaImport.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaImport.xml
new file mode 100644
index 00000000000..841a70a2580
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaImport.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaImport" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaImport">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Annotation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Namespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaInclude.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaInclude.xml
new file mode 100644
index 00000000000..0f66695a602
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaInclude.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaInclude" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaInclude">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Annotation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaKey.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaKey.xml
new file mode 100644
index 00000000000..73f63e5d1a0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaKey.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaKey" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaKey">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaKeyref.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaKeyref.xml
new file mode 100644
index 00000000000..4e36755dfe9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaKeyref.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaKeyref" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaKeyref">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Refer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaLengthFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaLengthFacet.xml
new file mode 100644
index 00000000000..5db9b6ad4f9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaLengthFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaLengthFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaLengthFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.xml
new file mode 100644
index 00000000000..cc1b9f383d5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaMaxExclusiveFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaMaxExclusiveFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.xml
new file mode 100644
index 00000000000..25cd201dad6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaMaxInclusiveFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaMaxInclusiveFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxLengthFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxLengthFacet.xml
new file mode 100644
index 00000000000..8d2e208b137
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMaxLengthFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaMaxLengthFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaMaxLengthFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinExclusiveFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinExclusiveFacet.xml
new file mode 100644
index 00000000000..7a8fddf565a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinExclusiveFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaMinExclusiveFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaMinExclusiveFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinInclusiveFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinInclusiveFacet.xml
new file mode 100644
index 00000000000..f80284b88a5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinInclusiveFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaMinInclusiveFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaMinInclusiveFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinLengthFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinLengthFacet.xml
new file mode 100644
index 00000000000..73368379d13
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaMinLengthFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaMinLengthFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaMinLengthFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaNotation.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaNotation.xml
new file mode 100644
index 00000000000..e955e77a00c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaNotation.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaNotation" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaNotation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Public">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaNumericFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaNumericFacet.xml
new file mode 100644
index 00000000000..bfcf3fe3869
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaNumericFacet.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaNumericFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObject.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObject.xml
new file mode 100644
index 00000000000..2ad7e630598
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObject.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaObject" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="LineNumber">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LinePosition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SourceUri">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Namespaces">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectCollection.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectCollection.xml
new file mode 100644
index 00000000000..b6e080dd061
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectCollection.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaObjectCollection" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaObjectCollection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="XmlSchemaObjectCollection(System.Xml.Schema.XmlSchemaObject)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="parent">TODO</param>
+ </constructor>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Add(System.Xml.Schema.XmlSchemaObject)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Contains(System.Xml.Schema.XmlSchemaObject)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Xml.Schema.XmlSchemaObject[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Xml.Schema.XmlSchemaObject)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.Xml.Schema.XmlSchemaObject)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Xml.Schema.XmlSchemaObject)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="item">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectEnumerator.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectEnumerator.xml
new file mode 100644
index 00000000000..ea55500857f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectEnumerator.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaObjectEnumerator" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Current">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="MoveNext">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Reset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectTable.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectTable.xml
new file mode 100644
index 00000000000..d076dab50c2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaObjectTable.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaObjectTable" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Names">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Values">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Contains(System.Xml.XmlQualifiedName)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaParticle.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaParticle.xml
new file mode 100644
index 00000000000..161c53d77a8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaParticle.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaParticle" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="MaxOccursString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MinOccursString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MaxOccurs">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MinOccurs">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaPatternFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaPatternFacet.xml
new file mode 100644
index 00000000000..8790fb09a60
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaPatternFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaPatternFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaPatternFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaRedefine.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaRedefine.xml
new file mode 100644
index 00000000000..1f4b8f58bc1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaRedefine.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaRedefine" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaRedefine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AttributeGroups">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Groups">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Items">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SchemaTypes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSequence.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSequence.xml
new file mode 100644
index 00000000000..4d259546431
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSequence.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaSequence" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaSequence">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Items">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContent.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContent.xml
new file mode 100644
index 00000000000..bd5ff0b3187
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContent.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaSimpleContent" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaSimpleContent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Content">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContentExtension.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContentExtension.xml
new file mode 100644
index 00000000000..ae536b81b61
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContentExtension.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaSimpleContentExtension" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaSimpleContentExtension">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="AnyAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContentRestriction.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContentRestriction.xml
new file mode 100644
index 00000000000..bd82e67b320
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleContentRestriction.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaSimpleContentRestriction" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaSimpleContentRestriction">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BaseTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AnyAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Facets">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleType.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleType.xml
new file mode 100644
index 00000000000..60cc1ba947e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleType.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaSimpleType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaSimpleType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Content">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeContent.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeContent.xml
new file mode 100644
index 00000000000..68f2d9f183e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeContent.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaSimpleTypeContent" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeList.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeList.xml
new file mode 100644
index 00000000000..75e67bfd7ce
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeList.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaSimpleTypeList" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaSimpleTypeList">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ItemType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.xml
new file mode 100644
index 00000000000..5a2bc87dd44
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaSimpleTypeRestriction" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaSimpleTypeRestriction">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BaseType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Facets">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeUnion.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeUnion.xml
new file mode 100644
index 00000000000..f91d2ef02a9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaSimpleTypeUnion.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaSimpleTypeUnion" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaSimpleTypeUnion">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="BaseTypes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MemberTypes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaTotalDigitsFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaTotalDigitsFacet.xml
new file mode 100644
index 00000000000..ecb34b186fd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaTotalDigitsFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaTotalDigitsFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaTotalDigitsFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaType.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaType.xml
new file mode 100644
index 00000000000..014e95feac1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaType.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Final">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseSchemaType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Datatype">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DerivedBy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FinalResolved">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsMixed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="QualifiedName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaUnique.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaUnique.xml
new file mode 100644
index 00000000000..59e3539aae1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaUnique.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaUnique" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaUnique">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaUse.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaUse.xml
new file mode 100644
index 00000000000..a1805e5f7a7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaUse.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.Schema.XmlSchemaUse" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.xml
new file mode 100644
index 00000000000..deabb059f2e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaWhiteSpaceFacet" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaWhiteSpaceFacet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaXPath.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaXPath.xml
new file mode 100644
index 00000000000..bcf34da65d5
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSchemaXPath.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.Schema.XmlSchemaXPath" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlSchemaXPath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="XPath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSeverityType.xml b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSeverityType.xml
new file mode 100644
index 00000000000..063be488cb8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.Schema/XmlSeverityType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.Schema.XmlSeverityType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.XPath/IXPathNavigable.xml b/mcs/docs/apidocs/xml/en/System.Xml.XPath/IXPathNavigable.xml
new file mode 100644
index 00000000000..0d5b2d0b9ab
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.XPath/IXPathNavigable.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Xml.XPath.IXPathNavigable" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathExpression.xml b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathExpression.xml
new file mode 100644
index 00000000000..f46f860a956
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathExpression.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XPath.XPathExpression" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Expression">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReturnType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SetContext(System.Xml.XmlNamespaceManager)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nsManager">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddSort(System.Object, System.Xml.XPath.XmlSortOrder, System.Xml.XPath.XmlCaseOrder, System.String, System.Xml.XPath.XmlDataType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="expr">TODO</param>
+ <param name="order">TODO</param>
+ <param name="caseOrder">TODO</param>
+ <param name="lang">TODO</param>
+ <param name="dataType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddSort(System.Object, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="expr">TODO</param>
+ <param name="comparer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNamespaceScope.xml b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNamespaceScope.xml
new file mode 100644
index 00000000000..6105b9d0179
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNamespaceScope.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XPath.XPathNamespaceScope" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNavigator.xml b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNavigator.xml
new file mode 100644
index 00000000000..1f39dfe6572
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNavigator.xml
@@ -0,0 +1,288 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XPath.XPathNavigator" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="BaseURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasChildren">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsEmptyElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NamespaceURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NameTable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Prefix">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlLang">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SelectDescendants(System.String, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <param name="matchSelf">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SelectDescendants(System.Xml.XPath.XPathNodeType, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="matchSelf">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SelectChildren(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SelectChildren(System.Xml.XPath.XPathNodeType)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SelectAncestors(System.String, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <param name="matchSelf">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SelectAncestors(System.Xml.XPath.XPathNodeType, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="matchSelf">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Select(System.Xml.XPath.XPathExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="expr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Select(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xpath">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToPrevious">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToParent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToNextNamespace(System.Xml.XPath.XPathNamespaceScope)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="namespaceScope">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToNextAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToNext">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToNamespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToId(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="id">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToFirstNamespace(System.Xml.XPath.XPathNamespaceScope)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="namespaceScope">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToFirstChild">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToFirstAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToFirst">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveTo(System.Xml.XPath.XPathNavigator)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="other">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Matches(System.Xml.XPath.XPathExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="expr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Matches(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xpath">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSamePosition(System.Xml.XPath.XPathNavigator)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="other">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDescendant(System.Xml.XPath.XPathNavigator)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nav">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNamespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Evaluate(System.Xml.XPath.XPathExpression, System.Xml.XPath.XPathNodeIterator)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="expr">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Evaluate(System.Xml.XPath.XPathExpression)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="expr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Evaluate(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xpath">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Compile(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xpath">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ComparePosition(System.Xml.XPath.XPathNavigator)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nav">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToFirstNamespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToNextNamespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNodeIterator.xml b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNodeIterator.xml
new file mode 100644
index 00000000000..fd41655f363
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNodeIterator.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XPath.XPathNodeIterator" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Current">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentPosition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="MoveNext">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNodeType.xml b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNodeType.xml
new file mode 100644
index 00000000000..da5610933d8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathNodeType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XPath.XPathNodeType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathResultType.xml b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathResultType.xml
new file mode 100644
index 00000000000..e5658414659
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathResultType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XPath.XPathResultType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathScanner.xml b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathScanner.xml
new file mode 100644
index 00000000000..b38ba50a98b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathScanner.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XPath.XPathScanner" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XPathScanner(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xpath">TODO</param>
+ </constructor>
+ <property name="TokenType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Scan">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathTokenType.xml b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathTokenType.xml
new file mode 100644
index 00000000000..0fa8d8a62b8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XPathTokenType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XPath.XPathTokenType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.XPath/XmlDataType.xml b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XmlDataType.xml
new file mode 100644
index 00000000000..6fe40fb98a9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XmlDataType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XPath.XmlDataType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml.XPath/XmlSortOrder.xml b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XmlSortOrder.xml
new file mode 100644
index 00000000000..55177785804
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml.XPath/XmlSortOrder.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XPath.XmlSortOrder" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/EntityHandling.xml b/mcs/docs/apidocs/xml/en/System.Xml/EntityHandling.xml
new file mode 100644
index 00000000000..1a0967bfb37
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/EntityHandling.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.EntityHandling" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/Formatting.xml b/mcs/docs/apidocs/xml/en/System.Xml/Formatting.xml
new file mode 100644
index 00000000000..fd67ab9c3dd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/Formatting.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.Formatting" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/IHasXmlNode.xml b/mcs/docs/apidocs/xml/en/System.Xml/IHasXmlNode.xml
new file mode 100644
index 00000000000..a9f4d27556d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/IHasXmlNode.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Xml.IHasXmlNode" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/IXmlLineInfo.xml b/mcs/docs/apidocs/xml/en/System.Xml/IXmlLineInfo.xml
new file mode 100644
index 00000000000..997b1b35bf2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/IXmlLineInfo.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.Xml.IXmlLineInfo" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/NameTable.xml b/mcs/docs/apidocs/xml/en/System.Xml/NameTable.xml
new file mode 100644
index 00000000000..961b8690629
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/NameTable.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.NameTable" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NameTable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="Get(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Get(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <param name="start">TODO</param>
+ <param name="len">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="key">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/ReadState.xml b/mcs/docs/apidocs/xml/en/System.Xml/ReadState.xml
new file mode 100644
index 00000000000..a3f356debd3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/ReadState.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.ReadState" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/ValidationType.xml b/mcs/docs/apidocs/xml/en/System.Xml/ValidationType.xml
new file mode 100644
index 00000000000..35c7c032888
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/ValidationType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.ValidationType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/WhitespaceHandling.xml b/mcs/docs/apidocs/xml/en/System.Xml/WhitespaceHandling.xml
new file mode 100644
index 00000000000..cbbc45eba63
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/WhitespaceHandling.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.WhitespaceHandling" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/WriteState.xml b/mcs/docs/apidocs/xml/en/System.Xml/WriteState.xml
new file mode 100644
index 00000000000..7805202cae9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/WriteState.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.WriteState" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlAttribute.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlAttribute.xml
new file mode 100644
index 00000000000..5ceb3a05c34
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlAttribute.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlAttribute" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="BaseURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NamespaceURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OwnerDocument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OwnerElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ParentNode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Prefix">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Specified">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LastLinkedChild">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlAttributeCollection.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlAttributeCollection.xml
new file mode 100644
index 00000000000..332e22c8c35
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlAttributeCollection.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlAttributeCollection" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="ItemOf">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemOf">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemOf">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="RemoveAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="i">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAll">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Xml.XmlAttribute)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="node">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Prepend(System.Xml.XmlAttribute)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="node">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="InsertBefore(System.Xml.XmlAttribute, System.Xml.XmlAttribute)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newNode">TODO</param>
+ <param name="refNode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="InsertAfter(System.Xml.XmlAttribute, System.Xml.XmlAttribute)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newNode">TODO</param>
+ <param name="refNode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Append(System.Xml.XmlAttribute)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="node">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetNamedItem(System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="node">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Xml.XmlAttribute[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlCDataSection.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlCDataSection.xml
new file mode 100644
index 00000000000..515f6201dbd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlCDataSection.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlCDataSection" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlCaseOrder.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlCaseOrder.xml
new file mode 100644
index 00000000000..ab7f8ddc62a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlCaseOrder.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XmlCaseOrder" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlCharacterData.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlCharacterData.xml
new file mode 100644
index 00000000000..3de21092924
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlCharacterData.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlCharacterData" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Substring(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReplaceData(System.Int32, System.Int32, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <param name="strData">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="InsertData(System.Int32, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <param name="strData">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DeleteData(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AppendData(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strData">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlComment.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlComment.xml
new file mode 100644
index 00000000000..b156db70c0f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlComment.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlComment" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlDeclaration.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlDeclaration.xml
new file mode 100644
index 00000000000..158b719db77
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlDeclaration.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlDeclaration" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Encoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Standalone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Version">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlDocument.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlDocument.xml
new file mode 100644
index 00000000000..0076c6c2982
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlDocument.xml
@@ -0,0 +1,353 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlDocument" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlDocument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="XmlDocument(System.Xml.NameTable)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nt">TODO</param>
+ </constructor>
+ <property name="BaseURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DocumentElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DocumentType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Implementation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LastLinkedChild">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NameTable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OwnerDocument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PreserveWhitespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlResolver">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Save(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Save(System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="writer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Save(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="filename">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Save(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="outStream">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadNode(System.Xml.XmlReader)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="reader">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LoadXml(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xml">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.Xml.XmlReader)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xmlReader">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.IO.TextReader)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="txtReader">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="filename">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inStream">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ImportNode(System.Xml.XmlNode, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="node">TODO</param>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetElementsByTagName(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetElementsByTagName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetElementById(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="elementId">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateXmlDeclaration(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="version">TODO</param>
+ <param name="encoding">TODO</param>
+ <param name="standalone">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateWhitespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateTextNode(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateSignificantWhitespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateProcessingInstruction(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateNode(System.Xml.XmlNodeType, System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="prefix">TODO</param>
+ <param name="name">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateNode(System.Xml.XmlNodeType, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <param name="name">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateNode(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nodeTypeString">TODO</param>
+ <param name="name">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateEntityReference(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateElement(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateDocumentType(System.String, System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="publicId">TODO</param>
+ <param name="systemId">TODO</param>
+ <param name="internalSubset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateDocumentFragment">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateComment(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateCDataSection(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateAttribute(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="qualifiedName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateElement(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateElement(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="qualifiedName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <event name="NodeChanged">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="NodeChanging">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="NodeInserted">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="NodeInserting">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="NodeRemoved">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="NodeRemoving">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlDocumentFragment.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlDocumentFragment.xml
new file mode 100644
index 00000000000..2bd03f6e8bc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlDocumentFragment.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlDocumentFragment" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="InnerXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OwnerDocument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ParentNode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlDocumentType.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlDocumentType.xml
new file mode 100644
index 00000000000..685ea39d2d4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlDocumentType.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlDocumentType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Entities">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InternalSubset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Notations">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PublicId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SystemId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlElement.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlElement.xml
new file mode 100644
index 00000000000..ee59cd10bdb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlElement.xml
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlElement" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsEmpty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LastLinkedChild">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NamespaceURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NextSibling">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OwnerDocument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Prefix">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SetAttributeNode(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetAttributeNode(System.Xml.XmlAttribute)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetAttribute(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAttributeNode(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAttributeNode(System.Xml.XmlAttribute)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="oldAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAttributeAt(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="i">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAllAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="HasAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="HasAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetElementsByTagName(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetElementsByTagName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttributeNode(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttributeNode(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAll">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlEntity.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlEntity.xml
new file mode 100644
index 00000000000..7bd48c60fe6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlEntity.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlEntity" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="BaseURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NotationName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OuterXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PublicId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SystemId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlEntityReference.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlEntityReference.xml
new file mode 100644
index 00000000000..d56affacbe4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlEntityReference.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlEntityReference" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="BaseURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlException.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlException.xml
new file mode 100644
index 00000000000..a03533f65ef
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlException.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlException" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ <property name="LineNumber">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LinePosition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Message">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlImplementation.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlImplementation.xml
new file mode 100644
index 00000000000..12d216e91d7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlImplementation.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlImplementation" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlImplementation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="CreateDocument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="HasFeature(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strFeature">TODO</param>
+ <param name="strVersion">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlLinkedNode.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlLinkedNode.xml
new file mode 100644
index 00000000000..e64df943276
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlLinkedNode.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlLinkedNode" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="NextSibling">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NextLinkedSibling">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PreviousSibling">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlNameTable.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlNameTable.xml
new file mode 100644
index 00000000000..521983da4e9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlNameTable.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlNameTable" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="Get(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Get(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlNamedNodeMap.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlNamedNodeMap.xml
new file mode 100644
index 00000000000..7f8fad291e1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlNamedNodeMap.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlNamedNodeMap" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetNamedItem(System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="node">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveNamedItem(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveNamedItem(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Item(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNamedItem(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNamedItem(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlNamespaceManager.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlNamespaceManager.xml
new file mode 100644
index 00000000000..60a64db256e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlNamespaceManager.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlNamespaceManager" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlNamespaceManager(System.Xml.XmlNameTable)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nameTable">TODO</param>
+ </constructor>
+ <property name="DefaultNamespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NameTable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveNamespace(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <param name="uri">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="PushScope">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="PopScope">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="LookupPrefix(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="uri">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LookupNamespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="HasNamespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddNamespace(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <param name="uri">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlNode.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlNode.xml
new file mode 100644
index 00000000000..73ee8c06982
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlNode.xml
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlNode" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ChildNodes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FirstChild">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasChildNodes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LastChild">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LastLinkedChild">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NamespaceURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NextSibling">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OuterXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OwnerDocument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ParentNode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Prefix">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PreviousSibling">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CreateNavigator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Supports(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="feature">TODO</param>
+ <param name="version">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SelectSingleNode(System.String, System.Xml.XmlNamespaceManager)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xpath">TODO</param>
+ <param name="nsmgr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SelectSingleNode(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xpath">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SelectNodes(System.String, System.Xml.XmlNamespaceManager)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xpath">TODO</param>
+ <param name="nsmgr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SelectNodes(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xpath">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReplaceChild(System.Xml.XmlNode, System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newChild">TODO</param>
+ <param name="oldChild">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveChild(System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="oldChild">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="RemoveAll">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="PrependChild(System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newChild">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Normalize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="InsertBefore(System.Xml.XmlNode, System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newChild">TODO</param>
+ <param name="refChild">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="InsertAfter(System.Xml.XmlNode, System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newChild">TODO</param>
+ <param name="refChild">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetPrefixOfNamespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNamespaceOfPrefix(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AppendChild(System.Xml.XmlNode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newChild">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedAction.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedAction.xml
new file mode 100644
index 00000000000..0bfc1d4f304
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedAction.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XmlNodeChangedAction" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedEventArgs.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedEventArgs.xml
new file mode 100644
index 00000000000..6637d3894a2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedEventArgs.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlNodeChangedEventArgs" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Action">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Node">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OldParent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NewParent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedEventHandler.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedEventHandler.xml
new file mode 100644
index 00000000000..512c3019cf4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeChangedEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.Xml.XmlNodeChangedEventHandler" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeList.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeList.xml
new file mode 100644
index 00000000000..1aba015739f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeList.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlNodeList" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ItemOf">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Item(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeOrder.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeOrder.xml
new file mode 100644
index 00000000000..84aa3a066d3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeOrder.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XmlNodeOrder" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeType.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeType.xml
new file mode 100644
index 00000000000..868de8f0992
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlNodeType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XmlNodeType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlNotation.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlNotation.xml
new file mode 100644
index 00000000000..01d767cb095
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlNotation.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlNotation" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="InnerXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OuterXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PublicId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SystemId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlParserContext.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlParserContext.xml
new file mode 100644
index 00000000000..57c3782f3a8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlParserContext.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlParserContext" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlParserContext(System.Xml.XmlNameTable, System.Xml.XmlNamespaceManager, System.String, System.Xml.XmlSpace)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nt">TODO</param>
+ <param name="nsMgr">TODO</param>
+ <param name="xmlLang">TODO</param>
+ <param name="xmlSpace">TODO</param>
+ </constructor>
+ <constructor name="XmlParserContext(System.Xml.XmlNameTable, System.Xml.XmlNamespaceManager, System.String, System.Xml.XmlSpace, System.Text.Encoding)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nt">TODO</param>
+ <param name="nsMgr">TODO</param>
+ <param name="xmlLang">TODO</param>
+ <param name="xmlSpace">TODO</param>
+ <param name="enc">TODO</param>
+ </constructor>
+ <constructor name="XmlParserContext(System.Xml.XmlNameTable, System.Xml.XmlNamespaceManager, System.String, System.String, System.String, System.String, System.String, System.String, System.Xml.XmlSpace)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nt">TODO</param>
+ <param name="nsMgr">TODO</param>
+ <param name="docTypeName">TODO</param>
+ <param name="pubId">TODO</param>
+ <param name="sysId">TODO</param>
+ <param name="internalSubset">TODO</param>
+ <param name="baseURI">TODO</param>
+ <param name="xmlLang">TODO</param>
+ <param name="xmlSpace">TODO</param>
+ </constructor>
+ <constructor name="XmlParserContext(System.Xml.XmlNameTable, System.Xml.XmlNamespaceManager, System.String, System.String, System.String, System.String, System.String, System.String, System.Xml.XmlSpace, System.Text.Encoding)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="nt">TODO</param>
+ <param name="nsMgr">TODO</param>
+ <param name="docTypeName">TODO</param>
+ <param name="pubId">TODO</param>
+ <param name="sysId">TODO</param>
+ <param name="internalSubset">TODO</param>
+ <param name="baseURI">TODO</param>
+ <param name="xmlLang">TODO</param>
+ <param name="xmlSpace">TODO</param>
+ <param name="enc">TODO</param>
+ </constructor>
+ <property name="BaseURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DocTypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Encoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InternalSubset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NamespaceManager">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NameTable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PublicId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SystemId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlLang">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlSpace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlProcessingInstruction.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlProcessingInstruction.xml
new file mode 100644
index 00000000000..bb48f448652
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlProcessingInstruction.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlProcessingInstruction" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Data">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="InnerText">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Target">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlQualifiedName.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlQualifiedName.xml
new file mode 100644
index 00000000000..66f584e1bfa
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlQualifiedName.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlQualifiedName" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlQualifiedName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="XmlQualifiedName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <constructor name="XmlQualifiedName(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="ns">TODO</param>
+ </constructor>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="IsEmpty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Namespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="other">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Equality(System.Xml.XmlQualifiedName, System.Xml.XmlQualifiedName)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Inequality(System.Xml.XmlQualifiedName, System.Xml.XmlQualifiedName)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlReader.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlReader.xml
new file mode 100644
index 00000000000..83ea519aabf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlReader.xml
@@ -0,0 +1,298 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlReader" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="AttributeCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CanResolveEntity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Depth">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EOF">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasAttributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsDefault">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsEmptyElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NamespaceURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NameTable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Prefix">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="QuoteChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReadState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlLang">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlSpace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Skip">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ResolveEntity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadStartElement(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadStartElement(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadStartElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadOuterXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadInnerXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadEndElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadElementString(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadElementString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadElementString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadAttributeValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToNextAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToFirstAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToContent">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToAttribute(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="i">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LookupNamespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsStartElement(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsStartElement(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsStartElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttribute(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="i">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsNameToken(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlResolver.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlResolver.xml
new file mode 100644
index 00000000000..065f4b332bb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlResolver.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlResolver" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Credentials">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ResolveUri(System.Uri, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="baseUri">TODO</param>
+ <param name="relativeUri">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEntity(System.Uri, System.String, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="absoluteUri">TODO</param>
+ <param name="role">TODO</param>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlSignificantWhitespace.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlSignificantWhitespace.xml
new file mode 100644
index 00000000000..ef9231ab78d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlSignificantWhitespace.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlSignificantWhitespace" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlSpace.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlSpace.xml
new file mode 100644
index 00000000000..f6f1a9ecdbf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlSpace.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XmlSpace" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlText.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlText.xml
new file mode 100644
index 00000000000..8f0cbb1cda3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlText.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlText" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SplitText(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlTextReader.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlTextReader.xml
new file mode 100644
index 00000000000..e6df4043bfe
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlTextReader.xml
@@ -0,0 +1,349 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlTextReader" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlTextReader(System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ </constructor>
+ <constructor name="XmlTextReader(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="url">TODO</param>
+ </constructor>
+ <constructor name="XmlTextReader(System.IO.TextReader)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ </constructor>
+ <constructor name="XmlTextReader(System.IO.Stream, System.Xml.XmlNameTable)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="nt">TODO</param>
+ </constructor>
+ <constructor name="XmlTextReader(System.String, System.IO.Stream)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="url">TODO</param>
+ <param name="input">TODO</param>
+ </constructor>
+ <constructor name="XmlTextReader(System.String, System.IO.TextReader)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="url">TODO</param>
+ <param name="input">TODO</param>
+ </constructor>
+ <constructor name="XmlTextReader(System.String, System.Xml.XmlNameTable)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="url">TODO</param>
+ <param name="nt">TODO</param>
+ </constructor>
+ <constructor name="XmlTextReader(System.IO.TextReader, System.Xml.XmlNameTable)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="input">TODO</param>
+ <param name="nt">TODO</param>
+ </constructor>
+ <constructor name="XmlTextReader(System.IO.Stream, System.Xml.XmlNodeType, System.Xml.XmlParserContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xmlFragment">TODO</param>
+ <param name="fragType">TODO</param>
+ <param name="context">TODO</param>
+ </constructor>
+ <constructor name="XmlTextReader(System.String, System.IO.Stream, System.Xml.XmlNameTable)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="url">TODO</param>
+ <param name="input">TODO</param>
+ <param name="nt">TODO</param>
+ </constructor>
+ <constructor name="XmlTextReader(System.String, System.IO.TextReader, System.Xml.XmlNameTable)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="url">TODO</param>
+ <param name="input">TODO</param>
+ <param name="nt">TODO</param>
+ </constructor>
+ <constructor name="XmlTextReader(System.String, System.Xml.XmlNodeType, System.Xml.XmlParserContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="xmlFragment">TODO</param>
+ <param name="fragType">TODO</param>
+ <param name="context">TODO</param>
+ </constructor>
+ <property name="AttributeCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Depth">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Encoding">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="EOF">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsDefault">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsEmptyElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LineNumber">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LinePosition">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Namespaces">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NamespaceURI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NameTable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Normalization">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Prefix">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="QuoteChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReadState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="WhitespaceHandling">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlLang">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlResolver">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlSpace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ResolveEntity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadOuterXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadInnerXml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadAttributeValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToNextAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToFirstAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveToAttribute(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="i">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LookupNamespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="namespaceURI">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAttribute(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="i">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetRemainder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadBase64(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadBinHex(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadChars(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ResetState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlTextWriter.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlTextWriter.xml
new file mode 100644
index 00000000000..2689f39d9dd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlTextWriter.xml
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlTextWriter" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlTextWriter(System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ </constructor>
+ <constructor name="XmlTextWriter(System.IO.Stream, System.Text.Encoding)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <param name="encoding">TODO</param>
+ </constructor>
+ <constructor name="XmlTextWriter(System.String, System.Text.Encoding)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="filename">TODO</param>
+ <param name="encoding">TODO</param>
+ </constructor>
+ <property name="BaseStream">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Formatting">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IndentingOverriden">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Indentation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IndentChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Namespaces">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="QuoteChar">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="WriteState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlLang">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlSpace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteWhitespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ws">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteSurrogateCharEntity(System.Char, System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="lowChar">TODO</param>
+ <param name="highChar">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStartElement(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <param name="localName">TODO</param>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStartDocument(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="standalone">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStartDocument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStartAttribute(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <param name="localName">TODO</param>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteRaw(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteRaw(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteQualifiedName(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteProcessingInstruction(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteNmToken(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteFullEndElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteEntityRef(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteEndElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteEndDocument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteEndAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteDocType(System.String, System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="pubid">TODO</param>
+ <param name="sysid">TODO</param>
+ <param name="subset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteComment(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteChars(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteCharEntity(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ch">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteCData(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteBinHex(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteBase64(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LookupPrefix(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlTokenizedType.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlTokenizedType.xml
new file mode 100644
index 00000000000..76aeb7c160c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlTokenizedType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Xml.XmlTokenizedType" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlUrlResolver.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlUrlResolver.xml
new file mode 100644
index 00000000000..bb380274c73
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlUrlResolver.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlUrlResolver" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="XmlUrlResolver">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="Credentials">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ResolveUri(System.Uri, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="baseUri">TODO</param>
+ <param name="relativeUri">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEntity(System.Uri, System.String, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="absoluteUri">TODO</param>
+ <param name="role">TODO</param>
+ <param name="ofObjectToReturn">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlWhitespace.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlWhitespace.xml
new file mode 100644
index 00000000000..c3c4107b96a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlWhitespace.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlWhitespace" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="LocalName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NodeType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteContentTo(System.Xml.XmlWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="w">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CloneNode(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="deep">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System.Xml/XmlWriter.xml b/mcs/docs/apidocs/xml/en/System.Xml/XmlWriter.xml
new file mode 100644
index 00000000000..4123f6b9644
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System.Xml/XmlWriter.xml
@@ -0,0 +1,275 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Xml.XmlWriter" assembly="System.Xml">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="WriteState">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlLang">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="XmlSpace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="WriteWhitespace(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ws">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteSurrogateCharEntity(System.Char, System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="lowChar">TODO</param>
+ <param name="highChar">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStartElement(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <param name="localName">TODO</param>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStartDocument(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="standalone">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStartDocument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStartAttribute(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <param name="localName">TODO</param>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteRaw(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteRaw(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteQualifiedName(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteProcessingInstruction(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteNode(System.Xml.XmlReader, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="reader">TODO</param>
+ <param name="defattr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteNmToken(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteFullEndElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteEntityRef(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteEndElement">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteEndDocument">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteEndAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteDocType(System.String, System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="pubid">TODO</param>
+ <param name="sysid">TODO</param>
+ <param name="subset">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteComment(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteChars(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteCharEntity(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ch">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteCData(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="text">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteBinHex(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteBase64(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteAttributes(System.Xml.XmlReader, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="reader">TODO</param>
+ <param name="defattr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LookupPrefix(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Flush">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Close">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteAttributeString(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteAttributeString(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="ns">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteAttributeString(System.String, System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="prefix">TODO</param>
+ <param name="localName">TODO</param>
+ <param name="ns">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteElementString(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteElementString(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="ns">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStartAttribute(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStartElement(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteStartElement(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="localName">TODO</param>
+ <param name="ns">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/AppDomain.xml b/mcs/docs/apidocs/xml/en/System/AppDomain.xml
new file mode 100644
index 00000000000..f0c153b4190
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/AppDomain.xml
@@ -0,0 +1,426 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.AppDomain" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="SetupInformation">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseDirectory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="RelativeSearchPath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DynamicDirectory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShadowCopyFiles">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FriendlyName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Evidence">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentDomain">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="SetThreadPrincipal(System.Security.Principal.IPrincipal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="principal">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetShadowCopyPath(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetPrincipalPolicy(System.Security.Principal.PrincipalPolicy)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="policy">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetData(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="data">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetCachePath(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetAppDomainPolicy(System.Security.Policy.PolicyLevel)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="domainPolicy">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.Byte[], System.Byte[], System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rawAssembly">TODO</param>
+ <param name="rawSymbolStore">TODO</param>
+ <param name="securityEvidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.String, System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyString">TODO</param>
+ <param name="assemblySecurity">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.Byte[], System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rawAssembly">TODO</param>
+ <param name="rawSymbolStore">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.Reflection.AssemblyName, System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyRef">TODO</param>
+ <param name="assemblySecurity">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyString">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="rawAssembly">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Load(System.Reflection.AssemblyName)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyRef">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetData(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetAssemblies">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ExecuteAssembly(System.String, System.Security.Policy.Evidence, System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyFile">TODO</param>
+ <param name="assemblySecurity">TODO</param>
+ <param name="args">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ExecuteAssembly(System.String, System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyFile">TODO</param>
+ <param name="assemblySecurity">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ExecuteAssembly(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyFile">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DoCallBack(System.CrossAppDomainDelegate)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="theDelegate">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String, System.Security.Policy.Evidence, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="access">TODO</param>
+ <param name="dir">TODO</param>
+ <param name="evidence">TODO</param>
+ <param name="requiredPermissions">TODO</param>
+ <param name="optionalPermissions">TODO</param>
+ <param name="refusedPersmissions">TODO</param>
+ <param name="isSynchronized">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String, System.Security.Policy.Evidence, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="access">TODO</param>
+ <param name="dir">TODO</param>
+ <param name="evidence">TODO</param>
+ <param name="requiredPermissions">TODO</param>
+ <param name="optionalPermissions">TODO</param>
+ <param name="refusedPersmissions">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="access">TODO</param>
+ <param name="dir">TODO</param>
+ <param name="requiredPermissions">TODO</param>
+ <param name="optionalPermissions">TODO</param>
+ <param name="refusedPersmissions">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.Security.Policy.Evidence, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="access">TODO</param>
+ <param name="evidence">TODO</param>
+ <param name="requiredPermissions">TODO</param>
+ <param name="optionalPermissions">TODO</param>
+ <param name="refusedPersmissions">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.Security.PermissionSet, System.Security.PermissionSet, System.Security.PermissionSet)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="access">TODO</param>
+ <param name="requiredPermissions">TODO</param>
+ <param name="optionalPermissions">TODO</param>
+ <param name="refusedPersmissions">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String, System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="access">TODO</param>
+ <param name="dir">TODO</param>
+ <param name="evidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="access">TODO</param>
+ <param name="dir">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess, System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="access">TODO</param>
+ <param name="evidence">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="access">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstanceFrom(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[], System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyName">TODO</param>
+ <param name="typeName">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="args">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="activationAttributes">TODO</param>
+ <param name="securityAttribtutes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstanceFrom(System.String, System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyName">TODO</param>
+ <param name="typeName">TODO</param>
+ <param name="activationAttributes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstanceFrom(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyName">TODO</param>
+ <param name="typeName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstance(System.String, System.String, System.Boolean, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo, System.Object[], System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyName">TODO</param>
+ <param name="typeName">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="args">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="activationAttributes">TODO</param>
+ <param name="securityAttribtutes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstance(System.String, System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyName">TODO</param>
+ <param name="typeName">TODO</param>
+ <param name="activationAttributes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstance(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="assemblyName">TODO</param>
+ <param name="typeName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ClearShadowCopyPath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ClearPrivatePath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="AppendPrivatePath(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="path">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="InitializeLifetimeService">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="other">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateDomain(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="friendlyName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateDomain(System.String, System.Security.Policy.Evidence)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="friendlyName">TODO</param>
+ <param name="securityInfo">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateDomain(System.String, System.Security.Policy.Evidence, System.AppDomainSetup)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="friendlyName">TODO</param>
+ <param name="securityInfo">TODO</param>
+ <param name="info">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateDomain(System.String, System.Security.Policy.Evidence, System.String, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="friendlyName">TODO</param>
+ <param name="securityInfo">TODO</param>
+ <param name="appBasePath">TODO</param>
+ <param name="appRelativeSearchPath">TODO</param>
+ <param name="shadowCopyFiles">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Unload(System.AppDomain)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="domain">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCurrentThreadId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <event name="AssemblyLoad">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="AssemblyResolve">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="DomainUnload">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="ProcessExit">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="ResourceResolve">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="TypeResolve">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ <event name="UnhandledException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <data>TODO</data>
+ </event>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/AppDomainSetup.xml b/mcs/docs/apidocs/xml/en/System/AppDomainSetup.xml
new file mode 100644
index 00000000000..4f5fd4829d2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/AppDomainSetup.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.AppDomainSetup" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AppDomainSetup">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <property name="ApplicationBase">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ApplicationName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CachePath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ConfigurationFile">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DisallowPublisherPolicy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DynamicBase">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LicenseFile">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PrivateBinPath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PrivateBinPathProbe">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShadowCopyDirectories">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ShadowCopyFiles">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/AppDomainUnloadedException.xml b/mcs/docs/apidocs/xml/en/System/AppDomainUnloadedException.xml
new file mode 100644
index 00000000000..42ee2a67875
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/AppDomainUnloadedException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.AppDomainUnloadedException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AppDomainUnloadedException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="AppDomainUnloadedException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="AppDomainUnloadedException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ApplicationException.xml b/mcs/docs/apidocs/xml/en/System/ApplicationException.xml
new file mode 100644
index 00000000000..9a6abc6bebd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ApplicationException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ApplicationException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ApplicationException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ApplicationException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ApplicationException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ArgumentException.xml b/mcs/docs/apidocs/xml/en/System/ArgumentException.xml
new file mode 100644
index 00000000000..461ad043025
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ArgumentException.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ArgumentException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ArgumentException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ArgumentException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ArgumentException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <constructor name="ArgumentException(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="param_name">TODO</param>
+ </constructor>
+ <constructor name="ArgumentException(System.String, System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="param_name">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <property name="ParamName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ArgumentNullException.xml b/mcs/docs/apidocs/xml/en/System/ArgumentNullException.xml
new file mode 100644
index 00000000000..02879fb4751
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ArgumentNullException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ArgumentNullException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ArgumentNullException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ArgumentNullException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="param_name">TODO</param>
+ </constructor>
+ <constructor name="ArgumentNullException(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="param_name">TODO</param>
+ <param name="message">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ArgumentOutOfRangeException.xml b/mcs/docs/apidocs/xml/en/System/ArgumentOutOfRangeException.xml
new file mode 100644
index 00000000000..448920d228a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ArgumentOutOfRangeException.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ArgumentOutOfRangeException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ArgumentOutOfRangeException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ArgumentOutOfRangeException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="param_name">TODO</param>
+ </constructor>
+ <constructor name="ArgumentOutOfRangeException(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="param_name">TODO</param>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ArgumentOutOfRangeException(System.String, System.Object, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="param_name">TODO</param>
+ <param name="actual_value">TODO</param>
+ <param name="message">TODO</param>
+ </constructor>
+ <property name="ActualValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ArithmeticException.xml b/mcs/docs/apidocs/xml/en/System/ArithmeticException.xml
new file mode 100644
index 00000000000..689a582a9f3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ArithmeticException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ArithmeticException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ArithmeticException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ArithmeticException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ArithmeticException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Array.xml b/mcs/docs/apidocs/xml/en/System/Array.xml
new file mode 100644
index 00000000000..bea80e8505e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Array.xml
@@ -0,0 +1,366 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Array" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Rank">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Item">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Count">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSynchronized">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SyncRoot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFixedSize">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsReadOnly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLength(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dimension">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLowerBound(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dimension">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue(System.Int32[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="idxs">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetValue(System.Object, System.Int32[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="idxs">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetUpperBound(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dimension">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="idx">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="idx1">TODO</param>
+ <param name="idx2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetValue(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="idx1">TODO</param>
+ <param name="idx2">TODO</param>
+ <param name="idx3">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetValue(System.Object, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="idx">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetValue(System.Object, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="idx1">TODO</param>
+ <param name="idx2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetValue(System.Object, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="idx1">TODO</param>
+ <param name="idx2">TODO</param>
+ <param name="idx3">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstance(System.Type, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="elementType">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstance(System.Type, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="elementType">TODO</param>
+ <param name="l1">TODO</param>
+ <param name="l2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstance(System.Type, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="elementType">TODO</param>
+ <param name="l1">TODO</param>
+ <param name="l2">TODO</param>
+ <param name="l3">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstance(System.Type, System.Int32[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="elementType">TODO</param>
+ <param name="lengths">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateInstance(System.Type, System.Int32[], System.Int32[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="elementType">TODO</param>
+ <param name="lengths">TODO</param>
+ <param name="bounds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BinarySearch(System.Array, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BinarySearch(System.Array, System.Object, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="value">TODO</param>
+ <param name="comparer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BinarySearch(System.Array, System.Int32, System.Int32, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <param name="length">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BinarySearch(System.Array, System.Int32, System.Int32, System.Object, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <param name="length">TODO</param>
+ <param name="value">TODO</param>
+ <param name="comparer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clear(System.Array, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy(System.Array, System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="source">TODO</param>
+ <param name="dest">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy(System.Array, System.Int32, System.Array, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="source">TODO</param>
+ <param name="source_idx">TODO</param>
+ <param name="dest">TODO</param>
+ <param name="dest_idx">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Array, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Array, System.Object, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="value">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Array, System.Object, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="value">TODO</param>
+ <param name="index">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.Array, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.Array, System.Object, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="value">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.Array, System.Object, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="value">TODO</param>
+ <param name="index">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Reverse(System.Array)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Reverse(System.Array, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sort(System.Array)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sort(System.Array, System.Array)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="keys">TODO</param>
+ <param name="items">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sort(System.Array, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="comparer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sort(System.Array, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sort(System.Array, System.Array, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="keys">TODO</param>
+ <param name="items">TODO</param>
+ <param name="comparer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sort(System.Array, System.Array, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="keys">TODO</param>
+ <param name="items">TODO</param>
+ <param name="index">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sort(System.Array, System.Int32, System.Int32, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <param name="length">TODO</param>
+ <param name="comparer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sort(System.Array, System.Array, System.Int32, System.Int32, System.Collections.IComparer)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="keys">TODO</param>
+ <param name="items">TODO</param>
+ <param name="index">TODO</param>
+ <param name="length">TODO</param>
+ <param name="comparer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ArrayTypeMismatchException.xml b/mcs/docs/apidocs/xml/en/System/ArrayTypeMismatchException.xml
new file mode 100644
index 00000000000..e600fab3934
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ArrayTypeMismatchException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ArrayTypeMismatchException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ArrayTypeMismatchException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ArrayTypeMismatchException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ArrayTypeMismatchException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/AssemblyLoadEventArgs.xml b/mcs/docs/apidocs/xml/en/System/AssemblyLoadEventArgs.xml
new file mode 100644
index 00000000000..1f160d15332
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/AssemblyLoadEventArgs.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.AssemblyLoadEventArgs" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AssemblyLoadEventArgs(System.Reflection.Assembly)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="loadedAssembly">TODO</param>
+ </constructor>
+ <property name="LoadedAssembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/AssemblyLoadEventHandler.xml b/mcs/docs/apidocs/xml/en/System/AssemblyLoadEventHandler.xml
new file mode 100644
index 00000000000..1ebbcbc3366
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/AssemblyLoadEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.AssemblyLoadEventHandler" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/AsyncCallback.xml b/mcs/docs/apidocs/xml/en/System/AsyncCallback.xml
new file mode 100644
index 00000000000..83060a95222
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/AsyncCallback.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.AsyncCallback" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Attribute.xml b/mcs/docs/apidocs/xml/en/System/Attribute.xml
new file mode 100644
index 00000000000..21c038a86a0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Attribute.xml
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Attribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="TypeId">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Match(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefaultAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttribute(System.Reflection.MemberInfo, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttribute(System.Reflection.Assembly, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttribute(System.Reflection.Module, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.Assembly)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.ParameterInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.MemberInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.Module)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.Assembly, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.Module, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.MemberInfo, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.Module, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.Assembly, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Reflection.Module, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Reflection.ParameterInfo, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Reflection.MemberInfo, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Reflection.Assembly, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Reflection.Module, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="element">TODO</param>
+ <param name="attribute_type">TODO</param>
+ <param name="inherit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/AttributeTargets.xml b/mcs/docs/apidocs/xml/en/System/AttributeTargets.xml
new file mode 100644
index 00000000000..c335b966a0f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/AttributeTargets.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.AttributeTargets" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/AttributeUsageAttribute.xml b/mcs/docs/apidocs/xml/en/System/AttributeUsageAttribute.xml
new file mode 100644
index 00000000000..ff002391a3e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/AttributeUsageAttribute.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.AttributeUsageAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="AttributeUsageAttribute(System.AttributeTargets)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="validOn">TODO</param>
+ </constructor>
+ <property name="AllowMultiple">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Inherited">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ValidOn">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/BadImageFormatException.xml b/mcs/docs/apidocs/xml/en/System/BadImageFormatException.xml
new file mode 100644
index 00000000000..469d739ef56
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/BadImageFormatException.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.BadImageFormatException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="BadImageFormatException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="BadImageFormatException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="BadImageFormatException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <constructor name="BadImageFormatException(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="fileName">TODO</param>
+ </constructor>
+ <constructor name="BadImageFormatException(System.String, System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="fileName">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <property name="Message">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FileName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FusionLog">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/BitConverter.xml b/mcs/docs/apidocs/xml/en/System/BitConverter.xml
new file mode 100644
index 00000000000..6815a7f37af
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/BitConverter.xml
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.BitConverter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="IsLittleEndian">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="DoubleToInt64Bits(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Int64BitsToDouble(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBytes(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Byte[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="start_index">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Boolean.xml b/mcs/docs/apidocs/xml/en/System/Boolean.xml
new file mode 100644
index 00000000000..3342c26b09a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Boolean.xml
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Boolean" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="FalseString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="TrueString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Buffer.xml b/mcs/docs/apidocs/xml/en/System/Buffer.xml
new file mode 100644
index 00000000000..36a69613977
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Buffer.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Buffer" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="ByteLength(System.Array)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetByte(System.Array, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetByte(System.Array, System.Int32, System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="array">TODO</param>
+ <param name="index">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="BlockCopy(System.Array, System.Int32, System.Array, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="src">TODO</param>
+ <param name="src_offset">TODO</param>
+ <param name="dest">TODO</param>
+ <param name="dest_offset">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Byte.xml b/mcs/docs/apidocs/xml/en/System/Byte.xml
new file mode 100644
index 00000000000..1d2dfd6b9b6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Byte.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Byte" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/CLSCompliantAttribute.xml b/mcs/docs/apidocs/xml/en/System/CLSCompliantAttribute.xml
new file mode 100644
index 00000000000..128f73c1122
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/CLSCompliantAttribute.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CLSCompliantAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CLSCompliantAttribute(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="is_compliant">TODO</param>
+ </constructor>
+ <property name="IsCompliant">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/CannotUnloadAppDomainException.xml b/mcs/docs/apidocs/xml/en/System/CannotUnloadAppDomainException.xml
new file mode 100644
index 00000000000..3980908e9e8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/CannotUnloadAppDomainException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CannotUnloadAppDomainException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="CannotUnloadAppDomainException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="CannotUnloadAppDomainException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="CannotUnloadAppDomainException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Char.xml b/mcs/docs/apidocs/xml/en/System/Char.xml
new file mode 100644
index 00000000000..07aed173f66
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Char.xml
@@ -0,0 +1,344 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Char" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNumericValue(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNumericValue(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetUnicodeCategory(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetUnicodeCategory(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsControl(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsControl(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDigit(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDigit(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLetter(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLetter(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLetterOrDigit(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLetterOrDigit(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLower(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLower(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsNumber(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsNumber(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsPunctuation(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsPunctuation(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSeparator(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSeparator(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSurrogate(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSurrogate(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSymbol(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSymbol(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsUpper(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsUpper(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsWhiteSpace(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsWhiteSpace(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToLower(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUpper(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/CharEnumerator.xml b/mcs/docs/apidocs/xml/en/System/CharEnumerator.xml
new file mode 100644
index 00000000000..ce2e96fe447
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/CharEnumerator.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.CharEnumerator" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Current">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Reset">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="MoveNext">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Console.xml b/mcs/docs/apidocs/xml/en/System/Console.xml
new file mode 100644
index 00000000000..06f7edf2522
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Console.xml
@@ -0,0 +1,311 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Console" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Error">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Out">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="In">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="OpenStandardError">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="OpenStandardError(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bufferSize">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="OpenStandardInput">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="OpenStandardInput(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bufferSize">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="OpenStandardOutput">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="OpenStandardOutput(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bufferSize">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetError(System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newError">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetIn(System.IO.TextReader)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newIn">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="SetOut(System.IO.TextWriter)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newOut">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Write(System.String, System.Object, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <param name="arg2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <param name="index">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="WriteLine(System.String, System.Object, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <param name="arg2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Read">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ReadLine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ContextBoundObject.xml b/mcs/docs/apidocs/xml/en/System/ContextBoundObject.xml
new file mode 100644
index 00000000000..ae31dd241e0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ContextBoundObject.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ContextBoundObject" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ContextMarshalException.xml b/mcs/docs/apidocs/xml/en/System/ContextMarshalException.xml
new file mode 100644
index 00000000000..58da7a376ec
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ContextMarshalException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ContextMarshalException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ContextMarshalException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ContextMarshalException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ContextMarshalException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ContextStaticAttribute.xml b/mcs/docs/apidocs/xml/en/System/ContextStaticAttribute.xml
new file mode 100644
index 00000000000..79890c0323b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ContextStaticAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ContextStaticAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ContextStaticAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Convert.xml b/mcs/docs/apidocs/xml/en/System/Convert.xml
new file mode 100644
index 00000000000..5eb24ebab39
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Convert.xml
@@ -0,0 +1,1924 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Convert" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="DBNull">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="FromBase64CharArray(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inArray">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromBase64String(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDBNull(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBase64CharArray(System.Byte[], System.Int32, System.Int32, System.Char[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inArray">TODO</param>
+ <param name="offsetIn">TODO</param>
+ <param name="length">TODO</param>
+ <param name="outArray">TODO</param>
+ <param name="offsetOut">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBase64String(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inArray">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBase64String(System.Byte[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="inArray">TODO</param>
+ <param name="offset">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="fromBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="fromBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="fromBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="fromBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="fromBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Boolean, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Byte, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Byte, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="toBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Char, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.DateTime, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Decimal, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Double, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Single, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="fromBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Int32, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Int64, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="fromBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Int64, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.SByte, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Int16, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="fromBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Int16, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.UInt32, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.UInt64, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.UInt16, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="fromBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="fromBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="fromBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64(System.Object, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ChangeType(System.Object, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="conversionType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ChangeType(System.Object, System.TypeCode)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="typeCode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ChangeType(System.Object, System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ChangeType(System.Object, System.TypeCode, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="typeCode">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/CrossAppDomainDelegate.xml b/mcs/docs/apidocs/xml/en/System/CrossAppDomainDelegate.xml
new file mode 100644
index 00000000000..25680b2a6e7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/CrossAppDomainDelegate.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.CrossAppDomainDelegate" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/DBNull.xml b/mcs/docs/apidocs/xml/en/System/DBNull.xml
new file mode 100644
index 00000000000..b1f576b9e77
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/DBNull.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.DBNull" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/DateTime.xml b/mcs/docs/apidocs/xml/en/System/DateTime.xml
new file mode 100644
index 00000000000..68f23aa5f60
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/DateTime.xml
@@ -0,0 +1,565 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.DateTime" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DateTime(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="newticks">TODO</param>
+ </constructor>
+ <constructor name="DateTime(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ </constructor>
+ <constructor name="DateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ </constructor>
+ <constructor name="DateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="millisecond">TODO</param>
+ </constructor>
+ <constructor name="DateTime(System.Int32, System.Int32, System.Int32, System.Globalization.Calendar)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="calendar">TODO</param>
+ </constructor>
+ <constructor name="DateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Globalization.Calendar)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="calendar">TODO</param>
+ </constructor>
+ <constructor name="DateTime(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Int32, System.Globalization.Calendar)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <param name="day">TODO</param>
+ <param name="hour">TODO</param>
+ <param name="minute">TODO</param>
+ <param name="second">TODO</param>
+ <param name="millisecond">TODO</param>
+ <param name="calendar">TODO</param>
+ </constructor>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Date">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Month">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Day">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DayOfWeek">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DayOfYear">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TimeOfDay">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Hour">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Minute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Second">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Millisecond">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Now">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Ticks">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Today">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UtcNow">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Year">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ts">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddDays(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="days">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddTicks(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddHours(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hours">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMilliseconds(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ms">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMinutes(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="minutes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddMonths(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="months">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddSeconds(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="seconds">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="AddYears(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="years">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Compare(System.DateTime, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="DaysInMonth(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <param name="month">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.DateTime, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromFileTime(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fileTime">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromOADate(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDateTimeFormats">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDateTimeFormats(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDateTimeFormats(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDateTimeFormats(System.Char, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsLeapYear(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider, System.Globalization.DateTimeStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <param name="styles">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ParseExact(System.String, System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ParseExact(System.String, System.String, System.IFormatProvider, System.Globalization.DateTimeStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ParseExact(System.String, System.String[], System.IFormatProvider, System.Globalization.DateTimeStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="formats">TODO</param>
+ <param name="fp">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Subtract(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="dt">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Subtract(System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ts">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToFileTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToLongDateString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToLongTimeString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToOADate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToShortDateString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToShortTimeString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToLocalTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUniversalTime">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Addition(System.DateTime, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <param name="t">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Equality(System.DateTime, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_GreaterThan(System.DateTime, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_GreaterThanOrEqual(System.DateTime, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Inequality(System.DateTime, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_LessThan(System.DateTime, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_LessThanOrEqual(System.DateTime, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Subtraction(System.DateTime, System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Subtraction(System.DateTime, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <param name="t">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/DayOfWeek.xml b/mcs/docs/apidocs/xml/en/System/DayOfWeek.xml
new file mode 100644
index 00000000000..2369ad409e0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/DayOfWeek.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.DayOfWeek" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Decimal.xml b/mcs/docs/apidocs/xml/en/System/Decimal.xml
new file mode 100644
index 00000000000..a7d26f86a0f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Decimal.xml
@@ -0,0 +1,454 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Decimal" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Decimal(System.Int32, System.Int32, System.Int32, System.Boolean, System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="lo">TODO</param>
+ <param name="mid">TODO</param>
+ <param name="hi">TODO</param>
+ <param name="isNegative">TODO</param>
+ <param name="scale">TODO</param>
+ </constructor>
+ <constructor name="Decimal(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ </constructor>
+ <constructor name="Decimal(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ </constructor>
+ <constructor name="Decimal(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ </constructor>
+ <constructor name="Decimal(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="uval">TODO</param>
+ </constructor>
+ <constructor name="Decimal(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ </constructor>
+ <constructor name="Decimal(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ </constructor>
+ <constructor name="Decimal(System.Int32[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bits">TODO</param>
+ </constructor>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinusOne">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="One">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Zero">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetBits(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Negate(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Subtract(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Floor(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Truncate(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Round(System.Decimal, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <param name="decimals">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Multiply(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Divide(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remainder(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Compare(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Addition(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Decrement(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Increment(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Subtraction(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_UnaryNegation(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_UnaryPlus(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Multiply(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Division(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Modulus(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Implicit(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Implicit(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Implicit(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Implicit(System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Implicit(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Implicit(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Implicit(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Implicit(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Implicit(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Inequality(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Equality(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_GreaterThan(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_GreaterThanOrEqual(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_LessThan(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_LessThanOrEqual(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d1">TODO</param>
+ <param name="d2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/DivideByZeroException.xml b/mcs/docs/apidocs/xml/en/System/DivideByZeroException.xml
new file mode 100644
index 00000000000..29ae2214d0a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/DivideByZeroException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.DivideByZeroException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DivideByZeroException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="DivideByZeroException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="DivideByZeroException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/DllNotFoundException.xml b/mcs/docs/apidocs/xml/en/System/DllNotFoundException.xml
new file mode 100644
index 00000000000..fe5466feaae
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/DllNotFoundException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.DllNotFoundException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DllNotFoundException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="DllNotFoundException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="DllNotFoundException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Double.xml b/mcs/docs/apidocs/xml/en/System/Double.xml
new file mode 100644
index 00000000000..c48866e507d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Double.xml
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Double" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Epsilon">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="NaN">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="NegativeInfinity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="PositiveInfinity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsInfinity(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsNaN(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsNegativeInfinity(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsPositiveInfinity(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/DuplicateWaitObjectException.xml b/mcs/docs/apidocs/xml/en/System/DuplicateWaitObjectException.xml
new file mode 100644
index 00000000000..48ce9f3dc12
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/DuplicateWaitObjectException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.DuplicateWaitObjectException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="DuplicateWaitObjectException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="DuplicateWaitObjectException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="param_name">TODO</param>
+ </constructor>
+ <constructor name="DuplicateWaitObjectException(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="param_name">TODO</param>
+ <param name="message">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/EntryPointNotFoundException.xml b/mcs/docs/apidocs/xml/en/System/EntryPointNotFoundException.xml
new file mode 100644
index 00000000000..4eb1fc85173
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/EntryPointNotFoundException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.EntryPointNotFoundException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="EntryPointNotFoundException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="EntryPointNotFoundException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="EntryPointNotFoundException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Environment.xml b/mcs/docs/apidocs/xml/en/System/Environment.xml
new file mode 100644
index 00000000000..7f73d9e4b36
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Environment.xml
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Environment" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="CommandLine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="CurrentDirectory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ExitCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MachineName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="NewLine">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="OSVersion">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="StackTrace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="SystemDirectory">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TickCount">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UserDomainName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UserInteractive">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UserName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Version">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="WorkingSet">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Exit(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="exitCode">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ExpandEnvironmentVariables(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetCommandLineArgs">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnvironmentVariable(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnvironmentVariables">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFolderPath(System.Environment.SpecialFolder)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="folder">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLogicalDrives">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/EventArgs.xml b/mcs/docs/apidocs/xml/en/System/EventArgs.xml
new file mode 100644
index 00000000000..8ce6c56729f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/EventArgs.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.EventArgs" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="EventArgs">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/EventHandler.xml b/mcs/docs/apidocs/xml/en/System/EventHandler.xml
new file mode 100644
index 00000000000..d8fa6f11845
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/EventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.EventHandler" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ExecutionEngineException.xml b/mcs/docs/apidocs/xml/en/System/ExecutionEngineException.xml
new file mode 100644
index 00000000000..29f31398fbb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ExecutionEngineException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ExecutionEngineException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ExecutionEngineException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ExecutionEngineException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ExecutionEngineException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/FieldAccessException.xml b/mcs/docs/apidocs/xml/en/System/FieldAccessException.xml
new file mode 100644
index 00000000000..e66e2839461
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/FieldAccessException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.FieldAccessException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FieldAccessException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="FieldAccessException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="FieldAccessException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/FlagsAttribute.xml b/mcs/docs/apidocs/xml/en/System/FlagsAttribute.xml
new file mode 100644
index 00000000000..0a56c423023
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/FlagsAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.FlagsAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FlagsAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/FormatException.xml b/mcs/docs/apidocs/xml/en/System/FormatException.xml
new file mode 100644
index 00000000000..31abaf59d68
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/FormatException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.FormatException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="FormatException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="FormatException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="FormatException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/GC.xml b/mcs/docs/apidocs/xml/en/System/GC.xml
new file mode 100644
index 00000000000..dededd93f08
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/GC.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.GC" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="SuppressFinalize(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Guid.xml b/mcs/docs/apidocs/xml/en/System/Guid.xml
new file mode 100644
index 00000000000..a5236a8de70
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Guid.xml
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Guid" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Guid(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="b">TODO</param>
+ </constructor>
+ <constructor name="Guid(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="g">TODO</param>
+ </constructor>
+ <constructor name="Guid(System.Int32, System.Int16, System.Int16, System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <param name="c">TODO</param>
+ <param name="d">TODO</param>
+ </constructor>
+ <constructor name="Guid(System.Int32, System.Int16, System.Int16, System.Byte, System.Byte, System.Byte, System.Byte, System.Byte, System.Byte, System.Byte, System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <param name="c">TODO</param>
+ <param name="d">TODO</param>
+ <param name="e">TODO</param>
+ <param name="f">TODO</param>
+ <param name="g">TODO</param>
+ <param name="h">TODO</param>
+ <param name="i">TODO</param>
+ <param name="j">TODO</param>
+ <param name="k">TODO</param>
+ </constructor>
+ <constructor name="Guid(System.UInt32, System.UInt16, System.UInt16, System.Byte, System.Byte, System.Byte, System.Byte, System.Byte, System.Byte, System.Byte, System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <param name="c">TODO</param>
+ <param name="d">TODO</param>
+ <param name="e">TODO</param>
+ <param name="f">TODO</param>
+ <param name="g">TODO</param>
+ <param name="h">TODO</param>
+ <param name="i">TODO</param>
+ <param name="j">TODO</param>
+ <param name="k">TODO</param>
+ </constructor>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="NewGuid">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByteArray">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Equality(System.Guid, System.Guid)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Inequality(System.Guid, System.Guid)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/IAppDomainSetup.xml b/mcs/docs/apidocs/xml/en/System/IAppDomainSetup.xml
new file mode 100644
index 00000000000..e66a4e5bebd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/IAppDomainSetup.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.IAppDomainSetup" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/IAsyncResult.xml b/mcs/docs/apidocs/xml/en/System/IAsyncResult.xml
new file mode 100644
index 00000000000..a5148f5f87c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/IAsyncResult.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.IAsyncResult" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ICloneable.xml b/mcs/docs/apidocs/xml/en/System/ICloneable.xml
new file mode 100644
index 00000000000..239dd98c16e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ICloneable.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.ICloneable" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/IComparable.xml b/mcs/docs/apidocs/xml/en/System/IComparable.xml
new file mode 100644
index 00000000000..b760c09b67e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/IComparable.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.IComparable" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/IConvertible.xml b/mcs/docs/apidocs/xml/en/System/IConvertible.xml
new file mode 100644
index 00000000000..a2474443c8b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/IConvertible.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.IConvertible" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/IDisposable.xml b/mcs/docs/apidocs/xml/en/System/IDisposable.xml
new file mode 100644
index 00000000000..64f187f3167
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/IDisposable.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.IDisposable" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/IFormatProvider.xml b/mcs/docs/apidocs/xml/en/System/IFormatProvider.xml
new file mode 100644
index 00000000000..4e38edf58d3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/IFormatProvider.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.IFormatProvider" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/IFormattable.xml b/mcs/docs/apidocs/xml/en/System/IFormattable.xml
new file mode 100644
index 00000000000..a4b63678a42
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/IFormattable.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.IFormattable" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/IServiceProvider.xml b/mcs/docs/apidocs/xml/en/System/IServiceProvider.xml
new file mode 100644
index 00000000000..dd49f1a5256
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/IServiceProvider.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System.IServiceProvider" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/IndexOutOfRangeException.xml b/mcs/docs/apidocs/xml/en/System/IndexOutOfRangeException.xml
new file mode 100644
index 00000000000..d99b0ffdfc2
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/IndexOutOfRangeException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IndexOutOfRangeException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IndexOutOfRangeException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="IndexOutOfRangeException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="IndexOutOfRangeException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Int16.xml b/mcs/docs/apidocs/xml/en/System/Int16.xml
new file mode 100644
index 00000000000..a77115e18da
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Int16.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Int16" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Int32.xml b/mcs/docs/apidocs/xml/en/System/Int32.xml
new file mode 100644
index 00000000000..5b1a4cf7862
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Int32.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Int32" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Int64.xml b/mcs/docs/apidocs/xml/en/System/Int64.xml
new file mode 100644
index 00000000000..4b41733dd52
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Int64.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Int64" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/IntPtr.xml b/mcs/docs/apidocs/xml/en/System/IntPtr.xml
new file mode 100644
index 00000000000..b28512927c6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/IntPtr.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.IntPtr" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IntPtr(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="i32">TODO</param>
+ </constructor>
+ <constructor name="IntPtr(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="i64">TODO</param>
+ </constructor>
+ <constructor name="IntPtr(System.Void*)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ptr">TODO</param>
+ </constructor>
+ <field name="Zero">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Size">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="si">TODO</param>
+ <param name="sc">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToPointer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Equality(System.IntPtr, System.IntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Inequality(System.IntPtr, System.IntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Void*)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.IntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.IntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.IntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/IntegerFormatter.xml b/mcs/docs/apidocs/xml/en/System/IntegerFormatter.xml
new file mode 100644
index 00000000000..57fa716d366
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/IntegerFormatter.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.IntegerFormatter" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="IntegerFormatter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <method name="NumberToString(System.String, System.Globalization.NumberFormatInfo, System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="nfi">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="NumberToString(System.String, System.Globalization.NumberFormatInfo, System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="nfi">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="NumberToString(System.String, System.Globalization.NumberFormatInfo, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="nfi">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="NumberToString(System.String, System.Globalization.NumberFormatInfo, System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="nfi">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="NumberToString(System.String, System.Globalization.NumberFormatInfo, System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="nfi">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="NumberToString(System.String, System.Globalization.NumberFormatInfo, System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="nfi">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="NumberToString(System.String, System.Globalization.NumberFormatInfo, System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="nfi">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="NumberToString(System.String, System.Globalization.NumberFormatInfo, System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="nfi">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/InvalidCastException.xml b/mcs/docs/apidocs/xml/en/System/InvalidCastException.xml
new file mode 100644
index 00000000000..5fc51c4dc84
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/InvalidCastException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.InvalidCastException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="InvalidCastException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="InvalidCastException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="InvalidCastException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/InvalidOperationException.xml b/mcs/docs/apidocs/xml/en/System/InvalidOperationException.xml
new file mode 100644
index 00000000000..aeb66fe35aa
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/InvalidOperationException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.InvalidOperationException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="InvalidOperationException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="InvalidOperationException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="InvalidOperationException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/InvalidProgramException.xml b/mcs/docs/apidocs/xml/en/System/InvalidProgramException.xml
new file mode 100644
index 00000000000..29bbfb054f0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/InvalidProgramException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.InvalidProgramException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="InvalidProgramException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="InvalidProgramException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="InvalidProgramException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/LoaderOptimization.xml b/mcs/docs/apidocs/xml/en/System/LoaderOptimization.xml
new file mode 100644
index 00000000000..72bd0496a13
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/LoaderOptimization.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.LoaderOptimization" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/LoaderOptimizationAttribute.xml b/mcs/docs/apidocs/xml/en/System/LoaderOptimizationAttribute.xml
new file mode 100644
index 00000000000..17bef7724ac
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/LoaderOptimizationAttribute.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.LoaderOptimizationAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="LoaderOptimizationAttribute(System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="LoaderOptimizationAttribute(System.LoaderOptimization)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/LocalDataStoreSlot.xml b/mcs/docs/apidocs/xml/en/System/LocalDataStoreSlot.xml
new file mode 100644
index 00000000000..7c8d7ca3268
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/LocalDataStoreSlot.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.LocalDataStoreSlot" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="LocalDataStoreSlot">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/MTAThreadAttribute.xml b/mcs/docs/apidocs/xml/en/System/MTAThreadAttribute.xml
new file mode 100644
index 00000000000..1f515ee74aa
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/MTAThreadAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.MTAThreadAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MTAThreadAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/MarshalByRefObject.xml b/mcs/docs/apidocs/xml/en/System/MarshalByRefObject.xml
new file mode 100644
index 00000000000..2e0885081ee
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/MarshalByRefObject.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.MarshalByRefObject" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <method name="InitializeLifetimeService">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLifetimeService">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CreateObjRef(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Math.xml b/mcs/docs/apidocs/xml/en/System/Math.xml
new file mode 100644
index 00000000000..4dc60f68739
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Math.xml
@@ -0,0 +1,398 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Math" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="E">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="PI">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="Abs(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Abs(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Abs(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Abs(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Abs(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Abs(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Abs(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Ceiling(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Floor(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IEEERemainder(System.Double, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <param name="y">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Log(System.Double, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="newBase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Max(System.Byte, System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Max(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Max(System.Double, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Max(System.Single, System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Max(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Max(System.Int64, System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Max(System.SByte, System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Max(System.Int16, System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Max(System.UInt32, System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Max(System.UInt64, System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Max(System.UInt16, System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Min(System.Byte, System.Byte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Min(System.Decimal, System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Min(System.Double, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Min(System.Single, System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Min(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Min(System.Int64, System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Min(System.SByte, System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Min(System.Int16, System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Min(System.UInt32, System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Min(System.UInt64, System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Min(System.UInt16, System.UInt16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="val1">TODO</param>
+ <param name="val2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Round(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Round(System.Decimal, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <param name="decimals">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Round(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="d">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Round(System.Double, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="digits">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sign(System.Decimal)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sign(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sign(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sign(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sign(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sign(System.SByte)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sign(System.Int16)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sin(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Cos(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Tan(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sinh(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Cosh(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Tanh(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Acos(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Asin(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Atan(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Atan2(System.Double, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="y">TODO</param>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Exp(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Log(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Log10(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Pow(System.Double, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <param name="y">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Sqrt(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="x">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/MemberAccessException.xml b/mcs/docs/apidocs/xml/en/System/MemberAccessException.xml
new file mode 100644
index 00000000000..eac96a1ae5a
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/MemberAccessException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.MemberAccessException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MemberAccessException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="MemberAccessException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="MemberAccessException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/MethodAccessException.xml b/mcs/docs/apidocs/xml/en/System/MethodAccessException.xml
new file mode 100644
index 00000000000..c68a27b1510
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/MethodAccessException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.MethodAccessException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MethodAccessException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="MethodAccessException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="MethodAccessException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/MissingFieldException.xml b/mcs/docs/apidocs/xml/en/System/MissingFieldException.xml
new file mode 100644
index 00000000000..30f98adcd08
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/MissingFieldException.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.MissingFieldException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MissingFieldException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="MissingFieldException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="MissingFieldException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ <constructor name="MissingFieldException(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="className">TODO</param>
+ <param name="fieldName">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/MissingMemberException.xml b/mcs/docs/apidocs/xml/en/System/MissingMemberException.xml
new file mode 100644
index 00000000000..7825779d182
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/MissingMemberException.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.MissingMemberException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MissingMemberException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="MissingMemberException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="MissingMemberException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <constructor name="MissingMemberException(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="className">TODO</param>
+ <param name="memberName">TODO</param>
+ </constructor>
+ <property name="Message">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/MissingMethodException.xml b/mcs/docs/apidocs/xml/en/System/MissingMethodException.xml
new file mode 100644
index 00000000000..06c0ff131dc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/MissingMethodException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.MissingMethodException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MissingMethodException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="MissingMethodException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="MissingMethodException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/MonoDummy.xml b/mcs/docs/apidocs/xml/en/System/MonoDummy.xml
new file mode 100644
index 00000000000..9647a380b5f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/MonoDummy.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.MonoDummy" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MonoDummy">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/MonoTODOAttribute.xml b/mcs/docs/apidocs/xml/en/System/MonoTODOAttribute.xml
new file mode 100644
index 00000000000..1134d19bfcb
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/MonoTODOAttribute.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.MonoTODOAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MonoTODOAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="MonoTODOAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="comment">TODO</param>
+ </constructor>
+ <property name="Comment">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/MulticastNotSupportedException.xml b/mcs/docs/apidocs/xml/en/System/MulticastNotSupportedException.xml
new file mode 100644
index 00000000000..88a50bdfecf
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/MulticastNotSupportedException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.MulticastNotSupportedException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="MulticastNotSupportedException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="MulticastNotSupportedException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="MulticastNotSupportedException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/NonSerializedAttribute.xml b/mcs/docs/apidocs/xml/en/System/NonSerializedAttribute.xml
new file mode 100644
index 00000000000..517d471da5d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/NonSerializedAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.NonSerializedAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NonSerializedAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/NotFiniteNumberException.xml b/mcs/docs/apidocs/xml/en/System/NotFiniteNumberException.xml
new file mode 100644
index 00000000000..0dca3b530e7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/NotFiniteNumberException.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.NotFiniteNumberException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NotFiniteNumberException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="NotFiniteNumberException(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="offending_number">TODO</param>
+ </constructor>
+ <constructor name="NotFiniteNumberException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="NotFiniteNumberException(System.String, System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="offending_number">TODO</param>
+ </constructor>
+ <constructor name="NotFiniteNumberException(System.String, System.Double, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="offending_number">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <property name="OffendingNumber">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/NotImplementedException.xml b/mcs/docs/apidocs/xml/en/System/NotImplementedException.xml
new file mode 100644
index 00000000000..0f2773339c8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/NotImplementedException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.NotImplementedException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NotImplementedException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="NotImplementedException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="NotImplementedException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/NotSupportedException.xml b/mcs/docs/apidocs/xml/en/System/NotSupportedException.xml
new file mode 100644
index 00000000000..3f6f972dab9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/NotSupportedException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.NotSupportedException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NotSupportedException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="NotSupportedException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="NotSupportedException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/NullReferenceException.xml b/mcs/docs/apidocs/xml/en/System/NullReferenceException.xml
new file mode 100644
index 00000000000..1d0540b28ba
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/NullReferenceException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.NullReferenceException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="NullReferenceException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="NullReferenceException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="NullReferenceException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ObjectDisposedException.xml b/mcs/docs/apidocs/xml/en/System/ObjectDisposedException.xml
new file mode 100644
index 00000000000..05db743f2b4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ObjectDisposedException.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ObjectDisposedException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ObjectDisposedException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objectName">TODO</param>
+ </constructor>
+ <constructor name="ObjectDisposedException(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="objectName">TODO</param>
+ <param name="message">TODO</param>
+ </constructor>
+ <property name="Message">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ObjectName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ObsoleteAttribute.xml b/mcs/docs/apidocs/xml/en/System/ObsoleteAttribute.xml
new file mode 100644
index 00000000000..682b19e784b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ObsoleteAttribute.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ObsoleteAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ObsoleteAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="ObsoleteAttribute(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="ObsoleteAttribute(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="error">TODO</param>
+ </constructor>
+ <property name="Message">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsError">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/OperatingSystem.xml b/mcs/docs/apidocs/xml/en/System/OperatingSystem.xml
new file mode 100644
index 00000000000..1ded618514e
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/OperatingSystem.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.OperatingSystem" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="OperatingSystem(System.PlatformID, System.Version)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="platform">TODO</param>
+ <param name="version">TODO</param>
+ </constructor>
+ <property name="Platform">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Version">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/OutOfMemoryException.xml b/mcs/docs/apidocs/xml/en/System/OutOfMemoryException.xml
new file mode 100644
index 00000000000..9de8aa08af3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/OutOfMemoryException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.OutOfMemoryException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="OutOfMemoryException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="OutOfMemoryException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="OutOfMemoryException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/OverflowException.xml b/mcs/docs/apidocs/xml/en/System/OverflowException.xml
new file mode 100644
index 00000000000..3e8617eeada
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/OverflowException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.OverflowException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="OverflowException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="OverflowException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="OverflowException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ParamArrayAttribute.xml b/mcs/docs/apidocs/xml/en/System/ParamArrayAttribute.xml
new file mode 100644
index 00000000000..4c0b4a1c0a3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ParamArrayAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ParamArrayAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ParamArrayAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/PlatformID.xml b/mcs/docs/apidocs/xml/en/System/PlatformID.xml
new file mode 100644
index 00000000000..3ac63a822ff
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/PlatformID.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.PlatformID" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/PlatformNotSupportedException.xml b/mcs/docs/apidocs/xml/en/System/PlatformNotSupportedException.xml
new file mode 100644
index 00000000000..0b78710d4b0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/PlatformNotSupportedException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.PlatformNotSupportedException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="PlatformNotSupportedException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="PlatformNotSupportedException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="PlatformNotSupportedException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Random.xml b/mcs/docs/apidocs/xml/en/System/Random.xml
new file mode 100644
index 00000000000..b77b7c483a9
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Random.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Random" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Random">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="Random(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="Seed">TODO</param>
+ </constructor>
+ <method name="NextDouble">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="NextBytes(System.Byte[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="buffer">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Next(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="minValue">TODO</param>
+ <param name="maxValue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Next(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="maxValue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Next">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/RankException.xml b/mcs/docs/apidocs/xml/en/System/RankException.xml
new file mode 100644
index 00000000000..5cbcfebf565
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/RankException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.RankException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="RankException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="RankException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="RankException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ResolveEventArgs.xml b/mcs/docs/apidocs/xml/en/System/ResolveEventArgs.xml
new file mode 100644
index 00000000000..77771134dc3
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ResolveEventArgs.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ResolveEventArgs" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ResolveEventArgs(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ </constructor>
+ <property name="Name">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ResolveEventHandler.xml b/mcs/docs/apidocs/xml/en/System/ResolveEventHandler.xml
new file mode 100644
index 00000000000..43fcb9782d6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ResolveEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.ResolveEventHandler" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/RuntimeArgumentHandle.xml b/mcs/docs/apidocs/xml/en/System/RuntimeArgumentHandle.xml
new file mode 100644
index 00000000000..8908991d47c
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/RuntimeArgumentHandle.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.RuntimeArgumentHandle" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/RuntimeFieldHandle.xml b/mcs/docs/apidocs/xml/en/System/RuntimeFieldHandle.xml
new file mode 100644
index 00000000000..ff0f5dcd56d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/RuntimeFieldHandle.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.RuntimeFieldHandle" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/RuntimeMethodHandle.xml b/mcs/docs/apidocs/xml/en/System/RuntimeMethodHandle.xml
new file mode 100644
index 00000000000..65f767842d7
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/RuntimeMethodHandle.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.RuntimeMethodHandle" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/RuntimeTypeHandle.xml b/mcs/docs/apidocs/xml/en/System/RuntimeTypeHandle.xml
new file mode 100644
index 00000000000..6e177412341
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/RuntimeTypeHandle.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.RuntimeTypeHandle" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="Value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/SByte.xml b/mcs/docs/apidocs/xml/en/System/SByte.xml
new file mode 100644
index 00000000000..42175ecc4ce
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/SByte.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.SByte" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/STAThreadAttribute.xml b/mcs/docs/apidocs/xml/en/System/STAThreadAttribute.xml
new file mode 100644
index 00000000000..3dcf8381a22
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/STAThreadAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.STAThreadAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="STAThreadAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/SerializableAttribute.xml b/mcs/docs/apidocs/xml/en/System/SerializableAttribute.xml
new file mode 100644
index 00000000000..c01e94817fc
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/SerializableAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.SerializableAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SerializableAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Single.xml b/mcs/docs/apidocs/xml/en/System/Single.xml
new file mode 100644
index 00000000000..18b93d8ccef
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Single.xml
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Single" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Epsilon">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="NaN">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="PositiveInfinity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="NegativeInfinity">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsInfinity(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="f">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsNaN(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="f">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsNegativeInfinity(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="f">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsPositiveInfinity(System.Single)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="f">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/SpecialFolder.xml b/mcs/docs/apidocs/xml/en/System/SpecialFolder.xml
new file mode 100644
index 00000000000..c61bab16fa8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/SpecialFolder.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.Environment+SpecialFolder" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/StackOverflowException.xml b/mcs/docs/apidocs/xml/en/System/StackOverflowException.xml
new file mode 100644
index 00000000000..97be57541d8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/StackOverflowException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.StackOverflowException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="StackOverflowException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="StackOverflowException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="StackOverflowException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/String.xml b/mcs/docs/apidocs/xml/en/System/String.xml
new file mode 100644
index 00000000000..20ef1ca3d79
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/String.xml
@@ -0,0 +1,630 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.String" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="String(System.Char*)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="String(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="String(System.SByte*)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="String(System.Char, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <param name="count">TODO</param>
+ </constructor>
+ <constructor name="String(System.Char*, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="length">TODO</param>
+ </constructor>
+ <constructor name="String(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="length">TODO</param>
+ </constructor>
+ <constructor name="String(System.SByte*, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="length">TODO</param>
+ </constructor>
+ <constructor name="String(System.SByte*, System.Int32, System.Int32, System.Text.Encoding)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="length">TODO</param>
+ <param name="enc">TODO</param>
+ </constructor>
+ <field name="Empty">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Length">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Chars">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Compare(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strA">TODO</param>
+ <param name="strB">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Compare(System.String, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strA">TODO</param>
+ <param name="strB">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Compare(System.String, System.String, System.Boolean, System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strA">TODO</param>
+ <param name="strB">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Compare(System.String, System.Int32, System.String, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strA">TODO</param>
+ <param name="indexA">TODO</param>
+ <param name="strB">TODO</param>
+ <param name="indexB">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Compare(System.String, System.Int32, System.String, System.Int32, System.Int32, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strA">TODO</param>
+ <param name="indexA">TODO</param>
+ <param name="strB">TODO</param>
+ <param name="indexB">TODO</param>
+ <param name="length">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Compare(System.String, System.Int32, System.String, System.Int32, System.Int32, System.Boolean, System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strA">TODO</param>
+ <param name="indexA">TODO</param>
+ <param name="strB">TODO</param>
+ <param name="indexB">TODO</param>
+ <param name="length">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareOrdinal(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strA">TODO</param>
+ <param name="strB">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareOrdinal(System.String, System.Int32, System.String, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="strA">TODO</param>
+ <param name="indexA">TODO</param>
+ <param name="strB">TODO</param>
+ <param name="indexB">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Concat(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="arg">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Concat(System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="args">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Concat(System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Concat(System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Concat(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str0">TODO</param>
+ <param name="str1">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Concat(System.Object, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <param name="arg2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Concat(System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str0">TODO</param>
+ <param name="str1">TODO</param>
+ <param name="str2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Concat(System.String, System.String, System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str0">TODO</param>
+ <param name="str1">TODO</param>
+ <param name="str2">TODO</param>
+ <param name="str3">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Copy(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CopyTo(System.Int32, System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="sourceIndex">TODO</param>
+ <param name="destination">TODO</param>
+ <param name="destinationIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="EndsWith(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Format(System.String, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Format(System.String, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Format(System.String, System.Object, System.Object, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="arg0">TODO</param>
+ <param name="arg1">TODO</param>
+ <param name="arg2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Format(System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="args">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Format(System.IFormatProvider, System.String, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <param name="format">TODO</param>
+ <param name="args">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEnumerator">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Char, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.Char, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOf(System.String, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOfAny(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOfAny(System.Char[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <param name="startIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IndexOfAny(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Insert(System.Int32, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="startIndex">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Intern(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsInterned(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="str">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Join(System.String, System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="separator">TODO</param>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Join(System.String, System.String[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="separator">TODO</param>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.Char, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.Char, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOf(System.String, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOfAny(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOfAny(System.Char[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <param name="startIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="LastIndexOfAny(System.Char[], System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="values">TODO</param>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="PadLeft(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="totalWidth">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="PadLeft(System.Int32, System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="totalWidth">TODO</param>
+ <param name="padChar">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="PadRight(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="totalWidth">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="PadRight(System.Int32, System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="totalWidth">TODO</param>
+ <param name="padChar">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Remove(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="startIndex">TODO</param>
+ <param name="count">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.Char, System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="oldChar">TODO</param>
+ <param name="newChar">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Replace(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="oldValue">TODO</param>
+ <param name="newValue">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Split(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="separator">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Split(System.Char[], System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="separator">TODO</param>
+ <param name="maxCount">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="StartsWith(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Substring(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="startIndex">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Substring(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="startIndex">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToCharArray">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToCharArray(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="startIndex">TODO</param>
+ <param name="length">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToLower">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToLower(System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUpper">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUpper(System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Trim">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Trim(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="trimChars">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TrimEnd(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="trimChars">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="TrimStart(System.Char[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="trimChars">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Equality(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Inequality(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="a">TODO</param>
+ <param name="b">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/SystemException.xml b/mcs/docs/apidocs/xml/en/System/SystemException.xml
new file mode 100644
index 00000000000..0ab0152e457
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/SystemException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.SystemException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="SystemException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="SystemException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="SystemException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/ThreadStaticAttribute.xml b/mcs/docs/apidocs/xml/en/System/ThreadStaticAttribute.xml
new file mode 100644
index 00000000000..e74c0789ca4
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/ThreadStaticAttribute.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.ThreadStaticAttribute" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="ThreadStaticAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/TimeSpan.xml b/mcs/docs/apidocs/xml/en/System/TimeSpan.xml
new file mode 100644
index 00000000000..d2d45f7dd90
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/TimeSpan.xml
@@ -0,0 +1,292 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.TimeSpan" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TimeSpan(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="TimeSpan(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="hours">TODO</param>
+ <param name="minutes">TODO</param>
+ <param name="seconds">TODO</param>
+ </constructor>
+ <constructor name="TimeSpan(System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="days">TODO</param>
+ <param name="hours">TODO</param>
+ <param name="minutes">TODO</param>
+ <param name="seconds">TODO</param>
+ </constructor>
+ <constructor name="TimeSpan(System.Int32, System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="days">TODO</param>
+ <param name="hours">TODO</param>
+ <param name="minutes">TODO</param>
+ <param name="seconds">TODO</param>
+ <param name="milliseconds">TODO</param>
+ </constructor>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Zero">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="TicksPerDay">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="TicksPerHour">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="TicksPerMillisecond">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="TicksPerMinute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="TicksPerSecond">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Days">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Hours">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Milliseconds">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Minutes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Seconds">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Ticks">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TotalDays">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TotalHours">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TotalMilliseconds">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TotalMinutes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TotalSeconds">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Add(System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ts">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Compare(System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Duration">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromDays(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromHours(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromMinutes(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromSeconds(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromMilliseconds(System.Double)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromTicks(System.Int64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Negate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Subtract(System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="ts">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Addition(System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Equality(System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_GreaterThan(System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_GreaterThanOrEqual(System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Inequality(System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_LessThan(System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_LessThanOrEqual(System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Subtraction(System.TimeSpan, System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t1">TODO</param>
+ <param name="t2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_UnaryNegation(System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_UnaryPlus(System.TimeSpan)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="t">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/TimeZone.xml b/mcs/docs/apidocs/xml/en/System/TimeZone.xml
new file mode 100644
index 00000000000..7f13481afe1
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/TimeZone.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.TimeZone" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <property name="CurrentTimeZone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DaylightName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="StandardName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="ToUniversalTime(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToLocalTime(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDaylightSavingTime(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetUtcOffset(System.DateTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDaylightChanges(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="year">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsDaylightSavingTime(System.DateTime, System.Globalization.DaylightTime)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="time">TODO</param>
+ <param name="daylightTimes">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Type.xml b/mcs/docs/apidocs/xml/en/System/Type.xml
new file mode 100644
index 00000000000..371e0537f42
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Type.xml
@@ -0,0 +1,758 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Type" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="Delimiter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="EmptyTypes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="FilterAttribute">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="FilterName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="FilterNameIgnoreCase">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="Missing">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Assembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AssemblyQualifiedName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Attributes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="BaseType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DeclaringType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="DefaultBinder">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="FullName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="GUID">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HasElementType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsAbstract">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsAnsiClass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsArray">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsAutoClass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsAutoLayout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsByRef">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsClass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsCOMObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsContextful">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsEnum">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsExplicitLayout">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsImport">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsInterface">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsLayoutSequential">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsMarshalByRef">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsNestedAssembly">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsNestedFamANDAssem">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsNestedFamily">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsNestedFamORAssem">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsNestedPrivate">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsNestedPublic">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsNotPublic">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsPointer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsPrimitive">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsPublic">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSealed">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSerializable">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsSpecialName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsUnicodeClass">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsValueType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="MemberType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Module">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Namespace">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="ReflectedType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TypeHandle">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TypeInitializer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UnderlyingSystemType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="InvokeMember(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object, System.Object[], System.Reflection.ParameterModifier[], System.Globalization.CultureInfo, System.String[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="target">TODO</param>
+ <param name="args">TODO</param>
+ <param name="modifiers">TODO</param>
+ <param name="culture">TODO</param>
+ <param name="namedParameters">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperty(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Type, System.Type[], System.Reflection.ParameterModifier[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="types">TODO</param>
+ <param name="modifiers">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperty(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperties(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethods(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethod(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Type[], System.Reflection.ParameterModifier[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="types">TODO</param>
+ <param name="modifiers">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethod(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMembers(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMember(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFields(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetField(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FindMembers(System.Reflection.MemberTypes, System.Reflection.BindingFlags, System.Reflection.MemberFilter, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="memberType">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <param name="filter">TODO</param>
+ <param name="filterCriteria">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetDefaultMembers">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetConstructors(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNestedTypes(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNestedType(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMember(System.String, System.Reflection.MemberTypes, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="type">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvents(System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvents">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvent(System.String, System.Reflection.BindingFlags)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetElementType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetArrayRank">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsInstanceOfType(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsAssignableFrom(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterfaces">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterfaceMap(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="interfaceType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterface(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FindInterfaces(System.Reflection.TypeFilter, System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="filter">TODO</param>
+ <param name="filterCriteria">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetType(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="typeName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetType(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="typeName">TODO</param>
+ <param name="throwOnError">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetType(System.String, System.Boolean, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="typeName">TODO</param>
+ <param name="throwOnError">TODO</param>
+ <param name="ignoreCase">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeArray(System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="args">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeFromCLSID(System.Guid)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="clsid">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeFromCLSID(System.Guid, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="clsid">TODO</param>
+ <param name="throwOnError">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeFromCLSID(System.Guid, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="clsid">TODO</param>
+ <param name="server">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeFromCLSID(System.Guid, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="clsid">TODO</param>
+ <param name="server">TODO</param>
+ <param name="throwOnError">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeFromHandle(System.RuntimeTypeHandle)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="handle">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeFromProgID(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="progID">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeFromProgID(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="progID">TODO</param>
+ <param name="throwOnError">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeFromProgID(System.String, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="progID">TODO</param>
+ <param name="server">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeFromProgID(System.String, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="progID">TODO</param>
+ <param name="server">TODO</param>
+ <param name="throwOnError">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeHandle(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsSubclassOf(System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="c">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetInterface(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetEvent(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetField(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetFields">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMember(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMembers">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethod(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethod(System.String, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="types">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethod(System.String, System.Type[], System.Reflection.ParameterModifier[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="types">TODO</param>
+ <param name="modifiers">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethod(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Reflection.CallingConventions, System.Type[], System.Reflection.ParameterModifier[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="bindingAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="callConvention">TODO</param>
+ <param name="types">TODO</param>
+ <param name="modifiers">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetMethods">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNestedType(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetNestedTypes">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperties">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperty(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperty(System.String, System.Type)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="returnType">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperty(System.String, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="types">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperty(System.String, System.Type, System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="types">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetProperty(System.String, System.Type, System.Type[], System.Reflection.ParameterModifier[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="returnType">TODO</param>
+ <param name="types">TODO</param>
+ <param name="modifiers">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetConstructor(System.Type[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="types">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetConstructor(System.Reflection.BindingFlags, System.Reflection.Binder, System.Type[], System.Reflection.ParameterModifier[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="types">TODO</param>
+ <param name="modifiers">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetConstructor(System.Reflection.BindingFlags, System.Reflection.Binder, System.Reflection.CallingConventions, System.Type[], System.Reflection.ParameterModifier[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="bindingAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="callConvention">TODO</param>
+ <param name="types">TODO</param>
+ <param name="modifiers">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetConstructors">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="InvokeMember(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object, System.Object[])">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="target">TODO</param>
+ <param name="args">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="InvokeMember(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object, System.Object[], System.Globalization.CultureInfo)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <param name="invokeAttr">TODO</param>
+ <param name="binder">TODO</param>
+ <param name="target">TODO</param>
+ <param name="args">TODO</param>
+ <param name="culture">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/TypeCode.xml b/mcs/docs/apidocs/xml/en/System/TypeCode.xml
new file mode 100644
index 00000000000..899d9f8400b
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/TypeCode.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.TypeCode" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/TypeInitializationException.xml b/mcs/docs/apidocs/xml/en/System/TypeInitializationException.xml
new file mode 100644
index 00000000000..e465dfc8a7d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/TypeInitializationException.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.TypeInitializationException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TypeInitializationException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="type_name">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <property name="TypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/TypeLoadException.xml b/mcs/docs/apidocs/xml/en/System/TypeLoadException.xml
new file mode 100644
index 00000000000..49e924048e0
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/TypeLoadException.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.TypeLoadException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TypeLoadException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="TypeLoadException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="TypeLoadException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ <property name="Message">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TypeName">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/TypeUnloadedException.xml b/mcs/docs/apidocs/xml/en/System/TypeUnloadedException.xml
new file mode 100644
index 00000000000..94ee9063814
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/TypeUnloadedException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.TypeUnloadedException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="TypeUnloadedException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="TypeUnloadedException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="TypeUnloadedException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="innerException">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/UInt16.xml b/mcs/docs/apidocs/xml/en/System/UInt16.xml
new file mode 100644
index 00000000000..400ed0d93d6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/UInt16.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.UInt16" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/UInt32.xml b/mcs/docs/apidocs/xml/en/System/UInt32.xml
new file mode 100644
index 00000000000..61270db013d
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/UInt32.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.UInt32" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/UInt64.xml b/mcs/docs/apidocs/xml/en/System/UInt64.xml
new file mode 100644
index 00000000000..05617cfb193
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/UInt64.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.UInt64" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <field name="value">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MaxValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="MinValue">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <method name="ToUInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToType(System.Type, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="conversionType">TODO</param>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSingle(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToSByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt64(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt32(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToInt16(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDouble(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDecimal(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToDateTime(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToChar(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToByte(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToBoolean(System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="provider">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetTypeCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="o">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Parse(System.String, System.Globalization.NumberStyles, System.IFormatProvider)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="s">TODO</param>
+ <param name="style">TODO</param>
+ <param name="fp">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="format">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/UIntPtr.xml b/mcs/docs/apidocs/xml/en/System/UIntPtr.xml
new file mode 100644
index 00000000000..2c29054edc6
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/UIntPtr.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.UIntPtr" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UIntPtr(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="UIntPtr(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <constructor name="UIntPtr(System.Void*)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ </constructor>
+ <field name="Zero">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="Size">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt32">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToUInt64">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToPointer">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Equality(System.UIntPtr, System.UIntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value1">TODO</param>
+ <param name="value2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Inequality(System.UIntPtr, System.UIntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value1">TODO</param>
+ <param name="value2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.UIntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.UIntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.UInt64)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.Void*)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.UIntPtr)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Explicit(System.UInt32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="value">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/UnauthorizedAccessException.xml b/mcs/docs/apidocs/xml/en/System/UnauthorizedAccessException.xml
new file mode 100644
index 00000000000..eb5de2697ae
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/UnauthorizedAccessException.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.UnauthorizedAccessException" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UnauthorizedAccessException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="UnauthorizedAccessException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ <constructor name="UnauthorizedAccessException(System.String, System.Exception)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ <param name="inner">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/UnhandledExceptionEventArgs.xml b/mcs/docs/apidocs/xml/en/System/UnhandledExceptionEventArgs.xml
new file mode 100644
index 00000000000..8997b926dab
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/UnhandledExceptionEventArgs.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.UnhandledExceptionEventArgs" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UnhandledExceptionEventArgs(System.Object, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="exception">TODO</param>
+ <param name="isTerminating">TODO</param>
+ </constructor>
+ <property name="ExceptionObject">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsTerminating">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/UnhandledExceptionEventHandler.xml b/mcs/docs/apidocs/xml/en/System/UnhandledExceptionEventHandler.xml
new file mode 100644
index 00000000000..b00ec29905f
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/UnhandledExceptionEventHandler.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <delegate name="System.UnhandledExceptionEventHandler" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </delegate>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Uri.xml b/mcs/docs/apidocs/xml/en/System/Uri.xml
new file mode 100644
index 00000000000..1917d253ecd
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Uri.xml
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Uri" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Uri(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="uri">TODO</param>
+ </constructor>
+ <constructor name="Uri(System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="uri">TODO</param>
+ <param name="dontEscape">TODO</param>
+ </constructor>
+ <constructor name="Uri(System.Uri, System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="baseUri">TODO</param>
+ <param name="relativeUri">TODO</param>
+ </constructor>
+ <constructor name="Uri(System.Uri, System.String, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="baseUri">TODO</param>
+ <param name="relativeUri">TODO</param>
+ <param name="dontEscape">TODO</param>
+ </constructor>
+ <field name="SchemeDelimiter">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="UriSchemeFile">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="UriSchemeFtp">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="UriSchemeGopher">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="UriSchemeHttp">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="UriSchemeHttps">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="UriSchemeMailto">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <field name="UriSchemeNntp">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </field>
+ <property name="AbsolutePath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="AbsoluteUri">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Authority">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Fragment">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Host">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="HostNameType">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsDefaultPort">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsFile">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsLoopback">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="IsUnc">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="LocalPath">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="PathAndQuery">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Port">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Query">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Scheme">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Segments">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UserEscaped">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="UserInfo">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="compared">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="CheckHostName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="name">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="CheckSchemeName(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="schemeName">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="FromHex(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="digit">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="HexEscape(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="character">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="HexUnescape(System.String, System.Int32&amp;)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="pattern">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsHexDigit(System.Char)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="character">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="IsHexEncoding(System.String, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="pattern">TODO</param>
+ <param name="index">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetLeftPart(System.UriPartial)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="part">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="MakeRelative(System.Uri)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="toUri">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/UriFormatException.xml b/mcs/docs/apidocs/xml/en/System/UriFormatException.xml
new file mode 100644
index 00000000000..21024af1120
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/UriFormatException.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.UriFormatException" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="UriFormatException">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="UriFormatException(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="message">TODO</param>
+ </constructor>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/UriHostNameType.xml b/mcs/docs/apidocs/xml/en/System/UriHostNameType.xml
new file mode 100644
index 00000000000..05997be4025
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/UriHostNameType.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.UriHostNameType" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/UriPartial.xml b/mcs/docs/apidocs/xml/en/System/UriPartial.xml
new file mode 100644
index 00000000000..2a0365c09ac
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/UriPartial.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <enum name="System.UriPartial" assembly="System">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <member name="TODO" />
+ </enum>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Version.xml b/mcs/docs/apidocs/xml/en/System/Version.xml
new file mode 100644
index 00000000000..d2dc0664213
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Version.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.Version" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="Version">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </constructor>
+ <constructor name="Version(System.String)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="version">TODO</param>
+ </constructor>
+ <constructor name="Version(System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="major">TODO</param>
+ <param name="minor">TODO</param>
+ </constructor>
+ <constructor name="Version(System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="major">TODO</param>
+ <param name="minor">TODO</param>
+ <param name="build">TODO</param>
+ </constructor>
+ <constructor name="Version(System.Int32, System.Int32, System.Int32, System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="major">TODO</param>
+ <param name="minor">TODO</param>
+ <param name="build">TODO</param>
+ <param name="revision">TODO</param>
+ </constructor>
+ <property name="Build">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Major">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Minor">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Revision">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="CompareTo(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="version">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="Clone">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="GetHashCode">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="Equals(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="obj">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <returns>TODO</returns>
+ </method>
+ <method name="ToString(System.Int32)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="fields">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ <operator name="op_Equality(System.Version, System.Version)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v1">TODO</param>
+ <param name="v2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_Inequality(System.Version, System.Version)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v1">TODO</param>
+ <param name="v2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_GreaterThan(System.Version, System.Version)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v1">TODO</param>
+ <param name="v2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_GreaterThanOrEqual(System.Version, System.Version)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v1">TODO</param>
+ <param name="v2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_LessThan(System.Version, System.Version)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v1">TODO</param>
+ <param name="v2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ <operator name="op_LessThanOrEqual(System.Version, System.Version)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="v1">TODO</param>
+ <param name="v2">TODO</param>
+ <returns>TODO</returns>
+ </operator>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/Void.xml b/mcs/docs/apidocs/xml/en/System/Void.xml
new file mode 100644
index 00000000000..454ef01d3ab
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/Void.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <struct name="System.Void" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </struct>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/WeakReference.xml b/mcs/docs/apidocs/xml/en/System/WeakReference.xml
new file mode 100644
index 00000000000..ab5b93831e8
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/WeakReference.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <class name="System.WeakReference" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <constructor name="WeakReference(System.Object)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ </constructor>
+ <constructor name="WeakReference(System.Object, System.Boolean)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="target">TODO</param>
+ <param name="trackResurrection">TODO</param>
+ </constructor>
+ <property name="IsAlive">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="Target">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <property name="TrackResurrection">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <value>TODO</value>
+ </property>
+ <method name="GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ <param name="info">TODO</param>
+ <param name="context">TODO</param>
+ <returns>TODO</returns>
+ </method>
+ </class>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/apidocs/xml/en/System/_AppDomain.xml b/mcs/docs/apidocs/xml/en/System/_AppDomain.xml
new file mode 100644
index 00000000000..c162b997a20
--- /dev/null
+++ b/mcs/docs/apidocs/xml/en/System/_AppDomain.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE monodoc SYSTEM "http://www.go-mono.org/monodoc.dtd">
+<monodoc language="en">
+ <interface name="System._AppDomain" assembly="corlib">
+ <summary>TODO</summary>
+ <remarks>TODO</remarks>
+ </interface>
+</monodoc> \ No newline at end of file
diff --git a/mcs/docs/compiler b/mcs/docs/compiler
new file mode 100755
index 00000000000..8379c7f8054
--- /dev/null
+++ b/mcs/docs/compiler
@@ -0,0 +1,248 @@
+ The Internals of the Mono C# Compiler
+
+ Miguel de Icaza
+ (miguel@ximian.com)
+ 2002
+
+* Abstract
+
+ The Mono C# compiler is a C# compiler written in C# itself.
+ Its goals are to provide a free and alternate implementation
+ of the C# language. The Mono C# compiler generates ECMA CIL
+ images through the use of the System.Reflection.Emit API which
+ enable the compiler to be platform independent.
+
+* How the compiler fits together
+
+ The driver, the tokenizer, the parser, the internal
+ representation, the resolution process, the code generation
+ step.
+
+* The parsing process
+
+ All the input files that make up a program need to be read in
+ advance, because C# allows declarations to happen after an
+ entity is used, for example, the following is a valid program:
+
+ class X : Y {
+ static void Main ()
+ {
+ a = "hello"; b = "world";
+ }
+ string a;
+ }
+
+ class Y {
+ public string b;
+ }
+
+ At the time the assignment expression `a = "hello"' is parsed,
+ it is not know whether a is a class field from this class, or
+ its parents, or whether it is a property access or a variable
+ reference.
+
+ Hence, the compiler driver has to parse all the input files.
+ Once all the input files have been parsed, and an internal
+ representation of the input program exists, the following
+ steps are taken:
+
+ * The interface hierarchy is resolved first.
+ As the interface hierarchy is constructed,
+ TypeBuilder objects are created for each one of
+ them.
+
+ * Classes and structure hierarchy is resolved next,
+ TypeBuilder objects are created for them.
+
+ * Constants and enumerations are resolved.
+
+ * Method, indexer, properties, delegates and event
+ definitions are now entered into the TypeBuilders.
+
+ * Elements that contain code are now invoked to
+ perform semantic analysis and code generation.
+
+** The Tokenizer and the pre-processor
+
+ The tokenizer is contained in the file `cs-tokenizer.cs', and
+ the main entry point is the `token ()' method. The tokenizer
+ implements the `yyParser.yyInput' interface, which is what the
+ Yacc/Jay parser will use when fetching tokens.
+
+ Token definitions are generated by jay during the compilation
+ process, and those can be references from the tokenizer class
+ with the `Token.' prefix.
+
+ Each time a token is returned, the location for the token is
+ recorded into the `Location' property, that can be accessed by
+ the parser. The parser retrieves the Location properties as
+ it builds its internal representation to allow the semantic
+ analysis phase to produce error messages that can pin point
+ the location of the problem.
+
+ C# has a limited pre-processor that allows conditional
+ compilation, but it is not as fully featured as the C
+ pre-processor, and most notable, macros are missing. This
+ makes it simple to implement in very few lines and mesh it
+ with the tokenizer.
+
+ The `handle_preprocessing_directive' method in the tokenizer
+ handles all the pre-processing, and it is invoked when the '#'
+ symbol is found as the first token in a line. The state of
+ the pre-processor is contained in a Stack called `ifstack',
+ this state is used to track the if/elif/else/endif states.
+ The state is encoded in the top of the stack as a number of
+ values `TAKING', `TAKEN_BEFORE', `ELSE_SEEN',
+ `PARENT_TAKING'.
+
+** Locations
+
+ Locations are encoded as a 32-bit number (the Location
+ struct) that map each input source line to a linear number.
+ As new files are parsed, the Location manager is informed of
+ the new file, to allow it to map back from an int constant to
+ a file + line number.
+
+ The tokenizer also tracks the column number for a token, but
+ this is currently not being used or encoded. It could
+ probably be encoded in the low 9 bits, allowing for columns
+ from 1 to 512 to be encoded.
+
+* The Parser
+
+* Internal Representatio
+
+** Expressions
+
+*** The Expression Class
+
+ The utility functions that can be called by all children of
+ Expression.
+
+** Constants
+
+ Constants in the Mono C# compiler are reprensented by the
+ abstract class `Constant'. Constant is in turn derived from
+ Expression. The base constructor for `Constant' just sets the
+ expression class to be an `ExprClass.Value', Constants are
+ born in a fully resolved state, so the `DoResolve' method
+ only returns a reference to itself.
+
+ Each Constant should implement the `GetValue' method which
+ returns an object with the actual contents of this constant, a
+ utility virtual method called `AsString' is used to render a
+ diagnostic message. The output of AsString is shown to the
+ developer when an error or a warning is triggered.
+
+ Constant classes also participate in the constant folding
+ process. Constant folding is invoked by those expressions
+ that can be constant folded invoking the functionality
+ provided by the ConstantFold class (cfold.cs).
+
+ Each Constant has to implement a number of methods to convert
+ itself into a Constant of a different type. These methods are
+ called `ConvertToXXXX' and they are invoked by the wrapper
+ functions `ToXXXX'. These methods only perform implicit
+ numeric conversions. Explicit conversions are handled by the
+ `Cast' expression class.
+
+ The `ToXXXX' methods are the entry point, and provide error
+ reporting in case a conversion can not be performed.
+
+** Statements
+
+* Output Generation
+
+** Code Generation
+
+ The EmitContext class is created any time that IL code is to
+ be generated (methods, properties, indexers and attributes all
+ create EmitContexts).
+
+ An EmitContext is used by the underlying code generation
+ facilities to track the state of code generation:
+
+ * The ILGenerator used to generate code for this
+ method.
+
+ * The TypeContainer where the code lives, this is used
+ to access the TypeBuilder.
+
+ * The DeclSpace, this is used to resolve names through
+ RootContext.LookupType in the various statements and
+ expressions.
+
+ Code generation state is also tracked here:
+
+ * CheckState:
+
+ This variable tracks the `checked' state of the
+ compilation, it controls whether we should generate
+ code that does overflow checking, or if we generate
+ code that ignores overflows.
+
+ The default setting comes from the command line
+ option to generate checked or unchecked code plus
+ any source code changes using the checked/unchecked
+ statements or expressions. Contrast this with the
+ ConstantCheckState flag.
+
+ * ConstantCheckState
+
+ The constant check state is always set to `true' and
+ cant be changed from the command line. The source
+ code can change this setting with the `checked' and
+ `unchecked' statements and expressions.
+
+ * IsStatic
+
+ Whether we are emitting code inside a static or
+ instance method
+
+ * ReturnType
+
+ The value that is allowed to be returned or NULL if
+ there is no return type.
+
+
+ * ContainerType
+
+ Points to the Type (extracted from the
+ TypeContainer) that declares this body of code
+ summary>
+
+
+ * IsConstructor
+
+ Whether this is generating code for a constructor
+
+ * CurrentBlock
+
+ Tracks the current block being generated.
+
+ * ReturnLabel;
+
+ The location where return has to jump to return the
+ value
+
+ A few variables are used to track the state for checking in
+ for loops, or in try/catch statements:
+
+ * InFinally
+
+ Whether we are in a Finally block
+
+ * InTry
+
+ Whether we are in a Try block
+
+ * InCatch
+
+ Whether we are in a Catch block
+
+ * InUnsafe
+ Whether we are inside an unsafe block
+
+
+
+
diff --git a/mcs/docs/order.txt b/mcs/docs/order.txt
index 40ce6970d81..fb23b66c014 100755
--- a/mcs/docs/order.txt
+++ b/mcs/docs/order.txt
@@ -1,2 +1,3 @@
-Order:
- Not all code paths return a value \ No newline at end of file
+The plans:
+
+ Currently types and base classes are being registered. \ No newline at end of file
diff --git a/mcs/doctools/.cvsignore b/mcs/doctools/.cvsignore
new file mode 100644
index 00000000000..378eac25d31
--- /dev/null
+++ b/mcs/doctools/.cvsignore
@@ -0,0 +1 @@
+build
diff --git a/mcs/doctools/ChangeLog b/mcs/doctools/ChangeLog
new file mode 100644
index 00000000000..393d023425c
--- /dev/null
+++ b/mcs/doctools/ChangeLog
@@ -0,0 +1,13 @@
+2002-03-28 John Barnette <jbarn@httcb.net>
+
+ * makefile: added gui target, no longer uses CVS NAnt
+
+ * doctools.build: Reworked, added gui target.
+
+2002-02-24 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: have 'clean' target remove the build directory
+
+2002-02-14 Nick Drochak <ndrochak@gol.com>
+
+ * doctools.build: Fix build script so doctools will compile (doesn't run yet though)
diff --git a/mcs/doctools/README.build b/mcs/doctools/README.build
new file mode 100644
index 00000000000..f29dd30eddc
--- /dev/null
+++ b/mcs/doctools/README.build
@@ -0,0 +1,8 @@
+28 March 2002 (jbarn)
+
+The NAnt buildfile for doctools uses tasks that exist in NAnt 0.7.x,
+and are not available in the version of NAnt (0.6) in our CVS tree.
+As I really don't want to go through the hell of getting the newer version
+of NAnt into our tree, the makefile and build files under doctools require
+NAnt 0.7.x or greater to be in the path somewhere.
+
diff --git a/mcs/doctools/doctools.build b/mcs/doctools/doctools.build
new file mode 100644
index 00000000000..4d2fee7f6b6
--- /dev/null
+++ b/mcs/doctools/doctools.build
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- NOTE: this buildfile requires NAnt 0.7.x or greater. -->
+
+<project name="doctools" default="gui">
+ <property name="build.dir" value="build" />
+ <property name="build.resource.dir" value="${build.dir}/res" />
+ <property name="debug" value="true" />
+ <property name="src.dir" value="src" />
+
+ <target name="init">
+ <mkdir dir="${build.dir}" />
+ </target>
+
+ <target name="docstub" depends="init">
+ <csc target="exe" output="${build.dir}/docstub.exe">
+ <sources>
+ <includes name="src/Console/docstub.cs" />
+ </sources>
+ </csc>
+ </target>
+
+ <target name="core" depends="init">
+ <csc target="library" output="${build.dir}/Mono.Doc.Core.dll" debug="${debug}">
+ <sources>
+ <includes name="${src.dir}/Core/*.cs" />
+ </sources>
+ <references>
+ <includes name="System.dll" />
+ </references>
+ </csc>
+ </target>
+
+ <target name="docval" depends="init">
+ <csc target="exe" output="${build.dir}/docval.exe" debug="${debug}">
+ <sources>
+ <includes name="${src.dir}/Console/docval.cs" />
+ </sources>
+ </csc>
+ </target>
+
+ <target name="gui" depends="init,core">
+ <mkdir dir="${build.resource.dir}" />
+ <resgen input="etc/gui/ImageResources.resx"
+ output="${build.resource.dir}/Mono.Doc.Gui.ImageResources.resources"
+ />
+ <resgen input="etc/gui/TextResources.resx"
+ output="${build.resource.dir}/Mono.Doc.Gui.TextResources.resources"
+ />
+
+ <csc target="winexe" debug="${debug}" output="${build.dir}/monodoc.exe">
+ <sources>
+ <includes name="${src.dir}/Gui/*.cs" />
+ </sources>
+ <references>
+ <includes name="System.dll" />
+ <includes name="System.Data.dll" />
+ <includes name="System.Drawing.dll" />
+ <includes name="System.Windows.Forms.dll" />
+ <includes name="${build.dir}\Mono.Doc.Core.dll" />
+ </references>
+
+ <arg value="/resource:${build.resource.dir}\Mono.Doc.Gui.ImageResources.resources" />
+ <arg value="/resource:${build.resource.dir}\Mono.Doc.Gui.TextResources.resources" />
+ </csc>
+ </target>
+
+ <target name="clean">
+ <delete dir="${build.dir}" />
+ </target>
+</project>
diff --git a/mcs/doctools/etc/gui/AboutMonodoc.png b/mcs/doctools/etc/gui/AboutMonodoc.png
new file mode 100644
index 00000000000..9cf817597c4
--- /dev/null
+++ b/mcs/doctools/etc/gui/AboutMonodoc.png
Binary files differ
diff --git a/mcs/doctools/etc/gui/AssemblyBrowser.png b/mcs/doctools/etc/gui/AssemblyBrowser.png
new file mode 100644
index 00000000000..b7de659ce54
--- /dev/null
+++ b/mcs/doctools/etc/gui/AssemblyBrowser.png
Binary files differ
diff --git a/mcs/doctools/etc/gui/ErrorExplosion.png b/mcs/doctools/etc/gui/ErrorExplosion.png
new file mode 100644
index 00000000000..cd3d9572781
--- /dev/null
+++ b/mcs/doctools/etc/gui/ErrorExplosion.png
Binary files differ
diff --git a/mcs/doctools/etc/gui/ImageResources.resx b/mcs/doctools/etc/gui/ImageResources.resx
new file mode 100644
index 00000000000..ff32aaf2d35
--- /dev/null
+++ b/mcs/doctools/etc/gui/ImageResources.resx
@@ -0,0 +1,504 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 1.3
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">1.3</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1">this is my long string</data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ [base64 mime encoded serialized .NET Framework object]
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>1.3</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="AboutMonodoc.Bitmap" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAIAAAD2HxkiAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAK0dJREFUeF7tndvq
+ Z0eVgHsewScQfAEvfAARciEiitHQTrRD1E7UG49IGMUbURFEUBREUfBCHJBhLvRCwQMiY1CI4oGIIgoe
+ Bg9jTIjaHrHnS69OpVKHVatqn3977Yvm3/tXtapq1fpq1Xn/2wMPPHDFH9eAa2BDDQChP64B18BWGnjT
+ m950Zau0PV3XgGvgzW9+82tf+9qnILypPo888kjx9973eir+q2vgPBp4y1ve8vrXv/7ee+99GoT/sfuH
+ lmPnDw3bzp+7d//83wmev/3tbxD4qle9itpwCGeGeucEkr3dM3j3xTP4m9/85k9/+tP169evXbt29epV
+ h9Ah3B2VDuGuu6QzE7OAOPeE05l2CB3CSWg6hA5hsxE5Xnf0i1/8Ypgx+/znPz8JkeUj7x/CD33oQ//5
+ 5DMdmCUkNI346AEOBuFnPvMZCHzf+97Hfgb+rUH49re//aMf/Si/Js9nP/vZD3zgA3b0EEKURAgv3/3u
+ dxuFDED4wQ9+8OMf//h/lx5+esc73jEgsxaFUjAlQBlRJootIkSKQPqDH/yAkMmCAS/5ifXl2dl773vf
+ G1oH0o2fxx577A9/+MPRwYvzfyQIP/KRj9y4cQOLkR1FRQj59cc//jG2Qj196UtfIkx4Pvaxjz300EP8
+ hBC4AtQaSJ/61Ke++93visEhhIhBCP/96U9/yvtf/vKXpNVE0QjMe97zHjz8z3/+85CogBE/IWnq7+tf
+ /zpAGoUrwUgURT3jGc9AnwmEoAVgv/3tb3mP3sjJHXfcISHl4b+8FG187nOfu++++yaiCO3I+dnPfmZR
+ wj//+c+//OUvADmFxkcffRQJ8vz+97+3ixqOWEziMBAKgVhDsIMEQshBj9QfzGAfta1/RCciloe03CsG
+ ITBw11131YQ85znPIRXSAnjdKzY5wekJexSNLSNI1jctPutZz7r//vsBkijUKNGbSdQCgDFCwm5h/sb/
+ ABL4feUrX+G/AIauSFHPEhLQJ/AMu0ScnrA3oARofPzxx+38SEgo+sc//iEpokzyL61zU85wREXyMSCk
+ F5oQGHtCMBDvBzlNixF7AkW0H3OIY+wVAuqYaRHm4CEVQmj4f/jDH0q2E/YoBZYN59iHPMCQNAqEISLR
+ ESLbnboefO+f//xnJAfA+BsI8UWCH6jb9zCTf6IAUq8/hFv6tNOV8Pe//93uykDuX//6FwYQqx2Fk42/
+ /vWvCi3GiDTu//X058tf/jIvYsn8l5fyZu8QfvKTn/zJT34ilRT3hQKEvAcDLEDxfkVjChyCHw4QIah4
+ TAjVX+vc1sAQBvJsY/rSZ6Zu6Ct++tOfxl8xPJSX5BAakz4hLxGFQDuEknrcrUBFQMjQC2n5SRrUIk9S
+ BbFiMWji4kLtnVKaIVJUlEBnmEbhj3/8I91FQkKIogS4wk01XRkB6MeSaF4Wmjnkk1xNiCVioOu5z30u
+ crBemOSPF73oRYFDNP/sZz87pLJfCOl/yk5UjKPIBub44IMPSv8zViiq5CfgrPmQYDrEwm6CA8yFKI4o
+ CMEjifEVx4dFMEArZwA5QhrjvSJRyIdGiRg34dKaEBGxFg6LqQuEcUtHflCjSOYJEzPSRy3SSAtCSGOn
+ 9BOf+ARcJQ1BUAL6BFHhOUaC9o5YuR8LSlAQCnLIZM3PY0uKM7REhDpJSCAUDvkXd3LPPffIG2gMv+7a
+ E5JpakjpXsrQLmiTkGhQOvdMqzD1gn/jX5liSQw3nl3gV5lulW6qiA1CZJZVhGB/xYGi9GSKg8OcCvFC
+ ScMhboT6aDo0AjCGJHDSg5UxqjJbA8PgRxJ5syVlDwJFkwTDETE3E2CQ4SJvxH0Vh6+8J0DTGYoPLCqB
+ ROMUEwjFiGVgVlNCc7aGotV62tQvPduaJ+yKGGMm4AEhdngwCOMRS6418BM7EHJQEM0kbXneM6Q/wGRm
+ XmciM7hZKkAmbIpzpzAmKGI6eWYwvuJ6SQIh5pX7QGnFQcs4tCMYgfMOFepS+qXSkSPz+rAZrRIMEvBU
+ NZZAkeEfwXJRVMQ3v/lNHUKi5z5QlFAcVRaRoK7hsKiEZr9UYQljGIMwj5hDyCDwne98p3RKD+MJxYPl
+ cxLJUERmR/SFe8iEw+JIQKRJ2w9mytIF1i9zIfmoiUzSrc17pAmETKLkeSBu76BOYE6agwBzsVOqWF7Q
+ pyiBrmBzfoUAgJq3RzRkdFx1CAlQVAJkJj4w747GQMo0SVEJ8FnzZtIXqLVEtEE6hPaIOYTC3pEgZL8c
+ w0ImJ77//e9LVzD3P9KLgy7L6jlhYLV4f4cYn2XdD8yw0bC2lnRrdQjpDZJKMr7lv7xksGcZzsVhRFpi
+ EyikJo33+vqHKEFxgAlahCR8MjiU4igQSqyiEmr9WAUnRoA1JYB0LSKrGrUxIb0JZl+mR8TpPfOZz5Qp
+ Gel/4gMZHPKvzJTya5in2e/ETLxp9f3vf39R10Kg7rtiMOAH15rALHZjJBBpJAfMeS0iRIeQyshdB+ni
+ HnsJlPBFgeJX856trEYqPdIuAgUzDD0fJOsQFv0nSlD8pwIhP0FUrlWUgJOsLVrUJjllYkkZUg5H1Itw
+ DAgBkpnSpPlE0V0EYpe0TMXGu9iTVHbDMCubVzySmcVJYgW6WFXP2xHcCC+HF9xxhkCVtCky5Vt0rfHc
+ TD7hrMNTdG4M/8KcVsiGIodF+ZoS+KnmP3ULxhnWlFBzhmG5L+5HyGBYcYPf+c53Hn74YZhP5gubEfX8
+ J7OjL3zhC/d7nhBXnkM4sIEbJ5b3hXohlPWPxPp5o0BIzYUNdyEi9YfXGnODxAIqbDr3RYBB1Spi8b3F
+ RqQ5q5kEoAPZBSHQFpUALUrSuhHLNqmiEgCmFpf5VX4lYrxjBgL1FX84HIt4IZ4QCBNFJ9vWmts4JQC8
+ JT1JmOyFENh6ISwaCiSwKjgMIRFl4ippDmjgSU5Z7cCF5vkf8IRA2CWnpgR9iR/T5wl2HP4b/mBlr6YE
+ ffn+Rz/6Udg7+r3vfS9JIkmXX0M2EItBhk2nErIYvvhT8vIw3VGmZxJFj0FITzKRMwZhPlGkeELZpZlP
+ LIGQcYW9BqpspilKViZ7yE8XPDU3xTY3uxwC15SgzwYJG0UO5b0seBSVoEzP5DLzhGph4vdxxsbeHwZC
+ pklzCCHK6ABDMHqw0yFkojW3JwVCeCiueer+yuIhcXf5KBdzpIzKfM9cEHZ5wmJgskr+iysTgfzcySRA
+ 4pdqSlDWG8YgLGYm9mx5Y5F78rh3yq8HhpBeZW83EhRngVAGY/YxIX3OvL8k9mchTQ/DqDKfZeEN06HK
+ +Qm7B1NGa7UxoZzGSB76nDUl6GPRoieMu478zVxoUQn6gmECjN0TFiPqA78QJfecB4ZwoBu5FYQ4pXxJ
+ Q5ZGpkNYFC4LhptAKKcxcq5YhKgpoQmh4kzEpvF4uXBRgsJGEYxa99LoOZPWIf+vQ7iNJ4STYjs9vEIY
+ 0zXgZmfsjubOTYGwqITmDhux2pjDfLaDic2am61BWJtNCWnl5NfagmJ3tNZHzeUHT/jiF79410sU+Zjw
+ WJ5wOQgZcPb2dY8FYU5R4kwIwARML4R673HNX707+sQG7oGxZdeYcFFPeDYI86kRh3ClOxGX84TsJl0B
+ wuJwaJbuaHGpUJ/12coTFpXQ7I5anFJxqVCUYIm+bRj3hE/M5teO5CrrH12esDhsm3FiJt8vogvfBMLi
+ 7Ghzw3fxPGHODBMzNSVsC5gldYdQuzpxLgjpMebbtaSdNp4hVCZREZIPOPE566wT5iMxdmAWZ0dZz6gp
+ QT85ZbHjmhL0dUKL5BXCOIRrQMgW7XyTMRDycuLNhbJYn28W0TfELeoJyU8RKrZo15RQhDasWzQxkMX6
+ ohKUDdlNsasFcAjXgLC205rZ/IGThLFXZKic79iSgxTKhrgZIbQv+kNmce8oEvQbMZowyE18xdMklitn
+ mvKXDnA6CDk7P8se1K4xoey0Lh57U/a1WNbxsY/8mLIczlA6unNB2LV3FM/GKYqiErjVYvgUBRrgPERR
+ CcqRwqW56pJ/OgiZCM1PYyw9MQNOykH45uVOysYX2oL8wgU2l+uHM7aCUI7VF28DULaP6gbNUYaaEvS+
+ KFcGy/2/8kBs8yiT5GQ4Yq0gh4Hwa1/72vSN13KUKZnGWGGJIhyEz2cm8JDDp5mYesl7g2hJtkQrjnQr
+ CHF3nKwvKkE5zaRDyNRLTQlygV3xkXsxwrXLdODlbC5Y6kcKByLmWwuSLB0GQo5vJV0OWGIw0HuKIodw
+ YLG+9xSF8CCH6xM/LFcqDEzPMJjMpwSVO2ZiJmsQNu93SjqNvd1Rosvh+qISatMzCoTyjZqkVRUlKIeY
+ xHnmHWO5skjxn8MR9XbkSBAmupa7IewXzIRDvdNP1nOot3iekJtOa9dbCAP4vfymQBpyKqlrrUIuL026
+ BiiEXFkGmUUIa0sLymitBqF+NImRYVEJOMliK1Dcw4nGOJLLaLCohOTwRLzJhr/BrHabJm0iMpVtpUpE
+ Ngwku3mKm3tCccIfx9g7Khc95ath1CVHCi1XrQkbEJvLkfXirk+mMbuTVwZ9G97rEPIr1pNfO01B7PeO
+ Fi+xl/sOIdPy7bTi+cbmLGVOIzjleiAb+qWJcl1iUQnKvaPJ6SEIlHu44+veRAm8jzui+QG/4pELmVyV
+ SwlixxWftGhGLPY885fJZnSB8M4779zpN+vf9a538TWYX/3qV8UrD2m35NNc9EvpZ1L3uS/C7qGU9/xK
+ d7+4VCWXvcu93Xi5IpByFTfM1y41kS8Z8KtkQ1x0PjArIiQdIThsTtLQp61dH9y8vBQHyPwQQ1DymS+y
+ y2ASDPj8Q+3aJe7txfvJN0Xlq2n5PhUZXIkoVMFkTO7f5AbuBCFRArGKN3DHpkwYhcDkSoucAVjKG/T4
+ oqraqYhmxGK3swhhCMmvO4UQ1/etb30LtKhLKib/blG8KET7h04ZMcrNvOH2JzAIzMAqvxKmdnmrfMGC
+ dj18fSHc2iQXliKZXwmDkdWEyNeUSEisEBSLsyOBw1gOJihJ46aK3gyEwlec4uZfvoikExh/+ZCxUO3W
+ TUQFNZITHF3Mg3y9jLREDzzKZd6IIhX5MEHxTu7AYVEJ8bdHxV7FlBmVQYLMqeRKKN69XYSwpgEZ49RY
+ UjyhHjERmDjnnUKI9/vqV7/6mte8RvkMUL5DQq51CBBCERagMFOUIC+xs1iOcnV3TQhWgoTaFCUcUjGS
+ vVgC+RffDpDQKL6LFXkCSyuQXznHexhTeqGyVaD55cOkILRK5CHeXY3r6xWCTOTULsYnz8hUlEBEaAQ8
+ 5iSxVLkfraYE+TpFzk8CoWVMWINQH0zSBNi7owfwhED44Q9/+HnPex42Fz+YrLTB+SPBaHpjeGrDaAU/
+ +SmBuSYnzltioCJBWSeADekZ5lYV3DI/8VCo3IeHrnhzzw0JFTvhTSVQugRC4+cfY8nkU/k6BT1V+SDp
+ RCU0L3SK50hkkjPvkcrMFqTVzuPKV/osEYP3zud4klki/vvtb3+b/F+/fn1fh3qBkAIXH7qpeAZ5wtfk
+ GRCGJ9yljSdEZcNPDLMiRNLlGuIQRjps2L0OofAZOpnEsnypFz7Dx6dg2DINI55w7EkgHBPS/Ggh40z5
+ VOiAEmBGWQ+srQ3QsSRWjJMMB5JJnTz6cERlleIwSxTFY4u9i4QrhGcACfzyMCi1bD0jDCyFb9ZjHOL9
+ Ym8fD1blosSuJQ0lG70X/i4Xnlmf8M36phJYD6CPav86b8IAEWVsKS2mjMbp0DY/Mzoc0QLhvjyh8aTw
+ ClBNTMIIYQhGcjIOpJOZPLxvzp32Jkf45aAalkwfFd/ItKpMw9JVCw89ySYn+sp4/Cuoh8t/u8QORyzm
+ zT3hRMoa0QeoWDnKMCqrRbRDddCQDqFDuBpNgwkdFC17th1Ch3CQjdWi2a35oCEdQodwNZoGEzooWvZs
+ O4QO4SAbq0WzW/NBQzqEDuFqNA0mdFC07Nl2CB3CQTZWi2a35oOGdAgdwtVoGkzooGjZs+0QOoSDbKwW
+ zW7NBw2pQbisec4hfeV17YHkVrPU4YQOariXlG2HcICsjijDbKwW8ZKs+aBlcQg7iBoIuhpLwwkd1HAv
+ KdsO4QBZHVGG2Vgt4iVZ80HL4hB2EDUQdDWWhhM6qOFeUrYdwgGyOqIMs7FaxEuy5oOWxSHsIGog6Gos
+ DSe0Q8ONT+sNH9vdYblqWXIIB8jqiDLMxmoR92OssMfhXY7MhwPvQuN+crhQThzCDqIGgq7G0nBCCxmW
+ XSzgcdMEl7sIe1zqEe4y5eKJQ3zbzF7YYkiHcICsjijDbKwWcaIBTY8uV9lz51J+vSUX7ejXqE1PfQ8S
+ HMIOogaCrsbScEKbWyEQ1m5SBE6HcI6tZUvKGKBi5SjDbKwWcQ8Qho5oQqNDeHNJfOaRvTJRA8mtxtJw
+ QptDSAZkSkYu2I7vAnUIHcIB6NIow2ysFnEPEIY8MEMTfzbQIXQIHcI2oXIVejucLQRzofEXBwKEcRLh
+ /vXwh032/3XlM07FKH84mE/MzECaImI1hzac0LDphIhdxq0nx6pgE0IkJEwOF6GW86XlJxl2CB3Cp0wi
+ cTIxZorbKbopiZvEarqXBEKAZKyYoyJv8nTjl0qukrwlzlxpU4r5D9FzObXyJu8FQvm40NWrV6/wTRJ5
+ GCLPM3mypJRlAZpD+rCDWi1isLnE+Jrva55wWA4Ccwh5U4QwsfgAfPJH7HNqMCd+yeIea02AxUvn+gme
+ 0CGcg7lMxmosDSdU9BhKf8xiykWAEzdbtHU7hIm5F31grTnQO9JjEBZlFkXleoi7o09MDrsnnJfFYTZW
+ i1gbUA17QqVP2By8dUFY82BTcp6zbXH4tTarBqEyJnQI5wXwCWmrsTScUNPIhv1JM2LO5ACEOXJjEDZB
+ UorTjFtrmEQD3h2dH7xY4jAbq0WMTTaZMIj5DD8loyw9Su6sauElpAXCYrc2zl4YLnYVrZbVWnlz5Qhp
+ IXUJYNGbT8ycHcJmF3HNAEUIlS5iyNvjjz9+48YN1vpl20388Ib3TD8OfNAX+RxoRDjfAw5HPWLhHP7g
+ Pb8SZlhRvkThEA4bT3fEgEqREygiQLxOyN9ynrA2WcJPrO8LeHwmnRkNxlTxBlT+5g2L/hySIgyHFe0o
+ gh/oyge0EX7//fcnRz049sEb3vMrwslG15dGg/ocQoewm6WBCGLNMSpXnnyEE/gRUy5CWEwxfLmanW4B
+ PD49D3IIkYe/w08cUxQULWcUwQmowA8J4YwVwskq/4bMx6Xgm9tEGVCOQ+gQDphNRxSsmW/BY/rBmrFp
+ QS5wEswaYMKJXuw7eMI8PQhELJCEDd/8IYzxHuZxoWFTOGkFkCCWMHQglTIQlyYDqHKApSwkFG80FxQJ
+ zE8dqnkyqEPoEA6YjTUKBIo1B8zAD3J4KZ1POBGzhrf8VGENwkBgEEufECEMz/LeJqlIHgKHErh2UlHy
+ TNJJ+NCVJQkSQgJyEpfoEC6L05j01SY5hxOy8tQfLhCYeCHwS65vwvNI3y/p6cm2tTxlJMSBicV/FecW
+ uArM4JYBpniBDY1CTCwer+g5SY73+NVQOpHZr6enliiuXbvm29bGQNNiDbOxWsQBozFGSaxZ/E9tPBac
+ W3zJRfEoE+QgB48aiIJV0tLvZZNYse8iVj6EI3sEi9sCep74vWKRCSwDXURJT3jsHgDvjs4P3rHWCY1E
+ 9QZLrBm0dGcliwHYdMxJEUK6hfHkjXgqy6Vs+K44ogzhkkYBLOMDjQxQCaNPqJK0PPZ510SZDqFD2MuX
+ KTyuKbZmHBeANS8RhRPAizuNiW9BAlTEkzekUvNUSUbFGcYjT+KSzxCMXmsSgBkdmDcVeEIgh9AhnGA+
+ laj4hKRThwtiINdMCeSwewVCHBfC4+kQxm+WJQdJGkcXe1q6neQzNA2kjrRYOGlNWYVvllcCOIQOodFU
+ OoJBBWOk2JqNPcZksT7vjkJy7GBJAsn2JXI8bRI9vl848cN0oWNEO8rfGdQhdAg7TcYQPEHFvoBWO1kf
+ 0qTnGU/JiCsz5Oh2EFqHxNfFE7AIj/0ko0260HbhwyEdQodw2HiqERNUsGbjVhILhPEqOX/Hg7pmSWTU
+ F7vo2NmS7US4cbTZTFcP4BA6hBNNqBB92JoHIOzlpAvCLsKH9egQOoTDxqN5wjF/tTSEMrlq9IS9fd1h
+ PTqEDuGw8VghtFuzBcJ4TNg7bJPVvBjC+HMXONV4gaR31mdYjw6hQzhsPBqEyb5K/I9lrr8JYTLl0zuB
+ ySJEvF4PZvEKR7JAIr9aVlYmatAhdAgnmlAhejLXjzWz+qcfXBApTQjzxY+upTzGeLGvk2nbsMJBM5H4
+ SeMeg4kadAgdwokmVIiOS0nWCWXjaHNjVxNC2QYQ75gx4k0u8y0EABlP2+bbcWS3ndEZEl2eXoU6hA5h
+ r820w4u5JyfuwLI52diEkLTZRxav9RnxJiKuOG4acIPyIZq4PMnGVHy43MGrb8oBPITz/PrXv7bsYk00
+ 6BA6hG2oBkIwyZGMvmR6BktVfIUFQlnri6dnlIMOIed0NYunKPJDVXnzIeeAaxyGc1g0B8opZEWHDqFD
+ OIBYO4rslk6cIWaK88EfFt0FnPBT8i2KYlcwOU9YO/IXcinnCeNdqcJVMRs0H/F5QplKlfD4yXiLHBmW
+ 073hRDIR3RMuS9SA9NWOBQ4n1OZpNIScc0/Oy+MPMVkMV25Ak0socI/hsqb4LJ90BSET6iSw5MV+sl4u
+ a0JIzJXu2YTYZIspHDIQRQii+FVuA+AB7NDQiFj7RtagV/eEA2R1RBlmY7WIo4i14wEAaMV3W4QFOrkB
+ Lb6OCScpuCbXpcEkKBL4C1/4QuxkAodhkibcMYO/Ajx6j7Atd6WFGVEmWuQ6KX2MJ4ch41PzIedyw1py
+ 3ZNRbE1lDmEHUQNBV2NpOKE2TBNCyC1PYBAP4fKryuSWJMLI+fT8DiXeJBCKP4Q3cUfBf8JkwBuKYFuO
+ 6vMv7+V6G8uKpZyapwXJM5PknyTItlFsUZcO4QBZHVGG2Vgt4gTETFFBhc4kqGCpYBb3NvlbmJFuHm5T
+ LvAVP4Nxh5+k+6qMJKXDKfeOxhdkyL2g0Cj44SHtSwi0IDLkC5IDfsl1prjc5uqLT8x0YDNv0NVYGk6o
+ SVJy7XwzfDGArLaFoZQMqGS8J73HBx98UG74xe55KQ/GzU+WURZhBGC59CV+5IZsPBv4KZcI18oVJCdi
+ J17sHSfnnnBe6FJpw2ysFtECVe2DJ5a49jADhNiFS8iJSUyM7mPCZWGrSV+NpeGEEsBqHzAJBmQMX/zw
+ i/41mKLkAE/8oRVdTs3Wc4SaH8DJua1xmHwHpqt1cE+4LJzDbKwWMf50UWw6Ne/XDJ+YaTN8EW/F+mvy
+ m3avRyzmM0fLIUw/vb0sQHNIX42l4YQskDTdWmKstfA1yGt9RQWMAWeYQxgLqekhYXuJHql7wjlQq8sY
+ ZmO1iEYIc06M5miR3wth0+kVAxhdqF4uY6m7cqhBuKx5ziF9NUsdTmjAdpeo5lpzXutzJr3BYjClY1b0
+ eE0GigLtHcKm3TczUGwL7LGGK84hHObLFFGsOVhS/LdiNMVuUtPIjAGUjpze7cwHb7XuXC0Jy/tipzFv
+ RJRSjE3MJA1NraaMLYWxLiSYQ2hiaThQV2V44KU1MOysah1m/b2xOA7hMF+miMZq8GDraGAhCCdm3iE0
+ sTQcaGL1ePQzaMAhHObLFPEMNuRlnKgBh9DE0nCgidXj0c+gAYdwmC9TxDPYkJdxogYcQhNLw4EmVo9H
+ P4MGHMJhvkwRz2BDXsaJGnAITSwNB5pYPR79DBpwCIf5MkU8gw15GSdqwCE0sTQcaGL1ePQzaMAhHObL
+ FPEMNuRlnKgBh9DE0nCgidXj0c+gAYdwmC9TxDPYkJdxogYcQhNLw4EmVo9HP4MGHMJhvkwRz2BDXsaJ
+ GnAITSwNB5pYPR79DBpwCIf5MkU8gw15GSdqwCE0sTQcaGL1ePQzaMAhHObLFPEMNuRlnKgBh9DE0nCg
+ idXj0c+gAYdwmC9TxDPYkJdxogYcQhNLw4EmVo9HP4MGHMJhvkwRz2BDXsaJGnAITSwNB5pYPR79DBpw
+ CIf5MkU8gw15GSdqwCE0sTQcaLh6+HItTx69+H79b5gMl8sj5hpwCIf5MkWcYnNFCBGYv1cgnHjn9JT8
+ e1yjBhxCE0vDgYQZwSZxYvF/i/7NDiHCjd9IMpqFB1tTAw7hMF+miFKXCW+hgmPMcuQcwjVJ2DAth9DE
+ 0nCgAGETvCUg9L7ohmjZk3YIh/kyRdwWQqWbajcRD7m0BhxCE0vDgYwQ+phwaUPfs3yHcJgvU8QwIIzn
+ ZpKhYD5tI0yGJ+7KFt/7xMyeGWvmzSE0sTQcqFkBswTwdcJZ1LiVEIdwmC9TxHXq1Sdg1tHzQqk4hCaW
+ hgMtVG0u9pI04BAO82WKeEm24mVZSAMOoYml4UALVZuLvSQNOITDfJkiXpKteFkW0oBDaGJpONBC1eZi
+ L0kDDuEwX6aIl2QrXpaFNOAQmlgaDrRQtbnYS9KAQzjMlyniJdmKl2UhDTiEJpaGAy1UbS72kjTgEA7z
+ ZYp4SbbiZVlIAw6hiaXhQAtVm4u9JA04hMN8mSJekq14WRbSgENoYmk40ELV5mIvSQMO4TBfpoiXZCte
+ loU04BCaWBoOtFC1udhL0oBDOMyXKeIl2YqXZSENaBCarGzTQAspxcW6BtbUgEO4prY9LddAQQMOoZuF
+ a2BjDTiEG1eAJ+8acAjdBlwDG2vAIdy4Ajx514BD6DbgGthYAw7hxhXgybsGzgih8smx4jchFCuZ5dbd
+ Wn7s1kk25CFKnqVZMhnk67mKcyKZMUa0F7ZYxjj6LOXtys/EwGeEsKiyMRL2UN9xHpaw+KAuY2GTPBhj
+ ddnxhX2Z+FwQ5p9Yoe6Tr6/YaSz6nK62v5ifPEtN51MLkGcmd5ihFPFPRSs3ljdxyHkbEVOq5Cd2pHb3
+ vgTzXQ3EQOBzQSgKKmJmZ6/mGZLqt1tDkrT+32IdB9gs8OSw5RxaurW18tYgVMKHKHFcXZ819drVPkDL
+ QlEcwtuKnQXCGAa7NRS/0Vtzkk07aDqNGDmRlr8xQlgsbyKt5gmb2UiEW9o4u86balwzgEM4J4RjNafz
+ 39s6rAlhzS3HbBcJL5Kv0Jsn5J5w06MTUeIzGn2vree+YrgZntgdDd3LxK01u82KLzJ6Qh1CEVJzsxZP
+ qNSvQ3hUCItfwF1oYsbCpCU/zYYmHlDlfba4UxeoiKMkTimEj9OtdbPz90n0vIEIb2pxa/mxdEeLbUdT
+ gZsHOGN3dEalW0ibMbmlRR2lOHo+j1KKUJsO4STDPlx96x28xHFNUs2SkS9J7ejJIVzSWFy2a8CgAYfQ
+ oCQP4hpYUgMO4ZLaddmuAYMGHEKDkjyIa2BJDTiES2rXZbsGDBpwCA1K8iCugSU14BAuqV2X7RowaMAh
+ NCjJHCTeL5KvZc2yumVcyivuXJklA2ZlrBGwtkOItA+kf4dwNluJa92IyljaRpbyLWNjye05VqLzkNVj
+ 6d8hnM3GFDbyDZnxFkrJQYie7K7M81ds44tJJGITG40tVcmPCMnlK4qLwzebjCRwM3xcijgPx9U/ED70
+ 0EN33HHHtWvX+PfKA08+N2/e3Ms27Xo+ZgNoJkG6sRb7TsHEixxaulW52JjqmO2E9ib8Ercmv6az3vDD
+ ujc2Rgq0oYBJSZPmKcmhXsBE4Rb9iycEP56rV686hMMmkUYsmkix5dbrySKn6Hlq1pB4NiX12Ea7nOFw
+ 4Nj6mzWh+0yL3vJmKG+nLHIm6j9AiCd0CJv13hHAUnlzGUExW80muZl60RN2qOBWUB2VXmnG/mdXD2J6
+ IzhR/w7hFDN4WtykFd8PhMH1FZt5iyfs0tFW3dHj6t8h7DIwLXDSeUva7KSHFv4bExLzEAeIRzXFnl7e
+ HUqi5wYa3tTixs6k2N2q6aIr8BTtF2k36m1v+peJGR8TTrGHmeMu14WbOaNbi1tIUQuJrWnLlyi2tqMs
+ /WJbvrtc7iNDS9Cyvv4dwn1Yk+fixBpwCE9c+V70fWjAIdxHPXguTqwBh/DEle9F34cGHMJ91IPn4sQa
+ cAhPXPle9H1owCHcRz14Lk6sAYfwxJXvRd+HBhzCfdSD5+LEGnAIT1z5XvR9aMAh3Ec9eC5OrAGH8MSV
+ 70XfhwYcwn3Ug+fixBpwCE9c+V70fWjAIdxHPXguTqwBh/DEle9F34cGHMJ91IPn4sQacAhPXPle9H1o
+ wCHcRz14Lk6sAQ3CE6vFi+4aWE8DDuF6uvaUXANFDTiEbhiugY014BBuXAGevGvAIXQbcA1srAGHcLYK
+ WO3694k5TvK5xP25wzncVWaGS9Eb0SHs1ZgWPrahNe2pN62t8tnUdW9BmgIPEcAhnLOaasatfMWF5JOv
+ tYQ3xa+4xL9K1gc8sOQz/6BKeB8nnX86JqjMUi47V/aQc9bZDmQ5hHNWQhHC4seDYn7C38kf+X9zXItR
+ mkWqfW5BkZ8TYixXMzMx0vbAlxTSIZyzNhXPUPspN0HduIvZ7fUhRU+Y+0Ydj4F86rruLcWcNbepLIdw
+ TvUHMzIOugY854wQ5qJqGBTfO4RzmY5DOJcmbw/Pmp4tTm8JCGsjvWa67gnnNIUeWQ5hj7bUsPlAK3aM
+ zZ5qAklRWlFIGBYWR3T5y1hI/GvyPm5Nauk2C9XVw+wKPFu17UCQQ7hlJZzW7GpKP6dCHMLNIMx93WZZ
+ 2U3CDuHVq1evPPDkc/Pmzd1UjWfENXDJGnBPeMm162U7hAYcwkNUk2fykjXgEF5y7XrZDqEBh/AQ1eSZ
+ vGQNOISXXLtetkNowCE8RDV5Ji9ZAw7hJdfuOmXLF/eaO2zWyZiksvl6bHPx0yFc0x4uLa2ifdc2dhs3
+ tS+hoyYGExOdKN8hnKh/j144HBwrxXICo1eJtW2uNTk1SCweO2k7uvb01pxwkq5AeMetx3fM9BqDh7/d
+ 31Ooyx3jRL9R87RKZVgaghAmpy50a2vF1EukZ5hfgycUDn3bmnPVrYGmkeUSp3PYNdIbhjDJec0Dzwih
+ e8Ju+/MIMvNh94RFrzJFjRaei8NRy9jVWC6HcEoNetwZNGCEUJ+YESdjyU0zuVzOFAib3dSkGdJTL7ZZ
+ cXfUPaHFBjzMUxpQumfF7qLShzQSKEYcP8UeY+LBhvOZAx8ai6TV0MtbCyzy44kZHxM6YNtowO4Gt8nf
+ wqn6EsXCCnbxBg3Y3aBB2PGCOITHqzPP8YVpwCG8sAr14hxPAw7h8erMc3xhGnAIL6xCvTjH04BDeLw6
+ 8xxfmAYcwgurUC/O8TTgEB6vzjzHF6YBh/DCKnTV4hS3jyTbU2pbTFbN6HyJFZc0J5bRIZyvfs4nqQah
+ aCLfdXkZi/LF3aHysmvrT5DjEJ4PnflKXNzcHMTXtjLnlqrsBc0zq7idXE4cOGkaAjNd5BSVp+uhpm+H
+ cD5LPLGkAQib7tHiLWNsanmI3yduKvw3rjpLuk2cuoQ4hCdGZ62i1zxh3lmNPZjFjuMwyd9FZ1jsHieJ
+ WtKdRXN5urzheovr169fu3bNjzLNomQXclsDdgh7VVaEMElOcblFT9ibh+nh3RNO16FLaGhgQwj1/qpD
+ 6LZ7Cg2ETlc8TxPYSH7t6o7GcWtykkmX4piwGGbNunFPuKa2PS3XgKYBX6Jw+3ANbKwBh3DjCvDkXQMO
+ oduAa2BjDTiEG1eAJ+8acAjdBlwDG2vAIdy4Ajx514BD6DbgGthYAw7hxhXgybsGHEK3gY01kG+5npKh
+ eMNakJNsspkif2Lc2hYf38A9UbEefaoG8s3WUyTWdnIjs4jolLQG4iZ54L/uCQfU6FFua6DmxHo9T/FU
+ RGAmJ0eXr0AY11yykTX/yZ5ulzNPto/HEPpHQh2tPg3UbD0hKglWTKMI4bD8PEW9sZAs1bxx8X3Mp5H5
+ uG+cJBe+yuTnCftM0EPHlq0YpUVRNQiTJBJaapJ17BWvm48hLeWq6aGZveAS/XPZFiPxMAUN1Gzd4voS
+ cRZPmHgSpUomQmjxwEnftcs+EtcauqP0Rd0TdmnSA6dfya5Bktt0sbuYezkj5Iq0INPo/Yp56Oqm5mYR
+ +9KafO+OOk7jGih2F2XAE57c6RWxzI01kZOAVJSvdF+b4RPnFvKT9EibcvRGJ4ku//Xu6LgJesyja0Dv
+ uK5WOl+iWE3VntC+NFDz1evn0iFcX+eeomvgaRpwCN0gXAMba8Ah3LgCPHnXgEPoNuAa2FgDDuHGFeDJ
+ uwYcQrcB18DGGnAIN64AT9414BC6DZg08OCtJw9ae28S6oFuacAh3NIQima9ZYbUtGu5PVYpdqheDUJ+
+ +19/zBr4n1sPwb/xjW+EvyW2/Dd5GYIVA4eIBIuFBGnxe/k7kVPLeAimpytliZ+QYvI+D0kA2Y9iVt6p
+ A/7iF7949NFH77333rvvvvuuu+668sCt561vfeuNGzcee+yxR/zp0cDDt54kRvIm/m8eWOLWwhTlS/gQ
+ pSYzzlUtvJ43S25DKg/denqUd96wv/vd72iEXv7yl7/sZS97yUtecuVtb3vbG9/4xte97nWvfvWrX/nK
+ V/67Pz0aeMELXpAH52XyhDDF8Pwav6/9HSdkCWMJr8ux5LZHWx72tgb4Ou9LX/pS8JPnyhve8Ib77rvv
+ nnvu4Yc777wz/OB/WDTw/Oc/Pw9WfCnBaj/F72t/xwlZwljC63IsubVoycPoGrgCga94xStiLl1ldg1M
+ gbAIAC8tgFnCdEGYpGtvMkIqcmeRXXUeMmjg/wGWxDeDO3nJPAAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="AssemblyTree.Bitmap" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAAPAAAAAQCAYAAAAoEfIQAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAACExJREFUaEPtml1o
+ XEUUxzdPPlUCRURFqFACIoWIgvQhEARFBSUgVBCEhfjx0JfVYkAUW8hFrFTyVhASUkGtpYagQqG0pbHR
+ QEtNtA/FlLZXQhtsTVmMFl0IHuecmXN37ux83f3KUgxM7u69c++cmTm/8z8zd/sAoOT66+vrS/GaqPOQ
+ s5K6MDU1NT86OjoUqtfp68LmeWHvptuB/ewlWzo97r32fOW72wy7vu8V34gdr7lLc8NYd3hgeM56DwJs
+ FlERwU33XAXYc5EIT231+Nzk5GS6uLg4j0dfvU5fk3aW5kP2dtoOFRR7xpZu9LeX2kiSJF1YWLAV9A0M
+ 8A0+z+d6wXfQlr3f7N3XX+mvll4vwZZ37oL73r2niucaWNVPMLi7BbQILx1FwaOrY3TPpHiK+BMQpzaI
+ 8RyX0ESzDTa7wgNPAGM1CkChtjp1XQUSbH/TbWmXY27WeLI/6EcZIBPxL6EBNgsCbDuPUDcLcCv9d9nj
+ 87/pH6bLp5dPD88uzY6MHByZHZjYCgMHtkL5UHk6x4YcjLrilmYkvHxEgH1KrAOMo6kDrEFLzhxSaBu8
+ ugP6gghCy3OZJCUQxQlxK5MRgt6Al6r7bAk9DyffVUL35sZOzGuz/ab7BCZF73fBV8RupaQgjlxoXtsN
+ sM/WZvuP/cS5E0NHcxjbb1u9wfHBpVfPPQ4PjvcDgq3NbSmdUUpL0KLafq6O2ne8RsVQNhNgVmEFK4Er
+ /0oEcCuQ2hxIRlQqDAsC480YmnFGdCQxCZSC4RG/mwPtgJfsaQZiOeklTAWpKeMYlWXQeOO8JUKxmoCY
+ nTdBtSsIsRoPHqYoe/WgoxRThzf7rAPsC3KWazR/PJf2Oayreiv9Z3hp7D0Qb9Sq/ddOvABcbq8tDZp2
+ Yfr80qlHYdeJx0BPpVF9CdhqtSpTZUOB9e82iE2ACVXxTAFyBi4jLACm86VRUSwpbitwo6ProPAkieNR
+ bcJISRJhHxYJv3s9xNc49WJoze+yy5QBqICVDya+gOJrX63lqArNkyoMM3733d8Ab0GITectAnF9PIov
+ afBeHV7sp6bA9NkEGAdCBjj3UY1XVs82frpfttJ/A14ZQAXENr9HcNeWp2F99SvYqF2GlYVKlWHGNTAW
+ VN63Lz0Fu396ErZ/dC+do0JOgZFZQUwKzBBrSsx1TIjDADO+pMAdAZgBsqkcwpsBloc3p6AcqW1A2BRX
+ KTI9IwLewuqFz1UKbCpv9h3nTrfb7IMKiHJ+GV4D4pj7ZdCTChwLsa6+Nqd1BR4NXhfEDSl0PdAF4JUZ
+ RAZ5VADE+gX774CXA3DO73AcEFb495T4+AmVjb/Pwfq1Q7DxDwak81Ce3glPH30Yxn8bgY//fBmemNoO
+ lSOVCeV7UoF1iE0lzqDlNFqmYpROUlGbWBmqTSiwT315skN1bI7CAGeQSxVrgFdcZ4dpWHNiH20O1xCt
+ 1TpcZQKcyuc03uXMnjSwdQXmIF2HN2o9ywpEjp6H13u/ob5UNwZiHV6eL02Jc8uvIgrM9nOuxRDHAKyW
+ DYX6r+ZSNieVl+AV563jRgBvHGwotT8SuHFhF1w4uRN2vLcNygtD8Mr8EDy7f3BJY0KtkTQ4MZ3OlFit
+ iTXlJWNmFq/e4kH2A9wdBXZFdB3gulrm02YVwWmtyc6mH0MKrAcYzAIYYJo0oVysWpoDWQKIc62rVMO9
+ BuZsgI+8YUJ9SJIrau3La2DpVFoQ892vKS5nEdQfH5CkQBJaHppogM3nmlA7MiSaOwSEj/gZ/9ScyjHU
+ 9qvxewzATfdftE3AavDyuJh9IIBvCfVd+4BKbWUsA7e2fklU/wuq6RG4f2wLDI7vEECXZzOfyyBUabRN
+ iTMHQHBnZmi9PLNw9XYcwDJlwb9OptCxALvqMbC2zamYNbAJMTkIT14A4oi1bqY+emBx9UU/3wAxOhVC
+ HfmaDevpTswBKXS/UmE0JQpeX19CbamA5VwDM7z6MQZg9u+i/c9S6Ah4sQoBnH4IN848j+tfAe+EWA8f
+ E5dWMATJsvw+pOlnkF48AOvXtV1o3fFyqbJaE3NHGVyEF4s4n0uhdRXGe+qbWHl4O7GJ5Zv8GAWOASFm
+ Fzo3lnmKckpsOmTEWjcN2chZhJ6K5+yR0DrhDd2vVDeovuz0ckOvdXhD/cbrnLLaVJgV2IQwFmAdYs6o
+ QgGFbVKbVrRP4bsHAd5YehNWz+8Tt+KPxb5oLMtjAOvfwq+nX8z5Qu4lOEVrXYk1xWVwMXVmFcg5iFgH
+ M8Q6wKi6rLwI72YAjBBjIbsdO4ExjhJTJ2uDK2uK50o9YxQ4pu2QipnzVuSZRZRfqW/LyhtrX0iBdYg1
+ CIMpdD4Gy2AUA2996rOlhDcAI8A3Tz4Ht38/Y10L0/r4l7egtrofd6vLObvMQcoglhtVpLaUMlvAbeig
+ 2szC+2zghgDmaGcOUtGBs028Akuu/wqkkLFOlNmOAcICb12ZXL8cau19b4ydRZzPNYahdroNL6sdv0Iy
+ 18G2tTD6J0Md6o/p40Xq++Zcfw6/MoLaj0JlD9jLxQqsHB+q4jtjL8CZIyqAca0bCxDVw3e8MSVyDVZ0
+ wDzw4oZOx+DldjMFLtiWrnDm53aMQbeeEesr7bQnRoFFexm0DDuC3E47mn0WArwy/4bYyPoS4LpIo1Wp
+ Xa7A2tkRSI8NwvLhB2D17NhEg+C6Gi2SMjUosUo1fE7ZqhoUHSyyJUnmutFuN9sqOg53Yv2Qn/V6cESA
+ q1cOQ+3n12Dtu2cg/foRuPDp3bA03V+9fHxkVmxqVWy/ziKxvRMn1BOUon551Y4xEU7TtbbaYe//zwj/
+ Iq9TYyRARVijgDVt+A+t1PRPsQlSHgAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="ErrorExplosion.Bitmap" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAAEEAAABACAIAAADKyY23AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAJtZJREFUaEPdendb
+ Wtu37vk4999zz/M7u6UYNYm9K2JDVBSlWrCBvWADBBt2RVERBXvvvfeeWGKMJaYnJjGarPsuYe9zznM/
+ wb37Gc/akyWa8c456jvmv/3b/x//+VOe+jia+DiYedqaeFj9RXn6u6fVnwHOj0J9bIVMipjvk87zTuN6
+ JXM84liUWKaLIMAh3M8ulm4bF+CQGOScxHRJCHSIZ9gnBNknMh1S2S7pXDcxj4KnYYE3ScGOqUyHtGDH
+ lGCnxED7WLq1gGYR4WMJ4dPsOV42IVTLIIpFoJsl3fmJj8NjDztTBtU6yNM20MOG7vrUy8HU29EMa66f
+ C4fyMMLnSbSfFSQ2wMZ4BFSr32zv/S+oDgA0e5MAZzMm5THHwzKUZh1JtzNomRjiGs90jgmwD/exZFHN
+ mG4mXE/bCLqzkEmNC/EUBbuLQtwSue6pYV7ZAp+8uEBlMqsoKQRSnMIuSGDKYvwyeNSMMM+MMO9kjrso
+ yCWa4RLP8kjh0+KMf9aa4/mU5WHB8rAKuRMm5WmQ25NA18fQB8JwMccb/DSQYh7s8TTE0wJPiBGDl/Uf
+ NLs/3Sz+olo/8HV4FODyGN8OoT5luZPCpz4N97KKpNkKfG3DvK1Y1MeBro8CnB8yKfZ8mmtMsJeI7S1k
+ ecZxPdMi6TlxgeVprEZFdHtpUosyXpsXUyeNKElmSiO9MsN9IKk8r/hgt0h/J4gwxCM5lJ7Op6ZyKUls
+ SnywSxTDkettzXAxpdnd43paYR/ZVAsIFvhoEBwO08sOgoPyc7MwYvC0/svPydTT3szdxoRieQ9gcCA+
+ dg/9nUxJ9M6mLLfHnDs8ga7Ykkd+zib+Lo84FKsoOs6HtDFokMqnyIS+xWkho1Vxy7rs3Z6Cne787a48
+ PNfbZHOa9O6yJJ0iVpXOVcYH5cX45UbRJREkqqwI7/gQJy7VnG7/B832D3+nB2xPSz7djudlzfe2gdIh
+ lCcMp0f+Dg8DHE2wCKZYsj1seN72HE9bhvNjIwZvBxMHs/9wszGFAAZs0dveFO6BM4Fp+VjfowOPwyO6
+ gwnN/qGvg4mfq3kg1ULoY5fGdJOGecvCPSVhFHmke3mKX4OUdb1UQ2w3ETvNP5Zrvy1U/1yrJzY0WL+d
+ 1TzrUU7XpvcpRZ15UU2S0MrEgDwBVRhkHx1gE063hkT420cFukQHu0ES2J5JXG88BX6OTFdzut19wAh2
+ e+xn8Vuw/YNQypMIHI6LmRGDn5MZ7CeYahngYg4VSS2dTCHetvepln/4Opu5W//lZvmHh+09YMB7ro+d
+ iO0l5npIBbSy5GB1Drc2K1gjC5ltTrtcURNvh4izXuKk+/ZZy7e1BmJLR+y23S43/Npo/LFS93pEud2S
+ udIsXmrO6i0TVaYGJUb4RDMd0/iuXNffFFFURaxPAsspiUdRiBjyOEYa3xNHEeBkznC1oDtbUG3M/OEe
+ Lvj4ONDtSRDlb3/Afvs7m3O8beFJ+AG+AcFX6Y44B3LjYTmwUUiw+xM4enSgEzw4g+OeG0krTQrU5oaN
+ 16UeTZTfHHQRb8Z+nfbcvuggjruIo44fuzpiv53Y7/i+SoL5ulB72CNfrE+erU9eas4ZrU3V5Qly4kKS
+ eNS8OEZ2qFuDNLxeJihICpYnBKcgoPE8YoKcsfd0e3jpU2DwtCV1MwhgQIznANMHDMMr/Aw7Db0BAGtA
+ 8rT8V5DrI5bbI3+7P0Jc7sczHbLCPBA0JaFURZRXaRy9Scbb6FLcHnYTl2PEq15of/285eag7faw/eZ5
+ CwnmVe+PZ/rPC+o3U5WHA4VbHfKtzvzVtryByoS6TJY4wh+hAm6dyfcoEAXmRNLjmK4I63xP7JclgpWf
+ 40Oa3QPssj/Cri15CIYtNhzI33HJ5j5geFj9CePBxkN87B4AA6yL7+sQ7W+XGY6o4hnHsBZznBplYcPV
+ aX3lCX2l8X2loqGq+BV9zruFOuKknzju+bbRSLzsudnTQ2kg+fZcD6Mi3gzhcIjn3ecTVVPq5PZ8QUdR
+ zFB1ykhNykB5vCw6MNTDIsrXLplFTWC6CXztEYV8bR/4O97H3uHw6Q4PfO0fwpwCnJ7Q7c0QV/ASoQXP
+ ILf/CwNUN3gCzgEQYV0Chmt6mAfCfFkqOz+WVpMWPKHO2O0p3u7I3+3O3+nKOxoq/rzS+OtZ+88d3ffV
+ uq/LtcTztputpp97LcSLzh/7rT+PO4nzvptXXT+22rY6Fc25Ycp4/4rU4CZ5RE9x7FA5XIKHFMmjmgsD
+ XRGLOB7WoT72wW5PobpBUYRH5AckikDnxwHIdK6PDMKkmLE9//YHgy0ZABiOyeDWTHcLuC/X6wnSUEaY
+ hzzKpyo5sCMvYrhMNFIWu9mWtdchuRgvu91s+rml/TJX9Wm2/Ha9/tsKKcRBB3E2SBx2fN9t/rrb/GlT
+ 82mleUmfC4svTeNUZYXV5YQ2ZrObs5kdhbHFcQyu+yOet6Wv/X1EP+wuwuh/OS581+0J0/VJEBKXkznT
+ zTSYYoY0xfWyCKfbGm0JABCaYDzQ/h+XAAasYU5IOmG+Nslct+KkoPocXrOU150fMVYhOhlUvJ0qxd4T
+ O03ElpaMoesaYrfpy2Lt1ZKaeN5OHPd+X9e8m638MF/9fkH1a79vrlkmF/rHsVzFAlqlmNNfFreiy1xs
+ yh5WpcYxbRFbETwCXBE8TAKc7jHcnwZQnsAhkXDvAJgF30mIuynbwxw7G+ZrFRlgZ8RAdzSFx0BjhCoo
+ DTFke7aXDc4hJpga4e+I0FGTHd5WJGrPjxqtiIdffpyv+LWpIba1d3mg8teaGvJ9ofJ6TXO9XE9s6xGI
+ 3o6XnvQp3k2UISLt9SqxBdEB1qG+NuIo34a86IVm6dl4JWLUlCYzIciaR7NguD1iUqHJg0CXewHuFv5u
+ T0it7g4BqZbMti7myIZwd5Q8kXQb1D5GDOSXKE95KD9cHmHLMyL9IKjqYG0Chl1qhGc8hxrP8pLHsGsz
+ IzXS0CFV7PFUIbHZeLNSdzVffbVU82NTe7ur/77d9Gm14Wat9nq97sNy3YvR0qWWnOm6lNn61KXG9JZ8
+ kTozNNLDtDyBsdlVPFARO9OQ8POg5dNc3WarPJvj6mH277D4YKoV6gAuzQqlUbC7hUE3VIQQuIQfjMXJ
+ BNEWKTyW4ZQQQjFiwM/wVRwWMjm8SsSixjBdgt3Nkfbx5PqYR/jZwOFS2F6ZXM9cgXtvueDTVj0w/Fxr
+ +LqgAoybDQ3xTI+g9Hq6/NNC5eVMxW6vYqQmqas4prsktksZ2SJjN0oj2wrjYfodhfGrHYVDVaKlVjEw
+ IHu8X2xokoaFe1uggIUteNv9FeRuZgCAYgfqAQY+4ok1Uh4AhPvaxwQ4wlH/J4Y7xECPcgUuT1Z18DOa
+ RVTAk8QQpxSOexrbPZXplMm2a8vnXi6pcAi3q/XfF2vgzbfIx89a4Bsnw3nTdXEzDUmDVfGtypjOsviB
+ mrR2pbA6NVCVwVNnhylFAbUZ/C6lqL9ceDReSlwOE2fdSCODNclJLBf4HhwA0QVeYcBg2F8cAtvT2iAA
+ EEazAwDUjtDKiAFYIUGuJFb8AoKan8M9nvfTRCSyGHpJin9JcmBJYlBlCqsug4us1Fsa9Xy4CLZ+NV8D
+ Q/8wVYGjQClxtVB11CdpyQ3RStmqzJDytOByMQ9eVJXOKY73rxSzpBGeYo5LYayfSszGER2OVxAnA8SJ
+ 7nK5qrkgNJyGXTfFOZA+4P4YJSYqVsOuQ2mDIPdxqXAGa1TvaTwPVI1GDIYCHWEYv4aABY+JDbDNjfap
+ zeHrC2J7KoQ9pcJOZexARfJ0Q/Z4bdpMY8b+QPHxgPLtdM3H+bo3E1Vvpyo/zaveTJYc9kgW9dl95XGV
+ 6UxxKDXKn+x1kNSxBdWZnOxwanFCoC4/TiuL0uaGTzakn8zUEK97dkcLCuK9/Bx+hxUhorC8LEkbpj4J
+ 9YLjklsO08czys8eH/GMZTgkBLuIue7/hcHgN/gFUaBjdpgX/hk47kBlEnRd1EvW2yWbHfLVFsmyTrKg
+ zRmtShqrTt5oz9/qUD7rLT8arDwaLD8ZKTsdL381rDzsVZyMV210F/WrUlVZYZIo35xImiojtKcstUzM
+ zBPSmguEPRXi2qxQnEyTPHxnqJS4GJptlaTyXX3tUfA/QFJCJxREMUGMiaCRjgubge/iaZBsgS8aqTS2
+ WyrLNYtPNZ5DGN1REOAii/QtEJLG2leagJi93Zl72Jt/PFBwMFB4NKTc7Zavt+bMN4p7lTEt0rD+4nid
+ QtSQE6GVhPeUxM9osoBwuTlruTljqSlzuVU2XCtukAqqMvjNeaKukmT4sSSamiv0aS6Ia8iNLooLVETT
+ ShL8xhrEe6MqtSQUgRLNgJ8TBF0kUtijSF/r2AB77DfpijwP6C2J8suNZShEQfJov5xw75wwTxSdRgzx
+ HG/0U3VZYbXpbJT1I5WJa7qsZx2S457cs8G83S7pdkfOqi59rSVro00yVp3YlMXViNnxDEeemwnP9UEm
+ x7Uug92qEHTkhXUVRHTKOb1KQVUKI9rbNNLLLC+KVhBFE3mZxTEtc6I8NHlCeEh5Gqc0iZkWYotiu14S
+ IWQ4oD9huFj5Oj31tn0Q5GYa5msBozAASOd7ZkXQoH1xCrcqSwD7wXYrYvzRS5WnsP/GwHZHQigU0Yvi
+ /CrTQrTyyNYiETyhpVDYUZKgzxNiv6vFfJiEOieyMjNMLgxM5VIRQ+D9iNaIxYokXm4CJzmUFsN0Q7yD
+ JLGpqM/ZHk9SQ31RsYfR7TP47rnRvspEZnFSMBZwEnAIogCbaJZniLcN2bc4PoBPo5RArYoiIi7IIYXj
+ JouhA3BNdmi1mKuM85NFUOUx9ML4wIp0LqKcRiIwYogMcBAGu6ZxnFPZTmKeqyzKWxHrC5+Wx9AK4vyz
+ Qz1SQ5xF/rYx/jbYMPgW39OC6WyChhtdL4TjZYXmC1pCVxSV8EW+pxXKT4SRQGfTRI4Pyji+t52Abhnp
+ ZwUJpz3lepiyKA851Ec8T7PwQFeWpzWqI5RJ+JsGALFMJ4TaZLYroOZEeOXH0ksSGWVJgaWJDABAAVqX
+ E66VRzcroowYBP62UQz7eKajkGEHwSIh2AnPxBBn7AS2HIwG7BURDaGNjG7etneh2hLbhuLeUAz72P7l
+ bfMnWSfbPvCzN0F1EOhsTrO5D+IDdShZ8LghgpuiqsPX7liIeyhL8RKBCPGUDKYeFmRU9LFCtZ8Q4prO
+ dwevA5GEexSK/KvTWRppeLNCoMriA0BjrgAAUPwaMaCjh4AyMSxSuFSDoI1CK4iWH9EgKsAZ+wrtIRxv
+ O66PPWwJ2wYlQOQYlAMA4KHZPvK1M0XV4Gv70Mf6flwQFRJgZ0J3MfN1NqU5PcITHbm/22MIFgw3M/wd
+ Ps02ws8OAgCgCEB2ZIZSDSdQnhJSl82Huq15UW350U1QXUGGZnQyTbJQIwZxqAcE6orDvDPCffBMD/XC
+ R8AAJMQ1NFbAgPQOAGQZQyUF2wbtoTSeBhjwDZL1IGPLY2RMYAh0ME0P9S2I57JdAcCMhs7E2cwP3SIF
+ NelTLPARfwd2CGMGAQd6JpHtAmUQlGHS2P6KVBYAkOpKw7RSvjaHR67l4Whi2wrQS/1tSzg1tAfgtqTR
+ dAjIEvwV7ATMURRoj7AAc0pkwVldQWyBZQj1dbgj50gYJA3lYQG7gjMAACzE9y4+IufQbP6CbxQkhHSW
+ pcN9ses4ChCK3g4PITgNlNZB4Ca8LOCQAAD7SWA549/NiYQr0pFD1Nn8BklYg4SvyeZB+yYJXyfDR56+
+ IAJpdEydMtWQbjwHWRRNEesH91UmBhbGB2ADciI8wGrhCRfP5LmnsVwSgxyBB/EOSQeZEnxZqK8d9g+C
+ Bc/HBjBgVzgKbycTKIqCx8vmX2E+TyqzeAsdSkm4O07M4DlwIUOPhl/Br995sAv2CADQVUuiaPBahC9d
+ XjSENHopaTOI3b0lQmRYFA1D1QlTGjEKgrVWqRFDaQqrUswjHT85qDghQBHtLY/yQqhF01gg9FVE+qD9
+ T2e7IjohO6bx3HEsyWwK9EZfEclwDvdzgG8YzgSn4eP80Mfxgb/LfQ+rfw+nmSN/bQ9VyaOpdPu/GM4P
+ 0YJBAl1MEENxAnAAnEBKqCdsGEwmTAjK1OZEqCXhMCEcAiynWRYOAD3FosnaNBQKC3rJYot0iZSctbYc
+ IwZdbkRHQUxNNg8F0j+CjxBVFhf0UVkKA6jAnWSHukOQ4cUct3SWGw4H7C8SqsDHBtwEuEAEU2xzkKu1
+ l+VjtqttiMMf1cn+u215md7mHPfHiMiBjg/QpbDczDhu5tF0eyRgxECYbr4owBDy0axqcwVN8sgWeQSM
+ R5vDaVWED1SIJutTZrXiuaaM5z2FkGfdBbudeRAjBnV6sCaL05QnMIhWEdEoD9fkhtVL+QZRZXDKU5io
+ 2yCFIoZM4AMDA0EGNgVcMpIGrAu1DWpMVI0Myj3UPEFuNp4WfwgDHg/XiN7M1kyUCsHVASFaFDQqbIo5
+ MMPBMkJJyylNCkEKQ6GA6KmXk8Gns0iIqgyWg6JhXJU0p8lAwYaybbtbvtch2+9WvOgvfDmofDVcYsTQ
+ mS9AFQSqyyDw+v8uSNiIZSR7JYmol0SqsyPARJQkhCDho0CEBSN7wEkE/vYRdAcIw/0/ve1+QytLs/+9
+ sybh12kf8WpgpyOXZKvATYDFcnqEjh6/gugnjfavEfPqMvgNWfzGrFBUOu1yAcjM4fKkFa10tVmyppOu
+ 6yWbrbLdTvlBX+HxcPFZf/6bkeJPU5Xf5muvF+uMGHqLIvqLI3tLYyB9ZbHoTgYr44arE0ZUiaM1Se0l
+ Il1BlEYWASYCMDSy6MbcGAjKUpR0JGcTHwRVEJFTuJ4JHCrf77Gv4z2OtwNaSl15ws5Y6U5fYU6wdeBd
+ m353ROZIZEg+oPhLklgtckFbXlR3QQxUHylPmKlJX2nK2WpTbOmle+2Kg+7Cg578/e68o76Cs9Gyt9NV
+ VzMV12AYVu8oiHWNEcOCJgWCqhMl50KjeK4hbaYuBTKtTsYTrGinMrolTwBqCCGiWSbQ5UZCkHSQaOpz
+ QqvSWYhmIP9EgXYC2lPQDUGulnxvSqCLFaKNMoG+3FoUh2YdGDzh9485no8R4hD9UJvBcfVSXrsivK84
+ FlTDTG3ysjZzu1XyvEvxrFN+1Fd4OlIG1c9GS15PlH9cUF2DtF2uvVlR366ii6zD2ojher0JJAq6mXcz
+ Nedj5ccDRTC43XbpVkv2ph7AxMAGWWzMmq1Ln6hOGUaHWSxsk/Nbc3m6XK5Oxm+U8FCoyiOpYrY9qhUe
+ xZrr5iTwIXtFgPy8PlAtYoPVCnJ9iAIpKdheHu2B72slrM78cJz8iCoe5P5KS9Zmu3S3K/dZj+J5r/zF
+ kBI9yeVM1ds51du5KrA7V+t1N7tNP3YaDXK9rfm2WW/EgI7+GuzQ806SoN4EXdd4tVT/ZbEODCnkcqIU
+ bdq76aq3k9WvxypOBoqPegr2O/KfdUp32iRb7ZK9LsXBQNFeT8FiU+ZYdXy9hJ0f7ZcSRE0NoZYmB8zp
+ Ml9P19cnM9HTRfpZopXDAY7V4oSTljWpu+05r2ZVl8sNnzf13/bafuy1Xu+2XO80Qz6uNnzZ0H7d1n7b
+ abraavi6rbne097u64iTTuIVONwuLH697DBiOBtSvOyTng7kG+RssAAMO0ihz7PV6JhBXkDAAHxfUH+d
+ q/k6BxKp/mYZvFjT9bIaLShIse9r2i9LmpPR0u0O6bwueViViPhYEOutU4RcLFZ8XKqFQSvi/PJFvvrC
+ 6P2Rqu9brd9WG0k6cFd/9bzjx4se4nSIeD1MXIAi6CeJ55MukiY8H7iT3juNO0h51Um87ifeDJITAjxf
+ 9xsxLGrT5jUpK82SJW32fEMGZEFDWg6ec/VieMiiNgPesqrP2WzPBcf6rLdwv195PlIOY4W8Gq08n1Cd
+ T6rPJmpPx9XzbfkzenmDlKMQOC/pMt7Mq8C9Xm83aguFWTynvuJooL3Z0P5Yb7rdgU6gynuIsz5wsr/O
+ e39d9P287L+57Lu+6Lk9I+Xnea9BsL457f7xquv2dd9/FyOG7U7ZVod0s02x3pK7qpNC1vQygwAY1IXS
+ UH29VQokgATOi/T4mgQwlgPKyL6iqMESsL/xg2VxvSVxqIozeS4JAU/0irDXs3XEYS/xohfW3FstBobm
+ HNbLkRKcG2hw4nkPsd9HksrgxjF2uegnLgfu9njw15sBAwCgIl9i198NE+9HiA+jeEO+xGnciRHDXo9i
+ pysXBg1FQUJis7c7FQbBRzDbh4PK5334KX4kXb3z8kVtOjDDxbGvbfIw5FS9Ar11aH0mB7QFcnl+jA/Y
+ 1f2B8pOxSuKo72anbbW3slDoU5lIH6kQLjamHvQXvBwufTla9m5V/XGj4esz3c1R+89XJBjyQLD3wICj
+ OO0mOfOTzn/kH+3/B4at9uz1lgwkke122WYrEooEC2QlPLfapFgYBF+A/PMRvAESSGdhFCIvSN/pJtms
+ Tj7TnNskF6nEYWBfekoSx6vTQDB/WdHdbLf3V6fLIt01Ody5piwcKfbldKwCE4nrPR2GFT+PwJP3ExeD
+ Rn9AZnw3QrwdJi4HyfM57yMPCk9y0Uec9v4jxnM46svb75Eie4PIQFQ96MnDAh+RVrDA07DA++ddZKon
+ w1FL9nqbHOGlRcGvFQdVpwaUJvqhwYe15Ap8M7lUMcs5T+C501XSJuOdjlW9mamdbJICA7iMjmIhGG/M
+ 444GlChD3i2qIJ8Q7Hd15AhvS/t1XfN9U4uTwQjm+37Lj8O2v+0NGPp/HbZDfh60QW73W40YPi/Vflqs
+ uVqp+4I4s1gDweLraj2EfIk4u1T/ebHu43zte8TByYrzsdLTkeJnvfmgORa0GSBssLXTjRnDqmSwqxWp
+ nJwwary/RU0689tWNyqA88nKn3sdW/0VmXxcErAmmYfUoNa80LEq4ao2fUGbuKBJ2GgVHw8XXE6VvZks
+ ezddAfb/3XLN+5XaD6vqT+v1nzca/pFrxMM7AU4wvEYMhiEIsddK7Oh/bjX/2sYks4V41ka+2WtFukAM
+ udloRuqAYI0331Y0SD1IQBdTFacTFfAZUGnjqoQuZQSoENRXOJbNHuWX9ZbZ+qTvm80ImmP1WQkMK/Qk
+ cO6JRtk04l5jGqYw+325e92S48G8j3PVIP2/LapvVzTETitx1Em86DLKYQeOCLz61YbmdrsZglETBHy7
+ EcO3FTVynGESBSIeT6zxxiBvJiuQ4N7PVH+cq4FggZR3OVGOb2J0S/7F3dav69qzyUoEt7mGlIq0IJS9
+ 1eLA92stp1NVL0aKMKf7sqa+WGrBCKtMzO6uzsQtgp7SuN1uBXHQTRx2QhsUEeQOrms/T1d9nCj/NleD
+ GRIJ4ATJoY98vuj6td+GSR+5uYb9xUbv6I0Yfqw03Kxq3s5UXEyUYLRDyoTy25KK2Gz4vlh1PFL6YrgE
+ mRihCfaDJ9bY+F8nrcRF94+TtptXHYh91wft4OvHqmL1abwuSdRYecrrqaaLae1uX+nX7R7ieOzrRm+f
+ Mq42OWhWnd2eGzFUHL+uk7+d0V6/6LzC0Oh06MNK46elxvPRqvcTtTvNktfjZcieN6jtNhuJZzpio+7n
+ YjmxXPlloeHdlOrrCrJq44vBYiOG8yHlxXDx+wVkqNKT0eKT4YL9LsmLPtnlaNH5cN7rGdV+f8FGWw7o
+ SpgNPoK9XNFlnM6V3B63Eu8Rtod+HHecTJevt2ZvtGaPlgvn61Owx9e7bV93Wy+XaonzQeLNMPFx/sNa
+ E/j6i1nVaHXskk58Oa8iXvbdvmonzruQBFBNvJ6tOBtTvhoqWqxLmKyMRjnzFXaF6mNNAxv7iUJ1rwVm
+ /HWh7vtSw5e5WmhuxHA5Xgnu+nm/Ek3G/mDR+VT1yVgZCod3oOZXNJjonE2Vn4yXYIERG3E2dL2jx5tP
+ 6+rbo1ZDiv2+33Y4pgROhK/LhQpMWG6PWogPw8Rp+5d9DXHZ+eus9eaF7vZYjzc/X7YdTOR92FITb/qJ
+ T6PXx03EOySynq97jYcj8vPpkhfDisUG0UZLzlaH7Hyq5mxShTg+2yDe6CyETKkSEf1fDha/n66BBf0d
+ WwdKjgZKdHmRzYqICU324ZjqxVjNwUjF+XTd+yXtbm/u8VjxB9Q2h13ExQg5SD8bwv4Rr8eJ12NknXM+
+ TLzsf7/W+G4B49A+xMRbVDuI7h9Gfp1B+07iI86hh9T43SDxEX+h/2q/mXjdCwv8cqBHFiM+TyMtfNrS
+ rXVKLmZrMARbQ9fWVdRZGNOQzSlJCEhg2OASFC4QgTeI9rXAHKMihYkOGzM+IwZMnSFJLGfcAcCdA1zY
+ QcdTLWZjBIgas6UwdFiduN6bfzhZ9XK29nim5mROfbpQv4w2pbd4a6hsY0AJ8h1cA64vfFrSvd/s+Ljd
+ cXs8/PV595u1ZpR0P08Gfh33Xz/v+Lyle7/e9GJa9Wy0bGuoZK2/eKI5e3dE9WKmca27ZEIjRTs6osoa
+ rMhsy4uvyeTHYwBJfcRyfeBt8R/gEEA+kANoN4sgT2vMWfg067z4YCOGYNf7IW5gm83BDqHK5/tYhLia
+ BDr9yaGY8D3MmM6/syn3wn3MhIHWiSwHiCjIJtrfIoFhh9thmMniozDQMtL7ocjHVMZ3QZUhj/RUZ3Ea
+ srjYxcGKJDD7a62KjVb5XnfR0XDVbKOkuzgOjEkWn4J7ZylM59Rglzg/W4HHU6btvRgf2zi6c5ibBeYP
+ Afb3oDqmQeByMKlCF0VicLfxdn5Ksb7vYXv/v+5rUKz+pNrc87J/6GrxO67I4DqT6+N/eVj+5ud439eO
+ vBR3d9vgPggLsEPgiEAiAS3b9XGIqzluHPnY/YZpMUkJ+zyJo1tL+S4ZIXb1GSwQKv0lQqh+0Ffybq4R
+ de7VsvZ6s31NLwewYiENlE9SkF2cv5XA01TkZ41fj/R+Gu7xBOJv9Z8g8e9ukZADdsyo/Owf4O4PBASP
+ n8OfGLWBFAQLbDwHiu0jDwdzPCnWDz3tH3nZPQIkw4zdy/ovXGTCHTs/l6c0R3P8CII108PW3948nO4q
+ YLjxcSOMTZUIg9Sy2CG1/Hxes91b9Hqh4dVENcrEvW75SmPas3bZmzElhndoiEfKotG1LepkB+Pq/TH1
+ Rn/ZZJNkuUc5pc+d1udp8qNAq6WHuvED3Hn+FAbFCjDC/TDGBf9Lcgj5AvfccFfUlyPqjM6SBCMGHxsT
+ L5uHPjamXlYmEG8bc7qDBd3J2tfRytvBAuSpr4OZj80DUKhhNAfcKQuwf8ClWijCKa2KyMm6zNkGctaP
+ mvftfANxMnL1DM824iU6ssZPKzVnY4XH/YqLsWKkmouhvPOBgrejZa+Hit+Pl+G21o9l1a9l9fVsNUiK
+ n+vNF+OVo+VxdWmBlfE03C2CpIS4CQOcoujOMYHuKaH+2UJuuZiPKUx9dnizNBRlvxED3dEc4mX7p6fN
+ H7if6GH9O+h1GBJ8A7M9WCRoCAibYhrsfA9OAjJ0pCEXO/3jedfNfjfyABmmLoZQHZD97mbD11X1XbJv
+ QK9DbLVAoB9Kr522bJSP31dbPi9oLyerUIOhJHs7WrKuSSG73KGS0/GayzntVH3WWoeyrTilQRaTL2SA
+ IGXj/oAzOaGL9ncANQgrwpgPlIouX2jEAPPA5Teq7X/4uvzJ8jbl+ZpxvB6EUH4Lcv7fTMd/D3L6VyzD
+ Qh7rWZ8b2lOZOKBKmm7OOZioeb9WRyAsotA/0BNIFIe6z+uqN3MlP5e1H8YqPk3VXM3WvRmtvJrD7auu
+ 78v687na9gLQpuHzTbKR6lSUrls9+Rfz6heDpego0BspYzxwp6VdGacvEHVVpNblRtfLY3AlCzc70MSC
+ ZUxj26WE2ICQB7EpifYvTGKrJNFGDDA4prulkEfNFjEqZZEtZUm9tWnj2szF9tyt3qL98Yrj2erTRfXV
+ LoqLUeKk7+uuHs07GhfcULraafq4VocCEykW6enzKu5ukO77fqru1VD5SHkciDokJty42hoorUoLwjwK
+ AVQu8M6L9h6oTtnsL9kfUW33lWXzEZ1sUkNwSda2XhEljfZVxPlW5/B6qpNn9LlLrbKZxvTBSmGPMkwn
+ D6/JYKFZx2UqUCRGDORIxtEEswWwdJhdp3MouObTmBOGafR+f+X5ourXyy7i4wTZCr7s/LhW82GlGrv+
+ crJ6vjmzLZ+PUeJgmbBTEdYhD51SJU/UJLblh3UqI0FwJIdYJAZbKuK9MRStzWbnRlGV8Qwwk8kYMgXa
+ Fif61WSxypL8kVvj/Z+IuQ6SCLc0lkO9LDyD75IQ9DgnwqlaHNBTFjXfLEYxhvIR1dDZSNGL/vy1JvFg
+ aaReyjJiYDr9hetDvpa/MWx+Z9r+Hmz7G9fhd6GnaS7XuUJEb1Ywtvql1zAYNLKHLRdzpS/HFe+XK8bV
+ KXo5ryzOB/6nTgmqFPlq0ljTqoxxTaq+KFybx9PIeRVihlrK1RZFVmWzO4oEg1WJ0xrJiCoDFBsCCyYg
+ PaUx4BTBL07Wp+FK2mxT1uFY1d5g6f5IxdV2+9V267ft1qtN/Ze1po/LGtQ+b2ar340rP89Wfl6oxq2i
+ s4kyIwY0JdXpwVopFx0Myvr1rsK9/rLD0cpX0+qLec3H3WaSM70YIEsjNOMnnSTJ87LjbK7qLe5JLqpR
+ YCOMHo+UX0zV/drr+7zZejFffzyBl6SDflpu/bDY+npa+2ZBffu86/t215v5prcLzZdzmjcLdYgHn1Ya
+ UVPiNh2u+kEn4qAL1Sex34ko/AFU0Ir2eqsFrez1dtuXteYPSxpUnMcjJa/GK15NVp7PqIwY2gujR6qT
+ DwZzT6eL0TThAhsqfrJqPwPhM3r7Cm3uCCigqz399UEredPwsIX05rM24l3vzxf6T+u113tNYLWOR5XL
+ TamrzSTZuKHNXq1LX6/LXKlOWypL2VBlztaJnvXkYvK91Jhx0KdEpz7fkHjQL389WYpK+aBX9moo73Ki
+ +HKs8HRQftSdfdIjP+yUbOkzlhpSxiuFIIVbZNzGTKauIBJmWRRPk0VS8oVef/eiG3BKFWgF3OkkTd9A
+ +BgE3fdF76/nTV821J836r7ttdzg/iTqvMtx4qwHBvZxq/7det3pUtX+ZNH6QO5Kr+RwuBgMO6Ybu715
+ 2Kqz6ernA4XL+kx0eSOVIngL7jDiFjLK5KPhstNJ1dmc6uVUxcFo8XafYkEvnqjHjCcJi66i2BlNDmSl
+ NX+oMhkft7pLIM8HqxZ18pcT9UejtRhQGDH8v/6//wOxEBXYZyzgPgAAAABJRU5ErkJggg==
+</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/mcs/doctools/etc/gui/TextResources.resx b/mcs/doctools/etc/gui/TextResources.resx
new file mode 100644
index 00000000000..29d380cc385
--- /dev/null
+++ b/mcs/doctools/etc/gui/TextResources.resx
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 1.3
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">1.3</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1">this is my long string</data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ [base64 mime encoded serialized .NET Framework object]
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>1.3</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="Monodoc.Version">
+ <value>0.0</value>
+ </data>
+ <data name="Form.About.Title">
+ <value>About Monodoc</value>
+ </data>
+ <data name="Menu.File">
+ <value>File</value>
+ </data>
+ <data name="Menu.File.Exit">
+ <value>Exit</value>
+ </data>
+ <data name="Menu.Edit">
+ <value>Edit</value>
+ </data>
+ <data name="Menu.Window">
+ <value>Window</value>
+ </data>
+ <data name="Menu.Help">
+ <value>Help</value>
+ </data>
+ <data name="Menu.Window.About">
+ <value>About Monodoc...</value>
+ </data>
+ <data name="Menu.Window.Cascade">
+ <value>Cascade</value>
+ </data>
+ <data name="Menu.Window.TileHorizontal">
+ <value>Tile Horizontal</value>
+ </data>
+ <data name="Menu.Window.TileVertical">
+ <value>TileVertical</value>
+ </data>
+ <data name="Form.Main.Title">
+ <value>Monodoc</value>
+ </data>
+ <data name="Buttons.Close">
+ <value>Close</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/mcs/doctools/etc/gui/readme.txt b/mcs/doctools/etc/gui/readme.txt
new file mode 100644
index 00000000000..2b54b334365
--- /dev/null
+++ b/mcs/doctools/etc/gui/readme.txt
@@ -0,0 +1,20 @@
+Monodoc GUI Graphical Resources
+-------------------------------
+These are the original files for graphical resources that end up in
+ImageResources.resx.
+
+Filename --> Resource Name
+
+AboutMonodoc.png --> AboutMonodoc.Bitmap
+AssemblyBrowser.png --> AssemblyTree.Bitmap
+
+* TODO: Figure out a way to generate the .resx file programatically.
+
+
+Monodoc GUI Text Resources
+--------------------------
+These files contain text used by the GUI, such as menu and button names,
+abstracted out for easy internationalization.
+
+TextResources.resx --> Standard (English) text resources.
+
diff --git a/mcs/doctools/etc/monodoc.dtd b/mcs/doctools/etc/monodoc.dtd
new file mode 100644
index 00000000000..fbdac7184ed
--- /dev/null
+++ b/mcs/doctools/etc/monodoc.dtd
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Root element -->
+<!ELEMENT monodoc (class | delegate | enum | interface | struct)*>
+<!ATTLIST monodoc
+ language CDATA #REQUIRED
+>
+
+<!-- Type-level tags -->
+<!ELEMENT class (summary, remarks?, (class | delegate | enum | interface | struct | constructor | event | field | method | operator | property)*, seealso*)>
+<!ATTLIST class
+ name CDATA #REQUIRED
+ assembly CDATA #IMPLIED
+>
+
+<!ELEMENT delegate (summary, remarks?, param*, seealso*)>
+<!ATTLIST delegate
+ name CDATA #REQUIRED
+ assembly CDATA #IMPLIED
+>
+<!ELEMENT enum (summary, remarks?, member+)>
+<!ATTLIST enum
+ name CDATA #REQUIRED
+ assembly CDATA #IMPLIED
+>
+
+<!ELEMENT interface (summary, remarks?, seealso*)>
+<!ATTLIST interface
+ name CDATA #REQUIRED
+ assembly CDATA #IMPLIED
+>
+
+<!ELEMENT struct (summary, remarks?, (class | delegate | enum | interface | struct | constructor | event | field | method | operator | property)*, seealso*)>
+<!ATTLIST struct
+ name CDATA #REQUIRED
+ assembly CDATA #IMPLIED
+>
+
+<!-- Member-level tags -->
+<!ELEMENT constructor (summary, remarks?, param*, exception*, seealso*)>
+<!ATTLIST constructor
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT event (summary, remarks?, data, seealso*)>
+<!ATTLIST event
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT field (summary, remarks?, seealso*)>
+<!ATTLIST field
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT method (summary, remarks?, param*, exception*, returns?, seealso*)>
+<!ATTLIST method
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT operator (summary, remarks?, param*, exception*, returns?, seealso*)>
+<!ATTLIST operator
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT property (summary, remarks?, value, exception*, seealso*)>
+<!ATTLIST property
+ name CDATA #REQUIRED
+>
+
+<!-- Member-info level tags -->
+<!ELEMENT data (#PCDATA | c | example | list | para | see)*>
+
+<!ELEMENT exception (#PCDATA | c | example | list | para | paramref | see)*>
+<!ATTLIST exception
+ cref CDATA #REQUIRED
+>
+
+<!ELEMENT member (#PCDATA | c | see)*>
+<!ATTLIST member
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT param (#PCDATA | c | example | list | para | see)*>
+<!ATTLIST param
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT remarks (#PCDATA | c | example | list | para | paramref | see)*>
+
+<!ELEMENT returns (#PCDATA | c | example | list | para | paramref | see)*>
+
+<!ELEMENT seealso EMPTY>
+<!ATTLIST seealso
+ cref CDATA #REQUIRED
+>
+
+<!ELEMENT summary (#PCDATA | c | example | list | para | paramref | see)*>
+
+<!ELEMENT value (#PCDATA | c | example | list | para | paramref | see)*>
+
+<!-- Formatting and presentation tags -->
+
+<!ELEMENT c (#PCDATA)>
+
+<!ELEMENT code (#PCDATA)>
+<!ATTLIST code
+ lang CDATA #REQUIRED
+>
+
+<!ELEMENT description (#PCDATA | c | see)*>
+
+<!ELEMENT example (#PCDATA | c | code | para | see)*>
+
+<!ELEMENT item (term?, description)>
+
+<!ELEMENT list (listheader?, item+)>
+<!ATTLIST list
+ type (bullet | number | table) #REQUIRED
+>
+
+<!ELEMENT listheader (term?, description)>
+
+<!ELEMENT para (#PCDATA | c | example | list | paramref | see)*>
+
+<!ELEMENT paramref EMPTY>
+<!ATTLIST paramref
+ name CDATA #REQUIRED
+>
+
+<!ELEMENT see (#PCDATA)>
+<!ATTLIST see
+ cref CDATA #REQUIRED
+>
+
+<!ELEMENT term (#PCDATA)>
diff --git a/mcs/doctools/makefile b/mcs/doctools/makefile
new file mode 100755
index 00000000000..c7fe192bd46
--- /dev/null
+++ b/mcs/doctools/makefile
@@ -0,0 +1,11 @@
+docstub:
+ NAnt docstub
+
+docval:
+ NAnt docval
+
+gui:
+ NAnt gui
+
+clean:
+ rm -rf build
diff --git a/mcs/doctools/src/Console/docstub.cs b/mcs/doctools/src/Console/docstub.cs
new file mode 100644
index 00000000000..ca23f7675bb
--- /dev/null
+++ b/mcs/doctools/src/Console/docstub.cs
@@ -0,0 +1,693 @@
+// docstub.cs
+//
+// Adam Treat (manyoso@yahoo.com)
+// (C) 2002 Adam Treat
+//
+// DocStub is based heavily upon the NDoc project
+// ndoc.sourceforge.net
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+
+
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+using System.Xml;
+using System.Text;
+
+namespace Mono.Util {
+
+ class DocStub {
+
+ Assembly assembly;
+ bool nested;
+ string assembly_file, directory, language, classname, currentNamespace, docname;
+
+ void Usage()
+ {
+ Console.Write (
+ "docstub -l <lang> -d <directory> -a <assembly>\n\n" +
+ " -d || --dir <directory> The directory to write the xml files to.\n" +
+ " -a || --assembly <assembly> Specifies the target assembly to load and parse.\n" +
+ " -l || --language <two-letter ISO code> Specifies the language encoding.\n\n");
+ }
+
+ public static void Main(string[] args)
+ {
+ DocStub stub = new DocStub(args);
+ }
+
+ public DocStub(string[] args)
+ {
+ assembly_file = null;
+ directory = null;
+ int argc = args.Length;
+
+ for(int i = 0; i < argc; i++) {
+
+ string arg = args[i];
+
+ if(arg.StartsWith("-")) {
+
+ switch(arg) {
+
+ case "-d": case "--directory":
+ if((i + 1) >= argc) {
+ Usage();
+ return;
+ }
+ directory = args[++i];
+ continue;
+
+ case "-a": case "--assembly":
+ if((i + 1) >= argc) {
+ Usage();
+ return;
+ }
+ assembly_file = args[++i];
+ continue;
+ case "-l": case "--language":
+ if((i + 1) >= argc) {
+ Usage();
+ return;
+ }
+ language = args[++i];
+ continue;
+
+ default:
+ Usage();
+ return;
+ }
+ }
+ }
+
+ if(assembly_file == null) {
+ Usage();
+ return;
+ } else if(directory == null) {
+ Usage();
+ return;
+ }
+
+ if (!Directory.Exists(directory) && directory != null) {
+ Directory.CreateDirectory(directory);
+ }
+
+ // Call the main driver to get some things done
+ MakeXml();
+ }
+
+ // Builds an XmlDocument with the reflected metadata
+ private void MakeXml()
+ {
+ try {
+ assembly = LoadAssembly(Path.GetFullPath(assembly_file));
+ }
+ catch (Exception e) {
+ Console.WriteLine(e.Message);
+ }
+ Write();
+ }
+
+ private void Write()
+ {
+ foreach(Module module in assembly.GetModules()) {
+ WriteNamespaces(module);
+ }
+ }
+
+ private void WriteNamespaces(Module module)
+ {
+ Type[] types = GetMyTypes(module);
+ StringCollection namespaceNames = GetNamespaceNames(types);
+ XmlTextWriter dummy = new XmlTextWriter("temp.xml", new UTF8Encoding());
+
+ foreach (string namespaceName in namespaceNames) {
+ currentNamespace = namespaceName;
+ WriteClasses(dummy, types);
+ WriteInterfaces(dummy, types);
+ WriteStructures(dummy, types);
+ WriteDelegates(dummy, types);
+ WriteEnumerations(dummy, types);
+ }
+
+ dummy.Close();
+ File.Delete("temp.xml");
+ }
+
+ private XmlTextWriter StartDocument()
+ {
+ if (!Directory.Exists(directory+"/"+currentNamespace) && directory != null) {
+ Directory.CreateDirectory(directory+"/"+currentNamespace);
+ }
+
+ string filename = directory+"/"+currentNamespace+"/"+docname+".xml";
+ XmlTextWriter writer = new XmlTextWriter (filename, new UTF8Encoding());
+ writer.Formatting = Formatting.Indented;
+ writer.Indentation=4;
+ writer.WriteStartDocument();
+ writer.WriteDocType("monodoc", null, "http://www.go-mono.org/monodoc.dtd", null);
+ writer.WriteStartElement("monodoc");
+ writer.WriteAttributeString("language",language);
+ return writer;
+ }
+
+ private void EndDocument(XmlTextWriter writer)
+ {
+ writer.WriteEndElement();
+ writer.WriteEndDocument();
+ nested = false;
+ writer.Close();
+ }
+
+ private bool IsDelegate(Type type)
+ {
+ return type.BaseType.FullName == "System.Delegate" ||
+ type.BaseType.FullName == "System.MulticastDelegate";
+ }
+
+ private string GetTypeName(Type type)
+ {
+ return type.FullName.Replace('+', '.');
+ }
+
+ private StringCollection GetNamespaceNames(Type[] types)
+ {
+ StringCollection namespaceNames = new StringCollection();
+ foreach (Type type in types) {
+ if (!namespaceNames.Contains(type.Namespace)) {
+ namespaceNames.Add(type.Namespace);
+ }
+ }
+ return namespaceNames;
+ }
+
+ private bool IsAlsoAnEvent(Type type, string fullName)
+ {
+ bool isEvent = false;
+
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.DeclaredOnly;
+
+ foreach (EventInfo eventInfo in type.GetEvents(bindingFlags)) {
+
+ if (eventInfo.EventHandlerType.FullName == fullName) {
+
+ isEvent = true;
+ break;
+ }
+ }
+
+ return isEvent;
+ }
+
+ private bool IsAlsoAnEvent(FieldInfo field)
+ {
+ return IsAlsoAnEvent(field.DeclaringType, field.FieldType.FullName);
+ }
+
+ private bool IsAlsoAnEvent(PropertyInfo property)
+ {
+ return IsAlsoAnEvent(property.DeclaringType, property.PropertyType.FullName);
+ }
+
+ // Loads an assembly.
+ public static Assembly LoadAssembly(string filename)
+ {
+ if (!File.Exists(filename)) {
+ throw new ApplicationException("can't find assembly " + filename);
+ }
+
+ FileStream fs = File.Open(filename, FileMode.Open, FileAccess.Read);
+ byte[] buffer = new byte[fs.Length];
+ fs.Read(buffer, 0, (int)fs.Length);
+ fs.Close();
+
+ return Assembly.Load(buffer);
+ }
+
+ private Type[] GetMyTypes(Module module)
+ {
+ int i = 0;
+ Type[] temp = module.GetTypes();
+ ArrayList list = new ArrayList();
+ foreach (Type type in temp) {
+ if (MustDocumentType(type)) {
+ list.Add(type);
+ }
+ }
+ Type[] types = new Type[list.Count];
+ foreach (Type type in list) {
+ types[i++] = type;
+ }
+ return types;
+ }
+
+ private bool MustDocumentType(Type type)
+ {
+ if (type != null) {
+ return ((type.IsPublic ||
+ type.IsNestedPublic) &&
+ !type.FullName.Equals("Driver") &&
+ !type.FullName.Equals("Profile"));
+ } else {
+ return false;
+ }
+ }
+
+ private bool MustDocumentMethod(MethodBase method)
+ {
+ return (method.IsPublic);
+ }
+
+ private bool MustDocumentField(FieldInfo field)
+ {
+ return (field.IsPublic);
+ }
+
+ private string GetParameterTypes(ParameterInfo[] parameters)
+ {
+ if (parameters.Length != 0) {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("(");
+ foreach (ParameterInfo parameter in parameters) {
+
+ sb.Append(GetTypeName(parameter.ParameterType) + ", ");
+ }
+ sb.Remove(sb.Length-2, 2);
+ sb.Append(")");
+ return sb.ToString();
+ } else {
+ return "";
+ }
+ }
+
+ private void WriteClasses(XmlTextWriter writer, Type[] types)
+ {
+ foreach (Type type in types) {
+ if (type.IsClass && !IsDelegate(type) && type.Namespace.Equals(currentNamespace)) {
+ classname = type.FullName;
+ docname = type.Name;
+ if (!nested) {
+
+ writer = StartDocument();
+ WriteClass(writer, type);
+ EndDocument(writer);
+ } else {
+ WriteClass(writer, type);
+ }
+ }
+ }
+ }
+
+ private void WriteInterfaces(XmlTextWriter writer, Type[] types)
+ {
+ foreach (Type type in types) {
+
+ if (type.IsInterface && type.Namespace.Equals(currentNamespace)) {
+
+ classname = type.FullName;
+ docname = type.Name;
+ if (!nested) {
+
+ writer = StartDocument();
+ WriteInterface(writer, type);
+ EndDocument(writer);
+ } else {
+ WriteInterface(writer, type);
+ }
+ }
+ }
+ }
+
+ private void WriteStructures(XmlTextWriter writer, Type[] types)
+ {
+ foreach (Type type in types) {
+
+ if (type.IsValueType && !type.IsEnum && type.Namespace.Equals(currentNamespace)) {
+
+ classname = type.FullName;
+ docname = type.Name;
+ if (!nested) {
+
+ writer = StartDocument();
+ WriteClass(writer, type);
+ EndDocument(writer);
+ } else {
+ WriteClass(writer, type);
+ }
+ }
+ }
+ }
+
+ private void WriteDelegates(XmlTextWriter writer, Type[] types)
+ {
+ foreach (Type type in types) {
+
+ if (type.IsClass && IsDelegate(type) && type.Namespace.Equals(currentNamespace)) {
+
+ classname = type.FullName;
+ docname = type.Name;
+ if (!nested) {
+
+ writer = StartDocument();
+ WriteDelegate(writer, type);
+ EndDocument(writer);
+ } else {
+ WriteDelegate(writer, type);
+ }
+ }
+ }
+ }
+
+ private void WriteEnumerations(XmlTextWriter writer, Type[] types)
+ {
+ foreach (Type type in types) {
+
+ if (type.IsEnum && type.Namespace.Equals(currentNamespace)) {
+
+ classname = type.FullName;
+ docname = type.Name;
+ if (!nested) {
+
+ writer = StartDocument();
+ WriteEnumeration(writer, type);
+ EndDocument(writer);
+ } else {
+ WriteEnumeration(writer, type);
+ }
+ }
+ }
+ }
+
+ // Writes XML documenting a class or struct.
+ private void WriteClass(XmlTextWriter writer, Type type)
+ {
+ Type[] types = type.GetNestedTypes();
+ AssemblyName assemblyName = assembly.GetName();
+ bool isStruct = type.IsValueType;
+ nested = false;
+
+ writer.WriteStartElement(isStruct ? "struct" : "class");
+ writer.WriteAttributeString("name", type.FullName);
+ writer.WriteAttributeString("assembly", assemblyName.Name);
+ writer.WriteElementString("summary","TODO");
+ writer.WriteElementString("remarks","TODO");
+
+ WriteClasses(writer, types);
+ WriteInterfaces(writer, types);
+ WriteStructures(writer, types);
+ WriteDelegates(writer, types);
+ WriteEnumerations(writer, types);
+
+ WriteConstructors(writer, type);
+ WriteFields(writer, type);
+ WriteProperties(writer, type);
+ WriteMethods(writer, type);
+ WriteOperators(writer, type);
+ WriteEvents(writer, type);
+
+ writer.WriteEndElement();
+ }
+
+ // Writes XML documenting an interface.
+ private void WriteInterface(XmlTextWriter writer, Type type)
+ {
+ AssemblyName assemblyName = assembly.GetName();
+
+ writer.WriteStartElement("interface");
+ writer.WriteAttributeString("name", type.FullName);
+ writer.WriteAttributeString("assembly", assemblyName.Name);
+ writer.WriteElementString("summary","TODO");
+ writer.WriteElementString("remarks","TODO");
+ writer.WriteEndElement();
+ }
+
+ // Writes XML documenting a delegate.
+ private void WriteDelegate(XmlTextWriter writer, Type type)
+ {
+ AssemblyName assemblyName = assembly.GetName();
+
+ writer.WriteStartElement("delegate");
+ writer.WriteAttributeString("name", type.FullName);
+ writer.WriteAttributeString("assembly", assemblyName.Name);
+ writer.WriteElementString("summary","TODO");
+ writer.WriteElementString("remarks","TODO");
+ writer.WriteEndElement();
+ }
+
+ // Writes XML documenting an enumeration.
+ private void WriteEnumeration(XmlTextWriter writer, Type type)
+ {
+ Type[] types = type.GetNestedTypes();
+ AssemblyName assemblyName = assembly.GetName();
+
+ writer.WriteStartElement("enum");
+ writer.WriteAttributeString("name", type.FullName);
+ writer.WriteAttributeString("assembly", assemblyName.Name);
+ writer.WriteElementString("summary","TODO");
+ writer.WriteElementString("remarks","TODO");
+
+ writer.WriteStartElement("member");
+ writer.WriteAttributeString("name", "TODO");
+ writer.WriteEndElement();
+
+ writer.WriteEndElement();
+ }
+
+ private void WriteConstructors(XmlTextWriter writer, Type type)
+ {
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Public |
+ BindingFlags.NonPublic;
+
+ ConstructorInfo[] constructors = type.GetConstructors(bindingFlags);
+
+ foreach (ConstructorInfo constructor in constructors) {
+
+ if (MustDocumentMethod(constructor)) {
+
+ WriteConstructor(writer, constructor);
+ }
+ }
+ }
+
+ private void WriteFields(XmlTextWriter writer, Type type)
+ {
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic;
+
+ foreach (FieldInfo field in type.GetFields(bindingFlags)) {
+
+ if (!IsAlsoAnEvent(field) && MustDocumentField(field)) {
+
+ WriteField(writer, field);
+ }
+ }
+ }
+
+ private void WriteProperties(XmlTextWriter writer, Type type)
+ {
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic;
+
+ PropertyInfo[] properties = type.GetProperties(bindingFlags);
+
+ foreach (PropertyInfo property in properties) {
+
+ MethodInfo getMethod = property.GetGetMethod(true);
+ MethodInfo setMethod = property.GetSetMethod(true);
+
+ bool hasGetter = (getMethod != null);
+ bool hasSetter = (setMethod != null);
+
+ if ((hasGetter || hasSetter) && !IsAlsoAnEvent(property)) {
+
+ WriteProperty(writer, property, property.DeclaringType.FullName != type.FullName);
+ }
+ }
+ }
+
+ private void WriteMethods(XmlTextWriter writer, Type type)
+ {
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic;
+
+ MethodInfo[] methods = type.GetMethods(bindingFlags);
+
+ foreach (MethodInfo method in methods) {
+
+ if (!(method.Name.StartsWith("get_")) &&
+ !(method.Name.StartsWith("set_")) &&
+ !(method.Name.StartsWith("add_")) &&
+ !(method.Name.StartsWith("remove_")) &&
+ !(method.Name.StartsWith("op_")) && MustDocumentMethod(method))
+ {
+ WriteMethod(writer, method, method.DeclaringType.FullName != type.FullName);
+ }
+ }
+ }
+
+ private void WriteOperators(XmlTextWriter writer, Type type)
+ {
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic;
+
+ MethodInfo[] methods = type.GetMethods(bindingFlags);
+
+ foreach (MethodInfo method in methods) {
+
+ if (method.Name.StartsWith("op_") && MustDocumentMethod(method)) {
+
+ WriteOperator(writer, method);
+ }
+ }
+ }
+
+ private void WriteEvents(XmlTextWriter writer, Type type)
+ {
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.DeclaredOnly;
+
+ foreach (EventInfo eventInfo in type.GetEvents(bindingFlags)) {
+
+ MethodInfo addMethod = eventInfo.GetAddMethod(true);
+
+ if (addMethod != null && MustDocumentMethod(addMethod)) {
+
+ WriteEvent(writer, eventInfo);
+ }
+ }
+ }
+
+ // Writes XML documenting a field.
+ private void WriteField(XmlTextWriter writer, FieldInfo field)
+ {
+ writer.WriteStartElement("field");
+ writer.WriteAttributeString("name", field.Name);
+ writer.WriteElementString("summary","TODO");
+ writer.WriteElementString("remarks","TODO");
+ writer.WriteEndElement();
+ }
+
+ // Writes XML documenting an event.
+ private void WriteEvent(XmlTextWriter writer, EventInfo eventInfo)
+ {
+ writer.WriteStartElement("event");
+ writer.WriteAttributeString("name", eventInfo.Name);
+ writer.WriteElementString("summary","TODO");
+ writer.WriteElementString("remarks","TODO");
+ writer.WriteElementString("data","TODO");
+
+ writer.WriteEndElement();
+ }
+
+ // Writes XML documenting a constructor.
+ private void WriteConstructor(XmlTextWriter writer, ConstructorInfo constructor)
+ {
+ writer.WriteStartElement("constructor");
+ writer.WriteAttributeString("name", docname + GetParameterTypes(constructor.GetParameters()));
+ writer.WriteElementString("summary","TODO");
+ writer.WriteElementString("remarks","TODO");
+
+ foreach (ParameterInfo parameter in constructor.GetParameters()) {
+
+ WriteParameter(writer, parameter);
+ }
+
+ writer.WriteEndElement();
+ }
+
+ // Writes XML documenting a property.
+ private void WriteProperty(XmlTextWriter writer, PropertyInfo property, bool inherited )
+ {
+ if (!inherited) {
+
+ writer.WriteStartElement("property");
+ writer.WriteAttributeString("name", property.Name);
+ writer.WriteElementString("summary","TODO");
+ writer.WriteElementString("remarks","TODO");
+ writer.WriteElementString("value","TODO");
+
+ writer.WriteEndElement();
+ }
+ }
+
+ // Writes XML documenting an operator.
+ private void WriteOperator(XmlTextWriter writer, MethodInfo method)
+ {
+ if (method != null) {
+
+ writer.WriteStartElement("operator");
+ writer.WriteAttributeString("name", method.Name + GetParameterTypes(method.GetParameters()));
+ writer.WriteElementString("summary","TODO");
+ writer.WriteElementString("remarks","TODO");
+
+ foreach (ParameterInfo parameter in method.GetParameters()) {
+
+ WriteParameter(writer, parameter);
+ }
+
+ writer.WriteElementString("returns", "TODO");
+
+ writer.WriteEndElement();
+ }
+ }
+
+ // Writes XML documenting a method.
+ private void WriteMethod(XmlTextWriter writer, MethodInfo method, bool inherited)
+ {
+ if (!inherited && method != null) {
+
+ writer.WriteStartElement("method");
+ writer.WriteAttributeString("name", method.Name + GetParameterTypes(method.GetParameters()));
+ writer.WriteElementString("summary","TODO");
+ writer.WriteElementString("remarks","TODO");
+
+ foreach (ParameterInfo parameter in method.GetParameters()) {
+
+ WriteParameter(writer, parameter);
+ }
+
+ writer.WriteElementString("returns", "TODO");
+
+ writer.WriteEndElement();
+ }
+ }
+
+ private void WriteParameter(XmlTextWriter writer, ParameterInfo parameter)
+ {
+ writer.WriteStartElement("param");
+ writer.WriteAttributeString("name", parameter.Name);
+ writer.WriteString("TODO");
+ writer.WriteEndElement();
+ }
+ }
+}
diff --git a/mcs/doctools/src/Console/docval.cs b/mcs/doctools/src/Console/docval.cs
new file mode 100644
index 00000000000..9c3b691c609
--- /dev/null
+++ b/mcs/doctools/src/Console/docval.cs
@@ -0,0 +1,94 @@
+// docval.cs
+//
+// Adam Treat (manyoso@yahoo.com)
+// (C) 2002 Adam Treat
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+
+using System;
+using System.Xml;
+
+namespace Mono.Util {
+
+ class DocVal {
+
+ string file;
+
+ void Usage()
+ {
+ Console.Write ("docval [file]\n\n");
+ }
+
+ public static void Main(string[] args)
+ {
+ DocVal val = new DocVal(args);
+ }
+
+ public DocVal(string [] args)
+ {
+ bool pass = true;
+ file = null;
+ int argc = args.Length;
+
+ for(int i = 0; i < argc; i++) {
+ string arg = args[i];
+ if(arg.EndsWith(".xml")) {
+ file = arg;
+ }
+ }
+
+ if(file == null) {
+ Usage();
+ return;
+ }
+
+ try {
+ XmlTextReader read = new XmlTextReader(file);
+ XmlValidatingReader validate = new XmlValidatingReader(read);
+ validate.ValidationType = ValidationType.Auto;
+ while (validate.Read()) {
+ switch (validate.NodeType) {
+ case XmlNodeType.XmlDeclaration:
+ Console.WriteLine("** XML declaration");
+ break;
+ case XmlNodeType.DocumentType:
+ Console.WriteLine("** DocumentType node");
+ break;
+ case XmlNodeType.Document:
+ Console.WriteLine("** Document node");
+ break;
+ case XmlNodeType.Element:
+ Console.WriteLine("** Element: {0}", validate.Name);
+ break;
+ case XmlNodeType.EndElement:
+ Console.WriteLine("** End Element: {0}", validate.Name);
+ break;
+ case XmlNodeType.Text:
+ Console.WriteLine("** Text: {0}", validate.Value);
+ break;
+ case XmlNodeType.Comment:
+ Console.WriteLine("** Comment: {1}", validate.Name, validate.Value);
+ break;
+ case XmlNodeType.Whitespace:
+ break;
+ default:
+ pass = false;
+ Console.WriteLine("** ERROR: Unknown node type");
+ break;
+ }
+ }
+ } catch (Exception e) {
+ pass = false;
+ Console.WriteLine(e);
+ }
+ if(pass) {
+ Console.Write("\n Validation: PASSED!\n\n");
+ } else {
+ Console.Write("\n Validation: FAILED!\n\n");
+ }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/.cvsignore b/mcs/doctools/src/Core/.cvsignore
new file mode 100644
index 00000000000..ebc8ba26975
--- /dev/null
+++ b/mcs/doctools/src/Core/.cvsignore
@@ -0,0 +1,3 @@
+bin
+obj
+*.user
diff --git a/mcs/doctools/src/Core/AbstractClassStructDoc.cs b/mcs/doctools/src/Core/AbstractClassStructDoc.cs
new file mode 100644
index 00000000000..033ea88a5db
--- /dev/null
+++ b/mcs/doctools/src/Core/AbstractClassStructDoc.cs
@@ -0,0 +1,116 @@
+// AbstractClassStructDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public abstract class AbstractClassStructDoc : AbstractTypeDoc
+ {
+ // constructor | event | field | method | operator | property
+ protected ValueConstrainedArrayList constructors;
+ protected ValueConstrainedArrayList events;
+ protected ValueConstrainedArrayList fields;
+ protected ValueConstrainedArrayList methods;
+ protected ValueConstrainedArrayList operators;
+ protected ValueConstrainedArrayList properties;
+
+ // nested items
+ protected ValueConstrainedArrayList classes;
+ protected ValueConstrainedArrayList delegates;
+ protected ValueConstrainedArrayList enums;
+ protected ValueConstrainedArrayList interfaces;
+ protected ValueConstrainedArrayList structs;
+
+ public AbstractClassStructDoc(string name) : base(name)
+ {
+ this.constructors = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.ConstructorDoc", true));
+ this.events = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.EventDoc", true));
+ this.fields = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.FieldDoc", true));
+ this.methods = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.MethodDoc", true));
+ this.operators = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.OperatorDoc", true));
+ this.properties = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.PropertyDoc", true));
+ this.classes = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.ClassDoc", true));
+ this.enums = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.EnumDoc", true));
+ this.interfaces = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.InterfaceDoc", true));
+ this.structs = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.StructDoc", true));
+ }
+
+ public AbstractClassStructDoc() : this(string.Empty)
+ {
+ }
+
+ public ValueConstrainedArrayList Constructors
+ {
+ get { return this.constructors; }
+ }
+
+ public ValueConstrainedArrayList Events
+ {
+ get { return this.events; }
+ }
+
+ public ValueConstrainedArrayList Fields
+ {
+ get { return this.fields; }
+ }
+
+ public ValueConstrainedArrayList Methods
+ {
+ get { return this.methods; }
+ }
+
+ public ValueConstrainedArrayList Operators
+ {
+ get { return this.operators; }
+ }
+
+ public ValueConstrainedArrayList Properties
+ {
+ get { return this.properties; }
+ }
+
+ public ValueConstrainedArrayList NestedClasses
+ {
+ get { return this.classes; }
+ }
+
+ public ValueConstrainedArrayList NestedDelegates
+ {
+ get { return this.delegates; }
+ }
+
+ public ValueConstrainedArrayList NestedEnums
+ {
+ get { return this.enums; }
+ }
+
+ public ValueConstrainedArrayList NestedInterfaces
+ {
+ get { return this.interfaces; }
+ }
+
+ public ValueConstrainedArrayList NestedStructs
+ {
+ get { return this.structs; }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/AbstractDoc.cs b/mcs/doctools/src/Core/AbstractDoc.cs
new file mode 100644
index 00000000000..48eb0b7b26f
--- /dev/null
+++ b/mcs/doctools/src/Core/AbstractDoc.cs
@@ -0,0 +1,77 @@
+// AbstractDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections.Specialized;
+
+namespace Mono.Doc.Core
+{
+ public abstract class AbstractDoc
+ {
+ protected string name;
+ protected string summary;
+ protected string remarks;
+ protected string language;
+ protected StringCollection seeAlso;
+
+ public AbstractDoc(string name)
+ {
+ this.name = name;
+ this.summary = string.Empty;
+ this.remarks = string.Empty;
+ this.language = string.Empty;
+ this.seeAlso = new StringCollection();
+ }
+
+ public AbstractDoc() : this(string.Empty)
+ {
+ }
+
+ public string Summary
+ {
+ get { return this.summary; }
+ set { this.summary = value; }
+ }
+
+ public string Remarks
+ {
+ get { return this.remarks; }
+ set { this.remarks = value; }
+ }
+
+ public string Name
+ {
+ get { return this.name; }
+ set { this.name = value; }
+ }
+
+ public StringCollection SeeAlso
+ {
+ get { return this.seeAlso; }
+ }
+
+ public string Language
+ {
+ get { return this.language; }
+ set { this.language = value; }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/AbstractMethodOperatorDoc.cs b/mcs/doctools/src/Core/AbstractMethodOperatorDoc.cs
new file mode 100644
index 00000000000..33bef57faa4
--- /dev/null
+++ b/mcs/doctools/src/Core/AbstractMethodOperatorDoc.cs
@@ -0,0 +1,59 @@
+// AbstractMethodOperatorDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections.Specialized;
+
+namespace Mono.Doc.Core
+{
+ public abstract class AbstractMethodOperatorDoc : AbstractDoc
+ {
+ protected ValueConstrainedArrayList exceptions;
+ protected StringDictionary parameters;
+ protected string returns;
+
+ public AbstractMethodOperatorDoc(string name) : base(name)
+ {
+ this.exceptions = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.ExceptionDoc", true));
+ this.parameters = new StringDictionary();
+ }
+
+ public AbstractMethodOperatorDoc() : this(string.Empty)
+ {
+ }
+
+ public ValueConstrainedArrayList Exceptions
+ {
+ get { return this.exceptions; }
+ }
+
+ public StringDictionary Parameters
+ {
+ get { return this.parameters; }
+ }
+
+ public string Returns
+ {
+ get { return this.returns; }
+ set { this.returns = value; }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/AbstractTypeDoc.cs b/mcs/doctools/src/Core/AbstractTypeDoc.cs
new file mode 100644
index 00000000000..611024ed7fd
--- /dev/null
+++ b/mcs/doctools/src/Core/AbstractTypeDoc.cs
@@ -0,0 +1,45 @@
+// AbstractTypeDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public abstract class AbstractTypeDoc : AbstractDoc
+ {
+ protected string assembly;
+
+ public AbstractTypeDoc(string name) : base(name)
+ {
+ this.assembly = string.Empty;
+ }
+
+ public AbstractTypeDoc() : this(string.Empty)
+ {
+ }
+
+ public string Assembly
+ {
+ get { return this.assembly; }
+ set { this.assembly = value; }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/AssemblyInfo.cs b/mcs/doctools/src/Core/AssemblyInfo.cs
new file mode 100644
index 00000000000..8e9127507a2
--- /dev/null
+++ b/mcs/doctools/src/Core/AssemblyInfo.cs
@@ -0,0 +1,79 @@
+// AssemblyInfo.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+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("")]
+
+//
+// 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/doctools/src/Core/AssemblyLoader.cs b/mcs/doctools/src/Core/AssemblyLoader.cs
new file mode 100644
index 00000000000..2affd86bb14
--- /dev/null
+++ b/mcs/doctools/src/Core/AssemblyLoader.cs
@@ -0,0 +1,359 @@
+// AssemblyLoader.cs
+// John Barnette (jbarn@httcb.net)
+// Adam Treat (manyoso@yahoo.com)
+//
+// Copyright (c) 2002 John Barnette
+// Copyright (c) 2002 Adam Treat
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Reflection;
+
+namespace Mono.Doc.Core
+{
+ public class AssemblyLoader
+ {
+ #region Instance Fields
+
+ private Assembly assem;
+
+ #endregion // Instance Fields
+
+ #region Constructors and Destructors
+
+ // TODO: add a constructor that allows specification of type and member visibility
+ public AssemblyLoader(string fileName)
+ {
+ if (!File.Exists(fileName))
+ {
+ throw new ApplicationException(
+ "Cannot find assembly file: " + fileName
+ );
+ }
+
+ FileStream fs = File.Open(fileName, FileMode.Open, FileAccess.Read);
+ byte[] buffer = new byte[fs.Length];
+ fs.Read(buffer, 0, (int)fs.Length);
+ fs.Close();
+
+ assem = Assembly.Load(buffer);
+ }
+
+ #endregion // Constructors and Destructors
+
+ #region Private Instance Methods
+
+ // TODO: visibility should be configurable in constructor
+ private bool MustDocumentType(Type type)
+ {
+ if (type != null)
+ {
+ return ((type.IsPublic ||
+ type.IsNestedPublic) &&
+ !type.FullName.Equals("Driver") &&
+ !type.FullName.Equals("Profile")
+ );
+ }
+
+ return false;
+ }
+
+ // TODO: visibility should be configurable in constructor
+ private bool MustDocumentMethod(MethodBase method)
+ {
+ return (method.IsPublic);
+ }
+
+ // TODO: visibility should be configurable in constructor
+ private bool MustDocumentField(FieldInfo field)
+ {
+ return (field.IsPublic);
+ }
+
+ private bool IsAlsoAnEvent(Type type, string fullName)
+ {
+ bool isEvent = false;
+
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.DeclaredOnly;
+
+ foreach (EventInfo eventInfo in type.GetEvents(bindingFlags))
+ {
+
+ if (eventInfo.EventHandlerType.FullName == fullName)
+ {
+
+ isEvent = true;
+ break;
+ }
+ }
+
+ return isEvent;
+ }
+
+ private bool IsAlsoAnEvent(FieldInfo field)
+ {
+ return IsAlsoAnEvent(field.DeclaringType, field.FieldType.FullName);
+ }
+
+ private bool IsAlsoAnEvent(PropertyInfo property)
+ {
+ return IsAlsoAnEvent(property.DeclaringType, property.PropertyType.FullName);
+ }
+
+ #endregion // Private Instance Methods
+
+ #region Public Instance Methods
+
+ public Type[] GetTypes()
+ {
+ ArrayList list = new ArrayList();
+
+ foreach (Module m in assem.GetModules())
+ {
+ Type[] moduleTypes = m.GetTypes();
+
+ foreach (Type type in moduleTypes)
+ {
+ if (MustDocumentType(type))
+ {
+ list.Add(type);
+ }
+ }
+ }
+
+ Type[] types = new Type[list.Count];
+ int i = 0;
+
+ foreach (Type type in list)
+ {
+ types[i++] = type;
+ }
+
+ return types;
+ }
+
+ public ConstructorInfo[] GetConstructors(Type t)
+ {
+ // TODO: should be configurable in constructor
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Public |
+ BindingFlags.NonPublic ;
+
+ ArrayList ctorList = new ArrayList();
+
+ foreach (ConstructorInfo ctor in t.GetConstructors(bindingFlags))
+ {
+ if (MustDocumentMethod(ctor))
+ {
+ ctorList.Add(ctor);
+ }
+ }
+
+ ConstructorInfo[] constructors = new ConstructorInfo[ctorList.Count];
+ int i = 0;
+
+ foreach (ConstructorInfo c in ctorList)
+ {
+ constructors[i++] = c;
+ }
+
+ return constructors;
+ }
+
+ public FieldInfo[] GetFields(Type t)
+ {
+ // TODO: should be configurable in constructor
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic ;
+
+ ArrayList fieldList = new ArrayList();
+
+ foreach (FieldInfo field in t.GetFields(bindingFlags))
+ {
+ if (MustDocumentField(field))
+ {
+ fieldList.Add(field);
+ }
+ }
+
+ FieldInfo[] fields = new FieldInfo[fieldList.Count];
+ int i = 0;
+
+ foreach (FieldInfo f in fieldList)
+ {
+ fields[i++] = f;
+ }
+
+ return fields;
+ }
+
+ public PropertyInfo[] GetProperties(Type t)
+ {
+ // TODO: should be configurable in constructor
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic ;
+
+ ArrayList propertyList = new ArrayList();
+
+ foreach (PropertyInfo property in t.GetProperties(bindingFlags))
+ {
+ bool hasAccessor = (property.GetGetMethod(true) != null);
+ bool hasMutator = (property.GetSetMethod(true) != null);
+
+ if ((hasAccessor || hasMutator) && !IsAlsoAnEvent(property))
+ {
+ propertyList.Add(property);
+ }
+ }
+
+ PropertyInfo[] properties = new PropertyInfo[propertyList.Count];
+ int i = 0;
+
+ foreach (PropertyInfo p in propertyList)
+ {
+ properties[i++] = p;
+ }
+
+ return properties;
+ }
+
+ public MethodInfo[] GetMethods(Type t)
+ {
+ // TODO: should be configurable in constructor
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic ;
+
+ ArrayList methodList = new ArrayList();
+
+ foreach (MethodInfo method in t.GetMethods(bindingFlags))
+ {
+ if (!(method.Name.StartsWith("get_")) &&
+ !(method.Name.StartsWith("set_")) &&
+ !(method.Name.StartsWith("add_")) &&
+ !(method.Name.StartsWith("remove_")) &&
+ !(method.Name.StartsWith("op_")) &&
+ MustDocumentMethod(method))
+ {
+ methodList.Add(method);
+ }
+ }
+
+ MethodInfo[] methods = new MethodInfo[methodList.Count];
+ int i = 0;
+
+ foreach (MethodInfo m in methodList)
+ {
+ methods[i++] = m;
+ }
+
+ return methods;
+ }
+
+ public MethodInfo[] GetOperators(Type t)
+ {
+ // TODO: should be configurable in constructor
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic ;
+
+ ArrayList operatorList = new ArrayList();
+
+ foreach (MethodInfo operatorMethod in t.GetMethods(bindingFlags))
+ {
+ if (operatorMethod.Name.StartsWith("op_") && MustDocumentMethod(operatorMethod))
+ {
+ operatorList.Add(operatorMethod);
+ }
+ }
+
+ MethodInfo[] operators = new MethodInfo[operatorList.Count];
+ int i = 0;
+
+ foreach (MethodInfo m in operatorList)
+ {
+ operators[i++] = m;
+ }
+
+ return operators;
+ }
+
+ public EventInfo[] GetEvents(Type t)
+ {
+ // TODO: should be configurable in constructor
+ BindingFlags bindingFlags =
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic |
+ BindingFlags.DeclaredOnly;
+
+ ArrayList eventList = new ArrayList();
+
+ foreach (EventInfo eventInfo in t.GetEvents(bindingFlags))
+ {
+
+ MethodInfo addMethod = eventInfo.GetAddMethod(true);
+
+ if (addMethod != null && MustDocumentMethod(addMethod))
+ {
+ eventList.Add(eventInfo);
+ }
+ }
+
+ EventInfo[] events = new EventInfo[eventList.Count];
+ int i = 0;
+
+ foreach (EventInfo e in eventList)
+ {
+ events[i++] = e;
+ }
+
+ return events;
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Public Instance Properties
+
+ public Assembly Assembly
+ {
+ get { return assem; }
+ }
+
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/doctools/src/Core/ClassDoc.cs b/mcs/doctools/src/Core/ClassDoc.cs
new file mode 100644
index 00000000000..46a857d8edc
--- /dev/null
+++ b/mcs/doctools/src/Core/ClassDoc.cs
@@ -0,0 +1,36 @@
+// ClassDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public class ClassDoc : AbstractClassStructDoc
+ {
+ public ClassDoc(string name) : base(name)
+ {
+ }
+
+ public ClassDoc() : this(string.Empty)
+ {
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/ConstructorDoc.cs b/mcs/doctools/src/Core/ConstructorDoc.cs
new file mode 100644
index 00000000000..152b1ae1009
--- /dev/null
+++ b/mcs/doctools/src/Core/ConstructorDoc.cs
@@ -0,0 +1,52 @@
+// ConstructorDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections.Specialized;
+
+namespace Mono.Doc.Core
+{
+ public class ConstructorDoc : AbstractDoc
+ {
+ public ValueConstrainedArrayList exceptions;
+ public StringDictionary parameters;
+
+ public ConstructorDoc(string name) : base(name)
+ {
+ this.exceptions = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.ExceptionDoc", true));
+ this.parameters = new StringDictionary();
+ }
+
+ public ConstructorDoc() : this(string.Empty)
+ {
+ }
+
+ public ValueConstrainedArrayList Exceptions
+ {
+ get { return this.exceptions; }
+ }
+
+ public StringDictionary Parameters
+ {
+ get { return this.parameters; }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/Core.csproj b/mcs/doctools/src/Core/Core.csproj
new file mode 100644
index 00000000000..dc93538ea85
--- /dev/null
+++ b/mcs/doctools/src/Core/Core.csproj
@@ -0,0 +1,223 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{73F5A60D-A5E3-4852-B4C6-478275E733F9}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "Mono.Doc.Core"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "Mono.Doc.Core"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "..\..\build\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "..\..\build\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "D:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "D:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "D:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AbstractClassStructDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AbstractDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AbstractMethodOperatorDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AbstractTypeDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyLoader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ClassDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ConstructorDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DelegateDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DocProject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "EnumDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "EventDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ExceptionDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FieldDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InterfaceDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MethodDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MonodocException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NamingFlags.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NotifyArrayList.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NotifyCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NotifyHashtable.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "OperatorDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RecursiveFileList.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SortedStringValues.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StructDoc.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TypeNameHelper.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ValueConstrainedArrayList.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/doctools/src/Core/DelegateDoc.cs b/mcs/doctools/src/Core/DelegateDoc.cs
new file mode 100644
index 00000000000..5b5f54d9009
--- /dev/null
+++ b/mcs/doctools/src/Core/DelegateDoc.cs
@@ -0,0 +1,45 @@
+// DelegateDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections.Specialized;
+
+namespace Mono.Doc.Core
+{
+ public class DelegateDoc : AbstractTypeDoc
+ {
+ private StringDictionary parameters;
+
+ public DelegateDoc(string name) : base(name)
+ {
+ this.parameters = new StringDictionary();
+ }
+
+ public DelegateDoc() : this (string.Empty)
+ {
+ }
+
+ public StringDictionary Parameters
+ {
+ get { return this.parameters; }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/DocProject.cs b/mcs/doctools/src/Core/DocProject.cs
new file mode 100644
index 00000000000..6d2c2ee4545
--- /dev/null
+++ b/mcs/doctools/src/Core/DocProject.cs
@@ -0,0 +1,327 @@
+// DocProject.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+namespace Mono.Doc.Core
+{
+ public class DocProject
+ {
+ # region Public Static Fields
+
+ public static string UntitledProjectName = "Untitled"; // TODO: i18n
+
+ #endregion // Public Static Fields
+
+ #region Private Instance Fields
+
+ private ArrayList assemblyFiles;
+ private ArrayList xmlDirectories;
+ private Hashtable properties;
+ private bool isModified;
+ private bool isNewProject;
+ private string projectFileName;
+
+ #endregion // Private Instace Fields
+
+ #region Public Events
+
+ public event EventHandler Modified;
+
+ public DocProject()
+ {
+ assemblyFiles = new ArrayList();
+ xmlDirectories = new ArrayList();
+ properties = new Hashtable();
+ isModified = false;
+ isNewProject = true;
+ projectFileName = DocProject.UntitledProjectName;
+ }
+
+ #endregion // Public Events
+
+ #region Public Instance Methods
+
+ public void Load(string fileName)
+ {
+ Clear();
+
+ XmlTextReader xml = null;
+
+ try
+ {
+ StreamReader stream = new StreamReader(fileName);
+ xml = new XmlTextReader(stream);
+
+ xml.MoveToContent();
+ xml.ReadStartElement("monodoc-project");
+
+ while (xml.Read())
+ {
+ if (xml.NodeType == XmlNodeType.Element)
+ {
+ switch (xml.Name)
+ {
+ case "assemblies":
+ LoadAssemblies(xml);
+ break;
+ case "xmlDocs":
+ LoadXmlDirectories(xml);
+ break;
+ case "properties":
+ LoadProperties(xml);
+ break;
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // FIXME: i18n
+ throw new MonodocException(
+ "Problem reading project file '" + fileName + "'.\n" + e.Message, e
+ );
+ }
+ finally
+ {
+ if (xml != null) xml.Close();
+ }
+
+
+ projectFileName = fileName;
+ isModified = false;
+ isNewProject = false;
+ }
+
+ public void Save()
+ {
+ Save(projectFileName);
+ }
+
+ public void Save(string fileName)
+ {
+ if (DocProject.UntitledProjectName == fileName)
+ {
+ throw new MonodocException("Cannot save untitled (default) project.");
+ }
+
+ XmlTextWriter xml = null;
+
+ try
+ {
+ StreamWriter stream = new StreamWriter(fileName, false, new UTF8Encoding());
+ xml = new XmlTextWriter(stream);
+ xml.Formatting = Formatting.Indented;
+ xml.Indentation = 4;
+
+ // <monodoc-project>
+ xml.WriteStartElement("monodoc-project");
+
+ SaveAssemblies(xml);
+ SaveXmlDirectories(xml);
+ SaveProperties(xml);
+
+ // </monodoc-project>
+ xml.WriteEndElement();
+
+ }
+ catch (Exception e)
+ {
+ // TODO: i18n
+ throw new MonodocException(
+ "Problem saving project file '" + fileName + "'.\n" + e.Message, e
+ );
+ }
+ finally
+ {
+ if (xml != null) xml.Close();
+ }
+
+ projectFileName = fileName;
+ isModified = false;
+ isNewProject = false;
+ }
+
+ public void Clear()
+ {
+ assemblyFiles.Clear();
+ xmlDirectories.Clear();
+ properties.Clear();
+
+ projectFileName = DocProject.UntitledProjectName;
+ isModified = false;
+ isNewProject = true;
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Private Instance Methods
+
+ private void LoadAssemblies(XmlTextReader xml)
+ {
+ while (xml.Read() && !(xml.NodeType == XmlNodeType.EndElement && xml.Name == "assemblies"))
+ {
+ if (xml.NodeType == XmlNodeType.Element && xml.Name == "assembly")
+ {
+ assemblyFiles.Add(xml["location"]);
+ }
+ }
+ }
+
+ private void LoadXmlDirectories(XmlTextReader xml)
+ {
+ while (xml.Read() && !(xml.NodeType == XmlNodeType.EndElement && xml.Name == "xmlDocs"))
+ {
+ if (xml.NodeType == XmlNodeType.Element && xml.Name == "directory")
+ {
+ xmlDirectories.Add(xml["location"]);
+ }
+ }
+ }
+
+ // TODO: this is dropping the first property, and I'm too tired to know why.
+ private void LoadProperties(XmlTextReader xml)
+ {
+ while (xml.Read() && !(xml.NodeType == XmlNodeType.EndElement && xml.Name == "properties"))
+ {
+ if (xml.NodeType == XmlNodeType.Element && xml.Name == "property")
+ {
+ Console.WriteLine("project property load: {0} = '{1}'",
+ xml["name"], xml["value"]);
+
+ properties[xml["name"]] = xml["value"];
+ }
+ }
+ }
+
+ private void SaveAssemblies(XmlTextWriter xml)
+ {
+ // <assemblies>
+ xml.WriteStartElement("assemblies");
+
+ foreach (string assemblyFile in assemblyFiles)
+ {
+ // <assembly location="...">
+ xml.WriteStartElement("assembly");
+ xml.WriteAttributeString("location", assemblyFile);
+
+ // </assembly>
+ xml.WriteEndElement();
+ }
+
+ // </assemblies>
+ xml.WriteEndElement();
+ }
+
+ private void SaveXmlDirectories(XmlTextWriter xml)
+ {
+ // <xmlDocs>
+ xml.WriteStartElement("xmlDocs");
+
+ foreach (string xmlDir in xmlDirectories)
+ {
+ // <directory location="...">
+ xml.WriteStartElement("directory");
+ xml.WriteAttributeString("location", xmlDir);
+
+ // </directory>
+ xml.WriteEndElement();
+ }
+
+ // </xmlDocs>
+ xml.WriteEndElement();
+ }
+
+ private void SaveProperties(XmlTextWriter xml)
+ {
+ // <properties>
+ xml.WriteStartElement("properties");
+
+ foreach (string name in properties.Keys)
+ {
+ // <property name="..." value="...">
+ xml.WriteStartElement("property");
+ xml.WriteAttributeString("name", name);
+ xml.WriteAttributeString("value", properties[name].ToString());
+
+ // </property>
+ xml.WriteEndElement();
+ }
+
+ // </properties>
+ xml.WriteEndElement();
+ }
+
+ #endregion // Private Instance Methods
+
+ #region Public Instance Properties
+
+ public string FilePath
+ {
+ get { return projectFileName; }
+ set { projectFileName = value; }
+ }
+
+ public bool IsModified
+ {
+ get { return isModified; }
+ set
+ {
+ if (value && Modified != null)
+ {
+ isModified = value;
+ Modified(this, new EventArgs());
+ }
+ else
+ {
+ isModified = value;
+ }
+ }
+ }
+
+ public bool IsNewProject
+ {
+ get { return isNewProject; }
+ set { isNewProject = value; }
+ }
+
+ public ArrayList AssemblyFiles
+ {
+ get { return assemblyFiles; }
+ }
+
+ public ArrayList XmlDirectories
+ {
+ get { return xmlDirectories; }
+ }
+
+ public Hashtable Properties
+ {
+ get { return properties; }
+ }
+
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/doctools/src/Core/EnumDoc.cs b/mcs/doctools/src/Core/EnumDoc.cs
new file mode 100644
index 00000000000..e66ade83da8
--- /dev/null
+++ b/mcs/doctools/src/Core/EnumDoc.cs
@@ -0,0 +1,45 @@
+// EnumDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections.Specialized;
+
+namespace Mono.Doc.Core
+{
+ public class EnumDoc : AbstractTypeDoc
+ {
+ private StringDictionary members;
+
+ public EnumDoc(string name) : base(name)
+ {
+ this.members = new StringDictionary();
+ }
+
+ public EnumDoc() : this(string.Empty)
+ {
+ }
+
+ public StringDictionary Members
+ {
+ get { return this.members; }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/EventDoc.cs b/mcs/doctools/src/Core/EventDoc.cs
new file mode 100644
index 00000000000..36ae95ac916
--- /dev/null
+++ b/mcs/doctools/src/Core/EventDoc.cs
@@ -0,0 +1,47 @@
+// EventDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public class EventDoc : AbstractDoc
+ {
+ private string data;
+
+ public EventDoc(string name) : base(name)
+ {
+ this.data = string.Empty;
+ }
+
+ public EventDoc() : this(string.Empty)
+ {
+ }
+
+ public string Data
+ {
+ get { return this.data; }
+ set { this.data = value; }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/ExceptionDoc.cs b/mcs/doctools/src/Core/ExceptionDoc.cs
new file mode 100644
index 00000000000..b6b12c8062a
--- /dev/null
+++ b/mcs/doctools/src/Core/ExceptionDoc.cs
@@ -0,0 +1,55 @@
+// ExceptionDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public class ExceptionDoc
+ {
+ private string cref;
+ private string description;
+
+ public ExceptionDoc()
+ {
+ this.cref = string.Empty;
+ this.description = string.Empty;
+ }
+
+ public ExceptionDoc(string cref, string description)
+ {
+ this.cref = cref;
+ this.description = description;
+ }
+
+ public string Cref
+ {
+ get { return this.cref; }
+ set { this.cref = value; }
+ }
+
+ public string Description
+ {
+ get { return this.description; }
+ set { this.description = value; }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/FieldDoc.cs b/mcs/doctools/src/Core/FieldDoc.cs
new file mode 100644
index 00000000000..19de9094d27
--- /dev/null
+++ b/mcs/doctools/src/Core/FieldDoc.cs
@@ -0,0 +1,36 @@
+// FieldDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public class FieldDoc : AbstractDoc
+ {
+ public FieldDoc(string name) : base(name)
+ {
+ }
+
+ public FieldDoc() : this(string.Empty)
+ {
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/InterfaceDoc.cs b/mcs/doctools/src/Core/InterfaceDoc.cs
new file mode 100644
index 00000000000..a43223824ba
--- /dev/null
+++ b/mcs/doctools/src/Core/InterfaceDoc.cs
@@ -0,0 +1,36 @@
+// InterfaceDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public class InterfaceDoc : AbstractTypeDoc
+ {
+ public InterfaceDoc(string name) : base(name)
+ {
+ }
+
+ public InterfaceDoc() : this(string.Empty)
+ {
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/MethodDoc.cs b/mcs/doctools/src/Core/MethodDoc.cs
new file mode 100644
index 00000000000..0d9bf382aae
--- /dev/null
+++ b/mcs/doctools/src/Core/MethodDoc.cs
@@ -0,0 +1,36 @@
+// MethodDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public class MethodDoc : AbstractMethodOperatorDoc
+ {
+ public MethodDoc(string name) : base(name)
+ {
+ }
+
+ public MethodDoc() : this(string.Empty)
+ {
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/MonodocException.cs b/mcs/doctools/src/Core/MonodocException.cs
new file mode 100644
index 00000000000..1aacaace08e
--- /dev/null
+++ b/mcs/doctools/src/Core/MonodocException.cs
@@ -0,0 +1,40 @@
+// MonodocException.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public class MonodocException : ApplicationException
+ {
+ public MonodocException() : base()
+ {
+ }
+
+ public MonodocException(string msg) : base(msg)
+ {
+ }
+
+ public MonodocException(string msg, Exception nested) : base(msg, nested)
+ {
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/NamingFlags.cs b/mcs/doctools/src/Core/NamingFlags.cs
new file mode 100644
index 00000000000..f4f6d4042fd
--- /dev/null
+++ b/mcs/doctools/src/Core/NamingFlags.cs
@@ -0,0 +1,36 @@
+// NamingFlags.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ [Flags]
+ public enum NamingFlags
+ {
+ None = 1,
+ FullName = 2,
+ TypeSpecifier = 4,
+ ForceMethodParams = 8,
+ HideMethodParams = 16,
+ ShortParamTypes = 32
+ }
+} \ No newline at end of file
diff --git a/mcs/doctools/src/Core/NotifyArrayList.cs b/mcs/doctools/src/Core/NotifyArrayList.cs
new file mode 100644
index 00000000000..9efea5fcd63
--- /dev/null
+++ b/mcs/doctools/src/Core/NotifyArrayList.cs
@@ -0,0 +1,175 @@
+// NotifyArrayList.cs
+// John Sohn (jsohn@columbus.rr.com)
+//
+// Copyright (c) 2002 John Sohn
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+
+using System;
+using System.Collections;
+
+namespace Mono.Doc.Core
+{
+ /// <summary>
+ /// An implementation of the ArrayList class that provides
+ /// a mechanism to receive a notification event
+ /// when the elements of the array are changed
+ /// </summary>
+ public class NotifyArrayList : ArrayList, INotifyCollection
+ {
+ #region Protected Instance Fields
+
+ protected NotifyCollectionHandler handler = null;
+
+ #endregion
+
+ #region Constructors and Destructors
+
+ public NotifyArrayList() : base()
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ public NotifyArrayList(ICollection collection)
+ : base(collection)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ public NotifyArrayList(int i) : base(i)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ #endregion // Constructors and Destructors
+
+ #region Public Instance Fields
+
+ /// <summary>
+ /// The event handler that will be called whenever
+ /// a change is made to the ArrayList.
+ /// </summary>
+ public event CollectionModifiedEventHandler Modified;
+
+ #endregion // Public Instance Fields
+
+ #region Public Instance Methods
+
+ /// <summary>
+ /// Turns off notification event calling. Notification
+ /// events will not be sent until EndUpdate() is called.
+ /// </summary>
+ public virtual void BeginUpdate()
+ {
+ handler.BeginUpdate();
+ }
+
+ /// <summary>
+ /// Resumes notification event calling previously
+ /// turned off by calling BeginUpdate().
+ /// </summary>
+ public virtual void EndUpdate()
+ {
+ handler.EndUpdate();
+ }
+
+ /// <summary>
+ /// Invokes the Modified event.
+ /// </summary>
+ public void SetModifiedEvent()
+ {
+ if (Modified != null)
+ {
+ Modified(this);
+ }
+ }
+
+ // the following overridden functions modify the contents
+ // of the collection
+ public override object this[int index]
+ {
+ set
+ {
+ base[index] = value;
+ handler.OnModified();
+ }
+ }
+
+ public override int Add(object value)
+ {
+ int status = base.Add(value);
+ handler.OnModified();
+ return status;
+ }
+
+ public override void AddRange(ICollection c)
+ {
+ base.AddRange(c);
+ handler.OnModified();
+ }
+
+ public override void Clear()
+ {
+ base.Clear();
+ handler.OnModified();
+ }
+
+ public override void Insert(int index, object value)
+ {
+ base.Insert(index, value);
+ handler.OnModified();
+ }
+
+ public override void InsertRange(int index, ICollection c) {
+ base.InsertRange(index, c);
+ handler.OnModified();
+ }
+
+ public override void Remove(object obj) {
+ base.Remove(obj);
+ handler.OnModified();
+ }
+
+ public override void RemoveAt(int index) {
+ base.RemoveAt(index);
+ handler.OnModified();
+ }
+
+ public override void RemoveRange(int index,int count) {
+ base.RemoveRange(index, count);
+ handler.OnModified();
+ }
+
+ public override void Reverse() {
+ base.Reverse();
+ handler.OnModified();
+ }
+
+ public override void SetRange(int index,ICollection c) {
+ base.SetRange(index, c);
+ handler.OnModified();
+ }
+
+ public override void Sort() {
+ base.Sort();
+ handler.OnModified();
+ }
+
+ #endregion // Public Instance Methods
+ }
+}
+
diff --git a/mcs/doctools/src/Core/NotifyCollection.cs b/mcs/doctools/src/Core/NotifyCollection.cs
new file mode 100644
index 00000000000..1d098e14dac
--- /dev/null
+++ b/mcs/doctools/src/Core/NotifyCollection.cs
@@ -0,0 +1,82 @@
+// NotifyCollections.cs
+// John Sohn (jsohn@columbus.rr.com)
+//
+// Copyright (c) 2002 John Sohn
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
+
+using System;
+using System.Collections;
+
+namespace Mono.Doc.Core
+{
+ public delegate void CollectionModifiedEventHandler(object sender);
+
+ public interface INotifyCollection
+ {
+ event CollectionModifiedEventHandler Modified;
+ void BeginUpdate();
+ void EndUpdate();
+ void SetModifiedEvent();
+ }
+
+ public class NotifyCollectionHandler
+ {
+ private bool callModifiedEvent = true;
+ private bool changedDuringUpdate = false;
+ INotifyCollection collection;
+
+ public NotifyCollectionHandler(INotifyCollection collection)
+ {
+ this.collection = collection;
+ }
+
+ public void BeginUpdate()
+ {
+ callModifiedEvent = false;
+ changedDuringUpdate = false;
+ }
+
+ public void EndUpdate()
+ {
+ // call the event if changes occured between the
+ // begin/end update calls
+ if (changedDuringUpdate)
+ {
+ collection.SetModifiedEvent();
+ }
+
+ changedDuringUpdate = false;
+ callModifiedEvent = true;
+ }
+
+ public void OnModified()
+ {
+ // if in the middle of begin/end update
+ // save the event call until EndUpdate()
+ if (!callModifiedEvent)
+ {
+ changedDuringUpdate = true;
+ }
+ else
+ {
+ collection.SetModifiedEvent();
+ }
+ }
+ }
+}
+
diff --git a/mcs/doctools/src/Core/NotifyHashtable.cs b/mcs/doctools/src/Core/NotifyHashtable.cs
new file mode 100644
index 00000000000..d05a45f1e42
--- /dev/null
+++ b/mcs/doctools/src/Core/NotifyHashtable.cs
@@ -0,0 +1,174 @@
+// NotifyHashtable.cs
+// John Sohn (jsohn@columbus.rr.com)
+//
+// Copyright (c) 2002 John Sohn
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections;
+using System.Runtime.Serialization;
+
+namespace Mono.Doc.Core
+{
+ /// <summary>
+ /// An implementation of the Hashtable class that provides
+ /// a mechanism to receive a notification event
+ /// when the elements of the Hashtable are changed
+ // </summary>
+ public class NotifyHashtable : Hashtable, INotifyCollection
+ {
+ #region Protected Instance Fields
+
+ protected NotifyCollectionHandler handler = null;
+
+ #endregion
+
+ #region Constructors and Destructor
+
+ public NotifyHashtable() : base()
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ public NotifyHashtable(IDictionary d) : base(d)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ public NotifyHashtable(int i) : base(i)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ public NotifyHashtable(IDictionary d, float f) : base(d, f)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ public NotifyHashtable(IHashCodeProvider hp, IComparer c)
+ : base(hp, c)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ public NotifyHashtable(int i, float f) : base(i, f)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ protected NotifyHashtable(SerializationInfo si,
+ StreamingContext sc) : base(si, sc)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ public NotifyHashtable(IDictionary d, IHashCodeProvider hcp,
+ IComparer c) : base(d, hcp, c)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ public NotifyHashtable(int i, IHashCodeProvider hcp,
+ IComparer c) : base(i, hcp, c)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ public NotifyHashtable(IDictionary d, float f,
+ IHashCodeProvider hcp, IComparer c)
+ : base(d, f, hcp, c)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ public NotifyHashtable(int i, float f, IHashCodeProvider hcp,
+ IComparer c) : base(i, f, hcp, c)
+ {
+ handler = new NotifyCollectionHandler(this);
+ }
+
+ #endregion
+
+ #region Public Instance Fields
+
+ /// <summary>
+ /// The event handler that will be called whenever
+ /// a change is made to the Hashtable.
+ /// </summary>
+ public event CollectionModifiedEventHandler Modified;
+
+ #endregion // Public Instance Fields
+
+ #region Public Instance Methods
+
+ /// <summary>
+ /// Turns off notification event calling. Notification
+ /// events will not be sent until EndUpdate() is called.
+ /// </summary>
+ public virtual void BeginUpdate()
+ {
+ handler.BeginUpdate();
+ }
+
+ /// <summary>
+ /// Resumes notification event calling previously
+ /// turned off by calling BeginUpdate().
+ /// </summary>
+ public virtual void EndUpdate()
+ {
+ handler.EndUpdate();
+ }
+
+ public virtual void SetModifiedEvent()
+ {
+ if (Modified != null)
+ {
+ Modified(this);
+ }
+ }
+
+ public override object this[object key]
+ {
+ set
+ {
+ base[key] = value;
+ handler.OnModified();
+ }
+ }
+
+ public override void Add(object key,object value)
+ {
+ base.Add(key, value);
+ handler.OnModified();
+ }
+
+ public override void Clear()
+ {
+ base.Clear();
+ handler.OnModified();
+ }
+
+ public override void Remove(object key)
+ {
+ base.Remove(key);
+ handler.OnModified();
+ }
+ #endregion // Public Instance Methods
+ }
+}
+
diff --git a/mcs/doctools/src/Core/OperatorDoc.cs b/mcs/doctools/src/Core/OperatorDoc.cs
new file mode 100644
index 00000000000..4bb45808fa0
--- /dev/null
+++ b/mcs/doctools/src/Core/OperatorDoc.cs
@@ -0,0 +1,36 @@
+// OperatorDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public class OperatorDoc : AbstractMethodOperatorDoc
+ {
+ public OperatorDoc(string name) : base(name)
+ {
+ }
+
+ public OperatorDoc() : this(string.Empty)
+ {
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/PropertyDoc.cs b/mcs/doctools/src/Core/PropertyDoc.cs
new file mode 100644
index 00000000000..9c82c75cbcf
--- /dev/null
+++ b/mcs/doctools/src/Core/PropertyDoc.cs
@@ -0,0 +1,52 @@
+// PropertyDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public class PropertyDoc : AbstractDoc
+ {
+ private string value;
+ private ValueConstrainedArrayList exceptions;
+
+ public PropertyDoc(string name) : base(name)
+ {
+ this.value = string.Empty;
+ this.exceptions = new ValueConstrainedArrayList(Type.GetType("Mono.Doc.Core.ExceptionDoc", true));
+ }
+
+ public PropertyDoc() : this(string.Empty)
+ {
+ }
+
+ public string Value
+ {
+ get { return this.value; }
+ set { this.value = value; }
+ }
+
+ public ValueConstrainedArrayList Exceptions
+ {
+ get { return this.exceptions; }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/RecursiveFileList.cs b/mcs/doctools/src/Core/RecursiveFileList.cs
new file mode 100644
index 00000000000..3f1a556a904
--- /dev/null
+++ b/mcs/doctools/src/Core/RecursiveFileList.cs
@@ -0,0 +1,105 @@
+// RecursiveFileList.cs
+// John Sohn (jsohn@columbus.rr.com)
+//
+// Copyright (c) 2002 John Sohn
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections;
+using System.IO;
+
+
+namespace Mono.Doc.Core
+{
+ /// <summary>
+ /// Recurses through the given directory and subdirectories based on a
+ /// filter (wildcard) passed into the constructor. The results are placed
+ /// in the Files property which is an ArrayList of System.IO.FileInfo objects
+ /// </summary>
+ public class RecursiveFileList
+ {
+ #region Private Instance Fields
+
+ private ArrayList fileInfoList;
+
+ #endregion // Private Instance Fields
+
+ #region Constructors and Destructors
+
+ /// <summary>Constructor for RecursiveFileList.</summary>
+ /// <param name="path">The directory to recurse.</param>
+ /// <exception cref="DirectoryNotFoundException">Thrown if an invalid path is specified.</exception>
+ public RecursiveFileList(string path) : this(path, null)
+ {
+ }
+
+ /// <summary>
+ /// Constructor for RecursiveFileList.
+ /// </summary>
+ /// <param name="path">The directory to recurse.</param>
+ /// <param name="filter">Wildcard of files to collect.</param>
+ /// <exception cref="DirectoryNotFoundException">Thrown if an invalid path is specified.</exception>
+ public RecursiveFileList(string path, string filter)
+ {
+ this.fileInfoList = new ArrayList();
+ AddFilesInPath(path, filter);
+ }
+
+ #endregion // Constructors and Destructors
+
+ #region Private Instance Methods
+
+ private void AddFilesInPath(string path, string filter)
+ {
+ DirectoryInfo dir = new DirectoryInfo(path);
+
+
+ if (filter == null)
+ {
+ filter = "*.*";
+ }
+
+ foreach (FileSystemInfo fi in dir.GetFiles(filter))
+ {
+ this.fileInfoList.Add(fi);
+ }
+
+
+ foreach (DirectoryInfo di in dir.GetDirectories())
+ {
+ AddFilesInPath(di.FullName, filter);
+ }
+ }
+
+ #endregion // Private Instance Methods
+
+ #region Public Instance Properties
+
+ /// <summary>
+ /// Contains an ArrayList of System.IO.FileInfo objects
+ /// based on the path (and optional filter) passed to the constructor.
+ /// </summary>
+ public ArrayList Files
+ {
+ get { return this.fileInfoList; }
+ }
+
+ #endregion // Public Instance Properties
+ }
+}
+
diff --git a/mcs/doctools/src/Core/SortedStringValues.cs b/mcs/doctools/src/Core/SortedStringValues.cs
new file mode 100644
index 00000000000..9f1e130de4c
--- /dev/null
+++ b/mcs/doctools/src/Core/SortedStringValues.cs
@@ -0,0 +1,85 @@
+// SortedStringValues.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// The original concept for this class was presented in an MSDN online article
+// by Eric Gunnerson.
+
+using System;
+using System.Collections;
+
+namespace Mono.Doc.Core
+{
+ public class SortedStringValues : IEnumerable
+ {
+ private IEnumerable enumerable;
+
+ public SortedStringValues(IEnumerable enumerable)
+ {
+ this.enumerable = enumerable;
+ }
+
+ internal class SortedStringValuesEnumerator : IEnumerator
+ {
+ private ArrayList items = new ArrayList();
+ private int current;
+
+ internal SortedStringValuesEnumerator(IEnumerator enumerator)
+ {
+ while (enumerator.MoveNext())
+ {
+ items.Add(enumerator.Current.ToString());
+ }
+
+ IDisposable disposable = enumerator as IDisposable;
+
+ if (disposable != null)
+ {
+ disposable.Dispose();
+ }
+
+ items.Sort();
+ current = -1;
+ }
+
+ public void Reset()
+ {
+ current = -1;
+ }
+
+ public bool MoveNext()
+ {
+ if (++current == items.Count) return false;
+
+ return true;
+ }
+
+ public object Current
+ {
+ get { return items[current]; }
+ }
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return new SortedStringValuesEnumerator(enumerable.GetEnumerator());
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/StructDoc.cs b/mcs/doctools/src/Core/StructDoc.cs
new file mode 100644
index 00000000000..6d628bc17d3
--- /dev/null
+++ b/mcs/doctools/src/Core/StructDoc.cs
@@ -0,0 +1,36 @@
+// StructDoc.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Core
+{
+ public class StructDoc : AbstractClassStructDoc
+ {
+ public StructDoc(string name) : base(name)
+ {
+ }
+
+ public StructDoc() : this(string.Empty)
+ {
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/TypeNameHelper.cs b/mcs/doctools/src/Core/TypeNameHelper.cs
new file mode 100644
index 00000000000..3c5d4c8570f
--- /dev/null
+++ b/mcs/doctools/src/Core/TypeNameHelper.cs
@@ -0,0 +1,122 @@
+// TypeNameHelper.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Reflection;
+using System.Text;
+
+namespace Mono.Doc.Core
+{
+ /// <summary>
+ /// Generates friendly names for types.
+ /// </summary>
+ public sealed class TypeNameHelper
+ {
+ private TypeNameHelper()
+ {
+ // can't instantiate this class
+ }
+
+
+ /// <summary>
+ /// Given a MemberInfo object, creates a friendly string name without
+ /// full qualifiers or a type prefix.
+ /// </summary>
+ /// <param name="m">The MemberInfo to name</param>
+ /// <returns>A friendly name</returns>
+ public static string GetName(MemberInfo m) {
+ return GetName(m, NamingFlags.None);
+ }
+
+
+ /// <summary>
+ /// Given a MemberInfo object, creates a friendly string name.
+ /// </summary>
+ /// <param name="m">The MemberInfo to name</param>
+ /// <param name="flags">NamingFlags can be combined to alter the output</param>
+ /// <returns>A friendly name</returns>
+ public static string GetName(MemberInfo m, NamingFlags flags)
+ {
+ StringBuilder name = new StringBuilder();
+
+ // type specifier
+ if ((flags & NamingFlags.TypeSpecifier) != 0) {
+ // append a type specifier to this name
+ string type = null;
+
+ if (m is ConstructorInfo) {
+ type = "C";
+ } else if (m is MethodInfo) {
+ type = "M";
+ } else if (m is EventInfo) {
+ type = "E";
+ } else if (m is FieldInfo) {
+ type = "F";
+ } else if (m is PropertyInfo) {
+ type = "P";
+ } else if (m is Type) {
+ type = "T";
+ } else {
+ type = "!";
+ }
+
+ name.Append(type + ":");
+ }
+
+ // first-class types
+ if (m.DeclaringType == null && m is Type) {
+ return name.Append((m as Type).FullName).ToString();
+ }
+
+ // full name
+ if (((flags & NamingFlags.FullName) != 0) && m.DeclaringType != null) {
+ name.Append(m.DeclaringType.FullName + ".");
+ }
+
+ // normal name
+ name.Append(m.Name.Replace(".", "#")); // for #ctor
+
+ // for methods and constructors, params are part of the name
+ if (m is MethodBase) {
+ MethodBase method = m as MethodBase;
+ ParameterInfo[] parameters = method.GetParameters();
+
+ if (parameters.Length > 0 && ((flags & NamingFlags.HideMethodParams) == 0)) {
+ bool first = true;
+ name.Append("(");
+
+ foreach (ParameterInfo p in parameters) {
+ if (!first) name.Append(",");
+ first = false;
+ name.Append(((flags & NamingFlags.ShortParamTypes) != 0) ?
+ p.ParameterType.Name : p.ParameterType.FullName);
+ }
+
+ name.Append(")");
+ } else if ((flags & NamingFlags.ForceMethodParams) != 0) {
+ name.Append("()");
+ }
+ }
+
+ return name.ToString();
+ }
+ }
+}
diff --git a/mcs/doctools/src/Core/ValueConstrainedArrayList.cs b/mcs/doctools/src/Core/ValueConstrainedArrayList.cs
new file mode 100644
index 00000000000..0fdfad47ca3
--- /dev/null
+++ b/mcs/doctools/src/Core/ValueConstrainedArrayList.cs
@@ -0,0 +1,164 @@
+// ValueConstrainedArrayList.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections;
+
+namespace Mono.Doc.Core
+{
+ public class ValueConstrainedArrayList : ArrayList
+ {
+ #region Protected Instance Fields
+
+ protected Type allowed;
+
+ #endregion // Protected Instance Fields
+
+ #region Constructors and Destructors
+
+ public ValueConstrainedArrayList(Type allowed) : base()
+ {
+ if (allowed == null)
+ {
+ throw new ArgumentNullException("allowed", "Specified Type constraint cannot be null.");
+ }
+
+ this.allowed = allowed;
+ }
+
+ public ValueConstrainedArrayList(Type allowed, ICollection c)
+ {
+ if (allowed == null)
+ {
+ throw new ArgumentNullException("allowed", "Specified Type constraint cannot be null.");
+ }
+
+ this.allowed = allowed;
+
+ this.AddRange(c);
+ }
+
+ public ValueConstrainedArrayList(Type allowed, int capacity) : base(capacity)
+ {
+ if (allowed == null)
+ {
+ throw new ArgumentNullException("allowed", "Specified Type constraint cannot be null.");
+ }
+
+ this.allowed = allowed;
+ }
+
+ #endregion // Constructors and Destructors
+
+ #region Public Instance Methods
+
+ public override int Add(object value)
+ {
+ if (allowed != value.GetType())
+ {
+ throw new ArgumentException("Values in constrained collection must be of type " + allowed.ToString() +
+ ".", "value"
+ );
+ }
+
+ return base.Add(value);
+ }
+
+ public override void AddRange(ICollection c)
+ {
+ foreach (object o in c)
+ {
+ if (allowed != o.GetType())
+ {
+ throw new ArgumentException("Values in constrained collection must be of type " +
+ allowed.ToString() + ".", "c"
+ );
+ }
+ }
+
+ base.AddRange(c);
+ }
+
+ public override void Insert(int index, object value)
+ {
+ if (allowed != value.GetType())
+ {
+ throw new ArgumentException("Values in constrained collection must be of type " + allowed.ToString() +
+ ".", "value"
+ );
+ }
+
+ base.Insert(index, value);
+ }
+
+ public override void InsertRange(int index, ICollection c)
+ {
+ foreach (object o in c)
+ {
+ if (allowed != o.GetType())
+ {
+ throw new ArgumentException("Values in constrained collection must be of type " +
+ allowed.ToString() + ".", "c"
+ );
+ }
+ }
+
+ base.InsertRange(index, c);
+ }
+
+ public override void SetRange(int index, ICollection c)
+ {
+ foreach (object o in c)
+ {
+ if (allowed != o.GetType())
+ {
+ throw new ArgumentException("Values in constrained collection must be of type " +
+ allowed.ToString() + ".", "c"
+ );
+ }
+ }
+
+ base.SetRange(index, c);
+ }
+
+ #endregion // Public Instance Methods
+
+ #region Public Instance Properties
+
+ public override object this[int index]
+ {
+ get { return base[index]; }
+ set
+ {
+ if (allowed != value.GetType())
+ {
+ throw new ArgumentException("Values in constrained collection must be of type " +
+ allowed.ToString() + "." + "value"
+ );
+ }
+
+ base[index] = value;
+ }
+ }
+
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/doctools/src/Gui/.cvsignore b/mcs/doctools/src/Gui/.cvsignore
new file mode 100644
index 00000000000..83e41579c07
--- /dev/null
+++ b/mcs/doctools/src/Gui/.cvsignore
@@ -0,0 +1,3 @@
+bin
+obj
+*.resx
diff --git a/mcs/doctools/src/Gui/AboutForm.cs b/mcs/doctools/src/Gui/AboutForm.cs
new file mode 100644
index 00000000000..443b04d5fa3
--- /dev/null
+++ b/mcs/doctools/src/Gui/AboutForm.cs
@@ -0,0 +1,82 @@
+// AboutForm.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace Mono.Doc.Gui
+{
+ public class AboutForm : Form
+ {
+ private PictureBox aboutLogo;
+ private Button closeButton;
+
+ public AboutForm()
+ {
+ aboutLogo = new PictureBox();
+ closeButton = new Button();
+
+ this.SuspendLayout();
+
+ // aboutLogo properties
+ aboutLogo.Dock = DockStyle.Fill;
+ aboutLogo.Image = GuiResources.AboutMonodocBitmap;
+ aboutLogo.Name = "aboutLogo";
+ aboutLogo.Size = new Size(300, 300);
+
+ // closeButton properties
+ closeButton.Location = new Point(96, 272);
+ closeButton.Name = "closeButton";
+ closeButton.Size = new Size(104, 24);
+ closeButton.TabIndex = 0;
+ closeButton.Text = GuiResources.GetString("Buttons.Close");
+
+
+ // form properties
+ this.AutoScaleBaseSize = new Size(5, 13);
+ this.BackColor = Color.White;
+ this.ClientSize = new Size(300, 300);
+ this.FormBorderStyle = FormBorderStyle.FixedSingle;
+ this.Icon = GuiResources.OpenBookIcon;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "AboutForm";
+ this.ShowInTaskbar = false;
+ this.StartPosition = FormStartPosition.CenterParent;
+ this.Text = GuiResources.GetString("Form.About.Title");
+
+ // bind events
+ closeButton.Click += new EventHandler(closeButton_Click);
+
+ // add components
+ this.Controls.AddRange(new Control[] { closeButton, aboutLogo});
+
+ this.ResumeLayout(false);
+ }
+
+ // events
+ private void closeButton_Click(object sender, EventArgs args)
+ {
+ this.Close();
+ }
+ }
+}
diff --git a/mcs/doctools/src/Gui/AssemblyTreeImages.cs b/mcs/doctools/src/Gui/AssemblyTreeImages.cs
new file mode 100644
index 00000000000..363bdeef6ac
--- /dev/null
+++ b/mcs/doctools/src/Gui/AssemblyTreeImages.cs
@@ -0,0 +1,94 @@
+// AssemblyTreeImages.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace Mono.Doc.Gui
+{
+ /// <summary>
+ /// Summary description for AssemblyBrowserImages.
+ /// </summary>
+ public class AssemblyTreeImages
+ {
+ private static Image[] images = null;
+ private static ImageList imageList = null;
+
+ // this class cannot be instantiated
+ private AssemblyTreeImages()
+ {
+ }
+
+ static AssemblyTreeImages()
+ {
+ Bitmap b = GuiResources.AssemblyTreeBitmap;
+ int count = (int) b.Width / b.Height;
+ images = new Image[count];
+ Rectangle rect = new Rectangle(0, 0, b.Height, b.Height);
+ imageList = new ImageList();
+
+ for (int j = 0; j < count; j++)
+ {
+ images[j] = b.Clone(rect, b.PixelFormat);
+ rect.X += b.Height;
+
+ imageList.Images.Add(images[j]);
+ }
+ }
+
+ // access as an ImageList for TreeView, ToolBar
+ public static ImageList List { get { return imageList; } }
+
+ public static Image AssemblyClosedImage { get { return images[AssemblyClosed]; } }
+ public static Image AssemblyOpenImage { get { return images[AssemblyOpen]; } }
+ public static Image NamespaceImage { get { return images[Namespace]; } }
+ public static Image ClassImage { get { return images[Class]; } }
+ public static Image InterfaceImage { get { return images[Interface]; } }
+ public static Image StructImage { get { return images[Struct]; } }
+ public static Image EnumImage { get { return images[Enum]; } }
+ public static Image ConstructorImage { get { return images[Constructor]; } }
+ public static Image MethodImage { get { return images[Method]; } }
+ public static Image EventImage { get { return images[Event]; } }
+ public static Image PropertyImage { get { return images[Property]; } }
+ public static Image DelegateImage { get { return images[Delegate]; } }
+ public static Image OperatorImage { get { return images[Operator]; } }
+ public static Image FieldImage { get { return images[Field]; } }
+ public static Image ShortcutsImage { get { return images[Shortcuts]; } }
+
+ // imageList indexes
+ public static int AssemblyClosed = 0;
+ public static int AssemblyOpen = 1;
+ public static int Namespace = 2;
+ public static int Class = 3;
+ public static int Interface = 4;
+ public static int Struct = 5;
+ public static int Enum = 6;
+ public static int Constructor = 7;
+ public static int Method = 8;
+ public static int Event = 9;
+ public static int Property = 10;
+ public static int Delegate = 11;
+ public static int Operator = 12;
+ public static int Field = 13;
+ public static int Shortcuts = 14;
+ }
+}
diff --git a/mcs/doctools/src/Gui/AssemblyTreeLoader.cs b/mcs/doctools/src/Gui/AssemblyTreeLoader.cs
new file mode 100644
index 00000000000..152e22a4752
--- /dev/null
+++ b/mcs/doctools/src/Gui/AssemblyTreeLoader.cs
@@ -0,0 +1,461 @@
+// AssemblyTreeLoader.cs
+// John Barnette (jbarn@httcb.net)
+// Adam Treat (manyoso@yahoo.com)
+//
+// Copyright (c) 2002 John Barnette
+// Copyright (c) 2002 Adam Treat
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Much of the reflection guts of this class come from the original Monodoc
+// XML stub generator, by Adam Treat, and much of the guts of *that* were
+// derived from NDoc (http://ndoc.sourceforge.net).
+
+using Mono.Doc.Core;
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Windows.Forms;
+
+namespace Mono.Doc.Gui
+{
+ public class AssemblyTreeLoader
+ {
+ #region Instance Fields
+
+ private AssemblyLoader loader;
+
+ #endregion // Instance Fields
+
+ #region Constructors and Destructors
+
+ public AssemblyTreeLoader(AssemblyLoader loader)
+ {
+ this.loader = loader;
+ }
+
+ #endregion // Constructors and Destructors
+
+ #region Private Instance Methods
+
+ private TreeNode GetNodeForType(Type t)
+ {
+ string nodeName = GetTypeDisplayName(t) + " ";
+ TreeNode typeNode = new TreeNode();
+ typeNode.Tag =
+ TypeNameHelper.GetName(t, NamingFlags.TypeSpecifier | NamingFlags.FullName);
+
+ if (t.IsClass && !IsDelegate(t))
+ {
+ // Type is class
+ typeNode.ImageIndex = AssemblyTreeImages.Class;
+ typeNode.SelectedImageIndex = AssemblyTreeImages.Class;
+ typeNode.Text = nodeName + "Class"; // TODO: i18n
+
+ // Constructors, Fields, Properties, Methods, Operators, Events
+ TreeNode[] categories = new TreeNode[6];
+ categories[0] = GetConstructorsNode(t);
+ categories[1] = GetFieldsNode(t);
+ categories[2] = GetPropertiesNode(t);
+ categories[3] = GetMethodsNode(t);
+ categories[4] = GetOperatorsNode(t);
+ categories[5] = GetEventsNode(t);
+
+ foreach (TreeNode cat in categories)
+ {
+ if (cat != null)
+ {
+ typeNode.Nodes.Add(cat);
+ }
+ }
+ }
+ else if (t.IsInterface)
+ {
+ // Type is interface
+ typeNode.ImageIndex = AssemblyTreeImages.Interface;
+ typeNode.SelectedImageIndex = AssemblyTreeImages.Interface;
+ typeNode.Text = nodeName + "Interface"; // TODO: i18n
+
+ // Methods, properties, events
+ TreeNode methodsNode = GetMethodsNode(t);
+ TreeNode propsNode = GetPropertiesNode(t);
+ TreeNode eventsNode = GetEventsNode(t);
+
+ if (methodsNode != null)
+ {
+ typeNode.Nodes.Add(methodsNode);
+ }
+
+ if (propsNode != null)
+ {
+ typeNode.Nodes.Add(propsNode);
+ }
+
+ if (eventsNode != null)
+ {
+ typeNode.Nodes.Add(eventsNode);
+ }
+ }
+ else if (t.IsValueType && !t.IsEnum)
+ {
+ // Type is struct
+ typeNode.ImageIndex = AssemblyTreeImages.Struct;
+ typeNode.SelectedImageIndex = AssemblyTreeImages.Struct;
+ typeNode.Text = nodeName + "Structure"; // TODO: i18n
+
+ // Constructors, Fields, Properties, Methods, Operators, Events
+ TreeNode[] categories = new TreeNode[6];
+ categories[0] = GetConstructorsNode(t);
+ categories[1] = GetFieldsNode(t);
+ categories[2] = GetPropertiesNode(t);
+ categories[3] = GetMethodsNode(t);
+ categories[4] = GetOperatorsNode(t);
+ categories[5] = GetEventsNode(t);
+
+ foreach (TreeNode cat in categories)
+ {
+ if (cat != null)
+ {
+ typeNode.Nodes.Add(cat);
+ }
+ }
+ }
+ else if (t.IsEnum)
+ {
+ // Type is enumeration
+ typeNode.ImageIndex = AssemblyTreeImages.Enum;
+ typeNode.SelectedImageIndex = AssemblyTreeImages.Enum;
+ typeNode.Text = nodeName + "Enumeration"; // TODO: i18n
+ }
+ else if (t.IsClass && IsDelegate(t))
+ {
+ // Type is delegate
+ typeNode.ImageIndex = AssemblyTreeImages.Delegate;
+ typeNode.SelectedImageIndex = AssemblyTreeImages.Delegate;
+ typeNode.Text = nodeName + "Delegate"; // TODO: i18n
+ }
+ else
+ {
+ MessageBox.Show(
+ "Encountered unexpected type during tree load: " + t.FullName,
+ "What the heck is this?"
+ );
+ }
+
+ return typeNode;
+ }
+
+ private TreeNode GetConstructorsNode(Type t)
+ {
+ ConstructorInfo[] ctors = loader.GetConstructors(t);
+
+ if (ctors.Length > 0)
+ {
+ TreeNode cNode = new TreeNode("Constructors");
+ cNode.ImageIndex = AssemblyTreeImages.Constructor;
+ cNode.SelectedImageIndex = AssemblyTreeImages.Constructor;
+
+ foreach (ConstructorInfo ctor in ctors)
+ {
+ TreeNode ctorNode = new TreeNode();
+ ctorNode.ImageIndex = AssemblyTreeImages.Constructor;
+ ctorNode.SelectedImageIndex = AssemblyTreeImages.Constructor;
+ ctorNode.Tag = GetTag(ctor);
+ ctorNode.Text = TypeNameHelper.GetName(ctor,
+ NamingFlags.ForceMethodParams | NamingFlags.ShortParamTypes).
+ Replace("#ctor", t.Name + " Constructor ").
+ Replace(",", ", ");
+
+ cNode.Nodes.Add(ctorNode);
+ }
+
+ return cNode;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private TreeNode GetFieldsNode(Type t)
+ {
+ FieldInfo[] fields = loader.GetFields(t);
+
+ if (fields.Length > 0)
+ {
+ TreeNode fNode = new TreeNode("Fields");
+ fNode.ImageIndex = AssemblyTreeImages.Field;
+ fNode.SelectedImageIndex = AssemblyTreeImages.Field;
+
+ foreach (FieldInfo field in fields)
+ {
+ TreeNode fieldNode = new TreeNode();
+ fieldNode.ImageIndex = AssemblyTreeImages.Field;
+ fieldNode.SelectedImageIndex = AssemblyTreeImages.Field;
+ fieldNode.Tag = GetTag(field);
+ fieldNode.Text = field.Name + " Field";
+
+ fNode.Nodes.Add(fieldNode);
+ }
+
+ return fNode;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private TreeNode GetPropertiesNode(Type t)
+ {
+ PropertyInfo[] properties = loader.GetProperties(t);
+
+ if (properties.Length > 0)
+ {
+ TreeNode pNode = new TreeNode("Properties");
+ pNode.ImageIndex = AssemblyTreeImages.Property;
+ pNode.SelectedImageIndex = AssemblyTreeImages.Property;
+
+ foreach (PropertyInfo property in properties)
+ {
+ TreeNode propertyNode = new TreeNode();
+ propertyNode.ImageIndex = AssemblyTreeImages.Property;
+ propertyNode.SelectedImageIndex = AssemblyTreeImages.Property;
+ propertyNode.Tag = GetTag(property);
+ propertyNode.Text = property.Name + " Property";
+
+ pNode.Nodes.Add(propertyNode);
+ }
+
+ return pNode;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private TreeNode GetMethodsNode(Type t)
+ {
+ MethodInfo[] methods = loader.GetMethods(t);
+
+ if (methods.Length > 0)
+ {
+ TreeNode mNode = new TreeNode("Methods");
+ mNode.ImageIndex = AssemblyTreeImages.Method;
+ mNode.SelectedImageIndex = AssemblyTreeImages.Method;
+ Hashtable overloads = new Hashtable();
+
+ // group method overloads by name
+ foreach (MethodInfo method in methods)
+ {
+ ArrayList overloadList = overloads[method.Name] as ArrayList;
+
+ if (overloadList == null)
+ {
+ overloadList = new ArrayList();
+ overloads[method.Name] = overloadList;
+
+ overloadList.Add(method);
+ }
+ else
+ {
+ overloadList.Add(method);
+ }
+ }
+
+ // create nodes, grouping overloaded methods
+ foreach (string methodName in overloads.Keys)
+ {
+ ArrayList overloadList = overloads[methodName] as ArrayList;
+
+ if (overloadList.Count > 1)
+ {
+ // overloaded method
+ TreeNode overloadNode = new TreeNode();
+ overloadNode.ImageIndex = AssemblyTreeImages.Method;
+ overloadNode.SelectedImageIndex = AssemblyTreeImages.Method;
+ overloadNode.Text = methodName + " Method";
+ overloadNode.Tag = "TODO:OVERLOAD";
+
+ foreach (MethodInfo m in overloadList)
+ {
+ overloadNode.Nodes.Add(GetOverloadedMethodNode(m));
+ }
+
+ mNode.Nodes.Add(overloadNode);
+ }
+ else
+ {
+ // not overloaded
+ MethodInfo m = overloadList[0] as MethodInfo;
+ TreeNode methodNode = new TreeNode();
+ methodNode.ImageIndex = AssemblyTreeImages.Method;
+ methodNode.SelectedImageIndex = AssemblyTreeImages.Method;
+ methodNode.Tag = GetTag(m);
+ methodNode.Text = m.Name +
+ TypeNameHelper.GetName(m, NamingFlags.HideMethodParams).
+ Replace(m.Name, " ") + " Method";
+
+ mNode.Nodes.Add(methodNode);
+ }
+ }
+
+ return mNode;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private TreeNode GetOverloadedMethodNode(MethodInfo m)
+ {
+ TreeNode mNode = new TreeNode();
+ mNode.Tag = GetTag(m);
+ mNode.Text = m.Name + TypeNameHelper.GetName(m,
+ NamingFlags.ForceMethodParams | NamingFlags.ShortParamTypes).
+ Replace(",", ", ").Replace(m.Name, " ") + " Method";
+
+ return mNode;
+ }
+
+ private TreeNode GetOperatorsNode(Type t)
+ {
+ MethodInfo[] operatorMethods = loader.GetOperators(t);
+
+ if (operatorMethods.Length > 0)
+ {
+ TreeNode oNode = new TreeNode("Operators");
+ oNode.ImageIndex = AssemblyTreeImages.Operator;
+ oNode.SelectedImageIndex = AssemblyTreeImages.Operator;
+
+ foreach (MethodInfo om in operatorMethods)
+ {
+ TreeNode omNode = new TreeNode();
+ omNode.ImageIndex = AssemblyTreeImages.Operator;
+ omNode.SelectedImageIndex = AssemblyTreeImages.Operator;
+ omNode.Tag = GetTag(om);
+ omNode.Text = om.Name.Replace("op_", "") + " Operator";
+
+ oNode.Nodes.Add(omNode);
+ }
+
+ return oNode;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private TreeNode GetEventsNode(Type t)
+ {
+ EventInfo[] events = loader.GetEvents(t);
+
+ if (events.Length > 0)
+ {
+ TreeNode eNode = new TreeNode("Events");
+ eNode.ImageIndex = AssemblyTreeImages.Event;
+ eNode.SelectedImageIndex = AssemblyTreeImages.Event;
+
+ foreach (EventInfo e in events)
+ {
+ TreeNode eiNode = new TreeNode();
+ eiNode.ImageIndex = AssemblyTreeImages.Event;
+ eiNode.SelectedImageIndex = AssemblyTreeImages.Event;
+ eiNode.Tag = GetTag(e);
+ eiNode.Text = e.Name + " Event";
+
+ eNode.Nodes.Add(eiNode);
+ }
+
+ return eNode;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private bool IsDelegate(Type type)
+ {
+ return type.BaseType.FullName == "System.Delegate" ||
+ type.BaseType.FullName == "System.MulticastDelegate";
+ }
+
+ private string GetTypeDisplayName(Type type)
+ {
+ string[] s = type.FullName.Split(new char[] {'.'});
+ string name = s[s.Length - 1];
+
+ return name.Replace('+', '.');
+ }
+
+ private string GetTag(MemberInfo m)
+ {
+ return TypeNameHelper.GetName(m, NamingFlags.TypeSpecifier | NamingFlags.FullName);
+ }
+
+ #endregion // Private Instance Methods
+
+ #region Public Instance Methods
+
+ public void LoadNode(TreeNode node)
+ {
+ // create root element
+ TreeNode root = new TreeNode(loader.Assembly.GetName().Name + " Assembly");
+ root.ImageIndex = AssemblyTreeImages.AssemblyOpen;
+ root.SelectedImageIndex = AssemblyTreeImages.AssemblyOpen;
+ root.Tag = "A:" + loader.Assembly.GetName().Name;
+
+ node.Nodes.Add(root);
+
+ // dictionary of namespaces
+ Hashtable namespaces = new Hashtable();
+
+ foreach (Type t in loader.GetTypes())
+ {
+ TreeNode nsNode = (TreeNode) namespaces[t.Namespace];
+
+ if (nsNode == null)
+ {
+ nsNode = new TreeNode(t.Namespace);
+ nsNode.ImageIndex = AssemblyTreeImages.Namespace;
+ nsNode.SelectedImageIndex = AssemblyTreeImages.Namespace;
+ nsNode.Tag = "N:" + t.Namespace;
+ namespaces[t.Namespace] = nsNode;
+
+ }
+
+ // TODO: sort types before adding
+ TreeNode typeNode = GetNodeForType(t);
+
+ nsNode.Nodes.Add(typeNode);
+ }
+
+
+ // add sorted namespace nodes to root
+ foreach (string nsName in new SortedStringValues(namespaces.Keys))
+ {
+ root.Nodes.Add((TreeNode) namespaces[nsName]);
+ }
+ }
+
+ #endregion // Public Instance Methods
+ }
+}
diff --git a/mcs/doctools/src/Gui/DirectorySelectorForm.cs b/mcs/doctools/src/Gui/DirectorySelectorForm.cs
new file mode 100644
index 00000000000..7e51e61515c
--- /dev/null
+++ b/mcs/doctools/src/Gui/DirectorySelectorForm.cs
@@ -0,0 +1,318 @@
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.IO;
+
+namespace Mono.Doc.Gui
+{
+ /// <summary>
+ /// Summary description for DirectorySelectorForm.
+ /// </summary>
+ public class DirectorySelectorForm : System.Windows.Forms.Form
+ {
+ private DirectoryInfo currentDirectory;
+ private string selectedDirectoryName;
+
+ private System.Windows.Forms.Label labelPath;
+ private System.Windows.Forms.TextBox textBoxPath;
+ private System.Windows.Forms.TreeView tree;
+ private System.Windows.Forms.Button buttonOK;
+ private System.Windows.Forms.Button buttonCancel;
+ private System.Windows.Forms.Button buttonParentDir;
+
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.Container components = null;
+
+ public DirectorySelectorForm()
+ {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+
+ //
+ // TODO: Add any constructor code after InitializeComponent call
+ //
+
+ this.buttonParentDir.ImageList = AssemblyTreeImages.List;
+ this.buttonParentDir.ImageIndex = AssemblyTreeImages.Shortcuts; // TODO: need prev. dir icon
+ this.tree.ImageList = AssemblyTreeImages.List;
+ this.tree.ImageIndex = AssemblyTreeImages.Shortcuts; // TODO: need folder icon
+ this.tree.SelectedImageIndex = AssemblyTreeImages.Shortcuts; // TODO: need folder icon
+
+ if (SetCurrentDirectory(Directory.GetCurrentDirectory()))
+ {
+ this.textBoxPath.Text = this.currentDirectory.FullName;
+ this.selectedDirectoryName = this.currentDirectory.FullName;
+
+ InitializeTree();
+ }
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if(components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Private Instance Methods
+
+ private void InitializeTree()
+ {
+ this.tree.Nodes.Clear();
+
+ foreach (DirectoryInfo dirInfo in this.currentDirectory.GetDirectories())
+ {
+ TreeNode dirNode = new TreeNode(dirInfo.Name);
+ dirNode.Tag = dirInfo.FullName;
+
+ CreateSubdirectoryNodes(dirNode);
+ this.tree.Nodes.Add(dirNode);
+ }
+ }
+
+ private void CreateSubdirectoryNodes(TreeNode dirNode)
+ {
+ DirectoryInfo dirInfo = new DirectoryInfo(dirNode.Tag as string);
+
+ foreach (DirectoryInfo childDirInfo in dirInfo.GetDirectories())
+ {
+ TreeNode childDirNode = new TreeNode(childDirInfo.Name);
+ childDirNode.Tag = childDirInfo.FullName;
+
+ dirNode.Nodes.Add(childDirNode);
+ }
+ }
+
+ private bool SetCurrentDirectory(string dirName)
+ {
+ string errorMessage = null;
+ DirectoryInfo newDirectory = null;
+
+ try
+ {
+ newDirectory = new DirectoryInfo(dirName);
+ }
+ catch (ArgumentNullException)
+ {
+ errorMessage = "cannot be null.";
+ }
+ catch (DirectoryNotFoundException)
+ {
+ errorMessage = "was not found.";
+ }
+ catch (ArgumentException)
+ {
+ errorMessage = "contains invalid characters.";
+ }
+ catch (PathTooLongException)
+ {
+ errorMessage = "is too long.";
+ }
+
+ if (errorMessage != null)
+ {
+ MessageBox.Show("The selected path " + errorMessage,
+ "Problem Opening Directory",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error
+ );
+
+ return false;
+ }
+ else
+ {
+ this.currentDirectory = newDirectory;
+
+ return true;
+ }
+ }
+
+ #endregion // Private Instance Methods
+
+ #region Public Instance Properties
+
+ public string DirectoryName
+ {
+ get { return selectedDirectoryName; }
+ }
+
+ #endregion // Public Instance Properties
+
+ #region Windows Form Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.labelPath = new System.Windows.Forms.Label();
+ this.textBoxPath = new System.Windows.Forms.TextBox();
+ this.tree = new System.Windows.Forms.TreeView();
+ this.buttonOK = new System.Windows.Forms.Button();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.buttonParentDir = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // labelPath
+ //
+ this.labelPath.Location = new System.Drawing.Point(8, 8);
+ this.labelPath.Name = "labelPath";
+ this.labelPath.Size = new System.Drawing.Size(40, 16);
+ this.labelPath.TabIndex = 0;
+ this.labelPath.Text = "Path:";
+ this.labelPath.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // textBoxPath
+ //
+ this.textBoxPath.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.textBoxPath.Location = new System.Drawing.Point(48, 6);
+ this.textBoxPath.Name = "textBoxPath";
+ this.textBoxPath.Size = new System.Drawing.Size(232, 20);
+ this.textBoxPath.TabIndex = 1;
+ this.textBoxPath.Text = "";
+ this.textBoxPath.Leave += new System.EventHandler(this.textBoxPath_Leave);
+ //
+ // tree
+ //
+ this.tree.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.tree.ImageIndex = -1;
+ this.tree.Location = new System.Drawing.Point(8, 32);
+ this.tree.Name = "tree";
+ this.tree.SelectedImageIndex = -1;
+ this.tree.Size = new System.Drawing.Size(304, 288);
+ this.tree.TabIndex = 3;
+ this.tree.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.tree_BeforeSelect);
+ this.tree.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tree_BeforeExpand);
+ //
+ // buttonOK
+ //
+ this.buttonOK.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonOK.Location = new System.Drawing.Point(144, 328);
+ this.buttonOK.Name = "buttonOK";
+ this.buttonOK.TabIndex = 4;
+ this.buttonOK.Text = "OK";
+ this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonCancel.Location = new System.Drawing.Point(232, 328);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.TabIndex = 5;
+ this.buttonCancel.Text = "Cancel";
+ this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
+ //
+ // buttonParentDir
+ //
+ this.buttonParentDir.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonParentDir.Location = new System.Drawing.Point(288, 5);
+ this.buttonParentDir.Name = "buttonParentDir";
+ this.buttonParentDir.Size = new System.Drawing.Size(24, 23);
+ this.buttonParentDir.TabIndex = 6;
+ this.buttonParentDir.Text = "..";
+ this.buttonParentDir.Click += new System.EventHandler(this.buttonParentDir_Click);
+ //
+ // DirectorySelectorForm
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(320, 358);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.buttonParentDir,
+ this.buttonCancel,
+ this.buttonOK,
+ this.tree,
+ this.textBoxPath,
+ this.labelPath});
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
+ this.Name = "DirectorySelectorForm";
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
+ this.Text = "Select Directory";
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+
+ private void buttonCancel_Click(object sender, System.EventArgs e)
+ {
+ this.DialogResult = DialogResult.Cancel;
+ this.Close();
+ }
+
+ private void buttonOK_Click(object sender, System.EventArgs e)
+ {
+ this.DialogResult = DialogResult.OK;
+ this.Close();
+ }
+
+ private void textBoxPath_Leave(object sender, System.EventArgs e)
+ {
+ if (SetCurrentDirectory(textBoxPath.Text))
+ {
+ InitializeTree();
+ }
+ }
+
+ private void tree_BeforeExpand(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
+ {
+ foreach (TreeNode childDirNode in e.Node.Nodes)
+ {
+ if (childDirNode.Nodes.Count == 0)
+ {
+ CreateSubdirectoryNodes(childDirNode);
+ }
+ }
+ }
+
+ private void tree_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
+ {
+ string path = e.Node.Tag as string;
+ this.textBoxPath.Text = path;
+ this.selectedDirectoryName = path;
+ }
+
+ private void buttonParentDir_Click(object sender, System.EventArgs e)
+ {
+ DirectoryInfo parent = this.currentDirectory.Parent;
+
+ if (parent != null && SetCurrentDirectory(parent.FullName))
+ {
+ textBoxPath.Text = parent.FullName;
+ InitializeTree();
+ }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Gui/EditPropertyForm.cs b/mcs/doctools/src/Gui/EditPropertyForm.cs
new file mode 100644
index 00000000000..431ec38377f
--- /dev/null
+++ b/mcs/doctools/src/Gui/EditPropertyForm.cs
@@ -0,0 +1,182 @@
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace Mono.Doc.Gui
+{
+ /// <summary>
+ /// Summary description for EditPropertyForm.
+ /// </summary>
+ public class EditPropertyForm : System.Windows.Forms.Form
+ {
+ private System.Windows.Forms.Label labelPropertyName;
+ private System.Windows.Forms.Label labelPropertyValue;
+ private System.Windows.Forms.TextBox textBoxPropertyName;
+ private System.Windows.Forms.TextBox textBoxPropertyValue;
+ private System.Windows.Forms.Button buttonOk;
+ private System.Windows.Forms.Button buttonCancel;
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.Container components = null;
+
+ public EditPropertyForm()
+ {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+
+ //
+ // TODO: Add any constructor code after InitializeComponent call
+ //
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if(components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows Form Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.labelPropertyName = new System.Windows.Forms.Label();
+ this.labelPropertyValue = new System.Windows.Forms.Label();
+ this.textBoxPropertyName = new System.Windows.Forms.TextBox();
+ this.textBoxPropertyValue = new System.Windows.Forms.TextBox();
+ this.buttonOk = new System.Windows.Forms.Button();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // labelPropertyName
+ //
+ this.labelPropertyName.Location = new System.Drawing.Point(8, 8);
+ this.labelPropertyName.Name = "labelPropertyName";
+ this.labelPropertyName.Size = new System.Drawing.Size(100, 16);
+ this.labelPropertyName.TabIndex = 0;
+ this.labelPropertyName.Text = "Property Name";
+ //
+ // labelPropertyValue
+ //
+ this.labelPropertyValue.Location = new System.Drawing.Point(8, 56);
+ this.labelPropertyValue.Name = "labelPropertyValue";
+ this.labelPropertyValue.Size = new System.Drawing.Size(96, 16);
+ this.labelPropertyValue.TabIndex = 1;
+ this.labelPropertyValue.Text = "Property Value";
+ //
+ // textBoxPropertyName
+ //
+ this.textBoxPropertyName.Location = new System.Drawing.Point(8, 24);
+ this.textBoxPropertyName.Name = "textBoxPropertyName";
+ this.textBoxPropertyName.Size = new System.Drawing.Size(272, 20);
+ this.textBoxPropertyName.TabIndex = 2;
+ this.textBoxPropertyName.Text = "New Property";
+ //
+ // textBoxPropertyValue
+ //
+ this.textBoxPropertyValue.Location = new System.Drawing.Point(8, 72);
+ this.textBoxPropertyValue.Name = "textBoxPropertyValue";
+ this.textBoxPropertyValue.Size = new System.Drawing.Size(272, 20);
+ this.textBoxPropertyValue.TabIndex = 3;
+ this.textBoxPropertyValue.Text = "Property Value";
+ //
+ // buttonOk
+ //
+ this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK;
+ this.buttonOk.Location = new System.Drawing.Point(120, 104);
+ this.buttonOk.Name = "buttonOk";
+ this.buttonOk.TabIndex = 4;
+ this.buttonOk.Text = "OK";
+ this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.buttonCancel.Location = new System.Drawing.Point(208, 104);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.TabIndex = 5;
+ this.buttonCancel.Text = "Cancel";
+ this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
+ //
+ // EditPropertyForm
+ //
+ this.AcceptButton = this.buttonOk;
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.CancelButton = this.buttonCancel;
+ this.ClientSize = new System.Drawing.Size(292, 136);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.buttonCancel,
+ this.buttonOk,
+ this.textBoxPropertyValue,
+ this.textBoxPropertyName,
+ this.labelPropertyValue,
+ this.labelPropertyName});
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.Name = "EditPropertyForm";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Edit Project Property";
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+
+ private void buttonCancel_Click(object sender, System.EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void buttonOk_Click(object sender, System.EventArgs e)
+ {
+ this.Close();
+ }
+
+ #region Public Instance Properties
+
+ public string PropertyName
+ {
+ get { return this.textBoxPropertyName.Text; }
+ set { this.textBoxPropertyName.Text = value; }
+ }
+
+ public string PropertyValue
+ {
+ get { return this.textBoxPropertyValue.Text; }
+ set { this.textBoxPropertyValue.Text = value; }
+ }
+
+ #endregion // Public Instance Properties
+ }
+}
diff --git a/mcs/doctools/src/Gui/ExampleCodeEditorForm.cs b/mcs/doctools/src/Gui/ExampleCodeEditorForm.cs
new file mode 100644
index 00000000000..aae0001d991
--- /dev/null
+++ b/mcs/doctools/src/Gui/ExampleCodeEditorForm.cs
@@ -0,0 +1,166 @@
+// ExampleCodeEditorForm.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace Mono.Doc.Gui
+{
+ /// <summary>
+ /// Summary description for ExampleCodeEditorForm.
+ /// </summary>
+ public class ExampleCodeEditorForm : System.Windows.Forms.Form
+ {
+ // TODO: figure out how to munge TextBox to support simple autoindent.
+
+ private System.Windows.Forms.Label labelExampleLanguage;
+ private System.Windows.Forms.ComboBox comboBoxExampleLanguage;
+ private System.Windows.Forms.Button buttonOk;
+ private System.Windows.Forms.Button buttonCancel;
+ private System.Windows.Forms.TextBox textBoxExampleText;
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.Container components = null;
+
+ public ExampleCodeEditorForm()
+ {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+
+ //
+ // TODO: Add any constructor code after InitializeComponent call
+ //
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if(components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows Form Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.labelExampleLanguage = new System.Windows.Forms.Label();
+ this.comboBoxExampleLanguage = new System.Windows.Forms.ComboBox();
+ this.buttonOk = new System.Windows.Forms.Button();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.textBoxExampleText = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // labelExampleLanguage
+ //
+ this.labelExampleLanguage.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
+ this.labelExampleLanguage.Location = new System.Drawing.Point(168, 8);
+ this.labelExampleLanguage.Name = "labelExampleLanguage";
+ this.labelExampleLanguage.Size = new System.Drawing.Size(112, 16);
+ this.labelExampleLanguage.TabIndex = 0;
+ this.labelExampleLanguage.Text = "Example Language:";
+ this.labelExampleLanguage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // comboBoxExampleLanguage
+ //
+ this.comboBoxExampleLanguage.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
+ this.comboBoxExampleLanguage.Items.AddRange(new object[] {
+ "C#"});
+ this.comboBoxExampleLanguage.Location = new System.Drawing.Point(280, 6);
+ this.comboBoxExampleLanguage.Name = "comboBoxExampleLanguage";
+ this.comboBoxExampleLanguage.Size = new System.Drawing.Size(121, 21);
+ this.comboBoxExampleLanguage.TabIndex = 1;
+ //
+ // buttonOk
+ //
+ this.buttonOk.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonOk.Location = new System.Drawing.Point(248, 353);
+ this.buttonOk.Name = "buttonOk";
+ this.buttonOk.Size = new System.Drawing.Size(64, 24);
+ this.buttonOk.TabIndex = 2;
+ this.buttonOk.Text = "OK";
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.buttonCancel.Location = new System.Drawing.Point(328, 353);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(64, 24);
+ this.buttonCancel.TabIndex = 3;
+ this.buttonCancel.Text = "Cancel";
+ //
+ // textBoxExampleText
+ //
+ this.textBoxExampleText.AcceptsReturn = true;
+ this.textBoxExampleText.AcceptsTab = true;
+ this.textBoxExampleText.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.textBoxExampleText.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
+ this.textBoxExampleText.Location = new System.Drawing.Point(8, 32);
+ this.textBoxExampleText.Multiline = true;
+ this.textBoxExampleText.Name = "textBoxExampleText";
+ this.textBoxExampleText.ScrollBars = System.Windows.Forms.ScrollBars.Both;
+ this.textBoxExampleText.Size = new System.Drawing.Size(392, 313);
+ this.textBoxExampleText.TabIndex = 4;
+ this.textBoxExampleText.Text = "// example code";
+ this.textBoxExampleText.WordWrap = false;
+ //
+ // ExampleCodeEditorForm
+ //
+ this.AcceptButton = this.buttonOk;
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.CancelButton = this.buttonCancel;
+ this.ClientSize = new System.Drawing.Size(408, 382);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.textBoxExampleText,
+ this.buttonCancel,
+ this.buttonOk,
+ this.comboBoxExampleLanguage,
+ this.labelExampleLanguage});
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
+ this.Name = "ExampleCodeEditorForm";
+ this.ShowInTaskbar = false;
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
+ this.Text = "Example Code Editor";
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+ }
+}
diff --git a/mcs/doctools/src/Gui/GenericEditorForm.cs b/mcs/doctools/src/Gui/GenericEditorForm.cs
new file mode 100644
index 00000000000..4af61c0791d
--- /dev/null
+++ b/mcs/doctools/src/Gui/GenericEditorForm.cs
@@ -0,0 +1,232 @@
+// GenericEditorForm.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace Mono.Doc.Gui
+{
+ /// <summary>
+ /// Summary description for GenericEditorForm.
+ /// </summary>
+ public class GenericEditorForm : System.Windows.Forms.Form
+ {
+ protected System.Windows.Forms.ToolBar toolBar;
+ protected System.Windows.Forms.Label labelSummary;
+ protected System.Windows.Forms.TextBox textBoxSummary;
+ protected System.Windows.Forms.Label labelRemarks;
+ protected System.Windows.Forms.TextBox textBoxRemarks;
+ protected System.Windows.Forms.Label labelSeeAlso;
+ protected System.Windows.Forms.ComboBox comboBoxLanguage;
+ protected System.Windows.Forms.Label labelLanguage;
+ protected System.Windows.Forms.ListView listViewSeeAlso;
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.Container components = null;
+
+ public GenericEditorForm()
+ {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+
+ // TODO: hack so I can see the toolbar and ListView
+ toolBar.ImageList = AssemblyTreeImages.List;
+ listViewSeeAlso.SmallImageList = AssemblyTreeImages.List;
+
+ for (int j = 0; j < toolBar.ImageList.Images.Count; j++)
+ {
+ ToolBarButton b = new ToolBarButton();
+ b.ImageIndex = j;
+ toolBar.Buttons.Add(b);
+
+ ListViewItem i = new ListViewItem("See Also " + j.ToString(), j);
+ listViewSeeAlso.Items.Add(i);
+ }
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if(components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows Form Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.toolBar = new System.Windows.Forms.ToolBar();
+ this.labelSummary = new System.Windows.Forms.Label();
+ this.textBoxSummary = new System.Windows.Forms.TextBox();
+ this.labelRemarks = new System.Windows.Forms.Label();
+ this.textBoxRemarks = new System.Windows.Forms.TextBox();
+ this.labelSeeAlso = new System.Windows.Forms.Label();
+ this.comboBoxLanguage = new System.Windows.Forms.ComboBox();
+ this.labelLanguage = new System.Windows.Forms.Label();
+ this.listViewSeeAlso = new System.Windows.Forms.ListView();
+ this.SuspendLayout();
+ //
+ // toolBar
+ //
+ this.toolBar.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
+ this.toolBar.Divider = false;
+ this.toolBar.Dock = System.Windows.Forms.DockStyle.None;
+ this.toolBar.DropDownArrows = true;
+ this.toolBar.Location = new System.Drawing.Point(8, 0);
+ this.toolBar.Name = "toolBar";
+ this.toolBar.ShowToolTips = true;
+ this.toolBar.Size = new System.Drawing.Size(416, 23);
+ this.toolBar.TabIndex = 0;
+ this.toolBar.TextAlign = System.Windows.Forms.ToolBarTextAlign.Right;
+ this.toolBar.Wrappable = false;
+ //
+ // labelSummary
+ //
+ this.labelSummary.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.labelSummary.Location = new System.Drawing.Point(8, 64);
+ this.labelSummary.Name = "labelSummary";
+ this.labelSummary.Size = new System.Drawing.Size(416, 16);
+ this.labelSummary.TabIndex = 1;
+ this.labelSummary.Text = "Summary";
+ //
+ // textBoxSummary
+ //
+ this.textBoxSummary.AcceptsReturn = true;
+ this.textBoxSummary.AcceptsTab = true;
+ this.textBoxSummary.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.textBoxSummary.Location = new System.Drawing.Point(8, 80);
+ this.textBoxSummary.Multiline = true;
+ this.textBoxSummary.Name = "textBoxSummary";
+ this.textBoxSummary.Size = new System.Drawing.Size(416, 72);
+ this.textBoxSummary.TabIndex = 2;
+ this.textBoxSummary.Text = "Insert summary here.";
+ //
+ // labelRemarks
+ //
+ this.labelRemarks.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.labelRemarks.Location = new System.Drawing.Point(8, 160);
+ this.labelRemarks.Name = "labelRemarks";
+ this.labelRemarks.Size = new System.Drawing.Size(416, 16);
+ this.labelRemarks.TabIndex = 3;
+ this.labelRemarks.Text = "Remarks";
+ //
+ // textBoxRemarks
+ //
+ this.textBoxRemarks.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.textBoxRemarks.Location = new System.Drawing.Point(8, 176);
+ this.textBoxRemarks.Multiline = true;
+ this.textBoxRemarks.Name = "textBoxRemarks";
+ this.textBoxRemarks.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.textBoxRemarks.Size = new System.Drawing.Size(416, 192);
+ this.textBoxRemarks.TabIndex = 3;
+ this.textBoxRemarks.Text = "Insert remarks here.";
+ //
+ // labelSeeAlso
+ //
+ this.labelSeeAlso.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.labelSeeAlso.Location = new System.Drawing.Point(8, 376);
+ this.labelSeeAlso.Name = "labelSeeAlso";
+ this.labelSeeAlso.Size = new System.Drawing.Size(416, 16);
+ this.labelSeeAlso.TabIndex = 5;
+ this.labelSeeAlso.Text = "See Also";
+ //
+ // comboBoxLanguage
+ //
+ this.comboBoxLanguage.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
+ this.comboBoxLanguage.Location = new System.Drawing.Point(304, 32);
+ this.comboBoxLanguage.Name = "comboBoxLanguage";
+ this.comboBoxLanguage.Size = new System.Drawing.Size(121, 21);
+ this.comboBoxLanguage.TabIndex = 1;
+ this.comboBoxLanguage.Text = "English (en)";
+ //
+ // labelLanguage
+ //
+ this.labelLanguage.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.labelLanguage.Location = new System.Drawing.Point(8, 34);
+ this.labelLanguage.Name = "labelLanguage";
+ this.labelLanguage.Size = new System.Drawing.Size(296, 16);
+ this.labelLanguage.TabIndex = 8;
+ this.labelLanguage.Text = "Language:";
+ this.labelLanguage.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // listViewSeeAlso
+ //
+ this.listViewSeeAlso.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.listViewSeeAlso.GridLines = true;
+ this.listViewSeeAlso.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
+ this.listViewSeeAlso.LabelWrap = false;
+ this.listViewSeeAlso.Location = new System.Drawing.Point(8, 392);
+ this.listViewSeeAlso.Name = "listViewSeeAlso";
+ this.listViewSeeAlso.Size = new System.Drawing.Size(416, 72);
+ this.listViewSeeAlso.Sorting = System.Windows.Forms.SortOrder.Ascending;
+ this.listViewSeeAlso.TabIndex = 4;
+ this.listViewSeeAlso.View = System.Windows.Forms.View.List;
+ //
+ // GenericEditorForm
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(432, 477);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.listViewSeeAlso,
+ this.labelLanguage,
+ this.comboBoxLanguage,
+ this.labelSeeAlso,
+ this.textBoxRemarks,
+ this.labelRemarks,
+ this.textBoxSummary,
+ this.labelSummary,
+ this.toolBar});
+ this.Name = "GenericEditorForm";
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
+ this.Text = "GenericEditorForm";
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+ }
+}
diff --git a/mcs/doctools/src/Gui/Gui.csproj b/mcs/doctools/src/Gui/Gui.csproj
new file mode 100644
index 00000000000..6e5ec50d107
--- /dev/null
+++ b/mcs/doctools/src/Gui/Gui.csproj
@@ -0,0 +1,238 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{B76CBA27-ABBD-45FE-AFC3-A629BC13BAAE}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "monodoc"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "WinExe"
+ RootNamespace = "Mono.Doc.Gui"
+ StartupObject = "Mono.Doc.Gui.GuiDriver"
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "..\..\build\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "..\..\build\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "Core"
+ Project = "{73F5A60D-A5E3-4852-B4C6-478275E733F9}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "D:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Drawing"
+ AssemblyName = "System.Drawing"
+ HintPath = "D:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll"
+ />
+ <Reference
+ Name = "System.Windows.Forms"
+ AssemblyName = "System.Windows.Forms"
+ HintPath = "D:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "D:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "D:\WINNT\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AboutForm.cs"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AboutForm.resx"
+ DependentUpon = "AboutForm.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "AssemblyTreeImages.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyTreeLoader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DirectorySelectorForm.cs"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DirectorySelectorForm.resx"
+ DependentUpon = "DirectorySelectorForm.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "EditPropertyForm.cs"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "EditPropertyForm.resx"
+ DependentUpon = "EditPropertyForm.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "ExampleCodeEditorForm.cs"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ExampleCodeEditorForm.resx"
+ DependentUpon = "ExampleCodeEditorForm.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "GenericEditorForm.cs"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GenericEditorForm.resx"
+ DependentUpon = "GenericEditorForm.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "GuiDriver.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GuiResources.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ImageResources.resx"
+ Link = "..\..\etc\gui\ImageResources.resx"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "MainForm.cs"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MainForm.resx"
+ DependentUpon = "MainForm.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "MdiToolBar.cs"
+ SubType = "Component"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MdiToolBar.resx"
+ DependentUpon = "MdiToolBar.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "ProjectOptionsForm.cs"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ProjectOptionsForm.resx"
+ DependentUpon = "ProjectOptionsForm.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "TestingForm.cs"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestingForm.resx"
+ DependentUpon = "TestingForm.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "TextResources.resx"
+ Link = "..\..\etc\gui\TextResources.resx"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "TypeEditorForm.cs"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TypeEditorForm.resx"
+ DependentUpon = "TypeEditorForm.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "UnexpectedErrorForm.cs"
+ SubType = "Form"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "UnexpectedErrorForm.resx"
+ DependentUpon = "UnexpectedErrorForm.cs"
+ BuildAction = "EmbeddedResource"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/doctools/src/Gui/GuiDriver.cs b/mcs/doctools/src/Gui/GuiDriver.cs
new file mode 100644
index 00000000000..21ccee8929a
--- /dev/null
+++ b/mcs/doctools/src/Gui/GuiDriver.cs
@@ -0,0 +1,45 @@
+// GuiDriver.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Windows.Forms;
+
+namespace Mono.Doc.Gui
+{
+ public abstract class GuiDriver
+ {
+ [STAThread]
+ public static void Main(string[] args)
+ {
+ try
+ {
+ // DEBUG: testing UnexpectedErrorForm
+ //throw new ApplicationException("test exception");
+ Application.Run(new MainForm((args.Length > 0) ? args[0] : null));
+ }
+ catch (Exception e)
+ {
+ UnexpectedErrorForm error = new UnexpectedErrorForm(e);
+ error.ShowDialog();
+ }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Gui/GuiResources.cs b/mcs/doctools/src/Gui/GuiResources.cs
new file mode 100644
index 00000000000..a3136c7b617
--- /dev/null
+++ b/mcs/doctools/src/Gui/GuiResources.cs
@@ -0,0 +1,78 @@
+// GuiResources.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Drawing;
+using System.Reflection;
+using System.Resources;
+
+namespace Mono.Doc.Gui
+{
+ /// <summary>
+ /// Summary description for Resources.
+ /// </summary>
+ public class GuiResources
+ {
+ private static ResourceManager imageMgr = null;
+ private static ResourceManager textMgr = null;
+
+ // this class cannot be instantiated
+ private GuiResources()
+ {
+ }
+
+ static GuiResources()
+ {
+ imageMgr = new ResourceManager("Mono.Doc.Gui.ImageResources", Assembly.GetExecutingAssembly());
+ textMgr = new ResourceManager("Mono.Doc.Gui.TextResources", Assembly.GetExecutingAssembly());
+ }
+
+ public static Bitmap AssemblyTreeBitmap
+ {
+ get { return (Bitmap) imageMgr.GetObject("AssemblyTree.Bitmap"); }
+ }
+
+ public static Bitmap AboutMonodocBitmap
+ {
+ get { return (Bitmap) imageMgr.GetObject("AboutMonodoc.Bitmap"); }
+ }
+
+ public static Bitmap ErrorExplosionBitmap
+ {
+ get { return (Bitmap) imageMgr.GetObject("ErrorExplosion.Bitmap"); }
+ }
+
+ public static Icon OpenBookIcon
+ {
+ get { return (Icon) imageMgr.GetObject("OpenBook.Icon"); }
+ }
+
+ public static Icon ClosedBookIcon
+ {
+ get { return (Icon) imageMgr.GetObject("ClosedBook.Icon"); }
+ }
+
+ public static string GetString(string key)
+ {
+ return textMgr.GetString(key);
+ }
+ }
+}
diff --git a/mcs/doctools/src/Gui/MainForm.cs b/mcs/doctools/src/Gui/MainForm.cs
new file mode 100644
index 00000000000..10c952db1d1
--- /dev/null
+++ b/mcs/doctools/src/Gui/MainForm.cs
@@ -0,0 +1,898 @@
+// MainForm.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.IO;
+using System.Reflection;
+using System.Windows.Forms;
+
+using Mono.Doc.Core;
+
+namespace Mono.Doc.Gui
+{
+ public class MainForm : Form
+ {
+ #region Private Instance Fields
+
+ // project
+ private DocProject project;
+ private string projectName;
+
+ // mdi toolbar
+ private MdiToolBar mdiToolBar;
+
+ // main menu / items
+ private MainMenu mainMenu;
+ private MenuItem menuFile;
+ private MenuItem menuFileNew;
+ private MenuItem menuFileOpen;
+ private MenuItem menuFileClose;
+ private MenuItem menuFileSave;
+ private MenuItem menuFileSaveAs;
+ private MenuItem menuFileSeparator1;
+ private MenuItem menuFileRecent;
+ private MenuItem menuFileSeparator2;
+ private MenuItem menuFileExit;
+ private MenuItem menuEdit;
+ private MenuItem menuWindow;
+ private MenuItem menuWindowCascade;
+ private MenuItem menuWindowTile;
+ private MenuItem menuWindowTileHorizontal;
+ private MenuItem menuDebug;
+ private MenuItem menuDebugHaltAndCatchFire;
+ private MenuItem menuDebugDisplayGeneric;
+ private MenuItem menuHelp;
+ private MenuItem menuHelpAbout;
+
+ // tree context menu / items
+ private ContextMenu treeProjectMenu;
+ private MenuItem treeMenuProjectAddAssembly;
+ private MenuItem treeMenuProjectAddDirectory;
+ private MenuItem treeMenuProjectSeparator1;
+ private MenuItem treeMenuProjectOptions;
+ private ContextMenu treeShortcutMenu;
+ private MenuItem treeMenuShortcutClear;
+ private ContextMenu treeDirectoryMenu;
+ private MenuItem treeMenuDirectoryAdd;
+ private ContextMenu treeAssemblyMenu;
+ private MenuItem treeMenuAssemblyAdd;
+
+ // status bar
+ private StatusBar status;
+
+ // project tree
+ private TreeView tree;
+ private TreeNode treeProjectRootNode;
+ private TreeNode treeShortcutsNode;
+ private TreeNode treeDirectoryNode;
+ private TreeNode treeAssemblyNode;
+
+ // splitter
+ private Splitter verticalSplitter;
+
+ #endregion // Private Instance Fields
+
+ #region Constructors and Destructors
+
+ public MainForm(string projectFile)
+ {
+ this.project = new DocProject();
+ this.project.Modified += new EventHandler(this.project_Modified );
+
+ UpdateTitle();
+
+ this.SuspendLayout();
+
+ // this
+ this.AutoScaleBaseSize = new Size(5, 13);
+ this.IsMdiContainer = true;
+ this.Name = "MainForm";
+
+ // mdiToolBar
+ this.mdiToolBar = new MdiToolBar();
+ this.mdiToolBar.Dock = DockStyle.Top; // TODO: make this configurable
+ this.mdiToolBar.TextAlign = ToolBarTextAlign.Right;
+ this.mdiToolBar.Divider = true; // TODO: only if it's docked at the top.
+ this.mdiToolBar.ImageList = AssemblyTreeImages.List;
+ this.mdiToolBar.Appearance = ToolBarAppearance.Flat;
+
+ // set initial size to 75% of the current screen
+ // TODO: this should only happen if we have no size prefs
+ // HACK: not sure how best to determine the current screen for multihead users
+ Rectangle workArea = Screen.PrimaryScreen.WorkingArea;
+ int x = (int) (workArea.Width * 0.75);
+ int y = (int) (workArea.Height * 0.75);
+ this.ClientSize = new Size(x, y);
+
+ // won't completely remove flicker, but it helps
+ this.SetStyle(ControlStyles.DoubleBuffer, true);
+
+ // main menu / items
+ this.mainMenu = new MainMenu();
+ this.menuFile = new MenuItem();
+ this.menuFileNew = new MenuItem();
+ this.menuFileOpen = new MenuItem();
+ this.menuFileClose = new MenuItem();
+ this.menuFileSave = new MenuItem();
+ this.menuFileSaveAs = new MenuItem();
+ this.menuFileSeparator1 = new MenuItem();
+ this.menuFileRecent = new MenuItem();
+ this.menuFileSeparator2 = new MenuItem();
+ this.menuFileExit = new MenuItem();
+ this.menuEdit = new MenuItem();
+ this.menuWindow = new MenuItem();
+ this.menuWindowCascade = new MenuItem();
+ this.menuWindowTile = new MenuItem();
+ this.menuWindowTileHorizontal = new MenuItem();
+ this.menuDebug = new MenuItem();
+ this.menuDebugHaltAndCatchFire = new MenuItem();
+ this.menuDebugDisplayGeneric = new MenuItem();
+ this.menuHelp = new MenuItem();
+ this.menuHelpAbout = new MenuItem();
+
+ InitializeMainMenu();
+
+ // status bar
+ this.status = new StatusBar();
+ this.status.Text = "Ready.";
+
+ // project tree
+ this.tree = new TreeView();
+ this.treeAssemblyNode = new TreeNode();
+ this.treeDirectoryNode = new TreeNode();
+ this.treeProjectRootNode = new TreeNode();
+ this.treeShortcutsNode = new TreeNode();
+
+ InitializeTree();
+
+ // vertical splitter
+ // TODO: figure out how to store location in prefs
+ this.verticalSplitter = new Splitter();
+ this.verticalSplitter.Name = "verticalSplitter";
+ this.verticalSplitter.TabStop = false;
+
+ // add components and layout
+ this.Menu = this.mainMenu;
+ this.Controls.AddRange(new Control[] {
+ this.mdiToolBar,
+ this.verticalSplitter,
+ this.tree,
+ this.status
+ });
+
+ this.ResumeLayout(false);
+
+ // project tree context menus
+ this.treeProjectMenu = new ContextMenu();
+ this.treeMenuProjectAddAssembly = new MenuItem();
+ this.treeMenuProjectAddDirectory = new MenuItem();
+ this.treeMenuProjectSeparator1 = new MenuItem();
+ this.treeMenuProjectOptions = new MenuItem();
+
+ this.treeShortcutMenu = new ContextMenu();
+ this.treeMenuShortcutClear = new MenuItem();
+
+ this.treeDirectoryMenu = new ContextMenu();
+ this.treeMenuDirectoryAdd = new MenuItem();
+
+ this.treeAssemblyMenu = new ContextMenu();
+ this.treeMenuAssemblyAdd = new MenuItem();
+
+ InitializeTreeContextMenu();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ base.Dispose(disposing);
+ }
+
+ #endregion // Constructors and Destructors
+
+ #region Private Instance Methods
+
+ private void DisplayCorrectTreeMenu(Point showAt)
+ {
+ ContextMenu displayMenu = null;
+
+ if (this.treeProjectRootNode == tree.SelectedNode)
+ {
+ displayMenu = this.treeProjectMenu;
+ }
+ else if (this.treeShortcutsNode == tree.SelectedNode)
+ {
+ displayMenu = this.treeShortcutMenu;
+ }
+ else if (this.treeDirectoryNode == tree.SelectedNode)
+ {
+ displayMenu = this.treeDirectoryMenu;
+ }
+ else if (this.treeAssemblyNode == tree.SelectedNode)
+ {
+ displayMenu = this.treeAssemblyMenu;
+ }
+
+ if (displayMenu != null)
+ {
+ displayMenu.Show(this.tree, showAt);
+ }
+ }
+
+ private void Clear()
+ {
+ project.Clear();
+ }
+
+ private void CloseProject()
+ {
+ if (project.IsModified)
+ {
+ // TODO: i18n
+ DialogResult r = MessageBox.Show(
+ "Save changes to " + projectName + "?",
+ "Save Modified Project",
+ MessageBoxButtons.YesNoCancel,
+ MessageBoxIcon.Question,
+ MessageBoxDefaultButton.Button1
+ );
+
+ switch (r)
+ {
+ case DialogResult.Yes:
+ SaveOrSaveAsProject();
+ Clear();
+ UpdateTitle();
+ InitializeTree();
+ break;
+ case DialogResult.No:
+ Clear();
+ UpdateTitle();
+ InitializeTree();
+ break;
+ }
+ }
+ else
+ {
+ Clear();
+ UpdateTitle();
+ InitializeTree();
+ }
+ }
+
+ private void UpdateTitle()
+ {
+ string title = GuiResources.GetString("Form.Main.Title");
+
+ if (project.IsNewProject)
+ {
+ projectName = DocProject.UntitledProjectName;
+ }
+ else
+ {
+ projectName = Path.GetFileName(project.FilePath);
+ projectName = projectName.Substring(0, projectName.LastIndexOf('.'));
+ }
+
+ this.Text = projectName + (project.IsModified ? "*" : "") + " - " + title;
+ }
+
+ private void SaveOrSaveAsProject()
+ {
+ if (project.IsNewProject)
+ {
+ SaveAsProject();
+ }
+ else
+ {
+ SaveProject();
+ }
+ }
+
+ private void SaveAsProject()
+ {
+ SaveFileDialog save = new SaveFileDialog();
+
+ if (project.IsNewProject)
+ {
+ save.FileName =
+ "." +
+ Path.DirectorySeparatorChar +
+ DocProject.UntitledProjectName +
+ ".mdproj"; // TODO: abstract constant
+ }
+ else
+ {
+ save.FileName = project.FilePath;
+ }
+
+ save.Filter = "Monodoc Project Files (*.mdproj)|*.mdproj|All Files (*.*)|*.*"; // TODO: abstract constrant
+ save.RestoreDirectory = true;
+
+ if (save.ShowDialog() == DialogResult.OK)
+ {
+ project.FilePath = save.FileName;
+ SaveProject();
+ InitializeTree();
+ }
+ }
+
+ private void SaveProject()
+ {
+ try
+ {
+ project.Save();
+ UpdateTitle();
+ }
+ catch (MonodocException mde)
+ {
+ // TODO: error handling
+ MessageBox.Show("MonodocException during project save: " + mde.Message);
+ }
+ catch (Exception e)
+ {
+ // TODO: better error handling
+ MessageBox.Show("OTHER exception during project open: " + e.Message);
+ }
+ }
+
+ private void LoadSourceDocuments()
+ {
+ int fileCount = 0;
+
+ try
+ {
+ foreach (string dirName in this.project.XmlDirectories)
+ {
+ // TODO: abstract constant
+ RecursiveFileList fileList = new RecursiveFileList(dirName, "*.xml");
+
+ foreach (FileInfo f in fileList.Files)
+ {
+ this.status.Text = "Scanning file: " + f.Name;
+ fileCount++;
+ }
+ }
+
+ this.status.Text = "Scanned " + fileCount + " XML source files.";
+ }
+ catch (Exception e)
+ {
+ // TODO: better error handling
+ MessageBox.Show("Problem while trying to scan XML source directories.\n" +
+ e.Message + "\n" +
+ e.StackTrace
+ );
+ }
+ }
+
+ private void OpenProject(string fileName)
+ {
+ try
+ {
+ project.Load(fileName);
+ UpdateTitle();
+ InitializeTree();
+ LoadSourceDocuments();
+ }
+ catch (MonodocException mde)
+ {
+ // TODO: better error handling
+ MessageBox.Show("MonodocException during project open: " + mde.Message);
+ }
+ catch (Exception e)
+ {
+ // TODO: better error handling
+ MessageBox.Show("OTHER exception during project open: " + e.Message + "\n" + e.StackTrace);
+ }
+ }
+
+ #endregion // Private Instance Methods
+
+ #region Tree Init
+
+ private void InitializeTree()
+ {
+
+ // tree
+ this.tree.Dock = DockStyle.Left;
+ this.tree.ImageList = AssemblyTreeImages.List;
+ this.tree.ImageIndex = 0;
+ this.tree.SelectedImageIndex = 0;
+ this.tree.Name = "tree";
+ this.tree.TabIndex = 1;
+ this.tree.AfterSelect += new TreeViewEventHandler(this.tree_AfterSelect);
+ this.tree.MouseUp += new MouseEventHandler(this.tree_MouseUp);
+
+ // treeAssemblyNode
+ this.treeAssemblyNode.Text = "Assemblies"; // TODO: i18n
+ this.treeAssemblyNode.ImageIndex = AssemblyTreeImages.AssemblyClosed;
+ this.treeAssemblyNode.SelectedImageIndex = AssemblyTreeImages.AssemblyClosed;
+ this.treeAssemblyNode.Tag = "ASSEMBLIES"; // TODO: abstract constant
+
+ // treeDirectoryNode
+ this.treeDirectoryNode.Text = "Source Directories"; // TODO: i18n
+ this.treeDirectoryNode.ImageIndex = AssemblyTreeImages.Shortcuts; // TODO: folder image
+ this.treeDirectoryNode.SelectedImageIndex = AssemblyTreeImages.Shortcuts;
+ this.treeDirectoryNode.Tag = "DIRECTORIES"; // TODO: abstract constant
+
+ // treeProjectRootNode
+ this.treeProjectRootNode.Text = projectName + " Project"; // TODO: i18n
+ this.treeProjectRootNode.ImageIndex = AssemblyTreeImages.Shortcuts; // TODO: project image
+ this.treeProjectRootNode.SelectedImageIndex = AssemblyTreeImages.Shortcuts;
+ this.treeProjectRootNode.Tag = "PROJECT"; // TODO: abstract constant
+
+ // treeShortcutsNode
+ this.treeShortcutsNode.Text = "Shortcuts"; // TODO: i18n
+ this.treeShortcutsNode.ImageIndex = AssemblyTreeImages.Shortcuts;
+ this.treeShortcutsNode.SelectedImageIndex = AssemblyTreeImages.Shortcuts;
+ this.treeShortcutsNode.Tag = "SHORTCUTS"; // TODO: abstract constant
+
+ this.tree.BeginUpdate();
+ this.tree.Nodes.Clear();
+
+ // ugh. appears necessary to effectively rebuild the tree.
+ TreeNode[] nodesToRemove = new TreeNode[] {
+ this.treeAssemblyNode,
+ this.treeDirectoryNode,
+ this.treeProjectRootNode,
+ this.treeShortcutsNode
+ };
+
+ foreach (TreeNode n in nodesToRemove)
+ {
+ n.Nodes.Clear();
+
+ if (n.Parent != null)
+ {
+ n.Remove();
+ }
+ }
+
+ tree.Nodes.Add(this.treeProjectRootNode);
+
+ this.treeProjectRootNode.Nodes.AddRange(
+ new TreeNode[] {
+ this.treeShortcutsNode,
+ this.treeDirectoryNode,
+ this.treeAssemblyNode
+ });
+
+ // project xml directories
+ foreach (string xmlDir in project.XmlDirectories)
+ {
+ TreeNode dirNode = new TreeNode(xmlDir);
+ dirNode.ImageIndex = AssemblyTreeImages.Shortcuts; // TODO: folder image
+ dirNode.SelectedImageIndex = AssemblyTreeImages.Shortcuts;
+ dirNode.Tag = "DIRECTORY:" + xmlDir;
+
+ this.treeDirectoryNode.Nodes.Add(dirNode);
+ }
+
+ // project assemblies
+ try
+ {
+ foreach (string assemblyFile in this.project.AssemblyFiles)
+ {
+ AssemblyLoader asmLoader = new AssemblyLoader(assemblyFile);
+ AssemblyTreeLoader treeLoader = new AssemblyTreeLoader(asmLoader);
+
+ treeLoader.LoadNode(this.treeAssemblyNode);
+ }
+ }
+ catch (ApplicationException ae)
+ {
+ // TODO: better error handling
+ MessageBox.Show(ae.Message, "Error Loading project assemblies");
+ }
+
+ this.treeProjectRootNode.Expand();
+ this.treeAssemblyNode.Expand();
+ this.treeDirectoryNode.Expand();
+ this.tree.EndUpdate();
+ }
+
+ #endregion // Tree Init
+
+ #region Tree Events
+
+ private void tree_AfterSelect(object sender, TreeViewEventArgs args)
+ {
+ this.status.Text = (string) args.Node.Tag;
+ }
+
+ private void tree_MouseUp(object sender, MouseEventArgs args)
+ {
+ if (args.Button == MouseButtons.Right)
+ {
+ tree.SelectedNode = tree.GetNodeAt(args.X, args.Y);
+
+ if (tree.SelectedNode != null)
+ {
+ Point menuLoc = this.PointToClient(tree.PointToScreen(new Point(args.X, args.Y)));
+ this.status.Text = "display tree menu at " + menuLoc.ToString();
+ DisplayCorrectTreeMenu(menuLoc);
+ }
+ }
+ }
+
+ #endregion // Tree Events
+
+ #region Tree Context Menu Init
+
+ private void InitializeTreeContextMenu()
+ {
+ // treeProjectMenu
+ this.treeProjectMenu.MenuItems.AddRange(
+ new MenuItem[] {
+ this.treeMenuProjectAddAssembly,
+ this.treeMenuProjectAddDirectory,
+ this.treeMenuProjectSeparator1,
+ this.treeMenuProjectOptions
+ });
+
+ this.treeMenuProjectAddAssembly.Index = 0;
+ this.treeMenuProjectAddAssembly.Text = "Add Assembly..."; // TODO: i18n
+ this.treeMenuProjectAddAssembly.Click +=
+ new EventHandler(this.treeMenuProjectAddAssembly_Click);
+
+ this.treeMenuProjectAddDirectory.Index = 1;
+ this.treeMenuProjectAddDirectory.Text = "Add Directory..."; // TODO: i18n
+ this.treeMenuProjectAddDirectory.Click +=
+ new EventHandler(this.treeMenuProjectAddDirectory_Click);
+
+ this.treeMenuProjectSeparator1.Index = 2;
+ this.treeMenuProjectSeparator1.Text = "-";
+
+ this.treeMenuProjectOptions.Index = 3;
+ this.treeMenuProjectOptions.Text = "Options..."; // TODO: i18n
+ this.treeMenuProjectOptions.Click +=
+ new EventHandler(this.treeMenuProjectOptions_Click);
+
+ // treeShortcutMenu
+ this.treeShortcutMenu.MenuItems.AddRange(
+ new MenuItem[] {
+ this.treeMenuShortcutClear
+ });
+
+ this.treeMenuShortcutClear.Index = 0;
+ this.treeMenuShortcutClear.Text = "Clear Shortcuts"; // TODO: i18n
+ this.treeMenuShortcutClear.Click += new EventHandler(this.treeMenuShortcutClear_Click);
+
+ // treeDirectoryMenu
+ this.treeDirectoryMenu.MenuItems.AddRange(
+ new MenuItem[] {
+ this.treeMenuDirectoryAdd
+ });
+
+ this.treeMenuDirectoryAdd.Index = 0;
+ this.treeMenuDirectoryAdd.Text = "Add Directory..."; // TODO: i18n
+ this.treeMenuDirectoryAdd.Click += new EventHandler(this.treeMenuDirectoryAdd_Click);
+
+ // treeAssemblyMenu
+ this.treeAssemblyMenu.MenuItems.AddRange(
+ new MenuItem[] {
+ this.treeMenuAssemblyAdd
+ });
+
+ this.treeMenuAssemblyAdd.Index = 0;
+ this.treeMenuAssemblyAdd.Text = "Add Assembly..."; // TODO: i18n
+ this.treeMenuAssemblyAdd.Click += new EventHandler(this.treeMenuAssemblyAdd_Click);
+ }
+
+ #endregion // Tree Context Menu Init
+
+ #region Tree Context Menu Events
+
+ private void treeMenuProjectAddAssembly_Click(object sender, EventArgs args)
+ {
+ MessageBox.Show("TODO: add assembly to project");
+ }
+
+ private void treeMenuProjectAddDirectory_Click(object sender, EventArgs args)
+ {
+ MessageBox.Show("TODO: add source directory to project");
+ }
+
+ private void treeMenuProjectOptions_Click(object sender, EventArgs args)
+ {
+ ProjectOptionsForm options = new ProjectOptionsForm(this.project);
+ options.ShowDialog();
+ options.Dispose();
+ }
+
+ private void treeMenuShortcutClear_Click(object sender, EventArgs args)
+ {
+ treeShortcutsNode.Nodes.Clear();
+ }
+
+ private void treeMenuDirectoryAdd_Click(object sender, EventArgs args)
+ {
+ this.treeMenuProjectAddDirectory_Click(sender, args);
+ }
+
+ private void treeMenuAssemblyAdd_Click(object sender, EventArgs args)
+ {
+ this.treeMenuProjectAddAssembly_Click(sender, args);
+ }
+
+ #endregion // Tree Context Menu Events
+
+ #region Main Menu Init
+
+ private void InitializeMainMenu()
+ {
+ // main
+ this.mainMenu.MenuItems.AddRange(
+ new MenuItem[] {
+ this.menuFile,
+ this.menuEdit,
+ this.menuWindow,
+ this.menuDebug,
+ this.menuHelp
+ });
+
+ // File
+ this.menuFile.Index = 0;
+ this.menuFile.Text = "File"; // TODO: i18n
+
+ this.menuFile.MenuItems.AddRange(
+ new MenuItem[] {
+ this.menuFileNew,
+ this.menuFileOpen,
+ this.menuFileClose,
+ this.menuFileSave,
+ this.menuFileSaveAs,
+ this.menuFileSeparator1,
+ this.menuFileRecent,
+ this.menuFileSeparator2,
+ this.menuFileExit
+ });
+
+ // File|New Project
+ this.menuFileNew.Index = 0;
+ this.menuFileNew.Text = "New Project"; // TODO: i18n
+ this.menuFileNew.Click += new EventHandler(this.menuFileNew_Click);
+
+ // File|Open Project
+ this.menuFileOpen.Index = 1;
+ this.menuFileOpen.Text = "Open Project..."; // TODO: i18n
+ this.menuFileOpen.Click += new EventHandler(this.menuFileOpen_Click);
+
+
+ // File|Save Project
+ this.menuFileSave.Index = 2;
+ this.menuFileSave.Text = "Save Project"; // TODO: i18n
+ this.menuFileSave.Click += new EventHandler(this.menuFileSave_Click);
+
+ // File|Save Project As
+ this.menuFileSaveAs.Index = 3;
+ this.menuFileSaveAs.Text = "Save Project As..."; // TODO: i18n
+ this.menuFileSaveAs.Click += new EventHandler(this.menuFileSaveAs_Click);
+
+ // File|Separator1
+ this.menuFileSeparator1.Index = 4;
+ this.menuFileSeparator1.Text = "-";
+
+ // File|Recent Projects
+ this.menuFileRecent.Index = 5;
+ this.menuFileRecent.Text = "Recent Projects"; // TODO: i18n
+
+ // File|Separator2
+ this.menuFileSeparator2.Index = 6;
+ this.menuFileSeparator2.Text = "-";
+
+ // File|Close Project
+ this.menuFileClose.Index = 7;
+ this.menuFileClose.Text = "Close Project"; // TODO: i18n
+ this.menuFileClose.Click += new EventHandler(this.menuFileClose_Click);
+
+ // File|Exit
+ this.menuFileExit.Index = 8;
+ this.menuFileExit.Text = "Exit"; // TODO: i18n
+ this.menuFileExit.Click += new EventHandler(this.menuFileExit_Click);
+
+ // Edit
+ this.menuEdit.Index = 1;
+ this.menuEdit.Text = "Edit"; // TODO: i18n
+
+ // Window
+ this.menuWindow.Index = 2;
+ this.menuWindow.Text = "Window"; // TODO: i18n
+ this.menuWindow.MdiList = true;
+
+ this.menuWindow.MenuItems.AddRange(
+ new MenuItem[] {
+ this.menuWindowCascade,
+ this.menuWindowTile,
+ this.menuWindowTileHorizontal
+ });
+
+ // Window|Cascade
+ this.menuWindowCascade.Index = 0;
+ this.menuWindowCascade.Text = "Cascade"; // TODO: i18n
+ this.menuWindowCascade.Click += new EventHandler(this.menuWindowCascade_Click);
+
+ // Window|Tile
+ this.menuWindowTile.Index = 1;
+ this.menuWindowTile.Text = "Tile"; // TODO: i18n
+ this.menuWindowTile.Click += new EventHandler(this.menuWindowTile_Click);
+
+ // Window|Tile Horizontal
+ this.menuWindowTileHorizontal.Index = 2;
+ this.menuWindowTileHorizontal.Text = "Tile Horizontal"; // TODO: i18n
+ this.menuWindowTileHorizontal.Click += new EventHandler(this.menuWindowTileHorizontal_Click);
+
+ // DEBUG
+ this.menuDebug.Index = 3;
+ this.menuDebug.Text = "DEBUG";
+
+ this.menuDebug.MenuItems.AddRange(
+ new MenuItem[] {
+ this.menuDebugHaltAndCatchFire,
+ this.menuDebugDisplayGeneric
+ });
+
+ // DEBUG|Halt and Catch Fire
+ this.menuDebugHaltAndCatchFire.Index = 0;
+ this.menuDebugHaltAndCatchFire.Text = "Halt and Catch Fire";
+ this.menuDebugHaltAndCatchFire.Click += new EventHandler(this.menuDebugHaltAndCatchFire_Click);
+
+ // DEBUG|Display Generic
+ this.menuDebugDisplayGeneric.Index = 1;
+ this.menuDebugDisplayGeneric.Text = "Display Generic Form";
+ this.menuDebugDisplayGeneric.Click += new EventHandler(this.menuDebugDisplayGeneric_Click);
+
+ // Help
+ this.menuHelp.Index = 4;
+ this.menuHelp.Text = "Help"; // TODO: i18n
+
+ this.menuHelp.MenuItems.AddRange(
+ new MenuItem[] {
+ this.menuHelpAbout
+ });
+
+ // Help|About
+ this.menuHelpAbout.Index = 0;
+ this.menuHelpAbout.Text = "About..."; // TODO: i18n
+ this.menuHelpAbout.Click += new EventHandler(this.menuHelpAbout_Click);
+ }
+
+ #endregion // Main Menu Init
+
+ #region Main Menu Events
+
+ private void menuFileNew_Click(object sender, EventArgs e)
+ {
+ CloseProject();
+ }
+
+ private void menuFileOpen_Click(object sender, EventArgs e)
+ {
+ OpenFileDialog open = new OpenFileDialog();
+ open.Filter = "Monodoc Project Files (*.mdproj)|*.mdproj| All Files (*.*)|*.*";
+
+ if (open.ShowDialog() == DialogResult.OK)
+ {
+ OpenProject(open.FileName);
+ }
+ }
+
+ private void menuFileClose_Click(object sender, EventArgs e)
+ {
+ CloseProject();
+ }
+
+ private void menuFileSave_Click(object sender, EventArgs e)
+ {
+ if (project.IsNewProject || project.IsModified)
+ {
+ SaveOrSaveAsProject();
+ }
+ }
+
+ private void menuFileSaveAs_Click(object sender, EventArgs e)
+ {
+ SaveAsProject();
+ }
+
+ private void menuFileExit_Click(object sender, EventArgs e)
+ {
+ Application.Exit();
+ }
+
+ private void menuWindowCascade_Click(object sender, EventArgs e)
+ {
+ this.LayoutMdi(MdiLayout.Cascade);
+ }
+
+ private void menuWindowTile_Click(object sender, EventArgs e)
+ {
+ this.LayoutMdi(MdiLayout.TileVertical);
+ }
+
+ private void menuWindowTileHorizontal_Click(object sender, EventArgs e)
+ {
+ this.LayoutMdi(MdiLayout.TileHorizontal);
+ }
+
+ private void menuDebugHaltAndCatchFire_Click(object sender, EventArgs e)
+ {
+ throw new ApplicationException("Test Exception Message",
+ new ApplicationException("Inner Exception Message")
+ );
+ }
+
+ private void menuDebugDisplayGeneric_Click(object sender, EventArgs e)
+ {
+ GenericEditorForm generic = new GenericEditorForm();
+ generic.MdiParent = this;
+ generic.Tag = "mditoolbarimageindex[1]";
+ generic.Show();
+ }
+
+ private void menuHelpAbout_Click(object sender, EventArgs e)
+ {
+ Form aboutForm = new AboutForm();
+ aboutForm.ShowDialog();
+ }
+
+ #endregion // Main Menu Events
+
+ #region Other Events and Handlers
+
+ private void project_Modified(object sender, EventArgs args)
+ {
+ UpdateTitle();
+ InitializeTree();
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ base.OnClosing(e);
+
+ // this code is nearly duplicated from CloseProject()
+ if (project.IsModified)
+ {
+ // TODO: i18n
+ DialogResult r = MessageBox.Show(
+ "Save changes to " + projectName + "?",
+ "Save Modified Project",
+ MessageBoxButtons.YesNoCancel,
+ MessageBoxIcon.Question,
+ MessageBoxDefaultButton.Button1
+ );
+
+ switch (r)
+ {
+ case DialogResult.Yes:
+ SaveOrSaveAsProject();
+ break;
+ case DialogResult.Cancel:
+ e.Cancel = true;
+ break;
+ }
+ }
+ }
+ #endregion // Other Events and Handlers
+ }
+}
diff --git a/mcs/doctools/src/Gui/MdiToolBar.cs b/mcs/doctools/src/Gui/MdiToolBar.cs
new file mode 100644
index 00000000000..3bdc16e8b78
--- /dev/null
+++ b/mcs/doctools/src/Gui/MdiToolBar.cs
@@ -0,0 +1,206 @@
+// MdiToolBar.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace Mono.Doc.Gui
+{
+ public class MdiToolBar : ToolBar
+ {
+ #region Private Instance Fields
+
+ private Hashtable mdiChildren = null;
+ private Form currentMdiChild = null;
+
+ #endregion // Private Instance Fields
+
+ #region Constructors and Destructors
+
+ public MdiToolBar() : base()
+ {
+ this.mdiChildren = new Hashtable();
+ }
+
+ #endregion // Constructors and Destructors
+
+ #region Event Handlers
+
+ private void mdiParent_MdiChildActivate(object sender, EventArgs args)
+ {
+ Form activeMdiChild = ((Form) sender).ActiveMdiChild;
+
+ if (activeMdiChild != null)
+ {
+ if (this.mdiChildren[activeMdiChild] == null)
+ {
+ // need a new button
+ ToolBarButton newButton = new ToolBarButton(activeMdiChild.Text);
+ newButton.Style = ToolBarButtonStyle.ToggleButton;
+ this.mdiChildren[activeMdiChild] = newButton;
+ activeMdiChild.Closing += new CancelEventHandler(this.mdiChild_Closing);
+
+ // tooltip
+ newButton.ToolTipText = activeMdiChild.Text;
+
+ // separators
+ if ((this.Appearance == ToolBarAppearance.Flat) && (this.Buttons.Count > 0))
+ {
+ ToolBarButton sep = new ToolBarButton();
+ sep.Style = ToolBarButtonStyle.Separator;
+
+ this.Buttons.Add(sep);
+ }
+
+ // image index. if the mdi child form's Tag property is a string
+ // and contains the text "mditoolbarimageindex[n]", where n is
+ // an integer, the associated button's ImageIndex property will be
+ // set to n.
+
+ String formTag = activeMdiChild.Tag as string;
+
+ if (formTag != null)
+ {
+ string lookFor = "mditoolbarimageindex[";
+ int index = formTag.IndexOf(lookFor);
+
+ if (index != -1)
+ {
+ int startIndex = index + lookFor.Length;
+ int endIndex = formTag.IndexOf("]", startIndex);
+ string imageIndexStr = formTag.Substring(startIndex, endIndex - startIndex);
+
+ MessageBox.Show("mditoolbar: imageIndexStr: " + imageIndexStr);
+
+ try
+ {
+ newButton.ImageIndex = int.Parse(imageIndexStr);
+ }
+ catch
+ {
+ }
+ }
+ }
+ else
+ {
+ // use default index
+ newButton.ImageIndex = 0;
+ }
+
+ this.Buttons.Add(newButton);
+ }
+
+ this.CurrentMdiChild = activeMdiChild;
+ }
+ else
+ {
+ // last MDI child removed; clean up
+ this.mdiChildren.Clear();
+ this.Buttons.Clear();
+ this.currentMdiChild = null;
+ }
+ }
+
+ private void mdiChild_Closing(object sender, CancelEventArgs args)
+ {
+ ToolBarButton b = (ToolBarButton) this.mdiChildren[sender];
+
+ // deal with separators
+ if ((this.Appearance == ToolBarAppearance.Flat) && (this.Buttons.Count > 1))
+ {
+ int bIndex = this.Buttons.IndexOf(b);
+
+ if (bIndex == 0)
+ {
+ this.Buttons.RemoveAt(bIndex + 1);
+ }
+ else
+ {
+ this.Buttons.RemoveAt(bIndex - 1);
+ }
+ }
+
+ this.Buttons.Remove(b);
+ this.mdiChildren.Remove(sender);
+ }
+
+ #endregion // Event Handlers
+
+ #region Overridden Event Handlers
+
+ protected override void OnButtonClick(ToolBarButtonClickEventArgs args)
+ {
+ base.OnButtonClick(args);
+
+ args.Button.Pushed = true;
+
+ // linear search, but double-hashing seems worthless.
+ foreach (Form keyChild in this.mdiChildren.Keys)
+ {
+ if (args.Button == this.mdiChildren[keyChild])
+ {
+ keyChild.Activate();
+ break;
+ }
+ }
+ }
+
+ protected override void OnParentChanged(EventArgs args)
+ {
+ base.OnParentChanged(args);
+
+ // TODO: potential for multiple registration of event handler?
+ if (this.Parent is Form && ((Form) this.Parent).IsMdiContainer)
+ {
+ ((Form) this.Parent).MdiChildActivate
+ += new EventHandler(this.mdiParent_MdiChildActivate);
+ }
+ }
+
+ #endregion // Overridden Event Handlers
+
+ #region Private Instance Properties
+
+ private Form CurrentMdiChild
+ {
+ get { return this.currentMdiChild; }
+ set
+ {
+ if (this.currentMdiChild != null)
+ {
+ ToolBarButton child = this.mdiChildren[this.currentMdiChild] as ToolBarButton;
+
+ if (child != null)
+ {
+ child.Pushed = false;
+ }
+ }
+
+ ((ToolBarButton) this.mdiChildren[value]).Pushed = true;
+ this.currentMdiChild = value;
+ }
+ }
+
+ #endregion // Private Instance Properties
+ }
+}
diff --git a/mcs/doctools/src/Gui/ProjectOptionsForm.cs b/mcs/doctools/src/Gui/ProjectOptionsForm.cs
new file mode 100644
index 00000000000..1b67d749ce5
--- /dev/null
+++ b/mcs/doctools/src/Gui/ProjectOptionsForm.cs
@@ -0,0 +1,560 @@
+// ProjectOptionsForm.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using Mono.Doc.Core;
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace Mono.Doc.Gui
+{
+ /// <summary>
+ /// Summary description for ProjectOptionsForm.
+ /// </summary>
+ public class ProjectOptionsForm : System.Windows.Forms.Form
+ {
+ private DocProject project;
+ private bool isModified;
+
+ private System.Windows.Forms.Button buttonOK;
+ private System.Windows.Forms.Button buttonCancel;
+ private System.Windows.Forms.Button buttonApply;
+ private System.Windows.Forms.GroupBox groupBoxAssemblies;
+ private System.Windows.Forms.Button buttonAssemblyRemove;
+ private System.Windows.Forms.Button buttonAssemblyAdd;
+ private System.Windows.Forms.ListBox listBoxAssembliesToDocument;
+ private System.Windows.Forms.GroupBox groupBoxDirectories;
+ private System.Windows.Forms.Button buttonDirectoryRemove;
+ private System.Windows.Forms.Button buttonDirectoryAdd;
+ private System.Windows.Forms.ListBox listBoxXmlSourceDirectories;
+ private System.Windows.Forms.GroupBox groupBoxProperties;
+ private System.Windows.Forms.ListView listViewProperties;
+ private System.Windows.Forms.ToolBar toolBarProperties;
+ private System.Windows.Forms.ToolBarButton toolBarButtonNewProperty;
+ private System.Windows.Forms.ToolBarButton toolBarButtonEditProperty;
+ private System.Windows.Forms.ToolBarButton toolBarButtonRemoveProperty;
+ private System.Windows.Forms.ColumnHeader columnHeaderName;
+ private System.Windows.Forms.ColumnHeader columnHeaderValue;
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.Container components = null;
+
+ public ProjectOptionsForm(DocProject project)
+ {
+ //this.SetStyle(ControlStyles.DoubleBuffer, true);
+
+ this.project = project;
+ this.isModified = false;
+
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+
+ //
+ // TODO: Add any constructor code after InitializeComponent call
+ //
+
+ this.toolBarProperties.ImageList = AssemblyTreeImages.List; // TODO: need real images
+
+ // load list of assemblies
+ this.listBoxAssembliesToDocument.BeginUpdate();
+ this.listBoxAssembliesToDocument.Items.Clear();
+
+ foreach (string assemblyFile in project.AssemblyFiles)
+ {
+ this.listBoxAssembliesToDocument.Items.Add(assemblyFile);
+ }
+
+ this.listBoxAssembliesToDocument.EndUpdate();
+
+ // load list of XML directories
+ this.listBoxXmlSourceDirectories.BeginUpdate();
+ this.listBoxXmlSourceDirectories.Items.Clear();
+
+ foreach (string xmlDir in project.XmlDirectories)
+ {
+ this.listBoxXmlSourceDirectories.Items.Add(xmlDir);
+ }
+
+ this.listBoxXmlSourceDirectories.EndUpdate();
+
+ // load properties
+ foreach (string name in project.Properties.Keys)
+ {
+ ListViewItem entry = new ListViewItem(name);
+
+ entry.SubItems.Add(project.Properties[name] as string);
+ this.listViewProperties.Items.Add(entry);
+ }
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if(components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows Form Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.buttonOK = new System.Windows.Forms.Button();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.buttonApply = new System.Windows.Forms.Button();
+ this.groupBoxAssemblies = new System.Windows.Forms.GroupBox();
+ this.buttonAssemblyRemove = new System.Windows.Forms.Button();
+ this.buttonAssemblyAdd = new System.Windows.Forms.Button();
+ this.listBoxAssembliesToDocument = new System.Windows.Forms.ListBox();
+ this.groupBoxDirectories = new System.Windows.Forms.GroupBox();
+ this.buttonDirectoryRemove = new System.Windows.Forms.Button();
+ this.buttonDirectoryAdd = new System.Windows.Forms.Button();
+ this.listBoxXmlSourceDirectories = new System.Windows.Forms.ListBox();
+ this.groupBoxProperties = new System.Windows.Forms.GroupBox();
+ this.toolBarProperties = new System.Windows.Forms.ToolBar();
+ this.toolBarButtonNewProperty = new System.Windows.Forms.ToolBarButton();
+ this.toolBarButtonEditProperty = new System.Windows.Forms.ToolBarButton();
+ this.toolBarButtonRemoveProperty = new System.Windows.Forms.ToolBarButton();
+ this.listViewProperties = new System.Windows.Forms.ListView();
+ this.columnHeaderName = new System.Windows.Forms.ColumnHeader();
+ this.columnHeaderValue = new System.Windows.Forms.ColumnHeader();
+ this.groupBoxAssemblies.SuspendLayout();
+ this.groupBoxDirectories.SuspendLayout();
+ this.groupBoxProperties.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // buttonOK
+ //
+ this.buttonOK.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonOK.Location = new System.Drawing.Point(168, 394);
+ this.buttonOK.Name = "buttonOK";
+ this.buttonOK.TabIndex = 10;
+ this.buttonOK.Text = "OK";
+ this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.buttonCancel.Location = new System.Drawing.Point(344, 394);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(72, 23);
+ this.buttonCancel.TabIndex = 11;
+ this.buttonCancel.Text = "Cancel";
+ this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
+ //
+ // buttonApply
+ //
+ this.buttonApply.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonApply.Location = new System.Drawing.Point(256, 394);
+ this.buttonApply.Name = "buttonApply";
+ this.buttonApply.TabIndex = 12;
+ this.buttonApply.Text = "Apply";
+ this.buttonApply.Click += new System.EventHandler(this.buttonApply_Click);
+ //
+ // groupBoxAssemblies
+ //
+ this.groupBoxAssemblies.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.buttonAssemblyRemove,
+ this.buttonAssemblyAdd,
+ this.listBoxAssembliesToDocument});
+ this.groupBoxAssemblies.Location = new System.Drawing.Point(9, 8);
+ this.groupBoxAssemblies.Name = "groupBoxAssemblies";
+ this.groupBoxAssemblies.Size = new System.Drawing.Size(408, 96);
+ this.groupBoxAssemblies.TabIndex = 17;
+ this.groupBoxAssemblies.TabStop = false;
+ this.groupBoxAssemblies.Text = "Assemblies";
+ //
+ // buttonAssemblyRemove
+ //
+ this.buttonAssemblyRemove.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonAssemblyRemove.Location = new System.Drawing.Point(320, 40);
+ this.buttonAssemblyRemove.Name = "buttonAssemblyRemove";
+ this.buttonAssemblyRemove.Size = new System.Drawing.Size(80, 19);
+ this.buttonAssemblyRemove.TabIndex = 8;
+ this.buttonAssemblyRemove.Text = "Remove";
+ this.buttonAssemblyRemove.Click += new System.EventHandler(this.buttonAssemblyRemove_Click);
+ //
+ // buttonAssemblyAdd
+ //
+ this.buttonAssemblyAdd.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonAssemblyAdd.Location = new System.Drawing.Point(320, 16);
+ this.buttonAssemblyAdd.Name = "buttonAssemblyAdd";
+ this.buttonAssemblyAdd.Size = new System.Drawing.Size(80, 19);
+ this.buttonAssemblyAdd.TabIndex = 7;
+ this.buttonAssemblyAdd.Text = "Add...";
+ this.buttonAssemblyAdd.Click += new System.EventHandler(this.buttonAssemblyAdd_Click);
+ //
+ // listBoxAssembliesToDocument
+ //
+ this.listBoxAssembliesToDocument.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.listBoxAssembliesToDocument.Location = new System.Drawing.Point(8, 16);
+ this.listBoxAssembliesToDocument.Name = "listBoxAssembliesToDocument";
+ this.listBoxAssembliesToDocument.Size = new System.Drawing.Size(304, 69);
+ this.listBoxAssembliesToDocument.TabIndex = 6;
+ //
+ // groupBoxDirectories
+ //
+ this.groupBoxDirectories.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.buttonDirectoryRemove,
+ this.buttonDirectoryAdd,
+ this.listBoxXmlSourceDirectories});
+ this.groupBoxDirectories.Location = new System.Drawing.Point(9, 112);
+ this.groupBoxDirectories.Name = "groupBoxDirectories";
+ this.groupBoxDirectories.Size = new System.Drawing.Size(408, 96);
+ this.groupBoxDirectories.TabIndex = 18;
+ this.groupBoxDirectories.TabStop = false;
+ this.groupBoxDirectories.Text = "XML Source Directories";
+ //
+ // buttonDirectoryRemove
+ //
+ this.buttonDirectoryRemove.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonDirectoryRemove.Location = new System.Drawing.Point(320, 40);
+ this.buttonDirectoryRemove.Name = "buttonDirectoryRemove";
+ this.buttonDirectoryRemove.Size = new System.Drawing.Size(80, 19);
+ this.buttonDirectoryRemove.TabIndex = 8;
+ this.buttonDirectoryRemove.Text = "Remove";
+ this.buttonDirectoryRemove.Click += new System.EventHandler(this.buttonDirectoryRemove_Click);
+ //
+ // buttonDirectoryAdd
+ //
+ this.buttonDirectoryAdd.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
+ this.buttonDirectoryAdd.Location = new System.Drawing.Point(320, 16);
+ this.buttonDirectoryAdd.Name = "buttonDirectoryAdd";
+ this.buttonDirectoryAdd.Size = new System.Drawing.Size(80, 19);
+ this.buttonDirectoryAdd.TabIndex = 7;
+ this.buttonDirectoryAdd.Text = "Add...";
+ this.buttonDirectoryAdd.Click += new System.EventHandler(this.buttonDirectoryAdd_Click);
+ //
+ // listBoxXmlSourceDirectories
+ //
+ this.listBoxXmlSourceDirectories.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.listBoxXmlSourceDirectories.Location = new System.Drawing.Point(8, 16);
+ this.listBoxXmlSourceDirectories.Name = "listBoxXmlSourceDirectories";
+ this.listBoxXmlSourceDirectories.Size = new System.Drawing.Size(304, 69);
+ this.listBoxXmlSourceDirectories.TabIndex = 6;
+ //
+ // groupBoxProperties
+ //
+ this.groupBoxProperties.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.toolBarProperties,
+ this.listViewProperties});
+ this.groupBoxProperties.Location = new System.Drawing.Point(9, 216);
+ this.groupBoxProperties.Name = "groupBoxProperties";
+ this.groupBoxProperties.Size = new System.Drawing.Size(408, 168);
+ this.groupBoxProperties.TabIndex = 19;
+ this.groupBoxProperties.TabStop = false;
+ this.groupBoxProperties.Text = "Properties";
+ //
+ // toolBarProperties
+ //
+ this.toolBarProperties.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.toolBarProperties.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
+ this.toolBarButtonNewProperty,
+ this.toolBarButtonEditProperty,
+ this.toolBarButtonRemoveProperty});
+ this.toolBarProperties.Divider = false;
+ this.toolBarProperties.Dock = System.Windows.Forms.DockStyle.None;
+ this.toolBarProperties.DropDownArrows = true;
+ this.toolBarProperties.Location = new System.Drawing.Point(8, 16);
+ this.toolBarProperties.Name = "toolBarProperties";
+ this.toolBarProperties.ShowToolTips = true;
+ this.toolBarProperties.Size = new System.Drawing.Size(392, 23);
+ this.toolBarProperties.TabIndex = 2;
+ this.toolBarProperties.TextAlign = System.Windows.Forms.ToolBarTextAlign.Right;
+ this.toolBarProperties.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBarProperties_ButtonClick);
+ //
+ // toolBarButtonNewProperty
+ //
+ this.toolBarButtonNewProperty.ImageIndex = 0;
+ this.toolBarButtonNewProperty.ToolTipText = "New Property";
+ //
+ // toolBarButtonEditProperty
+ //
+ this.toolBarButtonEditProperty.Enabled = false;
+ this.toolBarButtonEditProperty.ImageIndex = 1;
+ this.toolBarButtonEditProperty.ToolTipText = "Edit Property";
+ //
+ // toolBarButtonRemoveProperty
+ //
+ this.toolBarButtonRemoveProperty.Enabled = false;
+ this.toolBarButtonRemoveProperty.ImageIndex = 2;
+ this.toolBarButtonRemoveProperty.ToolTipText = "Remove Property";
+ //
+ // listViewProperties
+ //
+ this.listViewProperties.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.listViewProperties.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.columnHeaderName,
+ this.columnHeaderValue});
+ this.listViewProperties.FullRowSelect = true;
+ this.listViewProperties.GridLines = true;
+ this.listViewProperties.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
+ this.listViewProperties.Location = new System.Drawing.Point(8, 40);
+ this.listViewProperties.Name = "listViewProperties";
+ this.listViewProperties.Size = new System.Drawing.Size(392, 120);
+ this.listViewProperties.TabIndex = 1;
+ this.listViewProperties.View = System.Windows.Forms.View.Details;
+ this.listViewProperties.SelectedIndexChanged += new System.EventHandler(this.listViewProperties_SelectedIndexChanged);
+ //
+ // columnHeaderName
+ //
+ this.columnHeaderName.Text = "Name";
+ this.columnHeaderName.Width = 171;
+ //
+ // columnHeaderValue
+ //
+ this.columnHeaderValue.Text = "Value";
+ this.columnHeaderValue.Width = 217;
+ //
+ // ProjectOptionsForm
+ //
+ this.AcceptButton = this.buttonOK;
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.CancelButton = this.buttonCancel;
+ this.ClientSize = new System.Drawing.Size(426, 423);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.groupBoxProperties,
+ this.groupBoxAssemblies,
+ this.buttonApply,
+ this.buttonCancel,
+ this.buttonOK,
+ this.groupBoxDirectories});
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.MaximizeBox = false;
+ this.Name = "ProjectOptionsForm";
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
+ this.Text = "Monodoc Project Options";
+ this.groupBoxAssemblies.ResumeLayout(false);
+ this.groupBoxDirectories.ResumeLayout(false);
+ this.groupBoxProperties.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+
+ #region Private Instance Methods
+
+ private void SaveProjectChanges()
+ {
+ project.AssemblyFiles.Clear();
+
+ foreach (string assemblyFile in this.listBoxAssembliesToDocument.Items)
+ {
+ project.AssemblyFiles.Add(assemblyFile);
+ }
+
+ project.XmlDirectories.Clear();
+
+ foreach (string xmlDir in this.listBoxXmlSourceDirectories.Items)
+ {
+ project.XmlDirectories.Add(xmlDir);
+ }
+
+ project.Properties.Clear();
+
+ foreach (ListViewItem prop in this.listViewProperties.Items)
+ {
+ project.Properties[prop.SubItems[0].Text] = prop.SubItems[1].Text;
+ }
+
+ project.IsModified = true;
+ this.isModified = false;
+ }
+
+ #endregion // Private Instance Methods
+
+ private void buttonCancel_Click(object sender, System.EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void buttonApply_Click(object sender, System.EventArgs e)
+ {
+ if (this.isModified)
+ {
+ SaveProjectChanges();
+ }
+ }
+
+ private void buttonOK_Click(object sender, System.EventArgs e)
+ {
+ if (this.isModified)
+ {
+ SaveProjectChanges();
+ }
+
+ this.Close();
+ }
+
+ private void buttonAssemblyAdd_Click(object sender, System.EventArgs e)
+ {
+ OpenFileDialog open = new OpenFileDialog();
+ open.Filter = "Assembly Files (*.dll; *.exe)|*.dll; *.exe|All Files (*.*)|*.*";
+
+ if (open.ShowDialog() == DialogResult.OK)
+ {
+ this.listBoxAssembliesToDocument.Items.Add(open.FileName);
+ this.isModified = true;
+ }
+ }
+
+ private void buttonAssemblyRemove_Click(object sender, System.EventArgs e)
+ {
+ this.listBoxAssembliesToDocument.Items.Remove(
+ this.listBoxAssembliesToDocument.SelectedItem
+ );
+ this.isModified = true;
+ }
+
+ private void buttonDirectoryAdd_Click(object sender, System.EventArgs e)
+ {
+ DirectorySelectorForm dirSel = new DirectorySelectorForm();
+
+ if (dirSel.ShowDialog() == DialogResult.OK)
+ {
+ this.listBoxXmlSourceDirectories.Items.Add(dirSel.DirectoryName);
+ this.isModified = true;
+ }
+
+ dirSel.Dispose();
+ }
+ private void buttonDirectoryRemove_Click(object sender, System.EventArgs e)
+ {
+ this.listBoxXmlSourceDirectories.Items.Remove(
+ this.listBoxXmlSourceDirectories.SelectedItem
+ );
+ this.isModified = true;
+ }
+
+ private void toolBarProperties_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
+ {
+ if (e.Button == toolBarButtonNewProperty)
+ {
+ EditPropertyForm edit = new EditPropertyForm();
+
+ if (edit.ShowDialog() == DialogResult.OK)
+ {
+ ListViewItem item = null;
+
+ foreach (ListViewItem existingItem in this.listViewProperties.Items)
+ {
+ if (existingItem.Text == edit.PropertyName)
+ {
+ item = existingItem;
+ break;
+ }
+ }
+
+ if (item != null)
+ {
+ DialogResult dr = MessageBox.Show(
+ "A property named " + edit.PropertyName + " already exists. Overwrite?",
+ "Property Exists", MessageBoxButtons.YesNo, MessageBoxIcon.Question
+ );
+
+ if (dr == DialogResult.Yes && item.SubItems[1].Text != edit.PropertyValue)
+ {
+ item.SubItems[0].Text = edit.PropertyName;
+ item.SubItems[1].Text = edit.PropertyValue;
+ this.isModified = true;
+ }
+ }
+ else
+ {
+ ListViewItem newProperty = new ListViewItem(edit.PropertyName);
+
+ newProperty.SubItems.Add(edit.PropertyValue);
+ this.listViewProperties.Items.Add(newProperty);
+
+ newProperty.Selected = true;
+ this.isModified = true;
+ }
+ }
+
+ edit.Dispose();
+ }
+ else if (e.Button == toolBarButtonEditProperty)
+ {
+ if (this.listViewProperties.SelectedItems.Count > 0)
+ {
+ ListViewItem selectedItem = this.listViewProperties.SelectedItems[0];
+ EditPropertyForm edit = new EditPropertyForm();
+ edit.PropertyName = selectedItem.SubItems[0].Text;
+ edit.PropertyValue = selectedItem.SubItems[1].Text;
+
+ if (edit.ShowDialog(this) == DialogResult.OK &&
+ (selectedItem.SubItems[0].Text != edit.PropertyName ||
+ selectedItem.SubItems[1].Text != edit.PropertyValue))
+ {
+ selectedItem.SubItems[0].Text = edit.PropertyName;
+ selectedItem.SubItems[1].Text = edit.PropertyValue;
+ selectedItem.Selected = true;
+ this.isModified = true;
+ }
+
+ edit.Dispose();
+ }
+ }
+ else if (e.Button == toolBarButtonRemoveProperty)
+ {
+ foreach (ListViewItem item in this.listViewProperties.SelectedItems)
+ {
+ item.Remove();
+ }
+ }
+ }
+
+ private void listViewProperties_SelectedIndexChanged(object sender, System.EventArgs e)
+ {
+ if (this.listViewProperties.SelectedItems.Count > 0)
+ {
+ this.toolBarButtonEditProperty.Enabled = true;
+ this.toolBarButtonRemoveProperty.Enabled = true;
+ }
+ else
+ {
+ this.toolBarButtonEditProperty.Enabled = false;
+ this.toolBarButtonRemoveProperty.Enabled = false;
+ }
+ }
+ }
+}
diff --git a/mcs/doctools/src/Gui/TypeEditorForm.cs b/mcs/doctools/src/Gui/TypeEditorForm.cs
new file mode 100644
index 00000000000..7fa9784276e
--- /dev/null
+++ b/mcs/doctools/src/Gui/TypeEditorForm.cs
@@ -0,0 +1,120 @@
+// TypeEditorForm.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+
+namespace Mono.Doc.Gui
+{
+ public class TypeEditorForm : GenericEditorForm
+ {
+ private System.Windows.Forms.Label labelMembers;
+ private System.Windows.Forms.ComboBox comboBoxMembers;
+
+ private void InitializeComponent()
+ {
+ this.labelMembers = new System.Windows.Forms.Label();
+ this.comboBoxMembers = new System.Windows.Forms.ComboBox();
+ this.SuspendLayout();
+ //
+ // toolBar
+ //
+ //this.toolBar.ButtonSize = new System.Drawing.Size(43, 22);
+ this.toolBar.Visible = true;
+ //
+ // labelSummary
+ //
+ this.labelSummary.Visible = true;
+ //
+ // textBoxSummary
+ //
+ this.textBoxSummary.Visible = true;
+ //
+ // labelRemarks
+ //
+ this.labelRemarks.Visible = true;
+ //
+ // textBoxRemarks
+ //
+ this.textBoxRemarks.Visible = true;
+ //
+ // labelSeeAlso
+ //
+ this.labelSeeAlso.Visible = true;
+ //
+ // comboBoxLanguage
+ //
+ this.comboBoxLanguage.ItemHeight = 13;
+ this.comboBoxLanguage.Visible = true;
+ //
+ // labelLanguage
+ //
+ this.labelLanguage.Location = new System.Drawing.Point(232, 34);
+ this.labelLanguage.Size = new System.Drawing.Size(72, 16);
+ this.labelLanguage.Visible = true;
+ //
+ // listView1
+ //
+ this.listViewSeeAlso.Visible = true;
+ //
+ // labelMembers
+ //
+ this.labelMembers.Location = new System.Drawing.Point(8, 34);
+ this.labelMembers.Name = "labelMembers";
+ this.labelMembers.Size = new System.Drawing.Size(56, 16);
+ this.labelMembers.TabIndex = 10;
+ this.labelMembers.Text = "Members:";
+ //
+ // comboBoxMembers
+ //
+ this.comboBoxMembers.Location = new System.Drawing.Point(64, 32);
+ this.comboBoxMembers.Name = "comboBoxMembers";
+ this.comboBoxMembers.Size = new System.Drawing.Size(168, 21);
+ this.comboBoxMembers.TabIndex = 11;
+ this.comboBoxMembers.Text = "comboBox1";
+ //
+ // TypeEditorForm
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(432, 469);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.listViewSeeAlso,
+ this.labelLanguage,
+ this.comboBoxLanguage,
+ this.labelSeeAlso,
+ this.textBoxRemarks,
+ this.labelRemarks,
+ this.textBoxSummary,
+ this.labelSummary,
+ this.toolBar,
+ this.comboBoxMembers,
+ this.labelMembers});
+ this.Name = "TypeEditorForm";
+ this.Text = "TypeEditorForm";
+ this.ResumeLayout(false);
+
+ }
+
+ public TypeEditorForm() : base()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/mcs/doctools/src/Gui/UnexpectedErrorForm.cs b/mcs/doctools/src/Gui/UnexpectedErrorForm.cs
new file mode 100644
index 00000000000..1d692fa86d1
--- /dev/null
+++ b/mcs/doctools/src/Gui/UnexpectedErrorForm.cs
@@ -0,0 +1,203 @@
+// UnexpectedErrorForm.cs
+// John Barnette (jbarn@httcb.net)
+//
+// Copyright (c) 2002 John Barnette
+//
+// This file is part of Monodoc, a multilingual API documentation tool.
+//
+// Monodoc is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Monodoc is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Monodoc; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace Mono.Doc.Gui
+{
+ /// <summary>
+ /// Summary description for UnexpectedErrorForm.
+ /// </summary>
+ public class UnexpectedErrorForm : System.Windows.Forms.Form
+ {
+ private System.Windows.Forms.PictureBox pictureBoxExplosion;
+ private System.Windows.Forms.Label labelErrorExplanation;
+ private System.Windows.Forms.TextBox textBoxErrorMessage;
+ private System.Windows.Forms.Button buttonSendErrorReport;
+ private System.Windows.Forms.Button buttonQuit;
+ private System.Windows.Forms.Button buttonContinue;
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.Container components = null;
+
+ public UnexpectedErrorForm(Exception e)
+ {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+
+ //
+ // TODO: Add any constructor code after InitializeComponent call
+ //
+
+ this.pictureBoxExplosion.Image = GuiResources.ErrorExplosionBitmap;
+
+ this.textBoxErrorMessage.Text +=
+ "Exception: " + e.GetType().FullName + "\n" +
+ "Message: " + e.Message + "\n\n" +
+ "Stack Trace: \n" + e.StackTrace + "\n\n";
+
+ while (e.InnerException != null)
+ {
+ e = e.InnerException;
+ this.textBoxErrorMessage.Text +=
+ "--- NESTED EXCEPTION ---\n" +
+ "Exception: " + e.GetType().FullName + "\n" +
+ "Message: " + e.Message + "\n\n" +
+ "Stack Trace: \n" + e.StackTrace + "\n\n";
+ }
+ }
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ protected override void Dispose( bool disposing )
+ {
+ if( disposing )
+ {
+ if(components != null)
+ {
+ components.Dispose();
+ }
+ }
+ base.Dispose( disposing );
+ }
+
+ #region Windows Form Designer generated code
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.pictureBoxExplosion = new System.Windows.Forms.PictureBox();
+ this.labelErrorExplanation = new System.Windows.Forms.Label();
+ this.textBoxErrorMessage = new System.Windows.Forms.TextBox();
+ this.buttonQuit = new System.Windows.Forms.Button();
+ this.buttonSendErrorReport = new System.Windows.Forms.Button();
+ this.buttonContinue = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // pictureBoxExplosion
+ //
+ this.pictureBoxExplosion.Location = new System.Drawing.Point(8, 8);
+ this.pictureBoxExplosion.Name = "pictureBoxExplosion";
+ this.pictureBoxExplosion.Size = new System.Drawing.Size(65, 64);
+ this.pictureBoxExplosion.TabIndex = 0;
+ this.pictureBoxExplosion.TabStop = false;
+ //
+ // labelErrorExplanation
+ //
+ this.labelErrorExplanation.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
+ this.labelErrorExplanation.Location = new System.Drawing.Point(96, 8);
+ this.labelErrorExplanation.Name = "labelErrorExplanation";
+ this.labelErrorExplanation.Size = new System.Drawing.Size(216, 64);
+ this.labelErrorExplanation.TabIndex = 1;
+ this.labelErrorExplanation.Text = "Kaboom! Monodoc has thrown an unexpected exception. Seeing as we\'re in heavy de" +
+ "velopment, this is hardly surprising. Relevant debugging information follows.";
+ //
+ // textBoxErrorMessage
+ //
+ this.textBoxErrorMessage.AcceptsReturn = true;
+ this.textBoxErrorMessage.Location = new System.Drawing.Point(8, 88);
+ this.textBoxErrorMessage.Multiline = true;
+ this.textBoxErrorMessage.Name = "textBoxErrorMessage";
+ this.textBoxErrorMessage.ReadOnly = true;
+ this.textBoxErrorMessage.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.textBoxErrorMessage.Size = new System.Drawing.Size(304, 216);
+ this.textBoxErrorMessage.TabIndex = 2;
+ this.textBoxErrorMessage.Text = "";
+ //
+ // buttonQuit
+ //
+ this.buttonQuit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.buttonQuit.Location = new System.Drawing.Point(144, 312);
+ this.buttonQuit.Name = "buttonQuit";
+ this.buttonQuit.TabIndex = 3;
+ this.buttonQuit.Text = "Quit";
+ this.buttonQuit.Click += new System.EventHandler(this.buttonExit_Click);
+ //
+ // buttonSendErrorReport
+ //
+ this.buttonSendErrorReport.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.buttonSendErrorReport.Location = new System.Drawing.Point(8, 312);
+ this.buttonSendErrorReport.Name = "buttonSendErrorReport";
+ this.buttonSendErrorReport.Size = new System.Drawing.Size(117, 23);
+ this.buttonSendErrorReport.TabIndex = 4;
+ this.buttonSendErrorReport.Text = "Send Error Report";
+ this.buttonSendErrorReport.Click += new System.EventHandler(this.buttonSendErrorReport_Click);
+ //
+ // buttonContinue
+ //
+ this.buttonContinue.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.buttonContinue.Location = new System.Drawing.Point(232, 312);
+ this.buttonContinue.Name = "buttonContinue";
+ this.buttonContinue.TabIndex = 5;
+ this.buttonContinue.Text = "Continue";
+ this.buttonContinue.Click += new System.EventHandler(this.buttonContinue_Click);
+ //
+ // UnexpectedErrorForm
+ //
+ this.AcceptButton = this.buttonQuit;
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.CancelButton = this.buttonContinue;
+ this.ClientSize = new System.Drawing.Size(320, 341);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.buttonContinue,
+ this.buttonSendErrorReport,
+ this.buttonQuit,
+ this.textBoxErrorMessage,
+ this.labelErrorExplanation,
+ this.pictureBoxExplosion});
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "UnexpectedErrorForm";
+ this.Text = "Monodoc Error";
+ this.ResumeLayout(false);
+
+ }
+ #endregion
+
+ private void buttonExit_Click(object sender, System.EventArgs e)
+ {
+ Application.Exit();
+ }
+
+ private void buttonSendErrorReport_Click(object sender, System.EventArgs e)
+ {
+ MessageBox.Show("TODO: This is coming, as soon as I figure out the best " +
+ "delivery mechanism. Promise.", "Unimplemented Feature"
+ );
+ }
+
+ private void buttonContinue_Click(object sender, System.EventArgs e)
+ {
+ MessageBox.Show("TODO: implement continue.", "Unimplemented Feature");
+ }
+ }
+}
diff --git a/mcs/doctools/src/doctools.sln b/mcs/doctools/src/doctools.sln
new file mode 100644
index 00000000000..b336c2a1e26
--- /dev/null
+++ b/mcs/doctools/src/doctools.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gui", "Gui\Gui.csproj", "{B76CBA27-ABBD-45FE-AFC3-A629BC13BAAE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{73F5A60D-A5E3-4852-B4C6-478275E733F9}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {B76CBA27-ABBD-45FE-AFC3-A629BC13BAAE}.Debug.ActiveCfg = Release|.NET
+ {B76CBA27-ABBD-45FE-AFC3-A629BC13BAAE}.Debug.Build.0 = Release|.NET
+ {B76CBA27-ABBD-45FE-AFC3-A629BC13BAAE}.Release.ActiveCfg = Release|.NET
+ {B76CBA27-ABBD-45FE-AFC3-A629BC13BAAE}.Release.Build.0 = Release|.NET
+ {73F5A60D-A5E3-4852-B4C6-478275E733F9}.Debug.ActiveCfg = Release|.NET
+ {73F5A60D-A5E3-4852-B4C6-478275E733F9}.Debug.Build.0 = Release|.NET
+ {73F5A60D-A5E3-4852-B4C6-478275E733F9}.Release.ActiveCfg = Release|.NET
+ {73F5A60D-A5E3-4852-B4C6-478275E733F9}.Release.Build.0 = Release|.NET
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/mcs/errors/bug1.cs b/mcs/errors/bug1.cs
new file mode 100755
index 00000000000..934f0f9bce2
--- /dev/null
+++ b/mcs/errors/bug1.cs
@@ -0,0 +1,17 @@
+//
+// FIXED
+//
+interface A {
+ void B ();
+}
+
+interface X {
+ void B ();
+}
+
+
+class B : A, X {
+ void X.B () {}
+ void A.B () {}
+
+}
diff --git a/mcs/errors/bug10.cs b/mcs/errors/bug10.cs
new file mode 100644
index 00000000000..5b2ff627ffa
--- /dev/null
+++ b/mcs/errors/bug10.cs
@@ -0,0 +1,30 @@
+//
+// fixed
+//
+using System;
+
+public class Blah {
+
+ public void Connect ()
+ {
+ }
+
+ public void Button1_Click (int i, int j)
+ {
+ Console.WriteLine ("Button1 was clicked !");
+ Console.WriteLine ("Answer : " + (i+j));
+ }
+
+ public static int Main ()
+ {
+ Blah b = new Blah ();
+
+ b.Connect ();
+
+ b.OnClick ();
+
+ Console.WriteLine ("Test passes");
+ return 0;
+ }
+
+}
diff --git a/mcs/errors/bug11.cs b/mcs/errors/bug11.cs
new file mode 100755
index 00000000000..b48bc1893f7
--- /dev/null
+++ b/mcs/errors/bug11.cs
@@ -0,0 +1,23 @@
+//
+// fixed
+//
+class Location {
+ static public int Null {
+ get {
+ return 1;
+ }
+ }
+}
+
+class X {
+ Location Location;
+ X ()
+ {
+ int a = Location.Null;
+ }
+
+ static void Main () {}
+}
+
+
+
diff --git a/mcs/errors/bug12.cs b/mcs/errors/bug12.cs
new file mode 100755
index 00000000000..27c24e93eb7
--- /dev/null
+++ b/mcs/errors/bug12.cs
@@ -0,0 +1,19 @@
+using System.Collections;
+
+ class PtrHashtable : Hashtable {
+ class PtrComparer : IComparer {
+ public int Compare (object x, object y)
+ {
+ if (x == y)
+ return 0;
+ else
+ return 1;
+ }
+ }
+
+ public PtrHashtable ()
+ {
+ comparer = new PtrComparer ();
+ }
+ }
+
diff --git a/mcs/errors/bug13.cs b/mcs/errors/bug13.cs
new file mode 100755
index 00000000000..91016d0a7c7
--- /dev/null
+++ b/mcs/errors/bug13.cs
@@ -0,0 +1,11 @@
+using System;
+
+class X {
+ static void Main ()
+ {
+ Type t = null;
+
+ if (t.GetType () == null)
+ return;
+ }
+}
diff --git a/mcs/errors/bug14.cs b/mcs/errors/bug14.cs
new file mode 100755
index 00000000000..9167d9afbbf
--- /dev/null
+++ b/mcs/errors/bug14.cs
@@ -0,0 +1,15 @@
+//
+// fixed
+//
+using System;
+
+class X {
+
+ static void Main ()
+ {
+ string msg = String.Format ("{0} {1} {2} {3}", "one", 3, 3, "two");
+
+ Console.WriteLine (msg);
+ }
+}
+
diff --git a/mcs/errors/bug15.cs b/mcs/errors/bug15.cs
new file mode 100755
index 00000000000..d233407af32
--- /dev/null
+++ b/mcs/errors/bug15.cs
@@ -0,0 +1,25 @@
+//
+// fixed
+//
+using System;
+
+class X {
+
+ void A ()
+ {
+ }
+
+ static void Main ()
+ {
+ int loop = 0;
+
+ goto a;
+ b:
+ loop++;
+ a:
+ Console.WriteLine ("Hello");
+ for (;;){
+ goto b;
+ }
+ }
+}
diff --git a/mcs/errors/bug16.cs b/mcs/errors/bug16.cs
new file mode 100644
index 00000000000..4b8503cf127
--- /dev/null
+++ b/mcs/errors/bug16.cs
@@ -0,0 +1,24 @@
+//
+// Fixed
+//
+
+using System;
+
+public class Blah {
+
+ public static void Main ()
+ {
+ ushort i;
+ sbyte j;
+
+ i = 10;
+ j = 20;
+
+ Console.WriteLine (i);
+ Console.WriteLine (j);
+
+ Console.WriteLine ("Hello there !");
+ }
+}
+
+
diff --git a/mcs/errors/bug17.cs b/mcs/errors/bug17.cs
new file mode 100755
index 00000000000..d922487cf34
--- /dev/null
+++ b/mcs/errors/bug17.cs
@@ -0,0 +1,10 @@
+//
+// Fixed
+//
+class X {
+ static void Main ()
+ {
+double x = 64.0;
+System.Console.WriteLine("x = " + x.ToBoolean(null));
+}
+}
diff --git a/mcs/errors/bug18.cs b/mcs/errors/bug18.cs
new file mode 100755
index 00000000000..61e0f0af006
--- /dev/null
+++ b/mcs/errors/bug18.cs
@@ -0,0 +1,16 @@
+namespace A {
+ interface B {
+ }
+}
+
+class X {
+ static void A (object A)
+ {
+ object x = (A.B) A;
+ }
+
+ static void Main ()
+ {
+ }
+}
+
diff --git a/mcs/errors/bug19.cs b/mcs/errors/bug19.cs
new file mode 100755
index 00000000000..15755b6faaa
--- /dev/null
+++ b/mcs/errors/bug19.cs
@@ -0,0 +1,18 @@
+namespace N1
+{
+ public enum A
+ {
+ A_1, A_2, A_3
+ }
+
+ public class B
+ {
+ const A b = A.A_1;
+ }
+}
+
+
+
+
+
+
diff --git a/mcs/errors/bug2.cs b/mcs/errors/bug2.cs
new file mode 100755
index 00000000000..61f6eea2bce
--- /dev/null
+++ b/mcs/errors/bug2.cs
@@ -0,0 +1,29 @@
+//
+// fixed
+//
+class X {
+
+ static void A (ref int a)
+ {
+ a++;
+ }
+
+ // Int32&
+ static void B (ref int a)
+ {
+ // Int32&&
+ A (ref a);
+ }
+
+ static int Main ()
+ {
+ int a = 10;
+
+ B (ref a);
+
+ if (a == 11)
+ return 0;
+ else
+ return 1;
+ }
+}
diff --git a/mcs/errors/bug3.cs b/mcs/errors/bug3.cs
new file mode 100755
index 00000000000..af24ecc011b
--- /dev/null
+++ b/mcs/errors/bug3.cs
@@ -0,0 +1,36 @@
+//
+// Fixed, incorporated into test
+//
+using System;
+
+using System.Runtime.InteropServices;
+
+[StructLayout (LayoutKind.Explicit)]
+struct A {
+ [FieldOffset (0)]
+ public int a;
+ [FieldOffset (0)]
+ public byte b1;
+ [FieldOffset (1)]
+ public byte b2;
+ [FieldOffset (2)]
+ public byte b3;
+ [FieldOffset (3)]
+ public byte b4;
+}
+
+class X {
+ static void Main ()
+ {
+ A a = new A ();
+
+ a.a = 0x12345678;
+
+ Console.WriteLine ("b1: " + a.b1);
+ Console.WriteLine ("b2: " + a.b2);
+ Console.WriteLine ("b3: " + a.b3);
+ Console.WriteLine ("b4: " + a.b4);
+
+ }
+}
+
diff --git a/mcs/errors/bug4.cs b/mcs/errors/bug4.cs
new file mode 100755
index 00000000000..775cfe30349
--- /dev/null
+++ b/mcs/errors/bug4.cs
@@ -0,0 +1,18 @@
+//
+// Fixed
+//
+using System;
+
+class X {
+ static void Main ()
+ {
+ try {
+ throw new Exception ();
+ } catch (Exception e) {
+ Console.WriteLine ("Caught");
+ throw;
+ } catch {
+ Console.WriteLine ("Again");
+ }
+ }
+}
diff --git a/mcs/errors/bug5.cs b/mcs/errors/bug5.cs
new file mode 100755
index 00000000000..03fce159750
--- /dev/null
+++ b/mcs/errors/bug5.cs
@@ -0,0 +1,23 @@
+//
+// fixed
+//
+interface I {
+ void a ();
+}
+
+abstract class X : I {
+ public abstract void a ();
+}
+
+class Y : X {
+ override public void a () {
+ System.Console.WriteLine ("Hello!");
+ return;
+ }
+
+ static void Main () {
+ Y y = new Y ();
+
+ ((I) y ).a ();
+ }
+}
diff --git a/mcs/errors/bug6.cs b/mcs/errors/bug6.cs
new file mode 100755
index 00000000000..9cbf071393d
--- /dev/null
+++ b/mcs/errors/bug6.cs
@@ -0,0 +1,14 @@
+//
+// fixed
+//
+public class X {
+
+ public enum Blah { A }
+
+}
+
+public class Y : X {
+
+ Blah x;
+
+}
diff --git a/mcs/errors/bug7.cs b/mcs/errors/bug7.cs
new file mode 100755
index 00000000000..fcd35bc6cdb
--- /dev/null
+++ b/mcs/errors/bug7.cs
@@ -0,0 +1,13 @@
+public enum X :byte {
+ a, b
+}
+
+public class Y {
+
+ const X myconst = X.a;
+
+ static void Main ()
+ {
+ }
+}
+
diff --git a/mcs/errors/bug8.cs b/mcs/errors/bug8.cs
new file mode 100755
index 00000000000..47846f7c4c9
--- /dev/null
+++ b/mcs/errors/bug8.cs
@@ -0,0 +1,20 @@
+using System;
+
+//
+// The problem here is that `(Type)' is being recognized as a Property
+// but inside a Cast expression this is invalid.
+//
+class X {
+
+ int Type {
+ get {
+ return 1;
+ }
+ }
+
+ static void Main ()
+ {
+ Type t = (Type) null;
+ }
+
+}
diff --git a/mcs/errors/bug9.cs b/mcs/errors/bug9.cs
new file mode 100755
index 00000000000..f0c436a1ad0
--- /dev/null
+++ b/mcs/errors/bug9.cs
@@ -0,0 +1,7 @@
+enum A {
+a, b
+}
+
+class X {
+ const A a = A.a;
+}
diff --git a/mcs/errors/cs-11.cs b/mcs/errors/cs-11.cs
new file mode 100644
index 00000000000..5adc40a2573
--- /dev/null
+++ b/mcs/errors/cs-11.cs
@@ -0,0 +1,20 @@
+// cs-11.cs : Delegate creation expression takes only one argument
+// Line : 17
+
+public class Blah {
+
+ public delegate int MyDelegate (int i, int j);
+
+ public int Foo (int i, int j)
+ {
+ return i+j;
+ }
+
+ public static void Main ()
+ {
+ Blah i = new Blah ();
+
+ MyDelegate del = new MyDelegate ();
+ }
+}
+
diff --git a/mcs/errors/cs-12.cs b/mcs/errors/cs-12.cs
new file mode 100755
index 00000000000..fe4b09b37a2
--- /dev/null
+++ b/mcs/errors/cs-12.cs
@@ -0,0 +1,34 @@
+class Y {
+ byte b;
+
+ public static implicit operator int (Y i)
+ {
+ return i.b;
+ }
+
+// public static implicit operator byte (Y i)
+// {
+// return i.b;
+// }
+
+ public Y (byte b)
+ {
+ this.b = b;
+ }
+}
+
+class X {
+ static void Main ()
+ {
+ Y y = new Y (1);
+
+ switch (y){
+ case 0:
+ break;
+ case 1:
+ break;
+ }
+
+ int a = y;
+ }
+}
diff --git a/mcs/errors/cs-20.cs b/mcs/errors/cs-20.cs
new file mode 100644
index 00000000000..6f33e0dcfd3
--- /dev/null
+++ b/mcs/errors/cs-20.cs
@@ -0,0 +1,35 @@
+// cs-20.cs : Cannot find attribute type My (maybe you forgot to set the usage using the AttributeUsage attribute ?).
+// Line : 18
+
+using System;
+using System.Reflection;
+
+namespace Test {
+
+ //[AttributeUsage (AttributeTargets.All)]
+ public class MyAttribute: Attribute {
+ public string val;
+ public MyAttribute (string stuff) {
+ System.Console.WriteLine (stuff);
+ val = stuff;
+ }
+ }
+
+ [My("testclass")]
+
+ public class Test {
+ static public int Main() {
+ System.Reflection.MemberInfo info = typeof (Test);
+ object[] attributes = info.GetCustomAttributes (false);
+ for (int i = 0; i < attributes.Length; i ++) {
+ System.Console.WriteLine(attributes[i]);
+ }
+ if (attributes.Length != 2)
+ return 1;
+ MyAttribute attr = (MyAttribute) attributes [0];
+ if (attr.val != "testclass")
+ return 2;
+ return 0;
+ }
+ }
+}
diff --git a/mcs/errors/cs0017.cs b/mcs/errors/cs0017.cs
new file mode 100755
index 00000000000..7942594be2f
--- /dev/null
+++ b/mcs/errors/cs0017.cs
@@ -0,0 +1,9 @@
+// cs0017.cs: Program has more than one entry point
+// Line: 7
+class X {
+static void Main () {}
+}
+class Y {
+static void Main () {
+}
+}
diff --git a/mcs/errors/cs0019-2.cs b/mcs/errors/cs0019-2.cs
new file mode 100755
index 00000000000..d9753a29a1c
--- /dev/null
+++ b/mcs/errors/cs0019-2.cs
@@ -0,0 +1,20 @@
+// cs0019.cs : Operator + cannot be applied to operands of type `int' and `Test.Zub'
+// Line : 11
+using System;
+
+class Test {
+
+ enum Zub :byte {
+ Foo = 99,
+ Bar,
+ Baz
+ }
+
+
+ static void Main ()
+ {
+ int v = 1;
+ object foo = (v + Zub.Foo);
+ }
+}
+
diff --git a/mcs/errors/cs0019-3.cs b/mcs/errors/cs0019-3.cs
new file mode 100755
index 00000000000..e49fde2ab13
--- /dev/null
+++ b/mcs/errors/cs0019-3.cs
@@ -0,0 +1,19 @@
+// cs0019.cs : Operator + cannot be applied to operands of type `int' and `Test.Zub'
+// Line : 11
+using System;
+
+class Test {
+
+ enum Zub :byte {
+ Foo = 99,
+ Bar,
+ Baz
+ }
+
+
+ static void Main ()
+ {
+ object v = (Zub.Foo + Zub.Foo);
+ }
+}
+
diff --git a/mcs/errors/cs0019-4.cs b/mcs/errors/cs0019-4.cs
new file mode 100755
index 00000000000..938735e69a2
--- /dev/null
+++ b/mcs/errors/cs0019-4.cs
@@ -0,0 +1,20 @@
+// cs0019.cs : Operator + cannot be applied to operands of type `int' and `Test.Zub'
+// Line : 11
+using System;
+
+class Test {
+
+ enum Zub :byte {
+ Foo = 99,
+ Bar,
+ Baz
+ }
+
+
+ static void Main ()
+ {
+ Zub a = Zub.Foo, b = Zub.Bar;
+ object v = (a + b);
+ }
+}
+
diff --git a/mcs/errors/cs0019.cs b/mcs/errors/cs0019.cs
new file mode 100644
index 00000000000..c3dbd4f9b93
--- /dev/null
+++ b/mcs/errors/cs0019.cs
@@ -0,0 +1,14 @@
+// cs0019.cs : Operator + cannot be applied to operands of type `Foo' and `int'
+// Line : 11
+
+public class Foo {
+
+ public static void Main ()
+ {
+
+ Foo k = new Foo ();
+
+ int i = k + 6;
+
+ }
+}
diff --git a/mcs/errors/cs0020.cs b/mcs/errors/cs0020.cs
new file mode 100755
index 00000000000..228401b453c
--- /dev/null
+++ b/mcs/errors/cs0020.cs
@@ -0,0 +1,12 @@
+// cs0020.cs : Division by constant zero.
+// Line : 999999999
+
+using System;
+
+public class X {
+ static void Main ()
+ {
+ int i = 1 / 0;
+ Console.WriteLine (i);
+ }
+}
diff --git a/mcs/errors/cs0023.cs b/mcs/errors/cs0023.cs
new file mode 100644
index 00000000000..6a2cd5518c9
--- /dev/null
+++ b/mcs/errors/cs0023.cs
@@ -0,0 +1,13 @@
+// cs0023.cs : Operator ~ cannot be applied to operand of type `Foo'
+// Line : 10
+
+public class Foo {
+
+ public static void Main ()
+ {
+ Foo k = new Foo ();
+
+ int i = ~ k;
+
+ }
+}
diff --git a/mcs/errors/cs0026-2.cs b/mcs/errors/cs0026-2.cs
new file mode 100755
index 00000000000..a4f41cdb51d
--- /dev/null
+++ b/mcs/errors/cs0026-2.cs
@@ -0,0 +1,10 @@
+// cs0026: use of this is not allowed in a static field initializer
+//
+class X {
+ static object o = this;
+
+ static int Main ()
+ {
+ return 1;
+ }
+}
diff --git a/mcs/errors/cs0026.cs b/mcs/errors/cs0026.cs
new file mode 100755
index 00000000000..e4b5ca7e580
--- /dev/null
+++ b/mcs/errors/cs0026.cs
@@ -0,0 +1,8 @@
+// cs0026: use of this is not allowed in static methods
+// Line: 6
+class X {
+ static void A ()
+ {
+ this = null;
+ }
+}
diff --git a/mcs/errors/cs0030.cs b/mcs/errors/cs0030.cs
new file mode 100644
index 00000000000..7226eb2855c
--- /dev/null
+++ b/mcs/errors/cs0030.cs
@@ -0,0 +1,15 @@
+// cs0030.cs : Cannot convert type 'Blah' to 'float'
+// Line : 12
+
+public class Blah {
+
+ public static int Main ()
+ {
+ Blah k;
+
+ k = new Blah ();
+
+ float f = (float) k;
+
+ }
+}
diff --git a/mcs/errors/cs0031.cs b/mcs/errors/cs0031.cs
new file mode 100644
index 00000000000..c79ba6975de
--- /dev/null
+++ b/mcs/errors/cs0031.cs
@@ -0,0 +1,14 @@
+// cs0031.cs : Constant value '256' cannot be converted to a byte
+// Line : 7
+
+public class Blah {
+
+ public enum MyEnum : byte {
+ Foo = 256,
+ Bar
+ }
+
+ public static void Main ()
+ {
+ }
+}
diff --git a/mcs/errors/cs0034.cs b/mcs/errors/cs0034.cs
new file mode 100755
index 00000000000..2d5917abee5
--- /dev/null
+++ b/mcs/errors/cs0034.cs
@@ -0,0 +1,15 @@
+// cs0034: operator >= is ambiguous on types ulong and sbyte
+// Line: 7
+class X {
+
+ bool ret (ulong u, sbyte s)
+ {
+ return (u >= s);
+ }
+
+ bool ret (ulong u, short s)
+ {
+ return (u >= s);
+ }
+
+}
diff --git a/mcs/errors/cs0066.cs b/mcs/errors/cs0066.cs
new file mode 100644
index 00000000000..e7e6f5e3479
--- /dev/null
+++ b/mcs/errors/cs0066.cs
@@ -0,0 +1,25 @@
+// cs0066.cs : 'Button.Click' : event must be of a delegate type
+// Line : 10
+
+using System;
+
+public delegate void EventHandler (object sender, EventArgs e);
+
+public class Button {
+
+ public event Blah Click;
+
+ public void Reset ()
+ {
+ Click = null;
+ }
+}
+
+public class Blah {
+
+ public static void Main ()
+ {
+ Blah b = new Blah ();
+ }
+
+}
diff --git a/mcs/errors/cs0070.cs b/mcs/errors/cs0070.cs
new file mode 100644
index 00000000000..826c97b301a
--- /dev/null
+++ b/mcs/errors/cs0070.cs
@@ -0,0 +1,30 @@
+// cs0070.cs : The event 'Click' can only appear on the left-side of a += or -= (except when used from within the type 'Button')
+// Line : 20
+
+using System;
+
+public delegate void EventHandler (int i, int j);
+
+public class Button {
+
+ public event EventHandler Click;
+
+}
+
+public class Blah {
+
+ Button Button1 = new Button ();
+
+ public void Connect ()
+ {
+ Button1.Click = new EventHandler (Button1_Click);
+ }
+
+ public void Button1_Click (int i, int j)
+ {
+ }
+
+ public static void Main ()
+ {
+ }
+}
diff --git a/mcs/errors/cs0107.cs b/mcs/errors/cs0107.cs
index c3b1405093f..fd02f7e2c2a 100755
--- a/mcs/errors/cs0107.cs
+++ b/mcs/errors/cs0107.cs
@@ -1,6 +1,6 @@
// cs0107.cs: More than one protection modifier
// Line: 4
class X {
- public private X {
+ public private class X {
}
}
diff --git a/mcs/errors/cs0108.cs b/mcs/errors/cs0108.cs
new file mode 100755
index 00000000000..a516acc7d38
--- /dev/null
+++ b/mcs/errors/cs0108.cs
@@ -0,0 +1,10 @@
+// cs0108.cs: The new keyword is required on MEMBER because it hides MEMBER2
+// Line:
+
+class Base {
+ public void F () {}
+}
+
+class Derived : Base {
+ void F () {}
+}
diff --git a/mcs/errors/cs0111.cs b/mcs/errors/cs0111.cs
new file mode 100644
index 00000000000..968e204f64a
--- /dev/null
+++ b/mcs/errors/cs0111.cs
@@ -0,0 +1,21 @@
+// cs111.cs : Class `Blah' already contains a definition with the same return value and parameter types for method `Foo'
+// Line : 10
+
+public class Blah {
+
+ static public void Foo (int i, int j)
+ {
+ }
+
+ static public void Foo (int i, int j)
+ {
+ }
+
+ public static void Main ()
+ {
+ int i = 1;
+ int j = 2;
+
+ Foo (i, j);
+ }
+}
diff --git a/mcs/errors/cs0113.cs b/mcs/errors/cs0113.cs
new file mode 100755
index 00000000000..6ddf367cf5d
--- /dev/null
+++ b/mcs/errors/cs0113.cs
@@ -0,0 +1,3 @@
+class X {
+ public virtual override void Y () {}
+}
diff --git a/mcs/errors/cs0114.cs b/mcs/errors/cs0114.cs
index b3c1f028e24..a617710997d 100755
--- a/mcs/errors/cs0114.cs
+++ b/mcs/errors/cs0114.cs
@@ -5,5 +5,5 @@ public abstract class X {
}
class Y : X {
- void XX ();
+ void XX () {}
}
diff --git a/mcs/errors/cs0115.cs b/mcs/errors/cs0115.cs
new file mode 100755
index 00000000000..f3ae9aa468d
--- /dev/null
+++ b/mcs/errors/cs0115.cs
@@ -0,0 +1,5 @@
+class X {
+ public override void Bla ()
+ {
+ }
+}
diff --git a/mcs/errors/cs0117.cs b/mcs/errors/cs0117.cs
index d07e5cf0e52..7b942b47625 100755
--- a/mcs/errors/cs0117.cs
+++ b/mcs/errors/cs0117.cs
@@ -5,5 +5,6 @@ class T {
public static int Main (string [] args )
{
int x = 1.E;
+ return 0;
}
}
diff --git a/mcs/errors/cs0121.cs b/mcs/errors/cs0121.cs
new file mode 100755
index 00000000000..7a8797ee680
--- /dev/null
+++ b/mcs/errors/cs0121.cs
@@ -0,0 +1,17 @@
+// cs0121.cs: ambigous call when selecting function due to implicit casts
+// Line: 15
+
+class X {
+ static void a (int i, double d)
+ {
+ }
+
+ static void a (double d, int i)
+ {
+ }
+
+ public static void Main ()
+ {
+ a (0, 0);
+ }
+}
diff --git a/mcs/errors/cs0126.cs b/mcs/errors/cs0126.cs
new file mode 100644
index 00000000000..2742abfdb09
--- /dev/null
+++ b/mcs/errors/cs0126.cs
@@ -0,0 +1,9 @@
+// cs0126: an object of type `int' is expected in the return statement
+// Line: 7
+
+class X {
+ int X ()
+ {
+ return;
+ }
+}
diff --git a/mcs/errors/cs0131.cs b/mcs/errors/cs0131.cs
new file mode 100755
index 00000000000..ef025a2039a
--- /dev/null
+++ b/mcs/errors/cs0131.cs
@@ -0,0 +1,8 @@
+// cs0131.cs: left hand side of an assignment must be variable, property access or indexer
+// Line:
+class X {
+ void A ()
+ {
+ 5 = 4;
+ }
+}
diff --git a/mcs/errors/cs0132.cs b/mcs/errors/cs0132.cs
new file mode 100755
index 00000000000..1b4ebf2c7b4
--- /dev/null
+++ b/mcs/errors/cs0132.cs
@@ -0,0 +1,7 @@
+// cs0132.cs: A static parameter must not have any parameters
+// Line: 4
+class X {
+ static X (int x)
+ {
+ }
+}
diff --git a/mcs/errors/cs0136-2.cs b/mcs/errors/cs0136-2.cs
new file mode 100755
index 00000000000..4dc9d547e32
--- /dev/null
+++ b/mcs/errors/cs0136-2.cs
@@ -0,0 +1,9 @@
+// cs0136.cs: local variable j can not be declared, because there is something with that name already
+// Line: 5
+class X {
+ public static void Bar (int j, params int [] args)
+ {
+ foreach (int j in args)
+ ;
+ }
+}
diff --git a/mcs/errors/cs0139.cs b/mcs/errors/cs0139.cs
new file mode 100644
index 00000000000..11eb5d7f750
--- /dev/null
+++ b/mcs/errors/cs0139.cs
@@ -0,0 +1,8 @@
+// cs0139.cs: No loop to exit to in continue or break.
+// Line: 6
+class X {
+ void A ()
+ {
+ continue;
+ }
+}
diff --git a/mcs/errors/cs0146.cs b/mcs/errors/cs0146.cs
new file mode 100644
index 00000000000..8b81c046864
--- /dev/null
+++ b/mcs/errors/cs0146.cs
@@ -0,0 +1,7 @@
+// cs0146.cs: circular class definition
+// Line: 6
+class A : B {
+}
+
+class B : A {
+}
diff --git a/mcs/errors/cs0150.cs b/mcs/errors/cs0150.cs
new file mode 100644
index 00000000000..fc67a91086e
--- /dev/null
+++ b/mcs/errors/cs0150.cs
@@ -0,0 +1,14 @@
+// cs0150.cs :
+// Line :
+
+using System;
+
+public class Blah {
+
+ public static void Main ()
+ {
+ int foo = 6;
+
+ int [] i = new int [foo] { 0, 1, 2, 3, 4, 5 };
+ }
+}
diff --git a/mcs/errors/cs0151.cs b/mcs/errors/cs0151.cs
new file mode 100755
index 00000000000..03ef7c2e9a9
--- /dev/null
+++ b/mcs/errors/cs0151.cs
@@ -0,0 +1,19 @@
+// cs0151.cs: An integral value expected
+// Line: 12
+class Y {
+ byte b;
+}
+
+class X {
+ static void Main ()
+ {
+ Y y = new Y ();
+
+ switch (y){
+ case 0:
+ break;
+ case 1:
+ break;
+ }
+ }
+}
diff --git a/mcs/errors/cs0153.cs b/mcs/errors/cs0153.cs
new file mode 100755
index 00000000000..c102bfa4672
--- /dev/null
+++ b/mcs/errors/cs0153.cs
@@ -0,0 +1,8 @@
+// cs0153.cs: goto default only allowed in switch statement
+// Line:
+class X {
+ void Main ()
+ {
+ goto default;
+ }
+}
diff --git a/mcs/errors/cs0157.cs b/mcs/errors/cs0157.cs
new file mode 100755
index 00000000000..a56dd964da0
--- /dev/null
+++ b/mcs/errors/cs0157.cs
@@ -0,0 +1,12 @@
+// cs0157.cs: Control can not leave the body of a finally clause
+// Line: 9
+
+class X {
+ void A ()
+ {
+ try {
+ } finally {
+ return;
+ }
+ }
+}
diff --git a/mcs/errors/cs0159-2.cs b/mcs/errors/cs0159-2.cs
new file mode 100755
index 00000000000..aeb30d78a35
--- /dev/null
+++ b/mcs/errors/cs0159-2.cs
@@ -0,0 +1,16 @@
+// cs0159-2.cs: No such case 20
+
+class y {
+ enum X { A = 1, B = 1, C = 1 }
+
+ static void Main ()
+ {
+ int x = 1;
+
+ switch (x){
+ case 1: break;
+ case 2: goto case 20;
+ }
+ }
+}
+
diff --git a/mcs/errors/cs0159.cs b/mcs/errors/cs0159.cs
new file mode 100755
index 00000000000..65aa5cb2dfb
--- /dev/null
+++ b/mcs/errors/cs0159.cs
@@ -0,0 +1,23 @@
+// cs0159.cs: No default target for goto default
+// Line:
+
+class X {
+
+ static int m (int n)
+ {
+ switch (n){
+ case 0:
+ goto default;
+
+ case 1:
+ return 1;
+ }
+
+ return 10;
+ }
+
+ static void Main ()
+ {
+ m (1);
+ }
+}
diff --git a/mcs/errors/cs0169.cs b/mcs/errors/cs0169.cs
index 5337e099f00..bcd47c81491 100755
--- a/mcs/errors/cs0169.cs
+++ b/mcs/errors/cs0169.cs
@@ -6,4 +6,6 @@ class X {
void blah ()
{
}
+
+ static void Main () {}
}
diff --git a/mcs/errors/cs0171.cs b/mcs/errors/cs0171.cs
new file mode 100755
index 00000000000..5b2b2343b2a
--- /dev/null
+++ b/mcs/errors/cs0171.cs
@@ -0,0 +1,11 @@
+// cs0171.cs: field x must be initialized before constructor X ends.
+// Line:
+struct X {
+ public readonly int x;
+
+ X (int a)
+ {
+ }
+
+ static void Main () {}
+}
diff --git a/mcs/errors/cs0172.cs b/mcs/errors/cs0172.cs
new file mode 100755
index 00000000000..c0496e9b83f
--- /dev/null
+++ b/mcs/errors/cs0172.cs
@@ -0,0 +1,25 @@
+class X {
+ public static implicit operator X (Y y)
+ {
+ return null;
+ }
+}
+
+class Y {
+ public static implicit operator Y (X x)
+ {
+ return null;
+ }
+}
+
+class Main
+{
+ static void Main ()
+ {
+ X x = new X ();
+ Y y = new Y ();
+
+ object d = (x == x) ? x : y;
+ }
+
+}
diff --git a/mcs/errors/cs0178.cs b/mcs/errors/cs0178.cs
new file mode 100644
index 00000000000..47be8ec08a7
--- /dev/null
+++ b/mcs/errors/cs0178.cs
@@ -0,0 +1,12 @@
+// cs0178.cs :
+// Line :
+
+using System;
+
+public class Blah {
+
+ public static void Main ()
+ {
+ int [,] i = new int [4,2] { 0, 1, 2, 3, 4, 5 };
+ }
+}
diff --git a/mcs/errors/cs0179.cs b/mcs/errors/cs0179.cs
new file mode 100755
index 00000000000..ed7eee8895b
--- /dev/null
+++ b/mcs/errors/cs0179.cs
@@ -0,0 +1,14 @@
+// cs0179.cs: member can not be declared extern and have a body
+// Line:
+
+class X {
+
+ public extern int extern_method ()
+ {
+ }
+
+ public static void Main ()
+ {
+ }
+}
+
diff --git a/mcs/errors/cs0180.cs b/mcs/errors/cs0180.cs
new file mode 100755
index 00000000000..7f1714e7331
--- /dev/null
+++ b/mcs/errors/cs0180.cs
@@ -0,0 +1,12 @@
+// cs0179.cs: member can not be declared extern and abstract
+// Line:
+
+class X {
+
+ public extern abstract int extern_method ();
+
+ public static void Main ()
+ {
+ }
+}
+
diff --git a/mcs/errors/cs0183.cs b/mcs/errors/cs0183.cs
new file mode 100755
index 00000000000..228445ff6b7
--- /dev/null
+++ b/mcs/errors/cs0183.cs
@@ -0,0 +1,13 @@
+// cs0183.cs: the expression is always of the type `x'
+// Line:
+
+class X {
+
+ static void Main ()
+ {
+ int i;
+
+ if (i is int){
+ }
+ }
+}
diff --git a/mcs/errors/cs0184.cs b/mcs/errors/cs0184.cs
new file mode 100755
index 00000000000..014b945f21b
--- /dev/null
+++ b/mcs/errors/cs0184.cs
@@ -0,0 +1,13 @@
+// cs0184.cs: The expression is never of the provided type
+// Line:
+
+class X {
+
+ static void Main ()
+ {
+ int a;
+
+ if (a is byte){
+ }
+ }
+}
diff --git a/mcs/errors/cs0185.cs b/mcs/errors/cs0185.cs
new file mode 100755
index 00000000000..6efb95560a6
--- /dev/null
+++ b/mcs/errors/cs0185.cs
@@ -0,0 +1,11 @@
+// cs0185.cs: object is not a reference type (as expected by lock)
+// Line:
+
+class X {
+ static void Main ()
+ {
+ lock (5) {
+ }
+ }
+}
+
diff --git a/mcs/errors/cs0187.cs b/mcs/errors/cs0187.cs
new file mode 100755
index 00000000000..dd9562abd70
--- /dev/null
+++ b/mcs/errors/cs0187.cs
@@ -0,0 +1,8 @@
+class X {
+ static void Main ()
+ {
+ X x = new X();
+
+ x++;
+ }
+}
diff --git a/mcs/errors/cs0196.cs b/mcs/errors/cs0196.cs
new file mode 100755
index 00000000000..edf4e6fd54e
--- /dev/null
+++ b/mcs/errors/cs0196.cs
@@ -0,0 +1,11 @@
+// cs0196.cs: pointers must be indexed by a single value
+// line: 8
+using System;
+unsafe class ZZ {
+ static void Main () {
+ int *p = null;
+
+ if (p [10,4] == 4)
+ ;
+ }
+}
diff --git a/mcs/errors/cs0200.cs b/mcs/errors/cs0200.cs
new file mode 100755
index 00000000000..87ec5c6786f
--- /dev/null
+++ b/mcs/errors/cs0200.cs
@@ -0,0 +1,15 @@
+// cs0200: can not assign to property X.P -- it is readonly
+// line: 12
+class X {
+ static int P {
+ get {
+ return 1;
+ }
+ }
+
+ static int Main ()
+ {
+ P = 10;
+ return 1;
+ }
+}
diff --git a/mcs/errors/cs0206.cs b/mcs/errors/cs0206.cs
new file mode 100755
index 00000000000..03c79bf1a9a
--- /dev/null
+++ b/mcs/errors/cs0206.cs
@@ -0,0 +1,16 @@
+// cs0206.cs: indexers or properties can not be used as ref or out arguments
+// Line:
+class X {
+ static int P { get { return 1; } set { } }
+
+ static int m (out int v)
+ {
+ v = 1;
+ return 1;
+ }
+
+ static void Main ()
+ {
+ m (out P);
+ }
+}
diff --git a/mcs/errors/cs0214.cs b/mcs/errors/cs0214.cs
new file mode 100644
index 00000000000..08eb088af39
--- /dev/null
+++ b/mcs/errors/cs0214.cs
@@ -0,0 +1,5 @@
+// cs0214: Pointer can only be used in unsafe context
+// Line: 4
+class X {
+ void *a;
+}
diff --git a/mcs/errors/cs0215.cs b/mcs/errors/cs0215.cs
new file mode 100644
index 00000000000..3c875505e94
--- /dev/null
+++ b/mcs/errors/cs0215.cs
@@ -0,0 +1,13 @@
+// cs0215.cs : The return type of operator True or False must be bool
+// Line : 11
+
+class Blah {
+
+ public static void Main ()
+ {
+
+ }
+
+ public static int operator true (Blah i) {}
+
+}
diff --git a/mcs/errors/cs0216.cs b/mcs/errors/cs0216.cs
new file mode 100644
index 00000000000..c218c51f20d
--- /dev/null
+++ b/mcs/errors/cs0216.cs
@@ -0,0 +1,9 @@
+// cs0216.cs: If you define operator <, you also need to define >
+// Line:
+class X {
+ public static X operator < (X a, int b)
+ {
+ return null;
+ }
+}
+
diff --git a/mcs/errors/cs0239.cs b/mcs/errors/cs0239.cs
new file mode 100644
index 00000000000..0f3608643bc
--- /dev/null
+++ b/mcs/errors/cs0239.cs
@@ -0,0 +1,34 @@
+// cs0239.cs : `X.MyMethod' : cannot override inherited member `Bar.MyMethod' because it is sealed.
+// Line : 25
+
+using System;
+
+public class Foo {
+
+ public virtual void MyMethod ()
+ {
+ Console.WriteLine ("This is me !");
+ }
+}
+
+public class Bar : Foo {
+
+ public sealed override void MyMethod ()
+ {
+
+ }
+
+}
+
+public class X : Bar {
+
+ public override void MyMethod ()
+ {
+
+ }
+
+ public static void Main ()
+ {
+
+ }
+}
diff --git a/mcs/errors/cs0242.cs b/mcs/errors/cs0242.cs
new file mode 100755
index 00000000000..2a927d86b6e
--- /dev/null
+++ b/mcs/errors/cs0242.cs
@@ -0,0 +1,11 @@
+// cs0242: operation is not defined for void *
+// Line: 8
+using System;
+unsafe class ZZ {
+ static void Main () {
+ void *p = null;
+
+ if (p [10] == 4)
+ ;
+ }
+}
diff --git a/mcs/errors/cs0246.cs b/mcs/errors/cs0246.cs
new file mode 100644
index 00000000000..8cf6b9a081d
--- /dev/null
+++ b/mcs/errors/cs0246.cs
@@ -0,0 +1,4 @@
+// cs0246.cs: can not find type `B'
+// Line: 4
+interface A : B {
+}
diff --git a/mcs/errors/cs0255.cs b/mcs/errors/cs0255.cs
new file mode 100755
index 00000000000..10e2045385e
--- /dev/null
+++ b/mcs/errors/cs0255.cs
@@ -0,0 +1,13 @@
+// cs0255.cs: Can not use stackalloc in finally or catch
+// Line: 10
+unsafe class X {
+ string s;
+
+ static void Main ()
+ {
+ try {
+ } catch {
+ char *ptr = stackalloc char [10U];
+}
+ }
+}
diff --git a/mcs/errors/cs0503.cs b/mcs/errors/cs0503.cs
index 5f05f6af8fb..e8e8e048568 100755
--- a/mcs/errors/cs0503.cs
+++ b/mcs/errors/cs0503.cs
@@ -1,5 +1,5 @@
// cs0503.cs: The abstract method `Class.X' cannot be marked virtual
// Line: 4
-class Class {
+abstract class Class {
virtual abstract public void X ();
}
diff --git a/mcs/errors/cs0509.cs b/mcs/errors/cs0509.cs
new file mode 100644
index 00000000000..f89988f2cb3
--- /dev/null
+++ b/mcs/errors/cs0509.cs
@@ -0,0 +1,8 @@
+// cs0509.cs: base class is sealed
+// Line: 7
+struct V {
+ int v;
+}
+
+class X : V {
+}
diff --git a/mcs/errors/cs0523.cs b/mcs/errors/cs0523.cs
new file mode 100755
index 00000000000..43b016e6264
--- /dev/null
+++ b/mcs/errors/cs0523.cs
@@ -0,0 +1,12 @@
+// cs0523.cs: circular structure definition
+//
+
+struct A {
+ B b;
+}
+
+struct B {
+ A a;
+}
+
+class Y { static void Main () {} }
diff --git a/mcs/errors/cs0527-2.cs b/mcs/errors/cs0527-2.cs
new file mode 100644
index 00000000000..e312377061b
--- /dev/null
+++ b/mcs/errors/cs0527-2.cs
@@ -0,0 +1,8 @@
+class A1 {
+}
+
+class A2 {
+}
+
+class B : A1, A2 {
+}
diff --git a/mcs/errors/cs0527.cs b/mcs/errors/cs0527.cs
new file mode 100644
index 00000000000..994add02c67
--- /dev/null
+++ b/mcs/errors/cs0527.cs
@@ -0,0 +1,7 @@
+// cs0527: type in interface list is not an interface
+// Line: 6
+class X {
+}
+
+interface A : X {
+}
diff --git a/mcs/errors/cs0529.cs b/mcs/errors/cs0529.cs
new file mode 100644
index 00000000000..52e725162d0
--- /dev/null
+++ b/mcs/errors/cs0529.cs
@@ -0,0 +1,7 @@
+// cs0529: Recursive interface definition
+// Line: 3
+interface A : B {
+}
+
+interface B : A {
+}
diff --git a/mcs/errors/cs0534.cs b/mcs/errors/cs0534.cs
index f17b8a070ec..fe865887ce1 100755
--- a/mcs/errors/cs0534.cs
+++ b/mcs/errors/cs0534.cs
@@ -6,5 +6,6 @@ abstract class X {
}
class Y : X {
+static void Main (){}
}
diff --git a/mcs/errors/cs0543.cs b/mcs/errors/cs0543.cs
new file mode 100644
index 00000000000..b59d0e834f5
--- /dev/null
+++ b/mcs/errors/cs0543.cs
@@ -0,0 +1,14 @@
+// cs1008.cs : Enumerator value for 'Bar' is too large to fit in its type
+// Line : 9
+
+public class Blah {
+
+ public enum MyEnum : byte {
+ Foo = 255,
+ Bar
+ }
+
+ public static void Main ()
+ {
+ }
+}
diff --git a/mcs/errors/cs0552.cs b/mcs/errors/cs0552.cs
new file mode 100755
index 00000000000..7fe395005de
--- /dev/null
+++ b/mcs/errors/cs0552.cs
@@ -0,0 +1,17 @@
+// cs0552.cs: user-defined conversion to/from interface
+// Line: 12
+//
+using System;
+using System.IO;
+
+//
+//
+// Implicit conversion to an interface is not permitted
+//
+class NoIDispose {
+ public static implicit operator IDisposable (NoIDispose a)
+ {
+ return a.x;
+ }
+}
+
diff --git a/mcs/errors/cs0555.cs b/mcs/errors/cs0555.cs
new file mode 100644
index 00000000000..110f952d25f
--- /dev/null
+++ b/mcs/errors/cs0555.cs
@@ -0,0 +1,11 @@
+// cs0555.cs : User-defined conversion cannot take an object of the enclosing type
+// and convert to an object of the enclosing type
+// Line : 8
+
+class Blah {
+
+ public static void Main () {}
+
+ public static implicit operator Blah (Blah i) {}
+
+}
diff --git a/mcs/errors/cs0556.cs b/mcs/errors/cs0556.cs
new file mode 100644
index 00000000000..36ff437d65b
--- /dev/null
+++ b/mcs/errors/cs0556.cs
@@ -0,0 +1,10 @@
+// cs0556.cs : User-defined conversion must convert to or from the enclosing type
+// Line : 8
+
+class Blah {
+
+ public static void Main () {}
+
+ public static implicit operator int (int i) {}
+
+}
diff --git a/mcs/errors/cs0563.cs b/mcs/errors/cs0563.cs
new file mode 100644
index 00000000000..af369883b2c
--- /dev/null
+++ b/mcs/errors/cs0563.cs
@@ -0,0 +1,7 @@
+// cs0563.cs: One of the parameters to the binary operator should be the containing type
+// Line: 4
+class X {
+ public static int operator + (int a, int b)
+ {
+ }
+}
diff --git a/mcs/errors/cs0574.cs b/mcs/errors/cs0574.cs
new file mode 100755
index 00000000000..1b88bf0173f
--- /dev/null
+++ b/mcs/errors/cs0574.cs
@@ -0,0 +1,13 @@
+// cs0574.cs: Name of destructor must match name of class:
+// Line: 6
+
+class X {
+
+ ~Y ()
+ {
+ }
+
+ static void Main ()
+ {
+ }
+}
diff --git a/mcs/errors/cs0575.cs b/mcs/errors/cs0575.cs
new file mode 100755
index 00000000000..16d0b7aa49e
--- /dev/null
+++ b/mcs/errors/cs0575.cs
@@ -0,0 +1,12 @@
+// cs0575.cs: destructors are only allowed in class types
+// Line: 5
+struct X {
+
+ ~X ()
+ {
+ }
+
+ static void Main ()
+ {
+ }
+}
diff --git a/mcs/errors/cs0592.cs b/mcs/errors/cs0592.cs
new file mode 100644
index 00000000000..02dd459cdbe
--- /dev/null
+++ b/mcs/errors/cs0592.cs
@@ -0,0 +1,29 @@
+// cs0592.cs : Attribute 'Simple' is not valid on this declaration type. It is valid on 'constructor' declarations only.
+// Line : 22
+
+using System;
+
+[AttributeUsage (AttributeTargets.Constructor, AllowMultiple = true)]
+ public class SimpleAttribute : Attribute {
+
+ string name = null;
+
+ public string MyNamedArg;
+
+ public SimpleAttribute (string name)
+ {
+ this.name = name;
+ }
+
+
+ }
+
+[Simple ("Dummy", MyNamedArg = "Dude!")]
+ public class Blah {
+
+ public static void Main ()
+ {
+ }
+ }
+
+
diff --git a/mcs/errors/cs0601.cs b/mcs/errors/cs0601.cs
new file mode 100644
index 00000000000..020787e74cf
--- /dev/null
+++ b/mcs/errors/cs0601.cs
@@ -0,0 +1,11 @@
+// cs0601.cs : The DllImport attribute must be specified on a method marked 'static' and 'extern'.
+// Line : 9
+
+using System;
+using System.Runtime.InteropServices;
+
+class Test {
+ [DllImport("cygwin1.dll", EntryPoint="puts", CharSet=CharSet.Ansi)]
+ public extern int puts (string name);
+
+}
diff --git a/mcs/errors/cs0617.cs b/mcs/errors/cs0617.cs
new file mode 100644
index 00000000000..e75266d9d1f
--- /dev/null
+++ b/mcs/errors/cs0617.cs
@@ -0,0 +1,26 @@
+// cs0617,cs : 'MyNamedArg' is not a valid named attribute argument. Named attribute arguments must be fields which are not readonly, static or const, or properties with a set accessor which are not static.
+// Line : 20
+
+using System;
+
+[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
+ public class SimpleAttribute : Attribute {
+
+ string name = null;
+
+ public readonly string MyNamedArg;
+
+ public SimpleAttribute (string name)
+ {
+ this.name = name;
+ }
+
+ }
+
+[Simple ("Dummy", MyNamedArg = "Dude!")]
+ public class Blah {
+
+ public static void Main ()
+ {
+ }
+ }
diff --git a/mcs/errors/cs0621.cs b/mcs/errors/cs0621.cs
index 014fd39ba92..87bc932088c 100755
--- a/mcs/errors/cs0621.cs
+++ b/mcs/errors/cs0621.cs
@@ -1,5 +1,5 @@
// cs0621.cs: X.method virtual or abstract methods can not be private
// Line:
class X {
- virtual void method ();
+ virtual void method () {}
}
diff --git a/mcs/errors/cs0642.cs b/mcs/errors/cs0642.cs
new file mode 100755
index 00000000000..9c73cd6baf1
--- /dev/null
+++ b/mcs/errors/cs0642.cs
@@ -0,0 +1,6 @@
+class X{
+ static void Main ()
+ {
+ if (true);
+ }
+}
diff --git a/mcs/errors/cs0644.cs b/mcs/errors/cs0644.cs
new file mode 100755
index 00000000000..5e93f4ef509
--- /dev/null
+++ b/mcs/errors/cs0644.cs
@@ -0,0 +1,4 @@
+// cs0644.cs: Cannot inherit from special class
+// Line: 3
+class X : System.ValueType {
+}
diff --git a/mcs/errors/cs0645.cs b/mcs/errors/cs0645.cs
new file mode 100755
index 00000000000..ff866d9dcad
--- /dev/null
+++ b/mcs/errors/cs0645.cs
@@ -0,0 +1,4 @@
+// cs0645.cs: identifier too long
+// Line: 3
+class aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa {
+}
diff --git a/mcs/errors/cs0646.cs b/mcs/errors/cs0646.cs
new file mode 100644
index 00000000000..78b7f4e3c77
--- /dev/null
+++ b/mcs/errors/cs0646.cs
@@ -0,0 +1,26 @@
+// cs0646.cs : Cannot specify the DefaultMember attribute on a type containing an indexer
+// Line : 8
+
+using System;
+using System.Reflection;
+
+[DefaultMember ("Item")]
+public class Foo {
+
+ string bar;
+
+ public static void Main ()
+ {
+ Console.WriteLine ("foo");
+ }
+
+ string this [int idx] {
+ get {
+ return "foo";
+ }
+ set {
+ bar = value;
+ }
+ }
+}
+
diff --git a/mcs/errors/cs0658.cs b/mcs/errors/cs0658.cs
new file mode 100644
index 00000000000..e4da1e82b72
--- /dev/null
+++ b/mcs/errors/cs0658.cs
@@ -0,0 +1,18 @@
+// cs0658.cs : Invalid attribute location "blah"
+// Line : 8
+
+public class MyClass {
+
+ delegate int MyDelegate (int i, int j);
+
+ [blah:Help("blah")]
+ public static MyClass operator/ (MyClass i, MyClass j)
+ {
+
+ }
+
+ public static implicit operator MyClass (Object o)
+ {
+
+ }
+}
diff --git a/mcs/errors/cs0664.cs b/mcs/errors/cs0664.cs
new file mode 100755
index 00000000000..daa1f39b717
--- /dev/null
+++ b/mcs/errors/cs0664.cs
@@ -0,0 +1,8 @@
+// cs0664.cs: Literal of type double cannot be implicity converted to Float, use F suffix
+// Line: 6
+class X {
+ void A ()
+ {
+ float f = 2.0;
+ }
+}
diff --git a/mcs/errors/cs0677.cs b/mcs/errors/cs0677.cs
new file mode 100755
index 00000000000..822724a9b53
--- /dev/null
+++ b/mcs/errors/cs0677.cs
@@ -0,0 +1,12 @@
+// cs0677.cs: X.a volatile field can not be of type "A"
+// Line: 8
+using System;
+
+struct A { int a; }
+
+class X {
+ public volatile A a;
+ static void Main ()
+ {
+ }
+}
diff --git a/mcs/errors/cs1008.cs b/mcs/errors/cs1008.cs
new file mode 100644
index 00000000000..3c49e166dd8
--- /dev/null
+++ b/mcs/errors/cs1008.cs
@@ -0,0 +1,14 @@
+// cs1008.cs : Type byte, sbyte, short, ushort, int, uint, long, or ulong expected
+// Line : 7
+
+public class Blah {
+
+ public enum MyEnum {
+ Foo = "foo",
+ Bar
+ }
+
+ public static void Main ()
+ {
+ }
+}
diff --git a/mcs/errors/cs1019.cs b/mcs/errors/cs1019.cs
new file mode 100644
index 00000000000..4fe30f842f7
--- /dev/null
+++ b/mcs/errors/cs1019.cs
@@ -0,0 +1,27 @@
+// cs1019.cs : Overloadable unary operator expected
+// Line : 18
+
+public class MyClass {
+
+ public int this[int ndx]
+ {
+ get { }
+ set { }
+ }
+
+ public event EventHandler Click
+ {
+ add { }
+ remove { }
+ }
+
+ public static MyClass operator/ (MyClass i)
+ {
+
+ }
+
+ public static implicit operator MyClass (Object o)
+ {
+
+ }
+}
diff --git a/mcs/errors/cs1020.cs b/mcs/errors/cs1020.cs
new file mode 100644
index 00000000000..891a613331f
--- /dev/null
+++ b/mcs/errors/cs1020.cs
@@ -0,0 +1,28 @@
+// cs1020.cs : Overloadable binary operator expected
+// Line : 19
+
+
+public class MyClass {
+
+ public int this[int ndx]
+ {
+ get { }
+ set { }
+ }
+
+ public event EventHandler Click
+ {
+ add { }
+ remove { }
+ }
+
+ public static MyClass operator++ (MyClass i, MyClass j)
+ {
+
+ }
+
+ public static implicit operator MyClass (Object o)
+ {
+
+ }
+}
diff --git a/mcs/errors/cs1032.cs b/mcs/errors/cs1032.cs
new file mode 100755
index 00000000000..e6640a68fe9
--- /dev/null
+++ b/mcs/errors/cs1032.cs
@@ -0,0 +1,8 @@
+// cs1032: tokens seen before define
+// Line: 4
+class X {
+#define A
+
+ static void Main () {
+ }
+}
diff --git a/mcs/errors/cs1510.cs b/mcs/errors/cs1510.cs
new file mode 100755
index 00000000000..4feba3810f6
--- /dev/null
+++ b/mcs/errors/cs1510.cs
@@ -0,0 +1,13 @@
+// cs1510: an lvalue is required for ref or out argument
+// Line: 11
+class X {
+ public static void m (ref int i)
+ {
+ i++;
+ }
+
+ static void Main ()
+ {
+ m (ref 4);
+ }
+}
diff --git a/mcs/errors/cs1511.cs b/mcs/errors/cs1511.cs
new file mode 100755
index 00000000000..4ec26c689b4
--- /dev/null
+++ b/mcs/errors/cs1511.cs
@@ -0,0 +1,14 @@
+// cs1511.cs: Base modifier not allowed in static code
+// Line:
+
+class Y {
+ public int a;
+}
+
+class X : Y {
+
+ static void Main ()
+ {
+ base.a = 1;
+ }
+}
diff --git a/mcs/errors/cs1513.cs b/mcs/errors/cs1513.cs
new file mode 100755
index 00000000000..819528ced96
--- /dev/null
+++ b/mcs/errors/cs1513.cs
@@ -0,0 +1,3 @@
+namespace X {
+
+
diff --git a/mcs/errors/cs1518.cs b/mcs/errors/cs1518.cs
new file mode 100755
index 00000000000..89036e1ee62
--- /dev/null
+++ b/mcs/errors/cs1518.cs
@@ -0,0 +1,6 @@
+//cs1518.cs: namespace can only contain class, interface, enum, struct or delegate
+// Line: 5
+namespace X {
+
+ sealed fe {}
+}
diff --git a/mcs/errors/cs1523.cs b/mcs/errors/cs1523.cs
new file mode 100755
index 00000000000..fda07fd98f6
--- /dev/null
+++ b/mcs/errors/cs1523.cs
@@ -0,0 +1,14 @@
+// cs1523: case or default must precede code in switch statement
+// Line: 11
+
+class X {
+
+ static void Main ()
+ {
+ int i = 0;
+
+ switch (i){
+ i = 4;
+ }
+ }
+}
diff --git a/mcs/errors/cs1524.cs b/mcs/errors/cs1524.cs
new file mode 100755
index 00000000000..b43976cc0bd
--- /dev/null
+++ b/mcs/errors/cs1524.cs
@@ -0,0 +1,15 @@
+// cs1524.cs: expected catch or finally
+// Line: 12
+
+namespace Test {
+ public class Test {
+ public static int Main () {
+ int a;
+ try {
+ a = 1;
+ }
+
+ return 0;
+ }
+ }
+}
diff --git a/mcs/errors/cs1526.cs b/mcs/errors/cs1526.cs
new file mode 100755
index 00000000000..582d451ea89
--- /dev/null
+++ b/mcs/errors/cs1526.cs
@@ -0,0 +1,8 @@
+// cs1526: new expression requires () or [] after type
+// Line: 6
+class X {
+ static void Main ()
+ {
+ X x = new X;
+ }
+}
diff --git a/mcs/errors/cs1527.cs b/mcs/errors/cs1527.cs
new file mode 100755
index 00000000000..663f880cd58
--- /dev/null
+++ b/mcs/errors/cs1527.cs
@@ -0,0 +1,4 @@
+// cs1527.cs: namespace elements cant explicitly be declared protected or private
+// Line:
+private class X {
+}
diff --git a/mcs/errors/cs1528.cs b/mcs/errors/cs1528.cs
new file mode 100755
index 00000000000..7223adc8f40
--- /dev/null
+++ b/mcs/errors/cs1528.cs
@@ -0,0 +1,14 @@
+// cs1528.cs: cant specify constructor arguments in declaration
+// Line:
+class X {
+ X (int a)
+ {
+ }
+}
+
+class Y {
+ static void Main ()
+ {
+ X x (4);
+ }
+}
diff --git a/mcs/errors/cs1530.cs b/mcs/errors/cs1530.cs
new file mode 100755
index 00000000000..7ed13b49dcf
--- /dev/null
+++ b/mcs/errors/cs1530.cs
@@ -0,0 +1,7 @@
+// cs1530.cs: New not allowed on namespace declarations
+// Line:
+namespace A {
+
+ new class X {
+ }
+}
diff --git a/mcs/errors/cs1593.cs b/mcs/errors/cs1593.cs
new file mode 100644
index 00000000000..755cd703170
--- /dev/null
+++ b/mcs/errors/cs1593.cs
@@ -0,0 +1,30 @@
+// cs1593.cs : Delegate 'Blah.MyDelegate' does not take '1' arguments
+// Line : 21
+
+using System;
+
+public class Blah {
+
+ public delegate int MyDelegate (int i, int j);
+
+ public int Foo (int i, int j)
+ {
+ return i+j;
+ }
+
+ public static int Main ()
+ {
+ Blah i = new Blah ();
+
+ MyDelegate del = new MyDelegate (i.Foo);
+
+ int number = del (2);
+
+ if (number == 5)
+ return 0;
+ else
+ return 1;
+
+ }
+
+}
diff --git a/mcs/errors/cs1594.cs b/mcs/errors/cs1594.cs
new file mode 100644
index 00000000000..0ffb3d9e761
--- /dev/null
+++ b/mcs/errors/cs1594.cs
@@ -0,0 +1,30 @@
+// cs1594.cs : Delegate 'Blah.MyDelegate' has some invalid arguments.
+// Line : 21
+
+using System;
+
+public class Blah {
+
+ public delegate int MyDelegate (int i, int j);
+
+ public int Foo (int i, int j)
+ {
+ return i+j;
+ }
+
+ public static int Main ()
+ {
+ Blah i = new Blah ();
+
+ MyDelegate del = new MyDelegate (i.Foo);
+
+ int number = del (2, "a string");
+
+ if (number == 5)
+ return 0;
+ else
+ return 1;
+
+ }
+
+}
diff --git a/mcs/errors/cs1604.cs b/mcs/errors/cs1604.cs
new file mode 100755
index 00000000000..1e87da758a1
--- /dev/null
+++ b/mcs/errors/cs1604.cs
@@ -0,0 +1,14 @@
+// cs1604.cs: m is a readonly variable
+// line: 10
+using System.IO;
+
+class X {
+
+ static void Main ()
+ {
+ using (MemoryStream m = new MemoryStream ()){
+ m = null;
+ }
+ }
+}
+
diff --git a/mcs/errors/errors.txt b/mcs/errors/errors.txt
index d769c5c1bd2..cc7a955248c 100755
--- a/mcs/errors/errors.txt
+++ b/mcs/errors/errors.txt
@@ -8,4 +8,49 @@ numbers to match the Microsoft numbers:
of handling it.
-2 Internal error, an interface is being defined inside an
- interface (This should never happen). \ No newline at end of file
+ interface (This should never happen).
+
+-3 Constant type is not one of sbyte, byte, short, ushort, int,
+ uint, long, ulong, char, float, double, decimal, bool, string, enum
+ or null type.
+
+-5 A search for a name on a Type returned matches that contain
+ methods and non-methods. They have the same name, and I do
+ not know how this is possible to begin with.
+
+-6 Generic internal compiler error.
+
+-7 Internal compiler error/library error: no default constructor
+ for a built-in type. Ie, decimal (int 32)
+
+-8 User-defined conversion cannot convert from or to object type.
+
+-9 User-defined conversion cannot convert from or to an interface type.
+
+-10 User-defined conversion cannot convert between types that derive
+ from each other.
+
+-11 Delegate creation expression takes only one argument
+
+-12 More than one integral conversion exists for the type on a
+ switch statement.
+
+-13 No return with a value found. Warning, since we currently
+ do not perform flow analysis, and can not tell whether a
+ ret is required or not.
+
+-14 Invalid number passed to probe
+
+-15 Can not locate default assembly path
+
+-16 Can not use System.Enum.ToObject (type, ConstantValue) with
+ user defined types.
+
+-17 A type has already been defined (try --nostdlib)
+
+-18 Do not know how to generate debugging information for this platform.
+
+-19 Can not find required utility function in the core libraries.
+
+-20 Cannot find attribute type Blah (maybe you forgot to set the
+ usage using the AttributeUsage attribute ?).
diff --git a/mcs/errors/fail b/mcs/errors/fail
new file mode 100755
index 00000000000..511cec0bfcb
--- /dev/null
+++ b/mcs/errors/fail
@@ -0,0 +1,53 @@
+The following tests failed:
+
+cs0051.cs, cs0060.cs, cs0111.cs
+
+cs0108.cs: We should re-enable the test code in the compiler
+cs0110.cs: Stack overflow in the compiler
+
+cs0118.cs:
+ We report the error, but the CSC error gives more information.
+
+cs0121.cs: Function deambiguator does not work here
+cs0136-2.cs cs0136.cs: Similar error reported (reuse of variable name, 128)
+cs0157.cs: Internal compiler error (null pointer reference)
+cs0164.cs: We dont emit the warning for an unused label
+cs0165-2.cs cs0165.cs:
+ We need data flow analysis
+
+cs0171.cs
+ We do not track unassigned struct fields on struct constructors
+
+cs0216.cs:
+ We do not report missing operators.
+
+cs0234.cs:
+ Will be hard to fix;
+
+cs0654.cs:
+ Compiler crash
+
+cs1001.cs:
+ Compiler emits syntax error; Its ok.
+
+ Compiler crashes
+cs1501.cs:
+ Compiler crashes. Easy to fix
+
+cs1513.cs:
+ Syntax error; We could provide better message
+
+cs1518.cs:
+ Syntax error; We could provide better message
+
+cs1525.cs:
+ Syntax error; We could provide better message
+
+cs1528.cs:
+ Syntax error; We could provide better message
+
+cs1529.cs:
+ Syntax error; We could provide better message
+
+cs1552.cs:
+ Syntax error; We could provide better message
diff --git a/mcs/errors/makefile b/mcs/errors/makefile
new file mode 100755
index 00000000000..f51f021bc5f
--- /dev/null
+++ b/mcs/errors/makefile
@@ -0,0 +1,37 @@
+#
+# Compile at the maximum warning level to probe for warnings
+#
+MCS=../mcs/mcs.exe --wlevel 4
+
+all:
+ failed=false; \
+ for i in cs*.cs; do \
+ case $$i in \
+ cs[0-9]*-[0-9]*cs) \
+ error=`echo $$i | sed -e 's/cs*//' -e 's/.cs//' -e 's/-.*//'`; \
+ ;;\
+ cs[0-9-]*cs) \
+ error=`echo $$i | sed -e 's/cs*//' -e 's/.cs//'`; \
+ ;;\
+ esac; \
+ echo $(MCS) --probe $$error $$i; \
+ $(MCS) --probe $$error 1 $$i > /dev/null; \
+ code=$$?; \
+ if test $$code != 123; then \
+ echo Code is: $$code; \
+ if [ x$$code = x124 ]; then \
+ echo "Compiler failed to flag $$i"; \
+ else \
+ echo "Compiler failed to compile $$i"; \
+ fi; \
+ flist="$$flist $$i"; \
+ failed=true; \
+ else \
+ echo test $$i ok; \
+ fi; \
+ done; \
+ if $$failed; then \
+ echo "The following tests failed: $$flist"; \
+ else \
+ echo All tests passed; \
+ fi \ No newline at end of file
diff --git a/mcs/jay/.cvsignore b/mcs/jay/.cvsignore
new file mode 100755
index 00000000000..75b36e0911d
--- /dev/null
+++ b/mcs/jay/.cvsignore
@@ -0,0 +1,2 @@
+jay
+jay.exe
diff --git a/mcs/jay/ACKNOWLEDGEMENTS b/mcs/jay/ACKNOWLEDGEMENTS
new file mode 100644
index 00000000000..b66bb250645
--- /dev/null
+++ b/mcs/jay/ACKNOWLEDGEMENTS
@@ -0,0 +1,25 @@
+ Berkeley Yacc owes much to the unflagging efforts of Keith Bostic.
+His badgering kept me working on it long after I was ready to quit.
+
+ Berkeley Yacc is based on the excellent algorithm for computing LALR(1)
+lookaheads developed by Tom Pennello and Frank DeRemer. The algorithm is
+described in their almost impenetrable article in TOPLAS 4,4.
+
+ Finally, much of the credit for the latest version must go to those
+who pointed out deficiencies of my earlier releases. Among the most
+prolific contributors were
+
+ Benson I. Margulies
+ Dave Gentzel
+ Antoine Verheijen
+ Peter S. Housel
+ Dale Smith
+ Ozan Yigit
+ John Campbell
+ Bill Sommerfeld
+ Paul Hilfinger
+ Gary Bridgewater
+ Dave Bakken
+ Dan Lanciani
+ Richard Sargent
+ Parag Patel
diff --git a/mcs/jay/ChangeLog b/mcs/jay/ChangeLog
new file mode 100755
index 00000000000..20b2931583a
--- /dev/null
+++ b/mcs/jay/ChangeLog
@@ -0,0 +1,9 @@
+2001-07-15 Sean MacIsaac <macisaac@ximian.com>
+
+ * makefile: added windows and unix targets.
+
+2001-07-14 Sean MacIsaac <macisaac@ximian.com>
+
+ * main.c: fixed error in command line flag -c if it was not first
+ option.
+
diff --git a/mcs/jay/NEW_FEATURES b/mcs/jay/NEW_FEATURES
new file mode 100644
index 00000000000..b030c625b00
--- /dev/null
+++ b/mcs/jay/NEW_FEATURES
@@ -0,0 +1,46 @@
+ The -r option has been implemented. The -r option tells Yacc to
+put the read-only tables in y.tab.c and the code and variables in
+y.code.c. Keith Bostic asked for this option so that :yyfix could be
+eliminated.
+
+ The -l and -t options have been implemented. The -l option tells
+Yacc not to include #line directives in the code it produces. The -t
+option causes debugging code to be included in the compiled parser.
+
+ The code for error recovery has been changed to implement the same
+algorithm as AT&T Yacc. There will still be differences in the way
+error recovery works because AT&T Yacc uses more default reductions
+than Berkeley Yacc.
+
+ The environment variable TMPDIR determines the directory where
+temporary files will be created. If TMPDIR is defined, temporary files
+will be created in the directory whose pathname is the value of TMPDIR.
+By default, temporary files are created in /tmp.
+
+ The keywords are now case-insensitive. For example, %nonassoc,
+%NONASSOC, %NonAssoc, and %nOnAsSoC are all equivalent.
+
+ Commas and semicolons that are not part of C code are treated as
+commentary.
+
+ Line-end comments, as in BCPL, are permitted. Line-end comments
+begin with // and end at the next end-of-line. Line-end comments are
+permitted in C code; they are converted to C comments on output.
+
+ The form of y.output files has been changed to look more like
+those produced by AT&T Yacc.
+
+ A new kind of declaration has been added. The form of the declaration
+is
+
+ %ident string
+
+where string is a sequence of characters begining with a double quote
+and ending with either a double quote or the next end-of-line, whichever
+comes first. The declaration will cause a #ident directive to be written
+near the start of the output file.
+
+ If a parser has been compiled with debugging code, that code can be
+enabled by setting an environment variable. If the environment variable
+YYDEBUG is set to 0, debugging output is suppressed. If it is set to 1,
+debugging output is written to standard output.
diff --git a/mcs/jay/NOTES b/mcs/jay/NOTES
new file mode 100644
index 00000000000..9db3c96ce1b
--- /dev/null
+++ b/mcs/jay/NOTES
@@ -0,0 +1,9 @@
+Berkeley Yacc reflects its origins. The reason so many routines
+use exactly six register variables is that Berkeley Yacc was
+developed on a VAX using PCC. PCC placed at most six variables
+in registers. I went to considerable effort to find which six
+variables most belonged in registers. Changes in machines and
+compilers make that effort worthless, perhaps even harmful.
+
+The code contains many instances where address calculations are
+performed in particular ways to optimize the code for the VAX.
diff --git a/mcs/jay/README b/mcs/jay/README
new file mode 100644
index 00000000000..b261173398e
--- /dev/null
+++ b/mcs/jay/README
@@ -0,0 +1,10 @@
+This is a port of Jay to C#, the original Jay can be found here:
+ http://www.informatik.uni-osnabrueck.de/bernd/jay/
+
+This is a temporary solution as we move to a Bison-generated parser
+as it would provide better error recovery (and error productions
+are broken in my port of Jay).
+
+The original README from Jay is in `README.jay'
+
+Miguel
diff --git a/mcs/jay/README.jay b/mcs/jay/README.jay
new file mode 100644
index 00000000000..94b7b72e6e4
--- /dev/null
+++ b/mcs/jay/README.jay
@@ -0,0 +1,55 @@
+ This version of Berkeley Yacc was taken from the BSD-Lite CD and targeted
+to Java by
+
+ axel.schreiner@informatik.uni-osnabrueck.de
+
+Makefile -> makefile removed Berkeleyisms, call it jay
+defs.h eliminate -dlpr options, %union, output_file, #ident
+ eliminate sekeleton.c references
+error.c eliminate %union
+main.c eliminate -dlpr options, %union, output_file
+output.c eliminate -dlpr options, %union, output_file
+ fix #define, short, -t/yyDebug
+ respell YYERRCODE, YYTABLESIZE, YYFINAL, YYMAXTOKEN
+ output trailer last
+ switch to filter behaviour
+reader.c eliminate output_file, #ident
+ #line -> // line, pass //
+ yyvsp[] -> yyVals[yyTop], yyval -> yyVal
+skeleton.c -> skeleton Java skeleton
+test removed
+yacc.1 -> jay.1 adapted
+yyfix.* removed
+
+Types: there is a significant difference. yacc uses %union to cast the value
+stack and <tag> to select alternatives. This works for l- and r-values alike.
+jay uses Object as the value stack and <tag> to set a class. l-values must not
+be cast. $n should not be assigned to, but $$ usually is. $n is referenced,
+but $$ usually is not. Consequently jay casts $n and $<tag>$ but not $<>n
+and $$. This makes assignment to $n references to $$ kludgily possible.
+As another kludge, to prevent 'untyped' messages and to avoid unnecessary
+casts, casts to "Object" are not emitted.
+-------------------------------------------------------------------------------
+ Berkeley Yacc is an LALR(1) parser generator. Berkeley Yacc has been made
+as compatible as possible with AT&T Yacc. Berkeley Yacc can accept any input
+specification that conforms to the AT&T Yacc documentation. Specifications
+that take advantage of undocumented features of AT&T Yacc will probably be
+rejected.
+
+ Berkeley Yacc is distributed with no warranty whatever. The code is certain
+to contain errors. Neither the author nor any contributor takes responsibility
+for any consequences of its use.
+
+ Berkeley Yacc is in the public domain. The data structures and algorithms
+used in Berkeley Yacc are all either taken from documents available to the
+general public or are inventions of the author. Anyone may freely distribute
+source or binary forms of Berkeley Yacc whether unchanged or modified.
+Distributers may charge whatever fees they can obtain for Berkeley Yacc.
+Programs generated by Berkeley Yacc may be distributed freely.
+
+ Please report bugs to
+
+ robert.corbett@eng.Sun.COM
+
+Include a small example if possible. Please include the banner string from
+skeleton.c with the bug report. Do not expect rapid responses.
diff --git a/mcs/jay/closure.c b/mcs/jay/closure.c
new file mode 100644
index 00000000000..5f63c5f32cd
--- /dev/null
+++ b/mcs/jay/closure.c
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)closure.c 5.3 (Berkeley) 5/24/93";
+#endif /* not lint */
+
+#include "defs.h"
+
+short *itemset;
+short *itemsetend;
+unsigned *ruleset;
+
+static unsigned *first_derives;
+static unsigned *EFF;
+
+
+set_EFF()
+{
+ register unsigned *row;
+ register int symbol;
+ register short *sp;
+ register int rowsize;
+ register int i;
+ register int rule;
+
+ rowsize = WORDSIZE(nvars);
+ EFF = NEW2(nvars * rowsize, unsigned);
+
+ row = EFF;
+ for (i = start_symbol; i < nsyms; i++)
+ {
+ sp = derives[i];
+ for (rule = *sp; rule > 0; rule = *++sp)
+ {
+ symbol = ritem[rrhs[rule]];
+ if (ISVAR(symbol))
+ {
+ symbol -= start_symbol;
+ SETBIT(row, symbol);
+ }
+ }
+ row += rowsize;
+ }
+
+ reflexive_transitive_closure(EFF, nvars);
+
+#ifdef DEBUG
+ print_EFF();
+#endif
+}
+
+
+set_first_derives()
+{
+ register unsigned *rrow;
+ register unsigned *vrow;
+ register int j;
+ register unsigned k;
+ register unsigned cword;
+ register short *rp;
+
+ int rule;
+ int i;
+ int rulesetsize;
+ int varsetsize;
+
+ rulesetsize = WORDSIZE(nrules);
+ varsetsize = WORDSIZE(nvars);
+ first_derives = NEW2(nvars * rulesetsize, unsigned) - ntokens * rulesetsize;
+
+ set_EFF();
+
+ rrow = first_derives + ntokens * rulesetsize;
+ for (i = start_symbol; i < nsyms; i++)
+ {
+ vrow = EFF + ((i - ntokens) * varsetsize);
+ k = BITS_PER_WORD;
+ for (j = start_symbol; j < nsyms; k++, j++)
+ {
+ if (k >= BITS_PER_WORD)
+ {
+ cword = *vrow++;
+ k = 0;
+ }
+
+ if (cword & (1 << k))
+ {
+ rp = derives[j];
+ while ((rule = *rp++) >= 0)
+ {
+ SETBIT(rrow, rule);
+ }
+ }
+ }
+
+ vrow += varsetsize;
+ rrow += rulesetsize;
+ }
+
+#ifdef DEBUG
+ print_first_derives();
+#endif
+
+ FREE(EFF);
+}
+
+
+closure(nucleus, n)
+short *nucleus;
+int n;
+{
+ register int ruleno;
+ register unsigned word;
+ register unsigned i;
+ register short *csp;
+ register unsigned *dsp;
+ register unsigned *rsp;
+ register int rulesetsize;
+
+ short *csend;
+ unsigned *rsend;
+ int symbol;
+ int itemno;
+
+ rulesetsize = WORDSIZE(nrules);
+ rsp = ruleset;
+ rsend = ruleset + rulesetsize;
+ for (rsp = ruleset; rsp < rsend; rsp++)
+ *rsp = 0;
+
+ csend = nucleus + n;
+ for (csp = nucleus; csp < csend; ++csp)
+ {
+ symbol = ritem[*csp];
+ if (ISVAR(symbol))
+ {
+ dsp = first_derives + symbol * rulesetsize;
+ rsp = ruleset;
+ while (rsp < rsend)
+ *rsp++ |= *dsp++;
+ }
+ }
+
+ ruleno = 0;
+ itemsetend = itemset;
+ csp = nucleus;
+ for (rsp = ruleset; rsp < rsend; ++rsp)
+ {
+ word = *rsp;
+ if (word)
+ {
+ for (i = 0; i < BITS_PER_WORD; ++i)
+ {
+ if (word & (1 << i))
+ {
+ itemno = rrhs[ruleno+i];
+ while (csp < csend && *csp < itemno)
+ *itemsetend++ = *csp++;
+ *itemsetend++ = itemno;
+ while (csp < csend && *csp == itemno)
+ ++csp;
+ }
+ }
+ }
+ ruleno += BITS_PER_WORD;
+ }
+
+ while (csp < csend)
+ *itemsetend++ = *csp++;
+
+#ifdef DEBUG
+ print_closure(n);
+#endif
+}
+
+
+
+finalize_closure()
+{
+ FREE(itemset);
+ FREE(ruleset);
+ FREE(first_derives + ntokens * WORDSIZE(nrules));
+}
+
+
+#ifdef DEBUG
+
+print_closure(n)
+int n;
+{
+ register short *isp;
+
+ printf("\n\nn = %d\n\n", n);
+ for (isp = itemset; isp < itemsetend; isp++)
+ printf(" %d\n", *isp);
+}
+
+
+print_EFF()
+{
+ register int i, j;
+ register unsigned *rowp;
+ register unsigned word;
+ register unsigned k;
+
+ printf("\n\nEpsilon Free Firsts\n");
+
+ for (i = start_symbol; i < nsyms; i++)
+ {
+ printf("\n%s", symbol_name[i]);
+ rowp = EFF + ((i - start_symbol) * WORDSIZE(nvars));
+ word = *rowp++;
+
+ k = BITS_PER_WORD;
+ for (j = 0; j < nvars; k++, j++)
+ {
+ if (k >= BITS_PER_WORD)
+ {
+ word = *rowp++;
+ k = 0;
+ }
+
+ if (word & (1 << k))
+ printf(" %s", symbol_name[start_symbol + j]);
+ }
+ }
+}
+
+
+print_first_derives()
+{
+ register int i;
+ register int j;
+ register unsigned *rp;
+ register unsigned cword;
+ register unsigned k;
+
+ printf("\n\n\nFirst Derives\n");
+
+ for (i = start_symbol; i < nsyms; i++)
+ {
+ printf("\n%s derives\n", symbol_name[i]);
+ rp = first_derives + i * WORDSIZE(nrules);
+ k = BITS_PER_WORD;
+ for (j = 0; j <= nrules; k++, j++)
+ {
+ if (k >= BITS_PER_WORD)
+ {
+ cword = *rp++;
+ k = 0;
+ }
+
+ if (cword & (1 << k))
+ printf(" %d\n", j);
+ }
+ }
+
+ fflush(stdout);
+}
+
+#endif
diff --git a/mcs/jay/defs.h b/mcs/jay/defs.h
new file mode 100644
index 00000000000..ac1d63f53a3
--- /dev/null
+++ b/mcs/jay/defs.h
@@ -0,0 +1,308 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)defs.h 5.6 (Berkeley) 5/24/93
+ */
+
+#include <assert.h>
+#include <ctype.h>
+#include <stdio.h>
+
+
+/* machine-dependent definitions */
+/* the following definitions are for the Tahoe */
+/* they might have to be changed for other machines */
+
+/* MAXCHAR is the largest unsigned character value */
+/* MAXSHORT is the largest value of a C short */
+/* MINSHORT is the most negative value of a C short */
+/* MAXTABLE is the maximum table size */
+/* BITS_PER_WORD is the number of bits in a C unsigned */
+/* WORDSIZE computes the number of words needed to */
+/* store n bits */
+/* BIT returns the value of the n-th bit starting */
+/* from r (0-indexed) */
+/* SETBIT sets the n-th bit starting from r */
+
+#define MAXCHAR 255
+#define MAXSHORT 32767
+#define MINSHORT -32768
+#define MAXTABLE 32500
+#define BITS_PER_WORD 32
+#define WORDSIZE(n) (((n)+(BITS_PER_WORD-1))/BITS_PER_WORD)
+#define BIT(r, n) ((((r)[(n)>>5])>>((n)&31))&1)
+#define SETBIT(r, n) ((r)[(n)>>5]|=((unsigned)1<<((n)&31)))
+
+
+/* character names */
+
+#define NUL '\0' /* the null character */
+#define NEWLINE '\n' /* line feed */
+#define SP ' ' /* space */
+#define BS '\b' /* backspace */
+#define HT '\t' /* horizontal tab */
+#define VT '\013' /* vertical tab */
+#define CR '\r' /* carriage return */
+#define FF '\f' /* form feed */
+#define QUOTE '\'' /* single quote */
+#define DOUBLE_QUOTE '\"' /* double quote */
+#define BACKSLASH '\\' /* backslash */
+
+
+/* defines for constructing filenames */
+
+#define CODE_SUFFIX ".code.c"
+#define DEFINES_SUFFIX ".tab.h"
+#define OUTPUT_SUFFIX ".tab.c"
+#define VERBOSE_SUFFIX ".output"
+
+
+/* keyword codes */
+
+#define TOKEN 0
+#define LEFT 1
+#define RIGHT 2
+#define NONASSOC 3
+#define MARK 4
+#define TEXT 5
+#define TYPE 6
+#define START 7
+
+
+/* symbol classes */
+
+#define UNKNOWN 0
+#define TERM 1
+#define NONTERM 2
+
+
+/* the undefined value */
+
+#define UNDEFINED (-1)
+
+
+/* action codes */
+
+#define SHIFT 1
+#define REDUCE 2
+
+
+/* character macros */
+
+#define IS_IDENT(c) (isalnum(c) || (c) == '_' || (c) == '.' || (c) == '$')
+#define IS_OCTAL(c) ((c) >= '0' && (c) <= '7')
+#define NUMERIC_VALUE(c) ((c) - '0')
+
+
+/* symbol macros */
+
+#define ISTOKEN(s) ((s) < start_symbol)
+#define ISVAR(s) ((s) >= start_symbol)
+
+
+/* storage allocation macros */
+
+#define CALLOC(k,n) (calloc((unsigned)(k),(unsigned)(n)))
+#define FREE(x) (free((char*)(x)))
+#define MALLOC(n) (malloc((unsigned)(n)))
+#define NEW(t) ((t*)allocate(sizeof(t)))
+#define NEW2(n,t) ((t*)allocate((unsigned)((n)*sizeof(t))))
+#define REALLOC(p,n) (realloc((char*)(p),(unsigned)(n)))
+
+
+/* the structure of a symbol table entry */
+
+typedef struct bucket bucket;
+struct bucket
+{
+ struct bucket *link;
+ struct bucket *next;
+ char *name;
+ char *tag;
+ short value;
+ short index;
+ short prec;
+ char class;
+ char assoc;
+};
+
+
+/* the structure of the LR(0) state machine */
+
+typedef struct core core;
+struct core
+{
+ struct core *next;
+ struct core *link;
+ short number;
+ short accessing_symbol;
+ short nitems;
+ short items[1];
+};
+
+
+/* the structure used to record shifts */
+
+typedef struct shifts shifts;
+struct shifts
+{
+ struct shifts *next;
+ short number;
+ short nshifts;
+ short shift[1];
+};
+
+
+/* the structure used to store reductions */
+
+typedef struct reductions reductions;
+struct reductions
+{
+ struct reductions *next;
+ short number;
+ short nreds;
+ short rules[1];
+};
+
+
+/* the structure used to represent parser actions */
+
+typedef struct action action;
+struct action
+{
+ struct action *next;
+ short symbol;
+ short number;
+ short prec;
+ char action_code;
+ char assoc;
+ char suppressed;
+};
+
+
+/* global variables */
+
+extern char tflag;
+extern char vflag;
+
+extern char *myname;
+extern char *cptr;
+extern char *line;
+extern int lineno;
+extern int outline;
+
+extern char *action_file_name;
+extern char *input_file_name;
+extern char *prolog_file_name;
+extern char *local_file_name;
+extern char *verbose_file_name;
+
+extern FILE *action_file;
+extern FILE *input_file;
+extern FILE *prolog_file;
+extern FILE *local_file;
+extern FILE *verbose_file;
+
+extern int nitems;
+extern int nrules;
+extern int nsyms;
+extern int ntokens;
+extern int nvars;
+extern int ntags;
+
+extern char *line_format;
+
+extern int start_symbol;
+extern char **symbol_name;
+extern short *symbol_value;
+extern short *symbol_prec;
+extern char *symbol_assoc;
+
+extern short *ritem;
+extern short *rlhs;
+extern short *rrhs;
+extern short *rprec;
+extern char *rassoc;
+
+extern short **derives;
+extern char *nullable;
+
+extern bucket *first_symbol;
+extern bucket *last_symbol;
+
+extern int nstates;
+extern core *first_state;
+extern shifts *first_shift;
+extern reductions *first_reduction;
+extern short *accessing_symbol;
+extern core **state_table;
+extern shifts **shift_table;
+extern reductions **reduction_table;
+extern unsigned *LA;
+extern short *LAruleno;
+extern short *lookaheads;
+extern short *goto_map;
+extern short *from_state;
+extern short *to_state;
+
+extern action **parser;
+extern int SRtotal;
+extern int RRtotal;
+extern short *SRconflicts;
+extern short *RRconflicts;
+extern short *defred;
+extern short *rules_used;
+extern short nunused;
+extern short final_state;
+
+/* global functions */
+
+extern char *allocate();
+extern bucket *lookup();
+extern bucket *make_bucket();
+
+
+/* system variables */
+
+extern int errno;
+
+
+/* system functions */
+
+extern void free();
+extern char *calloc();
+extern char *malloc();
+extern char *realloc();
+extern char *strcpy();
diff --git a/mcs/jay/depend b/mcs/jay/depend
new file mode 100644
index 00000000000..134445ffddd
--- /dev/null
+++ b/mcs/jay/depend
@@ -0,0 +1,11 @@
+closure.o: closure.c defs.h
+error.o: error.c defs.h
+lalr.o: lalr.c defs.h
+lr0.o: lr0.c defs.h
+main.o: main.c defs.h
+mkpar.o: mkpar.c defs.h
+output.o: output.c defs.h
+reader.o: reader.c defs.h
+symtab.o: symtab.c defs.h
+verbose.o: verbose.c defs.h
+warshall.o: warshall.c defs.h
diff --git a/mcs/jay/error.c b/mcs/jay/error.c
new file mode 100644
index 00000000000..dd8bf291c20
--- /dev/null
+++ b/mcs/jay/error.c
@@ -0,0 +1,335 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)error.c 5.3 (Berkeley) 6/1/90";
+#endif /* not lint */
+
+/* routines for printing error messages */
+
+#include "defs.h"
+
+
+fatal(msg)
+char *msg;
+{
+ fprintf(stderr, "%s: f - %s\n", myname, msg);
+ done(2);
+}
+
+
+no_space()
+{
+ fprintf(stderr, "%s: f - out of space\n", myname);
+ done(2);
+}
+
+
+open_error(filename)
+char *filename;
+{
+ fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename);
+ done(2);
+}
+
+
+unexpected_EOF()
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n",
+ myname, lineno, input_file_name);
+ done(1);
+}
+
+
+print_pos(st_line, st_cptr)
+char *st_line;
+char *st_cptr;
+{
+ register char *s;
+
+ if (st_line == 0) return;
+ for (s = st_line; *s != '\n'; ++s)
+ {
+ if (isprint(*s) || *s == '\t')
+ putc(*s, stderr);
+ else
+ putc('?', stderr);
+ }
+ putc('\n', stderr);
+ for (s = st_line; s < st_cptr; ++s)
+ {
+ if (*s == '\t')
+ putc('\t', stderr);
+ else
+ putc(' ', stderr);
+ }
+ putc('^', stderr);
+ putc('\n', stderr);
+}
+
+
+syntax_error(st_lineno, st_line, st_cptr)
+int st_lineno;
+char *st_line;
+char *st_cptr;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", syntax error\n",
+ myname, st_lineno, input_file_name);
+ print_pos(st_line, st_cptr);
+ done(1);
+}
+
+
+unterminated_comment(c_lineno, c_line, c_cptr)
+int c_lineno;
+char *c_line;
+char *c_cptr;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n",
+ myname, c_lineno, input_file_name);
+ print_pos(c_line, c_cptr);
+ done(1);
+}
+
+
+unterminated_string(s_lineno, s_line, s_cptr)
+int s_lineno;
+char *s_line;
+char *s_cptr;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n",
+ myname, s_lineno, input_file_name);
+ print_pos(s_line, s_cptr);
+ done(1);
+}
+
+
+unterminated_text(t_lineno, t_line, t_cptr)
+int t_lineno;
+char *t_line;
+char *t_cptr;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n",
+ myname, t_lineno, input_file_name);
+ print_pos(t_line, t_cptr);
+ done(1);
+}
+
+
+illegal_tag(t_lineno, t_line, t_cptr)
+int t_lineno;
+char *t_line;
+char *t_cptr;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", illegal tag\n",
+ myname, t_lineno, input_file_name);
+ print_pos(t_line, t_cptr);
+ done(1);
+}
+
+
+illegal_character(c_cptr)
+char *c_cptr;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", illegal character\n",
+ myname, lineno, input_file_name);
+ print_pos(line, c_cptr);
+ done(1);
+}
+
+
+used_reserved(s)
+char *s;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", illegal use of reserved symbol \
+%s\n", myname, lineno, input_file_name, s);
+ done(1);
+}
+
+
+tokenized_start(s)
+char *s;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s cannot be \
+declared to be a token\n", myname, lineno, input_file_name, s);
+ done(1);
+}
+
+
+retyped_warning(s)
+char *s;
+{
+ fprintf(stderr, "%s: w - line %d of \"%s\", the type of %s has been \
+redeclared\n", myname, lineno, input_file_name, s);
+}
+
+
+reprec_warning(s)
+char *s;
+{
+ fprintf(stderr, "%s: w - line %d of \"%s\", the precedence of %s has been \
+redeclared\n", myname, lineno, input_file_name, s);
+}
+
+
+revalued_warning(s)
+char *s;
+{
+ fprintf(stderr, "%s: w - line %d of \"%s\", the value of %s has been \
+redeclared\n", myname, lineno, input_file_name, s);
+}
+
+
+terminal_start(s)
+char *s;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s is a \
+token\n", myname, lineno, input_file_name, s);
+ done(1);
+}
+
+
+restarted_warning()
+{
+ fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \
+redeclared\n", myname, lineno, input_file_name);
+}
+
+
+no_grammar()
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \
+specified\n", myname, lineno, input_file_name);
+ done(1);
+}
+
+
+terminal_lhs(s_lineno)
+int s_lineno;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", a token appears on the lhs \
+of a production\n", myname, s_lineno, input_file_name);
+ done(1);
+}
+
+
+prec_redeclared()
+{
+ fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \
+specifiers\n", myname, lineno, input_file_name);
+}
+
+
+unterminated_action(a_lineno, a_line, a_cptr)
+int a_lineno;
+char *a_line;
+char *a_cptr;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n",
+ myname, a_lineno, input_file_name);
+ print_pos(a_line, a_cptr);
+ done(1);
+}
+
+
+dollar_warning(a_lineno, i)
+int a_lineno;
+int i;
+{
+ fprintf(stderr, "%s: w - line %d of \"%s\", $%d references beyond the \
+end of the current rule\n", myname, a_lineno, input_file_name, i);
+}
+
+
+dollar_error(a_lineno, a_line, a_cptr)
+int a_lineno;
+char *a_line;
+char *a_cptr;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", illegal $-name\n",
+ myname, a_lineno, input_file_name);
+ print_pos(a_line, a_cptr);
+ done(1);
+}
+
+
+untyped_lhs()
+{
+ fprintf(stderr, "%s: w - line %d of \"%s\", $$ is untyped\n",
+ myname, lineno, input_file_name);
+ /** done(1); */
+}
+
+
+untyped_rhs(i, s)
+int i;
+char *s;
+{
+ fprintf(stderr, "%s: w - line %d of \"%s\", $%d (%s) is untyped\n",
+ myname, lineno, input_file_name, i, s);
+ /** done(1); */
+}
+
+
+unknown_rhs(i)
+int i;
+{
+ fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n",
+ myname, lineno, input_file_name, i);
+ done(1);
+}
+
+
+default_action_warning()
+{
+ fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \
+undefined value to $$\n", myname, lineno, input_file_name);
+}
+
+
+undefined_goal(s)
+char *s;
+{
+ fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s);
+ done(1);
+}
+
+
+undefined_symbol_warning(s)
+char *s;
+{
+ fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s);
+}
diff --git a/mcs/jay/jay.1 b/mcs/jay/jay.1
new file mode 100644
index 00000000000..85040fd5694
--- /dev/null
+++ b/mcs/jay/jay.1
@@ -0,0 +1,120 @@
+.\" Copyright (c) 1989, 1990 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Robert Paul Corbett.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)yacc.1 5.8 (Berkeley) 5/24/93
+.\"
+.TH JAY 1 "May 24, 1993 / July 8, 1998"
+.UC 6
+.SH NAME
+jay \- an LALR(1) parser generator for Java and C#
+.SH SYNOPSIS
+.B jay [ -tv ] [ -c ] [ -b
+.I file_prefix
+.B ] [ -V
+.I yyValue
+.B ]
+.I filename
+.B <
+.I skeleton
+.SH DESCRIPTION
+.I Jay
+reads the grammar specification in the file
+.I filename
+and generates an LR(1) parser for it.
+The parsers consist of a set of LALR(1) parsing tables and a driver routine
+from the file
+.I skeleton
+written in the Java programming language.
+.I Jay
+writes the parse tables and the driver routine to standard output.
+.PP
+The following options are available:
+.RS
+.TP
+\fB-b \fIfile_prefix\fR
+The
+.B -b
+option changes the prefix prepended to the output file names to
+the string denoted by
+.IR file_prefix.
+The default prefix is the character
+.IR y.
+.TP
+.B -c
+The
+.B -c
+option makes jay generate C# code instead of the default Java.
+.TP
+.B -t
+The
+.B -t
+option arranges for
+debugging information to be incorporated in the compiled code.
+.TP
+.B -v
+The
+.B -v
+option causes a human-readable description of the generated parser to
+be written to the file
+.IR y.output.
+.RE
+.PP
+If the environment variable TMPDIR is set, the string denoted by
+TMPDIR will be used as the name of the directory where the temporary
+files are created.
+.SH FILES
+.IR skeleton
+.br
+.IR y.output
+.br
+.IR /tmp/yacc.aXXXXXX
+.br
+.IR /tmp/yacc.tXXXXXX
+.br
+.IR /tmp/yacc.uXXXXXX
+.SH DIAGNOSTICS
+If there are rules that are never reduced, the number of such rules is
+reported on standard error.
+If there are any LALR(1) conflicts, the number of conflicts is reported
+on standard error.
+.SH HISTORY
+.I Jay
+is derived from Berkeley
+.I yacc .
+Input conventions closely follow those of
+.I yacc ;
+for details,
+consult the parser
+.I skeleton
+file and the commented example included with the sources.
diff --git a/mcs/jay/lalr.c b/mcs/jay/lalr.c
new file mode 100644
index 00000000000..bf9aec846b7
--- /dev/null
+++ b/mcs/jay/lalr.c
@@ -0,0 +1,678 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)lalr.c 5.3 (Berkeley) 6/1/90";
+#endif /* not lint */
+
+#include "defs.h"
+
+typedef
+ struct shorts
+ {
+ struct shorts *next;
+ short value;
+ }
+ shorts;
+
+int tokensetsize;
+short *lookaheads;
+short *LAruleno;
+unsigned *LA;
+short *accessing_symbol;
+core **state_table;
+shifts **shift_table;
+reductions **reduction_table;
+short *goto_map;
+short *from_state;
+short *to_state;
+
+short **transpose();
+
+static int infinity;
+static int maxrhs;
+static int ngotos;
+static unsigned *F;
+static short **includes;
+static shorts **lookback;
+static short **R;
+static short *INDEX;
+static short *VERTICES;
+static int top;
+
+
+lalr()
+{
+ tokensetsize = WORDSIZE(ntokens);
+
+ set_state_table();
+ set_accessing_symbol();
+ set_shift_table();
+ set_reduction_table();
+ set_maxrhs();
+ initialize_LA();
+ set_goto_map();
+ initialize_F();
+ build_relations();
+ compute_FOLLOWS();
+ compute_lookaheads();
+}
+
+
+
+set_state_table()
+{
+ register core *sp;
+
+ state_table = NEW2(nstates, core *);
+ for (sp = first_state; sp; sp = sp->next)
+ state_table[sp->number] = sp;
+}
+
+
+
+set_accessing_symbol()
+{
+ register core *sp;
+
+ accessing_symbol = NEW2(nstates, short);
+ for (sp = first_state; sp; sp = sp->next)
+ accessing_symbol[sp->number] = sp->accessing_symbol;
+}
+
+
+
+set_shift_table()
+{
+ register shifts *sp;
+
+ shift_table = NEW2(nstates, shifts *);
+ for (sp = first_shift; sp; sp = sp->next)
+ shift_table[sp->number] = sp;
+}
+
+
+
+set_reduction_table()
+{
+ register reductions *rp;
+
+ reduction_table = NEW2(nstates, reductions *);
+ for (rp = first_reduction; rp; rp = rp->next)
+ reduction_table[rp->number] = rp;
+}
+
+
+
+set_maxrhs()
+{
+ register short *itemp;
+ register short *item_end;
+ register int length;
+ register int max;
+
+ length = 0;
+ max = 0;
+ item_end = ritem + nitems;
+ for (itemp = ritem; itemp < item_end; itemp++)
+ {
+ if (*itemp >= 0)
+ {
+ length++;
+ }
+ else
+ {
+ if (length > max) max = length;
+ length = 0;
+ }
+ }
+
+ maxrhs = max;
+}
+
+
+
+initialize_LA()
+{
+ register int i, j, k;
+ register reductions *rp;
+
+ lookaheads = NEW2(nstates + 1, short);
+
+ k = 0;
+ for (i = 0; i < nstates; i++)
+ {
+ lookaheads[i] = k;
+ rp = reduction_table[i];
+ if (rp)
+ k += rp->nreds;
+ }
+ lookaheads[nstates] = k;
+
+ LA = NEW2(k * tokensetsize, unsigned);
+ LAruleno = NEW2(k, short);
+ lookback = NEW2(k, shorts *);
+
+ k = 0;
+ for (i = 0; i < nstates; i++)
+ {
+ rp = reduction_table[i];
+ if (rp)
+ {
+ for (j = 0; j < rp->nreds; j++)
+ {
+ LAruleno[k] = rp->rules[j];
+ k++;
+ }
+ }
+ }
+}
+
+
+set_goto_map()
+{
+ register shifts *sp;
+ register int i;
+ register int symbol;
+ register int k;
+ register short *temp_map;
+ register int state2;
+ register int state1;
+
+ goto_map = NEW2(nvars + 1, short) - ntokens;
+ temp_map = NEW2(nvars + 1, short) - ntokens;
+
+ ngotos = 0;
+ for (sp = first_shift; sp; sp = sp->next)
+ {
+ for (i = sp->nshifts - 1; i >= 0; i--)
+ {
+ symbol = accessing_symbol[sp->shift[i]];
+
+ if (ISTOKEN(symbol)) break;
+
+ if (ngotos == MAXSHORT)
+ fatal("too many gotos");
+
+ ngotos++;
+ goto_map[symbol]++;
+ }
+ }
+
+ k = 0;
+ for (i = ntokens; i < nsyms; i++)
+ {
+ temp_map[i] = k;
+ k += goto_map[i];
+ }
+
+ for (i = ntokens; i < nsyms; i++)
+ goto_map[i] = temp_map[i];
+
+ goto_map[nsyms] = ngotos;
+ temp_map[nsyms] = ngotos;
+
+ from_state = NEW2(ngotos, short);
+ to_state = NEW2(ngotos, short);
+
+ for (sp = first_shift; sp; sp = sp->next)
+ {
+ state1 = sp->number;
+ for (i = sp->nshifts - 1; i >= 0; i--)
+ {
+ state2 = sp->shift[i];
+ symbol = accessing_symbol[state2];
+
+ if (ISTOKEN(symbol)) break;
+
+ k = temp_map[symbol]++;
+ from_state[k] = state1;
+ to_state[k] = state2;
+ }
+ }
+
+ FREE(temp_map + ntokens);
+}
+
+
+
+/* Map_goto maps a state/symbol pair into its numeric representation. */
+
+int
+map_goto(state, symbol)
+int state;
+int symbol;
+{
+ register int high;
+ register int low;
+ register int middle;
+ register int s;
+
+ low = goto_map[symbol];
+ high = goto_map[symbol + 1];
+
+ for (;;)
+ {
+ assert(low <= high);
+ middle = (low + high) >> 1;
+ s = from_state[middle];
+ if (s == state)
+ return (middle);
+ else if (s < state)
+ low = middle + 1;
+ else
+ high = middle - 1;
+ }
+}
+
+
+
+initialize_F()
+{
+ register int i;
+ register int j;
+ register int k;
+ register shifts *sp;
+ register short *edge;
+ register unsigned *rowp;
+ register short *rp;
+ register short **reads;
+ register int nedges;
+ register int stateno;
+ register int symbol;
+ register int nwords;
+
+ nwords = ngotos * tokensetsize;
+ F = NEW2(nwords, unsigned);
+
+ reads = NEW2(ngotos, short *);
+ edge = NEW2(ngotos + 1, short);
+ nedges = 0;
+
+ rowp = F;
+ for (i = 0; i < ngotos; i++)
+ {
+ stateno = to_state[i];
+ sp = shift_table[stateno];
+
+ if (sp)
+ {
+ k = sp->nshifts;
+
+ for (j = 0; j < k; j++)
+ {
+ symbol = accessing_symbol[sp->shift[j]];
+ if (ISVAR(symbol))
+ break;
+ SETBIT(rowp, symbol);
+ }
+
+ for (; j < k; j++)
+ {
+ symbol = accessing_symbol[sp->shift[j]];
+ if (nullable[symbol])
+ edge[nedges++] = map_goto(stateno, symbol);
+ }
+
+ if (nedges)
+ {
+ reads[i] = rp = NEW2(nedges + 1, short);
+
+ for (j = 0; j < nedges; j++)
+ rp[j] = edge[j];
+
+ rp[nedges] = -1;
+ nedges = 0;
+ }
+ }
+
+ rowp += tokensetsize;
+ }
+
+ SETBIT(F, 0);
+ digraph(reads);
+
+ for (i = 0; i < ngotos; i++)
+ {
+ if (reads[i])
+ FREE(reads[i]);
+ }
+
+ FREE(reads);
+ FREE(edge);
+}
+
+
+
+build_relations()
+{
+ register int i;
+ register int j;
+ register int k;
+ register short *rulep;
+ register short *rp;
+ register shifts *sp;
+ register int length;
+ register int nedges;
+ register int done;
+ register int state1;
+ register int stateno;
+ register int symbol1;
+ register int symbol2;
+ register short *shortp;
+ register short *edge;
+ register short *states;
+ register short **new_includes;
+
+ includes = NEW2(ngotos, short *);
+ edge = NEW2(ngotos + 1, short);
+ states = NEW2(maxrhs + 1, short);
+
+ for (i = 0; i < ngotos; i++)
+ {
+ nedges = 0;
+ state1 = from_state[i];
+ symbol1 = accessing_symbol[to_state[i]];
+
+ for (rulep = derives[symbol1]; *rulep >= 0; rulep++)
+ {
+ length = 1;
+ states[0] = state1;
+ stateno = state1;
+
+ for (rp = ritem + rrhs[*rulep]; *rp >= 0; rp++)
+ {
+ symbol2 = *rp;
+ sp = shift_table[stateno];
+ k = sp->nshifts;
+
+ for (j = 0; j < k; j++)
+ {
+ stateno = sp->shift[j];
+ if (accessing_symbol[stateno] == symbol2) break;
+ }
+
+ states[length++] = stateno;
+ }
+
+ add_lookback_edge(stateno, *rulep, i);
+
+ length--;
+ done = 0;
+ while (!done)
+ {
+ done = 1;
+ rp--;
+ if (ISVAR(*rp))
+ {
+ stateno = states[--length];
+ edge[nedges++] = map_goto(stateno, *rp);
+ if (nullable[*rp] && length > 0) done = 0;
+ }
+ }
+ }
+
+ if (nedges)
+ {
+ includes[i] = shortp = NEW2(nedges + 1, short);
+ for (j = 0; j < nedges; j++)
+ shortp[j] = edge[j];
+ shortp[nedges] = -1;
+ }
+ }
+
+ new_includes = transpose(includes, ngotos);
+
+ for (i = 0; i < ngotos; i++)
+ if (includes[i])
+ FREE(includes[i]);
+
+ FREE(includes);
+
+ includes = new_includes;
+
+ FREE(edge);
+ FREE(states);
+}
+
+
+add_lookback_edge(stateno, ruleno, gotono)
+int stateno, ruleno, gotono;
+{
+ register int i, k;
+ register int found;
+ register shorts *sp;
+
+ i = lookaheads[stateno];
+ k = lookaheads[stateno + 1];
+ found = 0;
+ while (!found && i < k)
+ {
+ if (LAruleno[i] == ruleno)
+ found = 1;
+ else
+ ++i;
+ }
+ assert(found);
+
+ sp = NEW(shorts);
+ sp->next = lookback[i];
+ sp->value = gotono;
+ lookback[i] = sp;
+}
+
+
+
+short **
+transpose(R, n)
+short **R;
+int n;
+{
+ register short **new_R;
+ register short **temp_R;
+ register short *nedges;
+ register short *sp;
+ register int i;
+ register int k;
+
+ nedges = NEW2(n, short);
+
+ for (i = 0; i < n; i++)
+ {
+ sp = R[i];
+ if (sp)
+ {
+ while (*sp >= 0)
+ nedges[*sp++]++;
+ }
+ }
+
+ new_R = NEW2(n, short *);
+ temp_R = NEW2(n, short *);
+
+ for (i = 0; i < n; i++)
+ {
+ k = nedges[i];
+ if (k > 0)
+ {
+ sp = NEW2(k + 1, short);
+ new_R[i] = sp;
+ temp_R[i] = sp;
+ sp[k] = -1;
+ }
+ }
+
+ FREE(nedges);
+
+ for (i = 0; i < n; i++)
+ {
+ sp = R[i];
+ if (sp)
+ {
+ while (*sp >= 0)
+ *temp_R[*sp++]++ = i;
+ }
+ }
+
+ FREE(temp_R);
+
+ return (new_R);
+}
+
+
+
+compute_FOLLOWS()
+{
+ digraph(includes);
+}
+
+
+compute_lookaheads()
+{
+ register int i, n;
+ register unsigned *fp1, *fp2, *fp3;
+ register shorts *sp, *next;
+ register unsigned *rowp;
+
+ rowp = LA;
+ n = lookaheads[nstates];
+ for (i = 0; i < n; i++)
+ {
+ fp3 = rowp + tokensetsize;
+ for (sp = lookback[i]; sp; sp = sp->next)
+ {
+ fp1 = rowp;
+ fp2 = F + tokensetsize * sp->value;
+ while (fp1 < fp3)
+ *fp1++ |= *fp2++;
+ }
+ rowp = fp3;
+ }
+
+ for (i = 0; i < n; i++)
+ for (sp = lookback[i]; sp; sp = next)
+ {
+ next = sp->next;
+ FREE(sp);
+ }
+
+ FREE(lookback);
+ FREE(F);
+}
+
+
+digraph(relation)
+short **relation;
+{
+ register int i;
+
+ infinity = ngotos + 2;
+ INDEX = NEW2(ngotos + 1, short);
+ VERTICES = NEW2(ngotos + 1, short);
+ top = 0;
+
+ R = relation;
+
+ for (i = 0; i < ngotos; i++)
+ INDEX[i] = 0;
+
+ for (i = 0; i < ngotos; i++)
+ {
+ if (INDEX[i] == 0 && R[i])
+ traverse(i);
+ }
+
+ FREE(INDEX);
+ FREE(VERTICES);
+}
+
+
+
+traverse(i)
+register int i;
+{
+ register unsigned *fp1;
+ register unsigned *fp2;
+ register unsigned *fp3;
+ register int j;
+ register short *rp;
+
+ int height;
+ unsigned *base;
+
+ VERTICES[++top] = i;
+ INDEX[i] = height = top;
+
+ base = F + i * tokensetsize;
+ fp3 = base + tokensetsize;
+
+ rp = R[i];
+ if (rp)
+ {
+ while ((j = *rp++) >= 0)
+ {
+ if (INDEX[j] == 0)
+ traverse(j);
+
+ if (INDEX[i] > INDEX[j])
+ INDEX[i] = INDEX[j];
+
+ fp1 = base;
+ fp2 = F + j * tokensetsize;
+
+ while (fp1 < fp3)
+ *fp1++ |= *fp2++;
+ }
+ }
+
+ if (INDEX[i] == height)
+ {
+ for (;;)
+ {
+ j = VERTICES[top--];
+ INDEX[j] = infinity;
+
+ if (i == j)
+ break;
+
+ fp1 = base;
+ fp2 = F + j * tokensetsize;
+
+ while (fp1 < fp3)
+ *fp2++ = *fp1++;
+ }
+ }
+}
diff --git a/mcs/jay/lr0.c b/mcs/jay/lr0.c
new file mode 100644
index 00000000000..43106ea6cf3
--- /dev/null
+++ b/mcs/jay/lr0.c
@@ -0,0 +1,637 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)lr0.c 5.3 (Berkeley) 1/20/91";
+#endif /* not lint */
+
+#include "defs.h"
+
+extern short *itemset;
+extern short *itemsetend;
+extern unsigned *ruleset;
+
+int nstates;
+core *first_state;
+shifts *first_shift;
+reductions *first_reduction;
+
+int get_state();
+core *new_state();
+
+static core **state_set;
+static core *this_state;
+static core *last_state;
+static shifts *last_shift;
+static reductions *last_reduction;
+
+static int nshifts;
+static short *shift_symbol;
+
+static short *redset;
+static short *shiftset;
+
+static short **kernel_base;
+static short **kernel_end;
+static short *kernel_items;
+
+
+allocate_itemsets()
+{
+ register short *itemp;
+ register short *item_end;
+ register int symbol;
+ register int i;
+ register int count;
+ register int max;
+ register short *symbol_count;
+
+ count = 0;
+ symbol_count = NEW2(nsyms, short);
+
+ item_end = ritem + nitems;
+ for (itemp = ritem; itemp < item_end; itemp++)
+ {
+ symbol = *itemp;
+ if (symbol >= 0)
+ {
+ count++;
+ symbol_count[symbol]++;
+ }
+ }
+
+ kernel_base = NEW2(nsyms, short *);
+ kernel_items = NEW2(count, short);
+
+ count = 0;
+ max = 0;
+ for (i = 0; i < nsyms; i++)
+ {
+ kernel_base[i] = kernel_items + count;
+ count += symbol_count[i];
+ if (max < symbol_count[i])
+ max = symbol_count[i];
+ }
+
+ shift_symbol = symbol_count;
+ kernel_end = NEW2(nsyms, short *);
+}
+
+
+allocate_storage()
+{
+ allocate_itemsets();
+ shiftset = NEW2(nsyms, short);
+ redset = NEW2(nrules + 1, short);
+ state_set = NEW2(nitems, core *);
+}
+
+
+append_states()
+{
+ register int i;
+ register int j;
+ register int symbol;
+
+#ifdef TRACE
+ fprintf(stderr, "Entering append_states()\n");
+#endif
+ for (i = 1; i < nshifts; i++)
+ {
+ symbol = shift_symbol[i];
+ j = i;
+ while (j > 0 && shift_symbol[j - 1] > symbol)
+ {
+ shift_symbol[j] = shift_symbol[j - 1];
+ j--;
+ }
+ shift_symbol[j] = symbol;
+ }
+
+ for (i = 0; i < nshifts; i++)
+ {
+ symbol = shift_symbol[i];
+ shiftset[i] = get_state(symbol);
+ }
+}
+
+
+free_storage()
+{
+ FREE(shift_symbol);
+ FREE(redset);
+ FREE(shiftset);
+ FREE(kernel_base);
+ FREE(kernel_end);
+ FREE(kernel_items);
+ FREE(state_set);
+}
+
+
+
+generate_states()
+{
+ allocate_storage();
+ itemset = NEW2(nitems, short);
+ ruleset = NEW2(WORDSIZE(nrules), unsigned);
+ set_first_derives();
+ initialize_states();
+
+ while (this_state)
+ {
+ closure(this_state->items, this_state->nitems);
+ save_reductions();
+ new_itemsets();
+ append_states();
+
+ if (nshifts > 0)
+ save_shifts();
+
+ this_state = this_state->next;
+ }
+
+ finalize_closure();
+ free_storage();
+}
+
+
+
+int
+get_state(symbol)
+int symbol;
+{
+ register int key;
+ register short *isp1;
+ register short *isp2;
+ register short *iend;
+ register core *sp;
+ register int found;
+ register int n;
+
+#ifdef TRACE
+ fprintf(stderr, "Entering get_state(%d)\n", symbol);
+#endif
+
+ isp1 = kernel_base[symbol];
+ iend = kernel_end[symbol];
+ n = iend - isp1;
+
+ key = *isp1;
+ assert(0 <= key && key < nitems);
+ sp = state_set[key];
+ if (sp)
+ {
+ found = 0;
+ while (!found)
+ {
+ if (sp->nitems == n)
+ {
+ found = 1;
+ isp1 = kernel_base[symbol];
+ isp2 = sp->items;
+
+ while (found && isp1 < iend)
+ {
+ if (*isp1++ != *isp2++)
+ found = 0;
+ }
+ }
+
+ if (!found)
+ {
+ if (sp->link)
+ {
+ sp = sp->link;
+ }
+ else
+ {
+ sp = sp->link = new_state(symbol);
+ found = 1;
+ }
+ }
+ }
+ }
+ else
+ {
+ state_set[key] = sp = new_state(symbol);
+ }
+
+ return (sp->number);
+}
+
+
+
+initialize_states()
+{
+ register int i;
+ register short *start_derives;
+ register core *p;
+
+ start_derives = derives[start_symbol];
+ for (i = 0; start_derives[i] >= 0; ++i)
+ continue;
+
+ p = (core *) MALLOC(sizeof(core) + i*sizeof(short));
+ if (p == 0) no_space();
+
+ p->next = 0;
+ p->link = 0;
+ p->number = 0;
+ p->accessing_symbol = 0;
+ p->nitems = i;
+
+ for (i = 0; start_derives[i] >= 0; ++i)
+ p->items[i] = rrhs[start_derives[i]];
+
+ first_state = last_state = this_state = p;
+ nstates = 1;
+}
+
+
+new_itemsets()
+{
+ register int i;
+ register int shiftcount;
+ register short *isp;
+ register short *ksp;
+ register int symbol;
+
+ for (i = 0; i < nsyms; i++)
+ kernel_end[i] = 0;
+
+ shiftcount = 0;
+ isp = itemset;
+ while (isp < itemsetend)
+ {
+ i = *isp++;
+ symbol = ritem[i];
+ if (symbol > 0)
+ {
+ ksp = kernel_end[symbol];
+ if (!ksp)
+ {
+ shift_symbol[shiftcount++] = symbol;
+ ksp = kernel_base[symbol];
+ }
+
+ *ksp++ = i + 1;
+ kernel_end[symbol] = ksp;
+ }
+ }
+
+ nshifts = shiftcount;
+}
+
+
+
+core *
+new_state(symbol)
+int symbol;
+{
+ register int n;
+ register core *p;
+ register short *isp1;
+ register short *isp2;
+ register short *iend;
+
+#ifdef TRACE
+ fprintf(stderr, "Entering new_state(%d)\n", symbol);
+#endif
+
+ if (nstates >= MAXSHORT)
+ fatal("too many states");
+
+ isp1 = kernel_base[symbol];
+ iend = kernel_end[symbol];
+ n = iend - isp1;
+
+ p = (core *) allocate((unsigned) (sizeof(core) + (n - 1) * sizeof(short)));
+ p->accessing_symbol = symbol;
+ p->number = nstates;
+ p->nitems = n;
+
+ isp2 = p->items;
+ while (isp1 < iend)
+ *isp2++ = *isp1++;
+
+ last_state->next = p;
+ last_state = p;
+
+ nstates++;
+
+ return (p);
+}
+
+
+/* show_cores is used for debugging */
+
+show_cores()
+{
+ core *p;
+ int i, j, k, n;
+ int itemno;
+
+ k = 0;
+ for (p = first_state; p; ++k, p = p->next)
+ {
+ if (k) printf("\n");
+ printf("state %d, number = %d, accessing symbol = %s\n",
+ k, p->number, symbol_name[p->accessing_symbol]);
+ n = p->nitems;
+ for (i = 0; i < n; ++i)
+ {
+ itemno = p->items[i];
+ printf("%4d ", itemno);
+ j = itemno;
+ while (ritem[j] >= 0) ++j;
+ printf("%s :", symbol_name[rlhs[-ritem[j]]]);
+ j = rrhs[-ritem[j]];
+ while (j < itemno)
+ printf(" %s", symbol_name[ritem[j++]]);
+ printf(" .");
+ while (ritem[j] >= 0)
+ printf(" %s", symbol_name[ritem[j++]]);
+ printf("\n");
+ fflush(stdout);
+ }
+ }
+}
+
+
+/* show_ritems is used for debugging */
+
+show_ritems()
+{
+ int i;
+
+ for (i = 0; i < nitems; ++i)
+ printf("ritem[%d] = %d\n", i, ritem[i]);
+}
+
+
+/* show_rrhs is used for debugging */
+show_rrhs()
+{
+ int i;
+
+ for (i = 0; i < nrules; ++i)
+ printf("rrhs[%d] = %d\n", i, rrhs[i]);
+}
+
+
+/* show_shifts is used for debugging */
+
+show_shifts()
+{
+ shifts *p;
+ int i, j, k;
+
+ k = 0;
+ for (p = first_shift; p; ++k, p = p->next)
+ {
+ if (k) printf("\n");
+ printf("shift %d, number = %d, nshifts = %d\n", k, p->number,
+ p->nshifts);
+ j = p->nshifts;
+ for (i = 0; i < j; ++i)
+ printf("\t%d\n", p->shift[i]);
+ }
+}
+
+
+save_shifts()
+{
+ register shifts *p;
+ register short *sp1;
+ register short *sp2;
+ register short *send;
+
+ p = (shifts *) allocate((unsigned) (sizeof(shifts) +
+ (nshifts - 1) * sizeof(short)));
+
+ p->number = this_state->number;
+ p->nshifts = nshifts;
+
+ sp1 = shiftset;
+ sp2 = p->shift;
+ send = shiftset + nshifts;
+
+ while (sp1 < send)
+ *sp2++ = *sp1++;
+
+ if (last_shift)
+ {
+ last_shift->next = p;
+ last_shift = p;
+ }
+ else
+ {
+ first_shift = p;
+ last_shift = p;
+ }
+}
+
+
+
+save_reductions()
+{
+ register short *isp;
+ register short *rp1;
+ register short *rp2;
+ register int item;
+ register int count;
+ register reductions *p;
+ register short *rend;
+
+ count = 0;
+ for (isp = itemset; isp < itemsetend; isp++)
+ {
+ item = ritem[*isp];
+ if (item < 0)
+ {
+ redset[count++] = -item;
+ }
+ }
+
+ if (count)
+ {
+ p = (reductions *) allocate((unsigned) (sizeof(reductions) +
+ (count - 1) * sizeof(short)));
+
+ p->number = this_state->number;
+ p->nreds = count;
+
+ rp1 = redset;
+ rp2 = p->rules;
+ rend = rp1 + count;
+
+ while (rp1 < rend)
+ *rp2++ = *rp1++;
+
+ if (last_reduction)
+ {
+ last_reduction->next = p;
+ last_reduction = p;
+ }
+ else
+ {
+ first_reduction = p;
+ last_reduction = p;
+ }
+ }
+}
+
+
+set_derives()
+{
+ register int i, k;
+ register int lhs;
+ register short *rules;
+
+ derives = NEW2(nsyms, short *);
+ rules = NEW2(nvars + nrules, short);
+
+ k = 0;
+ for (lhs = start_symbol; lhs < nsyms; lhs++)
+ {
+ derives[lhs] = rules + k;
+ for (i = 0; i < nrules; i++)
+ {
+ if (rlhs[i] == lhs)
+ {
+ rules[k] = i;
+ k++;
+ }
+ }
+ rules[k] = -1;
+ k++;
+ }
+
+#ifdef DEBUG
+ print_derives();
+#endif
+}
+
+free_derives()
+{
+ FREE(derives[start_symbol]);
+ FREE(derives);
+}
+
+#ifdef DEBUG
+print_derives()
+{
+ register int i;
+ register short *sp;
+
+ printf("\nDERIVES\n\n");
+
+ for (i = start_symbol; i < nsyms; i++)
+ {
+ printf("%s derives ", symbol_name[i]);
+ for (sp = derives[i]; *sp >= 0; sp++)
+ {
+ printf(" %d", *sp);
+ }
+ putchar('\n');
+ }
+
+ putchar('\n');
+}
+#endif
+
+
+set_nullable()
+{
+ register int i, j;
+ register int empty;
+ int done;
+
+ nullable = MALLOC(nsyms);
+ if (nullable == 0) no_space();
+
+ for (i = 0; i < nsyms; ++i)
+ nullable[i] = 0;
+
+ done = 0;
+ while (!done)
+ {
+ done = 1;
+ for (i = 1; i < nitems; i++)
+ {
+ empty = 1;
+ while ((j = ritem[i]) >= 0)
+ {
+ if (!nullable[j])
+ empty = 0;
+ ++i;
+ }
+ if (empty)
+ {
+ j = rlhs[-j];
+ if (!nullable[j])
+ {
+ nullable[j] = 1;
+ done = 0;
+ }
+ }
+ }
+ }
+
+#ifdef DEBUG
+ for (i = 0; i < nsyms; i++)
+ {
+ if (nullable[i])
+ printf("%s is nullable\n", symbol_name[i]);
+ else
+ printf("%s is not nullable\n", symbol_name[i]);
+ }
+#endif
+}
+
+
+free_nullable()
+{
+ FREE(nullable);
+}
+
+
+lr0()
+{
+ set_derives();
+ set_nullable();
+ generate_states();
+}
diff --git a/mcs/jay/main.c b/mcs/jay/main.c
new file mode 100644
index 00000000000..c6954eb9285
--- /dev/null
+++ b/mcs/jay/main.c
@@ -0,0 +1,341 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1989 The Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)main.c 5.5 (Berkeley) 5/24/93";
+#endif /* not lint */
+
+#include <signal.h>
+#include "defs.h"
+
+char tflag;
+char vflag;
+char csharp = 0;
+
+char *file_prefix = "y";
+char *myname = "yacc";
+char *temp_form = "yacc.XXXXXXX";
+
+int lineno;
+int outline;
+
+char *action_file_name;
+char *input_file_name = "";
+char *prolog_file_name;
+char *local_file_name;
+char *verbose_file_name;
+
+FILE *action_file; /* a temp file, used to save actions associated */
+ /* with rules until the parser is written */
+FILE *input_file; /* the input file */
+FILE *prolog_file; /* temp files, used to save text until all */
+FILE *local_file; /* symbols have been defined */
+FILE *verbose_file; /* y.output */
+
+int nitems;
+int nrules;
+int nsyms;
+int ntokens;
+int nvars;
+
+int start_symbol;
+char **symbol_name;
+short *symbol_value;
+short *symbol_prec;
+char *symbol_assoc;
+
+short *ritem;
+short *rlhs;
+short *rrhs;
+short *rprec;
+char *rassoc;
+short **derives;
+char *nullable;
+
+extern char *mktemp();
+extern char *getenv();
+
+done(k)
+int k;
+{
+ if (action_file) { fclose(action_file); unlink(action_file_name); }
+ if (prolog_file) { fclose(prolog_file); unlink(prolog_file_name); }
+ if (local_file) { fclose(local_file); unlink(local_file_name); }
+ exit(k);
+}
+
+
+void
+onintr(signo)
+ int signo;
+{
+ done(1);
+}
+
+
+set_signals()
+{
+#ifdef SIGINT
+ if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+ signal(SIGINT, onintr);
+#endif
+#ifdef SIGTERM
+ if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
+ signal(SIGTERM, onintr);
+#endif
+#ifdef SIGHUP
+ if (signal(SIGHUP, SIG_IGN) != SIG_IGN)
+ signal(SIGHUP, onintr);
+#endif
+}
+
+
+usage()
+{
+ fprintf(stderr, "usage: %s [-tvc] [-b file_prefix] filename\n", myname);
+ exit(1);
+}
+
+
+getargs(argc, argv)
+int argc;
+char *argv[];
+{
+ register int i;
+ register char *s;
+
+ if (argc > 0) myname = argv[0];
+ for (i = 1; i < argc; ++i)
+ {
+ s = argv[i];
+ if (*s != '-') break;
+ switch (*++s)
+ {
+ case '\0':
+ input_file = stdin;
+ if (i + 1 < argc) usage();
+ return;
+
+ case '-':
+ ++i;
+ goto no_more_options;
+
+ case 'b':
+ if (*++s)
+ file_prefix = s;
+ else if (++i < argc)
+ file_prefix = argv[i];
+ else
+ usage();
+ continue;
+
+ case 't':
+ tflag = 1;
+ break;
+
+ case 'c':
+ csharp = 1;
+ line_format = "#line %d \"%s\"\n";
+ break;
+
+ case 'v':
+ vflag = 1;
+ break;
+
+ default:
+ usage();
+ }
+
+ for (;;)
+ {
+ switch (*++s)
+ {
+ case '\0':
+ goto end_of_option;
+
+ case 't':
+ tflag = 1;
+ break;
+
+ case 'v':
+ vflag = 1;
+ break;
+
+ case 'c':
+ csharp = 1;
+ break;
+
+ default:
+ usage();
+ }
+ }
+end_of_option:;
+ }
+
+no_more_options:;
+ if (i + 1 != argc) usage();
+ input_file_name = argv[i];
+}
+
+
+char *
+allocate(n)
+unsigned n;
+{
+ register char *p;
+
+ p = NULL;
+ if (n)
+ {
+ p = CALLOC(1, n);
+ if (!p) no_space();
+ }
+ return (p);
+}
+
+
+create_file_names()
+{
+ int i, len;
+ char *tmpdir;
+
+ tmpdir = getenv("TMPDIR");
+ if (tmpdir == 0) tmpdir = "/tmp";
+
+ len = strlen(tmpdir);
+ i = len + 13;
+ if (len && tmpdir[len-1] != '/')
+ ++i;
+
+ action_file_name = MALLOC(i);
+ if (action_file_name == 0) no_space();
+ prolog_file_name = MALLOC(i);
+ if (prolog_file_name == 0) no_space();
+ local_file_name = MALLOC(i);
+ if (local_file_name == 0) no_space();
+
+ strcpy(action_file_name, tmpdir);
+ strcpy(prolog_file_name, tmpdir);
+ strcpy(local_file_name, tmpdir);
+
+ if (len && tmpdir[len - 1] != '/')
+ {
+ action_file_name[len] = '/';
+ prolog_file_name[len] = '/';
+ local_file_name[len] = '/';
+ ++len;
+ }
+
+ strcpy(action_file_name + len, temp_form);
+ strcpy(prolog_file_name + len, temp_form);
+ strcpy(local_file_name + len, temp_form);
+
+ action_file_name[len + 5] = 'a';
+ prolog_file_name[len + 5] = 'p';
+ local_file_name[len + 5] = 'l';
+
+ mktemp(action_file_name);
+ mktemp(prolog_file_name);
+ mktemp(local_file_name);
+
+ len = strlen(file_prefix);
+
+ if (vflag)
+ {
+ verbose_file_name = MALLOC(len + 8);
+ if (verbose_file_name == 0)
+ no_space();
+ strcpy(verbose_file_name, file_prefix);
+ strcpy(verbose_file_name + len, VERBOSE_SUFFIX);
+ }
+}
+
+
+open_files()
+{
+ create_file_names();
+
+ if (input_file == 0)
+ {
+ input_file = fopen(input_file_name, "r");
+ if (input_file == 0)
+ open_error(input_file_name);
+ }
+
+ action_file = fopen(action_file_name, "w");
+ if (action_file == 0)
+ open_error(action_file_name);
+
+ prolog_file = fopen(prolog_file_name, "w");
+ if (prolog_file == 0)
+ open_error(prolog_file_name);
+
+ local_file = fopen(local_file_name, "w");
+ if (local_file == 0)
+ open_error(local_file_name);
+
+ if (vflag)
+ {
+ verbose_file = fopen(verbose_file_name, "w");
+ if (verbose_file == 0)
+ open_error(verbose_file_name);
+ }
+}
+
+
+int
+main(argc, argv)
+int argc;
+char *argv[];
+{
+ set_signals();
+ getargs(argc, argv);
+ open_files();
+ reader();
+ lr0();
+ lalr();
+ make_parser();
+ verbose();
+ output();
+ done(0);
+ /*NOTREACHED*/
+}
diff --git a/mcs/jay/makefile b/mcs/jay/makefile
new file mode 100644
index 00000000000..10991a5435f
--- /dev/null
+++ b/mcs/jay/makefile
@@ -0,0 +1,14 @@
+all = jay
+c = closure.c error.c lalr.c lr0.c main.c mkpar.c output.c reader.c \
+ symtab.c verbose.c warshall.c
+
+CFLAGS=#-g
+
+jay: $(c:.c=.o) ; $(CC) -o $@ $(CFLAGS) $(c:.c=.o)
+
+clean:
+ rm -f jay *.o
+
+windows: jay
+
+linux: jay
diff --git a/mcs/jay/mkpar.c b/mcs/jay/mkpar.c
new file mode 100644
index 00000000000..42ead14514d
--- /dev/null
+++ b/mcs/jay/mkpar.c
@@ -0,0 +1,395 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)mkpar.c 5.3 (Berkeley) 1/20/91";
+#endif /* not lint */
+
+#include "defs.h"
+
+action **parser;
+int SRtotal;
+int RRtotal;
+short *SRconflicts;
+short *RRconflicts;
+short *defred;
+short *rules_used;
+short nunused;
+short final_state;
+
+static int SRcount;
+static int RRcount;
+
+extern action *parse_actions();
+extern action *get_shifts();
+extern action *add_reductions();
+extern action *add_reduce();
+
+
+make_parser()
+{
+ register int i;
+
+ parser = NEW2(nstates, action *);
+ for (i = 0; i < nstates; i++)
+ parser[i] = parse_actions(i);
+
+ find_final_state();
+ remove_conflicts();
+ unused_rules();
+ if (SRtotal + RRtotal > 0) total_conflicts();
+ defreds();
+}
+
+
+action *
+parse_actions(stateno)
+register int stateno;
+{
+ register action *actions;
+
+ actions = get_shifts(stateno);
+ actions = add_reductions(stateno, actions);
+ return (actions);
+}
+
+
+action *
+get_shifts(stateno)
+int stateno;
+{
+ register action *actions, *temp;
+ register shifts *sp;
+ register short *to_state;
+ register int i, k;
+ register int symbol;
+
+ actions = 0;
+ sp = shift_table[stateno];
+ if (sp)
+ {
+ to_state = sp->shift;
+ for (i = sp->nshifts - 1; i >= 0; i--)
+ {
+ k = to_state[i];
+ symbol = accessing_symbol[k];
+ if (ISTOKEN(symbol))
+ {
+ temp = NEW(action);
+ temp->next = actions;
+ temp->symbol = symbol;
+ temp->number = k;
+ temp->prec = symbol_prec[symbol];
+ temp->action_code = SHIFT;
+ temp->assoc = symbol_assoc[symbol];
+ actions = temp;
+ }
+ }
+ }
+ return (actions);
+}
+
+action *
+add_reductions(stateno, actions)
+int stateno;
+register action *actions;
+{
+ register int i, j, m, n;
+ register int ruleno, tokensetsize;
+ register unsigned *rowp;
+
+ tokensetsize = WORDSIZE(ntokens);
+ m = lookaheads[stateno];
+ n = lookaheads[stateno + 1];
+ for (i = m; i < n; i++)
+ {
+ ruleno = LAruleno[i];
+ rowp = LA + i * tokensetsize;
+ for (j = ntokens - 1; j >= 0; j--)
+ {
+ if (BIT(rowp, j))
+ actions = add_reduce(actions, ruleno, j);
+ }
+ }
+ return (actions);
+}
+
+
+action *
+add_reduce(actions, ruleno, symbol)
+register action *actions;
+register int ruleno, symbol;
+{
+ register action *temp, *prev, *next;
+
+ prev = 0;
+ for (next = actions; next && next->symbol < symbol; next = next->next)
+ prev = next;
+
+ while (next && next->symbol == symbol && next->action_code == SHIFT)
+ {
+ prev = next;
+ next = next->next;
+ }
+
+ while (next && next->symbol == symbol &&
+ next->action_code == REDUCE && next->number < ruleno)
+ {
+ prev = next;
+ next = next->next;
+ }
+
+ temp = NEW(action);
+ temp->next = next;
+ temp->symbol = symbol;
+ temp->number = ruleno;
+ temp->prec = rprec[ruleno];
+ temp->action_code = REDUCE;
+ temp->assoc = rassoc[ruleno];
+
+ if (prev)
+ prev->next = temp;
+ else
+ actions = temp;
+
+ return (actions);
+}
+
+
+find_final_state()
+{
+ register int goal, i;
+ register short *to_state;
+ register shifts *p;
+
+ p = shift_table[0];
+ to_state = p->shift;
+ goal = ritem[1];
+ for (i = p->nshifts - 1; i >= 0; --i)
+ {
+ final_state = to_state[i];
+ if (accessing_symbol[final_state] == goal) break;
+ }
+}
+
+
+unused_rules()
+{
+ register int i;
+ register action *p;
+
+ rules_used = (short *) MALLOC(nrules*sizeof(short));
+ if (rules_used == 0) no_space();
+
+ for (i = 0; i < nrules; ++i)
+ rules_used[i] = 0;
+
+ for (i = 0; i < nstates; ++i)
+ {
+ for (p = parser[i]; p; p = p->next)
+ {
+ if (p->action_code == REDUCE && p->suppressed == 0)
+ rules_used[p->number] = 1;
+ }
+ }
+
+ nunused = 0;
+ for (i = 3; i < nrules; ++i)
+ if (!rules_used[i]) ++nunused;
+
+ if (nunused)
+ if (nunused == 1)
+ fprintf(stderr, "%s: 1 rule never reduced\n", myname);
+ else
+ fprintf(stderr, "%s: %d rules never reduced\n", myname, nunused);
+}
+
+
+remove_conflicts()
+{
+ register int i;
+ register int symbol;
+ register action *p, *pref;
+
+ SRtotal = 0;
+ RRtotal = 0;
+ SRconflicts = NEW2(nstates, short);
+ RRconflicts = NEW2(nstates, short);
+ for (i = 0; i < nstates; i++)
+ {
+ SRcount = 0;
+ RRcount = 0;
+ symbol = -1;
+ for (p = parser[i]; p; p = p->next)
+ {
+ if (p->symbol != symbol)
+ {
+ pref = p;
+ symbol = p->symbol;
+ }
+ else if (i == final_state && symbol == 0)
+ {
+ SRcount++;
+ p->suppressed = 1;
+ }
+ else if (pref->action_code == SHIFT)
+ {
+ if (pref->prec > 0 && p->prec > 0)
+ {
+ if (pref->prec < p->prec)
+ {
+ pref->suppressed = 2;
+ pref = p;
+ }
+ else if (pref->prec > p->prec)
+ {
+ p->suppressed = 2;
+ }
+ else if (pref->assoc == LEFT)
+ {
+ pref->suppressed = 2;
+ pref = p;
+ }
+ else if (pref->assoc == RIGHT)
+ {
+ p->suppressed = 2;
+ }
+ else
+ {
+ pref->suppressed = 2;
+ p->suppressed = 2;
+ }
+ }
+ else
+ {
+ SRcount++;
+ p->suppressed = 1;
+ }
+ }
+ else
+ {
+ RRcount++;
+ p->suppressed = 1;
+ }
+ }
+ SRtotal += SRcount;
+ RRtotal += RRcount;
+ SRconflicts[i] = SRcount;
+ RRconflicts[i] = RRcount;
+ }
+}
+
+
+total_conflicts()
+{
+ fprintf(stderr, "%s: ", myname);
+ if (SRtotal == 1)
+ fprintf(stderr, "1 shift/reduce conflict");
+ else if (SRtotal > 1)
+ fprintf(stderr, "%d shift/reduce conflicts", SRtotal);
+
+ if (SRtotal && RRtotal)
+ fprintf(stderr, ", ");
+
+ if (RRtotal == 1)
+ fprintf(stderr, "1 reduce/reduce conflict");
+ else if (RRtotal > 1)
+ fprintf(stderr, "%d reduce/reduce conflicts", RRtotal);
+
+ fprintf(stderr, ".\n");
+}
+
+
+int
+sole_reduction(stateno)
+int stateno;
+{
+ register int count, ruleno;
+ register action *p;
+
+ count = 0;
+ ruleno = 0;
+ for (p = parser[stateno]; p; p = p->next)
+ {
+ if (p->action_code == SHIFT && p->suppressed == 0)
+ return (0);
+ else if (p->action_code == REDUCE && p->suppressed == 0)
+ {
+ if (ruleno > 0 && p->number != ruleno)
+ return (0);
+ if (p->symbol != 1)
+ ++count;
+ ruleno = p->number;
+ }
+ }
+
+ if (count == 0)
+ return (0);
+ return (ruleno);
+}
+
+
+defreds()
+{
+ register int i;
+
+ defred = NEW2(nstates, short);
+ for (i = 0; i < nstates; i++)
+ defred[i] = sole_reduction(i);
+}
+
+free_action_row(p)
+register action *p;
+{
+ register action *q;
+
+ while (p)
+ {
+ q = p->next;
+ FREE(p);
+ p = q;
+ }
+}
+
+free_parser()
+{
+ register int i;
+
+ for (i = 0; i < nstates; i++)
+ free_action_row(parser[i]);
+
+ FREE(parser);
+}
diff --git a/mcs/jay/output.c b/mcs/jay/output.c
new file mode 100644
index 00000000000..81e4755c9cd
--- /dev/null
+++ b/mcs/jay/output.c
@@ -0,0 +1,1173 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)output.c 5.7 (Berkeley) 5/24/93";
+#endif /* not lint */
+
+#include "defs.h"
+#include <string.h>
+
+static int nvectors;
+static int nentries;
+static short **froms;
+static short **tos;
+static short *tally;
+static short *width;
+static short *state_count;
+static short *order;
+static short *base;
+static short *pos;
+static int maxtable;
+static short *table;
+static short *check;
+static int lowzero;
+static int high;
+extern int csharp;
+
+output () {
+ int lno = 0;
+ char buf [128];
+
+ free_itemsets();
+ free_shifts();
+ free_reductions();
+
+ while (fgets(buf, sizeof buf, stdin) != NULL) {
+ char * cp;
+ ++ lno;
+ if (buf[strlen(buf)-1] != '\n')
+ fprintf(stderr, "jay: line %d is too long\n", lno), done(1);
+ switch (buf[0]) {
+ case '#': continue;
+ case 't': if (!tflag) fputs("//t", stdout);
+ case '.': break;
+ default:
+ cp = strtok(buf, " \t\r\n");
+ if (cp)
+ if (strcmp(cp, "actions") == 0) output_semantic_actions();
+ else if (strcmp(cp, "debug") == 0) output_debug();
+ else if (strcmp(cp, "epilog") == 0) output_trailing_text();
+ else if (strcmp(cp, "prolog") == 0)
+ output_stored_text(prolog_file, prolog_file_name);
+ else if (strcmp(cp, "local") == 0)
+ output_stored_text(local_file, local_file_name);
+ else if (strcmp(cp, "tables") == 0)
+ output_rule_data(), output_yydefred(), output_actions();
+ else if (strcmp(cp, "tokens") == 0)
+ output_defines(strtok(NULL, "\r\n"));
+ else
+ fprintf(stderr, "jay: unknown call (%s) in line %d\n", cp, lno);
+ continue;
+ }
+ fputs(buf+1, stdout), ++ outline;
+ }
+ free_parser();
+}
+
+output_rule_data()
+{
+ register int i;
+ register int j;
+
+
+ printf(" %s static %s short [] yyLhs = {%16d,",
+ csharp ? "" : " protected",
+ csharp ? "" : " final",
+ symbol_value[start_symbol]);
+
+ j = 10;
+ for (i = 3; i < nrules; i++)
+ {
+ if (j >= 10)
+ {
+ ++outline;
+ putchar('\n');
+ j = 1;
+ }
+ else
+ ++j;
+
+ printf("%5d,", symbol_value[rlhs[i]]);
+ }
+ outline += 2;
+ printf("\n };\n");
+
+ printf(" %s static %s short [] yyLen = {%12d,",
+ csharp ? "" : "protected",
+ csharp ? "" : "final",
+ 2);
+
+ j = 10;
+ for (i = 3; i < nrules; i++)
+ {
+ if (j >= 10)
+ {
+ ++outline;
+ putchar('\n');
+ j = 1;
+ }
+ else
+ j++;
+
+ printf("%5d,", rrhs[i + 1] - rrhs[i] - 1);
+ }
+ outline += 2;
+ printf("\n };\n");
+}
+
+
+output_yydefred()
+{
+ register int i, j;
+
+ printf(" %s static %s short [] yyDefRed = {%13d,",
+ csharp ? "" : "protected",
+ csharp ? "" : "final",
+ (defred[0] ? defred[0] - 2 : 0));
+
+ j = 10;
+ for (i = 1; i < nstates; i++)
+ {
+ if (j < 10)
+ ++j;
+ else
+ {
+ ++outline;
+ putchar('\n');
+ j = 1;
+ }
+
+ printf("%5d,", (defred[i] ? defred[i] - 2 : 0));
+ }
+
+ outline += 2;
+ printf("\n };\n");
+}
+
+
+output_actions()
+{
+ nvectors = 2*nstates + nvars;
+
+ froms = NEW2(nvectors, short *);
+ tos = NEW2(nvectors, short *);
+ tally = NEW2(nvectors, short);
+ width = NEW2(nvectors, short);
+
+ token_actions();
+ FREE(lookaheads);
+ FREE(LA);
+ FREE(LAruleno);
+ FREE(accessing_symbol);
+
+ goto_actions();
+ FREE(goto_map + ntokens);
+ FREE(from_state);
+ FREE(to_state);
+
+ sort_actions();
+ pack_table();
+ output_base();
+ output_table();
+ output_check();
+}
+
+
+token_actions()
+{
+ register int i, j;
+ register int shiftcount, reducecount;
+ register int max, min;
+ register short *actionrow, *r, *s;
+ register action *p;
+
+ actionrow = NEW2(2*ntokens, short);
+ for (i = 0; i < nstates; ++i)
+ {
+ if (parser[i])
+ {
+ for (j = 0; j < 2*ntokens; ++j)
+ actionrow[j] = 0;
+
+ shiftcount = 0;
+ reducecount = 0;
+ for (p = parser[i]; p; p = p->next)
+ {
+ if (p->suppressed == 0)
+ {
+ if (p->action_code == SHIFT)
+ {
+ ++shiftcount;
+ actionrow[p->symbol] = p->number;
+ }
+ else if (p->action_code == REDUCE && p->number != defred[i])
+ {
+ ++reducecount;
+ actionrow[p->symbol + ntokens] = p->number;
+ }
+ }
+ }
+
+ tally[i] = shiftcount;
+ tally[nstates+i] = reducecount;
+ width[i] = 0;
+ width[nstates+i] = 0;
+ if (shiftcount > 0)
+ {
+ froms[i] = r = NEW2(shiftcount, short);
+ tos[i] = s = NEW2(shiftcount, short);
+ min = MAXSHORT;
+ max = 0;
+ for (j = 0; j < ntokens; ++j)
+ {
+ if (actionrow[j])
+ {
+ if (min > symbol_value[j])
+ min = symbol_value[j];
+ if (max < symbol_value[j])
+ max = symbol_value[j];
+ *r++ = symbol_value[j];
+ *s++ = actionrow[j];
+ }
+ }
+ width[i] = max - min + 1;
+ }
+ if (reducecount > 0)
+ {
+ froms[nstates+i] = r = NEW2(reducecount, short);
+ tos[nstates+i] = s = NEW2(reducecount, short);
+ min = MAXSHORT;
+ max = 0;
+ for (j = 0; j < ntokens; ++j)
+ {
+ if (actionrow[ntokens+j])
+ {
+ if (min > symbol_value[j])
+ min = symbol_value[j];
+ if (max < symbol_value[j])
+ max = symbol_value[j];
+ *r++ = symbol_value[j];
+ *s++ = actionrow[ntokens+j] - 2;
+ }
+ }
+ width[nstates+i] = max - min + 1;
+ }
+ }
+ }
+ FREE(actionrow);
+}
+
+goto_actions()
+{
+ register int i, j, k;
+
+ state_count = NEW2(nstates, short);
+
+ k = default_goto(start_symbol + 1);
+ printf(" protected static %s short [] yyDgoto = {%14d,", csharp ? "" : "final", k);
+ save_column(start_symbol + 1, k);
+
+ j = 10;
+ for (i = start_symbol + 2; i < nsyms; i++)
+ {
+ if (j >= 10)
+ {
+ ++outline;
+ putchar('\n');
+ j = 1;
+ }
+ else
+ ++j;
+
+ k = default_goto(i);
+ printf("%5d,", k);
+ save_column(i, k);
+ }
+
+ outline += 2;
+ printf("\n };\n");
+ FREE(state_count);
+}
+
+int
+default_goto(symbol)
+int symbol;
+{
+ register int i;
+ register int m;
+ register int n;
+ register int default_state;
+ register int max;
+
+ m = goto_map[symbol];
+ n = goto_map[symbol + 1];
+
+ if (m == n) return (0);
+
+ for (i = 0; i < nstates; i++)
+ state_count[i] = 0;
+
+ for (i = m; i < n; i++)
+ state_count[to_state[i]]++;
+
+ max = 0;
+ default_state = 0;
+ for (i = 0; i < nstates; i++)
+ {
+ if (state_count[i] > max)
+ {
+ max = state_count[i];
+ default_state = i;
+ }
+ }
+
+ return (default_state);
+}
+
+
+
+save_column(symbol, default_state)
+int symbol;
+int default_state;
+{
+ register int i;
+ register int m;
+ register int n;
+ register short *sp;
+ register short *sp1;
+ register short *sp2;
+ register int count;
+ register int symno;
+
+ m = goto_map[symbol];
+ n = goto_map[symbol + 1];
+
+ count = 0;
+ for (i = m; i < n; i++)
+ {
+ if (to_state[i] != default_state)
+ ++count;
+ }
+ if (count == 0) return;
+
+ symno = symbol_value[symbol] + 2*nstates;
+
+ froms[symno] = sp1 = sp = NEW2(count, short);
+ tos[symno] = sp2 = NEW2(count, short);
+
+ for (i = m; i < n; i++)
+ {
+ if (to_state[i] != default_state)
+ {
+ *sp1++ = from_state[i];
+ *sp2++ = to_state[i];
+ }
+ }
+
+ tally[symno] = count;
+ width[symno] = sp1[-1] - sp[0] + 1;
+}
+
+sort_actions()
+{
+ register int i;
+ register int j;
+ register int k;
+ register int t;
+ register int w;
+
+ order = NEW2(nvectors, short);
+ nentries = 0;
+
+ for (i = 0; i < nvectors; i++)
+ {
+ if (tally[i] > 0)
+ {
+ t = tally[i];
+ w = width[i];
+ j = nentries - 1;
+
+ while (j >= 0 && (width[order[j]] < w))
+ j--;
+
+ while (j >= 0 && (width[order[j]] == w) && (tally[order[j]] < t))
+ j--;
+
+ for (k = nentries - 1; k > j; k--)
+ order[k + 1] = order[k];
+
+ order[j + 1] = i;
+ nentries++;
+ }
+ }
+}
+
+
+pack_table()
+{
+ register int i;
+ register int place;
+ register int state;
+
+ base = NEW2(nvectors, short);
+ pos = NEW2(nentries, short);
+
+ maxtable = 1000;
+ table = NEW2(maxtable, short);
+ check = NEW2(maxtable, short);
+
+ lowzero = 0;
+ high = 0;
+
+ for (i = 0; i < maxtable; i++)
+ check[i] = -1;
+
+ for (i = 0; i < nentries; i++)
+ {
+ state = matching_vector(i);
+
+ if (state < 0)
+ place = pack_vector(i);
+ else
+ place = base[state];
+
+ pos[i] = place;
+ base[order[i]] = place;
+ }
+
+ for (i = 0; i < nvectors; i++)
+ {
+ if (froms[i])
+ FREE(froms[i]);
+ if (tos[i])
+ FREE(tos[i]);
+ }
+
+ FREE(froms);
+ FREE(tos);
+ FREE(pos);
+}
+
+
+/* The function matching_vector determines if the vector specified by */
+/* the input parameter matches a previously considered vector. The */
+/* test at the start of the function checks if the vector represents */
+/* a row of shifts over terminal symbols or a row of reductions, or a */
+/* column of shifts over a nonterminal symbol. Berkeley Yacc does not */
+/* check if a column of shifts over a nonterminal symbols matches a */
+/* previously considered vector. Because of the nature of LR parsing */
+/* tables, no two columns can match. Therefore, the only possible */
+/* match would be between a row and a column. Such matches are */
+/* unlikely. Therefore, to save time, no attempt is made to see if a */
+/* column matches a previously considered vector. */
+/* */
+/* Matching_vector is poorly designed. The test could easily be made */
+/* faster. Also, it depends on the vectors being in a specific */
+/* order. */
+
+int
+matching_vector(vector)
+int vector;
+{
+ register int i;
+ register int j;
+ register int k;
+ register int t;
+ register int w;
+ register int match;
+ register int prev;
+
+ i = order[vector];
+ if (i >= 2*nstates)
+ return (-1);
+
+ t = tally[i];
+ w = width[i];
+
+ for (prev = vector - 1; prev >= 0; prev--)
+ {
+ j = order[prev];
+ if (width[j] != w || tally[j] != t)
+ return (-1);
+
+ match = 1;
+ for (k = 0; match && k < t; k++)
+ {
+ if (tos[j][k] != tos[i][k] || froms[j][k] != froms[i][k])
+ match = 0;
+ }
+
+ if (match)
+ return (j);
+ }
+
+ return (-1);
+}
+
+
+
+int
+pack_vector(vector)
+int vector;
+{
+ register int i, j, k, l;
+ register int t;
+ register int loc;
+ register int ok;
+ register short *from;
+ register short *to;
+ int newmax;
+
+ i = order[vector];
+ t = tally[i];
+ assert(t);
+
+ from = froms[i];
+ to = tos[i];
+
+ j = lowzero - from[0];
+ for (k = 1; k < t; ++k)
+ if (lowzero - from[k] > j)
+ j = lowzero - from[k];
+ for (;; ++j)
+ {
+ if (j == 0)
+ continue;
+ ok = 1;
+ for (k = 0; ok && k < t; k++)
+ {
+ loc = j + from[k];
+ if (loc >= maxtable)
+ {
+ if (loc >= MAXTABLE)
+ fatal("maximum table size exceeded");
+
+ newmax = maxtable;
+ do { newmax += 200; } while (newmax <= loc);
+ table = (short *) REALLOC(table, newmax*sizeof(short));
+ if (table == 0) no_space();
+ check = (short *) REALLOC(check, newmax*sizeof(short));
+ if (check == 0) no_space();
+ for (l = maxtable; l < newmax; ++l)
+ {
+ table[l] = 0;
+ check[l] = -1;
+ }
+ maxtable = newmax;
+ }
+
+ if (check[loc] != -1)
+ ok = 0;
+ }
+ for (k = 0; ok && k < vector; k++)
+ {
+ if (pos[k] == j)
+ ok = 0;
+ }
+ if (ok)
+ {
+ for (k = 0; k < t; k++)
+ {
+ loc = j + from[k];
+ table[loc] = to[k];
+ check[loc] = from[k];
+ if (loc > high) high = loc;
+ }
+
+ while (check[lowzero] != -1)
+ ++lowzero;
+
+ return (j);
+ }
+ }
+}
+
+
+
+output_base()
+{
+ register int i, j;
+
+ printf(" protected static %s short [] yySindex = {%13d,", csharp?"":"final", base[0]);
+
+ j = 10;
+ for (i = 1; i < nstates; i++)
+ {
+ if (j >= 10)
+ {
+ ++outline;
+ putchar('\n');
+ j = 1;
+ }
+ else
+ ++j;
+
+ printf("%5d,", base[i]);
+ }
+
+ outline += 2;
+ printf("\n };\n protected static %s short [] yyRindex = {%13d,",
+ csharp ? "" : "final",
+ base[nstates]);
+
+ j = 10;
+ for (i = nstates + 1; i < 2*nstates; i++)
+ {
+ if (j >= 10)
+ {
+ ++outline;
+ putchar('\n');
+ j = 1;
+ }
+ else
+ ++j;
+
+ printf("%5d,", base[i]);
+ }
+
+ outline += 2;
+ printf("\n };\n protected static %s short [] yyGindex = {%13d,",
+ csharp ? "" : "final",
+ base[2*nstates]);
+
+ j = 10;
+ for (i = 2*nstates + 1; i < nvectors - 1; i++)
+ {
+ if (j >= 10)
+ {
+ ++outline;
+ putchar('\n');
+ j = 1;
+ }
+ else
+ ++j;
+
+ printf("%5d,", base[i]);
+ }
+
+ outline += 2;
+ printf("\n };\n");
+ FREE(base);
+}
+
+
+
+output_table()
+{
+ register int i;
+ register int j;
+
+ printf(" protected static %s short [] yyTable = {%14d,", csharp ? "" : "final", table[0]);
+
+ j = 10;
+ for (i = 1; i <= high; i++)
+ {
+ if (j >= 10)
+ {
+ ++outline;
+ putchar('\n');
+ j = 1;
+ }
+ else
+ ++j;
+
+ printf("%5d,", table[i]);
+ }
+
+ outline += 2;
+ printf("\n };\n");
+ FREE(table);
+}
+
+
+
+output_check()
+{
+ register int i;
+ register int j;
+
+ printf(" protected static %s short [] yyCheck = {%14d,",
+ csharp ? "" : "final",
+ check[0]);
+
+ j = 10;
+ for (i = 1; i <= high; i++)
+ {
+ if (j >= 10)
+ {
+ ++outline;
+ putchar('\n');
+ j = 1;
+ }
+ else
+ ++j;
+
+ printf("%5d,", check[i]);
+ }
+
+ outline += 2;
+ printf("\n };\n");
+ FREE(check);
+}
+
+
+int
+is_C_identifier(name)
+char *name;
+{
+ register char *s;
+ register int c;
+
+ s = name;
+ c = *s;
+ if (c == '"')
+ {
+ c = *++s;
+ if (!isalpha(c) && c != '_' && c != '$')
+ return (0);
+ while ((c = *++s) != '"')
+ {
+ if (!isalnum(c) && c != '_' && c != '$')
+ return (0);
+ }
+ return (1);
+ }
+
+ if (!isalpha(c) && c != '_' && c != '$')
+ return (0);
+ while (c = *++s)
+ {
+ if (!isalnum(c) && c != '_' && c != '$')
+ return (0);
+ }
+ return (1);
+}
+
+
+output_defines(prefix)
+char *prefix;
+{
+ register int c, i;
+ register char *s;
+
+ for (i = 2; i < ntokens; ++i)
+ {
+ s = symbol_name[i];
+ if (is_C_identifier(s))
+ {
+ if (prefix)
+ printf(" %s ", prefix);
+ c = *s;
+ if (c == '"')
+ {
+ while ((c = *++s) != '"')
+ {
+ putchar(c);
+ }
+ }
+ else
+ {
+ do
+ {
+ putchar(c);
+ }
+ while (c = *++s);
+ }
+ ++outline;
+ printf(" = %d%s\n", symbol_value[i], csharp ? ";" : ";");
+ }
+ }
+
+ ++outline;
+ printf(" %s yyErrorCode = %d%s\n", prefix ? prefix : "", symbol_value[1], csharp ? ";" : ";");
+}
+
+
+output_stored_text(file, name)
+FILE *file;
+char *name;
+{
+ register int c;
+ register FILE *in;
+
+ fflush(file);
+ in = fopen(name, "r");
+ if (in == NULL)
+ open_error(name);
+ if ((c = getc(in)) != EOF) {
+ if (c == '\n')
+ ++outline;
+ putchar(c);
+ while ((c = getc(in)) != EOF)
+ {
+ if (c == '\n')
+ ++outline;
+ putchar(c);
+ }
+ printf(line_format, ++outline + 1, "-");
+ }
+ fclose(in);
+}
+
+
+output_debug()
+{
+ register int i, j, k, max;
+ char **symnam, *s;
+ char * prefix = tflag ? "" : "//t";
+
+ ++outline;
+ printf(" protected static %s int yyFinal = %d;\n", csharp ? "" : "final", final_state);
+
+ ++outline;
+ printf("%s public static %s string [] yyRule = {\n", prefix, csharp ? "" : "final");
+ for (i = 2; i < nrules; ++i)
+ {
+ printf("%s \"%s :", prefix, symbol_name[rlhs[i]]);
+ for (j = rrhs[i]; ritem[j] > 0; ++j)
+ {
+ s = symbol_name[ritem[j]];
+ if (s[0] == '"')
+ {
+ printf(" \\\"");
+ while (*++s != '"')
+ {
+ if (*s == '\\')
+ {
+ if (s[1] == '\\')
+ printf("\\\\\\\\");
+ else
+ printf("\\\\%c", s[1]);
+ ++s;
+ }
+ else
+ putchar(*s);
+ }
+ printf("\\\"");
+ }
+ else if (s[0] == '\'')
+ {
+ if (s[1] == '"')
+ printf(" '\\\"'");
+ else if (s[1] == '\\')
+ {
+ if (s[2] == '\\')
+ printf(" '\\\\\\\\");
+ else
+ printf(" '\\\\%c", s[2]);
+ s += 2;
+ while (*++s != '\'')
+ putchar(*s);
+ putchar('\'');
+ }
+ else
+ printf(" '%c'", s[1]);
+ }
+ else
+ printf(" %s", s);
+ }
+ ++outline;
+ printf("\",\n");
+ }
+ ++ outline;
+ printf("%s };\n", prefix);
+
+ max = 0;
+ for (i = 2; i < ntokens; ++i)
+ if (symbol_value[i] > max)
+ max = symbol_value[i];
+
+ /* need yyName for yyExpecting() */
+
+ printf(" protected static %s string [] yyName = {", csharp ? "" : "final");
+ symnam = (char **) MALLOC((max+1)*sizeof(char *));
+ if (symnam == 0) no_space();
+
+ /* Note that it is not necessary to initialize the element */
+ /* symnam[max]. */
+ for (i = 0; i < max; ++i)
+ symnam[i] = 0;
+ for (i = ntokens - 1; i >= 2; --i)
+ symnam[symbol_value[i]] = symbol_name[i];
+ symnam[0] = "end-of-file";
+
+ j = 70; fputs(" ", stdout);
+ for (i = 0; i <= max; ++i)
+ {
+ if (s = symnam[i])
+ {
+ if (s[0] == '"')
+ {
+ k = 7;
+ while (*++s != '"')
+ {
+ ++k;
+ if (*s == '\\')
+ {
+ k += 2;
+ if (*++s == '\\')
+ ++k;
+ }
+ }
+ j += k;
+ if (j > 70)
+ {
+ ++outline;
+ printf("\n ");
+ j = k;
+ }
+ printf("\"\\\"");
+ s = symnam[i];
+ while (*++s != '"')
+ {
+ if (*s == '\\')
+ {
+ printf("\\\\");
+ if (*++s == '\\')
+ printf("\\\\");
+ else
+ putchar(*s);
+ }
+ else
+ putchar(*s);
+ }
+ printf("\\\"\",");
+ }
+ else if (s[0] == '\'')
+ {
+ if (s[1] == '"')
+ {
+ j += 7;
+ if (j > 70)
+ {
+ ++outline;
+ printf("\n ");
+ j = 7;
+ }
+ printf("\"'\\\"'\",");
+ }
+ else
+ {
+ k = 5;
+ while (*++s != '\'')
+ {
+ ++k;
+ if (*s == '\\')
+ {
+ k += 2;
+ if (*++s == '\\')
+ ++k;
+ }
+ }
+ j += k;
+ if (j > 70)
+ {
+ ++outline;
+ printf("\n ");
+ j = k;
+ }
+ printf("\"'");
+ s = symnam[i];
+ while (*++s != '\'')
+ {
+ if (*s == '\\')
+ {
+ printf("\\\\");
+ if (*++s == '\\')
+ printf("\\\\");
+ else
+ putchar(*s);
+ }
+ else
+ putchar(*s);
+ }
+ printf("'\",");
+ }
+ }
+ else
+ {
+ k = strlen(s) + 3;
+ j += k;
+ if (j > 70)
+ {
+ ++outline;
+ printf("\n ");
+ j = k;
+ }
+ putchar('"');
+ do { putchar(*s); } while (*++s);
+ printf("\",");
+ }
+ }
+ else
+ {
+ j += 5;
+ if (j > 70)
+ {
+ ++outline;
+ printf("\n ");
+ j = 5;
+ }
+ printf("null,");
+ }
+ }
+ outline += 2;
+ printf("\n };\n");
+ FREE(symnam);
+}
+
+output_trailing_text()
+{
+ register int c, last;
+ register FILE *in;
+
+ if (line == 0)
+ return;
+
+ in = input_file;
+ c = *cptr;
+ if (c == '\n')
+ {
+ ++lineno;
+ if ((c = getc(in)) == EOF)
+ return;
+ ++outline;
+ printf(line_format, lineno, input_file_name);
+ if (c == '\n')
+ ++outline;
+ putchar(c);
+ last = c;
+ }
+ else
+ {
+ ++outline;
+ printf(line_format, lineno, input_file_name);
+ do { putchar(c); } while ((c = *++cptr) != '\n');
+ ++outline;
+ putchar('\n');
+ last = '\n';
+ }
+
+ while ((c = getc(in)) != EOF)
+ {
+ if (c == '\n')
+ ++outline;
+ putchar(c);
+ last = c;
+ }
+
+ if (last != '\n')
+ {
+ ++outline;
+ putchar('\n');
+ }
+ printf(line_format, ++outline + 1, "-");
+}
+
+
+output_semantic_actions()
+{
+ register int c, last;
+
+ fclose(action_file);
+ action_file = fopen(action_file_name, "r");
+ if (action_file == NULL)
+ open_error(action_file_name);
+
+ if ((c = getc(action_file)) == EOF)
+ return;
+
+ last = c;
+ if (c == '\n')
+ ++outline;
+ putchar(c);
+ while ((c = getc(action_file)) != EOF)
+ {
+ if (c == '\n')
+ ++outline;
+ putchar(c);
+ last = c;
+ }
+
+ if (last != '\n')
+ {
+ ++outline;
+ putchar('\n');
+ }
+
+ printf(line_format, ++outline + 1, "-");
+}
+
+
+free_itemsets()
+{
+ register core *cp, *next;
+
+ FREE(state_table);
+ for (cp = first_state; cp; cp = next)
+ {
+ next = cp->next;
+ FREE(cp);
+ }
+}
+
+
+free_shifts()
+{
+ register shifts *sp, *next;
+
+ FREE(shift_table);
+ for (sp = first_shift; sp; sp = next)
+ {
+ next = sp->next;
+ FREE(sp);
+ }
+}
+
+
+
+free_reductions()
+{
+ register reductions *rp, *next;
+
+ FREE(reduction_table);
+ for (rp = first_reduction; rp; rp = next)
+ {
+ next = rp->next;
+ FREE(rp);
+ }
+}
diff --git a/mcs/jay/reader.c b/mcs/jay/reader.c
new file mode 100644
index 00000000000..f2cdd5af834
--- /dev/null
+++ b/mcs/jay/reader.c
@@ -0,0 +1,1627 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)reader.c 5.7 (Berkeley) 1/20/91";
+#endif /* not lint */
+
+#include "defs.h"
+
+/* The line size must be a positive integer. One hundred was chosen */
+/* because few lines in Yacc input grammars exceed 100 characters. */
+/* Note that if a line exceeds LINESIZE characters, the line buffer */
+/* will be expanded to accomodate it. */
+
+#define LINESIZE 100
+
+char *cache;
+int cinc, cache_size;
+
+int ntags, tagmax;
+char **tag_table;
+
+char saw_eof;
+char *cptr, *line;
+int linesize;
+
+bucket *goal;
+int prec;
+int gensym;
+char last_was_action;
+
+int maxitems;
+bucket **pitem;
+
+int maxrules;
+bucket **plhs;
+
+int name_pool_size;
+char *name_pool;
+
+char *line_format = "\t\t\t\t\t// line %d \"%s\"\n";
+
+
+cachec(c)
+int c;
+{
+ assert(cinc >= 0);
+ if (cinc >= cache_size)
+ {
+ cache_size += 256;
+ cache = REALLOC(cache, cache_size);
+ if (cache == 0) no_space();
+ }
+ cache[cinc] = c;
+ ++cinc;
+}
+
+
+get_line()
+{
+ register FILE *f = input_file;
+ register int c;
+ register int i;
+
+ if (saw_eof || (c = getc(f)) == EOF)
+ {
+ if (line) { FREE(line); line = 0; }
+ cptr = 0;
+ saw_eof = 1;
+ return;
+ }
+
+ if (line == 0 || linesize != (LINESIZE + 1))
+ {
+ if (line) FREE(line);
+ linesize = LINESIZE + 1;
+ line = MALLOC(linesize);
+ if (line == 0) no_space();
+ }
+
+ i = 0;
+ ++lineno;
+ for (;;)
+ {
+ line[i] = c;
+ if (c == '\n') { cptr = line; return; }
+ if (++i >= linesize)
+ {
+ linesize += LINESIZE;
+ line = REALLOC(line, linesize);
+ if (line == 0) no_space();
+ }
+ c = getc(f);
+ if (c == EOF)
+ {
+ line[i] = '\n';
+ saw_eof = 1;
+ cptr = line;
+ return;
+ }
+ }
+}
+
+
+char *
+dup_line()
+{
+ register char *p, *s, *t;
+
+ if (line == 0) return (0);
+ s = line;
+ while (*s != '\n') ++s;
+ p = MALLOC(s - line + 1);
+ if (p == 0) no_space();
+
+ s = line;
+ t = p;
+ while ((*t++ = *s++) != '\n') continue;
+ return (p);
+}
+
+
+skip_comment()
+{
+ register char *s;
+
+ int st_lineno = lineno;
+ char *st_line = dup_line();
+ char *st_cptr = st_line + (cptr - line);
+
+ s = cptr + 2;
+ for (;;)
+ {
+ if (*s == '*' && s[1] == '/')
+ {
+ cptr = s + 2;
+ FREE(st_line);
+ return;
+ }
+ if (*s == '\n')
+ {
+ get_line();
+ if (line == 0)
+ unterminated_comment(st_lineno, st_line, st_cptr);
+ s = cptr;
+ }
+ else
+ ++s;
+ }
+}
+
+
+int
+nextc()
+{
+ register char *s;
+
+ if (line == 0)
+ {
+ get_line();
+ if (line == 0)
+ return (EOF);
+ }
+
+ s = cptr;
+ for (;;)
+ {
+ switch (*s)
+ {
+ case '\n':
+ get_line();
+ if (line == 0) return (EOF);
+ s = cptr;
+ break;
+
+ case ' ':
+ case '\t':
+ case '\f':
+ case '\r':
+ case '\v':
+ case ',':
+ case ';':
+ ++s;
+ break;
+
+ case '\\':
+ cptr = s;
+ return ('%');
+
+ case '/':
+ if (s[1] == '*')
+ {
+ cptr = s;
+ skip_comment();
+ s = cptr;
+ break;
+ }
+ else if (s[1] == '/')
+ {
+ get_line();
+ if (line == 0) return (EOF);
+ s = cptr;
+ break;
+ }
+ /* fall through */
+
+ default:
+ cptr = s;
+ return (*s);
+ }
+ }
+}
+
+
+int
+keyword()
+{
+ register int c;
+ char *t_cptr = cptr;
+
+ c = *++cptr;
+ if (isalpha(c))
+ {
+ cinc = 0;
+ for (;;)
+ {
+ if (isalpha(c))
+ {
+ if (isupper(c)) c = tolower(c);
+ cachec(c);
+ }
+ else if (isdigit(c) || c == '_' || c == '.' || c == '$')
+ cachec(c);
+ else
+ break;
+ c = *++cptr;
+ }
+ cachec(NUL);
+
+ if (strcmp(cache, "token") == 0 || strcmp(cache, "term") == 0)
+ return (TOKEN);
+ if (strcmp(cache, "type") == 0)
+ return (TYPE);
+ if (strcmp(cache, "left") == 0)
+ return (LEFT);
+ if (strcmp(cache, "right") == 0)
+ return (RIGHT);
+ if (strcmp(cache, "nonassoc") == 0 || strcmp(cache, "binary") == 0)
+ return (NONASSOC);
+ if (strcmp(cache, "start") == 0)
+ return (START);
+ }
+ else
+ {
+ ++cptr;
+ if (c == '{')
+ return (TEXT);
+ if (c == '%' || c == '\\')
+ return (MARK);
+ if (c == '<')
+ return (LEFT);
+ if (c == '>')
+ return (RIGHT);
+ if (c == '0')
+ return (TOKEN);
+ if (c == '2')
+ return (NONASSOC);
+ }
+ syntax_error(lineno, line, t_cptr);
+ /*NOTREACHED*/
+}
+
+
+copy_text(f)
+FILE *f;
+{
+ register int c;
+ int quote;
+ int need_newline = 0;
+ int t_lineno = lineno;
+ char *t_line = dup_line();
+ char *t_cptr = t_line + (cptr - line - 2);
+
+ if (*cptr == '\n')
+ {
+ get_line();
+ if (line == 0)
+ unterminated_text(t_lineno, t_line, t_cptr);
+ }
+ fprintf(f, line_format, lineno, input_file_name);
+
+loop:
+ c = *cptr++;
+ switch (c)
+ {
+ case '\n':
+ next_line:
+ putc('\n', f);
+ need_newline = 0;
+ get_line();
+ if (line) goto loop;
+ unterminated_text(t_lineno, t_line, t_cptr);
+
+ case '\'':
+ case '"':
+ {
+ int s_lineno = lineno;
+ char *s_line = dup_line();
+ char *s_cptr = s_line + (cptr - line - 1);
+
+ quote = c;
+ putc(c, f);
+ for (;;)
+ {
+ c = *cptr++;
+ putc(c, f);
+ if (c == quote)
+ {
+ need_newline = 1;
+ FREE(s_line);
+ goto loop;
+ }
+ if (c == '\n')
+ unterminated_string(s_lineno, s_line, s_cptr);
+ if (c == '\\')
+ {
+ c = *cptr++;
+ putc(c, f);
+ if (c == '\n')
+ {
+ get_line();
+ if (line == 0)
+ unterminated_string(s_lineno, s_line, s_cptr);
+ }
+ }
+ }
+ }
+
+ case '/':
+ putc(c, f);
+ need_newline = 1;
+ c = *cptr;
+ if (c == '/')
+ {
+ do putc(c, f); while ((c = *++cptr) != '\n');
+ goto next_line;
+ }
+ if (c == '*')
+ {
+ int c_lineno = lineno;
+ char *c_line = dup_line();
+ char *c_cptr = c_line + (cptr - line - 1);
+
+ putc('*', f);
+ ++cptr;
+ for (;;)
+ {
+ c = *cptr++;
+ putc(c, f);
+ if (c == '*' && *cptr == '/')
+ {
+ putc('/', f);
+ ++cptr;
+ FREE(c_line);
+ goto loop;
+ }
+ if (c == '\n')
+ {
+ get_line();
+ if (line == 0)
+ unterminated_comment(c_lineno, c_line, c_cptr);
+ }
+ }
+ }
+ need_newline = 1;
+ goto loop;
+
+ case '%':
+ case '\\':
+ if (*cptr == '}')
+ {
+ if (need_newline) putc('\n', f);
+ ++cptr;
+ FREE(t_line);
+ return;
+ }
+ /* fall through */
+
+ default:
+ putc(c, f);
+ need_newline = 1;
+ goto loop;
+ }
+}
+
+int
+hexval(c)
+int c;
+{
+ if (c >= '0' && c <= '9')
+ return (c - '0');
+ if (c >= 'A' && c <= 'F')
+ return (c - 'A' + 10);
+ if (c >= 'a' && c <= 'f')
+ return (c - 'a' + 10);
+ return (-1);
+}
+
+
+bucket *
+get_literal()
+{
+ register int c, quote;
+ register int i;
+ register int n;
+ register char *s;
+ register bucket *bp;
+ int s_lineno = lineno;
+ char *s_line = dup_line();
+ char *s_cptr = s_line + (cptr - line);
+
+ quote = *cptr++;
+ cinc = 0;
+ for (;;)
+ {
+ c = *cptr++;
+ if (c == quote) break;
+ if (c == '\n') unterminated_string(s_lineno, s_line, s_cptr);
+ if (c == '\\')
+ {
+ char *c_cptr = cptr - 1;
+
+ c = *cptr++;
+ switch (c)
+ {
+ case '\n':
+ get_line();
+ if (line == 0) unterminated_string(s_lineno, s_line, s_cptr);
+ continue;
+
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ n = c - '0';
+ c = *cptr;
+ if (IS_OCTAL(c))
+ {
+ n = (n << 3) + (c - '0');
+ c = *++cptr;
+ if (IS_OCTAL(c))
+ {
+ n = (n << 3) + (c - '0');
+ ++cptr;
+ }
+ }
+ if (n > MAXCHAR) illegal_character(c_cptr);
+ c = n;
+ break;
+
+ case 'x':
+ c = *cptr++;
+ n = hexval(c);
+ if (n < 0 || n >= 16)
+ illegal_character(c_cptr);
+ for (;;)
+ {
+ c = *cptr;
+ i = hexval(c);
+ if (i < 0 || i >= 16) break;
+ ++cptr;
+ n = (n << 4) + i;
+ if (n > MAXCHAR) illegal_character(c_cptr);
+ }
+ c = n;
+ break;
+
+ case 'a': c = 7; break;
+ case 'b': c = '\b'; break;
+ case 'f': c = '\f'; break;
+ case 'n': c = '\n'; break;
+ case 'r': c = '\r'; break;
+ case 't': c = '\t'; break;
+ case 'v': c = '\v'; break;
+ }
+ }
+ cachec(c);
+ }
+ FREE(s_line);
+
+ n = cinc;
+ s = MALLOC(n);
+ if (s == 0) no_space();
+
+ for (i = 0; i < n; ++i)
+ s[i] = cache[i];
+
+ cinc = 0;
+ if (n == 1)
+ cachec('\'');
+ else
+ cachec('"');
+
+ for (i = 0; i < n; ++i)
+ {
+ c = ((unsigned char *)s)[i];
+ if (c == '\\' || c == cache[0])
+ {
+ cachec('\\');
+ cachec(c);
+ }
+ else if (isprint(c))
+ cachec(c);
+ else
+ {
+ cachec('\\');
+ switch (c)
+ {
+ case 7: cachec('a'); break;
+ case '\b': cachec('b'); break;
+ case '\f': cachec('f'); break;
+ case '\n': cachec('n'); break;
+ case '\r': cachec('r'); break;
+ case '\t': cachec('t'); break;
+ case '\v': cachec('v'); break;
+ default:
+ cachec(((c >> 6) & 7) + '0');
+ cachec(((c >> 3) & 7) + '0');
+ cachec((c & 7) + '0');
+ break;
+ }
+ }
+ }
+
+ if (n == 1)
+ cachec('\'');
+ else
+ cachec('"');
+
+ cachec(NUL);
+ bp = lookup(cache);
+ bp->class = TERM;
+ if (n == 1 && bp->value == UNDEFINED)
+ bp->value = *(unsigned char *)s;
+ FREE(s);
+
+ return (bp);
+}
+
+
+int
+is_reserved(name)
+char *name;
+{
+ char *s;
+
+ if (strcmp(name, ".") == 0 ||
+ strcmp(name, "$accept") == 0 ||
+ strcmp(name, "$end") == 0)
+ return (1);
+
+ if (name[0] == '$' && name[1] == '$' && isdigit(name[2]))
+ {
+ s = name + 3;
+ while (isdigit(*s)) ++s;
+ if (*s == NUL) return (1);
+ }
+
+ return (0);
+}
+
+
+bucket *
+get_name()
+{
+ register int c;
+
+ cinc = 0;
+ for (c = *cptr; IS_IDENT(c); c = *++cptr)
+ cachec(c);
+ cachec(NUL);
+
+ if (is_reserved(cache)) used_reserved(cache);
+
+ return (lookup(cache));
+}
+
+
+int
+get_number()
+{
+ register int c;
+ register int n;
+
+ n = 0;
+ for (c = *cptr; isdigit(c); c = *++cptr)
+ n = 10*n + (c - '0');
+
+ return (n);
+}
+
+
+char *
+get_tag(int emptyOk)
+{
+ register int c;
+ register int i;
+ register char *s;
+ int t_lineno = lineno;
+ char *t_line = dup_line();
+ char *t_cptr = t_line + (cptr - line);
+
+ ++cptr;
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ if (emptyOk && c == '>') {
+ ++cptr; return 0; // 0 indicates empty tag if emptyOk
+ }
+ if (!isalpha(c) && c != '_' && c != '$')
+ illegal_tag(t_lineno, t_line, t_cptr);
+
+ cinc = 0;
+ do { cachec(c); c = *++cptr; } while (IS_IDENT(c));
+ cachec(NUL);
+
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ if (c != '>')
+ illegal_tag(t_lineno, t_line, t_cptr);
+ ++cptr;
+
+ for (i = 0; i < ntags; ++i)
+ {
+ if (strcmp(cache, tag_table[i]) == 0)
+ return (tag_table[i]);
+ }
+
+ if (ntags >= tagmax)
+ {
+ tagmax += 16;
+ tag_table = (char **)
+ (tag_table ? REALLOC(tag_table, tagmax*sizeof(char *))
+ : MALLOC(tagmax*sizeof(char *)));
+ if (tag_table == 0) no_space();
+ }
+
+ s = MALLOC(cinc);
+ if (s == 0) no_space();
+ strcpy(s, cache);
+ tag_table[ntags] = s;
+ ++ntags;
+ FREE(t_line);
+ return (s);
+}
+
+
+declare_tokens(assoc)
+int assoc;
+{
+ register int c;
+ register bucket *bp;
+ int value;
+ char *tag = 0;
+
+ if (assoc != TOKEN) ++prec;
+
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ if (c == '<')
+ {
+ tag = get_tag(0);
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ }
+
+ for (;;)
+ {
+ if (isalpha(c) || c == '_' || c == '.' || c == '$')
+ bp = get_name();
+ else if (c == '\'' || c == '"')
+ bp = get_literal();
+ else
+ return;
+
+ if (bp == goal) tokenized_start(bp->name);
+ bp->class = TERM;
+
+ if (tag)
+ {
+ if (bp->tag && tag != bp->tag)
+ retyped_warning(bp->name);
+ bp->tag = tag;
+ }
+
+ if (assoc != TOKEN)
+ {
+ if (bp->prec && prec != bp->prec)
+ reprec_warning(bp->name);
+ bp->assoc = assoc;
+ bp->prec = prec;
+ }
+
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ value = UNDEFINED;
+ if (isdigit(c))
+ {
+ value = get_number();
+ if (bp->value != UNDEFINED && value != bp->value)
+ revalued_warning(bp->name);
+ bp->value = value;
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ }
+ }
+}
+
+
+declare_types()
+{
+ register int c;
+ register bucket *bp;
+ char *tag;
+
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ if (c != '<') syntax_error(lineno, line, cptr);
+ tag = get_tag(0);
+
+ for (;;)
+ {
+ c = nextc();
+ if (isalpha(c) || c == '_' || c == '.' || c == '$')
+ bp = get_name();
+ else if (c == '\'' || c == '"')
+ bp = get_literal();
+ else
+ return;
+
+ if (bp->tag && tag != bp->tag)
+ retyped_warning(bp->name);
+ bp->tag = tag;
+ }
+}
+
+
+declare_start()
+{
+ register int c;
+ register bucket *bp;
+
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ if (!isalpha(c) && c != '_' && c != '.' && c != '$')
+ syntax_error(lineno, line, cptr);
+ bp = get_name();
+ if (bp->class == TERM)
+ terminal_start(bp->name);
+ if (goal && goal != bp)
+ restarted_warning();
+ goal = bp;
+}
+
+
+read_declarations()
+{
+ register int c, k;
+
+ cache_size = 256;
+ cache = MALLOC(cache_size);
+ if (cache == 0) no_space();
+
+ for (;;)
+ {
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ if (c != '%') syntax_error(lineno, line, cptr);
+ switch (k = keyword())
+ {
+ case MARK:
+ return;
+
+ case TEXT:
+ copy_text(prolog_file);
+ break;
+
+ case TOKEN:
+ case LEFT:
+ case RIGHT:
+ case NONASSOC:
+ declare_tokens(k);
+ break;
+
+ case TYPE:
+ declare_types();
+ break;
+
+ case START:
+ declare_start();
+ break;
+ }
+ }
+}
+
+
+initialize_grammar()
+{
+ nitems = 4;
+ maxitems = 300;
+ pitem = (bucket **) MALLOC(maxitems*sizeof(bucket *));
+ if (pitem == 0) no_space();
+ pitem[0] = 0;
+ pitem[1] = 0;
+ pitem[2] = 0;
+ pitem[3] = 0;
+
+ nrules = 3;
+ maxrules = 100;
+ plhs = (bucket **) MALLOC(maxrules*sizeof(bucket *));
+ if (plhs == 0) no_space();
+ plhs[0] = 0;
+ plhs[1] = 0;
+ plhs[2] = 0;
+ rprec = (short *) MALLOC(maxrules*sizeof(short));
+ if (rprec == 0) no_space();
+ rprec[0] = 0;
+ rprec[1] = 0;
+ rprec[2] = 0;
+ rassoc = (char *) MALLOC(maxrules*sizeof(char));
+ if (rassoc == 0) no_space();
+ rassoc[0] = TOKEN;
+ rassoc[1] = TOKEN;
+ rassoc[2] = TOKEN;
+}
+
+
+expand_items()
+{
+ maxitems += 300;
+ pitem = (bucket **) REALLOC(pitem, maxitems*sizeof(bucket *));
+ if (pitem == 0) no_space();
+}
+
+
+expand_rules()
+{
+ maxrules += 100;
+ plhs = (bucket **) REALLOC(plhs, maxrules*sizeof(bucket *));
+ if (plhs == 0) no_space();
+ rprec = (short *) REALLOC(rprec, maxrules*sizeof(short));
+ if (rprec == 0) no_space();
+ rassoc = (char *) REALLOC(rassoc, maxrules*sizeof(char));
+ if (rassoc == 0) no_space();
+}
+
+
+advance_to_start()
+{
+ register int c;
+ register bucket *bp;
+ char *s_cptr;
+ int s_lineno;
+
+ for (;;)
+ {
+ c = nextc();
+ if (c != '%') break;
+ s_cptr = cptr;
+ switch (keyword())
+ {
+ case MARK:
+ no_grammar();
+
+ case TEXT:
+ copy_text(local_file);
+ break;
+
+ case START:
+ declare_start();
+ break;
+
+ default:
+ syntax_error(lineno, line, s_cptr);
+ }
+ }
+
+ c = nextc();
+ if (!isalpha(c) && c != '_' && c != '.' && c != '_')
+ syntax_error(lineno, line, cptr);
+ bp = get_name();
+ if (goal == 0)
+ {
+ if (bp->class == TERM)
+ terminal_start(bp->name);
+ goal = bp;
+ }
+
+ s_lineno = lineno;
+ c = nextc();
+ if (c == EOF) unexpected_EOF();
+ if (c != ':') syntax_error(lineno, line, cptr);
+ start_rule(bp, s_lineno);
+ ++cptr;
+}
+
+
+start_rule(bp, s_lineno)
+register bucket *bp;
+int s_lineno;
+{
+ if (bp->class == TERM)
+ terminal_lhs(s_lineno);
+ bp->class = NONTERM;
+ if (nrules >= maxrules)
+ expand_rules();
+ plhs[nrules] = bp;
+ rprec[nrules] = UNDEFINED;
+ rassoc[nrules] = TOKEN;
+}
+
+
+end_rule()
+{
+ register int i;
+
+ if (!last_was_action && plhs[nrules]->tag)
+ {
+ for (i = nitems - 1; pitem[i]; --i) continue;
+ if (pitem[i+1] == 0 || pitem[i+1]->tag != plhs[nrules]->tag)
+ default_action_warning(); /** if classes don't match exactly **/
+ } /** bug: could be superclass... **/
+
+ last_was_action = 0;
+ if (nitems >= maxitems) expand_items();
+ pitem[nitems] = 0;
+ ++nitems;
+ ++nrules;
+}
+
+
+insert_empty_rule()
+{
+ register bucket *bp, **bpp;
+
+ assert(cache);
+ sprintf(cache, "$$%d", ++gensym);
+ bp = make_bucket(cache);
+ last_symbol->next = bp;
+ last_symbol = bp;
+ bp->tag = plhs[nrules]->tag;
+ bp->class = NONTERM;
+
+ if ((nitems += 2) > maxitems)
+ expand_items();
+ bpp = pitem + nitems - 1;
+ *bpp-- = bp;
+ while (bpp[0] = bpp[-1]) --bpp;
+
+ if (++nrules >= maxrules)
+ expand_rules();
+ plhs[nrules] = plhs[nrules-1];
+ plhs[nrules-1] = bp;
+ rprec[nrules] = rprec[nrules-1];
+ rprec[nrules-1] = 0;
+ rassoc[nrules] = rassoc[nrules-1];
+ rassoc[nrules-1] = TOKEN;
+}
+
+
+add_symbol()
+{
+ register int c;
+ register bucket *bp;
+ int s_lineno = lineno;
+
+ c = *cptr;
+ if (c == '\'' || c == '"')
+ bp = get_literal();
+ else
+ bp = get_name();
+
+ c = nextc();
+ if (c == ':')
+ {
+ end_rule();
+ start_rule(bp, s_lineno);
+ ++cptr;
+ return;
+ }
+
+ if (last_was_action)
+ insert_empty_rule();
+ last_was_action = 0;
+
+ if (++nitems > maxitems)
+ expand_items();
+ pitem[nitems-1] = bp;
+}
+
+
+copy_action()
+{
+ register int c;
+ register int i, n;
+ int depth;
+ int quote;
+ char *tag;
+ register FILE *f = action_file;
+ int a_lineno = lineno;
+ char *a_line = dup_line();
+ char *a_cptr = a_line + (cptr - line);
+
+ if (last_was_action)
+ insert_empty_rule();
+ last_was_action = 1;
+
+ fprintf(f, "case %d:\n", nrules - 2);
+ fprintf(f, line_format, lineno, input_file_name);
+ putc(' ', f); putc(' ', f);
+ if (*cptr == '=') ++cptr;
+
+ n = 0;
+ for (i = nitems - 1; pitem[i]; --i) ++n;
+
+ depth = 0;
+loop:
+ c = *cptr;
+ if (c == '$')
+ {
+ if (cptr[1] == '<')
+ {
+ int d_lineno = lineno;
+ char *d_line = dup_line();
+ char *d_cptr = d_line + (cptr - line);
+
+ ++cptr;
+ tag = get_tag(1);
+ c = *cptr;
+ if (c == '$')
+ { if (tag && strcmp(tag, "Object"))
+ fprintf(f, "((%s)yyVal)", tag);
+ else fprintf(f, "yyVal");
+ ++cptr;
+ FREE(d_line);
+ goto loop;
+ }
+ else if (isdigit(c))
+ {
+ i = get_number();
+ if (i > n) dollar_warning(d_lineno, i);
+ if (tag && strcmp(tag, "Object"))
+ fprintf(f, "((%s)yyVals[%d+yyTop])", tag, i - n);
+ else fprintf(f, "yyVals[%d+yyTop]", i - n);
+ FREE(d_line);
+ goto loop;
+ }
+ else if (c == '-' && isdigit(cptr[1]))
+ {
+ ++cptr;
+ i = -get_number() - n;
+ if (tag && strcmp(tag, "Object"))
+ fprintf(f, "((%s)yyVals[%d+yyTop])", tag, i);
+ else fprintf(f, "yyVals[%d+yyTop]", tag, i);
+ FREE(d_line);
+ goto loop;
+ }
+ else
+ dollar_error(d_lineno, d_line, d_cptr);
+ }
+ else if (cptr[1] == '$')
+ {
+ if (ntags && plhs[nrules]->tag == 0)
+ untyped_lhs();
+ fprintf(f, "yyVal");
+ cptr += 2;
+ goto loop;
+ }
+ else if (isdigit(cptr[1]))
+ {
+ ++cptr;
+ i = get_number();
+ if (ntags)
+ {
+ if (i <= 0 || i > n)
+ unknown_rhs(i);
+ tag = pitem[nitems + i - n - 1]->tag;
+ if (tag == 0)
+ untyped_rhs(i, pitem[nitems + i - n - 1]->name),
+ fprintf(f, "yyVals[%d+yyTop]", i - n);
+ else if (strcmp(tag, "Object"))
+ fprintf(f, "((%s)yyVals[%d+yyTop])", tag, i - n);
+ else
+ fprintf(f, "yyVals[%d+yyTop]", i - n);
+ }
+ else
+ {
+ if (i > n)
+ dollar_warning(lineno, i);
+ fprintf(f, "yyVals[%d+yyTop]", i - n);
+ }
+ goto loop;
+ }
+ else if (cptr[1] == '-')
+ {
+ cptr += 2;
+ i = get_number();
+ if (ntags)
+ unknown_rhs(-i);
+ fprintf(f, "yyVals[%d+yyTop]", -i - n);
+ goto loop;
+ }
+ }
+ if (isalpha(c) || c == '_' || c == '$')
+ {
+ do
+ {
+ putc(c, f);
+ c = *++cptr;
+ } while (isalnum(c) || c == '_' || c == '$');
+ goto loop;
+ }
+ putc(c, f);
+ ++cptr;
+ switch (c)
+ {
+ case '\n':
+ next_line:
+ get_line();
+ if (line) goto loop;
+ unterminated_action(a_lineno, a_line, a_cptr);
+
+ case ';':
+ if (depth > 0) goto loop;
+ fprintf(f, "\nbreak;\n");
+ return;
+
+ case '{':
+ ++depth;
+ goto loop;
+
+ case '}':
+ if (--depth > 0) goto loop;
+ fprintf(f, "\n break;\n");
+ return;
+
+ case '\'':
+ case '"':
+ {
+ int s_lineno = lineno;
+ char *s_line = dup_line();
+ char *s_cptr = s_line + (cptr - line - 1);
+
+ quote = c;
+ for (;;)
+ {
+ c = *cptr++;
+ putc(c, f);
+ if (c == quote)
+ {
+ FREE(s_line);
+ goto loop;
+ }
+ if (c == '\n')
+ unterminated_string(s_lineno, s_line, s_cptr);
+ if (c == '\\')
+ {
+ c = *cptr++;
+ putc(c, f);
+ if (c == '\n')
+ {
+ get_line();
+ if (line == 0)
+ unterminated_string(s_lineno, s_line, s_cptr);
+ }
+ }
+ }
+ }
+
+ case '/':
+ c = *cptr;
+ if (c == '/')
+ {
+ putc('*', f);
+ while ((c = *++cptr) != '\n')
+ {
+ if (c == '*' && cptr[1] == '/')
+ fprintf(f, "* ");
+ else
+ putc(c, f);
+ }
+ fprintf(f, "*/\n");
+ goto next_line;
+ }
+ if (c == '*')
+ {
+ int c_lineno = lineno;
+ char *c_line = dup_line();
+ char *c_cptr = c_line + (cptr - line - 1);
+
+ putc('*', f);
+ ++cptr;
+ for (;;)
+ {
+ c = *cptr++;
+ putc(c, f);
+ if (c == '*' && *cptr == '/')
+ {
+ putc('/', f);
+ ++cptr;
+ FREE(c_line);
+ goto loop;
+ }
+ if (c == '\n')
+ {
+ get_line();
+ if (line == 0)
+ unterminated_comment(c_lineno, c_line, c_cptr);
+ }
+ }
+ }
+ goto loop;
+
+ default:
+ goto loop;
+ }
+}
+
+
+int
+mark_symbol()
+{
+ register int c;
+ register bucket *bp;
+
+ c = cptr[1];
+ if (c == '%' || c == '\\')
+ {
+ cptr += 2;
+ return (1);
+ }
+
+ if (c == '=')
+ cptr += 2;
+ else if ((c == 'p' || c == 'P') &&
+ ((c = cptr[2]) == 'r' || c == 'R') &&
+ ((c = cptr[3]) == 'e' || c == 'E') &&
+ ((c = cptr[4]) == 'c' || c == 'C') &&
+ ((c = cptr[5], !IS_IDENT(c))))
+ cptr += 5;
+ else
+ syntax_error(lineno, line, cptr);
+
+ c = nextc();
+ if (isalpha(c) || c == '_' || c == '.' || c == '$')
+ bp = get_name();
+ else if (c == '\'' || c == '"')
+ bp = get_literal();
+ else
+ {
+ syntax_error(lineno, line, cptr);
+ /*NOTREACHED*/
+ }
+
+ if (rprec[nrules] != UNDEFINED && bp->prec != rprec[nrules])
+ prec_redeclared();
+
+ rprec[nrules] = bp->prec;
+ rassoc[nrules] = bp->assoc;
+ return (0);
+}
+
+
+read_grammar()
+{
+ register int c;
+
+ initialize_grammar();
+ advance_to_start();
+
+ for (;;)
+ {
+ c = nextc();
+ if (c == EOF) break;
+ if (isalpha(c) || c == '_' || c == '.' || c == '$' || c == '\'' ||
+ c == '"')
+ add_symbol();
+ else if (c == '{' || c == '=')
+ copy_action();
+ else if (c == '|')
+ {
+ end_rule();
+ start_rule(plhs[nrules-1], 0);
+ ++cptr;
+ }
+ else if (c == '%')
+ {
+ if (mark_symbol()) break;
+ }
+ else
+ syntax_error(lineno, line, cptr);
+ }
+ end_rule();
+}
+
+
+free_tags()
+{
+ register int i;
+
+ if (tag_table == 0) return;
+
+ for (i = 0; i < ntags; ++i)
+ {
+ assert(tag_table[i]);
+ FREE(tag_table[i]);
+ }
+ FREE(tag_table);
+}
+
+
+pack_names()
+{
+ register bucket *bp;
+ register char *p, *s, *t;
+
+ name_pool_size = 13; /* 13 == sizeof("$end") + sizeof("$accept") */
+ for (bp = first_symbol; bp; bp = bp->next)
+ name_pool_size += strlen(bp->name) + 1;
+ name_pool = MALLOC(name_pool_size);
+ if (name_pool == 0) no_space();
+
+ strcpy(name_pool, "$accept");
+ strcpy(name_pool+8, "$end");
+ t = name_pool + 13;
+ for (bp = first_symbol; bp; bp = bp->next)
+ {
+ p = t;
+ s = bp->name;
+ while (*t++ = *s++) continue;
+ FREE(bp->name);
+ bp->name = p;
+ }
+}
+
+
+check_symbols()
+{
+ register bucket *bp;
+
+ if (goal->class == UNKNOWN)
+ undefined_goal(goal->name);
+
+ for (bp = first_symbol; bp; bp = bp->next)
+ {
+ if (bp->class == UNKNOWN)
+ {
+ undefined_symbol_warning(bp->name);
+ bp->class = TERM;
+ }
+ }
+}
+
+
+pack_symbols()
+{
+ register bucket *bp;
+ register bucket **v;
+ register int i, j, k, n;
+
+ nsyms = 2;
+ ntokens = 1;
+ for (bp = first_symbol; bp; bp = bp->next)
+ {
+ ++nsyms;
+ if (bp->class == TERM) ++ntokens;
+ }
+ start_symbol = ntokens;
+ nvars = nsyms - ntokens;
+
+ symbol_name = (char **) MALLOC(nsyms*sizeof(char *));
+ if (symbol_name == 0) no_space();
+ symbol_value = (short *) MALLOC(nsyms*sizeof(short));
+ if (symbol_value == 0) no_space();
+ symbol_prec = (short *) MALLOC(nsyms*sizeof(short));
+ if (symbol_prec == 0) no_space();
+ symbol_assoc = MALLOC(nsyms);
+ if (symbol_assoc == 0) no_space();
+
+ v = (bucket **) MALLOC(nsyms*sizeof(bucket *));
+ if (v == 0) no_space();
+
+ v[0] = 0;
+ v[start_symbol] = 0;
+
+ i = 1;
+ j = start_symbol + 1;
+ for (bp = first_symbol; bp; bp = bp->next)
+ {
+ if (bp->class == TERM)
+ v[i++] = bp;
+ else
+ v[j++] = bp;
+ }
+ assert(i == ntokens && j == nsyms);
+
+ for (i = 1; i < ntokens; ++i)
+ v[i]->index = i;
+
+ goal->index = start_symbol + 1;
+ k = start_symbol + 2;
+ while (++i < nsyms)
+ if (v[i] != goal)
+ {
+ v[i]->index = k;
+ ++k;
+ }
+
+ goal->value = 0;
+ k = 1;
+ for (i = start_symbol + 1; i < nsyms; ++i)
+ {
+ if (v[i] != goal)
+ {
+ v[i]->value = k;
+ ++k;
+ }
+ }
+
+ k = 0;
+ for (i = 1; i < ntokens; ++i)
+ {
+ n = v[i]->value;
+ if (n > 256)
+ {
+ for (j = k++; j > 0 && symbol_value[j-1] > n; --j)
+ symbol_value[j] = symbol_value[j-1];
+ symbol_value[j] = n;
+ }
+ }
+
+ if (v[1]->value == UNDEFINED)
+ v[1]->value = 256;
+
+ j = 0;
+ n = 257;
+ for (i = 2; i < ntokens; ++i)
+ {
+ if (v[i]->value == UNDEFINED)
+ {
+ while (j < k && n == symbol_value[j])
+ {
+ while (++j < k && n == symbol_value[j]) continue;
+ ++n;
+ }
+ v[i]->value = n;
+ ++n;
+ }
+ }
+
+ symbol_name[0] = name_pool + 8;
+ symbol_value[0] = 0;
+ symbol_prec[0] = 0;
+ symbol_assoc[0] = TOKEN;
+ for (i = 1; i < ntokens; ++i)
+ {
+ symbol_name[i] = v[i]->name;
+ symbol_value[i] = v[i]->value;
+ symbol_prec[i] = v[i]->prec;
+ symbol_assoc[i] = v[i]->assoc;
+ }
+ symbol_name[start_symbol] = name_pool;
+ symbol_value[start_symbol] = -1;
+ symbol_prec[start_symbol] = 0;
+ symbol_assoc[start_symbol] = TOKEN;
+ for (++i; i < nsyms; ++i)
+ {
+ k = v[i]->index;
+ symbol_name[k] = v[i]->name;
+ symbol_value[k] = v[i]->value;
+ symbol_prec[k] = v[i]->prec;
+ symbol_assoc[k] = v[i]->assoc;
+ }
+
+ FREE(v);
+}
+
+
+pack_grammar()
+{
+ register int i, j;
+ int assoc, prec;
+
+ ritem = (short *) MALLOC(nitems*sizeof(short));
+ if (ritem == 0) no_space();
+ rlhs = (short *) MALLOC(nrules*sizeof(short));
+ if (rlhs == 0) no_space();
+ rrhs = (short *) MALLOC((nrules+1)*sizeof(short));
+ if (rrhs == 0) no_space();
+ rprec = (short *) REALLOC(rprec, nrules*sizeof(short));
+ if (rprec == 0) no_space();
+ rassoc = REALLOC(rassoc, nrules);
+ if (rassoc == 0) no_space();
+
+ ritem[0] = -1;
+ ritem[1] = goal->index;
+ ritem[2] = 0;
+ ritem[3] = -2;
+ rlhs[0] = 0;
+ rlhs[1] = 0;
+ rlhs[2] = start_symbol;
+ rrhs[0] = 0;
+ rrhs[1] = 0;
+ rrhs[2] = 1;
+
+ j = 4;
+ for (i = 3; i < nrules; ++i)
+ {
+ rlhs[i] = plhs[i]->index;
+ rrhs[i] = j;
+ assoc = TOKEN;
+ prec = 0;
+ while (pitem[j])
+ {
+ ritem[j] = pitem[j]->index;
+ if (pitem[j]->class == TERM)
+ {
+ prec = pitem[j]->prec;
+ assoc = pitem[j]->assoc;
+ }
+ ++j;
+ }
+ ritem[j] = -i;
+ ++j;
+ if (rprec[i] == UNDEFINED)
+ {
+ rprec[i] = prec;
+ rassoc[i] = assoc;
+ }
+ }
+ rrhs[i] = j;
+
+ FREE(plhs);
+ FREE(pitem);
+}
+
+
+print_grammar()
+{
+ register int i, j, k;
+ int spacing;
+ register FILE *f = verbose_file;
+
+ if (!vflag) return;
+
+ k = 1;
+ for (i = 2; i < nrules; ++i)
+ {
+ if (rlhs[i] != rlhs[i-1])
+ {
+ if (i != 2) fprintf(f, "\n");
+ fprintf(f, "%4d %s :", i - 2, symbol_name[rlhs[i]]);
+ spacing = strlen(symbol_name[rlhs[i]]) + 1;
+ }
+ else
+ {
+ fprintf(f, "%4d ", i - 2);
+ j = spacing;
+ while (--j >= 0) putc(' ', f);
+ putc('|', f);
+ }
+
+ while (ritem[k] >= 0)
+ {
+ fprintf(f, " %s", symbol_name[ritem[k]]);
+ ++k;
+ }
+ ++k;
+ putc('\n', f);
+ }
+}
+
+
+reader()
+{
+ create_symbol_table();
+ read_declarations();
+ read_grammar();
+ free_symbol_table();
+ free_tags();
+ pack_names();
+ check_symbols();
+ pack_symbols();
+ pack_grammar();
+ free_symbols();
+ print_grammar();
+}
diff --git a/mcs/jay/skeleton b/mcs/jay/skeleton
new file mode 100644
index 00000000000..07135c082f2
--- /dev/null
+++ b/mcs/jay/skeleton
@@ -0,0 +1,268 @@
+# jay skeleton
+
+# character in column 1 determines outcome...
+# # is a comment
+# . is copied
+# t is copied as //t if -t is set
+# other lines are interpreted to call jay procedures
+
+.// created by jay 0.7 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
+.
+ prolog ## %{ ... %} prior to the first %%
+
+.// %token constants
+.
+ tokens public static final int
+.
+. /** thrown for irrecoverable syntax errors and stack overflow.
+. */
+. public static class yyException extends java.lang.Exception {
+. public yyException (String message) {
+. super(message);
+. }
+. }
+.
+. /** must be implemented by a scanner object to supply input to the parser.
+. */
+. public interface yyInput {
+. /** move on to next token.
+. @return false if positioned beyond tokens.
+. @throws IOException on input error.
+. */
+. boolean advance () throws java.io.IOException;
+. /** classifies current token.
+. Should not be called if advance() returned false.
+. @return current %token or single character.
+. */
+. int token ();
+. /** associated with current token.
+. Should not be called if advance() returned false.
+. @return value for token().
+. */
+. Object value ();
+. }
+.
+. /** simplified error message.
+. @see <a href="#yyerror(java.lang.String, java.lang.String[])">yyerror</a>
+. */
+. public void yyerror (String message) {
+. yyerror(message, null);
+. }
+.
+. /** (syntax) error message.
+. Can be overwritten to control message format.
+. @param message text to be displayed.
+. @param expected vector of acceptable tokens, if available.
+. */
+. public void yyerror (String message, String[] expected) {
+. if (expected != null && expected.length > 0) {
+. System.err.print(message+", expecting");
+. for (int n = 0; n < expected.length; ++ n)
+. System.err.print(" "+expected[n]);
+. System.err.println();
+. } else
+. System.err.println(message);
+. }
+.
+. /** debugging support, requires the package jay.yydebug.
+. Set to null to suppress debugging messages.
+. */
+t protected jay.yydebug.yyDebug yydebug;
+.
+ debug ## tables for debugging support
+.
+. /** index-checked interface to yyName[].
+. @param token single character or %token value.
+. @return token name or [illegal] or [unknown].
+. */
+t public static final String yyname (int token) {
+t if (token < 0 || token > yyName.length) return "[illegal]";
+t String name;
+t if ((name = yyName[token]) != null) return name;
+t return "[unknown]";
+t }
+.
+. /** computes list of expected tokens on error by tracing the tables.
+. @param state for which to compute the list.
+. @return list of token names.
+. */
+. protected String[] yyExpecting (int state) {
+. int token, n, len = 0;
+. boolean[] ok = new boolean[yyName.length];
+.
+. if ((n = yySindex[state]) != 0)
+. for (token = n < 0 ? -n : 0;
+. token < yyName.length && n+token < yyTable.length; ++ token)
+. if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
+. ++ len;
+. ok[token] = true;
+. }
+. if ((n = yyRindex[state]) != 0)
+. for (token = n < 0 ? -n : 0;
+. token < yyName.length && n+token < yyTable.length; ++ token)
+. if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
+. ++ len;
+. ok[token] = true;
+. }
+.
+. String result[] = new String[len];
+. for (n = token = 0; n < len; ++ token)
+. if (ok[token]) result[n++] = yyName[token];
+. return result;
+. }
+.
+. /** the generated parser, with debugging messages.
+. Maintains a state and a value stack, currently with fixed maximum size.
+. @param yyLex scanner.
+. @param yydebug debug message writer implementing yyDebug, or null.
+. @return result of the last reduction, if any.
+. @throws yyException on irrecoverable parse error.
+. */
+. public Object yyparse (yyInput yyLex, Object yydebug)
+. throws java.io.IOException, yyException {
+t this.yydebug = (jay.yydebug.yyDebug)yydebug;
+. return yyparse(yyLex);
+. }
+.
+. /** initial size and increment of the state/value stack [default 256].
+. This is not final so that it can be overwritten outside of invocations
+. of yyparse().
+. */
+. protected int yyMax;
+.
+. /** executed at the beginning of a reduce action.
+. Used as $$ = yyDefault($1), prior to the user-specified action, if any.
+. Can be overwritten to provide deep copy, etc.
+. @param first value for $1, or null.
+. @return first.
+. */
+. protected Object yyDefault (Object first) {
+. return first;
+. }
+.
+. /** the generated parser.
+. Maintains a state and a value stack, currently with fixed maximum size.
+. @param yyLex scanner.
+. @return result of the last reduction, if any.
+. @throws yyException on irrecoverable parse error.
+. */
+. public Object yyparse (yyInput yyLex)
+. throws java.io.IOException, yyException {
+. if (yyMax <= 0) yyMax = 256; // initial size
+. int yyState = 0, yyStates[] = new int[yyMax]; // state stack
+. Object yyVal = null, yyVals[] = new Object[yyMax]; // value stack
+. int yyToken = -1; // current input
+. int yyErrorFlag = 0; // #tks to shift
+.
+ local ## %{ ... %} after the first %%
+
+. yyLoop: for (int yyTop = 0;; ++ yyTop) {
+. if (yyTop >= yyStates.length) { // dynamically increase
+. int[] i = new int[yyStates.length+yyMax];
+. System.arraycopy(yyStates, 0, i, 0, yyStates.length);
+. yyStates = i;
+. Object[] o = new Object[yyVals.length+yyMax];
+. System.arraycopy(yyVals, 0, o, 0, yyVals.length);
+. yyVals = o;
+. }
+. yyStates[yyTop] = yyState;
+. yyVals[yyTop] = yyVal;
+t if (yydebug != null) yydebug.push(yyState, yyVal);
+.
+. yyDiscarded: for (;;) { // discarding a token does not change stack
+. int yyN;
+. if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
+. if (yyToken < 0) {
+. yyToken = yyLex.advance() ? yyLex.token() : 0;
+t if (yydebug != null)
+t yydebug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
+. }
+. if ((yyN = yySindex[yyState]) != 0 && (yyN += yyToken) >= 0
+. && yyN < yyTable.length && yyCheck[yyN] == yyToken) {
+t if (yydebug != null)
+t yydebug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
+. yyState = yyTable[yyN]; // shift to yyN
+. yyVal = yyLex.value();
+. yyToken = -1;
+. if (yyErrorFlag > 0) -- yyErrorFlag;
+. continue yyLoop;
+. }
+. if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
+. && yyN < yyTable.length && yyCheck[yyN] == yyToken)
+. yyN = yyTable[yyN]; // reduce (yyN)
+. else
+. switch (yyErrorFlag) {
+.
+. case 0:
+. yyerror("syntax error", yyExpecting(yyState));
+t if (yydebug != null) yydebug.error("syntax error");
+.
+. case 1: case 2:
+. yyErrorFlag = 3;
+. do {
+. if ((yyN = yySindex[yyStates[yyTop]]) != 0
+. && (yyN += yyErrorCode) >= 0 && yyN < yyTable.length
+. && yyCheck[yyN] == yyErrorCode) {
+t if (yydebug != null)
+t yydebug.shift(yyStates[yyTop], yyTable[yyN], 3);
+. yyState = yyTable[yyN];
+. yyVal = yyLex.value();
+. continue yyLoop;
+. }
+t if (yydebug != null) yydebug.pop(yyStates[yyTop]);
+. } while (-- yyTop >= 0);
+t if (yydebug != null) yydebug.reject();
+. throw new yyException("irrecoverable syntax error");
+.
+. case 3:
+. if (yyToken == 0) {
+t if (yydebug != null) yydebug.reject();
+. throw new yyException("irrecoverable syntax error at end-of-file");
+. }
+t if (yydebug != null)
+t yydebug.discard(yyState, yyToken, yyname(yyToken),
+t yyLex.value());
+. yyToken = -1;
+. continue yyDiscarded; // leave stack alone
+. }
+. }
+. int yyV = yyTop + 1-yyLen[yyN];
+t if (yydebug != null)
+t yydebug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]);
+. yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
+. switch (yyN) {
+
+ actions ## code from the actions within the grammar
+
+. }
+. yyTop -= yyLen[yyN];
+. yyState = yyStates[yyTop];
+. int yyM = yyLhs[yyN];
+. if (yyState == 0 && yyM == 0) {
+t if (yydebug != null) yydebug.shift(0, yyFinal);
+. yyState = yyFinal;
+. if (yyToken < 0) {
+. yyToken = yyLex.advance() ? yyLex.token() : 0;
+t if (yydebug != null)
+t yydebug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
+. }
+. if (yyToken == 0) {
+t if (yydebug != null) yydebug.accept(yyVal);
+. return yyVal;
+. }
+. continue yyLoop;
+. }
+. if ((yyN = yyGindex[yyM]) != 0 && (yyN += yyState) >= 0
+. && yyN < yyTable.length && yyCheck[yyN] == yyState)
+. yyState = yyTable[yyN];
+. else
+. yyState = yyDgoto[yyM];
+t if (yydebug != null) yydebug.shift(yyStates[yyTop], yyState);
+. continue yyLoop;
+. }
+. }
+. }
+.
+ tables ## tables for rules, default reduction, and action calls
+.
+ epilog ## text following second %%
diff --git a/mcs/jay/skeleton.cs b/mcs/jay/skeleton.cs
new file mode 100644
index 00000000000..a2ed00734f7
--- /dev/null
+++ b/mcs/jay/skeleton.cs
@@ -0,0 +1,352 @@
+# jay skeleton
+
+# character in column 1 determines outcome...
+# # is a comment
+# . is copied
+# t is copied as //t if -t is set
+# other lines are interpreted to call jay procedures
+
+.// created by jay 0.7 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
+.
+ prolog ## %{ ... %} prior to the first %%
+
+.
+. /** simplified error message.
+. @see <a href="#yyerror(java.lang.String, java.lang.String[])">yyerror</a>
+. */
+. public void yyerror (string message) {
+. yyerror(message, null);
+. }
+.
+. /** (syntax) error message.
+. Can be overwritten to control message format.
+. @param message text to be displayed.
+. @param expected vector of acceptable tokens, if available.
+. */
+. public void yyerror (string message, string[] expected) {
+. if ((expected != null) && (expected.Length > 0)) {
+. System.Console.Write (message+", expecting");
+. for (int n = 0; n < expected.Length; ++ n)
+. System.Console.Write (" "+expected[n]);
+. System.Console.WriteLine ();
+. } else
+. System.Console.WriteLine (message);
+. }
+.
+. /** debugging support, requires the package jay.yydebug.
+. Set to null to suppress debugging messages.
+. */
+t protected yydebug.yyDebug debug;
+.
+ debug ## tables for debugging support
+.
+. /** index-checked interface to yyName[].
+. @param token single character or %token value.
+. @return token name or [illegal] or [unknown].
+. */
+t public static string yyname (int token) {
+t if ((token < 0) || (token > yyName.Length)) return "[illegal]";
+t string name;
+t if ((name = yyName[token]) != null) return name;
+t return "[unknown]";
+t }
+.
+. /** computes list of expected tokens on error by tracing the tables.
+. @param state for which to compute the list.
+. @return list of token names.
+. */
+. protected string[] yyExpecting (int state) {
+. int token, n, len = 0;
+. bool[] ok = new bool[yyName.Length];
+.
+. if ((n = yySindex[state]) != 0)
+. for (token = n < 0 ? -n : 0;
+. (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
+. if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
+. ++ len;
+. ok[token] = true;
+. }
+. if ((n = yyRindex[state]) != 0)
+. for (token = n < 0 ? -n : 0;
+. (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
+. if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
+. ++ len;
+. ok[token] = true;
+. }
+.
+. string [] result = new string[len];
+. for (n = token = 0; n < len; ++ token)
+. if (ok[token]) result[n++] = yyName[token];
+. return result;
+. }
+.
+. /** the generated parser, with debugging messages.
+. Maintains a state and a value stack, currently with fixed maximum size.
+. @param yyLex scanner.
+. @param yydebug debug message writer implementing yyDebug, or null.
+. @return result of the last reduction, if any.
+. @throws yyException on irrecoverable parse error.
+. */
+. public Object yyparse (yyParser.yyInput yyLex, Object yyd)
+. {
+t this.debug = (yydebug.yyDebug)yyd;
+. return yyparse(yyLex);
+. }
+.
+. /** initial size and increment of the state/value stack [default 256].
+. This is not final so that it can be overwritten outside of invocations
+. of yyparse().
+. */
+. protected int yyMax;
+.
+. /** executed at the beginning of a reduce action.
+. Used as $$ = yyDefault($1), prior to the user-specified action, if any.
+. Can be overwritten to provide deep copy, etc.
+. @param first value for $1, or null.
+. @return first.
+. */
+. protected Object yyDefault (Object first) {
+. return first;
+. }
+.
+. /** the generated parser.
+. Maintains a state and a value stack, currently with fixed maximum size.
+. @param yyLex scanner.
+. @return result of the last reduction, if any.
+. @throws yyException on irrecoverable parse error.
+. */
+. public Object yyparse (yyParser.yyInput yyLex)
+. {
+. if (yyMax <= 0) yyMax = 256; // initial size
+. int yyState = 0; // state stack ptr
+. int [] yyStates = new int[yyMax]; // state stack
+. Object yyVal = null; // value stack ptr
+. Object [] yyVals = new Object[yyMax]; // value stack
+. int yyToken = -1; // current input
+. int yyErrorFlag = 0; // #tks to shift
+.
+ local ## %{ ... %} after the first %%
+
+. int yyTop = 0;
+. goto skip;
+. yyLoop:
+. yyTop++;
+. skip:
+. for (;; ++ yyTop) {
+. if (yyTop >= yyStates.Length) { // dynamically increase
+. int[] i = new int[yyStates.Length+yyMax];
+. System.Array.Copy(yyStates, i, 0);
+. yyStates = i;
+. Object[] o = new Object[yyVals.Length+yyMax];
+. System.Array.Copy(yyVals, o, 0);
+. yyVals = o;
+. }
+. yyStates[yyTop] = yyState;
+. yyVals[yyTop] = yyVal;
+t if (debug != null) debug.push(yyState, yyVal);
+.
+. yyDiscarded: for (;;) { // discarding a token does not change stack
+. int yyN;
+. if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
+. if (yyToken < 0) {
+. yyToken = yyLex.advance() ? yyLex.token() : 0;
+t if (debug != null)
+t debug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
+. }
+. if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0)
+. && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) {
+t if (debug != null)
+t debug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
+. yyState = yyTable[yyN]; // shift to yyN
+. yyVal = yyLex.value();
+. yyToken = -1;
+. if (yyErrorFlag > 0) -- yyErrorFlag;
+. goto yyLoop;
+. }
+. if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
+. && yyN < yyTable.Length && yyCheck[yyN] == yyToken)
+. yyN = yyTable[yyN]; // reduce (yyN)
+. else
+. switch (yyErrorFlag) {
+.
+. case 0:
+. yyerror("syntax error", yyExpecting(yyState));
+t if (debug != null) debug.error("syntax error");
+. goto case 1;
+. case 1: case 2:
+. yyErrorFlag = 3;
+. do {
+. if ((yyN = yySindex[yyStates[yyTop]]) != 0
+. && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length
+. && yyCheck[yyN] == Token.yyErrorCode) {
+t if (debug != null)
+t debug.shift(yyStates[yyTop], yyTable[yyN], 3);
+. yyState = yyTable[yyN];
+. yyVal = yyLex.value();
+. goto yyLoop;
+. }
+t if (debug != null) debug.pop(yyStates[yyTop]);
+. } while (-- yyTop >= 0);
+t if (debug != null) debug.reject();
+. throw new yyParser.yyException("irrecoverable syntax error");
+.
+. case 3:
+. if (yyToken == 0) {
+t if (debug != null) debug.reject();
+. throw new yyParser.yyException("irrecoverable syntax error at end-of-file");
+. }
+t if (debug != null)
+t debug.discard(yyState, yyToken, yyname(yyToken),
+t yyLex.value());
+. yyToken = -1;
+. goto yyDiscarded; // leave stack alone
+. }
+. }
+. int yyV = yyTop + 1-yyLen[yyN];
+t if (debug != null)
+t debug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]);
+. yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
+. switch (yyN) {
+
+ actions ## code from the actions within the grammar
+
+. }
+. yyTop -= yyLen[yyN];
+. yyState = yyStates[yyTop];
+. int yyM = yyLhs[yyN];
+. if (yyState == 0 && yyM == 0) {
+t if (debug != null) debug.shift(0, yyFinal);
+. yyState = yyFinal;
+. if (yyToken < 0) {
+. yyToken = yyLex.advance() ? yyLex.token() : 0;
+t if (debug != null)
+t debug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
+. }
+. if (yyToken == 0) {
+t if (debug != null) debug.accept(yyVal);
+. return yyVal;
+. }
+. goto yyLoop;
+. }
+. if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0)
+. && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState))
+. yyState = yyTable[yyN];
+. else
+. yyState = yyDgoto[yyM];
+t if (debug != null) debug.shift(yyStates[yyTop], yyState);
+. goto yyLoop;
+. }
+. }
+. }
+.
+ tables ## tables for rules, default reduction, and action calls
+.
+ epilog ## text following second %%
+.namespace yydebug {
+. using System;
+. public interface yyDebug {
+. void push (int state, Object value);
+. void lex (int state, int token, string name, Object value);
+. void shift (int from, int to, int errorFlag);
+. void pop (int state);
+. void discard (int state, int token, string name, Object value);
+. void reduce (int from, int to, int rule, string text, int len);
+. void shift (int from, int to);
+. void accept (Object value);
+. void error (string message);
+. void reject ();
+. }
+.
+. class yyDebugSimple : yyDebug {
+. void println (string s){
+. Console.WriteLine (s);
+. }
+.
+. public void push (int state, Object value) {
+. println ("push\tstate "+state+"\tvalue "+value);
+. }
+.
+. public void lex (int state, int token, string name, Object value) {
+. println("lex\tstate "+state+"\treading "+name+"\tvalue "+value);
+. }
+.
+. public void shift (int from, int to, int errorFlag) {
+. switch (errorFlag) {
+. default: // normally
+. println("shift\tfrom state "+from+" to "+to);
+. break;
+. case 0: case 1: case 2: // in error recovery
+. println("shift\tfrom state "+from+" to "+to
+. +"\t"+errorFlag+" left to recover");
+. break;
+. case 3: // normally
+. println("shift\tfrom state "+from+" to "+to+"\ton error");
+. break;
+. }
+. }
+.
+. public void pop (int state) {
+. println("pop\tstate "+state+"\ton error");
+. }
+.
+. public void discard (int state, int token, string name, Object value) {
+. println("discard\tstate "+state+"\ttoken "+name+"\tvalue "+value);
+. }
+.
+. public void reduce (int from, int to, int rule, string text, int len) {
+. println("reduce\tstate "+from+"\tuncover "+to
+. +"\trule ("+rule+") "+text);
+. }
+.
+. public void shift (int from, int to) {
+. println("goto\tfrom state "+from+" to "+to);
+. }
+.
+. public void accept (Object value) {
+. println("accept\tvalue "+value);
+. }
+.
+. public void error (string message) {
+. println("error\t"+message);
+. }
+.
+. public void reject () {
+. println("reject");
+. }
+.
+. }
+.}
+.// %token constants
+. class Token {
+ tokens public const int
+. }
+. namespace yyParser {
+. using System;
+. /** thrown for irrecoverable syntax errors and stack overflow.
+. */
+. public class yyException : System.Exception {
+. public yyException (string message) : base (message) {
+. }
+. }
+.
+. /** must be implemented by a scanner object to supply input to the parser.
+. */
+. public interface yyInput {
+. /** move on to next token.
+. @return false if positioned beyond tokens.
+. @throws IOException on input error.
+. */
+. bool advance (); // throws java.io.IOException;
+. /** classifies current token.
+. Should not be called if advance() returned false.
+. @return current %token or single character.
+. */
+. int token ();
+. /** associated with current token.
+. Should not be called if advance() returned false.
+. @return value for token().
+. */
+. Object value ();
+. }
+. }
+.} // close outermost namespace, that MUST HAVE BEEN opened in the prolog
diff --git a/mcs/jay/symtab.c b/mcs/jay/symtab.c
new file mode 100644
index 00000000000..0c5f55c535b
--- /dev/null
+++ b/mcs/jay/symtab.c
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)symtab.c 5.3 (Berkeley) 6/1/90";
+#endif /* not lint */
+
+#include "defs.h"
+
+/* TABLE_SIZE is the number of entries in the symbol table. */
+/* TABLE_SIZE must be a power of two. */
+
+#define TABLE_SIZE 1024
+
+
+bucket **symbol_table;
+bucket *first_symbol;
+bucket *last_symbol;
+
+
+int
+hash(name)
+char *name;
+{
+ register char *s;
+ register int c, k;
+
+ assert(name && *name);
+ s = name;
+ k = *s;
+ while (c = *++s)
+ k = (31*k + c) & (TABLE_SIZE - 1);
+
+ return (k);
+}
+
+
+bucket *
+make_bucket(name)
+char *name;
+{
+ register bucket *bp;
+
+ assert(name);
+ bp = (bucket *) MALLOC(sizeof(bucket));
+ if (bp == 0) no_space();
+ bp->link = 0;
+ bp->next = 0;
+ bp->name = MALLOC(strlen(name) + 1);
+ if (bp->name == 0) no_space();
+ bp->tag = 0;
+ bp->value = UNDEFINED;
+ bp->index = 0;
+ bp->prec = 0;
+ bp-> class = UNKNOWN;
+ bp->assoc = TOKEN;
+
+ if (bp->name == 0) no_space();
+ strcpy(bp->name, name);
+
+ return (bp);
+}
+
+
+bucket *
+lookup(name)
+char *name;
+{
+ register bucket *bp, **bpp;
+
+ bpp = symbol_table + hash(name);
+ bp = *bpp;
+
+ while (bp)
+ {
+ if (strcmp(name, bp->name) == 0) return (bp);
+ bpp = &bp->link;
+ bp = *bpp;
+ }
+
+ *bpp = bp = make_bucket(name);
+ last_symbol->next = bp;
+ last_symbol = bp;
+
+ return (bp);
+}
+
+
+create_symbol_table()
+{
+ register int i;
+ register bucket *bp;
+
+ symbol_table = (bucket **) MALLOC(TABLE_SIZE*sizeof(bucket *));
+ if (symbol_table == 0) no_space();
+ for (i = 0; i < TABLE_SIZE; i++)
+ symbol_table[i] = 0;
+
+ bp = make_bucket("error");
+ bp->index = 1;
+ bp->class = TERM;
+
+ first_symbol = bp;
+ last_symbol = bp;
+ symbol_table[hash("error")] = bp;
+}
+
+
+free_symbol_table()
+{
+ FREE(symbol_table);
+ symbol_table = 0;
+}
+
+
+free_symbols()
+{
+ register bucket *p, *q;
+
+ for (p = first_symbol; p; p = q)
+ {
+ q = p->next;
+ FREE(p);
+ }
+}
diff --git a/mcs/jay/verbose.c b/mcs/jay/verbose.c
new file mode 100644
index 00000000000..33ae265ee2e
--- /dev/null
+++ b/mcs/jay/verbose.c
@@ -0,0 +1,366 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)verbose.c 5.3 (Berkeley) 1/20/91";
+#endif /* not lint */
+
+#include "defs.h"
+
+static short *null_rules;
+
+verbose()
+{
+ register int i;
+
+ if (!vflag) return;
+
+ null_rules = (short *) MALLOC(nrules*sizeof(short));
+ if (null_rules == 0) no_space();
+ fprintf(verbose_file, "\f\n");
+ for (i = 0; i < nstates; i++)
+ print_state(i);
+ FREE(null_rules);
+
+ if (nunused)
+ log_unused();
+ if (SRtotal || RRtotal)
+ log_conflicts();
+
+ fprintf(verbose_file, "\n\n%d terminals, %d nonterminals\n", ntokens,
+ nvars);
+ fprintf(verbose_file, "%d grammar rules, %d states\n", nrules - 2, nstates);
+}
+
+
+log_unused()
+{
+ register int i;
+ register short *p;
+
+ fprintf(verbose_file, "\n\nRules never reduced:\n");
+ for (i = 3; i < nrules; ++i)
+ {
+ if (!rules_used[i])
+ {
+ fprintf(verbose_file, "\t%s :", symbol_name[rlhs[i]]);
+ for (p = ritem + rrhs[i]; *p >= 0; ++p)
+ fprintf(verbose_file, " %s", symbol_name[*p]);
+ fprintf(verbose_file, " (%d)\n", i - 2);
+ }
+ }
+}
+
+
+log_conflicts()
+{
+ register int i;
+
+ fprintf(verbose_file, "\n\n");
+ for (i = 0; i < nstates; i++)
+ {
+ if (SRconflicts[i] || RRconflicts[i])
+ {
+ fprintf(verbose_file, "State %d contains ", i);
+ if (SRconflicts[i] == 1)
+ fprintf(verbose_file, "1 shift/reduce conflict");
+ else if (SRconflicts[i] > 1)
+ fprintf(verbose_file, "%d shift/reduce conflicts",
+ SRconflicts[i]);
+ if (SRconflicts[i] && RRconflicts[i])
+ fprintf(verbose_file, ", ");
+ if (RRconflicts[i] == 1)
+ fprintf(verbose_file, "1 reduce/reduce conflict");
+ else if (RRconflicts[i] > 1)
+ fprintf(verbose_file, "%d reduce/reduce conflicts",
+ RRconflicts[i]);
+ fprintf(verbose_file, ".\n");
+ }
+ }
+}
+
+
+print_state(state)
+int state;
+{
+ if (state)
+ fprintf(verbose_file, "\n\n");
+ if (SRconflicts[state] || RRconflicts[state])
+ print_conflicts(state);
+ fprintf(verbose_file, "state %d\n", state);
+ print_core(state);
+ print_nulls(state);
+ print_actions(state);
+}
+
+
+print_conflicts(state)
+int state;
+{
+ register int symbol, act, number;
+ register action *p;
+
+ symbol = -1;
+ for (p = parser[state]; p; p = p->next)
+ {
+ if (p->suppressed == 2)
+ continue;
+
+ if (p->symbol != symbol)
+ {
+ symbol = p->symbol;
+ number = p->number;
+ if (p->action_code == SHIFT)
+ act = SHIFT;
+ else
+ act = REDUCE;
+ }
+ else if (p->suppressed == 1)
+ {
+ if (state == final_state && symbol == 0)
+ {
+ fprintf(verbose_file, "%d: shift/reduce conflict \
+(accept, reduce %d) on $end\n", state, p->number - 2);
+ }
+ else
+ {
+ if (act == SHIFT)
+ {
+ fprintf(verbose_file, "%d: shift/reduce conflict \
+(shift %d, reduce %d) on %s\n", state, number, p->number - 2,
+ symbol_name[symbol]);
+ }
+ else
+ {
+ fprintf(verbose_file, "%d: reduce/reduce conflict \
+(reduce %d, reduce %d) on %s\n", state, number - 2, p->number - 2,
+ symbol_name[symbol]);
+ }
+ }
+ }
+ }
+}
+
+
+print_core(state)
+int state;
+{
+ register int i;
+ register int k;
+ register int rule;
+ register core *statep;
+ register short *sp;
+ register short *sp1;
+
+ statep = state_table[state];
+ k = statep->nitems;
+
+ for (i = 0; i < k; i++)
+ {
+ sp1 = sp = ritem + statep->items[i];
+
+ while (*sp >= 0) ++sp;
+ rule = -(*sp);
+ fprintf(verbose_file, "\t%s : ", symbol_name[rlhs[rule]]);
+
+ for (sp = ritem + rrhs[rule]; sp < sp1; sp++)
+ fprintf(verbose_file, "%s ", symbol_name[*sp]);
+
+ putc('.', verbose_file);
+
+ while (*sp >= 0)
+ {
+ fprintf(verbose_file, " %s", symbol_name[*sp]);
+ sp++;
+ }
+ fprintf(verbose_file, " (%d)\n", -2 - *sp);
+ }
+}
+
+
+print_nulls(state)
+int state;
+{
+ register action *p;
+ register int i, j, k, nnulls;
+
+ nnulls = 0;
+ for (p = parser[state]; p; p = p->next)
+ {
+ if (p->action_code == REDUCE &&
+ (p->suppressed == 0 || p->suppressed == 1))
+ {
+ i = p->number;
+ if (rrhs[i] + 1 == rrhs[i+1])
+ {
+ for (j = 0; j < nnulls && i > null_rules[j]; ++j)
+ continue;
+
+ if (j == nnulls)
+ {
+ ++nnulls;
+ null_rules[j] = i;
+ }
+ else if (i != null_rules[j])
+ {
+ ++nnulls;
+ for (k = nnulls - 1; k > j; --k)
+ null_rules[k] = null_rules[k-1];
+ null_rules[j] = i;
+ }
+ }
+ }
+ }
+
+ for (i = 0; i < nnulls; ++i)
+ {
+ j = null_rules[i];
+ fprintf(verbose_file, "\t%s : . (%d)\n", symbol_name[rlhs[j]],
+ j - 2);
+ }
+ fprintf(verbose_file, "\n");
+}
+
+
+print_actions(stateno)
+int stateno;
+{
+ register action *p;
+ register shifts *sp;
+ register int as;
+
+ if (stateno == final_state)
+ fprintf(verbose_file, "\t$end accept\n");
+
+ p = parser[stateno];
+ if (p)
+ {
+ print_shifts(p);
+ print_reductions(p, defred[stateno]);
+ }
+
+ sp = shift_table[stateno];
+ if (sp && sp->nshifts > 0)
+ {
+ as = accessing_symbol[sp->shift[sp->nshifts - 1]];
+ if (ISVAR(as))
+ print_gotos(stateno);
+ }
+}
+
+
+print_shifts(p)
+register action *p;
+{
+ register int count;
+ register action *q;
+
+ count = 0;
+ for (q = p; q; q = q->next)
+ {
+ if (q->suppressed < 2 && q->action_code == SHIFT)
+ ++count;
+ }
+
+ if (count > 0)
+ {
+ for (; p; p = p->next)
+ {
+ if (p->action_code == SHIFT && p->suppressed == 0)
+ fprintf(verbose_file, "\t%s shift %d\n",
+ symbol_name[p->symbol], p->number);
+ }
+ }
+}
+
+
+print_reductions(p, defred)
+register action *p;
+register int defred;
+{
+ register int k, anyreds;
+ register action *q;
+
+ anyreds = 0;
+ for (q = p; q ; q = q->next)
+ {
+ if (q->action_code == REDUCE && q->suppressed < 2)
+ {
+ anyreds = 1;
+ break;
+ }
+ }
+
+ if (anyreds == 0)
+ fprintf(verbose_file, "\t. error\n");
+ else
+ {
+ for (; p; p = p->next)
+ {
+ if (p->action_code == REDUCE && p->number != defred)
+ {
+ k = p->number - 2;
+ if (p->suppressed == 0)
+ fprintf(verbose_file, "\t%s reduce %d\n",
+ symbol_name[p->symbol], k);
+ }
+ }
+
+ if (defred > 0)
+ fprintf(verbose_file, "\t. reduce %d\n", defred - 2);
+ }
+}
+
+
+print_gotos(stateno)
+int stateno;
+{
+ register int i, k;
+ register int as;
+ register short *to_state;
+ register shifts *sp;
+
+ putc('\n', verbose_file);
+ sp = shift_table[stateno];
+ to_state = sp->shift;
+ for (i = 0; i < sp->nshifts; ++i)
+ {
+ k = to_state[i];
+ as = accessing_symbol[k];
+ if (ISVAR(as))
+ fprintf(verbose_file, "\t%s goto %d\n", symbol_name[as], k);
+ }
+}
diff --git a/mcs/jay/warshall.c b/mcs/jay/warshall.c
new file mode 100644
index 00000000000..4672244e368
--- /dev/null
+++ b/mcs/jay/warshall.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Robert Paul Corbett.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)warshall.c 5.4 (Berkeley) 5/24/93";
+#endif /* not lint */
+
+#include "defs.h"
+
+transitive_closure(R, n)
+unsigned *R;
+int n;
+{
+ register int rowsize;
+ register unsigned i;
+ register unsigned *rowj;
+ register unsigned *rp;
+ register unsigned *rend;
+ register unsigned *ccol;
+ register unsigned *relend;
+ register unsigned *cword;
+ register unsigned *rowi;
+
+ rowsize = WORDSIZE(n);
+ relend = R + n*rowsize;
+
+ cword = R;
+ i = 0;
+ rowi = R;
+ while (rowi < relend)
+ {
+ ccol = cword;
+ rowj = R;
+
+ while (rowj < relend)
+ {
+ if (*ccol & (1 << i))
+ {
+ rp = rowi;
+ rend = rowj + rowsize;
+ while (rowj < rend)
+ *rowj++ |= *rp++;
+ }
+ else
+ {
+ rowj += rowsize;
+ }
+
+ ccol += rowsize;
+ }
+
+ if (++i >= BITS_PER_WORD)
+ {
+ i = 0;
+ cword++;
+ }
+
+ rowi += rowsize;
+ }
+}
+
+reflexive_transitive_closure(R, n)
+unsigned *R;
+int n;
+{
+ register int rowsize;
+ register unsigned i;
+ register unsigned *rp;
+ register unsigned *relend;
+
+ transitive_closure(R, n);
+
+ rowsize = WORDSIZE(n);
+ relend = R + n*rowsize;
+
+ i = 0;
+ rp = R;
+ while (rp < relend)
+ {
+ *rp |= (1 << i);
+ if (++i >= BITS_PER_WORD)
+ {
+ i = 0;
+ rp++;
+ }
+
+ rp += rowsize;
+ }
+}
diff --git a/mcs/makefile b/mcs/makefile
new file mode 100755
index 00000000000..981259a664c
--- /dev/null
+++ b/mcs/makefile
@@ -0,0 +1,23 @@
+DIRS=jay nant mcs class nunit tools
+
+all: linux
+
+windows:
+ for i in $(DIRS); do \
+ (cd $$i; make linux) \
+ done
+
+linux:
+ for i in $(DIRS); do \
+ (cd $$i; make linux) || exit 1; \
+ done
+
+test:
+ (cd nunit; make)
+ (cd class; make test)
+
+clean:
+ for i in $(DIRS); do \
+ (cd $$i; make clean) \
+ done
+
diff --git a/mcs/mcs/.cvsignore b/mcs/mcs/.cvsignore
new file mode 100644
index 00000000000..9c5f9364012
--- /dev/null
+++ b/mcs/mcs/.cvsignore
@@ -0,0 +1,5 @@
+compiler.pdb
+compiler.exe
+cs-parser.cs
+y.output
+*.pdb
diff --git a/mcs/mcs/ChangeLog b/mcs/mcs/ChangeLog
index 202a33903dc..4fb328d5ab9 100755
--- a/mcs/mcs/ChangeLog
+++ b/mcs/mcs/ChangeLog
@@ -1,3 +1,6220 @@
+2002-04-24 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: Fix the case where the argument to params if the
+ type of the params. I omitted handling this before. Fixed
+
+2002-04-22 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs: Call BootCorlib_PopulateCoreType
+
+ * class.cs (Property.CheckBase): Check for properties only, not
+ for all members.
+
+ * interface.cs: Temporary hack: try/catch around the
+ CustomAttributeBuilder, because I am getting an exception that I
+ do not understand.
+
+ * rootcontext.cs (BootCorlib_PopulateCoreType): Populate some
+ types whose definitions are required to be there (attributes are
+ defined before standard types).
+
+ Compute definitions as we boot the various types, as they are used
+ immediately (value_type class will need object_type, but if we do
+ not initialize object_type, we will pass a null, which will let
+ the runtime pick the System.Object from the existing corlib, which
+ is not what we want).
+
+2002-04-22 Patrik Torstensson <totte@labs2.com>
+
+ * cs-tokenizer.cs: fixed a number of trim() issues.
+
+2002-04-22 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Argument.Type): Ensure that we return the correct
+ type when we have out or ref parameters [in which case we
+ append a "&"].
+
+2002-04-22 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (Property, Indexer): Allow extern modifier in there.
+
+ * typemanager.cs (InitBaseTypes): Initializes object_type and
+ value_type, since those will be used early on during the bootstrap
+ process to compile corlib.
+
+ (InitCoreTypes): Move code from here to InitBaseTypes.
+
+2002-04-21 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (PropertyExpr): Optimize calls to Array::get_Length on
+ single-dimension arrays as using the ldlen opcode.
+
+ Daniel Lewis discovered this optimization.
+
+ * typemanager.cs: Add signature for System.Array::get_Length
+
+2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * statement.cs: report the error when the foreach does not apply to an
+ array nor a collection.
+
+2002-04-19 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: Add implicit conversions to the operator ~.
+
+ * constant.cs (DecimalConstant.Emit): Emit decimal value.
+
+ * typemanager.cs: Locate the decimal constructor.
+
+2002-04-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * attribute.cs: use the new property of TypeOf.
+ * expression.cs: added 'get' property around typearg.
+
+ These changes fix a build breaker reported by NickD. Is this the
+ correct way to fix? If not, please, revert my changes and make it
+ work :-).
+
+2002-04-17 Miguel de Icaza <miguel@ximian.com>
+
+ * attribute.cs: Add support for typeof in attribute invocations.
+ I am not sure that this is right though.
+
+2002-04-14 Duncan Mak <duncan@ximian.com>
+
+ * cfold.cs (BinaryFold): Catch DivideByZeroException in the
+ Binary.Operator.Division case.
+
+2002-04-13 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (DefineType): Ensure that we do a proper check on
+ attribute types and also register it with the TypeManager.
+
+ (TypeContainer.Targets): The default for attribute types is
+ AttributeTargets.All.
+
+ * attribute.cs (ApplyAttributes): Registering the attribute type
+ is done elsewhere, not when we discover we have a Usage attribute.
+
+2002-04-12 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (VerifyArgumentsCompat): Implement Miguel's suggestion
+ and get rid of is_delegate parameter.
+
+ * everywhere : update.
+
+2002-04-12 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (compilation_unit): Revamp completely to use
+ some new ideas that I got from Rhys' grammar to solve the problems
+ with assembly level attributes.
+
+ (outer_declaration): New grammar production.
+
+ (attribute_sections): Add.
+
+ (opt_attributes): Base on attribute_sections
+
+ (namespace_declaration): Allow opt_attributes to tackle the case
+ when we have assembly level attributes - we are clever in this
+ regard now ;-)
+
+ * attribute.cs (ApplyAttributes): Do not worry about assembly
+ attributes in the non-global context.
+
+ * rootcontext.cs (AddGlobalAttributes): Go back to using this
+ instead of SetGlobalAttributes.
+
+ * class.cs, rootcontext.cs : Ensure we define and generate
+ attribute types before anything else.
+
+ * attribute.cs (CheckAttribute and GetValidPlaces): Handle the exception
+ and flag the new error -20 for the case when the attribute type
+ does not have valid targets specified. csc does not catch this.
+
+ * ../errors/errors.txt : update for error # -20
+
+2002-04-11 Ravi Pratap <ravi@ximian.com>
+
+ * support.cs (InternalParameters.ParameterModifier): Do some null
+ checking and return sane values.
+
+ * class.cs (Method.Define): If we are a PInvoke method, ensure
+ that we are static and extern. Report error # 601
+
+ * ../errors/cs0601.cs : Add test case for the above error.
+
+2002-04-07 Ravi Pratap <ravi@ximian.com>
+
+ * rootcontext.cs (attribute_types): We need to keep type of
+ all attribute types separately and emit code for them first.
+
+ (RegisterAttribute) : Implement.
+
+ * class.cs (DefineType): Check if the current Type is a custom
+ attribute type and register it accordingly.
+
+ * rootcontext.cs (AddGlobalAttributes): Fix silly bug where we were
+ adding the first attribute twice and rename to
+
+ (SetGlobalAttributes): this.
+
+ * rootcontext.cs (NamespaceLookup): Run through the aliases too and perform
+ lookups.
+
+ * attribute.cs (ApplyAttributes): Take an additional argument telling us
+ if we are processing global arguments. Hmm, I am unsure of this.
+
+2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * expression.cs: added static array of strings to avoid calling
+ Enum.ToString () for Operator in Binary. Significant recover of
+ performance.
+
+2002-04-10 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (FindMembers): Allow the Builders of the various
+ members to be null. If they are skip them. This only happens
+ during the PInvoke declaration.
+
+2002-04-09 Miguel de Icaza <miguel@ximian.com>
+
+ * parameter.cs (Parameters.ComputeParameterTypes): Flag the
+ failure, so we do not keep going afterwards.
+
+ * expression.cs: (Invocation.OverloadResolve): I believe Ravi
+ wanted to pass `false' as the `is_delegate' argument. If this is
+ the case, why not use delegate_type == null to mean `is_delegate =
+ false' and anything else as is_delegate = true.
+
+Tue Apr 9 05:40:12 2002 Piers Haken <piersh@friskit.com>
+
+ * statement.cs: fixed SimpleSwitchEmit to make 'goto case' goto the
+ code for the section, not the beginning of the tests.
+
+2002-04-08 Miguel de Icaza <miguel@ximian.com>
+
+ * cfold.cs: Handle operator + (Enum x, Underlying x)
+
+ * expression.cs (Binary): same. Warn about errors where we have
+ Enum/Enum in operator + as well.
+
+Mon Apr 8 06:29:03 2002 Piers Haken <piersh@friskit.com>
+
+ * statement.cs:
+ - added support for switch(bool)
+ - optimize loading of I8/U8 constants (ldc.i4, iconv_i8)
+ - add TableSwitchEmit() to handle table-based switch statements
+
+2002-04-05 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Invocation.OverloadResolve): Factor out code which
+ does parameter compatibility checking with arguments so that we can
+ re-use the code even from Delegate.VerifyApplicability
+
+ (VerifyArgumentsCompat): Move above code here.
+
+ * delegate.cs (VerifyApplicability): Get rid of duplicate code
+ and instead make a call to the above method.
+
+2002-03-31 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (attribute_type): Corresponds to System.Attribute.
+ We use it to keep track of classes which are attribute types.
+
+2002-04-02 Miguel de Icaza <miguel@ximian.com>
+
+ * delegate.cs (Delegate.Define): Correctly define the types in the
+ presence of fixed and array parameters.
+
+ * class.cs (TypeContainers.FindMembers): Use NonPublic flag while
+ doing FindMembers.
+
+ * ecore.cs (Expression.MemberLookup): Reset binding flags to not
+ include NonPublic after the first iteration.
+
+ * class.cs (Indexer.CheckBase): Only check if both parents are
+ non-null.
+
+ * cs-parser.jay (accessor_body): If empty, set to null.
+
+ * ecore.cs (SimpleName.SimpleNameResolve): We did not have the
+ same code path here to resolve constants names that we did have in
+ MemberAccess.DoResolve. There is too much code duplicated here.
+
+2002-04-01 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs, makefile: Drop Statementcollection and just use ArrayLists
+
+ * ecore.cs: Optimize UserDefinedConversion by minimizing the calls
+ to MakeUnionSet.
+
+ * cs-tokenizer.cs: Reuse a single StringBuilder for assembling
+ tokens, numbers and strings.
+
+ * ecore.cs (MethodGroupExpr): Make Emit warn about missing
+ parenthesis.
+
+ * delegate.cs: Use ComputeAndDefineParameterTypes for both the
+ asyncronous parameters and the regular parameters.
+
+ * codegen.cs (CodeGen.Init): Use the constructor that allows us to
+ specify the target directory.
+
+ * expression.cs: (This.DoResolve): Simplify
+ (As.Emit): Optimize, do not generate IsInst if the expression is
+ always of the given type.
+
+ (Is.DoResolve): Bug fix, we were reporting both always/never for
+ the is expression.
+
+ * (Invocation.MakeUnionSet): Simplify vastly and optimize, we were
+ creating too many unnecessary arrays.
+
+2002-03-31 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (EmitFieldInitializer): Use Assign expression to assign
+ fields instead of rolling our own initializer. Takes care of all
+ implicit conversions, and drops unnecessary static checks/argument.
+
+2002-03-31 Dick Porter <dick@ximian.com>
+
+ * driver.cs: use the GetDirectories() return values properly, and
+ use "/" as path separator.
+
+2002-03-30 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Unary): Optimize - - expr into expr.
+ (Binary): Optimize a + (-b) into a -b.
+
+ * codegen.cs (CodeGen): Made all methods static.
+
+2002-03-29 Miguel de Icaza <miguel@ximian.com>
+
+ * rootcontext.cs:
+
+ * decl.cs: Rename `definition' into `TypeBuilder' and drop the
+ TypeBuilder property.
+
+ * cs-parser.jay: Drop the use of RecordXXX and use RecordDecl
+ instead.
+
+ * tree.cs: Removed the various RecordXXXX, and replaced with a
+ single RecordDecl. Removed all the accessor methods, and just
+ left a single access point Type
+
+ * enum.cs: Rename DefineEnum to DefineType.
+
+ * decl.cs: New abstract method `DefineType' used to unify the
+ Defines for Enumerations, Interfaces, TypeContainers and
+ Delegates.
+
+ (FindType): Moved LookupInterfaceOrClass here. Moved the
+ LookupBaseClasses method that used to live in class.cs and
+ interface.cs here, and renamed to FindType.
+
+ * delegate.cs: Implement DefineType. Take advantage of the
+ refactored pattern for locating the parent builder without taking
+ the parent_builder argument (which we know does not work if we are
+ nested, and triggering a toplevel definition).
+
+2002-03-28 Miguel de Icaza <miguel@ximian.com>
+
+ * decl.cs (MemberCore.CheckMethodAgainstBase): Test if the
+ accessibility of a member has changed during override and report
+ an error if so.
+
+ * class.cs (Method.Define, Property.Define): Only complain on
+ overrides if the method is private, any other accessibility is
+ fine (and since we just checked the permission is the same, we are
+ good to go).
+
+ * cs-tokenizer.cs: only line, region, endregion, if, endif, else
+ and elif are processed always. The other pre-processing
+ directives are only processed if we are "taking" the path
+
+2002-03-29 Martin Baulig <martin@gnome.org>
+
+ * class.cs (Method.Emit): Only emit symbolic debugging info if the
+ current location is not Null.
+
+ * codegen.cs (CodeGen.SaveSymbols): Split out symbol writing code into
+ a separate method so we can profile it.
+
+ * driver.cs (ShowTime): We need to use `(int) span.TotalSeconds' since
+ `span.Seconds' are just seconds, but no minutes or hours.
+ (MainDriver): Profile the CodeGen.SaveSymbols calls.
+
+2002-03-28 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (Method.Define), (Property.Define), (Indexer.Define):
+ Remove the gratuitous set of Final:
+
+ // If an interface implementation, then we can set Final.
+ if (((flags & MethodAttributes.Abstract) == 0) &&
+ implementing.DeclaringType.IsInterface)
+ flags |= MethodAttributes.Final;
+
+ I do not know what I was smoking when I used that.
+
+
+ * cs-parser.jay, delegate.cs: Make Delegate be a DeclSpace, first
+ step into fixing the name resolution issues for delegates and
+ unifying the toplevel name resolution.
+
+2002-03-28 Martin Baulig <martin@gnome.org>
+
+ * class.cs (Method.Emit): If we have a symbol writer, call its
+ OpenMethod(), CloseMethod() and SetMethodSourceRange() methods to
+ tell it about the current method.
+
+ * codegen.cs (EmitContext.Mark): New public method. Tell the symbol
+ writer that we're going to emit the first byte of IL code for a new
+ statement (a new source line).
+ (EmitContext.EmitTopBlock): If we have a symbol writer, call
+ EmitContext.Mark() before emitting any code.
+
+ * location.cs (SymbolDocument): Return null when we're Null.
+
+ * statement.cs (Statement): Moved the `Location loc' variable here.
+ (Statement.EmitBoolExpression): If we have a symbol writer, call
+ ec.Mark() before emitting any code to tell it that we're at the
+ beginning of a new statement.
+ (StatementExpression): Added `Location' argument to the constructor.
+ (Block): Added public readonly variable `StartLocation' and public
+ variable `EndLocation'. The latter is to be set using SetEndLocation().
+ (Block): Added constructor which takes a start and end location.
+ (Block.SetEndLocation): New method. This sets the end location.
+ (Block.EmitMeta): If we have a symbol writer, tell it the names of the
+ local variables we create.
+ (Block.Emit): If we have a symbol writer, call ec.Mark() before emitting
+ each statement and do also mark the begin and end of the block.
+
+ * cs-parser.jay (block : OPEN_BRACE): Use the new `Block' constructor to
+ tell it the current lexer.Location, use Location.Null for the end of the
+ block.
+ (block : OPEN_BRACE opt_statement_list CLOSE_BRACE): When closing the
+ current block, set its end location using SetEndLocation().
+ (statement_expression): StatementExpression constructor now takes the
+ lexer.Location as additional argument.
+ (for_statement, declare_local_variables): Likewise.
+ (declare_local_variables): When creating a new implicit block, use the
+ new Block constructor and pass it the lexer.Location.
+
+2002-03-28 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (Expression.MemberLookup): On interfaces, lookup
+ members also on the parent interfaces recursively.
+
+2002-03-27 Miguel de Icaza <miguel@ximian.com>
+
+ * report.cs: Use new formats, since Gonzalo finished the missing
+ bits.
+
+ * expression.cs (Binary.ResolveOperator): added missing operator|
+ operator& and operator^ for bool/bool.
+
+ * cs-parser.jay: CheckDef now takes a Location argument that is
+ used to report errors more precisly (instead of reporting the end
+ of a definition, we try to track something which is a lot closer
+ to the source of the problem).
+
+ * cs-tokenizer.cs: Track global token use, so we can properly flag
+ the use of #define/#undef after the first token has been seen.
+
+ Also, rename the reportXXXX to Error_DescriptiveName
+
+ * decl.cs (DeclSpace.IsTopLevel): Move property here from
+ TypeContainer, so that Enum and Interface can use this too.
+
+ * class.cs (TypeContainer.LookupInterfaceOrClass,
+ GetInterfaceOrClass, GetClassBases, DefineType): Drop the
+ `builder' argument. Typically this was used to pass the parent
+ builder (a ModuleBuilder or a TypeBuilder from whoever triggered
+ the definition).
+
+ The problem is that a nested class could trigger the definition of
+ a toplevel class, and the builder would be obviously wrong in that
+ case.
+
+ So we drop this argument, and we compute dynamically the
+ TypeBuilder/ModuleBuilder (the correct information was available
+ to us anyways from DeclSpace.Parent)
+
+ * interface.cs (Interface.DefineInterface): Drop builder
+ parameter cleanup like class.cs
+
+ * enum.cs (Enum.DefineEnum): Drop builder parameter. Clean up
+ like class.cs
+
+ * statement.cs (Switch.EmitObjectInteger): Emit short/ushort
+ values.
+
+ (Try.Emit): Propagate the returns value from the statement.
+
+ (Return.Emit): Even if we are leavning
+
+ * driver.cs: Catch IOExpcetion for Directory.GetFiles as well.
+
+ * modifiers.cs: Fix the computation of MethodAttributes flags.
+
+Tue Mar 26 21:14:36 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * driver.cs: allow compilation of files that start with '/'.
+ Add a default case when checking the argument of --target.
+
+2002-03-25 Miguel de Icaza <miguel@ximian.com>
+
+ * interface.cs: Implement the same search algorithm for types in
+ the interface code.
+
+ * delegate.cs: Do not allow multiple definition.
+
+ * Recovered ChangeLog that got accidentally amputated
+
+ * interface.cs (Interface.DefineInterface): Prevent from double definitions.
+
+ * rootcontext.cs: Load manually enum to allow core classes to
+ contain enumerations.
+
+ * enum.cs, ecore.cs, driver.cs, attribute.cs, class.cs, expression.cs:
+ Update to new static methods in TypeManager.
+
+ * typemanager.cs (GetMethod, GetConstructor): Use our
+ implementation of FindMembers to find the members, since during
+ corlib compilation, the types are TypeBuilders and GetMethod and
+ GetConstructor do not work.
+
+ Make all methods in TypeManager static.
+
+ (InitCodeHelpers): Split the functionality from
+ the InitCodeTypes function.
+
+ * driver.cs: Call InitCodeHelpers after we have populated the
+ types.
+
+ * cs-parser.jay (delegate_declaration): we did not used to compute
+ the delegate name correctly for void delegates.
+
+2002-03-24 Miguel de Icaza <miguel@ximian.com>
+
+ * rootcontext.cs (RootContext): Init the interface_resolve_order
+ and type_container_resolve_order always.
+
+ (ResolveCore, BootstrapCorlib_ResolveClass,
+ BootstrapCorlib_ResolveStruct): New functions to bootstrap the
+ compiler when compiling with --nostdlib
+
+ * class.cs (TypeContainer.DefineType): Check that our parent is
+ not null. This test is most important when we are bootstraping
+ the core types.
+
+ * codegen.cs: Split out the symbol writing code.
+
+2002-03-25 Martin Baulig <martin@gnome.org>
+
+ * driver.cs (-g): Made -g an alias for --debug.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * codegen.cs (SymbolWriter): New public variable. Returns the
+ current symbol writer.
+ (CodeGen): Added `bool want_debugging_support' argument to the
+ constructor. If true, tell the ModuleBuild that we want debugging
+ support and ask it for the ISymbolWriter.
+ (Save): If we have a symbol writer, call it's Close() method after
+ saving the assembly.
+
+ * driver.c (--debug): New command line argument to create a
+ debugger information file.
+
+ * location.cs (SymbolDocument): New public property. Returns an
+ ISymbolDocumentWriter object for the current source file or null
+ if we don't have a symbol writer.
+
+2002-03-21 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs (LoadAssembly): Correctly return when all the paths
+ have been tried and not before.
+
+ * statement.cs (Switch.Emit): return the actual coverage for this
+ statement (returns/not-returns)
+
+ (Switch.SimpleSwitchEmit): Do not generate jumps to the end of the
+ switch of the statement if we are the last switch section. That
+ kills two problems: try/catch problems (we used to emit an empty
+ nop at the end) and switch statements where all branches would
+ return.
+
+2002-03-19 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs: Add default assemblies (the equivalent to the
+ Microsoft CSC.RSP file)
+
+ * cs-tokenizer.cs: When updating `cols and setting it to zero,
+ also update tokens_seen and set it to false.
+
+ * driver.cs: Implement --recurse for Mike.
+
+ * driver.cs (SplitPathAndPattern): Small bug fix, I was not
+ correctly splitting out the paths.
+
+2002-03-18 Miguel de Icaza <miguel@ximian.com>
+
+ * interface.cs (Interface.PopulateProperty): Instead of using
+ `parent' as the declaration space for the set parameters, use
+ `this'
+
+ * support.cs (InternalParameters): InternalParameters constructor
+ takes a DeclSpace instead of a TypeContainer.
+
+ * expression.cs (ArrayCreation.EmitDynamicInitializers): If value
+ types are being initialized, load the address of it before calling
+ the function.
+
+ (New): Provide a mechanism to disable the generation of local
+ value type temporaries when the caller will be providing us with
+ an address to store it.
+
+ (ArrayCreation.EmitDynamicInitializers): Use it.
+
+2002-03-17 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Invocation.EmitArguments): Only probe for array
+ property if there is more than one argument. Sorry about that.
+
+ * class.cs (Invocation.EmitArguments): Fix to emit arguments for
+ empty param arrays.
+
+ * class.cs (Method.LabelParameters): Fix incorrect code path that
+ prevented the `ParamArrayAttribute' from being applied to the
+ params attribute.
+
+2002-03-16 Miguel de Icaza <miguel@ximian.com>
+
+ * support.cs (ReflectionParameters): Correctly compute whether the
+ last argument is a params array. Fixes the problem with
+ string.Split ('a')
+
+ * typemanager.cs: Make the assemblies array always be non-null
+ (empty, but non-null)
+
+ * tree.cs (RecordDecl): New function that abstracts the recording
+ of names. This reports error 101, and provides a pointer to the
+ previous declaration. Fixes a crash in the compiler.
+
+ * cs-parser.jay (constructor_declaration): Update to new grammar,
+ and provide a constructor_body that can be empty.
+
+2002-03-15 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs: Add support for --resources.
+
+ * expression.cs: (FetchGetMethod, FetchAddressMethod, EmitAssign):
+ Make all types for the various array helper methods be integer.
+
+ * ecore.cs (Expression.ConvertNumericExplicit): Pass the
+ CheckState to ConvCast.
+
+ (ConvCast): Now it takes a `checked' state argument, to avoid
+ depending on the emit context for the conversion, and just using
+ the resolve time setting.
+
+ * expression.cs (ArrayCreation.EmitArrayArguments): New function,
+ instead of Invocation.EmitArguments. We do not emit the original
+ arguments, instead we emit those which have been converted to
+ unsigned int expressions.
+
+ * statement.cs (Block.EmitMeta): Drop tracking of indexes.
+
+ * codegen.cs: ditto.
+
+ * expression.cs (LocalVariableReference): Drop the use of the
+ Store function that depended on the variable index.
+
+ * statement.cs (VariableInfo): Drop the `Idx' property from this
+ class, as this is not taking into account the indexes for
+ temporaries tat we generate during the execution, getting the
+ indexes wrong.
+
+ * class.cs: First emit class initializers, then call the parent
+ constructor.
+
+ * expression.cs (Binary): Fix opcode emision.
+ (UnaryMutator.EmitCode): Support checked code generation
+
+ * ecore.cs (MemberLookup): TypeManager.FindMembers will return
+ matches for events for both the Static and Instance scans,
+ pointing to the same element. Fix that.
+
+2002-03-14 Miguel de Icaza <miguel@ximian.com>
+
+ * rootcontext.cs (ResolveTree): Always set the
+ interface_resolve_order, because nested interfaces will be calling
+ into us.
+
+ * class.cs (GetInterfaceOrClass): Track the same resolution
+ process used by TypeManager.LookupType. This fixes the nested
+ type lookups in class declarations (separate path from
+ LookupType).
+
+ (TypeContainer.DefineType): Also define nested interfaces.
+ (TypeContainer.RegisterOrder): New public function used to
+ register the order in which child interfaces need to be closed.
+
+ Nested interfaces need to be closed after their parents have been
+ created.
+
+ * interface.cs (InterfaceAttr): Put all the logic for computing
+ the interface attribute here.
+
+ (DefineInterface): Register our interface order with the
+ RootContext or with the TypeContainer depending on the case.
+
+2002-03-12 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: rework foreach statement to work with the new
+ changes to the policy on SimpleNames.
+
+ * report.cs: support Stacktrace on warnings as well.
+
+ * makefile: drop --unsafe and /unsafe from the compile.
+
+2002-03-13 Ravi Pratap <ravi@ximian.com>
+
+ * ecore.cs (StandardConversionExists): Modify to take an Expression
+ as the first parameter. Ensure we do null -> reference type conversion
+ checking.
+
+ * Everywhere : update calls accordingly, making use of MyEmptyExpr to store
+ temporary Expression objects.
+
+Wed Mar 13 12:32:40 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interface.cs: workaround bug in method overloading resolution
+ (there is already a bugzilla bug for it).
+
+2002-03-12 Miguel de Icaza <miguel@ximian.com>
+
+ We could also solve this problem by having a separate path for
+ performing type lookups, instead of DoResolve, we could have a
+ ResolveType entry point, and only participating pieces of the
+ production (simplename, deref, array) would implement this.
+
+ * codegen.cs (EmitContext): New field OnlyLookupTypes used to
+ signal SimpleName to only resolve type names and not attempt to
+ resolve anything else.
+
+ * expression.cs (Cast): Set the flag.
+
+ * ecore.cs (SimpleName): Use the OnlyLookupTypes flag
+
+ * class.cs: Only report 108 if there is no `new' modifier.
+
+ * cs-parser.jay: rework foreach statement to work with the new
+ changes to the policy on SimpleNames.
+
+ * report.cs: support Stacktrace on warnings as well.
+
+ * makefile: drop --unsafe and /unsafe from the compile.
+
+2002-03-11 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
+ lookups here, instead of doing that at parse time. This means
+ that our grammar will not introduce `LocalVariableReferences' as
+ expressions at this point. That solves the problem of code like
+ this:
+
+ class X {
+ static void Main ()
+ { int X = 1;
+ { X x = null }}}
+
+ This is only half the fix. The full fix requires parameters to
+ also be handled in this way.
+
+ * Everywhere: Use ec.DeclSpace on calls to LookupType, as this
+ makes the use more obvious of the DeclSpace. The
+ ec.TypeContainer.TypeBuilder is now only used to pull the
+ TypeBuilder for it.
+
+ My theory is that I can get rid of the TypeBuilder completely from
+ the EmitContext, and have typecasts where it is used (from
+ DeclSpace to where it matters).
+
+ The only pending problem is that the code that implements Aliases
+ is on TypeContainer, and probably should go in DeclSpace.
+
+ * ecore.cs (SimpleName.SimpleNameResolve): Perform local variable
+ lookups here, instead of doing that at parse time. This means
+ that our grammar will not introduce `LocalVariableReferences' as
+ expressions at this point. That solves the problem of code like
+ this:
+
+ class X {
+ static void Main ()
+ { int X = 1;
+ { X x = null }}}
+
+ This is only half the fix. The full fix requires parameters to
+ also be handled in this way.
+
+ * class.cs (Property.DefineMethod): When implementing an interface
+ method, set newslot, when implementing an abstract method, do not
+ set the flag (before we tried never setting it, or always setting
+ it, which is the difference).
+ (Indexer.DefineMethod): same.
+ (Method.DefineMethod): same.
+
+ * ecore.cs: Only set the status used flag if we get back a Field.
+
+ * attribute.cs: Temporary hack, so Paolo can keep working.
+
+2002-03-08 Ravi Pratap <ravi@ximian.com>
+
+ * attribute.cs (Attribute.UnmanagedType): This is to keep track of
+ the unmanaged type in the case we have a MarshalAs attribute.
+
+ (Resolve): Handle the case when we are parsing the special MarshalAs
+ attribute [we need to store the unmanaged type to use later]
+
+ * typemanager.cs (marshal_as_attr_type): Built in type for the
+ MarshalAs Attribute.
+
+ * attribute.cs (ApplyAttributes): Recognize the MarshalAs attribute
+ on parameters and accordingly set the marshalling info.
+
+2002-03-09 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs: Optimizing slightly by removing redundant code after
+ we switched to the `NoTypes' return value.
+ (Property.DefineMethod): use NoTypes here too.
+
+ This fixes the bug I introduced in my last batch of changes.
+
+2002-03-05 Ravi Pratap <ravi@ximian.com>
+
+ * tree.cs (RecordEnum): Add. We now keep track of enums too.
+
+ * class.cs (LookupInterfaceOrClass): Check against the list of recorded
+ Enums since those are types too.
+
+ * cs-parser.jay (enum_declaration): Record enums as we parse them.
+
+ * enum.cs (DefineEnum): Return if the TypeBuilder has already been defined
+ thanks to a call during the lookup process.
+
+2002-03-07 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Foreach): Lots of work to accomodate a particular
+ kind of foreach statement that I had not kept in mind. It is
+ possible to have foreachs on classes that provide a GetEnumerator
+ method that return objects that implement the "pattern" for using
+ a foreach, there is no need to support GetEnumerator
+ specifically.
+
+ This is needed to compile nant.
+
+ * decl.cs: Only report 114 if the member is not `Finalize' and if
+ the warning level is at least 2.
+
+ * class.cs: Moved the compare function from Method to
+ MethodSignature.
+
+ (MethodSignature.InheritableMemberSignatureCompare): Add new
+ filter function that is used to extract inheritable methods from a
+ class.
+
+ (Method.Define): Use the new `inheritable_method_signature_filter'
+ delegate
+
+ * cs-tokenizer.cs (get_cmd_arg): Do not add white space to the
+ command.
+
+2002-03-06 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (Expression.ConvertReferenceExplicit): Removed dead code.
+
+ * cs-parser.jay: Add opt_semicolon to the interface declaration.
+
+ * expression.cs: Pass location information to
+ ConvertImplicitStandard.
+
+ * class.cs: Added debugging code to track return values from
+ interfaces.
+
+2002-03-05 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Is.DoResolve): If either side of the `is' is an
+ interface, do not flag the warning.
+
+ * ecore.cs (ImplicitReferenceConversion): We need a separate test
+ for interfaces
+
+ * report.cs: Allow for --fatal to be used with --probe.
+
+ * typemanager.cs (NoTypes): Move the definition for the empty Type
+ array here.
+
+ * class.cs (TypeContainer.FindMembers): Also look for methods defined by
+ properties.
+ (TypeContainer.DefineProxy): New function used to proxy to parent
+ implementations when implementing interfaces.
+ (TypeContainer.ParentImplements): used to lookup if our parent
+ implements a public function that is required by an interface.
+ (TypeContainer.VerifyPendingMethods): Hook this up.
+
+ * typemanager.cs (TypeManager, AddModule, AddAssembly): Make the
+ `modules' and `assemblies' arraylists into arrays. We only grow
+ these are the very early start up of the program, so this improves
+ the speedof LookupType (nicely measured).
+
+ * expression.cs (MakeByteBlob): Replaced unsafe code with
+ BitConverter, as suggested by Paolo.
+
+ * cfold.cs (ConstantFold.Binary): Special case: perform constant
+ folding of string concatenation, but if either side is a string,
+ and the other is not, then return null, and let the runtime use
+ the concatenation on the string plus the object (using
+ `Object.ToString').
+
+2002-03-04 Miguel de Icaza <miguel@ximian.com>
+
+ Constant Folding has been implemented now.
+
+ * expression.cs (Unary.Reduce): Do not throw an exception, catch
+ the error instead on types that are not supported in one's
+ complement.
+
+ * constant.cs (Constant and all children): New set of functions to
+ perform implict and explicit conversions.
+
+ * ecore.cs (EnumConstant): Implement the new functions to perform
+ conversion by proxying to the child expression.
+
+ * codegen.cs: (ConstantCheckState): Constant evaluation has its
+ own separate setting that can not be turned off from the command
+ line using --unchecked or --checked and is only controlled using
+ the checked/unchecked statements and expressions. This setting is
+ used by the constant folder to flag errors.
+
+ * expression.cs (CheckedExpr, UncheckedExpr): Set the
+ ConstantCheckState as well.
+
+ During Resolve, they also have to flag the state, because the
+ constant folder runs completely in the Resolve phase.
+
+ * statement.cs (Checked, Unchecked): Set the ConstantCheckState as
+ well.
+
+2002-03-01 Miguel de Icaza <miguel@ximian.com>
+
+ * cfold.cs: New file, this file contains the constant folder.
+
+ * ecore.cs (IMemoryLocation.AddressOf): Now takes an extra
+ argument to track whether we are using the resulting address to
+ load or store a value and provide better error messages.
+
+ (FieldExpr.Emit, FieldExpr.EmitAssign, FieldExpr.AddressOf): Use
+ new AddressOf arguments.
+
+ * statement.cs (Foreach.EmitCollectionForeach): Update
+
+ * expression.cs (Argument.Emit): Call AddressOf with proper
+ arguments to track usage.
+
+ (New.DoEmit): Call AddressOf with new arguments.
+
+ (Unary.Emit): Adjust AddressOf call.
+
+2002-03-01 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (member_access): Change the case for pre-defined types
+ to use a MemberAccess instead of a SimpleName. Thanks to Felix again for
+ this suggestion.
+
+ * class.cs (Operator::Emit): If we are abstract or extern, we don't have
+ a method body.
+
+ * attribute.cs (CheckAttribute, ApplyAttribute): Ensure that we treat operators
+ essentially like methods and apply attributes like MethodImplOptions to them too.
+
+ * ecore.cs (SimpleName.SimpleNameResolve): Perform a check on ec.TypeContainer.TypeBuilder
+ not being null.
+
+ * codegen.cs (EmitContext): The constructor now takes in an extra argument specifying the
+ DeclSpace as the distinction is important. We provide sane defaults as usually the TypeContainer
+ is the DeclSpace.
+
+ * Update code everywhere accordingly.
+
+ * ecore.cs : Change references to ec.TypeContainer to ec.DeclSpace where appropriate.
+
+ * cs-parser.jay (enum_declaration): Set the current namespace of the enum.
+
+2002-02-28 Ravi Pratap <ravi@ximian.com>
+
+ * rootcontext.cs (LookupType): As we cycle through the chain of namespaces
+ try performing lookups against those instead of jumping straight into using
+ the 'using' clauses.
+
+ (ImplicitParent): Add. Thanks to Felix Arrese-Igor for this idea.
+
+ (LookupType): Perform lookups in implicit parents too.
+
+ * class.cs (GetInterfaceOrClass): Modify to perform the exact same lookup
+ sequence as RootContext.LookupType.
+
+ * rootcontext.cs (NamespaceLookup): Split out code from LookupType which tries
+ the various cases of namespace lookups into this method.
+
+2002-03-01 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Add support for [Attribute ()] (empty arguments
+ in positional arguments)
+
+ * class.cs (Operator): Update the AllowedModifiers to contain
+ extern.
+
+ * cs-parser.jay: Update operator declaration to allow for the
+ operator body to be empty.
+
+ * cs-tokenizer.cs: Added '\u' unicode support in strings and hex
+ values.
+
+2002-02-27 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (Method.Emit): Label parameters.
+
+ * driver.cs: Return 1 or 0 as the program exit code.
+
+2002-02-26 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: Special case the `null' object when trying to
+ auto-compute the type, as anything can be explicitly converted to
+ that.
+
+ * ecore.cs (Expression.ConvertExplicit): Bug fix, thanks for
+ spotting this Paolo.
+
+ (Expression.ImplicitNumericConversion): Perform comparissions of
+ the type using the underlying type in the case of an enumeration
+ rather than using the enumeration type for the compare.
+
+ Cope with the underlying == type case, which is not possible to
+ catch before.
+
+ (Expression.ConvertNumericExplicit): Perform comparissions of
+ the type using the underlying type in the case of an enumeration
+ rather than using the enumeration type for the compare.
+
+ * driver.cs: If the user does not supply an extension, assume .exe
+
+ * cs-parser.jay (if_statement): Rewrote so that we can track the
+ location for the if statement.
+
+ * expression.cs (Binary.ConstantFold): Only concat strings when
+ the operation is "+", not everything ;-)
+
+ * statement.cs (Statement.EmitBoolExpression): Take a location
+ argument.
+ (If, While, Do): Track location.
+
+ * expression.cs (Binary.ResolveOperator): In the object + string
+ case, I was missing a call to ConvertImplicit
+
+2002-02-25 Ravi Pratap <ravi@ximian.com>
+
+ * parameter.cs (Parameter.ExternalType): Take in extra DeclSpace and
+ Location arguments. Ensure we use RootContext.LookupType to do our work
+ and not try to do a direct Type.GetType and ModuleBuilder.GetType
+
+ * interface.cs (PopulateMethod): Handle the type of the parameter being
+ null gracefully.
+
+ * expression.cs (Invocation.BetterFunction): Handle the case when we
+ have a params method with no fixed arguments and a call is made with no
+ arguments.
+
+2002-02-25 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-tokenizer.cs: Add support for the quote-escape-sequence in
+ the verbatim-string-literal
+
+ * support.cs (InternalParameters.ParameterModifier): handle null
+ fixed parameters.
+ (InternalParameters.ParameterType): ditto.
+
+ * parameter.cs (VerifyArgs): Also check if the fixed parameter is
+ duplicating the name of the variable parameter.
+ (GetParameterByName): Fix bug where we were not looking up array
+ paramters if they were the only present (thanks Paolo!).
+ (GetParameterInfo): We only have an empty set of types if both
+ fixed and array are set to null.
+ (GetParameterInfo-idx): Handle FixedParameter == null
+
+ * cs-parser.jay: Handle the case where there is no catch
+ statements (missing null test).
+
+2002-02-22 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs (MainDriver): Be conservative on our command line
+ handling.
+
+ Catch DirectoryNotFoundException when calling GetFiles.
+
+ (SplitPathAndPattern): Used to split the input specification into
+ a path and a pattern that we can feed to Directory.GetFiles.
+
+2002-02-21 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Fixed): Implement the last case of the Fixed
+ statement (string handling).
+
+ * expression.cs (StringPtr): New class used to return a char * to
+ a string; Used by the Fixed statement.
+
+ * typemanager.cs: Add char_ptr_type. Add get_OffsetToStringData method.
+
+ * expression.cs (Binary.ResolveOperator): Remove redundant
+ MemberLookup pn parent type.
+ Optimize union call, we do not need a union if the types are the same.
+ (Unary.ResolveOperator): REmove redundant MemberLookup on parent
+ type.
+
+ Specialize the use of MemberLookup everywhere, instead of using
+ the default settings.
+
+ (StackAlloc): Implement stackalloc keyword.
+
+ * cs-parser.jay: Add rule to parse stackalloc.
+
+ * driver.cs: Handle /h, /help, /?
+
+ * expression.cs (MakeByteBlob): Removed the hacks we had in place
+ before we supported unsafe code.
+
+ * makefile: add --unsafe to the self compilation of mcs.
+
+2002-02-20 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (PointerArithmetic): New class that is used to
+ perform pointer arithmetic.
+ (Binary.Resolve): Handle pointer arithmetic
+ Handle pointer comparission.
+ (ArrayPtr): Utility expression class that is used to take the
+ address of an array.
+
+ (ElementAccess): Implement array access for pointers
+
+ * statement.cs (Fixed): Implement fixed statement for arrays, we
+ are missing one more case before we are done.
+
+ * expression.cs (Indirection): Implement EmitAssign and set the
+ ExprClass to Variable. This allows pointer dereferences to be
+ treated as variables, and to have values assigned to them.
+
+ * ecore.cs (Expression.StoreFromPtr): New utility function to
+ store values dereferencing.
+
+2002-02-20 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Binary.ResolveOperator): Ensure that we are
+ not trying to operate on a void type - this fixes the reported
+ bug.
+
+ * decl.cs (CheckMethodAgainstBase): Do not allow overriding if
+ the parent implementation is sealed.
+
+ * ../errors/cs0239.cs : Add.
+
+ * attribute.cs (ApplyAttributes): Handle Modulebuilders too.
+
+ * typemanager.cs (unverifiable_code_type): Corresponds to
+ System.Security.UnverifiableCodeAttribute. We need to emit this for modules
+ which have unsafe code in them.
+
+ * rootcontext.cs (EmitCode): Emit the above attribute when we are in an
+ unsafe context.
+
+2002-02-19 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-tokenizer.cs: Add support for @"litreal strings"
+
+ Make tokenizer accept pre-processor directives
+ on any column (remove the old C-like limitation).
+
+ * rootcontext.cs (EmitCode): Emit any global attributes.
+ (AddGlobalAttributes): Used to keep track of assembly attributes.
+
+ * attribute.cs (ApplyAttributes): Support AssemblyAttributes.
+
+ * cs-parser.jay: Add support for global attributes.
+
+2002-02-17 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Indirection): New helper class. Unary will
+ create Indirection classes to be able to implement the
+ IMemoryLocation interface on it.
+
+2002-02-16 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay (fixed_statement): reference the right statement.
+
+ * statement.cs (Fixed.Emit): Finish implementing the fixed
+ statement for the &x case.
+
+2002-02-14 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (Property.Define, Method.Define): Remove newslot when
+ `implementing'.
+
+ * modifiers.cs: My use of NewSlot when `Abstract' was set was
+ wrong. NewSlot should only be used if the `new' keyword is present.
+
+ * driver.cs (GetSystemDir): Use CodeBase instead of FullName for
+ locating our system dir. Sorry about this.
+
+2002-02-13 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs (GetSystemDir): Compute correctly the location of our
+ system assemblies. I was using the compiler directory instead of
+ the library directory.
+
+2002-02-13 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (BetterFunction): Put back in what Miguel commented out
+ since it is the correct fix. The problem is elsewhere ;-)
+
+ (IsParamsMethodApplicable): Fix bug where we were not checking that the fixed
+ parameters of the parms method are themselves compatible or not !
+
+ (StandardConversionExists): Fix very dangerous bug where we were forgetting
+ to check that a class implements an interface before saying that an implicit
+ conversion was allowed. Use ImplementsInterface to do the checking.
+
+2002-02-13 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (Method.Define): Track whether we are an explicit
+ implementation or not. And only call DefineMethodOverride if we
+ are an explicit implementation.
+
+ (Property.DefineMethod): Ditto.
+
+2002-02-11 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (BetterFunction): Catch hideous bug which was
+ preventing us from detecting ambiguous calls due to implicit casts i.e
+ cs0121.
+
+2002-01-29 Miguel de Icaza <miguel@ximian.com>
+
+ * support.cs (Pair): Remove un-needed method. I figured why I was
+ getting the error in cs-parser.jay, the variable in a foreach loop
+ is readonly, and the compiler does not really treat this as a variable.
+
+ * cs-parser.jay (fixed_statement): Fix grammar. Use ASSIGN
+ instead of EQUALS in grammar.
+
+ * typemanager.cs (VerifyUnmanaged): Report correct error (208)
+
+ * expression.cs (Unary.DoResolve): Check whether the argument is
+ managed or not.
+
+2002-01-28 Miguel de Icaza <miguel@ximian.com>
+
+ * support.cs: Api for Pair to set a value. Despite the fact that
+ the variables are public the MS C# compiler refuses to compile
+ code that accesses the field if the variable is part of a foreach
+ statement.
+
+ * statement.cs (Fixed): Begin implementation of the fixed
+ statement.
+
+ (Block.AddVariable): Return the VariableInfo on success and null
+ on failure instead of true/false.
+
+ * cs-parser.jay (foreach): Catch errors on variables already
+ defined (we were ignoring this value before) and properly unwind
+ the block hierarchy
+
+ (fixed_statement): grammar for the fixed statement.
+
+2002-01-25 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (UnaryMutator.IsIncrementableNumber): Allow also
+ pointer types to be incretemented.
+
+ (SizeOf): Implement.
+
+ * cs-parser.jay (pointer_member_access): Implement
+ expr->IDENTIFIER production.
+
+ * expression.cs (IndexerAccess.DoResolve, ArrayAccess.DoResolve,
+ MemberAccess.DoResolve, Invocation.DoResolve): Check for pointers
+ on safe contexts.
+
+ (Unary): Implement indirection.
+
+ * ecore.cs (Expression.UnsafeError): Reports error 214 (pointer
+ use in non-unsafe context).
+
+ (SimpleName.DoResolve): Check for pointers in field access on safe
+ contexts.
+
+ (Expression.LoadFromPtr): Factor the load-indirect code in this
+ function. This was duplicated in UnboxCast and ParameterReference
+
+2002-01-24 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (ComposedCast): report an error if a pointer cast
+ is used in a safe region.
+
+ * ecore.cs (Expression.ConvertExplicit): Add rules for implicit
+ pointer type casts in unsafe context.
+
+ * codegen.cs (EmitContext): Set up IsUnsafe.
+
+ * cs-parser.jay (non_expression_type): Add productions for pointer
+ casts.
+
+ * expression.cs (Invocation.EmitCall): Remove chunk of buggy
+ code. We should not use force into static mode if the method is
+ not virtual. Fixes bug in MIS
+
+ * statement.cs (Do.Emit, While.Emit, For.Emit,
+ Statement.EmitBoolExpression): Add support to Do and While to
+ propagate infinite loop as `I do return' semantics.
+
+ Improve the For case to also test for boolean constants.
+
+ * attribute.cs (Attribute.ApplyAttributes): Add ParameterBuilder
+ to the list of attributes we can add.
+
+ Remove `EmitContext' argument.
+
+ * class.cs (Method.Define): Apply parameter attributes.
+ (Constructor.Define): Apply parameter attributes.
+ (MethodCore.LabelParameters): Move here the core of labeling
+ parameters.
+
+ * support.cs (ReflectionParameters.ParameterModifier,
+ InternalParameters.ParameterModifier): Use IsByRef on the type and
+ only return the OUT bit for these parameters instead of in/out/ref
+ flags.
+
+ This is because I miss-understood things. The ParameterInfo.IsIn
+ and IsOut represent whether the parameter has the [In] and [Out]
+ attributes set.
+
+2002-01-22 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (FieldExpr.Emit): Release temporaries.
+
+ * assign.cs (LocalTemporary.Release): new function.
+
+ * codegen.cs (EmitContext.GetTemporaryStorage,
+ EmitContext.FreeTemporaryStorage): Rework the way we deal with
+ temporary storage. Now we can "put back" localbuilders when we
+ are done with them
+
+2002-01-21 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (FieldExpr.Emit): Handle initonly fields specially: we
+ need to make a copy of the variable to generate verifiable code.
+
+2002-01-19 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs: Compute dynamically the system directory.
+
+ * ecore.cs (CopyNewMethods): reworked, exposed, made public.
+ Slower, but more generally useful. Used by the abstract
+ registering implementation.
+
+ * expression.cs (ResolveMemberAccess): Reorder the way we evaluate
+ the rules for the special rule on Type/instances. First check if
+ we have the same name, and if so, try that special static path
+ rather than the instance path.
+
+2002-01-18 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Emit 642 (warning: possible empty statement) for
+ for, while and if.
+
+ * class.cs (TypeBuilder.DefineType): Do not allow inheritance from
+ Enum, ValueType, Delegate or Array for non-corlib compiles.
+
+ * cs-tokenizer.cs: Catch long identifiers (645)
+
+ * typemanager.cs (IndexerPropetyName): Ravi never tested this
+ piece of code.
+
+ * class.cs (TypeContainer.RegisterRequiredImplementations): Bug
+ fix, we were returning too early, so we were not registering
+ pending methods from abstract classes.
+
+ Do not register pending methods if the class is abstract.
+
+ * expression.cs (Conditional.DoResolve): Report circular implicit
+ conversions when we neecd to compute it for conditional
+ expressions.
+
+ (Is.DoResolve): If the expression is always of the provided type,
+ flag warning 183. If the expression can not ever be of the
+ provided type flag warning 184.
+
+ * class.cs: Catch 169 as well.
+
+ * ecore.cs (FieldExpr): For now in AddressOf mark as assigned and
+ read.
+
+2002-01-18 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
+
+2002-01-17 Miguel de Icaza <miguel@ximian.com>
+
+ * interface.cs: (PopulateMethod): Check for pointers being defined
+ only if the unsafe context is active.
+ (PopulateProperty): ditto.
+ (PopulateIndexer): ditto.
+
+ * class.cs (Method, Method.Define): Allow `unsafe' modifier to be
+ specified. If pointers are present, make sure that they are
+ present in an unsafe context.
+ (Constructor, Constructor.Define): ditto.
+ (Field, Field.Define): ditto.
+ (Property, Property.Define): ditto.
+ (Event, Event.Define): ditto.
+
+ * interface.cs (Interface.GetInterfaceTypeByName): Only lookup the
+ hashtable if there are classes or structs defined.
+
+ * expression.cs (LocalVariableReference.DoResolve): Simplify this
+ code, as the constant resolution moved.
+
+ * statement.cs (Block.EmitMeta): Resolve all constants as we emit
+ the metadata, so we can flag error 133.
+
+ * decl.cs (MemberCore.UnsafeOK): New function to test that a
+ pointer is being declared in an unsafe context.
+
+2002-01-16 Miguel de Icaza <miguel@ximian.com>
+
+ * modifiers.cs (Modifiers.Check): Require a Location argument.
+ Report error 227 for Unsafe use.
+
+ * typemanager.cs: Remove IsPointerType, we should be using Type.IsPointer
+
+ * statement.cs (For.Emit): If the test is null, then report that
+ we do `return', as we wont reach anything afterwards.
+
+ (Switch.SwitchGoverningType): Track the expression that matched
+ the conversion.
+
+ * driver.cs: Allow negative numbers as an error code to flag.
+
+ * cs-parser.jay: Handle 1551.
+
+ * namespace.cs: Add 1537 checking (repeated using alias namespaces).
+
+2002-01-15 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Report 1518 (type declaration can only contain
+ class, struct, interface, enum or delegate)
+
+ (switch_label): Report 1523 (keywords `case' or `default' must
+ preced code)
+
+ (opt_switch_sections): Report 1522 (empty switch)
+
+ * driver.cs: Report 1515 (response file specified multiple times)
+ Report 1516 (Source file specified multiple times).
+
+ * expression.cs (Argument.Resolve): Signal 1510
+
+ (BaseAccess.Resolve, BaseIndexer.Resolve): Signal 1511 (base
+ access not allowed in static code)
+
+2002-01-11 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (IsPointerType): Utility method which we are going
+ to need a lot.
+
+ * ecore.cs (ImplicitReferenceConversion): A pointer type cannot be cast to
+ the object type, so we take care of that.
+
+ * expression.cs (FullMethodDesc): Also include the return type in descriptions.
+
+ * support.cs (ParameterDesc): Fix minor bug which was causing params tags to be
+ added to non-params parameters :-)
+
+ * typemanager.cs (CSharpName): Include 'void' type too.
+
+ (void_ptr_type): Include in the set of core types.
+
+ * ecore.cs (ConvertImplicit): Make use of ConvertImplicitStandard instead of
+ duplicating code.
+
+ (ConvertImplicitStandard): Handle standard implicit pointer conversions when we have
+ an unsafe context.
+
+ * cs-parser.jay (local_variable_pointer_type): Add support for 'void *' as I had
+ completely forgotten about it.
+
+2002-01-10 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (pointer_type): Add. This begins our implementation
+ of parsing rules for unsafe code.
+
+ (unsafe_statement): Implement.
+
+ (embedded_statement): Modify to include the above.
+
+ * statement.cs (Unsafe): Implement new class for unsafe blocks.
+
+ * codegen.cs (EmitContext.InUnsafe): Add. This determines
+ if the current context is an unsafe one.
+
+ * cs-parser.jay (local_variable_pointer_type): Since local variable types
+ are handled differently, we need separate rules for them.
+
+ (local_variable_declaration): Update to use local_variable_pointer_type
+ to allow variable declarations of unmanaged pointer types.
+
+ * expression.cs (Unary.ResolveOperator): Ensure that the '&' operator is used only
+ in unsafe contexts.
+
+ * ../errors/cs0214.cs : Add.
+
+2002-01-16 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: remove 'response' file when cleaning.
+
+2002-01-15 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Report 1524.
+
+2002-01-14 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs (RegisterMethod): drop checking if we have
+ registered this from here
+
+2002-01-12 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (Method.EmitDestructor): Implement calling our base
+ destructor.
+
+ * statement.cs (Try.Emit): Fix to reset the InFinally to the old
+ value of InFinally.
+
+ * codegen.cs (EmitContext.EmitTopBlock): Destructors will call
+ this routine and will wrap the call in a try/catch block. Deal
+ with the case.
+
+2002-01-11 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (Expression.MemberLookup): instead of taking a
+ parameter `same_type' that was used to tell whether we could
+ access private members we compute our containing type from the
+ EmitContext.
+
+ (FieldExpr): Added partial support for volatile fields. This does
+ not work for volatile fields exposed from assemblies, as I can not
+ figure out how to extract the modreq from it.
+
+ Updated all the source files to use this.
+
+ * codegen.cs (EmitContext): Compute ContainerType ahead of time,
+ because it is referenced by MemberLookup very often.
+
+2002-01-09 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (IndexerPropertyName): If we have a TypeBuilder, use
+ TypeBuilder.GetCustomAttributes to retrieve what we need.
+
+ Get rid of redundant default_member_attr_type as this is the same as
+ default_member_type which already exists.
+
+ * interface.cs, attribute.cs : Update accordingly.
+
+2002-01-08 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs: Enable IndexerPropertyName again. It does not
+ work for TYpeBuilders though. Ravi, can you please fix this?
+
+ * cs-tokenizer.cs: Accept _ as a name in pp-expressions.
+
+ * expression.cs (Argument.Emit): Handle the case of ref objects
+ being passed to ref functions;
+
+ (ParameterReference.EmitLoad): Loads the content of the pointer
+ without dereferencing.
+
+2002-01-07 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-tokenizer.cs: Implemented the pre-processing expressions.
+
+2002-01-08 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Indexer.DefineMethod): Incorporate the interface
+ type in the name of the method if we are doing explicit interface
+ implementation.
+
+ * expression.cs (ConversionExists): Remove as it is completely obsolete.
+
+ (BetterConversion): Fix extremely trivial bug where we were referring to
+ ConversionExists instead of StandardConversionExists ! Hooray, things are fine
+ again !
+
+ * ../errors/bug16.cs : Add although we have fixed it.
+
+2002-01-07 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (BaseIndexer): Begin implementation.
+
+ * class.cs (TypeContainer.IsInterfaceMethod): Bug fix.
+
+ * cs-parser.jay (indexer_declarator): Use qualified_identifier
+ production directly to remove a shift/reduce, and implement
+ explicit interface implementation.
+
+ * cs-tokenizer.cs: Fix tokenizer, it was consuming one extra char
+ after a floating point suffix.
+
+ * expression.cs (DoNumericPromotions): Improved the conversion for
+ uint/uint. If we have a constant, we avoid doing a typecast to a
+ larger type.
+
+ * class.cs (Indexer): Implement explicit interface implementation
+ for indexers.
+
+Sat Jan 5 16:08:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.cs: make the default instance constructor public and hidebysig.
+
+2001-01-03 Ravi Pratap <ravi@ximian.com>
+
+ * interface.cs (EmitDefaultMemberAttr): Make this helper method static
+ so we can call it from elsewhere.
+
+ * class.cs (TypeContainer.Emit): Emit the attribute here too. The rule is that
+ we emit it internally if the class has a defined indexer; otherwise the user
+ emits it by decorating the class definition with the DefaultMemberAttribute.
+
+ * attribute.cs (ApplyAttributes): Perform checks to see that the DefaultMember
+ attribute is not used on a type which defines an indexer.
+
+ * cs-tokenizer.cs (get_cmd_arg): Ensure we trim whitespace and also include the tab
+ character when we skip whitespace.
+
+ * ../errors/cs0646.cs : Add.
+
+2002-01-03 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (SimpleName.ResolveSimpleName): Report error 120
+ again.
+
+ * makefile: Add practical target `mcs3.exe' which builds the third
+ generation compiler.
+
+ * expression.cs (New): Fix structures constructor calling.
+
+ * class.cs (Property, Method, Indexer): Emit Final flag on the
+ method if we are an interface implementation and we are not
+ abstract.
+
+ * ecore.cs (PropertyExpr): New public field `IsBase', tells
+ whether this property is referencing a `base' method.
+
+ * expression.cs (Invocation.EmitCall): take an extra argument:
+ is_base, this is used to determine whether the `call' or
+ `callvirt' opcode should be used.
+
+
+ * delegate.cs: update EmitCall.
+
+ * class.cs (Method.Define): Set NewSlot for the cases where we are
+ not implementing an interface method.
+
+ (Property.Define): ditto.
+
+2002-01-02 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-tokenizer.cs: (Tokenizer.escape): Escape '\r' as '\r' not as
+ 'r'. Allows mcs to parse itself fully.
+
+2002-01-02 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (ArrayCreation.num_automatic_initializers): Keep track
+ of the number of initializers that require the InitializeArray method.
+
+ (CheckIndices): Store the Expression in all cases - not the plain value. Also
+ update the above field where necessary.
+
+ (MakeByteBlob): Update accordingly.
+
+ (DoEmit): Call EmitStaticInitializers only if the number of initializers is
+ greater than 2.
+
+ (EmitDynamicInitializers): Update in accordance with the new optimization.
+
+ (ArrayAccess.EmitStoreOpcode): Include char type along with short and ushort - the
+ same OpCode applies.
+
+ * cs-parser.jay : Fix some glaring errors I introduced.
+
+2002-01-01 Ravi Pratap <ravi@ximian.com>
+
+ * parameters.cs (AddVariable, AddConstant): Pass in current_local_parameters
+ so that we can check for name clashes there too.
+
+ * typemanager.cs (default_member_attr_type): The attribute that we need to emit
+ for interface indexers.
+
+ * interfaces.cs (Define): Emit the default member attribute.
+
+ * expression.cs (MakeByteBlob): Fix extremely trivial bug where the wrong
+ variable was being referred to while setting the value ;-)
+
+2002-01-01 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (MakeByteBlob): Optimize: we do not need to fill
+ byte-by-byte information when we know the data is zero.
+
+ Make the block always a multiple of 4, because
+ DefineInitializedData has a bug.
+
+ * assign.cs: Fix, we should assign from the temporary, not from
+ the source.
+
+ * expression.cs (MakeByteBlob): Fix my incorrect code.
+
+2001-12-31 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs (EnumToUnderlying): This function is used to get
+ the underlying type from an enumeration, because it does not
+ always work.
+
+ * constant.cs: Use the I4_S form for values between -128 and 127.
+
+ * statement.cs (Block.LookupLabel): Looks up a label.
+ (Block): Drop support for labeled blocks.
+
+ (LabeledStatement): New kind of statement that represents a label
+ only.
+
+ (Goto): Finally implement this bad boy.
+
+ * cs-parser.jay: Update to reflect new mechanism to implement
+ labels.
+
+2001-12-30 Miguel de Icaza <miguel@ximian.com>
+
+ * codegen.cs (EmitContext.This): a codegen property that keeps the
+ a single instance of this instead of creating many different this
+ instances.
+
+ * delegate.cs (Delegate.DoResolve): Update to use the property;
+
+ * ecore.cs (SimpleName.SimpleNameResolve): Ditto
+
+ * expression.cs (BaseAccess.DoResolve): Ditto.
+
+2001-12-29 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (methodimpl_attr_type): Add to hold the type
+ corresponding to System.Runtime.CompilerServices.MethodImplAttribute.
+
+ (InitCoreTypes): Update accordingly.
+
+ * attribute.cs (Resolve): Remember if the attribute is a MethodImplAttribute
+ so we can quickly store the state.
+
+ (ApplyAttributes): Set the correct implementation flags
+ for InternalCall methods.
+
+2001-12-29 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (EmitCall): if a method is not virtual, then do
+ not use callvirt on it.
+
+ (ArrayAccess.EmitAssign): storing non-builtin value types (ie,
+ user defined stuff) requires the use of stobj, which takes an
+ address on the stack instead of an array and an index. So emit
+ the Ldelema operation for it.
+
+ (EmitStoreOpcode): Use stobj for valuetypes.
+
+ (UnaryMutator.EmitCode): Use the right 1 value depending on
+ whether we are dealing with int64/uint64, float or doubles.
+
+ * class.cs (TypeContainer.AddConstructor): Fix the logic to define
+ constructors that I implemented last night.
+
+ (Constructor.IsDefault): Fix to work properly for static
+ constructors.
+
+ * cs-parser.jay (CheckDef): report method signature errors.
+ Update error number 103 to be 132.
+
+ * decl.cs: New AdditionResult enumeration value: MethodExists.
+ Although we do this check for methods later on in the semantic
+ analysis, catching repeated default constructors is so easy that
+ we catch these here.
+
+ * expression.cs (Binary.DoNumericPromotions): Fix the uint64 type
+ promotions code.
+
+ (ParameterReference.EmitAssign, Emit): handle
+ bools as bytes.
+
+ (ArrayAccess.EmitLoadOpcode): Handle bool type here.
+ (ArrayAccess.EmitStoreOpcode): ditto.
+
+ * cs-tokenizer.cs (is_punct): Eliminated empty computation.
+
+ * expression.cs (MakeByteBlob): Complete all the missing types
+ (uint, short, ushort, byte, sbyte)
+
+ * class.cs: Only init instance field initializers on instance
+ constructors.
+
+ Rename `constructors' to instance_constructors.
+
+ (TypeContainer.AddConstructor): Only add constructors to the list
+ if it is not static.
+
+ Make sure that we handle default_static_constructor independently
+ everywhere where we handle instance_constructors
+
+2001-12-28 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs: Do not lookup or create a base initializer for a
+ static constructor.
+
+ (ConstructorInitializer.Resolve): use the proper type to lookup
+ for constructors.
+
+ * cs-parser.jay: Report error 1585 (modifiers between type and name).
+
+ * enum.cs, interface.cs: Remove CloseType, this is taken care by
+ in DeclSpace.
+
+ * decl.cs: CloseType is now an virtual method, the default
+ implementation just closes this type.
+
+2001-12-28 Ravi Pratap <ravi@ximian.com>
+
+ * attribute.cs (DefinePInvokeMethod): Set the implementation flags
+ to PreserveSig by default. Also emit HideBySig on such methods.
+
+ Basically, set the defaults to standard values.
+
+ * expression.cs (Invocation.BetterFunction): We need to make sure that for each
+ argument, if candidate is better, it can't be worse than the best !
+
+ (Invocation): Re-write bits to differentiate between methods being
+ applicable in their expanded form and their normal form - for params
+ methods of course.
+
+ Get rid of use_standard everywhere as only standard conversions are allowed
+ in overload resolution.
+
+ More spec conformance.
+
+2001-12-27 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs: Add --timestamp, to see where the compiler spends
+ most of its time.
+
+ * ecore.cs (SimpleName.DoResolve): Do not create an implicit
+ `this' in static code.
+
+ (SimpleName.DoResolve): Implement in terms of a helper function
+ that allows static-references to be passed upstream to
+ MemberAccess.
+
+ (Expression.ResolveWithSimpleName): Resolve specially simple
+ names when called by MemberAccess to implement the special
+ semantics.
+
+ (Expression.ImplicitReferenceConversion): Handle conversions from
+ Null to reference types before others, as Null's type is
+ System.Object.
+
+ * expression.cs (Invocation.EmitCall): Handle the special case of
+ calling methods declared on a reference type from a ValueType
+ (Base classes System.Object and System.Enum)
+
+ (MemberAccess.Resolve): Only perform lookups on Enumerations if
+ the left hand side is a TypeExpr, not on every enumeration.
+
+ (Binary.Resolve): If types are reference types, then do a cast to
+ object on operators != and == of both arguments.
+
+ * typemanager.cs (FindMembers): Extract instance and static
+ members if requested.
+
+ * interface.cs (PopulateProperty): Use void_type instead of null
+ as the return type for the setter method.
+
+ (PopulateIndexer): ditto.
+
+2001-12-27 Ravi Pratap <ravi@ximian.com>
+
+ * support.cs (ReflectionParameters): Fix minor bug where we
+ were examining the wrong parameter for the ParamArray attribute.
+
+ Cope with requests for the type of the parameter at position
+ greater than the params parameter's. We now return the element
+ type of the params array as that makes more sense.
+
+ * expression.cs (Invocation.IsParamsMethodApplicable): Update
+ accordingly as we no longer have to extract the element type
+ ourselves.
+
+ (Invocation.OverloadResolve): Update.
+
+2001-12-27 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Foreach.GetEnumeratorFilter): Do not compare
+ against IEnumerator, test whether the return value is a descendant
+ of the IEnumerator interface.
+
+ * class.cs (Indexer.Define): Use an auxiliary method to implement
+ the other bits of the method definition. Begin support for
+ explicit interface implementation.
+
+ (Property.DefineMethod): Use TypeManager.void_type instead of null
+ for an empty return value.
+
+2001-12-26 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (MemberAccess.ResolveMemberAccess): if we are
+ dealing with a FieldExpr which is composed of a FieldBuilder, in
+ the code path we did extract the constant, but we should have
+ obtained the underlying value to be able to cast it (otherwise we
+ end up in an infinite loop, this is what Ravi was running into).
+
+ (ArrayCreation.UpdateIndices): Arrays might be empty.
+
+ (MemberAccess.ResolveMemberAccess): Add support for section
+ 14.5.4.1 that deals with the special case of E.I when E is a type
+ and something else, that I can be a reference to a static member.
+
+ (ArrayCreation.MakeByteBlob): It is not an error to not be able to
+ handle a particular array type to create byte blobs, it is just
+ something we dont generate byteblobs for.
+
+ * cs-tokenizer.cs (get_cmd_arg): Ignore \r in commands and
+ arguments.
+
+ * location.cs (Push): remove the key from the hashtable that we
+ are about to add. This happens for empty files.
+
+ * driver.cs: Dispose files after we have parsed them.
+
+ (tokenize): new function that only runs the tokenizer on its
+ input, for speed testing.
+
+2001-12-26 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Event.Define): Define the private field only if there
+ are no accessors defined.
+
+ * expression.cs (ResolveMemberAccess): If there is no associated
+ field with the event, that means we have an event defined with its
+ own accessors and we should flag error cs0070 since transforming
+ ourselves into a field is not valid in that case.
+
+ * ecore.cs (SimpleName.DoResolve): Same as above.
+
+ * attribute.cs (DefinePInvokeMethod): Set the default calling convention
+ and charset to sane values.
+
+2001-12-25 Ravi Pratap <ravi@ximian.com>
+
+ * assign.cs (DoResolve): Perform check on events only if they
+ are being accessed outside the declaring type.
+
+ * cs-parser.jay (event_declarations): Update rules to correctly
+ set the type of the implicit parameter etc.
+
+ (add_accessor, remove_accessor): Set current local parameters.
+
+ * expression.cs (Binary): For delegate addition and subtraction,
+ cast the return value from the method into the appropriate delegate
+ type.
+
+2001-12-24 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (RegisterDelegateData, GetDelegateData): Get rid
+ of these as the workaround is unnecessary.
+
+ * delegate.cs (NewDelegate.DoResolve): Get rid of bits which registered
+ delegate data - none of that is needed at all.
+
+ Re-write bits to extract the instance expression and the delegate method
+ correctly.
+
+ * expression.cs (Binary.ResolveOperator): Handle the '-' binary operator
+ on delegates too.
+
+ * attribute.cs (ApplyAttributes): New method to take care of common tasks
+ of attaching attributes instead of duplicating code everywhere.
+
+ * everywhere : Update code to do attribute emission using the above method.
+
+2001-12-23 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (IsParamsMethodApplicable): if there are not
+ parameters, return immediately.
+
+ * ecore.cs: The 0 literal can be implicity converted to an enum
+ type.
+
+ (SimpleName.DoResolve): First lookup the type, then lookup the
+ members.
+
+ (FieldExpr.Emit): If the InstanceExpression is a ValueType, we
+ want to get its address. If the InstanceExpression is not
+ addressable, store the result in a temporary variable, then get
+ the address of it.
+
+ * codegen.cs: Only display 219 errors on warning level or above.
+
+ * expression.cs (ArrayAccess): Make it implement the
+ IMemoryLocation interface.
+
+ (Binary.DoResolve): handle the operator == (object a, object b)
+ and operator != (object a, object b) without incurring into a
+ BoxedCast (because 5 != o should never be performed).
+
+ Handle binary enumerator operators.
+
+ (EmitLoadOpcode): Use Ldelema if the object we are loading is a
+ value type, otherwise use Ldelem_ref.
+
+ Use precomputed names;
+
+ (AddressOf): Implement address of
+
+ * cs-parser.jay (labeled_statement): Fix recursive block
+ addition by reworking the production.
+
+ * expression.cs (New.DoEmit): New has a special case:
+
+ If we are dealing with a ValueType, we have a few
+ situations to deal with:
+
+ * The target of New is a ValueType variable, that is
+ easy, we just pass this as the variable reference
+
+ * The target of New is being passed as an argument,
+ to a boxing operation or a function that takes a
+ ValueType.
+
+ In this case, we need to create a temporary variable
+ that is the argument of New.
+
+
+2001-12-23 Ravi Pratap <ravi@ximian.com>
+
+ * rootcontext.cs (LookupType): Check that current_type is not null before
+ going about looking at nested types.
+
+ * ecore.cs (EventExpr.EmitAddOrRemove): Rename from EmitAssign as we do
+ not implement the IAssignMethod interface any more.
+
+ * expression.cs (MemberAccess.ResolveMemberAccess): Handle EventExprs specially
+ where we tranform them into FieldExprs if they are being resolved from within
+ the declaring type.
+
+ * ecore.cs (SimpleName.DoResolve): Do the same here.
+
+ * assign.cs (DoResolve, Emit): Clean up code considerably.
+
+ * ../errors/bug10.cs : Add.
+
+ * ../errors/cs0070.cs : Add.
+
+ * typemanager.cs : Use PtrHashtable for Delegate data hashtable etc.
+
+ * assign.cs : Get rid of EventIsLocal everywhere.
+
+2001-12-23 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (ConvertIntLiteral): finished the implementation.
+
+ * statement.cs (SwitchLabel): Convert the value we are using as a
+ key before looking up the table.
+
+2001-12-22 Miguel de Icaza <miguel@ximian.com>
+
+ * codegen.cs (EmitTopBlock): Require a Location argument now.
+
+ * cs-parser.jay (constructor_declarator): We need to setup
+ current_local_parameters before we parse the
+ opt_constructor_initializer, to allow the variables to be bound
+ to the constructor arguments.
+
+ * rootcontext.cs (LookupType): First lookup nested classes in our
+ class and our parents before we go looking outside our class.
+
+ * expression.cs (ConstantFold): Extract/debox the values at the
+ beginnning.
+
+ * rootcontext.cs (EmitCode): Resolve the constants first before we
+ resolve the types. This is not really needed, but it helps debugging.
+
+ * statement.cs: report location.
+
+ * cs-parser.jay: pass location to throw statement.
+
+ * driver.cs: Small bug fix.
+
+ * report.cs: Updated format to be 4-zero filled digits.
+
+2001-12-22 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (CheckIndices): Fix minor bug where the wrong
+ variable was being referred to ;-)
+
+ (DoEmit): Do not call EmitStaticInitializers when the
+ underlying type is System.Object.
+
+2001-12-21 Ravi Pratap <ravi@ximian.com>
+
+ * ecore.cs (EventExpr.Resolve): Implement to correctly set the type
+ and do the usual workaround for SRE.
+
+ * class.cs (MyEventBuilder.EventType): New member to get at the type
+ of the event, quickly.
+
+ * expression.cs (Binary.ResolveOperator): Handle delegate addition.
+
+ * assign.cs (Assign.DoResolve): Handle the case when the target
+ is an EventExpr and perform the necessary checks.
+
+ * ecore.cs (EventExpr.EmitAssign): Implement the IAssignMethod
+ interface.
+
+ (SimpleName.MemberStaticCheck): Include check for EventExpr.
+
+ (EventExpr): Set the type in the constructor itself since we
+ are meant to be born fully resolved.
+
+ (EventExpr.Define): Revert code I wrote earlier.
+
+ * delegate.cs (NewDelegate.Resolve): Handle the case when the MethodGroup's
+ instance expression is null. The instance expression is a This in that case
+ or a null, depending on whether it is a static method or not.
+
+ Also flag an error if the reference to a method is ambiguous i.e the MethodGroupExpr
+ refers to more than one method.
+
+ * assign.cs (DoResolve): Check whether the event belongs to the same Type container
+ and accordingly flag errors.
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Throw.Emit): Add support for re-throwing exceptions.
+
+2001-12-22 Miguel de Icaza <miguel@ximian.com>
+
+ * location.cs (ToString): Provide useful rutine.
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (Expression.ConvertIntLiteral): Do not return Constant
+ objects, return the actual integral boxed.
+
+ * statement.cs (SwitchLabel): define an ILLabel for each
+ SwitchLabel.
+
+ (Switch.CheckSwitch): If the value is a Literal, extract
+ the underlying literal.
+
+ Also in the unused hashtable we had, add the SwitchLabel so we can
+ quickly look this value up.
+
+ * constant.cs: Implement a bunch of new constants. Rewrite
+ Literal based on this. Made changes everywhere to adapt to this.
+
+ * expression.cs (Expression.MakeByteBlob): Optimize routine by
+ dereferencing array only once, and also copes with enumrations.
+
+ bytes are two bytes wide, not one.
+
+ (Cast): Perform constant conversions.
+
+ * ecore.cs (TryImplicitIntConversion): Return literals instead of
+ wrappers to the literals here.
+
+ * expression.cs (DoNumericPromotions): long literals can converted
+ to ulong implicity (this is taken care of elsewhere, but I was
+ missing this spot).
+
+ * ecore.cs (Expression.Literalize): Make the return type Literal,
+ to improve type checking.
+
+ * rootcontext.cs: Lookup for nested classes in our class hierarchy.
+
+2001-12-20 Miguel de Icaza <miguel@ximian.com>
+
+ * literal.cs: Revert code from ravi that checked the bounds. The
+ bounds are sane by the definition of the type itself.
+
+ * typemanager.cs: Fix implementation of ImplementsInterface. We
+ need to actually look up in our parent hierarchy for interfaces
+ implemented.
+
+ * const.cs: Use the underlying type for enumerations
+
+ * delegate.cs: Compute the basename for the delegate creation,
+ that should fix the delegate test case, and restore the correct
+ Type Lookup semantics in rootcontext
+
+ * rootcontext.cs: Revert Ravi's last patch. The correct way of
+ referencing a nested type with the Reflection API is using the "+"
+ sign.
+
+ * cs-parser.jay: Do not require EOF token at the end.
+
+2001-12-20 Ravi Pratap <ravi@ximian.com>
+
+ * rootcontext.cs (LookupType): Concatenate type names with
+ a '.' instead of a '+' The test suite passes again.
+
+ * enum.cs (Enum.DefineEnum): Set RTSpecialName on the 'value__'
+ field of the enumeration.
+
+ * expression.cs (MemberAccess.ResolveMemberAccess): Add support for
+ the case when the member is an EventExpr.
+
+ * ecore.cs (EventExpr.InstanceExpression): Every event which is not
+ static has an associated instance expression.
+
+ * typemanager.cs (RegisterEvent): The usual workaround, now for events.
+
+ (GetAddMethod, GetRemoveMethod): Workarounds, as usual.
+
+ * class.cs (Event.Define): Register event and perform appropriate checks
+ for error #111.
+
+ We define the Add and Remove methods even if the use provides none because
+ in that case, we provide default implementations ourselves.
+
+ Define a private field of the type of the event. This is done by the CSC compiler
+ and we should be doing it too ;-)
+
+ * typemanager.cs (delegate_combine_delegate_delegate, delegate_remove_delegate_delegate):
+ More methods we use in code we generate.
+
+ (multicast_delegate_type, delegate_type): Two separate types since the distinction
+ is important.
+
+ (InitCoreTypes): Update accordingly for the above.
+
+ * class.cs (Event.Emit): Generate code for default accessors that we provide
+
+ (EmitDefaultMethod): Do the job in the above.
+
+ * delegate.cs (DefineDelegate): Use TypeManager.multicast_delegate_type in the
+ appropriate place.
+
+2001-12-20 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (Indexer.Define): Fix bug, we were setting both Get/Set
+ builders even if we were missing one.
+
+ * interface.cs, class.cs, enum.cs: When calling DefineNestedType
+ pass the Basename as our class name instead of the Name. The
+ basename will be correctly composed for us.
+
+ * parameter.cs (Paramters): Now takes a Location argument.
+
+ * decl.cs (DeclSpace.LookupType): Removed convenience function and
+ make all the code call directly LookupType in RootContext and take
+ this chance to pass the Location information everywhere.
+
+ * Everywhere: pass Location information.
+
+2001-12-19 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (Constructor.Define): Updated way of detecting the
+ length of the parameters.
+
+ (TypeContainer.DefineType): Use basename as the type name for
+ nested types.
+
+ (TypeContainer.Define): Do not recursively define types here, as
+ definition is taken care in order by the RootContext.
+
+ * tree.cs: Keep track of namespaces in a per-file basis.
+
+ * parameter.cs (Parameter.ComputeSignature): Update to use
+ DeclSpace.
+
+ (Parameters.GetSignature): ditto.
+
+ * interface.cs (InterfaceMethod.GetSignature): Take a DeclSpace
+ instead of a TypeContainer.
+
+ (Interface.SemanticAnalysis): Use `this' instead of our parent to
+ resolve names. Because we need to be resolve in our context, not
+ our parents.
+
+ * driver.cs: Implement response files.
+
+ * class.cs (TypeContainer.DefineType): If we are defined, do not
+ redefine ourselves.
+
+ (Event.Emit): Emit the code for add/remove handlers.
+ (Event.Define): Save the MethodBuilders for add/remove.
+
+ * typemanager.cs: Use pair here too.
+
+ * cs-parser.jay: Replaced use of DictionaryEntry for Pair because
+ DictionaryEntry requires the first argument to be non-null.
+
+ (enum_declaration): Compute full name for registering the
+ enumeration.
+
+ (delegate_declaration): Instead of using
+ formal_parameter_list, use opt_formal_parameter_list as the list
+ can be empty.
+
+ * cs-tokenizer.cs (PropertyParsing): renamed from `properties'
+ (EventParsing): New property that controls whether `add' and
+ `remove' are returned as tokens or identifiers (for events);
+
+2001-12-19 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Event.Define): Revamp use of EventBuilder completely. We now
+ use MyEventBuilder only and let it wrap the real builder for us.
+
+ (MyEventBuilder): Revamp constructor etc.
+
+ Implement all operations that we perform on EventBuilder in precisely the same
+ way here too.
+
+ (FindMembers): Update to use the EventBuilder member.
+
+ (Event.Emit): Update accordingly.
+
+2001-12-18 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (MyEventBuilder.Set*): Chain to the underlying builder
+ by calling the appropriate methods.
+
+ (GetCustomAttributes): Make stubs as they cannot possibly do anything
+ useful.
+
+ (Event.Emit): Use MyEventBuilder everywhere - even to set attributes.
+
+2001-12-17 Ravi Pratap <ravi@ximian.com>
+
+ * delegate.cs (Delegate.Populate): Check that the return type
+ and various parameters types are indeed accessible.
+
+ * class.cs (Constructor.Define): Same here.
+
+ (Field.Define): Ditto.
+
+ (Event.Define): Ditto.
+
+ (Operator.Define): Check that the underlying Method defined itself
+ correctly - so it's MethodBuilder should not be null.
+
+ * delegate.cs (DelegateInvocation.DoResolve): Bale out if the type of the Instance
+ expression happens to be null.
+
+ * class.cs (MyEventBuilder): Workaround for SRE lameness. Implement various abstract
+ members but as of now we don't seem to be able to do anything really useful with it.
+
+ (FindMembers): Handle events separately by returning the MyEventBuilder of the event,
+ not the EventBuilder.
+
+2001-12-18 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-tokenizer.cs: Add support for defines.
+ Add support for #if, #elif, #else, #endif
+
+ (eval_var): evaluates a variable.
+ (eval): stubbed for evaluating functions.
+
+ * cs-parser.jay: Pass the defines information
+
+ * driver.cs: Add --define command line option.
+
+ * decl.cs: Move MemberCore here.
+
+ Make it the base class for DeclSpace. This allows us to catch and
+ report 108 and 109 for everything now.
+
+ * class.cs (TypeContainer.Define): Extract all the members
+ before populating and emit the warning 108 (new keyword required
+ to override) instead of having each member implement this.
+
+ (MemberCore.Define): New abstract method, we will be using this in
+ the warning reporting engine in Populate.
+
+ (Operator.Define): Adjust to new MemberCore protocol.
+
+ * const.cs (Const): This does not derive from Expression, it is a
+ temporary object we use to create fields, it is a MemberCore.
+
+ * class.cs (Method.Define): Allow the entry point to be in a
+ specific class.
+
+ * driver.cs: Rewrite the argument handler to clean it up a bit.
+
+ * rootcontext.cs: Made it just an auxiliary namespace feature by
+ making everything static.
+
+ * driver.cs: Adapt code to use RootContext type name instead of
+ instance variable.
+
+ * delegate.cs: Remove RootContext argument.
+
+ * class.cs: (Struct, TypeContainer, Class): Remove RootContext
+ argument.
+
+ * class.cs (Event.Define): The lookup can fail.
+
+ * cs-tokenizer.cs: Begin implementation of pre-procesor.
+
+ * expression.cs: Resolve the this instance before invoking the code.
+
+2001-12-17 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Add a production in element_access that allows
+ the thing to become a "type" reference. This way we can parse
+ things like "(string [])" as a type.
+
+ Note that this still does not handle the more complex rules of
+ casts.
+
+
+ * delegate.cs (Delegate.Populate): Register the delegage constructor builder here.
+
+ * ecore.cs: (CopyNewMethods): new utility function used to
+ assemble the list of methods from running FindMembers.
+
+ (MemberLookup): Rework FindMembers so that
+
+2001-12-16 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (TypeContainer): Remove Delegates who fail to be
+ defined.
+
+ * delegate.cs (Populate): Verify that we dont get null return
+ values. TODO: Check for AsAccessible.
+
+ * cs-parser.jay: Use basename to emit error 574 (destructor should
+ have the same name as container class), not the full name.
+
+ * cs-tokenizer.cs (adjust_int): Fit the integer in the best
+ possible representation.
+
+ Also implements integer type suffixes U and L.
+
+2001-12-15 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (ArrayCreation.DoResolve): We need to do the
+ argument resolution *always*.
+
+ * decl.cs: Make this hold the namespace. Hold the root context as
+ well.
+ (LookupType): Move here.
+
+ * enum.cs, class.cs, interface.cs: Adapt to new hierarchy.
+
+ * location.cs (Row, Name): Fixed the code, it was always returning
+ references to the first file.
+
+ * interface.cs: Register properties defined through interfaces.
+
+ * driver.cs: Add support for globbing on the command line
+
+ * class.cs (Field): Make it derive from MemberCore as well.
+ (Event): ditto.
+
+2001-12-15 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Event::Define): Check that the type of the event is a delegate
+ type else flag error #66.
+
+ Also, re-use TypeContainer.MethodModifiersValid here too as the rules are the
+ same.
+
+ * attribute.cs (DefinePInvokeMethod): Handle named arguments and process
+ values of EntryPoint, CharSet etc etc.
+
+ Pass in the values to TypeBuilder.DefinePInvokeMethod; determine Type etc neatly.
+
+ * class.cs (FindMembers): If a method is in transit, its MethodBuilder will
+ be null and we should ignore this. I am not sure if this is really clean. Apparently,
+ there's no way of avoiding hitting this because the call is coming from SimpleName.DoResolve,
+ which needs this to do its work.
+
+ * ../errors/cs0066.cs : Add.
+
+2001-12-14 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs: (GetPropertyGetter, GetPropertyGetter): New
+ helper functions.
+
+ * class.cs: (MethodSignature.MethodSignature): Removed hack that
+ clears out the parameters field.
+ (MemberSignatureCompare): Cleanup
+
+ (MemberCore): New base class used to share code between MethodCore
+ and Property.
+
+ (RegisterRequiredImplementations) BindingFlags.Public requires
+ either BindingFlags.Instace or Static. Use instance here.
+
+ (Property): Refactored code to cope better with the full spec.
+
+ * parameter.cs (GetParameterInfo): Return an empty array instead
+ of null on error.
+
+ * class.cs (Property): Abstract or extern properties have no bodies.
+
+ * parameter.cs (GetParameterInfo): return a zero-sized array.
+
+ * class.cs (TypeContainer.MethodModifiersValid): Move all the
+ method modifier validation to the typecontainer so we can reuse
+ this on properties.
+
+ (MethodCore.ParameterTypes): return an empty sized array of types.
+
+ (Property.Define): Test property modifier validity.
+
+ Add tests for sealed/override too.
+
+ (Method.Emit): abstract or extern methods have no bodies.
+
+2001-12-14 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Method.IsPInvoke): Get rid of it as it is an expensive
+ thing.
+
+ (Method::Define, ::Emit): Modify accordingly.
+
+ * expression.cs (Invocation::OverloadResolve): Handle error # 121.
+
+ (ArrayCreation::MakeByteBlob): Handle floats and doubles.
+
+ * makefile: Pass in /unsafe.
+
+2001-12-13 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (MakeKey): Kill routine.
+
+ * class.cs (TypeContainer.Define): Correctly define explicit
+ method implementations (they require the full interface name plus
+ the method name).
+
+ * typemanager.cs: Deply the PtrHashtable here and stop using the
+ lame keys. Things work so much better.
+
+ This of course broke everyone who depended on `RegisterMethod' to
+ do the `test for existance' test. This has to be done elsewhere.
+
+ * support.cs (PtrHashtable): A hashtable that avoid comparing with
+ the object stupid Equals method (because, that like fails all over
+ the place). We still do not use it.
+
+ * class.cs (TypeContainer.SetRequiredInterface,
+ TypeContainer.RequireMethods): Killed these two routines and moved
+ all the functionality to RegisterRequiredImplementations.
+
+ (TypeContainer.RegisterRequiredImplementations): This routine now
+ registers all the implementations required in an array for the
+ interfaces and abstract methods. We use an array of structures
+ which can be computed ahead of time to reduce memory usage and we
+ also assume that lookups are cheap as most classes will not
+ implement too many interfaces.
+
+ We also avoid creating too many MethodSignatures.
+
+ (TypeContainer.IsInterfaceMethod): Update and optionally does not
+ clear the "pending" bit if we find that there are problems with
+ the declaration.
+
+ (TypeContainer.VerifyPendingMethods): Update to report errors of
+ methods that look like implementations but are not.
+
+ (TypeContainer.Define): Add support for explicit interface method
+ implementation.
+
+2001-12-12 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs: Keep track of the parameters here instead of
+ being a feature of the TypeContainer.
+
+ * class.cs: Drop the registration of parameters here, as
+ InterfaceMethods are also interface declarations.
+
+ * delegate.cs: Register methods with the TypeManager not only with
+ the TypeContainer. This code was buggy.
+
+ * interface.cs: Full registation here.
+
+2001-12-11 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: Remove reducer for binary expressions, it can not
+ be done this way.
+
+ * const.cs: Put here the code that used to go into constant.cs
+
+ * constant.cs: Put here the code for constants, this is a new base
+ class for Literals.
+
+ * literal.cs: Make Literal derive from Constant.
+
+2001-12-09 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Return.Emit): Report error 157 if the user
+ attempts to return from a finally block.
+
+ (Return.Emit): Instead of emitting a return, jump to the end of
+ the function.
+
+ * codegen.cs (EmitContext): ReturnValue, ReturnLabel: new
+ LocalBuilder to store the result of the function. ReturnLabel is
+ the target where we jump.
+
+
+2001-12-09 Radek Doulik <rodo@ximian.com>
+
+ * cs-parser.jay: remember alias in current namespace
+
+ * ecore.cs (SimpleName::DoResolve): use aliases for types or
+ namespaces
+
+ * class.cs (LookupAlias): lookup alias in my_namespace
+
+ * namespace.cs (UsingAlias): add alias, namespace_or_type pair to
+ aliases hashtable
+ (LookupAlias): lookup alias in this and if needed in parent
+ namespaces
+
+2001-12-08 Miguel de Icaza <miguel@ximian.com>
+
+ * support.cs:
+
+ * rootcontext.cs: (ModuleBuilder) Made static, first step into
+ making things static. I need this to avoid passing the
+ TypeContainer when calling ParameterType.
+
+ * support.cs (InternalParameters.ParameterType): Remove ugly hack
+ that did string manipulation to compute the type and then call
+ GetType. Use Parameter.ParameterType instead.
+
+ * cs-tokenizer.cs: Consume the suffix for floating values.
+
+ * expression.cs (ParameterReference): figure out whether this is a
+ reference parameter or not. Kill an extra variable by computing
+ the arg_idx during emission.
+
+ * parameter.cs (Parameters.GetParameterInfo): New overloaded
+ function that returns whether a parameter is an out/ref value or not.
+
+ (Parameter.ParameterType): The type of the parameter (base,
+ without ref/out applied).
+
+ (Parameter.Resolve): Perform resolution here.
+ (Parameter.ExternalType): The full type (with ref/out applied).
+
+ * statement.cs (Using.Emit, Using.EmitExpression): Implement
+ support for expressions on the using statement.
+
+2001-12-07 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Using.EmitLocalVariableDecls): Split the
+ localvariable handling of the using statement.
+
+ (Block.EmitMeta): Keep track of variable count across blocks. We
+ were reusing slots on separate branches of blocks.
+
+ (Try.Emit): Emit the general code block, we were not emitting it.
+
+ Check the type of the declaration to be an IDisposable or
+ something that can be implicity converted to it.
+
+ Emit conversions if required.
+
+ * ecore.cs (EmptyExpression): New utility class.
+ (Expression.ImplicitConversionExists): New utility function.
+
+2001-12-06 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Using): Implement.
+
+ * expression.cs (LocalVariableReference): Support read only variables.
+
+ * statement.cs: Remove the explicit emit for the Leave opcode.
+ (VariableInfo): Add a readonly field.
+
+2001-12-05 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (ConvCast): new class used to encapsulate the various
+ explicit integer conversions that works in both checked and
+ unchecked contexts.
+
+ (Expression.ConvertNumericExplicit): Use new ConvCast class to
+ properly generate the overflow opcodes.
+
+2001-12-04 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs: The correct type for the EmptyExpression is the
+ element_type, not the variable type. Ravi pointed this out.
+
+2001-12-04 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Method::Define): Handle PInvoke methods specially
+ by using DefinePInvokeMethod instead of the usual one.
+
+ * attribute.cs (DefinePInvokeMethod): Implement as this is what is called
+ above to do the task of extracting information and defining the method.
+
+2001-12-04 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (ArrayCreation::EmitStaticInitializers): Get rid
+ of the condition for string type.
+
+ (Emit): Move that here.
+
+ (ArrayCreation::CheckIndices): Keep string literals in their expression
+ form.
+
+ (EmitDynamicInitializers): Handle strings appropriately.
+
+2001-12-04 Miguel de Icaza <miguel@ximian.com>
+
+ * codegen.cs (EmitContext): Replace multiple variables with a
+ single pointer to the current Switch statement.
+
+ * statement.cs (GotoDefault, Switch): Adjust to cleaned up
+ EmitContext.
+
+2001-12-03 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs
+
+ * statement.cs (GotoDefault), cs-parser.jay: Implement `goto
+ default'.
+
+ (Foreach.Emit): Foreach on arrays was not setting
+ up the loop variables (for break/continue).
+
+ (GotoCase): Semi-implented.
+
+2001-12-03 Ravi Pratap <ravi@ximian.com>
+
+ * attribute.cs (CheckAttribute): Handle system attributes by using
+ Attribute.GetAttributes to examine information we need.
+
+ (GetValidPlaces): Same here.
+
+ * class.cs (Method::Define): Catch invalid use of extern and abstract together.
+
+ * typemanager.cs (dllimport_type): Core type for System.DllImportAttribute.
+
+ * class.cs (Method.IsPinvoke): Used to determine if we are a PInvoke method.
+
+ (Method::Define): Set appropriate flags if we have a DllImport attribute.
+
+ (Method::Emit): Handle the case when we are a PInvoke method.
+
+2001-12-03 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: Use ResolveWithSimpleName on compound names.
+
+2001-12-02 Ravi Pratap <ravi@ximian.com>
+
+ * constant.cs (EmitConstant): Make sure we resolve the associated expression
+ before trying to reduce it.
+
+ * typemanager.cs (RegisterConstant, LookupConstant): Implement.
+
+ * constant.cs (LookupConstantValue): Implement.
+
+ (EmitConstant): Use the above in emitting the constant.
+
+ * expression.cs (MemberAccess::ResolveMemberAccess): Handle constants
+ that are user-defined by doing a LookupConstantValue on them.
+
+ (SimpleName::DoResolve): When we have a FieldExpr, cope with constants
+ too, like above.
+
+2001-11-29 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (BaseAccess, BaseIndexer): Also split this out.
+
+ (BaseAccess.DoResolve): Implement.
+
+ (MemberAccess.DoResolve): Split this routine into a
+ ResolveMemberAccess routine that can be used independently
+
+2001-11-28 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Probe, Is, As): Split Probe in two classes Is and
+ As that share bits of the implementation. Is returns a boolean,
+ while As returns the Type that is being probed.
+
+2001-12-01 Ravi Pratap <ravi@ximian.com>
+
+ * enum.cs (LookupEnumValue): Re-write various bits, return an object value
+ instead of a Literal - much easier.
+
+ (EnumInTransit): Remove - utterly useless :-)
+
+ (Populate): Re-write bits - remove duplicate code etc. The code is much neater now.
+
+ * expression.cs (MemberLookup): Cope with user-defined enums when they are in transit.
+
+ * enum.cs (LookupEnumValue): Auto-compute next values by going down the dependency
+ chain when we have no associated expression.
+
+2001-11-30 Ravi Pratap <ravi@ximian.com>
+
+ * constant.cs (Define): Use Location while reporting the errror.
+
+ Also emit a warning when 'new' is used and there is no inherited
+ member to hide.
+
+ * enum.cs (EnumInTransit): Used to tell if an enum type is in the process of being
+ populated.
+
+ (LookupEnumValue): Implement to lookup an enum member's value and define it
+ if necessary.
+
+ (Populate): Re-write accordingly to use the above routine.
+
+2001-11-27 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (This): Fix prototype for DoResolveLValue to
+ override the base class DoResolveLValue.
+
+ * cs-parser.cs: Report errors cs574 and cs575 (destructor
+ declarations)
+
+ * ecore.cs (FieldExpr.EmitAssign): Handle value types specially
+ (we need to load the address of the field here). This fixes
+ test-22.
+
+ (FieldExpr.DoResolveLValue): Call the DoResolve
+ function to initialize the Instance expression.
+
+ * statement.cs (Foreach.Emit): Fix the bug where we did not invoke
+ correctly the GetEnumerator operation on a value type.
+
+ * cs-parser.jay: Add more simple parsing error catches.
+
+ * statement.cs (Switch): Add support for string switches.
+ Handle null specially.
+
+ * literal.cs (NullLiteral): Make NullLiteral objects singletons.
+
+2001-11-28 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (local_constant_declaration): Use declare_local_constant.
+
+ (declare_local_constant): New helper function.
+
+ * statement.cs (AddConstant): Keep a separate record of constants
+
+ (IsConstant): Implement to determine if a variable is a constant.
+
+ (GetConstantExpression): Implement.
+
+ * expression.cs (LocalVariableReference): Handle the case when it is a constant.
+
+ * statement.cs (IsVariableDefined): Re-write.
+
+2001-11-27 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (TypeContainer::FindMembers): Look for constants
+ in the case when we are looking for MemberTypes.Field
+
+ * expression.cs (MemberAccess::DoResolve): Check that in the
+ case we are a FieldExpr and a Literal, we are not being accessed
+ by an instance reference.
+
+ * cs-parser.jay (local_constant_declaration): Implement.
+
+ (declaration_statement): Implement for constant declarations.
+
+2001-11-26 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Switch): Catch double defaults.
+
+ (Switch): More work on the switch() statement
+ implementation. It works for integral values now, need to finish
+ string support.
+
+
+2001-11-24 Miguel de Icaza <miguel@ximian.com>
+
+ * ecore.cs (Expression.ConvertIntLiteral): New function to convert
+ integer literals into other integer literals. To be used by
+ switch.
+
+2001-11-24 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (ArrayCreation): Get rid of ArrayExprs : we save
+ some memory.
+
+ (EmitDynamicInitializers): Cope with the above since we extract data
+ directly from ArrayData now.
+
+ (ExpectInitializers): Keep track of whether initializers are mandatory
+ or not.
+
+ (Bounds): Make it a hashtable to prevent the same dimension being
+ recorded for every element in that dimension.
+
+ (EmitDynamicInitializers): Fix bug which prevented the Set array method
+ from being found.
+
+ Also fix bug which was causing the indices to be emitted in the reverse
+ order.
+
+2001-11-24 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (ArrayCreation): Implement the bits that Ravi left
+ unfinished. They do not work, because the underlying code is
+ sloppy.
+
+2001-11-22 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Remove bogus fixme.
+
+ * statement.cs (Switch, SwitchSection, SwithLabel): Started work
+ on Switch statement.
+
+2001-11-23 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (IsDelegateType, IsEnumType): Fix logic to determine
+ the same.
+
+ * expression.cs (ArrayCreation::CheckIndices): Get rid of the require_constant
+ parameter. Apparently, any expression is allowed.
+
+ (ValidateInitializers): Update accordingly.
+
+ (CheckIndices): Fix some tricky bugs thanks to recursion.
+
+ * delegate.cs (NewDelegate::DoResolve): Re-write large portions as
+ I was being completely brain-dead.
+
+ (VerifyMethod, VerifyApplicability, VerifyDelegate): Make static
+ and re-write acordingly.
+
+ (DelegateInvocation): Re-write accordingly.
+
+ * expression.cs (ArrayCreation::Emit): Handle string initialization separately.
+
+ (MakeByteBlob): Handle types more correctly.
+
+ * expression.cs (ArrayCreation:Emit): Write preliminary code to do
+ initialization from expressions but it is incomplete because I am a complete
+ Dodo :-|
+
+2001-11-22 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (If.Emit): Fix a bug that generated incorrect code
+ on If. Basically, we have to return `true' (ie, we do return to
+ our caller) only if both branches of the if return.
+
+ * expression.cs (Binary.Emit): LogicalOr and LogicalAnd are
+ short-circuit operators, handle them as short circuit operators.
+
+ (Cast.DoResolve): Resolve type.
+ (Cast.Cast): Take an expression as the target type.
+
+ * cs-parser.jay (cast_expression): Remove old hack that only
+ allowed a limited set of types to be handled. Now we take a
+ unary_expression and we resolve to a type during semantic
+ analysis.
+
+ Use the grammar productions from Rhys to handle casts (this is
+ not complete like Rhys syntax yet, we fail to handle that corner
+ case that C# has regarding (-x), but we will get there.
+
+2001-11-22 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (EmitFieldInitializer): Take care of the case when we have a
+ field which is an array type.
+
+ * cs-parser.jay (declare_local_variables): Support array initialization too.
+
+ * typemanager.cs (MakeKey): Implement.
+
+ (everywhere): Use the above appropriately.
+
+ * cs-parser.jay (for_statement): Update for array initialization while
+ declaring variables.
+
+ * ecore.cs : The error message was correct, it's the variable's names that
+ were misleading ;-) Make the code more readable.
+
+ (MemberAccess::DoResolve): Fix the code which handles Enum literals to set
+ the correct type etc.
+
+ (ConvertExplicit): Handle Enum types by examining the underlying type.
+
+2001-11-21 Ravi Pratap <ravi@ximian.com>
+
+ * parameter.cs (GetCallingConvention): Always return
+ CallingConventions.Standard for now.
+
+2001-11-22 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Binary.ResolveOperator): Update the values of `l'
+ and `r' after calling DoNumericPromotions.
+
+ * ecore.cs: Fix error message (the types were in the wrong order).
+
+ * statement.cs (Foreach.ProbeCollectionType): Need to pass
+ BindingFlags.Instance as well
+
+ * ecore.cs (Expression.TryImplicitIntConversion): Wrap the result
+ implicit int literal conversion in an empty cast so that we
+ propagate the right type upstream.
+
+ (UnboxCast): new class used to unbox value types.
+ (Expression.ConvertExplicit): Add explicit type conversions done
+ by unboxing.
+
+ (Expression.ImplicitNumericConversion): Oops, forgot to test for
+ the target type before applying the implicit LongLiterals to ULong
+ literal cast.
+
+2001-11-21 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay (for_statement): Reworked the way For works: now
+ we declare manually any variables that are introduced in
+ for_initializer to solve the problem of having out-of-band code
+ emition (that is what got for broken).
+
+ (declaration_statement): Perform the actual variable declaration
+ that used to be done in local_variable_declaration here.
+
+ (local_variable_declaration): Do not declare anything, just pass
+ the information on a DictionaryEntry
+
+2001-11-20 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (ArrayCreation::CheckIndices): The story continues :-) Complete
+ re-write of the logic to now make it recursive.
+
+ (UpdateIndices): Re-write accordingly.
+
+ Store element data in a separate ArrayData list in the above methods.
+
+ (MakeByteBlob): Implement to dump the array data into a byte array.
+
+2001-11-19 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (ArrayCreation): Factor out some code from ValidateInitializers
+ into CheckIndices.
+
+ * constant.cs (Define): Implement.
+
+ (EmitConstant): Re-write fully.
+
+ Pass in location info.
+
+ * class.cs (Populate, Emit): Call Constant::Define and Constant::EmitConstant
+ respectively.
+
+ * cs-parser.jay (constant_declarator): Use VariableDeclaration instead of
+ DictionaryEntry since we need location info too.
+
+ (constant_declaration): Update accordingly.
+
+ * expression.cs (ArrayCreation): Make ValidateInitializers simpler by factoring
+ code into another method : UpdateIndices.
+
+2001-11-18 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (ArrayCreation::ValidateInitializers): Update to perform
+ some type checking etc.
+
+2001-11-17 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (ArrayCreation::ValidateInitializers): Implement
+ bits to provide dimension info if the user skips doing that.
+
+ Update second constructor to store the rank correctly.
+
+2001-11-16 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (ArrayCreation::ValidateInitializers): Poke around
+ and try to implement.
+
+ * ../errors/cs0150.cs : Add.
+
+ * ../errors/cs0178.cs : Add.
+
+2001-11-16 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs: Implement foreach on multi-dimensional arrays.
+
+ * parameter.cs (Parameters.GetParameterByName): Also lookup the
+ name of the params argument.
+
+ * expression.cs: Use EmitStoreOpcode to get the right opcode while
+ initializing the array.
+
+ (ArrayAccess.EmitStoreOpcode): move the opcode generation here, so
+ we can use this elsewhere.
+
+ * statement.cs: Finish implementation of foreach for single
+ dimension arrays.
+
+ * cs-parser.jay: Use an out-of-band stack to pass information
+ around, I wonder why I need this.
+
+ foreach_block: Make the new foreach_block the current_block.
+
+ * parameter.cs (Parameters.GetEmptyReadOnlyParameters): New
+ function used to return a static Parameters structure. Used for
+ empty parameters, as those are created very frequently.
+
+ * cs-parser.jay, class.cs: Use GetEmptyReadOnlyParameters
+
+2001-11-15 Ravi Pratap <ravi@ximian.com>
+
+ * interface.cs : Default modifier is private, not public. The
+ make verify test passes again.
+
+2001-11-15 Ravi Pratap <ravi@ximian.com>
+
+ * support.cs (ReflectionParameters): Fix logic to determine
+ whether the last parameter is a params one. Test 9 passes again.
+
+ * delegate.cs (Populate): Register the builders we define with
+ RegisterParameterForBuilder. Test 19 passes again.
+
+ * cs-parser.jay (property_declaration): Reference $6 instead
+ of $$ to get at the location.
+
+ (indexer_declaration): Similar stuff.
+
+ (attribute): Ditto.
+
+ * class.cs (Property): Register parameters for the Get and Set methods
+ if they exist. Test 23 passes again.
+
+ * expression.cs (ArrayCreation::Emit): Pass null for the method in the
+ call to EmitArguments as we are sure there aren't any params arguments.
+ Test 32 passes again.
+
+ * suppor.cs (ParameterDesc, ParameterModifier): Fix trivial bug causing
+ IndexOutOfRangeException.
+
+ * class.cs (Property::Define): Register property using TypeManager.RegisterProperty
+ Test 33 now passes again.
+
+2001-11-15 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Kill horrendous hack ($??? = lexer.Location) that
+ broke a bunch of things. Will have to come up with a better way
+ of tracking locations.
+
+ * statement.cs: Implemented foreach for single dimension arrays.
+
+2001-11-09 Miguel de Icaza <miguel@ximian.com>
+
+ * enum.cs (Enum.Emit): Delay the lookup of loc until we run into
+ an error. This removes the lookup from the critical path.
+
+ * cs-parser.jay: Removed use of temporary_loc, which is completely
+ broken.
+
+2001-11-14 Miguel de Icaza <miguel@ximian.com>
+
+ * support.cs (ReflectionParameters.ParameterModifier): Report
+ whether the argument is a PARAMS argument or not.
+
+ * class.cs: Set the attribute `ParamArrayAttribute' on the
+ parameter argument.
+
+ * typemanager.cs: Define param_array_type (ParamArrayAttribute)
+ and cons_param_array_attribute (ConstructorInfo for
+ ParamArrayAttribute).,
+
+ * codegen.cs: Emit the return using the `Return' statement, that
+ way we can report the error correctly for missing return values.
+
+ * class.cs (Method.Emit): Clean up.
+
+ * expression.cs (Argument.Resolve): Take another argument: the
+ location where this argument is used. Notice that this is not
+ part of the "Argument" class as to reduce the size of the
+ structure (we know the approximate location anyways).
+
+ Test if the argument is a variable-reference, if not, then
+ complain with a 206.
+
+ (Argument.Emit): Emit addresses of variables.
+
+ (Argument.FullDesc): Simplify.
+
+ (Invocation.DoResolve): Update for Argument.Resolve.
+
+ (ElementAccess.DoResolve): ditto.
+
+ * delegate.cs (DelegateInvocation.Emit): Invocation of Invoke
+ method should be virtual, as this method is always virtual.
+
+ (NewDelegate.DoResolve): Update for Argument.Resolve.
+
+ * class.cs (ConstructorInitializer.DoResolve): ditto.
+
+ * attribute.cs (Attribute.Resolve): ditto.
+
+2001-11-13 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Foreach.Emit): Use EmitAssign instead of Store.
+
+ * expression.cs (ParameterReference): Drop IStackStorage and implement
+ IAssignMethod instead.
+
+ (LocalVariableReference): ditto.
+
+ * ecore.cs (FieldExpr): Drop IStackStorage and implement
+ IAssignMethod instead.
+
+2001-11-13 Miguel de Icaza <miguel@ximian.com>
+
+ * parameter.cs, expression.cs, class.cs, ecore.cs: Made all
+ enumerations that are used in heavily used structures derive from
+ byte in a laughable and pathetic attempt to reduce memory usage.
+ This is the kind of pre-optimzations that you should not do at
+ home without adult supervision.
+
+ * expression.cs (UnaryMutator): New class, used to handle ++ and
+ -- separatedly from the other unary operators. Cleans up the
+ code, and kills the ExpressionStatement dependency in Unary.
+
+ (Unary): Removed `method' and `Arguments' from this class, making
+ it smaller, and moving it all to SimpleCall, so I can reuse this
+ code in other locations and avoid creating a lot of transient data
+ strucutres when not required.
+
+ * cs-parser.jay: Adjust for new changes.
+
+2001-11-11 Miguel de Icaza <miguel@ximian.com>
+
+ * enum.cs (Enum.Populate): If there is a failure during
+ definition, return
+
+ * cs-parser.jay (opt_enum_base): we used to catch type errors
+ here, but this is really incorrect. The type error should be
+ catched during semantic analysis.
+
+2001-12-11 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (operator_declarator, conversion_operator_declarator): Set
+ current_local_parameters as expected since I, in my stupidity, had forgotten
+ to do this :-)
+
+ * attribute.cs (GetValidPlaces): Fix stupid bug.
+
+ * class.cs (Method::Emit): Perform check on applicability of attributes.
+
+ (Constructor::Emit): Ditto.
+
+ (Field::Emit): Ditto.
+
+ (Field.Location): Store location information.
+
+ (Property, Event, Indexer, Operator): Ditto.
+
+ * cs-parser.jay (field_declaration): Pass in location for each field.
+
+ * ../errors/cs0592.cs : Add.
+
+2001-11-12 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (attribute_usage_type): New static member for System.AttributeUsage.
+
+ (InitCoreTypes): Update accordingly.
+
+ (RegisterAttrType, LookupAttr): Implement.
+
+ * attribute.cs (Attribute.Targets, AllowMultiple, Inherited): New fields to hold
+ info about the same.
+
+ (Resolve): Update to populate the above as necessary.
+
+ (Error592): Helper.
+
+ (GetValidPlaces): Helper to the above.
+
+ (CheckAttribute): Implement to perform validity of attributes on declarative elements.
+
+ * class.cs (TypeContainer::Emit): Update attribute emission code to perform checking etc.
+
+2001-11-12 Ravi Pratap <ravi@ximian.com>
+
+ * attribute.cs (Attribute::Resolve): Expand to handle named arguments too.
+
+ * ../errors/cs0617.cs : Add.
+
+2001-11-11 Ravi Pratap <ravi@ximian.com>
+
+ * enum.cs (Emit): Rename to Populate to be more consistent with what
+ we expect it to do and when exactly it is called.
+
+ * class.cs, rootcontext.cs : Update accordingly.
+
+ * typemanager.cs (RegisterField, GetValue): Workarounds for the fact that
+ FieldInfo.GetValue does not work on dynamic types ! S.R.E lameness strikes again !
+
+ * enum.cs (Populate): Register fields with TypeManager.RegisterField.
+
+ * expression.cs (MemberAccess.DoResolve): Adjust code to obtain the value
+ of a fieldinfo using the above, when dealing with a FieldBuilder.
+
+2001-11-10 Ravi Pratap <ravi@ximian.com>
+
+ * ../errors/cs0031.cs : Add.
+
+ * ../errors/cs1008.cs : Add.
+
+ * ../errrors/cs0543.cs : Add.
+
+ * enum.cs (DefineEnum): Check the underlying type and report an error if not a valid
+ enum type.
+
+ (FindMembers): Implement.
+
+ * typemanager.cs (FindMembers): Re-write to call the appropriate methods for
+ enums and delegates too.
+
+ (enum_types): Rename to builder_to_enum.
+
+ (delegate_types): Rename to builder_to_delegate.
+
+ * delegate.cs (FindMembers): Implement.
+
+2001-11-09 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (IsEnumType): Implement.
+
+ * enum.cs (Emit): Re-write parts to account for the underlying type
+ better and perform checking etc.
+
+ (GetNextDefaultValue): Helper to ensure we don't overshoot max value
+ of the underlying type.
+
+ * literal.cs (GetValue methods everywhere): Perform bounds checking and return
+ value
+
+ * enum.cs (error31): Helper to report error #31.
+
+ * cs-parser.jay (enum_declaration): Store location of each member too.
+
+ * enum.cs (member_to_location): New hashtable.
+
+ (AddEnumMember): Update location hashtable.
+
+ (Emit): Use the location of each member while reporting errors.
+
+2001-11-09 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: A for_initializer if is a
+ local_variable_declaration really ammount to have an implicit
+ block with the variable declaration and no initializer for for.
+
+ * statement.cs (For.Emit): Cope with null initializers.
+
+ This fixes the infinite loop on for initializers.
+
+2001-11-08 Miguel de Icaza <miguel@ximian.com>
+
+ * enum.cs: More cleanup.
+
+ * ecore.cs: Remove dead code.
+
+ * class.cs (Property.Emit): More simplification.
+ (Event.Emit): ditto.
+
+ Reworked to have less levels of indentation.
+
+2001-11-08 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Property): Emit attributes.
+
+ (Field): Ditto.
+
+ (Event): Ditto.
+
+ (Indexer): Ditto.
+
+ (Operator): Ditto.
+
+ * enum.cs (Emit): Ditto.
+
+ * rootcontext.cs (ResolveTree, EmitCode, CloseTypes): Do the same for
+ Enums too.
+
+ * class.cs (Field, Event, etc.): Move attribute generation into the
+ Emit method everywhere.
+
+ * enum.cs (Enum): Revamp to use the same definition semantics as delegates so
+ we have a DefineEnum, CloseEnum etc. The previous way of doing things was not right
+ as we had no way of defining nested enums !
+
+ * rootcontext.cs : Adjust code accordingly.
+
+ * typemanager.cs (AddEnumType): To keep track of enum types separately.
+
+2001-11-07 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (EvalConstantExpression): Move into ecore.cs
+
+ * enum.cs (Enum): Rename some members and make them public and readonly
+ according to our convention.
+
+ * modifiers.cs (EnumAttr): Implement as we need to set only visibility flags,
+ nothing else.
+
+ * enum.cs (Enum::Define): Use the above instead of TypeAttr.
+
+ (Enum::Emit): Write a simple version for now which doesn't try to compute
+ expressions. I shall modify this to be more robust in just a while.
+
+ * class.cs (TypeContainer::Emit): Make sure we include Enums too.
+
+ (TypeContainer::CloseType): Create the Enum types too.
+
+ * attribute.cs (Resolve): Use the new Reduce method instead of EvalConstantExpression.
+
+ * expression.cs (EvalConstantExpression): Get rid of completely.
+
+ * enum.cs (Enum::Emit): Use the new expression reducer. Implement assigning
+ user-defined values and other cases.
+
+ (IsValidEnumLiteral): Helper function.
+
+ * expression.cs (ExprClassfromMemberInfo): Modify to not do any literalizing
+ out there in the case we had a literal FieldExpr.
+
+ (MemberAccess:DoResolve): Do the literalizing of the FieldExpr here.
+
+ (Literalize): Revamp a bit to take two arguments.
+
+ (EnumLiteral): New class which derives from Literal to wrap enum literals.
+
+2001-11-06 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (compilation_unit): Remove extra opt_attributes for now.
+
+ * expression.cs (ArrayCreation::ValidateInitializers): Implement.
+
+ (Resolve): Use the above to ensure we have proper initializers.
+
+2001-11-05 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Expression::EvalConstantExpression): New method to
+ evaluate constant expressions.
+
+ * attribute.cs (Attribute::Resolve): Modify bits to use the above function.
+
+2001-11-07 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (ArrayCreation.Emit): Some bits to initialize data
+ in an array.
+
+ (Binary.ResolveOperator): Handle operator != (object a, object b)
+ and operator == (object a, object b);
+
+ (Binary.DoNumericPromotions): Indicate whether the numeric
+ promotion was possible.
+
+ (ArrayAccess.DoResolve, ArrayAccess.Emit, ArrayAccess.EmitAssign):
+ Implement.
+
+ Made the ArrayAccess implement interface IAssignMethod instead of
+ IStackStore as the order in which arguments are passed reflects
+ this.
+
+ * assign.cs: Instead of using expr.ExprClass to select the way of
+ assinging, probe for the IStackStore/IAssignMethod interfaces.
+
+ * typemanager.cs: Load InitializeArray definition.
+
+ * rootcontext.cs (RootContext.MakeStaticData): Used to define
+ static data that can be used to initialize arrays.
+
+2001-11-05 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: Handle operator== and operator!= for booleans.
+
+ (Conditioal.Reduce): Implement reducer for the ?: operator.
+
+ (Conditional.Resolve): Implement dead code elimination.
+
+ (Binary.Resolve): Catch string literals and return a new
+ concatenated string.
+
+ (Unary.Reduce): Implement reduction of unary expressions.
+
+ * ecore.cs: Split out the expression core handling here.
+
+ (Expression.Reduce): New method used to perform constant folding
+ and CSE. This is needed to support constant-expressions.
+
+ * statement.cs (Statement.EmitBoolExpression): Pass true and false
+ targets, and optimize for !x.
+
+2001-11-04 Ravi Pratap <ravi@ximian.com>
+
+ * attribute.cs (Attribute::Resolve): Implement guts. Note that resolution
+ of an attribute gives us a CustomAttributeBuilder which we use accordingly to
+ set custom atttributes.
+
+ * literal.cs (Literal::GetValue): New abstract method to return the actual
+ value of the literal, cast as an object.
+
+ (*Literal): Implement GetValue method.
+
+ * cs-parser.jay (positional_argument_list, named_argument_list): Add not just plain
+ expressions to the arraylist but objects of type Argument.
+
+ * class.cs (TypeContainer::Emit): Emit our attributes too.
+
+ (Method::Emit, Constructor::Emit): Ditto.
+
+ * cs-parser.jay (constructor_declaration): Set attributes too, which we seemed
+ to be ignoring earlier.
+
+2001-11-03 Ravi Pratap <ravi@ximian.com>
+
+ * attribute.cs (AttributeSection::Define): Implement to do the business
+ of constructing a CustomAttributeBuilder.
+
+ (Attribute): New trivial class. Increases readability of code.
+
+ * cs-parser.jay : Update accordingly.
+
+ (positional_argument_list, named_argument_list, named_argument): New rules
+
+ (attribute_arguments): Use the above so that we are more correct.
+
+2001-11-02 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Invocation::IsParamsMethodApplicable): Implement
+ to perform all checks for a method with a params parameter.
+
+ (Invocation::OverloadResolve): Update to use the above method and therefore
+ cope correctly with params method invocations.
+
+ * support.cs (InternalParameters::ParameterDesc): Provide a desc for
+ params too.
+
+ * class.cs (ConstructorInitializer::Resolve): Make sure we look for Non-public
+ constructors in our parent too because we can't afford to miss out on
+ protected ones ;-)
+
+ * attribute.cs (AttributeSection): New name for the class Attribute
+
+ Other trivial changes to improve readability.
+
+ * cs-parser.jay (opt_attributes, attribute_section etc.): Modify to
+ use the new class names.
+
+2001-11-01 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Method::Define): Complete definition for params types too
+
+ (Indexer::Define): Ditto.
+
+ * support.cs (InternalParameters::ParameterType, ParameterDesc, ParameterModifier):
+ Cope everywhere with a request for info about the array parameter.
+
+2001-11-01 Ravi Pratap <ravi@ximian.com>
+
+ * tree.cs (RecordNamespace): Fix up to check for the correct key.
+
+ * cs-parser.jay (GetQualifiedIdentifier): New Helper method used in
+ local_variable_type to extract the string corresponding to the type.
+
+ (local_variable_type): Fixup the action to use the new helper method.
+
+ * codegen.cs : Get rid of RefOrOutParameter, it's not the right way to
+ go.
+
+ * expression.cs : Clean out code which uses the above.
+
+2001-10-31 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (RegisterMethod): Check if we already have an existing key
+ and bale out if necessary by returning a false.
+
+ (RegisterProperty): Ditto.
+
+ * class.cs (everywhere): Check the return value from TypeManager.RegisterMethod
+ and print out appropriate error messages.
+
+ * interface.cs (everywhere): Ditto.
+
+ * cs-parser.jay (property_declaration, event_declaration, indexer_declaration): Pass
+ location to constructor.
+
+ * class.cs (Property, Event, Indexer): Update accordingly.
+
+ * ../errors/cs111.cs : Added.
+
+ * expression.cs (Invocation::IsApplicable): New static method to determine applicability
+ of a method, as laid down by the spec.
+
+ (Invocation::OverloadResolve): Use the above method.
+
+2001-10-31 Ravi Pratap <ravi@ximian.com>
+
+ * support.cs (InternalParameters): Get rid of crap taking in duplicate info. We
+ now take a TypeContainer and a Parameters object.
+
+ (ParameterData): Modify return type of ParameterModifier method to be
+ Parameter.Modifier and not a string.
+
+ (ReflectionParameters, InternalParameters): Update accordingly.
+
+ * expression.cs (Argument::GetParameterModifier): Same here.
+
+ * support.cs (InternalParameters::ParameterType): Find a better way of determining
+ if we are a ref/out parameter. Actually, the type shouldn't be holding the '&'
+ symbol in it at all so maybe this is only for now.
+
+2001-10-30 Ravi Pratap <ravi@ximian.com>
+
+ * support.cs (InternalParameters): Constructor now takes an extra argument
+ which is the actual Parameters class.
+
+ (ParameterDesc): Update to provide info on ref/out modifiers.
+
+ * class.cs (everywhere): Update call to InternalParameters to pass in
+ the second argument too.
+
+ * support.cs (ParameterData): Add ParameterModifier, which is a method
+ to return the modifier info [ref/out etc]
+
+ (InternalParameters, ReflectionParameters): Implement the above.
+
+ * expression.cs (Argument::ParameterModifier): Similar function to return
+ info about the argument's modifiers.
+
+ (Invocation::OverloadResolve): Update to take into account matching modifiers
+ too.
+
+ * class.cs (Indexer::Define): Actually define a Parameter object and put it onto
+ a new SetFormalParameters object which we pass to InternalParameters.
+
+2001-10-30 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (NewArray): Merge into the ArrayCreation class.
+
+2001-10-29 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (NewArray): Merge classes NewBuiltinArray and
+ NewUserdefinedArray into one as there wasn't much of a use in having
+ two separate ones.
+
+ * expression.cs (Argument): Change field's name to ArgType from Type.
+
+ (Type): New readonly property which returns the proper type, taking into
+ account ref/out modifiers.
+
+ (everywhere): Adjust code accordingly for the above.
+
+ * codegen.cs (EmitContext.RefOrOutParameter): New field to determine
+ whether we are emitting for a ref or out parameter.
+
+ * expression.cs (Argument::Emit): Use the above field to set the state.
+
+ (LocalVariableReference::Emit): Update to honour the flag and emit the
+ right stuff.
+
+ * parameter.cs (Attributes): Set the correct flags for ref parameters.
+
+ * expression.cs (Argument::FullDesc): New function to provide a full desc.
+
+ * support.cs (ParameterData): Add method ParameterDesc to the interface.
+
+ (ReflectionParameters, InternalParameters): Implement the above method.
+
+ * expression.cs (Invocation::OverloadResolve): Use the new desc methods in
+ reporting errors.
+
+ (Invocation::FullMethodDesc): Ditto.
+
+2001-10-29 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Add extra production for the second form of array
+ creation.
+
+ * expression.cs (ArrayCreation): Update to reflect the above
+ change.
+
+ * Small changes to prepare for Array initialization.
+
+2001-10-28 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs (ImplementsInterface): interface might be null;
+ Deal with this problem;
+
+ Also, we do store negative hits on the cache (null values), so use
+ this instead of calling t.GetInterfaces on the type everytime.
+
+2001-10-28 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (IsBuiltinType): New method to help determine the same.
+
+ * expression.cs (New::DoResolve): Get rid of array creation code and instead
+ split functionality out into different classes.
+
+ (New::FormArrayType): Move into NewBuiltinArray.
+
+ (Invocation::EmitArguments): Get rid of the MethodBase argument. Appears
+ quite useless.
+
+ (NewBuiltinArray): New class to handle creation of built-in arrays.
+
+ (NewBuiltinArray::DoResolve): Implement guts of array creation. Also take into
+ account creation of one-dimensional arrays.
+
+ (::Emit): Implement to use Newarr and Newobj opcodes accordingly.
+
+ (NewUserdefinedArray::DoResolve): Implement.
+
+ * cs-parser.jay (local_variable_type): Fix up to add the rank to the variable too.
+
+ * typemanager.cs (AddModule): Used to add a ModuleBuilder to the list of modules
+ we maintain inside the TypeManager. This is necessary to perform lookups on the
+ module builder.
+
+ (LookupType): Update to perform GetType on the module builders too.
+
+ * driver.cs (Driver): Add the ModuleBuilder to the list maintained by the TypeManager.
+
+ * exprssion.cs (NewUserdefinedArray::Emit): Implement.
+
+2001-10-23 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (New::DoResolve): Implement guts of array creation.
+
+ (New::FormLookupType): Rename to FormArrayType and modify ever so slightly.
+
+2001-10-27 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: Fix bug I introduced lsat night that broke
+ Delegates.
+
+ (Expression.Resolve): Report a 246 error (can not resolve name)
+ if we find a SimpleName in the stream.
+
+ (Expression.ResolveLValue): Ditto.
+
+ (Expression.ResolveWithSimpleName): This function is a variant of
+ ResolveName, this one allows SimpleNames to be returned without a
+ warning. The only consumer of SimpleNames is MemberAccess
+
+2001-10-26 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Invocation::DoResolve): Catch SimpleNames that
+ might arrive here. I have my doubts that this is correct.
+
+ * statement.cs (Lock): Implement lock statement.
+
+ * cs-parser.jay: Small fixes to support `lock' and `using'
+
+ * cs-tokenizer.cs: Remove extra space
+
+ * driver.cs: New flag --checked, allows to turn on integer math
+ checking.
+
+ * typemanger.cs: Load methodinfos for Threading.Monitor.Enter and
+ Threading.Monitor.Exit
+
+2001-10-23 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (IndexerAccess::DoResolveLValue): Set the
+ Expression Class to be IndexerAccess.
+
+ Notice that Indexer::DoResolve sets the eclass to Value.
+
+2001-10-22 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (TypeContainer::Emit): Emit code for indexers.
+
+ * assign.cs (IAssignMethod): New interface implemented by Indexers
+ and Properties for handling assignment.
+
+ (Assign::Emit): Simplify and reuse code.
+
+ * expression.cs (IndexerAccess, PropertyExpr): Implement
+ IAssignMethod, clean up old code.
+
+2001-10-22 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (ImplementsInterface): New method to determine if a type
+ implements a given interface. Provides a nice cache too.
+
+ * expression.cs (ImplicitReferenceConversion): Update checks to use the above
+ method.
+
+ (ConvertReferenceExplicit): Ditto.
+
+ * delegate.cs (Delegate::Populate): Update to define the parameters on the
+ various methods, with correct names etc.
+
+ * class.cs (Operator::OpType): New members Operator.UnaryPlus and
+ Operator.UnaryNegation.
+
+ * cs-parser.jay (operator_declarator): Be a little clever in the case where
+ we have a unary plus or minus operator.
+
+ * expression.cs (Unary): Rename memebers of Operator enum to UnaryPlus and
+ UnaryMinus.
+
+ * everywhere : update accordingly.
+
+ * everywhere : Change Negate and BitComplement to LogicalNot and OnesComplement
+ respectively.
+
+ * class.cs (Method::Define): For the case where we are implementing a method
+ inherited from an interface, we need to set the MethodAttributes.Final flag too.
+ Also set MethodAttributes.NewSlot and MethodAttributes.HideBySig.
+
+2001-10-21 Ravi Pratap <ravi@ximian.com>
+
+ * interface.cs (FindMembers): Implement to work around S.R.E
+ lameness.
+
+ * typemanager.cs (IsInterfaceType): Implement.
+
+ (FindMembers): Update to handle interface types too.
+
+ * expression.cs (ImplicitReferenceConversion): Re-write bits which
+ use IsAssignableFrom as that is not correct - it doesn't work.
+
+ * delegate.cs (DelegateInvocation): Derive from ExpressionStatement
+ and accordingly override EmitStatement.
+
+ * expression.cs (ConvertReferenceExplicit): Re-write similary, this time
+ using the correct logic :-)
+
+2001-10-19 Ravi Pratap <ravi@ximian.com>
+
+ * ../errors/cs-11.cs : Add to demonstrate error -11
+
+2001-10-17 Miguel de Icaza <miguel@ximian.com>
+
+ * assign.cs (Assign::Resolve): Resolve right hand side first, and
+ then pass this as a hint to ResolveLValue.
+
+ * expression.cs (FieldExpr): Add Location information
+
+ (FieldExpr::LValueResolve): Report assignment to readonly
+ variable.
+
+ (Expression::ExprClassFromMemberInfo): Pass location information.
+
+ (Expression::ResolveLValue): Add new method that resolves an
+ LValue.
+
+ (Expression::DoResolveLValue): Default invocation calls
+ DoResolve.
+
+ (Indexers): New class used to keep track of indexers in a given
+ Type.
+
+ (IStackStore): Renamed from LValue, as it did not really describe
+ what this did. Also ResolveLValue is gone from this interface and
+ now is part of Expression.
+
+ (ElementAccess): Depending on the element access type
+
+ * typemanager.cs: Add `indexer_name_type' as a Core type
+ (System.Runtime.CompilerServices.IndexerNameAttribute)
+
+ * statement.cs (Goto): Take a location.
+
+2001-10-18 Ravi Pratap <ravi@ximian.com>
+
+ * delegate.cs (Delegate::VerifyDelegate): New method to verify
+ if two delegates are compatible.
+
+ (NewDelegate::DoResolve): Update to take care of the case when
+ we instantiate a delegate from another delegate.
+
+ * typemanager.cs (FindMembers): Don't even try to look up members
+ of Delegate types for now.
+
+2001-10-18 Ravi Pratap <ravi@ximian.com>
+
+ * delegate.cs (NewDelegate): New class to take care of delegate
+ instantiation.
+
+ * expression.cs (New): Split the delegate related code out into
+ the NewDelegate class.
+
+ * delegate.cs (DelegateInvocation): New class to handle delegate
+ invocation.
+
+ * expression.cs (Invocation): Split out delegate related code into
+ the DelegateInvocation class.
+
+2001-10-17 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (New::DoResolve): Implement delegate creation fully
+ and according to the spec.
+
+ (New::DoEmit): Update to handle delegates differently.
+
+ (Invocation::FullMethodDesc): Fix major stupid bug thanks to me
+ because of which we were printing out arguments in reverse order !
+
+ * delegate.cs (VerifyMethod): Implement to check if the given method
+ matches the delegate.
+
+ (FullDelegateDesc): Implement.
+
+ (VerifyApplicability): Implement.
+
+ * expression.cs (Invocation::DoResolve): Update to accordingly handle
+ delegate invocations too.
+
+ (Invocation::Emit): Ditto.
+
+ * ../errors/cs1593.cs : Added.
+
+ * ../errors/cs1594.cs : Added.
+
+ * delegate.cs (InstanceExpression, TargetMethod): New properties.
+
+2001-10-16 Ravi Pratap <ravi@ximian.com>
+
+ * typemanager.cs (intptr_type): Core type for System.IntPtr
+
+ (InitCoreTypes): Update for the same.
+
+ (iasyncresult_type, asynccallback_type): Ditto.
+
+ * delegate.cs (Populate): Fix to use System.Intptr as it is indeed
+ correct.
+
+ * typemanager.cs (AddDelegateType): Store a pointer to the Delegate class
+ too.
+
+ * delegate.cs (ConstructorBuilder, InvokeBuilder, ...): New members to hold
+ the builders for the 4 members of a delegate type :-)
+
+ (Populate): Define the BeginInvoke and EndInvoke methods on the delegate
+ type.
+
+ * expression.cs (New::DoResolve): Implement guts for delegate creation.
+
+ * ../errors/errors.txt : Update for an error (-11) which only we catch :-)
+
+2001-10-15 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Break::Emit): Implement.
+ (Continue::Emit): Implement.
+
+ (For::Emit): Track old being/end loops; Set Begin loop, ack end loop
+ (While::Emit): Track old being/end loops; Set Begin loop, ack end loop
+ (Do::Emit): Track old being/end loops; Set Begin loop, ack end loop
+ (Foreach::Emit): Track old being/end loops; Set Begin loop, ack
+ end loop
+
+ * codegen.cs (EmitContext::LoopEnd, EmitContext::LoopBegin): New
+ properties that track the label for the current loop (begin of the
+ loop and end of the loop).
+
+2001-10-15 Ravi Pratap <ravi@ximian.com>
+
+ * delegate.cs (Emit): Get rid of it as there doesn't seem to be any ostensible
+ use of emitting anything at all.
+
+ * class.cs, rootcontext.cs : Get rid of calls to the same.
+
+ * delegate.cs (DefineDelegate): Make sure the class we define is also sealed.
+
+ (Populate): Define the constructor correctly and set the implementation
+ attributes.
+
+ * typemanager.cs (delegate_types): New hashtable to hold delegates that
+ have been defined.
+
+ (AddDelegateType): Implement.
+
+ (IsDelegateType): Implement helper method.
+
+ * delegate.cs (DefineDelegate): Use AddDelegateType instead of AddUserType.
+
+ * expression.cs (New::DoResolve): Check if we are trying to instantiate a delegate type
+ and accordingly handle it.
+
+ * delegate.cs (Populate): Take TypeContainer argument.
+ Implement bits to define the Invoke method. However, I still haven't figured out
+ how to take care of the native int bit :-(
+
+ * cs-parser.jay (delegate_declaration): Fixed the bug that I had introduced :-)
+ Qualify the name of the delegate, not its return type !
+
+ * expression.cs (ImplicitReferenceConversion): Implement guts of implicit array
+ conversion.
+
+ (StandardConversionExists): Checking for array types turns out to be recursive.
+
+ (ConvertReferenceExplicit): Implement array conversion.
+
+ (ExplicitReferenceConversionExists): New method to determine precisely that :-)
+
+2001-10-12 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (delegate_declaration): Store the fully qualified
+ name as it is a type declaration.
+
+ * delegate.cs (ReturnType, Name): Rename members to these. Make them
+ readonly.
+
+ (DefineDelegate): Renamed from Define. Does the same thing essentially,
+ as TypeContainer::DefineType.
+
+ (Populate): Method in which all the definition of the various methods (Invoke)
+ etc is done.
+
+ (Emit): Emit any code, if necessary. I am not sure about this really, but let's
+ see.
+
+ (CloseDelegate): Finally creates the delegate.
+
+ * class.cs (TypeContainer::DefineType): Update to define delegates.
+ (Populate, Emit and CloseType): Do the same thing here too.
+
+ * rootcontext.cs (ResolveTree, PopulateTypes, EmitCode, CloseTypes): Include
+ delegates in all these operations.
+
+2001-10-14 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: LocalTemporary: a new expression used to
+ reference a temporary that has been created.
+
+ * assign.cs: Handle PropertyAccess back here, so that we can
+ provide the proper semantic access to properties.
+
+ * expression.cs (Expression::ConvertReferenceExplicit): Implement
+ a few more explicit conversions.
+
+ * modifiers.cs: `NEW' modifier maps to HideBySig.
+
+ * expression.cs (PropertyExpr): Make this into an
+ ExpressionStatement, and support the EmitStatement code path.
+
+ Perform get/set error checking, clean up the interface.
+
+ * assign.cs: recognize PropertyExprs as targets, and if so, turn
+ them into toplevel access objects.
+
+2001-10-12 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: PropertyExpr::PropertyExpr: use work around the
+ SRE.
+
+ * typemanager.cs: Keep track here of our PropertyBuilders again to
+ work around lameness in SRE.
+
+2001-10-11 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (LValue::LValueResolve): New method in the
+ interface, used to perform a second resolution pass for LValues.
+
+ (This::DoResolve): Catch the use of this in static methods.
+
+ (This::LValueResolve): Implement.
+
+ (This::Store): Remove warning, assigning to `this' in structures
+ is
+
+ (Invocation::Emit): Deal with invocation of
+ methods on value types. We need to pass the address to structure
+ methods rather than the object itself. (The equivalent code to
+ emit "this" for structures leaves the entire structure on the
+ stack instead of a pointer to it).
+
+ (ParameterReference::DoResolve): Compute the real index for the
+ argument based on whether the method takes or not a `this' pointer
+ (ie, the method is static).
+
+ * codegen.cs (EmitContext::GetTemporaryStorage): Used to store
+ value types returned from functions when we need to invoke a
+ method on the sturcture.
+
+
+2001-10-11 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (TypeContainer::DefineType): Method to actually do the business of
+ defining the type in the Modulebuilder or Typebuilder. This is to take
+ care of nested types which need to be defined on the TypeBuilder using
+ DefineNestedMethod.
+
+ (TypeContainer::GetClassBases): Implement. Essentially the code from the
+ methods in RootContext, only ported to be part of TypeContainer.
+
+ (TypeContainer::GetInterfaceOrClass): Ditto.
+
+ (TypeContainer::LookupInterfaceOrClass, ::MakeFQN): Ditto.
+
+ * interface.cs (Interface::DefineInterface): New method. Does exactly
+ what RootContext.CreateInterface did earlier, only it takes care of nested types
+ too.
+
+ (Interface::GetInterfaces): Move from RootContext here and port.
+
+ (Interface::GetInterfaceByName): Same here.
+
+ * rootcontext.cs (ResolveTree): Re-write.
+
+ (PopulateTypes): Re-write.
+
+ * class.cs (TypeContainer::Populate): Populate nested types too.
+ (TypeContainer::Emit): Emit nested members too.
+
+ * typemanager.cs (AddUserType): Do not make use of the FullName property,
+ instead just use the name argument passed in as it is already fully
+ qualified.
+
+ (FindMembers): Check in the Builders to TypeContainer mapping instead of the name
+ to TypeContainer mapping to see if a type is user-defined.
+
+ * class.cs (TypeContainer::CloseType): Implement.
+
+ (TypeContainer::DefineDefaultConstructor): Use Basename, not Name while creating
+ the default constructor.
+
+ (TypeContainer::Populate): Fix minor bug which led to creating default constructors
+ twice.
+
+ (Constructor::IsDefault): Fix up logic to determine if it is the default constructor
+
+ * interface.cs (CloseType): Create the type here.
+
+ * rootcontext.cs (CloseTypes): Re-write to recursively close types by running through
+ the hierarchy.
+
+ Remove all the methods which are now in TypeContainer.
+
+2001-10-10 Ravi Pratap <ravi@ximian.com>
+
+ * delegate.cs (Define): Re-write bits to define the delegate
+ correctly.
+
+2001-10-10 Miguel de Icaza <miguel@ximian.com>
+
+ * makefile: Renamed the compiler to `mcs.exe' instead of compiler.exe
+
+ * expression.cs (ImplicitReferenceConversion): handle null as well
+ as a source to convert to any reference type.
+
+ * statement.cs (Return): Perform any implicit conversions to
+ expected return type.
+
+ Validate use of return statement.
+
+ * codegen.cs (EmitContext): Pass the expected return type here.
+
+ * class.cs (Method, Constructor, Property): Pass expected return
+ type to EmitContext.
+
+2001-10-09 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: Make DoResolve take an EmitContext instead of a
+ TypeContainer.
+
+ Replaced `l' and `location' for `loc', for consistency.
+
+ (Error, Warning): Remove unneeded Tc argument.
+
+ * assign.cs, literal.cs, constant.cs: Update to new calling
+ convention.
+
+ * codegen.cs: EmitContext now contains a flag indicating whether
+ code is being generated in a static method or not.
+
+ * cs-parser.jay: DecomposeQI, new function that replaces the old
+ QualifiedIdentifier. Now we always decompose the assembled
+ strings from qualified_identifier productions into a group of
+ memberaccesses.
+
+2001-10-08 Miguel de Icaza <miguel@ximian.com>
+
+ * rootcontext.cs: Deal with field-less struct types correctly now
+ by passing the size option to Define Type.
+
+ * class.cs: Removed hack that created one static field.
+
+2001-10-07 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs: Moved most of the code generation here.
+
+2001-10-09 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (New::DoResolve): Revert changes for array creation, doesn't
+ seem very right.
+
+ (ElementAccess): Remove useless bits for now - keep checks as the spec
+ says.
+
+2001-10-08 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (ElementAccess::DoResolve): Remove my crap code
+ and start performing checks according to the spec.
+
+2001-10-07 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (type_suffix*): Remove - they are redundant. Use
+ rank_specifiers instead.
+
+ (rank_specifiers): Change the order in which the rank specifiers are stored
+
+ (local_variable_declaration): Use opt_rank_specifier instead of type_suffixes.
+
+ * expression.cs (ElementAccess): Implement the LValue interface too.
+
+2001-10-06 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (ConvertExplicitStandard): Add. Same as ConvertExplicit
+ except that user defined conversions are not included.
+
+ (UserDefinedConversion): Update to use the ConvertExplicitStandard to
+ perform the conversion of the return type, if necessary.
+
+ (New::DoResolve): Check whether we are creating an array or an object
+ and accordingly do the needful.
+
+ (New::Emit): Same here.
+
+ (New::DoResolve): Implement guts of array creation.
+
+ (New::FormLookupType): Helper function.
+
+2001-10-07 Miguel de Icaza <miguel@ximian.com>
+
+ * codegen.cs: Removed most of the code generation here, and move the
+ corresponding code generation bits to the statement classes.
+
+ Added support for try/catch/finalize and throw.
+
+ * cs-parser.jay: Added support for try/catch/finalize.
+
+ * class.cs: Catch static methods having the flags override,
+ virtual or abstract.
+
+ * expression.cs (UserCast): This user cast was not really doing
+ what it was supposed to do. Which is to be born in fully resolved
+ state. Parts of the resolution were being performed at Emit time!
+
+ Fixed this code.
+
+2001-10-05 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs: Implicity convert the result from UserCast.
+
+2001-10-05 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Expression::FindMostEncompassingType): Fix bug which
+ prevented it from working correctly.
+
+ (ConvertExplicit): Make the first try, a call to ConvertImplicitStandard, not
+ merely ConvertImplicit.
+
+2001-10-05 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs: Make the LookupTypeContainer function static,
+ and not per-instance.
+
+ * class.cs: Make static FindMembers (the one that takes a Type
+ argument).
+
+ * codegen.cs: Add EmitForeach here.
+
+ * cs-parser.jay: Make foreach a toplevel object instead of the
+ inline expansion, as we need to perform semantic analysis on it.
+
+2001-10-05 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Expression::ImplicitUserConversion): Rename to
+ UserDefinedConversion.
+
+ (Expression::UserDefinedConversion): Take an extra argument specifying
+ whether we look for explicit user conversions too.
+
+ (Expression::ImplicitUserConversion): Make it a call to UserDefinedConversion.
+
+ (UserDefinedConversion): Incorporate support for user defined explicit conversions.
+
+ (ExplicitUserConversion): Make it a call to UserDefinedConversion
+ with the appropriate arguments.
+
+ * cs-parser.jay (cast_expression): Record location too.
+
+ * expression.cs (Cast): Record location info.
+
+ (Expression::ConvertExplicit): Take location argument.
+
+ (UserImplicitCast): Change name to UserCast. Take an extra constructor argument
+ to determine if we are doing explicit conversions.
+
+ (UserCast::Emit): Update accordingly.
+
+ (Expression::ConvertExplicit): Report an error if everything fails.
+
+ * ../errors/cs0030.cs : Add.
+
+2001-10-04 Miguel de Icaza <miguel@ximian.com>
+
+ * modifiers.cs: If the ABSTRACT keyword is present, also set the
+ virtual and newslot bits.
+
+ * class.cs (TypeContainer::RegisterRequiredImplementations):
+ Record methods we need.
+
+ (TypeContainer::MakeKey): Helper function to make keys for
+ MethodBases, since the Methodbase key is useless.
+
+ (TypeContainer::Populate): Call RegisterRequiredImplementations
+ before defining the methods.
+
+ Create a mapping for method_builders_to_methods ahead of time
+ instead of inside a tight loop.
+
+ (::RequireMethods): Accept an object as the data to set into the
+ hashtable so we can report interface vs abstract method mismatch.
+
+2001-10-03 Miguel de Icaza <miguel@ximian.com>
+
+ * report.cs: Make all of it static.
+
+ * rootcontext.cs: Drop object_type and value_type computations, as
+ we have those in the TypeManager anyways.
+
+ Drop report instance variable too, now it is a global.
+
+ * driver.cs: Use try/catch on command line handling.
+
+ Add --probe option to debug the error reporting system with a test
+ suite.
+
+ * report.cs: Add support for exiting program when a probe
+ condition is reached.
+
+2001-10-03 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Binary::DoNumericPromotions): Fix the case when
+ we do a forcible conversion regardless of type, to check if
+ ForceConversion returns a null.
+
+ (Binary::error19): Use location to report error.
+
+ (Unary::error23): Use location here too.
+
+ * ../errors/cs0019.cs : Check in.
+
+ * ../errors/cs0023.cs : Check in.
+
+ * expression.cs (Expression.MemberLookup): Return null for a rather esoteric
+ case of a non-null MethodInfo object with a length of 0 !
+
+ (Binary::ResolveOperator): Flag error if overload resolution fails to find
+ an applicable member - according to the spec :-)
+ Also fix logic to find members in base types.
+
+ (Unary::ResolveOperator): Same here.
+
+ (Unary::report23): Change name to error23 and make first argument a TypeContainer
+ as I was getting thoroughly confused between this and error19 :-)
+
+ * expression.cs (Expression::ImplicitUserConversion): Re-write fully
+ (::FindMostEncompassedType): Implement.
+ (::FindMostEncompassingType): Implement.
+ (::StandardConversionExists): Implement.
+
+ (UserImplicitCast): Re-vamp. We now need info about most specific
+ source and target types so that we can do the necessary conversions.
+
+ (Invocation::MakeUnionSet): Completely re-write to make sure we form a proper
+ mathematical union with no duplicates.
+
+2001-10-03 Miguel de Icaza <miguel@ximian.com>
+
+ * rootcontext.cs (RootContext::PopulateTypes): Populate containers
+ in order from base classes to child classes, so that we can in
+ child classes look up in our parent for method names and
+ attributes (required for handling abstract, virtual, new, override
+ constructs: we need to instrospect our base class, and if we dont
+ populate the classes in order, the introspection might be
+ incorrect. For example, a method could query its parent before
+ the parent has any methods and would determine that the parent has
+ no abstract methods (while it could have had them)).
+
+ (RootContext::CreateType): Record the order in which we define the
+ classes.
+
+2001-10-02 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (TypeContainer::Populate): Also method definitions can
+ fail now, keep track of this.
+
+ (TypeContainer::FindMembers): Implement support for
+ DeclaredOnly/noDeclaredOnly flag.
+
+ (Constructor::Emit) Return the ConstructorBuilder.
+
+ (Method::Emit) Return the MethodBuilder.
+ Check for abstract or virtual methods to be public.
+
+ * rootcontext.cs (RootContext::CreateType): Register all the
+ abstract methods required for the class to be complete and the
+ interface methods that must be implemented.
+
+ * cs-parser.jay: Report error 501 (method requires body if it is
+ not marked abstract or extern).
+
+ * expression.cs (TypeOf::Emit): Implement.
+
+ * typemanager.cs: runtime_handle_type, new global type.
+
+ * class.cs (Property::Emit): Generate code for properties.
+
+2001-10-02 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Unary::ResolveOperator): Find operators on base type
+ too - we now conform exactly to the spec.
+
+ (Binary::ResolveOperator): Same here.
+
+ * class.cs (Operator::Define): Fix minor quirk in the tests.
+
+ * ../errors/cs0215.cs : Added.
+
+ * ../errors/cs0556.cs : Added.
+
+ * ../errors/cs0555.cs : Added.
+
+2001-10-01 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-tokenizer.cs: Reimplemented Location to be a struct with a
+ single integer which is really efficient
+
+2001-10-01 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Expression::ImplicitUserConversion): Use location
+ even in the case when we are examining True operators.
+
+ * class.cs (Operator::Define): Perform extensive checks to conform
+ with the rules for operator overloading in the spec.
+
+ * expression.cs (Expression::ImplicitReferenceConversion): Implement
+ some of the other conversions mentioned in the spec.
+
+ * typemanager.cs (array_type): New static member for the System.Array built-in
+ type.
+
+ (cloneable_interface): For System.ICloneable interface.
+
+ * driver.cs (Driver::Driver): Initialize TypeManager's core types even before
+ we start resolving the tree and populating types.
+
+ * ../errors/errors.txt : Update for error numbers -7, -8, -9, -10
+
+2001-10-01 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Expression::ExprClassFromMemberInfo,
+ Expression::Literalize): Create literal expressions from
+ FieldInfos which are literals.
+
+ (ConvertNumericExplicit, ImplicitNumericConversion): Fix a few
+ type casts, because they were wrong. The test suite in tests
+ caught these ones.
+
+ (ImplicitNumericConversion): ushort to ulong requires a widening
+ cast.
+
+ Int32 constant to long requires widening cast as well.
+
+ * literal.cs (LongLiteral::EmitLong): Do not generate i4 constants
+ for integers because the type on the stack is not i4.
+
+2001-09-30 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (report118): require location argument.
+
+ * parameter.cs: Do not dereference potential null value.
+
+ * class.cs: Catch methods that lack the `new' keyword when
+ overriding a name. Report warnings when `new' is used without
+ anything being there to override.
+
+ * modifiers.cs: Handle `NEW' as MethodAttributes.NewSlot.
+
+ * class.cs: Only add constructor to hashtable if it is non-null
+ (as now constructors can fail on define).
+
+ (TypeManager, Class, Struct): Take location arguments.
+
+ Catch field instance initialization in structs as errors.
+
+ accepting_filter: a new filter for FindMembers that is static so
+ that we dont create an instance per invocation.
+
+ (Constructor::Define): Catch errors where a struct constructor is
+ parameterless
+
+ * cs-parser.jay: Pass location information for various new
+ constructs.
+
+ * delegate.cs (Delegate): take a location argument.
+
+ * driver.cs: Do not call EmitCode if there were problesm in the
+ Definition of the types, as many Builders wont be there.
+
+ * decl.cs (Decl::Decl): Require a location argument.
+
+ * cs-tokenizer.cs: Handle properly hex constants that can not fit
+ into integers, and find the most appropiate integer for it.
+
+ * literal.cs: Implement ULongLiteral.
+
+ * rootcontext.cs: Provide better information about the location of
+ failure when CreateType fails.
+
+2001-09-29 Miguel de Icaza <miguel@ximian.com>
+
+ * rootcontext.cs (RootContext::PopulateTypes): Populates structs
+ as well.
+
+ * expression.cs (Binary::CheckShiftArguments): Add missing type
+ computation.
+ (Binary::ResolveOperator): Add type to the logical and and logical
+ or, Bitwise And/Or and Exclusive Or code paths, it was missing
+ before.
+
+ (Binary::DoNumericPromotions): In the case where either argument
+ is ulong (and most signed types combined with ulong cause an
+ error) perform implicit integer constant conversions as well.
+
+2001-09-28 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (UserImplicitCast): Method should always be
+ non-null.
+ (Invocation::BetterConversion): Simplified test for IntLiteral.
+
+ (Expression::ImplicitNumericConversion): Split this routine out.
+ Put the code that performs implicit constant integer conversions
+ here.
+
+ (Expression::Resolve): Become a wrapper around DoResolve so we can
+ check eclass and type being set after resolve.
+
+ (Invocation::Badness): Remove this dead function
+
+ (Binary::ResolveOperator): Do not compute the expensive argumnets
+ unless we have a union for it.
+
+ (Probe::Emit): Is needs to do an isinst and then
+ compare against null.
+
+ (::CanConvert): Added Location argument. If the Location argument
+ is null (Location.Null), then we do not report errors. This is
+ used by the `probe' mechanism of the Explicit conversion. We do
+ not want to generate an error for something that the user
+ explicitly requested to be casted. But the pipeline for an
+ explicit cast first tests for potential implicit casts.
+
+ So for now, if the Location is null, it means `Probe only' to
+ avoid adding another argument. Might have to revise this
+ strategy later.
+
+ (ClassCast): New class used to type cast objects into arbitrary
+ classes (used in Explicit Reference Conversions).
+
+ Implement `as' as well.
+
+ Reverted all the patches from Ravi below: they were broken:
+
+ * The use of `level' as a mechanism to stop recursive
+ invocations is wrong. That was there just to catch the
+ bug with a strack trace but not as a way of addressing
+ the problem.
+
+ To fix the problem we have to *understand* what is going
+ on and the interactions and come up with a plan, not
+ just get things going.
+
+ * The use of the type conversion cache that I proposed
+ last night had an open topic: How does this work across
+ protection domains. A user defined conversion might not
+ be public in the location where we are applying the
+ conversion, a different conversion might be selected
+ (ie, private A->B (better) but public B->A (worse),
+ inside A, A->B applies, but outside it, B->A will
+ apply).
+
+ * On top of that (ie, even if the above is solved),
+ conversions in a cache need to be abstract. Ie, `To
+ convert from an Int to a Short use an OpcodeCast', not
+ `To convert from an Int to a Short use the OpcodeCast on
+ the variable 5' (which is what this patch was doing).
+
+2001-09-28 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Invocation::ConversionExists): Re-write to use
+ the conversion cache
+
+ (Expression::ConvertImplicit): Automatic bailing out if level != 0. Also
+ cache all conversions done, not just user-defined ones.
+
+ (Invocation::BetterConversion): The real culprit. Use ConversionExists
+ to determine if a conversion exists instead of acutually trying to
+ perform the conversion. It's faster too.
+
+ (Expression::ConvertExplicit): Modify to use ConversionExists to check
+ and only then attempt the implicit conversion.
+
+2001-09-28 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (ConvertImplicit): Use a cache for conversions
+ already found. Check level of recursion and bail out if necessary.
+
+2001-09-28 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs (string_concat_string_string, string_concat_object_object):
+ Export standard methods that we expect for string operations.
+
+ * statement.cs (Block::UsageWarning): Track usage of variables and
+ report the errors for not used variables.
+
+ * expression.cs (Conditional::Resolve, ::Emit): Implement ?:
+ operator.
+
+2001-09-27 Miguel de Icaza <miguel@ximian.com>
+
+ * codegen.cs: remove unnneded code
+
+ * expression.cs: Removed BuiltinTypeAccess class
+
+ Fix the order in which implicit conversions are
+ done.
+
+ The previous fixed dropped support for boxed conversions (adding a
+ test to the test suite now)
+
+ (UserImplicitCast::CanConvert): Remove test for source being null,
+ that code is broken. We should not feed a null to begin with, if
+ we do, then we should track the bug where the problem originates
+ and not try to cover it up here.
+
+ Return a resolved expression of type UserImplicitCast on success
+ rather than true/false. Ravi: this is what I was talking about,
+ the pattern is to use a static method as a "constructor" for
+ objects.
+
+ Also, do not create arguments until the very last minute,
+ otherwise we always create the arguments even for lookups that
+ will never be performed.
+
+ (UserImplicitCast::Resolve): Eliminate, objects of type
+ UserImplicitCast are born in a fully resolved state.
+
+ * typemanager.cs (InitCoreTypes): Init also value_type
+ (System.ValueType).
+
+ * expression.cs (Cast::Resolve): First resolve the child expression.
+
+ (LValue): Add new method AddressOf to be used by
+ the `&' operator.
+
+ Change the argument of Store to take an EmitContext instead of an
+ ILGenerator, because things like FieldExpr need to be able to call
+ their children expression to generate the instance code.
+
+ (Expression::Error, Expression::Warning): Sugar functions for
+ reporting errors.
+
+ (Expression::MemberLookup): Accept a TypeContainer instead of a
+ Report as the first argument.
+
+ (Expression::ResolvePrimary): Killed. I still want to improve
+ this as currently the code is just not right.
+
+ (Expression::ResolveMemberAccess): Simplify, but it is still
+ wrong.
+
+ (Unary::Resolve): Catch errors in AddressOf operators.
+
+ (LocalVariableReference::Emit, ::Store, ::AddressOf): typecast
+ index to a byte for the short-version, or the compiler will choose
+ the wrong Emit call, which generates the wrong data.
+
+ (ParameterReference::Emit, ::Store): same.
+
+ (FieldExpr::AddressOf): Implement.
+
+ * typemanager.cs: TypeManager: made public variable instead of
+ property.
+
+ * driver.cs: document --fatal.
+
+ * report.cs (ErrorMessage, WarningMessage): new names for the old
+ Error and Warning classes.
+
+ * cs-parser.jay (member_access): Turn built-in access to types
+ into a normal simplename
+
+2001-09-27 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Invocation::BetterConversion): Fix to cope
+ with q being null, since this was introducing a bug.
+
+ * expression.cs (ConvertImplicit): Do built-in conversions first.
+
+2001-09-27 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (UserImplicitCast::Resolve): Fix bug.
+
+2001-09-27 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (TypeContainer::AddConstructor): Fix a stupid bug
+ I had introduced long ago (what's new ?).
+
+ * expression.cs (UserImplicitCast::CanConvert): Static method to do
+ the work of all the checking.
+ (ConvertImplicit): Call CanConvert and only then create object if necessary.
+ (UserImplicitCast::CanConvert, ::Resolve): Re-write.
+
+ (Unary::Operator): Rename Add and Subtract to Addition and Subtraction because
+ that is the right way.
+
+ (Invocation::MakeUnionSet): Convenience function to make unions of sets for
+ overloading resolution. Use everywhere instead of cutting and pasting code.
+
+ (Binary::ResolveOperator): Use MakeUnionSet.
+
+ (UserImplicitCast::CanConvert, ::Resolve): Update to take care of the case when
+ we have to convert to bool types. Not complete yet.
+
+2001-09-27 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs (TypeManager::CSharpName): support ushort.
+
+ * expression.cs (Expression::TryImplicitIntConversion): Attempts
+ to provide an expression that performsn an implicit constant int
+ conversion (section 6.1.6).
+ (Expression::ConvertImplicitRequired): Reworked to include
+ implicit constant expression conversions.
+
+ (Expression::ConvertNumericExplicit): Finished.
+
+ (Invocation::Emit): If InstanceExpression is null, then it means
+ that we perform a call on this.
+
+2001-09-26 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Unary::Emit): Remove some dead code.
+ (Probe): Implement Resolve and Emit for `is'.
+ (Expression::ConvertImplicitRequired): Attempt to do constant
+ expression conversions here. Maybe should be moved to
+ ConvertImplicit, but I am not sure.
+ (Expression::ImplicitLongConstantConversionPossible,
+ Expression::ImplicitIntConstantConversionPossible): New functions
+ that tell whether is it possible to apply an implicit constant
+ expression conversion.
+
+ (ConvertNumericExplicit): Started work on explicit numeric
+ conversions.
+
+ * cs-parser.jay: Update operator constants.
+
+ * parameter.cs (Parameters::GetParameterInfo): Hook up VerifyArgs
+ (Parameters::GetSignature): Hook up VerifyArgs here.
+ (Parameters::VerifyArgs): Verifies that no two arguments have the
+ same name.
+
+ * class.cs (Operator): Update the operator names to reflect the
+ ones that the spec expects (as we are just stringizing the
+ operator names).
+
+ * expression.cs (Unary::ResolveOperator): Fix bug: Use
+ MethodInfo's ReturnType instead of LookupMethodByBuilder as the
+ previous usage did only work for our methods.
+ (Expression::ConvertImplicit): Handle decimal implicit numeric
+ conversions as well.
+ (Expression::InternalTypeConstructor): Used to invoke constructors
+ on internal types for default promotions.
+
+ (Unary::Emit): Implement special handling for the pre/post
+ increment/decrement for overloaded operators, as they need to have
+ the same semantics as the other operators.
+
+ (Binary::ResolveOperator): ditto.
+ (Invocation::ConversionExists): ditto.
+ (UserImplicitCast::Resolve): ditto.
+
+2001-09-26 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Unary::Emit and Binary::Emit): If we have an overloaded
+ operator, return after emitting body. Regression tests pass again !
+
+ * expression.cs (ConvertImplicit): Take TypeContainer as first argument
+ (Unary::ForceConversion, Binary::ForceConversion): Ditto.
+ (Invocation::OverloadResolve): Ditto.
+ (Invocation::BetterFunction, BetterConversion, ConversionExists): Ditto.
+
+ * everywhere : update calls to the above methods accordingly.
+
+2001-09-26 Miguel de Icaza <miguel@ximian.com>
+
+ * assign.cs (Assign): Make it inherit from ExpressionStatement.
+
+ * expression.cs (ExpressionStatement): New base class used for
+ expressions that can appear in statements, so that we can provide
+ an alternate path to generate expression that do not leave a value
+ on the stack.
+
+ (Expression::Emit, and all the derivatives): We no longer return
+ whether a value is left on the stack or not. Every expression
+ after being emitted leaves a single value on the stack.
+
+ * codegen.cs (EmitContext::EmitStatementExpression): Use the
+ facilties of ExpressionStatement if possible.
+
+ * cs-parser.jay: Update statement_expression.
+
+2001-09-25 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs: Change the wording of message
+
+2001-09-25 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Binary::ResolveOperator): Had forgottten to set
+ the type of the expression to the return type of the method if
+ we have an overloaded operator match ! The regression tests pass again !
+ (Unary::ResolveOperator): Ditto.
+
+ * expression.cs (Invocation::ConversionExists): Correct the member lookup
+ to find "op_Implicit", not "implicit" ;-)
+ (UserImplicitCast): New class to take care of user-defined implicit conversions.
+ (ConvertImplicit, ForceConversion): Take TypeContainer argument
+
+ * everywhere : Correct calls to the above accordingly.
+
+ * expression.cs (UserImplicitCast::Resolve, ::Emit): Implement.
+ (ConvertImplicit): Do user-defined conversion if it exists.
+
+2001-09-24 Miguel de Icaza <miguel@ximian.com>
+
+ * assign.cs: track location.
+ (Resolve): Use implicit conversions on assignment.
+
+ * literal.cs: Oops. Not good, Emit of short access values should
+ pass (Bytes) or the wrong argument will be selected.
+
+ * expression.cs (Unary::Emit): Emit code for -expr.
+
+ (Unary::ResolveOperator): Handle `Substract' for non-constants
+ (substract from zero from the non-constants).
+ Deal with Doubles as well.
+
+ (Expression::ConvertImplicitRequired): New routine that reports an
+ error if no implicit conversion exists.
+
+ (Invocation::OverloadResolve): Store the converted implicit
+ expressions if we make them
+
+2001-09-24 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (ConstructorInitializer): Take a Location argument.
+ (ConstructorBaseInitializer): Same here.
+ (ConstructorThisInitializer): Same here.
+
+ * cs-parser.jay : Update all calls accordingly.
+
+ * expression.cs (Unary, Binary, New): Take location argument.
+ Update accordingly everywhere.
+
+ * cs-parser.jay : Update all calls to the above to take a location
+ argument.
+
+ * class.cs : Ditto.
+
+2001-09-24 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Invocation::BetterFunction): Take TypeContainer argument
+ (Invocation::BetterConversion): Same here
+ (Invocation::ConversionExists): Ditto.
+
+ (Invocation::ConversionExists): Implement.
+
+2001-09-22 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (OverloadResolve): Improve some more to catch errors 1502 and 1503
+ Also take an additional TypeContainer argument.
+
+ * All over : Pass in TypeContainer as argument to OverloadResolve.
+
+ * typemanager.cs (CSharpName): Update to check for the string type and return
+ that too.
+
+ * expression.cs (Invocation::FullMethodDesc): New static method to return a string fully describing
+ a given method.
+
+2001-09-21 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Invocation::OverloadResolve): Re-write to conform more to the spec.
+ (Invocation::BetterFunction): Implement.
+ (Invocation::BetterConversion): Implement.
+ (Invocation::ConversionExists): Skeleton, no implementation yet.
+
+ Okay, things work fine !
+
+2001-09-21 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs: declare and load enum_type, delegate_type and
+ void_type.
+
+ * expression.cs (Expression::Emit): Now emit returns a value that
+ tells whether a value is left on the stack or not. This strategy
+ might be reveted tomorrow with a mechanism that would address
+ multiple assignments.
+ (Expression::report118): Utility routine to report mismatches on
+ the ExprClass.
+
+ (Unary::Report23): Report impossible type/operator combination
+ utility function.
+
+ (Unary::IsIncrementableNumber): Whether the type can be
+ incremented or decremented with add.
+ (Unary::ResolveOperator): Also allow enumerations to be bitwise
+ complemented.
+ (Unary::ResolveOperator): Implement ++, !, ~,
+
+ (Invocation::Emit): Deal with new Emit convetion.
+
+ * All Expression derivatives: Updated their Emit method to return
+ whether they leave values on the stack or not.
+
+ * codegen.cs (CodeGen::EmitStatement): Pop values left on the
+ stack for expressions that are statements.
+
+2001-09-20 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (LValue): New interface. Must be implemented by
+ LValue objects.
+ (LocalVariableReference, ParameterReference, FieldExpr): Implement
+ LValue interface.
+
+ * assign.cs (Assign::Emit, Assign::Resolve): Use new LValue
+ interface for generating code, simplifies the code.
+
+2001-09-20 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (everywhere): Comment out return statements in ::Resolve
+ methods to avoid the warnings.
+
+2001-09-20 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs (parse): Report error 2001 if we can not open the
+ source file.
+
+ * expression.cs (SimpleName::ResolveSimpleName): Error if we can
+ not resolve it.
+
+ * cs-parser.jay (QualifierIdentifier): Pass location to SimpleName
+ object.
+
+ * statement.cs (Block::EmitMeta): Reuse the count across all the variables,
+ otherwise nested blocks end up with the same index.
+
+ * codegen.cs (CodeGen::EmitTopBlock): Pass initial sequence
+
+ * expression.cs: Instead of having FIXMEs in the Resolve
+ functions, throw exceptions so it is obvious that we are facing a
+ bug.
+
+ * cs-parser.jay (invocation_expression): Pass Location information.
+
+ * codegen.cs (CodeGen::Save, CodeGen::CodeGen, CodeGen::Basename):
+ Use a basename for those routines because .NET does not like paths
+ on them.
+
+ * class.cs (TypeContainer::AddMethod): Do not call DefineName if the name was
+ already defined.
+
+2001-09-19 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs (TypeManager::CoreLookupType): A function to make sure that we
+ are loading the correct data types (throws an exception if not).
+ (TypeManager::InitCoreTypes): Use CoreLookupType
+
+ * expression.cs (Unary::ResolveOperator): return the child
+ expression for expressions which are just +expr.
+ (Unary::ResolveOperator): Return negative literals for -LITERAL
+ expressions (otherwise they are Unary {Literal}).
+ (Invocation::Badness): Take into account `Implicit constant
+ expression conversions'.
+
+ * literal.cs (LongLiteral): Implement long literal class.
+ (IntLiteral): export the `Value' of the intliteral.
+
+2001-09-19 Ravi Pratap <ravi@ximian.com>
+
+ * expression.cs (Binary::Emit): Finally get the emission right ! Woo!
+
+ * class.cs (Operator::Define): Change the methodname prefix to 'op_'
+ instead of 'Operator'
+
+ * expression.cs (Binary::ResolveOperator): Update accordingly.
+ (Unary::Operator): Change names to 'Add' and 'Subtract' instead 'Plus'
+ and 'Minus'
+
+ * cs-parser.jay (unary_expression): Update to use the new names.
+
+ * gen-treedump.cs (GetUnary): Same here.
+
+ * expression.cs (Unary::Resolve): Implement.
+ (Binary::ResolveOperator): Re-write bits to quietly continue if no overloaded
+ operators are found instead of making noise ;-)
+ (Unary::ResolveOperator): New method to do precisely the same thing which
+ Binary::ResolveOperator does for Binary expressions.
+ (Unary.method, .Arguments): Add.
+ (Unary::OperName): Implement.
+ (Unary::ForceConversion): Copy and Paste !
+
+ * class.cs (Operator::Define): Fix a small bug for the case when we have
+ a unary operator.
+
+ * expression.cs (Unary::Emit): Implement. Need to find the right Opcodes
+ for the inbuilt operators. Only overloading works for now ;-)
+
+2001-09-18 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (CheckedExpr::Resolve, CheckedExpr::Emit,
+ UnCheckedExpr::Resolve, UnCheckedExpr::Emit): Implement.
+
+ * expression.cs (This::Emit): Implement.
+ (This::Resolve): Implement.
+ (TypeOf:Resolve): Implement.
+ (Expression::ResolveSimpleName): Add an implicit this to instance
+ field references.
+ (MemberAccess::Resolve): Deal with Parameters and Fields.
+ Bind instance variable to Field expressions.
+ (FieldExpr::Instance): New field used to track the expression that
+ represents the object instance.
+ (FieldExpr::Resolve): Track potential errors from MemberLookup not
+ binding
+ (FieldExpr::Emit): Implement.
+
+ * codegen.cs (EmitIf, EmitStatement, EmitBlock): Propagate whether
+ the last instruction contains a return opcode to avoid generating
+ the last `ret' instruction (this generates correct code, and it is
+ nice to pass the peverify output).
+
+ * class.cs (TypeContainer::EmitFieldInitializers): Implement field
+ initializer for static and instance variables.
+ (Constructor::Emit): Allow initializer to be null in the case of
+ static constructors. Only emit initializer for instance
+ constructors.
+
+ (TypeContainer::FindMembers): Return a null array if there are no
+ matches.
+
+ Also fix the code for the MemberTypes.Method branch, as it was not
+ scanning that for operators (or tried to access null variables before).
+
+ * assign.cs (Assign::Emit): Handle instance and static fields.
+
+ * TODO: Updated.
+
+ * driver.cs: Stop compilation if there are parse errors.
+
+ * cs-parser.jay (constructor_declaration): Provide default base
+ initializer for non-static constructors.
+ (constructor_declarator): Do not provide a default base
+ initializers if none was specified.
+ Catch the fact that constructors should not have parameters.
+
+ * class.cs: Do not emit parent class initializers for static
+ constructors, that should be flagged as an error.
+
+2001-09-18 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (RegisterMethodBuilder): Remove : it's unnecessary.
+ Move back code into TypeContainer::Populate.
+
+2001-09-18 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (TypeContainer::AddConstructor): Fix the check to
+ compare against Name, not Basename.
+ (Operator::OpType): Change Plus and Minus to Add and Subtract.
+
+ * cs-parser.jay : Update accordingly.
+
+ * class.cs (TypeContainer::FindMembers): For the case where we are searching
+ for methods, don't forget to look into the operators too.
+ (RegisterMethodBuilder): Helper method to take care of this for
+ methods, constructors and operators.
+ (Operator::Define): Completely revamp.
+ (Operator.OperatorMethod, MethodName): New fields.
+ (TypeContainer::Populate): Move the registering of builders into
+ RegisterMethodBuilder.
+ (Operator::Emit): Re-write.
+
+ * expression.cs (Binary::Emit): Comment out code path to emit method
+ invocation stuff for the case when we have a user defined operator. I am
+ just not able to get it right !
+
+2001-09-17 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Expression::OverloadResolve): Drop TypeContainer
+ argument.
+
+ (Expression::MemberLookup): Provide a version that allows to
+ specify the MemberTypes and BindingFlags.
+
+ * statement.cs (Block::GetVariableInfo): Forgot to recurse here,
+ so it was not fetching variable information from outer blocks.
+
+ * modifiers.cs: (Modifiers::TypeAttr): Invert condition on
+ Beforefieldinit as it was buggy.
+
+ * rootcontext.cs (::LookupInterfaceOrClass): Removed an Error -200
+ that Ravi put here.
+
+ * class.cs (Constructor::Emit): Only emit if block is not null.
+ (TypeContainer::EmitDefaultConstructor): Removed routine, now we
+ deal with this by semantically definining it as if the user had
+ done it.
+
+ (TypeContainer::FindMembers): Removed ad-hoc hack to deal with
+ constructors as we now "emit" them at a higher level.
+
+ (TypeContainer::DefineDefaultConstructor): Used to define the
+ default constructors if none was provided.
+
+ (ConstructorInitializer): Add methods Resolve and Emit.
+
+ * expression.cs: Cast to ConstructorInfo instead of MethodInfo
+
+2001-09-17 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (TypeContainer::EmitDefaultConstructor): Register
+ the default constructor builder with our hashtable for methodbuilders
+ to methodcores.
+
+ * expression.cs (Invocation::OverloadResolve): Add a check for pd == null
+ and argument_count is 0 in which case we have a match.
+ (Binary::ResolveOperator): More null checking and miscellaneous coding
+ style cleanup.
+
+2001-09-17 Ravi Pratap <ravi@ximian.com>
+
+ * rootcontext.cs (IsNameSpace): Compare against null.
+
+ * everywhere : Correct spelling to 'Greater' and to 'Subtract'
+
+ * class.cs (Operator::OpType): Change names to match the ones in Binary::Operator
+ and Unary::Operator.
+
+ * cs-parser.jay (operator_declaration, CheckBinaryOperator, CheckUnaryOperator): Update
+ accordingly.
+
+ * expression.cs (Binary::method): New member to hold the MethodBase for the case when
+ we have overloaded operators.
+ (Binary::ResolveOperator): Implement the part which does the operator overload
+ resolution.
+
+ * class.cs (Operator::Emit): Implement.
+ (TypeContainer::Emit): Emit the operators we have too.
+
+ * expression.cs (Binary::Emit): Update to emit the appropriate code for
+ the case when we have a user-defined operator.
+
+2001-09-17 Miguel de Icaza <miguel@ximian.com>
+
+ * rootcontext.cs: Fix bug: tree.Namespaces might be null.
+
+2001-09-16 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (EmitStaticFieldInitializers, EmitFieldInitializers): Make public.
+ (TypeContainer::EmitConstructor): Remove and move code into Contructor::Emit.
+ (Constructor::Emit): Implement.
+ (EmitStaticFieldInitializers, EmitFieldInitializers): Ensure we return immediately
+ if we have no work to do.
+ (TypeContainer::Emit): Pass in TypeContainer as argument to the constructor's
+ Emit method.
+
+ * interface.cs (Interface::InterfaceAttr): Re-write to be more correct and complete.
+ (Interface::IsTopLevel): Add. Same as TypeContainer::IsTopLevel.
+
+ * class.cs (TypeContainer::IsTopLevel): Modify to use parent.Parent instead
+ of parent.parent.
+
+2001-09-15 Ravi Pratap <ravi@ximian.com>
+
+ * tree.cs (Tree::namespaces): New hashtable to keep track of namespaces
+ in the source.
+ (Tree::RecordNamespace): Method to do what the name says ;-)
+ (Tree::Namespaces): Property to get at the namespaces hashtable.
+
+ * cs-parser.jay (namespace_declaration): Call RecordNamespace to
+ keep track.
+
+ * rootcontext.cs (IsNamespace): Fixed it :-)
+
+2001-09-14 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (TypeContainer::FindMembers): Add support for
+ constructors.
+ (MethodCore): New class that encapsulates both the shared aspects
+ of a Constructor and a Method.
+ (Method, Constructor): Factored pieces into MethodCore.
+
+ * driver.cs: Added --fatal which makes errors throw exceptions.
+ Load System assembly as well as part of the standard library.
+
+ * report.cs: Allow throwing exceptions on errors for debugging.
+
+ * modifiers.cs: Do not use `parent', instead use the real type
+ container to evaluate permission settings.
+
+ * class.cs: Put Ravi's patch back in. He is right, and we will
+ have to cope with the
+
+2001-09-14 Ravi Pratap <ravi@ximian.com>
+
+ * modifiers.cs (TypeAttr, MethodAttr, FieldAttr): Map protected internal to
+ FamORAssem, not FamANDAssem.
+
+2001-09-14 Miguel de Icaza <miguel@ximian.com>
+
+ * driver.cs: Added --parse option that only parses its input files
+ and terminates.
+
+ * class.cs: Reverted last change from Ravi to IsTopLevel. That is
+ incorrect. IsTopLevel is not used to tell whether an object is
+ root_types or not (that can be achieved by testing this ==
+ root_types). But to see if this is a top-level *class* (not
+ necessarly our "toplevel" container).
+
+2001-09-14 Ravi Pratap <ravi@ximian.com>
+
+ * enum.cs (Enum::Define): Modify to call the Lookup method on the
+ parent instead of a direct call to GetType.
+
+2001-09-14 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (TypeContainer::TypeAttr): Remove property code and move it into
+ Modifiers.TypeAttr. This should just be a call to that method.
+
+ * modifiers.cs (TypeAttr): Re-write and take an extra argument, the TypeContainer
+ object so that we can determine if we are top-level or not.
+
+ * delegate.cs (Delegate::Define): Update call to TypeAttr method to pass in the
+ TypeContainer too.
+
+ * enum.cs (Enum::Define): Ditto.
+
+ * modifiers.cs (FieldAttr): Re-write.
+
+ * class.cs (TypeContainer::IsTopLevel): Change accessibility to public.
+ (TypeContainer::HaveStaticConstructor): New property to provide access
+ to precisely that info.
+
+ * modifiers.cs (MethodAttr): Re-write.
+ (EventAttr): Remove altogether as there seems to be no ostensible use for it.
+
+ * class.cs (TypeContainer::IsTopLevel): Re-write. root_types doesn't seem to be the parent
+ of top-level types as claimed.
+
+2001-09-13 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (MemberLookup): Fruitless attempt to lookup
+ constructors. Maybe I need to emit default constructors? That
+ might be it (currently .NET emits this for me automatically).
+ (Invocation::OverloadResolve): Cope with Arguments == null.
+ (Invocation::EmitArguments): new function, shared by the new
+ constructor and us.
+ (Invocation::Emit): Handle static and instance methods. Emit
+ proper call instruction for virtual or non-virtual invocations.
+ (New::Emit): Implement.
+ (New::Resolve): Implement.
+ (MemberAccess:Resolve): Implement.
+ (MethodGroupExpr::InstanceExpression): used conforming to the spec
+ to track instances.
+ (FieldExpr::Resolve): Set type.
+
+ * support.cs: Handle empty arguments.
+
+ * cs-parser.jay (CompositeLookup, QualifierIdentifier,
+ SimpleLookup): Auxiliary routines to help parse a qualifier
+ identifier.
+
+ Update qualifier_identifier rule.
+
+ * codegen.cs: Removed debugging messages.
+
+ * class.cs: Make this a global thing, this acts just as a "key" to
+ objects that we might have around.
+
+ (Populate): Only initialize method_builders_to_methods once.
+
+ * expression.cs (PropertyExpr): Initialize type from the
+ PropertyType.
+
+ * codegen.cs (EmitContext::EmitBoolExpression): Use propper
+ Resolve pattern. Attempt to implicitly convert value to boolean.
+ Emit code.
+
+ * expression.cs: Set the type for the int32/int32 argument case.
+ (Binary::ResolveOperator): Set the return type to boolean for
+ comparission operators
+
+ * typemanager.cs: Remove debugging print code.
+
+ (Invocation::Resolve): resolve type.
+
+ * class.cs: Allocate a MemberInfo of the correct size, as the code
+ elsewhere depends on the test to reflect the correct contents.
+
+ (Method::) Keep track of parameters, due to System.Reflection holes
+
+ (TypeContainer::Populate): Keep track of MethodBuilders to Method
+ mapping here.
+
+ (TypeContainer::FindMembers): Use ArrayList and then copy an array
+ of the exact size and return that.
+
+ (Class::LookupMethodByBuilder): New function that maps
+ MethodBuilders to its methods. Required to locate the information
+ on methods because System.Reflection bit us again.
+
+ * support.cs: New file, contains an interface ParameterData and
+ two implementations: ReflectionParameters and InternalParameters
+ used to access Parameter information. We will need to grow this
+ as required.
+
+ * expression.cs (Invocation::GetParameterData): implement a cache
+ and a wrapper around the ParameterData creation for methods.
+ (Invocation::OverloadResolve): Use new code.
+
+2001-09-13 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (TypeContainer::EmitField): Remove and move into
+ (Field::Define): here and modify accordingly.
+ (Field.FieldBuilder): New member.
+ (TypeContainer::Populate): Update accordingly.
+ (TypeContainer::FindMembers): Implement.
+
+2001-09-13 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs: (VariableInfo::VariableType): New field to be
+ initialized with the full type once it is resolved.
+
+2001-09-12 Miguel de Icaza <miguel@ximian.com>
+
+ * parameter.cs (GetParameterInfo): Use a type cache to compute
+ things only once, and to reuse this information
+
+ * expression.cs (LocalVariableReference::Emit): Implement.
+ (OpcodeCast::Emit): fix.
+
+ (ParameterReference::Resolve): Implement.
+ (ParameterReference::Emit): Implement.
+
+ * cs-parser.jay: Fix bug introduced by Ravi, variable initializers
+ that are expressions need to stay as Expressions.
+
+ * typemanager.cs (CSharpName): Returns the C# name of a type if
+ possible.
+
+ * expression.cs (Expression::ConvertImplicit): New function that
+ implements implicit type conversions.
+
+ (Expression::ImplicitReferenceConversion): Implements implicit
+ reference conversions.
+
+ (EmptyCast): New type for transparent casts.
+
+ (OpcodeCast): New type for casts of types that are performed with
+ a sequence of bytecodes.
+
+ (BoxedCast): New type used for casting value types into reference
+ types. Emits a box opcode.
+
+ (Binary::DoNumericPromotions): Implements numeric promotions of
+ and computation of the Binary::Type.
+
+ (Binary::EmitBranchable): Optimization.
+
+ (Binary::Emit): Implement code emission for expressions.
+
+ * typemanager.cs (TypeManager): Added two new core types: sbyte
+ and byte.
+
+2001-09-12 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (TypeContainer::FindMembers): Method which does exactly
+ what Type.FindMembers does, only we don't have to use reflection. No
+ implementation yet.
+
+ * typemanager.cs (typecontainers): New hashtable to hold the corresponding
+ typecontainer objects as we need to get at them.
+ (TypeManager::AddUserType): Overload to take an extra argument, the TypeContainer.
+
+ * rootcontext.cs : Correspondingly modify called to AddUserType to pass the
+ typecontainer object.
+
+ * expression.cs (MemberLookup): Modify signature to take a RootContext object instead
+ of just a Report object.
+
+2001-09-11 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Event::Define): Go back to using the prefixes "add_" and
+ "remove_"
+ (TypeContainer::Populate): Now define the delegates of the type too.
+ (TypeContainer.Delegates): Property to access the list of delegates defined
+ in the type.
+
+ * delegates.cs (Delegate::Define): Implement partially.
+
+ * modifiers.cs (TypeAttr): Handle more flags.
+
+2001-09-11 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Indexer::Define): Fix for loop iteration condition to be just <
+ and not <=
+ (Operator::Define): Re-write logic to get types by using the LookupType method
+ instead of blindly doing a Type.GetType ! How stupid can I get ;-) ?
+ (Indexer::Define): Ditto.
+ (Event::Define): Ditto.
+ (Property::Define): Ditto.
+
+2001-09-10 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (TypeContainer::Populate): Now define operators too.
+ (TypeContainer.Operators): New property to access the list of operators
+ in a type.
+ (Operator.OperatorMethodBuilder): New member to hold the method builder
+ for the operator we are defining.
+ (Operator::Define): Implement.
+
+2001-09-10 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Event::Define): Make the prefixes of the accessor methods
+ addOn_ and removeOn_
+
+ * genericparser.cs (GenericParser::error): Overloaded method to handle the case
+ of the location being passed in too. Ideally, this should go later since all
+ error reporting should be done through the Report object.
+
+ * class.cs (TypeContainer.Indexers): New property to access the list of indexers.
+ (Populate): Iterate thru the indexers we have and define them too.
+ (Indexer.GetMethodBuilder, .SetMethodBuilder): New members to hold the method builders
+ for the get and set accessors.
+ (Indexer::Define): Implement.
+
+2001-09-09 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (Binary::Resolve): Beginning of it. I scratched
+ my previous implementation, did not work.
+
+ * typemanager.cs: Add a couple of missing types (the longs).
+
+ * literal.cs: Use TypeManager.bool_type instead of getting it.
+
+ * expression.cs (EventExpr): New kind of expressions.
+ (Expressio::ExprClassFromMemberInfo): finish
+
+2001-09-08 Miguel de Icaza <miguel@ximian.com>
+
+ * assign.cs: Emit stores to static fields differently.
+
+2001-09-08 Ravi Pratap <ravi@ximian.com>
+
+ * Merge in changes and adjust code to tackle conflicts. Backed out my
+ code in Assign::Resolve ;-)
+
+2001-09-08 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (CheckAttributeTarget): Modify call to error to use
+ instead Report.Error and also pass in the location.
+ (CSharpParser::Lexer): New readonly property to return the reference
+ to the Tokenizer object.
+ (declare_local_variables): Use Report.Error with location instead of plain
+ old error.
+ (CheckDef): Ditto.
+
+ * class.cs (Operator::CheckUnaryOperator): Move into cs-parser.jay.
+ (Operator.CheckBinaryOperator): Ditto.
+
+ * cs-parser.jay (operator_declarator): Update accordingly.
+
+ * cs-parser.jay (CheckUnaryOperator): Modify to use Report.Error
+ (CheckBinaryOperator): Same here.
+
+ * rootcontext.cs (LookupType): Add an extra lookup which simply does a lookup
+ on the name without any prefixes of namespace names etc. This is because we
+ already might have something already fully qualified like
+ 'System.Console.WriteLine'
+
+ * assign.cs (Resolve): Begin implementation. Stuck ;-)
+
+2001-09-07 Ravi Pratap <ravi@ximian.com>
+
+ * cs-tokenizer.cs (location): Return a string which also contains
+ the file name.
+
+ * expression.cs (ElementAccess): New class for expressions of the
+ type 'element access.'
+ (BaseAccess): New class for expressions of the type 'base access.'
+ (CheckedExpr, UnCheckedExpr): New classes for Checked and Unchecked expressions
+ respectively.
+
+ * cs-parser.jay (element_access): Implement action.
+ (base_access): Implement actions.
+ (checked_expression, unchecked_expression): Implement.
+
+ * cs-parser.jay (local_variable_type): Correct and implement.
+ (type_suffixes, type_suffix_list, type_suffix): Implement actions.
+
+ * cs-tokenizer.cs (real_type_suffix): Comment out the extra getchar.
+
+ * cs-parser.jay (rank_specifiers): Remove space while concatenating the type's
+ name and the specifiers.
+
+ * interface.cs (InterfaceAttr): New property to return the corresponding TypeAttributes
+
+ * rootcontext.cs (CreateInterface): Use the InterfaceAttr property instead of
+ making them all public ;-)
+
+ * cs-parser.jay (error): Remove entirely as we have an implementation in the base
+ class anyways.
+
+2001-09-07 Miguel de Icaza <miguel@ximian.com>
+
+ * expression.cs (ExprClassFromMemberInfo): Return FieldExpr and
+ PropertyExprs.
+ (FieldExpr, PropertyExprs): New resolved expressions.
+ (SimpleName::MemberStaticCheck): Perform static checks for access
+ to non-static fields on static methods. Maybe this should be
+ generalized for MemberAccesses.
+ (SimpleName::ResolveSimpleName): More work on simple name
+ resolution.
+
+ * cs-parser.jay (primary_expression/qualified_identifier): track
+ the parameter index.
+
+ * codegen.cs (CodeGen::Save): Catch save exception, report error.
+ (EmitContext::EmitBoolExpression): Chain to expression generation
+ instead of temporary hack.
+ (::EmitStatementExpression): Put generic expression code generation.
+
+ * assign.cs (Assign::Emit): Implement variable assignments to
+ local variables, parameters and fields.
+
+2001-09-06 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs (Block::GetVariableInfo): New method, returns the
+ VariableInfo for a variable name in a block.
+ (Block::GetVariableType): Implement in terms of GetVariableInfo
+
+ * literal.cs (IntLiteral::Emit, FloatLiteral::Emit,
+ DoubleLiteral::Emit, CharLiteral::Emit, BoolLiteral::Emit): Implement
+
+2001-09-06 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (operator_declaration): Continue on my quest : update
+ to take attributes argument.
+ (event_declaration): Ditto.
+ (enum_declaration): Ditto.
+ (indexer_declaration): Ditto.
+
+ * class.cs (Operator::Operator): Update constructor accordingly.
+ (Event::Event): Ditto.
+
+ * delegate.cs (Delegate::Delegate): Same here.
+
+ * enum.cs (Enum::Enum): Same here.
+
+2001-09-05 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (CheckAttributeTarget): Update to use the right error number.
+
+ * ../tests/cs0658.cs : New file to demonstrate error 0658.
+
+ * attribute.cs (Attributes): New class to encapsulate all attributes which were
+ being passed around as an arraylist.
+ (Attributes::AddAttribute): Method to add attribute sections.
+
+ * cs-parser.jay (opt_attributes): Modify actions to use the new Attributes class.
+ (struct_declaration): Update accordingly.
+ (constant_declaration): Update.
+ (field_declaration): Update.
+ (method_header): Update.
+ (fixed_parameter): Update.
+ (parameter_array): Ditto.
+ (property_declaration): Ditto.
+ (destructor_declaration): Ditto.
+
+ * class.cs (Struct::Struct): Update constructors accordingly.
+ (Class::Class): Ditto.
+ (Field::Field): Ditto.
+ (Method::Method): Ditto.
+ (Property::Property): Ditto.
+ (TypeContainer::OptAttribute): update property's return type.
+
+ * interface.cs (Interface.opt_attributes): New member.
+ (Interface::Interface): Update to take the extra Attributes argument.
+
+ * parameter.cs (Parameter::Parameter): Ditto.
+
+ * constant.cs (Constant::Constant): Ditto.
+
+ * interface.cs (InterfaceMemberBase): New OptAttributes field.
+ (InterfaceMemberBase::InterfaceMemberBase): Update constructor to take
+ the attributes as a parameter.
+ (InterfaceProperty): Update constructor call.
+ (InterfaceEvent): Ditto.
+ (InterfaceMethod): Ditto.
+ (InterfaceIndexer): Ditto.
+
+ * cs-parser.jay (interface_indexer_declaration): Update call to constructor to
+ pass the attributes too.
+ (interface_event_declaration): Ditto.
+ (interface_property_declaration): Ditto.
+ (interface_method_declaration): Ditto.
+ (interface_declaration): Ditto.
+
+2001-09-05 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (Method::Define): Track the "static Main" definition to
+ create an entry point.
+
+ * rootcontext.cs (RootContext::EntryPoint): MethodInfo that holds the
+ EntryPoint if we find it.
+
+ * codegen.cs (EmitContext::EmitInvocation): Emit invocations.
+ (EmitContext::ig): Make this variable public.
+
+ * driver.cs: Make the default output file be the first file name
+ with the .exe extension.
+
+ Detect empty compilations
+
+ Handle various kinds of output targets. Handle --target and
+ rename -t to --dumper.
+
+ * expression.cs, literal.cs, assign.cs, constant.cs: All `Resolve'
+ methods inherited from Expression return now an Expression. This
+ will is used during the tree rewriting as we resolve them during
+ semantic analysis.
+
+ (Expression::MemberLookup): Implements the MemberLookup (7.3) from
+ the spec. Missing entirely is the information about
+ accessability of elements of it.
+
+ (Expression::ExprClassFromMemberInfo): New constructor for
+ Expressions that creates a fully initialized Expression based on
+ a MemberInfo that is one of Eventinfo, FieldINfo, PropertyInfo or
+ a Type.
+
+ (Invocation::Resolve): Begin implementing resolution of invocations.
+
+ * literal.cs (StringLiteral): Implement Emit.
+
+2001-09-05 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (error): Add new modifier because we are hiding an inherited
+ member.
+
+2001-09-04 Ravi Pratap <ravi@ximian.com>
+
+ * cs-parser.jay (attribute_arguments): Implement actions.
+ (attribute): Fix bug in production. Implement action.
+ (attribute_list): Implement.
+ (attribute_target): Implement.
+ (attribute_target_specifier, opt_target_specifier): Implement
+ (CheckAttributeTarget): New method to check if the attribute target
+ is valid.
+ (attribute_section): Implement.
+ (opt_attributes): Implement.
+
+ * attribute.cs : New file to handle attributes.
+ (Attribute): Class to hold attribute info.
+
+ * cs-parser.jay (opt_attribute_target_specifier): Remove production
+ (attribute_section): Modify production to use 2 different rules to
+ achieve the same thing. 1 s/r conflict down !
+ Clean out commented, useless, non-reducing dimension_separator rules.
+
+ * class.cs (TypeContainer.attributes): New member to hold list
+ of attributes for a type.
+ (Struct::Struct): Modify to take one more argument, the attribute list.
+ (Class::Class): Ditto.
+ (Field::Field): Ditto.
+ (Method::Method): Ditto.
+ (Property::Property): Ditto.
+
+ * cs-parser.jay (struct_declaration): Update constructor call to
+ pass in the attributes too.
+ (class_declaration): Ditto.
+ (constant_declaration): Ditto.
+ (field_declaration): Ditto.
+ (method_header): Ditto.
+ (fixed_parameter): Ditto.
+ (parameter_array): Ditto.
+ (property_declaration): Ditto.
+
+ * constant.cs (Constant::Constant): Update constructor similarly.
+ Use System.Collections.
+
+ * parameter.cs (Parameter::Parameter): Update as above.
+
+2001-09-02 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (TypeContainer::AddDelegate): New method to add a delegate.
+ (TypeContainer.delegates): New member to hold list of delegates.
+
+ * cs-parser.jay (delegate_declaration): Implement the action correctly
+ this time as I seem to be on crack ;-)
+
+2001-09-02 Miguel de Icaza <miguel@ximian.com>
+
+ * rootcontext.cs (RootContext::IsNamespace): new function, used to
+ tell whether an identifier represents a namespace.
+
+ * expression.cs (NamespaceExpr): A namespace expression, used only
+ temporarly during expression resolution.
+ (Expression::ResolveSimpleName, ::ResolvePrimary, ::ResolveName):
+ utility functions to resolve names on expressions.
+
+2001-09-01 Miguel de Icaza <miguel@ximian.com>
+
+ * codegen.cs: Add hook for StatementExpressions.
+
+ * class.cs: Fix inverted test for static flag in methods.
+
+2001-09-02 Ravi Pratap <ravi@ximian.com>
+
+ * class.cs (Operator::CheckUnaryOperator): Correct error number used
+ to make it coincide with MS' number.
+ (Operator::CheckBinaryOperator): Ditto.
+
+ * ../errors/errors.txt : Remove error numbers added earlier.
+
+ * ../errors/cs1019.cs : Test case for error # 1019
+
+ * ../errros/cs1020.cs : Test case for error # 1020
+
+ * cs-parser.jay : Clean out commented cruft.
+ (dimension_separators, dimension_separator): Comment out. Ostensibly not
+ used anywhere - non-reducing rule.
+ (namespace_declarations): Non-reducing rule - comment out.
+
+ * enum.cs (Enum::AddEnum): Rename to AddEnumMember as I was getting confused
+ with TypeContainer::AddEnum.
+
+ * delegate.cs : New file for delegate handling classes.
+ (Delegate): Class for declaring delegates.
+
+ * makefile : Update.
+
+ * cs-parser.jay (delegate_declaration): Implement.
+
+2001-09-01 Ravi Pratap <ravi@che.iitm.ac.in>
+
+ * class.cs (Event::Define): Implement.
+ (Event.EventBuilder): New member.
+
+ * class.cs (TypeContainer::Populate): Update to define all enums and events
+ we have.
+ (Events): New property for the events arraylist we hold. Shouldn't we move to using
+ readonly fields for all these cases ?
+
+2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
+
+ * class.cs (Property): Revamp to use the convention of making fields readonly.
+ Accordingly modify code elsewhere.
+
+ * class.cs : Apply patch from Mr. Mandar <go_mono@hotmail.com> for implementing
+ the Define method of the Property class.
+
+ * class.cs : Clean up applied patch and update references to variables etc. Fix
+ trivial bug.
+ (TypeContainer::Populate): Update to define all the properties we have. Also
+ define all enumerations.
+
+ * enum.cs (Define): Implement.
+
+2001-08-31 Ravi Pratap <ravi@che.iitm.ac.in>
+
+ * cs-parser.jay (overloadable_operator): The semantic value is an
+ enum of the Operator class.
+ (operator_declarator): Implement actions.
+ (operator_declaration): Implement.
+
+ * class.cs (Operator::CheckUnaryOperator): New static method to help in checking
+ validity of definitions.
+ (Operator::CheckBinaryOperator): Static method to check for binary operators
+ (TypeContainer::AddOperator): New method to add an operator to a type.
+
+ * cs-parser.jay (indexer_declaration): Added line to actually call the
+ AddIndexer method so it gets added ;-)
+
+ * ../errors/errors.txt : Update to include new error numbers. Are these numbers
+ already taken care of by the MS compiler ?
+
+2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
+
+ * class.cs (Operator): New class for operator declarations.
+ (Operator::OpType): Enum for the various operators.
+
+2001-08-29 Ravi Pratap <ravi@che.iitm.ac.in>
+
+ * class.cs (TypeContainer::AddIndexer): Remove FIXME comment. We
+ ostensibly handle this in semantic analysis.
+
+ * cs-parser.jay (general_catch_clause): Comment out
+ (specific_catch_clauses, specific_catch_clause): Ditto.
+ (opt_general_catch_clause, opt_specific_catch_clauses): Ditto
+ (catch_args, opt_catch_args): New productions.
+ (catch_clause): Rewrite to use the new productions above
+ (catch_clauses): Modify accordingly.
+ (opt_catch_clauses): New production to use in try_statement
+ (try_statement): Revamp. Basically, we get rid of one unnecessary rule
+ and re-write the code in the actions to extract the specific and
+ general catch clauses by being a little smart ;-)
+
+ * ../tests/try.cs : Fix. It's not 'finalize' my friend, it's 'finally' !
+ Hooray, try and catch statements parse fine !
+
+2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
+
+ * statement.cs (Block::GetVariableType): Fix logic to extract the type
+ string from the hashtable of variables.
+
+ * cs-parser.jay (event_accessor_declarations): Trivial fix. Man, how did
+ I end up making that mistake ;-)
+ (catch_clauses): Fixed gross error which made Key and Value of the
+ DictionaryEntry the same : $1 !!
+
+2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
+
+ * cs-tokenizer.cs (initTokens): Add keywords 'add' and 'remove'
+
+ * cs-parser.jay (event_declaration): Correct to remove the semicolon
+ when the add and remove accessors are specified.
+
+2001-08-28 Ravi Pratap <ravi@che.iitm.ac.in>
+
+ * cs-parser.jay (IndexerDeclaration): New helper class to hold
+ information about indexer_declarator.
+ (indexer_declarator): Implement actions.
+ (parsing_indexer): New local boolean used to keep track of whether
+ we are parsing indexers or properties. This is necessary because
+ implicit_parameters come into picture even for the get accessor in the
+ case of an indexer.
+ (get_accessor_declaration, set_accessor_declaration): Correspondingly modified.
+
+ * class.cs (Indexer): New class for indexer declarations.
+ (TypeContainer::AddIndexer): New method to add an indexer to a type.
+ (TypeContainer::indexers): New member to hold list of indexers for the
+ type.
+
+2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
+
+ * cs-parser.jay (add_accessor_declaration): Implement action.
+ (remove_accessor_declaration): Implement action.
+ (event_accessors_declaration): Implement
+ (variable_declarators): swap statements for first rule - trivial.
+
+ * class.cs (Event): New class to hold information about event
+ declarations.
+ (TypeContainer::AddEvent): New method to add an event to a type
+ (TypeContainer::events): New member to hold list of events.
+
+ * cs-parser.jay (event_declaration): Implement actions.
+
+2001-08-27 Ravi Pratap <ravi@che.iitm.ac.in>
+
+ * cs-parser.jay (dim_separators): Implement. Make it a string
+ concatenating all the commas together, just as they appear.
+ (opt_dim_separators): Modify accordingly
+ (rank_specifiers): Update accordingly. Basically do the same
+ thing - instead, collect the brackets here.
+ (opt_rank_sepcifiers): Modify accordingly.
+ (array_type): Modify to actually return the complete type string
+ instead of ignoring the rank_specifiers.
+ (expression_list): Implement to collect the expressions
+ (variable_initializer): Implement. We make it a list of expressions
+ essentially so that we can handle the array_initializer case neatly too.
+ (variable_initializer_list): Implement.
+ (array_initializer): Make it a list of variable_initializers
+ (opt_array_initializer): Modify accordingly.
+
+ * expression.cs (New::NType): Add enumeration to help us
+ keep track of whether we have an object/delegate creation
+ or an array creation.
+ (New:NewType, New::Rank, New::Indices, New::Initializers): New
+ members to hold data about array creation.
+ (New:New): Modify to update NewType
+ (New:New): New Overloaded contructor for the array creation
+ case.
+
+ * cs-parser.jay (array_creation_expression): Implement to call
+ the overloaded New constructor.
+
+2001-08-26 Ravi Pratap <ravi@che.iitm.ac.in>
+
+ * class.cs (TypeContainer::Constructors): Return member
+ constructors instead of returning null.
+
+2001-08-26 Miguel de Icaza <miguel@ximian.com>
+
+ * typemanager.cs (InitCoreTypes): Initialize the various core
+ types after we have populated the type manager with the user
+ defined types (this distinction will be important later while
+ compiling corlib.dll)
+
+ * expression.cs, literal.cs, assign.cs, constant.cs: Started work
+ on Expression Classification. Now all expressions have a method
+ `Resolve' and a method `Emit'.
+
+ * codegen.cs, cs-parser.jay: Fixed the bug that stopped code
+ generation from working. Also add some temporary debugging
+ code.
+
+2001-08-24 Miguel de Icaza <miguel@ximian.com>
+
+ * codegen.cs: Lots of code generation pieces. This is only the
+ beginning, will continue tomorrow with more touches of polish. We
+ handle the fundamentals of if, while, do, for, return. Others are
+ trickier and I need to start working on invocations soon.
+
+ * gen-treedump.cs: Bug fix, use s.Increment here instead of
+ s.InitStatement.
+
+ * codegen.cs (EmitContext): New struct, used during code
+ emission to keep a context. Most of the code generation will be
+ here.
+
+ * cs-parser.jay: Add embedded blocks to the list of statements of
+ this block. So code generation proceeds in a top down fashion.
+
+2001-08-23 Miguel de Icaza <miguel@ximian.com>
+
+ * statement.cs: Add support for multiple child blocks.
+
+2001-08-22 Miguel de Icaza <miguel@ximian.com>
+
+ * codegen.cs (EmitCode): New function, will emit the code for a
+ Block of code given a TypeContainer and its ILGenerator.
+
+ * statement.cs (Block): Standard public readonly optimization.
+ (Block::Block constructors): Link children.
+ (Block::Child): Child Linker.
+ (Block::EmitVariables): Emits IL variable declarations.
+
+ * class.cs: Drop support for MethodGroups here, delay until
+ Semantic Analysis.
+ (Method::): Applied the same simplification that I did before, and
+ move from Properties to public readonly fields.
+ (Method::ParameterTypes): Returns the parameter types for the
+ function, and implements a cache that will be useful later when I
+ do error checking and the semantic analysis on the methods is
+ performed.
+ (Constructor::GetCallingConvention): Renamed from CallingConvetion
+ and made a method, optional argument tells whether this is a class
+ or a structure to apply the `has-this' bit.
+ (Method::GetCallingConvention): Implement, returns the calling
+ convention.
+ (Method::Define): Defines the type, a second pass is performed
+ later to populate the methods.
+
+ (Constructor::ParameterTypes): implement a cache similar to the
+ one on Method::ParameterTypes, useful later when we do semantic
+ analysis.
+
+ (TypeContainer::EmitMethod): New method. Emits methods.
+
+ * expression.cs: Removed MethodGroup class from here.
+
+ * parameter.cs (Parameters::GetCallingConvention): new method.
+
+2001-08-21 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (TypeContainer::Populate): Drop RootContext from the
+ argument.
+
+ (Constructor::CallingConvention): Returns the calling convention.
+ (Constructor::ParameterTypes): Returns the constructor parameter
+ types.
+
+ (TypeContainer::AddConstructor): Keep track of default constructor
+ and the default static constructor.
+
+ (Constructor::) Another class that starts using `public readonly'
+ instead of properties.
+
+ (Constructor::IsDefault): Whether this is a default constructor.
+
+ (Field::) use readonly public fields instead of properties also.
+
+ (TypeContainer::TypeAttr, TypeContainer::AddConstructor): Keep
+ track of static constructors; If none is used, turn on
+ BeforeFieldInit in the TypeAttributes.
+
+ * cs-parser.jay (opt_argument_list): now the return can be null
+ for the cases where there are no arguments.
+
+ (constructor_declarator): If there is no implicit `base' or
+ `this', then invoke the default parent constructor.
+
+ * modifiers.cs (MethodAttr): New static function maps a set of
+ modifiers flags into a MethodAttributes enum
+ (FieldAttr): renamed from `Map'. So now we have FieldAttr,
+ MethodAttr, TypeAttr to represent the various mappings where the
+ modifiers are used.
+ (FieldAttr): Map also `readonly' to `FieldAttributes.InitOnly'
+
+2001-08-19 Miguel de Icaza <miguel@ximian.com>
+
+ * parameter.cs (GetParameterInfo): Fix bug where there would be no
+ method arguments.
+
+ * interface.cs (PopulateIndexer): Implemented the code generator
+ for interface indexers.
+
+2001-08-17 Miguel de Icaza <miguel@ximian.com>
+
+ * interface.cs (InterfaceMemberBase): Now we track the new status
+ here.
+
+ (PopulateProperty): Implement property population. Woohoo! Got
+ Methods and Properties going today.
+
+ Removed all the properties for interfaces, and replaced them with
+ `public readonly' fields.
+
+2001-08-16 Miguel de Icaza <miguel@ximian.com>
+
+ * interface.cs (AddEvent, AddMethod, AddIndexer, AddProperty):
+ initialize their hashtables/arraylists only when they are needed
+ instead of doing this always.
+
+ * parameter.cs: Handle refs and out parameters.
+
+ * cs-parser.jay: Use an ArrayList to construct the arguments
+ instead of the ParameterCollection, and then cast that to a
+ Parameter[] array.
+
+ * parameter.cs: Drop the use of ParameterCollection and use
+ instead arrays of Parameters.
+
+ (GetParameterInfo): Use the Type, not the Name when resolving
+ types.
+
+2001-08-13 Miguel de Icaza <miguel@ximian.com>
+
+ * parameter.cs: Eliminate the properties Name, Type and ModFlags,
+ and instead use public readonly fields.
+
+ * class.cs: Put back walking code for type containers.
+
+2001-08-11 Miguel de Icaza <miguel@ximian.com>
+
+ * class.cs (MakeConstant): Code to define constants.
+
+ * rootcontext.cs (LookupType): New function. Used to locate types
+
+
+2001-08-08 Miguel de Icaza <miguel@ximian.com>
+
+ * rootcontext.cs: OH MY! My trick works! It is amazing how nice
+ this System.Reflection code is. Kudos to Microsoft
+
+ * typemanager.cs: Implement a type cache and avoid loading all
+ types at boot time. Wrap in LookupType the internals. This made
+ the compiler so much faster. Wow. I rule!
+
+ * driver.cs: Make sure we always load mscorlib first (for
+ debugging purposes, nothing really important).
+
+ * Renamespaced things that were on `CSC' to `CIR'. Maybe I should
+ have moved to `CSC' rather than `CIR'. Oh man! The confussion!
+
+ * rootcontext.cs: Lookup types on their namespace; Lookup types
+ on namespaces that have been imported using the `using' keyword.
+
+ * class.cs (TypeContainer::TypeAttr): Virtualize.
+ (Class::TypeAttr): Return attributes suitable for this bad boy.
+ (Struct::TypeAttr): ditto.
+ Handle nested classes.
+ (TypeContainer::) Remove all the type visiting code, it is now
+ replaced with the rootcontext.cs code
+
+ * rootcontext.cs (GetClassBases): Added support for structs.
+
+2001-08-06 Miguel de Icaza <miguel@ximian.com>
+
+ * interface.cs, statement.cs, class.cs, parameter.cs,
+ rootcontext.cs, gen-treedump.cs, enum.cs, cs-parse.jay:
+ Drop use of TypeRefs, and use strings instead.
+
+2001-08-04 Miguel de Icaza <miguel@ximian.com>
+
+ * rootcontext.cs:
+
+ * class.cs (Struct::Struct): set the SEALED flags after
+ checking the modifiers.
+ (TypeContainer::TypeAttr): new property, returns the
+ TypeAttributes for a class.
+
+ * cs-parser.jay (type_list): Oops, list production was creating a
+ new list of base types.
+
+ * rootcontext.cs (StdLib): New property.
+ (GetInterfaceTypeByName): returns an interface by type name, and
+ encapsulates error handling here.
+ (GetInterfaces): simplified.
+ (ResolveTree): Encapsulated all the tree resolution here.
+ (CreateClass, GetClassBases, GetInterfaceOrClass): Create class
+ types.
+
+ * driver.cs: Add support for --nostdlib, to avoid loading the
+ default assemblies.
+ (Main): Do not put tree resolution here.
+
+ * rootcontext.cs: Beginning of the class resolution.
+
+2001-08-03 Miguel de Icaza <miguel@ximian.com>
+
+ * rootcontext.cs: Provide better error reporting.
+
+ * cs-parser.jay (interface_base): set our $$ to be interfaces.
+
+ * rootcontext.cs (CreateInterface): Handle the case where there
+ are no parent interfaces.
+
+ (CloseTypes): Routine to flush types at the end.
+ (CreateInterface): Track types.
+ (GetInterfaces): Returns an array of Types from the list of
+ defined interfaces.
+
+ * typemanager.c (AddUserType): Mechanism to track user types (puts
+ the type on the global type hash, and allows us to close it at the
+ end).
+
+2001-08-02 Miguel de Icaza <miguel@ximian.com>
+
+ * tree.cs: Removed RecordType, added RecordClass, RecordStruct and
+ RecordInterface instead.
+
+ * cs-parser.jay: Updated to reflect changes above.
+
+ * decl.cs (Definition): Keep track of the TypeBuilder type that
+ represents this type here. Not sure we will use it in the long
+ run, but wont hurt for now.
+
+ * driver.cs: Smaller changes to accomodate the new code.
+
+ Call ResolveInterfaceBases, Call ResolveClassBases, Save assembly
+ when done.
+
+ * rootcontext.cs (CreateInterface): New method, used to create
+ the System.TypeBuilder type for interfaces.
+ (ResolveInterfaces): new entry point to resolve the interface
+ hierarchy.
+ (CodeGen): Property, used to keep track of the code generator.
+
+2001-07-26 Miguel de Icaza <miguel@ximian.com>
+
+ * cs-parser.jay: Add a second production for delegate_declaration
+ with `VOID'.
+
+ (enum_body): Put an opt_comma here instead of putting it on
+ enum_body or enum_member_declarations so we can handle trailing
+ commas on enumeration members. Gets rid of a shift/reduce.
+
+ (type_list): Need a COMMA in the middle.
+
+ (indexer_declaration): Tell tokenizer to recognize get/set
+
+ * Remove old targets.
+
+ * Re-add the parser target.
+
+2001-07-13 Simon Cozens <simon@simon-cozens.org>
+
+ * cs-parser.jay: Add precendence rules for a number of operators
+ ot reduce the number of shift/reduce conflicts in the grammar.
+
+2001-07-17 Miguel de Icaza <miguel@ximian.com>
+
+ * tree.cs: moved IGenerator interface and renamed it to ITreeDump
+ and put it here.
+
+ Get rid of old crufty code.
+
+ * rootcontext.cs: Use this to keep track of the parsed
+ representation and the defined types available to the program.
+
+ * gen-treedump.cs: adjust for new convention.
+
+ * type.cs: Split out the type manager, and the assembly builder
+ from here.
+
+ * typemanager.cs: the type manager will live here now.
+
+ * cil-codegen.cs: And the code generator here.
+
+2001-07-14 Sean MacIsaac <macisaac@ximian.com>
+
+ * makefile: Fixed up for easy making.
+
+2001-07-13 Simon Cozens <simon@simon-cozens.org>
+
+ * cs-parser.jay (rank_specifier): Remove a conflict by reordering
+ the
+
+ (unary_expression): Expand pre_increment_expression and
+ post_decrement_expression to reduce a shift/reduce.
+
+2001-07-11 Simon Cozens
+
+ * cs-tokenizer.cs: Hex numbers should begin with a 0.
+
+ Improve allow_keyword_as_indent name.
+
+2001-06-19 Miguel de Icaza <miguel@ximian.com>
+
+ * Adjustments for Beta2.
+
2001-06-13 Miguel de Icaza <miguel@ximian.com>
* decl.cs: Added `Define' abstract method.
diff --git a/mcs/mcs/TODO b/mcs/mcs/TODO
new file mode 100644
index 00000000000..c0504ce365a
--- /dev/null
+++ b/mcs/mcs/TODO
@@ -0,0 +1,323 @@
+Major tasks:
+------------
+
+ Pinned and volatile require type modifiers that can not be encoded
+ with Reflection.Emit.
+
+ Properties and 17.6.3: Finish it.
+
+ Implement base indexer access.
+
+readonly variables and ref/out
+
+Important:
+----------
+
+ During enumeration definition, a set of extra operators are
+ allowed.
+
+BUGS
+----
+
+* Check for Final when overriding, if the parent is Final, then we cant
+ allow an override.
+
+* Do not declare a .property on things that are just implementations, that
+ comes from the parent, just do the method.
+
+* Currently the code path for 108/109 reporting is not being ran for methods
+ as we need to compare method signatures. But since we retrieve the expensive
+ method arguments in the method, we probably should do 108/109 processing there.
+
+* Emit warning on hiding members without NEW not only in members.
+
+* Implement visibility.
+
+* Adding variables.
+
+ We do add variables in a number of places, and this is erroneous:
+
+ void a (int b)
+ {
+ int b;
+ }
+
+ Also:
+
+ void a (int b)
+ {
+ foreach (int b ...)
+ ;
+ }
+
+* Visibility
+
+ I am not reporting errors on visibility yet.
+
+* Interface indexers
+
+ I have not figured out why the Microsoft version puts an
+ `instance' attribute, and I am not generating this `instance' attribute.
+
+ Explanation: The reason for the `instance' attribute on
+ indexers is that indexers only apply to instances
+
+* Arrays
+
+ We need to make sure at *compile time* that the arguments in
+ the expression list of an array creation are always positive.
+
+* Implement dead code elimination in statement.cs
+
+ It is pretty simple to implement dead code elimination in
+ if/do/while
+
+* Indexer bugs:
+
+ the following wont work:
+
+ x [0] = x [1] = N
+
+ if x has indexers, the value of x [N] set is set to void. This needs to be
+ fixed.
+
+* Array declarations
+
+ Multi-dim arrays are declared as [,] instead of [0..,0..]
+
+* Break/Continue statements
+
+ A finally block should reset the InLoop/LoopBegin/LoopEnd, as
+ they are logically outside the scope of the loop.
+
+* Break/continue part 2.
+
+ They should transfer control to the finally block if inside a try/catch
+ block.
+
+* Method Registration and error CS111
+
+ The way we use the method registration to signal 111 is wrong.
+
+ Method registration should only be used to register methodbuilders,
+ we need an alternate method of checking for duplicates.
+
+* We need to catch:
+
+ extern string Property {
+ get { }
+ }
+
+ The get there should only have a semicolon
+
+*
+> // CSC sets beforefieldinit
+> class X {
+> // .cctor will be generated by compiler
+> public static readonly object O = new System.Object ();
+> public static void Main () {}
+> }
+>
+
+PENDING TASKS
+-------------
+
+* Merge test 89 and test-34
+
+* Revisit
+
+ Primary-expression, as it has now been split into
+ non-array-creation-expression and array-creation-expression.
+
+* Static flow analysis
+
+ Required to warn about reachability of code and definite
+ assignemt as well as missing returns on functions.
+
+* Code cleanup
+
+ The information when registering a method in InternalParameters
+ is duplicated, you can always get the types from the InternalParameters
+
+* Emit modreq for volatiles
+
+ Handle modreq from public apis.
+
+* Emit `pinned' for pinned local variables.
+
+ Both `modreq' and pinned will require special hacks in the compiler.
+
+* Make sure that we are pinning the right variable
+
+* Maybe track event usage? Currently I am not tracking these, although they
+ are fields.
+
+* Merge tree.cs, rootcontext.cs
+
+OPTIMIZATIONS
+-------------
+
+* There is too much unshared code between MemberAccess.Resolve and SimpleName
+ resolve.
+
+* User Defined Conversions is doing way too many calls to do union sets that are not needed
+
+* Implement loop inversion for our loops
+
+* Add test case for destructors
+
+* Places that use `Ldelema' are basically places where I will be
+ initializing a value type. I could apply an optimization to
+ disable the implicit local temporary from being created (by using
+ the method in New).
+
+* Dropping TypeContainer as an argument to EmitContext
+
+ My theory is that I can get rid of the TypeBuilder completely from
+ the EmitContext, and have typecasts where it is used (from
+ DeclSpace to where it matters).
+
+ The only pending problem is that the code that implements Aliases
+ is on TypeContainer, and probably should go in DeclSpace.
+
+* Casts need to trigger a name resolution against types only.
+
+ currently we use a secret hand shake, probably we should use
+ a differen path, and only expressions (memberaccess, simplename)
+ would participate in this protocol.
+
+* Use of local temporary in UnaryMutator
+
+ We should get rid of the Localtemporary there for some cases
+
+* Emitcontext
+
+ Do we really need to instanciate this variable all the time?
+
+ It could be static for all we care, and just use it for making
+ sure that there are no recursive invocations on it.
+
+* Use of EmitBranchable
+
+ Currently I use brfalse/brtrue in the code for statements, instead of
+ using the EmitBranchable function that lives in Binary
+
+* ConvertImplicit
+
+ Currently ConvertImplicit will not catch things like:
+
+ - IntLiteral in a float context to generate a -FloatLiteral.
+ Instead it will perform an integer load followed by a conversion.
+
+* Tests
+
+ Write tests for the various reference conversions. We have
+ test for all the numeric conversions.
+
+* Optimizations
+
+ In Indexers and Properties, probably support an EmitWithDup
+ That emits the code to call Get and then leaves a this pointer
+ in the stack, so that later a Store can be emitted using that
+ this pointer (consider Property++ or Indexer++)
+
+* Optimizations: variable allocation.
+
+ When local variables of a type are required, we should request
+ the variable and later release it when we are done, so that
+ the same local variable slot can be reused later on.
+
+* Add a cache for the various GetArrayMethod operations.
+
+* TypeManager.FindMembers:
+
+ Instead of having hundreds of builder_to_blah hash table, have
+ a single one that maps a TypeBuilder `t' to a set of classes
+ that implement an interface that supports FindMembers.
+
+* MakeUnionSet Callers
+
+ If the types are the same, there is no need to compute the unionset,
+ we can just use the list from one of the types.
+
+* Factor all the FindMembers in all the FindMembers providers.
+
+* Factor the lookup code for class declarations an interfaces
+ (interface.cs:GetInterfaceByName)
+
+RECOMMENDATIONS
+---------------
+
+* Use of lexer.Location in the parser
+
+ Currently we do:
+
+ TOKEN nt TERMINAL nt TERMINAL nt3 {
+ $$ = new Blah ($2, $4, $6, lexer.Location);
+ }
+
+ This is bad, because the lexer.Location is for the last item in `nt3'
+
+ We need to change that to use this pattern:
+
+ TOKEN { oob_stack.Push (lexer.Location) } nt TERMINAL nt TERMINAL nt3 {
+ $$ = new Blah ($3, $5, $7, (Location) oob_stack.Pop ());
+ }
+
+ Notice how numbering of the arguments changes as the
+ { oob_stack.Push (lexer.Location) } takes a "slot" in the productions.
+
+* local_variable_declaration
+
+ Not sure that this grammar is correct, we might have to
+ resolve this during semantic analysis.
+
+* Optimizations
+
+ Only create one `This' instance per class, and reuse it.
+
+ Maybe keep a pool of constants/literals (zero, 1)?
+
+* Idea
+
+ MethodGroupExpr
+
+ These guys should only appear as part of an Invocation, so we
+ probably can afford to have a special callback:
+
+ Expression.ResolveAllowMemberGroups
+
+ This is only called by Invocation (or anyone that consumes
+ MethodGroupExprs)
+
+ And the regular DoResolve and DoResolveLValue do emit the error
+ 654 `Method referenced without argument list'.
+
+ Otherwise, a resolution will return a MethodGroupExpr which is
+ not guaranteed to have set its `Expression.Type' to a non-null
+ value.
+
+
+************
+Potential bug:
+
+ We would need to decode the shortname before we lookup members?
+
+ Maybe not.
+
+interface I {
+ void A ();
+}
+
+class X : I {
+ void I.A ();
+}
+
+class Y : X, I {
+ void I.A () {}
+}
+
+
+
+*************
+
diff --git a/mcs/mcs/assign.cs b/mcs/mcs/assign.cs
index c34f70d1cf8..2e769e5f750 100755
--- a/mcs/mcs/assign.cs
+++ b/mcs/mcs/assign.cs
@@ -1,20 +1,104 @@
//
-// assign.cs: Assignment representation for the IL tree.
+// assign.cs: Assignments.
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
// (C) 2001 Ximian, Inc.
//
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
-namespace CIR {
- public class Assign : Expression {
- Expression target, source;
+namespace Mono.CSharp {
+
+ /// <summary>
+ /// This interface is implemented by expressions that can be assigned to.
+ /// </summary>
+ /// <remarks>
+ /// This interface is implemented by Expressions whose values can not
+ /// store the result on the top of the stack.
+ ///
+ /// Expressions implementing this (Properties, Indexers and Arrays) would
+ /// perform an assignment of the Expression "source" into its final
+ /// location.
+ ///
+ /// No values on the top of the stack are expected to be left by
+ /// invoking this method.
+ /// </remarks>
+ public interface IAssignMethod {
+ void EmitAssign (EmitContext ec, Expression source);
+ }
+
+ /// <summary>
+ /// An Expression to hold a temporary value.
+ /// </summary>
+ /// <remarks>
+ /// The LocalTemporary class is used to hold temporary values of a given
+ /// type to "simulate" the expression semantics on property and indexer
+ /// access whose return values are void.
+ ///
+ /// The local temporary is used to alter the normal flow of code generation
+ /// basically it creates a local variable, and its emit instruction generates
+ /// code to access this value, return its address or save its value.
+ /// </remarks>
+ public class LocalTemporary : Expression, IMemoryLocation {
+ LocalBuilder builder;
+
+ public LocalTemporary (EmitContext ec, Type t)
+ {
+ type = t;
+ eclass = ExprClass.Value;
+ builder = ec.GetTemporaryStorage (t);
+ }
+
+ public void Release (EmitContext ec)
+ {
+ ec.FreeTemporaryStorage (builder);
+ builder = null;
+ }
- public Assign (Expression target, Expression source)
+ public LocalTemporary (LocalBuilder b, Type t)
+ {
+ type = t;
+ eclass = ExprClass.Value;
+ builder = b;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ec.ig.Emit (OpCodes.Ldloc, builder);
+ }
+
+ public void Store (EmitContext ec)
+ {
+ ec.ig.Emit (OpCodes.Stloc, builder);
+ }
+
+ public void AddressOf (EmitContext ec, AddressOp mode)
+ {
+ ec.ig.Emit (OpCodes.Ldloca, builder);
+ }
+ }
+
+ /// <summary>
+ /// The Assign node takes care of assigning the value of source into
+ /// the expression represented by target.
+ /// </summary>
+ public class Assign : ExpressionStatement {
+ Expression target, source;
+ Location l;
+
+ public Assign (Expression target, Expression source, Location l)
{
this.target = target;
this.source = source;
+ this.l = l;
}
public Expression Target {
@@ -36,5 +120,153 @@ namespace CIR {
source = value;
}
}
+
+ public static void error70 (EventInfo ei, Location l)
+ {
+ Report.Error (70, l, "The event '" + ei.Name +
+ "' can only appear on the left-side of a += or -= (except when" +
+ " used from within the type '" + ei.DeclaringType + "')");
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ source = source.Resolve (ec);
+ if (source == null)
+ return null;
+
+ target = target.ResolveLValue (ec, source);
+
+ if (target == null)
+ return null;
+
+ Type target_type = target.Type;
+ Type source_type = source.Type;
+
+ type = target_type;
+ eclass = ExprClass.Value;
+
+ //
+ // If we are doing a property assignment, then
+ // set the `value' field on the property, and Resolve
+ // it.
+ //
+ if (target is PropertyExpr){
+ PropertyExpr property_assign = (PropertyExpr) target;
+
+ //
+ // FIXME: Maybe handle this in the LValueResolve
+ //
+ if (!property_assign.VerifyAssignable ())
+ return null;
+
+ return this;
+ }
+
+ if (target is IndexerAccess){
+ IndexerAccess ia = (IndexerAccess) target;
+
+ return this;
+ }
+
+ if (target is EventExpr) {
+
+ Binary tmp;
+ EventInfo ei = ((EventExpr) target).EventInfo;
+
+
+ Expression ml = MemberLookup (
+ ec, ec.ContainerType, ei.Name,
+ MemberTypes.Event, AllBindingFlags, l);
+
+ if (ml == null) {
+ //
+ // If this is the case, then the Event does not belong
+ // to this TypeContainer and so, according to the spec
+ // is allowed to only appear on the left hand of
+ // the += and -= operators
+ //
+ // Note that if target will not appear as an EventExpr
+ // in the case it is being referenced within the same type container;
+ // it will appear as a FieldExpr in that case.
+ //
+
+ if (!(source is Binary)) {
+ error70 (ei, l);
+ return null;
+ } else {
+ tmp = ((Binary) source);
+ if (tmp.Oper != Binary.Operator.Addition &&
+ tmp.Oper != Binary.Operator.Subtraction) {
+ error70 (ei, l);
+ return null;
+ }
+ }
+ }
+ }
+
+ if (source is New && target_type.IsSubclassOf (TypeManager.value_type)){
+ New n = (New) source;
+
+ n.ValueTypeVariable = target;
+ return n;
+ }
+
+ if (target_type != source_type){
+ source = ConvertImplicitRequired (ec, source, target_type, l);
+ if (source == null)
+ return null;
+ }
+
+ if (target.eclass != ExprClass.Variable && target.eclass != ExprClass.EventAccess){
+ Report.Error (131, l,
+ "Left hand of an assignment must be a variable, " +
+ "a property or an indexer");
+ return null;
+ }
+
+ return this;
+ }
+
+ void Emit (EmitContext ec, bool is_statement)
+ {
+ if (target is EventExpr) {
+ ((EventExpr) target).EmitAddOrRemove (ec, source);
+ return;
+ }
+
+ //
+ // FIXME! We need a way to "probe" if the process can
+ // just use `dup' to propagate the result
+ //
+ IAssignMethod am = (IAssignMethod) target;
+
+ if (is_statement)
+ am.EmitAssign (ec, source);
+ else {
+ LocalTemporary tempo;
+
+ tempo = new LocalTemporary (ec, source.Type);
+
+ source.Emit (ec);
+ tempo.Store (ec);
+ am.EmitAssign (ec, tempo);
+ tempo.Emit (ec);
+ tempo.Release (ec);
+ }
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ Emit (ec, false);
+ }
+
+ public override void EmitStatement (EmitContext ec)
+ {
+ Emit (ec, true);
+ }
}
}
+
+
+
+
diff --git a/mcs/mcs/attribute.cs b/mcs/mcs/attribute.cs
new file mode 100644
index 00000000000..775d68cf852
--- /dev/null
+++ b/mcs/mcs/attribute.cs
@@ -0,0 +1,682 @@
+//
+// attribute.cs: Attribute Handler
+//
+// Author: Ravi Pratap (ravi@ximian.com)
+//
+// Licensed under the terms of the GNU GPL
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Text;
+
+namespace Mono.CSharp {
+
+ public class Attribute {
+ public readonly string Name;
+ public readonly ArrayList Arguments;
+
+ Location Location;
+
+ public Type Type;
+
+ //
+ // The following are only meaningful when the attribute
+ // being emitted is one of the builtin ones
+ //
+ public AttributeTargets Targets;
+ public bool AllowMultiple;
+ public bool Inherited;
+
+ public bool UsageAttr = false;
+
+ public MethodImplOptions ImplOptions;
+ public UnmanagedType UnmanagedType;
+
+ public Attribute (string name, ArrayList args, Location loc)
+ {
+ Name = name;
+ Arguments = args;
+ Location = loc;
+ }
+
+ void error617 (string name)
+ {
+ Report.Error (617, Location, "'" + name + "' is not a valid named attribute " +
+ "argument. Named attribute arguments must be fields which are not " +
+ "readonly, static or const, or properties with a set accessor which "+
+ "are not static.");
+ }
+
+ void error182 ()
+ {
+ Report.Error (182, Location,
+ "An attribute argument must be a constant expression, typeof " +
+ "expression or array creation expression");
+ }
+
+ public CustomAttributeBuilder Resolve (EmitContext ec)
+ {
+ string name = Name;
+ bool MethodImplAttr = false;
+ bool MarshalAsAttr = false;
+
+ UsageAttr = false;
+
+ if (Name.IndexOf ("Attribute") == -1)
+ name = Name + "Attribute";
+ else if (Name.LastIndexOf ("Attribute") == 0)
+ name = Name + "Attribute";
+
+ Type = RootContext.LookupType (ec.DeclSpace, name, false, Location);
+
+ if (Type == null) {
+ Report.Error (
+ 246, Location, "Could not find attribute '" + Name + "' (are you" +
+ " missing a using directive or an assembly reference ?)");
+ return null;
+ }
+
+ if (Type == TypeManager.attribute_usage_type)
+ UsageAttr = true;
+ if (Type == TypeManager.methodimpl_attr_type)
+ MethodImplAttr = true;
+ if (Type == TypeManager.marshal_as_attr_type)
+ MarshalAsAttr = true;
+
+
+ // Now we extract the positional and named arguments
+
+ ArrayList pos_args = new ArrayList ();
+ ArrayList named_args = new ArrayList ();
+
+ if (Arguments != null) {
+ pos_args = (ArrayList) Arguments [0];
+ if (Arguments.Count > 1)
+ named_args = (ArrayList) Arguments [1];
+ }
+
+ object [] pos_values = new object [pos_args.Count];
+
+ //
+ // First process positional arguments
+ //
+
+ int i;
+ for (i = 0; i < pos_args.Count; i++) {
+ Argument a = (Argument) pos_args [i];
+ Expression e;
+
+ if (!a.Resolve (ec, Location))
+ return null;
+
+ e = a.Expr;
+ if (e is Constant) {
+ pos_values [i] = ((Constant) e).GetValue ();
+ } else if (e is TypeOf) {
+ pos_values [i] = ((TypeOf) e).TypeArg;
+ } else {
+ error182 ();
+ return null;
+ }
+
+ if (UsageAttr)
+ this.Targets = (AttributeTargets) pos_values [0];
+
+ if (MethodImplAttr)
+ this.ImplOptions = (MethodImplOptions) pos_values [0];
+
+ if (MarshalAsAttr)
+ this.UnmanagedType =
+ (System.Runtime.InteropServices.UnmanagedType) pos_values [0];
+ }
+
+ //
+ // Now process named arguments
+ //
+
+ ArrayList field_infos = new ArrayList ();
+ ArrayList prop_infos = new ArrayList ();
+ ArrayList field_values = new ArrayList ();
+ ArrayList prop_values = new ArrayList ();
+
+ for (i = 0; i < named_args.Count; i++) {
+ DictionaryEntry de = (DictionaryEntry) named_args [i];
+ string member_name = (string) de.Key;
+ Argument a = (Argument) de.Value;
+ Expression e;
+
+ if (!a.Resolve (ec, Location))
+ return null;
+
+ Expression member = Expression.MemberLookup (
+ ec, Type, member_name,
+ MemberTypes.Field | MemberTypes.Property,
+ BindingFlags.Public | BindingFlags.Instance,
+ Location);
+
+ if (member == null || !(member is PropertyExpr || member is FieldExpr)) {
+ error617 (member_name);
+ return null;
+ }
+
+ e = a.Expr;
+ if (member is PropertyExpr) {
+ PropertyExpr pe = (PropertyExpr) member;
+ PropertyInfo pi = pe.PropertyInfo;
+
+ if (!pi.CanWrite) {
+ error617 (member_name);
+ return null;
+ }
+
+ if (e is Constant) {
+ object o = ((Constant) e).GetValue ();
+ prop_values.Add (o);
+
+ if (UsageAttr) {
+ if (member_name == "AllowMultiple")
+ this.AllowMultiple = (bool) o;
+ if (member_name == "Inherited")
+ this.Inherited = (bool) o;
+ }
+
+ } else {
+ error182 ();
+ return null;
+ }
+
+ prop_infos.Add (pi);
+
+ } else if (member is FieldExpr) {
+ FieldExpr fe = (FieldExpr) member;
+ FieldInfo fi = fe.FieldInfo;
+
+ if (fi.IsInitOnly) {
+ error617 (member_name);
+ return null;
+ }
+
+ if (e is Constant)
+ field_values.Add (((Constant) e).GetValue ());
+ else {
+ error182 ();
+ return null;
+ }
+
+ field_infos.Add (fi);
+ }
+ }
+
+ Expression mg = Expression.MemberLookup (
+ ec, Type, ".ctor", MemberTypes.Constructor,
+ BindingFlags.Public | BindingFlags.Instance, Location);
+
+ if (mg == null) {
+ Report.Error (
+ -6, Location,
+ "Could not find a constructor for this argument list.");
+ return null;
+ }
+
+ MethodBase constructor = Invocation.OverloadResolve (
+ ec, (MethodGroupExpr) mg, pos_args, Location);
+
+ if (constructor == null) {
+ Report.Error (
+ -6, Location,
+ "Could not find a constructor for this argument list.");
+ return null;
+ }
+
+ PropertyInfo [] prop_info_arr = new PropertyInfo [prop_infos.Count];
+ FieldInfo [] field_info_arr = new FieldInfo [field_infos.Count];
+ object [] field_values_arr = new object [field_values.Count];
+ object [] prop_values_arr = new object [prop_values.Count];
+
+ field_infos.CopyTo (field_info_arr, 0);
+ field_values.CopyTo (field_values_arr, 0);
+
+ prop_values.CopyTo (prop_values_arr, 0);
+ prop_infos.CopyTo (prop_info_arr, 0);
+
+ CustomAttributeBuilder cb = new CustomAttributeBuilder (
+ (ConstructorInfo) constructor, pos_values,
+ prop_info_arr, prop_values_arr,
+ field_info_arr, field_values_arr);
+
+ return cb;
+ }
+
+ static string GetValidPlaces (Attribute attr)
+ {
+ StringBuilder sb = new StringBuilder ();
+ AttributeTargets targets = 0;
+
+ TypeContainer a = TypeManager.LookupAttr (attr.Type);
+
+ if (a == null) {
+
+ System.Attribute [] attrs = null;
+
+ try {
+ attrs = System.Attribute.GetCustomAttributes (attr.Type);
+
+ } catch {
+ Report.Error (-20, attr.Location, "Cannot find attribute type " + attr.Name +
+ " (maybe you forgot to set the usage using the" +
+ " AttributeUsage attribute ?).");
+ return null;
+ }
+
+ foreach (System.Attribute tmp in attrs)
+ if (tmp is AttributeUsageAttribute)
+ targets = ((AttributeUsageAttribute) tmp).ValidOn;
+ } else
+ targets = a.Targets;
+
+
+ if ((targets & AttributeTargets.Assembly) != 0)
+ sb.Append ("'assembly' ");
+
+ if ((targets & AttributeTargets.Class) != 0)
+ sb.Append ("'class' ");
+
+ if ((targets & AttributeTargets.Constructor) != 0)
+ sb.Append ("'constructor' ");
+
+ if ((targets & AttributeTargets.Delegate) != 0)
+ sb.Append ("'delegate' ");
+
+ if ((targets & AttributeTargets.Enum) != 0)
+ sb.Append ("'enum' ");
+
+ if ((targets & AttributeTargets.Event) != 0)
+ sb.Append ("'event' ");
+
+ if ((targets & AttributeTargets.Field) != 0)
+ sb.Append ("'field' ");
+
+ if ((targets & AttributeTargets.Interface) != 0)
+ sb.Append ("'interface' ");
+
+ if ((targets & AttributeTargets.Method) != 0)
+ sb.Append ("'method' ");
+
+ if ((targets & AttributeTargets.Module) != 0)
+ sb.Append ("'module' ");
+
+ if ((targets & AttributeTargets.Parameter) != 0)
+ sb.Append ("'parameter' ");
+
+ if ((targets & AttributeTargets.Property) != 0)
+ sb.Append ("'property' ");
+
+ if ((targets & AttributeTargets.ReturnValue) != 0)
+ sb.Append ("'return value' ");
+
+ if ((targets & AttributeTargets.Struct) != 0)
+ sb.Append ("'struct' ");
+
+ return sb.ToString ();
+
+ }
+
+ public static void error592 (Attribute a, Location loc)
+ {
+ Report.Error (
+ 592, loc, "Attribute '" + a.Name +
+ "' is not valid on this declaration type. " +
+ "It is valid on " + GetValidPlaces (a) + "declarations only.");
+ }
+
+ public static bool CheckAttribute (Attribute a, object element)
+ {
+ TypeContainer attr = TypeManager.LookupAttr (a.Type);
+ AttributeTargets targets = 0;
+
+
+ if (attr == null) {
+
+ System.Attribute [] attrs = null;
+
+ try {
+ attrs = System.Attribute.GetCustomAttributes (a.Type);
+
+ } catch {
+ Report.Error (-20, a.Location, "Cannot find attribute type " + a.Name +
+ " (maybe you forgot to set the usage using the" +
+ " AttributeUsage attribute ?).");
+ return false;
+ }
+
+ foreach (System.Attribute tmp in attrs)
+ if (tmp is AttributeUsageAttribute)
+ targets = ((AttributeUsageAttribute) tmp).ValidOn;
+ } else
+ targets = attr.Targets;
+
+ if (element is Class) {
+ if ((targets & AttributeTargets.Class) != 0)
+ return true;
+ else
+ return false;
+
+ } else if (element is Struct) {
+ if ((targets & AttributeTargets.Struct) != 0)
+ return true;
+ else
+ return false;
+ } else if (element is Constructor) {
+ if ((targets & AttributeTargets.Constructor) != 0)
+ return true;
+ else
+ return false;
+ } else if (element is Delegate) {
+ if ((targets & AttributeTargets.Delegate) != 0)
+ return true;
+ else
+ return false;
+ } else if (element is Enum) {
+ if ((targets & AttributeTargets.Enum) != 0)
+ return true;
+ else
+ return false;
+ } else if (element is Event) {
+ if ((targets & AttributeTargets.Event) != 0)
+ return true;
+ else
+ return false;
+ } else if (element is Field) {
+ if ((targets & AttributeTargets.Field) != 0)
+ return true;
+ else
+ return false;
+ } else if (element is Interface) {
+ if ((targets & AttributeTargets.Interface) != 0)
+ return true;
+ else
+ return false;
+ } else if (element is Method || element is Operator) {
+ if ((targets & AttributeTargets.Method) != 0)
+ return true;
+ else
+ return false;
+ } else if (element is ParameterBuilder) {
+ if ((targets & AttributeTargets.Parameter) != 0)
+ return true;
+ else
+ return false;
+ } else if (element is Property) {
+ if ((targets & AttributeTargets.Property) != 0)
+ return true;
+ else
+ return false;
+ } else if (element is AssemblyBuilder){
+ if ((targets & AttributeTargets.Assembly) != 0)
+ return true;
+ else
+ return false;
+ }
+
+ return false;
+ }
+
+ public static void ApplyAttributes (EmitContext ec, object builder, object kind,
+ Attributes opt_attrs, Location loc)
+ {
+ if (opt_attrs == null)
+ return;
+
+ if (opt_attrs.AttributeSections == null)
+ return;
+
+ foreach (AttributeSection asec in opt_attrs.AttributeSections) {
+
+ if (asec.Attributes == null)
+ continue;
+
+ if (asec.Target == "assembly" && !(builder is AssemblyBuilder))
+ continue;
+
+ foreach (Attribute a in asec.Attributes) {
+ CustomAttributeBuilder cb = a.Resolve (ec);
+
+ if (cb == null)
+ continue;
+
+ if (!(kind is TypeContainer))
+ if (!CheckAttribute (a, kind)) {
+ error592 (a, loc);
+ return;
+ }
+
+ if (kind is Method || kind is Operator) {
+
+ if (a.Type == TypeManager.methodimpl_attr_type) {
+ if (a.ImplOptions == MethodImplOptions.InternalCall)
+ ((MethodBuilder) builder).SetImplementationFlags (
+ MethodImplAttributes.InternalCall |
+ MethodImplAttributes.Runtime);
+ } else if (a.Type != TypeManager.dllimport_type)
+ ((MethodBuilder) builder).SetCustomAttribute (cb);
+
+ } else if (kind is Constructor) {
+ ((ConstructorBuilder) builder).SetCustomAttribute (cb);
+ } else if (kind is Field) {
+ ((FieldBuilder) builder).SetCustomAttribute (cb);
+ } else if (kind is Property || kind is Indexer) {
+ ((PropertyBuilder) builder).SetCustomAttribute (cb);
+ } else if (kind is Event) {
+ ((EventBuilder) builder).SetCustomAttribute (cb);
+ } else if (kind is ParameterBuilder) {
+
+ if (a.Type == TypeManager.marshal_as_attr_type) {
+ UnmanagedMarshal marshal =
+ UnmanagedMarshal.DefineUnmanagedMarshal (a.UnmanagedType);
+
+ ((ParameterBuilder) builder).SetMarshal (marshal);
+ } else
+ ((ParameterBuilder) builder).SetCustomAttribute (cb);
+
+ } else if (kind is Enum) {
+ ((TypeBuilder) builder).SetCustomAttribute (cb);
+
+ } else if (kind is TypeContainer) {
+ TypeContainer tc = (TypeContainer) kind;
+
+ if (a.UsageAttr) {
+ tc.Targets = a.Targets;
+ tc.AllowMultiple = a.AllowMultiple;
+ tc.Inherited = a.Inherited;
+
+ } else if (a.Type == TypeManager.default_member_type) {
+ if (tc.Indexers != null) {
+ Report.Error (646, loc,
+ "Cannot specify the DefaultMember attribute on" +
+ " a type containing an indexer");
+ return;
+ }
+
+ } else {
+ if (!CheckAttribute (a, kind)) {
+ error592 (a, loc);
+ return;
+ }
+ }
+
+ ((TypeBuilder) builder).SetCustomAttribute (cb);
+
+ } else if (kind is AssemblyBuilder){
+ ((AssemblyBuilder) builder).SetCustomAttribute (cb);
+ } else if (kind is ModuleBuilder) {
+ ((ModuleBuilder) builder).SetCustomAttribute (cb);
+ } else
+ throw new Exception ("Unknown kind: " + kind);
+ }
+ }
+ }
+
+ public MethodBuilder DefinePInvokeMethod (EmitContext ec, TypeBuilder builder, string name,
+ MethodAttributes flags, Type ret_type, Type [] param_types)
+ {
+ //
+ // We extract from the attribute the information we need
+ //
+
+ if (Arguments == null) {
+ Console.WriteLine ("Internal error : this is not supposed to happen !");
+ return null;
+ }
+
+ string attr_name = Name;
+
+ if (Name.IndexOf ("Attribute") == -1)
+ attr_name = Name + "Attribute";
+ else if (Name.LastIndexOf ("Attribute") == 0)
+ attr_name = Name + "Attribute";
+
+ Type = RootContext.LookupType (ec.DeclSpace, attr_name, false, Location);
+
+ if (Type == null) {
+ Report.Error (246, Location, "Could not find attribute '" + Name + "' (are you" +
+ " missing a using directive or an assembly reference ?)");
+ return null;
+ }
+
+ ArrayList named_args = new ArrayList ();
+
+ ArrayList pos_args = (ArrayList) Arguments [0];
+ if (Arguments.Count > 1)
+ named_args = (ArrayList) Arguments [1];
+
+
+ string dll_name = null;
+
+ Argument tmp = (Argument) pos_args [0];
+
+ if (!tmp.Resolve (ec, Location))
+ return null;
+
+ if (tmp.Expr is Constant)
+ dll_name = (string) ((Constant) tmp.Expr).GetValue ();
+ else {
+ error182 ();
+ return null;
+ }
+
+ // Now we process the named arguments
+ CallingConvention cc = CallingConvention.Winapi;
+ CharSet charset = CharSet.Ansi;
+ bool preserve_sig = true;
+ bool exact_spelling = false;
+ bool set_last_err = false;
+ string entry_point = null;
+
+ for (int i = 0; i < named_args.Count; i++) {
+
+ DictionaryEntry de = (DictionaryEntry) named_args [i];
+
+ string member_name = (string) de.Key;
+ Argument a = (Argument) de.Value;
+
+ if (!a.Resolve (ec, Location))
+ return null;
+
+ Expression member = Expression.MemberLookup (
+ ec, Type, member_name,
+ MemberTypes.Field | MemberTypes.Property,
+ BindingFlags.Public | BindingFlags.Instance,
+ Location);
+
+ if (member == null || !(member is FieldExpr)) {
+ error617 (member_name);
+ return null;
+ }
+
+ if (member is FieldExpr) {
+ FieldExpr fe = (FieldExpr) member;
+ FieldInfo fi = fe.FieldInfo;
+
+ if (fi.IsInitOnly) {
+ error617 (member_name);
+ return null;
+ }
+
+ if (a.Expr is Constant) {
+ Constant c = (Constant) a.Expr;
+
+ if (member_name == "CallingConvention")
+ cc = (CallingConvention) c.GetValue ();
+ else if (member_name == "CharSet")
+ charset = (CharSet) c.GetValue ();
+ else if (member_name == "EntryPoint")
+ entry_point = (string) c.GetValue ();
+ else if (member_name == "SetLastError")
+ set_last_err = (bool) c.GetValue ();
+ else if (member_name == "ExactSpelling")
+ exact_spelling = (bool) c.GetValue ();
+ else if (member_name == "PreserveSig")
+ preserve_sig = (bool) c.GetValue ();
+ } else {
+ error182 ();
+ return null;
+ }
+
+ }
+ }
+
+ MethodBuilder mb = builder.DefinePInvokeMethod (
+ name, dll_name, flags | MethodAttributes.HideBySig,
+ CallingConventions.Standard,
+ ret_type,
+ param_types,
+ cc,
+ charset);
+
+ if (preserve_sig)
+ mb.SetImplementationFlags (MethodImplAttributes.PreserveSig);
+
+ return mb;
+ }
+
+ }
+
+ public class AttributeSection {
+
+ public readonly string Target;
+ public readonly ArrayList Attributes;
+
+ public AttributeSection (string target, ArrayList attrs)
+ {
+ Target = target;
+ Attributes = attrs;
+ }
+
+ }
+
+ public class Attributes {
+ public ArrayList AttributeSections;
+ public Location Location;
+
+ public Attributes (AttributeSection a, Location loc)
+ {
+ AttributeSections = new ArrayList ();
+ AttributeSections.Add (a);
+
+ }
+
+ public void AddAttribute (AttributeSection a)
+ {
+ if (a != null)
+ AttributeSections.Add (a);
+ }
+ }
+}
diff --git a/mcs/mcs/cfold.cs b/mcs/mcs/cfold.cs
new file mode 100755
index 00000000000..e12bc6ef8fa
--- /dev/null
+++ b/mcs/mcs/cfold.cs
@@ -0,0 +1,1002 @@
+//
+// cfold.cs: Constant Folding
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2002 Ximian, Inc.
+//
+
+using System;
+
+namespace Mono.CSharp {
+
+ public class ConstantFold {
+
+ //
+ // Performs the numeric promotions on the left and right expresions
+ // and desposits the results on `lc' and `rc'.
+ //
+ // On success, the types of `lc' and `rc' on output will always match,
+ // and the pair will be one of:
+ //
+ // (double, double)
+ // (float, float)
+ // (ulong, ulong)
+ // (long, long)
+ // (uint, uint)
+ // (int, int)
+ //
+ static void DoConstantNumericPromotions (Binary.Operator oper,
+ ref Constant left, ref Constant right,
+ Location loc)
+ {
+ if (left is DoubleConstant || right is DoubleConstant){
+ //
+ // If either side is a double, convert the other to a double
+ //
+ if (!(left is DoubleConstant))
+ left = left.ToDouble (loc);
+
+ if (!(right is DoubleConstant))
+ right = right.ToDouble (loc);
+ return;
+ } else if (left is FloatConstant || right is FloatConstant) {
+ //
+ // If either side is a float, convert the other to a float
+ //
+ if (!(left is FloatConstant))
+ left = left.ToFloat (loc);
+
+ if (!(right is FloatConstant))
+ right = right.ToFloat (loc);
+; return;
+ } else if (left is ULongConstant || right is ULongConstant){
+ //
+ // If either operand is of type ulong, the other operand is
+ // converted to type ulong. or an error ocurrs if the other
+ // operand is of type sbyte, short, int or long
+ //
+ Constant match, other;
+
+ if (left is ULongConstant){
+ other = right;
+ match = left;
+ if (!(right is ULongConstant))
+ right = right.ToULong (loc);
+ } else {
+ other = left;
+ match = right;
+ left = left.ToULong (loc);
+ }
+
+#if WRONG
+ if (other is SByteConstant || other is ShortConstant ||
+ other is IntConstant || other is LongConstant){
+ Binary.Error_OperatorAmbiguous
+ (loc, oper, other.Type, match.Type);
+ left = null;
+ right = null;
+ }
+#endif
+ return;
+ } else if (left is LongConstant || right is LongConstant){
+ //
+ // If either operand is of type long, the other operand is converted
+ // to type long.
+ //
+ if (!(left is LongConstant))
+ left = left.ToLong (loc);
+ else if (!(right is LongConstant))
+ right = right.ToLong (loc);
+ return;
+ } else if (left is UIntConstant || right is UIntConstant){
+ //
+ // 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.
+ //
+ if (!(left is UIntConstant))
+ left = left.ToUInt (loc);
+ else if (!(right is UIntConstant))
+ right = right.ToUInt (loc);
+ return;
+ } else {
+ //
+ // Force conversions to int32
+ //
+ if (!(left is IntConstant))
+ left = left.ToInt (loc);
+ if (!(right is IntConstant))
+ right = right.ToInt (loc);
+ }
+ return;
+ }
+
+ static void Error_CompileTimeOverflow (Location loc)
+ {
+ Report.Error (220, loc, "The operation overflows at compile time in checked mode");
+ }
+
+ /// <summary>
+ /// Constant expression folder for binary operations.
+ ///
+ /// Returns null if the expression can not be folded.
+ /// </summary>
+ static public Expression BinaryFold (EmitContext ec, Binary.Operator oper,
+ Constant left, Constant right, Location loc)
+ {
+ Type lt = left.Type;
+ Type rt = right.Type;
+ Type result_type = null;
+ bool bool_res;
+
+ //
+ // Enumerator folding
+ //
+ if (rt == lt && left is EnumConstant)
+ result_type = lt;
+
+ switch (oper){
+ case Binary.Operator.BitwiseOr:
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ if (left is IntConstant){
+ IntConstant v;
+ int res = ((IntConstant) left).Value | ((IntConstant) right).Value;
+
+ v = new IntConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ } else if (left is UIntConstant){
+ UIntConstant v;
+ uint res = ((UIntConstant)left).Value | ((UIntConstant)right).Value;
+
+ v = new UIntConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ } else if (left is LongConstant){
+ LongConstant v;
+ long res = ((LongConstant)left).Value | ((LongConstant)right).Value;
+
+ v = new LongConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ } else if (left is ULongConstant){
+ ULongConstant v;
+ ulong res = ((ULongConstant)left).Value |
+ ((ULongConstant)right).Value;
+
+ v = new ULongConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ }
+ break;
+
+ case Binary.Operator.BitwiseAnd:
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ if (left is IntConstant){
+ IntConstant v;
+ int res = ((IntConstant) left).Value & ((IntConstant) right).Value;
+
+ v = new IntConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ } else if (left is UIntConstant){
+ UIntConstant v;
+ uint res = ((UIntConstant)left).Value & ((UIntConstant)right).Value;
+
+ v = new UIntConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ } else if (left is LongConstant){
+ LongConstant v;
+ long res = ((LongConstant)left).Value & ((LongConstant)right).Value;
+
+ v = new LongConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ } else if (left is ULongConstant){
+ ULongConstant v;
+ ulong res = ((ULongConstant)left).Value &
+ ((ULongConstant)right).Value;
+
+ v = new ULongConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ }
+ break;
+
+ case Binary.Operator.ExclusiveOr:
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ if (left is IntConstant){
+ IntConstant v;
+ int res = ((IntConstant) left).Value ^ ((IntConstant) right).Value;
+
+ v = new IntConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ } else if (left is UIntConstant){
+ UIntConstant v;
+ uint res = ((UIntConstant)left).Value ^ ((UIntConstant)right).Value;
+
+ v = new UIntConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ } else if (left is LongConstant){
+ LongConstant v;
+ long res = ((LongConstant)left).Value ^ ((LongConstant)right).Value;
+
+ v = new LongConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ } else if (left is ULongConstant){
+ ULongConstant v;
+ ulong res = ((ULongConstant)left).Value ^
+ ((ULongConstant)right).Value;
+
+ v = new ULongConstant (res);
+ if (result_type == null)
+ return v;
+ else
+ return new EnumConstant (v, result_type);
+ }
+ break;
+
+ case Binary.Operator.Addition:
+ Constant result;
+ bool left_is_string = left is StringConstant;
+ bool right_is_string = right is StringConstant;
+
+ //
+ // If both sides are strings, then concatenate, if
+ // one is a string, and the other is not, then defer
+ // to runtime concatenation
+ //
+ if (left_is_string || right_is_string){
+ if (left_is_string && right_is_string)
+ return new StringConstant (
+ ((StringConstant) left).Value +
+ ((StringConstant) right).Value);
+
+ return null;
+ }
+
+ //
+ // handle "E operator + (E x, U y)"
+ // handle "E operator + (Y y, E x)"
+ //
+ // note that E operator + (E x, E y) is invalid
+ //
+ Type wrap_as = null;
+ if (left is EnumConstant){
+ if (right is EnumConstant){
+ return null;
+ }
+ if (((EnumConstant) left).Child.Type != right.Type)
+ return null;
+
+ wrap_as = left.Type;
+ } else if (right is EnumConstant){
+ if (((EnumConstant) right).Child.Type != left.Type)
+ return null;
+ wrap_as = right.Type;
+ }
+
+ result = null;
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ try {
+ if (left is DoubleConstant){
+ double res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((DoubleConstant) left).Value +
+ ((DoubleConstant) right).Value);
+ else
+ res = unchecked (((DoubleConstant) left).Value +
+ ((DoubleConstant) right).Value);
+
+ result = new DoubleConstant (res);
+ } else if (left is FloatConstant){
+ float res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((FloatConstant) left).Value +
+ ((FloatConstant) right).Value);
+ else
+ res = unchecked (((FloatConstant) left).Value +
+ ((FloatConstant) right).Value);
+
+ result = new FloatConstant (res);
+ } else if (left is ULongConstant){
+ ulong res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((ULongConstant) left).Value +
+ ((ULongConstant) right).Value);
+ else
+ res = unchecked (((ULongConstant) left).Value +
+ ((ULongConstant) right).Value);
+
+ result = new ULongConstant (res);
+ } else if (left is LongConstant){
+ long res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((LongConstant) left).Value +
+ ((LongConstant) right).Value);
+ else
+ res = unchecked (((LongConstant) left).Value +
+ ((LongConstant) right).Value);
+
+ result = new LongConstant (res);
+ } else if (left is UIntConstant){
+ uint res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((UIntConstant) left).Value +
+ ((UIntConstant) right).Value);
+ else
+ res = unchecked (((UIntConstant) left).Value +
+ ((UIntConstant) right).Value);
+
+ result = new UIntConstant (res);
+ } else if (left is IntConstant){
+ int res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((IntConstant) left).Value +
+ ((IntConstant) right).Value);
+ else
+ res = unchecked (((IntConstant) left).Value +
+ ((IntConstant) right).Value);
+
+ result = new IntConstant (res);
+ } else {
+ throw new Exception ( "Unexepected input: " + left);
+ }
+ } catch (OverflowException){
+ Error_CompileTimeOverflow (loc);
+ }
+
+ if (wrap_as != null)
+ return new EnumConstant (result, wrap_as);
+ else
+ return result;
+
+ case Binary.Operator.Subtraction:
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ try {
+ if (left is DoubleConstant){
+ double res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((DoubleConstant) left).Value -
+ ((DoubleConstant) right).Value);
+ else
+ res = unchecked (((DoubleConstant) left).Value -
+ ((DoubleConstant) right).Value);
+
+ return new DoubleConstant (res);
+ } else if (left is FloatConstant){
+ float res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((FloatConstant) left).Value -
+ ((FloatConstant) right).Value);
+ else
+ res = unchecked (((FloatConstant) left).Value -
+ ((FloatConstant) right).Value);
+
+ return new FloatConstant (res);
+ } else if (left is ULongConstant){
+ ulong res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((ULongConstant) left).Value -
+ ((ULongConstant) right).Value);
+ else
+ res = unchecked (((ULongConstant) left).Value -
+ ((ULongConstant) right).Value);
+
+ return new ULongConstant (res);
+ } else if (left is LongConstant){
+ long res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((LongConstant) left).Value -
+ ((LongConstant) right).Value);
+ else
+ res = unchecked (((LongConstant) left).Value -
+ ((LongConstant) right).Value);
+
+ return new LongConstant (res);
+ } else if (left is UIntConstant){
+ uint res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((UIntConstant) left).Value -
+ ((UIntConstant) right).Value);
+ else
+ res = unchecked (((UIntConstant) left).Value -
+ ((UIntConstant) right).Value);
+
+ return new UIntConstant (res);
+ } else if (left is IntConstant){
+ int res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((IntConstant) left).Value -
+ ((IntConstant) right).Value);
+ else
+ res = unchecked (((IntConstant) left).Value -
+ ((IntConstant) right).Value);
+
+ return new IntConstant (res);
+ } else {
+ throw new Exception ( "Unexepected input: " + left);
+ }
+ } catch (OverflowException){
+ Error_CompileTimeOverflow (loc);
+ }
+ break;
+
+ case Binary.Operator.Multiply:
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ try {
+ if (left is DoubleConstant){
+ double res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((DoubleConstant) left).Value *
+ ((DoubleConstant) right).Value);
+ else
+ res = unchecked (((DoubleConstant) left).Value *
+ ((DoubleConstant) right).Value);
+
+ return new DoubleConstant (res);
+ } else if (left is FloatConstant){
+ float res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((FloatConstant) left).Value *
+ ((FloatConstant) right).Value);
+ else
+ res = unchecked (((FloatConstant) left).Value *
+ ((FloatConstant) right).Value);
+
+ return new FloatConstant (res);
+ } else if (left is ULongConstant){
+ ulong res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((ULongConstant) left).Value *
+ ((ULongConstant) right).Value);
+ else
+ res = unchecked (((ULongConstant) left).Value *
+ ((ULongConstant) right).Value);
+
+ return new ULongConstant (res);
+ } else if (left is LongConstant){
+ long res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((LongConstant) left).Value *
+ ((LongConstant) right).Value);
+ else
+ res = unchecked (((LongConstant) left).Value *
+ ((LongConstant) right).Value);
+
+ return new LongConstant (res);
+ } else if (left is UIntConstant){
+ uint res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((UIntConstant) left).Value *
+ ((UIntConstant) right).Value);
+ else
+ res = unchecked (((UIntConstant) left).Value *
+ ((UIntConstant) right).Value);
+
+ return new UIntConstant (res);
+ } else if (left is IntConstant){
+ int res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((IntConstant) left).Value *
+ ((IntConstant) right).Value);
+ else
+ res = unchecked (((IntConstant) left).Value *
+ ((IntConstant) right).Value);
+
+ return new IntConstant (res);
+ } else {
+ throw new Exception ( "Unexepected input: " + left);
+ }
+ } catch (OverflowException){
+ Error_CompileTimeOverflow (loc);
+ }
+ break;
+
+ case Binary.Operator.Division:
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ try {
+ if (left is DoubleConstant){
+ double res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((DoubleConstant) left).Value /
+ ((DoubleConstant) right).Value);
+ else
+ res = unchecked (((DoubleConstant) left).Value /
+ ((DoubleConstant) right).Value);
+
+ return new DoubleConstant (res);
+ } else if (left is FloatConstant){
+ float res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((FloatConstant) left).Value /
+ ((FloatConstant) right).Value);
+ else
+ res = unchecked (((FloatConstant) left).Value /
+ ((FloatConstant) right).Value);
+
+ return new FloatConstant (res);
+ } else if (left is ULongConstant){
+ ulong res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((ULongConstant) left).Value /
+ ((ULongConstant) right).Value);
+ else
+ res = unchecked (((ULongConstant) left).Value /
+ ((ULongConstant) right).Value);
+
+ return new ULongConstant (res);
+ } else if (left is LongConstant){
+ long res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((LongConstant) left).Value /
+ ((LongConstant) right).Value);
+ else
+ res = unchecked (((LongConstant) left).Value /
+ ((LongConstant) right).Value);
+
+ return new LongConstant (res);
+ } else if (left is UIntConstant){
+ uint res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((UIntConstant) left).Value /
+ ((UIntConstant) right).Value);
+ else
+ res = unchecked (((UIntConstant) left).Value /
+ ((UIntConstant) right).Value);
+
+ return new UIntConstant (res);
+ } else if (left is IntConstant){
+ int res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((IntConstant) left).Value /
+ ((IntConstant) right).Value);
+ else
+ res = unchecked (((IntConstant) left).Value /
+ ((IntConstant) right).Value);
+
+ return new IntConstant (res);
+ } else {
+ throw new Exception ( "Unexepected input: " + left);
+ }
+ } catch (OverflowException){
+ Error_CompileTimeOverflow (loc);
+
+ } catch (DivideByZeroException) {
+ Report.Error (020, loc, "Division by constant zero");
+ }
+
+ break;
+
+ case Binary.Operator.Modulus:
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ try {
+ if (left is DoubleConstant){
+ double res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((DoubleConstant) left).Value %
+ ((DoubleConstant) right).Value);
+ else
+ res = unchecked (((DoubleConstant) left).Value %
+ ((DoubleConstant) right).Value);
+
+ return new DoubleConstant (res);
+ } else if (left is FloatConstant){
+ float res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((FloatConstant) left).Value %
+ ((FloatConstant) right).Value);
+ else
+ res = unchecked (((FloatConstant) left).Value %
+ ((FloatConstant) right).Value);
+
+ return new FloatConstant (res);
+ } else if (left is ULongConstant){
+ ulong res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((ULongConstant) left).Value %
+ ((ULongConstant) right).Value);
+ else
+ res = unchecked (((ULongConstant) left).Value %
+ ((ULongConstant) right).Value);
+
+ return new ULongConstant (res);
+ } else if (left is LongConstant){
+ long res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((LongConstant) left).Value %
+ ((LongConstant) right).Value);
+ else
+ res = unchecked (((LongConstant) left).Value %
+ ((LongConstant) right).Value);
+
+ return new LongConstant (res);
+ } else if (left is UIntConstant){
+ uint res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((UIntConstant) left).Value %
+ ((UIntConstant) right).Value);
+ else
+ res = unchecked (((UIntConstant) left).Value %
+ ((UIntConstant) right).Value);
+
+ return new UIntConstant (res);
+ } else if (left is IntConstant){
+ int res;
+
+ if (ec.ConstantCheckState)
+ res = checked (((IntConstant) left).Value %
+ ((IntConstant) right).Value);
+ else
+ res = unchecked (((IntConstant) left).Value %
+ ((IntConstant) right).Value);
+
+ return new IntConstant (res);
+ } else {
+ throw new Exception ( "Unexepected input: " + left);
+ }
+ } catch (OverflowException){
+ Error_CompileTimeOverflow (loc);
+ }
+ break;
+
+ //
+ // There is no overflow checking on left shift
+ //
+ case Binary.Operator.LeftShift:
+ IntConstant ic = right.ToInt (loc);
+ if (ic == null){
+ Binary.Error_OperatorCannotBeApplied (loc, "<<", lt, rt);
+ return null;
+ }
+ int lshift_val = ic.Value;
+
+ IntConstant lic;
+ if ((lic = left.ConvertToInt ()) != null)
+ return new IntConstant (lic.Value << lshift_val);
+
+ UIntConstant luic;
+ if ((luic = left.ConvertToUInt ()) != null)
+ return new UIntConstant (luic.Value << lshift_val);
+
+ LongConstant llc;
+ if ((llc = left.ConvertToLong ()) != null)
+ return new LongConstant (llc.Value << lshift_val);
+
+ ULongConstant lulc;
+ if ((lulc = left.ConvertToULong ()) != null)
+ return new ULongConstant (lulc.Value << lshift_val);
+
+ Binary.Error_OperatorCannotBeApplied (loc, "<<", lt, rt);
+ break;
+
+ //
+ // There is no overflow checking on right shift
+ //
+ case Binary.Operator.RightShift:
+ IntConstant sic = right.ToInt (loc);
+ if (sic == null){
+ Binary.Error_OperatorCannotBeApplied (loc, ">>", lt, rt);
+ return null;
+ }
+ int rshift_val = sic.Value;
+
+ IntConstant ric;
+ if ((ric = left.ConvertToInt ()) != null)
+ return new IntConstant (ric.Value >> rshift_val);
+
+ UIntConstant ruic;
+ if ((ruic = left.ConvertToUInt ()) != null)
+ return new UIntConstant (ruic.Value >> rshift_val);
+
+ LongConstant rlc;
+ if ((rlc = left.ConvertToLong ()) != null)
+ return new LongConstant (rlc.Value >> rshift_val);
+
+ ULongConstant rulc;
+ if ((rulc = left.ConvertToULong ()) != null)
+ return new ULongConstant (rulc.Value >> rshift_val);
+
+ Binary.Error_OperatorCannotBeApplied (loc, ">>", lt, rt);
+ break;
+
+ case Binary.Operator.LogicalAnd:
+ if (left is BoolConstant && right is BoolConstant){
+ return new BoolConstant (
+ ((BoolConstant) left).Value &&
+ ((BoolConstant) right).Value);
+ }
+ break;
+
+ case Binary.Operator.LogicalOr:
+ if (left is BoolConstant && right is BoolConstant){
+ return new BoolConstant (
+ ((BoolConstant) left).Value ||
+ ((BoolConstant) right).Value);
+ }
+ break;
+
+ case Binary.Operator.Equality:
+ if (left is BoolConstant && right is BoolConstant){
+ return new BoolConstant (
+ ((BoolConstant) left).Value ==
+ ((BoolConstant) right).Value);
+
+ }
+ if (left is StringConstant && right is StringConstant){
+ return new BoolConstant (
+ ((StringConstant) left).Value ==
+ ((StringConstant) right).Value);
+
+ }
+
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ bool_res = false;
+ if (left is DoubleConstant)
+ bool_res = ((DoubleConstant) left).Value ==
+ ((DoubleConstant) right).Value;
+ else if (left is FloatConstant)
+ bool_res = ((FloatConstant) left).Value ==
+ ((FloatConstant) right).Value;
+ else if (left is ULongConstant)
+ bool_res = ((ULongConstant) left).Value ==
+ ((ULongConstant) right).Value;
+ else if (left is LongConstant)
+ bool_res = ((LongConstant) left).Value ==
+ ((LongConstant) right).Value;
+ else if (left is UIntConstant)
+ bool_res = ((UIntConstant) left).Value ==
+ ((UIntConstant) right).Value;
+ else if (left is IntConstant)
+ bool_res = ((IntConstant) left).Value ==
+ ((IntConstant) right).Value;
+ else
+ return null;
+
+ return new BoolConstant (bool_res);
+
+ case Binary.Operator.Inequality:
+ if (left is BoolConstant && right is BoolConstant){
+ return new BoolConstant (
+ ((BoolConstant) left).Value !=
+ ((BoolConstant) right).Value);
+ }
+ if (left is StringConstant && right is StringConstant){
+ return new BoolConstant (
+ ((StringConstant) left).Value !=
+ ((StringConstant) right).Value);
+
+ }
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ bool_res = false;
+ if (left is DoubleConstant)
+ bool_res = ((DoubleConstant) left).Value !=
+ ((DoubleConstant) right).Value;
+ else if (left is FloatConstant)
+ bool_res = ((FloatConstant) left).Value !=
+ ((FloatConstant) right).Value;
+ else if (left is ULongConstant)
+ bool_res = ((ULongConstant) left).Value !=
+ ((ULongConstant) right).Value;
+ else if (left is LongConstant)
+ bool_res = ((LongConstant) left).Value !=
+ ((LongConstant) right).Value;
+ else if (left is UIntConstant)
+ bool_res = ((UIntConstant) left).Value !=
+ ((UIntConstant) right).Value;
+ else if (left is IntConstant)
+ bool_res = ((IntConstant) left).Value !=
+ ((IntConstant) right).Value;
+ else
+ return null;
+
+ return new BoolConstant (bool_res);
+
+ case Binary.Operator.LessThan:
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ bool_res = false;
+ if (left is DoubleConstant)
+ bool_res = ((DoubleConstant) left).Value <
+ ((DoubleConstant) right).Value;
+ else if (left is FloatConstant)
+ bool_res = ((FloatConstant) left).Value <
+ ((FloatConstant) right).Value;
+ else if (left is ULongConstant)
+ bool_res = ((ULongConstant) left).Value <
+ ((ULongConstant) right).Value;
+ else if (left is LongConstant)
+ bool_res = ((LongConstant) left).Value <
+ ((LongConstant) right).Value;
+ else if (left is UIntConstant)
+ bool_res = ((UIntConstant) left).Value <
+ ((UIntConstant) right).Value;
+ else if (left is IntConstant)
+ bool_res = ((IntConstant) left).Value <
+ ((IntConstant) right).Value;
+ else
+ return null;
+
+ return new BoolConstant (bool_res);
+
+ case Binary.Operator.GreaterThan:
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ bool_res = false;
+ if (left is DoubleConstant)
+ bool_res = ((DoubleConstant) left).Value >
+ ((DoubleConstant) right).Value;
+ else if (left is FloatConstant)
+ bool_res = ((FloatConstant) left).Value >
+ ((FloatConstant) right).Value;
+ else if (left is ULongConstant)
+ bool_res = ((ULongConstant) left).Value >
+ ((ULongConstant) right).Value;
+ else if (left is LongConstant)
+ bool_res = ((LongConstant) left).Value >
+ ((LongConstant) right).Value;
+ else if (left is UIntConstant)
+ bool_res = ((UIntConstant) left).Value >
+ ((UIntConstant) right).Value;
+ else if (left is IntConstant)
+ bool_res = ((IntConstant) left).Value >
+ ((IntConstant) right).Value;
+ else
+ return null;
+
+ return new BoolConstant (bool_res);
+
+ case Binary.Operator.GreaterThanOrEqual:
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ bool_res = false;
+ if (left is DoubleConstant)
+ bool_res = ((DoubleConstant) left).Value >=
+ ((DoubleConstant) right).Value;
+ else if (left is FloatConstant)
+ bool_res = ((FloatConstant) left).Value >=
+ ((FloatConstant) right).Value;
+ else if (left is ULongConstant)
+ bool_res = ((ULongConstant) left).Value >=
+ ((ULongConstant) right).Value;
+ else if (left is LongConstant)
+ bool_res = ((LongConstant) left).Value >=
+ ((LongConstant) right).Value;
+ else if (left is UIntConstant)
+ bool_res = ((UIntConstant) left).Value >=
+ ((UIntConstant) right).Value;
+ else if (left is IntConstant)
+ bool_res = ((IntConstant) left).Value >=
+ ((IntConstant) right).Value;
+ else
+ return null;
+
+ return new BoolConstant (bool_res);
+
+ case Binary.Operator.LessThanOrEqual:
+ DoConstantNumericPromotions (oper, ref left, ref right, loc);
+ if (left == null || right == null)
+ return null;
+
+ bool_res = false;
+ if (left is DoubleConstant)
+ bool_res = ((DoubleConstant) left).Value <=
+ ((DoubleConstant) right).Value;
+ else if (left is FloatConstant)
+ bool_res = ((FloatConstant) left).Value <=
+ ((FloatConstant) right).Value;
+ else if (left is ULongConstant)
+ bool_res = ((ULongConstant) left).Value <=
+ ((ULongConstant) right).Value;
+ else if (left is LongConstant)
+ bool_res = ((LongConstant) left).Value <=
+ ((LongConstant) right).Value;
+ else if (left is UIntConstant)
+ bool_res = ((UIntConstant) left).Value <=
+ ((UIntConstant) right).Value;
+ else if (left is IntConstant)
+ bool_res = ((IntConstant) left).Value <=
+ ((IntConstant) right).Value;
+ else
+ return null;
+
+ return new BoolConstant (bool_res);
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/mcs/mcs/class.cs b/mcs/mcs/class.cs
index 131f29a43b7..306b775726e 100755
--- a/mcs/mcs/class.cs
+++ b/mcs/mcs/class.cs
@@ -7,30 +7,76 @@
//
// (C) 2001 Ximian, Inc (http://www.ximian.com)
//
-// TODO:
-//
-// a. Maybe keep a list of defined names in the order they
-// appeared, so we can walk things in this way to present
-// the users with errors in that order?
//
using System.Collections;
+using System.Reflection;
+using System.Reflection.Emit;
using System;
+using System.Runtime.CompilerServices;
+using System.Diagnostics.SymbolStore;
-namespace CIR {
-
+namespace Mono.CSharp {
+
+ /// <summary>
+ /// This is the base class for structs and classes.
+ /// </summary>
public class TypeContainer : DeclSpace {
- protected int mod_flags;
- Hashtable types, fields, properties;
- Hashtable enums, constants, interfaces, method_groups;
+ // Holds a list of classes and structures
+ ArrayList types;
+
+ // Holds the list of properties
+ ArrayList properties;
+
+ // Holds the list of enumerations
+ ArrayList enums;
+
+ // Holds the list of delegates
+ ArrayList delegates;
+
+ // Holds the list of constructors
+ ArrayList instance_constructors;
+
+ // Holds the list of fields
+ ArrayList fields;
+
+ // Holds a list of fields that have initializers
+ ArrayList initialized_fields;
+
+ // Holds a list of static fields that have initializers
+ ArrayList initialized_static_fields;
- ArrayList constructor_list;
+ // Holds the list of constants
+ ArrayList constants;
+
+ // Holds the list of
+ ArrayList interfaces;
+
+ // Holds order in which interfaces must be closed
+ ArrayList interface_order;
+
+ // Holds the methods.
+ ArrayList methods;
+
+ // Holds the events
+ ArrayList events;
+
+ // Holds the indexers
+ ArrayList indexers;
+
+ // Holds the operators
+ ArrayList operators;
+
+ //
+ // Pointers to the default constructor and the default static constructor
+ //
+ Constructor default_constructor;
+ Constructor default_static_constructor;
//
- // This is the namespace in which this typecontainer
- // was declared. We use this to resolve names.
+ // Whether we have seen a static constructor for this class or not
//
- CSC.Namespace my_namespace;
+ bool have_static_constructor = false;
//
// This one is computed after we can distinguish interfaces
@@ -38,15 +84,24 @@ namespace CIR {
//
string base_class_name;
- TypeContainer parent;
ArrayList type_bases;
- public TypeContainer (TypeContainer parent, string name) : base (name)
- {
- types = new Hashtable ();
- this.parent = parent;
+ // Attributes for this type
+ protected Attributes attributes;
+
+ // Information in the case we are an attribute type
+ public AttributeTargets Targets = AttributeTargets.All;
+ public bool AllowMultiple = false;
+ public bool Inherited;
+
+
+ public TypeContainer (TypeContainer parent, string name, Location l)
+ : base (parent, name, l)
+ {
string n;
+ types = new ArrayList ();
+
if (parent == null)
n = "";
else
@@ -57,7 +112,7 @@ namespace CIR {
//Console.WriteLine ("New class " + name + " inside " + n);
}
- public AdditionResult AddConstant (Constant constant)
+ public AdditionResult AddConstant (Const constant)
{
AdditionResult res;
string name = constant.Name;
@@ -66,15 +121,15 @@ namespace CIR {
return res;
if (constants == null)
- constants = new Hashtable ();
+ constants = new ArrayList ();
- constants.Add (name, constant);
+ constants.Add (constant);
DefineName (name, constant);
return AdditionResult.Success;
}
- public AdditionResult AddEnum (CIR.Enum e)
+ public AdditionResult AddEnum (Mono.CSharp.Enum e)
{
AdditionResult res;
string name = e.Name;
@@ -83,9 +138,9 @@ namespace CIR {
return res;
if (enums == null)
- enums = new Hashtable ();
+ enums = new ArrayList ();
- enums.Add (name, e);
+ enums.Add (e);
DefineName (name, e);
return AdditionResult.Success;
@@ -101,7 +156,7 @@ namespace CIR {
return res;
DefineName (name, c);
- types.Add (name, c);
+ types.Add (c);
return AdditionResult.Success;
}
@@ -115,7 +170,24 @@ namespace CIR {
return res;
DefineName (name, s);
- types.Add (name, s);
+ types.Add (s);
+
+ return AdditionResult.Success;
+ }
+
+ public AdditionResult AddDelegate (Delegate d)
+ {
+ AdditionResult res;
+ string name = d.Name;
+
+ if ((res = IsValid (name)) != AdditionResult.Success)
+ return res;
+
+ if (delegates == null)
+ delegates = new ArrayList ();
+
+ DefineName (name, d);
+ delegates.Add (d);
return AdditionResult.Success;
}
@@ -125,38 +197,47 @@ namespace CIR {
string name = method.Name;
Object value = defined_names [name];
- if (value != null && (!(value is MethodGroup)))
+ if (value != null && (!(value is Method)))
return AdditionResult.NameExists;
- if (method_groups == null)
- method_groups = new Hashtable ();
+ if (methods == null)
+ methods = new ArrayList ();
- MethodGroup mg = (MethodGroup) method_groups [name];
- if (mg == null){
- mg = new MethodGroup (name);
+ methods.Add (method);
+ if (value != null)
+ DefineName (name, method);
- mg.Add (method);
- method_groups.Add (name, mg);
-
- return AdditionResult.Success;
- }
- mg.Add (method);
-
- if (value == null)
- DefineName (name, mg);
-
return AdditionResult.Success;
}
public AdditionResult AddConstructor (Constructor c)
{
- if (c.Name != Basename)
+ if (c.Name != Basename)
return AdditionResult.NotAConstructor;
+
+ bool is_static = (c.ModFlags & Modifiers.STATIC) != 0;
- if (constructor_list == null)
- constructor_list = new ArrayList ();
+ if (is_static){
+ have_static_constructor = true;
+ if (default_static_constructor != null){
+ Console.WriteLine ("I have a static constructor already");
+ Console.WriteLine (" " + default_static_constructor);
+ return AdditionResult.MethodExists;
+ }
- constructor_list.Add (c);
+ default_static_constructor = c;
+ } else {
+ if (c.IsDefault ()){
+ if (default_constructor != null)
+ return AdditionResult.MethodExists;
+ default_constructor = c;
+ }
+
+ if (instance_constructors == null)
+ instance_constructors = new ArrayList ();
+
+ instance_constructors.Add (c);
+ }
return AdditionResult.Success;
}
@@ -170,8 +251,8 @@ namespace CIR {
return res;
if (interfaces == null)
- interfaces = new Hashtable ();
- interfaces.Add (name, iface);
+ interfaces = new ArrayList ();
+ interfaces.Add (iface);
DefineName (name, iface);
return AdditionResult.Success;
@@ -186,9 +267,30 @@ namespace CIR {
return res;
if (fields == null)
- fields = new Hashtable ();
+ fields = new ArrayList ();
+
+ fields.Add (field);
+
+ if (field.Initializer != null){
+ if ((field.ModFlags & Modifiers.STATIC) != 0){
+ if (initialized_static_fields == null)
+ initialized_static_fields = new ArrayList ();
- fields.Add (name, field);
+ initialized_static_fields.Add (field);
+
+ //
+ // We have not seen a static constructor,
+ // but we will provide static initialization of fields
+ //
+ have_static_constructor = true;
+ } else {
+ if (initialized_fields == null)
+ initialized_fields = new ArrayList ();
+
+ initialized_fields.Add (field);
+ }
+ }
+
DefineName (name, field);
return AdditionResult.Success;
}
@@ -202,54 +304,83 @@ namespace CIR {
return res;
if (properties == null)
- properties = new Hashtable ();
+ properties = new ArrayList ();
- properties.Add (name, prop);
+ properties.Add (prop);
DefineName (name, prop);
return AdditionResult.Success;
}
-
- public Constant GetConstant (string name) {
- return (Constant) constants [name];
+
+ public AdditionResult AddEvent (Event e)
+ {
+ AdditionResult res;
+ string name = e.Name;
+
+ if ((res = IsValid (name)) != AdditionResult.Success)
+ return res;
+
+ if (events == null)
+ events = new ArrayList ();
+
+ events.Add (e);
+ DefineName (name, e);
+
+ return AdditionResult.Success;
}
-
- public TypeContainer Parent {
- get {
- return parent;
- }
+
+ public AdditionResult AddIndexer (Indexer i)
+ {
+ if (indexers == null)
+ indexers = new ArrayList ();
+
+ indexers.Add (i);
+
+ return AdditionResult.Success;
+ }
+
+ public AdditionResult AddOperator (Operator op)
+ {
+ if (operators == null)
+ operators = new ArrayList ();
+
+ operators.Add (op);
+
+ return AdditionResult.Success;
}
- public Hashtable Types {
+ public void RegisterOrder (Interface iface)
+ {
+ if (interface_order == null)
+ interface_order = new ArrayList ();
+
+ interface_order.Add (iface);
+ }
+
+ public ArrayList Types {
get {
return types;
}
}
- public Hashtable MethodGroups {
+ public ArrayList Methods {
get {
- return method_groups;
+ return methods;
}
}
- public Hashtable Constants {
+ public ArrayList Constants {
get {
return constants;
}
}
- public Hashtable Interfaces {
+ public ArrayList Interfaces {
get {
return interfaces;
}
}
- public int ModFlags {
- get {
- return mod_flags;
- }
- }
-
public string Base {
get {
return base_class_name;
@@ -266,180 +397,1459 @@ namespace CIR {
}
}
- public Hashtable Fields {
+ public ArrayList Fields {
get {
return fields;
}
}
- public Hashtable Constructors {
+ public ArrayList InstanceConstructors {
get {
- return null; // constructors;
+ return instance_constructors;
}
}
- public Hashtable Properties {
+ public ArrayList Properties {
get {
return properties;
}
}
- public Hashtable Enums {
+ public ArrayList Events {
+ get {
+ return events;
+ }
+ }
+
+ public ArrayList Enums {
get {
return enums;
}
}
- public CSC.Namespace Namespace {
+ public ArrayList Indexers {
get {
- return my_namespace;
+ return indexers;
}
+ }
- set {
- my_namespace = value;
+ public ArrayList Operators {
+ get {
+ return operators;
+ }
+ }
+
+ public ArrayList Delegates {
+ get {
+ return delegates;
}
}
- public int ResolveParents (Tree root)
+ public Attributes OptAttributes {
+ get {
+ return attributes;
+ }
+ }
+
+ public bool HaveStaticConstructor {
+ get {
+ return have_static_constructor;
+ }
+ }
+
+ public virtual TypeAttributes TypeAttr {
+ get {
+ return Modifiers.TypeAttr (ModFlags, this);
+ }
+ }
+
+ //
+ // Emits the instance field initializers
+ //
+ public bool EmitFieldInitializers (EmitContext ec)
{
- if (Bases == null){
- base_class_name = "System.Object";
- return 0;
+ ArrayList fields;
+ ILGenerator ig = ec.ig;
+ Expression instance_expr;
+
+ if (ec.IsStatic){
+ fields = initialized_static_fields;
+ instance_expr = null;
+ } else {
+ fields = initialized_fields;
+ instance_expr = new This (Location.Null).Resolve (ec);
}
+
+ if (fields == null)
+ return true;
- if (type_bases.Count == 0){
- base_class_name = "System.Object";
- return 0;
+ foreach (Field f in fields){
+ Object init = f.Initializer;
+
+ Expression e;
+ if (init is Expression)
+ e = (Expression) init;
+ else {
+ string base_type = f.Type.Substring (0, f.Type.IndexOf ("["));
+ string rank = f.Type.Substring (f.Type.IndexOf ("["));
+ e = new ArrayCreation (base_type, rank, (ArrayList)init, f.Location);
+ }
+
+ Location l = f.Location;
+ FieldExpr fe = new FieldExpr (f.FieldBuilder, l);
+ fe.InstanceExpression = instance_expr;
+ Assign a = new Assign (fe, e, l);
+
+ a = (Assign) a.Resolve (ec);
+ if (a == null)
+ return false;
+
+ a.EmitStatement (ec);
}
- return 0;
+ return true;
}
+
+ //
+ // Defines the default constructors
+ //
+ void DefineDefaultConstructor (bool is_static)
+ {
+ Constructor c;
+ int mods = 0;
+
+ c = new Constructor (Basename, Parameters.GetEmptyReadOnlyParameters (),
+ new ConstructorBaseInitializer (null, new Location (-1)),
+ new Location (-1));
+
+ if (is_static)
+ mods = Modifiers.STATIC;
- override public Type Define (Tree tree)
+ c.ModFlags = mods;
+
+ AddConstructor (c);
+
+ c.Block = new Block (null);
+
+ }
+
+ public void ReportStructInitializedInstanceError ()
{
- return null;
+ string n = TypeBuilder.FullName;
+
+ foreach (Field f in initialized_fields){
+ Report.Error (
+ 573, Location,
+ "`" + n + "." + f.Name + "': can not have " +
+ "instance field initializers in structs");
+ }
}
-
- public delegate void VisitContainer (TypeContainer container, object cback_data);
- void VisitTypesAt (TypeContainer root, VisitContainer visit, object cback)
+ struct TypeAndMethods {
+ public Type type;
+ public MethodInfo [] methods;
+
+ // Far from ideal, but we want to avoid creating a copy
+ // of methods above.
+ public Type [][] args;
+
+ //
+ // This flag on the method says `We found a match, but
+ // because it was private, we could not use the match
+ //
+ public bool [] found;
+ }
+
+ //
+ // This array keeps track of the pending implementations
+ //
+ TypeAndMethods [] pending_implementations;
+
+ //
+ // Returns a list of the abstract methods that are exposed by all of our
+ // parents that we must implement. Notice that this `flattens' the
+ // method search space, and takes into account overrides.
+ //
+ ArrayList GetAbstractMethods (Type t)
+ {
+ ArrayList list = null;
+ bool searching = true;
+ Type current_type = t;
+
+ do {
+ MemberInfo [] mi;
+
+ mi = FindMembers (
+ current_type, MemberTypes.Method,
+ BindingFlags.Public | BindingFlags.Instance |
+ BindingFlags.DeclaredOnly,
+ virtual_method_filter, null);
+
+ if (current_type == TypeManager.object_type)
+ searching = false;
+ else {
+ current_type = current_type.BaseType;
+ if (!current_type.IsAbstract)
+ searching = false;
+ }
+
+ if (mi == null)
+ continue;
+
+ int count = mi.Length;
+ if (count == 0)
+ continue;
+
+ if (count == 1 && !(mi [0] is MethodBase))
+ searching = false;
+ else
+ list = Expression.CopyNewMethods (list, mi);
+ } while (searching);
+
+ if (list == null)
+ return null;
+
+ for (int i = 0; i < list.Count; i++){
+ while (list.Count > i && !((MethodInfo) list [i]).IsAbstract)
+ list.RemoveAt (i);
+ }
+
+ if (list.Count == 0)
+ return null;
+
+ return list;
+ }
+
+ //
+ // Registers the required method implementations for this class
+ //
+ // Register method implementations are either abstract methods
+ // flagged as such on the base class or interface methods
+ //
+ public void RegisterRequiredImplementations ()
{
- if (root == null)
+ Type [] ifaces = TypeBuilder.GetInterfaces ();
+ Type b = TypeBuilder.BaseType;
+ int icount = 0;
+
+#if DEBUG
+ {
+ Type x = TypeBuilder;
+
+ while (x != null){
+ Type [] iff = x.GetInterfaces ();
+ Console.WriteLine ("Type: " + x.Name);
+
+ foreach (Type tt in iff){
+ Console.WriteLine (" Iface: " + tt.Name);
+ }
+ x = x.BaseType;
+ }
+ }
+#endif
+
+ icount = ifaces.Length;
+
+ //
+ // If we are implementing an abstract class, and we are not
+ // ourselves abstract, and there are abstract methods (C# allows
+ // abstract classes that have no abstract methods), then allocate
+ // one slot.
+ //
+ // We also pre-compute the methods.
+ //
+ bool implementing_abstract = (b.IsAbstract && !TypeBuilder.IsAbstract);
+ ArrayList abstract_methods = null;
+
+ if (implementing_abstract){
+ abstract_methods = GetAbstractMethods (b);
+
+ if (abstract_methods == null)
+ implementing_abstract = false;
+ }
+
+ int total = icount + (implementing_abstract ? 1 : 0);
+ if (total == 0)
return;
+
+ pending_implementations = new TypeAndMethods [total];
- foreach (DictionaryEntry de in root.Types){
- TypeContainer type = (TypeContainer) de.Value;
+ int i = 0;
+ if (ifaces != null){
+ foreach (Type t in ifaces){
+ MethodInfo [] mi;
+
+ if (t is TypeBuilder){
+ Interface iface;
+
+ iface = TypeManager.LookupInterface (t);
+
+ mi = iface.GetMethods ();
+ } else
+ mi = t.GetMethods ();
+
+ int count = mi.Length;
+ pending_implementations [i].type = t;
+ pending_implementations [i].methods = mi;
+ pending_implementations [i].args = new Type [count][];
+ pending_implementations [i].found = new bool [count];
- visit (type, cback);
- VisitTypesAt (type, visit, cback);
+ int j = 0;
+ foreach (MethodInfo m in mi){
+ Type [] types = TypeManager.GetArgumentTypes (m);
+
+ pending_implementations [i].args [j] = types;
+ j++;
+ }
+ i++;
+ }
+ }
+
+ if (abstract_methods != null){
+ int count = abstract_methods.Count;
+ pending_implementations [i].methods = new MethodInfo [count];
+
+ abstract_methods.CopyTo (pending_implementations [i].methods, 0);
+ pending_implementations [i].found = new bool [count];
+ pending_implementations [i].args = new Type [count][];
+ pending_implementations [i].type = TypeBuilder;
+
+ int j = 0;
+ foreach (MemberInfo m in abstract_methods){
+ MethodInfo mi = (MethodInfo) m;
+
+ Type [] types = TypeManager.GetArgumentTypes (mi);
+
+ pending_implementations [i].args [j] = types;
+ j++;
+ }
}
}
- // <summary>
- // Use this method to visit all the types in a type container.
- // You can use cback to pass arbitrary data to your callback.
- // </summary>
- public void VisitTypes (VisitContainer visit, object cback)
+ /// <summary>
+ /// This function computes the Base class and also the
+ /// list of interfaces that the class or struct @c implements.
+ ///
+ /// The return value is an array (might be null) of
+ /// interfaces implemented (as Types).
+ ///
+ /// The @parent argument is set to the parent object or null
+ /// if this is `System.Object'.
+ /// </summary>
+ Type [] GetClassBases (bool is_class, out Type parent, out bool error)
{
- foreach (DictionaryEntry de in types){
- TypeContainer type = (TypeContainer) de.Value;
+ ArrayList bases = Bases;
+ int count;
+ int start, j, i;
+
+ error = false;
+
+ if (is_class)
+ parent = null;
+ else
+ parent = TypeManager.value_type;
+
+ if (bases == null){
+ if (is_class){
+ if (RootContext.StdLib)
+ parent = TypeManager.object_type;
+ else if (Name != "System.Object")
+ parent = TypeManager.object_type;
+ } else {
+ //
+ // If we are compiling our runtime,
+ // and we are defining ValueType, then our
+ // parent is `System.Object'.
+ //
+ if (!RootContext.StdLib && Name == "System.ValueType")
+ parent = TypeManager.object_type;
+ }
- VisitTypesAt (type, visit, cback);
+ return null;
}
+
+ //
+ // Bases should be null if there are no bases at all
+ //
+ count = bases.Count;
+
+ if (is_class){
+ string name = (string) bases [0];
+ Type first = FindType (name);
+
+ if (first == null){
+ error = true;
+ return null;
+ }
+
+ if (first.IsClass){
+ parent = first;
+ start = 1;
+ } else {
+ parent = TypeManager.object_type;
+ start = 0;
+ }
+
+ } else {
+ start = 0;
+ }
+
+ Type [] ifaces = new Type [count-start];
- }
+ for (i = start, j = 0; i < count; i++, j++){
+ string name = (string) bases [i];
+ Type t = FindType (name);
+
+ if (t == null){
+ error = true;
+ return null;
+ }
- internal class VisitExpressions_Lambda {
- VisitExpressionRoot vb;
- object user_data;
+ if (is_class == false && !t.IsInterface){
+ Report.Error (527, "In Struct `" + Name + "', type `"+
+ name +"' is not an interface");
+ error = true;
+ return null;
+ }
+
+ if (t.IsSealed) {
+ string detail = "";
+
+ if (t.IsValueType)
+ detail = " (a class can not inherit from a struct/enum)";
+
+ Report.Error (509, "class `"+ Name +
+ "': Cannot inherit from sealed class `"+
+ bases [i]+"'"+detail);
+ error = true;
+ return null;
+ }
- void walk_arguments (ArrayList args)
- {
- if (args == null)
- return;
+ if (t.IsClass) {
+ if (parent != null){
+ Report.Error (527, "In Class `" + Name + "', type `"+
+ name+"' is not an interface");
+ error = true;
+ return null;
+ }
+ }
- int top = args.Count;
+ ifaces [j] = t;
+ }
+
+ return ifaces;
+ }
+
+ //
+ // Defines the type in the appropriate ModuleBuilder or TypeBuilder.
+ //
+ public override TypeBuilder DefineType ()
+ {
+ Type parent;
+ Type [] ifaces;
+ bool error;
+ bool is_class;
+
+ if (TypeBuilder != null)
+ return TypeBuilder;
+
+ if (InTransit)
+ return null;
+
+ InTransit = true;
+
+ if (this is Class)
+ is_class = true;
+ else
+ is_class = false;
- for (int i = 0; i < top; i++){
- Argument arg = (Argument) args [i];
+ ifaces = GetClassBases (is_class, out parent, out error);
+
+ if (error)
+ return null;
- vb (arg.Expr, user_data);
+ if (is_class && parent != null){
+ if (parent == TypeManager.enum_type ||
+ (parent == TypeManager.value_type && RootContext.StdLib) ||
+ parent == TypeManager.delegate_type ||
+ parent == TypeManager.array_type){
+ Report.Error (
+ 644, Location, "`" + Name + "' cannot inherit from " +
+ "special class `" + TypeManager.CSharpName (parent) + "'");
+ return null;
}
}
- void walk_block (Block b)
- {
+ if (!is_class && TypeManager.value_type == null)
+ throw new Exception ();
+
+ // if (parent_builder is ModuleBuilder) {
+ if (IsTopLevel){
+ ModuleBuilder builder = CodeGen.ModuleBuilder;
+
+ //
+ // Structs with no fields need to have a ".size 1"
+ // appended
+ //
+
+ if (!is_class && Fields == null)
+ TypeBuilder = builder.DefineType (Name,
+ TypeAttr,
+ parent,
+ PackingSize.Unspecified, 1);
+ else
+ //
+ // classes or structs with fields
+ //
+ TypeBuilder = builder.DefineType (Name,
+ TypeAttr,
+ parent,
+ ifaces);
+ } else {
+ TypeBuilder builder = Parent.TypeBuilder;
+
+ //
+ // Structs with no fields need to have a ".size 1"
+ // appended
+ //
+ if (!is_class && Fields == null)
+ TypeBuilder = builder.DefineNestedType (Basename,
+ TypeAttr,
+ parent,
+ PackingSize.Unspecified);
+ else {
+ //
+ // classes or structs with fields
+ //
+ TypeBuilder = builder.DefineNestedType (Basename,
+ TypeAttr,
+ parent,
+ ifaces);
+ }
+ }
+
+ TypeManager.AddUserType (Name, TypeBuilder, this);
+
+ if (parent == TypeManager.attribute_type ||
+ parent.IsSubclassOf (TypeManager.attribute_type)) {
+ RootContext.RegisterAttribute (this);
+ TypeManager.RegisterAttrType (TypeBuilder, this);
+ } else
+ RootContext.RegisterOrder (this);
+
+ if (Interfaces != null) {
+ foreach (Interface iface in Interfaces)
+ iface.DefineType ();
}
- void walk_constructor (Constructor c)
- {
- ConstructorInitializer init = c.Initializer;
+ if (Types != null) {
+ foreach (TypeContainer tc in Types)
+ tc.DefineType ();
+ }
+
+ if (Delegates != null) {
+ foreach (Delegate d in Delegates)
+ d.DefineType ();
+ }
+
+ if (Enums != null) {
+ foreach (Enum en in Enums)
+ en.DefineType ();
+ }
+
+ InTransit = false;
+ return TypeBuilder;
+ }
+
+
+ /// <summary>
+ /// Defines the MemberCore objects that are in the `list' Arraylist
+ ///
+ /// The `defined_names' array contains a list of members defined in
+ /// a base class
+ /// </summary>
+ static ArrayList remove_list = new ArrayList ();
+ void DefineMembers (ArrayList list, MemberInfo [] defined_names)
+ {
+ int idx;
+
+ remove_list.Clear ();
+
+ foreach (MemberCore mc in list){
+ if (!mc.Define (this)){
+ remove_list.Add (mc);
+ continue;
+ }
+
+ if (defined_names == null)
+ continue;
+
+ idx = Array.BinarySearch (defined_names, mc.Name, mif_compare);
- if (init != null && init.Arguments != null)
- walk_arguments (init.Arguments);
+ if (idx < 0){
+ if (RootContext.WarningLevel >= 4){
+ if ((mc.ModFlags & Modifiers.NEW) != 0)
+ Report109 (mc.Location, mc);
+ }
+ continue;
+ }
- walk_block (c.Block);
+ if (defined_names [idx] is PropertyInfo &&
+ ((mc.ModFlags & Modifiers.OVERRIDE) != 0)){
+ continue;
+ }
+
+#if WANT_TO_VERIFY_SIGNATURES_HERE
+ if (defined_names [idx] is MethodBase && mc is MethodCore){
+ MethodBase mb = (MethodBase) defined_names [idx];
+ MethodCore met = (MethodCore) mc;
+
+ if ((mb.IsVirtual || mb.IsAbstract) &&
+ (mc.ModFlags & Modifiers.OVERRIDE) != 0)
+ continue;
+
+ //
+ // FIXME: Compare the signatures here. If they differ,
+ // then: `continue;'
+ }
+#endif
+ if ((mc.ModFlags & Modifiers.NEW) == 0)
+ Report108 (mc.Location, defined_names [idx]);
}
+
+ foreach (object o in remove_list)
+ list.Remove (o);
+
+ remove_list.Clear ();
+ }
+
+ /// <summary>
+ /// Populates our TypeBuilder with fields and methods
+ /// </summary>
+ public override bool Define (TypeContainer parent)
+ {
+ MemberInfo [] defined_names = null;
- void walk_properties (Property p)
- {
+ if (RootContext.WarningLevel > 1){
+ Type ptype;
+
+ //
+ // This code throws an exception in the comparer
+ // I guess the string is not an object?
+ //
+ ptype = TypeBuilder.BaseType;
+ if (ptype != null){
+ defined_names = FindMembers (
+ ptype, MemberTypes.All & ~MemberTypes.Constructor,
+ BindingFlags.Public | BindingFlags.Instance |
+ BindingFlags.Static, null, null);
+
+ Array.Sort (defined_names, mif_compare);
+ }
}
+
+ if (constants != null)
+ DefineMembers (constants, defined_names);
- void walk_method (Method m)
- {
+ if (fields != null)
+ DefineMembers (fields, defined_names);
+
+ if (this is Class){
+ if (instance_constructors == null){
+ if (default_constructor == null)
+ DefineDefaultConstructor (false);
+ }
+
+ if (initialized_static_fields != null &&
+ default_static_constructor == null)
+ DefineDefaultConstructor (true);
}
-
- void type_walker_1 (TypeContainer type, object cback)
- {
- if (type.Fields != null){
- foreach (DictionaryEntry de in type.Fields){
- Field f = (Field) de.Value;
+
+ if (this is Struct){
+ //
+ // Structs can not have initialized instance
+ // fields
+ //
+ if (initialized_static_fields != null &&
+ default_static_constructor == null)
+ DefineDefaultConstructor (true);
+
+ if (initialized_fields != null)
+ ReportStructInitializedInstanceError ();
+ }
+
+ RegisterRequiredImplementations ();
+
+ //
+ // Constructors are not in the defined_names array
+ //
+ if (instance_constructors != null)
+ DefineMembers (instance_constructors, null);
+
+ if (default_static_constructor != null)
+ default_static_constructor.Define (this);
+
+ if (methods != null)
+ DefineMembers (methods, null);
+
+ if (properties != null)
+ DefineMembers (properties, defined_names);
+
+ if (events != null)
+ DefineMembers (events, defined_names);
+
+ if (indexers != null) {
+ foreach (Indexer i in Indexers)
+ i.Define (this);
+ }
+
+ if (operators != null)
+ DefineMembers (operators, null);
+
+ if (enums != null)
+ DefineMembers (enums, defined_names);
+
+ if (delegates != null)
+ DefineMembers (delegates, defined_names);
+
+ return true;
+ }
+
+ /// <summary>
+ /// Looks up the alias for the name
+ /// </summary>
+ public string LookupAlias (string name)
+ {
+ if (Namespace != null)
+ return Namespace.LookupAlias (name);
+ else
+ return null;
+ }
+
+ /// <summary>
+ /// This function is based by a delegate to the FindMembers routine
+ /// </summary>
+ static bool AlwaysAccept (MemberInfo m, object filterCriteria)
+ {
+ return true;
+ }
+
+ /// <summary>
+ /// This filter is used by FindMembers, and we just keep
+ /// a global for the filter to `AlwaysAccept'
+ /// </summary>
+ static MemberFilter accepting_filter;
+
+ static bool IsVirtualFilter (MemberInfo m, object filterCriteria)
+ {
+ if (!(m is MethodInfo))
+ return false;
+
+ return ((MethodInfo) m).IsVirtual;
+ }
+
+ /// <summary>
+ /// This filter is used by FindMembers, and it is used to
+ /// extract only virtual/abstract fields
+ /// </summary>
+ static MemberFilter virtual_method_filter;
+
+ /// <summary>
+ /// A member comparission method based on name only
+ /// </summary>
+ static IComparer mif_compare;
+
+ static TypeContainer ()
+ {
+ accepting_filter = new MemberFilter (AlwaysAccept);
+ virtual_method_filter = new MemberFilter (IsVirtualFilter);
+ mif_compare = new MemberInfoCompare ();
+ }
+
+ /// <summary>
+ /// This method returns the members of this type just like Type.FindMembers would
+ /// Only, we need to use this for types which are _being_ defined because MS'
+ /// implementation can't take care of that.
+ /// </summary>
+ //
+ // FIXME: return an empty static array instead of null, that cleans up
+ // some code and is consistent with some coding conventions I just found
+ // out existed ;-)
+ //
+ //
+ // Notice that in various cases we check if our field is non-null,
+ // something that would normally mean that there was a bug elsewhere.
+ //
+ // The problem happens while we are defining p-invoke methods, as those
+ // will trigger a FindMembers, but this happens before things are defined
+ //
+ // Since the whole process is a no-op, it is fine to check for null here.
+ //
+ public MemberInfo [] FindMembers (MemberTypes mt, BindingFlags bf,
+ MemberFilter filter, object criteria)
+ {
+ ArrayList members = new ArrayList ();
+ bool priv = (bf & BindingFlags.NonPublic) != 0;
+
+ priv = true;
+ if (filter == null)
+ filter = accepting_filter;
+
+ if ((mt & MemberTypes.Field) != 0) {
+ if (fields != null) {
+ foreach (Field f in fields) {
+ if ((f.ModFlags & Modifiers.PRIVATE) != 0)
+ if (!priv)
+ continue;
+
+ FieldBuilder fb = f.FieldBuilder;
+ if (fb != null && filter (fb, criteria) == true)
+ members.Add (fb);
+ }
+ }
+
+ if (constants != null) {
+ foreach (Const con in constants) {
+ if ((con.ModFlags & Modifiers.PRIVATE) != 0)
+ if (!priv)
+ continue;
+
+ FieldBuilder fb = con.FieldBuilder;
+ if (fb != null && filter (fb, criteria) == true)
+ members.Add (fb);
+ }
+ }
+ }
+
+ if ((mt & MemberTypes.Method) != 0) {
+ if (methods != null) {
+ foreach (Method m in methods) {
+ if ((m.ModFlags & Modifiers.PRIVATE) != 0)
+ if (!priv)
+ continue;
- if (f.Initializer != null){
- if (f.Initializer is Expression)
- vb ((Expression) f.Initializer, user_data);
+ MethodBuilder mb = m.MethodBuilder;
+
+ if (mb != null && filter (mb, criteria) == true)
+ members.Add (mb);
+ }
+ }
+
+ if (operators != null){
+ foreach (Operator o in operators) {
+ if ((o.ModFlags & Modifiers.PRIVATE) != 0)
+ if (!priv)
+ continue;
+
+ MethodBuilder ob = o.OperatorMethodBuilder;
+ if (ob != null && filter (ob, criteria) == true)
+ members.Add (ob);
+ }
+ }
+
+ if (properties != null){
+ foreach (Property p in properties){
+ if ((p.ModFlags & Modifiers.PRIVATE) != 0)
+ if (!priv)
+ continue;
+
+ MethodBuilder b;
+
+ b = p.GetBuilder;
+ if (b != null && filter (b, criteria) == true)
+ members.Add (b);
+
+ b = p.SetBuilder;
+ if (b != null && filter (b, criteria) == true)
+ members.Add (b);
+ }
+ }
+ }
+
+ if ((mt & MemberTypes.Event) != 0) {
+ if (events != null)
+ foreach (Event e in events) {
+ if ((e.ModFlags & Modifiers.PRIVATE) != 0)
+ if (!priv)
+ continue;
+
+ MemberInfo eb = e.EventBuilder;
+ if (eb != null && filter (eb, criteria) == true)
+ members.Add (e.EventBuilder);
+ }
+ }
+
+ if ((mt & MemberTypes.Property) != 0){
+ if (properties != null)
+ foreach (Property p in properties) {
+ if ((p.ModFlags & Modifiers.PRIVATE) != 0)
+ if (!priv)
+ continue;
+
+ MemberInfo pb = p.PropertyBuilder;
+ if (pb != null && filter (pb, criteria) == true) {
+ members.Add (p.PropertyBuilder);
}
}
+
+ if (indexers != null)
+ foreach (Indexer ix in indexers) {
+ if ((ix.ModFlags & Modifiers.PRIVATE) != 0)
+ if (!priv)
+ continue;
+
+ MemberInfo ib = ix.PropertyBuilder;
+ if (ib != null && filter (ib, criteria) == true) {
+ members.Add (ix.PropertyBuilder);
+ }
+ }
+ }
+
+ if ((mt & MemberTypes.NestedType) != 0) {
+
+ if (Types != null)
+ foreach (TypeContainer t in Types)
+ if (filter (t.TypeBuilder, criteria) == true)
+ members.Add (t.TypeBuilder);
+
+ if (Enums != null)
+ foreach (Enum en in Enums)
+ if (filter (en.TypeBuilder, criteria) == true)
+ members.Add (en.TypeBuilder);
+
+ }
+
+ if ((mt & MemberTypes.Constructor) != 0){
+ if (instance_constructors != null){
+ foreach (Constructor c in instance_constructors){
+ ConstructorBuilder cb = c.ConstructorBuilder;
+
+ if (cb != null)
+ if (filter (cb, criteria) == true)
+ members.Add (cb);
+ }
+ }
+
+ if (default_static_constructor != null){
+ ConstructorBuilder cb =
+ default_static_constructor.ConstructorBuilder;
+
+ if (filter (cb, criteria) == true)
+ members.Add (cb);
}
+ }
+
+ //
+ // Lookup members in parent if requested.
+ //
+ if ((bf & BindingFlags.DeclaredOnly) == 0){
+ MemberInfo [] mi;
+
+ mi = FindMembers (TypeBuilder.BaseType, mt, bf, filter, criteria);
+ if (mi != null)
+ members.AddRange (mi);
+ }
+
+ int count = members.Count;
+ if (count > 0){
+ MemberInfo [] mi = new MemberInfo [count];
+ members.CopyTo (mi);
+ return mi;
+ }
+
+ return null;
+ }
+
+ public MemberInfo GetFieldFromEvent (EventExpr event_expr)
+ {
+ EventInfo ei = event_expr.EventInfo;
+
+ foreach (Event e in events) {
+
+ if (e.FieldBuilder == null)
+ continue;
+
+ if (Type.FilterName (e.FieldBuilder, ei.Name))
+ return e.FieldBuilder;
+ }
- if (type.Constructors != null){
- foreach (DictionaryEntry de in type.Constructors)
- walk_constructor ((Constructor) de.Value);
+ return null;
+ }
+
+ public static MemberInfo [] FindMembers (Type t, MemberTypes mt, BindingFlags bf,
+ MemberFilter filter, object criteria)
+ {
+ TypeContainer tc = TypeManager.LookupTypeContainer (t);
+
+ if (tc != null)
+ return tc.FindMembers (mt, bf, filter, criteria);
+ else
+ return t.FindMembers (mt, bf, filter, criteria);
+ }
+
+ //
+ // FindMethods will look for methods not only in the type `t', but in
+ // any interfaces implemented by the type.
+ //
+ public static MethodInfo [] FindMethods (Type t, BindingFlags bf,
+ MemberFilter filter, object criteria)
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// Whether the specified method is an interface method implementation
+ /// </summary>
+ ///
+ /// <remarks>
+ /// If a method in Type `t' (or null to look in all interfaces
+ /// and the base abstract class) with name `Name', return type `ret_type' and
+ /// arguments `args' implements an interface, this method will
+ /// return the MethodInfo that this method implements.
+ ///
+ /// This will remove the method from the list of "pending" methods
+ /// that are required to be implemented for this class as a side effect.
+ ///
+ /// </remarks>
+ public MethodInfo IsInterfaceMethod (Type t, string Name, Type ret_type, Type [] args,
+ bool clear)
+ {
+ int arg_len = args.Length;
+
+ if (pending_implementations == null)
+ return null;
+
+ foreach (TypeAndMethods tm in pending_implementations){
+ if (!(t == null || tm.type == t))
+ continue;
+
+ int i = 0;
+ foreach (MethodInfo m in tm.methods){
+ if (m == null){
+ i++;
+ continue;
+ }
+
+ if (Name != m.Name){
+ i++;
+ continue;
+ }
+
+ if (ret_type != m.ReturnType){
+ if (!((ret_type == null && m.ReturnType == TypeManager.void_type) ||
+ (m.ReturnType == null && ret_type == TypeManager.void_type)))
+ {
+ i++;
+ continue;
+ }
+ }
+
+ //
+ // Check if we have the same parameters
+ //
+ if (tm.args [i].Length != arg_len){
+ i++;
+ continue;
+ }
+
+ int j, top = args.Length;
+ bool fail = false;
+
+ for (j = 0; j < top; j++){
+ if (tm.args [i][j] != args[j]){
+ fail = true;
+ break;
+ }
+ }
+ if (fail){
+ i++;
+ continue;
+ }
+
+ if (clear)
+ tm.methods [i] = null;
+ tm.found [i] = true;
+ return m;
}
- if (type.Properties != null){
- foreach (DictionaryEntry de in type.Properties)
- walk_properties ((Property) de.Value);
+ // If a specific type was requested, we can stop now.
+ if (tm.type == t)
+ return null;
+ }
+ return null;
+ }
+
+ /// <summary>
+ /// C# allows this kind of scenarios:
+ /// interface I { void M (); }
+ /// class X { public void M (); }
+ /// class Y : X, I { }
+ ///
+ /// For that case, we create an explicit implementation function
+ /// I.M in Y.
+ /// </summary>
+ void DefineProxy (Type iface, MethodInfo parent_method, MethodInfo iface_method,
+ Type [] args)
+ {
+ MethodBuilder proxy;
+
+ string proxy_name = iface.Name + "." + iface_method.Name;
+
+ proxy = TypeBuilder.DefineMethod (
+ proxy_name,
+ MethodAttributes.HideBySig |
+ MethodAttributes.NewSlot |
+ MethodAttributes.Virtual,
+ CallingConventions.Standard | CallingConventions.HasThis,
+ parent_method.ReturnType, args);
+
+ int top = args.Length;
+ ILGenerator ig = proxy.GetILGenerator ();
+
+ ig.Emit (OpCodes.Ldarg_0);
+ for (int i = 0; i < top; i++){
+ switch (i){
+ case 0:
+ ig.Emit (OpCodes.Ldarg_1); break;
+ case 1:
+ ig.Emit (OpCodes.Ldarg_2); break;
+ case 2:
+ ig.Emit (OpCodes.Ldarg_3); break;
+ default:
+ ig.Emit (OpCodes.Ldarg, i - 1); break;
}
+ }
+ ig.Emit (OpCodes.Call, parent_method);
+ ig.Emit (OpCodes.Ret);
+
+ TypeBuilder.DefineMethodOverride (proxy, iface_method);
+ }
+
+ /// <summary>
+ /// This function tells whether one of our parent classes implements
+ /// the given method (which turns out, it is valid to have an interface
+ /// implementation in a parent
+ /// </summary>
+ bool ParentImplements (Type iface_type, MethodInfo mi)
+ {
+ MethodSignature ms;
+
+ Type [] args = TypeManager.GetArgumentTypes (mi);
+ ms = new MethodSignature (mi.Name, mi.ReturnType, args);
+ MemberInfo [] list = FindMembers (
+ TypeBuilder.BaseType, MemberTypes.Method | MemberTypes.Property,
+ BindingFlags.Public | BindingFlags.Instance,
+ MethodSignature.method_signature_filter, ms);
- if (type.MethodGroups != null){
- foreach (DictionaryEntry de in type.MethodGroups){
- Hashtable methods = ((MethodGroup) de.Value).Methods;
- foreach (Method m in methods)
- walk_method (m);
+ if (list == null || list.Length == 0)
+ return false;
+
+ DefineProxy (iface_type, (MethodInfo) list [0], mi, args);
+ return true;
+ }
+
+ /// <summary>
+ /// Verifies that any pending abstract methods or interface methods
+ /// were implemented.
+ /// </summary>
+ bool VerifyPendingMethods ()
+ {
+ int top = pending_implementations.Length;
+ bool errors = false;
+ int i;
+
+ for (i = 0; i < top; i++){
+ Type type = pending_implementations [i].type;
+ int j = 0;
+
+ foreach (MethodInfo mi in pending_implementations [i].methods){
+ if (mi == null)
+ continue;
+
+ if (type.IsInterface){
+ if (ParentImplements (type, mi))
+ continue;
+
+ string extra = "";
+
+ if (pending_implementations [i].found [j])
+ extra = ". (method might be private or static)";
+ Report.Error (
+ 536, Location,
+ "`" + Name + "' does not implement " +
+ "interface member `" +
+ type.FullName + "." + mi.Name + "'" + extra);
+ } else {
+ Report.Error (
+ 534, Location,
+ "`" + Name + "' does not implement " +
+ "inherited abstract member `" +
+ type.FullName + "." + mi.Name + "'");
}
+ errors = true;
+ j++;
}
}
+ return errors;
+ }
+ /// <summary>
+ /// Emits the values for the constants
+ /// </summary>
+ public void EmitConstants ()
+ {
+ if (constants != null)
+ foreach (Const con in constants)
+ con.EmitConstant (this);
+ return;
+ }
+
+ /// <summary>
+ /// Emits the code, this step is performed after all
+ /// the types, enumerations, constructors
+ /// </summary>
+ public void Emit ()
+ {
+ if (instance_constructors != null)
+ foreach (Constructor c in instance_constructors)
+ c.Emit (this);
+
+ if (default_static_constructor != null)
+ default_static_constructor.Emit (this);
- internal VisitExpressions_Lambda (TypeContainer tc,
- VisitExpressionRoot vb,
- object user_data)
- {
- this.vb = vb;
- this.user_data = user_data;
+ if (methods != null)
+ foreach (Method m in methods)
+ m.Emit (this);
+
+ if (operators != null)
+ foreach (Operator o in operators)
+ o.Emit (this);
+
+ if (properties != null)
+ foreach (Property p in properties)
+ p.Emit (this);
+
+ if (indexers != null) {
+ foreach (Indexer ix in indexers)
+ ix.Emit (this);
+
+ CustomAttributeBuilder cb = Interface.EmitDefaultMemberAttr (this, ModFlags, Location);
+
+ TypeBuilder.SetCustomAttribute (cb);
+ }
+
+ if (fields != null)
+ foreach (Field f in fields)
+ f.Emit (this);
- tc.VisitTypes (new VisitContainer (type_walker_1), null);
+ if (events != null){
+ foreach (Event e in Events)
+ e.Emit (this);
}
+
+ if (pending_implementations != null)
+ if (!VerifyPendingMethods ())
+ return;
+
+ EmitContext ec = new EmitContext (
+ this, Mono.CSharp.Location.Null, null, null,
+ ModFlags);
+
+ Attribute.ApplyAttributes (ec, TypeBuilder, this, OptAttributes, Location);
+
+ //
+ // Check for internal or private fields that were never assigned
+ //
+ if (RootContext.WarningLevel >= 3){
+ foreach (Field f in fields){
+ if ((f.ModFlags & Modifiers.PUBLIC) != 0)
+ continue;
+
+ if (f.status == 0){
+ Report.Warning (
+ 169, f.Location, "Private field " +
+ MakeName (f.Name) + " is never used");
+ continue;
+ }
+
+ //
+ // Only report 649 on level 4
+ //
+ if (RootContext.WarningLevel < 4)
+ continue;
+
+ if ((f.status & Field.Status.ASSIGNED) != 0)
+ continue;
+
+ Report.Warning (
+ 649, f.Location,
+ "Field " + MakeName (f.Name) + " is never assigned " +
+ " to and will always have its default value");
+ }
+ }
+
+// if (types != null)
+// foreach (TypeContainer tc in types)
+// tc.Emit ();
}
- public delegate void VisitExpressionRoot (Expression e, object cback);
- // <summary>
- // Use this method to visit all the code blocks in a TypeContainer
- // </summary>
- public void VisitExpressionRoots (VisitExpressionRoot vb, object cback)
+ public override void CloseType ()
+ {
+ try {
+ if (!Created){
+ Created = true;
+ TypeBuilder.CreateType ();
+ }
+ } catch (TypeLoadException){
+ //
+ // This is fine, the code still created the type
+ //
+// Report.Warning (-20, "Exception while creating class: " + TypeBuilder.Name);
+// Console.WriteLine (e.Message);
+ }
+
+ if (Enums != null)
+ foreach (Enum en in Enums)
+ en.CloseType ();
+
+ if (interface_order != null){
+ foreach (Interface iface in interface_order)
+ iface.CloseType ();
+ }
+
+ if (Types != null){
+ foreach (TypeContainer tc in Types)
+ if (tc is Struct)
+ tc.CloseType ();
+
+ foreach (TypeContainer tc in Types)
+ if (!(tc is Struct))
+ tc.CloseType ();
+ }
+
+ if (Delegates != null)
+ foreach (Delegate d in Delegates)
+ d.CloseDelegate ();
+ }
+
+ public string MakeName (string n)
{
- VisitExpressions_Lambda l = new VisitExpressions_Lambda (this, vb, cback);
+ return "`" + Name + "." + n + "'";
+ }
+
+ public void Report108 (Location l, MemberInfo mi)
+ {
+ Report.Warning (
+ 108, l, "The keyword new is required on " +
+ MakeName (mi.Name) + " because it hides `" +
+ mi.ReflectedType.Name + "." + mi.Name + "'");
+ }
+
+ public void Report109 (Location l, MemberCore mc)
+ {
+ Report.Warning (
+ 109, l, "The member " + MakeName (mc.Name) + " does not hide an " +
+ "inherited member, the keyword new is not required");
+ }
+
+ public static int CheckMember (string name, MemberInfo mi, int ModFlags)
+ {
+ return 0;
+ }
+
+ //
+ // Performs the validation on a Method's modifiers (properties have
+ // the same properties).
+ //
+ public bool MethodModifiersValid (int flags, string n, Location loc)
+ {
+ const int vao = (Modifiers.VIRTUAL | Modifiers.ABSTRACT | Modifiers.OVERRIDE);
+ const int nv = (Modifiers.NEW | Modifiers.VIRTUAL);
+ bool ok = true;
+ string name = MakeName (n);
+
+ //
+ // At most one of static, virtual or override
+ //
+ if ((flags & Modifiers.STATIC) != 0){
+ if ((flags & vao) != 0){
+ Report.Error (
+ 112, loc, "static method " + name + "can not be marked " +
+ "as virtual, abstract or override");
+ ok = false;
+ }
+ }
+
+ if ((flags & Modifiers.OVERRIDE) != 0 && (flags & nv) != 0){
+ Report.Error (
+ 113, loc, name +
+ " marked as override cannot be marked as new or virtual");
+ ok = false;
+ }
+
+ //
+ // If the declaration includes the abstract modifier, then the
+ // declaration does not include static, virtual or extern
+ //
+ if ((flags & Modifiers.ABSTRACT) != 0){
+ if ((flags & Modifiers.EXTERN) != 0){
+ Report.Error (
+ 180, loc, name + " can not be both abstract and extern");
+ ok = false;
+ }
+
+ if ((flags & Modifiers.VIRTUAL) != 0){
+ Report.Error (
+ 503, loc, name + " can not be both abstract and virtual");
+ ok = false;
+ }
+
+ if ((ModFlags & Modifiers.ABSTRACT) == 0){
+ Report.Error (
+ 513, loc, name +
+ " is abstract but its container class is not");
+ ok = false;
+
+ }
+ }
+
+ if ((flags & Modifiers.PRIVATE) != 0){
+ if ((flags & vao) != 0){
+ Report.Error (
+ 621, loc, name +
+ " virtual or abstract members can not be private");
+ ok = false;
+ }
+ }
+
+ if ((flags & Modifiers.SEALED) != 0){
+ if ((flags & Modifiers.OVERRIDE) == 0){
+ Report.Error (
+ 238, loc, name +
+ " cannot be sealed because it is not an override");
+ ok = false;
+ }
+ }
+
+ return ok;
+ }
+
+ //
+ // Returns true if `type' is as accessible as the flags `flags'
+ // given for this member
+ //
+ static public bool AsAccessible (Type type, int flags)
+ {
+ return true;
+ }
+
+ Hashtable builder_and_args;
+
+ public bool RegisterMethod (MethodBuilder mb, InternalParameters ip, Type [] args)
+ {
+ if (builder_and_args == null)
+ builder_and_args = new Hashtable ();
+ return true;
}
}
@@ -454,10 +1864,11 @@ namespace CIR {
Modifiers.INTERNAL |
Modifiers.PRIVATE |
Modifiers.ABSTRACT |
- Modifiers.SEALED;
+ Modifiers.SEALED |
+ Modifiers.UNSAFE;
- public Class (TypeContainer parent, string name, int mod)
- : base (parent, name)
+ public Class (TypeContainer parent, string name, int mod, Attributes attrs, Location l)
+ : base (parent, name, l)
{
int accmods;
@@ -465,8 +1876,19 @@ namespace CIR {
accmods = Modifiers.INTERNAL;
else
accmods = Modifiers.PRIVATE;
-
- this.mod_flags = Modifiers.Check (AllowedModifiers, mod, accmods);
+
+ this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
+ this.attributes = attrs;
+ }
+
+ //
+ // FIXME: How do we deal with the user specifying a different
+ // layout?
+ //
+ public override TypeAttributes TypeAttr {
+ get {
+ return base.TypeAttr | TypeAttributes.AutoLayout | TypeAttributes.Class;
+ }
}
}
@@ -475,14 +1897,15 @@ namespace CIR {
// Modifiers allowed in a struct declaration
// </summary>
public const int AllowedModifiers =
- Modifiers.NEW |
- Modifiers.PUBLIC |
+ Modifiers.NEW |
+ Modifiers.PUBLIC |
Modifiers.PROTECTED |
- Modifiers.INTERNAL |
+ Modifiers.INTERNAL |
+ Modifiers.UNSAFE |
Modifiers.PRIVATE;
- public Struct (TypeContainer parent, string name, int mod)
- : base (parent, name)
+ public Struct (TypeContainer parent, string name, int mod, Attributes attrs, Location l)
+ : base (parent, name, l)
{
int accmods;
@@ -491,92 +1914,160 @@ namespace CIR {
else
accmods = Modifiers.PRIVATE;
- this.mod_flags = Modifiers.Check (AllowedModifiers, mod, accmods);
+ this.ModFlags = Modifiers.Check (AllowedModifiers, mod, accmods, l);
+
+ this.ModFlags |= Modifiers.SEALED;
+ this.attributes = attrs;
+
}
- }
- public class Method {
- Parameters parameters;
- TypeRef return_typeref;
- string name;
- int modifiers;
- Block block;
+ //
+ // FIXME: Allow the user to specify a different set of attributes
+ // in some cases (Sealed for example is mandatory for a class,
+ // but what SequentialLayout can be changed
+ //
+ public override TypeAttributes TypeAttr {
+ get {
+ return base.TypeAttr |
+ TypeAttributes.SequentialLayout |
+ TypeAttributes.Sealed |
+ TypeAttributes.BeforeFieldInit;
+ }
+ }
+ }
- // return_type can be "null" for VOID values.
- public Method (TypeRef return_typeref, int mod, string name, Parameters parameters)
+ public abstract class MethodCore : MemberCore {
+ public readonly Parameters Parameters;
+ Block block;
+
+ //
+ // Parameters, cached for semantic analysis.
+ //
+ InternalParameters parameter_info;
+
+ public MethodCore (string name, Parameters parameters, Location l)
+ : base (name, l)
{
- this.return_typeref = return_typeref;
- this.name = name;
- this.parameters = parameters;
- this.modifiers = Modifiers.Check (AllowedModifiers, mod, Modifiers.PRIVATE);
+ Name = name;
+ Parameters = parameters;
}
+
+ //
+ // Returns the System.Type array for the parameters of this method
+ //
+ Type [] parameter_types;
+ public Type [] ParameterTypes (TypeContainer parent)
+ {
+ if (Parameters == null)
+ return TypeManager.NoTypes;
+
+ if (parameter_types == null)
+ parameter_types = Parameters.GetParameterInfo (parent);
- // <summary>
- // Modifiers allowed in a class declaration
- // </summary>
- const int AllowedModifiers =
- Modifiers.NEW |
- Modifiers.PUBLIC |
- Modifiers.PROTECTED |
- Modifiers.INTERNAL |
- Modifiers.PRIVATE |
- Modifiers.STATIC |
- Modifiers.VIRTUAL |
- Modifiers.SEALED |
- Modifiers.OVERRIDE |
- Modifiers.ABSTRACT |
- Modifiers.EXTERN;
+ return parameter_types;
+ }
- public Block Block {
+ public InternalParameters ParameterInfo
+ {
get {
- return block;
+ return parameter_info;
}
set {
- block = value;
+ parameter_info = value;
}
}
-
- public string Name {
+
+ public Block Block {
get {
- return name;
+ return block;
}
- }
- public int ModFlags {
- get {
- return modifiers;
+ set {
+ block = value;
}
}
- public Parameters Parameters {
- get {
- return parameters;
- }
+ public CallingConventions GetCallingConvention (bool is_class)
+ {
+ CallingConventions cc = 0;
+
+ cc = Parameters.GetCallingConvention ();
+
+ if (is_class)
+ if ((ModFlags & Modifiers.STATIC) == 0)
+ cc |= CallingConventions.HasThis;
+
+ // FIXME: How is `ExplicitThis' used in C#?
+
+ return cc;
}
- public Type ReturnType {
- get {
- return return_typeref.Type;
+ public void LabelParameters (EmitContext ec, Type [] parameters, MethodBase builder)
+ {
+ //
+ // Define each type attribute (in/out/ref) and
+ // the argument names.
+ //
+ Parameter [] p = Parameters.FixedParameters;
+ int i = 0;
+
+ MethodBuilder mb = null;
+ ConstructorBuilder cb = null;
+
+ if (builder is MethodBuilder)
+ mb = (MethodBuilder) builder;
+ else
+ cb = (ConstructorBuilder) builder;
+
+ if (p != null){
+ for (i = 0; i < p.Length; i++) {
+ ParameterBuilder pb;
+
+ if (mb == null)
+ pb = cb.DefineParameter (
+ i + 1, p [i].Attributes, p [i].Name);
+ else
+ pb = mb.DefineParameter (
+ i + 1, p [i].Attributes, p [i].Name);
+
+ Attributes attr = p [i].OptAttributes;
+ if (attr != null)
+ Attribute.ApplyAttributes (ec, pb, pb, attr, Location);
+ }
}
- }
- public string ArgumentSignature {
- get {
- return ""; // TYPEFIX: Type.MakeParameterSignature (name, parameters);
+ if (Parameters.ArrayParameter != null){
+ ParameterBuilder pb;
+ Parameter array_param = Parameters.ArrayParameter;
+
+ if (mb == null)
+ pb = cb.DefineParameter (
+ i + 1, array_param.Attributes,
+ array_param.Name);
+ else
+ pb = mb.DefineParameter (
+ i + 1, array_param.Attributes,
+ array_param.Name);
+
+ CustomAttributeBuilder a = new CustomAttributeBuilder (
+ TypeManager.cons_param_array_attribute, new object [0]);
+
+ pb.SetCustomAttribute (a);
}
}
}
+
+ public class Method : MethodCore {
+ public readonly string ReturnType;
+ public MethodBuilder MethodBuilder;
+ public readonly Attributes OptAttributes;
- public class Field {
- Type type;
- Object expr_or_array_init;
- string name;
- int modifiers;
-
- // <summary>
- // Modifiers allowed in a class declaration
- // </summary>
+ MethodAttributes flags;
+
+ /// <summary>
+ /// Modifiers allowed in a class declaration
+ /// </summary>
const int AllowedModifiers =
Modifiers.NEW |
Modifiers.PUBLIC |
@@ -584,47 +2075,404 @@ namespace CIR {
Modifiers.INTERNAL |
Modifiers.PRIVATE |
Modifiers.STATIC |
- Modifiers.READONLY;
+ Modifiers.VIRTUAL |
+ Modifiers.SEALED |
+ Modifiers.OVERRIDE |
+ Modifiers.ABSTRACT |
+ Modifiers.UNSAFE |
+ Modifiers.EXTERN;
- public Field (TypeRef typeref, int mod, string name, Object expr_or_array_init)
+ //
+ // return_type can be "null" for VOID values.
+ //
+ public Method (string return_type, int mod, string name, Parameters parameters,
+ Attributes attrs, Location l)
+ : base (name, parameters, l)
{
- this.type = type;
- this.modifiers = Modifiers.Check (AllowedModifiers, mod, Modifiers.PRIVATE);
- this.name = name;
- this.expr_or_array_init = expr_or_array_init;
+ ReturnType = return_type;
+ ModFlags = Modifiers.Check (AllowedModifiers, mod, Modifiers.PRIVATE, l);
+ OptAttributes = attrs;
}
- public Type Type {
- get {
- return type;
- }
+ //
+ // Returns the `System.Type' for the ReturnType of this
+ // function. Provides a nice cache. (used between semantic analysis
+ // and actual code generation
+ //
+ Type type_return_type;
+
+ public Type GetReturnType (TypeContainer parent)
+ {
+ if (type_return_type == null)
+ type_return_type = RootContext.LookupType (
+ parent, ReturnType, false, Location);
+
+ return type_return_type;
}
- public object Initializer {
- get {
- return expr_or_array_init;
+ void DuplicatEntryPoint (MethodInfo b)
+ {
+ Report.Error (
+ 17, Location,
+ "Program `" + CodeGen.FileName +
+ "' has more than one entry point defined: `" +
+ b.DeclaringType.Name + "." + b.Name + "'");
+ }
+
+ //
+ // Creates the type
+ //
+ public override bool Define (TypeContainer parent)
+ {
+ Type ret_type = GetReturnType (parent);
+ Type [] parameters = ParameterTypes (parent);
+ bool error = false;
+ MethodInfo implementing;
+ Type iface_type = null;
+ string iface = "", short_name;
+ bool explicit_impl = false;
+
+ // Check if the return type and arguments were correct
+ if (ret_type == null || parameters == null)
+ return false;
+
+ if (!parent.MethodModifiersValid (ModFlags, Name, Location))
+ return false;
+
+ flags = Modifiers.MethodAttr (ModFlags);
+
+ //
+ // verify accessibility
+ //
+ if (!TypeContainer.AsAccessible (ret_type, ModFlags))
+ return false;
+
+ if (ret_type.IsPointer && !UnsafeOK (parent))
+ return false;
+
+ foreach (Type partype in parameters){
+ if (!TypeContainer.AsAccessible (partype, ModFlags))
+ error = true;
+ if (partype.IsPointer && !UnsafeOK (parent))
+ error = true;
+ }
+
+ if (error)
+ return false;
+
+ //
+ // Verify if the parent has a type with the same name, and then
+ // check whether we have to create a new slot for it or not.
+ //
+ Type ptype = parent.TypeBuilder.BaseType;
+
+ // ptype is only null for System.Object while compiling corlib.
+ if (ptype != null){
+ MethodSignature ms = new MethodSignature (Name, ret_type, parameters);
+ MemberInfo [] mi, mi_static, mi_instance;
+
+ mi_static = TypeContainer.FindMembers (
+ ptype, MemberTypes.Method,
+ BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static,
+ MethodSignature.inheritable_method_signature_filter, ms);
+
+ mi_instance = TypeContainer.FindMembers (
+ ptype, MemberTypes.Method,
+ BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance,
+ MethodSignature.inheritable_method_signature_filter,
+ ms);
+
+ if (mi_instance != null && mi_instance.Length > 0){
+ mi = mi_instance;
+ } else if (mi_static != null && mi_static.Length > 0)
+ mi = mi_static;
+ else
+ mi = null;
+
+ if (mi != null && mi.Length > 0){
+ if (!CheckMethodAgainstBase (parent, flags, (MethodInfo) mi [0])){
+ return false;
+ }
+ } else {
+ if ((ModFlags & Modifiers.NEW) != 0)
+ WarningNotHiding (parent);
+
+ if ((ModFlags & Modifiers.OVERRIDE) != 0){
+ Report.Error (115, Location,
+ parent.MakeName (Name) +
+ " no suitable methods found to override");
+ }
+ }
+ } else if ((ModFlags & Modifiers.NEW) != 0)
+ WarningNotHiding (parent);
+
+ //
+ // If we implement an interface, extract the interface name.
+ //
+
+ if (Name.IndexOf (".") != -1){
+ int pos = Name.LastIndexOf (".");
+ iface = Name.Substring (0, pos);
+
+ iface_type = RootContext.LookupType (parent, iface, false, Location);
+ short_name = Name.Substring (pos + 1);
+
+ if (iface_type == null)
+ return false;
+
+ // Compute the full name that we need to export
+ Name = iface_type.FullName + "." + short_name;
+ explicit_impl = true;
+ } else
+ short_name = Name;
+
+ //
+ // Check if we are an implementation of an interface method or
+ // a method
+ //
+ implementing = parent.IsInterfaceMethod (
+ iface_type, short_name, ret_type, parameters, false);
+
+ //
+ // For implicit implementations, make sure we are public, for
+ // explicit implementations, make sure we are private.
+ //
+ if (implementing != null){
+ //
+ // Setting null inside this block will trigger a more
+ // verbose error reporting for missing interface implementations
+ //
+ // The "candidate" function has been flagged already
+ // but it wont get cleared
+ //
+ if (iface_type == null){
+ //
+ // We already catch different accessibility settings
+ // so we just need to check that we are not private
+ //
+ if ((ModFlags & Modifiers.PRIVATE) != 0)
+ implementing = null;
+
+ //
+ // Static is not allowed
+ //
+ if ((ModFlags & Modifiers.STATIC) != 0)
+ implementing = null;
+ } else {
+ if ((ModFlags & (Modifiers.PUBLIC | Modifiers.ABSTRACT)) != 0){
+ Report.Error (
+ 106, Location, "`public' or `abstract' modifiers "+
+ "are not allowed in explicit interface declarations"
+ );
+ implementing = null;
+ }
+ }
+ }
+
+ //
+ // If implementing is still valid, set flags
+ //
+ if (implementing != null){
+ if (implementing.DeclaringType.IsInterface)
+ flags |= MethodAttributes.NewSlot;
+
+ flags |=
+ MethodAttributes.Virtual |
+ MethodAttributes.HideBySig;
+
+ //
+ // clear the flag
+ //
+ parent.IsInterfaceMethod (
+ iface_type, short_name, ret_type, parameters, true);
+ }
+
+ Attribute dllimport_attr = null;
+ if (OptAttributes != null && OptAttributes.AttributeSections != null) {
+ foreach (AttributeSection asec in OptAttributes.AttributeSections) {
+ if (asec.Attributes == null)
+ continue;
+
+ foreach (Attribute a in asec.Attributes)
+ if (a.Name.IndexOf ("DllImport") != -1) {
+ flags |= MethodAttributes.PinvokeImpl;
+ dllimport_attr = a;
+ }
+ }
+ }
+
+ //
+ // Finally, define the method
+ //
+
+ if ((flags & MethodAttributes.PinvokeImpl) != 0) {
+
+ if ((ModFlags & Modifiers.STATIC) == 0) {
+ Report.Error (601, Location, "The DllImport attribute must be specified on " +
+ "a method marked 'static' and 'extern'.");
+ return false;
+ }
+
+ EmitContext ec = new EmitContext (
+ parent, Location, null, GetReturnType (parent), ModFlags);
+
+ MethodBuilder = dllimport_attr.DefinePInvokeMethod (
+ ec, parent.TypeBuilder,
+ Name, flags, ret_type, parameters);
+ } else {
+
+ MethodBuilder = parent.TypeBuilder.DefineMethod (
+ Name, flags,
+ GetCallingConvention (parent is Class),
+ ret_type, parameters);
+
+ if (implementing != null && explicit_impl)
+ parent.TypeBuilder.DefineMethodOverride (
+ MethodBuilder, implementing);
+ }
+
+ if (MethodBuilder == null)
+ return false;
+
+ //
+ // HACK because System.Reflection.Emit is lame
+ //
+ ParameterInfo = new InternalParameters (parent, Parameters);
+
+ if (!TypeManager.RegisterMethod (MethodBuilder, ParameterInfo,
+ parameters)) {
+ Report.Error (
+ 111, Location,
+ "Class `" + parent.Name + "' already contains a definition with " +
+ " the same return value and parameter types for method `" +
+ Name + "'");
+ return false;
+ }
+
+ //
+ // This is used to track the Entry Point,
+ //
+ // FIXME: Allow pluggable entry point, check arguments, etc.
+ //
+ if (Name == "Main" &&
+ ((ModFlags & Modifiers.STATIC) != 0) &&
+ (RootContext.MainClass == null ||
+ RootContext.MainClass == parent.TypeBuilder.FullName)){
+ if (RootContext.EntryPoint != null){
+ DuplicatEntryPoint (MethodBuilder);
+ DuplicatEntryPoint (RootContext.EntryPoint);
+ } else
+ RootContext.EntryPoint = MethodBuilder;
+
+ //
+ // FIXME: Verify that the method signature
+ // is valid for an entry point, and report
+ // error 28 if not.
+ //
}
+
+ return true;
}
- public string Name {
- get {
- return name;
+ //
+ // Emits the code
+ //
+ public void Emit (TypeContainer parent)
+ {
+ ILGenerator ig;
+ EmitContext ec;
+
+ if ((flags & MethodAttributes.PinvokeImpl) == 0)
+ ig = MethodBuilder.GetILGenerator ();
+ else
+ ig = null;
+
+ ec = new EmitContext (parent, Location, ig, GetReturnType (parent), ModFlags);
+
+ if (OptAttributes != null)
+ Attribute.ApplyAttributes (ec, MethodBuilder, this, OptAttributes, Location);
+
+
+ LabelParameters (ec, ParameterTypes (parent), MethodBuilder);
+
+ //
+ // abstract or extern methods have no bodies
+ //
+ if ((ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) != 0)
+ return;
+
+ //
+ // Handle destructors specially
+ //
+ // FIXME: This code generates buggy code
+ //
+ if (Name == "Finalize" && type_return_type == TypeManager.void_type)
+ EmitDestructor (ec);
+ else {
+ ISymbolWriter sw = CodeGen.SymbolWriter;
+
+ if ((sw != null) && (!Location.IsNull (Location))) {
+ MethodToken token = MethodBuilder.GetToken ();
+ sw.OpenMethod (new SymbolToken (token.Token));
+ sw.SetMethodSourceRange (Location.SymbolDocument,
+ Location.Row, 0,
+ Block.EndLocation.SymbolDocument,
+ Block.EndLocation.Row, 0);
+
+ ec.EmitTopBlock (Block, Location);
+
+ sw.CloseMethod ();
+ } else
+ ec.EmitTopBlock (Block, Location);
}
}
- public int ModFlags {
- get {
- return modifiers;
+ void EmitDestructor (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+
+ Label finish = ig.DefineLabel ();
+ bool old_in_try = ec.InTry;
+ Expression member_lookup;
+
+ ig.BeginExceptionBlock ();
+ ec.InTry = true;
+ ec.ReturnLabel = finish;
+ ec.EmitTopBlock (Block, Location);
+ ec.InTry = old_in_try;
+
+ ig.MarkLabel (finish);
+ bool old_in_finally = ec.InFinally;
+ ec.InFinally = true;
+ ig.BeginFinallyBlock ();
+
+ member_lookup = Expression.MemberLookup (
+ ec, ec.ContainerType.BaseType, "Finalize",
+ MemberTypes.Method, Expression.AllBindingFlags, Location);
+
+ if (member_lookup != null){
+ MethodGroupExpr parent_destructor = ((MethodGroupExpr) member_lookup);
+
+ ig.Emit (OpCodes.Ldarg_0);
+ ig.Emit (OpCodes.Call, (MethodInfo) parent_destructor.Methods [0]);
}
+ ec.InFinally = old_in_finally;
+
+ ig.EndExceptionBlock ();
+ //ig.MarkLabel (ec.ReturnLabel);
+ ig.Emit (OpCodes.Ret);
}
}
public abstract class ConstructorInitializer {
ArrayList argument_list;
-
- public ConstructorInitializer (ArrayList argument_list)
+ ConstructorInfo parent_constructor;
+ Location location;
+
+ public ConstructorInitializer (ArrayList argument_list, Location location)
{
this.argument_list = argument_list;
+ this.location = location;
}
public ArrayList Arguments {
@@ -632,26 +2480,73 @@ namespace CIR {
return argument_list;
}
}
+
+ public bool Resolve (EmitContext ec)
+ {
+ Expression parent_constructor_group;
+ Type t;
+
+ if (argument_list != null){
+ for (int i = argument_list.Count; i > 0; ){
+ --i;
+
+ Argument a = (Argument) argument_list [i];
+ if (!a.Resolve (ec, location))
+ return false;
+ }
+ }
+
+ if (this is ConstructorBaseInitializer)
+ t = ec.ContainerType.BaseType;
+ else
+ t = ec.ContainerType;
+
+ parent_constructor_group = Expression.MemberLookup (
+ ec, t, ".ctor",
+ MemberTypes.Constructor,
+ BindingFlags.Public | BindingFlags.Instance, location);
+
+ if (parent_constructor_group == null){
+ Console.WriteLine ("Could not find a constructor in our parent");
+ return false;
+ }
+
+ parent_constructor = (ConstructorInfo) Invocation.OverloadResolve (ec,
+ (MethodGroupExpr) parent_constructor_group, argument_list, location);
+
+ if (parent_constructor == null){
+ Console.WriteLine ("Could not locate a proper overload function");
+ return false;
+ }
+
+ return true;
+ }
+
+ public void Emit (EmitContext ec)
+ {
+ ec.ig.Emit (OpCodes.Ldarg_0);
+ if (argument_list != null)
+ Invocation.EmitArguments (ec, null, argument_list);
+ ec.ig.Emit (OpCodes.Call, parent_constructor);
+ }
}
public class ConstructorBaseInitializer : ConstructorInitializer {
- public ConstructorBaseInitializer (ArrayList argument_list) : base (argument_list)
+ public ConstructorBaseInitializer (ArrayList argument_list, Location l) : base (argument_list, l)
{
}
}
public class ConstructorThisInitializer : ConstructorInitializer {
- public ConstructorThisInitializer (ArrayList argument_list) : base (argument_list)
+ public ConstructorThisInitializer (ArrayList argument_list, Location l) : base (argument_list, l)
{
}
}
- public class Constructor {
- ConstructorInitializer init;
- string name;
- Parameters args;
- Block block;
- int mod_flags;
+ public class Constructor : MethodCore {
+ public ConstructorBuilder ConstructorBuilder;
+ public ConstructorInitializer Initializer;
+ public Attributes OptAttributes;
// <summary>
// Modifiers allowed for a constructor.
@@ -661,64 +2556,233 @@ namespace CIR {
Modifiers.PROTECTED |
Modifiers.INTERNAL |
Modifiers.STATIC |
+ Modifiers.UNSAFE |
Modifiers.PRIVATE;
//
// The spec claims that static is not permitted, but
// my very own code has static constructors.
//
-
- public Constructor (string name, Parameters args, ConstructorInitializer init)
+ public Constructor (string name, Parameters args, ConstructorInitializer init, Location l)
+ : base (name, args, l)
{
- this.name = name;
- this.args = args;
- this.init = init;
+ Initializer = init;
}
- public string Name {
- get {
- return name;
- }
+ //
+ // Returns true if this is a default constructor
+ //
+ public bool IsDefault ()
+ {
+ if ((ModFlags & Modifiers.STATIC) != 0)
+ return (Parameters.FixedParameters == null ? true : Parameters.Empty) &&
+ (Parameters.ArrayParameter == null ? true : Parameters.Empty);
+
+ else
+ return (Parameters.FixedParameters == null ? true : Parameters.Empty) &&
+ (Parameters.ArrayParameter == null ? true : Parameters.Empty) &&
+ (Initializer is ConstructorBaseInitializer) &&
+ (Initializer.Arguments == null);
}
- public ConstructorInitializer Initializer {
- get {
- return init;
+ //
+ // Creates the ConstructorBuilder
+ //
+ public override bool Define (TypeContainer parent)
+ {
+ MethodAttributes ca = (MethodAttributes.RTSpecialName |
+ MethodAttributes.SpecialName);
+
+ Type [] parameters = ParameterTypes (parent);
+
+ if ((ModFlags & Modifiers.STATIC) != 0)
+ ca |= MethodAttributes.Static;
+ else {
+ if (parent is Struct && parameters.Length == 0){
+ Report.Error (
+ 568, Location,
+ "Structs can not contain explicit parameterless " +
+ "constructors");
+ return false;
+ }
+ ca |= MethodAttributes.Public | MethodAttributes.HideBySig;
}
- }
- public Parameters Parameters {
- get {
- return args;
+ foreach (Type partype in parameters)
+ if (!TypeContainer.AsAccessible (partype, ModFlags))
+ return false;
+
+ ConstructorBuilder = parent.TypeBuilder.DefineConstructor (
+ ca, GetCallingConvention (parent is Class), parameters);
+
+ //
+ // HACK because System.Reflection.Emit is lame
+ //
+ ParameterInfo = new InternalParameters (parent, Parameters);
+
+ if (!TypeManager.RegisterMethod (ConstructorBuilder, ParameterInfo, parameters)) {
+ Report.Error (
+ 111, Location,
+ "Class `" +parent.Name+ "' already contains a definition with the " +
+ "same return value and parameter types for constructor `" + Name
+ + "'");
+ return false;
}
+
+ return true;
}
- public Block Block {
- get {
- return block;
+ //
+ // Emits the code
+ //
+ public void Emit (TypeContainer parent)
+ {
+ ILGenerator ig = ConstructorBuilder.GetILGenerator ();
+ EmitContext ec = new EmitContext (parent, Location, ig, null, ModFlags, true);
+
+ if (parent is Class && ((ModFlags & Modifiers.STATIC) == 0)){
+ if (Initializer == null)
+ Initializer = new ConstructorBaseInitializer (null, parent.Location);
+
+ if (!Initializer.Resolve (ec)){
+ Console.WriteLine ("Could not resolve initializer: " + parent.Name);
+ }
}
- set {
- block = value;
+ LabelParameters (ec, ParameterTypes (parent), ConstructorBuilder);
+
+ //
+ // Classes can have base initializers and instance field initializers.
+ //
+ if (parent is Class){
+ if ((ModFlags & Modifiers.STATIC) == 0){
+ parent.EmitFieldInitializers (ec);
+ Initializer.Emit (ec);
+ }
}
+
+ if ((ModFlags & Modifiers.STATIC) != 0)
+ parent.EmitFieldInitializers (ec);
+
+ Attribute.ApplyAttributes (ec, ConstructorBuilder, this, OptAttributes, Location);
+
+ ec.EmitTopBlock (Block, Location);
}
+ }
+
+ public class Field : MemberCore {
+ public readonly string Type;
+ public readonly Object Initializer;
+ public readonly Attributes OptAttributes;
+ public FieldBuilder FieldBuilder;
+ public Status status;
- public int ModFlags {
- get {
- return mod_flags;
+ [Flags]
+ public enum Status : byte { ASSIGNED = 1, USED = 2 }
+
+
+ // <summary>
+ // Modifiers allowed in a class declaration
+ // </summary>
+ const int AllowedModifiers =
+ Modifiers.NEW |
+ Modifiers.PUBLIC |
+ Modifiers.PROTECTED |
+ Modifiers.INTERNAL |
+ Modifiers.PRIVATE |
+ Modifiers.STATIC |
+ Modifiers.VOLATILE |
+ Modifiers.UNSAFE |
+ Modifiers.READONLY;
+
+ public Field (string type, int mod, string name, Object expr_or_array_init,
+ Attributes attrs, Location loc)
+ : base (name, loc)
+ {
+ Type = type;
+ ModFlags = Modifiers.Check (AllowedModifiers, mod, Modifiers.PRIVATE, loc);
+ Initializer = expr_or_array_init;
+ OptAttributes = attrs;
+ }
+
+ public override bool Define (TypeContainer parent)
+ {
+ Type t = RootContext.LookupType (parent, Type, false, Location);
+
+ if (t == null)
+ return false;
+
+ if (!TypeContainer.AsAccessible (t, ModFlags))
+ return false;
+
+ if (t.IsPointer && !UnsafeOK (parent))
+ return false;
+
+ if (RootContext.WarningLevel > 1){
+ Type ptype = parent.TypeBuilder.BaseType;
+
+ // ptype is only null for System.Object while compiling corlib.
+ if (ptype != null){
+ MemberInfo [] mi;
+
+ mi = TypeContainer.FindMembers (
+ ptype, MemberTypes.Method,
+ BindingFlags.Public |
+ BindingFlags.Static | BindingFlags.Instance,
+ System.Type.FilterName, Name);
+ }
}
- set {
- mod_flags = Modifiers.Check (AllowedModifiers, value, 0);
+ if ((ModFlags & Modifiers.VOLATILE) != 0){
+ if (!t.IsClass){
+ if (TypeManager.IsEnumType (t))
+ t = TypeManager.EnumToUnderlying (t);
+
+ if (!((t == TypeManager.bool_type) ||
+ (t == TypeManager.sbyte_type) ||
+ (t == TypeManager.byte_type) ||
+ (t == TypeManager.short_type) ||
+ (t == TypeManager.ushort_type) ||
+ (t == TypeManager.int32_type) ||
+ (t == TypeManager.uint32_type) ||
+ (t == TypeManager.char_type) ||
+ (t == TypeManager.float_type))){
+ Report.Error (
+ 677, Location, parent.MakeName (Name) +
+ " A volatile field can not be of type `" +
+ TypeManager.CSharpName (t) + "'");
+ return false;
+ }
+ }
}
+
+ FieldBuilder = parent.TypeBuilder.DefineField (
+ Name, t, Modifiers.FieldAttr (ModFlags));
+
+ TypeManager.RegisterField (FieldBuilder, this);
+ return true;
+ }
+
+ public void Emit (TypeContainer tc)
+ {
+ EmitContext ec = new EmitContext (tc, Location, null,
+ FieldBuilder.FieldType, ModFlags);
+
+ Attribute.ApplyAttributes (ec, FieldBuilder, this, OptAttributes, Location);
}
}
- public class Property {
- TypeRef typeref;
- string name;
- int mod_flags;
- Block get_block, set_block;
+ public class Property : MemberCore {
+ public readonly string Type;
+ public Block Get, Set;
+ public PropertyBuilder PropertyBuilder;
+ public Attributes OptAttributes;
+ public MethodBuilder GetBuilder, SetBuilder;
+
+ //
+ // The type, once we compute it.
+
+ Type PropertyType;
const int AllowedModifiers =
Modifiers.NEW |
@@ -730,46 +2794,1329 @@ namespace CIR {
Modifiers.SEALED |
Modifiers.OVERRIDE |
Modifiers.ABSTRACT |
+ Modifiers.UNSAFE |
+ Modifiers.EXTERN |
Modifiers.VIRTUAL;
+
+ public Property (string type, string name, int mod_flags, Block get_block, Block set_block,
+ Attributes attrs, Location loc)
+ : base (name, loc)
+ {
+ Type = type;
+ ModFlags = Modifiers.Check (AllowedModifiers, mod_flags, Modifiers.PRIVATE, loc);
+ Get = get_block;
+ Set = set_block;
+ OptAttributes = attrs;
+ }
+
+ //
+ // Checks our base implementation if any
+ //
+ bool CheckBase (MethodAttributes flags, TypeContainer parent)
+ {
+ //
+ // Find properties with the same name on the base class
+ //
+
+
+ //
+ // Ok, this code is broken. We should use the same concept
+ // that is available in `MemberLookup', because that does the
+ // right thing (ie, stops when it finds something).
+ //
+ // Currently we return multiple matches from the type hierarchy
+ // of properties
+ //
+ MemberInfo [] props;
+ MemberInfo [] props_static = TypeContainer.FindMembers (
+ parent.TypeBuilder.BaseType,
+ MemberTypes.Property, BindingFlags.Public | BindingFlags.Static,
+ System.Type.FilterName, Name);
+
+ MemberInfo [] props_instance = TypeContainer.FindMembers (
+ parent.TypeBuilder.BaseType,
+ MemberTypes.Property, BindingFlags.Public | BindingFlags.Instance,
+ System.Type.FilterName, Name);
+
+ //
+ // Find if we have anything
+ //
+ if (props_static != null && props_static.Length > 0)
+ props = props_static;
+ else if (props_instance != null && props_instance.Length > 0)
+ props = props_instance;
+ else
+ props = null;
+
+ //
+ // If we have something on the base.
+ if (props != null && props.Length > 0){
+ //
+ // FIXME:
+ // Currently we expect only to get 1 match at most from our
+ // base class, maybe we can get more than one, investigate
+ // whether this is possible
+ //
+ if (props.Length > 1)
+ throw new Exception ("How do we handle this?");
+
+ PropertyInfo pi = (PropertyInfo) props [0];
+
+ MethodInfo inherited_get = TypeManager.GetPropertyGetter (pi);
+ MethodInfo inherited_set = TypeManager.GetPropertySetter (pi);
+
+ MethodInfo reference = inherited_get == null ?
+ inherited_set : inherited_get;
+
+ if (reference != null)
+ if (!CheckMethodAgainstBase (parent, flags, reference))
+ return false;
+
+ } else {
+ if ((ModFlags & Modifiers.NEW) != 0)
+ WarningNotHiding (parent);
+
+ if ((ModFlags & Modifiers.OVERRIDE) != 0){
+ Report.Error (115, Location,
+ parent.MakeName (Name) +
+ " no suitable properties found to override");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ bool DefineMethod (TypeContainer parent, Type iface_type, string short_name,
+ MethodAttributes flags, bool is_get)
+ {
+ Type [] parameters = TypeManager.NoTypes;
+ MethodInfo implementing;
+ Type fn_type;
+ string name;
+
+ if (is_get){
+ fn_type = PropertyType;
+ name = "get_" + short_name;
+ } else {
+ name = "set_" + short_name;
+ parameters = new Type [1];
+ parameters [0] = PropertyType;
+ fn_type = TypeManager.void_type;
+ }
+
+ implementing = parent.IsInterfaceMethod (
+ iface_type, name, fn_type, parameters, false);
+
+ //
+ // For implicit implementations, make sure we are public, for
+ // explicit implementations, make sure we are private.
+ //
+ if (implementing != null){
+ //
+ // Setting null inside this block will trigger a more
+ // verbose error reporting for missing interface implementations
+ //
+ // The "candidate" function has been flagged already
+ // but it wont get cleared
+ //
+ if (iface_type == null){
+ //
+ // We already catch different accessibility settings
+ // so we just need to check that we are not private
+ //
+ if ((ModFlags & Modifiers.PRIVATE) != 0)
+ implementing = null;
+
+ //
+ // Static is not allowed
+ //
+ if ((ModFlags & Modifiers.STATIC) != 0)
+ implementing = null;
+ } else {
+ if ((ModFlags & (Modifiers.PUBLIC | Modifiers.ABSTRACT)) != 0){
+ Report.Error (
+ 106, Location, "`public' or `abstract' modifiers "+
+ "are not allowed in explicit interface declarations"
+ );
+ implementing = null;
+ }
+ }
+ }
+
+ //
+ // If implementing is still valid, set flags
+ //
+ if (implementing != null){
+ //
+ // When implementing interface methods, set NewSlot.
+ //
+ if (implementing.DeclaringType.IsInterface)
+ flags |= MethodAttributes.NewSlot;
+
+ flags |=
+ MethodAttributes.Virtual |
+ MethodAttributes.HideBySig;
+
+ //
+ // clear the pending flag
+ //
+ parent.IsInterfaceMethod (
+ iface_type, name, fn_type, parameters, true);
+ }
+
+ //
+ // If this is not an explicit interface implementation,
+ // clear implementing, as it is only used for explicit
+ // interface implementation
+ //
+ if (Name.IndexOf (".") == -1)
+ implementing = null;
+
+ if (is_get){
+ GetBuilder = parent.TypeBuilder.DefineMethod (
+ name, flags, PropertyType, null);
+ PropertyBuilder.SetGetMethod (GetBuilder);
+
+ if (implementing != null)
+ parent.TypeBuilder.DefineMethodOverride (
+ GetBuilder, implementing);
+
+ //
+ // HACK because System.Reflection.Emit is lame
+ //
+ InternalParameters ip = new InternalParameters (
+ parent, Parameters.GetEmptyReadOnlyParameters ());
+
+ if (!TypeManager.RegisterMethod (GetBuilder, ip, null)) {
+ Report.Error (111, Location,
+ "Class `" + parent.Name +
+ "' already contains a definition with the " +
+ "same return value and parameter types as the " +
+ "'get' method of property `" + Name + "'");
+ return false;
+ }
+ } else {
+ SetBuilder = parent.TypeBuilder.DefineMethod (
+ name, flags, null, parameters);
+
+ if (implementing != null)
+ parent.TypeBuilder.DefineMethodOverride (
+ SetBuilder, implementing);
+
+ SetBuilder.DefineParameter (1, ParameterAttributes.None, "value");
+ PropertyBuilder.SetSetMethod (SetBuilder);
+
+ //
+ // HACK because System.Reflection.Emit is lame
+ //
+ Parameter [] parms = new Parameter [1];
+ parms [0] = new Parameter (Type, "value", Parameter.Modifier.NONE, null);
+ InternalParameters ip = new InternalParameters (
+ parent, new Parameters (parms, null, Location));
+
+ if (!TypeManager.RegisterMethod (SetBuilder, ip, parameters)) {
+ Report.Error (
+ 111, Location,
+ "Class `" + parent.Name +
+ "' already contains a definition with the " +
+ "same return value and parameter types as the " +
+ "'set' method of property `" + Name + "'");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public override bool Define (TypeContainer parent)
+ {
+ Type iface_type = null;
+ string short_name;
+
+ if (!parent.MethodModifiersValid (ModFlags, Name, Location))
+ return false;
+
+ MethodAttributes flags = Modifiers.MethodAttr (ModFlags);
+
+ flags |= MethodAttributes.HideBySig |
+ MethodAttributes.SpecialName;
+
+ // Lookup Type, verify validity
+ PropertyType = RootContext.LookupType (parent, Type, false, Location);
+ if (PropertyType == null)
+ return false;
+
+ // verify accessibility
+ if (!TypeContainer.AsAccessible (PropertyType, ModFlags))
+ return false;
+
+ if (PropertyType.IsPointer && !UnsafeOK (parent))
+ return false;
+
+ if (!CheckBase (flags, parent))
+ return false;
+
+ //
+ // Check for explicit interface implementation
+ //
+ if (Name.IndexOf (".") != -1){
+ int pos = Name.LastIndexOf (".");
+ string iface = Name.Substring (0, pos);
+
+ iface_type = RootContext.LookupType (parent, iface, false, Location);
+ if (iface_type == null)
+ return false;
+
+ short_name = Name.Substring (pos + 1);
+
+ // Compute the full name that we need to export.
+ Name = iface_type.FullName + "." + short_name;
+ } else
+ short_name = Name;
+
+ // FIXME - PropertyAttributes.HasDefault ?
+
+ PropertyAttributes prop_attr = PropertyAttributes.RTSpecialName |
+ PropertyAttributes.SpecialName;
- public Property (TypeRef typeref, string name, int mod_flags, Block get_block, Block set_block)
+ PropertyBuilder = parent.TypeBuilder.DefineProperty (
+ Name, prop_attr, PropertyType, null);
+
+ if (Get != null)
+ if (!DefineMethod (parent, iface_type, short_name, flags, true))
+ return false;
+
+ if (Set != null)
+ if (!DefineMethod (parent, iface_type, short_name, flags, false))
+ return false;
+
+ //
+ // HACK for the reasons exposed above
+ //
+ if (!TypeManager.RegisterProperty (PropertyBuilder, GetBuilder, SetBuilder)) {
+ Report.Error (
+ 111, Location,
+ "Class `" + parent.Name +
+ "' already contains a definition for the property `" +
+ Name + "'");
+ return false;
+ }
+
+ return true;
+ }
+
+ public void Emit (TypeContainer tc)
+ {
+ ILGenerator ig;
+ EmitContext ec;
+
+ ec = new EmitContext (tc, Location, null, PropertyType, ModFlags);
+ Attribute.ApplyAttributes (ec, PropertyBuilder, this, OptAttributes, Location);
+
+
+ //
+ // abstract or extern properties have no bodies
+ //
+ if ((ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) != 0)
+ return;
+
+ if (Get != null){
+ ig = GetBuilder.GetILGenerator ();
+ ec = new EmitContext (tc, Location, ig, PropertyType, ModFlags);
+
+ ec.EmitTopBlock (Get, Location);
+ }
+
+ if (Set != null){
+ ig = SetBuilder.GetILGenerator ();
+ ec = new EmitContext (tc, Location, ig, null, ModFlags);
+
+ ec.EmitTopBlock (Set, Location);
+ }
+ }
+ }
+
+
+ /// </summary>
+ /// Gigantic workaround for lameness in SRE follows :
+ /// This class derives from EventInfo and attempts to basically
+ /// wrap around the EventBuilder so that FindMembers can quickly
+ /// return this in it search for members
+ /// </summary>
+ public class MyEventBuilder : EventInfo {
+
+ //
+ // We use this to "point" to our Builder which is
+ // not really a MemberInfo
+ //
+ EventBuilder MyBuilder;
+
+ //
+ // We "catch" and wrap these methods
+ //
+ MethodInfo raise, remove, add;
+
+ EventAttributes attributes;
+ Type declaring_type, reflected_type, event_type;
+ string name;
+
+ public MyEventBuilder (TypeBuilder type_builder, string name, EventAttributes event_attr, Type event_type)
{
- this.typeref = typeref;
+ MyBuilder = type_builder.DefineEvent (name, event_attr, event_type);
+
+ // And now store the values in our own fields.
+
+ declaring_type = type_builder;
+
+ // FIXME : This is supposed to be MyBuilder but since that doesn't
+ // derive from Type, I have no clue what to do with this.
+ reflected_type = null;
+
+ attributes = event_attr;
this.name = name;
- this.mod_flags = Modifiers.Check (AllowedModifiers, mod_flags, Modifiers.PRIVATE);
- this.get_block = get_block;
- this.set_block = set_block;
+ this.event_type = event_type;
+ }
+
+ //
+ // Methods that you have to override. Note that you only need
+ // to "implement" the variants that take the argument (those are
+ // the "abstract" methods, the others (GetAddMethod()) are
+ // regular.
+ //
+ public override MethodInfo GetAddMethod (bool nonPublic)
+ {
+ return add;
+ }
+
+ public override MethodInfo GetRemoveMethod (bool nonPublic)
+ {
+ return remove;
+ }
+
+ public override MethodInfo GetRaiseMethod (bool nonPublic)
+ {
+ return raise;
+ }
+
+ //
+ // These methods make "MyEventInfo" look like a Builder
+ //
+ public void SetRaiseMethod (MethodBuilder raiseMethod)
+ {
+ raise = raiseMethod;
+ MyBuilder.SetRaiseMethod (raiseMethod);
+ }
+
+ public void SetRemoveOnMethod (MethodBuilder removeMethod)
+ {
+ remove = removeMethod;
+ MyBuilder.SetRemoveOnMethod (removeMethod);
+ }
+
+ public void SetAddOnMethod (MethodBuilder addMethod)
+ {
+ add = addMethod;
+ MyBuilder.SetAddOnMethod (addMethod);
}
- public Type Type {
+ public void SetCustomAttribute (CustomAttributeBuilder cb)
+ {
+ MyBuilder.SetCustomAttribute (cb);
+ }
+
+ public override object [] GetCustomAttributes (bool inherit)
+ {
+ // FIXME : There's nothing which can be seemingly done here because
+ // we have no way of getting at the custom attribute objects of the
+ // EventBuilder !
+ return null;
+ }
+
+ public override object [] GetCustomAttributes (Type t, bool inherit)
+ {
+ // FIXME : Same here !
+ return null;
+ }
+
+ public override bool IsDefined (Type t, bool b)
+ {
+ return true;
+ }
+
+ public override EventAttributes Attributes {
get {
- return typeref.Type;
+ return attributes;
}
}
- public string Name {
+ public override string Name {
get {
return name;
}
}
- public int ModFlags {
+ public override Type DeclaringType {
get {
- return mod_flags;
+ return declaring_type;
}
}
- public Block Get {
+ public override Type ReflectedType {
get {
- return get_block;
+ return reflected_type;
}
}
- public Block Set {
+ public Type EventType {
get {
- return set_block;
+ return event_type;
}
}
}
-}
+
+ public class Event : MemberCore {
+
+ const int AllowedModifiers =
+ Modifiers.NEW |
+ Modifiers.PUBLIC |
+ Modifiers.PROTECTED |
+ Modifiers.INTERNAL |
+ Modifiers.PRIVATE |
+ Modifiers.STATIC |
+ Modifiers.VIRTUAL |
+ Modifiers.SEALED |
+ Modifiers.OVERRIDE |
+ Modifiers.UNSAFE |
+ Modifiers.ABSTRACT;
+
+ public readonly string Type;
+ public readonly Object Initializer;
+ public readonly Block Add;
+ public readonly Block Remove;
+ public MyEventBuilder EventBuilder;
+ public FieldBuilder FieldBuilder;
+ public Attributes OptAttributes;
+
+ Type EventType;
+ MethodBuilder AddBuilder, RemoveBuilder;
+
+
+ public Event (string type, string name, Object init, int flags, Block add_block,
+ Block rem_block, Attributes attrs, Location loc)
+ : base (name, loc)
+ {
+ Type = type;
+ Initializer = init;
+ ModFlags = Modifiers.Check (AllowedModifiers, flags, Modifiers.PRIVATE, loc);
+ Add = add_block;
+ Remove = rem_block;
+ OptAttributes = attrs;
+ }
+
+ public override bool Define (TypeContainer parent)
+ {
+ if (!parent.MethodModifiersValid (ModFlags, Name, Location))
+ return false;
+
+ MethodAttributes m_attr = Modifiers.MethodAttr (ModFlags);
+ EventAttributes e_attr = EventAttributes.RTSpecialName | EventAttributes.SpecialName;
+
+ EventType = RootContext.LookupType (parent, Type, false, Location);
+ if (EventType == null)
+ return false;
+
+ if (!TypeContainer.AsAccessible (EventType, ModFlags))
+ return false;
+
+ if (EventType.IsPointer && !UnsafeOK (parent))
+ return false;
+
+ if (!EventType.IsSubclassOf (TypeManager.delegate_type)) {
+ Report.Error (66, Location, "'" + parent.Name + "." + Name +
+ "' : event must be of a delegate type");
+ return false;
+ }
+
+ Type [] parameters = new Type [1];
+ parameters [0] = EventType;
+
+ EventBuilder = new MyEventBuilder (parent.TypeBuilder, Name, e_attr, EventType);
+
+ if (Add == null && Remove == null)
+ FieldBuilder = parent.TypeBuilder.DefineField (Name, EventType, FieldAttributes.Private);
+
+ //
+ // Now define the accessors
+ //
+
+ AddBuilder = parent.TypeBuilder.DefineMethod (
+ "add_" + Name, m_attr, null, parameters);
+ AddBuilder.DefineParameter (1, ParameterAttributes.None, "value");
+ EventBuilder.SetAddOnMethod (AddBuilder);
+
+ //
+ // HACK because System.Reflection.Emit is lame
+ //
+ Parameter [] parms = new Parameter [1];
+ parms [0] = new Parameter (Type, "value", Parameter.Modifier.NONE, null);
+ InternalParameters ip = new InternalParameters (
+ parent, new Parameters (parms, null, Location));
+
+ if (!TypeManager.RegisterMethod (AddBuilder, ip, parameters)) {
+ Report.Error (111, Location,
+ "Class `" + parent.Name + "' already contains a definition with the " +
+ "same return value and parameter types for the " +
+ "'add' method of event `" + Name + "'");
+ return false;
+ }
+
+ RemoveBuilder = parent.TypeBuilder.DefineMethod (
+ "remove_" + Name, m_attr, null, parameters);
+ RemoveBuilder.DefineParameter (1, ParameterAttributes.None, "value");
+ EventBuilder.SetRemoveOnMethod (RemoveBuilder);
+
+ //
+ // HACK because System.Reflection.Emit is lame
+ //
+
+ if (!TypeManager.RegisterMethod (RemoveBuilder, ip, parameters)) {
+ Report.Error (111, Location,
+ "Class `" + parent.Name + "' already contains a definition with the " +
+ "same return value and parameter types for the " +
+ "'remove' method of event `" + Name + "'");
+ return false;
+ }
+
+ if (!TypeManager.RegisterEvent (EventBuilder, AddBuilder, RemoveBuilder)) {
+ Report.Error (111, Location,
+ "Class `" + parent.Name +
+ "' already contains a definition for the event `" +
+ Name + "'");
+ return false;
+ }
+
+ return true;
+ }
+
+ void EmitDefaultMethod (EmitContext ec, bool is_add)
+ {
+ ILGenerator ig = ec.ig;
+ MethodInfo method = null;
+
+ if (is_add)
+ method = TypeManager.delegate_combine_delegate_delegate;
+ else
+ method = TypeManager.delegate_remove_delegate_delegate;
+
+ ig.Emit (OpCodes.Ldarg_0);
+ ig.Emit (OpCodes.Ldarg_0);
+ ig.Emit (OpCodes.Ldfld, (FieldInfo) FieldBuilder);
+ ig.Emit (OpCodes.Ldarg_1);
+ ig.Emit (OpCodes.Call, method);
+ ig.Emit (OpCodes.Castclass, EventType);
+ ig.Emit (OpCodes.Stfld, (FieldInfo) FieldBuilder);
+ ig.Emit (OpCodes.Ret);
+ }
+
+ public void Emit (TypeContainer tc)
+ {
+ EmitContext ec;
+ ILGenerator ig;
+
+ ig = AddBuilder.GetILGenerator ();
+ ec = new EmitContext (tc, Location, ig, TypeManager.void_type, ModFlags);
+
+ if (Add != null)
+ ec.EmitTopBlock (Add, Location);
+ else
+ EmitDefaultMethod (ec, true);
+
+ ig = RemoveBuilder.GetILGenerator ();
+ ec = new EmitContext (tc, Location, ig, TypeManager.void_type, ModFlags);
+
+ if (Remove != null)
+ ec.EmitTopBlock (Remove, Location);
+ else
+ EmitDefaultMethod (ec, false);
+
+ ec = new EmitContext (tc, Location, null, EventType, ModFlags);
+ Attribute.ApplyAttributes (ec, EventBuilder, this, OptAttributes, Location);
+
+ }
+
+ }
+
+ //
+ // FIXME: This does not handle:
+ //
+ // int INTERFACENAME [ args ]
+ //
+ // Only:
+ //
+ // int this [ args ]
+
+ public class Indexer : MemberCore {
+
+ const int AllowedModifiers =
+ Modifiers.NEW |
+ Modifiers.PUBLIC |
+ Modifiers.PROTECTED |
+ Modifiers.INTERNAL |
+ Modifiers.PRIVATE |
+ Modifiers.VIRTUAL |
+ Modifiers.SEALED |
+ Modifiers.OVERRIDE |
+ Modifiers.UNSAFE |
+ Modifiers.EXTERN |
+ Modifiers.ABSTRACT;
+ public readonly string Type;
+ public readonly string InterfaceType;
+ public readonly Parameters FormalParameters;
+ public readonly Block Get;
+ public readonly Block Set;
+ public Attributes OptAttributes;
+ public MethodBuilder GetBuilder;
+ public MethodBuilder SetBuilder;
+ public PropertyBuilder PropertyBuilder;
+ public Type IndexerType;
+
+ public Indexer (string type, string int_type, int flags, Parameters parms,
+ Block get_block, Block set_block, Attributes attrs, Location loc)
+ : base ("", loc)
+ {
+
+ Type = type;
+ InterfaceType = int_type;
+ ModFlags = Modifiers.Check (AllowedModifiers, flags, Modifiers.PRIVATE, loc);
+ FormalParameters = parms;
+ Get = get_block;
+ Set = set_block;
+ OptAttributes = attrs;
+ }
+
+ void DefineMethod (TypeContainer parent, Type iface_type,
+ Type ret_type, string name,
+ Type [] parameters, MethodAttributes attr, bool is_get)
+ {
+ MethodInfo implementing;
+
+ implementing = parent.IsInterfaceMethod (
+ iface_type, name, ret_type, parameters, false);
+
+ //
+ // Setting null inside this block will trigger a more
+ // verbose error reporting for missing interface implementations
+ //
+ // The "candidate" function has been flagged already
+ // but it wont get cleared
+ //
+ if (implementing != null){
+ if (iface_type == null){
+ //
+ // We already catch different accessibility settings
+ // so we just need to check that we are not private
+ //
+ if ((ModFlags & Modifiers.PRIVATE) != 0)
+ implementing = null;
+
+ //
+ // Static is not allowed
+ //
+ if ((ModFlags & Modifiers.STATIC) != 0)
+ implementing = null;
+ } else {
+ if((ModFlags&(Modifiers.PUBLIC | Modifiers.ABSTRACT)) != 0){
+ Report.Error (
+ 106, Location,
+ "`public' or `abstract' modifiers are not "+
+ "allowed in explicit interface declarations"
+ );
+ implementing = null;
+ }
+ }
+ }
+ if (implementing != null){
+ //
+ // When implementing interface methods, set NewSlot.
+ //
+ if (implementing.DeclaringType.IsInterface)
+ attr |= MethodAttributes.NewSlot;
+
+ attr |=
+ MethodAttributes.Virtual |
+ MethodAttributes.HideBySig;
+
+ //
+ // clear the pending flag
+ //
+ parent.IsInterfaceMethod (
+ iface_type, name, ret_type, parameters, true);
+ }
+
+ //
+ // If this is not an explicit interface implementation,
+ // clear implementing, as it is only used for explicit
+ // interface implementation
+ //
+ if (Name.IndexOf (".") == -1)
+ implementing = null;
+
+ if (is_get){
+
+ string meth_name = "get_Item";
+ if (iface_type != null)
+ meth_name = iface_type + ".get_Item";
+
+ GetBuilder = parent.TypeBuilder.DefineMethod (
+ meth_name, attr, IndexerType, parameters);
+
+ if (implementing != null)
+ parent.TypeBuilder.DefineMethodOverride (
+ GetBuilder, implementing);
+
+
+ PropertyBuilder.SetGetMethod (GetBuilder);
+ } else {
+
+ string meth_name = "set_Item";
+
+ if (iface_type != null)
+ meth_name = iface_type + ".set_Item";
+
+ SetBuilder = parent.TypeBuilder.DefineMethod (
+ meth_name, attr, null, parameters);
+ if (implementing != null)
+ parent.TypeBuilder.DefineMethodOverride (
+ SetBuilder, implementing);
+
+ PropertyBuilder.SetSetMethod (SetBuilder);
+ }
+ }
+
+ public override bool Define (TypeContainer parent)
+ {
+ PropertyAttributes prop_attr =
+ PropertyAttributes.RTSpecialName |
+ PropertyAttributes.SpecialName;
+ bool error = false;
+
+ IndexerType = RootContext.LookupType (parent, Type, false, Location);
+ Type [] parameters = FormalParameters.GetParameterInfo (parent);
+
+ // Check if the return type and arguments were correct
+ if (IndexerType == null || parameters == null)
+ return false;
+
+ if (!parent.MethodModifiersValid (ModFlags, InterfaceType == null ?
+ "this" : InterfaceType, Location))
+ return false;
+
+ //
+ // verify accessibility and unsafe pointers
+ //
+ if (!TypeContainer.AsAccessible (IndexerType, ModFlags))
+ return false;
+
+ if (IndexerType.IsPointer && !UnsafeOK (parent))
+ return false;
+
+ foreach (Type partype in parameters){
+ if (!TypeContainer.AsAccessible (partype, ModFlags))
+ error = true;
+ if (partype.IsPointer && !UnsafeOK (parent))
+ error = true;
+ }
+
+ if (error)
+ return false;
+
+ Type iface_type = null;
+
+ if (InterfaceType != null){
+ iface_type = RootContext.LookupType (parent, InterfaceType, false, Location);
+ if (iface_type == null)
+ return false;
+ }
+
+
+ PropertyBuilder = parent.TypeBuilder.DefineProperty (
+ TypeManager.IndexerPropertyName (parent.TypeBuilder),
+ prop_attr, IndexerType, parameters);
+
+ MethodAttributes attr = Modifiers.MethodAttr (ModFlags);
+
+ if (Get != null){
+ DefineMethod (parent, iface_type, IndexerType, "get_Item",
+ parameters, attr, true);
+ InternalParameters pi = new InternalParameters (parent, FormalParameters);
+ if (!TypeManager.RegisterMethod (GetBuilder, pi, parameters)) {
+ Report.Error (111, Location,
+ "Class `" + parent.Name +
+ "' already contains a definition with the " +
+ "same return value and parameter types for the " +
+ "'get' indexer");
+ return false;
+ }
+ }
+
+ if (Set != null){
+ int top = parameters.Length;
+ Type [] set_pars = new Type [top + 1];
+ parameters.CopyTo (set_pars, 0);
+ set_pars [top] = IndexerType;
+
+ Parameter [] fixed_parms = FormalParameters.FixedParameters;
+
+ Parameter [] tmp = new Parameter [fixed_parms.Length + 1];
+
+ fixed_parms.CopyTo (tmp, 0);
+ tmp [fixed_parms.Length] = new Parameter (
+ Type, "value", Parameter.Modifier.NONE, null);
+
+ Parameters set_formal_params = new Parameters (tmp, null, Location);
+
+ DefineMethod (
+ parent, iface_type, TypeManager.void_type,
+ "set_Item", set_pars, attr, false);
+
+ InternalParameters ip = new InternalParameters (parent, set_formal_params);
+
+ if (!TypeManager.RegisterMethod (SetBuilder, ip, set_pars)) {
+ Report.Error (
+ 111, Location,
+ "Class `" + parent.Name + "' already contains a " +
+ "definition with the " +
+ "same return value and parameter types for the " +
+ "'set' indexer");
+ return false;
+ }
+ }
+
+ //
+ // Now name the parameters
+ //
+ Parameter [] p = FormalParameters.FixedParameters;
+ if (p != null) {
+ int i;
+
+ for (i = 0; i < p.Length; ++i) {
+ if (Get != null)
+ GetBuilder.DefineParameter (
+ i + 1, p [i].Attributes, p [i].Name);
+
+ if (Set != null)
+ SetBuilder.DefineParameter (
+ i + 1, p [i].Attributes, p [i].Name);
+ }
+
+ if (Set != null)
+ SetBuilder.DefineParameter (
+ i + 1, ParameterAttributes.None, "value");
+
+ if (i != parameters.Length) {
+ Parameter array_param = FormalParameters.ArrayParameter;
+ SetBuilder.DefineParameter (i + 1, array_param.Attributes,
+ array_param.Name);
+ }
+ }
+
+ TypeManager.RegisterProperty (PropertyBuilder, GetBuilder, SetBuilder);
+
+ return true;
+ }
+
+ public void Emit (TypeContainer tc)
+ {
+ ILGenerator ig;
+ EmitContext ec;
+
+ ec = new EmitContext (tc, Location, null, IndexerType, ModFlags);
+ Attribute.ApplyAttributes (ec, PropertyBuilder, this, OptAttributes, Location);
+
+ if (Get != null){
+ ig = GetBuilder.GetILGenerator ();
+ ec = new EmitContext (tc, Location, ig, IndexerType, ModFlags);
+
+ ec.EmitTopBlock (Get, Location);
+ }
+
+ if (Set != null){
+ ig = SetBuilder.GetILGenerator ();
+ ec = new EmitContext (tc, Location, ig, null, ModFlags);
+
+ ec.EmitTopBlock (Set, Location);
+ }
+ }
+ }
+
+ public class Operator : MemberCore {
+
+ const int AllowedModifiers =
+ Modifiers.PUBLIC |
+ Modifiers.UNSAFE |
+ Modifiers.EXTERN |
+ Modifiers.STATIC;
+
+ const int RequiredModifiers =
+ Modifiers.PUBLIC |
+ Modifiers.STATIC;
+
+ public enum OpType : byte {
+
+ // Unary operators
+ LogicalNot,
+ OnesComplement,
+ Increment,
+ Decrement,
+ True,
+ False,
+
+ // Unary and Binary operators
+ Addition,
+ Subtraction,
+
+ UnaryPlus,
+ UnaryNegation,
+
+ // Binary operators
+ Multiply,
+ Division,
+ Modulus,
+ BitwiseAnd,
+ BitwiseOr,
+ ExclusiveOr,
+ LeftShift,
+ RightShift,
+ Equality,
+ Inequality,
+ GreaterThan,
+ LessThan,
+ GreaterThanOrEqual,
+ LessThanOrEqual,
+
+ // Implicit and Explicit
+ Implicit,
+ Explicit
+ };
+
+ public readonly OpType OperatorType;
+ public readonly string ReturnType;
+ public readonly string FirstArgType;
+ public readonly string FirstArgName;
+ public readonly string SecondArgType;
+ public readonly string SecondArgName;
+ public readonly Block Block;
+ public Attributes OptAttributes;
+ public MethodBuilder OperatorMethodBuilder;
+
+ public string MethodName;
+ public Method OperatorMethod;
+
+ public Operator (OpType type, string ret_type, int flags, string arg1type, string arg1name,
+ string arg2type, string arg2name, Block block, Attributes attrs, Location loc)
+ : base ("", loc)
+ {
+ OperatorType = type;
+ ReturnType = ret_type;
+ ModFlags = Modifiers.Check (AllowedModifiers, flags, Modifiers.PUBLIC, loc);
+ FirstArgType = arg1type;
+ FirstArgName = arg1name;
+ SecondArgType = arg2type;
+ SecondArgName = arg2name;
+ Block = block;
+ OptAttributes = attrs;
+ }
+
+ string Prototype (TypeContainer parent)
+ {
+ return parent.Name + ".operator " + OperatorType + " (" + FirstArgType + "," +
+ SecondArgType + ")";
+ }
+
+ public override bool Define (TypeContainer parent)
+ {
+ int length = 1;
+ MethodName = "op_" + OperatorType;
+
+ if (SecondArgType != null)
+ length = 2;
+
+ Parameter [] param_list = new Parameter [length];
+
+ if ((ModFlags & RequiredModifiers) != RequiredModifiers){
+ Report.Error (
+ 558, Location,
+ "User defined operators `" +
+ Prototype (parent) +
+ "' must be declared static and public");
+ return false;
+ }
+
+ param_list[0] = new Parameter (FirstArgType, FirstArgName,
+ Parameter.Modifier.NONE, null);
+ if (SecondArgType != null)
+ param_list[1] = new Parameter (SecondArgType, SecondArgName,
+ Parameter.Modifier.NONE, null);
+
+ OperatorMethod = new Method (ReturnType, ModFlags, MethodName,
+ new Parameters (param_list, null, Location),
+ OptAttributes, Mono.CSharp.Location.Null);
+
+ OperatorMethod.Define (parent);
+
+ if (OperatorMethod.MethodBuilder == null)
+ return false;
+
+ OperatorMethodBuilder = OperatorMethod.MethodBuilder;
+
+ Type [] param_types = OperatorMethod.ParameterTypes (parent);
+ Type declaring_type = OperatorMethodBuilder.DeclaringType;
+ Type return_type = OperatorMethod.GetReturnType (parent);
+ Type first_arg_type = param_types [0];
+
+ // Rules for conversion operators
+
+ if (OperatorType == OpType.Implicit || OperatorType == OpType.Explicit) {
+ if (first_arg_type == return_type && first_arg_type == declaring_type){
+ Report.Error (
+ 555, Location,
+ "User-defined conversion cannot take an object of the " +
+ "enclosing type and convert to an object of the enclosing" +
+ " type");
+ return false;
+ }
+
+ if (first_arg_type != declaring_type && return_type != declaring_type){
+ Report.Error (
+ 556, Location,
+ "User-defined conversion must convert to or from the " +
+ "enclosing type");
+ return false;
+ }
+
+ if (first_arg_type == TypeManager.object_type ||
+ return_type == TypeManager.object_type){
+ Report.Error (
+ -8, Location,
+ "User-defined conversion cannot convert to or from " +
+ "object type");
+ return false;
+ }
+
+ if (first_arg_type.IsInterface || return_type.IsInterface){
+ Report.Error (
+ 552, Location,
+ "User-defined conversion cannot convert to or from an " +
+ "interface type");
+ return false;
+ }
+
+ if (first_arg_type.IsSubclassOf (return_type) ||
+ return_type.IsSubclassOf (first_arg_type)){
+ Report.Error (
+ -10, Location,
+ "User-defined conversion cannot convert between types " +
+ "that derive from each other");
+ return false;
+ }
+ } else if (SecondArgType == null) {
+ // Checks for Unary operators
+
+ if (first_arg_type != declaring_type){
+ Report.Error (
+ 562, Location,
+ "The parameter of a unary operator must be the " +
+ "containing type");
+ return false;
+ }
+
+ if (OperatorType == OpType.Increment || OperatorType == OpType.Decrement) {
+ if (return_type != declaring_type){
+ Report.Error (
+ 559, Location,
+ "The parameter and return type for ++ and -- " +
+ "must be the containing type");
+ return false;
+ }
+
+ }
+
+ if (OperatorType == OpType.True || OperatorType == OpType.False) {
+ if (return_type != TypeManager.bool_type){
+ Report.Error (
+ 215, Location,
+ "The return type of operator True or False " +
+ "must be bool");
+ return false;
+ }
+ }
+
+ } else {
+ // Checks for Binary operators
+
+ if (first_arg_type != declaring_type &&
+ param_types [1] != declaring_type){
+ Report.Error (
+ 563, Location,
+ "One of the parameters of a binary operator must " +
+ "be the containing type");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public void Emit (TypeContainer parent)
+ {
+ EmitContext ec = new EmitContext (parent, Location, null, null, ModFlags);
+ Attribute.ApplyAttributes (ec, OperatorMethodBuilder, this, OptAttributes, Location);
+
+ //
+ // abstract or extern methods have no bodies
+ //
+ if ((ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) != 0)
+ return;
+
+ OperatorMethod.Block = Block;
+ OperatorMethod.Emit (parent);
+ }
+ }
+
+ //
+ // This is used to compare method signatures
+ //
+ struct MethodSignature {
+ public string Name;
+ public Type RetType;
+ public Type [] Parameters;
+
+ /// <summary>
+ /// This delegate is used to extract methods which have the
+ /// same signature as the argument
+ /// </summary>
+ public static MemberFilter method_signature_filter;
+
+ /// <summary>
+ /// This delegate is used to extract inheritable methods which
+ /// have the same signature as the argument. By inheritable,
+ /// this means that we have permissions to override the method
+ /// from the current assembly and class
+ /// </summary>
+ public static MemberFilter inheritable_method_signature_filter;
+
+ static MethodSignature ()
+ {
+ method_signature_filter = new MemberFilter (MemberSignatureCompare);
+ inheritable_method_signature_filter = new MemberFilter (
+ InheritableMemberSignatureCompare);
+ }
+
+ public MethodSignature (string name, Type ret_type, Type [] parameters)
+ {
+ Name = name;
+ RetType = ret_type;
+
+ if (parameters == null)
+ Parameters = TypeManager.NoTypes;
+ else
+ Parameters = parameters;
+ }
+
+ public override int GetHashCode ()
+ {
+ return Name.GetHashCode ();
+ }
+
+ public override bool Equals (Object o)
+ {
+ MethodSignature other = (MethodSignature) o;
+
+ if (other.Name != Name)
+ return false;
+
+ if (other.RetType != RetType)
+ return false;
+
+ if (Parameters == null){
+ if (other.Parameters == null)
+ return true;
+ return false;
+ }
+
+ if (other.Parameters == null)
+ return false;
+
+ int c = Parameters.Length;
+ if (other.Parameters.Length != c)
+ return false;
+
+ for (int i = 0; i < c; i++)
+ if (other.Parameters [i] != Parameters [i])
+ return false;
+
+ return true;
+ }
+
+ static bool MemberSignatureCompare (MemberInfo m, object filter_criteria)
+ {
+ MethodInfo mi;
+
+ if (! (m is MethodInfo))
+ return false;
+
+ MethodSignature sig = (MethodSignature) filter_criteria;
+
+ if (m.Name != sig.Name)
+ return false;
+
+ mi = (MethodInfo) m;
+
+ if (mi.ReturnType != sig.RetType)
+ return false;
+
+ Type [] args = TypeManager.GetArgumentTypes (mi);
+ Type [] sigp = sig.Parameters;
+
+ if (args.Length != sigp.Length)
+ return false;
+
+ for (int i = args.Length; i > 0; ){
+ i--;
+ if (args [i] != sigp [i])
+ return false;
+ }
+ return true;
+ }
+
+ //
+ // This filter should be used when we are requesting methods that
+ // we want to override.
+ //
+ static bool InheritableMemberSignatureCompare (MemberInfo m, object filter_criteria)
+ {
+ if (MemberSignatureCompare (m, filter_criteria)){
+ MethodInfo mi = (MethodInfo) m;
+ MethodAttributes prot = mi.Attributes & MethodAttributes.MemberAccessMask;
+
+ // If only accessible to the current class.
+ if (prot == MethodAttributes.Private)
+ return false;
+
+ // If only accessible to the defining assembly or
+ if (prot == MethodAttributes.FamANDAssem ||
+ prot == MethodAttributes.Assembly){
+ if (m is MethodBuilder)
+ return true;
+ else
+ return false;
+ }
+
+ // Anything else (FamOrAssembly and Public) is fine
+ return true;
+ }
+ return false;
+ }
+ }
+}
diff --git a/mcs/mcs/codegen.cs b/mcs/mcs/codegen.cs
new file mode 100755
index 00000000000..54e8650ffbe
--- /dev/null
+++ b/mcs/mcs/codegen.cs
@@ -0,0 +1,453 @@
+//
+// codegen.cs: The code generator
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Diagnostics.SymbolStore;
+
+namespace Mono.CSharp {
+
+ /// <summary>
+ /// Code generator class.
+ /// </summary>
+ public class CodeGen {
+ static AppDomain current_domain;
+ static AssemblyBuilder assembly_builder;
+ static ModuleBuilder module_builder;
+
+ static public ISymbolWriter SymbolWriter;
+
+ public static string Basename (string name)
+ {
+ int pos = name.LastIndexOf ("/");
+
+ if (pos != -1)
+ return name.Substring (pos + 1);
+
+ pos = name.LastIndexOf ("\\");
+ if (pos != -1)
+ return name.Substring (pos + 1);
+
+ return name;
+ }
+
+ public static string Dirname (string name)
+ {
+ int pos = name.LastIndexOf ("/");
+
+ if (pos != -1)
+ return name.Substring (0, pos);
+
+ pos = name.LastIndexOf ("\\");
+ if (pos != -1)
+ return name.Substring (0, pos);
+
+ return ".";
+ }
+
+ static string TrimExt (string name)
+ {
+ int pos = name.LastIndexOf (".");
+
+ return name.Substring (0, pos);
+ }
+
+ static public string FileName;
+
+ //
+ // This routine initializes the Mono runtime SymbolWriter.
+ //
+ static void InitMonoSymbolWriter (string basename)
+ {
+ string symbol_output = basename + "-debug.s";
+
+ //
+ // Mono's default symbol writer ignores the first and third argument
+ // of this method.
+ //
+ SymbolWriter.Initialize (new IntPtr (0), symbol_output, true);
+ }
+
+ //
+ // Initializes the symbol writer
+ //
+ static void InitializeSymbolWriter (string basename)
+ {
+ SymbolWriter = module_builder.GetSymWriter ();
+
+ //
+ // If we got an ISymbolWriter instance, initialize it.
+ //
+ if (SymbolWriter == null)
+ return;
+
+ //
+ // Due to lacking documentation about the first argument of the
+ // Initialize method, we cannot use Microsoft's default symbol
+ // writer yet.
+ //
+ // If we're using the mono symbol writer, the SymbolWriter object
+ // is of type MonoSymbolWriter - but that's defined in a dynamically
+ // loaded DLL - that's why we're doing a comparision based on the type
+ // name here instead of using `SymbolWriter is MonoSymbolWriter'.
+ //
+ Type sym_type = ((object) SymbolWriter).GetType ();
+
+ switch (sym_type.Name){
+ case "MonoSymbolWriter":
+ InitMonoSymbolWriter (basename);
+ break;
+
+ default:
+ Report.Error (
+ -18, "Cannot generate debugging information on this platform");
+ break;
+ }
+ }
+
+ //
+ // Initializes the code generator variables
+ //
+ static public void Init (string name, string output, bool want_debugging_support)
+ {
+ AssemblyName an;
+
+ FileName = output;
+ an = new AssemblyName ();
+ an.Name = TrimExt (Basename (name));
+ current_domain = AppDomain.CurrentDomain;
+ assembly_builder = current_domain.DefineDynamicAssembly (
+ an, AssemblyBuilderAccess.RunAndSave, Dirname (name));
+
+ //
+ // Pass a path-less name to DefineDynamicModule. Wonder how
+ // this copes with output in different directories then.
+ // FIXME: figure out how this copes with --output /tmp/blah
+ //
+ // If the third argument is true, the ModuleBuilder will dynamically
+ // load the default symbol writer.
+ //
+ module_builder = assembly_builder.DefineDynamicModule (
+ Basename (name), Basename (output), want_debugging_support);
+
+ if (want_debugging_support)
+ InitializeSymbolWriter (an.Name);
+ }
+
+ static public AssemblyBuilder AssemblyBuilder {
+ get {
+ return assembly_builder;
+ }
+ }
+
+ static public ModuleBuilder ModuleBuilder {
+ get {
+ return module_builder;
+ }
+ }
+
+ static public void Save (string name)
+ {
+ try {
+ assembly_builder.Save (Basename (name));
+ } catch (System.IO.IOException io){
+ Report.Error (16, "Coult not write to file `"+name+"', cause: " + io.Message);
+ }
+ }
+
+ static public void SaveSymbols ()
+ {
+ if (SymbolWriter != null) {
+ // If we have a symbol writer, call its Close() method to write
+ // the symbol file to disk.
+ //
+ // When using Mono's default symbol writer, the Close() method must
+ // be called after the assembly has already been written to disk since
+ // it opens the assembly and reads its metadata.
+ SymbolWriter.Close ();
+ }
+ }
+ }
+
+ /// <summary>
+ /// An Emit Context is created for each body of code (from methods,
+ /// properties bodies, indexer bodies or constructor bodies)
+ /// </summary>
+ public class EmitContext {
+ public DeclSpace DeclSpace;
+ public TypeContainer TypeContainer;
+ public ILGenerator ig;
+
+ /// <summary>
+ /// This variable tracks the `checked' state of the compilation,
+ /// it controls whether we should generate code that does overflow
+ /// checking, or if we generate code that ignores overflows.
+ ///
+ /// The default setting comes from the command line option to generate
+ /// checked or unchecked code plus any source code changes using the
+ /// checked/unchecked statements or expressions. Contrast this with
+ /// the ConstantCheckState flag.
+ /// </summary>
+
+ public bool CheckState;
+
+ /// <summary>
+ /// The constant check state is always set to `true' and cant be changed
+ /// from the command line. The source code can change this setting with
+ /// the `checked' and `unchecked' statements and expressions.
+ /// </summary>
+ public bool ConstantCheckState;
+
+ /// <summary>
+ /// Whether we are emitting code inside a static or instance method
+ /// </summary>
+ public bool IsStatic;
+
+ /// <summary>
+ /// The value that is allowed to be returned or NULL if there is no
+ /// return type.
+ /// </summary>
+ public Type ReturnType;
+
+ /// <summary>
+ /// Points to the Type (extracted from the TypeContainer) that
+ /// declares this body of code
+ /// </summary>
+ public Type ContainerType;
+
+ /// <summary>
+ /// Whether this is generating code for a constructor
+ /// </summary>
+ public bool IsConstructor;
+
+ /// <summary>
+ /// Keeps track of the Type to LocalBuilder temporary storage created
+ /// to store structures (used to compute the address of the structure
+ /// value on structure method invocations)
+ /// </summary>
+ public Hashtable temporary_storage;
+
+ public Block CurrentBlock;
+
+ /// <summary>
+ /// The location where we store the return value.
+ /// </summary>
+ LocalBuilder return_value;
+
+ /// <summary>
+ /// The location where return has to jump to return the
+ /// value
+ /// </summary>
+ public Label ReturnLabel;
+
+ /// <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 in a Catch block
+ /// </summary>
+ public bool InCatch;
+
+ /// <summary>
+ /// Whether we are inside an unsafe block
+ /// </summary>
+ public bool InUnsafe;
+
+ /// <summary>
+ /// Location for this EmitContext
+ /// </summary>
+ public Location loc;
+
+ /// <summary>
+ /// Used to "flag" the resolution process to only lookup types,
+ /// and nothing else. This is an out-of-band communication
+ /// path to SimpleName from the cast operation.
+ /// </summary>
+ public bool OnlyLookupTypes;
+
+ public EmitContext (TypeContainer parent, DeclSpace ds, Location l, ILGenerator ig,
+ Type return_type, int code_flags, bool is_constructor)
+ {
+ this.ig = ig;
+
+ TypeContainer = parent;
+ DeclSpace = ds;
+ CheckState = RootContext.Checked;
+ ConstantCheckState = true;
+
+ IsStatic = (code_flags & Modifiers.STATIC) != 0;
+ ReturnType = return_type;
+ IsConstructor = is_constructor;
+ CurrentBlock = null;
+ ContainerType = parent.TypeBuilder;
+ InUnsafe = ((parent.ModFlags | code_flags) & Modifiers.UNSAFE) != 0;
+ OnlyLookupTypes = false;
+ loc = l;
+
+ if (ReturnType == TypeManager.void_type)
+ ReturnType = null;
+ }
+
+ public EmitContext (TypeContainer tc, Location l, ILGenerator ig,
+ Type return_type, int code_flags, bool is_constructor)
+ : this (tc, tc, l, ig, return_type, code_flags, is_constructor)
+ {
+ }
+
+ public EmitContext (TypeContainer tc, Location l, ILGenerator ig,
+ Type return_type, int code_flags)
+ : this (tc, tc, l, ig, return_type, code_flags, false)
+ {
+ }
+
+ public void EmitTopBlock (Block block, Location loc)
+ {
+ bool has_ret = false;
+
+// Console.WriteLine ("Emitting: " + loc);
+
+ if (CodeGen.SymbolWriter != null)
+ Mark (loc);
+
+ if (block != null){
+ int errors = Report.Errors;
+
+ block.EmitMeta (this, block);
+
+ if (Report.Errors == errors){
+ has_ret = block.Emit (this);
+
+ if (Report.Errors == errors){
+ if (RootContext.WarningLevel >= 3)
+ block.UsageWarning ();
+ }
+ }
+ }
+
+ if (ReturnType != null && !has_ret){
+ //
+ // FIXME: we need full flow analysis to implement this
+ // correctly and emit an error instead of a warning.
+ //
+ //
+ Report.Error (161, loc, "Not all code paths return a value");
+ return;
+ }
+
+ if (return_value != null){
+ ig.MarkLabel (ReturnLabel);
+ ig.Emit (OpCodes.Ldloc, return_value);
+ ig.Emit (OpCodes.Ret);
+ } else {
+ if (!has_ret){
+ if (!InTry)
+ ig.Emit (OpCodes.Ret);
+ }
+ }
+ }
+
+ /// <summary>
+ /// This is called immediately before emitting an IL opcode to tell the symbol
+ /// writer to which source line this opcode belongs.
+ /// </summary>
+ public void Mark (Location loc)
+ {
+ if (!Location.IsNull (loc)) {
+ ISymbolDocumentWriter doc = loc.SymbolDocument;
+
+ if (doc != null)
+ ig.MarkSequencePoint (doc, loc.Row, 0, loc.Row, 0);
+ } }
+
+
+ /// <summary>
+ /// Returns a temporary storage for a variable of type t as
+ /// a local variable in the current body.
+ /// </summary>
+ public LocalBuilder GetTemporaryStorage (Type t)
+ {
+ LocalBuilder location;
+
+ if (temporary_storage != null){
+ location = (LocalBuilder) temporary_storage [t];
+ if (location != null)
+ return location;
+ }
+
+ location = ig.DeclareLocal (t);
+
+ return location;
+ }
+
+ public void FreeTemporaryStorage (LocalBuilder b)
+ {
+ // Empty for now.
+ }
+
+ /// <summary>
+ /// Current loop begin and end labels.
+ /// </summary>
+ public Label LoopBegin, LoopEnd;
+
+ /// <summary>
+ /// Whether we are inside a loop and break/continue are possible.
+ /// </summary>
+ public bool InLoop;
+
+ /// <summary>
+ /// Default target in a switch statement. Only valid if
+ /// InSwitch is true
+ /// </summary>
+ public Label DefaultTarget;
+
+ /// <summary>
+ /// If this is non-null, points to the current switch statement
+ /// </summary>
+ public Switch Switch;
+
+ /// <summary>
+ /// ReturnValue creates on demand the LocalBuilder for the
+ /// return value from the function. By default this is not
+ /// used. This is only required when returns are found inside
+ /// Try or Catch statements.
+ /// </summary>
+ public LocalBuilder TemporaryReturn ()
+ {
+ if (return_value == null){
+ return_value = ig.DeclareLocal (ReturnType);
+ ReturnLabel = ig.DefineLabel ();
+ }
+
+ return return_value;
+ }
+
+ /// <summary>
+ /// A dynamic This that is shared by all variables in a emitcontext.
+ /// Created on demand.
+ /// </summary>
+ public Expression my_this;
+ public Expression This {
+ get {
+ if (my_this == null)
+ my_this = new This (loc).Resolve (this);
+
+ return my_this;
+ }
+ }
+ }
+}
diff --git a/mcs/mcs/compiler.csproj b/mcs/mcs/compiler.csproj
new file mode 100755
index 00000000000..7707eb5120e
--- /dev/null
+++ b/mcs/mcs/compiler.csproj
@@ -0,0 +1,238 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ ProjectGuid = "{896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "compiler"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Exe"
+ RootNamespace = "CIR"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ />
+ <Reference
+ Name = "System.Web.Services"
+ AssemblyName = "System.Web.Services"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "assign.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "attribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "cfold.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "class.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "codegen.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "const.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "constant.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "cs-parser.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "cs-tokenizer.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "decl.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "delegate.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "driver.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ecore.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "enum.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "expression.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "genericparser.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "interface.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "literal.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "location.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "modifiers.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "namespace.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "parameter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "parameterCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "report.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "rootcontext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "statement.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "statementCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "support.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "tree.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "typemanager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <Folder
+ RelPath = "Web References\"
+ WebReferences = "TRUE"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/mcs/compiler.csproj.user b/mcs/mcs/compiler.csproj.user
new file mode 100755
index 00000000000..3ad35158f42
--- /dev/null
+++ b/mcs/mcs/compiler.csproj.user
@@ -0,0 +1,48 @@
+<VisualStudioProject>
+ <CSHARP>
+ <Build>
+ <Settings ReferencePath = "" >
+ <Config
+ Name = "Debug"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = "@response"
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = "\mono\mcs\mcs"
+ StartWithIE = "false"
+ />
+ <Config
+ Name = "Release"
+ EnableASPDebugging = "false"
+ EnableASPXDebugging = "false"
+ EnableUnmanagedDebugging = "false"
+ EnableSQLServerDebugging = "false"
+ RemoteDebugEnabled = "false"
+ RemoteDebugMachine = ""
+ StartAction = "Project"
+ StartArguments = ""
+ StartPage = ""
+ StartProgram = ""
+ StartURL = ""
+ StartWorkingDirectory = ""
+ StartWithIE = "false"
+ />
+ </Settings>
+ </Build>
+ <OtherProjectSettings
+ CopyProjectDestinationFolder = ""
+ CopyProjectUncPath = ""
+ CopyProjectOption = "0"
+ ProjectView = "ProjectFiles"
+ ProjectTrust = "0"
+ />
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/mcs/compiler.doc b/mcs/mcs/compiler.doc
new file mode 100644
index 00000000000..fafb61ed531
--- /dev/null
+++ b/mcs/mcs/compiler.doc
@@ -0,0 +1,114 @@
+Compiler operation
+
+The compiler has a number of phases:
+
+* Parsing.
+
+ Initially the compiler parses all the source files and keeps a
+ parsed representation in memory. Very syntax error checking
+ is performed at this point.
+
+ The compiler stores the information in classes whose names
+ represent the language construct, for example, the "if"
+ construct is stored in an `If' class. A class is stored in a
+ `Class'.
+
+* The TypeManager
+
+ The TypeManager loads all the assemblies that were referenced
+ by the programmer. The CLR type system is used as our
+ repository for types defined as well.
+
+ So the same interface that is used to query the types,
+ properties and flags about system types is the same interface
+ that we use for our types.
+
+ As we work our way through the code generation and semantic
+ analysis, new types are entered into the Type system through
+ the use of System.Reflection.Emit. The TypeManager will
+ lookup types on both the user defined types and on the system
+ defined ones.
+
+ So special care has to be used. The order in which we
+ proceeed from here is important.
+
+* Base class resolution and type definition.
+
+ Once the parsing has happened, the compiler resolves the
+ inheritance tree for interfaces. This is done recursively
+ and we catch recursive interface definitions here.
+
+ After this is done, we continue on with classes. Classes have
+ can have an optional "parent" inherit from or the implicit
+ System.Object class (for normal builds, builds with /nostdlib
+ will allow you to compile class System.Object with no parent).
+
+ At this point we do some error checking and verify that the
+ inherits/implements section of a class is correct (since we
+ have previously built the interface inheritance).
+
+ By the time we are done, all classes, structs and interfaces
+ have been created using System.Reflection.Emit and registered
+ with the Type Manager.
+
+ This allows us to define fields and resolve argument names for
+ methods, properties, indexers and events.
+
+* Field generation
+
+ Fields are generated next, we go through all the type
+ containers (classes and structs) and enter the fields into
+ their types.
+
+* Method, Properties, Indexers and events definitions
+
+ Now all the methods, constructors, properties, indexers and
+ events are entered. They are only `defined' using
+ System.Reflection.Emit. No code generation will happen until
+ everything has been entered into System.Reflection.Emit.
+
+ This is important because to actually generate code we need to
+ know everything about the environment in which the code is
+ being generated.
+
+* Code Generation
+
+ At this point all the definitions have been entered into the
+ type manager through System.Reflection.Emit. We can now use
+ System.Reflection to query all the information about the
+ types.
+
+ Your normal semantic analysis and code generation phase lives
+ here.
+
+* Statements
+
+ Most of the statements are handled in the codegen.cs file.
+
+* Expressions
+
+* Error reporting
+
+ We should try to use the `Report.Error' and `Report.Warning'
+ classes which are part of the RootContext (there is even a
+ property to access it).
+
+ Error reporting should try to use the same codes that the
+ Microsoft compiler uses (if only so we can track which errors
+ we handle and which ones we dont).
+
+ If there is an error which is specific to MSC, use negative
+ numbers, and register the number in mcs/errors/errors.txt
+
+ Try to write a test case for any error that you run into the
+ code of the compiler if there is none already.
+
+ Put your test case in a file called csNNNN.cs in the
+ mcs/errors directory, and have the first two lines be:
+
+ // csNNNN.cs: This is the description.
+ // Line: XXX
+
+ Where `XXX' is the line where the error ocurrs. We will later
+ use this as a regression test suite for catching errors in the
+ compiler.
diff --git a/mcs/mcs/compiler.sln b/mcs/mcs/compiler.sln
new file mode 100755
index 00000000000..3b94d64a492
--- /dev/null
+++ b/mcs/mcs/compiler.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "compiler", "compiler.csproj", "{896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}.Debug.ActiveCfg = Debug|.NET
+ {896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}.Debug.Build.0 = Debug|.NET
+ {896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}.Release.ActiveCfg = Release|.NET
+ {896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}.Release.Build.0 = Release|.NET
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/mcs/mcs/const.cs b/mcs/mcs/const.cs
new file mode 100755
index 00000000000..e526fff11c6
--- /dev/null
+++ b/mcs/mcs/const.cs
@@ -0,0 +1,172 @@
+//
+// const.cs: Constant declarations.
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+//
+
+//
+// This is needed because the following situation arises:
+//
+// The FieldBuilder is declared with the real type for an enumeration
+//
+// When we attempt to set the value for the constant, the FieldBuilder.SetConstant
+// function aborts because it requires its argument to be of the same type
+//
+
+namespace Mono.CSharp {
+
+ using System;
+ using System.Reflection;
+ using System.Reflection.Emit;
+ using System.Collections;
+
+ public class Const : MemberCore {
+ public readonly string ConstantType;
+ public Expression Expr;
+ public Attributes OptAttributes;
+ public FieldBuilder FieldBuilder;
+
+ object ConstantValue = null;
+ Type type;
+
+ public const int AllowedModifiers =
+ Modifiers.NEW |
+ Modifiers.PUBLIC |
+ Modifiers.PROTECTED |
+ Modifiers.INTERNAL |
+ Modifiers.PRIVATE;
+
+ public Const (string constant_type, string name, Expression expr, int mod_flags,
+ Attributes attrs, Location loc)
+ : base (name, loc)
+ {
+ ConstantType = constant_type;
+ Name = name;
+ Expr = expr;
+ ModFlags = Modifiers.Check (AllowedModifiers, mod_flags, Modifiers.PRIVATE, loc);
+ OptAttributes = attrs;
+ }
+
+ public FieldAttributes FieldAttr {
+ get {
+ return FieldAttributes.Literal | FieldAttributes.Static |
+ Modifiers.FieldAttr (ModFlags) ;
+ }
+ }
+
+#if DEBUG
+ void dump_tree (Type t)
+ {
+ Console.WriteLine ("Dumping hierarchy");
+ while (t != null){
+ Console.WriteLine (" " + t.FullName + " " +
+ (t.GetType ().IsEnum ? "yes" : "no"));
+ t = t.BaseType;
+ }
+ }
+#endif
+
+ /// <summary>
+ /// Defines the constant in the @parent
+ /// </summary>
+ public override bool Define (TypeContainer parent)
+ {
+ type = RootContext.LookupType (parent, ConstantType, true, Location);
+
+ if (type == null)
+ return false;
+
+ if (!TypeManager.IsBuiltinType (type) &&
+ (!type.IsSubclassOf (TypeManager.enum_type))) {
+ Report.Error (
+ -3, Location,
+ "Constant type is not valid (only system types are allowed)");
+ return false;
+ }
+
+ Type ptype = parent.TypeBuilder.BaseType;
+
+ if (ptype != null) {
+ MemberInfo [] mi = TypeContainer.FindMembers (
+ ptype, MemberTypes.Field, BindingFlags.Public,
+ Type.FilterName, Name);
+
+ if (mi == null || mi.Length == 0)
+ if ((ModFlags & Modifiers.NEW) != 0)
+ WarningNotHiding (parent);
+
+ } else if ((ModFlags & Modifiers.NEW) != 0)
+ WarningNotHiding (parent);
+
+ FieldBuilder = parent.TypeBuilder.DefineField (Name, type, FieldAttr);
+
+ TypeManager.RegisterConstant (FieldBuilder, this);
+
+ return true;
+ }
+
+ /// <summary>
+ /// Looks up the value of a constant field. Defines it if it hasn't
+ /// already been. Similar to LookupEnumValue in spirit.
+ /// </summary>
+ public object LookupConstantValue (EmitContext ec)
+ {
+ if (ConstantValue != null)
+ return ConstantValue;
+
+ Expr = Expr.Resolve (ec);
+
+ if (Expr == null) {
+ Report.Error (150, Location, "A constant value is expected");
+ return null;
+ }
+
+ if (!(Expr is Constant)) {
+ Report.Error (150, Location, "A constant value is expected");
+ return null;
+ }
+
+ ConstantValue = ((Constant) Expr).GetValue ();
+
+ if (type.IsEnum){
+ //
+ // This sadly does not work for our user-defined enumerations types ;-(
+ //
+ try {
+ ConstantValue = System.Enum.ToObject (
+ type, ConstantValue);
+ } catch (ArgumentException){
+ Report.Error (
+ -16, Location,
+ ".NET SDK 1.0 does not permit to create the constant "+
+ " field from a user-defined enumeration");
+ }
+ }
+
+ FieldBuilder.SetConstant (ConstantValue);
+
+ if (!TypeManager.RegisterFieldValue (FieldBuilder, ConstantValue))
+ return null;
+
+ return ConstantValue;
+ }
+
+
+ /// <summary>
+ /// Emits the field value by evaluating the expression
+ /// </summary>
+ public void EmitConstant (TypeContainer parent)
+ {
+ EmitContext ec = new EmitContext (parent, Location, null, type, ModFlags);
+ LookupConstantValue (ec);
+
+ return;
+ }
+ }
+}
+
+
diff --git a/mcs/mcs/constant.cs b/mcs/mcs/constant.cs
index 8364173a241..2bfdfc031f5 100755
--- a/mcs/mcs/constant.cs
+++ b/mcs/mcs/constant.cs
@@ -1,48 +1,969 @@
-namespace CIR {
+//
+// constant.cs: Constants.
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+//
+
+namespace Mono.CSharp {
using System;
+ using System.Reflection.Emit;
+
+ /// <summary>
+ /// Base class for constants and literals.
+ /// </summary>
+ public abstract class Constant : Expression {
+ /// <remarks>
+ /// This is different from ToString in that ToString
+ /// is supposed to be there for debugging purposes,
+ /// and is not guaranteed to be useful for anything else,
+ /// AsString() will provide something that can be used
+ /// for round-tripping C# code. Maybe it can be used
+ /// for IL assembly as well.
+ /// </remarks>
+ public abstract string AsString ();
+
+ override public string ToString ()
+ {
+ return this.GetType ().Name + " (" + AsString () + ")";
+ }
+
+ /// <summary>
+ /// This is used to obtain the actual value of the literal
+ /// cast into an object.
+ /// </summary>
+ public abstract object GetValue ();
+
+ /// <summary>
+ /// Constants are always born in a fully resolved state
+ /// </summary>
+ public override Expression DoResolve (EmitContext ec)
+ {
+ return this;
+ }
+
+ //
+ // The various ToXXXX conversion functions are used by the constant
+ // folding evaluator. A null value is returned if the conversion is
+ // not possible.
+ //
+ // Note: not all the patterns for catching `implicit_conv' are the same.
+ // some implicit conversions can never be performed between two types
+ // even if the conversion would be lossless (for example short to uint),
+ // but some conversions are explicitly permitted by the standard provided
+ // that there will be no loss of information (for example, int to uint).
+ //
+ public DoubleConstant ToDouble (Location loc)
+ {
+ DoubleConstant c = ConvertToDouble ();
+
+ if (c == null)
+ Error_CannotConvertImplicit (loc, Type, TypeManager.double_type);
+
+ return c;
+ }
+
+ public FloatConstant ToFloat (Location loc)
+ {
+ FloatConstant c = ConvertToFloat ();
+
+ if (c == null)
+ Error_CannotConvertImplicit (loc, Type, TypeManager.float_type);
+
+ return c;
+ }
+
+ public ULongConstant ToULong (Location loc)
+ {
+ ULongConstant c = ConvertToULong ();
+
+ if (c == null)
+ Error_CannotConvertImplicit (loc, Type, TypeManager.uint64_type);
+
+ return c;
+ }
+
+ public LongConstant ToLong (Location loc)
+ {
+ LongConstant c = ConvertToLong ();
+
+ if (c == null)
+ Error_CannotConvertImplicit (loc, Type, TypeManager.int64_type);
+
+ return c;
+ }
+
+ public UIntConstant ToUInt (Location loc)
+ {
+ UIntConstant c = ConvertToUInt ();
+
+ if (c == null)
+ Error_CannotConvertImplicit (loc, Type, TypeManager.uint32_type);
+
+ return c;
+ }
+
+ public IntConstant ToInt (Location loc)
+ {
+ IntConstant c = ConvertToInt ();
+
+ if (c == null)
+ Error_CannotConvertImplicit (loc, Type, TypeManager.int32_type);
+
+ return c;
+ }
+
+ public virtual DoubleConstant ConvertToDouble ()
+ {
+ return null;
+ }
+
+ public virtual FloatConstant ConvertToFloat ()
+ {
+ return null;
+ }
+
+ public virtual ULongConstant ConvertToULong ()
+ {
+ return null;
+ }
+
+ public virtual LongConstant ConvertToLong ()
+ {
+ return null;
+ }
+
+ public virtual UIntConstant ConvertToUInt ()
+ {
+ return null;
+ }
+
+ public virtual IntConstant ConvertToInt ()
+ {
+ return null;
+ }
+ }
- public class Constant : Expression {
- public string name;
- public Expression expr;
- public TypeRef typeref;
+ public class BoolConstant : Constant {
+ public readonly bool Value;
+
+ public BoolConstant (bool val)
+ {
+ type = TypeManager.bool_type;
+ eclass = ExprClass.Value;
- public const int AllowedModifiers =
- Modifiers.NEW |
- Modifiers.PUBLIC |
- Modifiers.PROTECTED |
- Modifiers.INTERNAL |
- Modifiers.PRIVATE;
+ Value = val;
+ }
- public Constant (TypeRef typeref, string name, Expression expr)
+ override public string AsString ()
{
- this.typeref = typeref;
- this.name = name;
- this.expr = expr;
+ return Value ? "true" : "false";
}
- public void Reduce ()
+ public override object GetValue ()
{
-
+ return (object) Value;
+ }
+
+
+ public override void Emit (EmitContext ec)
+ {
+ if (Value)
+ ec.ig.Emit (OpCodes.Ldc_I4_1);
+ else
+ ec.ig.Emit (OpCodes.Ldc_I4_0);
}
+ }
- public string Name {
- get {
- return name;
- }
+ public class ByteConstant : Constant {
+ public readonly byte Value;
+
+ public ByteConstant (byte v)
+ {
+ type = TypeManager.byte_type;
+ eclass = ExprClass.Value;
+ Value = v;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ IntLiteral.EmitInt (ec.ig, Value);
+ }
+
+ public override string AsString ()
+ {
+ return Value.ToString ();
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return new DoubleConstant (Value);
+ }
+
+ public override FloatConstant ConvertToFloat ()
+ {
+ return new FloatConstant (Value);
+ }
+
+ public override ULongConstant ConvertToULong ()
+ {
+ return new ULongConstant (Value);
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return new LongConstant (Value);
}
- public Type ConstantType {
- get {
- return typeref.Type;
+ public override UIntConstant ConvertToUInt ()
+ {
+ return new UIntConstant (Value);
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return new IntConstant (Value);
+ }
+ }
+
+ public class CharConstant : Constant {
+ public readonly char Value;
+
+ public CharConstant (char v)
+ {
+ type = TypeManager.char_type;
+ eclass = ExprClass.Value;
+ Value = v;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ IntLiteral.EmitInt (ec.ig, Value);
+ }
+
+ static public string descape (char c)
+ {
+ switch (c){
+ case '\a':
+ return "\\a";
+ case '\b':
+ return "\\b";
+ case '\n':
+ return "\\n";
+ case '\t':
+ return "\\t";
+ case '\v':
+ return "\\v";
+ case '\r':
+ return "\\r";
+ case '\\':
+ return "\\\\";
+ case '\f':
+ return "\\f";
+ case '\0':
+ return "\\0";
+ case '"':
+ return "\\\"";
+ case '\'':
+ return "\\\'";
}
+ return c.ToString ();
+ }
+
+ public override string AsString ()
+ {
+ return "\"" + descape (Value) + "\"";
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return new DoubleConstant (Value);
+ }
+
+ public override FloatConstant ConvertToFloat ()
+ {
+ return new FloatConstant (Value);
+ }
+
+ public override ULongConstant ConvertToULong ()
+ {
+ return new ULongConstant (Value);
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return new LongConstant (Value);
+ }
+
+ public override UIntConstant ConvertToUInt ()
+ {
+ return new UIntConstant (Value);
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return new IntConstant (Value);
+ }
+ }
+
+ public class SByteConstant : Constant {
+ public readonly sbyte Value;
+
+ public SByteConstant (sbyte v)
+ {
+ type = TypeManager.sbyte_type;
+ eclass = ExprClass.Value;
+ Value = v;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ IntLiteral.EmitInt (ec.ig, Value);
+ }
+
+ public override string AsString ()
+ {
+ return Value.ToString ();
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return new DoubleConstant (Value);
+ }
+
+ public override FloatConstant ConvertToFloat ()
+ {
+ return new FloatConstant (Value);
+ }
+
+ public override ULongConstant ConvertToULong ()
+ {
+ if (Value >= 0)
+ return new ULongConstant ((ulong) Value);
+
+ return null;
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return new LongConstant (Value);
+ }
+
+ public override UIntConstant ConvertToUInt ()
+ {
+ return null;
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return new IntConstant (Value);
+ }
+ }
+
+ public class ShortConstant : Constant {
+ public readonly short Value;
+
+ public ShortConstant (short v)
+ {
+ type = TypeManager.short_type;
+ eclass = ExprClass.Value;
+ Value = v;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ IntLiteral.EmitInt (ec.ig, Value);
+ }
+
+ public override string AsString ()
+ {
+ return Value.ToString ();
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return new DoubleConstant (Value);
}
- public Expression Expr {
- get {
- return expr;
+ public override FloatConstant ConvertToFloat ()
+ {
+ return new FloatConstant (Value);
+ }
+
+ public override ULongConstant ConvertToULong ()
+ {
+ return null;
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return new LongConstant (Value);
+ }
+
+ public override UIntConstant ConvertToUInt ()
+ {
+ return null;
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return new IntConstant (Value);
+ }
+ }
+
+ public class UShortConstant : Constant {
+ public readonly ushort Value;
+
+ public UShortConstant (ushort v)
+ {
+ type = TypeManager.ushort_type;
+ eclass = ExprClass.Value;
+ Value = v;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ IntLiteral.EmitInt (ec.ig, Value);
+ }
+
+ public override string AsString ()
+ {
+ return Value.ToString ();
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return new DoubleConstant (Value);
+ }
+
+ public override FloatConstant ConvertToFloat ()
+ {
+ return new FloatConstant (Value);
+ }
+
+ public override ULongConstant ConvertToULong ()
+ {
+ return new ULongConstant (Value);
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return new LongConstant (Value);
+ }
+
+ public override UIntConstant ConvertToUInt ()
+ {
+ return new UIntConstant (Value);
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return new IntConstant (Value);
+ }
+ }
+
+ public class IntConstant : Constant {
+ public readonly int Value;
+
+ public IntConstant (int v)
+ {
+ type = TypeManager.int32_type;
+ eclass = ExprClass.Value;
+ Value = v;
+ }
+
+ static public void EmitInt (ILGenerator ig, int i)
+ {
+ switch (i){
+ case -1:
+ ig.Emit (OpCodes.Ldc_I4_M1);
+ break;
+
+ case 0:
+ ig.Emit (OpCodes.Ldc_I4_0);
+ break;
+
+ case 1:
+ ig.Emit (OpCodes.Ldc_I4_1);
+ break;
+
+ case 2:
+ ig.Emit (OpCodes.Ldc_I4_2);
+ break;
+
+ case 3:
+ ig.Emit (OpCodes.Ldc_I4_3);
+ break;
+
+ case 4:
+ ig.Emit (OpCodes.Ldc_I4_4);
+ break;
+
+ case 5:
+ ig.Emit (OpCodes.Ldc_I4_5);
+ break;
+
+ case 6:
+ ig.Emit (OpCodes.Ldc_I4_6);
+ break;
+
+ case 7:
+ ig.Emit (OpCodes.Ldc_I4_7);
+ break;
+
+ case 8:
+ ig.Emit (OpCodes.Ldc_I4_8);
+ break;
+
+ default:
+ if (i >= -128 && i <= 127){
+ ig.Emit (OpCodes.Ldc_I4_S, (sbyte) i);
+ } else
+ ig.Emit (OpCodes.Ldc_I4, i);
+ break;
}
}
+
+ public override void Emit (EmitContext ec)
+ {
+ EmitInt (ec.ig, Value);
+ }
+
+ public override string AsString ()
+ {
+ return Value.ToString ();
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return new DoubleConstant (Value);
+ }
+
+ public override FloatConstant ConvertToFloat ()
+ {
+ return new FloatConstant (Value);
+ }
+
+ public override ULongConstant ConvertToULong ()
+ {
+ if (Value < 0)
+ return null;
+
+ return new ULongConstant ((ulong) Value);
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return new LongConstant (Value);
+ }
+
+ public override UIntConstant ConvertToUInt ()
+ {
+ if (Value < 0)
+ return null;
+
+ return new UIntConstant ((uint) Value);
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return this;
+ }
+ }
+
+ public class UIntConstant : Constant {
+ public readonly uint Value;
+
+ public UIntConstant (uint v)
+ {
+ type = TypeManager.uint32_type;
+ eclass = ExprClass.Value;
+ Value = v;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ IntLiteral.EmitInt (ec.ig, unchecked ((int) Value));
+ }
+
+ public override string AsString ()
+ {
+ return Value.ToString ();
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return new DoubleConstant (Value);
+ }
+
+ public override FloatConstant ConvertToFloat ()
+ {
+ return new FloatConstant (Value);
+ }
+
+ public override ULongConstant ConvertToULong ()
+ {
+ return new ULongConstant (Value);
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return new LongConstant (Value);
+ }
+
+ public override UIntConstant ConvertToUInt ()
+ {
+ return this;
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return null;
+ }
+ }
+
+ public class LongConstant : Constant {
+ public readonly long Value;
+
+ public LongConstant (long v)
+ {
+ type = TypeManager.int64_type;
+ eclass = ExprClass.Value;
+ Value = v;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+
+ EmitLong (ig, Value);
+ }
+
+ static public void EmitLong (ILGenerator ig, long l)
+ {
+ ig.Emit (OpCodes.Ldc_I8, l);
+ }
+
+ public override string AsString ()
+ {
+ return Value.ToString ();
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return new DoubleConstant (Value);
+ }
+
+ public override FloatConstant ConvertToFloat ()
+ {
+ return new FloatConstant (Value);
+ }
+
+ public override ULongConstant ConvertToULong ()
+ {
+ if (Value < 0)
+ return null;
+
+ return new ULongConstant ((ulong) Value);
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return this;
+ }
+
+ public override UIntConstant ConvertToUInt ()
+ {
+ return null;
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return null;
+ }
+ }
+
+ public class ULongConstant : Constant {
+ public readonly ulong Value;
+
+ public ULongConstant (ulong v)
+ {
+ type = TypeManager.uint64_type;
+ eclass = ExprClass.Value;
+ Value = v;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+
+ LongLiteral.EmitLong (ig, unchecked ((long) Value));
+ }
+
+ public override string AsString ()
+ {
+ return Value.ToString ();
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return new DoubleConstant (Value);
+ }
+
+ public override FloatConstant ConvertToFloat ()
+ {
+ return new FloatConstant (Value);
+ }
+
+ public override ULongConstant ConvertToULong ()
+ {
+ return this;
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return null;
+ }
+
+ public override UIntConstant ConvertToUInt ()
+ {
+ return null;
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return null;
+ }
+ }
+
+ public class FloatConstant : Constant {
+ public readonly float Value;
+
+ public FloatConstant (float v)
+ {
+ type = TypeManager.float_type;
+ eclass = ExprClass.Value;
+ Value = v;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ec.ig.Emit (OpCodes.Ldc_R4, Value);
+ }
+
+ public override string AsString ()
+ {
+ return Value.ToString ();
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return new DoubleConstant (Value);
+ }
+
+ public override FloatConstant ConvertToFloat ()
+ {
+ return this;
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return null;
+ }
+
+ public override UIntConstant ConvertToUInt ()
+ {
+ return null;
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return null;
+ }
+ }
+
+ public class DoubleConstant : Constant {
+ public readonly double Value;
+
+ public DoubleConstant (double v)
+ {
+ type = TypeManager.double_type;
+ eclass = ExprClass.Value;
+ Value = v;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ec.ig.Emit (OpCodes.Ldc_R8, Value);
+ }
+
+ public override string AsString ()
+ {
+ return Value.ToString ();
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return this;
+ }
+
+ public override FloatConstant ConvertToFloat ()
+ {
+ return null;
+ }
+
+ public override ULongConstant ConvertToULong ()
+ {
+ return null;
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return null;
+ }
+
+ public override UIntConstant ConvertToUInt ()
+ {
+ return null;
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return null;
+ }
}
+
+ public class DecimalConstant : Constant {
+ public readonly decimal Value;
+
+ public DecimalConstant (decimal d)
+ {
+ type = TypeManager.decimal_type;
+ eclass = ExprClass.Value;
+ Value = d;
+ }
+
+ override public string AsString ()
+ {
+ return Value.ToString ();
+ }
+
+ public override object GetValue ()
+ {
+ return (object) Value;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ int [] words = Decimal.GetBits (Value);
+
+ //
+ // FIXME: we could optimize this, and call a better
+ // constructor
+ //
+
+ ILGenerator ig = ec.ig;
+
+ IntConstant.EmitInt (ig, words [0]);
+ IntConstant.EmitInt (ig, words [1]);
+ IntConstant.EmitInt (ig, words [2]);
+
+ // sign
+ IntConstant.EmitInt (ig, words [3] >> 31);
+
+ // power
+ IntConstant.EmitInt (ig, (words [3] >> 16) & 0xff);
+
+ ig.Emit (OpCodes.Newobj, TypeManager.void_decimal_ctor_five_args);
+ }
+ }
+
+ public class StringConstant : Constant {
+ public readonly string Value;
+
+ public StringConstant (string s)
+ {
+ type = TypeManager.string_type;
+ eclass = ExprClass.Value;
+ Value = s;
+ }
+
+ // FIXME: Escape the string.
+ override public string AsString ()
+ {
+ return "\"" + Value + "\"";
+ }
+
+ public override object GetValue ()
+ {
+ return Value;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ec.ig.Emit (OpCodes.Ldstr, Value);
+ }
+ }
+
}
+
diff --git a/mcs/mcs/cs-parser.cs b/mcs/mcs/cs-parser.cs
deleted file mode 100755
index 90add9f4dd5..00000000000
--- a/mcs/mcs/cs-parser.cs
+++ /dev/null
@@ -1,5531 +0,0 @@
-// created by jay 0.7 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
-
-#line 1 "cs-parser.jay"
-
-//
-// cs-parser.jay: The Parser for the C# compiler
-//
-// Author: Miguel de Icaza (miguel@gnu.org)
-//
-// Licensed under the terms of the GNU GPL
-//
-// (C) 2001 Ximian, Inc (http://www.ximian.com)
-//
-// TODO:
-// (1) Get rid of the *Collections.cs, that is an idea I took from System.CodeDOM
-// And come to think of it, it is not that great, it duplicates a lot of code
-// for something which is not really needed. We still have piles of typecasts
-// anwyays (due to the nature of the stack being a collection of Objects).
-//
-// (2) Figure out why error productions dont work. `type-declaration' is a
-// great spot to put an `error' because you can reproduce it with this input:
-// "public X { }"
-//
-// (3) Move Modifier checking from each object into the parser itself, that will
-// get rid of the global "error" symbol that we use now to report errors.
-// We still need to pass a pointer to the tree.ErrorHandler, but that is a
-// separate problem
-//
-using System.Text;
-using CSC;
-using System;
-
-namespace CSC
-{
- using System.Collections;
- using Compiler;
- using CSC;
- using CIR;
-
- /// <summary>
- /// The C# Parser
- /// </summary>
- public class CSharpParser : Parser {
- static int global_errors;
-
- Namespace current_namespace;
- TypeContainer current_container;
-
- // <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>
- Interface current_interface;
-
- // <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" accesor
- // method
- // </summary>
- ParameterCollection implicit_value_parameters;
-
- // <summary>
- // Here we keep track of type references.
- // </summary>
- TypeRefManager type_references;
-#line 81 "-"
-
- /** simplified error message.
- @see <a href="#yyerror(java.lang.String, java.lang.String[])">yyerror</a>
- */
- public void yyerror (string message) {
- yyerror(message, null);
- }
-
- /** (syntax) error message.
- Can be overwritten to control message format.
- @param message text to be displayed.
- @param expected vector of acceptable tokens, if available.
- */
- public void yyerror (string message, string[] expected) {
- string res;
- if ((expected != null) && (expected.Length > 0)) {
- res = message+", expecting";
- for (int n = 0; n < expected.Length; ++ n)
- res += " "+expected[n];
- } else
- res = message;
- throw new Exception (res);
- }
-
- /** debugging support, requires the package jay.yydebug.
- Set to null to suppress debugging messages.
- */
- protected yydebug.yyDebug yydebug;
-
- protected static int yyFinal = 2;
- public static string [] yyRule = {
- "$accept : compilation_unit",
- "compilation_unit : opt_using_directives opt_attributes opt_namespace_member_declarations EOF",
- "using_directives : using_directive",
- "using_directives : using_directives using_directive",
- "using_directive : using_alias_directive",
- "using_directive : using_namespace_directive",
- "using_alias_directive : USING IDENTIFIER ASSIGN namespace_or_type_name SEMICOLON",
- "using_namespace_directive : USING namespace_name SEMICOLON",
- "namespace_declarations : namespace_declaration",
- "namespace_declarations : namespace_declarations namespace_declaration",
- "$$1 :",
- "namespace_declaration : NAMESPACE qualified_identifier $$1 namespace_body opt_semicolon",
- "opt_semicolon :",
- "opt_semicolon : SEMICOLON",
- "opt_comma :",
- "opt_comma : COMMA",
- "qualified_identifier : IDENTIFIER",
- "qualified_identifier : qualified_identifier DOT IDENTIFIER",
- "namespace_name : namespace_or_type_name",
- "namespace_body : OPEN_BRACE opt_using_directives opt_namespace_member_declarations CLOSE_BRACE",
- "opt_using_directives :",
- "opt_using_directives : using_directives",
- "opt_namespace_member_declarations :",
- "opt_namespace_member_declarations : namespace_member_declarations",
- "namespace_member_declarations : namespace_member_declaration",
- "namespace_member_declarations : namespace_member_declarations namespace_member_declaration",
- "namespace_member_declaration : type_declaration",
- "namespace_member_declaration : namespace_declaration",
- "type_declaration : class_declaration",
- "type_declaration : struct_declaration",
- "type_declaration : interface_declaration",
- "type_declaration : enum_declaration",
- "type_declaration : delegate_declaration",
- "opt_attributes :",
- "opt_attributes : attributes",
- "attributes : attribute_sections",
- "attribute_sections : attribute_section",
- "attribute_sections : attribute_sections attribute_section",
- "attribute_section : OPEN_BRACKET opt_attribute_target_specifier attribute_list CLOSE_BRACKET",
- "opt_attribute_target_specifier :",
- "opt_attribute_target_specifier : attribute_target_specifier",
- "attribute_target_specifier : attribute_target COLON",
- "attribute_target : IDENTIFIER",
- "attribute_target : EVENT",
- "attribute_target : RETURN",
- "attribute_list : attribute",
- "attribute_list : attribute_list COMMA attribute",
- "attribute : attribute_name",
- "attribute : opt_attribute_arguments",
- "attribute_name : type_name",
- "opt_attribute_arguments :",
- "opt_attribute_arguments : OPEN_PARENS attribute_arguments CLOSE_PARENS",
- "attribute_arguments : expression",
- "attribute_arguments : attribute_arguments COMMA expression",
- "opt_dimension_separators :",
- "opt_dimension_separators : dimension_separators",
- "dimension_separators : COMMA",
- "dimension_separators : dimension_separators COMMA",
- "class_body : OPEN_BRACE opt_class_member_declarations CLOSE_BRACE",
- "opt_class_member_declarations :",
- "opt_class_member_declarations : class_member_declarations",
- "class_member_declarations : class_member_declaration",
- "class_member_declarations : class_member_declarations class_member_declaration",
- "class_member_declaration : constant_declaration",
- "class_member_declaration : field_declaration",
- "class_member_declaration : method_declaration",
- "class_member_declaration : property_declaration",
- "class_member_declaration : event_declaration",
- "class_member_declaration : indexer_declaration",
- "class_member_declaration : operator_declaration",
- "class_member_declaration : constructor_declaration",
- "class_member_declaration : destructor_declaration",
- "class_member_declaration : type_declaration",
- "$$2 :",
- "struct_declaration : opt_attributes opt_modifiers STRUCT IDENTIFIER $$2 opt_struct_interfaces struct_body opt_semicolon",
- "opt_struct_interfaces :",
- "opt_struct_interfaces : struct_interfaces",
- "struct_interfaces : struct_interface",
- "struct_interfaces : struct_interfaces struct_interface",
- "struct_interface : COLON type_list",
- "struct_body : OPEN_BRACE opt_struct_member_declarations CLOSE_BRACE",
- "opt_struct_member_declarations :",
- "opt_struct_member_declarations : struct_member_declarations",
- "struct_member_declarations : struct_member_declaration",
- "struct_member_declarations : struct_member_declarations struct_member_declaration",
- "struct_member_declaration : constant_declaration",
- "struct_member_declaration : field_declaration",
- "struct_member_declaration : method_declaration",
- "struct_member_declaration : property_declaration",
- "struct_member_declaration : event_declaration",
- "struct_member_declaration : indexer_declaration",
- "struct_member_declaration : operator_declaration",
- "struct_member_declaration : constructor_declaration",
- "struct_member_declaration : type_declaration",
- "constant_declaration : opt_attributes opt_modifiers CONST type constant_declarators SEMICOLON",
- "constant_declarators : constant_declarator",
- "constant_declarators : constant_declarators COMMA constant_declarator",
- "constant_declarator : IDENTIFIER ASSIGN constant_expression",
- "field_declaration : opt_attributes opt_modifiers type variable_declarators SEMICOLON",
- "variable_declarators : variable_declarator",
- "variable_declarators : variable_declarators COMMA variable_declarator",
- "variable_declarator : IDENTIFIER ASSIGN variable_initializer",
- "variable_declarator : IDENTIFIER",
- "variable_initializer : expression",
- "variable_initializer : array_initializer",
- "method_declaration : method_header method_body",
- "method_header : opt_attributes opt_modifiers type member_name OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS",
- "method_header : opt_attributes opt_modifiers VOID member_name OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS",
- "method_body : block",
- "method_body : SEMICOLON",
- "opt_formal_parameter_list :",
- "opt_formal_parameter_list : formal_parameter_list",
- "formal_parameter_list : fixed_parameters",
- "formal_parameter_list : fixed_parameters COMMA parameter_array",
- "formal_parameter_list : parameter_array",
- "fixed_parameters : fixed_parameter",
- "fixed_parameters : fixed_parameters COMMA fixed_parameter",
- "fixed_parameter : opt_attributes opt_parameter_modifier type IDENTIFIER",
- "opt_parameter_modifier :",
- "opt_parameter_modifier : parameter_modifier",
- "parameter_modifier : REF",
- "parameter_modifier : OUT",
- "parameter_array : opt_attributes PARAMS type IDENTIFIER",
- "member_name : IDENTIFIER",
- "member_name : interface_type DOT IDENTIFIER",
- "$$3 :",
- "$$4 :",
- "property_declaration : opt_attributes opt_modifiers type member_name OPEN_BRACE $$3 accessor_declarations $$4 CLOSE_BRACE",
- "accessor_declarations : get_accessor_declaration opt_set_accessor_declaration",
- "accessor_declarations : set_accessor_declaration opt_get_accessor_declaration",
- "opt_get_accessor_declaration :",
- "opt_get_accessor_declaration : get_accessor_declaration",
- "opt_set_accessor_declaration :",
- "opt_set_accessor_declaration : set_accessor_declaration",
- "get_accessor_declaration : opt_attributes GET accessor_body",
- "$$5 :",
- "set_accessor_declaration : opt_attributes SET $$5 accessor_body",
- "accessor_body : block",
- "accessor_body : SEMICOLON",
- "$$6 :",
- "interface_declaration : opt_attributes opt_modifiers INTERFACE IDENTIFIER $$6 opt_interface_base interface_body",
- "opt_interface_base :",
- "opt_interface_base : interface_base",
- "interface_base : COLON interface_type_list",
- "interface_type_list : interface_type",
- "interface_type_list : interface_type_list COMMA interface_type",
- "interface_body : OPEN_BRACE opt_interface_member_declarations CLOSE_BRACE",
- "opt_interface_member_declarations :",
- "opt_interface_member_declarations : interface_member_declarations",
- "interface_member_declarations : interface_member_declaration",
- "interface_member_declarations : interface_member_declarations interface_member_declaration",
- "interface_member_declaration : interface_method_declaration",
- "interface_member_declaration : interface_property_declaration",
- "interface_member_declaration : interface_event_declaration",
- "interface_member_declaration : interface_indexer_declaration",
- "opt_new :",
- "opt_new : NEW",
- "interface_method_declaration : opt_attributes opt_new type IDENTIFIER OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS SEMICOLON",
- "interface_method_declaration : opt_attributes opt_new VOID IDENTIFIER OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS SEMICOLON",
- "$$7 :",
- "$$8 :",
- "interface_property_declaration : opt_attributes opt_new type IDENTIFIER OPEN_BRACE $$7 interface_accesors $$8 CLOSE_BRACE",
- "interface_accesors : opt_attributes GET SEMICOLON",
- "interface_accesors : opt_attributes SET SEMICOLON",
- "interface_accesors : opt_attributes GET SEMICOLON opt_attributes SET SEMICOLON",
- "interface_accesors : opt_attributes SET SEMICOLON opt_attributes GET SEMICOLON",
- "interface_event_declaration : opt_attributes opt_new EVENT type IDENTIFIER SEMICOLON",
- "$$9 :",
- "$$10 :",
- "interface_indexer_declaration : opt_attributes opt_new type THIS OPEN_BRACKET formal_parameter_list CLOSE_BRACKET OPEN_BRACE $$9 interface_accesors $$10 CLOSE_BRACE",
- "operator_declaration : opt_attributes opt_modifiers operator_declarator block",
- "operator_declarator : type OPERATOR overloadable_operator OPEN_PARENS type IDENTIFIER CLOSE_PARENS",
- "operator_declarator : type OPERATOR overloadable_operator OPEN_PARENS type IDENTIFIER COMMA type IDENTIFIER CLOSE_PARENS",
- "operator_declarator : conversion_operator_declarator",
- "overloadable_operator : BANG",
- "overloadable_operator : TILDE",
- "overloadable_operator : OP_INC",
- "overloadable_operator : OP_DEC",
- "overloadable_operator : TRUE",
- "overloadable_operator : FALSE",
- "overloadable_operator : PLUS",
- "overloadable_operator : MINUS",
- "overloadable_operator : STAR",
- "overloadable_operator : DIV",
- "overloadable_operator : PERCENT",
- "overloadable_operator : BITWISE_AND",
- "overloadable_operator : BITWISE_OR",
- "overloadable_operator : CARRET",
- "overloadable_operator : OP_SHIFT_LEFT",
- "overloadable_operator : OP_SHIFT_RIGHT",
- "overloadable_operator : OP_EQ",
- "overloadable_operator : OP_NE",
- "overloadable_operator : OP_GT",
- "overloadable_operator : OP_LT",
- "overloadable_operator : OP_GE",
- "overloadable_operator : OP_LE",
- "conversion_operator_declarator : IMPLICIT OPERATOR type OPEN_PARENS type IDENTIFIER CLOSE_PARENS",
- "conversion_operator_declarator : EXPLICIT OPERATOR type OPEN_PARENS type IDENTIFIER CLOSE_PARENS",
- "constructor_declaration : opt_attributes opt_modifiers constructor_declarator block",
- "constructor_declarator : IDENTIFIER OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS opt_constructor_initializer",
- "opt_constructor_initializer :",
- "opt_constructor_initializer : constructor_initializer",
- "constructor_initializer : COLON BASE OPEN_PARENS opt_argument_list CLOSE_PARENS",
- "constructor_initializer : COLON THIS OPEN_PARENS opt_argument_list CLOSE_PARENS",
- "destructor_declaration : opt_attributes TILDE IDENTIFIER OPEN_PARENS CLOSE_PARENS block",
- "event_declaration : opt_attributes opt_modifiers EVENT type variable_declarators SEMICOLON",
- "event_declaration : opt_attributes opt_modifiers EVENT type member_name OPEN_BRACE event_accesor_declarations CLOSE_BRACE SEMICOLON",
- "event_accesor_declarations : add_accessor_declaration remove_accessor_declaration",
- "event_accesor_declarations : remove_accessor_declaration add_accessor_declaration",
- "add_accessor_declaration : opt_attributes ADD block",
- "remove_accessor_declaration : opt_attributes REMOVE block",
- "indexer_declaration : opt_attributes opt_modifiers indexer_declarator OPEN_BRACE accessor_declarations CLOSE_BRACE",
- "indexer_declarator : type THIS OPEN_BRACKET formal_parameter_list CLOSE_BRACKET",
- "indexer_declarator : type interface_type DOT THIS OPEN_BRACKET formal_parameter_list CLOSE_BRACKET",
- "enum_declaration : opt_attributes opt_modifiers ENUM IDENTIFIER opt_enum_base enum_body opt_semicolon",
- "opt_enum_base :",
- "opt_enum_base : COLON integral_type",
- "enum_body : OPEN_BRACE opt_enum_member_declarations CLOSE_BRACE",
- "enum_body : OPEN_BRACE enum_member_declarations COMMA CLOSE_BRACE",
- "opt_enum_member_declarations :",
- "opt_enum_member_declarations : enum_member_declarations",
- "enum_member_declarations : enum_member_declaration",
- "enum_member_declarations : enum_member_declarations COMMA enum_member_declaration",
- "enum_member_declaration : opt_attributes IDENTIFIER",
- "enum_member_declaration : opt_attributes IDENTIFIER ASSIGN expression",
- "delegate_declaration : opt_attributes opt_modifiers DELEGATE type IDENTIFIER OPEN_PARENS formal_parameter_list CLOSE_PARENS SEMICOLON",
- "type_name : namespace_or_type_name",
- "namespace_or_type_name : qualified_identifier",
- "type : type_name",
- "type : builtin_types",
- "type : array_type",
- "type_list : type",
- "type_list : type_list type",
- "builtin_types : OBJECT",
- "builtin_types : STRING",
- "builtin_types : BOOL",
- "builtin_types : DECIMAL",
- "builtin_types : FLOAT",
- "builtin_types : DOUBLE",
- "builtin_types : integral_type",
- "integral_type : SBYTE",
- "integral_type : BYTE",
- "integral_type : SHORT",
- "integral_type : USHORT",
- "integral_type : INT",
- "integral_type : UINT",
- "integral_type : LONG",
- "integral_type : ULONG",
- "integral_type : CHAR",
- "interface_type : type_name",
- "array_type : type rank_specifiers",
- "primary_expression : literal",
- "primary_expression : qualified_identifier",
- "primary_expression : parenthesized_expression",
- "primary_expression : member_access",
- "primary_expression : invocation_expression",
- "primary_expression : element_access",
- "primary_expression : this_access",
- "primary_expression : base_access",
- "primary_expression : post_increment_expression",
- "primary_expression : post_decrement_expression",
- "primary_expression : new_expression",
- "primary_expression : typeof_expression",
- "primary_expression : sizeof_expression",
- "primary_expression : checked_expression",
- "primary_expression : unchecked_expression",
- "literal : boolean_literal",
- "literal : integer_literal",
- "literal : real_literal",
- "literal : LITERAL_CHARACTER",
- "literal : LITERAL_STRING",
- "literal : NULL",
- "real_literal : LITERAL_FLOAT",
- "real_literal : LITERAL_DOUBLE",
- "real_literal : LITERAL_DECIMAL",
- "integer_literal : LITERAL_INTEGER",
- "boolean_literal : TRUE",
- "boolean_literal : FALSE",
- "parenthesized_expression : OPEN_PARENS expression CLOSE_PARENS",
- "member_access : primary_expression DOT IDENTIFIER",
- "member_access : predefined_type DOT IDENTIFIER",
- "predefined_type : builtin_types",
- "invocation_expression : primary_expression OPEN_PARENS opt_argument_list CLOSE_PARENS",
- "opt_argument_list :",
- "opt_argument_list : argument_list",
- "argument_list : argument",
- "argument_list : argument_list COMMA argument",
- "argument : expression",
- "argument : REF variable_reference",
- "argument : OUT variable_reference",
- "variable_reference : expression",
- "element_access : primary_expression OPEN_BRACKET expression_list CLOSE_BRACKET",
- "expression_list : expression",
- "expression_list : expression_list COMMA expression",
- "this_access : THIS",
- "base_access : BASE DOT IDENTIFIER",
- "base_access : BASE OPEN_BRACKET expression_list CLOSE_BRACKET",
- "post_increment_expression : primary_expression OP_INC",
- "post_decrement_expression : primary_expression OP_DEC",
- "new_expression : object_or_delegate_creation_expression",
- "new_expression : array_creation_expression",
- "object_or_delegate_creation_expression : NEW type OPEN_PARENS opt_argument_list CLOSE_PARENS",
- "array_creation_expression : NEW type OPEN_BRACKET expression_list CLOSE_BRACKET opt_rank_specifier opt_array_initializer",
- "opt_rank_specifier :",
- "opt_rank_specifier : rank_specifiers",
- "rank_specifiers : rank_specifier",
- "rank_specifiers : rank_specifiers rank_specifier",
- "rank_specifier : OPEN_BRACKET opt_dim_separators CLOSE_BRACKET",
- "opt_dim_separators :",
- "opt_dim_separators : dim_separators",
- "dim_separators : COMMA",
- "dim_separators : dim_separators COMMA",
- "opt_array_initializer :",
- "opt_array_initializer : array_initializer",
- "array_initializer : OPEN_BRACE CLOSE_BRACE",
- "array_initializer : OPEN_BRACE variable_initializer_list CLOSE_BRACE",
- "array_initializer : OPEN_BRACE variable_initializer_list COMMA CLOSE_BRACE",
- "variable_initializer_list : variable_initializer",
- "variable_initializer_list : variable_initializer_list COMMA variable_initializer",
- "typeof_expression : TYPEOF OPEN_PARENS type CLOSE_PARENS",
- "sizeof_expression : SIZEOF OPEN_PARENS type CLOSE_PARENS",
- "checked_expression : CHECKED OPEN_PARENS expression CLOSE_PARENS",
- "unchecked_expression : UNCHECKED OPEN_PARENS expression CLOSE_PARENS",
- "unary_expression : primary_expression",
- "unary_expression : PLUS unary_expression",
- "unary_expression : MINUS unary_expression",
- "unary_expression : BANG unary_expression",
- "unary_expression : TILDE unary_expression",
- "unary_expression : STAR unary_expression",
- "unary_expression : BITWISE_AND unary_expression",
- "unary_expression : pre_increment_expression",
- "unary_expression : pre_decrement_expression",
- "unary_expression : cast_expression",
- "pre_increment_expression : OP_INC unary_expression",
- "pre_decrement_expression : OP_DEC unary_expression",
- "cast_expression : OPEN_PARENS qualified_identifier CLOSE_PARENS unary_expression",
- "cast_expression : OPEN_PARENS builtin_types CLOSE_PARENS unary_expression",
- "multiplicative_expression : unary_expression",
- "multiplicative_expression : multiplicative_expression STAR unary_expression",
- "multiplicative_expression : multiplicative_expression DIV unary_expression",
- "multiplicative_expression : multiplicative_expression PERCENT unary_expression",
- "additive_expression : multiplicative_expression",
- "additive_expression : additive_expression PLUS multiplicative_expression",
- "additive_expression : additive_expression MINUS multiplicative_expression",
- "shift_expression : additive_expression",
- "shift_expression : shift_expression OP_SHIFT_LEFT additive_expression",
- "shift_expression : shift_expression OP_SHIFT_RIGHT additive_expression",
- "relational_expression : shift_expression",
- "relational_expression : relational_expression OP_LT shift_expression",
- "relational_expression : relational_expression OP_GT shift_expression",
- "relational_expression : relational_expression OP_LE shift_expression",
- "relational_expression : relational_expression OP_GE shift_expression",
- "relational_expression : relational_expression IS type",
- "relational_expression : relational_expression AS type",
- "equality_expression : relational_expression",
- "equality_expression : equality_expression OP_EQ relational_expression",
- "equality_expression : equality_expression OP_NE relational_expression",
- "and_expression : equality_expression",
- "and_expression : and_expression BITWISE_AND equality_expression",
- "exclusive_or_expression : and_expression",
- "exclusive_or_expression : exclusive_or_expression CARRET and_expression",
- "inclusive_or_expression : exclusive_or_expression",
- "inclusive_or_expression : inclusive_or_expression BITWISE_OR exclusive_or_expression",
- "conditional_and_expression : inclusive_or_expression",
- "conditional_and_expression : conditional_and_expression OP_AND inclusive_or_expression",
- "conditional_or_expression : conditional_and_expression",
- "conditional_or_expression : conditional_or_expression OP_OR conditional_and_expression",
- "conditional_expression : conditional_or_expression",
- "conditional_expression : conditional_or_expression INTERR expression COLON expression",
- "assignment_expression : unary_expression ASSIGN expression",
- "assignment_expression : unary_expression OP_MULT_ASSIGN expression",
- "assignment_expression : unary_expression OP_DIV_ASSIGN expression",
- "assignment_expression : unary_expression OP_MOD_ASSIGN expression",
- "assignment_expression : unary_expression OP_ADD_ASSIGN expression",
- "assignment_expression : unary_expression OP_SUB_ASSIGN expression",
- "assignment_expression : unary_expression OP_SHIFT_LEFT_ASSIGN expression",
- "assignment_expression : unary_expression OP_SHIFT_RIGHT_ASSIGN expression",
- "assignment_expression : unary_expression OP_AND_ASSIGN expression",
- "assignment_expression : unary_expression OP_OR_ASSIGN expression",
- "assignment_expression : unary_expression OP_XOR_ASSIGN expression",
- "expression : conditional_expression",
- "expression : assignment_expression",
- "constant_expression : expression",
- "boolean_expression : expression",
- "$$11 :",
- "class_declaration : opt_attributes opt_modifiers CLASS IDENTIFIER $$11 opt_class_base class_body opt_semicolon",
- "opt_modifiers :",
- "opt_modifiers : modifiers",
- "modifiers : modifier",
- "modifiers : modifiers modifier",
- "modifier : NEW",
- "modifier : PUBLIC",
- "modifier : PROTECTED",
- "modifier : INTERNAL",
- "modifier : PRIVATE",
- "modifier : ABSTRACT",
- "modifier : SEALED",
- "modifier : STATIC",
- "modifier : READONLY",
- "modifier : VIRTUAL",
- "modifier : OVERRIDE",
- "modifier : EXTERN",
- "opt_class_base :",
- "opt_class_base : class_base",
- "class_base : COLON type_list",
- "$$12 :",
- "block : OPEN_BRACE $$12 opt_statement_list CLOSE_BRACE",
- "opt_statement_list :",
- "opt_statement_list : statement_list",
- "statement_list : statement",
- "statement_list : statement_list statement",
- "statement : declaration_statement",
- "statement : embedded_statement",
- "statement : labeled_statement",
- "embedded_statement : block",
- "embedded_statement : empty_statement",
- "embedded_statement : expression_statement",
- "embedded_statement : selection_statement",
- "embedded_statement : iteration_statement",
- "embedded_statement : jump_statement",
- "embedded_statement : try_statement",
- "embedded_statement : checked_statement",
- "embedded_statement : unchecked_statement",
- "embedded_statement : lock_statement",
- "embedded_statement : using_statement",
- "empty_statement : SEMICOLON",
- "labeled_statement : IDENTIFIER COLON statement",
- "declaration_statement : local_variable_declaration SEMICOLON",
- "declaration_statement : local_constant_declaration SEMICOLON",
- "local_variable_type : primary_expression type_suffixes",
- "local_variable_type : builtin_types type_suffixes",
- "local_variable_type : VOID type_suffixes",
- "type_suffixes :",
- "type_suffixes : type_suffix_list",
- "type_suffix_list : type_suffix",
- "type_suffix_list : type_suffix_list type_suffix",
- "type_suffix : OPEN_BRACKET opt_dim_separators CLOSE_BRACKET",
- "local_variable_declaration : local_variable_type variable_declarators",
- "local_constant_declaration : CONST type constant_declarator",
- "expression_statement : statement_expression SEMICOLON",
- "statement_expression : invocation_expression",
- "statement_expression : object_creation_expression",
- "statement_expression : assignment_expression",
- "statement_expression : post_increment_expression",
- "statement_expression : post_decrement_expression",
- "statement_expression : pre_increment_expression",
- "statement_expression : pre_decrement_expression",
- "object_creation_expression : object_or_delegate_creation_expression",
- "selection_statement : if_statement",
- "selection_statement : switch_statement",
- "if_statement : IF OPEN_PARENS boolean_expression CLOSE_PARENS embedded_statement",
- "if_statement : IF OPEN_PARENS boolean_expression CLOSE_PARENS embedded_statement ELSE embedded_statement",
- "switch_statement : SWITCH OPEN_PARENS expression CLOSE_PARENS switch_block",
- "switch_block : OPEN_BRACE opt_switch_sections CLOSE_BRACE",
- "opt_switch_sections :",
- "opt_switch_sections : switch_sections",
- "switch_sections : switch_section",
- "switch_sections : switch_sections switch_section",
- "$$13 :",
- "switch_section : switch_labels $$13 statement_list",
- "switch_labels : switch_label",
- "switch_labels : switch_labels switch_label",
- "switch_label : CASE constant_expression COLON",
- "switch_label : DEFAULT COLON",
- "iteration_statement : while_statement",
- "iteration_statement : do_statement",
- "iteration_statement : for_statement",
- "iteration_statement : foreach_statement",
- "while_statement : WHILE OPEN_PARENS boolean_expression CLOSE_PARENS embedded_statement",
- "do_statement : DO embedded_statement WHILE OPEN_PARENS boolean_expression CLOSE_PARENS SEMICOLON",
- "for_statement : FOR OPEN_PARENS opt_for_initializer SEMICOLON opt_for_condition SEMICOLON opt_for_iterator CLOSE_PARENS embedded_statement",
- "opt_for_initializer :",
- "opt_for_initializer : for_initializer",
- "for_initializer : local_variable_declaration",
- "for_initializer : statement_expression_list",
- "opt_for_condition :",
- "opt_for_condition : boolean_expression",
- "opt_for_iterator :",
- "opt_for_iterator : for_iterator",
- "for_iterator : statement_expression_list",
- "statement_expression_list : statement_expression",
- "statement_expression_list : statement_expression_list COMMA statement_expression",
- "foreach_statement : FOREACH OPEN_PARENS type IDENTIFIER IN expression CLOSE_PARENS embedded_statement",
- "jump_statement : break_statement",
- "jump_statement : continue_statement",
- "jump_statement : goto_statement",
- "jump_statement : return_statement",
- "jump_statement : throw_statement",
- "break_statement : BREAK SEMICOLON",
- "continue_statement : CONTINUE SEMICOLON",
- "goto_statement : GOTO IDENTIFIER SEMICOLON",
- "goto_statement : GOTO CASE constant_expression SEMICOLON",
- "goto_statement : GOTO DEFAULT SEMICOLON",
- "return_statement : RETURN opt_expression SEMICOLON",
- "throw_statement : THROW opt_expression SEMICOLON",
- "opt_expression :",
- "opt_expression : expression",
- "try_statement : TRY block catch_clauses",
- "try_statement : TRY block finalize_clause",
- "try_statement : TRY block catch_clauses finalize_clause",
- "catch_clauses : specific_catch_clauses opt_general_catch_clause",
- "catch_clauses : opt_specific_catch_clauses general_catch_clause",
- "opt_general_catch_clause :",
- "opt_general_catch_clause : general_catch_clause",
- "opt_specific_catch_clauses :",
- "opt_specific_catch_clauses : specific_catch_clauses",
- "specific_catch_clauses : specific_catch_clause",
- "specific_catch_clauses : specific_catch_clauses specific_catch_clause",
- "specific_catch_clause : CATCH OPEN_PARENS type opt_identifier CLOSE_PARENS block",
- "opt_identifier :",
- "opt_identifier : IDENTIFIER",
- "general_catch_clause : CATCH block",
- "finalize_clause : FINALLY block",
- "checked_statement : CHECKED block",
- "unchecked_statement : UNCHECKED block",
- "lock_statement : LOCK OPEN_PARENS expression CLOSE_PARENS embedded_statement",
- "using_statement : USING OPEN_PARENS resource_acquisition CLOSE_PARENS embedded_statement",
- "resource_acquisition : local_variable_declaration expression",
- };
- protected static string [] yyName = {
- "end-of-file",null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,"'!'",null,null,null,"'%'","'&'",
- null,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",null,null,null,
- null,null,null,null,null,null,null,"':'","';'","'<'","'='","'>'",
- "'?'",null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,"'['",null,"']'","'^'",null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,"'{'","'|'","'}'","'~'",null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,null,null,null,null,null,null,null,null,null,null,null,null,null,
- null,"EOF","NONE","ERROR","ABSTRACT","AS","ADD","BASE","BOOL","BREAK",
- "BYTE","CASE","CATCH","CHAR","CHECKED","CLASS","CONST","CONTINUE",
- "DECIMAL","DEFAULT","DELEGATE","DO","DOUBLE","ELSE","ENUM","EVENT",
- "EXPLICIT","EXTERN","FALSE","FINALLY","FIXED","FLOAT","FOR","FOREACH",
- "GOTO","IF","IMPLICIT","IN","INT","INTERFACE","INTERNAL","IS","LOCK",
- "LONG","NAMESPACE","NEW","NULL","OBJECT","OPERATOR","OUT","OVERRIDE",
- "PARAMS","PRIVATE","PROTECTED","PUBLIC","READONLY","REF","RETURN",
- "REMOVE","SBYTE","SEALED","SHORT","SIZEOF","STATIC","STRING","STRUCT",
- "SWITCH","THIS","THROW","TRUE","TRY","TYPEOF","UINT","ULONG",
- "UNCHECKED","UNSAFE","USHORT","USING","VIRTUAL","VOID","WHILE","GET",
- "\"get\"","SET","\"set\"","OPEN_BRACE","CLOSE_BRACE","OPEN_BRACKET",
- "CLOSE_BRACKET","OPEN_PARENS","CLOSE_PARENS","DOT","COMMA","COLON",
- "SEMICOLON","TILDE","PLUS","MINUS","BANG","ASSIGN","OP_LT","OP_GT",
- "BITWISE_AND","BITWISE_OR","STAR","PERCENT","DIV","CARRET","INTERR",
- "OP_INC","\"++\"","OP_DEC","\"--\"","OP_SHIFT_LEFT","\"<<\"",
- "OP_SHIFT_RIGHT","\">>\"","OP_LE","\"<=\"","OP_GE","\">=\"","OP_EQ",
- "\"==\"","OP_NE","\"!=\"","OP_AND","\"&&\"","OP_OR","\"||\"",
- "OP_MULT_ASSIGN","\"*=\"","OP_DIV_ASSIGN","\"/=\"","OP_MOD_ASSIGN",
- "\"%=\"","OP_ADD_ASSIGN","\"+=\"","OP_SUB_ASSIGN","\"-=\"",
- "OP_SHIFT_LEFT_ASSIGN","\"<<=\"","OP_SHIFT_RIGHT_ASSIGN","\">>=\"",
- "OP_AND_ASSIGN","\"&=\"","OP_XOR_ASSIGN","\"^=\"","OP_OR_ASSIGN",
- "\"|=\"","OP_PTR","\"->\"","LITERAL_INTEGER","\"int literal\"",
- "LITERAL_FLOAT","\"float literal\"","LITERAL_DOUBLE",
- "\"double literal\"","LITERAL_DECIMAL","\"decimal literal\"",
- "LITERAL_CHARACTER","\"character literal\"","LITERAL_STRING",
- "\"string literal\"","IDENTIFIER",
- };
-
- /** index-checked interface to yyName[].
- @param token single character or %token value.
- @return token name or [illegal] or [unknown].
- */
- public static string yyname (int token) {
- if ((token < 0) || (token > yyName.Length)) return "[illegal]";
- string name;
- if ((name = yyName[token]) != null) return name;
- return "[unknown]";
- }
-
- /** computes list of expected tokens on error by tracing the tables.
- @param state for which to compute the list.
- @return list of token names.
- */
- protected string[] yyExpecting (int state) {
- int token, n, len = 0;
- bool[] ok = new bool[yyName.Length];
-
- if ((n = yySindex[state]) != 0)
- for (token = n < 0 ? -n : 0;
- (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
- if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
- ++ len;
- ok[token] = true;
- }
- if ((n = yyRindex[state]) != 0)
- for (token = n < 0 ? -n : 0;
- (token < yyName.Length) && (n+token < yyTable.Length); ++ token)
- if (yyCheck[n+token] == token && !ok[token] && yyName[token] != null) {
- ++ len;
- ok[token] = true;
- }
-
- string [] result = new string[len];
- for (n = token = 0; n < len; ++ token)
- if (ok[token]) result[n++] = yyName[token];
- return result;
- }
-
- /** the generated parser, with debugging messages.
- Maintains a state and a value stack, currently with fixed maximum size.
- @param yyLex scanner.
- @param yydebug debug message writer implementing yyDebug, or null.
- @return result of the last reduction, if any.
- @throws yyException on irrecoverable parse error.
- */
- public Object yyparse (yyParser.yyInput yyLex, Object yydebug)
- {
- this.yydebug = (yydebug.yyDebug)yydebug;
- return yyparse(yyLex);
- }
-
- /** initial size and increment of the state/value stack [default 256].
- This is not final so that it can be overwritten outside of invocations
- of yyparse().
- */
- protected int yyMax;
-
- /** executed at the beginning of a reduce action.
- Used as $$ = yyDefault($1), prior to the user-specified action, if any.
- Can be overwritten to provide deep copy, etc.
- @param first value for $1, or null.
- @return first.
- */
- protected Object yyDefault (Object first) {
- return first;
- }
-
- /** the generated parser.
- Maintains a state and a value stack, currently with fixed maximum size.
- @param yyLex scanner.
- @return result of the last reduction, if any.
- @throws yyException on irrecoverable parse error.
- */
- public Object yyparse (yyParser.yyInput yyLex)
- {
- if (yyMax <= 0) yyMax = 256; // initial size
- int yyState = 0; // state stack ptr
- int [] yyStates = new int[yyMax]; // state stack
- Object yyVal = null; // value stack ptr
- Object [] yyVals = new Object[yyMax]; // value stack
- int yyToken = -1; // current input
- int yyErrorFlag = 0; // #tks to shift
-
- int yyTop = 0;
- goto skip;
- yyLoop:
- yyTop++;
- skip:
- for (;; ++ yyTop) {
- if (yyTop >= yyStates.Length) { // dynamically increase
- int[] i = new int[yyStates.Length+yyMax];
- System.Array.Copy(yyStates, i, 0);
- yyStates = i;
- Object[] o = new Object[yyVals.Length+yyMax];
- System.Array.Copy(yyVals, o, 0);
- yyVals = o;
- }
- yyStates[yyTop] = yyState;
- yyVals[yyTop] = yyVal;
- if (yydebug != null) yydebug.push(yyState, yyVal);
-
- yyDiscarded: for (;;) { // discarding a token does not change stack
- int yyN;
- if ((yyN = yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
- if (yyToken < 0) {
- yyToken = yyLex.advance() ? yyLex.token() : 0;
- if (yydebug != null)
- yydebug.lex(yyState, yyToken, yyname(yyToken), yyLex.value());
- }
- if ((yyN = yySindex[yyState]) != 0 && ((yyN += yyToken) >= 0)
- && (yyN < yyTable.Length) && (yyCheck[yyN] == yyToken)) {
- if (yydebug != null)
- yydebug.shift(yyState, yyTable[yyN], yyErrorFlag-1);
- yyState = yyTable[yyN]; // shift to yyN
- yyVal = yyLex.value();
- yyToken = -1;
- if (yyErrorFlag > 0) -- yyErrorFlag;
- goto yyLoop;
- }
- if ((yyN = yyRindex[yyState]) != 0 && (yyN += yyToken) >= 0
- && yyN < yyTable.Length && yyCheck[yyN] == yyToken)
- yyN = yyTable[yyN]; // reduce (yyN)
- else
- switch (yyErrorFlag) {
-
- case 0:
- yyerror("syntax error", yyExpecting(yyState));
- if (yydebug != null) yydebug.error("syntax error");
- goto case 1;
- case 1: case 2:
- yyErrorFlag = 3;
- do {
- if ((yyN = yySindex[yyStates[yyTop]]) != 0
- && (yyN += Token.yyErrorCode) >= 0 && yyN < yyTable.Length
- && yyCheck[yyN] == Token.yyErrorCode) {
- if (yydebug != null)
- yydebug.shift(yyStates[yyTop], yyTable[yyN], 3);
- yyState = yyTable[yyN];
- yyVal = yyLex.value();
- goto yyLoop;
- }
- if (yydebug != null) yydebug.pop(yyStates[yyTop]);
- } while (-- yyTop >= 0);
- if (yydebug != null) yydebug.reject();
- throw new yyParser.yyException("irrecoverable syntax error");
-
- case 3:
- if (yyToken == 0) {
- if (yydebug != null) yydebug.reject();
- throw new yyParser.yyException("irrecoverable syntax error at end-of-file");
- }
- if (yydebug != null)
- yydebug.discard(yyState, yyToken, yyname(yyToken),
- yyLex.value());
- yyToken = -1;
- goto yyDiscarded; // leave stack alone
- }
- }
- int yyV = yyTop + 1-yyLen[yyN];
- if (yydebug != null)
- yydebug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]);
- yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
- switch (yyN) {
-case 1:
-#line 240 "cs-parser.jay"
- {
- /* At some point check that using only comes *before* any namespaces */
- }
- break;
-case 6:
-#line 257 "cs-parser.jay"
- {
- }
- break;
-case 7:
-#line 263 "cs-parser.jay"
- {
- current_namespace.Using ((string) yyVals[-1+yyTop]);
- }
- break;
-case 10:
-#line 274 "cs-parser.jay"
- {
- current_namespace = new Namespace (current_namespace, (string) yyVals[0+yyTop]);
- }
- break;
-case 11:
-#line 278 "cs-parser.jay"
- {
- current_namespace = current_namespace.Parent;
- }
- break;
-case 17:
-#line 295 "cs-parser.jay"
- {
- yyVal = ((yyVals[-2+yyTop]).ToString ()) + "." + (yyVals[0+yyTop].ToString ()); }
- break;
-case 19:
-#line 308 "cs-parser.jay"
- {
- }
- break;
-case 26:
-#line 329 "cs-parser.jay"
- {
- int mod_flags = 0;
- string name = "";
-
- if (yyVals[0+yyTop] is Class){
- Class c = (Class) yyVals[0+yyTop];
- mod_flags = c.ModFlags;
- name = c.Name;
- } else if (yyVals[0+yyTop] is Struct){
- Struct s = (Struct) yyVals[0+yyTop];
- mod_flags = s.ModFlags;
- name = s.Name;
- } else
- break;
-
- /* */
- /* We remove this error until we can */
- /*if ((mod_flags & (Modifiers.PRIVATE|Modifiers.PROTECTED)) != 0){ */
- /* error (1527, "Namespace elements cant be explicitly " + */
- /* "declared private or protected in `" + name + "'"); */
- /*} */
- }
- break;
-case 42:
-#line 396 "cs-parser.jay"
- {
- /* if (Collection.Contains ($$))... FIXME */
- note ("Allows: assembly, field, method, module, param, property, type");
- }
- break;
-case 49:
-#line 415 "cs-parser.jay"
- { /* reserved attribute name or identifier: 17.4 */ }
- break;
-case 73:
-#line 471 "cs-parser.jay"
- {
- Struct new_struct;
- string full_struct_name = MakeName ((string) yyVals[0+yyTop]);
-
- new_struct = new Struct (current_container, full_struct_name, (int) yyVals[-2+yyTop]);
- current_container = new_struct;
- current_container.Namespace = current_namespace;
- }
- break;
-case 74:
-#line 482 "cs-parser.jay"
- {
- Struct new_struct = (Struct) current_container;
-
- current_container = current_container.Parent;
- CheckDef (current_container.AddStruct (new_struct), new_struct.Name);
- yyVal = new_struct;
- }
- break;
-case 94:
-#line 538 "cs-parser.jay"
- {
- Modifiers.Check (Constant.AllowedModifiers, (int) yyVals[-4+yyTop], Modifiers.PRIVATE);
-
- foreach (DictionaryEntry constant in (ArrayList) yyVals[-1+yyTop]){
- Constant c = new Constant (
- (TypeRef) yyVals[-2+yyTop], (string) constant.Key,
- (Expression) constant.Value);
-
- CheckDef (current_container.AddConstant (c), c.Name);
- }
- }
- break;
-case 95:
-#line 553 "cs-parser.jay"
- {
- ArrayList constants = new ArrayList ();
- constants.Add (yyVals[0+yyTop]);
- yyVal = constants;
- }
- break;
-case 96:
-#line 559 "cs-parser.jay"
- {
- ArrayList constants = (ArrayList) yyVals[-2+yyTop];
-
- constants.Add (yyVals[0+yyTop]);
- }
- break;
-case 97:
-#line 567 "cs-parser.jay"
- {
- yyVal = new DictionaryEntry (yyVals[-2+yyTop], yyVals[0+yyTop]);
- }
- break;
-case 98:
-#line 578 "cs-parser.jay"
- {
- TypeRef typeref = (TypeRef) yyVals[-2+yyTop];
- int mod = (int) yyVals[-3+yyTop];
-
- foreach (VariableDeclaration var in (ArrayList) yyVals[-1+yyTop]){
- Field field = new Field (typeref, mod, var.identifier,
- var.expression_or_array_initializer);
-
- CheckDef (current_container.AddField (field), field.Name);
- }
- }
- break;
-case 99:
-#line 594 "cs-parser.jay"
- {
- ArrayList decl = new ArrayList ();
- yyVal = decl;
- decl.Add (yyVals[0+yyTop]);
- }
- break;
-case 100:
-#line 600 "cs-parser.jay"
- {
- ArrayList decls = (ArrayList) yyVals[-2+yyTop];
- decls.Add (yyVals[0+yyTop]);
- yyVal = yyVals[-2+yyTop];
- }
- break;
-case 101:
-#line 609 "cs-parser.jay"
- {
- yyVal = new VariableDeclaration ((string) yyVals[-2+yyTop], yyVals[0+yyTop]);
- }
- break;
-case 102:
-#line 613 "cs-parser.jay"
- {
- yyVal = new VariableDeclaration ((string) yyVals[0+yyTop], null);
- }
- break;
-case 105:
-#line 626 "cs-parser.jay"
- {
- Method method = (Method) yyVals[-1+yyTop];
-
- method.Block = (Block) yyVals[0+yyTop];
- CheckDef (current_container.AddMethod (method), method.Name);
-
- current_local_parameters = null;
- }
- break;
-case 106:
-#line 642 "cs-parser.jay"
- {
- Method method = new Method ((TypeRef) yyVals[-4+yyTop], (int) yyVals[-5+yyTop], (string) yyVals[-3+yyTop], (Parameters) yyVals[-1+yyTop]);
-
- current_local_parameters = (Parameters) yyVals[-1+yyTop];
-
- yyVal = method;
- }
- break;
-case 107:
-#line 654 "cs-parser.jay"
- {
- Method method = new Method (type ("void"), (int) yyVals[-5+yyTop], (string) yyVals[-3+yyTop], (Parameters) yyVals[-1+yyTop]);
-
- current_local_parameters = (Parameters) yyVals[-1+yyTop];
- yyVal = method;
- }
- break;
-case 109:
-#line 664 "cs-parser.jay"
- { yyVal = null; }
- break;
-case 110:
-#line 668 "cs-parser.jay"
- { yyVal = new Parameters (null, null); }
- break;
-case 112:
-#line 674 "cs-parser.jay"
- {
- yyVal = new Parameters ((ParameterCollection) yyVals[0+yyTop], null);
- }
- break;
-case 113:
-#line 678 "cs-parser.jay"
- {
- yyVal = new Parameters ((ParameterCollection) yyVals[-2+yyTop], (Parameter) yyVals[0+yyTop]);
- }
- break;
-case 114:
-#line 682 "cs-parser.jay"
- {
- yyVal = new Parameters (null, (Parameter) yyVals[0+yyTop]);
- }
- break;
-case 115:
-#line 689 "cs-parser.jay"
- {
- ParameterCollection pars = new ParameterCollection ();
- pars.Add ((Parameter) yyVals[0+yyTop]);
- yyVal = pars;
- }
- break;
-case 116:
-#line 695 "cs-parser.jay"
- {
- ParameterCollection pars = (ParameterCollection) yyVals[-2+yyTop];
- pars.Add ((Parameter) yyVals[0+yyTop]);
- yyVal = yyVals[-2+yyTop];
- }
- break;
-case 117:
-#line 707 "cs-parser.jay"
- {
- yyVal = new Parameter ((TypeRef) yyVals[-1+yyTop], (string) yyVals[0+yyTop], (Parameter.Modifier) yyVals[-2+yyTop]);
- }
- break;
-case 118:
-#line 713 "cs-parser.jay"
- { yyVal = Parameter.Modifier.NONE; }
- break;
-case 120:
-#line 718 "cs-parser.jay"
- { yyVal = Parameter.Modifier.REF; }
- break;
-case 121:
-#line 719 "cs-parser.jay"
- { yyVal = Parameter.Modifier.OUT; }
- break;
-case 122:
-#line 724 "cs-parser.jay"
- {
- yyVal = new Parameter ((TypeRef) yyVals[-1+yyTop], (string) yyVals[0+yyTop], Parameter.Modifier.PARAMS);
- note ("type must be a single-dimension array type");
- }
- break;
-case 123:
-#line 731 "cs-parser.jay"
- { yyVal = yyVals[0+yyTop].ToString (); }
- break;
-case 124:
-#line 732 "cs-parser.jay"
- { yyVal = yyVals[-2+yyTop].ToString () + "." + yyVals[0+yyTop].ToString (); }
- break;
-case 125:
-#line 740 "cs-parser.jay"
- {
- Parameter implicit_value_parameter;
- implicit_value_parameter = new Parameter ((TypeRef) yyVals[-2+yyTop], "value", Parameter.Modifier.NONE);
-
- lexer.properties = true;
-
- implicit_value_parameters = new ParameterCollection ();
- implicit_value_parameters.Add (implicit_value_parameter);
- }
- break;
-case 126:
-#line 750 "cs-parser.jay"
- {
- lexer.properties = false;
- }
- break;
-case 127:
-#line 754 "cs-parser.jay"
- {
- Property prop;
- DictionaryEntry pair = (DictionaryEntry) yyVals[-2+yyTop];
- Block get_block = null;
- Block set_block = null;
-
- if (pair.Key != null)
- get_block = (Block) pair.Key;
- if (pair.Value != null)
- set_block = (Block) pair.Value;
-
- prop = new Property ((TypeRef) yyVals[-6+yyTop], (string) yyVals[-5+yyTop], (int) yyVals[-7+yyTop], get_block, set_block);
-
- CheckDef (current_container.AddProperty (prop), prop.Name);
- implicit_value_parameters = null;
- }
- break;
-case 128:
-#line 774 "cs-parser.jay"
- {
- yyVal = new DictionaryEntry (yyVals[-1+yyTop], yyVals[0+yyTop]);
- }
- break;
-case 129:
-#line 778 "cs-parser.jay"
- {
- yyVal = new DictionaryEntry (yyVals[0+yyTop], yyVals[-1+yyTop]);
- }
- break;
-case 130:
-#line 784 "cs-parser.jay"
- { yyVal = null; }
- break;
-case 132:
-#line 789 "cs-parser.jay"
- { yyVal = null; }
- break;
-case 134:
-#line 795 "cs-parser.jay"
- {
- yyVal = yyVals[0+yyTop];
- }
- break;
-case 135:
-#line 802 "cs-parser.jay"
- {
- current_local_parameters = new Parameters (implicit_value_parameters, null);
- }
- break;
-case 136:
-#line 806 "cs-parser.jay"
- {
- yyVal = yyVals[0+yyTop];
- current_local_parameters = null;
- }
- break;
-case 138:
-#line 814 "cs-parser.jay"
- { yyVal = new Block (null); }
- break;
-case 139:
-#line 821 "cs-parser.jay"
- {
- Interface new_interface;
- string full_interface_name = MakeName ((string) yyVals[0+yyTop]);
-
- new_interface = new Interface (current_container, full_interface_name, (int) yyVals[-2+yyTop]);
- if (current_interface != null)
- error (-2, "Internal compiler error: interface inside interface");
- current_interface = new_interface;
- }
- break;
-case 140:
-#line 832 "cs-parser.jay"
- {
- Interface new_interface = (Interface) current_interface;
-
- if (yyVals[-1+yyTop] != null)
- new_interface.Bases = (ArrayList) yyVals[-1+yyTop];
-
- current_interface = null;
- CheckDef (current_container.AddInterface (new_interface), new_interface.Name);
- }
- break;
-case 141:
-#line 844 "cs-parser.jay"
- { yyVal = null; }
- break;
-case 143:
-#line 849 "cs-parser.jay"
- { yyVal = yyVals[0+yyTop]; }
- break;
-case 144:
-#line 854 "cs-parser.jay"
- {
- ArrayList interfaces = new ArrayList ();
-
- interfaces.Add (yyVals[0+yyTop]);
- }
- break;
-case 145:
-#line 860 "cs-parser.jay"
- {
- ArrayList interfaces = (ArrayList) yyVals[-2+yyTop];
- interfaces.Add (yyVals[0+yyTop]);
- yyVal = interfaces;
- }
- break;
-case 151:
-#line 885 "cs-parser.jay"
- {
- InterfaceMethod m = (InterfaceMethod) yyVals[0+yyTop];
-
- CheckDef (current_interface.AddMethod (m), m.Name);
- }
- break;
-case 152:
-#line 891 "cs-parser.jay"
- {
- InterfaceProperty p = (InterfaceProperty) yyVals[0+yyTop];
-
- CheckDef (current_interface.AddProperty (p), p.Name);
- }
- break;
-case 153:
-#line 897 "cs-parser.jay"
- {
- InterfaceEvent e = (InterfaceEvent) yyVals[0+yyTop];
-
- CheckDef (current_interface.AddEvent (e), e.Name);
- }
- break;
-case 154:
-#line 903 "cs-parser.jay"
- {
- InterfaceIndexer i = (InterfaceIndexer) yyVals[0+yyTop];
-
- CheckDef (current_interface.AddIndexer (i), "indexer");
- }
- break;
-case 155:
-#line 911 "cs-parser.jay"
- { yyVal = false; }
- break;
-case 156:
-#line 912 "cs-parser.jay"
- { yyVal = true; }
- break;
-case 157:
-#line 919 "cs-parser.jay"
- {
- yyVal = new InterfaceMethod ((TypeRef) yyVals[-5+yyTop], (string) yyVals[-4+yyTop], (bool) yyVals[-6+yyTop], (Parameters) yyVals[-2+yyTop]);
- }
- break;
-case 158:
-#line 925 "cs-parser.jay"
- {
- yyVal = new InterfaceMethod (type ("void"), (string) yyVals[-4+yyTop], (bool) yyVals[-6+yyTop], (Parameters) yyVals[-2+yyTop]);
- }
- break;
-case 159:
-#line 935 "cs-parser.jay"
- { lexer.properties = true; }
- break;
-case 160:
-#line 937 "cs-parser.jay"
- { lexer.properties = false; }
- break;
-case 161:
-#line 939 "cs-parser.jay"
- {
- int gs = (int) yyVals[-2+yyTop];
-
- yyVal = new InterfaceProperty ((TypeRef) yyVals[-6+yyTop], (string) yyVals[-5+yyTop], (bool) yyVals[-7+yyTop],
- (gs & 1) == 1, (gs & 2) == 2);
- }
- break;
-case 162:
-#line 948 "cs-parser.jay"
- { yyVal = 1; }
- break;
-case 163:
-#line 949 "cs-parser.jay"
- { yyVal = 2; }
- break;
-case 164:
-#line 951 "cs-parser.jay"
- { yyVal = 3; }
- break;
-case 165:
-#line 953 "cs-parser.jay"
- { yyVal = 3; }
- break;
-case 166:
-#line 958 "cs-parser.jay"
- {
- yyVal = new InterfaceEvent ((TypeRef) yyVals[-2+yyTop], (string) yyVals[-1+yyTop], (bool) yyVals[-4+yyTop]);
- }
- break;
-case 167:
-#line 967 "cs-parser.jay"
- { lexer.properties = true; }
- break;
-case 168:
-#line 969 "cs-parser.jay"
- { lexer.properties = false; }
- break;
-case 169:
-#line 971 "cs-parser.jay"
- {
- int a_flags = (int) yyVals[-2+yyTop];
-
- bool do_get = (a_flags & 1) == 1;
- bool do_set = (a_flags & 2) == 2;
-
- yyVal = new InterfaceIndexer ((TypeRef) yyVals[-9+yyTop], (Parameters) yyVals[-6+yyTop], do_get, do_set, (bool) yyVals[-10+yyTop]);
- }
- break;
-case 170:
-#line 983 "cs-parser.jay"
- {
- /* FIXME: validate that opt_modifiers is exactly: PUBLIC and STATIC */
- }
- break;
-case 171:
-#line 991 "cs-parser.jay"
- {
- /* FIXME: since reduce/reduce on this */
- /* rule, validate overloadable_operator is unary */
- }
- break;
-case 172:
-#line 1000 "cs-parser.jay"
- {
- /* FIXME: because of the reduce/reduce on PLUS and MINUS */
- /* validate overloadable_operator is binary */
- }
- break;
-case 198:
-#line 1045 "cs-parser.jay"
- {
- Constructor c = (Constructor) yyVals[-1+yyTop];
- c.Block = (Block) yyVals[0+yyTop];
- c.ModFlags = (int) yyVals[-2+yyTop];
-
- if ((c.ModFlags & Modifiers.STATIC) != 0){
- if ((c.ModFlags & Modifiers.Accessibility) != 0){
- error (515, "Access modifiers are not allowed on static constructors");
- }
- }
- CheckDef (current_container.AddConstructor (c), c.Name);
-
- current_local_parameters = null;
- }
- break;
-case 199:
-#line 1065 "cs-parser.jay"
- {
- ConstructorInitializer i = null;
-
- if (yyVals[0+yyTop] != null)
- i = (ConstructorInitializer) yyVals[0+yyTop];
-
- yyVal = new Constructor ((string) yyVals[-4+yyTop], (Parameters) yyVals[-2+yyTop], i);
-
- current_local_parameters = (Parameters) yyVals[-2+yyTop];
- }
- break;
-case 200:
-#line 1078 "cs-parser.jay"
- { yyVal = null; }
- break;
-case 202:
-#line 1084 "cs-parser.jay"
- {
- yyVal = new ConstructorBaseInitializer ((ArrayList) yyVals[-1+yyTop]);
- }
- break;
-case 203:
-#line 1088 "cs-parser.jay"
- {
- yyVal = new ConstructorThisInitializer ((ArrayList) yyVals[-1+yyTop]);
- }
- break;
-case 204:
-#line 1095 "cs-parser.jay"
- {
- Method d = new Method (type ("void"), 0, "Finalize", new Parameters (null, null));
-
- d.Block = (Block) yyVals[0+yyTop];
- CheckDef (current_container.AddMethod (d), d.Name);
- }
- break;
-case 205:
-#line 1107 "cs-parser.jay"
- { note ("validate that the flags only contain new public protected internal private static virtual sealed override abstract"); }
- break;
-case 206:
-#line 1112 "cs-parser.jay"
- { note ("validate that the flags only contain new public protected internal private static virtual sealed override abstract"); }
- break;
-case 211:
-#line 1131 "cs-parser.jay"
- {
- /* The signature is computed from the signature of the indexer. Look */
- /* at section 3.6 on the spec */
- note ("verify modifiers are NEW PUBLIC PROTECTED INTERNAL PRIVATE VIRTUAL SEALED OVERRIDE ABSTRACT");
- }
- break;
-case 214:
-#line 1150 "cs-parser.jay"
- {
- string name = (string) yyVals[-3+yyTop];
- Enum e = new Enum ((TypeRef) yyVals[-2+yyTop], (int) yyVals[-5+yyTop], name);
-
- foreach (VariableDeclaration ev in (ArrayList) yyVals[-1+yyTop]){
- CheckDef (
- e.AddEnum (
- ev.identifier,
- (Expression) ev.expression_or_array_initializer),
- ev.identifier);
- }
-
- CheckDef (current_container.AddEnum (e), name);
- }
- break;
-case 215:
-#line 1167 "cs-parser.jay"
- { yyVal = type ("System.Int32"); }
- break;
-case 216:
-#line 1168 "cs-parser.jay"
- { yyVal = yyVals[0+yyTop]; }
- break;
-case 217:
-#line 1173 "cs-parser.jay"
- {
- yyVal = yyVals[-1+yyTop];
- }
- break;
-case 218:
-#line 1177 "cs-parser.jay"
- {
- yyVal = yyVals[-2+yyTop];
- }
- break;
-case 219:
-#line 1183 "cs-parser.jay"
- { yyVal = new ArrayList (); }
- break;
-case 220:
-#line 1184 "cs-parser.jay"
- { yyVal = yyVals[0+yyTop]; }
- break;
-case 221:
-#line 1189 "cs-parser.jay"
- {
- ArrayList l = new ArrayList ();
-
- l.Add (yyVals[0+yyTop]);
- yyVal = l;
- }
- break;
-case 222:
-#line 1196 "cs-parser.jay"
- {
- ArrayList l = (ArrayList) yyVals[-2+yyTop];
-
- l.Add (yyVals[0+yyTop]);
-
- yyVal = l;
- }
- break;
-case 223:
-#line 1207 "cs-parser.jay"
- {
- yyVal = new VariableDeclaration ((string) yyVals[0+yyTop], null);
- }
- break;
-case 224:
-#line 1211 "cs-parser.jay"
- {
- yyVal = new VariableDeclaration ((string) yyVals[-2+yyTop], yyVals[0+yyTop]);
- }
- break;
-case 225:
-#line 1224 "cs-parser.jay"
- { note ("validate that modifiers only contains NEW PUBLIC PROTECTED INTERNAL PRIVATE"); }
- break;
-case 228:
-#line 1242 "cs-parser.jay"
- { /* class_type */
- /*
- This does interfaces, delegates, struct_types, class_types,
- parent classes, and more! 4.2
- */
- yyVal = type ((string) yyVals[0+yyTop]);
- }
- break;
-case 231:
-#line 1255 "cs-parser.jay"
- {
- ArrayList types = new ArrayList ();
-
- types.Add (yyVals[0+yyTop]);
- yyVal = types;
- }
- break;
-case 232:
-#line 1262 "cs-parser.jay"
- {
- ArrayList types = new ArrayList ();
- types.Add (yyVals[0+yyTop]);
- yyVal = types;
- }
- break;
-case 233:
-#line 1274 "cs-parser.jay"
- { yyVal = type ("System.Object"); }
- break;
-case 234:
-#line 1275 "cs-parser.jay"
- { yyVal = type ("System.String"); }
- break;
-case 235:
-#line 1276 "cs-parser.jay"
- { yyVal = type ("System.Boolean"); }
- break;
-case 236:
-#line 1277 "cs-parser.jay"
- { yyVal = type ("System.Decimal"); }
- break;
-case 237:
-#line 1278 "cs-parser.jay"
- { yyVal = type ("System.Single"); }
- break;
-case 238:
-#line 1279 "cs-parser.jay"
- { yyVal = type ("System.Double"); }
- break;
-case 240:
-#line 1284 "cs-parser.jay"
- { yyVal = type ("System.SByte"); }
- break;
-case 241:
-#line 1285 "cs-parser.jay"
- { yyVal = type ("System.Byte"); }
- break;
-case 242:
-#line 1286 "cs-parser.jay"
- { yyVal = type ("System.Int16"); }
- break;
-case 243:
-#line 1287 "cs-parser.jay"
- { yyVal = type ("System.UInt16"); }
- break;
-case 244:
-#line 1288 "cs-parser.jay"
- { yyVal = type ("System.Int32"); }
- break;
-case 245:
-#line 1289 "cs-parser.jay"
- { yyVal = type ("System.UInt32"); }
- break;
-case 246:
-#line 1290 "cs-parser.jay"
- { yyVal = type ("System.Int64"); }
- break;
-case 247:
-#line 1291 "cs-parser.jay"
- { yyVal = type ("System.UInt64"); }
- break;
-case 248:
-#line 1292 "cs-parser.jay"
- { yyVal = type ("System.Char"); }
- break;
-case 250:
-#line 1301 "cs-parser.jay"
- {
- yyVal = yyVals[-1+yyTop];
- /* FIXME: We need to create a type for the nested thing. */
- }
- break;
-case 251:
-#line 1312 "cs-parser.jay"
- {
- /* 7.5.1: Literals */
-
- }
- break;
-case 252:
-#line 1318 "cs-parser.jay"
- {
- string name = (string) yyVals[0+yyTop];
-
- yyVal = null;
- if (name.IndexOf ('.') == -1){
- /* */
- /* we need to check against current_block not being null */
- /* as `expression' is allowed in argument_lists, which */
- /* do not exist inside a block. */
- /* */
- if (current_block != null){
- if (current_block.IsVariableDefined (name))
- yyVal = new LocalVariableReference (current_block, name);
- }
- if ((yyVal == null) && (current_local_parameters != null)){
- Parameter par = current_local_parameters.GetParameterByName (name);
- if (par != null)
- yyVal = new ParameterReference (current_local_parameters, name);
- }
- }
- if (yyVal == null)
- yyVal = new SimpleName (name);
- }
- break;
-case 269:
-#line 1360 "cs-parser.jay"
- { yyVal = new CharLiteral ((char) lexer.Value); }
- break;
-case 270:
-#line 1361 "cs-parser.jay"
- { yyVal = new StringLiteral ((string) lexer.Value); }
- break;
-case 271:
-#line 1362 "cs-parser.jay"
- { yyVal = new NullLiteral (); }
- break;
-case 272:
-#line 1366 "cs-parser.jay"
- { yyVal = new FloatLiteral ((float) lexer.Value); }
- break;
-case 273:
-#line 1367 "cs-parser.jay"
- { yyVal = new DoubleLiteral ((double) lexer.Value); }
- break;
-case 274:
-#line 1368 "cs-parser.jay"
- { yyVal = new DecimalLiteral ((decimal) lexer.Value); }
- break;
-case 275:
-#line 1372 "cs-parser.jay"
- { yyVal = new IntLiteral ((Int32) lexer.Value); }
- break;
-case 276:
-#line 1376 "cs-parser.jay"
- { yyVal = new BoolLiteral (true); }
- break;
-case 277:
-#line 1377 "cs-parser.jay"
- { yyVal = new BoolLiteral (false); }
- break;
-case 278:
-#line 1382 "cs-parser.jay"
- { yyVal = yyVals[-1+yyTop]; }
- break;
-case 279:
-#line 1387 "cs-parser.jay"
- {
- yyVal = new MemberAccess ((Expression) yyVals[-2+yyTop], (string) yyVals[0+yyTop]);
- }
- break;
-case 280:
-#line 1391 "cs-parser.jay"
- {
- yyVal = new BuiltinTypeAccess ((TypeRef) yyVals[-2+yyTop], (string) yyVals[0+yyTop]);
- }
- break;
-case 282:
-#line 1402 "cs-parser.jay"
- {
- /* FIXME: */
- /* if $1 is MethodGroup */
- /* $$ = new Call ($1, $3); */
- /* else */
- /* $$ = new DelegateCall ($1, $3); */
- if (yyVals[-3+yyTop] == null)
- error (1, "THIS IS CRAZY");
-
- yyVal = new Invocation ((Expression) yyVals[-3+yyTop], (ArrayList) yyVals[-1+yyTop]);
- }
- break;
-case 283:
-#line 1416 "cs-parser.jay"
- { yyVal = new ArrayList (); }
- break;
-case 285:
-#line 1422 "cs-parser.jay"
- {
- ArrayList list = new ArrayList ();
- list.Add (yyVals[0+yyTop]);
- yyVal = list;
- }
- break;
-case 286:
-#line 1428 "cs-parser.jay"
- {
- ArrayList list = (ArrayList) yyVals[-2+yyTop];
- list.Add (yyVals[0+yyTop]);
- yyVal = list;
- }
- break;
-case 287:
-#line 1437 "cs-parser.jay"
- {
- yyVal = new Argument ((Expression) yyVals[0+yyTop], Argument.AType.Expression);
- }
- break;
-case 288:
-#line 1441 "cs-parser.jay"
- {
- yyVal = new Argument ((Expression) yyVals[0+yyTop], Argument.AType.Ref);
- }
- break;
-case 289:
-#line 1445 "cs-parser.jay"
- {
- yyVal = new Argument ((Expression) yyVals[0+yyTop], Argument.AType.Out);
- }
- break;
-case 290:
-#line 1451 "cs-parser.jay"
- { note ("section 5.4"); yyVal = yyVals[0+yyTop]; }
- break;
-case 294:
-#line 1466 "cs-parser.jay"
- {
- yyVal = new This ();
- }
- break;
-case 297:
-#line 1480 "cs-parser.jay"
- {
- yyVal = new Unary (Unary.Operator.PostIncrement, (Expression) yyVals[-1+yyTop]);
- }
- break;
-case 298:
-#line 1487 "cs-parser.jay"
- {
- yyVal = new Unary (Unary.Operator.PostDecrement, (Expression) yyVals[-1+yyTop]);
- }
- break;
-case 301:
-#line 1499 "cs-parser.jay"
- {
- yyVal = new New ((TypeRef) yyVals[-3+yyTop], (ArrayList) yyVals[-1+yyTop]);
- }
- break;
-case 319:
-#line 1559 "cs-parser.jay"
- {
- yyVal = new TypeOf ((TypeRef) yyVals[-1+yyTop]);
- }
- break;
-case 320:
-#line 1565 "cs-parser.jay"
- {
- yyVal = new SizeOf ((TypeRef) yyVals[-1+yyTop]);
-
- note ("Verify type is unmanaged");
- note ("if (5.8) builtin, yield constant expression");
- }
- break;
-case 324:
-#line 1583 "cs-parser.jay"
- {
- yyVal = new Unary (Unary.Operator.Plus, (Expression) yyVals[0+yyTop]);
- }
- break;
-case 325:
-#line 1587 "cs-parser.jay"
- {
- yyVal = new Unary (Unary.Operator.Minus, (Expression) yyVals[0+yyTop]);
- }
- break;
-case 326:
-#line 1591 "cs-parser.jay"
- {
- yyVal = new Unary (Unary.Operator.Negate, (Expression) yyVals[0+yyTop]);
- }
- break;
-case 327:
-#line 1595 "cs-parser.jay"
- {
- yyVal = new Unary (Unary.Operator.BitComplement, (Expression) yyVals[0+yyTop]);
- }
- break;
-case 328:
-#line 1599 "cs-parser.jay"
- {
- yyVal = new Unary (Unary.Operator.Indirection, (Expression) yyVals[0+yyTop]);
- }
- break;
-case 329:
-#line 1603 "cs-parser.jay"
- {
- yyVal = new Unary (Unary.Operator.AddressOf, (Expression) yyVals[0+yyTop]);
- }
- break;
-case 333:
-#line 1618 "cs-parser.jay"
- {
- yyVal = new Unary (Unary.Operator.PreIncrement, (Expression) yyVals[0+yyTop]);
- }
- break;
-case 334:
-#line 1625 "cs-parser.jay"
- {
- yyVal = new Unary (Unary.Operator.PreDecrement, (Expression) yyVals[0+yyTop]);
- }
- break;
-case 335:
-#line 1635 "cs-parser.jay"
- {
- yyVal = new Cast (type ((string) yyVals[-2+yyTop]), (Expression) yyVals[0+yyTop]);
- }
- break;
-case 336:
-#line 1639 "cs-parser.jay"
- {
- yyVal = new Cast ((TypeRef) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 338:
-#line 1647 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.Multiply,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 339:
-#line 1652 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.Divide,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 340:
-#line 1657 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.Modulo,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 342:
-#line 1666 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.Add,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 343:
-#line 1671 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.Substract,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 345:
-#line 1680 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.ShiftLeft,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 346:
-#line 1685 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.ShiftRight,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 348:
-#line 1694 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.LessThan,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 349:
-#line 1699 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.GreatherThan,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 350:
-#line 1704 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.LessOrEqual,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 351:
-#line 1709 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.GreatherOrEqual,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 352:
-#line 1714 "cs-parser.jay"
- {
- yyVal = new Probe (Probe.Operator.Is,
- (Expression) yyVals[-2+yyTop], (TypeRef) yyVals[0+yyTop]);
- }
- break;
-case 353:
-#line 1719 "cs-parser.jay"
- {
- yyVal = new Probe (Probe.Operator.As,
- (Expression) yyVals[-2+yyTop], (TypeRef) yyVals[0+yyTop]);
- }
- break;
-case 355:
-#line 1728 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.Equal,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 356:
-#line 1733 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.NotEqual,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 358:
-#line 1742 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.BitwiseAnd,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 360:
-#line 1751 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.ExclusiveOr,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 362:
-#line 1760 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.BitwiseOr,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 364:
-#line 1769 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.LogicalAnd,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 366:
-#line 1778 "cs-parser.jay"
- {
- yyVal = new Binary (Binary.Operator.LogicalOr,
- (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 368:
-#line 1787 "cs-parser.jay"
- {
- yyVal = new Conditional ((Expression) yyVals[-4+yyTop], (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 369:
-#line 1794 "cs-parser.jay"
- {
- yyVal = new Assign ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
- }
- break;
-case 370:
-#line 1798 "cs-parser.jay"
- {
- yyVal = new Assign ((Expression) yyVals[-2+yyTop],
- new Binary (Binary.Operator.Multiply,
- (Expression) yyVals[-2+yyTop],
- (Expression) yyVals[0+yyTop]));
- }
- break;
-case 371:
-#line 1805 "cs-parser.jay"
- {
- yyVal = new Assign ((Expression) yyVals[-2+yyTop],
- new Binary (Binary.Operator.Divide,
- (Expression) yyVals[-2+yyTop],
- (Expression) yyVals[0+yyTop]));
- }
- break;
-case 372:
-#line 1812 "cs-parser.jay"
- {
- yyVal = new Assign ((Expression) yyVals[-2+yyTop],
- new Binary (Binary.Operator.Modulo,
- (Expression) yyVals[-2+yyTop],
- (Expression) yyVals[0+yyTop]));
- }
- break;
-case 373:
-#line 1819 "cs-parser.jay"
- {
- yyVal = new Assign ((Expression) yyVals[-2+yyTop],
- new Binary (Binary.Operator.Add,
- (Expression) yyVals[-2+yyTop],
- (Expression) yyVals[0+yyTop]));
- }
- break;
-case 374:
-#line 1826 "cs-parser.jay"
- {
- yyVal = new Assign ((Expression) yyVals[-2+yyTop],
- new Binary (Binary.Operator.Substract,
- (Expression) yyVals[-2+yyTop],
- (Expression) yyVals[0+yyTop]));
- }
- break;
-case 375:
-#line 1833 "cs-parser.jay"
- {
- yyVal = new Assign ((Expression) yyVals[-2+yyTop],
- new Binary (Binary.Operator.ShiftLeft,
- (Expression) yyVals[-2+yyTop],
- (Expression) yyVals[0+yyTop]));
- }
- break;
-case 376:
-#line 1840 "cs-parser.jay"
- {
- yyVal = new Assign ((Expression) yyVals[-2+yyTop],
- new Binary (Binary.Operator.ShiftRight,
- (Expression) yyVals[-2+yyTop],
- (Expression) yyVals[0+yyTop]));
- }
- break;
-case 377:
-#line 1847 "cs-parser.jay"
- {
- yyVal = new Assign ((Expression) yyVals[-2+yyTop],
- new Binary (Binary.Operator.BitwiseAnd,
- (Expression) yyVals[-2+yyTop],
- (Expression) yyVals[0+yyTop]));
- }
- break;
-case 378:
-#line 1854 "cs-parser.jay"
- {
- yyVal = new Assign ((Expression) yyVals[-2+yyTop],
- new Binary (Binary.Operator.BitwiseOr,
- (Expression) yyVals[-2+yyTop],
- (Expression) yyVals[0+yyTop]));
- }
- break;
-case 379:
-#line 1861 "cs-parser.jay"
- {
- yyVal = new Assign ((Expression) yyVals[-2+yyTop],
- new Binary (Binary.Operator.ExclusiveOr,
- (Expression) yyVals[-2+yyTop],
- (Expression) yyVals[0+yyTop]));
- }
- break;
-case 383:
-#line 1879 "cs-parser.jay"
- { CheckBoolean ((Expression) yyVals[0+yyTop]); yyVal = yyVals[0+yyTop]; }
- break;
-case 384:
-#line 1889 "cs-parser.jay"
- {
- Class new_class;
- string full_class_name = MakeName ((string) yyVals[0+yyTop]);
-
- new_class = new Class (current_container, full_class_name, (int) yyVals[-2+yyTop]);
- current_container = new_class;
- current_container.Namespace = current_namespace;
- }
- break;
-case 385:
-#line 1900 "cs-parser.jay"
- {
- Class new_class = (Class) current_container;
-
- if (yyVals[-2+yyTop] != null)
- new_class.Bases = (ArrayList) yyVals[-2+yyTop];
-
- current_container = current_container.Parent;
- CheckDef (current_container.AddClass (new_class), new_class.Name);
-
- yyVal = new_class;
- }
- break;
-case 386:
-#line 1914 "cs-parser.jay"
- { yyVal = (int) 0; }
- break;
-case 389:
-#line 1920 "cs-parser.jay"
- {
- int m1 = (int) yyVals[-1+yyTop];
- int m2 = (int) yyVals[0+yyTop];
-
- if ((m1 & m2) != 0)
- error (1002, "Duplicate modifier: `" + Modifiers.Name (m2) + "'");
-
- yyVal = (int) (m1 | m2);
- }
- break;
-case 390:
-#line 1932 "cs-parser.jay"
- { yyVal = Modifiers.NEW; }
- break;
-case 391:
-#line 1933 "cs-parser.jay"
- { yyVal = Modifiers.PUBLIC; }
- break;
-case 392:
-#line 1934 "cs-parser.jay"
- { yyVal = Modifiers.PROTECTED; }
- break;
-case 393:
-#line 1935 "cs-parser.jay"
- { yyVal = Modifiers.INTERNAL; }
- break;
-case 394:
-#line 1936 "cs-parser.jay"
- { yyVal = Modifiers.PRIVATE; }
- break;
-case 395:
-#line 1937 "cs-parser.jay"
- { yyVal = Modifiers.ABSTRACT; }
- break;
-case 396:
-#line 1938 "cs-parser.jay"
- { yyVal = Modifiers.SEALED; }
- break;
-case 397:
-#line 1939 "cs-parser.jay"
- { yyVal = Modifiers.STATIC; }
- break;
-case 398:
-#line 1940 "cs-parser.jay"
- { yyVal = Modifiers.READONLY; }
- break;
-case 399:
-#line 1941 "cs-parser.jay"
- { yyVal = Modifiers.VIRTUAL; }
- break;
-case 400:
-#line 1942 "cs-parser.jay"
- { yyVal = Modifiers.OVERRIDE; }
- break;
-case 401:
-#line 1943 "cs-parser.jay"
- { yyVal = Modifiers.EXTERN; }
- break;
-case 402:
-#line 1947 "cs-parser.jay"
- { yyVal = null; }
- break;
-case 403:
-#line 1948 "cs-parser.jay"
- { yyVal = yyVals[0+yyTop]; }
- break;
-case 404:
-#line 1952 "cs-parser.jay"
- { yyVal = yyVals[0+yyTop]; }
- break;
-case 405:
-#line 1970 "cs-parser.jay"
- {
- current_block = new Block (current_block);
- }
- break;
-case 406:
-#line 1974 "cs-parser.jay"
- {
- while (current_block.Implicit)
- current_block = current_block.Parent;
- yyVal = current_block;
- current_block = current_block.Parent;
- }
- break;
-case 411:
-#line 1994 "cs-parser.jay"
- {
- if ((Block) yyVals[0+yyTop] != current_block){
- current_block.AddStatement ((Statement) yyVals[0+yyTop]);
- current_block = (Block) yyVals[0+yyTop];
- }
- }
- break;
-case 412:
-#line 2001 "cs-parser.jay"
- {
- current_block.AddStatement ((Statement) yyVals[0+yyTop]);
- }
- break;
-case 413:
-#line 2005 "cs-parser.jay"
- {
- current_block.AddStatement ((Statement) yyVals[0+yyTop]);
- }
- break;
-case 425:
-#line 2026 "cs-parser.jay"
- {
- yyVal = new EmptyStatement ();
- }
- break;
-case 426:
-#line 2033 "cs-parser.jay"
- {
- string lab = (String) yyVals[-2+yyTop];
- Block block;
-
- block = new Block (current_block, lab);
- block.AddStatement ((Statement) yyVals[0+yyTop]);
- yyVal = block;
-
- if (!current_block.AddLabel (lab, block)){
- error (140, "The label '" + lab + "' is a duplicate");
- yyVal = yyVals[0+yyTop];
- }
- }
- break;
-case 429:
-#line 2061 "cs-parser.jay"
- {
- /* FIXME: Do something smart here regarding the composition of the 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 */
- /* really) two shift/reduces appear. */
- /* */
- /* So, instead we do a super trick: we just allow ($1) to be a */
- /* SimpleName Expression. */
- /* */
- if (((Expression) yyVals[-1+yyTop]) is SimpleName)
- yyVal = type (((SimpleName) yyVals[-1+yyTop]).Name);
- else {
- error (-1, "Invalid Type definition");
- yyVal = type ("object");
- }
- }
- break;
-case 430:
-#line 2082 "cs-parser.jay"
- {
- /* FIXME: Do something smart with the type here. */
- yyVal = yyVals[-1+yyTop];
- }
- break;
-case 431:
-#line 2087 "cs-parser.jay"
- {
- yyVal = type ("VOID SOMETHING TYPE");
- }
- break;
-case 437:
-#line 2109 "cs-parser.jay"
- {
- yyVal = declare_local_variables ((TypeRef) yyVals[-1+yyTop], (ArrayList) yyVals[0+yyTop]);
- }
- break;
-case 439:
-#line 2121 "cs-parser.jay"
- {
- yyVal = yyVals[-1+yyTop];
- }
- break;
-case 440:
-#line 2131 "cs-parser.jay"
- { yyVal = new StatementExpression ((Expression) yyVals[0+yyTop]); }
- break;
-case 441:
-#line 2132 "cs-parser.jay"
- { yyVal = new StatementExpression ((Expression) yyVals[0+yyTop]); }
- break;
-case 442:
-#line 2133 "cs-parser.jay"
- { yyVal = new StatementExpression ((Expression) yyVals[0+yyTop]); }
- break;
-case 443:
-#line 2134 "cs-parser.jay"
- { yyVal = new StatementExpression ((Expression) yyVals[0+yyTop]); }
- break;
-case 444:
-#line 2135 "cs-parser.jay"
- { yyVal = new StatementExpression ((Expression) yyVals[0+yyTop]); }
- break;
-case 445:
-#line 2136 "cs-parser.jay"
- { yyVal = new StatementExpression ((Expression) yyVals[0+yyTop]); }
- break;
-case 446:
-#line 2137 "cs-parser.jay"
- { yyVal = new StatementExpression ((Expression) yyVals[0+yyTop]); }
- break;
-case 447:
-#line 2142 "cs-parser.jay"
- { note ("complain if this is a delegate maybe?"); }
- break;
-case 450:
-#line 2153 "cs-parser.jay"
- {
- yyVal = new If ((Expression) yyVals[-2+yyTop], (Statement) yyVals[0+yyTop]);
- }
- break;
-case 451:
-#line 2158 "cs-parser.jay"
- {
- yyVal = new If ((Expression) yyVals[-4+yyTop], (Statement) yyVals[-2+yyTop], (Statement) yyVals[0+yyTop]);
- }
- break;
-case 452:
-#line 2166 "cs-parser.jay"
- {
- yyVal = new Switch ((Expression) yyVals[-2+yyTop], (ArrayList) yyVals[0+yyTop]);
- }
- break;
-case 453:
-#line 2175 "cs-parser.jay"
- {
- yyVal = yyVals[-1+yyTop];
- }
- break;
-case 454:
-#line 2181 "cs-parser.jay"
- { yyVal = new ArrayList (); }
- break;
-case 456:
-#line 2187 "cs-parser.jay"
- {
- ArrayList sections = new ArrayList ();
-
- sections.Add (yyVals[0+yyTop]);
- yyVal = sections;
- }
- break;
-case 457:
-#line 2194 "cs-parser.jay"
- {
- ArrayList sections = (ArrayList) yyVals[-1+yyTop];
-
- sections.Add (yyVals[0+yyTop]);
- yyVal = sections;
- }
- break;
-case 458:
-#line 2204 "cs-parser.jay"
- {
- current_block = new Block (current_block);
- }
- break;
-case 459:
-#line 2208 "cs-parser.jay"
- {
- while (current_block.Implicit)
- current_block = current_block.Parent;
- yyVal = new SwitchSection ((ArrayList) yyVals[-2+yyTop], current_block);
- current_block = current_block.Parent;
- }
- break;
-case 460:
-#line 2218 "cs-parser.jay"
- {
- ArrayList labels = new ArrayList ();
-
- labels.Add (yyVals[0+yyTop]);
- yyVal = labels;
- }
- break;
-case 461:
-#line 2225 "cs-parser.jay"
- {
- ArrayList labels = (ArrayList) (yyVals[-1+yyTop]);
- labels.Add (yyVals[0+yyTop]);
-
- yyVal = labels;
- }
- break;
-case 462:
-#line 2234 "cs-parser.jay"
- { yyVal = new SwitchLabel ((Expression) yyVals[-1+yyTop]); }
- break;
-case 463:
-#line 2235 "cs-parser.jay"
- { yyVal = new SwitchLabel (null); }
- break;
-case 468:
-#line 2247 "cs-parser.jay"
- {
- yyVal = new While ((Expression) yyVals[-2+yyTop], (Statement) yyVals[0+yyTop]);
- }
- break;
-case 469:
-#line 2255 "cs-parser.jay"
- {
- yyVal = new Do ((Statement) yyVals[-5+yyTop], (Expression) yyVals[-2+yyTop]);
- }
- break;
-case 470:
-#line 2266 "cs-parser.jay"
- {
- yyVal = new For ((Statement) yyVals[-6+yyTop], (Expression) yyVals[-4+yyTop], (Statement) yyVals[-2+yyTop], (Statement) yyVals[0+yyTop]);
- }
- break;
-case 471:
-#line 2272 "cs-parser.jay"
- { yyVal = new EmptyStatement (); }
- break;
-case 475:
-#line 2282 "cs-parser.jay"
- { yyVal = new BoolLiteral (true); }
- break;
-case 477:
-#line 2287 "cs-parser.jay"
- { yyVal = new EmptyStatement (); }
- break;
-case 480:
-#line 2297 "cs-parser.jay"
- {
- Block b = new Block (null, true);
-
- b.AddStatement ((Statement) yyVals[0+yyTop]);
- yyVal = b;
- }
- break;
-case 481:
-#line 2304 "cs-parser.jay"
- {
- Block b = (Block) yyVals[-2+yyTop];
-
- b.AddStatement ((Statement) yyVals[0+yyTop]);
- yyVal = yyVals[-2+yyTop];
- }
- break;
-case 482:
-#line 2315 "cs-parser.jay"
- {
- string temp_id = current_block.MakeInternalID ();
- Expression assign_e, ma;
- Statement getcurrent;
- Block foreach_block, child_block;
-
- foreach_block = new Block (current_block, true);
-
- foreach_block.AddVariable (type ("IEnumerator"), temp_id);
- foreach_block.AddVariable ((TypeRef) yyVals[-5+yyTop], (string) yyVals[-4+yyTop]);
- assign_e = new Assign (new LocalVariableReference (foreach_block, temp_id),
- new Invocation (
- new MemberAccess ((Expression) yyVals[-2+yyTop], "GetEnumerator"), null));
- current_block.AddStatement (new StatementExpression (assign_e));
- ma = new MemberAccess (new LocalVariableReference (foreach_block, temp_id), "MoveNext");
- child_block = new Block (current_block);
-
- getcurrent = new StatementExpression (
- new Assign (
- new LocalVariableReference (foreach_block, (string) yyVals[-4+yyTop]),
- new Cast (
- (TypeRef) yyVals[-5+yyTop],
- new MemberAccess (
- new LocalVariableReference (foreach_block, temp_id), "Current"))));
-
- child_block.AddStatement (getcurrent);
- child_block.AddStatement ((Statement) yyVals[0+yyTop]);
- foreach_block.AddStatement (new While (ma, (Statement) child_block));
-
- yyVal = foreach_block;
- }
- break;
-case 488:
-#line 2358 "cs-parser.jay"
- {
- yyVal = new Break ();
- }
- break;
-case 489:
-#line 2365 "cs-parser.jay"
- {
- yyVal = new Continue ();
- }
- break;
-case 490:
-#line 2372 "cs-parser.jay"
- {
- yyVal = new Goto ((string) yyVals[-1+yyTop]);
- }
- break;
-case 493:
-#line 2381 "cs-parser.jay"
- {
- yyVal = new Return ((Expression) yyVals[-1+yyTop]);
- }
- break;
-case 494:
-#line 2388 "cs-parser.jay"
- {
- yyVal = new Throw ((Expression) yyVals[-1+yyTop]);
- }
- break;
-case 497:
-#line 2400 "cs-parser.jay"
- {
- DictionaryEntry cc = (DictionaryEntry) yyVals[0+yyTop];
- ArrayList s = null;
-
- if (cc.Key != null)
- s = (ArrayList) cc.Key;
-
- yyVal = new Try ((Block) yyVals[-1+yyTop], s, (Catch) cc.Value, null);
- }
- break;
-case 498:
-#line 2410 "cs-parser.jay"
- {
- yyVal = new Try ((Block) yyVals[-1+yyTop], null, null, (Block) yyVals[0+yyTop]);
- }
- break;
-case 499:
-#line 2414 "cs-parser.jay"
- {
- DictionaryEntry cc = (DictionaryEntry) yyVals[-1+yyTop];
- ArrayList s = null;
-
- if (cc.Key != null)
- s = (ArrayList) cc.Key;
-
- yyVal = new Try ((Block) yyVals[-2+yyTop], s, (Catch) cc.Value, (Block) yyVals[0+yyTop]);
- }
- break;
-case 500:
-#line 2427 "cs-parser.jay"
- {
- DictionaryEntry pair = new DictionaryEntry ();
-
- pair.Key = yyVals[-1+yyTop];
- pair.Value = yyVals[0+yyTop];
-
- yyVal = pair;
- }
- break;
-case 501:
-#line 2436 "cs-parser.jay"
- {
- DictionaryEntry pair = new DictionaryEntry ();
- pair.Key = yyVals[-1+yyTop];
- pair.Value = yyVals[-1+yyTop];
-
- yyVal = pair;
- }
- break;
-case 502:
-#line 2446 "cs-parser.jay"
- { yyVal = null; }
- break;
-case 504:
-#line 2451 "cs-parser.jay"
- { yyVal = null; }
- break;
-case 506:
-#line 2457 "cs-parser.jay"
- {
- ArrayList l = new ArrayList ();
-
- l.Add (yyVals[0+yyTop]);
- yyVal = l;
- }
- break;
-case 507:
-#line 2464 "cs-parser.jay"
- {
- ArrayList l = (ArrayList) yyVals[-1+yyTop];
-
- l.Add (yyVals[0+yyTop]);
- yyVal = l;
- }
- break;
-case 508:
-#line 2474 "cs-parser.jay"
- {
- string id = null;
-
- if (yyVals[-2+yyTop] != null)
- id = (string) yyVals[-2+yyTop];
-
- yyVal = new Catch ((TypeRef) yyVals[-3+yyTop], id, (Block) yyVals[0+yyTop]);
- }
- break;
-case 509:
-#line 2485 "cs-parser.jay"
- { yyVal = null; }
- break;
-case 511:
-#line 2491 "cs-parser.jay"
- {
- yyVal = new Catch (null, null, (Block) yyVals[0+yyTop]);
- }
- break;
-case 512:
-#line 2498 "cs-parser.jay"
- {
- yyVal = yyVals[0+yyTop];
- }
- break;
-case 513:
-#line 2505 "cs-parser.jay"
- {
- yyVal = new Checked ((Block) yyVals[0+yyTop]);
- }
- break;
-case 514:
-#line 2512 "cs-parser.jay"
- {
- yyVal = new Unchecked ((Block) yyVals[0+yyTop]);
- }
- break;
-case 515:
-#line 2519 "cs-parser.jay"
- {
- yyVal = new Lock ((Expression) yyVals[-2+yyTop], (Statement) yyVals[0+yyTop]);
- }
- break;
-#line 2673 "-"
- }
- yyTop -= yyLen[yyN];
- yyState = yyStates[yyTop];
- int yyM = yyLhs[yyN];
- if (yyState == 0 && yyM == 0) {
- if (yydebug != null) yydebug.shift(0, yyFinal);
- yyState = yyFinal;
- if (yyToken < 0) {
- yyToken = yyLex.advance() ? yyLex.token() : 0;
- if (yydebug != null)
- yydebug.lex(yyState, yyToken,yyname(yyToken), yyLex.value());
- }
- if (yyToken == 0) {
- if (yydebug != null) yydebug.accept(yyVal);
- return yyVal;
- }
- goto yyLoop;
- }
- if (((yyN = yyGindex[yyM]) != 0) && ((yyN += yyState) >= 0)
- && (yyN < yyTable.Length) && (yyCheck[yyN] == yyState))
- yyState = yyTable[yyN];
- else
- yyState = yyDgoto[yyM];
- if (yydebug != null) yydebug.shift(yyStates[yyTop], yyState);
- goto yyLoop;
- }
- }
- }
-
- static short [] yyLhs = { -1,
- 0, 4, 4, 5, 5, 6, 7, 10, 10, 14,
- 11, 15, 15, 16, 16, 12, 12, 9, 13, 1,
- 1, 3, 3, 17, 17, 18, 18, 19, 19, 19,
- 19, 19, 2, 2, 25, 26, 26, 27, 28, 28,
- 30, 31, 31, 31, 29, 29, 32, 32, 33, 34,
- 34, 36, 36, 38, 38, 39, 39, 40, 41, 41,
- 42, 42, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 55, 21, 54, 54, 57, 57, 58, 56,
- 60, 60, 61, 61, 62, 62, 62, 62, 62, 62,
- 62, 62, 62, 44, 64, 64, 65, 45, 67, 67,
- 68, 68, 69, 69, 46, 71, 71, 72, 72, 74,
- 74, 76, 76, 76, 77, 77, 79, 80, 80, 81,
- 81, 78, 73, 73, 84, 85, 47, 83, 83, 89,
- 89, 87, 87, 86, 91, 88, 90, 90, 93, 22,
- 92, 92, 95, 96, 96, 94, 97, 97, 98, 98,
- 99, 99, 99, 99, 104, 104, 100, 100, 106, 107,
- 101, 105, 105, 105, 105, 102, 108, 109, 103, 50,
- 110, 110, 110, 111, 111, 111, 111, 111, 111, 111,
- 111, 111, 111, 111, 111, 111, 111, 111, 111, 111,
- 111, 111, 111, 111, 111, 112, 112, 51, 113, 114,
- 114, 115, 115, 52, 48, 48, 117, 117, 118, 119,
- 49, 120, 120, 23, 121, 121, 122, 122, 124, 124,
- 125, 125, 126, 126, 24, 35, 8, 63, 63, 63,
- 59, 59, 127, 127, 127, 127, 127, 127, 127, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 82, 128,
- 130, 130, 130, 130, 130, 130, 130, 130, 130, 130,
- 130, 130, 130, 130, 130, 131, 131, 131, 131, 131,
- 131, 147, 147, 147, 146, 145, 145, 132, 133, 133,
- 148, 134, 116, 116, 149, 149, 150, 150, 150, 151,
- 135, 152, 152, 136, 137, 137, 138, 139, 140, 140,
- 153, 154, 155, 155, 129, 129, 157, 158, 158, 159,
- 159, 156, 156, 70, 70, 70, 160, 160, 141, 142,
- 143, 144, 161, 161, 161, 161, 161, 161, 161, 161,
- 161, 161, 162, 163, 164, 164, 165, 165, 165, 165,
- 166, 166, 166, 167, 167, 167, 168, 168, 168, 168,
- 168, 168, 168, 169, 169, 169, 170, 170, 171, 171,
- 172, 172, 173, 173, 174, 174, 175, 175, 176, 176,
- 176, 176, 176, 176, 176, 176, 176, 176, 176, 37,
- 37, 66, 177, 179, 20, 53, 53, 180, 180, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 178, 178, 182, 184, 75, 183, 183, 185, 185,
- 186, 186, 186, 188, 188, 188, 188, 188, 188, 188,
- 188, 188, 188, 188, 190, 189, 187, 187, 202, 202,
- 202, 203, 203, 204, 204, 205, 200, 201, 191, 206,
- 206, 206, 206, 206, 206, 206, 207, 192, 192, 208,
- 208, 209, 210, 211, 211, 212, 212, 215, 213, 214,
- 214, 216, 216, 193, 193, 193, 193, 217, 218, 219,
- 221, 221, 224, 224, 222, 222, 223, 223, 226, 225,
- 225, 220, 194, 194, 194, 194, 194, 227, 228, 229,
- 229, 229, 230, 231, 232, 232, 195, 195, 195, 233,
- 233, 236, 236, 237, 237, 235, 235, 239, 240, 240,
- 238, 234, 196, 197, 198, 199, 241,
- };
- static short [] yyLen = { 2,
- 4, 1, 2, 1, 1, 5, 3, 1, 2, 0,
- 5, 0, 1, 0, 1, 1, 3, 1, 4, 0,
- 1, 0, 1, 1, 2, 1, 1, 1, 1, 1,
- 1, 1, 0, 1, 1, 1, 2, 4, 0, 1,
- 2, 1, 1, 1, 1, 3, 1, 1, 1, 0,
- 3, 1, 3, 0, 1, 1, 2, 3, 0, 1,
- 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 0, 8, 0, 1, 1, 2, 2, 3,
- 0, 1, 1, 2, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 6, 1, 3, 3, 5, 1, 3,
- 3, 1, 1, 1, 2, 7, 7, 1, 1, 0,
- 1, 1, 3, 1, 1, 3, 4, 0, 1, 1,
- 1, 4, 1, 3, 0, 0, 9, 2, 2, 0,
- 1, 0, 1, 3, 0, 4, 1, 1, 0, 7,
- 0, 1, 2, 1, 3, 3, 0, 1, 1, 2,
- 1, 1, 1, 1, 0, 1, 8, 8, 0, 0,
- 9, 3, 3, 6, 6, 6, 0, 0, 12, 4,
- 7, 10, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 7, 7, 4, 5, 0,
- 1, 5, 5, 6, 6, 9, 2, 2, 3, 3,
- 6, 5, 7, 7, 0, 2, 3, 4, 0, 1,
- 1, 3, 2, 4, 9, 1, 1, 1, 1, 1,
- 1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
- 1, 4, 0, 1, 1, 3, 1, 2, 2, 1,
- 4, 1, 3, 1, 3, 4, 2, 2, 1, 1,
- 5, 7, 0, 1, 1, 2, 3, 0, 1, 1,
- 2, 0, 1, 2, 3, 4, 1, 3, 4, 4,
- 4, 4, 1, 2, 2, 2, 2, 2, 2, 1,
- 1, 1, 2, 2, 4, 4, 1, 3, 3, 3,
- 1, 3, 3, 1, 3, 3, 1, 3, 3, 3,
- 3, 3, 3, 1, 3, 3, 1, 3, 1, 3,
- 1, 3, 1, 3, 1, 3, 1, 5, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 1,
- 1, 1, 1, 0, 8, 0, 1, 1, 2, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 0, 1, 2, 0, 4, 0, 1, 1, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 3, 2, 2, 2, 2,
- 2, 0, 1, 1, 2, 3, 2, 3, 2, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 5,
- 7, 5, 3, 0, 1, 1, 2, 0, 3, 1,
- 2, 3, 2, 1, 1, 1, 1, 5, 7, 9,
- 0, 1, 1, 1, 0, 1, 0, 1, 1, 1,
- 3, 8, 1, 1, 1, 1, 1, 2, 2, 3,
- 4, 3, 3, 3, 0, 1, 3, 3, 4, 2,
- 2, 0, 1, 0, 1, 1, 2, 6, 0, 1,
- 2, 2, 2, 2, 5, 5, 2,
- };
- static short [] yyDefRed = { 0,
- 0, 0, 0, 0, 2, 4, 5, 0, 18, 0,
- 0, 0, 0, 34, 0, 36, 3, 0, 7, 0,
- 43, 44, 42, 0, 40, 0, 0, 0, 0, 27,
- 0, 24, 26, 28, 29, 30, 31, 32, 37, 16,
- 0, 17, 0, 226, 0, 45, 47, 48, 49, 41,
- 0, 395, 401, 393, 390, 400, 394, 392, 391, 398,
- 396, 397, 399, 0, 0, 388, 1, 25, 6, 0,
- 235, 241, 248, 0, 236, 238, 277, 237, 244, 246,
- 0, 271, 233, 240, 242, 0, 234, 294, 276, 0,
- 245, 247, 0, 243, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 275, 272, 273, 274, 269, 270, 0,
- 0, 52, 239, 281, 0, 251, 253, 254, 255, 256,
- 257, 258, 259, 260, 261, 262, 263, 264, 265, 266,
- 267, 268, 0, 299, 300, 0, 330, 331, 332, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 380,
- 381, 38, 0, 0, 0, 0, 0, 0, 0, 389,
- 0, 0, 0, 228, 0, 229, 230, 0, 0, 0,
- 0, 0, 0, 327, 324, 325, 326, 329, 328, 333,
- 334, 51, 0, 0, 0, 0, 297, 298, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 46, 0, 0, 384, 0, 0, 139, 73, 292,
- 0, 295, 0, 0, 0, 0, 305, 0, 0, 0,
- 0, 278, 0, 53, 0, 0, 0, 287, 0, 0,
- 285, 279, 280, 369, 370, 371, 372, 373, 374, 375,
- 376, 377, 379, 378, 338, 340, 339, 337, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 13, 11, 0,
- 0, 0, 0, 0, 0, 0, 296, 0, 321, 310,
- 0, 0, 0, 0, 306, 320, 319, 322, 335, 336,
- 291, 290, 289, 288, 282, 0, 0, 0, 0, 0,
- 403, 0, 216, 0, 0, 0, 0, 142, 0, 0,
- 0, 77, 293, 0, 307, 311, 301, 286, 368, 19,
- 0, 0, 0, 0, 0, 0, 0, 114, 115, 0,
- 0, 0, 221, 214, 249, 144, 0, 0, 140, 0,
- 0, 0, 78, 0, 0, 0, 0, 72, 0, 0,
- 61, 63, 64, 65, 66, 67, 68, 69, 70, 71,
- 0, 385, 121, 0, 120, 0, 119, 0, 0, 0,
- 217, 0, 0, 0, 0, 0, 149, 151, 152, 153,
- 154, 0, 93, 85, 86, 87, 88, 89, 90, 91,
- 92, 0, 0, 83, 74, 0, 313, 302, 0, 0,
- 58, 62, 405, 109, 105, 108, 0, 0, 225, 113,
- 116, 0, 218, 222, 145, 156, 0, 146, 150, 80,
- 84, 314, 103, 317, 104, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 173, 0, 0, 0, 122,
- 117, 224, 0, 0, 0, 315, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 99, 0, 0, 170, 198, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 425, 0, 414, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 442, 0, 0, 409,
- 411, 412, 413, 415, 416, 417, 418, 419, 420, 421,
- 422, 423, 424, 0, 0, 0, 0, 441, 448, 449,
- 464, 465, 466, 467, 483, 484, 485, 486, 487, 0,
- 0, 0, 0, 316, 318, 0, 0, 0, 95, 0,
- 0, 0, 0, 0, 0, 0, 111, 179, 178, 175,
- 180, 181, 174, 193, 192, 185, 186, 182, 184, 183,
- 187, 176, 177, 188, 189, 195, 194, 190, 191, 0,
- 0, 0, 0, 98, 125, 0, 0, 0, 0, 0,
- 0, 488, 513, 0, 489, 0, 0, 0, 0, 0,
- 0, 0, 0, 496, 0, 0, 0, 0, 514, 0,
- 0, 431, 0, 434, 0, 0, 430, 0, 429, 406,
- 410, 427, 428, 0, 0, 439, 0, 0, 0, 159,
- 0, 204, 0, 0, 94, 205, 0, 0, 0, 0,
- 124, 0, 0, 0, 101, 100, 0, 0, 0, 0,
- 135, 211, 0, 128, 133, 0, 131, 129, 438, 0,
- 473, 480, 0, 472, 0, 0, 382, 0, 492, 490,
- 383, 0, 0, 493, 0, 494, 0, 0, 0, 498,
- 0, 0, 506, 0, 0, 0, 0, 0, 435, 0,
- 426, 166, 0, 0, 0, 0, 97, 96, 0, 0,
- 0, 0, 0, 0, 107, 0, 199, 201, 0, 212,
- 126, 106, 0, 138, 137, 134, 0, 0, 0, 0,
- 0, 491, 0, 0, 0, 0, 512, 499, 0, 500,
- 503, 507, 0, 501, 517, 0, 436, 0, 0, 0,
- 0, 160, 0, 0, 0, 0, 0, 207, 0, 208,
- 0, 0, 0, 0, 0, 0, 0, 136, 0, 476,
- 0, 481, 0, 0, 515, 0, 452, 0, 511, 516,
- 468, 158, 167, 0, 0, 0, 157, 209, 210, 206,
- 197, 196, 0, 0, 171, 0, 127, 213, 0, 0,
- 0, 0, 0, 0, 0, 0, 456, 0, 460, 510,
- 0, 0, 0, 0, 161, 0, 0, 0, 469, 0,
- 0, 478, 0, 451, 0, 463, 453, 457, 0, 461,
- 0, 168, 0, 0, 202, 203, 0, 0, 482, 462,
- 0, 508, 0, 0, 0, 172, 470, 169, 164, 165,
- };
- protected static short [] yyDgoto = { 2,
- 3, 345, 29, 4, 5, 6, 7, 44, 10, 0,
- 30, 110, 224, 154, 289, 0, 31, 32, 33, 34,
- 35, 36, 37, 38, 14, 15, 16, 24, 45, 25,
- 26, 46, 47, 48, 164, 111, 248, 0, 0, 344,
- 369, 370, 371, 372, 373, 374, 375, 376, 377, 378,
- 379, 380, 420, 330, 296, 362, 331, 332, 341, 412,
- 413, 414, 342, 558, 559, 678, 480, 481, 444, 445,
- 381, 425, 474, 566, 507, 567, 347, 348, 349, 386,
- 387, 475, 599, 657, 766, 600, 664, 601, 668, 726,
- 727, 327, 295, 359, 328, 357, 395, 396, 397, 398,
- 399, 400, 401, 437, 752, 705, 786, 812, 843, 455,
- 590, 456, 457, 717, 718, 249, 710, 711, 712, 458,
- 294, 325, 113, 351, 352, 353, 114, 167, 236, 115,
- 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
- 126, 127, 128, 129, 130, 131, 132, 133, 250, 251,
- 313, 245, 134, 135, 365, 418, 237, 302, 303, 446,
- 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
- 146, 147, 148, 149, 150, 151, 682, 320, 290, 65,
- 66, 321, 518, 459, 519, 520, 521, 522, 523, 524,
- 525, 526, 527, 528, 529, 530, 531, 532, 533, 534,
- 535, 536, 629, 623, 624, 537, 538, 539, 540, 777,
- 805, 806, 807, 808, 829, 809, 541, 542, 543, 544,
- 673, 771, 820, 674, 675, 822, 545, 546, 547, 548,
- 549, 615, 689, 690, 691, 740, 692, 741, 693, 811,
- 697,
- };
- protected static short [] yySindex = { -312,
- -236, 0, -116, -312, 0, 0, 0, -97, 0, -56,
- -15, -273, -90, 0, -116, 0, 0, -49, 0, -44,
- 0, 0, 0, -328, 0, 69, -49, 4393, 166, 0,
- -90, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 63, 0, 8029, 0, -58, 0, 0, 0, 0, 0,
- -15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 36, 4393, 0, 0, 0, 0, 19,
- 0, 0, 0, 86, 0, 0, 0, 0, 0, 0,
- 468, 0, 0, 0, 0, 90, 0, 0, 0, 95,
- 0, 0, 98, 0, 8029, 8029, 8029, 8029, 8029, 8029,
- 8029, 8029, 8029, 0, 0, 0, 0, 0, 0, -15,
- 88, 0, 0, 0, 74, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 111, 0, 0, 429, 0, 0, 0, -9,
- -51, 78, -155, 73, 112, 118, 126, 96, -295, 0,
- 0, 0, -328, 158, 83, 468, 87, 91, 100, 0,
- 8029, 101, 8029, 0, 116, 0, 0, 468, 468, 8029,
- -293, 168, 171, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 8029, 8029, 6957, 102, 0, 0, 103, 8029,
- 8029, 8029, 8029, 8029, 8029, 8029, 8029, 8029, 8029, 8029,
- 8029, 8029, 8029, 8029, 8029, 8029, 8029, 468, 468, 8029,
- 8029, 8029, 8029, 8029, 8029, 8029, 8029, 8029, 8029, 8029,
- 8029, 0, -312, 173, 0, -310, 175, 0, 0, 0,
- 33, 0, 179, 7493, 6957, 184, 0, -186, -87, 182,
- 8029, 0, 8029, 0, 34, 8029, 8029, 0, 183, 185,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, -9, -9,
- -51, -51, 184, 184, 78, 78, 78, 78, -155, -155,
- 73, 112, 118, 126, 193, 96, -90, 0, 0, 194,
- 186, 187, 31, 190, 196, 199, 0, 8029, 0, 0,
- 35, 200, 201, 204, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 6957, 8029, 210, 468, 213,
- 0, -116, 0, -116, 173, -49, 216, 0, 468, 217,
- 199, 0, 0, 184, 0, 0, 0, 0, 0, 0,
- 468, 184, -116, 173, 38, 215, 218, 0, 0, 149,
- 222, 221, 0, 0, 0, 0, 223, -116, 0, 468,
- -116, 173, 0, 184, 224, 184, 4236, 0, 230, -116,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -299, 0, 0, 468, 0, 468, 0, 225, -116, 219,
- 0, -19, -49, 275, 235, -116, 0, 0, 0, 0,
- 0, 4393, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 236, -116, 0, 0, 7091, 0, 0, 162, 8233,
- 0, 0, 0, 0, 0, 0, -305, -287, 0, 0,
- 0, 8029, 0, 0, 0, 0, 8585, 0, 0, 0,
- 0, 0, 0, 0, 0, -60, 234, 468, 468, 276,
- 278, 164, 240, -208, 249, 0, 249, 251, 4633, 0,
- 0, 0, 468, 174, -265, 0, 7225, 250, -276, -266,
- 468, 468, 0, 254, 247, -116, 661, 252, 246, 119,
- 0, 43, 255, 0, 0, -116, 256, 54, 468, 258,
- 4947, 259, 266, -263, 267, 269, 8029, 272, 8029, 249,
- 64, 274, 279, 280, 0, 277, 0, 279, 79, 0,
- 0, 0, 0, 429, 0, 0, 0, 281, 4633, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 271, 282, 209, 285, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, -256,
- 284, 288, 70, 0, 0, 249, 283, 125, 0, 134,
- 286, 145, 146, -116, 227, 291, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 295,
- -116, 7627, 209, 0, 0, -116, -308, 155, 299, -116,
- -116, 0, 0, -276, 0, 311, 7761, 468, 8029, 300,
- 301, 8029, 8029, 0, 305, 8029, 308, -241, 0, 8163,
- 186, 0, 279, 0, 8029, 4633, 0, 7493, 0, 0,
- 0, 0, 0, 246, 312, 0, 309, -116, -116, 0,
- -116, 0, 8029, 243, 0, 0, -116, 468, 468, 317,
- 0, 315, 468, 321, 0, 0, -116, 322, 329, -36,
- 0, 0, 334, 0, 0, 339, 0, 0, 0, 336,
- 0, 0, 332, 0, 331, -239, 0, 333, 0, 0,
- 0, 338, 340, 0, 342, 0, 344, 249, 400, 0,
- 422, 423, 0, 8029, 79, 8029, 348, 351, 0, 350,
- 0, 0, 352, 353, -116, 359, 0, 0, -212, 364,
- -116, -116, -238, -233, 0, -240, 0, 0, -231, 0,
- 0, 0, -116, 0, 0, 0, -36, 8029, 8029, 8029,
- 414, 0, 4947, 4947, 369, 468, 0, 0, 75, 0,
- 0, 0, 249, 0, 0, 4947, 0, 4947, 361, 371,
- 156, 0, 363, 249, 249, 367, 405, 0, 452, 0,
- 377, 378, 380, 381, 152, 386, 385, 0, 384, 0,
- 383, 0, 8029, 456, 0, -61, 0, -226, 0, 0,
- 0, 0, 0, 388, 389, 394, 0, 0, 0, 0,
- 0, 0, 6957, 6957, 0, 468, 0, 0, 391, 8029,
- 397, 4947, 8029, 382, 403, -61, 0, -61, 0, 0,
- 406, -116, -116, -116, 0, 407, 410, -194, 0, 413,
- 331, 0, 4947, 0, 415, 0, 0, 0, 4633, 0,
- 249, 0, 427, 412, 0, 0, 424, 4947, 0, 0,
- 4633, 0, 430, 419, 426, 0, 0, 0, 0, 0,
- };
- protected static short [] yyRindex = { 8996,
- 0, 0, 9143, 8886, 0, 0, 0, -76, 0, 0,
- 2129, 28, 9198, 0, 813, 0, 0, 0, 0, 0,
- 0, 0, 0, 81, 0, 0, 0, 85, 0, 0,
- 9051, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 433, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 8315, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1681,
- 0, 0, 0, 0, 1838, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1995, 0, 0, 0, 2397,
- 2799, 2933, 5081, 5483, 5751, 5885, 6287, 6555, 6823, 0,
- 0, 0, 81, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 8741, 0, 432, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 434, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 9073, 8941, 0, 0, 440, 0, 0, 0,
- 0, 0, 0, 442, 434, 2263, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 443,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 2531, 2665,
- 3067, 3201, 3335, 3469, 3603, 3737, 3871, 4005, 5215, 5349,
- 5617, 6019, 6153, 6421, 0, 6689, 9126, 0, 0, 449,
- 442, 0, 0, 0, 450, 451, 0, 0, 0, 0,
- 0, 0, 454, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 8553, 0, -318, -235, 0, 0, 0, 0, 0,
- 453, 0, 0, 1210, 0, 0, 0, 0, 0, 0,
- 458, 8632, 889, -235, 8742, 0, 157, 0, 0, 0,
- 0, 459, 0, 0, 0, 0, 461, 8426, 0, -80,
- 1051, -235, 0, 1367, 1524, 8668, 8382, 0, 0, 970,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 8553, -29,
- 0, 374, 0, 8720, 0, 8478, 0, 0, 0, 0,
- 0, 8382, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1130, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, -225, 0, 0, 0, 0, 0, 463, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 160, 0, 0, 8509, 0, 0, -12, 0,
- 0, 0, 0, 0, 0, 172, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 445, 0, 445, 0,
- 0, 0, 387, 0, 0, 9299, 0, -327, -108, 9155,
- 9178, 9237, 9248, 0, 584, 1195, 0, 0, 465, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 8509, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 8553, 0, 0, 0, 0, 8509, 0, 0, 0, 2,
- -150, 0, 0, 0, 0, 0, 462, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 442, 0, 402, 0, 0, 0, 0, 442, 0, 0,
- 0, 0, 0, 7359, 7895, 0, 0, 8509, 8553, 0,
- 8509, 0, 0, 0, 0, 0, -115, 0, 0, 0,
- 0, 467, 0, 0, 0, 0, 172, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 473, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 4319, 0,
- 4162, 0, 0, 0, 387, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 172, 0, 0, 0, 0, 0,
- 499, 563, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 8553, 0, 0, 0, 0, 0, 481, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 4476, 0, 491, 0, 489, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 434, 434, 0, 0, 0, 0, 0, 490,
- 0, 0, 0, 0, 0, 496, 0, 4790, 0, 0,
- 0, 172, 48, 5, 0, 0, 0, 0, 0, 0,
- 493, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -123, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- };
- protected static short [] yyGindex = { 0,
- 618, -3, 555, 0, 839, 0, 0, 195, 0, 0,
- 0, 8, 0, 0, -45, 0, 0, 814, -158, 0,
- 0, 0, 0, 0, 0, 0, 834, 0, 0, 0,
- 0, 698, 0, 0, -22, 0, -25, 0, 0, 0,
- 0, 0, 482, -206, -161, -156, -153, -146, -135, -110,
- -107, 0, 825, 0, 0, 0, 0, 523, 528, 0,
- 0, 446, 229, 0, -454, -624, -415, 268, -453, 501,
- 0, 0, -272, -501, -192, -319, 0, 475, 478, 0,
- 0, -321, 212, 0, 0, 270, 0, 273, 0, 147,
- 0, 0, 0, 0, 0, 0, 0, 0, 476, 0,
- 0, 0, 0, 0, 68, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, -234, 0, 163, 165, 0,
- 0, 0, 586, 0, 0, 494, 67, 0, 549, -429,
- 0, 0, 0, -193, 0, 0, 0, 17, 114, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 572,
- 643, -10, 151, 0, 0, 0, -223, -306, 0, 0,
- 27, 161, 208, 0, 198, 248, 253, 298, 676, 681,
- 675, 682, 679, 0, 0, 263, -609, 0, 0, 0,
- 837, 0, 0, 0, 76, -513, 0, -484, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, -558,
- 0, 0, -134, 0, 287, -596, 0, 0, 0, 0,
- 0, 0, 97, 0, 0, 104, 0, 0, 0, 0,
- 0, 0, 0, 0, 106, 0, 0, 0, 0, 0,
- 0, 416, 0, 228, 0, 0, 0, 226, 220, 0,
- 0,
- };
- protected static short [] yyTable = { 13,
- 304, 49, 346, 609, 356, 631, 606, 21, 11, 28,
- 672, 610, 305, 555, 659, 700, 43, 112, 707, 281,
- 1, 12, 763, 219, 12, 11, 687, 28, 12, 509,
- 12, 11, 291, 12, 51, 12, 12, 291, 12, 22,
- 12, 423, 12, 688, 12, 12, 12, 12, 671, 754,
- 424, 12, 241, 20, 560, 291, 12, 552, 12, 12,
- 12, 696, 650, 12, 12, 12, 291, 12, 220, 172,
- 12, 435, 12, 12, 12, 12, 291, 291, 16, 12,
- 12, 12, 764, 12, 12, 12, 291, 221, 11, 509,
- 40, 432, 12, 12, 658, 477, 12, 16, 12, 12,
- 33, 755, 171, 291, 291, 208, 12, 12, 292, 291,
- 651, 291, 701, 460, 478, 12, 291, 16, 769, 770,
- 635, 16, 174, 175, 176, 177, 178, 179, 180, 181,
- 49, 461, 483, 772, 291, 230, 703, 233, 655, 706,
- 305, 209, 557, 459, 240, 23, 33, 166, 291, 669,
- 231, 459, 479, 553, 404, 611, 291, 244, 230, 306,
- 11, 173, 637, 11, 254, 255, 256, 257, 258, 259,
- 260, 261, 262, 263, 264, 11, 11, 509, 825, 731,
- 761, 482, 8, 12, 368, 762, 33, 765, 426, 708,
- 695, 130, 810, 16, 285, 9, 509, 561, 33, 405,
- 210, 211, 403, 672, 406, 803, 404, 407, 230, 27,
- 479, 368, 41, 804, 408, 11, 11, 212, 459, 213,
- 312, 312, 166, 301, 837, 409, 12, 265, 266, 267,
- 268, 268, 268, 268, 166, 166, 268, 268, 268, 268,
- 268, 268, 268, 268, 268, 268, 323, 268, 774, 775,
- 410, 405, 12, 411, 403, 291, 406, 18, 307, 407,
- 79, 780, 484, 781, 485, 510, 408, 309, 79, 310,
- 16, 654, 333, 16, 166, 166, 323, 409, 323, 354,
- 323, 466, 323, 28, 323, 152, 323, 467, 323, 153,
- 323, 339, 323, 19, 323, 603, 72, 510, 382, 73,
- 204, 205, 410, 355, 423, 411, 155, 618, 619, 165,
- 432, 156, 223, 724, 698, 157, 415, 824, 223, 704,
- 350, 698, 433, 12, 79, 510, 11, 631, 123, 80,
- 158, 20, 123, 11, 16, 102, 11, 102, 839, 367,
- 33, 33, 383, 132, 384, 84, 163, 85, 11, 385,
- 201, 202, 203, 847, 394, 386, 159, 402, 91, 92,
- 386, 161, 94, 642, 386, 162, 367, 11, 622, 40,
- 355, 39, 39, 627, 42, 39, 297, 311, 334, 386,
- 298, 298, 298, 595, 226, 166, 33, 596, 350, 162,
- 443, 11, 394, 11, 423, 166, 238, 239, 163, 509,
- 11, 269, 270, 767, 423, 386, 462, 166, 170, 402,
- 640, 509, 69, 510, 641, 423, 184, 50, 185, 736,
- 186, 628, 67, 185, 50, 186, 166, 11, 50, 355,
- 163, 355, 510, 182, 168, 183, 273, 274, 187, 169,
- 188, 443, 170, 187, 11, 188, 206, 355, 207, 214,
- 166, 215, 166, 271, 272, 11, 11, 189, 234, 11,
- 235, 11, 275, 276, 277, 278, 593, 725, 594, 216,
- 11, 614, 644, 614, 645, 511, 219, 11, 11, 11,
- 217, 593, 598, 646, 218, 514, 166, 291, 291, 648,
- 649, 660, 784, 661, 785, 737, 11, 795, 223, 796,
- 112, 225, 112, 166, 123, 227, 16, 511, 33, 228,
- 33, 279, 280, 242, 166, 166, 243, 514, 229, 232,
- 252, 253, 288, 293, 299, 508, 291, 308, 315, 166,
- 324, 322, 316, 300, 725, 511, 510, 166, 166, 510,
- 510, 317, 319, 335, 326, 514, 779, 329, 336, 337,
- 779, 340, 510, 343, 510, 166, 358, 361, 816, 817,
- 388, 788, 789, 391, 416, 389, 443, 390, 392, 366,
- 393, 421, 512, 432, 429, 436, 438, 440, 468, 471,
- 447, 472, 473, 677, 476, 508, 681, 683, 366, 423,
- 685, 486, 551, 565, 591, 556, 663, 666, 564, 681,
- 592, 597, 230, 607, 512, 602, 510, 605, 510, 513,
- 608, 612, 427, 613, 428, 11, 616, 677, 620, 515,
- 632, 621, 630, 511, 625, 626, 647, 634, 638, 510,
- 639, 633, 512, 514, 636, 510, 652, 643, 842, 653,
- 662, 513, 511, 709, 510, 651, 670, 510, 454, 679,
- 680, 515, 514, 598, 684, 11, 11, 686, 702, 593,
- 11, 557, 715, 716, 720, 465, 516, 722, 172, 513,
- 745, 723, 661, 508, 166, 660, 469, 470, 730, 515,
- 728, 729, 732, 733, 688, 734, 508, 735, 736, 739,
- 743, 550, 508, 746, 747, 748, 750, 749, 516, 562,
- 563, 751, 681, 681, 753, 756, 773, 757, 759, 776,
- 782, 783, 787, 754, 166, 166, 790, 604, 755, 166,
- 512, 517, 791, 792, 793, 794, 516, 797, 798, 799,
- 826, 71, 800, 72, 802, 815, 73, 813, 814, 512,
- 819, 75, 823, 11, 827, 76, 511, 801, 845, 511,
- 511, 831, 835, 517, 78, 836, 514, 513, 838, 514,
- 514, 79, 511, 840, 511, 844, 80, 515, 849, 846,
- 83, 848, 514, 10, 514, 850, 513, 677, 281, 283,
- 215, 517, 84, 190, 85, 308, 515, 87, 284, 402,
- 141, 75, 33, 76, 495, 91, 92, 309, 404, 94,
- 220, 143, 166, 11, 407, 432, 408, 200, 751, 833,
- 834, 471, 33, 191, 516, 192, 511, 193, 511, 194,
- 433, 195, 474, 196, 33, 197, 514, 198, 514, 199,
- 475, 200, 454, 516, 509, 477, 676, 455, 479, 511,
- 287, 318, 17, 512, 68, 511, 512, 512, 39, 514,
- 222, 422, 64, 363, 511, 514, 360, 511, 441, 512,
- 656, 512, 166, 430, 514, 417, 431, 514, 721, 517,
- 667, 439, 665, 768, 760, 758, 713, 714, 323, 832,
- 513, 719, 364, 513, 513, 434, 40, 338, 517, 314,
- 515, 281, 283, 515, 515, 508, 513, 282, 513, 286,
- 284, 160, 828, 0, 841, 821, 515, 508, 515, 699,
- 742, 830, 0, 512, 617, 512, 738, 744, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 445,
- 0, 445, 0, 445, 0, 0, 512, 516, 330, 0,
- 516, 516, 512, 0, 568, 0, 0, 0, 0, 0,
- 513, 512, 513, 516, 512, 516, 0, 0, 0, 0,
- 515, 0, 515, 0, 778, 0, 0, 0, 330, 0,
- 330, 0, 330, 513, 330, 0, 330, 0, 330, 513,
- 330, 0, 330, 515, 330, 569, 330, 0, 513, 515,
- 0, 513, 517, 0, 0, 517, 517, 0, 515, 0,
- 0, 515, 0, 0, 0, 0, 0, 516, 517, 516,
- 517, 570, 571, 572, 573, 0, 574, 575, 576, 577,
- 578, 579, 580, 581, 818, 582, 0, 583, 0, 584,
- 516, 585, 0, 586, 0, 587, 516, 588, 0, 589,
- 0, 0, 0, 0, 0, 516, 0, 0, 516, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 517, 0, 517, 0, 0, 0, 0, 35,
- 0, 0, 35, 0, 35, 0, 35, 0, 35, 0,
- 0, 35, 0, 35, 35, 517, 35, 0, 35, 0,
- 35, 517, 35, 35, 35, 35, 0, 0, 0, 35,
- 517, 0, 0, 517, 35, 0, 35, 35, 35, 0,
- 0, 35, 35, 35, 0, 35, 0, 35, 35, 35,
- 35, 35, 35, 35, 35, 0, 35, 35, 35, 35,
- 0, 35, 35, 35, 0, 0, 0, 0, 0, 0,
- 35, 35, 0, 0, 35, 0, 35, 35, 33, 35,
- 0, 35, 33, 0, 33, 0, 0, 33, 0, 33,
- 33, 0, 33, 35, 33, 0, 33, 0, 33, 33,
- 33, 33, 0, 0, 0, 33, 0, 0, 0, 0,
- 33, 0, 33, 33, 33, 0, 0, 33, 0, 33,
- 0, 33, 0, 0, 33, 0, 33, 33, 33, 33,
- 0, 0, 0, 33, 33, 33, 0, 33, 33, 33,
- 0, 0, 0, 0, 0, 0, 33, 33, 0, 0,
- 33, 0, 33, 33, 0, 0, 0, 0, 0, 33,
- 59, 35, 0, 33, 0, 33, 0, 0, 33, 33,
- 33, 33, 0, 33, 0, 33, 0, 33, 0, 33,
- 33, 33, 33, 0, 0, 0, 33, 0, 0, 0,
- 0, 33, 0, 33, 33, 33, 0, 0, 33, 0,
- 33, 0, 33, 0, 0, 33, 0, 33, 33, 33,
- 33, 0, 0, 0, 33, 33, 33, 0, 33, 33,
- 33, 0, 0, 0, 0, 0, 0, 33, 33, 0,
- 0, 33, 0, 33, 33, 0, 0, 33, 0, 0,
- 33, 60, 0, 0, 33, 0, 33, 0, 0, 33,
- 33, 33, 33, 0, 33, 0, 33, 0, 33, 0,
- 33, 33, 33, 33, 0, 0, 0, 33, 0, 0,
- 0, 0, 33, 0, 33, 33, 33, 0, 0, 33,
- 0, 33, 0, 33, 0, 0, 33, 0, 33, 33,
- 33, 33, 0, 0, 0, 33, 33, 33, 0, 33,
- 33, 33, 0, 0, 0, 0, 0, 0, 33, 33,
- 0, 0, 33, 0, 33, 33, 0, 0, 33, 33,
- 0, 0, 81, 33, 0, 33, 0, 0, 33, 0,
- 33, 33, 0, 33, 0, 33, 0, 33, 0, 33,
- 33, 33, 33, 0, 0, 0, 33, 0, 0, 0,
- 0, 33, 0, 33, 33, 33, 0, 0, 33, 0,
- 33, 0, 33, 0, 0, 33, 0, 33, 33, 33,
- 33, 0, 0, 0, 33, 33, 33, 0, 33, 33,
- 33, 0, 0, 0, 0, 0, 0, 33, 33, 0,
- 0, 33, 0, 33, 33, 0, 0, 0, 0, 33,
- 303, 82, 303, 303, 0, 303, 0, 0, 303, 303,
- 0, 0, 0, 303, 0, 0, 0, 303, 0, 0,
- 0, 0, 0, 303, 0, 0, 303, 0, 0, 0,
- 0, 0, 0, 303, 0, 0, 303, 0, 303, 0,
- 303, 303, 303, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 303, 0, 303, 303, 0, 303,
- 0, 0, 303, 0, 303, 0, 303, 303, 303, 303,
- 446, 303, 446, 0, 446, 0, 0, 0, 33, 331,
- 303, 303, 0, 303, 303, 303, 303, 303, 303, 303,
- 303, 303, 303, 303, 303, 303, 303, 303, 303, 303,
- 303, 303, 303, 303, 303, 0, 303, 0, 303, 331,
- 303, 331, 303, 331, 303, 331, 303, 331, 303, 331,
- 303, 331, 303, 331, 303, 331, 303, 331, 303, 0,
- 303, 0, 303, 0, 303, 0, 303, 0, 303, 0,
- 303, 0, 303, 0, 0, 0, 303, 0, 303, 0,
- 303, 0, 303, 0, 303, 0, 303, 304, 303, 304,
- 304, 0, 304, 0, 0, 304, 304, 0, 0, 0,
- 304, 0, 0, 0, 304, 0, 0, 0, 0, 0,
- 304, 0, 0, 304, 0, 0, 0, 0, 0, 0,
- 304, 0, 0, 304, 0, 304, 0, 304, 304, 304,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 304, 0, 304, 304, 0, 304, 0, 0, 304,
- 0, 304, 0, 304, 304, 304, 304, 0, 304, 0,
- 0, 0, 0, 0, 0, 0, 0, 304, 304, 0,
- 304, 304, 304, 304, 304, 304, 304, 304, 304, 304,
- 304, 304, 304, 304, 304, 304, 304, 304, 304, 304,
- 304, 304, 0, 304, 0, 304, 0, 304, 0, 304,
- 0, 304, 0, 304, 0, 304, 0, 304, 0, 304,
- 0, 304, 0, 304, 0, 304, 0, 304, 0, 304,
- 0, 304, 0, 304, 0, 304, 0, 304, 0, 304,
- 0, 0, 0, 304, 0, 304, 0, 304, 0, 304,
- 0, 304, 0, 304, 312, 304, 312, 312, 0, 312,
- 0, 0, 312, 312, 0, 0, 0, 312, 0, 0,
- 0, 312, 0, 0, 0, 0, 0, 312, 0, 0,
- 312, 0, 0, 0, 0, 0, 0, 312, 0, 0,
- 312, 0, 312, 0, 312, 312, 312, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 312, 0,
- 312, 312, 0, 312, 0, 0, 312, 0, 312, 0,
- 312, 312, 312, 312, 0, 312, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 312, 312, 312, 312, 312,
- 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
- 312, 312, 312, 312, 312, 312, 312, 312, 312, 0,
- 312, 0, 312, 0, 312, 0, 312, 0, 312, 0,
- 312, 0, 312, 0, 312, 0, 312, 0, 312, 0,
- 312, 0, 312, 0, 312, 0, 312, 0, 312, 0,
- 312, 0, 312, 0, 312, 0, 312, 0, 0, 0,
- 312, 0, 312, 0, 312, 0, 312, 0, 312, 0,
- 312, 252, 312, 252, 252, 0, 252, 0, 0, 252,
- 252, 0, 0, 0, 252, 0, 0, 0, 252, 0,
- 0, 0, 0, 0, 252, 0, 0, 252, 0, 0,
- 0, 0, 0, 0, 252, 0, 0, 252, 0, 252,
- 0, 252, 252, 252, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 252, 0, 252, 252, 0,
- 252, 0, 0, 252, 0, 252, 0, 252, 252, 252,
- 252, 0, 252, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 252, 252, 252, 252, 252, 0, 252, 252,
- 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
- 252, 252, 252, 252, 252, 252, 0, 252, 0, 252,
- 0, 252, 0, 252, 0, 252, 0, 252, 0, 252,
- 0, 252, 0, 252, 0, 252, 0, 252, 0, 252,
- 0, 252, 0, 252, 0, 252, 0, 252, 0, 252,
- 0, 252, 0, 252, 0, 0, 0, 252, 0, 252,
- 0, 252, 0, 252, 0, 252, 0, 252, 323, 252,
- 323, 323, 0, 323, 0, 0, 323, 323, 0, 0,
- 0, 323, 0, 0, 0, 323, 0, 0, 0, 0,
- 0, 323, 0, 0, 323, 0, 0, 0, 0, 0,
- 0, 323, 0, 0, 323, 0, 323, 0, 323, 323,
- 323, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 323, 0, 323, 323, 0, 323, 0, 0,
- 323, 0, 323, 0, 323, 323, 323, 323, 0, 323,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 323,
- 0, 323, 0, 323, 0, 323, 323, 323, 323, 323,
- 323, 323, 323, 323, 323, 323, 323, 323, 323, 323,
- 323, 323, 0, 0, 0, 0, 323, 0, 323, 0,
- 323, 0, 323, 0, 323, 0, 323, 0, 323, 0,
- 323, 0, 323, 0, 323, 0, 323, 0, 323, 0,
- 323, 0, 323, 0, 323, 0, 323, 0, 323, 0,
- 323, 0, 0, 0, 323, 0, 323, 0, 323, 0,
- 323, 0, 323, 0, 323, 337, 323, 337, 337, 0,
- 337, 0, 0, 337, 337, 0, 0, 0, 337, 0,
- 0, 0, 337, 0, 0, 0, 0, 0, 337, 0,
- 0, 337, 0, 0, 0, 0, 0, 0, 337, 0,
- 0, 337, 0, 337, 0, 337, 337, 337, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 337,
- 0, 337, 337, 0, 337, 0, 0, 337, 0, 337,
- 0, 337, 337, 337, 337, 0, 337, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 337, 0, 337, 337,
- 337, 0, 337, 337, 337, 337, 337, 337, 337, 0,
- 337, 337, 337, 337, 337, 337, 337, 337, 337, 337,
- 0, 337, 0, 337, 0, 337, 0, 337, 0, 337,
- 0, 337, 0, 337, 0, 337, 0, 337, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 227,
- 0, 227, 227, 0, 227, 0, 0, 227, 227, 0,
- 0, 337, 227, 337, 0, 337, 227, 337, 0, 337,
- 0, 337, 227, 337, 0, 227, 0, 0, 0, 0,
- 0, 0, 227, 0, 0, 227, 0, 227, 0, 227,
- 227, 227, 227, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 227, 0, 227, 227, 0, 227, 0,
- 0, 227, 0, 227, 0, 227, 227, 227, 227, 0,
- 227, 0, 0, 0, 0, 0, 0, 0, 0, 227,
- 227, 227, 227, 227, 227, 0, 227, 227, 227, 227,
- 227, 227, 227, 0, 227, 227, 227, 227, 227, 0,
- 0, 227, 227, 227, 0, 227, 0, 0, 0, 0,
- 0, 227, 0, 227, 0, 227, 0, 227, 0, 227,
- 0, 227, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 250, 0, 250, 250, 0, 250, 0,
- 0, 250, 250, 0, 0, 227, 250, 227, 0, 227,
- 250, 227, 0, 227, 0, 227, 250, 227, 0, 250,
- 0, 0, 0, 0, 0, 0, 250, 0, 0, 250,
- 0, 250, 0, 250, 250, 250, 250, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 250, 0, 250,
- 250, 0, 250, 0, 0, 250, 0, 250, 0, 250,
- 250, 250, 250, 0, 250, 0, 0, 0, 0, 0,
- 0, 0, 0, 250, 250, 0, 250, 250, 250, 0,
- 250, 250, 250, 250, 250, 250, 250, 0, 250, 250,
- 250, 250, 250, 0, 0, 250, 250, 250, 0, 250,
- 0, 0, 0, 0, 0, 250, 0, 250, 0, 250,
- 0, 250, 0, 250, 0, 250, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 341, 0, 341,
- 341, 0, 341, 0, 0, 341, 341, 0, 0, 250,
- 341, 250, 0, 250, 341, 250, 0, 250, 0, 250,
- 341, 250, 0, 341, 0, 0, 0, 0, 0, 0,
- 341, 0, 0, 341, 0, 341, 0, 341, 341, 341,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 341, 0, 341, 341, 0, 341, 0, 0, 341,
- 0, 341, 0, 341, 341, 341, 341, 0, 341, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 341, 0,
- 341, 341, 341, 0, 341, 341, 341, 341, 341, 341,
- 341, 0, 341, 341, 341, 341, 0, 0, 0, 341,
- 341, 341, 0, 341, 0, 341, 0, 341, 0, 341,
- 0, 341, 0, 341, 0, 341, 0, 341, 0, 341,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 342, 0, 342, 342, 0, 342, 0, 0, 342,
- 342, 0, 0, 341, 342, 341, 0, 341, 342, 341,
- 0, 341, 0, 341, 342, 341, 0, 342, 0, 0,
- 0, 0, 0, 0, 342, 0, 0, 342, 0, 342,
- 0, 342, 342, 342, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 342, 0, 342, 342, 0,
- 342, 0, 0, 342, 0, 342, 0, 342, 342, 342,
- 342, 0, 342, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 342, 0, 342, 342, 342, 0, 342, 342,
- 342, 342, 342, 342, 342, 0, 342, 342, 342, 342,
- 0, 0, 0, 342, 342, 342, 0, 342, 0, 342,
- 0, 342, 0, 342, 0, 342, 0, 342, 0, 342,
- 0, 342, 0, 342, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 343, 0, 343, 343, 0,
- 343, 0, 0, 343, 343, 0, 0, 342, 343, 342,
- 0, 342, 343, 342, 0, 342, 0, 342, 343, 342,
- 0, 343, 0, 0, 0, 0, 0, 0, 343, 0,
- 0, 343, 0, 343, 0, 343, 343, 343, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 343,
- 0, 343, 343, 0, 343, 0, 0, 343, 0, 343,
- 0, 343, 343, 343, 343, 0, 343, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 343, 0, 343, 343,
- 343, 0, 343, 343, 343, 343, 343, 343, 343, 0,
- 343, 343, 343, 343, 0, 0, 0, 343, 343, 343,
- 0, 343, 0, 343, 0, 343, 0, 343, 0, 343,
- 0, 343, 0, 343, 0, 343, 0, 343, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 344,
- 0, 344, 344, 0, 344, 0, 0, 344, 344, 0,
- 0, 343, 344, 343, 0, 343, 344, 343, 0, 343,
- 0, 343, 344, 343, 0, 344, 0, 0, 0, 0,
- 0, 0, 344, 0, 0, 344, 0, 344, 0, 344,
- 344, 344, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 344, 0, 344, 344, 0, 344, 0,
- 0, 344, 0, 344, 0, 344, 344, 344, 344, 0,
- 344, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 344, 0, 344, 344, 344, 0, 344, 344, 344, 344,
- 0, 0, 344, 0, 344, 344, 344, 344, 344, 0,
- 0, 344, 344, 344, 0, 344, 0, 344, 0, 344,
- 0, 344, 0, 344, 0, 344, 0, 344, 0, 344,
- 0, 344, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 347, 0, 347, 347, 0, 347, 0,
- 0, 347, 347, 0, 0, 344, 347, 344, 0, 344,
- 347, 344, 0, 344, 0, 344, 347, 344, 0, 347,
- 0, 0, 0, 0, 0, 0, 347, 0, 0, 347,
- 0, 347, 0, 347, 347, 347, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 347, 0, 347,
- 347, 0, 347, 0, 0, 347, 0, 347, 0, 347,
- 347, 347, 347, 0, 347, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 347, 0, 347, 347, 347, 0,
- 347, 347, 347, 347, 347, 347, 347, 0, 347, 347,
- 347, 347, 347, 0, 0, 347, 347, 347, 0, 347,
- 0, 0, 0, 0, 0, 347, 0, 347, 0, 347,
- 0, 347, 0, 347, 0, 347, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 345, 0, 345,
- 345, 0, 345, 0, 0, 345, 345, 0, 0, 347,
- 345, 347, 0, 347, 345, 347, 0, 347, 0, 347,
- 345, 347, 0, 345, 0, 0, 0, 0, 0, 0,
- 345, 0, 0, 345, 0, 345, 0, 345, 345, 345,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 345, 0, 345, 345, 0, 345, 0, 0, 345,
- 0, 345, 0, 345, 345, 345, 345, 0, 345, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 345, 0,
- 345, 345, 345, 0, 345, 345, 345, 345, 0, 0,
- 345, 0, 345, 345, 345, 345, 345, 0, 0, 345,
- 345, 345, 0, 345, 0, 345, 0, 345, 0, 345,
- 0, 345, 0, 345, 0, 345, 0, 345, 0, 345,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 346, 0, 346, 346, 0, 346, 0, 0, 346,
- 346, 0, 0, 345, 346, 345, 0, 345, 346, 345,
- 0, 345, 0, 345, 346, 345, 0, 346, 0, 0,
- 0, 0, 0, 0, 346, 0, 0, 346, 0, 346,
- 0, 346, 346, 346, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 346, 0, 346, 346, 0,
- 346, 0, 0, 346, 0, 346, 0, 346, 346, 346,
- 346, 0, 346, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 346, 0, 346, 346, 346, 0, 346, 346,
- 346, 346, 0, 0, 346, 0, 346, 346, 346, 346,
- 346, 0, 0, 346, 346, 346, 0, 346, 0, 346,
- 0, 346, 0, 346, 0, 346, 0, 346, 0, 346,
- 0, 346, 0, 346, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 353, 0, 353, 353, 0,
- 353, 0, 0, 353, 353, 0, 0, 346, 353, 346,
- 0, 346, 353, 346, 0, 346, 0, 346, 353, 346,
- 0, 353, 0, 0, 0, 0, 0, 0, 353, 0,
- 0, 353, 0, 353, 0, 353, 353, 353, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 353,
- 0, 353, 353, 0, 353, 0, 0, 353, 0, 353,
- 0, 353, 353, 353, 353, 0, 353, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 353, 0, 353, 353,
- 353, 0, 353, 353, 353, 353, 353, 353, 353, 0,
- 353, 353, 353, 353, 353, 0, 0, 353, 353, 353,
- 0, 353, 0, 0, 0, 0, 0, 353, 0, 353,
- 0, 353, 0, 353, 0, 353, 0, 353, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 352,
- 0, 352, 352, 0, 352, 0, 0, 352, 352, 0,
- 0, 353, 352, 353, 0, 353, 352, 353, 0, 353,
- 0, 353, 352, 353, 0, 352, 0, 0, 0, 0,
- 0, 0, 352, 0, 0, 352, 0, 352, 0, 352,
- 352, 352, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 352, 0, 352, 352, 0, 352, 0,
- 0, 352, 0, 352, 0, 352, 352, 352, 352, 0,
- 352, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 352, 0, 352, 352, 352, 0, 352, 352, 352, 352,
- 352, 352, 352, 0, 352, 352, 352, 352, 352, 0,
- 0, 352, 352, 352, 0, 352, 0, 0, 0, 0,
- 0, 352, 0, 352, 0, 352, 0, 352, 0, 352,
- 0, 352, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 348, 0, 348, 348, 0, 348, 0,
- 0, 348, 348, 0, 0, 352, 348, 352, 0, 352,
- 348, 352, 0, 352, 0, 352, 348, 352, 0, 348,
- 0, 0, 0, 0, 0, 0, 348, 0, 0, 348,
- 0, 348, 0, 348, 348, 348, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 348, 0, 348,
- 348, 0, 348, 0, 0, 348, 0, 348, 0, 348,
- 348, 348, 348, 0, 348, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 348, 0, 348, 348, 348, 0,
- 348, 348, 348, 348, 348, 348, 348, 0, 348, 348,
- 348, 348, 348, 0, 0, 348, 348, 348, 0, 348,
- 0, 0, 0, 0, 0, 348, 0, 348, 0, 348,
- 0, 348, 0, 348, 0, 348, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 349, 0, 349,
- 349, 0, 349, 0, 0, 349, 349, 0, 0, 348,
- 349, 348, 0, 348, 349, 348, 0, 348, 0, 348,
- 349, 348, 0, 349, 0, 0, 0, 0, 0, 0,
- 349, 0, 0, 349, 0, 349, 0, 349, 349, 349,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 349, 0, 349, 349, 0, 349, 0, 0, 349,
- 0, 349, 0, 349, 349, 349, 349, 0, 349, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 349, 0,
- 349, 349, 349, 0, 349, 349, 349, 349, 349, 349,
- 349, 0, 349, 349, 349, 349, 349, 0, 0, 349,
- 349, 349, 0, 349, 0, 0, 0, 0, 0, 349,
- 0, 349, 0, 349, 0, 349, 0, 349, 0, 349,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 350, 0, 350, 350, 0, 350, 0, 0, 350,
- 350, 0, 0, 349, 350, 349, 0, 349, 350, 349,
- 0, 349, 0, 349, 350, 349, 0, 350, 0, 0,
- 0, 0, 0, 0, 350, 0, 0, 350, 0, 350,
- 0, 350, 350, 350, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 350, 0, 350, 350, 0,
- 350, 0, 0, 350, 0, 350, 0, 350, 350, 350,
- 350, 0, 350, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 350, 0, 350, 350, 350, 0, 350, 350,
- 350, 350, 350, 350, 350, 0, 350, 350, 350, 350,
- 350, 0, 0, 350, 350, 350, 0, 350, 0, 0,
- 0, 0, 0, 350, 0, 350, 0, 350, 0, 350,
- 0, 350, 0, 350, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 351, 0, 351, 351, 0,
- 351, 0, 0, 351, 351, 0, 0, 350, 351, 350,
- 0, 350, 351, 350, 0, 350, 0, 350, 351, 350,
- 0, 351, 0, 0, 0, 0, 0, 0, 351, 0,
- 0, 351, 0, 351, 0, 351, 351, 351, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 351,
- 0, 351, 351, 0, 351, 0, 0, 351, 0, 351,
- 0, 351, 351, 351, 351, 0, 351, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 351, 0, 351, 351,
- 351, 0, 351, 351, 351, 351, 351, 351, 351, 0,
- 351, 351, 351, 351, 351, 0, 0, 351, 351, 351,
- 0, 351, 0, 0, 0, 0, 0, 351, 0, 351,
- 0, 351, 0, 351, 0, 351, 0, 351, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 351, 0, 351, 0, 351, 0, 351, 0, 351,
- 0, 351, 0, 351, 502, 502, 502, 502, 502, 0,
- 502, 502, 0, 502, 502, 502, 502, 0, 502, 502,
- 502, 0, 0, 0, 0, 502, 502, 0, 502, 502,
- 502, 502, 502, 0, 0, 502, 0, 0, 0, 502,
- 502, 0, 502, 502, 502, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 502, 0, 502, 0, 502, 502,
- 0, 502, 0, 502, 502, 502, 502, 502, 502, 502,
- 502, 502, 0, 502, 502, 52, 502, 502, 0, 0,
- 0, 0, 502, 502, 0, 0, 502, 0, 0, 0,
- 0, 502, 502, 502, 502, 502, 0, 0, 53, 502,
- 0, 502, 0, 0, 0, 0, 502, 0, 502, 0,
- 0, 54, 0, 0, 0, 0, 55, 0, 0, 0,
- 0, 56, 0, 57, 58, 59, 60, 0, 0, 0,
- 0, 61, 0, 0, 62, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 502, 63,
- 502, 0, 502, 0, 502, 0, 502, 0, 502, 0,
- 502, 497, 497, 497, 497, 497, 419, 497, 497, 0,
- 497, 497, 497, 497, 0, 497, 497, 497, 0, 0,
- 0, 0, 497, 0, 0, 497, 497, 497, 497, 497,
- 0, 0, 497, 0, 0, 0, 497, 497, 0, 497,
- 497, 497, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 497, 0, 497, 0, 497, 497, 0, 497, 0,
- 497, 497, 497, 497, 497, 497, 497, 497, 497, 0,
- 497, 497, 52, 497, 497, 0, 0, 0, 0, 497,
- 497, 0, 0, 497, 0, 0, 0, 0, 497, 497,
- 497, 497, 497, 0, 0, 53, 497, 0, 497, 0,
- 0, 0, 0, 497, 0, 497, 0, 0, 54, 0,
- 0, 0, 0, 55, 0, 0, 0, 0, 56, 0,
- 57, 58, 59, 60, 0, 0, 0, 0, 61, 0,
- 0, 62, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 497, 63, 497, 0, 497,
- 0, 497, 0, 497, 0, 497, 0, 497, 450, 450,
- 450, 450, 450, 0, 450, 450, 0, 450, 450, 450,
- 450, 0, 450, 450, 0, 0, 0, 0, 0, 450,
- 0, 0, 450, 450, 450, 450, 450, 0, 0, 450,
- 0, 0, 0, 450, 450, 0, 450, 450, 450, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 450, 0,
- 450, 0, 450, 450, 0, 450, 0, 450, 450, 450,
- 450, 450, 450, 450, 450, 450, 0, 450, 450, 0,
- 450, 450, 0, 0, 0, 0, 450, 450, 0, 0,
- 450, 0, 0, 0, 0, 450, 450, 450, 450, 450,
- 0, 0, 0, 450, 0, 450, 0, 0, 0, 0,
- 450, 0, 450, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 450, 0, 450, 0, 450, 0, 450, 0,
- 450, 0, 450, 0, 450, 70, 71, 487, 72, 0,
- 0, 73, 488, 0, 489, 490, 75, 0, 0, 491,
- 76, 0, 0, 0, 0, 0, 77, 0, 0, 78,
- 492, 493, 494, 495, 0, 0, 79, 0, 0, 0,
- 496, 80, 0, 81, 82, 83, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 497, 0, 84, 0, 85,
- 86, 0, 87, 0, 498, 88, 499, 89, 500, 90,
- 91, 92, 501, 0, 94, 502, 0, 503, 504, 0,
- 0, 0, 0, 423, 0, 0, 0, 95, 0, 0,
- 0, 0, 505, 96, 97, 98, 99, 0, 0, 0,
- 100, 0, 101, 0, 0, 0, 0, 102, 0, 103,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 104,
- 0, 105, 0, 106, 0, 107, 0, 108, 0, 109,
- 0, 506, 458, 458, 458, 458, 0, 0, 458, 458,
- 0, 458, 458, 458, 0, 0, 458, 458, 0, 0,
- 0, 0, 0, 458, 0, 0, 458, 458, 458, 458,
- 458, 0, 0, 458, 0, 0, 0, 458, 458, 0,
- 458, 458, 458, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 458, 0, 458, 0, 458, 458, 0, 458,
- 0, 458, 458, 458, 458, 458, 458, 458, 458, 458,
- 0, 458, 458, 0, 458, 458, 0, 0, 0, 0,
- 458, 0, 0, 0, 458, 0, 0, 0, 0, 458,
- 458, 458, 458, 458, 0, 0, 0, 458, 0, 458,
- 0, 0, 0, 0, 458, 0, 458, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 458, 0, 458, 0,
- 458, 0, 458, 0, 458, 0, 458, 0, 458, 70,
- 71, 487, 72, 0, 0, 73, 488, 0, 0, 490,
- 75, 0, 0, 491, 76, 0, 0, 0, 0, 0,
- 77, 0, 0, 78, 492, 493, 494, 495, 0, 0,
- 79, 0, 0, 0, 496, 80, 0, 81, 82, 83,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 497,
- 0, 84, 0, 85, 86, 0, 87, 0, 498, 88,
- 499, 89, 500, 90, 91, 92, 501, 0, 94, 502,
- 0, 0, 504, 0, 0, 0, 0, 423, 0, 0,
- 0, 95, 0, 0, 0, 0, 505, 96, 97, 98,
- 99, 0, 0, 0, 100, 0, 101, 0, 0, 0,
- 0, 102, 0, 103, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 354, 354, 0, 354, 0, 0, 354,
- 354, 0, 0, 104, 354, 105, 0, 106, 354, 107,
- 0, 108, 0, 109, 354, 40, 0, 354, 0, 0,
- 0, 0, 0, 0, 354, 0, 0, 0, 0, 354,
- 0, 354, 354, 354, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 354, 0, 354, 354, 0,
- 354, 0, 0, 354, 0, 354, 0, 354, 354, 354,
- 354, 0, 354, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 354, 0, 354, 354, 354, 0, 354, 354,
- 354, 354, 354, 354, 354, 0, 0, 0, 354, 354,
- 354, 0, 0, 354, 354, 354, 0, 354, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 354, 0, 354,
- 0, 354, 0, 354, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 355, 355, 0,
- 355, 0, 0, 355, 355, 0, 0, 354, 355, 354,
- 0, 354, 355, 354, 0, 354, 0, 354, 355, 354,
- 0, 355, 0, 0, 0, 0, 0, 0, 355, 0,
- 0, 0, 0, 355, 0, 355, 355, 355, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 355,
- 0, 355, 355, 0, 355, 0, 0, 355, 0, 355,
- 0, 355, 355, 355, 355, 0, 355, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 355, 0, 355, 355,
- 355, 0, 355, 355, 355, 355, 355, 355, 355, 0,
- 0, 0, 355, 355, 355, 0, 0, 355, 355, 355,
- 0, 355, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 355, 0, 355, 0, 355, 0, 355, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 356, 356, 0, 356, 0, 0, 356, 356, 0,
- 0, 355, 356, 355, 0, 355, 356, 355, 0, 355,
- 0, 355, 356, 355, 0, 356, 0, 0, 0, 0,
- 0, 0, 356, 0, 0, 0, 0, 356, 0, 356,
- 356, 356, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 356, 0, 356, 356, 0, 356, 0,
- 0, 356, 0, 356, 0, 356, 356, 356, 356, 0,
- 356, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 356, 0, 356, 356, 356, 0, 356, 356, 356, 356,
- 356, 356, 356, 0, 0, 0, 356, 356, 356, 0,
- 0, 356, 356, 356, 0, 356, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 356, 0, 356, 0, 356,
- 0, 356, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 357, 357, 0, 357, 0,
- 0, 357, 357, 0, 0, 356, 357, 356, 0, 356,
- 357, 356, 0, 356, 0, 356, 357, 356, 0, 357,
- 0, 0, 0, 0, 0, 0, 357, 0, 0, 0,
- 0, 357, 0, 357, 357, 357, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 357, 0, 357,
- 357, 0, 357, 0, 0, 357, 0, 357, 0, 357,
- 357, 357, 357, 0, 357, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 357, 0, 357, 357, 357, 0,
- 357, 357, 357, 357, 357, 357, 357, 0, 0, 0,
- 357, 357, 357, 0, 0, 357, 357, 357, 0, 357,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 357, 0, 357, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 358,
- 358, 0, 358, 0, 0, 358, 358, 0, 0, 357,
- 358, 357, 0, 357, 358, 357, 0, 357, 0, 357,
- 358, 357, 0, 358, 0, 0, 0, 0, 0, 0,
- 358, 0, 0, 0, 0, 358, 0, 358, 358, 358,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 358, 0, 358, 358, 0, 358, 0, 0, 358,
- 0, 358, 0, 358, 358, 358, 358, 0, 358, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 358, 0,
- 358, 358, 358, 0, 358, 358, 358, 358, 358, 358,
- 358, 0, 0, 0, 358, 358, 358, 0, 0, 358,
- 358, 358, 0, 358, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 358, 0, 358,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 359, 359, 0, 359, 0, 0, 359,
- 359, 0, 0, 358, 359, 358, 0, 358, 359, 358,
- 0, 358, 0, 358, 359, 358, 0, 359, 0, 0,
- 0, 0, 0, 0, 359, 0, 0, 0, 0, 359,
- 0, 359, 359, 359, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 359, 0, 359, 359, 0,
- 359, 0, 0, 359, 0, 359, 0, 359, 359, 359,
- 359, 0, 359, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 359, 0, 359, 359, 359, 0, 359, 359,
- 359, 359, 359, 359, 359, 0, 0, 0, 0, 359,
- 359, 0, 0, 359, 359, 359, 0, 359, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 359, 0, 359, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 361, 361, 0,
- 361, 0, 0, 361, 361, 0, 0, 359, 361, 359,
- 0, 359, 361, 359, 0, 359, 0, 359, 361, 359,
- 0, 361, 0, 0, 0, 0, 0, 0, 361, 0,
- 0, 0, 0, 361, 0, 361, 361, 361, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 361,
- 0, 361, 361, 0, 361, 0, 0, 361, 0, 361,
- 0, 361, 361, 361, 361, 0, 361, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 361, 0, 361, 361,
- 361, 0, 361, 361, 361, 361, 361, 361, 361, 0,
- 0, 0, 361, 361, 361, 0, 0, 0, 361, 361,
- 0, 361, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 361, 0, 361, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 360, 360, 0, 360, 0, 0, 360, 360, 0,
- 0, 361, 360, 361, 0, 361, 360, 361, 0, 361,
- 0, 361, 360, 361, 0, 360, 0, 0, 0, 0,
- 0, 0, 360, 0, 0, 0, 0, 360, 0, 360,
- 360, 360, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 360, 0, 360, 360, 0, 360, 0,
- 0, 360, 0, 360, 0, 360, 360, 360, 360, 0,
- 360, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 360, 0, 360, 360, 360, 0, 360, 360, 360, 360,
- 360, 360, 360, 0, 0, 0, 0, 360, 360, 0,
- 0, 360, 360, 360, 0, 360, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 360,
- 0, 360, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 362, 362, 0, 362, 0,
- 0, 362, 362, 0, 0, 360, 362, 360, 0, 360,
- 362, 360, 0, 360, 0, 360, 362, 360, 0, 362,
- 0, 0, 0, 0, 0, 0, 362, 0, 0, 0,
- 0, 362, 0, 362, 362, 362, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 362, 0, 362,
- 362, 0, 362, 0, 0, 362, 0, 362, 0, 362,
- 362, 362, 362, 0, 362, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 362, 0, 362, 362, 362, 0,
- 362, 362, 362, 362, 362, 362, 362, 0, 0, 0,
- 362, 362, 362, 0, 0, 0, 362, 362, 0, 362,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 362, 0, 362, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 363,
- 363, 0, 363, 0, 0, 363, 363, 0, 0, 362,
- 363, 362, 0, 362, 363, 362, 0, 362, 0, 362,
- 363, 362, 0, 363, 0, 0, 0, 0, 0, 0,
- 363, 0, 0, 0, 0, 363, 0, 363, 363, 363,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 363, 0, 363, 363, 0, 363, 0, 0, 363,
- 0, 363, 0, 363, 363, 363, 363, 0, 363, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 363, 0,
- 363, 363, 363, 0, 363, 363, 363, 363, 363, 363,
- 363, 0, 0, 0, 363, 0, 363, 0, 0, 0,
- 363, 363, 0, 363, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 363, 0, 363,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 364, 364, 0, 364, 0, 0, 364,
- 364, 0, 0, 363, 364, 363, 0, 363, 364, 363,
- 0, 363, 0, 363, 364, 363, 0, 364, 0, 0,
- 0, 0, 0, 0, 364, 0, 0, 0, 0, 364,
- 0, 364, 364, 364, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 364, 0, 364, 364, 0,
- 364, 0, 0, 364, 0, 364, 0, 364, 364, 364,
- 364, 0, 364, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 364, 0, 364, 364, 364, 0, 364, 364,
- 364, 364, 364, 364, 364, 0, 0, 0, 364, 0,
- 364, 0, 0, 0, 364, 364, 0, 364, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 364, 0, 364, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 365, 365, 0,
- 365, 0, 0, 365, 365, 0, 0, 364, 365, 364,
- 0, 364, 365, 364, 0, 364, 0, 364, 365, 364,
- 0, 365, 0, 0, 0, 0, 0, 0, 365, 0,
- 0, 0, 0, 365, 0, 365, 365, 365, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 365,
- 0, 365, 365, 0, 365, 0, 0, 365, 0, 365,
- 0, 365, 365, 365, 365, 0, 365, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 365, 0, 365, 365,
- 365, 0, 365, 365, 365, 365, 365, 365, 365, 0,
- 0, 0, 365, 0, 365, 0, 0, 0, 365, 365,
- 0, 365, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 365, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 366, 366, 0, 366, 0, 0, 366, 366, 0,
- 0, 365, 366, 365, 0, 365, 366, 365, 0, 365,
- 0, 365, 366, 365, 0, 366, 0, 0, 0, 0,
- 0, 0, 366, 0, 0, 0, 0, 366, 0, 366,
- 366, 366, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 366, 0, 366, 366, 0, 366, 0,
- 0, 366, 0, 366, 0, 366, 366, 366, 366, 0,
- 366, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 366, 0, 366, 366, 366, 0, 366, 366, 366, 366,
- 366, 366, 366, 0, 0, 0, 366, 0, 366, 0,
- 0, 0, 366, 366, 0, 366, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 366, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 367, 367, 0, 367, 0,
- 0, 367, 367, 0, 0, 366, 367, 366, 0, 366,
- 367, 366, 0, 366, 0, 366, 367, 366, 0, 367,
- 0, 0, 0, 0, 0, 0, 367, 0, 0, 0,
- 0, 367, 0, 367, 367, 367, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 367, 0, 367,
- 367, 0, 367, 0, 0, 367, 0, 367, 0, 367,
- 367, 367, 367, 0, 367, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 367, 0, 367, 367, 367, 0,
- 367, 367, 367, 367, 367, 367, 367, 0, 0, 0,
- 367, 0, 367, 0, 0, 0, 0, 367, 0, 367,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 70,
- 71, 0, 72, 0, 0, 73, 74, 0, 0, 367,
- 75, 367, 0, 367, 76, 367, 0, 367, 0, 367,
- 77, 367, 0, 78, 0, 0, 0, 0, 0, 0,
- 79, 0, 0, 0, 0, 80, 0, 81, 82, 83,
- 0, 246, 0, 0, 0, 0, 0, 0, 247, 0,
- 0, 84, 0, 85, 86, 0, 87, 0, 0, 88,
- 0, 89, 0, 90, 91, 92, 93, 0, 94, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 95, 0, 0, 0, 0, 0, 96, 97, 98,
- 99, 0, 0, 0, 100, 0, 101, 0, 0, 0,
- 0, 102, 0, 103, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 70, 71, 0, 72, 0, 0, 73,
- 74, 0, 0, 104, 75, 105, 0, 106, 76, 107,
- 0, 108, 0, 109, 77, 40, 0, 78, 0, 0,
- 0, 0, 0, 0, 79, 0, 0, 0, 0, 80,
- 0, 81, 82, 83, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 84, 0, 85, 86, 0,
- 87, 0, 0, 88, 0, 89, 0, 90, 91, 92,
- 93, 0, 94, 0, 0, 0, 0, 0, 0, 0,
- 0, 416, 442, 0, 0, 95, 0, 0, 0, 0,
- 0, 96, 97, 98, 99, 0, 0, 0, 100, 0,
- 101, 0, 0, 0, 0, 102, 0, 103, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 70, 71, 0,
- 72, 0, 0, 73, 74, 0, 0, 104, 75, 105,
- 0, 106, 76, 107, 0, 108, 0, 109, 77, 40,
- 0, 78, 0, 0, 0, 0, 0, 0, 79, 0,
- 0, 0, 0, 80, 0, 81, 82, 83, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 84,
- 0, 85, 86, 0, 87, 0, 0, 88, 0, 89,
- 0, 90, 91, 92, 93, 0, 94, 0, 0, 0,
- 0, 0, 0, 0, 0, 416, 554, 0, 0, 95,
- 0, 0, 0, 0, 0, 96, 97, 98, 99, 0,
- 0, 0, 100, 0, 101, 0, 0, 0, 0, 102,
- 0, 103, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 102, 102, 0, 102, 0, 0, 102, 102, 0,
- 0, 104, 102, 105, 0, 106, 102, 107, 0, 108,
- 0, 109, 102, 40, 0, 102, 0, 0, 0, 0,
- 0, 0, 102, 0, 0, 0, 0, 102, 0, 102,
- 102, 102, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 102, 0, 102, 102, 0, 102, 0,
- 0, 102, 0, 102, 0, 102, 102, 102, 102, 0,
- 102, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 102, 0, 0, 102, 0, 102, 102,
- 102, 102, 102, 0, 0, 0, 102, 0, 102, 0,
- 0, 0, 0, 102, 0, 102, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 70, 71, 0, 72, 0,
- 0, 73, 74, 0, 0, 102, 75, 102, 0, 102,
- 76, 102, 0, 102, 0, 102, 77, 102, 0, 78,
- 0, 0, 0, 0, 0, 0, 79, 0, 0, 0,
- 0, 80, 0, 81, 82, 83, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 84, 0, 85,
- 86, 0, 87, 0, 0, 88, 0, 89, 0, 90,
- 91, 92, 93, 0, 94, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 95, 0, 0,
- 300, 0, 0, 96, 97, 98, 99, 0, 0, 0,
- 100, 0, 101, 0, 0, 0, 0, 102, 0, 103,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 70,
- 71, 0, 72, 0, 0, 73, 74, 0, 0, 104,
- 75, 105, 0, 106, 76, 107, 0, 108, 0, 109,
- 77, 40, 0, 78, 0, 0, 0, 0, 0, 0,
- 79, 0, 0, 0, 0, 80, 0, 81, 82, 83,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 84, 0, 85, 86, 0, 87, 0, 0, 88,
- 0, 89, 0, 90, 91, 92, 93, 0, 94, 0,
- 0, 0, 0, 0, 0, 0, 0, 416, 0, 0,
- 0, 95, 0, 0, 0, 0, 0, 96, 97, 98,
- 99, 0, 0, 0, 100, 0, 101, 0, 0, 0,
- 0, 102, 0, 103, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 70, 71, 0, 72, 0, 0, 73,
- 74, 0, 0, 104, 75, 105, 0, 106, 76, 107,
- 0, 108, 0, 109, 77, 40, 0, 78, 0, 0,
- 0, 0, 0, 0, 79, 0, 0, 0, 0, 80,
- 0, 81, 82, 83, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 84, 0, 85, 86, 0,
- 87, 0, 0, 88, 0, 89, 0, 90, 91, 92,
- 93, 0, 94, 0, 0, 503, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 95, 0, 0, 0, 0,
- 0, 96, 97, 98, 99, 0, 0, 0, 100, 0,
- 101, 0, 0, 0, 0, 102, 0, 103, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 437, 437, 0,
- 437, 0, 0, 437, 437, 0, 0, 104, 437, 105,
- 0, 106, 437, 107, 0, 108, 0, 109, 437, 40,
- 0, 437, 0, 0, 0, 0, 0, 0, 437, 0,
- 0, 0, 0, 437, 0, 437, 437, 437, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 437,
- 0, 437, 437, 0, 437, 0, 0, 437, 0, 437,
- 0, 437, 437, 437, 437, 0, 437, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 437,
- 0, 0, 0, 0, 437, 437, 437, 437, 437, 0,
- 0, 0, 437, 0, 437, 0, 0, 0, 0, 437,
- 0, 437, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 70, 71, 0, 72, 0, 0, 73, 74, 0,
- 0, 437, 75, 437, 0, 437, 76, 437, 0, 437,
- 0, 437, 77, 437, 0, 78, 0, 0, 0, 0,
- 0, 0, 79, 0, 0, 0, 0, 80, 0, 81,
- 82, 83, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 84, 0, 85, 86, 0, 87, 0,
- 0, 88, 0, 89, 0, 90, 91, 92, 93, 0,
- 94, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 95, 0, 0, 0, 0, 0, 96,
- 97, 98, 99, 0, 0, 0, 100, 0, 101, 0,
- 0, 0, 0, 102, 0, 103, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 70, 71, 0, 72, 0,
- 0, 73, 74, 0, 0, 104, 75, 105, 0, 106,
- 76, 107, 0, 108, 0, 109, 77, 40, 0, 78,
- 0, 0, 0, 0, 0, 0, 79, 0, 0, 0,
- 0, 80, 0, 81, 82, 83, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 84, 0, 85,
- 86, 0, 87, 0, 0, 88, 0, 89, 0, 90,
- 91, 92, 93, 0, 94, 0, 71, 503, 72, 0,
- 0, 73, 0, 155, 448, 0, 75, 694, 156, 0,
- 76, 0, 157, 449, 450, 0, 0, 0, 0, 78,
- 0, 0, 0, 0, 451, 0, 79, 158, 0, 0,
- 0, 80, 0, 0, 0, 83, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 84, 0, 85,
- 0, 0, 87, 159, 0, 0, 0, 0, 0, 0,
- 91, 92, 0, 0, 94, 0, 0, 452, 0, 104,
- 0, 105, 0, 106, 0, 107, 0, 108, 387, 109,
- 387, 40, 0, 387, 0, 387, 387, 0, 387, 0,
- 387, 0, 387, 0, 387, 387, 387, 0, 0, 0,
- 0, 387, 0, 0, 0, 0, 387, 0, 387, 387,
- 0, 0, 0, 387, 0, 0, 0, 387, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 387,
- 0, 387, 0, 0, 387, 387, 0, 0, 0, 0,
- 0, 0, 387, 387, 0, 386, 387, 386, 0, 387,
- 386, 453, 386, 386, 0, 386, 0, 386, 0, 386,
- 0, 386, 386, 386, 0, 0, 0, 0, 386, 0,
- 0, 0, 0, 386, 0, 386, 386, 0, 0, 0,
- 386, 0, 0, 0, 386, 0, 0, 0, 0, 33,
- 0, 33, 0, 0, 33, 0, 386, 0, 386, 33,
- 0, 386, 386, 33, 0, 0, 33, 0, 0, 386,
- 386, 0, 33, 386, 0, 0, 386, 0, 0, 33,
- 0, 0, 0, 0, 33, 0, 33, 0, 33, 0,
- 0, 0, 0, 387, 0, 0, 0, 0, 0, 0,
- 33, 33, 33, 33, 0, 33, 33, 0, 0, 0,
- 0, 33, 0, 33, 33, 33, 0, 33, 33, 0,
- 33, 0, 0, 0, 33, 0, 0, 147, 0, 0,
- 0, 33, 33, 0, 33, 0, 33, 33, 33, 0,
- 33, 0, 33, 0, 0, 0, 33, 0, 0, 0,
- 0, 0, 33, 0, 33, 33, 0, 33, 0, 0,
- 386, 0, 33, 0, 0, 33, 33, 33, 0, 33,
- 0, 33, 33, 33, 0, 33, 33, 0, 33, 148,
- 33, 33, 0, 33, 0, 33, 33, 0, 33, 0,
- 33, 0, 0, 0, 0, 0, 33, 33, 0, 33,
- 33, 0, 0, 0, 33, 0, 33, 0, 71, 0,
- 72, 33, 0, 73, 110, 33, 0, 33, 75, 33,
- 0, 0, 76, 0, 33, 463, 0, 33, 0, 33,
- 0, 78, 33, 0, 0, 0, 0, 0, 79, 0,
- 33, 33, 0, 80, 33, 0, 0, 83, 0, 0,
- 0, 0, 0, 0, 0, 231, 33, 231, 0, 84,
- 231, 85, 0, 0, 87, 231, 0, 0, 0, 231,
- 0, 0, 91, 92, 0, 0, 94, 0, 231, 464,
- 0, 0, 0, 0, 0, 231, 0, 33, 0, 0,
- 231, 232, 0, 232, 231, 0, 232, 0, 0, 0,
- 0, 232, 0, 0, 0, 232, 231, 0, 231, 0,
- 0, 231, 0, 0, 232, 0, 0, 0, 0, 231,
- 231, 232, 0, 231, 0, 0, 232, 0, 0, 0,
- 232, 33, 231, 0, 0, 0, 0, 0, 0, 0,
- 231, 0, 232, 155, 232, 155, 0, 232, 155, 0,
- 0, 0, 0, 155, 0, 232, 232, 155, 0, 232,
- 155, 252, 0, 40, 0, 118, 155, 118, 232, 0,
- 118, 0, 0, 155, 0, 118, 232, 0, 155, 118,
- 0, 0, 155, 0, 0, 0, 0, 0, 118, 0,
- 0, 0, 0, 0, 155, 118, 155, 252, 0, 155,
- 118, 0, 0, 0, 118, 0, 0, 155, 155, 0,
- 231, 155, 0, 0, 155, 0, 118, 0, 118, 0,
- 0, 118, 0, 0, 0, 0, 0, 0, 0, 118,
- 118, 0, 0, 118, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 252, 0, 252, 232, 0, 0, 0,
- 0, 0, 252, 252, 0, 252, 252, 252, 252, 252,
- 252, 252, 252, 252, 252, 252, 0, 252, 0, 252,
- 0, 252, 0, 252, 0, 252, 0, 252, 0, 252,
- 0, 252, 0, 252, 0, 252, 0, 252, 0, 252,
- 0, 252, 0, 252, 0, 252, 0, 252, 155, 252,
- 0, 252, 21, 252, 0, 21, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 21, 0, 0, 0,
- 118, 21, 0, 0, 0, 21, 0, 0, 21, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 21, 21, 0, 0, 0, 21, 21, 0, 0, 0,
- 0, 21, 0, 21, 21, 21, 21, 12, 0, 0,
- 12, 21, 0, 0, 21, 0, 21, 0, 0, 0,
- 0, 12, 0, 0, 0, 0, 12, 0, 0, 21,
- 12, 0, 0, 12, 0, 0, 0, 21, 21, 0,
- 0, 0, 0, 0, 0, 12, 12, 0, 0, 0,
- 12, 12, 0, 0, 0, 0, 12, 0, 12, 12,
- 12, 12, 20, 0, 0, 20, 12, 0, 0, 12,
- 0, 12, 0, 0, 0, 0, 20, 0, 0, 0,
- 0, 20, 0, 0, 12, 20, 0, 0, 20, 0,
- 0, 0, 12, 12, 0, 0, 0, 0, 0, 0,
- 20, 20, 0, 0, 0, 20, 20, 0, 0, 0,
- 0, 20, 0, 20, 20, 20, 20, 23, 0, 0,
- 33, 20, 0, 0, 20, 0, 20, 0, 0, 0,
- 0, 33, 0, 0, 0, 0, 33, 0, 0, 20,
- 33, 0, 20, 33, 0, 0, 0, 0, 20, 0,
- 0, 0, 0, 20, 0, 33, 33, 0, 20, 0,
- 0, 33, 20, 0, 0, 20, 33, 0, 33, 33,
- 33, 33, 0, 0, 0, 0, 33, 20, 20, 33,
- 0, 33, 20, 20, 0, 0, 0, 0, 20, 0,
- 20, 20, 20, 20, 33, 33, 0, 0, 20, 0,
- 0, 20, 23, 20, 0, 0, 33, 0, 0, 33,
- 0, 33, 33, 0, 0, 33, 20, 0, 33, 0,
- 0, 0, 0, 33, 20, 20, 0, 0, 33, 0,
- 33, 33, 33, 0, 0, 33, 33, 0, 0, 0,
- 0, 33, 0, 33, 33, 33, 33, 33, 33, 0,
- 0, 33, 33, 33, 33, 0, 33, 0, 33, 0,
- 33, 33, 33, 33, 22, 0, 0, 33, 33, 33,
- 0, 33, 0, 33, 0, 0, 0, 22, 33, 0,
- 0, 0, 0, 33, 0, 0, 33, 33, 0, 0,
- 33, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 33, 33, 0, 0, 0, 255, 33, 255,
- 440, 255, 440, 33, 440, 33, 33, 33, 33, 255,
- 0, 0, 0, 33, 0, 0, 33, 0, 33, 255,
- 259, 255, 259, 443, 259, 443, 0, 443, 0, 0,
- 0, 33, 259, 0, 0, 0, 0, 0, 0, 255,
- 0, 255, 259, 255, 259, 255, 0, 255, 0, 255,
- 0, 255, 0, 255, 0, 255, 0, 255, 0, 0,
- 0, 0, 259, 0, 259, 0, 259, 0, 259, 0,
- 259, 0, 259, 255, 259, 0, 259, 0, 259, 260,
- 259, 260, 444, 260, 444, 0, 444, 0, 0, 0,
- 299, 260, 299, 447, 299, 447, 259, 447, 0, 0,
- 0, 260, 299, 260, 0, 0, 0, 0, 0, 0,
- 0, 0, 299, 0, 299, 0, 0, 0, 0, 0,
- 0, 260, 0, 260, 0, 260, 0, 260, 0, 260,
- 0, 260, 299, 260, 299, 260, 299, 260, 299, 260,
- 299, 16, 299, 16, 299, 16, 299, 0, 299, 0,
- 299, 0, 0, 16, 0, 260, 0, 0, 0, 0,
- 0, 0, 0, 16, 0, 16, 299, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 16, 0, 16, 0, 16, 0, 16,
- 0, 16, 0, 16, 0, 16, 0, 16, 0, 16,
- 0, 16, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 16,
- };
- protected static short [] yyCheck = { 3,
- 235, 24, 322, 267, 326, 519, 491, 281, 1, 13,
- 607, 275, 236, 467, 323, 625, 345, 43, 643, 347,
- 333, 257, 263, 342, 260, 18, 268, 31, 264, 459,
- 266, 24, 343, 269, 27, 271, 272, 343, 274, 313,
- 276, 341, 278, 285, 280, 281, 282, 283, 607, 262,
- 350, 287, 346, 347, 470, 343, 292, 323, 294, 295,
- 296, 620, 564, 299, 300, 301, 343, 303, 364, 95,
- 306, 393, 308, 309, 310, 311, 343, 343, 304, 315,
- 316, 317, 323, 319, 320, 321, 343, 383, 81, 519,
- 419, 419, 328, 329, 596, 304, 332, 323, 334, 335,
- 419, 314, 95, 343, 343, 261, 342, 343, 419, 343,
- 419, 343, 626, 419, 323, 351, 343, 343, 728, 729,
- 536, 347, 96, 97, 98, 99, 100, 101, 102, 103,
- 153, 419, 454, 730, 343, 161, 638, 163, 592, 641,
- 364, 297, 419, 267, 170, 419, 262, 81, 343, 604,
- 161, 275, 419, 419, 361, 419, 343, 183, 184, 346,
- 153, 95, 419, 156, 190, 191, 192, 193, 194, 195,
- 196, 197, 198, 199, 200, 168, 169, 607, 803, 419,
- 419, 454, 419, 419, 343, 419, 337, 419, 381, 644,
- 620, 342, 419, 419, 220, 1, 626, 470, 314, 361,
- 356, 357, 361, 800, 361, 267, 413, 361, 234, 300,
- 419, 370, 18, 275, 361, 208, 209, 373, 342, 375,
- 246, 247, 156, 234, 419, 361, 343, 201, 202, 203,
- 204, 205, 206, 207, 168, 169, 210, 211, 212, 213,
- 214, 215, 216, 217, 218, 219, 355, 221, 733, 734,
- 361, 413, 343, 361, 413, 343, 413, 355, 346, 413,
- 341, 746, 455, 748, 457, 459, 413, 241, 349, 243,
- 347, 591, 298, 350, 208, 209, 385, 413, 387, 325,
- 389, 342, 391, 287, 393, 344, 395, 348, 397, 348,
- 399, 317, 401, 350, 403, 488, 266, 491, 344, 269,
- 352, 353, 413, 326, 341, 413, 271, 500, 501, 81,
- 419, 276, 342, 350, 621, 280, 362, 802, 348, 639,
- 324, 628, 342, 343, 294, 519, 319, 841, 341, 299,
- 295, 347, 345, 326, 347, 348, 329, 350, 823, 343,
- 339, 337, 305, 342, 307, 315, 342, 317, 341, 312,
- 360, 361, 362, 838, 358, 271, 321, 361, 328, 329,
- 276, 343, 332, 556, 280, 347, 370, 360, 503, 419,
- 393, 344, 345, 508, 419, 348, 344, 344, 344, 295,
- 348, 348, 348, 341, 156, 319, 339, 345, 392, 342,
- 416, 384, 396, 386, 341, 329, 168, 169, 345, 829,
- 393, 204, 205, 723, 341, 321, 432, 341, 345, 413,
- 341, 841, 350, 607, 345, 341, 343, 349, 345, 345,
- 347, 343, 257, 345, 344, 347, 360, 420, 348, 452,
- 345, 454, 626, 346, 345, 348, 208, 209, 365, 345,
- 367, 467, 345, 365, 437, 367, 369, 470, 371, 377,
- 384, 379, 386, 206, 207, 448, 449, 347, 343, 452,
- 345, 454, 210, 211, 212, 213, 348, 660, 350, 358,
- 463, 497, 348, 499, 350, 459, 381, 470, 471, 472,
- 363, 348, 486, 350, 359, 459, 420, 343, 343, 345,
- 345, 337, 337, 339, 339, 688, 489, 346, 341, 348,
- 344, 419, 346, 437, 345, 419, 347, 491, 337, 419,
- 339, 214, 215, 346, 448, 449, 346, 491, 419, 419,
- 419, 419, 350, 349, 346, 459, 343, 346, 346, 463,
- 341, 345, 348, 348, 727, 519, 730, 471, 472, 733,
- 734, 349, 349, 344, 349, 519, 739, 349, 348, 346,
- 743, 342, 746, 341, 748, 489, 341, 341, 793, 794,
- 346, 754, 755, 342, 341, 348, 592, 419, 348, 341,
- 348, 342, 459, 355, 350, 301, 342, 342, 345, 304,
- 419, 304, 419, 609, 345, 519, 612, 613, 360, 341,
- 616, 341, 419, 347, 343, 346, 600, 601, 345, 625,
- 355, 347, 628, 345, 491, 350, 800, 350, 802, 459,
- 345, 345, 384, 345, 386, 608, 345, 643, 345, 459,
- 350, 343, 342, 607, 345, 349, 341, 419, 345, 823,
- 343, 350, 519, 607, 350, 829, 346, 355, 831, 345,
- 342, 491, 626, 647, 838, 419, 336, 841, 420, 350,
- 350, 491, 626, 657, 350, 648, 649, 350, 350, 348,
- 653, 419, 346, 349, 344, 437, 459, 346, 694, 519,
- 696, 343, 339, 607, 608, 337, 448, 449, 348, 519,
- 345, 350, 350, 346, 285, 346, 620, 346, 345, 268,
- 268, 463, 626, 346, 344, 346, 344, 346, 491, 471,
- 472, 705, 728, 729, 346, 342, 293, 711, 712, 341,
- 350, 341, 350, 262, 648, 649, 350, 489, 314, 653,
- 607, 459, 346, 346, 345, 345, 519, 342, 344, 346,
- 349, 264, 350, 266, 279, 342, 269, 350, 350, 626,
- 350, 274, 346, 736, 342, 278, 730, 773, 337, 733,
- 734, 346, 346, 491, 287, 346, 730, 607, 346, 733,
- 734, 294, 746, 349, 748, 339, 299, 607, 350, 346,
- 303, 342, 746, 341, 748, 350, 626, 803, 347, 346,
- 341, 519, 315, 355, 317, 344, 626, 320, 346, 341,
- 341, 341, 419, 341, 350, 328, 329, 344, 341, 332,
- 342, 341, 736, 796, 342, 419, 342, 341, 812, 813,
- 814, 350, 314, 385, 607, 387, 800, 389, 802, 391,
- 419, 393, 350, 395, 262, 397, 800, 399, 802, 401,
- 350, 403, 342, 626, 346, 346, 608, 342, 346, 823,
- 223, 287, 4, 730, 31, 829, 733, 734, 15, 823,
- 153, 370, 28, 331, 838, 829, 329, 841, 413, 746,
- 593, 748, 796, 389, 838, 365, 389, 841, 657, 607,
- 601, 396, 600, 727, 712, 711, 648, 649, 293, 812,
- 730, 653, 334, 733, 734, 392, 419, 316, 626, 247,
- 730, 216, 218, 733, 734, 829, 746, 217, 748, 221,
- 219, 65, 806, -1, 829, 800, 746, 841, 748, 623,
- 691, 808, -1, 800, 499, 802, 689, 692, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 346,
- -1, 348, -1, 350, -1, -1, 823, 730, 355, -1,
- 733, 734, 829, -1, 284, -1, -1, -1, -1, -1,
- 800, 838, 802, 746, 841, 748, -1, -1, -1, -1,
- 800, -1, 802, -1, 736, -1, -1, -1, 385, -1,
- 387, -1, 389, 823, 391, -1, 393, -1, 395, 829,
- 397, -1, 399, 823, 401, 325, 403, -1, 838, 829,
- -1, 841, 730, -1, -1, 733, 734, -1, 838, -1,
- -1, 841, -1, -1, -1, -1, -1, 800, 746, 802,
- 748, 351, 352, 353, 354, -1, 356, 357, 358, 359,
- 360, 361, 362, 363, 796, 365, -1, 367, -1, 369,
- 823, 371, -1, 373, -1, 375, 829, 377, -1, 379,
- -1, -1, -1, -1, -1, 838, -1, -1, 841, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 800, -1, 802, -1, -1, -1, -1, 257,
- -1, -1, 260, -1, 262, -1, 264, -1, 266, -1,
- -1, 269, -1, 271, 272, 823, 274, -1, 276, -1,
- 278, 829, 280, 281, 282, 283, -1, -1, -1, 287,
- 838, -1, -1, 841, 292, -1, 294, 295, 296, -1,
- -1, 299, 300, 301, -1, 303, -1, 305, 306, 307,
- 308, 309, 310, 311, 312, -1, 314, 315, 316, 317,
- -1, 319, 320, 321, -1, -1, -1, -1, -1, -1,
- 328, 329, -1, -1, 332, -1, 334, 335, 260, 337,
- -1, 339, 264, -1, 266, -1, -1, 269, -1, 271,
- 272, -1, 274, 351, 276, -1, 278, -1, 280, 281,
- 282, 283, -1, -1, -1, 287, -1, -1, -1, -1,
- 292, -1, 294, 295, 296, -1, -1, 299, -1, 301,
- -1, 303, -1, -1, 306, -1, 308, 309, 310, 311,
- -1, -1, -1, 315, 316, 317, -1, 319, 320, 321,
- -1, -1, -1, -1, -1, -1, 328, 329, -1, -1,
- 332, -1, 334, 335, -1, -1, -1, -1, -1, 260,
- 342, 419, -1, 264, -1, 266, -1, -1, 269, 351,
- 271, 272, -1, 274, -1, 276, -1, 278, -1, 280,
- 281, 282, 283, -1, -1, -1, 287, -1, -1, -1,
- -1, 292, -1, 294, 295, 296, -1, -1, 299, -1,
- 301, -1, 303, -1, -1, 306, -1, 308, 309, 310,
- 311, -1, -1, -1, 315, 316, 317, -1, 319, 320,
- 321, -1, -1, -1, -1, -1, -1, 328, 329, -1,
- -1, 332, -1, 334, 335, -1, -1, 419, -1, -1,
- 260, 342, -1, -1, 264, -1, 266, -1, -1, 269,
- 351, 271, 272, -1, 274, -1, 276, -1, 278, -1,
- 280, 281, 282, 283, -1, -1, -1, 287, -1, -1,
- -1, -1, 292, -1, 294, 295, 296, -1, -1, 299,
- -1, 301, -1, 303, -1, -1, 306, -1, 308, 309,
- 310, 311, -1, -1, -1, 315, 316, 317, -1, 319,
- 320, 321, -1, -1, -1, -1, -1, -1, 328, 329,
- -1, -1, 332, -1, 334, 335, -1, -1, 419, 260,
- -1, -1, 342, 264, -1, 266, -1, -1, 269, -1,
- 271, 272, -1, 274, -1, 276, -1, 278, -1, 280,
- 281, 282, 283, -1, -1, -1, 287, -1, -1, -1,
- -1, 292, -1, 294, 295, 296, -1, -1, 299, -1,
- 301, -1, 303, -1, -1, 306, -1, 308, 309, 310,
- 311, -1, -1, -1, 315, 316, 317, -1, 319, 320,
- 321, -1, -1, -1, -1, -1, -1, 328, 329, -1,
- -1, 332, -1, 334, 335, -1, -1, -1, -1, 419,
- 261, 342, 263, 264, -1, 266, -1, -1, 269, 270,
- -1, -1, -1, 274, -1, -1, -1, 278, -1, -1,
- -1, -1, -1, 284, -1, -1, 287, -1, -1, -1,
- -1, -1, -1, 294, -1, -1, 297, -1, 299, -1,
- 301, 302, 303, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 315, -1, 317, 318, -1, 320,
- -1, -1, 323, -1, 325, -1, 327, 328, 329, 330,
- 346, 332, 348, -1, 350, -1, -1, -1, 419, 355,
- 341, 342, -1, 344, 345, 346, 347, 348, 349, 350,
- 351, 352, 353, 354, 355, 356, 357, 358, 359, 360,
- 361, 362, 363, 364, 365, -1, 367, -1, 369, 385,
- 371, 387, 373, 389, 375, 391, 377, 393, 379, 395,
- 381, 397, 383, 399, 385, 401, 387, 403, 389, -1,
- 391, -1, 393, -1, 395, -1, 397, -1, 399, -1,
- 401, -1, 403, -1, -1, -1, 407, -1, 409, -1,
- 411, -1, 413, -1, 415, -1, 417, 261, 419, 263,
- 264, -1, 266, -1, -1, 269, 270, -1, -1, -1,
- 274, -1, -1, -1, 278, -1, -1, -1, -1, -1,
- 284, -1, -1, 287, -1, -1, -1, -1, -1, -1,
- 294, -1, -1, 297, -1, 299, -1, 301, 302, 303,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 315, -1, 317, 318, -1, 320, -1, -1, 323,
- -1, 325, -1, 327, 328, 329, 330, -1, 332, -1,
- -1, -1, -1, -1, -1, -1, -1, 341, 342, -1,
- 344, 345, 346, 347, 348, 349, 350, 351, 352, 353,
- 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
- 364, 365, -1, 367, -1, 369, -1, 371, -1, 373,
- -1, 375, -1, 377, -1, 379, -1, 381, -1, 383,
- -1, 385, -1, 387, -1, 389, -1, 391, -1, 393,
- -1, 395, -1, 397, -1, 399, -1, 401, -1, 403,
- -1, -1, -1, 407, -1, 409, -1, 411, -1, 413,
- -1, 415, -1, 417, 261, 419, 263, 264, -1, 266,
- -1, -1, 269, 270, -1, -1, -1, 274, -1, -1,
- -1, 278, -1, -1, -1, -1, -1, 284, -1, -1,
- 287, -1, -1, -1, -1, -1, -1, 294, -1, -1,
- 297, -1, 299, -1, 301, 302, 303, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 315, -1,
- 317, 318, -1, 320, -1, -1, 323, -1, 325, -1,
- 327, 328, 329, 330, -1, 332, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 342, 343, 344, 345, 346,
- 347, 348, 349, 350, 351, 352, 353, 354, 355, 356,
- 357, 358, 359, 360, 361, 362, 363, 364, 365, -1,
- 367, -1, 369, -1, 371, -1, 373, -1, 375, -1,
- 377, -1, 379, -1, 381, -1, 383, -1, 385, -1,
- 387, -1, 389, -1, 391, -1, 393, -1, 395, -1,
- 397, -1, 399, -1, 401, -1, 403, -1, -1, -1,
- 407, -1, 409, -1, 411, -1, 413, -1, 415, -1,
- 417, 261, 419, 263, 264, -1, 266, -1, -1, 269,
- 270, -1, -1, -1, 274, -1, -1, -1, 278, -1,
- -1, -1, -1, -1, 284, -1, -1, 287, -1, -1,
- -1, -1, -1, -1, 294, -1, -1, 297, -1, 299,
- -1, 301, 302, 303, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 315, -1, 317, 318, -1,
- 320, -1, -1, 323, -1, 325, -1, 327, 328, 329,
- 330, -1, 332, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 342, 343, 344, 345, 346, -1, 348, 349,
- 350, 351, 352, 353, 354, 355, 356, 357, 358, 359,
- 360, 361, 362, 363, 364, 365, -1, 367, -1, 369,
- -1, 371, -1, 373, -1, 375, -1, 377, -1, 379,
- -1, 381, -1, 383, -1, 385, -1, 387, -1, 389,
- -1, 391, -1, 393, -1, 395, -1, 397, -1, 399,
- -1, 401, -1, 403, -1, -1, -1, 407, -1, 409,
- -1, 411, -1, 413, -1, 415, -1, 417, 261, 419,
- 263, 264, -1, 266, -1, -1, 269, 270, -1, -1,
- -1, 274, -1, -1, -1, 278, -1, -1, -1, -1,
- -1, 284, -1, -1, 287, -1, -1, -1, -1, -1,
- -1, 294, -1, -1, 297, -1, 299, -1, 301, 302,
- 303, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 315, -1, 317, 318, -1, 320, -1, -1,
- 323, -1, 325, -1, 327, 328, 329, 330, -1, 332,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 342,
- -1, 344, -1, 346, -1, 348, 349, 350, 351, 352,
- 353, 354, 355, 356, 357, 358, 359, 360, 361, 362,
- 363, 364, -1, -1, -1, -1, 369, -1, 371, -1,
- 373, -1, 375, -1, 377, -1, 379, -1, 381, -1,
- 383, -1, 385, -1, 387, -1, 389, -1, 391, -1,
- 393, -1, 395, -1, 397, -1, 399, -1, 401, -1,
- 403, -1, -1, -1, 407, -1, 409, -1, 411, -1,
- 413, -1, 415, -1, 417, 261, 419, 263, 264, -1,
- 266, -1, -1, 269, 270, -1, -1, -1, 274, -1,
- -1, -1, 278, -1, -1, -1, -1, -1, 284, -1,
- -1, 287, -1, -1, -1, -1, -1, -1, 294, -1,
- -1, 297, -1, 299, -1, 301, 302, 303, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 315,
- -1, 317, 318, -1, 320, -1, -1, 323, -1, 325,
- -1, 327, 328, 329, 330, -1, 332, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 342, -1, 344, 345,
- 346, -1, 348, 349, 350, 351, 352, 353, 354, -1,
- 356, 357, 358, 359, 360, 361, 362, 363, 364, 365,
- -1, 367, -1, 369, -1, 371, -1, 373, -1, 375,
- -1, 377, -1, 379, -1, 381, -1, 383, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 261,
- -1, 263, 264, -1, 266, -1, -1, 269, 270, -1,
- -1, 407, 274, 409, -1, 411, 278, 413, -1, 415,
- -1, 417, 284, 419, -1, 287, -1, -1, -1, -1,
- -1, -1, 294, -1, -1, 297, -1, 299, -1, 301,
- 302, 303, 304, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 315, -1, 317, 318, -1, 320, -1,
- -1, 323, -1, 325, -1, 327, 328, 329, 330, -1,
- 332, -1, -1, -1, -1, -1, -1, -1, -1, 341,
- 342, 343, 344, 345, 346, -1, 348, 349, 350, 351,
- 352, 353, 354, -1, 356, 357, 358, 359, 360, -1,
- -1, 363, 364, 365, -1, 367, -1, -1, -1, -1,
- -1, 373, -1, 375, -1, 377, -1, 379, -1, 381,
- -1, 383, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 261, -1, 263, 264, -1, 266, -1,
- -1, 269, 270, -1, -1, 407, 274, 409, -1, 411,
- 278, 413, -1, 415, -1, 417, 284, 419, -1, 287,
- -1, -1, -1, -1, -1, -1, 294, -1, -1, 297,
- -1, 299, -1, 301, 302, 303, 304, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 315, -1, 317,
- 318, -1, 320, -1, -1, 323, -1, 325, -1, 327,
- 328, 329, 330, -1, 332, -1, -1, -1, -1, -1,
- -1, -1, -1, 341, 342, -1, 344, 345, 346, -1,
- 348, 349, 350, 351, 352, 353, 354, -1, 356, 357,
- 358, 359, 360, -1, -1, 363, 364, 365, -1, 367,
- -1, -1, -1, -1, -1, 373, -1, 375, -1, 377,
- -1, 379, -1, 381, -1, 383, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 261, -1, 263,
- 264, -1, 266, -1, -1, 269, 270, -1, -1, 407,
- 274, 409, -1, 411, 278, 413, -1, 415, -1, 417,
- 284, 419, -1, 287, -1, -1, -1, -1, -1, -1,
- 294, -1, -1, 297, -1, 299, -1, 301, 302, 303,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 315, -1, 317, 318, -1, 320, -1, -1, 323,
- -1, 325, -1, 327, 328, 329, 330, -1, 332, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 342, -1,
- 344, 345, 346, -1, 348, 349, 350, 351, 352, 353,
- 354, -1, 356, 357, 358, 359, -1, -1, -1, 363,
- 364, 365, -1, 367, -1, 369, -1, 371, -1, 373,
- -1, 375, -1, 377, -1, 379, -1, 381, -1, 383,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 261, -1, 263, 264, -1, 266, -1, -1, 269,
- 270, -1, -1, 407, 274, 409, -1, 411, 278, 413,
- -1, 415, -1, 417, 284, 419, -1, 287, -1, -1,
- -1, -1, -1, -1, 294, -1, -1, 297, -1, 299,
- -1, 301, 302, 303, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 315, -1, 317, 318, -1,
- 320, -1, -1, 323, -1, 325, -1, 327, 328, 329,
- 330, -1, 332, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 342, -1, 344, 345, 346, -1, 348, 349,
- 350, 351, 352, 353, 354, -1, 356, 357, 358, 359,
- -1, -1, -1, 363, 364, 365, -1, 367, -1, 369,
- -1, 371, -1, 373, -1, 375, -1, 377, -1, 379,
- -1, 381, -1, 383, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 261, -1, 263, 264, -1,
- 266, -1, -1, 269, 270, -1, -1, 407, 274, 409,
- -1, 411, 278, 413, -1, 415, -1, 417, 284, 419,
- -1, 287, -1, -1, -1, -1, -1, -1, 294, -1,
- -1, 297, -1, 299, -1, 301, 302, 303, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 315,
- -1, 317, 318, -1, 320, -1, -1, 323, -1, 325,
- -1, 327, 328, 329, 330, -1, 332, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 342, -1, 344, 345,
- 346, -1, 348, 349, 350, 351, 352, 353, 354, -1,
- 356, 357, 358, 359, -1, -1, -1, 363, 364, 365,
- -1, 367, -1, 369, -1, 371, -1, 373, -1, 375,
- -1, 377, -1, 379, -1, 381, -1, 383, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 261,
- -1, 263, 264, -1, 266, -1, -1, 269, 270, -1,
- -1, 407, 274, 409, -1, 411, 278, 413, -1, 415,
- -1, 417, 284, 419, -1, 287, -1, -1, -1, -1,
- -1, -1, 294, -1, -1, 297, -1, 299, -1, 301,
- 302, 303, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 315, -1, 317, 318, -1, 320, -1,
- -1, 323, -1, 325, -1, 327, 328, 329, 330, -1,
- 332, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 342, -1, 344, 345, 346, -1, 348, 349, 350, 351,
- -1, -1, 354, -1, 356, 357, 358, 359, 360, -1,
- -1, 363, 364, 365, -1, 367, -1, 369, -1, 371,
- -1, 373, -1, 375, -1, 377, -1, 379, -1, 381,
- -1, 383, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 261, -1, 263, 264, -1, 266, -1,
- -1, 269, 270, -1, -1, 407, 274, 409, -1, 411,
- 278, 413, -1, 415, -1, 417, 284, 419, -1, 287,
- -1, -1, -1, -1, -1, -1, 294, -1, -1, 297,
- -1, 299, -1, 301, 302, 303, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 315, -1, 317,
- 318, -1, 320, -1, -1, 323, -1, 325, -1, 327,
- 328, 329, 330, -1, 332, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 342, -1, 344, 345, 346, -1,
- 348, 349, 350, 351, 352, 353, 354, -1, 356, 357,
- 358, 359, 360, -1, -1, 363, 364, 365, -1, 367,
- -1, -1, -1, -1, -1, 373, -1, 375, -1, 377,
- -1, 379, -1, 381, -1, 383, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 261, -1, 263,
- 264, -1, 266, -1, -1, 269, 270, -1, -1, 407,
- 274, 409, -1, 411, 278, 413, -1, 415, -1, 417,
- 284, 419, -1, 287, -1, -1, -1, -1, -1, -1,
- 294, -1, -1, 297, -1, 299, -1, 301, 302, 303,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 315, -1, 317, 318, -1, 320, -1, -1, 323,
- -1, 325, -1, 327, 328, 329, 330, -1, 332, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 342, -1,
- 344, 345, 346, -1, 348, 349, 350, 351, -1, -1,
- 354, -1, 356, 357, 358, 359, 360, -1, -1, 363,
- 364, 365, -1, 367, -1, 369, -1, 371, -1, 373,
- -1, 375, -1, 377, -1, 379, -1, 381, -1, 383,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 261, -1, 263, 264, -1, 266, -1, -1, 269,
- 270, -1, -1, 407, 274, 409, -1, 411, 278, 413,
- -1, 415, -1, 417, 284, 419, -1, 287, -1, -1,
- -1, -1, -1, -1, 294, -1, -1, 297, -1, 299,
- -1, 301, 302, 303, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 315, -1, 317, 318, -1,
- 320, -1, -1, 323, -1, 325, -1, 327, 328, 329,
- 330, -1, 332, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 342, -1, 344, 345, 346, -1, 348, 349,
- 350, 351, -1, -1, 354, -1, 356, 357, 358, 359,
- 360, -1, -1, 363, 364, 365, -1, 367, -1, 369,
- -1, 371, -1, 373, -1, 375, -1, 377, -1, 379,
- -1, 381, -1, 383, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 261, -1, 263, 264, -1,
- 266, -1, -1, 269, 270, -1, -1, 407, 274, 409,
- -1, 411, 278, 413, -1, 415, -1, 417, 284, 419,
- -1, 287, -1, -1, -1, -1, -1, -1, 294, -1,
- -1, 297, -1, 299, -1, 301, 302, 303, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 315,
- -1, 317, 318, -1, 320, -1, -1, 323, -1, 325,
- -1, 327, 328, 329, 330, -1, 332, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 342, -1, 344, 345,
- 346, -1, 348, 349, 350, 351, 352, 353, 354, -1,
- 356, 357, 358, 359, 360, -1, -1, 363, 364, 365,
- -1, 367, -1, -1, -1, -1, -1, 373, -1, 375,
- -1, 377, -1, 379, -1, 381, -1, 383, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 261,
- -1, 263, 264, -1, 266, -1, -1, 269, 270, -1,
- -1, 407, 274, 409, -1, 411, 278, 413, -1, 415,
- -1, 417, 284, 419, -1, 287, -1, -1, -1, -1,
- -1, -1, 294, -1, -1, 297, -1, 299, -1, 301,
- 302, 303, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 315, -1, 317, 318, -1, 320, -1,
- -1, 323, -1, 325, -1, 327, 328, 329, 330, -1,
- 332, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 342, -1, 344, 345, 346, -1, 348, 349, 350, 351,
- 352, 353, 354, -1, 356, 357, 358, 359, 360, -1,
- -1, 363, 364, 365, -1, 367, -1, -1, -1, -1,
- -1, 373, -1, 375, -1, 377, -1, 379, -1, 381,
- -1, 383, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 261, -1, 263, 264, -1, 266, -1,
- -1, 269, 270, -1, -1, 407, 274, 409, -1, 411,
- 278, 413, -1, 415, -1, 417, 284, 419, -1, 287,
- -1, -1, -1, -1, -1, -1, 294, -1, -1, 297,
- -1, 299, -1, 301, 302, 303, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 315, -1, 317,
- 318, -1, 320, -1, -1, 323, -1, 325, -1, 327,
- 328, 329, 330, -1, 332, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 342, -1, 344, 345, 346, -1,
- 348, 349, 350, 351, 352, 353, 354, -1, 356, 357,
- 358, 359, 360, -1, -1, 363, 364, 365, -1, 367,
- -1, -1, -1, -1, -1, 373, -1, 375, -1, 377,
- -1, 379, -1, 381, -1, 383, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 261, -1, 263,
- 264, -1, 266, -1, -1, 269, 270, -1, -1, 407,
- 274, 409, -1, 411, 278, 413, -1, 415, -1, 417,
- 284, 419, -1, 287, -1, -1, -1, -1, -1, -1,
- 294, -1, -1, 297, -1, 299, -1, 301, 302, 303,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 315, -1, 317, 318, -1, 320, -1, -1, 323,
- -1, 325, -1, 327, 328, 329, 330, -1, 332, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 342, -1,
- 344, 345, 346, -1, 348, 349, 350, 351, 352, 353,
- 354, -1, 356, 357, 358, 359, 360, -1, -1, 363,
- 364, 365, -1, 367, -1, -1, -1, -1, -1, 373,
- -1, 375, -1, 377, -1, 379, -1, 381, -1, 383,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 261, -1, 263, 264, -1, 266, -1, -1, 269,
- 270, -1, -1, 407, 274, 409, -1, 411, 278, 413,
- -1, 415, -1, 417, 284, 419, -1, 287, -1, -1,
- -1, -1, -1, -1, 294, -1, -1, 297, -1, 299,
- -1, 301, 302, 303, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 315, -1, 317, 318, -1,
- 320, -1, -1, 323, -1, 325, -1, 327, 328, 329,
- 330, -1, 332, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 342, -1, 344, 345, 346, -1, 348, 349,
- 350, 351, 352, 353, 354, -1, 356, 357, 358, 359,
- 360, -1, -1, 363, 364, 365, -1, 367, -1, -1,
- -1, -1, -1, 373, -1, 375, -1, 377, -1, 379,
- -1, 381, -1, 383, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 261, -1, 263, 264, -1,
- 266, -1, -1, 269, 270, -1, -1, 407, 274, 409,
- -1, 411, 278, 413, -1, 415, -1, 417, 284, 419,
- -1, 287, -1, -1, -1, -1, -1, -1, 294, -1,
- -1, 297, -1, 299, -1, 301, 302, 303, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 315,
- -1, 317, 318, -1, 320, -1, -1, 323, -1, 325,
- -1, 327, 328, 329, 330, -1, 332, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 342, -1, 344, 345,
- 346, -1, 348, 349, 350, 351, 352, 353, 354, -1,
- 356, 357, 358, 359, 360, -1, -1, 363, 364, 365,
- -1, 367, -1, -1, -1, -1, -1, 373, -1, 375,
- -1, 377, -1, 379, -1, 381, -1, 383, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 407, -1, 409, -1, 411, -1, 413, -1, 415,
- -1, 417, -1, 419, 263, 264, 265, 266, 267, -1,
- 269, 270, -1, 272, 273, 274, 275, -1, 277, 278,
- 279, -1, -1, -1, -1, 284, 285, -1, 287, 288,
- 289, 290, 291, -1, -1, 294, -1, -1, -1, 298,
- 299, -1, 301, 302, 303, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 313, -1, 315, -1, 317, 318,
- -1, 320, -1, 322, 323, 324, 325, 326, 327, 328,
- 329, 330, -1, 332, 333, 260, 335, 336, -1, -1,
- -1, -1, 341, 342, -1, -1, 345, -1, -1, -1,
- -1, 350, 351, 352, 353, 354, -1, -1, 283, 358,
- -1, 360, -1, -1, -1, -1, 365, -1, 367, -1,
- -1, 296, -1, -1, -1, -1, 301, -1, -1, -1,
- -1, 306, -1, 308, 309, 310, 311, -1, -1, -1,
- -1, 316, -1, -1, 319, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 407, 334,
- 409, -1, 411, -1, 413, -1, 415, -1, 417, -1,
- 419, 263, 264, 265, 266, 267, 351, 269, 270, -1,
- 272, 273, 274, 275, -1, 277, 278, 279, -1, -1,
- -1, -1, 284, -1, -1, 287, 288, 289, 290, 291,
- -1, -1, 294, -1, -1, -1, 298, 299, -1, 301,
- 302, 303, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 313, -1, 315, -1, 317, 318, -1, 320, -1,
- 322, 323, 324, 325, 326, 327, 328, 329, 330, -1,
- 332, 333, 260, 335, 336, -1, -1, -1, -1, 341,
- 342, -1, -1, 345, -1, -1, -1, -1, 350, 351,
- 352, 353, 354, -1, -1, 283, 358, -1, 360, -1,
- -1, -1, -1, 365, -1, 367, -1, -1, 296, -1,
- -1, -1, -1, 301, -1, -1, -1, -1, 306, -1,
- 308, 309, 310, 311, -1, -1, -1, -1, 316, -1,
- -1, 319, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 407, 334, 409, -1, 411,
- -1, 413, -1, 415, -1, 417, -1, 419, 263, 264,
- 265, 266, 267, -1, 269, 270, -1, 272, 273, 274,
- 275, -1, 277, 278, -1, -1, -1, -1, -1, 284,
- -1, -1, 287, 288, 289, 290, 291, -1, -1, 294,
- -1, -1, -1, 298, 299, -1, 301, 302, 303, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 313, -1,
- 315, -1, 317, 318, -1, 320, -1, 322, 323, 324,
- 325, 326, 327, 328, 329, 330, -1, 332, 333, -1,
- 335, 336, -1, -1, -1, -1, 341, 342, -1, -1,
- 345, -1, -1, -1, -1, 350, 351, 352, 353, 354,
- -1, -1, -1, 358, -1, 360, -1, -1, -1, -1,
- 365, -1, 367, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 407, -1, 409, -1, 411, -1, 413, -1,
- 415, -1, 417, -1, 419, 263, 264, 265, 266, -1,
- -1, 269, 270, -1, 272, 273, 274, -1, -1, 277,
- 278, -1, -1, -1, -1, -1, 284, -1, -1, 287,
- 288, 289, 290, 291, -1, -1, 294, -1, -1, -1,
- 298, 299, -1, 301, 302, 303, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 313, -1, 315, -1, 317,
- 318, -1, 320, -1, 322, 323, 324, 325, 326, 327,
- 328, 329, 330, -1, 332, 333, -1, 335, 336, -1,
- -1, -1, -1, 341, -1, -1, -1, 345, -1, -1,
- -1, -1, 350, 351, 352, 353, 354, -1, -1, -1,
- 358, -1, 360, -1, -1, -1, -1, 365, -1, 367,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 407,
- -1, 409, -1, 411, -1, 413, -1, 415, -1, 417,
- -1, 419, 263, 264, 265, 266, -1, -1, 269, 270,
- -1, 272, 273, 274, -1, -1, 277, 278, -1, -1,
- -1, -1, -1, 284, -1, -1, 287, 288, 289, 290,
- 291, -1, -1, 294, -1, -1, -1, 298, 299, -1,
- 301, 302, 303, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 313, -1, 315, -1, 317, 318, -1, 320,
- -1, 322, 323, 324, 325, 326, 327, 328, 329, 330,
- -1, 332, 333, -1, 335, 336, -1, -1, -1, -1,
- 341, -1, -1, -1, 345, -1, -1, -1, -1, 350,
- 351, 352, 353, 354, -1, -1, -1, 358, -1, 360,
- -1, -1, -1, -1, 365, -1, 367, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 407, -1, 409, -1,
- 411, -1, 413, -1, 415, -1, 417, -1, 419, 263,
- 264, 265, 266, -1, -1, 269, 270, -1, -1, 273,
- 274, -1, -1, 277, 278, -1, -1, -1, -1, -1,
- 284, -1, -1, 287, 288, 289, 290, 291, -1, -1,
- 294, -1, -1, -1, 298, 299, -1, 301, 302, 303,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 313,
- -1, 315, -1, 317, 318, -1, 320, -1, 322, 323,
- 324, 325, 326, 327, 328, 329, 330, -1, 332, 333,
- -1, -1, 336, -1, -1, -1, -1, 341, -1, -1,
- -1, 345, -1, -1, -1, -1, 350, 351, 352, 353,
- 354, -1, -1, -1, 358, -1, 360, -1, -1, -1,
- -1, 365, -1, 367, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 263, 264, -1, 266, -1, -1, 269,
- 270, -1, -1, 407, 274, 409, -1, 411, 278, 413,
- -1, 415, -1, 417, 284, 419, -1, 287, -1, -1,
- -1, -1, -1, -1, 294, -1, -1, -1, -1, 299,
- -1, 301, 302, 303, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 315, -1, 317, 318, -1,
- 320, -1, -1, 323, -1, 325, -1, 327, 328, 329,
- 330, -1, 332, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 342, -1, 344, 345, 346, -1, 348, 349,
- 350, 351, 352, 353, 354, -1, -1, -1, 358, 359,
- 360, -1, -1, 363, 364, 365, -1, 367, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 377, -1, 379,
- -1, 381, -1, 383, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 263, 264, -1,
- 266, -1, -1, 269, 270, -1, -1, 407, 274, 409,
- -1, 411, 278, 413, -1, 415, -1, 417, 284, 419,
- -1, 287, -1, -1, -1, -1, -1, -1, 294, -1,
- -1, -1, -1, 299, -1, 301, 302, 303, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 315,
- -1, 317, 318, -1, 320, -1, -1, 323, -1, 325,
- -1, 327, 328, 329, 330, -1, 332, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 342, -1, 344, 345,
- 346, -1, 348, 349, 350, 351, 352, 353, 354, -1,
- -1, -1, 358, 359, 360, -1, -1, 363, 364, 365,
- -1, 367, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 377, -1, 379, -1, 381, -1, 383, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 263, 264, -1, 266, -1, -1, 269, 270, -1,
- -1, 407, 274, 409, -1, 411, 278, 413, -1, 415,
- -1, 417, 284, 419, -1, 287, -1, -1, -1, -1,
- -1, -1, 294, -1, -1, -1, -1, 299, -1, 301,
- 302, 303, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 315, -1, 317, 318, -1, 320, -1,
- -1, 323, -1, 325, -1, 327, 328, 329, 330, -1,
- 332, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 342, -1, 344, 345, 346, -1, 348, 349, 350, 351,
- 352, 353, 354, -1, -1, -1, 358, 359, 360, -1,
- -1, 363, 364, 365, -1, 367, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 377, -1, 379, -1, 381,
- -1, 383, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 263, 264, -1, 266, -1,
- -1, 269, 270, -1, -1, 407, 274, 409, -1, 411,
- 278, 413, -1, 415, -1, 417, 284, 419, -1, 287,
- -1, -1, -1, -1, -1, -1, 294, -1, -1, -1,
- -1, 299, -1, 301, 302, 303, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 315, -1, 317,
- 318, -1, 320, -1, -1, 323, -1, 325, -1, 327,
- 328, 329, 330, -1, 332, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 342, -1, 344, 345, 346, -1,
- 348, 349, 350, 351, 352, 353, 354, -1, -1, -1,
- 358, 359, 360, -1, -1, 363, 364, 365, -1, 367,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 381, -1, 383, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 263,
- 264, -1, 266, -1, -1, 269, 270, -1, -1, 407,
- 274, 409, -1, 411, 278, 413, -1, 415, -1, 417,
- 284, 419, -1, 287, -1, -1, -1, -1, -1, -1,
- 294, -1, -1, -1, -1, 299, -1, 301, 302, 303,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 315, -1, 317, 318, -1, 320, -1, -1, 323,
- -1, 325, -1, 327, 328, 329, 330, -1, 332, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 342, -1,
- 344, 345, 346, -1, 348, 349, 350, 351, 352, 353,
- 354, -1, -1, -1, 358, 359, 360, -1, -1, 363,
- 364, 365, -1, 367, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 381, -1, 383,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 263, 264, -1, 266, -1, -1, 269,
- 270, -1, -1, 407, 274, 409, -1, 411, 278, 413,
- -1, 415, -1, 417, 284, 419, -1, 287, -1, -1,
- -1, -1, -1, -1, 294, -1, -1, -1, -1, 299,
- -1, 301, 302, 303, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 315, -1, 317, 318, -1,
- 320, -1, -1, 323, -1, 325, -1, 327, 328, 329,
- 330, -1, 332, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 342, -1, 344, 345, 346, -1, 348, 349,
- 350, 351, 352, 353, 354, -1, -1, -1, -1, 359,
- 360, -1, -1, 363, 364, 365, -1, 367, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 381, -1, 383, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 263, 264, -1,
- 266, -1, -1, 269, 270, -1, -1, 407, 274, 409,
- -1, 411, 278, 413, -1, 415, -1, 417, 284, 419,
- -1, 287, -1, -1, -1, -1, -1, -1, 294, -1,
- -1, -1, -1, 299, -1, 301, 302, 303, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 315,
- -1, 317, 318, -1, 320, -1, -1, 323, -1, 325,
- -1, 327, 328, 329, 330, -1, 332, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 342, -1, 344, 345,
- 346, -1, 348, 349, 350, 351, 352, 353, 354, -1,
- -1, -1, 358, 359, 360, -1, -1, -1, 364, 365,
- -1, 367, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 381, -1, 383, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 263, 264, -1, 266, -1, -1, 269, 270, -1,
- -1, 407, 274, 409, -1, 411, 278, 413, -1, 415,
- -1, 417, 284, 419, -1, 287, -1, -1, -1, -1,
- -1, -1, 294, -1, -1, -1, -1, 299, -1, 301,
- 302, 303, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 315, -1, 317, 318, -1, 320, -1,
- -1, 323, -1, 325, -1, 327, 328, 329, 330, -1,
- 332, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 342, -1, 344, 345, 346, -1, 348, 349, 350, 351,
- 352, 353, 354, -1, -1, -1, -1, 359, 360, -1,
- -1, 363, 364, 365, -1, 367, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 381,
- -1, 383, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 263, 264, -1, 266, -1,
- -1, 269, 270, -1, -1, 407, 274, 409, -1, 411,
- 278, 413, -1, 415, -1, 417, 284, 419, -1, 287,
- -1, -1, -1, -1, -1, -1, 294, -1, -1, -1,
- -1, 299, -1, 301, 302, 303, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 315, -1, 317,
- 318, -1, 320, -1, -1, 323, -1, 325, -1, 327,
- 328, 329, 330, -1, 332, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 342, -1, 344, 345, 346, -1,
- 348, 349, 350, 351, 352, 353, 354, -1, -1, -1,
- 358, 359, 360, -1, -1, -1, 364, 365, -1, 367,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 381, -1, 383, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 263,
- 264, -1, 266, -1, -1, 269, 270, -1, -1, 407,
- 274, 409, -1, 411, 278, 413, -1, 415, -1, 417,
- 284, 419, -1, 287, -1, -1, -1, -1, -1, -1,
- 294, -1, -1, -1, -1, 299, -1, 301, 302, 303,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 315, -1, 317, 318, -1, 320, -1, -1, 323,
- -1, 325, -1, 327, 328, 329, 330, -1, 332, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 342, -1,
- 344, 345, 346, -1, 348, 349, 350, 351, 352, 353,
- 354, -1, -1, -1, 358, -1, 360, -1, -1, -1,
- 364, 365, -1, 367, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 381, -1, 383,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 263, 264, -1, 266, -1, -1, 269,
- 270, -1, -1, 407, 274, 409, -1, 411, 278, 413,
- -1, 415, -1, 417, 284, 419, -1, 287, -1, -1,
- -1, -1, -1, -1, 294, -1, -1, -1, -1, 299,
- -1, 301, 302, 303, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 315, -1, 317, 318, -1,
- 320, -1, -1, 323, -1, 325, -1, 327, 328, 329,
- 330, -1, 332, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 342, -1, 344, 345, 346, -1, 348, 349,
- 350, 351, 352, 353, 354, -1, -1, -1, 358, -1,
- 360, -1, -1, -1, 364, 365, -1, 367, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 381, -1, 383, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 263, 264, -1,
- 266, -1, -1, 269, 270, -1, -1, 407, 274, 409,
- -1, 411, 278, 413, -1, 415, -1, 417, 284, 419,
- -1, 287, -1, -1, -1, -1, -1, -1, 294, -1,
- -1, -1, -1, 299, -1, 301, 302, 303, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 315,
- -1, 317, 318, -1, 320, -1, -1, 323, -1, 325,
- -1, 327, 328, 329, 330, -1, 332, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 342, -1, 344, 345,
- 346, -1, 348, 349, 350, 351, 352, 353, 354, -1,
- -1, -1, 358, -1, 360, -1, -1, -1, 364, 365,
- -1, 367, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 383, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 263, 264, -1, 266, -1, -1, 269, 270, -1,
- -1, 407, 274, 409, -1, 411, 278, 413, -1, 415,
- -1, 417, 284, 419, -1, 287, -1, -1, -1, -1,
- -1, -1, 294, -1, -1, -1, -1, 299, -1, 301,
- 302, 303, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 315, -1, 317, 318, -1, 320, -1,
- -1, 323, -1, 325, -1, 327, 328, 329, 330, -1,
- 332, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 342, -1, 344, 345, 346, -1, 348, 349, 350, 351,
- 352, 353, 354, -1, -1, -1, 358, -1, 360, -1,
- -1, -1, 364, 365, -1, 367, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 383, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 263, 264, -1, 266, -1,
- -1, 269, 270, -1, -1, 407, 274, 409, -1, 411,
- 278, 413, -1, 415, -1, 417, 284, 419, -1, 287,
- -1, -1, -1, -1, -1, -1, 294, -1, -1, -1,
- -1, 299, -1, 301, 302, 303, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 315, -1, 317,
- 318, -1, 320, -1, -1, 323, -1, 325, -1, 327,
- 328, 329, 330, -1, 332, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 342, -1, 344, 345, 346, -1,
- 348, 349, 350, 351, 352, 353, 354, -1, -1, -1,
- 358, -1, 360, -1, -1, -1, -1, 365, -1, 367,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 263,
- 264, -1, 266, -1, -1, 269, 270, -1, -1, 407,
- 274, 409, -1, 411, 278, 413, -1, 415, -1, 417,
- 284, 419, -1, 287, -1, -1, -1, -1, -1, -1,
- 294, -1, -1, -1, -1, 299, -1, 301, 302, 303,
- -1, 305, -1, -1, -1, -1, -1, -1, 312, -1,
- -1, 315, -1, 317, 318, -1, 320, -1, -1, 323,
- -1, 325, -1, 327, 328, 329, 330, -1, 332, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 345, -1, -1, -1, -1, -1, 351, 352, 353,
- 354, -1, -1, -1, 358, -1, 360, -1, -1, -1,
- -1, 365, -1, 367, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 263, 264, -1, 266, -1, -1, 269,
- 270, -1, -1, 407, 274, 409, -1, 411, 278, 413,
- -1, 415, -1, 417, 284, 419, -1, 287, -1, -1,
- -1, -1, -1, -1, 294, -1, -1, -1, -1, 299,
- -1, 301, 302, 303, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 315, -1, 317, 318, -1,
- 320, -1, -1, 323, -1, 325, -1, 327, 328, 329,
- 330, -1, 332, -1, -1, -1, -1, -1, -1, -1,
- -1, 341, 342, -1, -1, 345, -1, -1, -1, -1,
- -1, 351, 352, 353, 354, -1, -1, -1, 358, -1,
- 360, -1, -1, -1, -1, 365, -1, 367, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 263, 264, -1,
- 266, -1, -1, 269, 270, -1, -1, 407, 274, 409,
- -1, 411, 278, 413, -1, 415, -1, 417, 284, 419,
- -1, 287, -1, -1, -1, -1, -1, -1, 294, -1,
- -1, -1, -1, 299, -1, 301, 302, 303, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 315,
- -1, 317, 318, -1, 320, -1, -1, 323, -1, 325,
- -1, 327, 328, 329, 330, -1, 332, -1, -1, -1,
- -1, -1, -1, -1, -1, 341, 342, -1, -1, 345,
- -1, -1, -1, -1, -1, 351, 352, 353, 354, -1,
- -1, -1, 358, -1, 360, -1, -1, -1, -1, 365,
- -1, 367, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 263, 264, -1, 266, -1, -1, 269, 270, -1,
- -1, 407, 274, 409, -1, 411, 278, 413, -1, 415,
- -1, 417, 284, 419, -1, 287, -1, -1, -1, -1,
- -1, -1, 294, -1, -1, -1, -1, 299, -1, 301,
- 302, 303, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 315, -1, 317, 318, -1, 320, -1,
- -1, 323, -1, 325, -1, 327, 328, 329, 330, -1,
- 332, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 345, -1, -1, 348, -1, 350, 351,
- 352, 353, 354, -1, -1, -1, 358, -1, 360, -1,
- -1, -1, -1, 365, -1, 367, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 263, 264, -1, 266, -1,
- -1, 269, 270, -1, -1, 407, 274, 409, -1, 411,
- 278, 413, -1, 415, -1, 417, 284, 419, -1, 287,
- -1, -1, -1, -1, -1, -1, 294, -1, -1, -1,
- -1, 299, -1, 301, 302, 303, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 315, -1, 317,
- 318, -1, 320, -1, -1, 323, -1, 325, -1, 327,
- 328, 329, 330, -1, 332, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 345, -1, -1,
- 348, -1, -1, 351, 352, 353, 354, -1, -1, -1,
- 358, -1, 360, -1, -1, -1, -1, 365, -1, 367,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 263,
- 264, -1, 266, -1, -1, 269, 270, -1, -1, 407,
- 274, 409, -1, 411, 278, 413, -1, 415, -1, 417,
- 284, 419, -1, 287, -1, -1, -1, -1, -1, -1,
- 294, -1, -1, -1, -1, 299, -1, 301, 302, 303,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 315, -1, 317, 318, -1, 320, -1, -1, 323,
- -1, 325, -1, 327, 328, 329, 330, -1, 332, -1,
- -1, -1, -1, -1, -1, -1, -1, 341, -1, -1,
- -1, 345, -1, -1, -1, -1, -1, 351, 352, 353,
- 354, -1, -1, -1, 358, -1, 360, -1, -1, -1,
- -1, 365, -1, 367, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 263, 264, -1, 266, -1, -1, 269,
- 270, -1, -1, 407, 274, 409, -1, 411, 278, 413,
- -1, 415, -1, 417, 284, 419, -1, 287, -1, -1,
- -1, -1, -1, -1, 294, -1, -1, -1, -1, 299,
- -1, 301, 302, 303, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 315, -1, 317, 318, -1,
- 320, -1, -1, 323, -1, 325, -1, 327, 328, 329,
- 330, -1, 332, -1, -1, 335, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 345, -1, -1, -1, -1,
- -1, 351, 352, 353, 354, -1, -1, -1, 358, -1,
- 360, -1, -1, -1, -1, 365, -1, 367, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 263, 264, -1,
- 266, -1, -1, 269, 270, -1, -1, 407, 274, 409,
- -1, 411, 278, 413, -1, 415, -1, 417, 284, 419,
- -1, 287, -1, -1, -1, -1, -1, -1, 294, -1,
- -1, -1, -1, 299, -1, 301, 302, 303, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 315,
- -1, 317, 318, -1, 320, -1, -1, 323, -1, 325,
- -1, 327, 328, 329, 330, -1, 332, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 345,
- -1, -1, -1, -1, 350, 351, 352, 353, 354, -1,
- -1, -1, 358, -1, 360, -1, -1, -1, -1, 365,
- -1, 367, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 263, 264, -1, 266, -1, -1, 269, 270, -1,
- -1, 407, 274, 409, -1, 411, 278, 413, -1, 415,
- -1, 417, 284, 419, -1, 287, -1, -1, -1, -1,
- -1, -1, 294, -1, -1, -1, -1, 299, -1, 301,
- 302, 303, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 315, -1, 317, 318, -1, 320, -1,
- -1, 323, -1, 325, -1, 327, 328, 329, 330, -1,
- 332, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 345, -1, -1, -1, -1, -1, 351,
- 352, 353, 354, -1, -1, -1, 358, -1, 360, -1,
- -1, -1, -1, 365, -1, 367, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 263, 264, -1, 266, -1,
- -1, 269, 270, -1, -1, 407, 274, 409, -1, 411,
- 278, 413, -1, 415, -1, 417, 284, 419, -1, 287,
- -1, -1, -1, -1, -1, -1, 294, -1, -1, -1,
- -1, 299, -1, 301, 302, 303, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 315, -1, 317,
- 318, -1, 320, -1, -1, 323, -1, 325, -1, 327,
- 328, 329, 330, -1, 332, -1, 264, 335, 266, -1,
- -1, 269, -1, 271, 272, -1, 274, 345, 276, -1,
- 278, -1, 280, 281, 282, -1, -1, -1, -1, 287,
- -1, -1, -1, -1, 292, -1, 294, 295, -1, -1,
- -1, 299, -1, -1, -1, 303, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 315, -1, 317,
- -1, -1, 320, 321, -1, -1, -1, -1, -1, -1,
- 328, 329, -1, -1, 332, -1, -1, 335, -1, 407,
- -1, 409, -1, 411, -1, 413, -1, 415, 264, 417,
- 266, 419, -1, 269, -1, 271, 272, -1, 274, -1,
- 276, -1, 278, -1, 280, 281, 282, -1, -1, -1,
- -1, 287, -1, -1, -1, -1, 292, -1, 294, 295,
- -1, -1, -1, 299, -1, -1, -1, 303, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 315,
- -1, 317, -1, -1, 320, 321, -1, -1, -1, -1,
- -1, -1, 328, 329, -1, 264, 332, 266, -1, 335,
- 269, 419, 271, 272, -1, 274, -1, 276, -1, 278,
- -1, 280, 281, 282, -1, -1, -1, -1, 287, -1,
- -1, -1, -1, 292, -1, 294, 295, -1, -1, -1,
- 299, -1, -1, -1, 303, -1, -1, -1, -1, 264,
- -1, 266, -1, -1, 269, -1, 315, -1, 317, 274,
- -1, 320, 321, 278, -1, -1, 281, -1, -1, 328,
- 329, -1, 287, 332, -1, -1, 335, -1, -1, 294,
- -1, -1, -1, -1, 299, -1, 301, -1, 303, -1,
- -1, -1, -1, 419, -1, -1, -1, -1, -1, -1,
- 315, 264, 317, 266, -1, 320, 269, -1, -1, -1,
- -1, 274, -1, 328, 329, 278, -1, 332, 281, -1,
- 335, -1, -1, -1, 287, -1, -1, 342, -1, -1,
- -1, 294, 264, -1, 266, -1, 299, 269, 301, -1,
- 303, -1, 274, -1, -1, -1, 278, -1, -1, -1,
- -1, -1, 315, -1, 317, 287, -1, 320, -1, -1,
- 419, -1, 294, -1, -1, 328, 329, 299, -1, 332,
- -1, 303, 335, 305, -1, 307, 264, -1, 266, 342,
- 312, 269, -1, 315, -1, 317, 274, -1, 320, -1,
- 278, -1, -1, -1, -1, -1, 328, 329, -1, 287,
- 332, -1, -1, -1, 419, -1, 294, -1, 264, -1,
- 266, 299, -1, 269, 346, 303, -1, 305, 274, 307,
- -1, -1, 278, -1, 312, 281, -1, 315, -1, 317,
- -1, 287, 320, -1, -1, -1, -1, -1, 294, -1,
- 328, 329, -1, 299, 332, -1, -1, 303, -1, -1,
- -1, -1, -1, -1, -1, 264, 419, 266, -1, 315,
- 269, 317, -1, -1, 320, 274, -1, -1, -1, 278,
- -1, -1, 328, 329, -1, -1, 332, -1, 287, 335,
- -1, -1, -1, -1, -1, 294, -1, 419, -1, -1,
- 299, 264, -1, 266, 303, -1, 269, -1, -1, -1,
- -1, 274, -1, -1, -1, 278, 315, -1, 317, -1,
- -1, 320, -1, -1, 287, -1, -1, -1, -1, 328,
- 329, 294, -1, 332, -1, -1, 299, -1, -1, -1,
- 303, 419, 341, -1, -1, -1, -1, -1, -1, -1,
- 349, -1, 315, 264, 317, 266, -1, 320, 269, -1,
- -1, -1, -1, 274, -1, 328, 329, 278, -1, 332,
- 281, 261, -1, 419, -1, 264, 287, 266, 341, -1,
- 269, -1, -1, 294, -1, 274, 349, -1, 299, 278,
- -1, -1, 303, -1, -1, -1, -1, -1, 287, -1,
- -1, -1, -1, -1, 315, 294, 317, 297, -1, 320,
- 299, -1, -1, -1, 303, -1, -1, 328, 329, -1,
- 419, 332, -1, -1, 335, -1, 315, -1, 317, -1,
- -1, 320, -1, -1, -1, -1, -1, -1, -1, 328,
- 329, -1, -1, 332, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 343, -1, 345, 419, -1, -1, -1,
- -1, -1, 352, 353, -1, 355, 356, 357, 358, 359,
- 360, 361, 362, 363, 364, 365, -1, 367, -1, 369,
- -1, 371, -1, 373, -1, 375, -1, 377, -1, 379,
- -1, 381, -1, 383, -1, 385, -1, 387, -1, 389,
- -1, 391, -1, 393, -1, 395, -1, 397, 419, 399,
- -1, 401, 257, 403, -1, 260, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 271, -1, -1, -1,
- 419, 276, -1, -1, -1, 280, -1, -1, 283, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 295, 296, -1, -1, -1, 300, 301, -1, -1, -1,
- -1, 306, -1, 308, 309, 310, 311, 257, -1, -1,
- 260, 316, -1, -1, 319, -1, 321, -1, -1, -1,
- -1, 271, -1, -1, -1, -1, 276, -1, -1, 334,
- 280, -1, -1, 283, -1, -1, -1, 342, 343, -1,
- -1, -1, -1, -1, -1, 295, 296, -1, -1, -1,
- 300, 301, -1, -1, -1, -1, 306, -1, 308, 309,
- 310, 311, 257, -1, -1, 260, 316, -1, -1, 319,
- -1, 321, -1, -1, -1, -1, 271, -1, -1, -1,
- -1, 276, -1, -1, 334, 280, -1, -1, 283, -1,
- -1, -1, 342, 343, -1, -1, -1, -1, -1, -1,
- 295, 296, -1, -1, -1, 300, 301, -1, -1, -1,
- -1, 306, -1, 308, 309, 310, 311, 257, -1, -1,
- 260, 316, -1, -1, 319, -1, 321, -1, -1, -1,
- -1, 271, -1, -1, -1, -1, 276, -1, -1, 334,
- 280, -1, 260, 283, -1, -1, -1, -1, 343, -1,
- -1, -1, -1, 271, -1, 295, 296, -1, 276, -1,
- -1, 301, 280, -1, -1, 283, 306, -1, 308, 309,
- 310, 311, -1, -1, -1, -1, 316, 295, 296, 319,
- -1, 321, 300, 301, -1, -1, -1, -1, 306, -1,
- 308, 309, 310, 311, 334, 260, -1, -1, 316, -1,
- -1, 319, 342, 321, -1, -1, 271, -1, -1, 257,
- -1, 276, 260, -1, -1, 280, 334, -1, 283, -1,
- -1, -1, -1, 271, 342, 343, -1, -1, 276, -1,
- 295, 296, 280, -1, -1, 283, 301, -1, -1, -1,
- -1, 306, -1, 308, 309, 310, 311, 295, 296, -1,
- -1, 316, 300, 301, 319, -1, 321, -1, 306, -1,
- 308, 309, 310, 311, 257, -1, -1, 260, 316, 334,
- -1, 319, -1, 321, -1, -1, -1, 342, 271, -1,
- -1, -1, -1, 276, -1, -1, 334, 280, -1, -1,
- 283, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 295, 296, -1, -1, -1, 343, 301, 345,
- 346, 347, 348, 306, 350, 308, 309, 310, 311, 355,
- -1, -1, -1, 316, -1, -1, 319, -1, 321, 365,
- 343, 367, 345, 346, 347, 348, -1, 350, -1, -1,
- -1, 334, 355, -1, -1, -1, -1, -1, -1, 385,
- -1, 387, 365, 389, 367, 391, -1, 393, -1, 395,
- -1, 397, -1, 399, -1, 401, -1, 403, -1, -1,
- -1, -1, 385, -1, 387, -1, 389, -1, 391, -1,
- 393, -1, 395, 419, 397, -1, 399, -1, 401, 343,
- 403, 345, 346, 347, 348, -1, 350, -1, -1, -1,
- 343, 355, 345, 346, 347, 348, 419, 350, -1, -1,
- -1, 365, 355, 367, -1, -1, -1, -1, -1, -1,
- -1, -1, 365, -1, 367, -1, -1, -1, -1, -1,
- -1, 385, -1, 387, -1, 389, -1, 391, -1, 393,
- -1, 395, 385, 397, 387, 399, 389, 401, 391, 403,
- 393, 343, 395, 345, 397, 347, 399, -1, 401, -1,
- 403, -1, -1, 355, -1, 419, -1, -1, -1, -1,
- -1, -1, -1, 365, -1, 367, 419, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 385, -1, 387, -1, 389, -1, 391,
- -1, 393, -1, 395, -1, 397, -1, 399, -1, 401,
- -1, 403, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 419,
- };
-
-#line 2535 "cs-parser.jay"
-
-
-// <summary>
-// A class used to pass around variable declarations and constants
-// </summary>
-public class VariableDeclaration {
- public string identifier;
- public object expression_or_array_initializer;
-
- public VariableDeclaration (string id, object eoai){
- this.identifier = id;
- this.expression_or_array_initializer = eoai;
- }
-}
-
-// <summary>
-// Given the @class_name name, it creates a fully qualified name
-// based on the containing declaration space
-// </summary>
-string
-MakeName (string class_name)
-{
- string ns = current_namespace.Name;
- string container_name = current_container.Name;
-
- if (container_name == ""){
- if (ns != "")
- return ns + "." + class_name;
- else
- return class_name;
- } else
- return container_name + "." + class_name;
-}
-
-// <summary>
-// Used to report back to the user the result of a declaration
-// in the current declaration space
-// </summary>
-void
-CheckDef (DeclSpace.AdditionResult result, string name)
-{
- if (result == DeclSpace.AdditionResult.Success)
- return;
-
- switch (result){
- case DeclSpace.AdditionResult.NameExists:
- error (102, "The namespace `" + current_container.Name +
- "' already contains a definition for `"+
- name + "'");
- break;
-
-/*
- NEED TO HANDLE THIS IN SEMANTIC ANALYSIS:
-
- case DeclSpace.AdditionResult.MethodDuplicated:
- error (111, "Class `"+current_container.Name+
- "' already defines a member called '" +
- name + "' with the same parameter types");
- break;
-*/
- case DeclSpace.AdditionResult.EnclosingClash:
- error (542, "Member names cannot be the same as their enclosing type");
- break;
-
- case DeclSpace.AdditionResult.NotAConstructor:
- error (1520, "Class, struct, or interface method must have a return type");
- break;
- }
-}
-
-void
-CheckDef (bool result, string name)
-{
- if (result)
- return;
- CheckDef (DeclSpace.AdditionResult.NameExists, name);
-}
-
-Block declare_local_variables (TypeRef typeref, ArrayList variable_declarators)
-{
- Block implicit_block;
- ArrayList inits = null;
-
- //
- // We use the `Used' property to check whether statements
- // have been added to the current block. If so, we need
- // to create another block to contain the new declaration
- // otherwise, as an optimization, we use the same block to
- // add the declaration.
- //
- // FIXME: A further optimization is to check if the statements
- // that were added were added as part of the initialization
- // below. In which case, no other statements have been executed
- // and we might be able to reduce the number of blocks for
- // situations like this:
- //
- // int j = 1; int k = j + 1;
- //
- if (current_block.Used)
- implicit_block = new Block (current_block, true);
- else
- implicit_block = new Block (current_block, true);
-
- foreach (VariableDeclaration decl in variable_declarators){
- if (implicit_block.AddVariable (typeref, decl.identifier)){
- if (decl.expression_or_array_initializer != null){
- if (inits == null)
- inits = new ArrayList ();
- inits.Add (decl);
- }
- } else {
- error (128, "A local variable `" + decl.identifier +
- "' is already defined in this scope");
- }
- }
-
- if (inits == null)
- return implicit_block;
-
- foreach (VariableDeclaration decl in inits){
- if (decl.expression_or_array_initializer is Expression){
- Expression expr = (Expression) decl.expression_or_array_initializer;
- Assign assign;
-
- assign = new Assign (new LocalVariableReference (implicit_block, decl.identifier), expr);
- implicit_block.AddStatement (new StatementExpression (assign));
- } else {
- }
- }
-
- return implicit_block;
-}
-
-void CheckConstant (Expression expr)
-{
- // finishme
-}
-
-void CheckBoolean (Expression expr)
-{
- // finishme
-}
-
-static public void error (int code, string desc)
-{
- Console.WriteLine ("Error CS"+code+": "+desc);
- global_errors++;
-}
-
-void output (string s)
-{
- Console.WriteLine (s);
-}
-
-void note (string s)
-{
- // Used to put annotations
-}
-
-TypeRef type (string type_name)
-{
- return type_references.GetTypeRef (current_container, type_name);
-}
-
-Tokenizer lexer;
-
-public CSharpParser(CIR.Tree tree, string name, System.IO.Stream input)
- : base (tree, name, input)
-{
- current_namespace = new Namespace (null, "");
- current_container = tree.Types;
- current_container.Namespace = current_namespace;
-
- lexer = new Tokenizer (input, name);
- type_references = new TypeRefManager ();
-}
-
-public override int parse ()
-{
- StringBuilder value = new StringBuilder ();
-
- global_errors = 0;
- try {
- if (yacc_verbose_flag)
- yyparse (lexer, new yydebug.yyDebugSimple ());
- else
- yyparse (lexer);
- } catch (Exception e){
- Console.WriteLine ("Fatal error: "+name);
- Console.WriteLine (e);
- Console.WriteLine (lexer.location);
- global_errors++;
- }
-
- return global_errors;
-}
-
-bool yacc_verbose_flag = false;
-
-public bool yacc_verbose {
- set {
- yacc_verbose_flag = value;
- }
-
- get {
- return yacc_verbose_flag;
- }
-}
-
-/* end end end */
-}
-}
-
-#line 5289 "-"
-namespace yydebug {
- using System;
- public interface yyDebug {
- void push (int state, Object value);
- void lex (int state, int token, string name, Object value);
- void shift (int from, int to, int errorFlag);
- void pop (int state);
- void discard (int state, int token, string name, Object value);
- void reduce (int from, int to, int rule, string text, int len);
- void shift (int from, int to);
- void accept (Object value);
- void error (string message);
- void reject ();
- }
-
- class yyDebugSimple : yyDebug {
- void println (string s){
- Console.WriteLine (s);
- }
-
- public void push (int state, Object value) {
- println ("push\tstate "+state+"\tvalue "+value);
- }
-
- public void lex (int state, int token, string name, Object value) {
- println("lex\tstate "+state+"\treading "+name+"\tvalue "+value);
- }
-
- public void shift (int from, int to, int errorFlag) {
- switch (errorFlag) {
- default: // normally
- println("shift\tfrom state "+from+" to "+to);
- break;
- case 0: case 1: case 2: // in error recovery
- println("shift\tfrom state "+from+" to "+to
- +"\t"+errorFlag+" left to recover");
- break;
- case 3: // normally
- println("shift\tfrom state "+from+" to "+to+"\ton error");
- break;
- }
- }
-
- public void pop (int state) {
- println("pop\tstate "+state+"\ton error");
- }
-
- public void discard (int state, int token, string name, Object value) {
- println("discard\tstate "+state+"\ttoken "+name+"\tvalue "+value);
- }
-
- public void reduce (int from, int to, int rule, string text, int len) {
- println("reduce\tstate "+from+"\tuncover "+to
- +"\trule ("+rule+") "+text);
- }
-
- public void shift (int from, int to) {
- println("goto\tfrom state "+from+" to "+to);
- }
-
- public void accept (Object value) {
- println("accept\tvalue "+value);
- }
-
- public void error (string message) {
- println("error\t"+message);
- }
-
- public void reject () {
- println("reject");
- }
-
- }
-}
-// %token constants
- class Token {
- public const int EOF = 257;
- public const int NONE = 258;
- public const int ERROR = 259;
- public const int ABSTRACT = 260;
- public const int AS = 261;
- public const int ADD = 262;
- public const int BASE = 263;
- public const int BOOL = 264;
- public const int BREAK = 265;
- public const int BYTE = 266;
- public const int CASE = 267;
- public const int CATCH = 268;
- public const int CHAR = 269;
- public const int CHECKED = 270;
- public const int CLASS = 271;
- public const int CONST = 272;
- public const int CONTINUE = 273;
- public const int DECIMAL = 274;
- public const int DEFAULT = 275;
- public const int DELEGATE = 276;
- public const int DO = 277;
- public const int DOUBLE = 278;
- public const int ELSE = 279;
- public const int ENUM = 280;
- public const int EVENT = 281;
- public const int EXPLICIT = 282;
- public const int EXTERN = 283;
- public const int FALSE = 284;
- public const int FINALLY = 285;
- public const int FIXED = 286;
- public const int FLOAT = 287;
- public const int FOR = 288;
- public const int FOREACH = 289;
- public const int GOTO = 290;
- public const int IF = 291;
- public const int IMPLICIT = 292;
- public const int IN = 293;
- public const int INT = 294;
- public const int INTERFACE = 295;
- public const int INTERNAL = 296;
- public const int IS = 297;
- public const int LOCK = 298;
- public const int LONG = 299;
- public const int NAMESPACE = 300;
- public const int NEW = 301;
- public const int NULL = 302;
- public const int OBJECT = 303;
- public const int OPERATOR = 304;
- public const int OUT = 305;
- public const int OVERRIDE = 306;
- public const int PARAMS = 307;
- public const int PRIVATE = 308;
- public const int PROTECTED = 309;
- public const int PUBLIC = 310;
- public const int READONLY = 311;
- public const int REF = 312;
- public const int RETURN = 313;
- public const int REMOVE = 314;
- public const int SBYTE = 315;
- public const int SEALED = 316;
- public const int SHORT = 317;
- public const int SIZEOF = 318;
- public const int STATIC = 319;
- public const int STRING = 320;
- public const int STRUCT = 321;
- public const int SWITCH = 322;
- public const int THIS = 323;
- public const int THROW = 324;
- public const int TRUE = 325;
- public const int TRY = 326;
- public const int TYPEOF = 327;
- public const int UINT = 328;
- public const int ULONG = 329;
- public const int UNCHECKED = 330;
- public const int UNSAFE = 331;
- public const int USHORT = 332;
- public const int USING = 333;
- public const int VIRTUAL = 334;
- public const int VOID = 335;
- public const int WHILE = 336;
- public const int GET = 337;
- public const int get = 338;
- public const int SET = 339;
- public const int set = 340;
- public const int OPEN_BRACE = 341;
- public const int CLOSE_BRACE = 342;
- public const int OPEN_BRACKET = 343;
- public const int CLOSE_BRACKET = 344;
- public const int OPEN_PARENS = 345;
- public const int CLOSE_PARENS = 346;
- public const int DOT = 347;
- public const int COMMA = 348;
- public const int COLON = 349;
- public const int SEMICOLON = 350;
- public const int TILDE = 351;
- public const int PLUS = 352;
- public const int MINUS = 353;
- public const int BANG = 354;
- public const int ASSIGN = 355;
- public const int OP_LT = 356;
- public const int OP_GT = 357;
- public const int BITWISE_AND = 358;
- public const int BITWISE_OR = 359;
- public const int STAR = 360;
- public const int PERCENT = 361;
- public const int DIV = 362;
- public const int CARRET = 363;
- public const int INTERR = 364;
- public const int OP_INC = 365;
- public const int OP_DEC = 367;
- public const int OP_SHIFT_LEFT = 369;
- public const int OP_SHIFT_RIGHT = 371;
- public const int OP_LE = 373;
- public const int OP_GE = 375;
- public const int OP_EQ = 377;
- public const int OP_NE = 379;
- public const int OP_AND = 381;
- public const int OP_OR = 383;
- public const int OP_MULT_ASSIGN = 385;
- public const int OP_DIV_ASSIGN = 387;
- public const int OP_MOD_ASSIGN = 389;
- public const int OP_ADD_ASSIGN = 391;
- public const int OP_SUB_ASSIGN = 393;
- public const int OP_SHIFT_LEFT_ASSIGN = 395;
- public const int OP_SHIFT_RIGHT_ASSIGN = 397;
- public const int OP_AND_ASSIGN = 399;
- public const int OP_XOR_ASSIGN = 401;
- public const int OP_OR_ASSIGN = 403;
- public const int OP_PTR = 405;
- public const int LITERAL_INTEGER = 407;
- public const int LITERAL_FLOAT = 409;
- public const int LITERAL_DOUBLE = 411;
- public const int LITERAL_DECIMAL = 413;
- public const int LITERAL_CHARACTER = 415;
- public const int LITERAL_STRING = 417;
- public const int IDENTIFIER = 419;
- public const int yyErrorCode = 256;
- }
- namespace yyParser {
- using System;
- /** thrown for irrecoverable syntax errors and stack overflow.
- */
- public class yyException : System.Exception {
- public yyException (string message) : base (message) {
- }
- }
-
- /** must be implemented by a scanner object to supply input to the parser.
- */
- public interface yyInput {
- /** move on to next token.
- @return false if positioned beyond tokens.
- @throws IOException on input error.
- */
- bool advance (); // throws java.io.IOException;
- /** classifies current token.
- Should not be called if advance() returned false.
- @return current %token or single character.
- */
- int token ();
- /** associated with current token.
- Should not be called if advance() returned false.
- @return value for token().
- */
- Object value ();
- }
- }
diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay
index 3b792896953..f6bde935f98 100755
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -1,2756 +1,3983 @@
-%{
-//
-// cs-parser.jay: The Parser for the C# compiler
-//
-// Author: Miguel de Icaza (miguel@gnu.org)
-//
-// Licensed under the terms of the GNU GPL
-//
-// (C) 2001 Ximian, Inc (http://www.ximian.com)
-//
-// TODO:
-// (1) Get rid of the *Collections.cs, that is an idea I took from System.CodeDOM
-// And come to think of it, it is not that great, it duplicates a lot of code
-// for something which is not really needed. We still have piles of typecasts
-// anwyays (due to the nature of the stack being a collection of Objects).
-//
-// (2) Figure out why error productions dont work. `type-declaration' is a
-// great spot to put an `error' because you can reproduce it with this input:
-// "public X { }"
-//
-// (3) Move Modifier checking from each object into the parser itself, that will
-// get rid of the global "error" symbol that we use now to report errors.
-// We still need to pass a pointer to the tree.ErrorHandler, but that is a
-// separate problem
-//
-using System.Text;
-using CSC;
-using System;
-
-namespace CSC
-{
- using System.Collections;
- using Compiler;
- using CSC;
- using CIR;
-
- /// <summary>
- /// The C# Parser
- /// </summary>
- public class CSharpParser : Parser {
- static int global_errors;
-
- Namespace current_namespace;
- TypeContainer current_container;
-
- // <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>
- Interface current_interface;
-
- // <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" accesor
- // method
- // </summary>
- ParameterCollection implicit_value_parameters;
-
- // <summary>
- // Here we keep track of type references.
- // </summary>
- TypeRefManager type_references;
-
- // <summary>
- // Used to record all types defined
- // </summary>
- CIR.Tree tree;
-%}
-
-%token EOF
-%token NONE /* This token is never returned by our lexer */
-%token ERROR // This is used not by the parser, but by the tokenizer.
- // do not remove.
-
-/*
- *These are the C# keywords
- */
-%token ABSTRACT
-%token AS
-%token ADD
-%token BASE
-%token BOOL
-%token BREAK
-%token BYTE
-%token CASE
-%token CATCH
-%token CHAR
-%token CHECKED
-%token CLASS
-%token CONST
-%token CONTINUE
-%token DECIMAL
-%token DEFAULT
-%token DELEGATE
-%token DO
-%token DOUBLE
-%token ELSE
-%token ENUM
-%token EVENT
-%token EXPLICIT
-%token EXTERN
-%token FALSE
-%token FINALLY
-%token FIXED
-%token FLOAT
-%token FOR
-%token FOREACH
-%token GOTO
-%token IF
-%token IMPLICIT
-%token IN
-%token INT
-%token INTERFACE
-%token INTERNAL
-%token IS
-%token LOCK
-%token LONG
-%token NAMESPACE
-%token NEW
-%token NULL
-%token OBJECT
-%token OPERATOR
-%token OUT
-%token OVERRIDE
-%token PARAMS
-%token PRIVATE
-%token PROTECTED
-%token PUBLIC
-%token READONLY
-%token REF
-%token RETURN
-%token REMOVE
-%token SBYTE
-%token SEALED
-%token SHORT
-%token SIZEOF
-%token STATIC
-%token STRING
-%token STRUCT
-%token SWITCH
-%token THIS
-%token THROW
-%token TRUE
-%token TRY
-%token TYPEOF
-%token UINT
-%token ULONG
-%token UNCHECKED
-%token UNSAFE
-%token USHORT
-%token USING
-%token VIRTUAL
-%token VOID
-%token WHILE
-
-/* C# keywords which are not really keywords */
-%token GET "get"
-%token SET "set"
-
-/* C# single character operators/punctuation. */
-%token OPEN_BRACE "{"
-%token CLOSE_BRACE "}"
-%token OPEN_BRACKET "["
-%token CLOSE_BRACKET "]"
-%token OPEN_PARENS "("
-%token CLOSE_PARENS ")"
-%token DOT "."
-%token COMMA ","
-%token COLON ":"
-%token SEMICOLON ";"
-%token TILDE "~"
-
-%token PLUS "+"
-%token MINUS "-"
-%token BANG "!"
-%token ASSIGN "="
-%token OP_LT "<"
-%token OP_GT ">"
-%token BITWISE_AND "&"
-%token BITWISE_OR "|"
-%token STAR "*"
-%token PERCENT "%"
-%token DIV "/"
-%token CARRET "^"
-%token INTERR "?"
-
-/* C# multi-character operators. */
-%token OP_INC "++"
-%token OP_DEC "--"
-%token OP_SHIFT_LEFT "<<"
-%token OP_SHIFT_RIGHT ">>"
-%token OP_LE "<="
-%token OP_GE ">="
-%token OP_EQ "=="
-%token OP_NE "!="
-%token OP_AND "&&"
-%token OP_OR "||"
-%token OP_MULT_ASSIGN "*="
-%token OP_DIV_ASSIGN "/="
-%token OP_MOD_ASSIGN "%="
-%token OP_ADD_ASSIGN "+="
-%token OP_SUB_ASSIGN "-="
-%token OP_SHIFT_LEFT_ASSIGN "<<="
-%token OP_SHIFT_RIGHT_ASSIGN ">>="
-%token OP_AND_ASSIGN "&="
-%token OP_XOR_ASSIGN "^="
-%token OP_OR_ASSIGN "|="
-%token OP_PTR "->"
-
-/* Numbers */
-%token LITERAL_INTEGER "int literal"
-%token LITERAL_FLOAT "float literal"
-%token LITERAL_DOUBLE "double literal"
-%token LITERAL_DECIMAL "decimal literal"
-%token LITERAL_CHARACTER "character literal"
-%token LITERAL_STRING "string literal"
-
-%token IDENTIFIER
-
-/* Add precedence rules to solve dangling else s/r conflict */
-%nonassoc IF
-%nonassoc ELSE
-
-%start compilation_unit
-/*%start namespace_declaration */
-%%
-
-compilation_unit
- : opt_using_directives opt_attributes opt_namespace_member_declarations
- EOF
- {
- // At some point check that using only comes *before* any namespaces
- }
- ;
-
-using_directives
- : using_directive
- | using_directives using_directive
- ;
-
-using_directive
- : using_alias_directive
- | using_namespace_directive
- ;
-
-using_alias_directive
- : USING IDENTIFIER ASSIGN
- namespace_or_type_name SEMICOLON {
- }
- ;
-
-using_namespace_directive
- : USING namespace_name SEMICOLON
- {
- current_namespace.Using ((string) $2);
- }
- ;
-
-namespace_declarations
- : namespace_declaration
- | namespace_declarations namespace_declaration
-
-namespace_declaration
- : NAMESPACE qualified_identifier
- {
- current_namespace = new Namespace (current_namespace, (string) $2);
- }
- namespace_body opt_semicolon
- {
- current_namespace = current_namespace.Parent;
- }
- ;
-
-opt_semicolon
- : /* empty */
- | SEMICOLON
- ;
-
-opt_comma
- : /* empty */
- | COMMA
- ;
-
-qualified_identifier
- : IDENTIFIER
- | qualified_identifier DOT IDENTIFIER {
- $$ = (($1).ToString ()) + "." + ($3.ToString ()); }
- ;
-
-
-namespace_name
- : namespace_or_type_name
- ;
-
-namespace_body
- : OPEN_BRACE
- opt_using_directives
- opt_namespace_member_declarations
- CLOSE_BRACE {
- }
- ;
-
-opt_using_directives
- : /* empty */
- | using_directives
- ;
-
-opt_namespace_member_declarations
- : /* empty */
- | namespace_member_declarations
- ;
-
-namespace_member_declarations
- : namespace_member_declaration
- | namespace_member_declarations namespace_member_declaration
- ;
-
-namespace_member_declaration
- : type_declaration
- {
- int mod_flags = 0;
- string name = "";
-
- if ($1 is Class){
- Class c = (Class) $1;
- mod_flags = c.ModFlags;
- name = c.Name;
- } else if ($1 is Struct){
- Struct s = (Struct) $1;
- mod_flags = s.ModFlags;
- name = s.Name;
- } else
- break;
-
- //
- // We remove this error until we can
- //if ((mod_flags & (Modifiers.PRIVATE|Modifiers.PROTECTED)) != 0){
- // error (1527, "Namespace elements cant be explicitly " +
- // "declared private or protected in `" + name + "'");
- //}
- }
- | namespace_declaration
- ;
-
-type_declaration
- : class_declaration
- | struct_declaration
- | interface_declaration
- | enum_declaration
- | delegate_declaration // finishme
- ;
-
-//
-// Attributes 17.2
-//
-opt_attributes
- : /* empty */
- | attributes
- ;
-
-attributes
- : attribute_sections
- ;
-
-attribute_sections
- : attribute_section
- | attribute_sections attribute_section
- ;
-
-attribute_section
- : OPEN_BRACKET
- opt_attribute_target_specifier attribute_list
- /* FIXME: opt_comma */
- CLOSE_BRACKET
- ;
-
-opt_attribute_target_specifier
- : /* empty */
- | attribute_target_specifier
- ;
-
-attribute_target_specifier
- : attribute_target COLON
- ;
-
-attribute_target
- : IDENTIFIER {
- // if (Collection.Contains ($$))... FIXME
- note ("Allows: assembly, field, method, module, param, property, type");
- }
- | EVENT
- | RETURN
- ;
-
-attribute_list
- : attribute
- | attribute_list COMMA attribute
- ;
-
-attribute
- : attribute_name
- | opt_attribute_arguments
- ;
-
-attribute_name
- : type_name { /* reserved attribute name or identifier: 17.4 */ }
- ;
-
-opt_attribute_arguments
- : /* empty */
- | OPEN_PARENS attribute_arguments CLOSE_PARENS
- ;
-
-attribute_arguments
- : expression
- | attribute_arguments COMMA expression
- ;
-
-
-opt_dimension_separators
- : /* empty */
- | dimension_separators
- ;
-
-dimension_separators
- : COMMA
- | dimension_separators COMMA
- ;
-
-class_body
- : OPEN_BRACE opt_class_member_declarations CLOSE_BRACE
- ;
-
-opt_class_member_declarations
- : /* empty */
- | class_member_declarations
- ;
-
-class_member_declarations
- : class_member_declaration
- | class_member_declarations
- class_member_declaration
- ;
-
-class_member_declaration
- : constant_declaration // done
- | field_declaration // done
- | method_declaration // done
- | property_declaration // done
- | event_declaration // finishme
- | indexer_declaration // finishme
- | operator_declaration // finishme
- | constructor_declaration // done
- | destructor_declaration // done
- | type_declaration
- ;
-
-struct_declaration
- : opt_attributes
- opt_modifiers
- STRUCT IDENTIFIER
- {
- Struct new_struct;
- string full_struct_name = MakeName ((string) $4);
-
- new_struct = new Struct (current_container, full_struct_name, (int) $2);
- current_container = new_struct;
- current_container.Namespace = current_namespace;
- tree.RecordType (full_class_name, new_struct);
- }
- opt_struct_interfaces
- struct_body
- opt_semicolon
- {
- Struct new_struct = (Struct) current_container;
-
- current_container = current_container.Parent;
- CheckDef (current_container.AddStruct (new_struct), new_struct.Name);
- $$ = new_struct;
- }
- ;
-
-opt_struct_interfaces
- : /* empty */
- | struct_interfaces
- ;
-
-struct_interfaces
- : struct_interface
- | struct_interfaces struct_interface
- ;
-
-struct_interface
- : COLON type_list
- ;
-
-struct_body
- : OPEN_BRACE opt_struct_member_declarations CLOSE_BRACE
- ;
-
-opt_struct_member_declarations
- : /* empty */
- | struct_member_declarations
- ;
-
-struct_member_declarations
- : struct_member_declaration
- | struct_member_declarations struct_member_declaration
- ;
-
-struct_member_declaration
- : constant_declaration
- | field_declaration
- | method_declaration
- | property_declaration
- | event_declaration
- | indexer_declaration
- | operator_declaration
- | constructor_declaration
- | type_declaration
- ;
-
-constant_declaration
- : opt_attributes
- opt_modifiers
- CONST
- type
- constant_declarators
- SEMICOLON
- {
- Modifiers.Check (Constant.AllowedModifiers, (int) $2, Modifiers.PRIVATE);
-
- foreach (DictionaryEntry constant in (ArrayList) $5){
- Constant c = new Constant (
- (TypeRef) $4, (string) constant.Key,
- (Expression) constant.Value);
-
- CheckDef (current_container.AddConstant (c), c.Name);
- }
- }
- ;
-
-constant_declarators
- : constant_declarator
- {
- ArrayList constants = new ArrayList ();
- constants.Add ($1);
- $$ = constants;
- }
- | constant_declarators COMMA constant_declarator
- {
- ArrayList constants = (ArrayList) $1;
-
- constants.Add ($3);
- }
- ;
-
-constant_declarator
- : IDENTIFIER ASSIGN constant_expression {
- $$ = new DictionaryEntry ($1, $3);
- }
- ;
-
-field_declaration
- : opt_attributes
- opt_modifiers
- type
- variable_declarators
- SEMICOLON
- {
- TypeRef typeref = (TypeRef) $3;
- int mod = (int) $2;
-
- foreach (VariableDeclaration var in (ArrayList) $4){
- Field field = new Field (typeref, mod, var.identifier,
- var.expression_or_array_initializer);
-
- CheckDef (current_container.AddField (field), field.Name);
- }
- }
-
- ;
-
-variable_declarators
- : variable_declarator
- {
- ArrayList decl = new ArrayList ();
- $$ = decl;
- decl.Add ($1);
- }
- | variable_declarators COMMA variable_declarator
- {
- ArrayList decls = (ArrayList) $1;
- decls.Add ($3);
- $$ = $1;
- }
- ;
-
-variable_declarator
- : IDENTIFIER ASSIGN variable_initializer
- {
- $$ = new VariableDeclaration ((string) $1, $3);
- }
- | IDENTIFIER
- {
- $$ = new VariableDeclaration ((string) $1, null);
- }
- ;
-
-variable_initializer
- : expression
- | array_initializer
- ;
-
-method_declaration
- : method_header
- method_body
- {
- Method method = (Method) $1;
-
- method.Block = (Block) $2;
- CheckDef (current_container.AddMethod (method), method.Name);
-
- current_local_parameters = null;
- }
- ;
-
-method_header
- : opt_attributes
- opt_modifiers
- type
- member_name
- OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
- {
- Method method = new Method ((TypeRef) $3, (int) $2, (string) $4, (Parameters) $6);
-
- current_local_parameters = (Parameters) $6;
-
- $$ = method;
- }
- | opt_attributes
- opt_modifiers
- VOID
- member_name
- OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
- {
- Method method = new Method (type ("void"), (int) $2, (string) $4, (Parameters) $6);
-
- current_local_parameters = (Parameters) $6;
- $$ = method;
- }
- ;
-
-method_body
- : block
- | SEMICOLON { $$ = null; }
- ;
-
-opt_formal_parameter_list
- : /* empty */ { $$ = new Parameters (null, null); }
- | formal_parameter_list
- ;
-
-formal_parameter_list
- : fixed_parameters
- {
- $$ = new Parameters ((ParameterCollection) $1, null);
- }
- | fixed_parameters COMMA parameter_array
- {
- $$ = new Parameters ((ParameterCollection) $1, (Parameter) $3);
- }
- | parameter_array
- {
- $$ = new Parameters (null, (Parameter) $1);
- }
- ;
-
-fixed_parameters
- : fixed_parameter
- {
- ParameterCollection pars = new ParameterCollection ();
- pars.Add ((Parameter) $1);
- $$ = pars;
- }
- | fixed_parameters COMMA fixed_parameter
- {
- ParameterCollection pars = (ParameterCollection) $1;
- pars.Add ((Parameter) $3);
- $$ = $1;
- }
- ;
-
-fixed_parameter
- : opt_attributes
- opt_parameter_modifier
- type
- IDENTIFIER
- {
- $$ = new Parameter ((TypeRef) $3, (string) $4, (Parameter.Modifier) $2);
- }
- ;
-
-opt_parameter_modifier
- : /* empty */ { $$ = Parameter.Modifier.NONE; }
- | parameter_modifier
- ;
-
-parameter_modifier
- : REF { $$ = Parameter.Modifier.REF; }
- | OUT { $$ = Parameter.Modifier.OUT; }
- ;
-
-parameter_array
- : opt_attributes PARAMS type IDENTIFIER
- {
- $$ = new Parameter ((TypeRef) $3, (string) $4, Parameter.Modifier.PARAMS);
- note ("type must be a single-dimension array type");
- }
- ;
-
-member_name
- : IDENTIFIER { $$ = $1.ToString (); }
- | interface_type DOT IDENTIFIER { $$ = $1.ToString () + "." + $3.ToString (); }
- ;
-
-property_declaration
- : opt_attributes
- opt_modifiers
- type member_name
- OPEN_BRACE
- {
- Parameter implicit_value_parameter;
- implicit_value_parameter = new Parameter ((TypeRef) $3, "value", Parameter.Modifier.NONE);
-
- lexer.properties = true;
-
- implicit_value_parameters = new ParameterCollection ();
- implicit_value_parameters.Add (implicit_value_parameter);
- }
- accessor_declarations
- {
- lexer.properties = false;
- }
- CLOSE_BRACE
- {
- Property prop;
- DictionaryEntry pair = (DictionaryEntry) $7;
- Block get_block = null;
- Block set_block = null;
-
- if (pair.Key != null)
- get_block = (Block) pair.Key;
- if (pair.Value != null)
- set_block = (Block) pair.Value;
-
- prop = new Property ((TypeRef) $3, (string) $4, (int) $2, get_block, set_block);
-
- CheckDef (current_container.AddProperty (prop), prop.Name);
- implicit_value_parameters = null;
- }
- ;
-
-accessor_declarations
- : get_accessor_declaration opt_set_accessor_declaration
- {
- $$ = new DictionaryEntry ($1, $2);
- }
- | set_accessor_declaration opt_get_accessor_declaration
- {
- $$ = new DictionaryEntry ($2, $1);
- }
- ;
-
-opt_get_accessor_declaration
- : /* empty */ { $$ = null; }
- | get_accessor_declaration
- ;
-
-opt_set_accessor_declaration
- : /* empty */ { $$ = null; }
- | set_accessor_declaration
- ;
-
-get_accessor_declaration
- : opt_attributes GET accessor_body
- {
- $$ = $3;
- }
- ;
-
-set_accessor_declaration
- : opt_attributes SET
- {
- current_local_parameters = new Parameters (implicit_value_parameters, null);
- }
- accessor_body
- {
- $$ = $4;
- current_local_parameters = null;
- }
- ;
-
-accessor_body
- : block
- | SEMICOLON { $$ = new Block (null); }
- ;
-
-interface_declaration
- : opt_attributes
- opt_modifiers
- INTERFACE IDENTIFIER
- {
- Interface new_interface;
- string full_interface_name = MakeName ((string) $4);
-
- new_interface = new Interface (current_container, full_interface_name, (int) $2);
- if (current_interface != null)
- error (-2, "Internal compiler error: interface inside interface");
- current_interface = new_interface;
- tree.RecordType (full_class_name, new_interface);
- }
- opt_interface_base
- interface_body
- {
- Interface new_interface = (Interface) current_interface;
-
- if ($6 != null)
- new_interface.Bases = (ArrayList) $6;
-
- current_interface = null;
- CheckDef (current_container.AddInterface (new_interface), new_interface.Name);
- }
- ;
-
-opt_interface_base
- : /* empty */ { $$ = null; }
- | interface_base
- ;
-
-interface_base
- : COLON interface_type_list { $$ = $2; }
- ;
-
-interface_type_list
- : interface_type
- {
- ArrayList interfaces = new ArrayList ();
-
- interfaces.Add ($1);
- }
- | interface_type_list COMMA interface_type
- {
- ArrayList interfaces = (ArrayList) $1;
- interfaces.Add ($3);
- $$ = interfaces;
- }
- ;
-
-interface_body
- : OPEN_BRACE
- opt_interface_member_declarations
- CLOSE_BRACE
- ;
-
-opt_interface_member_declarations
- : /* empty */
- | interface_member_declarations
- ;
-
-interface_member_declarations
- : interface_member_declaration
- | interface_member_declarations interface_member_declaration
- ;
-
-interface_member_declaration
- : interface_method_declaration
- {
- InterfaceMethod m = (InterfaceMethod) $1;
-
- CheckDef (current_interface.AddMethod (m), m.Name);
- }
- | interface_property_declaration
- {
- InterfaceProperty p = (InterfaceProperty) $1;
-
- CheckDef (current_interface.AddProperty (p), p.Name);
- }
- | interface_event_declaration
- {
- InterfaceEvent e = (InterfaceEvent) $1;
-
- CheckDef (current_interface.AddEvent (e), e.Name);
- }
- | interface_indexer_declaration
- {
- InterfaceIndexer i = (InterfaceIndexer) $1;
-
- CheckDef (current_interface.AddIndexer (i), "indexer");
- }
- ;
-
-opt_new
- : /* empty */ { $$ = false; }
- | NEW { $$ = true; }
- ;
-
-interface_method_declaration
- : opt_attributes opt_new type IDENTIFIER
- OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
- SEMICOLON
- {
- $$ = new InterfaceMethod ((TypeRef) $3, (string) $4, (bool) $2, (Parameters) $6);
- }
- | opt_attributes opt_new VOID IDENTIFIER
- OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
- SEMICOLON
- {
- $$ = new InterfaceMethod (type ("void"), (string) $4, (bool) $2, (Parameters) $6);
- }
- ;
-
-interface_property_declaration
- : opt_attributes
- opt_new
- type IDENTIFIER
- OPEN_BRACE
- { lexer.properties = true; }
- interface_accesors
- { lexer.properties = false; }
- CLOSE_BRACE
- {
- int gs = (int) $7;
-
- $$ = new InterfaceProperty ((TypeRef) $3, (string) $4, (bool) $2,
- (gs & 1) == 1, (gs & 2) == 2);
- }
- ;
-
-interface_accesors
- : opt_attributes GET SEMICOLON { $$ = 1; }
- | opt_attributes SET SEMICOLON { $$ = 2; }
- | opt_attributes GET SEMICOLON opt_attributes SET SEMICOLON
- { $$ = 3; }
- | opt_attributes SET SEMICOLON opt_attributes GET SEMICOLON
- { $$ = 3; }
- ;
-
-interface_event_declaration
- : opt_attributes opt_new EVENT type IDENTIFIER SEMICOLON
- {
- $$ = new InterfaceEvent ((TypeRef) $4, (string) $5, (bool) $2);
- }
- ;
-
-interface_indexer_declaration
- : opt_attributes opt_new type THIS
- OPEN_BRACKET formal_parameter_list CLOSE_BRACKET
- OPEN_BRACE
- { lexer.properties = true; }
- interface_accesors
- { lexer.properties = false; }
- CLOSE_BRACE
- {
- int a_flags = (int) $10;
-
- bool do_get = (a_flags & 1) == 1;
- bool do_set = (a_flags & 2) == 2;
-
- $$ = new InterfaceIndexer ((TypeRef) $3, (Parameters) $6, do_get, do_set, (bool) $2);
- }
- ;
-
-operator_declaration
- : opt_attributes opt_modifiers operator_declarator block
- {
- // FIXME: validate that opt_modifiers is exactly: PUBLIC and STATIC
- }
- ;
-
-operator_declarator
- : type OPERATOR overloadable_operator
- OPEN_PARENS type IDENTIFIER CLOSE_PARENS
- {
- // FIXME: since reduce/reduce on this
- // rule, validate overloadable_operator is unary
- }
- | type OPERATOR overloadable_operator
- OPEN_PARENS
- type IDENTIFIER COMMA
- type IDENTIFIER
- CLOSE_PARENS
- {
- // FIXME: because of the reduce/reduce on PLUS and MINUS
- // validate overloadable_operator is binary
- }
- | conversion_operator_declarator
- ;
-
-overloadable_operator
-// Unary operators:
- : BANG
- | TILDE
- | OP_INC
- | OP_DEC
- | TRUE
- | FALSE
-// Unary and binary:
- | PLUS
- | MINUS
-// Binary:
- | STAR
- | DIV
- | PERCENT
- | BITWISE_AND
- | BITWISE_OR
- | CARRET
- | OP_SHIFT_LEFT
- | OP_SHIFT_RIGHT
- | OP_EQ
- | OP_NE
- | OP_GT
- | OP_LT
- | OP_GE
- | OP_LE
- ;
-
-conversion_operator_declarator
- : IMPLICIT OPERATOR type OPEN_PARENS type IDENTIFIER CLOSE_PARENS
- | EXPLICIT OPERATOR type OPEN_PARENS type IDENTIFIER CLOSE_PARENS
- ;
-
-constructor_declaration
- : opt_attributes
- opt_modifiers
- constructor_declarator
- block
- {
- Constructor c = (Constructor) $3;
- c.Block = (Block) $4;
- c.ModFlags = (int) $2;
-
- if ((c.ModFlags & Modifiers.STATIC) != 0){
- if ((c.ModFlags & Modifiers.Accessibility) != 0){
- error (515, "Access modifiers are not allowed on static constructors");
- }
- }
- CheckDef (current_container.AddConstructor (c), c.Name);
-
- current_local_parameters = null;
- }
- ;
-
-constructor_declarator
- : IDENTIFIER
- OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
- opt_constructor_initializer
- {
- ConstructorInitializer i = null;
-
- if ($5 != null)
- i = (ConstructorInitializer) $5;
-
- $$ = new Constructor ((string) $1, (Parameters) $3, i);
-
- current_local_parameters = (Parameters) $3;
- }
- ;
-
-opt_constructor_initializer
- : /* empty */ { $$ = null; }
- | constructor_initializer
- ;
-
-constructor_initializer
- : COLON BASE OPEN_PARENS opt_argument_list CLOSE_PARENS
- {
- $$ = new ConstructorBaseInitializer ((ArrayList) $4);
- }
- | COLON THIS OPEN_PARENS opt_argument_list CLOSE_PARENS
- {
- $$ = new ConstructorThisInitializer ((ArrayList) $4);
- }
- ;
-
-destructor_declaration
- : opt_attributes TILDE IDENTIFIER OPEN_PARENS CLOSE_PARENS block
- {
- Method d = new Method (type ("void"), 0, "Finalize", new Parameters (null, null));
-
- d.Block = (Block) $6;
- CheckDef (current_container.AddMethod (d), d.Name);
- }
- ;
-
-event_declaration
- : opt_attributes
- opt_modifiers
- EVENT type variable_declarators SEMICOLON
- { note ("validate that the flags only contain new public protected internal private static virtual sealed override abstract"); }
- | opt_attributes
- opt_modifiers
- EVENT type member_name
- OPEN_BRACE event_accesor_declarations CLOSE_BRACE SEMICOLON
- { note ("validate that the flags only contain new public protected internal private static virtual sealed override abstract"); }
- ;
-
-event_accesor_declarations
- : add_accessor_declaration remove_accessor_declaration
- | remove_accessor_declaration add_accessor_declaration
- ;
-
-add_accessor_declaration
- : opt_attributes ADD block
- ;
-
-remove_accessor_declaration
- : opt_attributes REMOVE block
- ;
-
-indexer_declaration
- : opt_attributes opt_modifiers indexer_declarator
- OPEN_BRACE accessor_declarations CLOSE_BRACE
- {
- // The signature is computed from the signature of the indexer. Look
- // at section 3.6 on the spec
- note ("verify modifiers are NEW PUBLIC PROTECTED INTERNAL PRIVATE VIRTUAL SEALED OVERRIDE ABSTRACT");
- }
- ;
-
-indexer_declarator
- : type THIS OPEN_BRACKET formal_parameter_list CLOSE_BRACKET
- | type interface_type DOT THIS OPEN_BRACKET formal_parameter_list CLOSE_BRACKET
- ;
-
-enum_declaration
- : opt_attributes
- opt_modifiers
- ENUM IDENTIFIER
- opt_enum_base
- enum_body
- opt_semicolon
- {
- string name = (string) $4;
- Enum e = new Enum ((TypeRef) $5, (int) $2, name);
-
- foreach (VariableDeclaration ev in (ArrayList) $6){
- CheckDef (
- e.AddEnum (
- ev.identifier,
- (Expression) ev.expression_or_array_initializer),
- ev.identifier);
- }
-
- CheckDef (current_container.AddEnum (e), name);
- }
- ;
-
-opt_enum_base
- : /* empty */ { $$ = type ("System.Int32"); }
- | COLON integral_type { $$ = $2; }
- ;
-
-enum_body
- : OPEN_BRACE opt_enum_member_declarations CLOSE_BRACE
- {
- $$ = $2;
- }
- | OPEN_BRACE enum_member_declarations COMMA CLOSE_BRACE
- {
- $$ = $2;
- }
- ;
-
-opt_enum_member_declarations
- : /* empty */ { $$ = new ArrayList (); }
- | enum_member_declarations { $$ = $1; }
- ;
-
-enum_member_declarations
- : enum_member_declaration
- {
- ArrayList l = new ArrayList ();
-
- l.Add ($1);
- $$ = l;
- }
- | enum_member_declarations COMMA enum_member_declaration
- {
- ArrayList l = (ArrayList) $1;
-
- l.Add ($3);
-
- $$ = l;
- }
- ;
-
-enum_member_declaration
- : opt_attributes IDENTIFIER
- {
- $$ = new VariableDeclaration ((string) $2, null);
- }
- | opt_attributes IDENTIFIER ASSIGN expression
- {
- $$ = new VariableDeclaration ((string) $2, $4);
- }
- ;
-
-delegate_declaration
- : opt_attributes
- opt_modifiers
- DELEGATE type
- IDENTIFIER OPEN_PARENS
- formal_parameter_list
- CLOSE_PARENS
- SEMICOLON
- { note ("validate that modifiers only contains NEW PUBLIC PROTECTED INTERNAL PRIVATE"); }
- ;
-
-type_name
- : namespace_or_type_name
- ;
-
-namespace_or_type_name
- : qualified_identifier
- ;
-
-/*
- * Before you think of adding a return_type, notice that we have been
- * using two rules in the places where it matters (one rule using type
- * and another identical one that uses VOID as the return type). This
- * gets rid of a shift/reduce couple
- */
-type
- : type_name { /* class_type */
- /*
- This does interfaces, delegates, struct_types, class_types,
- parent classes, and more! 4.2
- */
- $$ = type ((string) $1);
- }
- | builtin_types
- | array_type
- ;
-
-type_list
- : type
- {
- ArrayList types = new ArrayList ();
-
- types.Add ($1);
- $$ = types;
- }
- | type_list type
- {
- ArrayList types = new ArrayList ();
- types.Add ($2);
- $$ = types;
- }
- ;
-
-/*
- * replaces all the productions for isolating the various
- * simple types, but we need this to reuse it easily in local_variable_type
- */
-builtin_types
- : OBJECT { $$ = type ("System.Object"); }
- | STRING { $$ = type ("System.String"); }
- | BOOL { $$ = type ("System.Boolean"); }
- | DECIMAL { $$ = type ("System.Decimal"); }
- | FLOAT { $$ = type ("System.Single"); }
- | DOUBLE { $$ = type ("System.Double"); }
- | integral_type
- ;
-
-integral_type
- : SBYTE { $$ = type ("System.SByte"); }
- | BYTE { $$ = type ("System.Byte"); }
- | SHORT { $$ = type ("System.Int16"); }
- | USHORT { $$ = type ("System.UInt16"); }
- | INT { $$ = type ("System.Int32"); }
- | UINT { $$ = type ("System.UInt32"); }
- | LONG { $$ = type ("System.Int64"); }
- | ULONG { $$ = type ("System.UInt64"); }
- | CHAR { $$ = type ("System.Char"); }
- ;
-
-interface_type
- : type_name
- ;
-
-array_type
- : type rank_specifiers
- {
- $$ = $1;
- // FIXME: We need to create a type for the nested thing.
- }
- ;
-
-//
-// Expressions, section 7.5
-//
-primary_expression
- : literal
- {
- // 7.5.1: Literals
-
- }
-
- | qualified_identifier
- {
- string name = (string) $1;
-
- $$ = null;
- if (name.IndexOf ('.') == -1){
- //
- // we need to check against current_block not being null
- // as `expression' is allowed in argument_lists, which
- // do not exist inside a block.
- //
- if (current_block != null){
- if (current_block.IsVariableDefined (name))
- $$ = new LocalVariableReference (current_block, name);
- }
- if (($$ == null) && (current_local_parameters != null)){
- Parameter par = current_local_parameters.GetParameterByName (name);
- if (par != null)
- $$ = new ParameterReference (current_local_parameters, name);
- }
- }
- if ($$ == null)
- $$ = new SimpleName (name);
- }
- | parenthesized_expression
- | member_access
- | invocation_expression
- | element_access
- | this_access
- | base_access
- | post_increment_expression
- | post_decrement_expression
- | new_expression
- | typeof_expression
- | sizeof_expression
- | checked_expression
- | unchecked_expression
- ;
-
-literal
- : boolean_literal
- | integer_literal
- | real_literal
- | LITERAL_CHARACTER { $$ = new CharLiteral ((char) lexer.Value); }
- | LITERAL_STRING { $$ = new StringLiteral ((string) lexer.Value); }
- | NULL { $$ = new NullLiteral (); }
- ;
-
-real_literal
- : LITERAL_FLOAT { $$ = new FloatLiteral ((float) lexer.Value); }
- | LITERAL_DOUBLE { $$ = new DoubleLiteral ((double) lexer.Value); }
- | LITERAL_DECIMAL { $$ = new DecimalLiteral ((decimal) lexer.Value); }
- ;
-
-integer_literal
- : LITERAL_INTEGER { $$ = new IntLiteral ((Int32) lexer.Value); }
- ;
-
-boolean_literal
- : TRUE { $$ = new BoolLiteral (true); }
- | FALSE { $$ = new BoolLiteral (false); }
- ;
-
-parenthesized_expression
- : OPEN_PARENS expression CLOSE_PARENS
- { $$ = $2; }
- ;
-
-member_access
- : primary_expression DOT IDENTIFIER
- {
- $$ = new MemberAccess ((Expression) $1, (string) $3);
- }
- | predefined_type DOT IDENTIFIER
- {
- $$ = new BuiltinTypeAccess ((TypeRef) $1, (string) $3);
- }
- ;
-
-predefined_type
- : builtin_types
- ;
-
-invocation_expression
- : primary_expression OPEN_PARENS opt_argument_list CLOSE_PARENS
- {
- // FIXME:
- // if $1 is MethodGroup
- // $$ = new Call ($1, $3);
- // else
- // $$ = new DelegateCall ($1, $3);
- if ($1 == null)
- error (1, "THIS IS CRAZY");
-
- $$ = new Invocation ((Expression) $1, (ArrayList) $3);
- }
- ;
-
-opt_argument_list
- : /* empty */ { $$ = new ArrayList (); }
- | argument_list
- ;
-
-argument_list
- : argument
- {
- ArrayList list = new ArrayList ();
- list.Add ($1);
- $$ = list;
- }
- | argument_list COMMA argument
- {
- ArrayList list = (ArrayList) $1;
- list.Add ($3);
- $$ = list;
- }
- ;
-
-argument
- : expression
- {
- $$ = new Argument ((Expression) $1, Argument.AType.Expression);
- }
- | REF variable_reference
- {
- $$ = new Argument ((Expression) $2, Argument.AType.Ref);
- }
- | OUT variable_reference
- {
- $$ = new Argument ((Expression) $2, Argument.AType.Out);
- }
- ;
-
-variable_reference
- : expression { note ("section 5.4"); $$ = $1; }
- ;
-
-element_access
- : primary_expression OPEN_BRACKET expression_list CLOSE_BRACKET
- // finishme
- ;
-
-expression_list
- : expression
- | expression_list COMMA expression
- ;
-
-this_access
- : THIS
- {
- $$ = new This ();
- }
- ;
-
-base_access
- : BASE DOT IDENTIFIER
- // finishme
- | BASE OPEN_BRACKET expression_list CLOSE_BRACKET
- // finishme
- ;
-
-post_increment_expression
- : primary_expression OP_INC
- {
- $$ = new Unary (Unary.Operator.PostIncrement, (Expression) $1);
- }
- ;
-
-post_decrement_expression
- : primary_expression OP_DEC
- {
- $$ = new Unary (Unary.Operator.PostDecrement, (Expression) $1);
- }
- ;
-
-new_expression
- : object_or_delegate_creation_expression
- | array_creation_expression
- ;
-
-object_or_delegate_creation_expression
- : NEW type OPEN_PARENS opt_argument_list CLOSE_PARENS
- {
- $$ = new New ((TypeRef) $2, (ArrayList) $4);
- }
- ;
-
-array_creation_expression
- : NEW type OPEN_BRACKET expression_list CLOSE_BRACKET
- opt_rank_specifier
- opt_array_initializer
- // finishme
- ;
-
-opt_rank_specifier
- : /* empty */
- | rank_specifiers
- ;
-
-rank_specifiers
- : rank_specifier
- | rank_specifiers rank_specifier
- // finishme
- ;
-
-rank_specifier
- : OPEN_BRACKET opt_dim_separators CLOSE_BRACKET
- // finishme
- ;
-
-opt_dim_separators
- : /* empty */
- | dim_separators
- // finishme
- ;
-
-dim_separators
- : COMMA
- | dim_separators COMMA
- // finishme
- ;
-
-opt_array_initializer
- : /* empty */
- | array_initializer
- ;
-
-array_initializer
- : OPEN_BRACE CLOSE_BRACE
- | OPEN_BRACE variable_initializer_list CLOSE_BRACE
- | OPEN_BRACE variable_initializer_list COMMA CLOSE_BRACE
- // finishme
- ;
-
-variable_initializer_list
- : variable_initializer
- | variable_initializer_list COMMA variable_initializer
- // finishme
- ;
-
-typeof_expression
- : TYPEOF OPEN_PARENS type CLOSE_PARENS
- {
- $$ = new TypeOf ((TypeRef) $3);
- }
- ;
-
-sizeof_expression
- : SIZEOF OPEN_PARENS type CLOSE_PARENS {
- $$ = new SizeOf ((TypeRef) $3);
-
- note ("Verify type is unmanaged");
- note ("if (5.8) builtin, yield constant expression");
- }
- ;
-
-checked_expression
- : CHECKED OPEN_PARENS expression CLOSE_PARENS
- ;
-
-unchecked_expression
- : UNCHECKED OPEN_PARENS expression CLOSE_PARENS
- ;
-
-unary_expression
- : primary_expression
- | PLUS unary_expression {
- $$ = new Unary (Unary.Operator.Plus, (Expression) $2);
- }
- | MINUS unary_expression
- {
- $$ = new Unary (Unary.Operator.Minus, (Expression) $2);
- }
- | BANG unary_expression
- {
- $$ = new Unary (Unary.Operator.Negate, (Expression) $2);
- }
- | TILDE unary_expression
- {
- $$ = new Unary (Unary.Operator.BitComplement, (Expression) $2);
- }
- | STAR unary_expression
- {
- $$ = new Unary (Unary.Operator.Indirection, (Expression) $2);
- }
- | BITWISE_AND unary_expression
- {
- $$ = new Unary (Unary.Operator.AddressOf, (Expression) $2);
- }
- | pre_increment_expression
- | pre_decrement_expression
- | cast_expression
- /*
- we can not do cast expressions at this level,
- as there is an ambiguity. Check "Cast Expressions" 7.6.8
- for the recipe to handle this.
- */
- ;
-
-pre_increment_expression
- : OP_INC unary_expression
- {
- $$ = new Unary (Unary.Operator.PreIncrement, (Expression) $2);
- }
- ;
-
-pre_decrement_expression
- : OP_DEC unary_expression
- {
- $$ = new Unary (Unary.Operator.PreDecrement, (Expression) $2);
- }
- ;
-
-cast_expression
- /* FIXME: This is actually wrong, it should be `type' but that
- * introduces a lot of {shift,reduce}/reduces
- */
- : OPEN_PARENS qualified_identifier CLOSE_PARENS unary_expression
- {
- $$ = new Cast (type ((string) $2), (Expression) $4);
- }
- | OPEN_PARENS builtin_types CLOSE_PARENS unary_expression
- {
- $$ = new Cast ((TypeRef) $2, (Expression) $4);
- }
- ;
-
-multiplicative_expression
- : unary_expression
- | multiplicative_expression STAR unary_expression
- {
- $$ = new Binary (Binary.Operator.Multiply,
- (Expression) $1, (Expression) $3);
- }
- | multiplicative_expression DIV unary_expression
- {
- $$ = new Binary (Binary.Operator.Divide,
- (Expression) $1, (Expression) $3);
- }
- | multiplicative_expression PERCENT unary_expression
- {
- $$ = new Binary (Binary.Operator.Modulo,
- (Expression) $1, (Expression) $3);
- }
- ;
-
-additive_expression
- : multiplicative_expression
- | additive_expression PLUS multiplicative_expression
- {
- $$ = new Binary (Binary.Operator.Add,
- (Expression) $1, (Expression) $3);
- }
- | additive_expression MINUS multiplicative_expression
- {
- $$ = new Binary (Binary.Operator.Substract,
- (Expression) $1, (Expression) $3);
- }
- ;
-
-shift_expression
- : additive_expression
- | shift_expression OP_SHIFT_LEFT additive_expression
- {
- $$ = new Binary (Binary.Operator.ShiftLeft,
- (Expression) $1, (Expression) $3);
- }
- | shift_expression OP_SHIFT_RIGHT additive_expression
- {
- $$ = new Binary (Binary.Operator.ShiftRight,
- (Expression) $1, (Expression) $3);
- }
- ;
-
-relational_expression
- : shift_expression
- | relational_expression OP_LT shift_expression
- {
- $$ = new Binary (Binary.Operator.LessThan,
- (Expression) $1, (Expression) $3);
- }
- | relational_expression OP_GT shift_expression
- {
- $$ = new Binary (Binary.Operator.GreatherThan,
- (Expression) $1, (Expression) $3);
- }
- | relational_expression OP_LE shift_expression
- {
- $$ = new Binary (Binary.Operator.LessOrEqual,
- (Expression) $1, (Expression) $3);
- }
- | relational_expression OP_GE shift_expression
- {
- $$ = new Binary (Binary.Operator.GreatherOrEqual,
- (Expression) $1, (Expression) $3);
- }
- | relational_expression IS type
- {
- $$ = new Probe (Probe.Operator.Is,
- (Expression) $1, (TypeRef) $3);
- }
- | relational_expression AS type
- {
- $$ = new Probe (Probe.Operator.As,
- (Expression) $1, (TypeRef) $3);
- }
- ;
-
-equality_expression
- : relational_expression
- | equality_expression OP_EQ relational_expression
- {
- $$ = new Binary (Binary.Operator.Equal,
- (Expression) $1, (Expression) $3);
- }
- | equality_expression OP_NE relational_expression
- {
- $$ = new Binary (Binary.Operator.NotEqual,
- (Expression) $1, (Expression) $3);
- }
- ;
-
-and_expression
- : equality_expression
- | and_expression BITWISE_AND equality_expression
- {
- $$ = new Binary (Binary.Operator.BitwiseAnd,
- (Expression) $1, (Expression) $3);
- }
- ;
-
-exclusive_or_expression
- : and_expression
- | exclusive_or_expression CARRET and_expression
- {
- $$ = new Binary (Binary.Operator.ExclusiveOr,
- (Expression) $1, (Expression) $3);
- }
- ;
-
-inclusive_or_expression
- : exclusive_or_expression
- | inclusive_or_expression BITWISE_OR exclusive_or_expression
- {
- $$ = new Binary (Binary.Operator.BitwiseOr,
- (Expression) $1, (Expression) $3);
- }
- ;
-
-conditional_and_expression
- : inclusive_or_expression
- | conditional_and_expression OP_AND inclusive_or_expression
- {
- $$ = new Binary (Binary.Operator.LogicalAnd,
- (Expression) $1, (Expression) $3);
- }
- ;
-
-conditional_or_expression
- : conditional_and_expression
- | conditional_or_expression OP_OR conditional_and_expression
- {
- $$ = new Binary (Binary.Operator.LogicalOr,
- (Expression) $1, (Expression) $3);
- }
- ;
-
-conditional_expression
- : conditional_or_expression
- | conditional_or_expression INTERR expression COLON expression
- {
- $$ = new Conditional ((Expression) $1, (Expression) $3, (Expression) $5);
- }
- ;
-
-assignment_expression
- : unary_expression ASSIGN expression
- {
- $$ = new Assign ((Expression) $1, (Expression) $3);
- }
- | unary_expression OP_MULT_ASSIGN expression
- {
- $$ = new Assign ((Expression) $1,
- new Binary (Binary.Operator.Multiply,
- (Expression) $1,
- (Expression) $3));
- }
- | unary_expression OP_DIV_ASSIGN expression
- {
- $$ = new Assign ((Expression) $1,
- new Binary (Binary.Operator.Divide,
- (Expression) $1,
- (Expression) $3));
- }
- | unary_expression OP_MOD_ASSIGN expression
- {
- $$ = new Assign ((Expression) $1,
- new Binary (Binary.Operator.Modulo,
- (Expression) $1,
- (Expression) $3));
- }
- | unary_expression OP_ADD_ASSIGN expression
- {
- $$ = new Assign ((Expression) $1,
- new Binary (Binary.Operator.Add,
- (Expression) $1,
- (Expression) $3));
- }
- | unary_expression OP_SUB_ASSIGN expression
- {
- $$ = new Assign ((Expression) $1,
- new Binary (Binary.Operator.Substract,
- (Expression) $1,
- (Expression) $3));
- }
- | unary_expression OP_SHIFT_LEFT_ASSIGN expression
- {
- $$ = new Assign ((Expression) $1,
- new Binary (Binary.Operator.ShiftLeft,
- (Expression) $1,
- (Expression) $3));
- }
- | unary_expression OP_SHIFT_RIGHT_ASSIGN expression
- {
- $$ = new Assign ((Expression) $1,
- new Binary (Binary.Operator.ShiftRight,
- (Expression) $1,
- (Expression) $3));
- }
- | unary_expression OP_AND_ASSIGN expression
- {
- $$ = new Assign ((Expression) $1,
- new Binary (Binary.Operator.BitwiseAnd,
- (Expression) $1,
- (Expression) $3));
- }
- | unary_expression OP_OR_ASSIGN expression
- {
- $$ = new Assign ((Expression) $1,
- new Binary (Binary.Operator.BitwiseOr,
- (Expression) $1,
- (Expression) $3));
- }
- | unary_expression OP_XOR_ASSIGN expression
- {
- $$ = new Assign ((Expression) $1,
- new Binary (Binary.Operator.ExclusiveOr,
- (Expression) $1,
- (Expression) $3));
- }
- ;
-
-expression
- : conditional_expression
- | assignment_expression
- ;
-
-constant_expression
- : expression
- ;
-
-boolean_expression
- : expression { CheckBoolean ((Expression) $1); $$ = $1; }
- ;
-
-//
-// 10 classes
-//
-class_declaration
- : opt_attributes
- opt_modifiers
- CLASS IDENTIFIER
- {
- Class new_class;
- string full_class_name = MakeName ((string) $4);
-
- new_class = new Class (current_container, full_class_name, (int) $2);
- current_container = new_class;
- current_container.Namespace = current_namespace;
- tree.RecordType (full_class_name, new_class);
- }
- opt_class_base
- class_body
- opt_semicolon
- {
- Class new_class = (Class) current_container;
-
- if ($6 != null)
- new_class.Bases = (ArrayList) $6;
-
- current_container = current_container.Parent;
- CheckDef (current_container.AddClass (new_class), new_class.Name);
-
- $$ = new_class;
- }
- ;
-
-opt_modifiers
- : /* empty */ { $$ = (int) 0; }
- | modifiers
- ;
-
-modifiers
- : modifier
- | modifiers modifier {
- int m1 = (int) $1;
- int m2 = (int) $2;
-
- if ((m1 & m2) != 0)
- error (1002, "Duplicate modifier: `" + Modifiers.Name (m2) + "'");
-
- $$ = (int) (m1 | m2);
- }
- ;
-
-modifier
- : NEW { $$ = Modifiers.NEW; }
- | PUBLIC { $$ = Modifiers.PUBLIC; }
- | PROTECTED { $$ = Modifiers.PROTECTED; }
- | INTERNAL { $$ = Modifiers.INTERNAL; }
- | PRIVATE { $$ = Modifiers.PRIVATE; }
- | ABSTRACT { $$ = Modifiers.ABSTRACT; }
- | SEALED { $$ = Modifiers.SEALED; }
- | STATIC { $$ = Modifiers.STATIC; }
- | READONLY { $$ = Modifiers.READONLY; }
- | VIRTUAL { $$ = Modifiers.VIRTUAL; }
- | OVERRIDE { $$ = Modifiers.OVERRIDE; }
- | EXTERN { $$ = Modifiers.EXTERN; }
- ;
-
-opt_class_base
- : /* empty */ { $$ = null; }
- | class_base { $$ = $1; }
- ;
-
-class_base
- : COLON type_list { $$ = $2; }
- ;
-
-//
-// Statements (8.2)
-//
-
-//
-// A block is "contained" on the following places:
-// method_body
-// property_declaration as part of the accessor body (get/set)
-// operator_declaration
-// constructor_declaration
-// destructor_declaration
-// event_declaration as part of add_accessor_declaration or remove_accessor_declaration
-//
-block
- : OPEN_BRACE
- {
- current_block = new Block (current_block);
- }
- opt_statement_list CLOSE_BRACE
- {
- while (current_block.Implicit)
- current_block = current_block.Parent;
- $$ = current_block;
- current_block = current_block.Parent;
- }
- ;
-
-opt_statement_list
- : /* empty */
- | statement_list
- ;
-
-statement_list
- : statement
- | statement_list statement
- ;
-
-statement
- : declaration_statement
- {
- if ((Block) $1 != current_block){
- current_block.AddStatement ((Statement) $1);
- current_block = (Block) $1;
- }
- }
- | embedded_statement
- {
- current_block.AddStatement ((Statement) $1);
- }
- | labeled_statement
- {
- current_block.AddStatement ((Statement) $1);
- }
- ;
-
-embedded_statement
- : block
- | empty_statement
- | expression_statement
- | selection_statement
- | iteration_statement
- | jump_statement
- | try_statement
- | checked_statement
- | unchecked_statement
- | lock_statement
- | using_statement
- ;
-
-empty_statement
- : SEMICOLON
- {
- $$ = new EmptyStatement ();
- }
- ;
-
-labeled_statement
- : IDENTIFIER COLON statement
- {
- string lab = (String) $1;
- Block block;
-
- block = new Block (current_block, lab);
- block.AddStatement ((Statement) $3);
- $$ = block;
-
- if (!current_block.AddLabel (lab, block)){
- error (140, "The label '" + lab + "' is a duplicate");
- $$ = $3;
- }
- }
- ;
-
-declaration_statement
- : local_variable_declaration SEMICOLON // done
- | local_constant_declaration SEMICOLON // finishme
- ;
-
-/*
- * The following is from Rhys' grammar:
- * > Types in local variable declarations must be recognized as
- * > expressions to prevent reduce/reduce errors in the grammar.
- * > The expressions are converted into types during semantic analysis.
- */
-local_variable_type
- : primary_expression type_suffixes
- {
- // FIXME: Do something smart here regarding the composition of the 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
- // really) two shift/reduces appear.
- //
- // So, instead we do a super trick: we just allow ($1) to be a
- // SimpleName Expression.
- //
- if (((Expression) $1) is SimpleName)
- $$ = type (((SimpleName) $1).Name);
- else {
- error (-1, "Invalid Type definition");
- $$ = type ("object");
- }
- }
- | builtin_types type_suffixes
- {
- // FIXME: Do something smart with the type here.
- $$ = $1;
- }
- | VOID type_suffixes
- {
- $$ = type ("VOID SOMETHING TYPE");
- }
- ;
-
-type_suffixes
- : /* empty */
- | type_suffix_list
- ;
-
-type_suffix_list
- : type_suffix
- | type_suffix_list type_suffix
- ;
-
-type_suffix
- : OPEN_BRACKET opt_dim_separators CLOSE_BRACKET
- /* FIXME: | MULTIPLY */
- ;
-
-local_variable_declaration
- : local_variable_type variable_declarators
- {
- $$ = declare_local_variables ((TypeRef) $1, (ArrayList) $2);
- }
- ;
-
-local_constant_declaration
- : CONST type constant_declarator
- // finishme
- ;
-
-expression_statement
- : statement_expression SEMICOLON
- {
- $$ = $1;
- }
- ;
-
- //
- // We have to do the wrapping here and not in the case above,
- // because statement_expression is used for example in for_statement
- //
-statement_expression
- : invocation_expression { $$ = new StatementExpression ((Expression) $1); }
- | object_creation_expression { $$ = new StatementExpression ((Expression) $1); }
- | assignment_expression { $$ = new StatementExpression ((Expression) $1); }
- | post_increment_expression { $$ = new StatementExpression ((Expression) $1); }
- | post_decrement_expression { $$ = new StatementExpression ((Expression) $1); }
- | pre_increment_expression { $$ = new StatementExpression ((Expression) $1); }
- | pre_decrement_expression { $$ = new StatementExpression ((Expression) $1); }
- ;
-
-object_creation_expression
- : object_or_delegate_creation_expression
- { note ("complain if this is a delegate maybe?"); }
- ;
-
-selection_statement
- : if_statement
- | switch_statement
- ;
-
-if_statement
- : IF OPEN_PARENS boolean_expression CLOSE_PARENS
- embedded_statement
- {
- $$ = new If ((Expression) $3, (Statement) $5);
- }
- | IF OPEN_PARENS boolean_expression CLOSE_PARENS
- embedded_statement ELSE embedded_statement
- {
- $$ = new If ((Expression) $3, (Statement) $5, (Statement) $7);
- }
- ;
-
-switch_statement
- : SWITCH OPEN_PARENS expression CLOSE_PARENS
- switch_block
- {
- $$ = new Switch ((Expression) $3, (ArrayList) $5);
- }
- ;
-
-switch_block
- : OPEN_BRACE
- opt_switch_sections
- CLOSE_BRACE
- {
- $$ = $2;
- }
- ;
-
-opt_switch_sections
- : /* empty */ { $$ = new ArrayList (); }
- | switch_sections
- ;
-
-switch_sections
- : switch_section
- {
- ArrayList sections = new ArrayList ();
-
- sections.Add ($1);
- $$ = sections;
- }
- | switch_sections switch_section
- {
- ArrayList sections = (ArrayList) $1;
-
- sections.Add ($2);
- $$ = sections;
- }
- ;
-
-switch_section
- : switch_labels
- {
- current_block = new Block (current_block);
- }
- statement_list
- {
- while (current_block.Implicit)
- current_block = current_block.Parent;
- $$ = new SwitchSection ((ArrayList) $1, current_block);
- current_block = current_block.Parent;
- }
- ;
-
-switch_labels
- : switch_label
- {
- ArrayList labels = new ArrayList ();
-
- labels.Add ($1);
- $$ = labels;
- }
- | switch_labels switch_label
- {
- ArrayList labels = (ArrayList) ($1);
- labels.Add ($2);
-
- $$ = labels;
- }
- ;
-
-switch_label
- : CASE constant_expression COLON { $$ = new SwitchLabel ((Expression) $2); }
- | DEFAULT COLON { $$ = new SwitchLabel (null); }
- ;
-
-iteration_statement
- : while_statement
- | do_statement
- | for_statement
- | foreach_statement
- ;
-
-while_statement
- : WHILE OPEN_PARENS boolean_expression CLOSE_PARENS embedded_statement
- {
- $$ = new While ((Expression) $3, (Statement) $5);
- }
- ;
-
-do_statement
- : DO embedded_statement
- WHILE OPEN_PARENS boolean_expression CLOSE_PARENS SEMICOLON
- {
- $$ = new Do ((Statement) $2, (Expression) $5);
- }
- ;
-
-for_statement
- : FOR OPEN_PARENS
- opt_for_initializer SEMICOLON
- opt_for_condition SEMICOLON
- opt_for_iterator CLOSE_PARENS
- embedded_statement
- {
- $$ = new For ((Statement) $3, (Expression) $5, (Statement) $7, (Statement) $9);
- }
- ;
-
-opt_for_initializer
- : /* empty */ { $$ = new EmptyStatement (); }
- | for_initializer
- ;
-
-for_initializer
- : local_variable_declaration
- | statement_expression_list
- ;
-
-opt_for_condition
- : /* empty */ { $$ = new BoolLiteral (true); }
- | boolean_expression
- ;
-
-opt_for_iterator
- : /* empty */ { $$ = new EmptyStatement (); }
- | for_iterator
- ;
-
-for_iterator
- : statement_expression_list
- ;
-
-statement_expression_list
- : statement_expression
- {
- Block b = new Block (null, true);
-
- b.AddStatement ((Statement) $1);
- $$ = b;
- }
- | statement_expression_list COMMA statement_expression
- {
- Block b = (Block) $1;
-
- b.AddStatement ((Statement) $3);
- $$ = $1;
- }
- ;
-
-foreach_statement
- : FOREACH OPEN_PARENS type IDENTIFIER IN expression CLOSE_PARENS
- embedded_statement
- {
- string temp_id = current_block.MakeInternalID ();
- Expression assign_e, ma;
- Statement getcurrent;
- Block foreach_block, child_block;
-
- foreach_block = new Block (current_block, true);
-
- foreach_block.AddVariable (type ("IEnumerator"), temp_id);
- foreach_block.AddVariable ((TypeRef) $3, (string) $4);
- assign_e = new Assign (new LocalVariableReference (foreach_block, temp_id),
- new Invocation (
- new MemberAccess ((Expression) $6, "GetEnumerator"), null));
- current_block.AddStatement (new StatementExpression (assign_e));
- ma = new MemberAccess (new LocalVariableReference (foreach_block, temp_id), "MoveNext");
- child_block = new Block (current_block);
-
- getcurrent = new StatementExpression (
- new Assign (
- new LocalVariableReference (foreach_block, (string) $4),
- new Cast (
- (TypeRef) $3,
- new MemberAccess (
- new LocalVariableReference (foreach_block, temp_id), "Current"))));
-
- child_block.AddStatement (getcurrent);
- child_block.AddStatement ((Statement) $8);
- foreach_block.AddStatement (new While (ma, (Statement) child_block));
-
- $$ = foreach_block;
- }
- ;
-
-jump_statement
- : break_statement
- | continue_statement
- | goto_statement
- | return_statement
- | throw_statement
- ;
-
-break_statement
- : BREAK SEMICOLON
- {
- $$ = new Break ();
- }
- ;
-
-continue_statement
- : CONTINUE SEMICOLON
- {
- $$ = new Continue ();
- }
- ;
-
-goto_statement
- : GOTO IDENTIFIER SEMICOLON
- {
- $$ = new Goto ((string) $2);
- }
- | GOTO CASE constant_expression SEMICOLON
- | GOTO DEFAULT SEMICOLON
- ;
-
-return_statement
- : RETURN opt_expression SEMICOLON
- {
- $$ = new Return ((Expression) $2);
- }
- ;
-
-throw_statement
- : THROW opt_expression SEMICOLON
- {
- $$ = new Throw ((Expression) $2);
- }
- ;
-
-opt_expression
- : /* empty */
- | expression
- ;
-
-try_statement
- : TRY block catch_clauses
- {
- DictionaryEntry cc = (DictionaryEntry) $3;
- ArrayList s = null;
-
- if (cc.Key != null)
- s = (ArrayList) cc.Key;
-
- $$ = new Try ((Block) $2, s, (Catch) cc.Value, null);
- }
- | TRY block finalize_clause
- {
- $$ = new Try ((Block) $2, null, null, (Block) $3);
- }
- | TRY block catch_clauses finalize_clause
- {
- DictionaryEntry cc = (DictionaryEntry) $3;
- ArrayList s = null;
-
- if (cc.Key != null)
- s = (ArrayList) cc.Key;
-
- $$ = new Try ((Block) $2, s, (Catch) cc.Value, (Block) $4);
- }
- ;
-
-catch_clauses
- : specific_catch_clauses opt_general_catch_clause
- {
- DictionaryEntry pair = new DictionaryEntry ();
-
- pair.Key = $1;
- pair.Value = $2;
-
- $$ = pair;
- }
- | opt_specific_catch_clauses general_catch_clause
- {
- DictionaryEntry pair = new DictionaryEntry ();
- pair.Key = $1;
- pair.Value = $1;
-
- $$ = pair;
- }
- ;
-
-opt_general_catch_clause
- : /* empty */ { $$ = null; }
- | general_catch_clause
- ;
-
-opt_specific_catch_clauses
- : /* emtpy */ { $$ = null; }
- | specific_catch_clauses
- ;
-
-specific_catch_clauses
- : specific_catch_clause
- {
- ArrayList l = new ArrayList ();
-
- l.Add ($1);
- $$ = l;
- }
- | specific_catch_clauses specific_catch_clause
- {
- ArrayList l = (ArrayList) $1;
-
- l.Add ($2);
- $$ = l;
- }
- ;
-
-specific_catch_clause
- : CATCH OPEN_PARENS type opt_identifier CLOSE_PARENS block
- {
- string id = null;
-
- if ($4 != null)
- id = (string) $4;
-
- $$ = new Catch ((TypeRef) $3, id, (Block) $6);
- }
- ;
-
-opt_identifier
- : /* empty */ { $$ = null; }
- | IDENTIFIER
- ;
-
-general_catch_clause
- : CATCH block
- {
- $$ = new Catch (null, null, (Block) $2);
- }
- ;
-
-finalize_clause
- : FINALLY block
- {
- $$ = $2;
- }
- ;
-
-checked_statement
- : CHECKED block
- {
- $$ = new Checked ((Block) $2);
- }
- ;
-
-unchecked_statement
- : UNCHECKED block
- {
- $$ = new Unchecked ((Block) $2);
- }
- ;
-
-lock_statement
- : LOCK OPEN_PARENS expression CLOSE_PARENS embedded_statement
- {
- $$ = new Lock ((Expression) $3, (Statement) $5);
- }
- ;
-
-using_statement
- : USING OPEN_PARENS resource_acquisition CLOSE_PARENS embedded_statement
- // finishme
- ;
-
-resource_acquisition
- : local_variable_declaration
- expression
- // finishme
- ;
-
-%%
-
-// <summary>
-// A class used to pass around variable declarations and constants
-// </summary>
-public class VariableDeclaration {
- public string identifier;
- public object expression_or_array_initializer;
-
- public VariableDeclaration (string id, object eoai){
- this.identifier = id;
- this.expression_or_array_initializer = eoai;
- }
-}
-
-// <summary>
-// Given the @class_name name, it creates a fully qualified name
-// based on the containing declaration space
-// </summary>
-string
-MakeName (string class_name)
-{
- string ns = current_namespace.Name;
- string container_name = current_container.Name;
-
- if (container_name == ""){
- if (ns != "")
- return ns + "." + class_name;
- else
- return class_name;
- } else
- return container_name + "." + class_name;
-}
-
-// <summary>
-// Used to report back to the user the result of a declaration
-// in the current declaration space
-// </summary>
-void
-CheckDef (DeclSpace.AdditionResult result, string name)
-{
- if (result == DeclSpace.AdditionResult.Success)
- return;
-
- switch (result){
- case DeclSpace.AdditionResult.NameExists:
- error (102, "The namespace `" + current_container.Name +
- "' already contains a definition for `"+
- name + "'");
- break;
-
-/*
- NEED TO HANDLE THIS IN SEMANTIC ANALYSIS:
-
- case DeclSpace.AdditionResult.MethodDuplicated:
- error (111, "Class `"+current_container.Name+
- "' already defines a member called '" +
- name + "' with the same parameter types");
- break;
-*/
- case DeclSpace.AdditionResult.EnclosingClash:
- error (542, "Member names cannot be the same as their enclosing type");
- break;
-
- case DeclSpace.AdditionResult.NotAConstructor:
- error (1520, "Class, struct, or interface method must have a return type");
- break;
- }
-}
-
-void
-CheckDef (bool result, string name)
-{
- if (result)
- return;
- CheckDef (DeclSpace.AdditionResult.NameExists, name);
-}
-
-Block declare_local_variables (TypeRef typeref, ArrayList variable_declarators)
-{
- Block implicit_block;
- ArrayList inits = null;
-
- //
- // We use the `Used' property to check whether statements
- // have been added to the current block. If so, we need
- // to create another block to contain the new declaration
- // otherwise, as an optimization, we use the same block to
- // add the declaration.
- //
- // FIXME: A further optimization is to check if the statements
- // that were added were added as part of the initialization
- // below. In which case, no other statements have been executed
- // and we might be able to reduce the number of blocks for
- // situations like this:
- //
- // int j = 1; int k = j + 1;
- //
- if (current_block.Used)
- implicit_block = new Block (current_block, true);
- else
- implicit_block = new Block (current_block, true);
-
- foreach (VariableDeclaration decl in variable_declarators){
- if (implicit_block.AddVariable (typeref, decl.identifier)){
- if (decl.expression_or_array_initializer != null){
- if (inits == null)
- inits = new ArrayList ();
- inits.Add (decl);
- }
- } else {
- error (128, "A local variable `" + decl.identifier +
- "' is already defined in this scope");
- }
- }
-
- if (inits == null)
- return implicit_block;
-
- foreach (VariableDeclaration decl in inits){
- if (decl.expression_or_array_initializer is Expression){
- Expression expr = (Expression) decl.expression_or_array_initializer;
- Assign assign;
-
- assign = new Assign (new LocalVariableReference (implicit_block, decl.identifier), expr);
- implicit_block.AddStatement (new StatementExpression (assign));
- } else {
- }
- }
-
- return implicit_block;
-}
-
-void CheckConstant (Expression expr)
-{
- // finishme
-}
-
-void CheckBoolean (Expression expr)
-{
- // finishme
-}
-
-static public void error (int code, string desc)
-{
- Console.WriteLine ("Error CS"+code+": "+desc);
- global_errors++;
-}
-
-void output (string s)
-{
- Console.WriteLine (s);
-}
-
-void note (string s)
-{
- // Used to put annotations
-}
-
-TypeRef type (string type_name)
-{
- return type_references.GetTypeRef (current_container, type_name);
-}
-
-Tokenizer lexer;
-
-public CSharpParser(CIR.Tree tree, string name, System.IO.Stream input)
- : base (tree, name, input)
-{
- current_namespace = new Namespace (null, "");
- this.tree = tree;
- current_container = tree.Types;
- current_container.Namespace = current_namespace;
-
- lexer = new Tokenizer (input, name);
- type_references = tree.TypeRefManager;
-}
-
-public override int parse ()
-{
- StringBuilder value = new StringBuilder ();
-
- global_errors = 0;
- try {
- if (yacc_verbose_flag)
- yyparse (lexer, new yydebug.yyDebugSimple ());
- else
- yyparse (lexer);
- } catch (Exception e){
- Console.WriteLine ("Fatal error: "+name);
- Console.WriteLine (e);
- Console.WriteLine (lexer.location);
- global_errors++;
- }
-
- return global_errors;
-}
-
-bool yacc_verbose_flag = false;
-
-public bool yacc_verbose {
- set {
- yacc_verbose_flag = value;
- }
-
- get {
- return yacc_verbose_flag;
- }
-}
-
-/* end end end */
-}
-}
-
+%{
+//
+// OPTIMIZATION:
+// This loop is pointless:
+// while (current_block != prev_block)
+// current_block = current_block.Parent;
+//
+// cs-parser.jay: The Parser for the C# compiler
+//
+// Author: Miguel de Icaza (miguel@gnu.org)
+// Ravi Pratap (ravi@ximian.com)
+//
+// Licensed under the terms of the GNU GPL
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+// TODO:
+// (1) Get rid of the *Collections.cs, that is an idea I took from System.CodeDOM
+// And come to think of it, it is not that great, it duplicates a lot of code
+// for something which is not really needed. We still have piles of typecasts
+// anwyays (due to the nature of the stack being a collection of Objects).
+//
+// (2) Figure out why error productions dont work. `type-declaration' is a
+// great spot to put an `error' because you can reproduce it with this input:
+// "public X { }"
+//
+// (3) Move Modifier checking from each object into the parser itself, that will
+// get rid of the global "error" symbol that we use now to report errors.
+// We still need to pass a pointer to the tree.ErrorHandler, but that is a
+// separate problem
+//
+using System.Text;
+using System;
+
+namespace Mono.CSharp
+{
+ using System.Collections;
+ using Mono.Languages;
+
+ /// <summary>
+ /// The C# Parser
+ /// </summary>
+ public class CSharpParser : GenericParser {
+ Namespace current_namespace;
+ TypeContainer current_container;
+
+ // <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>
+ Interface current_interface;
+
+ // <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>
+ string 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>
+ bool parsing_indexer;
+
+ //
+ // An out-of-band stack.
+ //
+ Stack oob_stack;
+%}
+
+%token EOF
+%token NONE /* This token is never returned by our lexer */
+%token ERROR // This is used not by the parser, but by the tokenizer.
+ // do not remove.
+
+/*
+ *These are the C# keywords
+ */
+%token ABSTRACT
+%token AS
+%token ADD
+%token ASSEMBLY
+%token BASE
+%token BOOL
+%token BREAK
+%token BYTE
+%token CASE
+%token CATCH
+%token CHAR
+%token CHECKED
+%token CLASS
+%token CONST
+%token CONTINUE
+%token DECIMAL
+%token DEFAULT
+%token DELEGATE
+%token DO
+%token DOUBLE
+%token ELSE
+%token ENUM
+%token EVENT
+%token EXPLICIT
+%token EXTERN
+%token FALSE
+%token FINALLY
+%token FIXED
+%token FLOAT
+%token FOR
+%token FOREACH
+%token GOTO
+%token IF
+%token IMPLICIT
+%token IN
+%token INT
+%token INTERFACE
+%token INTERNAL
+%token IS
+%token LOCK
+%token LONG
+%token NAMESPACE
+%token NEW
+%token NULL
+%token OBJECT
+%token OPERATOR
+%token OUT
+%token OVERRIDE
+%token PARAMS
+%token PRIVATE
+%token PROTECTED
+%token PUBLIC
+%token READONLY
+%token REF
+%token RETURN
+%token REMOVE
+%token SBYTE
+%token SEALED
+%token SHORT
+%token SIZEOF
+%token STACKALLOC
+%token STATIC
+%token STRING
+%token STRUCT
+%token SWITCH
+%token THIS
+%token THROW
+%token TRUE
+%token TRY
+%token TYPEOF
+%token UINT
+%token ULONG
+%token UNCHECKED
+%token UNSAFE
+%token USHORT
+%token USING
+%token VIRTUAL
+%token VOID
+%token VOLATILE
+%token WHILE
+
+/* C# keywords which are not really keywords */
+%token GET "get"
+%token SET "set"
+
+/* C# single character operators/punctuation. */
+%token OPEN_BRACE "{"
+%token CLOSE_BRACE "}"
+%token OPEN_BRACKET "["
+%token CLOSE_BRACKET "]"
+%token OPEN_PARENS "("
+%token CLOSE_PARENS ")"
+%token DOT "."
+%token COMMA ","
+%token COLON ":"
+%token SEMICOLON ";"
+%token TILDE "~"
+
+%token PLUS "+"
+%token MINUS "-"
+%token BANG "!"
+%token ASSIGN "="
+%token OP_LT "<"
+%token OP_GT ">"
+%token BITWISE_AND "&"
+%token BITWISE_OR "|"
+%token STAR "*"
+%token PERCENT "%"
+%token DIV "/"
+%token CARRET "^"
+%token INTERR "?"
+
+/* C# multi-character operators. */
+%token OP_INC "++"
+%token OP_DEC "--"
+%token OP_SHIFT_LEFT "<<"
+%token OP_SHIFT_RIGHT ">>"
+%token OP_LE "<="
+%token OP_GE ">="
+%token OP_EQ "=="
+%token OP_NE "!="
+%token OP_AND "&&"
+%token OP_OR "||"
+%token OP_MULT_ASSIGN "*="
+%token OP_DIV_ASSIGN "/="
+%token OP_MOD_ASSIGN "%="
+%token OP_ADD_ASSIGN "+="
+%token OP_SUB_ASSIGN "-="
+%token OP_SHIFT_LEFT_ASSIGN "<<="
+%token OP_SHIFT_RIGHT_ASSIGN ">>="
+%token OP_AND_ASSIGN "&="
+%token OP_XOR_ASSIGN "^="
+%token OP_OR_ASSIGN "|="
+%token OP_PTR "->"
+
+/* Numbers */
+%token LITERAL_INTEGER "int literal"
+%token LITERAL_FLOAT "float literal"
+%token LITERAL_DOUBLE "double literal"
+%token LITERAL_DECIMAL "decimal literal"
+%token LITERAL_CHARACTER "character literal"
+%token LITERAL_STRING "string literal"
+
+%token IDENTIFIER
+
+/* Add precedence rules to solve dangling else s/r conflict */
+%nonassoc LOWPREC
+%nonassoc IF
+%nonassoc ELSE
+%right ASSIGN
+%left OP_OR
+%left OP_AND
+%left BITWISE_OR
+%left BITWISE_AND
+%left OP_SHIFT_LEFT OP_SHIFT_RIGHT
+%left PLUS MINUS
+%left STAR DIV PERCENT
+%right BANG CARRET UMINUS
+%nonassoc OP_INC OP_DEC
+%left OPEN_PARENS
+%left OPEN_BRACKET OPEN_BRACE
+%left DOT
+%nonassoc HIGHPREC
+
+%start compilation_unit
+%%
+
+compilation_unit
+ : outer_declarations opt_EOF
+ | outer_declarations attribute_sections opt_EOF
+ | attribute_sections opt_EOF
+ ;
+
+opt_EOF
+ : /* empty */
+ | EOF
+ ;
+
+outer_declarations
+ : outer_declaration
+ | outer_declarations outer_declaration
+ ;
+
+outer_declaration
+ : using_directive
+ | namespace_member_declaration
+ ;
+
+using_directives
+ : using_directive
+ | using_directives using_directive
+ ;
+
+using_directive
+ : using_alias_directive
+ | using_namespace_directive
+ ;
+
+using_alias_directive
+ : USING IDENTIFIER ASSIGN
+ namespace_or_type_name SEMICOLON
+ {
+ current_namespace.UsingAlias ((string) $2, (string) $4, lexer.Location);
+ }
+ ;
+
+using_namespace_directive
+ : USING namespace_name SEMICOLON
+ {
+ current_namespace.Using ((string) $2);
+ }
+ ;
+
+//
+// Strictly speaking, namespaces don't have attributes but
+// we parse global attributes along with namespace declarations and then
+// detach them
+//
+namespace_declaration
+ : opt_attributes NAMESPACE qualified_identifier
+ {
+ Attributes attrs = (Attributes) $1;
+
+ if (attrs != null) {
+ foreach (AttributeSection asec in attrs.AttributeSections)
+ if (asec.Target == "assembly")
+ RootContext.AddGlobalAttribute (asec, lexer.Location);
+ }
+
+ current_namespace = RootContext.Tree.RecordNamespace (current_namespace, name, (string) $3);
+ }
+ namespace_body opt_semicolon
+ {
+ current_namespace = current_namespace.Parent;
+ }
+ ;
+
+opt_semicolon
+ : /* empty */
+ | SEMICOLON
+ ;
+
+opt_comma
+ : /* empty */
+ | COMMA
+ ;
+
+qualified_identifier
+ : IDENTIFIER
+ | qualified_identifier DOT IDENTIFIER {
+ $$ = (($1).ToString ()) + "." + ($3.ToString ()); }
+ ;
+
+
+namespace_name
+ : namespace_or_type_name
+ ;
+
+namespace_body
+ : OPEN_BRACE
+ opt_using_directives
+ opt_namespace_member_declarations
+ CLOSE_BRACE
+ {
+ }
+ ;
+
+opt_using_directives
+ : /* empty */
+ | using_directives
+ ;
+
+opt_namespace_member_declarations
+ : /* empty */
+ | namespace_member_declarations
+ ;
+
+namespace_member_declarations
+ : namespace_member_declaration
+ | namespace_member_declarations namespace_member_declaration
+ ;
+
+namespace_member_declaration
+ : type_declaration
+ {
+ string name = "";
+ int mod_flags;
+
+ if ($1 is Class){
+ Class c = (Class) $1;
+ mod_flags = c.ModFlags;
+ name = c.Name;
+ } else if ($1 is Struct){
+ Struct s = (Struct) $1;
+ mod_flags = s.ModFlags;
+ name = s.Name;
+ } else
+ break;
+
+ if ((mod_flags & (Modifiers.PRIVATE|Modifiers.PROTECTED)) != 0){
+ Report.Error (
+ 1527, lexer.Location,
+ "Namespace elements cant be explicitly " +
+ "declared private or protected in `" + name + "'");
+ }
+ }
+ | namespace_declaration
+ ;
+
+type_declaration
+ : class_declaration
+ | struct_declaration
+ | interface_declaration
+ | enum_declaration
+ | delegate_declaration
+//
+// Enable this when we have handled all errors, because this acts as a generic fallback
+//
+// | error {
+// Report.Error (1518, lexer.Location, "Expected class, struct, interface, enum or delegate");
+// }
+ ;
+
+//
+// Attributes 17.2
+//
+
+opt_attributes
+ : /* empty */
+ | attribute_sections { $$ = $1; }
+ ;
+
+attribute_sections
+ : attribute_section
+ {
+ AttributeSection sect = (AttributeSection) $1;
+
+ if (sect.Target == "assembly")
+ RootContext.AddGlobalAttribute (sect, lexer.Location);
+
+ $$ = new Attributes ((AttributeSection) $1, lexer.Location);
+ }
+ | attribute_sections attribute_section
+ {
+ Attributes attrs = null;
+ AttributeSection sect = (AttributeSection) $2;
+
+ if (sect.Target == "assembly")
+ RootContext.AddGlobalAttribute (sect, lexer.Location);
+
+ if ($1 != null) {
+ attrs = (Attributes) $1;
+ attrs.AddAttribute (sect);
+ }
+
+ $$ = attrs;
+ }
+ ;
+
+attribute_section
+ : OPEN_BRACKET attribute_target_specifier attribute_list CLOSE_BRACKET
+ {
+ string target = null;
+
+ if ($2 != null)
+ target = (string) $2;
+
+ $$ = new AttributeSection (target, (ArrayList) $3);
+ }
+ | OPEN_BRACKET attribute_list CLOSE_BRACKET
+ {
+ $$ = new AttributeSection (null, (ArrayList) $2);
+ }
+ ;
+
+attribute_target_specifier
+ : attribute_target COLON
+ {
+ $$ = $1;
+ }
+ ;
+
+attribute_target
+ : IDENTIFIER
+ {
+ CheckAttributeTarget ((string) $1);
+ $$ = $1;
+ }
+ | EVENT { $$ = "event"; }
+ | RETURN { $$ = "return"; }
+ ;
+
+attribute_list
+ : attribute
+ {
+ ArrayList attrs = new ArrayList ();
+ attrs.Add ($1);
+
+ $$ = attrs;
+
+ }
+ | attribute_list COMMA attribute
+ {
+ ArrayList attrs = (ArrayList) $1;
+ attrs.Add ($3);
+
+ $$ = attrs;
+ }
+ ;
+
+attribute
+ : attribute_name
+ {
+ $$ = lexer.Location;
+ }
+ opt_attribute_arguments
+ {
+ $$ = new Attribute ((string) $1, (ArrayList) $3, (Location) $2);
+ }
+ ;
+
+attribute_name
+ : type_name { /* reserved attribute name or identifier: 17.4 */ }
+ ;
+
+opt_attribute_arguments
+ : /* empty */ { $$ = null; }
+ | OPEN_PARENS attribute_arguments CLOSE_PARENS
+ {
+ $$ = $2;
+ }
+ ;
+
+
+attribute_arguments
+ : opt_positional_argument_list
+ {
+ if ($1 == null)
+ $$ = null;
+ else {
+ ArrayList args = new ArrayList ();
+ args.Add ($1);
+
+ $$ = args;
+ }
+ }
+ | positional_argument_list COMMA named_argument_list
+ {
+ ArrayList args = new ArrayList ();
+ args.Add ($1);
+ args.Add ($3);
+
+ $$ = args;
+ }
+ | named_argument_list
+ {
+ ArrayList args = new ArrayList ();
+ args.Add (null);
+ args.Add ($1);
+
+ $$ = args;
+ }
+ ;
+
+
+opt_positional_argument_list
+ : /* empty */ { $$ = null; }
+ | positional_argument_list
+ ;
+
+positional_argument_list
+ : expression
+ {
+ ArrayList args = new ArrayList ();
+ args.Add (new Argument ((Expression) $1, Argument.AType.Expression));
+
+ $$ = args;
+ }
+ | positional_argument_list COMMA expression
+ {
+ ArrayList args = (ArrayList) $1;
+ args.Add (new Argument ((Expression) $3, Argument.AType.Expression));
+
+ $$ = args;
+ }
+ ;
+
+named_argument_list
+ : named_argument
+ {
+ ArrayList args = new ArrayList ();
+ args.Add ($1);
+
+ $$ = args;
+ }
+ | named_argument_list COMMA named_argument
+ {
+ ArrayList args = (ArrayList) $1;
+ args.Add ($3);
+
+ $$ = args;
+ }
+ ;
+
+named_argument
+ : IDENTIFIER ASSIGN expression
+ {
+ $$ = new DictionaryEntry (
+ (string) $1,
+ new Argument ((Expression) $3, Argument.AType.Expression));
+ }
+ ;
+
+
+class_body
+ : OPEN_BRACE opt_class_member_declarations CLOSE_BRACE
+ ;
+
+opt_class_member_declarations
+ : /* empty */
+ | class_member_declarations
+ ;
+
+class_member_declarations
+ : class_member_declaration
+ | class_member_declarations
+ class_member_declaration
+ ;
+
+class_member_declaration
+ : constant_declaration // done
+ | field_declaration // done
+ | method_declaration // done
+ | property_declaration // done
+ | event_declaration // done
+ | indexer_declaration // done
+ | operator_declaration // done
+ | constructor_declaration // done
+ | destructor_declaration // done
+ | type_declaration
+ ;
+
+struct_declaration
+ : opt_attributes
+ opt_modifiers
+ STRUCT IDENTIFIER
+ {
+ Struct new_struct;
+ string full_struct_name = MakeName ((string) $4);
+
+ new_struct = new Struct (current_container, full_struct_name, (int) $2,
+ (Attributes) $1, lexer.Location);
+ current_container = new_struct;
+ current_container.Namespace = current_namespace;
+ RootContext.Tree.RecordDecl (full_struct_name, new_struct);
+ }
+ opt_struct_interfaces
+ struct_body
+ opt_semicolon
+ {
+ Struct new_struct = (Struct) current_container;
+
+ current_container = current_container.Parent;
+ CheckDef (current_container.AddStruct (new_struct), new_struct.Name, new_struct.Location);
+ $$ = new_struct;
+ }
+ ;
+
+opt_struct_interfaces
+ : /* empty */
+ | struct_interfaces
+ ;
+
+struct_interfaces
+ : struct_interface
+ | struct_interfaces struct_interface
+ ;
+
+struct_interface
+ : COLON type_list
+ ;
+
+struct_body
+ : OPEN_BRACE opt_struct_member_declarations CLOSE_BRACE
+ ;
+
+opt_struct_member_declarations
+ : /* empty */
+ | struct_member_declarations
+ ;
+
+struct_member_declarations
+ : struct_member_declaration
+ | struct_member_declarations struct_member_declaration
+ ;
+
+struct_member_declaration
+ : constant_declaration
+ | field_declaration
+ | method_declaration
+ | property_declaration
+ | event_declaration
+ | indexer_declaration
+ | operator_declaration
+ | constructor_declaration
+ | type_declaration
+
+ /*
+ * This is only included so we can flag error 575:
+ * destructors only allowed on class types
+ */
+ | destructor_declaration
+ ;
+
+constant_declaration
+ : opt_attributes
+ opt_modifiers
+ CONST
+ type
+ constant_declarators
+ SEMICOLON
+ {
+ foreach (VariableDeclaration constant in (ArrayList) $5){
+ Location l = constant.Location;
+
+ Const c = new Const (
+ (string) $4, (string) constant.identifier,
+ (Expression) constant.expression_or_array_initializer, (int) $2,
+ (Attributes) $1, l);
+
+ CheckDef (current_container.AddConstant (c), c.Name, l);
+ }
+ }
+ ;
+
+constant_declarators
+ : constant_declarator
+ {
+ ArrayList constants = new ArrayList ();
+ constants.Add ($1);
+ $$ = constants;
+ }
+ | constant_declarators COMMA constant_declarator
+ {
+ ArrayList constants = (ArrayList) $1;
+
+ constants.Add ($3);
+ }
+ ;
+
+constant_declarator
+ : IDENTIFIER ASSIGN constant_expression
+ {
+ $$ = new VariableDeclaration ((string) $1, $3, lexer.Location);
+ }
+ ;
+
+field_declaration
+ : opt_attributes
+ opt_modifiers
+ type
+ variable_declarators
+ SEMICOLON
+ {
+ string type = (string) $3;
+ int mod = (int) $2;
+
+ foreach (VariableDeclaration var in (ArrayList) $4){
+ Location l = var.Location;
+
+ Field field = new Field (type, mod, var.identifier,
+ var.expression_or_array_initializer,
+ (Attributes) $1, l);
+
+ CheckDef (current_container.AddField (field), field.Name, l);
+ }
+ }
+ ;
+
+variable_declarators
+ : variable_declarator
+ {
+ ArrayList decl = new ArrayList ();
+ decl.Add ($1);
+ $$ = decl;
+ }
+ | variable_declarators COMMA variable_declarator
+ {
+ ArrayList decls = (ArrayList) $1;
+ decls.Add ($3);
+ $$ = $1;
+ }
+ ;
+
+variable_declarator
+ : IDENTIFIER ASSIGN variable_initializer
+ {
+ $$ = new VariableDeclaration ((string) $1, $3, lexer.Location);
+ }
+ | IDENTIFIER
+ {
+ $$ = new VariableDeclaration ((string) $1, null, lexer.Location);
+ }
+ ;
+
+variable_initializer
+ : expression
+ {
+ $$ = $1;
+ }
+ | array_initializer
+ {
+ $$ = $1;
+ }
+ | STACKALLOC type OPEN_BRACKET expression CLOSE_BRACKET
+ {
+ $$ = new StackAlloc ((string) $2, (Expression) $4, lexer.Location);
+ }
+ ;
+
+method_declaration
+ : method_header
+ method_body
+ {
+ Method method = (Method) $1;
+ Block b = (Block) $2;
+ const int extern_abstract = (Modifiers.EXTERN | Modifiers.ABSTRACT);
+
+ if (b == null){
+ if ((method.ModFlags & extern_abstract) == 0){
+ Report.Error (
+ 501, lexer.Location, current_container.MakeName (method.Name) +
+ "must declare a body because it is not marked abstract or extern");
+ }
+ } else {
+ if ((method.ModFlags & Modifiers.EXTERN) != 0){
+ Report.Error (
+ 179, lexer.Location, current_container.MakeName (method.Name) +
+ " is declared extern, but has a body");
+ }
+ }
+
+ method.Block = (Block) $2;
+ CheckDef (current_container.AddMethod (method), method.Name, method.Location);
+
+ current_local_parameters = null;
+ }
+ ;
+
+opt_error_modifier
+ : /* empty */
+ | modifiers
+ {
+ int m = (int) $1;
+ int i = 1;
+
+ while (m != 0){
+ if ((i & m) != 0){
+ Report.Error (
+ 1585, lexer.Location, "Member modifier `" +
+ Modifiers.Name (i) + "' must precede member type and name");
+ }
+ m &= ~i;
+ i = i << 1;
+ }
+ }
+ ;
+
+method_header
+ : opt_attributes
+ opt_modifiers
+ type
+ member_name
+ OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
+ {
+ Method method = new Method ((string) $3, (int) $2, (string) $4,
+ (Parameters) $6, (Attributes) $1, lexer.Location);
+
+ current_local_parameters = (Parameters) $6;
+
+ $$ = method;
+ }
+ | opt_attributes
+ opt_modifiers
+ VOID
+ member_name
+ OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
+ {
+ Method method = new Method ("System.Void", (int) $2, (string) $4,
+ (Parameters) $6, (Attributes) $1, lexer.Location);
+
+ current_local_parameters = (Parameters) $6;
+ $$ = method;
+ }
+ ;
+
+method_body
+ : block
+ | SEMICOLON { $$ = null; }
+ ;
+
+opt_formal_parameter_list
+ : /* empty */ { $$ = Parameters.GetEmptyReadOnlyParameters (); }
+ | formal_parameter_list
+ ;
+
+formal_parameter_list
+ : fixed_parameters
+ {
+ ArrayList pars_list = (ArrayList) $1;
+
+ Parameter [] pars = new Parameter [pars_list.Count];
+ pars_list.CopyTo (pars);
+
+ $$ = new Parameters (pars, null, lexer.Location);
+ }
+ | fixed_parameters COMMA parameter_array
+ {
+ ArrayList pars_list = (ArrayList) $1;
+
+ Parameter [] pars = new Parameter [pars_list.Count];
+ pars_list.CopyTo (pars);
+
+ $$ = new Parameters (pars, (Parameter) $3, lexer.Location);
+ }
+ | parameter_array
+ {
+ $$ = new Parameters (null, (Parameter) $1, lexer.Location);
+ }
+ ;
+
+fixed_parameters
+ : fixed_parameter
+ {
+ ArrayList pars = new ArrayList ();
+
+ pars.Add ($1);
+ $$ = pars;
+ }
+ | fixed_parameters COMMA fixed_parameter
+ {
+ ArrayList pars = (ArrayList) $1;
+
+ pars.Add ($3);
+ $$ = $1;
+ }
+ ;
+
+fixed_parameter
+ : opt_attributes
+ opt_parameter_modifier
+ type
+ IDENTIFIER
+ {
+ $$ = new Parameter ((string) $3, (string) $4, (Parameter.Modifier) $2, (Attributes) $1);
+ }
+ ;
+
+opt_parameter_modifier
+ : /* empty */ { $$ = Parameter.Modifier.NONE; }
+ | parameter_modifier
+ ;
+
+parameter_modifier
+ : REF { $$ = Parameter.Modifier.REF; }
+ | OUT { $$ = Parameter.Modifier.OUT; }
+ ;
+
+parameter_array
+ : opt_attributes PARAMS type IDENTIFIER
+ {
+ $$ = new Parameter ((string) $3, (string) $4, Parameter.Modifier.PARAMS, (Attributes) $1);
+ note ("type must be a single-dimension array type");
+ }
+ ;
+
+member_name
+ : qualified_identifier
+ ;
+
+property_declaration
+ : opt_attributes
+ opt_modifiers
+ type member_name
+ OPEN_BRACE
+ {
+ implicit_value_parameter_type = (string) $3;
+
+ lexer.PropertyParsing = true;
+
+ $$ = lexer.Location;
+ }
+ accessor_declarations
+ {
+ lexer.PropertyParsing = false;
+ }
+ CLOSE_BRACE
+ {
+ Property prop;
+ Pair pair = (Pair) $7;
+ Block get_block = null;
+ Block set_block = null;
+
+ if (pair.First != null)
+ get_block = (Block) pair.First;
+ if (pair.Second != null)
+ set_block = (Block) pair.Second;
+
+ Location loc = (Location) $6;
+ prop = new Property ((string) $3, (string) $4, (int) $2, get_block, set_block,
+ (Attributes) $1, loc);
+
+ CheckDef (current_container.AddProperty (prop), prop.Name, loc);
+ implicit_value_parameter_type = null;
+ }
+ ;
+
+accessor_declarations
+ : get_accessor_declaration opt_set_accessor_declaration
+ {
+ $$ = new Pair ($1, $2);
+ }
+ | set_accessor_declaration opt_get_accessor_declaration
+ {
+ $$ = new Pair ($2, $1);
+ }
+ ;
+
+opt_get_accessor_declaration
+ : /* empty */ { $$ = null; }
+ | get_accessor_declaration
+ ;
+
+opt_set_accessor_declaration
+ : /* empty */ { $$ = null; }
+ | set_accessor_declaration
+ ;
+
+get_accessor_declaration
+ : opt_attributes GET
+ {
+ // If this is not the case, then current_local_parameters has already
+ // been set in indexer_declaration
+ if (parsing_indexer == false)
+ current_local_parameters = null;
+ else
+ current_local_parameters = indexer_parameters;
+ lexer.PropertyParsing = false;
+ }
+ accessor_body
+ {
+ $$ = $4;
+ current_local_parameters = null;
+ lexer.PropertyParsing = true;
+ }
+ ;
+
+set_accessor_declaration
+ : opt_attributes SET
+ {
+ Parameter [] args;
+ Parameter implicit_value_parameter = new Parameter (
+ implicit_value_parameter_type, "value",
+ Parameter.Modifier.NONE, null);
+
+ if (parsing_indexer == false) {
+ args = new Parameter [1];
+ args [0] = implicit_value_parameter;
+ } else {
+ Parameter [] fp = indexer_parameters.FixedParameters;
+ int count = fp.Length;
+
+ args = new Parameter [count + 1];
+
+ fp.CopyTo (args, 0);
+ args [count] = implicit_value_parameter;
+ }
+
+ current_local_parameters = new Parameters (args, null, lexer.Location);
+ lexer.PropertyParsing = false;
+ }
+ accessor_body
+ {
+ $$ = $4;
+ current_local_parameters = null;
+ lexer.PropertyParsing = true;
+ }
+ ;
+
+accessor_body
+ : block
+ | SEMICOLON { $$ = null; }
+ ;
+
+interface_declaration
+ : opt_attributes
+ opt_modifiers
+ INTERFACE IDENTIFIER
+ {
+ Interface new_interface;
+ string full_interface_name = MakeName ((string) $4);
+
+ new_interface = new Interface (current_container, full_interface_name, (int) $2,
+ (Attributes) $1, lexer.Location);
+ if (current_interface != null) {
+ Location l = lexer.Location;
+ Report.Error (-2, l, "Internal compiler error: interface inside interface");
+ }
+ current_interface = new_interface;
+ new_interface.Namespace = current_namespace;
+ RootContext.Tree.RecordDecl (full_interface_name, new_interface);
+ }
+ opt_interface_base
+ interface_body opt_semicolon
+ {
+ Interface new_interface = (Interface) current_interface;
+
+ if ($6 != null)
+ new_interface.Bases = (ArrayList) $6;
+
+ current_interface = null;
+ CheckDef (current_container.AddInterface (new_interface),
+ new_interface.Name, new_interface.Location);
+ }
+ ;
+
+opt_interface_base
+ : /* empty */ { $$ = null; }
+ | interface_base
+ ;
+
+interface_base
+ : COLON interface_type_list { $$ = $2; }
+ ;
+
+interface_type_list
+ : interface_type
+ {
+ ArrayList interfaces = new ArrayList ();
+
+ interfaces.Add ($1);
+ $$ = interfaces;
+ }
+ | interface_type_list COMMA interface_type
+ {
+ ArrayList interfaces = (ArrayList) $1;
+ interfaces.Add ($3);
+ $$ = interfaces;
+ }
+ ;
+
+interface_body
+ : OPEN_BRACE
+ opt_interface_member_declarations
+ CLOSE_BRACE
+ ;
+
+opt_interface_member_declarations
+ : /* empty */
+ | interface_member_declarations
+ ;
+
+interface_member_declarations
+ : interface_member_declaration
+ | interface_member_declarations interface_member_declaration
+ ;
+
+interface_member_declaration
+ : interface_method_declaration
+ {
+ InterfaceMethod m = (InterfaceMethod) $1;
+
+ CheckDef (current_interface.AddMethod (m), m.Name, m.Location);
+ }
+ | interface_property_declaration
+ {
+ InterfaceProperty p = (InterfaceProperty) $1;
+
+ CheckDef (current_interface.AddProperty (p), p.Name, p.Location);
+ }
+ | interface_event_declaration
+ {
+ InterfaceEvent e = (InterfaceEvent) $1;
+
+ CheckDef (current_interface.AddEvent (e), e.Name, lexer.Location);
+ }
+ | interface_indexer_declaration
+ {
+ InterfaceIndexer i = (InterfaceIndexer) $1;
+
+ CheckDef (current_interface.AddIndexer (i), "indexer", i.Location);
+ }
+ ;
+
+opt_new
+ : /* empty */ { $$ = false; }
+ | NEW { $$ = true; }
+ ;
+
+interface_method_declaration
+ : opt_attributes opt_new type IDENTIFIER
+ OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
+ SEMICOLON
+ {
+ $$ = new InterfaceMethod ((string) $3, (string) $4, (bool) $2,
+ (Parameters) $6, (Attributes) $1, lexer.Location);
+ }
+ | opt_attributes opt_new VOID IDENTIFIER
+ OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
+ SEMICOLON
+ {
+ $$ = new InterfaceMethod ("System.Void", (string) $4, (bool) $2, (Parameters) $6,
+ (Attributes) $1, lexer.Location);
+ }
+ ;
+
+interface_property_declaration
+ : opt_attributes
+ opt_new
+ type IDENTIFIER
+ OPEN_BRACE
+ { lexer.PropertyParsing = true; }
+ interface_accesors
+ { lexer.PropertyParsing = false; }
+ CLOSE_BRACE
+ {
+ int gs = (int) $7;
+
+ $$ = new InterfaceProperty ((string) $3, (string) $4, (bool) $2,
+ (gs & 1) == 1, (gs & 2) == 2, (Attributes) $1,
+ lexer.Location);
+ }
+ ;
+
+interface_accesors
+ : opt_attributes GET SEMICOLON { $$ = 1; }
+ | opt_attributes SET SEMICOLON { $$ = 2; }
+ | opt_attributes GET SEMICOLON opt_attributes SET SEMICOLON
+ { $$ = 3; }
+ | opt_attributes SET SEMICOLON opt_attributes GET SEMICOLON
+ { $$ = 3; }
+ ;
+
+interface_event_declaration
+ : opt_attributes opt_new EVENT type IDENTIFIER SEMICOLON
+ {
+ $$ = new InterfaceEvent ((string) $4, (string) $5, (bool) $2, (Attributes) $1);
+ }
+ ;
+
+interface_indexer_declaration
+ : opt_attributes opt_new type THIS
+ OPEN_BRACKET formal_parameter_list CLOSE_BRACKET
+ OPEN_BRACE
+ { lexer.PropertyParsing = true; }
+ interface_accesors
+ { lexer.PropertyParsing = false; }
+ CLOSE_BRACE
+ {
+ int a_flags = (int) $10;
+
+ bool do_get = (a_flags & 1) == 1;
+ bool do_set = (a_flags & 2) == 2;
+
+ $$ = new InterfaceIndexer ((string) $3, (Parameters) $6, do_get, do_set,
+ (bool) $2, (Attributes) $1, lexer.Location);
+ }
+ ;
+
+operator_declaration
+ : opt_attributes opt_modifiers operator_declarator operator_body
+ {
+ OperatorDeclaration decl = (OperatorDeclaration) $3;
+
+ Operator op = new Operator (decl.optype, decl.ret_type, (int) $2, decl.arg1type, decl.arg1name,
+ decl.arg2type, decl.arg2name, (Block) $4, (Attributes) $1, decl.location);
+
+ // Note again, checking is done in semantic analysis
+ current_container.AddOperator (op);
+
+ current_local_parameters = null;
+ }
+ ;
+
+operator_body
+ : block
+ | SEMICOLON { $$ = null; }
+ ;
+operator_declarator
+ : type OPERATOR overloadable_operator
+ OPEN_PARENS type IDENTIFIER CLOSE_PARENS
+ {
+ Operator.OpType op = (Operator.OpType) $3;
+ CheckUnaryOperator (op);
+
+ if (op == Operator.OpType.Addition)
+ op = Operator.OpType.UnaryPlus;
+
+ if (op == Operator.OpType.Subtraction)
+ op = Operator.OpType.UnaryNegation;
+
+ Parameter [] pars = new Parameter [1];
+
+ pars [0] = new Parameter ((string) $5, (string) $6, Parameter.Modifier.NONE, null);
+
+ current_local_parameters = new Parameters (pars, null, lexer.Location);
+
+ $$ = new OperatorDeclaration (op, (string) $1, (string) $5, (string) $6,
+ null, null, lexer.Location);
+ }
+ | type OPERATOR overloadable_operator
+ OPEN_PARENS
+ type IDENTIFIER COMMA
+ type IDENTIFIER
+ CLOSE_PARENS
+ {
+ CheckBinaryOperator ((Operator.OpType) $3);
+
+ Parameter [] pars = new Parameter [2];
+
+ pars [0] = new Parameter ((string) $5, (string) $6, Parameter.Modifier.NONE, null);
+ pars [1] = new Parameter ((string) $8, (string) $9, Parameter.Modifier.NONE, null);
+
+ current_local_parameters = new Parameters (pars, null, lexer.Location);
+
+ $$ = new OperatorDeclaration ((Operator.OpType) $3, (string) $1, (string) $5, (string) $6,
+ (string) $8, (string) $9, lexer.Location);
+ }
+ | conversion_operator_declarator
+ ;
+
+overloadable_operator
+// Unary operators:
+ : BANG { $$ = Operator.OpType.LogicalNot; }
+ | TILDE { $$ = Operator.OpType.OnesComplement; }
+ | OP_INC { $$ = Operator.OpType.Increment; }
+ | OP_DEC { $$ = Operator.OpType.Decrement; }
+ | TRUE { $$ = Operator.OpType.True; }
+ | FALSE { $$ = Operator.OpType.False; }
+// Unary and binary:
+ | PLUS { $$ = Operator.OpType.Addition; }
+ | MINUS { $$ = Operator.OpType.Subtraction; }
+// Binary:
+ | STAR { $$ = Operator.OpType.Multiply; }
+ | DIV { $$ = Operator.OpType.Division; }
+ | PERCENT { $$ = Operator.OpType.Modulus; }
+ | BITWISE_AND { $$ = Operator.OpType.BitwiseAnd; }
+ | BITWISE_OR { $$ = Operator.OpType.BitwiseOr; }
+ | CARRET { $$ = Operator.OpType.ExclusiveOr; }
+ | OP_SHIFT_LEFT { $$ = Operator.OpType.LeftShift; }
+ | OP_SHIFT_RIGHT { $$ = Operator.OpType.RightShift; }
+ | OP_EQ { $$ = Operator.OpType.Equality; }
+ | OP_NE { $$ = Operator.OpType.Inequality; }
+ | OP_GT { $$ = Operator.OpType.GreaterThan; }
+ | OP_LT { $$ = Operator.OpType.LessThan; }
+ | OP_GE { $$ = Operator.OpType.GreaterThanOrEqual; }
+ | OP_LE { $$ = Operator.OpType.LessThanOrEqual; }
+ ;
+
+conversion_operator_declarator
+ : IMPLICIT OPERATOR type OPEN_PARENS type IDENTIFIER CLOSE_PARENS
+ {
+ Parameter [] pars = new Parameter [1];
+
+ pars [0] = new Parameter ((string) $5, (string) $6, Parameter.Modifier.NONE, null);
+
+ current_local_parameters = new Parameters (pars, null, lexer.Location);
+
+ $$ = new OperatorDeclaration (Operator.OpType.Implicit, (string) $3, (string) $5, (string) $6,
+ null, null, lexer.Location);
+ }
+ | EXPLICIT OPERATOR type OPEN_PARENS type IDENTIFIER CLOSE_PARENS
+ {
+ Parameter [] pars = new Parameter [1];
+
+ pars [0] = new Parameter ((string) $5, (string) $6, Parameter.Modifier.NONE, null);
+
+ current_local_parameters = new Parameters (pars, null, lexer.Location);
+
+ $$ = new OperatorDeclaration (Operator.OpType.Explicit, (string) $3, (string) $5, (string) $6,
+ null, null, lexer.Location);
+ }
+ | IMPLICIT error
+ {
+ syntax_error (lexer.Location, "'operator' expected");
+ }
+ | EXPLICIT error
+ {
+ syntax_error (lexer.Location, "'operator' expected");
+ }
+ ;
+
+constructor_declaration
+ : opt_attributes
+ opt_modifiers
+ constructor_declarator
+ constructor_body
+ {
+ Constructor c = (Constructor) $3;
+ c.Block = (Block) $4;
+ c.ModFlags = (int) $2;
+ c.OptAttributes = (Attributes) $1;
+
+ if ((c.ModFlags & Modifiers.STATIC) != 0){
+ if ((c.ModFlags & Modifiers.Accessibility) != 0) {
+ Report.Error (
+ 515, c.Location,
+ "Access modifiers are not allowed on static constructors");
+ }
+
+ if (c.Initializer != null){
+ Report.Error (
+ 514, c.Location,
+ "Static constructors can not have an explicit this or base " +
+ "constructor invocations");
+ }
+
+ if (!c.Parameters.Empty){
+ Report.Error (
+ 132, c.Location, "Static constructors should not have parameters");
+ }
+ }
+
+ CheckDef (current_container.AddConstructor (c), c.Name, c.Location);
+
+ current_local_parameters = null;
+ }
+ ;
+
+constructor_declarator
+ : IDENTIFIER
+ OPEN_PARENS opt_formal_parameter_list CLOSE_PARENS
+ {
+ oob_stack.Push (lexer.Location);
+
+ current_local_parameters = (Parameters) $3;
+ }
+ opt_constructor_initializer
+ {
+ Location l = (Location) oob_stack.Pop ();
+ $$ = new Constructor ((string) $1, (Parameters) $3, (ConstructorInitializer) $6, l);
+ }
+ ;
+
+constructor_body
+ : block
+ | SEMICOLON { $$ = null; }
+ ;
+
+opt_constructor_initializer
+ : /* empty */ { $$ = null; }
+ | constructor_initializer
+ ;
+
+constructor_initializer
+ : COLON BASE OPEN_PARENS opt_argument_list CLOSE_PARENS
+ {
+ $$ = new ConstructorBaseInitializer ((ArrayList) $4, lexer.Location);
+ }
+ | COLON THIS OPEN_PARENS opt_argument_list CLOSE_PARENS
+ {
+ $$ = new ConstructorThisInitializer ((ArrayList) $4, lexer.Location);
+ }
+ ;
+
+destructor_declaration
+ : opt_attributes TILDE IDENTIFIER OPEN_PARENS CLOSE_PARENS block
+ {
+ if ((string) $3 != current_container.Basename){
+ Report.Error (574, lexer.Location, "Name of destructor must match name of class");
+ } else if (!(current_container is Class)){
+ Report.Error (575, lexer.Location, "Destructors are only allowed in class types");
+ } else {
+ Location l = lexer.Location;
+
+ Method d = new Method (
+ "System.Void", 0, "Finalize",
+ new Parameters (null, null, l), (Attributes) $1, l);
+
+ d.Block = (Block) $6;
+ CheckDef (current_container.AddMethod (d), d.Name, d.Location);
+ }
+ }
+ ;
+
+event_declaration
+ : opt_attributes
+ opt_modifiers
+ EVENT type variable_declarators SEMICOLON
+ {
+ foreach (VariableDeclaration var in (ArrayList) $5) {
+
+ Event e = new Event ((string) $4, var.identifier, var.expression_or_array_initializer,
+ (int) $2, null, null, (Attributes) $1, lexer.Location);
+
+ CheckDef (current_container.AddEvent (e), e.Name, e.Location);
+
+ }
+ }
+ | opt_attributes
+ opt_modifiers
+ EVENT type member_name
+ OPEN_BRACE
+ {
+ implicit_value_parameter_type = (string) $4;
+ lexer.EventParsing = true;
+ oob_stack.Push (lexer.Location);
+ }
+ event_accessor_declarations
+ {
+ lexer.EventParsing = false;
+ }
+ CLOSE_BRACE
+ {
+ Location loc = (Location) oob_stack.Pop ();
+
+ Pair pair = (Pair) $8;
+ Block add_block = null;
+ Block rem_block = null;
+
+ if (pair.First != null)
+ add_block = (Block) pair.First;
+ if (pair.Second != null)
+ rem_block = (Block) pair.Second;
+
+ Event e = new Event ((string) $4, (string) $5, null, (int) $2, add_block, rem_block,
+ (Attributes) $1, loc);
+
+ CheckDef (current_container.AddEvent (e), e.Name, loc);
+ implicit_value_parameter_type = null;
+ }
+ ;
+
+event_accessor_declarations
+ : add_accessor_declaration remove_accessor_declaration
+ {
+ $$ = new Pair ($1, $2);
+ }
+ | remove_accessor_declaration add_accessor_declaration
+ {
+ $$ = new Pair ($2, $1);
+ }
+ ;
+
+add_accessor_declaration
+ : opt_attributes ADD
+ {
+ Parameter [] args = new Parameter [1];
+ Parameter implicit_value_parameter = new Parameter (
+ implicit_value_parameter_type, "value",
+ Parameter.Modifier.NONE, null);
+
+ args [0] = implicit_value_parameter;
+
+ current_local_parameters = new Parameters (args, null, lexer.Location);
+ lexer.EventParsing = false;
+ }
+ block
+ {
+ $$ = $4;
+ lexer.EventParsing = true;
+ }
+ ;
+
+remove_accessor_declaration
+ : opt_attributes REMOVE
+ {
+ Parameter [] args = new Parameter [1];
+ Parameter implicit_value_parameter = new Parameter (
+ implicit_value_parameter_type, "value",
+ Parameter.Modifier.NONE, null);
+
+ args [0] = implicit_value_parameter;
+
+ current_local_parameters = new Parameters (args, null, lexer.Location);
+ lexer.EventParsing = false;
+ }
+ block
+ {
+ $$ = $4;
+ lexer.EventParsing = true;
+ }
+ ;
+
+indexer_declaration
+ : opt_attributes opt_modifiers indexer_declarator
+ OPEN_BRACE
+ {
+ IndexerDeclaration decl = (IndexerDeclaration) $3;
+
+ implicit_value_parameter_type = decl.type;
+
+ lexer.PropertyParsing = true;
+ parsing_indexer = true;
+
+ indexer_parameters = decl.param_list;
+ $$ = lexer.Location;
+ }
+ accessor_declarations
+ {
+ lexer.PropertyParsing = false;
+ parsing_indexer = false;
+ }
+ CLOSE_BRACE
+ {
+ // The signature is computed from the signature of the indexer. Look
+ // at section 3.6 on the spec
+
+ Indexer indexer;
+ IndexerDeclaration decl = (IndexerDeclaration) $3;
+ Pair pair = (Pair) $6;
+ Block get_block = null;
+ Block set_block = null;
+
+ if (pair.First != null)
+ get_block = (Block) pair.First;
+ if (pair.Second != null)
+ set_block = (Block) pair.Second;
+
+ indexer = new Indexer (decl.type, decl.interface_type, (int) $2, decl.param_list,
+ get_block, set_block, (Attributes) $1, (Location) $5);
+
+ // Note that there is no equivalent of CheckDef for this case
+ // We shall handle this in semantic analysis
+
+ current_container.AddIndexer (indexer);
+
+ current_local_parameters = null;
+ implicit_value_parameter_type = null;
+ indexer_parameters = null;
+ }
+ ;
+
+indexer_declarator
+ : type THIS OPEN_BRACKET opt_formal_parameter_list CLOSE_BRACKET
+ {
+ Parameters pars = (Parameters) $4;
+
+ if (pars.FixedParameters == null){
+ Report.Error (1551, lexer.Location, "Indexers must have at least one parameter");
+ }
+
+ $$ = new IndexerDeclaration ((string) $1, null, pars);
+ }
+ | type qualified_identifier DOT THIS OPEN_BRACKET opt_formal_parameter_list CLOSE_BRACKET
+ {
+ Parameters pars = (Parameters) $6;
+
+ if (pars.FixedParameters == null){
+ Report.Error (1551, lexer.Location, "Indexers must have at least one parameter");
+ }
+ $$ = new IndexerDeclaration ((string) $1, (string) $2, pars);
+ }
+ ;
+
+enum_declaration
+ : opt_attributes
+ opt_modifiers
+ ENUM IDENTIFIER
+ opt_enum_base
+ enum_body
+ opt_semicolon
+ {
+ Location enum_location = lexer.Location;
+
+ string full_name = MakeName ((string) $4);
+ Enum e = new Enum (
+ current_container, (string) $5, (int) $2, full_name,
+ (Attributes) $1, enum_location);
+
+ foreach (VariableDeclaration ev in (ArrayList) $6){
+ Location loc = (Location) ev.Location;
+
+ CheckDef (e.AddEnumMember (ev.identifier,
+ (Expression) ev.expression_or_array_initializer,
+ loc),
+ ev.identifier, loc);
+ }
+
+ e.Namespace = current_namespace;
+
+ CheckDef (current_container.AddEnum (e), full_name, enum_location);
+ RootContext.Tree.RecordDecl (full_name, e);
+
+ }
+ ;
+
+opt_enum_base
+ : /* empty */ { $$ = "System.Int32"; }
+ | COLON type { $$ = $2; }
+ ;
+
+enum_body
+ : OPEN_BRACE opt_enum_member_declarations CLOSE_BRACE
+ {
+ $$ = $2;
+ }
+ ;
+
+opt_enum_member_declarations
+ : /* empty */ { $$ = new ArrayList (); }
+ | enum_member_declarations opt_comma { $$ = $1; }
+ ;
+
+enum_member_declarations
+ : enum_member_declaration
+ {
+ ArrayList l = new ArrayList ();
+
+ l.Add ($1);
+ $$ = l;
+ }
+ | enum_member_declarations COMMA enum_member_declaration
+ {
+ ArrayList l = (ArrayList) $1;
+
+ l.Add ($3);
+
+ $$ = l;
+ }
+ ;
+
+enum_member_declaration
+ : opt_attributes IDENTIFIER
+ {
+ $$ = new VariableDeclaration ((string) $2, null, lexer.Location);
+ }
+ | opt_attributes IDENTIFIER
+ {
+ $$ = lexer.Location;
+ }
+ ASSIGN expression
+ {
+ $$ = new VariableDeclaration ((string) $2, $5, lexer.Location);
+ }
+ ;
+
+delegate_declaration
+ : opt_attributes
+ opt_modifiers
+ DELEGATE type
+ IDENTIFIER OPEN_PARENS
+ opt_formal_parameter_list
+ CLOSE_PARENS
+ SEMICOLON
+ {
+ Location l = lexer.Location;
+ Delegate del = new Delegate (current_container, (string) $4, (int) $2,
+ MakeName ((string) $5), (Parameters) $7,
+ (Attributes) $1, l);
+
+ del.Namespace = current_namespace;
+ CheckDef (current_container.AddDelegate (del), del.Name, l);
+ }
+ | opt_attributes
+ opt_modifiers
+ DELEGATE VOID
+ IDENTIFIER OPEN_PARENS
+ opt_formal_parameter_list
+ CLOSE_PARENS
+ SEMICOLON
+ {
+ Location l = lexer.Location;
+ Delegate del = new Delegate (
+ current_container,
+ "System.Void", (int) $2, MakeName ((string) $5), (Parameters) $7,
+ (Attributes) $1, l);
+
+ del.Namespace = current_namespace;
+ CheckDef (current_container.AddDelegate (del), del.Name, l);
+ }
+ ;
+
+type_name
+ : namespace_or_type_name
+ ;
+
+namespace_or_type_name
+ : qualified_identifier
+ ;
+
+/*
+ * Before you think of adding a return_type, notice that we have been
+ * using two rules in the places where it matters (one rule using type
+ * and another identical one that uses VOID as the return type). This
+ * gets rid of a shift/reduce couple
+ */
+type
+ : type_name { /* class_type */
+ /*
+ This does interfaces, delegates, struct_types, class_types,
+ parent classes, and more! 4.2
+ */
+ $$ = $1;
+ }
+ | builtin_types
+ | array_type
+ | pointer_type
+ ;
+
+
+pointer_type
+ : type STAR
+ {
+ //
+ // Note that here only unmanaged types are allowed but we
+ // can't perform checks during this phase - we do it during
+ // semantic analysis.
+ //
+ $$ = (string) $1 + "*";
+ }
+ | VOID STAR
+ {
+ $$ = "System.Void*";
+ }
+ ;
+
+non_expression_type
+ : builtin_types
+ {
+ $$ = new SimpleName ((string) $1, lexer.Location);
+ }
+ | non_expression_type rank_specifier
+ {
+ $$ = new ComposedCast ((Expression) $1, (string) $2, lexer.Location);
+ }
+ | non_expression_type STAR
+ {
+ $$ = new ComposedCast ((Expression) $1, "*", lexer.Location);
+ }
+ | expression rank_specifiers
+ {
+ $$ = new ComposedCast ((Expression) $1, (string) $2, lexer.Location);
+ }
+ | expression STAR
+ {
+ $$ = new ComposedCast ((Expression) $1, "*", lexer.Location);
+ }
+ ;
+
+type_list
+ : type
+ {
+ ArrayList types = new ArrayList ();
+
+ types.Add ($1);
+ $$ = types;
+ }
+ | type_list COMMA type
+ {
+ ArrayList types = (ArrayList) $1;
+
+ types.Add ($3);
+ $$ = types;
+ }
+ ;
+
+/*
+ * replaces all the productions for isolating the various
+ * simple types, but we need this to reuse it easily in local_variable_type
+ */
+builtin_types
+ : OBJECT { $$ = "System.Object"; }
+ | STRING { $$ = "System.String"; }
+ | BOOL { $$ = "System.Boolean"; }
+ | DECIMAL { $$ = "System.Decimal"; }
+ | FLOAT { $$ = "System.Single"; }
+ | DOUBLE { $$ = "System.Double"; }
+ | integral_type
+ ;
+
+integral_type
+ : SBYTE { $$ = "System.SByte"; }
+ | BYTE { $$ = "System.Byte"; }
+ | SHORT { $$ = "System.Int16"; }
+ | USHORT { $$ = "System.UInt16"; }
+ | INT { $$ = "System.Int32"; }
+ | UINT { $$ = "System.UInt32"; }
+ | LONG { $$ = "System.Int64"; }
+ | ULONG { $$ = "System.UInt64"; }
+ | CHAR { $$ = "System.Char"; }
+ | VOID { $$ = "System.Void"; }
+ ;
+
+interface_type
+ : type_name
+ ;
+
+array_type
+ : type rank_specifiers
+ {
+ $$ = (string) $1 + (string) $2;
+ }
+ ;
+
+//
+// Expressions, section 7.5
+//
+primary_expression
+ : literal
+ {
+ // 7.5.1: Literals
+ }
+
+ | qualified_identifier
+ {
+ string name = (string) $1;
+
+ $$ = null;
+ $$ = DecomposeQI (name, lexer.Location);
+ }
+ | parenthesized_expression
+ | member_access
+ | invocation_expression
+ | element_access
+ | this_access
+ | base_access
+ | post_increment_expression
+ | post_decrement_expression
+ | new_expression
+ | typeof_expression
+ | sizeof_expression
+ | checked_expression
+ | unchecked_expression
+ | pointer_member_access
+ // TODO: pointer_element_access
+ // TODO: sizeof-expression
+ ;
+
+literal
+ : boolean_literal
+ | integer_literal
+ | real_literal
+ | LITERAL_CHARACTER { $$ = new CharLiteral ((char) lexer.Value); }
+ | LITERAL_STRING { $$ = new StringLiteral ((string) lexer.Value); }
+ | NULL { $$ = NullLiteral.Null; }
+ ;
+
+real_literal
+ : LITERAL_FLOAT { $$ = new FloatLiteral ((float) lexer.Value); }
+ | LITERAL_DOUBLE { $$ = new DoubleLiteral ((double) lexer.Value); }
+ | LITERAL_DECIMAL { $$ = new DecimalLiteral ((decimal) lexer.Value); }
+ ;
+
+integer_literal
+ : LITERAL_INTEGER {
+ object v = lexer.Value;
+
+ //
+ // FIXME: Possible optimization would be to
+ // compute the *Literal objects directly in the scanner
+ //
+ if (v is int)
+ $$ = new IntLiteral ((Int32) v);
+ else if (v is uint)
+ $$ = new UIntLiteral ((UInt32) v);
+ else if (v is long)
+ $$ = new LongLiteral ((Int64) v);
+ else if (v is ulong)
+ $$ = new ULongLiteral ((UInt64) v);
+ else
+ Console.WriteLine ("OOPS. Unexpected result from scanner");
+ }
+ ;
+
+boolean_literal
+ : TRUE { $$ = new BoolLiteral (true); }
+ | FALSE { $$ = new BoolLiteral (false); }
+ ;
+
+parenthesized_expression
+ : OPEN_PARENS expression CLOSE_PARENS
+ { $$ = $2; }
+ ;
+
+member_access
+ : primary_expression DOT IDENTIFIER
+ {
+ $$ = new MemberAccess ((Expression) $1, (string) $3, lexer.Location);
+ }
+ | predefined_type DOT IDENTIFIER
+ {
+ $$ = new MemberAccess (new SimpleName ((string) $1, lexer.Location), (string) $3, lexer.Location);
+ }
+ ;
+
+predefined_type
+ : builtin_types
+ ;
+
+invocation_expression
+ : primary_expression OPEN_PARENS opt_argument_list CLOSE_PARENS
+ {
+ if ($1 == null) {
+ Location l = lexer.Location;
+ Report.Error (1, l, "THIS IS CRAZY");
+ }
+ $$ = new Invocation ((Expression) $1, (ArrayList) $3, lexer.Location);
+ }
+ ;
+
+opt_argument_list
+ : /* empty */ { $$ = null; }
+ | argument_list
+ ;
+
+argument_list
+ : argument
+ {
+ ArrayList list = new ArrayList ();
+ list.Add ($1);
+ $$ = list;
+ }
+ | argument_list COMMA argument
+ {
+ ArrayList list = (ArrayList) $1;
+ list.Add ($3);
+ $$ = list;
+ }
+ ;
+
+argument
+ : expression
+ {
+ $$ = new Argument ((Expression) $1, Argument.AType.Expression);
+ }
+ | REF variable_reference
+ {
+ $$ = new Argument ((Expression) $2, Argument.AType.Ref);
+ }
+ | OUT variable_reference
+ {
+ $$ = new Argument ((Expression) $2, Argument.AType.Out);
+ }
+ ;
+
+variable_reference
+ : expression { note ("section 5.4"); $$ = $1; }
+ ;
+
+element_access
+ : primary_expression OPEN_BRACKET expression_list CLOSE_BRACKET
+ {
+ $$ = new ElementAccess ((Expression) $1, (ArrayList) $3, lexer.Location);
+ }
+ | primary_expression rank_specifiers
+ {
+ // So the super-trick is that primary_expression
+ // can only be either a SimpleName or a MemberAccess.
+ // The MemberAccess case arises when you have a fully qualified type-name like :
+ // Foo.Bar.Blah i;
+ // SimpleName is when you have
+ // Blah i;
+
+ Expression expr = (Expression) $1;
+ if (!(expr is SimpleName || expr is MemberAccess)) {
+ Location l = lexer.Location;
+ Report.Error (-1, l, "Invalid Type definition");
+ $$ = "System.Object";
+ }
+
+ //
+ // So we extract the string corresponding to the SimpleName
+ // or MemberAccess
+ //
+ $$ = new SimpleName (GetQualifiedIdentifier (expr) + (string) $2, lexer.Location);
+ }
+ ;
+
+expression_list
+ : expression
+ {
+ ArrayList list = new ArrayList ();
+ list.Add ($1);
+ $$ = list;
+ }
+ | expression_list COMMA expression
+ {
+ ArrayList list = (ArrayList) $1;
+ list.Add ($3);
+ $$ = list;
+ }
+ ;
+
+this_access
+ : THIS
+ {
+ $$ = new This (lexer.Location);
+ }
+ ;
+
+base_access
+ : BASE DOT IDENTIFIER
+ {
+ $$ = new BaseAccess ((string) $3, lexer.Location);
+ }
+ | BASE OPEN_BRACKET expression_list CLOSE_BRACKET
+ {
+ $$ = new BaseIndexerAccess ((ArrayList) $3, lexer.Location);
+ }
+ ;
+
+post_increment_expression
+ : primary_expression OP_INC
+ {
+ $$ = new UnaryMutator (UnaryMutator.Mode.PostIncrement,
+ (Expression) $1, lexer.Location);
+ }
+ ;
+
+post_decrement_expression
+ : primary_expression OP_DEC
+ {
+ $$ = new UnaryMutator (UnaryMutator.Mode.PostDecrement,
+ (Expression) $1, lexer.Location);
+ }
+ ;
+
+new_expression
+ : object_or_delegate_creation_expression
+ | array_creation_expression
+ ;
+
+object_or_delegate_creation_expression
+ : NEW type OPEN_PARENS opt_argument_list CLOSE_PARENS
+ {
+ $$ = new New ((string) $2, (ArrayList) $4, lexer.Location);
+ }
+ ;
+
+array_creation_expression
+ : NEW type OPEN_BRACKET expression_list CLOSE_BRACKET
+ opt_rank_specifier
+ opt_array_initializer
+ {
+ $$ = new ArrayCreation ((string) $2, (ArrayList) $4, (string) $6, (ArrayList) $7,
+ lexer.Location);
+ }
+ | NEW type rank_specifiers array_initializer
+ {
+ $$ = new ArrayCreation ((string) $2, (string) $3, (ArrayList) $4, lexer.Location);
+ }
+ | NEW type error
+ {
+ Report.Error (1526, lexer.Location, "new expression requires () or [] after type");
+ }
+ ;
+
+opt_rank_specifier
+ : /* empty */
+ {
+ $$ = "";
+ }
+ | rank_specifiers
+ {
+ $$ = $1;
+ }
+ ;
+
+rank_specifiers
+ : rank_specifier
+ {
+ $$ = $1;
+ }
+ | rank_specifiers rank_specifier
+ {
+ $$ = (string) $2 + (string) $1;
+ }
+ ;
+
+rank_specifier
+ : OPEN_BRACKET opt_dim_separators CLOSE_BRACKET
+ {
+ $$ = "[" + (string) $2 + "]";
+ }
+ ;
+
+opt_dim_separators
+ : /* empty */
+ {
+ $$ = "";
+ }
+ | dim_separators
+ {
+ $$ = $1;
+ }
+ ;
+
+dim_separators
+ : COMMA
+ {
+ $$ = ",";
+ }
+ | dim_separators COMMA
+ {
+ $$ = (string) $1 + ",";
+ }
+ ;
+
+opt_array_initializer
+ : /* empty */
+ {
+ $$ = null;
+ }
+ | array_initializer
+ {
+ $$ = $1;
+ }
+ ;
+
+array_initializer
+ : OPEN_BRACE CLOSE_BRACE
+ {
+ ArrayList list = new ArrayList ();
+ $$ = list;
+ }
+ | OPEN_BRACE variable_initializer_list opt_comma CLOSE_BRACE
+ {
+ $$ = (ArrayList) $2;
+ }
+ ;
+
+variable_initializer_list
+ : variable_initializer
+ {
+ ArrayList list = new ArrayList ();
+ list.Add ($1);
+ $$ = list;
+ }
+ | variable_initializer_list COMMA variable_initializer
+ {
+ ArrayList list = (ArrayList) $1;
+ list.Add ($3);
+ $$ = list;
+ }
+ ;
+
+typeof_expression
+ : TYPEOF OPEN_PARENS type CLOSE_PARENS
+ {
+ $$ = new TypeOf ((string) $3, lexer.Location);
+ }
+ ;
+
+sizeof_expression
+ : SIZEOF OPEN_PARENS type CLOSE_PARENS {
+ $$ = new SizeOf ((string) $3, lexer.Location);
+
+ note ("Verify type is unmanaged");
+ note ("if (5.8) builtin, yield constant expression");
+ }
+ ;
+
+checked_expression
+ : CHECKED OPEN_PARENS expression CLOSE_PARENS
+ {
+ $$ = new CheckedExpr ((Expression) $3);
+ }
+ ;
+
+unchecked_expression
+ : UNCHECKED OPEN_PARENS expression CLOSE_PARENS
+ {
+ $$ = new UnCheckedExpr ((Expression) $3);
+ }
+ ;
+
+pointer_member_access
+ : primary_expression OP_PTR IDENTIFIER
+ {
+ Expression deref;
+
+ deref = new Unary (Unary.Operator.Indirection, (Expression) $1, lexer.Location);
+ $$ = new MemberAccess (deref, (string) $3, lexer.Location);
+ }
+
+unary_expression
+ : primary_expression
+ | BANG prefixed_unary_expression
+ {
+ $$ = new Unary (Unary.Operator.LogicalNot, (Expression) $2, lexer.Location);
+ }
+ | TILDE prefixed_unary_expression
+ {
+ $$ = new Unary (Unary.Operator.OnesComplement, (Expression) $2, lexer.Location);
+ }
+ | OPEN_PARENS expression CLOSE_PARENS unary_expression
+ {
+ $$ = new Cast ((Expression) $2, (Expression) $4, lexer.Location);
+ }
+ | OPEN_PARENS non_expression_type CLOSE_PARENS prefixed_unary_expression
+ {
+ $$ = new Cast ((Expression) $2, (Expression) $4, lexer.Location);
+ }
+ ;
+
+ //
+ // The idea to split this out is from Rhys' grammar
+ // to solve the problem with casts.
+ //
+prefixed_unary_expression
+ : unary_expression
+ | PLUS prefixed_unary_expression
+ {
+ $$ = new Unary (Unary.Operator.UnaryPlus, (Expression) $2, lexer.Location);
+ }
+ | MINUS prefixed_unary_expression
+ {
+ $$ = new Unary (Unary.Operator.UnaryNegation, (Expression) $2, lexer.Location);
+ }
+ | OP_INC prefixed_unary_expression
+ {
+ $$ = new UnaryMutator (UnaryMutator.Mode.PreIncrement,
+ (Expression) $2, lexer.Location);
+ }
+ | OP_DEC prefixed_unary_expression
+ {
+ $$ = new UnaryMutator (UnaryMutator.Mode.PreDecrement,
+ (Expression) $2, lexer.Location);
+ }
+ | STAR prefixed_unary_expression
+ {
+ $$ = new Unary (Unary.Operator.Indirection, (Expression) $2, lexer.Location);
+ }
+ | BITWISE_AND prefixed_unary_expression
+ {
+ $$ = new Unary (Unary.Operator.AddressOf, (Expression) $2, lexer.Location);
+ }
+ ;
+
+pre_increment_expression
+ : OP_INC prefixed_unary_expression
+ {
+ $$ = new UnaryMutator (UnaryMutator.Mode.PreIncrement,
+ (Expression) $2, lexer.Location);
+ }
+ ;
+
+pre_decrement_expression
+ : OP_DEC prefixed_unary_expression
+ {
+ $$ = new UnaryMutator (UnaryMutator.Mode.PreDecrement,
+ (Expression) $2, lexer.Location);
+ }
+ ;
+
+multiplicative_expression
+ : prefixed_unary_expression
+ | multiplicative_expression STAR prefixed_unary_expression
+ {
+ $$ = new Binary (Binary.Operator.Multiply,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ | multiplicative_expression DIV prefixed_unary_expression
+ {
+ $$ = new Binary (Binary.Operator.Division,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ | multiplicative_expression PERCENT prefixed_unary_expression
+ {
+ $$ = new Binary (Binary.Operator.Modulus,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ ;
+
+additive_expression
+ : multiplicative_expression
+ | additive_expression PLUS multiplicative_expression
+ {
+ $$ = new Binary (Binary.Operator.Addition,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ | additive_expression MINUS multiplicative_expression
+ {
+ $$ = new Binary (Binary.Operator.Subtraction,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ ;
+
+shift_expression
+ : additive_expression
+ | shift_expression OP_SHIFT_LEFT additive_expression
+ {
+ $$ = new Binary (Binary.Operator.LeftShift,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ | shift_expression OP_SHIFT_RIGHT additive_expression
+ {
+ $$ = new Binary (Binary.Operator.RightShift,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ ;
+
+relational_expression
+ : shift_expression
+ | relational_expression OP_LT shift_expression
+ {
+ $$ = new Binary (Binary.Operator.LessThan,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ | relational_expression OP_GT shift_expression
+ {
+ $$ = new Binary (Binary.Operator.GreaterThan,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ | relational_expression OP_LE shift_expression
+ {
+ $$ = new Binary (Binary.Operator.LessThanOrEqual,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ | relational_expression OP_GE shift_expression
+ {
+ $$ = new Binary (Binary.Operator.GreaterThanOrEqual,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ | relational_expression IS type
+ {
+ $$ = new Is ((Expression) $1, (string) $3, lexer.Location);
+ }
+ | relational_expression AS type
+ {
+ $$ = new As ((Expression) $1, (string) $3, lexer.Location);
+ }
+ ;
+
+equality_expression
+ : relational_expression
+ | equality_expression OP_EQ relational_expression
+ {
+ $$ = new Binary (Binary.Operator.Equality,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ | equality_expression OP_NE relational_expression
+ {
+ $$ = new Binary (Binary.Operator.Inequality,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ ;
+
+and_expression
+ : equality_expression
+ | and_expression BITWISE_AND equality_expression
+ {
+ $$ = new Binary (Binary.Operator.BitwiseAnd,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ ;
+
+exclusive_or_expression
+ : and_expression
+ | exclusive_or_expression CARRET and_expression
+ {
+ $$ = new Binary (Binary.Operator.ExclusiveOr,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ ;
+
+inclusive_or_expression
+ : exclusive_or_expression
+ | inclusive_or_expression BITWISE_OR exclusive_or_expression
+ {
+ $$ = new Binary (Binary.Operator.BitwiseOr,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ ;
+
+conditional_and_expression
+ : inclusive_or_expression
+ | conditional_and_expression OP_AND inclusive_or_expression
+ {
+ $$ = new Binary (Binary.Operator.LogicalAnd,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ ;
+
+conditional_or_expression
+ : conditional_and_expression
+ | conditional_or_expression OP_OR conditional_and_expression
+ {
+ $$ = new Binary (Binary.Operator.LogicalOr,
+ (Expression) $1, (Expression) $3, lexer.Location);
+ }
+ ;
+
+conditional_expression
+ : conditional_or_expression
+ | conditional_or_expression INTERR expression COLON expression
+ {
+ $$ = new Conditional ((Expression) $1, (Expression) $3, (Expression) $5, lexer.Location);
+ }
+ ;
+
+assignment_expression
+ : prefixed_unary_expression ASSIGN expression
+ {
+ $$ = new Assign ((Expression) $1, (Expression) $3, lexer.Location);
+ }
+ | prefixed_unary_expression OP_MULT_ASSIGN expression
+ {
+ Location l = lexer.Location;
+
+ $$ = new Assign ((Expression) $1,
+ new Binary (Binary.Operator.Multiply,
+ (Expression) $1,
+ (Expression) $3, l), l);
+ }
+ | prefixed_unary_expression OP_DIV_ASSIGN expression
+ {
+ Location l = lexer.Location;
+
+ $$ = new Assign ((Expression) $1,
+ new Binary (Binary.Operator.Division,
+ (Expression) $1,
+ (Expression) $3, l), l);
+ }
+ | prefixed_unary_expression OP_MOD_ASSIGN expression
+ {
+ Location l = lexer.Location;
+
+ $$ = new Assign ((Expression) $1,
+ new Binary (Binary.Operator.Modulus,
+ (Expression) $1,
+ (Expression) $3, l), l);
+ }
+ | prefixed_unary_expression OP_ADD_ASSIGN expression
+ {
+ Location l = lexer.Location;
+
+ $$ = new Assign ((Expression) $1,
+ new Binary (Binary.Operator.Addition,
+ (Expression) $1,
+ (Expression) $3, l), l);
+ }
+ | prefixed_unary_expression OP_SUB_ASSIGN expression
+ {
+ Location l = lexer.Location;
+
+ $$ = new Assign ((Expression) $1,
+ new Binary (Binary.Operator.Subtraction,
+ (Expression) $1,
+ (Expression) $3, l), l);
+ }
+ | prefixed_unary_expression OP_SHIFT_LEFT_ASSIGN expression
+ {
+ Location l = lexer.Location;
+
+ $$ = new Assign ((Expression) $1,
+ new Binary (Binary.Operator.LeftShift,
+ (Expression) $1,
+ (Expression) $3, l), l);
+ }
+ | prefixed_unary_expression OP_SHIFT_RIGHT_ASSIGN expression
+ {
+ Location l = lexer.Location;
+
+ $$ = new Assign ((Expression) $1,
+ new Binary (Binary.Operator.RightShift,
+ (Expression) $1,
+ (Expression) $3, l), l);
+ }
+ | prefixed_unary_expression OP_AND_ASSIGN expression
+ {
+ Location l = lexer.Location;
+
+ $$ = new Assign ((Expression) $1,
+ new Binary (Binary.Operator.BitwiseAnd,
+ (Expression) $1,
+ (Expression) $3, l), l);
+ }
+ | prefixed_unary_expression OP_OR_ASSIGN expression
+ {
+ Location l = lexer.Location;
+
+ $$ = new Assign ((Expression) $1,
+ new Binary (Binary.Operator.BitwiseOr,
+ (Expression) $1,
+ (Expression) $3, l), l);
+ }
+ | prefixed_unary_expression OP_XOR_ASSIGN expression
+ {
+ Location l = lexer.Location;
+
+ $$ = new Assign ((Expression) $1,
+ new Binary (Binary.Operator.ExclusiveOr,
+ (Expression) $1,
+ (Expression) $3, l), l);
+ }
+ ;
+
+expression
+ : conditional_expression
+ | assignment_expression
+ ;
+
+constant_expression
+ : expression
+ ;
+
+boolean_expression
+ : expression
+ ;
+
+//
+// 10 classes
+//
+class_declaration
+ : opt_attributes
+ opt_modifiers
+ CLASS IDENTIFIER
+ {
+ Class new_class;
+ string name;
+
+ name = MakeName ((string) $4);
+
+ new_class = new Class (current_container, name, (int) $2,
+ (Attributes) $1, lexer.Location);
+ current_container = new_class;
+ current_container.Namespace = current_namespace;
+ RootContext.Tree.RecordDecl (name, new_class);
+ }
+ opt_class_base
+ class_body
+ opt_semicolon
+ {
+ Class new_class = (Class) current_container;
+
+ if ($6 != null)
+ new_class.Bases = (ArrayList) $6;
+
+ current_container = current_container.Parent;
+ CheckDef (current_container.AddClass (new_class), new_class.Name, new_class.Location);
+
+ $$ = new_class;
+ }
+ ;
+
+opt_modifiers
+ : /* empty */ { $$ = (int) 0; }
+ | modifiers
+ ;
+
+modifiers
+ : modifier
+ | modifiers modifier
+ {
+ int m1 = (int) $1;
+ int m2 = (int) $2;
+
+ if ((m1 & m2) != 0) {
+ Location l = lexer.Location;
+ Report.Error (1004, l, "Duplicate modifier: `" + Modifiers.Name (m2) + "'");
+ }
+ $$ = (int) (m1 | m2);
+ }
+ ;
+
+modifier
+ : NEW { $$ = Modifiers.NEW; }
+ | PUBLIC { $$ = Modifiers.PUBLIC; }
+ | PROTECTED { $$ = Modifiers.PROTECTED; }
+ | INTERNAL { $$ = Modifiers.INTERNAL; }
+ | PRIVATE { $$ = Modifiers.PRIVATE; }
+ | ABSTRACT { $$ = Modifiers.ABSTRACT; }
+ | SEALED { $$ = Modifiers.SEALED; }
+ | STATIC { $$ = Modifiers.STATIC; }
+ | READONLY { $$ = Modifiers.READONLY; }
+ | VIRTUAL { $$ = Modifiers.VIRTUAL; }
+ | OVERRIDE { $$ = Modifiers.OVERRIDE; }
+ | EXTERN { $$ = Modifiers.EXTERN; }
+ | VOLATILE { $$ = Modifiers.VOLATILE; }
+ | UNSAFE { $$ = Modifiers.UNSAFE; }
+ ;
+
+opt_class_base
+ : /* empty */ { $$ = null; }
+ | class_base { $$ = $1; }
+ ;
+
+class_base
+ : COLON type_list { $$ = $2; }
+ ;
+
+//
+// Statements (8.2)
+//
+
+//
+// A block is "contained" on the following places:
+// method_body
+// property_declaration as part of the accessor body (get/set)
+// operator_declaration
+// constructor_declaration
+// destructor_declaration
+// event_declaration as part of add_accessor_declaration or remove_accessor_declaration
+//
+block
+ : OPEN_BRACE
+ {
+ current_block = new Block (current_block, lexer.Location, Location.Null);
+ }
+ opt_statement_list CLOSE_BRACE
+ {
+ while (current_block.Implicit)
+ current_block = current_block.Parent;
+ $$ = current_block;
+ current_block.SetEndLocation (lexer.Location);
+ current_block = current_block.Parent;
+ }
+ ;
+
+opt_statement_list
+ : /* empty */
+ | statement_list
+ ;
+
+statement_list
+ : statement
+ | statement_list statement
+ ;
+
+statement
+ : declaration_statement
+ {
+ if ((Block) $1 != current_block){
+ current_block.AddStatement ((Statement) $1);
+ current_block = (Block) $1;
+ }
+ }
+ | embedded_statement
+ {
+ Statement s = (Statement) $1;
+
+
+ current_block.AddStatement ((Statement) $1);
+ }
+ | labeled_statement
+ ;
+
+embedded_statement
+ : block
+ | empty_statement
+ | expression_statement
+ | selection_statement
+ | iteration_statement
+ | jump_statement
+ | try_statement
+ | checked_statement
+ | unchecked_statement
+ | lock_statement
+ | using_statement
+ | unsafe_statement
+ | fixed_statement
+ ;
+
+empty_statement
+ : SEMICOLON
+ {
+ $$ = new EmptyStatement ();
+ }
+ ;
+
+labeled_statement
+ : IDENTIFIER COLON
+ {
+ LabeledStatement labeled = new LabeledStatement ((string) $1);
+
+ if (!current_block.AddLabel ((string) $1, labeled)){
+ Location l = lexer.Location;
+ Report.Error (140, l, "The label '" + ((string) $1) + "' is a duplicate");
+ }
+ current_block.AddStatement (labeled);
+ }
+ statement
+ ;
+
+declaration_statement
+ : local_variable_declaration SEMICOLON
+ {
+ DictionaryEntry de = (DictionaryEntry) $1;
+
+ $$ = declare_local_variables ((string) de.Key, (ArrayList) de.Value, lexer.Location);
+ }
+
+ | local_constant_declaration SEMICOLON
+ {
+ DictionaryEntry de = (DictionaryEntry) $1;
+
+ $$ = declare_local_constant ((string) de.Key, (VariableDeclaration) de.Value);
+ }
+ ;
+
+/*
+ * The following is from Rhys' grammar:
+ * > Types in local variable declarations must be recognized as
+ * > expressions to prevent reduce/reduce errors in the grammar.
+ * > The expressions are converted into types during semantic analysis.
+ */
+local_variable_type
+ : primary_expression opt_rank_specifier
+ {
+ // FIXME: Do something smart here regarding the composition of the 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
+ // really) two shift/reduces appear.
+ //
+
+ // So the super-trick is that primary_expression
+ // can only be either a SimpleName or a MemberAccess.
+ // The MemberAccess case arises when you have a fully qualified type-name like :
+ // Foo.Bar.Blah i;
+ // SimpleName is when you have
+ // Blah i;
+
+ Expression expr = (Expression) $1;
+ if (!(expr is SimpleName || expr is MemberAccess)) {
+ Location l = lexer.Location;
+ Report.Error (-1, l, "Invalid Type definition");
+ $$ = "System.Object";
+ }
+
+ //
+ // So we extract the string corresponding to the SimpleName
+ // or MemberAccess
+ //
+ $$ = GetQualifiedIdentifier (expr) + (string) $2;
+ }
+ | builtin_types opt_rank_specifier
+ {
+ $$ = (string) $1 + (string) $2;
+ }
+ ;
+
+local_variable_pointer_type
+ : primary_expression STAR
+ {
+ Expression expr = (Expression) $1;
+ if (!(expr is SimpleName || expr is MemberAccess)) {
+ Location l = lexer.Location;
+ Report.Error (-1, l, "Invalid Type definition");
+ $$ = "System.Object";
+ }
+
+ $$ = GetQualifiedIdentifier (expr) + "*";
+ }
+ | builtin_types STAR
+ {
+ $$ = (string) $1 + "*";
+ }
+ | VOID STAR
+ {
+ $$ = "System.Void*";
+ }
+ | local_variable_pointer_type STAR
+ {
+ $$ = (string) $1 + "*";
+ }
+ ;
+
+local_variable_declaration
+ : local_variable_type variable_declarators
+ {
+ $$ = new DictionaryEntry ($1, $2);
+ }
+ | local_variable_pointer_type opt_rank_specifier variable_declarators
+ {
+ $$ = new DictionaryEntry ((string) $1 + (string) $2, $3);
+ }
+ ;
+
+local_constant_declaration
+ : CONST local_variable_type constant_declarator
+ {
+ $$ = new DictionaryEntry ($2, $3);
+ }
+ ;
+
+expression_statement
+ : statement_expression SEMICOLON
+ {
+ $$ = $1;
+ }
+ ;
+
+ //
+ // We have to do the wrapping here and not in the case above,
+ // because statement_expression is used for example in for_statement
+ //
+statement_expression
+ : invocation_expression { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
+ | object_creation_expression { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
+ | assignment_expression { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
+ | post_increment_expression { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
+ | post_decrement_expression { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
+ | pre_increment_expression { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
+ | pre_decrement_expression { $$ = new StatementExpression ((ExpressionStatement) $1, lexer.Location); }
+ | error {
+ Report.Error (1002, lexer.Location, "Expecting `;'");
+ }
+ ;
+
+object_creation_expression
+ : object_or_delegate_creation_expression
+ { note ("complain if this is a delegate maybe?"); }
+ ;
+
+selection_statement
+ : if_statement
+ | switch_statement
+ ;
+
+if_statement
+ : if_statement_open if_statement_rest
+ {
+ $$ = $2;
+ }
+ ;
+
+if_statement_open
+ : IF OPEN_PARENS
+ {
+ oob_stack.Push (lexer.Location);
+ }
+ ;
+
+if_statement_rest
+ : boolean_expression CLOSE_PARENS
+ embedded_statement
+ {
+ Location l = (Location) oob_stack.Pop ();
+
+ $$ = new If ((Expression) $1, (Statement) $3, l);
+
+ if (RootContext.WarningLevel >= 3){
+ if ($3 is EmptyStatement)
+ Report.Warning (642, lexer.Location, "Possibly mistaken empty statement");
+ }
+
+ }
+ | boolean_expression CLOSE_PARENS
+ embedded_statement ELSE embedded_statement
+ {
+ Location l = (Location) oob_stack.Pop ();
+
+ $$ = new If ((Expression) $1, (Statement) $3, (Statement) $5, l);
+ }
+ ;
+
+switch_statement
+ : SWITCH OPEN_PARENS
+ {
+ oob_stack.Push (lexer.Location);
+ }
+ expression CLOSE_PARENS
+ switch_block
+ {
+ $$ = new Switch ((Expression) $4, (ArrayList) $6, (Location) oob_stack.Pop ());
+ }
+ ;
+
+switch_block
+ : OPEN_BRACE
+ opt_switch_sections
+ CLOSE_BRACE
+ {
+ $$ = $2;
+ }
+ ;
+
+opt_switch_sections
+ : /* empty */
+ {
+ Report.Error (1522, lexer.Location, "Empty switch block");
+ }
+ | switch_sections
+ ;
+
+switch_sections
+ : switch_section
+ {
+ ArrayList sections = new ArrayList ();
+
+ sections.Add ($1);
+ $$ = sections;
+ }
+ | switch_sections switch_section
+ {
+ ArrayList sections = (ArrayList) $1;
+
+ sections.Add ($2);
+ $$ = sections;
+ }
+ ;
+
+switch_section
+ : switch_labels
+ {
+ current_block = new Block (current_block);
+ }
+ statement_list
+ {
+ while (current_block.Implicit)
+ current_block = current_block.Parent;
+ $$ = new SwitchSection ((ArrayList) $1, current_block);
+ current_block = current_block.Parent;
+ }
+ ;
+
+switch_labels
+ : switch_label
+ {
+ ArrayList labels = new ArrayList ();
+
+ labels.Add ($1);
+ $$ = labels;
+ }
+ | switch_labels switch_label
+ {
+ ArrayList labels = (ArrayList) ($1);
+ labels.Add ($2);
+
+ $$ = labels;
+ }
+ ;
+
+switch_label
+ : CASE constant_expression COLON { $$ = new SwitchLabel ((Expression) $2, lexer.Location); }
+ | DEFAULT COLON { $$ = new SwitchLabel (null, lexer.Location); }
+ | error {
+ Report.Error (
+ 1523, lexer.Location,
+ "The keyword case or default must precede code in switch block");
+ }
+ ;
+
+iteration_statement
+ : while_statement
+ | do_statement
+ | for_statement
+ | foreach_statement
+ ;
+
+while_statement
+ : WHILE OPEN_PARENS
+ {
+ oob_stack.Push (lexer.Location);
+ }
+ boolean_expression CLOSE_PARENS embedded_statement
+ {
+ Location l = (Location) oob_stack.Pop ();
+ $$ = new While ((Expression) $4, (Statement) $6, l);
+
+ if (RootContext.WarningLevel >= 3){
+ if ($6 is EmptyStatement)
+ Report.Warning (642, lexer.Location, "Possibly mistaken empty statement");
+ }
+ }
+ ;
+
+do_statement
+ : DO embedded_statement
+ WHILE OPEN_PARENS boolean_expression CLOSE_PARENS SEMICOLON
+ {
+ $$ = new Do ((Statement) $2, (Expression) $5, lexer.Location);
+ }
+ ;
+
+for_statement
+ : FOR OPEN_PARENS
+ opt_for_initializer SEMICOLON
+ {
+ Block assign_block = new Block (current_block);
+ current_block = assign_block;
+
+ if ($3 is DictionaryEntry){
+ DictionaryEntry de = (DictionaryEntry) $3;
+
+ string type = (string) de.Key;
+ ArrayList var_declarators = (ArrayList) de.Value;
+
+ foreach (VariableDeclaration decl in var_declarators){
+
+ VariableInfo vi;
+
+ vi = current_block.AddVariable (
+ type, decl.identifier, current_local_parameters, decl.Location);
+ if (vi == null){
+ Report.Error (128, decl.Location,
+ "A local variable `" + decl.identifier +
+ "' is already defined in this scope");
+ } else {
+ Location l = lexer.Location;
+ Expression expr;
+ if (decl.expression_or_array_initializer is Expression){
+ expr = (Expression) decl.expression_or_array_initializer;
+
+ } else {
+
+ ArrayList init = (ArrayList) decl.expression_or_array_initializer;
+
+ string base_type = type.Substring (0, type.IndexOf ("["));
+ string rank = type.Substring (type.IndexOf ("["));
+
+ expr = new ArrayCreation (base_type, rank, init, decl.Location);
+ }
+
+ LocalVariableReference var;
+ var = new LocalVariableReference (
+ assign_block, decl.identifier, l);
+
+ Assign a = new Assign (var, expr, decl.Location);
+
+ assign_block.AddStatement (new StatementExpression (a, lexer.Location));
+ }
+ }
+
+ $3 = null;
+ }
+ oob_stack.Push (lexer.Location);
+ }
+ opt_for_condition SEMICOLON
+ opt_for_iterator CLOSE_PARENS
+ embedded_statement
+ {
+ Location l = (Location) oob_stack.Pop ();
+
+ For f = new For ((Statement) $3, (Expression) $6, (Statement) $8, (Statement) $10, l);
+
+ if (RootContext.WarningLevel >= 3){
+ if ($10 is EmptyStatement)
+ Report.Warning (642, lexer.Location, "Possibly mistaken empty statement");
+ }
+
+ current_block.AddStatement (f);
+ while (current_block.Implicit)
+ current_block = current_block.Parent;
+ $$ = current_block;
+ current_block = current_block.Parent;
+ }
+ ;
+
+opt_for_initializer
+ : /* empty */ { $$ = new EmptyStatement (); }
+ | for_initializer
+ ;
+
+for_initializer
+ : local_variable_declaration
+ | statement_expression_list
+ ;
+
+opt_for_condition
+ : /* empty */ { $$ = null; }
+ | boolean_expression
+ ;
+
+opt_for_iterator
+ : /* empty */ { $$ = new EmptyStatement (); }
+ | for_iterator
+ ;
+
+for_iterator
+ : statement_expression_list
+ ;
+
+statement_expression_list
+ : statement_expression
+ {
+ // CHANGE: was `null'
+ Block b = new Block (current_block, true);
+
+ b.AddStatement ((Statement) $1);
+ $$ = b;
+ }
+ | statement_expression_list COMMA statement_expression
+ {
+ Block b = (Block) $1;
+
+ b.AddStatement ((Statement) $3);
+ $$ = $1;
+ }
+ ;
+
+foreach_statement
+ : FOREACH OPEN_PARENS type IDENTIFIER IN
+ {
+ oob_stack.Push (lexer.Location);
+ }
+ expression CLOSE_PARENS
+ {
+ oob_stack.Push (current_block);
+
+ Block foreach_block = new Block (current_block, true);
+ LocalVariableReference v;
+ Location l = lexer.Location;
+ VariableInfo vi;
+
+ vi = foreach_block.AddVariable ((string) $3, (string) $4, current_local_parameters, l);
+ if (vi == null){
+ Report.Error (
+ 128, l, "A local variable `" + (string) $4 + "' is already "+
+ "defined in this scope");
+ }
+
+ v = new LocalVariableReference (foreach_block, (string) $4, l);
+ current_block = foreach_block;
+
+ oob_stack.Push (v);
+ oob_stack.Push (current_block);
+ }
+ embedded_statement
+ {
+ Block foreach_block = (Block) oob_stack.Pop ();
+ LocalVariableReference v = (LocalVariableReference) oob_stack.Pop ();
+ Block prev_block = (Block) oob_stack.Pop ();
+ Location l = (Location) oob_stack.Pop ();
+
+ current_block = prev_block;
+
+ Foreach f = new Foreach ((string) $3, v, (Expression) $7, (Statement) $10, l);
+ foreach_block.AddStatement (f);
+
+ $$ = foreach_block;
+ }
+ ;
+
+jump_statement
+ : break_statement
+ | continue_statement
+ | goto_statement
+ | return_statement
+ | throw_statement
+ ;
+
+break_statement
+ : BREAK SEMICOLON
+ {
+ $$ = new Break (lexer.Location);
+ }
+ ;
+
+continue_statement
+ : CONTINUE SEMICOLON
+ {
+ $$ = new Continue (lexer.Location);
+ }
+ ;
+
+goto_statement
+ : GOTO IDENTIFIER SEMICOLON
+ {
+ $$ = new Goto (current_block, (string) $2, lexer.Location);
+ }
+ | GOTO CASE constant_expression SEMICOLON
+ {
+ $$ = new GotoCase ((Expression) $3, lexer.Location);
+ }
+ | GOTO DEFAULT SEMICOLON
+ {
+ $$ = new GotoDefault (lexer.Location);
+ }
+ ;
+
+return_statement
+ : RETURN opt_expression SEMICOLON
+ {
+ $$ = new Return ((Expression) $2, lexer.Location);
+ }
+ ;
+
+throw_statement
+ : THROW opt_expression SEMICOLON
+ {
+ $$ = new Throw ((Expression) $2, lexer.Location);
+ }
+ ;
+
+opt_expression
+ : /* empty */
+ | expression
+ ;
+
+try_statement
+ : TRY block catch_clauses
+ {
+ Catch g = null;
+ ArrayList s = new ArrayList ();
+
+ foreach (Catch cc in (ArrayList) $3) {
+ if (cc.Type == null)
+ g = cc;
+ else
+ s.Add (cc);
+ }
+
+ // Now s contains the list of specific catch clauses
+ // and g contains the general one.
+
+ $$ = new Try ((Block) $2, s, g, null);
+ }
+ | TRY block opt_catch_clauses FINALLY block
+ {
+ Catch g = null;
+ ArrayList s = new ArrayList ();
+ ArrayList catch_list = (ArrayList) $3;
+
+ if (catch_list != null){
+ foreach (Catch cc in catch_list) {
+ if (cc.Type == null)
+ g = cc;
+ else
+ s.Add (cc);
+ }
+ }
+
+ $$ = new Try ((Block) $2, s, g, (Block) $5);
+ }
+ | TRY block error
+ {
+ Report.Error (1524, lexer.Location, "Expected catch or finally");
+ }
+ ;
+
+opt_catch_clauses
+ : /* empty */ { $$ = null; }
+ | catch_clauses
+ ;
+
+catch_clauses
+ : catch_clause
+ {
+ ArrayList l = new ArrayList ();
+
+ l.Add ($1);
+ $$ = l;
+ }
+ | catch_clauses catch_clause
+ {
+ ArrayList l = (ArrayList) $1;
+
+ l.Add ($2);
+ $$ = l;
+ }
+ ;
+
+opt_identifier
+ : /* empty */ { $$ = null; }
+ | IDENTIFIER
+ ;
+
+catch_clause
+ : CATCH opt_catch_args
+ {
+ string type = null, id = null;
+
+ if ($2 != null) {
+ DictionaryEntry cc = (DictionaryEntry) $2;
+ type = (string) cc.Key;
+ id = (string) cc.Value;
+
+ if (id != null){
+ ArrayList one = new ArrayList ();
+ Location loc = lexer.Location;
+
+ one.Add (new VariableDeclaration (id, null, loc));
+
+ $1 = current_block;
+ current_block = new Block (current_block);
+ Block b = declare_local_variables (type, one, loc);
+ current_block = b;
+
+
+ }
+ }
+ } block {
+ string type = null, id = null;
+
+ if ($2 != null){
+ DictionaryEntry cc = (DictionaryEntry) $2;
+ type = (string) cc.Key;
+ id = (string) cc.Value;
+
+ if ($1 != null){
+ while (current_block != (Block) $1)
+ current_block = current_block.Parent;
+ }
+ }
+
+
+ $$ = new Catch (type, id , (Block) $4, lexer.Location);
+ }
+ ;
+
+opt_catch_args
+ : /* empty */ { $$ = null; }
+ | catch_args
+ ;
+
+catch_args
+ : OPEN_PARENS type opt_identifier CLOSE_PARENS
+ {
+ $$ = new DictionaryEntry ($2, $3);
+ }
+ ;
+
+checked_statement
+ : CHECKED block
+ {
+ $$ = new Checked ((Block) $2);
+ }
+ ;
+
+unchecked_statement
+ : UNCHECKED block
+ {
+ $$ = new Unchecked ((Block) $2);
+ }
+ ;
+
+unsafe_statement
+ : UNSAFE
+ {
+ if (!RootContext.Unsafe){
+ Report.Error (227, lexer.Location,
+ "Unsafe code can only be used if --unsafe is used");
+ }
+ } block {
+ $$ = new Unsafe ((Block) $3);
+ }
+ ;
+
+fixed_statement
+ : FIXED OPEN_PARENS
+ pointer_type fixed_pointer_declarators
+ CLOSE_PARENS
+ {
+ Block assign_block = new Block (current_block, true);
+ ArrayList list = (ArrayList) $4;
+ string type = (string) $3;
+ Location l = lexer.Location;
+ int top = list.Count;
+
+ for (int i = 0; i < top; i++){
+ Pair p = (Pair) list [i];
+ VariableInfo v;
+
+ v = current_block.AddVariable (type, (string) p.First,current_local_parameters, l);
+ if (v == null){
+ Report.Error (
+ 128, l, "A local variable `" + (string) p.First + "' is already "+
+ "defined in this scope");
+ }
+ v.ReadOnly = true;
+ p.First = v;
+ list [i] = p;
+ }
+ current_block.AddStatement (assign_block);
+ current_block = assign_block;
+ oob_stack.Push (assign_block);
+ oob_stack.Push (l);
+ }
+ embedded_statement
+ {
+ Location l = (Location) oob_stack.Pop ();
+ Block assign_block = (Block) oob_stack.Pop ();
+
+ ArrayList list = (ArrayList) $4;
+ int top = list.Count;
+
+ $$ = new Fixed ((string) $3, (ArrayList) $4, (Statement) $7, l);
+ }
+ ;
+
+fixed_pointer_declarators
+ : fixed_pointer_declarator {
+ ArrayList declarators = new ArrayList ();
+ declarators.Add ($1);
+ $$ = declarators;
+ }
+ | fixed_pointer_declarators COMMA fixed_pointer_declarator
+ {
+ ArrayList declarators = (ArrayList) $1;
+ declarators.Add ($3);
+ $$ = declarators;
+ }
+ ;
+
+fixed_pointer_declarator
+ : IDENTIFIER ASSIGN expression
+ {
+ $$ = new Pair ($1, $3);
+ }
+ ;
+
+lock_statement
+ : LOCK OPEN_PARENS expression CLOSE_PARENS
+ {
+ //
+ }
+ embedded_statement
+ {
+ $$ = new Lock ((Expression) $3, (Statement) $6, lexer.Location);
+ }
+ ;
+
+using_statement
+ : USING OPEN_PARENS resource_acquisition CLOSE_PARENS
+ {
+ Block assign_block = new Block (current_block);
+ current_block = assign_block;
+
+ oob_stack.Push (lexer.Location);
+
+ if ($3 is DictionaryEntry){
+ DictionaryEntry de = (DictionaryEntry) $3;
+ Location l = lexer.Location;
+
+ string type = (string) de.Key;
+ ArrayList var_declarators = (ArrayList) de.Value;
+
+ foreach (VariableDeclaration decl in var_declarators){
+ if (current_block.AddVariable (
+ type, decl.identifier,
+ current_local_parameters, decl.Location) == null){
+ Report.Error (128, decl.Location,
+ "A local variable `" + decl.identifier + "' is already" +
+ "defined in this scope");
+ }
+ }
+
+ ArrayList vars = new ArrayList ();
+
+ foreach (VariableDeclaration decl in var_declarators){
+
+ Expression expr;
+ if (decl.expression_or_array_initializer is Expression){
+ expr = (Expression) decl.expression_or_array_initializer;
+
+ } else {
+
+ ArrayList init = (ArrayList) decl.expression_or_array_initializer;
+
+ string base_type = type.Substring (0, type.IndexOf ("["));
+ string rank = type.Substring (type.IndexOf ("["));
+
+ expr = new ArrayCreation (base_type, rank, init, decl.Location);
+ }
+
+ LocalVariableReference var;
+ VariableInfo vi;
+
+ var = new LocalVariableReference (assign_block, decl.identifier, l);
+ vi = var.VariableInfo;
+ vi.ReadOnly = true;
+
+ // This is so that it is not a warning on using variables
+ vi.Used = true;
+
+ vars.Add (new DictionaryEntry (var, expr));
+
+ // Assign a = new Assign (var, expr, decl.Location);
+ // assign_block.AddStatement (new StatementExpression (a, lexer.Location));
+ }
+ $3 = new DictionaryEntry (type, vars);
+ }
+ }
+ embedded_statement
+ {
+ Using u = new Using ($3, (Statement) $6, (Location) oob_stack.Pop ());
+ current_block.AddStatement (u);
+ while (current_block.Implicit)
+ current_block = current_block.Parent;
+ $$ = current_block;
+ current_block = current_block.Parent;
+ }
+ ;
+
+resource_acquisition
+ : local_variable_declaration
+ | expression
+ ;
+
+%%
+
+// <summary>
+// A class used to pass around variable declarations and constants
+// </summary>
+public class VariableDeclaration {
+ public string identifier;
+ public object expression_or_array_initializer;
+ public Location Location;
+
+ public VariableDeclaration (string id, object eoai, Location l){
+ this.identifier = id;
+ this.expression_or_array_initializer = eoai;
+ this.Location = l;
+ }
+}
+
+// <summary>
+// A class used to hold info about an indexer declarator
+// </summary>
+
+public class IndexerDeclaration {
+ public string type;
+ public string interface_type;
+ public Parameters param_list;
+
+ public IndexerDeclaration (string type, string interface_type, Parameters param_list)
+ {
+ this.type = type;
+ this.interface_type = interface_type;
+ this.param_list = param_list;
+ }
+}
+
+// <summary>
+// A class used to hold info about an operator declarator
+// </summary>
+
+public class OperatorDeclaration {
+ public Operator.OpType optype;
+ public string ret_type;
+ public string arg1type;
+ public string arg1name;
+ public string arg2type;
+ public string arg2name;
+ public Location location;
+
+ public OperatorDeclaration (Operator.OpType op, string ret_type, string arg1type, string arg1name,
+ string arg2type, string arg2name, Location location)
+ {
+ optype = op;
+ this.ret_type = ret_type;
+ this.arg1type = arg1type;
+ this.arg1name = arg1name;
+ this.arg2type = arg2type;
+ this.arg2name = arg2name;
+ this.location = location;
+ }
+
+}
+
+// <summary>
+// Given the @class_name name, it creates a fully qualified name
+// based on the containing declaration space
+// </summary>
+string
+MakeName (string class_name)
+{
+ string ns = current_namespace.Name;
+ string container_name = current_container.Name;
+
+ if (container_name == ""){
+ if (ns != "")
+ return ns + "." + class_name;
+ else
+ return class_name;
+ } else
+ return container_name + "." + class_name;
+}
+
+// <summary>
+// Used to report back to the user the result of a declaration
+// in the current declaration space
+// </summary>
+void
+CheckDef (AdditionResult result, string name, Location l)
+{
+ if (result == AdditionResult.Success)
+ return;
+
+ switch (result){
+ case AdditionResult.NameExists:
+ Report.Error (102, l, "The container `" + current_container.Name +
+ "' already contains a definition for `"+
+ name + "'");
+ break;
+
+
+ //
+ // This is handled only for static Constructors, because
+ // in reality we handle these by the semantic analysis later
+ //
+ case AdditionResult.MethodExists:
+ Report.Error (
+ 111, l, "Class `"+current_container.Name+
+ "' already defines a member called '" +
+ name + "' with the same parameter types (more than one default constructor)");
+ break;
+
+ case AdditionResult.EnclosingClash:
+ Report.Error (542, l, "Member names cannot be the same as their enclosing type");
+ break;
+
+ case AdditionResult.NotAConstructor:
+ Report.Error (1520, l, "Class, struct, or interface method must have a return type");
+ break;
+ }
+}
+
+void
+CheckDef (bool result, string name, Location l)
+{
+ if (result)
+ return;
+ CheckDef (AdditionResult.NameExists, name, l);
+}
+
+//
+// This routine should be removed soon. I am in the process of making
+// changes to never keep anything but SimpleNames during parsing, as
+// that breaks some kinds of code (documented in the ChangeLog).
+//
+Expression
+SimpleLookup (string name, Location loc)
+{
+ //
+ // we need to check against current_block not being null
+ // as `expression' is allowed in argument_lists, which
+ // do not exist inside a block.
+ //
+
+ if (current_local_parameters != null){
+ int idx;
+ Parameter par = current_local_parameters.GetParameterByName (name, out idx);
+ if (par != null)
+ return new ParameterReference (current_local_parameters, idx, name);
+ }
+
+ return null;
+}
+
+Expression DecomposeQI (string name, Location loc)
+{
+ Expression o;
+
+ if (name.IndexOf ('.') == -1){
+ o = SimpleLookup (name, loc);
+ if (o == null)
+ return new SimpleName (name, loc);
+ return o;
+ } 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);
+ }
+}
+
+// <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>
+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 + ")");
+
+}
+
+Block declare_local_variables (string type, ArrayList variable_declarators, Location loc)
+{
+ Block implicit_block;
+ ArrayList inits = null;
+
+ //
+ // We use the `Used' property to check whether statements
+ // have been added to the current block. If so, we need
+ // to create another block to contain the new declaration
+ // otherwise, as an optimization, we use the same block to
+ // add the declaration.
+ //
+ // FIXME: A further optimization is to check if the statements
+ // that were added were added as part of the initialization
+ // below. In which case, no other statements have been executed
+ // and we might be able to reduce the number of blocks for
+ // situations like this:
+ //
+ // int j = 1; int k = j + 1;
+ //
+ if (current_block.Used)
+ implicit_block = new Block (current_block, true, loc, Location.Null);
+ else
+ implicit_block = current_block;
+
+ foreach (VariableDeclaration decl in variable_declarators){
+
+ if (implicit_block.AddVariable (type, decl.identifier, current_local_parameters, decl.Location) != null) {
+ if (decl.expression_or_array_initializer != null){
+ if (inits == null)
+ inits = new ArrayList ();
+ inits.Add (decl);
+ }
+ } else {
+ Report.Error (128, decl.Location, "A local variable `" + decl.identifier +
+ "' is already defined in this scope");
+ }
+ }
+
+ if (inits == null)
+ return implicit_block;
+
+ foreach (VariableDeclaration decl in inits){
+ Assign assign;
+ Expression expr;
+
+ if (decl.expression_or_array_initializer is Expression){
+ expr = (Expression) decl.expression_or_array_initializer;
+
+ } else {
+ ArrayList init = (ArrayList) decl.expression_or_array_initializer;
+
+ string base_type = type.Substring (0, type.IndexOf ("["));
+ string rank = type.Substring (type.IndexOf ("["));
+
+ expr = new ArrayCreation (base_type, rank, init, decl.Location);
+
+ }
+
+ LocalVariableReference var;
+ var = new LocalVariableReference (implicit_block, decl.identifier, loc);
+
+ assign = new Assign (var, expr, decl.Location);
+
+ implicit_block.AddStatement (new StatementExpression (assign, lexer.Location));
+ }
+
+ return implicit_block;
+}
+
+Block declare_local_constant (string type, VariableDeclaration decl)
+{
+ Block implicit_block;
+
+ if (current_block.Used)
+ implicit_block = new Block (current_block, true);
+ else
+ implicit_block = current_block;
+
+ if (!(implicit_block.AddConstant (type, decl.identifier, (Expression) decl.expression_or_array_initializer,
+ current_local_parameters, decl.Location))){
+ Report.Error (128, decl.Location, "A local variable `" + decl.identifier +
+ "' is already defined in this scope");
+ }
+
+ return implicit_block;
+}
+
+void CheckAttributeTarget (string a)
+{
+ switch (a) {
+
+ case "assembly" : case "field" : case "method" : case "param" : case "property" : case "type" :
+ return;
+
+ default :
+ Location l = lexer.Location;
+ Report.Error (658, l, "`" + a + "' is an invalid attribute target");
+ break;
+ }
+
+}
+
+void CheckUnaryOperator (Operator.OpType op)
+{
+ switch (op) {
+
+ case Operator.OpType.LogicalNot:
+ case Operator.OpType.OnesComplement:
+ case Operator.OpType.Increment:
+ case Operator.OpType.Decrement:
+ case Operator.OpType.True:
+ case Operator.OpType.False:
+ case Operator.OpType.Addition:
+ case Operator.OpType.Subtraction:
+
+ break;
+
+ default :
+ Location l = lexer.Location;
+ Report.Error (1019, l, "Overloadable unary operator expected");
+ break;
+
+ }
+}
+
+void CheckBinaryOperator (Operator.OpType op)
+{
+ switch (op) {
+
+ case Operator.OpType.Addition:
+ case Operator.OpType.Subtraction:
+ case Operator.OpType.Multiply:
+ case Operator.OpType.Division:
+ case Operator.OpType.Modulus:
+ case Operator.OpType.BitwiseAnd:
+ case Operator.OpType.BitwiseOr:
+ case Operator.OpType.ExclusiveOr:
+ case Operator.OpType.LeftShift:
+ case Operator.OpType.RightShift:
+ case Operator.OpType.Equality:
+ case Operator.OpType.Inequality:
+ case Operator.OpType.GreaterThan:
+ case Operator.OpType.LessThan:
+ case Operator.OpType.GreaterThanOrEqual:
+ case Operator.OpType.LessThanOrEqual:
+ break;
+
+ default :
+ Location l = lexer.Location;
+ Report.Error (1020, l, "Overloadable binary operator expected");
+ break;
+ }
+
+}
+
+void syntax_error (Location l, string msg)
+{
+ Report.Error (1003, l, "Syntax error, " + msg);
+}
+
+void output (string s)
+{
+ Console.WriteLine (s);
+}
+
+void note (string s)
+{
+ // Used to put annotations
+}
+
+Tokenizer lexer;
+
+public Tokenizer Lexer {
+ get {
+ return lexer;
+ }
+}
+
+public CSharpParser (string name, System.IO.Stream input, ArrayList defines)
+{
+ current_namespace = new Namespace (null, "");
+ this.name = name;
+ this.input = input;
+ current_container = RootContext.Tree.Types;
+ current_container.Namespace = current_namespace;
+ oob_stack = new Stack ();
+
+ lexer = new Tokenizer (input, name, defines);
+}
+
+public override int parse ()
+{
+ global_errors = 0;
+ try {
+ if (yacc_verbose_flag)
+ yyparse (lexer, new yydebug.yyDebugSimple ());
+ else
+ yyparse (lexer);
+ } catch (Exception e){
+ // Console.WriteLine ("Fatal error: " + name);
+ // Console.WriteLine (lexer.location);
+
+ //
+ // Please do not remove this, it is used during debugging
+ // of the grammar
+ //
+ Console.WriteLine (lexer.location + " : Parsing error ");
+ Console.WriteLine (e);
+ global_errors++;
+ }
+
+ return global_errors;
+}
+
+/* end end end */
+}
diff --git a/mcs/mcs/cs-tokenizer.cs b/mcs/mcs/cs-tokenizer.cs
index 5cb184e93f7..f6f905fc824 100755
--- a/mcs/mcs/cs-tokenizer.cs
+++ b/mcs/mcs/cs-tokenizer.cs
@@ -1,5 +1,6 @@
//
// cs-tokenizer.cs: The Tokenizer for the C# compiler
+// This also implements the preprocessor
//
// Author: Miguel de Icaza (miguel@gnu.org)
//
@@ -9,67 +10,23 @@
//
/*
- Todo:
-
- Do something with the integer and float suffixes, pass full datatype?
- Make sure we accept the proper Unicode ranges, per the spec.
-
- Open issues:
-
- * Data type handling
-
- Currently I am returning different tokens for the various
- kinds of floating point types (float, double, decimal) and I
- am only returning a single token for all integer values
- (integer, unsigned int, etc) as an experiment as to see
- which mechanism is better.
-
- I do not know yet how I will be doing the mapping of "int"
- to things like System.Int32 and so on. I am confused. MAN
- I AM C
-
- Indeed, this might be the core of the problem, I should
- *probably* just return a TYPE token and have the value of
- the token be stuff like `System.Int32', `System.UInt32',
- `System.Double' and so on. I will see.
-
- * Error reporting.
-
- I was returning Token.ERROR on errors and setting an
- internal error string with the details, but it might make sense
- to just use exceptions.
-
- Change of mind: I think I want to keep returning errors *UNLESS* the
- parser is catching errors from the tokenizer (at that point, there is
- not really any reason to use exceptions) so that I can continue the
- parsing
-
- * IDEA
-
- I think I have solved the problem. The idea is to not even *bother*
- about handling data types a lot here (except for fitting data into
- the proper places), but let the upper layer handle it.
-
- Ie, treat LITERAL_CHARACTER, LITERAL_INTEGER, LITERAL_FLOAT, LITERAL_DOUBLE, and
- return then as `LITERAL_LITERAL' with maybe subdetail information
-
+ * TODO:
+ * Make sure we accept the proper Unicode ranges, per the spec.
+ * Report error 1032
*/
using System;
using System.Text;
-using CSC;
using System.Collections;
using System.IO;
using System.Globalization;
-namespace CSC
+namespace Mono.CSharp
{
- using CSC;
-
/// <summary>
/// Tokenizer for C# source code.
/// </summary>
-
+
public class Tokenizer : yyParser.yyInput
{
StreamReader reader;
@@ -79,7 +36,24 @@ namespace CSC
public int col = 1;
public int current_token;
bool handle_get_set = false;
+ bool handle_remove_add = false;
+ bool handle_assembly = false;
+
+ //
+ // Whether tokens have been seen on this line
+ //
+ bool tokens_seen = false;
+ //
+ // Whether a token has been seen on the file
+ // This is needed because `define' is not allowed to be used
+ // after a token has been seen.
+ //
+ bool any_token_seen = false;
+
+ //
+ // Returns a verbose representation of the current location
+ //
public string location {
get {
string det;
@@ -89,13 +63,15 @@ namespace CSC
else
det = "";
- return "Line: "+line+" Col: "+col + "\n" +
- "VirtLine: "+ref_line +
- " Token: "+current_token + " " + det;
+ // return "Line: "+line+" Col: "+col + "\n" +
+ // "VirtLine: "+ref_line +
+ // " Token: "+current_token + " " + det;
+
+ return ref_name + " " + "(" + line + "," + col + "), Token:" + current_token + " " + det;
}
}
- public bool properties {
+ public bool PropertyParsing {
get {
return handle_get_set;
}
@@ -104,6 +80,26 @@ namespace CSC
handle_get_set = value;
}
}
+
+ public bool AssemblyTargetParsing {
+ get {
+ return handle_assembly;
+ }
+
+ set {
+ handle_assembly = value;
+ }
+ }
+
+ public bool EventParsing {
+ get {
+ return handle_remove_add;
+ }
+
+ set {
+ handle_remove_add = value;
+ }
+ }
//
// Class variables
@@ -115,9 +111,27 @@ namespace CSC
//
// Values for the associated token returned
//
- System.Text.StringBuilder number;
int putback_char;
Object val;
+
+ //
+ // Pre-processor
+ //
+ Hashtable defines;
+
+ const int TAKING = 1;
+ const int TAKEN_BEFORE = 2;
+ const int ELSE_SEEN = 4;
+ const int PARENT_TAKING = 8;
+
+ //
+ // pre-processor if stack state:
+ //
+ Stack ifstack;
+
+ static System.Text.StringBuilder id_builder;
+ static System.Text.StringBuilder string_builder;
+ static System.Text.StringBuilder number_builder;
//
// Details about the error encoutered by the tokenizer
@@ -142,12 +156,14 @@ namespace CSC
}
}
- static void initTokens ()
+ 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);
@@ -184,7 +200,7 @@ namespace CSC
keywords.Add ("interface", Token.INTERFACE);
keywords.Add ("internal", Token.INTERNAL);
keywords.Add ("is", Token.IS);
- keywords.Add ("lock ", Token.LOCK );
+ keywords.Add ("lock", Token.LOCK);
keywords.Add ("long", Token.LONG);
keywords.Add ("namespace", Token.NAMESPACE);
keywords.Add ("new", Token.NEW);
@@ -199,12 +215,14 @@ namespace CSC
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);
@@ -222,6 +240,7 @@ namespace CSC
keywords.Add ("using", Token.USING);
keywords.Add ("virtual", Token.VIRTUAL);
keywords.Add ("void", Token.VOID);
+ keywords.Add ("volatile", Token.VOLATILE);
keywords.Add ("while", Token.WHILE);
}
@@ -230,10 +249,13 @@ namespace CSC
//
static Tokenizer ()
{
- initTokens ();
+ InitTokens ();
csharp_format_info = new NumberFormatInfo ();
csharp_format_info.CurrencyDecimalSeparator = ".";
styles = NumberStyles.AllowExponent | NumberStyles.AllowDecimalPoint;
+ id_builder = new System.Text.StringBuilder ();
+ string_builder = new System.Text.StringBuilder ();
+ number_builder = new System.Text.StringBuilder ();
}
bool is_keyword (string name)
@@ -241,36 +263,57 @@ namespace CSC
bool res;
res = keywords.Contains (name);
- if ((name == "get" || name == "set") && handle_get_set == false)
+ if (handle_get_set == false && (name == "get" || name == "set"))
+ return false;
+ if (handle_remove_add == false && (name == "remove" || name == "add"))
+ return false;
+ if (handle_assembly == false && (name == "assembly"))
return false;
return res;
}
- int getKeyword (string name)
+ int GetKeyword (string name)
{
return (int) (keywords [name]);
}
+
+ public Location Location {
+ get {
+ return new Location (ref_line);
+ }
+ }
- public Tokenizer (System.IO.Stream input, string fname)
+ public Tokenizer (System.IO.Stream input, string fname, ArrayList defs)
{
this.ref_name = fname;
reader = new System.IO.StreamReader (input);
putback_char = -1;
+
+ if (defs != null){
+ defines = new Hashtable ();
+ foreach (string def in defs)
+ defines [def] = true;
+ }
+
+ //
+ // FIXME: This could be `Location.Push' but we have to
+ // find out why the MS compiler allows this
+ //
+ Mono.CSharp.Location.Push (fname);
}
bool is_identifier_start_character (char c)
{
- return CharacterInfo.IsLetter (c) || c == '_' ;
+ return Char.IsLetter (c) || c == '_' ;
}
bool is_identifier_part_character (char c)
{
- return (CharacterInfo.IsLetter (c) || CharacterInfo.IsDigit (c) || c == '_');
+ return (Char.IsLetter (c) || Char.IsDigit (c) || c == '_');
}
int is_punct (char c, ref bool doread)
{
- int idx = "{}[](),:;~+-*/%&|^!=<>?".IndexOf (c);
int d;
int t;
@@ -319,7 +362,7 @@ namespace CSC
else if (d == '=')
t = Token.OP_SUB_ASSIGN;
else if (d == '>')
- return Token.OP_PTR;
+ t = Token.OP_PTR;
else
return Token.MINUS;
doread = true;
@@ -438,31 +481,36 @@ namespace CSC
bool seen_digits = false;
if (c != -1)
- number.Append ((char) c);
+ number_builder.Append ((char) c);
while ((d = peekChar ()) != -1){
- if (CharacterInfo.IsDigit ((char)d)){
- number.Append ((char) d);
+ if (Char.IsDigit ((char)d)){
+ number_builder.Append ((char) d);
getChar ();
seen_digits = true;
} else
break;
}
+
return seen_digits;
}
+ bool is_hex (char e)
+ {
+ return Char.IsDigit (e) || (e >= 'A' && e <= 'F');
+ }
+
void hex_digits (int c)
{
int d;
if (c != -1)
- number.Append ((char) c);
+ number_builder.Append ((char) c);
while ((d = peekChar ()) != -1){
char e = Char.ToUpper ((char) d);
- if (CharacterInfo.IsDigit (e) ||
- (e >= 'A' && e <= 'F')){
- number.Append ((char) e);
+ if (is_hex (e)){
+ number_builder.Append ((char) e);
getChar ();
} else
break;
@@ -472,7 +520,7 @@ namespace CSC
int real_type_suffix (int c)
{
int t;
-
+
switch (c){
case 'F': case 'f':
t = Token.LITERAL_FLOAT;
@@ -486,29 +534,103 @@ namespace CSC
default:
return Token.NONE;
}
- getChar ();
return t;
}
- int integer_type_suffix (int c)
+ int integer_type_suffix (ulong ul, int c)
{
- // FIXME: Handle U and L suffixes.
- // We also need to see in which kind of
- // Int the thing fits better according to the spec.
+ bool is_unsigned = false;
+ bool is_long = false;
+
+ if (c != -1){
+ bool scanning = true;
+ do {
+ switch (c){
+ case 'U': case 'u':
+ if (is_unsigned)
+ scanning = false;
+ is_unsigned = true;
+ getChar ();
+ break;
+
+ case 'l':
+ if (!is_unsigned){
+ //
+ // if we have not seen anything in between
+ // report this error
+ //
+ Report.Warning (
+ 78, Location,
+ "the 'l' suffix is easily confused with digit `1'," +
+ " use 'L' for clarity");
+ }
+ goto case 'L';
+
+ case 'L':
+ if (is_long)
+ scanning = false;
+ is_long = true;
+ getChar ();
+ break;
+
+ default:
+ scanning = false;
+ break;
+ }
+ c = peekChar ();
+ } while (scanning);
+ }
+
+ if (is_long && is_unsigned){
+ val = ul;
+ return Token.LITERAL_INTEGER;
+ } else if (is_unsigned){
+ // uint if possible, or ulong else.
+
+ if ((ul & 0xffffffff00000000) == 0)
+ val = (uint) ul;
+ else
+ val = ul;
+ } else if (is_long){
+ // long if possible, ulong otherwise
+ if ((ul & 0x8000000000000000) != 0)
+ val = ul;
+ else
+ val = (long) ul;
+ } else {
+ // int, uint, long or ulong in that order
+ if ((ul & 0xffffffff00000000) == 0){
+ uint ui = (uint) ul;
+
+ if ((ui & 0x80000000) != 0)
+ val = ui;
+ else
+ val = (int) ui;
+ } else {
+ if ((ul & 0x8000000000000000) != 0)
+ val = ul;
+ else
+ val = (long) ul;
+ }
+ }
return Token.LITERAL_INTEGER;
}
-
- void adjust_int (int t)
+
+ //
+ // given `c' as the next char in the input decide whether
+ // we need to convert to a special type, and then choose
+ // the best representation for the integer
+ //
+ int adjust_int (int c)
{
- val = new System.Int32();
- val = System.Int32.Parse (number.ToString (), 0);
+ ulong ul = System.UInt64.Parse (number_builder.ToString ());
+ return integer_type_suffix (ul, c);
}
int adjust_real (int t)
{
- string s = number.ToString ();
+ string s = number_builder.ToString ();
- Console.WriteLine (s);
switch (t){
case Token.LITERAL_DECIMAL:
val = new System.Decimal ();
@@ -542,18 +664,20 @@ namespace CSC
int is_number (int c)
{
bool is_real = false;
- number = new System.Text.StringBuilder ();
int type;
- number.Length = 0;
+ number_builder.Length = 0;
- if (CharacterInfo.IsDigit ((char)c)){
- if (peekChar () == 'x' || peekChar () == 'X'){
+ if (Char.IsDigit ((char)c)){
+ if (c == '0' && peekChar () == 'x' || peekChar () == 'X'){
+ ulong ul;
getChar ();
hex_digits (-1);
- val = new System.Int32 ();
- val = System.Int32.Parse (number.ToString (), NumberStyles.HexNumber);
- return integer_type_suffix (peekChar ());
+
+ string s = number_builder.ToString ();
+
+ ul = System.UInt64.Parse (s, NumberStyles.HexNumber);
+ return integer_type_suffix (ul, peekChar ());
}
decimal_digits (c);
c = getChar ();
@@ -566,52 +690,89 @@ namespace CSC
if (c == '.'){
if (decimal_digits ('.')){
is_real = true;
- c = peekChar ();
+ c = getChar ();
} else {
putback ('.');
- number.Length -= 1;
- adjust_int (Token.LITERAL_INTEGER);
- return Token.LITERAL_INTEGER;
+ number_builder.Length -= 1;
+ return adjust_int (-1);
}
}
if (c == 'e' || c == 'E'){
is_real = true;
- number.Append ("e");
- getChar ();
+ number_builder.Append ("e");
+ c = getChar ();
- c = peekChar ();
if (c == '+'){
- number.Append ((char) c);
- getChar ();
- c = peekChar ();
+ number_builder.Append ((char) c);
+ c = getChar ();
} else if (c == '-'){
- number.Append ((char) c);
- getChar ();
- c = peekChar ();
+ number_builder.Append ((char) c);
+ c = getChar ();
}
decimal_digits (-1);
- c = peekChar ();
+ c = getChar ();
}
type = real_type_suffix (c);
if (type == Token.NONE && !is_real){
- type = integer_type_suffix (c);
- adjust_int (type);
putback (c);
- return type;
- } else
+ return adjust_int (c);
+ } else
is_real = true;
+ if (type == Token.NONE){
+ putback (c);
+ }
+
if (is_real)
return adjust_real (type);
Console.WriteLine ("This should not be reached");
throw new Exception ("Is Number should never reach this point");
}
+
+ //
+ // Accepts exactly count (4 or 8) hex, no more no less
+ //
+ int getHex (int count, out bool error)
+ {
+ int [] buffer = new int [8];
+ int i;
+ int total = 0;
+ int c;
+ char e;
+ int top = count != -1 ? count : 4;
+ getChar ();
+ error = false;
+ for (i = 0; i < top; i++){
+ c = getChar ();
+ e = Char.ToUpper ((char) c);
+
+ if (!is_hex (e)){
+ error = true;
+ return 0;
+ }
+ if (Char.IsDigit (e))
+ c = (int) e - (int) '0';
+ else
+ c = (int) e - (int) 'A';
+ total = (total * 16) + c;
+ if (count == -1){
+ int p = peekChar ();
+ if (p == -1)
+ break;
+ if (!is_hex ((char)p))
+ break;
+ }
+ }
+ return total;
+ }
+
int escape (int c)
{
+ bool error;
int d;
int v;
@@ -631,7 +792,7 @@ namespace CSC
case 'v':
v = '\v'; break;
case 'r':
- v = 'c'; break;
+ v = '\r'; break;
case '\\':
v = '\\'; break;
case 'f':
@@ -642,8 +803,23 @@ namespace CSC
v = '"'; break;
case '\'':
v = '\''; break;
+ case 'x':
+ v = getHex (-1, out error);
+ if (error)
+ goto default;
+ return v;
+ case 'u':
+ v = getHex (4, out error);
+ if (error)
+ goto default;
+ return v;
+ case 'U':
+ v = getHex (8, out error);
+ if (error)
+ goto default;
+ return v;
default:
- error_details = "cs1009: Unrecognized escape sequence " + (char)d;
+ Report.Error (1009, Location, "Unrecognized escape sequence in " + (char)d);
return -1;
}
getChar ();
@@ -696,61 +872,501 @@ namespace CSC
current_token = xtoken ();
return current_token;
}
+
+ static StringBuilder static_cmd_arg = new System.Text.StringBuilder ();
+
+ void get_cmd_arg (out string cmd, out string arg)
+ {
+ int c;
+
+ tokens_seen = false;
+ arg = "";
+ static_cmd_arg.Length = 0;
+
+ while ((c = getChar ()) != -1 && (c != '\n') && (c != ' ') && (c != '\t')){
+ if (c == '\r')
+ continue;
+ static_cmd_arg.Append ((char) c);
+ }
+
+ cmd = static_cmd_arg.ToString ();
+
+ if (c == '\n'){
+ line++;
+ ref_line++;
+ return;
+ }
+
+ // skip over white space
+ while ((c = getChar ()) != -1 && (c != '\n') && ((c == ' ') || (c == '\t')))
+ ;
+
+ if (c == '\n'){
+ line++;
+ ref_line++;
+ return;
+ }
+
+ static_cmd_arg.Length = 0;
+ static_cmd_arg.Append ((char) c);
+
+ while ((c = getChar ()) != -1 && (c != '\n')){
+ if (c == '\r')
+ continue;
+ static_cmd_arg.Append ((char) c);
+ }
+
+ if (c == '\n'){
+ line++;
+ ref_line++;
+ }
+ arg = static_cmd_arg.ToString ().Trim ();
+ }
+
+ //
+ // Handles the #line directive
+ //
+ bool PreProcessLine (string arg)
+ {
+ if (arg == "")
+ return false;
+
+ if (arg == "default"){
+ line = ref_line = line;
+ return false;
+ }
+
+ try {
+ int pos;
+
+ if ((pos = arg.IndexOf (' ')) != -1 && pos != 0){
+ ref_line = System.Int32.Parse (arg.Substring (0, pos));
+ pos++;
+
+ char [] quotes = { '\"' };
+
+ ref_name = arg.Substring (pos). Trim(quotes);
+ } else {
+ ref_line = System.Int32.Parse (arg);
+ }
+ } catch {
+ return false;
+ }
+
+ return true;
+ }
+
+ //
+ // Handles #define and #undef
+ //
+ void PreProcessDefinition (bool is_define, string arg)
+ {
+ if (arg == "" || arg == "true" || arg == "false"){
+ Report.Error(1001, Location, "Missing identifer to pre-processor directive");
+ return;
+ }
+
+ if (is_define){
+ if (defines == null)
+ defines = new Hashtable ();
+ defines [arg] = 1;
+ } else {
+ if (defines == null)
+ return;
+ if (defines.Contains (arg))
+ defines.Remove (arg);
+ }
+ }
+
+ bool eval_val (string s)
+ {
+ if (s == "true")
+ return true;
+ if (s == "false")
+ return false;
+
+ if (defines == null)
+ return false;
+ if (defines.Contains (s))
+ return true;
+
+ return false;
+ }
+
+ bool pp_primary (ref string s)
+ {
+ s = s.Trim ();
+ int len = s.Length;
+
+ if (len > 0){
+ char c = s [0];
+
+ if (c == '('){
+ s = s.Substring (1);
+ bool val = pp_expr (ref s);
+ if (s.Length > 0 && s [0] == ')')
+ return val;
+ Error_InvalidDirective ();
+ return false;
+ }
+
+ if (Char.IsLetter (c) || c == '_'){
+ int j = 1;
+
+ while (j < len){
+ c = s [j];
+
+ if (Char.IsLetter (c) || Char.IsDigit (c) || c == '_'){
+ j++;
+ continue;
+ }
+ bool v = eval_val (s.Substring (0, j));
+ s = s.Substring (j);
+ return v;
+ }
+ bool vv = eval_val (s);
+ s = "";
+ return vv;
+ }
+ }
+ Error_InvalidDirective ();
+ return false;
+ }
+
+ bool pp_unary (ref string s)
+ {
+ s = s.Trim ();
+ int len = s.Length;
+
+ if (len > 0){
+ if (s [0] == '!'){
+ if (len > 1 && s [1] == '='){
+ Error_InvalidDirective ();
+ return false;
+ }
+ s = s.Substring (1);
+ return ! pp_primary (ref s);
+ } else
+ return pp_primary (ref s);
+ } else {
+ Error_InvalidDirective ();
+ return false;
+ }
+ }
+
+ bool pp_eq (ref string s)
+ {
+ bool va = pp_unary (ref s);
+
+ s = s.Trim ();
+ int len = s.Length;
+ if (len > 0){
+ if (s [0] == '='){
+ if (len > 2 && s [1] == '='){
+ s = s.Substring (2);
+ return va == pp_unary (ref s);
+ } else {
+ Error_InvalidDirective ();
+ return false;
+ }
+ } else if (s [0] == '!' && len > 1 && s [1] == '='){
+ s = s.Substring (2);
+
+ return va != pp_unary (ref s);
+
+ }
+ }
+
+ return va;
+
+ }
+
+ bool pp_and (ref string s)
+ {
+ bool va = pp_eq (ref s);
+
+ s = s.Trim ();
+ int len = s.Length;
+ if (len > 0){
+ if (s [0] == '&'){
+ if (len > 2 && s [1] == '&'){
+ s = s.Substring (2);
+ return va && pp_eq (ref s);
+ } else {
+ Error_InvalidDirective ();
+ return false;
+ }
+ }
+ }
+ return va;
+ }
+
+ //
+ // Evaluates an expression for `#if' or `#elif'
+ //
+ bool pp_expr (ref string s)
+ {
+ bool va = pp_and (ref s);
+
+ s = s.Trim ();
+ int len = s.Length;
+ if (len > 0){
+ if (s [0] == '|'){
+ if (len > 2 && s [1] == '|'){
+ s = s.Substring (2);
+ return va || pp_and (ref s);
+ } else {
+ Error_InvalidDirective ();
+ return false;
+ }
+ } else {
+ Error_InvalidDirective ();
+ return false;
+ }
+ }
+
+ return va;
+ }
+
+ bool eval (string s)
+ {
+ bool v = pp_expr (ref s);
+
+ return v;
+ }
+
+ void Error_InvalidDirective ()
+ {
+ Report.Error (1517, Location, "Invalid pre-processor directive");
+ }
+
+ void Error_UnexpectedDirective (string extra)
+ {
+ Report.Error (
+ 1028, Location,
+ "Unexpected processor directive (" + extra + ")");
+ }
+
+ void Error_TokensSeen ()
+ {
+ Report.Error (
+ 1032, Location,
+ "Cannot define or undefine pre-processor symbols after a token in the file");
+ }
+
+ //
+ // if true, then the code continues processing the code
+ // if false, the code stays in a loop until another directive is
+ // reached.
+ //
+ bool handle_preprocessing_directive (bool caller_is_taking)
+ {
+ char [] blank = { ' ', '\t' };
+ string cmd, arg;
+
+ get_cmd_arg (out cmd, out arg);
+
+ //
+ // The first group of pre-processing instructions is always processed
+ //
+ switch (cmd){
+ case "line":
+ if (!PreProcessLine (arg))
+ Report.Error (
+ 1576, Location,
+ "Argument to #line directive is missing or invalid");
+ return true;
+
+ case "region":
+ arg = "true";
+ goto case "if";
+
+ case "endregion":
+ goto case "endif";
+
+ case "if":
+ if (arg == ""){
+ Error_InvalidDirective ();
+ return true;
+ }
+ bool taking = false;
+ if (ifstack == null)
+ ifstack = new Stack ();
+
+ if (ifstack.Count == 0){
+ taking = true;
+ } else {
+ int state = (int) ifstack.Peek ();
+ if ((state & TAKING) != 0)
+ taking = true;
+ }
+
+ if (eval (arg) && taking){
+ ifstack.Push (TAKING | TAKEN_BEFORE | PARENT_TAKING);
+ return true;
+ } else {
+ ifstack.Push (taking ? PARENT_TAKING : 0);
+ return false;
+ }
+
+ case "endif":
+ if (ifstack == null || ifstack.Count == 0){
+ Error_UnexpectedDirective ("no #if for this #endif");
+ return true;
+ } else {
+ ifstack.Pop ();
+ if (ifstack.Count == 0)
+ return true;
+ else {
+ int state = (int) ifstack.Peek ();
+
+ if ((state & TAKING) != 0)
+ return true;
+ else
+ return false;
+ }
+ }
+
+ case "elif":
+ if (ifstack == null || ifstack.Count == 0){
+ Error_UnexpectedDirective ("no #if for this #elif");
+ return true;
+ } else {
+ int state = (int) ifstack.Peek ();
+
+ if ((state & ELSE_SEEN) != 0){
+ Error_UnexpectedDirective ("#elif not valid after #else");
+ return true;
+ }
+
+ if ((state & (TAKEN_BEFORE | TAKING)) != 0)
+ return false;
+
+ if (eval (arg) && ((state & PARENT_TAKING) != 0)){
+ state = (int) ifstack.Pop ();
+ ifstack.Push (state | TAKING | TAKEN_BEFORE);
+ return true;
+ } else
+ return false;
+ }
+
+ case "else":
+ if (ifstack == null || ifstack.Count == 0){
+ Report.Error (
+ 1028, Location,
+ "Unexpected processor directive (no #if for this #else)");
+ return true;
+ } else {
+ int state = (int) ifstack.Peek ();
+
+ if ((state & ELSE_SEEN) != 0){
+ Error_UnexpectedDirective ("#else within #else");
+ return true;
+ }
+
+ ifstack.Pop ();
+ ifstack.Push (state | ELSE_SEEN);
+
+ if ((state & TAKEN_BEFORE) == 0){
+ if ((state & PARENT_TAKING) != 0)
+ return true;
+ else
+ return false;
+ }
+ return false;
+ }
+ }
+
+ //
+ // These are only processed if we are in a `taking' block
+ //
+ if (!caller_is_taking)
+ return false;
+
+ switch (cmd){
+ case "define":
+ if (any_token_seen){
+ Error_TokensSeen ();
+ return true;
+ }
+ PreProcessDefinition (true, arg);
+ return true;
+
+ case "undef":
+ if (any_token_seen){
+ Error_TokensSeen ();
+ return true;
+ }
+ PreProcessDefinition (false, arg);
+ return true;
+
+ case "error":
+ Report.Error (1029, Location, "#error: '" + arg + "'");
+ return true;
+
+ case "warning":
+ Report.Warning (1030, Location, "#warning: '" + arg + "'");
+ return true;
+ }
+
+ Report.Error (1024, Location, "Preprocessor directive expected (got: " + cmd + ")");
+ return true;
+ }
public int xtoken ()
{
int t;
- bool allow_keyword = false;
+ bool allow_keyword_as_ident = false;
bool doread = false;
int c;
val = null;
+ // optimization: eliminate col and implement #directive semantic correctly.
for (;(c = getChar ()) != -1; col++) {
-
- if (is_identifier_start_character ((char) c)){
- System.Text.StringBuilder id = new System.Text.StringBuilder ();
+ if (Char.IsLetter ((char)c) || c == '_'){
string ids;
-
- id.Append ((char) c);
+
+ id_builder.Length = 0;
+ tokens_seen = true;
+ id_builder.Append ((char) c);
while ((c = peekChar ()) != -1) {
if (is_identifier_part_character ((char) c)){
- id.Append ((char)getChar ());
+ id_builder.Append ((char)getChar ());
col++;
} else
break;
}
- ids = id.ToString ();
-
- if (!is_keyword (ids)){
- val = id.ToString ();
- return Token.IDENTIFIER;
- }
-
- if (allow_keyword) {
+ ids = id_builder.ToString ();
+
+ if (!is_keyword (ids) || allow_keyword_as_ident) {
val = ids;
+ if (ids.Length > 512){
+ Report.Error (
+ 645, Location,
+ "Identifier too long (limit is 512 chars)");
+ }
+ allow_keyword_as_ident = false;
return Token.IDENTIFIER;
}
- if (ids == "true")
- return Token.TRUE;
- else if (ids == "false")
- return Token.FALSE;
- else if (ids == "null")
- return Token.NULL;
-
- return getKeyword (ids);
+ // true, false and null are in the hash anyway.
+ return GetKeyword (ids);
+
}
if (c == '.'){
- if (CharacterInfo.IsDigit ((char) peekChar ()))
+ tokens_seen = true;
+ if (Char.IsDigit ((char) peekChar ()))
return is_number (c);
return Token.DOT;
}
- if (CharacterInfo.IsDigit ((char) c))
+ if (Char.IsDigit ((char) c)){
+ tokens_seen = true;
return is_number (c);
+ }
// Handle double-slash comments.
if (c == '/'){
@@ -762,6 +1378,9 @@ namespace CSC
col++;
line++;
ref_line++;
+ col = 0;
+ any_token_seen |= tokens_seen;
+ tokens_seen = false;
continue;
} else if (d == '*'){
getChar ();
@@ -775,42 +1394,54 @@ namespace CSC
if (d == '\n'){
line++;
ref_line++;
+ col = 0;
+ any_token_seen |= tokens_seen;
+ tokens_seen = false;
}
- col++;
}
continue;
}
}
/* For now, ignore pre-processor commands */
- if (col == 1 && c == '#'){
- System.Text.StringBuilder s = new System.Text.StringBuilder ();
+ // FIXME: In C# the '#' is not limited to appear
+ // on the first column.
+ if (c == '#' && !tokens_seen){
+ bool cont = true;
- while ((c = getChar ()) != -1 && (c != '\n')){
- s.Append ((char) c);
- }
- if (String.Compare (s.ToString (), 0, "line", 0, 4) == 0){
- string arg = s.ToString ().Substring (5);
- int pos;
-
- if ((pos = arg.IndexOf (' ')) != -1 && pos != 0){
- ref_line = System.Int32.Parse (arg.Substring (0, pos));
- pos++;
-
- char [] quotes = { '\"' };
+ start_again:
+
+ cont = handle_preprocessing_directive (cont);
- ref_name = arg.Substring (pos);
- ref_name.TrimStart (quotes);
- ref_name.TrimEnd (quotes);
- } else
- ref_line = System.Int32.Parse (arg);
+ if (cont){
+ col = 0;
+ continue;
}
- line++;
- ref_line++;
+ col = 1;
+
+ bool skipping = false;
+ for (;(c = getChar ()) != -1; col++){
+ if (c == '\n'){
+ col = 0;
+ line++;
+ ref_line++;
+ skipping = false;
+ } else if (c == ' ' || c == '\t' || c == '\v' || c == '\r')
+ continue;
+ else if (c != '#')
+ skipping = true;
+ if (c == '#' && !skipping)
+ goto start_again;
+ }
+ any_token_seen |= tokens_seen;
+ tokens_seen = false;
+ if (c == -1)
+ Report.Error (1027, Location, "#endif expected");
continue;
}
if ((t = is_punct ((char)c, ref doread)) != Token.ERROR){
+ tokens_seen = true;
if (doread){
getChar ();
col++;
@@ -819,25 +1450,37 @@ namespace CSC
}
if (c == '"'){
- System.Text.StringBuilder s = new System.Text.StringBuilder ();
-
+ string_builder.Length = 0;
+
+ tokens_seen = true;
+
while ((c = getChar ()) != -1){
if (c == '"'){
- val = s.ToString ();
+ if (allow_keyword_as_ident && peekChar () == '"'){
+ string_builder.Append ((char) c);
+ getChar ();
+ continue;
+ }
+ allow_keyword_as_ident = false;
+ val = string_builder.ToString ();
return Token.LITERAL_STRING;
}
- c = escape (c);
- if (c == -1)
- return Token.ERROR;
- s.Append ((char) c);
+ if (!allow_keyword_as_ident){
+ c = escape (c);
+ if (c == -1)
+ return Token.ERROR;
+ }
+ string_builder.Append ((char) c);
}
}
if (c == '\''){
c = getChar ();
+ tokens_seen = true;
if (c == '\''){
- error_details = "CS1011: Empty character literal";
+ error_details = "Empty character literal";
+ Report.Error (1011, Location, error_details);
return Token.ERROR;
}
c = escape (c);
@@ -846,8 +1489,11 @@ namespace CSC
val = new System.Char ();
val = (char) c;
c = getChar ();
+
if (c != '\''){
- error_details = "CS1012: Too many characters in character literal";
+ error_details = "Too many characters in character literal";
+ Report.Error (1012, Location, error_details);
+
// Try to recover, read until newline or next "'"
while ((c = getChar ()) != -1){
if (c == '\n' || c == '\'')
@@ -864,17 +1510,20 @@ namespace CSC
line++;
ref_line++;
col = 0;
+ any_token_seen |= tokens_seen;
+ tokens_seen = false;
continue;
}
+
if (c == ' ' || c == '\t' || c == '\f' || c == '\v' || c == '\r'){
if (c == '\t')
col = (((col + 8) / 8) * 8) - 1;
-
continue;
}
if (c == '@'){
- allow_keyword = true;
+ tokens_seen = true;
+ allow_keyword_as_ident = true;
continue;
}
@@ -883,7 +1532,10 @@ namespace CSC
return Token.ERROR;
}
+ if (ifstack != null && ifstack.Count > 1)
+ Report.Error (1027, Location, "#endif expected");
return Token.EOF;
}
}
}
+
diff --git a/mcs/mcs/decl.cs b/mcs/mcs/decl.cs
index 36235f0f8fc..4927f760e65 100755
--- a/mcs/mcs/decl.cs
+++ b/mcs/mcs/decl.cs
@@ -12,82 +12,237 @@
using System;
using System.Collections;
+using System.Reflection.Emit;
+using System.Reflection;
-namespace CIR {
+namespace Mono.CSharp {
- // <summary>
- // Base class for structs, classes, enums and interfaces. They all create
- // new declaration spaces. This provides the common foundation
- // for managing those name spaces
- // </summary>
-
- public abstract class DeclSpace {
- string name, basename;
-
- // <summary>
- // The result value from adding an declaration into
- // a struct or a class
- // </summary>
- public enum AdditionResult {
+ /// <summary>
+ /// Base representation for members. This is only used to keep track
+ /// of Name, Location and Modifier flags.
+ /// </summary>
+ public abstract class MemberCore {
+ /// <summary>
+ /// Public name
+ /// </summary>
+ public string Name;
+
+ /// <summary>
+ /// Modifier flags that the user specified in the source code
+ /// </summary>
+ public int ModFlags;
+
+ /// <summary>
+ /// Location where this declaration happens
+ /// </summary>
+ public readonly Location Location;
+
+ public MemberCore (string name, Location loc)
+ {
+ Name = name;
+ Location = loc;
+ }
+
+ protected void WarningNotHiding (TypeContainer parent)
+ {
+ Report.Warning (
+ 109, Location,
+ "The member `" + parent.Name + "." + Name + "' does not hide an " +
+ "inherited member. The keyword new is not required");
+
+ }
+
+ static string MethodBaseName (MethodBase mb)
+ {
+ return "`" + mb.ReflectedType.Name + "." + mb.Name + "'";
+ }
+
+ void Error_CannotChangeAccessModifiers (TypeContainer parent, MethodInfo parent_method)
+ {
//
- // The declaration has been successfully
- // added to the declation space.
+ // FIXME: report the old/new permissions?
//
- Success,
+ Report.Error (
+ 507, "`" + parent_method + "." + Name +
+ ": can't change the access modifiers from `" +
+ parent_method.DeclaringType.Name + "." + parent_method.Name + "'");
+ }
+
+ //
+ // Performs various checks on the MethodInfo `mb' regarding the modifier flags
+ // that have been defined.
+ //
+ // `name' is the user visible name for reporting errors (this is used to
+ // provide the right name regarding method names and properties)
+ //
+ protected bool CheckMethodAgainstBase (TypeContainer parent,
+ MethodAttributes my_attrs, MethodInfo mb)
+ {
+ bool ok = true;
+
+ if ((ModFlags & Modifiers.OVERRIDE) != 0){
+ if (!(mb.IsAbstract || mb.IsVirtual)){
+ Report.Error (
+ 506, Location, parent.MakeName (Name) +
+ ": cannot override inherited member " +
+ MethodBaseName (mb) + " because it is not " +
+ "virtual, abstract or override");
+ ok = false;
+ }
+
+ // Now we check that the overriden method is not final
+
+ if (mb.IsFinal) {
+ Report.Error (239, Location, parent.MakeName (Name) + " : cannot " +
+ "override inherited member " + MethodBaseName (mb) +
+ " because it is sealed.");
+ ok = false;
+ }
+
+ //
+ // Check that the permissions are not being changed
+ //
+ MethodAttributes thisp = my_attrs & MethodAttributes.MemberAccessMask;
+ MethodAttributes parentp = mb.Attributes & MethodAttributes.MemberAccessMask;
+
+ if (thisp != parentp){
+ Error_CannotChangeAccessModifiers (parent, mb);
+ ok = false;
+ }
+ }
+
+ if (mb.IsVirtual || mb.IsAbstract){
+ if ((ModFlags & (Modifiers.NEW | Modifiers.OVERRIDE)) == 0){
+ if (Name != "Finalize" && (RootContext.WarningLevel >= 2)){
+ Report.Warning (
+ 114, Location, parent.MakeName (Name) +
+ " hides inherited member " + MethodBaseName (mb) +
+ ". To make the current member override that " +
+ "implementation, add the override keyword, " +
+ "otherwise use the new keyword");
+ }
+ }
+ }
+
+ return ok;
+ }
+
+ public abstract bool Define (TypeContainer parent);
+ //
+ // Whehter is it ok to use an unsafe pointer in this type container
+ //
+ public bool UnsafeOK (DeclSpace parent)
+ {
//
- // The symbol has already been defined.
+ // First check if this MemberCore modifier flags has unsafe set
//
+ if ((ModFlags & Modifiers.UNSAFE) != 0)
+ return true;
+
+ if (parent.UnsafeContext)
+ return true;
+
+ Expression.UnsafeError (Location);
+ return false;
+ }
+ }
+
+ //
+ // FIXME: This is temporary outside DeclSpace, because I have to fix a bug
+ // in MCS that makes it fail the lookup for the enum
+ //
+
+ /// <summary>
+ /// The result value from adding an declaration into
+ /// a struct or a class
+ /// </summary>
+ public enum AdditionResult {
+ /// <summary>
+ /// The declaration has been successfully
+ /// added to the declation space.
+ /// </summary>
+ Success,
+
+ /// <summary>
+ /// The symbol has already been defined.
+ /// </summary>
NameExists,
- //
- // Returned if the declation being added to the
- // name space clashes with its container name.
- //
- // The only exceptions for this are constructors
- // and static constructors
- //
+ /// <summary>
+ /// Returned if the declation being added to the
+ /// name space clashes with its container name.
+ ///
+ /// The only exceptions for this are constructors
+ /// and static constructors
+ /// </summary>
EnclosingClash,
- //
- // Returned if a constructor was created (because syntactically
- // it looked like a constructor) but was not (because the name
- // of the method is not the same as the container class
- //
- NotAConstructor
- }
+ /// <summary>
+ /// Returned if a constructor was created (because syntactically
+ /// it looked like a constructor) but was not (because the name
+ /// of the method is not the same as the container class
+ /// </summary>
+ NotAConstructor,
- public string Name {
- get {
- return name;
- }
+ /// <summary>
+ /// This is only used by static constructors to emit the
+ /// error 111, but this error for other things really
+ /// happens at another level for other functions.
+ /// </summary>
+ MethodExists
}
- public string Basename {
- get {
- return basename;
- }
- }
+ /// <summary>
+ /// Base class for structs, classes, enumerations and interfaces.
+ /// </summary>
+ /// <remarks>
+ /// They all create new declaration spaces. This
+ /// provides the common foundation for managing those name
+ /// spaces.
+ /// </remarks>
+ public abstract class DeclSpace : MemberCore {
+ /// <summary>
+ /// this points to the actual definition that is being
+ /// created with System.Reflection.Emit
+ /// </summary>
+ public TypeBuilder TypeBuilder;
+
+ /// <summary>
+ /// This variable tracks whether we have Closed the type
+ /// </summary>
+ public bool Created = false;
+
+ //
+ // This is the namespace in which this typecontainer
+ // was declared. We use this to resolve names.
+ //
+ public Namespace Namespace;
+
+ public string Basename;
- // <summary>
- // defined_names is used for toplevel objects
- // </summary>
+ /// <summary>
+ /// defined_names is used for toplevel objects
+ /// </summary>
protected Hashtable defined_names;
- public DeclSpace (string name)
+ TypeContainer parent;
+
+ public DeclSpace (TypeContainer parent, string name, Location l)
+ : base (name, l)
{
- this.name = name;
- this.basename = name.Substring (1 + name.LastIndexOf ('.'));
+ Basename = name.Substring (1 + name.LastIndexOf ('.'));
defined_names = new Hashtable ();
+ this.parent = parent;
}
- // <summary>
- // Returns a status code based purely on the name
- // of the member being added
- // </summary>
+ /// <summary>
+ /// Returns a status code based purely on the name
+ /// of the member being added
+ /// </summary>
protected AdditionResult IsValid (string name)
{
- if (name == basename)
+ if (name == Basename)
return AdditionResult.EnclosingClash;
if (defined_names.Contains (name))
@@ -96,22 +251,31 @@ namespace CIR {
return AdditionResult.Success;
}
- // <summary>
- // Introduce @name into this declaration space and
- // associates it with the object @o. Note that for
- // methods this will just point to the first method. o
- // </summary>
+ /// <summary>
+ /// Introduce @name into this declaration space and
+ /// associates it with the object @o. Note that for
+ /// methods this will just point to the first method. o
+ /// </summary>
protected void DefineName (string name, object o)
{
defined_names.Add (name, o);
}
+ /// <summary>
+ /// Returns the object associated with a given name in the declaration
+ /// space. This is the inverse operation of `DefineName'
+ /// </summary>
+ public object GetDefinition (string name)
+ {
+ return defined_names [name];
+ }
+
bool in_transit = false;
- // <summary>
- // This function is used to catch recursive definitions
- // in declarations.
- // </summary>
+ /// <summary>
+ /// This function is used to catch recursive definitions
+ /// in declarations.
+ /// </summary>
public bool InTransit {
get {
return in_transit;
@@ -122,6 +286,197 @@ namespace CIR {
}
}
- abstract public Type Define (Tree tree);
+ public TypeContainer Parent {
+ get {
+ return parent;
+ }
+ }
+
+ //
+ // root_types contains all the types. All TopLevel types
+ // hence have a parent that points to `root_types', that is
+ // why there is a non-obvious test down here.
+ //
+ public bool IsTopLevel {
+ get {
+ if (parent != null){
+ if (parent.parent == null)
+ return true;
+ }
+ return false;
+ }
+ }
+
+ public virtual void CloseType ()
+ {
+ if (!Created){
+ try {
+ TypeBuilder.CreateType ();
+ } catch {
+ //
+ // The try/catch is needed because
+ // nested enumerations fail to load when they
+ // are defined.
+ //
+ // Even if this is the right order (enumerations
+ // declared after types).
+ //
+ // Note that this still creates the type and
+ // it is possible to save it
+ }
+ Created = true;
+ }
+ }
+
+ /// <remarks>
+ /// Should be overriten by the appropriate declaration space
+ /// <remarks>
+ public abstract TypeBuilder DefineType ();
+
+ //
+ // Whether this is an `unsafe context'
+ //
+ public bool UnsafeContext {
+ get {
+ if ((ModFlags & Modifiers.UNSAFE) != 0)
+ return true;
+ if (parent != null)
+ return parent.UnsafeContext;
+ return false;
+ }
+ }
+
+ public static string MakeFQN (string nsn, string name)
+ {
+ string prefix = (nsn == "" ? "" : nsn + ".");
+
+ return prefix + name;
+ }
+
+ Type LookupInterfaceOrClass (string ns, string name, out bool error)
+ {
+ DeclSpace parent;
+ Type t;
+
+ error = false;
+ name = MakeFQN (ns, name);
+
+ t = TypeManager.LookupType (name);
+ if (t != null)
+ return t;
+
+ parent = (DeclSpace) RootContext.Tree.Decls [name];
+ if (parent == null)
+ return null;
+
+ t = parent.DefineType ();
+ if (t == null){
+ Report.Error (146, "Class definition is circular: `"+name+"'");
+ error = true;
+ return null;
+ }
+ return t;
+ }
+
+ /// <summary>
+ /// GetType is used to resolve type names at the DeclSpace level.
+ /// Use this to lookup class/struct bases, interface bases or
+ /// delegate type references
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Contrast this to LookupType which is used inside method bodies to
+ /// lookup types that have already been defined. GetType is used
+ /// during the tree resolution process and potentially define
+ /// recursively the type
+ /// </remarks>
+ public Type FindType (string name)
+ {
+ Type t;
+ bool error;
+
+ //
+ // For the case the type we are looking for is nested within this one
+ // or is in any base class
+ //
+ DeclSpace containing_ds = this;
+
+ while (containing_ds != null){
+ Type current_type = containing_ds.TypeBuilder;
+
+ while (current_type != null) {
+ string pre = current_type.FullName;
+
+ t = LookupInterfaceOrClass (pre, name, out error);
+ if (error)
+ return null;
+
+ if (t != null)
+ return t;
+
+ current_type = current_type.BaseType;
+ }
+ containing_ds = containing_ds.Parent;
+ }
+
+ //
+ // Attempt to lookup the class on our namespace and all it's implicit parents
+ //
+ for (string ns = Namespace.Name; ns != null; ns = RootContext.ImplicitParent (ns)) {
+
+ t = LookupInterfaceOrClass (ns, name, out error);
+ if (error)
+ return null;
+
+ if (t != null)
+ return t;
+ }
+
+ //
+ // Attempt to do a direct unqualified lookup
+ //
+ t = LookupInterfaceOrClass ("", name, out error);
+ if (error)
+ return null;
+
+ if (t != null)
+ return t;
+
+ //
+ // Attempt to lookup the class on any of the `using'
+ // namespaces
+ //
+
+ for (Namespace ns = Namespace; ns != null; ns = ns.Parent){
+
+ t = LookupInterfaceOrClass (ns.Name, name, out error);
+ if (error)
+ return null;
+
+ if (t != null)
+ return t;
+
+ //
+ // Now check the using clause list
+ //
+ ArrayList using_list = ns.UsingTable;
+
+ if (using_list == null)
+ continue;
+
+ foreach (string n in using_list){
+ t = LookupInterfaceOrClass (n, name, out error);
+ if (error)
+ return null;
+
+ if (t != null)
+ return t;
+ }
+
+ }
+
+ Report.Error (246, Location, "Can not find type `"+name+"'");
+ return null;
+ }
}
}
diff --git a/mcs/mcs/delegate.cs b/mcs/mcs/delegate.cs
new file mode 100644
index 00000000000..94aa64e9baa
--- /dev/null
+++ b/mcs/mcs/delegate.cs
@@ -0,0 +1,710 @@
+//
+// delegate.cs: Delegate Handler
+//
+// Author: Ravi Pratap (ravi@ximian.com)
+//
+// Licensed under the terms of the GNU GPL
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Text;
+
+namespace Mono.CSharp {
+
+ /// <summary>
+ /// Holds Delegates
+ /// </summary>
+ public class Delegate : DeclSpace {
+ public readonly string ReturnType;
+ public Parameters Parameters;
+ public Attributes OptAttributes;
+
+ public ConstructorBuilder ConstructorBuilder;
+ public MethodBuilder InvokeBuilder;
+ public MethodBuilder BeginInvokeBuilder;
+ public MethodBuilder EndInvokeBuilder;
+
+ Type [] param_types;
+ Type ret_type;
+
+ Expression instance_expr;
+ MethodBase delegate_method;
+
+ const int AllowedModifiers =
+ Modifiers.NEW |
+ Modifiers.PUBLIC |
+ Modifiers.PROTECTED |
+ Modifiers.INTERNAL |
+ Modifiers.UNSAFE |
+ Modifiers.PRIVATE;
+
+ public Delegate (TypeContainer parent, string type, int mod_flags,
+ string name, Parameters param_list,
+ Attributes attrs, Location l)
+ : base (parent, name, l)
+ {
+ this.ReturnType = type;
+ ModFlags = Modifiers.Check (AllowedModifiers, mod_flags, Modifiers.PUBLIC, l);
+ Parameters = param_list;
+ OptAttributes = attrs;
+ }
+
+ public override TypeBuilder DefineType ()
+ {
+ TypeAttributes attr;
+
+ if (TypeBuilder != null)
+ return TypeBuilder;
+
+ string name = Name.Substring (1 + Name.LastIndexOf ('.'));
+
+ if (IsTopLevel) {
+ ModuleBuilder builder = CodeGen.ModuleBuilder;
+ attr = TypeAttributes.Public | TypeAttributes.Class | TypeAttributes.Sealed;
+
+ TypeBuilder = builder.DefineType (
+ name, attr, TypeManager.multicast_delegate_type);
+ } else {
+ TypeBuilder builder = Parent.TypeBuilder;
+ attr = TypeAttributes.NestedPublic | TypeAttributes.Class |
+ TypeAttributes.Sealed;
+
+ TypeBuilder = builder.DefineNestedType (
+ name, attr, TypeManager.multicast_delegate_type);
+ }
+
+ TypeManager.AddDelegateType (Name, TypeBuilder, this);
+
+ return TypeBuilder;
+ }
+
+ public override bool Define (TypeContainer parent)
+ {
+ MethodAttributes mattr;
+ int i;
+
+ // FIXME: POSSIBLY make this static, as it is always constant
+ //
+ Type [] const_arg_types = new Type [2];
+ const_arg_types [0] = TypeManager.object_type;
+ const_arg_types [1] = TypeManager.intptr_type;
+
+ mattr = MethodAttributes.RTSpecialName | MethodAttributes.SpecialName |
+ MethodAttributes.HideBySig | MethodAttributes.Public;
+
+ ConstructorBuilder = TypeBuilder.DefineConstructor (mattr,
+ CallingConventions.Standard,
+ const_arg_types);
+
+ ConstructorBuilder.DefineParameter (1, ParameterAttributes.None, "object");
+ ConstructorBuilder.DefineParameter (2, ParameterAttributes.None, "method");
+ //
+ // HACK because System.Reflection.Emit is lame
+ //
+ //
+ // FIXME: POSSIBLY make these static, as they are always the same
+ Parameter [] fixed_pars = new Parameter [2];
+ fixed_pars [0] = new Parameter (null, null, Parameter.Modifier.NONE, null);
+ fixed_pars [1] = new Parameter (null, null, Parameter.Modifier.NONE, null);
+ Parameters const_parameters = new Parameters (fixed_pars, null, Location);
+
+ TypeManager.RegisterMethod (
+ ConstructorBuilder,
+ new InternalParameters (const_arg_types, const_parameters),
+ const_arg_types);
+
+
+ ConstructorBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
+
+ //
+ // Here the various methods like Invoke, BeginInvoke etc are defined
+ //
+ // First, call the `out of band' special method for
+ // defining recursively any types we need:
+ Parameters.ComputeAndDefineParameterTypes (this);
+
+ param_types = Parameters.GetParameterInfo (this);
+ if (param_types == null)
+ return false;
+
+ //
+ // Invoke method
+ //
+
+ // Check accessibility
+ foreach (Type partype in param_types)
+ if (!TypeContainer.AsAccessible (partype, ModFlags))
+ return false;
+
+ ret_type = FindType (ReturnType);
+ if (ret_type == null)
+ return false;
+
+ if (!TypeContainer.AsAccessible (ret_type, ModFlags))
+ return false;
+
+ //
+ // We don't have to check any others because they are all
+ // guaranteed to be accessible - they are standard types.
+ //
+
+ CallingConventions cc = Parameters.GetCallingConvention ();
+
+ mattr = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.Virtual;
+
+ InvokeBuilder = TypeBuilder.DefineMethod ("Invoke",
+ mattr,
+ cc,
+ ret_type,
+ param_types);
+
+ i = 0;
+ if (Parameters.FixedParameters != null){
+ int top = Parameters.FixedParameters.Length;
+ Parameter p;
+
+ for (; i < top; i++) {
+ p = Parameters.FixedParameters [i];
+
+ InvokeBuilder.DefineParameter (
+ i+1, p.Attributes, p.Name);
+ }
+ }
+ if (Parameters.ArrayParameter != null){
+ Parameter p = Parameters.ArrayParameter;
+
+ InvokeBuilder.DefineParameter (
+ i+1, p.Attributes, p.Name);
+ }
+
+ InvokeBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
+
+ TypeManager.RegisterMethod (InvokeBuilder,
+ new InternalParameters (parent, Parameters),
+ param_types);
+
+ //
+ // BeginInvoke
+ //
+ int params_num = param_types.Length;
+ Type [] async_param_types = new Type [params_num + 2];
+
+ param_types.CopyTo (async_param_types, 0);
+
+ async_param_types [params_num] = TypeManager.asynccallback_type;
+ async_param_types [params_num + 1] = TypeManager.object_type;
+
+ mattr = MethodAttributes.Public | MethodAttributes.HideBySig |
+ MethodAttributes.Virtual | MethodAttributes.NewSlot;
+
+ BeginInvokeBuilder = TypeBuilder.DefineMethod ("BeginInvoke",
+ mattr,
+ cc,
+ TypeManager.iasyncresult_type,
+ async_param_types);
+
+ i = 0;
+ if (Parameters.FixedParameters != null){
+ int top = Parameters.FixedParameters.Length;
+ Parameter p;
+
+ for (i = 0 ; i < top; i++) {
+ p = Parameters.FixedParameters [i];
+
+ BeginInvokeBuilder.DefineParameter (
+ i+1, p.Attributes, p.Name);
+ }
+ }
+ if (Parameters.ArrayParameter != null){
+ Parameter p = Parameters.ArrayParameter;
+
+ BeginInvokeBuilder.DefineParameter (
+ i+1, p.Attributes, p.Name);
+ i++;
+ }
+
+ BeginInvokeBuilder.DefineParameter (i + 1, ParameterAttributes.None, "callback");
+ BeginInvokeBuilder.DefineParameter (i + 2, ParameterAttributes.None, "object");
+
+ BeginInvokeBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
+
+ Parameter [] async_params = new Parameter [params_num + 2];
+ int n = 0;
+ if (Parameters.FixedParameters != null){
+ Parameters.FixedParameters.CopyTo (async_params, 0);
+ n = Parameters.FixedParameters.Length;
+ }
+ if (Parameters.ArrayParameter != null)
+ async_params [n] = Parameters.ArrayParameter;
+
+ async_params [params_num] = new Parameter ("System.AsyncCallback", "callback",
+ Parameter.Modifier.NONE, null);
+ async_params [params_num + 1] = new Parameter ("System.IAsyncResult", "object",
+ Parameter.Modifier.NONE, null);
+
+ Parameters async_parameters = new Parameters (async_params, null, Location);
+
+ async_parameters.ComputeAndDefineParameterTypes (this);
+ TypeManager.RegisterMethod (BeginInvokeBuilder,
+ new InternalParameters (parent, async_parameters),
+ async_param_types);
+
+ //
+ // EndInvoke
+ //
+ Type [] end_param_types = new Type [1];
+ end_param_types [0] = TypeManager.iasyncresult_type;
+
+ EndInvokeBuilder = TypeBuilder.DefineMethod ("EndInvoke",
+ mattr,
+ cc,
+ ret_type,
+ end_param_types);
+ EndInvokeBuilder.DefineParameter (1, ParameterAttributes.None, "result");
+
+ EndInvokeBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
+
+ Parameter [] end_params = new Parameter [1];
+ end_params [0] = new Parameter ("System.IAsyncResult", "result",
+ Parameter.Modifier.NONE, null);
+
+ TypeManager.RegisterMethod (EndInvokeBuilder,
+ new InternalParameters (
+ parent,
+ new Parameters (end_params, null, Location)),
+ end_param_types);
+
+ return true;
+ }
+
+ /// <summary>
+ /// Verifies whether the method in question is compatible with the delegate
+ /// Returns the method itself if okay and null if not.
+ /// </summary>
+ public static MethodBase VerifyMethod (EmitContext ec, Type delegate_type, MethodBase mb,
+ Location loc)
+ {
+ ParameterData pd = Invocation.GetParameterData (mb);
+
+ Expression ml = Expression.MemberLookup (
+ ec, delegate_type, "Invoke", loc);
+
+ if (!(ml is MethodGroupExpr)) {
+ Report.Error (-100, loc, "Internal error : could not find Invoke method!");
+ return null;
+ }
+
+ MethodBase invoke_mb = ((MethodGroupExpr) ml).Methods [0];
+
+ ParameterData invoke_pd = Invocation.GetParameterData (invoke_mb);
+
+ bool mismatch = false;
+ for (int i = pd.Count; i > 0; ) {
+ i--;
+
+ if (invoke_pd.ParameterType (i) == pd.ParameterType (i))
+ continue;
+ else {
+ mismatch = true;
+ break;
+ }
+ }
+
+ if (mismatch) {
+ Report.Error (
+ 123, loc, "Method '" + Invocation.FullMethodDesc (mb) +
+ "' does not match delegate '" +
+ FullDelegateDesc (delegate_type, invoke_mb, invoke_pd) + "'");
+ return null;
+ }
+
+ if (((MethodInfo) invoke_mb).ReturnType == ((MethodInfo) mb).ReturnType)
+ return mb;
+ else
+ mismatch = true;
+
+ if (mismatch) {
+ Report.Error (123, loc, "Method '" + Invocation.FullMethodDesc (mb) +
+ "' does not match delegate '" +
+ FullDelegateDesc (delegate_type, invoke_mb, invoke_pd) + "'");
+ return null;
+ }
+
+ return null;
+ }
+
+ // <summary>
+ // Verifies whether the invocation arguments are compatible with the
+ // delegate's target method
+ // </summary>
+ public static bool VerifyApplicability (EmitContext ec,
+ Type delegate_type,
+ ArrayList args,
+ Location loc)
+ {
+ int arg_count;
+
+ if (args == null)
+ arg_count = 0;
+ else
+ arg_count = args.Count;
+
+ Expression ml = Expression.MemberLookup (
+ ec, delegate_type, "Invoke", loc);
+
+ if (!(ml is MethodGroupExpr)) {
+ Report.Error (-100, loc, "Internal error : could not find Invoke method!");
+ return false;
+ }
+
+ MethodBase mb = ((MethodGroupExpr) ml).Methods [0];
+ ParameterData pd = Invocation.GetParameterData (mb);
+
+ int pd_count = pd.Count;
+
+ bool not_params_method = (pd.ParameterModifier (pd_count - 1) != Parameter.Modifier.PARAMS);
+
+ if (not_params_method && pd_count != arg_count) {
+ Report.Error (1593, loc,
+ "Delegate '" + delegate_type.ToString ()
+ + "' does not take '" + arg_count + "' arguments");
+ return false;
+ }
+
+ return Invocation.VerifyArgumentsCompat (ec, args, arg_count, mb, !not_params_method,
+ delegate_type, loc);
+ }
+
+ /// <summary>
+ /// Verifies whether the delegate in question is compatible with this one in
+ /// order to determine if instantiation from the same is possible.
+ /// </summary>
+ public static bool VerifyDelegate (EmitContext ec, Type delegate_type, Type probe_type, Location loc)
+ {
+ Expression ml = Expression.MemberLookup (
+ ec, delegate_type, "Invoke", loc);
+
+ if (!(ml is MethodGroupExpr)) {
+ Report.Error (-100, loc, "Internal error : could not find Invoke method!");
+ return false;
+ }
+
+ MethodBase mb = ((MethodGroupExpr) ml).Methods [0];
+ ParameterData pd = Invocation.GetParameterData (mb);
+
+ Expression probe_ml = Expression.MemberLookup (
+ ec, delegate_type, "Invoke", loc);
+
+ if (!(probe_ml is MethodGroupExpr)) {
+ Report.Error (-100, loc, "Internal error : could not find Invoke method!");
+ return false;
+ }
+
+ MethodBase probe_mb = ((MethodGroupExpr) probe_ml).Methods [0];
+ ParameterData probe_pd = Invocation.GetParameterData (probe_mb);
+
+ if (((MethodInfo) mb).ReturnType != ((MethodInfo) probe_mb).ReturnType)
+ return false;
+
+ if (pd.Count != probe_pd.Count)
+ return false;
+
+ for (int i = pd.Count; i > 0; ) {
+ i--;
+
+ if (pd.ParameterType (i) != probe_pd.ParameterType (i) ||
+ pd.ParameterModifier (i) != probe_pd.ParameterModifier (i))
+ return false;
+ }
+
+ return true;
+ }
+
+ public static string FullDelegateDesc (Type del_type, MethodBase mb, ParameterData pd)
+ {
+ StringBuilder sb = new StringBuilder (TypeManager.CSharpName (((MethodInfo) mb).ReturnType));
+
+ sb.Append (" " + del_type.ToString ());
+ sb.Append (" (");
+
+ int length = pd.Count;
+
+ for (int i = length; i > 0; ) {
+ i--;
+
+ sb.Append (TypeManager.CSharpName (pd.ParameterType (length - i - 1)));
+ if (i != 0)
+ sb.Append (", ");
+ }
+
+ sb.Append (")");
+ return sb.ToString ();
+
+ }
+
+ // Hack around System.Reflection as found everywhere else
+ public MemberInfo [] FindMembers (MemberTypes mt, BindingFlags bf, MemberFilter filter, object criteria)
+ {
+ ArrayList members = new ArrayList ();
+
+ if ((mt & MemberTypes.Method) != 0) {
+ if (filter (ConstructorBuilder, criteria))
+ members.Add (ConstructorBuilder);
+
+ if (filter (InvokeBuilder, criteria))
+ members.Add (InvokeBuilder);
+
+ if (filter (BeginInvokeBuilder, criteria))
+ members.Add (BeginInvokeBuilder);
+
+ if (filter (EndInvokeBuilder, criteria))
+ members.Add (EndInvokeBuilder);
+ }
+
+ int count = members.Count;
+
+ if (count > 0) {
+ MemberInfo [] mi = new MemberInfo [count];
+ members.CopyTo (mi, 0);
+ return mi;
+ }
+
+ return null;
+ }
+
+ public void CloseDelegate ()
+ {
+ TypeBuilder.CreateType ();
+ }
+
+ public Expression InstanceExpression {
+ get {
+ return instance_expr;
+ }
+ set {
+ instance_expr = value;
+ }
+ }
+
+ public MethodBase TargetMethod {
+ get {
+ return delegate_method;
+ }
+ set {
+ delegate_method = value;
+ }
+ }
+
+ public Type TargetReturnType {
+ get {
+ return ret_type;
+ }
+ }
+
+ public Type [] ParameterTypes {
+ get {
+ return param_types;
+ }
+ }
+
+ }
+
+ public class NewDelegate : Expression {
+
+ public ArrayList Arguments;
+
+ MethodBase constructor_method;
+ MethodBase delegate_method;
+ Expression delegate_instance_expr;
+
+ Location Location;
+
+ public NewDelegate (Type type, ArrayList Arguments, Location loc)
+ {
+ this.type = type;
+ this.Arguments = Arguments;
+ this.Location = loc;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ if (Arguments == null) {
+ Report.Error (-11, Location,
+ "Delegate creation expression takes only one argument");
+ return null;
+ }
+
+ if (Arguments.Count != 1) {
+ Report.Error (-11, Location,
+ "Delegate creation expression takes only one argument");
+ return null;
+ }
+
+ Expression ml = Expression.MemberLookup (
+ ec, type, ".ctor", Location);
+
+ if (!(ml is MethodGroupExpr)) {
+ Report.Error (-100, Location, "Internal error : Could not find delegate constructor!");
+ return null;
+ }
+
+ constructor_method = ((MethodGroupExpr) ml).Methods [0];
+ Argument a = (Argument) Arguments [0];
+
+ if (!a.Resolve (ec, Location))
+ return null;
+
+ Expression e = a.Expr;
+
+ if (e is MethodGroupExpr) {
+ MethodGroupExpr mg = (MethodGroupExpr) e;
+
+ if (mg.Methods.Length > 1) {
+ Report.Error (-14, Location, "Ambiguous method reference in delegate creation");
+ return null;
+ }
+
+ delegate_method = Delegate.VerifyMethod (ec, type, mg.Methods [0], Location);
+ if (delegate_method == null)
+ return null;
+
+ if (mg.InstanceExpression != null)
+ delegate_instance_expr = mg.InstanceExpression.Resolve (ec);
+ else {
+ if (!ec.IsStatic)
+ delegate_instance_expr = ec.This;
+ else
+ delegate_instance_expr = null;
+ }
+
+ if (delegate_instance_expr != null)
+ if (delegate_instance_expr.Type.IsValueType)
+ delegate_instance_expr = new BoxedCast (delegate_instance_expr);
+
+ eclass = ExprClass.Value;
+ return this;
+ }
+
+ Type e_type = e.Type;
+
+ if (!TypeManager.IsDelegateType (e_type)) {
+ Report.Error (-12, Location, "Cannot create a delegate from something " +
+ "not a delegate or a method.");
+ return null;
+ }
+
+ // This is what MS' compiler reports. We could always choose
+ // to be more verbose and actually give delegate-level specifics
+
+ if (!Delegate.VerifyDelegate (ec, type, e_type, Location)) {
+ Report.Error (29, Location, "Cannot implicitly convert type '" + e_type + "' " +
+ "to type '" + type + "'");
+ return null;
+ }
+
+ Expression invoke_method = Expression.MemberLookup (
+ ec, e_type, "Invoke", MemberTypes.Method,
+ Expression.AllBindingFlags, Location);
+
+ if (invoke_method == null) {
+ Report.Error (-200, Location, "Internal error ! COuld not find Invoke method!");
+ return null;
+ }
+
+ delegate_instance_expr = e;
+ delegate_method = ((MethodGroupExpr) invoke_method).Methods [0];
+
+ eclass = ExprClass.Value;
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ if (delegate_instance_expr == null)
+ ec.ig.Emit (OpCodes.Ldnull);
+ else
+ delegate_instance_expr.Emit (ec);
+
+ ec.ig.Emit (OpCodes.Ldftn, (MethodInfo) delegate_method);
+ ec.ig.Emit (OpCodes.Newobj, (ConstructorInfo) constructor_method);
+ }
+ }
+
+ public class DelegateInvocation : ExpressionStatement {
+
+ public Expression InstanceExpr;
+ public ArrayList Arguments;
+ public Location Location;
+
+ MethodBase method;
+
+ public DelegateInvocation (Expression instance_expr, ArrayList args, Location loc)
+ {
+ this.InstanceExpr = instance_expr;
+ this.Arguments = args;
+ this.Location = loc;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ Type del_type = InstanceExpr.Type;
+ if (del_type == null)
+ return null;
+
+ if (Arguments != null){
+ for (int i = Arguments.Count; i > 0;){
+ --i;
+ Argument a = (Argument) Arguments [i];
+
+ if (!a.Resolve (ec, Location))
+ return null;
+ }
+ }
+
+ if (!Delegate.VerifyApplicability (ec, del_type, Arguments, Location))
+ return null;
+
+ Expression ml = Expression.MemberLookup (ec, del_type, "Invoke", Location);
+ if (!(ml is MethodGroupExpr)) {
+ Report.Error (-100, Location, "Internal error : could not find Invoke method!");
+ return null;
+ }
+
+ method = ((MethodGroupExpr) ml).Methods [0];
+ type = ((MethodInfo) method).ReturnType;
+ eclass = ExprClass.Value;
+
+ return this;
+ }
+
+ 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
+ //
+ Invocation.EmitCall (ec, false, false, InstanceExpr, method, Arguments);
+ }
+
+ public override void EmitStatement (EmitContext ec)
+ {
+ Emit (ec);
+ //
+ // Pop the return value if there is one
+ //
+ if (method is MethodInfo){
+ if (((MethodInfo) method).ReturnType != TypeManager.void_type)
+ ec.ig.Emit (OpCodes.Pop);
+ }
+ }
+
+ }
+}
diff --git a/mcs/mcs/driver.cs b/mcs/mcs/driver.cs
index f4b36acfc59..cf12f1c5927 100755
--- a/mcs/mcs/driver.cs
+++ b/mcs/mcs/driver.cs
@@ -1,253 +1,920 @@
-//
-// driver.cs: The compiler command line driver.
-//
-// Author: Miguel de Icaza (miguel@gnu.org)
-//
-// Licensed under the terms of the GNU GPL
-//
-// (C) 2001 Ximian, Inc (http://www.ximian.com)
-//
-
-namespace CSC
-{
- using System;
- using System.Reflection;
- using System.Reflection.Emit;
- using System.Collections;
- using System.IO;
- using CIR;
- using Generator;
- using CSC;
-
- /// <summary>
- /// Summary description for Class1.
- /// </summary>
- public class Driver
- {
- //
- // Assemblies references to be linked. Initialized with
- // mscorlib.dll here.
- ArrayList references;
-
- // Lookup paths
- ArrayList link_paths;
-
- // Our parser context.
- Tree context;
-
- bool yacc_verbose = false;
-
- int error_count = 0;
-
- public int parse (Tree context, string input_file)
- {
- CSharpParser parser;
- System.IO.Stream input;
- int errors;
-
- try {
- input = System.IO.File.OpenRead (input_file);
- } catch {
- return 1;
- }
-
- parser = new CSharpParser (context, input_file, input);
- parser.yacc_verbose = yacc_verbose;
- try {
- errors = parser.parse ();
- } catch (Exception ex) {
- Console.WriteLine (ex);
- Console.WriteLine ("Compilation aborted");
- return 1;
- }
-
- return errors;
- }
-
- public void Usage ()
- {
- Console.WriteLine (
- "compiler [-v] [-t tree] [-o output] [-L path] [-r reference] sources.cs\n" +
- "-v Verbose parsing\n"+
- "-o Specifies output file\n" +
- "-L Specifies path for loading assemblies\n" +
- "-r References an assembly\n");
-
- }
-
- public IGenerator lookup_output (string name)
- {
- if (name == "tree")
- return new Generator.TreeDump ();
- if (name == "il")
- return new MSIL.Generator ();
-
- return null;
- }
-
- public static void error (string msg)
- {
- Console.WriteLine ("Error: " + msg);
- }
-
- public static void notice (string msg)
- {
- Console.WriteLine (msg);
- }
-
- public static int Main(string[] args)
- {
- Driver driver = new Driver (args);
-
- return driver.error_count;
- }
-
- public int LoadAssembly (string assembly)
- {
- Assembly a;
-
- foreach (string dir in link_paths){
- string full_path = dir + "\\" + assembly;
-
- try {
- a = Assembly.Load (full_path);
- } catch (FileNotFoundException) {
- error ("// File not found: " + full_path);
- return 1;
- } catch (BadImageFormatException) {
- error ("// Bad file format: " + full_path);
- return 1;
- }
-
- context.AddAssembly (a);
- }
- return 0;
- }
-
- public int LoadReferences ()
- {
- int errors = 0;
-
- foreach (string r in references){
- errors += LoadAssembly (r);
- }
-
- return errors;
- }
-
-
- public Driver (string [] args)
- {
- Stream output_stream = Console.OpenStandardOutput ();
- IGenerator generator = null;
- int errors = 0, i;
-
- context = new Tree ();
- references = new ArrayList ();
- link_paths = new ArrayList ();
-
- //
- // Setup defaults
- //
- references.Add ("mscorlib.dll");
- link_paths.Add ("C://WINNT/Microsoft.Net/Framework/v1.0.2204");
-
- for (i = 0; i < args.Length; i++){
- string arg = args [i];
-
- if (arg.StartsWith ("-")){
- if (arg.StartsWith ("-v")){
- yacc_verbose = true;
- continue;
- }
-
- if (arg.StartsWith ("-t")){
- generator = lookup_output (args [++i]);
- continue;
- }
-
- if (arg.StartsWith ("-z")){
- generator.ParseOptions (args [++i]);
- continue;
- }
-
- if (arg.StartsWith ("-o")){
- try {
- output_stream = File.Create (args [++i]);
- } catch (Exception){
- error ("Could not write to `"+args [i]);
- error_count++;
- return;
- }
- continue;
- }
-
- if (arg.StartsWith ("-r")){
- references.Add (args [++i]);
- continue;
- }
-
- if (arg.StartsWith ("-L")){
- link_paths.Add (args [++i]);
- continue;
- }
-
- Usage ();
- error_count++;
- return;
- }
-
- if (!arg.EndsWith (".cs")){
- error ("Do not know how to compile " + arg);
- errors++;
- continue;
- }
-
- errors += parse (context, arg);
- }
- if (errors > 0)
- error ("// Parsing failed");
- else
- notice ("// Parsing successful");
-
- //
- // Load assemblies required
- //
- errors += LoadReferences ();
-
- if (errors > 0)
- error ("// Could not load one or more assemblies");
- else
- notice ("// Assemblies loaded");
-
-
- errors += context.BuilderInit ("Module", "Module.exe");
-
- //
- // Name resolution on the tree.
- //
- errors += context.Resolve ();
-
- //
- // Code generation from the tree
- //
- if (generator != null){
- StreamWriter output = new StreamWriter (output_stream);
-
- errors += generator.GenerateFromTree (context, output);
-
- if (errors > 0)
- error ("// Compilation failed");
- else
- notice ("// Compilation successful");
-
- output.Flush ();
- output.Close ();
- }
-
- error_count = errors;
- }
-
- }
-}
-
+//
+// driver.cs: The compiler command line driver.
+//
+// Author: Miguel de Icaza (miguel@gnu.org)
+//
+// Licensed under the terms of the GNU GPL
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace Mono.CSharp
+{
+ using System;
+ using System.Reflection;
+ using System.Reflection.Emit;
+ using System.Collections;
+ using System.IO;
+ using System.Globalization;
+ using Mono.Languages;
+
+ enum Target {
+ Library, Exe, Module, WinExe
+ };
+
+ /// <summary>
+ /// The compiler driver.
+ /// </summary>
+ public class Driver
+ {
+
+ //
+ // Assemblies references to be linked. Initialized with
+ // mscorlib.dll here.
+ static ArrayList references;
+
+ //
+ // If any of these fail, we ignore the problem. This is so
+ // that we can list all the assemblies in Windows and not fail
+ // if they are missing on Linux.
+ //
+ static ArrayList soft_references;
+
+ // Lookup paths
+ static ArrayList link_paths;
+
+ // Whether we want Yacc to output its progress
+ static bool yacc_verbose = false;
+
+ // Whether we want to only run the tokenizer
+ static bool tokenize = false;
+
+ static int error_count = 0;
+
+ 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;
+ static bool timestamps = false;
+
+ //
+ // Whether to load the initial config file (what CSC.RSP has by default)
+ //
+ static bool load_default_config = true;
+
+ static Hashtable response_file_list;
+ static Hashtable source_files = new Hashtable ();
+
+ //
+ // A list of resource files
+ //
+ static ArrayList resources;
+
+ //
+ // An array of the defines from the command line
+ //
+ static ArrayList defines;
+
+ //
+ // Last time we took the time
+ //
+ static DateTime last_time;
+ static void ShowTime (string msg)
+ {
+ DateTime now = DateTime.Now;
+ TimeSpan span = now - last_time;
+ last_time = now;
+
+ Console.WriteLine (
+ "[{0:00}:{1:000}] {2}",
+ (int) span.TotalSeconds, span.Milliseconds, msg);
+ }
+
+ static int tokenize_file (string input_file)
+ {
+ Stream input;
+
+ try {
+ input = File.OpenRead (input_file);
+
+ } catch {
+ Report.Error (2001, "Source file '" + input_file + "' could not be opened");
+ return 1;
+ }
+
+ using (input){
+ Tokenizer lexer = new Tokenizer (input, input_file, defines);
+ int token, tokens = 0, errors = 0;
+
+ while ((token = lexer.token ()) != Token.EOF){
+ Location l = lexer.Location;
+ tokens++;
+ if (token == Token.ERROR)
+ errors++;
+ }
+ Console.WriteLine ("Tokenized: " + tokens + " found " + errors + " errors");
+ }
+
+ return 0;
+ }
+
+ static int parse (string input_file)
+ {
+ CSharpParser parser;
+ Stream input;
+ int errors;
+
+ try {
+ input = File.OpenRead (input_file);
+ } catch {
+ Report.Error (2001, "Source file '" + input_file + "' could not be opened");
+ return 1;
+ }
+
+ parser = new CSharpParser (input_file, input, defines);
+ parser.yacc_verbose = yacc_verbose;
+ try {
+ errors = parser.parse ();
+ } catch (Exception ex) {
+ Console.WriteLine (ex);
+ Console.WriteLine ("Compilation aborted");
+ return 1;
+ } finally {
+ input.Close ();
+ }
+
+ return errors;
+ }
+
+ static void Usage (bool is_error)
+ {
+ Console.WriteLine (
+ "Mono C# compiler, (C) 2001 Ximian, Inc.\n" +
+ "mcs [options] source-files\n" +
+ " --about About the Mono C# compiler\n" +
+ " --checked Set default context to checked\n" +
+ " --define SYM Defines the symbol SYM\n" +
+ " --debug Generate debugging information\n" +
+ " -g Generate debugging information\n" +
+ " --fatal Makes errors fatal\n" +
+ " -L PATH Adds PATH to the assembly link path\n" +
+ " --noconfig Disables implicit references to assemblies\n" +
+ " --nostdlib Does not load core libraries\n" +
+ " --nowarn XXX Ignores warning number XXX\n" +
+ " -o FNAME Specifies output file\n" +
+ " --optimize Optimizes\n" +
+ " -g, --debug Write symbolic debugging information to FILE-debug.s\n" +
+ " --parse Only parses the source file\n" +
+ " --probe X Probes for the source to generate code X on line L\n" +
+ " --recurse SPEC Recursively compiles the files in SPEC ([dir]/file)\n" +
+ " --resource FILE Addds FILE as a resource\n" +
+ " --stacktrace Shows stack trace at error location\n" +
+ " --target KIND Specifies the target (KIND is one of: exe, winexe, " +
+ "library, module)\n" +
+ " --timestamp Displays time stamps of various compiler events\n" +
+ " --unsafe Allows unsafe code\n" +
+ " --werror Treat warnings as errors\n" +
+ " --wlevel LEVEL Sets warning level (the highest is 4, the default)\n" +
+ " -r References an assembly\n" +
+ " -v Verbose parsing (for debugging the parser)\n" +
+ " @file Read response file for more options");
+ if (is_error)
+ error_count++;
+ }
+
+ static void About ()
+ {
+ Console.WriteLine (
+ "The Mono C# compiler is (C) 2001 Ximian, Inc.\n\n" +
+ "The compiler source code is released under the terms of the GNU GPL\n\n" +
+
+ "For more information on Mono, visit the project Web site\n" +
+ " http://www.go-mono.com\n\n" +
+
+ "The compiler was written by Miguel de Icaza and Ravi Pratap");
+ }
+
+ static void error (string msg)
+ {
+ Console.WriteLine ("Error: " + msg);
+ }
+
+ static void notice (string msg)
+ {
+ Console.WriteLine (msg);
+ }
+
+ public static int Main (string[] args)
+ {
+ MainDriver (args);
+
+ return (error_count + Report.Errors) != 0 ? 1 : 0;
+ }
+
+ static public int LoadAssembly (string assembly, bool soft)
+ {
+ Assembly a;
+ string total_log = "";
+
+ try {
+ a = Assembly.Load (assembly);
+ TypeManager.AddAssembly (a);
+ return 0;
+ } catch (FileNotFoundException){
+ foreach (string dir in link_paths){
+ string full_path = dir + "/" + assembly + ".dll";
+
+ try {
+ a = Assembly.LoadFrom (full_path);
+ TypeManager.AddAssembly (a);
+ return 0;
+ } catch (FileNotFoundException ff) {
+ total_log += ff.FusionLog;
+ continue;
+ }
+ }
+ if (soft)
+ return 0;
+ } catch (BadImageFormatException f) {
+ error ("// Bad file format while loading assembly");
+ error ("Log: " + f.FusionLog);
+ return 1;
+ } catch (FileLoadException f){
+ error ("// File Load Exception: ");
+ error ("Log: " + f.FusionLog);
+ return 1;
+ } catch (ArgumentNullException){
+ error ("// Argument Null exception ");
+ return 1;
+ }
+
+ Report.Error (6, "Can not find assembly `" + assembly + "'" );
+ Console.WriteLine ("Log: \n" + total_log);
+
+ return 0;
+ }
+
+ /// <summary>
+ /// Loads all assemblies referenced on the command line
+ /// </summary>
+ static public int LoadReferences ()
+ {
+ int errors = 0;
+
+ foreach (string r in references)
+ errors += LoadAssembly (r, false);
+
+ foreach (string r in soft_references)
+ errors += LoadAssembly (r, true);
+
+ return errors;
+ }
+
+ static void SetupDefaultDefines ()
+ {
+ defines = new ArrayList ();
+ defines.Add ("__MonoCS__");
+ }
+
+ static string [] LoadArgs (string file)
+ {
+ StreamReader f;
+ ArrayList args = new ArrayList ();
+ string line;
+ try {
+ f = new StreamReader (file);
+ } catch {
+ return null;
+ }
+
+ while ((line = f.ReadLine ()) != null){
+ string [] line_args = line.Split (new char [] { ' ' });
+
+ foreach (string arg in line_args)
+ args.Add (arg);
+ }
+
+ string [] ret_value = new string [args.Count];
+ args.CopyTo (ret_value, 0);
+
+ return ret_value;
+ }
+
+ //
+ // Returns the directory where the system assemblies are installed
+ //
+ static string GetSystemDir ()
+ {
+ Assembly [] assemblies = AppDomain.CurrentDomain.GetAssemblies ();
+
+ foreach (Assembly a in assemblies){
+ string codebase = a.CodeBase;
+ if (codebase.EndsWith ("corlib.dll")){
+ return codebase.Substring (0, codebase.LastIndexOf ("/"));
+ }
+ }
+
+ Report.Error (-15, "Can not compute my system path");
+ return "";
+ }
+
+ //
+ // Given a path specification, splits the path from the file/pattern
+ //
+ static void SplitPathAndPattern (string spec, out string path, out string pattern)
+ {
+ int p = spec.LastIndexOf ("/");
+ if (p != -1){
+ //
+ // Windows does not like /file.cs, switch that to:
+ // "\", "file.cs"
+ //
+ if (p == 0){
+ path = "\\";
+ pattern = spec.Substring (1);
+ } else {
+ path = spec.Substring (0, p);
+ pattern = spec.Substring (p + 1);
+ }
+ return;
+ }
+
+ p = spec.LastIndexOf ("\\");
+ if (p != -1){
+ path = spec.Substring (0, p);
+ pattern = spec.Substring (p + 1);
+ return;
+ }
+
+ path = ".";
+ pattern = spec;
+ }
+
+ static int ProcessFile (string f)
+ {
+ if (first_source == null)
+ first_source = f;
+
+ if (source_files.Contains (f)){
+ Report.Error (
+ 1516,
+ "Source file `" + f + "' specified multiple times");
+ Environment.Exit (1);
+ } else
+ source_files.Add (f, f);
+
+ if (tokenize)
+ tokenize_file (f);
+ else
+ return parse (f);
+ return 0;
+ }
+
+ static int CompileFiles (string spec, bool recurse)
+ {
+ string path, pattern;
+ int errors = 0;
+
+ SplitPathAndPattern (spec, out path, out pattern);
+ string [] files = null;
+ try {
+ files = Directory.GetFiles (path, pattern);
+ } catch (System.IO.DirectoryNotFoundException) {
+ Report.Error (2001, "Source file `" + spec + "' could not be found");
+ return 1;
+ } catch (System.IO.IOException){
+ Report.Error (2001, "Source file `" + spec + "' could not be found");
+ return 1;
+ }
+
+ foreach (string f in files)
+ errors += ProcessFile (f);
+
+ if (!recurse)
+ return errors;
+
+ string [] dirs = null;
+
+ try {
+ dirs = Directory.GetDirectories (path);
+ } catch {
+ }
+
+ foreach (string d in dirs) {
+
+ // Don't include path in this string, as each
+ // directory entry already does
+ errors += CompileFiles (d + "/" + pattern, true);
+ }
+
+
+ return errors;
+ }
+
+ static void DefineDefaultConfig ()
+ {
+ //
+ // For now the "default config" is harcoded into the compiler
+ // we can move this outside later
+ //
+ string [] default_config = {
+ "System",
+ "System.Xml",
+#if false
+ //
+ // Is it worth pre-loading all this stuff?
+ //
+ "Accessibility",
+ "System.Configuration.Install",
+ "System.Data",
+ "System.Design",
+ "System.DirectoryServices",
+ "System.Drawing.Design",
+ "System.Drawing",
+ "System.EnterpriseServices",
+ "System.Management",
+ "System.Messaging",
+ "System.Runtime.Remoting",
+ "System.Runtime.Serialization.Formatters.Soap",
+ "System.Security",
+ "System.ServiceProcess",
+ "System.Web",
+ "System.Web.RegularExpressions",
+ "System.Web.Services",
+ "System.Windows.Forms"
+#endif
+ };
+
+ int p = 0;
+ foreach (string def in default_config)
+ soft_references.Insert (p++, def);
+ }
+
+ /// <summary>
+ /// Parses the arguments, and drives the compilation
+ /// process.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// TODO: Mostly structured to debug the compiler
+ /// now, needs to be turned into a real driver soon.
+ /// </remarks>
+ static void MainDriver (string [] args)
+ {
+ int errors = 0, i;
+ string output_file = null;
+ bool parsing_options = true;
+
+ references = new ArrayList ();
+ soft_references = new ArrayList ();
+ link_paths = new ArrayList ();
+
+ SetupDefaultDefines ();
+
+ //
+ // Setup defaults
+ //
+ // This is not required because Assembly.Load knows about this
+ // path.
+ //
+ link_paths.Add (GetSystemDir ());
+
+ int argc = args.Length;
+ for (i = 0; i < argc; i++){
+ string arg = args [i];
+
+ if (arg.StartsWith ("@")){
+ string [] new_args, extra_args;
+ string response_file = arg.Substring (1);
+
+ if (response_file_list == null)
+ response_file_list = new Hashtable ();
+
+ if (response_file_list.Contains (response_file)){
+ Report.Error (
+ 1515, "Response file `" + response_file +
+ "' specified multiple times");
+ Environment.Exit (1);
+ }
+
+ response_file_list.Add (response_file, response_file);
+
+ extra_args = LoadArgs (response_file);
+ if (extra_args == null){
+ Report.Error (2011, "Unable to open response file: " +
+ response_file);
+ return;
+ }
+
+ new_args = new string [extra_args.Length + argc];
+ args.CopyTo (new_args, 0);
+ extra_args.CopyTo (new_args, argc);
+ args = new_args;
+ argc = new_args.Length;
+ continue;
+ }
+
+ //
+ // Prepare to recurse
+ //
+
+ if (parsing_options && (arg.StartsWith ("-"))){
+ switch (arg){
+ case "-v":
+ yacc_verbose = true;
+ continue;
+
+ case "--":
+ parsing_options = false;
+ continue;
+
+ case "--parse":
+ parse_only = true;
+ continue;
+
+ case "--main": case "-m":
+ if ((i + 1) >= argc){
+ Usage (true);
+ return;
+ }
+ RootContext.MainClass = args [++i];
+ continue;
+
+ case "--unsafe":
+ RootContext.Unsafe = true;
+ continue;
+
+ case "--optimize":
+ RootContext.Optimize = true;
+ continue;
+
+ case "/?": case "/h": case "/help":
+ case "--help":
+ Usage (false);
+ return;
+
+ case "--define":
+ if ((i + 1) >= argc){
+ Usage (true);
+ return;
+ }
+ defines.Add (args [++i]);
+ continue;
+
+ case "--probe": {
+ int code = 0;
+
+ try {
+ code = Int32.Parse (
+ args [++i], NumberStyles.AllowLeadingSign);
+ Report.SetProbe (code);
+ } catch {
+ Report.Error (-14, "Invalid number specified");
+ }
+ continue;
+ }
+
+ case "--tokenize": {
+ tokenize = true;
+ continue;
+ }
+
+ case "-o":
+ case "--output":
+ if ((i + 1) >= argc){
+ Usage (true);
+ return;
+ }
+ output_file = args [++i];
+ string bname = CodeGen.Basename (output_file);
+ if (bname.IndexOf (".") == -1)
+ output_file += ".exe";
+ continue;
+
+ case "--checked":
+ RootContext.Checked = true;
+ continue;
+
+ case "--stacktrace":
+ Report.Stacktrace = true;
+ continue;
+
+ case "--resource":
+ if ((i + 1) >= argc){
+ Usage (true);
+ Console.WriteLine("Missing argument to --resource");
+ return;
+ }
+ if (resources == null)
+ resources = new ArrayList ();
+
+ resources.Add (args [++i]);
+ continue;
+
+ case "--target":
+ if ((i + 1) >= argc){
+ Usage (true);
+ return;
+ }
+
+ string type = args [++i];
+ switch (type){
+ case "library":
+ target = Target.Library;
+ target_ext = ".dll";
+ break;
+
+ case "exe":
+ target = Target.Exe;
+ break;
+
+ case "winexe":
+ target = Target.WinExe;
+ break;
+
+ case "module":
+ target = Target.Module;
+ target_ext = ".dll";
+ break;
+ default:
+ Usage (true);
+ return;
+ }
+ continue;
+
+ case "-r":
+ if ((i + 1) >= argc){
+ Usage (true);
+ return;
+ }
+
+ references.Add (args [++i]);
+ continue;
+
+ case "-L":
+ if ((i + 1) >= argc){
+ Usage (true);
+ return;
+ }
+ link_paths.Add (args [++i]);
+ continue;
+
+ case "--nostdlib":
+ RootContext.StdLib = false;
+ continue;
+
+ case "--fatal":
+ Report.Fatal = true;
+ continue;
+
+ case "--werror":
+ Report.WarningsAreErrors = true;
+ continue;
+
+ case "--nowarn":
+ if ((i + 1) >= argc){
+ Usage (true);
+ return;
+ }
+ int warn;
+
+ try {
+ warn = Int32.Parse (args [++i]);
+ } catch {
+ Usage (true);
+ return;
+ }
+ Report.SetIgnoreWarning (warn);
+ continue;
+
+ case "--wlevel":
+ if ((i + 1) >= argc){
+ Report.Error (
+ 1900,
+ "--wlevel requires an value from 0 to 4");
+ error_count++;
+ return;
+ }
+ int level;
+
+ try {
+ level = Int32.Parse (args [++i]);
+ } catch {
+ Report.Error (
+ 1900,
+ "--wlevel requires an value from 0 to 4");
+ return;
+ }
+ if (level < 0 || level > 4){
+ Report.Error (1900, "Warning level must be 0 to 4");
+ return;
+ } else
+ RootContext.WarningLevel = level;
+ continue;
+
+ case "--about":
+ About ();
+ return;
+
+ case "--recurse":
+ if ((i + 1) >= argc){
+ Console.WriteLine ("--recurse requires an argument");
+ error_count++;
+ return;
+ }
+ errors += CompileFiles (args [++i], true);
+ continue;
+
+ case "--timestamp":
+ timestamps = true;
+ last_time = DateTime.Now;
+ continue;
+
+ case "--debug": case "-g":
+ want_debugging_support = true;
+ continue;
+
+ case "--noconfig":
+ load_default_config = false;
+ continue;
+
+ default:
+ Console.WriteLine ("Unknown option: " + arg);
+ errors++;
+ continue;
+ }
+ }
+
+ CompileFiles (arg, false);
+ }
+
+ if (tokenize)
+ return;
+
+ if (first_source == null){
+ Report.Error (2008, "No files to compile were specified");
+ return;
+ }
+
+ if (Report.Errors > 0)
+ return;
+
+ if (parse_only)
+ return;
+
+ //
+ // Load Core Library for default compilation
+ //
+ if (RootContext.StdLib)
+ references.Insert (0, "mscorlib");
+
+ if (load_default_config)
+ DefineDefaultConfig ();
+
+ if (errors > 0){
+ error ("Parsing failed");
+ return;
+ }
+
+ //
+ // Load assemblies required
+ //
+ if (timestamps)
+ ShowTime ("Loading references");
+ errors += LoadReferences ();
+ if (timestamps)
+ ShowTime (" References loaded");
+
+ if (errors > 0){
+ error ("Could not load one or more assemblies");
+ return;
+ }
+
+ error_count = errors;
+
+ //
+ // Quick hack
+ //
+ if (output_file == null){
+ int pos = first_source.LastIndexOf (".");
+
+ if (pos > 0)
+ output_file = first_source.Substring (0, pos) + target_ext;
+ else
+ output_file = first_source + target_ext;
+ }
+
+ CodeGen.Init (output_file, output_file, want_debugging_support);
+
+ TypeManager.AddModule (CodeGen.ModuleBuilder);
+
+ //
+ // Before emitting, we need to get the core
+ // types emitted from the user defined types
+ // or from the system ones.
+ //
+ if (timestamps)
+ ShowTime ("Initializing Core Types");
+ if (!RootContext.StdLib){
+ RootContext.ResolveCore ();
+ if (Report.Errors > 0)
+ return;
+ }
+
+ TypeManager.InitCoreTypes ();
+ if (timestamps)
+ ShowTime (" Core Types done");
+
+ //
+ // The second pass of the compiler
+ //
+ if (timestamps)
+ ShowTime ("Resolving tree");
+ RootContext.ResolveTree ();
+ if (timestamps)
+ ShowTime ("Populate tree");
+ if (!RootContext.StdLib)
+ RootContext.BootCorlib_PopulateCoreTypes ();
+ RootContext.PopulateTypes ();
+
+ if (RootContext.StdLib)
+ TypeManager.InitCodeHelpers ();
+
+ if (Report.Errors > 0){
+ error ("Compilation failed");
+ return;
+ }
+
+ //
+ // The code generator
+ //
+ if (timestamps)
+ ShowTime ("Emitting code");
+ RootContext.EmitCode ();
+ if (timestamps)
+ ShowTime (" done");
+
+ if (Report.Errors > 0){
+ error ("Compilation failed");
+ return;
+ }
+
+ if (timestamps)
+ ShowTime ("Closing types");
+
+ RootContext.CloseTypes ();
+
+ PEFileKinds k = PEFileKinds.ConsoleApplication;
+
+ if (target == Target.Library || target == Target.Module)
+ k = PEFileKinds.Dll;
+ else if (target == Target.Exe)
+ k = PEFileKinds.ConsoleApplication;
+ else if (target == Target.WinExe)
+ k = PEFileKinds.WindowApplication;
+
+ if (target == Target.Exe || target == Target.WinExe){
+ MethodInfo ep = RootContext.EntryPoint;
+
+ if (ep == null){
+ Report.Error (5001, "Program " + output_file +
+ " does not have an entry point defined");
+ return;
+ }
+
+ CodeGen.AssemblyBuilder.SetEntryPoint (ep, k);
+ }
+
+ //
+ // Add the resources
+ //
+ if (resources != null){
+ foreach (string file in resources)
+ CodeGen.AssemblyBuilder.AddResourceFile (file, file);
+ }
+
+ CodeGen.Save (output_file);
+ if (timestamps)
+ ShowTime ("Saved output");
+
+ if (want_debugging_support) {
+ CodeGen.SaveSymbols ();
+ if (timestamps)
+ ShowTime ("Saved symbols");
+ }
+
+ if (Report.Errors > 0){
+ error ("Compilation failed");
+ return;
+ } else if (Report.ProbeCode != 0){
+ error ("Failed to report code " + Report.ProbeCode);
+ Environment.Exit (124);
+ }
+ }
+
+ }
+}
diff --git a/mcs/mcs/ecore.cs b/mcs/mcs/ecore.cs
new file mode 100755
index 00000000000..2ea18b33826
--- /dev/null
+++ b/mcs/mcs/ecore.cs
@@ -0,0 +1,3759 @@
+//
+// ecore.cs: Core of the Expression representation for the intermediate tree.
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+//
+
+namespace Mono.CSharp {
+ using System;
+ using System.Collections;
+ using System.Diagnostics;
+ using System.Reflection;
+ using System.Reflection.Emit;
+ using System.Text;
+
+ /// <remarks>
+ /// The ExprClass class contains the is used to pass the
+ /// classification of an expression (value, variable, namespace,
+ /// type, method group, property access, event access, indexer access,
+ /// nothing).
+ /// </remarks>
+ public enum ExprClass : byte {
+ Invalid,
+
+ Value,
+ Variable,
+ Namespace,
+ Type,
+ MethodGroup,
+ PropertyAccess,
+ EventAccess,
+ IndexerAccess,
+ Nothing,
+ }
+
+ //
+ // This is just as a hint to AddressOf of what will be done with the
+ // address.
+ [Flags]
+ public enum AddressOp {
+ Store = 1,
+ Load = 2,
+ LoadStore = 3
+ };
+
+ /// <summary>
+ /// This interface is implemented by variables
+ /// </summary>
+ public interface IMemoryLocation {
+ /// <summary>
+ /// The AddressOf method should generate code that loads
+ /// the address of the object and leaves it on the stack.
+ ///
+ /// The `mode' argument is used to notify the expression
+ /// of whether this will be used to read from the address or
+ /// write to the address.
+ ///
+ /// This is just a hint that can be used to provide good error
+ /// reporting, and should have no other side effects.
+ /// </summary>
+ void AddressOf (EmitContext ec, AddressOp mode);
+ }
+
+ /// <remarks>
+ /// Base class for expressions
+ /// </remarks>
+ public abstract class Expression {
+ public ExprClass eclass;
+ protected Type type;
+
+ public Type Type {
+ get {
+ return type;
+ }
+
+ set {
+ type = value;
+ }
+ }
+
+ /// <summary>
+ /// Utility wrapper routine for Error, just to beautify the code
+ /// </summary>
+ static protected void Error (int error, string s)
+ {
+ Report.Error (error, s);
+ }
+
+ static protected void Error (int error, Location loc, string s)
+ {
+ Report.Error (error, loc, s);
+ }
+
+ /// <summary>
+ /// Utility wrapper routine for Warning, just to beautify the code
+ /// </summary>
+ static protected void Warning (int warning, string s)
+ {
+ Report.Warning (warning, s);
+ }
+
+ static public void Error_CannotConvertType (Location loc, Type source, Type target)
+ {
+ Report.Error (30, loc, "Cannot convert type '" +
+ TypeManager.CSharpName (source) + "' to '" +
+ TypeManager.CSharpName (target) + "'");
+ }
+
+ /// <summary>
+ /// Performs semantic analysis on the Expression
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Resolve method is invoked to perform the semantic analysis
+ /// on the node.
+ ///
+ /// The return value is an expression (it can be the
+ /// same expression in some cases) or a new
+ /// expression that better represents this node.
+ ///
+ /// For example, optimizations of Unary (LiteralInt)
+ /// would return a new LiteralInt with a negated
+ /// value.
+ ///
+ /// If there is an error during semantic analysis,
+ /// then an error should be reported (using Report)
+ /// and a null value should be returned.
+ ///
+ /// There are two side effects expected from calling
+ /// Resolve(): the the field variable "eclass" should
+ /// be set to any value of the enumeration
+ /// `ExprClass' and the type variable should be set
+ /// to a valid type (this is the type of the
+ /// expression).
+ /// </remarks>
+ public abstract Expression DoResolve (EmitContext ec);
+
+ public virtual Expression DoResolveLValue (EmitContext ec, Expression right_side)
+ {
+ return DoResolve (ec);
+ }
+
+ /// <summary>
+ /// Resolves an expression and performs semantic analysis on it.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Currently Resolve wraps DoResolve to perform sanity
+ /// checking and assertion checking on what we expect from Resolve.
+ /// </remarks>
+ public Expression Resolve (EmitContext ec)
+ {
+ Expression e = DoResolve (ec);
+
+ if (e != null){
+
+ if (e is SimpleName){
+ SimpleName s = (SimpleName) e;
+
+ Report.Error (
+ 103, s.Location,
+ "The name `" + s.Name + "' could not be found in `" +
+ ec.DeclSpace.Name + "'");
+ return null;
+ }
+
+ if (e.eclass == ExprClass.Invalid)
+ throw new Exception ("Expression " + e.GetType () +
+ " ExprClass is Invalid after resolve");
+
+ if (e.eclass != ExprClass.MethodGroup)
+ if (e.type == null)
+ throw new Exception (
+ "Expression " + e.GetType () +
+ " did not set its type after Resolve\n" +
+ "called from: " + this.GetType ());
+ }
+
+ return e;
+ }
+
+ /// <summary>
+ /// Performs expression resolution and semantic analysis, but
+ /// allows SimpleNames to be returned.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// This is used by MemberAccess to construct long names that can not be
+ /// partially resolved (namespace-qualified names for example).
+ /// </remarks>
+ public Expression ResolveWithSimpleName (EmitContext ec)
+ {
+ Expression e;
+
+ if (this is SimpleName)
+ e = ((SimpleName) this).DoResolveAllowStatic (ec);
+ else
+ e = DoResolve (ec);
+
+ if (e != null){
+ if (e is SimpleName)
+ return e;
+
+ if (e.eclass == ExprClass.Invalid)
+ throw new Exception ("Expression " + e +
+ " ExprClass is Invalid after resolve");
+
+ if (e.eclass != ExprClass.MethodGroup)
+ if (e.type == null)
+ throw new Exception ("Expression " + e +
+ " did not set its type after Resolve");
+ }
+
+ return e;
+ }
+
+ /// <summary>
+ /// Resolves an expression for LValue assignment
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Currently ResolveLValue wraps DoResolveLValue to perform sanity
+ /// checking and assertion checking on what we expect from Resolve
+ /// </remarks>
+ public Expression ResolveLValue (EmitContext ec, Expression right_side)
+ {
+ Expression e = DoResolveLValue (ec, right_side);
+
+ if (e != null){
+ if (e is SimpleName){
+ SimpleName s = (SimpleName) e;
+
+ Report.Error (
+ 103, s.Location,
+ "The name `" + s.Name + "' could not be found in `" +
+ ec.DeclSpace.Name + "'");
+ return null;
+ }
+
+ if (e.eclass == ExprClass.Invalid)
+ throw new Exception ("Expression " + e +
+ " ExprClass is Invalid after resolve");
+
+ if (e.eclass != ExprClass.MethodGroup)
+ if (e.type == null)
+ throw new Exception ("Expression " + e +
+ " did not set its type after Resolve");
+ }
+
+ return e;
+ }
+
+ /// <summary>
+ /// Emits the code for the expression
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The Emit method is invoked to generate the code
+ /// for the expression.
+ /// </remarks>
+ public abstract void Emit (EmitContext ec);
+
+ /// <summary>
+ /// Protected constructor. Only derivate types should
+ /// be able to be created
+ /// </summary>
+
+ protected Expression ()
+ {
+ eclass = ExprClass.Invalid;
+ type = null;
+ }
+
+ /// <summary>
+ /// Returns a literalized version of a literal FieldInfo
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The possible return values are:
+ /// IntConstant, UIntConstant
+ /// LongLiteral, ULongConstant
+ /// FloatConstant, DoubleConstant
+ /// StringConstant
+ ///
+ /// The value returned is already resolved.
+ /// </remarks>
+ public static Constant Constantify (object v, Type t)
+ {
+ if (t == TypeManager.int32_type)
+ return new IntConstant ((int) v);
+ else if (t == TypeManager.uint32_type)
+ return new UIntConstant ((uint) v);
+ else if (t == TypeManager.int64_type)
+ return new LongConstant ((long) v);
+ else if (t == TypeManager.uint64_type)
+ return new ULongConstant ((ulong) v);
+ else if (t == TypeManager.float_type)
+ return new FloatConstant ((float) v);
+ else if (t == TypeManager.double_type)
+ return new DoubleConstant ((double) v);
+ else if (t == TypeManager.string_type)
+ return new StringConstant ((string) v);
+ else if (t == TypeManager.short_type)
+ return new ShortConstant ((short)v);
+ else if (t == TypeManager.ushort_type)
+ return new UShortConstant ((ushort)v);
+ else if (t == TypeManager.sbyte_type)
+ return new SByteConstant (((sbyte)v));
+ else if (t == TypeManager.byte_type)
+ return new ByteConstant ((byte)v);
+ else if (t == TypeManager.char_type)
+ return new CharConstant ((char)v);
+ else if (TypeManager.IsEnumType (t)){
+ Expression e = Constantify (v, v.GetType ());
+
+ return new EnumConstant ((Constant) e, t);
+ } else
+ throw new Exception ("Unknown type for constant (" + t +
+ "), details: " + v);
+ }
+
+ /// <summary>
+ /// Returns a fully formed expression after a MemberLookup
+ /// </summary>
+ public static Expression ExprClassFromMemberInfo (EmitContext ec, MemberInfo mi, Location loc)
+ {
+ if (mi is EventInfo)
+ return new EventExpr ((EventInfo) mi, loc);
+ else if (mi is FieldInfo)
+ return new FieldExpr ((FieldInfo) mi, loc);
+ else if (mi is PropertyInfo)
+ return new PropertyExpr ((PropertyInfo) mi, loc);
+ else if (mi is Type){
+ return new TypeExpr ((System.Type) mi);
+ }
+
+ return null;
+ }
+
+ //
+ // Returns whether the array of memberinfos contains the given method
+ //
+ static bool ArrayContainsMethod (MemberInfo [] array, MethodBase new_method)
+ {
+ Type [] new_args = TypeManager.GetArgumentTypes (new_method);
+
+ foreach (MethodBase method in array){
+ if (method.Name != new_method.Name)
+ continue;
+
+ Type [] old_args = TypeManager.GetArgumentTypes (method);
+ int old_count = old_args.Length;
+ int i;
+
+ if (new_args.Length != old_count)
+ continue;
+
+ for (i = 0; i < old_count; i++){
+ if (old_args [i] != new_args [i])
+ break;
+ }
+ if (i != old_count)
+ continue;
+
+ if (!(method is MethodInfo && new_method is MethodInfo))
+ return true;
+
+ if (((MethodInfo) method).ReturnType == ((MethodInfo) new_method).ReturnType)
+ return true;
+ }
+ return false;
+ }
+
+ //
+ // 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.
+ //
+ public static ArrayList CopyNewMethods (ArrayList target_list, MemberInfo [] new_members)
+ {
+ if (target_list == null){
+ target_list = new ArrayList ();
+
+ target_list.AddRange (new_members);
+ return target_list;
+ }
+
+ MemberInfo [] target_array = new MemberInfo [target_list.Count];
+ target_list.CopyTo (target_array, 0);
+
+ foreach (MemberInfo mi in new_members){
+ MethodBase new_method = (MethodBase) mi;
+
+ if (!ArrayContainsMethod (target_array, new_method))
+ target_list.Add (new_method);
+ }
+ return target_list;
+ }
+
+ //
+ // FIXME: Probably implement a cache for (t,name,current_access_set)?
+ //
+ // This code could use some optimizations, but we need to do some
+ // measurements. For example, we could use a delegate to `flag' when
+ // something can not any longer be a method-group (because it is something
+ // else).
+ //
+ // Return values:
+ // If the return value is an Array, then it is an array of
+ // MethodBases
+ //
+ // If the return value is an MemberInfo, it is anything, but a Method
+ //
+ // null on error.
+ //
+ // FIXME: When calling MemberLookup inside an `Invocation', we should pass
+ // the arguments here and have MemberLookup return only the methods that
+ // match the argument count/type, unlike we are doing now (we delay this
+ // decision).
+ //
+ // This is so we can catch correctly attempts to invoke instance methods
+ // from a static body (scan for error 120 in ResolveSimpleName).
+ //
+ //
+ // FIXME: Potential optimization, have a static ArrayList
+ //
+
+ public static Expression MemberLookup (EmitContext ec, Type t, string name,
+ MemberTypes mt, BindingFlags bf, Location loc)
+ {
+ Type source_type = ec.ContainerType;
+
+ if (source_type != null){
+ if (source_type == t || source_type.IsSubclassOf (t))
+ bf |= BindingFlags.NonPublic;
+ }
+
+ //
+ // Lookup for members starting in the type requested and going
+ // up the hierarchy until a match is found.
+ //
+ // As soon as a non-method match is found, we return.
+ //
+ // If methods are found though, then the search proceeds scanning
+ // for more public methods in the hierarchy with signatures that
+ // do not match any of the signatures found so far.
+ //
+ ArrayList method_list = null;
+ Type current_type = t;
+ bool searching = true;
+ do {
+ MemberInfo [] mi;
+
+ mi = TypeManager.FindMembers (
+ current_type, mt, bf | BindingFlags.DeclaredOnly,
+ System.Type.FilterName, name);
+
+ if (current_type == TypeManager.object_type)
+ searching = false;
+ else {
+ current_type = current_type.BaseType;
+
+ //
+ // Only do private searches on the current type,
+ // never in our parents.
+ //
+ // bf &= ~BindingFlags.NonPublic;
+
+ //
+ // This happens with interfaces, they have a null
+ // basetype
+ //
+ if (current_type == null)
+ searching = false;
+ }
+
+ if (mi == null)
+ continue;
+
+ int count = mi.Length;
+
+ if (count == 0)
+ continue;
+
+ //
+ // Events are returned by both `static' and `instance'
+ // searches, which means that our above FindMembers will
+ // return two copies of the same.
+ //
+ if (count == 1 && !(mi [0] is MethodBase))
+ return Expression.ExprClassFromMemberInfo (ec, mi [0], loc);
+ if (count == 2 && (mi [0] is EventInfo))
+ return Expression.ExprClassFromMemberInfo (ec, mi [0], loc);
+
+ //
+ // We found methods, turn the search into "method scan"
+ // mode.
+ //
+ method_list = CopyNewMethods (method_list, mi);
+ mt &= (MemberTypes.Method | MemberTypes.Constructor);
+ } while (searching);
+
+ if (method_list != null && method_list.Count > 0)
+ return new MethodGroupExpr (method_list, loc);
+
+ //
+ // Interfaces do not list members they inherit, so we have to
+ // scan those.
+ //
+ if (!t.IsInterface)
+ return null;
+
+ Type [] ifaces = t.GetInterfaces ();
+
+ foreach (Type itype in ifaces){
+ Expression x;
+
+ x = MemberLookup (ec, itype, name, mt, bf, loc);
+ if (x != null)
+ return x;
+ }
+
+ return null;
+ }
+
+ public const MemberTypes AllMemberTypes =
+ MemberTypes.Constructor |
+ MemberTypes.Event |
+ MemberTypes.Field |
+ MemberTypes.Method |
+ MemberTypes.NestedType |
+ MemberTypes.Property;
+
+ public const BindingFlags AllBindingFlags =
+ BindingFlags.Public |
+ BindingFlags.Static |
+ BindingFlags.Instance;
+
+ public static Expression MemberLookup (EmitContext ec, Type t, string name, Location loc)
+ {
+ return MemberLookup (ec, t, name, AllMemberTypes, AllBindingFlags, loc);
+ }
+
+ /// <summary>
+ /// This is a wrapper for MemberLookup that is not used to "probe", but
+ /// to find a final definition. If the final definition is not found, we
+ /// look for private members and display a useful debugging message if we
+ /// find it.
+ /// </summary>
+ public static Expression MemberLookupFinal (EmitContext ec, Type t, string name,
+ Location loc)
+ {
+ Expression e;
+
+ e = MemberLookup (ec, t, name, AllMemberTypes, AllBindingFlags, loc);
+
+ if (e != null)
+ return e;
+
+ e = MemberLookup (ec, t, name, AllMemberTypes,
+ AllBindingFlags | BindingFlags.NonPublic, loc);
+ if (e == null){
+ Report.Error (
+ 117, loc, "`" + t + "' does not contain a definition " +
+ "for `" + name + "'");
+ } else {
+ Report.Error (
+ 122, loc, "`" + t + "." + name +
+ "' is inaccessible due to its protection level");
+ }
+
+ return null;
+ }
+
+ static public Expression ImplicitReferenceConversion (Expression expr, Type target_type)
+ {
+ Type expr_type = expr.Type;
+
+ if (expr_type == null && expr.eclass == ExprClass.MethodGroup){
+ // if we are a method group, emit a warning
+
+ expr.Emit (null);
+ }
+
+ if (target_type == TypeManager.object_type) {
+ //
+ // A pointer type cannot be converted to object
+ //
+ if (expr_type.IsPointer)
+ return null;
+
+ if (expr_type.IsValueType)
+ return new BoxedCast (expr);
+ if (expr_type.IsClass || expr_type.IsInterface)
+ return new EmptyCast (expr, target_type);
+ } else if (expr_type.IsSubclassOf (target_type)) {
+ return new EmptyCast (expr, target_type);
+ } else {
+
+ // This code is kind of mirrored inside StandardConversionExists
+ // with the small distinction that we only probe there
+ //
+ // Always ensure that the code here and there is in sync
+
+ // from the null type to any reference-type.
+ if (expr is NullLiteral && !target_type.IsValueType)
+ return new EmptyCast (expr, target_type);
+
+ // from any class-type S to any interface-type T.
+ if (expr_type.IsClass && target_type.IsInterface) {
+ if (TypeManager.ImplementsInterface (expr_type, target_type))
+ return new EmptyCast (expr, target_type);
+ else
+ return null;
+ }
+
+ // from any interface type S to interface-type T.
+ if (expr_type.IsInterface && target_type.IsInterface) {
+
+ if (TypeManager.ImplementsInterface (expr_type, target_type))
+ return new EmptyCast (expr, target_type);
+ else
+ return null;
+ }
+
+ // from an array-type S to an array-type of type T
+ if (expr_type.IsArray && target_type.IsArray) {
+ if (expr_type.GetArrayRank () == target_type.GetArrayRank ()) {
+
+ Type expr_element_type = expr_type.GetElementType ();
+
+ if (MyEmptyExpr == null)
+ MyEmptyExpr = new EmptyExpression ();
+
+ MyEmptyExpr.SetType (expr_element_type);
+ Type target_element_type = target_type.GetElementType ();
+
+ if (!expr_element_type.IsValueType && !target_element_type.IsValueType)
+ if (StandardConversionExists (MyEmptyExpr,
+ target_element_type))
+ return new EmptyCast (expr, target_type);
+ }
+ }
+
+
+ // from an array-type to System.Array
+ if (expr_type.IsArray && target_type == TypeManager.array_type)
+ return new EmptyCast (expr, target_type);
+
+ // from any delegate type to System.Delegate
+ if (expr_type.IsSubclassOf (TypeManager.delegate_type) &&
+ target_type == TypeManager.delegate_type)
+ return new EmptyCast (expr, target_type);
+
+ // from any array-type or delegate type into System.ICloneable.
+ if (expr_type.IsArray || expr_type.IsSubclassOf (TypeManager.delegate_type))
+ if (target_type == TypeManager.icloneable_type)
+ return new EmptyCast (expr, target_type);
+
+ return null;
+
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Handles expressions like this: decimal d; d = 1;
+ /// and changes them into: decimal d; d = new System.Decimal (1);
+ /// </summary>
+ static Expression InternalTypeConstructor (EmitContext ec, Expression expr, Type target)
+ {
+ ArrayList args = new ArrayList ();
+
+ args.Add (new Argument (expr, Argument.AType.Expression));
+
+ Expression ne = new New (target.FullName, args,
+ new Location (-1));
+
+ return ne.Resolve (ec);
+ }
+
+ /// <summary>
+ /// Implicit Numeric Conversions.
+ ///
+ /// expr is the expression to convert, returns a new expression of type
+ /// target_type or null if an implicit conversion is not possible.
+ /// </summary>
+ static public Expression ImplicitNumericConversion (EmitContext ec, Expression expr,
+ Type target_type, Location loc)
+ {
+ Type expr_type = expr.Type;
+
+ //
+ // Attempt to do the implicit constant expression conversions
+
+ if (expr is IntConstant){
+ Expression e;
+
+ e = TryImplicitIntConversion (target_type, (IntConstant) expr);
+
+ if (e != null)
+ return e;
+ } else if (expr is LongConstant && target_type == TypeManager.uint64_type){
+ //
+ // Try the implicit constant expression conversion
+ // from long to ulong, instead of a nice routine,
+ // we just inline it
+ //
+ long v = ((LongConstant) expr).Value;
+ if (v > 0)
+ return new ULongConstant ((ulong) v);
+ }
+
+ //
+ // If we have an enumeration, extract the underlying type,
+ // use this during the comparission, but wrap around the original
+ // target_type
+ //
+ Type real_target_type = target_type;
+
+ if (TypeManager.IsEnumType (real_target_type))
+ real_target_type = TypeManager.EnumToUnderlying (real_target_type);
+
+ if (expr_type == real_target_type)
+ return new EmptyCast (expr, target_type);
+
+ if (expr_type == TypeManager.sbyte_type){
+ //
+ // From sbyte to short, int, long, float, double.
+ //
+ if (real_target_type == TypeManager.int32_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_I4);
+ if (real_target_type == TypeManager.int64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_I8);
+ if (real_target_type == TypeManager.double_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
+ if (real_target_type == TypeManager.float_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
+ if (real_target_type == TypeManager.short_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_I2);
+ if (real_target_type == TypeManager.decimal_type)
+ return InternalTypeConstructor (ec, expr, target_type);
+ } else if (expr_type == TypeManager.byte_type){
+ //
+ // From byte to short, ushort, int, uint, long, ulong, float, double
+ //
+ if ((real_target_type == TypeManager.short_type) ||
+ (real_target_type == TypeManager.ushort_type) ||
+ (real_target_type == TypeManager.int32_type) ||
+ (real_target_type == TypeManager.uint32_type))
+ return new EmptyCast (expr, target_type);
+
+ if (real_target_type == TypeManager.uint64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_U8);
+ if (real_target_type == TypeManager.int64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_I8);
+ if (real_target_type == TypeManager.float_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
+ if (real_target_type == TypeManager.double_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
+ if (real_target_type == TypeManager.decimal_type)
+ return InternalTypeConstructor (ec, expr, target_type);
+ } else if (expr_type == TypeManager.short_type){
+ //
+ // From short to int, long, float, double
+ //
+ if (real_target_type == TypeManager.int32_type)
+ return new EmptyCast (expr, target_type);
+ if (real_target_type == TypeManager.int64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_I8);
+ if (real_target_type == TypeManager.double_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
+ if (real_target_type == TypeManager.float_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
+ if (real_target_type == TypeManager.decimal_type)
+ return InternalTypeConstructor (ec, expr, target_type);
+ } else if (expr_type == TypeManager.ushort_type){
+ //
+ // From ushort to int, uint, long, ulong, float, double
+ //
+ if (real_target_type == TypeManager.uint32_type)
+ return new EmptyCast (expr, target_type);
+
+ if (real_target_type == TypeManager.uint64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_U8);
+ if (real_target_type == TypeManager.int32_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_I4);
+ if (real_target_type == TypeManager.int64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_I8);
+ if (real_target_type == TypeManager.double_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
+ if (real_target_type == TypeManager.float_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
+ if (real_target_type == TypeManager.decimal_type)
+ return InternalTypeConstructor (ec, expr, target_type);
+ } else if (expr_type == TypeManager.int32_type){
+ //
+ // From int to long, float, double
+ //
+ if (real_target_type == TypeManager.int64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_I8);
+ if (real_target_type == TypeManager.double_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
+ if (real_target_type == TypeManager.float_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
+ if (real_target_type == TypeManager.decimal_type)
+ return InternalTypeConstructor (ec, expr, target_type);
+ } else if (expr_type == TypeManager.uint32_type){
+ //
+ // From uint to long, ulong, float, double
+ //
+ if (real_target_type == TypeManager.int64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_U8);
+ if (real_target_type == TypeManager.uint64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_U8);
+ if (real_target_type == TypeManager.double_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R_Un,
+ OpCodes.Conv_R8);
+ if (real_target_type == TypeManager.float_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R_Un,
+ OpCodes.Conv_R4);
+ if (real_target_type == TypeManager.decimal_type)
+ return InternalTypeConstructor (ec, expr, target_type);
+ } else if ((expr_type == TypeManager.uint64_type) ||
+ (expr_type == TypeManager.int64_type)){
+ //
+ // From long/ulong to float, double
+ //
+ if (real_target_type == TypeManager.double_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R_Un,
+ OpCodes.Conv_R8);
+ if (real_target_type == TypeManager.float_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R_Un,
+ OpCodes.Conv_R4);
+ if (real_target_type == TypeManager.decimal_type)
+ return InternalTypeConstructor (ec, expr, target_type);
+ } else if (expr_type == TypeManager.char_type){
+ //
+ // From char to ushort, int, uint, long, ulong, float, double
+ //
+ if ((real_target_type == TypeManager.ushort_type) ||
+ (real_target_type == TypeManager.int32_type) ||
+ (real_target_type == TypeManager.uint32_type))
+ return new EmptyCast (expr, target_type);
+ if (real_target_type == TypeManager.uint64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_U8);
+ if (real_target_type == TypeManager.int64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_I8);
+ if (real_target_type == TypeManager.float_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R4);
+ if (real_target_type == TypeManager.double_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
+ if (real_target_type == TypeManager.decimal_type)
+ return InternalTypeConstructor (ec, expr, target_type);
+ } else if (expr_type == TypeManager.float_type){
+ //
+ // float to double
+ //
+ if (real_target_type == TypeManager.double_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_R8);
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Determines if a standard implicit conversion exists from
+ /// expr_type to target_type
+ /// </summary>
+ public static bool StandardConversionExists (Expression expr, Type target_type)
+ {
+ Type expr_type = expr.Type;
+
+ if (expr_type == target_type)
+ return true;
+
+ // First numeric conversions
+
+ if (expr_type == TypeManager.sbyte_type){
+ //
+ // From sbyte to short, int, long, float, double.
+ //
+ if ((target_type == TypeManager.int32_type) ||
+ (target_type == TypeManager.int64_type) ||
+ (target_type == TypeManager.double_type) ||
+ (target_type == TypeManager.float_type) ||
+ (target_type == TypeManager.short_type) ||
+ (target_type == TypeManager.decimal_type))
+ return true;
+
+ } else if (expr_type == TypeManager.byte_type){
+ //
+ // From byte to short, ushort, int, uint, long, ulong, float, double
+ //
+ if ((target_type == TypeManager.short_type) ||
+ (target_type == TypeManager.ushort_type) ||
+ (target_type == TypeManager.int32_type) ||
+ (target_type == TypeManager.uint32_type) ||
+ (target_type == TypeManager.uint64_type) ||
+ (target_type == TypeManager.int64_type) ||
+ (target_type == TypeManager.float_type) ||
+ (target_type == TypeManager.double_type) ||
+ (target_type == TypeManager.decimal_type))
+ return true;
+
+ } else if (expr_type == TypeManager.short_type){
+ //
+ // From short to int, long, float, double
+ //
+ if ((target_type == TypeManager.int32_type) ||
+ (target_type == TypeManager.int64_type) ||
+ (target_type == TypeManager.double_type) ||
+ (target_type == TypeManager.float_type) ||
+ (target_type == TypeManager.decimal_type))
+ return true;
+
+ } else if (expr_type == TypeManager.ushort_type){
+ //
+ // From ushort to int, uint, long, ulong, float, double
+ //
+ if ((target_type == TypeManager.uint32_type) ||
+ (target_type == TypeManager.uint64_type) ||
+ (target_type == TypeManager.int32_type) ||
+ (target_type == TypeManager.int64_type) ||
+ (target_type == TypeManager.double_type) ||
+ (target_type == TypeManager.float_type) ||
+ (target_type == TypeManager.decimal_type))
+ return true;
+
+ } else if (expr_type == TypeManager.int32_type){
+ //
+ // From int to long, float, double
+ //
+ if ((target_type == TypeManager.int64_type) ||
+ (target_type == TypeManager.double_type) ||
+ (target_type == TypeManager.float_type) ||
+ (target_type == TypeManager.decimal_type))
+ return true;
+
+ } else if (expr_type == TypeManager.uint32_type){
+ //
+ // From uint to long, ulong, float, double
+ //
+ if ((target_type == TypeManager.int64_type) ||
+ (target_type == TypeManager.uint64_type) ||
+ (target_type == TypeManager.double_type) ||
+ (target_type == TypeManager.float_type) ||
+ (target_type == TypeManager.decimal_type))
+ return true;
+
+ } else if ((expr_type == TypeManager.uint64_type) ||
+ (expr_type == TypeManager.int64_type)) {
+ //
+ // From long/ulong to float, double
+ //
+ if ((target_type == TypeManager.double_type) ||
+ (target_type == TypeManager.float_type) ||
+ (target_type == TypeManager.decimal_type))
+ return true;
+
+ } else if (expr_type == TypeManager.char_type){
+ //
+ // From char to ushort, int, uint, long, ulong, float, double
+ //
+ if ((target_type == TypeManager.ushort_type) ||
+ (target_type == TypeManager.int32_type) ||
+ (target_type == TypeManager.uint32_type) ||
+ (target_type == TypeManager.uint64_type) ||
+ (target_type == TypeManager.int64_type) ||
+ (target_type == TypeManager.float_type) ||
+ (target_type == TypeManager.double_type) ||
+ (target_type == TypeManager.decimal_type))
+ return true;
+
+ } else if (expr_type == TypeManager.float_type){
+ //
+ // float to double
+ //
+ if (target_type == TypeManager.double_type)
+ return true;
+ }
+
+ // Next reference conversions
+
+ if (target_type == TypeManager.object_type) {
+ if ((expr_type.IsClass) ||
+ (expr_type.IsValueType))
+ return true;
+
+ } else if (expr_type.IsSubclassOf (target_type)) {
+ return true;
+
+ } else {
+ // Please remember that all code below actually comes
+ // from ImplicitReferenceConversion so make sure code remains in sync
+
+ // from any class-type S to any interface-type T.
+ if (expr_type.IsClass && target_type.IsInterface) {
+ if (TypeManager.ImplementsInterface (expr_type, target_type))
+ return true;
+ }
+
+ // from any interface type S to interface-type T.
+ // FIXME : Is it right to use IsAssignableFrom ?
+ if (expr_type.IsInterface && target_type.IsInterface)
+ if (target_type.IsAssignableFrom (expr_type))
+ return true;
+
+ // from an array-type S to an array-type of type T
+ if (expr_type.IsArray && target_type.IsArray) {
+ if (expr_type.GetArrayRank () == target_type.GetArrayRank ()) {
+
+ Type expr_element_type = expr_type.GetElementType ();
+
+ if (MyEmptyExpr == null)
+ MyEmptyExpr = new EmptyExpression ();
+
+ MyEmptyExpr.SetType (expr_element_type);
+ Type target_element_type = target_type.GetElementType ();
+
+ if (!expr_element_type.IsValueType && !target_element_type.IsValueType)
+ if (StandardConversionExists (MyEmptyExpr,
+ target_element_type))
+ return true;
+ }
+ }
+
+ // from an array-type to System.Array
+ if (expr_type.IsArray && target_type.IsAssignableFrom (expr_type))
+ return true;
+
+ // from any delegate type to System.Delegate
+ if (expr_type.IsSubclassOf (TypeManager.delegate_type) &&
+ target_type == TypeManager.delegate_type)
+ if (target_type.IsAssignableFrom (expr_type))
+ return true;
+
+ // from any array-type or delegate type into System.ICloneable.
+ if (expr_type.IsArray || expr_type.IsSubclassOf (TypeManager.delegate_type))
+ if (target_type == TypeManager.icloneable_type)
+ return true;
+
+ // from the null type to any reference-type.
+ if (expr is NullLiteral && !target_type.IsValueType)
+ return true;
+
+ }
+
+ return false;
+ }
+
+ static EmptyExpression MyEmptyExpr;
+ /// <summary>
+ /// Tells whether an implicit conversion exists from expr_type to
+ /// target_type
+ /// </summary>
+ public bool ImplicitConversionExists (EmitContext ec, Type expr_type, Type target_type,
+ Location l)
+ {
+ if (MyEmptyExpr == null)
+ MyEmptyExpr = new EmptyExpression (expr_type);
+ else
+ MyEmptyExpr.SetType (expr_type);
+
+ return ConvertImplicit (ec, MyEmptyExpr, target_type, l) != null;
+ }
+
+ /// <summary>
+ /// Finds "most encompassed type" according to the spec (13.4.2)
+ /// amongst the methods in the MethodGroupExpr which convert from a
+ /// type encompassing source_type
+ /// </summary>
+ static Type FindMostEncompassedType (MethodGroupExpr me, Type source_type)
+ {
+ Type best = null;
+
+ for (int i = me.Methods.Length; i > 0; ) {
+ i--;
+
+ MethodBase mb = me.Methods [i];
+ ParameterData pd = Invocation.GetParameterData (mb);
+ Type param_type = pd.ParameterType (0);
+
+ Expression source = new EmptyExpression (source_type);
+ Expression param = new EmptyExpression (param_type);
+
+ if (StandardConversionExists (source, param_type)) {
+ if (best == null)
+ best = param_type;
+
+ if (StandardConversionExists (param, best))
+ best = param_type;
+ }
+ }
+
+ return best;
+ }
+
+ /// <summary>
+ /// Finds "most encompassing type" according to the spec (13.4.2)
+ /// amongst the methods in the MethodGroupExpr which convert to a
+ /// type encompassed by target_type
+ /// </summary>
+ static Type FindMostEncompassingType (MethodGroupExpr me, Type target)
+ {
+ Type best = null;
+
+ for (int i = me.Methods.Length; i > 0; ) {
+ i--;
+
+ MethodInfo mi = (MethodInfo) me.Methods [i];
+ Type ret_type = mi.ReturnType;
+
+ Expression ret = new EmptyExpression (ret_type);
+
+ if (StandardConversionExists (ret, target)) {
+ if (best == null)
+ best = ret_type;
+
+ if (!StandardConversionExists (ret, best))
+ best = ret_type;
+ }
+
+ }
+
+ return best;
+
+ }
+
+
+ /// <summary>
+ /// User-defined Implicit conversions
+ /// </summary>
+ static public Expression ImplicitUserConversion (EmitContext ec, Expression source,
+ Type target, Location loc)
+ {
+ return UserDefinedConversion (ec, source, target, loc, false);
+ }
+
+ /// <summary>
+ /// User-defined Explicit conversions
+ /// </summary>
+ static public Expression ExplicitUserConversion (EmitContext ec, Expression source,
+ Type target, Location loc)
+ {
+ return UserDefinedConversion (ec, source, target, loc, true);
+ }
+
+ /// <summary>
+ /// User-defined conversions
+ /// </summary>
+ static public Expression UserDefinedConversion (EmitContext ec, Expression source,
+ Type target, Location loc,
+ bool look_for_explicit)
+ {
+ Expression mg1 = null, mg2 = null;
+ Expression mg5 = null, mg6 = null, mg7 = null, mg8 = null;
+ Expression e;
+ MethodBase method = null;
+ Type source_type = source.Type;
+
+ string op_name;
+
+ // If we have a boolean type, we need to check for the True operator
+
+ // FIXME : How does the False operator come into the picture ?
+ // FIXME : This doesn't look complete and very correct !
+ if (target == TypeManager.bool_type)
+ op_name = "op_True";
+ else
+ op_name = "op_Implicit";
+
+#if old
+ //
+ // FIXME: This whole process can be optimized to check if the
+ // return is non-null and make the union as we go.
+ //
+ mg1 = MemberLookup (ec, source_type, op_name, loc);
+
+ if (source_type.BaseType != null)
+ mg2 = MemberLookup (ec, source_type.BaseType, op_name, loc);
+
+ mg3 = MemberLookup (ec, target, op_name, loc);
+
+ if (target.BaseType != null)
+ mg4 = MemberLookup (ec, target.BaseType, op_name, loc);
+
+ MethodGroupExpr union1 = Invocation.MakeUnionSet (mg1, mg2, loc);
+ MethodGroupExpr union2 = Invocation.MakeUnionSet (mg3, mg4, loc);
+
+ MethodGroupExpr union3 = Invocation.MakeUnionSet (union1, union2, loc);
+#else
+ MethodGroupExpr union3;
+
+ mg1 = MemberLookup (ec, source_type, op_name, loc);
+ if (source_type.BaseType != null)
+ mg2 = MemberLookup (ec, source_type.BaseType, op_name, MemberTypes.Method, AllBindingFlags, loc);
+
+ if (mg1 == null)
+ union3 = (MethodGroupExpr) mg2;
+ else if (mg2 == null)
+ union3 = (MethodGroupExpr) mg1;
+ else
+ union3 = Invocation.MakeUnionSet (mg1, mg2, loc);
+
+ mg1 = MemberLookup (ec, target, op_name, MemberTypes.Method, AllBindingFlags, loc);
+ if (mg1 != null){
+ if (union3 != null)
+ union3 = Invocation.MakeUnionSet (union3, mg1, loc);
+ else
+ union3 = (MethodGroupExpr) mg1;
+ }
+ if (target.BaseType != null)
+ mg1 = MemberLookup (ec, target.BaseType, op_name, MemberTypes.Method, AllBindingFlags, loc);
+
+ if (mg1 != null){
+ if (union3 != null)
+ union3 = Invocation.MakeUnionSet (union3, mg1, loc);
+ else
+ union3 = (MethodGroupExpr) mg1;
+ }
+#endif
+ MethodGroupExpr union4 = null;
+
+ if (look_for_explicit) {
+
+ op_name = "op_Explicit";
+
+ mg5 = MemberLookup (ec, source_type, op_name, loc);
+
+ if (source_type.BaseType != null)
+ mg6 = MemberLookup (ec, source_type.BaseType, op_name, loc);
+
+ mg7 = MemberLookup (ec, target, op_name, loc);
+
+ if (target.BaseType != null)
+ mg8 = MemberLookup (ec, target.BaseType, op_name, loc);
+
+ MethodGroupExpr union5 = Invocation.MakeUnionSet (mg5, mg6, loc);
+ MethodGroupExpr union6 = Invocation.MakeUnionSet (mg7, mg8, loc);
+
+ union4 = Invocation.MakeUnionSet (union5, union6, loc);
+ }
+
+ MethodGroupExpr union = Invocation.MakeUnionSet (union3, union4, loc);
+
+ if (union != null) {
+
+ Type most_specific_source, most_specific_target;
+
+ most_specific_source = FindMostEncompassedType (union, source_type);
+ if (most_specific_source == null)
+ return null;
+
+ most_specific_target = FindMostEncompassingType (union, target);
+ if (most_specific_target == null)
+ return null;
+
+ int count = 0;
+
+ for (int i = union.Methods.Length; i > 0;) {
+ i--;
+
+ MethodBase mb = union.Methods [i];
+ ParameterData pd = Invocation.GetParameterData (mb);
+ MethodInfo mi = (MethodInfo) union.Methods [i];
+
+ if (pd.ParameterType (0) == most_specific_source &&
+ mi.ReturnType == most_specific_target) {
+ method = mb;
+ count++;
+ }
+ }
+
+ if (method == null || count > 1) {
+ Report.Error (-11, loc, "Ambiguous user defined conversion");
+ return null;
+ }
+
+ //
+ // This will do the conversion to the best match that we
+ // found. Now we need to perform an implict standard conversion
+ // if the best match was not the type that we were requested
+ // by target.
+ //
+ if (look_for_explicit)
+ source = ConvertExplicitStandard (ec, source, most_specific_source, loc);
+ else
+ source = ConvertImplicitStandard (ec, source,
+ most_specific_source, loc);
+
+ if (source == null)
+ return null;
+
+ e = new UserCast ((MethodInfo) method, source);
+
+ if (e.Type != target){
+ if (!look_for_explicit)
+ e = ConvertImplicitStandard (ec, e, target, loc);
+ else
+ e = ConvertExplicitStandard (ec, e, target, loc);
+
+ return e;
+ } else
+ return e;
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Converts implicitly the resolved expression `expr' into the
+ /// `target_type'. It returns a new expression that can be used
+ /// in a context that expects a `target_type'.
+ /// </summary>
+ static public Expression ConvertImplicit (EmitContext ec, Expression expr,
+ Type target_type, Location loc)
+ {
+ Type expr_type = expr.Type;
+ Expression e;
+
+ if (expr_type == target_type)
+ return expr;
+
+ if (target_type == null)
+ throw new Exception ("Target type is null");
+
+ e = ConvertImplicitStandard (ec, expr, target_type, loc);
+ if (e != null)
+ return e;
+
+ e = ImplicitUserConversion (ec, expr, target_type, loc);
+ if (e != null)
+ return e;
+
+ return null;
+ }
+
+
+ /// <summary>
+ /// Attempts to apply the `Standard Implicit
+ /// Conversion' rules to the expression `expr' into
+ /// the `target_type'. It returns a new expression
+ /// that can be used in a context that expects a
+ /// `target_type'.
+ ///
+ /// This is different from `ConvertImplicit' in that the
+ /// user defined implicit conversions are excluded.
+ /// </summary>
+ static public Expression ConvertImplicitStandard (EmitContext ec, Expression expr,
+ Type target_type, Location loc)
+ {
+ Type expr_type = expr.Type;
+ Expression e;
+
+ if (expr_type == target_type)
+ return expr;
+
+ e = ImplicitNumericConversion (ec, expr, target_type, loc);
+ if (e != null)
+ return e;
+
+ e = ImplicitReferenceConversion (expr, target_type);
+ if (e != null)
+ return e;
+
+ if (target_type.IsSubclassOf (TypeManager.enum_type) && expr is IntLiteral){
+ IntLiteral i = (IntLiteral) expr;
+
+ if (i.Value == 0)
+ return new EmptyCast (expr, target_type);
+ }
+
+ if (ec.InUnsafe) {
+ if (expr_type.IsPointer){
+ if (target_type == TypeManager.void_ptr_type)
+ return new EmptyCast (expr, target_type);
+
+ //
+ // yep, comparing pointer types cant be done with
+ // t1 == t2, we have to compare their element types.
+ //
+ if (target_type.IsPointer){
+ if (target_type.GetElementType()==expr_type.GetElementType())
+ return expr;
+ }
+ }
+
+ if (target_type.IsPointer){
+ if (expr is NullLiteral)
+ return new EmptyCast (expr, target_type);
+ }
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Attemps to perform an implict constant conversion of the IntConstant
+ /// into a different data type using casts (See Implicit Constant
+ /// Expression Conversions)
+ /// </summary>
+ static protected Expression TryImplicitIntConversion (Type target_type, IntConstant ic)
+ {
+ int value = ic.Value;
+
+ //
+ // FIXME: This could return constants instead of EmptyCasts
+ //
+ if (target_type == TypeManager.sbyte_type){
+ 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)
+ return new ByteConstant ((byte) value);
+ } else if (target_type == TypeManager.short_type){
+ if (value >= Int16.MinValue && value <= Int16.MaxValue)
+ return new ShortConstant ((short) value);
+ } else if (target_type == TypeManager.ushort_type){
+ if (value >= UInt16.MinValue && value <= UInt16.MaxValue)
+ return new UShortConstant ((ushort) value);
+ } else if (target_type == TypeManager.uint32_type){
+ if (value >= 0)
+ return new UIntConstant ((uint) value);
+ } else if (target_type == TypeManager.uint64_type){
+ //
+ // we can optimize this case: a positive int32
+ // always fits on a uint64. But we need an opcode
+ // to do it.
+ //
+ if (value >= 0)
+ return new ULongConstant ((ulong) value);
+ }
+
+ if (value == 0 && ic is IntLiteral && TypeManager.IsEnumType (target_type))
+ return new EnumConstant (ic, target_type);
+
+ return null;
+ }
+
+ static public void Error_CannotConvertImplicit (Location loc, Type source, Type target)
+ {
+ string msg = "Cannot convert implicitly from `"+
+ TypeManager.CSharpName (source) + "' to `" +
+ TypeManager.CSharpName (target) + "'";
+
+ Error (29, loc, msg);
+ }
+
+ /// <summary>
+ /// Attemptes to implicityly convert `target' into `type', using
+ /// ConvertImplicit. If there is no implicit conversion, then
+ /// an error is signaled
+ /// </summary>
+ static public Expression ConvertImplicitRequired (EmitContext ec, Expression source,
+ Type target_type, Location loc)
+ {
+ Expression e;
+
+ e = ConvertImplicit (ec, source, target_type, loc);
+ if (e != null)
+ return e;
+
+ if (source is DoubleLiteral && target_type == TypeManager.float_type){
+ Error (664, loc,
+ "Double literal cannot be implicitly converted to " +
+ "float type, use F suffix to create a float literal");
+ }
+
+ Error_CannotConvertImplicit (loc, source.Type, target_type);
+
+ return null;
+ }
+
+ /// <summary>
+ /// Performs the explicit numeric conversions
+ /// </summary>
+ static Expression ConvertNumericExplicit (EmitContext ec, Expression expr,
+ Type target_type)
+ {
+ Type expr_type = expr.Type;
+
+ //
+ // If we have an enumeration, extract the underlying type,
+ // use this during the comparission, but wrap around the original
+ // target_type
+ //
+ Type real_target_type = target_type;
+
+ if (TypeManager.IsEnumType (real_target_type))
+ real_target_type = TypeManager.EnumToUnderlying (real_target_type);
+
+ if (expr_type == TypeManager.sbyte_type){
+ //
+ // From sbyte to byte, ushort, uint, ulong, char
+ //
+ if (real_target_type == TypeManager.byte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I1_U1);
+ if (real_target_type == TypeManager.ushort_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I1_U2);
+ if (real_target_type == TypeManager.uint32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I1_U4);
+ if (real_target_type == TypeManager.uint64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I1_U8);
+ if (real_target_type == TypeManager.char_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I1_CH);
+ } else if (expr_type == TypeManager.byte_type){
+ //
+ // From byte to sbyte and char
+ //
+ if (real_target_type == TypeManager.sbyte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U1_I1);
+ if (real_target_type == TypeManager.char_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U1_CH);
+ } else if (expr_type == TypeManager.short_type){
+ //
+ // From short to sbyte, byte, ushort, uint, ulong, char
+ //
+ if (real_target_type == TypeManager.sbyte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_I1);
+ if (real_target_type == TypeManager.byte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_U1);
+ if (real_target_type == TypeManager.ushort_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_U2);
+ if (real_target_type == TypeManager.uint32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_U4);
+ if (real_target_type == TypeManager.uint64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_U8);
+ if (real_target_type == TypeManager.char_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I2_CH);
+ } else if (expr_type == TypeManager.ushort_type){
+ //
+ // From ushort to sbyte, byte, short, char
+ //
+ if (real_target_type == TypeManager.sbyte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U2_I1);
+ if (real_target_type == TypeManager.byte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U2_U1);
+ if (real_target_type == TypeManager.short_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U2_I2);
+ if (real_target_type == TypeManager.char_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U2_CH);
+ } else if (expr_type == TypeManager.int32_type){
+ //
+ // From int to sbyte, byte, short, ushort, uint, ulong, char
+ //
+ if (real_target_type == TypeManager.sbyte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_I1);
+ if (real_target_type == TypeManager.byte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_U1);
+ if (real_target_type == TypeManager.short_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_I2);
+ if (real_target_type == TypeManager.ushort_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_U2);
+ if (real_target_type == TypeManager.uint32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_U4);
+ if (real_target_type == TypeManager.uint64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_U8);
+ if (real_target_type == TypeManager.char_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I4_CH);
+ } else if (expr_type == TypeManager.uint32_type){
+ //
+ // From uint to sbyte, byte, short, ushort, int, char
+ //
+ if (real_target_type == TypeManager.sbyte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_I1);
+ if (real_target_type == TypeManager.byte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_U1);
+ if (real_target_type == TypeManager.short_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_I2);
+ if (real_target_type == TypeManager.ushort_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_U2);
+ if (real_target_type == TypeManager.int32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_I4);
+ if (real_target_type == TypeManager.char_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U4_CH);
+ } else if (expr_type == TypeManager.int64_type){
+ //
+ // From long to sbyte, byte, short, ushort, int, uint, ulong, char
+ //
+ if (real_target_type == TypeManager.sbyte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_I1);
+ if (real_target_type == TypeManager.byte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_U1);
+ if (real_target_type == TypeManager.short_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_I2);
+ if (real_target_type == TypeManager.ushort_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_U2);
+ if (real_target_type == TypeManager.int32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_I4);
+ if (real_target_type == TypeManager.uint32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_U4);
+ if (real_target_type == TypeManager.uint64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_U8);
+ if (real_target_type == TypeManager.char_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.I8_CH);
+ } else if (expr_type == TypeManager.uint64_type){
+ //
+ // From ulong to sbyte, byte, short, ushort, int, uint, long, char
+ //
+ if (real_target_type == TypeManager.sbyte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_I1);
+ if (real_target_type == TypeManager.byte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_U1);
+ if (real_target_type == TypeManager.short_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_I2);
+ if (real_target_type == TypeManager.ushort_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_U2);
+ if (real_target_type == TypeManager.int32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_I4);
+ if (real_target_type == TypeManager.uint32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_U4);
+ if (real_target_type == TypeManager.int64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_I8);
+ if (real_target_type == TypeManager.char_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.U8_CH);
+ } else if (expr_type == TypeManager.char_type){
+ //
+ // From char to sbyte, byte, short
+ //
+ if (real_target_type == TypeManager.sbyte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.CH_I1);
+ if (real_target_type == TypeManager.byte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.CH_U1);
+ if (real_target_type == TypeManager.short_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.CH_I2);
+ } else if (expr_type == TypeManager.float_type){
+ //
+ // From float to sbyte, byte, short,
+ // ushort, int, uint, long, ulong, char
+ // or decimal
+ //
+ if (real_target_type == TypeManager.sbyte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_I1);
+ if (real_target_type == TypeManager.byte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_U1);
+ if (real_target_type == TypeManager.short_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_I2);
+ if (real_target_type == TypeManager.ushort_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_U2);
+ if (real_target_type == TypeManager.int32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_I4);
+ if (real_target_type == TypeManager.uint32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_U4);
+ if (real_target_type == TypeManager.int64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_I8);
+ if (real_target_type == TypeManager.uint64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_U8);
+ if (real_target_type == TypeManager.char_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R4_CH);
+ if (real_target_type == TypeManager.decimal_type)
+ return InternalTypeConstructor (ec, expr, target_type);
+ } else if (expr_type == TypeManager.double_type){
+ //
+ // From double to byte, byte, short,
+ // ushort, int, uint, long, ulong,
+ // char, float or decimal
+ //
+ if (real_target_type == TypeManager.sbyte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_I1);
+ if (real_target_type == TypeManager.byte_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_U1);
+ if (real_target_type == TypeManager.short_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_I2);
+ if (real_target_type == TypeManager.ushort_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_U2);
+ if (real_target_type == TypeManager.int32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_I4);
+ if (real_target_type == TypeManager.uint32_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_U4);
+ if (real_target_type == TypeManager.int64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_I8);
+ if (real_target_type == TypeManager.uint64_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_U8);
+ if (real_target_type == TypeManager.char_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_CH);
+ if (real_target_type == TypeManager.float_type)
+ return new ConvCast (ec, expr, target_type, ConvCast.Mode.R8_R4);
+ if (real_target_type == TypeManager.decimal_type)
+ return InternalTypeConstructor (ec, expr, target_type);
+ }
+
+ // decimal is taken care of by the op_Explicit methods.
+
+ return null;
+ }
+
+ /// <summary>
+ /// Returns whether an explicit reference conversion can be performed
+ /// from source_type to target_type
+ /// </summary>
+ static bool ExplicitReferenceConversionExists (Type source_type, Type target_type)
+ {
+ bool target_is_value_type = target_type.IsValueType;
+
+ if (source_type == target_type)
+ return true;
+
+ //
+ // From object to any reference type
+ //
+ if (source_type == TypeManager.object_type && !target_is_value_type)
+ return true;
+
+ //
+ // From any class S to any class-type T, provided S is a base class of T
+ //
+ if (target_type.IsSubclassOf (source_type))
+ return true;
+
+ //
+ // From any interface type S to any interface T provided S is not derived from T
+ //
+ if (source_type.IsInterface && target_type.IsInterface){
+ if (!target_type.IsSubclassOf (source_type))
+ return true;
+ }
+
+ //
+ // From any class type S to any interface T, provides S is not sealed
+ // and provided S does not implement T.
+ //
+ if (target_type.IsInterface && !source_type.IsSealed &&
+ !target_type.IsAssignableFrom (source_type))
+ return true;
+
+ //
+ // From any interface-type S to to any class type T, provided T is not
+ // sealed, or provided T implements S.
+ //
+ if (source_type.IsInterface &&
+ (!target_type.IsSealed || source_type.IsAssignableFrom (target_type)))
+ return true;
+
+ // From an array type S with an element type Se to an array type T with an
+ // element type Te provided all the following are true:
+ // * S and T differe only in element type, in other words, S and T
+ // have the same number of dimensions.
+ // * Both Se and Te are reference types
+ // * An explicit referenc conversions exist from Se to Te
+ //
+ if (source_type.IsArray && target_type.IsArray) {
+ if (source_type.GetArrayRank () == target_type.GetArrayRank ()) {
+
+ Type source_element_type = source_type.GetElementType ();
+ Type target_element_type = target_type.GetElementType ();
+
+ if (!source_element_type.IsValueType && !target_element_type.IsValueType)
+ if (ExplicitReferenceConversionExists (source_element_type,
+ target_element_type))
+ return true;
+ }
+ }
+
+
+ // From System.Array to any array-type
+ if (source_type == TypeManager.array_type &&
+ target_type.IsSubclassOf (TypeManager.array_type)){
+ return true;
+ }
+
+ //
+ // From System delegate to any delegate-type
+ //
+ if (source_type == TypeManager.delegate_type &&
+ target_type.IsSubclassOf (TypeManager.delegate_type))
+ return true;
+
+ //
+ // From ICloneable to Array or Delegate types
+ //
+ if (source_type == TypeManager.icloneable_type &&
+ (target_type == TypeManager.array_type ||
+ target_type == TypeManager.delegate_type))
+ return true;
+
+ return false;
+ }
+
+ /// <summary>
+ /// Implements Explicit Reference conversions
+ /// </summary>
+ static Expression ConvertReferenceExplicit (Expression source, Type target_type)
+ {
+ Type source_type = source.Type;
+ bool target_is_value_type = target_type.IsValueType;
+
+ //
+ // From object to any reference type
+ //
+ if (source_type == TypeManager.object_type && !target_is_value_type)
+ return new ClassCast (source, target_type);
+
+
+ //
+ // From any class S to any class-type T, provided S is a base class of T
+ //
+ if (target_type.IsSubclassOf (source_type))
+ return new ClassCast (source, target_type);
+
+ //
+ // From any interface type S to any interface T provided S is not derived from T
+ //
+ if (source_type.IsInterface && target_type.IsInterface){
+ if (TypeManager.ImplementsInterface (source_type, target_type))
+ return null;
+ else
+ return new ClassCast (source, target_type);
+ }
+
+ //
+ // From any class type S to any interface T, provides S is not sealed
+ // and provided S does not implement T.
+ //
+ if (target_type.IsInterface && !source_type.IsSealed) {
+
+ if (TypeManager.ImplementsInterface (source_type, target_type))
+ return null;
+ else
+ return new ClassCast (source, target_type);
+
+ }
+
+ //
+ // From any interface-type S to to any class type T, provided T is not
+ // sealed, or provided T implements S.
+ //
+ if (source_type.IsInterface) {
+
+ if (target_type.IsSealed)
+ return null;
+
+ if (TypeManager.ImplementsInterface (target_type, source_type))
+ return new ClassCast (source, target_type);
+ else
+ return null;
+ }
+
+ // From an array type S with an element type Se to an array type T with an
+ // element type Te provided all the following are true:
+ // * S and T differe only in element type, in other words, S and T
+ // have the same number of dimensions.
+ // * Both Se and Te are reference types
+ // * An explicit referenc conversions exist from Se to Te
+ //
+ if (source_type.IsArray && target_type.IsArray) {
+ if (source_type.GetArrayRank () == target_type.GetArrayRank ()) {
+
+ Type source_element_type = source_type.GetElementType ();
+ Type target_element_type = target_type.GetElementType ();
+
+ if (!source_element_type.IsValueType && !target_element_type.IsValueType)
+ if (ExplicitReferenceConversionExists (source_element_type,
+ target_element_type))
+ return new ClassCast (source, target_type);
+ }
+ }
+
+
+ // From System.Array to any array-type
+ if (source_type == TypeManager.array_type &&
+ target_type.IsSubclassOf (TypeManager.array_type)){
+ return new ClassCast (source, target_type);
+ }
+
+ //
+ // From System delegate to any delegate-type
+ //
+ if (source_type == TypeManager.delegate_type &&
+ target_type.IsSubclassOf (TypeManager.delegate_type))
+ return new ClassCast (source, target_type);
+
+ //
+ // From ICloneable to Array or Delegate types
+ //
+ if (source_type == TypeManager.icloneable_type &&
+ (target_type == TypeManager.array_type ||
+ target_type == TypeManager.delegate_type))
+ return new ClassCast (source, target_type);
+
+ return null;
+ }
+
+ /// <summary>
+ /// Performs an explicit conversion of the expression `expr' whose
+ /// type is expr.Type to `target_type'.
+ /// </summary>
+ static public Expression ConvertExplicit (EmitContext ec, Expression expr,
+ Type target_type, Location loc)
+ {
+ Type expr_type = expr.Type;
+ Expression ne = ConvertImplicitStandard (ec, expr, target_type, loc);
+
+ if (ne != null)
+ return ne;
+
+ ne = ConvertNumericExplicit (ec, expr, target_type);
+ if (ne != null)
+ return ne;
+
+ //
+ // Unboxing conversion.
+ //
+ if (expr_type == TypeManager.object_type && target_type.IsValueType)
+ return new UnboxCast (expr, target_type);
+
+ //
+ // Enum types
+ //
+ if (expr_type.IsSubclassOf (TypeManager.enum_type)) {
+ Expression e;
+
+ //
+ // FIXME: Is there any reason we should have EnumConstant
+ // dealt with here instead of just using always the
+ // UnderlyingSystemType to wrap the type?
+ //
+ if (expr is EnumConstant)
+ e = ((EnumConstant) expr).Child;
+ else {
+ e = new EmptyCast (expr, TypeManager.EnumToUnderlying (expr_type));
+ }
+
+ Expression t = ConvertImplicit (ec, e, target_type, loc);
+ if (t != null)
+ return t;
+
+ return ConvertNumericExplicit (ec, e, target_type);
+ }
+
+ ne = ConvertReferenceExplicit (expr, target_type);
+ if (ne != null)
+ return ne;
+
+ if (ec.InUnsafe){
+ if (target_type.IsPointer){
+ if (expr_type.IsPointer)
+ return new EmptyCast (expr, target_type);
+
+ if (expr_type == TypeManager.sbyte_type ||
+ expr_type == TypeManager.byte_type ||
+ expr_type == TypeManager.short_type ||
+ expr_type == TypeManager.ushort_type ||
+ expr_type == TypeManager.int32_type ||
+ expr_type == TypeManager.uint32_type ||
+ expr_type == TypeManager.uint64_type ||
+ expr_type == TypeManager.int64_type)
+ return new OpcodeCast (expr, target_type, OpCodes.Conv_U);
+ }
+ if (expr_type.IsPointer){
+ if (target_type == TypeManager.sbyte_type ||
+ target_type == TypeManager.byte_type ||
+ target_type == TypeManager.short_type ||
+ target_type == TypeManager.ushort_type ||
+ target_type == TypeManager.int32_type ||
+ target_type == TypeManager.uint32_type ||
+ target_type == TypeManager.uint64_type ||
+ target_type == TypeManager.int64_type){
+ Expression e = new EmptyCast (expr, TypeManager.uint32_type);
+ Expression ci, ce;
+
+ ci = ConvertImplicitStandard (ec, e, target_type, loc);
+
+ if (ci != null)
+ return ci;
+
+ ce = ConvertNumericExplicit (ec, e, target_type);
+ if (ce != null)
+ return ce;
+ //
+ // We should always be able to go from an uint32
+ // implicitly or explicitly to the other integral
+ // types
+ //
+ throw new Exception ("Internal compiler error");
+ }
+ }
+ }
+
+ ne = ExplicitUserConversion (ec, expr, target_type, loc);
+ if (ne != null)
+ return ne;
+
+ Error_CannotConvertType (loc, expr_type, target_type);
+ return null;
+ }
+
+ /// <summary>
+ /// Same as ConverExplicit, only it doesn't include user defined conversions
+ /// </summary>
+ static public Expression ConvertExplicitStandard (EmitContext ec, Expression expr,
+ Type target_type, Location l)
+ {
+ Expression ne = ConvertImplicitStandard (ec, expr, target_type, l);
+
+ if (ne != null)
+ return ne;
+
+ ne = ConvertNumericExplicit (ec, expr, target_type);
+ if (ne != null)
+ return ne;
+
+ ne = ConvertReferenceExplicit (expr, target_type);
+ if (ne != null)
+ return ne;
+
+ Error_CannotConvertType (l, expr.Type, target_type);
+ return null;
+ }
+
+ static string ExprClassName (ExprClass c)
+ {
+ switch (c){
+ case ExprClass.Invalid:
+ return "Invalid";
+ case ExprClass.Value:
+ return "value";
+ case ExprClass.Variable:
+ return "variable";
+ case ExprClass.Namespace:
+ return "namespace";
+ case ExprClass.Type:
+ return "type";
+ case ExprClass.MethodGroup:
+ return "method group";
+ case ExprClass.PropertyAccess:
+ return "property access";
+ case ExprClass.EventAccess:
+ return "event access";
+ case ExprClass.IndexerAccess:
+ return "indexer access";
+ case ExprClass.Nothing:
+ return "null";
+ }
+ throw new Exception ("Should not happen");
+ }
+
+ /// <summary>
+ /// Reports that we were expecting `expr' to be of class `expected'
+ /// </summary>
+ protected void report118 (Location loc, Expression expr, string expected)
+ {
+ string kind = "Unknown";
+
+ if (expr != null)
+ kind = ExprClassName (expr.eclass);
+
+ Error (118, loc, "Expression denotes a `" + kind +
+ "' where a `" + expected + "' was expected");
+ }
+
+ static void Error_ConstantValueCannotBeConverted (Location l, string val, Type t)
+ {
+ Report.Error (31, l, "Constant value `" + val + "' cannot be converted to " +
+ TypeManager.CSharpName (t));
+ }
+
+ public static void UnsafeError (Location loc)
+ {
+ Report.Error (214, loc, "Pointers may only be used in an unsafe context");
+ }
+
+ /// <summary>
+ /// Converts the IntConstant, UIntConstant, LongConstant or
+ /// ULongConstant into the integral target_type. Notice
+ /// that we do not return an `Expression' we do return
+ /// a boxed integral type.
+ ///
+ /// FIXME: Since I added the new constants, we need to
+ /// also support conversions from CharConstant, ByteConstant,
+ /// SByteConstant, UShortConstant, ShortConstant
+ ///
+ /// This is used by the switch statement, so the domain
+ /// of work is restricted to the literals above, and the
+ /// targets are int32, uint32, char, byte, sbyte, ushort,
+ /// short, uint64 and int64
+ /// </summary>
+ public static object ConvertIntLiteral (Constant c, Type target_type, Location loc)
+ {
+ string s = "";
+
+ if (c.Type == target_type)
+ return ((Constant) c).GetValue ();
+
+ //
+ // Make into one of the literals we handle, we dont really care
+ // about this value as we will just return a few limited types
+ //
+ if (c is EnumConstant)
+ c = ((EnumConstant)c).WidenToCompilerConstant ();
+
+ if (c is IntConstant){
+ int v = ((IntConstant) c).Value;
+
+ if (target_type == TypeManager.uint32_type){
+ if (v >= 0)
+ return (uint) v;
+ } else if (target_type == TypeManager.char_type){
+ if (v >= Char.MinValue && v <= Char.MaxValue)
+ return (char) v;
+ } else if (target_type == TypeManager.byte_type){
+ if (v >= Byte.MinValue && v <= Byte.MaxValue)
+ return (byte) v;
+ } else if (target_type == TypeManager.sbyte_type){
+ if (v >= SByte.MinValue && v <= SByte.MaxValue)
+ return (sbyte) v;
+ } else if (target_type == TypeManager.short_type){
+ if (v >= Int16.MinValue && v <= UInt16.MaxValue)
+ return (short) v;
+ } else if (target_type == TypeManager.ushort_type){
+ if (v >= UInt16.MinValue && v <= UInt16.MaxValue)
+ return (ushort) v;
+ } else if (target_type == TypeManager.int64_type)
+ return (long) v;
+ else if (target_type == TypeManager.uint64_type){
+ if (v > 0)
+ return (ulong) v;
+ }
+
+ s = v.ToString ();
+ } else if (c is UIntConstant){
+ uint v = ((UIntConstant) c).Value;
+
+ if (target_type == TypeManager.int32_type){
+ if (v <= Int32.MaxValue)
+ return (int) v;
+ } else if (target_type == TypeManager.char_type){
+ if (v >= Char.MinValue && v <= Char.MaxValue)
+ return (char) v;
+ } else if (target_type == TypeManager.byte_type){
+ if (v <= Byte.MaxValue)
+ return (byte) v;
+ } else if (target_type == TypeManager.sbyte_type){
+ if (v <= SByte.MaxValue)
+ return (sbyte) v;
+ } else if (target_type == TypeManager.short_type){
+ if (v <= UInt16.MaxValue)
+ return (short) v;
+ } else if (target_type == TypeManager.ushort_type){
+ if (v <= UInt16.MaxValue)
+ return (ushort) v;
+ } else if (target_type == TypeManager.int64_type)
+ return (long) v;
+ else if (target_type == TypeManager.uint64_type)
+ return (ulong) v;
+ s = v.ToString ();
+ } else if (c is LongConstant){
+ long v = ((LongConstant) c).Value;
+
+ if (target_type == TypeManager.int32_type){
+ if (v >= UInt32.MinValue && v <= UInt32.MaxValue)
+ return (int) v;
+ } else if (target_type == TypeManager.uint32_type){
+ if (v >= 0 && v <= UInt32.MaxValue)
+ return (uint) v;
+ } else if (target_type == TypeManager.char_type){
+ if (v >= Char.MinValue && v <= Char.MaxValue)
+ return (char) v;
+ } else if (target_type == TypeManager.byte_type){
+ if (v >= Byte.MinValue && v <= Byte.MaxValue)
+ return (byte) v;
+ } else if (target_type == TypeManager.sbyte_type){
+ if (v >= SByte.MinValue && v <= SByte.MaxValue)
+ return (sbyte) v;
+ } else if (target_type == TypeManager.short_type){
+ if (v >= Int16.MinValue && v <= UInt16.MaxValue)
+ return (short) v;
+ } else if (target_type == TypeManager.ushort_type){
+ if (v >= UInt16.MinValue && v <= UInt16.MaxValue)
+ return (ushort) v;
+ } else if (target_type == TypeManager.uint64_type){
+ if (v > 0)
+ return (ulong) v;
+ }
+ s = v.ToString ();
+ } else if (c is ULongConstant){
+ ulong v = ((ULongConstant) c).Value;
+
+ if (target_type == TypeManager.int32_type){
+ if (v <= Int32.MaxValue)
+ return (int) v;
+ } else if (target_type == TypeManager.uint32_type){
+ if (v <= UInt32.MaxValue)
+ return (uint) v;
+ } else if (target_type == TypeManager.char_type){
+ if (v >= Char.MinValue && v <= Char.MaxValue)
+ return (char) v;
+ } else if (target_type == TypeManager.byte_type){
+ if (v >= Byte.MinValue && v <= Byte.MaxValue)
+ return (byte) v;
+ } else if (target_type == TypeManager.sbyte_type){
+ if (v <= (int) SByte.MaxValue)
+ return (sbyte) v;
+ } else if (target_type == TypeManager.short_type){
+ if (v <= UInt16.MaxValue)
+ return (short) v;
+ } else if (target_type == TypeManager.ushort_type){
+ if (v <= UInt16.MaxValue)
+ return (ushort) v;
+ } else if (target_type == TypeManager.int64_type){
+ if (v <= Int64.MaxValue)
+ return (long) v;
+ }
+ s = v.ToString ();
+ } else if (c is ByteConstant){
+ byte v = ((ByteConstant) c).Value;
+
+ if (target_type == TypeManager.int32_type)
+ return (int) v;
+ else if (target_type == TypeManager.uint32_type)
+ return (uint) v;
+ else if (target_type == TypeManager.char_type)
+ return (char) v;
+ else if (target_type == TypeManager.sbyte_type){
+ if (v <= SByte.MaxValue)
+ return (sbyte) v;
+ } else if (target_type == TypeManager.short_type)
+ return (short) v;
+ else if (target_type == TypeManager.ushort_type)
+ return (ushort) v;
+ else if (target_type == TypeManager.int64_type)
+ return (long) v;
+ else if (target_type == TypeManager.uint64_type)
+ return (ulong) v;
+ s = v.ToString ();
+ } else if (c is SByteConstant){
+ sbyte v = ((SByteConstant) c).Value;
+
+ if (target_type == TypeManager.int32_type)
+ return (int) v;
+ else if (target_type == TypeManager.uint32_type){
+ if (v >= 0)
+ return (uint) v;
+ } else if (target_type == TypeManager.char_type){
+ if (v >= 0)
+ return (char) v;
+ } else if (target_type == TypeManager.byte_type){
+ if (v >= 0)
+ return (byte) v;
+ } else if (target_type == TypeManager.short_type)
+ return (short) v;
+ else if (target_type == TypeManager.ushort_type){
+ if (v >= 0)
+ return (ushort) v;
+ } else if (target_type == TypeManager.int64_type)
+ return (long) v;
+ else if (target_type == TypeManager.uint64_type){
+ if (v >= 0)
+ return (ulong) v;
+ }
+ s = v.ToString ();
+ } else if (c is ShortConstant){
+ short v = ((ShortConstant) c).Value;
+
+ if (target_type == TypeManager.int32_type){
+ return (int) v;
+ } else if (target_type == TypeManager.uint32_type){
+ if (v >= 0)
+ return (uint) v;
+ } else if (target_type == TypeManager.char_type){
+ if (v >= 0)
+ return (char) v;
+ } else if (target_type == TypeManager.byte_type){
+ if (v >= Byte.MinValue && v <= Byte.MaxValue)
+ return (byte) v;
+ } else if (target_type == TypeManager.sbyte_type){
+ if (v >= SByte.MinValue && v <= SByte.MaxValue)
+ return (sbyte) v;
+ } else if (target_type == TypeManager.ushort_type){
+ if (v >= 0)
+ return (ushort) v;
+ } else if (target_type == TypeManager.int64_type)
+ return (long) v;
+ else if (target_type == TypeManager.uint64_type)
+ return (ulong) v;
+
+ s = v.ToString ();
+ } else if (c is UShortConstant){
+ ushort v = ((UShortConstant) c).Value;
+
+ if (target_type == TypeManager.int32_type)
+ return (int) v;
+ else if (target_type == TypeManager.uint32_type)
+ return (uint) v;
+ else if (target_type == TypeManager.char_type){
+ if (v >= Char.MinValue && v <= Char.MaxValue)
+ return (char) v;
+ } else if (target_type == TypeManager.byte_type){
+ if (v >= Byte.MinValue && v <= Byte.MaxValue)
+ return (byte) v;
+ } else if (target_type == TypeManager.sbyte_type){
+ if (v <= SByte.MaxValue)
+ return (byte) v;
+ } else if (target_type == TypeManager.short_type){
+ if (v <= Int16.MaxValue)
+ return (short) v;
+ } else if (target_type == TypeManager.int64_type)
+ return (long) v;
+ else if (target_type == TypeManager.uint64_type)
+ return (ulong) v;
+
+ s = v.ToString ();
+ } else if (c is CharConstant){
+ char v = ((CharConstant) c).Value;
+
+ if (target_type == TypeManager.int32_type)
+ return (int) v;
+ else if (target_type == TypeManager.uint32_type)
+ return (uint) v;
+ else if (target_type == TypeManager.byte_type){
+ if (v >= Byte.MinValue && v <= Byte.MaxValue)
+ return (byte) v;
+ } else if (target_type == TypeManager.sbyte_type){
+ if (v <= SByte.MaxValue)
+ return (sbyte) v;
+ } else if (target_type == TypeManager.short_type){
+ if (v <= Int16.MaxValue)
+ return (short) v;
+ } else if (target_type == TypeManager.ushort_type)
+ return (short) v;
+ else if (target_type == TypeManager.int64_type)
+ return (long) v;
+ else if (target_type == TypeManager.uint64_type)
+ return (ulong) v;
+
+ s = v.ToString ();
+ }
+ Error_ConstantValueCannotBeConverted (loc, s, target_type);
+ return null;
+ }
+
+ //
+ // Load the object from the pointer. The `IsReference' is used
+ // to control whether we should use Ldind_Ref or LdObj if the
+ // value is not a `core' type.
+ //
+ // Maybe we should try to extract this infromation form the type?
+ // TODO: Maybe this is a bug. The reason we have this flag is because
+ // I had almost identical code in ParameterReference (for handling
+ // references) and in UnboxCast.
+ //
+ public static void LoadFromPtr (ILGenerator ig, Type t, bool IsReference)
+ {
+ if (t == TypeManager.int32_type)
+ ig.Emit (OpCodes.Ldind_I4);
+ else if (t == TypeManager.uint32_type)
+ ig.Emit (OpCodes.Ldind_U4);
+ else if (t == TypeManager.short_type)
+ ig.Emit (OpCodes.Ldind_I2);
+ else if (t == TypeManager.ushort_type)
+ ig.Emit (OpCodes.Ldind_U2);
+ else if (t == TypeManager.char_type)
+ ig.Emit (OpCodes.Ldind_U2);
+ else if (t == TypeManager.byte_type)
+ ig.Emit (OpCodes.Ldind_U1);
+ else if (t == TypeManager.sbyte_type)
+ ig.Emit (OpCodes.Ldind_I1);
+ else if (t == TypeManager.uint64_type)
+ ig.Emit (OpCodes.Ldind_I8);
+ else if (t == TypeManager.int64_type)
+ ig.Emit (OpCodes.Ldind_I8);
+ else if (t == TypeManager.float_type)
+ ig.Emit (OpCodes.Ldind_R4);
+ else if (t == TypeManager.double_type)
+ ig.Emit (OpCodes.Ldind_R8);
+ else if (t == TypeManager.bool_type)
+ ig.Emit (OpCodes.Ldind_I1);
+ else if (t == TypeManager.intptr_type)
+ ig.Emit (OpCodes.Ldind_I);
+ else if (TypeManager.IsEnumType (t)){
+ LoadFromPtr (ig, TypeManager.EnumToUnderlying (t), IsReference);
+ } else {
+ if (IsReference)
+ ig.Emit (OpCodes.Ldind_Ref);
+ else
+ ig.Emit (OpCodes.Ldobj, t);
+ }
+ }
+
+ //
+ // The stack contains the pointer and the value of type `type'
+ //
+ public static void StoreFromPtr (ILGenerator ig, Type type)
+ {
+ if (type == TypeManager.int32_type || type == TypeManager.uint32_type)
+ ig.Emit (OpCodes.Stind_I4);
+ else if (type == TypeManager.int64_type || type == TypeManager.uint64_type)
+ ig.Emit (OpCodes.Stind_I8);
+ else if (type == TypeManager.char_type || type == TypeManager.short_type ||
+ type == TypeManager.ushort_type)
+ ig.Emit (OpCodes.Stind_I2);
+ else if (type == TypeManager.float_type)
+ ig.Emit (OpCodes.Stind_R4);
+ else if (type == TypeManager.double_type)
+ ig.Emit (OpCodes.Stind_R8);
+ else if (type == TypeManager.byte_type || type == TypeManager.sbyte_type ||
+ type == TypeManager.bool_type)
+ ig.Emit (OpCodes.Stind_I1);
+ else if (type == TypeManager.intptr_type)
+ ig.Emit (OpCodes.Stind_I);
+ else
+ ig.Emit (OpCodes.Stind_Ref);
+ }
+
+ //
+ // Returns the size of type `t' if known, otherwise, 0
+ //
+ public static int GetTypeSize (Type t)
+ {
+ if (t == TypeManager.int32_type ||
+ t == TypeManager.uint32_type ||
+ t == TypeManager.float_type)
+ return 4;
+ else if (t == TypeManager.int64_type ||
+ t == TypeManager.uint64_type ||
+ t == TypeManager.double_type)
+ return 8;
+ else if (t == TypeManager.byte_type ||
+ t == TypeManager.sbyte_type ||
+ t == TypeManager.bool_type)
+ return 1;
+ else if (t == TypeManager.short_type ||
+ t == TypeManager.char_type ||
+ t == TypeManager.ushort_type)
+ return 2;
+ else
+ return 0;
+ }
+ }
+
+ /// <summary>
+ /// This is just a base class for expressions that can
+ /// appear on statements (invocations, object creation,
+ /// assignments, post/pre increment and decrement). The idea
+ /// being that they would support an extra Emition interface that
+ /// does not leave a result on the stack.
+ /// </summary>
+ public abstract class ExpressionStatement : Expression {
+
+ /// <summary>
+ /// Requests the expression to be emitted in a `statement'
+ /// context. This means that no new value is left on the
+ /// stack after invoking this method (constrasted with
+ /// Emit that will always leave a value on the stack).
+ /// </summary>
+ public abstract void EmitStatement (EmitContext ec);
+ }
+
+ /// <summary>
+ /// This kind of cast is used to encapsulate the child
+ /// whose type is child.Type into an expression that is
+ /// reported to return "return_type". This is used to encapsulate
+ /// expressions which have compatible types, but need to be dealt
+ /// at higher levels with.
+ ///
+ /// For example, a "byte" expression could be encapsulated in one
+ /// of these as an "unsigned int". The type for the expression
+ /// would be "unsigned int".
+ ///
+ /// </summary>
+ public class EmptyCast : Expression {
+ protected Expression child;
+
+ public EmptyCast (Expression child, Type return_type)
+ {
+ eclass = child.eclass;
+ type = return_type;
+ this.child = child;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ // This should never be invoked, we are born in fully
+ // initialized state.
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ child.Emit (ec);
+ }
+ }
+
+ /// <summary>
+ /// This class is used to wrap literals which belong inside Enums
+ /// </summary>
+ public class EnumConstant : Constant {
+ public Constant Child;
+
+ public EnumConstant (Constant child, Type enum_type)
+ {
+ eclass = child.eclass;
+ this.Child = child;
+ type = enum_type;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ // This should never be invoked, we are born in fully
+ // initialized state.
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ Child.Emit (ec);
+ }
+
+ public override object GetValue ()
+ {
+ return Child.GetValue ();
+ }
+
+ //
+ // Converts from one of the valid underlying types for an enumeration
+ // (int32, uint32, int64, uint64, short, ushort, byte, sbyte) to
+ // one of the internal compiler literals: Int/UInt/Long/ULong Literals.
+ //
+ public Constant WidenToCompilerConstant ()
+ {
+ Type t = TypeManager.EnumToUnderlying (Child.Type);
+ object v = ((Constant) Child).GetValue ();;
+
+ if (t == TypeManager.int32_type)
+ return new IntConstant ((int) v);
+ if (t == TypeManager.uint32_type)
+ return new UIntConstant ((uint) v);
+ if (t == TypeManager.int64_type)
+ return new LongConstant ((long) v);
+ if (t == TypeManager.uint64_type)
+ return new ULongConstant ((ulong) v);
+ if (t == TypeManager.short_type)
+ return new ShortConstant ((short) v);
+ if (t == TypeManager.ushort_type)
+ return new UShortConstant ((ushort) v);
+ if (t == TypeManager.byte_type)
+ return new ByteConstant ((byte) v);
+ if (t == TypeManager.sbyte_type)
+ return new SByteConstant ((sbyte) v);
+
+ throw new Exception ("Invalid enumeration underlying type: " + t);
+ }
+
+ //
+ // Extracts the value in the enumeration on its native representation
+ //
+ public object GetPlainValue ()
+ {
+ Type t = TypeManager.EnumToUnderlying (Child.Type);
+ object v = ((Constant) Child).GetValue ();;
+
+ if (t == TypeManager.int32_type)
+ return (int) v;
+ if (t == TypeManager.uint32_type)
+ return (uint) v;
+ if (t == TypeManager.int64_type)
+ return (long) v;
+ if (t == TypeManager.uint64_type)
+ return (ulong) v;
+ if (t == TypeManager.short_type)
+ return (short) v;
+ if (t == TypeManager.ushort_type)
+ return (ushort) v;
+ if (t == TypeManager.byte_type)
+ return (byte) v;
+ if (t == TypeManager.sbyte_type)
+ return (sbyte) v;
+
+ return null;
+ }
+
+ public override string AsString ()
+ {
+ return Child.AsString ();
+ }
+
+ public override DoubleConstant ConvertToDouble ()
+ {
+ return Child.ConvertToDouble ();
+ }
+
+ public override FloatConstant ConvertToFloat ()
+ {
+ return Child.ConvertToFloat ();
+ }
+
+ public override ULongConstant ConvertToULong ()
+ {
+ return Child.ConvertToULong ();
+ }
+
+ public override LongConstant ConvertToLong ()
+ {
+ return Child.ConvertToLong ();
+ }
+
+ public override UIntConstant ConvertToUInt ()
+ {
+ return Child.ConvertToUInt ();
+ }
+
+ public override IntConstant ConvertToInt ()
+ {
+ return Child.ConvertToInt ();
+ }
+ }
+
+ /// <summary>
+ /// This kind of cast is used to encapsulate Value Types in objects.
+ ///
+ /// The effect of it is to box the value type emitted by the previous
+ /// operation.
+ /// </summary>
+ public class BoxedCast : EmptyCast {
+
+ public BoxedCast (Expression expr)
+ : base (expr, TypeManager.object_type)
+ {
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ // This should never be invoked, we are born in fully
+ // initialized state.
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ base.Emit (ec);
+
+ ec.ig.Emit (OpCodes.Box, child.Type);
+ }
+ }
+
+ public class UnboxCast : EmptyCast {
+ public UnboxCast (Expression expr, Type return_type)
+ : base (expr, return_type)
+ {
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ // This should never be invoked, we are born in fully
+ // initialized state.
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ Type t = type;
+ ILGenerator ig = ec.ig;
+
+ base.Emit (ec);
+ ig.Emit (OpCodes.Unbox, t);
+
+ LoadFromPtr (ig, t, false);
+ }
+ }
+
+ /// <summary>
+ /// This is used to perform explicit numeric conversions.
+ ///
+ /// Explicit numeric conversions might trigger exceptions in a checked
+ /// context, so they should generate the conv.ovf opcodes instead of
+ /// conv opcodes.
+ /// </summary>
+ public class ConvCast : EmptyCast {
+ public enum Mode : byte {
+ I1_U1, I1_U2, I1_U4, I1_U8, I1_CH,
+ U1_I1, U1_CH,
+ I2_I1, I2_U1, I2_U2, I2_U4, I2_U8, I2_CH,
+ U2_I1, U2_U1, U2_I2, U2_CH,
+ I4_I1, I4_U1, I4_I2, I4_U2, I4_U4, I4_U8, I4_CH,
+ U4_I1, U4_U1, U4_I2, U4_U2, U4_I4, U4_CH,
+ I8_I1, I8_U1, I8_I2, I8_U2, I8_I4, I8_U4, I8_U8, I8_CH,
+ U8_I1, U8_U1, U8_I2, U8_U2, U8_I4, U8_U4, U8_I8, U8_CH,
+ CH_I1, CH_U1, CH_I2,
+ R4_I1, R4_U1, R4_I2, R4_U2, R4_I4, R4_U4, R4_I8, R4_U8, R4_CH,
+ R8_I1, R8_U1, R8_I2, R8_U2, R8_I4, R8_U4, R8_I8, R8_U8, R8_CH, R8_R4
+ }
+
+ Mode mode;
+ bool checked_state;
+
+ public ConvCast (EmitContext ec, Expression child, Type return_type, Mode m)
+ : base (child, return_type)
+ {
+ mode = m;
+ checked_state = ec.CheckState;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ // This should never be invoked, we are born in fully
+ // initialized state.
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+
+ base.Emit (ec);
+
+ if (checked_state){
+ switch (mode){
+ case Mode.I1_U1: ig.Emit (OpCodes.Conv_Ovf_U1); break;
+ case Mode.I1_U2: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+ case Mode.I1_U4: ig.Emit (OpCodes.Conv_Ovf_U4); break;
+ case Mode.I1_U8: ig.Emit (OpCodes.Conv_Ovf_U8); break;
+ case Mode.I1_CH: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+
+ case Mode.U1_I1: ig.Emit (OpCodes.Conv_Ovf_I1_Un); break;
+ case Mode.U1_CH: /* nothing */ break;
+
+ case Mode.I2_I1: ig.Emit (OpCodes.Conv_Ovf_I1); break;
+ case Mode.I2_U1: ig.Emit (OpCodes.Conv_Ovf_U1); break;
+ case Mode.I2_U2: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+ case Mode.I2_U4: ig.Emit (OpCodes.Conv_Ovf_U4); break;
+ case Mode.I2_U8: ig.Emit (OpCodes.Conv_Ovf_U8); break;
+ case Mode.I2_CH: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+
+ case Mode.U2_I1: ig.Emit (OpCodes.Conv_Ovf_I1_Un); break;
+ case Mode.U2_U1: ig.Emit (OpCodes.Conv_Ovf_U1_Un); break;
+ case Mode.U2_I2: ig.Emit (OpCodes.Conv_Ovf_I2_Un); break;
+ case Mode.U2_CH: /* nothing */ break;
+
+ case Mode.I4_I1: ig.Emit (OpCodes.Conv_Ovf_I1); break;
+ case Mode.I4_U1: ig.Emit (OpCodes.Conv_Ovf_U1); break;
+ case Mode.I4_I2: ig.Emit (OpCodes.Conv_Ovf_I2); break;
+ case Mode.I4_U4: ig.Emit (OpCodes.Conv_Ovf_U4); break;
+ case Mode.I4_U2: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+ case Mode.I4_U8: ig.Emit (OpCodes.Conv_Ovf_U8); break;
+ case Mode.I4_CH: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+
+ case Mode.U4_I1: ig.Emit (OpCodes.Conv_Ovf_I1_Un); break;
+ case Mode.U4_U1: ig.Emit (OpCodes.Conv_Ovf_U1_Un); break;
+ case Mode.U4_I2: ig.Emit (OpCodes.Conv_Ovf_I2_Un); break;
+ case Mode.U4_U2: ig.Emit (OpCodes.Conv_Ovf_U2_Un); break;
+ case Mode.U4_I4: ig.Emit (OpCodes.Conv_Ovf_I4_Un); break;
+ case Mode.U4_CH: ig.Emit (OpCodes.Conv_Ovf_U2_Un); break;
+
+ case Mode.I8_I1: ig.Emit (OpCodes.Conv_Ovf_I1); break;
+ case Mode.I8_U1: ig.Emit (OpCodes.Conv_Ovf_U1); break;
+ case Mode.I8_I2: ig.Emit (OpCodes.Conv_Ovf_I2); break;
+ case Mode.I8_U2: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+ case Mode.I8_I4: ig.Emit (OpCodes.Conv_Ovf_I4); break;
+ case Mode.I8_U4: ig.Emit (OpCodes.Conv_Ovf_U4); break;
+ case Mode.I8_U8: ig.Emit (OpCodes.Conv_Ovf_U8); break;
+ case Mode.I8_CH: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+
+ case Mode.U8_I1: ig.Emit (OpCodes.Conv_Ovf_I1_Un); break;
+ case Mode.U8_U1: ig.Emit (OpCodes.Conv_Ovf_U1_Un); break;
+ case Mode.U8_I2: ig.Emit (OpCodes.Conv_Ovf_I2_Un); break;
+ case Mode.U8_U2: ig.Emit (OpCodes.Conv_Ovf_U2_Un); break;
+ case Mode.U8_I4: ig.Emit (OpCodes.Conv_Ovf_I4_Un); break;
+ case Mode.U8_U4: ig.Emit (OpCodes.Conv_Ovf_U4_Un); break;
+ case Mode.U8_I8: ig.Emit (OpCodes.Conv_Ovf_I8_Un); break;
+ case Mode.U8_CH: ig.Emit (OpCodes.Conv_Ovf_U2_Un); break;
+
+ case Mode.CH_I1: ig.Emit (OpCodes.Conv_Ovf_I1_Un); break;
+ case Mode.CH_U1: ig.Emit (OpCodes.Conv_Ovf_U1_Un); break;
+ case Mode.CH_I2: ig.Emit (OpCodes.Conv_Ovf_I2_Un); break;
+
+ case Mode.R4_I1: ig.Emit (OpCodes.Conv_Ovf_I1); break;
+ case Mode.R4_U1: ig.Emit (OpCodes.Conv_Ovf_U1); break;
+ case Mode.R4_I2: ig.Emit (OpCodes.Conv_Ovf_I2); break;
+ case Mode.R4_U2: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+ case Mode.R4_I4: ig.Emit (OpCodes.Conv_Ovf_I4); break;
+ case Mode.R4_U4: ig.Emit (OpCodes.Conv_Ovf_U4); break;
+ case Mode.R4_I8: ig.Emit (OpCodes.Conv_Ovf_I8); break;
+ case Mode.R4_U8: ig.Emit (OpCodes.Conv_Ovf_U8); break;
+ case Mode.R4_CH: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+
+ case Mode.R8_I1: ig.Emit (OpCodes.Conv_Ovf_I1); break;
+ case Mode.R8_U1: ig.Emit (OpCodes.Conv_Ovf_U1); break;
+ case Mode.R8_I2: ig.Emit (OpCodes.Conv_Ovf_I2); break;
+ case Mode.R8_U2: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+ case Mode.R8_I4: ig.Emit (OpCodes.Conv_Ovf_I4); break;
+ case Mode.R8_U4: ig.Emit (OpCodes.Conv_Ovf_U4); break;
+ case Mode.R8_I8: ig.Emit (OpCodes.Conv_Ovf_I8); break;
+ case Mode.R8_U8: ig.Emit (OpCodes.Conv_Ovf_U8); break;
+ case Mode.R8_CH: ig.Emit (OpCodes.Conv_Ovf_U2); break;
+ case Mode.R8_R4: ig.Emit (OpCodes.Conv_R4); break;
+ }
+ } else {
+ switch (mode){
+ case Mode.I1_U1: ig.Emit (OpCodes.Conv_U1); break;
+ case Mode.I1_U2: ig.Emit (OpCodes.Conv_U2); break;
+ case Mode.I1_U4: ig.Emit (OpCodes.Conv_U4); break;
+ case Mode.I1_U8: ig.Emit (OpCodes.Conv_I8); break;
+ case Mode.I1_CH: ig.Emit (OpCodes.Conv_U2); break;
+
+ case Mode.U1_I1: ig.Emit (OpCodes.Conv_I1); break;
+ case Mode.U1_CH: ig.Emit (OpCodes.Conv_U2); break;
+
+ case Mode.I2_I1: ig.Emit (OpCodes.Conv_I1); break;
+ case Mode.I2_U1: ig.Emit (OpCodes.Conv_U1); break;
+ case Mode.I2_U2: ig.Emit (OpCodes.Conv_U2); break;
+ case Mode.I2_U4: ig.Emit (OpCodes.Conv_U4); break;
+ case Mode.I2_U8: ig.Emit (OpCodes.Conv_I8); break;
+ case Mode.I2_CH: ig.Emit (OpCodes.Conv_U2); break;
+
+ case Mode.U2_I1: ig.Emit (OpCodes.Conv_I1); break;
+ case Mode.U2_U1: ig.Emit (OpCodes.Conv_U1); break;
+ case Mode.U2_I2: ig.Emit (OpCodes.Conv_I2); break;
+ case Mode.U2_CH: /* nothing */ break;
+
+ case Mode.I4_I1: ig.Emit (OpCodes.Conv_I1); break;
+ case Mode.I4_U1: ig.Emit (OpCodes.Conv_U1); break;
+ case Mode.I4_I2: ig.Emit (OpCodes.Conv_I2); break;
+ case Mode.I4_U4: /* nothing */ break;
+ case Mode.I4_U2: ig.Emit (OpCodes.Conv_U2); break;
+ case Mode.I4_U8: ig.Emit (OpCodes.Conv_I8); break;
+ case Mode.I4_CH: ig.Emit (OpCodes.Conv_U2); break;
+
+ case Mode.U4_I1: ig.Emit (OpCodes.Conv_I1); break;
+ case Mode.U4_U1: ig.Emit (OpCodes.Conv_U1); break;
+ case Mode.U4_I2: ig.Emit (OpCodes.Conv_I2); break;
+ case Mode.U4_U2: ig.Emit (OpCodes.Conv_U2); break;
+ case Mode.U4_I4: /* nothing */ break;
+ case Mode.U4_CH: ig.Emit (OpCodes.Conv_U2); break;
+
+ case Mode.I8_I1: ig.Emit (OpCodes.Conv_I1); break;
+ case Mode.I8_U1: ig.Emit (OpCodes.Conv_U1); break;
+ case Mode.I8_I2: ig.Emit (OpCodes.Conv_I2); break;
+ case Mode.I8_U2: ig.Emit (OpCodes.Conv_U2); break;
+ case Mode.I8_I4: ig.Emit (OpCodes.Conv_I4); break;
+ case Mode.I8_U4: ig.Emit (OpCodes.Conv_U4); break;
+ case Mode.I8_U8: /* nothing */ break;
+ case Mode.I8_CH: ig.Emit (OpCodes.Conv_U2); break;
+
+ case Mode.U8_I1: ig.Emit (OpCodes.Conv_I1); break;
+ case Mode.U8_U1: ig.Emit (OpCodes.Conv_U1); break;
+ case Mode.U8_I2: ig.Emit (OpCodes.Conv_I2); break;
+ case Mode.U8_U2: ig.Emit (OpCodes.Conv_U2); break;
+ case Mode.U8_I4: ig.Emit (OpCodes.Conv_I4); break;
+ case Mode.U8_U4: ig.Emit (OpCodes.Conv_U4); break;
+ case Mode.U8_I8: /* nothing */ break;
+ case Mode.U8_CH: ig.Emit (OpCodes.Conv_U2); break;
+
+ case Mode.CH_I1: ig.Emit (OpCodes.Conv_I1); break;
+ case Mode.CH_U1: ig.Emit (OpCodes.Conv_U1); break;
+ case Mode.CH_I2: ig.Emit (OpCodes.Conv_I2); break;
+
+ case Mode.R4_I1: ig.Emit (OpCodes.Conv_I1); break;
+ case Mode.R4_U1: ig.Emit (OpCodes.Conv_U1); break;
+ case Mode.R4_I2: ig.Emit (OpCodes.Conv_I2); break;
+ case Mode.R4_U2: ig.Emit (OpCodes.Conv_U2); break;
+ case Mode.R4_I4: ig.Emit (OpCodes.Conv_I4); break;
+ case Mode.R4_U4: ig.Emit (OpCodes.Conv_U4); break;
+ case Mode.R4_I8: ig.Emit (OpCodes.Conv_I8); break;
+ case Mode.R4_U8: ig.Emit (OpCodes.Conv_U8); break;
+ case Mode.R4_CH: ig.Emit (OpCodes.Conv_U2); break;
+
+ case Mode.R8_I1: ig.Emit (OpCodes.Conv_I1); break;
+ case Mode.R8_U1: ig.Emit (OpCodes.Conv_U1); break;
+ case Mode.R8_I2: ig.Emit (OpCodes.Conv_I2); break;
+ case Mode.R8_U2: ig.Emit (OpCodes.Conv_U2); break;
+ case Mode.R8_I4: ig.Emit (OpCodes.Conv_I4); break;
+ case Mode.R8_U4: ig.Emit (OpCodes.Conv_U4); break;
+ case Mode.R8_I8: ig.Emit (OpCodes.Conv_I8); break;
+ case Mode.R8_U8: ig.Emit (OpCodes.Conv_U8); break;
+ case Mode.R8_CH: ig.Emit (OpCodes.Conv_U2); break;
+ case Mode.R8_R4: ig.Emit (OpCodes.Conv_R4); break;
+ }
+ }
+ }
+ }
+
+ public class OpcodeCast : EmptyCast {
+ OpCode op, op2;
+ bool second_valid;
+
+ public OpcodeCast (Expression child, Type return_type, OpCode op)
+ : base (child, return_type)
+
+ {
+ this.op = op;
+ second_valid = false;
+ }
+
+ public OpcodeCast (Expression child, Type return_type, OpCode op, OpCode op2)
+ : base (child, return_type)
+
+ {
+ this.op = op;
+ this.op2 = op2;
+ second_valid = true;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ // This should never be invoked, we are born in fully
+ // initialized state.
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ base.Emit (ec);
+ ec.ig.Emit (op);
+
+ if (second_valid)
+ ec.ig.Emit (op2);
+ }
+ }
+
+ /// <summary>
+ /// This kind of cast is used to encapsulate a child and cast it
+ /// to the class requested
+ /// </summary>
+ public class ClassCast : EmptyCast {
+ public ClassCast (Expression child, Type return_type)
+ : base (child, return_type)
+
+ {
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ // This should never be invoked, we are born in fully
+ // initialized state.
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ base.Emit (ec);
+
+ ec.ig.Emit (OpCodes.Castclass, type);
+ }
+
+ }
+
+ /// <summary>
+ /// SimpleName expressions are initially formed of a single
+ /// word and it only happens at the beginning of the expression.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// The expression will try to be bound to a Field, a Method
+ /// group or a Property. If those fail we pass the name to our
+ /// caller and the SimpleName is compounded to perform a type
+ /// lookup. The idea behind this process is that we want to avoid
+ /// creating a namespace map from the assemblies, as that requires
+ /// the GetExportedTypes function to be called and a hashtable to
+ /// be constructed which reduces startup time. If later we find
+ /// that this is slower, we should create a `NamespaceExpr' expression
+ /// that fully participates in the resolution process.
+ ///
+ /// For example `System.Console.WriteLine' is decomposed into
+ /// MemberAccess (MemberAccess (SimpleName ("System"), "Console"), "WriteLine")
+ ///
+ /// The first SimpleName wont produce a match on its own, so it will
+ /// be turned into:
+ /// MemberAccess (SimpleName ("System.Console"), "WriteLine").
+ ///
+ /// System.Console will produce a TypeExpr match.
+ ///
+ /// The downside of this is that we might be hitting `LookupType' too many
+ /// times with this scheme.
+ /// </remarks>
+ public class SimpleName : Expression {
+ public readonly string Name;
+ public readonly Location Location;
+
+ public SimpleName (string name, Location l)
+ {
+ Name = name;
+ Location = l;
+ }
+
+ public static void Error120 (Location l, string name)
+ {
+ Report.Error (
+ 120, l,
+ "An object reference is required " +
+ "for the non-static field `"+name+"'");
+ }
+
+ //
+ // Checks whether we are trying to access an instance
+ // property, method or field from a static body.
+ //
+ Expression MemberStaticCheck (Expression e)
+ {
+ if (e is FieldExpr){
+ FieldInfo fi = ((FieldExpr) e).FieldInfo;
+
+ if (!fi.IsStatic){
+ Error120 (Location, Name);
+ return null;
+ }
+ } else if (e is MethodGroupExpr){
+ MethodGroupExpr mg = (MethodGroupExpr) e;
+
+ if (!mg.RemoveInstanceMethods ()){
+ Error120 (Location, mg.Methods [0].Name);
+ return null;
+ }
+ return e;
+ } else if (e is PropertyExpr){
+ if (!((PropertyExpr) e).IsStatic){
+ Error120 (Location, Name);
+ return null;
+ }
+ } else if (e is EventExpr) {
+ if (!((EventExpr) e).IsStatic) {
+ Error120 (Location, Name);
+ return null;
+ }
+ }
+
+ return e;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ return SimpleNameResolve (ec, false);
+ }
+
+ public Expression DoResolveAllowStatic (EmitContext ec)
+ {
+ return SimpleNameResolve (ec, true);
+ }
+
+ /// <remarks>
+ /// 7.5.2: Simple Names.
+ ///
+ /// Local Variables and Parameters are handled at
+ /// parse time, so they never occur as SimpleNames.
+ ///
+ /// The `allow_static' flag is used by MemberAccess only
+ /// and it is used to inform us that it is ok for us to
+ /// avoid the static check, because MemberAccess might end
+ /// up resolving the Name as a Type name and the access as
+ /// a static type access.
+ ///
+ /// ie: Type Type; .... { Type.GetType (""); }
+ ///
+ /// Type is both an instance variable and a Type; Type.GetType
+ /// is the static method not an instance method of type.
+ /// </remarks>
+ Expression SimpleNameResolve (EmitContext ec, bool allow_static)
+ {
+ Expression e = null;
+
+ //
+ // Stage 1: Performed by the parser (binding to locals or parameters).
+ //
+ if (!ec.OnlyLookupTypes){
+ Block current_block = ec.CurrentBlock;
+ if (current_block != null && current_block.IsVariableDefined (Name)){
+ LocalVariableReference var;
+
+ var = new LocalVariableReference (ec.CurrentBlock, Name, Location);
+
+ return var.Resolve (ec);
+ }
+
+ //
+ // Stage 2: Lookup members
+ //
+
+ //
+ // For enums, the TypeBuilder is not ec.TypeContainer.TypeBuilder
+ // Hence we have two different cases
+ //
+ e = MemberLookup (ec, ec.DeclSpace.TypeBuilder, Name, Location);
+
+ if (e == null && ec.ContainerType != null)
+ e = MemberLookup (ec, ec.ContainerType, Name, Location);
+ }
+
+ // Continuation of stage 2
+ if (e == null){
+ //
+ // Stage 3: Lookup symbol in the various namespaces.
+ //
+ DeclSpace ds = ec.DeclSpace;
+ Type t;
+ string alias_value;
+
+ if ((t = RootContext.LookupType (ds, Name, true, Location)) != null)
+ return new TypeExpr (t);
+
+ //
+ // Stage 2 part b: Lookup up if we are an alias to a type
+ // or a namespace.
+ //
+ // Since we are cheating: we only do the Alias lookup for
+ // namespaces if the name does not include any dots in it
+ //
+
+ if (Name.IndexOf ('.') == -1 && (alias_value = ec.TypeContainer.LookupAlias (Name)) != null) {
+ // System.Console.WriteLine (Name + " --> " + alias_value);
+ if ((t = RootContext.LookupType (ds, alias_value, true, Location))
+ != null)
+ return new TypeExpr (t);
+
+ // we have alias value, but it isn't Type, so try if it's namespace
+ return new SimpleName (alias_value, Location);
+ }
+
+ // No match, maybe our parent can compose us
+ // into something meaningful.
+ return this;
+ }
+
+ //
+ // Stage 2 continues here.
+ //
+ if (e is TypeExpr)
+ return e;
+
+ if (ec.OnlyLookupTypes)
+ return null;
+
+ if (e is FieldExpr){
+ FieldExpr fe = (FieldExpr) e;
+ FieldInfo fi = fe.FieldInfo;
+
+ if (fi.FieldType.IsPointer && !ec.InUnsafe){
+ UnsafeError (Location);
+ }
+
+ if (ec.IsStatic){
+ if (!allow_static && !fi.IsStatic){
+ Error120 (Location, Name);
+ return null;
+ }
+ } else {
+ // If we are not in static code and this
+ // field is not static, set the instance to `this'.
+
+ if (!fi.IsStatic)
+ fe.InstanceExpression = ec.This;
+ }
+
+
+ if (fi is FieldBuilder) {
+ Const c = TypeManager.LookupConstant ((FieldBuilder) fi);
+
+ if (c != null) {
+ object o = c.LookupConstantValue (ec);
+ object real_value = ((Constant)c.Expr).GetValue ();
+ return Constantify (real_value, fi.FieldType);
+ }
+ }
+
+ if (fi.IsLiteral) {
+ Type t = fi.FieldType;
+ Type decl_type = fi.DeclaringType;
+ object o;
+
+ if (fi is FieldBuilder)
+ o = TypeManager.GetValue ((FieldBuilder) fi);
+ else
+ o = fi.GetValue (fi);
+
+ if (decl_type.IsSubclassOf (TypeManager.enum_type)) {
+ Expression enum_member = MemberLookup (
+ ec, decl_type, "value__", MemberTypes.Field,
+ AllBindingFlags, Location);
+
+ Enum en = TypeManager.LookupEnum (decl_type);
+
+ Constant c;
+ if (en != null)
+ c = Constantify (o, en.UnderlyingType);
+ else
+ c = Constantify (o, enum_member.Type);
+
+ return new EnumConstant (c, decl_type);
+ }
+
+ Expression exp = Constantify (o, t);
+ }
+
+ return e;
+ }
+
+ if (e is EventExpr) {
+ //
+ // If the event is local to this class, we transform ourselves into
+ // a FieldExpr
+ //
+ EventExpr ee = (EventExpr) e;
+
+ Expression ml = MemberLookup (
+ ec, ec.DeclSpace.TypeBuilder, ee.EventInfo.Name,
+ MemberTypes.Event, AllBindingFlags, Location);
+
+ if (ml != null) {
+ MemberInfo mi = ec.TypeContainer.GetFieldFromEvent ((EventExpr) ml);
+
+ if (mi == null) {
+ //
+ // If this happens, then we have an event with its own
+ // accessors and private field etc so there's no need
+ // to transform ourselves : we should instead flag an error
+ //
+ Assign.error70 (ee.EventInfo, Location);
+ return null;
+ }
+
+ ml = ExprClassFromMemberInfo (ec, mi, Location);
+
+ if (ml == null) {
+ Report.Error (-200, Location, "Internal error!!");
+ return null;
+ }
+
+ Expression instance_expr;
+
+ FieldInfo fi = ((FieldExpr) ml).FieldInfo;
+
+ if (fi.IsStatic)
+ instance_expr = null;
+ else
+ instance_expr = ec.This;
+
+ instance_expr = instance_expr.Resolve (ec);
+
+ if (instance_expr != null)
+ instance_expr = instance_expr.Resolve (ec);
+
+ return MemberAccess.ResolveMemberAccess (ec, ml, instance_expr, Location, null);
+ }
+ }
+
+
+ if (ec.IsStatic){
+ if (allow_static)
+ return e;
+
+ return MemberStaticCheck (e);
+ } else
+ return e;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ //
+ // If this is ever reached, then we failed to
+ // find the name as a namespace
+ //
+
+ Error (103, Location, "The name `" + Name +
+ "' does not exist in the class `" +
+ ec.DeclSpace.Name + "'");
+ }
+ }
+
+ /// <summary>
+ /// Fully resolved expression that evaluates to a type
+ /// </summary>
+ public class TypeExpr : Expression {
+ public TypeExpr (Type t)
+ {
+ Type = t;
+ eclass = ExprClass.Type;
+ }
+
+ override public Expression DoResolve (EmitContext ec)
+ {
+ return this;
+ }
+
+ override public void Emit (EmitContext ec)
+ {
+ throw new Exception ("Implement me");
+ }
+ }
+
+ /// <summary>
+ /// MethodGroup Expression.
+ ///
+ /// This is a fully resolved expression that evaluates to a type
+ /// </summary>
+ public class MethodGroupExpr : Expression {
+ public MethodBase [] Methods;
+ Location loc;
+ Expression instance_expression = null;
+
+ public MethodGroupExpr (MemberInfo [] mi, Location l)
+ {
+ Methods = new MethodBase [mi.Length];
+ mi.CopyTo (Methods, 0);
+ eclass = ExprClass.MethodGroup;
+ type = TypeManager.object_type;
+ loc = l;
+ }
+
+ public MethodGroupExpr (ArrayList list, Location l)
+ {
+ Methods = new MethodBase [list.Count];
+
+ try {
+ list.CopyTo (Methods, 0);
+ } catch {
+ foreach (MemberInfo m in list){
+ if (!(m is MethodBase)){
+ Console.WriteLine ("Name " + m.Name);
+ Console.WriteLine ("Found a: " + m.GetType ().FullName);
+ }
+ }
+ throw;
+ }
+ loc = l;
+ eclass = ExprClass.MethodGroup;
+ type = TypeManager.object_type;
+ }
+
+ //
+ // `A method group may have associated an instance expression'
+ //
+ public Expression InstanceExpression {
+ get {
+ return instance_expression;
+ }
+
+ set {
+ instance_expression = value;
+ }
+ }
+
+ override public Expression DoResolve (EmitContext ec)
+ {
+ return this;
+ }
+
+ public void ReportUsageError ()
+ {
+ Report.Error (654, loc, "Method `" + Methods [0].DeclaringType + "." +
+ Methods [0].Name + "()' is referenced without parentheses");
+ }
+
+ override public void Emit (EmitContext ec)
+ {
+ ReportUsageError ();
+ }
+
+ bool RemoveMethods (bool keep_static)
+ {
+ ArrayList smethods = new ArrayList ();
+ int top = Methods.Length;
+ int i;
+
+ for (i = 0; i < top; i++){
+ MethodBase mb = Methods [i];
+
+ if (mb.IsStatic == keep_static)
+ smethods.Add (mb);
+ }
+
+ if (smethods.Count == 0)
+ return false;
+
+ Methods = new MethodBase [smethods.Count];
+ smethods.CopyTo (Methods, 0);
+
+ return true;
+ }
+
+ /// <summary>
+ /// Removes any instance methods from the MethodGroup, returns
+ /// false if the resulting set is empty.
+ /// </summary>
+ public bool RemoveInstanceMethods ()
+ {
+ return RemoveMethods (true);
+ }
+
+ /// <summary>
+ /// Removes any static methods from the MethodGroup, returns
+ /// false if the resulting set is empty.
+ /// </summary>
+ public bool RemoveStaticMethods ()
+ {
+ return RemoveMethods (false);
+ }
+ }
+
+ /// <summary>
+ /// Fully resolved expression that evaluates to a Field
+ /// </summary>
+ public class FieldExpr : Expression, IAssignMethod, IMemoryLocation {
+ public readonly FieldInfo FieldInfo;
+ public Expression InstanceExpression;
+ Location loc;
+
+ public FieldExpr (FieldInfo fi, Location l)
+ {
+ FieldInfo = fi;
+ eclass = ExprClass.Variable;
+ type = fi.FieldType;
+ loc = l;
+ }
+
+ override public Expression DoResolve (EmitContext ec)
+ {
+ if (!FieldInfo.IsStatic){
+ if (InstanceExpression == null){
+ throw new Exception ("non-static FieldExpr without instance var\n" +
+ "You have to assign the Instance variable\n" +
+ "Of the FieldExpr to set this\n");
+ }
+
+ InstanceExpression = InstanceExpression.Resolve (ec);
+ if (InstanceExpression == null)
+ return null;
+ }
+
+ return this;
+ }
+
+ override public Expression DoResolveLValue (EmitContext ec, Expression right_side)
+ {
+ Expression e = DoResolve (ec);
+
+ if (e == null)
+ return null;
+
+ if (!FieldInfo.IsInitOnly)
+ return this;
+
+ //
+ // InitOnly fields can only be assigned in constructors
+ //
+
+ if (ec.IsConstructor)
+ return this;
+
+ Report.Error (191, loc,
+ "Readonly field can not be assigned outside " +
+ "of constructor or variable initializer");
+
+ return null;
+ }
+
+ override public void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ bool is_volatile = false;
+
+ if (FieldInfo is FieldBuilder){
+ Field f = TypeManager.GetField (FieldInfo);
+ if (f != null){
+ if ((f.ModFlags & Modifiers.VOLATILE) != 0)
+ is_volatile = true;
+
+ f.status |= Field.Status.USED;
+ }
+ }
+
+ if (FieldInfo.IsStatic){
+ if (is_volatile)
+ ig.Emit (OpCodes.Volatile);
+
+ ig.Emit (OpCodes.Ldsfld, FieldInfo);
+ } else {
+ if (InstanceExpression.Type.IsValueType){
+ IMemoryLocation ml;
+ LocalTemporary tempo = null;
+
+ if (!(InstanceExpression is IMemoryLocation)){
+ tempo = new LocalTemporary (
+ ec, InstanceExpression.Type);
+
+ InstanceExpression.Emit (ec);
+ tempo.Store (ec);
+ ml = tempo;
+ } else
+ ml = (IMemoryLocation) InstanceExpression;
+
+ ml.AddressOf (ec, AddressOp.Load);
+ } else
+ InstanceExpression.Emit (ec);
+
+ if (is_volatile)
+ ig.Emit (OpCodes.Volatile);
+
+ ig.Emit (OpCodes.Ldfld, FieldInfo);
+ }
+ }
+
+ public void EmitAssign (EmitContext ec, Expression source)
+ {
+ bool is_static = FieldInfo.IsStatic;
+ ILGenerator ig = ec.ig;
+
+ if (!is_static){
+ Expression instance = InstanceExpression;
+
+ if (instance.Type.IsValueType){
+ if (instance is IMemoryLocation){
+ IMemoryLocation ml = (IMemoryLocation) instance;
+
+ ml.AddressOf (ec, AddressOp.Store);
+ } else
+ throw new Exception ("The " + instance + " of type " +
+ instance.Type +
+ " represents a ValueType and does " +
+ "not implement IMemoryLocation");
+ } else
+ instance.Emit (ec);
+ }
+ source.Emit (ec);
+
+ if (FieldInfo is FieldBuilder){
+ Field f = TypeManager.GetField (FieldInfo);
+ if (f != null && (f.ModFlags & Modifiers.VOLATILE) != 0)
+ ig.Emit (OpCodes.Volatile);
+ }
+
+ if (is_static)
+ ig.Emit (OpCodes.Stsfld, FieldInfo);
+ else
+ ig.Emit (OpCodes.Stfld, FieldInfo);
+
+ if (FieldInfo is FieldBuilder){
+ Field f = TypeManager.GetField (FieldInfo);
+
+ f.status |= Field.Status.ASSIGNED;
+ }
+ }
+
+ public void AddressOf (EmitContext ec, AddressOp mode)
+ {
+ ILGenerator ig = ec.ig;
+
+ if (FieldInfo is FieldBuilder){
+ Field f = TypeManager.GetField (FieldInfo);
+ if (f != null && (f.ModFlags & Modifiers.VOLATILE) != 0)
+ ig.Emit (OpCodes.Volatile);
+ }
+
+ if (FieldInfo is FieldBuilder){
+ Field f = TypeManager.GetField (FieldInfo);
+
+ if ((mode & AddressOp.Store) != 0)
+ f.status |= Field.Status.ASSIGNED;
+ if ((mode & AddressOp.Load) != 0)
+ f.status |= Field.Status.USED;
+ }
+
+ //
+ // Handle initonly fields specially: make a copy and then
+ // get the address of the copy.
+ //
+ if (FieldInfo.IsInitOnly){
+ LocalBuilder local;
+
+ Emit (ec);
+ local = ig.DeclareLocal (type);
+ ig.Emit (OpCodes.Stloc, local);
+ ig.Emit (OpCodes.Ldloca, local);
+ return;
+ }
+
+ if (FieldInfo.IsStatic)
+ ig.Emit (OpCodes.Ldsflda, FieldInfo);
+ else {
+ InstanceExpression.Emit (ec);
+ ig.Emit (OpCodes.Ldflda, FieldInfo);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Expression that evaluates to a Property. The Assign class
+ /// might set the `Value' expression if we are in an assignment.
+ ///
+ /// This is not an LValue because we need to re-write the expression, we
+ /// can not take data from the stack and store it.
+ /// </summary>
+ public class PropertyExpr : ExpressionStatement, IAssignMethod {
+ public readonly PropertyInfo PropertyInfo;
+ public readonly bool IsStatic;
+ public bool IsBase;
+ MethodInfo [] Accessors;
+ Location loc;
+
+ Expression instance_expr;
+
+ public PropertyExpr (PropertyInfo pi, Location l)
+ {
+ PropertyInfo = pi;
+ eclass = ExprClass.PropertyAccess;
+ IsStatic = false;
+ loc = l;
+ Accessors = TypeManager.GetAccessors (pi);
+
+ if (Accessors != null)
+ for (int i = 0; i < Accessors.Length; i++){
+ if (Accessors [i] != null)
+ if (Accessors [i].IsStatic)
+ IsStatic = true;
+ }
+ else
+ Accessors = new MethodInfo [2];
+
+ type = pi.PropertyType;
+ }
+
+ //
+ // The instance expression associated with this expression
+ //
+ public Expression InstanceExpression {
+ set {
+ instance_expr = value;
+ }
+
+ get {
+ return instance_expr;
+ }
+ }
+
+ public bool VerifyAssignable ()
+ {
+ if (!PropertyInfo.CanWrite){
+ Report.Error (200, loc,
+ "The property `" + PropertyInfo.Name +
+ "' can not be assigned to, as it has not set accessor");
+ return false;
+ }
+
+ return true;
+ }
+
+ override public Expression DoResolve (EmitContext ec)
+ {
+ if (!PropertyInfo.CanRead){
+ Report.Error (154, loc,
+ "The property `" + PropertyInfo.Name +
+ "' can not be used in " +
+ "this context because it lacks a get accessor");
+ return null;
+ }
+
+ type = PropertyInfo.PropertyType;
+
+ return this;
+ }
+
+ override public void Emit (EmitContext ec)
+ {
+ MethodInfo method = Accessors [0];
+
+ //
+ // Special case: length of single dimension array is turned into ldlen
+ //
+ if (method == TypeManager.int_array_get_length){
+ Type iet = instance_expr.Type;
+
+ if (iet.GetArrayRank () == 1){
+ instance_expr.Emit (ec);
+ ec.ig.Emit (OpCodes.Ldlen);
+ return;
+ }
+ }
+
+ Invocation.EmitCall (ec, IsBase, IsStatic, instance_expr, method, null);
+
+ }
+
+ //
+ // Implements the IAssignMethod interface for assignments
+ //
+ public void EmitAssign (EmitContext ec, Expression source)
+ {
+ Argument arg = new Argument (source, Argument.AType.Expression);
+ ArrayList args = new ArrayList ();
+
+ args.Add (arg);
+ Invocation.EmitCall (ec, false, IsStatic, instance_expr, Accessors [1], args);
+ }
+
+ override public void EmitStatement (EmitContext ec)
+ {
+ Emit (ec);
+ ec.ig.Emit (OpCodes.Pop);
+ }
+ }
+
+ /// <summary>
+ /// Fully resolved expression that evaluates to an Event
+ /// </summary>
+ public class EventExpr : Expression {
+ public readonly EventInfo EventInfo;
+ Location loc;
+ public Expression InstanceExpression;
+
+ public readonly bool IsStatic;
+
+ MethodInfo add_accessor, remove_accessor;
+
+ public EventExpr (EventInfo ei, Location loc)
+ {
+ EventInfo = ei;
+ this.loc = loc;
+ eclass = ExprClass.EventAccess;
+
+ add_accessor = TypeManager.GetAddMethod (ei);
+ remove_accessor = TypeManager.GetRemoveMethod (ei);
+
+ if (add_accessor.IsStatic || remove_accessor.IsStatic)
+ IsStatic = true;
+
+ if (EventInfo is MyEventBuilder)
+ type = ((MyEventBuilder) EventInfo).EventType;
+ else
+ type = EventInfo.EventHandlerType;
+ }
+
+ override public Expression DoResolve (EmitContext ec)
+ {
+ // We are born fully resolved
+ return this;
+ }
+
+ override public void Emit (EmitContext ec)
+ {
+ throw new Exception ("Should not happen I think");
+ }
+
+ public void EmitAddOrRemove (EmitContext ec, Expression source)
+ {
+ Expression handler = ((Binary) source).Right;
+
+ Argument arg = new Argument (handler, Argument.AType.Expression);
+ ArrayList args = new ArrayList ();
+
+ args.Add (arg);
+
+ if (((Binary) source).Oper == Binary.Operator.Addition)
+ Invocation.EmitCall (
+ ec, false, IsStatic, InstanceExpression, add_accessor, args);
+ else
+ Invocation.EmitCall (
+ ec, false, IsStatic, InstanceExpression, remove_accessor, args);
+ }
+ }
+}
diff --git a/mcs/mcs/enum.cs b/mcs/mcs/enum.cs
index 3278e6ef5e8..98deac653ed 100755
--- a/mcs/mcs/enum.cs
+++ b/mcs/mcs/enum.cs
@@ -2,6 +2,7 @@
// enum.cs: Enum handling.
//
// Author: Miguel de Icaza (miguel@gnu.org)
+// Ravi Pratap (ravi@ximian.com)
//
// Licensed under the terms of the GNU GPL
//
@@ -10,15 +11,31 @@
using System;
using System.Collections;
+using System.Reflection;
+using System.Reflection.Emit;
-namespace CIR {
+namespace Mono.CSharp {
+ /// <summary>
+ /// Enumeration container
+ /// </summary>
public class Enum : DeclSpace {
+
ArrayList ordered_enums;
- TypeRef typeref;
- string name;
- int mod_flags;
+ public readonly string BaseType;
+ public Attributes OptAttributes;
+
+ public Type UnderlyingType;
+
+ Hashtable member_to_location;
+ //
+ // This is for members that have been defined
+ //
+ Hashtable member_to_value;
+
+ ArrayList field_builders;
+
public const int AllowedModifiers =
Modifiers.NEW |
Modifiers.PUBLIC |
@@ -26,20 +43,24 @@ namespace CIR {
Modifiers.INTERNAL |
Modifiers.PRIVATE;
- public Enum (TypeRef typeref, int mod_flags, string name) : base (name)
+ public Enum (TypeContainer parent, string type, int mod_flags, string name, Attributes attrs, Location l)
+ : base (parent, name, l)
{
- this.typeref = typeref;
- this.name = name;
- this.mod_flags = Modifiers.Check (AllowedModifiers, mod_flags, Modifiers.PUBLIC);
+ this.BaseType = type;
+ ModFlags = Modifiers.Check (AllowedModifiers, mod_flags, Modifiers.PUBLIC, l);
+ OptAttributes = attrs;
ordered_enums = new ArrayList ();
+ member_to_location = new Hashtable ();
+ member_to_value = new Hashtable ();
+ field_builders = new ArrayList ();
}
- // <summary>
- // Adds @name to the enumeration space, with @expr
- // being its definition.
- // </summary>
- public AdditionResult AddEnum (string name, Expression expr)
+ /// <summary>
+ /// Adds @name to the enumeration space, with @expr
+ /// being its definition.
+ /// </summary>
+ public AdditionResult AddEnumMember (string name, Expression expr, Location loc)
{
if (defined_names.Contains (name))
return AdditionResult.NameExists;
@@ -47,37 +68,347 @@ namespace CIR {
DefineName (name, expr);
ordered_enums.Add (name);
+ member_to_location.Add (name, loc);
+
return AdditionResult.Success;
}
- public Type Type {
- get {
- return typeref.Type;
+ public override TypeBuilder DefineType ()
+ {
+ if (TypeBuilder != null)
+ return TypeBuilder;
+
+ TypeAttributes attr = TypeAttributes.Class | TypeAttributes.Sealed;
+
+ UnderlyingType = TypeManager.LookupType (BaseType);
+
+ if (UnderlyingType != TypeManager.int32_type &&
+ UnderlyingType != TypeManager.uint32_type &&
+ UnderlyingType != TypeManager.int64_type &&
+ UnderlyingType != TypeManager.uint64_type &&
+ UnderlyingType != TypeManager.short_type &&
+ UnderlyingType != TypeManager.ushort_type &&
+ UnderlyingType != TypeManager.byte_type &&
+ UnderlyingType != TypeManager.sbyte_type) {
+ Report.Error (1008, Location,
+ "Type byte, sbyte, short, ushort, int, uint, " +
+ "long, or ulong expected (got: " +
+ TypeManager.CSharpName (UnderlyingType) + ")");
+ return null;
}
+
+ if (IsTopLevel) {
+ ModuleBuilder builder = CodeGen.ModuleBuilder;
+
+ if ((ModFlags & Modifiers.PUBLIC) != 0)
+ attr |= TypeAttributes.Public;
+ else
+ attr |= TypeAttributes.NotPublic;
+
+ TypeBuilder = builder.DefineType (Name, attr, TypeManager.enum_type);
+ } else {
+ TypeBuilder builder = Parent.TypeBuilder;
+
+ if ((ModFlags & Modifiers.PUBLIC) != 0)
+ attr |= TypeAttributes.NestedPublic;
+ else
+ attr |= TypeAttributes.NestedPrivate;
+
+
+ TypeBuilder = builder.DefineNestedType (
+ Basename, attr, TypeManager.enum_type);
+ }
+
+ TypeBuilder.DefineField ("value__", UnderlyingType,
+ FieldAttributes.Public | FieldAttributes.SpecialName
+ | FieldAttributes.RTSpecialName);
+
+ TypeManager.AddEnumType (Name, TypeBuilder, this);
+
+ return TypeBuilder;
}
- public ArrayList ValueNames {
- get {
- return ordered_enums;
+ bool IsValidEnumConstant (Expression e)
+ {
+ if (!(e is Constant))
+ return false;
+
+ if (e is IntConstant || e is UIntConstant || e is LongConstant ||
+ e is ByteConstant || e is SByteConstant || e is ShortConstant ||
+ e is UShortConstant || e is ULongConstant || e is EnumConstant)
+ return true;
+ else
+ return false;
+ }
+
+ object GetNextDefaultValue (object default_value)
+ {
+ if (UnderlyingType == TypeManager.int32_type) {
+ int i = (int) default_value;
+
+ if (i < System.Int32.MaxValue)
+ return ++i;
+ else
+ return null;
+ } else if (UnderlyingType == TypeManager.uint32_type) {
+ uint i = (uint) default_value;
+
+ if (i < System.UInt32.MaxValue)
+ return ++i;
+ else
+ return null;
+ } else if (UnderlyingType == TypeManager.int64_type) {
+ long i = (long) default_value;
+
+ if (i < System.Int64.MaxValue)
+ return ++i;
+ else
+ return null;
+ } else if (UnderlyingType == TypeManager.uint64_type) {
+ ulong i = (ulong) default_value;
+
+ if (i < System.UInt64.MaxValue)
+ return ++i;
+ else
+ return null;
+ } else if (UnderlyingType == TypeManager.short_type) {
+ short i = (short) default_value;
+
+ if (i < System.Int16.MaxValue)
+ return ++i;
+ else
+ return null;
+ } else if (UnderlyingType == TypeManager.ushort_type) {
+ ushort i = (ushort) default_value;
+
+ if (i < System.UInt16.MaxValue)
+ return ++i;
+ else
+ return null;
+ } else if (UnderlyingType == TypeManager.byte_type) {
+ byte i = (byte) default_value;
+
+ if (i < System.Byte.MaxValue)
+ return ++i;
+ else
+ return null;
+ } else if (UnderlyingType == TypeManager.sbyte_type) {
+ sbyte i = (sbyte) default_value;
+
+ if (i < System.SByte.MaxValue)
+ return ++i;
+ else
+ return null;
}
+
+ return null;
}
- public int ModFlags {
- get {
- return mod_flags;
+ void Error_ConstantValueCannotBeConverted (object val, Location loc)
+ {
+ if (val is Constant)
+ Report.Error (31, loc, "Constant value '" + ((Constant) val).AsString () +
+ "' cannot be converted" +
+ " to a " + TypeManager.CSharpName (UnderlyingType));
+ else
+ Report.Error (31, loc, "Constant value '" + val +
+ "' cannot be converted" +
+ " to a " + TypeManager.CSharpName (UnderlyingType));
+ return;
+ }
+
+ /// <summary>
+ /// This is used to lookup the value of an enum member. If the member is undefined,
+ /// it attempts to define it and return its value
+ /// </summary>
+ public object LookupEnumValue (EmitContext ec, string name, Location loc)
+ {
+ object default_value = null;
+ Constant c = null;
+
+ default_value = member_to_value [name];
+
+ if (default_value != null)
+ return default_value;
+
+ if (!defined_names.Contains (name)) {
+ Report.Error (117, loc, "'"+ Name + "' does not contain a definition for '"
+ + name + "'");
+ return null;
}
+
+ //
+ // So if the above doesn't happen, we have a member that is undefined
+ // We now proceed to define it
+ //
+ Expression val = this [name];
+
+ if (val == null) {
+
+ int idx = ordered_enums.IndexOf (name);
+
+ if (idx == 0)
+ default_value = 0;
+ else {
+ for (int i = 0; i < idx; ++i) {
+ string n = (string) ordered_enums [i];
+ Location m_loc = (Mono.CSharp.Location)
+ member_to_location [n];
+ default_value = LookupEnumValue (ec, n, m_loc);
+ }
+
+ default_value = GetNextDefaultValue (default_value);
+ }
+
+ } else {
+ val = val.Resolve (ec);
+
+ if (val == null) {
+ Report.Error (-12, loc, "Definition is circular.");
+ return null;
+ }
+
+ if (IsValidEnumConstant (val)) {
+ c = (Constant) val;
+ default_value = c.GetValue ();
+
+ if (default_value == null) {
+ Error_ConstantValueCannotBeConverted (c, loc);
+ return null;
+ }
+
+ } else {
+ Report.Error (
+ 1008, loc,
+ "Type byte, sbyte, short, ushort, int, uint, long, or " +
+ "ulong expected (have: " + val + ")");
+ return null;
+ }
+ }
+
+ FieldAttributes attr = FieldAttributes.Public | FieldAttributes.Static
+ | FieldAttributes.Literal;
+
+ FieldBuilder fb = TypeBuilder.DefineField (name, UnderlyingType, attr);
+
+ try {
+ default_value = Convert.ChangeType (default_value, UnderlyingType);
+ } catch {
+ Error_ConstantValueCannotBeConverted (c, loc);
+ return null;
+ }
+
+ fb.SetConstant (default_value);
+ field_builders.Add (fb);
+ member_to_value [name] = default_value;
+
+ if (!TypeManager.RegisterFieldValue (fb, default_value))
+ return null;
+
+ return default_value;
+ }
+
+ public override bool Define (TypeContainer parent)
+ {
+ //
+ // If there was an error during DefineEnum, return
+ //
+ if (TypeBuilder == null)
+ return false;
+
+ EmitContext ec = new EmitContext (parent, this, Location, null,
+ UnderlyingType, ModFlags, false);
+
+ object default_value = 0;
+
+ FieldAttributes attr = FieldAttributes.Public | FieldAttributes.Static
+ | FieldAttributes.Literal;
+
+
+ foreach (string name in ordered_enums) {
+ //
+ // Have we already been defined, thanks to some cross-referencing ?
+ //
+ if (member_to_value.Contains (name))
+ continue;
+
+ Location loc = (Mono.CSharp.Location) member_to_location [name];
+
+ if (this [name] != null) {
+ default_value = LookupEnumValue (ec, name, loc);
+
+ if (default_value == null)
+ return true;
+
+ } else {
+ FieldBuilder fb = TypeBuilder.DefineField (
+ name, UnderlyingType, attr);
+
+ if (default_value == null) {
+ Report.Error (543, loc, "Enumerator value for '" + name + "' is too large to " +
+ "fit in its type");
+ return false;
+ }
+
+ try {
+ default_value = Convert.ChangeType (default_value, UnderlyingType);
+ } catch {
+ Error_ConstantValueCannotBeConverted (default_value, loc);
+ return false;
+ }
+
+ fb.SetConstant (default_value);
+ field_builders.Add (fb);
+ member_to_value [name] = default_value;
+
+ if (!TypeManager.RegisterFieldValue (fb, default_value))
+ return false;
+ }
+
+ default_value = GetNextDefaultValue (default_value);
+ }
+
+ Attribute.ApplyAttributes (ec, TypeBuilder, this, OptAttributes, Location);
+
+ return true;
}
+ //
+ // Hack around System.Reflection as found everywhere else
+ //
+ public MemberInfo [] FindMembers (MemberTypes mt, BindingFlags bf,
+ MemberFilter filter, object criteria)
+ {
+ ArrayList members = new ArrayList ();
+
+ if ((mt & MemberTypes.Field) != 0) {
+ foreach (FieldBuilder fb in field_builders)
+ if (filter (fb, criteria) == true)
+ members.Add (fb);
+ }
+
+ int count = members.Count;
+
+ if (count > 0) {
+ MemberInfo [] mi = new MemberInfo [count];
+ members.CopyTo (mi, 0);
+ return mi;
+ }
+
+ return null;
+ }
+
+ public ArrayList ValueNames {
+ get {
+ return ordered_enums;
+ }
+ }
+
// indexer
public Expression this [string name] {
get {
return (Expression) defined_names [name];
}
}
-
- public override Type Define (Tree tree)
- {
- return null;
- }
}
}
diff --git a/mcs/mcs/errors.cs b/mcs/mcs/errors.cs
index 8d3377de693..e69de29bb2d 100755
--- a/mcs/mcs/errors.cs
+++ b/mcs/mcs/errors.cs
@@ -1,12 +0,0 @@
-using System.IO;
-using System;
-
-namespace CSC {
- public class Error {
- public static void report_error (string error)
- {
- Console.Write ("ERROR: ");
- Console.WriteLine (error);
- }
- }
-}
diff --git a/mcs/mcs/expression.cs b/mcs/mcs/expression.cs
index 3f12e7dada5..c86d2456744 100755
--- a/mcs/mcs/expression.cs
+++ b/mcs/mcs/expression.cs
@@ -6,112 +6,890 @@
//
// (C) 2001 Ximian, Inc.
//
-namespace CIR {
+//
+#define USE_OLD
+
+namespace Mono.CSharp {
+ using System;
using System.Collections;
using System.Diagnostics;
- using System;
+ using System.Reflection;
+ using System.Reflection.Emit;
+ using System.Text;
+
+ /// <summary>
+ /// This is just a helper class, it is generated by Unary, UnaryMutator
+ /// when an overloaded method has been found. It just emits the code for a
+ /// static call.
+ /// </summary>
+ public class StaticCallExpr : ExpressionStatement {
+ ArrayList args;
+ MethodInfo mi;
+
+ StaticCallExpr (MethodInfo m, ArrayList a)
+ {
+ mi = m;
+ args = a;
+
+ type = m.ReturnType;
+ eclass = ExprClass.Value;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ //
+ // We are born fully resolved
+ //
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ if (args != null)
+ Invocation.EmitArguments (ec, mi, args);
+
+ ec.ig.Emit (OpCodes.Call, mi);
+ return;
+ }
+
+ static public Expression MakeSimpleCall (EmitContext ec, MethodGroupExpr mg,
+ Expression e, Location loc)
+ {
+ ArrayList args;
+ MethodBase method;
+
+ args = new ArrayList (1);
+ args.Add (new Argument (e, Argument.AType.Expression));
+ method = Invocation.OverloadResolve (ec, (MethodGroupExpr) mg, args, loc);
+
+ if (method == null)
+ return null;
+
+ return new StaticCallExpr ((MethodInfo) method, args);
+ }
+
+ public override void EmitStatement (EmitContext ec)
+ {
+ Emit (ec);
+ if (type != TypeManager.void_type)
+ ec.ig.Emit (OpCodes.Pop);
+ }
+ }
- public abstract class Expression {
- Type type;
- bool is_lvalue;
+ /// <summary>
+ /// Unary expressions.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Unary implements unary expressions. It derives from
+ /// ExpressionStatement becuase the pre/post increment/decrement
+ /// operators can be used in a statement context.
+ /// </remarks>
+ public class Unary : Expression {
+ public enum Operator : byte {
+ UnaryPlus, UnaryNegation, LogicalNot, OnesComplement,
+ Indirection, AddressOf, TOP
+ }
- public Type Type {
- get {
- return type;
+ public Operator Oper;
+ public Expression Expr;
+ Location loc;
+
+ public Unary (Operator op, Expression expr, Location loc)
+ {
+ this.Oper = op;
+ this.Expr = expr;
+ this.loc = loc;
+ }
+
+ /// <summary>
+ /// Returns a stringified representation of the Operator
+ /// </summary>
+ static public string OperName (Operator oper)
+ {
+ switch (oper){
+ case Operator.UnaryPlus:
+ return "+";
+ case Operator.UnaryNegation:
+ return "-";
+ case Operator.LogicalNot:
+ return "!";
+ case Operator.OnesComplement:
+ return "~";
+ case Operator.AddressOf:
+ return "&";
+ case Operator.Indirection:
+ return "*";
}
+
+ return oper.ToString ();
}
- public bool IsLValue {
- get {
- return is_lvalue;
+ static string [] oper_names;
+
+ static Unary ()
+ {
+ oper_names = new string [(int)Operator.TOP];
+
+ oper_names [(int) Operator.UnaryPlus] = "op_UnaryPlus";
+ oper_names [(int) Operator.UnaryNegation] = "op_UnaryNegation";
+ oper_names [(int) Operator.LogicalNot] = "op_LogicalNot";
+ oper_names [(int) Operator.OnesComplement] = "op_OnesComplement";
+ oper_names [(int) Operator.Indirection] = "op_Indirection";
+ oper_names [(int) Operator.AddressOf] = "op_AddressOf";
+ }
+
+ void Error23 (Type t)
+ {
+ Report.Error (
+ 23, loc, "Operator " + OperName (Oper) +
+ " cannot be applied to operand of type `" +
+ TypeManager.CSharpName (t) + "'");
+ }
+
+ /// <remarks>
+ /// The result has been already resolved:
+ ///
+ /// FIXME: a minus constant -128 sbyte cant be turned into a
+ /// constant byte.
+ /// </remarks>
+ static Expression TryReduceNegative (Expression expr)
+ {
+ Expression e = null;
+
+ if (expr is IntConstant)
+ e = new IntConstant (-((IntConstant) expr).Value);
+ else if (expr is UIntConstant)
+ e = new LongConstant (-((UIntConstant) expr).Value);
+ else if (expr is LongConstant)
+ e = new LongConstant (-((LongConstant) expr).Value);
+ else if (expr is FloatConstant)
+ e = new FloatConstant (-((FloatConstant) expr).Value);
+ else if (expr is DoubleConstant)
+ e = new DoubleConstant (-((DoubleConstant) expr).Value);
+ else if (expr is DecimalConstant)
+ e = new DecimalConstant (-((DecimalConstant) expr).Value);
+ else if (expr is ShortConstant)
+ e = new IntConstant (-((ShortConstant) expr).Value);
+ else if (expr is UShortConstant)
+ e = new IntConstant (-((UShortConstant) expr).Value);
+ return e;
+ }
+
+ Expression Reduce (EmitContext ec, Expression e)
+ {
+ Type expr_type = e.Type;
+
+ switch (Oper){
+ case Operator.UnaryPlus:
+ return e;
+
+ case Operator.UnaryNegation:
+ return TryReduceNegative (e);
+
+ case Operator.LogicalNot:
+ if (expr_type != TypeManager.bool_type) {
+ Error23 (expr_type);
+ return null;
+ }
+
+ BoolConstant b = (BoolConstant) e;
+ return new BoolConstant (!(b.Value));
+
+ case Operator.OnesComplement:
+ if (!((expr_type == TypeManager.int32_type) ||
+ (expr_type == TypeManager.uint32_type) ||
+ (expr_type == TypeManager.int64_type) ||
+ (expr_type == TypeManager.uint64_type) ||
+ (expr_type.IsSubclassOf (TypeManager.enum_type)))){
+ Error23 (expr_type);
+ return null;
+ }
+
+ if (e is EnumConstant){
+ EnumConstant enum_constant = (EnumConstant) e;
+
+ Expression reduced = Reduce (ec, enum_constant.Child);
+
+ return new EnumConstant ((Constant) reduced, enum_constant.Type);
+ }
+
+ if (expr_type == TypeManager.int32_type)
+ return new IntConstant (~ ((IntConstant) e).Value);
+ if (expr_type == TypeManager.uint32_type)
+ return new UIntConstant (~ ((UIntConstant) e).Value);
+ if (expr_type == TypeManager.int64_type)
+ return new LongConstant (~ ((LongConstant) e).Value);
+ if (expr_type == TypeManager.uint64_type)
+ return new ULongConstant (~ ((ULongConstant) e).Value);
+
+ Error23 (expr_type);
+ return null;
}
+ throw new Exception ("Can not constant fold");
+ }
- set {
- is_lvalue = value;
+ Expression ResolveOperator (EmitContext ec)
+ {
+ Type expr_type = Expr.Type;
+
+ //
+ // Step 1: Perform Operator Overload location
+ //
+ Expression mg;
+ string op_name;
+
+ op_name = oper_names [(int) Oper];
+
+ mg = MemberLookup (ec, expr_type, op_name, MemberTypes.Method, AllBindingFlags, loc);
+
+ if (mg != null) {
+ Expression e = StaticCallExpr.MakeSimpleCall (
+ ec, (MethodGroupExpr) mg, Expr, loc);
+
+ if (e == null){
+ Error23 (expr_type);
+ return null;
+ }
+
+ return e;
+ }
+
+ // Only perform numeric promotions on:
+ // +, -
+
+ if (expr_type == null)
+ return null;
+
+ //
+ // Step 2: Default operations on CLI native types.
+ //
+ if (Expr is Constant)
+ return Reduce (ec, Expr);
+
+ if (Oper == Operator.LogicalNot){
+ if (expr_type != TypeManager.bool_type) {
+ Error23 (Expr.Type);
+ return null;
+ }
+
+ type = TypeManager.bool_type;
+ return this;
+ }
+
+ if (Oper == Operator.OnesComplement) {
+ if (!((expr_type == TypeManager.int32_type) ||
+ (expr_type == TypeManager.uint32_type) ||
+ (expr_type == TypeManager.int64_type) ||
+ (expr_type == TypeManager.uint64_type) ||
+ (expr_type.IsSubclassOf (TypeManager.enum_type)))){
+ Expression e;
+
+ e = ConvertImplicit (ec, Expr, TypeManager.int32_type, loc);
+ if (e != null){
+ type = TypeManager.int32_type;
+ return this;
+ }
+ e = ConvertImplicit (ec, Expr, TypeManager.uint32_type, loc);
+ if (e != null){
+ type = TypeManager.uint32_type;
+ return this;
+ }
+ e = ConvertImplicit (ec, Expr, TypeManager.int64_type, loc);
+ if (e != null){
+ type = TypeManager.int64_type;
+ return this;
+ }
+ e = ConvertImplicit (ec, Expr, TypeManager.uint64_type, loc);
+ if (e != null){
+ type = TypeManager.uint64_type;
+ return this;
+ }
+ Error23 (expr_type);
+ return null;
+ }
+ type = expr_type;
+ return this;
+ }
+
+ if (Oper == Operator.UnaryPlus) {
+ //
+ // A plus in front of something is just a no-op, so return the child.
+ //
+ return Expr;
+ }
+
+ //
+ // Deals with -literals
+ // int operator- (int x)
+ // long operator- (long x)
+ // float operator- (float f)
+ // double operator- (double d)
+ // decimal operator- (decimal d)
+ //
+ if (Oper == Operator.UnaryNegation){
+ Expression e = null;
+
+ //
+ // transform - - expr into expr
+ //
+ if (Expr is Unary){
+ Unary unary = (Unary) Expr;
+
+ if (unary.Oper == Operator.UnaryNegation)
+ return unary.Expr;
+ }
+
+ //
+ // perform numeric promotions to int,
+ // long, double.
+ //
+ //
+ // The following is inneficient, because we call
+ // ConvertImplicit too many times.
+ //
+ // It is also not clear if we should convert to Float
+ // or Double initially.
+ //
+ if (expr_type == TypeManager.uint32_type){
+ //
+ // FIXME: handle exception to this rule that
+ // permits the int value -2147483648 (-2^31) to
+ // bt wrote as a decimal interger literal
+ //
+ type = TypeManager.int64_type;
+ Expr = ConvertImplicit (ec, Expr, type, loc);
+ return this;
+ }
+
+ if (expr_type == TypeManager.uint64_type){
+ //
+ // FIXME: Handle exception of `long value'
+ // -92233720368547758087 (-2^63) to be wrote as
+ // decimal integer literal.
+ //
+ Error23 (expr_type);
+ return null;
+ }
+
+ if (expr_type == TypeManager.float_type){
+ type = expr_type;
+ return this;
+ }
+
+ e = ConvertImplicit (ec, Expr, TypeManager.int32_type, loc);
+ if (e != null){
+ Expr = e;
+ type = e.Type;
+ return this;
+ }
+
+ e = ConvertImplicit (ec, Expr, TypeManager.int64_type, loc);
+ if (e != null){
+ Expr = e;
+ type = e.Type;
+ return this;
+ }
+
+ e = ConvertImplicit (ec, Expr, TypeManager.double_type, loc);
+ if (e != null){
+ Expr = e;
+ type = e.Type;
+ return this;
+ }
+
+ Error23 (expr_type);
+ return null;
+ }
+
+ if (Oper == Operator.AddressOf){
+ if (Expr.eclass != ExprClass.Variable){
+ Error (211, loc, "Cannot take the address of non-variables");
+ return null;
+ }
+
+ if (!ec.InUnsafe) {
+ UnsafeError (loc);
+ return null;
+ }
+
+ if (!TypeManager.VerifyUnManaged (Expr.Type, loc)){
+ return null;
+ }
+
+ //
+ // This construct is needed because dynamic types
+ // are not known by Type.GetType, so we have to try then to use
+ // ModuleBuilder.GetType.
+ //
+ string ptr_type_name = Expr.Type.FullName + "*";
+ type = Type.GetType (ptr_type_name);
+ if (type == null)
+ type = CodeGen.ModuleBuilder.GetType (ptr_type_name);
+
+ return this;
+ }
+
+ if (Oper == Operator.Indirection){
+ if (!ec.InUnsafe){
+ UnsafeError (loc);
+ return null;
+ }
+
+ if (!expr_type.IsPointer){
+ Report.Error (
+ 193, loc,
+ "The * or -> operator can only be applied to pointers");
+ return null;
+ }
+
+ //
+ // We create an Indirection expression, because
+ // it can implement the IMemoryLocation.
+ //
+ return new Indirection (Expr);
}
+
+ Error (187, loc, "No such operator '" + OperName (Oper) + "' defined for type '" +
+ TypeManager.CSharpName (expr_type) + "'");
+ return null;
}
- public virtual bool IsLiteral {
- get {
- return false;
+ public override Expression DoResolve (EmitContext ec)
+ {
+ Expr = Expr.Resolve (ec);
+
+ if (Expr == null)
+ return null;
+
+ eclass = ExprClass.Value;
+ return ResolveOperator (ec);
+ }
+
+ 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:
+ Expr.Emit (ec);
+ ig.Emit (OpCodes.Neg);
+ break;
+
+ case Operator.LogicalNot:
+ Expr.Emit (ec);
+ ig.Emit (OpCodes.Ldc_I4_0);
+ ig.Emit (OpCodes.Ceq);
+ break;
+
+ case Operator.OnesComplement:
+ Expr.Emit (ec);
+ ig.Emit (OpCodes.Not);
+ break;
+
+ case Operator.AddressOf:
+ ((IMemoryLocation)Expr).AddressOf (ec, AddressOp.LoadStore);
+ break;
+
+ default:
+ throw new Exception ("This should not happen: Operator = "
+ + Oper.ToString ());
}
}
+
+ /// <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)
+ {
+ if (Oper != Operator.LogicalNot)
+ throw new Exception ("EmitLogicalNot can only be called with !expr");
+
+ Expr.Emit (ec);
+ }
+
+ public override string ToString ()
+ {
+ return "Unary (" + Oper + ", " + Expr + ")";
+ }
- // <summary>
- // Protected constructor. Only derivate types should
- // be able to be created
- // </summary>
- // protected Type (
+ }
+
+ //
+ // Unary operators are turned into Indirection expressions
+ // after semantic analysis (this is so we can take the address
+ // of an indirection).
+ //
+ public class Indirection : Expression, IMemoryLocation, IAssignMethod {
+ Expression expr;
+
+ public Indirection (Expression expr)
+ {
+ this.expr = expr;
+ this.type = expr.Type.GetElementType ();
+ eclass = ExprClass.Variable;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ expr.Emit (ec);
+ LoadFromPtr (ec.ig, Type, false);
+ }
- protected Expression ()
+ public void EmitAssign (EmitContext ec, Expression source)
{
- type = null;
+ expr.Emit (ec);
+ source.Emit (ec);
+ StoreFromPtr (ec.ig, type);
}
- static bool EvaluateType (Expression expr, out Type setType)
+ public void AddressOf (EmitContext ec, AddressOp Mode)
{
- setType = null;
- return true;
+ expr.Emit (ec);
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ //
+ // Born fully resolved
+ //
+ return this;
}
}
+
+ /// <summary>
+ /// Unary Mutator expressions (pre and post ++ and --)
+ /// </summary>
+ ///
+ /// <remarks>
+ /// UnaryMutator implements ++ and -- expressions. It derives from
+ /// ExpressionStatement becuase the pre/post increment/decrement
+ /// operators can be used in a statement context.
+ ///
+ /// FIXME: Idea, we could split this up in two classes, one simpler
+ /// for the common case, and one with the extra fields for more complex
+ /// classes (indexers require temporary access; overloaded require method)
+ ///
+ /// Maybe we should have classes PreIncrement, PostIncrement, PreDecrement,
+ /// PostDecrement, that way we could save the `Mode' byte as well.
+ /// </remarks>
+ public class UnaryMutator : ExpressionStatement {
+ public enum Mode : byte {
+ PreIncrement, PreDecrement, PostIncrement, PostDecrement
+ }
+
+ Mode mode;
+ Location loc;
+ Expression expr;
+ LocalTemporary temp_storage;
- public class Unary : Expression {
- public enum Operator {
- Plus, Minus, Negate, BitComplement,
- Indirection, AddressOf, PreIncrement,
- PreDecrement, PostIncrement, PostDecrement
+ //
+ // This is expensive for the simplest case.
+ //
+ Expression method;
+
+ public UnaryMutator (Mode m, Expression e, Location l)
+ {
+ mode = m;
+ loc = l;
+ expr = e;
}
- Operator oper;
- Expression expr;
+ static string OperName (Mode mode)
+ {
+ return (mode == Mode.PreIncrement || mode == Mode.PostIncrement) ?
+ "++" : "--";
+ }
- public Unary (Operator op, Expression expr)
+ void Error23 (Type t)
{
- this.oper = op;
- this.expr = expr;
+ Report.Error (
+ 23, loc, "Operator " + OperName (mode) +
+ " cannot be applied to operand of type `" +
+ TypeManager.CSharpName (t) + "'");
}
- public Expression Expr {
- get {
- return expr;
+ /// <summary>
+ /// Returns whether an object of type `t' can be incremented
+ /// or decremented with add/sub (ie, basically whether we can
+ /// use pre-post incr-decr operations on it, but it is not a
+ /// System.Decimal, which we require operator overloading to catch)
+ /// </summary>
+ static bool IsIncrementableNumber (Type t)
+ {
+ return (t == TypeManager.sbyte_type) ||
+ (t == TypeManager.byte_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.char_type) ||
+ (t.IsSubclassOf (TypeManager.enum_type)) ||
+ (t == TypeManager.float_type) ||
+ (t == TypeManager.double_type) ||
+ (t.IsPointer && t != TypeManager.void_ptr_type);
+ }
+
+ Expression ResolveOperator (EmitContext ec)
+ {
+ Type expr_type = expr.Type;
+
+ //
+ // Step 1: Perform Operator Overload location
+ //
+ Expression mg;
+ string op_name;
+
+ if (mode == Mode.PreIncrement || mode == Mode.PostIncrement)
+ op_name = "op_Increment";
+ else
+ op_name = "op_Decrement";
+
+ mg = MemberLookup (ec, expr_type, op_name, MemberTypes.Method, AllBindingFlags, loc);
+
+ if (mg == null && expr_type.BaseType != null)
+ mg = MemberLookup (ec, expr_type.BaseType, op_name,
+ MemberTypes.Method, AllBindingFlags, loc);
+
+ if (mg != null) {
+ method = StaticCallExpr.MakeSimpleCall (
+ ec, (MethodGroupExpr) mg, expr, loc);
+
+ type = method.Type;
+ return this;
}
- set {
- expr = value;
+ //
+ // The operand of the prefix/postfix increment decrement operators
+ // should be an expression that is classified as a variable,
+ // a property access or an indexer access
+ //
+ type = expr_type;
+ if (expr.eclass == ExprClass.Variable){
+ if (IsIncrementableNumber (expr_type) ||
+ expr_type == TypeManager.decimal_type){
+ return this;
+ }
+ } else if (expr.eclass == ExprClass.IndexerAccess){
+ IndexerAccess ia = (IndexerAccess) expr;
+
+ temp_storage = new LocalTemporary (ec, expr.Type);
+
+ expr = ia.ResolveLValue (ec, temp_storage);
+ if (expr == null)
+ return null;
+
+ return this;
+ } else if (expr.eclass == ExprClass.PropertyAccess){
+ PropertyExpr pe = (PropertyExpr) expr;
+
+ if (pe.VerifyAssignable ())
+ return this;
+
+ return null;
+ } else {
+ report118 (loc, expr, "variable, indexer or property access");
+ return null;
}
+
+ Error (187, loc, "No such operator '" + OperName (mode) + "' defined for type '" +
+ TypeManager.CSharpName (expr_type) + "'");
+ return null;
}
- public Operator Oper {
- get {
- return oper;
- }
+ public override Expression DoResolve (EmitContext ec)
+ {
+ expr = expr.Resolve (ec);
+
+ if (expr == null)
+ return null;
- set {
- oper = value;
- }
+ eclass = ExprClass.Value;
+ return ResolveOperator (ec);
}
- }
- public class Probe : Expression {
- TypeRef typeref;
- Expression expr;
- Operator oper;
+ static int PtrTypeSize (Type t)
+ {
+ return GetTypeSize (t.GetElementType ());
+ }
+
+ //
+ // FIXME: We need some way of avoiding the use of temp_storage
+ // for some types of storage (parameters, local variables,
+ // static fields) and single-dimension array access.
+ //
+ void EmitCode (EmitContext ec, bool is_expr)
+ {
+ ILGenerator ig = ec.ig;
+ IAssignMethod ia = (IAssignMethod) expr;
+ Type expr_type = expr.Type;
+
+ if (temp_storage == null)
+ temp_storage = new LocalTemporary (ec, expr_type);
+
+ switch (mode){
+ case Mode.PreIncrement:
+ case Mode.PreDecrement:
+ if (method == null){
+ expr.Emit (ec);
+
+ if (expr_type == TypeManager.uint64_type ||
+ expr_type == TypeManager.int64_type)
+ ig.Emit (OpCodes.Ldc_I8, 1L);
+ else if (expr_type == TypeManager.double_type)
+ ig.Emit (OpCodes.Ldc_R8, 1.0);
+ else if (expr_type == TypeManager.float_type)
+ ig.Emit (OpCodes.Ldc_R4, 1.0F);
+ else if (expr_type.IsPointer){
+ int n = PtrTypeSize (expr_type);
+
+ if (n == 0)
+ ig.Emit (OpCodes.Sizeof, expr_type);
+ else
+ IntConstant.EmitInt (ig, n);
+ } else
+ ig.Emit (OpCodes.Ldc_I4_1);
+
+ //
+ // Select the opcode based on the check state (then the type)
+ // and the actual operation
+ //
+ if (ec.CheckState){
+ if (expr_type == TypeManager.int32_type ||
+ expr_type == TypeManager.int64_type){
+ if (mode == Mode.PreDecrement)
+ ig.Emit (OpCodes.Sub_Ovf);
+ else
+ ig.Emit (OpCodes.Add_Ovf);
+ } else if (expr_type == TypeManager.uint32_type ||
+ expr_type == TypeManager.uint64_type){
+ if (mode == Mode.PreDecrement)
+ ig.Emit (OpCodes.Sub_Ovf_Un);
+ else
+ ig.Emit (OpCodes.Add_Ovf_Un);
+ } else {
+ if (mode == Mode.PreDecrement)
+ ig.Emit (OpCodes.Sub_Ovf);
+ else
+ ig.Emit (OpCodes.Add_Ovf);
+ }
+ } else {
+ if (mode == Mode.PreDecrement)
+ ig.Emit (OpCodes.Sub);
+ else
+ ig.Emit (OpCodes.Add);
+ }
+ } else
+ method.Emit (ec);
+
+ temp_storage.Store (ec);
+ ia.EmitAssign (ec, temp_storage);
+ if (is_expr)
+ temp_storage.Emit (ec);
+ break;
+
+ case Mode.PostIncrement:
+ case Mode.PostDecrement:
+ if (is_expr)
+ expr.Emit (ec);
+
+ if (method == null){
+ if (!is_expr)
+ expr.Emit (ec);
+ else
+ ig.Emit (OpCodes.Dup);
+
+ if (expr_type == TypeManager.uint64_type ||
+ expr_type == TypeManager.int64_type)
+ ig.Emit (OpCodes.Ldc_I8, 1L);
+ else if (expr_type == TypeManager.double_type)
+ ig.Emit (OpCodes.Ldc_R8, 1.0);
+ else if (expr_type == TypeManager.float_type)
+ ig.Emit (OpCodes.Ldc_R4, 1.0F);
+ else if (expr_type.IsPointer){
+ int n = PtrTypeSize (expr_type);
+
+ if (n == 0)
+ ig.Emit (OpCodes.Sizeof, expr_type);
+ else
+ IntConstant.EmitInt (ig, n);
+ } else
+ ig.Emit (OpCodes.Ldc_I4_1);
+
+ if (ec.CheckState){
+ if (expr_type == TypeManager.int32_type ||
+ expr_type == TypeManager.int64_type){
+ if (mode == Mode.PostDecrement)
+ ig.Emit (OpCodes.Sub_Ovf);
+ else
+ ig.Emit (OpCodes.Add_Ovf);
+ } else if (expr_type == TypeManager.uint32_type ||
+ expr_type == TypeManager.uint64_type){
+ if (mode == Mode.PostDecrement)
+ ig.Emit (OpCodes.Sub_Ovf_Un);
+ else
+ ig.Emit (OpCodes.Add_Ovf_Un);
+ } else {
+ if (mode == Mode.PostDecrement)
+ ig.Emit (OpCodes.Sub_Ovf);
+ else
+ ig.Emit (OpCodes.Add_Ovf);
+ }
+ } else {
+ if (mode == Mode.PostDecrement)
+ ig.Emit (OpCodes.Sub);
+ else
+ ig.Emit (OpCodes.Add);
+ }
+ } else {
+ method.Emit (ec);
+ }
+
+ temp_storage.Store (ec);
+ ia.EmitAssign (ec, temp_storage);
+ break;
+ }
+ }
- public enum Operator {
- Is, As
+ public override void Emit (EmitContext ec)
+ {
+ EmitCode (ec, true);
+
}
- public Probe (Operator oper, Expression expr, TypeRef typeref)
+ public override void EmitStatement (EmitContext ec)
{
- this.oper = oper;
- this.typeref = typeref;
- this.expr = expr;
+ EmitCode (ec, false);
}
- public Operator Oper {
- get {
- return oper;
- }
+ }
+
+ /// <summary>
+ /// Base class for the `Is' and `As' classes.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// FIXME: Split this in two, and we get to save the `Operator' Oper
+ /// size.
+ /// </remarks>
+ public abstract class Probe : Expression {
+ public readonly string ProbeType;
+ protected Expression expr;
+ protected Type probe_type;
+ protected Location loc;
+
+ public Probe (Expression expr, string probe_type, Location l)
+ {
+ ProbeType = probe_type;
+ loc = l;
+ this.expr = expr;
}
public Expression Expr {
@@ -120,27 +898,127 @@ namespace CIR {
}
}
- public Type ProbeType {
- get {
- return typeref.Type;
+ public override Expression DoResolve (EmitContext ec)
+ {
+ probe_type = RootContext.LookupType (ec.DeclSpace, ProbeType, false, loc);
+
+ if (probe_type == null)
+ return null;
+
+ expr = expr.Resolve (ec);
+
+ return this;
+ }
+ }
+
+ /// <summary>
+ /// Implementation of the `is' operator.
+ /// </summary>
+ public class Is : Probe {
+ public Is (Expression expr, string probe_type, Location l)
+ : base (expr, probe_type, l)
+ {
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+
+ expr.Emit (ec);
+
+ ig.Emit (OpCodes.Isinst, probe_type);
+ ig.Emit (OpCodes.Ldnull);
+ ig.Emit (OpCodes.Cgt_Un);
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ Expression e = base.DoResolve (ec);
+
+ if (e == null)
+ return null;
+
+ if (RootContext.WarningLevel >= 1){
+ Type etype = expr.Type;
+
+ if (etype == probe_type || etype.IsSubclassOf (probe_type)){
+ Report.Warning (
+ 183, loc,
+ "The expression is always of type `" +
+ TypeManager.CSharpName (probe_type) + "'");
+ } else if (etype != probe_type && !probe_type.IsSubclassOf (etype)){
+ if (!(probe_type.IsInterface || expr.Type.IsInterface))
+ Report.Warning (
+ 184, loc,
+ "The expression is never of type `" +
+ TypeManager.CSharpName (probe_type) + "'");
+ }
}
+
+ type = TypeManager.bool_type;
+ eclass = ExprClass.Value;
+
+ return this;
+ }
+ }
+
+ /// <summary>
+ /// Implementation of the `as' operator.
+ /// </summary>
+ public class As : Probe {
+ public As (Expression expr, string probe_type, Location l)
+ : base (expr, probe_type, l)
+ {
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+
+ Type etype = expr.Type;
+
+ expr.Emit (ec);
+ if (etype == probe_type || etype.IsSubclassOf (probe_type))
+ return;
+
+ ig.Emit (OpCodes.Isinst, probe_type);
}
-
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ Expression e = base.DoResolve (ec);
+
+ if (e == null)
+ return null;
+
+ type = probe_type;
+ eclass = ExprClass.Value;
+
+ return this;
+ }
}
+ /// <summary>
+ /// This represents a typecast in the source language.
+ ///
+ /// FIXME: Cast expressions have an unusual set of parsing
+ /// rules, we need to figure those out.
+ /// </summary>
public class Cast : Expression {
- TypeRef typeref;
+ Expression target_type;
Expression expr;
-
- public Cast (TypeRef typeref, Expression expr)
+ Location loc;
+
+ public Cast (Expression cast_type, Expression expr, Location loc)
{
- this.typeref = typeref;
+ this.target_type = cast_type;
this.expr = expr;
+ this.loc = loc;
}
- public Type TargetType {
+ public Expression TargetType {
get {
- return typeref.Type;
+ return target_type;
}
}
@@ -152,30 +1030,342 @@ namespace CIR {
expr = value;
}
}
+
+ /// <summary>
+ /// Attempts to do a compile-time folding of a constant cast.
+ /// </summary>
+ Expression TryReduce (EmitContext ec, Type target_type)
+ {
+ if (expr is ByteConstant){
+ byte v = ((ByteConstant) expr).Value;
+
+ if (target_type == TypeManager.sbyte_type)
+ return new SByteConstant ((sbyte) v);
+ if (target_type == TypeManager.short_type)
+ return new ShortConstant ((short) v);
+ if (target_type == TypeManager.ushort_type)
+ return new UShortConstant ((ushort) v);
+ if (target_type == TypeManager.int32_type)
+ return new IntConstant ((int) v);
+ if (target_type == TypeManager.uint32_type)
+ return new UIntConstant ((uint) v);
+ if (target_type == TypeManager.int64_type)
+ return new LongConstant ((long) v);
+ if (target_type == TypeManager.uint64_type)
+ return new ULongConstant ((ulong) v);
+ if (target_type == TypeManager.float_type)
+ return new FloatConstant ((float) v);
+ if (target_type == TypeManager.double_type)
+ return new DoubleConstant ((double) v);
+ }
+ if (expr is SByteConstant){
+ sbyte v = ((SByteConstant) expr).Value;
+
+ if (target_type == TypeManager.byte_type)
+ return new ByteConstant ((byte) v);
+ if (target_type == TypeManager.short_type)
+ return new ShortConstant ((short) v);
+ if (target_type == TypeManager.ushort_type)
+ return new UShortConstant ((ushort) v);
+ if (target_type == TypeManager.int32_type)
+ return new IntConstant ((int) v);
+ if (target_type == TypeManager.uint32_type)
+ return new UIntConstant ((uint) v);
+ if (target_type == TypeManager.int64_type)
+ return new LongConstant ((long) v);
+ if (target_type == TypeManager.uint64_type)
+ return new ULongConstant ((ulong) v);
+ if (target_type == TypeManager.float_type)
+ return new FloatConstant ((float) v);
+ if (target_type == TypeManager.double_type)
+ return new DoubleConstant ((double) v);
+ }
+ if (expr is ShortConstant){
+ short v = ((ShortConstant) expr).Value;
+
+ if (target_type == TypeManager.byte_type)
+ return new ByteConstant ((byte) v);
+ if (target_type == TypeManager.sbyte_type)
+ return new SByteConstant ((sbyte) v);
+ if (target_type == TypeManager.ushort_type)
+ return new UShortConstant ((ushort) v);
+ if (target_type == TypeManager.int32_type)
+ return new IntConstant ((int) v);
+ if (target_type == TypeManager.uint32_type)
+ return new UIntConstant ((uint) v);
+ if (target_type == TypeManager.int64_type)
+ return new LongConstant ((long) v);
+ if (target_type == TypeManager.uint64_type)
+ return new ULongConstant ((ulong) v);
+ if (target_type == TypeManager.float_type)
+ return new FloatConstant ((float) v);
+ if (target_type == TypeManager.double_type)
+ return new DoubleConstant ((double) v);
+ }
+ if (expr is UShortConstant){
+ ushort v = ((UShortConstant) expr).Value;
+
+ if (target_type == TypeManager.byte_type)
+ return new ByteConstant ((byte) v);
+ if (target_type == TypeManager.sbyte_type)
+ return new SByteConstant ((sbyte) v);
+ if (target_type == TypeManager.short_type)
+ return new ShortConstant ((short) v);
+ if (target_type == TypeManager.int32_type)
+ return new IntConstant ((int) v);
+ if (target_type == TypeManager.uint32_type)
+ return new UIntConstant ((uint) v);
+ if (target_type == TypeManager.int64_type)
+ return new LongConstant ((long) v);
+ if (target_type == TypeManager.uint64_type)
+ return new ULongConstant ((ulong) v);
+ if (target_type == TypeManager.float_type)
+ return new FloatConstant ((float) v);
+ if (target_type == TypeManager.double_type)
+ return new DoubleConstant ((double) v);
+ }
+ if (expr is IntConstant){
+ int v = ((IntConstant) expr).Value;
+
+ if (target_type == TypeManager.byte_type)
+ return new ByteConstant ((byte) v);
+ if (target_type == TypeManager.sbyte_type)
+ return new SByteConstant ((sbyte) v);
+ if (target_type == TypeManager.short_type)
+ return new ShortConstant ((short) v);
+ if (target_type == TypeManager.ushort_type)
+ return new UShortConstant ((ushort) v);
+ if (target_type == TypeManager.uint32_type)
+ return new UIntConstant ((uint) v);
+ if (target_type == TypeManager.int64_type)
+ return new LongConstant ((long) v);
+ if (target_type == TypeManager.uint64_type)
+ return new ULongConstant ((ulong) v);
+ if (target_type == TypeManager.float_type)
+ return new FloatConstant ((float) v);
+ if (target_type == TypeManager.double_type)
+ return new DoubleConstant ((double) v);
+ }
+ if (expr is UIntConstant){
+ uint v = ((UIntConstant) expr).Value;
+
+ if (target_type == TypeManager.byte_type)
+ return new ByteConstant ((byte) v);
+ if (target_type == TypeManager.sbyte_type)
+ return new SByteConstant ((sbyte) v);
+ if (target_type == TypeManager.short_type)
+ return new ShortConstant ((short) v);
+ if (target_type == TypeManager.ushort_type)
+ return new UShortConstant ((ushort) v);
+ if (target_type == TypeManager.int32_type)
+ return new IntConstant ((int) v);
+ if (target_type == TypeManager.int64_type)
+ return new LongConstant ((long) v);
+ if (target_type == TypeManager.uint64_type)
+ return new ULongConstant ((ulong) v);
+ if (target_type == TypeManager.float_type)
+ return new FloatConstant ((float) v);
+ if (target_type == TypeManager.double_type)
+ return new DoubleConstant ((double) v);
+ }
+ if (expr is LongConstant){
+ long v = ((LongConstant) expr).Value;
+
+ if (target_type == TypeManager.byte_type)
+ return new ByteConstant ((byte) v);
+ if (target_type == TypeManager.sbyte_type)
+ return new SByteConstant ((sbyte) v);
+ if (target_type == TypeManager.short_type)
+ return new ShortConstant ((short) v);
+ if (target_type == TypeManager.ushort_type)
+ return new UShortConstant ((ushort) v);
+ if (target_type == TypeManager.int32_type)
+ return new IntConstant ((int) v);
+ if (target_type == TypeManager.uint32_type)
+ return new UIntConstant ((uint) v);
+ if (target_type == TypeManager.uint64_type)
+ return new ULongConstant ((ulong) v);
+ if (target_type == TypeManager.float_type)
+ return new FloatConstant ((float) v);
+ if (target_type == TypeManager.double_type)
+ return new DoubleConstant ((double) v);
+ }
+ if (expr is ULongConstant){
+ ulong v = ((ULongConstant) expr).Value;
+
+ if (target_type == TypeManager.byte_type)
+ return new ByteConstant ((byte) v);
+ if (target_type == TypeManager.sbyte_type)
+ return new SByteConstant ((sbyte) v);
+ if (target_type == TypeManager.short_type)
+ return new ShortConstant ((short) v);
+ if (target_type == TypeManager.ushort_type)
+ return new UShortConstant ((ushort) v);
+ if (target_type == TypeManager.int32_type)
+ return new IntConstant ((int) v);
+ if (target_type == TypeManager.uint32_type)
+ return new UIntConstant ((uint) v);
+ if (target_type == TypeManager.int64_type)
+ return new LongConstant ((long) v);
+ if (target_type == TypeManager.float_type)
+ return new FloatConstant ((float) v);
+ if (target_type == TypeManager.double_type)
+ return new DoubleConstant ((double) v);
+ }
+ if (expr is FloatConstant){
+ float v = ((FloatConstant) expr).Value;
+
+ if (target_type == TypeManager.byte_type)
+ return new ByteConstant ((byte) v);
+ if (target_type == TypeManager.sbyte_type)
+ return new SByteConstant ((sbyte) v);
+ if (target_type == TypeManager.short_type)
+ return new ShortConstant ((short) v);
+ if (target_type == TypeManager.ushort_type)
+ return new UShortConstant ((ushort) v);
+ if (target_type == TypeManager.int32_type)
+ return new IntConstant ((int) v);
+ if (target_type == TypeManager.uint32_type)
+ return new UIntConstant ((uint) v);
+ if (target_type == TypeManager.int64_type)
+ return new LongConstant ((long) v);
+ if (target_type == TypeManager.uint64_type)
+ return new ULongConstant ((ulong) v);
+ if (target_type == TypeManager.double_type)
+ return new DoubleConstant ((double) v);
+ }
+ if (expr is DoubleConstant){
+ double v = ((DoubleConstant) expr).Value;
+
+ if (target_type == TypeManager.byte_type)
+ return new ByteConstant ((byte) v);
+ if (target_type == TypeManager.sbyte_type)
+ return new SByteConstant ((sbyte) v);
+ if (target_type == TypeManager.short_type)
+ return new ShortConstant ((short) v);
+ if (target_type == TypeManager.ushort_type)
+ return new UShortConstant ((ushort) v);
+ if (target_type == TypeManager.int32_type)
+ return new IntConstant ((int) v);
+ if (target_type == TypeManager.uint32_type)
+ return new UIntConstant ((uint) v);
+ if (target_type == TypeManager.int64_type)
+ return new LongConstant ((long) v);
+ if (target_type == TypeManager.uint64_type)
+ return new ULongConstant ((ulong) v);
+ if (target_type == TypeManager.float_type)
+ return new FloatConstant ((float) v);
+ }
+
+ return null;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ expr = expr.Resolve (ec);
+ if (expr == null)
+ return null;
+
+ bool old_state = ec.OnlyLookupTypes;
+ ec.OnlyLookupTypes = true;
+ target_type = target_type.Resolve (ec);
+ ec.OnlyLookupTypes = old_state;
+
+ if (target_type == null){
+ Report.Error (-10, loc, "Can not resolve type");
+ return null;
+ }
+
+ if (target_type.eclass != ExprClass.Type){
+ report118 (loc, target_type, "class");
+ return null;
+ }
+
+ type = target_type.Type;
+ eclass = ExprClass.Value;
+
+ if (type == null)
+ return null;
+
+ if (expr is Constant){
+ Expression e = TryReduce (ec, type);
+
+ if (e != null)
+ return e;
+ }
+
+ expr = ConvertExplicit (ec, expr, type, loc);
+ return expr;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ //
+ // This one will never happen
+ //
+ throw new Exception ("Should not happen");
+ }
}
+ /// <summary>
+ /// Binary operators
+ /// </summary>
public class Binary : Expression {
- public enum Operator {
- Multiply, Divide, Modulo,
- Add, Substract,
- ShiftLeft, ShiftRight,
- LessThan, GreatherThan, LessOrEqual, GreatherOrEqual,
- Equal, NotEqual,
+ public enum Operator : byte {
+ Multiply, Division, Modulus,
+ Addition, Subtraction,
+ LeftShift, RightShift,
+ LessThan, GreaterThan, LessThanOrEqual, GreaterThanOrEqual,
+ Equality, Inequality,
BitwiseAnd,
ExclusiveOr,
BitwiseOr,
LogicalAnd,
- LogicalOr
+ LogicalOr,
+ TOP
}
Operator oper;
Expression left, right;
-
- public Binary (Operator oper, Expression left, Expression right)
+ MethodBase method;
+ ArrayList Arguments;
+ Location loc;
+
+ bool DelegateOperation;
+
+ // This must be kept in sync with Operator!!!
+ static string [] oper_names;
+
+ static Binary ()
+ {
+ oper_names = new string [(int) Operator.TOP];
+
+ oper_names [(int) Operator.Multiply] = "op_Multiply";
+ oper_names [(int) Operator.Division] = "op_Division";
+ oper_names [(int) Operator.Modulus] = "op_Modulus";
+ oper_names [(int) Operator.Addition] = "op_Addition";
+ oper_names [(int) Operator.Subtraction] = "op_Subtraction";
+ oper_names [(int) Operator.LeftShift] = "op_LeftShift";
+ oper_names [(int) Operator.RightShift] = "op_RightShift";
+ oper_names [(int) Operator.LessThan] = "op_LessThan";
+ oper_names [(int) Operator.GreaterThan] = "op_GreaterThan";
+ oper_names [(int) Operator.LessThanOrEqual] = "op_LessThanOrEqual";
+ oper_names [(int) Operator.GreaterThanOrEqual] = "op_GreaterThanOrEqual";
+ oper_names [(int) Operator.Equality] = "op_Equality";
+ oper_names [(int) Operator.Inequality] = "op_Inequality";
+ oper_names [(int) Operator.BitwiseAnd] = "op_BitwiseAnd";
+ oper_names [(int) Operator.BitwiseOr] = "op_BitwiseOr";
+ oper_names [(int) Operator.ExclusiveOr] = "op_ExclusiveOr";
+ oper_names [(int) Operator.LogicalOr] = "op_LogicalOr";
+ oper_names [(int) Operator.LogicalAnd] = "op_LogicalAnd";
+ }
+
+ public Binary (Operator oper, Expression left, Expression right, Location loc)
{
this.oper = oper;
this.left = left;
this.right = right;
+ this.loc = loc;
}
public Operator Oper {
@@ -204,16 +1394,1025 @@ namespace CIR {
right = value;
}
}
+
+
+ /// <summary>
+ /// Returns a stringified representation of the Operator
+ /// </summary>
+ static string OperName (Operator oper)
+ {
+ switch (oper){
+ case Operator.Multiply:
+ return "*";
+ case Operator.Division:
+ return "/";
+ case Operator.Modulus:
+ return "%";
+ case Operator.Addition:
+ return "+";
+ case Operator.Subtraction:
+ return "-";
+ case Operator.LeftShift:
+ return "<<";
+ case Operator.RightShift:
+ return ">>";
+ case Operator.LessThan:
+ return "<";
+ case Operator.GreaterThan:
+ return ">";
+ case Operator.LessThanOrEqual:
+ return "<=";
+ case Operator.GreaterThanOrEqual:
+ return ">=";
+ case Operator.Equality:
+ return "==";
+ case Operator.Inequality:
+ return "!=";
+ case Operator.BitwiseAnd:
+ return "&";
+ case Operator.BitwiseOr:
+ return "|";
+ case Operator.ExclusiveOr:
+ return "^";
+ case Operator.LogicalOr:
+ return "||";
+ case Operator.LogicalAnd:
+ return "&&";
+ }
+
+ return oper.ToString ();
+ }
+
+ public override string ToString ()
+ {
+ return "operator " + OperName (oper) + "(" + left.ToString () + ", " +
+ right.ToString () + ")";
+ }
+
+ Expression ForceConversion (EmitContext ec, Expression expr, Type target_type)
+ {
+ if (expr.Type == target_type)
+ return expr;
+
+ return ConvertImplicit (ec, expr, target_type, new Location (-1));
+ }
+
+ public static void Error_OperatorAmbiguous (Location loc, Operator oper, Type l, Type r)
+ {
+ Report.Error (
+ 34, loc, "Operator `" + OperName (oper)
+ + "' is ambiguous on operands of type `"
+ + TypeManager.CSharpName (l) + "' "
+ + "and `" + TypeManager.CSharpName (r)
+ + "'");
+ }
+
+ //
+ // Note that handling the case l == Decimal || r == Decimal
+ // is taken care of by the Step 1 Operator Overload resolution.
+ //
+ bool DoNumericPromotions (EmitContext ec, Type l, Type r)
+ {
+ if (l == TypeManager.double_type || r == TypeManager.double_type){
+ //
+ // If either operand is of type double, the other operand is
+ // conveted to type double.
+ //
+ if (r != TypeManager.double_type)
+ right = ConvertImplicit (ec, right, TypeManager.double_type, loc);
+ if (l != TypeManager.double_type)
+ left = ConvertImplicit (ec, left, TypeManager.double_type, loc);
+
+ type = TypeManager.double_type;
+ } else if (l == TypeManager.float_type || r == TypeManager.float_type){
+ //
+ // if either operand is of type float, the other operand is
+ // converted to type float.
+ //
+ if (r != TypeManager.double_type)
+ right = ConvertImplicit (ec, right, TypeManager.float_type, loc);
+ if (l != TypeManager.double_type)
+ left = ConvertImplicit (ec, left, TypeManager.float_type, loc);
+ type = TypeManager.float_type;
+ } else if (l == TypeManager.uint64_type || r == TypeManager.uint64_type){
+ Expression e;
+ Type other;
+ //
+ // If either operand is of type ulong, the other operand is
+ // converted to type ulong. or an error ocurrs if the other
+ // operand is of type sbyte, short, int or long
+ //
+ if (l == TypeManager.uint64_type){
+ if (r != TypeManager.uint64_type){
+ if (right is IntConstant){
+ IntConstant ic = (IntConstant) right;
+
+ e = TryImplicitIntConversion (l, ic);
+ if (e != null)
+ right = e;
+ } else if (right is LongConstant){
+ long ll = ((LongConstant) right).Value;
+
+ if (ll > 0)
+ right = new ULongConstant ((ulong) ll);
+ } else {
+ e = ImplicitNumericConversion (ec, right, l, loc);
+ if (e != null)
+ right = e;
+ }
+ }
+ other = right.Type;
+ } else {
+ if (left is IntConstant){
+ e = TryImplicitIntConversion (r, (IntConstant) left);
+ if (e != null)
+ left = e;
+ } else if (left is LongConstant){
+ long ll = ((LongConstant) left).Value;
+
+ if (ll > 0)
+ left = new ULongConstant ((ulong) ll);
+ } else {
+ e = ImplicitNumericConversion (ec, left, r, loc);
+ if (e != null)
+ left = e;
+ }
+ other = left.Type;
+ }
+
+ if ((other == TypeManager.sbyte_type) ||
+ (other == TypeManager.short_type) ||
+ (other == TypeManager.int32_type) ||
+ (other == TypeManager.int64_type))
+ Error_OperatorAmbiguous (loc, oper, l, r);
+ type = TypeManager.uint64_type;
+ } else if (l == TypeManager.int64_type || r == TypeManager.int64_type){
+ //
+ // If either operand is of type long, the other operand is converted
+ // to type long.
+ //
+ if (l != TypeManager.int64_type)
+ left = ConvertImplicit (ec, left, TypeManager.int64_type, loc);
+ if (r != TypeManager.int64_type)
+ right = ConvertImplicit (ec, right, TypeManager.int64_type, loc);
+
+ type = TypeManager.int64_type;
+ } else if (l == TypeManager.uint32_type || r == TypeManager.uint32_type){
+ //
+ // 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.
+ //
+ Type other = null;
+
+ if (l == TypeManager.uint32_type){
+ if (right is IntConstant){
+ IntConstant ic = (IntConstant) right;
+ int val = ic.Value;
+
+ if (val >= 0)
+ right = new UIntConstant ((uint) val);
+
+ type = l;
+ return true;
+ }
+ other = r;
+ }
+ else if (r == TypeManager.uint32_type){
+ if (left is IntConstant){
+ IntConstant ic = (IntConstant) left;
+ int val = ic.Value;
+
+ if (val >= 0)
+ left = new UIntConstant ((uint) val);
+
+ type = r;
+ return true;
+ }
+
+ other = l;
+ }
+
+ if ((other == TypeManager.sbyte_type) ||
+ (other == TypeManager.short_type) ||
+ (other == TypeManager.int32_type)){
+ left = ForceConversion (ec, left, TypeManager.int64_type);
+ right = ForceConversion (ec, right, TypeManager.int64_type);
+ type = TypeManager.int64_type;
+ } else {
+ //
+ // if either operand is of type uint, the other
+ // operand is converd to type uint
+ //
+ left = ForceConversion (ec, left, TypeManager.uint32_type);
+ right = ForceConversion (ec, right, TypeManager.uint32_type);
+ type = TypeManager.uint32_type;
+ }
+ } else if (l == TypeManager.decimal_type || r == TypeManager.decimal_type){
+ if (l != TypeManager.decimal_type)
+ left = ConvertImplicit (ec, left, TypeManager.decimal_type, loc);
+ if (r != TypeManager.decimal_type)
+ right = ConvertImplicit (ec, right, TypeManager.decimal_type, loc);
+
+ type = TypeManager.decimal_type;
+ } else {
+ Expression l_tmp, r_tmp;
+
+ l_tmp = ForceConversion (ec, left, TypeManager.int32_type);
+ if (l_tmp == null)
+ return false;
+
+ r_tmp = ForceConversion (ec, right, TypeManager.int32_type);
+ if (r_tmp == null)
+ return false;
+
+ left = l_tmp;
+ right = r_tmp;
+
+ type = TypeManager.int32_type;
+ }
+
+ return true;
+ }
+
+ static public void Error_OperatorCannotBeApplied (Location loc, string name, Type l, Type r)
+ {
+ Error (19, loc,
+ "Operator " + name + " cannot be applied to operands of type `" +
+ TypeManager.CSharpName (l) + "' and `" +
+ TypeManager.CSharpName (r) + "'");
+ }
+
+ void error19 ()
+ {
+ Error_OperatorCannotBeApplied (loc, OperName (oper), left.Type, right.Type);
+ }
+
+ static bool is_32_or_64 (Type t)
+ {
+ return (t == TypeManager.int32_type || t == TypeManager.uint32_type ||
+ t == TypeManager.int64_type || t == TypeManager.uint64_type);
+ }
+
+ Expression CheckShiftArguments (EmitContext ec)
+ {
+ Expression e;
+ Type l = left.Type;
+ Type r = right.Type;
+
+ e = ForceConversion (ec, right, TypeManager.int32_type);
+ if (e == null){
+ error19 ();
+ return null;
+ }
+ right = e;
+
+ if (((e = ConvertImplicit (ec, left, TypeManager.int32_type, loc)) != null) ||
+ ((e = ConvertImplicit (ec, left, TypeManager.uint32_type, loc)) != null) ||
+ ((e = ConvertImplicit (ec, left, TypeManager.int64_type, loc)) != null) ||
+ ((e = ConvertImplicit (ec, left, TypeManager.uint64_type, loc)) != null)){
+ left = e;
+ type = e.Type;
+
+ return this;
+ }
+ error19 ();
+ return null;
+ }
+
+ Expression ResolveOperator (EmitContext ec)
+ {
+ Type l = left.Type;
+ Type r = right.Type;
+
+ //
+ // Step 1: Perform Operator Overload location
+ //
+ Expression left_expr, right_expr;
+
+ string op = oper_names [(int) oper];
+
+ MethodGroupExpr union;
+ left_expr = MemberLookup (ec, l, op, MemberTypes.Method, AllBindingFlags, loc);
+ if (r != l){
+ right_expr = MemberLookup (
+ ec, r, op, MemberTypes.Method, AllBindingFlags, loc);
+ union = Invocation.MakeUnionSet (left_expr, right_expr, loc);
+ } else
+ union = (MethodGroupExpr) left_expr;
+
+ if (union != null) {
+ Arguments = new ArrayList ();
+ Arguments.Add (new Argument (left, Argument.AType.Expression));
+ Arguments.Add (new Argument (right, Argument.AType.Expression));
+
+ method = Invocation.OverloadResolve (ec, union, Arguments, loc);
+ if (method != null) {
+ MethodInfo mi = (MethodInfo) method;
+
+ type = mi.ReturnType;
+ return this;
+ } else {
+ error19 ();
+ return null;
+ }
+ }
+
+ //
+ // Step 2: Default operations on CLI native types.
+ //
+
+ // Only perform numeric promotions on:
+ // +, -, *, /, %, &, |, ^, ==, !=, <, >, <=, >=
+ //
+ if (oper == Operator.Addition){
+ //
+ // If any of the arguments is a string, cast to string
+ //
+
+ if (l == TypeManager.string_type){
+
+ if (r == TypeManager.void_type) {
+ error19 ();
+ return null;
+ }
+
+ if (r == TypeManager.string_type){
+ if (left is Constant && right is Constant){
+ StringConstant ls = (StringConstant) left;
+ StringConstant rs = (StringConstant) right;
+
+ return new StringConstant (
+ ls.Value + rs.Value);
+ }
+
+ // string + string
+ method = TypeManager.string_concat_string_string;
+ } else {
+ // string + object
+ method = TypeManager.string_concat_object_object;
+ right = ConvertImplicit (ec, right,
+ TypeManager.object_type, loc);
+ }
+ type = TypeManager.string_type;
+
+ Arguments = new ArrayList ();
+ Arguments.Add (new Argument (left, Argument.AType.Expression));
+ Arguments.Add (new Argument (right, Argument.AType.Expression));
+
+ return this;
+
+ } else if (r == TypeManager.string_type){
+ // object + string
+
+ if (l == TypeManager.void_type) {
+ error19 ();
+ return null;
+ }
+
+ method = TypeManager.string_concat_object_object;
+ left = ConvertImplicit (ec, left, TypeManager.object_type, loc);
+ Arguments = new ArrayList ();
+ Arguments.Add (new Argument (left, Argument.AType.Expression));
+ Arguments.Add (new Argument (right, Argument.AType.Expression));
+
+ type = TypeManager.string_type;
+
+ return this;
+ }
+
+ //
+ // Transform a + ( - b) into a - b
+ //
+ if (right is Unary){
+ Unary right_unary = (Unary) right;
+
+ if (right_unary.Oper == Unary.Operator.UnaryNegation){
+ oper = Operator.Subtraction;
+ right = right_unary.Expr;
+ r = right.Type;
+ }
+ }
+ }
+
+ if (oper == Operator.Addition || oper == Operator.Subtraction) {
+ if (l.IsSubclassOf (TypeManager.delegate_type) &&
+ r.IsSubclassOf (TypeManager.delegate_type)) {
+
+ Arguments = new ArrayList ();
+ Arguments.Add (new Argument (left, Argument.AType.Expression));
+ Arguments.Add (new Argument (right, Argument.AType.Expression));
+
+ if (oper == Operator.Addition)
+ method = TypeManager.delegate_combine_delegate_delegate;
+ else
+ method = TypeManager.delegate_remove_delegate_delegate;
+
+ DelegateOperation = true;
+ type = l;
+ return this;
+ }
+
+ //
+ // Pointer arithmetic:
+ //
+ // T* operator + (T* x, int y);
+ // T* operator + (T* x, uint y);
+ // T* operator + (T* x, long y);
+ // T* operator + (T* x, ulong y);
+ //
+ // T* operator + (int y, T* x);
+ // T* operator + (uint y, T *x);
+ // T* operator + (long y, T *x);
+ // T* operator + (ulong y, T *x);
+ //
+ // T* operator - (T* x, int y);
+ // T* operator - (T* x, uint y);
+ // T* operator - (T* x, long y);
+ // T* operator - (T* x, ulong y);
+ //
+ // long operator - (T* x, T *y)
+ //
+ if (l.IsPointer){
+ if (r.IsPointer && oper == Operator.Subtraction){
+ if (r == l)
+ return new PointerArithmetic (
+ false, left, right, TypeManager.int64_type);
+ } else if (is_32_or_64 (r))
+ return new PointerArithmetic (
+ oper == Operator.Addition, left, right, l);
+ } else if (r.IsPointer && is_32_or_64 (l) && oper == Operator.Addition)
+ return new PointerArithmetic (
+ true, right, left, r);
+ }
+
+ //
+ // Enumeration operators
+ //
+ bool lie = TypeManager.IsEnumType (l);
+ bool rie = TypeManager.IsEnumType (r);
+ if (lie || rie){
+ Expression temp;
+
+ //
+ // operator + (E e, U x)
+ //
+ if (oper == Operator.Addition){
+ if (lie && rie){
+ error19 ();
+ return null;
+ }
+
+ Type enum_type = lie ? l : r;
+ Type other_type = lie ? r : l;
+ Type underlying_type = TypeManager.EnumToUnderlying (enum_type);
+;
+
+ if (underlying_type != other_type){
+ error19 ();
+ return null;
+ }
+
+ type = enum_type;
+ return this;
+ }
+
+ if (!rie){
+ temp = ConvertImplicit (ec, right, l, loc);
+ if (temp != null)
+ right = temp;
+ } if (!lie){
+ temp = ConvertImplicit (ec, left, r, loc);
+ if (temp != null){
+ left = temp;
+ l = r;
+ }
+ }
+
+ if (oper == Operator.Equality || oper == Operator.Inequality ||
+ oper == Operator.LessThanOrEqual || oper == Operator.LessThan ||
+ oper == Operator.GreaterThanOrEqual || oper == Operator.GreaterThan){
+ type = TypeManager.bool_type;
+ return this;
+ }
+
+ if (oper == Operator.BitwiseAnd ||
+ oper == Operator.BitwiseOr ||
+ oper == Operator.ExclusiveOr){
+ type = l;
+ return this;
+ }
+ return null;
+ }
+
+ if (oper == Operator.LeftShift || oper == Operator.RightShift)
+ return CheckShiftArguments (ec);
+
+ if (oper == Operator.LogicalOr || oper == Operator.LogicalAnd){
+ if (l != TypeManager.bool_type || r != TypeManager.bool_type){
+ error19 ();
+ return null;
+ }
+
+ type = TypeManager.bool_type;
+ return this;
+ }
+
+ if (oper == Operator.Equality || oper == Operator.Inequality){
+ if (l == TypeManager.bool_type || r == TypeManager.bool_type){
+ if (r != TypeManager.bool_type || l != TypeManager.bool_type){
+ error19 ();
+ return null;
+ }
+
+ type = TypeManager.bool_type;
+ return this;
+ }
+
+ //
+ // operator != (object a, object b)
+ // operator == (object a, object b)
+ //
+ // For this to be used, both arguments have to be reference-types.
+ // Read the rationale on the spec (14.9.6)
+ //
+ // Also, if at compile time we know that the classes do not inherit
+ // one from the other, then we catch the error there.
+ //
+ if (!(l.IsValueType || r.IsValueType)){
+ type = TypeManager.bool_type;
+
+ if (l == r)
+ return this;
+
+ if (l.IsSubclassOf (r) || r.IsSubclassOf (l))
+ return this;
+
+ //
+ // We are going to have to convert to an object to compare
+ //
+ if (l != TypeManager.object_type)
+ left = new EmptyCast (left, TypeManager.object_type);
+ if (r != TypeManager.object_type)
+ right = new EmptyCast (right, TypeManager.object_type);
+
+ return this;
+ }
+ }
+
+ //
+ // operator & (bool x, bool y)
+ // operator | (bool x, bool y)
+ // operator ^ (bool x, bool y)
+ //
+ if (l == TypeManager.bool_type && r == TypeManager.bool_type){
+ if (oper == Operator.BitwiseAnd ||
+ oper == Operator.BitwiseOr ||
+ oper == Operator.ExclusiveOr){
+ type = l;
+ return this;
+ }
+ }
+
+ //
+ // Pointer comparison
+ //
+ if (l.IsPointer && r.IsPointer){
+ if (oper == Operator.Equality || oper == Operator.Inequality ||
+ oper == Operator.LessThan || oper == Operator.LessThanOrEqual ||
+ oper == Operator.GreaterThan || oper == Operator.GreaterThanOrEqual){
+ type = TypeManager.bool_type;
+ return this;
+ }
+ }
+
+ //
+ // We are dealing with numbers
+ //
+ if (!DoNumericPromotions (ec, l, r)){
+ error19 ();
+ return null;
+ }
+
+ if (left == null || right == null)
+ return null;
+
+ //
+ // reload our cached types if required
+ //
+ l = left.Type;
+ r = right.Type;
+
+ if (oper == Operator.BitwiseAnd ||
+ oper == Operator.BitwiseOr ||
+ oper == Operator.ExclusiveOr){
+ if (l == r){
+ if (!((l == TypeManager.int32_type) ||
+ (l == TypeManager.uint32_type) ||
+ (l == TypeManager.int64_type) ||
+ (l == TypeManager.uint64_type)))
+ type = l;
+ } else {
+ error19 ();
+ return null;
+ }
+ }
+
+ if (oper == Operator.Equality ||
+ oper == Operator.Inequality ||
+ oper == Operator.LessThanOrEqual ||
+ oper == Operator.LessThan ||
+ oper == Operator.GreaterThanOrEqual ||
+ oper == Operator.GreaterThan){
+ type = TypeManager.bool_type;
+ }
+
+ return this;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ left = left.Resolve (ec);
+ right = right.Resolve (ec);
+
+ if (left == null || right == null)
+ return null;
+
+ if (left.Type == null)
+ throw new Exception (
+ "Resolve returned non null, but did not set the type! (" +
+ left + ") at Line: " + loc.Row);
+ if (right.Type == null)
+ throw new Exception (
+ "Resolve returned non null, but did not set the type! (" +
+ right + ") at Line: "+ loc.Row);
+
+ eclass = ExprClass.Value;
+
+ if (left is Constant && right is Constant){
+ Expression e = ConstantFold.BinaryFold (
+ ec, oper, (Constant) left, (Constant) right, loc);
+ if (e != null)
+ return e;
+ }
+
+ return ResolveOperator (ec);
+ }
+
+ public bool IsBranchable ()
+ {
+ if (oper == Operator.Equality ||
+ oper == Operator.Inequality ||
+ oper == Operator.LessThan ||
+ oper == Operator.GreaterThan ||
+ oper == Operator.LessThanOrEqual ||
+ oper == Operator.GreaterThanOrEqual){
+ return true;
+ } else
+ return false;
+ }
+
+ /// <summary>
+ /// This entry point is used by routines that might want
+ /// to emit a brfalse/brtrue after an expression, and instead
+ /// they could use a more compact notation.
+ ///
+ /// Typically the code would generate l.emit/r.emit, followed
+ /// by the comparission and then a brtrue/brfalse. The comparissions
+ /// are sometimes inneficient (there are not as complete as the branches
+ /// look for the hacks in Emit using double ceqs).
+ ///
+ /// So for those cases we provide EmitBranchable that can emit the
+ /// branch with the test
+ /// </summary>
+ public void EmitBranchable (EmitContext ec, int target)
+ {
+ OpCode opcode;
+ bool close_target = false;
+ ILGenerator ig = ec.ig;
+
+ //
+ // short-circuit operators
+ //
+ if (oper == Operator.LogicalAnd){
+ left.Emit (ec);
+ ig.Emit (OpCodes.Brfalse, target);
+ right.Emit (ec);
+ ig.Emit (OpCodes.Brfalse, target);
+ } else if (oper == Operator.LogicalOr){
+ left.Emit (ec);
+ ig.Emit (OpCodes.Brtrue, target);
+ right.Emit (ec);
+ ig.Emit (OpCodes.Brfalse, target);
+ }
+
+ left.Emit (ec);
+ right.Emit (ec);
+
+ switch (oper){
+ case Operator.Equality:
+ if (close_target)
+ opcode = OpCodes.Beq_S;
+ else
+ opcode = OpCodes.Beq;
+ break;
+
+ case Operator.Inequality:
+ if (close_target)
+ opcode = OpCodes.Bne_Un_S;
+ else
+ opcode = OpCodes.Bne_Un;
+ break;
+
+ case Operator.LessThan:
+ if (close_target)
+ opcode = OpCodes.Blt_S;
+ else
+ opcode = OpCodes.Blt;
+ break;
+
+ case Operator.GreaterThan:
+ if (close_target)
+ opcode = OpCodes.Bgt_S;
+ else
+ opcode = OpCodes.Bgt;
+ break;
+
+ case Operator.LessThanOrEqual:
+ if (close_target)
+ opcode = OpCodes.Ble_S;
+ else
+ opcode = OpCodes.Ble;
+ break;
+
+ case Operator.GreaterThanOrEqual:
+ if (close_target)
+ opcode = OpCodes.Bge_S;
+ else
+ opcode = OpCodes.Ble;
+ break;
+
+ default:
+ throw new Exception ("EmitBranchable called on non-EmitBranchable operator: "
+ + oper.ToString ());
+ }
+
+ ig.Emit (opcode, target);
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ Type l = left.Type;
+ Type r = right.Type;
+ OpCode opcode;
+
+ if (method != null) {
+
+ // Note that operators are static anyway
+
+ if (Arguments != null)
+ Invocation.EmitArguments (ec, method, Arguments);
+
+ if (method is MethodInfo)
+ ig.Emit (OpCodes.Call, (MethodInfo) method);
+ else
+ ig.Emit (OpCodes.Call, (ConstructorInfo) method);
+
+ if (DelegateOperation)
+ ig.Emit (OpCodes.Castclass, type);
+
+ return;
+ }
+
+ //
+ // Handle short-circuit operators differently
+ // than the rest
+ //
+ if (oper == Operator.LogicalAnd){
+ Label load_zero = ig.DefineLabel ();
+ Label end = ig.DefineLabel ();
+
+ 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){
+ Label load_one = ig.DefineLabel ();
+ Label end = ig.DefineLabel ();
+
+ 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);
+ return;
+ }
+
+ left.Emit (ec);
+ right.Emit (ec);
+
+ switch (oper){
+ case Operator.Multiply:
+ if (ec.CheckState){
+ if (l == TypeManager.int32_type || l == TypeManager.int64_type)
+ opcode = OpCodes.Mul_Ovf;
+ else if (l==TypeManager.uint32_type || l==TypeManager.uint64_type)
+ opcode = OpCodes.Mul_Ovf_Un;
+ else
+ opcode = OpCodes.Mul;
+ } else
+ opcode = OpCodes.Mul;
+
+ break;
+
+ case Operator.Division:
+ if (l == TypeManager.uint32_type || l == TypeManager.uint64_type)
+ opcode = OpCodes.Div_Un;
+ else
+ opcode = OpCodes.Div;
+ break;
+
+ case Operator.Modulus:
+ if (l == TypeManager.uint32_type || l == TypeManager.uint64_type)
+ opcode = OpCodes.Rem_Un;
+ else
+ opcode = OpCodes.Rem;
+ break;
+
+ case Operator.Addition:
+ if (ec.CheckState){
+ if (l == TypeManager.int32_type || l == TypeManager.int64_type)
+ opcode = OpCodes.Add_Ovf;
+ else if (l==TypeManager.uint32_type || l==TypeManager.uint64_type)
+ opcode = OpCodes.Add_Ovf_Un;
+ else
+ opcode = OpCodes.Add;
+ } else
+ opcode = OpCodes.Add;
+ break;
+
+ case Operator.Subtraction:
+ if (ec.CheckState){
+ if (l == TypeManager.int32_type || l == TypeManager.int64_type)
+ opcode = OpCodes.Sub_Ovf;
+ else if (l==TypeManager.uint32_type || l==TypeManager.uint64_type)
+ opcode = OpCodes.Sub_Ovf_Un;
+ else
+ opcode = OpCodes.Sub;
+ } else
+ opcode = OpCodes.Sub;
+ break;
+
+ case Operator.RightShift:
+ opcode = OpCodes.Shr;
+ break;
+
+ case Operator.LeftShift:
+ opcode = OpCodes.Shl;
+ break;
+
+ case Operator.Equality:
+ opcode = OpCodes.Ceq;
+ break;
+
+ case Operator.Inequality:
+ ec.ig.Emit (OpCodes.Ceq);
+ ec.ig.Emit (OpCodes.Ldc_I4_0);
+
+ opcode = OpCodes.Ceq;
+ break;
+
+ case Operator.LessThan:
+ opcode = OpCodes.Clt;
+ break;
+
+ case Operator.GreaterThan:
+ opcode = OpCodes.Cgt;
+ break;
+
+ case Operator.LessThanOrEqual:
+ ec.ig.Emit (OpCodes.Cgt);
+ ec.ig.Emit (OpCodes.Ldc_I4_0);
+
+ opcode = OpCodes.Ceq;
+ break;
+
+ case Operator.GreaterThanOrEqual:
+ ec.ig.Emit (OpCodes.Clt);
+ ec.ig.Emit (OpCodes.Ldc_I4_1);
+
+ opcode = OpCodes.Sub;
+ break;
+
+ case Operator.BitwiseOr:
+ opcode = OpCodes.Or;
+ break;
+
+ case Operator.BitwiseAnd:
+ opcode = OpCodes.And;
+ break;
+
+ case Operator.ExclusiveOr:
+ opcode = OpCodes.Xor;
+ break;
+
+ default:
+ throw new Exception ("This should not happen: Operator = "
+ + oper.ToString ());
+ }
+
+ ig.Emit (opcode);
+ }
}
+ public class PointerArithmetic : Expression {
+ Expression left, right;
+ bool is_add;
+
+ //
+ // We assume that `l' is always a pointer
+ //
+ public PointerArithmetic (bool is_addition, Expression l, Expression r, Type t)
+ {
+ type = t;
+ eclass = ExprClass.Variable;
+ left = l;
+ right = r;
+ is_add = is_addition;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ //
+ // We are born fully resolved
+ //
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ Type op_type = left.Type;
+ ILGenerator ig = ec.ig;
+ int size = GetTypeSize (op_type.GetElementType ());
+
+ if (right.Type.IsPointer){
+ //
+ // handle (pointer - pointer)
+ //
+ left.Emit (ec);
+ right.Emit (ec);
+ ig.Emit (OpCodes.Sub);
+
+ if (size != 1){
+ if (size == 0)
+ ig.Emit (OpCodes.Sizeof, op_type);
+ else
+ IntLiteral.EmitInt (ig, size);
+ ig.Emit (OpCodes.Div);
+ }
+ ig.Emit (OpCodes.Conv_I8);
+ } else {
+ //
+ // handle + and - on (pointer op int)
+ //
+ left.Emit (ec);
+ ig.Emit (OpCodes.Conv_I);
+ right.Emit (ec);
+ if (size != 1){
+ if (size == 0)
+ ig.Emit (OpCodes.Sizeof, op_type);
+ else
+ IntLiteral.EmitInt (ig, size);
+ ig.Emit (OpCodes.Mul);
+ }
+ if (is_add)
+ ig.Emit (OpCodes.Add);
+ else
+ ig.Emit (OpCodes.Sub);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Implements the ternary conditiona operator (?:)
+ /// </summary>
public class Conditional : Expression {
Expression expr, trueExpr, falseExpr;
+ Location loc;
- public Conditional (Expression expr, Expression trueExpr, Expression falseExpr)
+ public Conditional (Expression expr, Expression trueExpr, Expression falseExpr, Location l)
{
this.expr = expr;
this.trueExpr = trueExpr;
this.falseExpr = falseExpr;
+ this.loc = l;
}
public Expression Expr {
@@ -233,102 +2432,446 @@ namespace CIR {
return falseExpr;
}
}
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ expr = expr.Resolve (ec);
+
+ if (expr.Type != TypeManager.bool_type)
+ expr = Expression.ConvertImplicitRequired (
+ ec, expr, TypeManager.bool_type, loc);
+
+ trueExpr = trueExpr.Resolve (ec);
+ falseExpr = falseExpr.Resolve (ec);
+
+ if (expr == null || trueExpr == null || falseExpr == null)
+ return null;
+
+ eclass = ExprClass.Value;
+ if (trueExpr.Type == falseExpr.Type)
+ type = trueExpr.Type;
+ else {
+ Expression conv;
+ Type true_type = trueExpr.Type;
+ Type false_type = falseExpr.Type;
+
+ if (trueExpr is NullLiteral){
+ type = false_type;
+ return this;
+ } else if (falseExpr is NullLiteral){
+ type = true_type;
+ return this;
+ }
+
+ //
+ // First, if an implicit conversion exists from trueExpr
+ // to falseExpr, then the result type is of type falseExpr.Type
+ //
+ conv = ConvertImplicit (ec, trueExpr, false_type, loc);
+ if (conv != null){
+ //
+ // Check if both can convert implicitl to each other's type
+ //
+ if (ConvertImplicit (ec, falseExpr, true_type, loc) != null){
+ Report.Error (
+ 172, loc,
+ "Can not compute type of conditional expression " +
+ "as `" + TypeManager.CSharpName (trueExpr.Type) +
+ "' and `" + TypeManager.CSharpName (falseExpr.Type) +
+ "' convert implicitly to each other");
+ return null;
+ }
+ type = false_type;
+ trueExpr = conv;
+ } else if ((conv = ConvertImplicit(ec, falseExpr, true_type,loc))!= null){
+ type = true_type;
+ falseExpr = conv;
+ } else {
+ Error (173, loc, "The type of the conditional expression can " +
+ "not be computed because there is no implicit conversion" +
+ " from `" + TypeManager.CSharpName (trueExpr.Type) + "'" +
+ " and `" + TypeManager.CSharpName (falseExpr.Type) + "'");
+ return null;
+ }
+ }
+
+ if (expr is BoolConstant){
+ BoolConstant bc = (BoolConstant) expr;
+
+ if (bc.Value)
+ return trueExpr;
+ else
+ return falseExpr;
+ }
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ Label false_target = ig.DefineLabel ();
+ Label end_target = ig.DefineLabel ();
+
+ expr.Emit (ec);
+ ig.Emit (OpCodes.Brfalse, false_target);
+ trueExpr.Emit (ec);
+ ig.Emit (OpCodes.Br, end_target);
+ ig.MarkLabel (false_target);
+ falseExpr.Emit (ec);
+ ig.MarkLabel (end_target);
+ }
+
}
- public class SimpleName : Expression {
- string name;
+ /// <summary>
+ /// Local variables
+ /// </summary>
+ public class LocalVariableReference : Expression, IAssignMethod, IMemoryLocation {
+ public readonly string Name;
+ public readonly Block Block;
+ Location loc;
+ VariableInfo variable_info;
- public SimpleName (string name)
+ public LocalVariableReference (Block block, string name, Location l)
{
- this.name = name;
+ Block = block;
+ Name = name;
+ loc = l;
+ eclass = ExprClass.Variable;
}
- public string Name {
+ public VariableInfo VariableInfo {
get {
- return name;
+ if (variable_info == null)
+ variable_info = Block.GetVariableInfo (Name);
+ return variable_info;
}
}
- }
-
- public class LocalVariableReference : Expression {
- string name;
- Block block;
- public LocalVariableReference (Block block, string name)
+ public override Expression DoResolve (EmitContext ec)
{
- this.block = block;
- this.name = name;
- }
+ VariableInfo vi = VariableInfo;
- public Block Block {
- get {
- return block;
+ if (Block.IsConstant (Name)) {
+ Expression e = Block.GetConstantExpression (Name);
+
+ vi.Used = true;
+ return e;
}
+
+ type = vi.VariableType;
+ return this;
}
- public string Name {
- get {
- return name;
+ override public Expression DoResolveLValue (EmitContext ec, Expression right_side)
+ {
+ Expression e = DoResolve (ec);
+
+ if (e == null)
+ return null;
+
+ VariableInfo vi = VariableInfo;
+
+ if (vi.ReadOnly){
+ if (vi.Assigned){
+ Report.Error (
+ 1604, loc,
+ "cannot assign to `" + Name + "' because it is readonly");
+ return null;
+ }
}
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ VariableInfo vi = VariableInfo;
+ ILGenerator ig = ec.ig;
+
+ ig.Emit (OpCodes.Ldloc, vi.LocalBuilder);
+ vi.Used = true;
+ }
+
+ public void EmitAssign (EmitContext ec, Expression source)
+ {
+ ILGenerator ig = ec.ig;
+ VariableInfo vi = VariableInfo;
+
+ vi.Assigned = true;
+
+ source.Emit (ec);
+
+ ig.Emit (OpCodes.Stloc, vi.LocalBuilder);
+ }
+
+ public void AddressOf (EmitContext ec, AddressOp mode)
+ {
+ VariableInfo vi = VariableInfo;
+
+ if ((mode & AddressOp.Load) != 0)
+ vi.Used = true;
+ if ((mode & AddressOp.Store) != 0)
+ vi.Assigned = true;
+
+ ec.ig.Emit (OpCodes.Ldloca, vi.LocalBuilder);
}
}
- public class ParameterReference : Expression {
+ /// <summary>
+ /// This represents a reference to a parameter in the intermediate
+ /// representation.
+ /// </summary>
+ public class ParameterReference : Expression, IAssignMethod, IMemoryLocation {
Parameters pars;
- string name;
+ String name;
+ int idx;
+ public bool is_ref;
- public ParameterReference (Parameters pars, string name)
+ public ParameterReference (Parameters pars, int idx, string name)
{
this.pars = pars;
+ this.idx = idx;
this.name = name;
+ eclass = ExprClass.Variable;
}
- public string Name {
- get {
- return name;
+ //
+ // Notice that for ref/out parameters, the type exposed is not the
+ // same type exposed externally.
+ //
+ // for "ref int a":
+ // externally we expose "int&"
+ // here we expose "int".
+ //
+ // We record this in "is_ref". This means that the type system can treat
+ // the type as it is expected, but when we generate the code, we generate
+ // the alternate kind of code.
+ //
+ public override Expression DoResolve (EmitContext ec)
+ {
+ type = pars.GetParameterInfo (ec.DeclSpace, idx, out is_ref);
+ eclass = ExprClass.Variable;
+
+ return this;
+ }
+
+ //
+ // This method is used by parameters that are references, that are
+ // being passed as references: we only want to pass the pointer (that
+ // is already stored in the parameter, not the address of the pointer,
+ // and not the value of the variable).
+ //
+ public void EmitLoad (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ int arg_idx = idx;
+
+ if (!ec.IsStatic)
+ arg_idx++;
+
+ if (arg_idx <= 255)
+ ig.Emit (OpCodes.Ldarg_S, (byte) arg_idx);
+ else
+ ig.Emit (OpCodes.Ldarg, arg_idx);
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ int arg_idx = idx;
+
+ if (!ec.IsStatic)
+ arg_idx++;
+
+ if (arg_idx <= 255)
+ ig.Emit (OpCodes.Ldarg_S, (byte) arg_idx);
+ else
+ ig.Emit (OpCodes.Ldarg, arg_idx);
+
+ if (!is_ref)
+ return;
+
+ //
+ // If we are a reference, we loaded on the stack a pointer
+ // Now lets load the real value
+ //
+ LoadFromPtr (ig, type, true);
+ }
+
+ public void EmitAssign (EmitContext ec, Expression source)
+ {
+ ILGenerator ig = ec.ig;
+ int arg_idx = idx;
+
+ if (!ec.IsStatic)
+ arg_idx++;
+
+ if (is_ref){
+ // Load the pointer
+ if (arg_idx <= 255)
+ ig.Emit (OpCodes.Ldarg_S, (byte) arg_idx);
+ else
+ ig.Emit (OpCodes.Ldarg, arg_idx);
+ }
+
+ source.Emit (ec);
+
+ if (is_ref)
+ StoreFromPtr (ig, type);
+ else {
+ if (arg_idx <= 255)
+ ig.Emit (OpCodes.Starg_S, (byte) arg_idx);
+ else
+ ig.Emit (OpCodes.Starg, arg_idx);
}
+
+ }
+
+ public void AddressOf (EmitContext ec, AddressOp mode)
+ {
+ int arg_idx = idx;
+
+ if (!ec.IsStatic)
+ arg_idx++;
+
+ if (arg_idx <= 255)
+ ec.ig.Emit (OpCodes.Ldarga_S, (byte) arg_idx);
+ else
+ ec.ig.Emit (OpCodes.Ldarga, arg_idx);
}
}
- // <summary>
- // Used for arguments to New(), Invocation()
- // </summary>
+ /// <summary>
+ /// Used for arguments to New(), Invocation()
+ /// </summary>
public class Argument {
- public enum AType {
+ public enum AType : byte {
Expression,
Ref,
Out
};
- AType type;
- Expression expr;
-
+ public readonly AType ArgType;
+ public Expression expr;
+
public Argument (Expression expr, AType type)
{
this.expr = expr;
- this.type = type;
+ this.ArgType = type;
}
public Expression Expr {
get {
return expr;
}
+
+ set {
+ expr = value;
+ }
}
- public AType Type {
+ public Type Type {
get {
- return type;
+ if (ArgType == AType.Ref || ArgType == AType.Out)
+ return Type.GetType (expr.Type.ToString () + "&");
+ else
+ return expr.Type;
+ }
+ }
+
+ public Parameter.Modifier GetParameterModifier ()
+ {
+ if (ArgType == AType.Ref || ArgType == AType.Out)
+ return Parameter.Modifier.OUT;
+
+ return Parameter.Modifier.NONE;
+ }
+
+ public static string FullDesc (Argument a)
+ {
+ return (a.ArgType == AType.Ref ? "ref " :
+ (a.ArgType == AType.Out ? "out " : "")) +
+ TypeManager.CSharpName (a.Expr.Type);
+ }
+
+ public bool Resolve (EmitContext ec, Location loc)
+ {
+ expr = expr.Resolve (ec);
+
+ if (ArgType == AType.Expression)
+ return expr != null;
+
+ if (expr.eclass != ExprClass.Variable){
+ //
+ // We just probe to match the CSC output
+ //
+ if (expr.eclass == ExprClass.PropertyAccess ||
+ expr.eclass == ExprClass.IndexerAccess){
+ Report.Error (
+ 206, loc,
+ "A property or indexer can not be passed as an out or ref " +
+ "parameter");
+ } else {
+ Report.Error (
+ 1510, loc,
+ "An lvalue is required as an argument to out or ref");
+ }
+ return false;
}
+
+ return expr != null;
+ }
+
+ public void Emit (EmitContext ec)
+ {
+ //
+ // Ref and Out parameters need to have their addresses taken.
+ //
+ // ParameterReferences might already be references, so we want
+ // to pass just the value
+ //
+ if (ArgType == AType.Ref || ArgType == AType.Out){
+ AddressOp mode = AddressOp.Store;
+
+ if (ArgType == AType.Ref)
+ mode |= AddressOp.Load;
+
+ if (expr is ParameterReference){
+ ParameterReference pr = (ParameterReference) expr;
+
+ if (pr.is_ref)
+ pr.EmitLoad (ec);
+ else {
+
+ pr.AddressOf (ec, mode);
+ }
+ } else
+ ((IMemoryLocation)expr).AddressOf (ec, mode);
+ } else
+ expr.Emit (ec);
}
}
- // <summary>
- // Invocation of methods or delegates.
- // </summary>
- public class Invocation : Expression {
- ArrayList arguments;
+ /// <summary>
+ /// Invocation of methods or delegates.
+ /// </summary>
+ public class Invocation : ExpressionStatement {
+ public readonly ArrayList Arguments;
+ Location loc;
+
Expression expr;
+ MethodBase method = null;
+ bool is_base;
+
+ static Hashtable method_parameter_cache;
+ static Invocation ()
+ {
+ method_parameter_cache = new PtrHashtable ();
+ }
+
//
// arguments is an ArrayList, but we do not want to typecast,
// as it might be null.
@@ -336,10 +2879,11 @@ namespace CIR {
// FIXME: only allow expr to be a method invocation or a
// delegate invocation (7.5.5)
//
- public Invocation (Expression expr, ArrayList arguments)
+ public Invocation (Expression expr, ArrayList arguments, Location l)
{
this.expr = expr;
- this.arguments = arguments;
+ Arguments = arguments;
+ loc = l;
}
public Expression Expr {
@@ -348,77 +2892,1899 @@ namespace CIR {
}
}
- public ArrayList Arguments {
+ /// <summary>
+ /// Returns the Parameters (a ParameterData interface) for the
+ /// Method `mb'
+ /// </summary>
+ public static ParameterData GetParameterData (MethodBase mb)
+ {
+ object pd = method_parameter_cache [mb];
+ object ip;
+
+ if (pd != null)
+ return (ParameterData) pd;
+
+
+ ip = TypeManager.LookupParametersByBuilder (mb);
+ if (ip != null){
+ method_parameter_cache [mb] = ip;
+
+ return (ParameterData) ip;
+ } else {
+ ParameterInfo [] pi = mb.GetParameters ();
+ ReflectionParameters rp = new ReflectionParameters (pi);
+ method_parameter_cache [mb] = rp;
+
+ return (ParameterData) rp;
+ }
+ }
+
+ /// <summary>
+ /// Determines "better conversion" as specified in 7.4.2.3
+ /// Returns : 1 if a->p is better
+ /// 0 if a->q or neither is better
+ /// </summary>
+ static int BetterConversion (EmitContext ec, Argument a, Type p, Type q, Location loc)
+ {
+ Type argument_type = a.Type;
+ Expression argument_expr = a.Expr;
+
+ if (argument_type == null)
+ throw new Exception ("Expression of type " + a.Expr + " does not resolve its type");
+
+ if (p == q)
+ return 0;
+
+ if (argument_type == p)
+ return 1;
+
+ if (argument_type == q)
+ return 0;
+
+ //
+ // Now probe whether an implicit constant expression conversion
+ // can be used.
+ //
+ // An implicit constant expression conversion permits the following
+ // conversions:
+ //
+ // * A constant-expression of type `int' can be converted to type
+ // sbyte, byute, short, ushort, uint, ulong provided the value of
+ // of the expression is withing the range of the destination type.
+ //
+ // * A constant-expression of type long can be converted to type
+ // ulong, provided the value of the constant expression is not negative
+ //
+ // FIXME: Note that this assumes that constant folding has
+ // taken place. We dont do constant folding yet.
+ //
+
+ if (argument_expr is IntConstant){
+ IntConstant ei = (IntConstant) argument_expr;
+ int value = ei.Value;
+
+ if (p == TypeManager.sbyte_type){
+ if (value >= SByte.MinValue && value <= SByte.MaxValue)
+ return 1;
+ } else if (p == TypeManager.byte_type){
+ if (Byte.MinValue >= 0 && value <= Byte.MaxValue)
+ return 1;
+ } else if (p == TypeManager.short_type){
+ if (value >= Int16.MinValue && value <= Int16.MaxValue)
+ return 1;
+ } else if (p == TypeManager.ushort_type){
+ if (value >= UInt16.MinValue && value <= UInt16.MaxValue)
+ return 1;
+ } else if (p == TypeManager.uint32_type){
+ //
+ // we can optimize this case: a positive int32
+ // always fits on a uint32
+ //
+ if (value >= 0)
+ return 1;
+ } else if (p == TypeManager.uint64_type){
+ //
+ // we can optimize this case: a positive int32
+ // always fits on a uint64
+ //
+ if (value >= 0)
+ return 1;
+ }
+ } else if (argument_type == TypeManager.int64_type && argument_expr is LongConstant){
+ LongConstant lc = (LongConstant) argument_expr;
+
+ if (p == TypeManager.uint64_type){
+ if (lc.Value > 0)
+ return 1;
+ }
+ }
+
+ if (q == null) {
+ Expression tmp = ConvertImplicitStandard (ec, argument_expr, p, loc);
+
+ if (tmp != null)
+ return 1;
+ else
+ return 0;
+ }
+
+ Expression p_tmp = new EmptyExpression (p);
+ Expression q_tmp = new EmptyExpression (q);
+
+ if (StandardConversionExists (p_tmp, q) == true &&
+ StandardConversionExists (q_tmp, p) == false)
+ return 1;
+
+ if (p == TypeManager.sbyte_type)
+ if (q == TypeManager.byte_type || q == TypeManager.ushort_type ||
+ q == TypeManager.uint32_type || q == TypeManager.uint64_type)
+ return 1;
+
+ if (p == TypeManager.short_type)
+ if (q == TypeManager.ushort_type || q == TypeManager.uint32_type ||
+ q == TypeManager.uint64_type)
+ return 1;
+
+ if (p == TypeManager.int32_type)
+ if (q == TypeManager.uint32_type || q == TypeManager.uint64_type)
+ return 1;
+
+ if (p == TypeManager.int64_type)
+ if (q == TypeManager.uint64_type)
+ return 1;
+
+ return 0;
+ }
+
+ /// <summary>
+ /// Determines "Better function"
+ /// </summary>
+ /// <remarks>
+ /// and returns an integer indicating :
+ /// 0 if candidate ain't better
+ /// 1 if candidate is better than the current best match
+ /// </remarks>
+ static int BetterFunction (EmitContext ec, ArrayList args,
+ MethodBase candidate, MethodBase best,
+ bool expanded_form, Location loc)
+ {
+ ParameterData candidate_pd = GetParameterData (candidate);
+ ParameterData best_pd;
+ int argument_count;
+
+ if (args == null)
+ argument_count = 0;
+ else
+ argument_count = args.Count;
+
+ int cand_count = candidate_pd.Count;
+
+ if (cand_count == 0 && argument_count == 0)
+ return 1;
+
+ if (candidate_pd.ParameterModifier (cand_count - 1) != Parameter.Modifier.PARAMS)
+ if (cand_count != argument_count)
+ return 0;
+
+ if (best == null) {
+ int x = 0;
+
+ if (argument_count == 0 && cand_count == 1 &&
+ candidate_pd.ParameterModifier (cand_count - 1) == Parameter.Modifier.PARAMS)
+ return 1;
+
+ for (int j = argument_count; j > 0;) {
+ j--;
+
+ Argument a = (Argument) args [j];
+ Type t = candidate_pd.ParameterType (j);
+
+ if (candidate_pd.ParameterModifier (j) == Parameter.Modifier.PARAMS)
+ if (expanded_form)
+ t = t.GetElementType ();
+
+ x = BetterConversion (ec, a, t, null, loc);
+
+ if (x <= 0)
+ break;
+ }
+
+ if (x > 0)
+ return 1;
+ else
+ return 0;
+ }
+
+ best_pd = GetParameterData (best);
+
+ int rating1 = 0, rating2 = 0;
+
+ for (int j = 0; j < argument_count; ++j) {
+ int x, y;
+
+ Argument a = (Argument) args [j];
+
+ Type ct = candidate_pd.ParameterType (j);
+ Type bt = best_pd.ParameterType (j);
+
+ if (candidate_pd.ParameterModifier (j) == Parameter.Modifier.PARAMS)
+ if (expanded_form)
+ ct = ct.GetElementType ();
+
+ if (best_pd.ParameterModifier (j) == Parameter.Modifier.PARAMS)
+ if (expanded_form)
+ bt = bt.GetElementType ();
+
+ x = BetterConversion (ec, a, ct, bt, loc);
+ y = BetterConversion (ec, a, bt, ct, loc);
+
+ if (x < y)
+ return 0;
+
+ rating1 += x;
+ rating2 += y;
+ }
+
+ if (rating1 > rating2)
+ return 1;
+ else
+ return 0;
+ }
+
+ public static string FullMethodDesc (MethodBase mb)
+ {
+ string ret_type = "";
+
+ if (mb is MethodInfo)
+ ret_type = TypeManager.CSharpName (((MethodInfo) mb).ReturnType);
+
+ StringBuilder sb = new StringBuilder (ret_type + " " + mb.Name);
+ ParameterData pd = GetParameterData (mb);
+
+ int count = pd.Count;
+ sb.Append (" (");
+
+ for (int i = count; i > 0; ) {
+ i--;
+
+ sb.Append (pd.ParameterDesc (count - i - 1));
+ if (i != 0)
+ sb.Append (", ");
+ }
+
+ sb.Append (")");
+ return sb.ToString ();
+ }
+
+ public static MethodGroupExpr MakeUnionSet (Expression mg1, Expression mg2, Location loc)
+ {
+ MemberInfo [] miset;
+ MethodGroupExpr union;
+
+ if (mg1 == null){
+ if (mg2 == null)
+ return null;
+ return (MethodGroupExpr) mg2;
+ } else {
+ if (mg2 == null)
+ return (MethodGroupExpr) mg1;
+ }
+
+ MethodGroupExpr left_set = null, right_set = null;
+ int length1 = 0, length2 = 0;
+
+ left_set = (MethodGroupExpr) mg1;
+ length1 = left_set.Methods.Length;
+
+ right_set = (MethodGroupExpr) mg2;
+ length2 = right_set.Methods.Length;
+
+ ArrayList common = new ArrayList ();
+
+ for (int i = 0; i < left_set.Methods.Length; i++) {
+ for (int j = 0; j < right_set.Methods.Length; j++) {
+ if (left_set.Methods [i] == right_set.Methods [j])
+ common.Add (left_set.Methods [i]);
+ }
+ }
+
+ miset = new MemberInfo [length1 + length2 - common.Count];
+
+ left_set.Methods.CopyTo (miset, 0);
+
+ int k = 0;
+
+ for (int j = 0; j < right_set.Methods.Length; j++)
+ if (!common.Contains (right_set.Methods [j]))
+ miset [length1 + k++] = right_set.Methods [j];
+
+ union = new MethodGroupExpr (miset, loc);
+
+ return union;
+ }
+
+ /// <summary>
+ /// Determines is the candidate method, if a params method, is applicable
+ /// in its expanded form to the given set of arguments
+ /// </summary>
+ static bool IsParamsMethodApplicable (ArrayList arguments, MethodBase candidate)
+ {
+ int arg_count;
+
+ if (arguments == null)
+ arg_count = 0;
+ else
+ arg_count = arguments.Count;
+
+ ParameterData pd = GetParameterData (candidate);
+
+ int pd_count = pd.Count;
+
+ if (pd_count == 0)
+ return false;
+
+ if (pd.ParameterModifier (pd_count - 1) != Parameter.Modifier.PARAMS)
+ return false;
+
+ if (pd_count - 1 > arg_count)
+ return false;
+
+ if (pd_count == 1 && arg_count == 0)
+ return true;
+
+ //
+ // If we have come this far, the case which remains is when the number of parameters
+ // is less than or equal to the argument count.
+
+ for (int i = 0; i < pd_count - 1; ++i) {
+
+ Argument a = (Argument) arguments [i];
+
+ Parameter.Modifier a_mod = a.GetParameterModifier ();
+ Parameter.Modifier p_mod = pd.ParameterModifier (i);
+
+ if (a_mod == p_mod) {
+
+ if (a_mod == Parameter.Modifier.NONE)
+ if (!StandardConversionExists (a.Expr, pd.ParameterType (i)))
+ return false;
+
+ if (a_mod == Parameter.Modifier.REF ||
+ a_mod == Parameter.Modifier.OUT)
+ if (pd.ParameterType (i) != a.Type)
+ return false;
+ } else
+ return false;
+
+ }
+
+ Type element_type = pd.ParameterType (pd_count - 1).GetElementType ();
+
+ for (int i = pd_count - 1; i < arg_count; i++) {
+ Argument a = (Argument) arguments [i];
+
+ if (!StandardConversionExists (a.Expr, element_type))
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Determines if the candidate method is applicable (section 14.4.2.1)
+ /// to the given set of arguments
+ /// </summary>
+ static bool IsApplicable (ArrayList arguments, MethodBase candidate)
+ {
+ int arg_count;
+
+ if (arguments == null)
+ arg_count = 0;
+ else
+ arg_count = arguments.Count;
+
+ ParameterData pd = GetParameterData (candidate);
+
+ int pd_count = pd.Count;
+
+ if (arg_count != pd.Count)
+ return false;
+
+ for (int i = arg_count; i > 0; ) {
+ i--;
+
+ Argument a = (Argument) arguments [i];
+
+ Parameter.Modifier a_mod = a.GetParameterModifier ();
+ Parameter.Modifier p_mod = pd.ParameterModifier (i);
+
+ if (a_mod == p_mod) {
+ if (a_mod == Parameter.Modifier.NONE)
+ if (!StandardConversionExists (a.Expr, pd.ParameterType (i)))
+ return false;
+
+ if (a_mod == Parameter.Modifier.REF ||
+ a_mod == Parameter.Modifier.OUT)
+ if (pd.ParameterType (i) != a.Type)
+ return false;
+ } else
+ return false;
+ }
+
+ return true;
+ }
+
+
+
+ /// <summary>
+ /// Find the Applicable Function Members (7.4.2.1)
+ ///
+ /// me: Method Group expression with the members to select.
+ /// it might contain constructors or methods (or anything
+ /// that maps to a method).
+ ///
+ /// Arguments: ArrayList containing resolved Argument objects.
+ ///
+ /// loc: The location if we want an error to be reported, or a Null
+ /// location for "probing" purposes.
+ ///
+ /// Returns: The MethodBase (either a ConstructorInfo or a MethodInfo)
+ /// that is the best match of me on Arguments.
+ ///
+ /// </summary>
+ public static MethodBase OverloadResolve (EmitContext ec, MethodGroupExpr me,
+ ArrayList Arguments, Location loc)
+ {
+ ArrayList afm = new ArrayList ();
+ int best_match_idx = -1;
+ MethodBase method = null;
+ int argument_count;
+ ArrayList candidates = new ArrayList ();
+
+ for (int i = me.Methods.Length; i > 0; ){
+ i--;
+ MethodBase candidate = me.Methods [i];
+ int x;
+
+ // Check if candidate is applicable (section 14.4.2.1)
+ if (!IsApplicable (Arguments, candidate))
+ continue;
+
+ candidates.Add (candidate);
+
+ x = BetterFunction (ec, Arguments, candidate, method, false, loc);
+
+ if (x == 0)
+ continue;
+ else {
+ best_match_idx = i;
+ method = me.Methods [best_match_idx];
+ }
+ }
+
+ if (Arguments == null)
+ argument_count = 0;
+ else
+ argument_count = Arguments.Count;
+
+ //
+ // Now we see if we can find params functions, applicable in their expanded form
+ // since if they were applicable in their normal form, they would have been selected
+ // above anyways
+ //
+ bool chose_params_expanded = false;
+
+ if (best_match_idx == -1) {
+
+ candidates = new ArrayList ();
+ for (int i = me.Methods.Length; i > 0; ) {
+ i--;
+ MethodBase candidate = me.Methods [i];
+
+ if (!IsParamsMethodApplicable (Arguments, candidate))
+ continue;
+
+ candidates.Add (candidate);
+
+ int x = BetterFunction (ec, Arguments, candidate, method, true, loc);
+
+ if (x == 0)
+ continue;
+ else {
+ best_match_idx = i;
+ method = me.Methods [best_match_idx];
+ chose_params_expanded = true;
+ }
+ }
+ }
+
+ //
+ // Now we see if we can at least find a method with the same number of arguments
+ //
+ ParameterData pd;
+
+ if (best_match_idx == -1) {
+
+ for (int i = me.Methods.Length; i > 0;) {
+ i--;
+ MethodBase mb = me.Methods [i];
+ pd = GetParameterData (mb);
+
+ if (pd.Count == argument_count) {
+ best_match_idx = i;
+ method = me.Methods [best_match_idx];
+ } else
+ continue;
+ }
+ }
+
+ if (method == null)
+ return null;
+
+ //
+ // Now check that there are no ambiguities i.e the selected method
+ // should be better than all the others
+ //
+
+ for (int i = 0; i < candidates.Count; ++i) {
+ MethodBase candidate = (MethodBase) candidates [i];
+
+ if (candidate == method)
+ continue;
+
+ //
+ // If a normal method is applicable in the sense that it has the same
+ // number of arguments, then the expanded params method is never applicable
+ // so we debar the params method.
+ //
+ if (IsParamsMethodApplicable (Arguments, candidate) &&
+ IsApplicable (Arguments, method))
+ continue;
+
+ int x = BetterFunction (ec, Arguments, method, candidate,
+ chose_params_expanded, loc);
+
+ if (x != 1) {
+ Report.Error (
+ 121, loc,
+ "Ambiguous call when selecting function due to implicit casts");
+ return null;
+ }
+ }
+
+ //
+ // And now check if the arguments are all compatible, perform conversions
+ // if necessary etc. and return if everything is all right
+ //
+
+ if (VerifyArgumentsCompat (ec, Arguments, argument_count, method,
+ chose_params_expanded, null, loc))
+ return method;
+ else
+ return null;
+ }
+
+ public static bool VerifyArgumentsCompat (EmitContext ec, ArrayList Arguments,
+ int argument_count,
+ MethodBase method,
+ bool chose_params_expanded,
+ Type delegate_type,
+ Location loc)
+ {
+ ParameterData pd = GetParameterData (method);
+ int pd_count = pd.Count;
+
+ for (int j = 0; j < argument_count; j++) {
+ Argument a = (Argument) Arguments [j];
+ Expression a_expr = a.Expr;
+ Type parameter_type = pd.ParameterType (j);
+
+ if (pd.ParameterModifier (j) == Parameter.Modifier.PARAMS && chose_params_expanded)
+ parameter_type = parameter_type.GetElementType ();
+
+ if (a.Type != parameter_type){
+ Expression conv;
+
+ conv = ConvertImplicitStandard (ec, a_expr, parameter_type, loc);
+
+ if (conv == null) {
+ if (!Location.IsNull (loc)) {
+ if (delegate_type == null)
+ Error (1502, loc,
+ "The best overloaded match for method '" +
+ FullMethodDesc (method) +
+ "' has some invalid arguments");
+ else
+ Report.Error (1594, loc,
+ "Delegate '" + delegate_type.ToString () +
+ "' has some invalid arguments.");
+ Error (1503, loc,
+ "Argument " + (j+1) +
+ ": Cannot convert from '" + Argument.FullDesc (a)
+ + "' to '" + pd.ParameterDesc (j) + "'");
+ }
+
+ return false;
+ }
+
+ //
+ // Update the argument with the implicit conversion
+ //
+ if (a_expr != conv)
+ a.Expr = conv;
+ }
+
+ if (a.GetParameterModifier () != pd.ParameterModifier (j) &&
+ pd.ParameterModifier (pd_count - 1) != Parameter.Modifier.PARAMS) {
+ if (!Location.IsNull (loc)) {
+ Console.WriteLine ("A:P: " + a.GetParameterModifier ());
+ Console.WriteLine ("PP:: " + pd.ParameterModifier (j));
+ Console.WriteLine ("PT: " + parameter_type.IsByRef);
+ Error (1502, loc,
+ "The best overloaded match for method '" + FullMethodDesc (method)+
+ "' has some invalid arguments");
+ Error (1503, loc,
+ "Argument " + (j+1) +
+ ": Cannot convert from '" + Argument.FullDesc (a)
+ + "' to '" + pd.ParameterDesc (j) + "'");
+ }
+
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ //
+ // First, resolve the expression that is used to
+ // trigger the invocation
+ //
+ if (expr is BaseAccess)
+ is_base = true;
+
+ expr = expr.Resolve (ec);
+ if (expr == null)
+ return null;
+
+ if (!(expr is MethodGroupExpr)) {
+ Type expr_type = expr.Type;
+
+ if (expr_type != null){
+ bool IsDelegate = TypeManager.IsDelegateType (expr_type);
+ if (IsDelegate)
+ return (new DelegateInvocation (
+ this.expr, Arguments, loc)).Resolve (ec);
+ }
+ }
+
+ if (!(expr is MethodGroupExpr)){
+ report118 (loc, this.expr, "method group");
+ return null;
+ }
+
+ //
+ // Next, evaluate all the expressions in the argument list
+ //
+ if (Arguments != null){
+ for (int i = Arguments.Count; i > 0;){
+ --i;
+ Argument a = (Argument) Arguments [i];
+
+ if (!a.Resolve (ec, loc))
+ return null;
+ }
+ }
+
+ method = OverloadResolve (ec, (MethodGroupExpr) this.expr, Arguments, loc);
+
+ if (method == null){
+ Error (-6, loc,
+ "Could not find any applicable function for this argument list");
+ return null;
+ }
+
+ if (method is MethodInfo)
+ type = ((MethodInfo)method).ReturnType;
+
+ if (type.IsPointer){
+ if (!ec.InUnsafe){
+ UnsafeError (loc);
+ return null;
+ }
+ }
+
+ eclass = ExprClass.Value;
+ return this;
+ }
+
+ // <summary>
+ // Emits the list of arguments as an array
+ // </summary>
+ static void EmitParams (EmitContext ec, int idx, ArrayList arguments)
+ {
+ ILGenerator ig = ec.ig;
+ int count = arguments.Count - idx;
+ Argument a = (Argument) arguments [idx];
+ Type t = a.expr.Type;
+ string array_type = t.FullName + "[]";
+ LocalBuilder array;
+
+ array = ig.DeclareLocal (Type.GetType (array_type));
+ IntConstant.EmitInt (ig, count);
+ ig.Emit (OpCodes.Newarr, t);
+ ig.Emit (OpCodes.Stloc, array);
+
+ int top = arguments.Count;
+ for (int j = idx; j < top; j++){
+ a = (Argument) arguments [j];
+
+ ig.Emit (OpCodes.Ldloc, array);
+ IntConstant.EmitInt (ig, j - idx);
+ a.Emit (ec);
+
+ ArrayAccess.EmitStoreOpcode (ig, t);
+ }
+ ig.Emit (OpCodes.Ldloc, array);
+ }
+
+ /// <summary>
+ /// Emits a list of resolved Arguments that are in the arguments
+ /// ArrayList.
+ ///
+ /// The MethodBase argument might be null if the
+ /// emission of the arguments is known not to contain
+ /// a `params' field (for example in constructors or other routines
+ /// that keep their arguments in this structure
+ /// </summary>
+ public static void EmitArguments (EmitContext ec, MethodBase mb, ArrayList arguments)
+ {
+ ParameterData pd;
+ if (mb != null)
+ pd = GetParameterData (mb);
+ else
+ pd = null;
+
+ //
+ // If we are calling a params method with no arguments, special case it
+ //
+ if (arguments == null){
+ if (pd != null && pd.Count > 0 &&
+ pd.ParameterModifier (0) == Parameter.Modifier.PARAMS){
+ ILGenerator ig = ec.ig;
+
+ IntConstant.EmitInt (ig, 0);
+ ig.Emit (OpCodes.Newarr, pd.ParameterType (0).GetElementType ());
+ }
+
+ return;
+ }
+
+ int top = arguments.Count;
+
+ for (int i = 0; i < top; i++){
+ Argument a = (Argument) arguments [i];
+
+ if (pd != null){
+ if (pd.ParameterModifier (i) == Parameter.Modifier.PARAMS){
+ //
+ // Special case if we are passing the same data as the
+ // params argument, do not put it in an array.
+ //
+ if (pd.ParameterType (i) == a.Type)
+ a.Emit (ec);
+ else
+ EmitParams (ec, i, arguments);
+ return;
+ }
+ }
+
+ a.Emit (ec);
+ }
+ }
+
+ /// <remarks>
+ /// is_base tells whether we want to force the use of the `call'
+ /// opcode instead of using callvirt. Call is required to call
+ /// a specific method, while callvirt will always use the most
+ /// recent method in the vtable.
+ ///
+ /// is_static tells whether this is an invocation on a static method
+ ///
+ /// instance_expr is an expression that represents the instance
+ /// it must be non-null if is_static is false.
+ ///
+ /// method is the method to invoke.
+ ///
+ /// Arguments is the list of arguments to pass to the method or constructor.
+ /// </remarks>
+ public static void EmitCall (EmitContext ec, bool is_base,
+ bool is_static, Expression instance_expr,
+ MethodBase method, ArrayList Arguments)
+ {
+ ILGenerator ig = ec.ig;
+ bool struct_call = false;
+
+ if (!is_static){
+
+ if (method.DeclaringType.IsValueType)
+ struct_call = true;
+ //
+ // If this is ourselves, push "this"
+ //
+ if (instance_expr == null){
+ ig.Emit (OpCodes.Ldarg_0);
+ } else {
+ //
+ // Push the instance expression
+ //
+ if (instance_expr.Type.IsSubclassOf (TypeManager.value_type)){
+ //
+ // Special case: calls to a function declared in a
+ // reference-type with a value-type argument need
+ // to have their value boxed.
+
+ struct_call = true;
+ if (method.DeclaringType.IsValueType){
+ //
+ // If the expression implements IMemoryLocation, then
+ // we can optimize and use AddressOf on the
+ // return.
+ //
+ // If not we have to use some temporary storage for
+ // it.
+ if (instance_expr is IMemoryLocation){
+ ((IMemoryLocation)instance_expr).
+ AddressOf (ec, AddressOp.LoadStore);
+ }
+ else {
+ Type t = instance_expr.Type;
+
+ instance_expr.Emit (ec);
+ LocalBuilder temp = ig.DeclareLocal (t);
+ ig.Emit (OpCodes.Stloc, temp);
+ ig.Emit (OpCodes.Ldloca, temp);
+ }
+ } else {
+ instance_expr.Emit (ec);
+ ig.Emit (OpCodes.Box, instance_expr.Type);
+ }
+ } else
+ instance_expr.Emit (ec);
+ }
+ }
+
+ EmitArguments (ec, method, Arguments);
+
+ if (is_static || struct_call || is_base){
+ if (method is MethodInfo)
+ ig.Emit (OpCodes.Call, (MethodInfo) method);
+ else
+ ig.Emit (OpCodes.Call, (ConstructorInfo) method);
+ } else {
+ if (method is MethodInfo)
+ ig.Emit (OpCodes.Callvirt, (MethodInfo) method);
+ else
+ ig.Emit (OpCodes.Callvirt, (ConstructorInfo) method);
+ }
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ MethodGroupExpr mg = (MethodGroupExpr) this.expr;
+
+ EmitCall (ec, is_base, method.IsStatic, mg.InstanceExpression, method, Arguments);
+ }
+
+ public override void EmitStatement (EmitContext ec)
+ {
+ Emit (ec);
+
+ //
+ // Pop the return value if there is one
+ //
+ if (method is MethodInfo){
+ if (((MethodInfo)method).ReturnType != TypeManager.void_type)
+ ec.ig.Emit (OpCodes.Pop);
+ }
+ }
+ }
+
+ //
+ // This class is used to "disable" the code generation for the
+ // temporary variable when initializing value types.
+ //
+ class EmptyAddressOf : EmptyExpression, IMemoryLocation {
+ public void AddressOf (EmitContext ec, AddressOp Mode)
+ {
+ // nothing
+ }
+ }
+
+ /// <summary>
+ /// Implements the new expression
+ /// </summary>
+ public class New : ExpressionStatement {
+ public readonly ArrayList Arguments;
+ public readonly string RequestedType;
+
+ Location loc;
+ MethodBase method = null;
+
+ //
+ // If set, the new expression is for a value_target, and
+ // we will not leave anything on the stack.
+ //
+ Expression value_target;
+
+ public New (string requested_type, ArrayList arguments, Location l)
+ {
+ RequestedType = requested_type;
+ Arguments = arguments;
+ loc = l;
+ }
+
+ public Expression ValueTypeVariable {
get {
- return arguments;
+ return value_target;
+ }
+
+ set {
+ value_target = value;
+ }
+ }
+
+ //
+ // This function is used to disable the following code sequence for
+ // value type initialization:
+ //
+ // AddressOf (temporary)
+ // Construct/Init
+ // LoadTemporary
+ //
+ // Instead the provide will have provided us with the address on the
+ // stack to store the results.
+ //
+ static Expression MyEmptyExpression;
+
+ public void DisableTemporaryValueType ()
+ {
+ if (MyEmptyExpression == null)
+ MyEmptyExpression = new EmptyAddressOf ();
+
+ //
+ // To enable this, look into:
+ // test-34 and test-89 and self bootstrapping.
+ //
+ // For instance, we can avoid a copy by using `newobj'
+ // instead of Call + Push-temp on value types.
+// value_target = MyEmptyExpression;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ type = RootContext.LookupType (ec.DeclSpace, RequestedType, false, loc);
+
+ if (type == null)
+ return null;
+
+ bool IsDelegate = TypeManager.IsDelegateType (type);
+
+ if (IsDelegate)
+ return (new NewDelegate (type, Arguments, loc)).Resolve (ec);
+
+ bool is_struct = false;
+ is_struct = type.IsSubclassOf (TypeManager.value_type);
+ eclass = ExprClass.Value;
+
+ //
+ // SRE returns a match for .ctor () on structs (the object constructor),
+ // so we have to manually ignore it.
+ //
+ if (is_struct && Arguments == null)
+ return this;
+
+ Expression ml;
+ ml = MemberLookup (ec, type, ".ctor", MemberTypes.Constructor, AllBindingFlags, loc);
+
+ if (! (ml is MethodGroupExpr)){
+ if (!is_struct){
+ report118 (loc, ml, "method group");
+ return null;
+ }
+ }
+
+ if (ml != null) {
+ if (Arguments != null){
+ for (int i = Arguments.Count; i > 0;){
+ --i;
+ Argument a = (Argument) Arguments [i];
+
+ if (!a.Resolve (ec, loc))
+ return null;
+ }
+ }
+
+ method = Invocation.OverloadResolve (ec, (MethodGroupExpr) ml,
+ Arguments, loc);
+
}
+
+ if (method == null && !is_struct) {
+ Error (-6, loc,
+ "New invocation: Can not find a constructor for " +
+ "this argument list");
+ return null;
+ }
+ return this;
+ }
+
+ //
+ // This DoEmit can be invoked in two contexts:
+ // * As a mechanism that will leave a value on the stack (new object)
+ // * As one that wont (init struct)
+ //
+ // You can control whether a value is required on the stack by passing
+ // need_value_on_stack. The code *might* leave a value on the stack
+ // so it must be popped manually
+ //
+ // If we are dealing with a ValueType, we have a few
+ // situations to deal with:
+ //
+ // * The target is a ValueType, and we have been provided
+ // the instance (this is easy, we are being assigned).
+ //
+ // * The target of New is being passed as an argument,
+ // to a boxing operation or a function that takes a
+ // ValueType.
+ //
+ // In this case, we need to create a temporary variable
+ // that is the argument of New.
+ //
+ // Returns whether a value is left on the stack
+ //
+ bool DoEmit (EmitContext ec, bool need_value_on_stack)
+ {
+ bool is_value_type = type.IsSubclassOf (TypeManager.value_type);
+ ILGenerator ig = ec.ig;
+
+ if (is_value_type){
+ IMemoryLocation ml;
+
+ if (value_target == null)
+ value_target = new LocalTemporary (ec, type);
+
+ ml = (IMemoryLocation) value_target;
+ ml.AddressOf (ec, AddressOp.Store);
+ }
+
+ if (method != null)
+ Invocation.EmitArguments (ec, method, Arguments);
+
+ if (is_value_type){
+ if (method == null)
+ ig.Emit (OpCodes.Initobj, type);
+ else
+ ig.Emit (OpCodes.Call, (ConstructorInfo) method);
+ if (need_value_on_stack){
+ value_target.Emit (ec);
+ return true;
+ }
+ return false;
+ } else {
+ ig.Emit (OpCodes.Newobj, (ConstructorInfo) method);
+ return true;
+ }
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ DoEmit (ec, true);
+ }
+
+ public override void EmitStatement (EmitContext ec)
+ {
+ if (DoEmit (ec, false))
+ ec.ig.Emit (OpCodes.Pop);
}
}
- public class New : Expression {
- ArrayList arguments;
- TypeRef requested_ref;
+ /// <summary>
+ /// Represents an array creation expression.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// There are two possible scenarios here: one is an array creation
+ /// expression that specifies the dimensions and optionally the
+ /// initialization data and the other which does not need dimensions
+ /// specified but where initialization data is mandatory.
+ /// </remarks>
+ public class ArrayCreation : ExpressionStatement {
+ string RequestedType;
+ string Rank;
+ ArrayList Initializers;
+ Location loc;
+
+ //
+ // The list of Argument types.
+ // This is used to constrcut the `newarray' or constructor signature
+ //
+ ArrayList Arguments;
+
+ MethodBase method = null;
+ Type array_element_type;
+ bool IsOneDimensional = false;
+ bool IsBuiltinType = false;
+ bool ExpectInitializers = false;
+
+ int dimensions = 0;
+ Type underlying_type;
+
+ ArrayList ArrayData;
+
+ Hashtable Bounds;
+
+ //
+ // The number of array initializers that we can handle
+ // via the InitializeArray method - through EmitStaticInitializers
+ //
+ int num_automatic_initializers;
+
+ public ArrayCreation (string requested_type, ArrayList exprs,
+ string rank, ArrayList initializers, Location l)
+ {
+ RequestedType = requested_type;
+ Rank = rank;
+ Initializers = initializers;
+ loc = l;
+
+ Arguments = new ArrayList ();
+
+ foreach (Expression e in exprs)
+ Arguments.Add (new Argument (e, Argument.AType.Expression));
+ }
+
+ public ArrayCreation (string requested_type, string rank, ArrayList initializers, Location l)
+ {
+ RequestedType = requested_type;
+ Initializers = initializers;
+ loc = l;
+
+ Rank = rank.Substring (0, rank.LastIndexOf ("["));
+
+ string tmp = rank.Substring (rank.LastIndexOf ("["));
+
+ dimensions = tmp.Length - 1;
+ ExpectInitializers = true;
+ }
+
+ public static string FormArrayType (string base_type, int idx_count, string rank)
+ {
+ StringBuilder sb = new StringBuilder (base_type);
+
+ sb.Append (rank);
+
+ sb.Append ("[");
+ for (int i = 1; i < idx_count; i++)
+ sb.Append (",");
+
+ sb.Append ("]");
+
+ return sb.ToString ();
+ }
+
+ public static string FormElementType (string base_type, int idx_count, string rank)
+ {
+ StringBuilder sb = new StringBuilder (base_type);
+
+ sb.Append ("[");
+ for (int i = 1; i < idx_count; i++)
+ sb.Append (",");
+
+ sb.Append ("]");
+
+ sb.Append (rank);
+
+ string val = sb.ToString ();
+
+ return val.Substring (0, val.LastIndexOf ("["));
+ }
+
+ void error178 ()
+ {
+ Report.Error (178, loc, "Incorrectly structured array initializer");
+ }
+
+ public bool CheckIndices (EmitContext ec, ArrayList probe, int idx, bool specified_dims)
+ {
+ if (specified_dims) {
+ Argument a = (Argument) Arguments [idx];
+
+ if (!a.Resolve (ec, loc))
+ return false;
+
+ if (!(a.Expr is Constant)) {
+ Report.Error (150, loc, "A constant value is expected");
+ return false;
+ }
+
+ int value = (int) ((Constant) a.Expr).GetValue ();
+
+ if (value != probe.Count) {
+ error178 ();
+ return false;
+ }
+
+ Bounds [idx] = value;
+ }
+
+ foreach (object o in probe) {
+ if (o is ArrayList) {
+ bool ret = CheckIndices (ec, (ArrayList) o, idx + 1, specified_dims);
+ if (!ret)
+ return false;
+ } else {
+ Expression tmp = (Expression) o;
+ tmp = tmp.Resolve (ec);
+ if (tmp == null)
+ continue;
+
+ // Handle initialization from vars, fields etc.
+
+ Expression conv = ConvertImplicitRequired (
+ ec, tmp, underlying_type, loc);
+
+ if (conv == null)
+ return false;
- public New (TypeRef requested_ref, ArrayList arguments)
+ if (conv is StringConstant)
+ ArrayData.Add (conv);
+ else if (conv is Constant) {
+ ArrayData.Add (conv);
+ num_automatic_initializers++;
+ } else
+ ArrayData.Add (conv);
+ }
+ }
+
+ return true;
+ }
+
+ public void UpdateIndices (EmitContext ec)
{
- this.requested_ref = requested_ref;
- this.arguments = arguments;
+ int i = 0;
+ for (ArrayList probe = Initializers; probe != null;) {
+ if (probe.Count > 0 && probe [0] is ArrayList) {
+ Expression e = new IntConstant (probe.Count);
+ Arguments.Add (new Argument (e, Argument.AType.Expression));
+
+ Bounds [i++] = probe.Count;
+
+ probe = (ArrayList) probe [0];
+
+ } else {
+ Expression e = new IntConstant (probe.Count);
+ Arguments.Add (new Argument (e, Argument.AType.Expression));
+
+ Bounds [i++] = probe.Count;
+ probe = null;
+ }
+ }
+
}
- public ArrayList Arguments{
- get {
- return arguments;
+ public bool ValidateInitializers (EmitContext ec)
+ {
+ if (Initializers == null) {
+ if (ExpectInitializers)
+ return false;
+ else
+ return true;
+ }
+
+ underlying_type = RootContext.LookupType (
+ ec.DeclSpace, RequestedType, false, loc);
+
+ //
+ // We use this to store all the date values in the order in which we
+ // will need to store them in the byte blob later
+ //
+ ArrayData = new ArrayList ();
+ Bounds = new Hashtable ();
+
+ bool ret;
+
+ if (Arguments != null) {
+ ret = CheckIndices (ec, Initializers, 0, true);
+ return ret;
+
+ } else {
+ Arguments = new ArrayList ();
+
+ ret = CheckIndices (ec, Initializers, 0, false);
+
+ if (!ret)
+ return false;
+
+ UpdateIndices (ec);
+
+ if (Arguments.Count != dimensions) {
+ error178 ();
+ return false;
+ }
+
+ return ret;
}
}
- public Type RequestedType {
- get {
- return requested_ref.Type;
+ public override Expression DoResolve (EmitContext ec)
+ {
+ int arg_count;
+
+ //
+ // First step is to validate the initializers and fill
+ // in any missing bits
+ //
+ if (!ValidateInitializers (ec))
+ return null;
+
+ if (Arguments == null)
+ arg_count = 0;
+ else {
+ arg_count = Arguments.Count;
+ for (int i = 0; i < arg_count; i++){
+ Argument a = (Argument) Arguments [i];
+
+ if (!a.Resolve (ec, loc))
+ return null;
+
+ //
+ // Now, convert that to an integer
+ //
+ Expression real_arg;
+ bool old_checked = ec.CheckState;
+ ec.CheckState = true;
+
+ real_arg = ConvertExplicit (
+ ec, a.expr, TypeManager.uint32_type, loc);
+ ec.CheckState = old_checked;
+ if (real_arg == null)
+ return null;
+
+ a.expr = real_arg;
+ }
+ }
+
+ string array_type = FormArrayType (RequestedType, arg_count, Rank);
+ string element_type = FormElementType (RequestedType, arg_count, Rank);
+
+ type = RootContext.LookupType (ec.DeclSpace, array_type, false, loc);
+
+ array_element_type = RootContext.LookupType (
+ ec.DeclSpace, element_type, false, loc);
+
+ if (type == null)
+ return null;
+
+ if (arg_count == 1) {
+ IsOneDimensional = true;
+ eclass = ExprClass.Value;
+ return this;
+ }
+
+ IsBuiltinType = TypeManager.IsBuiltinType (type);
+
+ if (IsBuiltinType) {
+
+ Expression ml;
+
+ ml = MemberLookup (ec, type, ".ctor", MemberTypes.Constructor,
+ AllBindingFlags, loc);
+
+ if (!(ml is MethodGroupExpr)){
+ report118 (loc, ml, "method group");
+ return null;
+ }
+
+ if (ml == null) {
+ Report.Error (-6, loc, "New invocation: Can not find a constructor for " +
+ "this argument list");
+ return null;
+ }
+
+ method = Invocation.OverloadResolve (ec, (MethodGroupExpr) ml, Arguments, loc);
+
+ if (method == null) {
+ Report.Error (-6, loc, "New invocation: Can not find a constructor for " +
+ "this argument list");
+ return null;
+ }
+
+ eclass = ExprClass.Value;
+ return this;
+
+ } else {
+
+ ModuleBuilder mb = CodeGen.ModuleBuilder;
+
+ ArrayList args = new ArrayList ();
+ if (Arguments != null){
+ for (int i = arg_count; i > 0;){
+ --i;
+ Argument a = (Argument) Arguments [i];
+
+ args.Add (TypeManager.int32_type);
+ }
+ }
+
+ Type [] arg_types = null;
+
+ if (args.Count > 0)
+ arg_types = new Type [args.Count];
+
+ args.CopyTo (arg_types, 0);
+
+ method = mb.GetArrayMethod (type, ".ctor", CallingConventions.HasThis, null,
+ arg_types);
+
+ if (method == null) {
+ Report.Error (-6, loc, "New invocation: Can not find a constructor for " +
+ "this argument list");
+ return null;
+ }
+
+ eclass = ExprClass.Value;
+ return this;
+
+ }
+ }
+
+ public static byte [] MakeByteBlob (ArrayList ArrayData, Type underlying_type, Location loc)
+ {
+ int factor;
+ byte [] data;
+ byte [] element;
+ int count = ArrayData.Count;
+
+ factor = GetTypeSize (underlying_type);
+ if (factor == 0)
+ return null;
+
+ data = new byte [(count * factor + 4) & ~3];
+ int idx = 0;
+
+ for (int i = 0; i < count; ++i) {
+ object v = ArrayData [i];
+
+ if (v is EnumConstant)
+ v = ((EnumConstant) v).Child;
+
+ if (v is Constant && !(v is StringConstant))
+ v = ((Constant) v).GetValue ();
+ else {
+ idx += factor;
+ continue;
+ }
+
+ if (underlying_type == TypeManager.int64_type){
+ if (!(v is Expression)){
+ long val = (long) v;
+
+ for (int j = 0; j < factor; ++j) {
+ data [idx + j] = (byte) (val & 0xFF);
+ val = (val >> 8);
+ }
+ }
+ } else if (underlying_type == TypeManager.uint64_type){
+ if (!(v is Expression)){
+ ulong val = (ulong) v;
+
+ for (int j = 0; j < factor; ++j) {
+ data [idx + j] = (byte) (val & 0xFF);
+ val = (val >> 8);
+ }
+ }
+ } else if (underlying_type == TypeManager.float_type) {
+ if (!(v is Expression)){
+ element = BitConverter.GetBytes ((float) v);
+
+ for (int j = 0; j < factor; ++j)
+ data [idx + j] = element [j];
+ }
+ } else if (underlying_type == TypeManager.double_type) {
+ if (!(v is Expression)){
+ element = BitConverter.GetBytes ((double) v);
+
+ for (int j = 0; j < factor; ++j)
+ data [idx + j] = element [j];
+ }
+ } else if (underlying_type == TypeManager.char_type){
+ if (!(v is Expression)){
+ int val = (int) ((char) v);
+
+ data [idx] = (byte) (val & 0xff);
+ data [idx+1] = (byte) (val >> 8);
+ }
+ } else if (underlying_type == TypeManager.short_type){
+ if (!(v is Expression)){
+ int val = (int) ((short) v);
+
+ data [idx] = (byte) (val & 0xff);
+ data [idx+1] = (byte) (val >> 8);
+ }
+ } else if (underlying_type == TypeManager.ushort_type){
+ if (!(v is Expression)){
+ int val = (int) ((ushort) v);
+
+ data [idx] = (byte) (val & 0xff);
+ data [idx+1] = (byte) (val >> 8);
+ }
+ } else if (underlying_type == TypeManager.int32_type) {
+ if (!(v is Expression)){
+ int val = (int) v;
+
+ data [idx] = (byte) (val & 0xff);
+ data [idx+1] = (byte) ((val >> 8) & 0xff);
+ data [idx+2] = (byte) ((val >> 16) & 0xff);
+ data [idx+3] = (byte) (val >> 24);
+ }
+ } else if (underlying_type == TypeManager.uint32_type) {
+ if (!(v is Expression)){
+ uint val = (uint) v;
+
+ data [idx] = (byte) (val & 0xff);
+ data [idx+1] = (byte) ((val >> 8) & 0xff);
+ data [idx+2] = (byte) ((val >> 16) & 0xff);
+ data [idx+3] = (byte) (val >> 24);
+ }
+ } else if (underlying_type == TypeManager.sbyte_type) {
+ if (!(v is Expression)){
+ sbyte val = (sbyte) v;
+ data [idx] = (byte) val;
+ }
+ } else if (underlying_type == TypeManager.byte_type) {
+ if (!(v is Expression)){
+ byte val = (byte) v;
+ data [idx] = (byte) val;
+ }
+ } else
+ throw new Exception ("Unrecognized type in MakeByteBlob");
+
+ idx += factor;
+ }
+
+ return data;
+ }
+
+ //
+ // Emits the initializers for the array
+ //
+ void EmitStaticInitializers (EmitContext ec, bool is_expression)
+ {
+ //
+ // First, the static data
+ //
+ FieldBuilder fb;
+ ILGenerator ig = ec.ig;
+
+ byte [] data = MakeByteBlob (ArrayData, underlying_type, loc);
+
+ if (data != null) {
+ fb = RootContext.MakeStaticData (data);
+
+ if (is_expression)
+ ig.Emit (OpCodes.Dup);
+ ig.Emit (OpCodes.Ldtoken, fb);
+ ig.Emit (OpCodes.Call,
+ TypeManager.void_initializearray_array_fieldhandle);
+ }
+ }
+
+ //
+ // Emits pieces of the array that can not be computed at compile
+ // time (variables and string locations).
+ //
+ // This always expect the top value on the stack to be the array
+ //
+ void EmitDynamicInitializers (EmitContext ec, bool is_expression)
+ {
+ ILGenerator ig = ec.ig;
+ int dims = Bounds.Count;
+ int [] current_pos = new int [dims];
+ int top = ArrayData.Count;
+ LocalBuilder temp = ig.DeclareLocal (type);
+
+ ig.Emit (OpCodes.Stloc, temp);
+
+ MethodInfo set = null;
+
+ if (dims != 1){
+ Type [] args;
+ ModuleBuilder mb = null;
+ mb = CodeGen.ModuleBuilder;
+ args = new Type [dims + 1];
+
+ int j;
+ for (j = 0; j < dims; j++)
+ args [j] = TypeManager.int32_type;
+
+ args [j] = array_element_type;
+
+ set = mb.GetArrayMethod (
+ type, "Set",
+ CallingConventions.HasThis | CallingConventions.Standard,
+ TypeManager.void_type, args);
+ }
+
+ for (int i = 0; i < top; i++){
+
+ Expression e = null;
+
+ if (ArrayData [i] is Expression)
+ e = (Expression) ArrayData [i];
+
+ if (e != null) {
+ //
+ // Basically we do this for string literals and
+ // other non-literal expressions
+ //
+ if (e is StringConstant || !(e is Constant) ||
+ num_automatic_initializers <= 2) {
+ Type etype = e.Type;
+
+ ig.Emit (OpCodes.Ldloc, temp);
+
+ for (int idx = dims; idx > 0; ) {
+ idx--;
+ IntConstant.EmitInt (ig, current_pos [idx]);
+ }
+
+ //
+ // If we are dealing with a struct, get the
+ // address of it, so we can store it.
+ //
+ if (etype.IsSubclassOf (TypeManager.value_type) &&
+ !TypeManager.IsBuiltinType (etype)){
+ if (e is New){
+ New n = (New) e;
+
+ //
+ // Let new know that we are providing
+ // the address where to store the results
+ //
+ n.DisableTemporaryValueType ();
+ }
+
+ ig.Emit (OpCodes.Ldelema, etype);
+ }
+
+ e.Emit (ec);
+
+ if (dims == 1)
+ ArrayAccess.EmitStoreOpcode (ig, array_element_type);
+ else
+ ig.Emit (OpCodes.Call, set);
+ }
+ }
+
+ //
+ // Advance counter
+ //
+ for (int j = 0; j < dims; j++){
+ current_pos [j]++;
+ if (current_pos [j] < (int) Bounds [j])
+ break;
+ current_pos [j] = 0;
+ }
}
+
+ if (is_expression)
+ ig.Emit (OpCodes.Ldloc, temp);
}
+
+ void EmitArrayArguments (EmitContext ec)
+ {
+ foreach (Argument a in Arguments)
+ a.Emit (ec);
+ }
+
+ void DoEmit (EmitContext ec, bool is_statement)
+ {
+ ILGenerator ig = ec.ig;
+
+ EmitArrayArguments (ec);
+ if (IsOneDimensional)
+ ig.Emit (OpCodes.Newarr, array_element_type);
+ else {
+ if (IsBuiltinType)
+ ig.Emit (OpCodes.Newobj, (ConstructorInfo) method);
+ else
+ ig.Emit (OpCodes.Newobj, (MethodInfo) method);
+ }
+
+ if (Initializers != null){
+ //
+ // FIXME: Set this variable correctly.
+ //
+ bool dynamic_initializers = true;
+
+ if (underlying_type != TypeManager.string_type &&
+ underlying_type != TypeManager.object_type) {
+ if (num_automatic_initializers > 2)
+ EmitStaticInitializers (ec, dynamic_initializers || !is_statement);
+ }
+
+ if (dynamic_initializers)
+ EmitDynamicInitializers (ec, !is_statement);
+ }
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ DoEmit (ec, false);
+ }
+
+ public override void EmitStatement (EmitContext ec)
+ {
+ DoEmit (ec, true);
+ }
+
}
+
+ /// <summary>
+ /// Represents the `this' construct
+ /// </summary>
+ public class This : Expression, IAssignMethod, IMemoryLocation {
+ Location loc;
+
+ public This (Location loc)
+ {
+ this.loc = loc;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ eclass = ExprClass.Variable;
+ type = ec.ContainerType;
+
+ if (ec.IsStatic){
+ Report.Error (26, loc,
+ "Keyword this not valid in static code");
+ return null;
+ }
+
+ return this;
+ }
+
+ override public Expression DoResolveLValue (EmitContext ec, Expression right_side)
+ {
+ DoResolve (ec);
+
+ if (ec.TypeContainer is Class){
+ Report.Error (1604, loc, "Cannot assign to `this'");
+ return null;
+ }
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ec.ig.Emit (OpCodes.Ldarg_0);
+ }
+
+ public void EmitAssign (EmitContext ec, Expression source)
+ {
+ source.Emit (ec);
+ ec.ig.Emit (OpCodes.Starg, 0);
+ }
- public class This : Expression {
+ public void AddressOf (EmitContext ec, AddressOp mode)
+ {
+ ec.ig.Emit (OpCodes.Ldarg_0);
+
+ // FIMXE
+ // FIGURE OUT WHY LDARG_S does not work
+ //
+ // consider: struct X { int val; int P { set { val = value; }}}
+ //
+ // Yes, this looks very bad. Look at `NOTAS' for
+ // an explanation.
+ // ec.ig.Emit (OpCodes.Ldarga_S, (byte) 0);
+ }
}
+ /// <summary>
+ /// Implements the typeof operator
+ /// </summary>
public class TypeOf : Expression {
- TypeRef queried_ref;
+ public readonly string QueriedType;
+ Type typearg;
+ Location loc;
- public TypeOf (TypeRef queried_ref)
+ public TypeOf (string queried_type, Location l)
{
- this.queried_ref = queried_ref;
+ QueriedType = queried_type;
+ loc = l;
}
- public Type QueriedType {
- get {
- return queried_ref.Type;
- }
+ public override Expression DoResolve (EmitContext ec)
+ {
+ typearg = RootContext.LookupType (
+ ec.DeclSpace, QueriedType, false, loc);
+
+ if (typearg == null)
+ return null;
+
+ type = TypeManager.type_type;
+ eclass = ExprClass.Type;
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ec.ig.Emit (OpCodes.Ldtoken, typearg);
+ ec.ig.Emit (OpCodes.Call, TypeManager.system_type_get_type_from_handle);
+ }
+
+ public Type TypeArg {
+ get { return typearg; }
}
}
+ /// <summary>
+ /// Implements the sizeof expression
+ /// </summary>
public class SizeOf : Expression {
- TypeRef queried_ref;
+ public readonly string QueriedType;
+ Type type_queried;
+ Location loc;
- public SizeOf (TypeRef queried_ref)
+ public SizeOf (string queried_type, Location l)
{
- this.queried_ref = queried_ref;
+ this.QueriedType = queried_type;
+ loc = l;
}
- public Type QueriedType {
- get {
- return queried_ref.Type;
- }
+ public override Expression DoResolve (EmitContext ec)
+ {
+ type_queried = RootContext.LookupType (
+ ec.DeclSpace, QueriedType, false, loc);
+ if (type_queried == null)
+ return null;
+
+ type = TypeManager.int32_type;
+ eclass = ExprClass.Value;
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ int size = GetTypeSize (type_queried);
+
+ if (size == 0)
+ ec.ig.Emit (OpCodes.Sizeof, type_queried);
+ else
+ IntConstant.EmitInt (ec.ig, size);
}
}
+ /// <summary>
+ /// Implements the member access expression
+ /// </summary>
public class MemberAccess : Expression {
+ public readonly string Identifier;
Expression expr;
- string id;
+ Expression member_lookup;
+ Location loc;
- public MemberAccess (Expression expr, string id)
+ public MemberAccess (Expression expr, string id, Location l)
{
this.expr = expr;
- this.id = id;
+ Identifier = id;
+ loc = l;
}
public Expression Expr {
@@ -427,73 +4793,1288 @@ namespace CIR {
}
}
- public string Identifier {
- get {
- return id;
+ static void error176 (Location loc, string name)
+ {
+ Report.Error (176, loc, "Static member `" +
+ name + "' cannot be accessed " +
+ "with an instance reference, qualify with a " +
+ "type name instead");
+ }
+
+ static bool IdenticalNameAndTypeName (EmitContext ec, Expression left_original, Location loc)
+ {
+ if (left_original == null)
+ return false;
+
+ if (!(left_original is SimpleName))
+ return false;
+
+ SimpleName sn = (SimpleName) left_original;
+
+ Type t = RootContext.LookupType (ec.DeclSpace, sn.Name, true, loc);
+ if (t != null)
+ return true;
+
+ return false;
+ }
+
+ public static Expression ResolveMemberAccess (EmitContext ec, Expression member_lookup,
+ Expression left, Location loc,
+ Expression left_original)
+ {
+ //
+ // Method Groups
+ //
+ if (member_lookup is MethodGroupExpr){
+ MethodGroupExpr mg = (MethodGroupExpr) member_lookup;
+
+ //
+ // Type.MethodGroup
+ //
+ if (left is TypeExpr){
+ if (!mg.RemoveInstanceMethods ()){
+ SimpleName.Error120 (loc, mg.Methods [0].Name);
+ return null;
+ }
+
+ return member_lookup;
+ }
+
+ //
+ // Instance.MethodGroup
+ //
+ if (IdenticalNameAndTypeName (ec, left_original, loc)){
+ if (mg.RemoveInstanceMethods ())
+ return member_lookup;
+ }
+
+ if (!mg.RemoveStaticMethods ()){
+ error176 (loc, mg.Methods [0].Name);
+ return null;
+ }
+
+ mg.InstanceExpression = left;
+ return member_lookup;
+#if ORIGINAL
+ if (!mg.RemoveStaticMethods ()){
+ if (IdenticalNameAndTypeName (ec, left_original, loc)){
+ if (!mg.RemoveInstanceMethods ()){
+ SimpleName.Error120 (loc, mg.Methods [0].Name);
+ return null;
+ }
+ return member_lookup;
+ }
+
+ error176 (loc, mg.Methods [0].Name);
+ return null;
+ }
+
+ mg.InstanceExpression = left;
+
+ return member_lookup;
+#endif
+ }
+
+ if (member_lookup is FieldExpr){
+ FieldExpr fe = (FieldExpr) member_lookup;
+ FieldInfo fi = fe.FieldInfo;
+ Type decl_type = fi.DeclaringType;
+
+ if (fi is FieldBuilder) {
+ Const c = TypeManager.LookupConstant ((FieldBuilder) fi);
+
+ if (c != null) {
+ object o = c.LookupConstantValue (ec);
+ object real_value = ((Constant) c.Expr).GetValue ();
+
+ return Constantify (real_value, fi.FieldType);
+ }
+ }
+
+ if (fi.IsLiteral) {
+ Type t = fi.FieldType;
+
+ object o;
+
+ if (fi is FieldBuilder)
+ o = TypeManager.GetValue ((FieldBuilder) fi);
+ else
+ o = fi.GetValue (fi);
+
+ if (decl_type.IsSubclassOf (TypeManager.enum_type)) {
+ Expression enum_member = MemberLookup (
+ ec, decl_type, "value__", MemberTypes.Field,
+ AllBindingFlags, loc);
+
+ Enum en = TypeManager.LookupEnum (decl_type);
+
+ Constant c;
+ if (en != null)
+ c = Constantify (o, en.UnderlyingType);
+ else
+ c = Constantify (o, enum_member.Type);
+
+ return new EnumConstant (c, decl_type);
+ }
+
+ Expression exp = Constantify (o, t);
+
+ if (!(left is TypeExpr)) {
+ error176 (loc, fe.FieldInfo.Name);
+ return null;
+ }
+
+ return exp;
+ }
+
+ if (fi.FieldType.IsPointer && !ec.InUnsafe){
+ UnsafeError (loc);
+ return null;
+ }
+
+ if (left is TypeExpr){
+ // and refers to a type name or an
+ if (!fe.FieldInfo.IsStatic){
+ error176 (loc, fe.FieldInfo.Name);
+ return null;
+ }
+ return member_lookup;
+ } else {
+ if (fe.FieldInfo.IsStatic){
+ if (IdenticalNameAndTypeName (ec, left_original, loc))
+ return member_lookup;
+
+ error176 (loc, fe.FieldInfo.Name);
+ return null;
+ }
+ fe.InstanceExpression = left;
+
+ return fe;
+ }
+ }
+
+ if (member_lookup is PropertyExpr){
+ PropertyExpr pe = (PropertyExpr) member_lookup;
+
+ if (left is TypeExpr){
+ if (!pe.IsStatic){
+ SimpleName.Error120 (loc, pe.PropertyInfo.Name);
+ return null;
+ }
+ return pe;
+ } else {
+ if (pe.IsStatic){
+ if (IdenticalNameAndTypeName (ec, left_original, loc))
+ return member_lookup;
+ error176 (loc, pe.PropertyInfo.Name);
+ return null;
+ }
+ pe.InstanceExpression = left;
+
+ return pe;
+ }
+ }
+
+ if (member_lookup is EventExpr) {
+
+ EventExpr ee = (EventExpr) member_lookup;
+
+ //
+ // If the event is local to this class, we transform ourselves into
+ // a FieldExpr
+ //
+
+ Expression ml = MemberLookup (
+ ec, ec.ContainerType,
+ ee.EventInfo.Name, MemberTypes.Event, AllBindingFlags, loc);
+
+ if (ml != null) {
+ MemberInfo mi = ec.TypeContainer.GetFieldFromEvent ((EventExpr) ml);
+
+ if (mi == null) {
+ //
+ // If this happens, then we have an event with its own
+ // accessors and private field etc so there's no need
+ // to transform ourselves : we should instead flag an error
+ //
+ Assign.error70 (ee.EventInfo, loc);
+ return null;
+ }
+
+ ml = ExprClassFromMemberInfo (ec, mi, loc);
+
+ if (ml == null) {
+ Report.Error (-200, loc, "Internal error!!");
+ return null;
+ }
+ return ResolveMemberAccess (ec, ml, left, loc, left_original);
+ }
+
+ if (left is TypeExpr) {
+ if (!ee.IsStatic) {
+ SimpleName.Error120 (loc, ee.EventInfo.Name);
+ return null;
+ }
+
+ return ee;
+
+ } else {
+ if (ee.IsStatic) {
+ if (IdenticalNameAndTypeName (ec, left_original, loc))
+ return ee;
+
+ error176 (loc, ee.EventInfo.Name);
+ return null;
+ }
+
+ ee.InstanceExpression = left;
+
+ return ee;
+ }
+ }
+
+ if (member_lookup is TypeExpr){
+ member_lookup.Resolve (ec);
+ return member_lookup;
+ }
+
+ Console.WriteLine ("Left is: " + left);
+ Report.Error (-100, loc, "Support for [" + member_lookup + "] is not present yet");
+ Environment.Exit (0);
+ return null;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ //
+ // We are the sole users of ResolveWithSimpleName (ie, the only
+ // ones that can cope with it
+ //
+ Expression original = expr;
+ expr = expr.ResolveWithSimpleName (ec);
+
+ if (expr == null)
+ return null;
+
+ if (expr is SimpleName){
+ SimpleName child_expr = (SimpleName) expr;
+
+ expr = new SimpleName (child_expr.Name + "." + Identifier, loc);
+
+ return expr.ResolveWithSimpleName (ec);
+ }
+
+ //
+ // TODO: I mailed Ravi about this, and apparently we can get rid
+ // of this and put it in the right place.
+ //
+ // Handle enums here when they are in transit.
+ // Note that we cannot afford to hit MemberLookup in this case because
+ // it will fail to find any members at all
+ //
+
+ Type expr_type = expr.Type;
+ if ((expr is TypeExpr) && (expr_type.IsSubclassOf (TypeManager.enum_type))){
+
+ Enum en = TypeManager.LookupEnum (expr_type);
+
+ if (en != null) {
+ object value = en.LookupEnumValue (ec, Identifier, loc);
+
+ if (value != null){
+ Constant c = Constantify (value, en.UnderlyingType);
+ return new EnumConstant (c, expr_type);
+ }
+ }
+ }
+
+ if (expr_type.IsPointer){
+ Report.Error (23, loc,
+ "The `.' operator can not be applied to pointer operands (" +
+ TypeManager.CSharpName (expr_type) + ")");
+ return null;
+ }
+
+ member_lookup = MemberLookup (ec, expr_type, Identifier, loc);
+
+ if (member_lookup == null){
+ Report.Error (117, loc, "`" + expr_type + "' does not contain a " +
+ "definition for `" + Identifier + "'");
+
+ return null;
}
+
+ return ResolveMemberAccess (ec, member_lookup, expr, loc, original);
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ throw new Exception ("Should not happen");
}
}
- public class BuiltinTypeAccess : Expression {
- TypeRef access_base;
- string method;
+ /// <summary>
+ /// Implements checked expressions
+ /// </summary>
+ public class CheckedExpr : Expression {
+
+ public Expression Expr;
+
+ public CheckedExpr (Expression e)
+ {
+ Expr = e;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ bool last_const_check = ec.ConstantCheckState;
+
+ ec.ConstantCheckState = true;
+ Expr = Expr.Resolve (ec);
+ ec.ConstantCheckState = last_const_check;
+
+ if (Expr == null)
+ return null;
+
+ eclass = Expr.eclass;
+ type = Expr.Type;
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ bool last_check = ec.CheckState;
+ bool last_const_check = ec.ConstantCheckState;
+
+ ec.CheckState = true;
+ ec.ConstantCheckState = true;
+ Expr.Emit (ec);
+ ec.CheckState = last_check;
+ ec.ConstantCheckState = last_const_check;
+ }
- public BuiltinTypeAccess (TypeRef typeref, string method)
+ }
+
+ /// <summary>
+ /// Implements the unchecked expression
+ /// </summary>
+ public class UnCheckedExpr : Expression {
+
+ public Expression Expr;
+
+ public UnCheckedExpr (Expression e)
{
- System.Console.WriteLine ("DUDE! This TypeRef should be fully resolved!");
- this.access_base = access_base;
- this.method = method;
+ Expr = e;
}
- public Type AccessBase {
- get {
- return access_base.Type;
- }
+ public override Expression DoResolve (EmitContext ec)
+ {
+ bool last_const_check = ec.ConstantCheckState;
+
+ ec.ConstantCheckState = false;
+ Expr = Expr.Resolve (ec);
+ ec.ConstantCheckState = last_const_check;
+
+ if (Expr == null)
+ return null;
+
+ eclass = Expr.eclass;
+ type = Expr.Type;
+ return this;
}
- public string Method {
- get {
- return method;
- }
+ public override void Emit (EmitContext ec)
+ {
+ bool last_check = ec.CheckState;
+ bool last_const_check = ec.ConstantCheckState;
+
+ ec.CheckState = false;
+ ec.ConstantCheckState = false;
+ Expr.Emit (ec);
+ ec.CheckState = last_check;
+ ec.ConstantCheckState = last_const_check;
}
+
}
- public class MethodGroup : Expression {
- Hashtable signatures;
- string name;
+ /// <summary>
+ /// An Element Access expression.
+ ///
+ /// During semantic analysis these are transformed into
+ /// IndexerAccess or ArrayAccess
+ /// </summary>
+ public class ElementAccess : Expression {
+ public ArrayList Arguments;
+ public Expression Expr;
+ public Location loc;
- public MethodGroup (string name)
+ public ElementAccess (Expression e, ArrayList e_list, Location l)
{
- signatures = new Hashtable ();
- this.name = name;
+ Expr = e;
+
+ loc = l;
+
+ if (e_list == null)
+ return;
+
+ Arguments = new ArrayList ();
+ foreach (Expression tmp in e_list)
+ Arguments.Add (new Argument (tmp, Argument.AType.Expression));
+
}
- public bool Add (Method method)
+ bool CommonResolve (EmitContext ec)
{
- string sig = method.ArgumentSignature;
+ Expr = Expr.Resolve (ec);
- if (signatures.Contains (sig))
+ if (Expr == null)
return false;
- signatures.Add (sig, method);
+ if (Arguments == null)
+ return false;
+
+ for (int i = Arguments.Count; i > 0;){
+ --i;
+ Argument a = (Argument) Arguments [i];
+
+ if (!a.Resolve (ec, loc))
+ return false;
+ }
+
return true;
}
- public string Name {
- get {
- return name;
+ Expression MakePointerAccess ()
+ {
+ Type t = Expr.Type;
+
+ if (t == TypeManager.void_ptr_type){
+ Report.Error (
+ 242, loc,
+ "The array index operation is not valid for void pointers");
+ return null;
+ }
+ if (Arguments.Count != 1){
+ Report.Error (
+ 196, loc,
+ "A pointer must be indexed by a single value");
+ return null;
}
+ Expression p = new PointerArithmetic (true, Expr, ((Argument)Arguments [0]).Expr, t);
+ return new Indirection (p);
}
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ if (!CommonResolve (ec))
+ return null;
- public Hashtable Methods {
- get {
- return signatures;
+ //
+ // We perform some simple tests, and then to "split" the emit and store
+ // code we create an instance of a different class, and return that.
+ //
+ // I am experimenting with this pattern.
+ //
+ Type t = Expr.Type;
+
+ if (t.IsSubclassOf (TypeManager.array_type))
+ return (new ArrayAccess (this)).Resolve (ec);
+ else if (t.IsPointer)
+ return MakePointerAccess ();
+ else
+ return (new IndexerAccess (this)).Resolve (ec);
+ }
+
+ public override Expression DoResolveLValue (EmitContext ec, Expression right_side)
+ {
+ if (!CommonResolve (ec))
+ return null;
+
+ Type t = Expr.Type;
+ if (t.IsSubclassOf (TypeManager.array_type))
+ return (new ArrayAccess (this)).ResolveLValue (ec, right_side);
+ else if (t.IsPointer)
+ return MakePointerAccess ();
+ else
+ return (new IndexerAccess (this)).ResolveLValue (ec, right_side);
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ throw new Exception ("Should never be reached");
+ }
+ }
+
+ /// <summary>
+ /// Implements array access
+ /// </summary>
+ public class ArrayAccess : Expression, IAssignMethod, IMemoryLocation {
+ //
+ // Points to our "data" repository
+ //
+ ElementAccess ea;
+
+ public ArrayAccess (ElementAccess ea_data)
+ {
+ ea = ea_data;
+ eclass = ExprClass.Variable;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ if (ea.Expr.eclass != ExprClass.Variable) {
+ report118 (ea.loc, ea.Expr, "variable");
+ return null;
+ }
+
+ Type t = ea.Expr.Type;
+ if (t.GetArrayRank () != ea.Arguments.Count){
+ Report.Error (22, ea.loc,
+ "Incorrect number of indexes for array " +
+ " expected: " + t.GetArrayRank () + " got: " +
+ ea.Arguments.Count);
+ return null;
+ }
+ type = t.GetElementType ();
+ if (type.IsPointer && !ec.InUnsafe){
+ UnsafeError (ea.loc);
+ return null;
+ }
+
+ eclass = ExprClass.Variable;
+
+ return this;
+ }
+
+ /// <summary>
+ /// Emits the right opcode to load an object of Type `t'
+ /// from an array of T
+ /// </summary>
+ static public void EmitLoadOpcode (ILGenerator ig, Type type)
+ {
+ if (type == TypeManager.byte_type || type == TypeManager.bool_type)
+ ig.Emit (OpCodes.Ldelem_I1);
+ else if (type == TypeManager.sbyte_type)
+ ig.Emit (OpCodes.Ldelem_U1);
+ else if (type == TypeManager.short_type)
+ ig.Emit (OpCodes.Ldelem_I2);
+ else if (type == TypeManager.ushort_type)
+ ig.Emit (OpCodes.Ldelem_U2);
+ else if (type == TypeManager.int32_type)
+ ig.Emit (OpCodes.Ldelem_I4);
+ else if (type == TypeManager.uint32_type)
+ ig.Emit (OpCodes.Ldelem_U4);
+ else if (type == TypeManager.uint64_type)
+ ig.Emit (OpCodes.Ldelem_I8);
+ else if (type == TypeManager.int64_type)
+ ig.Emit (OpCodes.Ldelem_I8);
+ else if (type == TypeManager.float_type)
+ ig.Emit (OpCodes.Ldelem_R4);
+ else if (type == TypeManager.double_type)
+ ig.Emit (OpCodes.Ldelem_R8);
+ else if (type == TypeManager.intptr_type)
+ ig.Emit (OpCodes.Ldelem_I);
+ else if (type.IsValueType){
+ ig.Emit (OpCodes.Ldelema, type);
+ ig.Emit (OpCodes.Ldobj, type);
+ } else
+ ig.Emit (OpCodes.Ldelem_Ref);
+ }
+
+ /// <summary>
+ /// Emits the right opcode to store an object of Type `t'
+ /// from an array of T.
+ /// </summary>
+ static public void EmitStoreOpcode (ILGenerator ig, Type t)
+ {
+ if (t == TypeManager.byte_type || t == TypeManager.sbyte_type ||
+ t == TypeManager.bool_type)
+ ig.Emit (OpCodes.Stelem_I1);
+ else if (t == TypeManager.short_type || t == TypeManager.ushort_type || t == TypeManager.char_type)
+ ig.Emit (OpCodes.Stelem_I2);
+ else if (t == TypeManager.int32_type || t == TypeManager.uint32_type)
+ ig.Emit (OpCodes.Stelem_I4);
+ else if (t == TypeManager.int64_type || t == TypeManager.uint64_type)
+ ig.Emit (OpCodes.Stelem_I8);
+ else if (t == TypeManager.float_type)
+ ig.Emit (OpCodes.Stelem_R4);
+ else if (t == TypeManager.double_type)
+ ig.Emit (OpCodes.Stelem_R8);
+ else if (t == TypeManager.intptr_type)
+ ig.Emit (OpCodes.Stelem_I);
+ else if (t.IsValueType)
+ ig.Emit (OpCodes.Stobj, t);
+ else
+ ig.Emit (OpCodes.Stelem_Ref);
+ }
+
+ MethodInfo FetchGetMethod ()
+ {
+ ModuleBuilder mb = CodeGen.ModuleBuilder;
+ int arg_count = ea.Arguments.Count;
+ Type [] args = new Type [arg_count];
+ MethodInfo get;
+
+ for (int i = 0; i < arg_count; i++){
+ //args [i++] = a.Type;
+ args [i] = TypeManager.int32_type;
+ }
+
+ get = mb.GetArrayMethod (
+ ea.Expr.Type, "Get",
+ CallingConventions.HasThis |
+ CallingConventions.Standard,
+ type, args);
+ return get;
+ }
+
+
+ MethodInfo FetchAddressMethod ()
+ {
+ ModuleBuilder mb = CodeGen.ModuleBuilder;
+ int arg_count = ea.Arguments.Count;
+ Type [] args = new Type [arg_count];
+ MethodInfo address;
+ string ptr_type_name;
+ Type ret_type;
+
+ ptr_type_name = type.FullName + "&";
+ ret_type = Type.GetType (ptr_type_name);
+
+ //
+ // It is a type defined by the source code we are compiling
+ //
+ if (ret_type == null){
+ ret_type = mb.GetType (ptr_type_name);
+ }
+
+ for (int i = 0; i < arg_count; i++){
+ //args [i++] = a.Type;
+ args [i] = TypeManager.int32_type;
+ }
+
+ address = mb.GetArrayMethod (
+ ea.Expr.Type, "Address",
+ CallingConventions.HasThis |
+ CallingConventions.Standard,
+ ret_type, args);
+
+ return address;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ int rank = ea.Expr.Type.GetArrayRank ();
+ ILGenerator ig = ec.ig;
+
+ ea.Expr.Emit (ec);
+
+ foreach (Argument a in ea.Arguments)
+ a.Expr.Emit (ec);
+
+ if (rank == 1)
+ EmitLoadOpcode (ig, type);
+ else {
+ MethodInfo method;
+
+ method = FetchGetMethod ();
+ ig.Emit (OpCodes.Call, method);
+ }
+ }
+
+ public void EmitAssign (EmitContext ec, Expression source)
+ {
+ int rank = ea.Expr.Type.GetArrayRank ();
+ ILGenerator ig = ec.ig;
+
+ ea.Expr.Emit (ec);
+
+ foreach (Argument a in ea.Arguments)
+ a.Expr.Emit (ec);
+
+ Type t = source.Type;
+
+ //
+ // The stobj opcode used by value types will need
+ // an address on the stack, not really an array/array
+ // pair
+ //
+ if (rank == 1){
+ if (t.IsValueType && !TypeManager.IsBuiltinType (t))
+ ig.Emit (OpCodes.Ldelema, t);
+ }
+
+ source.Emit (ec);
+
+ if (rank == 1)
+ EmitStoreOpcode (ig, t);
+ else {
+ ModuleBuilder mb = CodeGen.ModuleBuilder;
+ int arg_count = ea.Arguments.Count;
+ Type [] args = new Type [arg_count + 1];
+ MethodInfo set;
+
+ for (int i = 0; i < arg_count; i++){
+ //args [i++] = a.Type;
+ args [i] = TypeManager.int32_type;
+ }
+
+ args [arg_count] = type;
+
+ set = mb.GetArrayMethod (
+ ea.Expr.Type, "Set",
+ CallingConventions.HasThis |
+ CallingConventions.Standard,
+ TypeManager.void_type, args);
+
+ ig.Emit (OpCodes.Call, set);
+ }
+ }
+
+ public void AddressOf (EmitContext ec, AddressOp mode)
+ {
+ int rank = ea.Expr.Type.GetArrayRank ();
+ ILGenerator ig = ec.ig;
+
+ ea.Expr.Emit (ec);
+
+ foreach (Argument a in ea.Arguments)
+ a.Expr.Emit (ec);
+
+ if (rank == 1){
+ ig.Emit (OpCodes.Ldelema, type);
+ } else {
+ MethodInfo address = FetchAddressMethod ();
+ ig.Emit (OpCodes.Call, address);
}
}
}
-}
+
+ class Indexers {
+ public ArrayList getters, setters;
+ static Hashtable map;
+
+ static Indexers ()
+ {
+ map = new Hashtable ();
+ }
+
+ Indexers (MemberInfo [] mi)
+ {
+ foreach (PropertyInfo property in mi){
+ MethodInfo get, set;
+
+ get = property.GetGetMethod (true);
+ if (get != null){
+ if (getters == null)
+ getters = new ArrayList ();
+
+ getters.Add (get);
+ }
+
+ set = property.GetSetMethod (true);
+ if (set != null){
+ if (setters == null)
+ setters = new ArrayList ();
+ setters.Add (set);
+ }
+ }
+ }
+
+ static public Indexers GetIndexersForType (Type t, Location loc)
+ {
+ Indexers ix = (Indexers) map [t];
+ string p_name = TypeManager.IndexerPropertyName (t);
+
+ if (ix != null)
+ return ix;
+
+ MemberInfo [] mi = TypeManager.FindMembers (
+ t, MemberTypes.Property,
+ BindingFlags.Public | BindingFlags.Instance,
+ Type.FilterName, p_name);
+
+ if (mi == null || mi.Length == 0){
+ Report.Error (21, loc,
+ "Type `" + TypeManager.CSharpName (t) + "' does not have " +
+ "any indexers defined");
+ return null;
+ }
+
+ ix = new Indexers (mi);
+ map [t] = ix;
+
+ return ix;
+ }
+ }
+
+ /// <summary>
+ /// Expressions that represent an indexer call.
+ /// </summary>
+ public class IndexerAccess : Expression, IAssignMethod {
+ //
+ // Points to our "data" repository
+ //
+ ElementAccess ea;
+ MethodInfo get, set;
+ Indexers ilist;
+ ArrayList set_arguments;
+
+ public IndexerAccess (ElementAccess ea_data)
+ {
+ ea = ea_data;
+ eclass = ExprClass.Value;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ Type indexer_type = ea.Expr.Type;
+
+ //
+ // Step 1: Query for all `Item' *properties*. Notice
+ // that the actual methods are pointed from here.
+ //
+ // This is a group of properties, piles of them.
+
+ if (ilist == null)
+ ilist = Indexers.GetIndexersForType (
+ indexer_type, ea.loc);
+
+
+ //
+ // Step 2: find the proper match
+ //
+ if (ilist != null && ilist.getters != null && ilist.getters.Count > 0){
+ Location loc = ea.loc;
+
+ get = (MethodInfo) Invocation.OverloadResolve (
+ ec, new MethodGroupExpr (ilist.getters, loc), ea.Arguments, loc);
+ }
+
+ if (get == null){
+ Report.Error (154, ea.loc,
+ "indexer can not be used in this context, because " +
+ "it lacks a `get' accessor");
+ return null;
+ }
+
+ type = get.ReturnType;
+ if (type.IsPointer && !ec.InUnsafe){
+ UnsafeError (ea.loc);
+ return null;
+ }
+
+ eclass = ExprClass.IndexerAccess;
+ return this;
+ }
+
+ public override Expression DoResolveLValue (EmitContext ec, Expression right_side)
+ {
+ Type indexer_type = ea.Expr.Type;
+ Type right_type = right_side.Type;
+
+ if (ilist == null)
+ ilist = Indexers.GetIndexersForType (
+ indexer_type, ea.loc);
+
+ if (ilist != null && ilist.setters != null && ilist.setters.Count > 0){
+ Location loc = ea.loc;
+
+ set_arguments = (ArrayList) ea.Arguments.Clone ();
+ set_arguments.Add (new Argument (right_side, Argument.AType.Expression));
+
+ set = (MethodInfo) Invocation.OverloadResolve (
+ ec, new MethodGroupExpr (ilist.setters, loc), set_arguments, loc);
+ }
+
+ if (set == null){
+ Report.Error (200, ea.loc,
+ "indexer X.this [" + TypeManager.CSharpName (right_type) +
+ "] lacks a `set' accessor");
+ return null;
+ }
+
+ type = TypeManager.void_type;
+ eclass = ExprClass.IndexerAccess;
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ Invocation.EmitCall (ec, false, false, ea.Expr, get, ea.Arguments);
+ }
+
+ //
+ // source is ignored, because we already have a copy of it from the
+ // LValue resolution and we have already constructed a pre-cached
+ // version of the arguments (ea.set_arguments);
+ //
+ public void EmitAssign (EmitContext ec, Expression source)
+ {
+ Invocation.EmitCall (ec, false, false, ea.Expr, set, set_arguments);
+ }
+ }
+
+ /// <summary>
+ /// The base operator for method names
+ /// </summary>
+ public class BaseAccess : Expression {
+ string member;
+ Location loc;
+
+ public BaseAccess (string member, Location l)
+ {
+ this.member = member;
+ loc = l;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ Expression member_lookup;
+ Type current_type = ec.ContainerType;
+ Type base_type = current_type.BaseType;
+ Expression e;
+
+ if (ec.IsStatic){
+ Report.Error (1511, loc,
+ "Keyword base is not allowed in static method");
+ return null;
+ }
+
+ member_lookup = MemberLookup (ec, base_type, member, loc);
+ if (member_lookup == null)
+ return null;
+
+ Expression left;
+
+ if (ec.IsStatic)
+ left = new TypeExpr (base_type);
+ else
+ left = ec.This;
+
+ e = MemberAccess.ResolveMemberAccess (ec, member_lookup, left, loc, null);
+ if (e is PropertyExpr){
+ PropertyExpr pe = (PropertyExpr) e;
+
+ pe.IsBase = true;
+ }
+
+ return e;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ throw new Exception ("Should never be called");
+ }
+ }
+
+ /// <summary>
+ /// The base indexer operator
+ /// </summary>
+ public class BaseIndexerAccess : Expression {
+ ArrayList Arguments;
+ Location loc;
+
+ public BaseIndexerAccess (ArrayList args, Location l)
+ {
+ Arguments = args;
+ loc = l;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ Type current_type = ec.ContainerType;
+ Type base_type = current_type.BaseType;
+ Expression member_lookup;
+
+ if (ec.IsStatic){
+ Report.Error (1511, loc,
+ "Keyword base is not allowed in static method");
+ return null;
+ }
+
+ member_lookup = MemberLookup (ec, base_type, "get_Item", MemberTypes.Method, AllBindingFlags, loc);
+ if (member_lookup == null)
+ return null;
+ return MemberAccess.ResolveMemberAccess (ec, member_lookup, ec.This, loc, null);
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ throw new Exception ("Should never be called");
+ }
+ }
+
+ /// <summary>
+ /// This class exists solely to pass the Type around and to be a dummy
+ /// that can be passed to the conversion functions (this is used by
+ /// foreach implementation to typecast the object return value from
+ /// get_Current into the proper type. All code has been generated and
+ /// we only care about the side effect conversions to be performed
+ ///
+ /// This is also now used as a placeholder where a no-action expression
+ /// is needed (the `New' class).
+ /// </summary>
+ public class EmptyExpression : Expression {
+ public EmptyExpression ()
+ {
+ type = TypeManager.object_type;
+ eclass = ExprClass.Value;
+ }
+ public EmptyExpression (Type t)
+ {
+ type = t;
+ eclass = ExprClass.Value;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ return this;
+ }
+ public override void Emit (EmitContext ec)
+ {
+ // nothing, as we only exist to not do anything.
+ }
+ //
+ // This is just because we might want to reuse this bad boy
+ // instead of creating gazillions of EmptyExpressions.
+ // (CanConvertImplicit uses it)
+ //
+ public void SetType (Type t)
+ {
+ type = t;
+ }
+ }
+
+ public class UserCast : Expression {
+ MethodBase method;
+ Expression source;
+
+ public UserCast (MethodInfo method, Expression source)
+ {
+ this.method = method;
+ this.source = source;
+ type = method.ReturnType;
+ eclass = ExprClass.Value;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ //
+ // We are born fully resolved
+ //
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+
+ source.Emit (ec);
+
+ if (method is MethodInfo)
+ ig.Emit (OpCodes.Call, (MethodInfo) method);
+ else
+ ig.Emit (OpCodes.Call, (ConstructorInfo) method);
+
+ }
+ }
+
+ // <summary>
+ // This class is used to "construct" the type during a typecast
+ // operation. Since the Type.GetType class in .NET can parse
+ // the type specification, we just use this to construct the type
+ // one bit at a time.
+ // </summary>
+ public class ComposedCast : Expression {
+ Expression left;
+ string dim;
+ Location loc;
+
+ public ComposedCast (Expression left, string dim, Location l)
+ {
+ this.left = left;
+ this.dim = dim;
+ loc = l;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ left = left.Resolve (ec);
+ if (left == null)
+ return null;
+
+ if (left.eclass != ExprClass.Type){
+ report118 (loc, left, "type");
+ return null;
+ }
+
+ type = RootContext.LookupType (
+ ec.DeclSpace, left.Type.FullName + dim, false, loc);
+ if (type == null)
+ return null;
+
+ if (!ec.InUnsafe && type.IsPointer){
+ UnsafeError (loc);
+ return null;
+ }
+
+ eclass = ExprClass.Type;
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ throw new Exception ("This should never be called");
+ }
+ }
+
+ //
+ // This class is used to represent the address of an array, used
+ // only by the Fixed statement, this is like the C "&a [0]" construct.
+ //
+ public class ArrayPtr : Expression {
+ Expression array;
+
+ public ArrayPtr (Expression array)
+ {
+ Type array_type = array.Type.GetElementType ();
+
+ this.array = array;
+
+ string array_ptr_type_name = array_type.FullName + "*";
+
+ type = Type.GetType (array_ptr_type_name);
+ if (type == null){
+ ModuleBuilder mb = CodeGen.ModuleBuilder;
+
+ type = mb.GetType (array_ptr_type_name);
+ }
+
+ eclass = ExprClass.Value;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+
+ array.Emit (ec);
+ IntLiteral.EmitInt (ig, 0);
+ ig.Emit (OpCodes.Ldelema, array.Type.GetElementType ());
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ //
+ // We are born fully resolved
+ //
+ return this;
+ }
+ }
+
+ //
+ // Used by the fixed statement
+ //
+ public class StringPtr : Expression {
+ LocalBuilder b;
+
+ public StringPtr (LocalBuilder b)
+ {
+ this.b = b;
+ eclass = ExprClass.Value;
+ type = TypeManager.char_ptr_type;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ // This should never be invoked, we are born in fully
+ // initialized state.
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+
+ ig.Emit (OpCodes.Ldloc, b);
+ ig.Emit (OpCodes.Conv_I);
+ ig.Emit (OpCodes.Call, TypeManager.int_get_offset_to_string_data);
+ ig.Emit (OpCodes.Add);
+ }
+ }
+
+ //
+ // Implements the `stackalloc' keyword
+ //
+ public class StackAlloc : Expression {
+ Type otype;
+ string t;
+ Expression count;
+ Location loc;
+
+ public StackAlloc (string type, Expression count, Location l)
+ {
+ t = type;
+ this.count = count;
+ loc = l;
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ count = count.Resolve (ec);
+ if (count == null)
+ return null;
+
+ if (count.Type != TypeManager.int32_type){
+ count = ConvertImplicitRequired (ec, count, TypeManager.int32_type, loc);
+ if (count == null)
+ return null;
+ }
+
+ if (ec.InCatch || ec.InFinally){
+ Report.Error (255, loc,
+ "stackalloc can not be used in a catch or finally block");
+ return null;
+ }
+
+ otype = RootContext.LookupType (ec.DeclSpace, t, false, loc);
+
+ if (otype == null)
+ return null;
+
+ if (!TypeManager.VerifyUnManaged (otype, loc))
+ return null;
+
+ string ptr_name = otype.FullName + "*";
+ type = Type.GetType (ptr_name);
+ if (type == null){
+ ModuleBuilder mb = CodeGen.ModuleBuilder;
+
+ type = mb.GetType (ptr_name);
+ }
+ eclass = ExprClass.Value;
+
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ int size = GetTypeSize (otype);
+ ILGenerator ig = ec.ig;
+
+ if (size == 0)
+ ig.Emit (OpCodes.Sizeof, otype);
+ else
+ IntConstant.EmitInt (ig, size);
+ count.Emit (ec);
+ ig.Emit (OpCodes.Mul);
+ ig.Emit (OpCodes.Localloc);
+ }
+ }
+}
diff --git a/mcs/mcs/gen-il.cs b/mcs/mcs/gen-il.cs
index d365441fb99..2dfeecc974c 100755
--- a/mcs/mcs/gen-il.cs
+++ b/mcs/mcs/gen-il.cs
@@ -14,7 +14,7 @@ using CIR;
namespace MSIL {
- public class Generator : CIR.IGenerator {
+ public class Generator : CIR.ITreeDump {
StreamWriter o;
int indent = 0;
diff --git a/mcs/mcs/gen-treedump.cs b/mcs/mcs/gen-treedump.cs
index b7a6bf1fc6c..8ad20e812d7 100755
--- a/mcs/mcs/gen-treedump.cs
+++ b/mcs/mcs/gen-treedump.cs
@@ -18,7 +18,7 @@ using CIR;
namespace Generator {
- public class TreeDump : CIR.IGenerator {
+ public class TreeDump : CIR.ITreeDump {
StreamWriter o;
int indent;
bool indented;
@@ -55,11 +55,6 @@ namespace Generator {
output (s);
}
- string GetType (Type type)
- {
- return type.Name;
- }
-
string GetParameter (Parameter par)
{
Parameter.Modifier f = par.ModFlags;
@@ -75,7 +70,7 @@ namespace Generator {
case Parameter.Modifier.NONE:
mod = ""; break;
}
- return mod + GetType (par.Type) + " " + par.Name;
+ return mod + par.Type + " " + par.Name;
}
string GetUnary (Unary u, int paren_level)
@@ -86,22 +81,22 @@ namespace Generator {
int prec = 0;
switch (u.Oper){
- case Unary.Operator.Plus:
+ case Unary.Operator.UnaryPlus:
prec = 10;
s = "+";
break;
- case Unary.Operator.Minus:
+ case Unary.Operator.UnaryNegation:
prec = 10;
s = "-";
break;
- case Unary.Operator.Negate:
+ case Unary.Operator.LogicalNot:
s = "!";
prec = 10;
break;
- case Unary.Operator.BitComplement:
+ case Unary.Operator.OnesComplement:
prec = 10;
s = "~";
break;
@@ -163,27 +158,27 @@ namespace Generator {
prec = 9;
op = "*"; break;
- case Binary.Operator.Divide:
+ case Binary.Operator.Division:
prec = 9;
op = "/"; break;
- case Binary.Operator.Modulo:
+ case Binary.Operator.Modulus:
prec = 9;
op = "%"; break;
- case Binary.Operator.Add:
+ case Binary.Operator.Addition:
prec = 8;
op = "+"; break;
- case Binary.Operator.Substract:
+ case Binary.Operator.Subtraction:
prec = 8;
op = "-"; break;
- case Binary.Operator.ShiftLeft:
+ case Binary.Operator.LeftShift:
prec = 7;
op = "<<"; break;
- case Binary.Operator.ShiftRight:
+ case Binary.Operator.RightShift:
prec = 7;
op = ">>"; break;
@@ -191,23 +186,23 @@ namespace Generator {
prec = 6;
op = "<"; break;
- case Binary.Operator.GreatherThan:
+ case Binary.Operator.GreaterThan:
prec = 6;
op = ">"; break;
- case Binary.Operator.LessOrEqual:
+ case Binary.Operator.LessThanOrEqual:
prec = 6;
op = "<="; break;
- case Binary.Operator.GreatherOrEqual:
+ case Binary.Operator.GreaterThanOrEqual:
prec = 6;
op = ">="; break;
- case Binary.Operator.Equal:
+ case Binary.Operator.Equality:
prec = 5;
op = "=="; break;
- case Binary.Operator.NotEqual:
+ case Binary.Operator.Inequality:
prec = 5;
op = "!="; break;
@@ -243,7 +238,7 @@ namespace Generator {
string GetCast (Cast c)
{
- return "(" + c.TargetType.Name + ") (" + GetExpression (c.Expr, 0) + ")";
+ return "(" + c.TargetType + ") (" + GetExpression (c.Expr, 0) + ")";
}
string GetConditional (Conditional c)
@@ -268,7 +263,7 @@ namespace Generator {
for (int i = 0; i < top; i++){
Argument arg = (Argument) args [i];
- switch (arg.Type){
+ switch (arg.ArgType){
case Argument.AType.Ref:
r += "ref "; break;
case Argument.AType.Out:
@@ -291,17 +286,17 @@ namespace Generator {
string GetNew (New n)
{
- return "new " + n.RequestedType.Name + GetArguments (n.Arguments);
+ return "new " + n.RequestedType + GetArguments (n.Arguments);
}
string GetTypeOf (TypeOf t)
{
- return "typeof (" + t.QueriedType.Name + ")";
+ return "typeof (" + t.QueriedType + ")";
}
string GetSizeOf (SizeOf t)
{
- return "sizeof (" + t.QueriedType.Name + ")";
+ return "sizeof (" + t.QueriedType + ")";
}
string GetMemberAccess (MemberAccess m)
@@ -332,7 +327,7 @@ namespace Generator {
else
s += "UNHANDLED";
- s += GetType (p.ProbeType);
+ s += p.ProbeType;
return s;
}
@@ -397,15 +392,15 @@ namespace Generator {
void GenerateParameters (Parameters pars)
{
- ParameterCollection pfixed;
+ Parameter [] pfixed;
Parameter parray;
pfixed = pars.FixedParameters;
if (pfixed != null){
- for (int i = 0; i < pfixed.Count; i++){
- output (GetParameter ((Parameter) pfixed [i]));
- if (i+1 != pfixed.Count)
+ for (int i = 0; i < pfixed.Length; i++){
+ output (GetParameter (pfixed [i]));
+ if (i+1 != pfixed.Length)
output (", ");
}
}
@@ -458,7 +453,7 @@ namespace Generator {
output ("; ");
output (GetExpression (s.Test, 0));
output ("; ");
- if (! (s.InitStatement is EmptyStatement))
+ if (! (s.Increment is EmptyStatement))
GenerateStatement (s.Increment, true, true, true);
output (") ");
GenerateStatement (s.Statement, true, true, false);
@@ -532,7 +527,7 @@ namespace Generator {
output ("catch ");
if (c.Type != null){
- output ("(" + GetType (c.Type) +
+ output ("(" + c.Type +
(c.Name != null ? " " + c.Name : "") + ")");
}
GenerateBlock (c.Block, false, false);
@@ -636,10 +631,12 @@ namespace Generator {
if (b.Variables != null){
foreach (DictionaryEntry entry in b.Variables){
+ VariableInfo vi = (VariableInfo) entry.Value;
+
space ();
output_newline (
- (((CIR.TypeRef)entry.Value).Type).Name + " " +
- (string)entry.Key + ";");
+ vi.Type + " " +
+ (string) entry.Key + ";");
}
newline ();
}
@@ -659,7 +656,7 @@ namespace Generator {
void GenerateMethod (Method m)
{
ioutput (GetModifiers (m.ModFlags) +
- GetType (m.ReturnType) + " " +
+ m.ReturnType + " " +
m.Name + " (");
GenerateParameters (m.Parameters);
output_newline (")");
@@ -669,20 +666,11 @@ namespace Generator {
newline ();
}
- void GenerateMethodGroup (MethodGroup mg)
- {
- foreach (DictionaryEntry de in mg.Methods){
- Method m = (Method) de.Value;
-
- GenerateMethod (m);
- }
- }
-
void GenerateInterfaceMethod (InterfaceMethod imethod)
{
space ();
output (imethod.IsNew ? "new " : "");
- output (GetType (imethod.ReturnType) + " " + imethod.Name + " (");
+ output (imethod.ReturnType + " " + imethod.Name + " (");
GenerateParameters (imethod.Parameters);
output (");");
newline ();
@@ -692,7 +680,7 @@ namespace Generator {
{
space ();
output (iprop.IsNew ? "new " : "");
- output (GetType (iprop.Type) + " " + iprop.Name + " { ");
+ output (iprop.Type + " " + iprop.Name + " { ");
if (iprop.HasGet) output ("get; ");
if (iprop.HasSet) output ("set; ");
output ("}");
@@ -703,7 +691,7 @@ namespace Generator {
{
space ();
output ((ievent.IsNew ? "new " : "") + "event ");
- output (GetType (ievent.Type) + " " + ievent.Name + ";");
+ output (ievent.Type + " " + ievent.Name + ";");
newline ();
}
@@ -711,7 +699,7 @@ namespace Generator {
{
space ();
output (iindexer.IsNew ? "new " : "");
- output (GetType (iindexer.Type) + " this [");
+ output (iindexer.Type + " this [");
output (iindexer.Parameters + "] {");
if (iindexer.HasGet) output ("get; ");
if (iindexer.HasSet) output ("set; ");
@@ -768,7 +756,7 @@ namespace Generator {
{
space ();
output (GetModifiers (f.ModFlags) +
- GetType (f.Type) + " " + f.Name);
+ f.Type + " " + f.Name);
if (f.Initializer != null){
if (f.Initializer is Expression)
output (" = " + GetExpression ((Expression) f.Initializer, 0));
@@ -803,7 +791,7 @@ namespace Generator {
void GenerateProperty (Property prop)
{
space ();
- output (GetModifiers (prop.ModFlags) + GetType (prop.Type) +
+ output (GetModifiers (prop.ModFlags) + prop.Type +
" " + prop.Name + " {");
newline ();
indent++;
@@ -852,12 +840,10 @@ namespace Generator {
void GenerateTypeContainerData (TypeContainer tc)
{
if (tc.Constants != null){
- foreach (DictionaryEntry cde in tc.Constants){
- Constant c = tc.GetConstant ((string) cde.Key);
-
+ foreach (Constant c in tc.Constants){
space ();
- output ("const " + c.ConstantType.Name + " " + c.name + " = " +
+ output ("const " + c.ConstantType + " " + c.Name + " = " +
GetExpression (c.Expr, 0) + ";");
newline ();
}
@@ -865,47 +851,34 @@ namespace Generator {
}
if (tc.Enums != null){
- foreach (DictionaryEntry ede in tc.Enums){
- CIR.Enum e = (CIR.Enum) ede.Value;
-
+ foreach (CIR.Enum e in tc.Enums)
GenerateEnum (e);
- }
}
if (tc.Fields != null){
- foreach (DictionaryEntry de in tc.Fields){
- Field f = (Field) de.Value;
-
+ foreach (Field f in tc.Fields)
GenerateField (f);
- }
newline ();
}
if (tc.Constructors != null){
- foreach (DictionaryEntry de in tc.Constructors){
- Constructor c = (Constructor) de.Value;
-
+ foreach (Constructor c in tc.Constructors)
GenerateConstructor (c);
- }
+
newline ();
}
if (tc.Properties != null){
- foreach (DictionaryEntry de in tc.Properties){
- Property prop = (Property) de.Value;
-
+ foreach (Property prop in tc.Properties)
GenerateProperty (prop);
- }
}
GenerateFromTypes (tc);
- if (tc.MethodGroups != null){
- foreach (DictionaryEntry de in tc.MethodGroups){
- MethodGroup mg = (MethodGroup) de.Value;
-
- GenerateMethodGroup (mg);
+ if (tc.Methods != null){
+ foreach (Method m in tc.Methods){
+ GenerateMethod (m);
}
}
}
@@ -994,7 +967,7 @@ namespace Generator {
}
}
- public int GenerateFromTree (Tree tree, StreamWriter output)
+ public int Dump (Tree tree, StreamWriter output)
{
this.o = output;
diff --git a/mcs/mcs/generator.cs b/mcs/mcs/generator.cs
deleted file mode 100755
index e6d73296b66..00000000000
--- a/mcs/mcs/generator.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-//
-// generator.cs: Generator interfaces.
-//
-// Author: Miguel de Icaza (miguel@gnu.org)
-//
-// Licensed under the terms of the GNU GPL
-//
-// (C) 2001 Ximian, Inc (http://www.ximian.com)
-//
-
-using System.IO;
-
-namespace CIR {
-
- public interface IGenerator {
- int GenerateFromTree (Tree tree, StreamWriter output);
- void ParseOptions (string options);
- }
-}
diff --git a/mcs/mcs/genericparser.cs b/mcs/mcs/genericparser.cs
new file mode 100644
index 00000000000..71f70c9db5e
--- /dev/null
+++ b/mcs/mcs/genericparser.cs
@@ -0,0 +1,85 @@
+//
+// GenericParser.cs: The Base Parser for the Mono compilers
+//
+// Author: A Rafael D Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// Licensed under the terms of the GNU GPL
+//
+// Copyright (C) 2001 Ximian, Inc.
+//
+using System;
+using System.Text;
+
+namespace Mono.Languages
+{
+ using System.Collections;
+
+ /// <summary>
+ /// Base class to support multiple Jay generated parsers
+ /// </summary>
+ public abstract class GenericParser
+ {
+ static protected int global_errors;
+
+ // Name of the file we are parsing
+ public string name;
+
+ // Input stream to parse from.
+ public System.IO.Stream input;
+
+ public abstract int parse ();
+
+ public virtual string[] extensions()
+ {
+ string [] list = { ".cs" };
+ return list;
+ }
+
+ /// <summary>
+ /// Emits error messages and increments a global count of them
+ /// </summary>
+ /// <param name="code"></param>
+ /// <param name="desc"></param>
+ static public void error (int code, string desc)
+ {
+ Console.WriteLine ("Error "+code+": "+ desc);
+ global_errors++;
+ }
+
+ // Emits error messages with location info.
+ // FIXME : Ideally, all error reporting should happen
+ // with Report.Error but how do you get at that non-static
+ // method everywhere you need it ?
+ static public void error (int code, Mono.CSharp.Location l, string text)
+ {
+ Console.WriteLine (l.Name + "(" + l.Row + "," +
+ "): Error CS" + code + ": " + text);
+ global_errors++;
+ }
+
+ public GenericParser()
+ {
+ //
+ // DO NOTHING: Derived classes should do their iniatilization here duties
+ //
+ }
+
+ protected bool yacc_verbose_flag = false;
+
+ public bool yacc_verbose
+ {
+ set
+ {
+ yacc_verbose_flag = value;
+ }
+
+ get
+ {
+ return yacc_verbose_flag;
+ }
+ }
+ }
+}
+
+
+
diff --git a/mcs/mcs/interface.cs b/mcs/mcs/interface.cs
index 968fbfb11eb..4754a39638e 100755
--- a/mcs/mcs/interface.cs
+++ b/mcs/mcs/interface.cs
@@ -14,41 +14,63 @@ using System.IO;
using System.Reflection;
using System.Reflection.Emit;
-namespace CIR {
+namespace Mono.CSharp {
+ /// <summary>
+ /// Interfaces
+ /// </summary>
public class Interface : DeclSpace {
+ const MethodAttributes interface_method_attributes =
+ MethodAttributes.Public |
+ MethodAttributes.Abstract |
+ MethodAttributes.HideBySig |
+ MethodAttributes.NewSlot |
+ MethodAttributes.Virtual;
+
+ const MethodAttributes property_attributes =
+ MethodAttributes.Public |
+ MethodAttributes.Abstract |
+ MethodAttributes.HideBySig |
+ MethodAttributes.NewSlot |
+ MethodAttributes.SpecialName |
+ MethodAttributes.Virtual;
+
ArrayList bases;
- int mod_flags;
- ArrayList defined_method_list;
- ArrayList defined_indexer_list;
+ ArrayList defined_method;
+ ArrayList defined_indexer;
+ ArrayList defined_events;
+ ArrayList defined_properties;
+
+ ArrayList method_builders;
+ ArrayList property_builders;
- Hashtable defined_events;
- Hashtable defined_properties;
+ Attributes OptAttributes;
// These will happen after the semantic analysis
// Hashtable defined_indexers;
// Hashtable defined_methods;
- // <summary>
- // Modifiers allowed in a class declaration
- // </summary>
+ /// <summary>
+ /// Modifiers allowed in a class declaration
+ /// </summary>
public const int AllowedModifiers =
- Modifiers.NEW |
- Modifiers.PUBLIC |
+ Modifiers.NEW |
+ Modifiers.PUBLIC |
Modifiers.PROTECTED |
- Modifiers.INTERNAL |
+ Modifiers.INTERNAL |
+ Modifiers.UNSAFE |
Modifiers.PRIVATE;
- public Interface (TypeContainer parent, string name, int mod) : base (name)
+ public Interface (TypeContainer parent, string name, int mod, Attributes attrs, Location l)
+ : base (parent, name, l)
{
- defined_events = new Hashtable ();
- defined_method_list = new ArrayList ();
- defined_indexer_list = new ArrayList ();
- defined_properties = new Hashtable ();
-
- this.mod_flags = Modifiers.Check (AllowedModifiers, mod, Modifiers.PUBLIC);
+ ModFlags = Modifiers.Check (AllowedModifiers, mod, Modifiers.PRIVATE, l);
+ OptAttributes = attrs;
+
+ method_builders = new ArrayList ();
+ property_builders = new ArrayList ();
}
public AdditionResult AddMethod (InterfaceMethod imethod)
@@ -61,7 +83,10 @@ namespace CIR {
return AdditionResult.NameExists;
}
- defined_method_list.Add (imethod);
+ if (defined_method == null)
+ defined_method = new ArrayList ();
+
+ defined_method.Add (imethod);
if (value == null)
DefineName (name, imethod);
@@ -78,7 +103,10 @@ namespace CIR {
DefineName (name, iprop);
- defined_properties.Add (name, iprop);
+ if (defined_properties == null)
+ defined_properties = new ArrayList ();
+
+ defined_properties.Add (iprop);
return AdditionResult.Success;
}
@@ -92,46 +120,46 @@ namespace CIR {
DefineName (name, ievent);
- defined_events.Add (name, ievent);
+ if (defined_events == null)
+ defined_events = new ArrayList ();
+
+ defined_events.Add (ievent);
return AdditionResult.Success;
}
public bool AddIndexer (InterfaceIndexer iindexer)
{
- defined_indexer_list.Add (iindexer);
+ if (defined_indexer == null)
+ defined_indexer = new ArrayList ();
+
+ defined_indexer.Add (iindexer);
return true;
}
- public Hashtable InterfaceMethods {
+ public ArrayList InterfaceMethods {
get {
- return null; // defined_methods;
+ return defined_method;
}
}
- public Hashtable InterfaceProperties {
+ public ArrayList InterfaceProperties {
get {
return defined_properties;
}
}
- public Hashtable InterfaceEvents {
+ public ArrayList InterfaceEvents {
get {
return defined_events;
}
}
- public Hashtable InterfaceIndexers {
+ public ArrayList InterfaceIndexers {
get {
- return null; // defined_indexers;
+ return defined_indexer;
}
}
- public int ModFlags {
- get {
- return mod_flags;
- }
- }
-
public ArrayList Bases {
get {
return bases;
@@ -142,190 +170,651 @@ namespace CIR {
}
}
- Type def;
- bool in_transit = false;
- public override Type Define (Tree tree)
- {
- if (in_transit){
- CSC.CSharpParser.error (529, "There is a cycle in interface " + Name);
- return null;
+ public virtual TypeAttributes InterfaceAttr {
+ get {
+ TypeAttributes x = TypeAttributes.Interface | TypeAttributes.Abstract;
+
+ if (IsTopLevel == false) {
+
+ if ((ModFlags & Modifiers.PROTECTED) != 0
+ && (ModFlags & Modifiers.INTERNAL) != 0)
+ x |= TypeAttributes.NestedFamORAssem;
+ else if ((ModFlags & Modifiers.PROTECTED) != 0)
+ x |= TypeAttributes.NestedFamily;
+ else if ((ModFlags & Modifiers.INTERNAL) != 0)
+ x |= TypeAttributes.NestedAssembly;
+ else if ((ModFlags & Modifiers.PUBLIC) != 0)
+ x |= TypeAttributes.NestedPublic;
+ else
+ x |= TypeAttributes.NestedPrivate;
+ } else {
+ if ((ModFlags & Modifiers.PUBLIC) != 0)
+ x |= TypeAttributes.Public;
+ else if ((ModFlags & Modifiers.PRIVATE) != 0)
+ x |= TypeAttributes.NotPublic;
+ }
+
+ if ((ModFlags & Modifiers.ABSTRACT) != 0)
+ x |= TypeAttributes.Abstract;
+
+ if ((ModFlags & Modifiers.SEALED) != 0)
+ x |= TypeAttributes.Sealed;
+
+ return x;
}
- in_transit = true;
+ }
+
+ void Error111 (InterfaceMemberBase ib)
+ {
+ Report.Error (
+ 111,
+ "Interface `" + Name + "' already contains a definition with the " +
+ "same return value and parameter types for member `" + ib.Name + "'");
+ }
+
+ bool RegisterMethod (MethodBase mb, InternalParameters ip, Type [] types)
+ {
+ if (!TypeManager.RegisterMethod (mb, ip, types))
+ return false;
- ModuleBuilder mb = tree.ModuleBuilder;
+ method_builders.Add (mb);
+ return true;
+ }
- if (bases != null){
- // FIXME: Go over each one of the TypeRefs
- // in Bases and resolve.
- Console.WriteLine ("Base interfaces not yet supported");
- return null;
+ public MethodInfo [] GetMethods ()
+ {
+ int n = method_builders.Count;
+ MethodInfo [] mi = new MethodInfo [n];
+
+ method_builders.CopyTo (mi, 0);
+
+ return mi;
+ }
+
+ // Hack around System.Reflection as found everywhere else
+ public MemberInfo [] FindMembers (MemberTypes mt, BindingFlags bf, MemberFilter filter, object criteria)
+ {
+ ArrayList members = new ArrayList ();
+
+ if ((mt & MemberTypes.Method) != 0) {
+ foreach (MethodBuilder mb in method_builders)
+ if (filter (mb, criteria))
+ members.Add (mb);
}
- TypeAttributes attr = TypeAttributes.Interface;
+ if ((mt & MemberTypes.Property) != 0) {
+ foreach (PropertyBuilder pb in property_builders)
+ if (filter (pb, criteria))
+ members.Add (pb);
+ }
+
+ if ((bf & BindingFlags.DeclaredOnly) == 0){
+ MemberInfo [] parent_mi;
+
+ parent_mi = TypeContainer.FindMembers (
+ TypeBuilder.BaseType, mt, bf, filter, criteria);
- attr |= Modifiers.TypeAttr (mod_flags);
+ if (parent_mi != null)
+ members.AddRange (parent_mi);
+ }
- def = mb.DefineType (Name, attr);
+ // The rest of the cases, if any, are unhandled at present.
- in_transit = false;
+ int count = members.Count;
- return def;
- }
- }
+ if (count > 0) {
+ MemberInfo [] mi = new MemberInfo [count];
+ members.CopyTo (mi, 0);
+ return mi;
+ }
- public class InterfaceMemberBase {
- string name;
+ return null;
+ }
- public InterfaceMemberBase (string name)
+ //
+ // Populates the methods in the interface
+ //
+ void PopulateMethod (InterfaceMethod im)
{
- this.name = name;
+ Type return_type = RootContext.LookupType (this, im.ReturnType, false, im.Location);
+ Type [] arg_types = im.ParameterTypes (this);
+ MethodBuilder mb;
+ Parameter [] p;
+ int i;
+
+ if (return_type == null)
+ return;
+
+ if (return_type.IsPointer && !UnsafeOK (this))
+ return;
+
+ foreach (Type t in arg_types){
+
+ if (t == null)
+ return;
+
+ if (t.IsPointer && !UnsafeOK (this))
+ return;
+ }
+
+ //
+ // Create the method
+ //
+ mb = TypeBuilder.DefineMethod (
+ im.Name, interface_method_attributes,
+ return_type, arg_types);
+
+ InternalParameters ip = new InternalParameters (arg_types, im.Parameters);
+
+ if (!RegisterMethod (mb, ip, arg_types)) {
+ Error111 (im);
+ return;
+ }
+
+ //
+ // Define each type attribute (in/out/ref) and
+ // the argument names.
+ //
+ p = im.Parameters.FixedParameters;
+ if (p != null){
+ for (i = 0; i < p.Length; i++)
+ mb.DefineParameter (i + 1, p [i].Attributes, p [i].Name);
+
+ if (i != arg_types.Length)
+ Console.WriteLine ("Implement the type definition for params");
+ }
}
-
- public string Name {
- get {
- return name;
+
+ //
+ // Populates the properties in the interface
+ //
+ void PopulateProperty (InterfaceProperty ip)
+ {
+ PropertyBuilder pb;
+ MethodBuilder get = null, set = null;
+ Type prop_type = RootContext.LookupType (this, ip.Type, false, ip.Location);
+ Type [] setter_args = new Type [1];
+
+ if (prop_type == null)
+ return;
+
+ if (prop_type.IsPointer && !UnsafeOK (this))
+ return;
+
+ setter_args [0] = prop_type;
+
+ //
+ // FIXME: properties are missing the following
+ // flags: hidebysig newslot specialname
+ //
+ pb = TypeBuilder.DefineProperty (
+ ip.Name, PropertyAttributes.None,
+ prop_type, null);
+
+ if (ip.HasGet){
+ get = TypeBuilder.DefineMethod (
+ "get_" + ip.Name, property_attributes ,
+ prop_type, null);
+
+ //
+ // HACK because System.Reflection.Emit is lame
+ //
+ Type [] null_types = null;
+ InternalParameters inp = new InternalParameters
+ (null_types, Parameters.GetEmptyReadOnlyParameters ());
+
+ if (!RegisterMethod (get, inp, null)) {
+ Error111 (ip);
+ return;
+ }
+
+ pb.SetGetMethod (get);
}
+
+ if (ip.HasSet){
+ setter_args [0] = prop_type;
+
+ set = TypeBuilder.DefineMethod (
+ "set_" + ip.Name, property_attributes,
+ TypeManager.void_type, setter_args);
+
+ set.DefineParameter (1, ParameterAttributes.None, "value");
+ pb.SetSetMethod (set);
+
+ //
+ // HACK because System.Reflection.Emit is lame
+ //
+ Parameter [] parms = new Parameter [1];
+ parms [0] = new Parameter (ip.Type, "value", Parameter.Modifier.NONE, null);
+ InternalParameters ipp = new InternalParameters (
+ this, new Parameters (parms, null, Location.Null));
+
+ if (!RegisterMethod (set, ipp, setter_args)) {
+ Error111 (ip);
+ return;
+ }
+ }
+
+ TypeManager.RegisterProperty (pb, get, set);
+ property_builders.Add (pb);
}
- }
-
- public class InterfaceProperty : InterfaceMemberBase {
- bool has_get, has_set, is_new;
- TypeRef typeref;
-
- public InterfaceProperty (TypeRef typeref, string name,
- bool is_new, bool has_get, bool has_set)
- : base (name)
+
+ //
+ // Populates the events in the interface
+ //
+ void PopulateEvent (InterfaceEvent ie)
{
- this.typeref = typeref;
- this.is_new = is_new;
- this.has_get = has_get;
- this.has_set = has_set;
+ //
+ // FIXME: We need to do this after delegates have been
+ // declared or we declare them recursively.
+ //
}
- public bool HasGet {
- get {
- return has_get;
+ //
+ // Populates the indexers in the interface
+ //
+ void PopulateIndexer (InterfaceIndexer ii)
+ {
+ PropertyBuilder pb;
+ Type prop_type = RootContext.LookupType (this, ii.Type, false, ii.Location);
+ Type [] arg_types = ii.ParameterTypes (this);
+ Type [] value_arg_types;
+
+ if (prop_type == null)
+ return;
+
+ if (prop_type.IsPointer && !UnsafeOK (this))
+ return;
+
+ //
+ // Sets up the extra invisible `value' argument for setters.
+ //
+ if (arg_types != null){
+ int count = arg_types.Length;
+ value_arg_types = new Type [count + 1];
+
+ arg_types.CopyTo (value_arg_types, 0);
+ value_arg_types [count] = prop_type;
+
+ foreach (Type t in arg_types){
+ if (t.IsPointer && !UnsafeOK (this))
+ return;
+ }
+ } else {
+ value_arg_types = new Type [1];
+
+ value_arg_types [1] = prop_type;
}
- }
- public bool HasSet {
- get {
- return has_set;
+ pb = TypeBuilder.DefineProperty (
+ "Item", PropertyAttributes.None,
+ prop_type, arg_types);
+
+ if (ii.HasGet){
+ MethodBuilder get_item;
+ Parameter [] p = ii.Parameters.FixedParameters;
+
+ get_item = TypeBuilder.DefineMethod (
+ "get_Item", property_attributes, prop_type, arg_types);
+ pb.SetGetMethod (get_item);
+ //
+ // HACK because System.Reflection.Emit is lame
+ //
+ InternalParameters ip = new InternalParameters (
+ arg_types, ii.Parameters);
+
+ if (!RegisterMethod (get_item, ip, arg_types)) {
+ Error111 (ii);
+ return;
+ }
+
+ if (p != null){
+ for (int i = 0; i < p.Length; i++)
+ get_item.DefineParameter (
+ i + 1,
+ p [i].Attributes, p [i].Name);
+ }
}
- }
- public bool IsNew {
- get {
- return is_new;
+ if (ii.HasSet){
+ Parameter [] p = ii.Parameters.FixedParameters;
+ MethodBuilder set_item;
+ int i = 0;
+
+ set_item = TypeBuilder.DefineMethod (
+ "set_Item", property_attributes,
+ TypeManager.void_type, value_arg_types);
+ pb.SetSetMethod (set_item);
+ //
+ // HACK because System.Reflection.Emit is lame
+ //
+ InternalParameters ip = new InternalParameters (
+ value_arg_types, ii.Parameters);
+ if (!RegisterMethod (set_item, ip, value_arg_types)) {
+ Error111 (ii);
+ return;
+ }
+
+ if (p != null){
+ for (; i < p.Length; i++)
+ set_item.DefineParameter (
+ i + 1,
+ p [i].Attributes, p [i].Name);
+ }
+
+ set_item.DefineParameter (i + 1, ParameterAttributes.None, "value");
}
}
- public Type Type {
- get {
- return typeref.Type;
+ /// <summary>
+ /// Performs the semantic analysis for all the interface members
+ /// that were declared
+ /// </summary>
+ bool SemanticAnalysis ()
+ {
+ Hashtable methods = new Hashtable ();
+
+
+ if (defined_method != null){
+ foreach (InterfaceMethod im in defined_method){
+ string sig = im.GetSignature (this);
+
+ //
+ // If there was an undefined Type on the signatures
+ //
+ if (sig == null)
+ continue;
+
+ if (methods [sig] != null){
+ Error111 (im);
+ return false;
+ }
+ }
}
+
+ //
+ // FIXME: Here I should check i
+ //
+ return true;
}
- }
- public class InterfaceEvent : InterfaceMemberBase {
- TypeRef typeref;
- bool is_new;
-
- public InterfaceEvent (TypeRef typeref, string name, bool is_new)
- : base (name)
+ Type GetInterfaceTypeByName (string name)
{
- this.typeref = typeref;
- this.is_new = is_new;
+ Type t = FindType (name);
+
+ if (t == null)
+ return null;
+
+ if (t.IsInterface)
+ return t;
+
+ string cause;
+
+ if (t.IsValueType)
+ cause = "is a struct";
+ else if (t.IsClass)
+ cause = "is a class";
+ else
+ cause = "Should not happen.";
+
+ Report.Error (527, Location, "`"+name+"' " + cause +
+ ", need an interface instead");
+
+ return null;
}
+
+ //
+ // Returns the list of interfaces that this interface implements
+ // Or null if it does not implement any interface.
+ //
+ // Sets the error boolean accoringly.
+ //
+ Type [] GetInterfaceBases (out bool error)
+ {
+ Type [] tbases;
+ int i;
- public Type Type {
- get {
- return typeref.Type;
+ error = false;
+ if (Bases == null)
+ return null;
+
+ tbases = new Type [Bases.Count];
+ i = 0;
+
+ foreach (string name in Bases){
+ Type t;
+
+ t = GetInterfaceTypeByName (name);
+ if (t == null){
+ error = true;
+ return null;
+ }
+
+ tbases [i++] = t;
}
+
+ return tbases;
}
+
+ //
+ // <summary>
+ // Defines the Interface in the appropriate ModuleBuilder or TypeBuilder
+ // </summary>
+ //
+ // TODO:
+ // Rework the way we recurse, because for recursive
+ // definitions of interfaces (A:B and B:A) we report the
+ // error twice, rather than once.
+
+ public override TypeBuilder DefineType ()
+ {
+ Type [] ifaces;
+ bool error;
- public bool IsNew {
- get {
- return is_new;
+ if (TypeBuilder != null)
+ return TypeBuilder;
+
+ if (InTransit)
+ return null;
+
+ InTransit = true;
+
+ ifaces = GetInterfaceBases (out error);
+
+ if (error)
+ return null;
+
+ if (IsTopLevel) {
+ ModuleBuilder builder = CodeGen.ModuleBuilder;
+
+ TypeBuilder = builder.DefineType (
+ Name,
+ InterfaceAttr,
+ (Type)null, // Parent Type
+ ifaces);
+ RootContext.RegisterOrder (this);
+ } else {
+ TypeBuilder builder = Parent.TypeBuilder;
+
+ TypeBuilder = builder.DefineNestedType (
+ Basename,
+ InterfaceAttr,
+ (Type) null, //parent type
+ ifaces);
+
+ TypeContainer tc = TypeManager.LookupTypeContainer (builder);
+ tc.RegisterOrder (this);
}
+
+ TypeManager.AddUserInterface (Name, TypeBuilder, this);
+ InTransit = false;
+
+ return TypeBuilder;
}
- }
-
- public class InterfaceMethod : InterfaceMemberBase {
- TypeRef return_type;
- bool is_new;
- Parameters args;
- public InterfaceMethod (TypeRef return_type, string name, bool is_new, Parameters args)
- : base (name)
+ /// <summary>
+ /// Performs semantic analysis, and then generates the IL interfaces
+ /// </summary>
+ public override bool Define (TypeContainer parent)
{
- this.return_type = return_type;
- this.is_new = is_new;
- this.args = args;
- }
+ if (!SemanticAnalysis ())
+ return false;
- public Type ReturnType {
- get {
- return return_type.Type;
+ if (defined_method != null){
+ foreach (InterfaceMethod im in defined_method)
+ PopulateMethod (im);
}
- }
- public bool IsNew {
- get {
- return is_new;
+ if (defined_properties != null){
+ foreach (InterfaceProperty ip in defined_properties)
+ PopulateProperty (ip);
}
+
+ if (defined_events != null)
+ foreach (InterfaceEvent ie in defined_events)
+ PopulateEvent (ie);
+
+ if (defined_indexer != null) {
+ foreach (InterfaceIndexer ii in defined_indexer)
+ PopulateIndexer (ii);
+
+ CustomAttributeBuilder cb = EmitDefaultMemberAttr (parent, ModFlags, Location);
+ if (cb != null)
+ TypeBuilder.SetCustomAttribute (cb);
+ }
+
+ return true;
}
- public Parameters Parameters {
- get {
- return args;
+ public static CustomAttributeBuilder EmitDefaultMemberAttr (TypeContainer parent, int flags,
+ Location loc)
+ {
+ EmitContext ec = new EmitContext (parent, loc, null, null, flags);
+
+ Expression ml = Expression.MemberLookup (ec, TypeManager.default_member_type,
+ ".ctor", MemberTypes.Constructor,
+ BindingFlags.Public | BindingFlags.Instance,
+ Location.Null);
+
+ if (!(ml is MethodGroupExpr)) {
+ Console.WriteLine ("Internal error !!!!");
+ return null;
+ }
+
+ MethodGroupExpr mg = (MethodGroupExpr) ml;
+
+ MethodBase constructor = mg.Methods [0];
+
+ string [] vals = { "Item" };
+
+ CustomAttributeBuilder cb = null;
+ try {
+ cb = new CustomAttributeBuilder ((ConstructorInfo) constructor, vals);
+ } catch {
+ Report.Warning (-100, "Can not set the indexer default member attribute");
}
+
+ return cb;
}
+
}
- public class InterfaceIndexer : InterfaceMemberBase {
- bool do_get, do_set, is_new;
- Parameters args;
- TypeRef typeref;
+ public class InterfaceMemberBase {
+ public readonly string Name;
+ public readonly bool IsNew;
+ public Attributes OptAttributes;
+
+ public InterfaceMemberBase (string name, bool is_new, Attributes attrs)
+ {
+ Name = name;
+ IsNew = is_new;
+ OptAttributes = attrs;
+ }
+ }
+
+ public class InterfaceProperty : InterfaceMemberBase {
+ public readonly bool HasSet;
+ public readonly bool HasGet;
+ public readonly string Type;
+ public readonly string type;
+ public readonly Location Location;
- public InterfaceIndexer (TypeRef typeref, Parameters args, bool do_get, bool do_set, bool is_new)
- : base ("")
+ public InterfaceProperty (string type, string name,
+ bool is_new, bool has_get, bool has_set,
+ Attributes attrs, Location loc)
+ : base (name, is_new, attrs)
{
- this.typeref = typeref;
- this.args = args;
- this.do_get = do_get;
- this.do_set = do_set;
- this.is_new = is_new;
+ Type = type;
+ HasGet = has_get;
+ HasSet = has_set;
+ Location = loc;
}
+ }
- public Type Type {
- get {
- return typeref.Type;
- }
+ public class InterfaceEvent : InterfaceMemberBase {
+ public readonly string Type;
+
+ public InterfaceEvent (string type, string name, bool is_new, Attributes attrs)
+ : base (name, is_new, attrs)
+ {
+ Type = type;
+ }
+ }
+
+ public class InterfaceMethod : InterfaceMemberBase {
+ public readonly string ReturnType;
+ public readonly Parameters Parameters;
+ public readonly Location Location;
+
+ public InterfaceMethod (string return_type, string name, bool is_new, Parameters args,
+ Attributes attrs, Location l)
+ : base (name, is_new, attrs)
+ {
+ this.ReturnType = return_type;
+ this.Parameters = args;
+ Location = l;
}
- public Parameters Parameters {
- get {
- return args;
- }
+ /// <summary>
+ /// Returns the signature for this interface method
+ /// </summary>
+ public string GetSignature (DeclSpace ds)
+ {
+ Type ret = RootContext.LookupType (ds, ReturnType, false, Location);
+ string args = Parameters.GetSignature (ds);
+
+ if ((ret == null) || (args == null))
+ return null;
+
+ return (IsNew ? "new-" : "") + ret.FullName + "(" + args + ")";
}
- public bool HasGet {
- get {
- return do_get;
- }
+ public Type [] ParameterTypes (DeclSpace ds)
+ {
+ return Parameters.GetParameterInfo (ds);
}
+ }
- public bool HasSet {
- get {
- return do_set;
- }
+ public class InterfaceIndexer : InterfaceMemberBase {
+ public readonly bool HasGet, HasSet;
+ public readonly Parameters Parameters;
+ public readonly string Type;
+ public readonly Location Location;
+
+ public InterfaceIndexer (string type, Parameters args, bool do_get, bool do_set,
+ bool is_new, Attributes attrs, Location loc)
+ : base ("", is_new, attrs)
+ {
+ Type = type;
+ Parameters = args;
+ HasGet = do_get;
+ HasSet = do_set;
+ Location = loc;
}
- public bool IsNew {
- get {
- return is_new;
- }
+ public Type [] ParameterTypes (DeclSpace ds)
+ {
+ return Parameters.GetParameterInfo (ds);
}
}
}
diff --git a/mcs/mcs/literal.cs b/mcs/mcs/literal.cs
index 2af028b8db3..a307030db6a 100755
--- a/mcs/mcs/literal.cs
+++ b/mcs/mcs/literal.cs
@@ -6,162 +6,182 @@
//
// (C) 2001 Ximian, Inc.
//
+//
+// Notice that during parsing we create objects of type Literal, but the
+// types are not loaded (thats why the Resolve method has to assign the
+// type at that point).
+//
+// Literals differ from the constants in that we know we encountered them
+// as a literal in the source code (and some extra rules apply there) and
+// they have to be resolved (since during parsing we have not loaded the
+// types yet) while constants are created only after types have been loaded
+// and are fully resolved when born.
+//
-namespace CIR {
- public abstract class Literal : Expression {
-
- // <summary>
- // This is different from ToString in that ToString
- // is supposed to be there for debugging purposes,
- // and is not guarantee to be useful for anything else,
- // AsString() will provide something that can be used
- // for round-tripping C# code. Maybe it can be used
- // for IL assembly as well.
- // </summary>
- public abstract string AsString ();
-
- override public string ToString ()
- {
- return AsString ();
- }
-
- static public string descape (char c)
- {
- switch (c){
- case '\a':
- return "\\a";
- case '\b':
- return "\\b";
- case '\n':
- return "\\n";
- case '\t':
- return "\\t";
- case '\v':
- return "\\v";
- case '\r':
- return "\\r";
- case '\\':
- return "\\\\";
- case '\f':
- return "\\f";
- case '\0':
- return "\\0";
- case '"':
- return "\\\"";
- case '\'':
- return "\\\'";
- }
- return c.ToString ();
- }
- }
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+namespace Mono.CSharp {
- public class NullLiteral : Literal {
+ public class NullLiteral : Constant {
+ public static readonly NullLiteral Null;
+
+ static NullLiteral ()
+ {
+ Null = new NullLiteral ();
+ }
+
public NullLiteral ()
{
+ if (Null != null)
+ throw new Exception ("More than one null has been created!");
+ eclass = ExprClass.Value;
}
-
+
override public string AsString ()
{
return "null";
}
- }
- public class BoolLiteral : Literal {
- bool val;
-
- public BoolLiteral (bool val)
+ public override object GetValue ()
{
- this.val = val;
+ return null;
}
- override public string AsString ()
+ public override Expression DoResolve (EmitContext ec)
+ {
+ type = TypeManager.object_type;
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
{
- return val ? "true" : "false";
+ ec.ig.Emit (OpCodes.Ldnull);
}
}
- public class CharLiteral : Literal {
- char c;
-
- public CharLiteral (char c)
+ public class BoolLiteral : BoolConstant {
+ public BoolLiteral (bool val) : base (val)
{
- this.c = c;
}
- override public string AsString ()
+ public override Expression DoResolve (EmitContext ec)
{
- return "\"" + descape (c) + "\"";
+ type = TypeManager.bool_type;
+ return this;
}
}
- public class IntLiteral : Literal {
- int i;
-
- public IntLiteral (int l)
+ public class CharLiteral : CharConstant {
+ public CharLiteral (char c) : base (c)
{
- i = l;
}
- override public string AsString ()
+ public override Expression DoResolve (EmitContext ec)
{
- return i.ToString ();
+ type = TypeManager.char_type;
+ return this;
}
}
- public class FloatLiteral : Literal {
- float f;
+ public class IntLiteral : IntConstant {
+ public IntLiteral (int l) : base (l)
+ {
+ }
- public FloatLiteral (float f)
+ public override Expression DoResolve (EmitContext ec)
{
- this.f = f;
+ type = TypeManager.int32_type;
+ return this;
}
+ }
- override public string AsString ()
+ public class UIntLiteral : UIntConstant {
+ public UIntLiteral (uint l) : base (l)
{
- return f.ToString ();
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ type = TypeManager.uint32_type;
+ return this;
}
}
+
+ public class LongLiteral : LongConstant {
+ public LongLiteral (long l) : base (l)
+ {
+ }
- public class DoubleLiteral : Literal {
- double d;
+ public override Expression DoResolve (EmitContext ec)
+ {
+ type = TypeManager.int64_type;
- public DoubleLiteral (double d)
+ return this;
+ }
+ }
+
+ public class ULongLiteral : ULongConstant {
+ public ULongLiteral (ulong l) : base (l)
{
- this.d = d;
}
- override public string AsString ()
+ public override Expression DoResolve (EmitContext ec)
{
- return d.ToString ();
+ type = TypeManager.uint64_type;
+ return this;
}
}
+
+ public class FloatLiteral : FloatConstant {
+
+ public FloatLiteral (float f) : base (f)
+ {
+ }
- public class DecimalLiteral : Literal {
- decimal d;
+ public override Expression DoResolve (EmitContext ec)
+ {
+ type = TypeManager.float_type;
+ return this;
+ }
+ }
- public DecimalLiteral (decimal d)
+ public class DoubleLiteral : DoubleConstant {
+ public DoubleLiteral (double d) : base (d)
{
- this.d = d;
}
- override public string AsString ()
+ public override Expression DoResolve (EmitContext ec)
{
- return d.ToString ();
+ type = TypeManager.double_type;
+
+ return this;
}
}
- public class StringLiteral : Literal {
- string s;
+ public class DecimalLiteral : DecimalConstant {
+ public DecimalLiteral (decimal d) : base (d)
+ {
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ type = TypeManager.decimal_type;
+ return this;
+ }
+ }
- public StringLiteral (string s)
+ public class StringLiteral : StringConstant {
+ public StringLiteral (string s) : base (s)
{
- this.s = s;
}
- // FIXME: Escape the string.
- override public string AsString ()
+ public override Expression DoResolve (EmitContext ec)
{
- return "\"" + s + "\"";
+ type = TypeManager.string_type;
+
+ return this;
}
}
}
diff --git a/mcs/mcs/location.cs b/mcs/mcs/location.cs
new file mode 100644
index 00000000000..1b32f32de6e
--- /dev/null
+++ b/mcs/mcs/location.cs
@@ -0,0 +1,151 @@
+//
+// location.cs: Keeps track of the location of source code entity
+//
+// Author:
+// Miguel de Icaza
+//
+// (C) 2001 Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Diagnostics.SymbolStore;
+
+namespace Mono.CSharp {
+ /// <summary>
+ /// Keeps track of the location in the program
+ /// </summary>
+ ///
+ /// <remarks>
+ /// This uses a compact representation and a couple of auxiliary
+ /// structures to keep track of tokens to (file,line) mappings.
+ ///
+ /// We could probably also keep track of columns by storing those
+ /// in 8 bits (and say, map anything after char 255 to be `255+').
+ /// </remarks>
+ public struct Location {
+ public int token;
+
+ static Hashtable map;
+ static Hashtable sym_docs;
+ static ArrayList list;
+ static int global_count;
+ static int module_base;
+
+ public readonly static Location Null;
+
+ static Location ()
+ {
+ map = new Hashtable ();
+ list = new ArrayList ();
+ sym_docs = new Hashtable ();
+ global_count = 0;
+ module_base = 0;
+ Null.token = -1;
+ }
+
+ static public void Push (string name)
+ {
+ map.Remove (global_count);
+ map.Add (global_count, name);
+ list.Add (global_count);
+ module_base = global_count;
+ }
+
+ public Location (int row)
+ {
+ if (row < 0)
+ token = -1;
+ else {
+ token = module_base + row;
+ if (global_count < token)
+ global_count = token;
+ }
+ }
+
+ public override string ToString ()
+ {
+ return Name + ": (" + Row + ")";
+ }
+
+ /// <summary>
+ /// Whether the Location is Null
+ /// </summary>
+ static public bool IsNull (Location l)
+ {
+ return l.token == -1;
+ }
+
+ public string Name {
+ get {
+ int best = 0;
+
+ if (token < 0)
+ return "Internal";
+
+ foreach (int b in list){
+ if (token > b)
+ best = b;
+ }
+ return (string) map [best];
+ }
+ }
+
+ public int Row {
+ get {
+ int best = 0;
+
+ if (token < 0)
+ return 1;
+
+ foreach (int b in list){
+ if (token > b)
+ best = b;
+ }
+ return token - best;
+ }
+ }
+
+ // The ISymbolDocumentWriter interface is used by the symbol writer to
+ // describe a single source file - for each source file there's exactly
+ // one corresponding ISymbolDocumentWriter instance.
+ //
+ // This class has an internal hash table mapping source document names
+ // to such ISymbolDocumentWriter instances - so there's exactly one
+ // instance per document.
+ //
+ // This property returns the ISymbolDocumentWriter instance which belongs
+ // to the location's source file.
+ //
+ // If we don't have a symbol writer, this property is always null.
+ public ISymbolDocumentWriter SymbolDocument {
+ get {
+ ISymbolWriter sw = CodeGen.SymbolWriter;
+ ISymbolDocumentWriter doc;
+
+ if (token < 0)
+ return null;
+
+ // If we don't have a symbol writer, return null.
+ if (sw == null)
+ return null;
+
+ if (sym_docs.Contains (Name))
+ // If we already created an ISymbolDocumentWriter
+ // instance for this document, return it.
+ doc = (ISymbolDocumentWriter) sym_docs [Name];
+ else {
+ // Create a new ISymbolDocumentWriter instance and
+ // store it in the hash table.
+ doc = sw.DefineDocument (Name, SymLanguageType.CSharp,
+ SymLanguageVendor.Microsoft,
+ SymDocumentType.Text);
+
+ sym_docs.Add (Name, doc);
+ }
+
+ return doc;
+ }
+ }
+ }
+}
diff --git a/mcs/mcs/makefile b/mcs/mcs/makefile
index 56a8664f1e0..87aed69ecb6 100755
--- a/mcs/mcs/makefile
+++ b/mcs/mcs/makefile
@@ -1,83 +1,95 @@
+CSC=csc.exe
+CSCFLAGS=/nologo /debug+ /debug:full /optimize
+
VERSION=0.13
-COMMON_SOURCES = cs-parser.cs cs-tokenizer.cs parser.cs errors.cs tree.cs
+COMMON_SOURCES = cs-parser.cs cs-tokenizer.cs tree.cs location.cs
COMPILER_SOURCES = \
assign.cs \
+ attribute.cs \
driver.cs $(COMMON_SOURCES) \
+ cfold.cs \
class.cs \
+ codegen.cs \
+ const.cs \
constant.cs \
decl.cs \
+ delegate.cs \
enum.cs \
+ ecore.cs \
expression.cs \
- generator.cs \
- gen-il.cs \
- gen-treedump.cs \
+ genericparser.cs \
interface.cs \
literal.cs \
modifiers.cs \
namespace.cs \
parameter.cs \
- parameterCollection.cs \
+ report.cs \
+ rootcontext.cs \
statement.cs \
- statementCollection.cs \
- type.cs
+ support.cs \
+ typemanager.cs
TEST_TOKENIZER_SOURCES = test-token.cs $(COMMON_SOURCES)
-all:
- -rm compiler.exe
- csc /target:exe /r:System.dll /debug+ /debug:full /out:compiler.exe $(COMPILER_SOURCES)
+all: mcs.exe
+
+mcs.exe: cs-parser.cs $(COMPILER_SOURCES)
+ $(CSC) $(CSCFLAGS) /target:exe /r:System.dll /out:mcs.exe $(COMPILER_SOURCES)
+
+res:
+ echo --target exe -o mcs2.exe $(COMPILER_SOURCES) > response
+
+dum: cs-parser.cs
+ $(TIME) ./mcs --fatal --target exe -o mcs2.exe $(COMPILER_SOURCES)
+
+mcs2.exe: mcs.exe
+ $(TIME) ./mcs $(XFLAGS) --target exe -o mcs2.exe $(COMPILER_SOURCES)
+
+mcs3.exe: mcs2.exe
+ $(TIME) ./mcs2 --target exe -o mcs3.exe $(COMPILER_SOURCES)
+
+mcs-mono.exe: cs-parser.cs $(COMPILER_SOURCES)
+ mono mcs.exe --timestamp -o mcs-mono.exe $(COMPILER_SOURCES)
+mm:
+ mint $(MINTFLAGS) ./mcs.exe $(MCSFLAGS) --target exe -o mcs4.exe $(COMPILER_SOURCES)
+
+monomcs: cs-parser.cs
+ mcs $(MCSFLAGS) --target exe -o mcs4.exe $(COMPILER_SOURCES)
+
+test: mcs3.exe
+ ls -l mcs2.exe mcs3.exe
+
+docs: cs-parser.cs
+ $(CSC) $(CSCFLAGS) /doc:docs.xml /nowarn:1591 /target:exe /r:System.dll /out:mcs.exe $(COMPILER_SOURCES)
+
+windows: all
+
+linux: all
opt:
- -rm compiler.exe
- csc /optimize+ /target:exe /r:System.dll /debug+ /debug:full /out:compiler.exe $(COMPILER_SOURCES)
+ $(CSC) /optimize+ /target:exe /r:System.dll /out:mcs.exe $(COMPILER_SOURCES)
old: test-tokenizer.exe
test-tokenizer.exe: $(TEST_TOKENIZER_SOURCES)
- csc /target:exe /out:test-tokenizer.exe $(TEST_TOKENIZER_SOURCES)
+ $(CSC) /target:exe /out:test-tokenizer.exe $(TEST_TOKENIZER_SOURCES)
bison:
perl -pe 's/\015//' < cs-parser.jay > x.y
bison --debug --verbose x.y
-parser:
- jay -tv cs-parser.jay > cs-parser.cs
-
-parsernoline:
- jay -tv cs-parser.jay | grep -v '^#line' > cs-parser.cs
-
-syncunix:
- rsync -v -a /quack/Barra ~/Barra
-
-syncquack:
- rsync -v -a ~/Barra /quack/Barra
-
-syncnt:
- rsync -v -a ~/Barra /quack/nt
-
-statementCollection.cs: X-Collection.cs
- sed -e "s/@CONTAINEE@/Statement/g" -e "s/@arrayname@/statements/g" < X-Collection.cs > statementCollection.cs
+cs-parser.cs: cs-parser.jay
+ ../jay/jay -ctv < ../jay/skeleton.cs cs-parser.jay > cs-parser.cs
-parameterCollection.cs: X-Collection.cs
- sed -e "s/@CONTAINEE@/Parameter/g" -e "s/@arrayname@/parameters/g" < X-Collection.cs > parameterCollection.cs
+pn:
+ ../jay/jay -ctv < ../jay/skeleton.cs cs-parser.jay | grep -v '#line' > cs-parser.cs
-DIST_FILES=$(COMPILER_SOURCES) cs-parser.jay makefile ChangeLog
+#statementCollection.cs: X-Collection.cs
+# sed -e "s/@CONTAINEE@/Statement/g" -e "s/@arrayname@/statements/g" < X-Collection.cs > statementCollection.cs
-dist:
- rm -rf /tmp/mcs-$(VERSION)
- mkdir /tmp/mcs-$(VERSION)
- mkdir /tmp/mcs-$(VERSION)/errors
- mkdir /tmp/mcs-$(VERSION)/tests
- mkdir /tmp/mcs-$(VERSION)/docs
- cp -a $(DIST_FILES) /tmp/mcs-$(VERSION)
- cp errors/*.cs errors/*.txt /tmp/mcs-$(VERSION)/errors
- cp tests/*.cs /tmp/mcs-$(VERSION)/tests
- cp docs/*.txt /tmp/mcs-$(VERSION)/docs
- (cd /tmp; tar czvf mcs-$(VERSION).tar.gz mcs-$(VERSION))
+#parameterCollection.cs: X-Collection.cs
+# sed -e "s/@CONTAINEE@/Parameter/g" -e "s/@arrayname@/parameters/g" < X-Collection.cs > parameterCollection.cs
-try:
- -mkdir try-dir
- for i in $(COMPILER_SOURCES); do \
- ./compiler -t tree $$i > try-dir/$$i; \
- done
+clean:
+ rm -f mcs.exe cs-parser.cs y.output mcs.pdb *~ .*~ mcs.log response
diff --git a/mcs/mcs/mb-parser.jay b/mcs/mcs/mb-parser.jay
new file mode 100644
index 00000000000..ebfb758b5bc
--- /dev/null
+++ b/mcs/mcs/mb-parser.jay
@@ -0,0 +1,480 @@
+%{
+//
+// MonoBASIC.Parser.cs (from .jay): The Parser for the MonoBASIC compiler
+//
+// Author: A Rafael D Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// Licensed under the terms of the GNU GPL
+//
+// Copyright (C) 2001 A Rafael D Teixeira
+//
+// TODO:
+// Nearly everything
+//
+
+namespace Mono.Languages.MonoBASIC
+{
+ using System.Text;
+ using System;
+ using System.Collections;
+
+ using CIR;
+ using Mono.Languages;
+ using Mono.Languages.MonoBASIC; // To get the tokenizer
+
+ /// <summary>
+ /// The MonoBASIC Parser
+ /// </summary>
+ public class Parser : GenericParser {
+ Namespace current_namespace;
+ TypeContainer current_container;
+
+/*
+ /// <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>
+ Interface current_interface;
+
+ /// <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" accessor
+ /// method
+ /// </summary>
+ Parameter [] implicit_value_parameters;
+
+*/
+ /// <summary>
+ /// Used to record all types defined
+ /// </summary>
+ Tree tree;
+
+ bool UseExtendedSyntax; // for ".mbs" files
+
+ public override string[] GetExtensions()
+ {
+ string [] list = { ".vb", ".mbs" };
+ return list;
+ }
+
+%}
+
+%token EOF
+%token NONE /* This token is never returned by our lexer */
+%token ERROR // This is used not by the parser, but by the tokenizer.
+ // do not remove.
+
+/*
+ *These are the MonoBASIC keywords
+ */
+%token ADDHANDLER
+%token ADDRESSOF
+%token ALIAS
+%token AND
+%token ANDALSO
+%token ANSI
+%token AS
+%token ASSEMBLY
+%token AUTO
+%token BOOLEAN
+%token BYREF
+%token BYTE
+%token BYVAL
+%token CALL
+%token CASE
+%token CATCH
+%token CBOOL
+%token CBYTE
+%token CCHAR
+%token CDATE
+%token CDEC
+%token CDBL
+%token CHAR
+%token CINT
+%token CLASS
+%token CLNG
+%token COBJ
+//%token COMPARE
+%token CONST
+%token CSHORT
+%token CSNG
+%token CSTR
+%token CTYPE
+%token DATE
+%token DECIMAL
+%token DECLARE
+%token DEFAULT
+%token DELEGATE
+%token DIM
+%token DO
+%token DOUBLE
+%token EACH
+%token ELSE
+%token ELSEIF
+%token END
+%token ENUM
+%token EOL
+%token ERASE
+%token ERROR
+%token EVENT
+%token EXIT
+//%token EXPLICIT
+%token FALSE
+%token FINALLY
+%token FOR
+%token FRIEND
+%token FUNCTION
+%token GET
+%token GETTYPE
+%token GOTO
+%token HANDLES
+%token IF
+%token IMPLEMENTS
+%token IMPORTS
+%token IN
+%token INHERITS
+%token INTEGER
+%token INTERFACE
+%token IS
+%token LET
+%token LIB
+%token LIKE
+%token LONG
+%token LOOP
+%token ME
+%token MOD
+%token MODULE
+%token MUSTINHERIT
+%token MUSTOVERRIDE
+%token MYBASE
+%token MYCLASS
+%token NAMESPACE
+%token NEW
+%token NEXT
+%token NOT
+%token NOTHING
+%token NOTINHERITABLE
+%token NOTOVERRIDABLE
+%token OBJECT
+%token ON
+%token OPTION
+%token OPTIONAL
+%token OR
+%token ORELSE
+%token OVERLOADS
+%token OVERRIDABLE
+%token OVERRIDES
+%token PARAM_ARRAY
+%token PRESERVE
+%token PRIVATE
+%token PROPERTY
+%token PROTECTED
+%token PUBLIC
+%token RAISEEVENT
+%token READONLY
+%token REDIM
+%token REM
+%token REMOVEHANDLER
+%token RESUME
+%token RETURN
+%token SELECT
+%token SET
+%token SHADOWS
+%token SHARED
+%token SHORT
+%token SINGLE
+%token SIZEOF
+%token STATIC
+%token STEP
+%token STOP
+%token STRING
+%token STRUCTURE
+%token SUB
+%token SYNCLOCK
+%token THEN
+%token THROW
+%token TO
+%token TRUE
+%token TRY
+%token TYPEOF
+%token UNICODE
+%token UNTIL
+%token VARIANT
+%token WHEN
+%token WHILE
+%token WITH
+%token WITHEVENTS
+%token WRITEONLY
+%token XOR
+
+/* MonoBASIC single character operators/punctuation. */
+%token OPEN_BRACKET "["
+%token CLOSE_BRACKET "]"
+%token OPEN_PARENS "("
+%token CLOSE_PARENS ")"
+%token DOT "."
+%token COMMA ","
+%token COLON ":"
+
+%token PLUS "+"
+%token MINUS "-"
+%token ASSIGN "="
+%token OP_LT "<"
+%token OP_GT ">"
+%token STAR "*"
+%token PERCENT "%"
+%token DIV "/"
+%token OP_EXP "^"
+%token INTERR "?"
+%token OP_IDIV "\\"
+%token OP_CONCAT "&"
+
+/* MonoBASIC multi-character operators. */
+%token OP_LE "<="
+%token OP_GE ">="
+%token OP_EQ "=="
+%token OP_NE "<>"
+%token OP_AND //"and"
+%token OP_OR //"or"
+%token OP_XOR //"xor"
+%token OP_MODULUS //"mod"
+%token OP_MULT_ASSIGN "*="
+%token OP_DIV_ASSIGN "/="
+%token OP_IDIV_ASSIGN "\\="
+%token OP_ADD_ASSIGN "+="
+%token OP_SUB_ASSIGN "-="
+%token OP_CONCAT_ASSIGN "&="
+%token OP_EXP_ASSIGN "^="
+
+/* Numbers */
+%token LITERAL_INTEGER "int literal"
+%token LITERAL_SINGLE "float literal"
+%token LITERAL_DOUBLE "double literal"
+%token LITERAL_DECIMAL "decimal literal"
+%token LITERAL_CHARACTER "character literal"
+%token LITERAL_STRING "string literal"
+
+%token IDENTIFIER
+
+/* Add precedence rules to solve dangling else s/r conflict */
+%nonassoc LOWPREC
+%nonassoc IF
+%nonassoc ELSE
+%right ASSIGN
+%left OP_OR
+%left OP_AND
+%left BITWISE_OR
+%left BITWISE_AND
+%left OP_SHIFT_LEFT OP_SHIFT_RIGHT
+%left PLUS MINUS
+%left STAR DIV PERCENT
+%right BITWISE_NOT CARRET UMINUS
+%nonassoc OP_INC OP_DEC
+%left OPEN_PARENS
+%left OPEN_BRACKET OPEN_BRACE
+%left DOT
+%nonassoc HIGHPREC
+
+%start compilation_unit
+%%
+
+compilation_unit
+ : opt_imports_directives
+ /* opt_attributes */
+ opt_namespace_member_declarations
+ EOF
+ {
+ $$ = $3;
+ }
+ ;
+
+qualified_identifier
+ : IDENTIFIER
+ | qualified_identifier DOT IDENTIFIER
+ {
+ $$ = (($1).ToString ()) + "." + ($3.ToString ());
+ }
+ ;
+
+opt_imports_directives
+ : /* empty */
+ | imports_directives
+ ;
+
+imports_directives
+ : imports_directive
+ | imports_directives imports_directive
+ ;
+
+imports_directive
+ : /* imports_alias_directive
+ | */ imports_namespace_directive
+ ;
+
+imports_namespace_directive
+ : IMPORTS namespace_name EOL
+ {
+ current_namespace.Using ((string) $2);
+ }
+ ;
+
+opt_attributes
+ : /* empty */
+ ;
+
+namespace_declaration
+ : NAMESPACE qualified_identifier EOL
+ {
+ current_namespace = new Namespace (current_namespace, (string) $2);
+ }
+ opt_imports_directives
+ opt_namespace_member_declarations
+ END NAMESPACE EOL
+ {
+ current_namespace = current_namespace.Parent;
+ }
+ ;
+
+namespace_name
+ : qualified_identifier
+ ;
+
+
+
+opt_namespace_member_declarations
+ : /* empty */
+ | namespace_member_declarations
+ ;
+
+namespace_member_declarations
+ : namespace_member_declaration
+ | namespace_member_declarations namespace_member_declaration
+ ;
+
+namespace_member_declaration
+ : namespace_declaration
+ | type_declaration
+ {
+ int mod_flags = 0;
+ string name = "";
+
+ if ($1 is Class){
+ Class c = (Class) $1;
+ mod_flags = c.ModFlags;
+ name = c.Name;
+ } else if ($1 is Struct){
+ Struct s = (Struct) $1;
+ mod_flags = s.ModFlags;
+ name = s.Name;
+ } else
+ break;
+
+ }
+ ;
+
+
+type_declaration
+ : class_declaration
+ ;
+
+
+class_declaration
+ : /* opt_attributes opt_modifiers */
+ CLASS IDENTIFIER /* opt_class_interfaces */ EOL
+ {
+ }
+ opt_class_member_declarations
+ END CLASS EOL
+ {
+ }
+ ;
+
+opt_class_member_declarations
+ : /* empty */
+ | class_member_declarations
+ ;
+
+class_member_declarations
+ : class_member_declaration
+ | class_member_declarations class_member_declaration
+ ;
+
+class_member_declaration
+ : type_declaration
+ | sub_declaration
+ ;
+
+sub_declaration
+ : SUB qualified_identifier OPEN_PARENS opt_formal_parameters CLOSE_PARENS EOL
+ opt_statements
+ END SUB EOL
+ ;
+
+opt_statements
+ : /* empty */
+ | qualified_identifier OPEN_PARENS opt_actual_parameters CLOSE_PARENS EOL
+ ;
+
+opt_formal_parameters
+ : /* empty */
+ | qualified_identifier AS qualified_identifier
+ ;
+
+opt_actual_parameters
+ : /* empty */
+ | qualified_identifier
+ | LITERAL_STRING
+ ;
+
+%%
+
+
+Tokenizer lexer;
+
+public override int parse ()
+{
+ current_namespace = new Namespace (null, "");
+ this.tree = rc.Tree;
+ current_container = tree.Types;
+ current_container.Namespace = current_namespace;
+
+ UseExtendedSyntax = name.EndsWith(".mbs");
+
+ lexer = new Tokenizer (input, name);
+ StringBuilder value = new StringBuilder ();
+
+ global_errors = 0;
+ try
+ {
+ if (yacc_verbose_flag)
+ yyparse (lexer, new yydebug.yyDebugSimple ());
+ else
+ yyparse (lexer);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine (lexer.location + " : Parsing error ");
+ Console.WriteLine (e);
+ global_errors++;
+ }
+
+ return global_errors;
+}
+
+/* end end end */
+}
+
+
diff --git a/mcs/mcs/mb-tokenizer.cs b/mcs/mcs/mb-tokenizer.cs
new file mode 100644
index 00000000000..e6252742edb
--- /dev/null
+++ b/mcs/mcs/mb-tokenizer.cs
@@ -0,0 +1,824 @@
+//
+// MonoBASIC.Tokenizer.cs: The Tokenizer for the MonoBASIC compiler
+//
+// Author: A Rafael D Teixeira (rafaelteixeirabr@hotmail.com)
+//
+// Based on cs-tokenizer.cs by Miguel de Icaza (miguel@gnu.org)
+//
+// Licensed under the terms of the GNU GPL
+//
+// Copyright (C) 2001 A Rafael D Teixeira
+//
+
+/*
+ Todo:
+
+ EVERYTHING
+
+*/
+
+
+namespace Mono.Languages.MonoBASIC
+{
+ using System;
+ using System.Text;
+ using System.Collections;
+ using System.IO;
+ using System.Globalization;
+ using Mono.Languages.MonoBASIC;
+ using Mono.CSharp;
+
+ /// <summary>
+ /// Tokenizer for MonoBASIC source code.
+ /// </summary>
+
+ public class Tokenizer : yyParser.yyInput
+ {
+ TextReader reader;
+ public string ref_name;
+ public int ref_line = 1;
+ public int line = 1;
+ public int col = 1;
+ public int current_token;
+ bool handle_get_set = false;
+
+ public string location {
+ get {
+ string det;
+
+ if (current_token == Token.ERROR)
+ det = "detail: " + error_details;
+ else
+ det = "";
+
+ return "Line: "+line+" Col: "+col + "\n" +
+ "VirtLine: "+ref_line +
+ " Token: "+current_token + " " + det;
+ }
+ }
+
+ public bool properties {
+ get {
+ return handle_get_set;
+ }
+
+ set {
+ handle_get_set = value;
+ }
+ }
+
+ //
+ // Class variables
+ //
+ static Hashtable keywords;
+ static NumberStyles styles;
+ static NumberFormatInfo csharp_format_info;
+
+ //
+ // Values for the associated token returned
+ //
+ System.Text.StringBuilder number;
+ int putback_char;
+ Object val;
+
+ //
+ // Details about the error encoutered by the tokenizer
+ //
+ string error_details;
+
+ public string error {
+ get {
+ return error_details;
+ }
+ }
+
+ public int Line {
+ get {
+ return line;
+ }
+ }
+
+ public int Col {
+ get {
+ return col;
+ }
+ }
+
+ static void initTokens ()
+ {
+ keywords = new Hashtable ();
+
+ keywords.Add ("addhandler", Token.ADDHANDLER);
+ keywords.Add ("addressof", Token.ADDRESSOF);
+ keywords.Add ("alias", Token.ALIAS);
+ keywords.Add ("and", Token.AND);
+ keywords.Add ("andalso", Token.ANDALSO);
+ keywords.Add ("ansi", Token.ANSI);
+ keywords.Add ("as", Token.AS);
+ keywords.Add ("assembly", Token.ASSEMBLY);
+ keywords.Add ("auto", Token.AUTO);
+ keywords.Add ("boolean", Token.BOOLEAN);
+ keywords.Add ("byref", Token.BYREF);
+ keywords.Add ("byte", Token.BYTE);
+ keywords.Add ("byval", Token.BYVAL);
+ keywords.Add ("call", Token.CALL);
+ keywords.Add ("case", Token.CASE);
+ keywords.Add ("catch", Token.CATCH);
+ keywords.Add ("cbool", Token.CBOOL);
+ keywords.Add ("cbyte", Token.CBYTE);
+ keywords.Add ("cchar", Token.CCHAR);
+ keywords.Add ("cdate", Token.CDATE);
+ keywords.Add ("cdec", Token.CDEC);
+ keywords.Add ("cdbl", Token.CDBL);
+ keywords.Add ("char", Token.CHAR);
+ keywords.Add ("cint", Token.CINT);
+ keywords.Add ("class", Token.CLASS);
+ keywords.Add ("clng", Token.CLNG);
+ keywords.Add ("cobj", Token.COBJ);
+ //keywords.Add ("compare", Token.COMPARE);
+ keywords.Add ("const", Token.CONST);
+ keywords.Add ("cshort", Token.CSHORT);
+ keywords.Add ("csng", Token.CSNG);
+ keywords.Add ("cstr", Token.CSTR);
+ keywords.Add ("ctype", Token.CTYPE);
+ keywords.Add ("date", Token.DATE);
+ keywords.Add ("decimal", Token.DECIMAL);
+ keywords.Add ("declare", Token.DECLARE);
+ keywords.Add ("default", Token.DEFAULT);
+ keywords.Add ("delegate", Token.DELEGATE);
+ keywords.Add ("dim", Token.DIM);
+ keywords.Add ("do", Token.DO);
+ keywords.Add ("double", Token.DOUBLE);
+ keywords.Add ("each", Token.EACH);
+ keywords.Add ("else", Token.ELSE);
+ keywords.Add ("elseif", Token.ELSEIF);
+ keywords.Add ("end", Token.END);
+ keywords.Add ("enum", Token.ENUM);
+ keywords.Add ("erase", Token.ERASE);
+ keywords.Add ("error", Token.ERROR);
+ keywords.Add ("event", Token.EVENT);
+ keywords.Add ("exit", Token.EXIT);
+ //keywords.Add ("explicit", Token.EXPLICIT);
+ keywords.Add ("false", Token.FALSE);
+ keywords.Add ("finally", Token.FINALLY);
+ keywords.Add ("for", Token.FOR);
+ keywords.Add ("friend", Token.FRIEND);
+ keywords.Add ("function", Token.FUNCTION);
+ keywords.Add ("get", Token.GET);
+ keywords.Add ("gettype", Token.GETTYPE);
+ keywords.Add ("goto", Token.GOTO);
+ keywords.Add ("handles", Token.HANDLES);
+ keywords.Add ("if", Token.IF);
+ keywords.Add ("implements", Token.IMPLEMENTS);
+ keywords.Add ("imports", Token.IMPORTS);
+ keywords.Add ("in", Token.IN);
+ keywords.Add ("inherits", Token.INHERITS);
+ keywords.Add ("integer", Token.INTEGER);
+ keywords.Add ("interface", Token.INTERFACE);
+ keywords.Add ("is", Token.IS);
+ keywords.Add ("let ", Token.LET );
+ keywords.Add ("lib ", Token.LIB );
+ keywords.Add ("like ", Token.LIKE );
+ keywords.Add ("long", Token.LONG);
+ keywords.Add ("loop", Token.LOOP);
+ keywords.Add ("me", Token.ME);
+ keywords.Add ("mod", Token.MOD);
+ keywords.Add ("module", Token.MODULE);
+ keywords.Add ("mustinherit", Token.MUSTINHERIT);
+ keywords.Add ("mustoverride", Token.MUSTOVERRIDE);
+ keywords.Add ("mybase", Token.MYBASE);
+ keywords.Add ("myclass", Token.MYCLASS);
+ keywords.Add ("namespace", Token.NAMESPACE);
+ keywords.Add ("new", Token.NEW);
+ keywords.Add ("next", Token.NEXT);
+ keywords.Add ("not", Token.NOT);
+ keywords.Add ("nothing", Token.NOTHING);
+ keywords.Add ("notinheritable", Token.NOTINHERITABLE);
+ keywords.Add ("notoverridable", Token.NOTOVERRIDABLE);
+ keywords.Add ("object", Token.OBJECT);
+ keywords.Add ("on", Token.ON);
+ keywords.Add ("option", Token.OPTION);
+ keywords.Add ("optional", Token.OPTIONAL);
+ keywords.Add ("or", Token.OR);
+ keywords.Add ("orelse", Token.ORELSE);
+ keywords.Add ("overloads", Token.OVERLOADS);
+ keywords.Add ("overridable", Token.OVERRIDABLE);
+ keywords.Add ("overrides", Token.OVERRIDES);
+ keywords.Add ("paramarray", Token.PARAM_ARRAY);
+ keywords.Add ("preserve", Token.PRESERVE);
+ keywords.Add ("private", Token.PRIVATE);
+ keywords.Add ("property", Token.PROPERTY);
+ keywords.Add ("protected", Token.PROTECTED);
+ keywords.Add ("public", Token.PUBLIC);
+ keywords.Add ("raiseevent", Token.RAISEEVENT);
+ keywords.Add ("readonly", Token.READONLY);
+ keywords.Add ("redim", Token.REDIM);
+ keywords.Add ("rem", Token.REM);
+ keywords.Add ("removehandler", Token.REMOVEHANDLER);
+ keywords.Add ("resume", Token.RESUME);
+ keywords.Add ("return", Token.RETURN);
+ keywords.Add ("select", Token.SELECT);
+ keywords.Add ("set", Token.SET);
+ keywords.Add ("shadows", Token.SHADOWS);
+ keywords.Add ("shared", Token.SHARED);
+ keywords.Add ("short", Token.SHORT);
+ keywords.Add ("single", Token.SINGLE);
+ keywords.Add ("sizeof", Token.SIZEOF);
+ keywords.Add ("static", Token.STATIC);
+ keywords.Add ("step", Token.STEP);
+ keywords.Add ("stop", Token.STOP);
+ keywords.Add ("string", Token.STRING);
+ keywords.Add ("structure", Token.STRUCTURE);
+ keywords.Add ("sub", Token.SUB);
+ keywords.Add ("synclock", Token.SYNCLOCK);
+ keywords.Add ("then", Token.THEN);
+ keywords.Add ("throw", Token.THROW);
+ keywords.Add ("to", Token.TO);
+ keywords.Add ("true", Token.TRUE);
+ keywords.Add ("try", Token.TRY);
+ keywords.Add ("typeof", Token.TYPEOF);
+ keywords.Add ("unicode", Token.UNICODE);
+ keywords.Add ("until", Token.UNTIL);
+ keywords.Add ("variant", Token.VARIANT);
+ keywords.Add ("when", Token.WHEN);
+ keywords.Add ("while", Token.WHILE);
+ keywords.Add ("with", Token.WITH);
+ keywords.Add ("withevents", Token.WITHEVENTS);
+ keywords.Add ("writeonly", Token.WRITEONLY);
+ keywords.Add ("xor", Token.XOR);
+ }
+
+ //
+ // Class initializer
+ //
+ static Tokenizer ()
+ {
+ initTokens ();
+ csharp_format_info = new NumberFormatInfo ();
+ csharp_format_info.CurrencyDecimalSeparator = ".";
+ styles = NumberStyles.AllowExponent | NumberStyles.AllowDecimalPoint;
+ }
+
+ bool is_keyword (string name)
+ {
+ bool res;
+
+ res = keywords.Contains(name.ToLower());
+ if ((name == "get" || name == "set") && handle_get_set == false)
+ return false;
+ return res;
+ }
+
+ int getKeyword (string name)
+ {
+ return (int) (keywords [name.ToLower()]);
+ }
+
+ public Location Location {
+ get {
+ return new Location (ref_line);
+ }
+ }
+
+ public Tokenizer (System.IO.TextReader input, string fname)
+ {
+ this.ref_name = fname;
+ reader = input;
+ putback_char = -1;
+
+ Location.Push (fname);
+ }
+
+ bool is_identifier_start_character (char c)
+ {
+ return Char.IsLetter (c) || c == '_' ;
+ }
+
+ bool is_identifier_part_character (char c)
+ {
+ return (Char.IsLetter (c) || Char.IsDigit (c) || c == '_');
+ }
+
+ int is_punct (char c, ref bool doread)
+ {
+ int idx = "{}[](),:;~+-*/%&|^!=<>?".IndexOf (c);
+ int d;
+ int t;
+
+ doread = false;
+
+ switch (c){
+ case '[':
+ return Token.OPEN_BRACKET;
+ case ']':
+ return Token.CLOSE_BRACKET;
+ case '(':
+ return Token.OPEN_PARENS;
+ case ')':
+ return Token.CLOSE_PARENS;
+ case ',':
+ return Token.COMMA;
+ case ':':
+ return Token.COLON;
+ case '?':
+ return Token.INTERR;
+ }
+
+ d = peekChar ();
+ if (c == '+'){
+
+ if (d == '+')
+ t = Token.OP_INC;
+ else if (d == '=')
+ t = Token.OP_ADD_ASSIGN;
+ else
+ return Token.PLUS;
+ doread = true;
+ return t;
+ }
+ if (c == '-'){
+ if (d == '=')
+ t = Token.OP_SUB_ASSIGN;
+ else
+ return Token.MINUS;
+ doread = true;
+ return t;
+ }
+
+ if (c == '='){
+ /*if (d == '='){
+ doread = true;
+ return Token.OP_EQ;
+ }*/
+ return Token.ASSIGN;
+ }
+
+ if (c == '*'){
+ if (d == '='){
+ doread = true;
+ return Token.OP_MULT_ASSIGN;
+ }
+ return Token.STAR;
+ }
+
+ if (c == '/'){
+ if (d == '='){
+ doread = true;
+ return Token.OP_DIV_ASSIGN;
+ }
+ return Token.DIV;
+ }
+
+ if (c == '\\'){
+ if (d == '='){
+ doread = true;
+ return Token.OP_IDIV_ASSIGN;
+ }
+ return Token.OP_IDIV;
+ }
+
+ if (c == '^'){
+ if (d == '='){
+ doread = true;
+ return Token.OP_EXP_ASSIGN;
+ }
+ return Token.OP_EXP;
+ }
+
+ if (c == '<'){
+ if (d == '>')
+ {
+ doread = true;
+ return Token.OP_NE;
+ }
+ if (d == '='){
+ doread = true;
+ return Token.OP_LE;
+ }
+ return Token.OP_LT;
+ }
+
+ if (c == '>'){
+ if (d == '='){
+ doread = true;
+ return Token.OP_GE;
+ }
+ return Token.OP_GT;
+ }
+ return Token.ERROR;
+ }
+
+ bool decimal_digits (int c)
+ {
+ int d;
+ bool seen_digits = false;
+
+ if (c != -1)
+ number.Append ((char) c);
+
+ while ((d = peekChar ()) != -1){
+ if (Char.IsDigit ((char)d)){
+ number.Append ((char) d);
+ getChar ();
+ seen_digits = true;
+ } else
+ break;
+ }
+ return seen_digits;
+ }
+
+ void hex_digits (int c)
+ {
+ int d;
+
+ if (c != -1)
+ number.Append ((char) c);
+ while ((d = peekChar ()) != -1){
+ char e = Char.ToUpper ((char) d);
+
+ if (Char.IsDigit (e) ||
+ (e >= 'A' && e <= 'F')){
+ number.Append ((char) e);
+ getChar ();
+ } else
+ break;
+ }
+ }
+
+ int real_type_suffix (int c)
+ {
+ int t;
+
+ switch (c){
+ case 'F': case 'f':
+ t = Token.LITERAL_SINGLE;
+ break;
+ case 'D': case 'd':
+ t = Token.LITERAL_DOUBLE;
+ break;
+ case 'M': case 'm':
+ t= Token.LITERAL_DECIMAL;
+ break;
+ default:
+ return Token.NONE;
+ }
+ getChar ();
+ return t;
+ }
+
+ int integer_type_suffix (int c)
+ {
+ // FIXME: Handle U and L suffixes.
+ // We also need to see in which kind of
+ // Int the thing fits better according to the spec.
+ return Token.LITERAL_INTEGER;
+ }
+
+ void adjust_int (int t)
+ {
+ val = new System.Int32();
+ val = System.Int32.Parse (number.ToString (), 0);
+ }
+
+ int adjust_real (int t)
+ {
+ string s = number.ToString ();
+
+ Console.WriteLine (s);
+ switch (t){
+ case Token.LITERAL_DECIMAL:
+ val = new System.Decimal ();
+ val = System.Decimal.Parse (
+ s, styles, csharp_format_info);
+ break;
+ case Token.LITERAL_DOUBLE:
+ val = new System.Double ();
+ val = System.Double.Parse (
+ s, styles, csharp_format_info);
+ break;
+ case Token.LITERAL_SINGLE:
+ val = new System.Double ();
+ val = (float) System.Double.Parse (
+ s, styles, csharp_format_info);
+ break;
+
+ case Token.NONE:
+ val = new System.Double ();
+ val = System.Double.Parse (
+ s, styles, csharp_format_info);
+ t = Token.LITERAL_DOUBLE;
+ break;
+ }
+ return t;
+ }
+
+ //
+ // Invoked if we know we have .digits or digits
+ //
+ int is_number (int c)
+ {
+ bool is_real = false;
+ number = new System.Text.StringBuilder ();
+ int type;
+
+ number.Length = 0;
+
+ if (Char.IsDigit ((char)c)){
+ if (c == '0' && peekChar () == 'x' || peekChar () == 'X'){
+ getChar ();
+ hex_digits (-1);
+ val = new System.Int32 ();
+ val = System.Int32.Parse (number.ToString (), NumberStyles.HexNumber);
+ return integer_type_suffix (peekChar ());
+ }
+ decimal_digits (c);
+ c = getChar ();
+ }
+
+ //
+ // We need to handle the case of
+ // "1.1" vs "1.string" (LITERAL_SINGLE vs NUMBER DOT IDENTIFIER)
+ //
+ if (c == '.'){
+ if (decimal_digits ('.')){
+ is_real = true;
+ c = peekChar ();
+ } else {
+ putback ('.');
+ number.Length -= 1;
+ adjust_int (Token.LITERAL_INTEGER);
+ return Token.LITERAL_INTEGER;
+ }
+ }
+
+ if (c == 'e' || c == 'E'){
+ is_real = true;
+ number.Append ("e");
+ getChar ();
+
+ c = peekChar ();
+ if (c == '+'){
+ number.Append ((char) c);
+ getChar ();
+ c = peekChar ();
+ } else if (c == '-'){
+ number.Append ((char) c);
+ getChar ();
+ c = peekChar ();
+ }
+ decimal_digits (-1);
+ c = peekChar ();
+ }
+
+ type = real_type_suffix (c);
+ if (type == Token.NONE && !is_real){
+ type = integer_type_suffix (c);
+ adjust_int (type);
+ putback (c);
+ return type;
+ } else
+ is_real = true;
+
+ if (is_real)
+ return adjust_real (type);
+
+ Console.WriteLine ("This should not be reached");
+ throw new Exception ("Is Number should never reach this point");
+ }
+
+ int escape (int c)
+ {
+ int d;
+ int v;
+
+ d = peekChar ();
+ if (c != '\\')
+ return c;
+
+ switch (d){
+ case 'a':
+ v = '\a'; break;
+ case 'b':
+ v = '\b'; break;
+ case 'n':
+ v = '\n'; break;
+ case 't':
+ v = '\t'; break;
+ case 'v':
+ v = '\v'; break;
+ case 'r':
+ v = 'c'; break;
+ case '\\':
+ v = '\\'; break;
+ case 'f':
+ v = '\f'; break;
+ case '0':
+ v = 0; break;
+ case '"':
+ v = '"'; break;
+ case '\'':
+ v = '\''; break;
+ default:
+ error_details = "cs1009: Unrecognized escape sequence " + (char)d;
+ return -1;
+ }
+ getChar ();
+ return v;
+ }
+
+ int getChar ()
+ {
+ if (putback_char != -1){
+ int x = putback_char;
+ putback_char = -1;
+
+ return x;
+ }
+ return reader.Read ();
+ }
+
+ int peekChar ()
+ {
+ if (putback_char != -1)
+ return putback_char;
+ return reader.Peek ();
+ }
+
+ void putback (int c)
+ {
+ if (putback_char != -1)
+ throw new Exception ("This should not happen putback on putback");
+ putback_char = c;
+ }
+
+ public bool advance ()
+ {
+ return current_token != Token.EOF ;
+ }
+
+ public Object Value {
+ get {
+ return val;
+ }
+ }
+
+ public Object value ()
+ {
+ return val;
+ }
+
+ public int token ()
+ {
+ current_token = xtoken ();
+ if (current_token == 0)
+ return Token.EOF;
+ return current_token;
+ }
+
+ public int xtoken ()
+ {
+ int t;
+ bool allow_keyword_as_ident = false;
+ bool doread = false;
+ int c;
+
+ val = null;
+ for (;(c = getChar ()) != -1; col++) {
+
+ // Handle line comments.
+ if (c == '\''){
+ int d = getChar ();
+ while ((d = getChar ()) != -1 && (d != '\n'))
+ col++;
+ line++;
+ ref_line++;
+ col = 0;
+ if (current_token == Token.EOL) // if last token was also EOL keep skipping
+ continue;
+ return Token.EOL;
+ }
+
+ // Handle EOL.
+ if (c == '\n')
+ {
+ line++;
+ ref_line++;
+ col = 0;
+ if (current_token == Token.EOL) // if last token was also EOL keep skipping
+ continue;
+ return Token.EOL;
+ }
+
+ // Handle identifiers
+ if (is_identifier_start_character ((char) c)){
+ System.Text.StringBuilder id = new System.Text.StringBuilder ();
+ string ids;
+
+ id.Append ((char) c);
+
+ while ((c = peekChar ()) != -1) {
+ if (is_identifier_part_character ((char) c)){
+ id.Append ((char)getChar ());
+ col++;
+ } else
+ break;
+ }
+
+ ids = id.ToString ();
+
+ if (!is_keyword (ids) || allow_keyword_as_ident) {
+ val = ids;
+ return Token.IDENTIFIER;
+ }
+
+ // true, false and null are in the hash anyway.
+ return getKeyword (ids);
+
+ }
+
+ if (c == '.'){
+ if (Char.IsDigit ((char) peekChar ()))
+ return is_number (c);
+ return Token.DOT;
+ }
+
+ if (Char.IsDigit ((char) c))
+ return is_number (c);
+
+ /* For now, ignore pre-processor commands */
+ if (col == 1 && c == '#'){
+ System.Text.StringBuilder s = new System.Text.StringBuilder ();
+
+ while ((c = getChar ()) != -1 && (c != '\n')){
+ s.Append ((char) c);
+ }
+ if (String.Compare (s.ToString (), 0, "line", 0, 4) == 0){
+ string arg = s.ToString ().Substring (5);
+ int pos;
+
+ if ((pos = arg.IndexOf (' ')) != -1 && pos != 0){
+ ref_line = System.Int32.Parse (arg.Substring (0, pos));
+ pos++;
+
+ char [] quotes = { '\"' };
+
+ ref_name = arg.Substring (pos);
+ ref_name.TrimStart (quotes);
+ ref_name.TrimEnd (quotes);
+ } else
+ ref_line = System.Int32.Parse (arg);
+ }
+ line++;
+ ref_line++;
+ continue;
+ }
+
+ if ((t = is_punct ((char)c, ref doread)) != Token.ERROR){
+ if (doread){
+ getChar ();
+ col++;
+ }
+ return t;
+ }
+
+ if (c == '"'){
+ System.Text.StringBuilder s = new System.Text.StringBuilder ();
+
+ while ((c = getChar ()) != -1){
+ if (c == '"'){
+ val = s.ToString ();
+ return Token.LITERAL_STRING;
+ }
+
+ c = escape (c);
+ if (c == -1)
+ return Token.ERROR;
+ s.Append ((char) c);
+ }
+ }
+
+ // white space
+ if (c == ' ' || c == '\t' || c == '\f' || c == '\v' || c == '\r'){
+ if (c == '\t')
+ col = (((col + 8) / 8) * 8) - 1;
+
+ continue;
+ }
+
+ if (c == '@'){
+ allow_keyword_as_ident = true;
+ continue;
+ }
+
+ error_details = ((char)c).ToString ();
+
+ return Token.ERROR;
+ }
+
+ if (current_token != Token.EOL) // if last token wasn´t EOL send it before EOF
+ return Token.EOL;
+
+ return Token.EOF;
+ }
+ }
+}
diff --git a/mcs/mcs/mcs.exe.config b/mcs/mcs/mcs.exe.config
new file mode 100644
index 00000000000..cf61d4baa0b
--- /dev/null
+++ b/mcs/mcs/mcs.exe.config
@@ -0,0 +1,11 @@
+<configuration>
+ <system.diagnostics>
+ <trace autoflush="true" indentsize="4">
+ <listeners>
+ <add name="compilerLogListener" type="System.Diagnostics.TextWriterTraceListener,System"
+ initializeData="mcs.log" />
+ <remove type="System.Diagnostics.DefaultTraceListener,System"/>
+ </listeners>
+ </trace>
+ </system.diagnostics>
+</configuration>
diff --git a/mcs/mcs/modifiers.cs b/mcs/mcs/modifiers.cs
index e05159285e0..a5ad3d3646e 100755
--- a/mcs/mcs/modifiers.cs
+++ b/mcs/mcs/modifiers.cs
@@ -4,7 +4,7 @@
using System;
using System.Reflection;
-namespace CIR {
+namespace Mono.CSharp {
public class Modifiers {
//
@@ -23,7 +23,9 @@ namespace CIR {
public const int VIRTUAL = 0x0200;
public const int OVERRIDE = 0x0400;
public const int EXTERN = 0x0800;
- public const int TOP = 0x0800;
+ public const int VOLATILE = 0x1000;
+ public const int UNSAFE = 0x2000;
+ public const int TOP = 0x2000;
public const int Accessibility =
PUBLIC | PROTECTED | INTERNAL | PRIVATE;
@@ -57,29 +59,121 @@ namespace CIR {
s = "override"; break;
case Modifiers.EXTERN:
s = "extern"; break;
+ case Modifiers.VOLATILE:
+ s = "volatile"; break;
}
return s;
}
- public static TypeAttributes TypeAttr (int mod_flags)
+ public static TypeAttributes TypeAttr (int mod_flags, TypeContainer caller)
{
TypeAttributes t = 0;
+ bool top_level = caller.IsTopLevel;
+
+ if (top_level){
+ if ((mod_flags & PUBLIC) != 0)
+ t |= TypeAttributes.Public;
+ if ((mod_flags & PRIVATE) != 0)
+ t |= TypeAttributes.NotPublic;
+ } else {
+ if ((mod_flags & PUBLIC) != 0)
+ t |= TypeAttributes.NestedPublic;
+ if ((mod_flags & PRIVATE) != 0)
+ t |= TypeAttributes.NestedPrivate;
+ if ((mod_flags & PROTECTED) != 0 && (mod_flags & INTERNAL) != 0)
+ t |= TypeAttributes.NestedFamORAssem;
+ if ((mod_flags & PROTECTED) != 0)
+ t |= TypeAttributes.NestedFamily;
+ if ((mod_flags & INTERNAL) != 0)
+ t |= TypeAttributes.NestedAssembly;
+ }
+ if ((mod_flags & SEALED) != 0)
+ t |= TypeAttributes.Sealed;
+ if ((mod_flags & ABSTRACT) != 0)
+ t |= TypeAttributes.Abstract;
+
+ // If we do not have static constructors, static methods
+ // can be invoked without initializing the type.
+ if (!caller.HaveStaticConstructor)
+ t |= TypeAttributes.BeforeFieldInit;
+
+ return t;
+ }
+
+ public static FieldAttributes FieldAttr (int mod_flags)
+ {
+ FieldAttributes fa = 0;
+
if ((mod_flags & PUBLIC) != 0)
- t |= TypeAttributes.Public;
+ fa |= FieldAttributes.Public;
+ if ((mod_flags & PRIVATE) != 0)
+ fa |= FieldAttributes.Private;
+ if ((mod_flags & PROTECTED) != 0 && (mod_flags & INTERNAL) != 0)
+ fa |= FieldAttributes.FamORAssem;
+ if ((mod_flags & PROTECTED) != 0)
+ fa |= FieldAttributes.Family;
+ if ((mod_flags & INTERNAL) != 0)
+ fa |= FieldAttributes.Assembly;
+
+ if ((mod_flags & STATIC) != 0)
+ fa |= FieldAttributes.Static;
+ if ((mod_flags & READONLY) != 0)
+ fa |= FieldAttributes.InitOnly;
- // FIXME: implement all flags
+ return fa;
+ }
- return t;
+ public static MethodAttributes MethodAttr (int mod_flags)
+ {
+ MethodAttributes ma = 0;
+
+ if ((mod_flags & PUBLIC) != 0)
+ ma |= MethodAttributes.Public;
+ if ((mod_flags & PRIVATE) != 0)
+ ma |= MethodAttributes.Private;
+ if ((mod_flags & PROTECTED) != 0){
+ if ((mod_flags & INTERNAL) != 0)
+ ma |= MethodAttributes.FamORAssem;
+ else
+ ma |= MethodAttributes.Family;
+ } else {
+ if ((mod_flags & INTERNAL) != 0)
+ ma |= MethodAttributes.Assembly;
+ }
+
+ if ((mod_flags & STATIC) != 0)
+ ma |= MethodAttributes.Static;
+ if ((mod_flags & ABSTRACT) != 0){
+ ma |= MethodAttributes.Abstract | MethodAttributes.Virtual |
+ MethodAttributes.HideBySig;
+ }
+ if ((mod_flags & SEALED) != 0)
+ ma |= MethodAttributes.Final;
+
+ if ((mod_flags & VIRTUAL) != 0)
+ ma |= MethodAttributes.Virtual;
+
+ if ((mod_flags & OVERRIDE) != 0)
+ ma |= MethodAttributes.Virtual | MethodAttributes.HideBySig;
+ else {
+ if ((ma & MethodAttributes.Virtual) != 0)
+ ma |= MethodAttributes.NewSlot;
+ }
+
+ if ((mod_flags & NEW) != 0)
+ ma |= MethodAttributes.HideBySig;
+
+ return ma;
}
-
+
// <summary>
// Checks the object @mod modifiers to be in @allowed.
// Returns the new mask. Side effect: reports any
// incorrect attributes.
// </summary>
- public static int Check (int allowed, int mod, int def_access)
+ public static int Check (int allowed, int mod, int def_access, Location l)
{
int invalid_flags = (~allowed) & mod;
int i;
@@ -87,6 +181,14 @@ namespace CIR {
if (invalid_flags == 0){
int a = mod;
+ if ((mod & Modifiers.UNSAFE) != 0){
+ if (!RootContext.Unsafe){
+ Report.Error (227, l,
+ "Unsafe code requires the --unsafe command " +
+ "line option to be specified");
+ }
+ }
+
//
// If no accessibility bits provided
// then provide the defaults.
@@ -107,7 +209,7 @@ namespace CIR {
a = ((a & 2) >> 1) + (a & 5);
a = ((a & 4) >> 2) + (a & 3);
if (a > 1)
- CSC.CSharpParser.error (107, "More than one protecion modifier specified");
+ Report.Error (107, l, "More than one protection modifier specified");
return mod;
}
@@ -116,7 +218,8 @@ namespace CIR {
if ((i & invalid_flags) == 0)
continue;
- CSC.CSharpParser.error (106, "the modifier `" + Name (i) + "' is not valid for this item");
+ Report.Error (106, l, "the modifier `" + Name (i) +
+ "' is not valid for this item");
}
return allowed & mod;
diff --git a/mcs/mcs/namespace.cs b/mcs/mcs/namespace.cs
index 17a98230791..f9ccd2e9369 100755
--- a/mcs/mcs/namespace.cs
+++ b/mcs/mcs/namespace.cs
@@ -1,87 +1,125 @@
+//
+// namespace.cs: Tracks namespaces
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
using System;
using System.Collections;
-using CIR;
-namespace CSC {
+namespace Mono.CSharp {
- // <summary>
- // Keeps track of the namespaces defined in the C# code.
- // </summary>
+ /// <summary>
+ /// Keeps track of the namespaces defined in the C# code.
+ /// </summary>
public class Namespace {
Namespace parent;
string name;
- Hashtable using_clauses;
+ ArrayList using_clauses;
+ Hashtable aliases;
bool decl_found = false;
- // <summary>
- // Constructor Takes the current namespace and the
- // name. This is bootrstraped with parent == null
- // and name = ""
- // </summary>
+ /// <summary>
+ /// Constructor Takes the current namespace and the
+ /// name. This is bootstrapped with parent == null
+ /// and name = ""
+ /// </summary>
public Namespace (Namespace parent, string name)
{
this.name = name;
this.parent = parent;
}
- // <summary>
- // The qualified name of the current namespace
- // </summary>
+ /// <summary>
+ /// The qualified name of the current namespace
+ /// </summary>
public string Name {
get {
- if (parent != null)
+ string pname = parent != null ? parent.Name : "";
+
+ if (pname == "")
+ return name;
+ else
return parent.Name + "." + name;
-
- return name;
}
}
- // <summary>
- // The parent of this namespace, used by the parser to "Pop"
- // the current namespace declaration
- // </summary>
+ /// <summary>
+ /// The parent of this namespace, used by the parser to "Pop"
+ /// the current namespace declaration
+ /// </summary>
public Namespace Parent {
get {
return parent;
}
}
- // <summary>
- // When a declaration is found in a namespace,
- // we call this function, to emit an error if the
- // program attempts to use a using clause afterwards
- // </summary>
+ /// <summary>
+ /// When a declaration is found in a namespace,
+ /// we call this function, to emit an error if the
+ /// program attempts to use a using clause afterwards
+ /// </summary>
public void DeclarationFound ()
{
decl_found = true;
}
- // <summary>
- // Records a new namespace for resolving name references
- // </summary>
+ /// <summary>
+ /// Records a new namespace for resolving name references
+ /// </summary>
public void Using (string ns)
{
if (decl_found){
CSharpParser.error (1529, "A using clause must precede all other namespace elements");
return;
}
-
+
if (using_clauses == null)
- using_clauses = new Hashtable ();
+ using_clauses = new ArrayList ();
- using_clauses.Add (ns, null);
+ using_clauses.Add (ns);
}
- public Hashtable UsingTable {
+ public ArrayList UsingTable {
get {
return using_clauses;
}
}
- // <summary>
- // Used to validate that all the using clauses are correct
- // after we are finished parsing all the files
- // </summary>
+ public void UsingAlias (string alias, string namespace_or_type, Location loc)
+ {
+ if (aliases == null)
+ aliases = new Hashtable ();
+
+ if (aliases.Contains (alias)){
+ Report.Error (1537, loc, "The using alias `" + alias +
+ "' appeared previously in this namespace");
+ return;
+ }
+
+ aliases [alias] = namespace_or_type;
+ }
+
+ public string LookupAlias (string alias)
+ {
+ string value = null;
+
+ // System.Console.WriteLine ("Lookup " + alias + " in " + name);
+
+ if (aliases != null)
+ value = (string) (aliases [alias]);
+ if (value == null && Parent != null)
+ value = Parent.LookupAlias (alias);
+
+ return value;
+ }
+
+ /// <summary>
+ /// Used to validate that all the using clauses are correct
+ /// after we are finished parsing all the files
+ /// </summary>
public void VerifyUsing ()
{
foreach (DictionaryEntry de in using_clauses){
@@ -94,6 +132,7 @@ namespace CSC {
}
}
}
+
}
}
diff --git a/mcs/mcs/old-code.cs b/mcs/mcs/old-code.cs
new file mode 100755
index 00000000000..271ffa2a7f5
--- /dev/null
+++ b/mcs/mcs/old-code.cs
@@ -0,0 +1,216 @@
+#else
+
+ bla bla bla
+ //
+ // This code is more conformant to the spec (it follows it step by step),
+ // but it has not been tested yet, and there is nothing here that is not
+ // caught by the above code. But it might be a better foundation to improve
+ // on in the future
+ //
+ public ResolveTypeMemberAccess (EmitContext ec, Expression member_lookup,
+ Expression left, Location loc)
+ {
+ if (member_lookup is TypeExpr){
+ member_lookup.Resolve (ec);
+ return member_lookup;
+ }
+
+ if (member_lookup is MethodGroupExpr){
+ if (!mg.RemoveStaticMethods ()){
+ SimpleName.Error120 (loc, mg.Methods [0].Name);
+ return null;
+ }
+
+ return member_lookup;
+ }
+
+ if (member_lookup is PropertyExpr){
+ PropertyExpr pe = (PropertyExpr) member_lookup;
+
+ if (!pe.IsStatic){
+ SimpleName.Error120 (loc, pe.PropertyInfo.Name);
+ return null;
+ }
+ return pe;
+ }
+
+ if (member_lookup is FieldExpr){
+ FieldExpr fe = (FieldExpr) member_lookup;
+ FieldInfo fi = fe.FieldInfo;
+
+ if (fi is FieldBuilder) {
+ Const c = TypeManager.LookupConstant ((FieldBuilder) fi);
+
+ if (c != null) {
+ object o = c.LookupConstantValue (ec);
+ return Constantify (o, fi.FieldType);
+ }
+ }
+
+ if (fi.IsLiteral) {
+ Type t = fi.FieldType;
+ Type decl_type = fi.DeclaringType;
+ object o;
+
+ if (fi is FieldBuilder)
+ o = TypeManager.GetValue ((FieldBuilder) fi);
+ else
+ o = fi.GetValue (fi);
+
+ if (decl_type.IsSubclassOf (TypeManager.enum_type)) {
+ Expression enum_member = MemberLookup (
+ ec, decl_type, "value__", loc);
+
+ Enum en = TypeManager.LookupEnum (decl_type);
+
+ Constant c;
+ if (en != null)
+ c = Constantify (o, en.UnderlyingType);
+ else
+ c = Constantify (o, enum_member.Type);
+
+ return new EnumConstant (c, decl_type);
+ }
+
+ Expression exp = Constantify (o, t);
+
+ return exp;
+ }
+
+ if (!fe.FieldInfo.IsStatic){
+ error176 (loc, fe.FieldInfo.Name);
+ return null;
+ }
+ return member_lookup;
+ }
+
+ if (member_lookup is EventExpr){
+
+ EventExpr ee = (EventExpr) member_lookup;
+
+ //
+ // If the event is local to this class, we transform ourselves into
+ // a FieldExpr
+ //
+
+ Expression ml = MemberLookup (
+ ec, ec.TypeContainer.TypeBuilder, ee.EventInfo.Name,
+ MemberTypes.Event, AllBindingFlags, loc);
+
+ if (ml != null) {
+ MemberInfo mi = ec.TypeContainer.GetFieldFromEvent ((EventExpr) ml);
+
+ ml = ExprClassFromMemberInfo (ec, mi, loc);
+
+ if (ml == null) {
+ Report.Error (-200, loc, "Internal error!!");
+ return null;
+ }
+
+ return ResolveMemberAccess (ec, ml, left, loc);
+ }
+
+ if (!ee.IsStatic) {
+ SimpleName.Error120 (loc, ee.EventInfo.Name);
+ return null;
+ }
+
+ return ee;
+ }
+
+ Console.WriteLine ("Left is: " + left);
+ Report.Error (-100, loc, "Support for [" + member_lookup + "] is not present yet");
+ Environment.Exit (0);
+
+ return null;
+ }
+
+ public ResolveInstanceMemberAccess (EmitContext ec, Expression member_lookup,
+ Expression left, Location loc)
+ {
+ if (member_lookup is MethodGroupExpr){
+ //
+ // Instance.MethodGroup
+ //
+ if (!mg.RemoveStaticMethods ()){
+ error176 (loc, mg.Methods [0].Name);
+ return null;
+ }
+
+ mg.InstanceExpression = left;
+
+ return member_lookup;
+ }
+
+ if (member_lookup is PropertyExpr){
+ PropertyExpr pe = (PropertyExpr) member_lookup;
+
+ if (pe.IsStatic){
+ error176 (loc, pe.PropertyInfo.Name);
+ return null;
+ }
+ pe.InstanceExpression = left;
+
+ return pe;
+ }
+
+ Type left_type = left.type;
+
+ if (left_type.IsValueType){
+ } else {
+
+ }
+ }
+
+ public override Expression DoResolve (EmitContext ec)
+ {
+ //
+ // We are the sole users of ResolveWithSimpleName (ie, the only
+ // ones that can cope with it
+ //
+ expr = expr.ResolveWithSimpleName (ec);
+
+ if (expr == null)
+ return null;
+
+ if (expr is SimpleName){
+ SimpleName child_expr = (SimpleName) expr;
+
+ expr = new SimpleName (child_expr.Name + "." + Identifier, loc);
+
+ return expr.ResolveWithSimpleName (ec);
+ }
+
+ //
+ // Handle enums here when they are in transit.
+ // Note that we cannot afford to hit MemberLookup in this case because
+ // it will fail to find any members at all (Why?)
+ //
+
+ Type expr_type = expr.Type;
+ if (expr_type.IsSubclassOf (TypeManager.enum_type)) {
+
+ Enum en = TypeManager.LookupEnum (expr_type);
+
+ if (en != null) {
+ object value = en.LookupEnumValue (ec, Identifier, loc);
+
+ if (value == null)
+ return null;
+
+ Constant c = Constantify (value, en.UnderlyingType);
+ return new EnumConstant (c, expr_type);
+ }
+ }
+
+ member_lookup = MemberLookup (ec, expr.Type, Identifier, loc);
+
+ if (member_lookup == null)
+ return null;
+
+ if (expr is TypeExpr)
+ return ResolveTypeMemberAccess (ec, member_lookup, expr, loc);
+ else
+ return ResolveInstanceMemberAccess (ec, member_lookup, expr, loc);
+ }
+#endif
diff --git a/mcs/mcs/parameter.cs b/mcs/mcs/parameter.cs
index 63f6854fb29..8663824bccf 100755
--- a/mcs/mcs/parameter.cs
+++ b/mcs/mcs/parameter.cs
@@ -8,138 +8,388 @@
// (C) 2001 Ximian, Inc (http://www.ximian.com)
//
//
-// FIXME: We should deprecate ParameterCollection as it is mostly slow
-// to access (it uses an arraylist instead of a hashtable) and exposes
-// no method to quickly locate parameters by name.
-//
-// Look at the implementation for GetParameterByName for an example.
//
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Collections;
-namespace CIR {
+namespace Mono.CSharp {
- using System;
-
- public class Parameter {
- public enum Modifier {
- NONE,
- REF,
- OUT,
- PARAMS,
+ /// <summary>
+ /// Represents a single method parameter
+ /// </summary>
+ public class Parameter {
+ [Flags]
+ public enum Modifier : byte {
+ NONE = 0,
+ REF = 1,
+ OUT = 2,
+ PARAMS = 4,
}
- TypeRef typeref;
- string name;
- Modifier mod;
+ public readonly string TypeName;
+ public readonly string Name;
+ public readonly Modifier ModFlags;
+ public Attributes OptAttributes;
+ public Type ParameterType;
- public Parameter (TypeRef typeref, string name, Modifier mod)
+ public Parameter (string type, string name, Modifier mod, Attributes attrs)
{
- this.name = name;
- this.mod = mod;
- this.typeref = typeref;
+ Name = name;
+ ModFlags = mod;
+ TypeName = type;
+ OptAttributes = attrs;
}
- string ModSignature ()
+ // <summary>
+ // Resolve is used in method definitions
+ // </summary>
+ public bool Resolve (DeclSpace ds, Location l)
{
- switch (mod){
- case Modifier.NONE:
- return "";
- case Modifier.REF:
- return "&";
- case Modifier.OUT:
- return ">";
- case Modifier.PARAMS:
- return "";
- }
- // This should not happen.
- return (string) null;
+ ParameterType = RootContext.LookupType (ds, TypeName, false, l);
+ return ParameterType != null;
+ }
+
+ // <summary>
+ // ResolveAndDefine is used by delegate declarations, because
+ // they happen during the initial tree resolution process
+ // </summary>
+ public bool ResolveAndDefine (DeclSpace ds)
+ {
+ ParameterType = ds.FindType (TypeName);
+ return ParameterType != null;
}
- public string Signature {
- get {
- return ModSignature (); // TYPEFIX: + Type.GetTypeEncoding (typeref.Type);
+ public Type ExternalType (DeclSpace ds, Location l)
+ {
+ if ((ModFlags & (Parameter.Modifier.REF | Parameter.Modifier.OUT)) != 0){
+ string n = ParameterType.FullName + "&";
+
+ Type t = RootContext.LookupType (ds, n, false, l);
+
+ return t;
}
+
+ return ParameterType;
}
- public Type Type {
+ public ParameterAttributes Attributes {
get {
- return typeref.Type;
+ switch (ModFlags){
+ case Modifier.NONE:
+ return ParameterAttributes.None;
+ case Modifier.REF:
+ return ParameterAttributes.None;
+ case Modifier.OUT:
+ return ParameterAttributes.Out;
+ case Modifier.PARAMS:
+ return 0;
+ }
+
+ return ParameterAttributes.None;
}
}
-
- public string Name {
- get {
- return name;
+
+ /// <summary>
+ /// Returns the signature for this parameter evaluating it on the
+ /// @tc context
+ /// </summary>
+ public string GetSignature (DeclSpace ds, Location loc)
+ {
+ if (ParameterType == null){
+ if (!Resolve (ds, loc))
+ return null;
}
- }
- public Modifier ModFlags {
- get {
- return mod;
- }
+ return ExternalType (ds, loc).FullName;
}
}
+ /// <summary>
+ /// Represents the methods parameters
+ /// </summary>
public class Parameters {
- ParameterCollection fixed_parameters;
- Parameter array_parameter;
+ public Parameter [] FixedParameters;
+ public readonly Parameter ArrayParameter;
string signature;
+ Type [] types;
+ Location loc;
- public Parameters (ParameterCollection fixed_parameters, Parameter array_parameter)
+ static Parameters empty_parameters;
+
+ public Parameters (Parameter [] fixed_parameters, Parameter array_parameter, Location l)
{
- this.fixed_parameters = fixed_parameters;
- this.array_parameter = array_parameter;
+ FixedParameters = fixed_parameters;
+ ArrayParameter = array_parameter;
+ loc = l;
}
- void compute_signature ()
+ /// <summary>
+ /// This is used to reuse a set of empty parameters, because they
+ /// are common
+ /// </summary>
+ public static Parameters GetEmptyReadOnlyParameters ()
{
- signature = "";
+ if (empty_parameters == null)
+ empty_parameters = new Parameters (null, null, Location.Null);
- if (fixed_parameters != null){
- for (int i = 0; i < fixed_parameters.Count; i++){
- Parameter par = (Parameter) fixed_parameters [i];
+ return empty_parameters;
+ }
+
+ public bool Empty {
+ get {
+ return (FixedParameters == null) && (ArrayParameter == null);
+ }
+ }
+
+ public void ComputeSignature (DeclSpace ds)
+ {
+ signature = "";
+ if (FixedParameters != null){
+ for (int i = 0; i < FixedParameters.Length; i++){
+ Parameter par = FixedParameters [i];
- signature += par.Signature;
+ signature += par.GetSignature (ds, loc);
}
}
-
//
- // Note: as per the spec, the `params' arguments (array_parameter)
+ // Note: as per the spec, the `params' arguments (ArrayParameter)
// are not used in the signature computation for a method
//
}
+
+ static void error100 (string name)
+ {
+ Report.Error (
+ 100, "The parameter name `" + name + "' is a duplicate");
+ }
- public ParameterCollection FixedParameters {
- get {
- return fixed_parameters;
+ public bool VerifyArgs ()
+ {
+ int count;
+ int i, j;
+
+ if (FixedParameters == null)
+ return true;
+
+ count = FixedParameters.Length;
+ string array_par_name = ArrayParameter != null ? ArrayParameter.Name : null;
+ for (i = 0; i < count; i++){
+ string base_name = FixedParameters [i].Name;
+
+ for (j = i + 1; j < count; j++){
+ if (base_name != FixedParameters [j].Name)
+ continue;
+ error100 (base_name);
+ return false;
+ }
+
+ if (base_name == array_par_name){
+ error100 (base_name);
+ return false;
+ }
}
+ return true;
}
+
+ /// <summary>
+ /// Returns the signature of the Parameters evaluated in
+ /// the @tc environment
+ /// </summary>
+ public string GetSignature (DeclSpace ds)
+ {
+ if (signature == null){
+ VerifyArgs ();
+ ComputeSignature (ds);
+ }
+
+ return signature;
+ }
+
+ /// <summary>
+ /// Returns the paramenter information based on the name
+ /// </summary>
+ public Parameter GetParameterByName (string name, out int idx)
+ {
+ idx = 0;
+ int i = 0;
- public Parameter ArrayParameter {
- get {
- return array_parameter;
+ if (FixedParameters != null){
+ foreach (Parameter par in FixedParameters){
+ if (par.Name == name){
+ idx = i;
+ return par;
+ }
+ i++;
+ }
+ }
+
+ if (ArrayParameter != null){
+ if (name == ArrayParameter.Name){
+ idx = i;
+ return ArrayParameter;
+ }
}
+
+ return null;
}
- // Removed for now, as we can not compute this at
- // boot strap.
- public string Signature {
- get {
- return signature;
+ bool ComputeParameterTypes (DeclSpace ds)
+ {
+ int extra = (ArrayParameter != null) ? 1 : 0;
+ int i = 0;
+ int pc;
+
+ if (FixedParameters == null)
+ pc = extra;
+ else
+ pc = extra + FixedParameters.Length;
+
+ types = new Type [pc];
+
+ if (!VerifyArgs ()){
+ FixedParameters = null;
+ return false;
+ }
+
+ bool failed = false;
+ if (FixedParameters != null){
+ foreach (Parameter p in FixedParameters){
+ Type t = null;
+
+ if (p.Resolve (ds, loc))
+ t = p.ExternalType (ds, loc);
+ else
+ failed = true;
+
+ types [i] = t;
+ i++;
+ }
+ }
+ if (failed)
+ return false;
+
+ if (extra > 0){
+ if (ArrayParameter.Resolve (ds, loc))
+ types [i] = ArrayParameter.ExternalType (ds, loc);
+ }
+
+ return true;
+ }
+
+ //
+ // This variant is used by Delegates, because they need to
+ // resolve/define names, instead of the plain LookupType
+ //
+ public bool ComputeAndDefineParameterTypes (DeclSpace ds)
+ {
+ int extra = (ArrayParameter != null) ? 1 : 0;
+ int i = 0;
+ int pc;
+
+ if (FixedParameters == null)
+ pc = extra;
+ else
+ pc = extra + FixedParameters.Length;
+
+ types = new Type [pc];
+
+ if (!VerifyArgs ()){
+ FixedParameters = null;
+ return false;
+ }
+
+ if (FixedParameters != null){
+ foreach (Parameter p in FixedParameters){
+ Type t = null;
+
+ if (p.ResolveAndDefine (ds))
+ t = p.ExternalType (ds, loc);
+
+ types [i] = t;
+ i++;
+ }
+ }
+
+ if (extra > 0){
+ if (ArrayParameter.ResolveAndDefine (ds))
+ types [i] = ArrayParameter.ExternalType (ds, loc);
}
+
+ return true;
+ }
+
+ /// <summary>
+ /// Returns the argument types as an array
+ /// </summary>
+ static Type [] no_types = new Type [0];
+
+ public Type [] GetParameterInfo (DeclSpace ds)
+ {
+ if (types != null)
+ return types;
+
+ if (FixedParameters == null && ArrayParameter == null)
+ return no_types;
+
+ if (ComputeParameterTypes (ds) == false)
+ return null;
+
+ return types;
}
- public Parameter GetParameterByName (string name)
+ /// <summary>
+ /// Returns the type of a given parameter, and stores in the `is_out'
+ /// boolean whether this is an out or ref parameter.
+ ///
+ /// Note that the returned type will not contain any dereference in this
+ /// case (ie, you get "int" for a ref int instead of "int&"
+ /// </summary>
+ public Type GetParameterInfo (DeclSpace ds, int idx, out bool is_out)
{
- if (fixed_parameters == null)
+ is_out = false;
+
+ if (!VerifyArgs ()){
+ FixedParameters = null;
return null;
+ }
- foreach (Parameter par in fixed_parameters)
- if (par.Name == name)
- return par;
- return null;
+ if (FixedParameters == null && ArrayParameter == null)
+ return null;
+
+ if (types == null)
+ if (ComputeParameterTypes (ds) == false){
+ is_out = false;
+ return null;
+ }
+
+ //
+ // If this is a request for the variable lenght arg.
+ //
+ int array_idx = (FixedParameters != null ? FixedParameters.Length : 0);
+ if (idx == array_idx){
+ is_out = false;
+ return types [idx];
+ }
+
+ //
+ // Otherwise, it is a fixed parameter
+ //
+ Parameter p = FixedParameters [idx];
+ is_out = ((p.ModFlags & (Parameter.Modifier.REF | Parameter.Modifier.OUT)) != 0);
+
+ return p.ParameterType;
+ }
+
+ public CallingConventions GetCallingConvention ()
+ {
+ // For now this is the only correc thing to do
+ return CallingConventions.Standard;
}
}
}
+
diff --git a/mcs/mcs/parameterCollection.cs b/mcs/mcs/parameterCollection.cs
index 77d895c3b4b..222742544b1 100755
--- a/mcs/mcs/parameterCollection.cs
+++ b/mcs/mcs/parameterCollection.cs
@@ -7,7 +7,7 @@
// (C) 2001 Ximian, Inc.
//
-namespace CIR {
+namespace Mono.CSharp {
using System.Collections;
using System;
@@ -156,5 +156,11 @@ namespace CIR {
return parameters.IsSynchronized;
}
}
+
+ public bool IsFixedSize {
+ get {
+ return false;
+ }
+ }
}
}
diff --git a/mcs/mcs/parser.cs b/mcs/mcs/parser.cs
index 08cca9bb487..c30a354ff91 100755
--- a/mcs/mcs/parser.cs
+++ b/mcs/mcs/parser.cs
@@ -1,3 +1,4 @@
+
namespace Compiler {
using System;
@@ -5,9 +6,8 @@ namespace Compiler {
abstract public class Parser {
public string name;
public System.IO.Stream input;
- public CIR.Tree tree;
- public Parser (CIR.Tree tree, string name, System.IO.Stream stream)
+ public Parser (Mono.CSharp.Tree tree, string name, System.IO.Stream stream)
{
this.tree = tree;
this.name = name;
diff --git a/mcs/mcs/report.cs b/mcs/mcs/report.cs
new file mode 100644
index 00000000000..0ffc2dfc188
--- /dev/null
+++ b/mcs/mcs/report.cs
@@ -0,0 +1,195 @@
+//
+// report.cs: report errors and warnings.
+//
+// Author: Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc. (http://www.ximian.com)
+//
+
+//
+// FIXME: currently our class library does not support custom number format strings
+//
+using System;
+using System.Collections;
+using System.Diagnostics;
+
+namespace Mono.CSharp {
+
+ /// <summary>
+ /// This class is used to report errors and warnings t te user.
+ /// </summary>
+ public class Report {
+ /// <summary>
+ /// Errors encountered so far
+ /// </summary>
+ static public int Errors;
+
+ /// <summary>
+ /// Warnings encountered so far
+ /// </summary>
+ static public int Warnings;
+
+ /// <summary>
+ /// Whether errors should be throw an exception
+ /// </summary>
+ static public bool Fatal;
+
+ /// <summary>
+ /// Whether warnings should be considered errors
+ /// </summary>
+ static public bool WarningsAreErrors;
+
+ /// <summary>
+ /// Whether to dump a stack trace on errors.
+ /// </summary>
+ static public bool Stacktrace;
+
+ //
+ // If the error code is reported on the given line,
+ // then the process exits with a unique error code.
+ //
+ // Used for the test suite to excercise the error codes
+ //
+ static int probe_error = 0;
+
+ //
+ // Keeps track of the warnings that we are ignoring
+ //
+ static Hashtable warning_ignore_table;
+
+ static void Check (int code)
+ {
+ if (code == probe_error){
+ if (Fatal)
+ throw new Exception ();
+
+ Environment.Exit (123);
+ }
+ }
+
+ static public void RealError (string msg)
+ {
+ Errors++;
+ Console.WriteLine (msg);
+
+ if (Stacktrace)
+ Console.WriteLine (new StackTrace ().ToString ());
+ if (Fatal)
+ throw new Exception (msg);
+ }
+
+ static public void Error (int code, Location l, string text)
+ {
+ string msg = String.Format (
+ "{0}({1}) error CS{2:0000}: {3}", l.Name, l.Row, code, text);
+// "{0}({1}) error CS{2}: {3}", l.Name, l.Row, code, text);
+
+ RealError (msg);
+ Check (code);
+ }
+
+ static public void Warning (int code, Location l, string text)
+ {
+ if (warning_ignore_table != null){
+ if (warning_ignore_table.Contains (code))
+ return;
+ }
+
+ if (WarningsAreErrors)
+ Error (code, l, text);
+ else {
+ string row;
+
+ if (Location.IsNull (l))
+ row = "";
+ else
+ row = l.Row.ToString ();
+
+ Console.WriteLine (String.Format (
+ "{0}({1}) warning CS{2:0000}: {3}",
+// "{0}({1}) warning CS{2}: {3}",
+ l.Name, row, code, text));
+ Warnings++;
+ Check (code);
+
+ if (Stacktrace)
+ Console.WriteLine (new StackTrace ().ToString ());
+ }
+ }
+
+ static public void Warning (int code, string text)
+ {
+ Warning (code, Location.Null, text);
+ }
+
+ static public void Error (int code, string text)
+ {
+ string msg = String.Format ("error CS{0:0000}: {1}", code, text);
+// string msg = String.Format ("error CS{0}: {1}", code, text);
+
+ RealError (msg);
+ Check (code);
+ }
+
+ static public void Message (Message m)
+ {
+ if (m is ErrorMessage)
+ Error (m.code, m.text);
+ else
+ Warning (m.code, m.text);
+ }
+
+ static public void SetIgnoreWarning (int code)
+ {
+ if (warning_ignore_table == null)
+ warning_ignore_table = new Hashtable ();
+
+ warning_ignore_table [code] = true;
+ }
+
+ static public void SetProbe (int code)
+ {
+ probe_error = code;
+ }
+
+ static public int ProbeCode {
+ get {
+ return probe_error;
+ }
+ }
+ }
+
+ public class Message {
+ public int code;
+ public string text;
+
+ public Message (int code, string text)
+ {
+ this.code = code;
+ this.text = text;
+ }
+ }
+
+ public class WarningMessage : Message {
+ public WarningMessage (int code, string text) : base (code, text)
+ {
+ }
+ }
+
+ public class ErrorMessage : Message {
+ public ErrorMessage (int code, string text) : base (code, text)
+ {
+ }
+
+ //
+ // For compatibility reasons with old code.
+ //
+ public static void report_error (string error)
+ {
+ Console.Write ("ERROR: ");
+ Console.WriteLine (error);
+ }
+ }
+}
+
+
diff --git a/mcs/mcs/rootcontext.cs b/mcs/mcs/rootcontext.cs
new file mode 100755
index 00000000000..0258d806ba5
--- /dev/null
+++ b/mcs/mcs/rootcontext.cs
@@ -0,0 +1,724 @@
+//
+// rootcontext.cs: keeps track of our tree representation, and assemblies loaded.
+//
+// Author: Miguel de Icaza (miguel@ximian.com)
+// Ravi Pratap (ravi@ximian.com)
+//
+// Licensed under the terms of the GNU GPL
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Diagnostics;
+
+namespace Mono.CSharp {
+
+ public class RootContext {
+
+ //
+ // Contains the parsed tree
+ //
+ static Tree tree;
+
+ static public bool Optimize;
+
+ //
+ // The list of global attributes (those that target the assembly)
+ //
+ static Attributes global_attributes;
+
+ //
+ // Whether we are being linked against the standard libraries.
+ // This is only used to tell whether `System.Object' should
+ // have a parent or not.
+ //
+ public static bool StdLib = true;
+
+ //
+ // This keeps track of the order in which classes were defined
+ // so that we can poulate them in that order.
+ //
+ // Order is important, because we need to be able to tell by
+ // examining the parent's list of methods which ones are virtual
+ // or abstract as well as the parent names (to implement new,
+ // override).
+ //
+ static ArrayList type_container_resolve_order;
+ static ArrayList interface_resolve_order;
+ static ArrayList attribute_types;
+
+ //
+ // Holds a reference to the Private Implementation Details
+ // class.
+ //
+ static TypeBuilder impl_details_class;
+
+ public static int WarningLevel = 2;
+
+ //
+ // Constructor
+ //
+ static RootContext ()
+ {
+ tree = new Tree ();
+ interface_resolve_order = new ArrayList ();
+ type_container_resolve_order = new ArrayList ();
+ }
+
+ static public Tree Tree {
+ get {
+ return tree;
+ }
+ }
+
+ static public string MainClass;
+
+ public static void RegisterOrder (Interface iface)
+ {
+ interface_resolve_order.Add (iface);
+ }
+
+ public static void RegisterOrder (TypeContainer tc)
+ {
+ type_container_resolve_order.Add (tc);
+ }
+
+ public static void RegisterAttribute (TypeContainer tc)
+ {
+ if (attribute_types == null)
+ attribute_types = new ArrayList ();
+
+ attribute_types.Add (tc);
+ }
+
+ //
+ // The default compiler checked state
+ //
+ static public bool Checked = false;
+
+ //
+ // Whether to allow Unsafe code
+ //
+ static public bool Unsafe = false;
+
+ static string MakeFQN (string nsn, string name)
+ {
+ string prefix = (nsn == "" ? "" : nsn + ".");
+
+ return prefix + name;
+ }
+
+ // <remarks>
+ // This function is used to resolve the hierarchy tree.
+ // It processes interfaces, structs and classes in that order.
+ //
+ // It creates the TypeBuilder's as it processes the user defined
+ // types.
+ // </remarks>
+ static public void ResolveTree ()
+ {
+ //
+ // Interfaces are processed first, as classes and
+ // structs might inherit from an object or implement
+ // a set of interfaces, we need to be able to tell
+ // them appart by just using the TypeManager.
+ //
+
+ TypeContainer root = Tree.Types;
+
+ ArrayList ifaces = root.Interfaces;
+ if (ifaces != null){
+ foreach (Interface i in ifaces)
+ i.DefineType ();
+ }
+
+ //
+ // Process the attribute types separately and before anything else
+ //
+ if (attribute_types != null)
+ foreach (TypeContainer tc in attribute_types)
+ tc.DefineType ();
+
+ foreach (TypeContainer tc in root.Types)
+ tc.DefineType ();
+
+ if (root.Delegates != null)
+ foreach (Delegate d in root.Delegates)
+ d.DefineType ();
+
+ if (root.Enums != null)
+ foreach (Enum e in root.Enums)
+ e.DefineType ();
+
+ }
+
+ static void Error_TypeConflict (string name, Location loc)
+ {
+ Report.Error (
+ 520, loc, "`" + name + "' conflicts with a predefined type");
+ }
+
+ static void Error_TypeConflict (string name)
+ {
+ Report.Error (
+ 520, "`" + name + "' conflicts with a predefined type");
+ }
+
+ //
+ // Resolves a single class during the corlib bootstrap process
+ //
+ static TypeBuilder BootstrapCorlib_ResolveClass (TypeContainer root, string name)
+ {
+ object o = root.GetDefinition (name);
+ if (o == null){
+ Report.Error (518, "The predefined type `" + name + "' is not defined");
+ return null;
+ }
+
+ if (!(o is Class)){
+ if (o is DeclSpace){
+ DeclSpace d = (DeclSpace) o;
+
+ Error_TypeConflict (name, d.Location);
+ } else
+ Error_TypeConflict (name);
+
+ return null;
+ }
+
+ return ((DeclSpace) o).DefineType ();
+ }
+
+ //
+ // Resolves a struct during the corlib bootstrap process
+ //
+ static void BootstrapCorlib_ResolveStruct (TypeContainer root, string name)
+ {
+ object o = root.GetDefinition (name);
+ if (o == null){
+ Report.Error (518, "The predefined type `" + name + "' is not defined");
+ return;
+ }
+
+ if (!(o is Struct)){
+ if (o is DeclSpace){
+ DeclSpace d = (DeclSpace) o;
+
+ Error_TypeConflict (name, d.Location);
+ } else
+ Error_TypeConflict (name);
+
+ return;
+ }
+
+ ((DeclSpace) o).DefineType ();
+ }
+
+ //
+ // Resolves a struct during the corlib bootstrap process
+ //
+ static void BootstrapCorlib_ResolveInterface (TypeContainer root, string name)
+ {
+ object o = root.GetDefinition (name);
+ if (o == null){
+ Report.Error (518, "The predefined type `" + name + "' is not defined");
+ return;
+ }
+
+ if (!(o is Interface)){
+ if (o is DeclSpace){
+ DeclSpace d = (DeclSpace) o;
+
+ Error_TypeConflict (name, d.Location);
+ } else
+ Error_TypeConflict (name);
+
+ return;
+ }
+
+ ((DeclSpace) o).DefineType ();
+ }
+
+ //
+ // Resolves a delegate during the corlib bootstrap process
+ //
+ static void BootstrapCorlib_ResolveDelegate (TypeContainer root, string name)
+ {
+ object o = root.GetDefinition (name);
+ if (o == null){
+ Report.Error (518, "The predefined type `" + name + "' is not defined");
+ Environment.Exit (0);
+ }
+
+ if (!(o is Delegate)){
+ Error_TypeConflict (name);
+ return;
+ }
+
+ ((DeclSpace) o).DefineType ();
+ }
+
+
+ /// <summary>
+ /// Resolves the core types in the compiler when compiling with --nostdlib
+ /// </summary>
+ static public void ResolveCore ()
+ {
+ TypeContainer root = Tree.Types;
+
+ TypeManager.object_type = BootstrapCorlib_ResolveClass (root, "System.Object");
+ TypeManager.value_type = BootstrapCorlib_ResolveClass (root, "System.ValueType");
+ TypeManager.attribute_type = BootstrapCorlib_ResolveClass (root, "System.Attribute");
+
+ string [] interfaces_first_stage = {
+ "System.IComparable", "System.ICloneable",
+ "System.IConvertible",
+
+ "System.Collections.IEnumerable",
+ "System.Collections.ICollection",
+ "System.Collections.IEnumerator",
+ "System.Collections.IList",
+ "System.IAsyncResult",
+ "System.IDisposable",
+
+ "System.Runtime.Serialization.ISerializable",
+
+ "System.Reflection.IReflect",
+ "System.Reflection.ICustomAttributeProvider"
+ };
+
+ foreach (string iname in interfaces_first_stage)
+ BootstrapCorlib_ResolveInterface (root, iname);
+
+
+ //
+ // These are the base value types
+ //
+ string [] structs_first_stage = {
+ "System.Byte", "System.SByte",
+ "System.Int16", "System.UInt16",
+ "System.Int32", "System.UInt32",
+ "System.Int64", "System.UInt64",
+ "System.Single", "System.Double",
+ "System.Char", "System.Boolean",
+ "System.Decimal", "System.Void",
+ "System.RuntimeFieldHandle",
+ "System.RuntimeTypeHandle",
+ "System.IntPtr"
+ };
+
+ foreach (string cname in structs_first_stage)
+ BootstrapCorlib_ResolveStruct (root, cname);
+
+ //
+ // These are classes that depends on the core interfaces
+ //
+ string [] classes_second_stage = {
+ "System.String", "System.Enum",
+ "System.Array", "System.MulticastDelegate",
+ "System.Delegate",
+
+ "System.Reflection.MemberInfo",
+ "System.Type",
+
+ //
+ // These are not really important in the order, but they
+ // are used by the compiler later on (typemanager/CoreLookupType-d)
+ //
+ "System.Runtime.CompilerServices.RuntimeHelpers",
+ "System.Reflection.DefaultMemberAttribute",
+ "System.Threading.Monitor",
+
+ "System.AttributeUsageAttribute",
+ "System.Runtime.InteropServices.DllImportAttribute",
+ "System.Runtime.CompilerServices.MethodImplAttribute",
+ "System.Runtime.InteropServices.MarshalAsAttribute",
+ "System.ParamArrayAttribute",
+ "System.Security.UnverifiableCodeAttribute",
+ };
+
+ foreach (string cname in classes_second_stage)
+ BootstrapCorlib_ResolveClass (root, cname);
+
+ BootstrapCorlib_ResolveDelegate (root, "System.AsyncCallback");
+ }
+
+ // <summary>
+ // Closes all open types
+ // </summary>
+ //
+ // <remarks>
+ // We usually use TypeBuilder types. When we are done
+ // creating the type (which will happen after we have added
+ // methods, fields, etc) we need to "Define" them before we
+ // can save the Assembly
+ // </remarks>
+ static public void CloseTypes ()
+ {
+ TypeContainer root = Tree.Types;
+
+ ArrayList ifaces = root.Interfaces;
+
+ if (root.Enums != null)
+ foreach (Enum en in root.Enums)
+ en.CloseType ();
+
+ if (attribute_types != null)
+ foreach (TypeContainer tc in attribute_types)
+ tc.CloseType ();
+
+ foreach (Interface iface in interface_resolve_order)
+ iface.CloseType ();
+
+ //
+ // We do this in two passes, first we close the structs,
+ // then the classes, because it seems the code needs it this
+ // way. If this is really what is going on, we should probably
+ // make sure that we define the structs in order as well.
+ //
+ foreach (TypeContainer tc in type_container_resolve_order){
+ if (tc is Struct && tc.Parent == tree.Types){
+ tc.CloseType ();
+ }
+ }
+
+ foreach (TypeContainer tc in type_container_resolve_order){
+ if (!(tc is Struct && tc.Parent == tree.Types))
+ tc.CloseType ();
+ }
+
+ if (root.Delegates != null)
+ foreach (Delegate d in root.Delegates)
+ d.CloseDelegate ();
+
+
+ //
+ // If we have a <PrivateImplementationDetails> class, close it
+ //
+ if (impl_details_class != null){
+ impl_details_class.CreateType ();
+ }
+ }
+
+ //
+ // This idea is from Felix Arrese-Igor
+ //
+ // Returns : the implicit parent of a composite namespace string
+ // eg. Implicit parent of A.B is A
+ //
+ static public string ImplicitParent (string ns)
+ {
+ int i = ns.LastIndexOf (".");
+ if (i < 0)
+ return null;
+
+ return ns.Substring (0, i);
+ }
+
+ static Type NamespaceLookup (Namespace curr_ns, string name)
+ {
+ Type t;
+
+ //
+ // Try in the current namespace and all its implicit parents
+ //
+ for (string ns = curr_ns.Name; ns != null; ns = ImplicitParent (ns)) {
+ t = TypeManager.LookupType (MakeFQN (ns, name));
+ if (t != null)
+ return t;
+ }
+
+ //
+ // It's possible that name already is fully qualified. So we do
+ // a simple direct lookup without adding any namespace names
+ //
+ t = TypeManager.LookupType (name);
+ if (t != null)
+ return t;
+
+ //
+ // Try the aliases in the current namespace
+ //
+ string alias = curr_ns.LookupAlias (name);
+
+ if (alias != null) {
+ t = TypeManager.LookupType (alias);
+ if (t != null)
+ return t;
+
+ t = TypeManager.LookupType (MakeFQN (alias, name));
+ if (t != null)
+ return t;
+ }
+
+ for (Namespace ns = curr_ns; ns != null; ns = ns.Parent) {
+ //
+ // Look in the namespace ns
+ //
+ t = TypeManager.LookupType (MakeFQN (ns.Name, name));
+ if (t != null)
+ return t;
+
+ //
+ // Then try with the using clauses
+ //
+ ArrayList using_list = ns.UsingTable;
+
+ if (using_list == null)
+ continue;
+
+ foreach (string n in using_list) {
+ t = TypeManager.LookupType (MakeFQN (n, name));
+ if (t != null)
+ return t;
+ }
+
+ //
+ // Try with aliases
+ //
+ string a = ns.LookupAlias (name);
+ if (a != null) {
+ t = TypeManager.LookupType (a);
+ if (t != null)
+ return t;
+
+ t = TypeManager.LookupType (MakeFQN (a, name));
+ if (t != null)
+ return t;
+ }
+ }
+
+ return null;
+ }
+
+ //
+ // Public function used to locate types, this can only
+ // be used after the ResolveTree function has been invoked.
+ //
+ // Returns: Type or null if they type can not be found.
+ //
+ static public Type LookupType (DeclSpace ds, string name, bool silent, Location loc)
+ {
+ Type t;
+
+ //
+ // For the case the type we are looking for is nested within this one
+ // or is in any base class
+ //
+ DeclSpace containing_ds = ds;
+ while (containing_ds != null){
+ Type current_type = containing_ds.TypeBuilder;
+
+ while (current_type != null) {
+ //
+ // nested class
+ //
+ t = TypeManager.LookupType (current_type.FullName + "+" + name);
+ if (t != null)
+ return t;
+
+ current_type = current_type.BaseType;
+ }
+
+ containing_ds = containing_ds.Parent;
+ }
+
+ t = NamespaceLookup (ds.Namespace, name);
+ if (t != null)
+ return t;
+
+ if (!silent)
+ Report.Error (246, loc, "Cannot find type `"+name+"'");
+
+ return null;
+ }
+
+ // <summary>
+ // This is the silent version of LookupType, you can use this
+ // to `probe' for a type
+ // </summary>
+ static public Type LookupType (TypeContainer tc, string name, Location loc)
+ {
+ return LookupType (tc, name, true, loc);
+ }
+
+ static public bool IsNamespace (string name)
+ {
+ Namespace ns;
+
+ if (tree.Namespaces != null){
+ ns = (Namespace) tree.Namespaces [name];
+
+ if (ns != null)
+ return true;
+ }
+
+ return false;
+ }
+
+ static void Report1530 (Location loc)
+ {
+ Report.Error (1530, loc, "Keyword new not allowed for namespace elements");
+ }
+
+ static public void PopulateCoreType (TypeContainer root, string name)
+ {
+ DeclSpace ds = (DeclSpace) root.GetDefinition (name);
+
+ ds.Define (root);
+ }
+
+ static public void BootCorlib_PopulateCoreTypes ()
+ {
+ TypeContainer root = tree.Types;
+
+ PopulateCoreType (root, "System.Object");
+ PopulateCoreType (root, "System.ValueType");
+ PopulateCoreType (root, "System.Attribute");
+ }
+
+ // <summary>
+ // Populates the structs and classes with fields and methods
+ // </summary>
+ //
+ // This is invoked after all interfaces, structs and classes
+ // have been defined through `ResolveTree'
+ static public void PopulateTypes ()
+ {
+ TypeContainer root = Tree.Types;
+
+ if (attribute_types != null)
+ foreach (TypeContainer tc in attribute_types)
+ tc.Define (root);
+
+ if (interface_resolve_order != null){
+ foreach (Interface iface in interface_resolve_order)
+ if ((iface.ModFlags & Modifiers.NEW) == 0)
+ iface.Define (root);
+ else
+ Report1530 (iface.Location);
+ }
+
+
+ if (type_container_resolve_order != null){
+ foreach (TypeContainer tc in type_container_resolve_order)
+ if ((tc.ModFlags & Modifiers.NEW) == 0)
+ tc.Define (root);
+ else
+ Report1530 (tc.Location);
+ }
+
+ ArrayList delegates = root.Delegates;
+ if (delegates != null){
+ foreach (Delegate d in delegates)
+ if ((d.ModFlags & Modifiers.NEW) == 0)
+ d.Define (root);
+ else
+ Report1530 (d.Location);
+ }
+
+ ArrayList enums = root.Enums;
+ if (enums != null){
+ foreach (Enum en in enums)
+ if ((en.ModFlags & Modifiers.NEW) == 0)
+ en.Define (root);
+ else
+ Report1530 (en.Location);
+ }
+ }
+
+ static public void EmitCode ()
+ {
+ //
+ // Because of the strange way in which we do things, global
+ // attributes must be processed first.
+ //
+ if (global_attributes != null){
+ EmitContext ec = new EmitContext (
+ tree.Types, Mono.CSharp.Location.Null, null, null, 0, false);
+ AssemblyBuilder ab = CodeGen.AssemblyBuilder;
+
+ Attribute.ApplyAttributes (ec, ab, ab, global_attributes,
+ global_attributes.Location);
+ }
+
+ if (attribute_types != null)
+ foreach (TypeContainer tc in attribute_types)
+ tc.Emit ();
+
+ if (type_container_resolve_order != null) {
+ foreach (TypeContainer tc in type_container_resolve_order)
+ tc.EmitConstants ();
+
+ foreach (TypeContainer tc in type_container_resolve_order)
+ tc.Emit ();
+ }
+
+ if (Unsafe) {
+ ConstructorInfo ci = TypeManager.unverifiable_code_type.GetConstructor (new Type [0]);
+
+ if (ci == null) {
+ Console.WriteLine ("Internal error !");
+ return;
+ }
+
+ CustomAttributeBuilder cb = new CustomAttributeBuilder (ci, new object [0]);
+ CodeGen.ModuleBuilder.SetCustomAttribute (cb);
+ }
+ }
+
+ //
+ // Public Field, used to track which method is the public entry
+ // point.
+ //
+ static public MethodInfo EntryPoint;
+
+ //
+ // These are used to generate unique names on the structs and fields.
+ //
+ static int field_count;
+
+ //
+ // Makes an initialized struct, returns the field builder that
+ // references the data. Thanks go to Sergey Chaban for researching
+ // how to do this. And coming up with a shorter mechanism than I
+ // was able to figure out.
+ //
+ // This works but makes an implicit public struct $ArrayType$SIZE and
+ // makes the fields point to it. We could get more control if we did
+ // use instead:
+ //
+ // 1. DefineNestedType on the impl_details_class with our struct.
+ //
+ // 2. Define the field on the impl_details_class
+ //
+ static public FieldBuilder MakeStaticData (byte [] data)
+ {
+ FieldBuilder fb;
+ int size = data.Length;
+
+ if (impl_details_class == null)
+ impl_details_class = CodeGen.ModuleBuilder.DefineType (
+ "<PrivateImplementationDetails>", TypeAttributes.NotPublic);
+
+ fb = impl_details_class.DefineInitializedData (
+ "$$field-" + (field_count++), data,
+ FieldAttributes.Static | FieldAttributes.Assembly);
+
+ return fb;
+ }
+
+ static public void AddGlobalAttribute (AttributeSection attr, Location loc)
+ {
+ if (global_attributes == null)
+ global_attributes = new Attributes (attr, loc);
+ else
+ global_attributes.AddAttribute (attr);
+ }
+ }
+}
+
+
diff --git a/mcs/mcs/statement.cs b/mcs/mcs/statement.cs
index 31e664d2f85..82561b0089e 100755
--- a/mcs/mcs/statement.cs
+++ b/mcs/mcs/statement.cs
@@ -4,184 +4,412 @@
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
-// (C) 2001 Ximian, Inc.
+// (C) 2001, 2002 Ximian, Inc.
//
using System;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Diagnostics;
-namespace CIR {
+namespace Mono.CSharp {
using System.Collections;
public abstract class Statement {
+ public Location loc;
+
+ /// <summary>
+ /// Return value indicates whether all code paths emitted return.
+ /// </summary>
+ public abstract bool Emit (EmitContext ec);
+
+ /// <remarks>
+ /// Emits a bool expression.
+ /// </remarks>
+ public static Expression EmitBoolExpression (EmitContext ec, Expression e,
+ Label target, bool isTrue, Location loc)
+ {
+ e = e.Resolve (ec);
+
+ if (e == null)
+ return null;
+
+ if (e.Type != TypeManager.bool_type){
+ e = Expression.ConvertImplicit (ec, e, TypeManager.bool_type,
+ new Location (-1));
+ }
+
+ if (e == null){
+ Report.Error (
+ 31, loc, "Can not convert the expression to a boolean");
+ return null;
+ }
+
+ if (CodeGen.SymbolWriter != null)
+ ec.Mark (loc);
+
+ bool invert = false;
+ if (e is Unary){
+ Unary u = (Unary) e;
+
+ if (u.Oper == Unary.Operator.LogicalNot){
+ invert = true;
+
+ u.EmitLogicalNot (ec);
+ }
+ }
+
+ if (!invert)
+ e.Emit (ec);
+
+ if (isTrue){
+ if (invert)
+ ec.ig.Emit (OpCodes.Brfalse, target);
+ else
+ ec.ig.Emit (OpCodes.Brtrue, target);
+ } else {
+ if (invert)
+ ec.ig.Emit (OpCodes.Brtrue, target);
+ else
+ ec.ig.Emit (OpCodes.Brfalse, target);
+ }
+
+ return e;
+ }
}
public class EmptyStatement : Statement {
+ public override bool Emit (EmitContext ec)
+ {
+ return false;
+ }
}
public class If : Statement {
- Expression expr;
- Statement trueStatement;
- Statement falseStatement;
+ public readonly Expression Expr;
+ public readonly Statement TrueStatement;
+ public readonly Statement FalseStatement;
- public If (Expression expr, Statement trueStatement)
+ public If (Expression expr, Statement trueStatement, Location l)
{
- this.expr = expr;
- this.trueStatement = trueStatement;
+ Expr = expr;
+ TrueStatement = trueStatement;
+ loc = l;
}
public If (Expression expr,
Statement trueStatement,
- Statement falseStatement)
+ Statement falseStatement,
+ Location l)
{
- this.expr = expr;
- this.trueStatement = trueStatement;
- this.falseStatement = falseStatement;
- }
-
- public Statement TrueStatement {
- get {
- return trueStatement;
- }
+ Expr = expr;
+ TrueStatement = trueStatement;
+ FalseStatement = falseStatement;
+ loc = l;
}
- public Statement FalseStatement {
- get {
- return falseStatement;
+ public override bool Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ Label false_target = ig.DefineLabel ();
+ Label end;
+ bool is_true_ret, is_false_ret;
+
+ if (EmitBoolExpression (ec, Expr, false_target, false, loc) == null)
+ return false;
+
+ is_true_ret = TrueStatement.Emit (ec);
+ is_false_ret = is_true_ret;
+
+ if (FalseStatement != null){
+ bool branch_emitted = false;
+
+ end = ig.DefineLabel ();
+ if (!is_true_ret){
+ ig.Emit (OpCodes.Br, end);
+ branch_emitted = true;
+ }
+
+ ig.MarkLabel (false_target);
+ is_false_ret = FalseStatement.Emit (ec);
+
+ if (branch_emitted)
+ ig.MarkLabel (end);
+ } else {
+ ig.MarkLabel (false_target);
+ is_false_ret = false;
}
- }
- public Expression Expr {
- get {
- return expr;
- }
+ return is_true_ret && is_false_ret;
}
}
public class Do : Statement {
- Expression boolExpr;
- Statement statement;
+ public readonly Expression Expr;
+ public readonly Statement EmbeddedStatement;
- public Do (Statement statement, Expression boolExpr)
+ public Do (Statement statement, Expression boolExpr, Location l)
{
- this.boolExpr = boolExpr;
- this.statement = statement;
+ Expr = boolExpr;
+ EmbeddedStatement = statement;
+ loc = l;
}
- public Statement EmbeddedStatement {
- get {
- return statement;
- }
- }
-
- public Expression Expr {
- get {
- return boolExpr;
+ public override bool Emit (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;
+ Expression e;
+
+ ec.LoopBegin = ig.DefineLabel ();
+ ec.LoopEnd = ig.DefineLabel ();
+ ec.InLoop = true;
+
+ ig.MarkLabel (loop);
+ EmbeddedStatement.Emit (ec);
+ ig.MarkLabel (ec.LoopBegin);
+ e = EmitBoolExpression (ec, Expr, loop, true, loc);
+ ig.MarkLabel (ec.LoopEnd);
+
+ ec.LoopBegin = old_begin;
+ ec.LoopEnd = old_end;
+ ec.InLoop = old_inloop;
+
+ //
+ // Inform whether we are infinite or not
+ //
+ if (e is BoolConstant){
+ BoolConstant bc = (BoolConstant) e;
+
+ if (bc.Value == true)
+ return true;
}
+
+ return false;
}
}
public class While : Statement {
- Expression boolExpr;
- Statement statement;
+ public readonly Expression Expr;
+ public readonly Statement Statement;
- public While (Expression boolExpr, Statement statement)
+ public While (Expression boolExpr, Statement statement, Location l)
{
- this.boolExpr = boolExpr;
- this.statement = statement;
+ Expr = boolExpr;
+ Statement = statement;
+ loc = l;
}
- public Statement Statement {
- get {
- return statement;
- }
- }
-
- public Expression Expr {
- get {
- return boolExpr;
+ public override bool Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ Label old_begin = ec.LoopBegin;
+ Label old_end = ec.LoopEnd;
+ bool old_inloop = ec.InLoop;
+ Expression e;
+
+ ec.LoopBegin = ig.DefineLabel ();
+ ec.LoopEnd = ig.DefineLabel ();
+ ec.InLoop = true;
+
+ ig.MarkLabel (ec.LoopBegin);
+ e = EmitBoolExpression (ec, Expr, ec.LoopEnd, false, loc);
+ Statement.Emit (ec);
+ ig.Emit (OpCodes.Br, ec.LoopBegin);
+ ig.MarkLabel (ec.LoopEnd);
+
+ ec.LoopBegin = old_begin;
+ ec.LoopEnd = old_end;
+ ec.InLoop = old_inloop;
+
+ //
+ // Inform whether we are infinite or not
+ //
+ if (e is BoolConstant){
+ BoolConstant bc = (BoolConstant) e;
+
+ if (bc.Value == true)
+ return true;
}
+ return false;
}
}
public class For : Statement {
- Statement initStatement;
- Expression test;
- Statement increment;
- Statement statement;
+ public readonly Statement InitStatement;
+ public readonly Expression Test;
+ public readonly Statement Increment;
+ public readonly Statement Statement;
public For (Statement initStatement,
Expression test,
Statement increment,
- Statement statement)
+ Statement statement,
+ Location l)
{
- this.initStatement = initStatement;
- this.test = test;
- this.increment = increment;
- this.statement = statement;
+ InitStatement = initStatement;
+ Test = test;
+ Increment = increment;
+ Statement = statement;
+ loc = l;
}
- public Statement InitStatement {
- get {
- return initStatement;
- }
- }
-
- public Expression Test {
- get {
- return test;
- }
- }
+ public override bool Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ Label old_begin = ec.LoopBegin;
+ Label old_end = ec.LoopEnd;
+ bool old_inloop = ec.InLoop;
+ Label loop = ig.DefineLabel ();
+ Expression e = null;
+
+ if (InitStatement != null)
+ if (! (InitStatement is EmptyStatement))
+ InitStatement.Emit (ec);
+
+ ec.LoopBegin = ig.DefineLabel ();
+ ec.LoopEnd = ig.DefineLabel ();
+ ec.InLoop = true;
+
+ ig.MarkLabel (loop);
+
+ //
+ // If test is null, there is no test, and we are just
+ // an infinite loop
+ //
+ if (Test != null)
+ e = EmitBoolExpression (ec, Test, ec.LoopEnd, false, loc);
- public Statement Increment {
- get {
- return increment;
- }
- }
-
- public Statement Statement {
- get {
- return statement;
- }
+ Statement.Emit (ec);
+ ig.MarkLabel (ec.LoopBegin);
+ if (!(Increment is EmptyStatement))
+ Increment.Emit (ec);
+ ig.Emit (OpCodes.Br, loop);
+ ig.MarkLabel (ec.LoopEnd);
+
+ ec.LoopBegin = old_begin;
+ ec.LoopEnd = old_end;
+ ec.InLoop = old_inloop;
+
+ //
+ // Inform whether we are infinite or not
+ //
+ if (Test != null){
+ if (e is BoolConstant){
+ BoolConstant bc = (BoolConstant) e;
+
+ if (bc.Value)
+ return true;
+ }
+ return false;
+ } else
+ return true;
}
-
}
public class StatementExpression : Statement {
- Expression expr;
+ public readonly ExpressionStatement Expr;
- public StatementExpression (Expression expr)
+ public StatementExpression (ExpressionStatement expr, Location l)
{
- this.expr = expr;
+ Expr = expr;
+ loc = l;
}
- public Expression Expr {
- get {
- return expr;
+ public override bool Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ Expression ne;
+
+ ne = Expr.Resolve (ec);
+ if (ne != null){
+ if (ne is ExpressionStatement)
+ ((ExpressionStatement) ne).EmitStatement (ec);
+ else {
+ ne.Emit (ec);
+ ig.Emit (OpCodes.Pop);
+ }
}
+
+ return false;
+ }
+
+ public override string ToString ()
+ {
+ return "StatementExpression (" + Expr + ")";
}
}
+ /// <summary>
+ /// Implements the return statement
+ /// </summary>
public class Return : Statement {
- Expression expr;
+ public Expression Expr;
- public Return (Expression expr)
+ public Return (Expression expr, Location l)
{
- this.expr = expr;
+ Expr = expr;
+ loc = l;
}
- public Expression Expr {
- get {
- return expr;
+ public override bool Emit (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 false;
+ }
+ } else {
+ if (Expr == null){
+ Report.Error (126, loc, "An object of type `" +
+ TypeManager.CSharpName (ec.ReturnType) + "' is " +
+ "expected for the return statement");
+ return false;
+ }
+
+ Expr = Expr.Resolve (ec);
+ if (Expr == null)
+ return false;
+
+ if (Expr.Type != ec.ReturnType)
+ Expr = Expression.ConvertImplicitRequired (
+ ec, Expr, ec.ReturnType, loc);
+
+ if (Expr == null)
+ return false;
+
+ Expr.Emit (ec);
+
+ if (ec.InTry || ec.InCatch)
+ ec.ig.Emit (OpCodes.Stloc, ec.TemporaryReturn ());
}
+
+ if (ec.InTry || ec.InCatch)
+ ec.ig.Emit (OpCodes.Leave, ec.ReturnLabel);
+ else
+ ec.ig.Emit (OpCodes.Ret);
+
+ return true;
}
}
public class Goto : Statement {
string target;
+ Block block;
- public Goto (string label)
+ public Goto (Block parent_block, string label, Location l)
{
+ block = parent_block;
+ loc = l;
target = label;
}
@@ -190,110 +418,408 @@ namespace CIR {
return target;
}
}
+
+ public override bool Emit (EmitContext ec)
+ {
+ LabeledStatement label = block.LookupLabel (target);
+
+ if (label == null){
+ //
+ // Maybe we should catch this before?
+ //
+ Report.Error (
+ 159, loc,
+ "No such label `" + target + "' in this scope");
+ return false;
+ }
+ Label l = label.LabelTarget (ec);
+ ec.ig.Emit (OpCodes.Br, l);
+
+ return false;
+ }
}
- public class Throw : Statement {
+ public class LabeledStatement : Statement {
+ string label_name;
+ bool defined;
+ Label label;
+
+ public LabeledStatement (string label_name)
+ {
+ this.label_name = label_name;
+ }
+
+ public Label LabelTarget (EmitContext ec)
+ {
+ if (defined)
+ return label;
+ label = ec.ig.DefineLabel ();
+ defined = true;
+
+ return label;
+ }
+
+ public override bool Emit (EmitContext ec)
+ {
+ LabelTarget (ec);
+ ec.ig.MarkLabel (label);
+
+ return false;
+ }
+ }
+
+
+ /// <summary>
+ /// `goto default' statement
+ /// </summary>
+ public class GotoDefault : Statement {
+
+ public GotoDefault (Location l)
+ {
+ loc = l;
+ }
+
+ public override bool Emit (EmitContext ec)
+ {
+ if (ec.Switch == null){
+ Report.Error (153, loc, "goto default is only valid in a switch statement");
+ return false;
+ }
+
+ if (!ec.Switch.GotDefault){
+ Report.Error (159, loc, "No default target on switch statement");
+ return false;
+ }
+ ec.ig.Emit (OpCodes.Br, ec.Switch.DefaultTarget);
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// `goto case' statement
+ /// </summary>
+ public class GotoCase : Statement {
Expression expr;
- public Throw (Expression expr)
+ public GotoCase (Expression e, Location l)
{
- this.expr = expr;
+ expr = e;
+ loc = l;
+ }
+
+ public override bool Emit (EmitContext ec)
+ {
+ if (ec.Switch == null){
+ Report.Error (153, loc, "goto case is only valid in a switch statement");
+ return false;
+ }
+
+ expr = expr.Resolve (ec);
+ if (expr == null)
+ return false;
+
+ if (!(expr is Constant)){
+ Report.Error (159, loc, "Target expression for goto case is not constant");
+ return false;
+ }
+
+ object val = Expression.ConvertIntLiteral (
+ (Constant) expr, ec.Switch.SwitchType, loc);
+
+ if (val == null)
+ return false;
+
+ SwitchLabel sl = (SwitchLabel) ec.Switch.Elements [val];
+
+ if (sl == null){
+ Report.Error (
+ 159, loc,
+ "No such label 'case " + val + "': for the goto case");
+ }
+
+ ec.ig.Emit (OpCodes.Br, sl.ILLabelCode);
+ return false;
+ }
+ }
+
+ public class Throw : Statement {
+ public readonly Expression Expr;
+
+ public Throw (Expression expr, Location l)
+ {
+ Expr = expr;
+ loc = l;
+ }
+
+ public override bool Emit (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 false;
+ }
+
+ Expression e = Expr.Resolve (ec);
+
+ if (e == null)
+ return false;
+
+ e.Emit (ec);
+
+ ec.ig.Emit (OpCodes.Throw);
+
+ return true;
}
}
public class Break : Statement {
- public Break ()
+
+ public Break (Location l)
+ {
+ loc = l;
+ }
+
+ public override bool Emit (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;
+ }
+
+ ig.Emit (OpCodes.Br, ec.LoopEnd);
+ return false;
}
}
public class Continue : Statement {
- public Continue ()
+
+ public Continue (Location l)
{
+ loc = l;
+ }
+
+ public override bool Emit (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; }}
+ //
+ ec.ig.Emit (OpCodes.Br, begin);
+ return false;
}
}
- // <summary>
- // Used for Label management
- // </summary>
- //
+ public class VariableInfo {
+ public readonly string Type;
+ public LocalBuilder LocalBuilder;
+ public Type VariableType;
+ public readonly Location Location;
+
+ public bool Used;
+ public bool Assigned;
+ public bool ReadOnly;
+
+ public VariableInfo (string type, Location l)
+ {
+ Type = type;
+ LocalBuilder = null;
+ Location = l;
+ }
+
+ public void MakePinned ()
+ {
+ TypeManager.MakePinned (LocalBuilder);
+ }
+ }
+
+ /// <summary>
+ /// Block represents a C# block.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// This class is used in a number of places: either to represent
+ /// explicit blocks that the programmer places or implicit blocks.
+ ///
+ /// Implicit blocks are used as labels or to introduce variable
+ /// declarations.
+ /// </remarks>
public class Block : Statement {
- Block parent;
- StatementCollection statements;
+ public readonly Block Parent;
+ public readonly bool Implicit;
+ public readonly Location StartLocation;
+ public Location EndLocation;
+
+ //
+ // The statements in this block
+ //
+ ArrayList statements;
+
+ //
+ // An array of Blocks. We keep track of children just
+ // to generate the local variable declarations.
+ //
+ // Statements and child statements are handled through the
+ // statements.
+ //
+ ArrayList children;
+
+ //
+ // Labels. (label, block) pairs.
+ //
Hashtable labels;
- Hashtable labels_referenced;
- bool implicit_block;
+
+ //
+ // Keeps track of (name, type) pairs
+ //
Hashtable variables;
- string label;
- int internal_id_serial;
+
+ //
+ // Keeps track of constants
+ Hashtable constants;
+
+ //
+ // Maps variable names to ILGenerator.LocalBuilders
+ //
+ Hashtable local_builders;
+
bool used = false;
+
+ static int id;
+
+ int this_id;
public Block (Block parent)
- {
- this.parent = parent;
- this.implicit_block = false;
- }
+ : this (parent, false, Location.Null, Location.Null)
+ { }
public Block (Block parent, bool implicit_block)
- {
- this.parent = parent;
- this.implicit_block = true;
- }
+ : this (parent, implicit_block, Location.Null, Location.Null)
+ { }
- public Block (Block parent, string labeled)
- {
- this.parent = parent;
- this.implicit_block = true;
- label = labeled;
- }
-
- public Block Parent {
- get {
- return parent;
- }
- }
+ public Block (Block parent, Location start, Location end)
+ : this (parent, false, start, end)
+ { }
- public bool Implicit {
- get {
- return implicit_block;
- }
+ public Block (Block parent, bool implicit_block, Location start, Location end)
+ {
+ if (parent != null)
+ parent.AddChild (this);
+
+ this.Parent = parent;
+ this.Implicit = implicit_block;
+ this.StartLocation = start;
+ this.EndLocation = end;
+ this.loc = start;
+ this_id = id++;
+ statements = new ArrayList ();
}
- public string Label {
+ public int ID {
get {
- return label;
+ return this_id;
}
}
- // <summary>
- // Adds a label to the current block.
- // </summary>
- //
- // <returns>
- // false if the name already exists in this block. true
- // otherwise.
- // </returns>
- //
- public bool AddLabel (string name, Block block)
+ void AddChild (Block b)
+ {
+ if (children == null)
+ children = new ArrayList ();
+
+ children.Add (b);
+ }
+
+ public void SetEndLocation (Location loc)
+ {
+ EndLocation = loc;
+ }
+
+ /// <summary>
+ /// Adds a label to the current block.
+ /// </summary>
+ ///
+ /// <returns>
+ /// false if the name already exists in this block. true
+ /// otherwise.
+ /// </returns>
+ ///
+ public bool AddLabel (string name, LabeledStatement target)
{
if (labels == null)
labels = new Hashtable ();
if (labels.Contains (name))
return false;
- labels.Add (name, block);
+ labels.Add (name, target);
return true;
}
- public bool AddVariable (TypeRef typeref, string name)
+ public LabeledStatement LookupLabel (string name)
+ {
+ if (labels != null){
+ if (labels.Contains (name))
+ return ((LabeledStatement) labels [name]);
+ }
+
+ if (Parent != null)
+ return Parent.LookupLabel (name);
+
+ return null;
+ }
+
+ public VariableInfo AddVariable (string type, string name, Parameters pars, Location l)
{
if (variables == null)
variables = new Hashtable ();
- if (GetVariableTypeRef (name) != null)
+ if (GetVariableType (name) != null)
+ return null;
+
+ if (pars != null) {
+ int idx = 0;
+ Parameter p = pars.GetParameterByName (name, out idx);
+ if (p != null)
+ return null;
+ }
+
+ VariableInfo vi = new VariableInfo (type, l);
+
+ variables.Add (name, vi);
+
+ // Console.WriteLine ("Adding {0} to {1}", name, ID);
+ return vi;
+ }
+
+ public bool AddConstant (string type, string name, Expression value, Parameters pars, Location l)
+ {
+ if (AddVariable (type, name, pars, l) == null)
return false;
- variables.Add (name, typeref);
+ if (constants == null)
+ constants = new Hashtable ();
+
+ constants.Add (name, value);
return true;
}
@@ -303,78 +829,99 @@ namespace CIR {
}
}
- public TypeRef GetVariableTypeRef (string name)
+ public VariableInfo GetVariableInfo (string name)
{
- TypeRef tr = null;
+ if (variables != null) {
+ object temp;
+ temp = variables [name];
+
+ if (temp != null){
+ return (VariableInfo) temp;
+ }
+ }
+
+ if (Parent != null)
+ return Parent.GetVariableInfo (name);
- if (variables != null)
- tr = (TypeRef) variables [name];
- if (tr != null)
- return tr;
- else if (parent != null)
- return parent.GetVariableTypeRef (name);
return null;
}
-
- // <summary>
- // True if the variable named @name has been defined
- // in this block
- // </summary>
- public bool IsVariableDefined (string name)
+
+ public string GetVariableType (string name)
{
- return GetVariableTypeRef (name) != null;
- }
+ VariableInfo vi = GetVariableInfo (name);
- // <summary>
- // Use to fetch the statement associated with this label
- // </summary>
- public Statement this [string name] {
- get {
- return (Statement) labels [name];
- }
- }
+ if (vi != null)
+ return vi.Type;
- // <summary>
- // Call this to label the label as used in a block
- // </summary>
- public void Reference (string name)
- {
- if (labels_referenced == null)
- labels_referenced = new Hashtable ();
- labels_referenced.Add (name, null);
+ return null;
}
- // <returns>
- // A list of labels that were not used within this block
- // </returns>
- public string [] GetUnreferenced ()
+ public Expression GetConstantExpression (string name)
{
- ArrayList unrefs = new ArrayList ();
+ if (constants != null) {
+ object temp;
+ temp = constants [name];
+
+ if (temp != null)
+ return (Expression) temp;
+ }
+
+ if (Parent != null)
+ return Parent.GetConstantExpression (name);
- foreach (string s in (string []) labels.Keys) {
- if (labels_referenced [s] == null)
- unrefs.Add (s);
+ return null;
+ }
+
+ /// <summary>
+ /// True if the variable named @name has been defined
+ /// in this block
+ /// </summary>
+ public bool IsVariableDefined (string name)
+ {
+ // Console.WriteLine ("Looking up {0} in {1}", name, ID);
+ if (variables != null) {
+ if (variables.Contains (name))
+ return true;
}
+
+ if (Parent != null)
+ return Parent.IsVariableDefined (name);
- string [] result = new string [unrefs.Count];
- unrefs.CopyTo (result);
- return result;
+ return false;
}
- public StatementCollection Statements {
+ /// <summary>
+ /// True if the variable named @name is a constant
+ /// </summary>
+ public bool IsConstant (string name)
+ {
+ Expression e = null;
+
+ e = GetConstantExpression (name);
+
+ return e != null;
+ }
+
+ /// <summary>
+ /// Use to fetch the statement associated with this label
+ /// </summary>
+ public Statement this [string name] {
get {
- if (statements == null)
- statements = new StatementCollection ();
-
- return statements;
+ return (Statement) labels [name];
}
}
- public void AddStatement (Statement s)
+ /// <returns>
+ /// A list of labels that were not used within this block
+ /// </returns>
+ public string [] GetUnreferenced ()
{
- if (statements == null)
- statements = new StatementCollection ();
+ // FIXME: Implement me
+ return null;
+ }
+ public void AddStatement (Statement s)
+ {
statements.Add (s);
used = true;
}
@@ -384,143 +931,1217 @@ namespace CIR {
return used;
}
}
+
+ public void Use ()
+ {
+ used = true;
+ }
- // <summary>
- // Creates a compiler-internal identifier, this is
- // used to create temporary variables that should not
- // be seen by the application
- // </summary
- public string MakeInternalID () {
- string ret = internal_id_serial.ToString ();
+ /// <summary>
+ /// Emits the variable declarations and labels.
+ /// </summary>
+ /// <remarks>
+ /// tc: is our typecontainer (to resolve type references)
+ /// ig: is the code generator:
+ /// toplevel: the toplevel block. This is used for checking
+ /// that no two labels with the same name are used.
+ /// </remarks>
+ public void EmitMeta (EmitContext ec, Block toplevel)
+ {
+ DeclSpace ds = ec.DeclSpace;
+ ILGenerator ig = ec.ig;
+
+ //
+ // Process this block variables
+ //
+ if (variables != null){
+ local_builders = new Hashtable ();
+
+ foreach (DictionaryEntry de in variables){
+ string name = (string) de.Key;
+ VariableInfo vi = (VariableInfo) de.Value;
+ Type t;
+
+ t = RootContext.LookupType (ds, vi.Type, false, vi.Location);
+ if (t == null)
+ continue;
+
+ vi.VariableType = t;
+ vi.LocalBuilder = ig.DeclareLocal (t);
+
+ if (CodeGen.SymbolWriter != null)
+ vi.LocalBuilder.SetLocalSymInfo (name);
+
+ if (constants == null)
+ continue;
+
+ Expression cv = (Expression) constants [name];
+ if (cv == null)
+ continue;
+
+ Expression e = cv.Resolve (ec);
+ if (e == null)
+ continue;
+
+ if (!(e is Constant)){
+ Report.Error (133, vi.Location,
+ "The expression being assigned to `" +
+ name + "' must be constant (" + e + ")");
+ continue;
+ }
+
+ constants.Remove (name);
+ constants.Add (name, e);
+ }
+ }
+
+ //
+ // Now, handle the children
+ //
+ if (children != null){
+ foreach (Block b in children)
+ b.EmitMeta (ec, toplevel);
+ }
+ }
+
+ public void UsageWarning ()
+ {
+ string name;
+
+ if (variables != null){
+ foreach (DictionaryEntry de in variables){
+ VariableInfo vi = (VariableInfo) de.Value;
+
+ if (vi.Used)
+ continue;
+
+ name = (string) de.Key;
+
+ if (vi.Assigned){
+ Report.Warning (
+ 219, vi.Location, "The variable `" + name +
+ "' is assigned but its value is never used");
+ } else {
+ Report.Warning (
+ 168, vi.Location, "The variable `" +
+ name +
+ "' is declared but never used");
+ }
+ }
+ }
- internal_id_serial++;
- return "0_" + ret;
+ if (children != null)
+ foreach (Block b in children)
+ b.UsageWarning ();
+ }
+
+ public override bool Emit (EmitContext ec)
+ {
+ bool is_ret = false;
+ Block prev_block = ec.CurrentBlock;
+
+ ec.CurrentBlock = this;
+
+ if (CodeGen.SymbolWriter != null) {
+ ec.Mark (StartLocation);
+
+ foreach (Statement s in statements) {
+ ec.Mark (s.loc);
+
+ is_ret = s.Emit (ec);
+ }
+
+ ec.Mark (EndLocation);
+ } else {
+ foreach (Statement s in statements)
+ is_ret = s.Emit (ec);
+ }
+
+ ec.CurrentBlock = prev_block;
+ return is_ret;
}
}
public class SwitchLabel {
Expression label;
-
+ object converted;
+ public Location loc;
+ public Label ILLabel;
+ public Label ILLabelCode;
+
//
// if expr == null, then it is the default case.
//
- public SwitchLabel (Expression expr)
+ public SwitchLabel (Expression expr, Location l)
{
label = expr;
+ loc = l;
}
-
+
public Expression Label {
get {
return label;
}
}
+
+ public object Converted {
+ get {
+ return converted;
+ }
+ }
+
+ //
+ // Resolves the expression, reduces it to a literal if possible
+ // and then converts it to the requested type.
+ //
+ public bool ResolveAndReduce (EmitContext ec, Type required_type)
+ {
+ ILLabel = ec.ig.DefineLabel ();
+ ILLabelCode = ec.ig.DefineLabel ();
+
+ if (label == null)
+ return true;
+
+ Expression e = label.Resolve (ec);
+
+ if (e == null)
+ return false;
+
+ if (!(e is Constant)){
+ Console.WriteLine ("Value is: " + label);
+ Report.Error (150, loc, "A constant value is expected");
+ return false;
+ }
+
+ if (e is StringConstant || e is NullLiteral){
+ if (required_type == TypeManager.string_type){
+ converted = label;
+ ILLabel = ec.ig.DefineLabel ();
+ return true;
+ }
+ }
+
+ converted = Expression.ConvertIntLiteral ((Constant) e, required_type, loc);
+ if (converted == null)
+ return false;
+
+ return true;
+ }
}
public class SwitchSection {
// An array of SwitchLabels.
- ArrayList labels;
- Block block;
+ public readonly ArrayList Labels;
+ public readonly Block Block;
public SwitchSection (ArrayList labels, Block block)
{
- this.labels = labels;
- this.block = block;
+ Labels = labels;
+ Block = block;
}
+ }
+
+ public class Switch : Statement {
+ public readonly ArrayList Sections;
+ public Expression Expr;
+
+ /// <summary>
+ /// Maps constants whose type type SwitchType to their SwitchLabels.
+ /// </summary>
+ public Hashtable Elements;
+
+ /// <summary>
+ /// The governing switch type
+ /// </summary>
+ public Type SwitchType;
- public Block Block {
+ //
+ // Computed
+ //
+ bool got_default;
+ Label default_target;
+
+ //
+ // The types allowed to be implicitly cast from
+ // on the governing type
+ //
+ static Type [] allowed_types;
+
+ public Switch (Expression e, ArrayList sects, Location l)
+ {
+ Expr = e;
+ Sections = sects;
+ loc = l;
+ }
+
+ public bool GotDefault {
get {
- return block;
+ return got_default;
}
}
- public ArrayList Labels {
+ public Label DefaultTarget {
get {
- return labels;
+ return default_target;
}
}
- }
-
- public class Switch : Statement {
- ArrayList sections;
- Expression expr;
-
- public Switch (Expression expr, ArrayList sections)
+
+ //
+ // Determines the governing type for a switch. The returned
+ // expression might be the expression from the switch, or an
+ // expression that includes any potential conversions to the
+ // integral types or to string.
+ //
+ Expression SwitchGoverningType (EmitContext ec, Type t)
{
- this.expr = expr;
- this.sections = sections;
- }
+ if (t == TypeManager.int32_type ||
+ t == TypeManager.uint32_type ||
+ t == TypeManager.char_type ||
+ t == TypeManager.byte_type ||
+ t == TypeManager.sbyte_type ||
+ t == TypeManager.ushort_type ||
+ t == TypeManager.short_type ||
+ t == TypeManager.uint64_type ||
+ t == TypeManager.int64_type ||
+ t == TypeManager.string_type ||
+ t == TypeManager.bool_type ||
+ t.IsSubclassOf (TypeManager.enum_type))
+ return Expr;
+
+ if (allowed_types == null){
+ allowed_types = new Type [] {
+ TypeManager.sbyte_type,
+ TypeManager.byte_type,
+ TypeManager.short_type,
+ TypeManager.ushort_type,
+ TypeManager.int32_type,
+ TypeManager.uint32_type,
+ TypeManager.int64_type,
+ TypeManager.uint64_type,
+ TypeManager.char_type,
+ TypeManager.bool_type,
+ TypeManager.string_type
+ };
+ }
- public Expression Expr {
- get {
- return expr;
+ //
+ // Try to find a *user* defined implicit conversion.
+ //
+ // If there is no implicit conversion, or if there are multiple
+ // conversions, we have to report an error
+ //
+ Expression converted = null;
+ foreach (Type tt in allowed_types){
+ Expression e;
+
+ e = Expression.ImplicitUserConversion (ec, Expr, tt, loc);
+ if (e == null)
+ continue;
+
+ if (converted != null){
+ Report.Error (-12, loc, "More than one conversion to an integral " +
+ " type exists for type `" +
+ TypeManager.CSharpName (Expr.Type)+"'");
+ return null;
+ } else
+ converted = e;
}
+ return converted;
}
- public ArrayList Sections {
- get {
- return sections;
+ void error152 (string n)
+ {
+ Report.Error (
+ 152, "The label `" + n + ":' " +
+ "is already present on this switch statement");
+ }
+
+ //
+ // Performs the basic sanity checks on the switch statement
+ // (looks for duplicate keys and non-constant expressions).
+ //
+ // It also returns a hashtable with the keys that we will later
+ // use to compute the switch tables
+ //
+ bool CheckSwitch (EmitContext ec)
+ {
+ Type compare_type;
+ bool error = false;
+ Elements = new Hashtable ();
+
+ got_default = false;
+
+ if (TypeManager.IsEnumType (SwitchType)){
+ compare_type = TypeManager.EnumToUnderlying (SwitchType);
+ } else
+ compare_type = SwitchType;
+
+ foreach (SwitchSection ss in Sections){
+ foreach (SwitchLabel sl in ss.Labels){
+ if (!sl.ResolveAndReduce (ec, SwitchType)){
+ error = true;
+ continue;
+ }
+
+ if (sl.Label == null){
+ if (got_default){
+ error152 ("default");
+ error = true;
+ }
+ got_default = true;
+ continue;
+ }
+
+ object key = sl.Converted;
+
+ if (key is Constant)
+ key = ((Constant) key).GetValue ();
+
+ if (key == null)
+ key = NullLiteral.Null;
+
+ string lname = null;
+ if (compare_type == TypeManager.uint64_type){
+ ulong v = (ulong) key;
+
+ if (Elements.Contains (v))
+ lname = v.ToString ();
+ else
+ Elements.Add (v, sl);
+ } else if (compare_type == TypeManager.int64_type){
+ long v = (long) key;
+
+ if (Elements.Contains (v))
+ lname = v.ToString ();
+ else
+ Elements.Add (v, sl);
+ } else if (compare_type == TypeManager.uint32_type){
+ uint v = (uint) key;
+
+ if (Elements.Contains (v))
+ lname = v.ToString ();
+ else
+ Elements.Add (v, sl);
+ } else if (compare_type == TypeManager.char_type){
+ char v = (char) key;
+
+ if (Elements.Contains (v))
+ lname = v.ToString ();
+ else
+ Elements.Add (v, sl);
+ } else if (compare_type == TypeManager.byte_type){
+ byte v = (byte) key;
+
+ if (Elements.Contains (v))
+ lname = v.ToString ();
+ else
+ Elements.Add (v, sl);
+ } else if (compare_type == TypeManager.sbyte_type){
+ sbyte v = (sbyte) key;
+
+ if (Elements.Contains (v))
+ lname = v.ToString ();
+ else
+ Elements.Add (v, sl);
+ } else if (compare_type == TypeManager.short_type){
+ short v = (short) key;
+
+ if (Elements.Contains (v))
+ lname = v.ToString ();
+ else
+ Elements.Add (v, sl);
+ } else if (compare_type == TypeManager.ushort_type){
+ ushort v = (ushort) key;
+
+ if (Elements.Contains (v))
+ lname = v.ToString ();
+ else
+ Elements.Add (v, sl);
+ } else if (compare_type == TypeManager.string_type){
+ if (key is NullLiteral){
+ if (Elements.Contains (NullLiteral.Null))
+ lname = "null";
+ else
+ Elements.Add (NullLiteral.Null, null);
+ } else {
+ string s = (string) key;
+
+ if (Elements.Contains (s))
+ lname = s;
+ else
+ Elements.Add (s, sl);
+ }
+ } else if (compare_type == TypeManager.int32_type) {
+ int v = (int) key;
+
+ if (Elements.Contains (v))
+ lname = v.ToString ();
+ else
+ Elements.Add (v, sl);
+ } else if (compare_type == TypeManager.bool_type) {
+ bool v = (bool) key;
+
+ if (Elements.Contains (v))
+ lname = v.ToString ();
+ else
+ Elements.Add (v, sl);
+ }
+ else
+ {
+ throw new Exception ("Unknown switch type!" +
+ SwitchType + " " + compare_type);
+ }
+
+ if (lname != null){
+ error152 ("case + " + lname);
+ error = true;
+ }
+ }
}
+ if (error)
+ return false;
+
+ return true;
}
- }
- public class Lock : Statement {
- Expression expr;
- Statement stmt;
+ void EmitObjectInteger (ILGenerator ig, object k)
+ {
+ if (k is int)
+ IntConstant.EmitInt (ig, (int) k);
+ else if (k is Constant) {
+ EmitObjectInteger (ig, ((Constant) k).GetValue ());
+ }
+ else if (k is uint)
+ IntConstant.EmitInt (ig, unchecked ((int) (uint) k));
+ else if (k is long)
+ {
+ if ((long) k >= int.MinValue && (long) k <= int.MaxValue)
+ {
+ IntConstant.EmitInt (ig, (int) (long) k);
+ ig.Emit (OpCodes.Conv_I8);
+ }
+ else
+ LongConstant.EmitLong (ig, (long) k);
+ }
+ else if (k is ulong)
+ {
+ if ((ulong) k < (1L<<32))
+ {
+ IntConstant.EmitInt (ig, (int) (long) k);
+ ig.Emit (OpCodes.Conv_U8);
+ }
+ else
+ {
+ LongConstant.EmitLong (ig, unchecked ((long) (ulong) k));
+ }
+ }
+ else if (k is char)
+ IntConstant.EmitInt (ig, (int) ((char) k));
+ else if (k is sbyte)
+ IntConstant.EmitInt (ig, (int) ((sbyte) k));
+ else if (k is byte)
+ IntConstant.EmitInt (ig, (int) ((byte) k));
+ else if (k is short)
+ IntConstant.EmitInt (ig, (int) ((short) k));
+ else if (k is ushort)
+ IntConstant.EmitInt (ig, (int) ((ushort) k));
+ else if (k is bool)
+ IntConstant.EmitInt (ig, ((bool) k) ? 1 : 0);
+ else
+ throw new Exception ("Unhandled case");
+ }
- public Lock (Expression expr, Statement stmt)
+ // structure used to hold blocks of keys while calculating table switch
+ class KeyBlock : IComparable
{
- this.expr = expr;
- this.stmt = stmt;
+ public KeyBlock (long _nFirst)
+ {
+ nFirst = nLast = _nFirst;
+ }
+ public long nFirst;
+ public long nLast;
+ public ArrayList rgKeys = null;
+ public int Length
+ {
+ get { return (int) (nLast - nFirst + 1); }
+ }
+ public static long TotalLength (KeyBlock kbFirst, KeyBlock kbLast)
+ {
+ return kbLast.nLast - kbFirst.nFirst + 1;
+ }
+ public int CompareTo (object obj)
+ {
+ KeyBlock kb = (KeyBlock) obj;
+ int nLength = Length;
+ int nLengthOther = kb.Length;
+ if (nLengthOther == nLength)
+ return (int) (kb.nFirst - nFirst);
+ return nLength - nLengthOther;
+ }
}
- public Statement Statement {
- get {
- return stmt;
+ /// <summary>
+ /// This method emits code for a lookup-based switch statement (non-string)
+ /// Basically it groups the cases into blocks that are at least half full,
+ /// and then spits out individual lookup opcodes for each block.
+ /// It emits the longest blocks first, and short blocks are just
+ /// handled with direct compares.
+ /// </summary>
+ /// <param name="ec"></param>
+ /// <param name="val"></param>
+ /// <returns></returns>
+ bool TableSwitchEmit (EmitContext ec, LocalBuilder val)
+ {
+ int cElements = Elements.Count;
+ object [] rgKeys = new object [cElements];
+ Elements.Keys.CopyTo (rgKeys, 0);
+ Array.Sort (rgKeys);
+
+ // initialize the block list with one element per key
+ ArrayList rgKeyBlocks = new ArrayList ();
+ foreach (object key in rgKeys)
+ rgKeyBlocks.Add (new KeyBlock (Convert.ToInt64 (key)));
+
+ KeyBlock kbCurr;
+ // iteratively merge the blocks while they are at least half full
+ // there's probably a really cool way to do this with a tree...
+ while (rgKeyBlocks.Count > 1)
+ {
+ ArrayList rgKeyBlocksNew = new ArrayList ();
+ kbCurr = (KeyBlock) rgKeyBlocks [0];
+ for (int ikb = 1; ikb < rgKeyBlocks.Count; ikb++)
+ {
+ KeyBlock kb = (KeyBlock) rgKeyBlocks [ikb];
+ if ((kbCurr.Length + kb.Length) * 2 >= KeyBlock.TotalLength (kbCurr, kb))
+ {
+ // merge blocks
+ kbCurr.nLast = kb.nLast;
+ }
+ else
+ {
+ // start a new block
+ rgKeyBlocksNew.Add (kbCurr);
+ kbCurr = kb;
+ }
+ }
+ rgKeyBlocksNew.Add (kbCurr);
+ if (rgKeyBlocks.Count == rgKeyBlocksNew.Count)
+ break;
+ rgKeyBlocks = rgKeyBlocksNew;
}
+
+ // initialize the key lists
+ foreach (KeyBlock kb in rgKeyBlocks)
+ kb.rgKeys = new ArrayList ();
+
+ // fill the key lists
+ int iBlockCurr = 0;
+ kbCurr = (KeyBlock) rgKeyBlocks [0];
+ foreach (object key in rgKeys)
+ {
+ bool fNextBlock = (key is UInt64) ? (ulong) key > (ulong) kbCurr.nLast : Convert.ToInt64 (key) > kbCurr.nLast;
+ if (fNextBlock)
+ kbCurr = (KeyBlock) rgKeyBlocks [++iBlockCurr];
+ kbCurr.rgKeys.Add (key);
+ }
+
+ // sort the blocks so we can tackle the largest ones first
+ rgKeyBlocks.Sort ();
+
+ // okay now we can start...
+ ILGenerator ig = ec.ig;
+ Label lblEnd = ig.DefineLabel (); // at the end ;-)
+ Label lblDefault = new Label ();
+ Type typeKeys = rgKeys [0].GetType (); // used for conversions
+
+ for (int iBlock = rgKeyBlocks.Count - 1; iBlock >= 0; --iBlock)
+ {
+ KeyBlock kb = ((KeyBlock) rgKeyBlocks [iBlock]);
+ lblDefault = (iBlock == 0) ? DefaultTarget : ig.DefineLabel ();
+ if (kb.Length <= 2)
+ {
+ foreach (object key in kb.rgKeys)
+ {
+ ig.Emit (OpCodes.Ldloc, val);
+ EmitObjectInteger (ig, key);
+ SwitchLabel sl = (SwitchLabel) Elements [key];
+ ig.Emit (OpCodes.Beq, sl.ILLabel);
+ }
+ }
+ else
+ {
+ // TODO: if all the keys in the block are the same and there are
+ // no gaps/defaults then just use a range-check.
+ if (SwitchType == TypeManager.int64_type ||
+ SwitchType == TypeManager.uint64_type)
+ {
+ // TODO: optimize constant/I4 cases
+
+ // check block range (could be > 2^31)
+ ig.Emit (OpCodes.Ldloc, val);
+ EmitObjectInteger (ig, Convert.ChangeType (kb.nFirst, typeKeys));
+ ig.Emit (OpCodes.Blt, lblDefault);
+ ig.Emit (OpCodes.Ldloc, val);
+ EmitObjectInteger (ig, Convert.ChangeType (kb.nFirst, typeKeys));
+ ig.Emit (OpCodes.Bgt, lblDefault);
+
+ // normalize range
+ ig.Emit (OpCodes.Ldloc, val);
+ if (kb.nFirst != 0)
+ {
+ EmitObjectInteger (ig, Convert.ChangeType (kb.nFirst, typeKeys));
+ ig.Emit (OpCodes.Sub);
+ }
+ ig.Emit (OpCodes.Conv_I4); // assumes < 2^31 labels!
+ }
+ else
+ {
+ // normalize range
+ ig.Emit (OpCodes.Ldloc, val);
+ int nFirst = (int) kb.nFirst;
+ if (nFirst > 0)
+ {
+ IntConstant.EmitInt (ig, nFirst);
+ ig.Emit (OpCodes.Sub);
+ }
+ else if (nFirst < 0)
+ {
+ IntConstant.EmitInt (ig, -nFirst);
+ ig.Emit (OpCodes.Add);
+ }
+ }
+
+ // first, build the list of labels for the switch
+ int iKey = 0;
+ int cJumps = kb.Length;
+ Label [] rgLabels = new Label [cJumps];
+ for (int iJump = 0; iJump < cJumps; iJump++)
+ {
+ object key = kb.rgKeys [iKey];
+ if (Convert.ToInt64 (key) == kb.nFirst + iJump)
+ {
+ SwitchLabel sl = (SwitchLabel) Elements [key];
+ rgLabels [iJump] = sl.ILLabel;
+ iKey++;
+ }
+ else
+ rgLabels [iJump] = lblDefault;
+ }
+ // emit the switch opcode
+ ig.Emit (OpCodes.Switch, rgLabels);
+ }
+
+ // mark the default for this block
+ if (iBlock != 0)
+ ig.MarkLabel (lblDefault);
+ }
+
+ // TODO: find the default case and emit it here,
+ // to prevent having to do the following jump.
+ // make sure to mark other labels in the default section
+
+ // the last default just goes to the end
+ ig.Emit (OpCodes.Br, lblDefault);
+
+ // now emit the code for the sections
+ bool fFoundDefault = false;
+ bool fAllReturn = true;
+ foreach (SwitchSection ss in Sections)
+ {
+ foreach (SwitchLabel sl in ss.Labels)
+ {
+ ig.MarkLabel (sl.ILLabel);
+ ig.MarkLabel (sl.ILLabelCode);
+ if (sl.Label == null)
+ {
+ ig.MarkLabel (lblDefault);
+ fFoundDefault = true;
+ }
+ }
+ fAllReturn &= ss.Block.Emit (ec);
+ //ig.Emit (OpCodes.Br, lblEnd);
+ }
+
+ if (!fFoundDefault)
+ ig.MarkLabel (lblDefault);
+ ig.MarkLabel (lblEnd);
+
+ return fAllReturn;
}
+ //
+ // This simple emit switch works, but does not take advantage of the
+ // `switch' opcode.
+ // TODO: remove non-string logic from here
+ // TODO: binary search strings?
+ //
+ bool SimpleSwitchEmit (EmitContext ec, LocalBuilder val)
+ {
+ ILGenerator ig = ec.ig;
+ Label end_of_switch = ig.DefineLabel ();
+ Label next_test = ig.DefineLabel ();
+ Label null_target = ig.DefineLabel ();
+ bool default_found = false;
+ bool first_test = true;
+ bool pending_goto_end = false;
+ bool all_return = true;
+ bool is_string = false;
+ bool null_found;
+
+ //
+ // Special processing for strings: we cant compare
+ // against null.
+ //
+ if (SwitchType == TypeManager.string_type){
+ ig.Emit (OpCodes.Ldloc, val);
+ is_string = true;
+
+ if (Elements.Contains (NullLiteral.Null)){
+ ig.Emit (OpCodes.Brfalse, null_target);
+ } else
+ ig.Emit (OpCodes.Brfalse, default_target);
+
+ ig.Emit (OpCodes.Ldloc, val);
+ ig.Emit (OpCodes.Call, TypeManager.string_isinterneted_string);
+ ig.Emit (OpCodes.Stloc, val);
+ }
- public Expression Expr {
- get {
- return expr;
+ SwitchSection last_section;
+ last_section = (SwitchSection) Sections [Sections.Count-1];
+
+ foreach (SwitchSection ss in Sections){
+ Label sec_begin = ig.DefineLabel ();
+
+ if (pending_goto_end)
+ ig.Emit (OpCodes.Br, end_of_switch);
+
+ int label_count = ss.Labels.Count;
+ null_found = false;
+ foreach (SwitchLabel sl in ss.Labels){
+ ig.MarkLabel (sl.ILLabel);
+
+ if (!first_test){
+ ig.MarkLabel (next_test);
+ next_test = ig.DefineLabel ();
+ }
+ //
+ // If we are the default target
+ //
+ if (sl.Label == null){
+ ig.MarkLabel (default_target);
+ default_found = true;
+ } else {
+ object lit = sl.Converted;
+
+ if (lit is NullLiteral){
+ null_found = true;
+ if (label_count == 1)
+ ig.Emit (OpCodes.Br, next_test);
+ continue;
+
+ }
+ if (is_string){
+ StringConstant str = (StringConstant) lit;
+
+ ig.Emit (OpCodes.Ldloc, val);
+ ig.Emit (OpCodes.Ldstr, str.Value);
+ if (label_count == 1)
+ ig.Emit (OpCodes.Bne_Un, next_test);
+ else
+ ig.Emit (OpCodes.Beq, sec_begin);
+ } else {
+ ig.Emit (OpCodes.Ldloc, val);
+ EmitObjectInteger (ig, lit);
+ ig.Emit (OpCodes.Ceq);
+ if (label_count == 1)
+ ig.Emit (OpCodes.Brfalse, next_test);
+ else
+ ig.Emit (OpCodes.Brtrue, sec_begin);
+ }
+ }
+ }
+ if (label_count != 1 && ss != last_section)
+ ig.Emit (OpCodes.Br, next_test);
+
+ if (null_found)
+ ig.MarkLabel (null_target);
+ ig.MarkLabel (sec_begin);
+ foreach (SwitchLabel sl in ss.Labels)
+ ig.MarkLabel (sl.ILLabelCode);
+ if (ss.Block.Emit (ec))
+ pending_goto_end = false;
+ else {
+ all_return = false;
+ pending_goto_end = true;
+ }
+ 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 Emit (EmitContext ec)
+ {
+ Expr = Expr.Resolve (ec);
+ if (Expr == null)
+ return false;
+
+ Expression new_expr = SwitchGoverningType (ec, Expr.Type);
+ if (new_expr == null){
+ Report.Error (151, loc, "An integer type or string was expected for switch");
+ return false;
+ }
+
+ // Validate switch.
+ SwitchType = new_expr.Type;
+
+ if (!CheckSwitch (ec))
+ return false;
+
+ // Store variable for comparission purposes
+ LocalBuilder value = ec.ig.DeclareLocal (SwitchType);
+ new_expr.Emit (ec);
+ ec.ig.Emit (OpCodes.Stloc, value);
+
+ ILGenerator ig = ec.ig;
+
+ default_target = ig.DefineLabel ();
+
+ //
+ // Setup the codegen context
+ //
+ Label old_end = ec.LoopEnd;
+ Switch old_switch = ec.Switch;
+
+ ec.LoopEnd = ig.DefineLabel ();
+ ec.Switch = this;
+
+ // Emit Code.
+ bool all_return;
+ if (SwitchType == TypeManager.string_type)
+ all_return = SimpleSwitchEmit (ec, value);
+ else
+ all_return = TableSwitchEmit (ec, value);
+
+ // Restore context state.
+ ig.MarkLabel (ec.LoopEnd);
+
+ //
+ // Restore the previous context
+ //
+ ec.LoopEnd = old_end;
+ ec.Switch = old_switch;
+
+ return all_return;
+ }
+ }
+
+ public class Lock : Statement {
+ public readonly Expression Expr;
+ public readonly Statement Statement;
+
+ public Lock (Expression expr, Statement stmt, Location l)
+ {
+ Expr = expr;
+ Statement = stmt;
+ loc = l;
+ }
+
+ public override bool Emit (EmitContext ec)
+ {
+ Expression e = Expr.Resolve (ec);
+ if (e == null)
+ return false;
+
+ Type type = e.Type;
+
+ 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);
+
+ e.Emit (ec);
+ ig.Emit (OpCodes.Dup);
+ ig.Emit (OpCodes.Stloc, temp);
+ ig.Emit (OpCodes.Call, TypeManager.void_monitor_enter_object);
+
+ // try
+ Label end = 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);
+
+ // finally
+ ig.BeginFinallyBlock ();
+ ig.Emit (OpCodes.Ldloc, temp);
+ ig.Emit (OpCodes.Call, TypeManager.void_monitor_exit_object);
+ ig.EndExceptionBlock ();
+
+ return false;
+ }
}
public class Unchecked : Statement {
- Block b;
+ public readonly Block Block;
public Unchecked (Block b)
{
- this.b = b;
+ Block = b;
}
- public Block Block {
- get {
- return b;
- }
+ public override bool Emit (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);
+ ec.CheckState = previous_state;
+ ec.ConstantCheckState = previous_state_const;
+
+ return val;
}
}
public class Checked : Statement {
- Block b;
+ public readonly Block Block;
public Checked (Block b)
{
- this.b = b;
+ Block = b;
}
- public Block Block {
- get {
- return b;
+ public override bool Emit (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);
+ ec.CheckState = previous_state;
+ ec.ConstantCheckState = previous_state_const;
+
+ return val;
+ }
+ }
+
+ public class Unsafe : Statement {
+ public readonly Block Block;
+
+ public Unsafe (Block b)
+ {
+ Block = b;
+ }
+
+ public override bool Emit (EmitContext ec)
+ {
+ bool previous_state = ec.InUnsafe;
+ bool val;
+
+ ec.InUnsafe = true;
+ val = Block.Emit (ec);
+ ec.InUnsafe = previous_state;
+
+ return val;
+ }
+ }
+
+ //
+ // Fixed statement
+ //
+ public class Fixed : Statement {
+ string type;
+ ArrayList declarators;
+ Statement statement;
+
+ public Fixed (string type, ArrayList decls, Statement stmt, Location l)
+ {
+ this.type = type;
+ declarators = decls;
+ statement = stmt;
+ loc = l;
+ }
+
+ public override bool Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ Type t;
+
+ t = RootContext.LookupType (ec.DeclSpace, type, false, loc);
+ if (t == null)
+ return false;
+
+ foreach (Pair p in declarators){
+ VariableInfo vi = (VariableInfo) p.First;
+ Expression e = (Expression) p.Second;
+
+ //
+ // The rules for the possible declarators are pretty wise,
+ // but the production on the grammar is more concise.
+ //
+ // So we have to enforce these rules here.
+ //
+ // We do not resolve before doing the case 1 test,
+ // because the grammar is explicit in that the token &
+ // is present, so we need to test for this particular case.
+ //
+
+ //
+ // Case 1: & object.
+ //
+ if (e is Unary && ((Unary) e).Oper == Unary.Operator.AddressOf){
+ Expression child = ((Unary) e).Expr;
+
+ vi.MakePinned ();
+ if (child is ParameterReference || child is LocalVariableReference){
+ Report.Error (
+ 213, loc,
+ "No need to use fixed statement for parameters or " +
+ "local variable declarations (address is already " +
+ "fixed)");
+ continue;
+ }
+
+ e = e.Resolve (ec);
+ if (e == null)
+ continue;
+
+ child = ((Unary) e).Expr;
+
+ if (!TypeManager.VerifyUnManaged (child.Type, loc))
+ continue;
+
+ //
+ // Store pointer in pinned location
+ //
+ e.Emit (ec);
+ ig.Emit (OpCodes.Stloc, vi.LocalBuilder);
+
+ statement.Emit (ec);
+
+ // Clear the pinned variable.
+ ig.Emit (OpCodes.Ldc_I4_0);
+ ig.Emit (OpCodes.Conv_U);
+ ig.Emit (OpCodes.Stloc, vi.LocalBuilder);
+
+ continue;
+ }
+
+ e = e.Resolve (ec);
+ if (e == null)
+ continue;
+
+ //
+ // Case 2: Array
+ //
+ if (e.Type.IsArray){
+ Type array_type = e.Type.GetElementType ();
+
+ vi.MakePinned ();
+ //
+ // Provided that array_type is unmanaged,
+ //
+ if (!TypeManager.VerifyUnManaged (array_type, loc))
+ continue;
+
+ //
+ // and T* is implicitly convertible to the
+ // pointer type given in the fixed statement.
+ //
+ ArrayPtr array_ptr = new ArrayPtr (e);
+
+ Expression converted = Expression.ConvertImplicitRequired (
+ ec, array_ptr, vi.VariableType, loc);
+ if (converted == null)
+ continue;
+
+ //
+ // Store pointer in pinned location
+ //
+ converted.Emit (ec);
+
+ ig.Emit (OpCodes.Stloc, vi.LocalBuilder);
+
+ statement.Emit (ec);
+
+ // Clear the pinned variable.
+ ig.Emit (OpCodes.Ldc_I4_0);
+ ig.Emit (OpCodes.Conv_U);
+ ig.Emit (OpCodes.Stloc, vi.LocalBuilder);
+
+ continue;
+ }
+
+ //
+ // Case 3: string
+ //
+ if (e.Type == TypeManager.string_type){
+ LocalBuilder pinned_string = ig.DeclareLocal (TypeManager.string_type);
+ TypeManager.MakePinned (pinned_string);
+
+ e.Emit (ec);
+ ig.Emit (OpCodes.Stloc, pinned_string);
+
+ Expression sptr = new StringPtr (pinned_string);
+ Expression converted = Expression.ConvertImplicitRequired (
+ ec, sptr, vi.VariableType, loc);
+
+ if (converted == null)
+ continue;
+
+ converted.Emit (ec);
+ ig.Emit (OpCodes.Stloc, vi.LocalBuilder);
+
+ statement.Emit (ec);
+
+ // Clear the pinned variable
+ ig.Emit (OpCodes.Ldnull);
+ ig.Emit (OpCodes.Stloc, pinned_string);
+ }
}
+
+ return false;
+ }
+ }
+
+ public class Catch {
+ public readonly string Type;
+ public readonly string Name;
+ public readonly Block Block;
+ public readonly Location Location;
+
+ public Catch (string type, string name, Block block, Location l)
+ {
+ Type = type;
+ Name = name;
+ Block = block;
+ Location = l;
}
}
public class Try : Statement {
- Block fini, block;
- ArrayList specific;
- Catch general;
+ public readonly Block Fini, Block;
+ public readonly ArrayList Specific;
+ public readonly Catch General;
//
// specific, general and fini might all be null.
@@ -531,65 +2152,756 @@ namespace CIR {
Console.WriteLine ("CIR.Try: Either specific or general have to be non-null");
}
- this.block = block;
- this.specific = specific;
- this.general = general;
- this.fini = fini;
+ this.Block = block;
+ this.Specific = specific;
+ this.General = general;
+ this.Fini = fini;
}
- public Block Block {
- get {
- return block;
+ public override bool Emit (EmitContext ec)
+ {
+ ILGenerator ig = ec.ig;
+ Label end;
+ Label finish = ig.DefineLabel ();;
+ bool returns;
+
+ end = ig.BeginExceptionBlock ();
+ bool old_in_try = ec.InTry;
+ ec.InTry = true;
+ returns = 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;
+ DeclSpace ds = ec.DeclSpace;
+
+ foreach (Catch c in Specific){
+ Type catch_type = RootContext.LookupType (ds, c.Type, false, c.Location);
+ VariableInfo vi;
+
+ if (catch_type == null)
+ return false;
+
+ ig.BeginCatchBlock (catch_type);
+
+ if (c.Name != null){
+ vi = c.Block.GetVariableInfo (c.Name);
+ if (vi == null){
+ Console.WriteLine ("This should not happen! variable does not exist in this block");
+ Environment.Exit (0);
+ }
+
+ ig.Emit (OpCodes.Stloc, vi.LocalBuilder);
+ } else
+ ig.Emit (OpCodes.Pop);
+
+ if (!c.Block.Emit (ec))
+ returns = false;
+ }
+
+ if (General != null){
+ ig.BeginCatchBlock (TypeManager.object_type);
+ ig.Emit (OpCodes.Pop);
+ if (!General.Block.Emit (ec))
+ returns = false;
}
+ 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 ();
+
+ //
+ // FIXME: Is this correct?
+ // Replace with `returns' and check test-18, maybe we can
+ // perform an optimization here.
+ //
+ return returns;
}
+ }
- public ArrayList Specific {
- get {
- return specific;
+ //
+ // FIXME: We still do not support the expression variant of the using
+ // statement.
+ //
+ public class Using : Statement {
+ object expression_or_block;
+ Statement Statement;
+
+ public Using (object expression_or_block, Statement stmt, Location l)
+ {
+ this.expression_or_block = expression_or_block;
+ Statement = stmt;
+ loc = l;
+ }
+
+ //
+ // Emits the code for the case of using using a local variable declaration.
+ //
+ bool EmitLocalVariableDecls (EmitContext ec, string type_name, ArrayList var_list)
+ {
+ ILGenerator ig = ec.ig;
+ Expression [] converted_vars;
+ bool need_conv = false;
+ Type type = RootContext.LookupType (ec.DeclSpace, type_name, false, loc);
+ int i = 0;
+
+ if (type == null)
+ return false;
+
+ //
+ // The type must be an IDisposable or an implicit conversion
+ // must exist.
+ //
+ converted_vars = new Expression [var_list.Count];
+ if (!TypeManager.ImplementsInterface (type, TypeManager.idisposable_type)){
+ foreach (DictionaryEntry e in var_list){
+ Expression var = (Expression) e.Key;
+
+ var = var.Resolve (ec);
+ if (var == null)
+ return false;
+
+ converted_vars [i] = Expression.ConvertImplicit (
+ ec, var, TypeManager.idisposable_type, loc);
+
+ if (converted_vars [i] == null)
+ return false;
+ i++;
+ }
+ need_conv = true;
+ }
+
+ i = 0;
+ bool old_in_try = ec.InTry;
+ ec.InTry = true;
+ foreach (DictionaryEntry e in var_list){
+ LocalVariableReference var = (LocalVariableReference) e.Key;
+ Expression expr = (Expression) e.Value;
+ Expression a;
+
+ a = new Assign (var, expr, loc);
+ a.Resolve (ec);
+ if (!need_conv)
+ converted_vars [i] = var;
+ i++;
+ if (a == null)
+ continue;
+ ((ExpressionStatement) a).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;
+ Label skip = ig.DefineLabel ();
+ i--;
+
+ ig.BeginFinallyBlock ();
+
+ var.Emit (ec);
+ ig.Emit (OpCodes.Brfalse, skip);
+ converted_vars [i].Emit (ec);
+ ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
+ ig.MarkLabel (skip);
+ ig.EndExceptionBlock ();
}
+ ec.InFinally = old_in_finally;
+
+ return false;
}
- public Catch General {
- get {
- return general;
+ bool EmitExpression (EmitContext ec, Expression expr)
+ {
+ Type expr_type = expr.Type;
+ Expression conv = null;
+
+ if (!TypeManager.ImplementsInterface (expr_type, TypeManager.idisposable_type)){
+ conv = Expression.ConvertImplicit (
+ ec, expr, TypeManager.idisposable_type, loc);
+
+ if (conv == null)
+ return false;
}
+
+ //
+ // Make a copy of the expression and operate on that.
+ //
+ ILGenerator ig = ec.ig;
+ LocalBuilder local_copy = ig.DeclareLocal (expr_type);
+ if (conv != null)
+ conv.Emit (ec);
+ else
+ 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;
}
+
+ public override bool Emit (EmitContext ec)
+ {
+ if (expression_or_block is DictionaryEntry){
+ string t = (string) ((DictionaryEntry) expression_or_block).Key;
+ ArrayList var_list = (ArrayList)((DictionaryEntry)expression_or_block).Value;
- public Block Fini {
- get {
- return fini;
+ return EmitLocalVariableDecls (ec, t, var_list);
+ } if (expression_or_block is Expression){
+ Expression e = (Expression) expression_or_block;
+
+ e = e.Resolve (ec);
+ if (e == null)
+ return false;
+
+ return EmitExpression (ec, e);
}
+ return false;
}
}
-
- public class Catch {
- TypeRef typeref;
- string name;
- Block block;
+
+ /// <summary>
+ /// Implementation of the foreach C# statement
+ /// </summary>
+ public class Foreach : Statement {
+ string type;
+ LocalVariableReference variable;
+ Expression expr;
+ Statement statement;
+
+ public Foreach (string type, LocalVariableReference var, Expression expr,
+ Statement stmt, Location l)
+ {
+ this.type = type;
+ this.variable = var;
+ this.expr = expr;
+ statement = stmt;
+ loc = l;
+ }
+
+ //
+ // Retrieves a `public bool MoveNext ()' method from the Type `t'
+ //
+ static MethodInfo FetchMethodMoveNext (Type t)
+ {
+ MemberInfo [] move_next_list;
+
+ move_next_list = TypeContainer.FindMembers (
+ t, MemberTypes.Method,
+ BindingFlags.Public | BindingFlags.Instance,
+ Type.FilterName, "MoveNext");
+ if (move_next_list == null || move_next_list.Length == 0)
+ return null;
+
+ foreach (MemberInfo m in move_next_list){
+ MethodInfo mi = (MethodInfo) m;
+ Type [] args;
+
+ args = TypeManager.GetArgumentTypes (mi);
+ if (args != null && args.Length == 0){
+ if (mi.ReturnType == TypeManager.bool_type)
+ return mi;
+ }
+ }
+ return null;
+ }
- public Catch (TypeRef typeref, string name, Block block)
+ //
+ // Retrieves a `public T get_Current ()' method from the Type `t'
+ //
+ static MethodInfo FetchMethodGetCurrent (Type t)
{
- this.typeref = typeref;
- this.name = name;
- this.block = block;
+ MemberInfo [] move_next_list;
+
+ move_next_list = TypeContainer.FindMembers (
+ t, MemberTypes.Method,
+ BindingFlags.Public | BindingFlags.Instance,
+ Type.FilterName, "get_Current");
+ if (move_next_list == null || move_next_list.Length == 0)
+ return null;
+
+ foreach (MemberInfo m in move_next_list){
+ MethodInfo mi = (MethodInfo) m;
+ Type [] args;
+
+ args = TypeManager.GetArgumentTypes (mi);
+ if (args != null && args.Length == 0)
+ return mi;
+ }
+ return null;
}
- public Block Block {
- get {
- return block;
+ //
+ // This struct records the helper methods used by the Foreach construct
+ //
+ class ForeachHelperMethods {
+ public EmitContext ec;
+ public MethodInfo get_enumerator;
+ public MethodInfo move_next;
+ public MethodInfo get_current;
+
+ public ForeachHelperMethods (EmitContext ec)
+ {
+ this.ec = ec;
}
}
+
+ static bool GetEnumeratorFilter (MemberInfo m, object criteria)
+ {
+ if (m == null)
+ return false;
+
+ if (!(m is MethodInfo))
+ return false;
+
+ if (m.Name != "GetEnumerator")
+ return false;
- public string Name {
- get {
- return name;
+ MethodInfo mi = (MethodInfo) m;
+ Type [] args = TypeManager.GetArgumentTypes (mi);
+ if (args != null){
+ if (args.Length != 0)
+ return false;
+ }
+ ForeachHelperMethods hm = (ForeachHelperMethods) criteria;
+ EmitContext ec = hm.ec;
+
+ //
+ // Check whether GetEnumerator is accessible to us
+ //
+ MethodAttributes prot = mi.Attributes & MethodAttributes.MemberAccessMask;
+
+ Type declaring = mi.DeclaringType;
+ if (prot == MethodAttributes.Private){
+ if (declaring != ec.ContainerType)
+ return false;
+ } else if (prot == MethodAttributes.FamANDAssem){
+ // If from a different assembly, false
+ if (!(mi is MethodBuilder))
+ return false;
+ //
+ // Are we being invoked from the same class, or from a derived method?
+ //
+ if (ec.ContainerType != declaring){
+ if (!ec.ContainerType.IsSubclassOf (declaring))
+ return false;
+ }
+ } else if (prot == MethodAttributes.FamORAssem){
+ if (!(mi is MethodBuilder ||
+ ec.ContainerType == declaring ||
+ ec.ContainerType.IsSubclassOf (declaring)))
+ return false;
+ } if (prot == MethodAttributes.Family){
+ if (!(ec.ContainerType == declaring ||
+ ec.ContainerType.IsSubclassOf (declaring)))
+ return false;
}
+
+ //
+ // Ok, we can access it, now make sure that we can do something
+ // with this `GetEnumerator'
+ //
+ if (mi.ReturnType == TypeManager.ienumerator_type ||
+ TypeManager.ienumerator_type.IsAssignableFrom (mi.ReturnType)){
+ hm.move_next = TypeManager.bool_movenext_void;
+ hm.get_current = TypeManager.object_getcurrent_void;
+ return true;
+ }
+
+ //
+ // Ok, so they dont return an IEnumerable, we will have to
+ // find if they support the GetEnumerator pattern.
+ //
+ Type return_type = mi.ReturnType;
+
+ hm.move_next = FetchMethodMoveNext (return_type);
+ if (hm.move_next == null)
+ return false;
+ hm.get_current = FetchMethodGetCurrent (return_type);
+ if (hm.get_current == null)
+ return false;
+
+ return true;
+ }
+
+ /// <summary>
+ /// This filter is used to find the GetEnumerator method
+ /// on which IEnumerator operates
+ /// </summary>
+ static MemberFilter FilterEnumerator;
+
+ static Foreach ()
+ {
+ FilterEnumerator = new MemberFilter (GetEnumeratorFilter);
}
- public Type Type {
- get {
- return typeref.Type;
+ void error1579 (Type t)
+ {
+ Report.Error (1579, loc,
+ "foreach statement cannot operate on variables of type `" +
+ t.FullName + "' because that class does not provide a " +
+ " GetEnumerator method or it is inaccessible");
+ }
+
+ static bool TryType (Type t, ForeachHelperMethods hm)
+ {
+ MemberInfo [] mi;
+
+ mi = TypeContainer.FindMembers (t, MemberTypes.Method,
+ BindingFlags.Public | BindingFlags.NonPublic |
+ BindingFlags.Instance,
+ FilterEnumerator, hm);
+
+ if (mi == null || mi.Length == 0)
+ return false;
+
+ hm.get_enumerator = (MethodInfo) mi [0];
+ return true;
+ }
+
+ //
+ // Looks for a usable GetEnumerator in the Type, and if found returns
+ // the three methods that participate: GetEnumerator, MoveNext and get_Current
+ //
+ ForeachHelperMethods ProbeCollectionType (EmitContext ec, Type t)
+ {
+ ForeachHelperMethods hm = new ForeachHelperMethods (ec);
+
+ if (TryType (t, hm))
+ return hm;
+
+ //
+ // Now try to find the method in the interfaces
+ //
+ while (t != null){
+ Type [] ifaces = t.GetInterfaces ();
+
+ foreach (Type i in ifaces){
+ if (TryType (i, hm))
+ return hm;
+ }
+
+ //
+ // Since TypeBuilder.GetInterfaces only returns the interface
+ // types for this type, we have to keep looping, but once
+ // we hit a non-TypeBuilder (ie, a Type), then we know we are
+ // done, because it returns all the types
+ //
+ if ((t is TypeBuilder))
+ t = t.BaseType;
+ else
+ break;
+ }
+
+ return null;
+ }
+
+ //
+ // FIXME: possible optimization.
+ // We might be able to avoid creating `empty' if the type is the sam
+ //
+ bool EmitCollectionForeach (EmitContext ec, Type var_type, ForeachHelperMethods hm)
+ {
+ ILGenerator ig = ec.ig;
+ LocalBuilder enumerator, disposable;
+ Expression empty = new EmptyExpression ();
+ Expression conv;
+
+ //
+ // FIXME: maybe we can apply the same trick we do in the
+ // array handling to avoid creating empty and conv in some cases.
+ //
+ // Although it is not as important in this case, as the type
+ // will not likely be object (what the enumerator will return).
+ //
+ conv = Expression.ConvertExplicit (ec, empty, var_type, loc);
+ if (conv == null)
+ return false;
+
+ enumerator = ig.DeclareLocal (TypeManager.ienumerator_type);
+ disposable = ig.DeclareLocal (TypeManager.idisposable_type);
+
+ //
+ // Instantiate the enumerator
+ //
+ if (expr.Type.IsValueType){
+ if (expr is IMemoryLocation){
+ IMemoryLocation ml = (IMemoryLocation) expr;
+
+ ml.AddressOf (ec, AddressOp.Load);
+ } else
+ throw new Exception ("Expr " + expr + " of type " + expr.Type +
+ " does not implement IMemoryLocation");
+ ig.Emit (OpCodes.Call, hm.get_enumerator);
+ } else {
+ expr.Emit (ec);
+ ig.Emit (OpCodes.Callvirt, hm.get_enumerator);
}
+ ig.Emit (OpCodes.Stloc, enumerator);
+
+ //
+ // Protect the code in a try/finalize block, so that
+ // if the beast implement IDisposable, we get rid of it
+ //
+ Label l = ig.BeginExceptionBlock ();
+ bool old_in_try = ec.InTry;
+ ec.InTry = true;
+
+ Label end_try = ig.DefineLabel ();
+
+ ig.MarkLabel (ec.LoopBegin);
+ ig.Emit (OpCodes.Ldloc, enumerator);
+ ig.Emit (OpCodes.Callvirt, hm.move_next);
+ ig.Emit (OpCodes.Brfalse, end_try);
+ ig.Emit (OpCodes.Ldloc, enumerator);
+ ig.Emit (OpCodes.Callvirt, hm.get_current);
+ variable.EmitAssign (ec, conv);
+ 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);
+
+ //
+ // Now the finally block
+ //
+ Label end_finally = ig.DefineLabel ();
+ bool old_in_finally = ec.InFinally;
+ ec.InFinally = true;
+ ig.BeginFinallyBlock ();
+
+ ig.Emit (OpCodes.Ldloc, enumerator);
+ ig.Emit (OpCodes.Isinst, TypeManager.idisposable_type);
+ ig.Emit (OpCodes.Stloc, disposable);
+ ig.Emit (OpCodes.Ldloc, disposable);
+ ig.Emit (OpCodes.Brfalse, end_finally);
+ ig.Emit (OpCodes.Ldloc, disposable);
+ 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);
+
+ ig.EndExceptionBlock ();
+
+ ig.MarkLabel (ec.LoopEnd);
+ return false;
+ }
+
+ //
+ // FIXME: possible optimization.
+ // We might be able to avoid creating `empty' if the type is the sam
+ //
+ bool EmitArrayForeach (EmitContext ec, Type var_type)
+ {
+ Type array_type = expr.Type;
+ Type element_type = array_type.GetElementType ();
+ Expression conv = null;
+ Expression empty = new EmptyExpression (element_type);
+
+ conv = Expression.ConvertExplicit (ec, empty, var_type, loc);
+ if (conv == null)
+ return false;
+
+ int rank = array_type.GetArrayRank ();
+ ILGenerator ig = ec.ig;
+
+ LocalBuilder copy = ig.DeclareLocal (array_type);
+
+ //
+ // Make our copy of the array
+ //
+ expr.Emit (ec);
+ ig.Emit (OpCodes.Stloc, copy);
+
+ if (rank == 1){
+ LocalBuilder counter = ig.DeclareLocal (TypeManager.int32_type);
+
+ Label loop, test;
+
+ ig.Emit (OpCodes.Ldc_I4_0);
+ ig.Emit (OpCodes.Stloc, counter);
+ test = ig.DefineLabel ();
+ ig.Emit (OpCodes.Br, test);
+
+ loop = ig.DefineLabel ();
+ ig.MarkLabel (loop);
+
+ ig.Emit (OpCodes.Ldloc, copy);
+ ig.Emit (OpCodes.Ldloc, counter);
+ ArrayAccess.EmitLoadOpcode (ig, var_type);
+
+ variable.EmitAssign (ec, conv);
+
+ statement.Emit (ec);
+
+ ig.MarkLabel (ec.LoopBegin);
+ ig.Emit (OpCodes.Ldloc, counter);
+ ig.Emit (OpCodes.Ldc_I4_1);
+ ig.Emit (OpCodes.Add);
+ ig.Emit (OpCodes.Stloc, counter);
+
+ ig.MarkLabel (test);
+ ig.Emit (OpCodes.Ldloc, counter);
+ ig.Emit (OpCodes.Ldloc, copy);
+ ig.Emit (OpCodes.Ldlen);
+ ig.Emit (OpCodes.Conv_I4);
+ ig.Emit (OpCodes.Blt, loop);
+ } else {
+ LocalBuilder [] dim_len = new LocalBuilder [rank];
+ LocalBuilder [] dim_count = new LocalBuilder [rank];
+ Label [] loop = new Label [rank];
+ Label [] test = new Label [rank];
+ int dim;
+
+ for (dim = 0; dim < rank; dim++){
+ dim_len [dim] = ig.DeclareLocal (TypeManager.int32_type);
+ dim_count [dim] = ig.DeclareLocal (TypeManager.int32_type);
+ test [dim] = ig.DefineLabel ();
+ loop [dim] = ig.DefineLabel ();
+ }
+
+ for (dim = 0; dim < rank; dim++){
+ ig.Emit (OpCodes.Ldloc, copy);
+ IntLiteral.EmitInt (ig, dim);
+ ig.Emit (OpCodes.Callvirt, TypeManager.int_getlength_int);
+ ig.Emit (OpCodes.Stloc, dim_len [dim]);
+ }
+
+ for (dim = 0; dim < rank; dim++){
+ ig.Emit (OpCodes.Ldc_I4_0);
+ ig.Emit (OpCodes.Stloc, dim_count [dim]);
+ ig.Emit (OpCodes.Br, test [dim]);
+ ig.MarkLabel (loop [dim]);
+ }
+
+ ig.Emit (OpCodes.Ldloc, copy);
+ for (dim = 0; dim < rank; dim++)
+ ig.Emit (OpCodes.Ldloc, dim_count [dim]);
+
+ //
+ // FIXME: Maybe we can cache the computation of `get'?
+ //
+ Type [] args = new Type [rank];
+ MethodInfo get;
+
+ for (int i = 0; i < rank; i++)
+ args [i] = TypeManager.int32_type;
+
+ ModuleBuilder mb = CodeGen.ModuleBuilder;
+ get = mb.GetArrayMethod (
+ array_type, "Get",
+ CallingConventions.HasThis| CallingConventions.Standard,
+ var_type, args);
+ ig.Emit (OpCodes.Call, get);
+ variable.EmitAssign (ec, conv);
+ statement.Emit (ec);
+ ig.MarkLabel (ec.LoopBegin);
+ for (dim = rank - 1; dim >= 0; dim--){
+ ig.Emit (OpCodes.Ldloc, dim_count [dim]);
+ ig.Emit (OpCodes.Ldc_I4_1);
+ ig.Emit (OpCodes.Add);
+ ig.Emit (OpCodes.Stloc, dim_count [dim]);
+
+ ig.MarkLabel (test [dim]);
+ ig.Emit (OpCodes.Ldloc, dim_count [dim]);
+ ig.Emit (OpCodes.Ldloc, dim_len [dim]);
+ ig.Emit (OpCodes.Blt, loop [dim]);
+ }
+ }
+ ig.MarkLabel (ec.LoopEnd);
+
+ return false;
+ }
+
+ public override bool Emit (EmitContext ec)
+ {
+ Type var_type;
+ bool ret_val;
+
+ expr = expr.Resolve (ec);
+ if (expr == null)
+ return false;
+
+ var_type = RootContext.LookupType (ec.DeclSpace, type, false, loc);
+ if (var_type == null)
+ return false;
+
+ //
+ // We need an instance variable. Not sure this is the best
+ // way of doing this.
+ //
+ // FIXME: When we implement propertyaccess, will those turn
+ // out to return values in ExprClass? I think they should.
+ //
+ if (!(expr.eclass == ExprClass.Variable || expr.eclass == ExprClass.Value ||
+ expr.eclass == ExprClass.PropertyAccess)){
+ error1579 (expr.Type);
+ return false;
+ }
+
+ ILGenerator ig = ec.ig;
+
+ Label old_begin = ec.LoopBegin, old_end = ec.LoopEnd;
+ bool old_inloop = ec.InLoop;
+ ec.LoopBegin = ig.DefineLabel ();
+ ec.LoopEnd = ig.DefineLabel ();
+ ec.InLoop = true;
+
+ if (expr.Type.IsArray)
+ ret_val = EmitArrayForeach (ec, var_type);
+ else {
+ ForeachHelperMethods hm;
+
+ hm = ProbeCollectionType (ec, expr.Type);
+ if (hm == null){
+ error1579 (expr.Type);
+ return false;
+ }
+
+ ret_val = EmitCollectionForeach (ec, var_type, hm);
+ }
+
+ ec.LoopBegin = old_begin;
+ ec.LoopEnd = old_end;
+ ec.InLoop = old_inloop;
+
+ return ret_val;
}
}
}
diff --git a/mcs/mcs/statementCollection.cs b/mcs/mcs/statementCollection.cs
index 475b17b1279..9e5141dfdc6 100755
--- a/mcs/mcs/statementCollection.cs
+++ b/mcs/mcs/statementCollection.cs
@@ -7,7 +7,7 @@
// (C) 2001 Ximian, Inc.
//
-namespace CIR {
+namespace Mono.CSharp {
using System.Collections;
using System;
@@ -156,5 +156,11 @@ namespace CIR {
return statements.IsSynchronized;
}
}
+
+ public bool IsFixedSize {
+ get {
+ return false;
+ }
+ }
}
}
diff --git a/mcs/mcs/support.cs b/mcs/mcs/support.cs
new file mode 100755
index 00000000000..f6f0614d88d
--- /dev/null
+++ b/mcs/mcs/support.cs
@@ -0,0 +1,240 @@
+//
+// support.cs: Support routines to work around the fact that System.Reflection.Emit
+// can not introspect types that are being constructed
+//
+// Author:
+// Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+using System.Text;
+using System.Reflection;
+using System.Collections;
+using System.Reflection.Emit;
+
+namespace Mono.CSharp {
+
+ public interface ParameterData {
+ Type ParameterType (int pos);
+ int Count { get; }
+ string ParameterDesc (int pos);
+ Parameter.Modifier ParameterModifier (int pos);
+ }
+
+ public class ReflectionParameters : ParameterData {
+ ParameterInfo [] pi;
+ bool last_arg_is_params;
+
+ public ReflectionParameters (ParameterInfo [] pi)
+ {
+ object [] attrs;
+
+ this.pi = pi;
+
+ int count = pi.Length-1;
+
+ if (count >= 0) {
+ attrs = pi [count].GetCustomAttributes (TypeManager.param_array_type, true);
+
+ if (attrs == null)
+ return;
+
+ if (attrs.Length == 0)
+ return;
+ last_arg_is_params = true;
+ }
+ }
+
+ public Type ParameterType (int pos)
+ {
+ if (last_arg_is_params && pos >= pi.Length - 1)
+ return pi [pi.Length -1].ParameterType;
+ else
+ return pi [pos].ParameterType;
+ }
+
+ public string ParameterDesc (int pos)
+ {
+ StringBuilder sb = new StringBuilder ();
+
+ if (pi [pos].IsOut)
+ sb.Append ("out ");
+
+ if (pi [pos].IsIn)
+ sb.Append ("in ");
+
+ if (pos >= pi.Length - 1 && last_arg_is_params)
+ sb.Append ("params ");
+
+ sb.Append (TypeManager.CSharpName (ParameterType (pos)));
+
+ return sb.ToString ();
+
+ }
+
+ public Parameter.Modifier ParameterModifier (int pos)
+ {
+ int len = pi.Length;
+
+ if (pos >= len - 1)
+ if (last_arg_is_params)
+ return Parameter.Modifier.PARAMS;
+
+ Type t = pi [pos].ParameterType;
+ if (t.IsByRef)
+ return Parameter.Modifier.OUT;
+
+ return Parameter.Modifier.NONE;
+ }
+
+ public int Count {
+ get {
+ return pi.Length;
+ }
+ }
+
+ }
+
+ public class InternalParameters : ParameterData {
+ Type [] param_types;
+
+ Parameters parameters;
+
+ public InternalParameters (Type [] param_types, Parameters parameters)
+ {
+ this.param_types = param_types;
+ this.parameters = parameters;
+ }
+
+ public InternalParameters (DeclSpace ds, Parameters parameters)
+ : this (parameters.GetParameterInfo (ds), parameters)
+ {
+ }
+
+ public int Count {
+ get {
+ if (param_types == null)
+ return 0;
+
+ return param_types.Length;
+ }
+ }
+
+ public Type ParameterType (int pos)
+ {
+ if (param_types == null)
+ return null;
+
+ Parameter [] fixed_pars = parameters.FixedParameters;
+ if (fixed_pars != null){
+ int len = fixed_pars.Length;
+ if (pos < len)
+ return parameters.FixedParameters [pos].ParameterType;
+ else
+ return parameters.ArrayParameter.ParameterType;
+ } else
+ return parameters.ArrayParameter.ParameterType;
+ }
+
+ public string ParameterDesc (int pos)
+ {
+ string tmp = null;
+ Parameter p;
+
+ if (pos >= parameters.FixedParameters.Length)
+ p = parameters.ArrayParameter;
+ else
+ p = parameters.FixedParameters [pos];
+
+ if (p.ModFlags == Parameter.Modifier.REF)
+ tmp = "ref ";
+ else if (p.ModFlags == Parameter.Modifier.OUT)
+ tmp = "out ";
+ else if (p.ModFlags == Parameter.Modifier.PARAMS)
+ tmp = "params ";
+
+ Type t = ParameterType (pos);
+
+ return tmp + TypeManager.CSharpName (t);
+ }
+
+ public Parameter.Modifier ParameterModifier (int pos)
+ {
+ if (parameters.FixedParameters == null) {
+ if (parameters.ArrayParameter != null)
+ return parameters.ArrayParameter.ModFlags;
+ else
+ return Parameter.Modifier.NONE;
+ }
+
+ if (pos >= parameters.FixedParameters.Length)
+ return parameters.ArrayParameter.ModFlags;
+ else {
+ Parameter.Modifier m = parameters.FixedParameters [pos].ModFlags;
+
+ //
+ // We use a return value of "OUT" for "reference" parameters.
+ // both out and ref flags in the source map to reference parameters.
+ //
+ if (m == Parameter.Modifier.OUT || m == Parameter.Modifier.REF)
+ return Parameter.Modifier.OUT;
+
+ return Parameter.Modifier.NONE;
+ }
+ }
+
+ }
+
+ class PtrHashtable : Hashtable {
+ class PtrComparer : IComparer {
+ public int Compare (object x, object y)
+ {
+ if (x == y)
+ return 0;
+ else
+ return 1;
+ }
+ }
+
+ public PtrHashtable ()
+ {
+ comparer = new PtrComparer ();
+ }
+ }
+
+ //
+ // Compares member infos based on their name and
+ // also allows one argument to be a string
+ //
+ class MemberInfoCompare : IComparer {
+
+ public int Compare (object a, object b)
+ {
+ if (a == null || b == null){
+ Console.WriteLine ("Invalid information passed");
+ throw new Exception ();
+ }
+
+ if (a is string)
+ return String.Compare ((string) a, ((MemberInfo)b).Name);
+
+ if (b is string)
+ return String.Compare (((MemberInfo)a).Name, (string) b);
+
+ return String.Compare (((MemberInfo)a).Name, ((MemberInfo)b).Name);
+ }
+ }
+
+ struct Pair {
+ public object First;
+ public object Second;
+
+ public Pair (object f, object s)
+ {
+ First = f;
+ Second = s;
+ }
+ }
+}
diff --git a/mcs/mcs/tree.cs b/mcs/mcs/tree.cs
index f08c5a27dac..2cf5be8ca5c 100755
--- a/mcs/mcs/tree.cs
+++ b/mcs/mcs/tree.cs
@@ -13,170 +13,96 @@ using System;
using System.Collections;
using System.Reflection;
using System.Reflection.Emit;
+using System.IO;
-namespace CIR
+namespace Mono.CSharp
{
+ public interface ITreeDump {
+ int Dump (Tree tree, StreamWriter output);
+ void ParseOptions (string options);
+ }
+
// <summary>
- // A storage for temporary IL trees
+ //
+ // We store here all the toplevel types that we have parsed,
+ // this is the root of all information we have parsed.
+ //
// </summary>
public class Tree {
TypeContainer root_types;
// <summary>
- // Holds the Array of Assemblies that have been loaded
- // (either because it is the default or the user used the
- // -r command line option)
- // </summary>
- ArrayList assemblies;
-
- // <summary>
- // This is used to map defined FQN to Types
+ // Keeps track of namespaces defined in the source code
// </summary>
- Hashtable types;
+ Hashtable namespaces;
// <summary>
- // This maps source defined types that are defined
- // in the source code to their object holders (Class, Struct,
- // Interface) and that have not yet been made into real
- // types.
+ // Keeps track of all the types definied (classes, structs, ifaces, enums)
// </summary>
- Hashtable source_types;
-
- AppDomain current_domain;
- AssemblyBuilder assembly_builder;
- ModuleBuilder module_builder;
+ Hashtable decls;
public Tree ()
{
- root_types = new TypeContainer (null, "");
- assemblies = new ArrayList ();
- types = new Hashtable ();
- source_types = new Hashtable ();
- }
-
- public int BuilderInit (string name, string output)
- {
- AssemblyName an;
-
- an = new AssemblyName ();
- an.Name = "AssemblyName";
- current_domain = AppDomain.CurrentDomain;
- assembly_builder = current_domain.DefineDynamicAssembly (
- an, AssemblyBuilderAccess.RunAndSave);
-
- module_builder = assembly_builder.DefineDynamicModule (name, output);
-
- return 0;
- }
+ root_types = new TypeContainer (null, "", new Location (-1));
- public AssemblyBuilder AssemblyBuilder {
- get {
- return assembly_builder;
- }
- }
-
- public ModuleBuilder ModuleBuilder {
- get {
- return module_builder;
- }
+ decls = new Hashtable ();
+ namespaces = new Hashtable ();
}
- public void RecordType (string name, DeclSpace decl)
+ public void RecordDecl (string name, DeclSpace ds)
{
- source_types.Add (name, decl);
- }
-
- public TypeContainer Types {
- get {
- return root_types;
+ if (decls.Contains (name)){
+ Report.Error (
+ 101, ds.Location,
+ "There is already a definition for `" + name + "'");
+ DeclSpace other = (DeclSpace) decls [name];
+ Report.Error (0,
+ other.Location, "(Location of symbol related to previous error)");
+ return;
}
- }
-
- public int ResolveTypeContainerTypes (TypeContainer type)
- {
- return 0;
+ decls.Add (name, ds);
}
- public int ResolveNames (TypeContainer types)
+ public Namespace RecordNamespace (Namespace parent, string file, string name)
{
- int errors = 0;
-
- if (types == null)
- return 0;
+ Namespace ns = new Namespace (parent, name);
- foreach (DictionaryEntry de in types.Types){
- TypeContainer type = (TypeContainer) de.Value;
+ if (namespaces.Contains (file)){
+ Hashtable ns_ns = (Hashtable) namespaces [file];
- errors += ResolveTypeContainerTypes (type);
- }
-
- return errors;
- }
-
- public Type ResolveType (string name)
- {
- Type t = (Type) types [name];
-
- if (t != null)
- return t;
-
- DeclSpace decl;
- decl = (DeclSpace) source_types [name];
+ if (ns_ns.Contains (ns.Name))
+ return (Namespace) ns_ns [ns.Name];
+ ns_ns.Add (ns.Name, ns);
+ } else {
+ Hashtable new_table = new Hashtable ();
+ namespaces [file] = new_table;
- // FIXME: handle using here.
- if (decl == null){
- CSC.CSharpParser.error (234, "The type or namespace name '" + name
- + "' does not exist in the current space");
- return null;
+ new_table.Add (ns.Name, ns);
}
- return decl.Define (this);
- }
-
- int iscan_errors = 0;
- void interface_scan (TypeContainer container, object data)
- {
- foreach (Interface iface in container.Interfaces){
- Type t = ResolveType (iface.Name);
-
- if (t != null){
- CSC.CSharpParser.error (101, "There is already a definition for " + iface.Name);
- iscan_errors++;
- }
- iface.Define (this);
- }
+ return ns;
}
- public int ResolveInterfaces (TypeContainer type)
- {
- TypeContainer.VisitContainer iscanner;
+ //
+ // FIXME: Why are we using Types?
+ //
+ public TypeContainer Types {
+ get {
+ return root_types;
+ }
+ }
- iscanner = new TypeContainer.VisitContainer (interface_scan);
- type.VisitTypes (iscanner, this);
- return iscan_errors;
- }
-
- public int ResolveTypeContainerParents (TypeContainer type)
- {
- return type.ResolveParents (this);
- }
-
- public int Resolve ()
- {
- int errors = 0;
-
- errors += ResolveInterfaces (root_types);
- errors += ResolveTypeContainerParents (root_types);
- return 0;
+ public Hashtable Decls {
+ get {
+ return decls;
+ }
}
- public void AddAssembly (Assembly a)
- {
- assemblies.Add (a);
- foreach (Type t in a.GetExportedTypes ()){
- types.Add (t.FullName, t);
+ public Hashtable Namespaces {
+ get {
+ return namespaces;
}
}
}
diff --git a/mcs/mcs/type.cs b/mcs/mcs/type.cs
deleted file mode 100755
index 021b00f823a..00000000000
--- a/mcs/mcs/type.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-//
-// type.cs: Type container.
-//
-// Author: Miguel de Icaza (miguel@gnu.org)
-//
-// Licensed under the terms of the GNU GPL
-//
-// (C) 2001 Ximian, Inc (http://www.ximian.com)
-//
-
-namespace CIR {
- using System.Collections;
- using System;
-
- public class UnresolvedType {
- TypeContainer parent;
- string name;
-
- public UnresolvedType (TypeContainer parent, string name)
- {
- this.parent = parent;
- this.name = name;
- }
-
- public string Name {
- get {
- return name;
- }
- }
-
- public TypeContainer Parent {
- get {
- return parent;
- }
- }
- }
-
- public class TypeRef {
- object data;
-
- public TypeRef (object data)
- {
- this.data = data;
- }
-
- public Object Data {
- get {
- return data;
- }
- }
-
- public UnresolvedType UnresolvedData {
- get {
- if (data is UnresolvedType)
- return (UnresolvedType) data;
- else
- return null;
- }
- }
-
- public Type Type {
- get {
- if (data is UnresolvedType)
- Resolve ();
-
- return (Type) data;
- }
- }
-
- public bool IsResolved {
- get {
- return !(data is UnresolvedType);
- }
- }
-
- public bool Resolve () {
- return false;
- }
- }
-
- public class TypeRefManager {
- ArrayList pending_types;
-
- public TypeRefManager ()
- {
- pending_types = new ArrayList ();
- }
-
- public TypeRef GetTypeRef (TypeContainer container, string name)
- {
- object unresolved;
- TypeRef typeref;
-
- unresolved = new UnresolvedType (container, name);
- typeref = new TypeRef (unresolved);
- pending_types.Add (typeref);
-
- return typeref;
- }
- }
-}
-
-
-
diff --git a/mcs/mcs/typemanager.cs b/mcs/mcs/typemanager.cs
new file mode 100755
index 00000000000..01cc191389c
--- /dev/null
+++ b/mcs/mcs/typemanager.cs
@@ -0,0 +1,1095 @@
+//
+// typemanager.cs: C# type manager
+//
+// Author: Miguel de Icaza (miguel@gnu.org)
+// Ravi Pratap (ravi@ximian.com)
+//
+// Licensed under the terms of the GNU GPL
+//
+// (C) 2001 Ximian, Inc (http://www.ximian.com)
+//
+//
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Reflection.Emit;
+
+namespace Mono.CSharp {
+
+public class TypeManager {
+ //
+ // A list of core types that the compiler requires or uses
+ //
+ static public Type object_type;
+ static public Type value_type;
+ static public Type string_type;
+ static public Type int32_type;
+ static public Type uint32_type;
+ static public Type int64_type;
+ static public Type uint64_type;
+ static public Type float_type;
+ static public Type double_type;
+ static public Type char_type;
+ static public Type char_ptr_type;
+ static public Type short_type;
+ static public Type decimal_type;
+ static public Type bool_type;
+ static public Type sbyte_type;
+ static public Type byte_type;
+ static public Type ushort_type;
+ static public Type enum_type;
+ static public Type delegate_type;
+ static public Type multicast_delegate_type;
+ static public Type void_type;
+ static public Type enumeration_type;
+ static public Type array_type;
+ static public Type runtime_handle_type;
+ static public Type icloneable_type;
+ static public Type type_type;
+ static public Type ienumerator_type;
+ static public Type idisposable_type;
+ static public Type default_member_type;
+ static public Type iasyncresult_type;
+ static public Type asynccallback_type;
+ static public Type intptr_type;
+ static public Type monitor_type;
+ static public Type runtime_field_handle_type;
+ static public Type attribute_type;
+ static public Type attribute_usage_type;
+ static public Type dllimport_type;
+ static public Type unverifiable_code_type;
+ static public Type methodimpl_attr_type;
+ static public Type marshal_as_attr_type;
+ static public Type param_array_type;
+ static public Type void_ptr_type;
+
+ static public Type [] NoTypes;
+
+ //
+ // Internal, not really used outside
+ //
+ static Type runtime_helpers_type;
+
+ //
+ // These methods are called by code generated by the compiler
+ //
+ static public MethodInfo string_concat_string_string;
+ static public MethodInfo string_concat_object_object;
+ static public MethodInfo string_isinterneted_string;
+ static public MethodInfo system_type_get_type_from_handle;
+ static public MethodInfo object_getcurrent_void;
+ static public MethodInfo bool_movenext_void;
+ static public MethodInfo void_dispose_void;
+ static public MethodInfo void_monitor_enter_object;
+ static public MethodInfo void_monitor_exit_object;
+ static public MethodInfo void_initializearray_array_fieldhandle;
+ static public MethodInfo int_getlength_int;
+ static public MethodInfo delegate_combine_delegate_delegate;
+ static public MethodInfo delegate_remove_delegate_delegate;
+ static public MethodInfo int_get_offset_to_string_data;
+ static public MethodInfo int_array_get_length;
+
+ //
+ // The attribute constructors.
+ //
+ static public ConstructorInfo cons_param_array_attribute;
+ static public ConstructorInfo void_decimal_ctor_five_args;
+
+ // <remarks>
+ // Holds the Array of Assemblies that have been loaded
+ // (either because it is the default or the user used the
+ // -r command line option)
+ // </remarks>
+ static Assembly [] assemblies;
+
+ // <remarks>
+ // Keeps a list of module builders. We used this to do lookups
+ // on the modulebuilder using GetType -- needed for arrays
+ // </remarks>
+ static ModuleBuilder [] modules;
+
+ // <remarks>
+ // This is the type_cache from the assemblies to avoid
+ // hitting System.Reflection on every lookup.
+ // </summary>
+ static Hashtable types;
+
+ // <remarks>
+ // This is used to hotld the corresponding TypeContainer objects
+ // since we need this in FindMembers
+ // </remarks>
+ static Hashtable typecontainers;
+
+ // <remarks>
+ // Keeps track of those types that are defined by the
+ // user's program
+ // </remarks>
+ static ArrayList user_types;
+
+ // <remarks>
+ // Keeps a mapping between TypeBuilders and their TypeContainers
+ // </remarks>
+ static PtrHashtable builder_to_container;
+
+ // <remarks>
+ // Maps MethodBase.RuntimeTypeHandle to a Type array that contains
+ // the arguments to the method
+ // </remarks>
+ static Hashtable method_arguments;
+
+ // <remarks>
+ // Maybe `method_arguments' should be replaced and only
+ // method_internal_params should be kept?
+ // <remarks>
+ static Hashtable method_internal_params;
+
+ static PtrHashtable builder_to_interface;
+
+ // <remarks>
+ // Keeps track of delegate types
+ // </remarks>
+
+ static Hashtable builder_to_delegate;
+
+ // <remarks>
+ // Keeps track of enum types
+ // </remarks>
+
+ static Hashtable builder_to_enum;
+
+ // <remarks>
+ // Keeps track of attribute types
+ // </remarks>
+
+ static Hashtable builder_to_attr;
+
+ struct Signature {
+ public string name;
+ public Type [] args;
+ }
+
+ /// <summary>
+ /// A filter for Findmembers that uses the Signature object to
+ /// extract objects
+ /// </summary>
+ static bool SignatureFilter (MemberInfo mi, object criteria)
+ {
+ Signature sig = (Signature) criteria;
+
+ if (!(mi is MethodBase))
+ return false;
+
+ if (mi.Name != sig.name)
+ return false;
+
+ int count = sig.args.Length;
+
+ if (mi is MethodBuilder || mi is ConstructorBuilder){
+ Type [] candidate_args = GetArgumentTypes ((MethodBase) mi);
+
+ if (candidate_args.Length != count)
+ return false;
+
+ for (int i = 0; i < count; i++)
+ if (candidate_args [i] != sig.args [i])
+ return false;
+
+ return true;
+ } else {
+ ParameterInfo [] pars = ((MethodBase) mi).GetParameters ();
+
+ if (pars.Length != count)
+ return false;
+
+ for (int i = 0; i < count; i++)
+ if (pars [i].ParameterType != sig.args [i])
+ return false;
+ return true;
+ }
+ }
+
+ // A delegate that points to the filter above.
+ static MemberFilter signature_filter;
+
+ static TypeManager ()
+ {
+ assemblies = new Assembly [0];
+ modules = null;
+ user_types = new ArrayList ();
+
+ types = new Hashtable ();
+ typecontainers = new Hashtable ();
+
+ builder_to_interface = new PtrHashtable ();
+ builder_to_delegate = new PtrHashtable ();
+ builder_to_enum = new PtrHashtable ();
+ builder_to_attr = new PtrHashtable ();
+ method_arguments = new PtrHashtable ();
+ method_internal_params = new PtrHashtable ();
+ builder_to_container = new PtrHashtable ();
+
+ NoTypes = new Type [0];
+
+ signature_filter = new MemberFilter (SignatureFilter);
+ }
+
+ public static void AddUserType (string name, TypeBuilder t)
+ {
+ try {
+ types.Add (name, t);
+ user_types.Add (t);
+ } catch {
+ Report.Error (-17, "The type `" + name + "' has already been defined");
+ }
+ }
+
+ public static void AddUserType (string name, TypeBuilder t, TypeContainer tc)
+ {
+ AddUserType (name, t);
+ builder_to_container.Add (t, tc);
+ typecontainers.Add (name, tc);
+ }
+
+ public static void AddDelegateType (string name, TypeBuilder t, Delegate del)
+ {
+ types.Add (name, t);
+ builder_to_delegate.Add (t, del);
+ }
+
+ public static void AddEnumType (string name, TypeBuilder t, Enum en)
+ {
+ types.Add (name, t);
+ builder_to_enum.Add (t, en);
+ }
+
+ public static void AddUserInterface (string name, TypeBuilder t, Interface i)
+ {
+ AddUserType (name, t);
+ builder_to_interface.Add (t, i);
+ }
+
+ public static void RegisterAttrType (Type t, TypeContainer tc)
+ {
+ builder_to_attr.Add (t, tc);
+ }
+
+ /// <summary>
+ /// 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)
+ {
+ return (TypeContainer) builder_to_container [t];
+ }
+
+ public static Interface LookupInterface (Type t)
+ {
+ return (Interface) builder_to_interface [t];
+ }
+
+ public static Delegate LookupDelegate (Type t)
+ {
+ return (Delegate) builder_to_delegate [t];
+ }
+
+ public static Enum LookupEnum (Type t)
+ {
+ return (Enum) builder_to_enum [t];
+ }
+
+ public static TypeContainer LookupAttr (Type t)
+ {
+ return (TypeContainer) builder_to_attr [t];
+ }
+
+ /// <summary>
+ /// Registers an assembly to load types from.
+ /// </summary>
+ public static void AddAssembly (Assembly a)
+ {
+ int top = assemblies.Length;
+ Assembly [] n = new Assembly [top + 1];
+
+ assemblies.CopyTo (n, 0);
+
+ n [top] = a;
+ assemblies = n;
+ }
+
+ /// <summary>
+ /// Registers a module builder to lookup types from
+ /// </summary>
+ public static void AddModule (ModuleBuilder mb)
+ {
+ int top = modules != null ? modules.Length : 0;
+ ModuleBuilder [] n = new ModuleBuilder [top + 1];
+
+ if (modules != null)
+ modules.CopyTo (n, 0);
+ n [top] = mb;
+ modules = n;
+ }
+
+ /// <summary>
+ /// Returns the Type associated with @name
+ /// </summary>
+ public static Type LookupType (string name)
+ {
+ Type t;
+
+ //
+ // First lookup in user defined and cached values
+ //
+
+ t = (Type) types [name];
+ if (t != null)
+ return t;
+
+ foreach (Assembly a in assemblies){
+ t = a.GetType (name);
+ if (t != null){
+ types [name] = t;
+
+ return t;
+ }
+ }
+
+ foreach (ModuleBuilder mb in modules) {
+ t = mb.GetType (name);
+ if (t != null) {
+ types [name] = t;
+ return t;
+ }
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Returns the C# name of a type if possible, or the full type name otherwise
+ /// </summary>
+ static public string CSharpName (Type t)
+ {
+ if (t == int32_type)
+ return "int";
+ else if (t == uint32_type)
+ return "uint";
+ else if (t == int64_type)
+ return "long";
+ else if (t == uint64_type)
+ return "ulong";
+ else if (t == float_type)
+ return "float";
+ else if (t == double_type)
+ return "double";
+ else if (t == char_type)
+ return "char";
+ else if (t == short_type)
+ return "short";
+ else if (t == decimal_type)
+ return "decimal";
+ else if (t == bool_type)
+ return "bool";
+ else if (t == sbyte_type)
+ return "sbyte";
+ else if (t == byte_type)
+ return "byte";
+ else if (t == short_type)
+ return "short";
+ else if (t == ushort_type)
+ return "ushort";
+ else if (t == string_type)
+ return "string";
+ else if (t == object_type)
+ return "object";
+ else if (t == void_type)
+ return "void";
+ else
+ return t.FullName;
+ }
+
+ /// <summary>
+ /// Looks up a type, and aborts if it is not found. This is used
+ /// by types required by the compiler
+ /// </summary>
+ static Type CoreLookupType (string name)
+ {
+ Type t = LookupType (name);
+
+ if (t == null){
+ Report.Error (518, "The predefined type `" + name + "' is not defined or imported");
+ Environment.Exit (0);
+ }
+
+ return t;
+ }
+
+ /// <summary>
+ /// 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)
+ {
+ MemberInfo [] mi;
+ Signature sig;
+
+ sig.name = name;
+ sig.args = args;
+
+ mi = FindMembers (
+ t, MemberTypes.Method,
+ instance_and_static | BindingFlags.Public, signature_filter, sig);
+ if (mi == null || mi.Length == 0 || !(mi [0] is MethodInfo)){
+ Report.Error (-19, "Can not find the core function `" + name + "'");
+ return null;
+ }
+
+ return (MethodInfo) mi [0];
+ }
+
+ /// <summary>
+ /// Returns the ConstructorInfo for "args"
+ /// </summary>
+ static ConstructorInfo GetConstructor (Type t, Type [] args)
+ {
+ MemberInfo [] mi;
+ Signature sig;
+
+ sig.name = ".ctor";
+ sig.args = args;
+
+ mi = FindMembers (t, MemberTypes.Constructor,
+ instance_and_static | BindingFlags.Public, signature_filter, sig);
+ if (mi == null || mi.Length == 0 || !(mi [0] is ConstructorInfo)){
+ Report.Error (-19, "Can not find the core constructor for type `" + t.Name + "'");
+ return null;
+ }
+
+ return (ConstructorInfo) mi [0];
+ }
+
+ /// <remarks>
+ /// The types have to be initialized after the initial
+ /// population of the type has happened (for example, to
+ /// bootstrap the corlib.dll
+ /// </remarks>
+ public static void InitCoreTypes ()
+ {
+ object_type = CoreLookupType ("System.Object");
+ value_type = CoreLookupType ("System.ValueType");
+ string_type = CoreLookupType ("System.String");
+ int32_type = CoreLookupType ("System.Int32");
+ int64_type = CoreLookupType ("System.Int64");
+ uint32_type = CoreLookupType ("System.UInt32");
+ uint64_type = CoreLookupType ("System.UInt64");
+ float_type = CoreLookupType ("System.Single");
+ double_type = CoreLookupType ("System.Double");
+ byte_type = CoreLookupType ("System.Byte");
+ sbyte_type = CoreLookupType ("System.SByte");
+ char_type = CoreLookupType ("System.Char");
+ char_ptr_type = CoreLookupType ("System.Char*");
+ short_type = CoreLookupType ("System.Int16");
+ ushort_type = CoreLookupType ("System.UInt16");
+ decimal_type = CoreLookupType ("System.Decimal");
+ bool_type = CoreLookupType ("System.Boolean");
+ enum_type = CoreLookupType ("System.Enum");
+
+ multicast_delegate_type = CoreLookupType ("System.MulticastDelegate");
+ delegate_type = CoreLookupType ("System.Delegate");
+
+ array_type = CoreLookupType ("System.Array");
+ void_type = CoreLookupType ("System.Void");
+ type_type = CoreLookupType ("System.Type");
+
+ runtime_field_handle_type = CoreLookupType ("System.RuntimeFieldHandle");
+ runtime_helpers_type = CoreLookupType ("System.Runtime.CompilerServices.RuntimeHelpers");
+ default_member_type = CoreLookupType ("System.Reflection.DefaultMemberAttribute");
+ runtime_handle_type = CoreLookupType ("System.RuntimeTypeHandle");
+ asynccallback_type = CoreLookupType ("System.AsyncCallback");
+ iasyncresult_type = CoreLookupType ("System.IAsyncResult");
+ ienumerator_type = CoreLookupType ("System.Collections.IEnumerator");
+ idisposable_type = CoreLookupType ("System.IDisposable");
+ icloneable_type = CoreLookupType ("System.ICloneable");
+ monitor_type = CoreLookupType ("System.Threading.Monitor");
+ intptr_type = CoreLookupType ("System.IntPtr");
+
+ attribute_type = CoreLookupType ("System.Attribute");
+ attribute_usage_type = CoreLookupType ("System.AttributeUsageAttribute");
+ dllimport_type = CoreLookupType ("System.Runtime.InteropServices.DllImportAttribute");
+ methodimpl_attr_type = CoreLookupType ("System.Runtime.CompilerServices.MethodImplAttribute");
+ marshal_as_attr_type = CoreLookupType ("System.Runtime.InteropServices.MarshalAsAttribute");
+ param_array_type = CoreLookupType ("System.ParamArrayAttribute");
+
+ unverifiable_code_type= CoreLookupType ("System.Security.UnverifiableCodeAttribute");
+
+ void_ptr_type = CoreLookupType ("System.Void*");
+
+ }
+
+ //
+ // The helper methods that are used by the compiler
+ //
+ public static void InitCodeHelpers ()
+ {
+ //
+ // Now load the default methods that we use.
+ //
+ Type [] string_string = { string_type, string_type };
+ string_concat_string_string = GetMethod (
+ string_type, "Concat", string_string);
+
+ Type [] object_object = { object_type, object_type };
+ string_concat_object_object = GetMethod (
+ string_type, "Concat", object_object);
+
+ Type [] string_ = { string_type };
+ string_isinterneted_string = GetMethod (
+ string_type, "IsInterned", string_);
+
+ Type [] runtime_type_handle = { runtime_handle_type };
+ system_type_get_type_from_handle = GetMethod (
+ type_type, "GetTypeFromHandle", runtime_type_handle);
+
+ Type [] delegate_delegate = { delegate_type, delegate_type };
+ delegate_combine_delegate_delegate = GetMethod (
+ delegate_type, "Combine", delegate_delegate);
+
+ delegate_remove_delegate_delegate = GetMethod (
+ delegate_type, "Remove", delegate_delegate);
+
+ //
+ // Void arguments
+ //
+ Type [] void_arg = { };
+ object_getcurrent_void = GetMethod (
+ ienumerator_type, "get_Current", void_arg);
+ bool_movenext_void = GetMethod (
+ ienumerator_type, "MoveNext", void_arg);
+ void_dispose_void = GetMethod (
+ idisposable_type, "Dispose", void_arg);
+ int_get_offset_to_string_data = GetMethod (
+ runtime_helpers_type, "get_OffsetToStringData", void_arg);
+ int_array_get_length = GetMethod (
+ array_type, "get_Length", void_arg);
+
+ //
+ // object arguments
+ //
+ Type [] object_arg = { object_type };
+ void_monitor_enter_object = GetMethod (
+ monitor_type, "Enter", object_arg);
+ void_monitor_exit_object = GetMethod (
+ monitor_type, "Exit", object_arg);
+
+ Type [] array_field_handle_arg = { array_type, runtime_field_handle_type };
+
+ void_initializearray_array_fieldhandle = GetMethod (
+ runtime_helpers_type, "InitializeArray", array_field_handle_arg);
+
+ //
+ // Array functions
+ //
+ Type [] int_arg = { int32_type };
+ int_getlength_int = GetMethod (
+ array_type, "GetLength", int_arg);
+
+ //
+ // Decimal constructors
+ //
+ Type [] dec_arg = { int32_type, int32_type, int32_type, bool_type, byte_type };
+ void_decimal_ctor_five_args = GetConstructor (
+ decimal_type, dec_arg);
+
+ //
+ // Attributes
+ //
+ cons_param_array_attribute = GetConstructor (
+ param_array_type, void_arg);
+
+ }
+
+ const BindingFlags instance_and_static = BindingFlags.Static | BindingFlags.Instance;
+
+ //
+ // FIXME: This can be optimized easily. speedup by having a single builder mapping
+ //
+ public static MemberInfo [] FindMembers (Type t, MemberTypes mt, BindingFlags bf,
+ MemberFilter filter, object criteria)
+ {
+ //
+ // We have to take care of arrays specially, because GetType on
+ // a TypeBuilder array will return a Type, not a TypeBuilder,
+ // and we can not call FindMembers on this type.
+ //
+ if (t.IsSubclassOf (TypeManager.array_type))
+ return TypeManager.array_type.FindMembers (mt, bf, filter, criteria);
+
+ if (!(t is TypeBuilder)){
+ //
+ // Since FindMembers will not lookup both static and instance
+ // members, we emulate this behaviour here.
+ //
+ if ((bf & instance_and_static) == instance_and_static){
+ MemberInfo [] i_members = t.FindMembers (
+ mt, bf & ~BindingFlags.Static, filter, criteria);
+ MemberInfo [] s_members = t.FindMembers (
+ mt, bf & ~BindingFlags.Instance, filter, criteria);
+
+ int i_len = i_members.Length;
+ int s_len = s_members.Length;
+ if (i_len > 0 || s_len > 0){
+ MemberInfo [] both = new MemberInfo [i_len + s_len];
+
+ i_members.CopyTo (both, 0);
+ s_members.CopyTo (both, i_len);
+
+ return both;
+ } else
+ return i_members;
+ }
+ return t.FindMembers (mt, bf, filter, criteria);
+ }
+
+ //
+ // FIXME: We should not have builder_to_blah everywhere,
+ // we should just have a builder_to_findmemberizable
+ // and have them implement a new ICanFindMembers interface
+ //
+ Enum e = (Enum) builder_to_enum [t];
+
+ if (e != null)
+ return e.FindMembers (mt, bf, filter, criteria);
+
+ Delegate del = (Delegate) builder_to_delegate [t];
+
+ if (del != null)
+ return del.FindMembers (mt, bf, filter, criteria);
+
+ Interface iface = (Interface) builder_to_interface [t];
+
+ if (iface != null)
+ return iface.FindMembers (mt, bf, filter, criteria);
+
+ TypeContainer tc = (TypeContainer) builder_to_container [t];
+
+ if (tc != null)
+ return tc.FindMembers (mt, bf, filter, criteria);
+
+ return null;
+ }
+
+ public static bool IsBuiltinType (Type t)
+ {
+ if (t == object_type || t == string_type || t == int32_type || t == uint32_type ||
+ t == int64_type || t == uint64_type || t == float_type || t == double_type ||
+ t == char_type || t == short_type || t == decimal_type || t == bool_type ||
+ t == sbyte_type || t == byte_type || t == ushort_type)
+ return true;
+ else
+ return false;
+ }
+
+ public static bool IsDelegateType (Type t)
+ {
+ if (t.IsSubclassOf (TypeManager.delegate_type))
+ return true;
+ else
+ return false;
+ }
+
+ public static bool IsEnumType (Type t)
+ {
+ if (t.IsSubclassOf (TypeManager.enum_type))
+ return true;
+ else
+ return false;
+ }
+
+ public static bool IsInterfaceType (Type t)
+ {
+ Interface iface = (Interface) builder_to_interface [t];
+
+ if (iface != null)
+ return true;
+ else
+ return false;
+ }
+
+ /// <summary>
+ /// Returns the User Defined Types
+ /// </summary>
+ public static ArrayList UserTypes {
+ get {
+ return user_types;
+ }
+ }
+
+ public static Hashtable TypeContainers {
+ get {
+ return typecontainers;
+ }
+ }
+
+ static Hashtable builder_to_constant;
+
+ public static void RegisterConstant (FieldBuilder fb, Const c)
+ {
+ if (builder_to_constant == null)
+ builder_to_constant = new PtrHashtable ();
+
+ if (builder_to_constant.Contains (fb))
+ return;
+
+ builder_to_constant.Add (fb, c);
+ }
+
+ public static Const LookupConstant (FieldBuilder fb)
+ {
+ if (builder_to_constant == null)
+ return null;
+
+ return (Const) builder_to_constant [fb];
+ }
+
+ /// <summary>
+ /// Gigantic work around for missing features in System.Reflection.Emit follows.
+ /// </summary>
+ ///
+ /// <remarks>
+ /// Since System.Reflection.Emit can not return MethodBase.GetParameters
+ /// for anything which is dynamic, and we need this in a number of places,
+ /// we register this information here, and use it afterwards.
+ /// </remarks>
+ static public bool RegisterMethod (MethodBase mb, InternalParameters ip, Type [] args)
+ {
+ if (args == null)
+ args = NoTypes;
+
+ method_arguments.Add (mb, args);
+ method_internal_params.Add (mb, ip);
+
+ return true;
+ }
+
+ static public InternalParameters LookupParametersByBuilder (MethodBase mb)
+ {
+ if (! (mb is ConstructorBuilder || mb is MethodBuilder))
+ return null;
+
+ if (method_internal_params.Contains (mb))
+ return (InternalParameters) method_internal_params [mb];
+ else
+ throw new Exception ("Argument for Method not registered" + mb);
+ }
+
+ /// <summary>
+ /// Returns the argument types for a method based on its methodbase
+ ///
+ /// For dynamic methods, we use the compiler provided types, for
+ /// methods from existing assemblies we load them from GetParameters,
+ /// and insert them into the cache
+ /// </summary>
+ static public Type [] GetArgumentTypes (MethodBase mb)
+ {
+ if (method_arguments.Contains (mb))
+ return (Type []) method_arguments [mb];
+ else {
+ ParameterInfo [] pi = mb.GetParameters ();
+ int c = pi.Length;
+ Type [] types = new Type [c];
+
+ for (int i = 0; i < c; i++)
+ types [i] = pi [i].ParameterType;
+
+ method_arguments.Add (mb, types);
+ return types;
+ }
+ }
+
+ // <remarks>
+ // This is a workaround the fact that GetValue is not
+ // supported for dynamic types
+ // </remarks>
+ static Hashtable fields = new Hashtable ();
+ static public bool RegisterFieldValue (FieldBuilder fb, object value)
+ {
+ if (fields.Contains (fb))
+ return false;
+
+ fields.Add (fb, value);
+
+ return true;
+ }
+
+ static public object GetValue (FieldBuilder fb)
+ {
+ return fields [fb];
+ }
+
+ static Hashtable fieldbuilders_to_fields = new Hashtable ();
+ static public bool RegisterField (FieldBuilder fb, Field f)
+ {
+ if (fieldbuilders_to_fields.Contains (fb))
+ return false;
+
+ fieldbuilders_to_fields.Add (fb, f);
+ return true;
+ }
+
+ static public Field GetField (FieldInfo fb)
+ {
+ return (Field) fieldbuilders_to_fields [fb];
+ }
+
+ static Hashtable events;
+
+ static public bool RegisterEvent (MyEventBuilder eb, MethodBase add, MethodBase remove)
+ {
+ if (events == null)
+ events = new Hashtable ();
+
+ if (events.Contains (eb))
+ return false;
+
+ events.Add (eb, new Pair (add, remove));
+
+ return true;
+ }
+
+ static public MethodInfo GetAddMethod (EventInfo ei)
+ {
+ if (ei is MyEventBuilder) {
+ Pair pair = (Pair) events [ei];
+
+ return (MethodInfo) pair.First;
+ } else
+ return ei.GetAddMethod ();
+ }
+
+ static public MethodInfo GetRemoveMethod (EventInfo ei)
+ {
+ if (ei is MyEventBuilder) {
+ Pair pair = (Pair) events [ei];
+
+ return (MethodInfo) pair.Second;
+ } else
+ return ei.GetAddMethod ();
+ }
+
+ static Hashtable properties;
+
+ static public bool RegisterProperty (PropertyBuilder pb, MethodBase get, MethodBase set)
+ {
+ if (properties == null)
+ properties = new Hashtable ();
+
+ if (properties.Contains (pb))
+ return false;
+
+ properties.Add (pb, new Pair (get, set));
+
+ return true;
+ }
+
+ //
+ // FIXME: we need to return the accessors depending on whether
+ // they are visible or not.
+ //
+ static public MethodInfo [] GetAccessors (PropertyInfo pi)
+ {
+ MethodInfo [] ret;
+
+ if (pi is PropertyBuilder){
+ Pair pair = (Pair) properties [pi];
+
+ ret = new MethodInfo [2];
+ ret [0] = (MethodInfo) pair.First;
+ ret [1] = (MethodInfo) pair.Second;
+
+ return ret;
+ } else {
+ MethodInfo [] mi = new MethodInfo [2];
+
+ //
+ // Why this and not pi.GetAccessors?
+ // Because sometimes index 0 is the getter
+ // sometimes it is 1
+ //
+ mi [0] = pi.GetGetMethod (true);
+ mi [1] = pi.GetSetMethod (true);
+
+ return mi;
+ }
+ }
+
+ static public MethodInfo GetPropertyGetter (PropertyInfo pi)
+ {
+ if (pi is PropertyBuilder){
+ Pair de = (Pair) properties [pi];
+
+ return (MethodInfo) de.Second;
+ } else
+ return pi.GetSetMethod ();
+ }
+
+ static public MethodInfo GetPropertySetter (PropertyInfo pi)
+ {
+ if (pi is PropertyBuilder){
+ Pair de = (Pair) properties [pi];
+
+ return (MethodInfo) de.First;
+ } else
+ return pi.GetGetMethod ();
+ }
+
+ /// <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.
+ /// </remarks>
+ public static bool ImplementsInterface (Type t, Type iface)
+ {
+ Type [] interfaces;
+
+ //
+ // FIXME OPTIMIZATION:
+ // as soon as we hit a non-TypeBuiler in the interface
+ // chain, we could return, as the `Type.GetInterfaces'
+ // will return all the interfaces implement by the type
+ // or its parents.
+ //
+ do {
+ interfaces = t.GetInterfaces ();
+
+ for (int i = interfaces.Length; i > 0; ){
+ i--;
+ if (interfaces [i] == iface)
+ return true;
+ }
+ t = t.BaseType;
+ } while (t != null);
+
+ return false;
+ }
+
+ //
+ // This is needed, because enumerations from assemblies
+ // do not report their underlyingtype, but they report
+ // themselves
+ //
+ public static Type EnumToUnderlying (Type t)
+ {
+ t = t.UnderlyingSystemType;
+ if (!TypeManager.IsEnumType (t))
+ return t;
+
+ TypeCode tc = Type.GetTypeCode (t);
+
+ switch (tc){
+ case TypeCode.Boolean:
+ return TypeManager.bool_type;
+ case TypeCode.Byte:
+ return TypeManager.byte_type;
+ case TypeCode.SByte:
+ return TypeManager.sbyte_type;
+ case TypeCode.Char:
+ return TypeManager.char_type;
+ case TypeCode.Int16:
+ return TypeManager.short_type;
+ case TypeCode.UInt16:
+ return TypeManager.ushort_type;
+ case TypeCode.Int32:
+ return TypeManager.int32_type;
+ case TypeCode.UInt32:
+ return TypeManager.uint32_type;
+ case TypeCode.Int64:
+ return TypeManager.int64_type;
+ case TypeCode.UInt64:
+ return TypeManager.uint64_type;
+ }
+ throw new Exception ("Unhandled typecode in enum" + tc);
+ }
+
+ /// <summary>
+ /// Utility function that can be used to probe whether a type
+ /// is managed or not.
+ /// </summary>
+ public static bool VerifyUnManaged (Type t, Location loc)
+ {
+ if (t.IsValueType){
+ //
+ // FIXME: this is more complex, we actually need to
+ // make sure that the type does not contain any
+ // classes itself
+ //
+ return true;
+ }
+
+ Report.Error (
+ 208, loc,
+ "Cannot take the address or size of a variable of a managed type ('" +
+ CSharpName (t) + "')");
+ return false;
+ }
+
+ /// <summary>
+ /// 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
+ /// using the DefaultMemberAttribute in the class.
+ ///
+ /// For example, the String class indexer is named `Chars' not `Item'
+ /// </remarks>
+ public static string IndexerPropertyName (Type t)
+ {
+
+ if (t is TypeBuilder) {
+ TypeContainer tc = (TypeContainer) builder_to_container [t];
+
+ Attributes attrs = tc.OptAttributes;
+
+ if (attrs == null || attrs.AttributeSections == null)
+ return "Item";
+
+ foreach (AttributeSection asec in attrs.AttributeSections) {
+
+ if (asec.Attributes == null)
+ continue;
+
+ foreach (Attribute a in asec.Attributes) {
+ if (a.Name.IndexOf ("DefaultMember") != -1) {
+ ArrayList pos_args = (ArrayList) a.Arguments [0];
+ Expression e = ((Argument) pos_args [0]).expr;
+
+ if (e is StringConstant)
+ return ((StringConstant) e).Value;
+ }
+ }
+ }
+
+ return "Item";
+ }
+
+ System.Attribute attr = System.Attribute.GetCustomAttribute (t, TypeManager.default_member_type);
+
+ if (attr != null)
+ {
+ DefaultMemberAttribute dma = (DefaultMemberAttribute) attr;
+
+ return dma.MemberName;
+ }
+
+ return "Item";
+ }
+
+ public static void MakePinned (LocalBuilder builder)
+ {
+ //
+ // FIXME: Flag the "LocalBuilder" type as being
+ // pinned. Figure out API.
+ //
+ }
+}
+
+}
diff --git a/mcs/nant/.cvsignore b/mcs/nant/.cvsignore
new file mode 100755
index 00000000000..6e95567187d
--- /dev/null
+++ b/mcs/nant/.cvsignore
@@ -0,0 +1,2 @@
+NAnt.exe
+nant.exe
diff --git a/mcs/nant/ChangeLog b/mcs/nant/ChangeLog
new file mode 100644
index 00000000000..45dfa4c6a37
--- /dev/null
+++ b/mcs/nant/ChangeLog
@@ -0,0 +1,11 @@
+2002-03-17 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: Do not remove the NAnt.exe on a 'make clean'. This would
+ prevent other cleans from happening that need nant.
+
+2002/03/15 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: Compile a version of NAnt with Mono's libs. It only does
+ this if you 'make NAnt_mono.exe'. Of course, right now the resulting
+ exe probably is not going to work yet becuase of the immature class
+ libs.
diff --git a/mcs/nant/README-nant.txt b/mcs/nant/README-nant.txt
new file mode 100755
index 00000000000..66c04bef116
--- /dev/null
+++ b/mcs/nant/README-nant.txt
@@ -0,0 +1,62 @@
+NAnt
+
+What is it?
+-----------
+NAnt is a .NET based build tool. In theory it is kind of like make without
+make's wrinkles. In practice it's a lot like Ant.
+
+If you are not familiar with Jakarta Ant you can get more information at the
+Jakarta project web site.
+http://jakarta.apache.org/
+
+
+Why NAnt?
+---------
+Because Ant was too Java specific.
+Because Ant needed the Java runtime. NAnt only needs the .NET runtime.
+
+
+The Latest Version
+------------------
+Details of the latest version can be found on the NAnt project web site
+http://nant.sourceforge.net/
+
+
+Documentation
+-------------
+Documentation is available in HTML format, in the doc/ directory.
+
+
+License
+-------
+Copyright (C) 2001 Gerry Shaw
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+In addition, as a special exception, Gerry Shaw gives permission to link the
+code of this program with the Microsoft .NET library (or with modified versions
+of Microsoft .NET library that use the same license as the Microsoft .NET
+library), and distribute linked combinations including the two. You must obey
+the GNU General Public License in all respects for all of the code used other
+than the Microsoft .NET library. If you modify this file, you may extend this
+exception to your version of the file, but you are not obligated to do so. If
+you do not wish to do so, delete this exception statement from your version.
+
+A copy of the GNU General Public License is available in the COPYING.txt file
+included with all NAnt distributions.
+
+For more licensing information refer to the GNU General Public License on the
+GNU Project web site.
+http://www.gnu.org/copyleft/gpl.html
diff --git a/mcs/nant/doc/arrow.gif b/mcs/nant/doc/arrow.gif
new file mode 100755
index 00000000000..d5e5f8e771d
--- /dev/null
+++ b/mcs/nant/doc/arrow.gif
Binary files differ
diff --git a/mcs/nant/doc/authors.html b/mcs/nant/doc/authors.html
new file mode 100755
index 00000000000..3b8ce57e47b
--- /dev/null
+++ b/mcs/nant/doc/authors.html
@@ -0,0 +1,43 @@
+<html>
+
+<head>
+ <meta http-equiv="Content-Language" content="en-ca">
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ <title>NAnt Authors</title>
+</head>
+
+<body>
+ <table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
+ <tr><td class="NavBar-Cell" width="100%"><a title="NAnt home page" href="index.html"><b>NAnt</b></a> <img src="arrow.gif" alt="->"/> Authors</td></tr>
+ </table>
+
+ <h1><span class="N">N</span><span class="Ant">Ant</span> Authors</h1>
+
+ <h3>Lead Developer</h3>
+ <ul>
+ <li>Gerry Shaw (gerry_shaw@yahoo.com)</li>
+ </ul>
+
+ <h3>Developers</h3>
+ <ul>
+ <li>Ian MacLean (ian_maclean@another.com)</li>
+ </ul>
+
+ <h3>Code Contributions (sorted by name)</h3>
+ <ul>
+ <li>Mike Krueger (mike@icsharpcode.net)</li>
+ <li>Sergey Chaban (serge@wildwestsoftware.com)</li>
+ </ul>
+
+ <h3><a></a>Special Thanks To</h3>
+ <ul>
+ <li>The <a href="http://jakarta.apache.org/ant/">Ant</a> team on the Jakarta project.</li>
+ <li><a href="http://www.hazware.com/">Hazware</a> for the original XBuild source.</li>
+ <li><a href="http://nunit.sourceforge.net/">Philip Craig</a> for NUnit.</li>
+ <li><a href="http://msdn.microsoft.com/net/">Microsoft</a> for making .NET and C#.</li>
+ <li>Ximian for working on the <a href="http://www.go-mono.com">Mono</a> project ot make .NET a true open standard.</li>
+ </ul>
+</body>
+
+</html>
diff --git a/mcs/nant/doc/changelog.html b/mcs/nant/doc/changelog.html
new file mode 100755
index 00000000000..a5f3ac7e182
--- /dev/null
+++ b/mcs/nant/doc/changelog.html
@@ -0,0 +1,121 @@
+<html>
+
+<head>
+ <meta http-equiv="Content-Language" content="en-ca">
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ <title>NAnt Change Log</title>
+</head>
+
+<body>
+ <table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
+ <tr><td class="NavBar-Cell" width="100%"><a title="NAnt home page" href="index.html"><b>NAnt</b></a> <img src="arrow.gif" alt="->"/> Change Log</td></tr>
+ </table>
+
+ <h1><span class="N">N</span><span class="Ant">Ant</span> Change Log</h1>
+
+ <h3>0.6.0 September 18, 2001</h3>
+ <ul>
+ <li>report build file xml errors in a useful way</li>
+ <li>report error location when tasks are missing required attributes</li>
+ <li>copy task updated - thanks to Ian MacLean</li>
+ <li>**/*.cs type pattern matching now available in file sets via DirectoryScanner class</li>
+ <li>Ian MacLean added as a project developer</li>
+ <li>added all the environment variables to properites, ie, &lt;echo message="path=${nant.env.PATH}"/&gt;</li>
+ <li>move task updated - thanks to Ian MacLean</li>
+ <li>sleep task added - thanks to Ian MacLean</li>
+ <li>DirectoryScanner and FileSet's scan for files AND directories now</li>
+ <li>FileSet's cache scan results, use Scan() to rescan</li>
+ <li>FileSet's auto initialize to their containing Task, this helps clean up the code</li>
+ <li>copy task can now copy full directory trees</li>
+ <li>added verbose attribute to copy task, default off, message gives number of files processed</li>
+ <li>fixed bug with any ExternalBase tasks hanging - thanks to Sergey Chaban for reporting</li>
+ <li>include task added</li>
+ <li>call task added</li>
+ <li>-verbose command line option added</li>
+ <li>build file can now build complete distribution, try 'nant dist'</li>
+ </ul>
+
+ <h3>0.5.0 August 22, 2001</h3>
+ <ul>
+ <li>complete overhaul of the web site and doc folder (all html files)</li>
+ <li>made src a parent folder to be able to hold multiple assemblies in anticipation of the NAnt.Tests.dll assembly</li>
+ <li>licensed changed to GNU General Public License</li>
+ <li>source code placed under CVS</li>
+ <li>tasks can now have attributes in base classes, see CompilerBase as an example - thanks to Mike Krueger</li>
+ <li>coding conventions posted on SourceForge in the document manager</li>
+ <li>task manager in SourceForge is now being used to track currently active tasks</li>
+ <li>namespace changed to SourceForge.NAnt</li>
+ <li>added basic command line parsing</li>
+ <li>added version resource</li>
+ <li>support for multiple build targets (try 'nant clean test')</li>
+ <li>BuildException added to report text position in the build file where errors occur - thanks to Ian MacLean</li>
+ <li>style task (xslt processing) added - thanks to Serge</li>
+ <li>executable is now signed with the NAnt.key</li>
+ <li>converted all public/protected fields to properties</li>
+ <li>added support for user define properties</li>
+ <li>added -set option (try 'nant -set:debug=true clean build')</li>
+ <li>changed verions number to 0.5 to reflect the number of changes in the code base</li>
+ </ul>
+
+ <h3>0.1.5 July 22, 2001</h3>
+ <ul>
+ <li>only compiles program if source file last write time > output last write time</li>
+ <li>refactored compiler code into common CompilerBase class</li>
+ <li>refactored compiler and exec task into common ExternalProgramBase class</li>
+ <li>added &lt;arg value="/win32res:filename"/&gt; element to all external program tasks</li>
+ <li>added Int32ValidatorAttribute and BooleanValidatorAttribute classes to perform error checking on task attributes after macro expansion but before task execution. Search for BooleanValidator or Int32Validator in Tasks for examples.</li>
+ <li>changed Task attribute names to TaskAttributeAttribute and FileSetAttribute</li>
+ <li>removed default value for task attributes (set with initial value)</li>
+ <li>changes to Project class on how to initialize a project and run it</li>
+ <li>right aligned task prefixes to clean up output</li>
+ <li>added or enhanced these tasks
+ <ul>
+ <li>vbc, jsc, csc</li>
+ <li>move</li>
+ <li>nant</li>
+ <li>taskdef</li>
+ <li>tstamp</li>
+ <li>exec (failonerror attribute)</li>
+ </ul>
+ </li>
+ </ul>
+
+ <h3>0.1.4 July 19, 2001</h3>
+ <ul>
+ <li>added or enhanced these tasks
+ <ul>
+ <li>echo</li>
+ <li>fail</li>
+ <li>property</li>
+ <li>copy (respects basedir)</li>
+ <li>delete (respects basedir)</li>
+ <li>mkdir (respects basedir)</li>
+ <li>exec</li>
+ </ul>
+ </li>
+ </ul>
+
+ <h3>0.1.3 July 18, 2001</h3>
+ <ul>
+ <li>dependices working via depends attribute on targets</li>
+ <li>changed name from NBuild to NAnt</li>
+ <li>using the name "Parameter" to refer to the xml attributes in tasks because it was conflicting badly with .NET Attributes</li>
+ <li>added FileSetParameterAttribute so that fileset parameters would autoinit</li>
+ <li>renamed TaskAttributeAttribute to StringParameterAttribute</li>
+ <li>broke into seperate source files (one per class)</li>
+ <li>changed default build file from Project.xml to the first file with a .build extension</li>
+ </ul>
+
+ <h3>0.1.2 July 16, 2001</h3>
+ <ul>
+ <li>basic functionality to have NAnt build itself (csc task)</li>
+ </ul>
+
+ <h3>0.1.1 July 5, 2001</h3>
+ <ul>
+ <li>initial test version</li>
+ </ul>
+</body>
+
+</html>
diff --git a/mcs/nant/doc/index.html b/mcs/nant/doc/index.html
new file mode 100755
index 00000000000..635c2ca1233
--- /dev/null
+++ b/mcs/nant/doc/index.html
@@ -0,0 +1,43 @@
+<html>
+
+<head>
+ <meta http-equiv="Content-Language" content="en-ca">
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ <title>NAnt - A .NET Build Tool</title>
+</head>
+
+<body>
+ <table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
+ <tr><td class="NavBar-Cell" width="100%"><b>NAnt</b> : A .NET Build Tool</td></tr>
+ </table>
+
+ <h1><span class="N">N</span><span class="Ant">Ant</span> Home Page</h1>
+
+ <p>September 18, 2001 Gerry Shaw -- <a title="Send email to Gerry Shaw" href="mailto:gerry_shaw@yahoo.com">gerry_shaw@yahoo.com</a></p>
+ <p>NAnt is a .NET based build tool. In theory it is kind of like make without make's wrinkles. In practice it's a lot like <a title="Ant home page" href="http://jakarta.apache.org/ant/">Ant</a>. NAnt has only been tested with Beta 2 .NET SDK, build 2914.</p>
+ <p>The idea for NAnt came from <a title="Hazware home page" href="http://www.hazware.com/xbHome.htm"> Hazware's XBuild</a> project. After emailing the author for a beta 2 version of the tool and getting no response I decided to port the code to .NET beta 2. Due to the number of changes from .NET beta 1 to beta 2 the result was a total rewrite.</p>
+ <ul>
+ <li><a title="NAnt files page on SourceForge" href="http://sourceforge.net/project/showfiles.php?group_id=31650"><b>Download latest version</b></a> from SourceForge</li>
+ <li><a title="NAnt web site on SourceForge" href="http://nant.sourceforge.net">Home page</a> on SourceForge</li>
+ <li><a title="NAnt project summary on SourceForge" href="http://sourceforge.net/projects/nant/">Project summary</a> on SourceForge</li>
+ <li><a title="Version history of NAnt" href="changelog.html">Changes</a></li>
+ <li><a title="Tasks still being worked on" href="todo.html">To do</a></li>
+ <li><a title="Project credits" href="authors.html">Authors</a></li>
+ <li><a title="Software license agreement" href="license.html">License</a></li>
+ </ul>
+
+ <h2>Getting Started</h2>
+ <p>Since the software is still in heavy development you are going to be on your own. You can see NAnt build itself by doing the following:</p>
+ <ol>
+ <li>Download the latest released version.</li>
+ <li>Unzip the distribution into a new folder.</li>
+ <li>Using a command prompt (so you can see the build output) cd into the
+ folder where NAnt was unzipped.</li>
+ <li>Type <code>bin\nant</code> at the command prompt to build NAnt.</li>
+ </ol>
+
+ <p><a href="http://sourceforge.net"><img valign="middle" src="http://sourceforge.net/sflogo.php?group_id=31650" width="88" height="31" border="0" alt="SourceForge logo (link to home page)"></a></p>
+</body>
+
+</html>
diff --git a/mcs/nant/doc/license.html b/mcs/nant/doc/license.html
new file mode 100755
index 00000000000..86d993bb13d
--- /dev/null
+++ b/mcs/nant/doc/license.html
@@ -0,0 +1,48 @@
+<html>
+
+<head>
+ <meta http-equiv="Content-Language" content="en-ca">
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ <title>NAnt License</title>
+</head>
+
+<body>
+ <table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
+ <tr><td class="NavBar-Cell" width="100%"><a title="NAnt home page" href="index.html"><b>NAnt</b></a> <img src="arrow.gif" alt="->"/> License</td></tr>
+ </table>
+
+ <h1><span class="N">N</span><span class="Ant">Ant</span> License</h1>
+ <p>Copyright &copy 2001 Gerry Shaw</p>
+ <p>
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ </p>
+ <p>
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ </p>
+ <p>
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ </p>
+ <p>
+ <b>In addition, as a special exception</b>, Gerry Shaw gives permission to link the
+ code of this program with the Microsoft .NET library (or with modified versions
+ of Microsoft .NET library that use the same license as the Microsoft .NET
+ library), and distribute linked combinations including the two. You must obey
+ the GNU General Public License in all respects for all of the code used other
+ than the Microsoft .NET library. If you modify this file, you may extend this
+ exception to your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from your version.
+ </p>
+ <p>A copy of the GNU General Public License is available in the COPYING.txt file included with all NAnt distributions.</p>
+ <p>The <a title="GNU home page" href="http://www.gnu.org/">GNU Project</a> has more information on the <a title="Full text of the GNU Public License" href="http://www.gnu.org/copyleft/gpl.html">GNU General Public License</a>.</p>
+</body>
+
+</html>
diff --git a/mcs/nant/doc/style.css b/mcs/nant/doc/style.css
new file mode 100755
index 00000000000..32613372a4c
--- /dev/null
+++ b/mcs/nant/doc/style.css
@@ -0,0 +1,71 @@
+body {
+ font-family: Georgia, "Times New Roman", Times, "New York", serif;
+ background: white;
+ color: black
+}
+
+h1, h2, h3, h4, h5, h6 {
+ font-family: Verdana, Arial, Helvetica, Geneva, SunSans-Regular, sans-serif
+}
+
+h1.LinkHeader, h2.LinkHeader, h3.LinkHeader { margin-bottom: -18 }
+
+h4 {
+ margin-bottom: 0.5em
+}
+
+h5 {
+ margin-bottom: -.8em;
+}
+
+
+hr {
+ color: gray
+}
+
+input {
+ font-family: Verdana, Arial, Helvetica, Geneva, SunSans-Regular, sans-serif;
+}
+
+a:link { color: #0000cc; }
+a:visited { color: purple }
+a:active { color: #cc0000 }
+a:hover { color: #cc0000; }
+
+/*
+
+Because HTML 4.0 strict does not include the border attribute for images we turn it off with a style
+but this totally messes up Navigator 4.7 so we can't use it.
+
+a:link img, a:visited img, a:active img {
+ border: none
+}
+*/
+
+/* have list items flush left against lists in a side bar use this style */
+ul.FlushLeft {
+ margin-left: 1.25em;
+ list-style-position: outside
+}
+
+.NavBar {
+ background-color: #dfff80;
+ border-color: #999966;
+ border-style: none none solid none;
+ border-width: 2px;
+}
+
+.NavBar-Cell {
+ font-family: Verdana, Arial, Helvetica, Geneva, SunSans-Regular, sans-serif;
+ font-size: 79%;
+}
+
+.SideBar {
+ font-size: 80%;
+ font-family: Verdana, Arial, Helvetica, Geneva, SunSans-Regular, sans-serif;
+ padding: 8px;
+}
+
+/* color scheme */
+.N { color: #99cc00; }
+.Ant { color: #ff9900; }
diff --git a/mcs/nant/doc/todo.html b/mcs/nant/doc/todo.html
new file mode 100755
index 00000000000..20cd3ba16ac
--- /dev/null
+++ b/mcs/nant/doc/todo.html
@@ -0,0 +1,55 @@
+<html>
+
+<head>
+ <meta http-equiv="Content-Language" content="en-ca">
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ <title>NAnt To Do</title>
+</head>
+
+<body>
+ <table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
+ <tr><td class="NavBar-Cell" width="100%"><a title="NAnt home page" href="index.html"><b>NAnt</b></a> <img src="arrow.gif" alt="->" width="13" height="9"/> To Do</td></tr>
+ </table>
+
+ <h1><span class="N">N</span><span class="Ant">Ant</span> To Do</h1>
+ <p>The following is a rough guide to what features are being worked on and when they will be worked on in the future.</p>
+ <p>For a list of what is actively being worked refer to the <a title="SourceForge task manager for NAnt" href="https://sourceforge.net/pm/?group_id=31650">NAnt Task Manager</a> on SourceForge.</p>
+
+ <h3>0.7</h3>
+ <ul>
+ <li>command line parsing using clippy (another tool I'm working on that will be posted soon)</li>
+ <li>clippy task (for command line parsing)</li>
+ <li>nunit tests</li>
+ <li>nunit task</li>
+ <li>validate build file for valid xml and against a schema before starting build</li>
+ <li>code xml docs for all non private members</li>
+ <li>developer docs (code conventions, high level design)</li>
+ <li>post newsgroup announcment</li>
+ <li>request code review and project help</li>
+ </ul>
+
+ <h3>0.8</h3>
+ <ul>
+ <li>task documentation for users</li>
+ <li>zip task</li>
+ <li>ftp task</li>
+ <li>standard input support for tasks that require input (ie, passwords when copying files via scp to SourceForge)</li>
+ </ul>
+
+ <h3>1.0</h3>
+ <ul>
+ <li>official release</li>
+ <li>general cleanup</li>
+ <li>xml documentation</li>
+ <li>user documentation</li>
+ <li>post newsgroup announcment</li>
+ </ul>
+
+ <h3>1.1</h3>
+ <ul>
+ <li>additional optional but useful tasks (sql, touch, email, grep)</li>
+ </ul>
+</body>
+
+</html> \ No newline at end of file
diff --git a/mcs/nant/makefile b/mcs/nant/makefile
new file mode 100755
index 00000000000..66f2bb291e4
--- /dev/null
+++ b/mcs/nant/makefile
@@ -0,0 +1,15 @@
+all: nant.exe
+linux: nant.exe
+windows: nant.exe
+
+nant.exe: NAnt.exe
+ -cp NAnt.exe nant.exe
+
+NAnt.exe: makefile
+ csc /out:NAnt.exe /recurse:*.cs
+
+NAnt_mono.exe: makefile
+ csc /out:NAnt_mono.exe /nostdlib /noconfig /recurse:*.cs /lib:../class/lib /r:corlib.dll /r:System.Xml.dll /r:System.dll /nowarn:1595
+
+clean:
+ rm -f NAnt_mono.exe \ No newline at end of file
diff --git a/mcs/nant/readme.txt b/mcs/nant/readme.txt
new file mode 100755
index 00000000000..816b000c2e5
--- /dev/null
+++ b/mcs/nant/readme.txt
@@ -0,0 +1,4 @@
+This is an import of the Nant sources version 0.6.0 into the
+tree. We are doing this because the binaries were not compatible
+across versions of .NET.
+
diff --git a/mcs/nant/src/AssemblyInfo.cs b/mcs/nant/src/AssemblyInfo.cs
new file mode 100755
index 00000000000..1bd25d5d050
--- /dev/null
+++ b/mcs/nant/src/AssemblyInfo.cs
@@ -0,0 +1,37 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle("NAnt")]
+[assembly: AssemblyDescription("A .NET Build Tool")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("http://nant.sourceforge.net/")]
+[assembly: AssemblyProduct("NAnt")]
+[assembly: AssemblyCopyright("Copyright (C) 2001 Gerry Shaw")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: AssemblyVersion("0.6.0.*")]
+
+// This will not compile with Visual Studio. If you want to build a signed
+// executable use the NAnt build file. To build under Visual Studio just
+// exclude this file from the build.
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/nant/src/AssemblyInfo.cs~ b/mcs/nant/src/AssemblyInfo.cs~
new file mode 100755
index 00000000000..a59c887180d
--- /dev/null
+++ b/mcs/nant/src/AssemblyInfo.cs~
@@ -0,0 +1,38 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle("NAnt")]
+[assembly: AssemblyDescription("A .NET Build Tool")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("http://nant.sourceforge.net/")]
+[assembly: AssemblyProduct("NAnt")]
+[assembly: AssemblyCopyright("Copyright (C) 2001 Gerry Shaw")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: AssemblyVersion("0.6.0.*")]
+
+// This will not compile with Visual Studio. If you want to build a signed
+// executable use the NAnt build file. To build under Visual Studio just
+// exclude this file from the build.
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile(@"..\NAnt.key")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/nant/src/Attributes/BooleanValidatorAttribute.cs b/mcs/nant/src/Attributes/BooleanValidatorAttribute.cs
new file mode 100755
index 00000000000..932b027d44d
--- /dev/null
+++ b/mcs/nant/src/Attributes/BooleanValidatorAttribute.cs
@@ -0,0 +1,42 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Reflection;
+
+ /// <summary>Indicates that field should be able to be converted into a Boolean.</summary>
+ [AttributeUsage(AttributeTargets.Field, Inherited=true)]
+ public class BooleanValidatorAttribute : ValidatorAttribute {
+
+ public BooleanValidatorAttribute() {
+ }
+
+ public override string Validate(object value) {
+ string errorMessage = null;
+ try {
+ Convert.ToBoolean(value);
+ } catch (Exception) {
+ errorMessage = String.Format("Cannot resolve to '{0}' to Boolean value.", value.ToString());
+ }
+ return errorMessage;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Attributes/Int32ValidatorAttribute.cs b/mcs/nant/src/Attributes/Int32ValidatorAttribute.cs
new file mode 100755
index 00000000000..51d967d7520
--- /dev/null
+++ b/mcs/nant/src/Attributes/Int32ValidatorAttribute.cs
@@ -0,0 +1,63 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Reflection;
+
+ /// <summary>Indicates that field should be able to be converted into a Int32 within the given range.</summary>
+ [AttributeUsage(AttributeTargets.Field, Inherited=true)]
+ public class Int32ValidatorAttribute : ValidatorAttribute {
+
+ int _minValue = Int32.MinValue;
+ int _maxValue = Int32.MaxValue;
+
+ public Int32ValidatorAttribute() {
+ }
+
+ public Int32ValidatorAttribute(int minValue, int maxValue) {
+ MinValue = minValue;
+ MaxValue = maxValue;
+ }
+
+ public int MinValue {
+ get { return _minValue; }
+ set { _minValue = value; }
+ }
+
+ public int MaxValue {
+ get { return _maxValue; }
+ set { _maxValue = value; }
+ }
+
+ public override string Validate(object value) {
+ string errorMessage = null;
+ try {
+ Int32 intValue = Convert.ToInt32(value);
+ if (intValue < MinValue || intValue > MaxValue) {
+ errorMessage = String.Format("Cannot resolve '{0}' to integer between '{1}' and '{2}'.", value.ToString(), MinValue, MaxValue);
+ }
+ } catch (Exception) {
+ errorMessage = String.Format("Cannot resolve '{0}' to integer value.", value.ToString());
+ }
+ return errorMessage;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Attributes/TaskAttributeAttribute.cs b/mcs/nant/src/Attributes/TaskAttributeAttribute.cs
new file mode 100755
index 00000000000..060e25c3a31
--- /dev/null
+++ b/mcs/nant/src/Attributes/TaskAttributeAttribute.cs
@@ -0,0 +1,78 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Reflection;
+
+ /// <summary>Indicates that field should be treated as a xml attribute for the task.</summary>
+ /// <example>
+ /// Examples of how to specify task attributes
+ /// <code>
+ /// // task XmlType default is string
+ /// [TaskAttribute("out", Required=true)]
+ /// string _out = null; // assign default value here
+ ///
+ /// [TaskAttribute("optimize")]
+ /// [BooleanValidator()]
+ /// // during ExecuteTask you can safely use Convert.ToBoolean(_optimize)
+ /// string _optimize = Boolean.FalseString;
+ ///
+ /// [TaskAttribute("warnlevel")]
+ /// [Int32Validator(0,4)] // limit values to 0-4
+ /// // during ExecuteTask you can safely use Convert.ToInt32(_optimize)
+ /// string _warnlevel = "0";
+ ///
+ /// [TaskFileSet("sources")]
+ /// FileSet _sources = new FileSet();
+ /// </code>
+ /// NOTE: Attribute values must be of type of string if you want
+ /// to be able to have macros. The field stores the exact value during
+ /// InitializeTask. Just before ExecuteTask is called NAnt will expand
+ /// all the macros with the current values.
+ [AttributeUsage(AttributeTargets.Field, Inherited=true)]
+ public class TaskAttributeAttribute : Attribute {
+
+ string _name;
+ bool _required;
+ bool _expandText;
+
+ public TaskAttributeAttribute(string name) {
+ Name = name;
+ Required = false;
+ ExpandText = true;
+ }
+
+ public string Name {
+ get { return _name; }
+ set { _name = value; }
+ }
+
+ public bool Required {
+ get { return _required; }
+ set { _required = value; }
+ }
+
+ public bool ExpandText {
+ get { return _expandText; }
+ set { _expandText = value; }
+ }
+ }
+}
diff --git a/mcs/nant/src/Attributes/TaskFileSetAttribute.cs b/mcs/nant/src/Attributes/TaskFileSetAttribute.cs
new file mode 100755
index 00000000000..607f59fc4c5
--- /dev/null
+++ b/mcs/nant/src/Attributes/TaskFileSetAttribute.cs
@@ -0,0 +1,40 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Reflection;
+
+ /// <summary>Indicates that field should be treated as a xml file set for the task.</summary>
+ [AttributeUsage(AttributeTargets.Field, Inherited=true)]
+ public class TaskFileSetAttribute : Attribute {
+
+ string _name;
+
+ public TaskFileSetAttribute(string name) {
+ Name = name;
+ }
+
+ public string Name {
+ get { return _name; }
+ set { _name = value; }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Attributes/TaskNameAttribute.cs b/mcs/nant/src/Attributes/TaskNameAttribute.cs
new file mode 100755
index 00000000000..bc7ffde1d2a
--- /dev/null
+++ b/mcs/nant/src/Attributes/TaskNameAttribute.cs
@@ -0,0 +1,45 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Reflection;
+
+ /// <summary>Indicates that class should be treated as a task.</summary>
+ /// <remarks>
+ /// Attach this attribute to a subclass of Task to have NAnt be able
+ /// to reconize it. The name should be short but must not confict
+ /// with any other task already in use.
+ /// </remarks>
+ [AttributeUsage(AttributeTargets.Class, Inherited=false, AllowMultiple=false)]
+ public class TaskNameAttribute : Attribute {
+
+ string _name;
+
+ public TaskNameAttribute(string name) {
+ _name = name;
+ }
+
+ public string Name {
+ get { return _name; }
+ set { _name = value; }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Attributes/ValidatorAttribute.cs b/mcs/nant/src/Attributes/ValidatorAttribute.cs
new file mode 100755
index 00000000000..053089cc497
--- /dev/null
+++ b/mcs/nant/src/Attributes/ValidatorAttribute.cs
@@ -0,0 +1,28 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Reflection;
+
+ public abstract class ValidatorAttribute : Attribute {
+ public abstract string Validate(object value);
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/BuildException.cs b/mcs/nant/src/BuildException.cs
new file mode 100755
index 00000000000..7940496d330
--- /dev/null
+++ b/mcs/nant/src/BuildException.cs
@@ -0,0 +1,85 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+// Ian MacLean (ian_maclean@another.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+
+ /// <summary>
+ /// Thrown whenever an error occurs during the build.
+ /// </summary>
+ public class BuildException : ApplicationException {
+
+ private Location _location = Location.UnknownLocation;
+
+ /// <summary>
+ /// Constructs a build exception with no descriptive information.
+ /// </summary>
+ public BuildException() : base() {
+ }
+
+ /// <summary>
+ /// Constructs an exception with a descriptive message.
+ /// </summary>
+ public BuildException(String message) : base(message) {
+ }
+
+ /// <summary>
+ /// Constructs an exception with a descriptive message and an
+ /// instance of the Exception that is the cause of the current Exception.
+ /// </summary>
+ public BuildException(String message, Exception e) : base(message, e) {
+ }
+
+ /// <summary>
+ /// Constructs an exception with a descriptive message and location
+ /// in the build file that caused the exception.
+ /// </summary>
+ /// <param name="location">Location in the build file where the exception occured.</param>
+ public BuildException(String message, Location location) : base(message) {
+ _location = location;
+ }
+
+ /// <summary>
+ /// Constructs an exception with the given descriptive message, the
+ /// location in the build file and an instance of the Exception that
+ /// is the cause of the current Exception.
+ /// </summary>
+ /// <param name="message">The error message that explains the reason for the exception.</param>
+ /// <param name="location">Location in the build file where the exception occured.</param>
+ /// <param name="e">An instance of Exception that is the cause of the current Exception.</param>
+ public BuildException(String message, Location location, Exception e) : base(message, e) {
+ _location = location;
+ }
+
+ public override string Message {
+ get {
+ string message = base.Message;
+
+ // only include location string if not empty
+ string locationString = _location.ToString();
+ if (locationString != String.Empty) {
+ message = locationString + " " + message;
+ }
+ return message;
+ }
+ }
+ }
+}
diff --git a/mcs/nant/src/DirectoryScanner.cs b/mcs/nant/src/DirectoryScanner.cs
new file mode 100755
index 00000000000..a2baa303d38
--- /dev/null
+++ b/mcs/nant/src/DirectoryScanner.cs
@@ -0,0 +1,226 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+/*
+Examples:
+"**\*.class" matches all .class files/dirs in a directory tree.
+
+"test\a??.java" matches all files/dirs which start with an 'a', then two
+more characters and then ".java", in a directory called test.
+
+"**" matches everything in a directory tree.
+
+"**\test\**\XYZ*" matches all files/dirs that start with "XYZ" and where
+there is a parent directory called test (e.g. "abc\test\def\ghi\XYZ123").
+
+Example of usage:
+
+DirectoryScanner scanner = DirectoryScanner();
+scanner.Includes.Add("**\\*.class");
+scanner.Exlucdes.Add("modules\\*\\**");
+scanner.BaseDirectory = "test";
+scanner.Scan();
+foreach (string filename in GetIncludedFiles()) {
+ Console.WriteLine(filename);
+}
+*/
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Collections.Specialized;
+ using System.IO;
+ using System.Text;
+ using System.Text.RegularExpressions;
+
+ public class DirectoryScanner {
+
+ string _baseDirectory = Environment.CurrentDirectory;
+
+ // holds the nant patterns
+ StringCollection _includes = new StringCollection();
+ StringCollection _excludes = new StringCollection();
+
+ // holds the nant patterns converted to regular expression patterns
+ StringCollection _includePatterns = null;
+ StringCollection _excludePatterns = null;
+
+ // holds the result from a scan
+ StringCollection _fileNames = null;
+ StringCollection _directoryNames = null;
+
+ public StringCollection Includes {
+ get { return _includes; }
+ }
+
+ public StringCollection Excludes {
+ get { return _excludes; }
+ }
+
+ public string BaseDirectory {
+ get { return _baseDirectory; }
+ set { _baseDirectory = value; }
+ }
+
+ public StringCollection FileNames {
+ get {
+ if (_fileNames == null) {
+ Scan();
+ }
+ return _fileNames;
+ }
+ }
+
+ public StringCollection DirectoryNames {
+ get {
+ if (_directoryNames == null) {
+ Scan();
+ }
+ return _directoryNames;
+ }
+ }
+
+ public void Scan() {
+ _includePatterns = new StringCollection();
+ foreach (string pattern in Includes) {
+ _includePatterns.Add(ToRegexPattern(pattern));
+ }
+
+ _excludePatterns = new StringCollection();
+ foreach (string pattern in Excludes) {
+ _excludePatterns.Add(ToRegexPattern(pattern));
+ }
+
+ _fileNames = new StringCollection();
+ _directoryNames = new StringCollection();
+
+ ScanDirectory(Path.GetFullPath(BaseDirectory));
+ }
+
+ void ScanDirectory(string path) {
+ // get info for the current directory
+ DirectoryInfo currentDirectoryInfo = new DirectoryInfo(path);
+
+ // scan subfolders
+ foreach (DirectoryInfo directoryInfo in currentDirectoryInfo.GetDirectories()) {
+ ScanDirectory(directoryInfo.FullName);
+ }
+
+ // scan files
+ foreach (FileInfo fileInfo in currentDirectoryInfo.GetFiles()) {
+ string filename = Path.Combine(path, fileInfo.Name);
+ if (IsPathIncluded(filename)) {
+ _fileNames.Add(filename);
+ }
+ }
+
+ // Check current path last so that delete task will correctly
+ // delete empty directories. This may *seem* like a special case
+ // but it is more like formalizing something in a way that makes
+ // writing the delete task easier :)
+ if (IsPathIncluded(path)) {
+ _directoryNames.Add(path);
+ }
+ }
+
+ bool IsPathIncluded(string path) {
+ bool included = false;
+
+ // check path against includes
+ foreach (string pattern in _includePatterns) {
+ Match m = Regex.Match(path, pattern);
+ if (m.Success) {
+ included = true;
+ break;
+ }
+ }
+
+ // check path against excludes
+ if (included) {
+ foreach (string pattern in _excludePatterns) {
+ Match m = Regex.Match(path, pattern);
+ if (m.Success) {
+ included = false;
+ break;
+ }
+ }
+ }
+
+ return included;
+ }
+
+ string ToRegexPattern(string nantPattern) {
+
+ StringBuilder pattern = new StringBuilder(nantPattern);
+
+ // NAnt patterns can use either / \ as a directory seperator.
+ // We must replace both of these characters with Path.DirectorySeperatorChar
+ pattern.Replace('/', Path.DirectorySeparatorChar);
+ pattern.Replace('\\', Path.DirectorySeparatorChar);
+
+ // Patterns MUST be full paths.
+ if (!Path.IsPathRooted(pattern.ToString())) {
+ pattern = new StringBuilder(Path.Combine(BaseDirectory, pattern.ToString()));
+ }
+
+ // The '\' character is a special character in regular expressions
+ // and must be escaped before doing anything else.
+ pattern.Replace(@"\", @"\\");
+
+ // Escape the rest of the regular expression special characters.
+ // NOTE: Characters other than . $ ^ { [ ( | ) * + ? \ match themselves.
+ // TODO: Decide if ] and } are missing from this list, the above
+ // list of characters was taking from the .NET SDK docs.
+ pattern.Replace(".", @"\.");
+ pattern.Replace("$", @"\$");
+ pattern.Replace("^", @"\^");
+ pattern.Replace("{", @"\{");
+ pattern.Replace("[", @"\[");
+ pattern.Replace("(", @"\(");
+ pattern.Replace(")", @"\)");
+ pattern.Replace("+", @"\+");
+
+ // Special case directory seperator string under Windows.
+ string seperator = Path.DirectorySeparatorChar.ToString();
+ if (seperator == @"\") {
+ seperator = @"\\";
+ }
+
+ // Convert NAnt pattern characters to regular expression patterns.
+
+ // SPECIAL CASE: to match subdirectory OR current directory. If
+ // we don't do this then we can write something like 'src/**/*.cs'
+ // to match all the files ending in .cs in the src directory OR
+ // subdirectories of src.
+ pattern.Replace(seperator + "**", "(" + seperator + ".|)|");
+
+ // | is a place holder for * to prevent it from being replaced in next line
+ pattern.Replace("**", ".|");
+ pattern.Replace("*", "[^" + seperator + "]*");
+ pattern.Replace("?", "[^" + seperator + "]?");
+ pattern.Replace('|', '*'); // replace place holder string
+
+ // Help speed up the search
+ pattern.Insert(0, '^'); // start of line
+ pattern.Append('$'); // end of line
+
+ return pattern.ToString();
+ }
+ }
+}
diff --git a/mcs/nant/src/FileSet.cs b/mcs/nant/src/FileSet.cs
new file mode 100755
index 00000000000..4e934fc82d2
--- /dev/null
+++ b/mcs/nant/src/FileSet.cs
@@ -0,0 +1,132 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Collections.Specialized;
+ using System.IO;
+
+ public class FileSet {
+
+ /// <summary>
+ /// Used to determine if a file has a more recent last write time then the specified write time.
+ /// </summary>
+ /// <param name="fileNames">A collection of filenames to check last write times against.</param>
+ /// <param name="targetLastWriteTime">The datetime to compare against.</param>
+ /// <returns><c>True</c> if at least one file in <c>fileNames</c> has a last write time greater than <c>targetLastWriteTime</c>.</returns>
+ public static bool MoreRecentLastWriteTime(StringCollection fileNames, DateTime targetLastWriteTime) {
+ foreach (string fileName in fileNames) {
+ FileInfo fileInfo = new FileInfo(fileName);
+ if (!fileInfo.Exists) {
+ return true;
+ }
+ if (fileInfo.LastWriteTime > targetLastWriteTime) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // We can't just use the DirectoryScanner's includes/excludes collections
+ // because when we do a Scan() we need to first expand any macros.
+
+ StringCollection _includes = new StringCollection();
+ StringCollection _excludes = new StringCollection();
+ DirectoryScanner _scanner = null;
+ string _baseDirectory;
+ bool _includeAllByDefault;
+ Task _task = null;
+
+ public FileSet(bool includeAllByDefault) {
+ IncludeAllByDefault = includeAllByDefault;
+ Excludes.Add("**/CVS/*");
+ Excludes.Add("**/.cvsignore");
+ }
+
+ /// <remarks>
+ /// Will be automagically set in Task.AutoInitializeAttributes() if
+ /// file set has TaskFileSetAttribute set on it.
+ /// </remarks>
+ // TODO: change this to IMacroExpander
+ public Task Task {
+ get { return _task; }
+ set { _task = value; }
+ }
+
+ public string BaseDirectory {
+ get { return _baseDirectory; }
+ set { _baseDirectory = value; }
+ }
+
+ /// <summary>Determines if scan should produce everything or nothing
+ /// if there are no Includes set. Default false.</summary>
+ public bool IncludeAllByDefault {
+ get { return _includeAllByDefault; }
+ set { _includeAllByDefault = value; }
+ }
+
+ public StringCollection Includes {
+ get { return _includes; }
+ }
+
+ public StringCollection Excludes {
+ get { return _excludes; }
+ }
+
+ public void Scan() {
+ // get project (only for expanding macros)
+ Project expander = Task.Project;
+
+ _scanner = new DirectoryScanner();
+ _scanner.BaseDirectory = expander.GetFullPath(BaseDirectory);;
+
+ foreach (string path in Includes) {
+ _scanner.Includes.Add(expander.ExpandText(path));
+ }
+ if (Includes.Count <= 0 && IncludeAllByDefault) {
+ _scanner.Includes.Add("**");
+ }
+
+ foreach (string path in Excludes) {
+ _scanner.Excludes.Add(expander.ExpandText(path));
+ }
+
+ _scanner.Scan();
+ }
+
+ public StringCollection DirectoryNames {
+ get {
+ if (_scanner == null) {
+ Scan();
+ }
+ return _scanner.DirectoryNames;
+ }
+ }
+
+ public StringCollection FileNames {
+ get {
+ if (_scanner == null) {
+ Scan();
+ }
+ return _scanner.FileNames;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Location.cs b/mcs/nant/src/Location.cs
new file mode 100755
index 00000000000..3a51279d371
--- /dev/null
+++ b/mcs/nant/src/Location.cs
@@ -0,0 +1,89 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Ian MacLean (ian_maclean@another.com)
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+ using System;
+ using System.IO;
+
+ /// <summary>
+ /// Stores the file name and line number in a file.
+ /// </summary>
+ public class Location {
+ string _fileName;
+ int _lineNumber;
+ int _columnNumber;
+
+ public static readonly Location UnknownLocation = new Location();
+
+ /// <summary>
+ /// Creates a location consisting of a file name and line number.
+ ///</summary>
+ public Location(string fileName, int lineNumber, int columnNumber) {
+ Uri uri = new Uri(fileName);
+ string strfileName = uri.LocalPath; // convert from URI syntax to local path
+ Init(strfileName, lineNumber, columnNumber);
+ }
+
+ /// <summary>
+ /// Creates a location consisting of a file name but no line number.
+ ///</summary>
+ public Location(string fileName) {
+ Init(fileName, 0, 0);
+ }
+
+ /// <summary>
+ /// Creates an "unknown" location.
+ ///</summary>
+ private Location() {
+ Init(null, 0, 0);
+ }
+
+ /// <summary>
+ /// Private Init function.
+ ///</summary>
+ private void Init(string fileName, int lineNumber, int columnNumber) {
+ _fileName = fileName;
+ _lineNumber = lineNumber;
+ _columnNumber = columnNumber;
+ }
+
+ /// <summary>
+ /// Returns the file name, line number and a trailing space. An error
+ /// message can be appended easily. For unknown locations, returns
+ /// an empty string.
+ ///</summary>
+ public override string ToString() {
+ string message = "";
+
+ if (_fileName != null) {
+ message += _fileName;
+
+ if (_lineNumber != 0) {
+ message += ":";
+ message += _lineNumber.ToString();
+ }
+
+ message += ":";
+ }
+
+ return message;
+ }
+ }
+}
diff --git a/mcs/nant/src/NAnt.cs b/mcs/nant/src/NAnt.cs
new file mode 100755
index 00000000000..7a192036f98
--- /dev/null
+++ b/mcs/nant/src/NAnt.cs
@@ -0,0 +1,107 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Diagnostics;
+ using System.IO;
+ using System.Text.RegularExpressions;
+
+ public class NAnt {
+ public static int Main(string[] args) {
+ int returnCode = 0;
+
+ Log.IndentSize = 12;
+
+ Project project = new Project();
+
+ const string buildfileOption = "-buildfile:";
+ const string basedirOption = "-basedir:";
+ const string setOption = "-set:";
+ const string helpOption = "-h"; // allow -h and -help
+ const string verboseOption = "-verbose";
+
+ bool showHelp = false;
+
+ foreach (string arg in args) {
+ if (arg.StartsWith(buildfileOption)) {
+ project.BuildFileName = arg.Substring(buildfileOption.Length);
+ } else if (arg.StartsWith(basedirOption)) {
+ project.BaseDirectory = arg.Substring(basedirOption.Length);
+ } else if (arg.StartsWith(basedirOption)) {
+ project.BaseDirectory = arg.Substring(basedirOption.Length);
+ } else if (arg.StartsWith(setOption)) {
+ // TODO: implement user defined properties
+ // user defined properties from command line or file should be
+ // marked so that they cannot be overwritten by the build file
+ // ie, once set they are set for the rest of the build.
+ Match match = Regex.Match(arg, @"-set:(\w+)=(\w*)");
+ if (match.Success) {
+ string name = match.Groups[1].Value;
+ string value = match.Groups[2].Value;
+ project.Properties.AddReadOnly(name, value);
+ }
+ } else if (arg.StartsWith(helpOption)) {
+ showHelp = true;
+ } else if (arg.StartsWith(verboseOption)) {
+ project.Verbose = true;
+ } else if (arg.Length > 0) {
+ // must be a target (or mistake ;)
+ project.BuildTargets.Add(arg);
+ }
+ }
+
+ // Get version information directly from assembly. This takes more
+ // work but prevents the version numbers from getting out of sync.
+ ProcessModule module = Process.GetCurrentProcess().MainModule;
+ FileVersionInfo info = FileVersionInfo.GetVersionInfo(module.FileName);
+ string programName = Path.GetFileNameWithoutExtension(info.FileName); // in case the user has renamed the program
+
+ if (showHelp) {
+ const int optionPadding = 23;
+
+ Console.WriteLine("NAnt Version {0} Copyright (C) 2001 Gerry Shaw", info.FileMajorPart + "." + info.FileMinorPart + "." + info.FileBuildPart);
+ Console.WriteLine("http://nant.sourceforge.net/");
+ Console.WriteLine();
+ Console.WriteLine("NAnt comes with ABSOLUTELY NO WARRANTY.");
+ Console.WriteLine("This is free software, and you are welcome to redistribute it under certain");
+ Console.WriteLine("conditions set out by the GNU General Public License. A copy of the license");
+ Console.WriteLine("is available in the distribution package and from the NAnt web site.");
+ Console.WriteLine();
+ Console.WriteLine("usage: {0} [options] [target]", programName);
+ Console.WriteLine();
+ Console.WriteLine("options:");
+ Console.WriteLine(" {0} use given buildfile", (buildfileOption + "<file>").PadRight(optionPadding));
+ Console.WriteLine(" {0} set project base directory", (basedirOption + "<dir>").PadRight(optionPadding));
+ Console.WriteLine(" {0} use value for given property", (setOption + "<property>=<value>").PadRight(optionPadding));
+ Console.WriteLine(" {0} print this message", helpOption.PadRight(optionPadding));
+ Console.WriteLine();
+ Console.WriteLine("If no buildfile is specified the first file ending in .build will be used.");
+ } else {
+ if (!project.Run()) {
+ Console.WriteLine("Try `{0} -help' for more information.", programName);
+ returnCode = 1; // set return code to indicate an error occurred
+ }
+ }
+ Log.Close();
+ return returnCode;
+ }
+ }
+}
diff --git a/mcs/nant/src/NAnt.exe b/mcs/nant/src/NAnt.exe
new file mode 100755
index 00000000000..a7a82b71366
--- /dev/null
+++ b/mcs/nant/src/NAnt.exe
Binary files differ
diff --git a/mcs/nant/src/Project.cs b/mcs/nant/src/Project.cs
new file mode 100755
index 00000000000..9746dadcfdc
--- /dev/null
+++ b/mcs/nant/src/Project.cs
@@ -0,0 +1,332 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+// Ian MacLean (ian_maclean@another.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+ using System.Reflection;
+ using System.Text.RegularExpressions;
+ using System.Xml;
+ using System.Xml.XPath;
+ using System.Collections;
+ using System.Collections.Specialized;
+
+ /// <summary>
+ /// Central representation of an NAnt project.
+ /// </summary>
+ public class Project {
+
+ public static readonly string BuildFilePattern = "*.build";
+
+ /// <summary>
+ /// Finds the file name for the build file in the specified directory.
+ /// </summary>
+ /// <param name="directory">The directory to look for a build file. When in doubt use Environment.CurrentDirectory for directory.</param>
+ /// <returns>The path to the build file or <c>null</c> if no build file could be found.</returns>
+ public static string FindBuildFileName(string directory) {
+ string buildFileName = null;
+
+ // find first file ending in .build
+ DirectoryInfo directoryInfo = new DirectoryInfo(directory);
+ FileInfo[] files = directoryInfo.GetFiles(BuildFilePattern);
+ if (files.Length > 0) {
+ buildFileName = Path.Combine(directory, files[0].Name);
+ }
+ return buildFileName;
+ }
+
+ string _name;
+ string _defaultTargetName;
+ string _baseDirectory;
+ string _buildFileName;
+ bool _verbose = false;
+
+ StringCollection _buildTargets = new StringCollection();
+ TaskCollection _tasks = new TaskCollection();
+ TargetCollection _targets = new TargetCollection();
+ XPathTextPositionMap _positionMap; // created when Xml document is loaded
+ TaskFactory _taskFactory; // created in constructor
+ PropertyDictionary _properties = new PropertyDictionary();
+
+ public Project() {
+ _taskFactory = new TaskFactory(this);
+ }
+
+ /// <summary>
+ /// The name of the project.
+ /// </summary>
+ public string Name {
+ get { return _name; }
+ set { _name = value; }
+ }
+
+ public string BaseDirectory {
+ get { return _baseDirectory; }
+ set { _baseDirectory = value; }
+ }
+
+ public string BuildFileName {
+ get { return _buildFileName; }
+ set { _buildFileName = value; }
+ }
+
+ /// <summary>
+ /// When true tasks should output more output.
+ /// </summary>
+ public bool Verbose {
+ get { return _verbose; }
+ set { _verbose = value; }
+ }
+
+ /// <summary>
+ /// The list of targets to built.
+ /// </summary>
+ /// <remarks>
+ /// Targets are built in the order they appear in the collection. If
+ /// the collection is empty the default target will be built.
+ /// </remarks>
+ public StringCollection BuildTargets {
+ get { return _buildTargets; }
+ }
+
+ /// <summary>
+ /// The list of tasks to perform before any targets executed.
+ /// </summary>
+ /// <remarks>
+ /// Tasks are executed in the order they appear in the collection.
+ /// </remarks>
+ public TaskCollection Tasks {
+ get { return _tasks; }
+ }
+
+ public PropertyDictionary Properties {
+ get { return _properties; }
+ }
+
+ public TargetCollection Targets {
+ get { return _targets; }
+ }
+
+ public bool Run() {
+ bool buildResult = false;
+ try {
+ DateTime startTime = DateTime.Now;
+
+ if (BaseDirectory == null) {
+ BaseDirectory = Environment.CurrentDirectory;
+ }
+ BaseDirectory = Path.GetFullPath(BaseDirectory);
+
+ if (BuildFileName == null || BuildFileName == String.Empty) {
+ BuildFileName = FindBuildFileName(BaseDirectory);
+ if (BuildFileName == null) {
+ throw new BuildException(String.Format("Could not find a '{0}' file in '{1}'", BuildFilePattern, BaseDirectory));
+ }
+ }
+
+ Log.WriteLine("Buildfile: {0}", BuildFileName);
+ if (Verbose) {
+ Log.WriteLine("Base Directory: {0}", BaseDirectory);
+ }
+
+ XmlDocument doc = new XmlDocument();
+ try {
+ doc.Load(BuildFileName);
+ // TODO: validate against xsd schema
+ } catch (XmlException e) {
+ throw new BuildException(String.Format("Could not load '{0}'", BuildFileName), e);
+ }
+
+ Initialize(doc);
+ Properties.Add("nant.buildfile", BuildFileName);
+
+ Execute();
+
+ Log.WriteLine();
+ Log.WriteLine("BUILD SUCCEEDED");
+
+ TimeSpan buildTime = DateTime.Now - startTime;
+ Log.WriteLine();
+ Log.WriteLine("Total time: {0} seconds", (int) buildTime.TotalSeconds);
+
+ buildResult = true;
+ } catch (BuildException e) {
+ Log.WriteLine();
+ Log.WriteLine("BUILD FAILED");
+ Log.WriteLine(e.Message);
+ if (e.InnerException != null) {
+ Log.WriteLine(e.InnerException.Message);
+ }
+ } catch (Exception e) {
+ // all other exceptions should have been caught
+ Log.WriteLine();
+ Log.WriteLine("INTERNAL ERROR");
+ Log.WriteLine(e.ToString());
+ }
+ return buildResult;
+ }
+
+ public int AddTasks(string assemblyPath) {
+
+ Assembly assembly;
+ if (assemblyPath == null) {
+ assembly = Assembly.GetExecutingAssembly();
+ } else {
+ assembly = Assembly.LoadFrom(assemblyPath);
+ }
+
+ int taskCount = 0;
+ foreach(Type type in assembly.GetTypes()) {
+ if (type.IsSubclassOf(typeof(Task)) && !type.IsAbstract) {
+ if (_taskFactory.Builders.Add(new TaskBuilder(type.FullName, assemblyPath))) {
+ taskCount++;
+ }
+ }
+ }
+ return taskCount;
+ }
+
+ public void Initialize(XmlDocument doc) {
+
+ Name = doc.SelectSingleNode("project/@name").Value;
+
+ // make it possible for user to override this value
+ if (BaseDirectory == null) {
+ BaseDirectory = doc.SelectSingleNode("project/@basedir").Value;
+ }
+
+ // used only if BuildTargets collection is empty
+ _defaultTargetName = doc.SelectSingleNode("project/@default").Value;
+
+ // initialize builtin tasks
+ AddTasks(null);
+
+ // init static built in properties
+ Properties.Add("nant.project.name", Name);
+ Properties.Add("nant.base.dir", BaseDirectory);
+ Properties.Add("nant.default.name", _defaultTargetName);
+
+ // add all environment variables
+ IDictionary variables = Environment.GetEnvironmentVariables();
+ foreach (string name in variables.Keys) {
+ string value = (string) variables[name];
+ Properties.Add("nant.env." + name, value);
+ }
+
+ // Load line Xpath to linenumber array
+ _positionMap = new XPathTextPositionMap(doc.BaseURI);
+
+ // process all the non-target nodes (these are global tasks for the project)
+ XmlNodeList taskList = doc.SelectNodes("project/*[name() != 'target']");
+ foreach (XmlNode taskNode in taskList) {
+
+ // TODO: do somethiing like Project.CreateTask(taskNode) and have the project set the location
+ TextPosition textPosition = _positionMap.GetTextPosition(taskNode);
+
+ Task task = CreateTask(taskNode);
+ if (task != null) {
+ Tasks.Add(task);
+ }
+ }
+
+ // execute global tasks now - before anything else
+ // this lets us include tasks that do things like add more tasks
+ foreach (Task task in Tasks) {
+ task.Execute();
+ }
+
+ // process all the targets
+ XmlNodeList targetList = doc.SelectNodes("project/target");
+ foreach (XmlNode targetNode in targetList) {
+ Target target = new Target(this);
+ target.Initialize(targetNode);
+ Targets.Add(target);
+ }
+ }
+
+ public void Execute() {
+ if (BuildTargets.Count == 0) {
+ BuildTargets.Add(_defaultTargetName);
+ }
+
+ foreach(string targetName in BuildTargets) {
+ Execute(targetName);
+ }
+ }
+
+ public void Execute(string targetName) {
+ Target target = Targets.Find(targetName);
+ if (target == null) {
+ throw new BuildException(String.Format("unknown target '{0}'", targetName));
+ }
+ target.Execute();
+ }
+
+ public Task CreateTask(XmlNode taskNode) {
+ return CreateTask(taskNode, null);
+ }
+
+ public Task CreateTask(XmlNode taskNode, Target target) {
+ Task task = _taskFactory.CreateTask(taskNode, target);
+ if (task != null) {
+ // save task location in case of error
+ TextPosition pos = _positionMap.GetTextPosition(taskNode);
+
+ // initialize the task
+ task.Initialize(taskNode, new Location(taskNode.BaseURI, pos.Line, pos.Column));
+ }
+ return task;
+ }
+
+ public string ExpandText(string input) {
+ string output = input;
+ if (input != null) {
+ const string pattern = @"\$\{([^\}]*)\}";
+ foreach (Match m in Regex.Matches(input, pattern)) {
+ if (m.Length > 0) {
+
+ string token = m.ToString();
+ string propertyName = m.Groups[1].Captures[0].Value;
+ string propertyValue = Properties[propertyName];
+
+ if (propertyValue != null) {
+ output = output.Replace(token, propertyValue);
+ }
+ }
+ }
+ }
+ return output;
+ }
+
+ public string GetFullPath(string path) {
+ string baseDir = ExpandText(BaseDirectory);
+
+ if (path != null) {
+ if (!Path.IsPathRooted(path)) {
+ path = Path.Combine(baseDir, path);
+ }
+ } else {
+ path = baseDir;
+ }
+ return Path.GetFullPath(path);
+ }
+ }
+}
diff --git a/mcs/nant/src/PropertyDictionary.cs b/mcs/nant/src/PropertyDictionary.cs
new file mode 100755
index 00000000000..072ba46c0d2
--- /dev/null
+++ b/mcs/nant/src/PropertyDictionary.cs
@@ -0,0 +1,72 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System.Collections;
+ using System.Collections.Specialized;
+
+ public class PropertyDictionary : DictionaryBase {
+
+ /// <summary>
+ /// Maintains a list of the property names that are readonly.
+ /// </summary>
+ StringCollection _readOnlyProperties = new StringCollection();
+
+ /// <summary>
+ /// Adds a property that cannot be changed.
+ /// </summary>
+ /// <remarks>
+ /// Properties added with this method can never be changed. Note that
+ /// they are removed if the <c>Clear</c> method is called.
+ /// </remarks>
+ /// <param name="name">Name of property</param>
+ /// <param name="value">Value of property</param>
+ public void AddReadOnly(string name, string value) {
+ if (!_readOnlyProperties.Contains(name)) {
+ _readOnlyProperties.Add(name);
+ Dictionary.Add(name, value);
+ }
+ }
+
+ /// <summary>
+ /// Adds a property to the collection.
+ /// </summary>
+ /// <param name="name">Name of property</param>
+ /// <param name="value">Value of property</param>
+ public void Add(string name, string value) {
+ if (!_readOnlyProperties.Contains(name)) {
+ Dictionary.Add(name, value);
+ }
+ }
+
+ public string this[string name] {
+ get { return (string) Dictionary[(object) name]; }
+ set {
+ if (!_readOnlyProperties.Contains(name)) {
+ Dictionary[name] = value;
+ }
+ }
+ }
+
+ protected override void OnClear() {
+ _readOnlyProperties.Clear();
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Target.cs b/mcs/nant/src/Target.cs
new file mode 100755
index 00000000000..3e0de022c23
--- /dev/null
+++ b/mcs/nant/src/Target.cs
@@ -0,0 +1,115 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+// Ian MacLean (ian_maclean@another.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Collections.Specialized;
+ using System.Xml;
+
+ public class Target {
+
+ string _name;
+ Project _project;
+ bool _hasExecuted = false;
+ TaskCollection _tasks = new TaskCollection();
+ StringCollection _dependencies = new StringCollection();
+
+ public Target(Project project) {
+ Project = project;
+ }
+
+ public string Name {
+ get { return _name; }
+ set { _name = value; }
+ }
+
+ public Project Project {
+ get { return _project; }
+ set { _project = value; }
+ }
+
+ public bool HasExecuted {
+ get { return _hasExecuted; }
+ }
+
+ public TaskCollection Tasks {
+ get { return _tasks; }
+ }
+
+ public StringCollection Dependencies {
+ get { return _dependencies; }
+ }
+
+ public void Initialize(XmlNode targetNode) {
+ // get target name
+ XmlNode nameNode = targetNode.SelectSingleNode("@name");
+ if (nameNode == null) {
+ // TODO: add Location to exception
+ throw new BuildException("target must have a name attribute");
+ }
+ Name = nameNode.Value;
+
+ // add dependicies
+ XmlNode dependsNode = targetNode.SelectSingleNode("@depends");
+ if (dependsNode != null) {
+ string depends = dependsNode.Value;
+ foreach (string str in depends.Split(new char[]{','})) {
+ string dependency = str.Trim();
+ if (dependency.Length > 0) {
+ Dependencies.Add(dependency);
+ }
+ }
+ }
+
+ // select all the non-target nodes (these are global tasks for the project)
+ XmlNodeList taskList = targetNode.SelectNodes("*");
+ foreach (XmlNode taskNode in taskList) {
+ Task task = Project.CreateTask(taskNode, this);
+ if (task != null) {
+ Tasks.Add(task);
+ }
+ }
+ }
+
+ public void Execute() {
+ if (!HasExecuted) {
+ try {
+ foreach (string targetName in Dependencies) {
+ Target target = Project.Targets.Find(targetName);
+ if (target == null) {
+ // TODO: add Location to exception
+ throw new BuildException(String.Format("unknown dependent target '{0}' of target '{1}'", targetName, Name));
+ }
+ target.Execute();
+ }
+
+ Log.WriteLine();
+ Log.WriteLine("{0}:", Name);
+ foreach (Task task in Tasks) {
+ task.Execute();
+ }
+ } finally {
+ _hasExecuted = true;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/nant/src/TargetCollection.cs b/mcs/nant/src/TargetCollection.cs
new file mode 100755
index 00000000000..c4f486b1302
--- /dev/null
+++ b/mcs/nant/src/TargetCollection.cs
@@ -0,0 +1,35 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Collections;
+
+ public class TargetCollection : ArrayList {
+
+ public Target Find(string targetName) {
+ foreach(Target target in this) {
+ if (target.Name == targetName)
+ return target;
+ }
+ return null;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Task.cs b/mcs/nant/src/Task.cs
new file mode 100755
index 00000000000..2a4eafaebd1
--- /dev/null
+++ b/mcs/nant/src/Task.cs
@@ -0,0 +1,192 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+// Mike Krueger (mike@icsharpcode.net)
+// Ian MacLean (ian_maclean@another.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Reflection;
+ using System.Xml;
+
+ public abstract class Task {
+
+ /// <summary>Gets and sets how much spacing log prefix names will be padded.</summary>
+ /// <remarks>
+ /// Includes characters for a space after the name and the [ ] brackets. Default is 12.
+ /// </remarks>
+ public static int LogPrefixPadding = Log.IndentSize;
+
+ Location _location = Location.UnknownLocation;
+ Target _target = null;
+ Project _project = null;
+
+ /// <summary>
+ /// Location in build file where task is defined.
+ /// </summary>
+ protected Location Location {
+ get { return _location; }
+ set { _location = value; }
+ }
+
+ public string Name {
+ get {
+ string name = null;
+ TaskNameAttribute taskName = (TaskNameAttribute) Attribute.GetCustomAttribute(GetType(), typeof(TaskNameAttribute));
+ if (taskName != null) {
+ name = taskName.Name;
+ }
+ return name;
+ }
+ }
+
+ public string LogPrefix {
+ get {
+ string prefix = "[" + Name + "] ";
+ return prefix.PadLeft(LogPrefixPadding);
+ }
+ }
+
+ public Target Target {
+ get { return _target; }
+ set { _target = value; }
+ }
+
+ public Project Project {
+ get { return _project; }
+ set { _project = value; }
+ }
+
+ protected void AutoInitializeAttributes(XmlNode taskNode) {
+
+ // TODO: BooleanValidatorAttribute and Int32ValidatorAttribute implementation in Task
+
+ // Go down the inheritance tree to find the private fields in the object.
+ // We are looking for task attributes to initialize.
+ Type currentType = GetType();
+ while (currentType != typeof(object)) {
+ FieldInfo[] fieldInfoArray = currentType.GetFields(BindingFlags.NonPublic|BindingFlags.Instance);
+ foreach (FieldInfo fieldInfo in fieldInfoArray) {
+
+ // process TaskAttribute attributes
+ TaskAttributeAttribute taskAttribute = (TaskAttributeAttribute) Attribute.GetCustomAttribute(fieldInfo, typeof(TaskAttributeAttribute));
+ if (taskAttribute != null) {
+
+ // get value from xml file
+ XmlNode node = taskNode.SelectSingleNode("@" + taskAttribute.Name);
+
+ // check if its required
+ if (node == null && taskAttribute.Required) {
+ // TODO: add Location to exception
+ throw new BuildException(String.Format("{0} is a required attribute.", taskAttribute.Name), Location);
+ }
+
+ if (node != null) {
+ fieldInfo.SetValue(this, Convert.ChangeType(node.Value, fieldInfo.FieldType));
+ }
+ }
+
+ // process TaskFileSet attributes
+ TaskFileSetAttribute fileSetAttribute = (TaskFileSetAttribute) Attribute.GetCustomAttribute(fieldInfo, typeof(TaskFileSetAttribute));
+ if (fileSetAttribute != null) {
+ // have file set initialize itself
+ FileSet fileSet = (FileSet) fieldInfo.GetValue(this);
+
+ // set task fileset belongs to
+ fileSet.Task = this;
+
+ // load values from build file
+ XmlNode fileSetNode = taskNode.SelectSingleNode(fileSetAttribute.Name);
+ if (fileSetNode != null) {
+
+ XmlNode baseDirectoryNode = fileSetNode.SelectSingleNode("@basedir");
+ if (baseDirectoryNode != null) {
+ fileSet.BaseDirectory = baseDirectoryNode.Value;
+ }
+
+ foreach (XmlNode node in fileSetNode.SelectNodes("includes")) {
+ string pathname = node.SelectSingleNode("@name").Value;
+ fileSet.Includes.Add(pathname);
+ }
+
+ foreach (XmlNode node in fileSetNode.SelectNodes("excludes")) {
+ fileSet.Excludes.Add(node.SelectSingleNode("@name").Value);
+ }
+ }
+ }
+ }
+ currentType = currentType.BaseType;
+ }
+ }
+
+ protected void AutoExpandAttributes() {
+
+ // Go down the inheritance tree to find the private fields in the object.
+ // We are looking for task attributes to initialize.
+ Type currentType = GetType();
+ while (currentType != typeof(object)) {
+ FieldInfo[] fieldInfoArray = currentType.GetFields(BindingFlags.NonPublic|BindingFlags.Instance);
+ foreach (FieldInfo fieldInfo in fieldInfoArray) {
+
+ // proces string parameters
+ TaskAttributeAttribute taskAttribute = (TaskAttributeAttribute) Attribute.GetCustomAttribute(fieldInfo, typeof(TaskAttributeAttribute));
+ if (taskAttribute != null) {
+ if (taskAttribute.ExpandText) {
+ string value = (string) fieldInfo.GetValue(this);
+ value = Project.ExpandText(value);
+ fieldInfo.SetValue(this, value);
+ }
+
+ // if a field also has a validator attribute then ensure that value is correct
+ ValidatorAttribute[] validators = (ValidatorAttribute[]) Attribute.GetCustomAttributes(fieldInfo, typeof(ValidatorAttribute));
+ foreach (ValidatorAttribute validator in validators) {
+ string errorMessage = validator.Validate(fieldInfo.GetValue(this));
+ if (errorMessage != null) {
+ throw new BuildException(String.Format("Error processing '{0}' attribute in <{1}> task: {2}", taskAttribute.Name, Name, errorMessage), Location);
+ }
+ }
+ }
+ }
+ currentType = currentType.BaseType;
+ }
+ }
+
+ public void Initialize(XmlNode taskNode) {
+ Initialize(taskNode, null);
+ }
+
+ public void Initialize(XmlNode taskNode, Location location) {
+ if (location != null) {
+ _location = location;
+ }
+ AutoInitializeAttributes(taskNode);
+ InitializeTask(taskNode);
+ }
+
+ public void Execute() {
+ AutoExpandAttributes();
+ ExecuteTask();
+ }
+
+ protected virtual void InitializeTask(XmlNode taskNode) {
+ }
+
+ protected abstract void ExecuteTask();
+ }
+}
diff --git a/mcs/nant/src/TaskBuilder.cs b/mcs/nant/src/TaskBuilder.cs
new file mode 100755
index 00000000000..97b602b4828
--- /dev/null
+++ b/mcs/nant/src/TaskBuilder.cs
@@ -0,0 +1,84 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Reflection;
+
+ public class TaskBuilder {
+
+ string _className;
+ string _assemblyFileName;
+ string _taskName;
+
+ public TaskBuilder(string className)
+ : this(className, null) {
+ }
+
+ public TaskBuilder(string className, string assemblyFileName) {
+ _className = className;
+ _assemblyFileName = assemblyFileName;
+
+ // get task name from attribute
+ Assembly assembly = GetAssembly();
+ TaskNameAttribute taskNameAttribute = (TaskNameAttribute) Attribute.GetCustomAttribute(assembly.GetType(ClassName), typeof(TaskNameAttribute));
+ _taskName = taskNameAttribute.Name;
+ }
+
+ public string ClassName {
+ get { return _className; }
+ }
+
+ public string AssemblyFileName {
+ get { return _assemblyFileName; }
+ }
+
+ public string TaskName {
+ get { return _taskName; }
+ }
+
+ private Assembly GetAssembly() {
+ Assembly assembly;
+ if (AssemblyFileName == null) {
+ assembly = Assembly.GetExecutingAssembly();
+ } else {
+ assembly = Assembly.LoadFrom(AssemblyFileName);
+ }
+ return assembly;
+ }
+
+ public Task CreateTask(Project project, Target target) {
+ Task task;
+ try {
+ Assembly assembly = GetAssembly();
+
+ // create instance (ignore case)
+ task = (Task) assembly.CreateInstance(ClassName, true);
+
+ // set default values
+ task.Project = project;
+ task.Target = target;
+ } catch (Exception) {
+ task = null;
+ }
+ return task;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/TaskBuilderCollection.cs b/mcs/nant/src/TaskBuilderCollection.cs
new file mode 100755
index 00000000000..bb61c3171a3
--- /dev/null
+++ b/mcs/nant/src/TaskBuilderCollection.cs
@@ -0,0 +1,46 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Collections;
+
+ public class TaskBuilderCollection : ArrayList {
+
+ public bool Add(TaskBuilder builder) {
+ // prevent adding duplicate builders with the name task name
+ bool taskAdded = false;
+ if (GetBuilderForTask(builder.TaskName) == null) {
+ base.Add(builder);
+ taskAdded = true;
+ }
+ return taskAdded;
+ }
+
+ public TaskBuilder GetBuilderForTask(string taskName) {
+ foreach (TaskBuilder builder in this) {
+ if (builder.TaskName == taskName) {
+ return builder;
+ }
+ }
+ return null;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/TaskCollection.cs b/mcs/nant/src/TaskCollection.cs
new file mode 100755
index 00000000000..94d7afc4202
--- /dev/null
+++ b/mcs/nant/src/TaskCollection.cs
@@ -0,0 +1,26 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System.Collections;
+
+ public class TaskCollection : ArrayList {
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/TaskFactory.cs b/mcs/nant/src/TaskFactory.cs
new file mode 100755
index 00000000000..f1e4f7f718a
--- /dev/null
+++ b/mcs/nant/src/TaskFactory.cs
@@ -0,0 +1,57 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Xml;
+
+ internal class TaskFactory {
+
+ TaskBuilderCollection _builders = new TaskBuilderCollection();
+ Project _project;
+
+ public TaskFactory(Project project) {
+ Project = project;
+ }
+
+ public TaskBuilderCollection Builders {
+ get { return _builders; }
+ }
+
+ public Project Project {
+ get { return _project; }
+ set { _project = value; }
+ }
+
+ public Task CreateTask(XmlNode taskNode, Target target) {
+ string taskName = taskNode.Name;
+ Task task = null;
+
+ TaskBuilder builder = Builders.GetBuilderForTask(taskName);
+ if (builder != null) {
+ task = builder.CreateTask(Project, target);
+ } else {
+ throw new BuildException(String.Format("unknown task <{0}> in target <{1}>", taskName, target.Name));
+ }
+
+ return task;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Tasks/CallTask.cs b/mcs/nant/src/Tasks/CallTask.cs
new file mode 100755
index 00000000000..08e24711746
--- /dev/null
+++ b/mcs/nant/src/Tasks/CallTask.cs
@@ -0,0 +1,41 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Collections.Specialized;
+ using System.Diagnostics;
+ using System.IO;
+ using System.Xml;
+
+ [TaskName("call")]
+ public class CallTask : Task {
+
+ [TaskAttribute("target", Required=true)]
+ string _target = null;
+
+ // Attribute properties
+ public string TargetName { get { return _target; } }
+
+ protected override void ExecuteTask() {
+ Project.Execute(TargetName);
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Tasks/CompilerBase.cs b/mcs/nant/src/Tasks/CompilerBase.cs
new file mode 100755
index 00000000000..3c5990a09f2
--- /dev/null
+++ b/mcs/nant/src/Tasks/CompilerBase.cs
@@ -0,0 +1,186 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+// Mike Krueger (mike@icsharpcode.net)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Collections.Specialized;
+ using System.Diagnostics;
+ using System.IO;
+
+ public abstract class CompilerBase : ExternalProgramBase {
+
+ string _responseFileName;
+
+ // Microsoft common compiler options
+ [TaskAttribute("output", Required=true)]
+ string _output = null;
+
+ [TaskAttribute("target", Required=true)]
+ string _target = null;
+
+ [TaskAttribute("debug")]
+ [BooleanValidator()]
+ string _debug = Boolean.FalseString;
+
+ [TaskAttribute("define")]
+ string _define = null;
+
+ [TaskAttribute("win32icon")]
+ string _win32icon = null;
+
+ [TaskFileSet("references")]
+ FileSet _references = new FileSet(false);
+
+ [TaskFileSet("resources")]
+ FileSet _resources = new FileSet(false);
+
+ [TaskFileSet("modules")]
+ FileSet _modules = new FileSet(false);
+
+ [TaskFileSet("sources")]
+ FileSet _sources = new FileSet(true); // include all by default
+
+ public string Output { get { return _output; } }
+ public string OutputTarget { get { return _target; } }
+ public bool Debug { get { return Convert.ToBoolean(_debug); } }
+ public string Define { get { return _define; } }
+ public string Win32Icon { get { return _win32icon; } }
+ public FileSet References { get { return _references; } }
+ public FileSet Resources { get { return _resources; } }
+ public FileSet Modules { get { return _modules; } }
+ public FileSet Sources { get { return _sources; } }
+
+ public override string ProgramFileName { get { return Name; } }
+ public override string ProgramArguments { get { return "@" + _responseFileName; } }
+
+ protected virtual void WriteOptions(TextWriter writer) {
+ }
+
+ protected string GetOutputPath() {
+ return Path.GetFullPath(Path.Combine(BaseDirectory, Project.ExpandText(Output)));
+ }
+
+ protected virtual bool NeedsCompiling() {
+ // return true as soon as we know we need to compile
+
+ FileInfo outputFileInfo = new FileInfo(GetOutputPath());
+ if (!outputFileInfo.Exists) {
+ return true;
+ }
+
+ if (FileSet.MoreRecentLastWriteTime(Sources.FileNames, outputFileInfo.LastWriteTime)) {
+ return true;
+ }
+ if (FileSet.MoreRecentLastWriteTime(References.FileNames, outputFileInfo.LastWriteTime)) {
+ return true;
+ }
+ if (FileSet.MoreRecentLastWriteTime(Modules.FileNames, outputFileInfo.LastWriteTime)) {
+ return true;
+ }
+
+ // if we made it here then we don't have to recompile
+ return false;
+ }
+
+ protected override void ExecuteTask() {
+ if (NeedsCompiling()) {
+ // create temp response file to hold compiler options
+ _responseFileName = Path.GetTempFileName();
+ StreamWriter writer = new StreamWriter(_responseFileName);
+
+ try {
+ if (References.BaseDirectory == null) {
+ References.BaseDirectory = BaseDirectory;
+ }
+ if (Modules.BaseDirectory == null) {
+ Modules.BaseDirectory = BaseDirectory;
+ }
+ if (Sources.BaseDirectory == null) {
+ Sources.BaseDirectory = BaseDirectory;
+ }
+
+ Log.WriteLine(LogPrefix + "Compiling {0} files to {1}", Sources.FileNames.Count, GetOutputPath());
+
+ // specific compiler options
+ WriteOptions(writer);
+
+ // Microsoft common compiler options
+ writer.WriteLine("/nologo");
+ writer.WriteLine("/target:{0}", OutputTarget);
+ writer.WriteLine("/out:{0}", GetOutputPath());
+ if (Debug) {
+ writer.WriteLine("/debug");
+ writer.WriteLine("/define:DEBUG;TRACE");
+ }
+ if (Define != null) {
+ writer.WriteLine("/define:{0}", Define);
+ }
+ if (Win32Icon != null) {
+ writer.WriteLine("/win32icon:{0}", Win32Icon);
+ }
+ foreach (string fileName in References.FileNames) {
+ writer.WriteLine("/reference:{0}", fileName);
+ }
+ foreach (string fileName in Modules.FileNames) {
+ writer.WriteLine("/addmodule:{0}", fileName);
+ }
+ foreach (string fileName in Resources.FileNames) {
+ writer.WriteLine("/resource:{0}", fileName);
+ }
+ foreach (string fileName in Sources.FileNames) {
+ writer.WriteLine(fileName);
+ }
+ // Make sure to close the response file otherwise contents
+ // will not be written to disc and EXecuteTask() will fail.
+ writer.Close();
+
+ if (Verbose) {
+ // display response file contents
+ Log.WriteLine(LogPrefix + "Contents of " + _responseFileName);
+ /*
+ StreamReader reader = File.OpenText(_responseFileName);
+ string line = reader.ReadLine();
+ while (line != null) {
+ Log.WriteLine(LogPrefix + " " + line);
+ line = reader.ReadLine();
+ }
+ reader.Close();
+ */
+
+ StreamReader reader = File.OpenText(_responseFileName);
+ Log.WriteLine(reader.ReadToEnd());
+ reader.Close();
+
+ }
+
+ // call base class to do the work
+ base.ExecuteTask();
+
+ } finally {
+ // make sure we delete response file even if an exception is thrown
+ writer.Close(); // make sure stream is closed or file cannot be deleted
+ File.Delete(_responseFileName);
+ _responseFileName = null;
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/CopyTask.cs b/mcs/nant/src/Tasks/CopyTask.cs
new file mode 100755
index 00000000000..849eb023f9e
--- /dev/null
+++ b/mcs/nant/src/Tasks/CopyTask.cs
@@ -0,0 +1,196 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+// Ian MacLean (ian_maclean@another.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+ using System.Xml;
+ using System.Text;
+ using System.Collections;
+ using System.Collections.Specialized;
+
+ [TaskName("copy")]
+ public class CopyTask : Task {
+
+ [TaskAttribute("file")]
+ string _sourceFile = null;
+
+ [TaskAttribute("tofile")]
+ string _toFile = null;
+
+ [TaskAttribute("todir")]
+ string _toDirectory = null;
+
+ [TaskAttribute("filtering")]
+ [BooleanValidator()]
+ string _filtering = Boolean.FalseString;
+
+ [TaskAttribute("flatten")]
+ [BooleanValidator()]
+ string _flatten = Boolean.FalseString;
+
+ [TaskAttribute("includeEmptyDirs")]
+ [BooleanValidator()]
+ string _includeEmptyDirs = Boolean.FalseString;
+
+ [TaskFileSet("fileset")]
+ FileSet _fileset = new FileSet(true); // include all by default
+
+ [TaskAttribute("overwrite")]
+ [BooleanValidator()]
+ string _overwrite = Boolean.FalseString;
+
+ [TaskAttribute("verbose")]
+ [BooleanValidator()]
+ string _verbose = Boolean.FalseString;
+
+ [TaskAttribute("preserveLastModified")]
+ [BooleanValidator()]
+ string _preserveLastModified = Boolean.FalseString;
+
+ Hashtable _fileCopyMap = new Hashtable();
+
+ public string SourceFile { get { return _sourceFile; } }
+ public string ToFile { get { return _toFile; } }
+ public string ToDirectory { get { return _toDirectory; } }
+ public bool Filtering { get { return Convert.ToBoolean(_filtering); } }
+ public bool Flatten { get { return Convert.ToBoolean(_flatten); } }
+ public bool IncludeEmptyDirs { get { return Convert.ToBoolean(_includeEmptyDirs); } }
+ public bool Overwrite { get { return Convert.ToBoolean(_overwrite); } }
+ public bool PreserveLastModified{ get { return Convert.ToBoolean(_preserveLastModified); } }
+ public FileSet CopyFileSet { get { return _fileset; } }
+
+ public bool Verbose {
+ get {
+ return (Project.Verbose || Convert.ToBoolean(_verbose));
+ }
+ }
+
+ protected Hashtable FileCopyMap {
+ get { return _fileCopyMap; }
+ }
+
+ /// <summary>
+ /// Actually does the file (and possibly empty directory) copies.
+ /// </summary>
+ protected virtual void DoFileOperations() {
+ int fileCount = FileCopyMap.Keys.Count;
+ if (fileCount > 0) {
+ if (ToDirectory != null) {
+ Log.WriteLine(LogPrefix + "Copying {0} files to {1}", fileCount, Project.GetFullPath(ToDirectory));
+ } else {
+ Log.WriteLine(LogPrefix + "Copying {0} files", fileCount);
+ }
+
+ // loop thru our file list
+ foreach (string sourcePath in FileCopyMap.Keys) {
+ string dstPath = (string)FileCopyMap[sourcePath];
+ if (sourcePath == dstPath) {
+ if (Verbose) {
+ Log.WriteLine(LogPrefix + "Skipping self-copy of {0}" + sourcePath);
+ }
+ continue;
+ }
+
+ try {
+ if (Verbose) {
+ Log.WriteLine(LogPrefix + "Copying {0} to {1}", sourcePath, dstPath);
+ }
+
+ // create directory if not present
+ string dstDirectory = Path.GetDirectoryName(dstPath);
+ if (!Directory.Exists(dstDirectory)) {
+ Directory.CreateDirectory(dstDirectory);
+ if (Verbose) {
+ Log.WriteLine(LogPrefix + "Created directory {0}", dstDirectory);
+ }
+ }
+
+ File.Copy(sourcePath, dstPath, true);
+ } catch (IOException ioe) {
+ string msg = String.Format("Cannot copy {0} to {1}", sourcePath, dstPath);
+ throw new BuildException(msg, Location, ioe);
+ }
+ }
+ }
+
+ // TODO: handle empty directories in the fileset, refer to includeEmptyDirs attribute at
+ // http://jakarta.apache.org/ant/manual/CoreTasks/copy.html
+ }
+
+ protected override void ExecuteTask() {
+
+ string dstDirectoryPath = Project.GetFullPath(ToDirectory);
+ string srcFilePath = Project.GetFullPath(SourceFile);
+ FileInfo srcInfo = new FileInfo(srcFilePath);
+
+ string dstFilePath;
+ if (ToFile == null) {
+ dstFilePath = dstDirectoryPath + Path.DirectorySeparatorChar + srcInfo.Name;
+ } else {
+ dstFilePath = Project.GetFullPath(ToFile);
+ }
+
+ FileInfo dstInfo = new FileInfo(dstFilePath);
+ if (SourceFile != null) {
+ if (srcInfo.Exists) {
+ // do the outdated check
+ bool outdated = (!dstInfo.Exists) || (srcInfo.LastWriteTime > dstInfo.LastWriteTime);
+
+ if (Overwrite || outdated) {
+ // add to a copy map of absolute verified paths
+ FileCopyMap.Add(srcFilePath, dstFilePath);
+ }
+ } else {
+ Log.WriteLine(LogPrefix + "Could not find file {0} to copy.", srcFilePath);
+ }
+ } else {
+ // get the complete path of the base directory of the fileset, ie, c:\work\nant\src
+ string srcBasePath = Project.GetFullPath(CopyFileSet.BaseDirectory);
+ string dstBasePath = Project.GetFullPath(ToDirectory);
+
+ // if source file not specified use fileset
+ foreach (string pathname in CopyFileSet.FileNames) {
+ // replace the fileset path with the destination path
+ // NOTE: big problems could occur if the file set base dir is rooted on a different drive
+ string dstPath = pathname.Replace(srcBasePath, dstBasePath);
+
+ srcInfo = new FileInfo(pathname);
+ dstInfo = new FileInfo(dstPath);
+
+ if (srcInfo.Exists) {
+ // do the outdated check
+ bool outdated = (!dstInfo.Exists) || (srcInfo.LastWriteTime > dstInfo.LastWriteTime);
+
+ if (Overwrite || outdated) {
+ FileCopyMap.Add(pathname, dstPath);
+ }
+ } else {
+ Log.WriteLine(LogPrefix + "Could not find file {0} to copy.", srcFilePath);
+ }
+ }
+ }
+
+ // do all the actual copy operations now...
+ DoFileOperations();
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/CscTask.cs b/mcs/nant/src/Tasks/CscTask.cs
new file mode 100755
index 00000000000..6632df83674
--- /dev/null
+++ b/mcs/nant/src/Tasks/CscTask.cs
@@ -0,0 +1,45 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+// Mike Krueger (mike@icsharpcode.net)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+
+ [TaskName("csc")]
+ public class CscTask : CompilerBase {
+
+ // C# specific compiler options
+ [TaskAttribute("doc")]
+ string _doc = null;
+
+ protected override void WriteOptions(TextWriter writer) {
+ writer.WriteLine("/fullpaths");
+ if (_doc != null) {
+ writer.WriteLine("/doc:{0}", _doc);
+ }
+ }
+
+ protected override bool NeedsCompiling() {
+ // TODO: add checks for any referenced files OR return false to always compile
+ return base.NeedsCompiling();
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/DeleteTask.cs b/mcs/nant/src/Tasks/DeleteTask.cs
new file mode 100755
index 00000000000..4d4abf25149
--- /dev/null
+++ b/mcs/nant/src/Tasks/DeleteTask.cs
@@ -0,0 +1,173 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+
+// TODO: move this into the task documentation (once we figure out how tasks
+// should be documented - xml??
+/*
+
+verbose: Show name of each deleted file ("true"/"false"). Default is "false"
+when omitted.
+
+quiet: If the file does not exist, do not display a diagnostic message or
+modify the exit status to reflect an error (unless Ant has been invoked with
+the -verbose or -debug switches). This means that if a file or directory cannot
+be deleted, then no error is reported. This setting emulates the -f option to
+the Unix "rm" command. ("true"/"false"). Default is "false" meaning things are
+"noisy". Setting this to true, implies setting failonerror to false.
+
+failonerror: This flag (which is only of relevance if 'quiet' is false),
+controls whether an error -such as a failure to delete a file- stops the build
+task, or is merely reported to the screen. The default is "true"
+
+*/
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+
+ [TaskName("delete")]
+ public class DeleteTask : Task {
+
+ [TaskAttribute("file")]
+ string _file = null;
+
+ [TaskAttribute("dir")]
+ string _dir = null;
+
+ [TaskAttribute("verbose")]
+ [BooleanValidator()]
+ string _verbose = Boolean.FalseString;
+
+ [TaskAttribute("failonerror")]
+ [BooleanValidator()]
+ string _failOnError = Boolean.TrueString;
+
+ /// <summary>If true then delete empty directories when using filesets.</summary>
+ [TaskAttribute("includeEmptyDirs")]
+ [BooleanValidator()]
+ string _includeEmptyDirs = Boolean.FalseString;
+
+ [TaskFileSet("fileset")]
+ FileSet _fileset = new FileSet(false);
+
+ public string FileName { get { return _file; } }
+ public string DirectoryName { get { return _dir; } }
+ public bool FailOnError { get { return Convert.ToBoolean(_failOnError); } }
+ public bool IncludeEmptyDirectories { get { return Convert.ToBoolean(_includeEmptyDirs); } }
+ public FileSet DeleteFileSet { get { return _fileset; } }
+
+ public bool Verbose {
+ get {
+ return (Project.Verbose || Convert.ToBoolean(_verbose));
+ }
+ }
+
+ protected override void ExecuteTask() {
+
+ // limit task to deleting either a file or a directory or a file set
+ if (FileName != null && DirectoryName != null) {
+ throw new BuildException("Cannot specify 'file' and 'dir' in the same delete task", Location);
+ }
+
+ // try to delete specified file
+ if (FileName != null) {
+ string path = null;
+ try {
+ path = Project.GetFullPath(FileName);
+ } catch (Exception e) {
+ string msg = String.Format("Could not determine path from {0}", FileName);
+ throw new BuildException(msg, Location, e);
+ }
+ DeleteFile(path);
+
+ // try to delete specified directory
+ } else if (DirectoryName != null) {
+ string path = null;
+ try {
+ path = Project.GetFullPath(DirectoryName);
+ } catch (Exception e) {
+ string msg = String.Format("Could not determine path from {0}", DirectoryName);
+ throw new BuildException(msg, Location, e);
+ }
+ DeleteDirectory(path);
+
+ // delete files/directories in fileset
+ } else {
+ // only use the file set if file and dir attributes have NOT been set
+ foreach (string path in DeleteFileSet.FileNames) {
+ DeleteFile(path);
+ }
+
+ if (IncludeEmptyDirectories) {
+ foreach (string path in DeleteFileSet.DirectoryNames) {
+ // only delete EMPTY directories (no files, no directories)
+ DirectoryInfo dirInfo = new DirectoryInfo(path);
+
+ if ((dirInfo.GetFiles().Length == 0) && (dirInfo.GetDirectories().Length == 0)) {
+ DeleteDirectory(path);
+ }
+ }
+ }
+ }
+ }
+
+ void DeleteDirectory(string path) {
+ try {
+ if (Directory.Exists(path)) {
+ if (Verbose) {
+ Log.WriteLine(LogPrefix + "Deleting directory {0}", path);
+ }
+ if (path.Length > 10) {
+ Directory.Delete(path, true);
+ } else {
+ // TODO: remove this once this task is fully tested and NAnt is at 1.0
+ Console.WriteLine(LogPrefix + "Path {0} is too close to root to delete this early in development", path);
+ }
+ } else {
+ throw new DirectoryNotFoundException();
+ }
+ } catch (Exception e) {
+ if (FailOnError) {
+ string msg = String.Format("Cannot delete directory {0}", path);
+ throw new BuildException(msg, Location, e);
+ }
+ }
+ }
+
+ void DeleteFile(string path) {
+ try {
+ if (File.Exists(path)) {
+ if (Verbose) {
+ Log.WriteLine(LogPrefix + "Deleting file {0}", path);
+ }
+ File.Delete(path);
+ } else {
+ throw new FileNotFoundException();
+ }
+ } catch (Exception e) {
+ if (FailOnError) {
+ string msg = String.Format("Cannot delete file {0}", path);
+ throw new BuildException(msg, Location, e);
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/EchoTask.cs b/mcs/nant/src/Tasks/EchoTask.cs
new file mode 100755
index 00000000000..871a4385b10
--- /dev/null
+++ b/mcs/nant/src/Tasks/EchoTask.cs
@@ -0,0 +1,34 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+
+ [TaskName("echo")]
+ public class EchoTask : Task {
+
+ [TaskAttribute("message", Required=true)]
+ string _message = null;
+
+ protected override void ExecuteTask() {
+ Log.WriteLine(LogPrefix + _message);
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/ExecTask.cs b/mcs/nant/src/Tasks/ExecTask.cs
new file mode 100755
index 00000000000..747c8ab5f46
--- /dev/null
+++ b/mcs/nant/src/Tasks/ExecTask.cs
@@ -0,0 +1,58 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+
+ [TaskName("exec")]
+ public class ExecTask : ExternalProgramBase {
+
+ [TaskAttribute("program", Required=true)]
+ string _program = null;
+
+ [TaskAttribute("commandline")]
+ string _commandline = null;
+
+ [TaskAttribute("basedir")]
+ string _baseDirectory = null;
+
+ // Stop the buildprocess if the command exits with a returncode other than 0.
+ [TaskAttribute("failonerror")]
+ [BooleanValidator()]
+ string _failonerror = Boolean.TrueString;
+
+ // TODO: change this to Int32Parameter to ensure value is a valid Int32 type after text expansion
+ [TaskAttribute("timeout")]
+ [Int32Validator()]
+ string _timeout = Int32.MaxValue.ToString();
+
+ public override string ProgramFileName { get { return Project.GetFullPath(_program); } }
+ public override string ProgramArguments { get { return _commandline; } }
+ public override string BaseDirectory { get { return Project.GetFullPath(_baseDirectory); } }
+ public override int TimeOut { get { return Convert.ToInt32(_timeout); } }
+ public override bool FailOnError { get { return Convert.ToBoolean(_failonerror); } }
+
+ protected override void ExecuteTask() {
+ Log.WriteLine(LogPrefix + "{0} {1}", Path.GetFileName(ProgramFileName), GetCommandLine());
+ base.ExecuteTask();
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Tasks/ExternalProgramBase.cs b/mcs/nant/src/Tasks/ExternalProgramBase.cs
new file mode 100755
index 00000000000..0bc938177a2
--- /dev/null
+++ b/mcs/nant/src/Tasks/ExternalProgramBase.cs
@@ -0,0 +1,130 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Collections.Specialized;
+ using System.Diagnostics;
+ using System.IO;
+ using System.Text;
+ using System.Xml;
+
+ public abstract class ExternalProgramBase : Task {
+
+ [TaskAttribute("verbose")]
+ [BooleanValidator()]
+ string _verbose = Boolean.FalseString;
+
+ public abstract string ProgramFileName { get; }
+ public abstract string ProgramArguments { get; }
+
+ public virtual string BaseDirectory {
+ get {
+ if (Project != null) {
+ return Project.BaseDirectory;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ public virtual int TimeOut {
+ get { return Int32.MaxValue; }
+ }
+
+ public virtual bool FailOnError {
+ get { return true; }
+ }
+
+ public bool Verbose {
+ get {
+ return (Project.Verbose || Convert.ToBoolean(_verbose));
+ }
+ }
+
+ StringCollection _args = new StringCollection();
+
+ protected override void InitializeTask(XmlNode taskNode) {
+ // initialize the _args collection
+ foreach (XmlNode optionNode in taskNode.SelectNodes("arg")) {
+
+ // TODO: decide if we should enforce arg elements not being able
+ // to accept a file and value attribute on the same element.
+ // Ideally this would be down via schema and since it doesn't
+ // really hurt for now I'll leave it in.
+
+ XmlNode valueNode = optionNode.SelectSingleNode("@value");
+ if (valueNode != null) {
+ _args.Add(Project.ExpandText(valueNode.Value));
+ }
+
+ XmlNode fileNode = optionNode.SelectSingleNode("@file");
+ if (fileNode != null) {
+ _args.Add(Project.GetFullPath(Project.ExpandText(fileNode.Value)));
+ }
+ }
+ }
+
+ public string GetCommandLine() {
+ // append any nested <arg> arguments to command line
+ StringBuilder arguments = new StringBuilder(ProgramArguments);
+ foreach (string arg in _args) {
+ arguments = arguments.Append(' ');
+ arguments = arguments.Append(arg);
+ }
+ return arguments.ToString();
+ }
+
+ protected override void ExecuteTask() {
+ try {
+ // create process to launch compiler (redirect standard output to temp buffer)
+ Process process = new Process();
+ process.StartInfo.FileName = ProgramFileName;
+ process.StartInfo.Arguments = GetCommandLine();
+ process.StartInfo.RedirectStandardOutput = true;
+ process.StartInfo.UseShellExecute = false;
+ process.StartInfo.WorkingDirectory = BaseDirectory;
+ if (Verbose) {
+ Log.WriteLine(LogPrefix + "{0}>{1} {2}", process.StartInfo.WorkingDirectory, process.StartInfo.FileName, process.StartInfo.Arguments);
+ }
+ process.Start();
+
+ // display standard output
+ StreamReader reader = process.StandardOutput;
+ string output = reader.ReadToEnd();
+ if (output.Length > 0) {
+ int indentLevel = Log.IndentLevel;
+ Log.IndentLevel = 0;
+ Log.WriteLine(output);
+ Log.IndentLevel = indentLevel;
+ }
+
+ // wait for program to exit
+ process.WaitForExit(TimeOut);
+
+ if (FailOnError && process.ExitCode != 0) {
+ throw new BuildException("Program error, see build log for details.");
+ }
+ } catch (Exception e) {
+ throw new BuildException(e.Message, Location, e);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Tasks/FailTask.cs b/mcs/nant/src/Tasks/FailTask.cs
new file mode 100755
index 00000000000..2e6b7161fb5
--- /dev/null
+++ b/mcs/nant/src/Tasks/FailTask.cs
@@ -0,0 +1,38 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+
+ [TaskName("fail")]
+ public class FailTask : Task {
+
+ [TaskAttribute("message")]
+ string _message = null;
+
+ protected override void ExecuteTask() {
+ string message = _message;
+ if (message == null) {
+ message = "No message";
+ }
+ throw new BuildException(message);
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/IncludeTask.cs b/mcs/nant/src/Tasks/IncludeTask.cs
new file mode 100755
index 00000000000..637c3dabb5e
--- /dev/null
+++ b/mcs/nant/src/Tasks/IncludeTask.cs
@@ -0,0 +1,134 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Ian MacLean (ian_maclean@another.com)
+
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Xml;
+ using System.Collections;
+ using System.Collections.Specialized;
+
+ /// <summary>
+ /// Summary description for IncludeTask.
+ /// </summary>
+
+ [TaskName("include")] // TODO make into ant:include
+ public class IncludeTask : Task {
+
+ /// <summary>hours to to add to the sleep time</summary>
+ [TaskAttribute("href", Required=true)]
+ string _href = null;
+
+ // Attribute properties
+ public string Href { get { return _href; } }
+
+ XPathTextPositionMap _positionMap; // created when Xml document is loaded
+ TaskCollection _tasks = new TaskCollection();
+
+ // static members
+ static System.Collections.Stack _includesStack = new Stack();
+ static bool IsIncluded( string href ) {
+ bool result = false;
+ IEnumerator stackenum = _includesStack.GetEnumerator();
+ while ( stackenum.MoveNext()) {
+ if ( href == (string)stackenum.Current ) {
+ result = true; break;
+ }
+ }
+ return result;
+ }
+
+ protected void InitializeIncludedDocument(XmlDocument doc) {
+
+ // Load line Xpath to linenumber array
+ _positionMap = new XPathTextPositionMap(doc.BaseURI);
+
+ // process all the non-target nodes (these are global tasks for the project)
+ XmlNodeList taskList = doc.SelectNodes("project/*[name() != 'target']");
+ foreach (XmlNode taskNode in taskList) {
+
+ // TODO: do somethiing like Project.CreateTask(taskNode) and have the project set the location
+ TextPosition textPosition = _positionMap.GetTextPosition(taskNode);
+
+ Task task = Project.CreateTask(taskNode);
+ if (task != null) {
+ // Store a local copy also so we can execute only those
+ _tasks.Add(task);
+ }
+ }
+
+ // execute global tasks now - before anything else
+ // this lets us include tasks that do things like add more tasks
+ // Here is where we should check for recursive dependencies
+ //
+ foreach (Task task in _tasks ) {
+ task.Execute();
+ }
+
+ // process all the targets
+ XmlNodeList targetList = doc.SelectNodes("project/target");
+ foreach (XmlNode targetNode in targetList) {
+ Target target = new Target(Project);
+ target.Initialize(targetNode);
+ Project.Targets.Add(target);
+ }
+ }
+
+ /// <summary>
+ /// verify parameters
+ ///</summary>
+ ///<param name="taskNode"> taskNode used to define this task instance </param>
+ protected override void InitializeTask(XmlNode taskNode) {
+
+ //TODO check where we are in document - if not at top level then bail out on error ...
+ // basic recursion check
+ if (IsIncluded( Project.GetFullPath(Href) )) {
+ throw new BuildException("Recursive includes are not allowed", Location);
+ }
+ }
+
+ protected override void ExecuteTask() {
+
+ string fullpath = Project.GetFullPath(Href);
+ // push ourselves onto the stack
+ _includesStack.Push(fullpath);
+ try {
+
+ XmlDocument doc = new XmlDocument();
+
+ // Handle local file case
+ doc.Load(fullpath);
+
+ InitializeIncludedDocument(doc);
+ }
+ // Handling the case where a nested include causes an exception during initialization
+ catch ( BuildException ) {
+ throw;
+ }
+ catch ( Exception e) {
+ throw new BuildException(e.Message, Location, e);
+ }
+ finally {
+ // Pop off the stack
+ _includesStack.Pop();
+ }
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/JscTask.cs b/mcs/nant/src/Tasks/JscTask.cs
new file mode 100755
index 00000000000..e2944122aa7
--- /dev/null
+++ b/mcs/nant/src/Tasks/JscTask.cs
@@ -0,0 +1,40 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+// Mike Krueger (mike@icsharpcode.net)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+
+ [TaskName("jsc")]
+ public class JscTask : CompilerBase {
+
+ // TODO: add JScript.NET specific compiler options here (see CscTask)
+
+ protected override void WriteOptions(TextWriter writer) {
+ // TODO: add support for compiler specific options
+ }
+
+ protected override bool NeedsCompiling() {
+ // TODO: add checks for any referenced files OR return false to always compile
+ return base.NeedsCompiling();
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/MkDirTask.cs b/mcs/nant/src/Tasks/MkDirTask.cs
new file mode 100755
index 00000000000..fca374b3408
--- /dev/null
+++ b/mcs/nant/src/Tasks/MkDirTask.cs
@@ -0,0 +1,49 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+// Ian MacLean (ian_maclean@another.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+
+ /// <summary>Creates a directory and any non-existent parent directories when necessary.</summary>
+ [TaskName("mkdir")]
+ public class MkDirTask : Task {
+
+ [TaskAttribute("dir", Required=true)]
+ string _dir = null; // the directory to create
+
+ protected override void ExecuteTask() {
+ try {
+ string directory = Project.GetFullPath(_dir);
+ if (!Directory.Exists(directory)) {
+ Log.WriteLine(LogPrefix + "Creating directory {0}", directory);
+ DirectoryInfo result = Directory.CreateDirectory(directory);
+ if (result == null) {
+ string msg = String.Format("Unknown error creating directory '{0}'", directory);
+ throw new BuildException(msg, Location);
+ }
+ }
+ } catch (Exception e) {
+ throw new BuildException(e.Message, Location, e);
+ }
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/MoveTask.cs b/mcs/nant/src/Tasks/MoveTask.cs
new file mode 100755
index 00000000000..2b63014ef0b
--- /dev/null
+++ b/mcs/nant/src/Tasks/MoveTask.cs
@@ -0,0 +1,71 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+// Ian MacLean (ian_maclean@another.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+
+ [TaskName("move")]
+ public class MoveTask : CopyTask {
+
+ /// <summary>
+ /// Actually does the file (and possibly empty directory) copies.
+ /// </summary>
+ protected override void DoFileOperations() {
+ if (FileCopyMap.Count > 0) {
+
+ // loop thru our file list
+ foreach (string sourcePath in FileCopyMap.Keys) {
+ string destinationPath = (string)FileCopyMap[sourcePath];
+ if (sourcePath == destinationPath) {
+ Log.WriteLine(LogPrefix + "Skipping self-move of {0}" + sourcePath);
+ continue;
+ }
+
+ try {
+ // check if directory exists
+ if (Directory.Exists(sourcePath)) {
+ Log.WriteLine(LogPrefix + "moving directory {0} to {1}", sourcePath, destinationPath);
+ Directory.Move(sourcePath, destinationPath);
+ }
+ else {
+
+ DirectoryInfo todir = new DirectoryInfo(destinationPath);
+ if ( !todir.Exists ) {
+ Directory.CreateDirectory( Path.GetDirectoryName(destinationPath) );
+ }
+
+ Log.WriteLine(LogPrefix + "Moving {0} to {1}", sourcePath, destinationPath);
+ // IM look into how Ant does this for directories
+ File.Move(sourcePath, destinationPath);
+ }
+
+ } catch (IOException ioe) {
+ string msg = String.Format("Failed to move {0} to {1}\n{2}", sourcePath, destinationPath, ioe.Message);
+ throw new BuildException(msg, Location);
+ }
+ }
+ }
+ }
+ }
+}
+
+
diff --git a/mcs/nant/src/Tasks/NantTask.cs b/mcs/nant/src/Tasks/NantTask.cs
new file mode 100755
index 00000000000..1462ae97097
--- /dev/null
+++ b/mcs/nant/src/Tasks/NantTask.cs
@@ -0,0 +1,65 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Collections.Specialized;
+ using System.Diagnostics;
+ using System.IO;
+ using System.Xml;
+
+ [TaskName("nant")]
+ public class NantTask : Task {
+
+ [TaskAttribute("buildfile")]
+ string _buildFileName = null;
+
+ [TaskAttribute("basedir")]
+ string _baseDirectory = null;
+
+ // TODO: add support for multiple targets
+ [TaskAttribute("target")]
+ string _target = null;
+
+ protected override void ExecuteTask() {
+ string directory = Project.GetFullPath(_baseDirectory);
+ string buildFileName = _buildFileName;
+ if (buildFileName == null) {
+ buildFileName = Project.FindBuildFileName(directory);
+ }
+
+ try {
+ Log.WriteLine(LogPrefix + "{0} {1}", buildFileName, _target);
+ Log.Indent();
+ Project project = new Project();
+ project.BaseDirectory = directory;
+ project.BuildFileName = buildFileName;
+ if (_target != null) {
+ project.BuildTargets.Add(_target);
+ }
+ if (!project.Run()) {
+ throw new BuildException("Nested build failed - refer to build log for exact reason.");
+ }
+ } finally {
+ Log.Unindent();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Tasks/PropertyTask.cs b/mcs/nant/src/Tasks/PropertyTask.cs
new file mode 100755
index 00000000000..90933ca78ac
--- /dev/null
+++ b/mcs/nant/src/Tasks/PropertyTask.cs
@@ -0,0 +1,37 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+
+ [TaskName("property")]
+ public class PropertyTask : Task {
+
+ [TaskAttribute("name", Required=true)]
+ string _name = null;
+
+ [TaskAttribute("value", Required=true)]
+ string _value = String.Empty;
+
+ protected override void ExecuteTask() {
+ Project.Properties[_name] = _value;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Tasks/SleepTask.cs b/mcs/nant/src/Tasks/SleepTask.cs
new file mode 100755
index 00000000000..d6c69cc90b1
--- /dev/null
+++ b/mcs/nant/src/Tasks/SleepTask.cs
@@ -0,0 +1,91 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Ian MacLean (ian_maclean@another.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Xml;
+ using System.Threading;
+
+ /// <summary>
+ /// A task for sleeping a short period of time, useful when a build or deployment process
+ /// requires an interval between tasks.
+ /// </summary>
+
+ [TaskName("sleep")]
+ public class SleepTask : Task {
+
+ /// <summary>hours to to add to the sleep time</summary>
+ [TaskAttribute("hours")]
+ string _hours = null;
+
+ /// <summary>minutes to add to the sleep time</summary>
+ [TaskAttribute("minutes")]
+ string _minutes = 0.ToString();
+
+ /// <summary>seconds to add to the sleep time</summary>
+ [TaskAttribute("seconds")]
+ string _seconds = 0.ToString();
+
+ /// <summary>milliseconds to add to the sleep time</summary>
+ [TaskAttribute("milliseconds")]
+ string _milliseconds = 0.ToString();
+
+ /// <summary>flag controlling whether to break the build on an error</summary>
+ [TaskAttribute("failonerror")]
+ [BooleanValidator()]
+ string _failonerror = Boolean.FalseString;
+
+ // Attribute properties
+ public int Hours { get { return Convert.ToInt32(_hours); } }
+ public int Minutes { get { return Convert.ToInt32(_minutes); } }
+ public int Seconds { get { return Convert.ToInt32(_seconds); } }
+ public int Milliseconds { get { return Convert.ToInt32(_milliseconds); } }
+ public bool FailOnError { get { return Convert.ToBoolean(_failonerror); } }
+
+ ///return time to sleep
+ private int GetSleepTime() {
+ return ((((int) Hours * 60) + Minutes) * 60 + Seconds) * 1000 + Milliseconds;
+ }
+
+ ///<summary> return time to sleep </summary>
+ ///<param name="millis"> </param>
+ private void DoSleep(int millis ) {
+ Thread.Sleep(millis);
+ }
+
+ /// <summary>
+ /// verify parameters
+ ///</summary>
+ ///<param name="taskNode"> taskNode used to define this task instance </param>
+ protected override void InitializeTask(XmlNode taskNode) {
+ if (GetSleepTime() < 0) {
+ throw new BuildException("Negative sleep periods are not supported", Location);
+ }
+ }
+
+ protected override void ExecuteTask() {
+ int sleepTime = GetSleepTime();
+ Log.WriteLine(LogPrefix + "sleeping for {0} milliseconds", sleepTime);
+ DoSleep(sleepTime);
+ }
+ }
+}
+
+
diff --git a/mcs/nant/src/Tasks/StyleTask.cs b/mcs/nant/src/Tasks/StyleTask.cs
new file mode 100755
index 00000000000..05117217d0b
--- /dev/null
+++ b/mcs/nant/src/Tasks/StyleTask.cs
@@ -0,0 +1,171 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Serge (serge@wildwestsoftware.com)
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+ using System.Xml;
+ using System.Xml.Xsl;
+ using System.Xml.XPath;
+ using System.Text.RegularExpressions;
+
+ [TaskName("style")]
+ public class StyleTask : Task {
+
+ // TODO: consider prefixing private fields with _ to stay consistent (gs)
+
+ [TaskAttribute("basedir", Required=false)]
+ string baseDir = null;
+
+ [TaskAttribute("destdir", Required=false)]
+ string destDir = null;
+
+ [TaskAttribute("extension", Required=false)]
+ string extension = "html";
+
+ [TaskAttribute("style", Required=true)]
+ string xsltFile = null;
+
+ [TaskAttribute("in", Required=true)]
+ string srcFile = null;
+
+ [TaskAttribute("out", Required=false)]
+ string destFile = null;
+
+ private static string GetPath(string dir, string file) {
+ // TODO: remove platform dependencies by using System.IO.Path (gs)
+ string d = (dir == null)
+ ? ""
+ : Regex.Replace(dir, "/", "\\");
+
+ return (d==null || d=="")
+ ? (file==null || file=="") ? "" : file
+ : d.EndsWith("\\")
+ ? d +file : d + "\\" + file;
+ }
+
+ private XmlReader CreateXmlReader(string dir, string file) {
+ string xmlPath = GetPath(dir, file);
+ XmlTextReader xmlReader = null;
+
+ try {
+ xmlReader = new XmlTextReader(new FileStream(xmlPath, FileMode.Open));
+ } catch (Exception) {
+ xmlReader = null;
+ }
+
+ return xmlReader;
+ }
+
+ private XmlWriter CreateXmlWriter(string dir, string file) {
+ string xmlPath = GetPath(dir, file);
+
+ XmlWriter xmlWriter = null;
+
+ string targetDir = Path.GetDirectoryName(Path.GetFullPath(xmlPath));
+ if (targetDir != null && targetDir != "" && !Directory.Exists(targetDir)) {
+ Directory.CreateDirectory(targetDir);
+ }
+
+ try {
+ // UTF-8 encoding will be used
+ xmlWriter = new XmlTextWriter(xmlPath, null);
+ } catch (Exception) {
+ xmlWriter = null;
+ }
+
+ return xmlWriter;
+ }
+
+ protected override void ExecuteTask() {
+ string destFile = this.destFile;
+
+ if (destFile == null || destFile == "") {
+ // TODO: use System.IO.Path (gs)
+ string ext = extension[0]=='.'
+ ? extension
+ : "." + extension;
+
+ int extPos = srcFile.LastIndexOf('.');
+
+ if (extPos == -1) {
+ destFile = srcFile + ext;
+ } else {
+ destFile = srcFile.Substring(0, extPos) + ext;
+ }
+ }
+
+ string srcPath = GetPath(baseDir, srcFile);
+ string destPath = GetPath(destDir, destFile);
+ string xsltPath = GetPath(baseDir, xsltFile);
+
+ FileInfo srcInfo = new FileInfo(srcPath);
+ FileInfo destInfo = new FileInfo(destPath);
+ FileInfo xsltInfo = new FileInfo(xsltPath);
+
+ if (!srcInfo.Exists) {
+ throw new BuildException("Unable to find source xml file.");
+ }
+ if (!xsltInfo.Exists) {
+ throw new BuildException("Unable to find stylesheet file.");
+ }
+
+ bool destOutdated = !destInfo.Exists
+ || srcInfo.LastWriteTime > destInfo.LastWriteTime
+ || xsltInfo.LastWriteTime > destInfo.LastWriteTime;
+
+ if (destOutdated) {
+ XmlReader xmlReader = CreateXmlReader(baseDir, srcFile);
+ XmlReader xslReader = CreateXmlReader(baseDir, xsltFile);
+ XmlWriter xmlWriter = CreateXmlWriter(destDir, destFile);
+
+ Log.WriteLine(LogPrefix + "Transforming into " + Path.GetFullPath(destDir));
+
+ // TODO: remove assignments from conditional statement (gs)
+ if (xmlReader != null && xslReader != null && xmlWriter != null) {
+ XslTransform xslt = new XslTransform();
+ XPathDocument xml = new XPathDocument(xmlReader);
+
+ Log.WriteLine(LogPrefix + "Loading stylesheet " + Path.GetFullPath(xsltPath));
+ try {
+ xslt.Load(xslReader);
+ } catch (XsltCompileException xce) {
+ throw new BuildException(xce.Message, xce);
+ } catch (Exception e) {
+ throw new BuildException(e.Message, e);
+ }
+
+ Log.WriteLine(LogPrefix + "Processing " + Path.GetFullPath(srcPath) + " to " + Path.GetFullPath(destPath));
+ try {
+ xslt.Transform(xml, null, xmlWriter);
+ } catch (Exception e) {
+ throw new BuildException(e.Message, e);
+ }
+ } else {
+ // not sure how to deal with this...
+ // TODO: remove this statement or do something useful (gs)
+ // Can this condition occur? I would have thought
+ // that an exception would be thrown. (gs)
+ }
+ }
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/TStampTask.cs b/mcs/nant/src/Tasks/TStampTask.cs
new file mode 100755
index 00000000000..1806a3040c4
--- /dev/null
+++ b/mcs/nant/src/Tasks/TStampTask.cs
@@ -0,0 +1,43 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+
+ /// <remarks>
+ /// Sets the following properties:
+ /// <ul>
+ /// <li>nant.dateStamp to yyyyMMdd</li>
+ /// <li>nant.timeStamp to HHmm</li>
+ /// <li>nant.today using default DataTime.ToString() method</li>
+ /// </ul>
+ /// </remarks>
+ [TaskName("tstamp")]
+ public class TStampTask : Task {
+ protected override void ExecuteTask() {
+ DateTime now = DateTime.Now;
+ Log.WriteLine(LogPrefix + now.ToString());
+ Project.Properties["nant.dstamp"] = now.ToString("yyyyMMdd");
+ Project.Properties["nant.tstamp"] = now.ToString("HHmm");
+ Project.Properties["nant.today"] = now.ToString();
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/TaskDefTask.cs b/mcs/nant/src/Tasks/TaskDefTask.cs
new file mode 100755
index 00000000000..4c7eca7be4f
--- /dev/null
+++ b/mcs/nant/src/Tasks/TaskDefTask.cs
@@ -0,0 +1,42 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+
+ [TaskName("taskdef")]
+ public class TaskDefTask : Task {
+
+ [TaskAttribute("assembly", Required=true)]
+ string _assemblyFileName = null;
+
+ protected override void ExecuteTask() {
+ string assemblyFileName = Project.GetFullPath(_assemblyFileName);
+ try {
+ int taskCount = Project.AddTasks(assemblyFileName);
+ Log.WriteLine(LogPrefix + "Added {0} tasks from {1}", taskCount, assemblyFileName);
+ } catch (Exception e) {
+ Log.WriteLine(LogPrefix + "Adding tasks from {0}", assemblyFileName);
+ throw new BuildException(e.Message, Location, e);
+ }
+ }
+ }
+}
diff --git a/mcs/nant/src/Tasks/VbcTask.cs b/mcs/nant/src/Tasks/VbcTask.cs
new file mode 100755
index 00000000000..4f93787eed8
--- /dev/null
+++ b/mcs/nant/src/Tasks/VbcTask.cs
@@ -0,0 +1,40 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+// Mike Krueger (mike@icsharpcode.net)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+
+ [TaskName("vbc")]
+ public class VbcTask : CompilerBase {
+
+ // TODO: add JScript.NET specific compiler options here (see CscTask)
+
+ protected override void WriteOptions(TextWriter writer) {
+ // TODO: add support for compiler specific options
+ }
+
+ protected override bool NeedsCompiling() {
+ // TODO: add checks for any referenced files OR return false to always compile
+ return base.NeedsCompiling();
+ }
+ }
+}
diff --git a/mcs/nant/src/Util/Log.cs b/mcs/nant/src/Util/Log.cs
new file mode 100755
index 00000000000..b875663069d
--- /dev/null
+++ b/mcs/nant/src/Util/Log.cs
@@ -0,0 +1,155 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.Collections;
+ using System.IO;
+ using System.Text;
+
+ public class TextWriterCollection : ArrayList {
+ }
+
+ public class Log {
+
+ static bool _autoFlush = false;
+ static int _indentLevel = 0;
+ static int _indentSize = 4;
+
+ static TextWriterCollection _listeners;
+
+ protected Log() {
+ }
+
+ ~Log() {
+ // make sure we release any open file handles
+ Close();
+ }
+
+ public static bool AutoFlush {
+ get { return _autoFlush; }
+ set { _autoFlush = value; }
+ }
+
+ public static int IndentLevel {
+ get { return _indentLevel; }
+ set { _indentLevel = value; }
+ }
+
+ public static int IndentSize {
+ get { return _indentSize; }
+ set { _indentSize = value; }
+ }
+
+ public static TextWriterCollection Listeners {
+ get {
+ if (_listeners == null) {
+ _listeners = new TextWriterCollection();
+ _listeners.Add(Console.Out);
+ }
+ return _listeners;
+ }
+ }
+
+ public static void Close() {
+ foreach (TextWriter writer in Listeners) {
+ // never close the Console.Out writer
+ if (writer != Console.Out) {
+ writer.Close();
+ }
+ }
+ }
+
+ public static void Flush() {
+ foreach (TextWriter writer in Listeners) {
+ writer.Flush();
+ }
+ }
+
+ public static void Indent() {
+ IndentLevel++;
+ }
+
+ public static void Unindent() {
+ if (IndentLevel <= 0) {
+ throw new InvalidOperationException("IndentLevel must be greater than zero before calling Unindent()");
+ }
+ IndentLevel--;
+ }
+
+ /// <summary>
+ /// Flag to indicate next string will start on a new line so that it can be indented.
+ /// </summary>
+ private static bool _newline = true;
+
+ private static void PreprocessValue(ref string value) {
+ // if we are starting a new line then first indent the string
+ if (_newline) {
+ if (IndentLevel > 0) {
+ StringBuilder sb = new StringBuilder(value);
+ sb.Insert(0, " ", IndentLevel * IndentSize);
+ value = sb.ToString();
+ }
+ _newline = false;
+ }
+ }
+
+ public static void Write(string value) {
+ PreprocessValue(ref value);
+ foreach (TextWriter writer in Listeners) {
+ writer.Write(value);
+ }
+
+ if (AutoFlush) {
+ foreach (TextWriter writer in Listeners) {
+ writer.Flush();
+ }
+ }
+ }
+
+ public static void WriteLine() {
+ WriteLine(String.Empty);
+ }
+
+ public static void WriteLine(string value) {
+ PreprocessValue(ref value);
+ foreach (TextWriter writer in Listeners) {
+ writer.WriteLine(value);
+ }
+
+ if (AutoFlush) {
+ foreach (TextWriter writer in Listeners) {
+ writer.Flush();
+ }
+ }
+
+ // make sure we indent the next line
+ _newline = true;
+ }
+
+ public static void Write(string format, params object[] arg) {
+ Write(String.Format(format, arg));
+ }
+
+ public static void WriteLine(string format, params object[] arg) {
+ WriteLine(String.Format(format, arg));
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nant/src/Util/XmlNodeTextPositionMap.cs b/mcs/nant/src/Util/XmlNodeTextPositionMap.cs
new file mode 100755
index 00000000000..fd10caafd4f
--- /dev/null
+++ b/mcs/nant/src/Util/XmlNodeTextPositionMap.cs
@@ -0,0 +1,187 @@
+// NAnt - A .NET build tool
+// Copyright (C) 2001 Gerry Shaw
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Gerry Shaw (gerry_shaw@yahoo.com)
+
+namespace SourceForge.NAnt {
+
+ using System;
+ using System.IO;
+ using System.Text.RegularExpressions;
+ using System.Xml;
+ using System.Xml.XPath;
+ using System.Collections;
+
+ public struct TextPosition {
+ public static readonly TextPosition InvalidPosition = new TextPosition(-1,-1);
+
+ public TextPosition(int line, int column) {
+ Line = line;
+ Column = column;
+ }
+
+ public int Line;
+ public int Column;
+ }
+
+ /// <summary>
+ /// Maps XML nodes to the text positions from their original source.
+ /// </summary>
+ public class XPathTextPositionMap {
+
+ Hashtable _map = new Hashtable();
+
+ public XPathTextPositionMap(string url) {
+ string parentXPath = "/"; // default to root
+ string previousXPath = "";
+ int previousDepth = 0;
+
+ // Load text reader
+ XmlTextReader reader = new XmlTextReader(url);
+ ArrayList indexAtDepth = new ArrayList();
+
+ // Explicitly load document XPath
+ _map.Add((object) "/", (object) new TextPosition(1, 1));
+
+ // loop thru all nodes in the document
+ while (reader.Read()) {
+ // reader to Node ...
+ if ( (reader.NodeType.ToString() != "Whitespace") // Ignore those we aren't interested in
+ && (reader.NodeType.ToString() != "EndElement")
+ && (reader.NodeType.ToString() != "ProcessingInstruction")
+ && (reader.NodeType.ToString() != "XmlDeclaration")
+ ) {
+ int level = reader.Depth;
+ string currentXPath = "";
+
+ // If we arr higher than before
+ if (reader.Depth < previousDepth) {
+ // Clear vars for new depth
+ string[] list = parentXPath.Split('/');
+ string newXPath = ""; // once appended to / will be root node ...
+
+ for (int j = 1; j < level+1; j++) {
+ newXPath += "/" + list[j];
+ }
+
+ // higher than before so trim xpath\
+ parentXPath = newXPath; // one up from before
+
+ // clear indexes for depth greater than ours
+ indexAtDepth.RemoveRange(level+1, indexAtDepth.Count - (level+1));
+
+ } else if (reader.Depth > previousDepth) {
+ // we are lower
+ parentXPath = previousXPath;
+ }
+
+ // End depth setup
+ // Setup up index array
+ // add any needed extra items ( usually only 1 )
+ // would have uses array but not sure what maximum depth will be beforehand
+ for (int index = indexAtDepth.Count; index < level+1; index++) {
+ indexAtDepth.Add(0);
+ }
+ // Set child index
+ if ((int) indexAtDepth[level] == 0) {
+ // first time thru
+ indexAtDepth[level] = 1;
+ } else {
+ indexAtDepth[level] = (int) indexAtDepth[level] + 1; // lower so append to xpath
+ }
+
+ // Do actual XPath generation
+ if (parentXPath.EndsWith("/")) {
+ currentXPath = parentXPath;
+ } else {
+ currentXPath = parentXPath + "/"; // add seperator
+ }
+
+ // Set the final XPath
+ currentXPath += "child::node()[" + indexAtDepth[level] + "]";
+
+ // Add to our hash structures
+ _map.Add((object) currentXPath, (object) new TextPosition(reader.LineNumber, reader.LinePosition));
+
+ // setup up loop vars for next iteration
+ previousXPath = currentXPath;
+ previousDepth = reader.Depth;
+ }
+ }
+ }
+
+ public TextPosition GetTextPosition(XmlNode node) {
+ string xpath = GetXPathFromNode(node);
+ return GetTextPosition(xpath);
+ }
+
+ public TextPosition GetTextPosition(string xpath) {
+ TextPosition pos;
+ if (_map.ContainsKey(xpath)) {
+ pos = (TextPosition) _map[xpath];
+ } else {
+ pos = TextPosition.InvalidPosition;
+ }
+ return pos;
+ }
+
+ private string GetXPathFromNode(XmlNode node) {
+ XPathNavigator nav = node.CreateNavigator();
+
+ string xpath = "";
+ int index = 0;
+
+ while (nav.NodeType.ToString() != "Root") {
+ // loop thru children until we find ourselves
+ XPathNavigator navParent = nav.Clone();
+ navParent.MoveToParent();
+ int parentIndex = 0;
+ navParent.MoveToFirstChild();
+ if (navParent.IsSamePosition(nav)) {
+ index = parentIndex;
+ }
+ while (navParent.MoveToNext()) {
+ parentIndex++;
+ if (navParent.IsSamePosition(nav)) {
+ index = parentIndex;
+ }
+ }
+
+ nav.MoveToParent(); // do loop condiditon here
+
+ // if we are at doc and index = 0 then there is no xml proc instruction
+ if ((nav.NodeType.ToString()) != "Root" || (index == 0)) {
+ index = index + 1; // special case at root to avoid processing instruction ..
+ }
+
+ string thisNode = "child::node()[" + index + "]";
+
+ if (xpath == "") {
+ xpath = thisNode;
+ } else {
+ // build xpath string
+ xpath = thisNode + "/" + xpath;
+ }
+ }
+
+ // prepend slash to ...
+ xpath = "/" + xpath;
+
+ return xpath;
+ }
+ }
+}
diff --git a/mcs/nunit/.cvsignore b/mcs/nunit/.cvsignore
new file mode 100644
index 00000000000..335c71fd7fa
--- /dev/null
+++ b/mcs/nunit/.cvsignore
@@ -0,0 +1,2 @@
+*.dll
+*.pdb
diff --git a/mcs/nunit/ChangeLog b/mcs/nunit/ChangeLog
new file mode 100644
index 00000000000..e7f9936f64d
--- /dev/null
+++ b/mcs/nunit/ChangeLog
@@ -0,0 +1,32 @@
+2002-03-08 Nick Drochak <ndrochak@gol.com>
+
+ * nunit.build: exclude all the obsolete stuff, and prevent csc from
+ linking any ms stuff to the dll and exe we are testing on Linux.
+
+2002-03-07 Nick Drochak <ndrochak@gol.com>
+
+ * .cvsignore: ignore *.pdb files
+ * nunit.build: Build a version of NUnitCore.dll and NUnitConsole.exe
+ using mono's corlib. Use this to test on Linux under mint and mono.
+
+2002-03-06 Nick Drochak <ndrochak@gol.com>
+
+ * nunit.build: Exclude obsolete class from build. Probably should
+ remove from cvs.
+
+2002-02-27 Martin Baulig <martin@gnome.org>
+
+ Imported NUnit 1.11.
+
+ * nunit.build: Added NAnt build file for NUnit. In addition to
+ NUnitConsole.exe and NUnitCore.dll, we also create a small
+ NUnitBase.dll which just contains the source files which are needed
+ to run the tests on Linux.
+
+ * RunTests.cs: This is a simple test runner which is used when we
+ run the tests on Linux. It is linked into UNitBase.dll.
+
+ * makefile: Just call NAnt here.
+
+ * NUnitGUI.exe, NUnitTests.dll: Removed binaries.
+
diff --git a/mcs/nunit/RunTests.cs b/mcs/nunit/RunTests.cs
new file mode 100755
index 00000000000..e5369546900
--- /dev/null
+++ b/mcs/nunit/RunTests.cs
@@ -0,0 +1,79 @@
+using System;
+using System.IO;
+using System.Threading;
+using System.Globalization;
+
+using NUnit.Framework;
+
+namespace MonoTests {
+
+public class MyTestRunner {
+
+ static TextWriter fWriter = Console.Out;
+
+ protected static TextWriter Writer {
+ get { return fWriter; }
+ }
+
+ public static void Print(TestResult result) {
+ PrintErrors(result);
+ PrintFailures(result);
+ PrintHeader(result);
+ }
+
+ /// <summary>Prints the errors to the standard output.</summary>
+ public static void PrintErrors(TestResult result) {
+ if (result.ErrorCount != 0) {
+ if (result.ErrorCount == 1)
+ Writer.WriteLine("There was "+result.ErrorCount+" error:");
+ else
+ Writer.WriteLine("There were "+result.ErrorCount+" errors:");
+
+ int i= 1;
+ foreach (TestFailure failure in result.Errors) {
+ Writer.WriteLine(i++ + ") "+failure+"("+failure.ThrownException.GetType().ToString()+")");
+ Writer.Write(failure.ThrownException);
+ }
+ }
+ }
+
+ /// <summary>Prints failures to the standard output.</summary>
+ public static void PrintFailures(TestResult result) {
+ if (result.FailureCount != 0) {
+ if (result.FailureCount == 1)
+ Writer.WriteLine("There was " + result.FailureCount + " failure:");
+ else
+ Writer.WriteLine("There were " + result.FailureCount + " failures:");
+ int i = 1;
+ foreach (TestFailure failure in result.Failures) {
+ Writer.Write(i++ + ") " + failure.FailedTest);
+ Exception t= failure.ThrownException;
+ if (t.Message != "")
+ Writer.WriteLine(" \"" + t.Message + "\"");
+ else {
+ Writer.WriteLine();
+ Writer.Write(failure.ThrownException);
+ }
+ }
+ }
+ }
+
+ /// <summary>Prints the header of the report.</summary>
+ public static void PrintHeader(TestResult result) {
+ if (result.WasSuccessful) {
+ Writer.WriteLine();
+ Writer.Write("OK");
+ Writer.WriteLine (" (" + result.RunCount + " tests)");
+
+ } else {
+ Writer.WriteLine();
+ Writer.WriteLine("FAILURES!!!");
+ Writer.WriteLine("Tests Run: "+result.RunCount+
+ ", Failures: "+result.FailureCount+
+ ", Errors: "+result.ErrorCount);
+ }
+ }
+
+}
+
+}
diff --git a/mcs/nunit/makefile b/mcs/nunit/makefile
new file mode 100644
index 00000000000..7e3b8cbb8b2
--- /dev/null
+++ b/mcs/nunit/makefile
@@ -0,0 +1,12 @@
+all: build
+
+linux: build
+
+windows: build
+
+build:
+ ../nant/NAnt.exe build
+
+clean:
+ ../nant/NAnt.exe clean
+
diff --git a/mcs/nunit/nunit.build b/mcs/nunit/nunit.build
new file mode 100755
index 00000000000..ab085a314e7
--- /dev/null
+++ b/mcs/nunit/nunit.build
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for NUnit -->
+
+<project name="NUnit" default="build">
+ <property name="debug" value="true"/>
+
+ <target name="build">
+ <csc target="library" output="NUnitCore.dll" debug="${debug}">
+ <sources basedir="src/NUnitCore">
+ <includes name="*.cs"/>
+ <excludes name="SimpleTestCollector.cs"/>
+ <excludes name="ClassPathTestCollector.cs"/>
+ <excludes name="ReflectionUtils.cs"/>
+ <excludes name="ITestSuiteLoader.cs"/>
+ <excludes name="LoadingTestCollector.cs"/>
+ <excludes name="ReloadingTestSuiteLoader.cs"/>
+ <excludes name="StandardTestSuiteLoader.cs"/>
+ <excludes name="TestCaseClassLoader.cs"/>
+ </sources>
+ </csc>
+
+ <csc target="library" output="NUnitCore_mono.dll" debug="${debug}">
+ <sources basedir="src/NUnitCore">
+ <includes name="*.cs"/>
+ <excludes name="SimpleTestCollector.cs"/>
+ <excludes name="ClassPathTestCollector.cs"/>
+ <excludes name="ReflectionUtils.cs"/>
+ <excludes name="ITestSuiteLoader.cs"/>
+ <excludes name="LoadingTestCollector.cs"/>
+ <excludes name="ReloadingTestSuiteLoader.cs"/>
+ <excludes name="StandardTestSuiteLoader.cs"/>
+ <excludes name="TestCaseClassLoader.cs"/>
+ </sources>
+ <arg value="/r:..\class\lib\corlib.dll"/>
+ <arg value="/r:..\class\lib\System.dll"/>
+ <arg value="/nostdlib"/> <!-- don't reference mscorlib -->
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ </csc>
+
+ <csc target="library" output="NUnitBase.dll" debug="${debug}">
+ <sources>
+ <includes name="src/NUnitCore/*.cs"/>
+ <includes name="RunTests.cs"/>
+ <excludes name="src/NUnitCore/IFailureDetailView.cs"/>
+ <excludes name="src/NUnitCore/SimpleTestCollector.cs"/>
+ </sources>
+ </csc>
+
+ <csc target="exe" output="NUnitConsole.exe" debug="${debug}">
+ <sources basedir="src\NUnitConsole">
+ <includes name="*.cs"/>
+ </sources>
+ <references>
+ <includes name="NUnitCore.dll"/>
+ </references>
+ </csc>
+
+ <csc target="exe" output="NUnitConsole_mono.exe" debug="${debug}">
+ <sources basedir="src\NUnitConsole">
+ <includes name="*.cs"/>
+ </sources>
+ <references>
+ <includes name="NUnitCore_mono.dll"/>
+ </references>
+ <arg value="/nostdlib"/> <!-- don't reference mscorlib -->
+ <arg value="/noconfig"/> <!-- don't reference ms assemblies -->
+ <arg value="/r:..\class\lib\corlib.dll"/>
+ </csc>
+ </target>
+
+ <target name="clean">
+ <delete file="NUnitCore.dll" failonerror="false"/>
+ <delete file="NUnitCore_mono.dll" failonerror="false"/>
+ <delete file="NUnitBase.dll" failonerror="false"/>
+ <delete file="NUnitConsole.exe" failonerror="false"/>
+ <delete file="NUnitConsole_mono.exe" failonerror="false"/>
+ <delete file="NUnitCore.pdb" failonerror="false"/>
+ <delete file="NUnitCore_mono.pdb" failonerror="false"/>
+ <delete file="NUnitBase.pdb" failonerror="false"/>
+ <delete file="NUnitConsole.pdb" failonerror="false"/>
+ <delete file="NUnitConsole_mono.pdb" failonerror="false"/>
+ </target>
+
+</project>
diff --git a/mcs/nunit/src/NUnitConsole/AssemblyInfo.cs b/mcs/nunit/src/NUnitConsole/AssemblyInfo.cs
new file mode 100644
index 00000000000..184c24203a1
--- /dev/null
+++ b/mcs/nunit/src/NUnitConsole/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Mark the framework assembly as CLS compliant
+[assembly:CLSCompliant(true)]
+
+//
+// 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("NUnit Testing Framework")]
+[assembly:AssemblyDescription("A unit testing framework for the .Net platform, ported from junit by Kent Beck and Erich Gamma.")]
+[assembly:AssemblyConfiguration("")]
+[assembly:AssemblyCompany("")]
+[assembly:AssemblyProduct("NUnit")]
+[assembly:AssemblyCopyright("")]
+[assembly:AssemblyTrademark("")]
+[assembly:AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Revision
+// Build Number
+//
+// You can specify all the value or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly:AssemblyVersion("1.11.*")]
+
+//
+// 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 cannot be signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine.
+// (*) If the key file and a key name attributes 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 file is installed into the CSP and used.
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile(@"..\..\..\..\NUnit.key")]
+//[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit/src/NUnitConsole/NUnitConsole.csproj b/mcs/nunit/src/NUnitConsole/NUnitConsole.csproj
new file mode 100755
index 00000000000..c7376873b47
--- /dev/null
+++ b/mcs/nunit/src/NUnitConsole/NUnitConsole.csproj
@@ -0,0 +1,93 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9254"
+ SchemaVersion = "1.0"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = "Logo.ico"
+ AssemblyKeyContainerName = ""
+ AssemblyName = "NUnitConsole"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Flow"
+ DefaultTargetSchema = "IE32Nav30"
+ DelaySign = "false"
+ NoStandardLibraries = "false"
+ OutputType = "Exe"
+ RootNamespace = "NUnitConsole"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "0"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = "NUnitConsole.xml"
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "0"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "NUnitCore"
+ Project = "{434945C6-B4F0-416B-AC43-2631EA091AAA}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ Private = "True"
+ />
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NUnitConsoleMain.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit/src/NUnitConsole/NUnitConsole.xml b/mcs/nunit/src/NUnitConsole/NUnitConsole.xml
new file mode 100644
index 00000000000..7aaf89815df
--- /dev/null
+++ b/mcs/nunit/src/NUnitConsole/NUnitConsole.xml
@@ -0,0 +1,146 @@
+<?xml version="1.0"?>
+<doc>
+ <assembly>
+ <name>NUnitConsole</name>
+ </assembly>
+ <members>
+ <member name="T:NUnit.Top">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="M:NUnit.Top.Main(System.String[])">
+ <summary>
+
+ </summary>
+ <param name="args"></param>
+ </member>
+ <member name="T:NUnit.TextUI.TestRunner">
+ <summary>A command line based tool to run tests.</summary><remarks>
+ <code>
+ C:\NUnitConsole.exe /t [/wait] TestCaseClass
+ </code>
+ TestRunner expects the name of a TestCase class as argument.
+ If this class defines a static <c>Suite</c> property it
+ will be invoked and the returned test is run. Otherwise all
+ the methods starting with "Test" having no arguments are run.
+
+ When the wait command line argument is given TestRunner
+ waits until the users types RETURN.
+
+ TestRunner prints a trace as the tests are executed followed by a
+ summary at the end.</remarks>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.#ctor">
+ <summary>
+ Constructs a TestRunner.
+ </summary>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.#ctor(System.IO.TextWriter)">
+ <summary>
+ Constructs a TestRunner using the given stream for all the output
+ </summary>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.AddError(NUnit.Framework.ITest,System.Exception)">
+ <summary>
+
+ </summary>
+ <param name="test"></param>
+ <param name="t"></param>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.AddFailure(NUnit.Framework.ITest,NUnit.Framework.AssertionFailedError)">
+ <summary>
+
+ </summary>
+ <param name="test"></param>
+ <param name="t"></param>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.CreateTestResult">
+ <summary>Creates the TestResult to be used for the test run.</summary>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.DoRun(NUnit.Framework.ITest,System.Boolean)">
+ <summary>
+
+ </summary>
+ <param name="suite"></param>
+ <param name="wait"></param>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.EndTest(NUnit.Framework.ITest)">
+ <summary>
+
+ </summary>
+ <param name="test"></param>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.GetLoader">
+ <summary>
+
+ </summary>
+ <returns></returns>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.Print(NUnit.Framework.TestResult)">
+ <summary>
+
+ </summary>
+ <param name="result"></param>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.PrintErrors(NUnit.Framework.TestResult)">
+ <summary>Prints the errors to the standard output.</summary>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.PrintFailures(NUnit.Framework.TestResult)">
+ <summary>Prints failures to the standard output.</summary>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.PrintHeader(NUnit.Framework.TestResult)">
+ <summary>Prints the header of the report.</summary>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.Run(System.Type)">
+ <summary>Runs a Suite extracted from a TestCase subclass.</summary>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.Run(NUnit.Framework.ITest)">
+ <summary>
+
+ </summary>
+ <param name="suite"></param>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.RunAndWait(NUnit.Framework.ITest)">
+ <summary>Runs a single test and waits until the user
+ types RETURN.</summary>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.RunFailed(System.String)">
+ <summary>
+
+ </summary>
+ <param name="message"></param>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.Start(System.String[])">
+ <summary>Starts a test run. Analyzes the command line arguments
+ and runs the given test suite.</summary>
+ </member>
+ <member name="M:NUnit.TextUI.TestRunner.StartTest(NUnit.Framework.ITest)">
+ <summary>
+
+ </summary>
+ <param name="test"></param>
+ </member>
+ <member name="P:NUnit.TextUI.TestRunner.Writer">
+ <summary>
+
+ </summary>
+ </member>
+ <member name="M:System.Collections.Hashtable.Synchronized(System.Collections.Hashtable)">
+ <summary>
+ Returns a synchronized (thread-safe)
+ wrapper for the Hashtable.
+ </summary>
+ </member>
+ <member name="M:System.Collections.Hashtable.GetHash(System.Object)">
+ <summary>Returns the hash code for the specified key.</summary>
+ </member>
+ <member name="M:System.Collections.Hashtable.KeyEquals(System.Object,System.Object)">
+ <summary>
+ Compares a specific Object with a specific key
+ in the Hashtable.
+ </summary>
+ </member>
+ </members>
+</doc>
diff --git a/mcs/nunit/src/NUnitConsole/NUnitConsoleMain.cs b/mcs/nunit/src/NUnitConsole/NUnitConsoleMain.cs
new file mode 100644
index 00000000000..cf6091319d3
--- /dev/null
+++ b/mcs/nunit/src/NUnitConsole/NUnitConsoleMain.cs
@@ -0,0 +1,35 @@
+namespace NUnit
+{
+ using System;
+ using System.Collections;
+ using NUnit.Framework;
+ using NUnit.Runner;
+ using NUnit.TextUI;
+
+ /// <summary>
+ ///
+ /// </summary>
+ public class Top
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="args"></param>
+ public static void Main(string[] args)
+ {
+ TestRunner aTestRunner = new NUnit.TextUI.TestRunner();
+ try
+ {
+ TestResult r = aTestRunner.Start(args);
+ if (!r.WasSuccessful)
+ Environment.Exit(1);
+ Environment.Exit(0);
+ }
+ catch(Exception e)
+ {
+ Console.Error.WriteLine(e.Message);
+ Environment.Exit(2);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitConsole/TestRunner.cs b/mcs/nunit/src/NUnitConsole/TestRunner.cs
new file mode 100644
index 00000000000..77493e48866
--- /dev/null
+++ b/mcs/nunit/src/NUnitConsole/TestRunner.cs
@@ -0,0 +1,277 @@
+namespace NUnit.TextUI
+{
+ using System;
+ using System.IO;
+ using System.Reflection;
+ using NUnit.Framework;
+ using NUnit.Runner;
+
+ /// <summary>A command line based tool to run tests.</summary><remarks>
+ /// <code>
+ /// C:\NUnitConsole.exe /t [/wait] TestCaseClass
+ /// </code>
+ /// TestRunner expects the name of a TestCase class as argument.
+ /// If this class defines a static <c>Suite</c> property it
+ /// will be invoked and the returned test is run. Otherwise all
+ /// the methods starting with "Test" having no arguments are run.
+ ///
+ /// When the wait command line argument is given TestRunner
+ /// waits until the users types RETURN.
+ ///
+ /// TestRunner prints a trace as the tests are executed followed by a
+ /// summary at the end.</remarks>
+ public class TestRunner : BaseTestRunner
+ {
+ int fColumn = 0;
+ TextWriter fWriter = Console.Out;
+
+ /// <summary>
+ /// Constructs a TestRunner.
+ /// </summary>
+ public TestRunner() {}
+
+ /// <summary>
+ /// Constructs a TestRunner using the given stream for all the output
+ /// </summary>
+ public TestRunner(TextWriter writer) : this()
+ {
+ if (writer != null)
+ {
+ fWriter= writer;
+ }
+ else
+ {
+ throw new ArgumentNullException("writer");
+ }
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ /// <param name="t"></param>
+ public override void AddError(ITest test, Exception t)
+ {
+ lock(this)
+ this.Writer.Write("E");
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ /// <param name="t"></param>
+ public override void AddFailure(ITest test, AssertionFailedError t)
+ {
+ lock (this)
+ this.Writer.Write("F");
+ }
+
+ /// <summary>Creates the TestResult to be used for the test run.</summary>
+ protected TestResult CreateTestResult()
+ {
+ return new TestResult();
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="suite"></param>
+ /// <param name="wait"></param>
+ /// <returns></returns>
+ protected TestResult DoRun(ITest suite, bool wait)
+ {
+ TestResult result= CreateTestResult();
+ result.AddListener(this);
+ long startTime= System.DateTime.Now.Ticks;
+ suite.Run(result);
+ long endTime= System.DateTime.Now.Ticks;
+ long runTime= (endTime-startTime) / 10000;
+ Writer.WriteLine();
+ Writer.WriteLine("Time: "+ElapsedTimeAsString(runTime));
+ Print(result);
+
+ Writer.WriteLine();
+
+ if (wait)
+ {
+ Writer.WriteLine("<RETURN> to continue");
+ try
+ {
+ Console.ReadLine();
+ }
+ catch(Exception)
+ {
+ }
+ }
+ return result;
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+
+ public override void EndTest(ITest test)
+ {
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public override ITestLoader GetLoader()
+ {
+ return new StandardLoader();
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="result"></param>
+ public void Print(TestResult result)
+ {
+ lock(this)
+ {
+ PrintErrors(result);
+ PrintFailures(result);
+ PrintHeader(result);
+ }
+ }
+
+ /// <summary>Prints the errors to the standard output.</summary>
+ public void PrintErrors(TestResult result)
+ {
+ if (result.ErrorCount != 0)
+ {
+ if (result.ErrorCount == 1)
+ Writer.WriteLine("There was "+result.ErrorCount+" error:");
+ else
+ Writer.WriteLine("There were "+result.ErrorCount+" errors:");
+
+ int i= 1;
+ foreach (TestFailure failure in result.Errors)
+ {
+ Writer.WriteLine(i++ + ") "+failure+"("+failure.ThrownException.GetType().ToString()+")");
+ Writer.Write(GetFilteredTrace(failure.ThrownException));
+ }
+ }
+ }
+
+ /// <summary>Prints failures to the standard output.</summary>
+ public void PrintFailures(TestResult result)
+ {
+ if (result.FailureCount != 0)
+ {
+ if (result.FailureCount == 1)
+ Writer.WriteLine("There was " + result.FailureCount + " failure:");
+ else
+ Writer.WriteLine("There were " + result.FailureCount + " failures:");
+ int i = 1;
+ foreach (TestFailure failure in result.Failures)
+ {
+ Writer.Write(i++ + ") " + failure.FailedTest);
+ Exception t= failure.ThrownException;
+ if (t.Message != "")
+ Writer.WriteLine(" \"" + Truncate(t.Message) + "\"");
+ else
+ {
+ Writer.WriteLine();
+ Writer.Write(GetFilteredTrace(failure.ThrownException));
+ }
+ }
+ }
+ }
+
+ /// <summary>Prints the header of the report.</summary>
+ public void PrintHeader(TestResult result)
+ {
+ if (result.WasSuccessful)
+ {
+ Writer.WriteLine();
+ Writer.Write("OK");
+ Writer.WriteLine (" (" + result.RunCount + " tests)");
+
+ }
+ else
+ {
+ Writer.WriteLine();
+ Writer.WriteLine("FAILURES!!!");
+ Writer.WriteLine("Tests Run: "+result.RunCount+
+ ", Failures: "+result.FailureCount+
+ ", Errors: "+result.ErrorCount);
+ }
+ }
+
+ /// <summary>Runs a Suite extracted from a TestCase subclass.</summary>
+ static public void Run(Type testClass)
+ {
+ Run(new TestSuite(testClass));
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="suite"></param>
+ static public void Run(ITest suite)
+ {
+ TestRunner aTestRunner= new TestRunner();
+ aTestRunner.DoRun(suite, false);
+ }
+
+ /// <summary>Runs a single test and waits until the user
+ /// types RETURN.</summary>
+ static public void RunAndWait(ITest suite)
+ {
+ TestRunner aTestRunner= new TestRunner();
+ aTestRunner.DoRun(suite, true);
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="message"></param>
+ protected override void RunFailed(string message)
+ {
+ Console.Error.WriteLine(message);
+ Environment.ExitCode = 1;
+ throw new ApplicationException(message);
+ }
+
+ /// <summary>Starts a test run. Analyzes the command line arguments
+ /// and runs the given test suite.</summary>
+ public TestResult Start(string[] args)
+ {
+ bool wait = false;
+ string testCase = ProcessArguments(args, ref wait);
+ if (testCase.Equals(""))
+ throw new ApplicationException("Usage: NUnitConsole.exe [/wait] testCaseName, where\n"
+ + "name is the name of the TestCase class");
+
+ try
+ {
+ ITest suite = GetTest(testCase);
+ return DoRun(suite, wait);
+ }
+ catch (Exception e)
+ {
+ throw new ApplicationException("Could not create and run test suite.", e);
+ }
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ public override void StartTest(ITest test)
+ {
+ lock (this)
+ {
+ Writer.Write(".");
+ if (fColumn++ >= 40)
+ {
+ Writer.WriteLine();
+ fColumn = 0;
+ }
+ }
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ protected TextWriter Writer
+ {
+ get { return fWriter; }
+ }
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/ActiveTestSuite.cs b/mcs/nunit/src/NUnitCore/ActiveTestSuite.cs
new file mode 100644
index 00000000000..cdba3b0ed9b
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/ActiveTestSuite.cs
@@ -0,0 +1,113 @@
+namespace NUnit.Extensions
+{
+ using System;
+ using System.Threading;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// A TestSuite for active Tests. It runs each test in a
+ /// separate thread and until all threads have terminated.
+ /// -- Aarhus Radisson Scandinavian Center 11th floor
+ /// </summary>
+ public class ActiveTestSuite: TestSuite
+ {
+ private int fActiveTestDeathCount;
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="result"></param>
+ public override void Run(TestResult result)
+ {
+ fActiveTestDeathCount= 0;
+ base.Run(result);
+ WaitUntilFinished();
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ /// <param name="result"></param>
+ public void BaseRunTest(ITest test, TestResult result)
+ {
+ base.RunTest(test, result);
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ /// <param name="result"></param>
+ public override void RunTest(ITest test, TestResult result)
+ {
+ ThreadLittleHelper tlh = new ThreadLittleHelper(test, result, this);
+ Thread t = new Thread(new ThreadStart(tlh.Run));
+ t.Start();
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ public void RunFinished(ITest test)
+ {
+ lock(this)
+ {
+ fActiveTestDeathCount++;
+ Monitor.PulseAll(this);
+ }
+ }
+ private void WaitUntilFinished()
+ {
+ lock(this)
+ {
+ while (fActiveTestDeathCount < TestCount)
+ {
+ try
+ {
+ Monitor.Wait(this);
+ }
+ catch (ThreadInterruptedException)
+ {
+ return; // TBD
+ }
+ }
+ }
+ }
+ #region Nested Classes
+ /// <summary>
+ ///
+ /// </summary>
+ public class ThreadLittleHelper
+ {
+ private ITest fTest;
+ private TestResult fResult;
+ private ActiveTestSuite fSuite;
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ /// <param name="result"></param>
+ /// <param name="suite"></param>
+ public ThreadLittleHelper(ITest test, TestResult result,
+ ActiveTestSuite suite)
+ {
+ fSuite = suite;
+ fTest = test;
+ fResult = result;
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ public void Run()
+ {
+ try
+ {
+ fSuite.BaseRunTest(fTest, fResult);
+ }
+ finally
+ {
+ fSuite.RunFinished(fTest);
+ }
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/AssemblyInfo.cs b/mcs/nunit/src/NUnitCore/AssemblyInfo.cs
new file mode 100644
index 00000000000..bd0c7b8eee4
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Mark the framework assembly as CLS compliant
+[assembly:CLSCompliant(true)]
+
+//
+// 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("NUnit Testing Framework")]
+[assembly:AssemblyDescription("A unit testing framework for the .Net platform, ported from junit by Kent Beck and Erich Gamma.")]
+[assembly:AssemblyConfiguration("")]
+[assembly:AssemblyCompany("")]
+[assembly:AssemblyProduct("NUnit")]
+[assembly:AssemblyCopyright("")]
+[assembly:AssemblyTrademark("")]
+[assembly:AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Revision
+// Build Number
+//
+// You can specify all the value or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly:AssemblyVersion("1.11.*")]
+
+//
+// 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 cannot be signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine.
+// (*) If the key file and a key name attributes 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 file is installed into the CSP and used.
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile(@"..\..\..\..\NUnit.key")]
+//[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit/src/NUnitCore/AssemblyTestCollector.cs b/mcs/nunit/src/NUnitCore/AssemblyTestCollector.cs
new file mode 100755
index 00000000000..9c707c43e33
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/AssemblyTestCollector.cs
@@ -0,0 +1,72 @@
+using System;
+using NUnit.Framework;
+
+namespace NUnit.Runner
+{
+ /// <summary>
+ /// Collects the names of all classes in an assembly that are tests.
+ /// </summary>
+ public sealed class AssemblyTestCollector : MarshalByRefObject, ITestCollector
+ {
+ #region Instance Variables
+ private string fAssemblyName;
+ private StandardLoader fLoader;
+ #endregion
+
+ #region Constructors
+ /// <summary>
+ /// Create a new AssemblyTestCollector for the specified
+ /// assembly, and uses the supplied loader to load the tests
+ /// from the assembly.
+ /// </summary>
+ /// <param name="assemblyName">The file name of the assembly
+ /// from which to load classes</param>
+ /// <param name="loader">An instance if the standard loader to
+ /// use for loading tests from the assembly.</param>
+ public AssemblyTestCollector(string assemblyName,
+ StandardLoader loader)
+ {
+ if(loader!=null)
+ fLoader = loader;
+ else
+ throw new ArgumentNullException("loader");
+
+ if(assemblyName != null)
+ {
+ fAssemblyName = assemblyName;
+ }
+ else
+ throw new ArgumentNullException("assemblyName");
+
+ }
+ /// <summary>
+ /// Create a new AssemblyTestCollector for the specified
+ /// assembly.
+ /// </summary>
+ /// <param name="assemblyName">The file name of the assembly
+ /// from which to load classes.</param>
+ public AssemblyTestCollector(string assemblyName)
+ : this(assemblyName,new StandardLoader()){}
+ /// <summary>
+ /// returns a System.String[] of FullNames for all test classes
+ /// contained within the assembly.
+ /// Implements ITestCollector.CollectTestsClassNames()
+ /// </summary>
+ #endregion
+
+ #region ITestCollector Methods
+ public string[] CollectTestsClassNames()
+ {
+ Type[] tests = fLoader.GetTestTypes(fAssemblyName);
+ string[] ret = new string[tests.Length];
+ int i=0;
+ foreach (Type testType in tests)
+ {
+ ret[i] = testType.FullName;
+ i++;
+ }
+ return ret;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/Assertion.cs b/mcs/nunit/src/NUnitCore/Assertion.cs
new file mode 100644
index 00000000000..f9dbff90457
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/Assertion.cs
@@ -0,0 +1,184 @@
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>A set of Assert methods.</summary>
+ public class Assertion : MarshalByRefObject
+ {
+
+ /// <summary>
+ /// Protect constructor since it is a static only class
+ /// </summary>
+ protected Assertion():base(){}
+ /// <summary>
+ /// Asserts that a condition is true. If it isn't it throws
+ /// an <see cref="AssertionFailedError"/>.
+ /// </summary>
+ /// <param name="message">The message to display is the condition
+ /// is false</param>
+ /// <param name="condition">The evaluated condition</param>
+ static public void Assert(string message, bool condition)
+ {
+ if (!condition)
+ Assertion.Fail(message);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If it isn't it throws
+ /// an <see cref="AssertionFailedError"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ static public void Assert(bool condition)
+ {
+ Assertion.Assert(string.Empty, condition);
+ }
+ /// <summary>
+ /// /// Asserts that two doubles are equal concerning a delta. If the
+ /// expected value is infinity then the delta value is ignored.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ static public void AssertEquals(double expected, double actual, double delta)
+ {
+ Assertion.AssertEquals(string.Empty, expected, actual, delta);
+ }
+ /// <summary>
+ /// /// Asserts that two singles are equal concerning a delta. If the
+ /// expected value is infinity then the delta value is ignored.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ static public void AssertEquals(float expected, float actual, float delta)
+ {
+ Assertion.AssertEquals(string.Empty, expected, actual, delta);
+ }
+
+ /// <summary>Asserts that two objects are equal. If they are not
+ /// an <see cref="AssertionFailedError"/> is thrown.</summary>
+ static public void AssertEquals(Object expected, Object actual)
+ {
+ Assertion.AssertEquals(string.Empty, expected, actual);
+ }
+
+ /// <summary>Asserts that two doubles are equal concerning a delta.
+ /// If the expected value is infinity then the delta value is ignored.
+ /// </summary>
+ static public void AssertEquals(string message, double expected,
+ double actual, double delta)
+ {
+ // handle infinity specially since subtracting two infinite values gives
+ // NaN and the following test fails
+ if (double.IsInfinity(expected))
+ {
+ if (!(expected == actual))
+ Assertion.FailNotEquals(message, expected, actual);
+ }
+ else if (!(Math.Abs(expected-actual) <= delta))
+ Assertion.FailNotEquals(message, expected, actual);
+ }
+
+ /// <summary>Asserts that two floats are equal concerning a delta.
+ /// If the expected value is infinity then the delta value is ignored.
+ /// </summary>
+ static public void AssertEquals(string message, float expected,
+ float actual, float delta)
+ {
+ // handle infinity specially since subtracting two infinite values gives
+ // NaN and the following test fails
+ if (float.IsInfinity(expected))
+ {
+ if (!(expected == actual))
+ Assertion.FailNotEquals(message, expected, actual);
+ }
+ else if (!(Math.Abs(expected-actual) <= delta))
+ Assertion.FailNotEquals(message, expected, actual);
+ }
+
+ /// <summary>Asserts that two objects are equal. If they are not
+ /// an <see cref="AssertionFailedError"/> is thrown.</summary>
+ static public void AssertEquals(string message, Object expected, Object actual)
+ {
+ if (expected == null && actual == null)
+ return;
+ if (expected != null && expected.Equals(actual))
+ return;
+ Assertion.FailNotEquals(message, expected, actual);
+ }
+
+ /// <summary>Asserts that an object isn't null.</summary>
+ static public void AssertNotNull(Object anObject)
+ {
+ Assertion.AssertNotNull(string.Empty, anObject);
+ }
+
+ /// <summary>Asserts that an object isn't null.</summary>
+ static public void AssertNotNull(string message, Object anObject)
+ {
+ Assertion.Assert(string.Empty, anObject != null);
+ }
+
+ /// <summary>Asserts that an object is null.</summary>
+ static public void AssertNull(Object anObject)
+ {
+ Assertion.AssertNull(string.Empty, anObject);
+ }
+
+ /// <summary>Asserts that an object is null.</summary>
+ static public void AssertNull(string message, Object anObject)
+ {
+ Assertion.Assert(message, anObject == null);
+ }
+
+ /// <summary>Asserts that two objects refer to the same object. If they
+ /// are not the same an <see cref="AssertionFailedError"/> is thrown.
+ /// </summary>
+ static public void AssertSame(Object expected, Object actual)
+ {
+ Assertion.AssertSame(string.Empty, expected, actual);
+ }
+
+ /// <summary>Asserts that two objects refer to the same object.
+ /// If they are not an <see cref="AssertionFailedError"/> is thrown.
+ /// </summary>
+ static public void AssertSame(string message, Object expected, Object actual)
+ {
+ if (expected == actual)
+ return;
+ Assertion.FailNotSame(message, expected, actual);
+ }
+
+ /// <summary>Fails a test with no message.</summary>
+ static public void Fail()
+ {
+ Assertion.Fail(string.Empty);
+ }
+
+ /// <summary>Fails a test with the given message.</summary>
+ static public void Fail(string message)
+ {
+ if (message == null)
+ message = string.Empty;
+ throw new AssertionFailedError(message);
+ }
+
+ static private void FailNotEquals(string message, Object expected, Object actual)
+ {
+ string formatted=string.Empty;
+ if (message != null)
+ formatted= message+" ";
+ Assertion.Fail(formatted+"expected:<"+expected+"> but was:<"+actual+">");
+ }
+
+ static private void FailNotSame(string message, Object expected, Object actual)
+ {
+ string formatted=string.Empty;
+ if (message != null)
+ formatted= message+" ";
+ Assertion.Fail(formatted+"expected same");
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/AssertionFailedError.cs b/mcs/nunit/src/NUnitCore/AssertionFailedError.cs
new file mode 100644
index 00000000000..9afebde079c
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/AssertionFailedError.cs
@@ -0,0 +1,27 @@
+namespace NUnit.Framework
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ /// <summary>
+ /// Thrown when an assertion failed.
+ /// </summary>
+ [Serializable]
+ public class AssertionFailedError : ApplicationException//NUnitException
+ {
+ /// <summary>
+ /// Serialization Constructor
+ /// </summary>
+ protected AssertionFailedError(SerializationInfo info,
+ StreamingContext context) : base(info,context){}
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="message"></param>
+ public AssertionFailedError (string message) : base(message) {}
+// public override bool IsAssertionFailure
+// {
+// get{return true;}
+// }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/BaseTestRunner.cs b/mcs/nunit/src/NUnitCore/BaseTestRunner.cs
new file mode 100644
index 00000000000..7f3adfc6733
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/BaseTestRunner.cs
@@ -0,0 +1,323 @@
+namespace NUnit.Runner
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Specialized;
+ using System.IO;
+ using System.IO.IsolatedStorage;
+ using System.Reflection;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Base class for all test runners.
+ /// </summary>
+ /// <remarks>
+ ///
+ /// </remarks>
+ public abstract class BaseTestRunner: MarshalByRefObject, ITestListener
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ [Obsolete("Shoud be handled by a loader")]
+ public static string SUITE_PROPERTYNAME="Suite";
+
+ private static NameValueCollection fPreferences = new NameValueCollection();
+ private static int fgMaxMessageLength = 500;
+ private static bool fgFilterStack = true;
+
+ private bool fLoading = true;
+ /// <summary>
+ ///
+ /// </summary>
+ public BaseTestRunner()
+ {
+ fPreferences = new NameValueCollection();
+ fPreferences.Add("loading", "true");
+ fPreferences.Add("filterstack", "true");
+ ReadPreferences();
+ fgMaxMessageLength = GetPreference("maxmessage", fgMaxMessageLength);
+ }
+
+ #region ITestListener Methods
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ /// <param name="t"></param>
+ public abstract void AddError(ITest test, Exception t);
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ /// <param name="t"></param>
+ public abstract void AddFailure(ITest test, AssertionFailedError t);
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ public abstract void EndTest(ITest test);
+ #endregion
+
+#if false
+ /// <summary>
+ /// Clears the status message.
+ /// </summary>
+ protected virtual void ClearStatus()
+ {
+ // Belongs in the GUI TestRunner class.
+ }
+#endif
+ /// <summary>
+ /// Returns the formatted string of the elapsed time.
+ /// </summary>
+ public static string ElapsedTimeAsString(long runTime)
+ {
+ return ((double)runTime/1000).ToString();
+ }
+ /// <summary>
+ /// Extract the class name from a string in VA/Java style
+ /// </summary>
+ public static string ExtractClassName(string className)
+ {
+ if(className.StartsWith("Default package for"))
+ return className.Substring(className.LastIndexOf(".")+1);
+ return className;
+ }
+
+ static bool FilterLine(string line)
+ {
+ string[] patterns = new string[]
+ {
+ "NUnit.Framework.TestCase",
+ "NUnit.Framework.TestResult",
+ "NUnit.Framework.TestSuite",
+ "NUnit.Framework.Assertion." // don't filter AssertionFailure
+ };
+ for (int i = 0; i < patterns.Length; i++)
+ {
+ if (line.IndexOf(patterns[i]) > 0)
+ return true;
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Filters stack frames from internal NUnit classes
+ /// </summary>
+ public static string FilterStack(string stack)
+ {
+ string pref = GetPreference("filterstack");
+ if (((pref != null) && !GetPreference("filterstack").Equals("true"))
+ || fgFilterStack == false)
+ return stack;
+
+ StringWriter sw = new StringWriter();
+ StringReader sr = new StringReader(stack);
+
+ try
+ {
+ string line;
+ while ((line = sr.ReadLine()) != null)
+ {
+ if (!FilterLine(line))
+ sw.WriteLine(line);
+ }
+ }
+ catch (Exception)
+ {
+ return stack; // return the stack unfiltered
+ }
+ return sw.ToString();
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="t"></param>
+ /// <returns></returns>
+ public static string GetFilteredTrace(Exception t)
+ {
+ return BaseTestRunner.FilterStack(t.StackTrace);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="key"></param>
+ /// <returns></returns>
+ public static string GetPreference(string key)
+ {
+ return fPreferences.Get(key);
+ }
+
+ private static int GetPreference(String key, int dflt)
+ {
+ String value= GetPreference(key);
+ int intValue= dflt;
+ if (value != null)
+ {
+ try
+ {
+ intValue= int.Parse(value);
+ }
+ catch (FormatException) {}
+ }
+ return intValue;
+ }
+
+ private static FileStream GetPreferencesFile()
+ {
+ return new IsolatedStorageFileStream("NUnit.Prefs", FileMode.OpenOrCreate);
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public virtual ITestLoader GetLoader()
+ {
+ if (UseReloadingTestSuiteLoader())
+ return new UnloadingLoader();
+ return new StandardLoader();
+ }
+
+ /// <summary>
+ /// Returns the ITest corresponding to the given suite. This is
+ /// a template method, subclasses override RunFailed(), ClearStatus().
+ /// </summary>
+ public ITest GetTest(string suiteClassName)
+ {
+ ITest test = null;
+ try
+ {
+ test = LoadSuiteClass(suiteClassName);
+ }
+ catch (TypeLoadException e)
+ {
+ RunFailed(e.Message);
+ return null;
+ }
+ catch (Exception e)
+ {
+ RunFailed("Error: " + e.ToString());
+ return null;
+ }
+ //ClearStatus();
+ return test;
+ }
+
+ /// <summary>
+ /// Returns the loaded Class for a suite name.
+ /// </summary>
+ protected ITest LoadSuiteClass(string suiteClassName)
+ {
+ return GetLoader().LoadTest(suiteClassName);
+ }
+
+ private static void ReadPreferences()
+ {
+ FileStream fs= null;
+ try
+ {
+ fs= GetPreferencesFile();
+ fPreferences= new NameValueCollection(fPreferences);
+ ReadPrefsFromFile(ref fPreferences, fs);
+ }
+ catch (IOException)
+ {
+ try
+ {
+ if (fs != null)
+ fs.Close();
+ }
+ catch (IOException)
+ {
+ }
+ }
+ }
+
+ /// <summary>
+ /// Real method reads name/value pairs, populates, or maybe just
+ /// deserializes...
+ /// </summary>
+ /// <param name="prefs"></param>
+ /// <param name="fs"></param>
+ private static void ReadPrefsFromFile(ref NameValueCollection prefs, FileStream fs)
+ {
+ }
+
+ /// <summary>
+ /// Override to define how to handle a failed loading of a test suite.
+ /// </summary>
+ protected abstract void RunFailed(string message);
+
+ /// <summary>
+ /// Truncates a String to the maximum length.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <returns></returns>
+ public static string Truncate(string message)
+ {
+ if (fgMaxMessageLength != -1 && message.Length > fgMaxMessageLength)
+ message = message.Substring(0, fgMaxMessageLength)+"...";
+ return message;
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ public abstract void StartTest(ITest test);
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="args"></param>
+ /// <param name="wait"></param>
+ /// <returns></returns>
+ protected string ProcessArguments(string[] args, ref bool wait)
+ {
+ string suiteName="";
+ wait = false;
+ foreach (string arg in args)
+ {
+ if (arg.Equals("/noloading"))
+ SetLoading(false);
+ else if (arg.Equals("/nofilterstack"))
+ fgFilterStack = false;
+ else if (arg.Equals("/wait"))
+ wait = true;
+ else if (arg.Equals("/c"))
+ suiteName= ExtractClassName(arg);
+ else if (arg.Equals("/v"))
+ {
+ Console.Error.WriteLine("NUnit "+NUnit.Runner.Version.id()
+ + " by Philip Craig");
+ Console.Error.WriteLine("ported from JUnit 3.6 by Kent Beck"
+ + " and Erich Gamma");
+ }
+ else
+ suiteName = arg;
+ }
+ return suiteName;
+ }
+
+ /// <summary>
+ /// Sets the loading behaviour of the test runner
+ /// </summary>
+ protected void SetLoading(bool enable)
+ {
+ fLoading = enable;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ protected bool UseReloadingTestSuiteLoader()
+ {
+ return bool.TrueString.Equals( GetPreference("loading")) && fLoading;
+ }
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/ClassPathTestCollector.cs b/mcs/nunit/src/NUnitCore/ClassPathTestCollector.cs
new file mode 100644
index 00000000000..0669a285c07
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/ClassPathTestCollector.cs
@@ -0,0 +1,78 @@
+namespace NUnit.Runner
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Specialized;
+ using System.IO;
+
+ /// <summary>
+ /// A TestCollector that consults the
+ /// class path. It considers all classes on the class path
+ /// excluding classes in JARs. It leaves it up to subclasses
+ /// to decide whether a class is a runnable Test.
+ /// <see cref="ITestCollector"/>
+ /// </summary>
+ [Obsolete("Use StandardLoader or UnloadingLoader")]
+ public abstract class ClassPathTestCollector : ITestCollector
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ public ClassPathTestCollector() {}
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public string[] CollectTestsClassNames()
+ {
+ string classPath = Environment.GetEnvironmentVariable("Path");
+ char separator= Path.PathSeparator;
+ ArrayList result = new ArrayList();
+ CollectFilesInRoots(classPath.Split(separator), result);
+ string[] retVal = new string[result.Count];
+ result.CopyTo(retVal);
+ return retVal;
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="classFileName"></param>
+ /// <returns></returns>
+ protected string ClassNameFromFile(string classFileName)
+ {
+ return classFileName;
+ }
+
+ private void CollectFilesInRoots(string[] roots, IList result)
+ {
+ foreach (string directory in roots)
+ {
+ DirectoryInfo dirInfo=new DirectoryInfo(directory);
+ if (dirInfo.Exists)
+ {
+ string[] files=Directory.GetFiles(dirInfo.FullName);
+ foreach (string file in files)
+ {
+ if (IsTestClass(file))
+ {
+ string className=ClassNameFromFile(file);
+ result.Add(className);
+ }
+ }
+ }
+ }
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="classFileName"></param>
+ /// <returns></returns>
+ protected virtual bool IsTestClass(string classFileName)
+ {
+ return
+ ( classFileName.EndsWith(".dll")
+ || classFileName.EndsWith(".exe"))
+ && classFileName.IndexOf("Test") > 0;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ExceptionTestCase.cs b/mcs/nunit/src/NUnitCore/ExceptionTestCase.cs
new file mode 100644
index 00000000000..a5ae174fd61
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/ExceptionTestCase.cs
@@ -0,0 +1,53 @@
+namespace NUnit.Extensions
+{
+ using System;
+ using NUnit.Framework;
+
+ /// <summary>A TestCase that expects an Exception of class fExpected
+ /// to be thrown.</summary>
+ /// <remarks> The other way to check that an expected exception is thrown is:
+ /// <code>
+ /// try {
+ /// ShouldThrow();
+ /// }catch (SpecialException) {
+ /// return;
+ /// }
+ /// Assertion.Fail("Expected SpecialException");
+ /// </code>
+ ///
+ /// To use ExceptionTestCase, create a TestCase like:
+ /// <code>
+ /// new ExceptionTestCase("TestShouldThrow", typeof(SpecialException));
+ /// </code></remarks>
+ public class ExceptionTestCase: TestCase
+ {
+ private readonly Type fExpected;
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="name"></param>
+ /// <param name="exception"></param>
+ public ExceptionTestCase(string name, Type exception) : base(name)
+ {
+ fExpected= exception;
+ }
+
+ /// <summary>Execute the test method expecting that an Exception of
+ /// class fExpected or one of its subclasses will be thrown.</summary>
+ protected override void RunTest()
+ {
+ try
+ {
+ base.RunTest();
+ }
+ catch (Exception e)
+ {
+ if (fExpected.IsAssignableFrom(e.InnerException.GetType()))
+ return;
+ else
+ throw e.InnerException;
+ }
+ Assertion.Fail("Expected exception " + fExpected);
+ }
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/ExpectExceptionAttribute.cs b/mcs/nunit/src/NUnitCore/ExpectExceptionAttribute.cs
new file mode 100644
index 00000000000..401049da416
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/ExpectExceptionAttribute.cs
@@ -0,0 +1,47 @@
+namespace NUnit.Framework {
+ using System;
+
+ /// <summary>
+ /// The given exception should be thrown by the annotated method.
+ /// </summary>
+ /// <remarks>
+ /// To use this attribute, attach it to a method in a
+ /// <see cref="TestCase"/> subclass.
+ /// <example>Here is an example:
+ /// <code>
+ /// public class FooTest : TestCase {
+ /// public ExpectExceptionTest(string name) : base(name) {}
+ /// [ExpectException(typeof(ArgumentException))]
+ /// [ExpectException(typeof(IndexOutOfRangeException))]
+ /// public void TestBar() {
+ /// throw new ArgumentException("bad argument");
+ /// }
+ /// }
+ /// </code>
+ /// </example>
+ /// </remarks>
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=true)]
+ public class ExpectExceptionAttribute : Attribute {
+ private Type expected;
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="exceptionExpected"></param>
+ public ExpectExceptionAttribute(Type exceptionExpected) {
+ this.expected = exceptionExpected;
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString() {
+ return expected.ToString();
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ public Type ExceptionExpected {
+ get { return expected; }
+ }
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/IFailureDetailView.cs b/mcs/nunit/src/NUnitCore/IFailureDetailView.cs
new file mode 100644
index 00000000000..55553b505ad
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/IFailureDetailView.cs
@@ -0,0 +1,21 @@
+namespace NUnit.Runner {
+
+ using System;
+
+ using NUnit.Framework;
+
+ /// <summary>
+ /// A view to show details about a failure
+ /// </summary>
+ public interface IFailureDetailView {
+ /// <summary>
+ /// Clears the view
+ /// </summary>
+ void Clear();
+
+ /// <summary>
+ /// Shows details of a TestFailure
+ /// </summary>
+ void ShowFailure(TestFailure failure);
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/IProtectable.cs b/mcs/nunit/src/NUnitCore/IProtectable.cs
new file mode 100644
index 00000000000..ad86136602f
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/IProtectable.cs
@@ -0,0 +1,12 @@
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// An <c>IProtectable</c> can be run and can throw an Exception.
+ /// </summary>
+ /// <seealso cref="TestResult"/>
+ public interface IProtectable
+ {
+ /// <summary>Run the the following method protected.</summary>
+ void Protect();
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ITest.cs b/mcs/nunit/src/NUnitCore/ITest.cs
new file mode 100644
index 00000000000..098f4c0f23f
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/ITest.cs
@@ -0,0 +1,18 @@
+namespace NUnit.Framework
+{
+ /// <summary>An <c>ITest</c> can be run and collect its results.</summary>
+ /// <seealso cref="TestResult"/>
+ public interface ITest
+ {
+ /// <summary>
+ /// Counts the number of test cases that will be run by this test.
+ /// </summary>
+ int CountTestCases { get; }
+ /// <summary>
+ /// Runs a test and collects its result in a
+ /// <see cref="TestResult"/> instance.
+ /// </summary>
+ /// <param name="result"></param>
+ void Run(TestResult result);
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/ITestCollector.cs b/mcs/nunit/src/NUnitCore/ITestCollector.cs
new file mode 100644
index 00000000000..40bf089be83
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/ITestCollector.cs
@@ -0,0 +1,16 @@
+namespace NUnit.Runner
+{
+ using System;
+
+ /// <summary>
+ /// Collects Test classes to be presented by the TestSelector.
+ /// <see foocref="TestSelector"/>
+ /// </summary>
+ public interface ITestCollector
+ {
+ /// <summary>
+ /// Returns an array of FullNames for classes that are tests.
+ /// </summary>
+ string[] CollectTestsClassNames();
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/ITestListener.cs b/mcs/nunit/src/NUnitCore/ITestListener.cs
new file mode 100644
index 00000000000..87726ea95d4
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/ITestListener.cs
@@ -0,0 +1,65 @@
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>A Listener for test progress</summary>
+ public interface ITestListener
+ {
+ /// <summary>An error occurred.</summary>
+ void AddError(ITest test, Exception ex);
+
+ /// <summary>A failure occurred.</summary>
+ void AddFailure(ITest test, AssertionFailedError ex);
+
+ /// <summary>A test ended.</summary>
+ void EndTest(ITest test);
+
+ /// <summary>A test started.</summary>
+ void StartTest(ITest test);
+ }
+#if false
+ public class TestEventArgs : System.EventArgs
+ {
+ private readonly ITest fTest;
+ public TestEventArgs(ITest test) : base()
+ {
+ fTest = test;
+ }
+ public ITest Test
+ {
+ get { return fTest;}
+ }
+ }
+ public class TestErrorArgs : TestEventArgs
+ {
+ private readonly Exception fThrownException;
+
+ public TestErrorArgs(ITest test, Exception thrownException) : base(test)
+ {
+ fThrownException = thrownException;
+ }
+
+ public TestErrorArgs(TestFailure error)
+ : this(error.FailedTest,error.ThrownException){}
+
+ public Exception ThrownException
+ {
+ get { return fThrownException;}
+
+ }
+ }
+
+ public delegate void TestErrorHandler(TestFailure failure);
+ public delegate void TestEventHandler(ITest test);
+
+ public interface ITestEvents
+ {
+ event TestErrorHandler TestErred;
+ event TestErrorHandler TestFailed;
+ event TestEventHandler TestStarted;
+ event TestEventHandler TestEnded;
+ event TestEventHandler RunStarted;
+ event TestEventHandler RunEnded;
+ }
+#endif
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ITestLoader.cs b/mcs/nunit/src/NUnitCore/ITestLoader.cs
new file mode 100755
index 00000000000..ed0a08ed73c
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/ITestLoader.cs
@@ -0,0 +1,58 @@
+namespace NUnit.Runner
+{
+ using System;
+ using NUnit.Framework;
+ using System.Runtime.Serialization;
+
+ /// <summary>
+ /// Basic contract governing loading of tests
+ /// </summary>
+ public interface ITestLoader
+ {
+ /// <summary>
+ /// Loads an instance of the test class specified by the name.
+ /// Loadable in most cases will be an assembly qualified name.
+ ///
+ /// Other loaders could dynamically construct a test case from
+ /// an XML file or a database record.
+ /// </summary>
+ ITest LoadTest(string loadableName);
+
+ /// <summary>
+ /// Return the name used by the loader to load an instance
+ /// of the supplied test
+ /// </summary>
+ /// <param name="test"></param>
+ /// <returns></returns>
+ string GetLoadName(ITest test);
+ }
+
+ /// <summary>
+ /// Error thrown during assembly and class loading problems
+ /// </summary>
+ [Serializable]
+ public class LoaderException : NUnitException
+ {
+ /// <summary>
+ /// Serialization Constructor
+ /// </summary>
+ protected LoaderException(SerializationInfo info,
+ StreamingContext context) : base(info,context){}
+ /// <summary>
+ /// Standard constructor
+ /// </summary>
+ /// <param name="message">The error message that explains
+ /// the reason for the exception</param>
+ /// <param name="innerException">The exception that caused the
+ /// current exception</param>
+ public LoaderException(string message, Exception innerException) :
+ base(message, innerException) {}
+ /// <summary>
+ /// Standard constructor
+ /// </summary>
+ /// <param name="message">The error message that explains
+ /// the reason for the exception</param>
+ public LoaderException(string message) :
+ base(message) {}
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ITestSuiteLoader.cs b/mcs/nunit/src/NUnitCore/ITestSuiteLoader.cs
new file mode 100644
index 00000000000..71f7da29f6e
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/ITestSuiteLoader.cs
@@ -0,0 +1,17 @@
+namespace NUnit.Runner
+{
+ using System;
+
+ /// <summary>
+ /// An interface to define how a test suite should be loaded.
+ /// </summary>
+ [Obsolete("Use ILoader")]
+ public interface ITestSuiteLoader
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ Type Load(string suiteClassName);
+ //Type Reload(Type aType);
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/LoadingTestCollector.cs b/mcs/nunit/src/NUnitCore/LoadingTestCollector.cs
new file mode 100644
index 00000000000..4938ee952e9
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/LoadingTestCollector.cs
@@ -0,0 +1,54 @@
+namespace NUnit.Runner
+{
+ using System;
+ using System.Reflection;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// An implementation of a TestCollector that loads
+ /// all classes on the class path and tests whether
+ /// it is assignable from ITest or provides a static Suite property.
+ /// <see cref="ITestCollector"/>
+ /// </summary>
+ [Obsolete("Use StandardLoader or UnloadingLoader")]
+ public class LoadingClassPathTestCollector: ClassPathTestCollector
+ {
+
+ TestCaseClassLoader fLoader;
+ /// <summary>
+ ///
+ /// </summary>
+ public LoadingClassPathTestCollector()
+ {
+ fLoader= new TestCaseClassLoader();
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="classFileName"></param>
+ /// <returns></returns>
+ protected override bool IsTestClass(string classFileName)
+ {
+ try
+ {
+ if (classFileName.EndsWith(".dll") || classFileName.EndsWith(".exe"))
+ {
+ Type testClass= ClassFromFile(classFileName);
+ return (testClass != null); //HACK: && TestCase.IsTest(testClass);
+ }
+ }
+ catch (TypeLoadException)
+ {
+ }
+ return false;
+ }
+
+ private Type ClassFromFile(string classFileName)
+ {
+ string className = base.ClassNameFromFile(classFileName);
+ if (!fLoader.IsExcluded(className))
+ return fLoader.LoadClass(className, false);
+ return null;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/NUnitCore.csproj b/mcs/nunit/src/NUnitCore/NUnitCore.csproj
new file mode 100755
index 00000000000..e53d5db8fff
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/NUnitCore.csproj
@@ -0,0 +1,238 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.0.9466"
+ SchemaVersion = "1.0"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "NUnitCore"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Flow"
+ DefaultTargetSchema = "IE32Nav30"
+ DelaySign = "false"
+ OutputType = "Library"
+ RootNamespace = "NUnitCore"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "0"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = "NUnitCore.xml"
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "0"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ />
+ <Reference
+ Name = "SYSTEM.WINDOWS.FORMS"
+ AssemblyName = "System.Windows.Forms"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "ActiveTestSuite.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyTestCollector.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Assertion.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssertionFailedError.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "BaseTestRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ClassPathTestCollector.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ExceptionTestCase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ExpectExceptionAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IFailureDetailView.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IProtectable.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ITest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ITestCollector.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ITestListener.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ITestLoader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ITestSuiteLoader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LoadingTestCollector.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NUnitException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ReflectionUtils.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ReloadingTestSuiteLoader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RepeatedTest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StandardLoader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StandardTestSuiteLoader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestCase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestCaseClassLoader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestDecorator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestFailure.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestResult.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestSetup.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestSuite.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Version.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit/src/NUnitCore/NUnitException.cs b/mcs/nunit/src/NUnitCore/NUnitException.cs
new file mode 100644
index 00000000000..f0273ef791f
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/NUnitException.cs
@@ -0,0 +1,51 @@
+namespace NUnit.Framework
+{
+ using System;
+ using System.Diagnostics;
+ using System.Runtime.Serialization;
+
+ /// <summary>
+ /// Thrown when an assertion failed. Here to preserve the inner
+ /// exception and hence its stack trace.
+ /// </summary>
+ [Serializable]
+ public class NUnitException : ApplicationException
+ {
+ /// <summary>
+ /// Serialization Constructor
+ /// </summary>
+ protected NUnitException(SerializationInfo info,
+ StreamingContext context) : base(info,context){}
+ /// <summary>
+ /// Standard constructor
+ /// </summary>
+ /// <param name="message">The error message that explains
+ /// the reason for the exception</param>
+ public NUnitException(string message) : base (message){}
+ /// <summary>
+ /// Standard constructor
+ /// </summary>
+ /// <param name="message">The error message that explains
+ /// the reason for the exception</param>
+ /// <param name="inner">The exception that caused the
+ /// current exception</param>
+ public NUnitException(string message, Exception inner) :
+ base(message, inner) {}
+
+ /// <summary>
+ /// Indicates that this exception wraps an AssertionFailedError
+ /// exception
+ /// </summary>
+ public virtual bool IsAssertionFailure
+ {
+ get
+ {
+ AssertionFailedError inner = this.InnerException
+ as AssertionFailedError;
+ if(inner != null)
+ return true;
+ return false;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ReflectionUtils.cs b/mcs/nunit/src/NUnitCore/ReflectionUtils.cs
new file mode 100644
index 00000000000..491e0e7ec91
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/ReflectionUtils.cs
@@ -0,0 +1,94 @@
+namespace NUnit.Runner
+{
+
+ using System;
+ using System.Collections;
+ using System.Collections.Specialized;
+ using System.IO;
+ using System.Reflection;
+
+ using NUnit.Framework;
+ /// <summary>
+ ///
+ /// </summary>
+ [Obsolete("Use Standar Loader")]
+ public class ReflectionUtils
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="testClass"></param>
+ /// <returns></returns>
+ [Obsolete("Use Standar Loader")]
+ public static bool HasTests(Type testClass)
+ {
+
+ PropertyInfo suiteProperty= null;
+ suiteProperty = testClass.GetProperty("Suite", new Type[0]);
+ if (suiteProperty == null )
+ {
+ // try to extract a test suite automatically
+ TestSuite dummy = new TestSuite(testClass, true);
+ return (dummy.CountTestCases > 0);
+ }
+ ITest test= null;
+ try
+ {
+ // static property
+ test= (ITest)suiteProperty.GetValue(null, new Type[0]);
+ if (test == null)
+ return false;
+ }
+ catch(Exception)
+ {
+ return false;
+ }
+ return true;
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="assemblyName"></param>
+ /// <returns></returns>
+ [Obsolete("Use Standar Loader")]
+ public static StringCollection GetAssemblyClasses(string assemblyName)
+ {
+ StringCollection classNames = new StringCollection ();
+ try
+ {
+ Assembly testAssembly = Assembly.LoadFrom(assemblyName);
+
+ foreach(Type testType in testAssembly.GetExportedTypes())
+ {
+ if(testType.IsClass && HasTests(testType))
+ {
+ classNames.Add(testType.FullName);
+ }
+ }
+ }
+ catch(ReflectionTypeLoadException rcle)
+ {
+
+ Type[] loadedTypes = rcle.Types;
+ Exception[] exceptions = rcle.LoaderExceptions;
+
+ int exceptionCount = 0;
+
+ for ( int i =0; i < loadedTypes.Length; i++ )
+ {
+ Console.Error.WriteLine("Unable to load a type because {0}", exceptions[exceptionCount] );
+ exceptionCount++;
+ }
+ }
+ catch(FileNotFoundException fnfe)
+ {
+ Console.Error.WriteLine(fnfe.Message);
+ }
+ catch(Exception e)
+ {
+ Console.Error.WriteLine("Error reading file {0}: {1}", assemblyName, e.Message);
+ }
+ return classNames;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/ReloadingTestSuiteLoader.cs b/mcs/nunit/src/NUnitCore/ReloadingTestSuiteLoader.cs
new file mode 100644
index 00000000000..de222ed9d77
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/ReloadingTestSuiteLoader.cs
@@ -0,0 +1,33 @@
+namespace NUnit.Runner
+{
+
+ using System;
+
+ /// <summary>A TestSuite loader that can reload classes.</summary>
+ [Obsolete("Use StandardLoader or UnloadingLoader")]
+ public class ReloadingTestSuiteLoader: ITestSuiteLoader
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="suiteClassName"></param>
+ /// <returns></returns>
+ public Type Load(string suiteClassName)
+ {
+ // TestCaseClassLoader loader= new TestCaseClassLoader();
+ // return loader.LoadClass(suiteClassName, true);
+ return Type.GetType(suiteClassName, true);
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="aClass"></param>
+ /// <returns></returns>
+ public Type Reload(Type aClass)
+ {
+ // TestCaseClassLoader loader= new TestCaseClassLoader();
+ // return loader.LoadClass(aClass.ToString(), true);
+ return aClass;
+ }
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/RepeatedTest.cs b/mcs/nunit/src/NUnitCore/RepeatedTest.cs
new file mode 100644
index 00000000000..546bed56d6e
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/RepeatedTest.cs
@@ -0,0 +1,45 @@
+namespace NUnit.Extensions {
+
+ using System;
+
+ using NUnit.Framework;
+ /// <summary>A Decorator that runs a test repeatedly.</summary>
+ public class RepeatedTest: TestDecorator {
+ private readonly int fTimesRepeat;
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ /// <param name="repeat"></param>
+ public RepeatedTest(ITest test, int repeat) : base(test) {
+ if (repeat < 0) {
+ throw new ArgumentOutOfRangeException("repeat", "Repetition count must be > 0");
+ }
+ fTimesRepeat= repeat;
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ public override int CountTestCases {
+ get { return base.CountTestCases * fTimesRepeat; }
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="result"></param>
+ public override void Run(TestResult result) {
+ for (int i= 0; i < fTimesRepeat; i++) {
+ if (result.ShouldStop)
+ break;
+ base.Run(result);
+ }
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString() {
+ return base.ToString()+"(repeated)";
+ }
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/SimpleTestCollector.cs b/mcs/nunit/src/NUnitCore/SimpleTestCollector.cs
new file mode 100644
index 00000000000..e1f73ea959a
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/SimpleTestCollector.cs
@@ -0,0 +1,28 @@
+namespace NUnit.Runner {
+
+ using System;
+
+ /// <summary>
+ /// An implementation of a TestCollector that considers
+ /// a class to be a test class when it contains the
+ /// pattern "Test" in its name
+ /// <see cref="ITestCollector"/>
+ /// </summary>
+ public class SimpleTestCollector: ClassPathTestCollector {
+ /// <summary>
+ ///
+ /// </summary>
+ public SimpleTestCollector() {
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="classFileName"></param>
+ /// <returns></returns>
+ protected override bool IsTestClass(string classFileName) {
+ return
+ (classFileName.EndsWith(".dll") || classFileName.EndsWith(".exe")) &&
+ classFileName.IndexOf("Test") > 0;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/StandardLoader.cs b/mcs/nunit/src/NUnitCore/StandardLoader.cs
new file mode 100755
index 00000000000..5666c56aac3
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/StandardLoader.cs
@@ -0,0 +1,222 @@
+namespace NUnit.Runner
+{
+ using System;
+ using System.Collections;
+ using System.Reflection;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Same as StandardLoader.
+ /// TODO: Clean up "Unloading" concepts in framework
+ /// </summary>
+ public class UnloadingLoader : StandardLoader{}
+
+ /// <summary>
+ /// TestLoader that
+ /// </summary>
+ public class StandardLoader : ITestLoader
+ {
+ #region Overidable loader implementatioons
+ /// <summary>
+ /// Attempts by all means possible to return a test for the given type.
+ /// Check in the following order:
+ /// 1. For a static Suite property, that implments ITest.
+ /// 2. Tries to dynamically create a suite for the type.
+ /// </summary>
+ /// <param name="testClass"></param>
+ /// <returns></returns>
+ protected virtual ITest CoerceTestFrom(Type testClass)
+ {
+ try
+ {
+ ITest test = GetStaticSuiteProperty(testClass);
+ if (test == null )
+ {
+ // try to extract a test suite automatically
+ test = new TestSuite(testClass);
+ }
+ return test;
+ }
+ catch (Exception e)
+ {
+ throw new NUnitException("Error building test for class: "
+ + testClass.FullName,e);
+ }
+ }
+
+ /// <summary>
+ /// Searches for the type specified by the testClassName in the
+ /// specified assembly, and if found, attempts to coerce a test
+ /// from the type.
+ /// </summary>
+ /// <param name="testClassName"></param>
+ /// <param name="assemblyFileName"></param>
+ /// <returns></returns>
+ public virtual ITest LoadTest(string testClassName,
+ string assemblyFileName)
+ {
+ try
+ {
+ return this.CoerceTestFrom(
+ getAssembly(assemblyFileName).GetType(testClassName));
+ }
+ catch (Exception e)
+ {
+ throw new LoaderException("Error loading test class: "
+ + testClassName + "," + assemblyFileName, e);
+ }
+ }
+ /// <summary>
+ /// Determines if a Type is a test.
+ /// </summary>
+ /// <param name="typeToCheck"></param>
+ protected virtual bool IsTestClass(Type typeToCheck)
+ {
+ if(typeToCheck!=null)
+ {
+ if( typeToCheck.IsClass
+ && typeToCheck.IsPublic
+ && !typeToCheck.IsAbstract)
+ {
+ try
+ {
+ if( (typeof(ITest).IsAssignableFrom(typeToCheck)
+ // Has public single string constructor
+ && (typeToCheck.GetConstructor(new Type[]{typeof(string)})!=null))
+ || GetStaticSuiteProperty(typeToCheck)!= null)
+ {
+ return true;
+ }
+ }
+ catch(System.Security.SecurityException)
+ {
+ // eat security exceptions, since shouldn't
+ // have errors on classes we can't access
+ }
+ }
+ return false;
+ }
+ else
+ {
+ throw new ArgumentNullException("typeToCheck");
+ }
+ }
+ /// <summary>
+ /// Uses reflection to obtain the suite property for the Type
+ /// </summary>
+ /// <param name="testClass"></param>
+ /// <returns>The Suite property of the Type, or null if the property
+ /// does not exist</returns>
+ protected virtual TestSuite GetStaticSuiteProperty(Type testClass)
+ {
+ if(testClass!=null)
+ {
+ TestSuite test = null;
+ PropertyInfo suiteProperty = testClass.GetProperty("Suite"
+ ,BindingFlags.Static|BindingFlags.Public
+ ,Type.DefaultBinder // unknown
+ ,typeof(ITest) // Itest return type
+ ,Type.EmptyTypes // no parameters
+ ,new ParameterModifier[0] // unknown
+ );
+ if (suiteProperty != null )
+ {
+ test = (TestSuite)suiteProperty.GetValue(null, new Object[0]);
+ }
+ return test;
+ }
+ else
+ {
+ throw new ArgumentNullException ("testClass");
+ }
+ }
+ private Assembly getAssembly(string assemblyFileName)
+ {
+ try
+ {
+ return Assembly.LoadFrom(assemblyFileName);
+ }
+ catch(ArgumentNullException)
+ {
+ throw new ArgumentNullException("assemblyFileName");
+ }
+ }
+ #endregion
+
+ #region ILoader Methods
+ /// <summary>
+ /// Implements ILoader.GetLoadName().
+ /// </summary>
+ /// <param name="test"></param>
+ /// <returns></returns>
+ public virtual string GetLoadName(ITest test)
+ {
+ Type testType = test.GetType();
+ if(testType.Equals(typeof(TestSuite)))
+ {
+ string tname = test.ToString();
+ testType = Type.GetType(tname);
+ }
+ if(testType != null)
+ return testType.FullName+","+testType.Assembly.CodeBase;
+ else
+ return string.Empty;
+ }
+ /// <summary>
+ /// Implements ILoader.LoadTest().
+ /// Loads an instance of the test class specified by the
+ /// AssemblyQualifiedName. The assembly qualified name
+ /// contains the Full Clas Name, followed by the CodeBase
+ /// (file or url) of the assembly. If the class is found,
+ /// the loader will attempt to return a TestSuite for the
+ /// class. Trying first the static Suite property, followed
+ /// by trying to dynamically create a suite for the class.
+ /// </summary>
+ /// <param name="assemblyQualifiedName">The qualified name
+ /// for the class taking the form
+ /// "Namespace.ClassName,AssemblyFileName" without the quotes.
+ /// Assembly file name can be a fulied qualified path name, or
+ /// a URL.</param>
+ /// <returns></returns>
+ public virtual ITest LoadTest(string assemblyQualifiedName)
+ {
+ if(assemblyQualifiedName==null)
+ throw new ArgumentNullException("assemblyQualifiedName");
+
+ string[] nameParts = assemblyQualifiedName.Split(new Char[]{','});
+ if(nameParts.Length >= 1)
+ {
+ return this.LoadTest(nameParts[0].Trim(),nameParts[1].Trim());
+ }
+ else
+ {
+ throw new ArgumentException("Expected an Assembly Qualified Class"
+ + " Name, containing the file name of the assembly",
+ "assemblyQualifiedName");
+ }
+ }
+ #endregion
+
+ /// <summary>
+ /// Examies all types in the specified assembly and returns a list of those
+ /// types that can be coerced into tests.
+ /// </summary>
+ /// <param name="assemblyFileName"></param>
+ /// <returns></returns>
+ public virtual Type[] GetTestTypes(string assemblyFileName)
+ {
+ Assembly assembly = getAssembly(assemblyFileName);
+ ArrayList Tests = new ArrayList(assembly.GetExportedTypes().Length);
+ foreach(Type typeToCheck in assembly.GetExportedTypes())
+ {
+ if(this.IsTestClass(typeToCheck))
+ {
+ Tests.Add(typeToCheck);
+ }
+ }
+ Type[] ret = new Type[Tests.Count];
+ Tests.CopyTo(ret);
+ return ret;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/StandardTestSuiteLoader.cs b/mcs/nunit/src/NUnitCore/StandardTestSuiteLoader.cs
new file mode 100644
index 00000000000..ebdd9565760
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/StandardTestSuiteLoader.cs
@@ -0,0 +1,47 @@
+namespace NUnit.Runner
+{
+ using System;
+ using System.Reflection;
+ using System.IO;
+ using System.Security;
+
+ /// <summary>
+ /// The standard test suite loader. It can only load the same
+ /// class once.
+ /// </summary>
+ [Obsolete("Use StandardLoader or UnloadingLoader")]
+ public class StandardTestSuiteLoader: ITestSuiteLoader
+ {
+ /// <summary>
+ /// Loads
+ /// </summary>
+ /// <param name="testClassName"></param>
+ /// <returns></returns>
+ public Type Load(string testClassName)
+ {
+ Type testClass;
+ string[] classSpec=testClassName.Split(',');
+ if (classSpec.Length > 1)
+ {
+ FileInfo dll=new FileInfo(classSpec[1]);
+ if (!dll.Exists)
+ throw new FileNotFoundException("File " + dll.FullName + " not found", dll.FullName);
+ Assembly a = Assembly.LoadFrom(dll.FullName);
+ testClass=a.GetType(classSpec[0], true);
+ }
+ else
+ testClass = Type.GetType(testClassName, true);
+ return testClass;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="aClass"></param>
+ /// <returns></returns>
+ public Type Reload(Type aClass)
+ {
+ return aClass;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/TestCase.cs b/mcs/nunit/src/NUnitCore/TestCase.cs
new file mode 100644
index 00000000000..e2e746394bf
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/TestCase.cs
@@ -0,0 +1,241 @@
+namespace NUnit.Framework
+{
+ using System;
+ using System.Reflection;
+
+ /// <summary>A test case defines the fixture to run multiple Tests.</summary>
+ /// <remarks> To define a test case
+ /// <list type="number">
+ /// <item><description>implement a subclass of TestCase</description></item>
+ /// <item><description>define instance variables that store the state
+ /// of the fixture</description></item>
+ /// <item><description>initialize the fixture state by overriding
+ /// <c>SetUp</c></description></item>
+ /// <item><description>clean-up after a test by overriding
+ /// <c>TearDown</c></description></item>
+ /// </list>
+ /// Each test runs in its own fixture so there can be no side effects
+ /// among test runs.
+ /// <example>Here is an example:
+ /// <code>
+ /// public class MathTest: TestCase {
+ /// protected double fValue1;
+ /// protected double fValue2;
+ ///
+ /// public MathTest(string name) : base(name) {}
+ ///
+ /// protected override void SetUp() {
+ /// fValue1= 2.0;
+ /// fValue2= 3.0;
+ /// }
+ /// }</code>
+ /// </example>
+ ///
+ /// For each test implement a method which interacts with the fixture.
+ /// Verify the expected results with Assertions specified by calling
+ /// <c>Assert</c> with a bool.
+ /// <code>
+ /// protected void TestAdd() {
+ /// double result= fValue1 + fValue2;
+ /// Assert(result == 5.0);
+ /// }
+ /// </code>
+ /// Once the methods are defined you can run them. The framework supports
+ /// both a static type safe and more dynamic way to run a test.
+ /// In the static way you override the runTest method and define the method
+ /// to be invoked.
+ /// <code>
+ /// protected class AddMathTest: TestCase {
+ /// public void AddMathTest(string name) : base(name) {}
+ /// protected override void RunTest() { TestAdd(); }
+ /// }
+ ///
+ /// test test= new AddMathTest("Add");
+ /// test.Run();
+ /// </code>
+ /// The dynamic way uses reflection to implement <c>RunTest</c>. It
+ /// dynamically finds and invokes a method. In this case the name of the
+ /// test case has to correspond to the test method to be run.
+ /// <code>
+ /// test= new MathTest("TestAdd");
+ /// test.Run();
+ /// </code>
+ /// The Tests to be run can be collected into a <see cref="TestSuite"/>.
+ /// NUnit provides different test runners which can run a test suite
+ /// and collect the results.
+ /// A test runner either expects a static property <c>Suite</c> as the entry
+ /// point to get a test to run or it will extract the suite automatically.
+ /// <code>
+ /// public static ITest Suite {
+ /// get {
+ /// suite.AddTest(new MathTest("TestAdd"));
+ /// suite.AddTest(new MathTest("TestDivideByZero"));
+ /// return suite;
+ /// }
+ /// }
+ /// </code></remarks>
+ /// <seealso cref="TestResult"/>
+ /// <seealso cref="TestSuite"/>
+ public abstract class TestCase: Assertion, ITest
+ {
+ #region Instance Variables
+ /// <summary>the name of the test case.</summary>
+ private readonly string fName;
+ #endregion
+
+ #region Constructors
+ /// <summary>Constructs a test case with no name.</summary>
+ public TestCase() : this(String.Empty){}
+
+ /// <summary>Constructs a test case with the given name.</summary>
+ public TestCase(string testName)
+ {
+ this.fName = testName;
+ }
+ #endregion
+
+ #region Properties
+ /// <value>Counts the number of test cases executed by
+ /// Run(TestResult result).</value>
+ public int CountTestCases
+ {
+ get { return 1; }
+ }
+
+ /// <value>The name of the test case.</value>
+ public string Name
+ {
+ get { return this.fName; }
+ }
+ #endregion
+
+ #region Utility Methods
+ /// <summary>Creates a default <see cref="TestResult"/> object.</summary>
+ protected TestResult CreateResult()
+ {
+ return new TestResult();
+ }
+ #endregion
+
+ #region Run Methods
+ /// <summary>A convenience method to run this test, collecting the
+ /// results with a default <see cref="TestResult"/> object.</summary>
+ public TestResult Run()
+ {
+ TestResult result = this.CreateResult();
+ this.Run(result);
+ return result;
+ }
+
+ /// <summary>Runs the test case and collects the results in
+ /// TestResult.</summary>
+ public void Run(TestResult result)
+ {
+ result.Run(this);
+ }
+
+ /// <summary>Runs the bare test sequence.</summary>
+ public void RunBare()
+ {
+ this.SetUp();
+ try
+ {
+ this.RunTest();
+ }
+ finally
+ {
+ this.TearDown();
+ }
+ }
+
+ /// <summary>Override to run the test and Assert its state.</summary>
+ protected virtual void RunTest()
+ {
+ MethodInfo runMethod = GetType().GetMethod(this.Name, new Type[0]);
+ if (runMethod == null)
+ Assertion.Fail("Method \""+this.Name+"\" not found");
+
+ if (runMethod != null && !runMethod.IsPublic)
+ {
+ Assertion.Fail("Method \""+this.Name+"\" should be public");
+ }
+
+ object[] exa =
+ runMethod.GetCustomAttributes(typeof(ExpectExceptionAttribute),true);
+
+ try
+ {
+ runMethod.Invoke(this, null);
+ }
+ catch (AssertionFailedError e)
+ {
+ throw new NUnitException("Run Error: ", e);
+ }
+ catch (TargetInvocationException e)
+ {
+ Exception inner = e.InnerException;
+ if (inner is AssertionFailedError)
+ {
+ throw new NUnitException("Run Error: ", inner);
+ }
+ if (exa.Length>0)
+ {
+ foreach (ExpectExceptionAttribute ex in exa)
+ {
+ if (ex.ExceptionExpected.IsAssignableFrom(inner.GetType()))
+ return;
+ }
+ Assertion.Fail("Unexpected Exception thrown: " + inner);
+ }
+ else
+ {
+ throw new NUnitException("Run Error: ", inner);
+ }
+ }
+ catch (MemberAccessException e)
+ {
+ throw new NUnitException("", e);
+ }
+
+ if (exa.Length > 0)
+ {
+ System.Text.StringBuilder sb =
+ new System.Text.StringBuilder
+ ("One of these exceptions should have been thrown: ");
+ bool first = true;
+ foreach (ExpectExceptionAttribute ex in exa)
+ {
+ if(first)
+ first = false;
+ else
+ sb.Append(", ");
+ sb.Append(ex);
+ }
+ Assertion.Fail(sb.ToString());
+ }
+ }
+
+ /// <summary>
+ /// Sets up the fixture, for example, open a network connection.
+ /// This method is called before a test is executed.
+ /// </summary>
+ protected virtual void SetUp() {}
+ /// <summary>
+ /// Tears down the fixture, for example, close a network
+ /// connection. This method is called after a test is executed.
+ /// </summary>
+ protected virtual void TearDown() {}
+ #endregion
+
+ #region Overrides
+ /// <summary>
+ /// Returns a string representation of the test case.
+ /// </summary>
+ public override string ToString()
+ {
+ return this.Name+"("+this.GetType().ToString()+")";
+ }
+ #endregion
+
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/TestCaseClassLoader.cs b/mcs/nunit/src/NUnitCore/TestCaseClassLoader.cs
new file mode 100644
index 00000000000..80fc7e89100
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/TestCaseClassLoader.cs
@@ -0,0 +1,208 @@
+namespace NUnit.Runner
+{
+ using System;
+
+ /// <summary>
+ ///
+ /// </summary>
+ [Obsolete("Use StandardLoader or UnloadingLoader")]
+ public class TestCaseClassLoader : StandardTestSuiteLoader
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="name"></param>
+ /// <param name="resolve"></param>
+ /// <returns></returns>
+ public Type LoadClass(string name, bool resolve)
+ {
+ return Load(name);
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="name"></param>
+ /// <returns></returns>
+ public bool IsExcluded(string name)
+ {
+ return false;
+ }
+ }
+}
+
+
+#if false
+// commented out till figure out .net class reloading
+
+namespace NUnit.Runner {
+
+ /**
+ * A custom class loader which enables the reloading
+ * of classes for each test run. The class loader
+ * can be configured with a list of package paths that
+ * should be excluded from loading. The loading
+ * of these packages is delegated to the system class
+ * loader. They will be shared across test runs.
+ * <p>
+ * The list of excluded package paths is specified in
+ * a properties file "excluded.properties" that is located in
+ * the same place as the TestCaseClassLoader class.
+ * <p>
+ * <b>Known limitation:</b> the TestCaseClassLoader cannot load classes
+ * from jar files.
+ */
+
+
+ public class TestCaseClassLoader: ClassLoader {
+ /** scanned class path */
+ private string[] fPathItems;
+ /** excluded paths */
+ private string[] fExcluded= { "com.sun.", "sun."};
+ /** name of excluded properties file */
+ static final string EXCLUDED_FILE= "excluded.properties";
+ /**
+ * Constructs a TestCaseLoader. It scans the class path
+ * and the excluded package paths
+ */
+ public TestCaseClassLoader() {
+ super();
+ string classPath= System.getProperty("java.class.path");
+ string separator= System.getProperty("path.separator");
+
+ // first pass: count elements
+ StringTokenizer st= new StringTokenizer(classPath, separator);
+ int i= 0;
+ while (st.hasMoreTokens()) {
+ st.nextToken();
+ i++;
+ }
+ // second pass: split
+ fPathItems= new string[i];
+ st= new StringTokenizer(classPath, separator);
+ i= 0;
+ while (st.hasMoreTokens()) {
+ fPathItems[i++]= st.nextToken();
+ }
+
+ string[] excluded= ReadExcludedPackages();
+ if (excluded != null)
+ fExcluded= excluded;
+ }
+ public java.net.URL GetResource(string name) {
+ return ClassLoader.getSystemResource(name);
+ }
+ public InputStream GetResourceAsStream(string name) {
+ return ClassLoader.getSystemResourceAsStream(name);
+ }
+ protected boolean IsExcluded(string name) {
+ // exclude the "java" and "junit" packages.
+ // They always need to be excluded so that they are loaded by the system class loader
+ if (name.startsWith("java.") ||
+ name.startsWith("junit.framework") ||
+ name.startsWith("junit.extensions") ||
+ name.startsWith("junit.util") ||
+ name.startsWith("junit.ui"))
+ return true;
+
+ // exclude the user defined package paths
+ for (int i= 0; i < fExcluded.length; i++) {
+ if (name.startsWith(fExcluded[i])) {
+ return true;
+ }
+ }
+ return false;
+ }
+ public synchronized Class LoadClass(string name, boolean resolve)
+ throws ClassNotFoundException {
+
+ Class c= FindLoadedClass(name);
+ if (c != null)
+ return c;
+ //
+ // Delegate the loading of excluded classes to the
+ // standard class loader.
+ //
+ if (IsExcluded(name)) {
+ try {
+ c= findSystemClass(name);
+ return c;
+ } catch (ClassNotFoundException e) {
+ // keep searching
+ }
+ }
+ if (c == null) {
+ File file= Locate(name);
+ if (file == null)
+ throw new ClassNotFoundException();
+ byte data[]= LoadClassData(file);
+ c= defineClass(name, data, 0, data.length);
+ }
+ if (resolve)
+ resolveClass(c);
+ return c;
+ }
+ private byte[] LoadClassData(File f) throws ClassNotFoundException {
+ try {
+ //System.out.println("loading: "+f.getPath());
+ FileInputStream stream= new FileInputStream(f);
+
+ try {
+ byte[] b= new byte[stream.available()];
+ stream.read(b);
+ stream.close();
+ return b;
+ }
+ catch (IOException e) {
+ throw new ClassNotFoundException();
+ }
+ }
+ catch (FileNotFoundException e) {
+ throw new ClassNotFoundException();
+ }
+ }
+ /**
+ * Locate the given file.
+ * @return Returns null if file couldn't be found.
+ */
+ private File Locate(string fileName) {
+ fileName= fileName.replace('.', '/')+".class";
+ File path= null;
+
+ if (fileName != null) {
+ for (int i= 0; i < fPathItems.length; i++) {
+ path= new File(fPathItems[i], fileName);
+ if (path.exists())
+ return path;
+ }
+ }
+ return null;
+ }
+ private string[] ReadExcludedPackages() {
+ InputStream is= getClass().GetResourceAsStream(EXCLUDED_FILE);
+ if (is == null)
+ return null;
+ Properties p= new Properties();
+ try {
+ p.Load(is);
+ }
+ catch (IOException e) {
+ return null;
+ }
+ Vector v= new Vector(10);
+ for (Enumeration e= p.propertyNames(); e.hasMoreElements(); ) {
+ string key= (string)e.nextElement();
+ if (key.startsWith("excluded.")) {
+ string path= p.getProperty(key);
+ if (path.endsWith("*"))
+ path= path.substring(0, path.length()-1);
+ if (path.length() > 0)
+ v.addElement(path);
+ }
+ }
+ string[] excluded= new string[v.size()];
+ for (int i= 0; i < v.size(); i++)
+ excluded[i]= (string)v.elementAt(i);
+ return excluded;
+ }
+ }
+#endif
diff --git a/mcs/nunit/src/NUnitCore/TestDecorator.cs b/mcs/nunit/src/NUnitCore/TestDecorator.cs
new file mode 100644
index 00000000000..eded1c24ba5
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/TestDecorator.cs
@@ -0,0 +1,71 @@
+namespace NUnit.Extensions
+{
+ using System;
+ using NUnit.Framework;
+
+ /// <summary>A Decorator for Tests.</summary>
+ /// <remarks>Use TestDecorator as the base class
+ /// for defining new test decorators. TestDecorator subclasses
+ /// can be introduced to add behaviour before or after a test
+ /// is run.</remarks>
+ public class TestDecorator: Assertion, ITest
+ {
+ /// <summary>
+ /// A reference to the test that is being decorated
+ /// </summary>
+ protected readonly ITest fTest;
+ /// <summary>
+ /// Creates a decorator for the supplied test
+ /// </summary>
+ /// <param name="test">The test to be decorated</param>
+ public TestDecorator(ITest test)
+ {
+ if(test!= null)
+ {
+ this.fTest= test;
+ }
+ else
+ throw new ArgumentNullException("test");
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="result"></param>
+ public virtual void Run(TestResult result)
+ {
+ this.BasicRun(result);
+ }
+ /// <summary>The basic run behaviour.</summary>
+ public void BasicRun(TestResult result)
+ {
+ this.fTest.Run(result);
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ public virtual int CountTestCases
+ {
+ get { return fTest.CountTestCases; }
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ public ITest GetTest
+ {
+ get { return fTest; }
+ }
+ //public string Name
+ //{
+ // get{return fTest.Name;}
+ //}
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ return fTest.ToString();
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/TestFailure.cs b/mcs/nunit/src/NUnitCore/TestFailure.cs
new file mode 100644
index 00000000000..4dad5bd02bd
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/TestFailure.cs
@@ -0,0 +1,55 @@
+namespace NUnit.Framework
+{
+ using System;
+ using System.Diagnostics;
+ using System.IO;
+ using System.Text;
+
+ /// <summary>
+ /// A <c>TestFailure</c> collects a failed test together with
+ /// the caught exception.
+ /// </summary>
+ /// <seealso cref="TestResult"/>
+ public class TestFailure : MarshalByRefObject
+ {
+ private readonly ITest fFailedTest;
+ private readonly Exception fThrownException;
+
+ /// <summary>
+ /// Constructs a TestFailure with the given test and exception.
+ /// </summary>
+ public TestFailure(ITest theFailedTest, Exception theThrownException)
+ {
+ if(theFailedTest==null)
+ throw new ArgumentNullException("theFailedTest");
+ if(theThrownException==null)
+ throw new ArgumentNullException("theThrownException");
+ this.fFailedTest = theFailedTest;
+ this.fThrownException = theThrownException;
+ }
+
+ /// <value>Gets the failed test.</value>
+ public ITest FailedTest
+ {
+ get { return this.fFailedTest; }
+ }
+
+ /// <value>True if it's a failure, false if error.</value>
+ public bool IsFailure
+ {
+ get { return this.fThrownException is AssertionFailedError; }
+ }
+
+ /// <value>Gets the thrown exception.</value>
+ public Exception ThrownException
+ {
+ get { return this.fThrownException; }
+ }
+
+ /// <summary>Returns a short description of the failure.</summary>
+ public override string ToString()
+ {
+ return this.fFailedTest + ": " + this.fThrownException.Message;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/TestResult.cs b/mcs/nunit/src/NUnitCore/TestResult.cs
new file mode 100644
index 00000000000..ff274a8c4ff
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/TestResult.cs
@@ -0,0 +1,249 @@
+namespace NUnit.Framework
+{
+ using System;
+ using System.Collections;
+ using System.Threading;
+
+ /// <summary>A <c>TestResult</c> collects the results of executing
+ /// a test case. It is an instance of the Collecting Parameter pattern.
+ /// </summary><remarks>
+ /// The test framework distinguishes between failures and errors.
+ /// A failure is anticipated and checked for with assertions. Errors are
+ /// unanticipated problems like an <c>ArgumentOutOfRangeException</c>.
+ /// </remarks><seealso cref="ITest"/>
+ public class TestResult : MarshalByRefObject
+ {
+ #region Instance Variables
+ private ArrayList fFailures;
+ private ArrayList fErrors;
+ private ArrayList fListeners;
+ private int fRunTests;
+ private bool fStop;
+ #endregion
+
+ #region Constructors
+ /// <summary>
+ ///
+ /// </summary>
+ public TestResult()
+ {
+ fFailures= new ArrayList();
+ fErrors= new ArrayList();
+ fListeners= new ArrayList();
+ }
+ #endregion
+
+ #region Collection Methods
+ /// <summary>
+ /// Adds an error to the list of errors. The passed in exception
+ /// caused the error.
+ /// </summary>
+ public void AddError(ITest test, Exception error)
+ {
+ lock(this)
+ {
+ this.fErrors.Add(new TestFailure(test, error));
+ foreach (ITestListener listner in CloneListeners())
+ {
+ listner.AddError(test, error);
+ }
+ }
+ }
+ /// <summary>
+ /// Adds a failure to the list of failures. The passed in
+ /// exception caused the failure.
+ /// </summary>
+ public void AddFailure(ITest test, AssertionFailedError failure)
+ {
+ lock(this)
+ {
+ fFailures.Add(new TestFailure(test, failure));
+ foreach (ITestListener listner in CloneListeners())
+ {
+ listner.AddFailure(test, failure);
+ }
+ }
+ }
+ #endregion
+
+ #region Events
+ /// <summary>Registers a TestListener.</summary>
+ public void AddListener(ITestListener listener)
+ {
+ lock(this)
+ this.fListeners.Add(listener);
+ }
+ /// <summary>Unregisters a TestListener</summary>
+ public void RemoveListener(ITestListener listener)
+ {
+ lock(this)
+ {
+ fListeners.Remove(listener);
+ }
+ }
+ /// <summary>Returns a copy of the listeners.</summary>
+ private ArrayList CloneListeners()
+ {
+ lock(this)
+ {
+ return (ArrayList)fListeners.Clone();
+ }
+ }
+ /// <summary>Informs the result that a test was completed.</summary>
+ public void EndTest(ITest test)
+ {
+ foreach (ITestListener listner in CloneListeners())
+ {
+ listner.EndTest(test);
+ }
+ }
+ /// <summary>Informs the result that a test will be started.</summary>
+ public void StartTest(ITest test)
+ {
+ lock(this)
+ {
+ this.fRunTests += test.CountTestCases;
+ }
+ foreach (ITestListener listner in CloneListeners())
+ {
+ listner.StartTest(test);
+ }
+ }
+ #endregion
+
+ #region Properties
+ /// <value>Gets the number of run tests.</value>
+ public int RunCount
+ {
+ get {lock(this)return this.fRunTests; }
+ }
+ /// <value>Gets the number of detected errors.</value>
+ public int ErrorCount
+ {
+ get {lock(this)return this.fErrors.Count; }
+ }
+ /// <value>Gets the number of detected failures.</value>
+ public int FailureCount
+ {
+ get {lock(this)return this.fFailures.Count; }
+ }
+ /// <summary>Checks whether the test run should stop.</summary>
+ public bool ShouldStop
+ {
+ get {lock(this)return this.fStop; }
+ }
+ /// <value>Returns whether the entire test was successful or not.</value>
+ public bool WasSuccessful
+ {
+ get
+ {
+ lock(this)
+ {
+ return (this.FailureCount == 0)
+ && (this.ErrorCount == 0);
+ }
+ }
+ }
+ /// <value>Returns a TestFailure[] for the errors.</value>
+ public TestFailure[] Errors
+ {
+ get
+ {
+ lock(this)
+ {
+ TestFailure[] retVal = new TestFailure[this.fErrors.Count];
+ this.fErrors.CopyTo(retVal);
+ return retVal;
+ }
+ }
+ }
+ /// <value>Returns a TestFauiler[] for the failures.</value>
+ public TestFailure[] Failures
+ {
+ get
+ {
+ lock(this)
+ {
+ TestFailure[] retVal = new TestFailure[this.fFailures.Count];
+ this.fFailures.CopyTo(retVal);
+ return retVal;
+ }
+ }
+ }
+ #endregion
+
+ #region Nested Classes
+ /// <summary>Runs a TestCase.</summary>
+ protected class ProtectedProtect: IProtectable
+ {
+ private TestCase fTest;
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ public ProtectedProtect(TestCase test)
+ {
+ if(test != null)
+ {
+ this.fTest = test;
+ }
+ else
+ {
+ throw new ArgumentNullException("test");
+ }
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ public void Protect()
+ {
+ this.fTest.RunBare();
+ }
+ }
+ #endregion
+
+ #region Run Methods
+ /// <summary>Runs a TestCase.</summary>
+ internal void Run(TestCase test)
+ {
+ StartTest(test);
+ IProtectable p = new ProtectedProtect(test);
+ RunProtected(test, p);
+ EndTest(test);
+ }
+
+ /// <summary>Runs a TestCase.</summary>
+ public void RunProtected(ITest test, IProtectable p)
+ {
+ try
+ {
+ p.Protect();
+ }
+ catch (AssertionFailedError e)
+ {
+ AddFailure(test, e);
+ }
+ catch (NUnitException e)
+ {
+ if (e.IsAssertionFailure)
+ AddFailure(test, (AssertionFailedError)e.InnerException);
+ else
+ AddError(test, e.InnerException);
+ }
+ catch (ThreadAbortException e)
+ { // don't catch by accident
+ throw e;
+ }
+ catch (System.Exception e)
+ {
+ AddError(test, e);
+ }
+ }
+ /// <summary>Marks that the test run should stop.</summary>
+ public void Stop()
+ {
+ fStop= true;
+ }
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit/src/NUnitCore/TestSetup.cs b/mcs/nunit/src/NUnitCore/TestSetup.cs
new file mode 100644
index 00000000000..95823504015
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/TestSetup.cs
@@ -0,0 +1,70 @@
+namespace NUnit.Extensions
+{
+ using System;
+ using NUnit.Framework;
+
+ /// <summary>A Decorator to set up and tear down additional fixture state.
+ /// </summary><remarks>
+ /// Subclass TestSetup and insert it into your tests when you want
+ /// to set up additional state once before the tests are run.</remarks>
+ public class TestSetup: TestDecorator
+ {
+ #region Constructors
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ public TestSetup(ITest test) : base(test) {}
+ #endregion
+
+ #region Nested Classes
+ /// <summary>
+ ///
+ /// </summary>
+ protected class ProtectedProtect: IProtectable
+ {
+ private readonly TestSetup fTestSetup;
+ private readonly TestResult fTestResult;
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="testSetup"></param>
+ /// <param name="testResult"></param>
+ public ProtectedProtect(TestSetup testSetup, TestResult testResult)
+ {
+ if(testSetup == null)
+ throw new ArgumentNullException("testSetup");
+ if(testResult == null)
+ throw new ArgumentNullException("testResult");
+ this.fTestSetup = testSetup;
+ this.fTestResult = testResult;
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ void IProtectable.Protect()
+ {
+ this.fTestSetup.SetUp();
+ this.fTestSetup.BasicRun(fTestResult);
+ this.fTestSetup.TearDown();
+ }
+ }
+ #endregion
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="result"></param>
+ public override void Run(TestResult result)
+ {
+ IProtectable p = new ProtectedProtect(this, result);
+ result.RunProtected(this, p);
+ }
+ /// <summary>Sets up the fixture. Override to set up additional fixture
+ /// state.</summary>
+ protected virtual void SetUp() {}
+ /// <summary>Tears down the fixture. Override to tear down the additional
+ /// fixture state.</summary>
+ protected virtual void TearDown() {}
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/TestSuite.cs b/mcs/nunit/src/NUnitCore/TestSuite.cs
new file mode 100644
index 00000000000..7febc1150f5
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/TestSuite.cs
@@ -0,0 +1,293 @@
+namespace NUnit.Framework
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Specialized;
+ using System.Reflection;
+
+ /// <summary>A <c>TestSuite</c> is a <c>Composite</c> of Tests.</summary>
+ /// <remarks>It runs a collection of test cases. Here is an example using
+ /// the dynamic test definition.
+ /// <code>
+ /// TestSuite suite= new TestSuite();
+ /// suite.AddTest(new MathTest("TestAdd"));
+ /// suite.AddTest(new MathTest("TestDivideByZero"));
+ /// </code>
+ /// Alternatively, a TestSuite can extract the Tests to be run automatically.
+ /// To do so you pass the class of your TestCase class to the
+ /// TestSuite constructor.
+ /// <code>
+ /// TestSuite suite= new TestSuite(typeof(MathTest));
+ /// </code>
+ /// This constructor creates a suite with all the methods
+ /// starting with "Test" that take no arguments.</remarks>
+ /// <seealso cref="ITest"/>
+ public class TestSuite: MarshalByRefObject, ITest
+ {
+ #region Instance Variables
+ private ArrayList fTests= new ArrayList(10);
+ private string fName;
+ private bool fSupressWarnings = false;
+ private string fDynamicConstructionQualifiedName= string.Empty;
+
+ #endregion
+
+ #region Constructors
+ /// <summary>Constructs an empty TestSuite with a name.</summary>
+ public TestSuite(string name)
+ {
+ if(name==null)
+ this.fName=String.Empty;
+ this.fName = name;
+ }
+
+ /// <summary>Constructs an empty TestSuite with no name.</summary>
+ public TestSuite() : this(String.Empty){}
+
+ /// <summary>Constructs a TestSuite from the given class.</summary>
+ /// <remarks>Adds all the methods starting with "Test" as test cases
+ /// to the suite. Parts of this method was written at 2337 meters in
+ /// the Hüffihütte, Kanton Uri</remarks>
+ /// <param name="theClass"></param>
+ /// <param name="supressWarnings"></param>
+ public TestSuite(Type theClass, bool supressWarnings) :
+ this(theClass.FullName)
+ {
+ this.fSupressWarnings = supressWarnings;
+ //REFACTOR: these checks are also found in AssemblyTestCollector
+ if( theClass.IsClass
+ && (theClass.IsPublic || theClass.IsNestedPublic)
+ && !theClass.IsAbstract
+ && typeof(ITest).IsAssignableFrom(theClass)
+ )
+ {
+ ConstructorInfo FixtureConstructor = GetConstructor(theClass);
+ if(FixtureConstructor != null)
+ {
+ {
+ MethodInfo[] methods = theClass.GetMethods(
+ BindingFlags.Public
+ |BindingFlags.NonPublic
+ |BindingFlags.Instance
+ );
+ foreach (MethodInfo method in methods)
+ {
+ AddTestMethod(method, FixtureConstructor);
+ }
+ if (this.fTests.Count == 0)
+ AddWarning("No Tests found in "+theClass.ToString());
+ }
+ }
+ else
+ {
+ AddWarning("Class "+theClass.Name
+ +" has no public constructor TestCase(String name)");
+ }
+ }
+ else
+ {
+ AddWarning("Type '" + theClass.Name
+ +"' must be a public, not abstract class that"
+ +" implements ITest.");
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="theClass"></param>
+ public TestSuite(Type theClass) : this(theClass,false){}
+ #endregion
+
+ #region Collection Methods
+ /// <summary>Adds a test to the suite.</summary>
+ public void AddTest(ITest test)
+ {
+ fTests.Add(test);
+ }
+
+ /// <summary>Adds the tests from the given class to the suite</summary>
+ public void AddTestSuite(Type testClass)
+ {
+ AddTest(new TestSuite(testClass));
+ }
+ #endregion
+
+ #region Dynamic Test Case Creation
+ //private void AddTestMethod(MethodInfo m, StringCollection names,
+ private void AddTestMethod(MethodInfo m,
+ ConstructorInfo constructor)
+ {
+ string name = m.Name;
+ if (IsPublicTestMethod(m))
+ {
+ Object[] args= new Object[]{name};
+ try
+ {
+ AddTest((ITest)constructor.Invoke(args));
+ }
+ catch (TypeLoadException e)
+ {
+ AddWarning("Cannot instantiate test case: "+name + "( " + e.ToString() + ")");
+ }
+ catch (TargetInvocationException e)
+ {
+ AddWarning("Exception in constructor: "+name + "( " + e.ToString() + ")");
+ }
+ catch (MemberAccessException e)
+ {
+ AddWarning("Cannot access test case: "+name + "( " + e.ToString() + ")");
+ }
+ }
+ else
+ { // almost a test method
+ if (IsTestMethod(m))
+ AddWarning("test method isn't public: "+m.Name);
+ }
+ }
+
+ /// <summary>Gets a constructor which takes a single string as
+ /// its argument.</summary>
+ private ConstructorInfo GetConstructor(Type theClass)
+ {
+ //REFACTOR: these checks are also found in AssemblyTestCollector
+ return theClass.GetConstructor(new Type[]{typeof(string)});
+ }
+
+ private bool IsPublicTestMethod(MethodInfo methodToCheck)
+ {
+ return methodToCheck.IsPublic
+ && IsTestMethod(methodToCheck);
+ }
+
+ private bool IsTestMethod(MethodInfo methodToCheck)
+ {
+ return
+ !methodToCheck.IsAbstract
+ && methodToCheck.GetParameters().Length == 0
+ && methodToCheck.ReturnType.Equals(typeof(void))
+ && methodToCheck.Name.ToLower().StartsWith("test")
+ ;
+ }
+ #endregion
+
+ #region Properties
+ /// <summary>
+ /// Returns the name of the suite. Not all test suites have a name
+ /// and this method can return null.
+ /// </summary>
+ public string Name
+ {
+ get { return this.fName; }
+ }
+
+ /// <summary>
+ /// The number of test cases that will be run by this test.
+ /// </summary>
+ public int CountTestCases
+ {
+ get
+ {
+ int count= 0;
+ foreach (ITest test in this.Tests)
+ {
+ count += test.CountTestCases;
+ }
+ return count;
+ }
+ }
+
+ /// <value>The number of Tests in this suite.</value>
+ public int TestCount
+ {
+ get {return this.fTests.Count; }
+ }
+
+ /// <value>The test at the given index.</value>
+ /// <remarks>Formerly TestAt(int).</remarks>
+ public ITest this[int index]
+ {
+ get {return (ITest)this.fTests[index]; }
+ }
+
+ /// <value>The Tests as a Test[].</value>
+ public ITest[] Tests
+ {
+ get {
+ ITest[] ret = new ITest[this.fTests.Count];
+ this.fTests.CopyTo(ret);
+ return ret;
+ }
+ }
+ #endregion
+
+ #region Utility Methods
+ private void AddWarning(string message)
+ {
+ if(!this.fSupressWarnings)
+ AddTest(new WarningFail(message));
+ }
+ #endregion
+
+ #region Run Methods
+ /// <summary>Runs the Tests and collects their result in a
+ /// TestResult.</summary>
+ public virtual void Run(TestResult result)
+ {
+ foreach (ITest test in Tests)
+ {
+ if (result.ShouldStop )
+ break;
+ RunTest(test, result);
+ }
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="test"></param>
+ /// <param name="result"></param>
+ public virtual void RunTest(ITest test, TestResult result)
+ {
+ test.Run(result);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ #endregion
+
+ #region Overrides
+ public override string ToString()
+ {
+ return this.Name;
+ }
+ #endregion
+
+ #region Nested Classes
+ /// <summary>A test which will fail and log a warning
+ /// message.</summary>
+ public class WarningFail : TestCase
+ {
+ private string fMessage;
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="message"></param>
+ public WarningFail(string message): base("warning")
+ {
+ this.fMessage = message;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ protected override void RunTest()
+ {
+ Assertion.Fail(fMessage);
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit/src/NUnitCore/Version.cs b/mcs/nunit/src/NUnitCore/Version.cs
new file mode 100644
index 00000000000..bc7770df126
--- /dev/null
+++ b/mcs/nunit/src/NUnitCore/Version.cs
@@ -0,0 +1,23 @@
+namespace NUnit.Runner
+{
+ using System.Reflection;
+ /// <summary>
+ /// This class defines the current version of NUnit
+ /// </summary>
+ public class Version
+ {
+ private Version()
+ {
+ // don't instantiate
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public static string id()
+ {
+ return Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ //return "1.10";
+ }
+ }
+}
diff --git a/mcs/tests/ChangeLog b/mcs/tests/ChangeLog
new file mode 100755
index 00000000000..89c1ca17ed1
--- /dev/null
+++ b/mcs/tests/ChangeLog
@@ -0,0 +1,341 @@
+2002-04-22 Ravi Pratap <ravi@ximian.com>
+
+ * test-104.cs : Another overload resolution test !
+
+2002-04-05 Ravi Pratap <ravi@ximian.com>
+
+ * test-101.cs : Add test from Paolo.
+
+ * test-102.cs : Another test for attribute emission.
+
+2002-04-05 Ravi Pratap <ravi@ximian.com>
+
+ * test-90.cs : Fix bug where we had no class !
+
+ * test-96.cs : Here too !
+
+ * test-98.cs : Supply a missing Main.
+
+2002-03-27 Miguel de Icaza <miguel@ximian.com>
+
+ * test-18.cs: Augment test with the multi-flow try/catch.
+
+2002-03-21 Miguel de Icaza <miguel@ximian.com>
+
+ * test-49.cs: Improved test to excerise the coverage.
+
+2002-03-13 Ravi Pratap <ravi@ximian.com>
+
+ * test-86.cs : Add. This is to check for correct overload resolution
+ with a null literal.
+
+2002-03-07 Ravi Pratap <ravi@ximian.com>
+
+ * test-82.cs : Add.
+
+2002-03-07 Miguel de Icaza <miguel@ximian.com>
+
+ * test-52.cs: Expanded test to cover more cases of foreach.
+
+2002-03-05 Ravi Pratap <ravi@ximian.com>
+
+ * test-81.cs : Add.
+
+ * makefile : Update accordingly as this test passes.
+
+2002-02-20 Miguel de Icaza <miguel@ximian.com>
+
+ * unsafe-1.cs: Extend test.
+
+2002-01-18 Miguel de Icaza <miguel@ximian.com>
+
+ * test-7.cs: Fix test (i.i wsa invalid)
+
+2002-01-18 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
+
+2002-01-13 Ravi Pratap <ravi@ximian.com>
+
+ * test-58.cs : Since it was a duplicate, replace with unsafe
+ code testing.
+
+2002-01-08 Miguel de Icaza <miguel@ximian.com>
+
+ * test-34.cs: Improve this test to check ref/ref cases.
+
+2002-01-02 Ravi Pratap <ravi@ximian.com>
+
+ * test-45.cs : Augment to exercise support for array initialization
+ for various other types.
+
+2001-12-30 Miguel de Icaza <miguel@ximian.com>
+
+ * test-67.cs: Improve this test.
+
+2001-12-29 Ravi Pratap <ravi@ximian.com>
+
+ * test-69.cs : Add. This tests support for methods which are
+ internal calls.
+
+2001-12-28 Ravi Pratap <ravi@ximian.com>
+
+ * test-34.cs : Update to exercise the new overload resolution
+ code.
+
+2001-12-26 Ravi Pratap <ravi@ximian.com>
+
+ * test-67.cs : Add. These are tests for explicit layout
+ of structs and classes.
+
+ * makefile : Update accordingly.
+
+2001-12-25 Ravi Pratap <ravi@ximian.com>
+
+ * test-57.cs : Update to exercise more of the code base for
+ events.
+
+2001-12-24 Ravi Pratap <ravi@ximian.com>
+
+ * test-19.cs : Augment to exercise tests on delegates
+ defined in mscorlib.
+
+ * test-57.cs : Update to exercise the -= operator
+ as well.
+
+2001-12-23 Ravi Pratap <ravi@ximian.com>
+
+ * test-57.cs : Update.
+
+ * makefile : Update to include the above as it passes nicely.
+
+2001-12-21 Ravi Pratap <ravi@ximian.com>
+
+ * test-19.cs : Augment to exercise code which fixed the bug
+ where we were not generating a This for the delegate's
+ instance expression - for the non-static methods ie.
+
+2001-12-15 Miguel de Icaza <miguel@ximian.com>
+
+ * test-45.cs: Make test also use variables as arguments to new;
+ We used to have a bug in the compiler that did not resolve some of
+ the arguments.
+
+2001-12-15 Ravi Pratap <ravi@ximian.com>
+
+ * makefile : Include test-52.cs in the suite, it works fine!
+
+ (NO_PASS): It's test-51 which doesn't seem to pass.
+
+ * test-50.cs : Augment some more to set named arguments on
+ the DllImport attribute.
+
+ * test-57.cs : Add. This tests support for Events and does not
+ pass yet.
+
+2001-12-14 Ravi Pratap <ravi@ximian.com>
+
+ * test-45.cs : Update for float and double initialization.
+
+2001-12-13 Miguel de Icaza <miguel@ximian.com>
+
+ * makefile (test-30): Another test moved to the `pass' section.
+ This is explicit interface implementation.
+
+ (test-54): returning from catch exceptions has been working for
+ some time now.
+
+2001-12-09 Radek Doulik <rodo@ximian.com>
+
+ * makefile (TEST_SOURCES): added test-55 for using alias directive
+
+2001-12-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * makefile: added new target test-jit
+
+2001-12-04 Ravi Pratap <ravi@ximian.com>
+
+ * makefile : Update to include test 50 as it now passes.
+
+2001-12-04 Ravi Pratap <ravi@ximian.com>
+
+ * test-45.cs : Update for string initialization tests.
+
+2001-12-03 Miguel de Icaza <miguel@ximian.com>
+
+ * test-49.cs: Updated to test `goto default'
+
+ * test-43.cs: Test break and continue here.
+
+ * gen-cast-test.cs: Improved cast test generator.
+
+2001-12-03 Ravi Pratap <ravi@ximian.com>
+
+ * test-50.cs : Add. This does not pass yet.
+
+2001-12-02 Ravi Pratap <ravi@ximian.com>
+
+ * test-40.cs : Update to now test recursive definitions with
+ constants hooked up.
+
+2001-12-01 Ravi Pratap <ravi@ximian.com>
+
+ * test-40.cs : Update to do recursive enumeration definition.
+
+2001-11-28 Ravi Pratap <ravi@ximian.com>
+
+ * test-48.cs : Add for constant emission tests.
+
+ * makefile : Update for the above as it passes nicely :-)
+
+2001-11-22 Ravi Pratap <ravi@ximian.com>
+
+ * test-45.cs : Augment some more to test shorthand declaration
+ of variables/fields that are array types.
+
+2001-11-20 Ravi Pratap <ravi@ximian.com>
+
+ * test-45.cs : Add for array initialization testing.
+
+2001-11-16 Miguel de Icaza <miguel@ximian.com>
+
+ * test-34.cs: Improve this test to check if we are actually
+ walking over the arguments in foreach.
+
+2001-11-15 Ravi Pratap <ravi@ximian.com>
+
+ * makefile : Update to include test-33 again. All tests
+ pass again !
+
+2001-11-13 Ravi Pratap <ravi@ximian.com>
+
+ * test-7.cs : Re-write to make the tests more robust.
+
+2001-11-12 Ravi Pratap <ravi@ximian.com>
+
+ * test-39.cs : Update to test named arguments too.
+
+2001-11-11 Ravi Pratap <ravi@ximian.com>
+
+ * test-40.cs : Update to be a little more useful.
+
+2001-11-08 Ravi Pratap <ravi@ximian.com>
+
+ * test-39.cs : Add
+
+ * test-40.cs : Add
+
+ * makefile : Modify to include the above as they pass all tests.
+
+2001-10-31 Ravi Pratap <ravi@ximian.com>
+
+ * test-34.cs : Add
+
+2001-10-28 Ravi Pratap <ravi@ximian.com>
+
+ * test-32.cs : Added to test array definition and creation.
+
+ * makefile : Updated accordingly.
+
+2001-10-22 Ravi Pratap <ravi@ximian.com>
+
+ * makefile : New target 'verify' which uses the verifier to check
+ that executables produced by us are identical to the MSC produced ones.
+
+ * test-7.cs : Update to exercise more overloadable operators.
+
+2001-10-21 Ravi Pratap <ravi@ximian.com>
+
+ * test-27.cs : Add to do various implicit and explicit
+ reference conversions.
+
+ * makefile : Update accordingly.
+
+2001-10-18 Ravi Pratap <ravi@ximian.com>
+
+ * test-26.cs : Update to test delegate creation from another
+ delegate.
+
+2001-10-17 Ravi Pratap <ravi@ximian.com>
+
+ * test-26.cs : Added to demonstrate delegate support.
+
+2001-10-16 Miguel de Icaza <miguel@ximian.com>
+
+ * test-25.cs: Added new test to excercise break/continue on
+ various loop constructs.
+
+ * test-24.cs: Test property use in expression and statement
+ contexts.
+
+2001-10-14 Miguel de Icaza <miguel@ximian.com>
+
+ * test-23.cs: Added new test for properties.
+
+2001-10-12 Ravi Pratap <ravi@ximian.com>
+
+ * test-21.cs : Update to actually do some checking and return
+ an appropriate value.
+
+2001-10-11 Ravi Pratap <ravi@ximian.com>
+
+ * test-21.cs : Add. This is a test for testing our support
+ for nested types
+
+2001-10-05 Ravi Pratap <ravi@ximian.com>
+
+ * test-16.cs : Update to exercise the code which selects the best
+ conversion operator based on "most encompassing/encompassed type"
+
+ * test-7.cs : Update here too.
+
+2001-10-05 Ravi Pratap <ravi@ximian.com>
+
+ * test-7.cs : Update to do explicit conversion tests.
+
+ * makefile : small fix.
+
+2001-10-03 Ravi Pratap <ravi@ximian.com>
+
+ * test-16.cs : Update to make the test more correct.
+
+2001-10-03 Ravi Pratap <ravi@ximian.com>
+
+ * test-16.cs : Add.
+
+ * makefile : update accordingly.
+
+2001-10-02 Miguel de Icaza <miguel@ximian.com>
+
+ * makefile (test-compiler): Add rm *.exe before launching tests.
+
+2001-10-02 Ravi Pratap <ravi@ximian.com>
+
+ * test-13.cs : Added.
+
+ * makefile : update accordingly.
+
+2001-09-27 Ravi Pratap <ravi@ximian.com>
+
+ * test-7.cs : Revamp and add more operator tests. Still in progress.
+
+ * test-9,10.cs : Added by Miguel earlier.
+
+2001-09-26 Ravi Pratap <ravi@ximian.com>
+
+ * test-7.cs : Update to return an exit code
+
+ * test-8.cs : Added by Miguel.
+
+2001-09-25 Ravi Pratap <ravi@ximian.com>
+
+ * test-7.cs : Update to include implicit conversion tests.
+
+2001-09-21 Ravi Pratap <ravi@ximian.com>
+
+ * test-7.cs : Add.
+
+2001-09-21 Miguel de Icaza <miguel@ximian.com>
+
+ * makefile (test-compiler): Abort tests on failure.
+
diff --git a/mcs/tests/c1.cs b/mcs/tests/c1.cs
new file mode 100755
index 00000000000..8b81c046864
--- /dev/null
+++ b/mcs/tests/c1.cs
@@ -0,0 +1,7 @@
+// cs0146.cs: circular class definition
+// Line: 6
+class A : B {
+}
+
+class B : A {
+}
diff --git a/mcs/tests/c2.cs b/mcs/tests/c2.cs
new file mode 100755
index 00000000000..eeeb6f19e74
--- /dev/null
+++ b/mcs/tests/c2.cs
@@ -0,0 +1,2 @@
+class X {
+}
diff --git a/mcs/tests/casts.cs b/mcs/tests/casts.cs
new file mode 100755
index 00000000000..8934e4eee7e
--- /dev/null
+++ b/mcs/tests/casts.cs
@@ -0,0 +1,566 @@
+using System;
+class Test {
+
+ static void receive_int (int a)
+ {
+ Console.Write (" ");
+ Console.WriteLine (a);
+ }
+
+ static void receive_uint (uint a)
+ {
+ Console.Write (" ");
+ Console.WriteLine (a);
+ }
+
+ static void receive_short (short a)
+ {
+ Console.Write (" ");
+ Console.WriteLine (a);
+ }
+
+ static void receive_ushort (ushort a)
+ {
+ Console.Write (" ");
+ Console.WriteLine (a);
+ }
+
+ static void receive_long (long a)
+ {
+ Console.Write (" ");
+ Console.WriteLine (a);
+ }
+
+ static void receive_ulong (ulong a)
+ {
+ Console.Write (" ");
+ Console.WriteLine (a);
+ }
+
+ static void receive_sbyte (sbyte a)
+ {
+ Console.Write (" ");
+ Console.WriteLine (a);
+ }
+
+ static void receive_byte (byte a)
+ {
+ Console.Write (" ");
+ Console.WriteLine (a);
+ }
+
+ static void receive_char (char a)
+ {
+ Console.Write (" ");
+ Console.WriteLine (a);
+ }
+
+ static void probe_int()
+ {
+ int zero = (int) 0;
+ int min = (int) int.MinValue;
+ int max = (int) int.MaxValue;
+
+ Console.WriteLine ("Testing: int");
+
+ Console.WriteLine (" arg: int (int)");
+
+ receive_int (unchecked ((int) zero));
+ receive_int (unchecked ((int) min));
+ receive_int (unchecked ((int) max));
+ Console.WriteLine (" arg: uint (int)");
+
+ receive_uint (unchecked ((uint) zero));
+ receive_uint (unchecked ((uint) min));
+ receive_uint (unchecked ((uint) max));
+ Console.WriteLine (" arg: short (int)");
+
+ receive_short (unchecked ((short) zero));
+ receive_short (unchecked ((short) min));
+ receive_short (unchecked ((short) max));
+ Console.WriteLine (" arg: ushort (int)");
+
+ receive_ushort (unchecked ((ushort) zero));
+ receive_ushort (unchecked ((ushort) min));
+ receive_ushort (unchecked ((ushort) max));
+ Console.WriteLine (" arg: long (int)");
+
+ receive_long (unchecked ((long) zero));
+ receive_long (unchecked ((long) min));
+ receive_long (unchecked ((long) max));
+ Console.WriteLine (" arg: ulong (int)");
+
+ receive_ulong (unchecked ((ulong) zero));
+ receive_ulong (unchecked ((ulong) min));
+ receive_ulong (unchecked ((ulong) max));
+ Console.WriteLine (" arg: sbyte (int)");
+
+ receive_sbyte (unchecked ((sbyte) zero));
+ receive_sbyte (unchecked ((sbyte) min));
+ receive_sbyte (unchecked ((sbyte) max));
+ Console.WriteLine (" arg: byte (int)");
+
+ receive_byte (unchecked ((byte) zero));
+ receive_byte (unchecked ((byte) min));
+ receive_byte (unchecked ((byte) max));
+ Console.WriteLine (" arg: char (int)");
+
+ receive_char (unchecked ((char) zero));
+ receive_char (unchecked ((char) min));
+ receive_char (unchecked ((char) max));
+ }
+
+ static void probe_uint()
+ {
+ uint zero = (uint) 0;
+ uint min = (uint) uint.MinValue;
+ uint max = (uint) uint.MaxValue;
+
+ Console.WriteLine ("Testing: uint");
+
+ Console.WriteLine (" arg: int (uint)");
+
+ receive_int (unchecked ((int) zero));
+ receive_int (unchecked ((int) min));
+ receive_int (unchecked ((int) max));
+ Console.WriteLine (" arg: uint (uint)");
+
+ receive_uint (unchecked ((uint) zero));
+ receive_uint (unchecked ((uint) min));
+ receive_uint (unchecked ((uint) max));
+ Console.WriteLine (" arg: short (uint)");
+
+ receive_short (unchecked ((short) zero));
+ receive_short (unchecked ((short) min));
+ receive_short (unchecked ((short) max));
+ Console.WriteLine (" arg: ushort (uint)");
+
+ receive_ushort (unchecked ((ushort) zero));
+ receive_ushort (unchecked ((ushort) min));
+ receive_ushort (unchecked ((ushort) max));
+ Console.WriteLine (" arg: long (uint)");
+
+ receive_long (unchecked ((long) zero));
+ receive_long (unchecked ((long) min));
+ receive_long (unchecked ((long) max));
+ Console.WriteLine (" arg: ulong (uint)");
+
+ receive_ulong (unchecked ((ulong) zero));
+ receive_ulong (unchecked ((ulong) min));
+ receive_ulong (unchecked ((ulong) max));
+ Console.WriteLine (" arg: sbyte (uint)");
+
+ receive_sbyte (unchecked ((sbyte) zero));
+ receive_sbyte (unchecked ((sbyte) min));
+ receive_sbyte (unchecked ((sbyte) max));
+ Console.WriteLine (" arg: byte (uint)");
+
+ receive_byte (unchecked ((byte) zero));
+ receive_byte (unchecked ((byte) min));
+ receive_byte (unchecked ((byte) max));
+ Console.WriteLine (" arg: char (uint)");
+
+ receive_char (unchecked ((char) zero));
+ receive_char (unchecked ((char) min));
+ receive_char (unchecked ((char) max));
+ }
+
+ static void probe_short()
+ {
+ short zero = (short) 0;
+ short min = (short) short.MinValue;
+ short max = (short) short.MaxValue;
+
+ Console.WriteLine ("Testing: short");
+
+ Console.WriteLine (" arg: int (short)");
+
+ receive_int (unchecked ((int) zero));
+ receive_int (unchecked ((int) min));
+ receive_int (unchecked ((int) max));
+ Console.WriteLine (" arg: uint (short)");
+
+ receive_uint (unchecked ((uint) zero));
+ receive_uint (unchecked ((uint) min));
+ receive_uint (unchecked ((uint) max));
+ Console.WriteLine (" arg: short (short)");
+
+ receive_short (unchecked ((short) zero));
+ receive_short (unchecked ((short) min));
+ receive_short (unchecked ((short) max));
+ Console.WriteLine (" arg: ushort (short)");
+
+ receive_ushort (unchecked ((ushort) zero));
+ receive_ushort (unchecked ((ushort) min));
+ receive_ushort (unchecked ((ushort) max));
+ Console.WriteLine (" arg: long (short)");
+
+ receive_long (unchecked ((long) zero));
+ receive_long (unchecked ((long) min));
+ receive_long (unchecked ((long) max));
+ Console.WriteLine (" arg: ulong (short)");
+
+ receive_ulong (unchecked ((ulong) zero));
+ receive_ulong (unchecked ((ulong) min));
+ receive_ulong (unchecked ((ulong) max));
+ Console.WriteLine (" arg: sbyte (short)");
+
+ receive_sbyte (unchecked ((sbyte) zero));
+ receive_sbyte (unchecked ((sbyte) min));
+ receive_sbyte (unchecked ((sbyte) max));
+ Console.WriteLine (" arg: byte (short)");
+
+ receive_byte (unchecked ((byte) zero));
+ receive_byte (unchecked ((byte) min));
+ receive_byte (unchecked ((byte) max));
+ Console.WriteLine (" arg: char (short)");
+
+ receive_char (unchecked ((char) zero));
+ receive_char (unchecked ((char) min));
+ receive_char (unchecked ((char) max));
+ }
+
+ static void probe_ushort()
+ {
+ ushort zero = (ushort) 0;
+ ushort min = (ushort) ushort.MinValue;
+ ushort max = (ushort) ushort.MaxValue;
+
+ Console.WriteLine ("Testing: ushort");
+
+ Console.WriteLine (" arg: int (ushort)");
+
+ receive_int (unchecked ((int) zero));
+ receive_int (unchecked ((int) min));
+ receive_int (unchecked ((int) max));
+ Console.WriteLine (" arg: uint (ushort)");
+
+ receive_uint (unchecked ((uint) zero));
+ receive_uint (unchecked ((uint) min));
+ receive_uint (unchecked ((uint) max));
+ Console.WriteLine (" arg: short (ushort)");
+
+ receive_short (unchecked ((short) zero));
+ receive_short (unchecked ((short) min));
+ receive_short (unchecked ((short) max));
+ Console.WriteLine (" arg: ushort (ushort)");
+
+ receive_ushort (unchecked ((ushort) zero));
+ receive_ushort (unchecked ((ushort) min));
+ receive_ushort (unchecked ((ushort) max));
+ Console.WriteLine (" arg: long (ushort)");
+
+ receive_long (unchecked ((long) zero));
+ receive_long (unchecked ((long) min));
+ receive_long (unchecked ((long) max));
+ Console.WriteLine (" arg: ulong (ushort)");
+
+ receive_ulong (unchecked ((ulong) zero));
+ receive_ulong (unchecked ((ulong) min));
+ receive_ulong (unchecked ((ulong) max));
+ Console.WriteLine (" arg: sbyte (ushort)");
+
+ receive_sbyte (unchecked ((sbyte) zero));
+ receive_sbyte (unchecked ((sbyte) min));
+ receive_sbyte (unchecked ((sbyte) max));
+ Console.WriteLine (" arg: byte (ushort)");
+
+ receive_byte (unchecked ((byte) zero));
+ receive_byte (unchecked ((byte) min));
+ receive_byte (unchecked ((byte) max));
+ Console.WriteLine (" arg: char (ushort)");
+
+ receive_char (unchecked ((char) zero));
+ receive_char (unchecked ((char) min));
+ receive_char (unchecked ((char) max));
+ }
+
+ static void probe_long()
+ {
+ long zero = (long) 0;
+ long min = (long) long.MinValue;
+ long max = (long) long.MaxValue;
+
+ Console.WriteLine ("Testing: long");
+
+ Console.WriteLine (" arg: int (long)");
+
+ receive_int (unchecked ((int) zero));
+ receive_int (unchecked ((int) min));
+ receive_int (unchecked ((int) max));
+ Console.WriteLine (" arg: uint (long)");
+
+ receive_uint (unchecked ((uint) zero));
+ receive_uint (unchecked ((uint) min));
+ receive_uint (unchecked ((uint) max));
+ Console.WriteLine (" arg: short (long)");
+
+ receive_short (unchecked ((short) zero));
+ receive_short (unchecked ((short) min));
+ receive_short (unchecked ((short) max));
+ Console.WriteLine (" arg: ushort (long)");
+
+ receive_ushort (unchecked ((ushort) zero));
+ receive_ushort (unchecked ((ushort) min));
+ receive_ushort (unchecked ((ushort) max));
+ Console.WriteLine (" arg: long (long)");
+
+ receive_long (unchecked ((long) zero));
+ receive_long (unchecked ((long) min));
+ receive_long (unchecked ((long) max));
+ Console.WriteLine (" arg: ulong (long)");
+
+ receive_ulong (unchecked ((ulong) zero));
+ receive_ulong (unchecked ((ulong) min));
+ receive_ulong (unchecked ((ulong) max));
+ Console.WriteLine (" arg: sbyte (long)");
+
+ receive_sbyte (unchecked ((sbyte) zero));
+ receive_sbyte (unchecked ((sbyte) min));
+ receive_sbyte (unchecked ((sbyte) max));
+ Console.WriteLine (" arg: byte (long)");
+
+ receive_byte (unchecked ((byte) zero));
+ receive_byte (unchecked ((byte) min));
+ receive_byte (unchecked ((byte) max));
+ Console.WriteLine (" arg: char (long)");
+
+ receive_char (unchecked ((char) zero));
+ receive_char (unchecked ((char) min));
+ receive_char (unchecked ((char) max));
+ }
+
+ static void probe_ulong()
+ {
+ ulong zero = (ulong) 0;
+ ulong min = (ulong) ulong.MinValue;
+ ulong max = (ulong) ulong.MaxValue;
+
+ Console.WriteLine ("Testing: ulong");
+
+ Console.WriteLine (" arg: int (ulong)");
+
+ receive_int (unchecked ((int) zero));
+ receive_int (unchecked ((int) min));
+ receive_int (unchecked ((int) max));
+ Console.WriteLine (" arg: uint (ulong)");
+
+ receive_uint (unchecked ((uint) zero));
+ receive_uint (unchecked ((uint) min));
+ receive_uint (unchecked ((uint) max));
+ Console.WriteLine (" arg: short (ulong)");
+
+ receive_short (unchecked ((short) zero));
+ receive_short (unchecked ((short) min));
+ receive_short (unchecked ((short) max));
+ Console.WriteLine (" arg: ushort (ulong)");
+
+ receive_ushort (unchecked ((ushort) zero));
+ receive_ushort (unchecked ((ushort) min));
+ receive_ushort (unchecked ((ushort) max));
+ Console.WriteLine (" arg: long (ulong)");
+
+ receive_long (unchecked ((long) zero));
+ receive_long (unchecked ((long) min));
+ receive_long (unchecked ((long) max));
+ Console.WriteLine (" arg: ulong (ulong)");
+
+ receive_ulong (unchecked ((ulong) zero));
+ receive_ulong (unchecked ((ulong) min));
+ receive_ulong (unchecked ((ulong) max));
+ Console.WriteLine (" arg: sbyte (ulong)");
+
+ receive_sbyte (unchecked ((sbyte) zero));
+ receive_sbyte (unchecked ((sbyte) min));
+ receive_sbyte (unchecked ((sbyte) max));
+ Console.WriteLine (" arg: byte (ulong)");
+
+ receive_byte (unchecked ((byte) zero));
+ receive_byte (unchecked ((byte) min));
+ receive_byte (unchecked ((byte) max));
+ Console.WriteLine (" arg: char (ulong)");
+
+ receive_char (unchecked ((char) zero));
+ receive_char (unchecked ((char) min));
+ receive_char (unchecked ((char) max));
+ }
+
+ static void probe_sbyte()
+ {
+ sbyte zero = (sbyte) 0;
+ sbyte min = (sbyte) sbyte.MinValue;
+ sbyte max = (sbyte) sbyte.MaxValue;
+
+ Console.WriteLine ("Testing: sbyte");
+
+ Console.WriteLine (" arg: int (sbyte)");
+
+ receive_int (unchecked ((int) zero));
+ receive_int (unchecked ((int) min));
+ receive_int (unchecked ((int) max));
+ Console.WriteLine (" arg: uint (sbyte)");
+
+ receive_uint (unchecked ((uint) zero));
+ receive_uint (unchecked ((uint) min));
+ receive_uint (unchecked ((uint) max));
+ Console.WriteLine (" arg: short (sbyte)");
+
+ receive_short (unchecked ((short) zero));
+ receive_short (unchecked ((short) min));
+ receive_short (unchecked ((short) max));
+ Console.WriteLine (" arg: ushort (sbyte)");
+
+ receive_ushort (unchecked ((ushort) zero));
+ receive_ushort (unchecked ((ushort) min));
+ receive_ushort (unchecked ((ushort) max));
+ Console.WriteLine (" arg: long (sbyte)");
+
+ receive_long (unchecked ((long) zero));
+ receive_long (unchecked ((long) min));
+ receive_long (unchecked ((long) max));
+ Console.WriteLine (" arg: ulong (sbyte)");
+
+ receive_ulong (unchecked ((ulong) zero));
+ receive_ulong (unchecked ((ulong) min));
+ receive_ulong (unchecked ((ulong) max));
+ Console.WriteLine (" arg: sbyte (sbyte)");
+
+ receive_sbyte (unchecked ((sbyte) zero));
+ receive_sbyte (unchecked ((sbyte) min));
+ receive_sbyte (unchecked ((sbyte) max));
+ Console.WriteLine (" arg: byte (sbyte)");
+
+ receive_byte (unchecked ((byte) zero));
+ receive_byte (unchecked ((byte) min));
+ receive_byte (unchecked ((byte) max));
+ Console.WriteLine (" arg: char (sbyte)");
+
+ receive_char (unchecked ((char) zero));
+ receive_char (unchecked ((char) min));
+ receive_char (unchecked ((char) max));
+ }
+
+ static void probe_byte()
+ {
+ byte zero = (byte) 0;
+ byte min = (byte) byte.MinValue;
+ byte max = (byte) byte.MaxValue;
+
+ Console.WriteLine ("Testing: byte");
+
+ Console.WriteLine (" arg: int (byte)");
+
+ receive_int (unchecked ((int) zero));
+ receive_int (unchecked ((int) min));
+ receive_int (unchecked ((int) max));
+ Console.WriteLine (" arg: uint (byte)");
+
+ receive_uint (unchecked ((uint) zero));
+ receive_uint (unchecked ((uint) min));
+ receive_uint (unchecked ((uint) max));
+ Console.WriteLine (" arg: short (byte)");
+
+ receive_short (unchecked ((short) zero));
+ receive_short (unchecked ((short) min));
+ receive_short (unchecked ((short) max));
+ Console.WriteLine (" arg: ushort (byte)");
+
+ receive_ushort (unchecked ((ushort) zero));
+ receive_ushort (unchecked ((ushort) min));
+ receive_ushort (unchecked ((ushort) max));
+ Console.WriteLine (" arg: long (byte)");
+
+ receive_long (unchecked ((long) zero));
+ receive_long (unchecked ((long) min));
+ receive_long (unchecked ((long) max));
+ Console.WriteLine (" arg: ulong (byte)");
+
+ receive_ulong (unchecked ((ulong) zero));
+ receive_ulong (unchecked ((ulong) min));
+ receive_ulong (unchecked ((ulong) max));
+ Console.WriteLine (" arg: sbyte (byte)");
+
+ receive_sbyte (unchecked ((sbyte) zero));
+ receive_sbyte (unchecked ((sbyte) min));
+ receive_sbyte (unchecked ((sbyte) max));
+ Console.WriteLine (" arg: byte (byte)");
+
+ receive_byte (unchecked ((byte) zero));
+ receive_byte (unchecked ((byte) min));
+ receive_byte (unchecked ((byte) max));
+ Console.WriteLine (" arg: char (byte)");
+
+ receive_char (unchecked ((char) zero));
+ receive_char (unchecked ((char) min));
+ receive_char (unchecked ((char) max));
+ }
+
+ static void probe_char()
+ {
+ char zero = (char) 0;
+ char min = (char) char.MinValue;
+ char max = (char) char.MaxValue;
+
+ Console.WriteLine ("Testing: char");
+
+ Console.WriteLine (" arg: int (char)");
+
+ receive_int (unchecked ((int) zero));
+ receive_int (unchecked ((int) min));
+ receive_int (unchecked ((int) max));
+ Console.WriteLine (" arg: uint (char)");
+
+ receive_uint (unchecked ((uint) zero));
+ receive_uint (unchecked ((uint) min));
+ receive_uint (unchecked ((uint) max));
+ Console.WriteLine (" arg: short (char)");
+
+ receive_short (unchecked ((short) zero));
+ receive_short (unchecked ((short) min));
+ receive_short (unchecked ((short) max));
+ Console.WriteLine (" arg: ushort (char)");
+
+ receive_ushort (unchecked ((ushort) zero));
+ receive_ushort (unchecked ((ushort) min));
+ receive_ushort (unchecked ((ushort) max));
+ Console.WriteLine (" arg: long (char)");
+
+ receive_long (unchecked ((long) zero));
+ receive_long (unchecked ((long) min));
+ receive_long (unchecked ((long) max));
+ Console.WriteLine (" arg: ulong (char)");
+
+ receive_ulong (unchecked ((ulong) zero));
+ receive_ulong (unchecked ((ulong) min));
+ receive_ulong (unchecked ((ulong) max));
+ Console.WriteLine (" arg: sbyte (char)");
+
+ receive_sbyte (unchecked ((sbyte) zero));
+ receive_sbyte (unchecked ((sbyte) min));
+ receive_sbyte (unchecked ((sbyte) max));
+ Console.WriteLine (" arg: byte (char)");
+
+ receive_byte (unchecked ((byte) zero));
+ receive_byte (unchecked ((byte) min));
+ receive_byte (unchecked ((byte) max));
+ Console.WriteLine (" arg: char (char)");
+
+ receive_char (unchecked ((char) zero));
+ receive_char (unchecked ((char) min));
+ receive_char (unchecked ((char) max));
+ }
+
+ static void Main ()
+ {
+ probe_int ();
+ probe_uint ();
+ probe_short ();
+ probe_ushort ();
+ probe_long ();
+ probe_ulong ();
+ probe_sbyte ();
+ probe_byte ();
+ probe_char ();
+ }
+}
+
diff --git a/mcs/tests/co1.cs b/mcs/tests/co1.cs
new file mode 100755
index 00000000000..da1bdaab246
--- /dev/null
+++ b/mcs/tests/co1.cs
@@ -0,0 +1,4 @@
+class X {
+ const int x = 1;
+ const string s = "Hello";
+}
diff --git a/mcs/tests/cs1.cs b/mcs/tests/cs1.cs
new file mode 100755
index 00000000000..bfb3c74b3c8
--- /dev/null
+++ b/mcs/tests/cs1.cs
@@ -0,0 +1,5 @@
+class X {
+}
+
+struct Y {
+}
diff --git a/mcs/tests/csc-casts.out b/mcs/tests/csc-casts.out
new file mode 100755
index 00000000000..70ce7135da8
--- /dev/null
+++ b/mcs/tests/csc-casts.out
Binary files differ
diff --git a/mcs/tests/gen-cast-test.cs b/mcs/tests/gen-cast-test.cs
new file mode 100755
index 00000000000..d1f9531d2f1
--- /dev/null
+++ b/mcs/tests/gen-cast-test.cs
@@ -0,0 +1,99 @@
+using System;
+
+class Stress {
+
+ static string mode = "unchecked";
+
+ static string [] types = {
+ "int", "uint",
+ "short", "ushort",
+ "long", "ulong",
+ "sbyte", "byte", "char"
+ };
+
+
+ static void w (string s)
+ {
+ Console.Write (s);
+ }
+
+ static void wl (string s)
+ {
+ Console.WriteLine (s);
+ }
+
+ static void generate_receptors ()
+ {
+ foreach (string t in types){
+ w ("\tstatic void receive_" + t + " (" + t + " a)\n\t{\n");
+ w ("\t\tConsole.Write (\" \");\n");
+ w ("\t\tConsole.WriteLine (a);\n");
+ w ("\t}\n\n");
+ }
+
+ }
+
+ static void var (string type, string name, string init)
+ {
+ w ("\t\t" + type + " " + name + " = (" + type + ") " + init + ";\n");
+ }
+
+ static void call (string type, string name)
+ {
+ w ("\t\treceive_" + type + " (" + mode + "((" + type + ") " + name + "));\n");
+ }
+
+ static void generate_emision ()
+ {
+ foreach (string type in types){
+ w ("\tstatic void probe_" + type + "()\n\t{\n");
+ var (type, "zero", "0");
+ var (type, "min", type + ".MinValue");
+ var (type, "max", type + ".MaxValue");
+ wl ("");
+
+ wl ("\t\tConsole.WriteLine (\"Testing: " + type + "\");\n");
+ foreach (string t in types){
+ wl ("\t\tConsole.WriteLine (\" arg: " + t + " (" + type + ")\");\n");
+ call (t, "zero");
+ call (t, "min");
+ call (t, "max");
+ }
+
+ w ("\t}\n\n");
+ }
+ }
+
+ static void generate_main ()
+ {
+ wl ("\tstatic void Main ()\n\t{");
+
+ foreach (string t in types){
+ w ("\t\tprobe_" + t + " ();\n");
+ }
+ wl ("\t}");
+ }
+
+ static void Main (string [] args)
+ {
+ foreach (string arg in args){
+ if (arg == "-h" || arg == "--help"){
+ Console.WriteLine ("-h, --help Shows help");
+ Console.WriteLine ("-c, --checked Generate checked contexts");
+ return;
+ }
+ if (arg == "--checked" || arg == "-c"){
+ mode = "checked";
+ continue;
+ }
+ }
+ wl ("using System;\nclass Test {\n");
+
+ generate_receptors ();
+ generate_emision ();
+
+ generate_main ();
+
+ wl ("}\n");
+ }
+}
diff --git a/mcs/tests/gen-check.cs b/mcs/tests/gen-check.cs
new file mode 100755
index 00000000000..9077b141a74
--- /dev/null
+++ b/mcs/tests/gen-check.cs
@@ -0,0 +1,78 @@
+using System;
+
+class Stress {
+
+ static string [] types = {
+ "int", "uint",
+ "short", "ushort",
+ "long", "ulong",
+ "sbyte", "byte", "char"
+ };
+
+
+ static void w (string s)
+ {
+ Console.Write (s);
+ }
+
+ static void wl (string s)
+ {
+ Console.WriteLine (s);
+ }
+
+ static void generate_receptors ()
+ {
+ foreach (string t in types){
+ w ("\tstatic void receive_" + t + " (" + t + " a)\n\t{\n");
+ w ("\t\tConsole.Write (\" \");\n");
+ w ("\t\tConsole.WriteLine (a);\n");
+ w ("\t}\n\n");
+ }
+
+ }
+
+ static void call (string type, string name)
+ {
+ w ("\t\treceive_" + type + " (checked ((" + type + ") var ));\n");
+ }
+
+ static void generate_emision ()
+ {
+ foreach (string type in types){
+ w ("\tstatic void probe_" + type + "()\n\t{\n");
+ if (type == "char")
+ w ("\t\t" + type + " var = (char) 0;");
+ else
+ w ("\t\t" + type + " var = 0;");
+
+ wl ("");
+
+ foreach (string t in types)
+ call (t, "var");
+
+ w ("\t}\n\n");
+ }
+ }
+
+ static void generate_main ()
+ {
+ wl ("\tstatic void Main ()\n\t{");
+
+ foreach (string t in types){
+ w ("\t\tprobe_" + t + " ();\n");
+ }
+ wl ("\t}");
+ }
+
+ static void Main (string [] args)
+ {
+ wl ("using System;\nclass Test {\n");
+
+ generate_receptors ();
+ generate_emision ();
+
+ generate_main ();
+
+ wl ("}\n");
+ }
+}
diff --git a/mcs/tests/i-recursive.cs b/mcs/tests/i-recursive.cs
new file mode 100644
index 00000000000..9c22e5876cc
--- /dev/null
+++ b/mcs/tests/i-recursive.cs
@@ -0,0 +1,5 @@
+interface A : B {
+}
+
+interface B : A {
+}
diff --git a/mcs/tests/i-three.cs b/mcs/tests/i-three.cs
new file mode 100755
index 00000000000..7c473f21657
--- /dev/null
+++ b/mcs/tests/i-three.cs
@@ -0,0 +1,11 @@
+interface A {
+}
+
+interface B : A{
+}
+
+interface C : A {
+}
+
+interface D : C {
+}
diff --git a/mcs/tests/i-undefined.cs b/mcs/tests/i-undefined.cs
new file mode 100644
index 00000000000..496795cd6db
--- /dev/null
+++ b/mcs/tests/i-undefined.cs
@@ -0,0 +1,2 @@
+interface A : B {
+}
diff --git a/mcs/tests/i1.cs b/mcs/tests/i1.cs
new file mode 100755
index 00000000000..00141820820
--- /dev/null
+++ b/mcs/tests/i1.cs
@@ -0,0 +1,2 @@
+interface A {
+}
diff --git a/mcs/tests/i2.cs b/mcs/tests/i2.cs
new file mode 100755
index 00000000000..9c22e5876cc
--- /dev/null
+++ b/mcs/tests/i2.cs
@@ -0,0 +1,5 @@
+interface A : B {
+}
+
+interface B : A {
+}
diff --git a/mcs/tests/i3.cs b/mcs/tests/i3.cs
new file mode 100755
index 00000000000..dff6c54db9d
--- /dev/null
+++ b/mcs/tests/i3.cs
@@ -0,0 +1,5 @@
+class X {
+}
+
+interface A : X {
+}
diff --git a/mcs/tests/i4.cs b/mcs/tests/i4.cs
new file mode 100755
index 00000000000..f89988f2cb3
--- /dev/null
+++ b/mcs/tests/i4.cs
@@ -0,0 +1,8 @@
+// cs0509.cs: base class is sealed
+// Line: 7
+struct V {
+ int v;
+}
+
+class X : V {
+}
diff --git a/mcs/tests/i5.cs b/mcs/tests/i5.cs
new file mode 100755
index 00000000000..e312377061b
--- /dev/null
+++ b/mcs/tests/i5.cs
@@ -0,0 +1,8 @@
+class A1 {
+}
+
+class A2 {
+}
+
+class B : A1, A2 {
+}
diff --git a/mcs/tests/i6.cs b/mcs/tests/i6.cs
new file mode 100755
index 00000000000..fa20da0ada8
--- /dev/null
+++ b/mcs/tests/i6.cs
@@ -0,0 +1,4 @@
+// cs0246.cs: can not find type `B'
+// Line: 4
+class X : D {
+}
diff --git a/mcs/tests/ix1.cs b/mcs/tests/ix1.cs
new file mode 100755
index 00000000000..984391d2fda
--- /dev/null
+++ b/mcs/tests/ix1.cs
@@ -0,0 +1,3 @@
+interface INTERFACE {
+ string PROPERTY { get; set; }
+}
diff --git a/mcs/tests/ix2.cs b/mcs/tests/ix2.cs
new file mode 100755
index 00000000000..c36b52ea2ac
--- /dev/null
+++ b/mcs/tests/ix2.cs
@@ -0,0 +1,15 @@
+using System;
+
+interface Blah {
+ string this [ int INDEX ] { get; set; }
+ string Item (int index);
+}
+
+public class Foo {
+
+ public static void Main ()
+ {
+ Console.WriteLine ("foo");
+ }
+}
+
diff --git a/mcs/tests/makefile b/mcs/tests/makefile
new file mode 100755
index 00000000000..b8d2d5d084a
--- /dev/null
+++ b/mcs/tests/makefile
@@ -0,0 +1,102 @@
+CSC=csc.exe
+
+MCS=../mcs/mcs.exe
+VERIFY=../tools/verifier.exe
+
+TEST_SOURCES = \
+ test-1 test-2 test-3 test-4 test-5 test-6 test-7 test-8 test-9 test-10 \
+ test-11 test-12 test-13 test-14 test-15 test-16 test-17 test-18 test-19 test-20 \
+ test-21 test-22 test-23 test-24 test-25 test-26 test-27 test-28 test-30 \
+ test-31 test-32 test-33 test-34 test-35 test-36 test-37 test-39 test-40 \
+ test-41 test-42 test-43 test-44 test-45 test-46 test-47 test-48 test-49 test-50 \
+ test-51 test-52 test-53 test-54 test-55 test-56 test-57 test-59 \
+ test-61 test-62 test-63 test-64 test-65 test-66 test-67 test-68 test-69 test-70 \
+ 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-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
+
+UNSAFE_SOURCES = \
+ unsafe-1 unsafe-2
+
+TEST_NOPASS = \
+ test-29 test-38
+
+all: test-compiler test-unsafe
+
+test-compiler:
+ -rm *.exe
+ for i in $(TEST_SOURCES); do \
+ if $(MCS) $$i.cs > /dev/null; then \
+ if ./$$i.exe; then \
+ echo $$i: ok; \
+ else \
+ echo test $$i failed; exit; \
+ fi; \
+ else \
+ echo compiler failed on $$i; exit; \
+ fi \
+ done
+
+test-unsafe:
+ for i in $(UNSAFE_SOURCES); do \
+ if $(MCS) --unsafe $$i.cs > /dev/null; then \
+ if ./$$i.exe; then \
+ echo $$i: ok; \
+ else \
+ echo test $$i failed; exit; \
+ fi; \
+ else \
+ echo compiler failed on $$i; exit; \
+ fi \
+ done
+
+test-jit:
+ for i in $(TEST_SOURCES:.cs=.exe); do \
+ if mono ./$$i.exe; then \
+ echo $$i: ok; \
+ else \
+ echo test $$i failed; exit; \
+ fi \
+ done
+
+
+
+verify:
+ for i in $(TEST_SOURCES); do \
+ if $(MCS) -o mcs-gen-code.exe $$i.cs > /dev/null; then \
+ if $(CSC) /out:csc-gen-code.exe $$i.cs > /dev/null; then \
+ if $(VERIFY) mcs-gen-code.exe csc-gen-code.exe > /dev/null; then \
+ echo $$i: identical assemblies; \
+ else \
+ echo $$i: unidentical assemblies; exit; \
+ fi; \
+ fi \
+ fi \
+ done
+
+
+casts.cs: gen-cast-test.cs
+ $(CSC) /out:csc-cast.exe gen-cast-test.cs
+ ./csc-cast > casts.cs
+
+casts-csc.exe: casts.cs
+ $(CSC) /out:casts-csc.exe casts.cs
+
+casts.exe: casts.cs
+ $(MCS) casts.cs
+
+csc-casts.out: casts-csc.exe
+ ./casts-csc.exe > csc-casts.out
+
+msc-casts.out: casts.exe
+ ./casts.exe > msc-casts.out
+
+test-casts: csc-casts.out msc-casts.out
+ cmp csc-casts.out msc-casts.out
+
+clean:
+ rm *.exe
+ rm *.out
+ rm casts.cs
+
diff --git a/mcs/tests/n1.cs b/mcs/tests/n1.cs
new file mode 100755
index 00000000000..b47fd24b2ca
--- /dev/null
+++ b/mcs/tests/n1.cs
@@ -0,0 +1,11 @@
+namespace A {
+ class X {
+ void Y () {}
+ }
+}
+
+namespace A {
+ class XX : X {
+ void YY () {}
+ }
+}
diff --git a/mcs/tests/n2.cs b/mcs/tests/n2.cs
new file mode 100755
index 00000000000..34c210e1fe7
--- /dev/null
+++ b/mcs/tests/n2.cs
@@ -0,0 +1,4 @@
+using System.Collections;
+
+class X : Queue {
+}
diff --git a/mcs/tests/s1.cs b/mcs/tests/s1.cs
new file mode 100755
index 00000000000..6c1191a86a0
--- /dev/null
+++ b/mcs/tests/s1.cs
@@ -0,0 +1,7 @@
+struct A {
+ int x;
+}
+
+struct B : A {
+ int y;
+}
diff --git a/mcs/tests/test-1.cs b/mcs/tests/test-1.cs
new file mode 100755
index 00000000000..adb1dd88a92
--- /dev/null
+++ b/mcs/tests/test-1.cs
@@ -0,0 +1,9 @@
+using System;
+
+class X {
+ static int Main (string [] args)
+ {
+ Console.WriteLine ("Hello, World!");
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-10.cs b/mcs/tests/test-10.cs
new file mode 100644
index 00000000000..20e1cc6ee81
--- /dev/null
+++ b/mcs/tests/test-10.cs
@@ -0,0 +1,150 @@
+/*
+ * Test explicit numeric conversions.
+ */
+
+using System;
+
+class X {
+
+ void asbyte (byte a, ushort b, uint c, ulong d, char e)
+ {
+ }
+
+ void bsbyte ()
+ {
+ sbyte s = 0;
+
+ asbyte ((byte) s, (ushort) s, (uint) s, (ulong) s, (char) s);
+ asbyte (checked ((byte) s), checked ((ushort) s), checked ((uint) s), checked ((ulong) s), checked ((char) s));
+ }
+
+ void abyte (sbyte a, char b)
+ {
+ }
+
+ void bbyte ()
+ {
+ byte b = 0;
+
+ abyte ((sbyte) b, (char) b);
+ abyte (checked ((sbyte) b), checked ((char) b));
+ }
+
+ void ashort (sbyte a, byte b, ushort c, uint d, ulong e, char f)
+ {
+ }
+
+ void bshort ()
+ {
+ short a = 1;
+
+ ashort ((sbyte) a, (byte) a, (ushort) a, (uint) a, (ulong) a, (char) a);
+ ashort (checked ((sbyte) a), checked ((byte) a), checked ((ushort) a), checked ((uint) a), checked ((ulong) a), checked ((char) a));
+ }
+
+ void aushort (sbyte a, byte b, short c, char d)
+ {
+ }
+
+ void bushort ()
+ {
+ ushort a = 1;
+ aushort ((sbyte) a, (byte) a, (short) a, (char) a);
+ aushort (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((char) a));
+ }
+
+ void aint (sbyte a, byte b, short c, ushort d, uint e, ulong f, char g)
+ {
+ }
+
+ void bint ()
+ {
+ int a = 1;
+
+ aint ((sbyte) a, (byte) a, (short) a, (ushort) a, (uint) a, (ulong) a, (char) a);
+ aint (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((uint) a), checked ((ulong) a), checked ((char) a));
+ }
+
+ void auint (sbyte a, byte b, short c, ushort d, int e, char f)
+ {
+ }
+
+ void buint ()
+ {
+ uint a = 1;
+
+ auint ((sbyte) a, (byte) a, (short) a, (ushort) a, (int) a, (char) a);
+ auint (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((int) a), checked ((char) a));
+ }
+
+ void along (sbyte a, byte b, short c, ushort d, int e, uint f, ulong g, char h)
+ {
+ }
+
+ void blong ()
+ {
+ long a = 1;
+
+ along ((sbyte) a, (byte) a, (short) a, (ushort) a, (int) a, (uint) a, (ulong) a, (char) a);
+ along (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((int) a), checked ((uint) a), checked ((ulong) a), checked ((char) a));
+ }
+
+ void aulong (sbyte a, byte b, short c, ushort d, int e, uint f, long g, char h)
+ {
+ }
+
+ void bulong ()
+ {
+ ulong a = 1;
+
+ aulong ((sbyte) a, (byte) a, (short) a, (ushort) a, (int) a, (uint) a, (long) a, (char) a);
+ aulong (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((int) a), checked ((uint) a), checked ((long) a), checked ((char) a));
+ }
+
+ void achar (sbyte a, byte b, short c)
+ {
+
+ }
+
+ void bchar ()
+ {
+ char a = (char) 1;
+
+ achar ((sbyte) a, (byte) a, (short) a);
+ achar (checked ((sbyte) a), checked ((byte) a), checked ((short) a));
+ }
+
+ void afloat (sbyte a, byte b, short c, ushort d, int e, uint f, long ll, ulong g, char h, decimal dd)
+ {
+ }
+
+ void bfloat ()
+ {
+ float a = 1;
+
+ afloat ((sbyte) a, (byte) a, (short) a, (ushort) a, (int) a, (uint) a, (long) a,
+ (ulong) a, (char) a, (decimal) a);
+ afloat (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((int) a), checked ((uint) a), checked ((long) a),
+checked ( (ulong) a), checked ((char) a), checked ((decimal) a));
+ }
+
+ void adouble (sbyte a, byte b, short c, ushort d, int e, uint f, long ll, ulong g, char h,
+ float ff, decimal dd)
+ {
+ }
+
+ void bdouble ()
+ {
+ double a = 1;
+
+ adouble ((sbyte) a, (byte) a, (short) a, (ushort) a, (int) a, (uint) a, (long) a,
+ (ulong) a, (char) a, (float) a, (decimal) a);
+ adouble (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((int) a), checked ((uint) a), checked ((long) a),
+checked ( (ulong) a), checked ((char) a), checked ((float) a), (decimal) a);
+ }
+
+ static void Main ()
+ {
+
+ }
+}
diff --git a/mcs/tests/test-100.cs b/mcs/tests/test-100.cs
new file mode 100755
index 00000000000..da77cf3cdda
--- /dev/null
+++ b/mcs/tests/test-100.cs
@@ -0,0 +1,31 @@
+namespace GLib {
+
+ using System;
+ using System.Runtime.InteropServices;
+
+ public class Object {
+ int v;
+
+ protected int Raw {
+ get {
+ return 1;
+ }
+ set {
+ v = value;
+ }
+ }
+
+ [DllImport("bah", CallingConvention=CallingConvention.Cdecl)]
+ static extern void g_object_get (int obj);
+
+ public void GetProperty ()
+ {
+ g_object_get (Raw);
+ }
+
+ static int Main ()
+ {
+ return 0;
+ }
+ }
+}
diff --git a/mcs/tests/test-101.cs b/mcs/tests/test-101.cs
new file mode 100644
index 00000000000..c0256030fc0
--- /dev/null
+++ b/mcs/tests/test-101.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Reflection;
+
+namespace Test {
+
+ public class MyAttribute: Attribute {
+ public string val;
+ public MyAttribute (string stuff) {
+ System.Console.WriteLine (stuff);
+ val = stuff;
+ }
+ }
+
+ public class My2Attribute: MyAttribute {
+ public int ival;
+ public My2Attribute (string stuff, int blah) : base (stuff) {
+ System.Console.WriteLine ("ctor with int val"+stuff);
+ ival = blah;
+ }
+ }
+
+ [My("testclass")]
+ [My2("testclass", 22)]
+ public class Test {
+ static public int Main() {
+ System.Reflection.MemberInfo info = typeof (Test);
+ object[] attributes = info.GetCustomAttributes (false);
+ for (int i = 0; i < attributes.Length; i ++) {
+ System.Console.WriteLine(attributes[i]);
+ }
+ if (attributes.Length != 2)
+ return 1;
+ MyAttribute attr = (MyAttribute) attributes [0];
+ if (attr.val != "testclass")
+ return 2;
+ return 0;
+ }
+ }
+}
diff --git a/mcs/tests/test-102.cs b/mcs/tests/test-102.cs
new file mode 100644
index 00000000000..11e8b04aa0e
--- /dev/null
+++ b/mcs/tests/test-102.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Reflection;
+
+[assembly: AssemblyTitle ("Foo")]
+[assembly: AssemblyVersion ("1.0.2")]
+
+namespace N1 {
+
+ [AttributeUsage (AttributeTargets.All)]
+ public class MineAttribute : Attribute {
+
+ string name;
+
+ public MineAttribute (string s)
+ {
+ name = s;
+ }
+ }
+
+ public class Foo {
+
+ int i;
+
+ [return : Mine ("Foo")]
+ public static int Main ()
+ {
+ return 0;
+ }
+ }
+}
diff --git a/mcs/tests/test-103.cs b/mcs/tests/test-103.cs
new file mode 100755
index 00000000000..09974f4cc29
--- /dev/null
+++ b/mcs/tests/test-103.cs
@@ -0,0 +1,28 @@
+//
+// We should also allow overrides to work on protected methods.
+// Only private is not considered part of the override process.
+//
+abstract class A {
+ protected abstract int Foo ();
+}
+
+class B : A {
+ protected override int Foo ()
+ {
+ return 0;
+ }
+
+ public int M ()
+ {
+ return Foo ();
+ }
+}
+
+class Test {
+ public static int Main ()
+ {
+ return new B ().M ();
+ }
+}
+
+
diff --git a/mcs/tests/test-104.cs b/mcs/tests/test-104.cs
new file mode 100644
index 00000000000..21ab8406168
--- /dev/null
+++ b/mcs/tests/test-104.cs
@@ -0,0 +1,14 @@
+//
+// Test to ensure we do correct overload resolution
+//
+using System;
+
+class Test {
+ public static int Main(String[] args) {
+ long iTest = 1;
+
+ System.Threading.Interlocked.Increment(ref iTest);
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-11.cs b/mcs/tests/test-11.cs
new file mode 100644
index 00000000000..c122201d472
--- /dev/null
+++ b/mcs/tests/test-11.cs
@@ -0,0 +1,27 @@
+using System;
+using System.IO;
+
+public class Test {
+
+ public static int boxtest ()
+ {
+ int i = 123;
+ object o = i;
+// int j = (int) o;
+
+// if (i != j)
+// return 1;
+
+ return 0;
+ }
+
+ public static int Main () {
+ if (boxtest () != 0)
+ return 1;
+
+
+ return 0;
+ }
+}
+
+
diff --git a/mcs/tests/test-12.cs b/mcs/tests/test-12.cs
new file mode 100644
index 00000000000..b788eb89dd1
--- /dev/null
+++ b/mcs/tests/test-12.cs
@@ -0,0 +1,44 @@
+/*
+ * Tests the ?: operator and the string concatenation
+ */
+
+using System;
+class X {
+ static int Main (string [] args)
+ {
+ string a = "hello";
+ string b = "1";
+ string c = a + b;
+ string d = a + 1;
+ string y;
+
+ if (c != d)
+ return 1;
+ if (d != (a + b))
+ return 2;
+ if (d != x (a, b))
+ return 3;
+ if (d != x (a, 1))
+ return 4;
+
+ y = c == d ? "equal" : "not-equal";
+ if (y != "equal")
+ return 5;
+ y = b == a ? "oops" : "nice";
+ if (y != "nice")
+ return 6;
+
+ Console.WriteLine (c);
+ return 0;
+ }
+
+ static string s (string a, int o)
+ {
+ return a + o;
+ }
+ static string x (string s, object o)
+ {
+ return s + o;
+ }
+
+}
diff --git a/mcs/tests/test-13.cs b/mcs/tests/test-13.cs
new file mode 100644
index 00000000000..f921ae55728
--- /dev/null
+++ b/mcs/tests/test-13.cs
@@ -0,0 +1,31 @@
+using System;
+
+class Foo {
+
+ public bool MyMethod ()
+ {
+ Console.WriteLine ("Base class method !");
+ return true;
+ }
+}
+
+class Blah : Foo {
+
+ public static int Main ()
+ {
+ Blah k = new Blah ();
+
+ Foo i = k;
+
+ if (i.MyMethod ())
+ return 0;
+ else
+ return 1;
+
+
+ }
+
+}
+
+
+
diff --git a/mcs/tests/test-14.cs b/mcs/tests/test-14.cs
new file mode 100644
index 00000000000..dac824b6028
--- /dev/null
+++ b/mcs/tests/test-14.cs
@@ -0,0 +1,43 @@
+using System;
+
+namespace Obj {
+ interface Bah {
+ int H ();
+ }
+ class A : Bah {
+ public int F () {return 1;}
+ public virtual int G () {return 2;}
+ public int H () {return 10;}
+ }
+ class B : A {
+ public new int F () {return 3;}
+ public override int G () {return 4;}
+ public new int H () {return 11;}
+ }
+ class Test {
+ static public int Main () {
+ int result = 0;
+ B b = new B ();
+ A a = b;
+ if (a.F () != 1)
+ result |= 1 << 0;
+ if (b.F () != 3)
+ result |= 1 << 1;
+ if (b.G () != 4)
+ result |= 1 << 2;
+ if (a.G () != 4){
+ Console.WriteLine ("oops: " + a.G ());
+ result |= 1 << 3;
+ }
+ if (a.H () != 10)
+ result |= 1 << 4;
+ if (b.H () != 11)
+ result |= 1 << 5;
+ if (((A)b).H () != 10)
+ result |= 1 << 6;
+ if (((B)a).H () != 11)
+ result |= 1 << 7;
+ return result;
+ }
+ };
+};
diff --git a/mcs/tests/test-15.cs b/mcs/tests/test-15.cs
new file mode 100755
index 00000000000..c199bc13bcb
--- /dev/null
+++ b/mcs/tests/test-15.cs
@@ -0,0 +1,22 @@
+using System;
+
+interface Iface {
+ void A ();
+}
+
+class Implementor : Iface {
+ public void A () {}
+}
+
+class Run {
+
+ static int Main ()
+ {
+ Iface iface;
+ Implementor i = new Implementor ();
+
+ iface = i;
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-16.cs b/mcs/tests/test-16.cs
new file mode 100644
index 00000000000..0b45b1fc5cf
--- /dev/null
+++ b/mcs/tests/test-16.cs
@@ -0,0 +1,59 @@
+using System;
+
+namespace Mine {
+
+ public class Blah {
+
+ public static int operator + (Blah i, Blah j)
+ {
+ Console.WriteLine ("Base class binary + operator");
+ return 2;
+ }
+
+ public static implicit operator int (Blah i)
+ {
+ Console.WriteLine ("Blah->int");
+ return 3;
+ }
+
+ public static implicit operator byte (Blah i)
+ {
+ Console.WriteLine ("Blah->byte");
+ return 0;
+ }
+
+ public static implicit operator short (Blah i)
+ {
+ Console.WriteLine ("Blah->short");
+ return 1;
+ }
+
+ }
+
+ public class Foo : Blah {
+
+ public static int Main ()
+ {
+ int number = new Foo () + new Foo () ;
+ Console.WriteLine (number);
+
+ Foo tmp = new Foo ();
+
+ int k = tmp;
+
+ float f = tmp;
+
+ // The following will not work till we fix our UserCast::Emit
+ // to convert the return value on the stack.
+ if (f == 3)
+ Console.WriteLine ("Best implicit conversion selected correctly.");
+
+ Console.WriteLine ("F is {0}", f);
+
+ if (number == 2 && k == 3)
+ return 0;
+ else
+ return 1;
+ }
+ }
+}
diff --git a/mcs/tests/test-17.cs b/mcs/tests/test-17.cs
new file mode 100755
index 00000000000..c6e2a95745c
--- /dev/null
+++ b/mcs/tests/test-17.cs
@@ -0,0 +1,45 @@
+//
+// This test excercises user defined conversions and an implicit
+// conversion to a type afterwards.
+//
+//
+using System;
+
+class Blah {
+
+ public static int Main ()
+ {
+ Blah k = new Blah ();
+
+ float f = k;
+
+ if (f == 2){
+ Console.WriteLine ("Best implicit operator selected correctly");
+ return 0;
+ }
+ return 1;
+
+ }
+
+ public static implicit operator byte (Blah i)
+ {
+ Console.WriteLine ("Blah->byte");
+ return 0;
+ }
+
+
+ public static implicit operator short (Blah i)
+ {
+ Console.WriteLine ("Blah->short");
+ return 1;
+ }
+
+ public static implicit operator int (Blah i)
+ {
+ Console.WriteLine ("Blah->int");
+ return 2;
+ }
+
+
+}
+
diff --git a/mcs/tests/test-18.cs b/mcs/tests/test-18.cs
new file mode 100644
index 00000000000..eb2a02c0033
--- /dev/null
+++ b/mcs/tests/test-18.cs
@@ -0,0 +1,52 @@
+using System;
+
+class X {
+ static int i;
+ static int j;
+
+ static void m ()
+ {
+ i = 0;
+ j = 0;
+
+ try {
+ throw new ArgumentException ("Blah");
+ } catch (ArgumentException){
+ i = 1;
+ } catch (Exception){
+ i = 2;
+ } finally {
+ j = 1;
+ }
+ }
+
+ static int ret (int a)
+ {
+ try {
+ if (a == 1)
+ throw new Exception ();
+
+ return 1;
+ } catch {
+ return 2;
+ }
+ }
+
+ static int Main ()
+ {
+ m ();
+ if (i != 1)
+ return 1;
+ if (j != 1)
+ return 2;
+
+ if (ret (1) != 2)
+ return 3;
+
+ if (ret (10) != 1)
+ return 4;
+
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-19.cs b/mcs/tests/test-19.cs
new file mode 100755
index 00000000000..4a49c8fb6fd
--- /dev/null
+++ b/mcs/tests/test-19.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Threading;
+using System.Reflection;
+
+class I {
+
+ public delegate string GetTextFn (string a);
+
+ static public GetTextFn GetText;
+
+ static string fn (string s)
+ {
+ return "(" + s + ")";
+ }
+
+ static I ()
+ {
+ GetText = new GetTextFn (fn);
+ }
+}
+
+class X {
+
+ public delegate int Foo (int i, int j);
+
+ private void Thread_func () {
+ Console.WriteLine ("Inside the thread !");
+ }
+
+ public int Func (int i, int j)
+ {
+ return i+j;
+ }
+
+ public void Bar ()
+ {
+ Foo my_func = new Foo (Func);
+
+ int result = my_func (2, 4);
+
+ Console.WriteLine ("Answer is : " + result);
+ }
+
+ static bool MyFilter (MemberInfo mi, object criteria)
+ {
+ Console.WriteLine ("You passed in : " + criteria);
+ return true;
+ }
+
+ public static int Main ()
+ {
+ I.GetTextFn _ = I.GetText;
+
+ Console.WriteLine ("Value: " + I.GetText);
+ X x = new X ();
+
+ Thread thr = new Thread (new ThreadStart (x.Thread_func));
+
+ thr.Start ();
+ Console.WriteLine ("Inside main ");
+ thr.Join ();
+
+ Console.WriteLine (_("Hello"));
+
+ x.Bar ();
+
+ MemberFilter filter = new MemberFilter (MyFilter);
+
+ Type t = x.GetType ();
+
+ MemberInfo [] mi = t.FindMembers (MemberTypes.Method, BindingFlags.Static | BindingFlags.NonPublic,
+ Type.FilterName, "MyFilter");
+
+ Console.WriteLine ("FindMembers called, mi = " + mi);
+ Console.WriteLine (" Count: " + mi.Length);
+ if (!filter (mi [0], "MyFilter"))
+ return 1;
+
+ Console.WriteLine ("Test passes");
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-2.cs b/mcs/tests/test-2.cs
new file mode 100755
index 00000000000..0a18d50767b
--- /dev/null
+++ b/mcs/tests/test-2.cs
@@ -0,0 +1,7 @@
+class X {
+ static int Main (string [] args)
+ {
+ System.Console.WriteLine ("Hello, World");
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-20.cs b/mcs/tests/test-20.cs
new file mode 100755
index 00000000000..006bd45075e
--- /dev/null
+++ b/mcs/tests/test-20.cs
@@ -0,0 +1,70 @@
+//
+// This generates a warning
+//
+using System;
+
+class A {
+ public int a;
+
+ public void X ()
+ {
+ a = 1;
+ }
+}
+
+class B : A {
+ void X ()
+ {
+ a = 2;
+ }
+
+ public void TestB ()
+ {
+ X ();
+ }
+}
+
+class Ax {
+ public int a;
+
+ public virtual void A ()
+ {
+ a = 1;
+ }
+
+ public virtual void B ()
+ {
+ a = 3;
+ }
+}
+
+class Bx : Ax {
+ public override void A ()
+ {
+ a = 2;
+ }
+ public new void B ()
+ {
+ a = 4;
+ }
+}
+class Test {
+ static int Main ()
+ {
+ B b = new B ();
+
+ b.TestB ();
+ if (b.a != 2)
+ return 1;
+
+ Bx bx = new Bx ();
+ bx.A ();
+ if (b.a != 2)
+ return 2;
+ bx.B ();
+ Console.WriteLine ("a="+bx.a);
+ if (bx.a != 4)
+ return 3;
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-21.cs b/mcs/tests/test-21.cs
new file mode 100644
index 00000000000..cd125497bbb
--- /dev/null
+++ b/mcs/tests/test-21.cs
@@ -0,0 +1,35 @@
+using System;
+
+public class Blah {
+
+ public class Foo {
+
+ public Foo ()
+ {
+ Console.WriteLine ("Inside the Foo constructor now");
+ }
+
+ public int Bar (int i, int j)
+ {
+ Console.WriteLine ("The Bar method");
+ return i+j;
+ }
+
+
+ }
+
+ public static int Main ()
+ {
+ Foo f = new Foo ();
+
+ int j = f.Bar (2, 3);
+ Console.WriteLine ("Blah.Foo.Bar returned " + j);
+
+ if (j == 5)
+ return 0;
+ else
+ return 1;
+
+ }
+
+}
diff --git a/mcs/tests/test-22.cs b/mcs/tests/test-22.cs
new file mode 100644
index 00000000000..2e662494ddd
--- /dev/null
+++ b/mcs/tests/test-22.cs
@@ -0,0 +1,46 @@
+//
+// This test excercises invocations of methods in structures.
+//
+// Unlike classes, we can not just leave the result of a computed
+// structure in the IL stack as a result. The reason is that the
+// result is the whole structure, not a pointer to it.
+//
+// This program excercises invocations to methods on structures
+//
+
+struct T {
+ public int a, b;
+}
+
+struct S {
+ T t;
+
+ public T GetT ()
+ {
+ return t;
+ }
+
+ public void Init ()
+ {
+ t.a = 1;
+ t.b = 2;
+ }
+}
+
+class M {
+ static int Main ()
+ {
+ S s = new S ();
+
+ s.Init ();
+
+ if (s.GetT ().a != 1)
+ return 1;
+
+ if (s.GetT ().b != 2)
+ return 2;
+
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-23.cs b/mcs/tests/test-23.cs
new file mode 100644
index 00000000000..0723c667d95
--- /dev/null
+++ b/mcs/tests/test-23.cs
@@ -0,0 +1,106 @@
+//
+// Tests properties
+//
+using System;
+
+class X {
+ static int v;
+
+ static X ()
+ {
+ v = 10;
+ }
+
+ public static int Value {
+ get {
+ return v;
+ }
+
+ set {
+ v = value;
+ }
+ }
+
+ static int Main ()
+ {
+ if (Value != 10)
+ return 1;
+
+ Value = 4;
+
+ if (Value != 4)
+ return 2;
+
+ Y y = new Y ("hello");
+
+ if (y.Value != "hello")
+ return 3;
+
+ y.Value = "goodbye";
+ if (y.Value != "goodbye")
+ return 4;
+
+ Z z = new Z ();
+
+ if (Z.IVal != 4)
+ return 5;
+ Z.IVal = 10;
+ if (Z.IVal != 10)
+ return 6;
+
+ z.XVal = 23;
+ if (z.XVal != 23)
+ return 7;
+
+ return 0;
+ }
+}
+
+class Y {
+ string init;
+
+ public Y (string s)
+ {
+ init = s;
+ }
+
+ public string Value {
+ get {
+ return init;
+ }
+
+ set {
+ init = value;
+ }
+ }
+}
+
+struct Z {
+ static int val;
+ int xval;
+
+ static Z ()
+ {
+ val = 4;
+ }
+
+ static public int IVal {
+ get {
+ return val;
+ }
+
+ set {
+ val= value;
+ }
+ }
+
+ public int XVal {
+ get {
+ return xval;
+ }
+
+ set {
+ xval = value;
+ }
+ }
+}
diff --git a/mcs/tests/test-24.cs b/mcs/tests/test-24.cs
new file mode 100644
index 00000000000..e69a844c93d
--- /dev/null
+++ b/mcs/tests/test-24.cs
@@ -0,0 +1,35 @@
+//
+// Properties intermixed in assignments
+//
+
+using System;
+
+class X {
+
+ static string v;
+
+ static string S {
+ get {
+ return v;
+ }
+ set {
+ v = value;
+ }
+ }
+
+ static string x, b;
+
+ static int Main ()
+ {
+
+ x = S = b = "hlo";
+ if (x != "hlo")
+ return 1;
+ if (S != "hlo")
+ return 2;
+ if (b != "hlo")
+ return 3;
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-25.cs b/mcs/tests/test-25.cs
new file mode 100644
index 00000000000..a01a8daa4f1
--- /dev/null
+++ b/mcs/tests/test-25.cs
@@ -0,0 +1,65 @@
+//
+// Test the various iteration constructs, breaks and continues
+//
+// FIXME: Add foreach and more tests.
+//
+using System;
+
+class X {
+
+ static int Main ()
+ {
+ int i, j, t, k;
+
+ for (i = 0; i < 10; i++){
+ if (i == 5)
+ break;
+ }
+
+ if (i != 5)
+ return 1;
+
+ t = 0;
+ k = 0;
+ for (i = 0; i < 10; i++){
+ for (j = 0; j < 10; j++){
+ if (j > 3)
+ break;
+ t++;
+
+ if (j >= 1)
+ continue;
+
+ k++;
+ }
+ }
+
+ if (t != 40)
+ return 2;
+ if (k != 10)
+ return 3;
+
+
+ t = 0;
+ do {
+ if (k == 5)
+ continue;
+ t++;
+ } while (--k > 0);
+
+ if (t != 9)
+ return 4;
+
+ t = 0;
+ do {
+ t++;
+ if (t == 5)
+ break;
+ } while (k++ < 10);
+
+ if (t != 5)
+ return 5;
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-26.cs b/mcs/tests/test-26.cs
new file mode 100644
index 00000000000..38b173ca3bd
--- /dev/null
+++ b/mcs/tests/test-26.cs
@@ -0,0 +1,72 @@
+using System;
+
+public class Blah {
+
+ public delegate int MyDelegate (int i, int j);
+
+ public int Foo (int i, int j)
+ {
+ return i+j;
+ }
+
+ public static int Test1 ()
+ {
+ Blah f = new Blah ();
+
+ MyDelegate del = new MyDelegate (f.Foo);
+
+ MyDelegate another = new MyDelegate (del);
+
+ int number = del (2, 3);
+
+ int i = another (4, 6);
+
+ Console.WriteLine ("Delegate invocation of one returned : " + number);
+
+ Console.WriteLine ("Delegate invocation of the other returned : " + i);
+
+ if (number == 5 && i == 10)
+ return 0;
+ else
+ return 1;
+ }
+
+ public delegate int List (params int [] args);
+
+ public static int Adder (params int [] args)
+ {
+ int total = 0;
+
+ foreach (int i in args)
+ total += i;
+
+ return total;
+ }
+
+ public static int Test2 ()
+ {
+ List my_adder = new List (Adder);
+
+ if (my_adder (1, 2, 3) != 6)
+ return 2;
+
+ return 0;
+ }
+
+ public static int Main ()
+ {
+ int v;
+
+ v = Test1 ();
+ if (v != 0)
+ return v;
+
+ v = Test2 ();
+ if (v != 0)
+ return v;
+
+ Console.WriteLine ("All tests pass");
+ return 0;
+ }
+
+}
diff --git a/mcs/tests/test-27.cs b/mcs/tests/test-27.cs
new file mode 100644
index 00000000000..f1bd59b102a
--- /dev/null
+++ b/mcs/tests/test-27.cs
@@ -0,0 +1,97 @@
+using System;
+
+public interface Hello {
+
+ bool MyMethod (int i);
+}
+
+public interface Another : Hello {
+
+ int AnotherMethod (int i);
+}
+
+public class Foo : Hello, Another {
+
+ public bool MyMethod (int i)
+ {
+ if (i == 22)
+ return true;
+ else
+ return false;
+ }
+
+ public int AnotherMethod (int i)
+ {
+ return i * 10;
+ }
+
+}
+
+public interface ITest {
+
+ bool TestMethod (int i, float j);
+}
+
+public class Blah : Foo {
+
+ public delegate void MyDelegate (int i, int j);
+
+ void Bar (int i, int j)
+ {
+ Console.WriteLine (i+j);
+ }
+
+ public static int Main ()
+ {
+ Blah k = new Blah ();
+
+ Foo f = k;
+
+ object o = k;
+
+ if (f is Foo)
+ Console.WriteLine ("I am a Foo!");
+
+ Hello ihello = f;
+
+ Another ianother = f;
+
+ ihello = ianother;
+
+ bool b = f.MyMethod (22);
+
+ MyDelegate del = new MyDelegate (k.Bar);
+
+ del (2, 3);
+
+ Delegate tmp = del;
+
+ // Explicit reference conversions
+
+ MyDelegate adel = (MyDelegate) tmp;
+
+ adel (4, 7);
+
+ Blah l = (Blah) o;
+
+ l.Bar (20, 30);
+
+ l = (Blah) f;
+
+ l.Bar (2, 5);
+
+ f = (Foo) ihello;
+
+ // The following cause exceptions even though they are supposed to work
+ // according to the spec
+
+ // This one sounds ridiculous !
+ // ITest t = (ITest) l;
+
+ // ITest u = (ITest) ihello;
+
+ return 0;
+
+ }
+}
+
diff --git a/mcs/tests/test-28.cs b/mcs/tests/test-28.cs
new file mode 100644
index 00000000000..3dc65d776bd
--- /dev/null
+++ b/mcs/tests/test-28.cs
@@ -0,0 +1,47 @@
+abstract class A {
+ protected abstract int this [int a] { get; }
+}
+
+class B : A {
+ protected override int this [int a] { get { return a;} }
+
+ public int M ()
+ {
+ return this [0];
+ }
+
+}
+class X {
+ int v1, v2;
+
+ int this [int a] {
+ get {
+ if (a == 0)
+ return v1;
+ else
+ return v2;
+ }
+
+ set {
+ if (a == 0)
+ v1 = value;
+ else
+ v2 = value;
+ }
+ }
+
+ static int Main ()
+ {
+ X x = new X ();
+ int b;
+
+ x [0] = 1;
+ if (x.v1 != 1)
+ return 1;
+
+ if (x [0] != 1)
+ return 2;
+
+ return new B ().M ();
+ }
+}
diff --git a/mcs/tests/test-29.cs b/mcs/tests/test-29.cs
new file mode 100644
index 00000000000..6183126d277
--- /dev/null
+++ b/mcs/tests/test-29.cs
@@ -0,0 +1,40 @@
+//
+// Versioning, should choose Derived.Add (1)
+//
+using System;
+
+class Base {
+ public int val;
+
+ public void Add (int x)
+ {
+ Console.WriteLine ("Incorrect method called");
+
+ val = 1;
+ }
+}
+
+class Derived : Base {
+ public void Add (double x)
+ {
+ Console.WriteLine ("Calling the derived class with double! Excellent!");
+ val = 2;
+ }
+}
+
+class Demo {
+
+ static int Main ()
+ {
+ Derived d = new Derived ();
+
+ d.Add (1);
+ if (d.val == 1)
+ return 1;
+
+ if (d.val == 2)
+ return 0;
+ return 2;
+
+ }
+}
diff --git a/mcs/tests/test-3.cs b/mcs/tests/test-3.cs
new file mode 100755
index 00000000000..5e7d4e1fab2
--- /dev/null
+++ b/mcs/tests/test-3.cs
@@ -0,0 +1,62 @@
+
+public class TestIntOps {
+
+ public static sbyte sbyte_add (sbyte a, sbyte b) {
+ return (sbyte)(a+b);
+ }
+
+ public static short short_add (short a, short b) {
+ return (short)(a+b);
+ }
+
+ public static double double_add (double a, double b) {
+ return a+b;
+ }
+
+ public static int int_add (int a, int b) {
+ return a+b;
+ }
+
+ public static int int_sub (int a, int b) {
+ return a-b;
+ }
+
+ public static int int_mul (int a, int b) {
+ return a*b;
+ }
+
+ public static int Main() {
+ int num = 1;
+
+ if (int_add (1, 1) != 2) return num;
+ num++;
+
+ if (int_add (31, -1) != 30) return num;
+ num++;
+
+ if (int_sub (31, -1) != 32) return num;
+ num++;
+
+ if (int_mul (12, 12) != 144) return num;
+ num++;
+
+ if (sbyte_add (1, 1) != 2) return num;
+ num++;
+
+ if (sbyte_add (31, -1) != 30) return num;
+ num++;
+
+ if (short_add (1, 1) != 2) return num;
+ num++;
+
+ if (short_add (31, -1) != 30) return num;
+ num++;
+
+ if (double_add (1.5, 1.5) != 3) return num;
+ num++;
+
+ // add more meaningful tests
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-30.cs b/mcs/tests/test-30.cs
new file mode 100644
index 00000000000..56c8308c02b
--- /dev/null
+++ b/mcs/tests/test-30.cs
@@ -0,0 +1,60 @@
+//
+// Tests whether we implement the correct methods from interfaces
+//
+
+using System;
+
+interface IA {
+ void Draw ();
+}
+
+interface IB {
+ void Draw ();
+}
+
+class X : IA, IB {
+ public bool ia_called;
+ public bool ib_called;
+
+ void IA.Draw ()
+ {
+ ia_called = true;
+ }
+
+ void IB.Draw ()
+ {
+ ib_called = true;
+ }
+}
+
+class test {
+
+ static int Main ()
+ {
+ X x = new X ();
+
+ ((IA) x).Draw ();
+ Console.WriteLine ("IA: " + x.ia_called);
+ Console.WriteLine ("IB: " + x.ib_called);
+
+ if (x.ib_called)
+ return 1;
+ if (!x.ia_called)
+ return 2;
+
+ X y = new X ();
+ ((IB) y).Draw ();
+ Console.WriteLine ("IA: " + x.ia_called);
+ Console.WriteLine ("IB: " + x.ib_called);
+
+ if (!y.ib_called)
+ return 3;
+ if (y.ia_called)
+ return 4;
+
+ Console.WriteLine ("All tests pass");
+ return 0;
+ }
+}
+
+
diff --git a/mcs/tests/test-31.cs b/mcs/tests/test-31.cs
new file mode 100644
index 00000000000..c7c31fed25e
--- /dev/null
+++ b/mcs/tests/test-31.cs
@@ -0,0 +1,41 @@
+//
+// Versioning test: make sure that we output a warning, but still call the derived
+// method
+//
+using System;
+
+class Base {
+ public int which;
+
+ public virtual void A ()
+ {
+ which = 1;
+ }
+}
+
+class Derived :Base {
+ public virtual void A ()
+ {
+ which = 2;
+ }
+}
+
+class Test {
+ static int Main ()
+ {
+ Derived d = new Derived ();
+
+ //
+ // This should call Derived.A and output a warning.
+ //
+ d.A ();
+
+
+ if (d.which == 1)
+ return 1;
+
+ Console.WriteLine ("Test passes");
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-32.cs b/mcs/tests/test-32.cs
new file mode 100644
index 00000000000..94399b230e2
--- /dev/null
+++ b/mcs/tests/test-32.cs
@@ -0,0 +1,21 @@
+using System;
+
+public class Blah {
+
+ public static int Main ()
+ {
+ int [][] i = new int [2][];
+
+ int [,][] j = new int [3,6][];
+
+ Blah [] k = new Blah [2];
+
+ Blah [,][] l = new Blah [3,4][];
+
+ Uri [] uri = new Uri [4];
+
+ Console.WriteLine ("All arrays successfully created");
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-33.cs b/mcs/tests/test-33.cs
new file mode 100644
index 00000000000..3e908b2ef35
--- /dev/null
+++ b/mcs/tests/test-33.cs
@@ -0,0 +1,51 @@
+using System;
+
+namespace FirstOuter
+{
+ namespace FirstInner
+ {
+ public class First
+ {
+ public string MyIdentity {
+ get {
+ return this.GetType().FullName;
+ }
+ }
+ }
+ }
+
+ public class Second : FirstInner.First {}
+
+ namespace SecondInner
+ {
+ public class Third : FirstOuter.FirstInner.First {}
+ }
+
+ namespace FirstInner // purposefully again
+ {
+ public class Fourth : First {} // must understand First in the nom qualified form
+ }
+}
+
+public class Fifth : FirstOuter.FirstInner.First {}
+
+class Application
+{
+ static int Main(string[] args)
+ {
+ FirstOuter.FirstInner.First V1 = new FirstOuter.FirstInner.First();
+ FirstOuter.Second V2 = new FirstOuter.Second();
+ FirstOuter.SecondInner.Third V3 = new FirstOuter.SecondInner.Third();
+ FirstOuter.FirstInner.Fourth V4 = new FirstOuter.FirstInner.Fourth();
+ Fifth V5 = new Fifth();
+
+ Console.WriteLine("V1 is " + V1.MyIdentity);
+ Console.WriteLine("V2 is " + V2.MyIdentity);
+ Console.WriteLine("V3 is " + V3.MyIdentity);
+ Console.WriteLine("V4 is " + V4.MyIdentity);
+ Console.WriteLine("V5 is " + V5.MyIdentity);
+
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-34.cs b/mcs/tests/test-34.cs
new file mode 100644
index 00000000000..44a9fca10ca
--- /dev/null
+++ b/mcs/tests/test-34.cs
@@ -0,0 +1,90 @@
+//
+// This test tests both how arguments are selected in the presence
+// of ref/out modifiers and the params arguments.
+//
+using System;
+
+public class Blah {
+ static int got;
+
+ public static void Foo (ref int i, ref int j)
+ {
+ got = 1;
+ }
+
+ public static int Bar (int j, params int [] args)
+ {
+ got = 2;
+ int total = 0;
+
+ foreach (int i in args){
+ Console.WriteLine ("My argument: " + i);
+ total += i;
+ }
+
+ return total;
+ }
+
+ public static void Foo (int i, int j)
+ {
+ got = 3;
+ }
+
+ static void In (ref int a)
+ {
+ a++;
+ }
+
+ static void Out (ref int a)
+ {
+ In (ref a);
+ }
+
+ static int AddArray (params int [] valores)
+ {
+ int total = 0;
+
+ for (int i = 0; i < valores.Length; i++)
+ total += valores [i];
+
+ return total;
+ }
+
+ public static int Main ()
+ {
+ int i = 1;
+ int j = 2;
+
+ int [] arr = new int [2] { 0, 1 };
+
+ Foo (i, j);
+ if (got != 3)
+ return 1;
+
+ Foo (ref i, ref j);
+ if (got != 1)
+ return 2;
+
+ if (Bar (i, j, 5, 4, 3, 3, 2) != 19)
+ return 4;
+
+ //if (Bar (1, arr) != 1)
+ // return 5;
+
+ if (got != 2)
+ return 3;
+
+ int k = 10;
+
+ Out (ref k);
+ if (k != 11)
+ return 10;
+
+ int [] arr2 = new int [2] {1, 2};
+
+ if (AddArray (arr2) != 3)
+ return 11;
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-35.cs b/mcs/tests/test-35.cs
new file mode 100755
index 00000000000..d9bc1d8338e
--- /dev/null
+++ b/mcs/tests/test-35.cs
@@ -0,0 +1,71 @@
+//
+// This test checks the !x optimization for if/while/for/do
+//
+class X {
+
+ static bool t = true;
+ static bool f = false;
+ static int j = 0;
+
+ static void a ()
+ {
+ if (!t)
+ j = 1;
+ }
+
+ static void w (int x)
+ {
+ System.Console.WriteLine (" " + x);
+ }
+
+ static int Main ()
+ {
+ int ok = 0, error = 0;
+
+ if (!f)
+ ok = 1;
+ else
+ error++;
+
+ w (1);
+ if (f)
+ error++;
+ else
+ ok |= 2;
+
+ w(2);
+ if (t)
+ ok |= 4;
+ else
+ error++;
+
+ if (!t)
+ error++;
+ else
+ ok |= 8;
+
+ if (!(t && f == false))
+ error++;
+ else
+ ok |= 16;
+
+ int i = 0;
+ w(3);
+ do {
+ i++;
+ } while (!(i > 5));
+ if (i != 6)
+ error ++;
+ else
+ ok |= 32;
+
+ w(100);
+ System.Console.WriteLine ("Value: " + t);
+ do {
+ i++;
+ } while (!t);
+
+ System.Console.WriteLine ("Ok=" + ok + " Errors=" + error);
+ return ((ok == 63) && (error == 0)) ? 0 : 1;
+ }
+}
diff --git a/mcs/tests/test-36.cs b/mcs/tests/test-36.cs
new file mode 100755
index 00000000000..9f4897a82f4
--- /dev/null
+++ b/mcs/tests/test-36.cs
@@ -0,0 +1,46 @@
+//
+// This program excercises invoking foreach on structures
+// that implement GetEnumerator
+//
+
+using System;
+using System.Collections;
+struct X {
+ int [] a;
+
+ public IEnumerator GetEnumerator ()
+ {
+ a = new int [3] { 1, 2, 3};
+ return a.GetEnumerator ();
+ }
+ }
+
+class Y {
+ static X x;
+
+ static int Main ()
+ {
+ int total = 0;
+ x = new X ();
+
+ foreach (object a in x){
+ total += (int) a;
+ }
+
+ if (total != 6)
+ return 1;
+
+ total = 0;
+
+ //
+ // implicit block
+ //
+ foreach (object a in x)
+ total += (int) a;
+ if (total != 6)
+ return 2;
+
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-37.cs b/mcs/tests/test-37.cs
new file mode 100755
index 00000000000..91f54f4d9a0
--- /dev/null
+++ b/mcs/tests/test-37.cs
@@ -0,0 +1,136 @@
+//
+// This test excercises array access on single dimension, multi-dimension
+// and jagged arrays.
+//
+using System;
+
+class X {
+ static void m (int [] a)
+ {
+ a [0] = 0xdead;
+ }
+
+ static int test_int_single_dim ()
+ {
+ int [] a = new int [10];
+ int i;
+
+ for (i = 0; i < 10; i++)
+ a [i] = i;
+
+ m (a);
+
+ if (a [0] != 0xdead)
+ return 1;
+
+ a [0] = 0;
+ for (i = 9; i >= 0; i--){
+ if (a [i] != i)
+ return 2;
+ }
+ return 0;
+ }
+
+ static int simple_test_double_dim ()
+ {
+ int [,] b = new int [10, 10];
+
+ b [0, 0] = 1;
+ b [4, 4] = 1;
+
+ if (b [0, 0] != b [4, 4])
+ return 20;
+ if (b [1, 1] != b [5, 5])
+ return 21;
+
+ return 0;
+ }
+
+// static void dd (int [,] b)
+// {
+// int i, j;
+//
+// for (i = 0; i < 10; i++)
+// for (j = 0; j < 10; j++)
+// b [i, j] = b [i, j] + 1;
+// }
+//
+// static int test_int_double_dim ()
+// {
+// int [,] b = new int [10,10];
+// int i, j;
+//
+// for (i = 0; i < 10; i++)
+// for (j = 0; j < 10; j++)
+// b [i,j] = i * 10 + j;
+//
+// dd (b);
+//
+// for (i = 0; i < 10; i++)
+// for (j = 0; j < 10; j++)
+// if (b [i,j] != i *10 + j + 1){
+// Console.WriteLine ("Expecting " + (i * 10 + j + 1) + "got: " + b [i,j]);
+// return 10;
+// }
+//
+// return 0;
+// }
+
+// static int test_jagged ()
+// {
+// int [][] a = new int [10][];
+// int i;
+//
+// for (i = 0; i < 10; i++){
+// if (a [i] != null)
+// return 20;
+//
+// a [i] = new int [10];
+//
+// for (int j = 0; j < 10; j++){
+// int q;
+// a [i][j] = j * 10;
+// q = a [i][j] = j * 10;
+//
+// a [i][j]++;
+//
+// if (a [i][j] != q + 1)
+// return 21;
+// }
+// }
+//
+// return 0;
+// }
+
+ static int Main ()
+ {
+ int v;
+
+ Console.WriteLine ("hello");
+ return 0;
+
+ v = test_int_single_dim ();
+
+ if (v != 0)
+ return v;
+
+ // v = test_int_double_dim ();
+ // if (v != 0)
+ // return v;
+ //
+ // v = test_jagged ();
+
+ v = simple_test_double_dim ();
+ if (v != 0)
+ return v;
+
+ int [] a = new int [10];
+ int i;
+ for (i = 0; i < 10; i++){
+ a [i] = i;
+ // a [i]++;
+ // Console.WriteLine ("Should be: " + (i + 1) + " it is = " + a [i]);
+ }
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-38.cs b/mcs/tests/test-38.cs
new file mode 100755
index 00000000000..69dbbc3f936
--- /dev/null
+++ b/mcs/tests/test-38.cs
@@ -0,0 +1,36 @@
+class X {
+ int v1, v2;
+
+ int this [int a] {
+ get {
+ if (a == 0)
+ return v1;
+ else
+ return v2;
+ }
+
+ set {
+ if (a == 0)
+ v1 = value;
+ else
+ v2 = value;
+ }
+ }
+
+ static int Main ()
+ {
+ X x = new X ();
+ int b;
+
+ x [0] = x [1] = 1;
+ x [0] = 1;
+ if (x.v1 != 1)
+ return 1;
+
+ if (x [0] != 1)
+ return 2;
+
+ return 0;
+
+ }
+}
diff --git a/mcs/tests/test-39.cs b/mcs/tests/test-39.cs
new file mode 100644
index 00000000000..7366b1c0ce2
--- /dev/null
+++ b/mcs/tests/test-39.cs
@@ -0,0 +1,38 @@
+using System;
+[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
+ public class SimpleAttribute : Attribute {
+
+ string name = null;
+
+ public string MyNamedArg;
+
+ private string secret;
+
+ public SimpleAttribute (string name)
+ {
+ this.name = name;
+ }
+
+ public string AnotherArg {
+ get {
+ return secret;
+ }
+ set {
+ secret = value;
+ }
+ }
+
+ }
+
+[Simple ("Dummy", MyNamedArg = "Dude!")]
+[Simple ("Vids", MyNamedArg = "Raj", AnotherArg = "Foo")]
+ public class Blah {
+
+ public static int Main ()
+ {
+ Console.WriteLine ("A dummy app which tests attribute emission");
+ return 0;
+ }
+ }
+
+
diff --git a/mcs/tests/test-4.cs b/mcs/tests/test-4.cs
new file mode 100755
index 00000000000..3023f6e9d1b
--- /dev/null
+++ b/mcs/tests/test-4.cs
@@ -0,0 +1,40 @@
+using System;
+class X {
+ bool sbyte_selected;
+ bool int_selected;
+
+ void test (sbyte s)
+ {
+ sbyte_selected = true;
+ }
+
+ void test (int i)
+ {
+ int_selected = true;
+ }
+
+ static int Main ()
+ {
+ X x = new X ();
+
+ x.test (1);
+ if (x.sbyte_selected){
+ Console.WriteLine ("FAILED: Sbyte selected on constant int argument");
+ return 1;
+ } else {
+ Console.WriteLine ("OK: int selected for constant int");
+ }
+
+ X y = new X ();
+ sbyte s = 10;
+
+ y.test (s);
+ if (y.sbyte_selected){
+ Console.WriteLine ("OK: sbyte selected for sbyte argument");
+ } else {
+ Console.WriteLine ("FAILED: sbyte not selected for sbyte argument");
+ return 1;
+ }
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-40.cs b/mcs/tests/test-40.cs
new file mode 100644
index 00000000000..d640c5a4970
--- /dev/null
+++ b/mcs/tests/test-40.cs
@@ -0,0 +1,75 @@
+using System;
+
+public class Blah {
+
+ enum Bar {
+ a = MyEnum.Foo,
+ b = A.c,
+ c = MyEnum.Bar,
+ d = myconstant
+ }
+
+ public enum MyEnum : byte {
+ Foo = 254,
+ Bar = B.y
+ }
+
+ enum A {
+ a, b, c
+ }
+
+ enum B {
+ x, y, z
+ }
+
+ enum AA : byte { a, b }
+ enum BB : ulong { x, y }
+
+ const int myconstant = 30;
+
+ public static int Main ()
+ {
+ byte b = (byte) MyEnum.Foo;
+
+ Console.WriteLine ("Foo has a value of " + b);
+
+ if (b != 254)
+ return 1;
+
+ int i = (int) A.a;
+ int j = (int) B.x;
+ int k = (int) A.c;
+ int l = (int) AA.b + 1;
+
+ if (i != j)
+ return 1;
+
+ if (k != l)
+ return 1;
+
+ A var = A.b;
+
+ i = (int) Bar.a;
+
+ if (i != 254)
+ return 1;
+
+ i = (int) Bar.b;
+
+ if (i != 2)
+ return 1;
+
+ j = (int) Bar.c;
+
+ if (j != 1)
+ return 1;
+
+ j = (int) Bar.d;
+
+ if (j != 30)
+ return 1;
+
+ Console.WriteLine ("Enum emission test okay");
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-41.cs b/mcs/tests/test-41.cs
new file mode 100644
index 00000000000..cdf1fd45f89
--- /dev/null
+++ b/mcs/tests/test-41.cs
@@ -0,0 +1,93 @@
+//
+// This tests the ref access to parameters
+//
+using System;
+
+class X {
+
+ static void A (ref int a, ref uint b, ref sbyte c, ref byte d, ref long e, ref ulong f,
+ ref short g, ref ushort h, ref char i, ref X x, ref float j, ref double k)
+ {
+ if (a == 1)
+ a = 2;
+
+ if (b == 1)
+ b = 2;
+
+ if (c == 1)
+ c = 2;
+
+ if (d == 1)
+ d = 2;
+
+ if (e == 1)
+ e = 2;
+
+ if (f == 1)
+ f = 2;
+
+ if (g == 1)
+ g = 2;
+
+ if (h == 1)
+ h = 2;
+
+ if (i == 'a')
+ i = 'b';
+
+ if (x == null)
+ x = new X ();
+
+ if (j == 1.0)
+ j = 2.0F;
+ if (k == 1.0)
+ k = 2.0;
+ }
+
+ static int Main ()
+ {
+ int a = 1;
+ uint b = 1;
+ sbyte c = 1;
+ byte d = 1;
+ long e = 1;
+ ulong f = 1;
+ short g = 1;
+ ushort h = 1;
+ char i = 'a';
+ float j = 1.0F;
+ double k = 1.0;
+ X x = null;
+
+ A (ref a, ref b, ref c, ref d, ref e, ref f, ref g, ref h, ref i, ref x, ref j, ref k);
+
+ if (a != 2)
+ return 1;
+ if (b != 2)
+ return 2;
+ if (c != 2)
+ return 3;
+ if (d != 2)
+ return 4;
+ if (e != 2)
+ return 5;
+ if (f != 2)
+ return 6;
+ if (g != 2)
+ return 7;
+ if (h != 2)
+ return 8;
+ if (i != 'b')
+ return 9;
+ if (j != 2.0)
+ return 10;
+ if (k != 2.0)
+ return 11;
+ if (x == null)
+ return 12;
+
+ Console.WriteLine ("Test passed");
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-42.cs b/mcs/tests/test-42.cs
new file mode 100755
index 00000000000..684324b8f93
--- /dev/null
+++ b/mcs/tests/test-42.cs
@@ -0,0 +1,184 @@
+//
+// This test exercises the various ways in which mutator operators can be
+// used in C# and the various different scenarios that the compiler would
+// have to deal with
+//
+// variables, linear arrays, multi-dimensional arrays, jagged arrays,
+// properties, indexers and overloaded ++ and --
+//
+
+class X {
+
+ public int v, p;
+ public int idx;
+
+ public int this [int n] {
+ get {
+ idx = n;
+ return v;
+ }
+ set {
+ idx = n;
+ v = value;
+ }
+ }
+
+ public int P {
+ get {
+ return p;
+ }
+
+ set {
+ p = value;
+ }
+ }
+
+}
+
+class Z {
+ int v;
+
+ public Z P {
+ get {
+ return null;
+ }
+
+ set {
+ }
+ }
+
+ static public Z operator ++ (Z v)
+ {
+ v.v++;
+ return v;
+ }
+}
+
+class Y {
+
+ static int p_pre_increment (X x)
+ {
+ return ++x.P;
+ }
+
+ static int p_post_increment (X x)
+ {
+ return x.P++;
+ }
+
+ static int i_pre_increment (X x)
+ {
+ return ++x [100];
+ }
+
+ static int i_post_increment (X x)
+ {
+ return x [14]++;
+ }
+
+ static Z overload_increment (Z z)
+ {
+ return z++;
+ }
+
+ static Z overload_pre_increment (Z z)
+ {
+ return ++z;
+ }
+
+ static Z ugly (Z z)
+ {
+ return z.P++;
+ }
+
+ //
+ // Tests the ++ and -- operators on integers
+ //
+ static int simple (int i)
+ {
+ if (++i != 11)
+ return 1;
+ if (--i != 10)
+ return 2;
+ if (i++ != 10)
+ return 3;
+ if (i-- != 11)
+ return 4;
+ return 0;
+ }
+
+ static int arrays ()
+ {
+ int [] a = new int [10];
+ int i, j;
+
+ for (i = 0; i < 10; i++)
+ a [i]++;
+
+ for (i = 0; i < 10; i++)
+ if (a [i] != 1)
+ return 100;
+
+ int [,] b = new int [10,10];
+ for (i = 0; i < 10; i++){
+ for (j = 0; j < 10; j++){
+ b [i,j] = i * 10 + j;
+ if (i < 5)
+ b [i,j]++;
+ else
+ ++b [i,j];
+ }
+ }
+
+ for (i = 0; i < 10; i++){
+ for (j = 0; j < 10; j++){
+ if (b [i,j] != i * 10 + (j + 1))
+ return 101;
+ }
+ }
+
+ return 0;
+ }
+
+ static int Main ()
+ {
+ X x = new X ();
+ int c;
+
+ if ((c = simple (10)) != 0)
+ return c;
+
+ if (i_pre_increment (x) != 1)
+ return 5;
+
+ if (x.idx != 100)
+ return 6;
+
+ if (i_post_increment (x) != 1)
+ return 7;
+
+ if (x.idx != 14)
+ return 8;
+
+ if (p_pre_increment (x) != 1)
+ return 9;
+
+ if (x.p != 1)
+ return 10;
+
+ if (p_post_increment (x) != 1)
+ return 10;
+
+ if (x.p != 2)
+ return 11;
+
+ Z z = new Z();
+
+ overload_increment (z);
+
+ arrays ();
+
+ return 0;
+ }
+
+}
diff --git a/mcs/tests/test-43.cs b/mcs/tests/test-43.cs
new file mode 100755
index 00000000000..7d8deffe812
--- /dev/null
+++ b/mcs/tests/test-43.cs
@@ -0,0 +1,78 @@
+//
+// This test is used for testing the foreach array support
+//
+using System;
+
+class X {
+
+ static int test_single (int [] a)
+ {
+ int total = 0;
+
+ foreach (int i in a)
+ total += i;
+
+ return total;
+ }
+
+ static int test_continue (int [] a)
+ {
+ int total = 0;
+ int j = 0;
+
+ foreach (int i in a){
+ j++;
+ if (j == 5)
+ continue;
+ total += i;
+ }
+
+ return total;
+ }
+
+ static int test_break (int [] a)
+ {
+ int total = 0;
+ int j = 0;
+
+ foreach (int i in a){
+ j++;
+ if (j == 5)
+ break;
+ total += i;
+ }
+
+ return total;
+ }
+
+ static int Main ()
+ {
+ int [] a = new int [10];
+ int [] b = new int [2];
+
+ for (int i = 0; i < 10; i++)
+ a [i] = 10 + i;
+
+ for (int j = 0; j < 2; j++)
+ b [j] = 50 + j;
+
+ if (test_single (a) != 145)
+ return 1;
+
+ if (test_single (b) != 101)
+ return 2;
+
+ if (test_continue (a) != 131){
+ Console.WriteLine ("Expecting: 131, got " + test_continue (a));
+ return 3;
+ }
+
+ if (test_break (a) != 46){
+ Console.WriteLine ("Expecting: 46, got " + test_break (a));
+ return 4;
+ }
+
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-44.cs b/mcs/tests/test-44.cs
new file mode 100755
index 00000000000..c1b896a5814
--- /dev/null
+++ b/mcs/tests/test-44.cs
@@ -0,0 +1,55 @@
+//
+// This test shows that the current way in which we handle blocks
+// and statements is broken. The b [q,w] code is only executed 10
+// times instead of a 100
+//
+using System;
+
+class X {
+
+ static int dob (int [,]b)
+ {
+ int total = 0;
+
+ foreach (int i in b)
+ total += i;
+
+ return total;
+ }
+
+ //
+ // This tests typecasting from an object to an array of ints
+ // and then doing foreach
+ //
+ static int count (object o)
+ {
+ int total = 0;
+
+ foreach (int i in (int []) o)
+ total += i;
+
+ return total;
+ }
+
+ static int Main ()
+ {
+ int [,] b = new int [10,10];
+
+ for (int q = 0; q < 10; q++)
+ for (int w = 0; w < 10; w++)
+ b [q,w] = q * 10 + w;
+
+ if (dob (b) != 4950)
+ return 1;
+
+ int [] a = new int [10];
+ for (int i = 0; i < 10; i++)
+ a [i] = 2;
+
+ if (count (a) != 20)
+ return 2;
+
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-45.cs b/mcs/tests/test-45.cs
new file mode 100644
index 00000000000..9d50a9c9420
--- /dev/null
+++ b/mcs/tests/test-45.cs
@@ -0,0 +1,101 @@
+using System;
+
+public class Blah {
+
+ private static int[] array = {0, 1, 2, 3};
+
+ private static int [,] bar = { {0,1}, {4,5}, {10,20} };
+
+ static string [] names = {
+ "Miguel", "Paolo", "Dietmar", "Dick", "Ravi"
+ };
+
+ public static int Main ()
+ {
+ int [] i = new int [4] { 0, 1, 2, 3 };
+
+ short [,] j = new short [4,2] { {0,1}, {2,3}, {4,5}, {6,7} };
+
+ ushort [] a = { 4, 5, 6, 7 };
+
+ long [,,] m = new long [2,3,2] {{{0,1}, {2,3}, {4,5}}, {{6,7}, {8,9}, {10,11}}};
+
+ int foo = 1;
+ int [] k = new int [] { foo, foo+1, foo+4 };
+
+ int [,] boo = new int [,] {{foo, foo+10}, {foo+3, foo+10}};
+
+ float [] f_array = new float [] { 1.23F, 4.5F, 6.24F };
+
+ double [] double_arr = new double [] { 34.4567, 90.1226, 54.9823 };
+
+ char [] c_arr = { 'A', 'B', 'C', 'M', 'R' };
+
+ byte [] b_arr = { 0, 3, 8, 10, 21 };
+
+ sbyte [] s_arr = { 10, 15, 30, 123 };
+
+ if (a [2] != 6)
+ return 1;
+
+ if (s_arr [3] != 123)
+ return 2;
+
+ if (i [2] != 2)
+ return 1;
+
+ if (j [1,1] != 3)
+ return 1;
+
+ for (int t = 0; t < 4; ++t) {
+ if (array [t] != t)
+ return 1;
+
+ if (a [t] != (t + 4))
+ return 1;
+ }
+
+ if (bar [2,1] != 20)
+ return 1;
+
+ if (k [2] != 5)
+ return 1;
+
+ if (m [1,1,1] != 9)
+ return 1;
+
+ if (boo [0,1] != 11)
+ return 1;
+
+ if (f_array [0] != 1.23F)
+ return 1;
+
+ if (double_arr [1] != 90.1226)
+ return 1;
+
+ foreach (string s in names)
+ Console.WriteLine ("Hello, " + s);
+
+ if (names [0] != "Miguel")
+ return 1;
+
+ if (c_arr [4] != 'R')
+ return 2;
+
+ int count = 10;
+
+ int [] x = new int [count];
+
+ for (int idx = 0; idx < count; idx++)
+ x [idx] = idx + 1;
+
+ for (int idx = count; idx > 0; ){
+ idx--;
+ if (x [idx] != idx + 1)
+ return 12;
+ }
+ Console.WriteLine ("Array initialization test okay.");
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-46.cs b/mcs/tests/test-46.cs
new file mode 100755
index 00000000000..6a4aa000a0b
--- /dev/null
+++ b/mcs/tests/test-46.cs
@@ -0,0 +1,127 @@
+//
+// This test probes the various explicit unboxing casts
+//
+using System;
+
+class X {
+ static int cast_int (object o) { return (int) o; }
+ static uint cast_uint (object o) { return (uint) o; }
+ static short cast_short (object o) { return (short) o; }
+ static char cast_char (object o) { return (char) o; }
+ static ushort cast_ushort (object o) { return (ushort) o; }
+ static byte cast_byte (object o) { return (byte) o; }
+ static sbyte cast_sbyte (object o) { return (sbyte) o; }
+ static long cast_long (object o) { return (long) o; }
+ static ulong cast_ulong (object o) { return (ulong) o; }
+ static float cast_float (object o) { return (float) o; }
+ static double cast_double (object o) { return (double) o; }
+ static bool cast_bool (object o) { return (bool) o; }
+
+ static int Main ()
+ {
+ if (cast_int ((object) -1) != -1)
+ return 1;
+ if (cast_int ((object) 1) != 1)
+ return 2;
+ if (cast_int ((object) Int32.MaxValue) != Int32.MaxValue)
+ return 1;
+ if (cast_int ((object) Int32.MinValue) != Int32.MinValue)
+ return 2;
+ if (cast_int ((object) 0) != 0)
+ return 3;
+
+ if (cast_uint ((object) (uint)0) != 0)
+ return 4;
+ if (cast_uint ((object) (uint) 1) != 1)
+ return 5;
+ if (cast_uint ((object) (uint) UInt32.MaxValue) != UInt32.MaxValue)
+ return 6;
+ if (cast_uint ((object) (uint) UInt32.MinValue) != UInt32.MinValue)
+ return 7;
+
+ if (cast_ushort ((object) (ushort) 1) != 1)
+ return 8;
+ if (cast_ushort ((object) (ushort) UInt16.MaxValue) != UInt16.MaxValue)
+ return 9;
+ if (cast_ushort ((object) (ushort) UInt16.MinValue) != UInt16.MinValue)
+ return 10;
+ if (cast_ushort ((object) (ushort) 0) != 0)
+ return 11;
+
+ if (cast_short ((object) (short)-1) != -1)
+ return 12;
+ if (cast_short ((object) (short) 1) != 1)
+ return 13;
+ if (cast_short ((object) (short) Int16.MaxValue) != Int16.MaxValue)
+ return 14;
+ if (cast_short ((object) (short) Int16.MinValue) != Int16.MinValue)
+ return 15;
+ if (cast_short ((object) (short) 0) != 0)
+ return 16;
+
+ if (cast_byte ((object) (byte)1) != 1)
+ return 17;
+ if (cast_byte ((object) (byte) Byte.MaxValue) != Byte.MaxValue)
+ return 18;
+ if (cast_byte ((object) (byte) Byte.MinValue) != Byte.MinValue)
+ return 19;
+ if (cast_byte ((object) (byte) 0) != 0)
+ return 20;
+
+ if (cast_sbyte ((object) (sbyte) -1) != -1)
+ return 21;
+ if (cast_sbyte ((object) (sbyte) 1) != 1)
+ return 22;
+ if (cast_sbyte ((object) (sbyte) SByte.MaxValue) != SByte.MaxValue)
+ return 23;
+ if (cast_sbyte ((object) (sbyte)SByte.MinValue) != SByte.MinValue)
+ return 24;
+ if (cast_sbyte ((object) (sbyte) 0) != 0)
+ return 25;
+
+
+ if (cast_long ((object) (long) -1) != -1)
+ return 26;
+ if (cast_long ((object) (long) 1) != 1)
+ return 27;
+ if (cast_long ((object) (long) Int64.MaxValue) != Int64.MaxValue)
+ return 28;
+ if (cast_long ((object) (long) Int64.MinValue) != Int64.MinValue)
+ return 29;
+ if (cast_long ((object) (long) 0) != 0)
+ return 30;
+
+ if (cast_ulong ((object) (ulong) 0) != 0)
+ return 31;
+ if (cast_ulong ((object) (ulong) 1) != 1)
+ return 32;
+ if (cast_ulong ((object) (ulong) UInt64.MaxValue) != UInt64.MaxValue)
+ return 33;
+ if (cast_ulong ((object) (ulong) UInt64.MinValue) != UInt64.MinValue)
+ return 34;
+
+ if (cast_double ((object) (double) -1) != -1)
+ return 35;
+ if (cast_double ((object) (double) 1) != 1)
+ return 36;
+ if (cast_double ((object) (double) Double.MaxValue) != Double.MaxValue)
+ return 37;
+ if (cast_double ((object) (double) Double.MinValue) != Double.MinValue)
+ return 38;
+ if (cast_double ((object) (double) 0) != 0)
+ return 39;
+
+ if (cast_float ((object) (float) -1) != -1)
+ return 40;
+ if (cast_float ((object) (float) 1) != 1)
+ return 41;
+ if (cast_float ((object) (float)Single.MaxValue) != Single.MaxValue)
+ return 42;
+ if (cast_float ((object) (float) Single.MinValue) != Single.MinValue)
+ return 43;
+ if (cast_float ((object) (float) 0) != 0)
+ return 44;
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-47.cs b/mcs/tests/test-47.cs
new file mode 100755
index 00000000000..c269d0b6c71
--- /dev/null
+++ b/mcs/tests/test-47.cs
@@ -0,0 +1,95 @@
+//
+// Short-circuit evaluation tests
+//
+using System;
+
+class X {
+
+ static int t_count = 0;
+ static int f_count = 0;
+
+ static bool f ()
+ {
+ Console.WriteLine ("f");
+ f_count++;
+ return false;
+ }
+
+ static bool t ()
+ {
+ Console.WriteLine ("t");
+ t_count++;
+ return true;
+ }
+
+ static int Main ()
+ {
+ if (t () && t ()){
+ f_count--;
+ }
+
+ if (t_count != 2)
+ return 1;
+
+ if (f_count != -1)
+ return 3;
+
+ f_count = 0;
+
+ if (t () && f ())
+ if (t_count != 3 && f_count == 1)
+ return 2;
+
+ if (f () && f ())
+ return 3;
+
+ if (f_count != 2)
+ return 4;
+
+ if (f () && t ())
+ return 5;
+
+ if (f_count != 3)
+ return 6;
+
+ if (t_count != 3)
+ return 7;
+
+ //
+ // reset
+ //
+ Console.WriteLine ("or");
+
+ t_count = f_count = 0;
+
+ if (t () || t ()){
+ if (t_count != 1)
+ return 8;
+ } else
+ return 9;
+
+ if (t () || f ()){
+ if (f_count != 0)
+ return 10;
+ if (t_count != 2)
+ return 16;
+ } else
+ return 11;
+
+ if (f () || f ()){
+ return 12;
+ } else
+ if (f_count != 2)
+ return 13;
+
+ if (f () || t ()){
+ if (f_count != 3)
+ return 15;
+ if (t_count != 3)
+ return 17;
+ } else
+ return 14;
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-48.cs b/mcs/tests/test-48.cs
new file mode 100644
index 00000000000..21b6857ba6c
--- /dev/null
+++ b/mcs/tests/test-48.cs
@@ -0,0 +1,30 @@
+using System;
+
+public class Blah {
+
+ public const int i = 5;
+
+ public static int Main ()
+ {
+ const int foo = 10;
+
+ int j = Blah.i;
+
+ if (j != 5)
+ return 1;
+
+ if (foo != 10)
+ return 1;
+
+ for (int i = 0; i < 5; ++i){
+ const int bar = 15;
+
+ Console.WriteLine (bar);
+ Console.WriteLine (foo);
+ }
+
+ Console.WriteLine ("Constant emission test okay");
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-49.cs b/mcs/tests/test-49.cs
new file mode 100755
index 00000000000..67f2c38807c
--- /dev/null
+++ b/mcs/tests/test-49.cs
@@ -0,0 +1,480 @@
+//
+// This tests excercises a number of switch things:
+//
+// Code to test for multiple-labels is different that
+// code for a single label.
+//
+// Code for switching on strings is different from the integer
+// code.
+//
+// nulls (for strings) need to be handled specially since ceq will
+// throw an exception if there.
+//
+// null as a case statement needs to be caught specially
+//
+using System;
+
+class X {
+ enum A {
+ a = 23333,
+ }
+
+ static int s (byte b)
+ {
+ switch (b){
+ case 0: return 255-0;
+ case 1: return 255-1;
+ case 2: return 255-2;
+ case 3: return 255-3;
+ case 4: return 255-4;
+ case 5: return 255-5;
+ case 6: return 255-6;
+ case 7: return 255-7;
+ case 8: return 255-8;
+ case 9: return 255-9;
+ case 10: return 255-10;
+ case 11: return 255-11;
+ case 12: return 255-12;
+ case 13: return 255-13;
+ case 14: return 255-14;
+ case 15: return 255-15;
+ case 16: return 255-16;
+ case 17: return 255-17;
+ case 18: return 255-18;
+ case 19: return 255-19;
+ case 20: return 255-20;
+ case 21: return 255-21;
+ case 22: return 255-22;
+ case 23: return 255-23;
+ case 24: return 255-24;
+ case 25: return 255-25;
+ case 26: return 255-26;
+ case 27: return 255-27;
+ case 28: return 255-28;
+ case 29: return 255-29;
+ case 30: return 255-30;
+ case 31: return 255-31;
+ case 32: return 255-32;
+ case 33: return 255-33;
+ case 34: return 255-34;
+ case 35: return 255-35;
+ case 36: return 255-36;
+ case 37: return 255-37;
+ case 38: return 255-38;
+ case 39: return 255-39;
+ case 40: return 255-40;
+ case 41: return 255-41;
+ case 42: return 255-42;
+ case 43: return 255-43;
+ case 44: return 255-44;
+ case 45: return 255-45;
+ case 46: return 255-46;
+ case 47: return 255-47;
+ case 48: return 255-48;
+ case 49: return 255-49;
+ case 50: return 255-50;
+ case 51: return 255-51;
+ case 52: return 255-52;
+ case 53: return 255-53;
+ case 54: return 255-54;
+ case 55: return 255-55;
+ case 56: return 255-56;
+ case 57: return 255-57;
+ case 58: return 255-58;
+ case 59: return 255-59;
+ case 60: return 255-60;
+ case 61: return 255-61;
+ case 62: return 255-62;
+ case 63: return 255-63;
+ case 64: return 255-64;
+ case 65: return 255-65;
+ case 66: return 255-66;
+ case 67: return 255-67;
+ case 68: return 255-68;
+ case 69: return 255-69;
+ case 70: return 255-70;
+ case 71: return 255-71;
+ case 72: return 255-72;
+ case 73: return 255-73;
+ case 74: return 255-74;
+ case 75: return 255-75;
+ case 76: return 255-76;
+ case 77: return 255-77;
+ case 78: return 255-78;
+ case 79: return 255-79;
+ case 80: return 255-80;
+ case 81: return 255-81;
+ case 82: return 255-82;
+ case 83: return 255-83;
+ case 84: return 255-84;
+ case 85: return 255-85;
+ case 86: return 255-86;
+ case 87: return 255-87;
+ case 88: return 255-88;
+ case 89: return 255-89;
+ case 90: return 255-90;
+ case 91: return 255-91;
+ case 92: return 255-92;
+ case 93: return 255-93;
+ case 94: return 255-94;
+ case 95: return 255-95;
+ case 96: return 255-96;
+ case 97: return 255-97;
+ case 98: return 255-98;
+ case 99: return 255-99;
+ case 100: return 255-100;
+ case 101: return 255-101;
+ case 102: return 255-102;
+ case 103: return 255-103;
+ case 104: return 255-104;
+ case 105: return 255-105;
+ case 106: return 255-106;
+ case 107: return 255-107;
+ case 108: return 255-108;
+ case 109: return 255-109;
+ case 110: return 255-110;
+ case 111: return 255-111;
+ case 112: return 255-112;
+ case 113: return 255-113;
+ case 114: return 255-114;
+ case 115: return 255-115;
+ case 116: return 255-116;
+ case 117: return 255-117;
+ case 118: return 255-118;
+ case 119: return 255-119;
+ case 120: return 255-120;
+ case 121: return 255-121;
+ case 122: return 255-122;
+ case 123: return 255-123;
+ case 124: return 255-124;
+ case 125: return 255-125;
+ case 126: return 255-126;
+ case 127: return 255-127;
+ case 128: return 255-128;
+ case 129: return 255-129;
+ case 130: return 255-130;
+ case 131: return 255-131;
+ case 132: return 255-132;
+ case 133: return 255-133;
+ case 134: return 255-134;
+ case 135: return 255-135;
+ case 136: return 255-136;
+ case 137: return 255-137;
+ case 138: return 255-138;
+ case 139: return 255-139;
+ case 140: return 255-140;
+ case 141: return 255-141;
+ case 142: return 255-142;
+ case 143: return 255-143;
+ case 144: return 255-144;
+ case 145: return 255-145;
+ case 146: return 255-146;
+ case 147: return 255-147;
+ case 148: return 255-148;
+ case 149: return 255-149;
+ case 150: return 255-150;
+ case 151: return 255-151;
+ case 152: return 255-152;
+ case 153: return 255-153;
+ case 154: return 255-154;
+ case 155: return 255-155;
+ case 156: return 255-156;
+ case 157: return 255-157;
+ case 158: return 255-158;
+ case 159: return 255-159;
+ case 160: return 255-160;
+ case 161: return 255-161;
+ case 162: return 255-162;
+ case 163: return 255-163;
+ case 164: return 255-164;
+ case 165: return 255-165;
+ case 166: return 255-166;
+ case 167: return 255-167;
+ case 168: return 255-168;
+ case 169: return 255-169;
+ case 170: return 255-170;
+ case 171: return 255-171;
+ case 172: return 255-172;
+ case 173: return 255-173;
+ case 174: return 255-174;
+ case 175: return 255-175;
+ case 176: return 255-176;
+ case 177: return 255-177;
+ case 178: return 255-178;
+ case 179: return 255-179;
+ case 180: return 255-180;
+ case 181: return 255-181;
+ case 182: return 255-182;
+ case 183: return 255-183;
+ case 184: return 255-184;
+ case 185: return 255-185;
+ case 186: return 255-186;
+ case 187: return 255-187;
+ case 188: return 255-188;
+ case 189: return 255-189;
+ case 190: return 255-190;
+ case 191: return 255-191;
+ case 192: return 255-192;
+ case 193: return 255-193;
+ case 194: return 255-194;
+ case 195: return 255-195;
+ case 196: return 255-196;
+ case 197: return 255-197;
+ case 198: return 255-198;
+ case 199: return 255-199;
+ case 200: return 255-200;
+ case 201: return 255-201;
+ case 202: return 255-202;
+ case 203: return 255-203;
+ case 204: return 255-204;
+ case 205: return 255-205;
+ case 206: return 255-206;
+ case 207: return 255-207;
+ case 208: return 255-208;
+ case 209: return 255-209;
+ case 210: return 255-210;
+ case 211: return 255-211;
+ case 212: return 255-212;
+ case 213: return 255-213;
+ case 214: return 255-214;
+ case 215: return 255-215;
+ case 216: return 255-216;
+ case 217: return 255-217;
+ case 218: return 255-218;
+ case 219: return 255-219;
+ case 220: return 255-220;
+ case 221: return 255-221;
+ case 222: return 255-222;
+ case 223: return 255-223;
+ case 224: return 255-224;
+ case 225: return 255-225;
+ case 226: return 255-226;
+ case 227: return 255-227;
+ case 228: return 255-228;
+ case 229: return 255-229;
+ case 230: return 255-230;
+ case 231: return 255-231;
+ case 232: return 255-232;
+ case 233: return 255-233;
+ case 234: return 255-234;
+ case 235: return 255-235;
+ case 236: return 255-236;
+ case 237: return 255-237;
+ case 238: return 255-238;
+ case 239: return 255-239;
+ case 240: return 255-240;
+ case 241: return 255-241;
+ case 242: return 255-242;
+ case 243: return 255-243;
+ case 244: return 255-244;
+ case 245: return 255-245;
+ case 246: return 255-246;
+ case 247: return 255-247;
+ case 248: return 255-248;
+ case 249: return 255-249;
+ case 250: return 255-250;
+ case 251: return 255-251;
+ case 252: return 255-252;
+ case 253: return 255-253;
+ case 254: return 255-254;
+ case 255: return 255-255;
+ }
+
+ return -1;
+ }
+
+ static int test (int v)
+ {
+ Console.WriteLine ("value: " + v);
+ switch (v){
+ case 1:
+ case 2:
+ return 1;
+
+ case 3:
+ return 3;
+
+ case 4:
+ return 5;
+
+ default:
+ Console.WriteLine ("default");
+ return 6;
+ }
+
+ return 7;
+ }
+
+ static int tests (string s)
+ {
+ switch (s){
+ case "one":
+ case "two":
+ return 1;
+ case "three":
+ return 3;
+ case "four":
+ return 5;
+ case null:
+ return 9;
+ default:
+ return 6;
+ }
+
+ return 1;
+ }
+
+ static int testn (string s)
+ {
+ switch (s){
+ case "one":
+ return 1;
+
+ default:
+ return 0;
+ }
+ return -1;
+ }
+
+ static int testm (string s)
+ {
+ switch (s){
+ case "one":
+ return 1;
+ }
+ return 100;
+ }
+
+ static int testo (string s)
+ {
+ switch (s){
+ case "one":
+ return 1;
+ case null:
+ return 100;
+ }
+ return 2;
+ }
+
+ static int testp (string s)
+ {
+ switch (s){
+ case "one":
+ case null:
+ case "two":
+ return 1;
+ case "three":
+ return 3;
+ }
+ return 4;
+ }
+
+ static int test_def (string s)
+ {
+ switch (s){
+ case "one":
+ goto default;
+ case "two":
+ return 1;
+ case "three":
+ return 2;
+ default:
+ return 3;
+ }
+ return 4;
+ }
+
+ static int test_coverage (int x)
+ {
+ switch (x){
+ case 0:
+ return 1;
+ default:
+ return 10;
+ }
+ }
+
+ static int Main ()
+ {
+ byte b;
+
+ for (b = 0; b < 255; b++){
+ if (s (b) != 255 - b){
+ Console.WriteLine ("Failed with: " + b + " [" + s (b) + "]");
+ return 1;
+ }
+ }
+
+ Console.WriteLine ("Batch 2");
+ if (test (1) != 1)
+ return 1;
+ if (test (2) != 1)
+ return 2;
+ if (test (3) != 3)
+ return 3;
+ if (test (4) != 5)
+ return 4;
+ if (test (100) != 6)
+ return 5;
+
+ if (tests ("one") != 1)
+ return 6;
+ if (tests ("two") != 1)
+ return 7;
+ if (tests ("three") != 3)
+ return 8;
+ if (tests ("four") != 5)
+ return 9;
+ if (tests (null) != 9)
+ return 10;
+ if (tests ("blah") != 6)
+ return 11;
+
+ if (testn ("one") != 1)
+ return 12;
+ if (testn ("hello") != 0)
+ return 13;
+ if (testn (null) != 0)
+ return 14;
+
+ if (testm ("one") != 1)
+ return 15;
+ if (testm ("two") != 100)
+ return 16;
+ if (testm (null) != 100)
+ return 17;
+
+ if (testo ("one") != 1)
+ return 18;
+ if (testo ("two") != 2)
+ return 19;
+ if (testo (null) != 100)
+ return 20;
+
+ if (testp ("one") != 1)
+ return 21;
+ if (testp (null) != 1)
+ return 22;
+ if (testp ("two") != 1)
+ return 23;
+ if (testp ("three") != 3)
+ return 24;
+ if (testp ("blah") != 4)
+ return 25;
+
+ if (test_def ("one") != 3)
+ return 26;
+ if (test_def ("two") != 1)
+ return 27;
+ if (test_def ("three") != 2)
+ return 28;
+ if (test_def (null) != 3)
+ return 29;
+
+ if (test_coverage (100) != 10)
+ return 30;
+
+ Console.WriteLine ("All tests pass");
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-5.cs b/mcs/tests/test-5.cs
new file mode 100755
index 00000000000..7b3bdbc7924
--- /dev/null
+++ b/mcs/tests/test-5.cs
@@ -0,0 +1,14 @@
+using System;
+
+class X {
+
+ static int Main ()
+ {
+ Console.WriteLine ("From 0 to 9");
+
+ for (int i = 0; i < 10; i++)
+ Console.WriteLine (i);
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-50.cs b/mcs/tests/test-50.cs
new file mode 100644
index 00000000000..84636e887ff
--- /dev/null
+++ b/mcs/tests/test-50.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Runtime.InteropServices;
+
+public class Blah {
+
+ [DllImport ("user32", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)]
+ public static extern int MessageBox (int hWnd, string pText, string pCaption, int uType);
+
+ public static int Main ()
+ {
+ MessageBox (0, "Hello from Mono !", "PInvoke Test", 0);
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-51.cs b/mcs/tests/test-51.cs
new file mode 100755
index 00000000000..3a6257747b6
--- /dev/null
+++ b/mcs/tests/test-51.cs
@@ -0,0 +1,89 @@
+//
+// This test is used to test the `base' implementation
+//
+using System;
+
+class Base {
+ public int b_int_field;
+ public string b_string_field;
+
+ public const int b_const_three = 3;
+
+ public int b_int_property {
+ get {
+ return b_int_field;
+ }
+
+ set {
+ b_int_field = value;
+ }
+ }
+
+ public string b_get_id ()
+ {
+ return "Base";
+ }
+
+ public Base ()
+ {
+ b_int_field = 1;
+ b_string_field = "base";
+ }
+}
+
+class Derived : Base {
+ new int b_int_field;
+ new string b_string_field;
+ new const int b_const_three = 4;
+
+ new int b_int_property {
+ get {
+ return b_int_field;
+ }
+
+
+ set {
+ b_int_field = value;
+ }
+
+ }
+
+ public Derived ()
+ {
+ b_int_field = 10;
+ b_string_field = "derived";
+ }
+
+ public int Test ()
+ {
+ if (b_int_field != 10)
+ return 1;
+ if (base.b_int_field != 1)
+ return 2;
+ if (base.b_string_field != "base")
+ return 3;
+ if (b_string_field != "derived")
+ return 4;
+ base.b_int_property = 4;
+ if (b_int_property != 10)
+ return 5;
+ if (b_int_property != 10)
+ return 6;
+ if (base.b_int_property != 4)
+ return 7;
+ if (b_const_three != 4)
+ return 8;
+ if (Base.b_const_three != 3)
+ return 9;
+ System.Console.WriteLine ("All tests pass");
+ return 0;
+ }
+}
+
+class boot {
+ static int Main ()
+ {
+ Derived d = new Derived ();
+ return d.Test ();
+ }
+}
diff --git a/mcs/tests/test-52.cs b/mcs/tests/test-52.cs
new file mode 100755
index 00000000000..f16e6264696
--- /dev/null
+++ b/mcs/tests/test-52.cs
@@ -0,0 +1,79 @@
+//
+// Tests the foreach on strings, and tests the implicit use of foreach
+// to pull the enumerator from the class and identify the pattern to be called
+//
+using System;
+using System.Collections;
+
+class Y {
+ int count = 0;
+
+ public bool MoveNext ()
+ {
+ count++;
+ return count != 10;
+ }
+
+ public object Current {
+ get {
+ return count;
+ }
+ }
+}
+
+class X {
+
+ static string [] a = {
+ "one", "two", "three"
+ };
+
+ public Y GetEnumerator ()
+ {
+ return new Y ();
+ }
+
+ static int Main ()
+ {
+ //
+ // String test
+ //
+ string total = "";
+
+ foreach (string s in a){
+ total = total + s;
+ }
+ if (total != "onetwothree")
+ return 1;
+
+ //
+ // Pattern test
+ //
+ X x = new X ();
+
+ int t = 0;
+ foreach (object o in x){
+ t += (int) o;
+ }
+ if (t != 45)
+ return 2;
+
+ //
+ // Looking for GetEnumerator on interfaces test
+ //
+ Hashtable xx = new Hashtable ();
+ xx.Add ("A", 10);
+ xx.Add ("B", 20);
+
+ IDictionary vars = xx;
+ string total2 = "";
+ foreach (string name in vars.Keys){
+ total2 = total2 + name;
+ }
+
+ if (total2 != "AB")
+ return 3;
+
+ Console.WriteLine ("test passes");
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-53.cs b/mcs/tests/test-53.cs
new file mode 100755
index 00000000000..34cdd0c2f94
--- /dev/null
+++ b/mcs/tests/test-53.cs
@@ -0,0 +1,119 @@
+//
+// Tests the using statement implementation
+//
+using System;
+using System.IO;
+
+class MyDispose : IDisposable {
+ public bool disposed;
+
+ public void Dispose ()
+ {
+ disposed = true;
+ }
+}
+
+//
+// This class does not implement IDiposable, but has an implicit conversion
+// defined
+//
+class NoIDispose {
+ static public MyDispose x;
+
+ public NoIDispose ()
+ {
+ }
+
+ static NoIDispose ()
+ {
+ x = new MyDispose ();
+ }
+
+ public static implicit operator MyDispose (NoIDispose a)
+ {
+ return x;
+ }
+}
+
+class Y {
+ static void B ()
+ {
+ using (NoIDispose a = new NoIDispose ()){
+ }
+ }
+
+}
+
+class X {
+ static int Main ()
+ {
+ MyDispose copy_a, copy_b, copy_c;
+
+ //
+ // Test whether the two `a' and `b' get disposed
+ //
+ using (MyDispose a = new MyDispose (), b = new MyDispose ()){
+ copy_a = a;
+ copy_b = b;
+ }
+
+ if (!copy_a.disposed)
+ return 1;
+ if (!copy_b.disposed)
+ return 2;
+
+ Console.WriteLine ("Nested using clause disposed");
+
+ //
+ // See if the variable `b' is disposed if there is
+ // an error thrown inside the using block.
+ //
+ copy_c = null;
+ try {
+ using (MyDispose c = new MyDispose ()){
+ copy_c = c;
+ throw new Exception ();
+ }
+ } catch {}
+
+ if (!copy_c.disposed)
+ return 3;
+ else
+ Console.WriteLine ("Disposal on finally block works");
+
+ //
+ // This should test if `a' is non-null before calling dispose
+ // implicitly
+ //
+ using (MyDispose d = null){
+ }
+
+ Console.WriteLine ("Null test passed");
+
+ //
+ // This tests that a variable is permitted here if there is
+ // an implicit conversion to a type that implement IDisposable
+ //
+ using (NoIDispose a = new NoIDispose ()){
+ }
+
+ //
+ // See if we dispose the object that can be implicitly converted
+ // to IDisposable
+ if (NoIDispose.x.disposed != true)
+ return 4;
+ else
+ Console.WriteLine ("Implicit conversion from type to IDisposable pass");
+
+ MyDispose bb = new MyDispose ();
+ using (bb){
+
+ }
+ if (bb.disposed == false)
+ return 6;
+
+ Console.WriteLine ("All tests pass");
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-54.cs b/mcs/tests/test-54.cs
new file mode 100755
index 00000000000..0eb5b692204
--- /dev/null
+++ b/mcs/tests/test-54.cs
@@ -0,0 +1,23 @@
+//
+// This test does not pass peverify because we dont return properly
+// from catch blocks
+//
+using System;
+
+class X {
+
+ bool v ()
+ {
+ try {
+ throw new Exception ();
+ } catch {
+ return false;
+ }
+ return true;
+ }
+
+ static int Main ()
+ {
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-55.cs b/mcs/tests/test-55.cs
new file mode 100755
index 00000000000..6058ee2a1ba
--- /dev/null
+++ b/mcs/tests/test-55.cs
@@ -0,0 +1,33 @@
+using c = System.Console;
+using s = System;
+
+namespace A {
+ namespace B {
+ class C {
+ public static void Hola () {
+ c.WriteLine ("Hola!");
+ }
+ }
+ }
+}
+
+namespace X {
+ namespace Y {
+ namespace Z {
+ class W {
+ public static void Ahoj () {
+ s.Console.WriteLine ("Ahoj!");
+ }
+ }
+ }
+ }
+}
+
+class App {
+ public static int Main () {
+ A.B.C.Hola ();
+ X.Y.Z.W.Ahoj ();
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-56.cs b/mcs/tests/test-56.cs
new file mode 100755
index 00000000000..286cb10dacd
--- /dev/null
+++ b/mcs/tests/test-56.cs
@@ -0,0 +1,96 @@
+//
+// Stress test properties and the various modes of
+// declarations (virtual, overrides, abstract, new)
+//
+using System;
+
+interface I {
+ int P {
+ get; set;
+ }
+}
+
+abstract class A : I {
+ public int p;
+ public int q;
+
+ public int P {
+ get { return p; }
+ set { p = value; }
+ }
+
+ public abstract int Q { get; set; }
+
+ public int r;
+ public virtual int R { get { return r; } set { r = value; } }
+}
+
+class B : A {
+ public int bp;
+
+ public new int P
+ {
+ get { return bp; }
+ set { bp = value; }
+ }
+
+ public override int Q {
+ get { return q; }
+ set { q = value; }
+ }
+}
+
+class C : A {
+ public override int Q {
+ get { return q; }
+ set { q = value; }
+ }
+
+ public int rr;
+ public override int R { get { return rr; } set { rr = value; } }
+}
+
+class M {
+
+ static int Main ()
+ {
+ B b = new B ();
+
+ b.P = 1;
+ b.R = 10;
+ b.Q = 20;
+
+ if (b.P != 1)
+ return 1;
+ if (b.bp != 1)
+ return 2;
+
+ if (b.R != 10)
+ return 3;
+ if (b.r != 10)
+ return 4;
+
+ if (b.Q != 20)
+ return 5;
+ if (b.q != 20)
+ return 6;
+
+ C c = new C ();
+
+ c.R = 10;
+ c.Q = 20;
+ c.P = 30;
+ if (c.R != 10)
+ return 7;
+ if (c.rr != 10)
+ return 8;
+ if (c.P != 30)
+ return 9;
+ if (c.p != 30)
+ return 10;
+
+ Console.WriteLine ("Test passes");
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-57.cs b/mcs/tests/test-57.cs
new file mode 100644
index 00000000000..2d23bdedb13
--- /dev/null
+++ b/mcs/tests/test-57.cs
@@ -0,0 +1,75 @@
+using System;
+
+public delegate void EventHandler (int i, int j);
+
+public class Button {
+
+ private EventHandler click;
+
+ public event EventHandler Click {
+ add { click += value; }
+ remove { click -= value; }
+ }
+
+ public void OnClick (int i, int j)
+ {
+ if (click == null) {
+ Console.WriteLine ("Nothing to click!");
+ return;
+ }
+
+ click (i, j);
+ }
+
+ public void Reset ()
+ {
+ click = null;
+ }
+}
+
+public class Blah {
+
+ Button Button1 = new Button ();
+
+ public void Connect ()
+ {
+ Button1.Click += new EventHandler (Button1_Click);
+ Button1.Click += new EventHandler (Foo_Click);
+ }
+
+ public void Button1_Click (int i, int j)
+ {
+ Console.WriteLine ("Button1 was clicked !");
+ Console.WriteLine ("Answer : " + (i+j));
+ }
+
+ public void Foo_Click (int i, int j)
+ {
+ Console.WriteLine ("Foo was clicked !");
+ Console.WriteLine ("Answer : " + (i+j));
+ }
+
+ public void Disconnect ()
+ {
+ Console.WriteLine ("Disconnecting Button1's handler ...");
+ Button1.Click -= new EventHandler (Button1_Click);
+ }
+
+ public static int Main ()
+ {
+ Blah b = new Blah ();
+
+ b.Connect ();
+
+ b.Button1.OnClick (2, 3);
+
+ b.Disconnect ();
+
+ Console.WriteLine ("Now calling OnClick again");
+ b.Button1.OnClick (3, 7);
+
+ Console.WriteLine ("Events test passes");
+ return 0;
+ }
+
+}
diff --git a/mcs/tests/test-58.cs b/mcs/tests/test-58.cs
new file mode 100755
index 00000000000..d7230ee45df
--- /dev/null
+++ b/mcs/tests/test-58.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Reflection;
+
+public class Blah {
+
+ public static int Main ()
+ {
+ unsafe {
+ int* i;
+ int foo = 10;
+
+ void* bar;
+
+ i = &foo;
+
+ bar = i;
+
+ Console.WriteLine ("Address : {0}", (int) i);
+ }
+
+ return 0;
+ }
+}
+
+
diff --git a/mcs/tests/test-59.cs b/mcs/tests/test-59.cs
new file mode 100755
index 00000000000..f857ed84d12
--- /dev/null
+++ b/mcs/tests/test-59.cs
@@ -0,0 +1,89 @@
+//
+// Tests the varios type conversions.
+//
+using System;
+
+class X {
+
+ static int test_explicit ()
+ {
+ object x_int = 1;
+ object x_uint_1 = 1u;
+ object x_uint_2 = 1U;
+ object x_long_1 = 1l;
+ object x_long_2 = 1L;
+ object x_ulong_1 = 1ul;
+ object x_ulong_2 = 1UL;
+ object x_ulong_3 = 1lu;
+ object x_ulong_4 = 1Lu;
+ object x_ulong_5 = 1LU;
+
+ if (!(x_int is int))
+ return 1;
+
+ if (!(x_uint_1 is uint))
+ return 2;
+
+ if (!(x_uint_2 is uint))
+ return 3;
+
+ if (!(x_long_1 is long))
+ return 5;
+
+ if (!(x_long_2 is long))
+ return 6;
+
+ if (!(x_ulong_1 is ulong))
+ return 7;
+
+ if (!(x_ulong_2 is ulong))
+ return 8;
+
+ if (!(x_ulong_3 is ulong))
+ return 9;
+
+ if (!(x_ulong_4 is ulong))
+ return 10;
+
+ if (!(x_ulong_5 is ulong))
+ return 11;
+
+ return 0;
+
+ }
+
+ static int test_implicit ()
+ {
+ object i_int = 1;
+ object i_uint = 0x80000000;
+ object i_long = 0x100000000;
+ object i_ulong = 0x8000000000000000;
+
+ if (!(i_int is int))
+ return 1;
+ if (!(i_uint is uint))
+ return 2;
+ if (!(i_long is long))
+ return 3;
+ if (!(i_ulong is ulong))
+ return 4;
+
+ return 0;
+ }
+
+ static int Main ()
+ {
+ int v;
+ v = test_explicit ();
+
+ if (v != 0)
+ return v;
+
+ v = test_implicit ();
+ if (v != 0)
+ return 20 + v;
+
+ Console.WriteLine ("Tests pass");
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-6.cs b/mcs/tests/test-6.cs
new file mode 100755
index 00000000000..b95d891b7c4
--- /dev/null
+++ b/mcs/tests/test-6.cs
@@ -0,0 +1,15 @@
+using System;
+
+class X {
+
+ static int Main ()
+ {
+ Console.WriteLine ("From 0 to 9");
+ int i;
+
+ for (i = 0; i < 10; i++)
+ Console.WriteLine (i);
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-60.cs b/mcs/tests/test-60.cs
new file mode 100755
index 00000000000..a900b81b947
--- /dev/null
+++ b/mcs/tests/test-60.cs
@@ -0,0 +1,17 @@
+//
+// Really lame test, but it should be fine for now
+//
+#if YY
+#errro this should not be printed
+#if X
+#elif Y
+#else
+#endif
+#else
+class X {
+ static int Main ()
+ {
+ return 0;
+ }
+}
+#endif
diff --git a/mcs/tests/test-61.cs b/mcs/tests/test-61.cs
new file mode 100755
index 00000000000..9d8c8532b0f
--- /dev/null
+++ b/mcs/tests/test-61.cs
@@ -0,0 +1,39 @@
+//
+// This tests checks that we allow the `get' and `set' keywords inside
+// the get and set blocks. It does the same for Events special remove
+// and add keywords.
+//
+class X {
+ int Property {
+ get {
+ int get;
+ get = 1;
+ return get;
+ }
+ set {
+ int set;
+ set = value;
+ }
+ }
+
+ int P2 {
+ get { return 0; }
+ }
+
+ int P3 {
+ set { }
+ }
+
+ public delegate void MyEvent ();
+
+ public event MyEvent XX {
+ add { int add = 1; }
+ remove { int remove = 1; }
+ }
+
+ static int Main ()
+ {
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-62.cs b/mcs/tests/test-62.cs
new file mode 100755
index 00000000000..550956009e0
--- /dev/null
+++ b/mcs/tests/test-62.cs
@@ -0,0 +1,28 @@
+//
+// This test just makes sure that we can typecast to
+// array types, as this was introduced later into the
+// grammar.
+//
+
+class X {
+
+ X [] GetX ()
+ {
+ return (X []) null;
+ }
+
+ int [] getInt ()
+ {
+ return (int []) null;
+ }
+
+ int [,,] getMoreInt ()
+ {
+ return (int [,,]) null;
+ }
+
+ static int Main ()
+ {
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-63.cs b/mcs/tests/test-63.cs
new file mode 100755
index 00000000000..268c607f783
--- /dev/null
+++ b/mcs/tests/test-63.cs
@@ -0,0 +1,31 @@
+//
+// Tests rethrowing an exception
+//
+using System;
+
+class X {
+ static int Main ()
+ {
+ bool one = false, two = false;
+
+ try {
+ try {
+ throw new Exception ();
+ } catch (Exception e) {
+ one = true;
+ Console.WriteLine ("Caught");
+ throw;
+ }
+ } catch {
+ two = true;
+ Console.WriteLine ("Again");
+ }
+
+ if (one && two){
+ Console.WriteLine ("Ok");
+ return 0;
+ } else
+ Console.WriteLine ("Failed");
+ return 1;
+ }
+}
diff --git a/mcs/tests/test-64.cs b/mcs/tests/test-64.cs
new file mode 100755
index 00000000000..43c31d7559e
--- /dev/null
+++ b/mcs/tests/test-64.cs
@@ -0,0 +1,29 @@
+//
+// This just test that we can compile this code.
+//
+// The challenge here is that LookupType needs to first look
+// in classes defined in its class or parent classes before resorting
+// to lookups in the namespace.
+//
+
+class Operator {
+}
+
+class Blah {
+
+ public enum Operator { A, B };
+
+ public Blah (Operator x)
+ {
+ }
+}
+
+class T {
+ static int Main ()
+ {
+ Blah b = new Blah (Blah.Operator.A);
+
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-65.cs b/mcs/tests/test-65.cs
new file mode 100755
index 00000000000..b117ae309a4
--- /dev/null
+++ b/mcs/tests/test-65.cs
@@ -0,0 +1,51 @@
+//
+// This exercises the various ways in which the new operator works
+// with value types.
+//
+
+using System;
+
+struct S {
+ int v;
+}
+
+class X {
+ static bool receive, create, create_and_box;
+
+ static void receiver (S x)
+ {
+ receive = true;
+ }
+
+ static object BoxS ()
+ {
+ create_and_box = true;
+ return new S ();
+ }
+
+ static S Plain ()
+ {
+ create = true;
+ return new S ();
+ }
+
+ static int Main ()
+ {
+ object a = new S ();
+ receiver (new S ());
+ S s = Plain ();
+ object o = BoxS ();
+
+ if (a == null)
+ return 1;
+ if (receive == false)
+ return 2;
+ if (create == false)
+ return 3;
+ if (create_and_box == false)
+ return 4;
+
+ Console.WriteLine ("Test pass");
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-66.cs b/mcs/tests/test-66.cs
new file mode 100755
index 00000000000..7691f6e7334
--- /dev/null
+++ b/mcs/tests/test-66.cs
@@ -0,0 +1,134 @@
+//
+// This tests checks out field access to arrays
+//
+using System;
+
+struct A {
+ public int a;
+}
+
+class Y {
+ public object a;
+}
+
+class X {
+ static A [] a_single = new A [10];
+ static A [,] a_double = new A [10,10];
+ static Y [] o_single = new Y [10];
+ static Y [,] o_double = new Y [10,10];
+
+ static void FillOne ()
+ {
+ a_single [0].a = 1;
+ }
+
+ static void FillSingle ()
+ {
+ int i;
+
+ for (i = 0; i < 10; i++){
+ a_single [i].a = i + 1;
+ }
+ }
+
+ static void FillDouble ()
+ {
+ int i, j;
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++)
+ a_double [i,j].a = i * j;
+ }
+
+ static void FillObject ()
+ {
+ int i;
+
+ for (i = 0; i < 10; i++){
+ o_single [i] = new Y ();
+ o_single [i].a = (i + 1);
+ }
+ }
+
+ static void FillDoubleObject ()
+ {
+ int i, j;
+
+ for (i = 0; i < 10; i++)
+ for (j = 0; j < 10; j++){
+ o_double [i,j] = new Y ();
+ o_double [i,j].a = i * j;
+ }
+ }
+
+ static int TestSingle ()
+ {
+ int i;
+
+ for (i = 0; i < 10; i++){
+ if (a_single [i].a != i + 1)
+ return 1;
+ }
+ return 0;
+ }
+
+ static int TestDouble ()
+ {
+ int i, j;
+
+ for (i = 0; i < 10; i++){
+ for (j = 0; j < 10; j++)
+ if (a_double [i,j].a != (i *j))
+ return 2;
+ }
+
+ return 0;
+ }
+
+ static int TestObjectSingle ()
+ {
+ int i;
+
+ for (i = 0; i < 10; i++){
+ if ((int)(o_single [i].a) != i + 1)
+ return 1;
+ }
+ return 0;
+ }
+
+ static int TestObjectDouble ()
+ {
+ int i, j;
+
+ for (i = 0; i < 10; i++){
+ for (j = 0; j < 10; j++)
+ if (((int)o_double [i,j].a) != (i *j))
+ return 2;
+ }
+
+ return 0;
+ }
+
+ static int Main ()
+ {
+ FillSingle ();
+ FillDouble ();
+ FillObject ();
+ FillDoubleObject ();
+
+ if (TestSingle () != 0)
+ return 1;
+
+ if (TestDouble () != 0)
+ return 2;
+
+ if (TestObjectSingle () != 0)
+ return 3;
+
+ if (TestObjectDouble () != 0)
+ return 4;
+
+ Console.WriteLine ("test passes");
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-67.cs b/mcs/tests/test-67.cs
new file mode 100644
index 00000000000..7eb792ae690
--- /dev/null
+++ b/mcs/tests/test-67.cs
@@ -0,0 +1,93 @@
+using System;
+using System.Runtime.InteropServices;
+
+[StructLayout (LayoutKind.Sequential)]
+public class MySystemTime {
+ public ushort Year;
+ public ushort Month;
+ public ushort DayOfWeek;
+ public ushort Day;
+ public ushort Hour;
+ public ushort Minute;
+ public ushort Second;
+ public ushort Milliseconds;
+}
+
+[StructLayout (LayoutKind.Sequential)]
+public struct Point {
+ public int x;
+ public int y;
+}
+
+[StructLayout (LayoutKind.Explicit)]
+public struct Rect {
+ [FieldOffset (0)] public int left;
+ [FieldOffset (4)] public int top;
+ [FieldOffset (8)] public int right;
+ [FieldOffset (12)] public int bottom;
+}
+
+[StructLayout (LayoutKind.Explicit)]
+struct A {
+ [FieldOffset (0)]
+ public int a;
+ [FieldOffset (0)]
+ public byte b1;
+ [FieldOffset (1)]
+ public byte b2;
+ [FieldOffset (2)]
+ public byte b3;
+ [FieldOffset (3)]
+ public byte b4;
+}
+
+public class Blah {
+
+ [DllImport ("Kernel32.dll")]
+ public static extern void GetSystemTime (MySystemTime st);
+
+ [DllImport ("User32.dll")]
+ public static extern bool PtInRect (ref Rect r, Point p);
+
+ public static int Main () {
+
+ MySystemTime st = new MySystemTime ();
+
+ GetSystemTime (st);
+
+ Console.WriteLine ("Today's date is : {0:0000}-{1:00}-{2:00}", st.Year, st.Month, st.Day);
+ Console.WriteLine ("The time now is : {0:00}:{1:00}:{2:00}", st.Hour, st.Minute, st.Second);
+
+ Rect r = new Rect ();
+
+ r.left = 10;
+ r.top = 12;
+ r.right = 30;
+ r.bottom = 30;
+
+ Point p = new Point ();
+
+ p.x = 15;
+ p.y = 20;
+
+ if (!PtInRect (ref r, p))
+ return 1;
+
+ A a = new A ();
+
+ a.a = 0x12345678;
+
+ if (a.b1 != 0x78)
+ return 2;
+ if (a.b2 != 0x56)
+ return 3;
+ if (a.b3 != 0x34)
+ return 4;
+ if (a.b4 != 0x12)
+ return 5;
+
+ Console.WriteLine ("Point lies inside rect");
+ Console.WriteLine ("Test passes");
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-68.cs b/mcs/tests/test-68.cs
new file mode 100755
index 00000000000..8dd44f48fb7
--- /dev/null
+++ b/mcs/tests/test-68.cs
@@ -0,0 +1,22 @@
+//
+// Tests invocation of reference type functions with value type arguments
+//
+
+enum A {
+ Hello
+}
+
+class X {
+
+ static int Main ()
+ {
+ if ("Hello" != A.Hello.ToString ())
+ return 1;
+
+ if (5.ToString () != "5")
+ return 2;
+
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-69.cs b/mcs/tests/test-69.cs
new file mode 100644
index 00000000000..be58166c258
--- /dev/null
+++ b/mcs/tests/test-69.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Runtime.CompilerServices;
+
+public class Blah {
+
+ [MethodImpl (MethodImplOptions.InternalCall)]
+ private extern void Start_internal(IntPtr handle);
+
+ public static int Main ()
+ {
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-7.cs b/mcs/tests/test-7.cs
new file mode 100644
index 00000000000..d3a9a9f34b1
--- /dev/null
+++ b/mcs/tests/test-7.cs
@@ -0,0 +1,176 @@
+using System;
+
+namespace Mine {
+
+ public class Blah {
+
+ public int i;
+
+ public static int Main ()
+ {
+ Blah k, l;
+
+ k = new Blah (2) + new Blah (3);
+ if (k.i != 5)
+ return 1;
+
+ k = ~ new Blah (5);
+ if (k.i != -6)
+ return 1;
+
+
+ k = + new Blah (4);
+ if (k.i != 4)
+ return 1;
+
+ k = - new Blah (21);
+ if (k.i != -21)
+ return 1;
+
+ k = new Blah (22) - new Blah (21);
+ if (k.i != 1)
+ return 1;
+
+ if (!k)
+ Console.WriteLine ("! returned true");
+
+ int number = k;
+ if (number != 1)
+ return 1;
+
+ k++;
+ ++k;
+
+ if (k)
+ Console.WriteLine ("k is definitely true");
+
+ k = new Blah (30);
+
+ double f = (double) k;
+
+ if (f != 30.0)
+ return 1;
+
+ int i = new Blah (5) * new Blah (10);
+
+ if (i != 50)
+ return 1;
+
+ k = new Blah (50);
+ l = new Blah (10);
+
+ i = k / l;
+
+ if (i != 5)
+ return 1;
+
+ i = k % l;
+
+ if (i != 0)
+ return 1;
+
+ return 0;
+ }
+
+ public Blah (int v)
+ {
+ i = v;
+ }
+
+ public static Blah operator + (Blah i, Blah j)
+ {
+ Blah b = new Blah (i.i + j.i);
+ Console.WriteLine ("Overload binary + operator");
+ return b;
+ }
+
+ public static Blah operator + (Blah i)
+ {
+ Console.WriteLine ("Overload unary + operator");
+ return new Blah (i.i);
+ }
+
+ public static Blah operator - (Blah i)
+ {
+ Console.WriteLine ("Overloaded unary - operator");
+ return new Blah (- i.i);
+ }
+
+ public static Blah operator - (Blah i, Blah j)
+ {
+ Blah b = new Blah (i.i - j.i);
+ Console.WriteLine ("Overloaded binary - operator");
+ return b;
+ }
+
+ public static int operator * (Blah i, Blah j)
+ {
+ Console.WriteLine ("Overloaded binary * operator");
+ return i.i * j.i;
+ }
+
+ public static int operator / (Blah i, Blah j)
+ {
+ Console.WriteLine ("Overloaded binary / operator");
+ return i.i / j.i;
+ }
+
+ public static int operator % (Blah i, Blah j)
+ {
+ Console.WriteLine ("Overloaded binary % operator");
+ return i.i % j.i;
+ }
+
+ public static Blah operator ~ (Blah i)
+ {
+ Console.WriteLine ("Overloaded ~ operator");
+ return new Blah (~i.i);
+ }
+
+ public static bool operator ! (Blah i)
+ {
+ Console.WriteLine ("Overloaded ! operator");
+ return (i.i == 1);
+ }
+
+ public static Blah operator ++ (Blah i)
+ {
+ Blah b = new Blah (i.i + 1);
+ Console.WriteLine ("Incrementing i");
+ return b;
+ }
+
+ public static Blah operator -- (Blah i)
+ {
+ Blah b = new Blah (i.i - 1);
+ Console.WriteLine ("Decrementing i");
+ return b;
+ }
+
+ public static bool operator true (Blah i)
+ {
+ Console.WriteLine ("Overloaded true operator");
+ return (i.i == 3);
+ }
+
+ public static bool operator false (Blah i)
+ {
+ Console.WriteLine ("Overloaded false operator");
+ return (i.i != 1);
+ }
+
+ public static implicit operator int (Blah i)
+ {
+ Console.WriteLine ("Converting implicitly from Blah->int");
+ return i.i;
+ }
+
+ public static explicit operator double (Blah i)
+ {
+ Console.WriteLine ("Converting explicitly from Blah->double");
+ return (double) i.i;
+ }
+
+ }
+
+}
diff --git a/mcs/tests/test-70.cs b/mcs/tests/test-70.cs
new file mode 100755
index 00000000000..6fe8da995e8
--- /dev/null
+++ b/mcs/tests/test-70.cs
@@ -0,0 +1,48 @@
+//
+// Tests the right settings for overrides
+//
+
+class X {
+
+ public virtual int A {
+ get {
+ return 1;
+ }
+ }
+
+ public virtual int B ()
+ {
+ return 1;
+ }
+}
+
+class Y : X {
+ public override int A {
+ get {
+ return base.A + 2;
+ }
+ }
+
+ public override int B ()
+ {
+ return base.B () + 1;
+ }
+}
+
+class Z {
+ static int Main ()
+ {
+ Y y = new Y ();
+ X x = new X ();
+
+ if (y.B () != 2)
+ return 1;
+ if (y.A != 3)
+ return 2;
+ if (x.A != 1)
+ return 3;
+ if (x.B () != 1)
+ return 4;
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-71.cs b/mcs/tests/test-71.cs
new file mode 100755
index 00000000000..e7bd956c5f6
--- /dev/null
+++ b/mcs/tests/test-71.cs
@@ -0,0 +1,28 @@
+//
+// struct with a constructor
+//
+using System;
+
+class X {
+
+ static void Main ()
+ {
+ MethodSignature ms = new MethodSignature ("hello", null, null);
+
+ Console.WriteLine ("About to look for: " + ms.Name);
+ }
+}
+
+ struct MethodSignature {
+ public string Name;
+ public Type RetType;
+ public Type [] Parameters;
+
+ public MethodSignature (string name, Type ret_type, Type [] parameters)
+ {
+ Name = name;
+ RetType = ret_type;
+ Parameters = parameters;
+ }
+ }
+
diff --git a/mcs/tests/test-72.cs b/mcs/tests/test-72.cs
new file mode 100755
index 00000000000..06d1cee18f9
--- /dev/null
+++ b/mcs/tests/test-72.cs
@@ -0,0 +1,21 @@
+//
+// Compile test for referencing types on nested types
+//
+
+using System;
+
+public class outer {
+ public class inner {
+ public void meth(Object o) {
+ inner inst = (inner)o;
+ }
+ }
+
+ static int Main ()
+ {
+ // We only test that this compiles.
+
+ return 0;
+ }
+ }
+
diff --git a/mcs/tests/test-73.cs b/mcs/tests/test-73.cs
new file mode 100755
index 00000000000..2acf9806895
--- /dev/null
+++ b/mcs/tests/test-73.cs
@@ -0,0 +1,28 @@
+//
+// This test is used to test that we do not use the .override
+// command on abstract method implementations.
+//
+
+public abstract class Abstract {
+ public abstract int A ();
+}
+
+public class Concrete : Abstract {
+ public override int A () {
+ return 1;
+ }
+}
+
+class Test {
+
+ static int Main ()
+ {
+ Concrete c = new Concrete ();
+
+ if (c.A () != 1)
+ return 1;
+
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-74.cs b/mcs/tests/test-74.cs
new file mode 100755
index 00000000000..ede9e38b577
--- /dev/null
+++ b/mcs/tests/test-74.cs
@@ -0,0 +1,22 @@
+//
+// This test excercises #pre-processor directives in non-1 column
+// as well as the literal strings
+//
+class X {
+ #if Blah
+ #else
+ static int Main ()
+ {
+ #endif
+ string s = @"Hola\";
+ string d = "Hola\\";
+ string e = @"Co""a";
+ string f = "Co\"a";
+
+ if (s != d)
+ return 1;
+ if (e != f)
+ return 2;
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-75.cs b/mcs/tests/test-75.cs
new file mode 100755
index 00000000000..a16816cbbf0
--- /dev/null
+++ b/mcs/tests/test-75.cs
@@ -0,0 +1,36 @@
+//
+// This test probes using an operator overloaded in a parents' parent
+//
+
+class X {
+ public static bool called = false;
+
+ static public X operator + (X a, X b)
+ {
+ called = true;
+ return null;
+ }
+}
+
+class Y : X {
+}
+
+class Z : Y {
+}
+
+class driver {
+
+ static int Main ()
+ {
+ Z a = new Z ();
+ Z b = new Z ();
+ X c = a + b;
+
+ if (X.called)
+ return 0;
+
+ return 1;
+ }
+
+}
+
diff --git a/mcs/tests/test-76.cs b/mcs/tests/test-76.cs
new file mode 100755
index 00000000000..91377cee80a
--- /dev/null
+++ b/mcs/tests/test-76.cs
@@ -0,0 +1,35 @@
+//
+// This test is used to verify that we handle functions that have
+// only an array parameter
+//
+
+using System;
+using System.Text;
+
+class foo {
+
+ static string strcat (params string [] values)
+ {
+ StringBuilder s = new StringBuilder ();
+
+ foreach (string val in values) {
+ s.Append (val);
+ }
+
+ return s.ToString ();
+ }
+
+ public static int Main ()
+ {
+ if (strcat ("Hello", "World") != "HelloWorld")
+ return 1;
+
+ if (strcat () != "")
+ return 2;
+
+ if (strcat ("a", "b", "c", "d", "e") != "abcde")
+ return 3;
+
+ return 0;
+ }
+};
diff --git a/mcs/tests/test-77.cs b/mcs/tests/test-77.cs
new file mode 100755
index 00000000000..aca2001a39e
--- /dev/null
+++ b/mcs/tests/test-77.cs
@@ -0,0 +1,38 @@
+//
+// Tests the various string implicit conversions
+//
+
+class XX {
+
+ enum X {
+ A = 1
+ }
+
+ static int Main ()
+ {
+ int one = 1;
+ int two = 2;
+
+ if (("a" + "b") != "ab")
+ return 1;
+
+ if (("one" + one) != "one1")
+ return 2;
+
+ if ((one + "one") != "1one")
+ return 3;
+
+ if ((one + "two" + two) != "1two2")
+ return 4;
+
+ if ((X.A + "a") != "Aa")
+ return 5;
+
+ if (((int)X.A) + "a" != "1a")
+ return 6;
+
+ System.Console.WriteLine ("test ok");
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-78.cs b/mcs/tests/test-78.cs
new file mode 100755
index 00000000000..3787fe6b9e2
--- /dev/null
+++ b/mcs/tests/test-78.cs
@@ -0,0 +1,59 @@
+//
+// This test exhibits an old bug where we did not
+// go into the underlying type for an enumeration, and
+// hence implicit and explicit casts were not working when
+// they were going from a type to an enum
+//
+
+namespace N1
+{
+ public enum A
+ {
+ A_1, A_2, A_3
+ }
+
+ public class B
+ {
+ static bool ShortCasting ()
+ {
+ short i = 0;
+ N1.A a = N1.A.A_1;
+
+ i = (short) a; //<- crash
+ a = (N1.A)i;//<- used to fail, can't convert
+
+ if (a != N1.A.A_1)
+ return false;
+ return true;
+ }
+
+ static bool IntCasting ()
+ {
+ int i = 0;
+ N1.A a = N1.A.A_1;
+
+ i = (int) a;//<- works fine
+ a = (N1.A)i;//<- used to fail, can't convert
+
+ if (a != N1.A.A_1)
+ return false;
+ return true;
+ }
+
+ static int Main ()
+ {
+ if (!IntCasting ())
+ return 1;
+ if (!ShortCasting ())
+ return 2;
+ return 0;
+ }
+
+ }
+}
+
+
+
+
+
+
diff --git a/mcs/tests/test-79.cs b/mcs/tests/test-79.cs
new file mode 100755
index 00000000000..8a4012db8ad
--- /dev/null
+++ b/mcs/tests/test-79.cs
@@ -0,0 +1,17 @@
+//
+// This test excercises the compiler being able to compute
+// correctly the return type in the presence of null (as null
+// will be implicitly convertible to anything
+//
+class X {
+
+ static int Main ()
+ {
+ object o = null;
+
+ string s = o == null ? "string" : null;
+ string d = o == null ? null : "string";
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-8.cs b/mcs/tests/test-8.cs
new file mode 100644
index 00000000000..5de9804f341
--- /dev/null
+++ b/mcs/tests/test-8.cs
@@ -0,0 +1,29 @@
+class X {
+ static public int Main (string [] args)
+ {
+ int a, b, c, d;
+
+ a = b = 10;
+ c = d = 14;
+
+ if ((a + b) != 20)
+ return 1;
+ if ((a + d) != 24)
+ return 2;
+ if ((c + d) != 28)
+ return 3;
+ if ((b + c) != 24)
+ return 4;
+
+ if (a++ != 10)
+ return 5;
+ if (++a != 12)
+ return 6;
+ if (b-- != 10)
+ return 7;
+ if (--b != 8)
+ return 8;
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-80.cs b/mcs/tests/test-80.cs
new file mode 100755
index 00000000000..ec2270b1c40
--- /dev/null
+++ b/mcs/tests/test-80.cs
@@ -0,0 +1,32 @@
+//
+// This test is used to check that we can actually use implementations
+// provided in our parent to interfaces declared afterwards.
+//
+
+using System;
+
+public interface A {
+ int Add (int a, int b);
+}
+
+public class X {
+ public int Add (int a, int b)
+ {
+ return a + b;
+ }
+}
+
+class Y : X, A {
+
+ static int Main ()
+ {
+ Y y = new Y ();
+
+ if (y.Add (1, 1) != 2)
+ return 1;
+
+ Console.WriteLine ("parent interface implementation test passes");
+ return 0;
+ }
+
+}
diff --git a/mcs/tests/test-81.cs b/mcs/tests/test-81.cs
new file mode 100644
index 00000000000..005708bfc86
--- /dev/null
+++ b/mcs/tests/test-81.cs
@@ -0,0 +1,37 @@
+//
+// Tests if we can invoke static members using the short
+// names
+//
+using System;
+
+namespace N1
+{
+ public class A
+ {
+ int x;
+ string s;
+
+ void Bar ()
+ {
+ x = int.Parse ("0");
+ s = string.Format("{0}", x);
+ }
+
+ public static int Main ()
+ {
+ A a = new A ();
+
+ a.Bar ();
+
+ if (a.x != 0)
+ return 1;
+
+ if (a.s != "0")
+ return 1;
+
+ Console.WriteLine ("Bar set s to " + a.s);
+
+ return 0;
+ }
+ }
+}
diff --git a/mcs/tests/test-82.cs b/mcs/tests/test-82.cs
new file mode 100644
index 00000000000..9ff4032897b
--- /dev/null
+++ b/mcs/tests/test-82.cs
@@ -0,0 +1,40 @@
+//
+// Test to ensure that we correctly perform type lookups - thanks to Felix A.I
+//
+namespace N1
+{
+ public enum A
+ {
+ A_1, A_2, A_3
+ }
+
+ namespace N2
+ {
+ public class B
+ {
+ A member;
+
+ void Method (ref A a)
+ {
+ }
+
+ public static int Main ()
+ {
+ return 0;
+ }
+ }
+
+ }
+}
+
+namespace N1.N3
+{
+ public class B
+ {
+ A member;
+
+ void Method (ref A a)
+ {
+ }
+ }
+}
diff --git a/mcs/tests/test-83.cs b/mcs/tests/test-83.cs
new file mode 100755
index 00000000000..cf9629ada38
--- /dev/null
+++ b/mcs/tests/test-83.cs
@@ -0,0 +1,44 @@
+//
+// This test probes that we treat events differently than fields
+// This used to cause a compiler crash.
+//
+using System;
+
+delegate void PersonArrivedHandler (object source, PersonArrivedArgs args);
+
+class PersonArrivedArgs /*: EventArgs*/ {
+ public string name;
+ public PersonArrivedArgs (string name) {
+ this.name = name;
+ }
+}
+
+class Greeter {
+ string greeting;
+
+ public Greeter (string greeting) {
+ this.greeting = greeting;
+ }
+
+ public void HandlePersonArrived (object source, PersonArrivedArgs args) {
+ Console.WriteLine(greeting, args.name);
+ }
+}
+
+class Room {
+ public event PersonArrivedHandler PersonArrived;
+
+ public Room () {}
+
+ public void AddPerson (string name) {
+ PersonArrived(this, null); //(this, PersonArrivedArgs(name));
+ }
+}
+
+class DelegateTest {
+ static int Main () {
+ return 0;
+ }
+}
+
+
diff --git a/mcs/tests/test-84.cs b/mcs/tests/test-84.cs
new file mode 100755
index 00000000000..e6b3d4e3f0d
--- /dev/null
+++ b/mcs/tests/test-84.cs
@@ -0,0 +1,22 @@
+//
+// This test shows how a variable can be created with the
+// same name as the class, and then the class referenced again
+//
+// This was a bug exposed by Digger, as we incorrectly tried to
+// do some work ahead of time during the resolution process
+// (ie, we created LocalVariableReferences for the int variable `Ghost',
+// which stopped `Ghost' from being useful as a type afterwards
+//
+
+class Ghost {
+
+ static int Main ()
+ {
+ int Ghost = 0;
+
+ if (true){
+ Ghost g = null;
+ }
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-85.cs b/mcs/tests/test-85.cs
new file mode 100755
index 00000000000..a50379568f3
--- /dev/null
+++ b/mcs/tests/test-85.cs
@@ -0,0 +1,23 @@
+//
+// This test declares a field variable called `UnmanagedType' of type
+// UnmanagedType.
+//
+// The test is used to test the cast of 0 to UnmanagedType, as before
+// that would have been resolved to a variable instead of a type.
+//
+using System.Runtime.InteropServices;
+
+class X {
+ static UnmanagedType UnmanagedType;
+
+ static int Main ()
+ {
+ UnmanagedType = (UnmanagedType) 0;
+
+ if (UnmanagedType != 0)
+ return 1;
+
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-86.cs b/mcs/tests/test-86.cs
new file mode 100644
index 00000000000..faf1ae20a18
--- /dev/null
+++ b/mcs/tests/test-86.cs
@@ -0,0 +1,45 @@
+using System;
+
+namespace T {
+ public class T {
+
+ static int method1 (Type t, int val)
+ {
+ Console.WriteLine ("You passed in " + val);
+ return 1;
+ }
+
+ static int method1 (Type t, Type[] types)
+ {
+ Console.WriteLine ("Wrong method called !");
+ return 2;
+ }
+
+ static int method2 (Type t, int val)
+ {
+ Console.WriteLine ("MEthod2 : " + val);
+ return 3;
+ }
+
+ static int method2 (Type t, Type [] types)
+ {
+ Console.WriteLine ("Correct one this time!");
+ return 4;
+ }
+
+ public static int Main()
+ {
+ int i = method1 (null, 1);
+
+ if (i != 1)
+ return 1;
+
+ i = method2 (null, null);
+
+ if (i != 4)
+ return 1;
+
+ return 0;
+ }
+ }
+}
diff --git a/mcs/tests/test-87.cs b/mcs/tests/test-87.cs
new file mode 100755
index 00000000000..56c53c9c7ce
--- /dev/null
+++ b/mcs/tests/test-87.cs
@@ -0,0 +1,47 @@
+//
+// Tests the lookup of names on nested classes.
+//
+// Tests nested interfaces
+//
+class Top {
+
+ class X {
+
+ }
+
+ class Y : X {
+ }
+
+ interface A {
+ int get_one ();
+ }
+
+ interface B : A {
+ int get_two ();
+ }
+
+ class XA : A {
+ public int get_one () { return 1; }
+ }
+
+ class XB : B {
+ public int get_one () { return 1; }
+ public int get_two () { return 2; }
+ }
+
+ static int Main ()
+ {
+ XA x = new XA ();
+
+ if (x.get_one () != 1)
+ return 1;
+
+ XB b = new XB ();
+ if (x.get_one () != 1)
+ return 2;
+ if (b.get_two () != 2)
+ return 3;
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-88.cs b/mcs/tests/test-88.cs
new file mode 100755
index 00000000000..a45aafe7e5b
--- /dev/null
+++ b/mcs/tests/test-88.cs
@@ -0,0 +1,18 @@
+class X {
+
+static void f (string s)
+{
+s. Split ('a');
+}
+
+ static int Main ()
+ {
+ string s = "";
+
+ s.Split ('a');
+ s.Split ();
+ s.Split ('a', 'b', 'c');
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-89.cs b/mcs/tests/test-89.cs
new file mode 100755
index 00000000000..3f1b86ed6b2
--- /dev/null
+++ b/mcs/tests/test-89.cs
@@ -0,0 +1,34 @@
+//
+// This test is used to make sure that we correctly create value
+// types in the presence of arrays. Check bug 21801 for a history
+// of the bug
+//
+using System;
+
+struct X {
+ int value;
+
+ X (int a)
+ {
+ value = a;
+ }
+
+ static X F (int a)
+ {
+ return new X (a);
+ }
+
+ static int Main ()
+ {
+ X [] x = { new X (40), F (10) };
+
+ if (x [0].value != 40)
+ return 1;
+
+ if (x [1].value != 10)
+ return 2;
+
+ Console.WriteLine ("test ok");
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-9.cs b/mcs/tests/test-9.cs
new file mode 100755
index 00000000000..4fd35e3714b
--- /dev/null
+++ b/mcs/tests/test-9.cs
@@ -0,0 +1,24 @@
+class X {
+ static public int Main (string [] args)
+ {
+ decimal a, b, c, d;
+
+ a = 0;
+ b = 1;
+ c = d = 3;
+
+ if (b + b + b != c)
+ return 1;
+
+ if (a != (b - 1))
+ return 2;
+
+ if (c != d)
+ return 3;
+
+ if (!(c == d))
+ return 4;
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-90.cs b/mcs/tests/test-90.cs
new file mode 100755
index 00000000000..8d7c147ec3f
--- /dev/null
+++ b/mcs/tests/test-90.cs
@@ -0,0 +1,37 @@
+//
+// This test just makes sure that we can compile C.A, there used to be
+// a bug in the compiler that was doing the lookups in the wrong namespace
+//
+//
+namespace N1
+{
+ public enum A
+ {
+ A_1, A_2, A_3
+ }
+
+ public interface B
+ {
+ N1.A myProp
+ {
+ get;
+ set; // <-- This always worked.
+ }
+ }
+
+ public interface C
+ {
+ A myProp
+ {
+ get;
+ set; // <-- This used to fail.
+ }
+ }
+
+ public class Blah {
+ static int Main ()
+ {
+ return 0;
+ }
+ }
+}
diff --git a/mcs/tests/test-91.cs b/mcs/tests/test-91.cs
new file mode 100755
index 00000000000..11dddc6b45c
--- /dev/null
+++ b/mcs/tests/test-91.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Reflection;
+
+class Test {
+
+ static protected internal void MyProtectedInternal () { }
+ static internal void MyInternal() { }
+ static public void MyPublic () { }
+ static void MyPrivate () {}
+
+ static int Main ()
+ {
+ Type myself = typeof (Test);
+ BindingFlags bf = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public;
+ MethodAttributes mpia;
+ MethodInfo mpi;
+
+ //
+ // protected internal
+ //
+ mpi = myself.GetMethod ("MyProtectedInternal", bf);
+ mpia = mpi.Attributes & MethodAttributes.MemberAccessMask;
+ if (mpia != MethodAttributes.FamORAssem)
+ return 1;
+
+ //
+ // internal
+ //
+ mpi = myself.GetMethod ("MyInternal", bf);
+ mpia = mpi.Attributes & MethodAttributes.MemberAccessMask;
+ if (mpia != MethodAttributes.Assembly)
+ return 2;
+
+ //
+ // public
+ //
+ mpi = myself.GetMethod ("MyPublic", bf);
+ mpia = mpi.Attributes & MethodAttributes.MemberAccessMask;
+ if (mpia != MethodAttributes.Public)
+ return 3;
+
+ //
+ // private
+ //
+ mpi = myself.GetMethod ("MyPrivate", bf);
+ mpia = mpi.Attributes & MethodAttributes.MemberAccessMask;
+ if (mpia != MethodAttributes.Private)
+ return 4;
+
+ Console.WriteLine ("All tests pass");
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-92.cs b/mcs/tests/test-92.cs
new file mode 100755
index 00000000000..1de5aa71a7d
--- /dev/null
+++ b/mcs/tests/test-92.cs
@@ -0,0 +1,20 @@
+//
+// This test exposed a bug that Dan found:
+//
+// The InnerBase used to be the `builder' that was passed to InnerBase,
+// so even if InnerBase was a toplevel, it would be defined in the context
+// of being nested. Buggy.
+//
+class Outer {
+ class Inner : InnerBase {
+ }
+}
+
+abstract class InnerBase {
+}
+
+class MainClass {
+ public static int Main () {
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-93.cs b/mcs/tests/test-93.cs
new file mode 100755
index 00000000000..0ce693979d6
--- /dev/null
+++ b/mcs/tests/test-93.cs
@@ -0,0 +1,47 @@
+//
+// This tests member lookups on inherited interfaces.
+//
+// The bug was exposed because FindMembers in MemberLookup
+// would not return all the members on interfaces, but only
+// the members from the most close type.
+//
+
+using System;
+using System.Collections;
+
+namespace N1
+{
+ interface A
+ {
+ void method1 ();
+ }
+
+ interface B:A
+ {
+ void method2 ();
+ }
+
+ public class C
+ {
+ void method (ref B p)
+ {
+ p.method2();//<- works declared in 'B'
+ p.method1();//<- fails declared in 'A'
+ }
+ }
+}
+
+
+class Test {
+ public static int Main () {
+ IList list = new ArrayList ();
+ int n = list.Count;
+
+ return 0;
+ }
+}
+
+
+
+
+
diff --git a/mcs/tests/test-94.cs b/mcs/tests/test-94.cs
new file mode 100755
index 00000000000..a8c5fea996f
--- /dev/null
+++ b/mcs/tests/test-94.cs
@@ -0,0 +1,59 @@
+using System;
+
+public interface IVehicle {
+ int Start ();
+ int Stop ();
+ int Turn ();
+}
+
+public class Base : IVehicle {
+ int IVehicle.Start () { return 1; }
+ public int Stop () { return 2; }
+ public virtual int Turn () { return 3; }
+}
+
+public class Derived1 : Base {
+ // replaces Base.Turn + IVehice.Turn
+ public override int Turn () { return 4; }
+}
+
+public class Derived2 : Base, IVehicle {
+ // legal - we redeclared IVehicle support
+ public new int Stop () { return 6; }
+ // legal - we redeclared IVehicle support
+ int IVehicle.Start () { return 5; }
+ // replaces IVehicle.Turn
+ int IVehicle.Turn () { return 7; }
+ // replaces Base.Turn
+ public override int Turn () { return 8; }
+}
+
+public class Test {
+
+ static int Main () {
+ Derived1 d1 = new Derived1 ();
+ Derived2 d2 = new Derived2 ();
+ Base b1 = d1;
+ Base b2 = d2;
+
+ if (d1.Turn () != 4)
+ return 1;
+
+ if (((IVehicle)d1).Turn () != 4)
+ return 2;
+
+ if (((IVehicle)d2).Turn () != 7)
+ return 3;
+
+ if (b2.Turn () != 8)
+ return 4;
+
+ if (((IVehicle)b2).Turn () != 7)
+ return 5;
+
+ //Console.WriteLine ("TEST {0}", ((IVehicle)b2).Turn ());
+
+ return 0;
+ }
+}
+
diff --git a/mcs/tests/test-95.cs b/mcs/tests/test-95.cs
new file mode 100755
index 00000000000..69f3684a43b
--- /dev/null
+++ b/mcs/tests/test-95.cs
@@ -0,0 +1,18 @@
+class X {
+
+ double d = 0;
+
+ void X ()
+ {
+ }
+
+ static int Main ()
+ {
+ X x = new X ();
+
+ if (x.d != 0)
+ return 1;
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-96.cs b/mcs/tests/test-96.cs
new file mode 100755
index 00000000000..718a95f1749
--- /dev/null
+++ b/mcs/tests/test-96.cs
@@ -0,0 +1,20 @@
+//
+// Compilation test
+//
+// This used to be a bug in the name lookups in delegate declarations
+//
+namespace N1
+{
+ public class A
+ {
+ static int Main ()
+ {
+ return 0;
+ }
+ }
+
+ //
+ // A used to not be resolved
+ //
+ public delegate void C(object sender, A a);
+}
diff --git a/mcs/tests/test-97.cs b/mcs/tests/test-97.cs
new file mode 100755
index 00000000000..612185cf1aa
--- /dev/null
+++ b/mcs/tests/test-97.cs
@@ -0,0 +1,18 @@
+//
+// This test excercises the simple name lookups on
+// unfinished enumerations.
+//
+
+public enum FL {
+ EMPTY = 0,
+ USHIFT = 11,
+ USER0 = (1<<(USHIFT+0)),
+}
+
+class X {
+
+ static int Main ()
+ {
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-98.cs b/mcs/tests/test-98.cs
new file mode 100755
index 00000000000..17842abe407
--- /dev/null
+++ b/mcs/tests/test-98.cs
@@ -0,0 +1,18 @@
+class X {
+ int a;
+ Y x;
+
+ void b ()
+ {
+ if (x.a == 1)
+ return;
+ }
+}
+
+class Y : X {
+
+ public static int Main ()
+ {
+ return 0;
+ }
+}
diff --git a/mcs/tests/test-99.cs b/mcs/tests/test-99.cs
new file mode 100755
index 00000000000..385330dfa55
--- /dev/null
+++ b/mcs/tests/test-99.cs
@@ -0,0 +1,25 @@
+using System;
+class X {
+ enum A : int {
+ a = 1, b, c
+ }
+
+ static int Main ()
+ {
+ int v = 1;
+ object foo = (v + A.a);
+ object foo2 = (1 + A.a);
+
+ if (foo.GetType ().ToString () != "X+A"){
+ Console.WriteLine ("Expression evaluator bug in E operator + (U x, E y)");
+ return 1;
+ }
+
+ if (foo2.GetType ().ToString () != "X+A"){
+ Console.WriteLine ("Constant folder bug in E operator + (U x, E y)");
+ return 2;
+ }
+
+ return 0;
+ }
+}
diff --git a/mcs/tests/try.cs b/mcs/tests/try.cs
index c1746f92b2d..5bc1d408d0c 100755
--- a/mcs/tests/try.cs
+++ b/mcs/tests/try.cs
@@ -45,7 +45,7 @@ class t {
a = 0x3;
} catch {
a = 0x1;
- } finalize {
+ } finally {
a = 111;
}
}
diff --git a/mcs/tests/unsafe-1.cs b/mcs/tests/unsafe-1.cs
new file mode 100755
index 00000000000..b49bc0fe277
--- /dev/null
+++ b/mcs/tests/unsafe-1.cs
@@ -0,0 +1,163 @@
+//
+// Tests unsafe operators. address-of, dereference, member access
+//
+using System;
+
+unsafe struct Y {
+ public int a;
+ public int s;
+}
+
+unsafe class X {
+ static int TestDereference ()
+ {
+ Y y;
+ Y *z;
+ Y a;
+
+ z = &y;
+ y.a = 1;
+ y.s = 2;
+
+ a.a = z->a;
+ a.s = z->s;
+
+ if (a.a != y.a)
+ return 1;
+ if (a.s != y.s)
+ return 2;
+
+ return 0;
+ }
+
+ static int TestPtrAdd ()
+ {
+ int [] a = new int [10];
+ int i;
+
+ for (i = 0; i < 10; i++)
+ a [i] = i;
+
+ i = 0;
+ fixed (int *b = &a [0]){
+ int *p = b;
+
+ for (i = 0; i < 10; i++){
+ if (*p != a [i])
+ return 10+i;
+ p++;
+ }
+ }
+ return 0;
+ }
+
+ static int i = 1;
+ static char c = 'a';
+ static long l = 123;
+ static double d = 1.2;
+ static float f = 1.3F;
+ static short s = 4;
+
+ static int TestPtrAssign ()
+ {
+
+ fixed (int *ii = &i){
+ *ii = 10;
+ }
+
+ fixed (char *cc = &c){
+ *cc = 'b';
+ }
+
+ fixed (long *ll = &l){
+ *ll = 100;
+ }
+
+ fixed (double *dd = &d){
+ *dd = 3.0;
+ }
+
+ fixed (float *ff = &f){
+ *ff = 1.2F;
+ }
+
+ fixed (short *ss = &s){
+ *ss = 102;
+ }
+
+ if (i != 10)
+ return 100;
+ if (c != 'b')
+ return 101;
+ if (l != 100)
+ return 102;
+ if (d != 3.0)
+ return 103;
+ if (f != 1.2F)
+ return 104;
+ if (s != 102)
+ return 105;
+ return 0;
+ }
+
+ static int TestPtrArithmetic ()
+ {
+ char [] array = new char [10];
+ char *pb;
+
+ array [5] = 'j';
+ fixed (char *pa = array){
+ pb = pa + 1;
+
+
+ //
+ // This one tests pointer element access
+ //
+ if (pa [5] != 'j')
+ return 199;
+
+ Console.WriteLine ("V: " + (pb - pa));
+ if ((pb - pa) != 1)
+ return 200;
+
+ pb++;
+
+ if (pb == pa)
+ return 201;
+ if (pb < pa)
+ return 202;
+ if (pa > pb)
+ return 203;
+ if (pa >= pb)
+ return 204;
+ if (pb <= pa)
+ return 205;
+ pb = pb - 2;
+ if (pb != pa){
+ Console.WriteLine ("VV: " + (pb - pa));
+ return 206;
+ }
+ }
+
+ return 0;
+ }
+
+ static int Main ()
+ {
+ int v;
+
+ if ((v = TestDereference ()) != 0)
+ return v;
+
+ if ((v = TestPtrAdd ()) != 0)
+ return v;
+
+ if ((v = TestPtrAssign ()) != 0)
+ return v;
+
+ if ((v = TestPtrArithmetic ()) != 0)
+ return v;
+ Console.WriteLine ("Ok");
+ return 0;
+ }
+}
diff --git a/mcs/tests/unsafe-2.cs b/mcs/tests/unsafe-2.cs
new file mode 100755
index 00000000000..adedee29633
--- /dev/null
+++ b/mcs/tests/unsafe-2.cs
@@ -0,0 +1,25 @@
+//
+// This test excercises stackalloc, some pointer arithmetic,
+// and dereferences
+//
+using System;
+unsafe class X {
+ static int Main ()
+ {
+ char *ptr = stackalloc char [10];
+ int i;
+
+ for (i = 0; i < 10; i++)
+ ptr [i] = (char) (i + 10);
+
+ for (i = 0; i < 10; i++){
+ if (*ptr != (char) (i + 10))
+ return 200 + i;
+ ptr++;
+ }
+ Console.WriteLine ("Ok");
+ return 0;
+ }
+}
+
+
diff --git a/mcs/tools/.cvsignore b/mcs/tools/.cvsignore
new file mode 100644
index 00000000000..7d47302f00a
--- /dev/null
+++ b/mcs/tools/.cvsignore
@@ -0,0 +1,4 @@
+*.pdb
+*.exe
+*.dll
+cormissing.xml
diff --git a/mcs/tools/ChangeLog b/mcs/tools/ChangeLog
new file mode 100644
index 00000000000..da21df1c32e
--- /dev/null
+++ b/mcs/tools/ChangeLog
@@ -0,0 +1,124 @@
+2002-03-09 Martin Baulig <martin@gnome.org>
+
+ * DumpCultureInfo.cs: New tool to dump culture info. Incomplete,
+ we need to get unicode support working before we can use this.
+
+2002-03-05 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * GenerateDelegate.cs: Generates delegates (EventHandler) as
+ specified. The output is quite simple, a delegate that has
+ the prototype as -->
+ public delegate void <given-name>EventHandler(object sender,
+ <given-name>EventArgs e)
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * scan-tests.pl: Catch exceptions when running the tests so that we
+ always run all the tests in a test suite even if some of them fail.
+
+2002-02-27 Martin Baulig <martin@gnome.org>
+
+ * scan-tests.pl: Moved this script here from ../class/corlib/Test.
+
+2002-02-22 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: move corcompare to it's own directory to hold multiple
+ class files. still makes old corcompare for now. will remove that
+ soon.
+
+2002-02-18 Duncan Mak <duncan@ximian.com>
+
+ * serialize.cs: When appropriate, changed Type.GetType calls to
+ the faster typeof operator.
+
+2002-02-19 Nick Drochak <ndrochak@gol.com>
+
+ * corcompare.cs: Reorganized into collaberating classes to analyze
+ and generate reports. Still needs to find the MonoTODO's, and
+ has a little more prototype code in there, but it's almost done.
+
+ * makefile: output XML file in the tools directory for now.
+
+2002-02-15 Nick Drochak <ndrochak@gol.com>
+
+ * corcompare.cs: Adding stuff to collect all the missing and todo
+ information need to generate nice looking HTML pages. Not quite
+ done and needs some re-org, but Duncan can take a look.
+
+ * sample.xml: an example of how the XML will look that corcompare
+ will generate. Can be used to start working on the XSLT.
+
+2002-02-13 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: 'clean' target now removes file generated by CorCompare
+
+2002-02-03 Duncan Mak <duncan@ximian.com>
+
+ * serialize.cs: Added namespace block.
+
+2002-02-01 Duncan Mak <duncan@ximian.com>
+
+ * serialize.cs: Added a new tool for serializing objects. It
+ can create new types dynamically, but can only handle
+ arguments that are of primitive types.
+
+2002-01-26 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * EnumCheckAssemblyCollection.cs,
+ * assemblies.xml: Files related to EnumCheck checked-in. Now EnumCheck does
+ not have any path hardcoded. It takes the assemblies to
+ search from a xml files, which by default is assemblies.xml
+
+2002-01-25 Nick Drochak <ndrochak@gol.com>
+
+ * .cvsignore: ignore .dll files now since we build NUnitCore.dll ourselves
+
+2002-01-18 Duncan Mak <duncan@ximian.com>
+
+ * EnumCheck.cs: A checkin for Miguel to make EnumCheck not hardcode
+ path to corlib.dll.
+
+2002-01-19 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: corcompare works again now, so make xml of missing types
+ * CorCompare.cs: use exception that .NET v1 throws to get types in mono corlib
+
+2002-01-18 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: remove path to beta2 csc.exe. path to csc.exe must be in PATH instead.
+ don't generate xml from corcompare for now. it throws an error on v1.0 of .NET
+
+2002-01-17 Nick Drochak <ndrochak@gol.com>
+
+ * IFaceDisco.cs, XMLUtil.cs: Added new files for interface discovery tool.
+ * makefile: added target for IFaceDisco.exe and added to clean target for same
+
+2002-01-08 John Barnette <jbarn@httcb.net>
+
+ * Removed todo.cs and related makefile data.
+
+
+
+2002-01-07 John Barnette <jbarn@httcb.net>
+
+
+
+ * makefile: added todo target, fixed EnumCheck target, simplified clean
+
+
+ * todo.cs: new file. generates todo list XML and compares assemblies
+
+
+
+2002-01-07 Gaurav Vaish <gvaish@iitk.ac.in>
+
+ * EnumCheck.cs: Get the numerical values of an enumeration.
+
+2002-01-06 Nick Drochak <ndrochak@gol.com>
+
+ * corcompare.cs: Catch the FileNotFoundException and handle it nicely.
+
+2002-01-05 Nick Drochak <ndrochak@gol.com>
+
+ * makefile: build corcompare
+ * corcompare.cs: add new file. compares an assembly with mscorlib
diff --git a/mcs/tools/DumpCultureInfo.cs b/mcs/tools/DumpCultureInfo.cs
new file mode 100755
index 00000000000..a3c93fafa03
--- /dev/null
+++ b/mcs/tools/DumpCultureInfo.cs
@@ -0,0 +1,176 @@
+using System;
+using System.Threading;
+using System.Globalization;
+
+namespace Mono.Tools {
+
+ public class DumpCultureInfo {
+
+ internal static string ToUnicode (string input)
+ {
+ string output = "";
+ for (int i = 0; i < input.Length; i++) {
+ int chr = input [i];
+ output += "\\x" + chr.ToString ("x4");
+ }
+
+ return output;
+ }
+
+ public static void DumpNumberFormatInfo (CultureInfo culture)
+ {
+ NumberFormatInfo nfi = culture.NumberFormat;
+
+ string currency_group_sizes = "";
+ {
+ int[] group_sizes = nfi.CurrencyGroupSizes;
+
+ currency_group_sizes = "new int[" + group_sizes.Length + "] { ";
+ for (int i = 0; i < group_sizes.Length; i++) {
+ if (i > 0) currency_group_sizes += ", ";
+ currency_group_sizes += group_sizes[i] + " ";
+ }
+ currency_group_sizes += "}";
+ }
+
+ string number_group_sizes = "";
+ {
+ int[] group_sizes = nfi.NumberGroupSizes;
+
+ number_group_sizes = "new int[" + group_sizes.Length + "] { ";
+ for (int i = 0; i < group_sizes.Length; i++) {
+ if (i > 0) number_group_sizes += ", ";
+ number_group_sizes += group_sizes[i] + " ";
+ }
+ number_group_sizes += "}";
+ }
+
+ string percent_group_sizes = "";
+ {
+ int[] group_sizes = nfi.PercentGroupSizes;
+
+ percent_group_sizes = "new int[" + group_sizes.Length + "] { ";
+ for (int i = 0; i < group_sizes.Length; i++) {
+ if (i > 0) percent_group_sizes += ", ";
+ percent_group_sizes += group_sizes[i] + " ";
+ }
+ percent_group_sizes += "}";
+ }
+
+
+ Object[] data = { "\t\t\t\t",
+ nfi.CurrencyDecimalDigits,
+ ToUnicode (nfi.CurrencyDecimalSeparator),
+ ToUnicode (nfi.CurrencyGroupSeparator),
+ currency_group_sizes,
+ nfi.CurrencyNegativePattern,
+ nfi.CurrencyPositivePattern,
+ ToUnicode (nfi.CurrencySymbol),
+ ToUnicode (nfi.NaNSymbol),
+ ToUnicode (nfi.NegativeInfinitySymbol),
+ ToUnicode (nfi.NegativeSign),
+ nfi.NumberDecimalDigits,
+ ToUnicode (nfi.NumberDecimalSeparator),
+ ToUnicode (nfi.NumberGroupSeparator),
+ number_group_sizes,
+ nfi.NumberNegativePattern,
+ nfi.PercentDecimalDigits,
+ ToUnicode (nfi.PercentDecimalSeparator),
+ ToUnicode (nfi.PercentGroupSeparator),
+ percent_group_sizes,
+ nfi.PercentNegativePattern,
+ nfi.PercentPositivePattern,
+ ToUnicode (nfi.PercentSymbol),
+ ToUnicode (nfi.PerMilleSymbol),
+ ToUnicode (nfi.PositiveInfinitySymbol),
+ ToUnicode (nfi.PositiveSign)
+ };
+
+ string format = "{0}currencyDecimalDigits\t\t= {1};\n"
+ + "{0}currencyDecimalSeparator\t= \"{2}\";\n"
+ + "{0}currencyGroupSeparator\t\t= \"{3}\";\n"
+ + "{0}currencyGroupSizes\t\t= {4};\n"
+ + "{0}currencyNegativePattern\t\t= {5};\n"
+ + "{0}currencyPositivePattern\t\t= {6};\n"
+ + "{0}currencySymbol\t\t\t= \"{7}\";\n\n"
+ + "{0}naNSymbol\t\t\t= \"{8}\";\n"
+ + "{0}negativeInfinitySymbol\t\t= \"{9}\";\n"
+ + "{0}negativeSign\t\t\t= \"{10}\";\n\n"
+ + "{0}numberDecimalDigits\t\t= {11};\n"
+ + "{0}numberDecimalSeparator\t\t= \"{12}\";\n"
+ + "{0}numberGroupSeparator\t\t= \"{13}\";\n"
+ + "{0}numberGroupSizes\t\t= {14};\n"
+ + "{0}numberNegativePattern\t\t= {15};\n"
+ + "{0}percentDecimalDigits\t\t= {16};\n"
+ + "{0}percentDecimalSeparator\t\t= \"{17}\";\n"
+ + "{0}percentGroupSeparator\t\t= \"{18}\";\n"
+ + "{0}percentGroupSizes\t\t= {19};\n"
+ + "{0}percentNegativePattern\t\t= {20};\n"
+ + "{0}percentPositivePattern\t\t= {21};\n"
+ + "{0}percentSymbol\t\t\t= \"{22}\";\n\n"
+ + "{0}perMilleSymbol\t\t\t= \"{23}\";\n"
+ + "{0}positiveInfinitySymbol\t\t= \"{24}\";\n"
+ + "{0}positiveSign\t\t\t= \"{25}\";\n";
+
+ string output = String.Format (format, data);
+
+ Object[] data2 = { "\t\t\t\t", "\t\t\t", culture.EnglishName,
+ culture.LCID.ToString ("x4"), output };
+
+ string format2 = "{0}// {2}\n{1}case 0x{3}:\n{0}readOnly = false;\n\n"
+ + "{4}\n{0}break;\n\n";
+
+ Console.WriteLine (String.Format (format2, data2));
+ }
+
+ public static int[] AllCultures = {
+ 0x007F, 0x0001, 0x0401, 0x0801, 0x0C01, 0x1001, 0x1401, 0x1801,
+ 0x1C01, 0x2001, 0x2401, 0x2801, 0x2C01, 0x3001, 0x3401, 0x3801,
+ 0x3C01, 0x4001, 0x0002, 0x0402, 0x0003, 0x0403, 0x0004, 0x0404,
+ 0x0804, 0x0C04, 0x1004, 0x1404, 0x7C04, 0x0005, 0x0405, 0x0006,
+ 0x0406, 0x0007, 0x0407, 0x0807, 0x0C07, 0x1007, 0x1407, 0x0008,
+ 0x0408, 0x0009, 0x0409, 0x0809, 0x0C09, 0x1009, 0x1409, 0x1809,
+ 0x1C09, 0x2009, 0x2409, 0x2809, 0x2C09, 0x3009, 0x3409, 0x000A,
+ 0x080A, 0x0C0A, 0x100A, 0x140A, 0x180A, 0x1C0A, 0x200A, 0x240A,
+ 0x280A, 0x2C0A, 0x300A, 0x340A, 0x380A, 0x3C0A, 0x400A, 0x440A,
+ 0x480A, 0x4C0A, 0x500A, 0x000B, 0x040B, 0x000C, 0x040C, 0x080C,
+ 0x0C0C, 0x100C, 0x140C, 0x180C, 0x000D, 0x040D, 0x000E, 0x040E,
+ 0x000F, 0x040F, 0x0010, 0x0410, 0x0810, 0x0011, 0x0411, 0x0012,
+ 0x0412, 0x0013, 0x0413, 0x0813, 0x0014, 0x0414, 0x0814, 0x0015,
+ 0x0415, 0x0016, 0x0416, 0x0816, 0x0018, 0x0418, 0x0019, 0x0419,
+ 0x001A, 0x041A, 0x081A, 0x0C1A, 0x001B, 0x041B, 0x001C, 0x041C,
+ 0x001D, 0x041D, 0x081D, 0x001E, 0x041E, 0x001F, 0x041F, 0x0020,
+ 0x0420, 0x0021, 0x0421, 0x0022, 0x0422, 0x0023, 0x0423, 0x0024,
+ 0x0424, 0x0025, 0x0425, 0x0026, 0x0426, 0x0027, 0x0427, 0x0029,
+ 0x0429, 0x002A, 0x042A, 0x002B, 0x042B, 0x002C, 0x042C, 0x082C,
+ 0x002D, 0x042D, 0x002F, 0x042F, 0x0036, 0x0436, 0x0037, 0x0437,
+ 0x0038, 0x0438, 0x0039, 0x0439, 0x003E, 0x043E, 0x083E, 0x003F,
+ 0x043F, 0x0040, 0x0440, 0x0041, 0x0441, 0x0043, 0x0443, 0x0843,
+ 0x0044, 0x0444, 0x0046, 0x0446, 0x0047, 0x0447, 0x0049, 0x0449,
+ 0x004A, 0x044A, 0x004B, 0x044B, 0x004E, 0x044E, 0x004F, 0x044F,
+ 0x0050, 0x0450, 0x0056, 0x0456, 0x0057, 0x0457, 0x005A, 0x045A,
+ 0x0065, 0x0465
+ };
+
+ public static int[] Cultures = {
+ // Invariant culture
+ 0x007f,
+ // English
+ 0x0409, 0x0809, 0x0c09, 0x1009,
+ // German
+ 0x0407, 0x0807, 0x0c07, 0x1007, 0x1407
+ };
+
+ public static void Main ()
+ {
+ for (int i = 0; i < AllCultures.Length; i++) {
+ CultureInfo culture = new CultureInfo (AllCultures [i], false);
+
+ if (culture.IsNeutralCulture)
+ continue;
+
+ DumpNumberFormatInfo (culture);
+ }
+ }
+ }
+}
diff --git a/mcs/tools/EnumCheck.cs b/mcs/tools/EnumCheck.cs
new file mode 100644
index 00000000000..8c564cc7956
--- /dev/null
+++ b/mcs/tools/EnumCheck.cs
@@ -0,0 +1,132 @@
+/**
+ * Namespace: System.Web
+ * Class: EnumCheck
+ *
+ * Author: Gaurav Vaish
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.Xml;
+using System.Collections;
+using System.Reflection;
+
+namespace Mono.Enumerations
+{
+ public class EnumCheck
+ {
+ private string className;
+ private Type type;
+ private EnumCheckAssemblyCollection ecac = new EnumCheckAssemblyCollection();
+
+ public static string confFile = "assemblies.xml";
+
+ public EnumCheck(string className)
+ {
+ this.className = className;
+ ecac.Parse();
+ }
+
+ public void Display()
+ {
+ ecac.ConfigFile = confFile;
+ LoadType();
+ if(type == null || !type.IsEnum)
+ {
+ System.Console.Write("-->Failed to load the enumeration: " + className);
+ return;
+ }
+ Array ar = Enum.GetValues(type);
+ System.Console.WriteLine("-->Enumeration: {0}", type.ToString());
+ for(int i=0; i < ar.Length; i++)
+ {
+ Enum b = (Enum)ar.GetValue(i);
+ System.Console.Write(" {0}", Enum.Format(type, b, "G"));
+ System.Console.WriteLine(" ({0}) ", Enum.Format(type, b, "D"));
+ }
+ }
+
+ private void LoadType()
+ {
+ type = null;
+ foreach(string url in ecac)
+ {
+ try
+ {
+ Assembly assembly = Assembly.LoadFrom(url);
+ foreach(Type t in assembly.GetTypes())
+ {
+ if(!t.IsEnum)
+ continue;
+ if(className == t.ToString())
+ {
+ type = t;
+ break;
+ }
+ }
+ } catch(BadImageFormatException)
+ {
+ } catch(ReflectionTypeLoadException)
+ {
+ } catch(ArgumentException)
+ {
+ }
+ if(type != null)
+ return;
+ }
+ }
+
+ public static void PrintUsage()
+ {
+ System.Console.WriteLine("Usage:");
+ System.Console.WriteLine("EnumCheck [<enum> [<enum> [... ] ] ]");
+ System.Console.WriteLine("");
+ System.Console.WriteLine("enum := <namespace>[.<subnamespace>[...]].enum_name");
+ System.Console.WriteLine("");
+ }
+
+ public static void Main(string[] args)
+ {
+ if(args.Length > 0 && (args[0] == "--help" || args[0] == "-h"))
+ {
+ PrintUsage();
+ return;
+ }
+ EnumCheck check = null;
+ string bdir;
+ System.Console.Write("Enter assembly configuration file [{0}]:", confFile);
+ //System.Console.Write("[{0}]: ", confFile);
+ bdir = System.Console.ReadLine();
+ while(bdir.EndsWith("/") || bdir.EndsWith("\\"))
+ {
+ bdir = bdir.Substring(0, bdir.Length - 1);
+ }
+ if(bdir != "")
+ {
+ confFile = bdir;
+ }
+ if(args.Length != 0)
+ {
+ foreach(string clName in args)
+ {
+ check = new EnumCheck(clName);
+ check.Display();
+ System.Console.WriteLine("\n");
+ }
+ }
+ while(true)
+ {
+ System.Console.Write("Enter the name of the Enumeration (end to stop): ");
+ string clName = System.Console.ReadLine();
+ if(clName == "stop" || clName == "end" || clName.Length == 0)
+ break;
+ check = new EnumCheck(clName);
+ check.Display();
+ System.Console.WriteLine("\n");
+ }
+ }
+ }
+}
diff --git a/mcs/tools/EnumCheckAssemblyCollection.cs b/mcs/tools/EnumCheckAssemblyCollection.cs
new file mode 100644
index 00000000000..470492c25b5
--- /dev/null
+++ b/mcs/tools/EnumCheckAssemblyCollection.cs
@@ -0,0 +1,77 @@
+/**
+ * Namespace: System.Web
+ * Class: EnumCheckAssembly
+ *
+ * Author: Gaurav Vaish
+ * Contact: <gvaish@iitk.ac.in>
+ * Status: 100%
+ *
+ * (C) Gaurav Vaish (2002)
+ */
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Collections;
+using System.Reflection;
+
+namespace Mono.Enumerations
+{
+ public class EnumCheckAssemblyCollection: IEnumerable
+ {
+ public string ConfigFile = "assemblies.xml";
+
+ private ArrayList assemblyList = new ArrayList();
+
+ public EnumCheckAssemblyCollection()
+ {
+ }
+
+ public void Parse()
+ {
+ Stream fStream;
+ XmlReader reader;
+ XmlDocument document;
+ string url;
+
+ fStream = new FileStream(ConfigFile, FileMode.Open, FileAccess.Read, FileShare.Read);
+ reader = new XmlTextReader(fStream);
+ document = new XmlDocument();
+ document.Load(reader);
+ if(document.DocumentElement != null)
+ {
+ if(document.DocumentElement.LocalName == "assemblies")
+ {
+ foreach(XmlNode pathNode in document.DocumentElement)
+ {
+ if(pathNode.NodeType == XmlNodeType.Element && pathNode.LocalName=="path")
+ {
+ url = pathNode.Attributes["url"].Value;
+ while(url.EndsWith("\\") || url.EndsWith("/"))
+ {
+ url = url.Substring(0, url.Length - 1);
+ }
+ if(url == null || url.Length == 0)
+ {
+ continue;
+ }
+ foreach(XmlNode assemblyNode in pathNode.ChildNodes)
+ {
+ if(assemblyNode.LocalName == "assembly")
+ {
+ assemblyList.Add(url + "\\" + assemblyNode.Attributes["file"].Value);
+ }
+ }
+ }
+ }
+ }
+ }
+ fStream.Close();
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return assemblyList.GetEnumerator();
+ }
+ }
+}
diff --git a/mcs/tools/GenerateDelegate.cs b/mcs/tools/GenerateDelegate.cs
new file mode 100644
index 00000000000..0ba8e78c0a0
--- /dev/null
+++ b/mcs/tools/GenerateDelegate.cs
@@ -0,0 +1,190 @@
+/**
+ * Namespace: com.mastergaurav.utils
+ * Class: GenerateDelegate
+ *
+ * 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)
+ */
+
+using System;
+using System.IO;
+
+namespace com.mastergaurav.Utils
+{
+ public class GenerateDelegate
+ {
+ public static string TargetDirectory = String.Empty;
+ public static string NamespaceName = String.Empty;
+
+ public static readonly string PROLOGUE = "/**\n * Namespace: ";
+ public static readonly string DETAILS = " *\n * Author: Gaurav Vaish\n" +
+ " * Maintainer: gvaish@iitk.ac.in\n" +
+ " * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>\n" +
+ " * Implementation: yes\n" +
+ " * Status: 100%\n" +
+ " *\n" +
+ " * (C) Gaurav Vaish (2002)\n" +
+ " */\n\n";
+ public static readonly string USING = "using System;\n" +
+ "using System.Web;\n" +
+ "using System.Web.UI;\n\n";
+
+ public static readonly string NAMESPACE = "namespace ";
+
+ public static string AskForNamespace()
+ {
+ string nm = String.Empty;
+ System.Console.Write("Enter the name of the namespace: ");
+ nm = System.Console.ReadLine();
+ return nm;
+ }
+
+ public static string AskForMore()
+ {
+ string del = String.Empty;
+ System.Console.Write("Enter the name of the delegate (end to stop): ");
+ del = System.Console.ReadLine();
+ if(del == String.Empty || del == "end")
+ return String.Empty;
+ return del;
+ }
+
+ public static void Generate(string delName)
+ {
+ string fileName = TargetDirectory + "\\" + delName + "EventHandler.cs";
+ System.Console.Write("File: ");//, fileName);
+ System.Console.Write(fileName);
+ System.Console.Write("\tGenerating");
+
+ StreamWriter writer;
+ try
+ {
+ Stream stream = new FileStream(fileName, FileMode.Truncate, FileAccess.Write);
+ writer = new StreamWriter(stream);
+ } catch(FileNotFoundException)
+ {
+ writer = File.CreateText(fileName);
+ }
+ if(writer == null)
+ {
+ System.Console.WriteLine("Null writer...\n");
+ return;
+ }
+ writer.Write(PROLOGUE);
+ writer.Write(NamespaceName + "\n");
+ writer.Write(DETAILS);
+ writer.Write(NAMESPACE);
+ writer.Write(NamespaceName + "\n");
+ writer.Write("{\n");
+ writer.Write("\tpublic delegate void ");
+ writer.Write(delName);
+ writer.Write("EventHandler(object sender, ");
+ writer.Write(delName);
+ writer.Write("EventArgs e);\n");
+ writer.Write("}");
+
+ writer.Flush();
+ writer.Close();
+
+ System.Console.WriteLine("\tGenerated\n");
+ }
+
+ public static string GetTargetDir()
+ {
+ System.Console.Write("Enter target directory: ");
+ return System.Console.ReadLine();
+ }
+
+ public static void Usage(bool wrong)
+ {
+ if(wrong)
+ {
+ System.Console.WriteLine("Wrong # arguments.");
+ }
+ System.Console.WriteLine("Usage: GenerateDelegate [target-dir] [namespace] [delegate1 [delegate2 [...]]]");
+ }
+
+ public static bool IsHelp(string arg)
+ {
+ return (arg == "-h" || arg == "--help");
+ }
+
+ public static bool IsDirectory(string dirName)
+ {
+ FileAttributes attrs;
+ try
+ {
+ attrs = File.GetAttributes(dirName);
+ if( (attrs & FileAttributes.Directory) != FileAttributes.Directory)
+ {
+ Usage(true);
+ return false;
+ }
+ }catch(Exception e)
+ {
+ System.Console.WriteLine("Exception: {0}", e.ToString());
+ return false;
+ }
+ return true;
+ }
+
+ public static void Main(string[] args)
+ {
+ if(args.Length == 1 && IsHelp(args[0]))
+ {
+ Usage(false);
+ return;
+ }
+
+ if(args.Length == 0)
+ {
+ TargetDirectory = GetTargetDir();
+ while(TargetDirectory.EndsWith("\\"))
+ {
+ TargetDirectory = TargetDirectory.Substring(0, TargetDirectory.Length - 1);
+ }
+ } else
+ {
+ while(args[0].EndsWith("\\"))
+ {
+ args[0] = args[0].Substring(0, args[0].Length - 1);
+ }
+ TargetDirectory = args[0];
+ }
+
+ if(!IsDirectory(TargetDirectory))
+ return;
+
+ if(args.Length > 1)
+ {
+ NamespaceName = args[1];
+ } else
+ {
+ NamespaceName = AskForNamespace();
+ }
+
+ if(args.Length > 2)
+ {
+ int i=0;
+ foreach(string currArg in args)
+ {
+ if(i != 0)
+ {
+ Generate(currArg);
+ }
+ i++;
+ }
+ }
+ string delegateName = String.Empty;
+ while((delegateName = AskForMore()) != String.Empty)
+ {
+ Generate(delegateName);
+ }
+ }
+ }
+}
diff --git a/mcs/tools/IFaceDisco.cs b/mcs/tools/IFaceDisco.cs
new file mode 100644
index 00000000000..0f8a06225e9
--- /dev/null
+++ b/mcs/tools/IFaceDisco.cs
@@ -0,0 +1,105 @@
+// IFaceDisco.cs
+//
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak
+
+using System;
+using System.Reflection;
+using System.Collections;
+using System.IO;
+
+namespace Mono.Util
+{
+ class IFaceDisco {
+ public static void Main(string[] args) {
+ Assembly asm;
+ Type[] asmTypes;
+ InterfaceMapping map;
+ Type[] interfaces;
+ ArrayList TypesList = new ArrayList();
+ ArrayList implementingTypes = new ArrayList();
+ string asmFullPath = null;
+ string ifaceToDiscover = null;
+
+ if (args.Length < 1 || args.Length > 3) {
+ Usage();
+ return;
+ }
+
+ for (int i = 0; i < args.Length; i++) {
+ string arg = args[i];
+
+ if (arg.StartsWith("-") && ((i + 1) < args.Length)) {
+ if (arg == "--asm") {
+ asmFullPath = args[++i];
+ } else {
+ Usage();
+ return;
+ }
+ } else {
+ // allow only one interface to discover
+ if (ifaceToDiscover != null){
+ Usage();
+ return;
+ }
+ ifaceToDiscover = arg;
+ }
+ }
+
+ // find the assembly
+ if (null == asmFullPath){
+ asm = Assembly.GetAssembly(typeof (System.Object));
+ }
+ else {
+ try{
+ asm = Assembly.LoadFrom(asmFullPath);
+ }
+ catch(Exception e){
+ Console.WriteLine("Could not open assembly '{0}' for discovery. Error is: "+e.Message, asmFullPath);
+ return;
+ }
+ }
+ asmTypes = asm.GetTypes();
+
+ // examine all the public types
+ foreach(Type t in asmTypes) {
+ if (t.IsPublic) {
+ // find out which, if any, interfaces are "in" the type
+ interfaces= t.GetInterfaces();
+ if (null != interfaces){
+ // look for the interface we want to discover
+ foreach (Type iface in interfaces) {
+ // this area seems to throw an exception sometimes, just ignore it
+ try{
+ if (iface.FullName.ToLower() == args[0].ToLower()) {
+ // find out if this type is the one which "declares" the interface
+ map = t.GetInterfaceMap(iface);
+ if (map.TargetMethods[0].DeclaringType.FullName == t.FullName){
+ // if so, then we found a class to report
+ implementingTypes.Add(t.FullName);
+ } // if
+ } // if
+ }catch{}
+ } // foreach
+ } // if
+ } // if
+ } // foreach
+
+ // sort the list to make it easier to find what you are looking for
+ implementingTypes.Sort();
+ Console.WriteLine(XMLUtil.ToXML(implementingTypes, "Type", "ImplementingTypes"));
+ } // Main()
+
+ private static void Usage() {
+ Console.WriteLine (
+ "Mono Interface Discovery Tool\n" +
+ "usage: ifacedisco [--asm assembly] interface\n\n" +
+ " The full path to 'assembly' should be specified when using --asm.\n" +
+ " If 'assembly' is not specified, the assembly that contains System.Object will be used.\n" +
+ " Use the fully qualified form for 'interface', e.g. System.Runtime.Serialization.ISerializable\n"
+ );
+ } // Usage()
+
+ } // class IFaceDisco
+} // namespace Mono.Util
diff --git a/mcs/tools/XMLUtil.cs b/mcs/tools/XMLUtil.cs
new file mode 100644
index 00000000000..0643472ad28
--- /dev/null
+++ b/mcs/tools/XMLUtil.cs
@@ -0,0 +1,36 @@
+// IFaceDisco.cs
+//
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001 Nick Drochak
+
+using System;
+using System.Text;
+using System.Collections;
+
+namespace Mono.Util
+{
+ class XMLUtil{
+ public static string ToXML(
+ ArrayList list,
+ string itemWrap,
+ string listWrap)
+ {
+ if (null == itemWrap){
+ throw new ArgumentNullException("itemWrap");
+ }
+ if (null == listWrap){
+ throw new ArgumentNullException("listWrap");
+ }
+ StringBuilder output = new StringBuilder();
+ output.Append("<"+listWrap+">");
+ foreach(object o in list){
+ output.Append("\n<"+itemWrap+">");
+ output.Append(o.ToString());
+ output.Append("</"+itemWrap+">");
+ }
+ output.Append("\n</"+listWrap+">");
+ return output.ToString();
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/tools/assemblies.xml b/mcs/tools/assemblies.xml
new file mode 100644
index 00000000000..1bf42d8c266
--- /dev/null
+++ b/mcs/tools/assemblies.xml
@@ -0,0 +1,20 @@
+<assemblies>
+ <path url="C:\WINNT\Microsoft.NET\Framework\v1.0.3705">
+ <assembly file="mscorlib.dll"/>
+ <assembly file="System.Web.dll"/>
+ <assembly file="System.dll"/>
+ <assembly file="System.Drawing.dll"/>
+ <assembly file="System.Security.dll"/>
+ <assembly file="System.Windows.Forms.dll"/>
+ <assembly file="System.Xml.dll"/>
+ <assembly file="System.Data.dll"/>
+ <assembly file="System.Design.dll"/>
+ <assembly file="System.EnterpriseServices.dll"/>
+ <assembly file="System.Management.dll"/>
+ <assembly file="System.Messaging.dll"/>
+ <assembly file="System.Runtime.Remoting.dll"/>
+ <assembly file="System.ServiceProcess.dll"/>
+ <assembly file="System.Web.RegularExpressions.dll"/>
+ <assembly file="System.Web.Services.dll"/>
+ </path>
+</assemblies>
diff --git a/mcs/tools/corcompare/.cvsignore b/mcs/tools/corcompare/.cvsignore
new file mode 100644
index 00000000000..ee381230de1
--- /dev/null
+++ b/mcs/tools/corcompare/.cvsignore
@@ -0,0 +1,2 @@
+*.pdb
+*.exe
diff --git a/mcs/tools/corcompare/ChangeLog b/mcs/tools/corcompare/ChangeLog
new file mode 100644
index 00000000000..4e100611a23
--- /dev/null
+++ b/mcs/tools/corcompare/ChangeLog
@@ -0,0 +1,6 @@
+2002-02-25 Nick Drochak <ndrochak@gol.com>
+
+ * ToDoAssembly.cs: remove unused code
+ * ToDoNamespace.cs: using BindingFlags for GetMembers
+ * ToDoType.cs: throw exception if we encounter a member type
+ that we didn't expect. Also remove unused property. \ No newline at end of file
diff --git a/mcs/tools/corcompare/CompletionInfo.cs b/mcs/tools/corcompare/CompletionInfo.cs
new file mode 100644
index 00000000000..ab497f31eb4
--- /dev/null
+++ b/mcs/tools/corcompare/CompletionInfo.cs
@@ -0,0 +1,573 @@
+// Mono.Util.CorCompare.CompletionInfo
+//
+// Author(s):
+// Piers Haken (piersh@friskit.com)
+//
+// (C) 2001-2002 Piers Haken
+
+using System;
+using System.Reflection;
+using System.Xml;
+using System.Collections;
+
+namespace Mono.Util.CorCompare
+{
+ #region
+ public struct CompletionType
+ {
+ private enum CompletionTypes
+ {
+ Present,
+ Missing,
+ Extra
+ }
+ private const int MASK_TYPE = 0x0f;
+ private const int MASK_TODO = 0x10;
+ //private const int MASK_ERROR = 0x20;
+ private int m_type;
+
+ private CompletionType (CompletionTypes type, bool fTodo)
+ {
+ m_type = (int) type;
+
+ if (fTodo)
+ m_type |= MASK_TODO;
+ }
+
+ public bool IsPresent
+ {
+ get { return Type == CompletionTypes.Present; }
+ }
+ public bool IsMissing
+ {
+ get { return Type == CompletionTypes.Missing; }
+ }
+ public bool IsExtra
+ {
+ get { return Type == CompletionTypes.Extra; }
+ }
+ public bool IsTodo
+ {
+ get { return (m_type & MASK_TODO) != 0; }
+ }
+ private CompletionTypes Type
+ {
+ get { return (CompletionTypes) (m_type & MASK_TYPE); }
+ }
+
+ public override string ToString ()
+ {
+ switch (Type)
+ {
+ case CompletionTypes.Missing:
+ return "missing";
+ case CompletionTypes.Extra:
+ return "extra";
+ case CompletionTypes.Present:
+ return "present";
+ default:
+ throw new Exception ("Invalid CompletionType: "+Type);
+ }
+ }
+
+ public static CompletionType Present
+ {
+ get { return new CompletionType (CompletionTypes.Present, false); }
+ }
+ public static CompletionType Missing
+ {
+ get { return new CompletionType (CompletionTypes.Missing, false); }
+ }
+ public static CompletionType Extra
+ {
+ get { return new CompletionType (CompletionTypes.Extra, false); }
+ }
+ public static CompletionType Compare (Object oMono, Object oMS)
+ {
+ if (oMono == null)
+ return Missing;
+ else if (oMS == null)
+ return Extra;
+ else
+ return Present;
+ }
+ }
+
+ /// <summary>
+ /// Represents the amount of work done on a node
+ /// </summary>
+ /// <remarks>
+ /// created by - Piersh
+ /// created on - 3/2/2002 1:12:00 AM
+ /// </remarks>
+
+ public struct CompletionInfo
+ {
+ public int cPresent;
+ public int cExtra;
+ public int cMissing;
+ public int cTodo;
+
+ /// <summary>
+ /// converts a CompletionTypes into a CompletionInfo
+ /// sets the corresponding field to '1'
+ /// </summary>
+ /// <param name="ct">the CompletionTypes to convert</param>
+ public CompletionInfo (CompletionType ct)
+ {
+ cPresent = cTodo = cMissing = cExtra = 0;
+ if (ct.IsPresent)
+ cPresent = 1;
+ else if (ct.IsMissing)
+ cMissing = 1;
+ else if (ct.IsExtra)
+ cExtra = 1;
+
+ if (ct.IsTodo)
+ cTodo = 1;
+ }
+
+ /// <summary>
+ /// counts the total number of elements represented by this info
+ /// </summary>
+ public int cTotal
+ {
+ get
+ {
+ return cPresent + cTodo + cMissing;
+ }
+ }
+
+ /// <summary>
+ /// adds two CompletionInfos together
+ /// </summary>
+ /// <param name="m_nodeStatus"></param>
+ public void Add (CompletionInfo m_nodeStatus)
+ {
+ cPresent += m_nodeStatus.cPresent;
+ cTodo += m_nodeStatus.cTodo;
+ cMissing += m_nodeStatus.cMissing;
+ cExtra += m_nodeStatus.cExtra;
+ }
+
+ /// <summary>
+ /// subtracts two CompletionInfos
+ /// </summary>
+ /// <param name="m_nodeStatus"></param>
+ public void Sub (CompletionInfo m_nodeStatus)
+ {
+ cPresent -= m_nodeStatus.cPresent;
+ cTodo -= m_nodeStatus.cTodo;
+ cMissing -= m_nodeStatus.cMissing;
+ cExtra -= m_nodeStatus.cExtra;
+ if (cPresent < 0 || cTodo < 0 || cMissing < 0 || cExtra < 0)
+ throw new Exception ("Completion underflow on subtract");
+ }
+
+ /// <summary>
+ /// increments the corresponding field
+ /// </summary>
+ /// <param name="ct"></param>
+ public void Add (CompletionType ct)
+ {
+ Add (new CompletionInfo (ct));
+ }
+ /// <summary>
+ /// decrements the corresponding field
+ /// </summary>
+ /// <param name="ct"></param>
+ public void Sub (CompletionType ct)
+ {
+ Sub (new CompletionInfo (ct));
+ }
+
+ /// <summary>
+ /// adds appropriate 'missing', 'todo' & 'complete' attributes to an XmlElement
+ /// </summary>
+ /// <param name="elt"></param>
+ public void SetAttributes (XmlElement elt)
+ {
+ elt.SetAttribute ("present", cPresent.ToString ());
+ elt.SetAttribute ("missing", cMissing.ToString ());
+ elt.SetAttribute ("extra", cExtra.ToString ());
+ elt.SetAttribute ("todo", cTodo.ToString ());
+
+ //int percentComplete = (cTotal == 0) ? 100 : (100 - 100 * (cMissing + cExtra) / cTotal);
+ //elt.SetAttribute ("complete", percentComplete.ToString ());
+ }
+ }
+
+ #endregion
+
+ public enum PresenceTypes
+ {
+// UNINITIALIZED = 0,
+ Missing = 0,
+ Present,
+ Extra
+ }
+
+ public enum ErrorTypes
+ {
+ // TODO: order is important here... (see Status.SetError ())
+// UNINITIALIZED = 0,
+ OK = 0,
+ Todo,
+ Warning,
+ Error
+ }
+
+ public struct PresenceCounts
+ {
+ public int cMissing;
+ public int cPresent;
+ public int cExtra;
+
+ public PresenceCounts (PresenceTypes type)
+ {
+ cMissing = cPresent = cExtra = 0;
+ if (type == PresenceTypes.Missing)
+ cMissing = 1;
+ else if (type == PresenceTypes.Present)
+ cPresent = 1;
+ else if (type == PresenceTypes.Extra)
+ cExtra = 1;
+ else throw new Exception ("Invalid PresenceType");
+ }
+ public int Total
+ {
+ get { return cMissing + cPresent + cExtra; }
+ }
+ public void Add (PresenceCounts counts)
+ {
+ cMissing += counts.cMissing;
+ cPresent += counts.cPresent;
+ cExtra += counts.cExtra;
+ }
+ public void Sub (PresenceCounts counts)
+ {
+ cMissing -= counts.cMissing;
+ cPresent -= counts.cPresent;
+ cExtra -= counts.cExtra;
+
+ if (cMissing < 0 || cPresent < 0 || cExtra < 0)
+ throw new Exception ("Underflow");
+ }
+ public void Add (PresenceTypes type)
+ {
+ Add (new PresenceCounts (type));
+ }
+ public void Sub (PresenceTypes type)
+ {
+ Sub (new PresenceCounts (type));
+ }
+ public void SetAttributes (XmlElement elt, string strSuffix)
+ {
+ if (cMissing != 0)
+ elt.SetAttribute ("missing"+strSuffix, cMissing.ToString ());
+ if (cPresent != 0)
+ elt.SetAttribute ("present"+strSuffix, cPresent.ToString ());
+ if (cExtra != 0)
+ elt.SetAttribute ("extra"+strSuffix, cExtra.ToString ());
+ }
+ }
+
+ public struct ErrorCounts
+ {
+ public int cOK;
+ public int cTodo;
+ public int cWarning;
+ public int cError;
+
+ public ErrorCounts (ErrorTypes type)
+ {
+ cOK = cTodo = cWarning = cError = 0;
+ if (type == ErrorTypes.OK)
+ cOK = 1;
+ else if (type == ErrorTypes.Todo)
+ cTodo = 1;
+ else if (type == ErrorTypes.Warning)
+ cWarning = 1;
+ else if (type == ErrorTypes.Error)
+ cError = 1;
+ else throw new Exception ("Invalid ErrorType");
+ }
+ public int Total
+ {
+ get { return cOK + cTodo + cWarning + cError; }
+ }
+ public void Add (ErrorCounts counts)
+ {
+ cOK += counts.cOK;
+ cTodo += counts.cTodo;
+ cWarning += counts.cWarning;
+ cError += counts.cError;
+ }
+ public void Sub (ErrorCounts counts)
+ {
+ cOK -= counts.cOK;
+ cTodo -= counts.cTodo;
+ cWarning -= counts.cWarning;
+ cError -= counts.cError;
+ if (cOK < 0 || cTodo < 0 || cWarning < 0 || cError < 0)
+ throw new Exception ("Underflow");
+ }
+ public void Add (ErrorTypes type)
+ {
+ Add (new ErrorCounts (type));
+ }
+ public void Sub (ErrorTypes type)
+ {
+ Sub (new ErrorCounts (type));
+ }
+ public void SetAttributes (XmlElement elt, string strSuffix)
+ {
+ if (cOK != 0)
+ elt.SetAttribute ("ok"+strSuffix, cOK.ToString ());
+ if (cTodo != 0)
+ elt.SetAttribute ("todo"+strSuffix, cTodo.ToString ());
+ if (cWarning != 0)
+ elt.SetAttribute ("warning"+strSuffix, cWarning.ToString ());
+ if (cError != 0)
+ elt.SetAttribute ("error"+strSuffix, cError.ToString ());
+ }
+ }
+
+ public struct Status
+ {
+ public PresenceTypes presence;
+ public ErrorTypes error;
+
+ public string PresenceName
+ {
+ get
+ {
+ if (presence == PresenceTypes.Missing)
+ return "missing";
+ else if (presence == PresenceTypes.Present)
+ return "present";
+ else if (presence == PresenceTypes.Extra)
+ return "extra";
+ else throw new Exception ("Invalid PresenceType");
+ }
+ }
+ public string ErrorName
+ {
+ get
+ {
+ if (error == ErrorTypes.OK)
+ return "OK";
+ else if (error == ErrorTypes.Todo)
+ return "todo";
+ else if (error == ErrorTypes.Warning)
+ return "warning";
+ else if (error == ErrorTypes.Error)
+ return "error";
+ else throw new Exception ("Invalid ErrorType");
+ }
+ }
+ public void SetAttributes (XmlElement elt)
+ {
+ if (presence != PresenceTypes.Present)
+ elt.SetAttribute ("presence", PresenceName);
+ if (error != ErrorTypes.OK)
+ elt.SetAttribute ("error", ErrorName);
+ }
+ }
+
+ public struct StatusCounts
+ {
+ public PresenceCounts presenceCounts;
+ public ErrorCounts errorCounts;
+
+ public void Add (StatusCounts statusCounts)
+ {
+ presenceCounts.Add (statusCounts.presenceCounts);
+ errorCounts.Add (statusCounts.errorCounts);
+ if (presenceCounts.Total != errorCounts.Total)
+ throw new Exception ("invalid status counts");
+ }
+ public void Sub (StatusCounts statusCounts)
+ {
+ presenceCounts.Sub (statusCounts.presenceCounts);
+ errorCounts.Sub (statusCounts.errorCounts);
+ if (presenceCounts.Total != errorCounts.Total)
+ throw new Exception ("invalid status counts");
+ }
+ public void Add (Status status)
+ {
+ presenceCounts.Add (status.presence);
+ errorCounts.Add (status.error);
+ if (presenceCounts.Total != errorCounts.Total)
+ throw new Exception ("invalid status counts");
+ }
+ public void Sub (Status status)
+ {
+ presenceCounts.Sub (status.presence);
+ errorCounts.Sub (status.error);
+ if (presenceCounts.Total != errorCounts.Total)
+ throw new Exception ("invalid status counts");
+ }
+ public void SetAttributes (XmlElement elt, string strSuffix)
+ {
+ presenceCounts.SetAttributes (elt, strSuffix);
+ errorCounts.SetAttributes (elt, strSuffix);
+
+ int cTotal = presenceCounts.cMissing + presenceCounts.cPresent;
+ int cIncomplete =
+ presenceCounts.cMissing +
+ errorCounts.cTodo +
+ errorCounts.cWarning +
+ errorCounts.cError;
+
+ if (presenceCounts.Total != errorCounts.Total)
+ throw new Exception ("invalid status counts");
+
+ if (cTotal != 0)
+ {
+ int percentComplete = 100 * (cTotal - cIncomplete) / cTotal;
+ elt.SetAttribute ("complete" + strSuffix, percentComplete.ToString ());
+ }
+ }
+ }
+
+ public class NodeMessage
+ {
+ protected string msg;
+
+ public NodeMessage (string _msg)
+ {
+ msg = _msg;
+ }
+
+ public string Message
+ {
+ get { return msg; }
+ }
+ }
+
+ public class NodeStatus
+ {
+ public Status status;
+ protected StatusCounts statusCountsChildren;
+ protected StatusCounts statusCountsTotal;
+ protected IList lstWarnings;
+
+ public NodeStatus ()
+ {
+ status.error = ErrorTypes.OK;
+ }
+
+ /// <summary>
+ /// Constructs a NodeStatus by comparing the presence of two objects
+ /// it only sets the status.presence field
+ /// </summary>
+ /// <param name="objMono"></param>
+ /// <param name="objMS"></param>
+ public NodeStatus (Object objMono, Object objMS)
+ {
+ status.error = ErrorTypes.OK;
+ statusCountsChildren = statusCountsTotal = new StatusCounts ();
+ if (objMono == null)
+ status.presence = PresenceTypes.Missing;
+ else if (objMS == null)
+ status.presence = PresenceTypes.Extra;
+ else
+ status.presence = PresenceTypes.Present;
+ }
+ public void Add (NodeStatus statusChild)
+ {
+ if ((int) statusChild.status.error > (int) status.error)
+ status.error = statusChild.status.error;
+ statusCountsTotal.Add (statusChild.statusCountsTotal);
+ statusCountsChildren.Add (statusChild.statusCountsChildren);
+ }
+ public void AddChildren (NodeStatus statusChild)
+ {
+ statusCountsTotal.Add (statusChild.statusCountsTotal);
+ statusCountsTotal.Add (statusChild.status);
+ statusCountsChildren.Add (statusChild.status);
+ }
+
+ public void SubChildren (NodeStatus statusChild)
+ {
+ statusCountsTotal.Sub (statusChild.statusCountsTotal);
+ statusCountsTotal.Sub (statusChild.status);
+ statusCountsChildren.Sub (statusChild.status);
+ }
+
+ public void Add (StatusCounts statusCounts)
+ {
+ statusCountsChildren.Add (statusCounts);
+ statusCountsTotal.Add (statusCounts);
+ }
+
+ public void Sub (StatusCounts statusCounts)
+ {
+ statusCountsChildren.Sub (statusCounts);
+ statusCountsTotal.Sub (statusCounts);
+ }
+
+ public void Add (Status status)
+ {
+ statusCountsChildren.Add (status);
+ statusCountsTotal.Add (status);
+ }
+
+ public void Sub (Status status)
+ {
+ statusCountsChildren.Sub (status);
+ statusCountsTotal.Sub (status);
+ }
+
+
+ public bool IsMissing
+ {
+ get { return status.presence == PresenceTypes.Missing; }
+ }
+ public bool IsPresent
+ {
+ get { return status.presence == PresenceTypes.Present; }
+ }
+ public bool IsExtra
+ {
+ get { return status.presence == PresenceTypes.Extra; }
+ }
+
+ public void SetAttributes (XmlElement elt)
+ {
+ status.SetAttributes (elt);
+ statusCountsChildren.SetAttributes (elt, "");
+ statusCountsTotal.SetAttributes (elt, "_total");
+
+ // add any warning messages
+ if (lstWarnings != null)
+ {
+ XmlElement eltWarnings = elt.OwnerDocument.CreateElement ("warnings");
+ elt.AppendChild (eltWarnings);
+ foreach (NodeMessage msg in lstWarnings)
+ {
+ XmlElement eltWarning = elt.OwnerDocument.CreateElement ("warning");
+ eltWarnings.AppendChild (eltWarning);
+ eltWarning.SetAttribute ("text", msg.Message);
+ }
+ }
+
+ //int percentComplete = (cTotal == 0) ? 100 : (100 - 100 * (cMissing + cExtra) / cTotal);
+ //elt.SetAttribute ("complete", percentComplete.ToString ());
+ }
+ public void SetError (ErrorTypes errorNew)
+ {
+ // TODO: assumes order of error values
+ if ((int) errorNew > (int) status.error)
+ status.error = errorNew;
+ }
+ public void AddWarning (string strWarning)
+ {
+ if (lstWarnings == null)
+ lstWarnings = new ArrayList ();
+ lstWarnings.Add (new NodeMessage (strWarning));
+ SetError (ErrorTypes.Warning);
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/tools/corcompare/CorCompare.cs b/mcs/tools/corcompare/CorCompare.cs
new file mode 100644
index 00000000000..bb956979fe3
--- /dev/null
+++ b/mcs/tools/corcompare/CorCompare.cs
@@ -0,0 +1,72 @@
+// Mono.Util.CorCompare.CorCompareDriver
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001-2002 Nick Drochak
+
+using System;
+using System.IO;
+
+namespace Mono.Util.CorCompare {
+
+ /// <summary>
+ /// Handles command line arguments, and generates appropriate report(s)
+ /// based on those arguments
+ /// </summary>
+ /// <remarks>
+ /// created by - Nick
+ /// created on - 2/20/2002 10:43:57 PM
+ /// </remarks>
+ class CorCompareDriver
+ {
+ public static void Main(string[] args) {
+ // make sure we were called with the proper usage
+ if (args.Length < 1) {
+ Console.WriteLine("Usage: CorCompare [-t][-n][-x outfile][-ms assembly][-f friendly_name] assembly_to_compare");
+ return;
+ }
+
+ bool fList = false;
+ string strXML = null;
+ string strMono = args [args.Length - 1];
+ string strMS = null;
+ string strFriendly = null;
+
+ for (int i = 0; i < args.Length-1; i++) {
+ if (args [i] == "-t") {
+ fList = true;
+ }
+ if (args [i] == "-n") {
+ }
+ if (args [i] == "-x") {
+ strXML = args [++i];
+ }
+ if (args [i] == "-ms") {
+ strMS = args [++i];
+ }
+ if (args [i] == "-f") {
+ strFriendly = args [++i];
+ }
+ }
+
+ if (strMS == null)
+ strMS = Path.GetFileNameWithoutExtension (strMono);
+
+ if (strFriendly == null)
+ strFriendly = strMS;
+
+ if (strXML == null)
+ strXML = strFriendly + ".xml";
+
+ ToDoAssembly td = ToDoAssembly.Load (strMono, strFriendly, strMS);
+
+ if (fList)
+ Console.WriteLine(td.CreateClassListReport());
+
+ if (strXML != null)
+ td.CreateXMLReport(strXML);
+
+ }
+ }
+}
diff --git a/mcs/tools/corcompare/Makefile b/mcs/tools/corcompare/Makefile
new file mode 100644
index 00000000000..253e4e8b791
--- /dev/null
+++ b/mcs/tools/corcompare/Makefile
@@ -0,0 +1,11 @@
+all: linux
+
+windows: linux
+
+linux: CorCompare.exe
+
+CorCompare.exe: *.cs
+ ../../nant/NAnt.exe linux
+
+clean:
+ rm -f *.exe *.pdb *.dll
diff --git a/mcs/tools/corcompare/MissingAttribute.cs b/mcs/tools/corcompare/MissingAttribute.cs
new file mode 100644
index 00000000000..f155a8764bd
--- /dev/null
+++ b/mcs/tools/corcompare/MissingAttribute.cs
@@ -0,0 +1,136 @@
+// Mono.Util.CorCompare.MissingAttribute
+//
+// Author(s):
+// Piers Haken (piersh@friskit.com)
+//
+// (C) 2001-2002 Piers Haken
+using System;
+using System.Xml;
+using System.Reflection;
+using System.Collections;
+
+namespace Mono.Util.CorCompare
+{
+
+ /// <summary>
+ /// Represents an Attribute that is completely missing
+ /// </summary>
+ /// <remarks>
+ /// created by - Piersh
+ /// created on - 3/2/2002 9:47:00 pm
+ /// </remarks>
+ class MissingAttribute : MissingBase
+ {
+ // e.g. <attribute name="Equals" status="missing"/>
+ Object attributeMono;
+ Object attributeMS;
+ static Hashtable htIgnore;
+
+ static MissingAttribute ()
+ {
+ htIgnore = new Hashtable ();
+ htIgnore.Add ("System.Runtime.InteropServices.ClassInterfaceAttribute", null);
+ htIgnore.Add ("System.Diagnostics.DebuggerHiddenAttribute", null);
+ htIgnore.Add ("System.Diagnostics.DebuggerStepThroughAttribute", null);
+ htIgnore.Add ("System.Runtime.InteropServices.GuidAttribute", null);
+ htIgnore.Add ("System.Runtime.InteropServices.InterfaceTypeAttribute", null);
+ htIgnore.Add ("System.Runtime.InteropServices.ComVisibleAttribute", null);
+ }
+
+ public MissingAttribute (Object _attributeMono, Object _attributeMS)
+ {
+ attributeMono = _attributeMono;
+ attributeMS = _attributeMS;
+ m_nodeStatus = new NodeStatus (attributeMono, attributeMS);
+ }
+
+ public override string Name
+ {
+ get { return Attribute.ToString (); }
+ }
+
+ public override string Type
+ {
+ get { return "attribute"; }
+ }
+
+ public override NodeStatus Analyze ()
+ {
+ return m_nodeStatus;
+ }
+
+
+ public Object Attribute
+ {
+ get { return (attributeMono != null) ? attributeMono : attributeMS; }
+ }
+
+ /// <summary>
+ /// creates a map from a list of attributes
+ /// the hashtable maps from name to attribute
+ /// </summary>
+ /// <param name="rgAttributes">the list of attributes</param>
+ /// <returns>a map</returns>
+ public static Hashtable GetAttributeMap (Object [] rgAttributes)
+ {
+ Hashtable map = new Hashtable ();
+ foreach (Object attribute in rgAttributes)
+ {
+ if (attribute != null)
+ {
+ string strName = attribute.ToString ();
+ if (!map.Contains (strName) && !htIgnore.Contains (strName))
+ map.Add (strName, attribute);
+ }
+ }
+ return map;
+ }
+
+ /// <summary>
+ /// analyzes two sets of reflected attributes, generates a list
+ /// of MissingAttributes according to the completion of the first set wrt the second.
+ /// </summary>
+ /// <param name="rgAttributesMono">mono attributes</param>
+ /// <param name="rgAttributesMS">microsoft attributes</param>
+ /// <param name="rgAttributes">where the results are put</param>
+ /// <returns>completion info for the whole set</returns>
+ public static NodeStatus AnalyzeAttributes (Object [] rgAttributesMono, Object [] rgAttributesMS, ArrayList rgAttributes)
+ {
+ NodeStatus nodeStatus = new NodeStatus ();
+
+ Hashtable mapAttributesMono = (rgAttributesMono == null) ? new Hashtable () : MissingAttribute.GetAttributeMap (rgAttributesMono);
+ Hashtable mapAttributesMS = (rgAttributesMS == null) ? new Hashtable () : MissingAttribute.GetAttributeMap (rgAttributesMS);
+
+ foreach (Object attribute in mapAttributesMS.Values)
+ {
+ string strAttribute = attribute.ToString ();
+ Object attributeMono = mapAttributesMono [strAttribute];
+ MissingAttribute ma = new MissingAttribute (attributeMono, attribute);
+ rgAttributes.Add (ma);
+ NodeStatus nsAttribute = ma.Analyze ();
+ nodeStatus.AddChildren (nsAttribute);
+
+ if (attributeMono != null)
+ mapAttributesMono.Remove (strAttribute);
+ }
+ foreach (Object attribute in mapAttributesMono.Values)
+ {
+ if (attribute.ToString ().EndsWith ("MonoTODOAttribute"))
+ {
+ nodeStatus.SetError (ErrorTypes.Todo);
+ //nodeStatus.statusCountsChildren.errorCounts.Add (ErrorTypes.Todo);
+ //nodeStatus.statusCountsTotal.errorCounts.Add (ErrorTypes.Todo);
+ //nodeStatus.cTodo ++; // this is where ALL the 'todo's come from
+ }
+ else
+ {
+ MissingAttribute ma = new MissingAttribute (attribute, null);
+ rgAttributes.Add (ma);
+ NodeStatus nsAttribute = ma.Analyze ();
+ nodeStatus.AddChildren (nsAttribute);
+ }
+ }
+ return nodeStatus;
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/tools/corcompare/MissingBase.cs b/mcs/tools/corcompare/MissingBase.cs
new file mode 100644
index 00000000000..ec62043a32a
--- /dev/null
+++ b/mcs/tools/corcompare/MissingBase.cs
@@ -0,0 +1,134 @@
+// Mono.Util.CorCompare.MissingBase
+//
+// Author(s):
+// Piers Haken (piersh@friskit.com)
+//
+// (C) 2001-2002 Piers Haken
+using System;
+using System.Xml;
+using System.Reflection;
+using System.Collections;
+
+namespace Mono.Util.CorCompare
+{
+ /// <summary>
+ /// Base class for all comparison items
+ /// </summary>
+ /// <remarks>
+ /// created by - Piersh
+ /// created on - 3/3/2002 10:23:24 AM
+ /// </remarks>
+ public abstract class MissingBase
+ {
+ protected NodeStatus m_nodeStatus;
+ protected ArrayList rgAttributes;
+ protected NodeStatus nsAttributes;
+
+ public enum Accessibility
+ {
+ Public,
+ Assembly,
+ FamilyOrAssembly,
+ Family,
+ FamilyAndAssembly,
+ Private,
+ }
+
+ /// <summary>
+ /// The name of the element (eg "System.Xml")
+ /// </summary>
+ public abstract string Name { get ; }
+
+ /// <summary>
+ /// The type of the element (eg "namespace")
+ /// </summary>
+ public abstract string Type { get; }
+
+ /// <summary>
+ /// Generates an XmlElement describint this element
+ /// </summary>
+ /// <param name="doc">The document in which to create the element</param>
+ /// <returns></returns>
+ public virtual XmlElement CreateXML (XmlDocument doc)
+ {
+ XmlElement eltMissing = doc.CreateElement (Type);
+ eltMissing.SetAttribute ("name", Name);
+ //Status.status.SetAttributes (eltMissing);
+ Status.SetAttributes (eltMissing);
+
+ XmlElement eltAttributes = MissingBase.CreateMemberCollectionElement ("attributes", rgAttributes, nsAttributes, doc);
+ if (eltAttributes != null)
+ eltMissing.AppendChild (eltAttributes);
+
+ return eltMissing;
+ }
+
+ public virtual NodeStatus Status
+ {
+ get { return m_nodeStatus; }
+ }
+
+ public abstract NodeStatus Analyze ();
+
+ /// <summary>
+ /// Creates an XmlElement grouping together a set of sub-elements
+ /// </summary>
+ /// <param name="name">the name of the element to create</param>
+ /// <param name="rgMembers">a list of sub-elements</param>
+ /// <param name="doc">the document in which to create the element</param>
+ /// <returns></returns>
+ public static XmlElement CreateMemberCollectionElement (string name, ArrayList rgMembers, NodeStatus ns, XmlDocument doc)
+ {
+ XmlElement element = null;
+ if (rgMembers != null && rgMembers.Count > 0)
+ {
+ element = doc.CreateElement(name);
+ foreach (MissingBase mm in rgMembers)
+ element.AppendChild (mm.CreateXML (doc));
+
+ //ns.SetAttributes (element);
+ }
+ return element;
+ }
+ protected void AddFakeAttribute (bool fMono, bool fMS, string strName)
+ {
+ if (fMono || fMS)
+ {
+ MissingAttribute ma = new MissingAttribute (
+ (fMono) ? strName : null,
+ (fMS) ? strName : null);
+ ma.Analyze ();
+ rgAttributes.Add (ma);
+ nsAttributes.AddChildren (ma.Status);
+ }
+ }
+
+ protected void AddFlagWarning (bool fMono, bool fMS, string strName)
+ {
+ if (!fMono && fMS)
+ m_nodeStatus.AddWarning ("Should be " + strName);
+ else if (fMono && !fMS)
+ m_nodeStatus.AddWarning ("Should not be " + strName);
+ }
+
+ protected string AccessibilityToString (Accessibility ac)
+ {
+ switch (ac)
+ {
+ case Accessibility.Public:
+ return "public";
+ case Accessibility.Assembly:
+ return "internal";
+ case Accessibility.FamilyOrAssembly:
+ return "protected internal";
+ case Accessibility.Family:
+ return "protected";
+ case Accessibility.FamilyAndAssembly:
+ return "protected"; // TODO:
+ case Accessibility.Private:
+ return "private";
+ }
+ throw new Exception ("Invalid accessibility: "+ac.ToString ());
+ }
+ }
+}
diff --git a/mcs/tools/corcompare/MissingConstructor.cs b/mcs/tools/corcompare/MissingConstructor.cs
new file mode 100644
index 00000000000..eda6f52b23a
--- /dev/null
+++ b/mcs/tools/corcompare/MissingConstructor.cs
@@ -0,0 +1,30 @@
+// Mono.Util.CorCompare.MissingConstructor
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001-2002 Nick Drochak
+
+using System;
+using System.Reflection;
+
+namespace Mono.Util.CorCompare {
+
+ /// <summary>
+ /// Represents a class event that is completely missing
+ /// </summary>
+ /// <remarks>
+ /// created by - Nick
+ /// created on - 2/24/2002 10:43:57 PM
+ /// </remarks>
+ class MissingConstructor : MissingMethod {
+ // e.g. <method name="Equals" status="missing"/>
+ public MissingConstructor (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
+
+ public override string Type {
+ get {
+ return "constructor";
+ }
+ }
+ }
+}
diff --git a/mcs/tools/corcompare/MissingEvent.cs b/mcs/tools/corcompare/MissingEvent.cs
new file mode 100644
index 00000000000..fb037c2319b
--- /dev/null
+++ b/mcs/tools/corcompare/MissingEvent.cs
@@ -0,0 +1,110 @@
+// Mono.Util.CorCompare.MissingEvent
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001-2002 Nick Drochak
+
+using System;
+using System.Reflection;
+using System.Xml;
+
+namespace Mono.Util.CorCompare {
+
+ /// <summary>
+ /// Represents a class event that is completely missing
+ /// </summary>
+ /// <remarks>
+ /// created by - Nick
+ /// created on - 2/24/2002 10:43:57 PM
+ /// </remarks>
+ class MissingEvent : MissingMember {
+ // e.g. <method name="Equals" status="missing"/>
+ public MissingEvent (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
+ MissingMethod mmAdd;
+ MissingMethod mmRemove;
+ MissingMethod mmRaise;
+
+ public override string Type {
+ get {
+ return "event";
+ }
+ }
+
+ public override NodeStatus Analyze ()
+ {
+ m_nodeStatus = base.Analyze ();
+
+ EventInfo eiMono = (EventInfo) mInfoMono;
+ EventInfo eiMS = (EventInfo) mInfoMS;
+
+ MemberInfo miAddMono, miRemoveMono, miRaiseMono;
+ if (eiMono == null)
+ miAddMono = miRemoveMono = miRaiseMono = null;
+ else
+ {
+ miAddMono = eiMono.GetAddMethod ();
+ miRemoveMono = eiMono.GetRemoveMethod ();
+ miRaiseMono = eiMono.GetRaiseMethod ();
+ }
+
+ MemberInfo miAddMS, miRemoveMS, miRaiseMS;
+ if (eiMS == null)
+ miAddMS = miRemoveMS = miRaiseMS = null;
+ else
+ {
+ miAddMS = eiMS.GetAddMethod ();
+ miRemoveMS = eiMS.GetRemoveMethod ();
+ miRaiseMS = eiMS.GetRaiseMethod ();
+ }
+
+ if (miAddMono != null || miAddMS != null)
+ {
+ mmAdd = new MissingMethod (miAddMono, miAddMS);
+ m_nodeStatus.AddChildren (mmAdd.Analyze ());
+ }
+ if (miRemoveMono != null || miRemoveMS != null)
+ {
+ mmRemove = new MissingMethod (miRemoveMono, miRemoveMS);
+ m_nodeStatus.AddChildren (mmRemove.Analyze ());
+ }
+ if (miRaiseMono != null || miRaiseMS != null)
+ {
+ mmRaise = new MissingMethod (miRemoveMono, miRemoveMS);
+ m_nodeStatus.AddChildren (mmRaise.Analyze ());
+ }
+ return m_nodeStatus;
+ }
+
+ public override XmlElement CreateXML (XmlDocument doc)
+ {
+ XmlElement eltMember = base.CreateXML (doc);
+
+ if (mInfoMono != null && mmRaise != null)
+ {
+ XmlElement eltAccessors = (XmlElement) eltMember.SelectSingleNode ("accessors");
+ if (eltAccessors == null)
+ {
+ eltAccessors = doc.CreateElement ("accessors");
+ eltMember.AppendChild (eltAccessors);
+ }
+ if (mmAdd != null)
+ {
+ XmlElement eltAdd = mmAdd.CreateXML (doc);
+ eltAccessors.AppendChild (eltAdd);
+ }
+ if (mmRemove != null)
+ {
+ XmlElement eltRemove = mmRemove.CreateXML (doc);
+ eltAccessors.AppendChild (eltRemove);
+ }
+ if (mmRaise != null)
+ {
+ XmlElement eltRaise = mmRaise.CreateXML (doc);
+ eltAccessors.AppendChild (eltRaise);
+ }
+ }
+ return eltMember;
+ }
+ }
+}
diff --git a/mcs/tools/corcompare/MissingField.cs b/mcs/tools/corcompare/MissingField.cs
new file mode 100644
index 00000000000..12e598a2180
--- /dev/null
+++ b/mcs/tools/corcompare/MissingField.cs
@@ -0,0 +1,76 @@
+// Mono.Util.CorCompare.MissingField
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001-2002 Nick Drochak
+
+using System;
+using System.Reflection;
+
+namespace Mono.Util.CorCompare {
+
+ /// <summary>
+ /// Represents a class event that is completely missing
+ /// </summary>
+ /// <remarks>
+ /// created by - Nick
+ /// created on - 2/24/2002 10:43:57 PM
+ /// </remarks>
+ class MissingField : MissingMember {
+ // e.g. <method name="Equals" status="missing"/>
+ public MissingField (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
+
+ public override string Type {
+ get {
+ return "field";
+ }
+ }
+
+ public override NodeStatus Analyze ()
+ {
+ base.Analyze ();
+
+ if (mInfoMono != null && mInfoMS != null)
+ {
+ FieldInfo fiMono = (FieldInfo) mInfoMono;
+ FieldInfo fiMS = (FieldInfo) mInfoMS;
+
+ AddFakeAttribute (fiMono.IsNotSerialized, fiMS.IsNotSerialized, "System.NonSerializedAttribute");
+ AddFakeAttribute (fiMono.IsPinvokeImpl, fiMS.IsPinvokeImpl, "System.PInvokeImplAttribute");
+
+ AddFlagWarning (fiMono.IsStatic, fiMS.IsStatic, "static");
+ AddFlagWarning (fiMono.IsLiteral, fiMS.IsLiteral, "const");
+ AddFlagWarning (fiMono.IsInitOnly, fiMS.IsInitOnly, "readonly");
+
+ string strTypeMono = fiMono.FieldType.FullName;
+ string strTypeMS = fiMS.FieldType.FullName;
+ if (strTypeMono != strTypeMS)
+ {
+ Status.AddWarning ("Invalid type: is '"+strTypeMono+"', should be '"+strTypeMS+"'");
+ }
+
+ try
+ {
+ if (fiMono.IsStatic && fiMS.IsStatic &&
+ fiMono.IsLiteral && fiMS.IsLiteral)
+ {
+ object objMono = fiMono.GetValue (null);
+ object objMS = fiMS.GetValue (null);
+ long lMono = Convert.ToInt64 (objMono);
+ long lMS = Convert.ToInt64 (objMS);
+
+ if (lMono != lMS)
+ {
+ string strValMono = ((lMono < 0) ? "-0x" : "0x") + lMono.ToString ("x");
+ string strValMS = ((lMS < 0) ? "-0x" : "0x") + lMS.ToString ("x");
+ Status.AddWarning ("Invalid value: is '"+strValMono+"', should be '"+strValMS+"'");
+ }
+ }
+ }
+ catch (Exception) {}
+ }
+ return m_nodeStatus;
+ }
+ }
+}
diff --git a/mcs/tools/corcompare/MissingInterface.cs b/mcs/tools/corcompare/MissingInterface.cs
new file mode 100644
index 00000000000..d4c274b61e6
--- /dev/null
+++ b/mcs/tools/corcompare/MissingInterface.cs
@@ -0,0 +1,51 @@
+// Mono.Util.CorCompare.MissingField
+//
+// Author(s):
+// Piers Haken (piersh@friskit.com)
+//
+// (C) 2002 Piers Haken
+
+using System;
+using System.Reflection;
+
+namespace Mono.Util.CorCompare
+{
+
+ /// <summary>
+ /// Represents an interface implemented on a class
+ /// </summary>
+ /// <remarks>
+ /// created by - Piers
+ /// created on - 10:34 AM 3/12/2002
+ /// </remarks>
+ class MissingInterface : MissingBase
+ {
+ protected Type ifaceMono;
+ protected Type ifaceMS;
+
+ // e.g. <method name="Equals" status="missing"/>
+ public MissingInterface (Type _ifaceMono, Type _ifaceMS)
+ {
+ ifaceMono = _ifaceMono;
+ ifaceMS = _ifaceMS;
+ m_nodeStatus = new NodeStatus (ifaceMono, ifaceMS);
+ }
+
+ public override string Type
+ {
+ get { return "interface"; }
+ }
+ public override string Name
+ {
+ get { return Interface.FullName; }
+ }
+ protected Type Interface
+ {
+ get { return (ifaceMono != null) ? ifaceMono : ifaceMS; }
+ }
+ public override NodeStatus Analyze ()
+ {
+ return m_nodeStatus;
+ }
+ }
+}
diff --git a/mcs/tools/corcompare/MissingMember.cs b/mcs/tools/corcompare/MissingMember.cs
new file mode 100644
index 00000000000..2341c532b03
--- /dev/null
+++ b/mcs/tools/corcompare/MissingMember.cs
@@ -0,0 +1,138 @@
+using System;
+using System.Xml;
+using System.Reflection;
+using System.Collections;
+
+namespace Mono.Util.CorCompare
+{
+
+ /// <summary>
+ /// Represents a generic member that is completely missing
+ /// </summary>
+ /// <remarks>
+ /// created by - Piersh
+ /// created on - 3/1/2002 3:37:00 am
+ /// </remarks>
+ abstract class MissingMember : MissingBase
+ {
+ // e.g. <method name="Equals" status="missing"/>
+ protected MemberInfo mInfoMono;
+ protected MemberInfo mInfoMS;
+
+ public MissingMember (MemberInfo infoMono, MemberInfo infoMS)
+ {
+ mInfoMono = infoMono;
+ mInfoMS = infoMS;
+ m_nodeStatus = new NodeStatus (infoMono, infoMS);
+ }
+
+ public override string Name
+ {
+ get { return Info.Name; }
+ }
+
+ public override NodeStatus Analyze ()
+ {
+ if (!Status.IsMissing)
+ {
+ rgAttributes = new ArrayList ();
+ nsAttributes = MissingAttribute.AnalyzeAttributes (
+ (mInfoMono == null) ? null : mInfoMono.GetCustomAttributes (false),
+ (mInfoMS == null) ? null : mInfoMS.GetCustomAttributes (false),
+ rgAttributes);
+
+ if (mInfoMono != null && mInfoMS != null)
+ {
+ Accessibility acMono = GetAccessibility (mInfoMono);
+ Accessibility acMS = GetAccessibility (mInfoMS);
+ if (acMono != acMS)
+ Status.AddWarning ("Should be "+AccessibilityToString (acMS));
+ }
+
+ m_nodeStatus.Add (nsAttributes);
+ }
+ return m_nodeStatus;
+ }
+
+ /// <summary>
+ /// returns the MemberInfo for this member.
+ /// if it's a missing member then the microsoft MemberInfo is returned instead
+ /// </summary>
+ public MemberInfo Info
+ {
+ get { return (mInfoMono != null) ? mInfoMono : mInfoMS; }
+ }
+
+ /// <summary>
+ /// returns the 'best' info for this member. the 'best' info is the microsoft info, if it's available, otherwise the mono info.
+ /// </summary>
+ public MemberInfo BestInfo
+ {
+ get { return (mInfoMS != null) ? mInfoMS : mInfoMono; }
+ }
+
+ public static string GetUniqueName (MemberInfo mi)
+ {
+ return (mi.MemberType).ToString () + mi.ToString ();
+ }
+
+ public static Accessibility GetAccessibility (MemberInfo mi)
+ {
+ switch (mi.MemberType)
+ {
+ case MemberTypes.Constructor:
+ case MemberTypes.Method:
+ MethodBase mb = (MethodBase) mi;
+ if (mb.IsPublic)
+ return Accessibility.Public;
+ else if (mb.IsAssembly)
+ return Accessibility.Assembly;
+ else if (mb.IsFamilyOrAssembly)
+ return Accessibility.FamilyOrAssembly;
+ else if (mb.IsFamily)
+ return Accessibility.Family;
+ else if (mb.IsFamilyAndAssembly)
+ return Accessibility.FamilyAndAssembly;
+ else if (mb.IsPrivate)
+ return Accessibility.Private;
+ break;
+ case MemberTypes.Field:
+ FieldInfo fi = (FieldInfo) mi;
+ if (fi.IsPublic)
+ return Accessibility.Public;
+ else if (fi.IsAssembly)
+ return Accessibility.Assembly;
+ else if (fi.IsFamilyOrAssembly)
+ return Accessibility.FamilyOrAssembly;
+ else if (fi.IsFamily)
+ return Accessibility.Family;
+ else if (fi.IsFamilyAndAssembly)
+ return Accessibility.FamilyAndAssembly;
+ else if (fi.IsPrivate)
+ return Accessibility.Private;
+ break;
+ case MemberTypes.NestedType:
+ Type ti = (Type) mi;
+ if (ti.IsNestedPublic)
+ return Accessibility.Public;
+ if (ti.IsNestedAssembly)
+ return Accessibility.Assembly;
+ else if (ti.IsNestedFamORAssem)
+ return Accessibility.FamilyOrAssembly;
+ else if (ti.IsNestedFamily)
+ return Accessibility.Family;
+ else if (ti.IsNestedFamANDAssem)
+ return Accessibility.FamilyAndAssembly;
+ else if (ti.IsNestedPrivate)
+ return Accessibility.Private;
+ break;
+ case MemberTypes.Event:
+ case MemberTypes.Property:
+ return Accessibility.Public;
+ default:
+ throw new Exception ("Missing handler for MemberType: "+mi.MemberType.ToString ());
+ }
+ throw new Exception ("Invalid accessibility: "+mi.ToString ());
+ }
+ }
+}
diff --git a/mcs/tools/corcompare/MissingMethod.cs b/mcs/tools/corcompare/MissingMethod.cs
new file mode 100644
index 00000000000..306bbb66e81
--- /dev/null
+++ b/mcs/tools/corcompare/MissingMethod.cs
@@ -0,0 +1,58 @@
+// Mono.Util.CorCompare.MissingMethod
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001-2002 Nick Drochak
+
+using System;
+using System.Reflection;
+using System.Text;
+
+namespace Mono.Util.CorCompare {
+
+ /// <summary>
+ /// Represents a class method that is completely missing
+ /// </summary>
+ /// <remarks>
+ /// created by - Nick
+ /// created on - 2/20/2002 10:43:57 PM
+ /// </remarks>
+ class MissingMethod : MissingMember
+ {
+ // e.g. <method name="Equals" status="missing"/>
+ public MissingMethod (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
+
+ public override string Name {
+ get {
+ string s = Info.ToString();
+ int index = s.IndexOf(' ');
+ return s.Substring(index + 1);
+ }
+ }
+
+ public override string Type {
+ get {
+ return "method";
+ }
+ }
+
+ public override NodeStatus Analyze ()
+ {
+ m_nodeStatus = base.Analyze ();
+
+ if (mInfoMono != null && mInfoMS != null)
+ {
+ MethodBase miMono = (MethodBase) mInfoMono;
+ MethodBase miMS = (MethodBase) mInfoMS;
+
+ AddFlagWarning (miMono.IsAbstract, miMS.IsAbstract, "abstract");
+ AddFlagWarning (miMono.IsStatic, miMS.IsStatic, "static");
+ AddFlagWarning (miMono.IsVirtual && !miMono.IsFinal, miMS.IsVirtual && !miMS.IsFinal, "virtual");
+ AddFlagWarning (miMono.IsConstructor, miMS.IsConstructor, "a constructor");
+ //AddFlagWarning (miMono.IsFinal, miMS.IsFinal, "sealed");
+ }
+ return m_nodeStatus;
+ }
+ }
+}
diff --git a/mcs/tools/corcompare/MissingNameSpace.cs b/mcs/tools/corcompare/MissingNameSpace.cs
new file mode 100644
index 00000000000..b63168e0672
--- /dev/null
+++ b/mcs/tools/corcompare/MissingNameSpace.cs
@@ -0,0 +1,159 @@
+// Mono.Util.CorCompare.MissingNameSpace
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001-2002 Nick Drochak
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Xml;
+
+namespace Mono.Util.CorCompare {
+
+ /// <summary>
+ /// Represents a namespace that has missing and/or MonoTODO classes.
+ /// </summary>
+ /// <remarks>
+ /// created by - Nick
+ /// created on - 2/20/2002 10:43:57 PM
+ /// </remarks>
+ class MissingNameSpace : MissingBase
+ {
+ // e.g. <namespace name="System" missing="267" todo="453" complete="21">
+ protected ArrayList rgTypesMono, rgTypesMS;
+ string strNamespace;
+ ArrayList rgTypes = new ArrayList ();
+ protected static Hashtable htGhostTypes;
+ static string[] rgstrGhostTypes = {"System.Object", "System.ValueType", "System.Delegate", "System.Enum"};
+
+
+ static MissingNameSpace ()
+ {
+ htGhostTypes = new Hashtable ();
+
+ foreach (string strGhostType in rgstrGhostTypes)
+ {
+ htGhostTypes.Add (strGhostType, null);
+ }
+ }
+
+ public MissingNameSpace(string nameSpace, ArrayList _rgTypesMono, ArrayList _rgTypesMS)
+ {
+ strNamespace = nameSpace;
+ rgTypesMono = _rgTypesMono;
+ rgTypesMS = _rgTypesMS;
+ m_nodeStatus = new NodeStatus (_rgTypesMono, _rgTypesMS);
+ }
+
+ public virtual string [] MissingTypeNames (bool f)
+ {
+ return null;
+ }
+
+ public virtual ArrayList ToDoTypeNames
+ {
+ get { return null; }
+ }
+
+ public override string Name
+ {
+ get { return strNamespace; }
+ }
+ public override string Type
+ {
+ get { return "namespace"; }
+ }
+
+
+ /// <summary>
+ /// first we go through all the microsoft types adding any mono types that match, or missing types otherwise
+ /// then we go through the unmatched mono types adding those
+ /// uses a hashtable to speed up lookups
+ /// </summary>
+ /// <returns></returns>
+ public override NodeStatus Analyze ()
+ {
+ Hashtable htMono = new Hashtable ();
+ if (rgTypesMono != null)
+ {
+ foreach (Type t in rgTypesMono)
+ {
+ htMono.Add (t.FullName, t);
+ }
+ }
+ if (rgTypesMS != null)
+ {
+ foreach (Type t in rgTypesMS)
+ {
+ Type tMono = (Type) htMono [t.FullName];
+ MissingType mt = null;
+ if (tMono == null)
+ {
+ if (t.IsPublic && !htGhostTypes.Contains (t.FullName))
+ mt = new MissingType (null, t);
+ }
+ else
+ {
+ htMono.Remove (t.FullName);
+ mt = new MissingType (tMono, t);
+ }
+ if (mt != null)
+ {
+ NodeStatus nsType = mt.Analyze ();
+ m_nodeStatus.AddChildren (nsType);
+ rgTypes.Add (mt);
+ }
+ }
+ }
+ // do any mono types that aren't in microsoft's namespace
+ foreach (Type tMono in htMono.Values)
+ {
+ if (tMono.IsPublic)
+ {
+ MissingType tdt = new MissingType (tMono, null);
+ NodeStatus nsType = tdt.Analyze ();
+ m_nodeStatus.AddChildren (nsType);
+ rgTypes.Add (tdt);
+ }
+ }
+ return m_nodeStatus;
+ }
+
+ public override XmlElement CreateXML (XmlDocument doc)
+ {
+ XmlElement eltNameSpace = base.CreateXML (doc);
+
+ // TODO: include complete namespaces?
+// if (m_nodeStatus.statusCountsTotal.cMissing > 0 || m_nodeStatus.statusCountsTotal.cTodo > 0)
+ {
+ XmlElement eltClasses = doc.CreateElement("classes");
+ eltNameSpace.AppendChild (eltClasses);
+
+ foreach (MissingType type in rgTypes)
+ {
+ XmlElement eltClass = type.CreateXML (doc);
+ if (eltClass != null)
+ eltClasses.AppendChild (eltClass);
+ }
+ }
+ return eltNameSpace;
+ }
+
+
+ public static ArrayList GetNamespaces(Type[] types)
+ {
+ ArrayList nsList = new ArrayList();
+ foreach (Type t in types)
+ {
+ if (!nsList.Contains(t.Namespace))
+ {
+ nsList.Add(t.Namespace);
+ }
+ }
+ return nsList;
+ }
+ }
+}
+
diff --git a/mcs/tools/corcompare/MissingNestedType.cs b/mcs/tools/corcompare/MissingNestedType.cs
new file mode 100644
index 00000000000..a2bc3417005
--- /dev/null
+++ b/mcs/tools/corcompare/MissingNestedType.cs
@@ -0,0 +1,36 @@
+// Mono.Util.CorCompare.MissingNestedType
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001-2002 Nick Drochak
+
+using System;
+using System.Reflection;
+
+namespace Mono.Util.CorCompare {
+
+ /// <summary>
+ /// Represents a class event that is completely missing
+ /// </summary>
+ /// <remarks>
+ /// created by - Nick
+ /// created on - 2/24/2002 10:43:57 PM
+ /// </remarks>
+ class MissingNestedType : MissingMember {
+ // e.g. <method name="Equals" status="missing"/>
+ public MissingNestedType (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
+
+ public override string Type {
+ get {
+ return "nestedType";
+ }
+ }
+
+ public override string Name
+ {
+ get { return Info.DeclaringType.Name + "+" + Info.Name; }
+ }
+
+ }
+}
diff --git a/mcs/tools/corcompare/MissingProperty.cs b/mcs/tools/corcompare/MissingProperty.cs
new file mode 100644
index 00000000000..d3eb711d4fb
--- /dev/null
+++ b/mcs/tools/corcompare/MissingProperty.cs
@@ -0,0 +1,108 @@
+// Mono.Util.CorCompare.MissingProperty
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001-2002 Nick Drochak
+
+using System;
+using System.Reflection;
+using System.Text;
+using System.Xml;
+
+namespace Mono.Util.CorCompare {
+
+ /// <summary>
+ /// Represents a missing property from a class
+ /// </summary>
+ /// <remarks>
+ /// created by - Nick
+ /// created on - 2/20/2002 10:43:57 PM
+ /// </remarks>
+ class MissingProperty : MissingMember
+ {
+ // e.g. <property name="Length" status="missing"/>
+ public MissingProperty (MemberInfo infoMono, MemberInfo infoMS) : base (infoMono, infoMS) {}
+
+ public override string Type
+ {
+ get { return "property"; }
+ }
+
+ protected MissingMethod mmGet;
+ protected MissingMethod mmSet;
+
+ public override NodeStatus Analyze ()
+ {
+ m_nodeStatus = base.Analyze ();
+
+ PropertyInfo piMono = (PropertyInfo) mInfoMono;
+ PropertyInfo piMS = (PropertyInfo) mInfoMS;
+
+ MemberInfo miGetMono, miSetMono;
+ if (piMono == null)
+ miGetMono = miSetMono = null;
+ else
+ {
+ miGetMono = piMono.GetGetMethod ();
+ miSetMono = piMono.GetSetMethod ();
+ }
+
+ MemberInfo miGetMS, miSetMS;
+ if (piMS == null)
+ miGetMS = miSetMS = null;
+ else
+ {
+ miGetMS = piMS.GetGetMethod ();
+ miSetMS = piMS.GetSetMethod ();
+ }
+
+ if (miGetMono != null || miGetMS != null)
+ {
+ mmGet = new MissingMethod (miGetMono, miGetMS);
+ m_nodeStatus.AddChildren (mmGet.Analyze ());
+ }
+ if (miSetMono != null || miSetMS != null)
+ {
+ mmSet = new MissingMethod (miSetMono, miSetMS);
+ m_nodeStatus.AddChildren (mmSet.Analyze ());
+ }
+
+ if (piMono != null && piMS != null)
+ {
+ string strTypeMono = piMono.PropertyType.FullName;
+ string strTypeMS = piMS.PropertyType.FullName;
+ if (strTypeMono != strTypeMS)
+ Status.AddWarning ("Invalid type: is '"+strTypeMono+"', should be '"+strTypeMS+"'");
+ }
+
+ return m_nodeStatus;
+ }
+
+ public override XmlElement CreateXML (XmlDocument doc)
+ {
+ XmlElement eltMember = base.CreateXML (doc);
+
+ if (mInfoMono != null) // missing
+ {
+ if (mmGet != null || mmSet != null)
+ {
+ XmlElement eltAccessors = doc.CreateElement ("accessors");
+ eltMember.AppendChild (eltAccessors);
+
+ if (mmGet != null)
+ {
+ XmlElement eltGet = mmGet.CreateXML (doc);
+ eltAccessors.AppendChild (eltGet);
+ }
+ if (mmSet != null)
+ {
+ XmlElement eltSet = mmSet.CreateXML (doc);
+ eltAccessors.AppendChild (eltSet);
+ }
+ }
+ }
+ return eltMember;
+ }
+ }
+}
diff --git a/mcs/tools/corcompare/MissingType.cs b/mcs/tools/corcompare/MissingType.cs
new file mode 100644
index 00000000000..013ec5503d3
--- /dev/null
+++ b/mcs/tools/corcompare/MissingType.cs
@@ -0,0 +1,493 @@
+// Mono.Util.CorCompare.MissingType
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001-2002 Nick Drochak
+
+using System;
+using System.Xml;
+using System.Reflection;
+using System.Collections;
+
+namespace Mono.Util.CorCompare
+{
+
+ /// <summary>
+ /// Represents a class method that missing.
+ /// </summary>
+ /// <remarks>
+ /// created by - Nick
+ /// created on - 2/20/2002 10:43:57 PM
+ /// </remarks>
+ class MissingType : MissingBase
+ {
+ // e.g. <class name="System.Byte" status="missing"/>
+ // e.g. <class name="System.Array" status="todo" missing="5" todo="6" complete="45">
+ Type typeMono, typeMS;
+// ArrayList rgAttributes = new ArrayList ();
+ ArrayList rgMethods = new ArrayList ();
+ ArrayList rgProperties = new ArrayList ();
+ ArrayList rgEvents = new ArrayList ();
+ ArrayList rgFields = new ArrayList ();
+ ArrayList rgConstructors = new ArrayList ();
+ ArrayList rgNestedTypes = new ArrayList ();
+ ArrayList rgInterfaces = new ArrayList ();
+// NodeStatus nsAttributes = new NodeStatus ();
+ NodeStatus nsMethods = new NodeStatus ();
+ NodeStatus nsProperties = new NodeStatus ();
+ NodeStatus nsEvents = new NodeStatus ();
+ NodeStatus nsFields = new NodeStatus ();
+ NodeStatus nsConstructors = new NodeStatus ();
+ NodeStatus nsNestedTypes = new NodeStatus ();
+ NodeStatus nsInterfaces = new NodeStatus ();
+
+ public MissingType (Type _typeMono, Type _typeMS)
+ {
+ typeMono = _typeMono;
+ typeMS = _typeMS;
+ m_nodeStatus = new NodeStatus (_typeMono, _typeMS);
+ }
+
+ public override string Name
+ {
+ get
+ {
+ Type type = TypeInfoBest;
+ if (type.DeclaringType != null)
+ return type.DeclaringType.Name + "+" + type.Name;
+ return type.Name;
+ }
+ }
+
+ public override string Type
+ {
+ get
+ {
+ Type type = TypeInfo;
+ if (type.IsEnum)
+ return "enum";
+ else if (type.IsInterface)
+ return "interface";
+ else if (type.IsValueType)
+ return "struct";
+ else if (IsDelegate)
+ return "delegate";
+ else
+ return "class";
+ }
+ }
+
+ public Type TypeInfo
+ {
+ get { return (typeMono != null) ? typeMono : typeMS; }
+ }
+
+ public Type TypeInfoBest
+ {
+ get { return (typeMS == null) ? typeMono : typeMS; }
+ }
+
+ public bool IsDelegate
+ {
+ get
+ {
+ Type typeBest = TypeInfoBest;
+ if (typeBest.IsEnum || typeBest.IsInterface || typeBest.IsValueType)
+ return false;
+ Type type = typeBest.BaseType;
+ while (type != null)
+ {
+ if (type.FullName == "System.Delegate")
+ return true;
+ type = type.BaseType;
+ }
+ return false;
+ }
+ }
+
+ public MissingMember CreateMember (MemberInfo infoMono, MemberInfo infoMS)
+ {
+ MemberTypes mt = (infoMono != null) ? infoMono.MemberType : infoMS.MemberType;
+ MissingMember mm;
+ switch (mt)
+ {
+ case MemberTypes.Method:
+ mm = new MissingMethod (infoMono, infoMS);
+ break;
+ case MemberTypes.Property:
+ mm = new MissingProperty (infoMono, infoMS);
+ break;
+ case MemberTypes.Event:
+ mm = new MissingEvent (infoMono, infoMS);
+ break;
+ case MemberTypes.Field:
+ mm = new MissingField (infoMono, infoMS);
+ break;
+ case MemberTypes.Constructor:
+ mm = new MissingConstructor (infoMono, infoMS);
+ break;
+ case MemberTypes.NestedType:
+ mm = new MissingNestedType (infoMono, infoMS);
+ break;
+ default:
+ throw new Exception ("Unexpected MemberType: " + mt.ToString());
+ }
+ mm.Analyze ();
+ return mm;
+ }
+
+
+ public void AddMember (MissingMember mm)
+ {
+ switch (mm.Info.MemberType)
+ {
+ case MemberTypes.Method:
+ nsMethods.AddChildren (mm.Status);
+ rgMethods.Add (mm);
+ break;
+ case MemberTypes.Property:
+ nsProperties.AddChildren (mm.Status);
+ rgProperties.Add (mm);
+ break;
+ case MemberTypes.Event:
+ nsEvents.AddChildren (mm.Status);
+ rgEvents.Add (mm);
+ break;
+ case MemberTypes.Field:
+ nsFields.AddChildren (mm.Status);
+ rgFields.Add (mm);
+ break;
+ case MemberTypes.Constructor:
+ nsConstructors.AddChildren (mm.Status);
+ rgConstructors.Add (mm);
+ break;
+ case MemberTypes.NestedType:
+ nsNestedTypes.AddChildren (mm.Status);
+ rgNestedTypes.Add (mm);
+ break;
+ default:
+ throw new Exception ("Unexpected MemberType: " + mm.Info.ToString());
+ }
+ }
+
+ public void AddMember (MemberInfo infoMono, MemberInfo infoMS)
+ {
+ AddMember (CreateMember (infoMono, infoMS));
+ }
+
+ public override XmlElement CreateXML (XmlDocument doc)
+ {
+ XmlElement eltClass = base.CreateXML (doc);
+ XmlElement eltMember;
+
+ eltMember = MissingBase.CreateMemberCollectionElement ("methods", rgMethods, nsMethods, doc);
+ if (eltMember != null)
+ eltClass.AppendChild (eltMember);
+
+ eltMember = MissingBase.CreateMemberCollectionElement ("properties", rgProperties, nsProperties, doc);
+ if (eltMember != null)
+ eltClass.AppendChild (eltMember);
+
+ eltMember = MissingBase.CreateMemberCollectionElement ("events", rgEvents, nsEvents, doc);
+ if (eltMember != null)
+ eltClass.AppendChild (eltMember);
+
+ eltMember = MissingBase.CreateMemberCollectionElement ("fields", rgFields, nsFields, doc);
+ if (eltMember != null)
+ eltClass.AppendChild (eltMember);
+
+ eltMember = MissingBase.CreateMemberCollectionElement ("constructors", rgConstructors, nsConstructors, doc);
+ if (eltMember != null)
+ eltClass.AppendChild (eltMember);
+
+ eltMember = MissingBase.CreateMemberCollectionElement ("nestedTypes", rgNestedTypes, nsNestedTypes, doc);
+ if (eltMember != null)
+ eltClass.AppendChild (eltMember);
+
+ eltMember = MissingBase.CreateMemberCollectionElement ("interfaces", rgInterfaces, nsInterfaces, doc);
+ if (eltMember != null)
+ eltClass.AppendChild (eltMember);
+
+ return eltClass;
+ }
+
+ public override NodeStatus Analyze ()
+ {
+ Hashtable htMono = new Hashtable ();
+ if (typeMono != null)
+ {
+ ArrayList rgIgnoreMono = new ArrayList ();
+ foreach (MemberInfo miMono in typeMono.GetMembers (BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
+ {
+ if (typeMono == miMono.DeclaringType)
+ {
+ string strName = MissingMember.GetUniqueName (miMono);
+ htMono.Add (strName, miMono);
+
+ // ignore any property/event accessors
+ if (miMono.MemberType == MemberTypes.Property)
+ {
+ PropertyInfo pi = (PropertyInfo) miMono;
+ MemberInfo miGet = pi.GetGetMethod ();
+ if (miGet != null)
+ rgIgnoreMono.Add (miGet);
+ MemberInfo miSet = pi.GetSetMethod ();
+ if (miSet != null)
+ rgIgnoreMono.Add (miSet);
+ }
+ else if (miMono.MemberType == MemberTypes.Event)
+ {
+ EventInfo ei = (EventInfo) miMono;
+ MemberInfo miAdd = ei.GetAddMethod ();
+ if (miAdd != null)
+ rgIgnoreMono.Add (miAdd);
+ MemberInfo miRemove = ei.GetRemoveMethod ();
+ if (miRemove != null)
+ rgIgnoreMono.Add (miRemove);
+ MemberInfo miRaise = ei.GetRaiseMethod ();
+ if (miRaise != null)
+ rgIgnoreMono.Add (miRaise);
+ }
+ }
+ }
+ foreach (MemberInfo miIgnore in rgIgnoreMono)
+ htMono.Remove (MissingMember.GetUniqueName (miIgnore));
+ }
+ Hashtable htMethodsMS = new Hashtable ();
+ if (typeMS != null)
+ {
+ ICollection colMembersMS = typeMS.GetMembers (BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
+ Hashtable htIgnoreMS = new Hashtable ();
+ foreach (MemberInfo miMS in colMembersMS)
+ {
+ // ignore any property/event accessors
+ if (miMS.MemberType == MemberTypes.Property)
+ {
+ PropertyInfo pi = (PropertyInfo) miMS;
+ MemberInfo miGet = pi.GetGetMethod ();
+ if (miGet != null)
+ htIgnoreMS.Add (miGet, miMS);
+ MemberInfo miSet = pi.GetSetMethod ();
+ if (miSet != null)
+ htIgnoreMS.Add (miSet, miMS);
+ }
+ else if (miMS.MemberType == MemberTypes.Event)
+ {
+ EventInfo ei = (EventInfo) miMS;
+ MemberInfo miAdd = ei.GetAddMethod ();
+ if (miAdd != null)
+ htIgnoreMS.Add (miAdd, miMS);
+ MemberInfo miRemove = ei.GetRemoveMethod ();
+ if (miRemove != null)
+ htIgnoreMS.Add (miRemove, miMS);
+ MemberInfo miRaise = ei.GetRaiseMethod ();
+ if (miRaise != null)
+ htIgnoreMS.Add (miRaise, miMS);
+ }
+ }
+ foreach (MemberInfo miMS in colMembersMS)
+ {
+ if (miMS != null && miMS.DeclaringType == typeMS && !htIgnoreMS.Contains (miMS))
+ {
+ string strNameUnique = MissingMember.GetUniqueName (miMS);
+ MemberInfo miMono = (MemberInfo) htMono [strNameUnique];
+
+ MissingMember mm = CreateMember (miMono, miMS);
+
+ bool fVisibleMS = IsVisible (miMS);
+ if (miMono == null)
+ {
+ if (fVisibleMS)
+ AddMember (mm);
+ }
+ else
+ {
+ if (miMono.MemberType != miMS.MemberType)
+ {
+ //AddMember (null, miMS);
+ //MissingMember mm2 = CreateMember (miMono, null);
+ //mm2.Status.AddWarning ("MemberType mismatch, is: '" + miMono.MemberType.ToString () + "' [should be: '" + miMS.MemberType.ToString ()+"']");
+ //AddMember (mm2);
+ mm.Status.AddWarning ("MemberType mismatch, is: '" + miMono.MemberType.ToString () + "' [should be: '" + miMS.MemberType.ToString ()+"']");
+ AddMember (mm);
+ }
+ else if (fVisibleMS || IsVisible (miMono))
+ {
+ AddMember (mm);
+ }
+
+ htMono.Remove (strNameUnique);
+ }
+
+ switch (miMS.MemberType)
+ {
+ case MemberTypes.Method:
+ {
+ string strNameMSFull = miMS.ToString ();
+ int ichMS = strNameMSFull.IndexOf (' ');
+ string strNameMS = strNameMSFull.Substring (ichMS + 1);
+ if (!htMethodsMS.Contains (strNameMS))
+ htMethodsMS.Add (strNameMSFull.Substring (ichMS + 1), miMS);
+ break;
+ }
+ }
+ }
+ }
+ }
+ foreach (MemberInfo miMono in htMono.Values)
+ {
+ if (IsVisible (miMono))
+ {
+ MissingMember mm = CreateMember (miMono, null);
+ switch (miMono.MemberType)
+ {
+ case MemberTypes.Method:
+ {
+ string strNameMonoFull = miMono.ToString ();
+ int ichMono = strNameMonoFull.IndexOf (' ');
+ string strNameMono = strNameMonoFull.Substring (ichMono + 1);
+ MemberInfo miMS = (MemberInfo) htMethodsMS [strNameMono];
+ if (miMS != null)
+ {
+ string strNameMSFull = miMS.ToString ();
+ int ichMS = strNameMSFull.IndexOf (' ');
+ string strReturnTypeMS = strNameMSFull.Substring (0, ichMS);
+ string strReturnTypeMono = strNameMonoFull.Substring (0, ichMono);
+ mm.Status.AddWarning ("Return type mismatch, is: '"+strReturnTypeMono+"' [should be: '"+strReturnTypeMS+"']");
+ //Console.WriteLine ("WARNING: Return type mismatch on "+miMS.DeclaringType.FullName+"."+strNameMono+", is: '"+strReturnTypeMono+"' [should be: '"+strReturnTypeMS+"']");
+ }
+ break;
+ }
+ }
+ AddMember (mm);
+ }
+ }
+
+ // compare the attributes
+ rgAttributes = new ArrayList ();
+ nsAttributes = MissingAttribute.AnalyzeAttributes (
+ (typeMono == null) ? null : typeMono.GetCustomAttributes (false),
+ ( typeMS == null) ? null : typeMS.GetCustomAttributes (false),
+ rgAttributes);
+
+ rgInterfaces = new ArrayList ();
+ if (typeMono != null && typeMS != null)
+ {
+ // compare base types
+ string strBaseMono = (typeMono.BaseType == null) ? null : typeMono.BaseType.FullName;
+ string strBaseMS = ( typeMS.BaseType == null) ? null : typeMS.BaseType.FullName;
+ if (strBaseMono != strBaseMS)
+ {
+ m_nodeStatus.AddWarning ("Base class mismatch, is '"+strBaseMono+"' [should be: '"+strBaseMS+"']");
+ //Console.WriteLine ("WARNING: Base class mismatch on "+typeMono.FullName+", is: '"+strBaseMono+"' [should be: '"+strBaseMS+"']");
+ }
+
+ // compare the interfaces
+ Hashtable htInterfacesMono = new Hashtable ();
+ Type [] rgInterfacesMono = typeMono.GetInterfaces ();
+ foreach (Type ifaceMono in rgInterfacesMono)
+ {
+ if (ifaceMono != null)
+ {
+ string strName = ifaceMono.FullName;
+ htInterfacesMono.Add (strName, ifaceMono);
+ }
+ }
+ Type [] rgInterfacesMS = typeMS.GetInterfaces ();
+ foreach (Type ifaceMS in rgInterfacesMS)
+ {
+ if (ifaceMS != null)
+ {
+ string strName = ifaceMS.FullName;
+ Type ifaceMono = (Type) htInterfacesMono [strName];
+ MissingInterface mi = new MissingInterface (ifaceMono, ifaceMS);
+ mi.Analyze ();
+ rgInterfaces.Add (mi);
+ if (ifaceMono != null)
+ htInterfacesMono.Remove (strName);
+ nsInterfaces.AddChildren (mi.Status);
+ }
+ }
+ foreach (Type ifaceMono in htInterfacesMono.Values)
+ {
+ MissingInterface mi = new MissingInterface (ifaceMono, null);
+ mi.Analyze ();
+ rgInterfaces.Add (mi);
+ //Console.WriteLine ("WARNING: additional interface on "+typeMono.FullName+": '"+ifaceMono.FullName+"'");
+ nsInterfaces.AddChildren (mi.Status);
+ }
+
+ // serializable attribute
+ AddFakeAttribute (typeMono.IsSerializable, typeMS.IsSerializable, "System.SerializableAttribute");
+ AddFakeAttribute (typeMono.IsAutoLayout, typeMS.IsAutoLayout, "System.AutoLayoutAttribute");
+ AddFakeAttribute (typeMono.IsExplicitLayout, typeMS.IsExplicitLayout, "System.ExplicitLayoutAttribute");
+ AddFakeAttribute (typeMono.IsLayoutSequential, typeMS.IsLayoutSequential, "System.SequentialLayoutAttribute");
+
+ Accessibility accessibilityMono = GetAccessibility (typeMono);
+ Accessibility accessibilityMS = GetAccessibility (typeMS);
+ if (accessibilityMono != accessibilityMS)
+ m_nodeStatus.AddWarning ("Should be "+AccessibilityToString (accessibilityMono));
+
+ AddFlagWarning (typeMono.IsSealed, typeMS.IsSealed, "sealed");
+ AddFlagWarning (typeMono.IsAbstract, typeMS.IsAbstract, "abstract");
+ }
+
+ // sum up the sub-sections
+ m_nodeStatus.Add (nsAttributes);
+ m_nodeStatus.Add (nsMethods);
+ m_nodeStatus.Add (nsProperties);
+ m_nodeStatus.Add (nsEvents);
+ m_nodeStatus.Add (nsFields);
+ m_nodeStatus.Add (nsConstructors);
+ m_nodeStatus.Add (nsNestedTypes);
+ m_nodeStatus.Add (nsInterfaces);
+
+ return m_nodeStatus;
+ }
+
+ static bool IsVisible (MemberInfo mi)
+ {
+ // this is just embarrasing, couldn't they have virtualized this?
+ switch (mi.MemberType)
+ {
+ case MemberTypes.Constructor:
+ case MemberTypes.Method:
+ return !((MethodBase) mi).IsPrivate && !((MethodBase) mi).IsFamilyAndAssembly && !((MethodBase) mi).IsAssembly;
+ case MemberTypes.Field:
+ return !((FieldInfo) mi).IsPrivate && !((FieldInfo) mi).IsFamilyAndAssembly && !((FieldInfo) mi).IsAssembly;
+ case MemberTypes.NestedType:
+ return !((Type) mi).IsNestedPrivate;
+ case MemberTypes.Property: // great, now we have to look at the methods
+ PropertyInfo pi = (PropertyInfo) mi;
+ MethodInfo miAccessor = pi.GetGetMethod ();
+ if (miAccessor == null)
+ miAccessor = pi.GetSetMethod ();
+ if (miAccessor == null)
+ return false;
+ return IsVisible (miAccessor);
+ case MemberTypes.Event: // ditto
+ EventInfo ei = (EventInfo) mi;
+ MethodInfo eiAccessor = ei.GetAddMethod ();
+ if (eiAccessor == null)
+ eiAccessor = ei.GetRemoveMethod ();
+ if (eiAccessor == null)
+ eiAccessor = ei.GetRaiseMethod ();
+ if (eiAccessor == null)
+ return false;
+ return IsVisible (eiAccessor);
+ default:
+ throw new Exception ("Missing handler for MemberType: "+mi.MemberType.ToString ());
+ }
+ }
+
+ static Accessibility GetAccessibility (Type type)
+ {
+ if (type.IsPublic)
+ return Accessibility.Public;
+ else if (type.IsNotPublic)
+ return Accessibility.Private;
+ return MissingMember.GetAccessibility (type);
+ }
+ }
+}
diff --git a/mcs/tools/corcompare/TODO b/mcs/tools/corcompare/TODO
new file mode 100644
index 00000000000..355c8351eab
--- /dev/null
+++ b/mcs/tools/corcompare/TODO
@@ -0,0 +1,16 @@
+TODO
+for CorCompare - 2002/02/25
+
+ * The "methods" for a property's set and get are listed in the methods
+ element. It would be cool to take them out of there and show that
+ info in the property element, like "SomeProp{ get; set; } if it's missing
+ both.
+
+ * The constructors are just listed as ".ctor" which is not very verbose.
+ What we really need here is the parameter list too, but I couldn't find
+ a way to get the parameters for constructors, only methods.
+
+ * Missing attributes on classes and members are not included at all.
+
+ * Compare other assemblies besides corlib (then change name of
+ the utility of course :) \ No newline at end of file
diff --git a/mcs/tools/corcompare/ToDoAssembly.cs b/mcs/tools/corcompare/ToDoAssembly.cs
new file mode 100644
index 00000000000..d95c0a42783
--- /dev/null
+++ b/mcs/tools/corcompare/ToDoAssembly.cs
@@ -0,0 +1,199 @@
+// Mono.Util.CorCompare.ToDoAssembly
+//
+// Author(s):
+// Nick Drochak (ndrochak@gol.com)
+//
+// (C) 2001-2002 Nick Drochak
+
+using System;
+using System.Reflection;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+namespace Mono.Util.CorCompare {
+
+ /// <summary>
+ /// Represents an assembly that has missing or MonoTODO classes
+ /// </summary>
+ /// <remarks>
+ /// created by - Nick
+ /// created on - 2/20/2002 10:43:57 PM
+ /// </remarks>
+ class ToDoAssembly : MissingBase
+ {
+ // these types are in mono corlib, but not in the dll we are going to examine.
+ ArrayList MissingTypes = new ArrayList();
+ ArrayList rgNamespaces = new ArrayList();
+ string strName;
+ Assembly assMono;
+ Assembly assMS;
+ Type [] rgTypesMono;
+ Type [] rgTypesMS;
+
+ protected static Hashtable htGhostTypes;
+ private static string[] rgstrGhostTypes = {"System.Object", "System.ValueType", "System.Delegate", "System.Enum"};
+
+
+ static ToDoAssembly ()
+ {
+ htGhostTypes = new Hashtable ();
+
+ foreach (string strGhostType in rgstrGhostTypes)
+ {
+ htGhostTypes.Add (strGhostType, null);
+ }
+ }
+
+ public static ToDoAssembly Load (string strFileMono, string strName, string strNameMS)
+ {
+ Assembly assemblyMono = Assembly.LoadFrom (strFileMono);
+ Assembly assemblyMS = Assembly.LoadWithPartialName (strNameMS);
+
+ return new ToDoAssembly (strName, assemblyMono, assemblyMS);
+ }
+
+ public ToDoAssembly (string _strName, Assembly _assMono, Assembly _assMS)
+ {
+ strName = _strName;
+ assMono = _assMono;
+ assMS = _assMS;
+
+ rgTypesMono = assMono.GetTypes ();
+ rgTypesMS = assMS.GetTypes ();
+ m_nodeStatus = new NodeStatus (_assMono, _assMS);
+ }
+
+ public override string Name {
+ get {
+ return strName;
+ }
+ }
+
+ public override string Type
+ {
+ get { return "assembly"; }
+ }
+
+ private Hashtable GetNamespaceMap (Type [] rgTypes)
+ {
+ Hashtable mapTypes = new Hashtable ();
+ foreach (Type t in rgTypes)
+ {
+ if (t != null)
+ {
+ string strName = t.FullName;
+ string strNamespace = t.Namespace;
+ if (strNamespace != null && strNamespace.Length > 0 &&
+ strName != null && strName.Length > 0 &&
+ !strNamespace.StartsWith ("Microsoft.") &&
+ !htGhostTypes.Contains (strName))
+ {
+ ArrayList rgContainedTypes = (ArrayList) mapTypes [strNamespace];
+ if (rgContainedTypes == null)
+ {
+ rgContainedTypes = new ArrayList ();
+ mapTypes [strNamespace] = rgContainedTypes;
+ }
+ rgContainedTypes.Add (t);
+ }
+ }
+ }
+ return mapTypes;
+ }
+
+ public override NodeStatus Analyze ()
+ {
+ Hashtable mapTypesMono = GetNamespaceMap (rgTypesMono);
+ Hashtable mapTypesMS = GetNamespaceMap (rgTypesMS);
+
+ foreach (string strNamespaceMS in mapTypesMS.Keys)
+ {
+ if (strNamespaceMS != null)
+ {
+ ArrayList rgContainedTypesMS = (ArrayList) mapTypesMS [strNamespaceMS];
+ ArrayList rgContainedTypesMono = (ArrayList) mapTypesMono [strNamespaceMS];
+ MissingNameSpace mns = new MissingNameSpace (strNamespaceMS, rgContainedTypesMono, rgContainedTypesMS);
+ NodeStatus nsNamespace = mns.Analyze ();
+ m_nodeStatus.AddChildren (nsNamespace);
+ if (rgTypesMono != null)
+ mapTypesMono.Remove (strNamespaceMS);
+ rgNamespaces.Add (mns);
+ }
+ }
+ foreach (string strNamespaceMono in mapTypesMono.Keys)
+ {
+ if (strNamespaceMono != null)
+ {
+ ArrayList rgContainedTypesMono = (ArrayList) mapTypesMono [strNamespaceMono];
+ MissingNameSpace mns = new MissingNameSpace (strNamespaceMono, rgContainedTypesMono, null);
+ NodeStatus nsNamespace = mns.Analyze ();
+ m_nodeStatus.AddChildren (nsNamespace);
+ rgNamespaces.Add (mns);
+ }
+ }
+
+ rgAttributes = new ArrayList ();
+ NodeStatus nsAttributes = MissingAttribute.AnalyzeAttributes (
+ assMono.GetCustomAttributes (true),
+ assMS.GetCustomAttributes (true),
+ rgAttributes);
+ m_nodeStatus.Add (nsAttributes);
+
+ return m_nodeStatus;
+ }
+
+
+ public string CreateClassListReport() {
+ Analyze ();
+ if (rgNamespaces.Count == 0) return "";
+
+ StringBuilder output = new StringBuilder();
+ foreach (MissingNameSpace ns in rgNamespaces)
+ {
+ string[] missingTypes = ns.MissingTypeNames(true);
+ if (missingTypes != null && missingTypes.Length > 0) {
+ string joinedNames = String.Join("\n", missingTypes);
+ output.Append(joinedNames + "\n");
+ }
+ }
+ return output.ToString();
+ }
+
+ public override XmlElement CreateXML (XmlDocument doc)
+ {
+ XmlElement assemblyElem = base.CreateXML (doc);
+
+ if (rgNamespaces.Count > 0)
+ {
+ XmlElement eltNamespaces = doc.CreateElement ("namespaces");
+ assemblyElem.AppendChild (eltNamespaces);
+
+ foreach (MissingNameSpace ns in rgNamespaces)
+ {
+ XmlElement eltNameSpace = ns.CreateXML (doc);
+ if (eltNameSpace != null)
+ eltNamespaces.AppendChild (eltNameSpace);
+ }
+ }
+ return assemblyElem;
+ }
+
+ public void CreateXMLReport(string filename) {
+ Analyze();
+
+ XmlDocument outDoc;
+ outDoc = new XmlDocument();
+ outDoc.AppendChild(outDoc.CreateXmlDeclaration("1.0", null, null));
+
+ XmlElement assembliesElem = outDoc.CreateElement("assemblies");
+ outDoc.AppendChild(assembliesElem);
+
+ XmlElement assemblyElem = CreateXML (outDoc);
+ assembliesElem.AppendChild(assemblyElem);
+
+ outDoc.Save(filename);
+ }
+ }
+}
diff --git a/mcs/tools/corcompare/corcompare.build b/mcs/tools/corcompare/corcompare.build
new file mode 100644
index 00000000000..111cd018363
--- /dev/null
+++ b/mcs/tools/corcompare/corcompare.build
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<project name="CorCompare" default="linux">
+ <target name="linux">
+ <csc target="exe" output="./CorCompare.exe" debug="true">
+ <sources>
+ <includes name="*.cs" />
+ </sources>
+ </csc>
+ </target>
+
+</project>
diff --git a/mcs/tools/corcompare/cormissing.xsl b/mcs/tools/corcompare/cormissing.xsl
new file mode 100644
index 00000000000..a87c396354c
--- /dev/null
+++ b/mcs/tools/corcompare/cormissing.xsl
@@ -0,0 +1,424 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:output method="html" indent="no"/>
+ <!-- <xsl:output method="xml"/>-->
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="/">
+<!--
+ <HTML>
+ <HEAD>
+ <TITLE>
+ Mono Class Library Status
+ </TITLE>
+ <SCRIPT src="cormissing.js"></SCRIPT>
+ <LINK rel="stylesheet" type="text/css" href="cormissing.css"></LINK>
+ </HEAD>
+ <BODY onLoad="onLoad();">
+ <P>
+ <H1>Mono Class Library Status</H1>
+ </P>
+-->
+ <P>
+ <TABLE>
+ <TR>
+ <TD> <INPUT type="checkbox" ID="todo" onClick="selectTodo();" checked="1"/> </TD>
+ <TD> <IMG src="cm/st.gif"/> </TD>
+ <TD> TODO </TD>
+ <TD width="20"/>
+ <TD> <INPUT type="checkbox" ID="missing" onClick="selectMissing();" checked="1"/> </TD>
+ <TD> <IMG src="cm/sm.gif"/> </TD>
+ <TD> Missing </TD>
+ </TR>
+ <TR>
+ <TD> <INPUT type="checkbox" ID="extra" onClick="selectExtra();" checked="1"/> </TD>
+ <TD> <IMG src="cm/sx.gif"/> </TD>
+ <TD> Extra </TD>
+ <TD width="20"/>
+ <TD> <INPUT type="checkbox" ID="errors" onClick="selectErrors();" checked="1"/> </TD>
+ <TD> <IMG src="cm/se.gif"/> </TD>
+ <TD> Errors </TD>
+ </TR>
+ <TR>
+ <TD> </TD>
+ <TD> <IMG src="cm/sc.gif"/> </TD>
+ <TD> Completed </TD>
+ </TR>
+ </TABLE>
+ </P>
+ <DIV ID="ROOT">
+ <xsl:apply-templates/>
+ </DIV>
+<!--
+ </BODY>
+ </HTML>
+-->
+ </xsl:template>
+
+
+
+ <!-- assembly -->
+ <xsl:template match="/assemblies">
+ <xsl:apply-templates select="assembly">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="assemblies/assembly[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">y</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+ <!-- namespace -->
+ <xsl:template match="assembly/namespaces">
+ <xsl:apply-templates select="namespace">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="namespaces/namespace[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">n</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+ <xsl:template match="namespace/classes">
+ <xsl:apply-templates select="interface">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="class">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="struct">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="delegate">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ <xsl:apply-templates select="enum">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+
+ <!-- class -->
+ <xsl:template match="classes/class[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">c</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates select="attributes"/>
+ <xsl:apply-templates select="interfaces"/>
+ <xsl:apply-templates select="constructors"/>
+ <xsl:apply-templates select="./*[local-name() != 'attributes' and local-name() != 'constructors' and local-name() != 'interfaces']"/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+ <!-- struct -->
+ <xsl:template match="classes/struct[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">s</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+
+ <!-- interface -->
+ <xsl:template match="interfaces">
+ <xsl:apply-templates select="interface">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="interface[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">i</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+ <!-- delegate -->
+ <xsl:template match="classes/delegate[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">d</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+ <!-- enumeration -->
+ <xsl:template match="classes/enum[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">en</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+ <!-- method -->
+ <xsl:template match="methods">
+ <xsl:apply-templates select="method">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="methods/method[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">m</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+ <!-- property -->
+ <xsl:template match="properties">
+ <xsl:apply-templates select="property">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="properties/property[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">p</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+ <!-- event -->
+ <xsl:template match="events">
+ <xsl:apply-templates select="event">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="events/event[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">e</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+ <!-- constructor -->
+ <xsl:template match="constructors">
+ <xsl:apply-templates select="constructor">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="constructors/constructor[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">x</xsl:with-param>
+ <xsl:with-param name="image">m</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+ <!-- field -->
+ <xsl:template match="fields">
+ <xsl:apply-templates select="field">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="fields/field[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">f</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+ <!-- accessor -->
+ <xsl:template match="property/accessors">
+ <xsl:apply-templates select="method">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="property[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]/accessors/method[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">o</xsl:with-param>
+ <xsl:with-param name="image">m</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+ <!-- attribute -->
+ <xsl:template match="attributes">
+ <xsl:apply-templates select="attribute">
+ <xsl:sort select="@name"/>
+ </xsl:apply-templates>
+ </xsl:template>
+
+ <xsl:template match="attributes/attribute[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <DIV>
+ <xsl:call-template name="ELEMENT">
+ <xsl:with-param name="class">r</xsl:with-param>
+ </xsl:call-template>
+ <xsl:if test="not(@presence)">
+ <xsl:apply-templates/>
+ </xsl:if>
+ </DIV>
+ </xsl:template>
+
+
+
+ <!-- support templates -->
+
+ <xsl:template name="ELEMENT">
+ <xsl:param name="class"/>
+ <xsl:param name="image"/>
+ <xsl:attribute name="class">
+ <xsl:value-of select="$class"/>
+ <xsl:if test="./node() and local-name() != 'assembly'">_</xsl:if>
+ </xsl:attribute>
+ <xsl:call-template name="toggle"/>
+ <xsl:choose>
+ <xsl:when test="@error != 'todo'">
+ <xsl:element name="img">
+ <xsl:attribute name="src">cm/se.gif</xsl:attribute>
+ <xsl:attribute name="class">t</xsl:attribute>
+ <xsl:attribute name="title"><xsl:apply-templates select="warnings/warning" mode="hover"/></xsl:attribute>
+ </xsl:element>
+ </xsl:when>
+ <xsl:when test="@error = 'todo'">
+ <img src="cm/st.gif" class="t"/>
+ </xsl:when>
+ <xsl:when test="@presence = 'missing'">
+ <img src="cm/sm.gif" class="t"/>
+ </xsl:when>
+ <xsl:when test="@presence = 'extra'">
+ <img src="cm/sx.gif" class="t"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <img src="cm/sc.gif" class="t"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="$image">
+ <img src="cm/{$image}.gif" class="t"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <img src="cm/{$class}.gif" class="t"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:call-template name="name"/>
+ <xsl:if test="not(@presence)">
+ <xsl:call-template name="status"/>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="status">
+ <xsl:if test="@complete and @complete != 0">
+ <SPAN class="st">
+ <img src="cm/sc.gif"/>: <xsl:value-of select="@complete"/>%
+ </SPAN>
+ </xsl:if>
+ <xsl:if test="@todo_total">
+ <SPAN class="st">
+ <img src="cm/st.gif"/>: <xsl:value-of select="@todo_total"/>
+ </SPAN>
+ </xsl:if>
+ <xsl:if test="@missing_total">
+ <SPAN class="st">
+ <img src="cm/sm.gif"/>: <xsl:value-of select="@missing_total"/>
+ </SPAN>
+ </xsl:if>
+ <xsl:if test="@extra_total">
+ <SPAN class="st">
+ <img src="cm/sx.gif"/>: <xsl:value-of select="@extra_total"/>
+ </SPAN>
+ </xsl:if>
+ <xsl:if test="@warning_total">
+ <SPAN class="st">
+ <img src="cm/se.gif"/>: <xsl:value-of select="@warning_total"/>
+ </SPAN>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template name="toggle">
+ <xsl:choose>
+ <xsl:when test="not(@presence) and .//*[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence] and local-name() != 'assembly'">
+ <IMG src="cm/tp.gif" class="t"/>
+ </xsl:when>
+ <xsl:when test="not(@presence) and .//*[@missing_total or @todo_total or @extra_total or @warning_total or @error or @presence]">
+ <IMG src="cm/tm.gif" class="t"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <IMG src="cm/tb.gif"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="name">
+ <xsl:if test="@name">
+ <SPAN class="l"><xsl:value-of select="@name"/></SPAN>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="warnings/warning" mode="hover"> WARNING: <xsl:value-of select="@text"/>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/mcs/tools/corcompare/transform.js b/mcs/tools/corcompare/transform.js
new file mode 100644
index 00000000000..9b23b3f6dea
--- /dev/null
+++ b/mcs/tools/corcompare/transform.js
@@ -0,0 +1,11 @@
+var xml = WScript.CreateObject ("MSXML2.DOMDocument");
+var xsl = WScript.CreateObject ("MSXML2.DOMDocument");
+
+xml.async = false;
+xsl.async = false;
+
+xml.load (WScript.Arguments (0));
+xsl.load (WScript.Arguments (1));
+
+WScript.Echo (xml.transformNode (xsl));
+
diff --git a/mcs/tools/ictool/Makefile b/mcs/tools/ictool/Makefile
new file mode 100644
index 00000000000..27fae41ae61
--- /dev/null
+++ b/mcs/tools/ictool/Makefile
@@ -0,0 +1,10 @@
+CSC=csc.exe
+CSCFLAGS=/nologo /debug+ /debug:full
+
+all: ictool.exe
+
+ictool.exe: ictool.cs depgraph.cs peer.cs
+ $(CSC) $(CSCFLAGS) /out:ictool.exe ictool.cs depgraph.cs peer.cs
+
+clean:
+ rm -f *.exe *.pdb *.dll
diff --git a/mcs/tools/ictool/depgraph.cs b/mcs/tools/ictool/depgraph.cs
new file mode 100644
index 00000000000..57e96ff3e9c
--- /dev/null
+++ b/mcs/tools/ictool/depgraph.cs
@@ -0,0 +1,69 @@
+//
+// file: depgraph.cs
+// author: Dan Lewis (dihlewis@yahoo.co.uk)
+// (C) 2002
+//
+
+using System;
+using System.Collections;
+
+class DependencyGraph {
+ public DependencyGraph () {
+ nodes = new Hashtable ();
+ }
+
+ public void AddNode (object o) {
+ if (!nodes.Contains (o))
+ nodes.Add (o, new Node (o));
+ }
+
+ public void AddEdge (object from, object to) {
+ if (!nodes.Contains (from))
+ AddNode (from);
+ if (!nodes.Contains (to))
+ AddNode (from);
+
+ Node from_node = (Node)nodes[from];
+ Node to_node = (Node)nodes[to];
+
+ from_node.edges.Add (to_node);
+ }
+
+ public IList TopologicalSort () {
+ foreach (Node node in nodes.Values)
+ node.marked = false;
+
+ IList list = new ArrayList ();
+ foreach (Node node in nodes.Values) {
+ if (!node.marked)
+ Visit (node, list);
+ }
+
+ return list;
+ }
+
+ // private
+
+ private void Visit (Node node, IList list) {
+ node.marked = true;
+ foreach (Node adj in node.edges) {
+ if (!adj.marked)
+ Visit (adj, list);
+ }
+
+ list.Insert (0, node.value);
+ }
+
+ private class Node {
+ public Node (object o) {
+ this.value = o;
+ this.edges = new ArrayList ();
+ }
+
+ public object value;
+ public ArrayList edges;
+ public bool marked;
+ }
+
+ private Hashtable nodes;
+}
diff --git a/mcs/tools/ictool/ictool-config.xml b/mcs/tools/ictool/ictool-config.xml
new file mode 100644
index 00000000000..9716dc6ee04
--- /dev/null
+++ b/mcs/tools/ictool/ictool-config.xml
@@ -0,0 +1,105 @@
+<config>
+ <!-- assembly inputs -->
+
+ <assemblypath path="..\..\class\lib"/>
+
+ <assembly file="corlib_cmp.dll"/>
+ <assembly file="System.dll"/>
+
+ <!-- output files -->
+
+ <outputpath path="."/>
+
+ <outputfile name="types" file="icall_types.h">
+ <include><![CDATA[#include "icall.h"]]></include>
+ </outputfile>
+
+ <outputfile name="methods" file="icall_methods.h"/>
+ <outputfile name="map" file="icall_map.c"/>
+
+ <!-- typemap -->
+
+ <typemap>
+ <!-- base types -->
+
+ <namespace name="System">
+
+ <!-- default types are taken from the running assembly -->
+
+ <type name="Object" peer="MonoObject" opaque="true" default="true"/>
+
+ <type name="Void" peer="void" opaque="true" default="true"/>
+ <type name="Boolean" peer="MonoBoolean" opaque="true" default="true"/>
+ <type name="Int64" peer="gint64" opaque="true" default="true"/>
+ <type name="Int32" peer="gint32" opaque="true" default="true"/>
+ <type name="Int16" peer="gint16" opaque="true" default="true"/>
+ <type name="Byte" peer="gint8" opaque="true" default="true"/>
+ <type name="UInt64" peer="guint64" opaque="true" default="true"/>
+ <type name="UInt32" peer="guint32" opaque="true" default="true"/>
+ <type name="UInt16" peer="guint16" opaque="true" default="true"/>
+ <type name="SByte" peer="guint8" opaque="true" default="true"/>
+ <type name="IntPtr" peer="gpointer" opaque="true" default="true"/>
+ <type name="UIntPtr" peer="gpointer" opaque="true" default="true"/>
+ <type name="Single" peer="gfloat" opaque="true" default="true"/>
+ <type name="Double" peer="gdouble" opaque="true" default="true"/>
+ <type name="Char" peer="gunichar2" opaque="true" default="true"/>
+ <type name="Array" peer="MonoArray" opaque="true" default="true"/>
+
+ <!-- non-defaulting system types -->
+
+ <type name="Decimal" peer="decimal_repr" opaque="true"/>
+ <type name="String" peer="MonoString" opaque="true"/>
+
+ </namespace>
+
+ <!-- reflection types -->
+
+ <namespace name="System">
+ <type name="RuntimeTypeHandle" peer="MonoType *" opaque="true"/>
+ <type name="RuntimeMethodHandle" peer="MonoMethod *" opaque="true"/>
+ <type name="RuntimeFieldHandle" peer="MonoClassField *" opaque="true"/>
+
+ <type name="Type" peer="MonoReflectionType"/>
+ <type name="MonoTypeInfo" peer="MonoTypeInfo"/>
+ <type name="MonoEnumInfo" peer="MonoEnumInfo"/>
+ </namespace>
+
+ <namespace name="System.Reflection">
+ <type name="MonoMethod" peer="MonoReflectionMethod"/>
+ <type name="MonoField" peer="MonoReflectionField"/>
+ <type name="MonoFieldInfo" peer="MonoFieldInfo"/>
+ <type name="MonoProperty" peer="MonoReflectionProperty"/>
+ <type name="ParameterInfo" peer="MonoParameterInfo"/>
+ <type name="MonoMethodInfo" peer="MonoMethodInfo"/>
+ <type name="MonoPropertyInfo" peer="MonoPropertyInfo"/>
+ <type name="Assembly" peer="MonoReflectionAssembly"/>
+ <type name="Module" peer="MonoReflectionModule"/>
+ <type name="AssemblyName" peer="MonoReflectionAssemblyName"/>
+ </namespace>
+
+ <namespace name="System.Reflection.Emit">
+ <type name="ILGenerator" peer="MonoReflectionILGen"/>
+ <type name="ILExceptionInfo" peer="MonoILExceptionInfo"/>
+ <type name="ILExceptionBlock" peer="MonoILExceptionBlock"/>
+ <type name="LocalBuilder" peer="MonoReflectionLocalBuilder"/>
+ <type name="ParameterBuilder" peer="MonoReflectionParamBuilder"/>
+ <type name="ConstructorBuilder" peer="MonoReflectionCtorBuilder"/>
+ <type name="MethodBuilder" peer="MonoReflectionMethodBuilder"/>
+ <type name="FieldBuilder" peer="MonoReflectionFieldBuilder"/>
+ <type name="PropertyBuilder" peer="MonoReflectionPropertyBuilder"/>
+ <type name="ModuleBuilder" peer="MonoReflectionModuleBuilder"/>
+ <type name="TypeBuilder" peer="MonoReflectionTypeBuilder"/>
+ <type name="Label" peer="MonoReflectionLabel"/>
+ </namespace>
+
+ <!-- enumerations -->
+
+ <namespace name="System.Net.Sockets">
+ <type name="SocketType" peer="MonoSocketType"/>
+ <type name="AddressFamily" peer="MonoAddressFamily"/>
+ <type name="ProtocolType" peer="MonoProtocolType"/>
+ <type name="SocketOptionLevel" peer="MonoSocketOptionLevel"/>
+ <type name="SocketOptionName" peer="MonoSocketOptionName"/>
+ </namespace>
+ </typemap>
+</config>
diff --git a/mcs/tools/ictool/ictool.cs b/mcs/tools/ictool/ictool.cs
new file mode 100644
index 00000000000..9b4e0dd4472
--- /dev/null
+++ b/mcs/tools/ictool/ictool.cs
@@ -0,0 +1,428 @@
+//
+// file: ictool.cs
+// author: Dan Lewis (dihlewis@yahoo.co.uk)
+// (C) 2002
+//
+// description:
+//
+// Tool for generating C prototypes and structures suitable for use by the runtime
+// from a list of supplied assemblies. See ictool-config.xml for configuration details.
+//
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Reflection;
+using System.Collections;
+
+public class ICTool {
+ public static void Main (string[] args) {
+ string filename = "ictool-config.xml";
+ if (args.Length == 1) {
+ filename = args[0];
+ }
+ else if (args.Length > 1) {
+ Console.Error.WriteLine ("Usage: ictool.exe [config.xml]");
+ Environment.Exit (-1);
+ }
+
+ try {
+ Stream config = File.OpenRead (filename);
+ Configure (config);
+ }
+ catch (Exception e) {
+ Console.Error.WriteLine ("Error: could not read configuration file.");
+ Console.Error.WriteLine (e);
+ Environment.Exit (-1);
+ }
+
+ EmitPrototypes ();
+ EmitStructures ();
+ }
+
+ // private
+
+ private static void EmitPrototypes () {
+ StreamWriter methods_file = GetOutputFile ("methods");
+ StreamWriter map_file = GetOutputFile ("map");
+
+ // includes
+
+ methods_file.WriteLine ("#include \"{0}\"\n", output_files["types"]);
+ map_file.WriteLine ("#include \"{0}\"\n", output_files["methods"]);
+
+ map_file.Write (
+ "static gpointer icall_map [] = {\n\t"
+ );
+
+ ArrayList map_lines = new ArrayList ();
+
+ BindingFlags binding =
+ BindingFlags.DeclaredOnly |
+ BindingFlags.Instance |
+ BindingFlags.Static |
+ BindingFlags.Public |
+ BindingFlags.NonPublic;
+
+ foreach (Type type in types.Values) {
+ bool has_icall = false;
+ MethodInfo[] methods = type.GetMethods (binding);
+
+ foreach (MethodInfo method in methods) {
+ if (IsInternalCall (method)) {
+ has_icall = true;
+ break;
+ }
+ }
+
+ if (!has_icall)
+ continue;
+
+ methods_file.WriteLine ("\n/* {0} */\n", type.FullName);
+ //map_lines.Add (String.Format ("\n/* {0} */\n", type.FullName));
+
+ foreach (MethodInfo method in methods) {
+ if (!IsInternalCall (method))
+ continue;
+
+ // function name
+
+ string func_name = String.Format ("ves_icall_{0}_{1}",
+
+ type.FullName,
+ method.Name
+ );
+
+ func_name = func_name.Replace ('.', '_');
+
+ // map file
+
+ map_lines.Add (String.Format (
+ "\"{0}::{1}\", {2}",
+
+ type.FullName.Replace ('.', '_'),
+ method.Name,
+ func_name
+ ));
+
+ // methods file
+
+ ArrayList args = new ArrayList ();
+
+ // FIXME: return types that are structs need to be inserted
+ // into the argument list as a destination pointer
+
+ // object/value instance pointer
+
+ if (IsInstanceMethod (method)) {
+ args.Add (String.Format (
+ "{0}{1}",
+
+ peer_map.GetPeer (method.DeclaringType).GetTypedef (1),
+ "this"
+ ));
+ }
+
+ // arguments
+
+ foreach (ParameterInfo param in method.GetParameters ()) {
+ Type arg_type = param.ParameterType;
+
+ int refs = 0;
+ if (arg_type.IsByRef) {
+ arg_type = arg_type.GetElementType ();
+ ++ refs;
+ }
+
+ Peer arg_peer = peer_map.GetPeer (arg_type);
+ if (!arg_peer.IsValueType)
+ ++ refs;
+
+ args.Add (String.Format ("{0}{1}", arg_peer.GetTypedef (refs), param.Name));
+ }
+
+ Peer ret = peer_map.GetPeer (method.ReturnType);
+ methods_file.WriteLine ("static {0}", ret.GetTypedef (ret.IsValueType ? 0 : 1));
+ methods_file.WriteLine ("{0} ({1});",
+
+ func_name,
+ Join (", ", args)
+ );
+ methods_file.WriteLine ();
+ }
+
+ }
+
+ methods_file.Close ();
+
+ // write map file and close it
+
+ map_file.Write (
+ "{0}\n}};\n", Join (",\n\t", map_lines)
+ );
+
+ map_file.Close ();
+ }
+
+ private static bool IsInternalCall (MethodInfo meth) {
+ return (meth.GetMethodImplementationFlags () & MethodImplAttributes.InternalCall) != 0;
+ }
+
+ private static bool IsInstanceMethod (MethodInfo meth) {
+ return (meth.CallingConvention & CallingConventions.HasThis) != 0;
+ }
+
+ private static void EmitStructures () {
+ StreamWriter file = GetOutputFile ("types");
+
+ // build dependency graph
+
+ DependencyGraph dg = new DependencyGraph ();
+ foreach (Peer peer in peer_map.Peers) {
+ dg.AddNode (peer);
+
+ // peer depends on nearest base
+
+ if (peer.NearestBase != null)
+ dg.AddEdge (peer.NearestBase, peer);
+
+ // peer depends on any value types used for fields
+
+ foreach (PeerField field in peer.Fields) {
+ if (field.Peer.IsValueType)
+ dg.AddEdge (field.Peer, peer);
+ }
+ }
+
+ // write structures in order
+
+ foreach (Peer peer in dg.TopologicalSort ()) {
+ if (peer.IsOpaque)
+ continue;
+
+ if (peer.IsEnum) {
+ file.WriteLine ("typedef {0} {1};", peer.UnderlyingPeer.Name, peer.Name);
+ file.WriteLine ("enum _{0} {{", peer.Name);
+
+ ArrayList enum_lines = new ArrayList ();
+ foreach (string name in peer.EnumConstants.Keys) {
+ enum_lines.Add (String.Format ("\t{0}_{1} = {2}",
+ peer.Name,
+ name,
+ peer.EnumConstants[name]
+ ));
+ }
+
+ file.WriteLine ("{0}\n}};\n", Join (",\n", enum_lines));
+ }
+ else {
+ file.WriteLine ("typedef struct _{0} {{", peer.Name);
+
+ // base type
+
+ if (peer.NearestBase != null) {
+ file.WriteLine ("\t{0} __base;", peer.NearestBase.Name);
+ file.WriteLine ();
+ }
+
+ // fields
+
+ foreach (PeerField field in peer.Fields) {
+ bool use_struct = true;
+ if (field.Peer.IsValueType || field.Peer.IsOpaque)
+ use_struct = false;
+
+ file.WriteLine ("\t{0}{1}{2};",
+ use_struct ? "struct _" : "",
+ field.Peer.GetTypedef (field.Peer.IsValueType ? 0 : 1),
+ field.Name
+ );
+ }
+
+ file.WriteLine ("}} {0};\n", peer.Name);
+ }
+ }
+ }
+
+ private static void LoadAssemblies () {
+ types = new Hashtable ();
+
+ foreach (string filename in assemblies) {
+ Assembly assembly;
+
+ // find assembly
+
+ FileInfo info = null;
+ foreach (string path in assembly_paths) {
+ info = new FileInfo (Path.Combine (path, filename));
+ if (info.Exists)
+ break;
+ }
+
+ if (!info.Exists) {
+ Console.Error.WriteLine ("Error: assembly {0} not found.", filename);
+ Environment.Exit (-1);
+ }
+
+ // load assembly
+
+ assembly = Assembly.LoadFrom (info.FullName);
+
+ // load types
+
+ ArrayList loaded_types;
+
+ try {
+ loaded_types = new ArrayList (assembly.GetTypes ());
+ }
+ catch (ReflectionTypeLoadException e) {
+ loaded_types = new ArrayList ();
+ foreach (Type type in e.Types) {
+ if (type != null)
+ loaded_types.Add (type);
+ }
+
+ foreach (Exception f in e.LoaderExceptions) {
+ if (f is TypeLoadException) {
+ Console.Error.WriteLine ("Warning: {0} could not be loaded from assembly {1}.",
+ ((TypeLoadException)f).TypeName,
+ filename
+ );
+ }
+ else
+ Console.Error.WriteLine (f);
+ }
+ }
+
+ // add to type dictionary
+
+ foreach (Type type in loaded_types) {
+ if (!types.Contains (type.FullName))
+ types.Add (type.FullName, type);
+ }
+ }
+ }
+
+ private static void Configure (Stream input) {
+ XmlDocument doc = new XmlDocument ();
+ doc.Load (input);
+
+ // assemblies
+
+ assembly_paths = new ArrayList ();
+ assembly_paths.Add (".");
+
+ foreach (XmlNode node in doc.SelectNodes ("config/assemblypath")) {
+ assembly_paths.Add (node.Attributes["path"].Value);
+ }
+
+ assemblies = new ArrayList ();
+ foreach (XmlNode node in doc.SelectNodes ("config/assembly")) {
+ assemblies.Add (node.Attributes["file"].Value);
+ }
+
+ LoadAssemblies ();
+
+ // outputfiles
+
+ output_path = ".";
+ XmlNode path_node = doc.SelectSingleNode ("config/outputpath");
+ if (path_node != null)
+ output_path = path_node.Attributes["path"].Value;
+
+ output_files = new Hashtable ();
+ output_includes = new Hashtable ();
+ foreach (XmlNode node in doc.SelectNodes ("config/outputfile")) {
+ string name = node.Attributes["name"].Value;
+ output_files.Add (name, node.Attributes["file"].Value);
+
+ foreach (XmlNode child in node.ChildNodes) {
+ if (child.Name == "include")
+ output_includes[name] = child.InnerText;
+ }
+ }
+
+ // typemap
+
+ peer_map = new PeerMap ();
+ foreach (XmlNode node in doc.SelectNodes ("config/typemap/namespace")) {
+ string ns = node.Attributes["name"].Value;
+
+ foreach (XmlNode child in node.ChildNodes) {
+ if (child.Name == "type") {
+ string name = child.Attributes["name"].Value;
+ string peer_name = child.Attributes["peer"].Value;
+
+ bool opaque = false;
+ if (child.Attributes["opaque"] != null && child.Attributes["opaque"].Value == "true")
+ opaque = true;
+
+ String fullname = String.Format ("{0}.{1}", ns, name);
+
+ Type type;
+ if (child.Attributes["default"] != null && child.Attributes["default"].Value == "true")
+ type = Type.GetType (fullname);
+ else
+ type = (Type)types [fullname];
+
+ if (type != null)
+ peer_map.Add (new Peer (type, peer_name, opaque));
+ }
+ }
+ }
+
+ peer_map.ResolvePeers ();
+ }
+
+ private static StreamWriter GetOutputFile (string name) {
+ string filename = Path.Combine (output_path, (string)output_files[name]);
+ StreamWriter file = File.CreateText (filename);
+ file.AutoFlush = true;
+
+ file.Write (
+
+// (verbatim string)
+
+@"/**
+ * {0}
+ *
+ * This file was automatically generated on {1} by ictool.exe from
+ * the following assemblies:
+ * {2}
+ */
+
+",
+
+ output_files[name],
+ DateTime.Now.ToString ("d"),
+ Join (", ", assemblies)
+ );
+
+ if (output_includes.Contains (name)) {
+ file.WriteLine (output_includes [name]);
+ file.WriteLine ();
+ }
+
+ return file;
+ }
+
+ private static string Join (string separator, ICollection values) {
+ // note to microsoft: please implement this in String :)
+
+ string[] strs = new string[values.Count];
+
+ int i = 0;
+ foreach (object value in values)
+ strs[i ++] = value.ToString ();
+
+ return String.Join (separator, strs);
+ }
+
+ private static ArrayList assembly_paths;
+ private static ArrayList assemblies;
+ private static string output_path;
+ private static Hashtable output_files;
+ private static Hashtable output_includes;
+ private static PeerMap peer_map;
+ private static Hashtable types;
+}
diff --git a/mcs/tools/ictool/peer.cs b/mcs/tools/ictool/peer.cs
new file mode 100644
index 00000000000..6c3e0998f41
--- /dev/null
+++ b/mcs/tools/ictool/peer.cs
@@ -0,0 +1,284 @@
+//
+// file: peer.cs
+// author: Dan Lewis (dihlewis@yahoo.co.uk)
+// (C) 2002
+//
+
+using System;
+using System.Reflection;
+using System.Collections;
+
+class Peer {
+ public Peer (Type clr_type, string name, bool is_opaque) {
+ this.clr_type = clr_type;
+ this.name = name;
+ this.is_opaque = is_opaque;
+
+ this.nearest_base = null; // resolve later
+ this.underlying = null;
+ this.enum_constants = null;
+ this.fields = new PeerFieldCollection ();
+
+ this.is_enum = CLRIsEnum (clr_type);
+ this.is_value_type = CLRIsValueType (clr_type);
+ }
+
+ public string Name {
+ get { return name; }
+ }
+
+ public Type CLRType {
+ get { return clr_type; }
+ }
+
+ public bool IsOpaque {
+ get { return is_opaque; }
+ }
+
+ public bool IsValueType {
+ get { return is_value_type; }
+ }
+
+ public bool IsEnum {
+ get { return is_enum; }
+ }
+
+ public Peer NearestBase {
+ get { return nearest_base; }
+ set { nearest_base = value; }
+ }
+
+ public Peer UnderlyingPeer {
+ get { return underlying; }
+ set { underlying = value; }
+ }
+
+ public IDictionary EnumConstants {
+ get { return enum_constants; }
+ set { enum_constants = value; }
+ }
+
+ public PeerFieldCollection Fields {
+ get { return fields; }
+ }
+
+ public string GetTypedef (int refs) {
+ if (refs == 0)
+ return String.Format ("{0} ", name);
+
+ return String.Format ("{0} {1}", name, new string ('*', refs));
+ }
+
+ // internal
+
+ internal static bool CLRIsValueType (Type clr_type) {
+ return clr_type.IsValueType;
+ /*
+ if (clr_type.BaseType == null)
+ return false;
+
+ return
+ clr_type.BaseType.FullName == "System.ValueType" ||
+ clr_type.BaseType.FullName == "System.Enum";
+ */
+ }
+
+ internal static bool CLRIsEnum (Type clr_type) {
+ return clr_type.IsEnum;
+ /*
+ if (clr_type.BaseType == null)
+ return false;
+
+ return clr_type.BaseType.FullName == "System.Enum";
+ */
+ }
+
+ internal static Type CLRUnderlyingType (Type clr_type) {
+ return Enum.GetUnderlyingType (clr_type);
+ /*
+ Type ebase = type.BaseType;
+
+ return (Type)ebase.InvokeMember ("GetUnderlyingType",
+ BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Static,
+ null, null,
+ new object[] { type }
+ );
+ */
+ }
+
+ // private
+
+ private Type clr_type;
+ private bool is_opaque;
+ private bool is_value_type;
+ private bool is_enum;
+
+ private string name;
+ private Peer nearest_base;
+ private Peer underlying;
+ private IDictionary enum_constants;
+ private PeerFieldCollection fields;
+}
+
+class PeerField {
+ public PeerField (Peer peer, string name) {
+ this.peer = peer;
+ this.name = name;
+ }
+
+ public Peer Peer {
+ get { return peer; }
+ }
+
+ public string Name {
+ get { return name; }
+ }
+
+ private Peer peer;
+ private string name;
+}
+
+class PeerFieldCollection : CollectionBase {
+ public void Add (PeerField f) {
+ List.Add (f);
+ }
+
+ public PeerField this[int i] {
+ get { return (PeerField)List[i]; }
+ }
+}
+
+class PeerMap {
+ public PeerMap () {
+ peers = new Hashtable ();
+ }
+
+ public void Add (Peer peer) {
+ Add (peer.CLRType, peer);
+ }
+
+ public void Add (Type clr_type, Peer peer) {
+ peers.Add (clr_type, peer);
+ }
+
+ public ICollection Peers {
+ get { return peers.Values; }
+ }
+
+ public Peer this[Type clr_type] {
+ get {
+ if (peers.Contains (clr_type))
+ return (Peer)peers[clr_type];
+
+ return null;
+ }
+ }
+
+ public Peer GetPeer (Type clr_type) {
+ Peer peer;
+
+ if (Peer.CLRIsValueType (clr_type)) {
+ peer = this[clr_type];
+ if (peer != null)
+ return peer;
+
+ if (Peer.CLRIsEnum (clr_type)) {
+ peer = this[Peer.CLRUnderlyingType (clr_type)];
+ if (peer != null)
+ return peer;
+
+ throw new ArgumentException ("Could not find peer or underlying peer for enum " + clr_type);
+ }
+ else
+ throw new ArgumentException ("Could not find peer for value type " + clr_type);
+ }
+ else {
+ Type type = clr_type;
+ while (type != null) {
+ peer = this[type];
+ if (peer != null)
+ return peer;
+
+ type = type.BaseType;
+ }
+
+ throw new ArgumentException ("Could not find peer for class " + clr_type);
+ }
+ }
+
+ public void ResolvePeers () {
+ BindingFlags binding =
+ BindingFlags.DeclaredOnly |
+ BindingFlags.Instance |
+ BindingFlags.NonPublic |
+ BindingFlags.Public;
+
+ // base type
+
+ foreach (Peer peer in Peers) {
+ if (peer.IsOpaque || peer.IsValueType || peer.CLRType.BaseType == null)
+ continue;
+
+ peer.NearestBase = GetPeer (peer.CLRType.BaseType);
+ if (peer.NearestBase == null) {
+ Console.Error.WriteLine ("Error: cannot find an internal base type for {0}.", peer.Name);
+ Environment.Exit (-1);
+ }
+ }
+
+ // fields
+
+ foreach (Peer peer in Peers) {
+ if (peer.IsOpaque || peer.IsEnum)
+ continue;
+
+ Type clr_base = null;
+ if (peer.NearestBase != null)
+ clr_base = peer.NearestBase.CLRType;
+
+ Stack declared = new Stack ();
+ Type type = peer.CLRType;
+
+ while (type != clr_base) {
+ declared.Push (type);
+ type = type.BaseType;
+ }
+
+ // build declared field list
+
+ while (declared.Count > 0) {
+ type = (Type)declared.Pop ();
+ foreach (FieldInfo info in type.GetFields (binding)) {
+ PeerField field = new PeerField (
+ GetPeer (info.FieldType),
+ info.Name
+ );
+
+ peer.Fields.Add (field);
+ }
+ }
+ }
+
+ // enums
+
+ foreach (Peer peer in Peers) {
+ if (peer.IsOpaque || !peer.IsEnum)
+ continue;
+
+ Type clr_type = peer.CLRType;
+
+ // constants
+
+ Hashtable constants = new Hashtable ();
+ foreach (string name in Enum.GetNames (clr_type))
+ constants.Add (name, (int)Enum.Parse (clr_type, name));
+
+ peer.UnderlyingPeer = GetPeer (Enum.GetUnderlyingType (clr_type));
+ peer.EnumConstants = constants;
+ }
+ }
+
+ // private
+
+ private Hashtable peers;
+}
diff --git a/mcs/tools/makefile b/mcs/tools/makefile
new file mode 100644
index 00000000000..79791c49c0a
--- /dev/null
+++ b/mcs/tools/makefile
@@ -0,0 +1,45 @@
+CSC=csc.exe
+CSCRIPT=$(WINDIR)/system32/cscript.exe
+CSCFLAGS=/nologo /debug+ /debug:full
+
+windows: linux
+
+linux: monostyle.exe verifier.exe GenerateDelegate.exe EnumCheck.exe IFaceDisco.exe ./corcompare/CorCompare.exe
+#linux: verifier.exe GenerateDelegate.exe EnumCheck.exe IFaceDisco.exe ./corcompare/CorCompare.exe update
+
+monostyle.exe: monostyle.cs
+ $(CSC) $(CSCFLAGS) monostyle.cs
+
+GenerateDelegate.exe: GenerateDelegate.cs
+ $(CSC) $(CSCFLAGS) /out:$@ $<
+
+verifier.exe: verifier.cs
+ $(CSC) $(CSCFLAGS) verifier.cs
+
+./corcompare/CorCompare.exe: dummy
+ (cd corcompare; make CorCompare.exe)
+
+update: ../../mono/doc/pending-classes
+
+cormissing.xml: ./corcompare/CorCompare.exe ../class/lib/corlib_cmp.dll
+ ./corcompare/CorCompare.exe -x cormissing.xml -f corlib -ms mscorlib ../class/lib/corlib_cmp.dll
+
+../../mono/doc/pending-classes: ./corcompare/cormissing.xsl cormissing.xml
+ $(CSCRIPT) /nologo ./corcompare/transform.js cormissing.xml ./corcompare/cormissing.xsl > ../../mono/doc/pending-classes
+
+
+EnumCheck: EnumCheck.exe
+
+EnumCheck.exe: EnumCheck.cs EnumCheckAssemblyCollection.cs
+ $(CSC) $(CSCFLAGS) /out:EnumCheck.exe EnumCheck.cs EnumCheckAssemblyCollection.cs
+
+IFaceDisco.exe: IFaceDisco.cs XMLUtil.cs
+ $(CSC) $(CSCFLAGS) /out:IFaceDisco.exe IFaceDisco.cs XMLUtil.cs
+
+clean:
+ (cd corcompare; make clean)
+ rm -f *.exe *.pdb *.dll
+ rm -f cormissing.xml
+ rm -f ../../mono/doc/pending-classes.in
+
+dummy:
diff --git a/mcs/tools/monostyle.cs b/mcs/tools/monostyle.cs
new file mode 100644
index 00000000000..930700b130e
--- /dev/null
+++ b/mcs/tools/monostyle.cs
@@ -0,0 +1,366 @@
+// monostyle.cs
+//
+// Adam Treat (manyoso@yahoo.com)
+// (C) 2002 Adam Treat
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+
+using System;
+using System.IO;
+using System.Text.RegularExpressions;
+using System.Collections.Specialized;
+
+namespace Mono.Util {
+
+ class MonoStyle {
+
+ string file;
+ StringCollection filebuffer;
+ bool linespace = true;
+
+ void Usage()
+ {
+ Console.Write (
+ "monostyle -f file.cs -l <true|false> > output.cs\n\n" +
+ " -f || /-f || --file file.cs The csharp source file to parse.\n\n" +
+ " -l || /-l || --line <true|false> Specifies wether to use line spacing.\n\n");
+ }
+
+ public static void Main (string[] args)
+ {
+ MonoStyle style = new MonoStyle(args);
+ }
+
+ public MonoStyle (string[] args)
+ {
+ int argc = args.Length;
+ for(int i = 0; i < argc; i++) {
+ string arg = args[i];
+ // The "/" switch is there for wine users, like me ;-)
+ if(arg.StartsWith("-") || arg.StartsWith("/")) {
+ switch(arg) {
+ case "-l": case "/-l": case "--line":
+ if((i + 1) >= argc) {
+ Usage();
+ return;
+ }
+ if (args[i++] == "false") {
+ linespace = false;
+ }
+ continue;
+ case "-f": case "/-f": case "--file":
+ if((i + 1) >= argc) {
+ Usage();
+ return;
+ }
+ file = args[++i];
+ continue;
+ default:
+ Usage();
+ return;
+ }
+ }
+ }
+ if(file == null) {
+ Usage();
+ return;
+ }
+ filebuffer = new StringCollection();
+ StreamReader sr = new StreamReader(file);
+ FillBuffer(sr);
+ FixMonoStyle();
+ PrintToConsole();
+ }
+
+ public void FillBuffer(StreamReader sr)
+ {
+ sr.BaseStream.Seek(0, SeekOrigin.Begin);
+ while (sr.Peek() > -1) {
+ filebuffer.Add(sr.ReadLine());
+ }
+ sr.Close();
+ }
+
+ public void FixMonoStyle()
+ {
+ for (int i=0; i < filebuffer.Count; i++) {
+ IsBadMonoStyle(filebuffer[i]);
+ }
+ }
+
+ public void PrintToConsole()
+ {
+ for (int i=0; i < filebuffer.Count; i++) {
+ Console.WriteLine(filebuffer[i]);
+ }
+ }
+
+ public void IsBadMonoStyle(String str)
+ {
+ if (IsBadMonoType(str)) {
+ FixHangingBrace(str);
+ } else if(IsBadMonoFlow(str)) {
+ FixHangingBrace(str);
+ } else if(IsBadMonoFunction(str)) {
+ FixEndBrace(str);
+ } else if(IsBadMonoProperty(str)) {
+ FixHangingBrace(str);
+ } else {
+ }
+ }
+
+ public void FixHangingBrace(String str)
+ {
+ int strloc = filebuffer.IndexOf(str);
+ int brcloc = FindHangingBrace(strloc);
+ int diff = brcloc - strloc;
+ if (brcloc > 0) {
+ for (int i = 0; i < diff+1; i++) {
+ filebuffer.RemoveAt(strloc);
+ }
+ filebuffer.Insert(strloc, str + " {");
+ if (linespace) {
+ filebuffer.Insert(strloc+1, "");
+ }
+ } else {}
+ }
+
+ public int FindHangingBrace(int strloc)
+ {
+ strloc++;
+ bool found = false;
+ while (!found) {
+ try {
+ string str = filebuffer[strloc++];
+ found = IsHangingBrace(str);
+ if (!found && !IsBlankLine(str)) {
+ return -1;
+ }
+ } catch (Exception) {
+ return -1;
+ }
+ }
+ return strloc -1;
+ }
+
+ public void FixEndBrace(String str)
+ {
+ int strloc = filebuffer.IndexOf(str);
+ filebuffer.RemoveAt(strloc);
+ filebuffer.Insert(strloc, RemoveEndBrace(str));
+ filebuffer.Insert(strloc+1, AddHangingBrace(str));
+ }
+
+ public static bool IsBadMonoType(String str)
+ {
+ if ( IsType(str) && !EndWithBrace(str)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static bool IsBadMonoFlow(String str)
+ {
+ if (IsFlow(str) && !EndWithBrace(str)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static bool IsBadMonoFunction(String str)
+ {
+ if (IsFunction(str) && EndWithBrace(str)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static bool IsBadMonoProperty(String str)
+ {
+ if (IsProperty(str) && !EndWithBrace(str)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static bool IsType(String str)
+ {
+ if ( !IsComment(str) && (
+ IsNameSpace(str) ||
+ IsClass(str) ||
+ IsStruct(str) ||
+ IsEnum(str) )) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static bool IsFlow(String str)
+ {
+ if ( !IsComment(str) && (
+ IsIf(str) ||
+ IsElse(str) ||
+ IsElseIf(str) ||
+ IsTry(str) ||
+ IsCatch(str) ||
+ IsFinally(str) ||
+ IsFor(str) ||
+ IsForEach(str) ||
+ IsWhile(str) ||
+ IsSwitch(str) ||
+ IsCase(str) )) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static bool IsFunction(String str)
+ {
+ if ( Regex.IsMatch(str, @"^\s*(\w+)\s+(\w+).*\(+") &&
+ !IsDeclaration(str) &&
+ !IsComment(str) &&
+ !IsType(str) &&
+ !IsFlow(str) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static bool IsProperty(String str)
+ {
+ if ( Regex.IsMatch(str, @"^\s*(\w+)\s+(\w+).*") &&
+ !IsDeclaration(str) &&
+ !IsComment(str) &&
+ !IsType(str) &&
+ !IsFlow(str) &&
+ !IsFunction(str) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static string RemoveEndBrace(String str)
+ {
+ Regex rg = new Regex(@"\{\s*$");
+ return rg.Replace(str, "");
+ }
+
+ public static string AddHangingBrace(String str)
+ {
+ Regex rg = new Regex(@"\S+\s*");
+ string blank = rg.Replace(str,"");
+ return blank + "{";
+ }
+
+ public static bool IsDeclaration(String str)
+ {
+ return Regex.IsMatch(str, @"\;\s*$");
+ }
+
+ public static bool IsComment(String str)
+ {
+ return Regex.IsMatch(str, @"^(\s*\/+|\s*\*+|\s*\#+)");
+ }
+
+ public static bool EndWithBrace(String str)
+ {
+ return Regex.IsMatch(str, @"\{\s*$");
+ }
+
+ public static bool IsHangingBrace(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+)\{");
+ }
+
+ public static bool IsBlankLine(String str)
+ {
+ return Regex.IsMatch(str, @"^\s*$");
+ }
+
+ public static bool IsNameSpace(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+)namespace\s+");
+ }
+
+ public static bool IsClass(String str)
+ {
+ return Regex.IsMatch(str, @"\s+class\s+");
+ }
+
+ public static bool IsStruct(String str)
+ {
+ return Regex.IsMatch(str, @"\s+struct\s+");
+ }
+
+ public static bool IsEnum(String str)
+ {
+ return Regex.IsMatch(str, @"\s+enum\s+");
+ }
+
+ public static bool IsIf(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+|\}+)if(\s+|\(+|$)");
+ }
+
+ public static bool IsElse(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+|\}+)else(\s+|\{+|$)");
+ }
+
+ public static bool IsElseIf(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+|\}+)else if(\s+|\(+|$)");
+ }
+
+ public static bool IsTry(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+|\}+)try(\s+|\(+|$)");
+ }
+
+ public static bool IsCatch(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+|\}+)catch(\s+|\(+|$)");
+ }
+
+ public static bool IsFinally(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+|\}+)finally(\s+|\{+|$)");
+ }
+
+ public static bool IsFor(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+|\}+)for(\s+|\(+|$)");
+ }
+
+ public static bool IsForEach(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+|\}+)foreach(\s+|\(+|$)");
+ }
+
+ public static bool IsWhile(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+|\}+)while(\s+|\(+|$)");
+ }
+
+ public static bool IsSwitch(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+|\}+)switch(\s+|\(+|$)");
+ }
+
+ public static bool IsCase(String str)
+ {
+ return Regex.IsMatch(str, @"(^|\s+|\}+)case(\s+|\(+|$)");
+ }
+ }
+}
diff --git a/mcs/tools/sample_cast_const.cs b/mcs/tools/sample_cast_const.cs
new file mode 100755
index 00000000000..04969312cde
--- /dev/null
+++ b/mcs/tools/sample_cast_const.cs
@@ -0,0 +1,49 @@
+using System;
+
+class X {
+ static void w (string s)
+ {
+ Console.WriteLine ("\t" + s);
+ }
+
+ static void Main ()
+ {
+ object [,] names =
+ { { "Byte", "byte" },
+ { "SByte", "sbyte" },
+ { "Short", "short" },
+ { "UShort", "ushort" },
+ { "Int", "int32" },
+ { "UInt", "uint32" },
+ { "Long", "int64" },
+ { "ULong", "uint64" },
+ { "Float", "float" },
+ { "Double", "double" },
+ { null, null }
+ };
+
+ for (int i = 0; names [i,0] != null; i++){
+ string big = names [i, 0] + "Constant";
+ string small = "TypeManager." + names [i, 1] + "_type";
+ string nat = ((string) names [i,0]).ToLower ();
+
+ w ("\t\tif (expr is " + big + "){");
+ w ("\t\t\t" + nat + " v = ((" + big + ") expr).Value;");
+ w ("");
+
+ for (int j = 0; names [j,0] != null; j++){
+ string b = names [j, 0] + "Constant";
+ string s = "TypeManager." + names [j, 1] + "_type";
+ string n = ((string) names [j,0]).ToLower ();
+
+ if (i == j)
+ continue;
+
+ w ("\t\t\tif (target_type == " + s + ")");
+ w ("\t\t\t\treturn new " + b + " ((" + n + ") v);");
+ }
+ w ("\t\t}");
+ }
+ }
+}
+
diff --git a/mcs/tools/scan-tests.pl b/mcs/tools/scan-tests.pl
new file mode 100755
index 00000000000..5cb0f8625f5
--- /dev/null
+++ b/mcs/tools/scan-tests.pl
@@ -0,0 +1,163 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Carp;
+
+my @allfiles;
+
+my @badsuites = qw[System\.Collections/HashtableTest System\.Collections/StackTest System\.Collections\.Specialized\.BasicOperationsTest];
+my @badtests = qw[PathTest:TestGetTempFileName XmlTextReaderTests:TestIsNameChar XmlTextReaderTests:TestIsFirstNameChar ByteTest:TestParse];
+my @mapfiles = ('s,^MonoTests\.(.*)/,$1/,',
+ 's,^Ximian\.Mono\.Tests(.*)/,,',
+ 's,^System\.Net/,,',
+ 's,^Collections\.Specialized\.,,',
+ 's,^Text\.RegularExpressions\.,,'
+ );
+my @maptests = ();
+my @mapnamespace = ();
+
+die "Usage: $0 input output" unless $#ARGV == 1;
+
+my $namespace = 'MonoTests';
+
+sub parse_test {
+ my ($filename, $namespace, $testname, $suite) = @_;
+
+ foreach (@badsuites) {
+ return if $filename =~ /$_/;
+ }
+
+ my $map;
+ foreach $map (@mapfiles) {
+ eval "\$filename =~ $map";
+ }
+
+ foreach (@allfiles) {
+ return if $filename eq $_->[0];
+ }
+
+ # print STDERR "PARSE: |$filename|\n";
+
+ push @allfiles, [$filename,$namespace,$testname,$suite,[]];
+
+ my $INPUT;
+ open $INPUT, $filename or croak "open ($filename): $!";
+ while (defined ($_ = <$INPUT>)) {
+ if (/^\s*namespace\s*([\w\.]+?)\s*$/) {
+ $namespace = $1;
+ next;
+ }
+ if (/^\s*suite\.AddTest\s*\((.*)\.(.*?)\.Suite\)/) {
+ my $filename = (defined $namespace) ? qq[$namespace.$1/$2.cs] : qq[$1/$2.cs];
+ my $nsprefix = (defined $namespace) ? qq[$namespace.$1] : qq[MonoTests.$1];
+ parse_test ($filename, $nsprefix, $1, $2);
+ next;
+ }
+ if (/^\s*suite\.AddTest\s*\((.*?)\.Suite\)/) {
+ my $filename = (defined $namespace) ? qq[$namespace/$1.cs] : qq[$1.cs];
+ parse_test ($filename, $namespace, '', $1);
+ next;
+ }
+ if (/^\s*suite\.AddTest\s*\(\s*new\s+TestSuite\s*\(\s*typeof\(\s*(.*)\s*\)\s*\)\s*\);/) {
+ my $filename = (defined $namespace) ? qq[$namespace/$1.cs] : qq[$1.cs];
+ parse_test ($filename, $namespace, '', $1);
+ next;
+ }
+ }
+ close $INPUT;
+}
+
+parse_test ($ARGV[0], undef, '', '');
+
+my $file;
+foreach $file (@allfiles) {
+ my ($filename,$namespace,$testname,$suite) = @$file;
+
+ open SUITE, $filename or croak "open ($filename): $!";
+ while (defined ($_ = <SUITE>)) {
+ next unless /^\s*public\s+void\s+(Test.*?)\s*\(\s*\)/;
+ push @{$file->[4]}, $1;
+ }
+ close SUITE;
+}
+
+open OUTPUT, "> $ARGV[1]" or croak "open (> $ARGV[1]): $!";
+select OUTPUT;
+
+print qq[using NUnit.Framework;\n];
+print qq[using System;\n];
+print qq[using System.Threading;\n];
+print qq[using System.Globalization;\n\n];
+
+
+my $alltest;
+foreach $alltest (@allfiles) {
+
+ my ($filename,$namespace,$testname,$suite,$tests) = @$alltest;
+ my @tests = @$tests;
+
+ next unless defined $namespace;
+ next unless $#tests >= 0;
+
+ # print STDERR "DOING TEST: |$testname|$filename|\n";
+
+ $namespace .= ".$testname" unless $testname eq '';
+
+ print qq[namespace $namespace\n\{\n];
+ print qq[\tpublic class Run$suite : $suite\n\t\{\n];
+ print qq[\t\tprotected override void RunTest ()\n\t\t\{\n];
+# print qq[\t\t\tbool errorThrown = false;\n\n];
+ my $test;
+ testloop:
+ foreach $test (@tests) {
+ my $badtest;
+ $filename =~ s/\.cs$//;
+ my $fullname = qq[$filename:$test];
+ # print STDERR "TEST: |$fullname|\n";
+ foreach $badtest (@badtests) {
+ next testloop if $fullname =~ /$badtest/;
+ }
+# print qq[\t\t\ttry \{\n\t\t\t\t$test ();\n\t\t\t\} catch \{\n];
+# print qq[\t\t\t\tConsole.WriteLine ("$namespace:$suite:$test failed");\n];
+# print qq[\t\t\t\terrorThrown = true;\n];
+# print qq[\t\t\t\}\n];
+ print qq[\t\t\t$test ();\n];
+# print qq[\t\t\tConsole.WriteLine ("$namespace:$suite:$test DONE");\n];
+ }
+ print qq[\n];
+# print qq[\t\t\tif (errorThrown)\n\t\t\t\tthrow new ArgumentException ();\n];
+ print qq[\t\t\}\n\t\}\n];
+ print qq[\}\n\n];
+}
+
+print qq[namespace $namespace\n\{\n];
+print qq[\tpublic class RunAllTests\n\t\{\n];
+print qq[\t\tpublic static void AddAllTests (TestSuite suite)\n];
+print qq[\t\t\{\n];
+
+foreach $alltest (@allfiles) {
+ my ($filename,$namespace,$testname,$suite,$tests) = @$alltest;
+ my @tests = @$tests;
+
+ next unless defined $namespace;
+ next unless $#tests >= 0;
+
+ $namespace .= ".$testname" unless $testname eq '';
+
+ print qq[\t\t\tsuite.AddTest (new $namespace.Run$suite ());\n];
+}
+
+print qq[\t\t\}\n\t\}\n\}\n\n];
+
+print qq[class MainApp\n\{\n];
+print qq[\tpublic static void Main()\n\t\{\n];
+print qq[\t\tThread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");\n\n];
+print qq[\t\tTestResult result = new TestResult ();\n];
+print qq[\t\tTestSuite suite = new TestSuite ();\n];
+print qq[\t\t$namespace.RunAllTests.AddAllTests (suite);\n];
+print qq[\t\tsuite.Run (result);\n];
+print qq[\t\tMonoTests.MyTestRunner.Print (result);\n];
+print qq[\t\}\n\}\n\n];
+
+close OUTPUT;
+
diff --git a/mcs/tools/serialize.cs b/mcs/tools/serialize.cs
new file mode 100755
index 00000000000..01b83f83b87
--- /dev/null
+++ b/mcs/tools/serialize.cs
@@ -0,0 +1,138 @@
+//
+// Serialize.cs
+//
+// This program creates a SerializationInfo and requests an object
+// to serialize itself.
+//
+// We serialize because we need to know the *exact* names that are
+// used for the values being serialized.
+//
+// Author: Miguel de Icaza
+// Duncan Mak
+//
+// (C) Ximian, Inc.
+//
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Soap;
+using System.IO;
+
+namespace Mono.Serialize {
+ class Driver {
+ static object StaticCreateObject ()
+ {
+ //
+ // Change the object type here.
+ //
+ return null;
+ }
+
+ static object LiveCreateObject (Type obj, Type[] types, string[] values)
+ {
+ if (types.Length != values.Length)
+ throw new ArgumentException ();
+
+ object[] a = new object [types.Length];
+
+ for (int i = 0; i < a.Length; i++)
+ a [i] = Convert.ChangeType (values [i], types [i]);
+
+ return Activator.CreateInstance (obj, a);
+ }
+
+ static void Main (string[] args)
+ {
+ object x = null;
+ string strTypes = null;
+ string argValues = null;
+
+ if (args.Length == 1) {
+ Type t = Type.GetType (args[0]);
+ Console.WriteLine ("\nPlease enter the arguments to the constructor for type {0}", t.ToString());
+ strTypes = Console.ReadLine ();
+ Console.WriteLine ("\nPlease enter the values");
+ argValues = Console.ReadLine ();
+ Type[] types = ToTypeArray (strTypes.Split (','));
+ string[] param = argValues.Split (',');
+
+ x = LiveCreateObject (t, types, param);
+ } else {
+ x = StaticCreateObject ();
+ }
+
+ string fileName = x.GetType().FullName + ".xml";
+ Stream output = new FileStream (fileName, FileMode.Create,
+ FileAccess.Write, FileShare.None);
+ IFormatter formatter = new SoapFormatter ();
+
+ formatter.Serialize ((Stream) output, x);
+ output.Close ();
+ }
+
+ public static Type[] ToTypeArray (string[] strTypes)
+ {
+ Type[] t = new Type [strTypes.Length];
+
+ for (int i = 0; i < strTypes.Length; i++)
+ t [i] = StringToType (strTypes [i]);
+ return t;
+ }
+
+ public static Type StringToType (string s)
+ {
+ switch (s) {
+ case "bool":
+ return typeof (System.Boolean);
+ break;
+ case "byte":
+ return typeof (System.Byte);
+ break;
+ case "sbyte":
+ return typeof (System.SByte);
+ break;
+ case "char":
+ return typeof (System.Char);
+ break;
+ case "decimal":
+ return typeof (System.Decimal);
+ break;
+ case "double":
+ return typeof (System.Double);
+ break;
+ case "float":
+ return typeof (System.Single);
+ break;
+ case "int":
+ return typeof (System.Int32);
+ break;
+ case "uint":
+ return typeof (System.UInt32);
+ break;
+ case "long":
+ return typeof (System.Int64);
+ break;
+ case "ulong":
+ return typeof (System.UInt64);
+ break;
+ case "object":
+ return typeof (System.Object);
+ break;
+ case "short":
+ return typeof (System.Int16);
+ break;
+ case "ushort":
+ return typeof (System.UInt16);
+ break;
+ case "string":
+ return typeof (System.String);
+ break;
+ default:
+ return Type.GetType (s);
+ break;
+ }
+ }
+ }
+}
diff --git a/mcs/tools/verifier.cs b/mcs/tools/verifier.cs
new file mode 100644
index 00000000000..25268147b26
--- /dev/null
+++ b/mcs/tools/verifier.cs
@@ -0,0 +1,1587 @@
+//
+// verifier.cs: compares two assemblies and reports differences.
+//
+// Author:
+// Sergey Chaban (serge@wildwestsoftware.com)
+//
+// (C) Sergey Chaban (serge@wildwestsoftware.com)
+//
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Reflection;
+
+namespace Mono.Verifier {
+
+
+
+ ////////////////////////////////
+ // Collections
+ ////////////////////////////////
+
+ public abstract class MemberCollection : IEnumerable {
+
+ public delegate MemberInfo [] InfoQuery (Type type, BindingFlags bindings);
+ public delegate bool MemberComparer (MemberInfo mi1, MemberInfo mi2);
+
+ protected SortedList list;
+ protected MemberComparer comparer;
+
+ protected BindingFlags bindings;
+
+ protected MemberCollection (Type type, InfoQuery query, MemberComparer comparer, BindingFlags bindings)
+ {
+ if (query == null)
+ throw new NullReferenceException ("Invalid query delegate.");
+
+ if (comparer == null)
+ throw new NullReferenceException ("Invalid comparer.");
+
+ this.comparer = comparer;
+ this.bindings = bindings;
+
+ this.list = new SortedList ();
+
+ MemberInfo [] data = query (type, bindings);
+ foreach (MemberInfo info in data) {
+ this.list [info.Name] = info;
+ }
+ }
+
+
+
+ public MemberInfo this [string name] {
+ get {
+ return list [name] as MemberInfo;
+ }
+ }
+
+
+ public override int GetHashCode ()
+ {
+ return list.GetHashCode ();
+ }
+
+
+ public override bool Equals (object o)
+ {
+ bool res = (o is MemberCollection);
+ if (res) {
+ MemberCollection another = o as MemberCollection;
+ IEnumerator it = GetEnumerator ();
+ while (it.MoveNext () && res) {
+ MemberInfo inf1 = it.Current as MemberInfo;
+ MemberInfo inf2 = another [inf1.Name];
+ res &= comparer (inf1, inf2);
+ }
+ }
+ return res;
+ }
+
+
+
+ public static bool operator == (MemberCollection c1, MemberCollection c2)
+ {
+ return c1.Equals (c2);
+ }
+
+ public static bool operator != (MemberCollection c1, MemberCollection c2)
+ {
+ return !(c1 == c2);
+ }
+
+
+
+ public IEnumerator GetEnumerator()
+ {
+ return new Iterator (this);
+ }
+
+
+ internal class Iterator : IEnumerator {
+ private MemberCollection host;
+ private int pos;
+
+ internal Iterator (MemberCollection host)
+ {
+ this.host=host;
+ this.Reset ();
+ }
+
+ /// <summary></summary>
+ public object Current
+ {
+ get {
+ if (host != null && pos >=0 && pos < host.list.Count) {
+ return host.list.GetByIndex (pos);
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /// <summary></summary>
+ public bool MoveNext ()
+ {
+ if (host!=null) {
+ return (++pos) < host.list.Count;
+ } else {
+ return false;
+ }
+ }
+
+ /// <summary></summary>
+ public void Reset ()
+ {
+ this.pos = -1;
+ }
+ }
+
+ }
+
+
+
+
+ //--- Method collections
+
+ /// <summary>
+ /// Abstract collection of class' methods.
+ /// </summary>
+ public abstract class MethodCollectionBase : MemberCollection {
+
+
+ protected MethodCollectionBase (Type type, BindingFlags bindings)
+ : base (type, new InfoQuery (Query), new MemberComparer (Comparer), bindings)
+ {
+ }
+
+
+ private static MemberInfo [] Query (Type type, BindingFlags bindings)
+ {
+ // returns MethodInfo []
+ return type.GetMethods (bindings);
+ }
+
+ private static bool Comparer (MemberInfo mi1, MemberInfo mi2)
+ {
+ bool res = false;
+ if (mi1 is MethodInfo && (mi2 == null || mi2 is MethodInfo)) {
+ MethodInfo inf1 = mi1 as MethodInfo;
+ MethodInfo inf2 = mi2 as MethodInfo;
+ res = Compare.Methods (inf1, inf2);
+ } else {
+ Verifier.log.Write ("internal-error", "Wrong comparer arguments.", ImportanceLevel.HIGH);
+ }
+ return res;
+ }
+ }
+
+
+
+ /// <summary>
+ /// Collection of public instance methods of a class.
+ /// </summary>
+ public class PublicMethods : MethodCollectionBase {
+
+ public PublicMethods (Type type)
+ : base (type, BindingFlags.Public | BindingFlags.Instance)
+ {
+ }
+ }
+
+ /// <summary>
+ /// Collection of public static methods of a class.
+ /// </summary>
+ public class PublicStaticMethods : MethodCollectionBase {
+
+ public PublicStaticMethods (Type type)
+ : base (type, BindingFlags.Public | BindingFlags.Static)
+ {
+ }
+ }
+
+ /// <summary>
+ /// Collection of non-public instance methods of a class.
+ /// </summary>
+ public class NonPublicMethods : MethodCollectionBase {
+
+ public NonPublicMethods (Type type)
+ : base (type, BindingFlags.NonPublic | BindingFlags.Instance)
+ {
+ }
+ }
+
+ /// <summary>
+ /// Collection of non-public static methods of a class.
+ /// </summary>
+ public class NonPublicStaticMethods : MethodCollectionBase {
+
+ public NonPublicStaticMethods (Type type)
+ : base (type, BindingFlags.NonPublic | BindingFlags.Static)
+ {
+ }
+ }
+
+
+
+
+
+ //--- Field collections
+
+ public abstract class FieldCollectionBase : MemberCollection {
+
+
+ protected FieldCollectionBase (Type type, BindingFlags bindings)
+ : base (type, new InfoQuery (Query), new MemberComparer (Comparer), bindings)
+ {
+ }
+
+
+ private static MemberInfo [] Query (Type type, BindingFlags bindings)
+ {
+ // returns FieldInfo []
+ return type.GetFields (bindings);
+ }
+
+ private static bool Comparer (MemberInfo mi1, MemberInfo mi2)
+ {
+ bool res = false;
+ if (mi1 is FieldInfo && (mi2 == null || mi2 is FieldInfo)) {
+ FieldInfo inf1 = mi1 as FieldInfo;
+ FieldInfo inf2 = mi2 as FieldInfo;
+ res = Compare.Fields (inf1, inf2);
+ } else {
+ Verifier.log.Write ("internal-error", "Wrong comparer arguments.", ImportanceLevel.HIGH);
+ }
+ return res;
+ }
+ }
+
+
+ public class PublicFields : FieldCollectionBase {
+
+ public PublicFields (Type type)
+ : base (type, BindingFlags.Public | BindingFlags.Instance)
+ {
+ }
+ }
+
+ public class PublicStaticFields : FieldCollectionBase {
+
+ public PublicStaticFields (Type type)
+ : base (type, BindingFlags.Public | BindingFlags.Static)
+ {
+ }
+ }
+
+ public class NonPublicFields : FieldCollectionBase {
+
+ public NonPublicFields (Type type)
+ : base (type, BindingFlags.NonPublic | BindingFlags.Instance)
+ {
+ }
+ }
+
+ public class NonPublicStaticFields : FieldCollectionBase {
+
+ public NonPublicStaticFields (Type type)
+ : base (type, BindingFlags.NonPublic | BindingFlags.Static)
+ {
+ }
+ }
+
+
+
+
+
+ public abstract class AbstractTypeStuff {
+ public readonly Type type;
+
+ public AbstractTypeStuff (Type type)
+ {
+ if (type == null)
+ throw new NullReferenceException ("Invalid type.");
+
+ this.type = type;
+ }
+
+ public override int GetHashCode ()
+ {
+ return type.GetHashCode ();
+ }
+
+ public static bool operator == (AbstractTypeStuff t1, AbstractTypeStuff t2)
+ {
+ if ((t1 as object) == null) {
+ if ((t2 as object) == null) return true;
+ return false;
+ }
+ return t1.Equals (t2);
+ }
+
+ public static bool operator != (AbstractTypeStuff t1, AbstractTypeStuff t2)
+ {
+ return !(t1 == t2);
+ }
+
+ public override bool Equals (object o)
+ {
+ return (o is AbstractTypeStuff && CompareTypes (o as AbstractTypeStuff));
+ }
+
+ protected virtual bool CompareTypes (AbstractTypeStuff that)
+ {
+ Verifier.Log.Write ("info", "Comparing types.", ImportanceLevel.LOW);
+ bool res;
+
+ res = Compare.Types (this.type, that.type);
+
+ return res;
+ }
+
+ }
+
+
+
+
+ /// <summary>
+ /// Represents a class.
+ /// </summary>
+ public class ClassStuff : AbstractTypeStuff {
+
+ public PublicMethods publicMethods;
+ public PublicStaticMethods publicStaticMethods;
+ public NonPublicMethods nonpublicMethods;
+ public NonPublicStaticMethods nonpublicStaticMethods;
+
+ public PublicFields publicFields;
+ public PublicStaticFields publicStaticFields;
+ public NonPublicFields nonpublicFields;
+ public NonPublicStaticFields nonpublicStaticFields;
+
+ public ClassStuff (Type type) : base (type)
+ {
+ publicMethods = new PublicMethods (type);
+ publicStaticMethods = new PublicStaticMethods (type);
+ nonpublicMethods = new NonPublicMethods (type);
+ nonpublicStaticMethods = new NonPublicStaticMethods (type);
+
+ publicFields = new PublicFields (type);
+ publicStaticFields = new PublicStaticFields (type);
+ nonpublicFields = new NonPublicFields (type);
+ nonpublicStaticFields = new NonPublicStaticFields (type);
+ }
+
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ private bool CompareMethods (ClassStuff that)
+ {
+ bool res = true;
+ bool ok;
+
+ Verifier.Log.Write ("info", "Comparing public instance methods.", ImportanceLevel.LOW);
+ ok = (this.publicMethods == that.publicMethods);
+ res &= ok;
+ if (!ok && Verifier.stopOnError) return res;
+
+ Verifier.Log.Write ("info", "Comparing public static methods.", ImportanceLevel.LOW);
+ ok = (this.publicStaticMethods == that.publicStaticMethods);
+ res &= ok;
+ if (!ok && Verifier.stopOnError) return res;
+
+ Verifier.Log.Write ("info", "Comparing non-public instance methods.", ImportanceLevel.LOW);
+ ok = (this.nonpublicMethods == that.nonpublicMethods);
+ res &= ok;
+ if (!ok && Verifier.stopOnError) return res;
+
+ Verifier.Log.Write ("info", "Comparing non-public static methods.", ImportanceLevel.LOW);
+ ok = (this.nonpublicStaticMethods == that.nonpublicStaticMethods);
+ res &= ok;
+ if (!ok && Verifier.stopOnError) return res;
+
+ return res;
+ }
+
+
+ private bool CompareFields (ClassStuff that)
+ {
+ bool res = true;
+ bool ok;
+
+ Verifier.Log.Write ("info", "Comparing public instance fields.", ImportanceLevel.LOW);
+ ok = (this.publicFields == that.publicFields);
+ res &= ok;
+ if (!ok && Verifier.stopOnError) return res;
+
+ Verifier.Log.Write ("info", "Comparing public static fields.", ImportanceLevel.LOW);
+ ok = (this.publicStaticFields == that.publicStaticFields);
+ res &= ok;
+ if (!ok && Verifier.stopOnError) return res;
+
+ Verifier.Log.Write ("info", "Comparing non-public instance fields.", ImportanceLevel.LOW);
+ ok = (this.nonpublicFields == that.nonpublicFields);
+ res &= ok;
+ if (!ok && Verifier.stopOnError) return res;
+
+ Verifier.Log.Write ("info", "Comparing non-public static fields.", ImportanceLevel.LOW);
+ ok = (this.nonpublicStaticFields == that.nonpublicStaticFields);
+ res &= ok;
+ if (!ok && Verifier.stopOnError) return res;
+
+ return res;
+ }
+
+
+ public override bool Equals (object o)
+ {
+ bool res = (o is ClassStuff);
+ if (res) {
+ ClassStuff that = o as ClassStuff;
+
+ res &= this.CompareTypes (that);
+ if (!res && Verifier.stopOnError) return res;
+
+ res &= this.CompareMethods (that);
+ if (!res && Verifier.stopOnError) return res;
+
+ res &= this.CompareFields (that);
+ if (!res && Verifier.stopOnError) return res;
+
+ }
+ return res;
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents an interface.
+ /// </summary>
+ public class InterfaceStuff : AbstractTypeStuff {
+
+ public PublicMethods publicMethods;
+
+ public InterfaceStuff (Type type) : base (type)
+ {
+ publicMethods = new PublicMethods (type);
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool Equals (object o)
+ {
+ bool res = (o is InterfaceStuff);
+ if (res) {
+ bool ok;
+ InterfaceStuff that = o as InterfaceStuff;
+
+ res = this.CompareTypes (that);
+ if (!res && Verifier.stopOnError) return res;
+
+ Verifier.Log.Write ("info", "Comparing interface methods.", ImportanceLevel.LOW);
+ ok = (this.publicMethods == that.publicMethods);
+ res &= ok;
+ if (!ok && Verifier.stopOnError) return res;
+ }
+ return res;
+ }
+
+ }
+
+
+
+ /// <summary>
+ /// Represents an enumeration.
+ /// </summary>
+ public class EnumStuff : AbstractTypeStuff {
+
+ //public FieldInfo [] members;
+
+ public string baseType;
+ public Hashtable enumTable;
+ public bool isFlags;
+
+ public EnumStuff (Type type) : base (type)
+ {
+ //members = type.GetFields (BindingFlags.Public | BindingFlags.Static);
+
+ Array values = Enum.GetValues (type);
+ Array names = Enum.GetNames (type);
+
+ baseType = Enum.GetUnderlyingType (type).Name;
+
+ enumTable = new Hashtable ();
+
+ object [] attrs = type.GetCustomAttributes (false);
+ isFlags = (attrs != null && attrs.Length > 0);
+ if (isFlags) {
+ foreach (object attr in attrs) {
+ isFlags |= (attr is FlagsAttribute);
+ }
+ }
+
+ int indx = 0;
+ foreach (string id in names) {
+ enumTable [id] = Convert.ToInt64(values.GetValue(indx) as Enum);
+ ++indx;
+ }
+ }
+
+ public override int GetHashCode ()
+ {
+ return base.GetHashCode ();
+ }
+
+ public override bool Equals (object o)
+ {
+ bool res = (o is EnumStuff);
+ bool ok;
+
+ if (res) {
+ EnumStuff that = o as EnumStuff;
+ ok = this.CompareTypes (that);
+ res &= ok;
+ if (!ok && Verifier.stopOnError) return res;
+
+ ok = (this.baseType == that.baseType);
+ res &= ok;
+ if (!ok) {
+ Verifier.log.Write ("error",
+ String.Format ("Underlying types mismatch [{0}, {1}].", this.baseType, that.baseType),
+ ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+ Verifier.Log.Write ("info", "Comparing [Flags] attribute.");
+ ok = !(this.isFlags ^ that.isFlags);
+ res &= ok;
+ if (!ok) {
+ Verifier.log.Write ("error",
+ String.Format ("[Flags] attribute mismatch ({0} : {1}).", this.isFlags ? "Yes" : "No", that.isFlags ? "Yes" : "No"),
+ ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+ Verifier.Log.Write ("info", "Comparing enum values.");
+
+ ICollection names = enumTable.Keys;
+ foreach (string id in names) {
+ ok = that.enumTable.ContainsKey (id);
+ res &= ok;
+ if (!ok) {
+ Verifier.log.Write ("error", String.Format("{0} absent in enumeration.", id),
+ ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+ if (ok) {
+ long val1 = (long) this.enumTable [id];
+ long val2 = (long) that.enumTable [id];
+ ok = (val1 == val2);
+ res &= ok;
+ if (!ok) {
+ Verifier.log.Write ("error",
+ String.Format ("Enum values mismatch [{0}: {1} != {2}].", id, val1, val2),
+ ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+ }
+ }
+ }
+ return res;
+ }
+ }
+
+
+
+ public sealed class TypeArray {
+ public static readonly TypeArray empty = new TypeArray (Type.EmptyTypes);
+
+ public Type [] types;
+
+ public TypeArray (Type [] types)
+ {
+ this.types = new Type [types.Length];
+ for (int i = 0; i < types.Length; i++) {
+ this.types.SetValue (types.GetValue (i), i);
+ }
+ }
+ }
+
+
+
+ public class AssemblyLoader {
+ public delegate void Hook (TypeArray assemblyTypes);
+
+ private static Hashtable cache;
+
+ private Hook hook;
+
+ static AssemblyLoader ()
+ {
+ cache = new Hashtable (11);
+ }
+
+ public AssemblyLoader (Hook hook)
+ {
+ if (hook == null)
+ throw new NullReferenceException ("Invalid loader hook.");
+
+ this.hook = hook;
+ }
+
+
+ public bool LoadFrom (string assemblyName)
+ {
+ bool res = false;
+ try {
+ TypeArray types = TypeArray.empty;
+
+ lock (cache) {
+ if (cache.Contains (assemblyName)) {
+ types = (cache [assemblyName] as TypeArray);
+ if (types == null) types = TypeArray.empty;
+ } else {
+ Assembly asm = Assembly.LoadFrom (assemblyName);
+ Type [] allTypes = asm.GetTypes ();
+ if (allTypes == null) allTypes = Type.EmptyTypes;
+ types = new TypeArray (allTypes);
+ cache [assemblyName] = types;
+ }
+ }
+ hook (types);
+ res = true;
+ } catch (ReflectionTypeLoadException rtle) {
+ // FIXME: Should we try to recover? Use loaded portion of types.
+ Type [] loaded = rtle.Types;
+ for (int i = 0, xCnt = 0; i < loaded.Length; i++) {
+ if (loaded [i] == null) {
+ Verifier.log.Write ("fatal error",
+ String.Format ("Unable to load {0}, reason - {1}", loaded [i], rtle.LoaderExceptions [xCnt++]),
+ ImportanceLevel.LOW);
+ }
+ }
+ } catch (FileNotFoundException fnfe) {
+ Verifier.log.Write ("fatal error", fnfe.ToString (), ImportanceLevel.LOW);
+ } catch (Exception x) {
+ Verifier.log.Write ("fatal error", x.ToString (), ImportanceLevel.LOW);
+ }
+
+ return res;
+ }
+
+ }
+
+
+
+
+ public abstract class AbstractTypeCollection : SortedList {
+
+ private AssemblyLoader loader;
+
+ public AbstractTypeCollection ()
+ {
+ loader = new AssemblyLoader (new AssemblyLoader.Hook (LoaderHook));
+ }
+
+ public AbstractTypeCollection (string assemblyName) : this ()
+ {
+ LoadFrom (assemblyName);
+ }
+
+ public abstract void LoaderHook (TypeArray types);
+
+
+ public bool LoadFrom (string assemblyName)
+ {
+ return loader.LoadFrom (assemblyName);
+ }
+
+ }
+
+
+
+ public class ClassCollection : AbstractTypeCollection {
+
+ public ClassCollection () : base ()
+ {
+ }
+
+ public ClassCollection (string assemblyName)
+ : base (assemblyName)
+ {
+ }
+
+
+ public override void LoaderHook (TypeArray types)
+ {
+ foreach (Type type in types.types) {
+ if (type.IsClass) {
+ this [type.FullName] = new ClassStuff (type);
+ }
+ }
+ }
+
+ }
+
+
+ public class InterfaceCollection : AbstractTypeCollection {
+
+ public InterfaceCollection () : base ()
+ {
+ }
+
+ public InterfaceCollection (string assemblyName)
+ : base (assemblyName)
+ {
+ }
+
+
+ public override void LoaderHook (TypeArray types)
+ {
+ foreach (Type type in types.types) {
+ if (type.IsInterface) {
+ this [type.FullName] = new InterfaceStuff (type);
+ }
+ }
+ }
+
+ }
+
+
+
+ public class EnumCollection : AbstractTypeCollection {
+
+ public EnumCollection () : base ()
+ {
+ }
+
+ public EnumCollection (string assemblyName)
+ : base (assemblyName)
+ {
+ }
+
+ public override void LoaderHook (TypeArray types)
+ {
+ foreach (Type type in types.types) {
+ if (type.IsEnum) {
+ this [type.FullName] = new EnumStuff (type);
+ }
+ }
+ }
+ }
+
+
+
+ public class AssemblyStuff {
+
+ public string name;
+ public bool valid;
+
+ public ClassCollection classes;
+ public InterfaceCollection interfaces;
+ public EnumCollection enums;
+
+
+ protected delegate bool Comparer (AssemblyStuff asm1, AssemblyStuff asm2);
+ private static ArrayList comparers;
+
+ static AssemblyStuff ()
+ {
+ comparers = new ArrayList ();
+ comparers.Add (new Comparer (CompareNumClasses));
+ comparers.Add (new Comparer (CompareNumInterfaces));
+ comparers.Add (new Comparer (CompareClasses));
+ comparers.Add (new Comparer (CompareInterfaces));
+ comparers.Add (new Comparer (CompareEnums));
+ }
+
+ protected static bool CompareNumClasses (AssemblyStuff asm1, AssemblyStuff asm2)
+ {
+ bool res = (asm1.classes.Count == asm2.classes.Count);
+ if (!res) Verifier.Log.Write ("error", "Number of classes mismatch.", ImportanceLevel.MEDIUM);
+ return res;
+ }
+
+ protected static bool CompareNumInterfaces (AssemblyStuff asm1, AssemblyStuff asm2)
+ {
+ bool res = (asm1.interfaces.Count == asm2.interfaces.Count);
+ if (!res) Verifier.Log.Write ("error", "Number of interfaces mismatch.", ImportanceLevel.MEDIUM);
+ return res;
+ }
+
+
+ protected static bool CompareClasses (AssemblyStuff asm1, AssemblyStuff asm2)
+ {
+ bool res = true;
+ Verifier.Log.Write ("info", "Comparing classes.");
+
+ foreach (DictionaryEntry c in asm1.classes) {
+ string className = c.Key as string;
+
+ if (Verifier.Excluded.Contains (className)) {
+ Verifier.Log.Write ("info", String.Format ("Ignoring class {0}.", className), ImportanceLevel.MEDIUM);
+ continue;
+ }
+
+ Verifier.Log.Write ("class", className);
+
+ ClassStuff class1 = c.Value as ClassStuff;
+ ClassStuff class2 = asm2.classes [className] as ClassStuff;
+
+ if (class2 == null) {
+ Verifier.Log.Write ("error", String.Format ("There is no such class in {0}", asm2.name));
+ res = false;
+ if (Verifier.stopOnError || !Verifier.ignoreMissingTypes) return res;
+ continue;
+ }
+
+ res &= (class1 == class2);
+ if (!res && Verifier.stopOnError) return res;
+ }
+
+ return res;
+ }
+
+
+ protected static bool CompareInterfaces (AssemblyStuff asm1, AssemblyStuff asm2)
+ {
+ bool res = true;
+ Verifier.Log.Write ("info", "Comparing interfaces.");
+
+ foreach (DictionaryEntry ifc in asm1.interfaces) {
+ string ifcName = ifc.Key as string;
+ Verifier.Log.Write ("interface", ifcName);
+
+ InterfaceStuff ifc1 = ifc.Value as InterfaceStuff;
+ InterfaceStuff ifc2 = asm2.interfaces [ifcName] as InterfaceStuff;
+
+ if (ifc2 == null) {
+ Verifier.Log.Write ("error", String.Format ("There is no such interface in {0}", asm2.name));
+ res = false;
+ if (Verifier.stopOnError || !Verifier.ignoreMissingTypes) return res;
+ continue;
+ }
+
+ res &= (ifc1 == ifc2);
+ if (!res && Verifier.stopOnError) return res;
+
+ }
+
+ return res;
+ }
+
+
+ protected static bool CompareEnums (AssemblyStuff asm1, AssemblyStuff asm2)
+ {
+ bool res = true;
+ Verifier.Log.Write ("info", "Comparing enums.");
+
+ foreach (DictionaryEntry e in asm1.enums) {
+ string enumName = e.Key as string;
+ Verifier.Log.Write ("enum", enumName);
+
+ EnumStuff e1 = e.Value as EnumStuff;
+ EnumStuff e2 = asm2.enums [enumName] as EnumStuff;
+
+ if (e2 == null) {
+ Verifier.Log.Write ("error", String.Format ("There is no such enum in {0}", asm2.name));
+ res = false;
+ if (Verifier.stopOnError || !Verifier.ignoreMissingTypes) return res;
+ continue;
+ }
+ res &= (e1 == e2);
+ if (!res && Verifier.stopOnError) return res;
+ }
+
+ return res;
+ }
+
+
+
+ public AssemblyStuff (string assemblyName)
+ {
+ this.name = assemblyName;
+ valid = false;
+ }
+
+ public bool Load ()
+ {
+ bool res = true;
+ bool ok;
+
+ classes = new ClassCollection ();
+ ok = classes.LoadFrom (name);
+ res &= ok;
+ if (!ok) Verifier.log.Write ("error", String.Format ("Unable to load classes from {0}.", name), ImportanceLevel.HIGH);
+
+ interfaces = new InterfaceCollection ();
+ ok = interfaces.LoadFrom (name);
+ res &= ok;
+ if (!ok) Verifier.log.Write ("error", String.Format ("Unable to load interfaces from {0}.", name), ImportanceLevel.HIGH);
+
+ enums = new EnumCollection ();
+ ok = enums.LoadFrom (name);
+ res &= ok;
+ if (!ok) Verifier.log.Write ("error", String.Format ("Unable to load enums from {0}.", name), ImportanceLevel.HIGH);
+
+ valid = res;
+ return res;
+ }
+
+
+ public override bool Equals (object o)
+ {
+ bool res = (o is AssemblyStuff);
+ if (res) {
+ AssemblyStuff that = o as AssemblyStuff;
+ IEnumerator it = comparers.GetEnumerator ();
+ while ((res || !Verifier.stopOnError) && it.MoveNext ()) {
+ Comparer compare = it.Current as Comparer;
+ res &= compare (this, that);
+ }
+ }
+ return res;
+ }
+
+
+ public static bool operator == (AssemblyStuff asm1, AssemblyStuff asm2)
+ {
+ return asm1.Equals (asm2);
+ }
+
+ public static bool operator != (AssemblyStuff asm1, AssemblyStuff asm2)
+ {
+ return !(asm1 == asm2);
+ }
+
+ public override int GetHashCode ()
+ {
+ return classes.GetHashCode () ^ interfaces.GetHashCode ();
+ }
+
+
+ public override string ToString ()
+ {
+ string res;
+ if (valid) {
+ res = String.Format ("Asssembly {0}, valid, {1} classes, {2} interfaces, {3} enums.",
+ name, classes.Count, interfaces.Count, enums.Count);
+ } else {
+ res = String.Format ("Asssembly {0}, invalid.", name);
+ }
+ return res;
+ }
+
+ }
+
+
+
+
+ ////////////////////////////////
+ // Compare
+ ////////////////////////////////
+
+ public sealed class Compare {
+
+ private Compare ()
+ {
+ }
+
+
+ public static bool Parameters (ParameterInfo[] params1, ParameterInfo[] params2)
+ {
+ bool res = true;
+ if (params1.Length != params2.Length) {
+ Verifier.Log.Write ("Parameter count mismatch.");
+ return false;
+ }
+
+ int count = params1.Length;
+
+ for (int i = 0; i < count && res; i++) {
+ if (params1 [i].Name != params2 [i].Name) {
+ Verifier.Log.Write ("error", String.Format ("Parameters names mismatch {0}, {1}.", params1 [i].Name, params2 [i].Name));
+ res = false;
+ if (Verifier.stopOnError) break;
+ }
+
+ Verifier.Log.Write ("parameter", params1 [i].Name);
+
+ if (!Compare.Types (params1 [i].ParameterType, params2 [i].ParameterType)) {
+ Verifier.Log.Write ("error", String.Format ("Parameters types mismatch {0}, {1}.", params1 [i].ParameterType, params2 [i].ParameterType));
+ res = false;
+ if (Verifier.stopOnError) break;
+ }
+
+
+ if (Verifier.checkOptionalFlags) {
+ if (params1 [i].IsIn != params2 [i].IsIn) {
+ Verifier.Log.Write ("error", "[in] mismatch.");
+ res = false;
+ if (Verifier.stopOnError) break;
+ }
+
+ if (params1 [i].IsOut != params2 [i].IsOut) {
+ Verifier.Log.Write ("error", "[out] mismatch.");
+ res = false;
+ if (Verifier.stopOnError) break;
+ }
+
+ if (params1 [i].IsRetval != params2 [i].IsRetval) {
+ Verifier.Log.Write ("error", "[ref] mismatch.");
+ res = false;
+ if (Verifier.stopOnError) break;
+ }
+
+ if (params1 [i].IsOptional != params2 [i].IsOptional) {
+ Verifier.Log.Write ("error", "Optional flag mismatch.");
+ res = false;
+ if (Verifier.stopOnError) break;
+ }
+
+ } // checkOptionalFlags
+
+
+ }
+
+ return res;
+ }
+
+
+
+ public static bool Methods (MethodInfo mi1, MethodInfo mi2)
+ {
+
+ if (mi2 == null) {
+ Verifier.Log.Write ("error", String.Format ("There is no such method {0}.", mi1.Name), ImportanceLevel.MEDIUM);
+ return false;
+ }
+
+
+ Verifier.Log.Flush ();
+ Verifier.Log.Write ("method", String.Format ("{0}.", mi1.Name));
+ bool res = true;
+ bool ok;
+ string expected;
+
+ ok = Compare.Types (mi1.ReturnType, mi2.ReturnType);
+ res &= ok;
+ if (!ok) {
+ Verifier.Log.Write ("error", "Return types mismatch.", ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+
+
+
+ ok = (mi1.IsAbstract == mi2.IsAbstract);
+ res &= ok;
+ if (!ok) {
+ expected = (mi1.IsAbstract) ? "abstract" : "non-abstract";
+ Verifier.Log.Write ("error", String.Format ("Expected to be {0}.", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+ ok = (mi1.IsVirtual == mi2.IsVirtual);
+ res &= ok;
+ if (!ok) {
+ expected = (mi1.IsVirtual) ? "virtual" : "non-virtual";
+ Verifier.Log.Write ("error", String.Format ("Expected to be {0}.", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+ ok = (mi1.IsFinal == mi2.IsFinal);
+ res &= ok;
+ if (!ok) {
+ expected = (mi1.IsFinal) ? "final" : "overridable";
+ Verifier.Log.Write ("error", String.Format ("Expected to be {0}.", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+
+
+ // compare access modifiers
+
+ ok = (mi1.IsPrivate == mi2.IsPrivate);
+ res &= ok;
+ if (!ok) {
+ expected = (mi1.IsPublic) ? "public" : "private";
+ Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+
+ ok = (mi1.IsFamily == mi2.IsFamily);
+ res &= ok;
+ if (!ok) {
+ expected = (mi1.IsFamily) ? "protected" : "!protected";
+ Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+ ok = (mi1.IsAssembly == mi2.IsAssembly);
+ res &= ok;
+ if (!ok) {
+ expected = (mi1.IsAssembly) ? "internal" : "!internal";
+ Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+
+ ok = (mi1.IsStatic == mi2.IsStatic);
+ res &= ok;
+ if (!ok) {
+ expected = (mi1.IsStatic) ? "static" : "instance";
+ Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+
+
+ // parameters
+
+ ok = Compare.Parameters (mi1.GetParameters (), mi2.GetParameters ());
+ res &= ok;
+ if (!ok && Verifier.stopOnError) return res;
+
+
+ ok = (mi1.CallingConvention == mi2.CallingConvention);
+ res &= ok;
+ if (!ok) {
+ Verifier.Log.Write ("error", "Calling conventions mismatch.", ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+
+
+
+ return res;
+ }
+
+
+ public static bool Fields (FieldInfo fi1, FieldInfo fi2)
+ {
+ if (fi2 == null) {
+ Verifier.Log.Write ("error", String.Format ("There is no such field {0}.", fi1.Name), ImportanceLevel.MEDIUM);
+ return false;
+ }
+
+ bool res = true;
+ bool ok;
+ string expected;
+
+ Verifier.Log.Write ("field", String.Format ("{0}.", fi1.Name));
+
+ ok = (fi1.IsPrivate == fi2.IsPrivate);
+ res &= ok;
+ if (!ok) {
+ expected = (fi1.IsPublic) ? "public" : "private";
+ Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+ ok = (fi1.IsFamily == fi2.IsFamily);
+ res &= ok;
+ if (!ok) {
+ expected = (fi1.IsFamily) ? "protected" : "!protected";
+ Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+ ok = (fi1.IsAssembly == fi2.IsAssembly);
+ res &= ok;
+ if (!ok) {
+ expected = (fi1.IsAssembly) ? "internal" : "!internal";
+ Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+ ok = (fi1.IsInitOnly == fi2.IsInitOnly);
+ res &= ok;
+ if (!ok) {
+ expected = (fi1.IsInitOnly) ? "readonly" : "!readonly";
+ Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+ ok = (fi1.IsStatic == fi2.IsStatic);
+ res &= ok;
+ if (!ok) {
+ expected = (fi1.IsStatic) ? "static" : "instance";
+ Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
+ if (Verifier.stopOnError) return res;
+ }
+
+ return res;
+ }
+
+
+
+ public static bool Types (Type type1, Type type2)
+ {
+ // NOTE:
+ // simply calling type1.Equals (type2) won't work,
+ // types are in different assemblies hence they have
+ // different (fully-qualified) names.
+ int eqFlags = 0;
+ eqFlags |= (type1.IsAbstract == type2.IsAbstract) ? 0 : 0x001;
+ eqFlags |= (type1.IsClass == type2.IsClass) ? 0 : 0x002;
+ eqFlags |= (type1.IsValueType == type2.IsValueType) ? 0 : 0x004;
+ eqFlags |= (type1.IsPublic == type2.IsPublic) ? 0 : 0x008;
+ eqFlags |= (type1.IsSealed == type2.IsSealed) ? 0 : 0x010;
+ eqFlags |= (type1.IsEnum == type2.IsEnum) ? 0 : 0x020;
+ eqFlags |= (type1.IsPointer == type2.IsPointer) ? 0 : 0x040;
+ eqFlags |= (type1.IsPrimitive == type2.IsPrimitive) ? 0 : 0x080;
+ bool res = (eqFlags == 0);
+
+ if (!res) {
+ // TODO: convert flags into descriptive message.
+ Verifier.Log.Write ("error", "Types mismatch (0x" + eqFlags.ToString("X") + ").", ImportanceLevel.HIGH);
+ }
+
+
+ bool ok;
+
+ ok = (type1.Attributes & TypeAttributes.BeforeFieldInit) ==
+ (type2.Attributes & TypeAttributes.BeforeFieldInit);
+ if (!ok) {
+ Verifier.Log.Write ("error", "Types attributes mismatch: BeforeFieldInit.", ImportanceLevel.HIGH);
+ }
+ res &= ok;
+
+ ok = (type1.Attributes & TypeAttributes.ExplicitLayout) ==
+ (type2.Attributes & TypeAttributes.ExplicitLayout);
+ if (!ok) {
+ Verifier.Log.Write ("error", "Types attributes mismatch: ExplicitLayout.", ImportanceLevel.HIGH);
+ }
+ res &= ok;
+
+ ok = (type1.Attributes & TypeAttributes.SequentialLayout) ==
+ (type2.Attributes & TypeAttributes.SequentialLayout);
+ if (!ok) {
+ Verifier.Log.Write ("error", "Types attributes mismatch: SequentialLayout.", ImportanceLevel.HIGH);
+ }
+ res &= ok;
+
+ ok = (type1.Attributes & TypeAttributes.Serializable) ==
+ (type2.Attributes & TypeAttributes.Serializable);
+ if (!ok) {
+ Verifier.Log.Write ("error", "Types attributes mismatch: Serializable.", ImportanceLevel.HIGH);
+ }
+ res &= ok;
+
+ return res;
+ }
+
+ }
+
+
+
+
+ ////////////////////////////////
+ // Log
+ ////////////////////////////////
+
+ public enum ImportanceLevel : int {
+ LOW = 0, MEDIUM, HIGH
+ }
+
+
+ public interface ILogger {
+
+ void Write (string tag, string msg, ImportanceLevel importance);
+ void Write (string msg, ImportanceLevel level);
+ void Write (string tag, string msg);
+ void Write (string msg);
+ ImportanceLevel DefaultImportance {get; set;}
+ void Flush ();
+ void Close ();
+ }
+
+
+ public abstract class AbstractLogger : ILogger {
+ private ImportanceLevel defImportance = ImportanceLevel.MEDIUM;
+
+ public abstract void Write (string tag, string msg, ImportanceLevel importance);
+ public abstract void Write (string msg, ImportanceLevel level);
+
+ public virtual void Write (string tag, string msg)
+ {
+ Write (tag, msg, DefaultImportance);
+ }
+
+ public virtual void Write (string msg)
+ {
+ Write (msg, DefaultImportance);
+ }
+
+ public virtual ImportanceLevel DefaultImportance {
+ get {
+ return defImportance;
+ }
+ set {
+ defImportance = value < ImportanceLevel.LOW
+ ? ImportanceLevel.LOW
+ : value > ImportanceLevel.HIGH
+ ? ImportanceLevel.HIGH
+ : value;
+ }
+ }
+
+ public abstract void Flush ();
+ public abstract void Close ();
+
+ }
+
+
+
+ public class TextLogger : AbstractLogger {
+
+ private TextWriter writer;
+
+ public TextLogger (TextWriter writer)
+ {
+ if (writer == null)
+ throw new NullReferenceException ();
+
+ this.writer = writer;
+ }
+
+ private void DoWrite (string tag, string msg)
+ {
+ if (tag != null && tag.Length > 0) {
+ writer.WriteLine ("[{0}]\t{1}", tag, msg);
+ } else {
+ writer.WriteLine ("\t\t" + msg);
+ }
+ }
+
+ public override void Write (string tag, string msg, ImportanceLevel importance)
+ {
+ int v = Log.VerboseLevel;
+ switch (v) {
+ case 0 :
+ break;
+ case 1 :
+ if (importance >= ImportanceLevel.HIGH) {
+ DoWrite (tag, msg);
+ }
+ break;
+ case 2 :
+ if (importance >= ImportanceLevel.MEDIUM) {
+ DoWrite (tag, msg);
+ }
+ break;
+ case 3 :
+ DoWrite (tag, msg);
+ break;
+ default:
+ break;
+ }
+ }
+
+ public override void Write (string msg, ImportanceLevel importance)
+ {
+ Write (null, msg, importance);
+ }
+
+ public override void Flush ()
+ {
+ Console.Out.Flush ();
+ }
+
+ public override void Close ()
+ {
+ if (writer != Console.Out && writer != Console.Error) {
+ writer.Close ();
+ }
+ }
+ }
+
+
+
+ public sealed class Log {
+
+ private static int verbose = 3;
+
+ private ArrayList consumers;
+
+ public Log (bool useDefault)
+ {
+ consumers = new ArrayList ();
+ if (useDefault) AddConsumer (new TextLogger (Console.Out));
+ }
+
+ public Log () : this (true)
+ {
+ }
+
+
+ public static int VerboseLevel {
+ get {
+ return verbose;
+ }
+ set {
+ verbose = (value < 0)
+ ? 0
+ : (value > 3)
+ ? 3 : value;
+ }
+ }
+
+ public void AddConsumer (ILogger consumer)
+ {
+ consumers.Add (consumer);
+ }
+
+
+ public void Write (string tag, string msg, ImportanceLevel importance)
+ {
+ foreach (ILogger logger in consumers) {
+ if (tag == null || tag == "") {
+ logger.Write (msg, importance);
+ } else {
+ logger.Write (tag, msg, importance);
+ }
+ }
+ }
+
+ public void Write (string msg, ImportanceLevel importance)
+ {
+ Write (null, msg, importance);
+ }
+
+
+ public void Write (string tag, string msg)
+ {
+ foreach (ILogger logger in consumers) {
+ if (tag == null || tag == "") {
+ logger.Write (msg);
+ } else {
+ logger.Write (tag, msg);
+ }
+ }
+ }
+
+ public void Write (string msg)
+ {
+ Write (null, msg);
+ }
+
+
+ public void Flush ()
+ {
+ foreach (ILogger logger in consumers) {
+ logger.Flush ();
+ }
+ }
+
+
+ public void Close ()
+ {
+ foreach (ILogger logger in consumers) {
+ logger.Flush ();
+ logger.Close ();
+ }
+ }
+
+ }
+
+
+
+
+
+
+ ////////////////////////////////
+ // Main
+ ////////////////////////////////
+
+ public class Verifier {
+
+ public static readonly Log log = new Log ();
+ public static bool stopOnError = false;
+ public static bool ignoreMissingTypes = true;
+ public static bool checkOptionalFlags = true;
+
+ private static readonly IList excluded;
+
+ static Verifier ()
+ {
+ excluded = new ArrayList ();
+ excluded.Add ("<PrivateImplementationDetails>");
+ }
+
+
+ private Verifier ()
+ {
+ }
+
+ public static Log Log {
+ get {
+ return log;
+ }
+ }
+
+ public static IList Excluded {
+ get {
+ return excluded;
+ }
+ }
+
+
+
+ public static void Main (String [] args)
+ {
+ if (args.Length < 2) {
+ Console.WriteLine ("Usage: verifier assembly1 assembly2");
+ } else {
+ string name1 = args [0];
+ string name2 = args [1];
+
+ bool ok = false;
+
+ AssemblyStuff asm1 = new AssemblyStuff (name1);
+ AssemblyStuff asm2 = new AssemblyStuff (name2);
+ ok = asm1.Load ();
+ if (!ok) {
+ Console.WriteLine ("Unable to load assembly {0}.", name1);
+ Environment.Exit (-1);
+ }
+
+ ok = asm2.Load ();
+ if (!ok) {
+ Console.WriteLine ("Unable to load assembly {0}.", name2);
+ Environment.Exit (-1);
+ }
+
+
+ try {
+ ok = (asm1 == asm2);
+ } catch {
+ ok = false;
+ } finally {
+ Log.Close ();
+ }
+
+ if (!ok) {
+ Console.WriteLine ("--- not equal");
+ Environment.Exit (-1);
+ }
+ }
+ }
+
+ }
+
+
+}
+
diff --git a/mono/.cvsignore b/mono/.cvsignore
new file mode 100644
index 00000000000..282522db034
--- /dev/null
+++ b/mono/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/mono/Makefile.am b/mono/Makefile.am
index 89d68d86d83..589bffcb67e 100644
--- a/mono/Makefile.am
+++ b/mono/Makefile.am
@@ -1 +1,4 @@
-SUBDIRS = metadata dis \ No newline at end of file
+SUBDIRS = utils io-layer monoburg metadata cil dis \
+ arch monograph interpreter jit tests benchmark
+
+
diff --git a/mono/arch/.cvsignore b/mono/arch/.cvsignore
new file mode 100644
index 00000000000..0b27fc34173
--- /dev/null
+++ b/mono/arch/.cvsignore
@@ -0,0 +1,6 @@
+Makefile
+Makefile.in
+.deps
+.libs
+*.la
+*.lo \ No newline at end of file
diff --git a/mono/arch/ChangeLog b/mono/arch/ChangeLog
new file mode 100644
index 00000000000..cf08241dc60
--- /dev/null
+++ b/mono/arch/ChangeLog
@@ -0,0 +1,242 @@
+
+Mon Apr 22 12:57:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.h: added loop instructions and made x86_patch fully
+ useful.
+
+2002-04-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86/tramp.c (mono_create_trampoline): support internalcall
+ String constructors
+
+Sat Apr 6 16:29:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: fix advancement of argument position on the stack.
+
+Sat Mar 16 19:12:57 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: increase default allocated size for trampolines
+ and assert on overflow.
+
+2002-03-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86/tramp.c (mono_create_trampoline): dont use fld/fst to copy
+ R8 values
+
+Mon Mar 11 16:14:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.h: addex x86_clear_reg() and changed
+ x86_mov_reg_imm() to not check for imm == 0.
+
+Thu Feb 28 12:34:21 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: start handling of more complex marshaling stuff.
+
+2002-02-25 Sergey Chaban <serge@wildwestsoftware.com>
+
+ * arm: added ARM support code.
+ * Makefile.am: added arm to DIST_SUBDIRS.
+
+2002-02-24 Radek Doulik <rodo@ximian.com>
+
+ * ppc/tramp.c (mono_create_method_pointer): basic delegates
+ implementation, it works for simple delegates now and I am already
+ pretty close to have it working for every delegates, but I am
+ going to sleep and finish it tomorrow?
+ (mono_create_method_pointer): implements delegates with parameters
+ and return value
+
+2002-02-22 Jeffrey Stedfast <fejj@ximian.com>
+
+ * sparc/tramp.c (mono_create_trampoline): Much tinkering to get
+ the opcodes more correct. Still needs a lot of work.
+
+2002-02-19 Radek Doulik <rodo@ximian.com>
+
+ * ppc/tramp.c (emit_save_parameters): don't start saving 64bit values to
+ even registers
+ added stack saving for most arguments
+
+Tue Feb 19 20:19:38 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: avoid pointer arthmetric (pointed out by Serge).
+
+2002-02-17 Radek Doulik <rodo@ximian.com>
+
+ * ppc/tramp.c: fixed minimal stack size, fixed string parameters,
+ fix byte and half word parameters
+ (mono_string_new_wrapper): new helper function, cut&pasted from
+ x86, modified to check for NULL text to avoid branching in
+ generated code
+ (calculate_sizes): updated for string retval changes
+ (emit_call_and_store_retval): updated for string retval
+
+ * ppc/ppc-codegen.h (ppc_mr): added lhz, lbz, sth
+
+2002-02-16 Radek Doulik <rodo@ximian.com>
+
+ * ppc/tramp.c (emit_call_and_store_retval): support U2, I2, CHAR
+
+Mon Feb 11 18:40:04 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * sparc/*: sparc codegen header and some untested trampoline code.
+
+Mon Feb 11 12:32:35 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: fix handling of multiple marshaleed strings.
+ * x86/x86-codegen.h: some code to patch branch displacements.
+
+Fri Feb 1 16:03:00 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c, ppc/tramp.c: implement mono_method_pointer_get ().
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * x86/tramp.c (mono_create_trampoline): Do not try to create a
+ mono_string_new if the return value from the PInvoke code is
+ NULL.
+
+Mon Jan 14 11:50:16 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.c: added overflow condition code and some aliases
+ for the other ccs.
+
+Thu Jan 10 21:01:08 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: mono_create_trampoline (): the runtime argument is
+ needed to handle correctly delegates, the previous change in handling
+ the string return type broke them.
+
+Tue Jan 8 22:38:41 MST 2002 Matt Kimball <matt@kimball.net>
+
+ * x86/tramp.c: handle strings returned from functions in external
+ libraries by converting to a Mono string object after the pinvoke'd
+ function returns
+
+Sat Jan 5 15:51:06 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: handle short integer return types.
+
+Thu Dec 20 20:13:07 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: fix create_method_pointer() to pass the arguments
+ correctly and add check for overflow.
+
+Thu Dec 13 15:56:53 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.h: x86_mov_memindex_imm() added.
+
+2001-11-29 Radek Doulik <rodo@ximian.com>
+
+ * ppc/tramp.c: use r12 which is volatile instead of non-volatile
+ r14 to avoid saving
+
+ * Makefile.am (libmonoarch_la_LIBADD): added ppc to DIST_SUBDIRS
+ generate libmonoarch for ppc
+
+Tue Nov 27 15:24:07 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x96/x86-codegen.c: x86_lea_memindex() added.
+
+Thu Nov 15 17:41:01 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: handle enums with underlying type different from int32.
+
+Wed Nov 14 19:21:26 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: handle boolean as a return value.
+ * x96/x86-codegen.c: x86_widen_memindex() added.
+
+2001-11-07 Miguel de Icaza <miguel@ximian.com>
+
+ * x86/tramp.c: Include stdlib to kill warning.
+
+Mon Oct 22 15:20:14 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: handle boolean, u1 and i1 as return values.
+
+Wed Oct 10 16:07:24 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.c: added x86_set_{reg,mem,membase}.
+
+Mon Oct 8 16:13:07 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: remove mono_get_ansi_string () and use
+ mono_string_to_utf8 () instead.
+
+Thu Oct 4 19:09:13 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: allow marshalling valuetypes if they are
+ 4 bytes long.
+
+Mon Oct 1 18:48:27 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: fix thinko (s/SUB/ADD/) in stack adjustment
+ and avoid a couple of unnecessary instructions.
+
+Fri Sep 28 19:43:12 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: marshal valuetypes that are enums.
+
+Thu Sep 27 15:34:37 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.h: in memindex operand you can use X86_NOBASEREG
+ as basereg.
+
+Wed Sep 26 16:29:36 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.h: added memindex addressing mode encoding
+ (and mov to/from register opcodes).
+
+Mon Sep 24 18:49:01 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: don't change a MONO_TYPE_STRING to a char*
+ when it's an argument to an internalcall.
+
+Sun Sep 23 13:44:57 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/tramp.c: handle MONO_TYPE_CLASS in trampolines.
+
+2001-09-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86/x86-codegen.h (x86_breakpoint): added.
+
+Tue Sep 18 13:23:59 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.h: remove C++ comments.
+
+2001-09-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86/x86-codegen.h (x86_alu_reg_reg): replaced src/dest
+
+Mon Sep 10 17:26:06 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am, x86/Makefile.am: conditional compile logic
+ to make porting to different targets easier.
+
+Fri Sep 7 18:43:06 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.h: fixes and x86_mov_membase_imm ().
+ * x86/tramp.c: implemented mono_create_method_pointer ():
+ creates a native pointer to a method implementation that can be
+ used as a normal C callback.
+
+Thu Sep 6 15:38:00 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.h: added x86_rdtsc() and fixes.
+ * x86/tramp.c: create trampolines to call pinvoke methods.
+ * x86/Makefile.am: create a libmonoarch convenience library.
+
+Mon Aug 27 09:29:00 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.h: fix x86_call_code (). x86_mov_regp_reg () added.
+
+Sat Aug 18 12:40:32 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.h: fix a couple of buglets and add x86_regp_emit().
+
+Wed Aug 8 15:30:05 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86/x86-codegen.h, x86/test.c: added x86 code emitter with
+ test.
+
diff --git a/mono/arch/Makefile.am b/mono/arch/Makefile.am
new file mode 100644
index 00000000000..5f14ee96d90
--- /dev/null
+++ b/mono/arch/Makefile.am
@@ -0,0 +1,13 @@
+SUBDIRS = $(arch_target)
+DIST_SUBDIRS = x86 ppc sparc arm
+
+INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)
+
+noinst_LTLIBRARIES = libmonoarch.la
+
+libmonoarch_la_SOURCES = unknown.c
+
+libmonoarch_la_LIBADD = $(arch_target)/libmonoarch-$(arch_target).la
+
+EXTRA_DIST = ChangeLog
+
diff --git a/mono/arch/arm/.cvsignore b/mono/arch/arm/.cvsignore
new file mode 100644
index 00000000000..3a221ac7b8c
--- /dev/null
+++ b/mono/arch/arm/.cvsignore
@@ -0,0 +1,13 @@
+Makefile
+Makefile.in
+.deps
+.libs
+*.o
+*.la
+*.lo
+*.lib
+*.obj
+*.exe
+*.dll
+arm_dpimacros.h
+fixeol.sh \ No newline at end of file
diff --git a/mono/arch/arm/Makefile.am b/mono/arch/arm/Makefile.am
new file mode 100644
index 00000000000..afce5cd673d
--- /dev/null
+++ b/mono/arch/arm/Makefile.am
@@ -0,0 +1,22 @@
+
+INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)
+
+noinst_LTLIBRARIES = libmonoarch-arm.la
+
+BUILT_SOURCES = arm_dpimacros.h
+
+
+libmonoarch_arm_la_SOURCES = $(BUILT_SOURCES) \
+ tramp.c \
+ arm-codegen.c \
+ arm-codegen.h \
+ arm-dis.c \
+ arm-dis.h
+
+arm_dpimacros.h: dpiops.sh mov_macros.th dpi_macros.th cmp_macros.th
+ bash ./dpiops.sh
+
+CLEANFILES = $(BUILT_SOURCES)
+
+EXTRA_DIST = dpiops.sh mov_macros.th dpi_macros.th cmp_macros.th
+
diff --git a/mono/arch/arm/arm-codegen.c b/mono/arch/arm/arm-codegen.c
new file mode 100644
index 00000000000..88d572afe13
--- /dev/null
+++ b/mono/arch/arm/arm-codegen.c
@@ -0,0 +1,193 @@
+/*
+ * arm-codegen.c
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+#include "arm-codegen.h"
+
+
+arminstr_t* arm_emit_std_prologue(arminstr_t* p, unsigned int local_size) {
+ ARM_MOV_REG_REG(p, ARMREG_IP, ARMREG_SP);
+
+ /* save args */
+ ARM_PUSH(p, (1 << ARMREG_A1)
+ | (1 << ARMREG_A2)
+ | (1 << ARMREG_A3)
+ | (1 << ARMREG_A4));
+
+ ARM_PUSH(p, (1U << ARMREG_IP) | (1U << ARMREG_LR));
+
+ if (local_size != 0) {
+ if ((local_size & (~0xFF)) == 0) {
+ ARM_SUB_REG_IMM8(p, ARMREG_SP, ARMREG_SP, local_size);
+ } else {
+ /* TODO: optimize */
+ p = arm_mov_reg_imm32(p, ARMREG_IP, local_size);
+ ARM_SUB_REG_REG(p, ARMREG_SP, ARMREG_SP, ARMREG_IP);
+ ARM_ADD_REG_IMM8(p, ARMREG_IP, ARMREG_IP, sizeof(armword_t));
+ ARM_LDR_REG_REG(p, ARMREG_IP, ARMREG_SP, ARMREG_IP);
+ }
+ }
+
+ return p;
+}
+
+arminstr_t* arm_emit_std_epilogue(arminstr_t* p, unsigned int local_size, int pop_regs) {
+ if (local_size != 0) {
+ if ((local_size & (~0xFF)) == 0) {
+ ARM_ADD_REG_IMM8(p, ARMREG_SP, ARMREG_SP, local_size);
+ } else {
+ /* TODO: optimize */
+ p = arm_mov_reg_imm32(p, ARMREG_IP, local_size);
+ ARM_ADD_REG_REG(p, ARMREG_SP, ARMREG_SP, ARMREG_IP);
+ }
+ }
+
+ ARM_POP_NWB(p, (1 << ARMREG_SP) | (1 << ARMREG_PC) | (pop_regs & 0x3FF));
+
+ return p;
+}
+
+
+/* do not push A1-A4 */
+arminstr_t* arm_emit_lean_prologue(arminstr_t* p, unsigned int local_size, int push_regs) {
+ ARM_MOV_REG_REG(p, ARMREG_IP, ARMREG_SP);
+ /* push_regs upto R10 will be saved */
+ ARM_PUSH(p, (1U << ARMREG_IP) | (1U << ARMREG_LR) | (push_regs & 0x3FF));
+
+ if (local_size != 0) {
+ if ((local_size & (~0xFF)) == 0) {
+ ARM_SUB_REG_IMM8(p, ARMREG_SP, ARMREG_SP, local_size);
+ } else {
+ /* TODO: optimize */
+ p = arm_mov_reg_imm32(p, ARMREG_IP, local_size);
+ ARM_SUB_REG_REG(p, ARMREG_SP, ARMREG_SP, ARMREG_IP);
+ /* restore IP from stack */
+ ARM_ADD_REG_IMM8(p, ARMREG_IP, ARMREG_IP, sizeof(armword_t));
+ ARM_LDR_REG_REG(p, ARMREG_IP, ARMREG_SP, ARMREG_IP);
+ }
+ }
+
+ return p;
+}
+
+/* Bit scan forward. */
+int arm_bsf(armword_t val) {
+ int i;
+ armword_t mask;
+
+ if (val == 0) return 0;
+ for (i=1, mask=1; (i <= 8 * sizeof(armword_t)) && ((val & mask) == 0); ++i, mask<<=1);
+
+ return i;
+}
+
+
+int arm_is_power_of_2(armword_t val) {
+ return ((val & (val-1)) == 0);
+}
+
+
+/*
+ * returns:
+ * 1 - unable to represent
+ * positive even number - MOV-representable
+ * negative even number - MVN-representable
+ */
+int calc_arm_mov_const_shift(armword_t val) {
+ armword_t mask;
+ int res = 1, shift;
+
+ for (shift=0; shift < 32; shift+=2) {
+ mask = ARM_SCALE(0xFF, shift);
+ if ((val & (~mask)) == 0) {
+ res = shift;
+ break;
+ }
+ if (((~val) & (~mask)) == 0) {
+ res = -shift - 2;
+ break;
+ }
+ }
+
+ return res;
+}
+
+
+int is_arm_const(armword_t val) {
+ int res;
+ res = arm_is_power_of_2(val);
+ if (!res) {
+ res = calc_arm_mov_const_shift(val);
+ res = !(res < 0 || res == 1);
+ }
+ return res;
+}
+
+
+int arm_const_steps(armword_t val) {
+ int shift, steps = 0;
+
+ while (val != 0) {
+ shift = (arm_bsf(val) - 1) & (~1);
+ val &= ~(0xFF << shift);
+ ++steps;
+ }
+ return steps;
+}
+
+
+/*
+ * ARM cannot load arbitrary 32-bit constants directly into registers;
+ * widely used work-around for this is to store constants into a
+ * PC-addressable pool and use LDR instruction with PC-relative address
+ * to load constant into register. Easiest way to implement this is to
+ * embed constant inside a function with unconditional branch around it.
+ * The above method is not used at the moment.
+ * This routine always emits sequence of instructions to generate
+ * requested constant. In the worst case it takes 4 instructions to
+ * synthesize a constant - 1 MOV and 3 subsequent ORRs.
+ */
+arminstr_t* arm_mov_reg_imm32_cond(arminstr_t* p, int reg, armword_t imm32, int cond) {
+ int mov_op;
+ int step_op;
+ int snip;
+ int shift = calc_arm_mov_const_shift(imm32);
+
+ if ((shift & 0x80000001) != 1) {
+ if (shift >= 0) {
+ ARM_MOV_REG_IMM_COND(p, reg, imm32 >> ((32 - shift) & 31), shift >> 1, cond);
+ } else {
+ ARM_MVN_REG_IMM_COND(p, reg, (imm32 ^ (~0)) >> ((32 + 2 + shift) & 31), (-shift - 2) >> 1, cond);
+ }
+ } else {
+ mov_op = ARMOP_MOV;
+ step_op = ARMOP_ORR;
+
+ if (arm_const_steps(imm32) > arm_const_steps(~imm32)) {
+ mov_op = ARMOP_MVN;
+ step_op = ARMOP_SUB;
+ imm32 = ~imm32;
+ }
+
+ shift = (arm_bsf(imm32) - 1) & (~1);
+ snip = imm32 & (0xFF << shift);
+ ARM_EMIT(p, ARM_DEF_DPI_IMM_COND(snip >> shift, (32 - shift) >> 1, reg, 0, 0, mov_op, cond));
+
+ while ((imm32 ^= snip) != 0) {
+ shift = (arm_bsf(imm32) - 1) & (~1);
+ snip = imm32 & (0xFF << shift);
+ ARM_EMIT(p, ARM_DEF_DPI_IMM_COND(snip >> shift, (32 - shift) >> 1, reg, reg, 0, step_op, cond));
+ }
+ }
+
+ return p;
+}
+
+
+arminstr_t* arm_mov_reg_imm32(arminstr_t* p, int reg, armword_t imm32) {
+ return arm_mov_reg_imm32_cond(p, reg, imm32, ARMCOND_AL);
+}
+
+
+
diff --git a/mono/arch/arm/arm-codegen.h b/mono/arch/arm/arm-codegen.h
new file mode 100644
index 00000000000..3d6c7988a60
--- /dev/null
+++ b/mono/arch/arm/arm-codegen.h
@@ -0,0 +1,748 @@
+/*
+ * arm-codegen.h
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+
+#ifndef ARM_H
+#define ARM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef unsigned int arminstr_t;
+typedef unsigned int armword_t;
+
+/* Helper functions */
+arminstr_t* arm_emit_std_prologue(arminstr_t* p, unsigned int local_size);
+arminstr_t* arm_emit_std_epilogue(arminstr_t* p, unsigned int local_size, int pop_regs);
+arminstr_t* arm_emit_lean_prologue(arminstr_t* p, unsigned int local_size, int push_regs);
+int arm_is_power_of_2(armword_t val);
+int calc_arm_mov_const_shift(armword_t val);
+int is_arm_const(armword_t val);
+int arm_bsf(armword_t val);
+arminstr_t* arm_mov_reg_imm32_cond(arminstr_t* p, int reg, armword_t imm32, int cond);
+arminstr_t* arm_mov_reg_imm32(arminstr_t* p, int reg, armword_t imm32);
+
+
+
+#if defined(_MSC_VER) || defined(__CC_NORCROFT)
+ void __inline _arm_emit(arminstr_t** p, arminstr_t i) {**p = i; (*p)++;}
+# define ARM_EMIT(p, i) _arm_emit((arminstr_t**)&p, (arminstr_t)(i))
+#else
+# define ARM_EMIT(p, i) *(arminstr_t*)p = (arminstr_t)i; ((arminstr_t*)p)++
+#endif
+
+/* even_scale = rot << 1 */
+#define ARM_SCALE(imm8, even_scale) ( ((imm8) >> (even_scale)) | ((imm8) << (32 - even_scale)) )
+
+
+
+typedef enum {
+ ARMREG_R0 = 0,
+ ARMREG_R1,
+ ARMREG_R2,
+ ARMREG_R3,
+ ARMREG_R4,
+ ARMREG_R5,
+ ARMREG_R6,
+ ARMREG_R7,
+ ARMREG_R8,
+ ARMREG_R9,
+ ARMREG_R10,
+ ARMREG_R11,
+ ARMREG_R12,
+ ARMREG_R13,
+ ARMREG_R14,
+ ARMREG_R15,
+
+
+ /* aliases */
+ /* args */
+ ARMREG_A1 = ARMREG_R0,
+ ARMREG_A2 = ARMREG_R1,
+ ARMREG_A3 = ARMREG_R2,
+ ARMREG_A4 = ARMREG_R3,
+
+ /* local vars */
+ ARMREG_V1 = ARMREG_R4,
+ ARMREG_V2 = ARMREG_R5,
+ ARMREG_V3 = ARMREG_R6,
+ ARMREG_V4 = ARMREG_R7,
+ ARMREG_V5 = ARMREG_R8,
+ ARMREG_V6 = ARMREG_R9,
+ ARMREG_V7 = ARMREG_R10,
+
+ ARMREG_FP = ARMREG_R11,
+ ARMREG_IP = ARMREG_R12,
+ ARMREG_SP = ARMREG_R13,
+ ARMREG_LR = ARMREG_R14,
+ ARMREG_PC = ARMREG_R15,
+
+ /* co-processor */
+ ARMREG_CR0 = 0,
+ ARMREG_CR1,
+ ARMREG_CR2,
+ ARMREG_CR3,
+ ARMREG_CR4,
+ ARMREG_CR5,
+ ARMREG_CR6,
+ ARMREG_CR7,
+ ARMREG_CR8,
+ ARMREG_CR9,
+ ARMREG_CR10,
+ ARMREG_CR11,
+ ARMREG_CR12,
+ ARMREG_CR13,
+ ARMREG_CR14,
+ ARMREG_CR15,
+
+ ARMREG_MAX = ARMREG_R15
+} ARMReg;
+
+/* number of argument registers */
+#define ARM_NUM_ARG_REGS 4
+
+/* bitvector for all argument regs (A1-A4) */
+#define ARM_ALL_ARG_REGS \
+ (1 << ARMREG_A1) | (1 << ARMREG_A2) | (1 << ARMREG_A3) | (1 << ARMREG_A4)
+
+
+typedef enum {
+ ARMCOND_EQ = 0x0, /* Equal */
+ ARMCOND_NE = 0x1, /* Not equal, or unordered */
+ ARMCOND_CS = 0x2, /* Carry set */
+ ARMCOND_HS = ARMCOND_CS, /* Unsigned higher or same */
+ ARMCOND_CC = 0x3, /* Carry clear */
+ ARMCOND_LO = ARMCOND_CC, /* Unsigned lower */
+ ARMCOND_MI = 0x4, /* Negative */
+ ARMCOND_PL = 0x5, /* Positive or zero */
+ ARMCOND_VS = 0x6, /* Overflow */
+ ARMCOND_VC = 0x7, /* No overflow */
+ ARMCOND_HI = 0x8, /* Unsigned higher */
+ ARMCOND_LS = 0x9, /* Unsigned lower or same */
+ ARMCOND_GE = 0xA, /* Signed greater than or equal */
+ ARMCOND_LT = 0xB, /* Signed less than */
+ ARMCOND_GT = 0xC, /* Signed greater than */
+ ARMCOND_LE = 0xD, /* Signed less than or equal */
+ ARMCOND_AL = 0xE, /* Always */
+ ARMCOND_NV = 0xF, /* Never */
+
+ ARMCOND_SHIFT = 28
+} ARMCond;
+
+#define ARMCOND_MASK (ARMCOND_NV << ARMCOND_SHIFT)
+
+#define ARM_DEF_COND(cond) (((cond) & 0xF) << ARMCOND_SHIFT)
+
+
+
+typedef enum {
+ ARMSHIFT_LSL = 0,
+ ARMSHIFT_LSR = 1,
+ ARMSHIFT_ASR = 2,
+ ARMSHIFT_ROR = 3,
+
+ ARMSHIFT_ASL = ARMSHIFT_LSL
+ /* rrx = (ror, 1) */
+} ARMShiftType;
+
+
+typedef struct {
+ armword_t PSR_c : 8;
+ armword_t PSR_x : 8;
+ armword_t PSR_s : 8;
+ armword_t PSR_f : 8;
+} ARMPSR;
+
+typedef enum {
+ ARMOP_AND = 0x0,
+ ARMOP_EOR = 0x1,
+ ARMOP_SUB = 0x2,
+ ARMOP_RSB = 0x3,
+ ARMOP_ADD = 0x4,
+ ARMOP_ADC = 0x5,
+ ARMOP_SBC = 0x6,
+ ARMOP_RSC = 0x7,
+ ARMOP_TST = 0x8,
+ ARMOP_TEQ = 0x9,
+ ARMOP_CMP = 0xa,
+ ARMOP_CMN = 0xb,
+ ARMOP_ORR = 0xc,
+ ARMOP_MOV = 0xd,
+ ARMOP_BIC = 0xe,
+ ARMOP_MVN = 0xf,
+
+
+ /* not really opcodes */
+
+ ARMOP_STR = 0x0,
+ ARMOP_LDR = 0x1,
+
+ /* ARM2+ */
+ ARMOP_MUL = 0x0, /* Rd := Rm*Rs */
+ ARMOP_MLA = 0x1, /* Rd := (Rm*Rs)+Rn */
+
+ /* ARM3M+ */
+ ARMOP_UMUL = 0x4,
+ ARMOP_UMLAL = 0x5,
+ ARMOP_SMULL = 0x6,
+ ARMOP_SMLAL = 0x7
+} ARMOpcode;
+
+
+/* Generic form - all ARM instructions are conditional. */
+typedef struct {
+ arminstr_t icode : 28;
+ arminstr_t cond : 4;
+} ARMInstrGeneric;
+
+
+
+/* Branch or Branch with Link instructions. */
+typedef struct {
+ arminstr_t offset : 24;
+ arminstr_t link : 1;
+ arminstr_t tag : 3; /* 1 0 1 */
+ arminstr_t cond : 4;
+} ARMInstrBR;
+
+#define ARM_BR_ID 5
+#define ARM_BR_MASK 7 << 25
+#define ARM_BR_TAG ARM_BR_ID << 25
+
+#define ARM_DEF_BR(offs, l, cond) ((offs) | ((l) << 24) | (ARM_BR_TAG) | (cond << ARMCOND_SHIFT))
+
+/* branch */
+#define ARM_B_COND(p, cond, offset) ARM_EMIT(p, ARM_DEF_BR(offset, 0, cond))
+#define ARM_B(p, offs) ARM_B_COND((p), ARMCOND_AL, (offs))
+/* branch with link */
+#define ARM_BL_COND(p, cond, offset) ARM_EMIT(p, ARM_DEF_BR(offset, 1, cond))
+#define ARM_BL(p, offs) ARM_BL_COND((p), ARMCOND_AL, (offs))
+
+
+
+/* Data Processing Instructions - there are 3 types. */
+
+typedef struct {
+ arminstr_t imm : 8;
+ arminstr_t rot : 4;
+} ARMDPI_op2_imm;
+
+typedef struct {
+ arminstr_t rm : 4;
+ arminstr_t tag : 1; /* 0 - immediate shift, 1 - reg shift */
+ arminstr_t type : 2; /* shift type - logical, arithmetic, rotate */
+} ARMDPI_op2_reg_shift;
+
+
+/* op2 is reg shift by imm */
+typedef union {
+ ARMDPI_op2_reg_shift r2;
+ struct {
+ arminstr_t _dummy_r2 : 7;
+ arminstr_t shift : 5;
+ } imm;
+} ARMDPI_op2_reg_imm;
+
+/* op2 is reg shift by reg */
+typedef union {
+ ARMDPI_op2_reg_shift r2;
+ struct {
+ arminstr_t _dummy_r2 : 7;
+ arminstr_t pad : 1; /* always 0, to differentiate from HXFER etc. */
+ arminstr_t rs : 4;
+ } reg;
+} ARMDPI_op2_reg_reg;
+
+/* Data processing instrs */
+typedef union {
+ ARMDPI_op2_imm op2_imm;
+
+ ARMDPI_op2_reg_shift op2_reg;
+ ARMDPI_op2_reg_imm op2_reg_imm;
+ ARMDPI_op2_reg_reg op2_reg_reg;
+
+ struct {
+ arminstr_t op2 : 12; /* raw operand 2 */
+ arminstr_t rd : 4; /* destination reg */
+ arminstr_t rn : 4; /* first operand reg */
+ arminstr_t s : 1; /* S-bit controls PSR update */
+ arminstr_t opcode : 4; /* arithmetic/logic operation */
+ arminstr_t type : 1; /* type of op2, 0 = register, 1 = immediate */
+ arminstr_t tag : 2; /* 0 0 */
+ arminstr_t cond : 4;
+ } all;
+} ARMInstrDPI;
+
+#define ARM_DPI_ID 0
+#define ARM_DPI_MASK 3 << 26
+#define ARM_DPI_TAG ARM_DPI_ID << 26
+
+#define ARM_DEF_DPI_IMM_COND(imm8, rot, rd, rn, s, op, cond) \
+ ((imm8) & 0xFF) | \
+ (((rot) & 0xF) << 8) | \
+ ((rd) << 12) | \
+ ((rn) << 16) | \
+ ((s) << 20) | \
+ ((op) << 21) | \
+ (1 << 25) | \
+ (ARM_DPI_TAG) | \
+ ARM_DEF_COND(cond)
+
+
+#define ARM_DEF_DPI_IMM(imm8, rot, rd, rn, s, op) \
+ ARM_DEF_DPI_IMM_COND(imm8, rot, rd, rn, s, op, ARMCOND_AL)
+
+
+#define ARM_DPIOP_REG_IMM8ROT_COND(p, op, rd, rn, imm8, rot, cond) \
+ ARM_EMIT(p, ARM_DEF_DPI_IMM_COND((imm8), ((rot) >> 1), (rd), (rn), 0, (op), cond))
+#define ARM_DPIOP_S_REG_IMM8ROT_COND(p, op, rd, rn, imm8, rot, cond) \
+ ARM_EMIT(p, ARM_DEF_DPI_IMM_COND((imm8), ((rot) >> 1), (rd), (rn), 1, (op), cond))
+
+
+
+#define ARM_DEF_DPI_REG_IMMSHIFT_COND(rm, shift_type, imm_shift, rd, rn, s, op, cond) \
+ (rm) | \
+ ((shift_type & 3) << 5) | \
+ (((imm_shift) & 0x1F) << 7) | \
+ ((rd) << 12) | \
+ ((rn) << 16) | \
+ ((s) << 20) | \
+ ((op) << 21) | \
+ (ARM_DPI_TAG) | \
+ ARM_DEF_COND(cond)
+
+#define ARM_DPIOP_REG_IMMSHIFT_COND(p, op, rd, rn, rm, shift_t, imm_shift, cond) \
+ ARM_EMIT(p, ARM_DEF_DPI_REG_IMMSHIFT_COND((rm), shift_t, imm_shift, (rd), (rn), 0, (op), cond))
+
+#define ARM_DPIOP_S_REG_IMMSHIFT_COND(p, op, rd, rn, rm, shift_t, imm_shift, cond) \
+ ARM_EMIT(p, ARM_DEF_DPI_REG_IMMSHIFT_COND((rm), shift_t, imm_shift, (rd), (rn), 1, (op), cond))
+
+#define ARM_DPIOP_REG_REG_COND(p, op, rd, rn, rm, cond) \
+ ARM_EMIT(p, ARM_DEF_DPI_REG_IMMSHIFT_COND((rm), ARMSHIFT_LSL, 0, (rd), (rn), 0, (op), cond))
+
+#define ARM_DPIOP_S_REG_REG_COND(p, op, rd, rn, rm, cond) \
+ ARM_EMIT(p, ARM_DEF_DPI_REG_IMMSHIFT_COND((rm), ARMSHIFT_LSL, 0, (rd), (rn), 1, (op), cond))
+
+
+
+
+
+/* Multiple register transfer. */
+typedef struct {
+ arminstr_t reg_list : 16; /* bitfield */
+ arminstr_t rn : 4; /* base reg */
+ arminstr_t ls : 1; /* load(1)/store(0) */
+ arminstr_t wb : 1; /* write-back "!" */
+ arminstr_t s : 1; /* restore PSR, force user bit */
+ arminstr_t u : 1; /* up/down */
+ arminstr_t p : 1; /* pre(1)/post(0) index */
+ arminstr_t tag : 3; /* 1 0 0 */
+ arminstr_t cond : 4;
+} ARMInstrMRT;
+
+#define ARM_MRT_ID 4
+#define ARM_MRT_MASK 7 << 25
+#define ARM_MRT_TAG ARM_MRT_ID << 25
+
+#define ARM_DEF_MRT(regs, rn, l, w, s, u, p, cond) \
+ (regs) | \
+ (rn << 16) | \
+ (l << 20) | \
+ (w << 21) | \
+ (s << 22) | \
+ (u << 23) | \
+ (p << 24) | \
+ (ARM_MRT_TAG) | \
+ ARM_DEF_COND(cond)
+
+
+
+/* stmdb sp!, {regs} */
+#define ARM_PUSH(p, regs) ARM_EMIT(p, ARM_DEF_MRT(regs, ARMREG_SP, 0, 1, 0, 0, 1, ARMCOND_AL))
+
+/* ldmia sp!, {regs} */
+#define ARM_POP(p, regs) ARM_EMIT(p, ARM_DEF_MRT(regs, ARMREG_SP, 1, 1, 0, 1, 0, ARMCOND_AL))
+
+/* ldmia sp, {regs} ; (no write-back) */
+#define ARM_POP_NWB(p, regs) ARM_EMIT(p, ARM_DEF_MRT(regs, ARMREG_SP, 1, 0, 0, 1, 0, ARMCOND_AL))
+
+
+
+/* Multiply instructions */
+typedef struct {
+ arminstr_t rm : 4;
+ arminstr_t tag2 : 4; /* 9 */
+ arminstr_t rs : 4;
+ arminstr_t rn : 4;
+ arminstr_t rd : 4;
+ arminstr_t s : 1;
+ arminstr_t opcode : 3;
+ arminstr_t tag : 4;
+ arminstr_t cond : 4;
+} ARMInstrMul;
+
+#define ARM_MUL_ID 0
+#define ARM_MUL_ID2 9
+#define ARM_MUL_MASK ((0xF << 24) | (0xF << 4))
+#define ARM_MUL_TAG ((ARM_MUL_ID << 24) | (ARM_MUL_ID2 << 4))
+
+
+/* Word/byte transfer */
+typedef union {
+ ARMDPI_op2_reg_imm op2_reg_imm;
+ struct {
+ arminstr_t op2_imm : 12;
+ arminstr_t rd : 4;
+ arminstr_t rn : 4;
+ arminstr_t ls : 1;
+ arminstr_t wb : 1;
+ arminstr_t b : 1;
+ arminstr_t u : 1;
+ arminstr_t p : 1; /* post-index(0) / pre-index(1) */
+ arminstr_t type : 1; /* imm(0) / register(1) */
+ arminstr_t tag : 2; /* 0 1 */
+ arminstr_t cond : 4;
+ } all;
+} ARMInstrWXfer;
+
+#define ARM_WXFER_ID 1
+#define ARM_WXFER_MASK 3 << 26
+#define ARM_WXFER_TAG ARM_WXFER_ID << 26
+
+
+#define ARM_DEF_WXFER_IMM(imm12, rd, rn, ls, wb, b, p, cond) \
+ ((((int)imm12) < 0) ? -(int)(imm12) : (imm12)) | \
+ ((rd) << 12) | \
+ ((rn) << 16) | \
+ ((ls) << 20) | \
+ ((wb) << 21) | \
+ ((b) << 22) | \
+ (((int)(imm12) >= 0) << 23) | \
+ ((p) << 24) | \
+ ARM_WXFER_TAG | \
+ ARM_DEF_COND(cond)
+
+#define ARM_WXFER_MAX_OFFS 0xFFF
+
+/* this macro checks imm12 bounds */
+#define ARM_EMIT_WXFER_IMM(ptr, imm12, rd, rn, ls, wb, b, p, cond) \
+ do { \
+ int _imm12 = (int)(imm12) < -ARM_WXFER_MAX_OFFS \
+ ? -ARM_WXFER_MAX_OFFS \
+ : (int)(imm12) > ARM_WXFER_MAX_OFFS \
+ ? ARM_WXFER_MAX_OFFS \
+ : (int)(imm12); \
+ ARM_EMIT((ptr), \
+ ARM_DEF_WXFER_IMM(_imm12, (rd), (rn), (ls), (wb), (b), (p), (cond))); \
+ } while (0)
+
+
+/* LDRx */
+/* immediate offset, post-index */
+#define ARM_LDR_IMM_POST_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT(p, ARM_DEF_WXFER_IMM(imm, rd, rn, ARMOP_LDR, 0, 0, 0, cond))
+
+#define ARM_LDR_IMM_POST(p, rd, rn, imm) ARM_LDR_IMM_POST_COND(p, rd, rn, imm, ARMCOND_AL)
+
+#define ARM_LDRB_IMM_POST_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT(p, ARM_DEF_WXFER_IMM(imm, rd, rn, ARMOP_LDR, 0, 1, 0, cond))
+
+#define ARM_LDRB_IMM_POST(p, rd, rn, imm) ARM_LDRB_IMM_POST_COND(p, rd, rn, imm, ARMCOND_AL)
+
+/* immediate offset, pre-index */
+#define ARM_LDR_IMM_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT(p, ARM_DEF_WXFER_IMM(imm, rd, rn, ARMOP_LDR, 0, 0, 1, cond))
+
+#define ARM_LDR_IMM(p, rd, rn, imm) ARM_LDR_IMM_COND(p, rd, rn, imm, ARMCOND_AL)
+
+#define ARM_LDRB_IMM_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT(p, ARM_DEF_WXFER_IMM(imm, rd, rn, ARMOP_LDR, 0, 1, 1, cond))
+
+#define ARM_LDRB_IMM(p, rd, rn, imm) ARM_LDRB_IMM_COND(p, rd, rn, imm, ARMCOND_AL)
+
+/* STRx */
+/* immediate offset, post-index */
+#define ARM_STR_IMM_POST_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT(p, ARM_DEF_WXFER_IMM(imm, rd, rn, ARMOP_STR, 0, 0, 0, cond))
+
+#define ARM_STR_IMM_POST(p, rd, rn, imm) ARM_STR_IMM_POST_COND(p, rd, rn, imm, ARMCOND_AL)
+
+#define ARM_STRB_IMM_POST_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT(p, ARM_DEF_WXFER_IMM(imm, rd, rn, ARMOP_STR, 0, 1, 0, cond))
+
+#define ARM_STRB_IMM_POST(p, rd, rn, imm) ARM_STRB_IMM_POST_COND(p, rd, rn, imm, ARMCOND_AL)
+
+/* immediate offset, pre-index */
+#define ARM_STR_IMM_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT_WXFER_IMM(p, imm, rd, rn, ARMOP_STR, 0, 0, 1, cond)
+/* ARM_EMIT(p, ARM_DEF_WXFER_IMM(imm, rd, rn, ARMOP_STR, 0, 0, 1, cond)) */
+
+#define ARM_STR_IMM(p, rd, rn, imm) ARM_STR_IMM_COND(p, rd, rn, imm, ARMCOND_AL)
+
+#define ARM_STRB_IMM_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT(p, ARM_DEF_WXFER_IMM(imm, rd, rn, ARMOP_STR, 0, 1, 1, cond))
+
+#define ARM_STRB_IMM(p, rd, rn, imm) ARM_STRB_IMM_COND(p, rd, rn, imm, ARMCOND_AL)
+
+
+
+#define ARM_DEF_WXFER_REG_REG(rm, shift_type, shift, rd, rn, ls, wb, b, p, cond) \
+ (rm) | \
+ ((shift_type) << 5) | \
+ ((shift) << 7) | \
+ ((rd) << 12) | \
+ ((rn) << 16) | \
+ ((ls) << 20) | \
+ ((wb) << 21) | \
+ ((b) << 22) | \
+ ((p) << 24) | \
+ (1 << 25) | \
+ ARM_WXFER_TAG | \
+ ARM_DEF_COND(cond)
+
+
+#define ARM_LDR_REG_REG_SHIFT_COND(p, rd, rn, rm, shift_type, shift, cond) \
+ ARM_EMIT(p, ARM_DEF_WXFER_REG_REG(rm, shift_type, shift, rd, rn, ARMOP_LDR, 0, 0, 1, cond))
+#define ARM_LDR_REG_REG_SHIFT(p, rd, rn, rm, shift_type, shift) \
+ ARM_LDR_REG_REG_SHIFT_COND(p, rd, rn, rm, shift_type, shift, ARMCOND_AL)
+#define ARM_LDR_REG_REG(p, rd, rn, rm) \
+ ARM_LDR_REG_REG_SHIFT(p, rd, rn, rm, ARMSHIFT_LSL, 0)
+
+
+
+/* Half-word or byte (signed) transfer. */
+typedef struct {
+ arminstr_t rm : 4; /* imm_lo */
+ arminstr_t tag3 : 1; /* 1 */
+ arminstr_t h : 1; /* half-word or byte */
+ arminstr_t s : 1; /* sign-extend or zero-extend */
+ arminstr_t tag2 : 1; /* 1 */
+ arminstr_t imm_hi : 4;
+ arminstr_t rd : 4;
+ arminstr_t rn : 4;
+ arminstr_t ls : 1;
+ arminstr_t wb : 1;
+ arminstr_t type : 1; /* imm(1) / reg(0) */
+ arminstr_t u : 1; /* +- */
+ arminstr_t p : 1; /* pre/post-index */
+ arminstr_t tag : 3;
+ arminstr_t cond : 4;
+} ARMInstrHXfer;
+
+#define ARM_HXFER_ID 0
+#define ARM_HXFER_ID2 1
+#define ARM_HXFER_ID3 1
+#define ARM_HXFER_MASK ((0x7 << 25) | (0x9 << 4))
+#define ARM_HXFER_TAG ((ARM_HXFER_ID << 25) | (ARM_HXFER_ID2 << 7) | (ARM_HXFER_ID3 << 4))
+
+#define ARM_DEF_HXFER_IMM_COND(imm, h, s, rd, rn, ls, wb, p, cond) \
+ ((imm) & 0xF) | \
+ ((h) << 5) | \
+ ((s) << 6) | \
+ (((imm) << 4) & (0xF << 8)) | \
+ ((rd) << 12) | \
+ ((rn) << 16) | \
+ ((ls) << 20) | \
+ ((wb) << 21) | \
+ (1 << 22) | \
+ (((int)(imm) >= 0) << 23) | \
+ ((p) << 24) | \
+ ARM_HXFER_TAG | \
+ ARM_DEF_COND(cond)
+
+#define ARM_LDRH_IMM_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT(p, ARM_DEF_HXFER_IMM_COND(imm, 1, 0, rd, rn, ARMOP_LDR, 0, 1, cond))
+#define ARM_LDRH_IMM(p, rd, rn, imm) \
+ ARM_LDRH_IMM_COND(p, rd, rn, imm, ARMCOND_AL)
+#define ARM_LDRSH_IMM_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT(p, ARM_DEF_HXFER_IMM_COND(imm, 1, 1, rd, rn, ARMOP_LDR, 0, 1, cond))
+#define ARM_LDRSH_IMM(p, rd, rn, imm) \
+ ARM_LDRSH_IMM_COND(p, rd, rn, imm, ARMCOND_AL)
+#define ARM_LDRSB_IMM_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT(p, ARM_DEF_HXFER_IMM_COND(imm, 0, 1, rd, rn, ARMOP_LDR, 0, 1, cond))
+#define ARM_LDRSB_IMM(p, rd, rn, imm) \
+ ARM_LDRSB_IMM_COND(p, rd, rn, imm, ARMCOND_AL)
+
+
+#define ARM_STRH_IMM_COND(p, rd, rn, imm, cond) \
+ ARM_EMIT(p, ARM_DEF_HXFER_IMM_COND(imm, 1, 0, rd, rn, ARMOP_STR, 0, 1, cond))
+#define ARM_STRH_IMM(p, rd, rn, imm) \
+ ARM_STRH_IMM_COND(p, rd, rn, imm, ARMCOND_AL)
+
+
+
+/* Swap */
+typedef struct {
+ arminstr_t rm : 4;
+ arminstr_t tag3 : 8; /* 0x9 */
+ arminstr_t rd : 4;
+ arminstr_t rn : 4;
+ arminstr_t tag2 : 2;
+ arminstr_t b : 1;
+ arminstr_t tag : 5; /* 0x2 */
+ arminstr_t cond : 4;
+} ARMInstrSwap;
+
+#define ARM_SWP_ID 2
+#define ARM_SWP_ID2 9
+#define ARM_SWP_MASK ((0x1F << 23) | (3 << 20) | (0xFF << 4))
+#define ARM_SWP_TAG ((ARM_SWP_ID << 23) | (ARM_SWP_ID2 << 4))
+
+
+
+/* Software interrupt */
+typedef struct {
+ arminstr_t num : 24;
+ arminstr_t tag : 4;
+ arminstr_t cond : 4;
+} ARMInstrSWI;
+
+#define ARM_SWI_ID 0xF
+#define ARM_SWI_MASK (0xF << 24)
+#define ARM_SWI_TAG (ARM_SWI_ID << 24)
+
+
+
+/* Co-processor Data Processing */
+typedef struct {
+ arminstr_t crm : 4;
+ arminstr_t tag2 : 1; /* 0 */
+ arminstr_t op2 : 3;
+ arminstr_t cpn : 4; /* CP number */
+ arminstr_t crd : 4;
+ arminstr_t crn : 4;
+ arminstr_t op : 4;
+ arminstr_t tag : 4; /* 0xE */
+ arminstr_t cond : 4;
+} ARMInstrCDP;
+
+#define ARM_CDP_ID 0xE
+#define ARM_CDP_ID2 0
+#define ARM_CDP_MASK ((0xF << 24) | (1 << 4))
+#define ARM_CDP_TAG ((ARM_CDP_ID << 24) | (ARM_CDP_ID2 << 4))
+
+
+/* Co-processor Data Transfer (ldc/stc) */
+typedef struct {
+ arminstr_t offs : 8;
+ arminstr_t cpn : 4;
+ arminstr_t crd : 4;
+ arminstr_t rn : 4;
+ arminstr_t ls : 1;
+ arminstr_t wb : 1;
+ arminstr_t n : 1;
+ arminstr_t u : 1;
+ arminstr_t p : 1;
+ arminstr_t tag : 3;
+ arminstr_t cond : 4;
+} ARMInstrCDT;
+
+#define ARM_CDT_ID 6
+#define ARM_CDT_MASK (7 << 25)
+#define ARM_CDT_TAG (ARM_CDT_ID << 25)
+
+
+/* Co-processor Register Transfer (mcr/mrc) */
+typedef struct {
+ arminstr_t crm : 4;
+ arminstr_t tag2 : 1;
+ arminstr_t op2 : 3;
+ arminstr_t cpn : 4;
+ arminstr_t rd : 4;
+ arminstr_t crn : 4;
+ arminstr_t ls : 1;
+ arminstr_t op1 : 3;
+ arminstr_t tag : 4;
+ arminstr_t cond : 4;
+} ARMInstrCRT;
+
+#define ARM_CRT_ID 0xE
+#define ARM_CRT_ID2 0x1
+#define ARM_CRT_MASK ((0xF << 24) | (1 << 4))
+#define ARM_CRT_TAG ((ARM_CRT_ID << 24) | (ARM_CRT_ID2 << 4))
+
+/* Move register to PSR. */
+typedef union {
+ ARMDPI_op2_imm op2_imm;
+ struct {
+ arminstr_t rm : 4;
+ arminstr_t pad : 8; /* 0 */
+ arminstr_t tag4 : 4; /* 0xF */
+ arminstr_t fld : 4;
+ arminstr_t tag3 : 2; /* 0x2 */
+ arminstr_t sel : 1;
+ arminstr_t tag2 : 2; /* 0x2 */
+ arminstr_t type : 1;
+ arminstr_t tag : 2; /* 0 */
+ arminstr_t cond : 4;
+ } all;
+} ARMInstrMSR;
+
+#define ARM_MSR_ID 0
+#define ARM_MSR_ID2 2
+#define ARM_MSR_ID3 2
+#define ARM_MSR_ID4 0xF
+#define ARM_MSR_MASK ((3 << 26) | \
+ (3 << 23) | \
+ (3 << 20) | \
+ (0xF << 12))
+#define ARM_MSR_TAG ((ARM_MSR_ID << 26) | \
+ (ARM_MSR_ID2 << 23) | \
+ (ARM_MSR_ID3 << 20) | \
+ (ARM_MSR_ID4 << 12))
+
+
+/* Move PSR to register. */
+typedef struct {
+ arminstr_t tag3 : 12;
+ arminstr_t rd : 4;
+ arminstr_t tag2 : 6;
+ arminstr_t sel : 1; /* CPSR | SPSR */
+ arminstr_t tag : 5;
+ arminstr_t cond : 4;
+} ARMInstrMRS;
+
+#define ARM_MRS_ID 2
+#define ARM_MRS_ID2 0xF
+#define ARM_MRS_ID3 0
+#define ARM_MRS_MASK ((0x1F << 23) | (0x3F << 16) | 0xFFF)
+#define ARM_MRS_TAG ((ARM_MRS_ID << 23) | (ARM_MRS_ID2 << 16) | ARM_MRS_ID3)
+
+
+
+typedef union {
+ ARMInstrBR br;
+ ARMInstrDPI dpi;
+ ARMInstrMRT mrt;
+ ARMInstrMul mul;
+ ARMInstrWXfer wxfer;
+ ARMInstrHXfer hxfer;
+ ARMInstrSwap swp;
+ ARMInstrCDP cdp;
+ ARMInstrCDT cdt;
+ ARMInstrCRT crt;
+ ARMInstrSWI swi;
+ ARMInstrMSR msr;
+ ARMInstrMRS mrs;
+
+ ARMInstrGeneric generic;
+ arminstr_t raw;
+} ARMInstr;
+
+
+#include "arm_dpimacros.h"
+
+#define ARM_NOP(p) ARM_MOV_REG_REG(p, ARMREG_R0, ARMREG_R0)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ARM_H */
+
+
+
diff --git a/mono/arch/arm/arm-dis.c b/mono/arch/arm/arm-dis.c
new file mode 100644
index 00000000000..caec7e5f767
--- /dev/null
+++ b/mono/arch/arm/arm-dis.c
@@ -0,0 +1,494 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+
+#include <stdarg.h>
+
+#include "arm-dis.h"
+#include "arm-codegen.h"
+
+
+static ARMDis* gdisasm = NULL;
+
+static int use_reg_alias = 1;
+
+const static char* cond[] = {
+ "eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc",
+ "hi", "ls", "ge", "lt", "gt", "le", "", "nv"
+};
+
+const static char* ops[] = {
+ "and", "eor", "sub", "rsb", "add", "adc", "sbc", "rsc",
+ "tst", "teq", "cmp", "cmn", "orr", "mov", "bic", "mvn"
+};
+
+const static char* shift_types[] = {"lsl", "lsr", "asr", "ror"};
+
+const static char* mul_ops[] = {
+ "mul", "mla", "?", "?", "umul", "umlal", "smull", "smlal"
+};
+
+const static char* reg_alias[] = {
+ "a1", "a2", "a3", "a4",
+ "r4", "r5", "r6", "r7", "r8", "r9", "r10",
+ "fp", "ip", "sp", "lr", "pc"
+};
+
+const static char* msr_fld[] = {"f", "c", "x", "?", "s"};
+
+
+/* private functions prototypes (to keep compiler happy) */
+void chk_out(ARMDis* dis);
+void dump_reg(ARMDis* dis, int reg);
+void dump_creg(ARMDis* dis, int creg);
+void dump_reglist(ARMDis* dis, int reg_list);
+void init_gdisasm(void);
+
+void dump_br(ARMDis* dis, ARMInstr i);
+void dump_cdp(ARMDis* dis, ARMInstr i);
+void dump_cdt(ARMDis* dis, ARMInstr i);
+void dump_crt(ARMDis* dis, ARMInstr i);
+void dump_dpi(ARMDis* dis, ARMInstr i);
+void dump_hxfer(ARMDis* dis, ARMInstr i);
+void dump_mrs(ARMDis* dis, ARMInstr i);
+void dump_mrt(ARMDis* dis, ARMInstr i);
+void dump_msr(ARMDis* dis, ARMInstr i);
+void dump_mul(ARMDis* dis, ARMInstr i);
+void dump_swi(ARMDis* dis, ARMInstr i);
+void dump_swp(ARMDis* dis, ARMInstr i);
+void dump_wxfer(ARMDis* dis, ARMInstr i);
+
+
+/*
+void out(ARMDis* dis, const char* format, ...) {
+ va_list arglist;
+ va_start(arglist, format);
+ fprintf(dis->dis_out, format, arglist);
+ va_end(arglist);
+}
+*/
+
+
+void chk_out(ARMDis* dis) {
+ if (dis != NULL && dis->dis_out == NULL) dis->dis_out = stdout;
+}
+
+
+void armdis_set_output(ARMDis* dis, FILE* f) {
+ if (dis != NULL) {
+ dis->dis_out = f;
+ chk_out(dis);
+ }
+}
+
+FILE* armdis_get_output(ARMDis* dis) {
+ return (dis != NULL ? dis->dis_out : NULL);
+}
+
+
+
+
+void dump_reg(ARMDis* dis, int reg) {
+ reg &= 0xF;
+ if (!use_reg_alias || (reg > 3 && reg < 11)) {
+ fprintf(dis->dis_out, "r%d", reg);
+ } else {
+ fprintf(dis->dis_out, reg_alias[reg]);
+ }
+}
+
+void dump_creg(ARMDis* dis, int creg) {
+ if (dis != NULL) {
+ creg &= 0xF;
+ fprintf(dis->dis_out, "c%d", creg);
+ }
+}
+
+void dump_reglist(ARMDis* dis, int reg_list) {
+ int i = 0, j, n = 0;
+ int m1 = 1, m2, rn;
+ while (i < 16) {
+ if ((reg_list & m1) != 0) {
+ if (n != 0) fprintf(dis->dis_out, ", ");
+ n++;
+ dump_reg(dis, i);
+ for (j = i+1, rn = 0, m2 = m1<<1; j < 16; ++j, m2<<=1) {
+ if ((reg_list & m2) != 0) ++rn;
+ else break;
+ }
+ i+=rn;
+ if (rn > 1) {
+ fprintf(dis->dis_out, "-");
+ dump_reg(dis, i);
+ } else if (rn == 1) {
+ fprintf(dis->dis_out, ", ");
+ dump_reg(dis, i);
+ }
+ m1<<=(rn+1);
+ i++;
+ } else {
+ ++i;
+ m1<<=1;
+ }
+ }
+}
+
+
+void dump_br(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "b%s%s\t%x",
+ (i.br.link == 1) ? "l" : "",
+ cond[i.br.cond], i.br.offset);
+}
+
+
+void dump_dpi(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "%s%s", ops[i.dpi.all.opcode], cond[i.dpi.all.cond]);
+
+ if ((i.dpi.all.opcode >= ARMOP_TST) && (i.dpi.all.opcode <= ARMOP_CMN) && (i.dpi.all.s != 0)) {
+ fprintf(dis->dis_out, "s");
+ }
+
+ fprintf(dis->dis_out, "\t");
+
+ if ((i.dpi.all.opcode < ARMOP_TST) || (i.dpi.all.opcode > ARMOP_CMN)) {
+ /* comparison operation */
+ dump_reg(dis, i.dpi.all.rd);
+ fprintf(dis->dis_out, ", ");
+ }
+
+ if ((i.dpi.all.opcode != ARMOP_MOV) && (i.dpi.all.opcode != ARMOP_MVN)) {
+ dump_reg(dis, i.dpi.all.rn);
+ fprintf(dis->dis_out, ", ");
+ }
+
+ if (i.dpi.all.type == 1) {
+ /* immediate */
+ if (i.dpi.op2_imm.rot != 0) {
+ fprintf(dis->dis_out, "#%d, %d\t; 0x%x", i.dpi.op2_imm.imm, i.dpi.op2_imm.rot << 1,
+ ARM_SCALE(i.dpi.op2_imm.imm, (i.dpi.op2_imm.rot << 1)) );
+ } else {
+ fprintf(dis->dis_out, "#%d\t; 0x%x", i.dpi.op2_imm.imm, i.dpi.op2_imm.imm);
+ }
+ } else {
+ /* reg-reg */
+ if (i.dpi.op2_reg.tag == 0) {
+ /* op2 is reg shift by imm */
+ dump_reg(dis, i.dpi.op2_reg_imm.r2.rm);
+ if (i.dpi.op2_reg_imm.imm.shift != 0) {
+ fprintf(dis->dis_out, " %s #%d", shift_types[i.dpi.op2_reg_imm.r2.type], i.dpi.op2_reg_imm.imm.shift);
+ }
+ } else {
+ /* op2 is reg shift by reg */
+ dump_reg(dis, i.dpi.op2_reg_reg.r2.rm);
+ fprintf(dis->dis_out, " %s ", shift_types[i.dpi.op2_reg_reg.r2.type]);
+ dump_reg(dis, i.dpi.op2_reg_reg.reg.rs);
+ }
+
+ }
+}
+
+void dump_wxfer(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "%s%s%s\t",
+ (i.wxfer.all.ls == 0) ? "str" : "ldr",
+ cond[i.generic.cond],
+ (i.wxfer.all.b == 0) ? "" : "b");
+ dump_reg(dis, i.wxfer.all.rd);
+ fprintf(dis->dis_out, ", [");
+ dump_reg(dis, i.wxfer.all.rn);
+ fprintf(dis->dis_out, "%s, ", (i.wxfer.all.p == 0) ? "]" : "");
+
+ if (i.wxfer.all.type == 0) { /* imm */
+ fprintf(dis->dis_out, "#%s%d", (i.wxfer.all.u == 0) ? "-" : "", i.wxfer.all.op2_imm);
+ } else {
+ dump_reg(dis, i.wxfer.op2_reg_imm.r2.rm);
+ if (i.wxfer.op2_reg_imm.imm.shift != 0) {
+ fprintf(dis->dis_out, " %s #%d", shift_types[i.wxfer.op2_reg_imm.r2.type], i.wxfer.op2_reg_imm.imm.shift);
+ }
+ }
+
+ if (i.wxfer.all.p != 0) {
+ /* close pre-index instr, also check for write-back */
+ fprintf(dis->dis_out, "]%s", (i.wxfer.all.wb != 0) ? "!" : "");
+ }
+}
+
+void dump_hxfer(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "%s%s%s%s\t",
+ (i.hxfer.ls == 0) ? "str" : "ldr",
+ cond[i.generic.cond],
+ (i.hxfer.s != 0) ? "s" : "",
+ (i.hxfer.h != 0) ? "h" : "b");
+ dump_reg(dis, i.hxfer.rd);
+ fprintf(dis->dis_out, ", [");
+ dump_reg(dis, i.hxfer.rn);
+ fprintf(dis->dis_out, "%s, ", (i.hxfer.p == 0) ? "]" : "");
+
+ if (i.hxfer.type != 0) { /* imm */
+ fprintf(dis->dis_out, "#%s%d", (i.hxfer.u == 0) ? "-" : "", (i.hxfer.imm_hi << 4) | i.hxfer.rm);
+ } else {
+ dump_reg(dis, i.hxfer.rm);
+ }
+
+ if (i.hxfer.p != 0) {
+ /* close pre-index instr, also check for write-back */
+ fprintf(dis->dis_out, "]%s", (i.hxfer.wb != 0) ? "!" : "");
+ }
+}
+
+
+void dump_mrt(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "%s%s%s%s\t", (i.mrt.ls == 0) ? "stm" : "ldm", cond[i.mrt.cond],
+ (i.mrt.u == 0) ? "d" : "i", (i.mrt.p == 0) ? "a" : "b");
+ dump_reg(dis, i.mrt.rn);
+ fprintf(dis->dis_out, "%s, {", (i.mrt.wb != 0) ? "!" : "");
+ dump_reglist(dis, i.mrt.reg_list);
+ fprintf(dis->dis_out, "}");
+}
+
+
+void dump_swp(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "swp%s%s ", cond[i.swp.cond], (i.swp.b != 0) ? "b" : "");
+ dump_reg(dis, i.swp.rd);
+ fprintf(dis->dis_out, ", ");
+ dump_reg(dis, i.swp.rm);
+ fprintf(dis->dis_out, ", [");
+ dump_reg(dis, i.swp.rn);
+ fprintf(dis->dis_out, "]");
+}
+
+
+void dump_mul(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "%s%s%s\t", mul_ops[i.mul.opcode], cond[i.mul.cond], (i.mul.s != 0) ? "s" : "");
+ switch (i.mul.opcode) {
+ case ARMOP_MUL:
+ dump_reg(dis, i.mul.rd);
+ fprintf(dis->dis_out, ", ");
+ dump_reg(dis, i.mul.rm);
+ fprintf(dis->dis_out, ", ");
+ dump_reg(dis, i.mul.rs);
+ break;
+ case ARMOP_MLA:
+ dump_reg(dis, i.mul.rd);
+ fprintf(dis->dis_out, ", ");
+ dump_reg(dis, i.mul.rm);
+ fprintf(dis->dis_out, ", ");
+ dump_reg(dis, i.mul.rs);
+ fprintf(dis->dis_out, ", ");
+ dump_reg(dis, i.mul.rn);
+ break;
+ case ARMOP_UMUL:
+ case ARMOP_UMLAL:
+ case ARMOP_SMULL:
+ case ARMOP_SMLAL:
+ dump_reg(dis, i.mul.rd);
+ fprintf(dis->dis_out, ", ");
+ dump_reg(dis, i.mul.rn);
+ fprintf(dis->dis_out, ", ");
+ dump_reg(dis, i.mul.rm);
+ fprintf(dis->dis_out, ", ");
+ dump_reg(dis, i.mul.rs);
+ break;
+ default:
+ fprintf(dis->dis_out, "DCD 0x%x\t; <unknown>", i.raw);
+ break;
+ }
+}
+
+
+void dump_cdp(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "cdp%s\tp%d, %d, ", cond[i.generic.cond], i.cdp.cpn, i.cdp.op);
+ dump_creg(dis, i.cdp.crd);
+ fprintf(dis->dis_out, ", ");
+ dump_creg(dis, i.cdp.crn);
+ fprintf(dis->dis_out, ", ");
+ dump_creg(dis, i.cdp.crm);
+
+ if (i.cdp.op2 != 0) {
+ fprintf(dis->dis_out, ", %d", i.cdp.op2);
+ }
+}
+
+
+void dump_cdt(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "%s%s%s\tp%d, ", (i.cdt.ls == 0) ? "stc" : "ldc",
+ cond[i.generic.cond], (i.cdt.n != 0) ? "l" : "", i.cdt.cpn);
+ dump_creg(dis, i.cdt.crd);
+ fprintf(dis->dis_out, ", ");
+ dump_reg(dis, i.cdt.rn);
+
+ if (i.cdt.p == 0) {
+ fprintf(dis->dis_out, "]");
+ }
+
+ if (i.cdt.offs != 0) {
+ fprintf(dis->dis_out, ", #%d", i.cdt.offs);
+ }
+
+ if (i.cdt.p != 0) {
+ fprintf(dis->dis_out, "]%s", (i.cdt.wb != 0) ? "!" : "");
+ }
+}
+
+
+void dump_crt(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "%s%s\tp%d, %d, ", (i.crt.ls == 0) ? "mrc" : "mcr",
+ cond[i.generic.cond], i.crt.cpn, i.crt.op1);
+ dump_reg(dis, i.crt.rd);
+ fprintf(dis->dis_out, ", ");
+ dump_creg(dis, i.crt.crn);
+ fprintf(dis->dis_out, ", ");
+ dump_creg(dis, i.crt.crm);
+
+ if (i.crt.op2 != 0) {
+ fprintf(dis->dis_out, ", %d", i.crt.op2);
+ }
+}
+
+
+void dump_msr(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "msr%s\t%spsr_, ", cond[i.generic.cond],
+ (i.msr.all.sel == 0) ? "s" : "c");
+ if (i.msr.all.type == 0) {
+ /* reg */
+ fprintf(dis->dis_out, "%s, ", msr_fld[i.msr.all.fld]);
+ dump_reg(dis, i.msr.all.rm);
+ } else {
+ /* imm */
+ fprintf(dis->dis_out, "f, #%d", i.msr.op2_imm.imm << i.msr.op2_imm.rot);
+ }
+}
+
+
+void dump_mrs(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "mrs%s\t", cond[i.generic.cond]);
+ dump_reg(dis, i.mrs.rd);
+ fprintf(dis->dis_out, ", %spsr", (i.mrs.sel == 0) ? "s" : "c");
+}
+
+
+void dump_swi(ARMDis* dis, ARMInstr i) {
+ fprintf(dis->dis_out, "swi%s\t%d", cond[i.generic.cond], i.swi.num);
+}
+
+
+
+void armdis_decode(ARMDis* dis, void* p, int size) {
+ int i;
+ arminstr_t* pi = (arminstr_t*)p;
+ ARMInstr instr;
+
+ if (dis == NULL) return;
+
+ chk_out(dis);
+
+ size/=sizeof(arminstr_t);
+
+ for (i=0; i<size; ++i) {
+ fprintf(dis->dis_out, "%p:\t%08x\t", pi, *pi);
+ instr.raw = *pi++;
+
+ if ((instr.raw & ARM_BR_MASK) == ARM_BR_TAG) {
+ dump_br(dis, instr);
+ } else if ((instr.raw & ARM_SWP_MASK) == ARM_SWP_TAG) {
+ dump_swp(dis, instr);
+ } else if ((instr.raw & ARM_MUL_MASK) == ARM_MUL_TAG) {
+ dump_mul(dis, instr);
+ } else if ((instr.raw & ARM_WXFER_MASK) == ARM_WXFER_TAG) {
+ dump_wxfer(dis, instr);
+ } else if ((instr.raw & ARM_HXFER_MASK) == ARM_HXFER_TAG) {
+ dump_hxfer(dis, instr);
+ } else if ((instr.raw & ARM_DPI_MASK) == ARM_DPI_TAG) {
+ dump_dpi(dis, instr);
+ } else if ((instr.raw & ARM_MRT_MASK) == ARM_MRT_TAG) {
+ dump_mrt(dis, instr);
+ } else if ((instr.raw & ARM_CDP_MASK) == ARM_CDP_TAG) {
+ dump_cdp(dis, instr);
+ } else if ((instr.raw & ARM_CDT_MASK) == ARM_CDT_TAG) {
+ dump_cdt(dis, instr);
+ } else if ((instr.raw & ARM_CRT_MASK) == ARM_CRT_TAG) {
+ dump_crt(dis, instr);
+ } else if ((instr.raw & ARM_MSR_MASK) == ARM_MSR_TAG) {
+ dump_msr(dis, instr);
+ } else if ((instr.raw & ARM_MRS_MASK) == ARM_MRS_TAG) {
+ dump_mrs(dis, instr);
+ } else if ((instr.raw & ARM_SWI_MASK) == ARM_SWI_TAG) {
+ dump_swi(dis, instr);
+ } else {
+ fprintf(dis->dis_out, "DCD 0x%x\t; <unknown>", instr.raw);
+ }
+
+ fprintf(dis->dis_out, "\n");
+ }
+}
+
+
+void armdis_open(ARMDis* dis, const char* dump_name) {
+ if (dis != NULL && dump_name != NULL) {
+ armdis_set_output(dis, fopen(dump_name, "w"));
+ }
+}
+
+
+void armdis_close(ARMDis* dis) {
+ if (dis->dis_out != NULL && dis->dis_out != stdout && dis->dis_out != stderr) {
+ fclose(dis->dis_out);
+ dis->dis_out = NULL;
+ }
+}
+
+
+void armdis_dump(ARMDis* dis, const char* dump_name, void* p, int size) {
+ armdis_open(dis, dump_name);
+ armdis_decode(dis, p, size);
+ armdis_close(dis);
+}
+
+
+void armdis_init(ARMDis* dis) {
+ if (dis != NULL) {
+ /* set to stdout */
+ armdis_set_output(dis, NULL);
+ }
+}
+
+
+
+
+void init_gdisasm() {
+ if (gdisasm == NULL) {
+ gdisasm = (ARMDis*)malloc(sizeof(ARMDis));
+ armdis_init(gdisasm);
+ }
+}
+
+void _armdis_set_output(FILE* f) {
+ init_gdisasm();
+ armdis_set_output(gdisasm, f);
+}
+
+FILE* _armdis_get_output() {
+ init_gdisasm();
+ return armdis_get_output(gdisasm);
+}
+
+void _armdis_decode(void* p, int size) {
+ init_gdisasm();
+ armdis_decode(gdisasm, p, size);
+}
+
+void _armdis_open(const char* dump_name) {
+ init_gdisasm();
+ armdis_open(gdisasm, dump_name);
+}
+
+void _armdis_close() {
+ init_gdisasm();
+ armdis_close(gdisasm);
+}
+
+void _armdis_dump(const char* dump_name, void* p, int size) {
+ init_gdisasm();
+ armdis_dump(gdisasm, dump_name, p, size);
+}
+
diff --git a/mono/arch/arm/arm-dis.h b/mono/arch/arm/arm-dis.h
new file mode 100644
index 00000000000..b93db303ffa
--- /dev/null
+++ b/mono/arch/arm/arm-dis.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+#ifndef ARM_DIS
+#define ARM_DIS
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _ARMDis {
+ FILE* dis_out;
+} ARMDis;
+
+
+void _armdis_set_output(FILE* f);
+FILE* _armdis_get_output(void);
+void _armdis_decode(void* p, int size);
+void _armdis_open(const char* dump_name);
+void _armdis_close(void);
+void _armdis_dump(const char* dump_name, void* p, int size);
+
+
+void armdis_init(ARMDis* dis);
+void armdis_set_output(ARMDis* dis, FILE* f);
+FILE* armdis_get_output(ARMDis* dis);
+void armdis_decode(ARMDis* dis, void* p, int size);
+void armdis_open(ARMDis* dis, const char* dump_name);
+void armdis_close(ARMDis* dis);
+void armdis_dump(ARMDis* dis, const char* dump_name, void* p, int size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ARM_DIS */
diff --git a/mono/arch/arm/cmp_macros.th b/mono/arch/arm/cmp_macros.th
new file mode 100644
index 00000000000..8a357087a32
--- /dev/null
+++ b/mono/arch/arm/cmp_macros.th
@@ -0,0 +1,11 @@
+/* PSR = <Op> rd, (imm8 ROR 2*rot) */
+#define ARM_<Op>_REG_IMM_COND(p, rd, imm8, rot, cond) \
+ ARM_DPIOP_REG_IMM8ROT_COND(p, ARMOP_<Op>, rd, 0, imm8, rot, cond)
+#define ARM_<Op>_REG_IMM(p, rd, imm8, rot) \
+ ARM_<Op>_REG_IMM_COND(p, rd, imm8, rot, ARMCOND_AL)
+/* PSR = <Op> rd, imm8 */
+#define ARM_<Op>_REG_IMM8_COND(p, rd, imm8, cond) \
+ ARM_<Op>_REG_IMM_COND(p, rd, imm8, 0, cond)
+#define ARM_<Op>_REG_IMM8(p, rd, imm8) \
+ ARM_<Op>_REG_IMM8_COND(p, rd, imm8, ARMCOND_AL)
+
diff --git a/mono/arch/arm/dpi_macros.th b/mono/arch/arm/dpi_macros.th
new file mode 100644
index 00000000000..f8ec6086e92
--- /dev/null
+++ b/mono/arch/arm/dpi_macros.th
@@ -0,0 +1,44 @@
+/* -- <Op> -- */
+
+/* rd = rn <Op> (imm8 ROR rot) ; rot is power of 2 */
+#define ARM_<Op>_REG_IMM_COND(p, rd, rn, imm8, rot, cond) \
+ ARM_DPIOP_REG_IMM8ROT_COND(p, ARMOP_<Op>, rd, rn, imm8, rot, cond)
+#define ARM_<Op>_REG_IMM(p, rd, rn, imm8, rot) \
+ ARM_<Op>_REG_IMM_COND(p, rd, rn, imm8, rot, ARMCOND_AL)
+#define ARM_<Op>S_REG_IMM_COND(p, rd, rn, imm8, rot, cond) \
+ ARM_DPIOP_S_REG_IMM8ROT_COND(p, ARMOP_<Op>, rd, rn, imm8, rot, cond)
+#define ARM_<Op>S_REG_IMM(p, rd, rn, imm8, rot) \
+ ARM_<Op>S_REG_IMM_COND(p, rd, rn, imm8, rot, ARMCOND_AL)
+
+/* rd = rn <Op> imm8 */
+#define ARM_<Op>_REG_IMM8_COND(p, rd, rn, imm8, cond) \
+ ARM_<Op>_REG_IMM_COND(p, rd, rn, imm8, 0, cond)
+#define ARM_<Op>_REG_IMM8(p, rd, rn, imm8) \
+ ARM_<Op>_REG_IMM8_COND(p, rd, rn, imm8, ARMCOND_AL)
+#define ARM_<Op>S_REG_IMM8_COND(p, rd, rn, imm8, cond) \
+ ARM_<Op>S_REG_IMM_COND(p, rd, rn, imm8, 0, cond)
+#define ARM_<Op>S_REG_IMM8(p, rd, rn, imm8) \
+ ARM_<Op>S_REG_IMM8_COND(p, rd, rn, imm8, ARMCOND_AL)
+
+
+/* rd = rn <Op> rm */
+#define ARM_<Op>_REG_REG_COND(p, rd, rn, rm, cond) \
+ ARM_DPIOP_REG_REG_COND(p, ARMOP_<Op>, rd, rn, rm, cond)
+#define ARM_<Op>_REG_REG(p, rd, rn, rm) \
+ ARM_<Op>_REG_REG_COND(p, rd, rn, rm, ARMCOND_AL)
+#define ARM_<Op>S_REG_REG_COND(p, rd, rn, rm, cond) \
+ ARM_DPIOP_S_REG_REG_COND(p, ARMOP_<Op>, rd, rn, rm, cond)
+#define ARM_<Op>S_REG_REG(p, rd, rn, rm) \
+ ARM_<Op>S_REG_REG_COND(p, rd, rn, rm, ARMCOND_AL)
+
+/* rd = rn <Op> (rm <shift_type> imm_shift) */
+#define ARM_<Op>_REG_IMMSHIFT_COND(p, rd, rn, rm, shift_type, imm_shift, cond) \
+ ARM_DPIOP_REG_IMMSHIFT_COND(p, ARMOP_<Op>, rd, rn, rm, shift_type, imm_shift, cond)
+#define ARM_<Op>_REG_IMMSHIFT(p, rd, rn, rm, shift_type, imm_shift) \
+ ARM_<Op>_REG_IMMSHIFT_COND(p, rd, rn, rm, shift_type, imm_shift, ARMCOND_AL)
+#define ARM_<Op>S_REG_IMMSHIFT_COND(p, rd, rn, rm, shift_type, imm_shift, cond) \
+ ARM_DPIOP_S_REG_IMMSHIFT_COND(p, ARMOP_<Op>, rd, rn, rm, shift_type, imm_shift, cond)
+#define ARM_<Op>S_REG_IMMSHIFT(p, rd, rn, rm, shift_type, imm_shift) \
+ ARM_<Op>S_REG_IMMSHIFT_COND(p, rd, rn, rm, shift_type, imm_shift, ARMCOND_AL)
+
+
diff --git a/mono/arch/arm/dpiops.sh b/mono/arch/arm/dpiops.sh
new file mode 100755
index 00000000000..2eb43d9a75a
--- /dev/null
+++ b/mono/arch/arm/dpiops.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+OPCODES="AND EOR SUB RSB ADD ADC SBC RSC ORR BIC"
+CMP_OPCODES="TST TEQ CMP CMN"
+MOV_OPCODES="MOV MVN"
+OUTFILE=arm_dpimacros.h
+
+# $1: opcode list
+# $2: template
+function gen() {
+ for i in $1; do
+ sed "s/<Op>/$i/g" $2.th >> $OUTFILE
+ done
+}
+
+
+
+echo -e "/* Macros for DPI ops, auto-generated from template */\n" > $OUTFILE
+
+echo -e "\n/* mov/mvn */\n" >> $OUTFILE
+gen "$MOV_OPCODES" mov_macros
+
+echo -e "\n/* DPIs, arithmetic and logical */\n" >> $OUTFILE
+gen "$OPCODES" dpi_macros
+
+echo -e "\n\n" >> $OUTFILE
+
+echo -e "\n/* DPIs, comparison */\n" >> $OUTFILE
+gen "$CMP_OPCODES" cmp_macros
+
+echo -e "/* end generated */\n\n" >> $OUTFILE
+
diff --git a/mono/arch/arm/mov_macros.th b/mono/arch/arm/mov_macros.th
new file mode 100644
index 00000000000..151a29ba717
--- /dev/null
+++ b/mono/arch/arm/mov_macros.th
@@ -0,0 +1,39 @@
+/* rd = imm8 ROR rot */
+#define ARM_<Op>_REG_IMM_COND(p, reg, imm8, rot, cond) \
+ ARM_DPIOP_REG_IMM8ROT_COND(p, ARMOP_<Op>, reg, 0, imm8, rot, cond)
+#define ARM_<Op>_REG_IMM(p, reg, imm8, rot) \
+ ARM_<Op>_REG_IMM_COND(p, reg, imm8, rot, ARMCOND_AL)
+#define ARM_<Op>_REG_IMM8(p, reg, imm8) \
+ ARM_<Op>_REG_IMM(p, reg, imm8, 0)
+/* S */
+#define ARM_<Op>S_REG_IMM_COND(p, reg, imm8, rot, cond) \
+ ARM_DPIOP_S_REG_IMM8ROT_COND(p, ARMOP_<Op>, reg, 0, imm8, rot, cond)
+#define ARM_<Op>S_REG_IMM(p, reg, imm8, rot) \
+ ARM_<Op>S_REG_IMM_COND(p, reg, imm8, rot, ARMCOND_AL)
+
+
+/* rd = rm */
+#define ARM_<Op>_REG_REG_COND(p, rd, rm, cond) \
+ ARM_DPIOP_REG_REG_COND(p, ARMOP_<Op>, rd, 0, rm, cond)
+#define ARM_<Op>_REG_REG(p, rd, rm) \
+ ARM_<Op>_REG_REG_COND(p, rd, rm, ARMCOND_AL)
+/* S */
+#define ARM_<Op>S_REG_REG_COND(p, rd, rm, cond) \
+ ARM_DPIOP_S_REG_REG_COND(p, ARMOP_<Op>, rd, 0, rm, cond)
+#define ARM_<Op>S_REG_REG(p, rd, rm) \
+ ARM_<Op>S_REG_REG_COND(p, rd, rm, ARMCOND_AL)
+
+
+
+/* rd = rm <shift_type> imm_shift */
+#define ARM_<Op>_REG_IMMSHIFT_COND(p, rd, rm, shift_type, imm_shift, cond) \
+ ARM_DPIOP_REG_IMMSHIFT_COND(p, ARMOP_<Op>, rd, 0, rm, shift_type, imm_shift, cond)
+#define ARM_<Op>_REG_IMMSHIFT(p, rd, rm, shift_type, imm_shift) \
+ ARM_<Op>_REG_IMMSHIFT_COND(p, rd, rm, shift_type, imm_shift, ARMCOND_AL)
+/* S */
+#define ARM_<Op>S_REG_IMMSHIFT_COND(p, rd, rm, shift_type, imm_shift, cond) \
+ ARM_DPIOP_S_REG_IMMSHIFT_COND(p, ARMOP_<Op>, rd, 0, rm, shift_type, imm_shift, cond)
+#define ARM_<Op>S_REG_IMMSHIFT(p, rd, rm, shift_type, imm_shift) \
+ ARM_<Op>S_REG_IMMSHIFT_COND(p, rd, rm, shift_type, imm_shift, ARMCOND_AL)
+
+
diff --git a/mono/arch/arm/tramp.c b/mono/arch/arm/tramp.c
new file mode 100644
index 00000000000..0a7c47d470b
--- /dev/null
+++ b/mono/arch/arm/tramp.c
@@ -0,0 +1,809 @@
+/*
+ * Create trampolines to invoke arbitrary functions.
+ * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
+ */
+
+#include "arm-codegen.h"
+#include "arm-dis.h"
+
+#if defined(_WIN32_WCE) || defined (UNDER_CE)
+# include <windows.h>
+#endif
+
+#include "mono/metadata/class.h"
+#include "mono/metadata/tabledefs.h"
+#include "mono/interpreter/interp.h"
+#include "mono/metadata/appdomain.h"
+
+
+#if 1
+# define ARM_DUMP_DISASM 1
+#endif
+
+
+/* prototypes for private functions (to avoid compiler warnings) */
+MonoString* mono_string_new_wrapper (const char* text);
+void flush_icache (void);
+void* alloc_code_buff (int num_instr);
+
+
+
+/*
+ * The resulting function takes the form:
+ * void func (void (*callme)(), void *retval, void *this_obj, stackval *arguments);
+ * NOTE: all args passed in ARM registers (A1-A4),
+ * then copied to R4-R7 (see definitions below).
+ */
+
+#define REG_FUNC_ADDR ARMREG_R4
+#define REG_RETVAL ARMREG_R5
+#define REG_THIS ARMREG_R6
+#define REG_ARGP ARMREG_R7
+
+
+#define ARG_SIZE sizeof(stackval)
+
+
+
+/*
+ * Invokes mono_string_new for the current AppDomain.
+ */
+MonoString* mono_string_new_wrapper (const char* text)
+{
+ return text == NULL ? NULL : mono_string_new(mono_domain_get(), text);
+}
+
+
+void flush_icache ()
+{
+#if defined(_WIN32)
+ FlushInstructionCache(GetCurrentProcess(), NULL, 0);
+#else
+# if 0
+ asm ("mov r0, r0");
+ asm ("mov r0, #0");
+ asm ("mcr p15, 0, r0, c7, c7, 0");
+# else
+ /* TODO: use (movnv pc, rx) method */
+# endif
+#endif
+}
+
+
+void* alloc_code_buff (int num_instr)
+{
+ void* code_buff;
+
+#if defined(_WIN32) || defined(UNDER_CE)
+ int old_prot = 0;
+#endif
+
+ code_buff = malloc(num_instr * sizeof(arminstr_t));
+
+#if defined(_WIN32) || defined(UNDER_CE)
+ VirtualProtect(code_buff, num_instr * sizeof(arminstr_t), PAGE_EXECUTE_READWRITE, &old_prot);
+#endif
+
+ return code_buff;
+}
+
+
+/*
+ * Refer to ARM Procedure Call Standard (APCS) for more info.
+ */
+MonoPIFunc mono_create_trampoline (MonoMethod* method, int runtime)
+{
+ MonoMethodSignature* sig;
+ MonoType* param;
+ MonoPIFunc code_buff;
+ arminstr_t* p, * utf8_addr, * free_addr, * str_new_addr;
+ guint32 code_size, stack_size;
+ guint32 simple_type;
+ int i, hasthis, aregs, regc, stack_offs;
+ int utf8_offs, utf8_reg, utf8_stack_offs;
+ int this_loaded;
+ int str_args, strc;
+ guchar reg_alloc [ARM_NUM_ARG_REGS];
+
+ /* pessimistic estimation for prologue/epilogue size */
+ code_size = 16 + 16;
+ /* push/pop work regs */
+ code_size += 2;
+ /* call */
+ code_size += 2;
+ /* handle retval */
+ code_size += 2;
+
+ stack_size = 0;
+ str_args = 0;
+ sig = method->signature;
+ hasthis = sig->hasthis ? 1 : 0;
+
+ aregs = ARM_NUM_ARG_REGS - hasthis;
+
+ for (i = 0, regc = aregs; i < sig->param_count; ++i) {
+ param = sig->params [i];
+
+ /* keep track of argument sizes */
+ if (i < ARM_NUM_ARG_REGS) reg_alloc [i] = 0;
+
+ if (param->byref) {
+ if (regc > 0) {
+ code_size += 1;
+ reg_alloc [i] = regc;
+ --regc;
+ } else {
+ code_size += 2;
+ stack_size += sizeof(gpointer);
+ }
+ } else {
+ simple_type = param->type;
+enum_calc_size:
+ switch (simple_type) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ if (regc > 0) {
+ /* register arg */
+ code_size += 1;
+ reg_alloc [i] = regc;
+ --regc;
+ } else {
+ /* stack arg */
+ code_size += 2;
+ stack_size += 4;
+ }
+
+ if (simple_type == MONO_TYPE_STRING
+ && !(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)
+ && !runtime) {
+ code_size += 6; /* rough */
+ ++str_args;
+ }
+ break;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R8:
+ /* keep track of argument sizes */
+ if (regc > 1) {
+ /* fits into registers, two LDRs */
+ code_size += 2;
+ reg_alloc [i] = regc;
+ regc -= 2;
+ } else if (regc > 0) {
+ /* first half fits into register, one LDR */
+ code_size += 1;
+ reg_alloc [i] = regc;
+ --regc;
+ /* the rest on the stack, LDR/STR */
+ code_size += 2;
+ stack_size += 4;
+ } else {
+ /* stack arg, 4 instrs - 2x(LDR/STR) */
+ code_size += 4;
+ stack_size += 2 * 4;
+ }
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (param->data.klass->enumtype) {
+ simple_type = param->data.klass->enum_basetype->type;
+ goto enum_calc_size;
+ }
+ if (mono_class_value_size(param->data.klass, NULL) != 4) {
+ g_error("can only marshal enums, not generic structures (size: %d)", mono_class_value_size(param->data.klass, NULL));
+ }
+ if (regc > 0) {
+ /* register arg */
+ code_size += 1;
+ reg_alloc [i] = regc;
+ --regc;
+ } else {
+ /* stack arg */
+ code_size += 2;
+ stack_size += 4;
+ }
+ break;
+ default :
+ break;
+ }
+ }
+ }
+
+ if (str_args) code_size += 2;
+
+ code_buff = (MonoPIFunc)alloc_code_buff(code_size);
+ p = (arminstr_t*)code_buff;
+
+ /* prologue */
+ p = arm_emit_lean_prologue((arminstr_t*)p,
+ stack_size + str_args*sizeof(gpointer),
+ /* save workset (r4-r7) */
+ (1 << ARMREG_R4) | (1 << ARMREG_R5) | (1 << ARMREG_R6) | (1 << ARMREG_R7));
+
+
+ /* copy args into workset */
+ /* callme - always present */
+ ARM_MOV_REG_REG(p, ARMREG_R4, ARMREG_A1);
+ /* retval */
+ if (sig->ret->byref || (sig->ret->type != MONO_TYPE_VOID)) {
+ ARM_MOV_REG_REG(p, ARMREG_R5, ARMREG_A2);
+ }
+ /* this_obj */
+ if (sig->hasthis) {
+ this_loaded = 0;
+ if (stack_size == 0) {
+ ARM_MOV_REG_REG(p, ARMREG_A1, ARMREG_A3);
+ this_loaded = 1;
+ } else {
+ ARM_MOV_REG_REG(p, ARMREG_R6, ARMREG_A3);
+ }
+ }
+ /* args */
+ if (sig->param_count != 0) {
+ ARM_MOV_REG_REG(p, ARMREG_R7, ARMREG_A4);
+ }
+
+ if (str_args || sig->ret->type == MONO_TYPE_STRING) {
+ /* branch around address table */
+ ARM_B(p, str_args ? 2 : 0);
+
+ /* create branch table for string functions */
+ if (str_args) {
+ /* allocate slots for convert
+ * and free functions only if
+ * we have some string args,
+ * otherwise only string_new
+ * is needed for retval.
+ */
+ utf8_addr = p;
+ *p++ = (arminstr_t)&mono_string_to_utf8;
+ free_addr = p;
+ *p++ = (arminstr_t)&g_free;
+ }
+ str_new_addr = p;
+ *p++ = (arminstr_t)&mono_string_new_wrapper;
+
+ strc = str_args; /* # of string args */
+ }
+
+ stack_offs = stack_size;
+ utf8_stack_offs = stack_size + str_args*sizeof(gpointer);
+
+ /* handle arguments */
+ /* in reverse order so we could use r0 (arg1) for memory transfers */
+ for (i = sig->param_count; --i >= 0;) {
+ param = sig->params [i];
+ if (param->byref) {
+ if (i < aregs) {
+ ARM_LDR_IMM(p, ARMREG_A1 + i, REG_ARGP, i*ARG_SIZE);
+ } else {
+ stack_offs -= sizeof(armword_t);
+ ARM_LDR_IMM(p, ARMREG_R4, REG_ARGP, i*ARG_SIZE);
+ ARM_STR_IMM(p, ARMREG_R4, ARMREG_SP, stack_offs);
+ }
+ } else {
+ simple_type = param->type;
+enum_marshal:
+ switch (simple_type) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+push_a_word:
+ if (i < aregs && reg_alloc [i] > 0) {
+ /* pass in register */
+ ARM_LDR_IMM(p, ARMREG_A1 + hasthis + (aregs - reg_alloc [i]), REG_ARGP, i*ARG_SIZE);
+ } else {
+ stack_offs -= sizeof(armword_t);
+ ARM_LDR_IMM(p, ARMREG_R0, REG_ARGP, i*ARG_SIZE);
+ ARM_STR_IMM(p, ARMREG_R0, ARMREG_SP, stack_offs);
+ }
+ break;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R8:
+ if (i < aregs && reg_alloc [i] > 0) {
+ if (reg_alloc [i] > 1) {
+ /* pass in registers */
+ ARM_LDR_IMM(p, ARMREG_A1 + hasthis + (aregs - reg_alloc [i]), REG_ARGP, i*ARG_SIZE);
+ ARM_LDR_IMM(p, ARMREG_A1 + hasthis + (aregs - reg_alloc [i]) + 1, REG_ARGP, i*ARG_SIZE + 4);
+ } else {
+ stack_offs -= sizeof(armword_t);
+ ARM_LDR_IMM(p, ARMREG_R0, REG_ARGP, i*ARG_SIZE + 4);
+ ARM_STR_IMM(p, ARMREG_R0, ARMREG_SP, stack_offs);
+ ARM_LDR_IMM(p, ARMREG_A1 + hasthis + (aregs - reg_alloc [i]), REG_ARGP, i*ARG_SIZE);
+ }
+ } else {
+ /* two words transferred on the stack */
+ stack_offs -= 2*sizeof(armword_t);
+ ARM_LDR_IMM(p, ARMREG_R0, REG_ARGP, i*ARG_SIZE);
+ ARM_STR_IMM(p, ARMREG_R0, ARMREG_SP, stack_offs);
+ ARM_LDR_IMM(p, ARMREG_R0, REG_ARGP, i*ARG_SIZE + 4);
+ ARM_STR_IMM(p, ARMREG_R0, ARMREG_SP, stack_offs + 4);
+ }
+ break;
+ case MONO_TYPE_STRING:
+ if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || runtime) {
+ goto push_a_word;
+ } else {
+ if (sig->hasthis && this_loaded) {
+ ARM_MOV_REG_REG(p, REG_THIS, ARMREG_A1);
+ this_loaded = 0;
+ }
+
+ if (sig->hasthis && strc == str_args) {
+ ARM_PUSH(p, (1 << REG_THIS));
+ /* adjust stack pointers */
+ stack_offs += sizeof(armword_t);
+ utf8_stack_offs += sizeof(armword_t);
+ }
+
+ utf8_offs = -(p + 2 - utf8_addr) * sizeof(arminstr_t);
+ utf8_reg = sig->hasthis ? REG_FUNC_ADDR : REG_THIS;
+ /* load function address */
+ ARM_LDR_IMM(p, utf8_reg, ARMREG_PC, utf8_offs);
+ /* load MonoString ptr */
+ ARM_LDR_IMM(p, ARMREG_A1, REG_ARGP, i*ARG_SIZE);
+ /* call string_to_utf8 function */
+ ARM_MOV_REG_REG(p, ARMREG_LR, ARMREG_PC);
+ ARM_MOV_REG_REG(p, ARMREG_PC, utf8_reg);
+
+ /* count-down string args */
+ --strc;
+
+ if (sig->hasthis && strc == 0) {
+ ARM_POP(p, (1 << REG_THIS));
+ /* restore stack pointers */
+ stack_offs -= sizeof(armword_t);
+ utf8_stack_offs -= sizeof(armword_t);
+ }
+
+ /* maintain list of allocated strings */
+ utf8_stack_offs -= sizeof(gpointer);
+ ARM_STR_IMM(p, ARMREG_R0, ARMREG_SP, utf8_stack_offs);
+
+ if (i < aregs && reg_alloc [i] > 0) {
+ /* pass in register */
+ utf8_reg = ARMREG_A1 + hasthis + (aregs - reg_alloc [i]);
+ /* result returned in R0, avoid NOPs */
+ if (utf8_reg != ARMREG_R0) {
+ ARM_MOV_REG_REG(p, utf8_reg, ARMREG_R0);
+ }
+ } else {
+ stack_offs -= sizeof(armword_t);
+ ARM_STR_IMM(p, ARMREG_R0, ARMREG_SP, stack_offs);
+ }
+ }
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (param->data.klass->enumtype) {
+ /* it's an enum value, proceed based on its base type */
+ simple_type = param->data.klass->enum_basetype->type;
+ goto enum_marshal;
+ } else {
+ goto push_a_word;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ if (sig->hasthis && !this_loaded) {
+ /* [this] always passed in A1, regardless of sig->call_convention */
+ ARM_MOV_REG_REG(p, ARMREG_A1, REG_THIS);
+ }
+
+ /* call [func] */
+ ARM_MOV_REG_REG(p, ARMREG_LR, ARMREG_PC);
+ ARM_MOV_REG_REG(p, ARMREG_PC, REG_FUNC_ADDR);
+
+
+ /* handle retval */
+ if (sig->ret->byref) {
+ ARM_STR_IMM(p, ARMREG_R0, REG_RETVAL, 0);
+ } else {
+ simple_type = sig->ret->type;
+enum_retvalue:
+ switch (simple_type) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ ARM_STRB_IMM(p, ARMREG_R0, REG_RETVAL, 0);
+ break;
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ ARM_STRH_IMM(p, ARMREG_R0, REG_RETVAL, 0);
+ break;
+ /*
+ * A 32-bit integer and integer-equivalent return value
+ * is returned in R0.
+ * Single-precision floating-point values are returned in R0.
+ */
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_ARRAY:
+ ARM_STR_IMM(p, ARMREG_R0, REG_RETVAL, 0);
+ break;
+ case MONO_TYPE_STRING:
+ if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || runtime) {
+ /* return UTF8 string as-is */
+ ARM_STR_IMM(p, ARMREG_R0, REG_RETVAL, 0);
+ } else {
+ /* if result is non-null convert it back to MonoString */
+ utf8_offs = -(p + 2 - str_new_addr) * sizeof(arminstr_t);
+ ARM_TEQ_REG_IMM8(p, ARMREG_R0, 0);
+ /* load mono_string_new_wrapper address */
+ ARM_LDR_IMM_COND(p, ARMREG_R2, ARMREG_PC, utf8_offs, ARMCOND_NE);
+ /* call mono_string_new_wrapper */
+ ARM_MOV_REG_REG_COND(p, ARMREG_LR, ARMREG_PC, ARMCOND_NE);
+ ARM_MOV_REG_REG_COND(p, ARMREG_PC, ARMREG_R2, ARMCOND_NE);
+
+ ARM_STR_IMM(p, ARMREG_R0, REG_RETVAL, 0);
+ }
+ break;
+ /*
+ * A 64-bit integer is returned in R0 and R1.
+ * Double-precision floating-point values are returned in R0 and R1.
+ */
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R8:
+ ARM_STR_IMM(p, ARMREG_R0, REG_RETVAL, 0);
+ ARM_STR_IMM(p, ARMREG_R1, REG_RETVAL, 4);
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->ret->data.klass->enumtype) {
+ simple_type = sig->ret->data.klass->enum_basetype->type;
+ goto enum_retvalue;
+ }
+ break;
+ case MONO_TYPE_VOID:
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* free allocated strings */
+ if (str_args) {
+ utf8_stack_offs = stack_size + str_args*sizeof(gpointer);
+ for (strc = str_args; --strc >= 0;) {
+ utf8_stack_offs -= sizeof(gpointer);
+ /* calc PC-relative offset to function addr */
+ utf8_offs = -(p + 2 - free_addr) * sizeof(arminstr_t);
+ /* load function address */
+ ARM_LDR_IMM(p, ARMREG_R2, ARMREG_PC, utf8_offs);
+ /* load MonoString ptr */
+ ARM_LDR_IMM(p, ARMREG_A1, ARMREG_SP, utf8_stack_offs);
+ /* call free function */
+ ARM_MOV_REG_REG(p, ARMREG_LR, ARMREG_PC);
+ ARM_MOV_REG_REG(p, ARMREG_PC, ARMREG_R2);
+ }
+ }
+
+
+ p = arm_emit_std_epilogue(p, stack_size + str_args*sizeof(gpointer),
+ /* restore R4-R7 */
+ (1 << ARMREG_R4) | (1 << ARMREG_R5) | (1 << ARMREG_R6) | (1 << ARMREG_R7));
+
+ flush_icache();
+
+#ifdef ARM_DUMP_DISASM
+ _armdis_decode((arminstr_t*)code_buff, ((guint8*)p) - ((guint8*)code_buff));
+#endif
+
+ return code_buff;
+}
+
+
+
+#define MINV_OFFS(member) G_STRUCT_OFFSET(MonoInvocation, member)
+
+
+/*
+ * Returns a pointer to a native function that can be used to
+ * call the specified method.
+ * The function created will receive the arguments according
+ * to the call convention specified in the method.
+ * This function works by creating a MonoInvocation structure,
+ * filling the fields in and calling ves_exec_method on it.
+ * Still need to figure out how to handle the exception stuff
+ * across the managed/unmanaged boundary.
+ */
+void* mono_create_method_pointer (MonoMethod* method)
+{
+ MonoMethodSignature* sig;
+ guchar* p, * p_method, * p_stackval_from_data, * p_exec;
+ void* code_buff;
+ int i, stack_size, arg_pos, arg_add, stackval_pos, offs;
+ int areg, reg_args, shift, pos;
+
+ code_buff = alloc_code_buff(128);
+ p = (guchar*)code_buff;
+
+ sig = method->signature;
+
+ ARM_B(p, 3);
+
+ /* embed magic number followed by method pointer */
+ *p++ = 'M';
+ *p++ = 'o';
+ *p++ = 'n';
+ *p++ = 'o';
+ /* method ptr */
+ *(void**)p = method;
+ p_method = p;
+ p += 4;
+
+ /* call table */
+ *(void**)p = stackval_from_data;
+ p_stackval_from_data = p;
+ p += 4;
+ *(void**)p = ves_exec_method;
+ p_exec = p;
+ p += 4;
+
+
+ stack_size = sizeof(MonoInvocation) + ARG_SIZE*(sig->param_count + 1) + ARM_NUM_ARG_REGS*2*sizeof(armword_t);
+
+ /* prologue */
+ p = (guchar*)arm_emit_lean_prologue((arminstr_t*)p, stack_size,
+ (1 << ARMREG_R4) |
+ (1 << ARMREG_R5) |
+ (1 << ARMREG_R6) |
+ (1 << ARMREG_R7));
+
+ /* R7 - ptr to stack args */
+ ARM_MOV_REG_REG(p, ARMREG_R7, ARMREG_IP);
+
+ /*
+ * Initialize MonoInvocation fields, first the ones known now.
+ */
+ ARM_MOV_REG_IMM8(p, ARMREG_R4, 0);
+ ARM_STR_IMM(p, ARMREG_R4, ARMREG_SP, MINV_OFFS(ex));
+ ARM_STR_IMM(p, ARMREG_R4, ARMREG_SP, MINV_OFFS(ex_handler));
+ ARM_STR_IMM(p, ARMREG_R4, ARMREG_SP, MINV_OFFS(child));
+ ARM_STR_IMM(p, ARMREG_R4, ARMREG_SP, MINV_OFFS(parent));
+
+ /* Set the method pointer. */
+ ARM_LDR_IMM(p, ARMREG_R4, ARMREG_PC, -(int)(p - p_method + sizeof(arminstr_t)*2));
+ ARM_STR_IMM(p, ARMREG_R4, ARMREG_SP, MINV_OFFS(method));
+
+ if (sig->hasthis) {
+ /* [this] in A1 */
+ ARM_STR_IMM(p, ARMREG_A1, ARMREG_SP, MINV_OFFS(obj));
+ } else {
+ /* else set minv.obj to NULL */
+ ARM_STR_IMM(p, ARMREG_R4, ARMREG_SP, MINV_OFFS(obj));
+ }
+
+ /* copy args from registers to stack */
+ areg = ARMREG_A1 + sig->hasthis;
+ arg_pos = -(int)(ARM_NUM_ARG_REGS - sig->hasthis) * 2 * sizeof(armword_t);
+ arg_add = 0;
+ for (i = 0; i < sig->param_count; ++i) {
+ if (areg >= ARM_NUM_ARG_REGS) break;
+ ARM_STR_IMM(p, areg, ARMREG_R7, arg_pos);
+ ++areg;
+ if (!sig->params[i]->byref) {
+ switch (sig->params[i]->type) {
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R8:
+ if (areg >= ARM_NUM_ARG_REGS) {
+ /* load second half of 64-bit arg */
+ ARM_LDR_IMM(p, ARMREG_R4, ARMREG_R7, 0);
+ ARM_STR_IMM(p, ARMREG_R4, ARMREG_R7, arg_pos + sizeof(armword_t));
+ arg_add = sizeof(armword_t);
+ } else {
+ /* second half is already the register */
+ ARM_STR_IMM(p, areg, ARMREG_R7, arg_pos + sizeof(armword_t));
+ ++areg;
+ }
+ break;
+ case MONO_TYPE_VALUETYPE:
+ /* assert */
+ default:
+ break;
+ }
+ }
+ arg_pos += 2 * sizeof(armword_t);
+ }
+ /* number of args passed in registers */
+ reg_args = i;
+
+
+
+ /*
+ * Calc and save stack args ptr,
+ * args follow MonoInvocation struct on the stack.
+ */
+ ARM_ADD_REG_IMM8(p, ARMREG_R1, ARMREG_SP, sizeof(MonoInvocation));
+ ARM_STR_IMM(p, ARMREG_R1, ARMREG_SP, MINV_OFFS(stack_args));
+
+ /* convert method args to stackvals */
+ arg_pos = -(int)(ARM_NUM_ARG_REGS - sig->hasthis) * 2 * sizeof(armword_t);
+ stackval_pos = sizeof(MonoInvocation);
+ for (i = 0; i < sig->param_count; ++i) {
+ if (i < reg_args) {
+ ARM_SUB_REG_IMM8(p, ARMREG_A3, ARMREG_R7, -arg_pos);
+ arg_pos += 2 * sizeof(armword_t);
+ } else {
+ if (arg_pos < 0) arg_pos = 0;
+ pos = arg_pos + arg_add;
+ if (pos <= 0xFF) {
+ ARM_ADD_REG_IMM8(p, ARMREG_A3, ARMREG_R7, pos);
+ } else {
+ if (is_arm_const((armword_t)pos)) {
+ shift = calc_arm_mov_const_shift((armword_t)pos);
+ ARM_ADD_REG_IMM(p, ARMREG_A3, ARMREG_R7, pos >> ((32 - shift) & 31), shift >> 1);
+ } else {
+ p = (guchar*)arm_mov_reg_imm32((arminstr_t*)p, ARMREG_R6, (armword_t)pos);
+ ARM_ADD_REG_REG(p, ARMREG_A2, ARMREG_R7, ARMREG_R6);
+ }
+ }
+ arg_pos += sizeof(armword_t);
+ if (!sig->params[i]->byref) {
+ switch (sig->params[i]->type) {
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R8:
+ arg_pos += sizeof(armword_t);
+ break;
+ case MONO_TYPE_VALUETYPE:
+ /* assert */
+ default:
+ break;
+ }
+ }
+ }
+
+ /* A2 = result */
+ if (stackval_pos <= 0xFF) {
+ ARM_ADD_REG_IMM8(p, ARMREG_A2, ARMREG_SP, stackval_pos);
+ } else {
+ if (is_arm_const((armword_t)stackval_pos)) {
+ shift = calc_arm_mov_const_shift((armword_t)stackval_pos);
+ ARM_ADD_REG_IMM(p, ARMREG_A2, ARMREG_SP, stackval_pos >> ((32 - shift) & 31), shift >> 1);
+ } else {
+ p = (guchar*)arm_mov_reg_imm32((arminstr_t*)p, ARMREG_R6, (armword_t)stackval_pos);
+ ARM_ADD_REG_REG(p, ARMREG_A2, ARMREG_SP, ARMREG_R6);
+ }
+ }
+
+ /* A1 = type */
+ p = (guchar*)arm_mov_reg_imm32((arminstr_t*)p, ARMREG_A1, (armword_t)sig->params [i]);
+
+ stackval_pos += ARG_SIZE;
+
+ offs = -(p + 2*sizeof(arminstr_t) - p_stackval_from_data);
+ /* load function address */
+ ARM_LDR_IMM(p, ARMREG_R4, ARMREG_PC, offs);
+ /* call stackval_from_data */
+ ARM_MOV_REG_REG(p, ARMREG_LR, ARMREG_PC);
+ ARM_MOV_REG_REG(p, ARMREG_PC, ARMREG_R4);
+ }
+
+ /* store retval ptr */
+ p = (guchar*)arm_mov_reg_imm32((arminstr_t*)p, ARMREG_R5, (armword_t)stackval_pos);
+ ARM_ADD_REG_REG(p, ARMREG_R5, ARMREG_SP, ARMREG_R4);
+ ARM_STR_IMM(p, ARMREG_R5, ARMREG_SP, MINV_OFFS(retval));
+
+ /*
+ * Call the method.
+ */
+ /* A1 = MonoInvocation ptr */
+ ARM_MOV_REG_REG(p, ARMREG_A1, ARMREG_SP);
+ offs = -(p + 2*sizeof(arminstr_t) - p_exec);
+ /* load function address */
+ ARM_LDR_IMM(p, ARMREG_R4, ARMREG_PC, offs);
+ /* call ves_exec */
+ ARM_MOV_REG_REG(p, ARMREG_LR, ARMREG_PC);
+ ARM_MOV_REG_REG(p, ARMREG_PC, ARMREG_R4);
+
+
+ /*
+ * Move retval into reg.
+ */
+ if (sig->ret->byref) {
+ ARM_LDR_IMM(p, ARMREG_R0, ARMREG_R5, 0);
+ } else {
+ switch (sig->ret->type) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ ARM_LDRB_IMM(p, ARMREG_R0, ARMREG_R5, 0);
+ break;
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ ARM_LDRH_IMM(p, ARMREG_R0, ARMREG_R5, 0);
+ break;
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_ARRAY:
+ ARM_LDR_IMM(p, ARMREG_R0, ARMREG_R5, 0);
+ break;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R8:
+ ARM_LDR_IMM(p, ARMREG_R0, ARMREG_R5, 0);
+ ARM_LDR_IMM(p, ARMREG_R1, ARMREG_R5, 4);
+ break;
+ case MONO_TYPE_VOID:
+ default:
+ break;
+ }
+ }
+
+
+ p = (guchar*)arm_emit_std_epilogue((arminstr_t*)p, stack_size,
+ (1 << ARMREG_R4) |
+ (1 << ARMREG_R5) |
+ (1 << ARMREG_R6) |
+ (1 << ARMREG_R7));
+
+ flush_icache();
+
+#ifdef ARM_DUMP_DISASM
+ _armdis_decode((arminstr_t*)code_buff, ((guint8*)p) - ((guint8*)code_buff));
+#endif
+
+ return code_buff;
+}
+
+
+/*
+ * mono_create_method_pointer () will insert a pointer to the MonoMethod
+ * so that the interp can easily get at the data: this function will retrieve
+ * the method from the code stream.
+ */
+MonoMethod* mono_method_pointer_get (void* code)
+{
+ unsigned char* c = code;
+ /* check out magic number that follows unconditional branch */
+ if (c[4] == 'M' &&
+ c[5] == 'o' &&
+ c[6] == 'n' &&
+ c[7] == 'o') return ((MonoMethod**)code)[2];
+ return NULL;
+}
+
diff --git a/mono/arch/ppc/.cvsignore b/mono/arch/ppc/.cvsignore
new file mode 100644
index 00000000000..3c6240dc7a4
--- /dev/null
+++ b/mono/arch/ppc/.cvsignore
@@ -0,0 +1,7 @@
+Makefile
+Makefile.in
+.libs
+.deps
+*.la
+*.lo
+test \ No newline at end of file
diff --git a/mono/arch/ppc/Makefile.am b/mono/arch/ppc/Makefile.am
new file mode 100644
index 00000000000..ddfb109ab0d
--- /dev/null
+++ b/mono/arch/ppc/Makefile.am
@@ -0,0 +1,8 @@
+
+INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)
+
+noinst_LTLIBRARIES = libmonoarch-ppc.la
+
+libmonoarch_ppc_la_SOURCES = tramp.c ppc-codegen.h
+
+noinst_PROGRAMS = test \ No newline at end of file
diff --git a/mono/arch/ppc/ppc-codegen.h b/mono/arch/ppc/ppc-codegen.h
new file mode 100644
index 00000000000..c3f79b2e437
--- /dev/null
+++ b/mono/arch/ppc/ppc-codegen.h
@@ -0,0 +1,115 @@
+/*
+ Copyright (C) 2001 Radek Doulik
+*/
+
+#ifndef PPC_H
+#define PPC_H
+#include <glib.h>
+#include <assert.h>
+
+typedef enum {
+ ppc_r0 = 0,
+ ppc_r1,
+ ppc_r2,
+ ppc_r3,
+ ppc_r4,
+ ppc_r5,
+ ppc_r6,
+ ppc_r7,
+ ppc_r8,
+ ppc_r9,
+ ppc_r10,
+ ppc_r11,
+ ppc_r12,
+ ppc_r13,
+ ppc_r14,
+ ppc_r15,
+ ppc_r16,
+ ppc_r17,
+ ppc_r18,
+ ppc_r19,
+ ppc_r20,
+ ppc_r21,
+ ppc_r22,
+ ppc_r23,
+ ppc_r24,
+ ppc_r25,
+ ppc_r26,
+ ppc_r27,
+ ppc_r28,
+ ppc_r29,
+ ppc_r30,
+ ppc_r31
+} PPCIntRegister;
+
+typedef enum {
+ ppc_f0 = 0,
+ ppc_f1,
+ ppc_f2,
+ ppc_f3,
+ ppc_f4,
+ ppc_f5,
+ ppc_f6,
+ ppc_f7,
+ ppc_f8,
+ ppc_f9,
+ ppc_f10,
+ ppc_f11,
+ ppc_f12,
+ ppc_f13,
+ ppc_f14,
+ ppc_f15,
+ ppc_f16,
+ ppc_f17,
+ ppc_f18,
+ ppc_f19,
+ ppc_f20,
+ ppc_f21,
+ ppc_f22,
+ ppc_f23,
+ ppc_f24,
+ ppc_f25,
+ ppc_f26,
+ ppc_f27,
+ ppc_f28,
+ ppc_f29,
+ ppc_f30,
+ ppc_f31
+} PPCFloatRegister;
+
+typedef enum {
+ ppc_lr = 256,
+} PPCSpecialRegister;
+
+#define ppc_emit32(c,x) *((guint32 *) c) = x; ((guint32 *)c)++
+
+#define ppc_addi(c,D,A,d) ppc_emit32 (c, (14 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
+#define ppc_addis(c,D,A,d) ppc_emit32 (c, (15 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
+#define ppc_li(c,D,v) ppc_addi (c, D, 0, v);
+#define ppc_lis(c,D,v) ppc_addis (c, D, 0, v);
+#define ppc_lwz(c,D,d,a) ppc_emit32 (c, (32 << 26) | ((D) << 21) | ((a) << 16) | (guint16)(d))
+#define ppc_lhz(c,D,d,a) ppc_emit32 (c, (40 << 26) | ((D) << 21) | ((a) << 16) | (guint16)(d))
+#define ppc_lbz(c,D,d,a) ppc_emit32 (c, (34 << 26) | ((D) << 21) | ((a) << 16) | (guint16)(d))
+#define ppc_stw(c,S,d,a) ppc_emit32 (c, (36 << 26) | ((S) << 21) | ((a) << 16) | (guint16)(d))
+#define ppc_sth(c,S,d,a) ppc_emit32 (c, (44 << 26) | ((S) << 21) | ((a) << 16) | (guint16)(d))
+#define ppc_stb(c,S,d,a) ppc_emit32 (c, (38 << 26) | ((S) << 21) | ((a) << 16) | (guint16)(d))
+#define ppc_stwu(c,s,d,a) ppc_emit32 (c, (37 << 26) | ((s) << 21) | ((a) << 16) | (guint16)(d))
+#define ppc_or(c,a,s,b) ppc_emit32 (c, (31 << 26) | ((s) << 21) | ((a) << 16) | ((b) << 11) | 888)
+#define ppc_ori(c,S,A,u) ppc_emit32 (c, (24 << 26) | ((S) << 21) | ((A) << 16) | (guint16)(u))
+#define ppc_mr(c,a,s) ppc_or (c, a, s, s)
+#define ppc_mfspr(c,D,spr) ppc_emit32 (c, (31 << 26) | ((D) << 21) | ((spr) << 11) | (339 << 1))
+#define ppc_mflr(c,D) ppc_mfspr (c, D, ppc_lr)
+#define ppc_mtspr(c,spr,S) ppc_emit32 (c, (31 << 26) | ((S) << 21) | ((spr) << 11) | (467 << 1))
+#define ppc_mtlr(c,S) ppc_mtspr (c, ppc_lr, S)
+
+#define ppc_b(c,li) ppc_emit32 (c, (18 << 26) | ((li) << 2))
+#define ppc_blrl(c) ppc_emit32 (c, 0x4e800021)
+#define ppc_blr(c) ppc_emit32 (c, 0x4e800020)
+
+#define ppc_lfs(c,D,d,A) ppc_emit32 (c, (48 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
+#define ppc_lfd(c,D,d,A) ppc_emit32 (c, (50 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
+#define ppc_stfs(c,S,d,a) ppc_emit32 (c, (52 << 26) | ((S) << 21) | ((a) << 16) | (guint16)(d))
+#define ppc_stfd(c,S,d,a) ppc_emit32 (c, (54 << 26) | ((S) << 21) | ((a) << 16) | (guint16)(d))
+
+
+#endif
diff --git a/mono/arch/ppc/test.c b/mono/arch/ppc/test.c
new file mode 100644
index 00000000000..f80e5bb6670
--- /dev/null
+++ b/mono/arch/ppc/test.c
@@ -0,0 +1,30 @@
+#include "ppc-codegen.h"
+#include <stdio.h>
+
+/* don't run the resulting program, it will destroy your computer,
+ * just objdump -d it to inspect we generated the correct assembler.
+ */
+
+int main() {
+ guint8 code [16000];
+ guint8 *p = code;
+ guint8 *cp;
+
+ printf (".text\n.align 4\n.globl main\n.type main,@function\nmain:\n");
+
+ ppc_stwu (p, ppc_r1, -32, ppc_r1);
+ ppc_mflr (p, ppc_r0);
+ ppc_stw (p, ppc_r31, 28, ppc_r1);
+ ppc_or (p, ppc_r1, ppc_r2, ppc_r3);
+ ppc_mr (p, ppc_r31, ppc_r1);
+ ppc_lwz (p, ppc_r11, 0, ppc_r1);
+ ppc_mtlr (p, ppc_r0);
+ ppc_blr (p);
+ ppc_addi (p, ppc_r6, ppc_r6, 16);
+
+ for (cp = code; cp < p; cp++) {
+ printf (".byte 0x%x\n", *cp);
+ }
+
+ return 0;
+}
diff --git a/mono/arch/ppc/tramp.c b/mono/arch/ppc/tramp.c
new file mode 100644
index 00000000000..0e012963c12
--- /dev/null
+++ b/mono/arch/ppc/tramp.c
@@ -0,0 +1,808 @@
+/*
+ * Create trampolines to invoke arbitrary functions.
+ *
+ * Copyright (C) Radek Doulik
+ *
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include "ppc-codegen.h"
+#include "mono/metadata/class.h"
+#include "mono/metadata/tabledefs.h"
+#include "mono/interpreter/interp.h"
+#include "mono/metadata/appdomain.h"
+
+#ifdef NEED_MPROTECT
+#include <sys/mman.h>
+#include <limits.h> /* for PAGESIZE */
+#ifndef PAGESIZE
+#define PAGESIZE 4096
+#endif
+#endif
+
+/* gpointer
+fake_func (gpointer (*callme)(gpointer), stackval *retval, void *this_obj, stackval *arguments)
+{
+ guint32 i = 0xc002becd;
+
+ callme = (gpointer) 0x100fabcd;
+
+ *(gpointer*)retval = (gpointer)(*callme) (arguments [0].data.p, arguments [1].data.p, arguments [2].data.p);
+ *(gdouble*) retval = (gdouble)(*callme) (arguments [0].data.f);
+
+ return (gpointer) (*callme) (((MonoType *)arguments [0]. data.p)->data.klass);
+} */
+
+#define MIN_CACHE_LINE 8
+
+static void inline
+flush_icache (guint8 *code, guint size)
+{
+ guint i;
+ guint8 *p;
+
+ p = code;
+ for (i = 0; i < size; i += MIN_CACHE_LINE, p += MIN_CACHE_LINE) {
+ asm ("dcbst 0,%0;" : : "r"(p) : "memory");
+ }
+ asm ("sync");
+ p = code;
+ for (i = 0; i < size; i += MIN_CACHE_LINE, p += MIN_CACHE_LINE) {
+ asm ("icbi 0,%0; sync;" : : "r"(p) : "memory");
+ }
+ asm ("sync");
+ asm ("isync");
+}
+
+#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 MINIMAL_STACK_SIZE 5
+#define FLOAT_REGS 8
+#define GENERAL_REGS 8
+
+static void inline
+add_general (guint *gr, guint *stack_size, guint *code_size, gboolean simple)
+{
+ if (simple) {
+ if (*gr >= GENERAL_REGS) {
+ *stack_size += 4;
+ *code_size += 8; /* load from stack, save on stack */
+ } else {
+ *code_size += 4; /* load from stack */
+ }
+ } else {
+ if (*gr >= GENERAL_REGS - 1) {
+ *stack_size += 8 + (*stack_size % 8);
+ *code_size += 16; /* 2x load from stack, 2x save to stack */
+ } else {
+ *code_size += 16; /* 2x load from stack */
+ }
+ if ((*gr) && 1)
+ (*gr) ++;
+ (*gr) ++;
+ }
+ (*gr) ++;
+}
+
+static void inline
+calculate_sizes (MonoMethod *method, guint *stack_size, guint *code_size, guint *strings, gint runtime)
+{
+ MonoMethodSignature *sig;
+ guint i, fr, gr;
+ guint32 simpletype;
+
+ fr = gr = 0;
+ *stack_size = MINIMAL_STACK_SIZE*4;
+ *code_size = (PROLOG_INS + CALL_INS + EPILOG_INS)*4;
+ *strings = 0;
+
+ sig = method->signature;
+ if (sig->hasthis) {
+ add_general (&gr, stack_size, code_size, TRUE);
+ }
+
+ for (i = 0; i < sig->param_count; ++i) {
+ if (sig->params [i]->byref) {
+ add_general (&gr, stack_size, code_size, TRUE);
+ continue;
+ }
+ simpletype = sig->params [i]->type;
+ enum_calc_size:
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ add_general (&gr, stack_size, code_size, TRUE);
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->params [i]->data.klass->enumtype) {
+ simpletype = sig->params [i]->data.klass->enum_basetype->type;
+ goto enum_calc_size;
+ }
+ if (mono_class_value_size (sig->params [i]->data.klass, NULL) != 4)
+ g_error ("can only marshal enums, not generic structures (size: %d)",
+ mono_class_value_size (sig->params [i]->data.klass, NULL));
+ add_general (&gr, stack_size, code_size, TRUE);
+ *code_size += 4;
+ break;
+ case MONO_TYPE_STRING:
+ if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || runtime) {
+ add_general (&gr, stack_size, code_size, TRUE);
+ break;
+ }
+ (*strings) ++;
+ *code_size += 12*4;
+ *stack_size += 4;
+ break;
+ case MONO_TYPE_I8:
+ add_general (&gr, stack_size, code_size, FALSE);
+ break;
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ if (fr < 7) {
+ *code_size += 4;
+ fr ++;
+ } else {
+ NOT_IMPLEMENTED ("R8 arg");
+ }
+ break;
+ default:
+ g_error ("Can't trampoline 0x%x", sig->params [i]->type);
+ }
+ }
+
+ if (sig->ret->byref) {
+ *code_size += 8;
+ } else {
+ simpletype = sig->ret->type;
+enum_retvalue:
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ *code_size += 8;
+ break;
+ case MONO_TYPE_STRING:
+ *code_size += 8;
+ if (!(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) && !runtime) {
+ *code_size += 16;
+ }
+ break;
+ case MONO_TYPE_I8:
+ *code_size += 12;
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->ret->data.klass->enumtype) {
+ simpletype = sig->ret->data.klass->enum_basetype->type;
+ goto enum_retvalue;
+ }
+ NOT_IMPLEMENTED ("valuetype");
+ break;
+ case MONO_TYPE_VOID:
+ break;
+ default:
+ g_error ("Can't handle as return value 0x%x", sig->ret->type);
+ }
+ }
+
+ if (*strings) {
+ /* space to keep parameters and prepared strings */
+ *stack_size += 8;
+ *code_size += 16;
+ if (sig->hasthis) {
+ *stack_size += 4;
+ *code_size += 12;
+ }
+ }
+ /* align stack size to 16 */
+ printf (" stack size: %d (%d)\n code size: %d\n", (*stack_size + 15) & ~15, *stack_size, *code_size);
+ *stack_size = (*stack_size + 15) & ~15;
+
+}
+
+static inline guint8 *
+emit_prolog (guint8 *p, MonoMethod *method, guint stack_size, guint strings)
+{
+ /* function prolog */
+ ppc_stwu (p, ppc_r1, -stack_size, ppc_r1); /* sp <--- sp - stack_size, sp[0] <---- sp save sp, alloc stack */
+ ppc_mflr (p, ppc_r0); /* r0 <--- LR */
+ ppc_stw (p, ppc_r31, stack_size - 4, ppc_r1); /* sp[+4] <--- r31 save r31 */
+ ppc_stw (p, ppc_r0, stack_size + 4, ppc_r1); /* sp[-4] <--- LR save return address for "callme" */
+ ppc_mr (p, ppc_r31, ppc_r1); /* r31 <--- sp */
+
+ /* handle our parameters */
+ if (strings) {
+ ppc_stw (p, ppc_r30, stack_size - 16, ppc_r1);
+ ppc_stw (p, ppc_r29, stack_size - 12, ppc_r1);
+ if (method->signature->hasthis) {
+ ppc_stw (p, ppc_r28, 24, ppc_r1);
+ }
+ ppc_mr (p, ppc_r30, ppc_r6); /* args */
+ ppc_mr (p, ppc_r29, ppc_r3); /* callme */
+ if (method->signature->hasthis) {
+ ppc_mr (p, ppc_r28, ppc_r5); /* this */
+ }
+ } else {
+ ppc_mr (p, ppc_r12, ppc_r6); /* keep "arguments" in register */
+ ppc_mr (p, ppc_r0, ppc_r3); /* keep "callme" in register */
+ }
+ ppc_stw (p, ppc_r4, stack_size - 12, ppc_r31); /* preserve "retval", sp[+8] */
+
+ return p;
+}
+
+#define ARG_BASE strings ? ppc_r30 : ppc_r12
+#define SAVE_4_IN_GENERIC_REGISTER \
+ if (gr < GENERAL_REGS) { \
+ ppc_lwz (p, ppc_r3 + gr, i*16, ARG_BASE); \
+ gr ++; \
+ } else { \
+ ppc_lwz (p, ppc_r11, i*16, ARG_BASE); \
+ ppc_stw (p, ppc_r11, stack_par_pos, ppc_r1); \
+ stack_par_pos += 4; \
+ }
+
+inline static guint8*
+emit_save_parameters (guint8 *p, MonoMethod *method, guint stack_size, guint strings, gint runtime)
+{
+ MonoMethodSignature *sig;
+ guint i, fr, gr, act_strs, stack_par_pos;
+ guint32 simpletype;
+
+ fr = gr = 0;
+ act_strs = 0;
+ sig = method->signature;
+ stack_par_pos = 8;
+
+ if (strings) {
+ for (i = 0; i < sig->param_count; ++i) {
+ if (!sig->params [i]->byref && sig->params [i]->type == MONO_TYPE_STRING
+ && !((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || runtime)) {
+ ppc_lis (p, ppc_r0, (guint32) mono_string_to_utf8 >> 16);
+ ppc_lwz (p, ppc_r3, i*16, ppc_r30);
+ ppc_ori (p, ppc_r0, ppc_r0, (guint32) mono_string_to_utf8 & 0xffff);
+ ppc_mtlr (p, ppc_r0);
+ ppc_blrl (p);
+ ppc_stw (p, ppc_r3, stack_size - 24 - act_strs, ppc_r31);
+ act_strs += 4;
+ }
+ }
+ }
+
+ if (sig->hasthis) {
+ ppc_mr (p, ppc_r3, ppc_r5);
+ gr ++;
+ }
+
+ act_strs = 0;
+ for (i = 0; i < sig->param_count; ++i) {
+ if (sig->params [i]->byref) {
+ SAVE_4_IN_GENERIC_REGISTER;
+ continue;
+ }
+ simpletype = sig->params [i]->type;
+ enum_calc_size:
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ SAVE_4_IN_GENERIC_REGISTER;
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->params [i]->data.klass->enumtype) {
+ simpletype = sig->params [i]->data.klass->enum_basetype->type;
+ goto enum_calc_size;
+ }
+ if (mono_class_value_size (sig->params [i]->data.klass, NULL) != 4)
+ g_error ("can only marshal enums, not generic structures (size: %d)",
+ mono_class_value_size (sig->params [i]->data.klass, NULL));
+ if (gr < GENERAL_REGS) {
+ ppc_lwz (p, ppc_r3 + gr, i*16, ARG_BASE);
+ ppc_lwz (p, ppc_r3 + gr, 0, ppc_r3 + gr);
+ gr ++;
+ } else {
+ NOT_IMPLEMENTED ("save value type on stack");
+ }
+ break;
+ case MONO_TYPE_STRING:
+ if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || runtime) {
+ SAVE_4_IN_GENERIC_REGISTER;
+ } else {
+ if (gr < 8) {
+ ppc_lwz (p, ppc_r3 + gr, stack_size - 24 - act_strs, ppc_r31);
+ gr ++;
+ act_strs += 4;
+ } else
+ NOT_IMPLEMENTED ("string on stack");
+ }
+ break;
+ case MONO_TYPE_I8:
+ if (gr < 7) {
+ if (gr & 1)
+ gr ++;
+ g_warning ("check endianess");
+ ppc_lwz (p, ppc_r3 + gr, i*16, ARG_BASE);
+ gr ++;
+ ppc_lwz (p, ppc_r3 + gr, i*17, ARG_BASE);
+ gr ++;
+ } else {
+ NOT_IMPLEMENTED ("i8 on stack");
+ }
+ break;
+ case MONO_TYPE_R4:
+ if (fr < 7) {
+ ppc_lfs (p, ppc_f1 + fr, i*16, ARG_BASE);
+ fr ++;
+ } else {
+ NOT_IMPLEMENTED ("r4 on stack");
+ }
+ break;
+ case MONO_TYPE_R8:
+ if (fr < 7) {
+ ppc_lfd (p, ppc_f1 + fr, i*16, ARG_BASE);
+ fr ++;
+ } else {
+ NOT_IMPLEMENTED ("r8 on stack");
+ }
+ break;
+ default:
+ g_error ("Can't trampoline 0x%x", sig->params [i]->type);
+ }
+ }
+
+ return p;
+}
+
+static inline guint8 *
+alloc_code_memory (guint code_size)
+{
+ guint8 *p;
+
+#ifdef NEED_MPROTECT
+ p = g_malloc (code_size + PAGESIZE - 1);
+
+ /* Align to a multiple of PAGESIZE, assumed to be a power of two */
+ p = (char *)(((int) p + PAGESIZE-1) & ~(PAGESIZE-1));
+#else
+ p = g_malloc (code_size);
+#endif
+ printf (" align: %p (%d)\n", p, (guint)p % 4);
+
+ return p;
+}
+
+static MonoString*
+mono_string_new_wrapper (const char *text)
+{
+ return text ? mono_string_new (mono_domain_get (), text) : NULL;
+}
+
+static inline guint8 *
+emit_call_and_store_retval (guint8 *p, MonoMethod *method, guint stack_size, guint strings, gint runtime)
+{
+ MonoMethodSignature *sig = method->signature;
+ guint32 simpletype;
+
+ /* call "callme" */
+ ppc_mtlr (p, strings ? ppc_r29 : ppc_r0);
+ ppc_blrl (p);
+
+ /* get return value */
+ if (sig->ret->byref) {
+ ppc_lwz (p, ppc_r9, stack_size - 12, ppc_r31); /* load "retval" address */
+ ppc_stw (p, ppc_r3, 0, ppc_r9); /* save return value (r3) to "retval" */
+ } else {
+ simpletype = sig->ret->type;
+enum_retvalue:
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ ppc_lwz (p, ppc_r9, stack_size - 12, ppc_r31); /* load "retval" address */
+ ppc_stb (p, ppc_r3, 0, ppc_r9); /* save return value (r3) to "retval" */
+ break;
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ ppc_lwz (p, ppc_r9, stack_size - 12, ppc_r31); /* load "retval" address */
+ ppc_sth (p, ppc_r3, 0, ppc_r9); /* save return value (r3) to "retval" */
+ break;
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ ppc_lwz (p, ppc_r9, stack_size - 12, ppc_r31); /* load "retval" address */
+ ppc_stw (p, ppc_r3, 0, ppc_r9); /* save return value (r3) to "retval" */
+ break;
+ case MONO_TYPE_STRING:
+ if (!(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) && !runtime) {
+ ppc_lis (p, ppc_r0, (guint32) mono_string_new_wrapper >> 16);
+ ppc_ori (p, ppc_r0, ppc_r0, (guint32) mono_string_new_wrapper & 0xffff);
+ ppc_mtlr (p, ppc_r0);
+ ppc_blrl (p);
+ }
+
+ ppc_lwz (p, ppc_r9, stack_size - 12, ppc_r31); /* load "retval" address */
+ ppc_stw (p, ppc_r3, 0, ppc_r9); /* save return value (r3) to "retval" */
+
+ break;
+ case MONO_TYPE_R4:
+ ppc_lwz (p, ppc_r9, stack_size - 12, ppc_r31); /* load "retval" address */
+ ppc_stfs (p, ppc_f1, 0, ppc_r9); /* save return value (f1) to "retval" */
+ break;
+ case MONO_TYPE_R8:
+ ppc_lwz (p, ppc_r9, stack_size - 12, ppc_r31); /* load "retval" address */
+ ppc_stfd (p, ppc_f1, 0, ppc_r9); /* save return value (f1) to "retval" */
+ break;
+ case MONO_TYPE_I8:
+ g_warning ("check endianess");
+ ppc_lwz (p, ppc_r9, stack_size - 12, ppc_r31); /* load "retval" address */
+ ppc_stw (p, ppc_r3, 0, ppc_r9); /* save return value (r3) to "retval" */
+ ppc_stw (p, ppc_r4, 4, ppc_r9); /* save return value (r3) to "retval" */
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->ret->data.klass->enumtype) {
+ simpletype = sig->ret->data.klass->enum_basetype->type;
+ goto enum_retvalue;
+ }
+ NOT_IMPLEMENTED ("retval valuetype");
+ break;
+ case MONO_TYPE_VOID:
+ break;
+ default:
+ g_error ("Can't handle as return value 0x%x", sig->ret->type);
+ }
+ }
+
+ return p;
+}
+
+static inline guint8 *
+emit_epilog (guint8 *p, MonoMethod *method, guint stack_size, guint strings, gboolean runtime)
+{
+ if (strings) {
+ MonoMethodSignature *sig = method->signature;
+ guint i, act_strs;
+
+ /* free allocated memory */
+ act_strs = 0;
+ for (i = 0; i < sig->param_count; ++i) {
+ if (!sig->params [i]->byref && sig->params [i]->type == MONO_TYPE_STRING
+ && !((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || runtime)) {
+ ppc_lis (p, ppc_r0, (guint32) g_free >> 16);
+ ppc_lwz (p, ppc_r3, stack_size - 24 - act_strs, ppc_r31);
+ ppc_ori (p, ppc_r0, ppc_r0, (guint32) g_free & 0xffff);
+ ppc_mtlr (p, ppc_r0);
+ ppc_blrl (p);
+ act_strs += 4;
+ }
+ }
+
+ /* restore volatile registers */
+ ppc_lwz (p, ppc_r30, stack_size - 16, ppc_r1);
+ ppc_lwz (p, ppc_r29, stack_size - 12, ppc_r1);
+ if (method->signature->hasthis) {
+ ppc_lwz (p, ppc_r28, 24, ppc_r1);
+ }
+ }
+
+ /* function epilog */
+ ppc_lwz (p, ppc_r11, 0, ppc_r1); /* r11 <--- sp[0] load backchain from caller's function */
+ ppc_lwz (p, ppc_r0, 4, ppc_r11); /* r0 <--- r11[4] load return address */
+ ppc_mtlr (p, ppc_r0); /* LR <--- r0 set return address */
+ ppc_lwz (p, ppc_r31, -4, ppc_r11); /* r31 <--- r11[-4] restore r31 */
+ ppc_mr (p, ppc_r1, ppc_r11); /* sp <--- r11 restore stack */
+ ppc_blr (p); /* return */
+
+ return p;
+}
+
+MonoPIFunc
+mono_create_trampoline (MonoMethod *method, int runtime)
+{
+ guint8 *p, *code_buffer;
+ guint stack_size, code_size, strings;
+
+ printf ("\nPInvoke [start emiting] %s\n", method->name);
+ calculate_sizes (method, &stack_size, &code_size, &strings, runtime);
+
+ p = code_buffer = alloc_code_memory (code_size);
+ p = emit_prolog (p, method, stack_size, strings);
+ p = emit_save_parameters (p, method, stack_size, strings, runtime);
+ p = emit_call_and_store_retval (p, method, stack_size, strings, runtime);
+ p = emit_epilog (p, method, stack_size, strings, runtime);
+
+ /* {
+ guchar *cp;
+ printf (".text\n.align 4\n.globl main\n.type main,@function\nmain:\n");
+ for (cp = code_buffer; cp < p; cp++) {
+ printf (".byte 0x%x\n", *cp);
+ }
+ } */
+
+#ifdef NEED_MPROTECT
+ if (mprotect (code_buffer, 1024, PROT_READ | PROT_WRITE | PROT_EXEC)) {
+ g_error ("Cannot mprotect trampoline\n");
+ }
+#endif
+
+ printf ("emited code size: %d\n", p - code_buffer);
+ flush_icache (code_buffer, p - code_buffer);
+
+ printf ("PInvoke [end emiting]\n");
+
+ return (MonoPIFunc) code_buffer;
+ /* return fake_func; */
+}
+
+
+#define MINV_POS 8 /* MonoInvocation structure offset on stack */
+#define STACK_POS (MINV_POS - sizeof (stackval) * sig->param_count)
+#define OBJ_POS 8
+#define TYPE_OFFSET (G_STRUCT_OFFSET (stackval, type))
+
+/*
+ * Returns a pointer to a native function that can be used to
+ * call the specified method.
+ * The function created will receive the arguments according
+ * to the call convention specified in the method.
+ * This function works by creating a MonoInvocation structure,
+ * filling the fields in and calling ves_exec_method on it.
+ * Still need to figure out how to handle the exception stuff
+ * across the managed/unmanaged boundary.
+ */
+void *
+mono_create_method_pointer (MonoMethod *method)
+{
+ MonoMethodSignature *sig;
+ guint8 *p, *code_buffer;
+ guint i, code_size, stack_size, stackval_arg_pos, local_pos, local_start, reg_param, stack_param;
+ guint32 simpletype;
+
+ code_size = 512;
+ stack_size = 512;
+ stack_param = 0;
+
+ sig = method->signature;
+
+ p = code_buffer = g_malloc (code_size);
+
+ printf ("\nDelegate [start emiting] %s\n", method->name);
+
+ /* jump after header which consist of "Mono" + method ptr */
+ ppc_b (p, 3);
+ *p = 'M'; p ++;
+ *p = 'o'; p ++;
+ *p = 'n'; p ++;
+ *p = 'o'; p ++;
+ *(void **) p = method; p += 4;
+
+ /* prolog */
+ ppc_stwu (p, ppc_r1, -stack_size, ppc_r1); /* sp <--- sp - stack_size, sp[0] <---- sp save sp, alloc stack */
+ ppc_mflr (p, ppc_r0); /* r0 <--- LR */
+ ppc_stw (p, ppc_r31, stack_size - 4, ppc_r1); /* sp[+4] <--- r31 save r31 */
+ ppc_stw (p, ppc_r0, stack_size + 4, ppc_r1); /* sp[-4] <--- LR save return address for "callme" */
+ ppc_mr (p, ppc_r31, ppc_r1); /* r31 <--- sp */
+
+ /* let's fill MonoInvocation */
+ /* first zero some fields */
+ ppc_li (p, ppc_r0, 0);
+ ppc_stw (p, ppc_r0, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, ex)), ppc_r31);
+ ppc_stw (p, ppc_r0, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, ex_handler)), ppc_r31);
+ ppc_stw (p, ppc_r0, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, child)), ppc_r31);
+ ppc_stw (p, ppc_r0, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, parent)), ppc_r31);
+
+ /* set method pointer */
+ ppc_lis (p, ppc_r0, (guint32) method >> 16);
+ ppc_ori (p, ppc_r0, ppc_r0, (guint32) method & 0xffff);
+ ppc_stw (p, ppc_r0, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, method)), ppc_r31);
+
+ local_start = local_pos = MINV_POS + sizeof (MonoInvocation) + (sig->param_count + 1) * sizeof (stackval);
+
+ if (sig->hasthis) {
+ ppc_stw (p, ppc_r3, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, obj)), ppc_r31);
+ reg_param = 1;
+ } else {
+ ppc_stw (p, ppc_r3, local_pos, ppc_r31);
+ local_pos += 4;
+ reg_param = 0;
+ }
+ ppc_stw (p, ppc_r4, local_pos, ppc_r31); local_pos += 4;
+ ppc_stw (p, ppc_r5, local_pos, ppc_r31); local_pos += 4;
+
+ /* set MonoInvocation::stack_args */
+ stackval_arg_pos = MINV_POS + sizeof (MonoInvocation);
+ ppc_addi (p, ppc_r0, ppc_r31, stackval_arg_pos);
+ ppc_stw (p, ppc_r0, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, stack_args)), ppc_r31);
+
+ /* add stackval arguments */
+ for (i = 0; i < sig->param_count; ++i) {
+#define CALL_STACKVAL_FROM_DATA \
+ ppc_lis (p, ppc_r0, (guint32) stackval_from_data >> 16); \
+ ppc_ori (p, ppc_r0, ppc_r0, (guint32) stackval_from_data & 0xffff); \
+ ppc_mtlr (p, ppc_r0); \
+ ppc_blrl (p)
+#define CALL_SIZE_4 \
+ if (reg_param < 3 - (sig->hasthis ? 1 : 0)) { \
+ ppc_addi (p, ppc_r5, ppc_r31, local_start + (reg_param - (sig->hasthis ? 1 : 0))*4); \
+ reg_param ++; \
+ } else if (reg_param < 8) { \
+ ppc_stw (p, ppc_r3 + reg_param, local_pos, ppc_r31); \
+ ppc_addi (p, ppc_r5, ppc_r31, local_pos); \
+ reg_param ++; \
+ } else { \
+ ppc_addi (p, ppc_r5, stack_size + 8 + stack_param, ppc_r31); \
+ stack_param ++; \
+ } \
+ ppc_lis (p, ppc_r3, (guint32) sig->params [i] >> 16); \
+ ppc_addi (p, ppc_r4, ppc_r31, stackval_arg_pos); \
+ stackval_arg_pos ++; \
+ ppc_ori (p, ppc_r3, ppc_r3, (guint32) sig->params [i] & 0xffff); \
+\
+ CALL_STACKVAL_FROM_DATA
+
+ if (sig->params [i]->byref) {
+ CALL_SIZE_4;
+ continue;
+ }
+ simpletype = sig->params [i]->type;
+ enum_calc_size:
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ CALL_SIZE_4;
+ break;
+ case MONO_TYPE_VALUETYPE:
+ NOT_IMPLEMENTED ("value type");
+ break;
+ case MONO_TYPE_I8:
+ NOT_IMPLEMENTED ("i8");
+ break;
+ case MONO_TYPE_R4:
+ NOT_IMPLEMENTED ("r4");
+ break;
+ case MONO_TYPE_R8:
+ NOT_IMPLEMENTED ("r8");
+ break;
+ default:
+ g_error ("Can't delegate 0x%x type", sig->params [i]->type);
+ }
+ }
+
+ /* return value storage */
+ if (sig->param_count) {
+ ppc_addi (p, ppc_r0, ppc_r31, stackval_arg_pos);
+ }
+ ppc_stw (p, ppc_r0, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, retval)), ppc_r31);
+
+ /* call ves_exec_method */
+ ppc_lis (p, ppc_r0, (guint32) ves_exec_method >> 16);
+ ppc_addi (p, ppc_r3, ppc_r31, MINV_POS);
+ ppc_ori (p, ppc_r0, ppc_r0, (guint32) ves_exec_method & 0xffff);
+ ppc_mtlr (p, ppc_r0);
+ ppc_blrl (p);
+
+ /* move retval from stackval to proper place (r3/r4/...) */
+ if (sig->ret->byref) {
+ ppc_lwz (p, ppc_r3, stackval_arg_pos, ppc_r31);
+ } else {
+ switch (sig->ret->type) {
+ case MONO_TYPE_VOID:
+ break;
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_CLASS:
+ ppc_lwz (p, ppc_r3, stackval_arg_pos, ppc_r31);
+ break;
+ case MONO_TYPE_I8:
+ ppc_lwz (p, ppc_r3, stackval_arg_pos, ppc_r31);
+ ppc_lwz (p, ppc_r4, stackval_arg_pos + 1, ppc_r31);
+ break;
+ case MONO_TYPE_R4:
+ ppc_lfs (p, ppc_f1, stackval_arg_pos, ppc_r31);
+ break;
+ case MONO_TYPE_R8:
+ ppc_lfd (p, ppc_f1, stackval_arg_pos, ppc_r31);
+ break;
+ default:
+ g_error ("Type 0x%x not handled yet in thunk creation", sig->ret->type);
+ break;
+ }
+ }
+
+ /* epilog */
+ ppc_lwz (p, ppc_r11, 0, ppc_r1); /* r11 <--- sp[0] load backchain from caller's function */
+ ppc_lwz (p, ppc_r0, 4, ppc_r11); /* r0 <--- r11[4] load return address */
+ ppc_mtlr (p, ppc_r0); /* LR <--- r0 set return address */
+ ppc_lwz (p, ppc_r31, -4, ppc_r11); /* r31 <--- r11[-4] restore r31 */
+ ppc_mr (p, ppc_r1, ppc_r11); /* sp <--- r11 restore stack */
+ ppc_blr (p); /* return */
+
+ printf ("emited code size: %d\n", p - code_buffer);
+ flush_icache (code_buffer, p - code_buffer);
+
+ printf ("Delegate [end emiting]\n");
+
+ return (MonoPIFunc) code_buffer;
+}
+
+
+/*
+ * mono_create_method_pointer () will insert a pointer to the MonoMethod
+ * so that the interp can easily get at the data: this function will retrieve
+ * the method from the code stream.
+ */
+MonoMethod*
+mono_method_pointer_get (void *code)
+{
+ unsigned char *c = code;
+ if (c [4] != 'M' || c [5] != 'o' || c [6] != 'n' || c [7] != 'o')
+ return NULL;
+ return *(MonoMethod**)(c + 8);
+}
diff --git a/mono/arch/sparc/.cvsignore b/mono/arch/sparc/.cvsignore
new file mode 100644
index 00000000000..282522db034
--- /dev/null
+++ b/mono/arch/sparc/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/mono/arch/sparc/Makefile.am b/mono/arch/sparc/Makefile.am
new file mode 100644
index 00000000000..e0f7689ee31
--- /dev/null
+++ b/mono/arch/sparc/Makefile.am
@@ -0,0 +1,7 @@
+
+INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)
+
+noinst_LTLIBRARIES = libmonoarch-sparc.la
+
+libmonoarch_sparc_la_SOURCES = tramp.c sparc-codegen.h
+
diff --git a/mono/arch/sparc/sparc-codegen.h b/mono/arch/sparc/sparc-codegen.h
new file mode 100644
index 00000000000..04a23c35822
--- /dev/null
+++ b/mono/arch/sparc/sparc-codegen.h
@@ -0,0 +1,486 @@
+#ifndef __SPARC_CODEGEN_H__
+#define __SPARC_CODEGEN_H__
+
+typedef enum {
+ sparc_r0 = 0,
+ sparc_r1 = 1,
+ sparc_r2 = 2,
+ sparc_r3 = 3,
+ sparc_r4 = 4,
+ sparc_r5 = 5,
+ sparc_r6 = 6,
+ sparc_r7 = 7,
+ sparc_r8 = 8,
+ sparc_r9 = 9,
+ sparc_r10 = 10,
+ sparc_r11 = 11,
+ sparc_r12 = 12,
+ sparc_r13 = 13,
+ sparc_r14 = 14,
+ sparc_r15 = 15,
+ sparc_r16 = 16,
+ sparc_r17 = 17,
+ sparc_r18 = 18,
+ sparc_r19 = 19,
+ sparc_r20 = 20,
+ sparc_r21 = 21,
+ sparc_r22 = 22,
+ sparc_r23 = 23,
+ sparc_r24 = 24,
+ sparc_r25 = 25,
+ sparc_r26 = 26,
+ sparc_r27 = 27,
+ sparc_r28 = 28,
+ sparc_r29 = 29,
+ sparc_r30 = 30,
+ sparc_r31 = 31,
+ /* aliases */
+ /* global registers */
+ sparc_g0 = 0, sparc_zero = 0,
+ sparc_g1 = 1,
+ sparc_g2 = 2,
+ sparc_g3 = 3,
+ sparc_g4 = 4,
+ sparc_g5 = 5,
+ sparc_g6 = 6,
+ sparc_g7 = 7,
+ /* out registers */
+ sparc_o0 = 8,
+ sparc_o1 = 9,
+ sparc_o2 = 10,
+ sparc_o3 = 11,
+ sparc_o4 = 12,
+ sparc_o5 = 13,
+ sparc_o6 = 14, sparc_sp = 14,
+ sparc_o7 = 15, sparc_callsite = 15,
+ /* local registers */
+ sparc_l0 = 16,
+ sparc_l1 = 17,
+ sparc_l2 = 18,
+ sparc_l3 = 19,
+ sparc_l4 = 20,
+ sparc_l5 = 21,
+ sparc_l6 = 22,
+ sparc_l7 = 23,
+ /* in registers */
+ sparc_i0 = 24,
+ sparc_i1 = 25,
+ sparc_i2 = 26,
+ sparc_i3 = 27,
+ sparc_i4 = 28,
+ sparc_i5 = 29,
+ sparc_i6 = 30, sparc_fp = 30,
+ sparc_i7 = 31,
+ sparc_nreg = 32,
+ /* floating point registers */
+ sparc_f0 = 0,
+ sparc_f1 = 1,
+ sparc_f2 = 2,
+ sparc_f3 = 3,
+ sparc_f4 = 4,
+ sparc_f5 = 5,
+ sparc_f6 = 6,
+ sparc_f7 = 7,
+ sparc_f8 = 8,
+ sparc_f9 = 9,
+ sparc_f10 = 10,
+ sparc_f11 = 11,
+ sparc_f12 = 12,
+ sparc_f13 = 13,
+ sparc_f14 = 14,
+ sparc_f15 = 15,
+ sparc_f16 = 16,
+ sparc_f17 = 17,
+ sparc_f18 = 18,
+ sparc_f19 = 19,
+ sparc_f20 = 20,
+ sparc_f21 = 21,
+ sparc_f22 = 22,
+ sparc_f23 = 23,
+ sparc_f24 = 24,
+ sparc_f25 = 25,
+ sparc_f26 = 26,
+ sparc_f27 = 27,
+ sparc_f28 = 28,
+ sparc_f29 = 29,
+ sparc_f30 = 30,
+ sparc_f31 = 31,
+} SparcRegister;
+
+typedef enum {
+ sparc_bn = 0, sparc_bnever = 0,
+ sparc_be = 1,
+ sparc_ble = 2,
+ sparc_bl = 3,
+ sparc_bleu = 4,
+ sparc_bcs = 5, sparc_blu = 5,
+ sparc_bneg = 6,
+ sparc_bvs = 7, sparc_boverflow = 7,
+ sparc_ba = 8, sparc_balways = 8,
+ sparc_bne = 9,
+ sparc_bg = 10,
+ sparc_bge = 11,
+ sparc_bgu = 12,
+ sparc_bcc = 13, sparc_beu = 13,
+ sparc_bpos = 14,
+ sparc_bvc = 15
+} SparcCond;
+
+typedef enum {
+ /* with fcmp */
+ sparc_feq = 0,
+ sparc_fl = 1,
+ sparc_fg = 2,
+ sparc_unordered = 3,
+ /* branch ops */
+ sparc_fba = 8,
+ sparc_fbn = 0,
+ sparc_fbu = 7,
+ sparc_fbg = 6,
+ sparc_fbug = 5,
+ sparc_fbl = 4,
+ sparc_fbul = 3,
+ sparc_fblg = 2,
+ sparc_fbne = 1,
+ sparc_fbe = 9,
+ sparc_fbue = 10,
+ sparc_fbge = 11,
+ sparc_fbuge = 12,
+ sparc_fble = 13,
+ sparc_fbule = 14,
+ sparc_fbo = 15
+} SparcFCond;
+
+typedef enum {
+ /* fop1 format */
+ sparc_fitos = 196,
+ sparc_fitod = 200,
+ sparc_fstoi = 209,
+ sparc_fdtoi = 210,
+ sparc_fstod = 201,
+ sparc_fdtos = 198,
+ sparc_fmov = 1,
+ sparc_fneg = 5,
+ sparc_fabs = 9,
+ sparc_fsqrts = 41,
+ sparc_fsqrtd = 42,
+ sparc_fadds = 65,
+ sparc_faddd = 66,
+ sparc_fsubs = 69,
+ sparc_fsubd = 70,
+ sparc_fmuls = 73,
+ sparc_fmuld = 74,
+ sparc_fdivs = 77,
+ sparc_fdivd = 78,
+ /* fop2 format */
+ sparc_fcmps = 81,
+ sparc_fcmpd = 82
+} SparcFOp;
+
+typedef struct {
+ unsigned int op : 2; /* always 1 */
+ unsigned int disp : 30;
+} sparc_format1;
+
+typedef struct {
+ unsigned int op : 2; /* always 0 */
+ unsigned int rd : 5;
+ unsigned int op2 : 3;
+ unsigned int disp : 22;
+} sparc_format2a;
+
+typedef struct {
+ unsigned int op : 2; /* always 0 */
+ unsigned int a : 1;
+ unsigned int cond : 4;
+ unsigned int op2 : 3;
+ unsigned int disp : 22;
+} sparc_format2b;
+
+typedef struct {
+ unsigned int op : 2; /* 2 or 3 */
+ unsigned int rd : 5;
+ unsigned int op3 : 6;
+ unsigned int rs1 : 5;
+ unsigned int i : 1;
+ unsigned int asi : 8;
+ unsigned int rs2 : 5;
+} sparc_format3a;
+
+typedef struct {
+ unsigned int op : 2; /* 2 or 3 */
+ unsigned int rd : 5;
+ unsigned int op3 : 6;
+ unsigned int rs1 : 5;
+ unsigned int i : 1;
+ unsigned int imm : 13;
+} sparc_format3b;
+
+typedef struct {
+ unsigned int op : 2; /* 2 or 3 */
+ unsigned int rd : 5;
+ unsigned int op3 : 6;
+ unsigned int rs1 : 5;
+ unsigned int opf : 9;
+ unsigned int rs2 : 5;
+} sparc_format3c;
+
+/* for use in logical ops, use 0 to not set flags */
+#define sparc_cc 16
+
+#define sparc_encode_call(ins,addr) \
+ do { \
+ sparc_format1 *__f = (sparc_format1*)(ins); \
+ __f->op = 1; \
+ __f->disp = ((unsigned int)(addr) >> 2); \
+ (ins) = (unsigned int*)__f + 1; \
+ } while (0)
+
+#define sparc_encode_format2a(ins,val,oper,dest) \
+ do { \
+ sparc_format2a *__f = (sparc_format2a*)(ins); \
+ __f->op = 0; \
+ __f->rd = (dest); \
+ __f->op2 = (oper); \
+ __f->disp = (val) & 0x3fffff; \
+ (ins) = (unsigned int*)__f + 1; \
+ } while (0)
+
+#define sparc_encode_format2b(ins,aval,bcond,oper,disp22) \
+ do { \
+ sparc_format2b *__f = (sparc_format2b*)(ins); \
+ __f->op = 0; \
+ __f->a = (aval); \
+ __f->cond = (bcond); \
+ __f->op2 = (oper); \
+ __f->disp = (disp22); \
+ (ins) = (unsigned int*)__f + 1; \
+ } while (0)
+
+#define sparc_encode_format3a(ins,opval,asival,r1,r2,oper,dest) \
+ do { \
+ sparc_format3a *__f = (sparc_format3a*)(ins); \
+ __f->op = (opval); \
+ __f->asi = (asival); \
+ __f->i = 0; \
+ __f->rd = (dest); \
+ __f->rs1 = (r1); \
+ __f->rs2 = (r2); \
+ __f->op3 = (oper); \
+ (ins) = (unsigned int*)__f + 1; \
+ } while (0)
+
+#define sparc_encode_format3b(ins,opval,r1,val,oper,dest) \
+ do { \
+ sparc_format3b *__f = (sparc_format3b*)(ins); \
+ __f->op = (opval); \
+ __f->imm = (val); \
+ __f->i = 1; \
+ __f->rd = (dest); \
+ __f->rs1 = (r1); \
+ __f->op3 = (oper); \
+ (ins) = (unsigned int*)__f + 1; \
+ } while (0)
+
+#define sparc_encode_format3c(ins,opval,opfval,r1,oper,r2,dest) \
+ do { \
+ sparc_format3c *__f = (sparc_format3c*)(ins); \
+ __f->op = (opval); \
+ __f->opf = (opfval); \
+ __f->rd = (dest); \
+ __f->rs1 = (r1); \
+ __f->rs2 = (r2); \
+ __f->op3 = (oper); \
+ (ins) = (unsigned int*)__f + 1; \
+ } while (0)
+
+/* is it useful to provide a non-default value? */
+#define sparc_asi 0x0
+
+/* load */
+#define sparc_ldsb(ins,base,disp,dest) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),9,(dest))
+#define sparc_ldsb_imm(ins,base,disp,dest) sparc_encode_format3b((ins),3,(base),(disp),9,(dest))
+
+#define sparc_ldsh(ins,base,disp,dest) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),10,(dest))
+#define sparc_ldsh_imm(ins,base,disp,dest) sparc_encode_format3b((ins),3,(base),(disp),10,(dest))
+
+#define sparc_ldub(ins,base,disp,dest) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),1,(dest))
+#define sparc_ldub_imm(ins,base,disp,dest) sparc_encode_format3b((ins),3,(base),(disp),1,(dest))
+
+#define sparc_lduh(ins,base,disp,dest) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),2,(dest))
+#define sparc_lduh_imm(ins,base,disp,dest) sparc_encode_format3b((ins),3,(base),(disp),2,(dest))
+
+#define sparc_ld(ins,base,disp,dest) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),0,(dest))
+#define sparc_ld_imm(ins,base,disp,dest) sparc_encode_format3b((ins),3,(base),(disp),0,(dest))
+
+#define sparc_ldd(ins,base,disp,dest) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),3,(dest))
+#define sparc_ldd_imm(ins,base,disp,dest) sparc_encode_format3b((ins),3,(base),(disp),3,(dest))
+
+#define sparc_ldf(ins,base,disp,dest) sparc_encode_format3a((ins),3,0,(base),(disp),32,(dest))
+#define sparc_ldf_imm(ins,base,disp,dest) sparc_encode_format3b((ins),3,(base),(disp),32,(dest))
+
+#define sparc_lddf(ins,base,disp,dest) sparc_encode_format3a((ins),3,0,(base),(disp),35,(dest))
+#define sparc_lddf_imm(ins,base,disp,dest) sparc_encode_format3b((ins),3,(base),(disp),35,(dest))
+
+/* store */
+#define sparc_stb(ins,src,base,disp) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),5,(src))
+#define sparc_stb_imm(ins,src,base,disp) sparc_encode_format3b((ins),3,(base),(disp),5,(src))
+
+#define sparc_sth(ins,src,base,disp) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),6,(src))
+#define sparc_sth_imm(ins,src,base,disp) sparc_encode_format3b((ins),3,(base),(disp),6,(src))
+
+#define sparc_st(ins,src,base,disp) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),4,(src))
+#define sparc_st_imm(ins,src,base,disp) sparc_encode_format3b((ins),3,(base),(disp),4,(src))
+
+#define sparc_std(ins,src,base,disp) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),7,(src))
+#define sparc_std_imm(ins,src,base,disp) sparc_encode_format3b((ins),3,(base),(disp),7,(src))
+
+#define sparc_stf(ins,src,base,disp) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),36,(src))
+#define sparc_stf_imm(ins,src,base,disp) sparc_encode_format3b((ins),3,(base),(disp),36,(src))
+
+#define sparc_stdf(ins,src,base,disp) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),39,(src))
+#define sparc_stdf_imm(ins,src,base,disp) sparc_encode_format3b((ins),3,(base),(disp),39,(src))
+
+/* swap */
+#define sparc_ldstub(ins,base,disp,dest) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),13,(dest))
+#define sparc_ldstub_imm(ins,base,disp,dest) sparc_encode_format3b((ins),3,(base),(disp),13,(dest))
+
+#define sparc_swap(ins,base,disp,dest) sparc_encode_format3a((ins),3,sparc_asi,(base),(disp),15,(dest))
+#define sparc_swap_imm(ins,base,disp,dest) sparc_encode_format3b((ins),3,(base),(disp),15,(dest))
+
+/* misc */
+/* note: with sethi val is the full 32 bit value (think of it as %hi(val)) */
+#define sparc_sethi(ins,val,dest) sparc_encode_format2a((ins),((val)>>10),4,(dest))
+
+#define sparc_nop(ins) sparc_sethi((ins),0,sparc_zero)
+
+#define sparc_save(ins,src,disp,dest) sparc_encode_format3a((ins),2,0,(src),(disp),60,(dest))
+#define sparc_save_imm(ins,src,disp,dest) sparc_encode_format3b((ins),2,(src),(disp),60,(dest))
+
+#define sparc_restore(ins,src,disp,dest) sparc_encode_format3a((ins),2,0,(src),(disp),61,(dest))
+#define sparc_restore_imm(ins,src,disp,dest) sparc_encode_format3b((ins),2,(src),(disp),61,(dest))
+
+#define sparc_jmpl(ins,base,disp,dest) sparc_encode_format3a((ins),2,0,(base),(disp),56,(dest))
+#define sparc_jmpl_imm(ins,base,disp,dest) sparc_encode_format3b((ins),2,(base),(disp),56,(dest))
+
+#define sparc_call_simple(ins,addr) sparc_encode_call((ins),((unsigned int)(addr)>>2))
+
+#define sparc_rdy(ins,dest) sparc_encode_format3a((ins),2,0,0,0,40,(dest))
+
+#define sparc_wry(ins,base,disp) sparc_encode_format3a((ins),2,0,(base),(disp),48,0)
+#define sparc_wry_imm(ins,base,disp) sparc_encode_format3b((ins),2,(base),(disp),48,0)
+
+/* stbar, unimp, flush */
+#define sparc_stbar(ins) sparc_encode_format3a((ins),2,0,15,0,40,0)
+#define sparc_unimp(ins,val) sparc_encode_format2b((ins),0,0,0,(val))
+
+#define sparc_flush(ins,base,disp) sparc_encode_format3a((ins),2,0,(base),(disp),59,0)
+#define sparc_flush_imm(ins,base,disp) sparc_encode_format3b((ins),2,(base),(disp),59,0)
+
+/* trap */
+
+/* alu fop */
+/* provide wrappers for: fitos, fitod, fstoi, fdtoi, fstod, fdtos, fmov, fneg, fabs */
+
+#define sparc_fop(ins,r1,op,r2,dest) sparc_encode_format3c((ins),2,(op),(r1),52,(r2),(dest))
+#define sparc_fcmp(ins,r1,op,r2) sparc_encode_format3c((ins),2,(op),(r1),53,(r2),0)
+
+/* logical */
+#define sparc_and(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|1,(dest))
+#define sparc_and_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|1,(dest))
+
+#define sparc_andn(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|5,(dest))
+#define sparc_andn_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|5,(dest))
+
+#define sparc_or(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|2,(dest))
+#define sparc_or_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|2,(dest))
+
+#define sparc_orn(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|6,(dest))
+#define sparc_orn_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|6,(dest))
+
+#define sparc_xor(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|3,(dest))
+#define sparc_xor_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(r2),(imm)|3,(dest))
+
+#define sparc_xnor(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|7,(dest))
+#define sparc_xnor_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|7,(dest))
+
+/* shift */
+#define sparc_sll(ins,src,disp,dest) sparc_encode_format3a((ins),2,0,(src),(disp),37,(dest))
+#define sparc_sll_imm(ins,src,disp,dest) sparc_encode_format3b((ins),2,(src),(disp),37,(dest))
+
+#define sparc_srl(ins,src,disp,dest) sparc_encode_format3a((ins),2,0,(src),(disp),38,(dest))
+#define sparc_srl_imm(ins,src,disp,dest) sparc_encode_format3b((ins),2,(src),(disp),38,(dest))
+
+#define sparc_sra(ins,src,disp,dest) sparc_encode_format3a((ins),2,0,(src),(disp),39,(dest))
+#define sparc_sra_imm(ins,src,disp,dest) sparc_encode_format3b((ins),2,(src),(disp),39,(dest))
+
+/* alu */
+#define sparc_add(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|0,(dest))
+#define sparc_add_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|0,(dest))
+
+#define sparc_addx(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|8,(dest))
+#define sparc_addx_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|8,(dest))
+
+#define sparc_sub(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|4,(dest))
+#define sparc_sub_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|4,(dest))
+
+#define sparc_subx(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|12,(dest))
+#define sparc_subx_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|12,(dest))
+
+#define sparc_muls(ins,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),36,(dest))
+#define sparc_muls_imm(ins,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),36,(dest))
+
+#define sparc_umul(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|10,(dest))
+#define sparc_umul_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|10,(dest))
+
+#define sparc_smul(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|11,(dest))
+#define sparc_smul_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|11,(dest))
+
+#define sparc_udiv(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|14,(dest))
+#define sparc_udiv_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|14,(dest))
+
+#define sparc_sdiv(ins,setcc,r1,r2,dest) sparc_encode_format3a((ins),2,0,(r1),(r2),(setcc)|15,(dest))
+#define sparc_sdiv_imm(ins,setcc,r1,imm,dest) sparc_encode_format3b((ins),2,(r1),(imm),(setcc)|15,(dest))
+
+
+/* branch */
+#define sparc_branch(ins,aval,condval,displ) sparc_encode_format2b((ins),(aval),(condval),2,(displ))
+/* FIXME: float condition codes are different: unify. */
+#define sparc_fbranch(ins,aval,condval,displ) sparc_encode_format2b((ins),(aval),(condval),6,(displ))
+
+/* synthetic instructions */
+#define sparc_cmp(ins,r1,r2) sparc_sub((ins),sparc_cc,(r1),(r2),sparc_g0)
+#define sparc_cmp_imm(ins,r1,imm) sparc_sub_imm((ins),sparc_cc,(r1),(imm),sparc_g0)
+
+#define sparc_jmp(ins,base,disp) sparc_jmpl((ins),(base),(disp),sparc_g0)
+#define sparc_jmp_imm(ins,base,disp) sparc_jmpl_imm((ins),(base),(disp),sparc_g0)
+#define sparc_call(ins,base,disp) sparc_jmpl((ins),(base),(disp),sparc_o7)
+#define sparc_call_imm(ins,base,disp) sparc_jmpl_imm((ins),(base),(disp),sparc_o7)
+
+#define sparc_test(ins,reg) sparc_or ((ins),sparc_cc,sparc_g0,(reg),sparc_g0)
+
+#define sparc_ret(ins) sparc_jmpl_imm((ins),sparc_i7,8,sparc_g0)
+#define sparc_retl(ins) sparc_jmpl_imm((ins),sparc_o7,8,sparc_g0)
+#define sparc_restore_simple(ins) sparc_restore((ins),sparc_g0,sparc_g0,sparc_g0)
+
+#define sparc_set(ins,val,reg) \
+ do { \
+ if (((val) & 0x1fff) == 0) \
+ sparc_sethi((ins),(val),(reg)); \
+ else if (((val) >= -4096) && ((val) <= 4095)) \
+ sparc_or_imm((ins),FALSE,sparc_g0,(val),(reg)); \
+ else { \
+ sparc_sethi((ins),(val),(reg)); \
+ sparc_or_imm((ins),FALSE,(reg),(val)&0x3ff,(reg)); \
+ } \
+ } while (0)
+
+#define sparc_not(ins,reg) sparc_xnor((ins),FALSE,(reg),sparc_g0,(reg))
+#define sparc_neg(ins,reg) sparc_sub((ins),FALSE,sparc_g0,(reg),(reg))
+#define sparc_clr_reg(ins,reg) sparc_or((ins),FALSE,sparc_g0,sparc_g0,(reg))
+
+#define sparc_mov_reg_reg(ins,src,dest) sparc_or_imm((ins),FALSE,(src),0,(dest))
+
+
+#endif /* __SPARC_CODEGEN_H__ */
+
diff --git a/mono/arch/sparc/test.c b/mono/arch/sparc/test.c
new file mode 100644
index 00000000000..0d4ad1869b9
--- /dev/null
+++ b/mono/arch/sparc/test.c
@@ -0,0 +1,123 @@
+#include <glib.h>
+#include "sparc-codegen.h"
+
+/* don't run the resulting program, it will destroy your computer,
+ * just objdump -d it to inspect we generated the correct assembler.
+ */
+
+int
+main ()
+{
+ guint32 *p;
+ guint32 code_buffer [500];
+ guint32 local_size = 0, stack_size = 0, code_size = 6;
+ guint32 arg_pos, simpletype;
+ unsigned char *ins;
+ int i, stringp, cur_out_reg, size;
+
+ p = code_buffer;
+
+ printf (".text\n.align 4\n.globl main\n.type main,@function\nmain:\n");
+
+ /*
+ * Standard function prolog.
+ */
+ sparc_save_imm (p, sparc_sp, -112-stack_size, sparc_sp);
+ cur_out_reg = sparc_o0;
+ arg_pos = 0;
+
+ if (1) {
+ sparc_mov_reg_reg (p, sparc_i2, cur_out_reg);
+ ++cur_out_reg;
+ }
+
+ sparc_ld_imm (p, sparc_i3, arg_pos, cur_out_reg);
+ ++cur_out_reg;
+ sparc_ld_imm (p, sparc_i3, arg_pos+4, cur_out_reg);
+ ++cur_out_reg;
+ /*
+ * Insert call to function
+ */
+ sparc_jmpl (p, sparc_i0, 0, sparc_callsite);
+ sparc_nop (p);
+
+ sparc_jmpl_imm (p, sparc_i7, 8, sparc_zero);
+ sparc_restore (p, sparc_zero, sparc_zero, sparc_zero);
+
+ sparc_ldsb (p, sparc_i3, sparc_l0, sparc_o5);
+ sparc_ldsb_imm (p, sparc_i3, 2, sparc_o5);
+
+ sparc_ldsh (p, sparc_i3, sparc_l0, sparc_o5);
+ sparc_ldsh_imm (p, sparc_i3, 2, sparc_o5);
+
+ sparc_ldub (p, sparc_i3, sparc_l0, sparc_o5);
+ sparc_ldub_imm (p, sparc_i3, 2, sparc_o5);
+
+ sparc_lduh (p, sparc_i3, sparc_l0, sparc_o5);
+ sparc_lduh_imm (p, sparc_i3, 2, sparc_o5);
+
+ sparc_ldf (p, sparc_i3, sparc_l0, sparc_o5);
+ sparc_ldf_imm (p, sparc_i3, 2, sparc_o5);
+
+ sparc_stb (p, sparc_i3, sparc_l0, sparc_l2);
+ sparc_stb_imm (p, sparc_i3, sparc_o5, 2);
+
+ sparc_sethi (p, 0xff000000, sparc_o2);
+ sparc_rdy (p, sparc_l0);
+ sparc_wry (p, sparc_l0, sparc_l1);
+ sparc_wry_imm (p, sparc_l0, 16);
+ sparc_stbar (p);
+ sparc_unimp (p, 24);
+ sparc_flush (p, sparc_l4, 0);
+
+ sparc_and (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+ sparc_and_imm (p, FALSE, sparc_l0, 0xff, sparc_o1);
+ sparc_andn (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+ sparc_or (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+ sparc_orn (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+ sparc_xor (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+ sparc_xnor (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+
+ sparc_sll (p, sparc_l0, sparc_l1, sparc_o1);
+ sparc_sll_imm (p, sparc_l0, 2, sparc_o1);
+ sparc_srl (p, sparc_l0, sparc_l1, sparc_o1);
+ sparc_srl_imm (p, sparc_l0, 2, sparc_o1);
+ sparc_sra (p, sparc_l0, sparc_l1, sparc_o1);
+ sparc_sra_imm (p, sparc_l0, 2, sparc_o1);
+
+ sparc_add (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+ sparc_add_imm (p, FALSE, sparc_l0, 0xff, sparc_o1);
+ sparc_addx (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+ sparc_sub (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+ sparc_subx (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+
+ sparc_muls (p, sparc_l0, sparc_l1, sparc_o1);
+ sparc_umul (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+ sparc_smul (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+ sparc_udiv (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+ sparc_sdiv (p, sparc_cc, sparc_l0, sparc_l1, sparc_o1);
+
+ sparc_branch (p, FALSE, sparc_bne, -12);
+ sparc_ret (p);
+ sparc_retl (p);
+ sparc_test (p, sparc_l4);
+ sparc_cmp (p, sparc_l4, sparc_l6);
+ sparc_cmp_imm (p, sparc_l4, 4);
+ sparc_restore_simple (p);
+
+ sparc_set (p, 0xff000000, sparc_l7);
+ sparc_set (p, 1, sparc_l7);
+ sparc_set (p, 0xff0000ff, sparc_l7);
+
+ sparc_not (p, sparc_g2);
+ sparc_neg (p, sparc_g3);
+ sparc_clr_reg (p, sparc_g4);
+
+
+ size = (p-code_buffer)*4;
+ ins = (gchar*)code_buffer;
+ for (i = 0; i < size; ++i)
+ printf (".byte %d\n", (unsigned int) ins [i]);
+ return 0;
+}
+
diff --git a/mono/arch/sparc/tramp.c b/mono/arch/sparc/tramp.c
new file mode 100644
index 00000000000..8bc08ea531a
--- /dev/null
+++ b/mono/arch/sparc/tramp.c
@@ -0,0 +1,539 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Create trampolines to invoke arbitrary functions.
+ *
+ * Copyright (C) Ximian Inc.
+ *
+ * Authors: Paolo Molaro (lupus@ximian.com)
+ * Jeffrey Stedfast <fejj@ximian.com>
+ *
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include "sparc-codegen.h"
+#include "mono/metadata/class.h"
+#include "mono/metadata/tabledefs.h"
+#include "mono/interpreter/interp.h"
+#include "mono/metadata/appdomain.h"
+
+
+#define FUNC_ADDR_POS sparc_i0
+#define RETVAL_POS sparc_i1
+#define THIS_POS sparc_i2
+#define ARGP_POS sparc_i3
+#define LOC_POS -4
+
+#define ARG_SIZE sizeof (stackval)
+
+static void
+fake_func (void (*callme)(gpointer, gpointer), stackval *retval, void *this_obj, stackval *arguments)
+{
+ //*(gpointer*)retval = (gpointer)(*callme) (arguments [0].data.p, arguments [1].data.p, arguments [2].data.p);
+ //*(gdouble*) retval = (gdouble)(*callme) (arguments [0].data.f);
+
+ /* internal_from_handle() */
+ /* return (gpointer)(*callme) (((MonoType *)arguments [0].data.p)->data.klass); */
+
+ /* InitializeArray() */
+ return (*callme) (arguments [0].data.p, arguments [1].data.p);
+}
+
+static const char *
+mono_type (int type)
+{
+ switch (type) {
+ case MONO_TYPE_END:
+ return "MONO_TYPE_END";
+ case MONO_TYPE_VOID:
+ return "MONO_TYPE_VOID";
+ case MONO_TYPE_BOOLEAN:
+ return "MONO_TYPE_BOOLEAN";
+ case MONO_TYPE_CHAR:
+ return "MONO_TYPE_CHAR";
+ case MONO_TYPE_I1:
+ return "MONO_TYPE_I1";
+ case MONO_TYPE_U1:
+ return "MONO_TYPE_U1";
+ case MONO_TYPE_I2:
+ return "MONO_TYPE_I2";
+ case MONO_TYPE_U2:
+ return "MONO_TYPE_U2";
+ case MONO_TYPE_I4:
+ return "MONO_TYPE_I4";
+ case MONO_TYPE_U4:
+ return "MONO_TYPE_U4";
+ case MONO_TYPE_I8:
+ return "MONO_TYPE_I8";
+ case MONO_TYPE_U8:
+ return "MONO_TYPE_U8";
+ case MONO_TYPE_R4:
+ return "MONO_TYPE_R4";
+ case MONO_TYPE_R8:
+ return "MONO_TYPE_R8";
+ case MONO_TYPE_STRING:
+ return "MONO_TYPE_STRING";
+ case MONO_TYPE_PTR:
+ return "MONO_TYPE_PTR";
+ case MONO_TYPE_BYREF:
+ return "MONO_TYPE_BYREF";
+ case MONO_TYPE_VALUETYPE:
+ return "MONO_TYPE_VALUETYPE";
+ case MONO_TYPE_CLASS:
+ return "MONO_TYPE_CLASS";
+ case MONO_TYPE_ARRAY:
+ return "MONO_TYPE_ARRAY";
+ case MONO_TYPE_TYPEDBYREF:
+ return "MONO_TYPE_TYPEBYREF";
+ case MONO_TYPE_I:
+ return "MONO_TYPE_I";
+ case MONO_TYPE_U:
+ return "MONO_TYPE_U";
+ case MONO_TYPE_FNPTR:
+ return "MONO_TYPE_FNPTR";
+ case MONO_TYPE_OBJECT:
+ return "MONO_TYPE_OBJECT";
+ case MONO_TYPE_SZARRAY:
+ return "MONO_TYPE_SZARRAY";
+ case MONO_TYPE_CMOD_REQD:
+ return "MONO_TYPE_CMOD_REQD";
+ case MONO_TYPE_CMOD_OPT:
+ return "MONO_TYPE_CMOD_OPT";
+ case MONO_TYPE_INTERNAL:
+ return "MONO_TYPE_INTERNAL";
+ case MONO_TYPE_MODIFIER:
+ return "MONO_TYPE_MODIFIER";
+ case MONO_TYPE_SENTINEL:
+ return "MONO_TYPE_SENTINEL";
+ case MONO_TYPE_PINNED:
+ return "MONO_TYPE_PINNED";
+ }
+
+ return "??";
+}
+
+static void
+calculate_sizes (MonoMethod *method, guint32 *local_size, guint32 *stack_size, guint32 *code_size, int runtime)
+{
+ MonoMethodSignature *sig = method->signature;
+ guint32 local = 0, stack = 0, code = 6;
+ guint32 simpletype;
+ int i;
+
+ /* function arguments */
+ if (sig->hasthis)
+ code++;
+
+ for (i = 0; i < sig->param_count; i++) {
+ if (sig->params[i]->byref) {
+ stack += sizeof (gpointer);
+ code += i < 6 ? 1 : 3;
+ continue;
+ }
+
+ simpletype = sig->params[i]->type;
+ enum_calc_size:
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ stack += 4;
+ code += i < 6 ? 1 : 3;
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->params[i]->data.klass->enumtype) {
+ simpletype = sig->params[i]->data.klass->enum_basetype->type;
+ goto enum_calc_size;
+ }
+ if (mono_class_value_size (sig->params[i]->data.klass, NULL) != 4)
+ g_error ("can only marshal enums, not generic structures (size: %d)",
+ mono_class_value_size (sig->params[i]->data.klass, NULL));
+ stack += 4;
+ code += i < 6 ? 1 : 3;
+ break;
+ case MONO_TYPE_STRING:
+ if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || runtime) {
+ stack += 4;
+ code += i < 6 ? 1 : 3;
+ break;
+ }
+
+ stack += 4;
+ code += 5;
+ local++;
+ break;
+ case MONO_TYPE_I8:
+ stack += 8;
+ code += i < 6 ? 2 : 3;
+ break;
+ case MONO_TYPE_R8:
+ stack += 8;
+ code += i < 6 ? 2 : 3;
+ break;
+ default:
+ g_error ("Can't trampoline 0x%x", sig->params[i]->type);
+ }
+ }
+
+ /* function return value */
+ if (sig->ret->byref) {
+ code += 2;
+ } else {
+ simpletype = sig->ret->type;
+ enum_retvalue:
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ code += 2;
+ break;
+#if 0
+ case MONO_TYPE_STRING:
+ code += 2;
+ if (!(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) && !runtime) {
+ code += 4;
+ }
+ break;
+#endif
+ case MONO_TYPE_I8:
+ code += 3;
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->ret->data.klass->enumtype) {
+ simpletype = sig->ret->data.klass->enum_basetype->type;
+ goto enum_retvalue;
+ }
+ code += 2;
+ break;
+ case MONO_TYPE_VOID:
+ break;
+ default:
+ g_error ("Can't handle as return value 0x%x", sig->ret->type);
+ }
+ }
+
+#define STACKALIGN(x) (((x) + 15) & (~15))
+#define MINFRAME ((16 + 1 + 6) * 4) /* minimum size stack frame, in bytes:
+ * 16 for registers, 1 for "hidden param",
+ * and 6 in which a callee can store it's
+ * arguments.
+ */
+
+ stack += MINFRAME + (local * 4);
+
+ fprintf (stderr, "\tstack size: %d (%d)\n\tcode size: %d\n", STACKALIGN(stack), stack, code);
+
+ *local_size = local;
+ *stack_size = STACKALIGN(stack);
+ *code_size = code;
+}
+
+static MonoString *
+mono_string_new_wrapper (const char *text)
+{
+ return text ? mono_string_new (mono_domain_get (), text) : NULL;
+}
+
+MonoPIFunc
+mono_create_trampoline (MonoMethod *method, int runtime)
+{
+ MonoMethodSignature *sig;
+ guint32 *p, *code_buffer;
+ guint32 local_size, stack_size, code_size;
+ guint32 arg_pos, simpletype;
+ int i, stringp, cur_out_reg;
+
+ sig = method->signature;
+
+ fprintf (stderr, "\nPInvoke [start emiting] %s\n", method->name);
+ calculate_sizes (method, &local_size, &stack_size, &code_size, runtime);
+
+ code_buffer = p = alloca (code_size * 4);
+ cur_out_reg = sparc_o0;
+
+ /* Standard function prolog. */
+ sparc_save_imm (p, sparc_sp, -stack_size, sparc_sp);
+#if 0
+ /* gcc seems to want to store %i0 through %i3 for some reason */
+ sparc_st_imm (p, sparc_i0, sparc_fp, 68);
+ sparc_st_imm (p, sparc_i1, sparc_fp, 72);
+ sparc_st_imm (p, sparc_i2, sparc_fp, 76);
+ sparc_st_imm (p, sparc_i3, sparc_fp, 80);
+#endif
+
+ /*
+ * We store some local vars here to handle string pointers.
+ * and align to 16 byte boundary...
+ */
+#if 0
+ if (local_size) {
+ x86_alu_reg_imm (p, X86_SUB, X86_ESP, local_size * 4);
+ stack_size = (stack_size * local_size * 4) % 16;
+ } else {
+ stack_size = stack_size % 16;
+ }
+ if (stack_size)
+ x86_alu_reg_imm (p, X86_SUB, X86_ESP, stack_size);
+#endif
+
+ /*
+ * %i3 has the pointer to the args.
+ */
+
+ if (sig->hasthis) {
+ sparc_mov_reg_reg (p, sparc_i2, cur_out_reg);
+ cur_out_reg++;
+ }
+
+ /* Push arguments in reverse order. */
+ stringp = 0;
+ for (i = 0; i < sig->param_count; i++) {
+ arg_pos = ARG_SIZE * i;
+
+ if (sig->params[i]->byref) {
+ fprintf (stderr, "\tpushing params[%d] (byref): type=%s;\n", i, mono_type (sig->params[i]->type));
+ sparc_ld_imm (p, sparc_i3, arg_pos, cur_out_reg);
+ cur_out_reg++;
+ continue;
+ }
+
+ simpletype = sig->params[i]->type;
+enum_marshal:
+ fprintf (stderr, "\tpushing params[%d]: type=%s;\n", i, mono_type (simpletype));
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ sparc_ld_imm (p, sparc_i3, arg_pos, cur_out_reg);
+ cur_out_reg++;
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->params[i]->data.klass->enumtype) {
+ /* it's an enum value */
+ simpletype = sig->params[i]->data.klass->enum_basetype->type;
+ goto enum_marshal;
+ } else {
+ /*sparc_ld_imm (p, sparc_i3, arg_pos, cur_out_reg);*/
+ sparc_ld_imm (p, sparc_i3, arg_pos, sparc_l0);
+ sparc_ld (p, sparc_l0, 0, cur_out_reg);
+ cur_out_reg++;
+ }
+ break;
+ case MONO_TYPE_STRING:
+ if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || runtime) {
+ sparc_ld_imm (p, sparc_i3, arg_pos, cur_out_reg);
+ cur_out_reg++;
+ break;
+ }
+
+#if 0
+ sparc_sethi (p, mono_string_to_utf8, sparc_l0);
+ sparc_or_imm (p, 0, sparc_l0, mono_string_to_utf8, sparc_l1);
+
+ x86_push_membase (p, X86_EDX, arg_pos);
+ x86_mov_reg_imm (p, X86_EDX, mono_string_to_utf8);
+ x86_call_reg (p, X86_EDX);
+ x86_alu_reg_imm (p, X86_ADD, X86_ESP, 4);
+ x86_push_reg (p, X86_EAX);
+ /*
+ * Store the pointer in a local we'll free later.
+ */
+ stringp++;
+ x86_mov_membase_reg (p, X86_EBP, LOC_POS * stringp, X86_EAX, 4);
+ /*
+ * we didn't save the reg: restore it here.
+ */
+ if (i > 1)
+ x86_mov_reg_membase (p, X86_EDX, X86_EBP, ARGP_POS, 4);
+#endif
+ fprintf (stderr, "MONO_TYPE_STRING not yet fully supported.\n");
+ exit (1);
+ break;
+ case MONO_TYPE_I8:
+ sparc_ld_imm (p, sparc_i3, arg_pos, cur_out_reg);
+ cur_out_reg++;
+ sparc_ld_imm (p, sparc_i3, arg_pos + 4, cur_out_reg);
+ cur_out_reg++;
+ break;
+ case MONO_TYPE_R8:
+ sparc_ld_imm (p, sparc_i3, arg_pos, cur_out_reg);
+ cur_out_reg++;
+ sparc_ld_imm (p, sparc_i3, arg_pos + 4, cur_out_reg);
+ cur_out_reg++;
+ break;
+ default:
+ g_error ("Can't trampoline 0x%x", sig->params [i]->type);
+ }
+ }
+
+ /* call the function */
+ sparc_jmpl_imm (p, sparc_i0, 0, sparc_callsite);
+ sparc_nop (p);
+
+ /*
+ * Handle retval.
+ * Small integer and pointer values are in EAX.
+ * Long integers are in EAX:EDX.
+ * FP values are on the FP stack.
+ */
+#if 0
+ if (sig->ret->byref) {
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 4);
+ } else {
+ simpletype = sig->ret->type;
+enum_retvalue:
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 1);
+ break;
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 2);
+ break;
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 4);
+ break;
+ case MONO_TYPE_STRING:
+ if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || runtime) {
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 4);
+ break;
+ }
+
+ /* If the argument is non-null, then convert the value back */
+ x86_alu_reg_reg (p, X86_OR, X86_EAX, X86_EAX);
+ x86_branch8 (p, X86_CC_EQ, 11, FALSE);
+ x86_push_reg (p, X86_EAX);
+ x86_mov_reg_imm (p, X86_EDX, mono_string_new);
+ x86_call_reg (p, X86_EDX);
+ x86_alu_reg_imm (p, X86_ADD, X86_ESP, 4);
+
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 4);
+ break;
+ case MONO_TYPE_R4:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_fst_membase (p, X86_ECX, 0, FALSE, TRUE);
+ break;
+ case MONO_TYPE_R8:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_fst_membase (p, X86_ECX, 0, TRUE, TRUE);
+ break;
+ case MONO_TYPE_I8:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 4);
+ x86_mov_membase_reg (p, X86_ECX, 4, X86_EDX, 4);
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->ret->data.klass->enumtype) {
+ simpletype = sig->ret->data.klass->enum_basetype->type;
+ goto enum_retvalue;
+ }
+ case MONO_TYPE_VOID:
+ break;
+ default:
+ g_error ("Can't handle as return value 0x%x", sig->ret->type);
+ }
+ }
+#endif
+
+#if 0
+ /* free the allocated strings... */
+ if (!(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)) {
+ if (local_size)
+ x86_mov_reg_imm (p, X86_EDX, g_free);
+ for (i = 1; i <= local_size; ++i) {
+ x86_push_membase (p, X86_EBP, LOC_POS * i);
+ x86_call_reg (p, X86_EDX);
+ }
+ }
+#endif
+ /*
+ * Standard epilog.
+ * 8 may be 12 when returning structures (to skip unimp opcode).
+ */
+ sparc_jmpl_imm (p, sparc_i7, 8, sparc_zero);
+ sparc_restore (p, sparc_zero, sparc_zero, sparc_zero);
+
+ {
+ unsigned char *inptr, *inend;
+
+ inptr = (unsigned char *) code_buffer;
+ inend = (unsigned char *) p;
+
+ printf (".text\n.align 4\n.globl main\n.type main,function\nmain:\n");
+ while (inptr < inend) {
+ printf (".byte 0x%x\n", *inptr);
+ inptr++;
+ }
+ fflush (stdout);
+ }
+
+ fprintf (stderr, "PInvoke [finish emiting] %s\n", method->name);
+
+ /* FIXME: need to flush */
+ return g_memdup (code_buffer, 4 * (p - code_buffer));
+}
+
+void *
+mono_create_method_pointer (MonoMethod *method)
+{
+ return NULL;
+}
+
+MonoMethod*
+mono_method_pointer_get (void *code)
+{
+ return NULL;
+}
diff --git a/mono/arch/unknown.c b/mono/arch/unknown.c
new file mode 100644
index 00000000000..d02edcaf0cc
--- /dev/null
+++ b/mono/arch/unknown.c
@@ -0,0 +1,19 @@
+#ifdef NO_PORT
+#include "mono/interpreter/interp.h"
+
+MonoPIFunc
+mono_create_trampoline (MonoMethod *method)
+{
+ g_error ("Unsupported arch");
+ return NULL;
+}
+
+void *
+mono_create_method_pointer (MonoMethod *method)
+{
+ g_error ("Unsupported arch");
+ return NULL;
+}
+
+#endif
+
diff --git a/mono/arch/x86/.cvsignore b/mono/arch/x86/.cvsignore
new file mode 100644
index 00000000000..e9793ab64d0
--- /dev/null
+++ b/mono/arch/x86/.cvsignore
@@ -0,0 +1,6 @@
+Makefile
+Makefile.in
+.libs
+.deps
+*.la
+*.lo
diff --git a/mono/arch/x86/Makefile.am b/mono/arch/x86/Makefile.am
new file mode 100644
index 00000000000..8d809b8b3d8
--- /dev/null
+++ b/mono/arch/x86/Makefile.am
@@ -0,0 +1,7 @@
+
+INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)
+
+noinst_LTLIBRARIES = libmonoarch-x86.la
+
+libmonoarch_x86_la_SOURCES = tramp.c x86-codegen.h
+
diff --git a/mono/arch/x86/test.c b/mono/arch/x86/test.c
new file mode 100644
index 00000000000..3511e8fdaf0
--- /dev/null
+++ b/mono/arch/x86/test.c
@@ -0,0 +1,225 @@
+#include "x86-codegen.h"
+#include <stdio.h>
+
+/* don't run the resulting program, it will destroy your computer,
+ * just objdump -d it to inspect we generated the correct assembler.
+ */
+
+int main() {
+ unsigned char code [16000];
+ unsigned char *p = code;
+ unsigned char *target, *start, *end;
+ unsigned long mem_addr = 0xdeadbeef;
+ int size, i;
+
+ printf (".text\n.align 4\n.globl main\n.type main,@function\nmain:\n");
+
+ x86_prolog (p, 16, X86_CALLER_REGS);
+
+ x86_cmpxchg_reg_reg (p, X86_EAX, X86_EBP);
+ x86_cmpxchg_membase_reg (p, X86_EAX, 12, X86_EBP);
+
+ x86_xchg_reg_reg (p, X86_EAX, X86_EBP, 4);
+ x86_xchg_reg_reg (p, X86_EAX, X86_EBP, 1); // FIXME?
+ x86_xchg_membase_reg (p, X86_EAX, 12, X86_EBP, 4);
+ x86_xchg_membase_reg (p, X86_EAX, 12, X86_EBP, 2);
+ x86_xchg_membase_reg (p, X86_EAX, 12, X86_EBX, 1); // FIXME?
+
+ x86_inc_reg (p, X86_EAX);
+ x86_inc_mem (p, mem_addr);
+ x86_inc_membase (p, X86_ESP, 4);
+
+ x86_nop (p);
+ x86_nop (p);
+
+ x86_dec_reg (p, X86_EAX);
+ x86_dec_reg (p, X86_ECX);
+ x86_dec_mem (p, mem_addr);
+ x86_dec_membase (p, X86_ESP, 4);
+
+ x86_not_reg (p, X86_EDX);
+ x86_not_reg (p, X86_ECX);
+ x86_not_mem (p, mem_addr);
+ x86_not_membase (p, X86_ESP, 4);
+ x86_not_membase (p, X86_ESP, 0x4444444);
+ x86_not_membase (p, X86_EBP, 0x4444444);
+ x86_not_membase (p, X86_ECX, 0x4444444);
+ x86_not_membase (p, X86_EDX, 0);
+ x86_not_membase (p, X86_EBP, 0);
+
+ x86_neg_reg (p, X86_EAX);
+ x86_neg_reg (p, X86_ECX);
+ x86_neg_mem (p, mem_addr);
+ x86_neg_membase (p, X86_ESP, 8);
+
+ x86_alu_reg_imm (p, X86_ADD, X86_EAX, 5);
+ x86_alu_reg_imm (p, X86_ADD, X86_EBX, -10);
+ x86_alu_reg_imm (p, X86_SUB, X86_EDX, 7);
+ x86_alu_reg_imm (p, X86_OR, X86_ESP, 0xffffedaf);
+ x86_alu_reg_imm (p, X86_CMP, X86_ECX, 1);
+ x86_alu_mem_imm (p, X86_ADC, mem_addr, 2);
+ x86_alu_membase_imm (p, X86_ADC, X86_ESP, -4, 4);
+ x86_alu_membase_imm (p, X86_ADC, X86_ESP, -12, 0xffffedaf);
+
+ x86_alu_mem_reg (p, X86_SUB, mem_addr, X86_EDX);
+ x86_alu_reg_reg (p, X86_ADD, X86_EAX, X86_EBX);
+ x86_alu_reg_mem (p, X86_ADD, X86_EAX, mem_addr);
+ x86_alu_reg_imm (p, X86_ADD, X86_EAX, 0xdeadbeef);
+ x86_alu_reg_membase (p, X86_XOR, X86_EDX, X86_ESP, 4);
+ x86_alu_membase_reg (p, X86_XOR, X86_EBP, 8, X86_ESI);
+
+ x86_test_reg_imm (p, X86_EAX, 16);
+ x86_test_reg_imm (p, X86_EDX, -16);
+ x86_test_mem_imm (p, mem_addr, 1);
+ x86_test_membase_imm (p, X86_EBP, 8, 1);
+
+ x86_test_reg_reg (p, X86_EAX, X86_EDX);
+ x86_test_mem_reg (p, mem_addr, X86_EDX);
+ x86_test_membase_reg (p, X86_ESI, 4, X86_EDX);
+
+ x86_shift_reg_imm (p, X86_SHL, X86_EAX, 1);
+ x86_shift_reg_imm (p, X86_SHL, X86_EDX, 2);
+
+ x86_shift_mem_imm (p, X86_SHL, mem_addr, 2);
+ x86_shift_membase_imm (p, X86_SHLR, X86_EBP, 8, 4);
+
+ /*
+ * Shift by CL
+ */
+ x86_shift_reg (p, X86_SHL, X86_EAX);
+ x86_shift_mem (p, X86_SHL, mem_addr);
+
+ x86_mul_reg (p, X86_EAX, 0);
+ x86_mul_reg (p, X86_EAX, 1);
+ x86_mul_membase (p, X86_EBP, 8, 1);
+
+ x86_imul_reg_reg (p, X86_EBX, X86_EDX);
+ x86_imul_reg_membase (p, X86_EBX, X86_EBP, 12);
+
+ x86_imul_reg_reg_imm (p, X86_EBX, X86_EDX, 10);
+ x86_imul_reg_mem_imm (p, X86_EBX, mem_addr, 20);
+ x86_imul_reg_membase_imm (p, X86_EBX, X86_EBP, 16, 300);
+
+ x86_div_reg (p, X86_EDX, 0);
+ x86_div_reg (p, X86_EDX, 1);
+ x86_div_mem (p, mem_addr, 1);
+ x86_div_membase (p, X86_ESI, 4, 1);
+
+ x86_mov_mem_reg (p, mem_addr, X86_EAX, 4);
+ x86_mov_mem_reg (p, mem_addr, X86_EAX, 2);
+ x86_mov_mem_reg (p, mem_addr, X86_EAX, 1);
+ x86_mov_membase_reg (p, X86_EBP, 4, X86_EAX, 1);
+
+ x86_mov_regp_reg (p, X86_EAX, X86_EAX, 4);
+ x86_mov_membase_reg (p, X86_EAX, 0, X86_EAX, 4);
+ x86_mov_reg_membase (p, X86_EAX, X86_EAX, 0, 4);
+ x86_mov_reg_memindex (p, X86_ECX, X86_EAX, 34, X86_EDX, 2, 4);
+ x86_mov_reg_memindex (p, X86_ECX, X86_NOBASEREG, 34, X86_EDX, 2, 4);
+ x86_mov_memindex_reg (p, X86_EAX, X86_EAX, 0, X86_EDX, 2, 4);
+ x86_mov_reg_reg (p, X86_EAX, X86_EAX, 1);
+ x86_mov_reg_reg (p, X86_EAX, X86_EAX, 4);
+ x86_mov_reg_mem (p, X86_EAX, mem_addr, 4);
+
+ x86_mov_reg_imm (p, X86_EAX, 10);
+ x86_mov_mem_imm (p, mem_addr, 54, 4);
+ x86_mov_mem_imm (p, mem_addr, 54, 1);
+
+ x86_lea_mem (p, X86_EDX, mem_addr);
+ /* test widen */
+ x86_widen_memindex (p, X86_EDX, X86_ECX, 0, X86_EBX, 2, 1, 0);
+
+ x86_cdq (p);
+ x86_wait (p);
+
+ x86_fp_op_mem (p, X86_FADD, mem_addr, 1);
+ x86_fp_op_mem (p, X86_FSUB, mem_addr, 0);
+ x86_fp_op (p, X86_FSUB, 2);
+ x86_fp_op_reg (p, X86_FMUL, 1, 0);
+ x86_fstp (p, 2);
+ x86_fcompp (p);
+ x86_fnstsw (p);
+ x86_fnstcw (p, mem_addr);
+ x86_fnstcw_membase (p, X86_ESP, -8);
+
+ x86_fldcw_membase (p, X86_ESP, -8);
+ x86_fchs (p);
+ x86_frem (p);
+ x86_fxch (p, 3);
+ x86_fcomip (p, 3);
+ x86_fld_membase (p, X86_ESP, -8, 1);
+ x86_fld_membase (p, X86_ESP, -8, 0);
+ x86_fld80_membase (p, X86_ESP, -8);
+ x86_fild_membase (p, X86_ESP, -8, 1);
+ x86_fild_membase (p, X86_ESP, -8, 0);
+ x86_fld_reg (p, 4);
+ x86_fldz (p);
+ x86_fld1 (p);
+
+ x86_fst (p, mem_addr, 1, 0);
+ x86_fst (p, mem_addr, 1, 1);
+ x86_fst (p, mem_addr, 0, 1);
+
+ x86_fist_pop_membase (p, X86_EDX, 4, 1);
+ x86_fist_pop_membase (p, X86_EDX, 4, 0);
+
+ x86_push_reg (p, X86_EBX);
+ x86_push_membase (p, X86_EBP, 8);
+ x86_push_imm (p, -1);
+ x86_pop_reg (p, X86_EBX);
+
+ x86_pushad (p);
+ x86_pushfd (p);
+ x86_popfd (p);
+ x86_popad (p);
+
+ target = p;
+
+ start = p;
+ x86_jump32 (p, mem_addr);
+ x86_patch (start, target);
+ start = p;
+ x86_jump8 (p, 12);
+ x86_patch (start, target);
+ x86_jump_reg (p, X86_EAX);
+ x86_jump_membase (p, X86_EDX, 16);
+
+ x86_jump_code (p, target);
+
+ x86_branch8 (p, X86_CC_EQ, 54, 1);
+ x86_branch32 (p, X86_CC_LT, 54, 0);
+ x86_branch (p, X86_CC_GT, target, 0);
+ x86_branch_disp (p, X86_CC_NE, -4, 0);
+
+ x86_set_reg (p, X86_CC_EQ, X86_EAX, 0);
+ x86_set_membase (p, X86_CC_LE, X86_EBP, -8, 0);
+
+ x86_call_code (p, printf);
+ x86_call_reg (p, X86_ECX);
+
+ x86_sahf (p);
+
+ x86_fsin (p);
+ x86_fcos (p);
+ x86_fabs (p);
+ x86_fpatan (p);
+ x86_fprem (p);
+ x86_fprem1 (p);
+ x86_frndint (p);
+ x86_fsqrt (p);
+ x86_fptan (p);
+
+ x86_leave (p);
+ x86_ret (p);
+ x86_ret_imm (p, 24);
+
+ x86_cmov_reg (p, X86_CC_GT, 1, X86_EAX, X86_EDX);
+ x86_cmov_membase (p, X86_CC_GT, 0, X86_EAX, X86_EDX, -4);
+
+ x86_nop (p);
+ x86_epilog (p, X86_CALLER_REGS);
+
+ size = p-code;
+ for (i = 0; i < size; ++i)
+ printf (".byte %d\n", (unsigned int) code [i]);
+ return 0;
+}
diff --git a/mono/arch/x86/tramp.c b/mono/arch/x86/tramp.c
new file mode 100644
index 00000000000..baae8e94814
--- /dev/null
+++ b/mono/arch/x86/tramp.c
@@ -0,0 +1,524 @@
+/*
+ * Create trampolines to invoke arbitrary functions.
+ *
+ * Copyright (C) Ximian Inc.
+ *
+ * Author: Paolo Molaro (lupus@ximian.com)
+ *
+ */
+
+#include "config.h"
+#include <stdlib.h>
+#include "x86-codegen.h"
+#include "mono/metadata/class.h"
+#include "mono/metadata/tabledefs.h"
+#include "mono/interpreter/interp.h"
+#include "mono/metadata/appdomain.h"
+#include "mono/metadata/marshal.h"
+
+/*
+ * The resulting function takes the form:
+ * void func (void (*callme)(), void *retval, void *this_obj, stackval *arguments);
+ */
+#define FUNC_ADDR_POS 8
+#define RETVAL_POS 12
+#define THIS_POS 16
+#define ARGP_POS 20
+#define LOC_POS -4
+
+#define ARG_SIZE sizeof (stackval)
+
+MonoPIFunc
+mono_create_trampoline (MonoMethod *method, int runtime)
+{
+ MonoMethodSignature *sig;
+ unsigned char *p, *code_buffer;
+ guint32 local_size = 0, stack_size = 0, code_size = 50;
+ guint32 arg_pos, simpletype;
+ int i, stringp;
+ int need_marshal;
+ GList *free_locs = NULL;
+
+ if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || runtime)
+ need_marshal = 0;
+ else
+ need_marshal = 1;
+
+ sig = method->signature;
+
+ if (sig->hasthis) {
+ stack_size += sizeof (gpointer);
+ code_size += 5;
+ }
+
+ for (i = 0; i < sig->param_count; ++i) {
+ if (sig->params [i]->byref) {
+ stack_size += sizeof (gpointer);
+ code_size += 20;
+ local_size++;
+ continue;
+ }
+ simpletype = sig->params [i]->type;
+enum_calc_size:
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ stack_size += 4;
+ code_size += i < 10 ? 5 : 8;
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->params [i]->data.klass->enumtype) {
+ simpletype = sig->params [i]->data.klass->enum_basetype->type;
+ goto enum_calc_size;
+ }
+ if (mono_class_value_size (sig->params [i]->data.klass, NULL) != 4)
+ g_error ("can only marshal enums, not generic structures (size: %d)", mono_class_value_size (sig->params [i]->data.klass, NULL));
+ stack_size += 4;
+ code_size += i < 10 ? 5 : 8;
+ break;
+ case MONO_TYPE_STRING:
+ stack_size += 4;
+ code_size += 20;
+ local_size++;
+ break;
+ case MONO_TYPE_I8:
+ stack_size += 8;
+ code_size += i < 10 ? 5 : 8;
+ break;
+ case MONO_TYPE_R8:
+ stack_size += 8;
+ code_size += i < 10 ? 7 : 10;
+ break;
+ default:
+ g_error ("Can't trampoline 0x%x", sig->params [i]->type);
+ }
+ }
+ /*
+ * FIXME: take into account large return values.
+ */
+
+ code_buffer = p = alloca (code_size);
+
+ /*
+ * Standard function prolog.
+ */
+ x86_push_reg (p, X86_EBP);
+ x86_mov_reg_reg (p, X86_EBP, X86_ESP, 4);
+ /*
+ * We store some local vars here to handle string pointers.
+ * and align to 16 byte boundary...
+ */
+ if (local_size) {
+ x86_alu_reg_imm (p, X86_SUB, X86_ESP, local_size * 4);
+ stack_size = (stack_size * local_size * 4) % 16;
+ } else {
+ stack_size = stack_size % 16;
+ }
+ if (stack_size)
+ x86_alu_reg_imm (p, X86_SUB, X86_ESP, stack_size);
+
+ /*
+ * EDX has the pointer to the args.
+ */
+ x86_mov_reg_membase (p, X86_EDX, X86_EBP, ARGP_POS, 4);
+
+ /*
+ * Push arguments in reverse order.
+ */
+ stringp = 0;
+ for (i = sig->param_count; i; --i) {
+ arg_pos = ARG_SIZE * (i - 1);
+ if (sig->params [i - 1]->byref) {
+ if (!need_marshal) {
+ x86_push_membase (p, X86_EDX, arg_pos);
+ continue;
+ }
+ if (sig->params [i - 1]->type == MONO_TYPE_SZARRAY &&
+ sig->params [i - 1]->data.type->type == MONO_TYPE_STRING) {
+ x86_mov_reg_membase (p, X86_EAX, X86_EDX, arg_pos, 4);
+ x86_push_regp (p, X86_EAX);
+ x86_mov_reg_imm (p, X86_EDX, mono_marshal_string_array);
+ x86_call_reg (p, X86_EDX);
+ x86_alu_reg_imm (p, X86_ADD, X86_ESP, 4);
+ /*
+ * Store the pointer in a local we'll free later.
+ */
+ stringp++;
+ x86_mov_membase_reg (p, X86_EBP, LOC_POS * stringp, X86_EAX, 4);
+ free_locs = g_list_prepend (free_locs, GUINT_TO_POINTER (LOC_POS * stringp));
+ /* load the pointer and push it */
+ x86_lea_membase (p, X86_EAX, X86_EBP, LOC_POS * stringp);
+ x86_push_reg (p, X86_EAX);
+ /* restore pointer to args in EDX */
+ x86_mov_reg_membase (p, X86_EDX, X86_EBP, ARGP_POS, 4);
+ } else {
+ x86_push_membase (p, X86_EDX, arg_pos);
+ }
+ continue;
+ }
+ simpletype = sig->params [i - 1]->type;
+enum_marshal:
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_R4:
+ x86_push_membase (p, X86_EDX, arg_pos);
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (!sig->params [i - 1]->data.klass->enumtype) {
+ /* it's a structure that fits in 4 bytes, need to push the value pointed to */
+ x86_mov_reg_membase (p, X86_EAX, X86_EDX, arg_pos, 4);
+ x86_push_regp (p, X86_EAX);
+ } else {
+ /* it's an enum value */
+ simpletype = sig->params [i - 1]->data.klass->enum_basetype->type;
+ goto enum_marshal;
+ }
+ break;
+ case MONO_TYPE_STRING:
+ /*
+ * If it is an internalcall we assume it's the object we want.
+ * Yet another reason why MONO_TYPE_STRING should not be used to indicate char*.
+ */
+ if (!need_marshal) {
+ x86_push_membase (p, X86_EDX, arg_pos);
+ break;
+ }
+ /*if (frame->method->flags & PINVOKE_ATTRIBUTE_CHAR_SET_ANSI*/
+ x86_push_membase (p, X86_EDX, arg_pos);
+ x86_mov_reg_imm (p, X86_EDX, mono_string_to_utf8);
+ x86_call_reg (p, X86_EDX);
+ x86_alu_reg_imm (p, X86_ADD, X86_ESP, 4);
+ x86_push_reg (p, X86_EAX);
+ /*
+ * Store the pointer in a local we'll free later.
+ */
+ stringp++;
+ x86_mov_membase_reg (p, X86_EBP, LOC_POS * stringp, X86_EAX, 4);
+ free_locs = g_list_prepend (free_locs, GUINT_TO_POINTER (LOC_POS * stringp));
+ /*
+ * we didn't save the reg: restore it here.
+ */
+ if (i > 1)
+ x86_mov_reg_membase (p, X86_EDX, X86_EBP, ARGP_POS, 4);
+ break;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R8:
+ x86_push_membase (p, X86_EDX, arg_pos + 4);
+ x86_push_membase (p, X86_EDX, arg_pos);
+ break;
+ default:
+ g_error ("Can't trampoline 0x%x", sig->params [i - 1]->type);
+ }
+ }
+
+ if (sig->hasthis) {
+ if (sig->call_convention != MONO_CALL_THISCALL) {
+ x86_mov_reg_membase (p, X86_EDX, X86_EBP, THIS_POS, 4);
+ x86_push_reg (p, X86_EDX);
+ } else {
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, THIS_POS, 4);
+ }
+ }
+
+ /*
+ * Insert call to function
+ */
+ x86_mov_reg_membase (p, X86_EDX, X86_EBP, FUNC_ADDR_POS, 4);
+ x86_call_reg (p, X86_EDX);
+
+ /*
+ * Handle retval.
+ * Small integer and pointer values are in EAX.
+ * Long integers are in EAX:EDX.
+ * FP values are on the FP stack.
+ */
+
+ if (sig->ret->byref ||
+ (method->klass == mono_defaults.string_class &&
+ *method->name == '.' && !strcmp (method->name, ".ctor"))) {
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 4);
+ } else {
+ simpletype = sig->ret->type;
+enum_retvalue:
+ switch (simpletype) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 1);
+ break;
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 2);
+ break;
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 4);
+ break;
+ case MONO_TYPE_STRING:
+ if (!need_marshal) {
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 4);
+ break;
+ }
+
+ /* If the argument is non-null, then convert the value back */
+ x86_alu_reg_reg (p, X86_OR, X86_EAX, X86_EAX);
+ x86_branch8 (p, X86_CC_EQ, 11, FALSE);
+ x86_push_reg (p, X86_EAX);
+ x86_mov_reg_imm (p, X86_EDX, mono_string_new_wrapper);
+ x86_call_reg (p, X86_EDX);
+ x86_alu_reg_imm (p, X86_ADD, X86_ESP, 4);
+
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 4);
+ break;
+ case MONO_TYPE_R4:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_fst_membase (p, X86_ECX, 0, FALSE, TRUE);
+ break;
+ case MONO_TYPE_R8:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_fst_membase (p, X86_ECX, 0, TRUE, TRUE);
+ break;
+ case MONO_TYPE_I8:
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, RETVAL_POS, 4);
+ x86_mov_regp_reg (p, X86_ECX, X86_EAX, 4);
+ x86_mov_membase_reg (p, X86_ECX, 4, X86_EDX, 4);
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->ret->data.klass->enumtype) {
+ simpletype = sig->ret->data.klass->enum_basetype->type;
+ goto enum_retvalue;
+ }
+ case MONO_TYPE_VOID:
+ break;
+ default:
+ g_error ("Can't handle as return value 0x%x", sig->ret->type);
+ }
+ }
+
+ /*
+ * free the allocated strings.
+ */
+ if (need_marshal) {
+ GList* tmp;
+ for (tmp = free_locs; tmp; tmp = tmp->next) {
+ x86_mov_reg_imm (p, X86_EDX, g_free);
+ x86_push_membase (p, X86_EBP, GPOINTER_TO_UINT (tmp->data));
+ x86_call_reg (p, X86_EDX);
+ }
+ g_list_free (free_locs);
+ }
+ /*
+ * Standard epilog.
+ */
+ x86_leave (p);
+ x86_ret (p);
+
+ g_assert (p - code_buffer < code_size);
+ return g_memdup (code_buffer, p - code_buffer);
+}
+
+#define MINV_POS (- sizeof (MonoInvocation))
+#define STACK_POS (MINV_POS - sizeof (stackval) * sig->param_count)
+#define OBJ_POS 8
+#define TYPE_OFFSET (G_STRUCT_OFFSET (stackval, type))
+
+/*
+ * Returns a pointer to a native function that can be used to
+ * call the specified method.
+ * The function created will receive the arguments according
+ * to the call convention specified in the method.
+ * This function works by creating a MonoInvocation structure,
+ * filling the fields in and calling ves_exec_method on it.
+ * Still need to figure out how to handle the exception stuff
+ * across the managed/unmanaged boundary.
+ */
+void *
+mono_create_method_pointer (MonoMethod *method)
+{
+ MonoMethodSignature *sig;
+ unsigned char *p, *code_buffer;
+ gint32 local_size;
+ gint32 stackval_pos, arg_pos = 8;
+ int i, align;
+
+ /*
+ * If it is a static P/Invoke method, we can just return the pointer
+ * to the method implementation.
+ */
+ sig = method->signature;
+
+ code_buffer = p = alloca (512); /* FIXME: check for overflows... */
+
+ local_size = sizeof (MonoInvocation) + sizeof (stackval) * (sig->param_count + 1);
+ stackval_pos = -local_size;
+
+ /*
+ * Standard function prolog with magic trick.
+ */
+ x86_jump_code (p, code_buffer + 8);
+ *p++ = 'M';
+ *p++ = 'o';
+ *(void**)p = method;
+ p += 4;
+ x86_push_reg (p, X86_EBP);
+ x86_mov_reg_reg (p, X86_EBP, X86_ESP, 4);
+ x86_alu_reg_imm (p, X86_SUB, X86_ESP, local_size);
+
+ /*
+ * Initialize MonoInvocation fields, first the ones known now.
+ */
+ x86_mov_reg_imm (p, X86_EAX, 0);
+ x86_mov_membase_reg (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, ex)), X86_EAX, 4);
+ x86_mov_membase_reg (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, ex_handler)), X86_EAX, 4);
+ x86_mov_membase_reg (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, child)), X86_EAX, 4);
+ x86_mov_membase_reg (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, parent)), X86_EAX, 4);
+ /*
+ * Set the method pointer.
+ */
+ x86_mov_membase_imm (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, method)), (int)method, 4);
+
+ /*
+ * Handle this.
+ */
+ if (sig->hasthis) {
+ if (sig->call_convention != MONO_CALL_THISCALL) {
+ /*
+ * Grab it from the stack, otherwise it's already in ECX.
+ */
+ x86_mov_reg_membase (p, X86_ECX, X86_EBP, OBJ_POS, 4);
+ arg_pos += 4;
+ }
+ x86_mov_membase_reg (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, obj)), X86_ECX, 4);
+ }
+ /*
+ * Handle the arguments. stackval_pos is the posset of the stackval array from EBP.
+ * arg_pos is the offset from EBP to the incoming arg on the stack.
+ * We just call stackval_from_data to handle all the (nasty) issues....
+ */
+ x86_lea_membase (p, X86_EAX, X86_EBP, stackval_pos);
+ x86_mov_membase_reg (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, stack_args)), X86_EAX, 4);
+ for (i = 0; i < sig->param_count; ++i) {
+ x86_mov_reg_imm (p, X86_ECX, stackval_from_data);
+ x86_lea_membase (p, X86_EDX, X86_EBP, arg_pos);
+ x86_lea_membase (p, X86_EAX, X86_EBP, stackval_pos);
+ x86_push_reg (p, X86_EDX);
+ x86_push_reg (p, X86_EAX);
+ x86_push_imm (p, sig->params [i]);
+ x86_call_reg (p, X86_ECX);
+ x86_alu_reg_imm (p, X86_SUB, X86_ESP, 12);
+ stackval_pos += sizeof (stackval);
+ arg_pos += mono_type_stack_size (sig->params [i], &align);
+ }
+
+ /*
+ * Handle the return value storage area.
+ */
+ x86_lea_membase (p, X86_EAX, X86_EBP, stackval_pos);
+ x86_mov_membase_reg (p, X86_EBP, (MINV_POS + G_STRUCT_OFFSET (MonoInvocation, retval)), X86_EAX, 4);
+
+ /*
+ * Call the method.
+ */
+ x86_lea_membase (p, X86_EAX, X86_EBP, MINV_POS);
+ x86_push_reg (p, X86_EAX);
+ x86_mov_reg_imm (p, X86_EDX, ves_exec_method);
+ x86_call_reg (p, X86_EDX);
+
+ /*
+ * Move the return value to the proper place.
+ */
+ x86_lea_membase (p, X86_EAX, X86_EBP, stackval_pos);
+ if (sig->ret->byref) {
+ x86_mov_reg_membase (p, X86_EAX, X86_EAX, 0, 4);
+ } else {
+ switch (sig->ret->type) {
+ case MONO_TYPE_VOID:
+ break;
+ case MONO_TYPE_BOOLEAN:
+ x86_mov_reg_membase (p, X86_EAX, X86_EAX, 0, 1);
+ break;
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_CLASS:
+ x86_mov_reg_membase (p, X86_EAX, X86_EAX, 0, 4);
+ break;
+ case MONO_TYPE_I8:
+ x86_mov_reg_membase (p, X86_EDX, X86_EAX, 4, 4);
+ x86_mov_reg_membase (p, X86_EAX, X86_EAX, 0, 4);
+ break;
+ case MONO_TYPE_R8:
+ x86_fld_membase (p, X86_EAX, 0, TRUE);
+ break;
+ default:
+ g_error ("Type 0x%x not handled yet in thunk creation", sig->ret->type);
+ break;
+ }
+ }
+
+ /*
+ * Standard epilog.
+ */
+ x86_leave (p);
+ x86_ret (p);
+
+ g_assert (p - code_buffer < 512);
+ return g_memdup (code_buffer, p - code_buffer);
+}
+
+/*
+ * mono_create_method_pointer () will insert a pointer to the MonoMethod
+ * so that the interp can easily get at the data: this function will retrieve
+ * the method from the code stream.
+ */
+MonoMethod*
+mono_method_pointer_get (void *code)
+{
+ unsigned char *c = code;
+ if (c [2] != 'M' || c [3] != 'o')
+ return NULL;
+ return *(MonoMethod**)(c + sizeof (gpointer));
+}
diff --git a/mono/arch/x86/x86-codegen.h b/mono/arch/x86/x86-codegen.h
new file mode 100644
index 00000000000..e824e4862e5
--- /dev/null
+++ b/mono/arch/x86/x86-codegen.h
@@ -0,0 +1,1501 @@
+/* Copyright (C) 2000 Intel Corporation. All rights reserved.
+ Copyright (C) 2001 Ximian, Inc.
+//
+// $Header: /home/miguel/third-conversion/public/mono/mono/arch/x86/x86-codegen.h,v 1.26 2002/04/22 07:32:11 lupus Exp $
+*/
+
+#ifndef X86_H
+#define X86_H
+#include <assert.h>
+/*
+// x86 register numbers
+*/
+typedef enum {
+ X86_EAX = 0,
+ X86_ECX = 1,
+ X86_EDX = 2,
+ X86_EBX = 3,
+ X86_ESP = 4,
+ X86_EBP = 5,
+ X86_ESI = 6,
+ X86_EDI = 7,
+ X86_NREG
+} X86_Reg_No;
+/*
+// opcodes for alu instructions
+*/
+typedef enum {
+ X86_ADD = 0,
+ X86_OR = 1,
+ X86_ADC = 2,
+ X86_SBB = 3,
+ X86_AND = 4,
+ X86_SUB = 5,
+ X86_XOR = 6,
+ X86_CMP = 7,
+ X86_NALU
+} X86_ALU_Opcode;
+/*
+// opcodes for shift instructions
+*/
+typedef enum {
+ X86_SHLD,
+ X86_SHLR,
+ X86_SHL = 4,
+ X86_SHR = 5,
+ X86_SAR = 7,
+ X86_NSHIFT = 8
+} X86_Shift_Opcode;
+/*
+// opcodes for floating-point instructions
+*/
+typedef enum {
+ X86_FADD = 0,
+ X86_FMUL = 1,
+ X86_FCOM = 2,
+ X86_FCOMP = 3,
+ X86_FSUB = 4,
+ X86_FSUBR = 5,
+ X86_FDIV = 6,
+ X86_FDIVR = 7,
+ X86_NFP = 8
+} X86_FP_Opcode;
+/*
+// integer conditions codes
+*/
+typedef enum {
+ X86_CC_EQ = 0, X86_CC_E = 0, X86_CC_Z = 0,
+ X86_CC_NE = 1, X86_CC_NZ = 1,
+ X86_CC_LT = 2, X86_CC_B = 2, X86_CC_C = 2, X86_CC_NAE = 2,
+ X86_CC_LE = 3, X86_CC_BE = 3, X86_CC_NA = 3,
+ X86_CC_GT = 4, X86_CC_A = 4, X86_CC_NBE = 4,
+ X86_CC_GE = 5, X86_CC_AE = 5, X86_CC_NB = 5, X86_CC_NC = 5,
+ X86_CC_LZ = 6, X86_CC_S = 6,
+ X86_CC_GEZ = 7, X86_CC_NS = 7,
+ X86_CC_P = 8, X86_CC_PE = 8,
+ X86_CC_NP = 9, X86_CC_PO = 9,
+ X86_CC_O = 10,
+ X86_CC_NO = 11,
+ X86_NCC
+} X86_CC;
+/*
+// prefix code
+*/
+typedef enum {
+ X86_LOCK_PREFIX = 0xF0,
+ X86_REPNZ_PREFIX = 0xF2,
+ X86_REPZ_PREFIX = 0xF3,
+ X86_REP_PREFIX = 0xF3,
+ X86_CS_PREFIX = 0x2E,
+ X86_SS_PREFIX = 0x36,
+ X86_DS_PREFIX = 0x3E,
+ X86_ES_PREFIX = 0x26,
+ X86_FS_PREFIX = 0x64,
+ X86_GS_PREFIX = 0x65,
+ X86_OPERAND_PREFIX = 0x66,
+ X86_ADDRESS_PREFIX = 0x67
+} X86_Prefix;
+
+static const unsigned char
+x86_cc_unsigned_map [X86_NCC] = {
+ 0x74, /* eq */
+ 0x75, /* ne */
+ 0x72, /* lt */
+ 0x76, /* le */
+ 0x77, /* gt */
+ 0x73, /* ge */
+ 0x78, /* lz */
+ 0x79, /* gez */
+ 0x7a, /* p */
+ 0x7b, /* np */
+ 0x70, /* o */
+ 0x71, /* no */
+};
+
+static const unsigned char
+x86_cc_signed_map [X86_NCC] = {
+ 0x74, /* eq */
+ 0x75, /* ne */
+ 0x7c, /* lt */
+ 0x7e, /* le */
+ 0x7f, /* gt */
+ 0x7d, /* ge */
+ 0x78, /* lz */
+ 0x79, /* gez */
+ 0x7a, /* p */
+ 0x7b, /* np */
+ 0x70, /* o */
+ 0x71, /* no */
+};
+
+typedef union {
+ int val;
+ unsigned char b [4];
+} x86_imm_buf;
+
+#define X86_NOBASEREG (-1)
+
+/*
+// bitvector mask for callee-saved registers
+*/
+#define X86_ESI_MASK (1<<X86_ESI)
+#define X86_EDI_MASK (1<<X86_EDI)
+#define X86_EBX_MASK (1<<X86_EBX)
+#define X86_EBP_MASK (1<<X86_EBP)
+
+#define X86_CALLEE_REGS ((1<<X86_EAX) | (1<<X86_ECX) | (1<<X86_EDX))
+#define X86_CALLER_REGS ((1<<X86_EBX) | (1<<X86_EBP) | (1<<X86_ESI) | (1<<X86_EDI))
+#define X86_BYTE_REGS ((1<<X86_EAX) | (1<<X86_ECX) | (1<<X86_EDX) | (1<<X86_EBX))
+
+#define X86_IS_SCRATCH(reg) (X86_CALLER_REGS & (1 << (reg))) /* X86_EAX, X86_ECX, or X86_EDX */
+#define X86_IS_CALLEE(reg) (X86_CALLEE_REGS & (1 << (reg))) /* X86_ESI, X86_EDI, X86_EBX, or X86_EBP */
+
+/*
+// Frame structure:
+//
+// +--------------------------------+
+// | in_arg[0] = var[0] |
+// | in_arg[1] = var[1] |
+// | . . . |
+// | in_arg[n_arg-1] = var[n_arg-1] |
+// +--------------------------------+
+// | return IP |
+// +--------------------------------+
+// | saved EBP | <-- frame pointer (EBP)
+// +--------------------------------+
+// | ... | n_extra
+// +--------------------------------+
+// | var[n_arg] |
+// | var[n_arg+1] | local variables area
+// | . . . |
+// | var[n_var-1] |
+// +--------------------------------+
+// | |
+// | |
+// | spill area | area for spilling mimic stack
+// | |
+// +--------------------------------|
+// | ebx |
+// | ebp [ESP_Frame only] |
+// | esi | 0..3 callee-saved regs
+// | edi | <-- stack pointer (ESP)
+// +--------------------------------+
+// | stk0 |
+// | stk1 | operand stack area/
+// | . . . | out args
+// | stkn-1 |
+// +--------------------------------|
+//
+//
+*/
+
+
+/*
+ * useful building blocks
+ */
+#define x86_address_byte(inst,m,o,r) do { *(inst)++ = ((((m)&0x03)<<6)|(((o)&0x07)<<3)|(((r)&0x07))); } while (0)
+#define x86_imm_emit32(inst,imm) \
+ do { \
+ x86_imm_buf imb; imb.val = (int) (imm); \
+ *(inst)++ = imb.b [0]; \
+ *(inst)++ = imb.b [1]; \
+ *(inst)++ = imb.b [2]; \
+ *(inst)++ = imb.b [3]; \
+ } while (0)
+#define x86_imm_emit16(inst,imm) do { *(short*)(inst) = (imm); (inst) += 2; } while (0)
+#define x86_imm_emit8(inst,imm) do { *(inst) = (unsigned char)((imm) & 0xff); ++(inst); } while (0)
+#define x86_is_imm8(imm) (((int)(imm) >= -128 && (int)(imm) <= 127))
+#define x86_is_imm16(imm) (((int)(imm) >= -(1<<16) && (int)(imm) <= ((1<<16)-1)))
+
+#define x86_reg_emit(inst,r,regno) do { x86_address_byte ((inst), 3, (r), (regno)); } while (0)
+#define x86_regp_emit(inst,r,regno) do { x86_address_byte ((inst), 0, (r), (regno)); } while (0)
+#define x86_mem_emit(inst,r,disp) do { x86_address_byte ((inst), 0, (r), 5); x86_imm_emit32((inst), (disp)); } while (0)
+
+#define x86_membase_emit(inst,r,basereg,disp) do {\
+ if ((basereg) == X86_ESP) { \
+ if ((disp) == 0) { \
+ x86_address_byte ((inst), 0, (r), X86_ESP); \
+ x86_address_byte ((inst), 0, X86_ESP, X86_ESP); \
+ } else if (x86_is_imm8((disp))) { \
+ x86_address_byte ((inst), 1, (r), X86_ESP); \
+ x86_address_byte ((inst), 0, X86_ESP, X86_ESP); \
+ x86_imm_emit8 ((inst), (disp)); \
+ } else { \
+ x86_address_byte ((inst), 2, (r), X86_ESP); \
+ x86_address_byte ((inst), 0, X86_ESP, X86_ESP); \
+ x86_imm_emit32 ((inst), (disp)); \
+ } \
+ break; \
+ } \
+ if ((disp) == 0 && (basereg) != X86_EBP) { \
+ x86_address_byte ((inst), 0, (r), (basereg)); \
+ break; \
+ } \
+ if (x86_is_imm8((disp))) { \
+ x86_address_byte ((inst), 1, (r), (basereg)); \
+ x86_imm_emit8 ((inst), (disp)); \
+ } else { \
+ x86_address_byte ((inst), 2, (r), (basereg)); \
+ x86_imm_emit32 ((inst), (disp)); \
+ } \
+ } while (0)
+
+#define x86_memindex_emit(inst,r,basereg,disp,indexreg,shift) \
+ do { \
+ if ((basereg) == X86_NOBASEREG) { \
+ x86_address_byte ((inst), 0, (r), 4); \
+ x86_address_byte ((inst), (shift), (indexreg), 5); \
+ x86_imm_emit32 ((inst), (disp)); \
+ } else if ((disp) == 0 && (basereg) != X86_EBP) { \
+ x86_address_byte ((inst), 0, (r), 4); \
+ x86_address_byte ((inst), (shift), (indexreg), (basereg)); \
+ } else if (x86_is_imm8((disp))) { \
+ x86_address_byte ((inst), 1, (r), 4); \
+ x86_address_byte ((inst), (shift), (indexreg), (basereg)); \
+ x86_imm_emit8 ((inst), (disp)); \
+ } else { \
+ x86_address_byte ((inst), 0, (r), 4); \
+ x86_address_byte ((inst), (shift), (indexreg), 5); \
+ x86_imm_emit32 ((inst), (disp)); \
+ } \
+ } while (0)
+
+/*
+ * target is the position in the code where to jump to:
+ * target = code;
+ * .. output loop code...
+ * x86_mov_reg_imm (code, X86_EAX, 0);
+ * loop = code;
+ * x86_loop (code, -1);
+ * ... finish method
+ *
+ * patch displacement
+ * x86_patch (loop, target);
+ *
+ * ins should point at the start of the instruction that encodes a target.
+ * the instruction is inspected for validity and the correct displacement
+ * is inserted.
+ */
+#define x86_patch(ins,target) \
+ do { \
+ unsigned char* pos = (ins) + 1; \
+ int disp, size = 0; \
+ switch (*(ins)) { \
+ case 0xe9: ++size; break; /* jump32 */ \
+ case 0x0f: if (!(*pos >= 0x70 && *pos <= 0x7f)) assert (0); \
+ ++size; ++pos; break; /* prefix for 32-bit disp */ \
+ case 0xe0: case 0xe1: case 0xe2: /* loop */ \
+ case 0xeb: /* jump8 */ \
+ /* conditional jump opcodes */ \
+ case 0x70: case 0x71: case 0x72: case 0x73: \
+ case 0x74: case 0x75: case 0x76: case 0x77: \
+ case 0x78: case 0x79: case 0x7a: case 0x7b: \
+ case 0x7c: case 0x7d: case 0x7e: case 0x7f: \
+ break; \
+ default: assert (0); \
+ } \
+ disp = (target) - pos; \
+ if (size) x86_imm_emit32 (pos, disp - 4); \
+ else if (x86_is_imm8 (disp)) x86_imm_emit8 (pos, disp - 1); \
+ else assert (0); \
+ } while (0)
+
+#define x86_breakpoint(inst) \
+ do { \
+ *(inst)++ = 0xcc; \
+ } while (0)
+
+#define x86_cld(inst) do { *(inst)++ =(unsigned char)0xfc; } while (0)
+#define x86_stosb(inst) do { *(inst)++ =(unsigned char)0xaa; } while (0)
+#define x86_stosl(inst) do { *(inst)++ =(unsigned char)0xab; } while (0)
+
+#define x86_prefix(inst,p) do { *(inst)++ =(unsigned char) (p); } while (0)
+
+#define x86_rdtsc(inst) \
+ do { \
+ *(inst)++ = 0x0f; \
+ *(inst)++ = 0x31; \
+ } while (0)
+
+#define x86_cmpxchg_reg_reg(inst,dreg,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ *(inst)++ = (unsigned char)0xb1; \
+ x86_reg_emit ((inst), (reg), (dreg)); \
+ } while (0)
+
+#define x86_cmpxchg_mem_reg(inst,mem,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ *(inst)++ = (unsigned char)0xb1; \
+ x86_mem_emit ((inst), (reg), (mem)); \
+ } while (0)
+
+#define x86_cmpxchg_membase_reg(inst,basereg,disp,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ *(inst)++ = (unsigned char)0xb1; \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ } while (0)
+
+#define x86_xchg_reg_reg(inst,dreg,reg,size) \
+ do { \
+ if ((size) == 1) \
+ *(inst)++ = (unsigned char)0x86; \
+ else \
+ *(inst)++ = (unsigned char)0x87; \
+ x86_reg_emit ((inst), (reg), (dreg)); \
+ } while (0)
+
+#define x86_xchg_mem_reg(inst,mem,reg,size) \
+ do { \
+ if ((size) == 1) \
+ *(inst)++ = (unsigned char)0x86; \
+ else \
+ *(inst)++ = (unsigned char)0x87; \
+ x86_mem_emit ((inst), (reg), (mem)); \
+ } while (0)
+
+#define x86_xchg_membase_reg(inst,basereg,disp,reg,size) \
+ do { \
+ if ((size) == 1) \
+ *(inst)++ = (unsigned char)0x86; \
+ else \
+ *(inst)++ = (unsigned char)0x87; \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ } while (0)
+
+#define x86_inc_mem(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_mem_emit ((inst), 0, (mem)); \
+ } while (0)
+
+#define x86_inc_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_membase_emit ((inst), 0, (basereg), (disp)); \
+ } while (0)
+
+#define x86_inc_reg(inst,reg) do { *(inst)++ = (unsigned char)0x40 + (reg); } while (0)
+
+#define x86_dec_mem(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_mem_emit ((inst), 1, (mem)); \
+ } while (0)
+
+#define x86_dec_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_membase_emit ((inst), 1, (basereg), (disp)); \
+ } while (0)
+
+#define x86_dec_reg(inst,reg) do { *(inst)++ = (unsigned char)0x48 + (reg); } while (0)
+
+#define x86_not_mem(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_mem_emit ((inst), 2, (mem)); \
+ } while (0)
+
+#define x86_not_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_membase_emit ((inst), 2, (basereg), (disp)); \
+ } while (0)
+
+#define x86_not_reg(inst,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_reg_emit ((inst), 2, (reg)); \
+ } while (0)
+
+#define x86_neg_mem(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_mem_emit ((inst), 3, (mem)); \
+ } while (0)
+
+#define x86_neg_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_membase_emit ((inst), 3, (basereg), (disp)); \
+ } while (0)
+
+#define x86_neg_reg(inst,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_reg_emit ((inst), 3, (reg)); \
+ } while (0)
+
+#define x86_nop(inst) do { *(inst)++ = (unsigned char)0x90; } while (0)
+
+#define x86_alu_reg_imm(inst,opc,reg,imm) \
+ do { \
+ if ((reg) == X86_EAX) { \
+ *(inst)++ = (((unsigned char)(opc)) << 3) + 5; \
+ x86_imm_emit32 ((inst), (imm)); \
+ break; \
+ } \
+ if (x86_is_imm8((imm))) { \
+ *(inst)++ = (unsigned char)0x83; \
+ x86_reg_emit ((inst), (opc), (reg)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } else { \
+ *(inst)++ = (unsigned char)0x81; \
+ x86_reg_emit ((inst), (opc), (reg)); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_alu_mem_imm(inst,opc,mem,imm) \
+ do { \
+ if (x86_is_imm8((imm))) { \
+ *(inst)++ = (unsigned char)0x83; \
+ x86_mem_emit ((inst), (opc), (mem)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } else { \
+ *(inst)++ = (unsigned char)0x81; \
+ x86_mem_emit ((inst), (opc), (mem)); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_alu_membase_imm(inst,opc,basereg,disp,imm) \
+ do { \
+ if (x86_is_imm8((imm))) { \
+ *(inst)++ = (unsigned char)0x83; \
+ x86_membase_emit ((inst), (opc), (basereg), (disp)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } else { \
+ *(inst)++ = (unsigned char)0x81; \
+ x86_membase_emit ((inst), (opc), (basereg), (disp)); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_alu_mem_reg(inst,opc,mem,reg) \
+ do { \
+ *(inst)++ = (((unsigned char)(opc)) << 3) + 1; \
+ x86_mem_emit ((inst), (reg), (mem)); \
+ } while (0)
+
+#define x86_alu_membase_reg(inst,opc,basereg,disp,reg) \
+ do { \
+ *(inst)++ = (((unsigned char)(opc)) << 3) + 1; \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ } while (0)
+
+#define x86_alu_reg_reg(inst,opc,dreg,reg) \
+ do { \
+ *(inst)++ = (((unsigned char)(opc)) << 3) + 3; \
+ x86_reg_emit ((inst), (dreg), (reg)); \
+ } while (0)
+
+#define x86_alu_reg_mem(inst,opc,reg,mem) \
+ do { \
+ *(inst)++ = (((unsigned char)(opc)) << 3) + 3; \
+ x86_mem_emit ((inst), (reg), (mem)); \
+ } while (0)
+
+#define x86_alu_reg_membase(inst,opc,reg,basereg,disp) \
+ do { \
+ *(inst)++ = (((unsigned char)(opc)) << 3) + 3; \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ } while (0)
+
+#define x86_test_reg_imm(inst,reg,imm) \
+ do { \
+ if ((reg) == X86_EAX) { \
+ *(inst)++ = (unsigned char)0xa9; \
+ } else { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_reg_emit ((inst), 0, (reg)); \
+ } \
+ x86_imm_emit32 ((inst), (imm)); \
+ } while (0)
+
+#define x86_test_mem_imm(inst,mem,imm) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_mem_emit ((inst), 0, (mem)); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } while (0)
+
+#define x86_test_membase_imm(inst,basereg,disp,imm) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_membase_emit ((inst), 0, (basereg), (disp)); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } while (0)
+
+#define x86_test_reg_reg(inst,dreg,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0x85; \
+ x86_reg_emit ((inst), (reg), (dreg)); \
+ } while (0)
+
+#define x86_test_mem_reg(inst,mem,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0x85; \
+ x86_mem_emit ((inst), (reg), (mem)); \
+ } while (0)
+
+#define x86_test_membase_reg(inst,basereg,disp,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0x85; \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ } while (0)
+
+#define x86_shift_reg_imm(inst,opc,reg,imm) \
+ do { \
+ if ((imm) == 1) { \
+ *(inst)++ = (unsigned char)0xd1; \
+ x86_reg_emit ((inst), (opc), (reg)); \
+ } else { \
+ *(inst)++ = (unsigned char)0xc1; \
+ x86_reg_emit ((inst), (opc), (reg)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_shift_mem_imm(inst,opc,mem,imm) \
+ do { \
+ if ((imm) == 1) { \
+ *(inst)++ = (unsigned char)0xd1; \
+ x86_mem_emit ((inst), (opc), (mem)); \
+ } else { \
+ *(inst)++ = (unsigned char)0xc1; \
+ x86_mem_emit ((inst), (opc), (mem)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_shift_membase_imm(inst,opc,basereg,disp,imm) \
+ do { \
+ if ((imm) == 1) { \
+ *(inst)++ = (unsigned char)0xd1; \
+ x86_membase_emit ((inst), (opc), (basereg), (disp)); \
+ } else { \
+ *(inst)++ = (unsigned char)0xc1; \
+ x86_membase_emit ((inst), (opc), (basereg), (disp)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_shift_reg(inst,opc,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0xd3; \
+ x86_reg_emit ((inst), (opc), (reg)); \
+ } while (0)
+
+#define x86_shift_mem(inst,opc,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xd3; \
+ x86_mem_emit ((inst), (opc), (mem)); \
+ } while (0)
+
+#define x86_shift_membase(inst,opc,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xd3; \
+ x86_membase_emit ((inst), (opc), (basereg), (disp)); \
+ } while (0)
+
+/*
+ * Multi op shift missing.
+ */
+
+#define x86_shrd_reg(inst,dreg,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ *(inst)++ = (unsigned char)0xad; \
+ x86_reg_emit ((inst), (reg), (dreg)); \
+ } while (0)
+
+#define x86_shrd_reg_imm(inst,dreg,reg,shamt) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ *(inst)++ = (unsigned char)0xac; \
+ x86_reg_emit ((inst), (reg), (dreg)); \
+ x86_imm_emit8 ((inst), (shamt)); \
+ } while (0)
+
+#define x86_shld_reg(inst,dreg,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ *(inst)++ = (unsigned char)0xa5; \
+ x86_reg_emit ((inst), (reg), (dreg)); \
+ } while (0)
+
+#define x86_shld_reg_imm(inst,dreg,reg,shamt) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ *(inst)++ = (unsigned char)0xa4; \
+ x86_reg_emit ((inst), (reg), (dreg)); \
+ x86_imm_emit8 ((inst), (shamt)); \
+ } while (0)
+
+/*
+ * EDX:EAX = EAX * rm
+ */
+#define x86_mul_reg(inst,reg,is_signed) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_reg_emit ((inst), 4 + ((is_signed) ? 1 : 0), (reg)); \
+ } while (0)
+
+#define x86_mul_mem(inst,mem,is_signed) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_mem_emit ((inst), 4 + ((is_signed) ? 1 : 0), (mem)); \
+ } while (0)
+
+#define x86_mul_membase(inst,basereg,disp,is_signed) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_membase_emit ((inst), 4 + ((is_signed) ? 1 : 0), (basereg), (disp)); \
+ } while (0)
+
+/*
+ * r *= rm
+ */
+#define x86_imul_reg_reg(inst,dreg,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ *(inst)++ = (unsigned char)0xaf; \
+ x86_reg_emit ((inst), (dreg), (reg)); \
+ } while (0)
+
+#define x86_imul_reg_mem(inst,reg,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ *(inst)++ = (unsigned char)0xaf; \
+ x86_mem_emit ((inst), (reg), (mem)); \
+ } while (0)
+
+#define x86_imul_reg_membase(inst,reg,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ *(inst)++ = (unsigned char)0xaf; \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ } while (0)
+
+/*
+ * dreg = rm * imm
+ */
+#define x86_imul_reg_reg_imm(inst,dreg,reg,imm) \
+ do { \
+ if (x86_is_imm8 ((imm))) { \
+ *(inst)++ = (unsigned char)0x6b; \
+ x86_reg_emit ((inst), (dreg), (reg)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } else { \
+ *(inst)++ = (unsigned char)0x69; \
+ x86_reg_emit ((inst), (dreg), (reg)); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_imul_reg_mem_imm(inst,reg,mem,imm) \
+ do { \
+ if (x86_is_imm8 ((imm))) { \
+ *(inst)++ = (unsigned char)0x6b; \
+ x86_mem_emit ((inst), (reg), (mem)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } else { \
+ *(inst)++ = (unsigned char)0x69; \
+ x86_reg_emit ((inst), (reg), (mem)); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_imul_reg_membase_imm(inst,reg,basereg,disp,imm) \
+ do { \
+ if (x86_is_imm8 ((imm))) { \
+ *(inst)++ = (unsigned char)0x6b; \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } else { \
+ *(inst)++ = (unsigned char)0x69; \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } \
+ } while (0)
+
+/*
+ * divide EDX:EAX by rm;
+ * eax = quotient, edx = remainder
+ */
+
+#define x86_div_reg(inst,reg,is_signed) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_reg_emit ((inst), 6 + ((is_signed) ? 1 : 0), (reg)); \
+ } while (0)
+
+#define x86_div_mem(inst,mem,is_signed) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_mem_emit ((inst), 6 + ((is_signed) ? 1 : 0), (mem)); \
+ } while (0)
+
+#define x86_div_membase(inst,basereg,disp,is_signed) \
+ do { \
+ *(inst)++ = (unsigned char)0xf7; \
+ x86_membase_emit ((inst), 6 + ((is_signed) ? 1 : 0), (basereg), (disp)); \
+ } while (0)
+
+#define x86_mov_mem_reg(inst,mem,reg,size) \
+ do { \
+ switch ((size)) { \
+ case 1: *(inst)++ = (unsigned char)0x88; break; \
+ case 2: *(inst)++ = (unsigned char)0x66; /* fall through */ \
+ case 4: *(inst)++ = (unsigned char)0x89; break; \
+ default: assert (0); \
+ } \
+ x86_mem_emit ((inst), (reg), (mem)); \
+ } while (0)
+
+#define x86_mov_regp_reg(inst,regp,reg,size) \
+ do { \
+ switch ((size)) { \
+ case 1: *(inst)++ = (unsigned char)0x88; break; \
+ case 2: *(inst)++ = (unsigned char)0x66; /* fall through */ \
+ case 4: *(inst)++ = (unsigned char)0x89; break; \
+ default: assert (0); \
+ } \
+ x86_regp_emit ((inst), (reg), (regp)); \
+ } while (0)
+
+#define x86_mov_membase_reg(inst,basereg,disp,reg,size) \
+ do { \
+ switch ((size)) { \
+ case 1: *(inst)++ = (unsigned char)0x88; break; \
+ case 2: *(inst)++ = (unsigned char)0x66; /* fall through */ \
+ case 4: *(inst)++ = (unsigned char)0x89; break; \
+ default: assert (0); \
+ } \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ } while (0)
+
+#define x86_mov_memindex_reg(inst,basereg,disp,indexreg,shift,reg,size) \
+ do { \
+ switch ((size)) { \
+ case 1: *(inst)++ = (unsigned char)0x88; break; \
+ case 2: *(inst)++ = (unsigned char)0x66; /* fall through */ \
+ case 4: *(inst)++ = (unsigned char)0x89; break; \
+ default: assert (0); \
+ } \
+ x86_memindex_emit ((inst), (reg), (basereg), (disp), (indexreg), (shift)); \
+ } while (0)
+
+#define x86_mov_reg_reg(inst,dreg,reg,size) \
+ do { \
+ switch ((size)) { \
+ case 1: *(inst)++ = (unsigned char)0x8a; break; \
+ case 2: *(inst)++ = (unsigned char)0x66; /* fall through */ \
+ case 4: *(inst)++ = (unsigned char)0x8b; break; \
+ default: assert (0); \
+ } \
+ x86_reg_emit ((inst), (dreg), (reg)); \
+ } while (0)
+
+#define x86_mov_reg_mem(inst,reg,mem,size) \
+ do { \
+ switch ((size)) { \
+ case 1: *(inst)++ = (unsigned char)0x8a; break; \
+ case 2: *(inst)++ = (unsigned char)0x66; /* fall through */ \
+ case 4: *(inst)++ = (unsigned char)0x8b; break; \
+ default: assert (0); \
+ } \
+ x86_mem_emit ((inst), (reg), (mem)); \
+ } while (0)
+
+#define x86_mov_reg_membase(inst,reg,basereg,disp,size) \
+ do { \
+ switch ((size)) { \
+ case 1: *(inst)++ = (unsigned char)0x8a; break; \
+ case 2: *(inst)++ = (unsigned char)0x66; /* fall through */ \
+ case 4: *(inst)++ = (unsigned char)0x8b; break; \
+ default: assert (0); \
+ } \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ } while (0)
+
+#define x86_mov_reg_memindex(inst,reg,basereg,disp,indexreg,shift,size) \
+ do { \
+ switch ((size)) { \
+ case 1: *(inst)++ = (unsigned char)0x8a; break; \
+ case 2: *(inst)++ = (unsigned char)0x66; /* fall through */ \
+ case 4: *(inst)++ = (unsigned char)0x8b; break; \
+ default: assert (0); \
+ } \
+ x86_memindex_emit ((inst), (reg), (basereg), (disp), (indexreg), (shift)); \
+ } while (0)
+
+/*
+ * Note: x86_clear_reg () chacnges the condition code!
+ */
+#define x86_clear_reg(inst,reg) x86_alu_reg_reg((inst), X86_XOR, (reg), (reg))
+
+#define x86_mov_reg_imm(inst,reg,imm) \
+ do { \
+ *(inst)++ = (unsigned char)0xb8 + (reg); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } while (0)
+
+#define x86_mov_mem_imm(inst,mem,imm,size) \
+ do { \
+ if ((size) == 1) { \
+ *(inst)++ = (unsigned char)0xc6; \
+ x86_mem_emit ((inst), 0, (mem)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } else if ((size) == 2) { \
+ *(inst)++ = (unsigned char)0x66; \
+ *(inst)++ = (unsigned char)0xc7; \
+ x86_mem_emit ((inst), 0, (mem)); \
+ x86_imm_emit16 ((inst), (imm)); \
+ } else { \
+ *(inst)++ = (unsigned char)0xc7; \
+ x86_mem_emit ((inst), 0, (mem)); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_mov_membase_imm(inst,basereg,disp,imm,size) \
+ do { \
+ if ((size) == 1) { \
+ *(inst)++ = (unsigned char)0xc6; \
+ x86_membase_emit ((inst), 0, (basereg), (disp)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } else if ((size) == 2) { \
+ *(inst)++ = (unsigned char)0x66; \
+ *(inst)++ = (unsigned char)0xc7; \
+ x86_membase_emit ((inst), 0, (basereg), (disp)); \
+ x86_imm_emit16 ((inst), (imm)); \
+ } else { \
+ *(inst)++ = (unsigned char)0xc7; \
+ x86_membase_emit ((inst), 0, (basereg), (disp)); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_mov_memindex_imm(inst,basereg,disp,indexreg,shift,imm,size) \
+ do { \
+ if ((size) == 1) { \
+ *(inst)++ = (unsigned char)0xc6; \
+ x86_memindex_emit ((inst), 0, (basereg), (disp), (indexreg), (shift)); \
+ x86_imm_emit8 ((inst), (imm)); \
+ } else if ((size) == 2) { \
+ *(inst)++ = (unsigned char)0x66; \
+ *(inst)++ = (unsigned char)0xc7; \
+ x86_memindex_emit ((inst), 0, (basereg), (disp), (indexreg), (shift)); \
+ x86_imm_emit16 ((inst), (imm)); \
+ } else { \
+ *(inst)++ = (unsigned char)0xc7; \
+ x86_memindex_emit ((inst), 0, (basereg), (disp), (indexreg), (shift)); \
+ x86_imm_emit32 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_lea_mem(inst,reg,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0x8d; \
+ x86_mem_emit ((inst), (reg), (mem)); \
+ } while (0)
+
+#define x86_lea_membase(inst,reg,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0x8d; \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ } while (0)
+
+#define x86_lea_memindex(inst,reg,basereg,disp,indexreg,shift) \
+ do { \
+ *(inst)++ = (unsigned char)0x8d; \
+ x86_memindex_emit ((inst), (reg), (basereg), (disp), (indexreg), (shift)); \
+ } while (0)
+
+#define x86_widen_reg(inst,dreg,reg,is_signed,is_half) \
+ do { \
+ unsigned char op = 0xb6; \
+ *(inst)++ = (unsigned char)0x0f; \
+ if ((is_signed)) op += 0x08; \
+ if ((is_half)) op += 0x01; \
+ *(inst)++ = op; \
+ x86_reg_emit ((inst), (dreg), (reg)); \
+ } while (0)
+
+#define x86_widen_mem(inst,dreg,mem,is_signed,is_half) \
+ do { \
+ unsigned char op = 0xb6; \
+ *(inst)++ = (unsigned char)0x0f; \
+ if ((is_signed)) op += 0x08; \
+ if ((is_half)) op += 0x01; \
+ *(inst)++ = op; \
+ x86_mem_emit ((inst), (dreg), (mem)); \
+ } while (0)
+
+#define x86_widen_membase(inst,dreg,basereg,disp,is_signed,is_half) \
+ do { \
+ unsigned char op = 0xb6; \
+ *(inst)++ = (unsigned char)0x0f; \
+ if ((is_signed)) op += 0x08; \
+ if ((is_half)) op += 0x01; \
+ *(inst)++ = op; \
+ x86_membase_emit ((inst), (dreg), (basereg), (disp)); \
+ } while (0)
+
+#define x86_widen_memindex(inst,dreg,basereg,disp,indexreg,shift,is_signed,is_half) \
+ do { \
+ unsigned char op = 0xb6; \
+ *(inst)++ = (unsigned char)0x0f; \
+ if ((is_signed)) op += 0x08; \
+ if ((is_half)) op += 0x01; \
+ *(inst)++ = op; \
+ x86_memindex_emit ((inst), (dreg), (basereg), (disp), (indexreg), (shift)); \
+ } while (0)
+
+#define x86_cdq(inst) do { *(inst)++ = (unsigned char)0x99; } while (0)
+#define x86_wait(inst) do { *(inst)++ = (unsigned char)0x9b; } while (0)
+
+#define x86_fp_op_mem(inst,opc,mem,is_double) \
+ do { \
+ *(inst)++ = (is_double) ? (unsigned char)0xdc : (unsigned char)0xd8; \
+ x86_mem_emit ((inst), (opc), (mem)); \
+ } while (0)
+
+#define x86_fp_op(inst,opc,index) \
+ do { \
+ *(inst)++ = (unsigned char)0xd8; \
+ *(inst)++ = (unsigned char)0xc0+((opc)<<3)+((index)&0x07); \
+ } while (0)
+
+#define x86_fp_op_reg(inst,opc,index,pop_stack) \
+ do { \
+ static const unsigned char map[] = { 0, 1, 2, 3, 5, 4, 7, 6, 8}; \
+ *(inst)++ = (pop_stack) ? (unsigned char)0xde : (unsigned char)0xdc; \
+ *(inst)++ = (unsigned char)0xc0+(map[(opc)]<<3)+((index)&0x07); \
+ } while (0)
+
+#define x86_fstp(inst,index) \
+ do { \
+ *(inst)++ = (unsigned char)0xdd; \
+ *(inst)++ = (unsigned char)0xd8+(index); \
+ } while (0)
+
+#define x86_fcompp(inst) \
+ do { \
+ *(inst)++ = (unsigned char)0xde; \
+ *(inst)++ = (unsigned char)0xd9; \
+ } while (0)
+
+#define x86_fnstsw(inst) \
+ do { \
+ *(inst)++ = (unsigned char)0xdf; \
+ *(inst)++ = (unsigned char)0xe0; \
+ } while (0)
+
+#define x86_fnstcw(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xd9; \
+ x86_mem_emit ((inst), 7, (mem)); \
+ } while (0)
+
+#define x86_fnstcw_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xd9; \
+ x86_membase_emit ((inst), 7, (basereg), (disp)); \
+ } while (0)
+
+#define x86_fldcw(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xd9; \
+ x86_mem_emit ((inst), 5, (mem)); \
+ } while (0)
+
+#define x86_fldcw_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xd9; \
+ x86_membase_emit ((inst), 5, (basereg), (disp)); \
+ } while (0)
+
+#define x86_fchs(inst) \
+ do { \
+ *(inst)++ = (unsigned char)0xd9; \
+ *(inst)++ = (unsigned char)0xe0; \
+ } while (0)
+
+#define x86_frem(inst) \
+ do { \
+ *(inst)++ = (unsigned char)0xd9; \
+ *(inst)++ = (unsigned char)0xf8; \
+ } while (0)
+
+#define x86_fxch(inst,index) \
+ do { \
+ *(inst)++ = (unsigned char)0xd9; \
+ *(inst)++ = (unsigned char)0xc8 + ((index) & 0x07); \
+ } while (0)
+
+#define x86_fcomip(inst,index) \
+ do { \
+ *(inst)++ = (unsigned char)0xdf; \
+ *(inst)++ = (unsigned char)0xf0 + ((index) & 0x07); \
+ } while (0)
+
+#define x86_fld(inst,mem,is_double) \
+ do { \
+ *(inst)++ = (is_double) ? (unsigned char)0xdd : (unsigned char)0xd9; \
+ x86_mem_emit ((inst), 0, (mem)); \
+ } while (0)
+
+#define x86_fld_membase(inst,basereg,disp,is_double) \
+ do { \
+ *(inst)++ = (is_double) ? (unsigned char)0xdd : (unsigned char)0xd9; \
+ x86_membase_emit ((inst), 0, (basereg), (disp)); \
+ } while (0)
+
+#define x86_fld80_mem(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xdb; \
+ x86_mem_emit ((inst), 5, (mem)); \
+ } while (0)
+
+#define x86_fld80_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xdb; \
+ x86_membase_emit ((inst), 5, (basereg), (disp)); \
+ } while (0)
+
+#define x86_fild(inst,mem,is_long) \
+ do { \
+ if ((is_long)) { \
+ *(inst)++ = (unsigned char)0xdf; \
+ x86_mem_emit ((inst), 5, (mem)); \
+ } else { \
+ *(inst)++ = (unsigned char)0xdb; \
+ x86_mem_emit ((inst), 0, (mem)); \
+ } \
+ } while (0)
+
+#define x86_fild_membase(inst,basereg,disp,is_long) \
+ do { \
+ if ((is_long)) { \
+ *(inst)++ = (unsigned char)0xdf; \
+ x86_membase_emit ((inst), 5, (basereg), (disp)); \
+ } else { \
+ *(inst)++ = (unsigned char)0xdb; \
+ x86_membase_emit ((inst), 0, (basereg), (disp)); \
+ } \
+ } while (0)
+
+#define x86_fld_reg(inst,index) \
+ do { \
+ *(inst)++ = (unsigned char)0xd9; \
+ *(inst)++ = (unsigned char)0xc0 + ((index) & 0x07); \
+ } while (0)
+
+#define x86_fldz(inst) \
+ do { \
+ *(inst)++ = (unsigned char)0xd9; \
+ *(inst)++ = (unsigned char)0xee; \
+ } while (0)
+
+#define x86_fld1(inst) \
+ do { \
+ *(inst)++ = (unsigned char)0xd9; \
+ *(inst)++ = (unsigned char)0xe8; \
+ } while (0)
+
+#define x86_fst(inst,mem,is_double,pop_stack) \
+ do { \
+ *(inst)++ = (is_double) ? (unsigned char)0xdd: (unsigned char)0xd9; \
+ x86_mem_emit ((inst), 2 + ((pop_stack) ? 1 : 0), (mem)); \
+ } while (0)
+
+#define x86_fst_membase(inst,basereg,disp,is_double,pop_stack) \
+ do { \
+ *(inst)++ = (is_double) ? (unsigned char)0xdd: (unsigned char)0xd9; \
+ x86_membase_emit ((inst), 2 + ((pop_stack) ? 1 : 0), (basereg), (disp)); \
+ } while (0)
+
+#define x86_fst80_mem(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xdb; \
+ x86_mem_emit ((inst), 7, (mem)); \
+ } while (0)
+
+
+#define x86_fst80_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xdb; \
+ x86_membase_emit ((inst), 7, (basereg), (disp)); \
+ } while (0)
+
+
+#define x86_fist_pop(inst,mem,is_long) \
+ do { \
+ if ((is_long)) { \
+ *(inst)++ = (unsigned char)0xdf; \
+ x86_mem_emit ((inst), 7, (mem)); \
+ } else { \
+ *(inst)++ = (unsigned char)0xdb; \
+ x86_mem_emit ((inst), 3, (mem)); \
+ } \
+ } while (0)
+
+#define x86_fist_pop_membase(inst,basereg,disp,is_long) \
+ do { \
+ if ((is_long)) { \
+ *(inst)++ = (unsigned char)0xdf; \
+ x86_membase_emit ((inst), 7, (basereg), (disp)); \
+ } else { \
+ *(inst)++ = (unsigned char)0xdb; \
+ x86_membase_emit ((inst), 3, (basereg), (disp)); \
+ } \
+ } while (0)
+
+#define x86_push_reg(inst,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0x50 + (reg); \
+ } while (0)
+
+#define x86_push_regp(inst,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_regp_emit ((inst), 6, (reg)); \
+ } while (0)
+
+#define x86_push_mem(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_mem_emit ((inst), 6, (mem)); \
+ } while (0)
+
+#define x86_push_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_membase_emit ((inst), 6, (basereg), (disp)); \
+ } while (0)
+
+#define x86_push_memindex(inst,basereg,disp,indexreg,shift) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_memindex_emit ((inst), 6, (basereg), (disp), (indexreg), (shift)); \
+ } while (0)
+
+#define x86_push_imm(inst,imm) \
+ do { \
+ *(inst)++ = (unsigned char)0x68; \
+ x86_imm_emit32 ((inst), (imm)); \
+ } while (0)
+
+#define x86_pop_reg(inst,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0x58 + (reg); \
+ } while (0)
+
+#define x86_pop_mem(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0x87; \
+ x86_mem_emit ((inst), 0, (mem)); \
+ } while (0)
+
+#define x86_pop_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0x87; \
+ x86_membase_emit ((inst), 0, (basereg), (disp)); \
+ } while (0)
+
+#define x86_pushad(inst) do { *(inst)++ = (unsigned char)0x60; } while (0)
+#define x86_pushfd(inst) do { *(inst)++ = (unsigned char)0x9c; } while (0)
+#define x86_popad(inst) do { *(inst)++ = (unsigned char)0x61; } while (0)
+#define x86_popfd(inst) do { *(inst)++ = (unsigned char)0x9d; } while (0)
+
+#define x86_loop(inst,imm) \
+ do { \
+ *(inst)++ = (unsigned char)0xe2; \
+ x86_imm_emit8 ((inst), (imm)); \
+ } while (0)
+
+#define x86_loope(inst,imm) \
+ do { \
+ *(inst)++ = (unsigned char)0xe1; \
+ x86_imm_emit8 ((inst), (imm)); \
+ } while (0)
+
+#define x86_loopne(inst,imm) \
+ do { \
+ *(inst)++ = (unsigned char)0xe0; \
+ x86_imm_emit8 ((inst), (imm)); \
+ } while (0)
+
+#define x86_jump32(inst,imm) \
+ do { \
+ *(inst)++ = (unsigned char)0xe9; \
+ x86_imm_emit32 ((inst), (imm)); \
+ } while (0)
+
+#define x86_jump8(inst,imm) \
+ do { \
+ *(inst)++ = (unsigned char)0xeb; \
+ x86_imm_emit8 ((inst), (imm)); \
+ } while (0)
+
+#define x86_jump_reg(inst,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_reg_emit ((inst), 4, (reg)); \
+ } while (0)
+
+#define x86_jump_mem(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_mem_emit ((inst), 4, (mem)); \
+ } while (0)
+
+#define x86_jump_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_membase_emit ((inst), 4, (basereg), (disp)); \
+ } while (0)
+
+/*
+ * target is a pointer in our buffer.
+ */
+#define x86_jump_code(inst,target) \
+ do { \
+ int t = (unsigned char*)(target) - (inst) - 2; \
+ if (x86_is_imm8(t)) { \
+ x86_jump8 ((inst), t); \
+ } else { \
+ t -= 3; \
+ x86_jump32 ((inst), t); \
+ } \
+ } while (0)
+
+#define x86_jump_disp(inst,disp) \
+ do { \
+ int t = (disp) - 2; \
+ if (x86_is_imm8(t)) { \
+ x86_jump8 ((inst), t); \
+ } else { \
+ t -= 3; \
+ x86_jump32 ((inst), t); \
+ } \
+ } while (0)
+
+#define x86_branch8(inst,cond,imm,is_signed) \
+ do { \
+ if ((is_signed)) \
+ *(inst)++ = x86_cc_signed_map [(cond)]; \
+ else \
+ *(inst)++ = x86_cc_unsigned_map [(cond)]; \
+ x86_imm_emit8 ((inst), (imm)); \
+ } while (0)
+
+#define x86_branch32(inst,cond,imm,is_signed) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ if ((is_signed)) \
+ *(inst)++ = x86_cc_signed_map [(cond)] + 0x10; \
+ else \
+ *(inst)++ = x86_cc_unsigned_map [(cond)] + 0x10; \
+ x86_imm_emit32 ((inst), (imm)); \
+ } while (0)
+
+#define x86_branch(inst,cond,target,is_signed) \
+ do { \
+ int offset = (target) - (inst) - 2; \
+ if (x86_is_imm8 ((offset))) \
+ x86_branch8 ((inst), (cond), offset, (is_signed)); \
+ else { \
+ offset -= 4; \
+ x86_branch32 ((inst), (cond), offset, (is_signed)); \
+ } \
+ } while (0)
+
+#define x86_branch_disp(inst,cond,disp,is_signed) \
+ do { \
+ int offset = (disp) - 2; \
+ if (x86_is_imm8 ((offset))) \
+ x86_branch8 ((inst), (cond), offset, (is_signed)); \
+ else { \
+ offset -= 4; \
+ x86_branch32 ((inst), (cond), offset, (is_signed)); \
+ } \
+ } while (0)
+
+#define x86_set_reg(inst,cond,reg,is_signed) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ if ((is_signed)) \
+ *(inst)++ = x86_cc_signed_map [(cond)] + 0x20; \
+ else \
+ *(inst)++ = x86_cc_unsigned_map [(cond)] + 0x20; \
+ x86_reg_emit ((inst), 0, (reg)); \
+ } while (0)
+
+#define x86_set_mem(inst,cond,mem,is_signed) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ if ((is_signed)) \
+ *(inst)++ = x86_cc_signed_map [(cond)] + 0x20; \
+ else \
+ *(inst)++ = x86_cc_unsigned_map [(cond)] + 0x20; \
+ x86_mem_emit ((inst), 0, (mem)); \
+ } while (0)
+
+#define x86_set_membase(inst,cond,basereg,disp,is_signed) \
+ do { \
+ *(inst)++ = (unsigned char)0x0f; \
+ if ((is_signed)) \
+ *(inst)++ = x86_cc_signed_map [(cond)] + 0x20; \
+ else \
+ *(inst)++ = x86_cc_unsigned_map [(cond)] + 0x20; \
+ x86_membase_emit ((inst), 0, (basereg), (disp)); \
+ } while (0)
+
+#define x86_call_imm(inst,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xe8; \
+ x86_imm_emit32 ((inst), (int)(disp)); \
+ } while (0)
+
+#define x86_call_reg(inst,reg) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_reg_emit ((inst), 2, (reg)); \
+ } while (0)
+
+#define x86_call_mem(inst,mem) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_mem_emit ((inst), 2, (mem)); \
+ } while (0)
+
+#define x86_call_membase(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_membase_emit ((inst), 2, (basereg), (disp)); \
+ } while (0)
+
+#define x86_call_code(inst,target) \
+ do { \
+ int _x86_offset = (unsigned char*)(target) - (inst); \
+ _x86_offset -= 5; \
+ x86_call_imm ((inst), _x86_offset); \
+ } while (0)
+
+#define x86_ret(inst) do { *(inst)++ = (unsigned char)0xc3; } while (0)
+
+#define x86_ret_imm(inst,imm) \
+ do { \
+ if ((imm) == 0) { \
+ x86_ret ((inst)); \
+ } else { \
+ *(inst)++ = (unsigned char)0xc2; \
+ x86_imm_emit16 ((inst), (imm)); \
+ } \
+ } while (0)
+
+#define x86_cmov_reg(inst,cond,is_signed,dreg,reg) \
+ do { \
+ *(inst)++ = (unsigned char) 0x0f; \
+ if ((is_signed)) \
+ *(inst)++ = x86_cc_signed_map [(cond)] - 0x30; \
+ else \
+ *(inst)++ = x86_cc_unsigned_map [(cond)] - 0x30; \
+ x86_reg_emit ((inst), (dreg), (reg)); \
+ } while (0)
+
+#define x86_cmov_mem(inst,cond,is_signed,reg,mem) \
+ do { \
+ *(inst)++ = (unsigned char) 0x0f; \
+ if ((is_signed)) \
+ *(inst)++ = x86_cc_signed_map [(cond)] - 0x30; \
+ else \
+ *(inst)++ = x86_cc_unsigned_map [(cond)] - 0x30; \
+ x86_mem_emit ((inst), (reg), (mem)); \
+ } while (0)
+
+#define x86_cmov_membase(inst,cond,is_signed,reg,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char) 0x0f; \
+ if ((is_signed)) \
+ *(inst)++ = x86_cc_signed_map [(cond)] - 0x30; \
+ else \
+ *(inst)++ = x86_cc_unsigned_map [(cond)] - 0x30; \
+ x86_membase_emit ((inst), (reg), (basereg), (disp)); \
+ } while (0)
+
+#define x86_enter(inst,framesize) \
+ do { \
+ *(inst)++ = (unsigned char)0xc8; \
+ x86_imm_emit16 ((inst), (framesize)); \
+ *(inst)++ = 0; \
+ } while (0)
+
+#define x86_leave(inst) do { *(inst)++ = (unsigned char)0xc9; } while (0)
+#define x86_sahf(inst) do { *(inst)++ = (unsigned char)0x9e; } while (0)
+
+#define x86_fsin(inst) do { *(inst)++ = (unsigned char)0xd9; *(inst)++ = (unsigned char)0xfe; } while (0)
+#define x86_fcos(inst) do { *(inst)++ = (unsigned char)0xd9; *(inst)++ = (unsigned char)0xff; } while (0)
+#define x86_fabs(inst) do { *(inst)++ = (unsigned char)0xd9; *(inst)++ = (unsigned char)0xe1; } while (0)
+#define x86_fpatan(inst) do { *(inst)++ = (unsigned char)0xd9; *(inst)++ = (unsigned char)0xf3; } while (0)
+#define x86_fprem(inst) do { *(inst)++ = (unsigned char)0xd9; *(inst)++ = (unsigned char)0xf8; } while (0)
+#define x86_fprem1(inst) do { *(inst)++ = (unsigned char)0xd9; *(inst)++ = (unsigned char)0xf5; } while (0)
+#define x86_frndint(inst) do { *(inst)++ = (unsigned char)0xd9; *(inst)++ = (unsigned char)0xfc; } while (0)
+#define x86_fsqrt(inst) do { *(inst)++ = (unsigned char)0xd9; *(inst)++ = (unsigned char)0xfa; } while (0)
+#define x86_fptan(inst) do { *(inst)++ = (unsigned char)0xd9; *(inst)++ = (unsigned char)0xf2; } while (0)
+
+#define x86_padding(inst,size) \
+ do { \
+ switch ((size)) { \
+ case 1: x86_nop ((inst)); break; \
+ case 2: *(inst)++ = 0x8b; \
+ *(inst)++ = 0xc0; break; \
+ case 3: *(inst)++ = 0x8d; *(inst)++ = 0x6d; \
+ *(inst)++ = 0x00; break; \
+ case 4: *(inst)++ = 0x8d; *(inst)++ = 0x64; \
+ *(inst)++ = 0x24; *(inst)++ = 0x00; \
+ break; \
+ case 5: *(inst)++ = 0x8d; *(inst)++ = 0x64; \
+ *(inst)++ = 0x24; *(inst)++ = 0x00; \
+ x86_nop ((inst)); break; \
+ case 6: *(inst)++ = 0x8d; *(inst)++ = 0xad; \
+ *(inst)++ = 0x00; *(inst)++ = 0x00; \
+ *(inst)++ = 0x00; *(inst)++ = 0x00; \
+ break; \
+ case 7: *(inst)++ = 0x8d; *(inst)++ = 0xa4; \
+ *(inst)++ = 0x24; *(inst)++ = 0x00; \
+ *(inst)++ = 0x00; *(inst)++ = 0x00; \
+ *(inst)++ = 0x00; break; \
+ default: assert (0); \
+ } \
+ } while (0)
+
+#define x86_prolog(inst,frame_size,reg_mask) \
+ do { \
+ unsigned i, m = 1; \
+ x86_enter ((inst), (frame_size)); \
+ for (i = 0; i < X86_NREG; ++i, m <<= 1) { \
+ if ((reg_mask) & m) \
+ x86_push_reg ((inst), i); \
+ } \
+ } while (0)
+
+#define x86_epilog(inst,reg_mask) \
+ do { \
+ unsigned i, m = 1 << X86_EDI; \
+ for (i = X86_EDI; m != 0; i--, m=m>>1) { \
+ if ((reg_mask) & m) \
+ x86_pop_reg ((inst), i); \
+ } \
+ x86_leave ((inst)); \
+ x86_ret ((inst)); \
+ } while (0)
+
+#endif // X86_H
diff --git a/mono/benchmark/.cvsignore b/mono/benchmark/.cvsignore
new file mode 100644
index 00000000000..2ac00fb6fc3
--- /dev/null
+++ b/mono/benchmark/.cvsignore
@@ -0,0 +1,5 @@
+Makefile.in
+Makefile
+*.stdout
+.deps
+.libs
diff --git a/mono/benchmark/Makefile.am b/mono/benchmark/Makefile.am
new file mode 100644
index 00000000000..ca6cc442249
--- /dev/null
+++ b/mono/benchmark/Makefile.am
@@ -0,0 +1,44 @@
+TEST_PROG=../jit/mono
+
+CSC=mcs
+
+
+TESTSRC= \
+ fib.cs \
+ life.cs \
+ castclass.cs \
+ isinst.cs \
+ inline1.cs \
+ inline2.cs \
+ inline3.cs
+
+TESTSI=$(TESTSRC:.cs=.exe)
+TESTBS=$(BENCHSRC:.cs=.exe)
+
+EXTRA_DIST=test-driver $(TESTSRC)
+
+%.exe: %.cs
+ $(CSC) $<
+
+test: $(TEST_PROG) $(TESTSI)
+ @failed=0; \
+ passed=0; \
+ for i in $(TESTSI); do \
+ if ./test-driver $(TEST_PROG) $$i; \
+ then \
+ passed=`expr $${passed} + 1`; \
+ else \
+ failed=`expr $${failed} + 1`; \
+ fi \
+ done; \
+ echo "$${passed} test(s) passed. $${failed} test(s) failed."
+
+
+testjitspeed: $(JITTEST_PROG) $(TESTBS)
+ for i in $(TESTBS); do \
+ echo $$i; \
+ time $(JITTEST_PROG) $$i; \
+ done
+
+check:
+ @echo no check yet
diff --git a/mono/benchmark/castclass.cs b/mono/benchmark/castclass.cs
new file mode 100755
index 00000000000..0864a1a35ed
--- /dev/null
+++ b/mono/benchmark/castclass.cs
@@ -0,0 +1,27 @@
+using System;
+
+public class Test {
+
+ int tmp = 1;
+
+ public static int Main (string[] args) {
+ int repeat = 1;
+
+
+ if (args.Length == 1)
+ repeat = Convert.ToInt32 (args [0]);
+
+ Console.WriteLine ("Repeat = " + repeat);
+
+ object a = new Test ();
+
+ for (int i = 0; i < (repeat * 5000); i++)
+ for (int j = 0; j < 100000; j++)
+ if (((Test)a).tmp != 1)
+ return 1;
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/benchmark/fib.cs b/mono/benchmark/fib.cs
new file mode 100755
index 00000000000..44c398493f6
--- /dev/null
+++ b/mono/benchmark/fib.cs
@@ -0,0 +1,26 @@
+using System;
+
+public class Fib {
+
+ public static int fib (int n) {
+ if (n < 2)
+ return 1;
+ return fib(n-2)+fib(n-1);
+ }
+ public static int Main (string[] args) {
+ int repeat = 1;
+
+ if (args.Length == 1)
+ repeat = Convert.ToInt32 (args [0]);
+
+ Console.WriteLine ("Repeat = " + repeat);
+
+ for (int i = 0; i < (repeat * 50); i++)
+ if (fib (32) != 3524578)
+ return 1;
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/benchmark/inline1.cs b/mono/benchmark/inline1.cs
new file mode 100755
index 00000000000..883a81ddcd1
--- /dev/null
+++ b/mono/benchmark/inline1.cs
@@ -0,0 +1,24 @@
+using System;
+
+public class Test {
+
+ public static void test (int n) {
+ }
+
+ public static int Main (string[] args) {
+ int repeat = 1;
+
+ if (args.Length == 1)
+ repeat = Convert.ToInt32 (args [0]);
+
+ Console.WriteLine ("Repeat = " + repeat);
+
+ for (int i = 0; i < repeat; i++)
+ for (int j = 0; j < 500000000; j++)
+ test (12345);
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/benchmark/inline2.cs b/mono/benchmark/inline2.cs
new file mode 100644
index 00000000000..548a1e01158
--- /dev/null
+++ b/mono/benchmark/inline2.cs
@@ -0,0 +1,36 @@
+using System;
+
+public class Test {
+
+ public static void test0 () {
+ test1 (0);
+ }
+ public static void test1 (int a) {
+ test2 (0, 1);
+ }
+ public static void test2 (int a, int b) {
+ test3 (0, 1, 2);
+ }
+ public static void test3 (int a, int b, int c) {
+ test4 (0, 1, 2, 3);
+ }
+ public static void test4 (int a, int b, int c, int d) {
+ }
+
+ public static int Main (string[] args) {
+ int repeat = 1;
+
+ if (args.Length == 1)
+ repeat = Convert.ToInt32 (args [0]);
+
+ Console.WriteLine ("Repeat = " + repeat);
+
+ for (int i = 0; i < repeat; i++)
+ for (int j = 0; j < 500000000; j++)
+ test0 ();
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/benchmark/inline3.cs b/mono/benchmark/inline3.cs
new file mode 100644
index 00000000000..40e8c4445ff
--- /dev/null
+++ b/mono/benchmark/inline3.cs
@@ -0,0 +1,52 @@
+using System;
+
+public class Test {
+
+ public static int test0 ()
+ {
+ return test1 (1);
+ }
+ public static int test1 (int a)
+ {
+ return test2 (a, 2);
+ }
+
+ public static int test2 (int a, int b)
+ {
+ return test3 (a, b, 3);
+ }
+
+ public static int test3 (int a, int b, int c)
+ {
+ return test4 (a, b, c, 4);
+ }
+
+ public static int test4 (int a, int b, int c, int d)
+ {
+ return a + b + c + d;
+ }
+
+ public static int run ()
+ {
+ return test0 ();
+ }
+
+ public static int Main (string[] args) {
+ int repeat = 1;
+
+ if (args.Length == 1)
+ repeat = Convert.ToInt32 (args [0]);
+
+ Console.WriteLine ("Repeat = " + repeat);
+
+ for (int i = 0; i < repeat; i++)
+ for (int j = 0; j < 500000000; j++)
+ if (test0 () != 10)
+ return 1;
+
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/benchmark/isinst.cs b/mono/benchmark/isinst.cs
new file mode 100755
index 00000000000..7d5008147ea
--- /dev/null
+++ b/mono/benchmark/isinst.cs
@@ -0,0 +1,24 @@
+using System;
+
+public class Test {
+
+ public static int Main (string[] args) {
+ int repeat = 1;
+
+ if (args.Length == 1)
+ repeat = Convert.ToInt32 (args [0]);
+
+ Console.WriteLine ("Repeat = " + repeat);
+
+ object a = new Test ();
+
+ for (int i = 0; i < (repeat * 5000); i++)
+ for (int j = 0; j < 100000; j++)
+ if (!(a is Test))
+ return 1;
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/benchmark/life.cs b/mono/benchmark/life.cs
new file mode 100644
index 00000000000..a0c8d5b0be8
--- /dev/null
+++ b/mono/benchmark/life.cs
@@ -0,0 +1,74 @@
+// created on 03/03/2002 at 15:12
+using System;
+
+class App {
+ static String s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15;
+ static int[] offsets = {-16, -15, -14, -1, 1, 14, 15, 16};
+ public static int Main(String[] args) {
+ int i2 = 500;
+ int i0;
+ double n2;
+ DateTime start, end;
+ start = DateTime.Now;
+ s0 = " ";
+ s1 = " ";
+ s2 = " ";
+ s3 = " *** ";
+ s4 = " ";
+ s5 = " ";
+ s6 = " * ";
+ s7 = " * ";
+ s8 = " * ";
+ s9 = " * ";
+ s10 =" * ";
+ s11 =" * ";
+ s12 =" ";
+ s13 =" ";
+ s14 =" ";
+ s15 ="";
+ s15 = s0+s1+s2+s3+s4+s5+s6+s7+s8+s9+s10+s11+s12+s13+s14;
+ dump();
+ i0 =0;
+ while (i0++ < i2) {
+ generate();
+ dump();
+ }
+ end = DateTime.Now;
+ n2 = (end-start).TotalMilliseconds;
+ Console.WriteLine("{0} generations in {1} milliseconds, {2} gen/sec.",
+ i2, (int)n2, (int)(i2/(n2/1000)));
+ return 0;
+}
+static void generate() {
+ int i0, i1, i2, i3;
+ i0 = s15.Length;
+ s1 = "";
+ i1 = 0;
+ do {
+ i2 = 0;
+ foreach (int offset in offsets) {
+ i3 = (offset + i0 + i1) % i0;
+ if (s15.Substring(i3, 1) == "*")
+ i2++;
+ }
+ if (s15.Substring(i1, 1) == "*") {
+ if (i2 < 2 || i2 > 3) {
+ s1 += " ";
+ } else {
+ s1 += "*";
+ }
+ } else {
+ if (i2 == 3) {
+ s1 += "*";
+ } else {
+ s1 += "*";
+ }
+ }
+ } while (++i1 < i0);
+ s15 = s1;
+}
+static void dump() {
+ ;
+}
+}
+
diff --git a/mono/benchmark/test-driver b/mono/benchmark/test-driver
new file mode 100755
index 00000000000..b62810db1d9
--- /dev/null
+++ b/mono/benchmark/test-driver
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -w
+
+my $interpreter = shift;
+my $test = shift;
+my $output = $test;
+my $stdout = $test.'.stdout';
+my $stderr = $test.'.stderr';
+
+$output =~ s/\.exe$/.output/;
+
+$| = 0;
+print "Testing $test... ";
+
+for ($c = 20 - length ($test); $c > 0; $c--) { print " "; }
+
+my $res = system("/usr/bin/time -o .res -f '%U' $interpreter $test 2>/dev/null 1>$stdout");
+
+if ($res) {
+ printf ("failed $? (%d) signal (%d).\n", $? >> 8, $? & 127);
+ exit (1);
+} elsif (-f $output) {
+ print "failed output.\n" if (read_file ($output) ne read_file ($stdout));
+ exit (1);
+} else {
+ $t = `cat .res`;
+ $t =~ s/\n//;
+ print "pass. $t\n";
+ #unlink ($result);
+}
+exit (0);
+
+sub read_file {
+ local ($/);
+ my $out = shift;
+ open (F, "<$out") || die $!;
+ $out = <F>;
+ close(F);
+ return $out;
+}
diff --git a/mono/cil/.cvsignore b/mono/cil/.cvsignore
new file mode 100644
index 00000000000..10dae49ad16
--- /dev/null
+++ b/mono/cil/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+opcode.def
diff --git a/mono/cil/ChangeLog b/mono/cil/ChangeLog
new file mode 100644
index 00000000000..8d7c0a09b8f
--- /dev/null
+++ b/mono/cil/ChangeLog
@@ -0,0 +1,25 @@
+
+Wed Sep 5 15:54:47 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * opcode.def: cvs add to reduce build dependencies for
+ people using the snapshots or cvs.
+
+Wed Jul 11 18:50:12 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * cil-opcodes.xml: change duplicate unused entry.
+
+Mon Jul 2 15:31:31 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * cil-opcodes.xml: use a more proper XML format (single root tag).
+ * make-opcodes-def.pl: use XML::Parser, remove debugging print that
+ broke compilation, corrected opcode byte len.
+
+2001-07-01 Miguel de Icaza <miguel@ximian.com>
+
+ * cil-opcodes.xml: New file that describes the CIL opcodes in
+ XML format.
+
+ * make-opcodes-def.pl: Perl script that parses the above file and
+ generates a Annex V/C.2 compliant opcode.def file.
+
+
diff --git a/mono/cil/Makefile.am b/mono/cil/Makefile.am
new file mode 100644
index 00000000000..12141fc56fb
--- /dev/null
+++ b/mono/cil/Makefile.am
@@ -0,0 +1,12 @@
+
+opcode.def: make-opcodes-def.pl cil-opcodes.xml
+ perl make-opcodes-def.pl < $(srcdir)/cil-opcodes.xml > opcode.def
+
+defdir = $(includedir)/mono/cil
+def_DATA = opcode.def
+
+xmldir = $(datadir)/mono/cil
+xml_DATA = cil-opcodes.xml
+
+EXTRA_DIST=opcode.def make-opcodes-def.pl make-opcode-def.xsl $(xml_DATA) $(def_DATA)
+
diff --git a/mono/cil/TODO b/mono/cil/TODO
new file mode 100644
index 00000000000..6175693d3f6
--- /dev/null
+++ b/mono/cil/TODO
@@ -0,0 +1,3 @@
+* Replace make-opcodes-def.pl with XLST process
+
+ We should use an XSLT file to do the conversion there.
diff --git a/mono/cil/cil-opcodes.xml b/mono/cil/cil-opcodes.xml
new file mode 100644
index 00000000000..dfd5fb106cb
--- /dev/null
+++ b/mono/cil/cil-opcodes.xml
@@ -0,0 +1,297 @@
+<opdesc>
+<opcode name="nop" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0x00" flow="next"/>
+<opcode name="break" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0x01" flow="break"/>
+<opcode name="ldarg.0" input="Pop0" output="Push1" args="InlineNone" o1="0xFF" o2="0x02" flow="next"/>
+<opcode name="ldarg.1" input="Pop0" output="Push1" args="InlineNone" o1="0xFF" o2="0x03" flow="next"/>
+<opcode name="ldarg.2" input="Pop0" output="Push1" args="InlineNone" o1="0xFF" o2="0x04" flow="next"/>
+<opcode name="ldarg.3" input="Pop0" output="Push1" args="InlineNone" o1="0xFF" o2="0x05" flow="next"/>
+<opcode name="ldloc.0" input="Pop0" output="Push1" args="InlineNone" o1="0xFF" o2="0x06" flow="next"/>
+<opcode name="ldloc.1" input="Pop0" output="Push1" args="InlineNone" o1="0xFF" o2="0x07" flow="next"/>
+<opcode name="ldloc.2" input="Pop0" output="Push1" args="InlineNone" o1="0xFF" o2="0x08" flow="next"/>
+<opcode name="ldloc.3" input="Pop0" output="Push1" args="InlineNone" o1="0xFF" o2="0x09" flow="next"/>
+<opcode name="stloc.0" input="Pop1" output="Push0" args="InlineNone" o1="0xFF" o2="0x0A" flow="next"/>
+<opcode name="stloc.1" input="Pop1" output="Push0" args="InlineNone" o1="0xFF" o2="0x0B" flow="next"/>
+<opcode name="stloc.2" input="Pop1" output="Push0" args="InlineNone" o1="0xFF" o2="0x0C" flow="next"/>
+<opcode name="stloc.3" input="Pop1" output="Push0" args="InlineNone" o1="0xFF" o2="0x0D" flow="next"/>
+<opcode name="ldarg.s" input="Pop0" output="Push1" args="ShortInlineVar" o1="0xFF" o2="0x0E" flow="next"/>
+<opcode name="ldarga.s" input="Pop0" output="PushI" args="ShortInlineVar" o1="0xFF" o2="0x0F" flow="next"/>
+<opcode name="starg.s" input="Pop1" output="Push0" args="ShortInlineVar" o1="0xFF" o2="0x10" flow="next"/>
+<opcode name="ldloc.s" input="Pop0" output="Push1" args="ShortInlineVar" o1="0xFF" o2="0x11" flow="next"/>
+<opcode name="ldloca.s" input="Pop0" output="PushI" args="ShortInlineVar" o1="0xFF" o2="0x12" flow="next"/>
+<opcode name="stloc.s" input="Pop1" output="Push0" args="ShortInlineVar" o1="0xFF" o2="0x13" flow="next"/>
+<opcode name="ldnull" input="Pop0" output="PushRef" args="InlineNone" o1="0xFF" o2="0x14" flow="next"/>
+<opcode name="ldc.i4.m1" input="Pop0" output="PushI" args="InlineNone" o1="0xFF" o2="0x15" flow="next"/>
+<opcode name="ldc.i4.0" input="Pop0" output="PushI" args="InlineNone" o1="0xFF" o2="0x16" flow="next"/>
+<opcode name="ldc.i4.1" input="Pop0" output="PushI" args="InlineNone" o1="0xFF" o2="0x17" flow="next"/>
+<opcode name="ldc.i4.2" input="Pop0" output="PushI" args="InlineNone" o1="0xFF" o2="0x18" flow="next"/>
+<opcode name="ldc.i4.3" input="Pop0" output="PushI" args="InlineNone" o1="0xFF" o2="0x19" flow="next"/>
+<opcode name="ldc.i4.4" input="Pop0" output="PushI" args="InlineNone" o1="0xFF" o2="0x1A" flow="next"/>
+<opcode name="ldc.i4.5" input="Pop0" output="PushI" args="InlineNone" o1="0xFF" o2="0x1B" flow="next"/>
+<opcode name="ldc.i4.6" input="Pop0" output="PushI" args="InlineNone" o1="0xFF" o2="0x1C" flow="next"/>
+<opcode name="ldc.i4.7" input="Pop0" output="PushI" args="InlineNone" o1="0xFF" o2="0x1D" flow="next"/>
+<opcode name="ldc.i4.8" input="Pop0" output="PushI" args="InlineNone" o1="0xFF" o2="0x1E" flow="next"/>
+<opcode name="ldc.i4.s" input="Pop0" output="PushI" args="ShortInlineI" o1="0xFF" o2="0x1F" flow="next"/>
+<opcode name="ldc.i4" input="Pop0" output="PushI" args="InlineI" o1="0xFF" o2="0x20" flow="next"/>
+<opcode name="ldc.i8" input="Pop0" output="PushI8" args="InlineI8" o1="0xFF" o2="0x21" flow="next"/>
+<opcode name="ldc.r4" input="Pop0" output="PushR4" args="ShortInlineR" o1="0xFF" o2="0x22" flow="next"/>
+<opcode name="ldc.r8" input="Pop0" output="PushR8" args="InlineR" o1="0xFF" o2="0x23" flow="next"/>
+<opcode name="unused99" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0x24" flow="next"/>
+<opcode name="dup" input="Pop1" output="Push1+Push1" args="InlineNone" o1="0xFF" o2="0x25" flow="next"/>
+<opcode name="pop" input="Pop1" output="Push0" args="InlineNone" o1="0xFF" o2="0x26" flow="next"/>
+<opcode name="jmp" input="Pop0" output="Push0" args="InlineMethod" o1="0xFF" o2="0x27" flow="call"/>
+<opcode name="call" input="VarPop" output="VarPush" args="InlineMethod" o1="0xFF" o2="0x28" flow="call"/>
+<opcode name="calli" input="VarPop" output="VarPush" args="InlineSig" o1="0xFF" o2="0x29" flow="call"/>
+<opcode name="ret" input="VarPop" output="Push0" args="InlineNone" o1="0xFF" o2="0x2A" flow="return"/>
+<opcode name="br.s" input="Pop0" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x2B" flow="branch"/>
+<opcode name="brfalse.s" input="PopI" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x2C" flow="cond-branch"/>
+<opcode name="brtrue.s" input="PopI" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x2D" flow="cond-branch"/>
+<opcode name="beq.s" input="Pop1+Pop1" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x2E" flow="cond-branch"/>
+<opcode name="bge.s" input="Pop1+Pop1" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x2F" flow="cond-branch"/>
+<opcode name="bgt.s" input="Pop1+Pop1" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x30" flow="cond-branch"/>
+<opcode name="ble.s" input="Pop1+Pop1" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x31" flow="cond-branch"/>
+<opcode name="blt.s" input="Pop1+Pop1" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x32" flow="cond-branch"/>
+<opcode name="bne.un.s" input="Pop1+Pop1" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x33" flow="cond-branch"/>
+<opcode name="bge.un.s" input="Pop1+Pop1" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x34" flow="cond-branch"/>
+<opcode name="bgt.un.s" input="Pop1+Pop1" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x35" flow="cond-branch"/>
+<opcode name="ble.un.s" input="Pop1+Pop1" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x36" flow="cond-branch"/>
+<opcode name="blt.un.s" input="Pop1+Pop1" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0x37" flow="cond-branch"/>
+<opcode name="br" input="Pop0" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x38" flow="branch"/>
+<opcode name="brfalse" input="PopI" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x39" flow="cond-branch"/>
+<opcode name="brtrue" input="PopI" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x3A" flow="cond-branch"/>
+<opcode name="beq" input="Pop1+Pop1" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x3B" flow="cond-branch"/>
+<opcode name="bge" input="Pop1+Pop1" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x3C" flow="cond-branch"/>
+<opcode name="bgt" input="Pop1+Pop1" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x3D" flow="cond-branch"/>
+<opcode name="ble" input="Pop1+Pop1" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x3E" flow="cond-branch"/>
+<opcode name="blt" input="Pop1+Pop1" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x3F" flow="cond-branch"/>
+<opcode name="bne.un" input="Pop1+Pop1" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x40" flow="cond-branch"/>
+<opcode name="bge.un" input="Pop1+Pop1" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x41" flow="cond-branch"/>
+<opcode name="bgt.un" input="Pop1+Pop1" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x42" flow="cond-branch"/>
+<opcode name="ble.un" input="Pop1+Pop1" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x43" flow="cond-branch"/>
+<opcode name="blt.un" input="Pop1+Pop1" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0x44" flow="cond-branch"/>
+<opcode name="switch" input="PopI" output="Push0" args="InlineSwitch" o1="0xFF" o2="0x45" flow="cond-branch"/>
+<opcode name="ldind.i1" input="PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x46" flow="next"/>
+<opcode name="ldind.u1" input="PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x47" flow="next"/>
+<opcode name="ldind.i2" input="PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x48" flow="next"/>
+<opcode name="ldind.u2" input="PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x49" flow="next"/>
+<opcode name="ldind.i4" input="PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x4A" flow="next"/>
+<opcode name="ldind.u4" input="PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x4B" flow="next"/>
+<opcode name="ldind.i8" input="PopI" output="PushI8" args="InlineNone" o1="0xFF" o2="0x4C" flow="next"/>
+<opcode name="ldind.i" input="PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x4D" flow="next"/>
+<opcode name="ldind.r4" input="PopI" output="PushR4" args="InlineNone" o1="0xFF" o2="0x4E" flow="next"/>
+<opcode name="ldind.r8" input="PopI" output="PushR8" args="InlineNone" o1="0xFF" o2="0x4F" flow="next"/>
+<opcode name="ldind.ref" input="PopI" output="PushRef" args="InlineNone" o1="0xFF" o2="0x50" flow="next"/>
+<opcode name="stind.ref" input="PopI+PopI" output="Push0" args="InlineNone" o1="0xFF" o2="0x51" flow="next"/>
+<opcode name="stind.i1" input="PopI+PopI" output="Push0" args="InlineNone" o1="0xFF" o2="0x52" flow="next"/>
+<opcode name="stind.i2" input="PopI+PopI" output="Push0" args="InlineNone" o1="0xFF" o2="0x53" flow="next"/>
+<opcode name="stind.i4" input="PopI+PopI" output="Push0" args="InlineNone" o1="0xFF" o2="0x54" flow="next"/>
+<opcode name="stind.i8" input="PopI+PopI8" output="Push0" args="InlineNone" o1="0xFF" o2="0x55" flow="next"/>
+<opcode name="stind.r4" input="PopI+PopR4" output="Push0" args="InlineNone" o1="0xFF" o2="0x56" flow="next"/>
+<opcode name="stind.r8" input="PopI+PopR8" output="Push0" args="InlineNone" o1="0xFF" o2="0x57" flow="next"/>
+<opcode name="add" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x58" flow="next"/>
+<opcode name="sub" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x59" flow="next"/>
+<opcode name="mul" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x5A" flow="next"/>
+<opcode name="div" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x5B" flow="next"/>
+<opcode name="div.un" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x5C" flow="next"/>
+<opcode name="rem" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x5D" flow="next"/>
+<opcode name="rem.un" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x5E" flow="next"/>
+<opcode name="and" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x5F" flow="next"/>
+<opcode name="or" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x60" flow="next"/>
+<opcode name="xor" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x61" flow="next"/>
+<opcode name="shl" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x62" flow="next"/>
+<opcode name="shr" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x63" flow="next"/>
+<opcode name="shr.un" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x64" flow="next"/>
+<opcode name="neg" input="Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x65" flow="next"/>
+<opcode name="not" input="Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0x66" flow="next"/>
+<opcode name="conv.i1" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x67" flow="next"/>
+<opcode name="conv.i2" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x68" flow="next"/>
+<opcode name="conv.i4" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x69" flow="next"/>
+<opcode name="conv.i8" input="Pop1" output="PushI8" args="InlineNone" o1="0xFF" o2="0x6A" flow="next"/>
+<opcode name="conv.r4" input="Pop1" output="PushR4" args="InlineNone" o1="0xFF" o2="0x6B" flow="next"/>
+<opcode name="conv.r8" input="Pop1" output="PushR8" args="InlineNone" o1="0xFF" o2="0x6C" flow="next"/>
+<opcode name="conv.u4" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x6D" flow="next"/>
+<opcode name="conv.u8" input="Pop1" output="PushI8" args="InlineNone" o1="0xFF" o2="0x6E" flow="next"/>
+<opcode name="callvirt" input="VarPop" output="VarPush" args="InlineMethod" o1="0xFF" o2="0x6F" flow="call"/>
+<opcode name="cpobj" input="PopI+PopI" output="Push0" args="InlineType" o1="0xFF" o2="0x70" flow="next"/>
+<opcode name="ldobj" input="PopI" output="Push1" args="InlineType" o1="0xFF" o2="0x71" flow="next"/>
+<opcode name="ldstr" input="Pop0" output="PushRef" args="InlineString" o1="0xFF" o2="0x72" flow="next"/>
+<opcode name="newobj" input="VarPop" output="PushRef" args="InlineMethod" o1="0xFF" o2="0x73" flow="call"/>
+<opcode name="castclass" input="PopRef" output="PushRef" args="InlineType" o1="0xFF" o2="0x74" flow="next"/>
+<opcode name="isinst" input="PopRef" output="PushI" args="InlineType" o1="0xFF" o2="0x75" flow="next"/>
+<opcode name="conv.r.un" input="Pop1" output="PushR8" args="InlineNone" o1="0xFF" o2="0x76" flow="next"/>
+<opcode name="unused58" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0x77" flow="next"/>
+<opcode name="unused1" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0x78" flow="next"/>
+<opcode name="unbox" input="PopRef" output="PushI" args="InlineType" o1="0xFF" o2="0x79" flow="next"/>
+<opcode name="throw" input="PopRef" output="Push0" args="InlineNone" o1="0xFF" o2="0x7A" flow="throw"/>
+<opcode name="ldfld" input="PopRef" output="Push1" args="InlineField" o1="0xFF" o2="0x7B" flow="next"/>
+<opcode name="ldflda" input="PopRef" output="PushI" args="InlineField" o1="0xFF" o2="0x7C" flow="next"/>
+<opcode name="stfld" input="PopRef+Pop1" output="Push0" args="InlineField" o1="0xFF" o2="0x7D" flow="next"/>
+<opcode name="ldsfld" input="Pop0" output="Push1" args="InlineField" o1="0xFF" o2="0x7E" flow="next"/>
+<opcode name="ldsflda" input="Pop0" output="PushI" args="InlineField" o1="0xFF" o2="0x7F" flow="next"/>
+<opcode name="stsfld" input="Pop1" output="Push0" args="InlineField" o1="0xFF" o2="0x80" flow="next"/>
+<opcode name="stobj" input="PopI+Pop1" output="Push0" args="InlineType" o1="0xFF" o2="0x81" flow="next"/>
+<opcode name="conv.ovf.i1.un" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x82" flow="next"/>
+<opcode name="conv.ovf.i2.un" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x83" flow="next"/>
+<opcode name="conv.ovf.i4.un" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x84" flow="next"/>
+<opcode name="conv.ovf.i8.un" input="Pop1" output="PushI8" args="InlineNone" o1="0xFF" o2="0x85" flow="next"/>
+<opcode name="conv.ovf.u1.un" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x86" flow="next"/>
+<opcode name="conv.ovf.u2.un" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x87" flow="next"/>
+<opcode name="conv.ovf.u4.un" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x88" flow="next"/>
+<opcode name="conv.ovf.u8.un" input="Pop1" output="PushI8" args="InlineNone" o1="0xFF" o2="0x89" flow="next"/>
+<opcode name="conv.ovf.i.un" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x8A" flow="next"/>
+<opcode name="conv.ovf.u.un" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0x8B" flow="next"/>
+<opcode name="box" input="Pop1" output="PushRef" args="InlineType" o1="0xFF" o2="0x8C" flow="next"/>
+<opcode name="newarr" input="PopI" output="PushRef" args="InlineType" o1="0xFF" o2="0x8D" flow="next"/>
+<opcode name="ldlen" input="PopRef" output="PushI" args="InlineNone" o1="0xFF" o2="0x8E" flow="next"/>
+<opcode name="ldelema" input="PopRef+PopI" output="PushI" args="InlineType" o1="0xFF" o2="0x8F" flow="next"/>
+<opcode name="ldelem.i1" input="PopRef+PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x90" flow="next"/>
+<opcode name="ldelem.u1" input="PopRef+PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x91" flow="next"/>
+<opcode name="ldelem.i2" input="PopRef+PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x92" flow="next"/>
+<opcode name="ldelem.u2" input="PopRef+PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x93" flow="next"/>
+<opcode name="ldelem.i4" input="PopRef+PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x94" flow="next"/>
+<opcode name="ldelem.u4" input="PopRef+PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x95" flow="next"/>
+<opcode name="ldelem.i8" input="PopRef+PopI" output="PushI8" args="InlineNone" o1="0xFF" o2="0x96" flow="next"/>
+<opcode name="ldelem.i" input="PopRef+PopI" output="PushI" args="InlineNone" o1="0xFF" o2="0x97" flow="next"/>
+<opcode name="ldelem.r4" input="PopRef+PopI" output="PushR4" args="InlineNone" o1="0xFF" o2="0x98" flow="next"/>
+<opcode name="ldelem.r8" input="PopRef+PopI" output="PushR8" args="InlineNone" o1="0xFF" o2="0x99" flow="next"/>
+<opcode name="ldelem.ref" input="PopRef+PopI" output="PushRef" args="InlineNone" o1="0xFF" o2="0x9A" flow="next"/>
+<opcode name="stelem.i" input="PopRef+PopI+PopI" output="Push0" args="InlineNone" o1="0xFF" o2="0x9B" flow="next"/>
+<opcode name="stelem.i1" input="PopRef+PopI+PopI" output="Push0" args="InlineNone" o1="0xFF" o2="0x9C" flow="next"/>
+<opcode name="stelem.i2" input="PopRef+PopI+PopI" output="Push0" args="InlineNone" o1="0xFF" o2="0x9D" flow="next"/>
+<opcode name="stelem.i4" input="PopRef+PopI+PopI" output="Push0" args="InlineNone" o1="0xFF" o2="0x9E" flow="next"/>
+<opcode name="stelem.i8" input="PopRef+PopI+PopI8" output="Push0" args="InlineNone" o1="0xFF" o2="0x9F" flow="next"/>
+<opcode name="stelem.r4" input="PopRef+PopI+PopR4" output="Push0" args="InlineNone" o1="0xFF" o2="0xA0" flow="next"/>
+<opcode name="stelem.r8" input="PopRef+PopI+PopR8" output="Push0" args="InlineNone" o1="0xFF" o2="0xA1" flow="next"/>
+<opcode name="stelem.ref" input="PopRef+PopI+PopRef" output="Push0" args="InlineNone" o1="0xFF" o2="0xA2" flow="next"/>
+<opcode name="unused2" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xA3" flow="next"/>
+<opcode name="unused3" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xA4" flow="next"/>
+<opcode name="unused4" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xA5" flow="next"/>
+<opcode name="unused5" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xA6" flow="next"/>
+<opcode name="unused6" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xA7" flow="next"/>
+<opcode name="unused7" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xA8" flow="next"/>
+<opcode name="unused8" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xA9" flow="next"/>
+<opcode name="unused9" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xAA" flow="next"/>
+<opcode name="unused10" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xAB" flow="next"/>
+<opcode name="unused11" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xAC" flow="next"/>
+<opcode name="unused12" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xAD" flow="next"/>
+<opcode name="unused13" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xAE" flow="next"/>
+<opcode name="unused14" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xAF" flow="next"/>
+<opcode name="unused15" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xB0" flow="next"/>
+<opcode name="unused16" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xB1" flow="next"/>
+<opcode name="unused17" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xB2" flow="next"/>
+<opcode name="conv.ovf.i1" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xB3" flow="next"/>
+<opcode name="conv.ovf.u1" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xB4" flow="next"/>
+<opcode name="conv.ovf.i2" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xB5" flow="next"/>
+<opcode name="conv.ovf.u2" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xB6" flow="next"/>
+<opcode name="conv.ovf.i4" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xB7" flow="next"/>
+<opcode name="conv.ovf.u4" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xB8" flow="next"/>
+<opcode name="conv.ovf.i8" input="Pop1" output="PushI8" args="InlineNone" o1="0xFF" o2="0xB9" flow="next"/>
+<opcode name="conv.ovf.u8" input="Pop1" output="PushI8" args="InlineNone" o1="0xFF" o2="0xBA" flow="next"/>
+<opcode name="unused50" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xBB" flow="next"/>
+<opcode name="unused18" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xBC" flow="next"/>
+<opcode name="unused19" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xBD" flow="next"/>
+<opcode name="unused20" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xBE" flow="next"/>
+<opcode name="unused21" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xBF" flow="next"/>
+<opcode name="unused22" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xC0" flow="next"/>
+<opcode name="unused23" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xC1" flow="next"/>
+<opcode name="refanyval" input="Pop1" output="PushI" args="InlineType" o1="0xFF" o2="0xC2" flow="next"/>
+<opcode name="ckfinite" input="Pop1" output="PushR8" args="InlineNone" o1="0xFF" o2="0xC3" flow="next"/>
+<opcode name="unused24" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xC4" flow="next"/>
+<opcode name="unused25" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xC5" flow="next"/>
+<opcode name="mkrefany" input="PopI" output="Push1" args="InlineType" o1="0xFF" o2="0xC6" flow="next"/>
+<opcode name="unused59" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xC7" flow="next"/>
+<opcode name="unused60" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xC8" flow="next"/>
+<opcode name="unused61" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xC9" flow="next"/>
+<opcode name="unused62" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xCA" flow="next"/>
+<opcode name="unused63" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xCB" flow="next"/>
+<opcode name="unused64" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xCC" flow="next"/>
+<opcode name="unused65" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xCD" flow="next"/>
+<opcode name="unused66" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xCE" flow="next"/>
+<opcode name="unused67" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xCF" flow="next"/>
+<opcode name="ldtoken" input="Pop0" output="PushI" args="InlineTok" o1="0xFF" o2="0xD0" flow="next"/>
+<opcode name="conv.u2" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xD1" flow="next"/>
+<opcode name="conv.u1" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xD2" flow="next"/>
+<opcode name="conv.i" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xD3" flow="next"/>
+<opcode name="conv.ovf.i" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xD4" flow="next"/>
+<opcode name="conv.ovf.u" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xD5" flow="next"/>
+<opcode name="add.ovf" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0xD6" flow="next"/>
+<opcode name="add.ovf.un" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0xD7" flow="next"/>
+<opcode name="mul.ovf" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0xD8" flow="next"/>
+<opcode name="mul.ovf.un" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0xD9" flow="next"/>
+<opcode name="sub.ovf" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0xDA" flow="next"/>
+<opcode name="sub.ovf.un" input="Pop1+Pop1" output="Push1" args="InlineNone" o1="0xFF" o2="0xDB" flow="next"/>
+<opcode name="endfinally" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xDC" flow="return"/>
+<opcode name="leave" input="Pop0" output="Push0" args="InlineBrTarget" o1="0xFF" o2="0xDD" flow="branch"/>
+<opcode name="leave.s" input="Pop0" output="Push0" args="ShortInlineBrTarget" o1="0xFF" o2="0xDE" flow="branch"/>
+<opcode name="stind.i" input="PopI+PopI" output="Push0" args="InlineNone" o1="0xFF" o2="0xDF" flow="next"/>
+<opcode name="conv.u" input="Pop1" output="PushI" args="InlineNone" o1="0xFF" o2="0xE0" flow="next"/>
+<opcode name="unused26" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xE1" flow="next"/>
+<opcode name="unused27" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xE2" flow="next"/>
+<opcode name="unused28" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xE3" flow="next"/>
+<opcode name="unused29" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xE4" flow="next"/>
+<opcode name="unused30" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xE5" flow="next"/>
+<opcode name="unused31" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xE6" flow="next"/>
+<opcode name="unused32" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xE7" flow="next"/>
+<opcode name="unused33" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xE8" flow="next"/>
+<opcode name="unused34" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xE9" flow="next"/>
+<opcode name="unused35" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xEA" flow="next"/>
+<opcode name="unused36" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xEB" flow="next"/>
+<opcode name="unused37" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xEC" flow="next"/>
+<opcode name="unused38" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xED" flow="next"/>
+<opcode name="unused39" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xEE" flow="next"/>
+<opcode name="unused40" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xEF" flow="next"/>
+<opcode name="unused41" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xF0" flow="next"/>
+<opcode name="unused42" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xF1" flow="next"/>
+<opcode name="unused43" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xF2" flow="next"/>
+<opcode name="unused44" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xF3" flow="next"/>
+<opcode name="unused45" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xF4" flow="next"/>
+<opcode name="unused46" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xF5" flow="next"/>
+<opcode name="unused47" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xF6" flow="next"/>
+<opcode name="unused48" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xF7" flow="next"/>
+<opcode name="prefix7" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xF8" flow="meta"/>
+<opcode name="prefix6" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xF9" flow="meta"/>
+<opcode name="prefix5" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xFA" flow="meta"/>
+<opcode name="prefix4" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xFB" flow="meta"/>
+<opcode name="prefix3" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xFC" flow="meta"/>
+<opcode name="prefix2" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xFD" flow="meta"/>
+<opcode name="prefix1" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xFE" flow="meta"/>
+<opcode name="prefixref" input="Pop0" output="Push0" args="InlineNone" o1="0xFF" o2="0xFF" flow="meta"/>
+<opcode name="arglist" input="Pop0" output="PushI" args="InlineNone" o1="0xFE" o2="0x00" flow="next"/>
+<opcode name="ceq" input="Pop1+Pop1" output="PushI" args="InlineNone" o1="0xFE" o2="0x01" flow="next"/>
+<opcode name="cgt" input="Pop1+Pop1" output="PushI" args="InlineNone" o1="0xFE" o2="0x02" flow="next"/>
+<opcode name="cgt.un" input="Pop1+Pop1" output="PushI" args="InlineNone" o1="0xFE" o2="0x03" flow="next"/>
+<opcode name="clt" input="Pop1+Pop1" output="PushI" args="InlineNone" o1="0xFE" o2="0x04" flow="next"/>
+<opcode name="clt.un" input="Pop1+Pop1" output="PushI" args="InlineNone" o1="0xFE" o2="0x05" flow="next"/>
+<opcode name="ldftn" input="Pop0" output="PushI" args="InlineMethod" o1="0xFE" o2="0x06" flow="next"/>
+<opcode name="ldvirtftn" input="PopRef" output="PushI" args="InlineMethod" o1="0xFE" o2="0x07" flow="next"/>
+<opcode name="unused56" input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x08" flow="next"/>
+<opcode name="ldarg" input="Pop0" output="Push1" args="InlineVar" o1="0xFE" o2="0x09" flow="next"/>
+<opcode name="ldarga" input="Pop0" output="PushI" args="InlineVar" o1="0xFE" o2="0x0A" flow="next"/>
+<opcode name="starg" input="Pop1" output="Push0" args="InlineVar" o1="0xFE" o2="0x0B" flow="next"/>
+<opcode name="ldloc" input="Pop0" output="Push1" args="InlineVar" o1="0xFE" o2="0x0C" flow="next"/>
+<opcode name="ldloca" input="Pop0" output="PushI" args="InlineVar" o1="0xFE" o2="0x0D" flow="next"/>
+<opcode name="stloc" input="Pop1" output="Push0" args="InlineVar" o1="0xFE" o2="0x0E" flow="next"/>
+<opcode name="localloc" input="PopI" output="PushI" args="InlineNone" o1="0xFE" o2="0x0F" flow="next"/>
+<opcode name="unused57" input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x10" flow="next"/>
+<opcode name="endfilter" input="PopI" output="Push0" args="InlineNone" o1="0xFE" o2="0x11" flow="return"/>
+<opcode name="unaligned." input="Pop0" output="Push0" args="ShortInlineI" o1="0xFE" o2="0x12" flow="meta"/>
+<opcode name="volatile." input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x13" flow="meta"/>
+<opcode name="tail." input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x14" flow="meta"/>
+<opcode name="initobj" input="PopI" output="Push0" args="InlineType" o1="0xFE" o2="0x15" flow="next"/>
+<opcode name="unused68" input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x16" flow="next"/>
+<opcode name="cpblk" input="PopI+PopI+PopI" output="Push0" args="InlineNone" o1="0xFE" o2="0x17" flow="next"/>
+<opcode name="initblk" input="PopI+PopI+PopI" output="Push0" args="InlineNone" o1="0xFE" o2="0x18" flow="next"/>
+<opcode name="unused69" input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x19" flow="next"/>
+<opcode name="rethrow" input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x1A" flow="throw"/>
+<opcode name="unused" input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x1B" flow="next"/>
+<opcode name="sizeof" input="Pop0" output="PushI" args="InlineType" o1="0xFE" o2="0x1C" flow="next"/>
+<opcode name="refanytype" input="Pop1" output="PushI" args="InlineNone" o1="0xFE" o2="0x1D" flow="next"/>
+<opcode name="unused52" input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x1E" flow="next"/>
+<opcode name="unused53" input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x1F" flow="next"/>
+<opcode name="unused54" input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x20" flow="next"/>
+<opcode name="unused55" input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x21" flow="next"/>
+<opcode name="unused70" input="Pop0" output="Push0" args="InlineNone" o1="0xFE" o2="0x22" flow="next"/>
+<opcode name="illegal" input="Pop0" output="Push0" args="InlineNone" o1="0x00" o2="0x00" flow="meta"/>
+<opcode name="endmac" input="Pop0" output="Push0" args="InlineNone" o1="0x00" o2="0x00" flow="meta"/>
+
+
+</opdesc>
diff --git a/mono/cil/make-opcode-def.xsl b/mono/cil/make-opcode-def.xsl
new file mode 100644
index 00000000000..9ad799f4ba9
--- /dev/null
+++ b/mono/cil/make-opcode-def.xsl
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+
+<!--
+ | make-opcode-def.xsl: Translates opcodes from the CIL-opcodes.xml into
+ | a spec compliant opcodes.def file
+ | Converted to XSLT from make-opcodes-def.pl
+ |
+ | See: Common Language Infrastructure (CLI) Part 5: Annexes
+ |
+ | Author: Sergey Chaban
+ |
+ | $Id: make-opcode-def.xsl,v 1.1 2001/07/13 01:04:23 miguel Exp $
+ -->
+
+
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+
+
+<xsl:output method="text"/>
+
+
+<xsl:template match="/">
+ <xsl:apply-templates/>
+ <xsl:call-template name="print-trailer"/>
+</xsl:template>
+
+<xsl:template name="to-upper">
+ <xsl:param name="string"/>
+ <xsl:value-of select="translate($string,
+ 'abcdefghijklmnopqrstuvwxyz.-',
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ__')"/>
+</xsl:template>
+
+
+<xsl:template name="get-flow">
+ <xsl:param name="flow" select="@flow"/>
+ <xsl:choose>
+ <xsl:when
+ test="contains('next call return branch meta cond-branch',$flow)">
+ <xsl:call-template name="to-upper">
+ <xsl:with-param name="string" select="$flow"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="'ERROR'"/></xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="opdesc/opcode">
+ <xsl:variable name="uname">
+ <xsl:call-template name="to-upper">
+ <xsl:with-param name="string" select="@name"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="o1">
+ <xsl:call-template name="to-upper">
+ <xsl:with-param name="string" select="@o1"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="f">
+ <xsl:call-template name="get-flow"/>
+ </xsl:variable>
+ <xsl:variable name="count"
+ select="number(not(contains($o1,'FF')))+1"/>OPDEF(CEE_<xsl:value-of
+ select="concat($uname,', &#x22;',@name,'&#x22;, ',
+ @input,', ',@output,', ',@args,', X, ',
+ $count,', ',@o1,', ',@o2,', ',$f
+ )"/>)
+</xsl:template>
+
+
+<xsl:template name="print-trailer">
+#ifndef OPALIAS
+#define _MONO_CIL_OPALIAS_DEFINED_
+#define OPALIAS(a,s,r)
+#endif
+
+OPALIAS(CEE_BRNULL, "brnull", CEE_BRFALSE)
+OPALIAS(CEE_BRNULL_S, "brnull.s", CEE_BRFALSE_S)
+OPALIAS(CEE_BRZERO, "brzero", CEE_BRFALSE)
+OPALIAS(CEE_BRZERO_S, "brzero.s", CEE_BRFALSE_S)
+OPALIAS(CEE_BRINST, "brinst", CEE_BRTRUE)
+OPALIAS(CEE_BRINST_S, "brinst.s", CEE_BRTRUE_S)
+OPALIAS(CEE_LDIND_U8, "ldind.u8", CEE_LDIND_I8)
+OPALIAS(CEE_LDELEM_U8, "ldelem.u8", CEE_LDELEM_I8)
+OPALIAS(CEE_LDX_I4_MIX, "ldc.i4.M1", CEE_LDC_I4_M1)
+OPALIAS(CEE_ENDFAULT, "endfault", CEE_ENDFINALLY)
+
+#ifdef _MONO_CIL_OPALIAS_DEFINED_
+#undef OPALIAS
+#undef _MONO_CIL_OPALIAS_DEFINED_
+#endif
+</xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/mono/cil/make-opcodes-def.pl b/mono/cil/make-opcodes-def.pl
new file mode 100644
index 00000000000..3114918bb65
--- /dev/null
+++ b/mono/cil/make-opcodes-def.pl
@@ -0,0 +1,80 @@
+#!/usr/bin/perl
+#
+# make-opcodes-def.pl: Loads the opcodes from the CIL-opcodes.xml and
+# generates a spec compliant opcodes.def file
+#
+# Author:
+# Miguel de Icaza (miguel@ximian.com)
+#
+# (C) 2001 Ximian, Inc.
+#
+# We should really be doing this with XSLT, but I know nothing about XSLT
+# ;-)
+# or maybe just an XML::Parser... - lupus
+
+use strict;
+use XML::Parser;
+
+my %valid_flow;
+# the XML file also includes "throw"
+@valid_flow{qw(next call return branch meta cond-branch)} = ();
+
+open OUTPUT, ">opcode.def" || die "Can not create opcode.def file: $!";
+
+my $parser = new XML::Parser (Handlers => {Start => \&handle_opcode});
+$parser->parsefile("cil-opcodes.xml");
+print_trailer();
+close(OUTPUT) || die "Can not close file: $!";
+
+sub handle_opcode {
+ my ($parser, $elem, %attrs) = @_;
+ my ($name, $input, $output, $args, $o1, $o2, $flow, $uname, $count, $ff);
+
+ return if ($elem ne 'opcode');
+
+ ($name, $input, $output, $args, $o1, $o2, $flow) =
+ @attrs{qw(name input output args o1 o2 flow)};
+
+ $uname = uc $name;
+ $uname =~ tr/./_/;
+ if (hex($o1) == 0xff){
+ $count = 1;
+ } else {
+ $count = 2;
+ }
+
+ $ff = "ERROR";
+ if (exists $valid_flow{$flow}) {
+ $ff = uc $flow;
+ $ff =~ tr/-/_/;
+ }
+
+ print OUTPUT "OPDEF(CEE_$uname, \"$name\", $input, $output, $args, X, $count, $o1, $o2, $ff)\n";
+
+}
+
+sub print_trailer {
+print OUTPUT<<EOF;
+#ifndef OPALIAS
+#define _MONO_CIL_OPALIAS_DEFINED_
+#define OPALIAS(a,s,r)
+#endif
+
+OPALIAS(CEE_BRNULL, "brnull", CEE_BRFALSE)
+OPALIAS(CEE_BRNULL_S, "brnull.s", CEE_BRFALSE_S)
+OPALIAS(CEE_BRZERO, "brzero", CEE_BRFALSE)
+OPALIAS(CEE_BRZERO_S, "brzero.s", CEE_BRFALSE_S)
+OPALIAS(CEE_BRINST, "brinst", CEE_BRTRUE)
+OPALIAS(CEE_BRINST_S, "brinst.s", CEE_BRTRUE_S)
+OPALIAS(CEE_LDIND_U8, "ldind.u8", CEE_LDIND_I8)
+OPALIAS(CEE_LDELEM_U8, "ldelem.u8", CEE_LDELEM_I8)
+OPALIAS(CEE_LDX_I4_MIX, "ldc.i4.M1", CEE_LDC_I4_M1)
+OPALIAS(CEE_ENDFAULT, "endfault", CEE_ENDFINALLY)
+
+#ifdef _MONO_CIL_OPALIAS_DEFINED_
+#undef OPALIAS
+#undef _MONO_CIL_OPALIAS_DEFINED_
+#endif
+EOF
+}
+
diff --git a/mono/cil/opcode.def b/mono/cil/opcode.def
new file mode 100644
index 00000000000..9331159500d
--- /dev/null
+++ b/mono/cil/opcode.def
@@ -0,0 +1,313 @@
+OPDEF(CEE_NOP, "nop", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x00, NEXT)
+OPDEF(CEE_BREAK, "break", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x01, ERROR)
+OPDEF(CEE_LDARG_0, "ldarg.0", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x02, NEXT)
+OPDEF(CEE_LDARG_1, "ldarg.1", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x03, NEXT)
+OPDEF(CEE_LDARG_2, "ldarg.2", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x04, NEXT)
+OPDEF(CEE_LDARG_3, "ldarg.3", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x05, NEXT)
+OPDEF(CEE_LDLOC_0, "ldloc.0", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x06, NEXT)
+OPDEF(CEE_LDLOC_1, "ldloc.1", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x07, NEXT)
+OPDEF(CEE_LDLOC_2, "ldloc.2", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x08, NEXT)
+OPDEF(CEE_LDLOC_3, "ldloc.3", Pop0, Push1, InlineNone, X, 1, 0xFF, 0x09, NEXT)
+OPDEF(CEE_STLOC_0, "stloc.0", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0A, NEXT)
+OPDEF(CEE_STLOC_1, "stloc.1", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0B, NEXT)
+OPDEF(CEE_STLOC_2, "stloc.2", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0C, NEXT)
+OPDEF(CEE_STLOC_3, "stloc.3", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x0D, NEXT)
+OPDEF(CEE_LDARG_S, "ldarg.s", Pop0, Push1, ShortInlineVar, X, 1, 0xFF, 0x0E, NEXT)
+OPDEF(CEE_LDARGA_S, "ldarga.s", Pop0, PushI, ShortInlineVar, X, 1, 0xFF, 0x0F, NEXT)
+OPDEF(CEE_STARG_S, "starg.s", Pop1, Push0, ShortInlineVar, X, 1, 0xFF, 0x10, NEXT)
+OPDEF(CEE_LDLOC_S, "ldloc.s", Pop0, Push1, ShortInlineVar, X, 1, 0xFF, 0x11, NEXT)
+OPDEF(CEE_LDLOCA_S, "ldloca.s", Pop0, PushI, ShortInlineVar, X, 1, 0xFF, 0x12, NEXT)
+OPDEF(CEE_STLOC_S, "stloc.s", Pop1, Push0, ShortInlineVar, X, 1, 0xFF, 0x13, NEXT)
+OPDEF(CEE_LDNULL, "ldnull", Pop0, PushRef, InlineNone, X, 1, 0xFF, 0x14, NEXT)
+OPDEF(CEE_LDC_I4_M1, "ldc.i4.m1", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x15, NEXT)
+OPDEF(CEE_LDC_I4_0, "ldc.i4.0", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x16, NEXT)
+OPDEF(CEE_LDC_I4_1, "ldc.i4.1", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x17, NEXT)
+OPDEF(CEE_LDC_I4_2, "ldc.i4.2", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x18, NEXT)
+OPDEF(CEE_LDC_I4_3, "ldc.i4.3", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x19, NEXT)
+OPDEF(CEE_LDC_I4_4, "ldc.i4.4", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1A, NEXT)
+OPDEF(CEE_LDC_I4_5, "ldc.i4.5", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1B, NEXT)
+OPDEF(CEE_LDC_I4_6, "ldc.i4.6", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1C, NEXT)
+OPDEF(CEE_LDC_I4_7, "ldc.i4.7", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1D, NEXT)
+OPDEF(CEE_LDC_I4_8, "ldc.i4.8", Pop0, PushI, InlineNone, X, 1, 0xFF, 0x1E, NEXT)
+OPDEF(CEE_LDC_I4_S, "ldc.i4.s", Pop0, PushI, ShortInlineI, X, 1, 0xFF, 0x1F, NEXT)
+OPDEF(CEE_LDC_I4, "ldc.i4", Pop0, PushI, InlineI, X, 1, 0xFF, 0x20, NEXT)
+OPDEF(CEE_LDC_I8, "ldc.i8", Pop0, PushI8, InlineI8, X, 1, 0xFF, 0x21, NEXT)
+OPDEF(CEE_LDC_R4, "ldc.r4", Pop0, PushR4, ShortInlineR, X, 1, 0xFF, 0x22, NEXT)
+OPDEF(CEE_LDC_R8, "ldc.r8", Pop0, PushR8, InlineR, X, 1, 0xFF, 0x23, NEXT)
+OPDEF(CEE_UNUSED99, "unused99", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x24, NEXT)
+OPDEF(CEE_DUP, "dup", Pop1, Push1+Push1, InlineNone, X, 1, 0xFF, 0x25, NEXT)
+OPDEF(CEE_POP, "pop", Pop1, Push0, InlineNone, X, 1, 0xFF, 0x26, NEXT)
+OPDEF(CEE_JMP, "jmp", Pop0, Push0, InlineMethod, X, 1, 0xFF, 0x27, CALL)
+OPDEF(CEE_CALL, "call", VarPop, VarPush, InlineMethod, X, 1, 0xFF, 0x28, CALL)
+OPDEF(CEE_CALLI, "calli", VarPop, VarPush, InlineSig, X, 1, 0xFF, 0x29, CALL)
+OPDEF(CEE_RET, "ret", VarPop, Push0, InlineNone, X, 1, 0xFF, 0x2A, RETURN)
+OPDEF(CEE_BR_S, "br.s", Pop0, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2B, BRANCH)
+OPDEF(CEE_BRFALSE_S, "brfalse.s", PopI, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2C, COND_BRANCH)
+OPDEF(CEE_BRTRUE_S, "brtrue.s", PopI, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2D, COND_BRANCH)
+OPDEF(CEE_BEQ_S, "beq.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2E, COND_BRANCH)
+OPDEF(CEE_BGE_S, "bge.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x2F, COND_BRANCH)
+OPDEF(CEE_BGT_S, "bgt.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x30, COND_BRANCH)
+OPDEF(CEE_BLE_S, "ble.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x31, COND_BRANCH)
+OPDEF(CEE_BLT_S, "blt.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x32, COND_BRANCH)
+OPDEF(CEE_BNE_UN_S, "bne.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x33, COND_BRANCH)
+OPDEF(CEE_BGE_UN_S, "bge.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x34, COND_BRANCH)
+OPDEF(CEE_BGT_UN_S, "bgt.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x35, COND_BRANCH)
+OPDEF(CEE_BLE_UN_S, "ble.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x36, COND_BRANCH)
+OPDEF(CEE_BLT_UN_S, "blt.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0x37, COND_BRANCH)
+OPDEF(CEE_BR, "br", Pop0, Push0, InlineBrTarget, X, 1, 0xFF, 0x38, BRANCH)
+OPDEF(CEE_BRFALSE, "brfalse", PopI, Push0, InlineBrTarget, X, 1, 0xFF, 0x39, COND_BRANCH)
+OPDEF(CEE_BRTRUE, "brtrue", PopI, Push0, InlineBrTarget, X, 1, 0xFF, 0x3A, COND_BRANCH)
+OPDEF(CEE_BEQ, "beq", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3B, COND_BRANCH)
+OPDEF(CEE_BGE, "bge", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3C, COND_BRANCH)
+OPDEF(CEE_BGT, "bgt", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3D, COND_BRANCH)
+OPDEF(CEE_BLE, "ble", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3E, COND_BRANCH)
+OPDEF(CEE_BLT, "blt", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x3F, COND_BRANCH)
+OPDEF(CEE_BNE_UN, "bne.un", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x40, COND_BRANCH)
+OPDEF(CEE_BGE_UN, "bge.un", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x41, COND_BRANCH)
+OPDEF(CEE_BGT_UN, "bgt.un", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x42, COND_BRANCH)
+OPDEF(CEE_BLE_UN, "ble.un", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x43, COND_BRANCH)
+OPDEF(CEE_BLT_UN, "blt.un", Pop1+Pop1, Push0, InlineBrTarget, X, 1, 0xFF, 0x44, COND_BRANCH)
+OPDEF(CEE_SWITCH, "switch", PopI, Push0, InlineSwitch, X, 1, 0xFF, 0x45, COND_BRANCH)
+OPDEF(CEE_LDIND_I1, "ldind.i1", PopI, PushI, InlineNone, X, 1, 0xFF, 0x46, NEXT)
+OPDEF(CEE_LDIND_U1, "ldind.u1", PopI, PushI, InlineNone, X, 1, 0xFF, 0x47, NEXT)
+OPDEF(CEE_LDIND_I2, "ldind.i2", PopI, PushI, InlineNone, X, 1, 0xFF, 0x48, NEXT)
+OPDEF(CEE_LDIND_U2, "ldind.u2", PopI, PushI, InlineNone, X, 1, 0xFF, 0x49, NEXT)
+OPDEF(CEE_LDIND_I4, "ldind.i4", PopI, PushI, InlineNone, X, 1, 0xFF, 0x4A, NEXT)
+OPDEF(CEE_LDIND_U4, "ldind.u4", PopI, PushI, InlineNone, X, 1, 0xFF, 0x4B, NEXT)
+OPDEF(CEE_LDIND_I8, "ldind.i8", PopI, PushI8, InlineNone, X, 1, 0xFF, 0x4C, NEXT)
+OPDEF(CEE_LDIND_I, "ldind.i", PopI, PushI, InlineNone, X, 1, 0xFF, 0x4D, NEXT)
+OPDEF(CEE_LDIND_R4, "ldind.r4", PopI, PushR4, InlineNone, X, 1, 0xFF, 0x4E, NEXT)
+OPDEF(CEE_LDIND_R8, "ldind.r8", PopI, PushR8, InlineNone, X, 1, 0xFF, 0x4F, NEXT)
+OPDEF(CEE_LDIND_REF, "ldind.ref", PopI, PushRef, InlineNone, X, 1, 0xFF, 0x50, NEXT)
+OPDEF(CEE_STIND_REF, "stind.ref", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x51, NEXT)
+OPDEF(CEE_STIND_I1, "stind.i1", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x52, NEXT)
+OPDEF(CEE_STIND_I2, "stind.i2", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x53, NEXT)
+OPDEF(CEE_STIND_I4, "stind.i4", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x54, NEXT)
+OPDEF(CEE_STIND_I8, "stind.i8", PopI+PopI8, Push0, InlineNone, X, 1, 0xFF, 0x55, NEXT)
+OPDEF(CEE_STIND_R4, "stind.r4", PopI+PopR4, Push0, InlineNone, X, 1, 0xFF, 0x56, NEXT)
+OPDEF(CEE_STIND_R8, "stind.r8", PopI+PopR8, Push0, InlineNone, X, 1, 0xFF, 0x57, NEXT)
+OPDEF(CEE_ADD, "add", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x58, NEXT)
+OPDEF(CEE_SUB, "sub", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x59, NEXT)
+OPDEF(CEE_MUL, "mul", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5A, NEXT)
+OPDEF(CEE_DIV, "div", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5B, NEXT)
+OPDEF(CEE_DIV_UN, "div.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5C, NEXT)
+OPDEF(CEE_REM, "rem", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5D, NEXT)
+OPDEF(CEE_REM_UN, "rem.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5E, NEXT)
+OPDEF(CEE_AND, "and", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x5F, NEXT)
+OPDEF(CEE_OR, "or", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x60, NEXT)
+OPDEF(CEE_XOR, "xor", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x61, NEXT)
+OPDEF(CEE_SHL, "shl", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x62, NEXT)
+OPDEF(CEE_SHR, "shr", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x63, NEXT)
+OPDEF(CEE_SHR_UN, "shr.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0x64, NEXT)
+OPDEF(CEE_NEG, "neg", Pop1, Push1, InlineNone, X, 1, 0xFF, 0x65, NEXT)
+OPDEF(CEE_NOT, "not", Pop1, Push1, InlineNone, X, 1, 0xFF, 0x66, NEXT)
+OPDEF(CEE_CONV_I1, "conv.i1", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x67, NEXT)
+OPDEF(CEE_CONV_I2, "conv.i2", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x68, NEXT)
+OPDEF(CEE_CONV_I4, "conv.i4", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x69, NEXT)
+OPDEF(CEE_CONV_I8, "conv.i8", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x6A, NEXT)
+OPDEF(CEE_CONV_R4, "conv.r4", Pop1, PushR4, InlineNone, X, 1, 0xFF, 0x6B, NEXT)
+OPDEF(CEE_CONV_R8, "conv.r8", Pop1, PushR8, InlineNone, X, 1, 0xFF, 0x6C, NEXT)
+OPDEF(CEE_CONV_U4, "conv.u4", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x6D, NEXT)
+OPDEF(CEE_CONV_U8, "conv.u8", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x6E, NEXT)
+OPDEF(CEE_CALLVIRT, "callvirt", VarPop, VarPush, InlineMethod, X, 1, 0xFF, 0x6F, CALL)
+OPDEF(CEE_CPOBJ, "cpobj", PopI+PopI, Push0, InlineType, X, 1, 0xFF, 0x70, NEXT)
+OPDEF(CEE_LDOBJ, "ldobj", PopI, Push1, InlineType, X, 1, 0xFF, 0x71, NEXT)
+OPDEF(CEE_LDSTR, "ldstr", Pop0, PushRef, InlineString, X, 1, 0xFF, 0x72, NEXT)
+OPDEF(CEE_NEWOBJ, "newobj", VarPop, PushRef, InlineMethod, X, 1, 0xFF, 0x73, CALL)
+OPDEF(CEE_CASTCLASS, "castclass", PopRef, PushRef, InlineType, X, 1, 0xFF, 0x74, NEXT)
+OPDEF(CEE_ISINST, "isinst", PopRef, PushI, InlineType, X, 1, 0xFF, 0x75, NEXT)
+OPDEF(CEE_CONV_R_UN, "conv.r.un", Pop1, PushR8, InlineNone, X, 1, 0xFF, 0x76, NEXT)
+OPDEF(CEE_UNUSED58, "unused58", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x77, NEXT)
+OPDEF(CEE_UNUSED1, "unused1", Pop0, Push0, InlineNone, X, 1, 0xFF, 0x78, NEXT)
+OPDEF(CEE_UNBOX, "unbox", PopRef, PushI, InlineType, X, 1, 0xFF, 0x79, NEXT)
+OPDEF(CEE_THROW, "throw", PopRef, Push0, InlineNone, X, 1, 0xFF, 0x7A, ERROR)
+OPDEF(CEE_LDFLD, "ldfld", PopRef, Push1, InlineField, X, 1, 0xFF, 0x7B, NEXT)
+OPDEF(CEE_LDFLDA, "ldflda", PopRef, PushI, InlineField, X, 1, 0xFF, 0x7C, NEXT)
+OPDEF(CEE_STFLD, "stfld", PopRef+Pop1, Push0, InlineField, X, 1, 0xFF, 0x7D, NEXT)
+OPDEF(CEE_LDSFLD, "ldsfld", Pop0, Push1, InlineField, X, 1, 0xFF, 0x7E, NEXT)
+OPDEF(CEE_LDSFLDA, "ldsflda", Pop0, PushI, InlineField, X, 1, 0xFF, 0x7F, NEXT)
+OPDEF(CEE_STSFLD, "stsfld", Pop1, Push0, InlineField, X, 1, 0xFF, 0x80, NEXT)
+OPDEF(CEE_STOBJ, "stobj", PopI+Pop1, Push0, InlineType, X, 1, 0xFF, 0x81, NEXT)
+OPDEF(CEE_CONV_OVF_I1_UN, "conv.ovf.i1.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x82, NEXT)
+OPDEF(CEE_CONV_OVF_I2_UN, "conv.ovf.i2.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x83, NEXT)
+OPDEF(CEE_CONV_OVF_I4_UN, "conv.ovf.i4.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x84, NEXT)
+OPDEF(CEE_CONV_OVF_I8_UN, "conv.ovf.i8.un", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x85, NEXT)
+OPDEF(CEE_CONV_OVF_U1_UN, "conv.ovf.u1.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x86, NEXT)
+OPDEF(CEE_CONV_OVF_U2_UN, "conv.ovf.u2.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x87, NEXT)
+OPDEF(CEE_CONV_OVF_U4_UN, "conv.ovf.u4.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x88, NEXT)
+OPDEF(CEE_CONV_OVF_U8_UN, "conv.ovf.u8.un", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0x89, NEXT)
+OPDEF(CEE_CONV_OVF_I_UN, "conv.ovf.i.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x8A, NEXT)
+OPDEF(CEE_CONV_OVF_U_UN, "conv.ovf.u.un", Pop1, PushI, InlineNone, X, 1, 0xFF, 0x8B, NEXT)
+OPDEF(CEE_BOX, "box", Pop1, PushRef, InlineType, X, 1, 0xFF, 0x8C, NEXT)
+OPDEF(CEE_NEWARR, "newarr", PopI, PushRef, InlineType, X, 1, 0xFF, 0x8D, NEXT)
+OPDEF(CEE_LDLEN, "ldlen", PopRef, PushI, InlineNone, X, 1, 0xFF, 0x8E, NEXT)
+OPDEF(CEE_LDELEMA, "ldelema", PopRef+PopI, PushI, InlineType, X, 1, 0xFF, 0x8F, NEXT)
+OPDEF(CEE_LDELEM_I1, "ldelem.i1", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x90, NEXT)
+OPDEF(CEE_LDELEM_U1, "ldelem.u1", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x91, NEXT)
+OPDEF(CEE_LDELEM_I2, "ldelem.i2", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x92, NEXT)
+OPDEF(CEE_LDELEM_U2, "ldelem.u2", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x93, NEXT)
+OPDEF(CEE_LDELEM_I4, "ldelem.i4", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x94, NEXT)
+OPDEF(CEE_LDELEM_U4, "ldelem.u4", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x95, NEXT)
+OPDEF(CEE_LDELEM_I8, "ldelem.i8", PopRef+PopI, PushI8, InlineNone, X, 1, 0xFF, 0x96, NEXT)
+OPDEF(CEE_LDELEM_I, "ldelem.i", PopRef+PopI, PushI, InlineNone, X, 1, 0xFF, 0x97, NEXT)
+OPDEF(CEE_LDELEM_R4, "ldelem.r4", PopRef+PopI, PushR4, InlineNone, X, 1, 0xFF, 0x98, NEXT)
+OPDEF(CEE_LDELEM_R8, "ldelem.r8", PopRef+PopI, PushR8, InlineNone, X, 1, 0xFF, 0x99, NEXT)
+OPDEF(CEE_LDELEM_REF, "ldelem.ref", PopRef+PopI, PushRef, InlineNone, X, 1, 0xFF, 0x9A, NEXT)
+OPDEF(CEE_STELEM_I, "stelem.i", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9B, NEXT)
+OPDEF(CEE_STELEM_I1, "stelem.i1", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9C, NEXT)
+OPDEF(CEE_STELEM_I2, "stelem.i2", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9D, NEXT)
+OPDEF(CEE_STELEM_I4, "stelem.i4", PopRef+PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0x9E, NEXT)
+OPDEF(CEE_STELEM_I8, "stelem.i8", PopRef+PopI+PopI8, Push0, InlineNone, X, 1, 0xFF, 0x9F, NEXT)
+OPDEF(CEE_STELEM_R4, "stelem.r4", PopRef+PopI+PopR4, Push0, InlineNone, X, 1, 0xFF, 0xA0, NEXT)
+OPDEF(CEE_STELEM_R8, "stelem.r8", PopRef+PopI+PopR8, Push0, InlineNone, X, 1, 0xFF, 0xA1, NEXT)
+OPDEF(CEE_STELEM_REF, "stelem.ref", PopRef+PopI+PopRef, Push0, InlineNone, X, 1, 0xFF, 0xA2, NEXT)
+OPDEF(CEE_UNUSED2, "unused2", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA3, NEXT)
+OPDEF(CEE_UNUSED3, "unused3", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA4, NEXT)
+OPDEF(CEE_UNUSED4, "unused4", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA5, NEXT)
+OPDEF(CEE_UNUSED5, "unused5", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA6, NEXT)
+OPDEF(CEE_UNUSED6, "unused6", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA7, NEXT)
+OPDEF(CEE_UNUSED7, "unused7", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA8, NEXT)
+OPDEF(CEE_UNUSED8, "unused8", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xA9, NEXT)
+OPDEF(CEE_UNUSED9, "unused9", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAA, NEXT)
+OPDEF(CEE_UNUSED10, "unused10", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAB, NEXT)
+OPDEF(CEE_UNUSED11, "unused11", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAC, NEXT)
+OPDEF(CEE_UNUSED12, "unused12", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAD, NEXT)
+OPDEF(CEE_UNUSED13, "unused13", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAE, NEXT)
+OPDEF(CEE_UNUSED14, "unused14", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xAF, NEXT)
+OPDEF(CEE_UNUSED15, "unused15", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xB0, NEXT)
+OPDEF(CEE_UNUSED16, "unused16", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xB1, NEXT)
+OPDEF(CEE_UNUSED17, "unused17", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xB2, NEXT)
+OPDEF(CEE_CONV_OVF_I1, "conv.ovf.i1", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB3, NEXT)
+OPDEF(CEE_CONV_OVF_U1, "conv.ovf.u1", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB4, NEXT)
+OPDEF(CEE_CONV_OVF_I2, "conv.ovf.i2", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB5, NEXT)
+OPDEF(CEE_CONV_OVF_U2, "conv.ovf.u2", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB6, NEXT)
+OPDEF(CEE_CONV_OVF_I4, "conv.ovf.i4", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB7, NEXT)
+OPDEF(CEE_CONV_OVF_U4, "conv.ovf.u4", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xB8, NEXT)
+OPDEF(CEE_CONV_OVF_I8, "conv.ovf.i8", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0xB9, NEXT)
+OPDEF(CEE_CONV_OVF_U8, "conv.ovf.u8", Pop1, PushI8, InlineNone, X, 1, 0xFF, 0xBA, NEXT)
+OPDEF(CEE_UNUSED50, "unused50", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBB, NEXT)
+OPDEF(CEE_UNUSED18, "unused18", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBC, NEXT)
+OPDEF(CEE_UNUSED19, "unused19", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBD, NEXT)
+OPDEF(CEE_UNUSED20, "unused20", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBE, NEXT)
+OPDEF(CEE_UNUSED21, "unused21", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xBF, NEXT)
+OPDEF(CEE_UNUSED22, "unused22", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC0, NEXT)
+OPDEF(CEE_UNUSED23, "unused23", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC1, NEXT)
+OPDEF(CEE_REFANYVAL, "refanyval", Pop1, PushI, InlineType, X, 1, 0xFF, 0xC2, NEXT)
+OPDEF(CEE_CKFINITE, "ckfinite", Pop1, PushR8, InlineNone, X, 1, 0xFF, 0xC3, NEXT)
+OPDEF(CEE_UNUSED24, "unused24", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC4, NEXT)
+OPDEF(CEE_UNUSED25, "unused25", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC5, NEXT)
+OPDEF(CEE_MKREFANY, "mkrefany", PopI, Push1, InlineType, X, 1, 0xFF, 0xC6, NEXT)
+OPDEF(CEE_UNUSED59, "unused59", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC7, NEXT)
+OPDEF(CEE_UNUSED60, "unused60", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC8, NEXT)
+OPDEF(CEE_UNUSED61, "unused61", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xC9, NEXT)
+OPDEF(CEE_UNUSED62, "unused62", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCA, NEXT)
+OPDEF(CEE_UNUSED63, "unused63", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCB, NEXT)
+OPDEF(CEE_UNUSED64, "unused64", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCC, NEXT)
+OPDEF(CEE_UNUSED65, "unused65", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCD, NEXT)
+OPDEF(CEE_UNUSED66, "unused66", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCE, NEXT)
+OPDEF(CEE_UNUSED67, "unused67", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xCF, NEXT)
+OPDEF(CEE_LDTOKEN, "ldtoken", Pop0, PushI, InlineTok, X, 1, 0xFF, 0xD0, NEXT)
+OPDEF(CEE_CONV_U2, "conv.u2", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD1, NEXT)
+OPDEF(CEE_CONV_U1, "conv.u1", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD2, NEXT)
+OPDEF(CEE_CONV_I, "conv.i", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD3, NEXT)
+OPDEF(CEE_CONV_OVF_I, "conv.ovf.i", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD4, NEXT)
+OPDEF(CEE_CONV_OVF_U, "conv.ovf.u", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xD5, NEXT)
+OPDEF(CEE_ADD_OVF, "add.ovf", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD6, NEXT)
+OPDEF(CEE_ADD_OVF_UN, "add.ovf.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD7, NEXT)
+OPDEF(CEE_MUL_OVF, "mul.ovf", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD8, NEXT)
+OPDEF(CEE_MUL_OVF_UN, "mul.ovf.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xD9, NEXT)
+OPDEF(CEE_SUB_OVF, "sub.ovf", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xDA, NEXT)
+OPDEF(CEE_SUB_OVF_UN, "sub.ovf.un", Pop1+Pop1, Push1, InlineNone, X, 1, 0xFF, 0xDB, NEXT)
+OPDEF(CEE_ENDFINALLY, "endfinally", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xDC, RETURN)
+OPDEF(CEE_LEAVE, "leave", Pop0, Push0, InlineBrTarget, X, 1, 0xFF, 0xDD, BRANCH)
+OPDEF(CEE_LEAVE_S, "leave.s", Pop0, Push0, ShortInlineBrTarget, X, 1, 0xFF, 0xDE, BRANCH)
+OPDEF(CEE_STIND_I, "stind.i", PopI+PopI, Push0, InlineNone, X, 1, 0xFF, 0xDF, NEXT)
+OPDEF(CEE_CONV_U, "conv.u", Pop1, PushI, InlineNone, X, 1, 0xFF, 0xE0, NEXT)
+OPDEF(CEE_UNUSED26, "unused26", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE1, NEXT)
+OPDEF(CEE_UNUSED27, "unused27", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE2, NEXT)
+OPDEF(CEE_UNUSED28, "unused28", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE3, NEXT)
+OPDEF(CEE_UNUSED29, "unused29", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE4, NEXT)
+OPDEF(CEE_UNUSED30, "unused30", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE5, NEXT)
+OPDEF(CEE_UNUSED31, "unused31", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE6, NEXT)
+OPDEF(CEE_UNUSED32, "unused32", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE7, NEXT)
+OPDEF(CEE_UNUSED33, "unused33", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE8, NEXT)
+OPDEF(CEE_UNUSED34, "unused34", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xE9, NEXT)
+OPDEF(CEE_UNUSED35, "unused35", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEA, NEXT)
+OPDEF(CEE_UNUSED36, "unused36", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEB, NEXT)
+OPDEF(CEE_UNUSED37, "unused37", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEC, NEXT)
+OPDEF(CEE_UNUSED38, "unused38", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xED, NEXT)
+OPDEF(CEE_UNUSED39, "unused39", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEE, NEXT)
+OPDEF(CEE_UNUSED40, "unused40", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xEF, NEXT)
+OPDEF(CEE_UNUSED41, "unused41", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF0, NEXT)
+OPDEF(CEE_UNUSED42, "unused42", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF1, NEXT)
+OPDEF(CEE_UNUSED43, "unused43", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF2, NEXT)
+OPDEF(CEE_UNUSED44, "unused44", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF3, NEXT)
+OPDEF(CEE_UNUSED45, "unused45", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF4, NEXT)
+OPDEF(CEE_UNUSED46, "unused46", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF5, NEXT)
+OPDEF(CEE_UNUSED47, "unused47", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF6, NEXT)
+OPDEF(CEE_UNUSED48, "unused48", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF7, NEXT)
+OPDEF(CEE_PREFIX7, "prefix7", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF8, META)
+OPDEF(CEE_PREFIX6, "prefix6", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xF9, META)
+OPDEF(CEE_PREFIX5, "prefix5", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFA, META)
+OPDEF(CEE_PREFIX4, "prefix4", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFB, META)
+OPDEF(CEE_PREFIX3, "prefix3", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFC, META)
+OPDEF(CEE_PREFIX2, "prefix2", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFD, META)
+OPDEF(CEE_PREFIX1, "prefix1", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFE, META)
+OPDEF(CEE_PREFIXREF, "prefixref", Pop0, Push0, InlineNone, X, 1, 0xFF, 0xFF, META)
+OPDEF(CEE_ARGLIST, "arglist", Pop0, PushI, InlineNone, X, 2, 0xFE, 0x00, NEXT)
+OPDEF(CEE_CEQ, "ceq", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x01, NEXT)
+OPDEF(CEE_CGT, "cgt", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x02, NEXT)
+OPDEF(CEE_CGT_UN, "cgt.un", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x03, NEXT)
+OPDEF(CEE_CLT, "clt", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x04, NEXT)
+OPDEF(CEE_CLT_UN, "clt.un", Pop1+Pop1, PushI, InlineNone, X, 2, 0xFE, 0x05, NEXT)
+OPDEF(CEE_LDFTN, "ldftn", Pop0, PushI, InlineMethod, X, 2, 0xFE, 0x06, NEXT)
+OPDEF(CEE_LDVIRTFTN, "ldvirtftn", PopRef, PushI, InlineMethod, X, 2, 0xFE, 0x07, NEXT)
+OPDEF(CEE_UNUSED56, "unused56", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x08, NEXT)
+OPDEF(CEE_LDARG, "ldarg", Pop0, Push1, InlineVar, X, 2, 0xFE, 0x09, NEXT)
+OPDEF(CEE_LDARGA, "ldarga", Pop0, PushI, InlineVar, X, 2, 0xFE, 0x0A, NEXT)
+OPDEF(CEE_STARG, "starg", Pop1, Push0, InlineVar, X, 2, 0xFE, 0x0B, NEXT)
+OPDEF(CEE_LDLOC, "ldloc", Pop0, Push1, InlineVar, X, 2, 0xFE, 0x0C, NEXT)
+OPDEF(CEE_LDLOCA, "ldloca", Pop0, PushI, InlineVar, X, 2, 0xFE, 0x0D, NEXT)
+OPDEF(CEE_STLOC, "stloc", Pop1, Push0, InlineVar, X, 2, 0xFE, 0x0E, NEXT)
+OPDEF(CEE_LOCALLOC, "localloc", PopI, PushI, InlineNone, X, 2, 0xFE, 0x0F, NEXT)
+OPDEF(CEE_UNUSED57, "unused57", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x10, NEXT)
+OPDEF(CEE_ENDFILTER, "endfilter", PopI, Push0, InlineNone, X, 2, 0xFE, 0x11, RETURN)
+OPDEF(CEE_UNALIGNED_, "unaligned.", Pop0, Push0, ShortInlineI, X, 2, 0xFE, 0x12, META)
+OPDEF(CEE_VOLATILE_, "volatile.", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x13, META)
+OPDEF(CEE_TAIL_, "tail.", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x14, META)
+OPDEF(CEE_INITOBJ, "initobj", PopI, Push0, InlineType, X, 2, 0xFE, 0x15, NEXT)
+OPDEF(CEE_UNUSED68, "unused68", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x16, NEXT)
+OPDEF(CEE_CPBLK, "cpblk", PopI+PopI+PopI, Push0, InlineNone, X, 2, 0xFE, 0x17, NEXT)
+OPDEF(CEE_INITBLK, "initblk", PopI+PopI+PopI, Push0, InlineNone, X, 2, 0xFE, 0x18, NEXT)
+OPDEF(CEE_UNUSED69, "unused69", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x19, NEXT)
+OPDEF(CEE_RETHROW, "rethrow", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1A, ERROR)
+OPDEF(CEE_UNUSED, "unused", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1B, NEXT)
+OPDEF(CEE_SIZEOF, "sizeof", Pop0, PushI, InlineType, X, 2, 0xFE, 0x1C, NEXT)
+OPDEF(CEE_REFANYTYPE, "refanytype", Pop1, PushI, InlineNone, X, 2, 0xFE, 0x1D, NEXT)
+OPDEF(CEE_UNUSED52, "unused52", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1E, NEXT)
+OPDEF(CEE_UNUSED53, "unused53", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x1F, NEXT)
+OPDEF(CEE_UNUSED54, "unused54", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x20, NEXT)
+OPDEF(CEE_UNUSED55, "unused55", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x21, NEXT)
+OPDEF(CEE_UNUSED70, "unused70", Pop0, Push0, InlineNone, X, 2, 0xFE, 0x22, NEXT)
+OPDEF(CEE_ILLEGAL, "illegal", Pop0, Push0, InlineNone, X, 2, 0x00, 0x00, META)
+OPDEF(CEE_ENDMAC, "endmac", Pop0, Push0, InlineNone, X, 2, 0x00, 0x00, META)
+#ifndef OPALIAS
+#define _MONO_CIL_OPALIAS_DEFINED_
+#define OPALIAS(a,s,r)
+#endif
+
+OPALIAS(CEE_BRNULL, "brnull", CEE_BRFALSE)
+OPALIAS(CEE_BRNULL_S, "brnull.s", CEE_BRFALSE_S)
+OPALIAS(CEE_BRZERO, "brzero", CEE_BRFALSE)
+OPALIAS(CEE_BRZERO_S, "brzero.s", CEE_BRFALSE_S)
+OPALIAS(CEE_BRINST, "brinst", CEE_BRTRUE)
+OPALIAS(CEE_BRINST_S, "brinst.s", CEE_BRTRUE_S)
+OPALIAS(CEE_LDIND_U8, "ldind.u8", CEE_LDIND_I8)
+OPALIAS(CEE_LDELEM_U8, "ldelem.u8", CEE_LDELEM_I8)
+OPALIAS(CEE_LDX_I4_MIX, "ldc.i4.M1", CEE_LDC_I4_M1)
+OPALIAS(CEE_ENDFAULT, "endfault", CEE_ENDFINALLY)
+
+#ifdef _MONO_CIL_OPALIAS_DEFINED_
+#undef OPALIAS
+#undef _MONO_CIL_OPALIAS_DEFINED_
+#endif
diff --git a/mono/dis/.cvsignore b/mono/dis/.cvsignore
new file mode 100644
index 00000000000..45b45b2bee5
--- /dev/null
+++ b/mono/dis/.cvsignore
@@ -0,0 +1,5 @@
+Makefile
+Makefile.in
+.libs
+.deps
+monodis
diff --git a/mono/dis/ChangeLog b/mono/dis/ChangeLog
new file mode 100644
index 00000000000..afc9a328ab7
--- /dev/null
+++ b/mono/dis/ChangeLog
@@ -0,0 +1,346 @@
+
+Mon Apr 15 11:35:05 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * dump.c, dump.h, get.c, get.h, main.c: support for dumping the
+ module table and guid values.
+
+Mon Apr 8 17:15:04 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * main.c: removed unneeded runtime invoke support.
+
+Thu Mar 28 16:52:11 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c, dump.c, get.c, main.c, util.h: spring warning cleanup.
+
+Thu Mar 28 11:29:58 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * util.c: when an invalid flags combination is seen,
+ return the string "invalid-flags", so disassembly can continue.
+
+Tue Mar 19 18:15:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c: use unsigned for variables.
+
+Sat Mar 16 19:13:57 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * dump.c: handle TypeSpec token in memberref table dump.
+
+2002-03-08 Nick Drochak <ndrochak@gol.com>
+
+ * monodis.1: Add info about new parameter
+ * main.c: Add flag to remember if user wants to us mscorlib for
+ non-corilb assembly names
+ * get.c(get_typedef): use mscorlib for assembly name only
+ if user specifies it with a command line parameter. Default
+ behavior is now to use actual assembly name.
+
+Tue Mar 5 18:11:01 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * dump.c: print index of the methodsemantics table.
+ * main.cs: print event information.
+
+Wed Feb 20 22:10:48 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * dump.c: fix the fix and more complete custom attribute decoder.
+
+Tue Feb 19 20:20:15 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * dump.c: the prolog is before each arg in the custom attribute blob.
+
+Mon Feb 18 15:48:38 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * get.c: include last param.
+
+Thu Feb 14 18:59:37 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * main.c: output pack and size info if needed.
+
+2002-02-13 Dietmar Maurer <dietmar@ximian.com>
+
+ * *.c: s/MonoMetadata/MonoImage/
+
+Tue Feb 12 14:33:53 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * dump.c: make all the indexes printed starting from 1.
+
+Fri Feb 8 19:28:31 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * get.c: don't abort if a methodref is not found, usa alternative way
+ to get the method name.
+
+Fri Feb 8 12:29:41 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am: correct linking order.
+ * dis-cil.c: use opcode info from opcodes.h instead of a copy of the data.
+
+Thu Jan 31 18:21:12 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c: reverse order when outputting start try blocks.
+
+Mon Jan 14 17:00:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * dump.c: more info in method table dump.
+
+Mon Dec 24 17:24:13 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * main.c, dump.h, dump.c: add dump_table_nestedclass().
+ * dis-cil.c: output int64 as hex.
+
+Tue Dec 18 18:48:00 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * main.c: use mono_metadata_methods_from_property() and
+ mono_metadata_properties_from_typedef() from metadata instead of
+ custom code.
+
+Tue Nov 27 16:31:52 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * main.c: output a marker for method (used in debug support).
+
+Mon Nov 19 11:32:28 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * main.c: remove arch_create_jit_trampoline().
+
+Thu Nov 15 17:42:03 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dump.c: decode more info in the constant table.
+ * get.c: show literals the same way ildasm does.
+ * main.c: decode literal values for fields.
+
+Fri Nov 2 19:04:21 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * main.c, dump, dump.c: decode the customattr table.
+ * dump.c: handle also field signature when dumping the memberref
+ table.
+
+2001-11-07 Miguel de Icaza <miguel@ximian.com>
+
+ * main.c (dis_property_methods): Added missing colon which avoided
+ setting loc.t
+
+2001-10-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * main.c (arch_compile_method): added to compute vtable entry
+
+Mon Oct 8 16:13:55 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * get.c, get.h: MonoArray changed in MonoArrayType.
+ * main.c: guard against calling bsearch with a NULL pointer
+ (pointed out by Laurent Rioux, smoux).
+
+Thu Oct 4 19:05:56 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c: fix printing of exception stuff.
+ * dump.c: display some more info in the typedef table dump.
+ * main.c: typo fix and method list fix.
+
+2001-10-04 Dick Porter <dick@ximian.com>
+
+ * meta.h: include mono-endian.h not endian.h
+
+2001-10-02 Dietmar Maurer <dietmar@ximian.com>
+
+ * get.c (get_method): always write namespace and class name.
+
+2001-09-06 Miguel de Icaza <miguel@ximian.com>
+
+ * monodis.1: Update man page.
+
+Tue Aug 28 15:54:45 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * main.c, dump.c, dump.h, get.c: added dump_table_interfaceimpl ().
+ Output info about interfaces when disassembling a type. Many small
+ changes to make the output correct assembler.
+
+Mon Aug 27 20:13:49 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c, get.c: some endian fixes.
+ * main.c: colon-separate version numbers. Print also namespace
+ when outputting class information.
+
+Fri Aug 24 16:10:12 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * get.c, main.c, get.h: updates for MonoParam merge in MonoType.
+
+2001-08-24 Dietmar Maurer <dietmar@ximian.com>
+
+ * main.c (disassemble_file): use assembly_open instead of image_open
+
+Wed Aug 22 16:22:22 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c: add a newline after branch instructions. Move
+ end of exception handler code at the end.
+
+Tue Aug 21 18:51:05 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c: correctly print the label for multi-byte opcodes.
+
+Mon Aug 20 19:33:34 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * util.c: add a space when decoding multiple flags.
+ * dump.c, dump.h, main.c: decode the property map and
+ methodsemantics tables. Disassemble property information
+ to .property IL directives.
+ * get.c: allow passing a NULL as method in dis_stringify_method ()
+ if a methoddef_row is given.
+
+2001-08-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * get.c (dis_stringify_type): support pinned values
+
+Sat Aug 18 11:24:07 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dump.c, get.c, get.h, main.c: dis_stringify_method_signature()
+ gets an optional methodef_row index instead of a name, so it
+ can figure out also the names and attributes of params.
+ parse_method_signature() and free_method_signature() removed as
+ they are useless now.
+
+2001-08-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * main.c (pinvoke_info): bug fix - use the right column in the table
+
+2001-08-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * get.c (dis_stringify_type): use strconcat instead of strjoin
+
+Sat Aug 4 12:36:54 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * get.c, get.h, main.c, dump.c: implement dis_stringify_method_signature().
+ More magic constants replaced by enum values (spotted at least 3 real bugs
+ doing this). Print usage information if an unknown option is given.
+ Print the full signature when dumping the method table.
+ Changed method and field table dumps to show the typedef name the field
+ or method belongs to.
+
+Fri Aug 3 18:30:16 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * get.c (get_method): fix use of unitialized variable and
+ remove magic constants all over the place.
+
+Wed Aug 1 22:46:45 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c: properly decode the switch opcode.
+
+2001-08-01 Dietmar Maurer <dietmar@ximian.com>
+
+ * get.c (get_token): decode typedef and typeref tokens
+
+ * main.c (dis_method_list): don't decode the next row, that is
+ totally unnecessary
+
+Tue Jul 31 17:48:11 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c, dis-cil.h, dump.c, dump.h, get.c, get.h, main.c, push-pop.h:
+ massive namespace cleanup.
+ * main.c: dis_locals() now just strigifies a MonoMethodHeader.
+
+2001-07-31 Dietmar Maurer <dietmar@ximian.com>
+
+ * main.c (pinvoke_flags): impl.
+
+Mon Jul 30 20:08:37 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c, dis-cil.h, main.c: changes to disassemble also
+ the information about try/catch/finally blocks.
+
+2001-07-27 Dietmar Maurer <dietmar@ximian.com>
+
+ * get.c (dis_stringify_type): return "void" if !type
+ (dis_stringify_type): print type* instead of *type
+
+Thu Jul 26 13:22:28 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c, dump.c, get.c, main.c: updates to match changes in metadata.
+ Removed dead code.
+
+2001-07-17 Miguel de Icaza <miguel@ximian.com>
+
+ * main.c (usage): Print out all the arguments.
+
+ * get.c, main.c, dump.c: Remove `expand', `get_encoded_value',
+ `get_blob_encoded_size' and replaced with the proper functions
+ from metadata.c
+
+2001-07-15 Miguel de Icaza <miguel@ximian.com>
+
+ * main.c (dis_code): Only display .entrypoint when we are dealing
+ with a module that contains an entry point. This removes a bunch
+ of warnings for .dll dumping
+
+Sun Jul 15 17:29:10 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * get.h,get.c: added some dis_stringify_object() functions:
+ metadata decoding is now done in libmetadata. Still need to use
+ them throughhout the code (and move other decode code to
+ metadata). Fix also field decoding (band-aid until we load
+ also referenced assemblies).
+ * dis/main.c: start using the new routines.
+
+2001-07-13 Miguel de Icaza <miguel@ximian.com>
+
+ * get.c (get_method): GOOD. Implemented this other bad boy.
+
+2001-07-12 Miguel de Icaza <miguel@ximian.com>
+
+ * get.c (get_token_type): Implement TOKEN_TYPE_TYPE_SPEC.
+ (get_typespec): Implement.
+ (get_typedef_or_ref): Use get_typespec.
+
+ * dis-cil.c (dissasemble_cil): Implement InlineField
+ (dissasemble_cil): Implement InlineTok.
+
+ * get.c (get_token, get_field): Implemented. Worked around lame
+ tables in the spec.
+
+Wed Jul 11 18:52:15 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dis-cil.c: output real name of local var.
+ * dump.c: output more info about fields (flags and type). Properly decode
+ Property signatures. Decode also method table.
+ * main.c: Fix local variable info. Hopefully fix field and property list.
+
+Mon Jul 9 16:39:41 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dump.c: write stuff to output, not stderr. Give more info for properties.
+ * dump.c,dump.h,main.c: implement dump_table_event(), dump_table_file(),
+ dump_table_moduleref().
+ * get.c: first attempt to decode string constants, need to find if and where
+ this is actually specified.
+
+Fri Jul 6 19:49:21 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * dump.c,dump.h: implement dump_table_property().
+ * main.c: implement local variable info disassembling.
+ Annotate entrypoint method. Remove memory leak in
+ parse_method_signature ().
+
+2001-07-04 Miguel de Icaza <miguel@ximian.com>
+
+ * get.c (get_methodref_signature): Implement.
+
+ * dump.c (dump_table_memberref): Add memberref dumping.
+
+Tue, 3 Jul 2001 18:32:10 +0200 Paolo Molaro <lupus@ximian.com>
+
+ * main.c: return on failure.
+
+2001-07-02 Miguel de Icaza <miguel@ximian.com>
+
+ * dis-cil.c (get_encoded_user_string): Return a string from the
+ #US heap. o
+
+ * get.c (get_blob_encoded_size): Implement 23.1.4 decoding.
+
+2001-07-01 Miguel de Icaza <miguel@ximian.com>
+
+ * dis-cil.c: New file. CIL opcode dissasembler.
+
+2001-06-27 Miguel de Icaza <miguel@ximian.com>
+
+ * main.c: Split code.
+
+2001-06-22 Miguel de Icaza <miguel@ximian.com>
+
+ * main.c: More work on the disassembler and on the understanding
+ of the metadata file format.
+
diff --git a/mono/dis/Makefile.am b/mono/dis/Makefile.am
index fdb8662c28c..7cf51142868 100644
--- a/mono/dis/Makefile.am
+++ b/mono/dis/Makefile.am
@@ -2,9 +2,30 @@ INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)
bin_PROGRAMS = monodis
+lib_LIBRARIES = libmonodis.a
+
+libmonodis_a_SOURCES = \
+ get.c \
+ get.h \
+ dis-cil.c \
+ dis-cil.h \
+ util.c \
+ util.h
+
monodis_SOURCES = \
- main.c
+ dump.c \
+ dump.h \
+ main.c \
+ meta.h
monodis_LDADD = \
+ libmonodis.a \
../metadata/libmetadata.a \
+ ../io-layer/libwapi.a \
+ ../utils/libmonoutils.a \
+ $(GMODULE_LIBS) \
$(GLIB_LIBS)
+
+man_MANS = monodis.1
+
+EXTRA_DIST = $(man_MANS)
diff --git a/mono/dis/TODO b/mono/dis/TODO
new file mode 100644
index 00000000000..fb42dc0758a
--- /dev/null
+++ b/mono/dis/TODO
@@ -0,0 +1,5 @@
+* Write test cases
+
+ Write test cases to stress test TypeSpec. This is done by
+ creating arrays of various dimensions, sizes, and lower
+ bounds.
diff --git a/mono/dis/dis-cil.c b/mono/dis/dis-cil.c
new file mode 100644
index 00000000000..a250356a0d7
--- /dev/null
+++ b/mono/dis/dis-cil.c
@@ -0,0 +1,272 @@
+/*
+ * dis-cil.c: Disassembles CIL byte codes
+ *
+ * Author:
+ * Miguel de Icaza (miguel@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+#include <config.h>
+#include <glib.h>
+#include <stdio.h>
+#include <wchar.h>
+#include "meta.h"
+#include "get.h"
+#include "dump.h"
+#include "dis-cil.h"
+#include "mono/metadata/opcodes.h"
+
+/*
+ * Strings on the US heap are encoded using UTF-16. Poor man's
+ * UTF-16 to UTF-8. I know its broken, use libunicode later.
+ */
+static char *
+get_encoded_user_string (const char *ptr)
+{
+ char *res;
+ int len, i, j;
+
+ len = mono_metadata_decode_blob_size (ptr, &ptr);
+ res = g_malloc (len + 1);
+
+ /*
+ * I should really use some kind of libunicode here
+ */
+ for (i = 0, j = 0; i < len; j++, i += 2)
+ res [j] = ptr [i];
+
+ res [j] = 0;
+
+ return res;
+}
+
+#define CODE_INDENT g_assert (indent_level < 512); \
+ indent[indent_level*2] = ' '; \
+ indent[indent_level*2+1] = ' '; \
+ ++indent_level; \
+ indent[indent_level*2] = 0;
+#define CODE_UNINDENT g_assert (indent_level); \
+ --indent_level; \
+ indent[indent_level*2] = 0;
+
+void
+dissasemble_cil (MonoImage *m, MonoMethodHeader *mh)
+{
+ const unsigned char *start = mh->code;
+ int size = mh->code_size;
+ const unsigned char *end = start + size;
+ const unsigned char *ptr = start;
+ const MonoOpcode *entry;
+ char indent[1024];
+ int i, indent_level = 0;
+ const char *clause_names[] = {"catch", "filter", "finally", "fault"};
+
+ indent [0] = 0;
+
+#ifdef DEBUG
+ for (i = 0; i < mh->num_clauses; ++i) {
+#define clause mh->clauses [i]
+ g_print ("out clause %d: from %d len=%d, handler at %d, %d\n",
+ clause.flags, clause.try_offset, clause.try_len, clause.handler_offset, clause.handler_len);
+#undef clause
+ }
+#endif
+ while (ptr < end){
+ for (i = mh->num_clauses - 1; i >= 0 ; --i) {
+ if ((mh->clauses[i].flags == 0 || mh->clauses[i].flags == 2) && ptr == start + mh->clauses[i].try_offset) {
+ fprintf (output, "\t%s.try { // %d\n", indent, i);
+ CODE_INDENT;
+ }
+ if (ptr == start + mh->clauses[i].handler_offset) {
+ char * klass = mh->clauses[i].flags ? g_strdup ("") : dis_stringify_token (m, mh->clauses[i].token_or_filter);
+ fprintf (output, "\t%s%s %s { // %d\n", indent, clause_names [mh->clauses[i].flags], klass, i);
+ CODE_INDENT;
+ g_free (klass);
+ }
+ }
+ fprintf (output, "\t%sIL_%04x: ", indent, (int) (ptr - start));
+ i = *ptr;
+ if (*ptr == 0xfe){
+ ptr++;
+ i = *ptr + 256;
+ }
+ entry = &mono_opcodes [i];
+
+ fprintf (output, "%s ", mono_opcode_names [i]);
+ ptr++;
+ switch (entry->argument){
+ case MonoInlineBrTarget: {
+ gint target = read32 (ptr);
+ fprintf (output, "IL_%04x\n", ((int) (ptr - start)) + 4 + target);
+ ptr += 4;
+ break;
+ }
+
+ case MonoInlineField: {
+ guint32 token = read32 (ptr);
+ char *s;
+
+ s = get_field (m, token);
+ fprintf (output, "%s", s);
+ g_free (s);
+ ptr += 4;
+ break;
+ }
+
+ case MonoInlineI: {
+ int value = read32 (ptr);
+
+ fprintf (output, "%d", value);
+ ptr += 4;
+ break;
+ }
+
+ case MonoInlineI8: {
+ gint64 top = read64 (ptr);
+
+ fprintf (output, "0x%llx", (long long) top);
+ ptr += 8;
+ break;
+ }
+
+ case MonoInlineMethod: {
+ guint32 token = read32 (ptr);
+ char *s;
+
+ s = get_method (m, token);
+ fprintf (output, "%s", s);
+ g_free (s);
+ ptr += 4;
+ break;
+ }
+
+ case MonoInlineNone:
+ break;
+
+ case MonoInlineR: {
+ double r;
+ readr8 (ptr, &r);
+ fprintf (output, "%g", r);
+ ptr += 8;
+ break;
+ }
+
+ case MonoInlineSig: {
+ guint32 token = read32 (ptr);
+ fprintf (output, "signature-0x%08x", token);
+ ptr += 4;
+ break;
+ }
+
+ case MonoInlineString: {
+ guint32 token = read32 (ptr);
+
+ char *s = get_encoded_user_string (
+ mono_metadata_user_string (m, token & 0xffffff));
+
+ /*
+ * See section 23.1.4 on the encoding of the #US heap
+ */
+ fprintf (output, "\"%s\"", s);
+ g_free (s);
+ ptr += 4;
+ break;
+ }
+
+ case MonoInlineSwitch: {
+ guint32 count = read32 (ptr);
+ const unsigned char *endswitch;
+ guint32 n;
+
+ ptr += 4;
+ endswitch = ptr + sizeof (guint32) * count;
+ fprintf (output, "(\n");
+ CODE_INDENT;
+ for (n = 0; n < count; n++){
+ fprintf (output, "\t%sIL_%04x%s", indent,
+ endswitch-start+read32 (ptr),
+ n == count - 1 ? ")" : ",\n");
+ ptr += 4;
+ }
+ CODE_UNINDENT;
+ break;
+ }
+
+ case MonoInlineTok: {
+ guint32 token = read32 (ptr);
+ char *s;
+
+ s = get_token (m, token);
+ fprintf (output, "%s", s);
+ g_free (s);
+
+ ptr += 4;
+ break;
+ }
+
+ case MonoInlineType: {
+ guint32 token = read32 (ptr);
+ char *s = get_token_type (m, token);
+ fprintf (output, "%s", s);
+ g_free (s);
+ ptr += 4;
+ break;
+ }
+
+ case MonoInlineVar: {
+ guint16 var_idx = read16 (ptr);
+
+ fprintf (output, "%d\n", var_idx);
+ ptr += 2;
+ break;
+ }
+
+ case MonoShortInlineBrTarget: {
+ signed char x = *ptr;
+
+ fprintf (output, "IL_%04x\n", ptr - start + 1 + x);
+ ptr++;
+ break;
+ }
+
+ case MonoShortInlineI: {
+ char x = *ptr;
+
+ fprintf (output, "0x%02x", x);
+ ptr++;
+ break;
+ }
+
+ case MonoShortInlineR: {
+ float f;
+ readr4 (ptr, &f);
+
+ fprintf (output, "%g", (double) f);
+ ptr += 4;
+ break;
+ }
+
+ case MonoShortInlineVar: {
+ unsigned char x = *ptr;
+
+ fprintf (output, "%d", (int) x);
+ ptr++;
+ break;
+ }
+ default:
+ break;
+ }
+
+ fprintf (output, "\n");
+ for (i = 0; i < mh->num_clauses; ++i) {
+ if ((mh->clauses[i].flags == 0 || mh->clauses[i].flags == 2) && ptr == start + mh->clauses[i].try_offset + mh->clauses[i].try_len) {
+ CODE_UNINDENT;
+ fprintf (output, "\t%s} // end .try %d\n", indent, i);
+ }
+ if (ptr == start + mh->clauses[i].handler_offset + mh->clauses[i].handler_len) {
+ CODE_UNINDENT;
+ fprintf (output, "\t%s} // end handler %d\n", indent, i);
+ }
+ }
+ }
+}
diff --git a/mono/dis/dis-cil.h b/mono/dis/dis-cil.h
new file mode 100644
index 00000000000..09df77658a6
--- /dev/null
+++ b/mono/dis/dis-cil.h
@@ -0,0 +1 @@
+void dissasemble_cil (MonoImage *m, MonoMethodHeader *mh);
diff --git a/mono/dis/dump.c b/mono/dis/dump.c
new file mode 100644
index 00000000000..20666dd7e50
--- /dev/null
+++ b/mono/dis/dump.c
@@ -0,0 +1,784 @@
+/*
+ * dump.c: Dumping routines for the disassembler.
+ *
+ * Author:
+ * Miguel de Icaza (miguel@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+#include "meta.h"
+#include "util.h"
+#include "dump.h"
+#include "get.h"
+#include "mono/metadata/loader.h"
+#include "mono/metadata/class.h"
+
+void
+dump_table_assembly (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_ASSEMBLY];
+ guint32 cols [MONO_ASSEMBLY_SIZE];
+ const char *ptr;
+ int len;
+
+ mono_metadata_decode_row (t, 0, cols, MONO_ASSEMBLY_SIZE);
+ fprintf (output, "Assembly Table\n");
+
+ fprintf (output, "Name: %s\n", mono_metadata_string_heap (m, cols [MONO_ASSEMBLY_NAME]));
+ fprintf (output, "Hash Algoritm: 0x%08x\n", cols [MONO_ASSEMBLY_HASH_ALG]);
+ fprintf (output, "Version: %d.%d.%d.%d\n", cols [MONO_ASSEMBLY_MAJOR_VERSION],
+ cols [MONO_ASSEMBLY_MINOR_VERSION],
+ cols [MONO_ASSEMBLY_BUILD_NUMBER],
+ cols [MONO_ASSEMBLY_REV_NUMBER]);
+ fprintf (output, "Flags: 0x%08x\n", cols [MONO_ASSEMBLY_FLAGS]);
+ fprintf (output, "PublicKey: BlobPtr (0x%08x)\n", cols [MONO_ASSEMBLY_PUBLIC_KEY]);
+
+ ptr = mono_metadata_blob_heap (m, cols [MONO_ASSEMBLY_PUBLIC_KEY]);
+ len = mono_metadata_decode_value (ptr, &ptr);
+ if (len > 0){
+ fprintf (output, "\tDump:");
+ hex_dump (ptr, 0, len);
+ fprintf (output, "\n");
+ } else
+ fprintf (output, "\tZero sized public key\n");
+
+ fprintf (output, "Culture: %s\n", mono_metadata_string_heap (m, cols [MONO_ASSEMBLY_CULTURE]));
+ fprintf (output, "\n");
+}
+
+void
+dump_table_typeref (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_TYPEREF];
+ int i;
+
+ fprintf (output, "Typeref Table\n");
+
+ for (i = 1; i <= t->rows; i++){
+ char *s = get_typeref (m, i);
+
+ fprintf (output, "%d: %s\n", i, s);
+ g_free (s);
+ }
+ fprintf (output, "\n");
+}
+
+void
+dump_table_typedef (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_TYPEDEF];
+ int i;
+
+ fprintf (output, "Typedef Table\n");
+
+ for (i = 1; i <= t->rows; i++){
+ char *s = get_typedef (m, i);
+ guint32 cols [MONO_TYPEDEF_SIZE];
+
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_TYPEDEF], i - 1, cols, MONO_TYPEDEF_SIZE);
+
+ fprintf (output, "%d: %s (flist=%d, mlist=%d, flags=0x%x, extends=0x%x)\n", i, s,
+ cols [MONO_TYPEDEF_FIELD_LIST], cols [MONO_TYPEDEF_METHOD_LIST],
+ cols [MONO_TYPEDEF_FLAGS], cols [MONO_TYPEDEF_EXTENDS]);
+ g_free (s);
+ }
+ fprintf (output, "\n");
+}
+
+void
+dump_table_assemblyref (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_ASSEMBLYREF];
+ int i;
+
+ fprintf (output, "AssemblyRef Table\n");
+
+ for (i = 0; i < t->rows; i++){
+ const char *ptr;
+ int len;
+ guint32 cols [MONO_ASSEMBLYREF_SIZE];
+
+ mono_metadata_decode_row (t, i, cols, MONO_ASSEMBLYREF_SIZE);
+ fprintf (output, "%d: Version=%d.%d.%d.%d\n\tName=%s\n", i + 1,
+ cols [MONO_ASSEMBLYREF_MAJOR_VERSION],
+ cols [MONO_ASSEMBLYREF_MINOR_VERSION],
+ cols [MONO_ASSEMBLYREF_BUILD_NUMBER],
+ cols [MONO_ASSEMBLYREF_REV_NUMBER],
+ mono_metadata_string_heap (m, cols [MONO_ASSEMBLYREF_NAME]));
+ ptr = mono_metadata_blob_heap (m, cols [MONO_ASSEMBLYREF_PUBLIC_KEY]);
+ len = mono_metadata_decode_value (ptr, &ptr);
+ if (len > 0){
+ fprintf (output, "\tPublic Key:");
+ hex_dump (ptr, 0, len);
+ fprintf (output, "\n");
+ } else
+ fprintf (output, "\tZero sized public key\n");
+
+ }
+ fprintf (output, "\n");
+}
+
+void
+dump_table_param (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_PARAM];
+ int i;
+
+ fprintf (output, "Param Table\n");
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_PARAM_SIZE];
+
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
+ fprintf (output, "%d: 0x%04x %d %s\n",
+ i + 1,
+ cols [MONO_PARAM_FLAGS], cols [MONO_PARAM_SEQUENCE],
+ mono_metadata_string_heap (m, cols [MONO_PARAM_NAME]));
+ }
+ fprintf (output, "\n");
+}
+
+void
+dump_table_field (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_FIELD];
+ MonoTableInfo *td = &m->tables [MONO_TABLE_TYPEDEF];
+ MonoTableInfo *fl = &m->tables [MONO_TABLE_FIELDLAYOUT];
+ MonoTableInfo *rva = &m->tables [MONO_TABLE_FIELDRVA];
+ int i, current_type, offset_row, rva_row;
+ guint32 first_m, last_m;
+
+ fprintf (output, "Field Table (1..%d)\n", t->rows);
+
+ rva_row = offset_row = current_type = 1;
+ last_m = first_m = 1;
+ for (i = 1; i <= t->rows; i++){
+ guint32 cols [MONO_FIELD_SIZE];
+ char *sig, *flags;
+
+ /*
+ * Find the next type.
+ */
+ while (current_type <= td->rows && i >= (last_m = mono_metadata_decode_row_col (td, current_type - 1, MONO_TYPEDEF_FIELD_LIST))) {
+ current_type++;
+ }
+ if (i == first_m) {
+ fprintf (output, "########## %s.%s\n",
+ mono_metadata_string_heap (m, mono_metadata_decode_row_col (td, current_type - 2, MONO_TYPEDEF_NAMESPACE)),
+ mono_metadata_string_heap (m, mono_metadata_decode_row_col (td, current_type - 2, MONO_TYPEDEF_NAME)));
+ first_m = last_m;
+ }
+ mono_metadata_decode_row (t, i - 1, cols, MONO_FIELD_SIZE);
+ sig = get_field_signature (m, cols [MONO_FIELD_SIGNATURE]);
+ flags = field_flags (cols [MONO_FIELD_FLAGS]);
+ fprintf (output, "%d: %s %s: %s\n",
+ i,
+ sig,
+ mono_metadata_string_heap (m, cols [MONO_FIELD_NAME]),
+ flags);
+ g_free (sig);
+ g_free (flags);
+ if (offset_row <= fl->rows && (mono_metadata_decode_row_col (fl, offset_row - 1, MONO_FIELD_LAYOUT_FIELD) == i)) {
+ fprintf (output, "\texplicit offset: %d\n", mono_metadata_decode_row_col (fl, offset_row - 1, MONO_FIELD_LAYOUT_OFFSET));
+ offset_row ++;
+ }
+ if (rva_row <= rva->rows && (mono_metadata_decode_row_col (rva, rva_row - 1, MONO_FIELD_RVA_FIELD) == i)) {
+ fprintf (output, "\trva: %d\n", mono_metadata_decode_row_col (rva, rva_row - 1, MONO_FIELD_RVA_RVA));
+ rva_row ++;
+ }
+ }
+ fprintf (output, "\n");
+}
+
+void
+dump_table_memberref (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_MEMBERREF];
+ int i, kind, idx;
+ char *x, *xx;
+ char *sig;
+ const char *blob, *ks;
+
+ fprintf (output, "MemberRef Table (1..%d)\n", t->rows);
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_MEMBERREF_SIZE];
+
+ mono_metadata_decode_row (t, i, cols, MONO_MEMBERREF_SIZE);
+
+ kind = cols [MONO_MEMBERREF_CLASS] & 7;
+ idx = cols [MONO_MEMBERREF_CLASS] >> 3;
+
+ x = g_strdup ("UNHANDLED CASE");
+
+ switch (kind){
+ case 0:
+ ks = "TypeDef"; break;
+ case 1:
+ ks = "TypeRef";
+ xx = get_typeref (m, idx);
+ x = g_strconcat (xx, ".", mono_metadata_string_heap (m, cols [MONO_MEMBERREF_NAME]), NULL);
+ g_free (xx);
+ break;
+ case 2:
+ ks = "ModuleRef"; break;
+ case 3:
+ ks = "MethodDef"; break;
+ case 4:
+ ks = "TypeSpec";
+ xx = get_typespec (m, idx);
+ x = g_strconcat (xx, ".", mono_metadata_string_heap (m, cols [MONO_MEMBERREF_NAME]), NULL);
+ g_free (xx);
+ break;
+ default:
+ g_error ("Unknown tag: %d\n", kind);
+ }
+ blob = mono_metadata_blob_heap (m, cols [MONO_MEMBERREF_SIGNATURE]);
+ mono_metadata_decode_blob_size (blob, &blob);
+ if (*blob == 0x6) { /* it's a field */
+ sig = get_field_signature (m, cols [MONO_MEMBERREF_SIGNATURE]);
+ } else {
+ sig = get_methodref_signature (m, cols [MONO_MEMBERREF_SIGNATURE], NULL);
+ }
+ fprintf (output, "%d: %s[%d] %s\n\tResolved: %s\n\tSignature: %s\n\t\n",
+ i + 1,
+ ks, idx,
+ mono_metadata_string_heap (m, cols [MONO_MEMBERREF_NAME]),
+ x ? x : "",
+ sig);
+
+ if (x)
+ g_free (x);
+ g_free (sig);
+ }
+}
+
+void
+dump_table_class_layout (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_CLASSLAYOUT];
+ int i;
+ fprintf (output, "ClassLayout Table (1..%d)\n", t->rows);
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_CLASS_LAYOUT_SIZE];
+
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
+
+ fprintf (output, "%d: PackingSize=%d ClassSize=%d Parent=%s\n",
+ i + 1, cols [MONO_CLASS_LAYOUT_PACKING_SIZE],
+ cols [MONO_CLASS_LAYOUT_CLASS_SIZE],
+ get_typedef (m, cols [MONO_CLASS_LAYOUT_PARENT]));
+ }
+}
+
+void
+dump_table_constant (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_CONSTANT];
+ int i;
+ const char *desc [] = {
+ "Field",
+ "Param",
+ "Property",
+ ""
+ };
+ fprintf (output, "Constant Table (1..%d)\n", t->rows);
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_CONSTANT_SIZE];
+ const char *parent = desc [cols [MONO_CONSTANT_PARENT] & HASCONSTANT_MASK];
+
+ mono_metadata_decode_row (t, i, cols, MONO_CONSTANT_SIZE);
+
+ fprintf (output, "%d: Parent= %s: %d %s\n",
+ i + 1, parent, cols [MONO_CONSTANT_PARENT] >> HASCONSTANT_BITS,
+ get_constant (m, (MonoTypeEnum) cols [MONO_CONSTANT_TYPE], cols [MONO_CONSTANT_VALUE]));
+ }
+
+}
+
+void
+dump_table_property_map (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_PROPERTYMAP];
+ int i;
+ char *s;
+
+ fprintf (output, "Property Map Table (1..%d)\n", t->rows);
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_PROPERTY_MAP_SIZE];
+
+ mono_metadata_decode_row (t, i, cols, MONO_PROPERTY_MAP_SIZE);
+ s = get_typedef (m, cols [MONO_PROPERTY_MAP_PARENT]);
+ fprintf (output, "%d: %s %d\n", i + 1, s, cols [MONO_PROPERTY_MAP_PROPERTY_LIST]);
+ g_free (s);
+ }
+}
+
+void
+dump_table_property (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_PROPERTY];
+ int i, j, pcount;
+ const char *ptr;
+ char flags[128];
+
+ fprintf (output, "Property Table (1..%d)\n", t->rows);
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_PROPERTY_SIZE];
+ char *type;
+ int bsize;
+ int prop_flags;
+
+ mono_metadata_decode_row (t, i, cols, MONO_PROPERTY_SIZE);
+ flags [0] = 0;
+ prop_flags = cols [MONO_PROPERTY_FLAGS];
+ if (prop_flags & 0x0200)
+ strcat (flags, "special ");
+ if (prop_flags & 0x0400)
+ strcat (flags, "runtime ");
+ if (prop_flags & 0x1000)
+ strcat (flags, "hasdefault ");
+
+ ptr = mono_metadata_blob_heap (m, cols [MONO_PROPERTY_TYPE]);
+ bsize = mono_metadata_decode_blob_size (ptr, &ptr);
+ /* ECMA claims 0x08 ... */
+ if (*ptr != 0x28 && *ptr != 0x08)
+ g_warning("incorrect signature in propert blob: 0x%x", *ptr);
+ ptr++;
+ pcount = mono_metadata_decode_value (ptr, &ptr);
+ ptr = get_type (m, ptr, &type);
+ fprintf (output, "%d: %s %s (",
+ i + 1, type, mono_metadata_string_heap (m, cols [MONO_PROPERTY_NAME]));
+ g_free (type);
+
+ for (j = 0; j < pcount; j++){
+ ptr = get_param (m, ptr, &type);
+ fprintf (output, "%s%s", j > 0? ", " : "",type);
+ g_free (type);
+ }
+ fprintf (output, ") %s\n", flags);
+ }
+}
+
+void
+dump_table_event (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_EVENT];
+ int i;
+ fprintf (output, "Event Table (1..%d)\n", t->rows);
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_EVENT_SIZE];
+ const char *name;
+ char *type;
+
+ mono_metadata_decode_row (t, i, cols, MONO_EVENT_SIZE);
+
+ name = mono_metadata_string_heap (m, cols [MONO_EVENT_NAME]);
+ type = get_typedef_or_ref (m, cols [MONO_EVENT_TYPE]);
+ fprintf (output, "%d: %s %s %s\n", i + 1, type, name,
+ cols [MONO_EVENT_FLAGS] & 0x200 ? "specialname " : "");
+ g_free (type);
+ }
+
+}
+
+void
+dump_table_file (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_FILE];
+ int i;
+ fprintf (output, "File Table (1..%d)\n", t->rows);
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_FILE_SIZE];
+ const char *name;
+
+ mono_metadata_decode_row (t, i, cols, MONO_FILE_SIZE);
+
+ name = mono_metadata_string_heap (m, cols [MONO_FILE_NAME]);
+ fprintf (output, "%d: %s %s\n", i + 1, name,
+ cols [MONO_FILE_FLAGS] & 0x1 ? "nometadata" : "containsmetadata");
+ }
+
+}
+
+void
+dump_table_moduleref (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_MODULEREF];
+ int i;
+ fprintf (output, "ModuleRef Table (1..%d)\n", t->rows);
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_MODULEREF_SIZE];
+ const char *name;
+
+ mono_metadata_decode_row (t, i, cols, MONO_MODULEREF_SIZE);
+
+ name = mono_metadata_string_heap (m, cols [MONO_MODULEREF_NAME]);
+ fprintf (output, "%d: %s\n", i + 1, name);
+ }
+
+}
+
+void
+dump_table_module (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_MODULE];
+ int i;
+ fprintf (output, "ModuleRef Table (1..%d)\n", t->rows);
+
+ for (i = 0; i < t->rows; i++){
+ guint32 cols [MONO_MODULE_SIZE];
+ const char *name;
+ char *guid;
+
+ mono_metadata_decode_row (t, i, cols, MONO_MODULE_SIZE);
+
+ name = mono_metadata_string_heap (m, cols [MONO_MODULE_NAME]);
+ guid = get_guid (m, cols [MONO_MODULE_MVID]);
+ fprintf (output, "%d: %s %d %s\n", i + 1, name, cols [MONO_MODULE_MVID], guid);
+ }
+
+}
+
+void
+dump_table_method (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_METHOD];
+ MonoTableInfo *td = &m->tables [MONO_TABLE_TYPEDEF];
+ int i, current_type;
+ guint32 first_m, last_m;
+ fprintf (output, "Method Table (1..%d)\n", t->rows);
+
+ current_type = 1;
+ last_m = first_m = 1;
+ for (i = 1; i <= t->rows; i++){
+ guint32 cols [MONO_METHOD_SIZE];
+ char *sig;
+ const char *sigblob;
+ MonoMethodSignature *method;
+
+ /*
+ * Find the next type.
+ */
+ while (current_type <= td->rows && i >= (last_m = mono_metadata_decode_row_col (td, current_type - 1, MONO_TYPEDEF_METHOD_LIST))) {
+ current_type++;
+ }
+ if (i == first_m) {
+ fprintf (output, "########## %s.%s\n",
+ mono_metadata_string_heap (m, mono_metadata_decode_row_col (td, current_type - 2, MONO_TYPEDEF_NAMESPACE)),
+ mono_metadata_string_heap (m, mono_metadata_decode_row_col (td, current_type - 2, MONO_TYPEDEF_NAME)));
+ first_m = last_m;
+ }
+ mono_metadata_decode_row (t, i - 1, cols, MONO_METHOD_SIZE);
+ sigblob = mono_metadata_blob_heap (m, cols [MONO_METHOD_SIGNATURE]);
+ mono_metadata_decode_blob_size (sigblob, &sigblob);
+ method = mono_metadata_parse_method_signature (m, 1, sigblob, &sigblob);
+ sig = dis_stringify_method_signature (m, method, i);
+ fprintf (output, "%d: %s (param: %d)\n", i, sig, cols [MONO_METHOD_PARAMLIST]);
+ g_free (sig);
+ mono_metadata_free_method_signature (method);
+ }
+
+}
+
+static map_t semantics_map [] = {
+ {1, "setter"},
+ {2, "getter"},
+ {4, "other"},
+ {8, "add-on"},
+ {0x10, "remove-on"},
+ {0x20, "fire"},
+ {0, NULL},
+};
+
+void
+dump_table_methodsem (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_METHODSEMANTICS];
+ int i, is_property, index;
+ const char *semantics;
+
+ fprintf (output, "Method Semantics Table (1..%d)\n", t->rows);
+ for (i = 1; i <= t->rows; i++){
+ guint32 cols [MONO_METHOD_SEMA_SIZE];
+
+ mono_metadata_decode_row (t, i - 1, cols, MONO_METHOD_SEMA_SIZE);
+ semantics = flags (cols [MONO_METHOD_SEMA_SEMANTICS], semantics_map);
+ is_property = cols [MONO_METHOD_SEMA_ASSOCIATION] & HAS_SEMANTICS_MASK;
+ index = cols [MONO_METHOD_SEMA_ASSOCIATION] >> HAS_SEMANTICS_BITS;
+ fprintf (output, "%d: [%d] %s method: %d %s %d\n", i, cols [MONO_METHOD_SEMA_ASSOCIATION], semantics,
+ cols [MONO_METHOD_SEMA_METHOD] - 1,
+ is_property? "property" : "event",
+ index);
+ }
+}
+
+void
+dump_table_interfaceimpl (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_INTERFACEIMPL];
+ int i;
+
+ fprintf (output, "Interface Implementation Table (1..%d)\n", t->rows);
+ for (i = 1; i <= t->rows; i++) {
+ guint32 cols [MONO_INTERFACEIMPL_SIZE];
+
+ mono_metadata_decode_row (t, i - 1, cols, MONO_INTERFACEIMPL_SIZE);
+ fprintf (output, "%d: %s implements %s\n", i,
+ get_typedef (m, cols [MONO_INTERFACEIMPL_CLASS]),
+ get_typedef_or_ref (m, cols [MONO_INTERFACEIMPL_INTERFACE]));
+ }
+}
+
+static char*
+has_cattr_get_table (MonoImage *m, guint32 val)
+{
+ guint32 t = val & CUSTOM_ATTR_MASK;
+ guint32 index = val >> CUSTOM_ATTR_BITS;
+ const char *table;
+
+ switch (t) {
+ case CUSTOM_ATTR_METHODDEF:
+ table = "MethodDef";
+ break;
+ case CUSTOM_ATTR_FIELDDEF:
+ table = "FieldDef";
+ break;
+ case CUSTOM_ATTR_TYPEREF:
+ table = "TypeRef";
+ break;
+ case CUSTOM_ATTR_TYPEDEF:
+ table = "TypeDef";
+ break;
+ case CUSTOM_ATTR_PARAMDEF:
+ table = "Param";
+ break;
+ case CUSTOM_ATTR_INTERFACE:
+ table = "InterfaceImpl";
+ break;
+ case CUSTOM_ATTR_MEMBERREF:
+ table = "MemberRef";
+ break;
+ case CUSTOM_ATTR_MODULE:
+ table = "Module";
+ break;
+ case CUSTOM_ATTR_PERMISSION:
+ table = "DeclSecurity?";
+ break;
+ case CUSTOM_ATTR_PROPERTY:
+ table = "Property";
+ break;
+ case CUSTOM_ATTR_EVENT:
+ table = "Event";
+ break;
+ case CUSTOM_ATTR_SIGNATURE:
+ table = "StandAloneSignature";
+ break;
+ case CUSTOM_ATTR_MODULEREF:
+ table = "ModuleRef";
+ break;
+ case CUSTOM_ATTR_TYPESPEC:
+ table = "TypeSpec";
+ break;
+ case CUSTOM_ATTR_ASSEMBLY:
+ table = "Assembly";
+ break;
+ case CUSTOM_ATTR_ASSEMBLYREF:
+ table = "AssemblyRef";
+ break;
+ case CUSTOM_ATTR_FILE:
+ table = "File";
+ break;
+ case CUSTOM_ATTR_EXP_TYPE:
+ table = "ExportedType";
+ break;
+ case CUSTOM_ATTR_MANIFEST:
+ table = "Manifest";
+ break;
+ default:
+ table = "Unknown";
+ break;
+ }
+ /*
+ * FIXME: we should decode the index into something more uman-friendly.
+ */
+ return g_strdup_printf ("%s: %d", table, index);
+}
+
+static char*
+custom_attr_params (MonoImage *m, MonoMethodSignature* sig, const char* value)
+{
+ int len, i, slen, type;
+ GString *res;
+ char *s;
+ const char *p = value;
+
+ len = mono_metadata_decode_value (p, &p);
+ if (len < 2 || read16 (p) != 0x0001) /* Prolog */
+ return g_strdup ("");
+
+ /* skip prolog */
+ p += 2;
+ res = g_string_new ("");
+ for (i = 0; i < sig->param_count; ++i) {
+ if (i != 0)
+ g_string_append (res, ", ");
+ type = sig->params [i]->type;
+handle_enum:
+ switch (type) {
+ case MONO_TYPE_U1:
+ g_string_sprintfa (res, "%d", (unsigned int)*p);
+ ++p;
+ break;
+ case MONO_TYPE_I1:
+ g_string_sprintfa (res, "%d", *p);
+ ++p;
+ break;
+ case MONO_TYPE_BOOLEAN:
+ g_string_sprintfa (res, "%s", *p?"true":"false");
+ ++p;
+ break;
+ case MONO_TYPE_CHAR:
+ g_string_sprintfa (res, "'%c'", read16 (p));
+ p += 2;
+ break;
+ case MONO_TYPE_U2:
+ g_string_sprintfa (res, "%d", read16 (p));
+ p += 2;
+ break;
+ case MONO_TYPE_I2:
+ g_string_sprintfa (res, "%d", (gint16)read16 (p));
+ p += 2;
+ break;
+ case MONO_TYPE_U4:
+ g_string_sprintfa (res, "%d", read32 (p));
+ p += 4;
+ break;
+ case MONO_TYPE_I4:
+ g_string_sprintfa (res, "%d", (gint32)read32 (p));
+ p += 4;
+ break;
+ case MONO_TYPE_U8:
+ g_string_sprintfa (res, "%lld", read64 (p));
+ p += 8;
+ break;
+ case MONO_TYPE_I8:
+ g_string_sprintfa (res, "%lld", (gint64)read64 (p));
+ p += 8;
+ break;
+ case MONO_TYPE_R4: {
+ float val;
+ readr4 (p, &val);
+ g_string_sprintfa (res, "%g", val);
+ p += 4;
+ break;
+ }
+ case MONO_TYPE_R8: {
+ double val;
+ readr8 (p, &val);
+ g_string_sprintfa (res, "%g", val);
+ p += 8;
+ break;
+ }
+ case MONO_TYPE_VALUETYPE:
+ if (sig->params [i]->data.klass->enumtype) {
+ type = sig->params [i]->data.klass->enum_basetype->type;
+ goto handle_enum;
+ } else {
+ g_warning ("generic valutype not handled in custom attr value decoding");
+ }
+ break;
+ case MONO_TYPE_CLASS: /* It must be a Type: check? */
+ case MONO_TYPE_STRING:
+ slen = mono_metadata_decode_value (p, &p);
+ g_string_append_c (res, '"');
+ g_string_append (res, p);
+ g_string_append_c (res, '"');
+ p += slen;
+ break;
+ default:
+ g_warning ("Type %02x not handled in custom attr value decoding", sig->params [i]->type);
+ break;
+ }
+ }
+ /*
+ * FIXME: handle named args only when all the type are handled in fixed args.
+ * slen = read16 (p);
+ */
+ s = res->str;
+ g_string_free (res, FALSE);
+ return s;
+}
+
+void
+dump_table_customattr (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_CUSTOMATTRIBUTE];
+ int i;
+
+ fprintf (output, "Custom Attributes Table (1..%d)\n", t->rows);
+ for (i = 1; i <= t->rows; i++) {
+ guint32 cols [MONO_CUSTOM_ATTR_SIZE];
+ guint32 mtoken;
+ char * desc;
+ char *method;
+ char *params;
+ MonoMethod *meth;
+
+ mono_metadata_decode_row (t, i - 1, cols, MONO_CUSTOM_ATTR_SIZE);
+ desc = has_cattr_get_table (m, cols [MONO_CUSTOM_ATTR_PARENT]);
+ mtoken = cols [MONO_CUSTOM_ATTR_TYPE] >> CUSTOM_ATTR_TYPE_BITS;
+ switch (cols [MONO_CUSTOM_ATTR_TYPE] & CUSTOM_ATTR_TYPE_MASK) {
+ case CUSTOM_ATTR_TYPE_METHODDEF:
+ mtoken |= MONO_TOKEN_METHOD_DEF;
+ break;
+ case CUSTOM_ATTR_TYPE_MEMBERREF:
+ mtoken |= MONO_TOKEN_MEMBER_REF;
+ break;
+ default:
+ g_warning ("Unknown table for custom attr type %08x", cols [MONO_CUSTOM_ATTR_TYPE]);
+ break;
+ }
+ method = get_method (m, mtoken);
+ meth = mono_get_method (m, mtoken, NULL);
+ params = custom_attr_params (m, meth->signature, mono_metadata_blob_heap (m, cols [MONO_CUSTOM_ATTR_VALUE]));
+ fprintf (output, "%d: %s: %s [%s]\n", i, desc, method, params);
+ g_free (desc);
+ g_free (method);
+ g_free (params);
+ }
+}
+
+void
+dump_table_nestedclass (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_NESTEDCLASS];
+ guint32 cols [MONO_NESTED_CLASS_SIZE];
+ int i;
+ char *nested, *nesting;
+ fprintf (output, "NestedClass Table (1..%d)\n", t->rows);
+
+ for (i = 1; i <= t->rows; i++){
+ mono_metadata_decode_row (t, i - 1, cols, MONO_NESTED_CLASS_SIZE);
+ nested = get_typedef (m, cols [MONO_NESTED_CLASS_NESTED]);
+ nesting = get_typedef (m, cols [MONO_NESTED_CLASS_ENCLOSING]);
+ fprintf (output, "%d: %d %d: %s in %s\n", i,
+ cols [MONO_NESTED_CLASS_NESTED],
+ cols [MONO_NESTED_CLASS_ENCLOSING], nested, nesting);
+ g_free (nested);
+ g_free (nesting);
+ }
+
+}
+
diff --git a/mono/dis/dump.h b/mono/dis/dump.h
new file mode 100644
index 00000000000..87dbac97d4e
--- /dev/null
+++ b/mono/dis/dump.h
@@ -0,0 +1,22 @@
+extern FILE *output;
+
+void dump_table_assembly (MonoImage *m);
+void dump_table_assemblyref (MonoImage *m);
+void dump_table_class_layout (MonoImage *m);
+void dump_table_constant (MonoImage *m);
+void dump_table_customattr (MonoImage *m);
+void dump_table_property (MonoImage *m);
+void dump_table_property_map (MonoImage *m);
+void dump_table_event (MonoImage *m);
+void dump_table_file (MonoImage *m);
+void dump_table_moduleref (MonoImage *m);
+void dump_table_module (MonoImage *m);
+void dump_table_method (MonoImage *m);
+void dump_table_methodsem (MonoImage *m);
+void dump_table_field (MonoImage *m);
+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_nestedclass (MonoImage *m);
+void dump_table_interfaceimpl (MonoImage *m);
diff --git a/mono/dis/get.c b/mono/dis/get.c
new file mode 100644
index 00000000000..0a5049b18fb
--- /dev/null
+++ b/mono/dis/get.c
@@ -0,0 +1,1222 @@
+/*
+ * get.c: Functions to get stringified values from the metadata tables.
+ *
+ * Author:
+ * Miguel de Icaza (miguel@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <glib.h>
+#include "meta.h"
+#include "util.h"
+#include "get.h"
+#include <mono/metadata/class.h>
+
+extern gboolean substitute_with_mscorlib_p;
+
+char *
+get_typedef (MonoImage *m, int idx)
+{
+ guint32 cols [MONO_TYPEDEF_SIZE];
+
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_TYPEDEF], idx - 1, cols, MONO_TYPEDEF_SIZE);
+
+ return g_strdup_printf (
+ "%s.%s",
+ mono_metadata_string_heap (m, cols [MONO_TYPEDEF_NAMESPACE]),
+ mono_metadata_string_heap (m, cols [MONO_TYPEDEF_NAME]));
+}
+
+char *
+get_module (MonoImage *m, int idx)
+{
+ guint32 cols [MONO_MODULE_SIZE];
+
+ /*
+ * There MUST BE only one module in the Module table
+ */
+ g_assert (idx == 1);
+
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_MODULEREF], idx - 1, cols, MONO_MODULE_SIZE);
+
+ return g_strdup (mono_metadata_string_heap (m, cols [MONO_MODULE_NAME]));
+}
+
+char *
+get_assemblyref (MonoImage *m, int idx)
+{
+ guint32 cols [MONO_ASSEMBLYREF_SIZE];
+
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_ASSEMBLYREF], idx - 1, cols, MONO_ASSEMBLYREF_SIZE);
+
+ return g_strdup (mono_metadata_string_heap (m, cols [MONO_ASSEMBLYREF_NAME]));
+}
+
+/*
+ *
+ * Returns a string representing the ArrayShape (22.2.16).
+ */
+static const char *
+get_array_shape (MonoImage *m, const char *ptr, char **result)
+{
+ GString *res = g_string_new ("[");
+ guint32 rank, num_sizes, num_lo_bounds;
+ guint32 *sizes = NULL, *lo_bounds = NULL;
+ int i, r;
+ char buffer [80];
+
+ rank = mono_metadata_decode_value (ptr, &ptr);
+ num_sizes = mono_metadata_decode_value (ptr, &ptr);
+
+ if (num_sizes > 0)
+ sizes = g_new (guint32, num_sizes);
+
+ for (i = 0; i < num_sizes; i++)
+ sizes [i] = mono_metadata_decode_value (ptr, &ptr);
+
+ num_lo_bounds = mono_metadata_decode_value (ptr, &ptr);
+ if (num_lo_bounds > 0)
+ lo_bounds = g_new (guint32, num_lo_bounds);
+
+ for (i = 0; i < num_lo_bounds; i++)
+ lo_bounds [i] = mono_metadata_decode_value (ptr, &ptr);
+
+ for (r = 0; r < rank; r++){
+ if (r < num_sizes){
+ if (r < num_lo_bounds){
+ sprintf (buffer, "%d..%d", lo_bounds [r], lo_bounds [r] + sizes [r] - 1);
+ } else {
+ sprintf (buffer, "0..%d", sizes [r] - 1);
+ }
+ } else
+ buffer [0] = 0;
+
+ g_string_append (res, buffer);
+ if ((r + 1) != rank)
+ g_string_append (res, ", ");
+ }
+ g_string_append (res, "]");
+
+ if (sizes)
+ g_free (sizes);
+
+ if (lo_bounds)
+ g_free (lo_bounds);
+
+ *result = res->str;
+ g_string_free (res, FALSE);
+
+ return ptr;
+}
+
+/**
+ * get_typespec:
+ * @m: metadata context
+ * @blob_idx: index into the blob heap
+ *
+ * Returns the stringified representation of a TypeSpec signature (22.2.17)
+ */
+char *
+get_typespec (MonoImage *m, guint32 idx)
+{
+ guint32 cols [MONO_TYPESPEC_SIZE];
+ const char *ptr;
+ char *s, *result;
+ GString *res = g_string_new ("");
+ int len;
+
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_TYPESPEC], idx-1, cols, MONO_TYPESPEC_SIZE);
+ ptr = mono_metadata_blob_heap (m, cols [MONO_TYPESPEC_SIGNATURE]);
+ len = mono_metadata_decode_value (ptr, &ptr);
+
+ switch (*ptr++){
+ case MONO_TYPE_PTR:
+ ptr = get_custom_mod (m, ptr, &s);
+ if (s){
+ g_string_append (res, s);
+ g_string_append_c (res, ' ');
+ g_free (s);
+ }
+
+ if (*ptr == MONO_TYPE_VOID)
+ g_string_append (res, "void");
+ else {
+ ptr = get_type (m, ptr, &s);
+ if (s)
+ g_string_append (res, s);
+ }
+ break;
+
+ case MONO_TYPE_FNPTR:
+ g_string_append (res, "FNPTR ");
+ /*
+ * we assume MethodRefSig, as we do not know
+ * whether it is a MethodDefSig or a MethodRefSig.
+ */
+ printf ("\n FNPTR:\n");
+
+ hex_dump (ptr, 0, 40);
+ break;
+
+ case MONO_TYPE_ARRAY:
+ ptr = get_type (m, ptr, &s);
+ g_string_append (res, s);
+ g_free (s);
+ g_string_append_c (res, ' ');
+ ptr = get_array_shape (m, ptr, &s);
+ g_string_append (res, s);
+ g_free (s);
+ break;
+
+ case MONO_TYPE_SZARRAY:
+ ptr = get_custom_mod (m, ptr, &s);
+ if (s){
+ g_string_append (res, s);
+ g_string_append_c (res, ' ');
+ g_free (s);
+ }
+ ptr = get_type (m, ptr, &s);
+ g_string_append (res, s);
+ g_string_append (res, "[]");
+ g_free (s);
+ }
+
+ result = res->str;
+ g_string_free (res, FALSE);
+
+ return result;
+}
+
+char *
+get_typeref (MonoImage *m, int idx)
+{
+ guint32 cols [MONO_TYPEREF_SIZE];
+ const char *s, *t;
+ char *x, *ret;
+ guint32 rs_idx, table;
+
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_TYPEREF], idx - 1, cols, MONO_TYPEREF_SIZE);
+
+ t = mono_metadata_string_heap (m, cols [MONO_TYPEREF_NAME]);
+ s = mono_metadata_string_heap (m, cols [MONO_TYPEREF_NAMESPACE]);
+
+ rs_idx = cols [MONO_TYPEREF_SCOPE] >> 2;
+ /*
+ * Two bits in Beta2.
+ * ECMA spec claims 3 bits
+ */
+ table = cols [MONO_TYPEREF_SCOPE] & 3;
+
+ switch (table){
+ case 0: /* Module */
+ x = get_module (m, rs_idx);
+ ret = g_strdup_printf ("TODO:TypeRef-Module [%s] %s.%s", x, s, t);
+ g_free (x);
+ break;
+
+ case 1: /* ModuleRef */
+ ret = g_strdup_printf ("TODO:TypeRef-ModuleRef (%s.%s)", s, t);
+ break;
+
+ case 2: /*
+ * AssemblyRef (ECMA docs claim it is 3, but it looks to
+ * me like it is 2 (tokens are prefixed with 0x23)
+ */
+ x = get_assemblyref (m, rs_idx);
+ ret = g_strdup_printf ("[%s]%s.%s", x, s, t);
+ g_free (x);
+ break;
+
+ case 4: /* TypeRef */
+ ret = g_strdup_printf ("TODO:TypeRef-TypeRef: TYPEREF! (%s.%s)", s, t);
+ break;
+
+ default:
+ ret = g_strdup_printf ("Unknown table in TypeRef %d", table);
+ }
+
+ return ret;
+}
+
+/**
+ * get_typedef_or_ref:
+ * @m: metadata context
+ * @dor_token: def or ref encoded index
+ *
+ * Low two bits contain table to lookup from
+ * high bits contain the index into the def or ref table
+ *
+ * Returns: a stringified version of the MethodDef or MethodRef
+ * at (dor_token >> 2)
+ */
+char *
+get_typedef_or_ref (MonoImage *m, guint32 dor_token)
+{
+ char *temp = NULL, *s;
+ int table, idx;
+
+ /*
+ * low 2 bits contain encoding
+ */
+ table = dor_token & 0x03;
+ idx = dor_token >> 2;
+
+ switch (table){
+ case 0: /* TypeDef */
+ temp = get_typedef (m, idx);
+ s = g_strdup_printf ("%s", temp);
+ break;
+
+ case 1: /* TypeRef */
+ temp = get_typeref (m, idx);
+ s = g_strdup_printf ("%s", temp);
+ break;
+
+ case 2: /* TypeSpec */
+ s = get_typespec (m, idx);
+ break;
+
+ default:
+ g_error ("Unhandled encoding for typedef-or-ref coded index");
+
+ }
+
+ if (temp)
+ g_free (temp);
+
+ return s;
+}
+
+/**
+ * get_encoded_typedef_or_ref:
+ * @m: metadata context
+ * @ptr: location to decode from.
+ * @result: pointer to string where resulting decoded string is stored
+ *
+ * result will point to a g_malloc()ed string.
+ *
+ * Returns: the new ptr to continue decoding
+ */
+const char *
+get_encoded_typedef_or_ref (MonoImage *m, const char *ptr, char **result)
+{
+ guint32 token;
+
+ token = mono_metadata_decode_value (ptr, &ptr);
+
+ *result = get_typedef_or_ref (m, token);
+
+ return ptr;
+}
+
+/**
+ * get_custom_mod:
+ *
+ * Decodes a CustomMod (22.2.7)
+ *
+ * Returns: updated pointer location
+ */
+const char *
+get_custom_mod (MonoImage *m, const char *ptr, char **return_value)
+{
+ char *s;
+
+ if ((*ptr == MONO_TYPE_CMOD_OPT) ||
+ (*ptr == MONO_TYPE_CMOD_REQD)){
+ ptr++;
+ ptr = get_encoded_typedef_or_ref (m, ptr, &s);
+
+ *return_value = g_strconcat ("CMOD ", s, NULL);
+ g_free (s);
+ } else
+ *return_value = NULL;
+ return ptr;
+}
+
+
+static map_t element_type_map [] = {
+ { MONO_TYPE_END , "end" },
+ { MONO_TYPE_VOID , "void" },
+ { MONO_TYPE_BOOLEAN , "bool" },
+ { MONO_TYPE_CHAR , "char" },
+ { MONO_TYPE_I1 , "int8" },
+ { MONO_TYPE_U1 , "unsigned int8" },
+ { MONO_TYPE_I2 , "int16" },
+ { MONO_TYPE_U2 , "uint16" },
+ { MONO_TYPE_I4 , "int32" },
+ { MONO_TYPE_U4 , "uint32" },
+ { MONO_TYPE_I8 , "int64" },
+ { MONO_TYPE_U8 , "uint64" },
+ { MONO_TYPE_R4 , "float32" },
+ { MONO_TYPE_R8 , "float64" },
+ { MONO_TYPE_STRING , "string" },
+ { MONO_TYPE_TYPEDBYREF , "TypedByRef" },
+ { MONO_TYPE_I , "native int" },
+ { MONO_TYPE_U , "native unsigned int" },
+ { MONO_TYPE_OBJECT , "object" },
+ { 0, NULL }
+};
+
+static map_t call_conv_type_map [] = {
+ { MONO_CALL_DEFAULT , "default" },
+ { MONO_CALL_C , "c" },
+ { MONO_CALL_STDCALL , "stdcall" },
+ { MONO_CALL_THISCALL , "thiscall" },
+ { MONO_CALL_FASTCALL , "fastcall" },
+ { MONO_CALL_VARARG , "vararg" },
+ { 0, NULL }
+};
+
+char*
+dis_stringify_token (MonoImage *m, guint32 token)
+{
+ guint idx = token & 0xffffff;
+ switch (token >> 24) {
+ case MONO_TABLE_TYPEDEF: return get_typedef (m, idx);
+ case MONO_TABLE_TYPEREF: return get_typeref (m, idx);
+ case MONO_TABLE_TYPESPEC: return get_typespec (m, idx);
+ default:
+ break;
+ }
+ return g_strdup_printf("0x%08x", token);
+}
+
+char*
+dis_stringify_array (MonoImage *m, MonoArrayType *array)
+{
+ char *type;
+ GString *s = g_string_new("");
+ int i;
+
+ type = dis_stringify_type (m, array->type);
+ g_string_append (s, type);
+ g_free (type);
+ g_string_append_c (s, '[');
+ for (i = 0; i < array->rank; ++i) {
+ if (i)
+ g_string_append_c (s, ',');
+ if (i < array->numsizes) {
+ if (i < array->numlobounds && array->lobounds[i] != 0)
+ g_string_sprintfa (s, "%d..%d", array->lobounds[i], array->sizes[i]);
+ else
+ g_string_sprintfa (s, "%d", array->sizes[i]);
+ }
+ }
+ g_string_append_c (s, ']');
+ type = s->str;
+ g_string_free (s, FALSE);
+ return type;
+}
+
+char*
+dis_stringify_modifiers (MonoImage *m, int n, MonoCustomMod *mod)
+{
+ GString *s = g_string_new("");
+ char *result;
+ int i;
+ for (i = 0; i < n; ++i) {
+ char *tok = dis_stringify_token (m, mod[i].token);
+ g_string_sprintfa (s, "%s %s", mod[i].required ? "opt": "reqd", tok);
+ g_free (tok);
+ }
+ g_string_append_c (s, ' ');
+ result = s->str;
+ g_string_free (s, FALSE);
+ return result;
+}
+
+char*
+dis_stringify_param (MonoImage *m, MonoType *param)
+{
+ char *t;
+ char *result;
+ const char *out = param->attrs & 2 ? "[out] ": "";
+ t = dis_stringify_type (m, param);
+ result = g_strconcat (out, t, NULL);
+ g_free (t);
+ return result;
+}
+
+char*
+dis_stringify_method_signature (MonoImage *m, MonoMethodSignature *method, int methoddef_row)
+{
+ guint32 cols [MONO_METHOD_SIZE];
+ guint32 pcols [MONO_PARAM_SIZE];
+ guint32 param_index = 0;
+ const char *name = "";
+ int free_method = 0;
+ char *retval;
+ GString *result = g_string_new ("");
+ int i;
+
+ g_assert (method || methoddef_row);
+
+ if (methoddef_row) {
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_METHOD], methoddef_row -1, cols, MONO_METHOD_SIZE);
+ name = mono_metadata_string_heap (m, cols [MONO_METHOD_NAME]);
+ param_index = cols [MONO_METHOD_PARAMLIST];
+ if (!method) {
+ const char *sig = mono_metadata_blob_heap (m, cols [MONO_METHOD_SIGNATURE]);
+ mono_metadata_decode_blob_size (sig, &sig);
+ method = mono_metadata_parse_method_signature (m, 1, sig, &sig);
+ free_method = 1;
+ }
+ }
+
+ retval = dis_stringify_param (m, method->ret);
+ if (method->hasthis)
+ g_string_append (result, "instance ");
+ g_string_append (result, map (method->call_convention, call_conv_type_map));
+ g_string_sprintfa (result, " %s %s(", retval, name);
+ g_free (retval);
+ for (i = 0; i < method->param_count; ++i) {
+ if (param_index && param_index <= m->tables [MONO_TABLE_PARAM].rows) {
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_PARAM], param_index - 1, pcols, MONO_PARAM_SIZE);
+ name = mono_metadata_string_heap (m, pcols [MONO_PARAM_NAME]);
+ method->params [i]->attrs = pcols [MONO_PARAM_FLAGS];
+ param_index++;
+ } else {
+ name = "";
+ }
+ if (i)
+ g_string_append (result, ", ");
+ retval = dis_stringify_param (m, method->params [i]);
+ g_string_sprintfa (result, "%s %s", retval, name);
+ g_free (retval);
+ }
+ g_string_append (result, ") ");
+
+ if (free_method)
+ mono_metadata_free_method_signature (method);
+ retval = result->str;
+ g_string_free (result, FALSE);
+
+ return retval;
+}
+
+static char *
+dis_stringify_object (MonoImage *m, MonoType *type)
+{
+ const char *otype = type->type == MONO_TYPE_CLASS? "class" : "valuetype";
+ char *assemblyref = NULL, *result;
+ MonoClass *c = type->data.klass;
+ if (!c)
+ return g_strdup ("Unknown");
+ if (m != c->image) {
+ /* we cheat */
+ if (substitute_with_mscorlib_p && !strcmp ("corlib", c->image->assembly_name))
+ assemblyref = g_strdup_printf ("[%s]", "mscorlib");
+ else
+ assemblyref = g_strdup_printf ("[%s]", c->image->assembly_name);
+ }
+ result = g_strdup_printf ("%s %s%s%s%s", otype, assemblyref?assemblyref:"", c->name_space,
+ *c->name_space?".":"", c->name);
+ g_free (assemblyref);
+ return result;
+}
+
+char*
+dis_stringify_type (MonoImage *m, MonoType *type)
+{
+ const char *pinned = "", *byref = "";
+ char *bare = NULL, *mods = NULL;
+ char *result;
+
+ if (type->num_mods)
+ mods = dis_stringify_modifiers (m, type->num_mods, type->modifiers);
+
+ switch (type->type){
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_TYPEDBYREF:
+ bare = g_strdup (map (type->type, element_type_map));
+ break;
+
+ case MONO_TYPE_VALUETYPE:
+ case MONO_TYPE_CLASS:
+ bare = dis_stringify_object (m, type);
+ break;
+
+ case MONO_TYPE_FNPTR:
+ bare = dis_stringify_method_signature (m, type->data.method, 0);
+ break;
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY: {
+ char *child_type;
+ child_type = dis_stringify_type (m, type->data.type);
+
+ bare = g_strdup_printf (type->type == MONO_TYPE_PTR ? "%s*" : "%s[]", child_type);
+ g_free (child_type);
+ break;
+ }
+ case MONO_TYPE_ARRAY:
+ bare = dis_stringify_array (m, type->data.array);
+ break;
+ case MONO_TYPE_VOID:
+ bare = g_strdup ("void");
+ break;
+ default:
+ g_error ("Do not know how to stringify type 0x%x", type->type);
+ }
+
+ if (type->pinned)
+ pinned = " pinned";
+
+ if (type->byref)
+ byref = "&";
+
+ result = g_strconcat (mods ? mods : "", bare, byref, pinned, NULL);
+
+ g_free (bare);
+
+ return result;
+}
+
+/**
+ * get_type:
+ * @m: metadata context
+ * @ptr: location to decode from.
+ * @result: pointer to string where resulting decoded string is stored
+ *
+ * This routine returs in @result the stringified type pointed by @ptr.
+ * (22.2.12)
+ *
+ * Returns: the new ptr to continue decoding
+ */
+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);
+ return ptr;
+}
+
+/**
+ *
+ * Returns a stringified representation of a FieldSig (22.2.4)
+ */
+char *
+get_field_signature (MonoImage *m, guint32 blob_signature)
+{
+ char *allocated_modifier_string, *allocated_type_string;
+ const char *ptr = mono_metadata_blob_heap (m, blob_signature);
+ const char *base;
+ char *res;
+ int len;
+
+ len = mono_metadata_decode_value (ptr, &ptr);
+ base = ptr;
+ /* FIELD is 0x06 */
+ g_assert (*ptr == 0x06);
+/* hex_dump (ptr, 0, len); */
+ ptr++; len--;
+
+ ptr = get_custom_mod (m, ptr, &allocated_modifier_string);
+ ptr = get_type (m, ptr, &allocated_type_string);
+
+ res = g_strdup_printf (
+ "%s %s",
+ allocated_modifier_string ? allocated_modifier_string : "",
+ allocated_type_string);
+
+ if (allocated_modifier_string)
+ g_free (allocated_modifier_string);
+ if (allocated_type_string)
+ g_free (allocated_modifier_string);
+
+ return res;
+}
+
+MonoTypeEnum
+get_field_literal_type (MonoImage *m, guint32 blob_signature)
+{
+ const char *ptr = mono_metadata_blob_heap (m, blob_signature);
+ int len;
+ char *allocated_modifier_string;
+
+ len = mono_metadata_decode_value (ptr, &ptr);
+
+ /* FIELD is 0x06 */
+ g_assert (*ptr == 0x06);
+ ptr++; len--;
+
+ ptr = get_custom_mod (m, ptr, &allocated_modifier_string);
+ if (allocated_modifier_string)
+ g_free (allocated_modifier_string);
+
+ return (MonoTypeEnum) *ptr;
+
+}
+
+/**
+ * decode_literal:
+ * @m: metadata context
+ * @token: token to decode
+ *
+ * decodes the literal indexed by @token.
+ */
+char *
+decode_literal (MonoImage *m, guint32 token)
+{
+ return g_strdup ("LITERAL_VALUE");
+}
+
+/**
+ * get_ret_type:
+ * @m: metadata context
+ * @ptr: location to decode from.
+ * @result: pointer to string where resulting decoded string is stored
+ *
+ * This routine returns in @result the stringified RetType (22.2.11)
+ *
+ * Returns: the new ptr to continue decoding.
+ */
+const char *
+get_ret_type (MonoImage *m, const char *ptr, char **ret_type)
+{
+ GString *str = g_string_new ("");
+ char *mod = NULL;
+ char *allocated_type_string;
+
+ ptr = get_custom_mod (m, ptr, &mod);
+ if (mod){
+ g_string_append (str, mod);
+ g_string_append_c (str, ' ');
+ g_free (mod);
+ }
+
+ if (*ptr == MONO_TYPE_TYPEDBYREF){
+ /* TODO: what does `typedbyref' mean? */
+ g_string_append (str, "/* FIXME: What does this mean? */ typedbyref ");
+ ptr++;
+ } else if (*ptr == MONO_TYPE_VOID){
+ g_string_append (str, "void");
+ ptr++;
+ } else {
+ if (*ptr == MONO_TYPE_BYREF){
+ g_string_append (str, "[out] ");
+ ptr++;
+ }
+
+ ptr = get_type (m, ptr, &allocated_type_string);
+ g_string_append (str, allocated_type_string);
+ g_free (allocated_type_string);
+ }
+
+ *ret_type = str->str;
+ g_string_free (str, FALSE);
+
+ return ptr;
+}
+
+/**
+ * get_param:
+ * @m: metadata context
+ * @ptr: location to decode from.
+ * @result: pointer to string where resulting decoded string is stored
+ *
+ * This routine returns in @result the stringified Param (22.2.10)
+ *
+ * Returns: the new ptr to continue decoding.
+ */
+const char *
+get_param (MonoImage *m, const char *ptr, char **retval)
+{
+ GString *str = g_string_new ("");
+ char *allocated_mod_string, *allocated_type_string;
+
+ ptr = get_custom_mod (m, ptr, &allocated_mod_string);
+ if (allocated_mod_string){
+ g_string_append (str, allocated_mod_string);
+ g_string_append_c (str, ' ');
+ g_free (allocated_mod_string);
+ }
+
+ if (*ptr == MONO_TYPE_TYPEDBYREF){
+ g_string_append (str, "/*FIXME: what does typedbyref mean? */ typedbyref ");
+ ptr++;
+ } else {
+ if (*ptr == MONO_TYPE_BYREF){
+ g_string_append (str, "[out] ");
+ ptr++;
+ }
+ ptr = get_type (m, ptr, &allocated_type_string);
+ g_string_append (str, allocated_type_string);
+ g_free (allocated_type_string);
+ }
+
+ *retval = str->str;
+ g_string_free (str, FALSE);
+ return ptr;
+}
+
+static map_t param_map [] = {
+ { PARAM_ATTRIBUTE_IN, "[in] " },
+ { PARAM_ATTRIBUTE_OUT, "[out] " },
+ { PARAM_ATTRIBUTE_OPTIONAL, "optional " },
+ { PARAM_ATTRIBUTE_HAS_DEFAULT, "hasdefault " },
+ { PARAM_ATTRIBUTE_HAS_FIELD_MARSHAL, "fieldmarshal " },
+ { 0, NULL }
+};
+
+char *
+param_flags (guint32 f)
+{
+ return g_strdup (flags (f, param_map));
+}
+
+static map_t field_access_map [] = {
+ { FIELD_ATTRIBUTE_COMPILER_CONTROLLED, "compilercontrolled " },
+ { FIELD_ATTRIBUTE_PRIVATE, "private " },
+ { FIELD_ATTRIBUTE_FAM_AND_ASSEM, "famandassem " },
+ { FIELD_ATTRIBUTE_ASSEMBLY, "assembly " },
+ { FIELD_ATTRIBUTE_FAMILY, "family " },
+ { FIELD_ATTRIBUTE_FAM_OR_ASSEM, "famorassem " },
+ { FIELD_ATTRIBUTE_PUBLIC, "public " },
+ { 0, NULL }
+};
+
+static map_t field_flags_map [] = {
+ { FIELD_ATTRIBUTE_STATIC, "static " },
+ { FIELD_ATTRIBUTE_INIT_ONLY, "initonly " },
+ { FIELD_ATTRIBUTE_LITERAL, "literal " },
+ { FIELD_ATTRIBUTE_NOT_SERIALIZED, "notserialized " },
+ { FIELD_ATTRIBUTE_SPECIAL_NAME, "specialname " },
+ { FIELD_ATTRIBUTE_PINVOKE_IMPL, "FIXME:pinvokeimpl " },
+ { FIELD_ATTRIBUTE_RT_SPECIAL_NAME, "rtspecialname " },
+ { FIELD_ATTRIBUTE_HAS_FIELD_MARSHAL, "hasfieldmarshal " },
+ { FIELD_ATTRIBUTE_HAS_DEFAULT, "hasdefault " },
+ { FIELD_ATTRIBUTE_HAS_FIELD_RVA, "hasfieldrva " },
+ { 0, NULL }
+};
+
+/**
+ * field_flags:
+ *
+ * Returns a stringified version of a Field's flags
+ */
+char *
+field_flags (guint32 f)
+{
+ char buffer [1024];
+ int access = f & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK;
+
+ buffer [0] = 0;
+
+ strcat (buffer, map (access, field_access_map));
+ strcat (buffer, flags (f, field_flags_map));
+ return g_strdup (buffer);
+}
+
+/**
+ * Returns a stringifed representation of a MethodRefSig (22.2.2)
+ */
+char *
+get_methodref_signature (MonoImage *m, guint32 blob_signature, const char *fancy_name)
+{
+ GString *res = g_string_new ("");
+ const char *ptr = mono_metadata_blob_heap (m, blob_signature);
+ char *allocated_ret_type, *s;
+ gboolean seen_vararg = 0;
+ int param_count, signature_len;
+ int i;
+
+ signature_len = mono_metadata_decode_value (ptr, &ptr);
+
+ if (*ptr & 0x20){
+ if (*ptr & 0x40)
+ g_string_append (res, "explicit-this ");
+ else
+ g_string_append (res, "instance "); /* has-this */
+ }
+
+ if (*ptr & 0x05)
+ seen_vararg = 1;
+
+ ptr++;
+ param_count = mono_metadata_decode_value (ptr, &ptr);
+ ptr = get_ret_type (m, ptr, &allocated_ret_type);
+
+ g_string_append (res, allocated_ret_type);
+
+ if (fancy_name){
+ g_string_append_c (res, ' ');
+ g_string_append (res, fancy_name);
+ }
+
+ g_string_append (res, "(");
+
+ /*
+ * param_count describes parameters *before* and *after*
+ * the vararg sentinel
+ */
+ for (i = 0; i < param_count; i++){
+ char *param = NULL;
+
+ /*
+ * If ptr is a SENTINEL
+ */
+ if (*ptr == 0x41){
+ g_string_append (res, " varargs ");
+ continue;
+ }
+
+ ptr = get_param (m, ptr, &param);
+ g_string_append (res, param);
+ if (i+1 != param_count)
+ g_string_append (res, ", ");
+ g_free (param);
+ }
+ g_string_append (res, ")");
+
+ /*
+ * cleanup and return
+ */
+ g_free (allocated_ret_type);
+ s = res->str;
+ g_string_free (res, FALSE);
+ return s;
+}
+
+/**
+ * get_field:
+ * @m: metadata context
+ * @token: a FIELD_DEF token
+ *
+ * This routine has to locate the TypeDef that "owns" this Field.
+ * Since there is no backpointer in the Field table, we have to scan
+ * the TypeDef table and locate the actual "owner" of the field
+ */
+char *
+get_field (MonoImage *m, guint32 token)
+{
+ int idx = mono_metadata_token_index (token);
+ guint32 cols [MONO_FIELD_SIZE];
+ char *sig, *res, *type;
+ guint32 type_idx;
+
+ /*
+ * We can get here also with a MenberRef token (for a field
+ * defined in another module/assembly, just like in get_method ()
+ */
+ if (mono_metadata_token_code (token) == MONO_TOKEN_MEMBER_REF) {
+ return g_strdup_printf ("fieldref-0x%08x", token);
+ }
+ g_assert (mono_metadata_token_code (token) == MONO_TOKEN_FIELD_DEF);
+
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_FIELD], idx - 1, cols, MONO_FIELD_SIZE);
+ sig = get_field_signature (m, cols [MONO_FIELD_SIGNATURE]);
+
+ /*
+ * To locate the actual "container" for this field, we have to scan
+ * the TypeDef table. LAME!
+ */
+ type_idx = mono_metadata_typedef_from_field (m, idx);
+
+ type = get_typedef (m, type_idx);
+ res = g_strdup_printf ("%s %s::%s",
+ sig, type,
+ mono_metadata_string_heap (m, cols [MONO_FIELD_NAME]));
+ g_free (type);
+ g_free (sig);
+
+ return res;
+}
+
+static char *
+get_memberref_parent (MonoImage *m, guint32 mrp_token)
+{
+ /*
+ * mrp_index is a MemberRefParent coded index
+ */
+ guint32 table = mrp_token & 7;
+ guint32 idx = mrp_token >> 3;
+
+ switch (table){
+ case 0: /* TypeDef */
+ return get_typedef (m, idx);
+
+ case 1: /* TypeRef */
+ return get_typeref (m, idx);
+
+ case 2: /* ModuleRef */
+ return g_strdup_printf ("TODO:MemberRefParent-ModuleRef");
+
+ case 3: /* MethodDef */
+ return g_strdup ("TODO:MethodDef");
+
+ case 4: /* TypeSpec */
+ return get_typespec (m, idx);
+ }
+ g_assert_not_reached ();
+ return NULL;
+}
+
+/**
+ * get_method:
+ * @m: metadata context
+ * @token: a METHOD_DEF or MEMBER_REF token
+ *
+ * This routine has to locate the TypeDef that "owns" this Field.
+ * Since there is no backpointer in the Field table, we have to scan
+ * the TypeDef table and locate the actual "owner" of the field
+ */
+char *
+get_method (MonoImage *m, guint32 token)
+{
+ int idx = mono_metadata_token_index (token);
+ guint32 member_cols [MONO_MEMBERREF_SIZE], method_cols [MONO_METHOD_SIZE];
+ char *sig;
+ const char *name;
+
+ MonoMethod *mh;
+
+ mh = mono_get_method (m, token, NULL);
+ if (mh)
+ name = g_strdup_printf ("%s.%s::%s", mh->klass->name_space,
+ mh->klass->name, mh->name);
+ else
+ name = NULL;
+
+ switch (mono_metadata_token_code (token)){
+ case MONO_TOKEN_METHOD_DEF:
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_METHOD],
+ idx - 1, method_cols, MONO_METHOD_SIZE);
+
+ sig = get_methodref_signature (m, method_cols [MONO_METHOD_SIGNATURE], name);
+ return sig;
+
+ case MONO_TOKEN_MEMBER_REF: {
+
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_MEMBERREF],
+ idx - 1, member_cols, MONO_MEMBERREF_SIZE);
+ if (!name)
+ name = g_strdup_printf ("%s::%s",
+ get_memberref_parent (m, member_cols [MONO_MEMBERREF_CLASS]),
+ mono_metadata_string_heap (m, member_cols [MONO_MEMBERREF_NAME]));
+ sig = get_methodref_signature (
+ m, member_cols [MONO_MEMBERREF_SIGNATURE], name);
+ return sig;
+ }
+
+ default:
+ g_assert_not_reached ();
+ }
+ g_assert_not_reached ();
+ return NULL;
+}
+
+/**
+ * get_constant:
+ * @m: metadata context
+ * @blob_index: index into the blob where the constant is stored
+ *
+ * Returns: An allocated value representing a stringified version of the
+ * constant.
+ */
+char *
+get_constant (MonoImage *m, MonoTypeEnum t, guint32 blob_index)
+{
+ const char *ptr = mono_metadata_blob_heap (m, blob_index);
+ int len;
+
+ len = mono_metadata_decode_value (ptr, &ptr);
+
+ switch (t){
+ case MONO_TYPE_BOOLEAN:
+ return g_strdup_printf ("%s", *ptr ? "true" : "false");
+
+ case MONO_TYPE_CHAR:
+ return g_strdup_printf ("%c", *ptr); /* FIXME: unicode char */
+
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ return g_strdup_printf ("int8(0x%02x)", (int) (*ptr));
+ break;
+
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2:
+ return g_strdup_printf ("int16(0x%08x)", (int) read16 (ptr));
+
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ return g_strdup_printf ("int32(%d)", read32 (ptr));
+
+ case MONO_TYPE_I8: {
+ guint32 low, high;
+ low = read32 (ptr);
+ high = read32 (ptr + 4);
+ return g_strdup_printf ("0x%08x%08x", high, low);
+ }
+ case MONO_TYPE_U8: {
+ guint32 low, high;
+ low = read32 (ptr);
+ high = read32 (ptr + 4);
+ return g_strdup_printf ("0x%08x%08x", high, low);
+ }
+ case MONO_TYPE_R4: {
+ float r;
+ readr4 (ptr, &r);
+ return g_strdup_printf ("%g", (double) r);
+ }
+ case MONO_TYPE_R8: {
+ double r;
+ readr8 (ptr, &r);
+ return g_strdup_printf ("%g", r);
+ }
+ case MONO_TYPE_STRING: {
+ int i, j, e;
+ char *res;
+ e = len = 0;
+ for (i = 0; !ptr [i+1]; i += 2){
+ len++;
+ switch (ptr [i]) {
+ case '"':
+ case '\\':
+ case '\n': /* add more */
+ e++;
+ }
+ }
+ res = g_malloc (len + e + 3);
+ j = 1;
+ res [0] = '"';
+
+ for (i = 0; i < len; i += 2){
+ switch(ptr[i]) {
+ case '"':
+ res[j++] = '\\';
+ res[j++] = '"';
+ case '\\':
+ res[j++] = '\\';
+ res[j++] = '\\';
+ case '\n':
+ res[j++] = '\\';
+ res[j++] = 'n';
+ break;
+ default:
+ res[j++] = isprint (ptr [i]) ? ptr [i] : '.';
+ break;
+ }
+ }
+ res[j++] = '"';
+ res[j] = 0;
+ return res;
+ }
+
+ case MONO_TYPE_CLASS:
+ return g_strdup ("CLASS CONSTANT. MUST BE ZERO");
+
+ default:
+ g_error ("Unknown MONO_TYPE (%d) on constant at Blob index (0x%08x)\n",
+ (int) *ptr, blob_index);
+ return g_strdup_printf ("Unknown");
+ }
+
+}
+
+/**
+ * get_token:
+ * @m: metadata context
+ * @token: token that we want to decode.
+ *
+ * Returns: An allocated value representing a stringified version of the
+ * constant.
+ */
+char *
+get_token (MonoImage *m, guint32 token)
+{
+ guint32 idx = mono_metadata_token_index (token);
+
+ switch (mono_metadata_token_code (token)){
+ case MONO_TOKEN_FIELD_DEF:
+ return (get_field (m, token));
+ case MONO_TOKEN_TYPE_DEF:
+ return get_typedef (m, idx);
+ case MONO_TOKEN_TYPE_REF:
+ return get_typeref (m, idx);
+ case MONO_TOKEN_TYPE_SPEC:
+ return get_typespec (m, idx);
+ default:
+ g_error ("Do not know how to decode tokens of type 0x%08x", token);
+ }
+
+ g_assert_not_reached ();
+ return g_strdup ("ERROR");
+}
+
+/**
+ * get_token_type:
+ * @m: metadata context
+ * @token: the token can belong to any of the following tables:
+ * MONO_TOKEN_TYPE_REF, MONO_TOKEN_TYPE_DEF, MONO_TOKEN_TYPE_SPEC
+ *
+ * Returns: a stringified version of the MethodDef or MethodRef or TypeSpecn
+ * at (token & 0xffffff)
+ */
+char *
+get_token_type (MonoImage *m, guint32 token)
+{
+ char *temp = NULL, *s;
+ int idx;
+
+ idx = mono_metadata_token_index (token);
+
+ switch (mono_metadata_token_code (token)){
+ case MONO_TOKEN_TYPE_DEF:
+ temp = get_typedef (m, idx);
+ s = g_strdup_printf ("%s", temp);
+ break;
+
+ case MONO_TOKEN_TYPE_REF:
+ temp = get_typeref (m, idx);
+ s = g_strdup_printf ("%s", temp);
+ break;
+
+ case MONO_TOKEN_TYPE_SPEC:
+ s = get_typespec (m, idx);
+ break;
+
+ default:
+ g_error ("Unhandled encoding for typedef-or-ref coded index");
+
+ }
+
+ if (temp)
+ g_free (temp);
+
+ return s;
+}
+
+char *
+get_guid (MonoImage *m, guint32 guid_index)
+{
+ const unsigned char *guid;
+ char *result;
+
+ guid = mono_metadata_guid_heap (m, guid_index);
+
+ result = g_strdup_printf ("{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+ guid [3], guid [2], guid [1], guid [0], guid [5], guid [4], guid [7], guid [6],
+ guid [8], guid [9], guid [10], guid [11], guid [12], guid [13], guid [14], guid [15]);
+ return result;
+}
diff --git a/mono/dis/get.h b/mono/dis/get.h
new file mode 100644
index 00000000000..4686682fee4
--- /dev/null
+++ b/mono/dis/get.h
@@ -0,0 +1,55 @@
+
+/*
+ * These return allocated strings
+ */
+char *get_typedef (MonoImage *m, int idx);
+char *get_module (MonoImage *m, int idx);
+char *get_assemblyref (MonoImage *m, int idx);
+char *get_typeref (MonoImage *m, int idx);
+char *get_typedef_or_ref (MonoImage *m, guint32 dor_token);
+char *get_field_signature (MonoImage *m, guint32 blob_signature);
+char *decode_literal (MonoImage *m, guint32 token);
+char *get_field (MonoImage *m, guint32 token);
+char *param_flags (guint32 f);
+char *field_flags (guint32 f);
+char *get_methodref_signature (MonoImage *m, guint32 blob_signature, const char *fancy);
+char *get_constant (MonoImage *m, MonoTypeEnum t, guint32 blob_index);
+char *get_token (MonoImage *m, guint32 token);
+char *get_token_type (MonoImage *m, guint32 token);
+char *get_typespec (MonoImage *m, guint32 blob_idx);
+char *get_method (MonoImage *m, guint32 token);
+char *get_guid (MonoImage *m, guint32 guid_index);
+
+
+char *dis_stringify_type (MonoImage *m, MonoType *type);
+char *dis_stringify_token (MonoImage *m, guint32 token);
+char *dis_stringify_array (MonoImage *m, MonoArrayType *array);
+char *dis_stringify_modifiers (MonoImage *m, int n, MonoCustomMod *mod);
+char *dis_stringify_param (MonoImage *m, MonoType *param);
+char *dis_stringify_method_signature (MonoImage *m, MonoMethodSignature *method, int methoddef_row);
+
+/*
+ * These functions are used during the decoding of streams in the
+ * metadata heaps (a simple parsing).
+ *
+ * They return the `next' location to continue parsing from (ptr is
+ * the starting location).
+ *
+ * Results are returning in the pointer argument.
+ */
+const char *get_encoded_typedef_or_ref (MonoImage *m, const char *ptr,
+ char **result);
+const char *get_encoded_value (const char *_ptr,
+ guint32 *len);
+const char *get_custom_mod (MonoImage *m, const char *ptr,
+ char **return_value);
+const char *get_type (MonoImage *m, const char *ptr,
+ char **result);
+const char *get_ret_type (MonoImage *m, const char *ptr,
+ char **ret_type);
+const char *get_param (MonoImage *m, const char *ptr,
+ char **retval);
+const char *get_blob_encoded_size (const char *ptr, int *size);
+
+MonoTypeEnum get_field_literal_type (MonoImage *m, guint32 blob_signature);
+
diff --git a/mono/dis/main.c b/mono/dis/main.c
index 49f9027c1e2..b7173cd1713 100644
--- a/mono/dis/main.c
+++ b/mono/dis/main.c
@@ -1,24 +1,42 @@
/*
- * dis.c: Sample disassembler
+ * main.c: Sample disassembler
*
* Author:
* Miguel de Icaza (miguel@ximian.com)
*
* (C) 2001 Ximian, Inc.
+ *
+ * TODO:
+ * Investigate how interface inheritance works and how it should be dumped.
+ * Structs are not being labeled as `valuetype' classes
+ *
+ * How are fields with literals mapped to constants?
*/
#include <config.h>
#include <stdio.h>
+#include <string.h>
#include <glib.h>
+#include <stdlib.h>
+#include "meta.h"
+#include "util.h"
+#include "dump.h"
+#include "get.h"
+#include "dis-cil.h"
+#include <mono/metadata/loader.h>
#include <mono/metadata/assembly.h>
-#include <mono/metadata/cil-coff.h>
+#include <mono/metadata/appdomain.h>
FILE *output;
/* True if you want to get a dump of the header data */
gboolean dump_header_data_p = FALSE;
+gboolean substitute_with_mscorlib_p = FALSE;
+
+int dump_table = -1;
+
static void
-dump_header_data (MonoAssembly *ass)
+dump_header_data (MonoImage *img)
{
if (!dump_header_data_p)
return;
@@ -29,26 +47,829 @@ dump_header_data (MonoAssembly *ass)
}
static void
+dis_directive_assembly (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_ASSEMBLY];
+ guint32 cols [MONO_ASSEMBLY_SIZE];
+
+ if (t->base == NULL)
+ return;
+
+ mono_metadata_decode_row (t, 0, cols, MONO_ASSEMBLY_SIZE);
+
+ fprintf (output,
+ ".assembly '%s'\n"
+ "{\n"
+ " .hash algorithm 0x%08x\n"
+ " .ver %d:%d:%d:%d"
+ "%s %s"
+ "%s"
+ "\n"
+ "}\n",
+ mono_metadata_string_heap (m, cols [MONO_ASSEMBLY_NAME]),
+ cols [MONO_ASSEMBLY_HASH_ALG],
+ cols [MONO_ASSEMBLY_MAJOR_VERSION], cols [MONO_ASSEMBLY_MINOR_VERSION],
+ cols [MONO_ASSEMBLY_BUILD_NUMBER], cols [MONO_ASSEMBLY_REV_NUMBER],
+ cols [MONO_ASSEMBLY_CULTURE] ? "\n .locale" : "",
+ cols [MONO_ASSEMBLY_CULTURE] ? mono_metadata_string_heap (m, cols [MONO_ASSEMBLY_CULTURE]) : "",
+ cols [MONO_ASSEMBLY_PUBLIC_KEY] ? "\n .publickey" : ""
+ );
+}
+
+static void
+dis_directive_assemblyref (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_ASSEMBLYREF];
+ guint32 cols [MONO_ASSEMBLYREF_SIZE];
+ int i;
+
+ if (t->base == NULL)
+ return;
+
+ for (i = 0; i < t->rows; i++){
+ mono_metadata_decode_row (t, i, cols, MONO_ASSEMBLYREF_SIZE);
+
+ fprintf (output,
+ ".assembly extern %s\n"
+ "{\n"
+ " .ver %d:%d:%d:%d\n"
+ "}\n",
+ mono_metadata_string_heap (m, cols [MONO_ASSEMBLYREF_NAME]),
+ cols [MONO_ASSEMBLYREF_MAJOR_VERSION], cols [MONO_ASSEMBLYREF_MINOR_VERSION],
+ cols [MONO_ASSEMBLYREF_BUILD_NUMBER], cols [MONO_ASSEMBLYREF_REV_NUMBER]
+ );
+ }
+}
+
+static map_t visibility_map [] = {
+ { TYPE_ATTRIBUTE_NOT_PUBLIC, "private " },
+ { TYPE_ATTRIBUTE_PUBLIC, "public " },
+ { TYPE_ATTRIBUTE_NESTED_PUBLIC, "nested-public " },
+ { TYPE_ATTRIBUTE_NESTED_PRIVATE, "nested-private " },
+ { TYPE_ATTRIBUTE_NESTED_FAMILY, "family " },
+ { TYPE_ATTRIBUTE_NESTED_ASSEMBLY, "nested-assembly" },
+ { TYPE_ATTRIBUTE_NESTED_FAM_AND_ASSEM, "nested-fam-and-assembly" },
+ { TYPE_ATTRIBUTE_NESTED_FAM_OR_ASSEM, "nested-fam-or-assembly" },
+ { 0, NULL }
+};
+
+static map_t layout_map [] = {
+ { TYPE_ATTRIBUTE_AUTO_LAYOUT, "auto " },
+ { TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT, "sequential " },
+ { TYPE_ATTRIBUTE_EXPLICIT_LAYOUT, "explicit " },
+ { 0, NULL }
+};
+
+static map_t format_map [] = {
+ { TYPE_ATTRIBUTE_ANSI_CLASS, "ansi " },
+ { TYPE_ATTRIBUTE_UNICODE_CLASS, "unicode " },
+ { TYPE_ATTRIBUTE_AUTO_CLASS, "auto " },
+ { 0, NULL }
+};
+
+static char *
+typedef_flags (guint32 flags)
+{
+ static char buffer [1024];
+ int visibility = flags & TYPE_ATTRIBUTE_VISIBILITY_MASK;
+ int layout = flags & TYPE_ATTRIBUTE_LAYOUT_MASK;
+ int format = flags & TYPE_ATTRIBUTE_STRING_FORMAT_MASK;
+
+ buffer [0] = 0;
+
+ strcat (buffer, map (visibility, visibility_map));
+ strcat (buffer, map (layout, layout_map));
+ strcat (buffer, map (format, format_map));
+
+ if (flags & TYPE_ATTRIBUTE_ABSTRACT)
+ strcat (buffer, "abstract ");
+ if (flags & TYPE_ATTRIBUTE_SEALED)
+ strcat (buffer, "sealed ");
+ if (flags & TYPE_ATTRIBUTE_SPECIAL_NAME)
+ strcat (buffer, "special-name ");
+ if (flags & TYPE_ATTRIBUTE_IMPORT)
+ strcat (buffer, "import ");
+ if (flags & TYPE_ATTRIBUTE_SERIALIZABLE)
+ strcat (buffer, "serializable ");
+ if (flags & TYPE_ATTRIBUTE_BEFORE_FIELD_INIT)
+ strcat (buffer, "beforefieldinit ");
+
+ return buffer;
+}
+
+/**
+ * dis_field_list:
+ * @m: metadata context
+ * @start: starting index into the Field Table.
+ * @end: ending index into Field table.
+ *
+ * This routine displays all the decoded fields from @start to @end
+ */
+static void
+dis_field_list (MonoImage *m, guint32 start, guint32 end)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_FIELD];
+ guint32 cols [MONO_FIELD_SIZE];
+ int i;
+
+ if (end > t->rows + 1) {
+ g_warning ("ERROR index out of range in fields");
+ end = t->rows;
+ }
+
+ for (i = start; i < end; i++){
+ char *sig, *flags;
+
+ mono_metadata_decode_row (t, i, cols, MONO_FIELD_SIZE);
+ sig = get_field_signature (m, cols [MONO_FIELD_SIGNATURE]);
+ flags = field_flags (cols [MONO_FIELD_FLAGS]);
+
+ if (cols [MONO_FIELD_FLAGS] & FIELD_ATTRIBUTE_LITERAL){
+ char *lit;
+ guint32 const_cols [MONO_CONSTANT_SIZE];
+ guint32 crow;
+
+ if ((crow = mono_metadata_get_constant_index (m, MONO_TOKEN_FIELD_DEF | (i+1)))) {
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_CONSTANT], crow-1, const_cols, MONO_CONSTANT_SIZE);
+ lit = get_constant (m, const_cols [MONO_CONSTANT_TYPE], const_cols [MONO_CONSTANT_VALUE]);
+ } else {
+ lit = g_strdup ("not found");
+ }
+
+ fprintf (output, " .field %s %s %s = ",
+ flags, sig,
+ mono_metadata_string_heap (m, cols [MONO_FIELD_NAME]));
+ fprintf (output, "%s\n", lit);
+ g_free (lit);
+ } else
+ fprintf (output, " .field %s %s %s\n",
+ flags, sig,
+ mono_metadata_string_heap (m, cols [MONO_FIELD_NAME]));
+ g_free (flags);
+ g_free (sig);
+ }
+}
+
+static map_t method_access_map [] = {
+ { METHOD_ATTRIBUTE_COMPILER_CONTROLLED, "compilercontrolled " },
+ { METHOD_ATTRIBUTE_PRIVATE, "private" },
+ { METHOD_ATTRIBUTE_FAM_AND_ASSEM, "famandassem" },
+ { METHOD_ATTRIBUTE_ASSEM, "assembly " },
+ { METHOD_ATTRIBUTE_FAMILY, "family " },
+ { METHOD_ATTRIBUTE_FAM_OR_ASSEM, "famorassem " },
+ { METHOD_ATTRIBUTE_PUBLIC, "public " },
+ { 0, NULL }
+};
+
+static map_t method_flags_map [] = {
+ { METHOD_ATTRIBUTE_STATIC, "static " },
+ { METHOD_ATTRIBUTE_FINAL, "final " },
+ { METHOD_ATTRIBUTE_VIRTUAL, "virtual " },
+ { METHOD_ATTRIBUTE_HIDE_BY_SIG, "hidebysig " },
+ { METHOD_ATTRIBUTE_VTABLE_LAYOUT_MASK, "newslot " },
+ { METHOD_ATTRIBUTE_ABSTRACT, "abstract " },
+ { METHOD_ATTRIBUTE_SPECIAL_NAME, "specialname " },
+ { METHOD_ATTRIBUTE_RT_SPECIAL_NAME, "rtspecialname " },
+ { METHOD_ATTRIBUTE_UNMANAGED_EXPORT, "export " },
+ { METHOD_ATTRIBUTE_HAS_SECURITY, "hassecurity" },
+ { METHOD_ATTRIBUTE_REQUIRE_SEC_OBJECT, "requiresecobj" },
+ { METHOD_ATTRIBUTE_PINVOKE_IMPL, "pinvokeimpl " },
+ { 0, NULL }
+};
+
+/**
+ * method_flags:
+ *
+ * Returns a stringified version of the Method's flags
+ */
+static char *
+method_flags (guint32 f)
+{
+ GString *str = g_string_new ("");
+ int access = f & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK;
+ char *s;
+
+ g_string_append (str, map (access, method_access_map));
+ g_string_append (str, flags (f, method_flags_map));
+
+ s = str->str;
+ g_string_free (str, FALSE);
+
+ return s;
+}
+
+static map_t pinvoke_flags_map [] = {
+ { PINVOKE_ATTRIBUTE_NO_MANGLE , "nomangle " },
+ { PINVOKE_ATTRIBUTE_SUPPORTS_LAST_ERROR, "lasterr " },
+ { 0, NULL }
+};
+
+static map_t pinvoke_call_conv_map [] = {
+ { PINVOKE_ATTRIBUTE_CALL_CONV_WINAPI, "winapi " },
+ { PINVOKE_ATTRIBUTE_CALL_CONV_CDECL, "cdecl " },
+ { PINVOKE_ATTRIBUTE_CALL_CONV_STDCALL, "stdcall " },
+ { PINVOKE_ATTRIBUTE_CALL_CONV_THISCALL, "thiscall " },
+ { PINVOKE_ATTRIBUTE_CALL_CONV_FASTCALL, "fastcall " },
+ { 0, NULL }
+};
+
+static map_t pinvoke_char_set_map [] = {
+ { PINVOKE_ATTRIBUTE_CHAR_SET_NOT_SPEC, "" },
+ { PINVOKE_ATTRIBUTE_CHAR_SET_ANSI, "ansi " },
+ { PINVOKE_ATTRIBUTE_CHAR_SET_UNICODE , "unicode " },
+ { PINVOKE_ATTRIBUTE_CHAR_SET_AUTO, "autochar " },
+ { 0, NULL }
+};
+
+/**
+ * pinvoke_flags:
+ *
+ * Returns a stringified version of the Method's pinvoke flags
+ */
+static char *
+pinvoke_flags (guint32 f)
+{
+ GString *str = g_string_new ("");
+ int cset = f & PINVOKE_ATTRIBUTE_CHAR_SET_MASK;
+ int cconv = f & PINVOKE_ATTRIBUTE_CALL_CONV_MASK;
+ char *s;
+
+ g_string_append (str, map (cset, pinvoke_char_set_map));
+ g_string_append (str, map (cconv, pinvoke_call_conv_map));
+ g_string_append (str, flags (f, pinvoke_flags_map));
+
+ s = g_strdup(str->str);
+ g_string_free (str, FALSE);
+
+ return s;
+}
+
+static map_t method_impl_map [] = {
+ { METHOD_IMPL_ATTRIBUTE_IL, "cil " },
+ { METHOD_IMPL_ATTRIBUTE_NATIVE, "native " },
+ { METHOD_IMPL_ATTRIBUTE_OPTIL, "optil " },
+ { METHOD_IMPL_ATTRIBUTE_RUNTIME, "runtime " },
+ { 0, NULL }
+};
+
+static map_t managed_type_map [] = {
+ { METHOD_IMPL_ATTRIBUTE_UNMANAGED, "unmanaged " },
+ { METHOD_IMPL_ATTRIBUTE_MANAGED, "managed " },
+ { 0, NULL }
+};
+
+static map_t managed_impl_flags [] = {
+ { METHOD_IMPL_ATTRIBUTE_FORWARD_REF, "fwdref " },
+ { METHOD_IMPL_ATTRIBUTE_PRESERVE_SIG, "preservesig " },
+ { METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL, "internalcall " },
+ { METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED, "synchronized " },
+ { METHOD_IMPL_ATTRIBUTE_NOINLINING, "noinline " },
+ { 0, NULL }
+};
+
+static char *
+method_impl_flags (guint32 f)
+{
+ GString *str = g_string_new ("");
+ char *s;
+ int code_type = f & METHOD_IMPL_ATTRIBUTE_CODE_TYPE_MASK;
+ int managed_type = f & METHOD_IMPL_ATTRIBUTE_MANAGED_MASK;
+
+ g_string_append (str, map (code_type, method_impl_map));
+ g_string_append (str, map (managed_type, managed_type_map));
+ g_string_append (str, flags (f, managed_impl_flags));
+
+ s = str->str;
+ g_string_free (str, FALSE);
+ return s;
+}
+
+static void
+dis_locals (MonoImage *m, MonoMethodHeader *mh)
+{
+ int i;
+
+ fprintf(output, "\t.locals %s(\n", mh->init_locals ? "init " : "");
+ for (i=0; i < mh->num_locals; ++i) {
+ char * desc;
+ if (i)
+ fprintf(output, ",\n");
+ /* print also byref and pinned attributes */
+ desc = dis_stringify_type (m, mh->locals[i]);
+ fprintf(output, "\t\t%s\tV_%d", desc, i);
+ g_free(desc);
+ }
+ fprintf(output, ")\n");
+}
+
+static void
+dis_code (MonoImage *m, guint32 rva)
+{
+ MonoMethodHeader *mh;
+ MonoCLIImageInfo *ii = m->image_info;
+ const char *ptr = mono_cli_rva_map (ii, rva);
+ const char *loc;
+
+ if (rva == 0)
+ return;
+
+ mh = mono_metadata_parse_mh (m, ptr);
+ if (ii->cli_cli_header.ch_entry_point){
+ loc = mono_metadata_locate_token (m, ii->cli_cli_header.ch_entry_point);
+ if (rva == read32 (loc))
+ fprintf (output, "\t.entrypoint\n");
+ }
+
+ fprintf (output, "\t// Code size %d (0x%x)\n", mh->code_size, mh->code_size);
+ fprintf (output, "\t.maxstack %d\n", mh->max_stack);
+ if (mh->num_locals)
+ dis_locals (m, mh);
+ dissasemble_cil (m, mh);
+
+/*
+ hex_dump (mh->code, 0, mh->code_size);
+ printf ("\nAfter the code\n");
+ hex_dump (mh->code + mh->code_size, 0, 64);
+*/
+ mono_metadata_free_mh (mh);
+}
+
+static char *
+pinvoke_info (MonoImage *m, guint32 mindex)
+{
+ MonoTableInfo *im = &m->tables [MONO_TABLE_IMPLMAP];
+ MonoTableInfo *mr = &m->tables [MONO_TABLE_MODULEREF];
+ guint32 im_cols [MONO_IMPLMAP_SIZE];
+ guint32 mr_cols [MONO_MODULEREF_SIZE];
+ const char *import, *scope;
+ char *flags;
+ int i;
+
+ for (i = 0; i < im->rows; i++) {
+
+ mono_metadata_decode_row (im, i, im_cols, MONO_IMPLMAP_SIZE);
+
+ if ((im_cols [MONO_IMPLMAP_MEMBER] >> 1) == mindex + 1) {
+
+ flags = pinvoke_flags (im_cols [MONO_IMPLMAP_FLAGS]);
+
+ import = mono_metadata_string_heap (m, im_cols [MONO_IMPLMAP_NAME]);
+
+ mono_metadata_decode_row (mr, im_cols [MONO_IMPLMAP_SCOPE] - 1,
+ mr_cols, MONO_MODULEREF_SIZE);
+
+ scope = mono_metadata_string_heap (m, mr_cols [MONO_MODULEREF_NAME]);
+
+ return g_strdup_printf ("(%s as %s %s)", scope, import,
+ flags);
+ g_free (flags);
+ }
+ }
+
+ return NULL;
+}
+
+/**
+ * dis_method_list:
+ * @m: metadata context
+ * @start: starting index into the Method Table.
+ * @end: ending index into Method table.
+ *
+ * This routine displays the methods in the Method Table from @start to @end
+ */
+static void
+dis_method_list (MonoImage *m, guint32 start, guint32 end)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_METHOD];
+ guint32 cols [MONO_METHOD_SIZE];
+ int i;
+
+ if (end > t->rows){
+ fprintf (output, "ERROR index out of range in methods");
+ /*exit (1);*/
+ end = t->rows;
+ }
+
+ for (i = start; i < end; i++){
+ MonoMethodSignature *ms;
+ char *flags, *impl_flags;
+ const char *sig;
+ char *sig_str;
+
+ mono_metadata_decode_row (t, i, cols, MONO_METHOD_SIZE);
+
+ flags = method_flags (cols [MONO_METHOD_FLAGS]);
+ impl_flags = method_impl_flags (cols [MONO_METHOD_IMPLFLAGS]);
+
+ sig = mono_metadata_blob_heap (m, cols [MONO_METHOD_SIGNATURE]);
+ mono_metadata_decode_blob_size (sig, &sig);
+ ms = mono_metadata_parse_method_signature (m, 1, sig, &sig);
+ sig_str = dis_stringify_method_signature (m, ms, i + 1);
+
+ fprintf (output, " // method line %d\n", i + 1);
+ fprintf (output, " .method %s", flags);
+
+ if (cols [MONO_METHOD_FLAGS] & METHOD_ATTRIBUTE_PINVOKE_IMPL)
+ fprintf (output, "%s", pinvoke_info (m, i));
+
+ fprintf (output, "\n %s", sig_str);
+ fprintf (output, " %s\n", impl_flags);
+ g_free (flags);
+ g_free (impl_flags);
+
+ fprintf (output, " {\n");
+ fprintf (output, " // Method begins at RVA 0x%x\n", cols [MONO_METHOD_RVA]);
+ dis_code (m, cols [MONO_METHOD_RVA]);
+ fprintf (output, " }\n\n");
+ mono_metadata_free_method_signature (ms);
+ g_free (sig_str);
+ }
+}
+
+typedef struct {
+ MonoTableInfo *t;
+ guint32 col_idx;
+ guint32 idx;
+ guint32 result;
+} plocator_t;
+
+static int
+table_locator (const void *a, const void *b)
+{
+ plocator_t *loc = (plocator_t *) a;
+ const char *bb = (const char *) b;
+ guint32 table_index = (bb - loc->t->base) / loc->t->row_size;
+ guint32 col;
+
+ col = mono_metadata_decode_row_col (loc->t, table_index, loc->col_idx);
+
+ if (loc->idx == col) {
+ loc->result = table_index;
+ return 0;
+ }
+ if (loc->idx < col)
+ return -1;
+ else
+ return 1;
+}
+
+static void
+dis_property_methods (MonoImage *m, guint32 prop)
+{
+ guint start, end;
+ MonoTableInfo *msemt = &m->tables [MONO_TABLE_METHODSEMANTICS];
+ guint32 cols [MONO_METHOD_SEMA_SIZE];
+ char *sig;
+ const char *type[] = {NULL, ".set", ".get", NULL, ".other"};
+
+ start = mono_metadata_methods_from_property (m, prop, &end);
+ while (start < end) {
+ mono_metadata_decode_row (msemt, start, cols, MONO_METHOD_SEMA_SIZE);
+ sig = dis_stringify_method_signature (m, NULL, cols [MONO_METHOD_SEMA_METHOD]);
+ fprintf (output, "\t\t%s %s\n", type [cols [MONO_METHOD_SEMA_SEMANTICS]], sig);
+ g_free (sig);
+ ++start;
+ }
+}
+
+static char*
+dis_property_signature (MonoImage *m, guint32 prop_idx)
+{
+ MonoTableInfo *propt = &m->tables [MONO_TABLE_PROPERTY];
+ const char *ptr;
+ guint32 pcount, i;
+ guint32 cols [MONO_PROPERTY_SIZE];
+ MonoType *type;
+ MonoType *param;
+ char *blurb;
+ const char *name;
+ int prop_flags;
+ GString *res = g_string_new ("");
+
+ mono_metadata_decode_row (propt, prop_idx, cols, MONO_PROPERTY_SIZE);
+ name = mono_metadata_string_heap (m, cols [MONO_PROPERTY_NAME]);
+ prop_flags = cols [MONO_PROPERTY_FLAGS];
+ ptr = mono_metadata_blob_heap (m, cols [MONO_PROPERTY_TYPE]);
+ mono_metadata_decode_blob_size (ptr, &ptr);
+ /* ECMA claims 0x08 ... */
+ if (*ptr != 0x28 && *ptr != 0x08)
+ g_warning("incorrect signature in propert blob: 0x%x", *ptr);
+ ptr++;
+ pcount = mono_metadata_decode_value (ptr, &ptr);
+ type = mono_metadata_parse_type (m, MONO_PARSE_TYPE, 0, ptr, &ptr);
+ blurb = dis_stringify_type (m, type);
+ if (prop_flags & 0x0200)
+ g_string_append (res, "special ");
+ if (prop_flags & 0x0400)
+ g_string_append (res, "runtime ");
+ if (prop_flags & 0x1000)
+ g_string_append (res, "hasdefault ");
+ g_string_sprintfa (res, "%s %s (", blurb, name);
+ g_free (blurb);
+ mono_metadata_free_type (type);
+ for (i = 0; i < pcount; i++) {
+ if (i)
+ g_string_append (res, ", ");
+ param = mono_metadata_parse_param (m, ptr, &ptr);
+ blurb = dis_stringify_param (m, param);
+ g_string_append (res, blurb);
+ mono_metadata_free_type (param);
+ g_free (blurb);
+ }
+ g_string_append_c (res, ')');
+ blurb = res->str;
+ g_string_free (res, FALSE);
+ return blurb;
+
+}
+
+static void
+dis_property_list (MonoImage *m, guint32 typedef_row)
+{
+ guint start, end, i;
+ start = mono_metadata_properties_from_typedef (m, typedef_row, &end);
+
+ for (i = start; i < end; ++i) {
+ char *sig = dis_property_signature (m, i);
+ fprintf (output, "\t.property %s\n\t{\n", sig);
+ dis_property_methods (m, i);
+ fprintf (output, "\t}\n");
+ g_free (sig);
+ }
+}
+
+static char*
+dis_event_signature (MonoImage *m, guint32 event_idx)
+{
+ MonoTableInfo *et = &m->tables [MONO_TABLE_EVENT];
+ const char *name;
+ char *type, *res;
+ guint32 cols [MONO_EVENT_SIZE];
+
+ mono_metadata_decode_row (et, event_idx, cols, MONO_EVENT_SIZE);
+ name = mono_metadata_string_heap (m, cols [MONO_EVENT_NAME]);
+ type = get_typedef_or_ref (m, cols [MONO_EVENT_TYPE]);
+
+ res = g_strdup_printf ("%s %s", type, name);
+ g_free (type);
+ return res;
+}
+
+static void
+dis_event_methods (MonoImage *m, guint32 event)
+{
+ guint start, end;
+ MonoTableInfo *msemt = &m->tables [MONO_TABLE_METHODSEMANTICS];
+ guint32 cols [MONO_METHOD_SEMA_SIZE];
+ char *sig;
+ const char *type;
+
+ start = mono_metadata_methods_from_event (m, event, &end);
+ while (start < end) {
+ mono_metadata_decode_row (msemt, start, cols, MONO_METHOD_SEMA_SIZE);
+ sig = dis_stringify_method_signature (m, NULL, cols [MONO_METHOD_SEMA_METHOD]);
+ switch (cols [MONO_METHOD_SEMA_SEMANTICS]) {
+ case METHOD_SEMANTIC_OTHER:
+ type = ".other"; break;
+ case METHOD_SEMANTIC_ADD_ON:
+ type = ".addon"; break;
+ case METHOD_SEMANTIC_REMOVE_ON:
+ type = ".removeon"; break;
+ case METHOD_SEMANTIC_FIRE:
+ type = ".fire"; break;
+ default:
+ break;
+ }
+ fprintf (output, "\t\t%s %s\n", type, sig);
+ g_free (sig);
+ ++start;
+ }
+}
+
+static void
+dis_event_list (MonoImage *m, guint32 typedef_row)
+{
+ guint start, end, i;
+ start = mono_metadata_events_from_typedef (m, typedef_row, &end);
+
+ for (i = start; i < end; ++i) {
+ char *sig = dis_event_signature (m, i);
+ fprintf (output, "\t.event %s\n\t{\n", sig);
+ dis_event_methods (m, i);
+ fprintf (output, "\t}\n");
+ g_free (sig);
+ }
+}
+
+static void
+dis_interfaces (MonoImage *m, guint32 typedef_row)
+{
+ plocator_t loc;
+ guint start;
+ guint32 cols [MONO_INTERFACEIMPL_SIZE];
+ char *intf;
+ MonoTableInfo *table = &m->tables [MONO_TABLE_INTERFACEIMPL];
+
+ if (!table->base)
+ return;
+
+ loc.t = table;
+ loc.col_idx = MONO_INTERFACEIMPL_CLASS;
+ loc.idx = typedef_row;
+
+ if (!bsearch (&loc, table->base, table->rows, table->row_size, table_locator))
+ return;
+
+ start = loc.result;
+ /*
+ * We may end up in the middle of the rows...
+ */
+ while (start > 0) {
+ if (loc.idx == mono_metadata_decode_row_col (table, start - 1, MONO_INTERFACEIMPL_CLASS))
+ start--;
+ else
+ break;
+ }
+ while (start < table->rows) {
+ mono_metadata_decode_row (table, start, cols, MONO_INTERFACEIMPL_SIZE);
+ if (cols [MONO_INTERFACEIMPL_CLASS] != loc.idx)
+ break;
+ intf = get_typedef_or_ref (m, cols [MONO_INTERFACEIMPL_INTERFACE]);
+ fprintf (output, " \timplements %s\n", intf);
+ g_free (intf);
+ ++start;
+ }
+}
+
+/**
+ * dis_type:
+ * @m: metadata context
+ * @n: index of type to disassemble
+ *
+ * Disassembles the type whose index in the TypeDef table is @n.
+ */
+static void
+dis_type (MonoImage *m, int n)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_TYPEDEF];
+ guint32 cols [MONO_TYPEDEF_SIZE];
+ guint32 cols_next [MONO_TYPEDEF_SIZE];
+ const char *name, *nspace;
+ guint32 packing_size, class_size;
+ gboolean next_is_valid, last;
+
+ mono_metadata_decode_row (t, n, cols, MONO_TYPEDEF_SIZE);
+
+ if (t->rows > n + 1) {
+ mono_metadata_decode_row (t, n + 1, cols_next, MONO_TYPEDEF_SIZE);
+ next_is_valid = 1;
+ } else
+ next_is_valid = 0;
+
+ nspace = mono_metadata_string_heap (m, cols [MONO_TYPEDEF_NAMESPACE]);
+ if (*nspace)
+ fprintf (output, ".namespace %s\n{\n", nspace);
+ name = mono_metadata_string_heap (m, cols [MONO_TYPEDEF_NAME]);
+
+ if ((cols [MONO_TYPEDEF_FLAGS] & TYPE_ATTRIBUTE_CLASS_SEMANTIC_MASK) == TYPE_ATTRIBUTE_CLASS){
+ char *base = get_typedef_or_ref (m, cols [MONO_TYPEDEF_EXTENDS]);
+ fprintf (output, " .class %s%s\n", typedef_flags (cols [MONO_TYPEDEF_FLAGS]), name);
+ fprintf (output, " \textends %s\n", base);
+ g_free (base);
+ } else
+ fprintf (output, " .class interface %s%s\n", typedef_flags (cols [MONO_TYPEDEF_FLAGS]), name);
+
+ dis_interfaces (m, n + 1);
+ fprintf (output, " {\n");
+
+ if (mono_metadata_packing_from_typedef (m, n + 1, &packing_size, &class_size)) {
+ fprintf (output, " .pack %d\n", packing_size);
+ fprintf (output, " .size %d\n", class_size);
+ }
+ /*
+ * The value in the table is always valid, we know we have fields
+ * if the value stored is different than the next record.
+ */
+
+ if (next_is_valid)
+ last = cols_next [MONO_TYPEDEF_FIELD_LIST] - 1;
+ else
+ last = m->tables [MONO_TABLE_FIELD].rows;
+
+ if (cols [MONO_TYPEDEF_FIELD_LIST] && cols [MONO_TYPEDEF_FIELD_LIST] <= m->tables [MONO_TABLE_FIELD].rows)
+ dis_field_list (m, cols [MONO_TYPEDEF_FIELD_LIST] - 1, last);
+ fprintf (output, "\n");
+
+ if (next_is_valid)
+ last = cols_next [MONO_TYPEDEF_METHOD_LIST] - 1;
+ else
+ last = m->tables [MONO_TABLE_METHOD].rows;
+
+ if (cols [MONO_TYPEDEF_METHOD_LIST] && cols [MONO_TYPEDEF_METHOD_LIST] <= m->tables [MONO_TABLE_METHOD].rows)
+ dis_method_list (m, cols [MONO_TYPEDEF_METHOD_LIST] - 1, last);
+
+ dis_property_list (m, n);
+ dis_event_list (m, n);
+
+ fprintf (output, " }\n");
+ if (*nspace)
+ fprintf (output, "}\n");
+ fprintf (output, "\n");
+}
+
+/**
+ * dis_types:
+ * @m: metadata context
+ *
+ * disassembles all types in the @m context
+ */
+static void
+dis_types (MonoImage *m)
+{
+ MonoTableInfo *t = &m->tables [MONO_TABLE_TYPEDEF];
+ int i;
+
+ for (i = 1; i < t->rows; i++)
+ dis_type (m, i);
+}
+
+struct {
+ const char *name;
+ int table;
+ void (*dumper) (MonoImage *m);
+} table_list [] = {
+ { "--assembly", MONO_TABLE_ASSEMBLY, dump_table_assembly },
+ { "--assemblyref", MONO_TABLE_ASSEMBLYREF, dump_table_assemblyref },
+ { "--fields", MONO_TABLE_FIELD, dump_table_field },
+ { "--memberref", MONO_TABLE_MEMBERREF, dump_table_memberref },
+ { "--param", MONO_TABLE_PARAM, dump_table_param },
+ { "--typedef", MONO_TABLE_TYPEDEF, dump_table_typedef },
+ { "--typeref", MONO_TABLE_TYPEREF, dump_table_typeref },
+ { "--nested", MONO_TABLE_NESTEDCLASS, dump_table_nestedclass },
+ { "--interface", MONO_TABLE_INTERFACEIMPL, dump_table_interfaceimpl },
+ { "--classlayout", MONO_TABLE_CLASSLAYOUT, dump_table_class_layout },
+ { "--constant", MONO_TABLE_CONSTANT, dump_table_constant },
+ { "--customattr", MONO_TABLE_CUSTOMATTRIBUTE, dump_table_customattr },
+ { "--property", MONO_TABLE_PROPERTY, dump_table_property },
+ { "--propertymap", MONO_TABLE_PROPERTYMAP, dump_table_property_map },
+ { "--event", MONO_TABLE_EVENT, dump_table_event },
+ { "--file", MONO_TABLE_FILE, dump_table_file },
+ { "--moduleref", MONO_TABLE_MODULEREF, dump_table_moduleref },
+ { "--module", MONO_TABLE_MODULE, dump_table_module },
+ { "--method", MONO_TABLE_METHOD, dump_table_method },
+ { "--methodsem", MONO_TABLE_METHODSEMANTICS, dump_table_methodsem },
+ { NULL, -1 }
+};
+
+/**
+ * disassemble_file:
+ * @file: file containing CIL code.
+ *
+ * Disassembles the @file file.
+ */
+static void
disassemble_file (const char *file)
{
- enum MonoAssemblyOpenStatus status;
MonoAssembly *ass;
+ MonoImageOpenStatus status;
+ MonoImage *img;
- ass = mono_assembly_open (file, &status);
+ ass = mono_assembly_open (file, NULL, &status);
if (ass == NULL){
fprintf (stderr, "Error while trying to process %s\n", file);
-
+ return;
}
- dump_header_data (ass);
+ img = ass->image;
- mono_assembly_close (ass);
+ if (dump_table != -1){
+ (*table_list [dump_table].dumper) (img);
+ } else {
+ dump_header_data (img);
+
+ dis_directive_assemblyref (img);
+ dis_directive_assembly (img);
+ dis_types (img);
+ }
+
+ mono_image_close (img);
}
static void
usage (void)
{
- fprintf (stderr, "Usage is: monodis file1 ..\n");
+ GString *args = g_string_new ("[--help] [--mscorlib] ");
+ int i;
+
+ for (i = 0; table_list [i].name != NULL; i++){
+ g_string_append (args, "[");
+ g_string_append (args, table_list [i].name);
+ g_string_append (args, "] ");
+ if (((i-2) % 5) == 0)
+ g_string_append_c (args, '\n');
+ }
+ fprintf (stderr,
+ "Usage is: monodis %s file ..\n", args->str);
exit (1);
}
@@ -56,7 +877,7 @@ int
main (int argc, char *argv [])
{
GList *input_files = NULL, *l;
- int i;
+ int i, j;
output = stdout;
for (i = 1; i < argc; i++){
@@ -65,6 +886,18 @@ main (int argc, char *argv [])
usage ();
else if (argv [i][1] == 'd')
dump_header_data_p = TRUE;
+ else if (strcmp (argv [i], "--mscorlib") == 0) {
+ substitute_with_mscorlib_p = TRUE;
+ i++;
+ }
+ else if (strcmp (argv [i], "--help") == 0)
+ usage ();
+ for (j = 0; table_list [j].name != NULL; j++) {
+ if (strcmp (argv [i], table_list [j].name) == 0)
+ dump_table = j;
+ }
+ if (dump_table < 0)
+ usage ();
} else
input_files = g_list_append (input_files, argv [i]);
}
@@ -72,6 +905,10 @@ main (int argc, char *argv [])
if (input_files == NULL)
usage ();
+ mono_init (argv [0]);
+
for (l = input_files; l; l = l->next)
disassemble_file (l->data);
+
+ return 0;
}
diff --git a/mono/dis/meta.h b/mono/dis/meta.h
new file mode 100644
index 00000000000..e1de23c7003
--- /dev/null
+++ b/mono/dis/meta.h
@@ -0,0 +1,7 @@
+#include <mono/metadata/image.h>
+#include <mono/metadata/cil-coff.h>
+#include <mono/metadata/mono-endian.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/metadata/blob.h>
+
diff --git a/mono/dis/monodis.1 b/mono/dis/monodis.1
new file mode 100644
index 00000000000..28b2b37bcec
--- /dev/null
+++ b/mono/dis/monodis.1
@@ -0,0 +1,106 @@
+.\"
+.\" monodis manual page.
+.\" (C) Ximian, Inc.
+.\" Author:
+.\" Miguel de Icaza (miguel@gnu.org)
+.\"
+.TH Mono "Mono 1.0"
+.SH NAME
+monodis \- CIL image content dumper and disassembler.
+.SH SYNOPSIS
+.PP
+.B monodis
+[\-hd] [\-\-help]
+[\-\-mscorlib]
+[\-\-assembly]
+[\-\-assemblyref]
+[\-\-classlayout]
+[\-\-constant]
+[\-\-event]
+[\-\-fields]
+[\-\-file]
+[\-\-interface]
+[\-\-memberref]
+[\-\-method]
+[\-\-methodsem]
+[\-\-module]
+[\-\-moduleref]
+[\-\-param]
+[\-\-property]
+[\-\-propertymap]
+[\-\-typedef]
+[\-\-typeref]
+[FILES...]
+.SH DESCRIPTION
+The \fImonodis\fP program is used to dump the contents a CIL image
+(contained in .EXE files that contain extended PE/COFF CIL code).
+.SH OPTIONS
+The following Generic options are supported:
+.TP
+.I "--help", "-h"
+Displays usage instructions.
+.TP
+.I "--mscorlib"
+For non-corlib assemblies, use "mscorlib" as the assembly name. This
+is useful for round-tripping the IL with ilasm.
+.TP
+.I "--assembly"
+Dumps the contents of the assembly table
+.TP
+.I "--assemblyref"
+Dumps the contents of the assemblyref table
+.TP
+.I "--classlayout"
+Dumps the contents of the classlayout table
+.TP
+.I "--constant"
+Dumps the contents of the constant table
+.TP
+.I "--event"
+Dumps the contents of the event table
+.TP
+.I "--fields"
+Dumps the contents of the fields table
+.TP
+.I "--file"
+Dumps the contents of the file table
+.TP
+.I "--interface"
+Dumps the contents of the interface table
+.TP
+.I "--memberref"
+Dumps the contents of the memberref table
+.TP
+.I "--method"
+Dumps the contents of the method table
+.TP
+.I "--methodsem"
+Dumps the contents of the methodsem table
+.TP
+.I "--module"
+Dumps the contents of the module table
+.TP
+.I "--moduleref"
+Dumps the contents of the moduleref table
+.TP
+.I "--param"
+Dumps the contents of the param table
+.TP
+.I "--property"
+Dumps the contents of the property table
+.TP
+.I "--propertymap"
+Dumps the contents of the propertymap table
+.TP
+.I "--typedef"
+Dumps the contents of the typedef table
+.TP
+.I "--typeref"
+Dumps the contents of the typeref table
+.PP
+If no flags are specified the program dumps the content of the image
+in a format that can be used to rountrip the code.
+.SH AUTHOR
+monodis was written by Miguel de Icaza, Paolo Molaro and Dietmar Maurer.
+.SH SEE ALSO
+.BR pedump(1)
diff --git a/mono/dis/push-pop.h b/mono/dis/push-pop.h
new file mode 100644
index 00000000000..98da16824ad
--- /dev/null
+++ b/mono/dis/push-pop.h
@@ -0,0 +1,265 @@
+/* Poping */
+/* 1 bit */
+#define Pop0 1
+/* 2 bits */
+#define Pop1 2
+/* 3 bits */
+#define PopI 8
+/* 1 bit */
+#define PopI8 64
+/* 1 bit */
+#define Pop8 128
+/* 1 bit */
+#define PopR4 256
+/* 1 bit */
+#define PopR8 512
+/* 1 bit */
+#define PopRef 1024
+/* 1 bit */
+#define VarPop 2048
+
+/* Pushing */
+#define Push0 1
+#define PushI 2
+#define PushI8 4
+#define PushR4 8
+#define PushR8 16
+#define PushRef 32
+#define VarPush 64
+#define Push1 128
+
+/*
+ * dis-cil.c: Disassembles CIL byte codes
+ *
+ * Author:
+ * Miguel de Icaza (miguel@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+#include <config.h>
+#include <glib.h>
+#include <stdio.h>
+#include "meta.h"
+#include "dump.h"
+#include "dis-cil.h"
+
+/* Poping */
+/* 1 bit */
+#define Pop0 1
+/* 2 bits */
+#define Pop1 2
+/* 3 bits */
+#define PopI 8
+/* 1 bit */
+#define PopI8 64
+/* 1 bit */
+#define Pop8 128
+/* 1 bit */
+#define PopR4 256
+/* 1 bit */
+#define PopR8 512
+/* 1 bit */
+#define PopRef 1024
+/* 1 bit */
+#define VarPop 2048
+
+/* Pushing */
+#define Push0 1
+#define PushI 2
+#define PushI8 4
+#define PushR4 8
+#define PushR8 16
+#define PushRef 32
+#define VarPush 64
+#define Push1 128
+
+enum {
+ InlineBrTarget,
+ InlineField,
+ InlineI,
+ InlineI8,
+ InlineMethod,
+ InlineNone,
+ InlineR,
+ InlineSig,
+ InlineString,
+ InlineSwitch,
+ InlineTok,
+ InlineType,
+ InlineVar,
+ ShortInlineBrTarget,
+ ShortInlineI,
+ ShortInlineR,
+ ShortInlineVar
+};
+
+#define OPDEF(a,b,c,d,e,f,g,h,i,j) \
+ { b, c, d, e, g, h, i },
+
+typedef struct {
+ char *name;
+ int pop, push;
+ int argument;
+ int bytes;
+ unsigned char o1, o2;
+} opcode_t;
+
+static opcode_t opcodes [300] = {
+#include "mono/cil/opcode.def"
+};
+
+void
+dissasemble_cil (MonoMetadata *m, const unsigned char *start, int size)
+{
+ const unsigned char *end = start + size;
+ const unsigned char *ptr = start;
+ opcode_t *entry;
+
+ while (ptr < end){
+ if (*ptr == 0xfe){
+ ptr++;
+ entry = &opcodes [*ptr + 256];
+ } else
+ entry = &opcodes [*ptr];
+
+ ptr++;
+
+ fprintf (output, "\tIL_%04x: %s ", ptr - start, entry->name);
+ switch (entry->argument){
+ case InlineBrTarget: {
+ gint target = *(gint32 *) ptr;
+ fprintf (output, "IL_%04x", ptr + 4 + target);
+ ptr += 4;
+ break;
+ }
+
+ case InlineField: {
+ token = *(guint32 *) ptr;
+ fprintf (output, "fieldref-0x%08x", token);
+ ptr += 4;
+ break;
+ }
+
+ case InlineI: {
+ int value = *(int *) ptr;
+
+ fprintf (output, "%d", value);
+ ptr += 4;
+ break;
+ }
+
+ case InlineI8: {
+ gint64 top = *(guint64 *) value;
+
+ fprintf (output, "%ld", top);
+ ptr += 8;
+ break;
+ }
+
+ case InlineMethod: {
+ token = *(guint32 *) ptr;
+ fprintf (output, "method-0x%08x", token);
+ ptr += 4;
+ break;
+ }
+
+ case InlineNone:
+ break;
+
+ case InlineR: {
+ double r = *(double *) ptr;
+ fprintf (output, "%g", r);
+ ptr += 8;
+ break;
+ }
+
+ case InlineSig: {
+ guint32 token = *(guint32 *) ptr;
+ fprintf (output, "signature-0x%08x", token);
+ ptr += 4;
+ break;
+ }
+
+ case InlineString: {
+ guint32 token = *(guint32 *) ptr;
+
+ fprintf (output, "string-%0x08x", token);
+ ptr += 4;
+ break;
+ }
+
+ case InlineSwitch: {
+ guint32 count = *(guint32 *) ptr;
+ guint32 i;
+
+ ptr += 4;
+ fprintf (output, "(\n\t\t\t");
+ for (i = 0; i < count; i++){
+ fprintf (output, "IL_%x", *(guint32 *) ptr);
+ ptr += 4;
+ }
+ fprintf (output, "\t\t\t)");
+ break;
+ }
+
+ case InlineTok: {
+ guint32 token = *(guint32 *) ptr;
+
+ fprintf (output, "TOKEN_%08x", token);
+ ptr += 4;
+ break;
+ }
+
+ case InlineType: {
+ guint32 token = *(guint32 *) ptr;
+
+ fprintf (output, "Type-%08x", token);
+ ptr += 4;
+ break;
+ }
+
+ case InlineVar: {
+ gint16 var_idx = *(gint16 *) ptr;
+
+ fprintf (output, "variable-%d\n", var_idx);
+ ptr += 2;
+ break;
+ }
+
+ case ShortInlineBrTarget: {
+ signed char x = *ptr;
+
+ fprintf (output, "IL_%04x", ptr - start + 1 + x);
+ ptr++:
+ break;
+ }
+
+ case ShortInlineI: {
+ char x = *ptr;
+
+ fprintf (output, "0x%02x", x);
+ ptr++;
+ break;
+ }
+
+ case ShortInlineR: {
+ float f = *(float *) ptr;
+
+ fprintf (output, "%g", (double) f);
+ ptr += 4;
+ break;
+ }
+
+ case ShortInlineVar: {
+ signed char x = *ptr;
+
+ fprintf (output, "Varidx-%d", (int) x);
+ ptr++;
+ break;
+ }m
+
+ }
+
+ fprintf (output, "\n");
+ }
+}
diff --git a/mono/dis/util.c b/mono/dis/util.c
new file mode 100644
index 00000000000..997f67fe2b7
--- /dev/null
+++ b/mono/dis/util.c
@@ -0,0 +1,84 @@
+/*
+ * util.c: Assorted utilities for the dissasembler
+ *
+ * Author:
+ * Miguel de Icaza (miguel@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc (http://www.ximian.com)
+ */
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+#include <stdio.h>
+#include "util.h"
+
+/**
+ * map:
+ * @code: code to lookup in table
+ * @table: table to decode code
+ *
+ * Warning: returns static buffer.
+ */
+const char *
+map (guint32 code, map_t *table)
+{
+ int i;
+
+ for (i = 0; table [i].str != NULL; i++)
+ if (table [i].code == code)
+ return table [i].str;
+ return "invalid-flags";
+}
+
+/**
+ * flags:
+ * @code: bitfield
+ * @table: table to decode bitfield
+ *
+ * Warning: returns static buffer.
+ */
+const char *
+flags (guint32 code, map_t *table)
+{
+ static char buffer [1024];
+ int i;
+
+ buffer [0] = 0;
+
+ for (i = 0; table [i].str != NULL; i++)
+ if (table [i].code & code) {
+ if (buffer [0])
+ strcat (buffer, " ");
+ strcat (buffer, table [i].str);
+ }
+
+ return buffer;
+}
+
+/**
+ * hex_dump:
+ * @buffer: pointer to buffer to dump
+ * @base: numbering base to use
+ * @count: number of bytes to dump
+ */
+void
+hex_dump (const char *buffer, int base, int count)
+{
+ int show_header = 1;
+ int i;
+
+ if (count < 0){
+ count = -count;
+ show_header = 0;
+ }
+
+ for (i = 0; i < count; i++){
+ if (show_header)
+ if ((i % 16) == 0)
+ printf ("\n0x%08x: ", (unsigned char) base + i);
+
+ printf ("%02x ", (unsigned char) (buffer [i]));
+ }
+ fflush (stdout);
+}
+
diff --git a/mono/dis/util.h b/mono/dis/util.h
new file mode 100644
index 00000000000..4c33534049e
--- /dev/null
+++ b/mono/dis/util.h
@@ -0,0 +1,11 @@
+
+typedef struct {
+ int code;
+ const char *str;
+} map_t;
+
+const char *map (guint32 code, map_t *table);
+const char *flags (guint32 code, map_t *table);
+void hex_dump (const char *buffer, int base, int count);
+
+#define CSIZE(x) (sizeof (x) / 4)
diff --git a/mono/interpreter/.cvsignore b/mono/interpreter/.cvsignore
new file mode 100644
index 00000000000..d1628f487a6
--- /dev/null
+++ b/mono/interpreter/.cvsignore
@@ -0,0 +1,6 @@
+Makefile
+Makefile.in
+mint
+*.o
+.libs
+.deps
diff --git a/mono/interpreter/ChangeLog b/mono/interpreter/ChangeLog
new file mode 100644
index 00000000000..cfb9e92e674
--- /dev/null
+++ b/mono/interpreter/ChangeLog
@@ -0,0 +1,748 @@
+
+Mon Apr 22 16:52:03 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: handle muslticast delegates. Implement a couple more
+ convert opcodes. Pretend we spend some time jitting...
+
+2002-04-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_exec_method): support internalcall String constructors
+
+2002-04-19 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * interp.c: support for new szarray format.
+
+Tue Apr 16 20:12:58 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: removed profiling code (moved to common library).
+ Implemented inlining for some special methods.
+
+2002-04-15 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * interp.c: Using fullnames when adding icall's (array)
+
+Wed Apr 10 16:07:23 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: quick implementation for opcodes needed by the new parse
+ routines in corlib.
+
+Tue Apr 9 13:08:26 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: make the interp thread-safe wrt the metadata lib.
+
+Mon Apr 8 17:15:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: display return value with --trace.
+ Call mono_runtime_init ().
+
+2002-04-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (interp_mono_runtime_invoke): handle more types,
+ removed runtime_exec_main
+
+Thu Apr 4 11:36:52 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: don't try to get an IL opcode for runtime and internal
+ call methods.
+
+Thu Mar 28 16:54:51 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: spring warning cleanup.
+
+Thu Mar 28 12:03:28 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: check obj address in stfld.
+
+2002-03-27 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_exec_method): CASTCLASS: fix for transparent proxy
+
+Tue Mar 26 20:09:10 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: set frame->ip before dumping the stack trace.
+
+Tue Mar 26 19:54:45 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: remove glib mem vtable code.
+
+2002-03-26 Dick Porter <dick@ximian.com>
+
+ * interp.c: Show thread ID's in trace output.
+
+ New option "--traceclassinit" to put debug output around
+ runtime_class_init().
+
+ Make sure all options are displayed in usage().
+
+Tue Mar 26 17:03:14 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: support fieldrefs when accessing instance fields.
+
+Mon Mar 25 12:59:52 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: allow tracing to be done on a per-method basis.
+ Fix interp_mono_runtime_invoke() to deal correcttly with the return
+ value. Disable glib mem vtable setting.
+
+Thu Mar 21 18:08:37 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: set stack trace info when throwing an exception.
+
+Thu Mar 21 17:32:46 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: intern strings before executing a method (and don't
+ intern command line arguments anymore). Add sanity checks in alloca
+ use.
+
+Sat Mar 16 19:15:18 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: restore frame on return from unmanaged calls.
+ Add support for continuing execution up to x IL insn.
+ Fix exception handling when an exception is raised in the catch
+ handler of the same method that issued the first one.
+
+2002-03-11 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_runtime_method): set method_info field
+
+Mon Mar 11 14:48:07 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: corlib consistency checls moved to libmetadata.
+
+Mon Mar 11 11:27:27 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: use the new facilities in debug-helpers to
+ disassemble CIL code and match method names to MonoMethods.
+
+Thu Mar 7 17:20:59 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: Boehm-GC enable. Fix some overflow opcodes.
+
+Tue Mar 5 18:12:40 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fix non-debug build and some more opcode work.
+
+Mon Mar 4 11:21:44 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: print the address of 'this' in tracing mode.
+
+Thu Feb 28 19:18:59 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: add checks for more binary consistency.
+
+2002-02-27 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (interp_mono_runtime_invoke): use alloca instead of g_new0
+
+Tue Feb 26 11:43:34 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: added profiling for object creation.
+
+Mon Feb 25 17:37:07 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: use correct value for guint64 max.
+
+2002-02-22 Radek Doulik <rodo@ximian.com>
+
+ * interp.c: s/gulong/guint64 as it differs on ppc
+
+Wed Feb 20 22:18:40 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: more complete runtime_invoke () implementation.
+ Fixed castclass/isinst to work correctly with arrays.
+
+Tue Feb 19 20:21:14 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: implement the runtime_invoke function.
+
+Mon Feb 18 15:49:20 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fix alignment code. Make sure to init classes
+ in more cases. Command-line arguments are interned.
+
+2002-02-16 Radek Doulik <rodo@ximian.com>
+
+ * interp.c (ves_exec_method): test type of sp [-1] instead of sp
+ [0], because sp [-1] is the value going to be shifted, fixed in
+ CEE_SHL, CEE_SHR, CEE_UN opcodes)
+
+Sat Feb 16 12:00:24 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fixed cut&paste error for ldind.r4 and ldind.r8.
+
+Fri Feb 15 15:07:27 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: use strrchr instead of rindex. use _isnan and _finite on
+ win32 systems.
+
+2002-02-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * interp.c (ves_exec_method): replace
+ 'g_assert (sp->type = VAL_VALUETA)' with
+ 'g_assert (sp->type == VAL_VALUETA)' otherwise
+ the assert always passes. FIXME: should the test have been !=?
+
+2002-02-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (stackval_from_data): fix for MONO_TYPE_PTR
+
+Wed Feb 13 16:17:38 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fixed newobj implementation for valuetypes bug found by
+ dietmar. sub.ovf dummy code.
+
+Tue Feb 12 14:08:47 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * hacks.h: check against redefining preprocessor symbol.
+ * interp.c: fix profile info to return more sensible results.
+
+Mon Feb 11 13:05:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: added "die on exception" command line argument.
+ When we segfault, set the message in the exception to "Segmentation
+ fault" so people can recognise what's going on.
+
+2002-02-10 Miguel de Icaza <miguel@ximian.com>
+
+ * interp.c (ves_exec_method): Compare the element_class type token
+ in the class we got as well, instead of the element class vs the
+ toplevel class.
+
+ This fixes the invalid cast exceptions during unboxing
+
+Fri Feb 8 13:01:03 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: use opcode information from libmetadata.
+
+2002-02-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_exec_method): CEE_UNBOX: use element_class for
+ type check.
+
+2002-02-04 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (main): impl. __array_Address icall
+
+Fri Feb 1 16:03:53 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: exception fixes. Use mono_method_pointer_get ()
+ to easy porting to other archs. Some support for overflow detection.
+
+2002-01-25 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c, jit.c (main): install runtime_exec_main handler
+ (main): bug fix - call TlsAlloc () before we execute code
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * interp.c: Added some kludges to cope with CONV_OVF_I2,
+ CONV_OVF_I4 and ADD_OVF so that number formatting works. Also
+ initialise and cleanup the network support.
+
+Thu Jan 10 20:59:59 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c, interp.h: add a flag to mono_create_trampoline ()
+ to handle runtime methods.
+
+Sat Jan 5 15:45:14 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: allow classname:method name in --debug argument.
+ Fix box opcode for valuetypes. Fix a few opcode to take a 16 bit
+ index instead of 32 (stloc, ldloc, starg, etc.).
+
+Thu Jan 3 23:19:27 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: temporary mul.ovf, mul.ovf.un, add.ovf.un implementations
+ to get the compiler going.
+
+Mon Dec 24 17:23:45 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fix ldc.i8.
+
+Thu Dec 20 20:09:48 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fix delegate method invocation to handle both
+ static and instance methods.
+
+Tue Dec 18 18:48:50 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: make segv_handler static, handle runtime methods in stack
+ trace.
+
+Thu Dec 13 20:24:28 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: correctly handle exceptions generated in C code.
+ Install an handler for SIGSEGV. Bare-bones profiler and hook for the
+ verifier.
+
+Mon Dec 3 17:15:44 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: call mono_init() after registering internal calls.
+
+2001-11-30 Dick Porter <dick@ximian.com>
+
+ * interp.c: Replace get_named_exception() with
+ mono_exception_from_name()
+
+Fri Nov 30 12:05:21 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: calculate locals and args offsets only once
+ per method call. Cache trampoline code as well.
+
+2001-11-23 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_exec_method): bug fix for exception5.cs
+
+Mon Nov 19 11:33:00 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: start adding support for handling exceptions across
+ managed/unmanaged boundaries. Cleanup Delegate method invocation.
+ Pass the correct target object in Delegate::Invoke and use the correct
+ 'this' pointer in ldvirtftn (bugs pointed out by Dietmar).
+
+Thu Nov 15 17:40:24 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: handle enums with underlying type different from int32.
+ More checks for C structs <-> C# objects consistency.
+
+Wed Nov 14 19:23:00 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: move the stack frame dumping code to a function so it can
+ be called from the debugger. Fix virtual method lookup for interfaces.
+ Throw exceptions instead of aborting in more places.
+ Print also the message in an exception. Updates for field renames in
+ corlib.
+
+2001-11-09 Dick Porter <dick@ximian.com>
+
+ * Makefile.am (mint_LDADD): Don't need THREAD_LIBS any more
+
+2001-11-07 Miguel de Icaza <miguel@ximian.com>
+
+ * interp.c: Include stdlib to kill warning.
+ (check_corlib): Adjust format encodings to remove warnings.
+
+Wed Nov 7 15:47:36 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: updates for changes in array code.
+
+Fri Nov 2 19:06:54 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: hanlde field refs. Throw an exception on NULL references.
+ Check consistency of corlib types with the C struct representation.
+
+2001-10-25 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_exec_method): use relative numbering for runtime
+ type checks (and make it work with interfaces)
+
+2001-10-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c: removed newobj()
+
+2001-10-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (get_virtual_method): use the vtable
+ (arch_compile_method): added to compute vtable entry
+
+Mon Oct 8 16:14:40 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: use the accessors provided in object.h to deal with
+ MonoArrays. Updates for API renames in metadata. Throw exception
+ in ldelema if index is out of bounds.
+
+Mon Oct 8 10:44:25 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fixes for changes in metadata.
+
+2001-10-04 Dick Porter <dick@ximian.com>
+
+ * interp.c (ves_runtime_method): init_class() the
+ mono_defaults.delegate_class
+ Include mono-endian.h not endian.h
+
+Tue Oct 2 18:51:25 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: set frame->ip in the leave opcode. Make db_methods static.
+
+Sun Sep 30 11:57:15 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: compiler and ANSI C portability fixes.
+
+Fri Sep 28 19:37:46 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: Implemented ldtoken, conv.ovf.i. Use MonoClass->byval_arg
+ (and remove related kludges). Don't choke on access to arrays of
+ references. Throw an exception when an internalcall or P/Invoke
+ function don't have an implementation. Throw and EngineException
+ for unimplemented opcodes.
+
+Tue Sep 25 11:12:35 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fixed get_virtual_method () to deal with interface
+ methods better.
+
+Mon Sep 24 18:50:25 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: catch a few more error conditions with exceptions instead of
+ erroring out.
+ Don't use g_print() in stack traces because it doesn't work with
+ some float values.
+ When we call an instance method of a valuetype class, unbox the 'this'
+ argument if it is an object.
+ Use mono_ldstr () to implement the ldstr opcode: it takes care of
+ interning the string if necessary.
+ Implemented new opcodes: ckfinite, cgt.un, clt.un, ldvirtftn, ldarga.
+ Fixes to handle NaNs when comparing doubles.
+ Make sure the loaded assembly has an entry point defined.
+ Fixed portability bugs in neg and not opcodes.
+
+2001-09-24 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_exec_method): LDC_I4: 8bit constants are signed
+ (ves_exec_method): bug fix for NOT/NEG
+ (main): fix bug in parameter parsing
+
+2001-09-23 Dick Porter <dick@ximian.com>
+
+ * Makefile.am (mint_LDADD): rename PTHREAD_LIBS to THREAD_LIBS
+
+2001-09-23 Dick Porter <dick@ximian.com>
+
+ * interp.c (main): Do some thread setup and cleanup around the
+ call to ves_exec()
+
+2001-09-21 Dick Porter <dick@ximian.com>
+
+ * Makefile.am (mint_LDADD): Added PTHREAD_LIBS to the link line
+
+Thu Sep 20 16:32:42 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: implemented some more opcodes: calli, rem.un,
+ shr.un, conv.u, cpobj, stobj, conv.r.un, conv.ovf.i1.un,
+ conv.ovf.i2.un, conv.ovf.i4.un, conv.ovf.i8.un, conv.ovf.i.un,
+ conv.ovf.u1.un, conv.ovf.u2.un, conv.ovf.u4.un, conv.ovf.u8.un,
+ conv.ovf.u.un.
+ Fix some 64 bit issues in the array element access code and a small bug.
+ Throw an exception on index out of range instead of asserting.
+ Throw an exception on a NULL array instead of dying.
+ Stomped a memory corruption bug (.cctor methods were freed after
+ executing them, but they are stores in MonoClass now...).
+ Added a simple facility to invoke the debugger when a named
+ function is entered (use the cmdline option --debug method_name).
+ * interp.h: fix 64 bit issue.
+
+Tue Sep 18 13:21:33 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fix some 64 bit issues. Safer support for delegates.
+
+2001-09-12 Miguel de Icaza <miguel@ximian.com>
+
+ * interp.c (ves_exec_method): implement conv.u8 opcode.
+
+Mon Sep 10 20:20:36 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: endian fixes, comments.
+
+Fri Sep 7 18:45:38 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c, interp.h: make ves_exec_method () and stackval_from_data ()
+ non static. Implement a couple of runtime methods needed to
+ use delegates (ves_runtime_method ()).
+ Implemented ldftn opcode.
+
+Thu Sep 6 15:41:24 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am: link to libmonoarch.
+ * interp.h, interp.c: use mono_create_trampoline ().
+ Pass the command line arguments to Main (String[]) methods.
+
+2001-08-30 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_pinvoke_method): removed the libffi dependency
+
+2001-08-29 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_array_set): moved from icall.c
+ (ves_array_get): moved from icall.c
+
+ * icall.c: moved to metadata/icall.c
+
+Wed Aug 29 12:46:06 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: some small optimizations. Fixes to do signed
+ compares when needed. Change C++ comments into C.
+ Implemented cgt, clt. Added --opcode-count cmdline switch.
+
+2001-08-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_exec_method): better check for value types (get
+ the class to detect if we have a value type), implemented CEE_CONV_U1,
+ CEE_CONV_U2, CEE_CEQ
+
+
+Mon Aug 27 21:30:30 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: warn and exit when Main () expects the cmdline arguments
+ instead of creashing.
+
+Mon Aug 27 20:16:37 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: merge isinst/castclass handling. Hopefully implement
+ the right semantics for handling callvirt correctly (changes
+ here and there to support it). Integrate bugfix from Dietmar quickly
+ so he needs to handle the cvs conflict:-)
+
+Mon Aug 27 12:20:32 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fix compilation and updates for changes in metadata/.
+
+2001-08-26 Miguel de Icaza <miguel@ximian.com>
+
+ * interp.c (main): Add option handling for the interpreter,
+ support the `--trace' option.
+
+Sun Aug 26 23:04:46 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: get in a dummy virtual method dispatch.
+ Added support for int64, native int and native uint as arguments.
+ Added debug enter/leave for icall and pinvoke methods, too.
+ Implement opcodes conv.i, conv.i8, ldelema.
+
+Sun Aug 26 11:37:30 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.h, interp.c: load also a MonoClass pointer when we load
+ an address on the stack. Implemented conv.i1, conv.i2, con.i4,
+ conv.u4, conv.r4, conv.r8. Print the arguments in the stack trace
+ and the name of the exception.
+
+Sat Aug 25 15:56:03 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: Implemented some opcodes: starg.s, ldobj, isinst,
+ ldarg, starg, ldloc, ldloca, stloc, initobj, cpblk, sizeof.
+
+Sat Aug 25 12:57:36 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: handle enumerations specially (not as valuetypes).
+
+Fri Aug 24 19:34:04 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.h, interp.c: add support for valuetypes.
+
+Fri Aug 24 16:09:20 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: updates for merge of MonoParam in MonoType.
+
+Thu Aug 23 12:04:34 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: removed beforefieldinit check, it's a useless flag.
+ Added a couple more test cases to tests/ dir.
+
+2001-08-22 Miguel de Icaza <miguel@ximian.com>
+
+ * interp.c (usage): Add version information
+ (ves_pinvoke_method): Typo fix.
+
+Wed Aug 22 20:37:51 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: simplified init_class (). Make sure a class
+ is fully initialized before executing a method in the class.
+ Search for the class constructor only on beforefieldinit classes.
+ Implement a bunch of opcodes: br, brfalse, brtrue, beq, bge,
+ bgt, blt, ble, bne.un, bge.un, bgt.un, ble.un, blt.un, stind.i,
+ ldflda, ldsflda, ldelem.i8, stelem.i8, leave.
+
+Wed Aug 22 16:34:03 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: Updates for changes in metadata/. Better output in debug mode
+ and in the stack trace. Completed rethrow handling
+
+Tue Aug 21 18:56:19 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: new macro INIT_FRAME() to properly
+ initialize a MonoInvocation. Fixed a couple of buglets in exception code:
+ increase stack pointer when pushing the exception for catch blocks,
+ initialize frame->ex_handler to NULL, correctly try all the
+ catch blocks (don't incorrectly fallback on filter handling).
+ Added a couple more checks where we may need to throw an
+ exception. Added more exception creation functions.
+ Changed stackval_from_data() to take the target stackval as
+ argument. Implemented a couple more opcodes.
+ * interp.h: prepare stackval for value type code.
+
+2001-08-21 Miguel de Icaza <miguel@ximian.com>
+
+ * Makefile.am (mint_LDADD): Renamed interpreter to mint.
+
+2001-08-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (get_named_exception): use the right constructor.
+
+Mon Aug 20 18:58:36 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fix buglet with the leave.s opcode.
+
+2001-08-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * icall.c: changed everything to support the new calling convention
+
+ * hacks.h: added some macros for FreeBSD
+
+ * interp.c (get_named_exception): use mono_object_new instead of
+ newobj, initialize the stack before we call the constructor.
+
+Sat Aug 18 12:43:38 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c, interp.h: added support code to create exceptions.
+ Changed interncal calling convnetion over to MonoInvocation, to support
+ exceptions, walking the stack back and forward and passing the 'this'
+ pointer separately (remove the cludges required before to pass this on the
+ stack). Use alloca heavily for both local vars and a copy of the incoming
+ arguments. Init local vars to zero.
+ Simplify stackval_from_data() and stackval_to_data() to only take a pointer
+ instead of pointer + offset.
+ Implement a few exceptions-related opcodes and the code to run finally, fault and
+ catch blocks as well as a stack trace if no handler is found.
+
+2001-08-16 Alex Graveley <alex@ximian.com>
+
+ * Makefile.am (mono_int_LDADD): Link with ../../libffi/libffi.a
+ instead of ../../libffi/.libs/libffi.a.
+
+2001-08-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_exec_method): impl CASTCLASS
+
+ * icall.c: moved the internal call stuff to this file
+
+ * interp.c (ves_exec_method): impl. BOX/UNBOX
+ (ves_icall_System_Array_GetValue): impl.
+ (ves_icall_System_Array_SetValue): impl.
+ added myself to Authors
+
+2001-08-09 Dietmar Maurer <dietmar@ximian.com>
+
+ * implemented arrays, but you will need a modified version of
+ Array.cs to get arrays working (will commit soon)
+
+ * interp.c (ves_icall_array_Set): impl.
+ (ves_icall_array_Get): impl.
+ (ves_icall_array_ctor): impl.
+ (ves_icall_System_Array_GetRank): impl.
+ (ves_icall_System_Array_GetLength): impl.
+ (ves_icall_System_Array_GetLowerBound): impl.
+ (mono_lookup_internal_call): impl.
+
+2001-08-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_exec_method): impl. NEWARR
+ (ves_exec_method): impl. most LDELEM/STELEM opcodes, LDLEN
+ (newarr): impl.
+ (mono_get_ansi_string): impl.
+ (mono_lookup_internal_call): impl.
+ (ves_exec_method): implemented internal calls
+
+2001-08-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_pinvoke_method): removed all static vars.
+
+2001-08-02 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_exec_method): found a way to do unordered
+ compares, implemented CEE_BNE_UN_S, CEE_BGE_UN_S, CEE_BGT_UN_S,
+ CEE_BLE_UN_S, CEE_BLT_UN_S
+
+Wed Aug 1 22:51:38 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: handle also MONO_TYPE_CLASS to/from the stack.
+ Change locals to be a memory blob, instead of the structured
+ (but wrong) stackval. Implement bne.un.s opcode. Make the program
+ exit with the error code from Main().
+
+2001-08-01 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_exec_method): implemented LDSTR
+
+2001-07-31 Miguel de Icaza <miguel@ximian.com>
+
+ * interp.c (GET_NATI): Switched from using nati_t to cli/types.h
+ m_i type. Maybe we should rename the types to be m_i_t instead of
+ m_i alone.
+
+ Make the code compile after I broke it.
+
+Tue Jul 31 23:46:33 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: fix cleanup.
+ * Makefile.am: don't link with disassembler library.
+
+2001-07-31 Miguel de Icaza <miguel@ximian.com>
+
+ (ves_exec_method): Cleanup of the source code.
+
+Tue Jul 31 20:13:59 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: implement stind.*, ldind.*, ldloca.s opcodes.
+ Provide better tracing with DEBUG_INTERP.
+
+Tue Jul 31 17:52:53 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: massive namespace cleanup.
+
+Mon Jul 30 20:09:58 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: update to use mono_method->name.
+
+Fri Jul 27 20:54:00 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: start implementing callvirt. Classes with
+ class constructors are properly initialized when needed.
+ Fix error introduced in version 1.17.
+
+Fri Jul 27 14:03:19 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: implement static field loading and storing.
+
+2001-07-27 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.c (ves_pinvoke_method): impl.
+
+Fri Jul 27 11:49:19 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: Removed some debugging printouts. Made stackval_to_data
+ static. Handle also instance methods in CALL opcode. Fix ret to properly
+ deal with void functions. Fixed constructor to leave the object on
+ the stack.
+
+Thu Jul 26 13:24:51 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c: ves_exec_method () doesn't take a MonoImage arg
+ anymore. Use the method cache in MonoImage. Updates to
+ mache recent changes in metadata.
+ Fix newobj code to use new metadata features. Call the class
+ constructor after allocationg the object. Implemented load field
+ and store field opcodes (the support functions need to be finished).
+
+Tue Jul 24 16:51:09 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * interp.c, hacks.h: moved a few ugly macros out of the code.
+ Implemented switch opcode.
+
+2001-07-23 Miguel de Icaza <miguel@ximian.com>
+
+ * interp.c (newobj): Added function to handle newobj opcode.
+
+2001-07-18 Miguel de Icaza <miguel@ximian.com>
+
+ * interp.c (ves_exec_method): Make the interpreter abort with more
+ information than it currently does.
+
+ Enable the slow processor, as it is easier to debug.
+
+Sun Jul 15 17:50:23 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Started changelog.
+ * interp.c: use new mono_get_method () function to get the complete
+ info on a method invocation: we support now method invocation with
+ multiple (or zero) simple arguments and with or without a return value.
+ Implement also a couple more opcodes.
diff --git a/mono/interpreter/Makefile.am b/mono/interpreter/Makefile.am
new file mode 100644
index 00000000000..d40e9111fee
--- /dev/null
+++ b/mono/interpreter/Makefile.am
@@ -0,0 +1,25 @@
+INCLUDES = \
+ -I$(top_srcdir) \
+ $(GMODULE_CFLAGS) \
+ $(GLIB_CFLAGS)
+
+bin_PROGRAMS = mint
+
+mint_SOURCES = \
+ hacks.h \
+ interp.h \
+ interp.c
+
+mint_LDADD = \
+ ../arch/libmonoarch.la \
+ ../metadata/libmonoruntime.a \
+ ../metadata/libmetadata.a \
+ ../io-layer/libwapi.a \
+ ../utils/libmonoutils.a \
+ $(GLIB_LIBS) \
+ $(GMODULE_LIBS) \
+ -lm
+
+man_MANS = mint.1
+
+EXTRA_DIST = $(man_MANS)
diff --git a/mono/interpreter/hacks.h b/mono/interpreter/hacks.h
new file mode 100644
index 00000000000..ccf074a4991
--- /dev/null
+++ b/mono/interpreter/hacks.h
@@ -0,0 +1,116 @@
+/* we need some special math function */
+#ifndef _ISOC99_SOURCE
+#define _ISOC99_SOURCE
+#endif
+#include <math.h>
+
+/* which are not defined on FreeBSD */
+#ifndef isunordered
+# define isunordered(u, v) \
+ (__extension__ \
+ ({ __typeof__(u) __u = (u); __typeof__(v) __v = (v); \
+ isnan(__u) || isnan(__v); }))
+#endif
+
+#ifndef islessgreater
+# define islessgreater(x, u) \
+ (__extension__ \
+ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+ !isunordered (__x, __y) && (__x < __y) || (__y < __x); }))
+#endif
+
+#ifndef islessequal
+# define islessequal(x, y) \
+ (__extension__ \
+ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+ !isunordered(__x, __y) && __x <= __y; }))
+#endif
+
+#ifndef isless
+# define isless(x, y) \
+ (__extension__ \
+ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+ !isunordered(__x, __y) && __x < __y; }))
+#endif
+
+#ifndef isgreater
+# define isgreater(x, y) \
+ (__extension__ \
+ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+ !isunordered(__x, __y) && __x > __y; }))
+#endif
+
+/*
+ * Attempt at using the goto label construct of GNU GCC:
+ * it turns out this does give some benefit: 5-15% speedup.
+ * Don't look at these macros, it hurts...
+ */
+#define GOTO_LABEL
+#undef GOTO_LABEL
+#ifdef GOTO_LABEL
+
+#define SWITCH(a) goto *goto_map [(a)];
+#define BREAK SWITCH(*ip)
+#define CASE(l) l ## _LABEL:
+#define DEFAULT \
+ CEE_ILLEGAL_LABEL: \
+ CEE_ENDMAC_LABEL:
+#define SUB_SWITCH \
+ CEE_PREFIX1_LABEL: \
+ CEE_ARGLIST_LABEL: \
+ CEE_CEQ_LABEL: \
+ CEE_CGT_LABEL: \
+ CEE_CGT_UN_LABEL: \
+ CEE_CLT_LABEL: \
+ CEE_CLT_UN_LABEL: \
+ CEE_LDFTN_LABEL: \
+ CEE_LDVIRTFTN_LABEL: \
+ CEE_UNUSED56_LABEL: \
+ CEE_LDARG_LABEL: \
+ CEE_LDARGA_LABEL: \
+ CEE_STARG_LABEL: \
+ CEE_LDLOC_LABEL: \
+ CEE_LDLOCA_LABEL: \
+ CEE_STLOC_LABEL: \
+ CEE_LOCALLOC_LABEL: \
+ CEE_UNUSED57_LABEL: \
+ CEE_ENDFILTER_LABEL: \
+ CEE_UNALIGNED__LABEL: \
+ CEE_VOLATILE__LABEL: \
+ CEE_TAIL__LABEL: \
+ CEE_INITOBJ_LABEL: \
+ CEE_UNUSED68_LABEL: \
+ CEE_CPBLK_LABEL: \
+ CEE_INITBLK_LABEL: \
+ CEE_UNUSED69_LABEL: \
+ CEE_RETHROW_LABEL: \
+ CEE_UNUSED_LABEL: \
+ CEE_SIZEOF_LABEL: \
+ CEE_REFANYTYPE_LABEL: \
+ CEE_UNUSED52_LABEL: \
+ CEE_UNUSED53_LABEL: \
+ CEE_UNUSED54_LABEL: \
+ CEE_UNUSED55_LABEL: \
+ CEE_UNUSED70_LABEL:
+#define GOTO_LABEL_VARS \
+ const static void * const goto_map [] = {\
+#define OPDEF(a,b,c,d,e,f,g,h,i,j) \ \
+ && a ## _LABEL, \
+#include "mono/cil/opcode.def" \
+#undef OPDEF \
+ &&DUMMY_LABEL \
+ }; \
+ DUMMY_LABEL:
+
+#else
+
+#define SWITCH(a) switch(a)
+#define BREAK break
+#define CASE(l) case l:
+#define DEFAULT \
+ default: \
+ g_error ("Unimplemented opcode: %x at 0x%x\n", *ip, ip-header->code);
+#define SUB_SWITCH case 0xFE:
+#define GOTO_LABEL_VARS
+
+#endif
diff --git a/mono/interpreter/interp.c b/mono/interpreter/interp.c
new file mode 100644
index 00000000000..abc35ad377e
--- /dev/null
+++ b/mono/interpreter/interp.c
@@ -0,0 +1,3987 @@
+/*
+ * PLEASE NOTE: This is a research prototype.
+ *
+ *
+ * interp.c: Interpreter for CIL byte codes
+ *
+ * Authors:
+ * Paolo Molaro (lupus@ximian.com)
+ * Miguel de Icaza (miguel@ximian.com)
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+#ifndef __USE_ISOC99
+#define __USE_ISOC99
+#endif
+#include "config.h"
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <setjmp.h>
+#include <signal.h>
+
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#endif
+
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#else
+# ifdef __CYGWIN__
+# define alloca __builtin_alloca
+# endif
+#endif
+
+/* trim excessive headers */
+#include <mono/metadata/image.h>
+#include <mono/metadata/assembly.h>
+#include <mono/metadata/cil-coff.h>
+#include <mono/metadata/mono-endian.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/blob.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/metadata/loader.h>
+#include <mono/metadata/threads.h>
+#include <mono/metadata/profiler-private.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/reflection.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/verify.h>
+#include <mono/metadata/opcodes.h>
+#include <mono/metadata/debug-helpers.h>
+#include <mono/io-layer/io-layer.h>
+#include <mono/metadata/socket-io.h>
+/*#include <mono/cli/types.h>*/
+#include "interp.h"
+#include "hacks.h"
+
+#ifdef _WIN32
+#define isnan _isnan
+#define finite _finite
+#endif
+
+/* If true, then we output the opcodes as we interpret them */
+static int global_tracing = 0;
+
+static int debug_indent_level = 0;
+
+/*
+ * Pull the list of opcodes
+ */
+#define OPDEF(a,b,c,d,e,f,g,h,i,j) \
+ a = i,
+
+enum {
+#include "mono/cil/opcode.def"
+ LAST = 0xff
+};
+#undef OPDEF
+
+#define GET_NATI(sp) ((sp).data.nati)
+#define CSIZE(x) (sizeof (x) / 4)
+
+#define INIT_FRAME(frame,parent_frame,obj_this,method_args,method_retval,mono_method) \
+ do { \
+ (frame)->parent = (parent_frame); \
+ (frame)->obj = (obj_this); \
+ (frame)->stack_args = (method_args); \
+ (frame)->retval = (method_retval); \
+ (frame)->method = (mono_method); \
+ (frame)->ex_handler = NULL; \
+ (frame)->ex = NULL; \
+ (frame)->child = NULL; \
+ } while (0)
+
+void ves_exec_method (MonoInvocation *frame);
+
+typedef void (*ICallMethod) (MonoInvocation *frame);
+
+static guint32 die_on_exception = 0;
+static guint32 frame_thread_id = 0;
+
+#define DEBUG_INTERP 1
+#if DEBUG_INTERP
+
+static unsigned long opcode_count = 0;
+static unsigned long fcall_count = 0;
+static int break_on_method = 0;
+static GList *db_methods = NULL;
+
+static void
+output_indent (void)
+{
+ int h;
+
+ for (h = 0; h < debug_indent_level; h++)
+ g_print (" ");
+}
+
+static void
+db_match_method (gpointer data, gpointer user_data)
+{
+ MonoMethod *m = (MonoMethod*)user_data;
+ MonoMethodDesc *desc = data;
+
+ if (mono_method_desc_full_match (desc, m))
+ break_on_method = 1;
+}
+
+#define DEBUG_ENTER() \
+ fcall_count++; \
+ g_list_foreach (db_methods, db_match_method, (gpointer)frame->method); \
+ if (break_on_method) tracing=2; \
+ break_on_method = 0; \
+ if (tracing) { \
+ MonoClass *klass = frame->method->klass; \
+ char *args = dump_stack (frame->stack_args, frame->stack_args+signature->param_count); \
+ debug_indent_level++; \
+ output_indent (); \
+ g_print ("(%d) Entering %s.%s::%s (", GetCurrentThreadId(), klass->name_space, klass->name, frame->method->name); \
+ if (signature->hasthis) g_print ("%p ", frame->obj); \
+ g_print ("%s)\n", args); \
+ g_free (args); \
+ } \
+ if (mono_profiler_events & MONO_PROFILE_ENTER_LEAVE) \
+ mono_profiler_method_enter (frame->method);
+
+#define DEBUG_LEAVE() \
+ if (tracing) { \
+ MonoClass *klass = frame->method->klass; \
+ char *args; \
+ if (signature->ret->type != MONO_TYPE_VOID) \
+ args = dump_stack (frame->retval, frame->retval + 1); \
+ else \
+ args = g_strdup (""); \
+ output_indent (); \
+ g_print ("(%d) Leaving %s.%s::%s", GetCurrentThreadId(), klass->name_space, klass->name, frame->method->name); \
+ g_print (" => %s\n", args); \
+ g_free (args); \
+ debug_indent_level--; \
+ } \
+ if (mono_profiler_events & MONO_PROFILE_ENTER_LEAVE) \
+ mono_profiler_method_leave (frame->method);
+
+#else
+
+#define DEBUG_ENTER()
+#define DEBUG_LEAVE()
+
+#endif
+
+static void
+interp_ex_handler (MonoException *ex) {
+ MonoInvocation *frame = TlsGetValue (frame_thread_id);
+ frame->ex = ex;
+ longjmp (*(jmp_buf*)frame->locals, 1);
+}
+
+static void
+ves_real_abort (int line, MonoMethod *mh,
+ const unsigned char *ip, stackval *stack, stackval *sp)
+{
+ MonoMethodNormal *mm = (MonoMethodNormal *)mh;
+ fprintf (stderr, "Execution aborted in method: %s::%s\n", mh->klass->name, mh->name);
+ fprintf (stderr, "Line=%d IP=0x%04x, Aborted execution\n", line,
+ ip-mm->header->code);
+ g_print ("0x%04x %02x\n",
+ ip-mm->header->code, *ip);
+ if (sp > stack)
+ printf ("\t[%d] %d 0x%08x %0.5f\n", sp-stack, sp[-1].type, sp[-1].data.i, sp[-1].data.f);
+}
+#define ves_abort() do {ves_real_abort(__LINE__, frame->method, ip, frame->stack, sp); THROW_EX (mono_get_exception_execution_engine (NULL), ip);} while (0);
+
+static gpointer
+interp_create_remoting_trampoline (MonoMethod *method)
+{
+ return method;
+}
+
+static MonoMethod*
+get_virtual_method (MonoDomain *domain, MonoMethod *m, stackval *objs)
+{
+ MonoObject *obj;
+ MonoClass *klass;
+ MonoMethod **vtable;
+
+ if ((m->flags & METHOD_ATTRIBUTE_FINAL) || !(m->flags & METHOD_ATTRIBUTE_VIRTUAL))
+ return m;
+
+ obj = objs->data.p;
+ klass = obj->vtable->klass;
+ vtable = (MonoMethod **)obj->vtable->vtable;
+
+ if (m->klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+ return *(MonoMethod**)((char*)obj->vtable->interface_offsets [m->klass->interface_id] + (m->slot<<2));
+ }
+
+ g_assert (vtable [m->slot]);
+
+ return vtable [m->slot];
+}
+
+void inline
+stackval_from_data (MonoType *type, stackval *result, char *data)
+{
+ if (type->byref) {
+ switch (type->type) {
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY:
+ result->type = VAL_OBJ;
+ break;
+ default:
+ result->type = VAL_VALUETA;
+ break;
+ }
+ result->data.p = *(gpointer*)data;
+ result->data.vt.klass = mono_class_from_mono_type (type);
+ return;
+ }
+ switch (type->type) {
+ case MONO_TYPE_VOID:
+ return;
+ case MONO_TYPE_I1:
+ result->type = VAL_I32;
+ result->data.i = *(gint8*)data;
+ return;
+ case MONO_TYPE_U1:
+ case MONO_TYPE_BOOLEAN:
+ result->type = VAL_I32;
+ result->data.i = *(guint8*)data;
+ return;
+ case MONO_TYPE_I2:
+ result->type = VAL_I32;
+ result->data.i = *(gint16*)data;
+ return;
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ result->type = VAL_I32;
+ result->data.i = *(guint16*)data;
+ return;
+ case MONO_TYPE_I4:
+ result->type = VAL_I32;
+ result->data.i = *(gint32*)data;
+ return;
+ case MONO_TYPE_U:
+ case MONO_TYPE_I:
+ case MONO_TYPE_PTR:
+ result->type = VAL_TP;
+ result->data.p = *(gpointer*)data;
+ return;
+ case MONO_TYPE_U4:
+ result->type = VAL_I32;
+ result->data.i = *(guint32*)data;
+ return;
+ case MONO_TYPE_R4:
+ result->type = VAL_DOUBLE;
+ result->data.f = *(float*)data;
+ return;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ result->type = VAL_I64;
+ result->data.l = *(gint64*)data;
+ return;
+ case MONO_TYPE_R8:
+ result->type = VAL_DOUBLE;
+ result->data.f = *(double*)data;
+ return;
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_ARRAY:
+ result->type = VAL_OBJ;
+ result->data.p = *(gpointer*)data;
+ result->data.vt.klass = mono_class_from_mono_type (type);
+ return;
+ case MONO_TYPE_VALUETYPE:
+ if (type->data.klass->enumtype) {
+ return stackval_from_data (type->data.klass->enum_basetype, result, data);
+ } else {
+ result->type = VAL_VALUET;
+ result->data.vt.klass = type->data.klass;
+ memcpy (result->data.vt.vt, data, mono_class_value_size (type->data.klass, NULL));
+ }
+ return;
+ default:
+ g_warning ("got type 0x%02x", type->type);
+ g_assert_not_reached ();
+ }
+}
+
+static void inline
+stackval_to_data (MonoType *type, stackval *val, char *data)
+{
+ if (type->byref) {
+ gpointer *p = (gpointer*)data;
+ *p = val->data.p;
+ return;
+ }
+ switch (type->type) {
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1: {
+ guint8 *p = (guint8*)data;
+ *p = val->data.i;
+ return;
+ }
+ case MONO_TYPE_BOOLEAN: {
+ guint8 *p = (guint8*)data;
+ *p = (val->data.i != 0);
+ return;
+ }
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR: {
+ guint16 *p = (guint16*)data;
+ *p = val->data.i;
+ return;
+ }
+#if SIZEOF_VOID_P == 4
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+#endif
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4: {
+ gint32 *p = (gint32*)data;
+ *p = val->data.i;
+ return;
+ }
+#if SIZEOF_VOID_P == 8
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+#endif
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8: {
+ gint64 *p = (gint64*)data;
+ *p = val->data.l;
+ return;
+ }
+ case MONO_TYPE_R4: {
+ float *p = (float*)data;
+ *p = val->data.f;
+ return;
+ }
+ case MONO_TYPE_R8: {
+ double *p = (double*)data;
+ *p = val->data.f;
+ return;
+ }
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_PTR: {
+ gpointer *p = (gpointer*)data;
+ *p = val->data.p;
+ return;
+ }
+ case MONO_TYPE_VALUETYPE:
+ if (type->data.klass->enumtype) {
+ return stackval_to_data (type->data.klass->enum_basetype, val, data);
+ } else {
+ memcpy (data, val->data.vt.vt, mono_class_value_size (type->data.klass, NULL));
+ }
+ return;
+ default:
+ g_warning ("got type %x", type->type);
+ g_assert_not_reached ();
+ }
+}
+
+static MonoObject*
+ves_array_create (MonoDomain *domain, MonoClass *klass, MonoMethodSignature *sig, stackval *values)
+{
+ guint32 *lengths;
+ guint32 *lower_bounds;
+ int i;
+
+ lengths = alloca (sizeof (guint32) * klass->rank * 2);
+ for (i = 0; i < sig->param_count; ++i) {
+ lengths [i] = values->data.i;
+ values ++;
+ }
+ if (klass->rank == sig->param_count) {
+ /* Only lengths provided. */
+ lower_bounds = NULL;
+ } else {
+ /* lower bounds are first. */
+ lower_bounds = lengths;
+ lengths += klass->rank;
+ }
+ return (MonoObject*)mono_array_new_full (domain, klass, lengths, lower_bounds);
+}
+
+static void
+ves_array_set (MonoInvocation *frame)
+{
+ stackval *sp = frame->stack_args;
+ MonoObject *o;
+ MonoArray *ao;
+ MonoClass *ac;
+ gint32 i, t, pos, esize;
+ gpointer ea;
+ MonoType *mt;
+
+ o = frame->obj;
+ ao = (MonoArray *)o;
+ ac = o->vtable->klass;
+
+ g_assert (ac->rank >= 1);
+
+ pos = sp [0].data.i;
+ if (ao->bounds != NULL) {
+ pos -= ao->bounds [0].lower_bound;
+ for (i = 1; i < ac->rank; i++) {
+ if ((t = sp [i].data.i - ao->bounds [i].lower_bound) >=
+ ao->bounds [i].length) {
+ g_warning ("wrong array index");
+ g_assert_not_reached ();
+ }
+ pos = pos*ao->bounds [i].length + sp [i].data.i -
+ ao->bounds [i].lower_bound;
+ }
+ }
+
+ esize = mono_array_element_size (ac);
+ ea = mono_array_addr_with_size (ao, esize, pos);
+
+ mt = frame->method->signature->params [ac->rank];
+ stackval_to_data (mt, &sp [ac->rank], ea);
+}
+
+static void
+ves_array_get (MonoInvocation *frame)
+{
+ stackval *sp = frame->stack_args;
+ MonoObject *o;
+ MonoArray *ao;
+ MonoClass *ac;
+ gint32 i, pos, esize;
+ gpointer ea;
+ MonoType *mt;
+
+ o = frame->obj;
+ ao = (MonoArray *)o;
+ ac = o->vtable->klass;
+
+ g_assert (ac->rank >= 1);
+
+ pos = sp [0].data.i;
+ if (ao->bounds != NULL) {
+ pos -= ao->bounds [0].lower_bound;
+ for (i = 1; i < ac->rank; i++)
+ pos = pos*ao->bounds [i].length + sp [i].data.i -
+ ao->bounds [i].lower_bound;
+ }
+
+ esize = mono_array_element_size (ac);
+ ea = mono_array_addr_with_size (ao, esize, pos);
+
+ mt = frame->method->signature->ret;
+ stackval_from_data (mt, frame->retval, ea);
+}
+
+static void
+ves_array_element_address (MonoInvocation *frame)
+{
+ stackval *sp = frame->stack_args;
+ MonoObject *o;
+ MonoArray *ao;
+ MonoClass *ac;
+ gint32 i, pos, esize;
+ gpointer ea;
+
+ o = frame->obj;
+ ao = (MonoArray *)o;
+ ac = o->vtable->klass;
+
+ g_assert (ac->rank >= 1);
+
+ pos = sp [0].data.i;
+ if (ao->bounds != NULL) {
+ pos -= ao->bounds [0].lower_bound;
+ for (i = 1; i < ac->rank; i++)
+ pos = pos*ao->bounds [i].length + sp [i].data.i -
+ ao->bounds [i].lower_bound;
+ }
+
+ esize = mono_array_element_size (ac);
+ ea = mono_array_addr_with_size (ao, esize, pos);
+
+ frame->retval->type = VAL_TP;
+ frame->retval->data.p = ea;
+}
+
+static void
+ves_pinvoke_method (MonoInvocation *frame)
+{
+ jmp_buf env;
+ MonoPIFunc func;
+
+ if (setjmp(env)) {
+ TlsSetValue (frame_thread_id, frame->args);
+ return;
+ }
+ if (!frame->method->info)
+ frame->method->info = mono_create_trampoline (frame->method, 0);
+ func = (MonoPIFunc)frame->method->info;
+
+ /*
+ * frame->locals and args are unused for P/Invoke methods, so we reuse them.
+ * locals will point to the jmp_buf, while args will point to the previous
+ * MonoInvocation frame: this is needed to make exception searching work across
+ * managed/unmanaged boundaries.
+ */
+ frame->locals = (char*)&env;
+ frame->args = (char*)TlsGetValue (frame_thread_id);
+ TlsSetValue (frame_thread_id, frame);
+
+ func ((MonoFunc)frame->method->addr, &frame->retval->data.p, frame->obj, frame->stack_args);
+ stackval_from_data (frame->method->signature->ret, frame->retval, (char*)&frame->retval->data.p);
+ TlsSetValue (frame_thread_id, frame->args);
+}
+
+/*
+ * From the spec:
+ * runtime specifies that the implementation of the method is automatically
+ * provided by the runtime and is primarily used for the methods of delegates.
+ */
+static void
+ves_runtime_method (MonoInvocation *frame)
+{
+ const char *name = frame->method->name;
+ MonoObject *obj = (MonoObject*)frame->obj;
+ MonoMulticastDelegate *delegate = (MonoMulticastDelegate*)frame->obj;
+ MonoInvocation call;
+
+ mono_class_init (mono_defaults.multicastdelegate_class);
+
+ if (*name == '.' && (strcmp (name, ".ctor") == 0) && obj &&
+ mono_object_isinst (obj, mono_defaults.multicastdelegate_class)) {
+ delegate->delegate.target = frame->stack_args[0].data.p;
+ delegate->delegate.method_ptr = frame->stack_args[1].data.p;
+ delegate->delegate.method_info = mono_method_get_object (mono_object_domain(delegate), mono_method_pointer_get (delegate->delegate.method_ptr));
+ return;
+ }
+ if (*name == 'I' && (strcmp (name, "Invoke") == 0) && obj &&
+ mono_object_isinst (obj, mono_defaults.multicastdelegate_class)) {
+ guchar *code;
+ MonoMethod *method;
+
+ while (delegate) {
+
+ code = (guchar*)delegate->delegate.method_ptr;
+ method = mono_method_pointer_get (code);
+#if 1
+ /* FIXME: check for NULL method */
+ INIT_FRAME(&call,frame,delegate->delegate.target,frame->stack_args,frame->retval,method);
+ ves_exec_method (&call);
+#else
+ if (!method->addr)
+ method->addr = mono_create_trampoline (method, 1);
+ func = method->addr;
+ /* FIXME: need to handle exceptions across managed/unmanaged boundaries */
+ func ((MonoFunc)delegate->method_ptr, &frame->retval->data.p, delegate->target, frame->stack_args);
+#endif
+ stackval_from_data (frame->method->signature->ret, frame->retval, (char*)&frame->retval->data.p);
+ delegate = delegate->prev;
+ }
+ return;
+ }
+ g_error ("Don't know how to exec runtime method %s.%s::%s",
+ frame->method->klass->name_space, frame->method->klass->name,
+ frame->method->name);
+}
+
+static char*
+dump_stack (stackval *stack, stackval *sp)
+{
+ stackval *s = stack;
+ GString *str = g_string_new ("");
+
+ if (sp == stack)
+ return g_string_free (str, FALSE);
+
+ while (s < sp) {
+ switch (s->type) {
+ case VAL_I32: g_string_sprintfa (str, "[%d] ", s->data.i); break;
+ case VAL_I64: g_string_sprintfa (str, "[%lld] ", s->data.l); break;
+ case VAL_DOUBLE: g_string_sprintfa (str, "[%0.5f] ", s->data.f); break;
+ case VAL_VALUET: g_string_sprintfa (str, "[vt: %p] ", s->data.vt.vt); break;
+#if 0
+ case VAL_OBJ: {
+ MonoObject *obj = s->data.p;
+ if (obj && obj->klass == mono_defaults.string_class) {
+ char *str = mono_string_to_utf8 ((MonoString*)obj);
+ printf ("\"%s\" ", str);
+ g_free (str);
+ break;
+ }
+ }
+#endif
+ default: g_string_sprintfa (str, "[%p] ", s->data.p); break;
+ }
+ ++s;
+ }
+ return g_string_free (str, FALSE);
+}
+
+static char*
+dump_frame (MonoInvocation *inv)
+{
+ GString *str = g_string_new ("");
+ int i;
+ char *args;
+ for (i = 0; inv; inv = inv->parent, ++i) {
+ MonoClass *k = inv->method->klass;
+ int codep;
+ const char * opname;
+ if (inv->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL ||
+ inv->method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) {
+ codep = 0;
+ opname = "";
+ } else {
+ MonoMethodHeader *hd = ((MonoMethodNormal *)inv->method)->header;
+ if (inv->ip)
+ codep = *(inv->ip) == 0xfe? inv->ip [1] + 256: *(inv->ip);
+ else
+ codep = 0;
+ opname = mono_opcode_names [codep];
+ codep = inv->ip - hd->code;
+ }
+ args = dump_stack (inv->stack_args, inv->stack_args + inv->method->signature->param_count);
+ g_string_sprintfa (str, "#%d: 0x%05x %-10s in %s.%s::%s (%s)\n", i, codep, opname,
+ k->name_space, k->name, inv->method->name, args);
+ g_free (args);
+ }
+ return g_string_free (str, FALSE);
+}
+
+static CRITICAL_SECTION metadata_lock;
+
+typedef enum {
+ INLINE_STRING_LENGTH = 1,
+ INLINE_ARRAY_LENGTH,
+ INLINE_ARRAY_RANK,
+ INLINE_TYPE_ELEMENT_TYPE
+} InlineMethod;
+
+static void
+calc_offsets (MonoImage *image, MonoMethod *method)
+{
+ int i, align, size, offset = 0;
+ MonoMethodHeader *header = ((MonoMethodNormal*)method)->header;
+ MonoMethodSignature *signature = method->signature;
+ int hasthis = signature->hasthis;
+ register const unsigned char *ip, *end;
+ const MonoOpcode *opcode;
+ guint32 token;
+ MonoMethod *m;
+ MonoClass *class;
+ MonoDomain *domain = mono_domain_get ();
+ guint32 *offsets;
+
+ mono_profiler_method_jit (method); /* sort of... */
+ offsets = g_new0 (guint32, 2 + header->num_locals + signature->param_count + signature->hasthis);
+ for (i = 0; i < header->num_locals; ++i) {
+ size = mono_type_size (header->locals [i], &align);
+ offset += align - 1;
+ offset &= ~(align - 1);
+ offsets [2 + i] = offset;
+ offset += size;
+ }
+ offsets [0] = offset;
+ offset = 0;
+ if (hasthis) {
+ offset += sizeof (gpointer) - 1;
+ offset &= ~(sizeof (gpointer) - 1);
+ offsets [2 + header->num_locals] = offset;
+ offset += sizeof (gpointer);
+ }
+ for (i = 0; i < signature->param_count; ++i) {
+ size = mono_type_size (signature->params [i], &align);
+ offset += align - 1;
+ offset &= ~(align - 1);
+ offsets [2 + hasthis + header->num_locals + i] = offset;
+ offset += size;
+ }
+ offsets [1] = offset;
+
+ EnterCriticalSection (&metadata_lock);
+ /* intern the strings in the method. */
+ ip = header->code;
+ end = ip + header->code_size;
+ while (ip < end) {
+ i = *ip;
+ if (*ip == 0xfe) {
+ ip++;
+ i = *ip + 256;
+ }
+ opcode = &mono_opcodes [i];
+ switch (opcode->argument) {
+ case MonoInlineNone:
+ ++ip;
+ break;
+ case MonoInlineString:
+ mono_ldstr (domain, image, mono_metadata_token_index (read32 (ip + 1)));
+ ip += 5;
+ break;
+ case MonoInlineType:
+ class = mono_class_get (image, read32 (ip + 1));
+ mono_class_init (class);
+ if (!(class->flags & TYPE_ATTRIBUTE_INTERFACE))
+ mono_class_vtable (domain, class);
+ ip += 5;
+ break;
+ case MonoInlineField:
+ token = read32 (ip + 1);
+ if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) {
+ mono_field_from_memberref (image, token, &class);
+ } else {
+ class = mono_class_get (image,
+ MONO_TOKEN_TYPE_DEF | mono_metadata_typedef_from_field (image, token & 0xffffff));
+ }
+ mono_class_init (class);
+ mono_class_vtable (domain, class);
+ ip += 5;
+ break;
+ case MonoInlineMethod:
+ m = mono_get_method (image, read32 (ip + 1), NULL);
+ mono_class_init (m->klass);
+ if (!(m->klass->flags & TYPE_ATTRIBUTE_INTERFACE))
+ mono_class_vtable (domain, m->klass);
+ ip += 5;
+ break;
+ case MonoInlineTok:
+ case MonoInlineSig:
+ case MonoShortInlineR:
+ case MonoInlineI:
+ case MonoInlineBrTarget:
+ ip += 5;
+ break;
+ case MonoInlineVar:
+ ip += 3;
+ break;
+ case MonoShortInlineVar:
+ case MonoShortInlineI:
+ case MonoShortInlineBrTarget:
+ ip += 2;
+ break;
+ case MonoInlineSwitch: {
+ guint32 n;
+ ++ip;
+ n = read32 (ip);
+ ip += 4;
+ ip += 4 * n;
+ break;
+ }
+ case MonoInlineR:
+ case MonoInlineI8:
+ ip += 9;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ }
+ method->info = offsets;
+
+ /*
+ * We store the inline info in addr, since it's unused for IL methods.
+ */
+ if (method->klass == mono_defaults.string_class) {
+ if (strcmp (method->name, "get_Length") == 0)
+ method->addr = GUINT_TO_POINTER (INLINE_STRING_LENGTH);
+ } else if (method->klass == mono_defaults.array_class) {
+ if (strcmp (method->name, "get_Length") == 0)
+ method->addr = GUINT_TO_POINTER (INLINE_ARRAY_LENGTH);
+ else if (strcmp (method->name, "get_Rank") == 0 || strcmp (method->name, "GetRank") == 0)
+ method->addr = GUINT_TO_POINTER (INLINE_ARRAY_RANK);
+ } else if (method->klass == mono_defaults.monotype_class) {
+ if (strcmp (method->name, "GetElementType") == 0)
+ method->addr = GUINT_TO_POINTER (INLINE_TYPE_ELEMENT_TYPE);
+ }
+ LeaveCriticalSection (&metadata_lock);
+ mono_profiler_method_end_jit (method, MONO_PROFILE_OK);
+}
+
+#define LOCAL_POS(n) (frame->locals + offsets [2 + (n)])
+#define LOCAL_TYPE(header, n) ((header)->locals [(n)])
+
+#define ARG_POS(n) (args_pointers [(n)])
+#define ARG_TYPE(sig, n) ((n) ? (sig)->params [(n) - (sig)->hasthis] : \
+ (sig)->hasthis ? &frame->method->klass->this_arg: (sig)->params [(0)])
+
+#define THROW_EX(exception,ex_ip) \
+ do {\
+ char *stack_trace; \
+ frame->ip = (ex_ip); \
+ stack_trace = dump_frame (frame); \
+ frame->ex = (MonoException*)(exception); \
+ frame->ex->stack_trace = mono_string_new (domain, stack_trace); \
+ g_free (stack_trace); \
+ goto handle_exception; \
+ } while (0)
+
+typedef struct _vtallocation vtallocation;
+
+struct _vtallocation {
+ vtallocation *next;
+ guint32 size;
+ char data [MONO_ZERO_LEN_ARRAY];
+};
+
+/*
+ * we don't use vtallocation->next, yet
+ */
+#define vt_alloc(vtype,sp) \
+ if ((vtype)->type == MONO_TYPE_VALUETYPE && !(vtype)->data.klass->enumtype) { \
+ if (!(vtype)->byref) { \
+ guint32 align; \
+ guint32 size = mono_class_value_size ((vtype)->data.klass, &align); \
+ if (!vtalloc || vtalloc->size <= size) { \
+ vtalloc = alloca (sizeof (vtallocation) + size); \
+ vtalloc->size = size; \
+ g_assert (size < 10000); \
+ } \
+ (sp)->data.vt.vt = vtalloc->data; \
+ vtalloc = NULL; \
+ } else { \
+ (sp)->data.vt.klass = (vtype)->data.klass; \
+ } \
+ }
+
+#define vt_free(sp) \
+ do { \
+ if ((sp)->type == VAL_VALUET) { \
+ vtalloc = (vtallocation*)(((char*)(sp)->data.vt.vt) - G_STRUCT_OFFSET (vtallocation, data)); \
+ } \
+ } while (0)
+
+static void
+verify_method (MonoMethod *m)
+{
+ GSList *errors, *tmp;
+ MonoVerifyInfo *info;
+
+ errors = mono_method_verify (m, MONO_VERIFY_ALL);
+ if (errors)
+ g_print ("Method %s.%s::%s has invalid IL.\n", m->klass->name_space, m->klass->name, m->name);
+ for (tmp = errors; tmp; tmp = tmp->next) {
+ info = tmp->data;
+ g_print ("%s\n", info->message);
+ }
+ if (errors)
+ G_BREAKPOINT ();
+ mono_free_verify_list (errors);
+}
+
+#define MYGUINT64_MAX 18446744073709551615UL
+#define MYGINT64_MAX 9223372036854775807LL
+#define MYGINT64_MIN (-MYGINT64_MAX -1LL)
+
+#define MYGUINT32_MAX 4294967295U
+#define MYGINT32_MAX 2147483647
+#define MYGINT32_MIN (-MYGINT32_MAX -1)
+
+#define CHECK_ADD_OVERFLOW(a,b) \
+ (gint32)(b) >= 0 ? (gint32)(MYGINT32_MAX) - (gint32)(b) < (gint32)(a) ? -1 : 0 \
+ : (gint32)(MYGINT32_MIN) - (gint32)(b) > (gint32)(a) ? +1 : 0
+
+#define CHECK_ADD_OVERFLOW_UN(a,b) \
+ (guint32)(MYGUINT32_MAX) - (guint32)(b) < (guint32)(a) ? -1 : 0
+
+#define CHECK_ADD_OVERFLOW64(a,b) \
+ (gint64)(b) >= 0 ? (gint64)(MYGINT64_MAX) - (gint64)(b) < (gint64)(a) ? -1 : 0 \
+ : (gint64)(MYGINT64_MIN) - (gint64)(b) > (gint64)(a) ? +1 : 0
+
+#define CHECK_ADD_OVERFLOW64_UN(a,b) \
+ (guint64)(MYGUINT64_MAX) - (guint64)(b) < (guint64)(a) ? -1 : 0
+
+static MonoObject*
+interp_mono_runtime_invoke (MonoMethod *method, void *obj, void **params)
+{
+ MonoInvocation frame;
+ MonoObject *retval = NULL;
+ MonoMethodSignature *sig = method->signature;
+ MonoClass *klass = mono_class_from_mono_type (sig->ret);
+ int i, type, isobject = 0;
+ void *ret;
+ stackval result;
+ stackval *args = alloca (sizeof (stackval) * sig->param_count);
+
+ /* FIXME: Set frame for execption handling. */
+
+ switch (sig->ret->type) {
+ case MONO_TYPE_VOID:
+ break;
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY:
+ isobject = 1;
+ break;
+ case MONO_TYPE_VALUETYPE:
+ retval = mono_object_new (mono_domain_get (), klass);
+ ret = ((char*)retval) + sizeof (MonoObject);
+ if (!sig->ret->data.klass->enumtype)
+ result.data.vt.vt = ret;
+ break;
+ default:
+ retval = mono_object_new (mono_domain_get (), klass);
+ ret = ((char*)retval) + sizeof (MonoObject);
+ break;
+ }
+
+ for (i = 0; i < sig->param_count; ++i) {
+ if (sig->params [i]->byref) {
+ args [i].type = VAL_POINTER;
+ args [i].data.p = params [i];
+ continue;
+ }
+ type = sig->params [i]->type;
+handle_enum:
+ switch (type) {
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_BOOLEAN:
+ args [i].type = VAL_I32;
+ args [i].data.i = *(MonoBoolean*)params [i];
+ args [i].data.vt.klass = NULL;
+ break;
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_CHAR:
+ args [i].type = VAL_I32;
+ args [i].data.i = *(gint16*)params [i];
+ args [i].data.vt.klass = NULL;
+ break;
+#if SIZEOF_VOID_P == 4
+ case MONO_TYPE_U: /* use VAL_POINTER? */
+ case MONO_TYPE_I:
+#endif
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ args [i].type = VAL_I32;
+ args [i].data.i = *(gint32*)params [i];
+ args [i].data.vt.klass = NULL;
+ break;
+#if SIZEOF_VOID_P == 8
+ case MONO_TYPE_U:
+ case MONO_TYPE_I:
+#endif
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8:
+ args [i].type = VAL_I64;
+ args [i].data.l = *(gint64*)params [i];
+ args [i].data.vt.klass = NULL;
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->params [i]->data.klass->enumtype) {
+ type = sig->params [i]->data.klass->enum_basetype->type;
+ goto handle_enum;
+ } else {
+ g_warning ("generic valutype %s not handled in runtime invoke", sig->params [i]->data.klass->name);
+ }
+ break;
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_OBJECT:
+ args [i].type = VAL_OBJ;
+ args [i].data.p = params [i];
+ args [i].data.vt.klass = NULL;
+ break;
+ default:
+ g_error ("type 0x%x not handled in runtime invoke", sig->params [i]->type);
+ }
+ }
+
+ INIT_FRAME(&frame,NULL,obj,args,&result,method);
+ ves_exec_method (&frame);
+ if (sig->ret->type == MONO_TYPE_VOID)
+ return NULL;
+ if (isobject)
+ return result.data.p;
+ stackval_to_data (sig->ret, &result, ret);
+ return retval;
+}
+
+/*
+ * Need to optimize ALU ops when natural int == int32
+ *
+ * IDEA: if we maintain a stack of ip, sp to be checked
+ * in the return opcode, we could inline simple methods that don't
+ * use the stack or local variables....
+ *
+ * The {,.S} versions of many opcodes can/should be merged to reduce code
+ * duplication.
+ *
+ */
+void
+ves_exec_method (MonoInvocation *frame)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoInvocation child_frame;
+ MonoMethodHeader *header;
+ MonoMethodSignature *signature;
+ MonoImage *image;
+ const unsigned char *endfinally_ip;
+ register const unsigned char *ip;
+ register stackval *sp;
+ void **args_pointers;
+ guint32 *offsets;
+ gint il_ins_count = -1;
+ gint tracing = global_tracing;
+ unsigned char tail_recursion = 0;
+ unsigned char unaligned_address = 0;
+ unsigned char volatile_address = 0;
+ vtallocation *vtalloc = NULL;
+ GOTO_LABEL_VARS;
+
+ signature = frame->method->signature;
+
+ DEBUG_ENTER ();
+
+ if (frame->method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) {
+ if (!frame->method->addr) {
+ frame->ex = (MonoException*)mono_get_exception_missing_method ();
+ DEBUG_LEAVE ();
+ return;
+ }
+ if (frame->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+ ves_pinvoke_method (frame);
+ } else {
+ ICallMethod icall = (ICallMethod)frame->method->addr;
+ icall (frame);
+ }
+ if (frame->ex)
+ goto handle_exception;
+ DEBUG_LEAVE ();
+ return;
+ }
+
+ if (frame->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+ if (!frame->method->addr) {
+ frame->ex = (MonoException*)mono_get_exception_missing_method ();
+ DEBUG_LEAVE ();
+ return;
+ }
+ ves_pinvoke_method (frame);
+ if (frame->ex)
+ goto handle_exception;
+ DEBUG_LEAVE ();
+ return;
+ }
+
+ if (frame->method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) {
+ ves_runtime_method (frame);
+ if (frame->ex)
+ goto handle_exception;
+ DEBUG_LEAVE ();
+ return;
+ }
+
+ /*verify_method (frame->method);*/
+
+ header = ((MonoMethodNormal *)frame->method)->header;
+ image = frame->method->klass->image;
+
+ if (!frame->method->info)
+ calc_offsets (image, frame->method);
+ offsets = frame->method->info;
+
+ /*
+ * with alloca we get the expected huge performance gain
+ * stackval *stack = g_new0(stackval, header->max_stack);
+ */
+ g_assert (header->max_stack < 10000);
+ sp = frame->stack = alloca (sizeof (stackval) * header->max_stack);
+
+ if (header->num_locals) {
+ g_assert (offsets [0] < 10000);
+ frame->locals = alloca (offsets [0]);
+ /*
+ * yes, we do it unconditionally, because it needs to be done for
+ * some cases anyway and checking for that would be even slower.
+ */
+ memset (frame->locals, 0, offsets [0]);
+ }
+ /*
+ * Copy args from stack_args to args.
+ */
+ if (signature->param_count || signature->hasthis) {
+ int i;
+ int has_this = signature->hasthis;
+
+ g_assert (offsets [1] < 10000);
+ frame->args = alloca (offsets [1]);
+ g_assert ((signature->param_count + has_this) < 1000);
+ args_pointers = alloca (sizeof(void*) * (signature->param_count + has_this));
+ if (has_this) {
+ gpointer *this_arg;
+ this_arg = args_pointers [0] = frame->args;
+ *this_arg = frame->obj;
+ }
+ for (i = 0; i < signature->param_count; ++i) {
+ args_pointers [i + has_this] = frame->args + offsets [2 + header->num_locals + has_this + i];
+ stackval_to_data (signature->params [i], frame->stack_args + i, args_pointers [i + has_this]);
+ }
+ }
+
+ child_frame.parent = frame;
+ frame->child = &child_frame;
+ frame->ex = NULL;
+
+ /* ready to go */
+ ip = header->code;
+
+ /*
+ * using while (ip < end) may result in a 15% performance drop,
+ * but it may be useful for debug
+ */
+ while (1) {
+ main_loop:
+ /*g_assert (sp >= stack);*/
+#if DEBUG_INTERP
+ opcode_count++;
+ if (tracing > 1) {
+ char *ins;
+ if (sp > frame->stack) {
+ output_indent ();
+ ins = dump_stack (frame->stack, sp);
+ g_print ("(%d) stack: %s\n", GetCurrentThreadId(), ins);
+ g_free (ins);
+ }
+ output_indent ();
+ ins = mono_disasm_code_one (NULL, frame->method, ip);
+ g_print ("(%d) %s", GetCurrentThreadId(), ins);
+ g_free (ins);
+ }
+ if (il_ins_count > 0)
+ if (!(--il_ins_count))
+ G_BREAKPOINT ();
+#endif
+
+ SWITCH (*ip) {
+ CASE (CEE_NOP)
+ ++ip;
+ BREAK;
+ CASE (CEE_BREAK)
+ ++ip;
+ G_BREAKPOINT (); /* this is not portable... */
+ BREAK;
+ CASE (CEE_LDARG_0)
+ CASE (CEE_LDARG_1)
+ CASE (CEE_LDARG_2)
+ CASE (CEE_LDARG_3) {
+ int n = (*ip)-CEE_LDARG_0;
+ ++ip;
+ vt_alloc (ARG_TYPE (signature, n), sp);
+ stackval_from_data (ARG_TYPE (signature, n), sp, ARG_POS (n));
+ ++sp;
+ BREAK;
+ }
+ CASE (CEE_LDLOC_0)
+ CASE (CEE_LDLOC_1)
+ CASE (CEE_LDLOC_2)
+ CASE (CEE_LDLOC_3) {
+ int n = (*ip)-CEE_LDLOC_0;
+ ++ip;
+ if ((LOCAL_TYPE (header, n))->type == MONO_TYPE_I4) {
+ sp->type = VAL_I32;
+ sp->data.i = *(gint32*) LOCAL_POS (n);
+ ++sp;
+ BREAK;
+ } else {
+ vt_alloc (LOCAL_TYPE (header, n), sp);
+ stackval_from_data (LOCAL_TYPE (header, n), sp, LOCAL_POS (n));
+ }
+ ++sp;
+ BREAK;
+ }
+ CASE (CEE_STLOC_0)
+ CASE (CEE_STLOC_1)
+ CASE (CEE_STLOC_2)
+ CASE (CEE_STLOC_3) {
+ int n = (*ip)-CEE_STLOC_0;
+ ++ip;
+ --sp;
+ if ((LOCAL_TYPE (header, n))->type == MONO_TYPE_I4) {
+ gint32 *p = (gint32*)LOCAL_POS (n);
+ *p = sp->data.i;
+ BREAK;
+ } else {
+ stackval_to_data (LOCAL_TYPE (header, n), sp, LOCAL_POS (n));
+ vt_free (sp);
+ BREAK;
+ }
+ }
+ CASE (CEE_LDARG_S)
+ ++ip;
+ vt_alloc (ARG_TYPE (signature, *ip), sp);
+ stackval_from_data (ARG_TYPE (signature, *ip), sp, ARG_POS (*ip));
+ ++sp;
+ ++ip;
+ BREAK;
+ CASE (CEE_LDARGA_S) {
+ MonoType *t;
+ MonoClass *c;
+
+ ++ip;
+ t = ARG_TYPE (signature, *ip);
+ c = mono_class_from_mono_type (t);
+ sp->data.vt.klass = c;
+ sp->data.vt.vt = ARG_POS (*ip);
+
+ if (c->valuetype)
+ sp->type = VAL_VALUETA;
+ else
+ sp->type = VAL_TP;
+
+ ++sp;
+ ++ip;
+ BREAK;
+ }
+ CASE (CEE_STARG_S)
+ ++ip;
+ --sp;
+ stackval_to_data (ARG_TYPE (signature, *ip), sp, ARG_POS (*ip));
+ vt_free (sp);
+ ++ip;
+ BREAK;
+ CASE (CEE_LDLOC_S)
+ ++ip;
+ vt_alloc (LOCAL_TYPE (header, *ip), sp);
+ stackval_from_data (LOCAL_TYPE (header, *ip), sp, LOCAL_POS (*ip));
+ ++ip;
+ ++sp;
+ BREAK;
+ CASE (CEE_LDLOCA_S) {
+ MonoType *t;
+ MonoClass *c;
+
+ ++ip;
+ t = LOCAL_TYPE (header, *ip);
+ c = mono_class_from_mono_type (t);
+ sp->data.vt.klass = c;
+ sp->data.p = LOCAL_POS (*ip);
+
+ if (c->valuetype)
+ sp->type = VAL_VALUETA;
+ else
+ sp->type = VAL_TP;
+
+ ++sp;
+ ++ip;
+ BREAK;
+ }
+ CASE (CEE_STLOC_S)
+ ++ip;
+ --sp;
+ stackval_to_data (LOCAL_TYPE (header, *ip), sp, LOCAL_POS (*ip));
+ vt_free (sp);
+ ++ip;
+ BREAK;
+ CASE (CEE_LDNULL)
+ ++ip;
+ sp->type = VAL_OBJ;
+ sp->data.p = NULL;
+ sp->data.vt.klass = NULL;
+ ++sp;
+ BREAK;
+ CASE (CEE_LDC_I4_M1)
+ ++ip;
+ sp->type = VAL_I32;
+ sp->data.i = -1;
+ ++sp;
+ BREAK;
+ CASE (CEE_LDC_I4_0)
+ CASE (CEE_LDC_I4_1)
+ CASE (CEE_LDC_I4_2)
+ CASE (CEE_LDC_I4_3)
+ CASE (CEE_LDC_I4_4)
+ CASE (CEE_LDC_I4_5)
+ CASE (CEE_LDC_I4_6)
+ CASE (CEE_LDC_I4_7)
+ CASE (CEE_LDC_I4_8)
+ sp->type = VAL_I32;
+ sp->data.i = (*ip) - CEE_LDC_I4_0;
+ ++sp;
+ ++ip;
+ BREAK;
+ CASE (CEE_LDC_I4_S)
+ ++ip;
+ sp->type = VAL_I32;
+ sp->data.i = *(const gint8 *)ip;
+ ++ip;
+ ++sp;
+ BREAK;
+ CASE (CEE_LDC_I4)
+ ++ip;
+ sp->type = VAL_I32;
+ sp->data.i = read32 (ip);
+ ip += 4;
+ ++sp;
+ BREAK;
+ CASE (CEE_LDC_I8)
+ ++ip;
+ sp->type = VAL_I64;
+ sp->data.l = read64 (ip);
+ ip += 8;
+ ++sp;
+ BREAK;
+ CASE (CEE_LDC_R4) {
+ float val;
+ ++ip;
+ sp->type = VAL_DOUBLE;
+ readr4 (ip, &val);
+ sp->data.f = val;
+ ip += 4;
+ ++sp;
+ BREAK;
+ }
+ CASE (CEE_LDC_R8)
+ ++ip;
+ sp->type = VAL_DOUBLE;
+ readr8(ip, &sp->data.f);
+ ip += 8;
+ ++sp;
+ BREAK;
+ CASE (CEE_UNUSED99) ves_abort (); BREAK;
+ CASE (CEE_DUP)
+ if (sp [-1].type == VAL_VALUET) {
+ MonoClass *c = sp [-1].data.vt.klass;
+ vt_alloc (&c->byval_arg, sp);
+ stackval_from_data (&c->byval_arg, sp, sp [-1].data.vt.vt);
+ } else {
+ *sp = sp [-1];
+ }
+ ++sp;
+ ++ip;
+ BREAK;
+ CASE (CEE_POP)
+ ++ip;
+ --sp;
+ vt_free (sp);
+ BREAK;
+ CASE (CEE_JMP) ves_abort(); BREAK;
+ CASE (CEE_CALLVIRT) /* Fall through */
+ CASE (CEE_CALLI) /* Fall through */
+ CASE (CEE_CALL) {
+ MonoMethodSignature *csignature;
+ stackval retval;
+ stackval *endsp = sp;
+ guint32 token;
+ int virtual = *ip == CEE_CALLVIRT;
+ int calli = *ip == CEE_CALLI;
+
+ /*
+ * We ignore tail recursion for now.
+ */
+ tail_recursion = 0;
+
+ frame->ip = ip;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ if (calli) {
+ unsigned char *code;
+ --sp;
+ code = sp->data.p;
+ child_frame.method = mono_method_pointer_get (code);
+ /* check for NULL with native code */
+ csignature = child_frame.method->signature;
+ } else {
+ child_frame.method = mono_get_method (image, token, NULL);
+ if (!child_frame.method)
+ THROW_EX (mono_get_exception_missing_method (), ip -5);
+ csignature = child_frame.method->signature;
+ if (virtual) {
+ stackval *this_arg = &sp [-csignature->param_count-1];
+ if (!this_arg->data.p)
+ THROW_EX (mono_get_exception_null_reference(), ip - 5);
+ child_frame.method = get_virtual_method (domain, child_frame.method, this_arg);
+ if (!child_frame.method)
+ THROW_EX (mono_get_exception_missing_method (), ip -5);
+ }
+ }
+ g_assert (csignature->call_convention == MONO_CALL_DEFAULT);
+ /* decrement by the actual number of args */
+ if (csignature->param_count) {
+ sp -= csignature->param_count;
+ child_frame.stack_args = sp;
+ } else {
+ child_frame.stack_args = NULL;
+ }
+ if (csignature->hasthis) {
+ g_assert (sp >= frame->stack);
+ --sp;
+ /*
+ * It may also be a TP from LD(S)FLDA
+ * g_assert (sp->type == VAL_OBJ || sp->type == VAL_VALUETA);
+ */
+ if (sp->type == VAL_OBJ && child_frame.method->klass->valuetype) /* unbox it */
+ child_frame.obj = (char*)sp->data.p + sizeof (MonoObject);
+ else
+ child_frame.obj = sp->data.p;
+ } else {
+ child_frame.obj = NULL;
+ }
+ if (csignature->ret->type != MONO_TYPE_VOID) {
+ vt_alloc (csignature->ret, &retval);
+ child_frame.retval = &retval;
+ } else {
+ child_frame.retval = NULL;
+ }
+
+ child_frame.ex = NULL;
+ child_frame.ex_handler = NULL;
+
+ if (csignature->hasthis && sp->type == VAL_OBJ &&
+ ((MonoObject *)sp->data.p)->vtable->klass ==
+ mono_defaults.transparent_proxy_class) {
+ /* implement remoting */
+ g_assert_not_reached ();
+ } else {
+ switch (GPOINTER_TO_UINT (child_frame.method->addr)) {
+ case INLINE_STRING_LENGTH:
+ retval.type = VAL_I32;
+ retval.data.i = ((MonoString*)sp->data.p)->length;
+ //g_print ("length of '%s' is %d\n", mono_string_to_utf8 (sp->data.p), retval.data.i);
+ break;
+ case INLINE_ARRAY_LENGTH:
+ retval.type = VAL_I32;
+ retval.data.i = mono_array_length ((MonoArray*)sp->data.p);
+ break;
+ case INLINE_ARRAY_RANK:
+ retval.type = VAL_I32;
+ retval.data.i = mono_object_class (sp->data.p)->rank;
+ break;
+ case INLINE_TYPE_ELEMENT_TYPE:
+ retval.type = VAL_OBJ;
+ {
+ MonoClass *c = mono_class_from_mono_type (((MonoReflectionType*)sp->data.p)->type);
+ retval.data.vt.klass = NULL;
+ if (c->enumtype && c->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
+ retval.data.p = mono_type_get_object (domain, c->enum_basetype);
+ else if (c->element_class)
+ retval.data.p = mono_type_get_object (domain, &c->element_class->byval_arg);
+ else
+ retval.data.p = NULL;
+ }
+ break;
+ default:
+ ves_exec_method (&child_frame);
+ }
+ }
+
+ while (endsp > sp) {
+ --endsp;
+ vt_free (endsp);
+ }
+
+ if (child_frame.ex) {
+ /*
+ * An exception occurred, need to run finally, fault and catch handlers..
+ */
+ frame->ex = child_frame.ex;
+ goto handle_finally;
+ }
+
+ /* need to handle typedbyref ... */
+ if (csignature->ret->type != MONO_TYPE_VOID) {
+ *sp = retval;
+ sp++;
+ }
+ BREAK;
+ }
+ CASE (CEE_RET)
+ if (signature->ret->type != MONO_TYPE_VOID) {
+ --sp;
+ if (sp->type == VAL_VALUET) {
+ /* the caller has already allocated the memory */
+ stackval_from_data (signature->ret, frame->retval, sp->data.vt.vt);
+ vt_free (sp);
+ } else {
+ *frame->retval = *sp;
+ }
+ }
+ if (sp > frame->stack)
+ g_warning ("more values on stack: %d", sp-frame->stack);
+
+ DEBUG_LEAVE ();
+ return;
+ CASE (CEE_BR_S) /* Fall through */
+ CASE (CEE_BR)
+ if (*ip == CEE_BR) {
+ ++ip;
+ ip += (gint32) read32(ip);
+ ip += 4;
+ } else {
+ ++ip;
+ ip += (signed char) *ip;
+ ++ip;
+ }
+ BREAK;
+ CASE (CEE_BRFALSE) /* Fall through */
+ CASE (CEE_BRFALSE_S) {
+ int result;
+ int near_jump = *ip == CEE_BRFALSE_S;
+ ++ip;
+ --sp;
+ switch (sp->type) {
+ case VAL_I32: result = sp->data.i == 0; break;
+ case VAL_I64: result = sp->data.l == 0; break;
+ case VAL_DOUBLE: result = sp->data.f ? 0: 1; break;
+ default: result = sp->data.p == NULL; break;
+ }
+ if (result) {
+ if (near_jump)
+ ip += (signed char)*ip;
+ else
+ ip += (gint32) read32 (ip);
+ }
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ CASE (CEE_BRTRUE) /* Fall through */
+ CASE (CEE_BRTRUE_S) {
+ int result;
+ int near_jump = *ip == CEE_BRTRUE_S;
+ ++ip;
+ --sp;
+ switch (sp->type) {
+ case VAL_I32: result = sp->data.i != 0; break;
+ case VAL_I64: result = sp->data.l != 0; break;
+ case VAL_DOUBLE: result = sp->data.f ? 1 : 0; break;
+ default: result = sp->data.p != NULL; break;
+ }
+ if (result) {
+ if (near_jump)
+ ip += (signed char)*ip;
+ else
+ ip += (gint32) read32 (ip);
+ }
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ CASE (CEE_BEQ) /* Fall through */
+ CASE (CEE_BEQ_S) {
+ int result;
+ int near_jump = *ip == CEE_BEQ_S;
+ ++ip;
+ sp -= 2;
+ if (sp->type == VAL_I32)
+ result = sp [0].data.i == (gint)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = sp [0].data.l == sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = sp [0].data.f == sp [1].data.f;
+ else
+ result = (gint)GET_NATI (sp [0]) == (gint)GET_NATI (sp [1]);
+ if (result) {
+ if (near_jump)
+ ip += (signed char)*ip;
+ else
+ ip += (gint32) read32 (ip);
+ }
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ CASE (CEE_BGE) /* Fall through */
+ CASE (CEE_BGE_S) {
+ int result;
+ int near_jump = *ip == CEE_BGE_S;
+ ++ip;
+ sp -= 2;
+ if (sp->type == VAL_I32)
+ result = sp [0].data.i >= (gint)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = sp [0].data.l >= sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = sp [0].data.f >= sp [1].data.f;
+ else
+ result = (gint)GET_NATI (sp [0]) >= (gint)GET_NATI (sp [1]);
+ if (result) {
+ if (near_jump)
+ ip += (signed char)*ip;
+ else
+ ip += (gint32) read32 (ip);
+ }
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ CASE (CEE_BGT) /* Fall through */
+ CASE (CEE_BGT_S) {
+ int result;
+ int near_jump = *ip == CEE_BGT_S;
+ ++ip;
+ sp -= 2;
+ if (sp->type == VAL_I32)
+ result = sp [0].data.i > (gint)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = sp [0].data.l > sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = sp [0].data.f > sp [1].data.f;
+ else
+ result = (gint)GET_NATI (sp [0]) > (gint)GET_NATI (sp [1]);
+ if (result) {
+ if (near_jump)
+ ip += (signed char)*ip;
+ else
+ ip += (gint32) read32 (ip);
+ }
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ CASE (CEE_BLT) /* Fall through */
+ CASE (CEE_BLT_S) {
+ int result;
+ int near_jump = *ip == CEE_BLT_S;
+ ++ip;
+ sp -= 2;
+ if (sp->type == VAL_I32)
+ result = sp[0].data.i < (gint)GET_NATI(sp[1]);
+ else if (sp->type == VAL_I64)
+ result = sp[0].data.l < sp[1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = sp[0].data.f < sp[1].data.f;
+ else
+ result = (gint)GET_NATI(sp[0]) < (gint)GET_NATI(sp[1]);
+ if (result) {
+ if (near_jump)
+ ip += 1 + (signed char)*ip;
+ else
+ ip += 4 + (gint32) read32 (ip);
+ BREAK;
+ } else {
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ }
+ CASE (CEE_BLE) /* fall through */
+ CASE (CEE_BLE_S) {
+ int result;
+ int near_jump = *ip == CEE_BLE_S;
+ ++ip;
+ sp -= 2;
+
+ if (sp->type == VAL_I32)
+ result = sp [0].data.i <= (gint)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = sp [0].data.l <= sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = sp [0].data.f <= sp [1].data.f;
+ else {
+ /*
+ * FIXME: here and in other places GET_NATI on the left side
+ * _will_ be wrong when we change the macro to work on 64 bits
+ * systems.
+ */
+ result = (gint)GET_NATI (sp [0]) <= (gint)GET_NATI (sp [1]);
+ }
+ if (result) {
+ if (near_jump)
+ ip += (signed char)*ip;
+ else
+ ip += (gint32) read32 (ip);
+ }
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ CASE (CEE_BNE_UN) /* Fall through */
+ CASE (CEE_BNE_UN_S) {
+ int result;
+ int near_jump = *ip == CEE_BNE_UN_S;
+ ++ip;
+ sp -= 2;
+ if (sp->type == VAL_I32)
+ result = (guint32)sp [0].data.i != (guint32)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = (guint64)sp [0].data.l != (guint64)sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = isunordered (sp [0].data.f, sp [1].data.f) ||
+ (sp [0].data.f != sp [1].data.f);
+ else
+ result = GET_NATI (sp [0]) != GET_NATI (sp [1]);
+ if (result) {
+ if (near_jump)
+ ip += (signed char)*ip;
+ else
+ ip += (gint32) read32 (ip);
+ }
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ CASE (CEE_BGE_UN) /* Fall through */
+ CASE (CEE_BGE_UN_S) {
+ int result;
+ int near_jump = *ip == CEE_BGE_UN_S;
+ ++ip;
+ sp -= 2;
+ if (sp->type == VAL_I32)
+ result = (guint32)sp [0].data.i >= (guint32)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = (guint64)sp [0].data.l >= (guint64)sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = !isless (sp [0].data.f,sp [1].data.f);
+ else
+ result = GET_NATI (sp [0]) >= GET_NATI (sp [1]);
+ if (result) {
+ if (near_jump)
+ ip += (signed char)*ip;
+ else
+ ip += (gint32) read32 (ip);
+ }
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ CASE (CEE_BGT_UN) /* Fall through */
+ CASE (CEE_BGT_UN_S) {
+ int result;
+ int near_jump = *ip == CEE_BGT_UN_S;
+ ++ip;
+ sp -= 2;
+ if (sp->type == VAL_I32)
+ result = (guint32)sp [0].data.i > (guint32)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = (guint64)sp [0].data.l > (guint64)sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = isgreater (sp [0].data.f, sp [1].data.f);
+ else
+ result = GET_NATI (sp [0]) > GET_NATI (sp [1]);
+ if (result) {
+ if (near_jump)
+ ip += (signed char)*ip;
+ else
+ ip += (gint32) read32 (ip);
+ }
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ CASE (CEE_BLE_UN) /* Fall through */
+ CASE (CEE_BLE_UN_S) {
+ int result;
+ int near_jump = *ip == CEE_BLE_UN_S;
+ ++ip;
+ sp -= 2;
+ if (sp->type == VAL_I32)
+ result = (guint32)sp [0].data.i <= (guint32)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = (guint64)sp [0].data.l <= (guint64)sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = islessequal (sp [0].data.f, sp [1].data.f);
+ else
+ result = GET_NATI (sp [0]) <= GET_NATI (sp [1]);
+ if (result) {
+ if (near_jump)
+ ip += (signed char)*ip;
+ else
+ ip += (gint32) read32 (ip);
+ }
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ CASE (CEE_BLT_UN) /* Fall through */
+ CASE (CEE_BLT_UN_S) {
+ int result;
+ int near_jump = *ip == CEE_BLT_UN_S;
+ ++ip;
+ sp -= 2;
+ if (sp->type == VAL_I32)
+ result = (guint32)sp[0].data.i < (guint32)GET_NATI(sp[1]);
+ else if (sp->type == VAL_I64)
+ result = (guint64)sp[0].data.l < (guint64)sp[1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = isunordered (sp [0].data.f, sp [1].data.f) ||
+ (sp [0].data.f < sp [1].data.f);
+ else
+ result = GET_NATI(sp[0]) < GET_NATI(sp[1]);
+ if (result) {
+ if (near_jump)
+ ip += (signed char)*ip;
+ else
+ ip += (gint32) read32 (ip);
+ }
+ ip += near_jump ? 1: 4;
+ BREAK;
+ }
+ CASE (CEE_SWITCH) {
+ guint32 n;
+ const unsigned char *st;
+ ++ip;
+ n = read32 (ip);
+ ip += 4;
+ st = ip + sizeof (gint32) * n;
+ --sp;
+ if ((guint32)sp->data.i < n) {
+ gint offset;
+ ip += sizeof (gint32) * (guint32)sp->data.i;
+ offset = read32 (ip);
+ ip = st + offset;
+ } else {
+ ip = st;
+ }
+ BREAK;
+ }
+ CASE (CEE_LDIND_I1)
+ ++ip;
+ sp[-1].type = VAL_I32;
+ sp[-1].data.i = *(gint8*)sp[-1].data.p;
+ BREAK;
+ CASE (CEE_LDIND_U1)
+ ++ip;
+ sp[-1].type = VAL_I32;
+ sp[-1].data.i = *(guint8*)sp[-1].data.p;
+ BREAK;
+ CASE (CEE_LDIND_I2)
+ ++ip;
+ sp[-1].type = VAL_I32;
+ sp[-1].data.i = *(gint16*)sp[-1].data.p;
+ BREAK;
+ CASE (CEE_LDIND_U2)
+ ++ip;
+ sp[-1].type = VAL_I32;
+ sp[-1].data.i = *(guint16*)sp[-1].data.p;
+ BREAK;
+ CASE (CEE_LDIND_I4) /* Fall through */
+ CASE (CEE_LDIND_U4)
+ ++ip;
+ sp[-1].type = VAL_I32;
+ sp[-1].data.i = *(gint32*)sp[-1].data.p;
+ BREAK;
+ CASE (CEE_LDIND_I8)
+ ++ip;
+ sp[-1].type = VAL_I64;
+ sp[-1].data.l = *(gint64*)sp[-1].data.p;
+ BREAK;
+ CASE (CEE_LDIND_I)
+ ++ip;
+ sp[-1].type = VAL_NATI;
+ sp[-1].data.p = *(gpointer*)sp[-1].data.p;
+ BREAK;
+ CASE (CEE_LDIND_R4)
+ ++ip;
+ sp[-1].type = VAL_DOUBLE;
+ sp[-1].data.f = *(gfloat*)sp[-1].data.p;
+ BREAK;
+ CASE (CEE_LDIND_R8)
+ ++ip;
+ sp[-1].type = VAL_DOUBLE;
+ sp[-1].data.f = *(gdouble*)sp[-1].data.p;
+ BREAK;
+ CASE (CEE_LDIND_REF)
+ ++ip;
+ sp[-1].type = VAL_OBJ;
+ sp[-1].data.p = *(gpointer*)sp[-1].data.p;
+ sp[-1].data.vt.klass = NULL;
+ BREAK;
+ CASE (CEE_STIND_REF) {
+ gpointer *p;
+ ++ip;
+ sp -= 2;
+ p = sp->data.p;
+ *p = sp[1].data.p;
+ BREAK;
+ }
+ CASE (CEE_STIND_I1) {
+ gint8 *p;
+ ++ip;
+ sp -= 2;
+ p = sp->data.p;
+ *p = (gint8)sp[1].data.i;
+ BREAK;
+ }
+ CASE (CEE_STIND_I2) {
+ gint16 *p;
+ ++ip;
+ sp -= 2;
+ p = sp->data.p;
+ *p = (gint16)sp[1].data.i;
+ BREAK;
+ }
+ CASE (CEE_STIND_I4) {
+ gint32 *p;
+ ++ip;
+ sp -= 2;
+ p = sp->data.p;
+ *p = sp[1].data.i;
+ BREAK;
+ }
+ CASE (CEE_STIND_I) {
+ mono_i *p;
+ ++ip;
+ sp -= 2;
+ p = sp->data.p;
+ *p = (mono_i)sp[1].data.p;
+ BREAK;
+ }
+ CASE (CEE_STIND_I8) {
+ gint64 *p;
+ ++ip;
+ sp -= 2;
+ p = sp->data.p;
+ *p = sp[1].data.l;
+ BREAK;
+ }
+ CASE (CEE_STIND_R4) {
+ float *p;
+ ++ip;
+ sp -= 2;
+ p = sp->data.p;
+ *p = (gfloat)sp[1].data.f;
+ BREAK;
+ }
+ CASE (CEE_STIND_R8) {
+ double *p;
+ ++ip;
+ sp -= 2;
+ p = sp->data.p;
+ *p = sp[1].data.f;
+ BREAK;
+ }
+ CASE (CEE_ADD)
+ ++ip;
+ --sp;
+ /* should probably consider the pointers as unsigned */
+ if (sp->type == VAL_I32)
+ sp [-1].data.i += GET_NATI (sp [0]);
+ else if (sp->type == VAL_I64)
+ sp [-1].data.l += sp [0].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ sp [-1].data.f += sp [0].data.f;
+ else {
+ char *p = sp [-1].data.p;
+ p += GET_NATI (sp [0]);
+ sp [-1].data.p = p;
+ }
+ BREAK;
+ CASE (CEE_SUB)
+ ++ip;
+ --sp;
+ /* should probably consider the pointers as unsigned */
+ if (sp->type == VAL_I32)
+ sp [-1].data.i -= GET_NATI (sp [0]);
+ else if (sp->type == VAL_I64)
+ sp [-1].data.l -= sp [0].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ sp [-1].data.f -= sp [0].data.f;
+ else {
+ char *p = sp [-1].data.p;
+ p -= GET_NATI (sp [0]);
+ sp [-1].data.p = p;
+ }
+ BREAK;
+ CASE (CEE_MUL)
+ ++ip;
+ --sp;
+ if (sp->type == VAL_I32)
+ sp [-1].data.i *= (gint)GET_NATI (sp [0]);
+ else if (sp->type == VAL_I64)
+ sp [-1].data.l *= sp [0].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ sp [-1].data.f *= sp [0].data.f;
+ BREAK;
+ CASE (CEE_DIV)
+ ++ip;
+ --sp;
+ if (sp->type == VAL_I32) {
+ if (GET_NATI (sp [0]) == 0)
+ THROW_EX (mono_get_exception_divide_by_zero (), ip - 1);
+ sp [-1].data.i /= (gint)GET_NATI (sp [0]);
+ } else if (sp->type == VAL_I64) {
+ if (sp [0].data.l == 0)
+ THROW_EX (mono_get_exception_divide_by_zero (), ip - 1);
+ sp [-1].data.l /= sp [0].data.l;
+ } else if (sp->type == VAL_DOUBLE) {
+ /* set NaN is divisor is 0.0 */
+ sp [-1].data.f /= sp [0].data.f;
+ }
+ BREAK;
+ CASE (CEE_DIV_UN)
+ ++ip;
+ --sp;
+ if (sp->type == VAL_I32) {
+ guint32 val;
+ if (GET_NATI (sp [0]) == 0)
+ THROW_EX (mono_get_exception_divide_by_zero (), ip - 1);
+ val = sp [-1].data.i;
+ val /= (guint32)GET_NATI (sp [0]);
+ sp [-1].data.i = val;
+ } else if (sp->type == VAL_I64) {
+ guint64 val;
+ if (sp [0].data.l == 0)
+ THROW_EX (mono_get_exception_divide_by_zero (), ip - 1);
+ val = sp [-1].data.l;
+ val /= (guint64)sp [0].data.l;
+ sp [-1].data.l = val;
+ } else if (sp->type == VAL_NATI) {
+ mono_u val;
+ if (GET_NATI (sp [0]) == 0)
+ THROW_EX (mono_get_exception_divide_by_zero (), ip - 1);
+ val = (mono_u)sp [-1].data.p;
+ val /= (mono_u)sp [0].data.p;
+ sp [-1].data.p = (gpointer)val;
+ }
+ BREAK;
+ CASE (CEE_REM)
+ ++ip;
+ --sp;
+ if (sp->type == VAL_I32) {
+ if (GET_NATI (sp [0]) == 0)
+ THROW_EX (mono_get_exception_divide_by_zero (), ip - 1);
+ sp [-1].data.i %= (gint)GET_NATI (sp [0]);
+ } else if (sp->type == VAL_I64) {
+ if (sp [0].data.l == 0)
+ THROW_EX (mono_get_exception_divide_by_zero (), ip - 1);
+ sp [-1].data.l %= sp [0].data.l;
+ } else if (sp->type == VAL_DOUBLE) {
+ /* FIXME: what do we actually do here? */
+ sp [-1].data.f = fmod (sp [-1].data.f, sp [0].data.f);
+ } else {
+ if (GET_NATI (sp [0]) == 0)
+ THROW_EX (mono_get_exception_divide_by_zero (), ip - 1);
+ (gint)GET_NATI (sp [-1]) %= (gint)GET_NATI (sp [0]);
+ }
+ BREAK;
+ CASE (CEE_REM_UN)
+ ++ip;
+ --sp;
+ if (sp->type == VAL_I32) {
+ if (GET_NATI (sp [0]) == 0)
+ THROW_EX (mono_get_exception_divide_by_zero (), ip - 1);
+ (guint)sp [-1].data.i %= (guint)GET_NATI (sp [0]);
+ } else if (sp->type == VAL_I64) {
+ if (sp [0].data.l == 0)
+ THROW_EX (mono_get_exception_divide_by_zero (), ip - 1);
+ (guint64)sp [-1].data.l %= (guint64)sp [0].data.l;
+ } else if (sp->type == VAL_DOUBLE) {
+ /* unspecified behaviour according to the spec */
+ } else {
+ if (GET_NATI (sp [0]) == 0)
+ THROW_EX (mono_get_exception_divide_by_zero (), ip - 1);
+ (guint64)GET_NATI (sp [-1]) %= (guint64)GET_NATI (sp [0]);
+ }
+ BREAK;
+ CASE (CEE_AND)
+ ++ip;
+ --sp;
+ if (sp->type == VAL_I32)
+ sp [-1].data.i &= GET_NATI (sp [0]);
+ else if (sp->type == VAL_I64)
+ sp [-1].data.l &= sp [0].data.l;
+ else
+ GET_NATI (sp [-1]) &= GET_NATI (sp [0]);
+ BREAK;
+ CASE (CEE_OR)
+ ++ip;
+ --sp;
+ if (sp->type == VAL_I32)
+ sp [-1].data.i |= GET_NATI (sp [0]);
+ else if (sp->type == VAL_I64)
+ sp [-1].data.l |= sp [0].data.l;
+ else
+ GET_NATI (sp [-1]) |= GET_NATI (sp [0]);
+ BREAK;
+ CASE (CEE_XOR)
+ ++ip;
+ --sp;
+ if (sp->type == VAL_I32)
+ sp [-1].data.i ^= GET_NATI (sp [0]);
+ else if (sp->type == VAL_I64)
+ sp [-1].data.l ^= sp [0].data.l;
+ else
+ GET_NATI (sp [-1]) ^= GET_NATI (sp [0]);
+ BREAK;
+ CASE (CEE_SHL)
+ ++ip;
+ --sp;
+ if (sp [-1].type == VAL_I32)
+ sp [-1].data.i <<= GET_NATI (sp [0]);
+ else if (sp [-1].type == VAL_I64)
+ sp [-1].data.l <<= GET_NATI (sp [0]);
+ else
+ GET_NATI (sp [-1]) <<= GET_NATI (sp [0]);
+ BREAK;
+ CASE (CEE_SHR)
+ ++ip;
+ --sp;
+ if (sp [-1].type == VAL_I32)
+ sp [-1].data.i >>= GET_NATI (sp [0]);
+ else if (sp [-1].type == VAL_I64)
+ sp [-1].data.l >>= GET_NATI (sp [0]);
+ else
+ (gint)GET_NATI (sp [-1]) >>= GET_NATI (sp [0]);
+ BREAK;
+ CASE (CEE_SHR_UN)
+ ++ip;
+ --sp;
+ if (sp [-1].type == VAL_I32)
+ (guint)sp [-1].data.i >>= GET_NATI (sp [0]);
+ else if (sp [-1].type == VAL_I64)
+ (guint64)sp [-1].data.l >>= GET_NATI (sp [0]);
+ else
+ (guint64)GET_NATI (sp [-1]) >>= GET_NATI (sp [0]);
+ BREAK;
+ CASE (CEE_NEG)
+ ++ip;
+ --sp;
+ if (sp->type == VAL_I32)
+ sp->data.i = - sp->data.i;
+ else if (sp->type == VAL_I64)
+ sp->data.l = - sp->data.l;
+ else if (sp->type == VAL_DOUBLE)
+ sp->data.f = - sp->data.f;
+ else if (sp->type == VAL_NATI)
+ sp->data.p = (gpointer)(- (mono_i)sp->data.p);
+ ++sp;
+ BREAK;
+ CASE (CEE_NOT)
+ ++ip;
+ --sp;
+ if (sp->type == VAL_I32)
+ sp->data.i = ~ sp->data.i;
+ else if (sp->type == VAL_I64)
+ sp->data.l = ~ sp->data.l;
+ else if (sp->type == VAL_NATI)
+ sp->data.p = (gpointer)(~ (mono_i)sp->data.p);
+ ++sp;
+ BREAK;
+ CASE (CEE_CONV_U1) /* fall through */
+ CASE (CEE_CONV_I1) {
+ ++ip;
+ switch (sp [-1].type) {
+ case VAL_DOUBLE:
+ sp [-1].data.i = (gint8)sp [-1].data.f;
+ break;
+ case VAL_I64:
+ sp [-1].data.i = (gint8)sp [-1].data.l;
+ break;
+ case VAL_VALUET:
+ ves_abort();
+ case VAL_I32:
+ sp [-1].data.i = (gint8)sp [-1].data.i;
+ break;
+ default:
+ sp [-1].data.i = (gint8)sp [-1].data.nati;
+ break;
+ }
+ sp [-1].type = VAL_I32;
+ BREAK;
+ }
+ CASE (CEE_CONV_U2) /* fall through */
+ CASE (CEE_CONV_I2) {
+ ++ip;
+ switch (sp [-1].type) {
+ case VAL_DOUBLE:
+ sp [-1].data.i = (gint16)sp [-1].data.f;
+ break;
+ case VAL_I64:
+ sp [-1].data.i = (gint16)sp [-1].data.l;
+ break;
+ case VAL_VALUET:
+ ves_abort();
+ case VAL_I32:
+ sp [-1].data.i = (gint16)sp [-1].data.i;
+ break;
+ default:
+ sp [-1].data.i = (gint16)sp [-1].data.nati;
+ break;
+ }
+ sp [-1].type = VAL_I32;
+ BREAK;
+ }
+ CASE (CEE_CONV_U4) /* Fall through */
+#if SIZEOF_VOID_P == 4
+ CASE (CEE_CONV_I) /* Fall through */
+ CASE (CEE_CONV_U) /* Fall through */
+#endif
+ CASE (CEE_CONV_I4) {
+ ++ip;
+ switch (sp [-1].type) {
+ case VAL_DOUBLE:
+ sp [-1].data.i = (gint32)sp [-1].data.f;
+ break;
+ case VAL_I64:
+ sp [-1].data.i = (gint32)sp [-1].data.l;
+ break;
+ case VAL_VALUET:
+ ves_abort();
+ case VAL_I32:
+ break;
+ default:
+ sp [-1].data.i = (gint32)sp [-1].data.p;
+ break;
+ }
+ sp [-1].type = VAL_I32;
+ BREAK;
+ }
+#if SIZEOF_VOID_P == 8
+ CASE (CEE_CONV_I) /* Fall through */
+#endif
+ CASE (CEE_CONV_I8)
+ ++ip;
+ switch (sp [-1].type) {
+ case VAL_DOUBLE:
+ sp [-1].data.l = (gint64)sp [-1].data.f;
+ break;
+ case VAL_I64:
+ break;
+ case VAL_VALUET:
+ ves_abort();
+ case VAL_I32:
+ sp [-1].data.l = (gint64)sp [-1].data.i;
+ break;
+ default:
+ sp [-1].data.l = (gint64)sp [-1].data.nati;
+ break;
+ }
+ sp [-1].type = VAL_I64;
+ BREAK;
+ CASE (CEE_CONV_R4) /* Fall through */
+ CASE (CEE_CONV_R8) {
+ ++ip;
+ switch (sp [-1].type) {
+ case VAL_DOUBLE:
+ sp [-1].data.f = (double)sp [-1].data.f;
+ break;
+ case VAL_I64:
+ sp [-1].data.f = (double)sp [-1].data.l;
+ break;
+ case VAL_VALUET:
+ ves_abort();
+ case VAL_I32:
+ sp [-1].data.f = (double)sp [-1].data.i;
+ break;
+ default:
+ sp [-1].data.f = (double)sp [-1].data.nati;
+ break;
+ }
+ sp [-1].type = VAL_DOUBLE;
+ BREAK;
+ }
+#if SIZEOF_VOID_P == 8
+ CASE (CEE_CONV_U) /* Fall through */
+#endif
+ CASE (CEE_CONV_U8)
+ ++ip;
+
+ switch (sp [-1].type){
+ case VAL_DOUBLE:
+ sp [-1].data.l = (guint64)sp [-1].data.f;
+ break;
+ case VAL_I64:
+ break;
+ case VAL_VALUET:
+ ves_abort();
+ case VAL_I32:
+ sp [-1].data.l = (guint64) sp [-1].data.i;
+ break;
+ default:
+ sp [-1].data.l = (guint64) sp [-1].data.nati;
+ break;
+ }
+ sp [-1].type = VAL_I64;
+ BREAK;
+ CASE (CEE_CPOBJ) {
+ MonoClass *vtklass;
+ ++ip;
+ vtklass = mono_class_get (image, read32 (ip));
+ ip += 4;
+ sp -= 2;
+ memcpy (sp [0].data.p, sp [1].data.p, mono_class_value_size (vtklass, NULL));
+ BREAK;
+ }
+ CASE (CEE_LDOBJ) {
+ guint32 token;
+ MonoClass *c;
+ char *addr;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ c = mono_class_get (image, token);
+ addr = sp [-1].data.vt.vt;
+ vt_alloc (&c->byval_arg, &sp [-1]);
+ stackval_from_data (&c->byval_arg, &sp [-1], addr);
+ BREAK;
+ }
+ CASE (CEE_LDSTR) {
+ MonoObject *o;
+ guint32 str_index;
+
+ ip++;
+ str_index = mono_metadata_token_index (read32 (ip));
+ ip += 4;
+
+ o = (MonoObject*)mono_ldstr (domain, image, str_index);
+ sp->type = VAL_OBJ;
+ sp->data.p = o;
+ sp->data.vt.klass = NULL;
+
+ ++sp;
+ BREAK;
+ }
+ CASE (CEE_NEWOBJ) {
+ MonoObject *o;
+ MonoClass *newobj_class;
+ MonoMethodSignature *csig;
+ stackval valuetype_this;
+ stackval *endsp = sp;
+ guint32 token;
+ stackval retval;
+
+ frame->ip = ip;
+
+ ip++;
+ token = read32 (ip);
+ ip += 4;
+
+ if (!(child_frame.method = mono_get_method (image, token, NULL)))
+ THROW_EX (mono_get_exception_missing_method (), ip -5);
+
+ csig = child_frame.method->signature;
+ newobj_class = child_frame.method->klass;
+ /*if (profiling_classes) {
+ guint count = GPOINTER_TO_UINT (g_hash_table_lookup (profiling_classes, newobj_class));
+ count++;
+ g_hash_table_insert (profiling_classes, newobj_class, GUINT_TO_POINTER (count));
+ }*/
+
+
+ if (newobj_class->parent == mono_defaults.array_class) {
+ sp -= csig->param_count;
+ o = ves_array_create (domain, newobj_class, csig, sp);
+ goto array_constructed;
+ }
+
+ /*
+ * First arg is the object.
+ */
+ if (newobj_class->valuetype) {
+ void *zero;
+ vt_alloc (&newobj_class->byval_arg, &valuetype_this);
+ if (!newobj_class->enumtype && (newobj_class->byval_arg.type == MONO_TYPE_VALUETYPE)) {
+ zero = valuetype_this.data.vt.vt;
+ child_frame.obj = valuetype_this.data.vt.vt;
+ } else {
+ memset (&valuetype_this, 0, sizeof (stackval));
+ zero = &valuetype_this;
+ child_frame.obj = &valuetype_this;
+ }
+ stackval_from_data (&newobj_class->byval_arg, &valuetype_this, zero);
+ } else {
+ if (newobj_class != mono_defaults.string_class) {
+ o = mono_object_new (domain, newobj_class);
+ child_frame.obj = o;
+ } else {
+ child_frame.retval = &retval;
+ }
+ }
+
+ if (csig->param_count) {
+ sp -= csig->param_count;
+ child_frame.stack_args = sp;
+ } else {
+ child_frame.stack_args = NULL;
+ }
+
+ g_assert (csig->call_convention == MONO_CALL_DEFAULT);
+
+ child_frame.ex = NULL;
+ child_frame.ex_handler = NULL;
+
+ ves_exec_method (&child_frame);
+
+ while (endsp > sp) {
+ --endsp;
+ vt_free (endsp);
+ }
+
+ if (child_frame.ex) {
+ /*
+ * An exception occurred, need to run finally, fault and catch handlers..
+ */
+ frame->ex = child_frame.ex;
+ goto handle_finally;
+ }
+ /*
+ * a constructor returns void, but we need to return the object we created
+ */
+array_constructed:
+ if (newobj_class->valuetype && !newobj_class->enumtype) {
+ *sp = valuetype_this;
+ } else if (newobj_class == mono_defaults.string_class) {
+ *sp = retval;
+ } else {
+ sp->type = VAL_OBJ;
+ sp->data.p = o;
+ sp->data.vt.klass = newobj_class;
+ }
+ ++sp;
+ BREAK;
+ }
+ CASE (CEE_CASTCLASS) /* Fall through */
+ CASE (CEE_ISINST) {
+ MonoObject *o;
+ MonoVTable *vt;
+ MonoClass *c , *oclass;
+ guint32 token;
+ int do_isinst = *ip == CEE_ISINST;
+ gboolean found = FALSE;
+
+ ++ip;
+ token = read32 (ip);
+ c = mono_class_get (image, token);
+
+ g_assert (sp [-1].type == VAL_OBJ);
+
+ if ((o = sp [-1].data.p)) {
+
+ vt = o->vtable;
+ oclass = vt->klass;
+
+ if (c->flags & TYPE_ATTRIBUTE_INTERFACE) {
+ if ((c->interface_id <= oclass->max_interface_id) &&
+ vt->interface_offsets [c->interface_id])
+ found = TRUE;
+ } else {
+ if (oclass == mono_defaults.transparent_proxy_class) {
+ /* fixme: add check for IRemotingTypeInfo */
+ MonoRealProxy *rp = ((MonoTransparentProxy *)o)->rp;
+ MonoType *type;
+ type = rp->class_to_proxy->type;
+ oclass = mono_class_from_mono_type (type);
+ }
+ /* handle array casts */
+ if (oclass->rank && oclass->rank == c->rank) {
+ if ((oclass->element_class->baseval - c->element_class->baseval) <= c->element_class->diffval) {
+ sp [-1].data.vt.klass = c;
+ found = TRUE;
+ }
+ } else if ((oclass->baseval - c->baseval) <= c->diffval) {
+ sp [-1].data.vt.klass = c;
+ found = TRUE;
+ }
+ }
+
+ if (!found) {
+ if (do_isinst) {
+ sp [-1].data.p = NULL;
+ sp [-1].data.vt.klass = NULL;
+ } else
+ THROW_EX (mono_get_exception_invalid_cast (), ip - 1);
+ }
+ }
+ ip += 4;
+ BREAK;
+ }
+ CASE (CEE_CONV_R_UN)
+ switch (sp [-1].type) {
+ case VAL_DOUBLE:
+ break;
+ case VAL_I64:
+ sp [-1].data.f = (double)(guint64)sp [-1].data.l;
+ break;
+ case VAL_VALUET:
+ ves_abort();
+ case VAL_I32:
+ sp [-1].data.f = (double)(guint32)sp [-1].data.i;
+ break;
+ default:
+ sp [-1].data.f = (double)(guint64)sp [-1].data.nati;
+ break;
+ }
+ sp [-1].type = VAL_DOUBLE;
+ BREAK;
+ CASE (CEE_UNUSED58)
+ CASE (CEE_UNUSED1) ves_abort(); BREAK;
+ CASE (CEE_UNBOX) {
+ MonoObject *o;
+ MonoClass *c;
+ guint32 token;
+
+ ++ip;
+ token = read32 (ip);
+
+ c = mono_class_get (image, token);
+
+ o = sp [-1].data.p;
+ if (!o)
+ THROW_EX (mono_get_exception_null_reference(), ip - 1);
+
+ if (o->vtable->klass->element_class->type_token != c->element_class->type_token)
+ THROW_EX (mono_get_exception_invalid_cast (), ip - 1);
+
+ sp [-1].type = VAL_MP;
+ sp [-1].data.p = (char *)o + sizeof (MonoObject);
+
+ ip += 4;
+ BREAK;
+ }
+ CASE (CEE_THROW)
+ --sp;
+ frame->ex_handler = NULL;
+ THROW_EX (sp->data.p, ip);
+ BREAK;
+ CASE (CEE_LDFLDA) /* Fall through */
+ CASE (CEE_LDFLD) {
+ MonoObject *obj;
+ MonoClassField *field;
+ guint32 token, offset;
+ int load_addr = *ip == CEE_LDFLDA;
+
+ if (!sp [-1].data.p)
+ THROW_EX (mono_get_exception_null_reference (), ip);
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+
+ if (sp [-1].type == VAL_OBJ) {
+ obj = sp [-1].data.p;
+ /* if we access a field from our parent and the parent was
+ * defined in another assembly, we get a memberref.
+ */
+ if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF)
+ field = mono_field_from_memberref (image, token, NULL);
+ else
+ field = mono_class_get_field (obj->vtable->klass, token);
+ offset = field->offset;
+ } else { /* valuetype */
+ /*g_assert (sp [-1].type == VAL_VALUETA); */
+ obj = sp [-1].data.vt.vt;
+ field = mono_class_get_field (sp [-1].data.vt.klass, token);
+ offset = field->offset - sizeof (MonoObject);
+ }
+ if (load_addr) {
+ sp [-1].type = VAL_TP;
+ sp [-1].data.p = (char*)obj + offset;
+ sp [-1].data.vt.klass = mono_class_from_mono_type (field->type);
+ } else {
+ vt_alloc (field->type, &sp [-1]);
+ stackval_from_data (field->type, &sp [-1], (char*)obj + offset);
+
+ }
+ BREAK;
+ }
+ CASE (CEE_STFLD) {
+ MonoObject *obj;
+ MonoClassField *field;
+ guint32 token, offset;
+
+ sp -= 2;
+
+ if (!sp [0].data.p)
+ THROW_EX (mono_get_exception_null_reference (), ip);
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+
+ if (sp [0].type == VAL_OBJ) {
+ obj = sp [0].data.p;
+ /* if we access a field from our parent and the parent was
+ * defined in another assembly, we get a memberref.
+ */
+ if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF)
+ field = mono_field_from_memberref (image, token, NULL);
+ else
+ field = mono_class_get_field (obj->vtable->klass, token);
+ offset = field->offset;
+ } else { /* valuetype */
+ /*g_assert (sp->type == VAL_VALUETA); */
+ obj = sp [0].data.vt.vt;
+ field = mono_class_get_field (sp [0].data.vt.klass, token);
+ offset = field->offset - sizeof (MonoObject);
+ }
+
+ stackval_to_data (field->type, &sp [1], (char*)obj + offset);
+ vt_free (&sp [1]);
+ BREAK;
+ }
+ CASE (CEE_LDSFLD) /* Fall through */
+ CASE (CEE_LDSFLDA) {
+ MonoVTable *vt;
+ MonoClass *klass;
+ MonoClassField *field;
+ guint32 token;
+ int load_addr = *ip == CEE_LDSFLDA;
+ gpointer addr;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+
+ /* need to handle fieldrefs */
+ if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) {
+ field = mono_field_from_memberref (image, token, &klass);
+ } else {
+ klass = mono_class_get (image,
+ MONO_TOKEN_TYPE_DEF | mono_metadata_typedef_from_field (image, token & 0xffffff));
+ field = mono_class_get_field (klass, token);
+ }
+ g_assert (field);
+
+ vt = mono_class_vtable (domain, klass);
+ addr = (char*)(vt->data) + field->offset;
+
+ if (load_addr) {
+ sp->type = VAL_TP;
+ sp->data.p = addr;
+ sp->data.vt.klass = mono_class_from_mono_type (field->type);
+ } else {
+ vt_alloc (field->type, sp);
+ stackval_from_data (field->type, sp, addr);
+ }
+ ++sp;
+ BREAK;
+ }
+ CASE (CEE_STSFLD) {
+ MonoVTable *vt;
+ MonoClass *klass;
+ MonoClassField *field;
+ guint32 token;
+ gpointer addr;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ --sp;
+
+ /* need to handle fieldrefs */
+ if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) {
+ field = mono_field_from_memberref (image, token, &klass);
+ } else {
+ klass = mono_class_get (image,
+ MONO_TOKEN_TYPE_DEF | mono_metadata_typedef_from_field (image, token & 0xffffff));
+ field = mono_class_get_field (klass, token);
+ }
+ g_assert (field);
+
+ vt = mono_class_vtable (domain, klass);
+ addr = (char*)(vt->data) + field->offset;
+
+ stackval_to_data (field->type, sp, addr);
+ vt_free (sp);
+ BREAK;
+ }
+ CASE (CEE_STOBJ) {
+ MonoClass *vtklass;
+ ++ip;
+ vtklass = mono_class_get (image, read32 (ip));
+ ip += 4;
+ sp -= 2;
+ memcpy (sp [0].data.p, sp [1].data.vt.vt, mono_class_value_size (vtklass, NULL));
+ BREAK;
+ }
+#if SIZEOF_VOID_P == 8
+ CASE (CEE_CONV_OVF_I_UN)
+#endif
+ CASE (CEE_CONV_OVF_I8_UN) {
+ switch (sp [-1].type) {
+ case VAL_DOUBLE:
+ if (sp [-1].data.f < 0 || sp [-1].data.f > 9223372036854775807L)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.l = (guint64)sp [-1].data.f;
+ break;
+ case VAL_I64:
+ if (sp [-1].data.l < 0)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ break;
+ case VAL_VALUET:
+ ves_abort();
+ case VAL_I32:
+ /* Can't overflow */
+ sp [-1].data.l = (guint64)sp [-1].data.i;
+ break;
+ default:
+ if ((gint64)sp [-1].data.nati < 0)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.l = (guint64)sp [-1].data.nati;
+ break;
+ }
+ sp [-1].type = VAL_I64;
+ ++ip;
+ BREAK;
+ }
+#if SIZEOF_VOID_P == 8
+ CASE (CEE_CONV_OVF_U_UN)
+#endif
+ CASE (CEE_CONV_OVF_U8_UN) {
+ switch (sp [-1].type) {
+ case VAL_DOUBLE:
+ if (sp [-1].data.f < 0 || sp [-1].data.f > MYGUINT64_MAX)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.l = (guint64)sp [-1].data.f;
+ break;
+ case VAL_I64:
+ /* nothing to do */
+ break;
+ case VAL_VALUET:
+ ves_abort();
+ case VAL_I32:
+ /* Can't overflow */
+ sp [-1].data.l = (guint64)sp [-1].data.i;
+ break;
+ default:
+ /* Can't overflow */
+ sp [-1].data.l = (guint64)sp [-1].data.nati;
+ break;
+ }
+ sp [-1].type = VAL_I64;
+ ++ip;
+ BREAK;
+ }
+#if SIZEOF_VOID_P == 4
+ CASE (CEE_CONV_OVF_I_UN)
+ CASE (CEE_CONV_OVF_U_UN)
+#endif
+ CASE (CEE_CONV_OVF_I1_UN)
+ CASE (CEE_CONV_OVF_I2_UN)
+ CASE (CEE_CONV_OVF_I4_UN)
+ CASE (CEE_CONV_OVF_U1_UN)
+ CASE (CEE_CONV_OVF_U2_UN)
+ CASE (CEE_CONV_OVF_U4_UN) {
+ guint64 value;
+ switch (sp [-1].type) {
+ case VAL_DOUBLE:
+ value = (guint64)sp [-1].data.f;
+ break;
+ case VAL_I64:
+ value = (guint64)sp [-1].data.l;
+ break;
+ case VAL_VALUET:
+ ves_abort();
+ case VAL_I32:
+ value = (guint64)sp [-1].data.i;
+ break;
+ default:
+ value = (guint64)sp [-1].data.nati;
+ break;
+ }
+ switch (*ip) {
+ case CEE_CONV_OVF_I1_UN:
+ if (value > 127)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = value;
+ sp [-1].type = VAL_I32;
+ break;
+ case CEE_CONV_OVF_I2_UN:
+ if (value > 32767)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = value;
+ sp [-1].type = VAL_I32;
+ break;
+#if SIZEOF_VOID_P == 4
+ case CEE_CONV_OVF_I_UN: /* Fall through */
+#endif
+ case CEE_CONV_OVF_I4_UN:
+ if (value > 2147483647)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = value;
+ sp [-1].type = VAL_I32;
+ break;
+ case CEE_CONV_OVF_U1_UN:
+ if (value > 255)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = value;
+ sp [-1].type = VAL_I32;
+ break;
+ case CEE_CONV_OVF_U2_UN:
+ if (value > 65535)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = value;
+ sp [-1].type = VAL_I32;
+ break;
+#if SIZEOF_VOID_P == 4
+ case CEE_CONV_OVF_U_UN: /* Fall through */
+#endif
+ case CEE_CONV_OVF_U4_UN:
+ if (value > 4294967295U)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = value;
+ sp [-1].type = VAL_I32;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ ++ip;
+ BREAK;
+ }
+ CASE (CEE_BOX) {
+ guint32 token;
+ MonoClass *class;
+
+ ip++;
+ token = read32 (ip);
+
+ class = mono_class_get (image, token);
+ g_assert (class != NULL);
+
+ sp [-1].type = VAL_OBJ;
+ if (class->byval_arg.type == MONO_TYPE_VALUETYPE && !class->enumtype)
+ sp [-1].data.p = mono_value_box (domain, class, sp [-1].data.p);
+ else
+ sp [-1].data.p = mono_value_box (domain, class, &sp [-1]);
+ /* need to vt_free (sp); */
+
+ ip += 4;
+
+ BREAK;
+ }
+ CASE (CEE_NEWARR) {
+ MonoClass *class;
+ MonoObject *o;
+ guint32 token;
+
+ ip++;
+ token = read32 (ip);
+ class = mono_class_get (image, token);
+ o = (MonoObject*) mono_array_new (domain, class, sp [-1].data.i);
+ ip += 4;
+
+ sp [-1].type = VAL_OBJ;
+ sp [-1].data.p = o;
+ /*if (profiling_classes) {
+ guint count = GPOINTER_TO_UINT (g_hash_table_lookup (profiling_classes, o->vtable->klass));
+ count++;
+ g_hash_table_insert (profiling_classes, o->vtable->klass, GUINT_TO_POINTER (count));
+ }*/
+
+ BREAK;
+ }
+ CASE (CEE_LDLEN) {
+ MonoArray *o;
+
+ ip++;
+
+ g_assert (sp [-1].type == VAL_OBJ);
+
+ o = sp [-1].data.p;
+ if (!o)
+ THROW_EX (mono_get_exception_null_reference (), ip - 1);
+
+ g_assert (MONO_CLASS_IS_ARRAY (o->obj.vtable->klass));
+
+ sp [-1].type = VAL_I32;
+ sp [-1].data.i = mono_array_length (o);
+
+ BREAK;
+ }
+ CASE (CEE_LDELEMA) {
+ MonoArray *o;
+ guint32 esize, token;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ sp -= 2;
+
+ g_assert (sp [0].type == VAL_OBJ);
+ o = sp [0].data.p;
+
+ g_assert (MONO_CLASS_IS_ARRAY (o->obj.vtable->klass));
+
+ if (sp [1].data.nati >= mono_array_length (o))
+ THROW_EX (mono_get_exception_index_out_of_range (), ip - 5);
+
+ /* check the array element corresponds to token */
+ esize = mono_array_element_size (o->obj.vtable->klass);
+
+ sp->type = VAL_MP;
+ sp->data.p = mono_array_addr_with_size (o, esize, sp [1].data.i);
+ sp->data.vt.klass = o->obj.vtable->klass->element_class;
+
+ ++sp;
+ BREAK;
+ }
+ CASE (CEE_LDELEM_I1) /* fall through */
+ CASE (CEE_LDELEM_U1) /* fall through */
+ CASE (CEE_LDELEM_I2) /* fall through */
+ CASE (CEE_LDELEM_U2) /* fall through */
+ CASE (CEE_LDELEM_I4) /* fall through */
+ CASE (CEE_LDELEM_U4) /* fall through */
+ CASE (CEE_LDELEM_I8) /* fall through */
+ CASE (CEE_LDELEM_I) /* fall through */
+ CASE (CEE_LDELEM_R4) /* fall through */
+ CASE (CEE_LDELEM_R8) /* fall through */
+ CASE (CEE_LDELEM_REF) {
+ MonoArray *o;
+ mono_u aindex;
+
+ sp -= 2;
+
+ g_assert (sp [0].type == VAL_OBJ);
+ o = sp [0].data.p;
+ if (!o)
+ THROW_EX (mono_get_exception_null_reference (), ip);
+
+ g_assert (MONO_CLASS_IS_ARRAY (o->obj.vtable->klass));
+
+ aindex = sp [1].data.nati;
+ 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_LDELEM_I1:
+ sp [0].data.i = mono_array_get (o, gint8, aindex);
+ sp [0].type = VAL_I32;
+ break;
+ case CEE_LDELEM_U1:
+ sp [0].data.i = mono_array_get (o, guint8, aindex);
+ sp [0].type = VAL_I32;
+ break;
+ case CEE_LDELEM_I2:
+ sp [0].data.i = mono_array_get (o, gint16, aindex);
+ sp [0].type = VAL_I32;
+ break;
+ case CEE_LDELEM_U2:
+ sp [0].data.i = mono_array_get (o, guint16, aindex);
+ sp [0].type = VAL_I32;
+ break;
+ case CEE_LDELEM_I:
+ sp [0].data.nati = mono_array_get (o, mono_i, aindex);
+ sp [0].type = VAL_NATI;
+ break;
+ case CEE_LDELEM_I4:
+ sp [0].data.i = mono_array_get (o, gint32, aindex);
+ sp [0].type = VAL_I32;
+ break;
+ case CEE_LDELEM_U4:
+ sp [0].data.i = mono_array_get (o, guint32, aindex);
+ sp [0].type = VAL_I32;
+ break;
+ case CEE_LDELEM_I8:
+ sp [0].data.l = mono_array_get (o, gint64, aindex);
+ sp [0].type = VAL_I64;
+ break;
+ case CEE_LDELEM_R4:
+ sp [0].data.f = mono_array_get (o, float, aindex);
+ sp [0].type = VAL_DOUBLE;
+ break;
+ case CEE_LDELEM_R8:
+ sp [0].data.f = mono_array_get (o, double, aindex);
+ sp [0].type = VAL_DOUBLE;
+ break;
+ case CEE_LDELEM_REF:
+ sp [0].data.p = mono_array_get (o, gpointer, aindex);
+ sp [0].data.vt.klass = NULL;
+ sp [0].type = VAL_OBJ;
+ break;
+ default:
+ ves_abort();
+ }
+
+ ++ip;
+ ++sp;
+ BREAK;
+ }
+ CASE (CEE_STELEM_I) /* fall through */
+ CASE (CEE_STELEM_I1) /* fall through */
+ CASE (CEE_STELEM_I2) /* fall through */
+ CASE (CEE_STELEM_I4) /* fall through */
+ CASE (CEE_STELEM_I8) /* fall through */
+ CASE (CEE_STELEM_R4) /* fall through */
+ CASE (CEE_STELEM_R8) /* fall through */
+ CASE (CEE_STELEM_REF) {
+ MonoArray *o;
+ MonoClass *ac;
+ mono_u aindex;
+
+ sp -= 3;
+
+ g_assert (sp [0].type == VAL_OBJ);
+ o = sp [0].data.p;
+ if (!o)
+ THROW_EX (mono_get_exception_null_reference (), ip);
+
+ ac = o->obj.vtable->klass;
+ g_assert (MONO_CLASS_IS_ARRAY (ac));
+
+ aindex = sp [1].data.nati;
+ 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);
+ break;
+ case CEE_STELEM_I1:
+ mono_array_set (o, gint8, aindex, sp [2].data.i);
+ break;
+ case CEE_STELEM_I2:
+ mono_array_set (o, gint16, aindex, sp [2].data.i);
+ break;
+ case CEE_STELEM_I4:
+ mono_array_set (o, gint32, aindex, sp [2].data.i);
+ break;
+ case CEE_STELEM_I8:
+ mono_array_set (o, gint64, aindex, sp [2].data.l);
+ break;
+ case CEE_STELEM_R4:
+ mono_array_set (o, float, aindex, sp [2].data.f);
+ break;
+ case CEE_STELEM_R8:
+ mono_array_set (o, double, aindex, sp [2].data.f);
+ break;
+ case CEE_STELEM_REF:
+ g_assert (sp [2].type == VAL_OBJ);
+ mono_array_set (o, gpointer, aindex, sp [2].data.p);
+ break;
+ default:
+ ves_abort();
+ }
+
+ ++ip;
+ BREAK;
+ }
+ CASE (CEE_UNUSED2)
+ CASE (CEE_UNUSED3)
+ CASE (CEE_UNUSED4)
+ CASE (CEE_UNUSED5)
+ CASE (CEE_UNUSED6)
+ CASE (CEE_UNUSED7)
+ CASE (CEE_UNUSED8)
+ CASE (CEE_UNUSED9)
+ CASE (CEE_UNUSED10)
+ CASE (CEE_UNUSED11)
+ CASE (CEE_UNUSED12)
+ CASE (CEE_UNUSED13)
+ CASE (CEE_UNUSED14)
+ CASE (CEE_UNUSED15)
+ CASE (CEE_UNUSED16)
+ CASE (CEE_UNUSED17) ves_abort(); BREAK;
+ CASE (CEE_CONV_OVF_I1)
+ if (sp [-1].type == VAL_I32) {
+ if (sp [-1].data.i < 128 || sp [-1].data.i > 127)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = (gint8)sp [-1].data.i;
+ } else if (sp [-1].type == VAL_I64) {
+ if (sp [-1].data.l < 128 || sp [-1].data.l > 127)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = (gint8)sp [-1].data.l;
+ } else {
+ ves_abort();
+ }
+ ++ip;
+ BREAK;
+ CASE (CEE_CONV_OVF_U1)
+ if (sp [-1].type == VAL_I32) {
+ if (sp [-1].data.i < 0 || sp [-1].data.i > 255)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = (gint8)sp [-1].data.i;
+ } else if (sp [-1].type == VAL_I64) {
+ if (sp [-1].data.l < 0 || sp [-1].data.l > 255)
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = (gint8)sp [-1].data.l;
+ } else {
+ ves_abort();
+ }
+ ++ip;
+ BREAK;
+ CASE (CEE_CONV_OVF_I2)
+ CASE (CEE_CONV_OVF_U2)
+ ++ip;
+ /* FIXME: handle other cases */
+ if (sp [-1].type == VAL_I32) {
+ /* defined as NOP */
+ } else {
+ ves_abort();
+ }
+ BREAK;
+ CASE (CEE_CONV_OVF_I4)
+ /* FIXME: handle other cases */
+ if (sp [-1].type == VAL_I32) {
+ /* defined as NOP */
+ } else if(sp [-1].type == VAL_I64) {
+ sp [-1].data.i = (gint32)sp [-1].data.l;
+ } else {
+ ves_abort();
+ }
+ ++ip;
+ BREAK;
+ CASE (CEE_CONV_OVF_U4)
+ /* FIXME: handle other cases */
+ if (sp [-1].type == VAL_I32) {
+ /* defined as NOP */
+ } else if(sp [-1].type == VAL_I64) {
+ sp [-1].data.i = (guint32)sp [-1].data.l;
+ } else {
+ ves_abort();
+ }
+ ++ip;
+ BREAK;
+ CASE (CEE_CONV_OVF_I8)
+ /* FIXME: handle other cases */
+ if (sp [-1].type == VAL_I32) {
+ sp [-1].data.l = (guint64)sp [-1].data.l;
+ } else if(sp [-1].type == VAL_I64) {
+ /* defined as NOP */
+ } else {
+ ves_abort();
+ }
+ ++ip;
+ BREAK;
+ CASE (CEE_CONV_OVF_U8)
+ /* FIXME: handle other cases */
+ if (sp [-1].type == VAL_I32) {
+ sp [-1].data.l = (guint64)sp [-1].data.l;
+ } else if(sp [-1].type == VAL_I64) {
+ /* defined as NOP */
+ } else {
+ ves_abort();
+ }
+ ++ip;
+ BREAK;
+ CASE (CEE_UNUSED50)
+ CASE (CEE_UNUSED18)
+ CASE (CEE_UNUSED19)
+ CASE (CEE_UNUSED20)
+ CASE (CEE_UNUSED21)
+ CASE (CEE_UNUSED22)
+ CASE (CEE_UNUSED23) ves_abort(); BREAK;
+ CASE (CEE_REFANYVAL) ves_abort(); BREAK;
+ CASE (CEE_CKFINITE)
+ if (!finite(sp [-1].data.f))
+ THROW_EX (mono_get_exception_arithmetic (), ip);
+ ++ip;
+ BREAK;
+ CASE (CEE_UNUSED24) ves_abort(); BREAK;
+ CASE (CEE_UNUSED25) ves_abort(); BREAK;
+ CASE (CEE_MKREFANY) ves_abort(); BREAK;
+ CASE (CEE_UNUSED59)
+ CASE (CEE_UNUSED60)
+ CASE (CEE_UNUSED61)
+ CASE (CEE_UNUSED62)
+ CASE (CEE_UNUSED63)
+ CASE (CEE_UNUSED64)
+ CASE (CEE_UNUSED65)
+ CASE (CEE_UNUSED66)
+ CASE (CEE_UNUSED67) ves_abort(); BREAK;
+ CASE (CEE_LDTOKEN) {
+ gpointer handle;
+ MonoClass *handle_class;
+ ++ip;
+ handle = mono_ldtoken (image, read32 (ip), &handle_class);
+ ip += 4;
+ vt_alloc (&handle_class->byval_arg, sp);
+ stackval_from_data (&handle_class->byval_arg, sp, (char*)&handle);
+ ++sp;
+ BREAK;
+ }
+ CASE (CEE_CONV_OVF_I)
+ ++ip;
+ --sp;
+ /* FIXME: check overflow. */
+ switch (sp->type) {
+ case VAL_I32:
+ sp->data.p = (gpointer)(mono_i) sp->data.i;
+ break;
+ case VAL_I64:
+ sp->data.p = (gpointer)(mono_i) sp->data.l;
+ break;
+ case VAL_NATI:
+ break;
+ case VAL_DOUBLE:
+ sp->data.p = (gpointer)(mono_i) sp->data.f;
+ break;
+ default:
+ ves_abort ();
+ }
+ sp->type = VAL_NATI;
+ ++sp;
+ BREAK;
+ CASE (CEE_CONV_OVF_U) ves_abort(); BREAK;
+ CASE (CEE_ADD_OVF)
+ --sp;
+ /* FIXME: check overflow */
+ if (sp->type == VAL_I32) {
+ if (CHECK_ADD_OVERFLOW (sp [-1].data.i, GET_NATI (sp [0])))
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = (guint32)sp [-1].data.i + (guint32)GET_NATI (sp [0]);
+ } else if (sp->type == VAL_I64) {
+ if (CHECK_ADD_OVERFLOW64 (sp [-1].data.l, sp [0].data.l))
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.l = (guint64)sp [-1].data.l + (guint64)sp [0].data.l;
+ } else if (sp->type == VAL_DOUBLE)
+ sp [-1].data.f += sp [0].data.f;
+ else {
+ char *p = sp [-1].data.p;
+ p += GET_NATI (sp [0]);
+ sp [-1].data.p = p;
+ }
+ ++ip;
+ BREAK;
+ CASE (CEE_ADD_OVF_UN)
+ --sp;
+ /* FIXME: check overflow, make unsigned */
+ if (sp->type == VAL_I32) {
+ if (CHECK_ADD_OVERFLOW_UN (sp [-1].data.i, GET_NATI (sp [0])))
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.i = (guint32)sp [-1].data.i + (guint32)GET_NATI (sp [0]);
+ } else if (sp->type == VAL_I64) {
+ if (CHECK_ADD_OVERFLOW64_UN (sp [-1].data.l, sp [0].data.l))
+ THROW_EX (mono_get_exception_overflow (), ip);
+ sp [-1].data.l = (guint64)sp [-1].data.l + (guint64)sp [0].data.l;
+ } else if (sp->type == VAL_DOUBLE)
+ sp [-1].data.f += sp [0].data.f;
+ else {
+ char *p = sp [-1].data.p;
+ p += GET_NATI (sp [0]);
+ sp [-1].data.p = p;
+ }
+ ++ip;
+ BREAK;
+ CASE (CEE_MUL_OVF)
+ ++ip;
+ --sp;
+ /* FIXME: check overflow */
+ if (sp->type == VAL_I32)
+ sp [-1].data.i *= (gint)GET_NATI (sp [0]);
+ else if (sp->type == VAL_I64)
+ sp [-1].data.l *= sp [0].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ sp [-1].data.f *= sp [0].data.f;
+ BREAK;
+ CASE (CEE_MUL_OVF_UN)
+ ++ip;
+ --sp;
+ /* FIXME: check overflow, make unsigned */
+ if (sp->type == VAL_I32)
+ sp [-1].data.i *= (gint)GET_NATI (sp [0]);
+ else if (sp->type == VAL_I64)
+ sp [-1].data.l *= sp [0].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ sp [-1].data.f *= sp [0].data.f;
+ BREAK;
+ CASE (CEE_SUB_OVF)
+ CASE (CEE_SUB_OVF_UN)
+ ++ip;
+ --sp;
+ /* FIXME: handle undeflow/unsigned */
+ /* should probably consider the pointers as unsigned */
+ if (sp->type == VAL_I32)
+ sp [-1].data.i -= GET_NATI (sp [0]);
+ else if (sp->type == VAL_I64)
+ sp [-1].data.l -= sp [0].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ sp [-1].data.f -= sp [0].data.f;
+ else {
+ char *p = sp [-1].data.p;
+ p -= GET_NATI (sp [0]);
+ sp [-1].data.p = p;
+ }
+ BREAK;
+ CASE (CEE_ENDFINALLY)
+ if (frame->ex)
+ goto handle_fault;
+ /*
+ * There was no exception, we continue normally at the target address.
+ */
+ ip = endfinally_ip;
+ BREAK;
+ CASE (CEE_LEAVE) /* Fall through */
+ CASE (CEE_LEAVE_S)
+ sp = frame->stack; /* empty the stack */
+ frame->ip = ip;
+ if (*ip == CEE_LEAVE_S) {
+ ++ip;
+ ip += (signed char) *ip;
+ ++ip;
+ } else {
+ ++ip;
+ ip += (gint32) read32 (ip);
+ ip += 4;
+ }
+#if 0
+ /*
+ * We may be either inside a try block or inside an handler.
+ * In the first case there was no exception and we go on
+ * executing the finally handlers and after that resume control
+ * at endfinally_ip.
+ * In the second case we need to clear the exception and
+ * continue directly at the target ip.
+ */
+ if (!frame->ex) {
+ endfinally_ip = ip;
+ goto handle_finally;
+ } else {
+ frame->ex = NULL;
+ frame->ex_handler = NULL;
+ }
+#endif
+ frame->ex = NULL;
+ frame->ex_handler = NULL;
+ endfinally_ip = ip;
+ goto handle_finally;
+ BREAK;
+ CASE (CEE_UNUSED26)
+ CASE (CEE_UNUSED27)
+ CASE (CEE_UNUSED28)
+ CASE (CEE_UNUSED29)
+ CASE (CEE_UNUSED30)
+ CASE (CEE_UNUSED31)
+ CASE (CEE_UNUSED32)
+ CASE (CEE_UNUSED33)
+ CASE (CEE_UNUSED34)
+ CASE (CEE_UNUSED35)
+ CASE (CEE_UNUSED36)
+ CASE (CEE_UNUSED37)
+ CASE (CEE_UNUSED38)
+ CASE (CEE_UNUSED39)
+ CASE (CEE_UNUSED40)
+ CASE (CEE_UNUSED41)
+ CASE (CEE_UNUSED42)
+ CASE (CEE_UNUSED43)
+ CASE (CEE_UNUSED44)
+ CASE (CEE_UNUSED45)
+ CASE (CEE_UNUSED46)
+ CASE (CEE_UNUSED47)
+ CASE (CEE_UNUSED48)
+ CASE (CEE_PREFIX7)
+ CASE (CEE_PREFIX6)
+ CASE (CEE_PREFIX5)
+ CASE (CEE_PREFIX4)
+ CASE (CEE_PREFIX3)
+ CASE (CEE_PREFIX2)
+ CASE (CEE_PREFIXREF) ves_abort(); BREAK;
+ /*
+ * Note: Exceptions thrown when executing a prefixed opcode need
+ * to take into account the number of prefix bytes (usually the
+ * throw point is just (ip - n_prefix_bytes).
+ */
+ SUB_SWITCH
+ ++ip;
+ switch (*ip) {
+ case CEE_ARGLIST: ves_abort(); break;
+ case CEE_CEQ: {
+ gint32 result;
+ ++ip;
+ sp -= 2;
+
+ if (sp->type == VAL_I32)
+ result = sp [0].data.i == (gint)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = sp [0].data.l == sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE) {
+ if (isnan (sp [0].data.f) || isnan (sp [1].data.f))
+ result = 0;
+ else
+ result = sp [0].data.f == sp [1].data.f;
+ } else
+ result = GET_NATI (sp [0]) == GET_NATI (sp [1]);
+ sp->type = VAL_I32;
+ sp->data.i = result;
+
+ sp++;
+ break;
+ }
+ case CEE_CGT: {
+ gint32 result;
+ ++ip;
+ sp -= 2;
+
+ if (sp->type == VAL_I32)
+ result = sp [0].data.i > (gint)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = sp [0].data.l > sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE) {
+ if (isnan (sp [0].data.f) || isnan (sp [1].data.f))
+ result = 0;
+ else
+ result = sp [0].data.f > sp [1].data.f;
+ } else
+ result = (gint)GET_NATI (sp [0]) > (gint)GET_NATI (sp [1]);
+ sp->type = VAL_I32;
+ sp->data.i = result;
+
+ sp++;
+ break;
+ }
+ case CEE_CGT_UN: {
+ gint32 result;
+ ++ip;
+ sp -= 2;
+
+ if (sp->type == VAL_I32)
+ result = (guint32)sp [0].data.i > (mono_u)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = (guint64)sp [0].data.l > (guint64)sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = isnan (sp [0].data.f) || isnan (sp [1].data.f);
+ else
+ result = (mono_u)GET_NATI (sp [0]) > (mono_u)GET_NATI (sp [1]);
+ sp->type = VAL_I32;
+ sp->data.i = result;
+
+ sp++;
+ break;
+ }
+ case CEE_CLT: {
+ gint32 result;
+ ++ip;
+ sp -= 2;
+
+ if (sp->type == VAL_I32)
+ result = sp [0].data.i < (gint)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = sp [0].data.l < sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE) {
+ if (isnan (sp [0].data.f) || isnan (sp [1].data.f))
+ result = 0;
+ else
+ result = sp [0].data.f < sp [1].data.f;
+ } else
+ result = (gint)GET_NATI (sp [0]) < (gint)GET_NATI (sp [1]);
+ sp->type = VAL_I32;
+ sp->data.i = result;
+
+ sp++;
+ break;
+ }
+ case CEE_CLT_UN: {
+ gint32 result;
+ ++ip;
+ sp -= 2;
+
+ if (sp->type == VAL_I32)
+ result = (guint32)sp [0].data.i < (mono_u)GET_NATI (sp [1]);
+ else if (sp->type == VAL_I64)
+ result = (guint64)sp [0].data.l < (guint64)sp [1].data.l;
+ else if (sp->type == VAL_DOUBLE)
+ result = isnan (sp [0].data.f) || isnan (sp [1].data.f);
+ else
+ result = (mono_u)GET_NATI (sp [0]) < (mono_u)GET_NATI (sp [1]);
+ sp->type = VAL_I32;
+ sp->data.i = result;
+
+ sp++;
+ break;
+ }
+ case CEE_LDFTN:
+ case CEE_LDVIRTFTN: {
+ int virtual = *ip == CEE_LDVIRTFTN;
+ MonoMethod *m;
+ guint32 token;
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ m = mono_get_method (image, token, NULL);
+ if (!m)
+ THROW_EX (mono_get_exception_missing_method (), ip - 5);
+ if (virtual) {
+ --sp;
+ if (!sp->data.p)
+ THROW_EX (mono_get_exception_null_reference (), ip - 5);
+ m = get_virtual_method (domain, m, sp);
+ }
+ sp->type = VAL_NATI;
+ sp->data.p = mono_create_method_pointer (m);
+ sp->data.vt.klass = NULL;
+ ++sp;
+ break;
+ }
+ case CEE_UNUSED56: ves_abort(); break;
+ case CEE_LDARG: {
+ guint32 arg_pos;
+ ++ip;
+ arg_pos = read16 (ip);
+ ip += 2;
+ vt_alloc (ARG_TYPE (signature, arg_pos), sp);
+ stackval_from_data (ARG_TYPE (signature, arg_pos), sp, ARG_POS (arg_pos));
+ ++sp;
+ break;
+ }
+ case CEE_LDARGA: {
+ MonoType *t;
+ MonoClass *c;
+ guint32 anum;
+
+ ++ip;
+ anum = read16 (ip);
+ ip += 2;
+ t = ARG_TYPE (signature, anum);
+ c = mono_class_from_mono_type (t);
+ sp->data.vt.klass = c;
+ sp->data.vt.vt = ARG_POS (anum);
+
+ if (c->valuetype)
+ sp->type = VAL_VALUETA;
+ else
+ sp->type = VAL_TP;
+
+ ++sp;
+ ++ip;
+ break;
+ }
+ case CEE_STARG: {
+ guint32 arg_pos;
+ ++ip;
+ arg_pos = read16 (ip);
+ ip += 2;
+ --sp;
+ stackval_to_data (ARG_TYPE (signature, arg_pos), sp, ARG_POS (arg_pos));
+ vt_free (sp);
+ break;
+ }
+ case CEE_LDLOC: {
+ guint32 loc_pos;
+ ++ip;
+ loc_pos = read16 (ip);
+ ip += 2;
+ vt_alloc (LOCAL_TYPE (header, loc_pos), sp);
+ stackval_from_data (LOCAL_TYPE (header, loc_pos), sp, LOCAL_POS (loc_pos));
+ ++sp;
+ break;
+ }
+ case CEE_LDLOCA: {
+ MonoType *t;
+ MonoClass *c;
+ guint32 loc_pos;
+
+ ++ip;
+ loc_pos = read16 (ip);
+ ip += 2;
+ t = LOCAL_TYPE (header, loc_pos);
+ c = mono_class_from_mono_type (t);
+ sp->data.vt.vt = LOCAL_POS (loc_pos);
+ sp->data.vt.klass = c;
+
+ if (c->valuetype)
+ sp->type = VAL_VALUETA;
+ else
+ sp->type = VAL_TP;
+
+ ++sp;
+ break;
+ }
+ case CEE_STLOC: {
+ guint32 loc_pos;
+ ++ip;
+ loc_pos = read16 (ip);
+ ip += 2;
+ --sp;
+ stackval_to_data (LOCAL_TYPE (header, loc_pos), sp, LOCAL_POS (loc_pos));
+ vt_free (sp);
+ break;
+ }
+ case CEE_LOCALLOC:
+ if (sp != frame->stack)
+ THROW_EX (mono_get_exception_execution_engine (NULL), ip - 1);
+ ++ip;
+ sp->data.p = alloca (sp->data.i);
+ sp->type = VAL_TP;
+ break;
+ case CEE_UNUSED57: ves_abort(); break;
+ case CEE_ENDFILTER: ves_abort(); break;
+ case CEE_UNALIGNED_:
+ ++ip;
+ unaligned_address = 1;
+ break;
+ case CEE_VOLATILE_:
+ ++ip;
+ volatile_address = 1;
+ break;
+ case CEE_TAIL_:
+ ++ip;
+ tail_recursion = 1;
+ break;
+ case CEE_INITOBJ: {
+ guint32 token;
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ /*
+ * we ignore the value of token (I think we can as unspecified
+ * behavior described in Partition II, 3.5).
+ */
+ --sp;
+ g_assert (sp->type == VAL_VALUETA || sp->type == VAL_TP);
+ memset (sp->data.vt.vt, 0, mono_class_value_size (sp->data.vt.klass, NULL));
+ break;
+ }
+ case CEE_UNUSED68: ves_abort(); break;
+ case CEE_CPBLK:
+ sp -= 3;
+ if (!sp [0].data.p || !sp [1].data.p)
+ THROW_EX (mono_get_exception_null_reference(), ip - 1);
+ ++ip;
+ /* FIXME: value and size may be int64... */
+ memcpy (sp [0].data.p, sp [1].data.p, sp [2].data.i);
+ break;
+ case CEE_INITBLK:
+ sp -= 3;
+ if (!sp [0].data.p)
+ THROW_EX (mono_get_exception_null_reference(), ip - 1);
+ ++ip;
+ /* FIXME: value and size may be int64... */
+ memset (sp [0].data.p, sp [1].data.i, sp [2].data.i);
+ break;
+ case CEE_UNUSED69: ves_abort(); break;
+ case CEE_RETHROW:
+ /*
+ * need to clarify what this should actually do:
+ * start the search from the last found handler in
+ * this method or continue in the caller or what.
+ * Also, do we need to run finally/fault handlers after a retrow?
+ * Well, this implementation will follow the usual search
+ * for an handler, considering the current ip as throw spot.
+ * We need to NULL frame->ex_handler for the later code to
+ * actually run the new found handler.
+ */
+ frame->ex_handler = NULL;
+ THROW_EX (frame->ex, ip - 1);
+ break;
+ case CEE_UNUSED: ves_abort(); break;
+ case CEE_SIZEOF: {
+ guint32 token;
+ MonoType *type;
+ int align;
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ type = mono_type_create_from_typespec (image, token);
+ sp->type = VAL_I32;
+ sp->data.i = mono_type_size (type, &align);
+ mono_metadata_free_type (type);
+ ++sp;
+ break;
+ }
+ case CEE_REFANYTYPE: ves_abort(); break;
+ case CEE_UNUSED52:
+ case CEE_UNUSED53:
+ case CEE_UNUSED54:
+ case CEE_UNUSED55:
+ case CEE_UNUSED70:
+ default:
+ g_error ("Unimplemented opcode: 0xFE %02x at 0x%x\n", *ip, ip-header->code);
+ }
+ continue;
+ DEFAULT;
+ }
+ }
+
+ g_assert_not_reached ();
+ /*
+ * Exception handling code.
+ * The exception object is stored in frame->ex.
+ */
+
+ handle_exception:
+ {
+ int i;
+ guint32 ip_offset;
+ MonoInvocation *inv;
+ MonoMethodHeader *hd;
+ MonoExceptionClause *clause;
+ char *message;
+ MonoObject *ex_obj;
+
+ if (die_on_exception)
+ goto die_on_ex;
+
+ for (inv = frame; inv; inv = inv->parent) {
+ if (inv->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
+ continue;
+ if (inv->method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))
+ continue;
+ hd = ((MonoMethodNormal*)inv->method)->header;
+ ip_offset = inv->ip - hd->code;
+ for (i = 0; i < hd->num_clauses; ++i) {
+ clause = &hd->clauses [i];
+ if (clause->flags <= 1 && MONO_OFFSET_IN_CLAUSE (clause, ip_offset)) {
+ if (!clause->flags) {
+ if (mono_object_isinst ((MonoObject*)frame->ex, mono_class_get (inv->method->klass->image, clause->token_or_filter))) {
+ /*
+ * OK, we found an handler, now we need to execute the finally
+ * and fault blocks before branching to the handler code.
+ */
+ inv->ex_handler = clause;
+ /*
+ * It seems that if the catch handler is found in the same method,
+ * it gets executed before the finally handler.
+ */
+ if (inv == frame)
+ goto handle_fault;
+ else
+ goto handle_finally;
+ }
+ } else {
+ /* FIXME: handle filter clauses */
+ g_assert (0);
+ }
+ }
+ }
+ }
+ /*
+ * If we get here, no handler was found: print a stack trace.
+ */
+die_on_ex:
+ ex_obj = (MonoObject*)frame->ex;
+ message = frame->ex->message? mono_string_to_utf8 (frame->ex->message): NULL;
+ g_print ("Unhandled exception %s.%s %s.\n", ex_obj->vtable->klass->name_space, ex_obj->vtable->klass->name,
+ message?message:"");
+ g_free (message);
+ message = dump_frame (frame);
+ g_print ("%s", message);
+ g_free (message);
+ exit (1);
+ }
+ handle_finally:
+ {
+ int i;
+ guint32 ip_offset;
+ MonoExceptionClause *clause;
+
+ if (frame->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+ DEBUG_LEAVE ();
+ return;
+ }
+ ip_offset = frame->ip - header->code;
+
+ for (i = 0; i < header->num_clauses; ++i) {
+ clause = &header->clauses [i];
+ if (MONO_OFFSET_IN_CLAUSE (clause, ip_offset)) {
+ if (clause->flags == MONO_EXCEPTION_CLAUSE_FINALLY) {
+ ip = header->code + clause->handler_offset;
+ goto main_loop;
+ } else
+ break;
+ }
+ }
+
+ /*
+ * If an exception is set, we need to execute the fault handler, too,
+ * otherwise, we continue normally.
+ */
+ if (frame->ex)
+ goto handle_fault;
+ ip = endfinally_ip;
+ goto main_loop;
+ }
+ handle_fault:
+ {
+ int i;
+ guint32 ip_offset;
+ MonoExceptionClause *clause;
+
+ ip_offset = frame->ip - header->code;
+ for (i = 0; i < header->num_clauses; ++i) {
+ clause = &header->clauses [i];
+ if (clause->flags == 3 && MONO_OFFSET_IN_CLAUSE (clause, ip_offset)) {
+ ip = header->code + clause->handler_offset;
+ goto main_loop;
+ }
+ }
+ /*
+ * If the handler for the exception was found in this method, we jump
+ * to it right away, otherwise we return and let the caller run
+ * the finally, fault and catch blocks.
+ * This same code should be present in the endfault opcode, but it
+ * is corrently not assigned in the ECMA specs: LAMESPEC.
+ */
+ if (frame->ex_handler) {
+ ip = header->code + frame->ex_handler->handler_offset;
+ sp = frame->stack;
+ sp->type = VAL_OBJ;
+ sp->data.p = frame->ex;
+ ++sp;
+ goto main_loop;
+ }
+ DEBUG_LEAVE ();
+ return;
+ }
+
+}
+
+static int
+ves_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[])
+{
+ MonoArray *args = NULL;
+ MonoImage *image = assembly->image;
+ MonoCLIImageInfo *iinfo;
+ MonoMethod *method;
+ int i;
+
+ iinfo = image->image_info;
+ method = mono_get_method (image, iinfo->cli_cli_header.ch_entry_point, NULL);
+ if (!method)
+ g_error ("No entry point method found in %s", image->name);
+
+ if (method->signature->param_count) {
+ args = (MonoArray*)mono_array_new (domain, mono_defaults.string_class, argc);
+ for (i = 0; i < argc; ++i) {
+ MonoString *arg = mono_string_new (domain, argv [i]);
+ mono_array_set (args, gpointer, i, arg);
+ }
+ }
+
+ return mono_runtime_exec_main (method, args);
+}
+
+static void
+usage (void)
+{
+ fprintf (stderr,
+ "mint %s, the Mono ECMA CLI interpreter, (C) 2001 Ximian, Inc.\n\n"
+ "Usage is: mint [options] executable args...\n", VERSION);
+ fprintf (stderr,
+ "Valid Options are:\n"
+#ifdef DEBUG_INTERP
+ "--debug\n"
+#endif
+ "--help\n"
+ "--trace\n"
+ "--traceops\n"
+ "--traceclassinit\n"
+ "--dieonex\n"
+ "--profile\n"
+ "--debug method_name\n"
+ "--print-vtable\n"
+ "--opcode-count\n");
+ exit (1);
+}
+
+#ifdef RUN_TEST
+static void
+test_load_class (MonoImage* image)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_TYPEDEF];
+ MonoClass *klass;
+ int i;
+
+ for (i = 1; i <= t->rows; ++i) {
+ klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | i);
+ mono_class_init (klass);
+ }
+}
+#endif
+
+static MonoException * segv_exception = NULL;
+
+static void
+segv_handler (int signum)
+{
+ signal (signum, segv_handler);
+ mono_raise_exception (segv_exception);
+}
+
+int
+main (int argc, char *argv [])
+{
+ MonoDomain *domain;
+ MonoAssembly *assembly;
+ int retval = 0, i, ocount = 0;
+ char *file, *error;
+
+ if (argc < 2)
+ usage ();
+
+ for (i = 1; i < argc && argv [i][0] == '-'; i++){
+ if (strcmp (argv [i], "--trace") == 0)
+ global_tracing = 1;
+ if (strcmp (argv [i], "--traceops") == 0)
+ global_tracing = 2;
+ if (strcmp (argv [i], "--dieonex") == 0)
+ die_on_exception = 1;
+ if (strcmp (argv [i], "--print-vtable") == 0)
+ mono_print_vtable = TRUE;
+ if (strcmp (argv [i], "--profile") == 0)
+ mono_profiler_install_simple ();
+ if (strcmp (argv [i], "--opcode-count") == 0)
+ ocount = 1;
+ if (strcmp (argv [i], "--help") == 0)
+ usage ();
+#if DEBUG_INTERP
+ if (strcmp (argv [i], "--debug") == 0) {
+ MonoMethodDesc *desc = mono_method_desc_new (argv [++i], FALSE);
+ if (!desc)
+ g_error ("Invalid method name '%s'", argv [i]);
+ db_methods = g_list_append (db_methods, desc);
+ }
+#endif
+ }
+
+ file = argv [i];
+
+ if (!file)
+ usage ();
+
+ mono_init_icall ();
+ mono_add_internal_call ("System.Array::Set", ves_array_set);
+ mono_add_internal_call ("System.Array::Get", ves_array_get);
+ mono_add_internal_call ("System.Array::Address", ves_array_element_address);
+
+ frame_thread_id = TlsAlloc ();
+ TlsSetValue (frame_thread_id, NULL);
+
+ mono_install_runtime_invoke (interp_mono_runtime_invoke);
+ mono_install_remoting_trampoline (interp_create_remoting_trampoline);
+
+ mono_install_handler (interp_ex_handler);
+
+ InitializeCriticalSection (&metadata_lock);
+ domain = mono_init (file);
+ mono_runtime_init (domain);
+ mono_thread_init (domain);
+ mono_network_init ();
+
+ assembly = mono_domain_assembly_open (domain, file);
+
+ if (!assembly){
+ fprintf (stderr, "Can not open image %s\n", file);
+ exit (1);
+ }
+
+
+#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 (domain, "Segmentation fault");
+ signal (SIGSEGV, segv_handler);
+ /*
+ * skip the program name from the args.
+ */
+ ++i;
+ retval = ves_exec (domain, assembly, argc - i, argv + i);
+#endif
+ mono_profiler_shutdown ();
+
+ mono_network_cleanup ();
+ mono_thread_cleanup ();
+
+ mono_domain_unload (domain, TRUE);
+
+#if DEBUG_INTERP
+ if (ocount) {
+ fprintf (stderr, "opcode count: %ld\n", opcode_count);
+ fprintf (stderr, "fcall count: %ld\n", fcall_count);
+ }
+#endif
+ return retval;
+}
+
+
+
diff --git a/mono/interpreter/interp.h b/mono/interpreter/interp.h
new file mode 100644
index 00000000000..d3363a0514c
--- /dev/null
+++ b/mono/interpreter/interp.h
@@ -0,0 +1,79 @@
+
+#include <glib.h>
+#include <mono/metadata/loader.h>
+#include <mono/metadata/object.h>
+
+enum {
+ VAL_I32 = 0,
+ VAL_DOUBLE = 1,
+ VAL_I64 = 2,
+ VAL_VALUET = 3,
+ VAL_POINTER = 4,
+ VAL_NATI = 0 + VAL_POINTER,
+ VAL_MP = 1 + VAL_POINTER,
+ VAL_TP = 2 + VAL_POINTER,
+ VAL_OBJ = 3 + VAL_POINTER,
+ VAL_VALUETA = 8
+};
+
+#if SIZEOF_VOID_P == 4
+typedef guint32 mono_u;
+typedef gint32 mono_i;
+#elif SIZEOF_VOID_P == 8
+typedef guint64 mono_u;
+typedef gint64 mono_i;
+#endif
+
+/*
+ * Value types are represented on the eval stack as pointers to the
+ * actual storage. The size field tells how much storage is allocated.
+ * A value type can't be larger than 16 MB.
+ */
+typedef struct {
+ union {
+ gint32 i;
+ gint64 l;
+ double f;
+ /* native size integer and pointer types */
+ gpointer p;
+ mono_u nati;
+ struct {
+ gpointer vt;
+ MonoClass *klass;
+ } vt;
+ } data;
+ unsigned int type;
+} stackval;
+
+typedef struct _MonoInvocation MonoInvocation;
+
+struct _MonoInvocation {
+ MonoInvocation *parent; /* parent */
+ MonoInvocation *child;
+ MonoMethod *method; /* parent */
+ stackval *retval; /* parent */
+ void *obj; /* this - parent */
+ char *locals;
+ char *args;
+ stackval *stack_args; /* parent */
+ stackval *stack;
+ /* exception info */
+ const unsigned char *ip;
+ MonoException *ex;
+ MonoExceptionClause *ex_handler;
+};
+
+void mono_init_icall (void);
+
+void inline stackval_from_data (MonoType *type, stackval *result, char *data);
+void ves_exec_method (MonoInvocation *frame);
+
+typedef void (*MonoFunc) (void);
+typedef void (*MonoPIFunc) (MonoFunc callme, void *retval, void *obj_this, stackval *arguments);
+
+/*
+ * defined in an arch specific file.
+ */
+MonoPIFunc mono_create_trampoline (MonoMethod *method, int runtime);
+void *mono_create_method_pointer (MonoMethod *method);
+MonoMethod *mono_method_pointer_get (void *code);
diff --git a/mono/interpreter/mint.1 b/mono/interpreter/mint.1
new file mode 100644
index 00000000000..a774bf12a41
--- /dev/null
+++ b/mono/interpreter/mint.1
@@ -0,0 +1,61 @@
+.\"
+.\" mint manual page.
+.\" (C) Ximian, Inc.
+.\" Author:
+.\" Miguel de Icaza (miguel@gnu.org)
+.\"
+.TH Mono "Mono 1.0"
+.SH NAME
+mint \- Mono ECMA-CLI interpreter.
+.SH SYNOPSIS
+.PP
+.B mint
+[\-\-help] [\-\-opcode\-count] [\-\-trace]
+program.exe [arguments...]
+.SH DESCRIPTION
+The \fImint\fP program is an interpreter for ECMA CLI byte codes. It
+executes the bytecodes contains in
+.I program.exe
+and optionally passes
+the
+.I arguments
+to it.
+.SH OPTIONS
+The following Generic options are supported:
+.TP
+.I "--help", "-h"
+Displays usage instructions.
+.TP
+.I "--trace"
+Traces execution showing when methods are entered and left.
+.I "--traceops"
+Traces execution at the instruction level and displays the stack contents.
+.I "--traceclassinit"
+Shows when classes are initialized
+.TP
+.I "--profile"
+Performs runtime profiling of the code and displays statistics at the
+end of execution.
+.TP
+.I "--opcode-count"
+Displays the number of opcodes executed.
+.TP
+.I "--dieonex"
+Aborts execution upon hitting an exception.
+.TP
+.I "--debug method"
+Debugs the method whose name is `method'. You can specify the method
+like this: `class:method' or `class::method'
+.TP
+.I "--opcode-count"
+Displays the number of opcodes executed
+.PP
+.SH FILES
+Assemblies are lodaed from the installation lib directory. If you set
+`prefix' to /usr, the assemblies will be located in /usr/lib.
+.SH MAILING LISTS
+Visit http://mail.ximian.com/mailman/mono-list for details.
+.SH WEB SITE
+Visit: http://www.go-mono.com for details
+.SH SEE ALSO
+.BR mono(1), monodis(1)
diff --git a/mono/io-layer/.cvsignore b/mono/io-layer/.cvsignore
new file mode 100644
index 00000000000..cffa6011938
--- /dev/null
+++ b/mono/io-layer/.cvsignore
@@ -0,0 +1,4 @@
+.deps
+.libs
+Makefile
+Makefile.in
diff --git a/mono/io-layer/ChangeLog b/mono/io-layer/ChangeLog
new file mode 100644
index 00000000000..b28855faf8e
--- /dev/null
+++ b/mono/io-layer/ChangeLog
@@ -0,0 +1,276 @@
+
+Sat Apr 20 13:37:39 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * threads.c: destroy the mutex at thread destruction
+ (if/when thread destruction code will be actually called).
+ When protecting a tls data pointer from the gc, use also the
+ thread id in the key.
+
+Wed Apr 17 18:36:27 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * timed-thread.c: avoid race condition when setting the thread to
+ detached.
+
+2002-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * jit.h: to more #include lines to avoid breaking compilation
+ under windows when upgrading mingw and w32api to version
+ 1.3 (thanks Dick!).
+
+2002-04-16 Dick Porter <dick@ximian.com>
+
+ * atomic.h: Explanatory comment about lack of 80386 support
+
+2002-04-15 Dick Porter <dick@ximian.com>
+
+ * atomic.h: use xaddl for InterlockedIncrement() and
+ InterlockedDecrement(). Use cmpxchgl in a loop for
+ InterlockedExchange() and InterlockedExchangePointer().
+
+Mon Apr 15 13:31:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * unicode.c: fix unicode_len() to not access uninitialized memory
+ (and updated to conform to mono code style).
+
+Fri Mar 29 17:15:11 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * io.c: EEXISTS is ignored for directory creation.
+ * mono-mutex.h: remove silly "pragma }" that emacs users insert
+ because they use a broken editor:-)
+
+2002-03-28 Dick Porter <dick@ximian.com>
+
+ * sockets.h:
+ * sockets.c:
+ * io.c:
+ * handles.h:
+ * handles.c: Warning cleanups
+
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * unicode.h, unicode.c: changed to gunichar2
+ * io.h, io.c: changed strings to gunichar2*, added
+ SetFileAttributes(), GetCurrentDirectory(), SetCurrentDirectory(),
+ some fixes to FindFirstFile() and friends.
+
+2002-03-26 Dick Porter <dick@ximian.com>
+
+ * types.h: Implement the large integer struct
+
+ * timefuncs.h:
+ * timefuncs.c: Dummy functions that don't yet implement
+ QueryPerformanceCounter() and QueryPerformanceFrequency()
+
+ * threads.h:
+ * threads.c: Implement SleepEx()
+
+ * system.h:
+ * system.c: Beginnings of GetSystemInfo()
+
+ * mono-mutex.c (pthread_mutex_timedlock): Fix a ms/ns conversion
+ thinko
+
+ * context.h:
+ * context.c: Dummy function that doesnt yet implement
+ GetThreadContext()
+
+ * atomic.h:
+ * atomic.c: Interlocked functions
+
+Mon Mar 25 13:01:40 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * threads.c: use a gc-safe hash table to store tls pointers.
+
+2002-03-22 Dick Porter <dick@ximian.com>
+
+ * threads.c: Fix a race condition where a thread can start and
+ exit before the handle has been properly initialised (no reason
+ why the handle couldn't be initialised beforehand, so do so)
+
+ Fix a ms to ns conversion magnitude thinko.
+
+2002-03-21 Dick Porter <dick@ximian.com>
+
+ * semaphores.c: Fix a problem when waiting for one or more
+ semaphores, and another semaphore is Released (all waiting
+ semaphores assumed they were signalled)
+
+2002-03-29 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * io.h, io.c, uglify.h: added MoveFile, CopyFile, CreateDirectory,
+ RemoveDirectory, GetFileAttributes, GetFileAttributesEx
+
+2002-03-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * threads.c (Sleep): bug fix: 1ms == 1000000ns
+
+2002-03-19 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * io.h, io.c, events.c, mutexes.c, semaphores.c, sockets.c,
+ threads.c, io.c: added flush method to handles.
+
+ * io.c: FlushFileBuffers() and FindFirstFile() functions.
+
+Thu Mar 7 17:21:52 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * threads.c, timed-thread.c, wait.c: Boehm-GC anable.
+
+2002-02-20 Dick Porter <dick@ximian.com>
+
+ * io-layer.h: Always build without cygwin support on windows
+
+Mon Feb 18 15:50:59 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * sockets.c: #undef DEBUG.
+
+2002-02-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * io-layer.h: conditionally include sys/filio.h and sys/sockio.h
+ for FIONBIO, FIONREAD, and SIOCATMARK.
+
+2002-02-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * sockets.c: conditionally include sys/filio.h and sys/sockio.h
+ for FIONBIO, FIONREAD, and SIOCATMARK.
+
+2002-02-13 Dick Porter <dick@ximian.com>
+
+ * sockets.c: Implement shutdown and select
+
+2002-02-13 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mono-mutex.[c,h]: New source files that thinly wrap all pthread
+ functions that take pthread_mutex_t and/or pthread_mutexattr_t
+ arguments for the sake of portability. Implements recursive
+ mutexes and pthread_mutex_timedlock.
+
+ * critical-sections.c:
+ * events.c:
+ * handles.c:
+ * mutexes.c:
+ * semaphores.c:
+ * threads.c:
+ * timed-thread.c:
+ * wait.c: Use the mono-mutex wrapper portability functions/macros.
+
+ * pthread-compat.[c,h]: Replaced by mono-mutex.[c,h]
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * sockets.c: Networking support, mostly wrapping BSD socket APIs
+ with handle code, and translating errno into w32 error codes.
+
+ * macros.h: Some w32 macros used with the socket support
+
+ * error.c: Implemented GetLastError() and SetLastError()
+
+ * Makefile.am: Added sockets, with kludge to override some symbols
+
+2001-12-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * unicode.c (_wapi_unicode_to_utf8): byteswap UTF16 strings before
+ passing them to iconv
+ (_wapi_unicode_to_utf8): only swap bytes on LE systems, remove bug
+ from previous commit.
+
+2001-12-11 Dick Porter <dick@ximian.com>
+
+ * io.c: Implement DeleteFile(), GetFileTime(), SetFileTime() and
+ FileTimeToSystemTime().
+
+ * unicode.c (unicode_len): Nasty way of finding length of unicode
+ string with embedded NULLs (counts until two NULLs together).
+
+ * mutexes.c (mutex_close):
+ * events.c (event_close): Release the internal pthreads resources
+
+2001-11-26 Dick Porter <dick@ximian.com>
+
+ * critical-sections.c:
+ * events.c:
+ * handles.c:
+ * io.c:
+ * mutexes.c:
+ * semaphores.c:
+ * threads.c:
+ * timed-thread.c:
+ * wait.c: turn off DEBUG messages
+
+2001-11-22 Dick Porter <dick@ximian.com>
+
+ * handles.c (SignalObjectAndWait): Implement
+
+ * wait.c (WaitForSingleObject): Fix case where timeout == 0
+
+ * threads.c:
+ * semaphores.c:
+ * mutexes.c:
+ * io.c:
+ * events.c: Support for SignalObjectAndWait
+
+2001-11-21 Dick Porter <dick@ximian.com>
+
+ * events.c:
+ * handles.c:
+ * mutexes.c:
+ * semaphores.c:
+ * threads.c:
+ * wait.c: Reliable method of returning which handle was signalled
+ on return from WaitForMultipleObjects().
+
+2001-11-21 Dick Porter <dick@ximian.com>
+
+ * events.c: Implement events
+
+2001-11-15 Dick Porter <dick@ximian.com>
+
+ * mutexes.c: Implement mutexes
+
+ * threads.c:
+ * semaphores.c:
+ * misc.c: Factor out some common code
+
+2001-11-13 Dick Porter <dick@ximian.com>
+
+ * threads.c: Implement TLS. Implement GetCurrentThreadId(), and
+ GetCurrentThread() by maintaining a hash of thread handles.
+
+ * threads.h: Define thread and process creation flags
+
+2001-11-12 Dick Porter <dick@ximian.com>
+
+ * critical-sections.c: Implement critical sections
+
+2001-11-12 Dick Porter <dick@ximian.com>
+
+ * semaphores.c: Implement semaphores
+
+ * wait.c (wait_for_item): Maintain a wait count rather than count
+ signalled booleans.
+
+ * threads.c (thread_wait_multiple): Don't lock the wait item, that
+ will block other wait threads
+
+2001-11-11 Dick Porter <dick@ximian.com>
+
+ * Makefile.am: Rename some automake variables
+ (from Nick Drochak <ndrochak@gol.com>)
+
+2001-11-10 Dick Porter <dick@ximian.com>
+
+ * Makefile.am (libwapiincludedir): Fix include destination
+
+ * .cvsignore: Ignore generated files
+
+2001-11-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * pthread-compat.c: added some include files to make it compile on
+ linux.
+
+2001-11-08 Dick Porter <dick@ximian.com>
+
+ * Initial checkin.
+
+ This is a library emulating the win32 threading and IO API.
+
+
diff --git a/mono/io-layer/Makefile.am b/mono/io-layer/Makefile.am
new file mode 100644
index 00000000000..3cd566d17fe
--- /dev/null
+++ b/mono/io-layer/Makefile.am
@@ -0,0 +1,99 @@
+lib_LIBRARIES = libwapi.a
+
+INCLUDES = \
+ $(GLIB_CFLAGS) \
+ $(GMODULE_CFLAGS) \
+ -D_WAPI_BUILDING=1 \
+ -I$(top_srcdir)
+
+libwapiincludedir = $(includedir)/mono/io-layer
+
+OTHER_H = \
+ atomic.h \
+ context.h \
+ critical-sections.h \
+ error.h \
+ events.h \
+ handles.h \
+ io.h \
+ io-layer.h \
+ macros.h \
+ mutexes.h \
+ semaphores.h \
+ sockets.h \
+ status.h \
+ system.h \
+ threads.h \
+ timefuncs.h \
+ types.h \
+ uglify.h \
+ wait.h \
+ wapi.h
+
+OTHER_SRC = \
+ atomic.c \
+ atomic.h \
+ context.c \
+ context.h \
+ critical-sections.c \
+ critical-sections.h \
+ error.c \
+ error.h \
+ events.c \
+ events.h \
+ handles.c \
+ handles.h \
+ handles-private.h \
+ io.c \
+ io.h \
+ io-layer.h \
+ macros.h \
+ misc.c \
+ misc-private.h \
+ mutexes.c \
+ mutexes.h \
+ mono-mutex.c \
+ mono-mutex.h \
+ semaphores.c \
+ semaphores.h \
+ sockets.c \
+ sockets.h \
+ status.h \
+ system.c \
+ system.h \
+ threads.c \
+ threads.h \
+ timefuncs.c \
+ timefuncs.h \
+ timed-thread.c \
+ timed-thread.h \
+ types.h \
+ uglify.h \
+ unicode.c \
+ unicode.h \
+ wait.c \
+ wait.h \
+ wait-private.h \
+ wapi.h \
+ wapi-private.h
+
+WINDOWS_H = \
+ io-layer.h
+
+WINDOWS_SRC = \
+ io-layer.h \
+ io-layer-dummy.c
+
+if PLATFORM_WIN32
+libwapi_a_SOURCES = $(WINDOWS_SRC)
+libwapiinclude_HEADERS = $(WINDOWS_H)
+else
+libwapi_a_SOURCES = $(OTHER_SRC)
+libwapiinclude_HEADERS = $(OTHER_H)
+endif
+
+EXTRA_DIST = \
+ $(WINDOWS_SRC) \
+ $(OTHER_SRC)
+
+
diff --git a/mono/io-layer/atomic.c b/mono/io-layer/atomic.c
new file mode 100644
index 00000000000..88212deec3d
--- /dev/null
+++ b/mono/io-layer/atomic.c
@@ -0,0 +1,130 @@
+#include <config.h>
+#include <glib.h>
+#include <pthread.h>
+
+#include "mono/io-layer/wapi.h"
+
+#ifndef WAPI_ATOMIC_ASM
+#warning "Atomic functions are not atomic!"
+
+static pthread_spinlock_t spin;
+static pthread_once_t spin_once=PTHREAD_ONCE_INIT;
+
+static void spin_init(void)
+{
+ pthread_spin_init(&spin, 0);
+ g_warning("Using non-atomic functions!");
+}
+
+gint32 InterlockedCompareExchange(volatile gint32 *dest, gint32 exch,
+ gint32 comp)
+{
+ gint32 old;
+
+ pthread_once(&spin_once, spin_init);
+ pthread_spin_lock(&spin);
+
+ old= *dest;
+ if(old==comp) {
+ *dest=exch;
+ }
+
+ pthread_spin_unlock(&spin);
+
+ return(old);
+}
+
+gpointer InterlockedCompareExchangePointer(volatile gpointer *dest,
+ gpointer exch, gpointer comp)
+{
+ gpointer old;
+
+ pthread_once(&spin_once, spin_init);
+ pthread_spin_lock(&spin);
+
+ old= *dest;
+ if(old==comp) {
+ *dest=exch;
+ }
+
+ pthread_spin_unlock(&spin);
+
+ return(old);
+}
+
+gint32 InterlockedIncrement(volatile gint32 *dest)
+{
+ gint32 ret;
+
+ pthread_once(&spin_once, spin_init);
+ pthread_spin_lock(&spin);
+
+ *dest++;
+ ret= *dest;
+
+ pthread_spin_unlock(&spin);
+
+ return(ret);
+}
+
+gint32 InterlockedDecrement(volatile gint32 *dest)
+{
+ gint32 ret;
+
+ pthread_once(&spin_once, spin_init);
+ pthread_spin_lock(&spin);
+
+ *dest--;
+ ret= *dest;
+
+ pthread_spin_unlock(&spin);
+
+ return(ret);
+}
+
+gint32 InterlockedExchange(volatile gint32 *dest, gint32 exch)
+{
+ gint32 ret;
+
+ pthread_once(&spin_once, spin_init);
+ pthread_spin_lock(&spin);
+
+ ret=*dest;
+ *dest=exch;
+
+ pthread_spin_unlock(&spin);
+
+ return(ret);
+}
+
+gpointer InterlockedExchangePointer(volatile gpointer *dest, gpointer exch)
+{
+ gpointer ret;
+
+ pthread_once(&spin_once, spin_init);
+ pthread_spin_lock(&spin);
+
+ ret=*dest;
+ *dest=exch;
+
+ pthread_spin_unlock(&spin);
+
+ return(ret);
+}
+
+gint32 InterlockedExchangeAdd(volatile gint32 *dest, gint32 add)
+{
+ gint32 ret;
+
+ pthread_once(&spin_once, spin_init);
+ pthread_spin_lock(&spin);
+
+ ret= *dest;
+ *dest+=add;
+
+ pthread_spin_unlock(&spin);
+
+ return(ret);
+}
+
+#endif
diff --git a/mono/io-layer/atomic.h b/mono/io-layer/atomic.h
new file mode 100644
index 00000000000..119da422d10
--- /dev/null
+++ b/mono/io-layer/atomic.h
@@ -0,0 +1,111 @@
+#ifndef _WAPI_ATOMIC_H_
+#define _WAPI_ATOMIC_H_
+
+#include <glib.h>
+
+#include "mono/io-layer/wapi.h"
+
+#ifdef __i386__
+#define WAPI_ATOMIC_ASM
+
+/*
+ * NB: The *Pointer() functions here assume that
+ * sizeof(pointer)==sizeof(gint32)
+ *
+ * NB2: These asm functions assume 486+ (some of the opcodes dont
+ * exist on 386). If this becomes an issue, we can get configure to
+ * fall back to the non-atomic C versions of these calls.
+ */
+
+static inline gint32 InterlockedCompareExchange(volatile gint32 *dest,
+ gint32 exch, gint32 comp)
+{
+ gint32 old;
+
+ __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
+ : "=m" (*dest), "=a" (old)
+ : "r" (exch), "0" (*dest), "a" (comp));
+ return(old);
+}
+
+static inline gpointer InterlockedCompareExchangePointer(volatile gpointer *dest, gpointer exch, gpointer comp)
+{
+ gpointer old;
+
+ __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
+ : "=m" (*dest), "=a" (old)
+ : "r" (exch), "0" (*dest), "a" (comp));
+ return(old);
+}
+
+static inline gint32 InterlockedIncrement(volatile gint32 *val)
+{
+ gint32 tmp;
+
+ __asm__ __volatile__ ("lock; xaddl %0, %1"
+ : "=r" (tmp), "=m" (*val)
+ : "0" (1), "1" (*val));
+
+ return(tmp+1);
+}
+
+static inline gint32 InterlockedDecrement(volatile gint32 *val)
+{
+ gint32 tmp;
+
+ __asm__ __volatile__ ("lock; xaddl %0, %1"
+ : "=r" (tmp), "=m" (*val)
+ : "0" (-1), "1" (*val));
+
+ return(tmp-1);
+}
+
+/*
+ * See
+ * http://msdn.microsoft.com/library/en-us/dnmag00/html/win320700.asp?frame=true
+ * for the reasons for using cmpxchg and a loop here.
+ */
+static inline gint32 InterlockedExchange(volatile gint32 *val, gint32 new)
+{
+ gint32 ret;
+
+ __asm__ __volatile__ ("1:; lock; cmpxchgl %2, %0; jne 1b"
+ : "=m" (*val), "=a" (ret)
+ : "r" (new), "0" (*val), "a" (*val));
+
+ return(ret);
+}
+
+static inline gpointer InterlockedExchangePointer(volatile gpointer *val,
+ gpointer new)
+{
+ gpointer ret;
+
+ __asm__ __volatile__ ("1:; lock; cmpxchgl %2, %0; jne 1b"
+ : "=m" (*val), "=a" (ret)
+ : "r" (new), "0" (*val), "a" (*val));
+
+ return(ret);
+}
+
+static inline gint32 InterlockedExchangeAdd(volatile gint32 *val, gint32 add)
+{
+ gint32 ret;
+
+ __asm__ __volatile__ ("lock; xaddl %0, %1"
+ : "=r" (ret), "=m" (*val)
+ : "0" (add), "1" (*val));
+
+ return(ret);
+}
+#else
+extern gint32 InterlockedCompareExchange(volatile gint32 *dest, gint32 exch, gint32 comp);
+extern gpointer InterlockedCompareExchangePointer(volatile gpointer *dest, gpointer exch, gpointer comp);
+extern gint32 InterlockedIncrement(volatile gint32 *dest);
+extern gint32 InterlockedDecrement(volatile gint32 *dest);
+extern gint32 InterlockedExchange(volatile gint32 *dest, gint32 exch);
+extern gpointer InterlockedExchangePointer(volatile gpointer *dest, gpointer exch);
+extern gint32 InterlockedExchangeAdd(volatile gint32 *dest, gint32 add);
+#endif
+
+#endif /* _WAPI_ATOMIC_H_ */
diff --git a/mono/io-layer/context.c b/mono/io-layer/context.c
new file mode 100644
index 00000000000..f87a9d31512
--- /dev/null
+++ b/mono/io-layer/context.c
@@ -0,0 +1,13 @@
+#include <config.h>
+#include <glib.h>
+#include <pthread.h>
+
+#include "mono/io-layer/wapi.h"
+
+gboolean GetThreadContext(WapiHandle *handle G_GNUC_UNUSED, WapiContext *context G_GNUC_UNUSED)
+{
+ return(FALSE);
+}
+
+
+
diff --git a/mono/io-layer/context.h b/mono/io-layer/context.h
new file mode 100644
index 00000000000..456714d7dcb
--- /dev/null
+++ b/mono/io-layer/context.h
@@ -0,0 +1,77 @@
+#ifndef _WAPI_CONTEXT_H_
+#define _WAPI_CONTEXT_H_
+
+#include <glib.h>
+
+#include "mono/io-layer/wapi.h"
+
+/* This part is x86-specific. MSDN states that CONTEXT is defined
+ * also for MIPS, Alpha and PPC processors.
+ */
+
+#define SIZE_OF_80387_REGISTERS 80
+
+#define CONTEXT_i386 0x00010000
+#define CONTEXT_i486 0x00010000
+
+#define CONTEXT_CONTROL (CONTEXT_i386 | 0x00000001L)
+#define CONTEXT_INTEGER (CONTEXT_i386 | 0x00000002L)
+#define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x00000004L)
+#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x00000008L)
+#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L)
+#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x00000020L)
+
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
+
+#define MAXIMUM_SUPPORTED_EXTENSION 512
+
+typedef struct
+{
+ guint32 ControlWord;
+ guint32 StatusWord;
+ guint32 TagWord;
+ guint32 ErrorOffset;
+ guint32 ErrorSelector;
+ guint32 DataOffset;
+ guint32 DataSelector;
+ guint8 RegisterArea[SIZE_OF_80387_REGISTERS];
+ guint32 Cr0NpxState;
+} WapiFloatingSaveArea;
+
+typedef struct
+{
+ guint32 ContextFlags;
+ guint32 Dr0;
+ guint32 Dr1;
+ guint32 Dr2;
+ guint32 Dr3;
+ guint32 Dr6;
+ guint32 Dr7;
+
+ WapiFloatingSaveArea FloatSave;
+
+ guint32 SegGs;
+ guint32 SegFs;
+ guint32 SegEs;
+ guint32 SegDs;
+
+ guint32 Edi;
+ guint32 Esi;
+ guint32 Ebx;
+ guint32 Edx;
+ guint32 Ecx;
+ guint32 Eax;
+
+ guint32 Ebp;
+ guint32 Eip;
+ guint32 SegCs;
+ guint32 EFlags;
+ guint32 Esp;
+ guint32 SegSs;
+
+ guint8 ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
+} WapiContext;
+
+extern gboolean GetThreadContext(WapiHandle *handle, WapiContext *context);
+
+#endif /* _WAPI_COMPEX_H_ */
diff --git a/mono/io-layer/critical-sections.c b/mono/io-layer/critical-sections.c
new file mode 100644
index 00000000000..e21c161fb20
--- /dev/null
+++ b/mono/io-layer/critical-sections.c
@@ -0,0 +1,146 @@
+#include <config.h>
+#include <glib.h>
+#include <pthread.h>
+
+#include "mono/io-layer/wapi.h"
+
+#include "mono-mutex.h"
+
+#undef DEBUG
+
+/* A critical section is really just like a lightweight mutex. It
+ * can't be waited for, and doesn't have a handle.
+ */
+
+/* According to the MSDN docs, the Microsoft implementation spins a
+ * number of times then waits for a semaphore. I could implement that
+ * here but I'd need a mutex around the critical section structure
+ * anyway. So I may as well just use a pthread mutex.
+ */
+static pthread_once_t attr_key_once=PTHREAD_ONCE_INIT;
+static mono_mutexattr_t attr;
+
+static void attr_init(void)
+{
+ mono_mutexattr_init(&attr);
+ mono_mutexattr_settype(&attr, MONO_MUTEX_RECURSIVE);
+}
+
+/**
+ * InitializeCriticalSection:
+ * @section: The critical section to initialise
+ *
+ * Initialises a critical section.
+ */
+void InitializeCriticalSection(WapiCriticalSection *section)
+{
+ pthread_once(&attr_key_once, attr_init);
+ mono_mutex_init(&section->mutex, &attr);
+}
+
+/**
+ * InitializeCriticalSectionAndSpinCount:
+ * @section: The critical section to initialise.
+ * @spincount: The spin count for this critical section. Not
+ * currently used.
+ *
+ * Initialises a critical section and sets the spin count. This
+ * implementation just calls InitializeCriticalSection().
+ *
+ * Return value: %TRUE on success, %FALSE otherwise. (%FALSE never
+ * happens).
+ */
+gboolean InitializeCriticalSectionAndSpinCount(WapiCriticalSection *section,
+ guint32 spincount G_GNUC_UNUSED)
+{
+ InitializeCriticalSection(section);
+
+ return(TRUE);
+}
+
+/**
+ * DeleteCriticalSection:
+ * @section: The critical section to delete.
+ *
+ * Releases all resources owned by critical section @section.
+ */
+void DeleteCriticalSection(WapiCriticalSection *section)
+{
+ mono_mutex_destroy(&section->mutex);
+}
+
+/**
+ * SetCriticalSectionSpinCount:
+ * @section: The critical section to set
+ * @spincount: The new spin count for this critical section. Not
+ * currently used.
+ *
+ * Sets the spin count for the critical section @section. The spin
+ * count is currently ignored, and set to zero.
+ *
+ * Return value: The previous spin count. (Currently always zero).
+ */
+guint32 SetCriticalSectionSpinCount(WapiCriticalSection *section G_GNUC_UNUSED, guint32 spincount G_GNUC_UNUSED)
+{
+ return(0);
+}
+
+/**
+ * TryEnterCriticalSection:
+ * @section: The critical section to try and enter
+ *
+ * Attempts to enter a critical section without blocking. If
+ * successful the calling thread takes ownership of the critical
+ * section.
+ *
+ * A thread can recursively call EnterCriticalSection() and
+ * TryEnterCriticalSection(), but must call LeaveCriticalSection() an
+ * equal number of times.
+ *
+ * Return value: %TRUE if the thread successfully locked the critical
+ * section, %FALSE otherwise.
+ */
+gboolean TryEnterCriticalSection(WapiCriticalSection *section)
+{
+ int ret;
+
+ ret=mono_mutex_trylock(&section->mutex);
+ if(ret==0) {
+ return(TRUE);
+ } else {
+ return(FALSE);
+ }
+}
+
+/**
+ * EnterCriticalSection:
+ * @section: The critical section to enter
+ *
+ * Enters critical section @section, blocking while other threads own
+ * it. This function doesn't return until the calling thread assumes
+ * ownership of @section.
+ *
+ * A thread can recursively call EnterCriticalSection() and
+ * TryEnterCriticalSection(), but must call LeaveCriticalSection() an
+ * equal number of times.
+ */
+void EnterCriticalSection(WapiCriticalSection *section)
+{
+ mono_mutex_lock(&section->mutex);
+}
+
+/**
+ * LeaveCriticalSection:
+ * @section: The critical section to leave
+ *
+ * Leaves critical section @section, relinquishing ownership.
+ *
+ * A thread can recursively call EnterCriticalSection() and
+ * TryEnterCriticalSection(), but must call LeaveCriticalSection() an
+ * equal number of times.
+ */
+void LeaveCriticalSection(WapiCriticalSection *section)
+{
+ mono_mutex_unlock(&section->mutex);
+}
+
diff --git a/mono/io-layer/critical-sections.h b/mono/io-layer/critical-sections.h
new file mode 100644
index 00000000000..b9fdfd5abb8
--- /dev/null
+++ b/mono/io-layer/critical-sections.h
@@ -0,0 +1,27 @@
+#ifndef _WAPI_CRITICAL_SECTIONS_H_
+#define _WAPI_CRITICAL_SECTIONS_H_
+
+#include <config.h>
+
+#include <glib.h>
+#include <pthread.h>
+
+#include "mono-mutex.h"
+
+typedef struct _WapiCriticalSection WapiCriticalSection;
+
+struct _WapiCriticalSection
+{
+ guint32 depth;
+ mono_mutex_t mutex;
+};
+
+extern void InitializeCriticalSection(WapiCriticalSection *section);
+extern gboolean InitializeCriticalSectionAndSpinCount(WapiCriticalSection *section, guint32 spincount);
+extern void DeleteCriticalSection(WapiCriticalSection *section);
+extern guint32 SetCriticalSectionSpinCount(WapiCriticalSection *section, guint32 spincount);
+extern gboolean TryEnterCriticalSection(WapiCriticalSection *section);
+extern void EnterCriticalSection(WapiCriticalSection *section);
+extern void LeaveCriticalSection(WapiCriticalSection *section);
+
+#endif /* _WAPI_CRITICAL_SECTIONS_H_ */
diff --git a/mono/io-layer/error.c b/mono/io-layer/error.c
new file mode 100644
index 00000000000..462df564016
--- /dev/null
+++ b/mono/io-layer/error.c
@@ -0,0 +1,46 @@
+#include <config.h>
+#include <glib.h>
+#include <pthread.h>
+
+#include "mono/io-layer/wapi.h"
+
+static pthread_key_t error_key;
+static pthread_once_t error_key_once=PTHREAD_ONCE_INIT;
+
+static void error_init(void)
+{
+ pthread_key_create(&error_key, NULL);
+}
+
+/**
+ * GetLastError:
+ *
+ * Retrieves the last error that occurred in the calling thread.
+ *
+ * Return value: The error code for the last error that happened on
+ * the calling thread.
+ */
+guint32 GetLastError(void)
+{
+ guint32 err;
+ void *errptr;
+
+ pthread_once(&error_key_once, error_init);
+ errptr=pthread_getspecific(error_key);
+ err=GPOINTER_TO_UINT(errptr);
+
+ return(err);
+}
+
+/**
+ * SetLastError:
+ * @code: The error code.
+ *
+ * Sets the error code in the calling thread.
+ */
+void SetLastError(guint32 code)
+{
+ /* Set the thread-local error code */
+ pthread_once(&error_key_once, error_init);
+ pthread_setspecific(error_key, GUINT_TO_POINTER(code));
+}
diff --git a/mono/io-layer/error.h b/mono/io-layer/error.h
new file mode 100644
index 00000000000..f900a7172a3
--- /dev/null
+++ b/mono/io-layer/error.h
@@ -0,0 +1,1792 @@
+#ifndef _WAPI_ERROR_H_
+#define _WAPI_ERROR_H_
+
+typedef enum {
+ ERROR_SUCCESS = 0,
+ ERROR_INVALID_FUNCTION = 1,
+ ERROR_FILE_NOT_FOUND = 2,
+ ERROR_PATH_NOT_FOUND = 3,
+ ERROR_TOO_MANY_OPEN_FILES = 4,
+ ERROR_ACCESS_DENIED = 5,
+ ERROR_INVALID_HANDLE = 6,
+ ERROR_ARENA_TRASHED = 7,
+ ERROR_NOT_ENOUGH_MEMORY = 8,
+ ERROR_INVALID_BLOCK = 9,
+ ERROR_BAD_ENVIRONMENT = 10,
+ ERROR_BAD_FORMAT = 11,
+ ERROR_INVALID_ACCESS = 12,
+ ERROR_INVALID_DATA = 13,
+ ERROR_OUTOFMEMORY = 14,
+ ERROR_INVALID_DRIVE = 15,
+ ERROR_CURRENT_DIRECTORY = 16,
+ ERROR_NOT_SAME_DEVICE = 17,
+ ERROR_NO_MORE_FILES = 18,
+ ERROR_WRITE_PROTECT = 19,
+ ERROR_BAD_UNIT = 20,
+ ERROR_NOT_READY = 21,
+ ERROR_BAD_COMMAND = 22,
+ ERROR_CRC = 23,
+ ERROR_BAD_LENGTH = 24,
+ ERROR_SEEK = 25,
+ ERROR_NOT_DOS_DISK = 26,
+ ERROR_SECTOR_NOT_FOUND = 27,
+ ERROR_OUT_OF_PAPER = 28,
+ ERROR_WRITE_FAULT = 29,
+ ERROR_READ_FAULT = 30,
+ ERROR_GEN_FAILURE = 31,
+ ERROR_SHARING_VIOLATION = 32,
+ ERROR_LOCK_VIOLATION = 33,
+ ERROR_WRONG_DISK = 34,
+ ERROR_SHARING_BUFFER_EXCEEDED = 36,
+ ERROR_HANDLE_EOF = 38,
+ ERROR_HANDLE_DISK_FULL = 39,
+ ERROR_NOT_SUPPORTED = 50,
+ ERROR_REM_NOT_LIST = 51,
+ ERROR_DUP_NAME = 52,
+ ERROR_BAD_NETPATH = 53,
+ ERROR_NETWORK_BUSY = 54,
+ ERROR_DEV_NOT_EXIST = 55,
+ ERROR_TOO_MANY_CMDS = 56,
+ ERROR_ADAP_HDW_ERR = 57,
+ ERROR_BAD_NET_RESP = 58,
+ ERROR_UNEXP_NET_ERR = 59,
+ ERROR_BAD_REM_ADAP = 60,
+ ERROR_PRINTQ_FULL = 61,
+ ERROR_NO_SPOOL_SPACE = 62,
+ ERROR_PRINT_CANCELLED = 63,
+ ERROR_NETNAME_DELETED = 64,
+ ERROR_NETWORK_ACCESS_DENIED = 65,
+ ERROR_BAD_DEV_TYPE = 66,
+ ERROR_BAD_NET_NAME = 67,
+ ERROR_TOO_MANY_NAMES = 68,
+ ERROR_TOO_MANY_SESS = 69,
+ ERROR_SHARING_PAUSED = 70,
+ ERROR_REQ_NOT_ACCEP = 71,
+ ERROR_REDIR_PAUSED = 72,
+ ERROR_FILE_EXISTS = 80,
+ ERROR_CANNOT_MAKE = 82,
+ ERROR_FAIL_I24 = 83,
+ ERROR_OUT_OF_STRUCTURES = 84,
+ ERROR_ALREADY_ASSIGNED = 85,
+ ERROR_INVALID_PASSWORD = 86,
+ ERROR_INVALID_PARAMETER = 87,
+ ERROR_NET_WRITE_FAULT = 88,
+ ERROR_NO_PROC_SLOTS = 89,
+ ERROR_TOO_MANY_SEMAPHORES = 100,
+ ERROR_EXCL_SEM_ALREADY_OWNED = 101,
+ ERROR_SEM_IS_SET = 102,
+ ERROR_TOO_MANY_SEM_REQUESTS = 103,
+ ERROR_INVALID_AT_INTERRUPT_TIME = 104,
+ ERROR_SEM_OWNER_DIED = 105,
+ ERROR_SEM_USER_LIMIT = 106,
+ ERROR_DISK_CHANGE = 107,
+ ERROR_DRIVE_LOCKED = 108,
+ ERROR_BROKEN_PIPE = 109,
+ ERROR_OPEN_FAILED = 110,
+ ERROR_BUFFER_OVERFLOW = 111,
+ ERROR_DISK_FULL = 112,
+ ERROR_NO_MORE_SEARCH_HANDLES = 113,
+ ERROR_INVALID_TARGET_HANDLE = 114,
+ ERROR_INVALID_CATEGORY = 117,
+ ERROR_INVALID_VERIFY_SWITCH = 118,
+ ERROR_BAD_DRIVER_LEVEL = 119,
+ ERROR_CALL_NOT_IMPLEMENTED = 120,
+ ERROR_SEM_TIMEOUT = 121,
+ ERROR_INSUFFICIENT_BUFFER = 122,
+ ERROR_INVALID_NAME = 123,
+ ERROR_INVALID_LEVEL = 124,
+ ERROR_NO_VOLUME_LABEL = 125,
+ ERROR_MOD_NOT_FOUND = 126,
+ ERROR_PROC_NOT_FOUND = 127,
+ ERROR_WAIT_NO_CHILDREN = 128,
+ ERROR_CHILD_NOT_COMPLETE = 129,
+ ERROR_DIRECT_ACCESS_HANDLE = 130,
+ ERROR_NEGATIVE_SEEK = 131,
+ ERROR_SEEK_ON_DEVICE = 132,
+ ERROR_IS_JOIN_TARGET = 133,
+ ERROR_IS_JOINED = 134,
+ ERROR_IS_SUBSTED = 135,
+ ERROR_NOT_JOINED = 136,
+ ERROR_NOT_SUBSTED = 137,
+ ERROR_JOIN_TO_JOIN = 138,
+ ERROR_SUBST_TO_SUBST = 139,
+ ERROR_JOIN_TO_SUBST = 140,
+ ERROR_SUBST_TO_JOIN = 141,
+ ERROR_BUSY_DRIVE = 142,
+ ERROR_SAME_DRIVE = 143,
+ ERROR_DIR_NOT_ROOT = 144,
+ ERROR_DIR_NOT_EMPTY = 145,
+ ERROR_IS_SUBST_PATH = 146,
+ ERROR_IS_JOIN_PATH = 147,
+ ERROR_PATH_BUSY = 148,
+ ERROR_IS_SUBST_TARGET = 149,
+ ERROR_SYSTEM_TRACE = 150,
+ ERROR_INVALID_EVENT_COUNT = 151,
+ ERROR_TOO_MANY_MUXWAITERS = 152,
+ ERROR_INVALID_LIST_FORMAT = 153,
+ ERROR_LABEL_TOO_LONG = 154,
+ ERROR_TOO_MANY_TCBS = 155,
+ ERROR_SIGNAL_REFUSED = 156,
+ ERROR_DISCARDED = 157,
+ ERROR_NOT_LOCKED = 158,
+ ERROR_BAD_THREADID_ADDR = 159,
+ ERROR_BAD_ARGUMENTS = 160,
+ ERROR_BAD_PATHNAME = 161,
+ ERROR_SIGNAL_PENDING = 162,
+ ERROR_MAX_THRDS_REACHED = 164,
+ ERROR_LOCK_FAILED = 167,
+ ERROR_BUSY = 170,
+ ERROR_CANCEL_VIOLATION = 173,
+ ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174,
+ ERROR_INVALID_SEGMENT_NUMBER = 180,
+ ERROR_INVALID_ORDINAL = 182,
+ ERROR_ALREADY_EXISTS = 183,
+ ERROR_INVALID_FLAG_NUMBER = 186,
+ ERROR_SEM_NOT_FOUND = 187,
+ ERROR_INVALID_STARTING_CODESEG = 188,
+ ERROR_INVALID_STACKSEG = 189,
+ ERROR_INVALID_MODULETYPE = 190,
+ ERROR_INVALID_EXE_SIGNATURE = 191,
+ ERROR_EXE_MARKED_INVALID = 192,
+ ERROR_BAD_EXE_FORMAT = 193,
+ ERROR_ITERATED_DATA_EXCEEDS_64k = 194,
+ ERROR_INVALID_MINALLOCSIZE = 195,
+ ERROR_DYNLINK_FROM_INVALID_RING = 196,
+ ERROR_IOPL_NOT_ENABLED = 197,
+ ERROR_INVALID_SEGDPL = 198,
+ ERROR_AUTODATASEG_EXCEEDS_64k = 199,
+ ERROR_RING2SEG_MUST_BE_MOVABLE = 200,
+ ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201,
+ ERROR_INFLOOP_IN_RELOC_CHAIN = 202,
+ ERROR_ENVVAR_NOT_FOUND = 203,
+ ERROR_NO_SIGNAL_SENT = 205,
+ ERROR_FILENAME_EXCED_RANGE = 206,
+ ERROR_RING2_STACK_IN_USE = 207,
+ ERROR_META_EXPANSION_TOO_LONG = 208,
+ ERROR_INVALID_SIGNAL_NUMBER = 209,
+ ERROR_THREAD_1_INACTIVE = 210,
+ ERROR_LOCKED = 212,
+ ERROR_TOO_MANY_MODULES = 214,
+ ERROR_NESTING_NOT_ALLOWED = 215,
+ ERROR_EXE_MACHINE_TYPE_MISMATCH = 216,
+ ERROR_BAD_PIPE = 230,
+ ERROR_PIPE_BUSY = 231,
+ ERROR_NO_DATA = 232,
+ ERROR_PIPE_NOT_CONNECTED = 233,
+ ERROR_MORE_DATA = 234,
+ ERROR_VC_DISCONNECTED = 240,
+ ERROR_INVALID_EA_NAME = 254,
+ ERROR_EA_LIST_INCONSISTENT = 255,
+ WAIT_TIMEOUT = 258,
+ ERROR_NO_MORE_ITEMS = 259,
+ ERROR_CANNOT_COPY = 266,
+ ERROR_DIRECTORY = 267,
+ ERROR_EAS_DIDNT_FIT = 275,
+ ERROR_EA_FILE_CORRUPT = 276,
+ ERROR_EA_TABLE_FULL = 277,
+ ERROR_INVALID_EA_HANDLE = 278,
+ ERROR_EAS_NOT_SUPPORTED = 282,
+ ERROR_NOT_OWNER = 288,
+ ERROR_TOO_MANY_POSTS = 298,
+ ERROR_PARTIAL_COPY = 299,
+ ERROR_OPLOCK_NOT_GRANTED = 300,
+ ERROR_INVALID_OPLOCK_PROTOCOL = 301,
+ ERROR_DISK_TOO_FRAGMENTED = 302,
+ ERROR_DELETE_PENDING = 303,
+ ERROR_MR_MID_NOT_FOUND = 317,
+ ERROR_INVALID_ADDRESS = 487,
+ ERROR_ARITHMETIC_OVERFLOW = 534,
+ ERROR_PIPE_CONNECTED = 535,
+ ERROR_PIPE_LISTENING = 536,
+ ERROR_EA_ACCESS_DENIED = 994,
+ ERROR_OPERATION_ABORTED = 995,
+ ERROR_IO_INCOMPLETE = 996,
+ ERROR_IO_PENDING = 997,
+ ERROR_NOACCESS = 998,
+ ERROR_SWAPERROR = 999,
+ ERROR_STACK_OVERFLOW = 1001,
+ ERROR_INVALID_MESSAGE = 1002,
+ ERROR_CAN_NOT_COMPLETE = 1003,
+ ERROR_INVALID_FLAGS = 1004,
+ ERROR_UNRECOGNIZED_VOLUME = 1005,
+ ERROR_FILE_INVALID = 1006,
+ ERROR_FULLSCREEN_MODE = 1007,
+ ERROR_NO_TOKEN = 1008,
+ ERROR_BADDB = 1009,
+ ERROR_BADKEY = 1010,
+ ERROR_CANTOPEN = 1011,
+ ERROR_CANTREAD = 1012,
+ ERROR_CANTWRITE = 1013,
+ ERROR_REGISTRY_RECOVERED = 1014,
+ ERROR_REGISTRY_CORRUPT = 1015,
+ ERROR_REGISTRY_IO_FAILED = 1016,
+ ERROR_NOT_REGISTRY_FILE = 1017,
+ ERROR_KEY_DELETED = 1018,
+ ERROR_NO_LOG_SPACE = 1019,
+ ERROR_KEY_HAS_CHILDREN = 1020,
+ ERROR_CHILD_MUST_BE_VOLATILE = 1021,
+ ERROR_NOTIFY_ENUM_DIR = 1022,
+ ERROR_DEPENDENT_SERVICES_RUNNING = 1051,
+ ERROR_INVALID_SERVICE_CONTROL = 1052,
+ ERROR_SERVICE_REQUEST_TIMEOUT = 1053,
+ ERROR_SERVICE_NO_THREAD = 1054,
+ ERROR_SERVICE_DATABASE_LOCKED = 1055,
+ ERROR_SERVICE_ALREADY_RUNNING = 1056,
+ ERROR_INVALID_SERVICE_ACCOUNT = 1057,
+ ERROR_SERVICE_DISABLED = 1058,
+ ERROR_CIRCULAR_DEPENDENCY = 1059,
+ ERROR_SERVICE_DOES_NOT_EXIST = 1060,
+ ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061,
+ ERROR_SERVICE_NOT_ACTIVE = 1062,
+ ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063,
+ ERROR_EXCEPTION_IN_SERVICE = 1064,
+ ERROR_DATABASE_DOES_NOT_EXIST = 1065,
+ ERROR_SERVICE_SPECIFIC_ERROR = 1066,
+ ERROR_PROCESS_ABORTED = 1067,
+ ERROR_SERVICE_DEPENDENCY_FAIL = 1068,
+ ERROR_SERVICE_LOGON_FAILED = 1069,
+ ERROR_SERVICE_START_HANG = 1070,
+ ERROR_INVALID_SERVICE_LOCK = 1071,
+ ERROR_SERVICE_MARKED_FOR_DELETE = 1072,
+ ERROR_SERVICE_EXISTS = 1073,
+ ERROR_ALREADY_RUNNING_LKG = 1074,
+ ERROR_SERVICE_DEPENDENCY_DELETED = 1075,
+ ERROR_BOOT_ALREADY_ACCEPTED = 1076,
+ ERROR_SERVICE_NEVER_STARTED = 1077,
+ ERROR_DUPLICATE_SERVICE_NAME = 1078,
+ ERROR_DIFFERENT_SERVICE_ACCOUNT = 1079,
+ ERROR_CANNOT_DETECT_DRIVER_FAILURE = 1080,
+ ERROR_CANNOT_DETECT_PROCESS_ABORT = 1081,
+ ERROR_NO_RECOVERY_PROGRAM = 1082,
+ ERROR_SERVICE_NOT_IN_EXE = 1083,
+ ERROR_NOT_SAFEBOOT_SERVICE = 1084,
+ ERROR_END_OF_MEDIA = 1100,
+ ERROR_FILEMARK_DETECTED = 1101,
+ ERROR_BEGINNING_OF_MEDIA = 1102,
+ ERROR_SETMARK_DETECTED = 1103,
+ ERROR_NO_DATA_DETECTED = 1104,
+ ERROR_PARTITION_FAILURE = 1105,
+ ERROR_INVALID_BLOCK_LENGTH = 1106,
+ ERROR_DEVICE_NOT_PARTITIONED = 1107,
+ ERROR_UNABLE_TO_LOCK_MEDIA = 1108,
+ ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109,
+ ERROR_MEDIA_CHANGED = 1110,
+ ERROR_BUS_RESET = 1111,
+ ERROR_NO_MEDIA_IN_DRIVE = 1112,
+ ERROR_NO_UNICODE_TRANSLATION = 1113,
+ ERROR_DLL_INIT_FAILED = 1114,
+ ERROR_SHUTDOWN_IN_PROGRESS = 1115,
+ ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116,
+ ERROR_IO_DEVICE = 1117,
+ ERROR_SERIAL_NO_DEVICE = 1118,
+ ERROR_IRQ_BUSY = 1119,
+ ERROR_MORE_WRITES = 1120,
+ ERROR_COUNTER_TIMEOUT = 1121,
+ ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122,
+ ERROR_FLOPPY_WRONG_CYLINDER = 1123,
+ ERROR_FLOPPY_UNKNOWN_ERROR = 1124,
+ ERROR_FLOPPY_BAD_REGISTERS = 1125,
+ ERROR_DISK_RECALIBRATE_FAILED = 1126,
+ ERROR_DISK_OPERATION_FAILED = 1127,
+ ERROR_DISK_RESET_FAILED = 1128,
+ ERROR_EOM_OVERFLOW = 1129,
+ ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130,
+ ERROR_POSSIBLE_DEADLOCK = 1131,
+ ERROR_MAPPED_ALIGNMENT = 1132,
+ ERROR_SET_POWER_STATE_VETOED = 1140,
+ ERROR_SET_POWER_STATE_FAILED = 1141,
+ ERROR_TOO_MANY_LINKS = 1142,
+ ERROR_OLD_WIN_VERSION = 1150,
+ ERROR_APP_WRONG_OS = 1151,
+ ERROR_SINGLE_INSTANCE_APP = 1152,
+ ERROR_RMODE_APP = 1153,
+ ERROR_INVALID_DLL = 1154,
+ ERROR_NO_ASSOCIATION = 1155,
+ ERROR_DDE_FAIL = 1156,
+ ERROR_DLL_NOT_FOUND = 1157,
+ ERROR_NO_MORE_USER_HANDLES = 1158,
+ ERROR_MESSAGE_SYNC_ONLY = 1159,
+ ERROR_SOURCE_ELEMENT_EMPTY = 1160,
+ ERROR_DESTINATION_ELEMENT_FULL = 1161,
+ ERROR_ILLEGAL_ELEMENT_ADDRESS = 1162,
+ ERROR_MAGAZINE_NOT_PRESENT = 1163,
+ ERROR_DEVICE_REINITIALIZATION_NEEDED = 1164,
+ ERROR_DEVICE_REQUIRES_CLEANING = 1165,
+ ERROR_DEVICE_DOOR_OPEN = 1166,
+ ERROR_DEVICE_NOT_CONNECTED = 1167,
+ ERROR_NOT_FOUND = 1168,
+ ERROR_NO_MATCH = 1169,
+ ERROR_SET_NOT_FOUND = 1170,
+ ERROR_POINT_NOT_FOUND = 1171,
+ ERROR_NO_TRACKING_SERVICE = 1172,
+ ERROR_NO_VOLUME_ID = 1173,
+ ERROR_UNABLE_TO_REMOVE_REPLACED = 1175,
+ ERROR_UNABLE_TO_MOVE_REPLACEMENT = 1176,
+ ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 = 1177,
+ ERROR_JOURNAL_DELETE_IN_PROGRESS = 1178,
+ ERROR_JOURNAL_NOT_ACTIVE = 1179,
+ ERROR_POTENTIAL_FILE_FOUND = 1180,
+ ERROR_JOURNAL_ENTRY_DELETED = 1181,
+ ERROR_BAD_DEVICE = 1200,
+ ERROR_CONNECTION_UNAVAIL = 1201,
+ ERROR_DEVICE_ALREADY_REMEMBERED = 1202,
+ ERROR_NO_NET_OR_BAD_PATH = 1203,
+ ERROR_BAD_PROVIDER = 1204,
+ ERROR_CANNOT_OPEN_PROFILE = 1205,
+ ERROR_BAD_PROFILE = 1206,
+ ERROR_NOT_CONTAINER = 1207,
+ ERROR_EXTENDED_ERROR = 1208,
+ ERROR_INVALID_GROUPNAME = 1209,
+ ERROR_INVALID_COMPUTERNAME = 1210,
+ ERROR_INVALID_EVENTNAME = 1211,
+ ERROR_INVALID_DOMAINNAME = 1212,
+ ERROR_INVALID_SERVICENAME = 1213,
+ ERROR_INVALID_NETNAME = 1214,
+ ERROR_INVALID_SHARENAME = 1215,
+ ERROR_INVALID_PASSWORDNAME = 1216,
+ ERROR_INVALID_MESSAGENAME = 1217,
+ ERROR_INVALID_MESSAGEDEST = 1218,
+ ERROR_SESSION_CREDENTIAL_CONFLICT = 1219,
+ ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220,
+ ERROR_DUP_DOMAINNAME = 1221,
+ ERROR_NO_NETWORK = 1222,
+ ERROR_CANCELLED = 1223,
+ ERROR_USER_MAPPED_FILE = 1224,
+ ERROR_CONNECTION_REFUSED = 1225,
+ ERROR_GRACEFUL_DISCONNECT = 1226,
+ ERROR_ADDRESS_ALREADY_ASSOCIATED = 1227,
+ ERROR_ADDRESS_NOT_ASSOCIATED = 1228,
+ ERROR_CONNECTION_INVALID = 1229,
+ ERROR_CONNECTION_ACTIVE = 1230,
+ ERROR_NETWORK_UNREACHABLE = 1231,
+ ERROR_HOST_UNREACHABLE = 1232,
+ ERROR_PROTOCOL_UNREACHABLE = 1233,
+ ERROR_PORT_UNREACHABLE = 1234,
+ ERROR_REQUEST_ABORTED = 1235,
+ ERROR_CONNECTION_ABORTED = 1236,
+ ERROR_RETRY = 1237,
+ ERROR_CONNECTION_COUNT_LIMIT = 1238,
+ ERROR_LOGIN_TIME_RESTRICTION = 1239,
+ ERROR_LOGIN_WKSTA_RESTRICTION = 1240,
+ ERROR_INCORRECT_ADDRESS = 1241,
+ ERROR_ALREADY_REGISTERED = 1242,
+ ERROR_SERVICE_NOT_FOUND = 1243,
+ ERROR_NOT_AUTHENTICATED = 1244,
+ ERROR_NOT_LOGGED_ON = 1245,
+ ERROR_CONTINUE = 1246,
+ ERROR_ALREADY_INITIALIZED = 1247,
+ ERROR_NO_MORE_DEVICES = 1248,
+ ERROR_NO_SUCH_SITE = 1249,
+ ERROR_DOMAIN_CONTROLLER_EXISTS = 1250,
+ ERROR_ONLY_IF_CONNECTED = 1251,
+ ERROR_OVERRIDE_NOCHANGES = 1252,
+ ERROR_BAD_USER_PROFILE = 1253,
+ ERROR_NOT_SUPPORTED_ON_SBS = 1254,
+ ERROR_SERVER_SHUTDOWN_IN_PROGRESS = 1255,
+ ERROR_HOST_DOWN = 1256,
+ ERROR_NON_ACCOUNT_SID = 1257,
+ ERROR_NON_DOMAIN_SID = 1258,
+ ERROR_APPHELP_BLOCK = 1259,
+ ERROR_ACCESS_DISABLED_BY_POLICY = 1260,
+ ERROR_REG_NAT_CONSUMPTION = 1261,
+ ERROR_CSCSHARE_OFFLINE = 1262,
+ ERROR_PKINIT_FAILURE = 1263,
+ ERROR_SMARTCARD_SUBSYSTEM_FAILURE = 1264,
+ ERROR_DOWNGRADE_DETECTED = 1265,
+ SEC_E_SMARTCARD_CERT_REVOKED = 1266,
+ SEC_E_ISSUING_CA_UNTRUSTED = 1267,
+ SEC_E_REVOCATION_OFFLINE_C = 1268,
+ SEC_E_PKINIT_CLIENT_FAILUR = 1269,
+ SEC_E_SMARTCARD_CERT_EXPIRED = 1270,
+ ERROR_MACHINE_LOCKED = 1271,
+ ERROR_CALLBACK_SUPPLIED_INVALID_DATA = 1273,
+ ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED = 1274,
+ ERROR_DRIVER_BLOCKED = 1275,
+ ERROR_INVALID_IMPORT_OF_NON_DLL = 1276,
+ ERROR_NOT_ALL_ASSIGNED = 1300,
+ ERROR_SOME_NOT_MAPPED = 1301,
+ ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302,
+ ERROR_LOCAL_USER_SESSION_KEY = 1303,
+ ERROR_NULL_LM_PASSWORD = 1304,
+ ERROR_UNKNOWN_REVISION = 1305,
+ ERROR_REVISION_MISMATCH = 1306,
+ ERROR_INVALID_OWNER = 1307,
+ ERROR_INVALID_PRIMARY_GROUP = 1308,
+ ERROR_NO_IMPERSONATION_TOKEN = 1309,
+ ERROR_CANT_DISABLE_MANDATORY = 1310,
+ ERROR_NO_LOGON_SERVERS = 1311,
+ ERROR_NO_SUCH_LOGON_SESSION = 1312,
+ ERROR_NO_SUCH_PRIVILEGE = 1313,
+ ERROR_PRIVILEGE_NOT_HELD = 1314,
+ ERROR_INVALID_ACCOUNT_NAME = 1315,
+ ERROR_USER_EXISTS = 1316,
+ ERROR_NO_SUCH_USER = 1317,
+ ERROR_GROUP_EXISTS = 1318,
+ ERROR_NO_SUCH_GROUP = 1319,
+ ERROR_MEMBER_IN_GROUP = 1320,
+ ERROR_MEMBER_NOT_IN_GROUP = 1321,
+ ERROR_LAST_ADMIN = 1322,
+ ERROR_WRONG_PASSWORD = 1323,
+ ERROR_ILL_FORMED_PASSWORD = 1324,
+ ERROR_PASSWORD_RESTRICTION = 1325,
+ ERROR_LOGON_FAILURE = 1326,
+ ERROR_ACCOUNT_RESTRICTION = 1327,
+ ERROR_INVALID_LOGON_HOURS = 1328,
+ ERROR_INVALID_WORKSTATION = 1329,
+ ERROR_PASSWORD_EXPIRED = 1330,
+ ERROR_ACCOUNT_DISABLED = 1331,
+ ERROR_NONE_MAPPED = 1332,
+ ERROR_TOO_MANY_LUIDS_REQUESTED = 1333,
+ ERROR_LUIDS_EXHAUSTED = 1334,
+ ERROR_INVALID_SUB_AUTHORITY = 1335,
+ ERROR_INVALID_ACL = 1336,
+ ERROR_INVALID_SID = 1337,
+ ERROR_INVALID_SECURITY_DESCR = 1338,
+ ERROR_BAD_INHERITANCE_ACL = 1340,
+ ERROR_SERVER_DISABLED = 1341,
+ ERROR_SERVER_NOT_DISABLED = 1342,
+ ERROR_INVALID_ID_AUTHORITY = 1343,
+ ERROR_ALLOTTED_SPACE_EXCEEDED = 1344,
+ ERROR_INVALID_GROUP_ATTRIBUTES = 1345,
+ ERROR_BAD_IMPERSONATION_LEVEL = 1346,
+ ERROR_CANT_OPEN_ANONYMOUS = 1347,
+ ERROR_BAD_VALIDATION_CLASS = 1348,
+ ERROR_BAD_TOKEN_TYPE = 1349,
+ ERROR_NO_SECURITY_ON_OBJECT = 1350,
+ ERROR_CANT_ACCESS_DOMAIN_INFO = 1351,
+ ERROR_INVALID_SERVER_STATE = 1352,
+ ERROR_INVALID_DOMAIN_STATE = 1353,
+ ERROR_INVALID_DOMAIN_ROLE = 1354,
+ ERROR_NO_SUCH_DOMAIN = 1355,
+ ERROR_DOMAIN_EXISTS = 1356,
+ ERROR_DOMAIN_LIMIT_EXCEEDED = 1357,
+ ERROR_INTERNAL_DB_CORRUPTION = 1358,
+ ERROR_INTERNAL_ERROR = 1359,
+ ERROR_GENERIC_NOT_MAPPED = 1360,
+ ERROR_BAD_DESCRIPTOR_FORMAT = 1361,
+ ERROR_NOT_LOGON_PROCESS = 1362,
+ ERROR_LOGON_SESSION_EXISTS = 1363,
+ ERROR_NO_SUCH_PACKAGE = 1364,
+ ERROR_BAD_LOGON_SESSION_STATE = 1365,
+ ERROR_LOGON_SESSION_COLLISION = 1366,
+ ERROR_INVALID_LOGON_TYPE = 1367,
+ ERROR_CANNOT_IMPERSONATE = 1368,
+ ERROR_RXACT_INVALID_STATE = 1369,
+ ERROR_RXACT_COMMIT_FAILURE = 1370,
+ ERROR_SPECIAL_ACCOUNT = 1371,
+ ERROR_SPECIAL_GROUP = 1372,
+ ERROR_SPECIAL_USER = 1373,
+ ERROR_MEMBERS_PRIMARY_GROUP = 1374,
+ ERROR_TOKEN_ALREADY_IN_USE = 1375,
+ ERROR_NO_SUCH_ALIAS = 1376,
+ ERROR_MEMBER_NOT_IN_ALIAS = 1377,
+ ERROR_MEMBER_IN_ALIAS = 1378,
+ ERROR_ALIAS_EXISTS = 1379,
+ ERROR_LOGON_NOT_GRANTED = 1380,
+ ERROR_TOO_MANY_SECRETS = 1381,
+ ERROR_SECRET_TOO_LONG = 1382,
+ ERROR_INTERNAL_DB_ERROR = 1383,
+ ERROR_TOO_MANY_CONTEXT_IDS = 1384,
+ ERROR_LOGON_TYPE_NOT_GRANTED = 1385,
+ ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386,
+ ERROR_NO_SUCH_MEMBER = 1387,
+ ERROR_INVALID_MEMBER = 1388,
+ ERROR_TOO_MANY_SIDS = 1389,
+ ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390,
+ ERROR_NO_INHERITANCE = 1391,
+ ERROR_FILE_CORRUPT = 1392,
+ ERROR_DISK_CORRUPT = 1393,
+ ERROR_NO_USER_SESSION_KEY = 1394,
+ ERROR_LICENSE_QUOTA_EXCEEDED = 1395,
+ ERROR_WRONG_TARGET_NAME = 1396,
+ ERROR_MUTUAL_AUTH_FAILED = 1397,
+ ERROR_TIME_SKEW = 1398,
+ ERROR_CURRENT_DOMAIN_NOT_ALLOWED = 1399,
+ ERROR_INVALID_WINDOW_HANDLE = 1400,
+ ERROR_INVALID_MENU_HANDLE = 1401,
+ ERROR_INVALID_CURSOR_HANDLE = 1402,
+ ERROR_INVALID_ACCEL_HANDLE = 1403,
+ ERROR_INVALID_HOOK_HANDLE = 1404,
+ ERROR_INVALID_DWP_HANDLE = 1405,
+ ERROR_TLW_WITH_WSCHILD = 1406,
+ ERROR_CANNOT_FIND_WND_CLASS = 1407,
+ ERROR_WINDOW_OF_OTHER_THREAD = 1408,
+ ERROR_HOTKEY_ALREADY_REGISTERED = 1409,
+ ERROR_CLASS_ALREADY_EXISTS = 1410,
+ ERROR_CLASS_DOES_NOT_EXIST = 1411,
+ ERROR_CLASS_HAS_WINDOWS = 1412,
+ ERROR_INVALID_INDEX = 1413,
+ ERROR_INVALID_ICON_HANDLE = 1414,
+ ERROR_PRIVATE_DIALOG_INDEX = 1415,
+ ERROR_LISTBOX_ID_NOT_FOUND = 1416,
+ ERROR_NO_WILDCARD_CHARACTERS = 1417,
+ ERROR_CLIPBOARD_NOT_OPEN = 1418,
+ ERROR_HOTKEY_NOT_REGISTERED = 1419,
+ ERROR_WINDOW_NOT_DIALOG = 1420,
+ ERROR_CONTROL_ID_NOT_FOUND = 1421,
+ ERROR_INVALID_COMBOBOX_MESSAGE = 1422,
+ ERROR_WINDOW_NOT_COMBOBOX = 1423,
+ ERROR_INVALID_EDIT_HEIGHT = 1424,
+ ERROR_DC_NOT_FOUND = 1425,
+ ERROR_INVALID_HOOK_FILTER = 1426,
+ ERROR_INVALID_FILTER_PROC = 1427,
+ ERROR_HOOK_NEEDS_HMOD = 1428,
+ ERROR_GLOBAL_ONLY_HOOK = 1429,
+ ERROR_JOURNAL_HOOK_SET = 1430,
+ ERROR_HOOK_NOT_INSTALLED = 1431,
+ ERROR_INVALID_LB_MESSAGE = 1432,
+ ERROR_SETCOUNT_ON_BAD_LB = 1433,
+ ERROR_LB_WITHOUT_TABSTOPS = 1434,
+ ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435,
+ ERROR_CHILD_WINDOW_MENU = 1436,
+ ERROR_NO_SYSTEM_MENU = 1437,
+ ERROR_INVALID_MSGBOX_STYLE = 1438,
+ ERROR_INVALID_SPI_VALUE = 1439,
+ ERROR_SCREEN_ALREADY_LOCKED = 1440,
+ ERROR_HWNDS_HAVE_DIFF_PARENT = 1441,
+ ERROR_NOT_CHILD_WINDOW = 1442,
+ ERROR_INVALID_GW_COMMAND = 1443,
+ ERROR_INVALID_THREAD_ID = 1444,
+ ERROR_NON_MDICHILD_WINDOW = 1445,
+ ERROR_POPUP_ALREADY_ACTIVE = 1446,
+ ERROR_NO_SCROLLBARS = 1447,
+ ERROR_INVALID_SCROLLBAR_RANGE = 1448,
+ ERROR_INVALID_SHOWWIN_COMMAND = 1449,
+ ERROR_NO_SYSTEM_RESOURCES = 1450,
+ ERROR_NONPAGED_SYSTEM_RESOURCES = 1451,
+ ERROR_PAGED_SYSTEM_RESOURCES = 1452,
+ ERROR_WORKING_SET_QUOTA = 1453,
+ ERROR_PAGEFILE_QUOTA = 1454,
+ ERROR_COMMITMENT_LIMIT = 1455,
+ ERROR_MENU_ITEM_NOT_FOUND = 1456,
+ ERROR_INVALID_KEYBOARD_HANDLE = 1457,
+ ERROR_HOOK_TYPE_NOT_ALLOWED = 1458,
+ ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION = 1459,
+ ERROR_TIMEOUT = 1460,
+ ERROR_INVALID_MONITOR_HANDLE = 1461,
+ ERROR_EVENTLOG_FILE_CORRUPT = 1500,
+ ERROR_EVENTLOG_CANT_START = 1501,
+ ERROR_LOG_FILE_FULL = 1502,
+ ERROR_EVENTLOG_FILE_CHANGED = 1503,
+ ERROR_INSTALL_SERVICE_FAILURE = 1601,
+ ERROR_INSTALL_USEREXIT = 1602,
+ ERROR_INSTALL_FAILURE = 1603,
+ ERROR_INSTALL_SUSPEND = 1604,
+ ERROR_UNKNOWN_PRODUCT = 1605,
+ ERROR_UNKNOWN_FEATURE = 1606,
+ ERROR_UNKNOWN_COMPONENT = 1607,
+ ERROR_UNKNOWN_PROPERTY = 1608,
+ ERROR_INVALID_HANDLE_STATE = 1609,
+ ERROR_BAD_CONFIGURATION = 1610,
+ ERROR_INDEX_ABSENT = 1611,
+ ERROR_INSTALL_SOURCE_ABSENT = 1612,
+ ERROR_INSTALL_PACKAGE_VERSION = 1613,
+ ERROR_PRODUCT_UNINSTALLED = 1614,
+ ERROR_BAD_QUERY_SYNTAX = 1615,
+ ERROR_INVALID_FIELD = 1616,
+ ERROR_DEVICE_REMOVED = 1617,
+ ERROR_INSTALL_ALREADY_RUNNING = 1618,
+ ERROR_INSTALL_PACKAGE_OPEN_FAILED = 1619,
+ ERROR_INSTALL_PACKAGE_INVALID = 1620,
+ ERROR_INSTALL_UI_FAILURE = 1621,
+ ERROR_INSTALL_LOG_FAILURE = 1622,
+ ERROR_INSTALL_LANGUAGE_UNSUPPORTED = 1623,
+ ERROR_INSTALL_TRANSFORM_FAILURE = 1624,
+ ERROR_INSTALL_PACKAGE_REJECTED = 1625,
+ ERROR_FUNCTION_NOT_CALLED = 1626,
+ ERROR_FUNCTION_FAILED = 1627,
+ ERROR_INVALID_TABLE = 1628,
+ ERROR_DATATYPE_MISMATCH = 1629,
+ ERROR_UNSUPPORTED_TYPE = 1630,
+ ERROR_CREATE_FAILED = 1631,
+ ERROR_INSTALL_TEMP_UNWRITABLE = 1632,
+ ERROR_INSTALL_PLATFORM_UNSUPPORTED = 1633,
+ ERROR_INSTALL_NOTUSED = 1634,
+ ERROR_PATCH_PACKAGE_OPEN_FAILED = 1635,
+ ERROR_PATCH_PACKAGE_INVALID = 1636,
+ ERROR_PATCH_PACKAGE_UNSUPPORTED = 1637,
+ ERROR_PRODUCT_VERSION = 1638,
+ ERROR_INVALID_COMMAND_LINE = 1639,
+ ERROR_INSTALL_REMOTE_DISALLOWED = 1640,
+ ERROR_SUCCESS_REBOOT_INITIATED = 1641,
+ ERROR_PATCH_TARGET_NOT_FOUND = 1642,
+ ERROR_PATCH_PACKAGE_REJECTED = 1643,
+ ERROR_INSTALL_TRANSFORM_REJECTED = 1644,
+ RPC_S_INVALID_STRING_BINDING = 1700,
+ RPC_S_WRONG_KIND_OF_BINDING = 1701,
+ RPC_S_INVALID_BINDING = 1702,
+ RPC_S_PROTSEQ_NOT_SUPPORTED = 1703,
+ RPC_S_INVALID_RPC_PROTSEQ = 1704,
+ RPC_S_INVALID_STRING_UUID = 1705,
+ RPC_S_INVALID_ENDPOINT_FORMAT = 1706,
+ RPC_S_INVALID_NET_ADDR = 1707,
+ RPC_S_NO_ENDPOINT_FOUND = 1708,
+ RPC_S_INVALID_TIMEOUT = 1709,
+ RPC_S_OBJECT_NOT_FOUND = 1710,
+ RPC_S_ALREADY_REGISTERED = 1711,
+ RPC_S_TYPE_ALREADY_REGISTERED = 1712,
+ RPC_S_ALREADY_LISTENING = 1713,
+ RPC_S_NO_PROTSEQS_REGISTERED = 1714,
+ RPC_S_NOT_LISTENING = 1715,
+ RPC_S_UNKNOWN_MGR_TYPE = 1716,
+ RPC_S_UNKNOWN_IF = 1717,
+ RPC_S_NO_BINDINGS = 1718,
+ RPC_S_NO_PROTSEQS = 1719,
+ RPC_S_CANT_CREATE_ENDPOINT = 1720,
+ RPC_S_OUT_OF_RESOURCES = 1721,
+ RPC_S_SERVER_UNAVAILABLE = 1722,
+ RPC_S_SERVER_TOO_BUSY = 1723,
+ RPC_S_INVALID_NETWORK_OPTIONS = 1724,
+ RPC_S_NO_CALL_ACTIVE = 1725,
+ RPC_S_CALL_FAILED = 1726,
+ RPC_S_CALL_FAILED_DNE = 1727,
+ RPC_S_PROTOCOL_ERROR = 1728,
+ RPC_S_UNSUPPORTED_TRANS_SYN = 1730,
+ RPC_S_UNSUPPORTED_TYPE = 1732,
+ RPC_S_INVALID_TAG = 1733,
+ RPC_S_INVALID_BOUND = 1734,
+ RPC_S_NO_ENTRY_NAME = 1735,
+ RPC_S_INVALID_NAME_SYNTAX = 1736,
+ RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737,
+ RPC_S_UUID_NO_ADDRESS = 1739,
+ RPC_S_DUPLICATE_ENDPOINT = 1740,
+ RPC_S_UNKNOWN_AUTHN_TYPE = 1741,
+ RPC_S_MAX_CALLS_TOO_SMALL = 1742,
+ RPC_S_STRING_TOO_LONG = 1743,
+ RPC_S_PROTSEQ_NOT_FOUND = 1744,
+ RPC_S_PROCNUM_OUT_OF_RANGE = 1745,
+ RPC_S_BINDING_HAS_NO_AUTH = 1746,
+ RPC_S_UNKNOWN_AUTHN_SERVICE = 1747,
+ RPC_S_UNKNOWN_AUTHN_LEVEL = 1748,
+ RPC_S_INVALID_AUTH_IDENTITY = 1749,
+ RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750,
+ EPT_S_INVALID_ENTRY = 1751,
+ EPT_S_CANT_PERFORM_OP = 1752,
+ EPT_S_NOT_REGISTERED = 1753,
+ RPC_S_NOTHING_TO_EXPORT = 1754,
+ RPC_S_INCOMPLETE_NAME = 1755,
+ RPC_S_INVALID_VERS_OPTION = 1756,
+ RPC_S_NO_MORE_MEMBERS = 1757,
+ RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758,
+ RPC_S_INTERFACE_NOT_FOUND = 1759,
+ RPC_S_ENTRY_ALREADY_EXISTS = 1760,
+ RPC_S_ENTRY_NOT_FOUND = 1761,
+ RPC_S_NAME_SERVICE_UNAVAILABLE = 1762,
+ RPC_S_INVALID_NAF_ID = 1763,
+ RPC_S_CANNOT_SUPPORT = 1764,
+ RPC_S_NO_CONTEXT_AVAILABLE = 1765,
+ RPC_S_INTERNAL_ERROR = 1766,
+ RPC_S_ZERO_DIVIDE = 1767,
+ RPC_S_ADDRESS_ERROR = 1768,
+ RPC_S_FP_DIV_ZERO = 1769,
+ RPC_S_FP_UNDERFLOW = 1770,
+ RPC_S_FP_OVERFLOW = 1771,
+ RPC_X_NO_MORE_ENTRIES = 1772,
+ RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773,
+ RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774,
+ RPC_X_SS_IN_NULL_CONTEXT = 1775,
+ RPC_X_SS_CONTEXT_DAMAGED = 1777,
+ RPC_X_SS_HANDLES_MISMATCH = 1778,
+ RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779,
+ RPC_X_NULL_REF_POINTER = 1780,
+ RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781,
+ RPC_X_BYTE_COUNT_TOO_SMALL = 1782,
+ RPC_X_BAD_STUB_DATA = 1783,
+ ERROR_INVALID_USER_BUFFER = 1784,
+ ERROR_UNRECOGNIZED_MEDIA = 1785,
+ ERROR_NO_TRUST_LSA_SECRET = 1786,
+ ERROR_NO_TRUST_SAM_ACCOUNT = 1787,
+ ERROR_TRUSTED_DOMAIN_FAILURE = 1788,
+ ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789,
+ ERROR_TRUST_FAILURE = 1790,
+ RPC_S_CALL_IN_PROGRESS = 1791,
+ ERROR_NETLOGON_NOT_STARTED = 1792,
+ ERROR_ACCOUNT_EXPIRED = 1793,
+ ERROR_REDIRECTOR_HAS_OPEN_HANDLES = 1794,
+ ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795,
+ ERROR_UNKNOWN_PORT = 1796,
+ ERROR_UNKNOWN_PRINTER_DRIVER = 1797,
+ ERROR_UNKNOWN_PRINTPROCESSOR = 1798,
+ ERROR_INVALID_SEPARATOR_FILE = 1799,
+ ERROR_INVALID_PRIORITY = 1800,
+ ERROR_INVALID_PRINTER_NAME = 1801,
+ ERROR_PRINTER_ALREADY_EXISTS = 1802,
+ ERROR_INVALID_PRINTER_COMMAND = 1803,
+ ERROR_INVALID_DATATYPE = 1804,
+ ERROR_INVALID_ENVIRONMENT = 1805,
+ RPC_S_NO_MORE_BINDINGS = 1806,
+ ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807,
+ ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808,
+ ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809,
+ ERROR_DOMAIN_TRUST_INCONSISTENT = 1810,
+ ERROR_SERVER_HAS_OPEN_HANDLES = 1811,
+ ERROR_RESOURCE_DATA_NOT_FOUND = 1812,
+ ERROR_RESOURCE_TYPE_NOT_FOUND = 1813,
+ ERROR_RESOURCE_NAME_NOT_FOUND = 1814,
+ ERROR_RESOURCE_LANG_NOT_FOUND = 1815,
+ ERROR_NOT_ENOUGH_QUOTA = 1816,
+ RPC_S_NO_INTERFACES = 1817,
+ RPC_S_CALL_CANCELLED = 1818,
+ RPC_S_BINDING_INCOMPLETE = 1819,
+ RPC_S_COMM_FAILURE = 1820,
+ RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821,
+ RPC_S_NO_PRINC_NAME = 1822,
+ RPC_S_NOT_RPC_ERROR = 1823,
+ RPC_S_UUID_LOCAL_ONLY = 1824,
+ RPC_S_SEC_PKG_ERROR = 1825,
+ RPC_S_NOT_CANCELLED = 1826,
+ RPC_X_INVALID_ES_ACTION = 1827,
+ RPC_X_WRONG_ES_VERSION = 1828,
+ RPC_X_WRONG_STUB_VERSION = 1829,
+ RPC_X_INVALID_PIPE_OBJECT = 1830,
+ RPC_X_WRONG_PIPE_ORDER = 1831,
+ RPC_X_WRONG_PIPE_VERSION = 1832,
+ RPC_S_GROUP_MEMBER_NOT_FOUND = 1898,
+ EPT_S_CANT_CREATE = 1899,
+ RPC_S_INVALID_OBJECT = 1900,
+ ERROR_INVALID_TIME = 1901,
+ ERROR_INVALID_FORM_NAME = 1902,
+ ERROR_INVALID_FORM_SIZE = 1903,
+ ERROR_ALREADY_WAITING = 1904,
+ ERROR_PRINTER_DELETED = 1905,
+ ERROR_INVALID_PRINTER_STATE = 1906,
+ ERROR_PASSWORD_MUST_CHANGE = 1907,
+ ERROR_DOMAIN_CONTROLLER_NOT_FOUND = 1908,
+ ERROR_ACCOUNT_LOCKED_OUT = 1909,
+ OR_INVALID_OXID = 1910,
+ OR_INVALID_OID = 1911,
+ OR_INVALID_SET = 1912,
+ RPC_S_SEND_INCOMPLETE = 1913,
+ RPC_S_INVALID_ASYNC_HANDLE = 1914,
+ RPC_S_INVALID_ASYNC_CALL = 1915,
+ RPC_X_PIPE_CLOSED = 1916,
+ RPC_X_PIPE_DISCIPLINE_ERROR = 1917,
+ RPC_X_PIPE_EMPTY = 1918,
+ ERROR_NO_SITENAME = 1919,
+ ERROR_CANT_ACCESS_FILE = 1920,
+ ERROR_CANT_RESOLVE_FILENAME = 1921,
+ RPC_S_ENTRY_TYPE_MISMATCH = 1922,
+ RPC_S_NOT_ALL_OBJS_EXPORTED = 1923,
+ RPC_S_INTERFACE_NOT_EXPORTED = 1924,
+ RPC_S_PROFILE_NOT_ADDED = 1925,
+ RPC_S_PRF_ELT_NOT_ADDED = 1926,
+ RPC_S_PRF_ELT_NOT_REMOVED = 1927,
+ RPC_S_GRP_ELT_NOT_ADDED = 1928,
+ RPC_S_GRP_ELT_NOT_REMOVED = 1929,
+ ERROR_KM_DRIVER_BLOCKED = 1930,
+ ERROR_CONTEXT_EXPIRED = 1931,
+ ERROR_INVALID_PIXEL_FORMAT = 2000,
+ ERROR_BAD_DRIVER = 2001,
+ ERROR_INVALID_WINDOW_STYLE = 2002,
+ ERROR_METAFILE_NOT_SUPPORTED = 2003,
+ ERROR_TRANSFORM_NOT_SUPPORTED = 2004,
+ ERROR_CLIPPING_NOT_SUPPORTED = 2005,
+ ERROR_INVALID_CMM = 2010,
+ ERROR_INVALID_PROFILE = 2011,
+ ERROR_TAG_NOT_FOUND = 2012,
+ ERROR_TAG_NOT_PRESENT = 2013,
+ ERROR_DUPLICATE_TAG = 2014,
+ ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015,
+ ERROR_PROFILE_NOT_FOUND = 2016,
+ ERROR_INVALID_COLORSPACE = 2017,
+ ERROR_ICM_NOT_ENABLED = 2018,
+ ERROR_DELETING_ICM_XFORM = 2019,
+ ERROR_INVALID_TRANSFORM = 2020,
+ ERROR_COLORSPACE_MISMATCH = 2021,
+ ERROR_INVALID_COLORINDEX = 2022,
+ ERROR_CONNECTED_OTHER_PASSWORD = 2108,
+ ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT = 2109,
+ ERROR_BAD_USERNAME = 2202,
+ ERROR_NOT_CONNECTED = 2250,
+ ERROR_OPEN_FILES = 2401,
+ ERROR_ACTIVE_CONNECTIONS = 2402,
+ ERROR_DEVICE_IN_USE = 2404,
+ ERROR_UNKNOWN_PRINT_MONITOR = 3000,
+ ERROR_PRINTER_DRIVER_IN_USE = 3001,
+ ERROR_SPOOL_FILE_NOT_FOUND = 3002,
+ ERROR_SPL_NO_STARTDOC = 3003,
+ ERROR_SPL_NO_ADDJOB = 3004,
+ ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005,
+ ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006,
+ ERROR_INVALID_PRINT_MONITOR = 3007,
+ ERROR_PRINT_MONITOR_IN_USE = 3008,
+ ERROR_PRINTER_HAS_JOBS_QUEUED = 3009,
+ ERROR_SUCCESS_REBOOT_REQUIRED = 3010,
+ ERROR_SUCCESS_RESTART_REQUIRED = 3011,
+ ERROR_PRINTER_NOT_FOUND = 3012,
+ ERROR_PRINTER_DRIVER_WARNED = 3013,
+ ERROR_PRINTER_DRIVER_BLOCKED = 3014,
+ ERROR_WINS_INTERNAL = 4000,
+ ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001,
+ ERROR_STATIC_INIT = 4002,
+ ERROR_INC_BACKUP = 4003,
+ ERROR_FULL_BACKUP = 4004,
+ ERROR_REC_NON_EXISTENT = 4005,
+ ERROR_RPL_NOT_ALLOWED = 4006,
+ ERROR_DHCP_ADDRESS_CONFLICT = 4100,
+ ERROR_WMI_GUID_NOT_FOUND = 4200,
+ ERROR_WMI_INSTANCE_NOT_FOUND = 4201,
+ ERROR_WMI_ITEMID_NOT_FOUND = 4202,
+ ERROR_WMI_TRY_AGAIN = 4203,
+ ERROR_WMI_DP_NOT_FOUND = 4204,
+ ERROR_WMI_UNRESOLVED_INSTANCE_REF = 4205,
+ ERROR_WMI_ALREADY_ENABLED = 4206,
+ ERROR_WMI_GUID_DISCONNECTED = 4207,
+ ERROR_WMI_SERVER_UNAVAILABLE = 4208,
+ ERROR_WMI_DP_FAILED = 4209,
+ ERROR_WMI_INVALID_MOF = 4210,
+ ERROR_WMI_INVALID_REGINFO = 4211,
+ ERROR_WMI_ALREADY_DISABLED = 4212,
+ ERROR_WMI_READ_ONLY = 4213,
+ ERROR_WMI_SET_FAILURE = 4214,
+ ERROR_INVALID_MEDIA = 4300,
+ ERROR_INVALID_LIBRARY = 4301,
+ ERROR_INVALID_MEDIA_POOL = 4302,
+ ERROR_DRIVE_MEDIA_MISMATCH = 4303,
+ ERROR_MEDIA_OFFLINE = 4304,
+ ERROR_LIBRARY_OFFLINE = 4305,
+ ERROR_EMPTY = 4306,
+ ERROR_NOT_EMPTY = 4307,
+ ERROR_MEDIA_UNAVAILABLE = 4308,
+ ERROR_RESOURCE_DISABLED = 4309,
+ ERROR_INVALID_CLEANER = 4310,
+ ERROR_UNABLE_TO_CLEAN = 4311,
+ ERROR_OBJECT_NOT_FOUND = 4312,
+ ERROR_DATABASE_FAILURE = 4313,
+ ERROR_DATABASE_FULL = 4314,
+ ERROR_MEDIA_INCOMPATIBLE = 4315,
+ ERROR_RESOURCE_NOT_PRESENT = 4316,
+ ERROR_INVALID_OPERATION = 4317,
+ ERROR_MEDIA_NOT_AVAILABLE = 4318,
+ ERROR_DEVICE_NOT_AVAILABLE = 4319,
+ ERROR_REQUEST_REFUSED = 4320,
+ ERROR_INVALID_DRIVE_OBJECT = 4321,
+ ERROR_LIBRARY_FULL = 4322,
+ ERROR_MEDIUM_NOT_ACCESSIBLE = 4323,
+ ERROR_UNABLE_TO_LOAD_MEDIUM = 4324,
+ ERROR_UNABLE_TO_INVENTORY_DRIVE = 4325,
+ ERROR_UNABLE_TO_INVENTORY_SLOT = 4326,
+ ERROR_UNABLE_TO_INVENTORY_TRANSPORT = 4327,
+ ERROR_TRANSPORT_FULL = 4328,
+ ERROR_CONTROLLING_IEPORT = 4329,
+ ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA = 4330,
+ ERROR_CLEANER_SLOT_SET = 4331,
+ ERROR_CLEANER_SLOT_NOT_SET = 4332,
+ ERROR_CLEANER_CARTRIDGE_SPENT = 4333,
+ ERROR_UNEXPECTED_OMID = 4334,
+ ERROR_CANT_DELETE_LAST_ITEM = 4335,
+ ERROR_MESSAGE_EXCEEDS_MAX_SIZE = 4336,
+ ERROR_VOLUME_CONTAINS_SYS_FILES = 4337,
+ ERROR_INDIGENOUS_TYPE = 4338,
+ ERROR_NO_SUPPORTING_DRIVES = 4339,
+ ERROR_CLEANER_CARTRIDGE_INSTALLED = 4340,
+ ERROR_FILE_OFFLINE = 4350,
+ ERROR_REMOTE_STORAGE_NOT_ACTIVE = 4351,
+ ERROR_REMOTE_STORAGE_MEDIA_ERROR = 4352,
+ ERROR_NOT_A_REPARSE_POINT = 4390,
+ ERROR_REPARSE_ATTRIBUTE_CONFLICT = 4391,
+ ERROR_INVALID_REPARSE_DATA = 4392,
+ ERROR_REPARSE_TAG_INVALID = 4393,
+ ERROR_REPARSE_TAG_MISMATCH = 4394,
+ ERROR_VOLUME_NOT_SIS_ENABLED = 4500,
+ ERROR_DEPENDENT_RESOURCE_EXISTS = 5001,
+ ERROR_DEPENDENCY_NOT_FOUND = 5002,
+ ERROR_DEPENDENCY_ALREADY_EXISTS = 5003,
+ ERROR_RESOURCE_NOT_ONLINE = 5004,
+ ERROR_HOST_NODE_NOT_AVAILABLE = 5005,
+ ERROR_RESOURCE_NOT_AVAILABLE = 5006,
+ ERROR_RESOURCE_NOT_FOUND = 5007,
+ ERROR_SHUTDOWN_CLUSTER = 5008,
+ ERROR_CANT_EVICT_ACTIVE_NODE = 5009,
+ ERROR_OBJECT_ALREADY_EXISTS = 5010,
+ ERROR_OBJECT_IN_LIST = 5011,
+ ERROR_GROUP_NOT_AVAILABLE = 5012,
+ ERROR_GROUP_NOT_FOUND = 5013,
+ ERROR_GROUP_NOT_ONLINE = 5014,
+ ERROR_HOST_NODE_NOT_RESOURCE_OWNER = 5015,
+ ERROR_HOST_NODE_NOT_GROUP_OWNER = 5016,
+ ERROR_RESMON_CREATE_FAILED = 5017,
+ ERROR_RESMON_ONLINE_FAILED = 5018,
+ ERROR_RESOURCE_ONLINE = 5019,
+ ERROR_QUORUM_RESOURCE = 5020,
+ ERROR_NOT_QUORUM_CAPABLE = 5021,
+ ERROR_CLUSTER_SHUTTING_DOWN = 5022,
+ ERROR_INVALID_STATE = 5023,
+ ERROR_RESOURCE_PROPERTIES_STORED = 5024,
+ ERROR_NOT_QUORUM_CLASS = 5025,
+ ERROR_CORE_RESOURCE = 5026,
+ ERROR_QUORUM_RESOURCE_ONLINE_FAILED = 5027,
+ ERROR_QUORUMLOG_OPEN_FAILED = 5028,
+ ERROR_CLUSTERLOG_CORRUPT = 5029,
+ ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE = 5030,
+ ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE = 5031,
+ ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND = 5032,
+ ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE = 5033,
+ ERROR_QUORUM_OWNER_ALIVE = 5034,
+ ERROR_NETWORK_NOT_AVAILABLE = 5035,
+ ERROR_NODE_NOT_AVAILABLE = 5036,
+ ERROR_ALL_NODES_NOT_AVAILABLE = 5037,
+ ERROR_RESOURCE_FAILED = 5038,
+ ERROR_CLUSTER_INVALID_NODE = 5039,
+ ERROR_CLUSTER_NODE_EXISTS = 5040,
+ ERROR_CLUSTER_JOIN_IN_PROGRESS = 5041,
+ ERROR_CLUSTER_NODE_NOT_FOUND = 5042,
+ ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND = 5043,
+ ERROR_CLUSTER_NETWORK_EXISTS = 5044,
+ ERROR_CLUSTER_NETWORK_NOT_FOUND = 5045,
+ ERROR_CLUSTER_NETINTERFACE_EXISTS = 5046,
+ ERROR_CLUSTER_NETINTERFACE_NOT_FOUND = 5047,
+ ERROR_CLUSTER_INVALID_REQUEST = 5048,
+ ERROR_CLUSTER_INVALID_NETWORK_PROVIDER = 5049,
+ ERROR_CLUSTER_NODE_DOWN = 5050,
+ ERROR_CLUSTER_NODE_UNREACHABLE = 5051,
+ ERROR_CLUSTER_NODE_NOT_MEMBER = 5052,
+ ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS = 5053,
+ ERROR_CLUSTER_INVALID_NETWORK = 5054,
+ ERROR_CLUSTER_NODE_UP = 5056,
+ ERROR_CLUSTER_IPADDR_IN_USE = 5057,
+ ERROR_CLUSTER_NODE_NOT_PAUSED = 5058,
+ ERROR_CLUSTER_NO_SECURITY_CONTEXT = 5059,
+ ERROR_CLUSTER_NETWORK_NOT_INTERNAL = 5060,
+ ERROR_CLUSTER_NODE_ALREADY_UP = 5061,
+ ERROR_CLUSTER_NODE_ALREADY_DOWN = 5062,
+ ERROR_CLUSTER_NETWORK_ALREADY_ONLINE = 5063,
+ ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE = 5064,
+ ERROR_CLUSTER_NODE_ALREADY_MEMBER = 5065,
+ ERROR_CLUSTER_LAST_INTERNAL_NETWORK = 5066,
+ ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS = 5067,
+ ERROR_INVALID_OPERATION_ON_QUORUM = 5068,
+ ERROR_DEPENDENCY_NOT_ALLOWED = 5069,
+ ERROR_CLUSTER_NODE_PAUSED = 5070,
+ ERROR_NODE_CANT_HOST_RESOURCE = 5071,
+ ERROR_CLUSTER_NODE_NOT_READY = 5072,
+ ERROR_CLUSTER_NODE_SHUTTING_DOWN = 5073,
+ ERROR_CLUSTER_JOIN_ABORTED = 5074,
+ ERROR_CLUSTER_INCOMPATIBLE_VERSIONS = 5075,
+ ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED = 5076,
+ ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED = 5077,
+ ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND = 5078,
+ ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED = 5079,
+ ERROR_CLUSTER_RESNAME_NOT_FOUND = 5080,
+ ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED = 5081,
+ ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST = 5082,
+ ERROR_CLUSTER_DATABASE_SEQMISMATCH = 5083,
+ ERROR_RESMON_INVALID_STATE = 5084,
+ ERROR_CLUSTER_GUM_NOT_LOCKER = 5085,
+ ERROR_QUORUM_DISK_NOT_FOUND = 5086,
+ ERROR_DATABASE_BACKUP_CORRUPT = 5087,
+ ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT = 5088,
+ ERROR_RESOURCE_PROPERTY_UNCHANGEABLE = 5089,
+ ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE = 5890,
+ ERROR_CLUSTER_QUORUMLOG_NOT_FOUND = 5891,
+ ERROR_CLUSTER_MEMBERSHIP_HALT = 5892,
+ ERROR_CLUSTER_INSTANCE_ID_MISMATCH = 5893,
+ ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP = 5894,
+ ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH = 5895,
+ ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP = 5896,
+ ERROR_CLUSTER_PARAMETER_MISMATCH = 5897,
+ ERROR_NODE_CANNOT_BE_CLUSTERED = 5898,
+ ERROR_CLUSTER_WRONG_OS_VERSION = 5899,
+ ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME = 5900,
+ ERROR_ENCRYPTION_FAILED = 6000,
+ ERROR_DECRYPTION_FAILED = 6001,
+ ERROR_FILE_ENCRYPTED = 6002,
+ ERROR_NO_RECOVERY_POLICY = 6003,
+ ERROR_NO_EFS = 6004,
+ ERROR_WRONG_EFS = 6005,
+ ERROR_NO_USER_KEYS = 6006,
+ ERROR_FILE_NOT_ENCRYPTED = 6007,
+ ERROR_NOT_EXPORT_FORMAT = 6008,
+ ERROR_FILE_READ_ONLY = 6009,
+ ERROR_DIR_EFS_DISALLOWED = 6010,
+ ERROR_EFS_SERVER_NOT_TRUSTED = 6011,
+ ERROR_BAD_RECOVERY_POLICY = 6012,
+ ERROR_EFS_ALG_BLOB_TOO_BIG = 6013,
+ ERROR_VOLUME_NOT_SUPPORT_EFS = 6014,
+ ERROR_EFS_DISABLED = 6015,
+ ERROR_EFS_VERSION_NOT_SUPPORT = 6016,
+ ERROR_NO_BROWSER_SERVERS_FOUND = 6118,
+ SCHED_E_SERVICE_NOT_LOCALSYSTEM = 6200,
+ ERROR_CTX_WINSTATION_NAME_INVALID = 7001,
+ ERROR_CTX_INVALID_PD = 7002,
+ ERROR_CTX_PD_NOT_FOUND = 7003,
+ ERROR_CTX_WD_NOT_FOUND = 7004,
+ ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY = 7005,
+ ERROR_CTX_SERVICE_NAME_COLLISION = 7006,
+ ERROR_CTX_CLOSE_PENDING = 7007,
+ ERROR_CTX_NO_OUTBUF = 7008,
+ ERROR_CTX_MODEM_INF_NOT_FOUND = 7009,
+ ERROR_CTX_INVALID_MODEMNAME = 7010,
+ ERROR_CTX_MODEM_RESPONSE_ERROR = 7011,
+ ERROR_CTX_MODEM_RESPONSE_TIMEOUT = 7012,
+ ERROR_CTX_MODEM_RESPONSE_NO_CARRIER = 7013,
+ ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE = 7014,
+ ERROR_CTX_MODEM_RESPONSE_BUSY = 7015,
+ ERROR_CTX_MODEM_RESPONSE_VOICE = 7016,
+ ERROR_CTX_TD_ERROR = 7017,
+ ERROR_CTX_WINSTATION_NOT_FOUND = 7022,
+ ERROR_CTX_WINSTATION_ALREADY_EXISTS = 7023,
+ ERROR_CTX_WINSTATION_BUSY = 7024,
+ ERROR_CTX_BAD_VIDEO_MODE = 7025,
+ ERROR_CTX_GRAPHICS_INVALID = 7035,
+ ERROR_CTX_LOGON_DISABLED = 7037,
+ ERROR_CTX_NOT_CONSOLE = 7038,
+ ERROR_CTX_CLIENT_QUERY_TIMEOUT = 7040,
+ ERROR_CTX_CONSOLE_DISCONNECT = 7041,
+ ERROR_CTX_CONSOLE_CONNECT = 7042,
+ ERROR_CTX_SHADOW_DENIED = 7044,
+ ERROR_CTX_WINSTATION_ACCESS_DENIED = 7045,
+ ERROR_CTX_INVALID_WD = 7049,
+ ERROR_CTX_SHADOW_INVALID = 7050,
+ ERROR_CTX_SHADOW_DISABLED = 7051,
+ ERROR_CTX_CLIENT_LICENSE_IN_USE = 7052,
+ ERROR_CTX_CLIENT_LICENSE_NOT_SET = 7053,
+ ERROR_CTX_LICENSE_NOT_AVAILABLE = 7054,
+ ERROR_CTX_LICENSE_CLIENT_INVALID = 7055,
+ ERROR_CTX_LICENSE_EXPIRED = 7056,
+ ERROR_CTX_SHADOW_NOT_RUNNING = 7057,
+ ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE = 7058,
+ FRS_ERR_INVALID_API_SEQUENCE = 8001,
+ FRS_ERR_STARTING_SERVICE = 8002,
+ FRS_ERR_STOPPING_SERVICE = 8003,
+ FRS_ERR_INTERNAL_API = 8004,
+ FRS_ERR_INTERNAL = 8005,
+ FRS_ERR_SERVICE_COMM = 8006,
+ FRS_ERR_INSUFFICIENT_PRIV = 8007,
+ FRS_ERR_AUTHENTICATION = 8008,
+ FRS_ERR_PARENT_INSUFFICIENT_PRIV = 8009,
+ FRS_ERR_PARENT_AUTHENTICATION = 8010,
+ FRS_ERR_CHILD_TO_PARENT_COMM = 8011,
+ FRS_ERR_PARENT_TO_CHILD_COMM = 8012,
+ FRS_ERR_SYSVOL_POPULATE = 8013,
+ FRS_ERR_SYSVOL_POPULATE_TIMEOUT = 8014,
+ FRS_ERR_SYSVOL_IS_BUSY = 8015,
+ FRS_ERR_SYSVOL_DEMOTE = 8016,
+ FRS_ERR_INVALID_SERVICE_PARAMETER = 8017,
+ ERROR_DS_NOT_INSTALLED = 8200,
+ ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY = 8201,
+ ERROR_DS_NO_ATTRIBUTE_OR_VALUE = 8202,
+ ERROR_DS_INVALID_ATTRIBUTE_SYNTAX = 8203,
+ ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED = 8204,
+ ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS = 8205,
+ ERROR_DS_BUSY = 8206,
+ ERROR_DS_UNAVAILABLE = 8207,
+ ERROR_DS_NO_RIDS_ALLOCATED = 8208,
+ ERROR_DS_NO_MORE_RIDS = 8209,
+ ERROR_DS_INCORRECT_ROLE_OWNER = 8210,
+ ERROR_DS_RIDMGR_INIT_ERROR = 8211,
+ ERROR_DS_OBJ_CLASS_VIOLATION = 8212,
+ ERROR_DS_CANT_ON_NON_LEAF = 8213,
+ ERROR_DS_CANT_ON_RDN = 8214,
+ ERROR_DS_CANT_MOD_OBJ_CLASS = 8215,
+ ERROR_DS_CROSS_DOM_MOVE_ERROR = 8216,
+ ERROR_DS_GC_NOT_AVAILABLE = 8217,
+ ERROR_SHARED_POLICY = 8218,
+ ERROR_POLICY_OBJECT_NOT_FOUND = 8219,
+ ERROR_POLICY_ONLY_IN_DS = 8220,
+ ERROR_PROMOTION_ACTIVE = 8221,
+ ERROR_NO_PROMOTION_ACTIVE = 8222,
+ ERROR_DS_OPERATIONS_ERROR = 8224,
+ ERROR_DS_PROTOCOL_ERROR = 8225,
+ ERROR_DS_TIMELIMIT_EXCEEDED = 8226,
+ ERROR_DS_SIZELIMIT_EXCEEDED = 8227,
+ ERROR_DS_ADMIN_LIMIT_EXCEEDED = 8228,
+ ERROR_DS_COMPARE_FALSE = 8229,
+ ERROR_DS_COMPARE_TRUE = 8230,
+ ERROR_DS_AUTH_METHOD_NOT_SUPPORTED = 8231,
+ ERROR_DS_STRONG_AUTH_REQUIRED = 8232,
+ ERROR_DS_INAPPROPRIATE_AUTH = 8233,
+ ERROR_DS_AUTH_UNKNOWN = 8234,
+ ERROR_DS_REFERRAL = 8235,
+ ERROR_DS_UNAVAILABLE_CRIT_EXTENSION = 8236,
+ ERROR_DS_CONFIDENTIALITY_REQUIRED = 8237,
+ ERROR_DS_INAPPROPRIATE_MATCHING = 8238,
+ ERROR_DS_CONSTRAINT_VIOLATION = 8239,
+ ERROR_DS_NO_SUCH_OBJECT = 8240,
+ ERROR_DS_ALIAS_PROBLEM = 8241,
+ ERROR_DS_INVALID_DN_SYNTAX = 8242,
+ ERROR_DS_IS_LEAF = 8243,
+ ERROR_DS_ALIAS_DEREF_PROBLEM = 8244,
+ ERROR_DS_UNWILLING_TO_PERFORM = 8245,
+ ERROR_DS_LOOP_DETECT = 8246,
+ ERROR_DS_NAMING_VIOLATION = 8247,
+ ERROR_DS_OBJECT_RESULTS_TOO_LARGE = 8248,
+ ERROR_DS_AFFECTS_MULTIPLE_DSAS = 8249,
+ ERROR_DS_SERVER_DOWN = 8250,
+ ERROR_DS_LOCAL_ERROR = 8251,
+ ERROR_DS_ENCODING_ERROR = 8252,
+ ERROR_DS_DECODING_ERROR = 8253,
+ ERROR_DS_FILTER_UNKNOWN = 8254,
+ ERROR_DS_PARAM_ERROR = 8255,
+ ERROR_DS_NOT_SUPPORTED = 8256,
+ ERROR_DS_NO_RESULTS_RETURNED = 8257,
+ ERROR_DS_CONTROL_NOT_FOUND = 8258,
+ ERROR_DS_CLIENT_LOOP = 8259,
+ ERROR_DS_REFERRAL_LIMIT_EXCEEDED = 8260,
+ ERROR_DS_SORT_CONTROL_MISSING = 8261,
+ ERROR_DS_OFFSET_RANGE_ERROR = 8262,
+ ERROR_DS_ROOT_MUST_BE_NC = 8301,
+ ERROR_DS_ADD_REPLICA_INHIBITED = 8302,
+ ERROR_DS_ATT_NOT_DEF_IN_SCHEMA = 8303,
+ ERROR_DS_MAX_OBJ_SIZE_EXCEEDED = 8304,
+ ERROR_DS_OBJ_STRING_NAME_EXISTS = 8305,
+ ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA = 8306,
+ ERROR_DS_RDN_DOESNT_MATCH_SCHEMA = 8307,
+ ERROR_DS_NO_REQUESTED_ATTS_FOUND = 8308,
+ ERROR_DS_USER_BUFFER_TO_SMALL = 8309,
+ ERROR_DS_ATT_IS_NOT_ON_OBJ = 8310,
+ ERROR_DS_ILLEGAL_MOD_OPERATION = 8311,
+ ERROR_DS_OBJ_TOO_LARGE = 8312,
+ ERROR_DS_BAD_INSTANCE_TYPE = 8313,
+ ERROR_DS_MASTERDSA_REQUIRED = 8314,
+ ERROR_DS_OBJECT_CLASS_REQUIRED = 8315,
+ ERROR_DS_MISSING_REQUIRED_ATT = 8316,
+ ERROR_DS_ATT_NOT_DEF_FOR_CLASS = 8317,
+ ERROR_DS_ATT_ALREADY_EXISTS = 8318,
+ ERROR_DS_CANT_ADD_ATT_VALUES = 8320,
+ ERROR_DS_SINGLE_VALUE_CONSTRAINT = 8321,
+ ERROR_DS_RANGE_CONSTRAINT = 8322,
+ ERROR_DS_ATT_VAL_ALREADY_EXISTS = 8323,
+ ERROR_DS_CANT_REM_MISSING_ATT = 8324,
+ ERROR_DS_CANT_REM_MISSING_ATT_VAL = 8325,
+ ERROR_DS_ROOT_CANT_BE_SUBREF = 8326,
+ ERROR_DS_NO_CHAINING = 8327,
+ ERROR_DS_NO_CHAINED_EVAL = 8328,
+ ERROR_DS_NO_PARENT_OBJECT = 8329,
+ ERROR_DS_PARENT_IS_AN_ALIAS = 8330,
+ ERROR_DS_CANT_MIX_MASTER_AND_REPS = 8331,
+ ERROR_DS_CHILDREN_EXIST = 8332,
+ ERROR_DS_OBJ_NOT_FOUND = 8333,
+ ERROR_DS_ALIASED_OBJ_MISSING = 8334,
+ ERROR_DS_BAD_NAME_SYNTAX = 8335,
+ ERROR_DS_ALIAS_POINTS_TO_ALIAS = 8336,
+ ERROR_DS_CANT_DEREF_ALIAS = 8337,
+ ERROR_DS_OUT_OF_SCOPE = 8338,
+ ERROR_DS_OBJECT_BEING_REMOVED = 8339,
+ ERROR_DS_CANT_DELETE_DSA_OBJ = 8340,
+ ERROR_DS_GENERIC_ERROR = 8341,
+ ERROR_DS_DSA_MUST_BE_INT_MASTER = 8342,
+ ERROR_DS_CLASS_NOT_DSA = 8343,
+ ERROR_DS_INSUFF_ACCESS_RIGHTS = 8344,
+ ERROR_DS_ILLEGAL_SUPERIOR = 8345,
+ ERROR_DS_ATTRIBUTE_OWNED_BY_SAM = 8346,
+ ERROR_DS_NAME_TOO_MANY_PARTS = 8347,
+ ERROR_DS_NAME_TOO_LONG = 8348,
+ ERROR_DS_NAME_VALUE_TOO_LONG = 8349,
+ ERROR_DS_NAME_UNPARSEABLE = 8350,
+ ERROR_DS_NAME_TYPE_UNKNOWN = 8351,
+ ERROR_DS_NOT_AN_OBJECT = 8352,
+ ERROR_DS_SEC_DESC_TOO_SHORT = 8353,
+ ERROR_DS_SEC_DESC_INVALID = 8354,
+ ERROR_DS_NO_DELETED_NAME = 8355,
+ ERROR_DS_SUBREF_MUST_HAVE_PARENT = 8356,
+ ERROR_DS_NCNAME_MUST_BE_NC = 8357,
+ ERROR_DS_CANT_ADD_SYSTEM_ONLY = 8358,
+ ERROR_DS_CLASS_MUST_BE_CONCRETE = 8359,
+ ERROR_DS_INVALID_DMD = 8360,
+ ERROR_DS_OBJ_GUID_EXISTS = 8361,
+ ERROR_DS_NOT_ON_BACKLINK = 8362,
+ ERROR_DS_NO_CROSSREF_FOR_NC = 8363,
+ ERROR_DS_SHUTTING_DOWN = 8364,
+ ERROR_DS_UNKNOWN_OPERATION = 8365,
+ ERROR_DS_INVALID_ROLE_OWNER = 8366,
+ ERROR_DS_COULDNT_CONTACT_FSMO = 8367,
+ ERROR_DS_CROSS_NC_DN_RENAME = 8368,
+ ERROR_DS_CANT_MOD_SYSTEM_ONLY = 8369,
+ ERROR_DS_REPLICATOR_ONLY = 8370,
+ ERROR_DS_OBJ_CLASS_NOT_DEFINED = 8371,
+ ERROR_DS_OBJ_CLASS_NOT_SUBCLASS = 8372,
+ ERROR_DS_NAME_REFERENCE_INVALID = 8373,
+ ERROR_DS_CROSS_REF_EXISTS = 8374,
+ ERROR_DS_CANT_DEL_MASTER_CROSSREF = 8375,
+ ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD = 8376,
+ ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX = 8377,
+ ERROR_DS_DUP_RDN = 8378,
+ ERROR_DS_DUP_OID = 8379,
+ ERROR_DS_DUP_MAPI_ID = 8380,
+ ERROR_DS_DUP_SCHEMA_ID_GUID = 8381,
+ ERROR_DS_DUP_LDAP_DISPLAY_NAME = 8382,
+ ERROR_DS_SEMANTIC_ATT_TEST = 8383,
+ ERROR_DS_SYNTAX_MISMATCH = 8384,
+ ERROR_DS_EXISTS_IN_MUST_HAVE = 8385,
+ ERROR_DS_EXISTS_IN_MAY_HAVE = 8386,
+ ERROR_DS_NONEXISTENT_MAY_HAVE = 8387,
+ ERROR_DS_NONEXISTENT_MUST_HAVE = 8388,
+ ERROR_DS_AUX_CLS_TEST_FAIL = 8389,
+ ERROR_DS_NONEXISTENT_POSS_SUP = 8390,
+ ERROR_DS_SUB_CLS_TEST_FAIL = 8391,
+ ERROR_DS_BAD_RDN_ATT_ID_SYNTAX = 8392,
+ ERROR_DS_EXISTS_IN_AUX_CLS = 8393,
+ ERROR_DS_EXISTS_IN_SUB_CLS = 8394,
+ ERROR_DS_EXISTS_IN_POSS_SUP = 8395,
+ ERROR_DS_RECALCSCHEMA_FAILED = 8396,
+ ERROR_DS_TREE_DELETE_NOT_FINISHED = 8397,
+ ERROR_DS_CANT_DELETE = 8398,
+ ERROR_DS_ATT_SCHEMA_REQ_ID = 8399,
+ ERROR_DS_BAD_ATT_SCHEMA_SYNTAX = 8400,
+ ERROR_DS_CANT_CACHE_ATT = 8401,
+ ERROR_DS_CANT_CACHE_CLASS = 8402,
+ ERROR_DS_CANT_REMOVE_ATT_CACHE = 8403,
+ ERROR_DS_CANT_REMOVE_CLASS_CACHE = 8404,
+ ERROR_DS_CANT_RETRIEVE_DN = 8405,
+ ERROR_DS_MISSING_SUPREF = 8406,
+ ERROR_DS_CANT_RETRIEVE_INSTANCE = 8407,
+ ERROR_DS_CODE_INCONSISTENCY = 8408,
+ ERROR_DS_DATABASE_ERROR = 8409,
+ ERROR_DS_GOVERNSID_MISSING = 8410,
+ ERROR_DS_MISSING_EXPECTED_ATT = 8411,
+ ERROR_DS_NCNAME_MISSING_CR_REF = 8412,
+ ERROR_DS_SECURITY_CHECKING_ERROR = 8413,
+ ERROR_DS_SCHEMA_NOT_LOADED = 8414,
+ ERROR_DS_SCHEMA_ALLOC_FAILED = 8415,
+ ERROR_DS_ATT_SCHEMA_REQ_SYNTAX = 8416,
+ ERROR_DS_GCVERIFY_ERROR = 8417,
+ ERROR_DS_DRA_SCHEMA_MISMATCH = 8418,
+ ERROR_DS_CANT_FIND_DSA_OBJ = 8419,
+ ERROR_DS_CANT_FIND_EXPECTED_NC = 8420,
+ ERROR_DS_CANT_FIND_NC_IN_CACHE = 8421,
+ ERROR_DS_CANT_RETRIEVE_CHILD = 8422,
+ ERROR_DS_SECURITY_ILLEGAL_MODIFY = 8423,
+ ERROR_DS_CANT_REPLACE_HIDDEN_REC = 8424,
+ ERROR_DS_BAD_HIERARCHY_FILE = 8425,
+ ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED = 8426,
+ ERROR_DS_CONFIG_PARAM_MISSING = 8427,
+ ERROR_DS_COUNTING_AB_INDICES_FAILED = 8428,
+ ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED = 8429,
+ ERROR_DS_INTERNAL_FAILURE = 8430,
+ ERROR_DS_UNKNOWN_ERROR = 8431,
+ ERROR_DS_ROOT_REQUIRES_CLASS_TOP = 8432,
+ ERROR_DS_REFUSING_FSMO_ROLES = 8433,
+ ERROR_DS_MISSING_FSMO_SETTINGS = 8434,
+ ERROR_DS_UNABLE_TO_SURRENDER_ROLES = 8435,
+ ERROR_DS_DRA_GENERIC = 8436,
+ ERROR_DS_DRA_INVALID_PARAMETER = 8437,
+ ERROR_DS_DRA_BUSY = 8438,
+ ERROR_DS_DRA_BAD_DN = 8439,
+ ERROR_DS_DRA_BAD_NC = 8440,
+ ERROR_DS_DRA_DN_EXISTS = 8441,
+ ERROR_DS_DRA_INTERNAL_ERROR = 8442,
+ ERROR_DS_DRA_INCONSISTENT_DIT = 8443,
+ ERROR_DS_DRA_CONNECTION_FAILED = 8444,
+ ERROR_DS_DRA_BAD_INSTANCE_TYPE = 8445,
+ ERROR_DS_DRA_OUT_OF_MEM = 8446,
+ ERROR_DS_DRA_MAIL_PROBLEM = 8447,
+ ERROR_DS_DRA_REF_ALREADY_EXISTS = 8448,
+ ERROR_DS_DRA_REF_NOT_FOUND = 8449,
+ ERROR_DS_DRA_OBJ_IS_REP_SOURCE = 8450,
+ ERROR_DS_DRA_DB_ERROR = 8451,
+ ERROR_DS_DRA_NO_REPLICA = 8452,
+ ERROR_DS_DRA_ACCESS_DENIED = 8453,
+ ERROR_DS_DRA_NOT_SUPPORTED = 8454,
+ ERROR_DS_DRA_RPC_CANCELLED = 8455,
+ ERROR_DS_DRA_SOURCE_DISABLED = 8456,
+ ERROR_DS_DRA_SINK_DISABLED = 8457,
+ ERROR_DS_DRA_NAME_COLLISION = 8458,
+ ERROR_DS_DRA_SOURCE_REINSTALLED = 8459,
+ ERROR_DS_DRA_MISSING_PARENT = 8460,
+ ERROR_DS_DRA_PREEMPTED = 8461,
+ ERROR_DS_DRA_ABANDON_SYNC = 8462,
+ ERROR_DS_DRA_SHUTDOWN = 8463,
+ ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET = 8464,
+ ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA = 8465,
+ ERROR_DS_DRA_EXTN_CONNECTION_FAILED = 8466,
+ ERROR_DS_INSTALL_SCHEMA_MISMATCH = 8467,
+ ERROR_DS_DUP_LINK_ID = 8468,
+ ERROR_DS_NAME_ERROR_RESOLVING = 8469,
+ ERROR_DS_NAME_ERROR_NOT_FOUND = 8470,
+ ERROR_DS_NAME_ERROR_NOT_UNIQUE = 8471,
+ ERROR_DS_NAME_ERROR_NO_MAPPING = 8472,
+ ERROR_DS_NAME_ERROR_DOMAIN_ONLY = 8473,
+ ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 8474,
+ ERROR_DS_CONSTRUCTED_ATT_MOD = 8475,
+ ERROR_DS_WRONG_OM_OBJ_CLASS = 8476,
+ ERROR_DS_DRA_REPL_PENDING = 8477,
+ ERROR_DS_DS_REQUIRED = 8478,
+ ERROR_DS_INVALID_LDAP_DISPLAY_NAME = 8479,
+ ERROR_DS_NON_BASE_SEARCH = 8480,
+ ERROR_DS_CANT_RETRIEVE_ATTS = 8481,
+ ERROR_DS_BACKLINK_WITHOUT_LINK = 8482,
+ ERROR_DS_EPOCH_MISMATCH = 8483,
+ ERROR_DS_SRC_NAME_MISMATCH = 8484,
+ ERROR_DS_SRC_AND_DST_NC_IDENTICAL = 8485,
+ ERROR_DS_DST_NC_MISMATCH = 8486,
+ ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC = 8487,
+ ERROR_DS_SRC_GUID_MISMATCH = 8488,
+ ERROR_DS_CANT_MOVE_DELETED_OBJECT = 8489,
+ ERROR_DS_PDC_OPERATION_IN_PROGRESS = 8490,
+ ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD = 8491,
+ ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION = 8492,
+ ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS = 8493,
+ ERROR_DS_NC_MUST_HAVE_NC_PARENT = 8494,
+ ERROR_DS_DST_DOMAIN_NOT_NATIVE = 8496,
+ ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER = 8497,
+ ERROR_DS_CANT_MOVE_ACCOUNT_GROUP = 8498,
+ ERROR_DS_CANT_MOVE_RESOURCE_GROUP = 8499,
+ ERROR_DS_INVALID_SEARCH_FLAG = 8500,
+ ERROR_DS_NO_TREE_DELETE_ABOVE_NC = 8501,
+ ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE = 8502,
+ ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE = 8503,
+ ERROR_DS_SAM_INIT_FAILURE = 8504,
+ ERROR_DS_SENSITIVE_GROUP_VIOLATION = 8505,
+ ERROR_DS_CANT_MOD_PRIMARYGROUPID = 8506,
+ ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD = 8507,
+ ERROR_DS_NONSAFE_SCHEMA_CHANGE = 8508,
+ ERROR_DS_SCHEMA_UPDATE_DISALLOWED = 8509,
+ ERROR_DS_CANT_CREATE_UNDER_SCHEMA = 8510,
+ ERROR_DS_INSTALL_NO_SRC_SCH_VERSION = 8511,
+ ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE = 8512,
+ ERROR_DS_INVALID_GROUP_TYPE = 8513,
+ ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = 8514,
+ ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = 8515,
+ ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = 8516,
+ ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = 8517,
+ ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = 8518,
+ ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = 8519,
+ ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = 8520,
+ ERROR_DS_HAVE_PRIMARY_MEMBERS = 8521,
+ ERROR_DS_STRING_SD_CONVERSION_FAILED = 8522,
+ ERROR_DS_NAMING_MASTER_GC = 8523,
+ ERROR_DS_LOOKUP_FAILURE = 8524,
+ ERROR_DS_COULDNT_UPDATE_SPNS = 8525,
+ ERROR_DS_CANT_RETRIEVE_SD = 8526,
+ ERROR_DS_KEY_NOT_UNIQUE = 8527,
+ ERROR_DS_WRONG_LINKED_ATT_SYNTAX = 8528,
+ ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD = 8529,
+ ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY = 8530,
+ ERROR_DS_CANT_START = 8531,
+ ERROR_DS_INIT_FAILURE = 8532,
+ ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION = 8533,
+ ERROR_DS_SOURCE_DOMAIN_IN_FOREST = 8534,
+ ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST = 8535,
+ ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED = 8536,
+ ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN = 8537,
+ ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER = 8538,
+ ERROR_DS_SRC_SID_EXISTS_IN_FOREST = 8539,
+ ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH = 8540,
+ ERROR_SAM_INIT_FAILURE = 8541,
+ ERROR_DS_DRA_SCHEMA_INFO_SHIP = 8542,
+ ERROR_DS_DRA_SCHEMA_CONFLICT = 8543,
+ ERROR_DS_DRA_EARLIER_SCHEMA_CONLICT = 8544,
+ ERROR_DS_DRA_OBJ_NC_MISMATCH = 8545,
+ ERROR_DS_NC_STILL_HAS_DSAS = 8546,
+ ERROR_DS_GC_REQUIRED = 8547,
+ ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY = 8548,
+ ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS = 8549,
+ ERROR_DS_CANT_ADD_TO_GC = 8550,
+ ERROR_DS_NO_CHECKPOINT_WITH_PDC = 8551,
+ ERROR_DS_SOURCE_AUDITING_NOT_ENABLED = 8552,
+ ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC = 8553,
+ ERROR_DS_INVALID_NAME_FOR_SPN = 8554,
+ ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS = 8555,
+ ERROR_DS_UNICODEPWD_NOT_IN_QUOTES = 8556,
+ ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = 8557,
+ ERROR_DS_MUST_BE_RUN_ON_DST_DC = 8558,
+ ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER = 8559,
+ ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ = 8560,
+ ERROR_DS_INIT_FAILURE_CONSOLE = 8561,
+ ERROR_DS_SAM_INIT_FAILURE_CONSOLE = 8562,
+ ERROR_DS_FOREST_VERSION_TOO_HIGH = 8563,
+ ERROR_DS_DOMAIN_VERSION_TOO_HIGH = 8564,
+ ERROR_DS_FOREST_VERSION_TOO_LOW = 8565,
+ ERROR_DS_DOMAIN_VERSION_TOO_LOW = 8566,
+ ERROR_DS_INCOMPATIBLE_VERSION = 8567,
+ ERROR_DS_LOW_DSA_VERSION = 8568,
+ ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN = 8569,
+ ERROR_DS_NOT_SUPPORTED_SORT_ORDER = 8570,
+ ERROR_DS_NAME_NOT_UNIQUE = 8571,
+ ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 = 8572,
+ ERROR_DS_OUT_OF_VERSION_STORE = 8573,
+ ERROR_DS_INCOMPATIBLE_CONTROLS_USED = 8574,
+ ERROR_DS_NO_REF_DOMAIN = 8575,
+ ERROR_DS_RESERVED_LINK_ID = 8576,
+ ERROR_DS_LINK_ID_NOT_AVAILABLE = 8577,
+ ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = 8578,
+ ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE = 8579,
+ ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC = 8580,
+ ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG = 8581,
+ ERROR_DS_MODIFYDN_WRONG_GRANDPARENT = 8582,
+ ERROR_DS_NAME_ERROR_TRUST_REFERRAL = 8583,
+ ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER = 8584,
+ ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD = 8585,
+ ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE = 8586,
+ ERROR_DS_THREAD_LIMIT_EXCEEDED = 8587,
+ ERROR_DS_NOT_CLOSEST = 8588,
+ ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF = 8589,
+ ERROR_DS_SINGLE_USER_MODE_FAILED = 8590,
+ ERROR_DS_NTDSCRIPT_SYNTAX_ERROR = 8591,
+ ERROR_DS_NTDSCRIPT_PROCESS_ERROR = 8592,
+ ERROR_DS_DIFFERENT_REPL_EPOCHS = 8593,
+ ERROR_DS_DRS_EXTENSIONS_CHANGED = 8594,
+ ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR = 8595,
+ ERROR_DS_NO_MSDS_INTID = 8596,
+ ERROR_DS_DUP_MSDS_INTID = 8597,
+ ERROR_DS_EXISTS_IN_RDNATTID = 8598,
+ ERROR_DS_AUTHORIZATION_FAILED = 8599,
+ ERROR_DS_INVALID_SCRIPT = 8600,
+ ERROR_DS_REMOTE_CROSSREF_OP_FAILED = 8601,
+ DNS_ERROR_RCODE_FORMAT_ERROR = 9001,
+ DNS_ERROR_RCODE_SERVER_FAILURE = 9002,
+ DNS_ERROR_RCODE_NAME_ERROR = 9003,
+ DNS_ERROR_RCODE_NOT_IMPLEMENTED = 9004,
+ DNS_ERROR_RCODE_REFUSED = 9005,
+ DNS_ERROR_RCODE_YXDOMAIN = 9006,
+ DNS_ERROR_RCODE_YXRRSET = 9007,
+ DNS_ERROR_RCODE_NXRRSET = 9008,
+ DNS_ERROR_RCODE_NOTAUTH = 9009,
+ DNS_ERROR_RCODE_NOTZONE = 9010,
+ DNS_ERROR_RCODE_BADSIG = 9016,
+ DNS_ERROR_RCODE_BADKEY = 9017,
+ DNS_ERROR_RCODE_BADTIME = 9018,
+ DNS_INFO_NO_RECORDS = 9501,
+ DNS_ERROR_BAD_PACKET = 9502,
+ DNS_ERROR_NO_PACKET = 9503,
+ DNS_ERROR_RCODE = 9504,
+ DNS_ERROR_UNSECURE_PACKET = 9505,
+ DNS_ERROR_INVALID_TYPE = 9551,
+ DNS_ERROR_INVALID_IP_ADDRESS = 9552,
+ DNS_ERROR_INVALID_PROPERTY = 9553,
+ DNS_ERROR_TRY_AGAIN_LATER = 9554,
+ DNS_ERROR_NOT_UNIQUE = 9555,
+ DNS_ERROR_NON_RFC_NAME = 9556,
+ DNS_STATUS_FQDN = 9557,
+ DNS_STATUS_DOTTED_NAME = 9558,
+ DNS_STATUS_SINGLE_PART_NAME = 9559,
+ DNS_ERROR_INVALID_NAME_CHAR = 9560,
+ DNS_ERROR_NUMERIC_NAME = 9561,
+ DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER = 9562,
+ DNS_ERROR_ZONE_DOES_NOT_EXIST = 9601,
+ DNS_ERROR_NO_ZONE_INFO = 9602,
+ DNS_ERROR_INVALID_ZONE_OPERATION = 9603,
+ DNS_ERROR_ZONE_CONFIGURATION_ERROR = 9604,
+ DNS_ERROR_ZONE_HAS_NO_SOA_RECORD = 9605,
+ DNS_ERROR_ZONE_HAS_NO_NS_RECORDS = 9606,
+ DNS_ERROR_ZONE_LOCKED = 9607,
+ DNS_ERROR_ZONE_CREATION_FAILED = 9608,
+ DNS_ERROR_ZONE_ALREADY_EXISTS = 9609,
+ DNS_ERROR_AUTOZONE_ALREADY_EXISTS = 9610,
+ DNS_ERROR_INVALID_ZONE_TYPE = 9611,
+ DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP = 9612,
+ DNS_ERROR_ZONE_NOT_SECONDARY = 9613,
+ DNS_ERROR_NEED_SECONDARY_ADDRESSES = 9614,
+ DNS_ERROR_WINS_INIT_FAILED = 9615,
+ DNS_ERROR_NEED_WINS_SERVERS = 9616,
+ DNS_ERROR_NBSTAT_INIT_FAILED = 9617,
+ DNS_ERROR_SOA_DELETE_INVALID = 9618,
+ DNS_ERROR_FORWARDER_ALREADY_EXISTS = 9619,
+ DNS_ERROR_ZONE_REQUIRES_MASTER_IP = 9620,
+ DNS_ERROR_ZONE_IS_SHUTDOWN = 9621,
+ DNS_ERROR_PRIMARY_REQUIRES_DATAFILE = 9651,
+ DNS_ERROR_INVALID_DATAFILE_NAME = 9652,
+ DNS_ERROR_DATAFILE_OPEN_FAILURE = 9653,
+ DNS_ERROR_FILE_WRITEBACK_FAILED = 9654,
+ DNS_ERROR_DATAFILE_PARSING = 9655,
+ DNS_ERROR_RECORD_DOES_NOT_EXIST = 9701,
+ DNS_ERROR_RECORD_FORMAT = 9702,
+ DNS_ERROR_NODE_CREATION_FAILED = 9703,
+ DNS_ERROR_UNKNOWN_RECORD_TYPE = 9704,
+ DNS_ERROR_RECORD_TIMED_OUT = 9705,
+ DNS_ERROR_NAME_NOT_IN_ZONE = 9706,
+ DNS_ERROR_CNAME_LOOP = 9707,
+ DNS_ERROR_NODE_IS_CNAME = 9708,
+ DNS_ERROR_CNAME_COLLISION = 9709,
+ DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT = 9710,
+ DNS_ERROR_RECORD_ALREADY_EXISTS = 9711,
+ DNS_ERROR_SECONDARY_DATA = 9712,
+ DNS_ERROR_NO_CREATE_CACHE_DATA = 9713,
+ DNS_ERROR_NAME_DOES_NOT_EXIST = 9714,
+ DNS_WARNING_PTR_CREATE_FAILED = 9715,
+ DNS_WARNING_DOMAIN_UNDELETED = 9716,
+ DNS_ERROR_DS_UNAVAILABLE = 9717,
+ DNS_ERROR_DS_ZONE_ALREADY_EXISTS = 9718,
+ DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE = 9719,
+ DNS_INFO_AXFR_COMPLETE = 9751,
+ DNS_ERROR_AXFR = 9752,
+ DNS_INFO_ADDED_LOCAL_WINS = 9753,
+ DNS_STATUS_CONTINUE_NEEDED = 9801,
+ DNS_ERROR_NO_TCPIP = 9851,
+ DNS_ERROR_NO_DNS_SERVERS = 9852,
+ DNS_ERROR_DP_DOES_NOT_EXIST = 9901,
+ DNS_ERROR_DP_ALREADY_EXISTS = 9902,
+ DNS_ERROR_DP_NOT_ENLISTED = 9903,
+ DNS_ERROR_DP_ALREADY_ENLISTED = 9904,
+ WSAEINTR = 10004,
+ WSAEBADF = 10009,
+ WSAEACCES = 10013,
+ WSAEFAULT = 10014,
+ WSAEINVAL = 10022,
+ WSAEMFILE = 10024,
+ WSAEWOULDBLOCK = 10035,
+ WSAEINPROGRESS = 10036,
+ WSAEALREADY = 10037,
+ WSAENOTSOCK = 10038,
+ WSAEDESTADDRREQ = 10039,
+ WSAEMSGSIZE = 10040,
+ WSAEPROTOTYPE = 10041,
+ WSAENOPROTOOPT = 10042,
+ WSAEPROTONOSUPPORT = 10043,
+ WSAESOCKTNOSUPPORT = 10044,
+ WSAEOPNOTSUPP = 10045,
+ WSAEPFNOSUPPORT = 10046,
+ WSAEAFNOSUPPORT = 10047,
+ WSAEADDRINUSE = 10048,
+ WSAEADDRNOTAVAIL = 10049,
+ WSAENETDOWN = 10050,
+ WSAENETUNREACH = 10051,
+ WSAENETRESET = 10052,
+ WSAECONNABORTED = 10053,
+ WSAECONNRESET = 10054,
+ WSAENOBUFS = 10055,
+ WSAEISCONN = 10056,
+ WSAENOTCONN = 10057,
+ WSAESHUTDOWN = 10058,
+ WSAETOOMANYREFS = 10059,
+ WSAETIMEDOUT = 10060,
+ WSAECONNREFUSED = 10061,
+ WSAELOOP = 10062,
+ WSAENAMETOOLONG = 10063,
+ WSAEHOSTDOWN = 10064,
+ WSAEHOSTUNREACH = 10065,
+ WSAENOTEMPTY = 10066,
+ WSAEPROCLIM = 10067,
+ WSAEUSERS = 10068,
+ WSAEDQUOT = 10069,
+ WSAESTALE = 10070,
+ WSAEREMOTE = 10071,
+ WSASYSNOTREADY = 10091,
+ WSAVERNOTSUPPORTED = 10092,
+ WSANOTINITIALISED = 10093,
+ WSAEDISCON = 10101,
+ WSAENOMORE = 10102,
+ WSAECANCELLED = 10103,
+ WSAEINVALIDPROCTABLE = 10104,
+ WSAEINVALIDPROVIDER = 10105,
+ WSAEPROVIDERFAILEDINIT = 10106,
+ WSASYSCALLFAILURE = 10107,
+ WSASERVICE_NOT_FOUND = 10108,
+ WSATYPE_NOT_FOUND = 10109,
+ WSA_E_NO_MORE = 10110,
+ WSA_E_CANCELLED = 10111,
+ WSAEREFUSED = 10112,
+ WSAHOST_NOT_FOUND = 11001,
+ WSATRY_AGAIN = 11002,
+ WSANO_RECOVERY = 11003,
+ WSANO_DATA = 11004,
+ WSA_QOS_RECEIVERS = 11005,
+ WSA_QOS_SENDERS = 11006,
+ WSA_QOS_NO_SENDERS = 11007,
+ WSA_QOS_NO_RECEIVERS = 11008,
+ WSA_QOS_REQUEST_CONFIRMED = 11009,
+ WSA_QOS_ADMISSION_FAILURE = 11010,
+ WSA_QOS_POLICY_FAILURE = 11011,
+ WSA_QOS_BAD_STYLE = 11012,
+ WSA_QOS_BAD_OBJECT = 11013,
+ WSA_QOS_TRAFFIC_CTRL_ERROR = 11014,
+ WSA_QOS_GENERIC_ERROR = 11015,
+ WSA_QOS_ESERVICETYPE = 11016,
+ WSA_QOS_EFLOWSPEC = 11017,
+ WSA_QOS_EPROVSPECBUF = 11018,
+ WSA_QOS_EFILTERSTYLE = 11019,
+ WSA_QOS_EFILTERTYPE = 11020,
+ WSA_QOS_EFILTERCOUNT = 11021,
+ WSA_QOS_EOBJLENGTH = 11022,
+ WSA_QOS_EFLOWCOUNT = 11023,
+ WSA_QOS_EUNKNOWNPSOBJ = 11024,
+ WSA_QOS_EPOLICYOBJ = 11025,
+ WSA_QOS_EFLOWDESC = 11026,
+ WSA_QOS_EPSFLOWSPEC = 11027,
+ WSA_QOS_EPSFILTERSPEC = 11028,
+ WSA_QOS_ESDMODEOBJ = 11029,
+ WSA_QOS_ESHAPERATEOBJ = 11030,
+ WSA_QOS_RESERVED_PETYPE = 11031,
+ ERROR_IPSEC_QM_POLICY_EXISTS = 13000,
+ ERROR_IPSEC_QM_POLICY_NOT_FOUND = 13001,
+ ERROR_IPSEC_QM_POLICY_IN_USE = 13002,
+ ERROR_IPSEC_MM_POLICY_EXISTS = 13003,
+ ERROR_IPSEC_MM_POLICY_NOT_FOUND = 13004,
+ ERROR_IPSEC_MM_POLICY_IN_USE = 13005,
+ ERROR_IPSEC_MM_FILTER_EXISTS = 13006,
+ ERROR_IPSEC_MM_FILTER_NOT_FOUND = 13007,
+ ERROR_IPSEC_TRANSPORT_FILTER_EXISTS = 13008,
+ ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND = 13009,
+ ERROR_IPSEC_MM_AUTH_EXISTS = 13010,
+ ERROR_IPSEC_MM_AUTH_NOT_FOUND = 13011,
+ ERROR_IPSEC_MM_AUTH_IN_USE = 13012,
+ ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND = 13013,
+ ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND = 13014,
+ ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND = 13015,
+ ERROR_IPSEC_TUNNEL_FILTER_EXISTS = 13016,
+ ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND = 13017,
+ ERROR_IPSEC_MM_FILTER_PENDING_DELETION = 13018,
+ ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION = 13019,
+ ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION = 13020,
+ ERROR_IPSEC_MM_POLICY_PENDING_DELETION = 13021,
+ ERROR_IPSEC_MM_AUTH_PENDING_DELETION = 13022,
+ ERROR_IPSEC_QM_POLICY_PENDING_DELETION = 13023,
+ ERROR_IPSEC_IKE_AUTH_FAIL = 13801,
+ ERROR_IPSEC_IKE_ATTRIB_FAIL = 13802,
+ ERROR_IPSEC_IKE_NEGOTIATION_PENDING = 13803,
+ ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR = 13804,
+ ERROR_IPSEC_IKE_TIMED_OUT = 13805,
+ ERROR_IPSEC_IKE_NO_CERT = 13806,
+ ERROR_IPSEC_IKE_SA_DELETED = 13807,
+ ERROR_IPSEC_IKE_SA_REAPED = 13808,
+ ERROR_IPSEC_IKE_MM_ACQUIRE_DROP = 13809,
+ ERROR_IPSEC_IKE_QM_ACQUIRE_DROP = 13810,
+ ERROR_IPSEC_IKE_QUEUE_DROP_MM = 13811,
+ ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM = 13812,
+ ERROR_IPSEC_IKE_DROP_NO_RESPONSE = 13813,
+ ERROR_IPSEC_IKE_MM_DELAY_DROP = 13814,
+ ERROR_IPSEC_IKE_QM_DELAY_DROP = 13815,
+ ERROR_IPSEC_IKE_ERROR = 13816,
+ ERROR_IPSEC_IKE_CRL_FAILED = 13817,
+ ERROR_IPSEC_IKE_INVALID_KEY_USAGE = 13818,
+ ERROR_IPSEC_IKE_INVALID_CERT_TYPE = 13819,
+ ERROR_IPSEC_IKE_NO_PRIVATE_KEY = 13820,
+ ERROR_IPSEC_IKE_DH_FAIL = 13822,
+ ERROR_IPSEC_IKE_INVALID_HEADER = 13824,
+ ERROR_IPSEC_IKE_NO_POLICY = 13825,
+ ERROR_IPSEC_IKE_INVALID_SIGNATURE = 13826,
+ ERROR_IPSEC_IKE_KERBEROS_ERROR = 13827,
+ ERROR_IPSEC_IKE_NO_PUBLIC_KEY = 13828,
+ ERROR_IPSEC_IKE_PROCESS_ERR = 13829,
+ ERROR_IPSEC_IKE_PROCESS_ERR_SA = 13830,
+ ERROR_IPSEC_IKE_PROCESS_ERR_PROP = 13831,
+ ERROR_IPSEC_IKE_PROCESS_ERR_TRANS = 13832,
+ ERROR_IPSEC_IKE_PROCESS_ERR_KE = 13833,
+ ERROR_IPSEC_IKE_PROCESS_ERR_ID = 13834,
+ ERROR_IPSEC_IKE_PROCESS_ERR_CERT = 13835,
+ ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ = 13836,
+ ERROR_IPSEC_IKE_PROCESS_ERR_HASH = 13837,
+ ERROR_IPSEC_IKE_PROCESS_ERR_SIG = 13838,
+ ERROR_IPSEC_IKE_PROCESS_ERR_NONCE = 13839,
+ ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY = 13840,
+ ERROR_IPSEC_IKE_PROCESS_ERR_DELETE = 13841,
+ ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR = 13842,
+ ERROR_IPSEC_IKE_INVALID_PAYLOAD = 13843,
+ ERROR_IPSEC_IKE_LOAD_SOFT_SA = 13844,
+ ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN = 13845,
+ ERROR_IPSEC_IKE_INVALID_COOKIE = 13846,
+ ERROR_IPSEC_IKE_NO_PEER_CERT = 13847,
+ ERROR_IPSEC_IKE_PEER_CRL_FAILED = 13848,
+ ERROR_IPSEC_IKE_POLICY_CHANGE = 13849,
+ ERROR_IPSEC_IKE_NO_MM_POLICY = 13850,
+ ERROR_IPSEC_IKE_NOTCBPRIV = 13851,
+ ERROR_IPSEC_IKE_SECLOADFAIL = 13852,
+ ERROR_IPSEC_IKE_FAILSSPINIT = 13853,
+ ERROR_IPSEC_IKE_FAILQUERYSSP = 13854,
+ ERROR_IPSEC_IKE_SRVACQFAIL = 13855,
+ ERROR_IPSEC_IKE_SRVQUERYCRED = 13856,
+ ERROR_IPSEC_IKE_GETSPIFAIL = 13857,
+ ERROR_IPSEC_IKE_INVALID_FILTER = 13858,
+ ERROR_IPSEC_IKE_OUT_OF_MEMORY = 13859,
+ ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED = 13860,
+ ERROR_IPSEC_IKE_INVALID_POLICY = 13861,
+ ERROR_IPSEC_IKE_UNKNOWN_DOI = 13862,
+ ERROR_IPSEC_IKE_INVALID_SITUATION = 13863,
+ ERROR_IPSEC_IKE_DH_FAILURE = 13864,
+ ERROR_IPSEC_IKE_INVALID_GROUP = 13865,
+ ERROR_IPSEC_IKE_ENCRYPT = 13866,
+ ERROR_IPSEC_IKE_DECRYPT = 13867,
+ ERROR_IPSEC_IKE_POLICY_MATCH = 13868,
+ ERROR_IPSEC_IKE_UNSUPPORTED_ID = 13869,
+ ERROR_IPSEC_IKE_INVALID_HASH = 13870,
+ ERROR_IPSEC_IKE_INVALID_HASH_ALG = 13871,
+ ERROR_IPSEC_IKE_INVALID_HASH_SIZE = 13872,
+ ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG = 13873,
+ ERROR_IPSEC_IKE_INVALID_AUTH_ALG = 13874,
+ ERROR_IPSEC_IKE_INVALID_SIG = 13875,
+ ERROR_IPSEC_IKE_LOAD_FAILED = 13876,
+ ERROR_IPSEC_IKE_RPC_DELETE = 13877,
+ ERROR_IPSEC_IKE_BENIGN_REINIT = 13878,
+ ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY = 13879,
+ ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN = 13881,
+ ERROR_IPSEC_IKE_MM_LIMIT = 13882,
+ ERROR_IPSEC_IKE_NEGOTIATION_DISABLED = 13883,
+ ERROR_IPSEC_IKE_NEG_STATUS_END = 13884,
+ ERROR_SXS_SECTION_NOT_FOUND = 14000,
+ ERROR_SXS_CANT_GEN_ACTCTX = 14001,
+ ERROR_SXS_INVALID_ACTCTXDATA_FORMAT = 14002,
+ ERROR_SXS_ASSEMBLY_NOT_FOUND = 14003,
+ ERROR_SXS_MANIFEST_FORMAT_ERROR = 14004,
+ ERROR_SXS_MANIFEST_PARSE_ERROR = 14005,
+ ERROR_SXS_ACTIVATION_CONTEXT_DISABLED = 14006,
+ ERROR_SXS_KEY_NOT_FOUND = 14007,
+ ERROR_SXS_VERSION_CONFLICT = 14008,
+ ERROR_SXS_WRONG_SECTION_TYPE = 14009,
+ ERROR_SXS_THREAD_QUERIES_DISABLED = 14010,
+ ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET = 14011,
+ ERROR_SXS_UNKNOWN_ENCODING_GROUP = 14012,
+ ERROR_SXS_UNKNOWN_ENCODING = 14013,
+ ERROR_SXS_INVALID_XML_NAMESPACE_URI = 14014,
+ ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14015,
+ ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14016,
+ ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE = 14017,
+ ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE = 14018,
+ ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE = 14019,
+ ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT = 14020,
+ ERROR_SXS_DUPLICATE_DLL_NAME = 14021,
+ ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME = 14022,
+ ERROR_SXS_DUPLICATE_CLSID = 14023,
+ ERROR_SXS_DUPLICATE_IID = 14024,
+ ERROR_SXS_DUPLICATE_TLBID = 14025,
+ ERROR_SXS_DUPLICATE_PROGID = 14026,
+ ERROR_SXS_DUPLICATE_ASSEMBLY_NAME = 14027,
+ ERROR_SXS_FILE_HASH_MISMATCH = 14028,
+ ERROR_SXS_POLICY_PARSE_ERROR = 14029,
+ ERROR_SXS_XML_E_MISSINGQUOTE = 14030,
+ ERROR_SXS_XML_E_COMMENTSYNTAX = 14031,
+ ERROR_SXS_XML_E_BADSTARTNAMECHAR = 14032,
+ ERROR_SXS_XML_E_BADNAMECHAR = 14033,
+ ERROR_SXS_XML_E_BADCHARINSTRING = 14034,
+ ERROR_SXS_XML_E_XMLDECLSYNTAX = 14035,
+ ERROR_SXS_XML_E_BADCHARDATA = 14036,
+ ERROR_SXS_XML_E_MISSINGWHITESPACE = 14037,
+ ERROR_SXS_XML_E_EXPECTINGTAGEND = 14038,
+ ERROR_SXS_XML_E_MISSINGSEMICOLON = 14039,
+ ERROR_SXS_XML_E_UNBALANCEDPAREN = 14040,
+ ERROR_SXS_XML_E_INTERNALERROR = 14041,
+ ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE = 14042,
+ ERROR_SXS_XML_E_INCOMPLETE_ENCODING = 14043,
+ ERROR_SXS_XML_E_MISSING_PAREN = 14044,
+ ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE = 14045,
+ ERROR_SXS_XML_E_MULTIPLE_COLONS = 14046,
+ ERROR_SXS_XML_E_INVALID_DECIMAL = 14047,
+ ERROR_SXS_XML_E_INVALID_HEXIDECIMAL = 14048,
+ ERROR_SXS_XML_E_INVALID_UNICODE = 14049,
+ ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK = 14050,
+ ERROR_SXS_XML_E_UNEXPECTEDENDTAG = 14051,
+ ERROR_SXS_XML_E_UNCLOSEDTAG = 14052,
+ ERROR_SXS_XML_E_DUPLICATEATTRIBUTE = 14053,
+ ERROR_SXS_XML_E_MULTIPLEROOTS = 14054,
+ ERROR_SXS_XML_E_INVALIDATROOTLEVEL = 14055,
+ ERROR_SXS_XML_E_BADXMLDECL = 14056,
+ ERROR_SXS_XML_E_MISSINGROOT = 14057,
+ ERROR_SXS_XML_E_UNEXPECTEDEOF = 14058,
+ ERROR_SXS_XML_E_BADPEREFINSUBSET = 14059,
+ ERROR_SXS_XML_E_UNCLOSEDSTARTTAG = 14060,
+ ERROR_SXS_XML_E_UNCLOSEDENDTAG = 14061,
+ ERROR_SXS_XML_E_UNCLOSEDSTRING = 14062,
+ ERROR_SXS_XML_E_UNCLOSEDCOMMENT = 14063,
+ ERROR_SXS_XML_E_UNCLOSEDDECL = 14064,
+ ERROR_SXS_XML_E_UNCLOSEDCDATA = 14065,
+ ERROR_SXS_XML_E_RESERVEDNAMESPACE = 14066,
+ ERROR_SXS_XML_E_INVALIDENCODING = 14067,
+ ERROR_SXS_XML_E_INVALIDSWITCH = 14068,
+ ERROR_SXS_XML_E_BADXMLCASE = 14069,
+ ERROR_SXS_XML_E_INVALID_STANDALONE = 14070,
+ ERROR_SXS_XML_E_UNEXPECTED_STANDALONE = 14071,
+ ERROR_SXS_XML_E_INVALID_VERSION = 14072,
+ ERROR_SXS_XML_E_MISSINGEQUALS = 14073,
+ ERROR_SXS_PROTECTION_RECOVERY_FAILED = 14074,
+ ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT = 14075,
+ ERROR_SXS_PROTECTION_CATALOG_NOT_VALID = 14076,
+ ERROR_SXS_UNTRANSLATABLE_HRESULT = 14077,
+ ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING = 14078,
+ ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE = 14079,
+ ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME = 14080,
+} WapiError;
+
+extern guint32 GetLastError(void);
+extern void SetLastError(guint32 code);
+
+#endif /* _WAPI_ERROR_H_ */
diff --git a/mono/io-layer/events.c b/mono/io-layer/events.c
new file mode 100644
index 00000000000..829f8b8e243
--- /dev/null
+++ b/mono/io-layer/events.c
@@ -0,0 +1,667 @@
+#include <config.h>
+#include <glib.h>
+#include <pthread.h>
+#include <string.h>
+
+#include "mono/io-layer/wapi.h"
+#include "wapi-private.h"
+#include "wait-private.h"
+#include "handles-private.h"
+#include "misc-private.h"
+
+#include "mono-mutex.h"
+
+#undef DEBUG
+
+/* event_wait() uses the event-private condition to signal that the
+ * event has been set
+ *
+ * Hold mutex before setting the event, and before the final test
+ * Hold rwlock for reading while testing the event
+ * Hold rwlock for writing before resetting the event
+ */
+struct _WapiHandle_event
+{
+ WapiHandle handle;
+ mono_mutex_t mutex;
+ pthread_cond_t cond;
+ pthread_rwlock_t rwlock;
+ gboolean manual;
+};
+
+/* event_wait_multiple() uses the global condition to signal that an
+ * event has been set
+ */
+static mono_mutex_t event_signal_mutex = MONO_MUTEX_INITIALIZER;
+static pthread_cond_t event_signal_cond = PTHREAD_COND_INITIALIZER;
+
+static void event_close(WapiHandle *handle);
+static gboolean event_wait(WapiHandle *handle, WapiHandle *signal, guint32 ms);
+static guint32 event_wait_multiple(gpointer data);
+static void event_signal(WapiHandle *handle);
+
+static struct _WapiHandleOps event_ops = {
+ event_close, /* close */
+ NULL, /* getfiletype */
+ NULL, /* readfile */
+ NULL, /* writefile */
+ NULL, /* flushfile */
+ NULL, /* seek */
+ NULL, /* setendoffile */
+ NULL, /* getfilesize */
+ NULL, /* getfiletime */
+ NULL, /* setfiletime */
+ event_wait, /* wait */
+ event_wait_multiple, /* wait_multiple */
+ event_signal, /* signal */
+};
+
+static void event_close(WapiHandle *handle)
+{
+ struct _WapiHandle_event *event_handle=(struct _WapiHandle_event *)handle;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": closing event handle %p",
+ event_handle);
+#endif
+
+ mono_mutex_destroy(&event_handle->mutex);
+ pthread_cond_destroy(&event_handle->cond);
+ pthread_rwlock_destroy(&event_handle->rwlock);
+}
+
+static gboolean event_wait(WapiHandle *handle, WapiHandle *signal, guint32 ms)
+{
+ struct _WapiHandle_event *event_handle=(struct _WapiHandle_event *)handle;
+ struct timespec timeout;
+ int ret;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": waiting on event handle %p for %d ms", handle, ms);
+#endif
+
+ mono_mutex_lock(&event_handle->mutex);
+
+ /* Signal this handle after we have obtained the event lock */
+ if(signal!=NULL) {
+ signal->ops->signal(signal);
+ }
+
+ /* First check if the handle is already signalled */
+ if(handle->signalled==TRUE) {
+ /* If this is an auto-reset event, reset the state to
+ * unsignalled
+ */
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": event handle %p already signalled", handle);
+#endif
+
+ if(event_handle->manual==FALSE) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": resetting auto event handle %p", handle);
+#endif
+ handle->signalled=FALSE;
+ }
+ mono_mutex_unlock(&event_handle->mutex);
+
+ return(TRUE);
+ }
+
+ /* We'll have to wait for it then */
+ if(ms!=INFINITE) {
+ _wapi_calc_timeout(&timeout, ms);
+ }
+
+again:
+ /* Acquire a read lock so that the signal status can't be
+ * reset without us noticing. (PulseEvent and ResetEvent will
+ * gain a write lock before changing the status to
+ * unsignalled, which will block while one or more threads
+ * hold a read lock.)
+ */
+ pthread_rwlock_rdlock(&event_handle->rwlock);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": waiting for event handle %p to be signalled", handle);
+#endif
+
+ if(ms==INFINITE) {
+ ret=mono_cond_wait(&event_handle->cond,
+ &event_handle->mutex);
+ } else {
+ ret=mono_cond_timedwait(&event_handle->cond,
+ &event_handle->mutex, &timeout);
+ }
+
+ if(ret==0) {
+ /* Condition was signalled, so hopefully event is
+ * signalled now. (It might not be if its an
+ * auto-reset event and someone else got in before
+ * us.)
+ */
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": event handle %p signalled",
+ handle);
+#endif
+ if(handle->signalled==TRUE) {
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": event handle %p still signalled", handle);
+#endif
+ /* If this is an auto-reset event, reset the
+ * state to unsignalled
+ */
+ if(event_handle->manual==FALSE) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": resetting auto event handle %p",
+ handle);
+#endif
+ handle->signalled=FALSE;
+ }
+ pthread_rwlock_unlock(&event_handle->rwlock);
+ mono_mutex_unlock(&event_handle->mutex);
+
+ return(TRUE);
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": event handle %p no longer signalled", handle);
+#endif
+
+ /* Better luck next time */
+
+ /* Drop the rwlock briefly so that another thread has
+ * a chance to reset the event
+ */
+ pthread_rwlock_unlock(&event_handle->rwlock);
+ goto again;
+ }
+
+ /* Timeout or other error */
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": wait on event handle %p error: %s", handle,
+ strerror(ret));
+#endif
+
+ pthread_rwlock_unlock(&event_handle->rwlock);
+ mono_mutex_unlock(&event_handle->mutex);
+
+ return(FALSE);
+}
+
+static gboolean event_count_signalled(WaitQueueItem *item, guint32 numhandles,
+ gboolean waitall, guint32 *retcount)
+{
+ guint32 count, i;
+ gboolean ret;
+
+ /* Lock all the handles, with backoff */
+again:
+ for(i=0; i<numhandles; i++) {
+ struct _WapiHandle_event *event_handle;
+
+ event_handle=g_ptr_array_index(
+ item->handles[WAPI_HANDLE_EVENT], i);
+
+ ret=mono_mutex_trylock(&event_handle->mutex);
+ if(ret!=0) {
+ /* Bummer */
+ while(i--) {
+ event_handle=g_ptr_array_index(
+ item->handles[WAPI_HANDLE_EVENT], i);
+ mono_mutex_unlock(&event_handle->mutex);
+ }
+
+ /* It's not possible for two threads calling
+ * WaitForMultipleObjects to both be calling
+ * this function simultaneously, because the
+ * global event_signal_mutex is held.
+ * Therefore any collision is with a single
+ * lock from one of the functions that deal
+ * with single event handles. It's just about
+ * theoretically possible for the other
+ * threads to keep locking an event in a tight
+ * loop but eventually we will get the lock.
+ */
+ sched_yield();
+
+ goto again;
+ }
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Locked all event handles");
+#endif
+
+ count=_wapi_handle_count_signalled(item, WAPI_HANDLE_EVENT);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": %d event handles signalled",
+ count);
+#endif
+
+ if((waitall==TRUE && count==numhandles) ||
+ (waitall==FALSE && count>0)) {
+ /* done */
+ ret=TRUE;
+ } else {
+ ret=FALSE;
+ }
+
+ for(i=0; i<numhandles; i++) {
+ struct _WapiHandle_event *event_handle;
+
+ event_handle=g_ptr_array_index(
+ item->handles[WAPI_HANDLE_EVENT], i);
+
+ mono_mutex_unlock(&event_handle->mutex);
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Returning %d", ret);
+#endif
+
+ *retcount=count;
+ return(ret);
+}
+
+static guint32 event_wait_multiple(gpointer data)
+{
+ WaitQueueItem *item=(WaitQueueItem *)data;
+ struct timespec timeout;
+ guint32 iterations;
+ guint32 numhandles, count, i;
+ gboolean done;
+ int ret;
+
+ numhandles=item->handles[WAPI_HANDLE_EVENT]->len;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": waiting on %d event handles for %d ms", numhandles,
+ item->timeout);
+#endif
+
+ /* First, check if any of the handles are already
+ * signalled. If waitall is specified we only return if all
+ * handles have been signalled.
+ */
+ done=event_count_signalled(item, numhandles, item->waitall, &count);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Preliminary check found %d handles signalled", count);
+#endif
+
+ if(done==TRUE) {
+ item->waited[WAPI_HANDLE_EVENT]=TRUE;
+ item->waitcount[WAPI_HANDLE_EVENT]=count;
+
+ return(count);
+ }
+
+ /* We'll have to wait then */
+
+ mono_mutex_lock(&event_signal_mutex);
+
+ iterations=0;
+ do {
+ iterations++;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Wait iteration %d",
+ iterations);
+#endif
+
+ /* If the timeout isnt INFINITE but greater than 1s,
+ * split the timeout into 1s chunks.
+ *
+ * This is so that ResetEvent() wont block forever if
+ * another thread is waiting on multiple events, with
+ * some already signalled, and ResetEvent() wants to
+ * reset one of the signalled ones. (1s is a bit of a
+ * long wait too, this might need to be tuned.)
+ */
+
+ if((item->timeout!=INFINITE) &&
+ (item->timeout < (iterations*1000))) {
+ _wapi_calc_timeout(
+ &timeout, item->timeout-((iterations-1)*1000));
+ } else {
+ _wapi_calc_timeout(&timeout, 1000);
+ }
+
+ /* Acquire a read lock on all handles so that the
+ * signal status can't be reset without us
+ * noticing. (PulseEvent and ResetEvent will gain a
+ * write lock before changing the status to
+ * unsignalled, which will block while one or more
+ * threads hold a read lock.)
+ */
+ for(i=0; i<numhandles; i++) {
+ struct _WapiHandle_event *event_handle;
+
+ event_handle=g_ptr_array_index(
+ item->handles[WAPI_HANDLE_EVENT], i);
+
+ pthread_rwlock_rdlock(&event_handle->rwlock);
+ }
+
+ ret=mono_cond_timedwait(&event_signal_cond,
+ &event_signal_mutex, &timeout);
+
+ if(ret==0) {
+ /* Condition was signalled, so hopefully an
+ * event is signalled now. (It might not be
+ * if it was an auto-reset event and someone
+ * else got in before us.)
+ */
+ done=event_count_signalled(item, numhandles,
+ item->waitall, &count);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": signal check found %d handles signalled",
+ count);
+#endif
+
+ if(done==TRUE) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Returning wait success");
+#endif
+
+ for(i=0; i<numhandles; i++) {
+ struct _WapiHandle_event *event_handle;
+
+ event_handle=g_ptr_array_index(item->handles[WAPI_HANDLE_EVENT], i);
+
+ pthread_rwlock_unlock(&event_handle->rwlock);
+ }
+
+ item->waited[WAPI_HANDLE_EVENT]=TRUE;
+ item->waitcount[WAPI_HANDLE_EVENT]=count;
+
+ return(count);
+ }
+ } else {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Wait error %s",
+ strerror(ret));
+#endif
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Still waiting for more event handles");
+#endif
+ /* Drop the rwlocks briefly so that another thread has
+ * a chance to reset any of the events
+ */
+ for(i=0; i<numhandles; i++) {
+ struct _WapiHandle_event *event_handle;
+
+ event_handle=g_ptr_array_index(
+ item->handles[WAPI_HANDLE_EVENT], i);
+
+ pthread_rwlock_unlock(&event_handle->rwlock);
+ }
+ } while((item->timeout==INFINITE) ||
+ (item->timeout > (iterations * 1000)));
+
+ /* Timeout or other error */
+
+ for(i=0; i<numhandles; i++) {
+ struct _WapiHandle_event *event_handle;
+
+ event_handle=g_ptr_array_index(
+ item->handles[WAPI_HANDLE_EVENT], i);
+
+ pthread_rwlock_unlock(&event_handle->rwlock);
+ }
+
+ mono_mutex_unlock(&event_signal_mutex);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Returning wait failed");
+#endif
+
+ item->waited[WAPI_HANDLE_EVENT]=TRUE;
+ item->waitcount[WAPI_HANDLE_MUTEX]=0;
+
+ return(0);
+}
+
+static void event_signal(WapiHandle *handle)
+{
+ ResetEvent(handle);
+}
+
+/**
+ * CreateEvent:
+ * @security: Ignored for now.
+ * @manual: Specifies whether the new event handle has manual or auto
+ * reset behaviour.
+ * @initial: Specifies whether the new event handle is initially
+ * signalled or not.
+ * @name:Pointer to a string specifying the name of this name, or
+ * %NULL. Currently ignored.
+ *
+ * Creates a new event handle.
+ *
+ * An event handle is signalled with SetEvent(). If the new handle is
+ * a manual reset event handle, it remains signalled until it is reset
+ * with ResetEvent(). An auto reset event remains signalled until a
+ * single thread has waited for it, at which time the event handle is
+ * automatically reset to unsignalled.
+ *
+ * Return value: A new handle, or %NULL on error.
+ */
+WapiHandle *CreateEvent(WapiSecurityAttributes *security G_GNUC_UNUSED, gboolean manual,
+ gboolean initial, const guchar *name G_GNUC_UNUSED)
+{
+ struct _WapiHandle_event *event_handle;
+ WapiHandle *handle;
+
+ event_handle=(struct _WapiHandle_event *)g_new0(struct _WapiHandle_event, 1);
+ handle=(WapiHandle *)event_handle;
+ _WAPI_HANDLE_INIT(handle, WAPI_HANDLE_EVENT, event_ops);
+
+ mono_mutex_init(&event_handle->mutex, NULL);
+ pthread_cond_init(&event_handle->cond, NULL);
+ pthread_rwlock_init(&event_handle->rwlock, NULL);
+ event_handle->manual=manual;
+
+ if(initial==TRUE) {
+ handle->signalled=TRUE;
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": created new event handle %p",
+ handle);
+#endif
+
+ return(handle);
+}
+
+/**
+ * PulseEvent:
+ * @handle: The event handle.
+ *
+ * Sets the event handle @handle to the signalled state, and then
+ * resets it to unsignalled after informing any waiting threads.
+ *
+ * If @handle is a manual reset event, all waiting threads that can be
+ * released immediately are released. @handle is then reset. If
+ * @handle is an auto reset event, one waiting thread is released even
+ * if multiple threads are waiting.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise. (Currently only
+ * ever returns %TRUE).
+ */
+gboolean PulseEvent(WapiHandle *handle)
+{
+ struct _WapiHandle_event *event_handle=(struct _WapiHandle_event *)handle;
+
+ mono_mutex_lock(&event_handle->mutex);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Pulsing event handle %p", handle);
+#endif
+
+ handle->signalled=TRUE;
+
+ /* Tell everyone blocking on WaitForSingleObject */
+ if(event_handle->manual==TRUE) {
+ pthread_cond_broadcast(&event_handle->cond);
+ } else {
+ pthread_cond_signal(&event_handle->cond);
+ }
+ mono_mutex_unlock(&event_handle->mutex);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Informed single waits for event handle %p", handle);
+#endif
+
+ /* Tell everyone blocking on WaitForMultipleObjects */
+ mono_mutex_lock(&event_signal_mutex);
+ pthread_cond_broadcast(&event_signal_cond);
+ mono_mutex_unlock(&event_signal_mutex);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Informed multiple waits for event handles");
+#endif
+
+ /* Reset the handle signal state */
+
+ /* This rwlock blocks until no other thread holds a read lock.
+ * This ensures that we can't reset the event until every
+ * waiting thread has had a chance to examine it
+ */
+ pthread_rwlock_wrlock(&event_handle->rwlock);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Obtained write lock on event handle %p", handle);
+#endif
+
+ handle->signalled=FALSE;
+ pthread_rwlock_unlock(&event_handle->rwlock);
+
+ return(TRUE);
+}
+
+/**
+ * ResetEvent:
+ * @handle: The event handle.
+ *
+ * Resets the event handle @handle to the unsignalled state.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise. (Currently only
+ * ever returns %TRUE).
+ */
+gboolean ResetEvent(WapiHandle *handle)
+{
+ struct _WapiHandle_event *event_handle=(struct _WapiHandle_event *)handle;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Resetting event handle %p",
+ handle);
+#endif
+
+ /* Test for the current state, because another thread might be
+ * waiting forever on an unsignalled event with the read lock
+ * held. Theres no point going for the write lock if we dont
+ * need it.
+ */
+ mono_mutex_lock(&event_handle->mutex);
+ if(handle->signalled==FALSE) {
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": No need to reset event handle %p", handle);
+#endif
+
+ mono_mutex_unlock(&event_handle->mutex);
+ return(TRUE);
+ }
+ mono_mutex_unlock(&event_handle->mutex);
+
+ pthread_rwlock_wrlock(&event_handle->rwlock);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Obtained write lock on event handle %p", handle);
+#endif
+
+ handle->signalled=FALSE;
+ pthread_rwlock_unlock(&event_handle->rwlock);
+
+ return(TRUE);
+}
+
+/**
+ * SetEvent:
+ * @handle: The event handle
+ *
+ * Sets the event handle @handle to the signalled state.
+ *
+ * If @handle is a manual reset event, it remains signalled until it
+ * is reset with ResetEvent(). An auto reset event remains signalled
+ * until a single thread has waited for it, at which time @handle is
+ * automatically reset to unsignalled.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise. (Currently only
+ * ever returns %TRUE).
+ */
+gboolean SetEvent(WapiHandle *handle)
+{
+ struct _WapiHandle_event *event_handle=(struct _WapiHandle_event *)handle;
+
+ mono_mutex_lock(&event_handle->mutex);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Setting event handle %p", handle);
+#endif
+
+ handle->signalled=TRUE;
+
+ /* Tell everyone blocking on WaitForSingleObject */
+ if(event_handle->manual==TRUE) {
+ pthread_cond_broadcast(&event_handle->cond);
+ } else {
+ pthread_cond_signal(&event_handle->cond);
+ }
+ mono_mutex_unlock(&event_handle->mutex);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Informed single waits for event handle %p", handle);
+#endif
+
+ /* Tell everyone blocking on WaitForMultipleObjects */
+ mono_mutex_lock(&event_signal_mutex);
+ pthread_cond_broadcast(&event_signal_cond);
+ mono_mutex_unlock(&event_signal_mutex);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Informed multiple waits for event handles");
+#endif
+
+ return(TRUE);
+}
+
diff --git a/mono/io-layer/events.h b/mono/io-layer/events.h
new file mode 100644
index 00000000000..e2e27c05ff9
--- /dev/null
+++ b/mono/io-layer/events.h
@@ -0,0 +1,11 @@
+#ifndef _WAPI_EVENTS_H_
+#define _WAPI_EVENTS_H_
+
+#include <glib.h>
+
+extern WapiHandle *CreateEvent(WapiSecurityAttributes *security, gboolean manual, gboolean initial, const guchar *name);
+extern gboolean PulseEvent(WapiHandle *handle);
+extern gboolean ResetEvent(WapiHandle *handle);
+extern gboolean SetEvent(WapiHandle *handle);
+
+#endif /* _WAPI_EVENTS_H_ */
diff --git a/mono/io-layer/handles-private.h b/mono/io-layer/handles-private.h
new file mode 100644
index 00000000000..fa7149ce2b8
--- /dev/null
+++ b/mono/io-layer/handles-private.h
@@ -0,0 +1,12 @@
+#ifndef _WAPI_HANDLES_PRIVATE_H_
+#define _WAPI_HANDLES_PRIVATE_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include "wait-private.h"
+
+extern guint32 _wapi_handle_count_signalled(WaitQueueItem *item, WapiHandleType type);
+extern void _wapi_handle_set_lowest(WaitQueueItem *item, guint32 idx);
+
+#endif /* _WAPI_HANDLES_PRIVATE_H_ */
diff --git a/mono/io-layer/handles.c b/mono/io-layer/handles.c
new file mode 100644
index 00000000000..4da579b1dd2
--- /dev/null
+++ b/mono/io-layer/handles.c
@@ -0,0 +1,166 @@
+#include <config.h>
+#include <glib.h>
+#include <pthread.h>
+
+#include "mono/io-layer/wapi.h"
+#include "wapi-private.h"
+#include "handles-private.h"
+
+#include "mono-mutex.h"
+
+#undef DEBUG
+
+guint32 _wapi_handle_count_signalled(WaitQueueItem *item, WapiHandleType type)
+{
+ guint32 i, ret=0;
+
+ /* Count how many of the interesting thread handles are signalled */
+ for(i=0; i<item->handles[type]->len; i++) {
+ WapiHandle *handle;
+
+ handle=(WapiHandle *)g_ptr_array_index(item->handles[type], i);
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Checking handle %p",
+ handle);
+#endif
+
+ if(handle->signalled==TRUE) {
+ guint32 idx;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Handle %p signalled", handle);
+#endif
+
+ idx=g_array_index(item->waitindex[type], guint32, i);
+ _wapi_handle_set_lowest(item, idx);
+
+ ret++;
+ }
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": %d signalled handles", ret);
+#endif
+
+ return(ret);
+}
+
+void _wapi_handle_set_lowest(WaitQueueItem *item, guint32 idx)
+{
+ mono_mutex_lock(&item->mutex);
+
+ if(item->lowest_signal>idx) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Set %p lowest index to %d",
+ item, idx);
+#endif
+
+ item->lowest_signal=idx;
+ }
+
+ mono_mutex_unlock(&item->mutex);
+}
+
+/**
+ * CloseHandle:
+ * @handle: The handle to release
+ *
+ * Closes and invalidates @handle, releasing any resources it
+ * consumes. When the last handle to a temporary or non-persistent
+ * object is closed, that object can be deleted. Closing the same
+ * handle twice is an error.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean CloseHandle(WapiHandle *handle)
+{
+ g_return_val_if_fail(handle->ref>0, FALSE);
+
+ handle->ref--;
+ if(handle->ref==0) {
+ if(handle->ops->close!=NULL) {
+ handle->ops->close(handle);
+ }
+
+ g_free(handle); /* maybe this should be in
+ * ops, cuurently ops->close()
+ * is being used to free
+ * handle data
+ */
+ }
+
+ return(TRUE);
+}
+
+/**
+ * SignalObjectAndWait:
+ * @signal_handle: An object to signal
+ * @wait: An object to wait for
+ * @timeout: The maximum time in milliseconds to wait for
+ * @alertable: Specifies whether the function returnes when the system
+ * queues an I/O completion routine or an APC for the calling thread.
+ *
+ * Atomically signals @signal and waits for @wait to become signalled,
+ * or @timeout ms elapses. If @timeout is zero, the object's state is
+ * tested and the function returns immediately. If @timeout is
+ * %INFINITE, the function waits forever.
+ *
+ * @signal can be a semaphore, mutex or event object.
+ *
+ * If @alertable is %TRUE and the system queues an I/O completion
+ * routine or an APC for the calling thread, the function returns and
+ * the thread calls the completion routine or APC function. If
+ * %FALSE, the function does not return, and the thread does not call
+ * the completion routine or APC function. A completion routine is
+ * queued when the ReadFileEx() or WriteFileEx() function in which it
+ * was specified has completed. The calling thread is the thread that
+ * initiated the read or write operation. An APC is queued when
+ * QueueUserAPC() is called. Currently completion routines and APC
+ * functions are not supported.
+ *
+ * Return value: %WAIT_ABANDONED - @wait is a mutex that was not
+ * released by the owning thread when it exited. Ownershop of the
+ * mutex object is granted to the calling thread and the mutex is set
+ * to nonsignalled. %WAIT_IO_COMPLETION - the wait was ended by one
+ * or more user-mode asynchronous procedure calls queued to the
+ * thread. %WAIT_OBJECT_0 - The state of @wait is signalled.
+ * %WAIT_TIMEOUT - The @timeout interval elapsed and @wait's state is
+ * still not signalled. %WAIT_FAILED - an error occurred.
+ */
+guint32 SignalObjectAndWait(WapiHandle *signal_handle, WapiHandle *wait,
+ guint32 timeout, gboolean alertable)
+{
+ gboolean waited;
+ guint32 ret;
+
+ if(signal_handle->ops->signal==NULL) {
+ return(WAIT_FAILED);
+ }
+
+ if(wait->ops->wait==NULL) {
+ return(WAIT_FAILED);
+ }
+
+ waited=wait->ops->wait(wait, signal_handle, timeout);
+ if(waited==TRUE) {
+ /* Object signalled before timeout expired */
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Object %p signalled",
+ wait);
+#endif
+ ret=WAIT_OBJECT_0;
+ } else {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Object %p wait timed out",
+ wait);
+#endif
+ ret=WAIT_TIMEOUT;
+ }
+
+ if(alertable==TRUE) {
+ /* Deal with queued APC or IO completion routines */
+ }
+
+ return(ret);
+}
diff --git a/mono/io-layer/handles.h b/mono/io-layer/handles.h
new file mode 100644
index 00000000000..ab2a3b88719
--- /dev/null
+++ b/mono/io-layer/handles.h
@@ -0,0 +1,12 @@
+#ifndef _WAPI_HANDLES_H_
+#define _WAPI_HANDLES_H_
+
+#define INVALID_HANDLE_VALUE (WapiHandle *)-1
+
+typedef struct _WapiHandle WapiHandle;
+
+extern gboolean CloseHandle(WapiHandle *handle);
+extern guint32 SignalObjectAndWait(WapiHandle *signal_handle, WapiHandle *wait,
+ guint32 timeout, gboolean alertable);
+
+#endif /* _WAPI_HANDLES_H_ */
diff --git a/mono/io-layer/io-layer-dummy.c b/mono/io-layer/io-layer-dummy.c
new file mode 100644
index 00000000000..d0d088fa433
--- /dev/null
+++ b/mono/io-layer/io-layer-dummy.c
@@ -0,0 +1,2 @@
+extern char *_mono_iolayer_dummylib;
+char *_mono_iolayer_dummylib="This is a dummy library that isn't needed on Windows";
diff --git a/mono/io-layer/io-layer.h b/mono/io-layer/io-layer.h
new file mode 100644
index 00000000000..b446255c22e
--- /dev/null
+++ b/mono/io-layer/io-layer.h
@@ -0,0 +1,26 @@
+#ifndef _MONO_IOLAYER_IOLAYER_H_
+#define _MONO_IOLAYER_IOLAYER_H_
+
+#include <config.h>
+
+#if defined(PLATFORM_WIN32)
+/* Native win32 */
+#define UNICODE
+#define _UNICODE
+#define __USE_W32_SOCKETS
+#include <w32api.h>
+#include <windows.h>
+#include <ws2tcpip.h>
+#else /* EVERYONE ELSE */
+#include "mono/io-layer/wapi.h"
+#include "mono/io-layer/uglify.h"
+#endif /* PLATFORM_WIN32 */
+
+#ifdef HAVE_SYS_FILIO_H
+#include <sys/filio.h> /* defines FIONBIO and FIONREAD */
+#endif
+#ifdef HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h> /* defines SIOCATMARK */
+#endif
+
+#endif /* _MONO_IOLAYER_IOLAYER_H_ */
diff --git a/mono/io-layer/io.c b/mono/io-layer/io.c
new file mode 100644
index 00000000000..2d1fea91af1
--- /dev/null
+++ b/mono/io-layer/io.c
@@ -0,0 +1,2028 @@
+#include <config.h>
+#include <glib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/poll.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <glob.h>
+#include <stdio.h>
+#include <utime.h>
+
+#include "mono/io-layer/wapi.h"
+#include "unicode.h"
+#include "wapi-private.h"
+
+#undef DEBUG
+#define ACTUALLY_DO_UNICODE
+
+/* Currently used for both FILE and CONSOLE handle types. This may
+ * have to change in future.
+ */
+struct _WapiHandle_file
+{
+ WapiHandle handle;
+ int fd;
+ gchar *filename;
+ WapiSecurityAttributes *security_attributes;
+ guint32 fileaccess;
+ guint32 sharemode;
+ guint32 attrs;
+};
+
+struct _WapiHandle_find
+{
+ WapiHandle handle;
+ glob_t glob;
+ size_t count;
+};
+
+static void file_close(WapiHandle *handle);
+static WapiFileType file_getfiletype(void);
+static gboolean file_read(WapiHandle *handle, gpointer buffer,
+ guint32 numbytes, guint32 *bytesread,
+ WapiOverlapped *overlapped);
+static gboolean file_write(WapiHandle *handle, gconstpointer buffer,
+ guint32 numbytes, guint32 *byteswritten,
+ WapiOverlapped *overlapped);
+static gboolean file_flush(WapiHandle *handle);
+static guint32 file_seek(WapiHandle *handle, gint32 movedistance,
+ gint32 *highmovedistance, WapiSeekMethod method);
+static gboolean file_setendoffile(WapiHandle *handle);
+static guint32 file_getfilesize(WapiHandle *handle, guint32 *highsize);
+static gboolean file_getfiletime(WapiHandle *handle, WapiFileTime *create_time,
+ WapiFileTime *last_access,
+ WapiFileTime *last_write);
+static gboolean file_setfiletime(WapiHandle *handle,
+ const WapiFileTime *create_time,
+ const WapiFileTime *last_access,
+ const WapiFileTime *last_write);
+
+/* File handle is only signalled for overlapped IO */
+static struct _WapiHandleOps file_ops = {
+ file_close, /* close */
+ file_getfiletype, /* getfiletype */
+ file_read, /* readfile */
+ file_write, /* writefile */
+ file_flush, /* flushfile */
+ file_seek, /* seek */
+ file_setendoffile, /* setendoffile */
+ file_getfilesize, /* getfilesize */
+ file_getfiletime, /* getfiletime */
+ file_setfiletime, /* setfiletime */
+ NULL, /* wait */
+ NULL, /* wait_multiple */
+ NULL, /* signal */
+};
+
+static WapiFileType console_getfiletype(void);
+
+/* Console is mostly the same as file, except it can block waiting for
+ * input or output
+ */
+static struct _WapiHandleOps console_ops = {
+ file_close, /* close */
+ console_getfiletype, /* getfiletype */
+ file_read, /* readfile */
+ file_write, /* writefile */
+ file_flush, /* flushfile */
+ NULL, /* seek */
+ NULL, /* setendoffile */
+ NULL, /* getfilesize */
+ NULL, /* getfiletime */
+ NULL, /* setfiletime */
+ NULL, /* FIXME: wait */
+ NULL, /* FIXME: wait_multiple */
+ NULL, /* signal */
+};
+
+/* Find handle has no ops.
+ */
+static struct _WapiHandleOps find_ops = {
+ NULL, /* close */
+ NULL, /* getfiletype */
+ NULL, /* readfile */
+ NULL, /* writefile */
+ NULL, /* flushfile */
+ NULL, /* seek */
+ NULL, /* setendoffile */
+ NULL, /* getfilesize */
+ NULL, /* getfiletime */
+ NULL, /* setfiletime */
+ NULL, /* FIXME: wait */
+ NULL, /* FIXME: wait_multiple */
+ NULL, /* signal */
+};
+
+/* Some utility functions.
+ */
+static void _wapi_time_t_to_filetime (time_t timeval, WapiFileTime *filetime)
+{
+ guint64 ticks;
+
+ ticks = ((guint64)timeval * 10000000) + 116444736000000000UL;
+ filetime->dwLowDateTime = ticks & 0xFFFFFFFF;
+ filetime->dwHighDateTime = ticks >> 32;
+}
+
+static guint32 _wapi_stat_to_file_attributes (struct stat *buf)
+{
+ guint32 attrs = 0;
+
+ /* FIXME: this could definitely be better */
+
+ if (S_ISDIR (buf->st_mode))
+ attrs |= FILE_ATTRIBUTE_DIRECTORY;
+ else
+ attrs |= FILE_ATTRIBUTE_ARCHIVE;
+
+ if (!(buf->st_mode & S_IWUSR))
+ attrs |= FILE_ATTRIBUTE_READONLY;
+
+ return attrs;
+}
+
+static void _wapi_set_last_error_from_errno (void)
+{
+ /* mapping ideas borrowed from wine. they may need some work */
+
+ switch (errno) {
+ case EACCES: case EPERM: case EROFS:
+ SetLastError (ERROR_ACCESS_DENIED);
+ break;
+
+ case EAGAIN:
+ SetLastError (ERROR_SHARING_VIOLATION);
+ break;
+
+ case EBUSY:
+ SetLastError (ERROR_LOCK_VIOLATION);
+ break;
+
+ case EEXIST:
+ SetLastError (ERROR_FILE_EXISTS);
+ break;
+
+ case EINVAL: case ESPIPE:
+ SetLastError (ERROR_SEEK);
+ break;
+
+ case EISDIR:
+ SetLastError (ERROR_CANNOT_MAKE);
+ break;
+
+ case ENFILE: case EMFILE:
+ SetLastError (ERROR_NO_MORE_FILES);
+ break;
+
+ case ENOENT: case ENOTDIR:
+ SetLastError (ERROR_FILE_NOT_FOUND);
+ break;
+
+ case ENOSPC:
+ SetLastError (ERROR_HANDLE_DISK_FULL);
+ break;
+
+ case ENOTEMPTY:
+ SetLastError (ERROR_DIR_NOT_EMPTY);
+ break;
+
+ case ENOEXEC:
+ SetLastError (ERROR_BAD_FORMAT);
+ break;
+
+ case ENAMETOOLONG:
+ SetLastError (ERROR_FILENAME_EXCED_RANGE);
+ break;
+
+ default:
+ g_message ("Unknown errno: %s\n", strerror (errno));
+ SetLastError (ERROR_GEN_FAILURE);
+ break;
+ }
+}
+
+/* Handle ops.
+ */
+static void file_close(WapiHandle *handle)
+{
+ struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": closing file handle %p with fd %d",
+ file_handle, file_handle->fd);
+#endif
+
+ close(file_handle->fd);
+ if(file_handle->filename!=NULL) {
+ g_free(file_handle->filename);
+ file_handle->filename=NULL;
+ }
+}
+
+static WapiFileType file_getfiletype(void)
+{
+ return(FILE_TYPE_DISK);
+}
+
+static gboolean file_read(WapiHandle *handle, gpointer buffer,
+ guint32 numbytes, guint32 *bytesread,
+ WapiOverlapped *overlapped G_GNUC_UNUSED)
+{
+ struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle;
+ int ret;
+
+ if(bytesread!=NULL) {
+ *bytesread=0;
+ }
+
+ if(!(file_handle->fileaccess&GENERIC_READ) &&
+ !(file_handle->fileaccess&GENERIC_ALL)) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_READ access: %u", handle, file_handle->fd, file_handle->fileaccess);
+#endif
+
+ return(FALSE);
+ }
+
+ ret=read(file_handle->fd, buffer, numbytes);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": read of handle %p fd %d error: %s", handle,
+ file_handle->fd, strerror(errno));
+#endif
+
+ return(FALSE);
+ }
+
+ if(bytesread!=NULL) {
+ *bytesread=ret;
+ }
+
+ return(TRUE);
+}
+
+static gboolean file_write(WapiHandle *handle, gconstpointer buffer,
+ guint32 numbytes, guint32 *byteswritten,
+ WapiOverlapped *overlapped G_GNUC_UNUSED)
+{
+ struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle;
+ int ret;
+
+ if(byteswritten!=NULL) {
+ *byteswritten=0;
+ }
+
+ if(!(file_handle->fileaccess&GENERIC_WRITE) &&
+ !(file_handle->fileaccess&GENERIC_ALL)) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_WRITE access: %u", handle, file_handle->fd, file_handle->fileaccess);
+#endif
+
+ return(FALSE);
+ }
+
+ ret=write(file_handle->fd, buffer, numbytes);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": write of handle %p fd %d error: %s", handle,
+ file_handle->fd, strerror(errno));
+#endif
+
+ return(FALSE);
+ }
+ if(byteswritten!=NULL) {
+ *byteswritten=ret;
+ }
+
+ return(TRUE);
+}
+
+static gboolean file_flush(WapiHandle *handle)
+{
+ struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle;
+ int ret;
+
+ if(!(file_handle->fileaccess&GENERIC_WRITE) &&
+ !(file_handle->fileaccess&GENERIC_ALL)) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_WRITE access: %u", handle, file_handle->fd, file_handle->fileaccess);
+#endif
+
+ return(FALSE);
+ }
+
+ ret=fsync(file_handle->fd);
+ if (ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": write of handle %p fd %d error: %s", handle,
+ file_handle->fd, strerror(errno));
+#endif
+
+ return(FALSE);
+ }
+
+ return(TRUE);
+}
+
+static guint32 file_seek(WapiHandle *handle, gint32 movedistance,
+ gint32 *highmovedistance, WapiSeekMethod method)
+{
+ struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle;
+ off_t offset, newpos;
+ int whence;
+ guint32 ret;
+
+ if(!(file_handle->fileaccess&GENERIC_READ) &&
+ !(file_handle->fileaccess&GENERIC_WRITE) &&
+ !(file_handle->fileaccess&GENERIC_ALL)) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_READ or GENERIC_WRITE access: %u", handle, file_handle->fd, file_handle->fileaccess);
+#endif
+
+ return(INVALID_SET_FILE_POINTER);
+ }
+
+ switch(method) {
+ case FILE_BEGIN:
+ whence=SEEK_SET;
+ break;
+ case FILE_CURRENT:
+ whence=SEEK_CUR;
+ break;
+ case FILE_END:
+ whence=SEEK_END;
+ break;
+ default:
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": invalid seek type %d",
+ method);
+#endif
+
+ return(INVALID_SET_FILE_POINTER);
+ }
+
+#ifdef HAVE_LARGE_FILE_SUPPORT
+ if(highmovedistance==NULL) {
+ offset=movedistance;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": setting offset to %lld (low %d)", offset,
+ movedistance);
+#endif
+ } else {
+ offset=((gint64) *highmovedistance << 32) | movedistance;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": setting offset to %lld 0x%llx (high %d 0x%x, low %d 0x%x)", offset, offset, *highmovedistance, *highmovedistance, movedistance, movedistance);
+#endif
+ }
+#else
+ offset=movedistance;
+#endif
+
+#ifdef DEBUG
+#ifdef HAVE_LARGE_FILE_SUPPORT
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": moving handle %p fd %d by %lld bytes from %d", handle,
+ file_handle->fd, offset, whence);
+#else
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": moving handle %p fd %d by %ld bytes from %d", handle,
+ file_handle->fd, offset, whence);
+#endif
+#endif
+
+ newpos=lseek(file_handle->fd, offset, whence);
+ if(newpos==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": lseek on handle %p fd %d returned error %s",
+ handle, file_handle->fd, strerror(errno));
+#endif
+
+ return(INVALID_SET_FILE_POINTER);
+ }
+
+#ifdef DEBUG
+#ifdef HAVE_LARGE_FILE_SUPPORT
+ g_message(G_GNUC_PRETTY_FUNCTION ": lseek returns %lld", newpos);
+#else
+ g_message(G_GNUC_PRETTY_FUNCTION ": lseek returns %ld", newpos);
+#endif
+#endif
+
+#ifdef HAVE_LARGE_FILE_SUPPORT
+ ret=newpos & 0xFFFFFFFF;
+ if(highmovedistance!=NULL) {
+ *highmovedistance=newpos>>32;
+ }
+#else
+ ret=newpos;
+ if(highmovedistance!=NULL) {
+ /* Accurate, but potentially dodgy :-) */
+ *highmovedistance=0;
+ }
+#endif
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": move of handle %p fd %d returning %d/%d", handle,
+ file_handle->fd, ret,
+ highmovedistance==NULL?0:*highmovedistance);
+#endif
+
+ return(ret);
+}
+
+static gboolean file_setendoffile(WapiHandle *handle)
+{
+ struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle;
+ struct stat statbuf;
+ off_t size, pos;
+ int ret;
+
+ if(!(file_handle->fileaccess&GENERIC_WRITE) &&
+ !(file_handle->fileaccess&GENERIC_ALL)) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_WRITE access: %u", handle, file_handle->fd, file_handle->fileaccess);
+#endif
+
+ return(FALSE);
+ }
+
+ /* Find the current file position, and the file length. If
+ * the file position is greater than the length, write to
+ * extend the file with a hole. If the file position is less
+ * than the length, truncate the file.
+ */
+
+ ret=fstat(file_handle->fd, &statbuf);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": handle %p fd %d fstat failed: %s", handle,
+ file_handle->fd, strerror(errno));
+#endif
+
+ return(FALSE);
+ }
+ size=statbuf.st_size;
+
+ pos=lseek(file_handle->fd, (off_t)0, SEEK_CUR);
+ if(pos==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": handle %p fd %d lseek failed: %s", handle,
+ file_handle->fd, strerror(errno));
+#endif
+
+ return(FALSE);
+ }
+
+ if(pos>size) {
+ /* extend */
+ ret=write(file_handle->fd, "", 1);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": handle %p fd %d extend write failed: %s",
+ handle, file_handle->fd, strerror(errno));
+#endif
+
+ return(FALSE);
+ }
+ }
+
+ /* always truncate, because the extend write() adds an extra
+ * byte to the end of the file
+ */
+ ret=ftruncate(file_handle->fd, pos);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": handle %p fd %d ftruncate failed: %s", handle,
+ file_handle->fd, strerror(errno));
+#endif
+
+ return(FALSE);
+ }
+
+ return(TRUE);
+}
+
+static guint32 file_getfilesize(WapiHandle *handle, guint32 *highsize)
+{
+ struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle;
+ struct stat statbuf;
+ guint32 size;
+ int ret;
+
+ if(!(file_handle->fileaccess&GENERIC_READ) &&
+ !(file_handle->fileaccess&GENERIC_WRITE) &&
+ !(file_handle->fileaccess&GENERIC_ALL)) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_READ or GENERIC_WRITE access: %u", handle, file_handle->fd, file_handle->fileaccess);
+#endif
+
+ return(INVALID_FILE_SIZE);
+ }
+
+ ret=fstat(file_handle->fd, &statbuf);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": handle %p fd %d fstat failed: %s", handle,
+ file_handle->fd, strerror(errno));
+#endif
+
+ return(INVALID_FILE_SIZE);
+ }
+
+#ifdef HAVE_LARGE_FILE_SUPPORT
+ size=statbuf.st_size & 0xFFFFFFFF;
+ if(highsize!=NULL) {
+ *highsize=statbuf.st_size>>32;
+ }
+#else
+ if(highsize!=NULL) {
+ /* Accurate, but potentially dodgy :-) */
+ *highsize=0;
+ }
+ size=statbuf.st_size;
+#endif
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Returning size %d/%d", size,
+ *highsize);
+#endif
+
+ return(size);
+}
+
+static gboolean file_getfiletime(WapiHandle *handle, WapiFileTime *create_time,
+ WapiFileTime *last_access,
+ WapiFileTime *last_write)
+{
+ struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle;
+ struct stat statbuf;
+ guint64 create_ticks, access_ticks, write_ticks;
+ int ret;
+
+ if(!(file_handle->fileaccess&GENERIC_READ) &&
+ !(file_handle->fileaccess&GENERIC_ALL)) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_READ access: %u", handle, file_handle->fd, file_handle->fileaccess);
+#endif
+
+ return(FALSE);
+ }
+
+ ret=fstat(file_handle->fd, &statbuf);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": handle %p fd %d fstat failed: %s", handle,
+ file_handle->fd, strerror(errno));
+#endif
+
+ return(FALSE);
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": atime: %ld ctime: %ld mtime: %ld",
+ statbuf.st_atime, statbuf.st_ctime,
+ statbuf.st_mtime);
+#endif
+
+ /* Try and guess a meaningful create time by using the older
+ * of atime or ctime
+ */
+ /* The magic constant comes from msdn documentation
+ * "Converting a time_t Value to a File Time"
+ */
+ if(statbuf.st_atime < statbuf.st_ctime) {
+ create_ticks=((guint64)statbuf.st_atime*10000000)
+ + 116444736000000000UL;
+ } else {
+ create_ticks=((guint64)statbuf.st_ctime*10000000)
+ + 116444736000000000UL;
+ }
+
+ access_ticks=((guint64)statbuf.st_atime*10000000)+116444736000000000UL;
+ write_ticks=((guint64)statbuf.st_mtime*10000000)+116444736000000000UL;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": aticks: %llu cticks: %llu wticks: %llu",
+ access_ticks, create_ticks, write_ticks);
+#endif
+
+ if(create_time!=NULL) {
+ create_time->dwLowDateTime = create_ticks & 0xFFFFFFFF;
+ create_time->dwHighDateTime = create_ticks >> 32;
+ }
+
+ if(last_access!=NULL) {
+ last_access->dwLowDateTime = access_ticks & 0xFFFFFFFF;
+ last_access->dwHighDateTime = access_ticks >> 32;
+ }
+
+ if(last_write!=NULL) {
+ last_write->dwLowDateTime = write_ticks & 0xFFFFFFFF;
+ last_write->dwHighDateTime = write_ticks >> 32;
+ }
+
+ return(TRUE);
+}
+
+static gboolean file_setfiletime(WapiHandle *handle,
+ const WapiFileTime *create_time G_GNUC_UNUSED,
+ const WapiFileTime *last_access,
+ const WapiFileTime *last_write)
+{
+ struct _WapiHandle_file *file_handle=(struct _WapiHandle_file *)handle;
+ struct utimbuf utbuf;
+ struct stat statbuf;
+ guint64 access_ticks, write_ticks;
+ int ret;
+
+ if(!(file_handle->fileaccess&GENERIC_WRITE) &&
+ !(file_handle->fileaccess&GENERIC_ALL)) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_WRITE access: %u", handle, file_handle->fd, file_handle->fileaccess);
+#endif
+
+ return(FALSE);
+ }
+
+ if(file_handle->filename==NULL) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": handle %p fd %d unknown filename", handle,
+ file_handle->fd);
+#endif
+
+ return(FALSE);
+ }
+
+ /* Get the current times, so we can put the same times back in
+ * the event that one of the FileTime structs is NULL
+ */
+ ret=fstat(file_handle->fd, &statbuf);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": handle %p fd %d fstat failed: %s", handle,
+ file_handle->fd, strerror(errno));
+#endif
+
+ return(FALSE);
+ }
+
+ if(last_access!=NULL) {
+ access_ticks=((guint64)last_access->dwHighDateTime << 32) +
+ last_access->dwLowDateTime;
+ utbuf.actime=(access_ticks - 116444736000000000) / 10000000;
+ } else {
+ utbuf.actime=statbuf.st_atime;
+ }
+
+ if(last_write!=NULL) {
+ write_ticks=((guint64)last_write->dwHighDateTime << 32) +
+ last_write->dwLowDateTime;
+ utbuf.modtime=(write_ticks - 116444736000000000) / 10000000;
+ } else {
+ utbuf.modtime=statbuf.st_mtime;
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": setting handle %p access %ld write %ld", handle,
+ utbuf.actime, utbuf.modtime);
+#endif
+
+ ret=utime(file_handle->filename, &utbuf);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": handle %p [%s] fd %d utime failed: %s", handle,
+ file_handle->filename, file_handle->fd,
+ strerror(errno));
+#endif
+
+ return(FALSE);
+ }
+
+ return(TRUE);
+}
+
+static WapiFileType console_getfiletype(void)
+{
+ return(FILE_TYPE_CHAR);
+}
+
+static int convert_flags(guint32 fileaccess, guint32 createmode)
+{
+ int flags=0;
+
+ switch(fileaccess) {
+ case GENERIC_READ:
+ flags=O_RDONLY;
+ break;
+ case GENERIC_WRITE:
+ flags=O_WRONLY;
+ break;
+ case GENERIC_READ|GENERIC_WRITE:
+ flags=O_RDWR;
+ break;
+ default:
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Unknown access type 0x%x",
+ fileaccess);
+#endif
+ break;
+ }
+
+ switch(createmode) {
+ case CREATE_NEW:
+ flags|=O_CREAT|O_EXCL;
+ break;
+ case CREATE_ALWAYS:
+ flags|=O_CREAT|O_TRUNC;
+ break;
+ case OPEN_EXISTING:
+ break;
+ case OPEN_ALWAYS:
+ flags|=O_CREAT;
+ break;
+ case TRUNCATE_EXISTING:
+ flags|=O_TRUNC;
+ break;
+ default:
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Unknown create mode 0x%x",
+ createmode);
+#endif
+ break;
+ }
+
+ return(flags);
+}
+
+static guint32 convert_from_flags(int flags)
+{
+ guint32 fileaccess=0;
+
+ if(flags&O_RDONLY) {
+ fileaccess=GENERIC_READ;
+ } else if (flags&O_WRONLY) {
+ fileaccess=GENERIC_WRITE;
+ } else if (flags&O_RDWR) {
+ fileaccess=GENERIC_READ|GENERIC_WRITE;
+ } else {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Can't figure out flags 0x%x", flags);
+#endif
+ }
+
+ /* Maybe sort out create mode too */
+
+ return(fileaccess);
+}
+
+static mode_t convert_perms(guint32 sharemode)
+{
+ mode_t perms=0600;
+
+ if(sharemode&FILE_SHARE_READ) {
+ perms|=044;
+ }
+ if(sharemode&FILE_SHARE_WRITE) {
+ perms|=022;
+ }
+
+ return(perms);
+}
+
+
+/**
+ * CreateFile:
+ * @name: a pointer to a NULL-terminated unicode string, that names
+ * the file or other object to create.
+ * @fileaccess: specifies the file access mode
+ * @sharemode: whether the file should be shared. This parameter is
+ * currently ignored.
+ * @security: Ignored for now.
+ * @createmode: specifies whether to create a new file, whether to
+ * overwrite an existing file, whether to truncate the file, etc.
+ * @attrs: specifies file attributes and flags. On win32 attributes
+ * are characteristics of the file, not the handle, and are ignored
+ * when an existing file is opened. Flags give the library hints on
+ * how to process a file to optimise performance.
+ * @template: the handle of an open %GENERIC_READ file that specifies
+ * attributes to apply to a newly created file, ignoring @attrs.
+ * Normally this parameter is NULL. This parameter is ignored when an
+ * existing file is opened.
+ *
+ * Creates a new file handle. This only applies to normal files:
+ * pipes are handled by CreatePipe(), and console handles are created
+ * with GetStdHandle().
+ *
+ * Return value: the new handle, or %INVALID_HANDLE_VALUE on error.
+ */
+WapiHandle *CreateFile(const gunichar2 *name, guint32 fileaccess,
+ guint32 sharemode, WapiSecurityAttributes *security,
+ guint32 createmode, guint32 attrs,
+ WapiHandle *template G_GNUC_UNUSED)
+{
+ struct _WapiHandle_file *file_handle;
+ WapiHandle *handle;
+ int flags=convert_flags(fileaccess, createmode);
+ mode_t perms=convert_perms(sharemode);
+ gchar *filename;
+ int ret;
+
+ if(name==NULL) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": name is NULL");
+#endif
+
+ return(INVALID_HANDLE_VALUE);
+ }
+ filename=_wapi_unicode_to_utf8(name);
+
+#ifdef ACTUALLY_DO_UNICODE
+ if(filename==NULL) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": unicode conversion returned NULL");
+#endif
+
+ return(INVALID_HANDLE_VALUE);
+ }
+#endif
+
+#ifdef ACTUALLY_DO_UNICODE
+ ret=open(filename, flags, perms);
+#else
+ ret=open(name, flags, perms);
+#endif
+
+ if(ret==-1) {
+#ifdef DEBUG
+#ifdef ACTUALLY_DO_UNICODE
+ g_message(G_GNUC_PRETTY_FUNCTION ": Error opening file %s: %s",
+ filename, strerror(errno));
+#else
+ g_message(G_GNUC_PRETTY_FUNCTION ": Error opening file %s: %s",
+ filename, strerror(errno));
+#endif
+#endif
+ return(INVALID_HANDLE_VALUE);
+ }
+
+ file_handle=g_new0(struct _WapiHandle_file, 1);
+ handle=(WapiHandle *)file_handle;
+
+ _WAPI_HANDLE_INIT(handle, WAPI_HANDLE_FILE, file_ops);
+
+ file_handle->fd=ret;
+#ifdef ACTUALLY_DO_UNICODE
+ file_handle->filename=filename;
+#else
+ file_handle->filename=g_strdup(name);
+#endif
+ file_handle->security_attributes=security;
+ file_handle->fileaccess=fileaccess;
+ file_handle->sharemode=sharemode;
+ file_handle->attrs=attrs;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": returning handle %p [%s] with fd %d",
+ handle, file_handle->filename, file_handle->fd);
+#endif
+
+ return(handle);
+}
+
+/**
+ * DeleteFile:
+ * @name: a pointer to a NULL-terminated unicode string, that names
+ * the file to be deleted.
+ *
+ * Deletes file @name.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean DeleteFile(const gunichar2 *name)
+{
+ gchar *filename;
+ int ret;
+
+ if(name==NULL) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": name is NULL");
+#endif
+
+ return(FALSE);
+ }
+
+ filename=_wapi_unicode_to_utf8(name);
+#ifdef ACTUALLY_DO_UNICODE
+ if(filename==NULL) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": unicode conversion returned NULL");
+#endif
+
+ return(FALSE);
+ }
+#endif
+
+#ifdef ACTUALLY_DO_UNICODE
+ ret=unlink(filename);
+#else
+ ret=unlink(name);
+#endif
+
+ g_free(filename);
+
+ if(ret==0) {
+ return(TRUE);
+ } else {
+ return(FALSE);
+ }
+}
+
+/**
+ * MoveFile:
+ * @name: a pointer to a NULL-terminated unicode string, that names
+ * the file to be moved.
+ * @dest_name: a pointer to a NULL-terminated unicode string, that is the
+ * new name for the file.
+ *
+ * Renames file @name to @dest_name
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean MoveFile (const gunichar2 *name, const gunichar2 *dest_name)
+{
+ gchar *utf8_name, *utf8_dest_name;
+ int result;
+
+ utf8_name = _wapi_unicode_to_utf8 (name);
+ if (utf8_name == NULL) {
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": unicode conversion returned NULL");
+#endif
+
+ return FALSE;
+ }
+
+ utf8_dest_name = _wapi_unicode_to_utf8 (dest_name);
+ if (utf8_dest_name == NULL) {
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": unicode conversion returned NULL");
+#endif
+
+ g_free (utf8_name);
+ return FALSE;
+ }
+
+ result = rename (utf8_name, utf8_dest_name);
+ g_free (utf8_name);
+ g_free (utf8_dest_name);
+
+ if (result == 0)
+ return TRUE;
+
+ switch (errno) {
+ case EEXIST:
+ SetLastError (ERROR_ALREADY_EXISTS);
+ break;
+
+ default:
+ _wapi_set_last_error_from_errno ();
+ break;
+ }
+
+ return FALSE;
+}
+
+/**
+ * CopyFile:
+ * @name: a pointer to a NULL-terminated unicode string, that names
+ * the file to be copied.
+ * @dest_name: a pointer to a NULL-terminated unicode string, that is the
+ * new name for the file.
+ * @fail_if_exists: if TRUE and dest_name exists, the copy will fail.
+ *
+ * Copies file @name to @dest_name
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean CopyFile (const gunichar2 *name, const gunichar2 *dest_name, gboolean fail_if_exists)
+{
+ WapiHandle *src, *dest;
+ guint32 attrs;
+ char *buffer;
+ int remain, n;
+
+ attrs = GetFileAttributes (name);
+ if (attrs == -1) {
+ SetLastError (ERROR_FILE_NOT_FOUND);
+ return FALSE;
+ }
+
+ src = CreateFile (name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING, 0, NULL);
+ if (src == INVALID_HANDLE_VALUE) {
+ _wapi_set_last_error_from_errno ();
+ return FALSE;
+ }
+
+ dest = CreateFile (dest_name, GENERIC_WRITE, 0, NULL,
+ fail_if_exists ? CREATE_NEW : CREATE_ALWAYS, attrs, NULL);
+ if (dest == INVALID_HANDLE_VALUE) {
+ _wapi_set_last_error_from_errno ();
+ CloseHandle (src);
+ return FALSE;
+ }
+
+ buffer = g_new (gchar, 2048);
+
+ for (;;) {
+ if (ReadFile (src, buffer,sizeof (buffer), &remain, NULL) == 0) {
+ _wapi_set_last_error_from_errno ();
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": read failed.");
+#endif
+
+ CloseHandle (dest);
+ CloseHandle (src);
+ return FALSE;
+ }
+
+ if (remain == 0)
+ break;
+
+ while (remain > 0) {
+ if (WriteFile (dest, buffer, remain, &n, NULL) == 0) {
+ _wapi_set_last_error_from_errno ();
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": write failed.");
+#endif
+
+ CloseHandle (dest);
+ CloseHandle (src);
+ return FALSE;
+ }
+
+ remain -= n;
+ }
+ }
+
+ g_free (buffer);
+
+ CloseHandle (dest);
+ CloseHandle (src);
+ return TRUE;
+}
+
+/**
+ * GetStdHandle:
+ * @stdhandle: specifies the file descriptor
+ *
+ * Returns a handle for stdin, stdout, or stderr. Always returns the
+ * same handle for the same @stdhandle.
+ *
+ * Return value: the handle, or %INVALID_HANDLE_VALUE on error
+ */
+
+WapiHandle *GetStdHandle(WapiStdHandle stdhandle)
+{
+ struct _WapiHandle_file *file_handle;
+ WapiHandle *handle;
+ int flags, fd;
+
+ switch(stdhandle) {
+ case STD_INPUT_HANDLE:
+ fd=0;
+ break;
+
+ case STD_OUTPUT_HANDLE:
+ fd=1;
+ break;
+
+ case STD_ERROR_HANDLE:
+ fd=2;
+ break;
+
+ default:
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": unknown standard handle type");
+#endif
+
+ return(INVALID_HANDLE_VALUE);
+ }
+
+ /* Check if fd is valid */
+ flags=fcntl(fd, F_GETFL);
+ if(flags==-1) {
+ /* Invalid fd. Not really much point checking for EBADF
+ * specifically
+ */
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": fcntl error on fd %d: %s",
+ fd, strerror(errno));
+#endif
+
+ return(INVALID_HANDLE_VALUE);
+ }
+
+ file_handle=g_new0(struct _WapiHandle_file, 1);
+ handle=(WapiHandle *)file_handle;
+
+ _WAPI_HANDLE_INIT(handle, WAPI_HANDLE_CONSOLE, console_ops);
+
+ file_handle->fd=fd;
+ /* We might want to set file_handle->filename to something
+ * like "<stdin>" if we ever want to display handle internal
+ * details somehow
+ */
+ file_handle->security_attributes=/*some default*/NULL;
+ file_handle->fileaccess=convert_from_flags(flags);
+ file_handle->sharemode=0;
+ file_handle->attrs=0;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": returning handle %p with fd %d",
+ handle, file_handle->fd);
+#endif
+
+ return(handle);
+}
+
+/**
+ * ReadFile:
+ * @handle: The file handle to read from. The handle must have
+ * %GENERIC_READ access.
+ * @buffer: The buffer to store read data in
+ * @numbytes: The maximum number of bytes to read
+ * @bytesread: The actual number of bytes read is stored here. This
+ * value can be zero if the handle is positioned at the end of the
+ * file.
+ * @overlapped: points to a required %WapiOverlapped structure if
+ * @handle has the %FILE_FLAG_OVERLAPPED option set, should be NULL
+ * otherwise.
+ *
+ * If @handle does not have the %FILE_FLAG_OVERLAPPED option set, this
+ * function reads up to @numbytes bytes from the file from the current
+ * file position, and stores them in @buffer. If there are not enough
+ * bytes left in the file, just the amount available will be read.
+ * The actual number of bytes read is stored in @bytesread.
+
+ * If @handle has the %FILE_FLAG_OVERLAPPED option set, the current
+ * file position is ignored and the read position is taken from data
+ * in the @overlapped structure.
+ *
+ * Return value: %TRUE if the read succeeds (even if no bytes were
+ * read due to an attempt to read past the end of the file), %FALSE on
+ * error.
+ */
+gboolean ReadFile(WapiHandle *handle, gpointer buffer, guint32 numbytes,
+ guint32 *bytesread, WapiOverlapped *overlapped)
+{
+ if(handle->ops->readfile==NULL) {
+ return(FALSE);
+ }
+
+ return(handle->ops->readfile(handle, buffer, numbytes, bytesread,
+ overlapped));
+}
+
+/**
+ * WriteFile:
+ * @handle: The file handle to write to. The handle must have
+ * %GENERIC_WRITE access.
+ * @buffer: The buffer to read data from.
+ * @numbytes: The maximum number of bytes to write.
+ * @byteswritten: The actual number of bytes written is stored here.
+ * If the handle is positioned at the file end, the length of the file
+ * is extended. This parameter may be %NULL.
+ * @overlapped: points to a required %WapiOverlapped structure if
+ * @handle has the %FILE_FLAG_OVERLAPPED option set, should be NULL
+ * otherwise.
+ *
+ * If @handle does not have the %FILE_FLAG_OVERLAPPED option set, this
+ * function writes up to @numbytes bytes from @buffer to the file at
+ * the current file position. If @handle is positioned at the end of
+ * the file, the file is extended. The actual number of bytes written
+ * is stored in @byteswritten.
+ *
+ * If @handle has the %FILE_FLAG_OVERLAPPED option set, the current
+ * file position is ignored and the write position is taken from data
+ * in the @overlapped structure.
+ *
+ * Return value: %TRUE if the write succeeds, %FALSE on error.
+ */
+gboolean WriteFile(WapiHandle *handle, gconstpointer buffer, guint32 numbytes,
+ guint32 *byteswritten, WapiOverlapped *overlapped)
+{
+ if(handle->ops->writefile==NULL) {
+ return(FALSE);
+ }
+
+ return(handle->ops->writefile(handle, buffer, numbytes, byteswritten,
+ overlapped));
+}
+
+/**
+ * FlushFileBuffers:
+ * @handle: Handle to open file. The handle must have
+ * %GENERIC_WRITE access.
+ *
+ * Flushes buffers of the file and causes all unwritten data to
+ * be written.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean FlushFileBuffers(WapiHandle *handle)
+{
+ if(handle->ops->flushfile==NULL) {
+ return(FALSE);
+ }
+
+ return(handle->ops->flushfile(handle));
+}
+
+/**
+ * SetEndOfFile:
+ * @handle: The file handle to set. The handle must have
+ * %GENERIC_WRITE access.
+ *
+ * Moves the end-of-file position to the current position of the file
+ * pointer. This function is used to truncate or extend a file.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean SetEndOfFile(WapiHandle *handle)
+{
+ if(handle->ops->setendoffile==NULL) {
+ return(FALSE);
+ }
+
+ return(handle->ops->setendoffile(handle));
+}
+
+/**
+ * SetFilePointer:
+ * @handle: The file handle to set. The handle must have
+ * %GENERIC_READ or %GENERIC_WRITE access.
+ * @movedistance: Low 32 bits of a signed value that specifies the
+ * number of bytes to move the file pointer.
+ * @highmovedistance: Pointer to the high 32 bits of a signed value
+ * that specifies the number of bytes to move the file pointer, or
+ * %NULL.
+ * @method: The starting point for the file pointer move.
+ *
+ * Sets the file pointer of an open file.
+ *
+ * The distance to move the file pointer is calculated from
+ * @movedistance and @highmovedistance: If @highmovedistance is %NULL,
+ * @movedistance is the 32-bit signed value; otherwise, @movedistance
+ * is the low 32 bits and @highmovedistance a pointer to the high 32
+ * bits of a 64 bit signed value. A positive distance moves the file
+ * pointer forward from the position specified by @method; a negative
+ * distance moves the file pointer backward.
+ *
+ * If the library is compiled without large file support,
+ * @highmovedistance is ignored and its value is set to zero on a
+ * successful return.
+ *
+ * Return value: On success, the low 32 bits of the new file pointer.
+ * If @highmovedistance is not %NULL, the high 32 bits of the new file
+ * pointer are stored there. On failure, %INVALID_SET_FILE_POINTER.
+ */
+guint32 SetFilePointer(WapiHandle *handle, gint32 movedistance,
+ gint32 *highmovedistance, WapiSeekMethod method)
+{
+ if(handle->ops->seek==NULL) {
+ return(INVALID_SET_FILE_POINTER);
+ }
+
+ return(handle->ops->seek(handle, movedistance, highmovedistance,
+ method));
+}
+
+/**
+ * GetFileType:
+ * @handle: The file handle to test.
+ *
+ * Finds the type of file @handle.
+ *
+ * Return value: %FILE_TYPE_UNKNOWN - the type of the file @handle is
+ * unknown. %FILE_TYPE_DISK - @handle is a disk file.
+ * %FILE_TYPE_CHAR - @handle is a character device, such as a console.
+ * %FILE_TYPE_PIPE - @handle is a named or anonymous pipe.
+ */
+WapiFileType GetFileType(WapiHandle *handle)
+{
+ if(handle->ops->getfiletype==NULL) {
+ return(FILE_TYPE_UNKNOWN);
+ }
+
+ return(handle->ops->getfiletype());
+}
+
+/**
+ * GetFileSize:
+ * @handle: The file handle to query. The handle must have
+ * %GENERIC_READ or %GENERIC_WRITE access.
+ * @highsize: If non-%NULL, the high 32 bits of the file size are
+ * stored here.
+ *
+ * Retrieves the size of the file @handle.
+ *
+ * If the library is compiled without large file support, @highsize
+ * has its value set to zero on a successful return.
+ *
+ * Return value: On success, the low 32 bits of the file size. If
+ * @highsize is non-%NULL then the high 32 bits of the file size are
+ * stored here. On failure %INVALID_FILE_SIZE is returned.
+ */
+guint32 GetFileSize(WapiHandle *handle, guint32 *highsize)
+{
+ if(handle->ops->getfilesize==NULL) {
+ return(INVALID_FILE_SIZE);
+ }
+
+ return(handle->ops->getfilesize(handle, highsize));
+}
+
+/**
+ * GetFileTime:
+ * @handle: The file handle to query. The handle must have
+ * %GENERIC_READ access.
+ * @create_time: Points to a %WapiFileTime structure to receive the
+ * number of ticks since the epoch that file was created. May be
+ * %NULL.
+ * @last_access: Points to a %WapiFileTime structure to receive the
+ * number of ticks since the epoch when file was last accessed. May be
+ * %NULL.
+ * @last_write: Points to a %WapiFileTime structure to receive the
+ * number of ticks since the epoch when file was last written to. May
+ * be %NULL.
+ *
+ * Finds the number of ticks since the epoch that the file referenced
+ * by @handle was created, last accessed and last modified. A tick is
+ * a 100 nanosecond interval. The epoch is Midnight, January 1 1601
+ * GMT.
+ *
+ * Create time isn't recorded on POSIX file systems or reported by
+ * stat(2), so that time is guessed by returning the oldest of the
+ * other times.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean GetFileTime(WapiHandle *handle, WapiFileTime *create_time,
+ WapiFileTime *last_access, WapiFileTime *last_write)
+{
+ if(handle->ops->getfiletime==NULL) {
+ return(FALSE);
+ }
+
+ return(handle->ops->getfiletime(handle, create_time, last_access,
+ last_write));
+}
+
+/**
+ * SetFileTime:
+ * @handle: The file handle to set. The handle must have
+ * %GENERIC_WRITE access.
+ * @create_time: Points to a %WapiFileTime structure that contains the
+ * number of ticks since the epoch that the file was created. May be
+ * %NULL.
+ * @last_access: Points to a %WapiFileTime structure that contains the
+ * number of ticks since the epoch when the file was last accessed.
+ * May be %NULL.
+ * @last_write: Points to a %WapiFileTime structure that contains the
+ * number of ticks since the epoch when the file was last written to.
+ * May be %NULL.
+ *
+ * Sets the number of ticks since the epoch that the file referenced
+ * by @handle was created, last accessed or last modified. A tick is
+ * a 100 nanosecond interval. The epoch is Midnight, January 1 1601
+ * GMT.
+ *
+ * Create time isn't recorded on POSIX file systems, and is ignored.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean SetFileTime(WapiHandle *handle, const WapiFileTime *create_time,
+ const WapiFileTime *last_access,
+ const WapiFileTime *last_write)
+{
+ if(handle->ops->setfiletime==NULL) {
+ return(FALSE);
+ }
+
+ return(handle->ops->setfiletime(handle, create_time, last_access,
+ last_write));
+}
+
+/* A tick is a 100-nanosecond interval. File time epoch is Midnight,
+ * January 1 1601 GMT
+ */
+
+#define TICKS_PER_MILLISECOND 10000L
+#define TICKS_PER_SECOND 10000000L
+#define TICKS_PER_MINUTE 600000000L
+#define TICKS_PER_HOUR 36000000000L
+#define TICKS_PER_DAY 864000000000L
+
+#define isleap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
+
+static const guint16 mon_yday[2][13]={
+ {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
+ {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366},
+};
+
+/**
+ * FileTimeToSystemTime:
+ * @file_time: Points to a %WapiFileTime structure that contains the
+ * number of ticks to convert.
+ * @system_time: Points to a %WapiSystemTime structure to receive the
+ * broken-out time.
+ *
+ * Converts a tick count into broken-out time values.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean FileTimeToSystemTime(const WapiFileTime *file_time,
+ WapiSystemTime *system_time)
+{
+ gint64 file_ticks, totaldays, rem, y;
+ const guint16 *ip;
+
+ if(system_time==NULL) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": system_time NULL");
+#endif
+
+ return(FALSE);
+ }
+
+ file_ticks=((gint64)file_time->dwHighDateTime << 32) +
+ file_time->dwLowDateTime;
+
+ /* Really compares if file_ticks>=0x8000000000000000
+ * (LLONG_MAX+1) but we're working with a signed value for the
+ * year and day calculation to work later
+ */
+ if(file_ticks<0) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": file_time too big");
+#endif
+
+ return(FALSE);
+ }
+
+ totaldays=(file_ticks / TICKS_PER_DAY);
+ rem = file_ticks % TICKS_PER_DAY;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": totaldays: %lld rem: %lld",
+ totaldays, rem);
+#endif
+
+ system_time->wHour=rem/TICKS_PER_HOUR;
+ rem %= TICKS_PER_HOUR;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Hour: %d rem: %lld",
+ system_time->wHour, rem);
+#endif
+
+ system_time->wMinute = rem / TICKS_PER_MINUTE;
+ rem %= TICKS_PER_MINUTE;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Minute: %d rem: %lld",
+ system_time->wMinute, rem);
+#endif
+
+ system_time->wSecond = rem / TICKS_PER_SECOND;
+ rem %= TICKS_PER_SECOND;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Second: %d rem: %lld",
+ system_time->wSecond, rem);
+#endif
+
+ system_time->wMilliseconds = rem / TICKS_PER_MILLISECOND;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Milliseconds: %d",
+ system_time->wMilliseconds);
+#endif
+
+ /* January 1, 1601 was a Monday, according to Emacs calendar */
+ system_time->wDayOfWeek = ((1 + totaldays) % 7) + 1;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Day of week: %d",
+ system_time->wDayOfWeek);
+#endif
+
+ /* This algorithm to find year and month given days from epoch
+ * from glibc
+ */
+ y=1601;
+
+#define DIV(a, b) ((a) / (b) - ((a) % (b) < 0))
+#define LEAPS_THRU_END_OF(y) (DIV(y, 4) - DIV (y, 100) + DIV (y, 400))
+
+ while(totaldays < 0 || totaldays >= (isleap(y)?366:365)) {
+ /* Guess a corrected year, assuming 365 days per year */
+ gint64 yg = y + totaldays / 365 - (totaldays % 365 < 0);
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": totaldays: %lld yg: %lld y: %lld", totaldays, yg,
+ y);
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": LEAPS(yg): %lld LEAPS(y): %lld",
+ LEAPS_THRU_END_OF(yg-1), LEAPS_THRU_END_OF(y-1));
+#endif
+
+ /* Adjust days and y to match the guessed year. */
+ totaldays -= ((yg - y) * 365
+ + LEAPS_THRU_END_OF (yg - 1)
+ - LEAPS_THRU_END_OF (y - 1));
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": totaldays: %lld",
+ totaldays);
+#endif
+ y = yg;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": y: %lld", y);
+#endif
+ }
+
+ system_time->wYear = y;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Year: %d", system_time->wYear);
+#endif
+
+ ip = mon_yday[isleap(y)];
+
+ for(y=11; totaldays < ip[y]; --y) {
+ continue;
+ }
+ totaldays-=ip[y];
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": totaldays: %lld", totaldays);
+#endif
+
+ system_time->wMonth = y + 1;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Month: %d", system_time->wMonth);
+#endif
+
+ system_time->wDay = totaldays + 1;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Day: %d", system_time->wDay);
+#endif
+
+ return(TRUE);
+}
+
+WapiHandle *FindFirstFile (const gunichar2 *pattern, WapiFindData *find_data)
+{
+ struct _WapiHandle_find *handle;
+ gchar *utf8_pattern = NULL;
+ int result;
+
+ if (pattern == NULL) {
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": pattern is NULL");
+#endif
+
+ return INVALID_HANDLE_VALUE;
+ }
+
+ utf8_pattern = _wapi_unicode_to_utf8 (pattern);
+ if (utf8_pattern == NULL) {
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": unicode conversion returned NULL");
+#endif
+
+ return INVALID_HANDLE_VALUE;
+ }
+
+ handle = g_new0 (struct _WapiHandle_find, 1);
+ _WAPI_HANDLE_INIT ((&handle->handle), WAPI_HANDLE_FIND, find_ops);
+
+ result = glob (utf8_pattern, 0, NULL, &handle->glob);
+ g_free (utf8_pattern);
+
+ if (result != 0) {
+ globfree (&handle->glob);
+ g_free (handle);
+
+ switch (result) {
+#ifdef GLOB_NOMATCH
+ case GLOB_NOMATCH:
+ SetLastError (ERROR_NO_MORE_FILES);
+ break;
+#endif
+
+ default:
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": glob failed with code %d.", result);
+#endif
+
+ break;
+ }
+
+ return INVALID_HANDLE_VALUE;
+ }
+
+ handle->count = 0;
+ if (!FindNextFile ((WapiHandle *)handle, find_data)) {
+ FindClose ((WapiHandle *)handle);
+ SetLastError (ERROR_NO_MORE_FILES);
+ return INVALID_HANDLE_VALUE;
+ }
+
+ return (WapiHandle *)handle;
+}
+
+gboolean FindNextFile (WapiHandle *wapi_handle, WapiFindData *find_data)
+{
+ struct _WapiHandle_find *handle;
+ struct stat buf;
+ const gchar *filename;
+
+ gchar *base_filename;
+ gunichar2 *utf16_basename;
+ time_t create_time;
+ int i;
+
+ if (wapi_handle == INVALID_HANDLE_VALUE || wapi_handle->type != WAPI_HANDLE_FIND) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ handle = (struct _WapiHandle_find *)wapi_handle;
+ if (handle->count >= handle->glob.gl_pathc) {
+ SetLastError (ERROR_NO_MORE_FILES);
+ return FALSE;
+ }
+
+ /* stat next glob match */
+
+ filename = handle->glob.gl_pathv [handle->count ++];
+ if (stat (filename, &buf) != 0) {
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": stat failed: %s", filename);
+#endif
+
+ SetLastError (ERROR_NO_MORE_FILES);
+ return FALSE;
+ }
+
+ /* fill data block */
+
+ if (buf.st_mtime < buf.st_ctime)
+ create_time = buf.st_mtime;
+ else
+ create_time = buf.st_ctime;
+
+ find_data->dwFileAttributes = _wapi_stat_to_file_attributes (&buf);
+
+ _wapi_time_t_to_filetime (create_time, &find_data->ftCreationTime);
+ _wapi_time_t_to_filetime (buf.st_atime, &find_data->ftLastAccessTime);
+ _wapi_time_t_to_filetime (buf.st_mtime, &find_data->ftLastWriteTime);
+
+ if (find_data->dwFileAttributes && FILE_ATTRIBUTE_DIRECTORY) {
+ find_data->nFileSizeHigh = 0;
+ find_data->nFileSizeLow = 0;
+ }
+ else {
+ find_data->nFileSizeHigh = buf.st_size >> 32;
+ find_data->nFileSizeLow = buf.st_size & 0xFFFFFFFF;
+ }
+
+ find_data->dwReserved0 = 0;
+ find_data->dwReserved1 = 0;
+
+ base_filename = g_path_get_basename (filename);
+ utf16_basename = g_utf8_to_utf16 (base_filename, MAX_PATH, NULL, NULL, NULL);
+
+ i = 0;
+ while (utf16_basename [i] != 0) { /* copy basename */
+ find_data->cFileName [i] = utf16_basename [i];
+ ++ i;
+ }
+
+ find_data->cFileName[i] = 0; /* null terminate */
+ find_data->cAlternateFileName [0] = 0; /* not used */
+
+ g_free (base_filename);
+ g_free (utf16_basename);
+ return TRUE;
+}
+
+/**
+ * FindClose:
+ * @wapi_handle: the find handle to close.
+ *
+ * Closes find handle @wapi_handle
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean FindClose (WapiHandle *wapi_handle)
+{
+ struct _WapiHandle_find *handle;
+
+ if (wapi_handle == INVALID_HANDLE_VALUE || wapi_handle->type != WAPI_HANDLE_FIND) {
+ SetLastError (ERROR_INVALID_HANDLE);
+ return FALSE;
+ }
+
+ handle = (struct _WapiHandle_find *)wapi_handle;
+ globfree (&handle->glob);
+ g_free (handle);
+
+ return TRUE;
+}
+
+/**
+ * CreateDirectory:
+ * @name: a pointer to a NULL-terminated unicode string, that names
+ * the directory to be created.
+ * @security: ignored for now
+ *
+ * Creates directory @name
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean CreateDirectory (const gunichar2 *name, WapiSecurityAttributes *security)
+{
+ gchar *utf8_name;
+ int result;
+
+ utf8_name = _wapi_unicode_to_utf8 (name);
+ if (utf8_name == NULL) {
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": unicode conversion returned NULL");
+#endif
+
+ return FALSE;
+ }
+
+ result = mkdir (utf8_name, 0777);
+ g_free (utf8_name);
+
+ if (result == 0)
+ return TRUE;
+
+ switch (errno) {
+ case EEXIST:
+ return TRUE;
+ default:
+ _wapi_set_last_error_from_errno ();
+ break;
+ }
+
+ return FALSE;
+}
+
+/**
+ * RemoveDirectory:
+ * @name: a pointer to a NULL-terminated unicode string, that names
+ * the directory to be removed.
+ *
+ * Removes directory @name
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean RemoveDirectory (const gunichar2 *name)
+{
+ gchar *utf8_name;
+ int result;
+
+ utf8_name = _wapi_unicode_to_utf8 (name);
+ if (utf8_name == NULL) {
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": unicode conversion returned NULL");
+#endif
+
+ return FALSE;
+ }
+
+ result = rmdir (utf8_name);
+ g_free (utf8_name);
+
+ if (result == 0)
+ return TRUE;
+
+ _wapi_set_last_error_from_errno ();
+ return FALSE;
+}
+
+/**
+ * GetFileAttributes:
+ * @name: a pointer to a NULL-terminated unicode filename.
+ *
+ * Gets the attributes for @name;
+ *
+ * Return value: -1 on failure
+ */
+guint32 GetFileAttributes (const gunichar2 *name)
+{
+ gchar *utf8_name;
+ struct stat buf;
+ int result;
+
+ utf8_name = _wapi_unicode_to_utf8 (name);
+ if (utf8_name == NULL) {
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": unicode conversion returned NULL");
+#endif
+
+ SetLastError (ERROR_INVALID_PARAMETER);
+ return -1;
+ }
+
+ result = stat (utf8_name, &buf);
+ g_free (utf8_name);
+
+ if (result != 0) {
+ SetLastError (ERROR_FILE_NOT_FOUND);
+ return -1;
+ }
+
+ return _wapi_stat_to_file_attributes (&buf);
+}
+
+/**
+ * GetFileAttributesEx:
+ * @name: a pointer to a NULL-terminated unicode filename.
+ * @level: must be GetFileExInfoStandard
+ * @info: pointer to a WapiFileAttributesData structure
+ *
+ * Gets attributes, size and filetimes for @name;
+ *
+ * Return value: %TRUE on success, %FALSE on failure
+ */
+gboolean GetFileAttributesEx (const gunichar2 *name, WapiGetFileExInfoLevels level, gpointer info)
+{
+ gchar *utf8_name;
+ WapiFileAttributesData *data;
+
+ struct stat buf;
+ time_t create_time;
+ int result;
+
+ if (level != GetFileExInfoStandard) {
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": info level %d not supported.", level);
+#endif
+
+ return FALSE;
+ }
+
+ utf8_name = _wapi_unicode_to_utf8 (name);
+ if (utf8_name == NULL) {
+#ifdef DEBUG
+ g_message (G_GNUC_PRETTY_FUNCTION ": unicode conversion returned NULL");
+#endif
+
+ SetLastError (ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ result = stat (utf8_name, &buf);
+ g_free (utf8_name);
+
+ if (result != 0) {
+ SetLastError (ERROR_FILE_NOT_FOUND);
+ return FALSE;
+ }
+
+ /* fill data block */
+
+ data = (WapiFileAttributesData *)info;
+
+ if (buf.st_mtime < buf.st_ctime)
+ create_time = buf.st_mtime;
+ else
+ create_time = buf.st_ctime;
+
+ data->dwFileAttributes = _wapi_stat_to_file_attributes (&buf);
+
+ _wapi_time_t_to_filetime (create_time, &data->ftCreationTime);
+ _wapi_time_t_to_filetime (buf.st_atime, &data->ftLastAccessTime);
+ _wapi_time_t_to_filetime (buf.st_mtime, &data->ftLastWriteTime);
+
+ if (data->dwFileAttributes && FILE_ATTRIBUTE_DIRECTORY) {
+ data->nFileSizeHigh = 0;
+ data->nFileSizeLow = 0;
+ }
+ else {
+ data->nFileSizeHigh = buf.st_size >> 32;
+ data->nFileSizeLow = buf.st_size & 0xFFFFFFFF;
+ }
+
+ return TRUE;
+}
+
+/**
+ * SetFileAttributes
+ * @name: name of file
+ * @attrs: attributes to set
+ *
+ * Changes the attributes on a named file.
+ *
+ * Return value: %TRUE on success, %FALSE on failure.
+ */
+extern gboolean SetFileAttributes (const gunichar2 *name, guint32 attrs)
+{
+ /* FIXME: think of something clever to do on unix */
+
+ SetLastError (ERROR_INVALID_FUNCTION);
+ return FALSE;
+}
+
+/**
+ * GetCurrentDirectory
+ * @length: size of the buffer
+ * @buffer: pointer to buffer that recieves path
+ *
+ * Retrieves the current directory for the current process.
+ *
+ * Return value: number of characters in buffer on success, zero on failure
+ */
+extern guint32 GetCurrentDirectory (guint32 length, gunichar2 *buffer)
+{
+ gchar *path;
+ gunichar2 *utf16_path, *ptr;
+ glong count = 0;
+
+ path = g_get_current_dir ();
+ if (path == NULL)
+ return 0;
+
+ /* if buffer too small, return number of characters required.
+ * this is plain dumb.
+ */
+
+ count = strlen (path) + 1;
+ if (count > length)
+ return count;
+
+ utf16_path = g_utf8_to_utf16 (path, -1, NULL, NULL, NULL);
+ if (utf16_path == NULL)
+ return 0;
+
+ while (*ptr)
+ *buffer ++ = *ptr ++;
+
+ *buffer = 0;
+
+ g_free (utf16_path);
+ g_free (path);
+
+ return count;
+}
+
+/**
+ * SetCurrentDirectory
+ * @path: path to new directory
+ *
+ * Changes the directory path for the current process.
+ *
+ * Return value: %TRUE on success, %FALSE on failure.
+ */
+extern gboolean SetCurrentDirectory (const gunichar2 *path)
+{
+ gchar *utf8_path;
+ gboolean result;
+
+ utf8_path = _wapi_unicode_to_utf8 (path);
+ if (chdir (utf8_path) != 0) {
+ _wapi_set_last_error_from_errno ();
+ result = FALSE;
+ }
+ else
+ result = TRUE;
+
+ g_free (utf8_path);
+ return result;
+}
diff --git a/mono/io-layer/io.h b/mono/io-layer/io.h
new file mode 100644
index 00000000000..21b9a0ce1c5
--- /dev/null
+++ b/mono/io-layer/io.h
@@ -0,0 +1,174 @@
+#ifndef _WAPI_IO_H_
+#define _WAPI_IO_H_
+
+#include <stdlib.h>
+
+#include "mono/io-layer/wapi.h"
+
+typedef struct _WapiSecurityAttributes WapiSecurityAttributes;
+
+struct _WapiSecurityAttributes
+{
+ guint32 nLength;
+ gpointer lpSecurityDescriptor;
+ gboolean bInheritHandle;
+};
+
+typedef struct _WapiOverlapped WapiOverlapped;
+
+struct _WapiOverlapped
+{
+ guint32 Internal;
+ guint32 InternalHigh;
+ guint32 Offset;
+ guint32 OffsetHigh;
+ WapiHandle *hEvent;
+};
+
+#define GENERIC_READ 0x80000000
+#define GENERIC_WRITE 0x40000000
+#define GENERIC_EXECUTE 0x20000000
+#define GENERIC_ALL 0x10000000
+
+#define FILE_SHARE_READ 0x00000001
+#define FILE_SHARE_WRITE 0x00000002
+#define FILE_SHARE_DELETE 0x00000004
+
+#define CREATE_NEW 1
+#define CREATE_ALWAYS 2
+#define OPEN_EXISTING 3
+#define OPEN_ALWAYS 4
+#define TRUNCATE_EXISTING 5
+
+
+#define FILE_ATTRIBUTE_READONLY 0x00000001
+#define FILE_ATTRIBUTE_HIDDEN 0x00000002
+#define FILE_ATTRIBUTE_SYSTEM 0x00000004
+#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
+#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
+#define FILE_ATTRIBUTE_ENCRYPTED 0x00000040
+#define FILE_ATTRIBUTE_NORMAL 0x00000080
+#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
+#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
+#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
+#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
+#define FILE_ATTRIBUTE_OFFLINE 0x00001000
+#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
+#define FILE_FLAG_OPEN_NO_RECALL 0x00100000
+#define FILE_FLAG_OPEN_REPARSE_POINT 0x00200000
+#define FILE_FLAG_POSIX_SEMANTICS 0x01000000
+#define FILE_FLAG_BACKUP_SEMANTICS 0x02000000
+#define FILE_FLAG_DELETE_ON_CLOSE 0x04000000
+#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000
+#define FILE_FLAG_RANDOM_ACCESS 0x10000000
+#define FILE_FLAG_NO_BUFFERING 0x20000000
+#define FILE_FLAG_OVERLAPPED 0x40000000
+#define FILE_FLAG_WRITE_THROUGH 0x80000000
+
+#define MAX_PATH 260
+
+typedef enum {
+ STD_INPUT_HANDLE=-10,
+ STD_OUTPUT_HANDLE=-11,
+ STD_ERROR_HANDLE=-12,
+} WapiStdHandle;
+
+typedef enum {
+ FILE_BEGIN=0,
+ FILE_CURRENT=1,
+ FILE_END=2,
+} WapiSeekMethod;
+
+typedef enum {
+ FILE_TYPE_UNKNOWN=0x0000,
+ FILE_TYPE_DISK=0x0001,
+ FILE_TYPE_CHAR=0x0002,
+ FILE_TYPE_PIPE=0x0003,
+ FILE_TYPE_REMOTE=0x8000,
+} WapiFileType;
+
+typedef enum {
+ GetFileExInfoStandard=0x0000,
+ GetFileExMaxInfoLevel=0x0001
+} WapiGetFileExInfoLevels;
+
+typedef struct
+{
+ guint32 dwLowDateTime;
+ guint32 dwHighDateTime;
+} WapiFileTime;
+
+typedef struct
+{
+ guint16 wYear;
+ guint16 wMonth;
+ guint16 wDayOfWeek;
+ guint16 wDay;
+ guint16 wHour;
+ guint16 wMinute;
+ guint16 wSecond;
+ guint16 wMilliseconds;
+} WapiSystemTime;
+
+typedef struct
+{
+ guint32 dwFileAttributes;
+ WapiFileTime ftCreationTime;
+ WapiFileTime ftLastAccessTime;
+ WapiFileTime ftLastWriteTime;
+ guint32 nFileSizeHigh;
+ guint32 nFileSizeLow;
+ guint32 dwReserved0;
+ guint32 dwReserved1;
+ gunichar2 cFileName [MAX_PATH];
+ gunichar2 cAlternateFileName [14];
+} WapiFindData;
+
+typedef struct
+{
+ guint32 dwFileAttributes;
+ WapiFileTime ftCreationTime;
+ WapiFileTime ftLastAccessTime;
+ WapiFileTime ftLastWriteTime;
+ guint32 nFileSizeHigh;
+ guint32 nFileSizeLow;
+} WapiFileAttributesData;
+
+#define INVALID_SET_FILE_POINTER ((guint32)-1)
+#define INVALID_FILE_SIZE ((guint32)0xFFFFFFFF)
+
+extern WapiHandle *CreateFile(const gunichar2 *name, guint32 fileaccess,
+ guint32 sharemode,
+ WapiSecurityAttributes *security,
+ guint32 createmode,
+ guint32 attrs, WapiHandle *tmplate);
+extern gboolean DeleteFile(const gunichar2 *name);
+extern WapiHandle *GetStdHandle(WapiStdHandle stdhandle);
+extern gboolean ReadFile(WapiHandle *handle, gpointer buffer, guint32 numbytes,
+ guint32 *bytesread, WapiOverlapped *overlapped);
+extern gboolean WriteFile(WapiHandle *handle, gconstpointer buffer,
+ guint32 numbytes, guint32 *byteswritten,
+ WapiOverlapped *overlapped);
+extern gboolean FlushFileBuffers(WapiHandle *handle);
+extern gboolean SetEndOfFile(WapiHandle *handle);
+extern guint32 SetFilePointer(WapiHandle *handle, gint32 movedistance,
+ gint32 *highmovedistance, WapiSeekMethod method);
+extern WapiFileType GetFileType(WapiHandle *handle);
+extern guint32 GetFileSize(WapiHandle *handle, guint32 *highsize);
+extern gboolean GetFileTime(WapiHandle *handle, WapiFileTime *create_time, WapiFileTime *last_access, WapiFileTime *last_write);
+extern gboolean SetFileTime(WapiHandle *handle, const WapiFileTime *create_time, const WapiFileTime *last_access, const WapiFileTime *last_write);
+extern gboolean FileTimeToSystemTime(const WapiFileTime *file_time, WapiSystemTime *system_time);
+extern WapiHandle *FindFirstFile (const gunichar2 *pattern, WapiFindData *find_data);
+extern gboolean FindNextFile (WapiHandle *handle, WapiFindData *find_data);
+extern gboolean FindClose (WapiHandle *handle);
+extern gboolean CreateDirectory (const gunichar2 *name, WapiSecurityAttributes *security);
+extern gboolean RemoveDirectory (const gunichar2 *name);
+extern gboolean MoveFile (const gunichar2 *name, const gunichar2 *dest_name);
+extern gboolean CopyFile (const gunichar2 *name, const gunichar2 *dest_name, gboolean fail_if_exists);
+extern guint32 GetFileAttributes (const gunichar2 *name);
+extern gboolean GetFileAttributesEx (const gunichar2 *name, WapiGetFileExInfoLevels level, gpointer info);
+extern gboolean SetFileAttributes (const gunichar2 *name, guint32 attrs);
+extern guint32 GetCurrentDirectory (guint32 length, gunichar2 *buffer);
+extern gboolean SetCurrentDirectory (const gunichar2 *path);
+
+#endif /* _WAPI_IO_H_ */
diff --git a/mono/io-layer/macros.h b/mono/io-layer/macros.h
new file mode 100644
index 00000000000..cda5a3d5069
--- /dev/null
+++ b/mono/io-layer/macros.h
@@ -0,0 +1,15 @@
+#ifndef _WAPI_MACROS_H_
+#define _WAPI_MACROS_H_
+
+#include <glib.h>
+
+#define MAKEWORD(low, high) ((guint16)(((guint8)(low)) | \
+ ((guint16)((guint8)(high))) << 8))
+#define MAKELONG(low, high) ((guint32)(((guint16)(low)) | \
+ ((guint32)((guint16)(high))) << 16))
+#define LOWORD(i32) ((guint16)((i32) & 0xFFFF))
+#define HIWORD(i32) ((guint16)(((guint32)(i32) >> 16) & 0xFFFF))
+#define LOBYTE(i16) ((guint8)((i16) & 0xFF))
+#define HIBYTE(i16) ((guint8)(((guint16)(i16) >> 8) & 0xFF))
+
+#endif /* _WAPI_MACROS_H_ */
diff --git a/mono/io-layer/misc-private.h b/mono/io-layer/misc-private.h
new file mode 100644
index 00000000000..188d45cbdeb
--- /dev/null
+++ b/mono/io-layer/misc-private.h
@@ -0,0 +1,9 @@
+#ifndef _WAPI_MISC_PRIVATE_H_
+#define _WAPI_MISC_PRIVATE_H_
+
+#include <glib.h>
+#include <sys/time.h>
+
+extern void _wapi_calc_timeout(struct timespec *timeout, guint32 ms);
+
+#endif /* _WAPI_MISC_PRIVATE_H_ */
diff --git a/mono/io-layer/misc.c b/mono/io-layer/misc.c
new file mode 100644
index 00000000000..0b814cd8666
--- /dev/null
+++ b/mono/io-layer/misc.c
@@ -0,0 +1,18 @@
+#include <config.h>
+#include <glib.h>
+#include <sys/time.h>
+#include <stdlib.h>
+
+#include "misc-private.h"
+
+void _wapi_calc_timeout(struct timespec *timeout, guint32 ms)
+{
+ struct timeval now;
+ div_t divvy;
+
+ divvy=div((int)ms, 1000);
+ gettimeofday(&now, NULL);
+
+ timeout->tv_sec=now.tv_sec+divvy.quot;
+ timeout->tv_nsec=(now.tv_usec+divvy.rem)*1000;
+}
diff --git a/mono/io-layer/mono-mutex.c b/mono/io-layer/mono-mutex.c
new file mode 100644
index 00000000000..a2661115e4d
--- /dev/null
+++ b/mono/io-layer/mono-mutex.c
@@ -0,0 +1,320 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors: Jeffrey Stedfast <fejj@ximian.com>
+ *
+ * Copyright 2002 Ximain, Inc. (www.ximian.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+#include <sys/time.h>
+
+#include "mono-mutex.h"
+
+
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
+int
+pthread_mutex_timedlock (pthread_mutex_t *mutex, const struct timespec *timeout)
+{
+ struct timeval timenow;
+ struct timespec sleepytime;
+ int retcode;
+
+ /* This is just to avoid a completely busy wait */
+ sleepytime.tv_sec = 0;
+ sleepytime.tv_nsec = 10000000; /* 10ms */
+
+ while ((retcode = pthread_mutex_trylock (mutex)) == EBUSY) {
+ gettimeofday (&timenow, NULL);
+
+ if (timenow.tv_sec >= timeout->tv_sec &&
+ (timenow.tv_usec * 1000) >= timeout->tv_nsec) {
+ return ETIMEDOUT;
+ }
+
+ nanosleep (&sleepytime, NULL);
+ }
+
+ return retcode;
+}
+#endif /* HAVE_PTHREAD_MUTEX_TIMEDLOCK */
+
+
+
+#ifdef USE_MONO_MUTEX
+
+int
+mono_mutexattr_init (mono_mutexattr_t *attr)
+{
+ memset (attr, 0, sizeof (mono_mutexattr_t));
+ return 0;
+}
+
+int
+mono_mutexattr_settype (mono_mutexattr_t *attr, int type)
+{
+ attr->type = type;
+ return 0;
+}
+
+int
+mono_mutexattr_gettype (mono_mutexattr_t *attr, int *type)
+{
+ *type = attr->type;
+ return 0;
+}
+
+int
+mono_mutexattr_setpshared (mono_mutexattr_t *attr, int pshared)
+{
+ attr->shared = pshared;
+ return 0;
+}
+
+int
+mono_mutexattr_getpshared (mono_mutexattr_t *attr, int *pshared)
+{
+ *pshared = attr->shared;
+ return 0;
+}
+
+int
+mono_mutexattr_setprotocol (mono_mutexattr_t *attr, int protocol)
+{
+ attr->protocol = protocol;
+ return 0;
+}
+
+int
+mono_mutexattr_getprotocol (mono_mutexattr_t *attr, int *protocol)
+{
+ *protocol = attr->protocol;
+ return 0;
+}
+
+int
+mono_mutexattr_setprioceiling (mono_mutexattr_t *attr, int prioceiling)
+{
+ attr->priority = prioceiling;
+ return 0;
+}
+
+int
+mono_mutexattr_getprioceiling (mono_mutexattr_t *attr, int *prioceiling)
+{
+ *prioceiling = attr->priority;
+ return 0;
+}
+
+int
+mono_mutexattr_destroy (mono_mutexattr_t *attr)
+{
+ return 0;
+}
+
+
+int
+mono_mutex_init (mono_mutex_t *mutex, const mono_mutexattr_t *attr)
+{
+ mutex->waiters = 0;
+ mutex->depth = 0;
+ mutex->owner = MONO_THREAD_NONE;
+
+ if (!attr || attr->type == MONO_MUTEX_NORMAL) {
+ mutex->type = MONO_MUTEX_NORMAL;
+ pthread_mutex_init (&mutex->mutex, NULL);
+ } else {
+ mutex->type = MONO_MUTEX_RECURSIVE;
+ pthread_mutex_init (&mutex->mutex, NULL);
+ pthread_cond_init (&mutex->cond, NULL);
+ }
+
+ return 0;
+}
+
+int
+mono_mutex_lock (mono_mutex_t *mutex)
+{
+ pthread_t id;
+
+ switch (mutex->type) {
+ case MONO_MUTEX_NORMAL:
+ return pthread_mutex_lock (&mutex->mutex);
+ case MONO_MUTEX_RECURSIVE:
+ id = pthread_self ();
+ if (pthread_mutex_lock (&mutex->mutex) != 0)
+ return EINVAL;
+
+ while (1) {
+ if (mutex->owner == MONO_THREAD_NONE) {
+ mutex->owner = id;
+ mutex->depth = 1;
+ break;
+ } else if (mutex->owner == id) {
+ mutex->depth++;
+ break;
+ } else {
+ mutex->waiters++;
+ if (pthread_cond_wait (&mutex->cond, &mutex->mutex) == -1)
+ return EINVAL;
+ mutex->waiters--;
+ }
+ }
+
+ return pthread_mutex_unlock (&mutex->mutex);
+ }
+
+ return EINVAL;
+}
+
+int
+mono_mutex_trylock (mono_mutex_t *mutex)
+{
+ pthread_t id;
+
+ switch (mutex->type) {
+ case MONO_MUTEX_NORMAL:
+ return pthread_mutex_trylock (&mutex->mutex);
+ case MONO_MUTEX_RECURSIVE:
+ id = pthread_self ();
+
+ if (pthread_mutex_lock (&mutex->mutex) != 0)
+ return EINVAL;
+
+ if (mutex->owner != MONO_THREAD_NONE && mutex->owner != id) {
+ pthread_mutex_unlock (&mutex->mutex);
+ return EBUSY;
+ }
+
+ while (1) {
+ if (mutex->owner == MONO_THREAD_NONE) {
+ mutex->owner = id;
+ mutex->depth = 1;
+ break;
+ } else {
+ mutex->depth++;
+ break;
+ }
+ }
+
+ return pthread_mutex_unlock (&mutex->mutex);
+ }
+
+ return EINVAL;
+}
+
+int
+mono_mutex_timedlock (mono_mutex_t *mutex, const struct timespec *timeout)
+{
+ pthread_t id;
+
+ switch (mutex->type) {
+ case MONO_MUTEX_NORMAL:
+ return pthread_mutex_timedlock (&mutex->mutex, timeout);
+ case MONO_MUTEX_RECURSIVE:
+ id = pthread_self ();
+
+ if (pthread_mutex_timedlock (&mutex->mutex, timeout) != 0)
+ return ETIMEDOUT;
+
+ while (1) {
+ if (mutex->owner == MONO_THREAD_NONE) {
+ mutex->owner = id;
+ mutex->depth = 1;
+ break;
+ } else if (mutex->owner == id) {
+ mutex->depth++;
+ break;
+ } else {
+ mutex->waiters++;
+ if (pthread_cond_timedwait (&mutex->cond, &mutex->mutex, timeout) != 0)
+ return ETIMEDOUT;
+ mutex->waiters--;
+ }
+ }
+
+ return pthread_mutex_unlock (&mutex->mutex);
+ }
+
+ return EINVAL;
+}
+
+int
+mono_mutex_unlock (mono_mutex_t *mutex)
+{
+ switch (mutex->type) {
+ case MONO_MUTEX_NORMAL:
+ return pthread_mutex_unlock (&mutex->mutex);
+ case MONO_MUTEX_RECURSIVE:
+ if (pthread_mutex_lock (&mutex->mutex) != 0)
+ return EINVAL;
+
+ assert (mutex->owner == pthread_self ());
+
+ mutex->depth--;
+ if (mutex->depth == 0) {
+ mutex->owner = MONO_THREAD_NONE;
+ if (mutex->waiters > 0)
+ pthread_cond_signal (&mutex->cond);
+ }
+
+ return pthread_mutex_unlock (&mutex->mutex);
+ }
+
+ return EINVAL;
+}
+
+int
+mono_mutex_destroy (mono_mutex_t *mutex)
+{
+ int ret = 0;
+
+ switch (mutex->type) {
+ case MONO_MUTEX_NORMAL:
+ ret = pthread_mutex_destroy (&mutex->mutex);
+ break;
+ case MONO_MUTEX_RECURSIVE:
+ if ((ret = pthread_mutex_destroy (&mutex->mutex)) == 0) {
+ pthread_cond_destroy (&mutex->cond);
+ }
+ }
+
+ return ret;
+}
+
+
+int
+mono_cond_wait (pthread_cond_t *cond, mono_mutex_t *mutex)
+{
+ return pthread_cond_wait (cond, &mutex->mutex);
+}
+
+int
+mono_cond_timedwait (pthread_cond_t *cond, mono_mutex_t *mutex, const struct timespec *timeout)
+{
+ return pthread_cond_timedwait (cond, &mutex->mutex, timeout);
+}
+
+#endif /* USE_MONO_MUTEX */
diff --git a/mono/io-layer/mono-mutex.h b/mono/io-layer/mono-mutex.h
new file mode 100644
index 00000000000..ea533aa1842
--- /dev/null
+++ b/mono/io-layer/mono-mutex.h
@@ -0,0 +1,160 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors: Jeffrey Stedfast <fejj@ximian.com>
+ *
+ * Copyright 2002 Ximain, Inc. (www.ximian.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+
+#ifndef __MONO_MUTEX_H__
+#define __MONO_MUTEX_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <pthread.h>
+#include <time.h>
+
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
+extern int pthread_mutex_timedlock (pthread_mutex_t *mutex,
+ const struct timespec *timeout);
+#endif /* HAVE_PTHREAD_MUTEX_TIMEDLOCK */
+
+
+#ifdef USE_MONO_MUTEX
+
+#define MONO_THREAD_NONE ((pthread_t)~0)
+
+/* mutex types... */
+enum {
+ MONO_MUTEX_NORMAL,
+ MONO_MUTEX_RECURSIVE,
+ MONO_MUTEX_ERRORCHECK = MONO_MUTEX_NORMAL,
+ MONO_MUTEX_DEFAULT = MONO_MUTEX_NORMAL
+};
+
+/* mutex protocol attributes... */
+enum {
+ MONO_THREAD_PRIO_NONE,
+ MONO_THREAD_PRIO_INHERIT,
+ MONO_THREAD_PRIO_PROTECT,
+};
+
+/* mutex process sharing attributes... */
+enum {
+ MONO_THREAD_PROCESS_PRIVATE,
+ MONO_THREAD_PROCESS_SHARED
+};
+
+typedef struct _mono_mutexattr_t {
+ int type : 1;
+ int shared : 1;
+ int protocol : 2;
+ int priority : 28;
+} mono_mutexattr_t;
+
+typedef struct _mono_mutex_t {
+ int type;
+ pthread_t owner;
+ short waiters;
+ short depth;
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+} mono_mutex_t;
+
+/* static initializers */
+#define MONO_MUTEX_INITIALIZER { 0, MONO_THREAD_NONE, 0, 0, PTHREAD_MUTEX_INITIALIZER, 0 }
+#define MONO_RECURSIVE_MUTEX_INITIALIZER { 0, MONO_THREAD_NONE, 0, 0, PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER }
+
+
+int mono_mutexattr_init (mono_mutexattr_t *attr);
+int mono_mutexattr_settype (mono_mutexattr_t *attr, int type);
+int mono_mutexattr_gettype (mono_mutexattr_t *attr, int *type);
+int mono_mutexattr_setpshared (mono_mutexattr_t *attr, int pshared);
+int mono_mutexattr_getpshared (mono_mutexattr_t *attr, int *pshared);
+int mono_mutexattr_setprotocol (mono_mutexattr_t *attr, int protocol);
+int mono_mutexattr_getprotocol (mono_mutexattr_t *attr, int *protocol);
+int mono_mutexattr_setprioceiling (mono_mutexattr_t *attr, int prioceiling);
+int mono_mutexattr_getprioceiling (mono_mutexattr_t *attr, int *prioceiling);
+int mono_mutexattr_destroy (mono_mutexattr_t *attr);
+
+
+int mono_mutex_init (mono_mutex_t *mutex, const mono_mutexattr_t *attr);
+int mono_mutex_lock (mono_mutex_t *mutex);
+int mono_mutex_trylock (mono_mutex_t *mutex);
+int mono_mutex_timedlock (mono_mutex_t *mutex, const struct timespec *timeout);
+int mono_mutex_unlock (mono_mutex_t *mutex);
+int mono_mutex_destroy (mono_mutex_t *mutex);
+
+#define mono_cond_init(cond,attr) pthread_cond_init (cond, attr)
+int mono_cond_wait (pthread_cond_t *cond, mono_mutex_t *mutex);
+int mono_cond_timedwait (pthread_cond_t *cond, mono_mutex_t *mutex, const struct timespec *timeout);
+#define mono_cond_signal(cond) pthread_cond_signal (cond)
+#define mono_cond_broadcast(cond) pthread_cond_broadcast (cond)
+
+#else /* system is equipped with a fully-functional pthread mutex library */
+
+#define MONO_MUTEX_NORMAL PTHREAD_MUTEX_NORMAL
+#define MONO_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE
+#define MONO_MUTEX_ERRORCHECK PTHREAD_MUTEX_NORMAL
+#define MONO_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
+
+#define MONO_THREAD_PRIO_NONE PTHREAD_PRIO_NONE
+#define MONO_THREAD_PRIO_INHERIT PTHREAD_PRIO_INHERIT
+#define MONO_THREAD_PRIO_PROTECT PTHREAD_PRIO_PROTECT
+
+#define MONO_THREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
+#define MONO_THREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
+
+typedef pthread_mutex_t mono_mutex_t;
+typedef pthread_mutexattr_t mono_mutexattr_t;
+
+#define MONO_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#define MONO_RECURSIVE_MUTEX_INITIALIZER PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+
+#define mono_mutexattr_init(attr) pthread_mutexattr_init (attr)
+#define mono_mutexattr_settype(attr,type) pthread_mutexattr_settype (attr, type)
+#define mono_mutexattr_gettype(attr,type) pthread_mutexattr_gettype (attr, type)
+#define mono_mutexattr_setpshared(attr,pshared) pthread_mutexattr_setpshared (attr, pshared)
+#define mono_mutexattr_getpshared(attr,pshared) pthread_mutexattr_getpshared (attr, pshared)
+#define mono_mutexattr_setprotocol(attr,protocol) pthread_mutexattr_setprotocol (attr, protocol)
+#define mono_mutexattr_getprotocol(attr,protocol) pthread_mutexattr_getprotocol (attr, protocol)
+#define mono_mutexattr_setprioceiling(attr,prioceiling) pthread_mutexattr_setprioceiling (attr, prioceiling)
+#define mono_mutexattr_getprioceiling(attr,prioceiling) pthread_mutexattr_getprioceiling (attr, prioceiling)
+
+#define mono_mutex_init(mutex,attr) pthread_mutex_init (mutex, attr)
+#define mono_mutex_lock(mutex) pthread_mutex_lock (mutex)
+#define mono_mutex_trylock(mutex) pthread_mutex_trylock (mutex)
+#define mono_mutex_timedlock(mutex,timeout) pthread_mutex_timedlock (mutex, timeout)
+#define mono_mutex_unlock(mutex) pthread_mutex_unlock (mutex)
+#define mono_mutex_destroy(mutex) pthread_mutex_destroy (mutex)
+
+#define mono_cond_init(cond,attr) pthread_cond_init (cond,attr)
+#define mono_cond_wait(cond,mutex) pthread_cond_wait (cond, mutex)
+#define mono_cond_timedwait(cond,mutex,timeout) pthread_cond_timedwait (cond, mutex, timeout)
+#define mono_cond_signal(cond) pthread_cond_signal (cond)
+#define mono_cond_broadcast(cond) pthread_cond_broadcast (cond)
+
+#endif /* USE_MONO_MUTEX */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __MONO_MUTEX_H__ */
diff --git a/mono/io-layer/mutexes.c b/mono/io-layer/mutexes.c
new file mode 100644
index 00000000000..02d09aec5a1
--- /dev/null
+++ b/mono/io-layer/mutexes.c
@@ -0,0 +1,372 @@
+#include <config.h>
+#include <glib.h>
+#include <pthread.h>
+#include <string.h>
+
+#include "mono/io-layer/wapi.h"
+#include "wapi-private.h"
+#include "wait-private.h"
+#include "misc-private.h"
+#include "handles-private.h"
+
+#include "mono-mutex.h"
+
+#undef DEBUG
+
+struct _WapiHandle_mutex
+{
+ WapiHandle handle;
+ mono_mutex_t mutex;
+ pthread_t tid;
+ guint32 recursion;
+};
+
+static void mutex_close(WapiHandle *handle);
+static gboolean mutex_wait(WapiHandle *handle, WapiHandle *signal, guint32 ms);
+static guint32 mutex_wait_multiple(gpointer data);
+static void mutex_signal(WapiHandle *handle);
+
+static struct _WapiHandleOps mutex_ops = {
+ mutex_close, /* close */
+ NULL, /* getfiletype */
+ NULL, /* readfile */
+ NULL, /* writefile */
+ NULL, /* flushfile */
+ NULL, /* seek */
+ NULL, /* setendoffile */
+ NULL, /* getfilesize */
+ NULL, /* getfiletime */
+ NULL, /* setfiletime */
+ mutex_wait, /* wait */
+ mutex_wait_multiple, /* wait_multiple */
+ mutex_signal, /* signal */
+};
+
+static void mutex_close(WapiHandle *handle)
+{
+ struct _WapiHandle_mutex *mutex_handle=(struct _WapiHandle_mutex *)handle;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": closing mutex handle %p",
+ mutex_handle);
+#endif
+
+ mono_mutex_destroy(&mutex_handle->mutex);
+}
+
+static gboolean mutex_wait(WapiHandle *handle, WapiHandle *signal, guint32 ms)
+{
+ struct _WapiHandle_mutex *mutex_handle=(struct _WapiHandle_mutex *)handle;
+ pthread_t tid=pthread_self();
+ int ret;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": waiting for mutex handle %p",
+ mutex_handle);
+#endif
+
+ /* Signal this handle now. It really doesn't matter if some
+ * other thread grabs the mutex before we can
+ */
+ if(signal!=NULL) {
+ signal->ops->signal(signal);
+ }
+
+ if(mutex_handle->tid==tid) {
+ /* We already own this mutex, so just increase the count and
+ * return TRUE
+ */
+
+ mutex_handle->recursion++;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Already own mutex handle %p (recursion %d)",
+ mutex_handle, mutex_handle->recursion);
+#endif
+
+ return(TRUE);
+ }
+
+ if(ms==INFINITE) {
+ ret=mono_mutex_lock(&mutex_handle->mutex);
+ } else {
+ struct timespec timeout;
+
+ _wapi_calc_timeout(&timeout, ms);
+
+ ret=mono_mutex_timedlock(&mutex_handle->mutex, &timeout);
+ }
+
+ if(ret==0) {
+ /* Mutex locked */
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Locking mutex handle %p",
+ mutex_handle);
+#endif
+
+ mutex_handle->tid=tid;
+ mutex_handle->recursion=1;
+
+ return(TRUE);
+ } else {
+ /* ret might be ETIMEDOUT for timeout, or other for error */
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Failed to lock mutex handle %p: %s", mutex_handle,
+ strerror(ret));
+#endif
+ return(FALSE);
+ }
+}
+
+static guint32 mutex_wait_multiple(gpointer data G_GNUC_UNUSED)
+{
+ WaitQueueItem *item=(WaitQueueItem *)data;
+ GPtrArray *needed;
+ int ret;
+ guint32 numhandles;
+ struct timespec timeout;
+ pthread_t tid=pthread_self();
+ guint32 i, iterations;
+
+ numhandles=item->handles[WAPI_HANDLE_MUTEX]->len;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": waiting on %d mutex handles for %d ms", numhandles,
+ item->timeout);
+#endif
+
+ /*
+ * See which ones we need to lock
+ */
+ needed=g_ptr_array_new();
+ for(i=0; i<numhandles; i++) {
+ struct _WapiHandle_mutex *mutex_handle;
+
+ mutex_handle=g_ptr_array_index(
+ item->handles[WAPI_HANDLE_MUTEX], i);
+
+ if(mutex_handle->tid!=tid) {
+ /* We don't have this one, so add it to the list */
+ g_ptr_array_add(needed, mutex_handle);
+ }
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": need to lock %d mutex handles",
+ needed->len);
+#endif
+
+ iterations=0;
+ do {
+ iterations++;
+
+ /* If the timeout isnt INFINITE but greater than 1s,
+ * split the timeout into 1s chunks
+ */
+ if((item->timeout!=INFINITE) &&
+ (item->timeout < (iterations*1000))) {
+ _wapi_calc_timeout(
+ &timeout, item->timeout-((iterations-1)*1000));
+ } else {
+ _wapi_calc_timeout(&timeout, 1000);
+ }
+
+ /* Try and lock as many mutexes as we can until we run
+ * out of time, but to avoid deadlocks back off if we
+ * fail to lock one
+ */
+ for(i=0; i<needed->len; i++) {
+ struct _WapiHandle_mutex *mutex_handle;
+
+ mutex_handle=g_ptr_array_index(needed, i);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Locking %d mutex %p (owner %ld, me %ld)",
+ i, mutex_handle, mutex_handle->tid, tid);
+#endif
+
+ ret=mono_mutex_timedlock(&mutex_handle->mutex,
+ &timeout);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": timedlock ret %s",
+ strerror(ret));
+#endif
+
+ if(ret!=0) {
+ /* ETIMEDOUT is the most likely, but
+ * fail on other error too
+ */
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Lock %d mutex failed: %s", i,
+ strerror(ret));
+#endif
+
+ while(i--) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Releasing %d mutex", i);
+#endif
+ mutex_handle=g_ptr_array_index(needed,
+ i);
+ mono_mutex_unlock(&mutex_handle->mutex);
+ }
+
+ break;
+ }
+
+ /* OK, got that one. Don't record it as ours
+ * though until we get them all
+ */
+ }
+
+ if(i==needed->len) {
+ /* We've locked all the mutexes. Update the
+ * ones we already had, and record that the
+ * new ones belong to us
+ */
+ for(i=0; i<numhandles; i++) {
+ struct _WapiHandle_mutex *mutex_handle;
+ guint32 idx;
+
+ mutex_handle=g_ptr_array_index(
+ item->handles[WAPI_HANDLE_MUTEX], i);
+
+ idx=g_array_index(
+ item->waitindex[WAPI_HANDLE_MUTEX],
+ guint32, i);
+ _wapi_handle_set_lowest(item, idx);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Updating mutex %p", mutex_handle);
+#endif
+
+ if(mutex_handle->tid==tid) {
+ /* We already own this mutex,
+ * so just increase the count
+ */
+ mutex_handle->recursion++;
+ } else {
+ mutex_handle->tid=tid;
+ mutex_handle->recursion=1;
+ }
+ }
+
+ g_ptr_array_free(needed, FALSE);
+
+ item->waited[WAPI_HANDLE_MUTEX]=TRUE;
+ item->waitcount[WAPI_HANDLE_MUTEX]=numhandles;
+
+ return(numhandles);
+ }
+ } while((item->timeout==INFINITE) ||
+ (item->timeout > (iterations * 1000)));
+
+ /* Didn't get all the locks, and timeout isn't INFINITE */
+
+ g_ptr_array_free(needed, FALSE);
+
+ item->waited[WAPI_HANDLE_MUTEX]=TRUE;
+ item->waitcount[WAPI_HANDLE_MUTEX]=0;
+
+ return(0);
+}
+
+static void mutex_signal(WapiHandle *handle)
+{
+ ReleaseMutex(handle);
+}
+
+/**
+ * CreateMutex:
+ * @security: Ignored for now.
+ * @owned: If %TRUE, the mutex is created with the calling thread
+ * already owning the mutex.
+ * @name:Pointer to a string specifying the name of this mutex, or
+ * %NULL. Currently ignored.
+ *
+ * Creates a new mutex handle. A mutex is signalled when no thread
+ * owns it. A thread acquires ownership of the mutex by waiting for
+ * it with WaitForSingleObject() or WaitForMultipleObjects(). A
+ * thread relinquishes ownership with ReleaseMutex().
+ *
+ * A thread that owns a mutex can specify the same mutex in repeated
+ * wait function calls without blocking. The thread must call
+ * ReleaseMutex() an equal number of times to release the mutex.
+ *
+ * Return value: A new handle, or %NULL on error.
+ */
+WapiHandle *CreateMutex(WapiSecurityAttributes *security G_GNUC_UNUSED, gboolean owned G_GNUC_UNUSED,
+ const guchar *name G_GNUC_UNUSED)
+{
+ struct _WapiHandle_mutex *mutex_handle;
+ WapiHandle *handle;
+
+ mutex_handle=(struct _WapiHandle_mutex *)g_new0(struct _WapiHandle_mutex, 1);
+ handle=(WapiHandle *)mutex_handle;
+ _WAPI_HANDLE_INIT(handle, WAPI_HANDLE_MUTEX, mutex_ops);
+
+ mono_mutex_init(&mutex_handle->mutex, NULL);
+ if(owned==TRUE) {
+ pthread_t tid=pthread_self();
+
+ mono_mutex_lock(&mutex_handle->mutex);
+
+ mutex_handle->tid=tid;
+ mutex_handle->recursion=1;
+ }
+
+ return(handle);
+}
+
+/**
+ * ReleaseMutex:
+ * @handle: The mutex handle.
+ *
+ * Releases ownership if the mutex handle @handle.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise. This function
+ * fails if the calling thread does not own the mutex @handle.
+ */
+gboolean ReleaseMutex(WapiHandle *handle)
+{
+ struct _WapiHandle_mutex *mutex_handle=(struct _WapiHandle_mutex *)handle;
+ pthread_t tid=pthread_self();
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Releasing mutex handle %p",
+ mutex_handle);
+#endif
+
+ if(mutex_handle->tid!=tid) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": We don't own mutex handle %p (owned by %ld, me %ld)", mutex_handle, mutex_handle->tid, tid);
+#endif
+
+ return(FALSE);
+ }
+
+ /* OK, we own this mutex */
+ mutex_handle->recursion--;
+
+ if(mutex_handle->recursion==0) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Unlocking mutex handle %p",
+ mutex_handle);
+#endif
+
+ mutex_handle->tid=0;
+ mono_mutex_unlock(&mutex_handle->mutex);
+ }
+
+ return(TRUE);
+}
diff --git a/mono/io-layer/mutexes.h b/mono/io-layer/mutexes.h
new file mode 100644
index 00000000000..04e579413bc
--- /dev/null
+++ b/mono/io-layer/mutexes.h
@@ -0,0 +1,9 @@
+#ifndef _WAPI_MUTEXES_H_
+#define _WAPI_MUTEXES_H_
+
+#include <glib.h>
+
+extern WapiHandle *CreateMutex(WapiSecurityAttributes *security, gboolean owned, const guchar *name);
+extern gboolean ReleaseMutex(WapiHandle *handle);
+
+#endif /* _WAPI_MUTEXES_H_ */
diff --git a/mono/io-layer/semaphores.c b/mono/io-layer/semaphores.c
new file mode 100644
index 00000000000..1b7f3d1db4e
--- /dev/null
+++ b/mono/io-layer/semaphores.c
@@ -0,0 +1,436 @@
+#include <config.h>
+#include <glib.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include "mono/io-layer/wapi.h"
+#include "wapi-private.h"
+#include "wait-private.h"
+#include "misc-private.h"
+#include "handles-private.h"
+
+#include "mono-mutex.h"
+
+#undef DEBUG
+
+/* emulate sem_t, so that we can prod the internal state more easily */
+struct _WapiHandle_sem
+{
+ WapiHandle handle;
+ guint32 val;
+ gint32 max;
+};
+
+/* This mutex controls access to _all_ semaphores and should not be
+ * locked for long periods.
+ *
+ * This global mutex and cond is really for wait_multiple, so we dont
+ * have to try and lock multiple handle mutexes and conditions.
+ */
+static mono_mutex_t sem_mutex=MONO_MUTEX_INITIALIZER;
+static pthread_cond_t sem_cond=PTHREAD_COND_INITIALIZER;
+
+static void sema_close(WapiHandle *handle);
+static gboolean sema_wait(WapiHandle *handle, WapiHandle *signal, guint32 ms);
+static guint32 sema_wait_multiple(gpointer data);
+static void sema_signal(WapiHandle *handle);
+
+static struct _WapiHandleOps sem_ops = {
+ sema_close, /* close */
+ NULL, /* getfiletype */
+ NULL, /* readfile */
+ NULL, /* writefile */
+ NULL, /* flushfile */
+ NULL, /* seek */
+ NULL, /* setendoffile */
+ NULL, /* getfilesize */
+ NULL, /* getfiletime */
+ NULL, /* setfiletime */
+ sema_wait, /* wait */
+ sema_wait_multiple, /* wait_multiple */
+ sema_signal, /* signal */
+};
+
+static void sema_close(WapiHandle *handle G_GNUC_UNUSED)
+{
+ /* Not really much to do here */
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": closing sem handle %p", handle);
+#endif
+}
+
+static gboolean sema_wait(WapiHandle *handle, WapiHandle *signal, guint32 ms)
+{
+ struct _WapiHandle_sem *sem_handle=(struct _WapiHandle_sem *)handle;
+ gboolean waited;
+ int ret;
+
+ mono_mutex_lock(&sem_mutex);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Sem %p val %d ms %d", handle,
+ sem_handle->val, ms);
+#endif
+
+ /* Signal this handle after we have obtained the semaphore
+ * global lock
+ */
+ if(signal!=NULL) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": signalling %p", signal);
+#endif
+ signal->ops->signal(signal);
+ }
+
+ /* Shortcut when ms==0 */
+ if(ms==0) {
+ /* Just poll */
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Polling");
+#endif
+ if(sem_handle->val>0) {
+ waited=TRUE;
+ } else {
+ waited=FALSE;
+ }
+ goto end;
+ }
+
+ /* Check state first */
+ if(sem_handle->val>0) {
+ waited=TRUE;
+ goto end;
+ }
+
+ if(ms==INFINITE) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": wait for %p INFINITE",
+ sem_handle);
+#endif
+ try_again_infinite:
+ ret=mono_cond_wait(&sem_cond, &sem_mutex);
+ if(ret==0) {
+ /* See if we were signalled (it might have been
+ * another semaphore)
+ */
+ if(sem_handle->val>0) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": sem %p has been signalled",
+ sem_handle);
+#endif
+ waited=TRUE;
+ } else {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": sem %p not signalled",
+ sem_handle);
+#endif
+ goto try_again_infinite;
+ }
+ }
+ } else {
+ struct timespec timeout;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": wait for %p for %d ms",
+ sem_handle, ms);
+#endif
+
+ _wapi_calc_timeout(&timeout, ms);
+
+ try_again_timed:
+ ret=mono_cond_timedwait(&sem_cond, &sem_mutex, &timeout);
+ if(ret==0) {
+ /* See if we were signalled (it might have been
+ * another semaphore)
+ */
+ if(sem_handle->val>0) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": sem %p has been signalled",
+ sem_handle);
+#endif
+ waited=TRUE;
+ } else {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": sem %p not signalled",
+ sem_handle);
+#endif
+ goto try_again_timed;
+ }
+ } else {
+ /* ret might be ETIMEDOUT for timeout, or
+ * other for error */
+ waited=FALSE;
+ }
+ }
+
+end:
+ if(waited==TRUE) {
+ sem_handle->val--;
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Waited TRUE, sem %p val now %d", sem_handle,
+ sem_handle->val);
+#endif
+ }
+#ifdef DEBUG
+ else {
+ g_message(G_GNUC_PRETTY_FUNCTION ": Waited FALSE, sem %p",
+ sem_handle);
+ }
+#endif
+
+ mono_mutex_unlock(&sem_mutex);
+ return(waited);
+}
+
+static guint32 sema_wait_multiple(gpointer data G_GNUC_UNUSED)
+{
+ WaitQueueItem *item=(WaitQueueItem *)data;
+ guint32 numhandles, count;
+ struct timespec timeout;
+ guint32 i;
+ int ret;
+
+ numhandles=item->handles[WAPI_HANDLE_SEM]->len;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": waiting on %d sem handles for %d ms", numhandles,
+ item->timeout);
+#endif
+
+ mono_mutex_lock(&sem_mutex);
+
+ /* First, check if any of the handles are already signalled.
+ * If waitall is specified we only return if all handles have
+ * been signalled.
+ */
+ for(count=0, i=0; i<numhandles; i++) {
+ struct _WapiHandle_sem *sem_handle;
+
+ sem_handle=g_ptr_array_index(item->handles[WAPI_HANDLE_SEM],
+ i);
+ if(sem_handle->val>0) {
+ count++;
+ }
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Preliminary check found %d handles signalled", count);
+#endif
+
+ if((item->waitall==TRUE && count==numhandles) ||
+ (item->waitall==FALSE && count>0)) {
+ goto success;
+ }
+
+ /* OK, we need to wait for some */
+ if(item->timeout!=INFINITE) {
+ _wapi_calc_timeout(&timeout, item->timeout);
+ }
+
+ /* We can restart from here without resetting the timeout,
+ * because it is calculated from absolute time, not an offset.
+ */
+again:
+ if(item->timeout==INFINITE) {
+ ret=mono_cond_wait(&sem_cond, &sem_mutex);
+ } else {
+ ret=mono_cond_timedwait(&sem_cond, &sem_mutex, &timeout);
+ }
+
+ if(ret==ETIMEDOUT) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Wait timed out");
+#endif
+
+ goto success;
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Sem posted, checking status");
+#endif
+
+ /* A semaphore was posted, so see if it was one we are
+ * interested in
+ */
+ for(count=0, i=0; i<numhandles; i++) {
+ struct _WapiHandle_sem *sem_handle;
+
+ sem_handle=g_ptr_array_index(item->handles[WAPI_HANDLE_SEM],
+ i);
+ if(sem_handle->val>0) {
+ count++;
+ }
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Check after sem post found %d handles signalled", count);
+#endif
+
+ if((item->waitall==TRUE && count==numhandles) ||
+ (item->waitall==FALSE && count>0)) {
+ goto success;
+ }
+
+ /* Either we have waitall set with more handles to wait for, or
+ * the sem that was posted wasn't interesting to us
+ */
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Waiting a bit longer");
+#endif
+
+ goto again;
+
+success:
+ item->waited[WAPI_HANDLE_SEM]=TRUE;
+ item->waitcount[WAPI_HANDLE_SEM]=count;
+
+ if((item->waitall==TRUE && count==numhandles) ||
+ (item->waitall==FALSE && count>0)) {
+ /* Decrease all waited semaphores */
+ for(i=0; i<numhandles; i++) {
+ struct _WapiHandle_sem *sem_handle;
+ guint32 idx;
+
+ sem_handle=g_ptr_array_index(
+ item->handles[WAPI_HANDLE_SEM], i);
+
+ idx=g_array_index(item->waitindex[WAPI_HANDLE_SEM],
+ guint32, i);
+ _wapi_handle_set_lowest(item, idx);
+
+ if(sem_handle->val>0) {
+ sem_handle->val--;
+ }
+ }
+ }
+
+ mono_mutex_unlock(&sem_mutex);
+
+ return(count);
+}
+
+static void sema_signal(WapiHandle *handle)
+{
+ ReleaseSemaphore(handle, 1, NULL);
+}
+
+/**
+ * CreateSemaphore:
+ * @security: Ignored for now.
+ * @initial: The initial count for the semaphore. The value must be
+ * greater than or equal to zero, and less than or equal to @max.
+ * @max: The maximum count for this semaphore. The value must be
+ * greater than zero.
+ * @name: Pointer to a string specifying the name of this semaphore,
+ * or %NULL. Currently ignored.
+ *
+ * Creates a new semaphore handle. A semaphore is signalled when its
+ * count is greater than zero, and unsignalled otherwise. The count
+ * is decreased by one whenever a wait function releases a thread that
+ * was waiting for the semaphore. The count is increased by calling
+ * ReleaseSemaphore().
+ *
+ * Return value: a new handle, or NULL
+ */
+WapiHandle *CreateSemaphore(WapiSecurityAttributes *security G_GNUC_UNUSED, gint32 initial, gint32 max, const guchar *name G_GNUC_UNUSED)
+{
+ struct _WapiHandle_sem *sem_handle;
+ WapiHandle *handle;
+
+ if(max<=0) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": max <= 0");
+#endif
+
+ return(NULL);
+ }
+
+ if(initial>max || initial<0) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": initial>max or < 0");
+#endif
+
+ return(NULL);
+ }
+
+ sem_handle=(struct _WapiHandle_sem *)g_new0(struct _WapiHandle_sem, 1);
+ handle=(WapiHandle *)sem_handle;
+ _WAPI_HANDLE_INIT(handle, WAPI_HANDLE_SEM, sem_ops);
+
+ sem_handle->val=initial;
+ sem_handle->max=max;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Created semaphore handle %p",
+ handle);
+#endif
+
+ return(handle);
+}
+
+/**
+ * ReleaseSemaphore:
+ * @handle: The semaphore handle to release.
+ * @count: The amount by which the semaphore's count should be
+ * increased.
+ * @prevcount: Pointer to a location to store the previous count of
+ * the semaphore, or %NULL.
+ *
+ * Increases the count of semaphore @handle by @count.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean ReleaseSemaphore(WapiHandle *handle, gint32 count, gint32 *prevcount)
+{
+ struct _WapiHandle_sem *sem_handle=(struct _WapiHandle_sem *)handle;
+ gboolean ret=FALSE;
+
+
+ mono_mutex_lock(&sem_mutex);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": sem %p val %d count %d",
+ sem_handle, sem_handle->val, count);
+#endif
+
+ /* Do this before checking for count overflow, because overflowing max
+ * is a listed technique for finding the current value
+ */
+ if(prevcount!=NULL) {
+ *prevcount=sem_handle->val;
+ }
+
+ /* No idea why max is signed, but thats the spec :-( */
+ if(sem_handle->val+count > (guint32)sem_handle->max) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": sem %p max value would be exceeded: max %d current %d count %d",
+ handle, sem_handle->max, sem_handle->val, count);
+#endif
+
+ goto end;
+ }
+
+ sem_handle->val+=count;
+ pthread_cond_broadcast(&sem_cond);
+ ret=TRUE;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": sem %p val now %d", sem_handle,
+ sem_handle->val);
+#endif
+
+end:
+ mono_mutex_unlock(&sem_mutex);
+ return(ret);
+}
diff --git a/mono/io-layer/semaphores.h b/mono/io-layer/semaphores.h
new file mode 100644
index 00000000000..21a8bd0e535
--- /dev/null
+++ b/mono/io-layer/semaphores.h
@@ -0,0 +1,9 @@
+#ifndef _WAPI_SEMAPHORES_H_
+#define _WAPI_SEMAPHORES_H_
+
+#include <glib.h>
+
+extern WapiHandle *CreateSemaphore(WapiSecurityAttributes *security, gint32 initial, gint32 max, const guchar *name);
+extern gboolean ReleaseSemaphore(WapiHandle *handle, gint32 count, gint32 *prevcount);
+
+#endif /* _WAPI_SEMAPHORES_H_ */
diff --git a/mono/io-layer/sockets.c b/mono/io-layer/sockets.c
new file mode 100644
index 00000000000..08ecb25e67d
--- /dev/null
+++ b/mono/io-layer/sockets.c
@@ -0,0 +1,977 @@
+#include <config.h>
+#include <glib.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#ifdef HAVE_SYS_FILIO_H
+#include <sys/filio.h> /* defines FIONBIO and FIONREAD */
+#endif
+#ifdef HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h> /* defines SIOCATMARK */
+#endif
+#include <unistd.h>
+
+#include "mono/io-layer/wapi.h"
+#include "wapi-private.h"
+
+#undef DEBUG
+
+struct _WapiHandle_socket
+{
+ WapiHandle handle;
+ int fd;
+};
+
+static guint32 startup_count=0;
+static GPtrArray *sockets=NULL;
+static pthread_key_t error_key;
+static pthread_once_t error_key_once=PTHREAD_ONCE_INIT;
+
+static void socket_close(WapiHandle *handle);
+
+static struct _WapiHandleOps socket_ops = {
+ socket_close, /* close */
+ NULL, /* getfiletype */
+ NULL, /* readfile */
+ NULL, /* writefile */
+ NULL, /* flushfile */
+ NULL, /* seek */
+ NULL, /* setendoffile */
+ NULL, /* getfilesize */
+ NULL, /* getfiletime */
+ NULL, /* setfiletime */
+ NULL, /* wait */
+ NULL, /* wait_multiple */
+ NULL, /* signal */
+};
+
+static void socket_close(WapiHandle *handle)
+{
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": closing socket handle %p", handle);
+#endif
+
+ closesocket(handle);
+}
+
+int WSAStartup(guint32 requested, WapiWSAData *data)
+{
+ if(data==NULL) {
+ return(WSAEFAULT);
+ }
+
+ /* Insist on v2.0+ */
+ if(requested < MAKEWORD(2,0)) {
+ return(WSAVERNOTSUPPORTED);
+ }
+
+ if(startup_count==0) {
+ sockets=g_ptr_array_new();
+ }
+
+ startup_count++;
+
+ /* I've no idea what is the minor version of the spec I read */
+ data->wHighVersion=MAKEWORD(2,0);
+
+ data->wVersion=requested < data->wHighVersion? requested:
+ data->wHighVersion;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": high version 0x%x",
+ data->wHighVersion);
+#endif
+
+ strncpy(data->szDescription, "WAPI", WSADESCRIPTION_LEN);
+ strncpy(data->szSystemStatus, "groovy", WSASYS_STATUS_LEN);
+
+ return(0);
+}
+
+int WSACleanup(void)
+{
+ guint32 i;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": cleaning up");
+#endif
+
+ if(--startup_count) {
+ /* Do nothing */
+ return(0);
+ }
+
+ /* Close down all sockets */
+ for(i=0; i<sockets->len; i++) {
+ WapiHandle *handle;
+
+ handle=g_ptr_array_index(sockets, i);
+ handle->ops->close(handle);
+ }
+
+ g_ptr_array_free(sockets, FALSE);
+ sockets=NULL;
+
+ return(0);
+}
+
+static void error_init(void)
+{
+ pthread_key_create(&error_key, NULL);
+}
+
+void WSASetLastError(int error)
+{
+ pthread_once(&error_key_once, error_init);
+ pthread_setspecific(error_key, GINT_TO_POINTER(error));
+}
+
+int WSAGetLastError(void)
+{
+ int err;
+ void *errptr;
+
+ pthread_once(&error_key_once, error_init);
+ errptr=pthread_getspecific(error_key);
+ err=GPOINTER_TO_INT(errptr);
+
+ return(err);
+}
+
+int closesocket(WapiHandle *handle)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ if(handle->type!=WAPI_HANDLE_SOCKET) {
+ WSASetLastError(WSAENOTSOCK);
+ return(SOCKET_ERROR);
+ }
+
+ g_ptr_array_remove_fast(sockets, handle);
+
+ ret=close(socket_handle->fd);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": close error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EBADF:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case EINTR:
+ WSASetLastError(WSAEINTR);
+ break;
+ case EIO:
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+ return(ret);
+}
+
+WapiHandle *_wapi_accept(WapiHandle *handle, struct sockaddr *addr, socklen_t *addrlen)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ struct _WapiHandle_socket *new_socket_handle;
+ WapiHandle *new_handle;
+ int fd;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(INVALID_SOCKET);
+ }
+
+ fd=accept(socket_handle->fd, addr, addrlen);
+ if(fd==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": accept error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+#if EAGAIN != EWOULDBLOCK
+ case EAGAIN:
+#endif
+ case EWOULDBLOCK:
+ WSASetLastError(WSAEWOULDBLOCK);
+ break;
+ case EBADF:
+ break;
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case EOPNOTSUPP:
+ WSASetLastError(WSAEOPNOTSUPP);
+ break;
+ case EFAULT:
+ WSASetLastError(WSAEFAULT);
+ break;
+ case EPERM:
+ WSASetLastError(WSAENETDOWN);
+ break;
+ case ENOBUFS:
+ case ENOMEM:
+ WSASetLastError(WSAENOBUFS);
+ break;
+ case EMFILE:
+ WSASetLastError(WSAEMFILE);
+ break;
+ case EINVAL:
+ WSASetLastError(WSAEINVAL);
+ break;
+#ifdef ENOSR
+ case ENOSR:
+#endif
+ case ECONNABORTED:
+ case ESOCKTNOSUPPORT:
+ case EPROTONOSUPPORT:
+ case ETIMEDOUT:
+#ifdef ERESTARTSYS
+ case ERESTARTSYS:
+#endif
+ WSASetLastError(WSAENETDOWN);
+ break;
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(INVALID_SOCKET);
+ }
+
+ new_socket_handle=g_new0(struct _WapiHandle_socket, 1);
+ new_handle=(WapiHandle *)new_socket_handle;
+
+ _WAPI_HANDLE_INIT(new_handle, WAPI_HANDLE_SOCKET, socket_ops);
+
+ new_socket_handle->fd=fd;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": returning newly accepted socket handle %p with fd %d",
+ new_handle, new_socket_handle->fd);
+#endif
+
+ return(new_handle);
+}
+
+int _wapi_bind(WapiHandle *handle, struct sockaddr *my_addr, socklen_t addrlen)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=bind(socket_handle->fd, my_addr, addrlen);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": bind error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EINVAL:
+ WSASetLastError(WSAEINVAL);
+ break;
+ case EACCES:
+ WSASetLastError(WSAEACCES);
+ break;
+ case EBADF:
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+
+ /* The following apply to Unix domain sockets */
+ case EFAULT:
+ WSASetLastError(WSAEFAULT);
+ break;
+ case EROFS:
+ case ENAMETOOLONG:
+ case ENOENT:
+ case ENOMEM:
+ case ENOTDIR:
+ case ELOOP:
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+ return(ret);
+}
+
+int _wapi_connect(WapiHandle *handle, const struct sockaddr *serv_addr, socklen_t addrlen)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=connect(socket_handle->fd, serv_addr, addrlen);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": bind error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EBADF:
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case EFAULT:
+ WSASetLastError(WSAEFAULT);
+ break;
+ case EISCONN:
+ WSASetLastError(WSAEISCONN);
+ break;
+ case ECONNREFUSED:
+ WSASetLastError(WSAECONNREFUSED);
+ break;
+ case ETIMEDOUT:
+ WSASetLastError(WSAETIMEDOUT);
+ break;
+ case ENETUNREACH:
+ WSASetLastError(WSAENETUNREACH);
+ break;
+ case EADDRINUSE:
+ WSASetLastError(WSAEADDRINUSE);
+ break;
+ case EINPROGRESS:
+ WSASetLastError(WSAEINPROGRESS);
+ break;
+ case EALREADY:
+ WSASetLastError(WSAEALREADY);
+ break;
+ case EAFNOSUPPORT:
+ WSASetLastError(WSAEAFNOSUPPORT);
+ break;
+ case EACCES:
+ case EPERM:
+ WSASetLastError(WSAEACCES);
+ break;
+ case EAGAIN:
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+ return(ret);
+}
+
+int _wapi_getpeername(WapiHandle *handle, struct sockaddr *name, socklen_t *namelen)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=getpeername(socket_handle->fd, name, namelen);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": getpeername error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EBADF:
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case ENOTCONN:
+ WSASetLastError(WSAENOTCONN);
+ break;
+ case ENOBUFS:
+ /* not documented */
+ WSASetLastError(WSAENOBUFS);
+ break;
+ case EFAULT:
+ WSASetLastError(WSAEFAULT);
+ break;
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+
+ return(ret);
+}
+
+int _wapi_getsockname(WapiHandle *handle, struct sockaddr *name, socklen_t *namelen)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=getsockname(socket_handle->fd, name, namelen);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": getsockname error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EBADF:
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case ENOBUFS:
+ /* not documented */
+ WSASetLastError(WSAENOBUFS);
+ break;
+ case EFAULT:
+ WSASetLastError(WSAEFAULT);
+ break;
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+
+ return(ret);
+}
+
+int _wapi_getsockopt(WapiHandle *handle, int level, int optname, void *optval, socklen_t *optlen)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=getsockopt(socket_handle->fd, level, optname, optval, optlen);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": getsockopt error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EBADF:
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case ENOPROTOOPT:
+ WSASetLastError(WSAENOPROTOOPT);
+ break;
+ case EFAULT:
+ WSASetLastError(WSAEFAULT);
+ break;
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+
+ return(ret);
+}
+
+int _wapi_listen(WapiHandle *handle, int backlog)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=listen(socket_handle->fd, backlog);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": listen error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EADDRINUSE:
+ WSASetLastError(WSAEADDRINUSE);
+ break;
+ case EBADF:
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case EOPNOTSUPP:
+ WSASetLastError(WSAEOPNOTSUPP);
+ break;
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+
+ return(0);
+}
+
+int _wapi_recv(WapiHandle *handle, void *buf, size_t len, int recv_flags)
+{
+ return(_wapi_recvfrom(handle, buf, len, recv_flags, NULL, 0));
+}
+
+int _wapi_recvfrom(WapiHandle *handle, void *buf, size_t len, int recv_flags, struct sockaddr *from, socklen_t *fromlen)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=recvfrom(socket_handle->fd, buf, len, recv_flags, from, fromlen);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": recv error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EBADF:
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case ECONNREFUSED:
+ /* Not documented */
+ WSASetLastError(WSAECONNREFUSED);
+ break;
+ case ENOTCONN:
+ WSASetLastError(WSAENOTCONN);
+ break;
+ case EAGAIN:
+ WSASetLastError(WSAEWOULDBLOCK);
+ break;
+ case EINTR:
+ WSASetLastError(WSAEINTR);
+ break;
+ case EFAULT:
+ WSASetLastError(WSAEFAULT);
+ break;
+ case EINVAL:
+ WSASetLastError(WSAEINVAL);
+ break;
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+ return(ret);
+}
+
+int _wapi_send(WapiHandle *handle, const void *msg, size_t len, int send_flags)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=send(socket_handle->fd, msg, len, send_flags);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": send error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EBADF:
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case EFAULT:
+ WSASetLastError(WSAEFAULT);
+ break;
+ case EMSGSIZE:
+ WSASetLastError(WSAEMSGSIZE);
+ break;
+#if EAGAIN != EWOULDBLOCK
+ case EAGAIN:
+#endif
+ case EWOULDBLOCK:
+ WSASetLastError(WSAEWOULDBLOCK);
+ break;
+ case ENOBUFS:
+ WSASetLastError(WSAENOBUFS);
+ break;
+ case EINTR:
+ WSASetLastError(WSAEINTR);
+ break;
+ case EINVAL:
+ WSASetLastError(WSAEINVAL);
+ break;
+ case EPIPE:
+ WSASetLastError(WSAESHUTDOWN);
+ break;
+ case ENOMEM:
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+ return(ret);
+}
+
+int _wapi_sendto(WapiHandle *handle, const void *msg, size_t len, int send_flags, const struct sockaddr *to, socklen_t tolen)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=sendto(socket_handle->fd, msg, len, send_flags, to, tolen);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": send error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EBADF:
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case EFAULT:
+ WSASetLastError(WSAEFAULT);
+ break;
+ case EMSGSIZE:
+ WSASetLastError(WSAEMSGSIZE);
+ break;
+#if EAGAIN != EWOULDBLOCK
+ case EAGAIN:
+#endif
+ case EWOULDBLOCK:
+ WSASetLastError(WSAEWOULDBLOCK);
+ break;
+ case ENOBUFS:
+ WSASetLastError(WSAENOBUFS);
+ break;
+ case EINTR:
+ WSASetLastError(WSAEINTR);
+ break;
+ case EINVAL:
+ WSASetLastError(WSAEINVAL);
+ break;
+ case EPIPE:
+ WSASetLastError(WSAESHUTDOWN);
+ break;
+ case ENOMEM:
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+ return(ret);
+}
+
+int _wapi_setsockopt(WapiHandle *handle, int level, int optname, const void *optval, socklen_t optlen)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=setsockopt(socket_handle->fd, level, optname, optval, optlen);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": setsockopt error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EBADF:
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case ENOPROTOOPT:
+ WSASetLastError(WSAENOPROTOOPT);
+ break;
+ case EFAULT:
+ WSASetLastError(WSAEFAULT);
+ break;
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+
+ return(ret);
+}
+
+int _wapi_shutdown(WapiHandle *handle, int how)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=shutdown(socket_handle->fd, how);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": shutdown error: %s",
+ strerror(errno));
+#endif
+
+ switch(errno) {
+ case EBADF:
+ case ENOTSOCK:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case ENOTCONN:
+ WSASetLastError(WSAENOTCONN);
+ break;
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+
+ return(ret);
+}
+
+WapiHandle *_wapi_socket(int domain, int type, int protocol)
+{
+ struct _WapiHandle_socket *socket_handle;
+ WapiHandle *handle;
+ int fd;
+
+ fd=socket(domain, type, protocol);
+ if(fd==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": socket error: %s", strerror(errno));
+#endif
+
+ return(INVALID_SOCKET);
+ }
+
+ socket_handle=g_new0(struct _WapiHandle_socket, 1);
+ handle=(WapiHandle *)socket_handle;
+
+ _WAPI_HANDLE_INIT(handle, WAPI_HANDLE_SOCKET, socket_ops);
+
+ socket_handle->fd=fd;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": returning socket handle %p with fd %d", handle,
+ socket_handle->fd);
+#endif
+
+ return(handle);
+}
+
+struct hostent *_wapi_gethostbyname(const char *hostname)
+{
+ struct hostent *he;
+
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(NULL);
+ }
+
+ he=gethostbyname(hostname);
+ if(he==NULL) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": listen error: %s",
+ strerror(errno));
+#endif
+
+ switch(h_errno) {
+ case HOST_NOT_FOUND:
+ WSASetLastError(WSAHOST_NOT_FOUND);
+ break;
+#if NO_ADDRESS != NO_DATA
+ case NO_ADDRESS:
+#endif
+ case NO_DATA:
+ WSASetLastError(WSANO_DATA);
+ break;
+ case NO_RECOVERY:
+ WSASetLastError(WSANO_RECOVERY);
+ break;
+ case TRY_AGAIN:
+ WSASetLastError(WSATRY_AGAIN);
+ break;
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+ }
+
+ return(he);
+}
+
+int ioctlsocket(WapiHandle *handle, gint32 command, gpointer arg)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ if(handle->type!=WAPI_HANDLE_SOCKET) {
+ WSASetLastError(WSAENOTSOCK);
+ return(SOCKET_ERROR);
+ }
+
+ if(command!=FIONBIO &&
+ command!=FIONREAD &&
+ command!=SIOCATMARK) {
+ /* Not listed in the MSDN specs, but ioctl(2) returns
+ * this if command is invalid
+ */
+ WSASetLastError(WSAEINVAL);
+ return(SOCKET_ERROR);
+ }
+
+ ret=ioctl(socket_handle->fd, command, arg);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": ioctl error: %s",
+ strerror(errno));
+#endif
+ switch(errno) {
+ case ENOTTY:
+ case EBADF:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case EFAULT:
+ WSASetLastError(WSAEFAULT);
+ break;
+ case EINVAL:
+ WSASetLastError(WSAEINVAL);
+ break;
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+
+ return(0);
+}
+
+int _wapi_select(int nfds G_GNUC_UNUSED, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, struct timeval *timeout)
+{
+ int ret;
+
+ if(startup_count==0) {
+ WSASetLastError(WSANOTINITIALISED);
+ return(SOCKET_ERROR);
+ }
+
+ ret=select(getdtablesize(), readfds, writefds, exceptfds, timeout);
+ if(ret==-1) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": select error: %s",
+ strerror(errno));
+#endif
+ switch(errno) {
+ case EBADF:
+ WSASetLastError(WSAENOTSOCK);
+ break;
+ case EINTR:
+ WSASetLastError(WSAEINTR);
+ break;
+ case EINVAL:
+ WSASetLastError(WSAEINVAL);
+ break;
+ case ENOMEM:
+ WSASetLastError(WSAEFAULT);
+ break;
+ default:
+ g_warning(G_GNUC_PRETTY_FUNCTION ": Need to translate [%s] into winsock error", strerror(errno));
+ break;
+ }
+
+ return(SOCKET_ERROR);
+ }
+
+ return(ret);
+}
+
+void _wapi_FD_CLR(WapiHandle *handle, fd_set *set)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+
+ FD_CLR(socket_handle->fd, set);
+}
+
+int _wapi_FD_ISSET(WapiHandle *handle, fd_set *set)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+
+ return(FD_ISSET(socket_handle->fd, set));
+}
+
+void _wapi_FD_SET(WapiHandle *handle, fd_set *set)
+{
+ struct _WapiHandle_socket *socket_handle=(struct _WapiHandle_socket *)handle;
+
+ FD_SET(socket_handle->fd, set);
+}
+
diff --git a/mono/io-layer/sockets.h b/mono/io-layer/sockets.h
new file mode 100644
index 00000000000..40337932451
--- /dev/null
+++ b/mono/io-layer/sockets.h
@@ -0,0 +1,98 @@
+#ifndef _WAPI_SOCKETS_H_
+#define _WAPI_SOCKETS_H_
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+
+#include "mono/io-layer/wapi.h"
+
+#define WSADESCRIPTION_LEN 256
+#define WSASYS_STATUS_LEN 128
+
+typedef struct
+{
+ guint16 wVersion;
+ guint16 wHighVersion;
+ char szDescription[WSADESCRIPTION_LEN+1];
+ char szSystemStatus[WSASYS_STATUS_LEN+1];
+ guint16 iMaxSockets;
+ guint16 iMaxUdpDg;
+ guchar *lpVendorInfo;
+} WapiWSAData;
+
+#define INVALID_SOCKET (WapiHandle *)-1
+#define SOCKET_ERROR -1
+
+extern int WSAStartup(guint32 requested, WapiWSAData *data);
+extern int WSACleanup(void);
+extern void WSASetLastError(int error);
+extern int WSAGetLastError(void);
+extern int closesocket(WapiHandle *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 WapiHandle *_wapi_accept(WapiHandle *handle, struct sockaddr *addr, socklen_t *addrlen);
+extern int _wapi_bind(WapiHandle *handle, struct sockaddr *my_addr, socklen_t addrlen);
+extern int _wapi_connect(WapiHandle *handle, const struct sockaddr *serv_addr, socklen_t addrlen);
+extern int _wapi_getpeername(WapiHandle *handle, struct sockaddr *name, socklen_t *namelen);
+extern int _wapi_getsockname(WapiHandle *handle, struct sockaddr *name, socklen_t *namelen);
+extern int _wapi_getsockopt(WapiHandle *handle, int level, int optname, void *optval, socklen_t *optlen);
+extern int _wapi_listen(WapiHandle *handle, int backlog);
+extern int _wapi_recv(WapiHandle *handle, void *buf, size_t len, int recv_flags);
+extern int _wapi_recvfrom(WapiHandle *handle, void *buf, size_t len, int recv_flags, struct sockaddr *from, socklen_t *fromlen);
+extern int _wapi_send(WapiHandle *handle, const void *msg, size_t len, int send_flags);
+extern int _wapi_sendto(WapiHandle *handle, const void *msg, size_t len, int send_flags, const struct sockaddr *to, socklen_t tolen);
+extern int _wapi_setsockopt(WapiHandle *handle, int level, int optname, const void *optval, socklen_t optlen);
+extern int _wapi_shutdown(WapiHandle *handle, int how);
+extern WapiHandle *_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(WapiHandle *handle, fd_set *set);
+extern int _wapi_FD_ISSET(WapiHandle *handle, fd_set *set);
+extern void _wapi_FD_SET(WapiHandle *handle, fd_set *set);
+
+extern int ioctlsocket(WapiHandle *handle, gint32 command, gpointer arg);
+
+#endif /* _WAPI_SOCKETS_H_ */
diff --git a/mono/io-layer/status.h b/mono/io-layer/status.h
new file mode 100644
index 00000000000..cbbf12a55f4
--- /dev/null
+++ b/mono/io-layer/status.h
@@ -0,0 +1,36 @@
+#ifndef _WAPI_STATUS_H_
+#define _WAPI_STATUS_H_
+
+typedef enum {
+ STATUS_WAIT_0 = 0x00000000,
+ STATUS_ABANDONED_WAIT_0 = 0x00000080,
+ STATUS_USER_APC = 0x000000C0,
+ STATUS_TIMEOUT = 0x00000102,
+ STATUS_PENDING = 0x00000103,
+ STATUS_SEGMENT_NOTIFICATION = 0x40000005,
+ STATUS_GUARD_PAGE_VIOLATION = 0x80000001,
+ STATUS_DATATYPE_MISALIGNMENT = 0x80000002,
+ STATUS_BREAKPOINT = 0x80000003,
+ STATUS_SINGLE_STEP = 0x80000004,
+ STATUS_ACCESS_VIOLATION = 0xC0000005,
+ STATUS_IN_PAGE_ERROR = 0xC0000006,
+ STATUS_NO_MEMORY = 0xC0000017,
+ STATUS_ILLEGAL_INSTRUCTION = 0xC000001D,
+ STATUS_NONCONTINUABLE_EXCEPTION = 0xC0000025,
+ STATUS_INVALID_DISPOSITION = 0xC0000026,
+ STATUS_ARRAY_BOUNDS_EXCEEDED = 0xC000008C,
+ STATUS_FLOAT_DENORMAL_OPERAND = 0xC000008D,
+ STATUS_FLOAT_DIVIDE_BY_ZERO = 0xC000008E,
+ STATUS_FLOAT_INEXACT_RESULT = 0xC000008F,
+ STATUS_FLOAT_INVALID_OPERATION = 0xC0000090,
+ STATUS_FLOAT_OVERFLOW = 0xC0000091,
+ STATUS_FLOAT_STACK_CHECK = 0xC0000092,
+ STATUS_FLOAT_UNDERFLOW = 0xC0000093,
+ STATUS_INTEGER_DIVIDE_BY_ZERO = 0xC0000094,
+ STATUS_INTEGER_UNDERFLOW = 0xC0000095,
+ STATUS_PRIVILEGED_INSTRUCTION = 0xC0000096,
+ STATUS_STACK_OVERFLOW = 0xC00000FD,
+ STATUS_CONTROL_C_EXIT = 0xC000013A,
+} WapiStatus;
+
+#endif /* _WAPI_STATUS_H_ */
diff --git a/mono/io-layer/system.c b/mono/io-layer/system.c
new file mode 100644
index 00000000000..55e3cdd08db
--- /dev/null
+++ b/mono/io-layer/system.c
@@ -0,0 +1,17 @@
+#include <config.h>
+#include <glib.h>
+#include <sys/time.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "mono/io-layer/wapi.h"
+
+void GetSystemInfo(WapiSystemInfo *info)
+{
+ info->dwPageSize=getpagesize();
+
+ /* Fill in the rest of this junk. Maybe with libgtop */
+ info->dwNumberOfProcessors=1;
+}
+
+
diff --git a/mono/io-layer/system.h b/mono/io-layer/system.h
new file mode 100644
index 00000000000..08ea5f81271
--- /dev/null
+++ b/mono/io-layer/system.h
@@ -0,0 +1,33 @@
+#ifndef _WAPI_SYSTEM_H_
+#define _WAPI_SYSTEM_H_
+
+#include <glib.h>
+
+typedef struct _WapiSystemInfo WapiSystemInfo;
+
+struct _WapiSystemInfo
+{
+ union _anon_union
+ {
+ guint32 dwOemId;
+ struct _anon_struct
+ {
+ guint16 wProcessorArchitecture;
+ guint16 wReserved;
+ };
+ };
+
+ guint32 dwPageSize;
+ gpointer lpMinimumApplicationAddress;
+ gpointer lpMaximumApplicationAddress;
+ guint32 /*_PTR?*/ dwActiveProcessorMask;
+ guint32 dwNumberOfProcessors;
+ guint32 dwProcessorType;
+ guint32 dwAllocationGranularity;
+ guint16 wProcessorLevel;
+ guint16 wProcessorRevision;
+};
+
+extern void GetSystemInfo(WapiSystemInfo *info);
+
+#endif /* _WAPI_SYSTEM_H_ */
diff --git a/mono/io-layer/threads.c b/mono/io-layer/threads.c
new file mode 100644
index 00000000000..941e60e9f9d
--- /dev/null
+++ b/mono/io-layer/threads.c
@@ -0,0 +1,657 @@
+#include <config.h>
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#include "mono/utils/mono-hash.h"
+#endif
+#include <glib.h>
+#include <string.h>
+#include <pthread.h>
+#include <sched.h>
+#include <sys/time.h>
+#include <errno.h>
+
+#include "mono/io-layer/wapi.h"
+#include "wapi-private.h"
+#include "timed-thread.h"
+#include "wait-private.h"
+#include "handles-private.h"
+#include "misc-private.h"
+
+#include "mono-mutex.h"
+
+#undef DEBUG
+
+typedef enum {
+ THREAD_STATE_START,
+ THREAD_STATE_EXITED,
+} WapiThreadState;
+
+struct _WapiHandle_thread
+{
+ WapiHandle handle;
+ WapiThreadState state;
+ TimedThread *thread;
+ guint32 exitstatus;
+};
+
+static mono_mutex_t thread_signal_mutex = MONO_MUTEX_INITIALIZER;
+static pthread_cond_t thread_signal_cond = PTHREAD_COND_INITIALIZER;
+
+/* Hash threads with tids. I thought of using TLS for this, but that
+ * would have to set the data in the new thread, which is more hassle
+ */
+static pthread_once_t thread_hash_once = PTHREAD_ONCE_INIT;
+static mono_mutex_t thread_hash_mutex = MONO_MUTEX_INITIALIZER;
+static GHashTable *thread_hash=NULL;
+
+#if HAVE_BOEHM_GC
+static MonoGHashTable *tls_gc_hash = NULL;
+#endif
+
+static void thread_close(WapiHandle *handle);
+static gboolean thread_wait(WapiHandle *handle, WapiHandle *signal,
+ guint32 ms);
+static guint32 thread_wait_multiple(gpointer data);
+
+static struct _WapiHandleOps thread_ops = {
+ thread_close, /* close */
+ NULL, /* getfiletype */
+ NULL, /* readfile */
+ NULL, /* writefile */
+ NULL, /* flushfile */
+ NULL, /* seek */
+ NULL, /* setendoffile */
+ NULL, /* getfilesize */
+ NULL, /* getfiletime */
+ NULL, /* setfiletime */
+ thread_wait, /* wait */
+ thread_wait_multiple, /* wait_multiple */
+ NULL, /* signal */
+};
+
+static void thread_close(WapiHandle *handle)
+{
+ struct _WapiHandle_thread *thread_handle=(struct _WapiHandle_thread *)handle;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": closing thread handle %p with thread %p id %ld",
+ thread_handle, thread_handle->thread,
+ thread_handle->thread->id);
+#endif
+
+ mono_mutex_destroy (&thread_handle->thread->join_mutex);
+ g_free(thread_handle->thread);
+}
+
+static gboolean thread_wait(WapiHandle *handle, WapiHandle *signal, guint32 ms)
+{
+ struct _WapiHandle_thread *thread_handle=(struct _WapiHandle_thread *)handle;
+ int ret;
+
+ /* A thread can never become unsignalled after it was
+ * signalled, so we can signal this handle now without
+ * worrying about lost wakeups
+ */
+ if(signal!=NULL) {
+ signal->ops->signal(signal);
+ }
+
+ if(handle->signalled==TRUE) {
+ /* Already signalled, so return straight away */
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": thread handle %p already signalled, returning now", handle);
+#endif
+
+ return(TRUE);
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": waiting for %d ms for thread handle %p with id %ld", ms,
+ thread_handle, thread_handle->thread->id);
+#endif
+
+ if(ms==INFINITE) {
+ ret=_wapi_timed_thread_join(thread_handle->thread, NULL, NULL);
+ } else {
+ struct timespec timeout;
+
+ _wapi_calc_timeout(&timeout, ms);
+
+ ret=_wapi_timed_thread_join(thread_handle->thread, &timeout,
+ NULL);
+ }
+
+ if(ret==0) {
+ /* Thread joined */
+ return(TRUE);
+ } else {
+ /* ret might be ETIMEDOUT for timeout, or other for error */
+ return(FALSE);
+ }
+}
+
+static guint32 thread_wait_multiple(gpointer data)
+{
+ WaitQueueItem *item=(WaitQueueItem *)data;
+ int ret;
+ guint32 numhandles, count;
+ struct timespec timeout;
+
+ numhandles=item->handles[WAPI_HANDLE_THREAD]->len;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": waiting on %d thread handles for %d ms", numhandles,
+ item->timeout);
+#endif
+
+ /* First, check if any of the handles are already
+ * signalled. If waitall is specified we only return if all
+ * handles have been signalled.
+ */
+ count=_wapi_handle_count_signalled(item, WAPI_HANDLE_THREAD);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Preliminary check found %d handles signalled", count);
+#endif
+
+ if((item->waitall==TRUE && count==numhandles) ||
+ (item->waitall==FALSE && count>0)) {
+ goto success;
+ }
+
+ /* OK, we need to wait for some */
+ if(item->timeout!=INFINITE) {
+ _wapi_calc_timeout(&timeout, item->timeout);
+ }
+
+ /* We can restart from here without resetting the timeout,
+ * because it is calculated from absolute time, not an offset
+ */
+again:
+ mono_mutex_lock(&thread_signal_mutex);
+ if(item->timeout==INFINITE) {
+ ret=mono_cond_wait(&thread_signal_cond,
+ &thread_signal_mutex);
+ } else {
+ ret=mono_cond_timedwait(&thread_signal_cond,
+ &thread_signal_mutex,
+ &timeout);
+ }
+ mono_mutex_unlock(&thread_signal_mutex);
+
+ if(ret==ETIMEDOUT) {
+ /* Check signalled state here, just in case a thread
+ * exited between the first check and the cond wait.
+ * We return the number of signalled handles, which
+ * may be fewer than the total.
+ */
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Wait timed out");
+#endif
+
+ count=_wapi_handle_count_signalled(item, WAPI_HANDLE_THREAD);
+ goto success;
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Thread exited, checking status");
+#endif
+
+ /* Another thread exited, so see if it was one we are
+ * interested in
+ */
+ count=_wapi_handle_count_signalled(item, WAPI_HANDLE_THREAD);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Check after thread exit found %d handles signalled",
+ count);
+#endif
+
+ if((item->waitall==TRUE && count==numhandles) ||
+ (item->waitall==FALSE && count>0)) {
+ goto success;
+ }
+
+ /* Either we have waitall set with more handles to wait for,
+ * or the thread that exited wasn't interesting to us
+ */
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Waiting a bit longer");
+#endif
+
+ goto again;
+
+success:
+ item->waited[WAPI_HANDLE_THREAD]=TRUE;
+ item->waitcount[WAPI_HANDLE_THREAD]=count;
+
+ return(count);
+}
+
+static void thread_exit(guint32 exitstatus, gpointer userdata)
+{
+ struct _WapiHandle_thread *thread_handle=(struct _WapiHandle_thread *)userdata;
+
+ thread_handle->exitstatus=exitstatus;
+ thread_handle->state=THREAD_STATE_EXITED;
+ thread_handle->handle.signalled=TRUE;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Recording thread handle %p id %ld status as %d",
+ thread_handle, thread_handle->thread->id, exitstatus);
+#endif
+
+ /* Remove this thread from the hash */
+ mono_mutex_lock(&thread_hash_mutex);
+ g_hash_table_remove(thread_hash, &thread_handle->thread->id);
+ mono_mutex_unlock(&thread_hash_mutex);
+
+ /* Signal any thread waiting on thread exit */
+ mono_mutex_lock(&thread_signal_mutex);
+ pthread_cond_broadcast(&thread_signal_cond);
+ mono_mutex_unlock(&thread_signal_mutex);
+}
+
+static void thread_hash_init(void)
+{
+ thread_hash=g_hash_table_new(g_int_hash, g_int_equal);
+}
+
+/**
+ * CreateThread:
+ * @security: Ignored for now.
+ * @stacksize: the size in bytes of the new thread's stack. Use 0 to
+ * default to the normal stack size. (Ignored for now).
+ * @start: The function that the new thread should start with
+ * @param: The parameter to give to @start.
+ * @create: If 0, the new thread is ready to run immediately. If
+ * %CREATE_SUSPENDED, the new thread will be in the suspended state,
+ * requiring a ResumeThread() call to continue running.
+ * @tid: If non-NULL, the ID of the new thread is stored here.
+ *
+ * Creates a new threading handle.
+ *
+ * Return value: a new handle, or NULL
+ */
+WapiHandle *CreateThread(WapiSecurityAttributes *security G_GNUC_UNUSED, guint32 stacksize G_GNUC_UNUSED,
+ WapiThreadStart start, gpointer param, guint32 create G_GNUC_UNUSED,
+ guint32 *tid)
+{
+ struct _WapiHandle_thread *thread_handle;
+ WapiHandle *handle;
+ int ret;
+
+ pthread_once(&thread_hash_once, thread_hash_init);
+
+ if(start==NULL) {
+ return(NULL);
+ }
+
+ thread_handle=(struct _WapiHandle_thread *)g_new0(struct _WapiHandle_thread, 1);
+
+ handle=(WapiHandle *)thread_handle;
+ _WAPI_HANDLE_INIT(handle, WAPI_HANDLE_THREAD, thread_ops);
+
+ thread_handle->state=THREAD_STATE_START;
+
+ /* Lock around the thread create, so that the new thread cant
+ * race us to look up the thread handle in GetCurrentThread()
+ */
+ mono_mutex_lock(&thread_hash_mutex);
+
+ ret=_wapi_timed_thread_create(&thread_handle->thread, NULL, start,
+ thread_exit, param, thread_handle);
+ if(ret!=0) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Thread create error: %s",
+ strerror(ret));
+#endif
+ mono_mutex_unlock(&thread_hash_mutex);
+ g_free(thread_handle);
+ return(NULL);
+ }
+
+ g_hash_table_insert(thread_hash, &thread_handle->thread->id,
+ thread_handle);
+ mono_mutex_unlock(&thread_hash_mutex);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Started thread handle %p thread %p ID %ld", thread_handle,
+ thread_handle->thread, thread_handle->thread->id);
+#endif
+
+ if(tid!=NULL) {
+ *tid=thread_handle->thread->id;
+ }
+
+ return(handle);
+}
+
+/**
+ * ExitThread:
+ * @exitcode: Sets the thread's exit code, which can be read from
+ * another thread with GetExitCodeThread().
+ *
+ * Terminates the calling thread. A thread can also exit by returning
+ * from its start function. When the last thread in a process
+ * terminates, the process itself terminates.
+ */
+void ExitThread(guint32 exitcode)
+{
+ _wapi_timed_thread_exit(exitcode);
+}
+
+/**
+ * GetExitCodeThread:
+ * @handle: The thread handle to query
+ * @exitcode: The thread @handle exit code is stored here
+ *
+ * Finds the exit code of @handle, and stores it in @exitcode. If the
+ * thread @handle is still running, the value stored is %STILL_ACTIVE.
+ *
+ * Return value: %TRUE, or %FALSE on error.
+ */
+gboolean GetExitCodeThread(WapiHandle *handle, guint32 *exitcode)
+{
+ struct _WapiHandle_thread *thread_handle=(struct _WapiHandle_thread *)handle;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Finding exit status for thread handle %p id %ld", handle,
+ thread_handle->thread->id);
+#endif
+
+ if(exitcode==NULL) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Nowhere to store exit code");
+#endif
+ return(FALSE);
+ }
+
+ if(thread_handle->state!=THREAD_STATE_EXITED) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Thread still active (state %d, exited is %d)",
+ thread_handle->state, THREAD_STATE_EXITED);
+#endif
+ *exitcode=STILL_ACTIVE;
+ return(TRUE);
+ }
+
+ *exitcode=thread_handle->exitstatus;
+
+ return(TRUE);
+}
+
+/**
+ * GetCurrentThreadId:
+ *
+ * Looks up the thread ID of the current thread. This ID can be
+ * passed to OpenThread() to create a new handle on this thread.
+ *
+ * Return value: the thread ID.
+ */
+guint32 GetCurrentThreadId(void)
+{
+ pthread_t tid=pthread_self();
+
+ return(tid);
+}
+
+/**
+ * GetCurrentThread:
+ *
+ * Looks up the handle associated with the current thread. Under
+ * Windows this is a pseudohandle, and must be duplicated with
+ * DuplicateHandle() for some operations.
+ *
+ * Return value: The current thread handle, or %NULL on failure.
+ * (Unknown whether Windows has a possible failure here. It may be
+ * necessary to implement the pseudohandle-constant behaviour).
+ */
+WapiHandle *GetCurrentThread(void)
+{
+ WapiHandle *ret=NULL;
+ guint32 tid;
+
+ tid=GetCurrentThreadId();
+
+ mono_mutex_lock(&thread_hash_mutex);
+
+ ret=g_hash_table_lookup(thread_hash, &tid);
+
+ mono_mutex_unlock(&thread_hash_mutex);
+
+ return(ret);
+}
+
+/**
+ * ResumeThread:
+ * @handle: the thread handle to resume
+ *
+ * Decrements the suspend count of thread @handle. A thread can only
+ * run if its suspend count is zero.
+ *
+ * Return value: the previous suspend count, or 0xFFFFFFFF on error.
+ */
+guint32 ResumeThread(WapiHandle *handle G_GNUC_UNUSED)
+{
+ return(0xFFFFFFFF);
+}
+
+/**
+ * SuspendThread:
+ * @handle: the thread handle to suspend
+ *
+ * Increments the suspend count of thread @handle. A thread can only
+ * run if its suspend count is zero.
+ *
+ * Return value: the previous suspend count, or 0xFFFFFFFF on error.
+ */
+guint32 SuspendThread(WapiHandle *handle G_GNUC_UNUSED)
+{
+ return(0xFFFFFFFF);
+}
+
+/*
+ * We assume here that TLS_MINIMUM_AVAILABLE is less than
+ * PTHREAD_KEYS_MAX, allowing enough overhead for a few TLS keys for
+ * library usage.
+ *
+ * Currently TLS_MINIMUM_AVAILABLE is 64 and _POSIX_THREAD_KEYS_MAX
+ * (the minimum value for PTHREAD_KEYS_MAX) is 128, so we should be
+ * fine.
+ */
+
+static pthread_key_t TLS_keys[TLS_MINIMUM_AVAILABLE];
+static gboolean TLS_used[TLS_MINIMUM_AVAILABLE]={FALSE};
+static mono_mutex_t TLS_mutex=MONO_MUTEX_INITIALIZER;
+
+/**
+ * TlsAlloc:
+ *
+ * Allocates a Thread Local Storage (TLS) index. Any thread in the
+ * same process can use this index to store and retrieve values that
+ * are local to that thread.
+ *
+ * Return value: The index value, or %TLS_OUT_OF_INDEXES if no index
+ * is available.
+ */
+guint32 TlsAlloc(void)
+{
+ guint32 i;
+
+ mono_mutex_lock(&TLS_mutex);
+
+ for(i=0; i<TLS_MINIMUM_AVAILABLE; i++) {
+ if(TLS_used[i]==FALSE) {
+ TLS_used[i]=TRUE;
+ pthread_key_create(&TLS_keys[i], NULL);
+
+ mono_mutex_unlock(&TLS_mutex);
+
+ return(i);
+ }
+ }
+
+ mono_mutex_unlock(&TLS_mutex);
+
+ return(TLS_OUT_OF_INDEXES);
+}
+
+#define MAKE_GC_ID(idx) (GUINT_TO_POINTER((idx)|(GetCurrentThreadId()<<8)))
+
+/**
+ * TlsFree:
+ * @idx: The TLS index to free
+ *
+ * Releases a TLS index, making it available for reuse. This call
+ * will delete any TLS data stored under index @idx in all threads.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean TlsFree(guint32 idx)
+{
+ mono_mutex_lock(&TLS_mutex);
+
+ if(TLS_used[idx]==FALSE) {
+ mono_mutex_unlock(&TLS_mutex);
+ return(FALSE);
+ }
+
+ TLS_used[idx]=FALSE;
+ pthread_key_delete(TLS_keys[idx]);
+
+#if HAVE_BOEHM_GC
+ mono_g_hash_table_remove (tls_gc_hash, MAKE_GC_ID (idx));
+#endif
+ mono_mutex_unlock(&TLS_mutex);
+
+ return(TRUE);
+}
+
+/**
+ * TlsGetValue:
+ * @idx: The TLS index to retrieve
+ *
+ * Retrieves the TLS data stored under index @idx.
+ *
+ * Return value: The value stored in the TLS index @idx in the current
+ * thread, or %NULL on error. As %NULL can be a valid return value,
+ * in this case GetLastError() returns %ERROR_SUCCESS.
+ */
+gpointer TlsGetValue(guint32 idx)
+{
+ gpointer ret;
+
+ mono_mutex_lock(&TLS_mutex);
+
+ if(TLS_used[idx]==FALSE) {
+ mono_mutex_unlock(&TLS_mutex);
+ return(NULL);
+ }
+
+ ret=pthread_getspecific(TLS_keys[idx]);
+
+ mono_mutex_unlock(&TLS_mutex);
+
+ return(ret);
+}
+
+/**
+ * TlsSetValue:
+ * @idx: The TLS index to store
+ * @value: The value to store under index @idx
+ *
+ * Stores @value at TLS index @idx.
+ *
+ * Return value: %TRUE on success, %FALSE otherwise.
+ */
+gboolean TlsSetValue(guint32 idx, gpointer value)
+{
+ int ret;
+
+ mono_mutex_lock(&TLS_mutex);
+
+ if(TLS_used[idx]==FALSE) {
+ mono_mutex_unlock(&TLS_mutex);
+ return(FALSE);
+ }
+
+ ret=pthread_setspecific(TLS_keys[idx], value);
+ if(ret!=0) {
+ mono_mutex_unlock(&TLS_mutex);
+ return(FALSE);
+ }
+
+#if HAVE_BOEHM_GC
+ if (!tls_gc_hash)
+ tls_gc_hash = mono_g_hash_table_new(g_direct_hash, g_direct_equal);
+ mono_g_hash_table_insert (tls_gc_hash, MAKE_GC_ID (idx), value);
+#endif
+ mono_mutex_unlock(&TLS_mutex);
+
+ return(TRUE);
+}
+
+/**
+ * Sleep:
+ * @ms: The time in milliseconds to suspend for
+ *
+ * Suspends execution of the current thread for @ms milliseconds. A
+ * value of zero causes the thread to relinquish its time slice. A
+ * value of %INFINITE causes an infinite delay.
+ */
+void Sleep(guint32 ms)
+{
+ struct timespec req, rem;
+ div_t divvy;
+ int ret;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Sleeping for %d ms", ms);
+#endif
+
+ if(ms==0) {
+ sched_yield();
+ return;
+ }
+
+ /* FIXME: check for INFINITE and sleep forever */
+ divvy=div((int)ms, 1000);
+
+ req.tv_sec=divvy.quot;
+ req.tv_nsec=divvy.rem*1000000;
+
+again:
+ ret=nanosleep(&req, &rem);
+ if(ret==-1) {
+ /* Sleep interrupted with rem time remaining */
+#ifdef DEBUG
+ guint32 rems=rem.tv_sec*1000 + rem.tv_nsec/1000000;
+
+ g_message(G_GNUC_PRETTY_FUNCTION ": Still got %d ms to go",
+ rems);
+#endif
+ req=rem;
+ goto again;
+ }
+}
+
+/* FIXME: implement alertable */
+void SleepEx(guint32 ms, gboolean alertable)
+{
+ if(alertable==TRUE) {
+ g_warning(G_GNUC_PRETTY_FUNCTION ": alertable not implemented");
+ }
+
+ Sleep(ms);
+}
diff --git a/mono/io-layer/threads.h b/mono/io-layer/threads.h
new file mode 100644
index 00000000000..b14c81a1e18
--- /dev/null
+++ b/mono/io-layer/threads.h
@@ -0,0 +1,53 @@
+#ifndef _WAPI_THREADS_H_
+#define _WAPI_THREADS_H_
+
+#include <glib.h>
+
+#include "mono/io-layer/handles.h"
+#include "mono/io-layer/io.h"
+#include "mono/io-layer/status.h"
+
+#define TLS_MINIMUM_AVAILABLE 64
+#define TLS_OUT_OF_INDEXES 0xFFFFFFFF
+
+#define STILL_ACTIVE STATUS_PENDING
+
+#define DEBUG_PROCESS 0x00000001
+#define DEBUG_ONLY_THIS_PROCESS 0x00000002
+#define CREATE_SUSPENDED 0x00000004
+#define DETACHED_PROCESS 0x00000008
+#define CREATE_NEW_CONSOLE 0x00000010
+#define NORMAL_PRIORITY_CLASS 0x00000020
+#define IDLE_PRIORITY_CLASS 0x00000040
+#define HIGH_PRIORITY_CLASS 0x00000080
+#define REALTIME_PRIORITY_CLASS 0x00000100
+#define CREATE_NEW_PROCESS_GROUP 0x00000200
+#define CREATE_UNICODE_ENVIRONMENT 0x00000400
+#define CREATE_SEPARATE_WOW_VDM 0x00000800
+#define CREATE_SHARED_WOW_VDM 0x00001000
+#define CREATE_FORCEDOS 0x00002000
+#define BELOW_NORMAL_PRIORITY_CLASS 0x00004000
+#define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
+#define CREATE_BREAKAWAY_FROM_JOB 0x01000000
+#define CREATE_WITH_USERPROFILE 0x02000000
+#define CREATE_DEFAULT_ERROR_MODE 0x04000000
+#define CREATE_NO_WINDOW 0x08000000
+
+
+typedef guint32 (*WapiThreadStart)(gpointer);
+
+extern WapiHandle *CreateThread(WapiSecurityAttributes *security, guint32 stacksize, WapiThreadStart start, gpointer param, guint32 create, guint32 *tid);
+extern void ExitThread(guint32 exitcode) G_GNUC_NORETURN;
+extern gboolean GetExitCodeThread(WapiHandle *handle, guint32 *exitcode);
+extern guint32 GetCurrentThreadId(void);
+extern WapiHandle *GetCurrentThread(void);
+extern guint32 ResumeThread(WapiHandle *handle);
+extern guint32 SuspendThread(WapiHandle *handle);
+extern guint32 TlsAlloc(void);
+extern gboolean TlsFree(guint32 idx);
+extern gpointer TlsGetValue(guint32 idx);
+extern gboolean TlsSetValue(guint32 idx, gpointer value);
+extern void Sleep(guint32 ms);
+extern void SleepEx(guint32 ms, gboolean);
+
+#endif /* _WAPI_THREADS_H_ */
diff --git a/mono/io-layer/timed-thread.c b/mono/io-layer/timed-thread.c
new file mode 100644
index 00000000000..2464beb5fcd
--- /dev/null
+++ b/mono/io-layer/timed-thread.c
@@ -0,0 +1,144 @@
+#include <config.h>
+#include <glib.h>
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#endif
+#include <pthread.h>
+
+#include "timed-thread.h"
+
+#include "mono-mutex.h"
+
+#undef DEBUG
+
+/*
+ * Implementation of timed thread joining from the P1003.1d/D14 (July 1999)
+ * draft spec, figure B-6.
+ */
+
+static pthread_key_t timed_thread_key;
+static pthread_once_t timed_thread_once = PTHREAD_ONCE_INIT;
+
+static void timed_thread_init(void)
+{
+ pthread_key_create(&timed_thread_key, NULL);
+}
+
+void _wapi_timed_thread_exit(guint32 exitstatus)
+{
+ TimedThread *thread;
+ void *specific;
+
+ if((specific = pthread_getspecific(timed_thread_key)) == NULL) {
+ /* Handle cases which won't happen with correct usage.
+ */
+ pthread_exit(NULL);
+ }
+
+ thread=(TimedThread *)specific;
+
+ mono_mutex_lock(&thread->join_mutex);
+
+ /* Tell a joiner that we're exiting.
+ */
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Setting thread %p id %ld exit status to %d",
+ thread, thread->id, exitstatus);
+#endif
+
+ thread->exitstatus=exitstatus;
+ thread->exiting=TRUE;
+
+ if(thread->exit_routine!=NULL) {
+ thread->exit_routine(exitstatus, thread->exit_userdata);
+ }
+
+ pthread_cond_signal(&thread->exit_cond);
+ mono_mutex_unlock(&thread->join_mutex);
+
+ /* Call pthread_exit() to call destructors and really exit the
+ * thread.
+ */
+ pthread_exit(NULL);
+}
+
+/* Routine to establish thread specific data value and run the actual
+ * thread start routine which was supplied to timed_thread_create()
+ */
+static void *timed_thread_start_routine(gpointer args) G_GNUC_NORETURN;
+static void *timed_thread_start_routine(gpointer args)
+{
+ TimedThread *thread = (TimedThread *)args;
+
+ pthread_once(&timed_thread_once, timed_thread_init);
+ pthread_setspecific(timed_thread_key, (void *)thread);
+ pthread_detach(thread->id);
+ _wapi_timed_thread_exit(thread->start_routine(thread->arg));
+}
+
+/* Allocate a thread which can be used with timed_thread_join().
+ */
+int _wapi_timed_thread_create(TimedThread **threadp,
+ const pthread_attr_t *attr,
+ guint32 (*start_routine)(gpointer),
+ void (*exit_routine)(guint32, gpointer),
+ gpointer arg, gpointer exit_userdata)
+{
+ TimedThread *thread;
+ int result;
+
+ thread=(TimedThread *)g_new0(TimedThread, 1);
+
+ mono_mutex_init(&thread->join_mutex, NULL);
+ pthread_cond_init(&thread->exit_cond, NULL);
+ thread->start_routine = start_routine;
+ thread->exit_routine = exit_routine;
+ thread->arg = arg;
+ thread->exit_userdata = exit_userdata;
+ thread->exitstatus = 0;
+ thread->exiting = FALSE;
+
+ *threadp = thread;
+
+ if((result = pthread_create(&thread->id, attr,
+ timed_thread_start_routine,
+ (void *)thread)) != 0) {
+ g_free(thread);
+ return(result);
+ }
+
+ return(0);
+}
+
+int _wapi_timed_thread_join(TimedThread *thread, struct timespec *timeout,
+ guint32 *exitstatus)
+{
+ int result;
+
+ mono_mutex_lock(&thread->join_mutex);
+ result=0;
+
+ /* Wait until the thread announces that it's exiting, or until
+ * timeout.
+ */
+ while(result == 0 && !thread->exiting) {
+ if(timeout == NULL) {
+ result = pthread_cond_wait(&thread->exit_cond,
+ &thread->join_mutex);
+ } else {
+ result = pthread_cond_timedwait(&thread->exit_cond,
+ &thread->join_mutex,
+ timeout);
+ }
+ }
+
+ mono_mutex_unlock(&thread->join_mutex);
+ if(result == 0 && thread->exiting) {
+ if(exitstatus!=NULL) {
+ *exitstatus = thread->exitstatus;
+ }
+ }
+ return(result);
+}
+
diff --git a/mono/io-layer/timed-thread.h b/mono/io-layer/timed-thread.h
new file mode 100644
index 00000000000..683472317e3
--- /dev/null
+++ b/mono/io-layer/timed-thread.h
@@ -0,0 +1,33 @@
+#ifndef _WAPI_TIMED_THREAD_H_
+#define _WAPI_TIMED_THREAD_H_
+
+#include <config.h>
+#include <glib.h>
+#include <pthread.h>
+
+#include "mono-mutex.h"
+
+typedef struct
+{
+ pthread_t id;
+ mono_mutex_t join_mutex;
+ pthread_cond_t exit_cond;
+ guint32 (*start_routine)(gpointer arg);
+ void (*exit_routine)(guint32 exitstatus, gpointer userdata);
+ gpointer arg;
+ gpointer exit_userdata;
+ guint32 exitstatus;
+ gboolean exiting;
+} TimedThread;
+
+extern void _wapi_timed_thread_exit(guint32 exitstatus) G_GNUC_NORETURN;
+extern int _wapi_timed_thread_create(TimedThread **threadp,
+ const pthread_attr_t *attr,
+ guint32 (*start_routine)(gpointer),
+ void (*exit_routine)(guint32, gpointer),
+ gpointer arg, gpointer exit_userdata);
+extern int _wapi_timed_thread_join(TimedThread *thread,
+ struct timespec *timeout,
+ guint32 *exitstatus);
+
+#endif /* _WAPI_TIMED_THREAD_H_ */
diff --git a/mono/io-layer/timefuncs.c b/mono/io-layer/timefuncs.c
new file mode 100644
index 00000000000..9e86b85d3b7
--- /dev/null
+++ b/mono/io-layer/timefuncs.c
@@ -0,0 +1,17 @@
+#include <config.h>
+#include <glib.h>
+#include <sys/time.h>
+#include <stdlib.h>
+
+#include "mono/io-layer/wapi.h"
+
+gboolean QueryPerformanceCounter(WapiLargeInteger *count G_GNUC_UNUSED)
+{
+ return(FALSE);
+}
+
+gboolean QueryPerformanceFrequency(WapiLargeInteger *freq G_GNUC_UNUSED)
+{
+ return(FALSE);
+}
+
diff --git a/mono/io-layer/timefuncs.h b/mono/io-layer/timefuncs.h
new file mode 100644
index 00000000000..8cf1fa13842
--- /dev/null
+++ b/mono/io-layer/timefuncs.h
@@ -0,0 +1,11 @@
+#ifndef _WAPI_TIME_H_
+#define _WAPI_TIME_H_
+
+#include <glib.h>
+
+#include "mono/io-layer/wapi.h"
+
+gboolean QueryPerformanceCounter(WapiLargeInteger *count);
+gboolean QueryPerformanceFrequency(WapiLargeInteger *freq);
+
+#endif /* _WAPI_TIME_H_ */
diff --git a/mono/io-layer/types.h b/mono/io-layer/types.h
new file mode 100644
index 00000000000..f424b152a87
--- /dev/null
+++ b/mono/io-layer/types.h
@@ -0,0 +1,17 @@
+#ifndef _WAPI_TYPES_H_
+#define _WAPI_TYPES_H_
+
+#include <glib.h>
+
+typedef union
+{
+ struct
+ {
+ guint32 LowPart;
+ gint32 HighPart;
+ } u;
+
+ guint64 QuadPart;
+} WapiLargeInteger;
+
+#endif /* _WAPI_TYPES_H_ */
diff --git a/mono/io-layer/uglify.h b/mono/io-layer/uglify.h
new file mode 100644
index 00000000000..4b2579fc462
--- /dev/null
+++ b/mono/io-layer/uglify.h
@@ -0,0 +1,58 @@
+#ifndef _WAPI_UGLIFY_H_
+#define _WAPI_UGLIFY_H_
+
+/* Include this file if you insist on using the nasty Win32 typedefs */
+
+#include <stdlib.h>
+
+#include "mono/io-layer/wapi.h"
+
+typedef const guchar *LPCTSTR; /* replace this with gunichar */
+typedef guint8 BYTE;
+typedef guint16 WORD;
+typedef guint32 DWORD;
+typedef gpointer PVOID;
+typedef gpointer LPVOID;
+typedef gboolean BOOL;
+typedef guint32 *LPDWORD;
+typedef gint32 LONG;
+typedef guint32 ULONG;
+typedef gint32 *PLONG;
+typedef guint64 LONGLONG;
+typedef gunichar2 TCHAR;
+
+typedef WapiHandle *HANDLE;
+typedef WapiHandle **LPHANDLE;
+typedef WapiHandle *SOCKET; /* NB: w32 defines this to be int */
+typedef WapiSecurityAttributes *LPSECURITY_ATTRIBUTES;
+typedef WapiOverlapped *LPOVERLAPPED;
+typedef WapiThreadStart LPTHREAD_START_ROUTINE;
+typedef WapiCriticalSection CRITICAL_SECTION;
+typedef WapiCriticalSection *LPCRITICAL_SECTION;
+typedef WapiFileTime FILETIME;
+typedef WapiFileTime *LPFILETIME;
+typedef WapiSystemTime SYSTEMTIME;
+typedef WapiSystemTime *LPSYSTEMTIME;
+typedef WapiWSAData WSADATA;
+typedef WapiWSAData *LDWSADATA;
+typedef WapiLargeInteger LARGE_INTEGER;
+typedef WapiLargeInteger *PLARGE_INTEGER;
+typedef WapiSystemInfo SYSTEM_INFO;
+typedef WapiSystemInfo *LPSYSTEM_INFO;
+typedef WapiFloatingSaveArea FLOATING_SAVE_AREA;
+typedef WapiFloatingSaveArea *PFLOATING_SAVE_AREA;
+typedef WapiContext CONTEXT;
+typedef WapiContext *PCONTEXT;
+typedef WapiFindData WIN32_FIND_DATA;
+typedef WapiFindData *LPWIN32_FIND_DATA;
+typedef WapiFileAttributesData WIN32_FILE_ATTRIBUTE_DATA;
+typedef WapiGetFileExInfoLevels GET_FILEEX_INFO_LEVELS;
+
+#define CONST const
+#define VOID void
+
+#define IN
+#define OUT
+#define WINAPI
+
+#endif /* _WAPI_UGLIFY_H_ */
diff --git a/mono/io-layer/unicode.c b/mono/io-layer/unicode.c
new file mode 100644
index 00000000000..b9625ff0989
--- /dev/null
+++ b/mono/io-layer/unicode.c
@@ -0,0 +1,41 @@
+#include <config.h>
+#include <glib.h>
+#include <pthread.h>
+#if HAVE_ICONV_H
+#include <iconv.h>
+#elif HAVE_GICONV_H
+#include <giconv.h>
+#endif
+#include <errno.h>
+
+#include "mono/io-layer/wapi.h"
+#include "unicode.h"
+
+/* This is a nasty kludge */
+static guint32
+unicode_len (const gunichar2 *str)
+{
+ guint32 len = 0;
+
+ do {
+ if (str [len] == '\0')
+ return len * 2;
+
+ len++;
+ } while (1);
+}
+
+gchar *_wapi_unicode_to_utf8(const gunichar2 *uni)
+{
+ GError *error = NULL;
+ gchar *res;
+ int len;
+
+ len = unicode_len(uni);
+
+ res = g_utf16_to_utf8 (uni, len, NULL, NULL, &error);
+
+ g_assert (!error);
+
+ return res;
+}
diff --git a/mono/io-layer/unicode.h b/mono/io-layer/unicode.h
new file mode 100644
index 00000000000..665c6727557
--- /dev/null
+++ b/mono/io-layer/unicode.h
@@ -0,0 +1,10 @@
+#ifndef _WAPI_UNICODE_H_
+#define _WAPI_UNICODE_H_
+
+/* This is an internal, private header file */
+
+#include <glib.h>
+
+extern gchar *_wapi_unicode_to_utf8 (const gunichar2 *uni);
+
+#endif /* _WAPI_UNICODE_H_ */
diff --git a/mono/io-layer/wait-private.h b/mono/io-layer/wait-private.h
new file mode 100644
index 00000000000..1f96f7c2b8e
--- /dev/null
+++ b/mono/io-layer/wait-private.h
@@ -0,0 +1,42 @@
+#ifndef _WAPI_WAIT_PRIVATE_H_
+#define _WAPI_WAIT_PRIVATE_H_
+
+/* This is an internal, private header file */
+
+#include <config.h>
+
+#include <glib.h>
+#include <pthread.h>
+#include <semaphore.h>
+
+#include "wapi-private.h"
+#include "timed-thread.h"
+
+#include "mono-mutex.h"
+
+typedef enum {
+ WQ_NEW,
+ WQ_WAITING,
+ WQ_SIGNALLED,
+} WaitQueueState;
+
+typedef struct _WaitQueueItem
+{
+ mono_mutex_t mutex;
+ sem_t wait_sem;
+ WaitQueueState state;
+ guint32 update, ack;
+ guint32 timeout;
+ gboolean waitall;
+ GPtrArray *handles[WAPI_HANDLE_COUNT];
+ TimedThread *thread[WAPI_HANDLE_COUNT];
+ gboolean waited[WAPI_HANDLE_COUNT];
+ guint32 waitcount[WAPI_HANDLE_COUNT];
+ /* waitindex must be kept synchronised with the handles array,
+ * such that index n of one matches index n of the other
+ */
+ GArray *waitindex[WAPI_HANDLE_COUNT];
+ guint32 lowest_signal;
+} WaitQueueItem;
+
+#endif /* _WAPI_WAIT_PRIVATE_H_ */
diff --git a/mono/io-layer/wait.c b/mono/io-layer/wait.c
new file mode 100644
index 00000000000..daf48a52998
--- /dev/null
+++ b/mono/io-layer/wait.c
@@ -0,0 +1,484 @@
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#endif
+
+#include "mono/io-layer/wapi.h"
+#include "wait-private.h"
+#include "timed-thread.h"
+#include "handles-private.h"
+#include "wapi-private.h"
+
+#include "mono-mutex.h"
+
+#undef DEBUG
+
+static pthread_once_t wait_once=PTHREAD_ONCE_INIT;
+
+static GPtrArray *WaitQueue=NULL;
+
+static pthread_t wait_monitor_thread_id;
+static gboolean wait_monitor_thread_running=FALSE;
+static mono_mutex_t wait_monitor_mutex=MONO_MUTEX_INITIALIZER;
+static sem_t wait_monitor_sem;
+
+static void launch_tidy(guint32 exitcode G_GNUC_UNUSED, gpointer user)
+{
+ WaitQueueItem *item=(WaitQueueItem *)user;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Informing monitor thread");
+#endif
+
+ /* Update queue item */
+ mono_mutex_lock(&item->mutex);
+ item->update++;
+ mono_mutex_unlock(&item->mutex);
+
+ /* Signal monitor */
+ sem_post(&wait_monitor_sem);
+}
+
+/* This function is called by the monitor thread to launch handle-type
+ * specific threads to block in particular ways.
+ *
+ * The item mutex is held by the monitor thread when this function is
+ * called.
+ */
+static void launch_blocker_threads(WaitQueueItem *item)
+{
+ int i, ret;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Launching blocker threads");
+#endif
+
+ for(i=0; i<WAPI_HANDLE_COUNT; i++) {
+ if(item->handles[i]->len>0) {
+ WapiHandle *handle;
+
+ handle=g_ptr_array_index(item->handles[i], 0);
+ g_assert(handle!=NULL);
+ g_assert(handle->ops->wait_multiple!=NULL);
+
+#ifdef DEBUG
+ g_message("Handle type %d active", i);
+#endif
+ item->waited[i]=FALSE;
+
+ ret=_wapi_timed_thread_create(
+ &item->thread[i], NULL,
+ handle->ops->wait_multiple, launch_tidy, item,
+ item);
+ if(ret!=0) {
+ g_warning(G_GNUC_PRETTY_FUNCTION
+ ": Thread create error: %s",
+ strerror(ret));
+ return;
+ }
+ } else {
+ /* Pretend to have already waited for the
+ * thread; it makes life easier for the
+ * monitor thread.
+ */
+ item->waited[i]=TRUE;
+ }
+ }
+}
+
+static gboolean launch_threads_done(WaitQueueItem *item)
+{
+ int i;
+
+ for(i=0; i<WAPI_HANDLE_COUNT; i++) {
+ if(item->waited[i]==FALSE) {
+ return(FALSE);
+ }
+ }
+
+ return(TRUE);
+}
+
+/* This is the main loop for the monitor thread. It waits for a
+ * signal to check the wait queue, then takes any action necessary on
+ * any queue items that have indicated readiness.
+ */
+static void *wait_monitor_thread(void *unused G_GNUC_UNUSED)
+{
+ guint i;
+
+ /* Signal that the monitor thread is ready */
+ wait_monitor_thread_running=TRUE;
+
+ while(TRUE) {
+ /* Use a semaphore rather than a cond so we dont miss
+ * any signals
+ */
+ sem_wait(&wait_monitor_sem);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Blocking thread doing stuff");
+#endif
+
+ /* We've been signalled, so scan the wait queue for
+ * activity.
+ */
+ mono_mutex_lock(&wait_monitor_mutex);
+ for(i=0; i<WaitQueue->len; i++) {
+ WaitQueueItem *item=g_ptr_array_index(WaitQueue, i);
+
+ if(item->update > item->ack) {
+ /* Something changed */
+ mono_mutex_lock(&item->mutex);
+ item->ack=item->update;
+
+ switch(item->state) {
+ case WQ_NEW:
+ /* Launch a new thread for each type of
+ * handle to be waited for here.
+ */
+ launch_blocker_threads(item);
+
+ item->state=WQ_WAITING;
+ break;
+
+ case WQ_WAITING:
+ /* See if we have waited for
+ * the last blocker thread.
+ */
+ if(launch_threads_done(item)) {
+ /* All handles have
+ * been signalled, so
+ * signal the waiting
+ * thread. Let the
+ * waiting thread
+ * remove this item
+ * from the queue,
+ * because it makes
+ * the logic a lot
+ * easier here.
+ */
+ item->state=WQ_SIGNALLED;
+ sem_post(&item->wait_sem);
+ }
+ break;
+
+ case WQ_SIGNALLED:
+ /* This shouldn't happen. Prod
+ * the blocking thread again
+ * just to make sure.
+ */
+ g_warning(G_GNUC_PRETTY_FUNCTION
+ ": Prodding blocker again");
+ sem_post(&item->wait_sem);
+ break;
+ }
+
+ mono_mutex_unlock(&item->mutex);
+ }
+ }
+
+ mono_mutex_unlock(&wait_monitor_mutex);
+ }
+
+ return(NULL);
+}
+
+static void wait_init(void)
+{
+ int ret;
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Starting monitor thread");
+#endif
+
+ WaitQueue=g_ptr_array_new();
+
+ sem_init(&wait_monitor_sem, 0, 0);
+
+ /* Launch a thread which manages the wait queue, and deals
+ * with waiting for handles of various types.
+ */
+ ret=pthread_create(&wait_monitor_thread_id, NULL,
+ wait_monitor_thread, NULL);
+ if(ret!=0) {
+ g_warning(G_GNUC_PRETTY_FUNCTION
+ ": Couldn't start handle monitor thread: %s",
+ strerror(ret));
+ }
+
+ /* Wait for the monitor thread to get going */
+ while(wait_monitor_thread_running==FALSE) {
+ sched_yield();
+ }
+}
+
+static WaitQueueItem *wait_item_new(guint32 timeout, gboolean waitall)
+{
+ WaitQueueItem *new;
+ int i;
+
+ new=g_new0(WaitQueueItem, 1);
+
+ mono_mutex_init(&new->mutex, NULL);
+ sem_init(&new->wait_sem, 0, 0);
+
+ new->update=1; /* As soon as this item is queued it
+ * will need attention.
+ */
+ new->state=WQ_NEW;
+ new->timeout=timeout;
+ new->waitall=waitall;
+ new->lowest_signal=MAXIMUM_WAIT_OBJECTS;
+
+ for(i=0; i<WAPI_HANDLE_COUNT; i++) {
+ new->handles[i]=g_ptr_array_new();
+ new->waitindex[i]=g_array_new(FALSE, FALSE, sizeof(guint32));
+ }
+
+ return(new);
+}
+
+/* Adds our queue item to the work queue, and blocks until the monitor
+ * thread thinks it's done the work. Returns TRUE for done, FALSE for
+ * timed out. Sets lowest to the index of the first signalled handle
+ * in the list.
+ */
+static gboolean wait_for_item(WaitQueueItem *item, guint32 *lowest)
+{
+ gboolean ret;
+ int i;
+
+ /* Add the wait item to the monitor queue, and signal the
+ * monitor thread */
+ mono_mutex_lock(&wait_monitor_mutex);
+ g_ptr_array_add(WaitQueue, item);
+ sem_post(&wait_monitor_sem);
+ mono_mutex_unlock(&wait_monitor_mutex);
+
+ /* Wait for the item to become ready */
+ sem_wait(&item->wait_sem);
+
+ mono_mutex_lock(&item->mutex);
+
+ /* If waitall is TRUE, then the number signalled in each handle type
+ * must be the length of the handle type array for the wait to be
+ * successful. Otherwise, any signalled handle is good enough
+ */
+ if(item->waitall==TRUE) {
+ ret=TRUE;
+ for(i=0; i<WAPI_HANDLE_COUNT; i++) {
+ if(item->waitcount[i]!=item->handles[i]->len) {
+ ret=FALSE;
+ break;
+ }
+ }
+ } else {
+ ret=FALSE;
+ for(i=0; i<WAPI_HANDLE_COUNT; i++) {
+ if(item->waitcount[i]>0) {
+ ret=TRUE;
+ break;
+ }
+ }
+ }
+
+ *lowest=item->lowest_signal;
+
+ mono_mutex_unlock(&item->mutex);
+
+ return(ret);
+}
+
+static gboolean wait_dequeue_item(WaitQueueItem *item)
+{
+ gboolean ret;
+
+ g_assert(WaitQueue!=NULL);
+
+ mono_mutex_lock(&wait_monitor_mutex);
+ ret=g_ptr_array_remove_fast(WaitQueue, item);
+ mono_mutex_unlock(&wait_monitor_mutex);
+
+ return(ret);
+}
+
+static void wait_item_destroy(WaitQueueItem *item)
+{
+ int i;
+
+ mono_mutex_destroy(&item->mutex);
+ sem_destroy(&item->wait_sem);
+
+ for(i=0; i<WAPI_HANDLE_COUNT; i++) {
+ if(item->thread[i]!=NULL) {
+ g_free(item->thread[i]);
+ }
+ g_ptr_array_free(item->handles[i], FALSE);
+ g_array_free(item->waitindex[i], FALSE);
+ }
+}
+
+
+/**
+ * WaitForSingleObject:
+ * @handle: an object to wait for
+ * @timeout: the maximum time in milliseconds to wait for
+ *
+ * This function returns when either @handle is signalled, or @timeout
+ * ms elapses. If @timeout is zero, the object's state is tested and
+ * the function returns immediately. If @timeout is %INFINITE, the
+ * function waits forever.
+ *
+ * Return value: %WAIT_ABANDONED - @handle is a mutex that was not
+ * released by the owning thread when it exited. Ownership of the
+ * mutex object is granted to the calling thread and the mutex is set
+ * to nonsignalled. %WAIT_OBJECT_0 - The state of @handle is
+ * signalled. %WAIT_TIMEOUT - The @timeout interval elapsed and
+ * @handle's state is still not signalled. %WAIT_FAILED - an error
+ * occurred.
+ */
+guint32 WaitForSingleObject(WapiHandle *handle, guint32 timeout)
+{
+ gboolean wait;
+
+ if(handle->ops->wait==NULL) {
+ return(WAIT_FAILED);
+ }
+
+ wait=handle->ops->wait(handle, NULL, timeout);
+ if(wait==TRUE) {
+ /* Object signalled before timeout expired */
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Object %p (type %d) signalled", handle,
+ handle->type);
+#endif
+ return(WAIT_OBJECT_0);
+ } else {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Object %p wait timed out",
+ handle);
+#endif
+ return(WAIT_TIMEOUT);
+ }
+}
+
+/**
+ * WaitForMultipleObjects:
+ * @numobjects: The number of objects in @handles. The maximum allowed
+ * is %MAXIMUM_WAIT_OBJECTS.
+ * @handles: An array of object handles. Duplicates are not allowed.
+ * @waitall: If %TRUE, this function waits until all of the handles
+ * are signalled. If %FALSE, this function returns when any object is
+ * signalled.
+ * @timeout: The maximum time in milliseconds to wait for.
+ *
+ * This function returns when either one or more of @handles is
+ * signalled, or @timeout ms elapses. If @timeout is zero, the state
+ * of each item of @handles is tested and the function returns
+ * immediately. If @timeout is %INFINITE, the function waits forever.
+ *
+ * Return value: %WAIT_OBJECT_0 to %WAIT_OBJECT_0 + @numobjects - 1 -
+ * if @waitall is %TRUE, indicates that all objects are signalled. If
+ * @waitall is %FALSE, the return value minus %WAIT_OBJECT_0 indicates
+ * the first index into @handles of the objects that are signalled.
+ * %WAIT_ABANDONED_0 to %WAIT_ABANDONED_0 + @numobjects - 1 - if
+ * @waitall is %TRUE, indicates that all objects are signalled, and at
+ * least one object is an abandoned mutex object (See
+ * WaitForSingleObject() for a description of abandoned mutexes.) If
+ * @waitall is %FALSE, the return value minus %WAIT_ABANDONED_0
+ * indicates the first index into @handles of an abandoned mutex.
+ * %WAIT_TIMEOUT - The @timeout interval elapsed and no objects in
+ * @handles are signalled. %WAIT_FAILED - an error occurred.
+ */
+guint32 WaitForMultipleObjects(guint32 numobjects, WapiHandle **handles,
+ gboolean waitall, guint32 timeout)
+{
+ WaitQueueItem *item;
+ GHashTable *dups;
+ gboolean duplicate=FALSE, bogustype=FALSE;
+ gboolean wait;
+ guint i;
+ guint32 lowest;
+
+ pthread_once(&wait_once, wait_init);
+
+ if(numobjects>MAXIMUM_WAIT_OBJECTS) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Too many handles: %d",
+ numobjects);
+#endif
+
+ return(WAIT_FAILED);
+ }
+
+ /* Check for duplicates */
+ dups=g_hash_table_new(g_direct_hash, g_direct_equal);
+ for(i=0; i<numobjects; i++) {
+ gpointer exists=g_hash_table_lookup(dups, handles[i]);
+ if(exists!=NULL) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Handle %p duplicated", handles[i]);
+#endif
+
+ duplicate=TRUE;
+ break;
+ }
+
+ if(handles[i]->ops->wait_multiple==NULL) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Handle %p can't be waited for (type %d)",
+ handles[i], handles[i]->type);
+#endif
+
+ bogustype=TRUE;
+ }
+
+ g_hash_table_insert(dups, handles[i], handles[i]);
+ }
+ g_hash_table_destroy(dups);
+
+ if(duplicate==TRUE) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Returning due to duplicates");
+#endif
+
+ return(WAIT_FAILED);
+ }
+
+ if(bogustype==TRUE) {
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Returning due to bogus type");
+#endif
+
+ return(WAIT_FAILED);
+ }
+
+ item=wait_item_new(timeout, waitall);
+
+ /* Sort the handles by type */
+ for(i=0; i<numobjects; i++) {
+ g_ptr_array_add(item->handles[handles[i]->type], handles[i]);
+ g_array_append_val(item->waitindex[handles[i]->type], i);
+ }
+
+ wait=wait_for_item(item, &lowest);
+ wait_dequeue_item(item);
+ wait_item_destroy(item);
+
+ if(wait==FALSE) {
+ /* Wait timed out */
+ return(WAIT_TIMEOUT);
+ }
+
+ return(WAIT_OBJECT_0+lowest);
+}
diff --git a/mono/io-layer/wait.h b/mono/io-layer/wait.h
new file mode 100644
index 00000000000..b0218bd93cb
--- /dev/null
+++ b/mono/io-layer/wait.h
@@ -0,0 +1,22 @@
+#ifndef _WAPI_WAIT_H_
+#define _WAPI_WAIT_H_
+
+#include "mono/io-layer/status.h"
+
+#define MAXIMUM_WAIT_OBJECTS 64
+
+#define INFINITE 0xFFFFFFFF
+
+#define WAIT_FAILED 0xFFFFFFFF
+#define WAIT_OBJECT_0 ((STATUS_WAIT_0) +0)
+#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0) +0)
+#define WAIT_ABANDONED_0 ((STATUS_ABANDONED_WAIT_0) +0)
+
+/* WAIT_TIMEOUT is also defined in error.h. Luckily it's the same value */
+#define WAIT_TIMEOUT STATUS_TIMEOUT
+#define WAIT_IO_COMPLETION STATUS_USER_APC
+
+extern guint32 WaitForSingleObject(WapiHandle *handle, guint32 timeout);
+extern guint32 WaitForMultipleObjects(guint32 numobjects, WapiHandle **handles, gboolean waitall, guint32 timeout);
+
+#endif /* _WAPI_WAIT_H_ */
diff --git a/mono/io-layer/wapi-private.h b/mono/io-layer/wapi-private.h
new file mode 100644
index 00000000000..d80f27d0a2b
--- /dev/null
+++ b/mono/io-layer/wapi-private.h
@@ -0,0 +1,76 @@
+#ifndef _WAPI_PRIVATE_H_
+#define _WAPI_PRIVATE_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include "mono/io-layer/handles.h"
+
+typedef enum {
+ WAPI_HANDLE_FILE,
+ WAPI_HANDLE_CONSOLE,
+ WAPI_HANDLE_THREAD,
+ WAPI_HANDLE_SEM,
+ WAPI_HANDLE_MUTEX,
+ WAPI_HANDLE_EVENT,
+ WAPI_HANDLE_SOCKET,
+ WAPI_HANDLE_COUNT,
+ WAPI_HANDLE_FIND
+} WapiHandleType;
+
+struct _WapiHandleOps
+{
+ /* All handle types */
+ void (*close)(WapiHandle *handle);
+
+ /* File, console and pipe handles */
+ WapiFileType (*getfiletype)(void);
+
+ /* File and console handles */
+ gboolean (*readfile)(WapiHandle *handle, gpointer buffer,
+ guint32 numbytes, guint32 *bytesread,
+ WapiOverlapped *overlapped);
+ gboolean (*writefile)(WapiHandle *handle, gconstpointer buffer,
+ guint32 numbytes, guint32 *byteswritten,
+ WapiOverlapped *overlapped);
+ gboolean (*flushfile)(WapiHandle *handle);
+
+ /* File handles */
+ guint32 (*seek)(WapiHandle *handle, gint32 movedistance,
+ gint32 *highmovedistance, WapiSeekMethod method);
+ gboolean (*setendoffile)(WapiHandle *handle);
+ guint32 (*getfilesize)(WapiHandle *handle, guint32 *highsize);
+ gboolean (*getfiletime)(WapiHandle *handle, WapiFileTime *create_time,
+ WapiFileTime *last_access,
+ WapiFileTime *last_write);
+ gboolean (*setfiletime)(WapiHandle *handle,
+ const WapiFileTime *create_time,
+ const WapiFileTime *last_access,
+ const WapiFileTime *last_write);
+
+ /* WaitForSingleObject */
+ gboolean (*wait)(WapiHandle *handle, WapiHandle *signal, guint32 ms);
+
+ /* WaitForMultipleObjects */
+ guint32 (*wait_multiple)(gpointer data);
+
+ /* SignalObjectAndWait */
+ void (*signal)(WapiHandle *signal);
+};
+
+struct _WapiHandle
+{
+ WapiHandleType type;
+ guint ref;
+ gboolean signalled;
+ struct _WapiHandleOps *ops;
+};
+
+#define _WAPI_HANDLE_INIT(_handle, _type, _ops) G_STMT_START {\
+ _handle->type=_type;\
+ _handle->ref=1;\
+ _handle->signalled=FALSE;\
+ _handle->ops=&_ops;\
+ } G_STMT_END;
+
+#endif /* _WAPI_PRIVATE_H_ */
diff --git a/mono/io-layer/wapi.h b/mono/io-layer/wapi.h
new file mode 100644
index 00000000000..e0a0d2aed6a
--- /dev/null
+++ b/mono/io-layer/wapi.h
@@ -0,0 +1,22 @@
+#ifndef _WAPI_WAPI_H_
+#define _WAPI_WAPI_H_
+
+#include <mono/io-layer/types.h>
+#include <mono/io-layer/macros.h>
+#include <mono/io-layer/handles.h>
+#include <mono/io-layer/io.h>
+#include <mono/io-layer/atomic.h>
+#include <mono/io-layer/context.h>
+#include <mono/io-layer/critical-sections.h>
+#include <mono/io-layer/error.h>
+#include <mono/io-layer/events.h>
+#include <mono/io-layer/mutexes.h>
+#include <mono/io-layer/semaphores.h>
+#include <mono/io-layer/sockets.h>
+#include <mono/io-layer/status.h>
+#include <mono/io-layer/system.h>
+#include <mono/io-layer/threads.h>
+#include <mono/io-layer/timefuncs.h>
+#include <mono/io-layer/wait.h>
+
+#endif /* _WAPI_WAPI_H_ */
diff --git a/mono/jit/.cvsignore b/mono/jit/.cvsignore
new file mode 100644
index 00000000000..90b6b6b6546
--- /dev/null
+++ b/mono/jit/.cvsignore
@@ -0,0 +1,10 @@
+Makefile
+Makefile.in
+*.o
+*.exe
+.libs
+.deps
+testjit
+mono
+codegen-x86.c
+codegen.h
diff --git a/mono/jit/ChangeLog b/mono/jit/ChangeLog
new file mode 100644
index 00000000000..6cb8814fdb0
--- /dev/null
+++ b/mono/jit/ChangeLog
@@ -0,0 +1,1195 @@
+2002-04-23 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: code cleanup - use x86_patch ()
+
+ * jit.c (mono_analyze_stack): only use MB_TERM_CHECKTHIS when necessary
+ (mono_analyze_stack): don't store constants in temp. variables for CEE_DUP
+
+ * x86.brg (stmt): removed stmt: STIND_I4 (addr, coni4) rule
+ because it slows down performance.
+
+2002-04-21 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * emit-x86.c: enter_method handles 8-byte aligned parameters.
+
+2002-04-20 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * jit,h, jit.c, x86.brg: NEWOBJ_SPEC and NEWARR_SPEC terminals for
+ non-shared code.
+
+2002-04-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (check_inlining): added statistics about inlineing
+
+ * mono.c (usage): new switch --noinline to disable inlining
+
+ * jit.c (mono_analyze_stack): added a check for (this!=NULL) if we
+ inline methods (to keep semantics)
+
+ * x86.brg: added constant folding for inegers
+
+ * emit-x86.c (tree_allocate_regs): handle the special case when
+ chain rules need a register.
+
+2002-04-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * invoke.c (arch_create_native_wrapper): do not save LMF for Strings
+
+ * jit.c (check_inlining): better inlining support
+
+2002-04-19 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * x86.brg: LDLEN uses max_length instead of bounds[0]
+ * jit.c: support for new szarray format
+
+2002-04-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (check_inlining): added inlining support
+
+2002-04-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: optimized version of castclass and isinst
+
+Wed Apr 17 12:34:56 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * emit-x86.c, invoke.c: track time spent compiling.
+
+Wed Apr 17 10:58:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * emit-x86.c, invoke.c: call profile callbacks if needed.
+ * jit.c, jit.h, mono.c: add --profile command line option.
+
+2002-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * jit.h: included mono/io-layer/io-layer.h to avoid breaking
+ compilation under windows when upgrading mingw and w32api to
+ version 1.3 (thanks Dick!).
+
+2002-04-15 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * jit.c: changed the array icalls to use full names
+
+2002-04-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: check the this pointer before calling
+ non-virtual functions
+
+ * emit-x86.c (arch_emit_prologue): initialize local vars.
+
+ * x86.brg: removed incredible clumsy code
+
+2002-04-13 Martin Baulig <martin@gnome.org>
+
+ * debug-dwarf2.c (dwarf2_write_variable_location): New static func to write
+ the location of a variable.
+ (dwarf2_write_variable, dwarf2_write_parameter): Take a MonoDebugVarInfo
+ instead of a stack offset and use dwarf2_write_variable_location() to write
+ the location.
+
+2002-04-13 Martin Baulig <martin@gnome.org>
+
+ * debug.c, debug-stabs.c, debug-dwarf2.c: Reflect latest debug-symfile.h
+ API changes.
+
+2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Makefile.am: use of the new '-s' option in monoburg.
+
+2002-04-12 Martin Baulig <martin@gnome.org>
+
+ * debug-dwarf2.c (dwarf2_write_variable): Emit info about the variable's
+ lifetime.
+
+2002-04-10 Sergey Chaban <serge@wildwestsoftware.com>
+ * win32-exception: added Win32 SEH exception filter that translates
+ CONTEXT to sigcontext;
+
+ * jit.c: added Win32 SEH init/reset calls, compute sigcontext address
+ in a platfrom-dependent way;
+
+ * jit.h: use win32-exception instead of signal if PLATFORM_WIN32
+ and avoid io-layer includes;
+
+ * delegate.c: do not include io-layer stuff if PLATFORM_WIN32
+ is defined;
+
+2002-04-09 Dietmar Maurer <dietmar@ximian.com>
+
+ * delegate.c (arch_end_invoke): restore output arguments
+
+Mon Apr 8 17:16:40 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * jit.c: call mono_runtime_init ().
+
+2002-04-08 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_jit_cleanup): added more statistics
+
+ * invoke.c (arch_create_native_wrapper): special case EndInvoke -
+ we need to pass the MonoMethod pointer as first argument.
+
+ * delegate.c (mono_async_invoke): notify all listeners, not only a
+ single one.
+ (arch_end_invoke): we now pass a MonoMethod as first parameter and
+ use arch_method_call_message_new() to access the stack.
+ (arch_end_invoke): wait until we really finished processing
+ (async_invoke_abort): notify all listeners, not only a
+ single one.
+
+2002-04-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * message.c (arch_return_value): impl.
+ (arch_method_return_message_restore): consider delegate BeginInvoke
+
+ * jit.c: removed jit_exec_main()
+
+ * delegate.c (arch_begin_invoke): use the message builder to make
+ it architecture independent - still needs more cleanup.
+
+2002-04-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * delegate.c (mono_delegate_ctor): support for transparent proxy
+
+ * x86.brg (freg): bug fix in CONV_R* opcodes
+
+2002-04-04 Dietmar Maurer <dietmar@ximian.com>
+
+ * message.c: added documentation
+
+2002-04-03 Dietmar Maurer <dietmar@ximian.com>
+
+ * mono.c (main): use --trace instead of --trace-calls
+
+ * x86.brg: impl. REMOTE_STIND_XX
+
+ * message.c (mono_store_remote_field): impl.
+
+2002-03-30 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: impl. REMOTE_FIELD (load fields of remote objects)
+
+ * message.c (mono_load_remote_field): impl.
+
+ * jit.c (mono_analyze_stack): only call marshalbyref methods
+ through the vtable.
+ (mono_analyze_stack): consider marshalbyref objects in LDFLD
+
+Fri Mar 29 16:00:27 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86.brg: kill pointer arithmetric.
+
+2002-03-28 Martin Baulig <martin@gnome.org>
+
+ * jit.c (mono_debug_insert_breakpoint): New global variable.
+ (mono_debug_last_breakpoint_address): New global variable.
+
+ * emit-x86.c (arch_compile_method): If `mono_debug_insert_breakpoint' is
+ non-zero, insert a breakpoint; if it's positive, decrement it when done.
+ Set `mono_debug_last_breakpoint_address' to the address of the last inserted
+ breakpoint.
+
+ * debug.h: Provide external declaration of `mono_debug_insert_breakpoint' and
+ `mono_debug_last_breakpoint_address', also documented them here.
+
+2002-03-28 Martin Baulig <martin@gnome.org>
+
+ * debug-private.h (MonoDebugHandle): Renamed `format' to `default_format'.
+ (AssemblyDebugInfo): Added `format'.
+
+ * debug.c: Use the AssemblyDebugInfo's `format' field to determine the format,
+ this allows us choose the format on a per-assembly basis.
+ (mono_debug_open_assembly): When using MONO_DEBUG_FORMAT_DWARF2_PLUS, fall back
+ to MONO_DEBUG_FORMAT_DWARF2 if the symbol file does not exist, but the IL file
+ exists.
+ (debug_generate_method_lines): Generate correct IL offsets.
+
+2002-03-28 Martin Baulig <martin@gnome.org>
+
+ * jit.h (MonoFlowGraph): Added `prologue_end' and `epilogue_start' fields.
+
+ * emit-x86.c (arch_compile_method): Set prologue_end and epilogue_start.
+
+ * debug-private.h (DebugMethodInfo): Renamed `frame_start_offset' to
+ `prologue_end_offset', added `epilogue_begin_offset' and `last_line'.
+
+ * debug.c (debug_generate_method_lines): Don't return if we don't have line
+ numbers, we still need to generate the IL offsets here. Emit line numbers
+ for `prologue_end_offset' (the first line of actual code) and
+ `epilogue_begin_offset' (the line of the method's closing brace).
+ Don't crash if cfg->bblocks [i].forest is NULL.
+ (mono_debug_add_method): Don't crash if we don't have line numbers.
+ Initialize the newly added fields.
+
+ * debug-stabs.c: Record first and last line, emit filename info at the
+ beginning of the stab file, gdb ignores the types otherwise.
+
+ * debug-dwarf2.c: Use the new prologue_end_offset instead of guessing it;
+ emit line number info for the first and last line.
+
+2002-03-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * invoke.c (arch_create_delegate_trampoline): impl.
+
+Thu Mar 28 11:58:53 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am, mono.c, jit.h, jit.c: build the libmono library
+ with the jit runtime to easy embedding. main() is moved to mono.c, now.
+ * jit.c: use opcode names from libmetadata.
+ * debug.h, debug.c: constify char* argument.
+
+2002-03-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c: catching SIGSEGV again, added proxy support
+
+2002-03-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * delegate.c (mono_delegate_init): remove unused worker threads
+
+2002-03-27 Mike Kestner <mkestner@speakeasy.net>
+
+ * delegate.c (arch_get_delegate_invoke): malloc a bigger area
+
+Tue Mar 26 19:54:45 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * jit.c: remove glib mem vtable code.
+
+2002-03-26 Martin Baulig <martin@gnome.org>
+
+ * debug-dwarf2.c (write_method_lines_dwarf2): Don't generate method
+ lines if we don't have line number information.
+ (write_method_dwarf2): Use `minfo->method_info.this_offset' instead
+ of hardcoding 8.
+
+ * debug-stabs.c (write_method_stabs): Don't generate method lines if
+ we don't have line number information. Use `minfo->method_info.this_offset'
+ instead of hardcoding 8.
+
+ * debug.c (debug_generate_method_lines): Don't crash if we don't have
+ line number information.
+ (mono_debug_open_assembly): Don't generate line numbers for
+ MONO_DEBUG_FORMAT_DWARF2_PLUS.
+ (mono_debug_add_method): Don't store the 'this' offset in `param_offsets',
+ but it in the new `this_offset' field.
+
+Mon Mar 25 13:03:35 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * debug.c (debug_generate_method_lines): Use correct addresses for
+ record_il_offset().
+
+Mon Mar 25 13:03:35 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * jit.c: do not set the glib mem vtable anymore.
+ * Makefile.am: link to libmonoutils.
+
+2002-03-25 Martin Baulig <martin@gnome.org>
+
+ * debug.h (mono_debug_make_symbols): Documented this function.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * debug.c (mono_debug_add_method): Include the `this' offset in
+ the `minfo->method_info.param_offsets' array.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * x86.brg (lreg: CONV_I8 (reg)): X86_XOR modifies the flags, so we need
+ to do it before the X86_CMP.
+ (reg: CLT (lreg, lreg)): Use correct x86_branch8() targets.
+ (reg: CLT (lreg, lreg)): Likewise.
+ (reg: CLT_UN (lreg, lreg)): Likewise.
+ (reg: CLT_UN (lreg, lreg)): Likewise.
+ (reg: CGT (lreg, lreg)): Likewise.
+ (reg: CGT (lreg, lreg)): Likewise.
+ (reg: CGT_UN (lreg, lreg)): Likewise.
+ (reg: CGT_UN (lreg, lreg)): Likewise.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * debug-private.h (AssemblyDebugInfo): Added `_priv'.
+
+ * debug-dwarf2-plus.c
+ (mono_debug_open_assembly_dwarf2_plus): Open the symbol file here.
+ (mono_debug_close_assembly_dwarf2_plus): Close the symbol file here.
+ (mono_debug_write_assembly_dwarf2_plus): Only call
+ mono_debug_update_symbol_file() here.
+
+Thu Mar 21 17:35:48 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * jit.c: inter strings before executing a method.
+ Do not intern command line arguments anymore.
+
+2002-03-21 Martin Baulig <martin@gnome.org>
+
+ * debug.h (MonoDebugFormat): Added MONO_DEBUG_FORMAT_DWARF2_PLUS.
+
+ * debug-dwarf2-plus.c: This debugging format reads a symbol file which has
+ been created by MCS and fills in all machine dependent stuff.
+
+ * debug-private.h (DebugMethodInfo): Added `MonoDebugMethodInfo method_info',
+ removed everything which is already in MonoDebugMethodInfo.
+
+ * debug.c (debug_generate_method_lines): Generate the MonoILOffsetInfo array.
+ (mono_debug_make_symbols): Don't open the file or call as, this is done in the
+ backend code.
+
+ * jit.c (main): Added "--dwarf-plus" command line option to use the new
+ MONO_DEBUG_FORMAT_DWARF2_PLUS debugging format.
+
+2002-03-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (usage): new option to specify maximum number of worker threads
+ (mono_analyze_stack): avoid cyclic dependency in CEE_LDFTN
+
+ * delegate.c (async_invoke_abort): added support for asynchronous exceptions
+ (arch_get_async_invoke): notify listeners before we call the
+ asynchronous callback
+
+2002-03-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * delegate.c (async_invoke_thread): support for domains
+ (async_invoke_thread): create workers only when needed
+
+2002-03-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * delegate.c (async_invoke_thread): initial support for BeginInvoke/EndInvoke
+
+2002-03-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: impl. lreg: XOR (lreg, lreg)
+ impl. REM (freg, freg)
+
+2002-03-17 Martin Baulig <martin@gnome.org>
+
+ * debug.c (mono_debug_open_assembly): Call mono_debug_get_type() on all
+ base types.
+
+ * debug-dwarf2.c: Added support for strings and arrays.
+
+2002-03-17 Martin Baulig <martin@gnome.org>
+
+ * debug.c (mono_debug_get_type): Recursively call this for all function members
+ of a class type.
+ (mono_debug_add_method): Don't mangle function names, this must be done by the
+ debugger backend if the debugging format needs mangled names.
+
+ * debug-dwarf2.c: Improved support for classes, added member functions.
+
+2002-03-16 Martin Baulig <martin@gnome.org>
+
+ * debug.c (mono_debug_get_type): Recursively call this for all members and
+ parent classes of a class type.
+
+ * debug-dwarf2.c: Added basic support for classes. Set source language to C++
+ since GDB doesn't like Java very much.
+
+2002-03-16 Martin Baulig <martin@gnome.org>
+
+ * debug-dwarf2.c: Added support for enums.
+
+2002-03-15 Martin Baulig <martin@gnome.org>
+
+ * debug.c (mono_debug_get_type): Recursively call this for all members
+ of a struct type.
+
+ * debug-dwarf2.c: Added support for structs.
+
+2002-03-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (arch_create_jit_trampoline): adapt save/restore LMF
+ to new MonoLMF layout
+
+2002-03-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (arch_create_native_wrapper): new code to generate
+ wrappers for calling native functions.
+ (arch_create_native_wrapper): free allocated strings
+ (arch_handle_exception): made mono_jit_info_table domain dependent
+
+2002-03-14 Martin Baulig <martin@gnome.org>
+
+ * debug.c (MonoDebugFormat): New public enums specifying which debugging
+ format to use.
+ (mono_debug_open_file): Added MonoDebugFormat argument.
+ (mono_debug_make_symbols): Don't take an argument to make it easier to call
+ this function from GDB. It's now safe to call this function multiple times;
+ it'll always write a complete debugging file.
+
+ * debug.c: Splitted this file into a general part which remains in this file
+ and the debugging format specific parts debug-stabs.c and debug-dwarf2.c.
+ All public functions now call a corresponding format specific function.
+
+ * debug.c: The following changes are private to debug.c:
+ (AssemblyDebugInfo, MonoDebugHandle): Moved declarations to debug-private.h.
+ (record_line_number, debug_generate_method_lines): New private functions.
+ (mono_debug_open_ass): Renamed to mono_debug_open_assembly; this function now
+ calls a debugging-format-specific function (mono_debug_open_assembly_stabs or
+ mono_debug_open_assembly_dwarf2).
+ (mono_debug_make_symbols): Calls mono_debug_write_assembly_stabs/dwarf2(). It's
+ now safe to call this function multiple times.
+ (mono_debug_get_type): New public function. This takes a `MonoClass *' and
+ returns an unique index for this type. It's used to ensure that we only write
+ each class once to the debugging file.
+ (mono_debug_add_method, mono_debug_add_type): Store all the data in an internal
+ data structure, but don't directly write to the debugging file. This is done
+ later from mono_debug_write_assembly().
+
+ * jit.c (main): Added "--dwarf" command line argument to generate DWARF 2
+ debugging output. Call mono_debug_close() on cleanup if necessary.
+
+2002-03-14 Martin Baulig <martin@gnome.org>
+
+ * debug-private.h: New private header file.
+
+ * debug-stabs.c: Added the stabs type generation stuff which was
+ previously in debug.c.
+
+ * debug-dwarf.c: Started to implement type support. We're currently
+ only writing this most basic types to the dwarf file, but this will
+ change soon.
+
+2002-03-13 Martin Baulig <martin@gnome.org>
+
+ * debug-stabs.c, debug-dwarf2.c: New files containing my new
+ debugging code. They're now in CVS, but not yet used anywhere.
+
+2002-03-11 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (mono_delegate_ctor): use C impl. instead of x86_*
+ macros, included new delegate code from Daniel Stodden.
+
+
+Mon Mar 11 14:47:21 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * jit.c: verify that corlib and runtime are in sync.
+
+Mon Mar 11 11:30:56 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * emit-x86.c, jit.c: use the debug-helpers facilities to
+ describe and match a method when debugging.
+
+2002-03-10 Martin Baulig <martin@gnome.org>
+
+ * emit-x86.c (arch_compile_method): When emitting stabs debugging
+ output, put a nop instruction at the start of all functions so that
+ the adresses won't change when using --debug.
+
+ * debug.c (mono_debug_add_method): `tree->cli_addr' is an offset into
+ the bytecode area, stabs needs a line number in the .il file. Use the
+ new info->moffsets to get the line number.
+ (AssemblyDebugInfo): Added `total_lines' and `moffsets' fields.
+ `moffsets' is an array of `total_lines' fields (total number of lines
+ in the .il file); for each line in the .il field, this array contains
+ the bytecode offset if it's an "IL_xxxx" line, -1 if it's the last line
+ of a method and 0 otherwise.
+ (debug_load_method_lines): Read the whole .il file and initialize the
+ info->moffsets field.
+
+2002-03-09 Martin Baulig <martin@gnome.org>
+
+ * x86.brg (DIV_UN): Clear EDX before performing the division and remove
+ the unnecessary CDQ instruction.
+
+2002-03-07 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_stack): only load addresses of value types
+ on the runtime stack.
+
+2002-03-07 Duncan Mak <duncan@ximian.com>
+
+ * Makefile.am: A small patch fixing errors in vpath-based builds
+ (make clean failing to rerun monoburg due to BUILT_SOURCES usage),
+ committed for Daniel Stodden <stodden@in.tum.de>.
+
+Thu Mar 7 17:22:52 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * jit.c: Boehm-GC enable.
+
+2002-03-07 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg (SAVE_LFM): bug fix: patch the saved IP because we
+ realloc that code sometimes!
+
+ * emit-x86.c (mono_compute_branches): support several types of
+ jump infos
+
+2002-03-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: impl. MUL_OVF_UN (reg, reg)
+
+ * jit.c (mono_find_final_block): find correct finally handler.
+
+ * emit-x86.c (arch_create_jit_trampoline): bug fix: preserve
+ caller saved registers.
+
+2002-03-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: use x86_widen_reg for CONV opcodes
+
+2002-03-01 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (MAKE_SPILLED_BI_ALU): remove unnecessary assertions
+
+ * emit-x86.c (arch_handle_exception): big fix - dont use
+ uninitialized next_bp
+ (arch_compile_method): make the jit thread save
+ (x86_magic_trampoline): moved lock/unlock to x86_magic_trampoline
+ to avoid need of recursive mutexes
+
+ * x86.brg: use new mono_assert macros
+
+2002-02-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (arch_create_jit_trampoline): save/restore LMF before
+ calling into unmanaged code (arch_compile_method).
+
+ * x86.brg: impl. CONV_I4 (freg) with correct rounding
+ (lreg): impl CALL_I8(INTF_ADDR)
+ impl. CONV_R_UN (reg)
+ bug fix im REM_UN
+
+2002-02-27 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (arch_runtime_invoke): impl. runtime invoke for the jit.
+
+2002-02-26 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: bug fix in CLT(lreg,lreg)
+ (reg): bug fix in CONV_OVF_I4(lreg)
+ (lreg): replaced x86_call_reg with x86_call_code
+
+ * emit-x86.c (mono_add_jump_info): impl.
+ (mono_compute_branches): patch real jump address (instead of
+ emitting code twice)
+
+Tue Feb 26 11:56:03 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86.brg: optimize cmp reg,0 -> test reg.
+
+Sun Feb 24 13:58:34 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * jit.h, jit.c, emit-x86.c: Added a few statistics counters
+ and the --stats command line option to print them.
+ Fixed memory leak in arch_compile_method () when a method's code is
+ found in the cache. Fix magic trampoline to deal with static calls.
+
+2002-02-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: impl. SHR_UN for lreg, added new test, bug fix for BNE_UN
+
+2002-02-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (arch_compile_method): add shared code to mono_root_domain
+ (arch_create_jit_trampoline): cache trampoline code
+
+2002-02-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_stack): optimize LDSFLD/STSFLD for domain
+ specific code.
+ (mono_analyze_stack): use MB_TERM_LDELEMA to perform bound check
+
+ * x86.brg: do not encode exception objects into the instruction
+ stream, because they are domain dependend. Use
+ arch_get_throw_exception_by_name() instead;
+
+Mon Feb 18 15:51:40 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * jit.c: intern command line arguments.
+
+2002-02-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_stack): use the magic trampoline for all
+ calls (since we cant store the address of compiled code in
+ method->addr).
+ (mono_analyze_stack): imp. LDSTR for shared code
+
+ * emit-x86.c (x86_magic_trampoline): handle x86_call_code().
+ (arch_compile_method): add a cache for compiled methods to avoid
+ recompilation. dont use method->addr to store domain dependent
+ code address.
+
+2002-02-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: impl. BLE,BGT for freg
+
+Sat Feb 16 16:27:42 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * emit-x86.c: handle unreachable code. Eliminate some unneeded
+ malloc() calls.
+ * jit.c: handle unreachable code. Move setting of mono_end_of_stack to
+ main(). Add --compile classname and --ncompile num command line
+ options to do performance evaluation of the jitter (and help
+ debugging).
+
+2002-02-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (arch_compile_method): bug fix in static delegate
+ Invoke code.
+
+2002-02-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_stack): do a LDIND after NEWOBJ for value types.
+
+2002-02-13 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_stack): impl. CEE_SIZEOF
+
+2002-02-13 Miguel de Icaza <miguel@ximian.com>
+
+ * jit.c (arch_allocate_var): Only assert that the alignment is
+ at least 32-bits aligned, not always 32-bits aligned (for I8 for example).
+
+Mon Feb 11 11:20:57 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * x86.brg: fix invalid cast check in unbox. Pack MBTree structure.
+
+Sun Feb 10 12:54:05 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * emit-x86.c: make x86_magic_trampoline() handle call instructions
+ with an imm8 displacement. x86.brg not yet changed to take advantage
+ of it.
+
+Sun Feb 10 11:47:30 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * jit.c: use opcode info from libmetadata to do flow analysis
+ and simplify code.
+
+2002-02-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (MAKE_LDELEM, MAKE_STELEM): added bound checking
+
+2002-02-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: use element_class for type check
+
+2002-02-04 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (main): impl. __array_Address icall
+
+ * mempool.c (mono_mempool_alloc): handle large block allocation
+
+2002-02-01 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: impl. SHL/SHR/CLT for 64 bit values
+
+2002-01-31 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: impl. CEQ(lreg,lreg)
+
+ * jit.c (mono_analyze_stack): impl. LDVIRTFTN
+ (mono_analyze_stack): handle MONO_TABLE_MEMBERREF in LDSFLD/STSFLD
+
+ * x86.brg: removed some dead code.
+
+2002-01-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (arch_allocate_var): fixed alignment bugs
+
+2002-01-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_stack): use LDIND_REF/STIND_REF
+
+2002-01-16 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (main): install the trampoline before we start to create
+ objects.
+
+ * x86.brg: impl. CLT_UN, CGT_UN
+
+ * emit-x86.c (leave_method): added check for null object
+ (enter_method): consider byref arguments
+
+2002-01-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: bug fix in CONV_OVF_I1_UN
+ impl. ADD_OVF, MUL_OVF
+ impl. ADD_OVF_UN, SUB_OVF, SUB_OVF_UN
+ (SUB (lreg, lreg)): bug fix - use SBB instead of SUB
+ (EMIT_COND_EXCEPTION): added signed flag
+
+Fri Jan 11 20:06:22 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * jit.c: implement stloc, ldloc, ldloca.
+
+2002-01-11 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_stack): fixed calculation of last_instr
+
+ * x86.brg (LDLEN): emit null_reference exception
+ (BLE_UN): bug fix.
+ (RET, RET_VOID, RET_OBJ, ...) fixed jump to epilog
+
+2002-01-04 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: bug fix in CASTCLASS
+
+2001-12-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_stack): spill MUL to avoid problem with
+ register allocation.
+
+ * emit-x86.c (arch_compile_method): fixed static delegate bug
+
+2001-12-16 Miguel de Icaza <miguel@ximian.com>
+
+ * x86.brg, jit.c: Split up the nodes that we used to share on
+ CONV_OVF. They were sharing the nodes because they are the same
+ on 32-bit machines, but on 64-bit machines you need different
+ code for them.
+
+2001-12-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: removed prerequisite that (tree->left->reg1 <
+ tree->right->reg1) to make register allocation easier.
+
+2001-12-16 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (arch_handle_exception): new code to handle
+ exceptions inside unmanaged code.
+
+ * x86.brg: impl. SAVE_LMF, RESTORE_LMF, pass implizit valuetype
+ address as first argument.
+
+2001-12-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: pass exceptions on the stack
+
+ * jit.h (ISSTRUCT): new macro to check for real value types
+ (return false for enum types).
+
+2001-12-11 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: use position indepentent code if possible.
+
+ * x86.brg (EMIT_COND_EXCEPTION): new macro.
+
+ * emit-x86.c (mono_emit_cfg): impl. variable code buffer size
+
+2001-12-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_flow): use g_malloc0 o allocate large bcinfo
+ blocks.
+ (mono_analyze_flow): use g_malloc0 o allocate large bblocks array.
+
+ * x86.brg (stmt): added opt. for STIND_R4/STIND_R8
+
+2001-12-07 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_allocate_intvar): bug fix.
+
+ * emit-x86.c (get_unbox_trampoline): impl.
+
+ * jit.c (mono_analyze_stack): impl STOBJ, LEAVE
+
+2001-12-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: raise exceptions.
+
+2001-12-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: impl. CEQ for freg, NEWSTRUCT now allocates valuetypes on
+ the stack.
+
+2001-12-06 Miguel de Icaza <miguel@ximian.com>
+
+ * jit.c (mono_analyze_stack), x86.brg: Implement CONV.OVF.I1,
+ CONV.OVF.I4, CONV.OVF.I1.UN, CONV.OVF.U1, CONV.OVF.U1.UN,
+ CONV.OVF.I2.UN, CONV.OVF.I8.UN
+
+2001-12-04 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: impl. UNBOX, NEWSTRUCT, removed VTYPE, bug fixes,
+ removed the locaddr nonterminal, reimplemented value types
+
+ * jit.c: reimplemented value type support, better support for
+ enumeration types.
+
+2001-12-03 Miguel de Icaza <miguel@ximian.com>
+
+ * x86.brg, jit.c: Implement conv.ovf.u4, conv.ovf.u2, conv.ovf.i2,
+ conv.ovf.u8
+
+Mon Dec 3 17:16:36 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * jit.c: call mono_init() after registering internal calls.
+
+2001-11-30 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (tree_preallocate_regs): improved register allocation
+
+ * x86.brg: impl. ISINST, CASTCLASS
+
+Fri Nov 30 12:02:24 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * x86.brg: rearrange fields to reduce struct size.
+ * jit.c: use signature->param_count, not signature->params_size.
+ * debug.c: off-by-one error fix.
+
+2001-11-29 Radek Doulik <rodo@ximian.com>
+
+ * Makefile.am: build mono only for X86 architecture, compilation
+ fails for ppc now because of accessing registers in sigcontext
+ structure
+
+2001-11-29 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_stack): bug fix in DUP
+
+Thu Nov 29 12:32:01 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * debug.c: fix type handling. Position function position at start of
+ IL code. Output more fine-grained stepping information.
+
+2001-11-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg (LDIND_I1, LDIND_I2): use x86_widen_ instead of x86_mov_
+
+ * jit.c (mono_analyze_stack): record the cli_address for later use
+ with gdb.
+ (sigsegv_signal_handler): translate sigsegv into "Internal error"
+ exception.
+
+Tue Nov 27 16:32:41 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * debug.c, debug.h: added support for generating stabs.
+ Stabs can be compiled with as and the resulting object file can be
+ loaded in a gdb session with add-symbol-file object.o.
+ * jit.c, jit.h: add --stabs and --debug command line arguments. Keep track
+ where locals and arguments are stored in the stack. Add support for
+ passing command line arguments to CLR programs.
+ * emit-x86.c: insert a breakpoint at method invocation if needed.
+
+2001-11-27 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c: exception support
+
+ * emit-x86.c (arch_emit_epilogue): bug fix: restore the regs in
+ the right order.
+
+2001-11-26 Dick Porter <dick@ximian.com>
+
+ * Makefile.am (mono_LDADD): Add io-layer library
+
+2001-11-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * jit.c (mono_analyze_stack): impl. LDFTN
+ (MAKE_SPILLED_BI_ALU): always spill DIV/REM results to memory to
+ make register allocation easier on x86
+
+ * emit-x86.c (enter_method): more debugging output for Strings
+ (arch_compile_method): added delegate support
+ (arch_compile_method): align EBP to 8 byte boundary
+
+Mon Nov 19 11:36:22 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * jit.c: use mono_install_trampoline (), instead of exporting
+ a function to a lower-level library.
+
+2001-11-16 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg (STRING_ARG): impl. a way to marshal strings. This
+ will be extensible to handle all possible kinds of marshalling
+ requirements.
+
+ * jit.c (map_call_type): added MB_TERM_CALL_VOID
+ (mono_analyze_stack): impl. LDELEMA, reimplemented CALL
+ instructions to handle this arguments more effectively.
+
+2001-11-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * Makefile.am (mono_SOURCES): renamed testjit to mono
+
+ * x86.brg: added debugging support
+
+ * testjit.c: added support for value types, CFG improvements
+
+ * emit-x86.c (enter_method): handle value types
+ (tree_allocate_regs): impl. a better way to handle chain rules
+
+2001-11-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg (INITOBJ): bug fix: initialize data before use,
+ simplified the code.
+
+2001-11-09 Miguel de Icaza <miguel@ximian.com>
+
+ * testjit.c (mono_analyze_stack): Remove compiler warning by
+ testing against NULL.
+
+2001-11-09 Dick Porter <dick@ximian.com>
+
+ * Makefile.am (testjit_LDADD): Don't need THREAD_LIBS any more
+
+2001-11-09 Dietmar Maurer <dietmar@ximian.com>
+
+ * testjit.c (mono_analyze_stack): new BOX impl.
+
+ * x86.brg: implemented INITOBJ
+
+ * testjit.c (mono_analyze_stack): finished array support
+ (mono_analyze_stack): reimplemented DUP instruction
+
+2001-11-08 Dietmar Maurer <dietmar@ximian.com>
+
+ * testjit.c (MAKE_STELEM, MAKE_LDELEM): we build a tree which
+ represents the address of the element. This way we can emit highly
+ optimized x86 instructions to access elements (using base+index+offset
+ adressing mode)
+
+2001-11-07 Miguel de Icaza <miguel@ximian.com>
+
+ * mempool.c: Include string.h to kill warning.
+
+ * testjit.c: Add typecast to kill warning.
+
+ * x86.brg: Include string.h to eliminate warning.
+
+ * emit-x86.c (tree_allocate_regs): Fix arguments to g_warning to
+ kill warning.
+
+2001-11-07 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (enter_method): print out all method arguments
+ (x86_magic_trampoline): impl.
+ (arch_create_simple_jit_trampoline): we use different trampolines
+ for static methods (no need to write the address back into to
+ vtable).
+
+2001-11-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (arch_create_jit_trampoline): optimised trampoline to
+ use less the 16 bytes.
+
+ * x86.brg: code cleanup
+
+2001-11-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * testjit.c: bug fixes.
+
+ * emit-x86.c (leave_method): print result values
+
+2001-11-03 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (enter_method): new debugging code
+ (leave_method): new debbuging code, this functions are called
+ when you use the new option --trace-calls
+
+2001-11-02 Dietmar Maurer <dietmar@ximian.com>
+
+ * testjit.c: impl. STELEM_XX, STELEM_XX
+
+ * x86.brg: impl. LDLEN, LDELEMA
+
+
+2001-10-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: added some experimental code for CALL
+ instructions - still not found the optimal way to do it.
+
+ * testjit.c (map_stind_type): add support for value types with
+ a size of 1, 2 or 4 bytes, implemented CEE_UNBOX, CEE_LDOBJ,
+ CEE_LDSTR, CEE_LDFLD, CEE_LDFLDA, CEE_STFLD, CEE_NEWOBJ, CEE_CEQ
+ (ctree_create_newobj): impl.
+
+
+ * emit-x86.c (tree_allocate_regs): removed allocation code for
+ addr nonterminal.
+ (get_address): use a simple, but bug free search instead of the
+ buggy binary search.
+
+2001-10-12 Dietmar Maurer <dietmar@ximian.com>
+
+ * testjit.c: support virtual functions
+
+ * x86.brg: support different addressing modes for calls
+
+2001-10-11 Dietmar Maurer <dietmar@ximian.com>
+
+ * testjit.c: impl. STFLD
+
+2001-10-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: impl. CEQ
+
+2001-10-04 Dick Porter <dick@ximian.com>
+
+ * testjit.c:
+ * emit-x86.c: include mono-endian.h not endian.h
+
+2001-10-02 Dietmar Maurer <dietmar@ximian.com>
+
+ * testjit.c (ctree_create_dup): really duplicate the tree.
+ attach the arguments to the CALL node. Added a new macro to
+ make argument order configurable (ARCH_ARGS_RIGHT_TO_LEFT).
+
+2001-10-01 Dietmar Maurer <dietmar@ximian.com>
+
+ * interp.brg: the burm based interpreter: added the file as example.
+
+2001-09-27 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: cleanup
+
+ * testjit.c: impl. LDIND/STIND/LDLOCA, use g_malloc to alloc static
+ data.
+ (map_stind_type): support enum types
+ (map_ldind_type): support enum types
+
+ * emit-x86.c (tree_allocate_regs): added code to support
+ register allocation for addressing modes trees.
+ (tree_emit): bug fix: we have to emit all mono_burg_functins. The
+ previous impl. did not work for chain rules.
+ (compute_branches): support for SWITCH statements
+
+ * x86.brg: added rules to model x86 addressing modes
+
+2001-09-26 Dietmar Maurer <dietmar@ximian.com>
+
+ * emit-x86.c (compute_branches): implemented SWITCH
+
+ * testjit.c (mono_create_forest): implemented LDIND/STIND opcodes
+ (map_ldind_type): add enumeration types.
+ (map_stind_type): add enumeration types.
+
+ * emit-x86.c (arch_compile_method): more documentation.
+
+ * testjit.c: moved the architecture specific things to emit-x86.c
+ and x86.brg. Added more documentation. code cleanup.
+
+2001-09-25 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: we now have different types of addresses: ADDR_L for local
+ values, ADDR_A for arguments and ADDR_G for global addresses. We
+ also use LDIND_XX token to load values from a specific address
+ instead of LDLOC/STLOC.
+
+ * testjit.c: use the new adressing scheme everywhere:
+ LDIND _XX (ADDR_X), and STIND_XX (ADDR_X, tree)
+
+2001-09-24 Dietmar Maurer <dietmar@ximian.com>
+
+ * testjit.c (main): fix bug in parameter parsing
+
+ * x86.brg: impl. more opcodes
+
+2001-09-23 Dick Porter <dick@ximian.com>
+
+ * Makefile.am (testjit_LDADD): rename PTHREAD_LIBS to THREAD_LIBS
+
+2001-09-23 Dietmar Maurer <dietmar@ximian.com>
+
+ * testjit.c: use the memory pool to avoid memory leaks
+
+2001-09-22 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: increment the stack pointer after function calls
+
+2001-09-21 Dick Porter <dick@ximian.com>
+
+ * Makefile.am (testjit_LDADD): Added PTHREAD_LIBS to the link line
+
+2001-09-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: implemented long MUL/DIV
+ (MB_OPT_LEVEL): define optimisation level macro
+
+ * testjit.c (tree_allocate_regs): added a way to prevent EDX usage
+ for operations like idiv. it is also possible to assign specific registers.
+
+2001-09-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: added basic support for long
+
+ * testjit.c (mono_compile_method): implemented POP
+
+2001-09-19 Miguel de Icaza <miguel@ximian.com>
+
+ * testjit.c (usage): Added a couple of more usage options.
+
+2001-09-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: added more floating point grammar
+
+ * testjit.c (mono_compile_method): make local offsets negative
+
+ * x86.brg: added some floating point trees
+
+ * testjit.c (mono_compile_method): arguments on the runtime
+ stack are at least 4 bytes
+
+ * x86.brg: partly implemented 8,16 bit integers
+
+ * testjit.c (get_address): mark basic blocks
+
+2001-09-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: added some rules to optimize code
+
+ * testjit.c (get_address): use a binary search to get the address
+ (main): added an option to debug the jit (-d)
+
+Tue Sep 18 13:19:16 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * testjit.c: better/faster align code. Handle ldloc.s and stloc.s.
+
+2001-09-17 Miguel de Icaza <miguel@ximian.com>
+
+ * testjit.c (mono_compile_method): Provide better error reporting.
+
+2001-09-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * testjit.c (tree_get_address): impl. to fix address bug
+ (tree_get_address): make sure that we can only jump to the first
+ instruction of a tree.
+
+ * x86.brg: emit real code for calls
+
+ * testjit.c (create_jit_trampoline): creates a function to trigger jit
+ compilation.
+ (mono_compile_method): reversed argument order
+
+2001-09-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg (stmt): don't emit unnecessary register moves
+
+ * testjit.c (tree_allocate_regs): free registers earlier
+
+2001-09-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: branch addresses are now resolved
+
+ * testjit.c (compute_branches): compute address of branches
+
+ * x86.brg: emit real x86 instructions
+
+ * testjit.c: call objdump to disassemble the output
+
+2001-09-13 Dietmar Maurer <dietmar@ximian.com>
+
+ * x86.brg: use the right offsets to access local variables
+ and arguments.
+
+ * emit-x86.c: only save/restore callee saved registers if they are
+ really modified.
+
+ * testjit.c (tree_allocate_regs): use the new MonoRegSet to
+ allocate registers.
+ (mono_compile_method): changed the tree for mothod calls
+
+ * regset.h: impl.
+
+ * regset.c: impl.
+
+
+2001-09-10 Miguel de Icaza <miguel@ximian.com>
+
+ * x86.brg: Use Unix assembly syntax.
+
+ * emit-x86.c: support code, should be moved
+
+ * testjit.c: Use GPtrArrays instead of GLists, as those are very
+ inefficient at appends.
+
+ * Renamed `create_new_leave' to `create_new_leaf'
+
+
+
diff --git a/mono/jit/Makefile.am b/mono/jit/Makefile.am
new file mode 100644
index 00000000000..10af4e92a8b
--- /dev/null
+++ b/mono/jit/Makefile.am
@@ -0,0 +1,53 @@
+INCLUDES = \
+ -I$(top_srcdir) \
+ $(GMODULE_CFLAGS) \
+ $(GLIB_CFLAGS)
+
+if X86
+bin_PROGRAMS = mono
+lib_LIBRARIES = libmono.a
+endif
+
+libmono_a_SOURCES = \
+ win32-exception.c \
+ win32-exception.h \
+ codegen.h \
+ codegen-x86.c \
+ emit-x86.c \
+ jit.h \
+ regset.h \
+ regset.c \
+ debug.h \
+ debug-private.h \
+ debug.c \
+ debug-stabs.c \
+ debug-dwarf2.c \
+ debug-dwarf2-plus.c \
+ jit.c \
+ trampoline.c \
+ delegate.c \
+ exception.c \
+ invoke.c \
+ message.c
+
+mono_SOURCES = mono.c
+
+mono_LDADD = \
+ libmono.a \
+ ../metadata/libmonoruntime.a \
+ ../metadata/libmetadata.a \
+ ../io-layer/libwapi.a \
+ ../utils/libmonoutils.a \
+ $(GLIB_LIBS) \
+ $(GMODULE_LIBS) \
+ -lm
+
+codegen-x86.c codegen.h: x86.brg
+ ../monoburg/monoburg $(srcdir)/x86.brg -d codegen.h -s codegen-x86.c
+
+BUILT_SOURCES = codegen-x86.c codegen.h
+
+CLEANFILES = $(BUILT_SOURCES)
+
+EXTRA_DIST = x86.brg
+
diff --git a/mono/jit/TODO b/mono/jit/TODO
new file mode 100644
index 00000000000..290afbfc7bf
--- /dev/null
+++ b/mono/jit/TODO
@@ -0,0 +1,34 @@
+* 64bit integer mult with overflow checks + test bench
+* correctly align value types on the stack and in arrays
+* impl. marshalling attributes for pinvoke
+* raise exceptions everywhere
+* exceptions: save/restore floating point state
+* implement all floating point instruction in x86.brg, we also need to check
+ the floating branch instruction - some of them seems to be wrong, we need to
+ write better tests for that.
+* document the functions and variables in the JIT
+* implement a register set for FP registers (just count register usage on x86)
+
+* inline all calls in System.Math::*, we should use coprozessor instructions
+ directly whenever possible.
+
+* Calling conventions:
+
+ Implement fast call
+
+* Overflow conversions:
+
+ Implement CONV_OVF_XXX (constant) variants that emit either
+ loads or exceptions (as we can always tell)
+
+
+* use short jump opcodes where possible (for backward jumps), will give better
+ performance.
+
+* Memory allocation of dynamic code.
+
+ The current interface to generate code and allocate the memory
+ for it is not very nice.
+
+ Use large buffers to allocate temporary code, rather than allocating
+ 256 bytes every time, and hoping that it will be enough. \ No newline at end of file
diff --git a/mono/jit/debug-dwarf2-plus.c b/mono/jit/debug-dwarf2-plus.c
new file mode 100644
index 00000000000..c7d95bdf911
--- /dev/null
+++ b/mono/jit/debug-dwarf2-plus.c
@@ -0,0 +1,58 @@
+#include <stdlib.h>
+#include <string.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/debug-symfile.h>
+#include <mono/jit/codegen.h>
+#include <mono/jit/debug.h>
+
+#include "debug-private.h"
+
+typedef struct {
+ MonoDebugSymbolFile *symfile;
+} AssemblyDebugInfoPrivate;
+
+void
+mono_debug_open_assembly_dwarf2_plus (AssemblyDebugInfo *info)
+{
+ AssemblyDebugInfoPrivate *priv = g_new0 (AssemblyDebugInfoPrivate, 1);
+
+ priv->symfile = mono_debug_open_symbol_file (info->image, info->filename, TRUE);
+
+ info->_priv = priv;
+}
+
+void
+mono_debug_close_assembly_dwarf2_plus (AssemblyDebugInfo *info)
+{
+ AssemblyDebugInfoPrivate *priv = info->_priv;
+
+ if (priv->symfile)
+ mono_debug_close_symbol_file (priv->symfile);
+
+ g_free (info->_priv);
+}
+
+static MonoDebugMethodInfo *
+method_info_func (MonoDebugSymbolFile *symfile, guint32 token, gpointer user_data)
+{
+ AssemblyDebugInfo *info = user_data;
+ MonoMethod *method;
+ DebugMethodInfo *minfo;
+
+ method = g_hash_table_lookup (info->image->method_cache, GINT_TO_POINTER (token));
+ if (!method)
+ return NULL;
+
+ minfo = g_hash_table_lookup (info->methods, method);
+
+ return (MonoDebugMethodInfo *) minfo;
+}
+
+void
+mono_debug_write_assembly_dwarf2_plus (AssemblyDebugInfo *info)
+{
+ AssemblyDebugInfoPrivate *priv = info->_priv;
+
+ if (priv->symfile)
+ mono_debug_update_symbol_file (priv->symfile, method_info_func, info);
+}
diff --git a/mono/jit/debug-dwarf2.c b/mono/jit/debug-dwarf2.c
new file mode 100644
index 00000000000..5a7561bc58e
--- /dev/null
+++ b/mono/jit/debug-dwarf2.c
@@ -0,0 +1,1385 @@
+#include <stdlib.h>
+#include <string.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/jit/codegen.h>
+#include <mono/jit/debug.h>
+
+#include "debug-private.h"
+
+#define ABBREV_COMPILE_UNIT 1
+#define ABBREV_SUBPROGRAM 2
+#define ABBREV_SUBPROGRAM_RETVAL 3
+#define ABBREV_BASE_TYPE 4
+#define ABBREV_FORMAL_PARAMETER 5
+#define ABBREV_PARAMETER 6
+#define ABBREV_LOCAL_VARIABLE 7
+#define ABBREV_STRUCT_TYPE 8
+#define ABBREV_STRUCT_MEMBER 9
+#define ABBREV_STRUCT_ACCESS 10
+#define ABBREV_ENUM_TYPE 11
+#define ABBREV_ENUM_VALUE 12
+#define ABBREV_ENUM_VALUE_UNSIGNED 13
+#define ABBREV_ENUM_VALUE_SIGNED 14
+#define ABBREV_CLASS_TYPE 15
+#define ABBREV_CLASS_INHERITANCE 16
+#define ABBREV_POINTER_TYPE 17
+#define ABBREV_CLASS_METHOD 18
+#define ABBREV_CLASS_METHOD_RETVAL 19
+#define ABBREV_ARTIFICIAL_PARAMETER 20
+#define ABBREV_SIMPLE_ARRAY 21
+#define ABBREV_ARRAY 22
+#define ABBREV_SUBRANGE 23
+
+// The following constants are defined in the DWARF 2 specification
+#define DW_TAG_array_type 0x01
+#define DW_TAG_class_type 0x02
+#define DW_TAG_enumeration_type 0x04
+#define DW_TAG_formal_parameter 0x05
+#define DW_TAG_member 0x0d
+#define DW_TAG_pointer_type 0x0f
+#define DW_TAG_compile_unit 0x11
+#define DW_TAG_structure_type 0x13
+#define DW_TAG_inheritance 0x1c
+#define DW_TAG_subrange_type 0x21
+#define DW_TAG_access_declaration 0x23
+#define DW_TAG_base_type 0x24
+#define DW_TAG_enumerator 0x28
+#define DW_TAG_subprogram 0x2e
+#define DW_TAG_variable 0x34
+
+#define DW_CHILDREN_no 0
+#define DW_CHILDREN_yes 1
+
+#define DW_AT_location 0x02
+#define DW_AT_name 0x03
+#define DW_AT_byte_size 0x0b
+#define DW_AT_stmt_list 0x10
+#define DW_AT_low_pc 0x11
+#define DW_AT_high_pc 0x12
+#define DW_AT_language 0x13
+#define DW_AT_const_value 0x1c
+#define DW_AT_lower_bound 0x22
+#define DW_AT_producer 0x25
+#define DW_AT_start_scope 0x2c
+#define DW_AT_upper_bound 0x2f
+#define DW_AT_accessibility 0x32
+#define DW_AT_artificial 0x34
+#define DW_AT_calling_convention 0x36
+#define DW_AT_count 0x37
+#define DW_AT_data_member_location 0x38
+#define DW_AT_encoding 0x3e
+#define DW_AT_external 0x3f
+#define DW_AT_type 0x49
+#define DW_AT_virtuality 0x4c
+#define DW_AT_vtable_elem_location 0x4d
+
+/* Martin Baulig's extensions. */
+#define DW_AT_end_scope 0x2121
+
+#define DW_FORM_addr 0x01
+#define DW_FORM_block4 0x04
+#define DW_FORM_data2 0x05
+#define DW_FORM_data4 0x06
+#define DW_FORM_data8 0x07
+#define DW_FORM_string 0x08
+#define DW_FORM_data1 0x0b
+#define DW_FORM_flag 0x0c
+#define DW_FORM_sdata 0x0d
+#define DW_FORM_udata 0x0f
+#define DW_FORM_ref4 0x13
+
+#define DW_ATE_void 0x00
+#define DW_ATE_address 0x01
+#define DW_ATE_boolean 0x02
+#define DW_ATE_complex_float 0x03
+#define DW_ATE_float 0x04
+#define DW_ATE_signed 0x05
+#define DW_ATE_signed_char 0x06
+#define DW_ATE_unsigned 0x07
+#define DW_ATE_unsigned_char 0x08
+
+#define DW_OP_const1u 0x08
+#define DW_OP_const1s 0x09
+#define DW_OP_constu 0x10
+#define DW_OP_consts 0x11
+#define DW_OP_plus 0x22
+#define DW_OP_reg0 0x50
+#define DW_OP_breg0 0x70
+#define DW_OP_fbreg 0x91
+#define DW_OP_piece 0x93
+
+#define DW_CC_normal 1
+#define DW_CC_program 2
+#define DW_CC_nocall 3
+
+#define DW_ACCESS_public 1
+#define DW_ACCESS_protected 2
+#define DW_ACCESS_private 3
+
+#define DW_VIRTUALITY_none 0
+#define DW_VIRTUALITY_virtual 1
+#define DW_VIRTUALITY_pure_virtual 2
+
+#define DW_LANG_C_plus_plus 0x04
+#define DW_LANG_Java 0x0b
+// This is NOT in the standard, we're using Java for the moment. */
+#define DW_LANG_C_sharp DW_LANG_C_plus_plus
+
+#define DW_LNS_extended_op 0
+#define DW_LNS_copy 1
+#define DW_LNS_advance_pc 2
+#define DW_LNS_advance_line 3
+#define DW_LNS_set_file 4
+#define DW_LNS_set_column 5
+#define DW_LNS_negate_stmt 6
+#define DW_LNS_set_basic_block 7
+#define DW_LNS_const_add_pc 8
+#define DW_LNS_fixed_advance_pc 9
+
+#define DW_LNE_end_sequence 1
+#define DW_LNE_set_address 2
+#define DW_LNE_define_file 3
+
+
+static const int line_base = 1, line_range = 8, opcode_base = 10;
+static const int standard_opcode_sizes [10] = {
+ 0, 0, 1, 1, 1, 1, 0, 0, 0, 0
+};
+
+void
+mono_debug_open_assembly_dwarf2 (AssemblyDebugInfo *info)
+{
+}
+
+void
+mono_debug_close_assembly_dwarf2 (AssemblyDebugInfo *info)
+{
+}
+
+static void
+dwarf2_write_byte (FILE *f, int byte)
+{
+ fprintf (f, "\t.byte\t\t%d\n", byte);
+}
+
+static void
+dwarf2_write_2byte (FILE *f, int word)
+{
+ fprintf (f, "\t.2byte\t\t%d\n", word);
+}
+
+static void
+dwarf2_write_pair (FILE *f, int a, int b)
+{
+ fprintf (f, "\t.uleb128\t\t%d, %d\n", a, b);
+}
+
+static void
+dwarf2_write_long (FILE *f, unsigned long value)
+{
+ fprintf (f, "\t.long\t\t%lu\n", value);
+}
+
+static void
+dwarf2_write_address (FILE *f, void *address)
+{
+ fprintf (f, "\t.long\t\t%p\n", address);
+}
+
+static void
+dwarf2_write_string (FILE *f, const char *string)
+{
+ fprintf (f, "\t.string\t\t\"%s\"\n", string);
+}
+
+static void
+dwarf2_write_sleb128 (FILE *f, long value)
+{
+ fprintf (f, "\t.sleb128\t%ld\n", value);
+}
+
+static void
+dwarf2_write_uleb128 (FILE *f, unsigned long value)
+{
+ fprintf (f, "\t.uleb128\t%lu\n", value);
+}
+
+static void
+dwarf2_write_section_start (FILE *f, const char *section)
+{
+ fprintf (f, "\t.section\t.%s\n", section);
+}
+
+static void
+dwarf2_write_section_end (FILE *f)
+{
+ fprintf (f, "\t.previous\n\n");
+}
+
+static void
+dwarf2_write_label (FILE *f, const char *label)
+{
+ fprintf (f, ".L_%s:\n", label);
+}
+
+static void
+dwarf2_write_section_size (FILE *f, const char *start_label, const char *end_label)
+{
+ fprintf (f, "\t.long\t\t.L_%s - .L_%s\n", end_label, start_label);
+}
+
+static void
+dwarf2_write_ref4 (FILE *f, const char *target_label)
+{
+ fprintf (f, "\t.long\t\t.L_%s\n", target_label);
+}
+
+static void
+dwarf2_write_type_ref (FILE *f, unsigned long type_index)
+{
+ fprintf (f, "\t.long\t\t.L_TYPE_%lu - .L_debug_info_b\n", type_index);
+}
+
+static void
+dwarf2_write_type_ptr_ref (FILE *f, unsigned long idx)
+{
+ fprintf (f, "\t.long\t\t.L_TYPE_PTR_%lu - .L_debug_info_b\n", idx);
+}
+
+static void
+dwarf2_write_relative_ref (FILE *f, const gchar *name, unsigned long idx)
+{
+ fprintf (f, "\t.long\t\t.L_%s_%lu - .L_debug_info_b\n", name, idx);
+}
+
+static void
+dwarf2_write_dw_lns_copy (FILE *f)
+{
+ dwarf2_write_byte (f, DW_LNS_copy);
+}
+
+static void
+dwarf2_write_dw_lns_advance_pc (FILE *f, unsigned value)
+{
+ dwarf2_write_byte (f, DW_LNS_advance_pc);
+ dwarf2_write_uleb128 (f, value);
+}
+
+static void
+dwarf2_write_dw_lns_advance_line (FILE *f, int value)
+{
+ dwarf2_write_byte (f, DW_LNS_advance_line);
+ dwarf2_write_sleb128 (f, value);
+}
+
+static void
+dwarf2_write_dw_lns_negate_stmt (FILE *f)
+{
+ dwarf2_write_byte (f, DW_LNS_negate_stmt);
+}
+
+#if 0 /* never used */
+static void
+dwarf2_write_dw_lns_set_basic_block (FILE *f)
+{
+ dwarf2_write_byte (f, DW_LNS_set_basic_block);
+}
+#endif
+
+static void
+dwarf2_write_dw_lne_end_sequence (FILE *f)
+{
+ dwarf2_write_byte (f, 0);
+ dwarf2_write_byte (f, 1);
+ dwarf2_write_byte (f, DW_LNE_end_sequence);
+}
+
+static void
+dwarf2_write_dw_lne_set_address (FILE *f, void *address)
+{
+ dwarf2_write_byte (f, 0);
+ dwarf2_write_byte (f, sizeof (address) + 1);
+ dwarf2_write_byte (f, DW_LNE_set_address);
+ dwarf2_write_address (f, address);
+}
+
+static void
+dwarf2_write_base_type (AssemblyDebugInfo *info, int idx,
+ int type, int size, const gchar *name)
+{
+ char buffer [BUFSIZ];
+
+ sprintf (buffer, "TYPE_%d", idx);
+ dwarf2_write_label (info->f, buffer);
+ // DW_TAG_basic_type
+ dwarf2_write_byte (info->f, ABBREV_BASE_TYPE);
+ dwarf2_write_string (info->f, name);
+ dwarf2_write_byte (info->f, type);
+ dwarf2_write_byte (info->f, size);
+}
+
+static void
+dwarf2_write_enum_value (AssemblyDebugInfo *info, MonoClass *klass, int idx)
+{
+ const void *ptr;
+ guint32 field_index = idx + klass->field.first;
+ guint32 crow;
+
+ crow = mono_metadata_get_constant_index (klass->image, MONO_TOKEN_FIELD_DEF | (field_index + 1));
+ if (!crow) {
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE);
+ dwarf2_write_string (info->f, klass->fields [idx].name);
+ dwarf2_write_long (info->f, 0);
+ return;
+ }
+
+ crow = mono_metadata_decode_row_col (&klass->image->tables [MONO_TABLE_CONSTANT], crow-1,
+ MONO_CONSTANT_VALUE);
+
+ ptr = 1 + mono_metadata_blob_heap (klass->image, crow);
+
+ switch (klass->enum_basetype->type) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_U1:
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE_UNSIGNED);
+ dwarf2_write_string (info->f, klass->fields [idx].name);
+ dwarf2_write_uleb128 (info->f, *(guint8 *) ptr);
+ break;
+ case MONO_TYPE_I1:
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE_SIGNED);
+ dwarf2_write_string (info->f, klass->fields [idx].name);
+ dwarf2_write_sleb128 (info->f, *(gint8 *) ptr);
+ break;
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_U2:
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE_UNSIGNED);
+ dwarf2_write_string (info->f, klass->fields [idx].name);
+ dwarf2_write_uleb128 (info->f, *(guint16 *) ptr);
+ break;
+ case MONO_TYPE_I2:
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE_SIGNED);
+ dwarf2_write_string (info->f, klass->fields [idx].name);
+ dwarf2_write_sleb128 (info->f, *(gint16 *) ptr);
+ break;
+ case MONO_TYPE_U4:
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE_UNSIGNED);
+ dwarf2_write_string (info->f, klass->fields [idx].name);
+ dwarf2_write_uleb128 (info->f, *(guint32 *) ptr);
+ break;
+ case MONO_TYPE_I4:
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE_SIGNED);
+ dwarf2_write_string (info->f, klass->fields [idx].name);
+ dwarf2_write_sleb128 (info->f, *(gint32 *) ptr);
+ break;
+ case MONO_TYPE_U8:
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE_UNSIGNED);
+ dwarf2_write_string (info->f, klass->fields [idx].name);
+ dwarf2_write_uleb128 (info->f, *(guint64 *) ptr);
+ break;
+ case MONO_TYPE_I8:
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE_SIGNED);
+ dwarf2_write_string (info->f, klass->fields [idx].name);
+ dwarf2_write_sleb128 (info->f, *(gint64 *) ptr);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+}
+
+static void
+dwarf2_write_enum_type (AssemblyDebugInfo *info, MonoClass *klass)
+{
+ int i;
+
+ // DW_TAG_enumeration_type
+ dwarf2_write_byte (info->f, ABBREV_ENUM_TYPE);
+ dwarf2_write_string (info->f, klass->name);
+ dwarf2_write_long (info->f, klass->instance_size - sizeof (MonoObject));
+
+ for (i = 0; i < klass->field.count; i++) {
+ if (klass->fields [i].type->attrs & FIELD_ATTRIBUTE_LITERAL)
+ dwarf2_write_enum_value (info, klass, i);
+ }
+
+ dwarf2_write_byte (info->f, 0);
+ // DW_TAG_enumeration_type ends here
+}
+
+static void
+dwarf2_write_class_field (AssemblyDebugInfo *info, MonoClass *klass, int idx,
+ int type_index, int start_offset)
+{
+ MonoClass *subclass = mono_class_from_mono_type (klass->fields [idx].type);
+ char start [BUFSIZ], end [BUFSIZ];
+ static long label_index = 0;
+
+ sprintf (start, "DSF1_%ld", ++label_index);
+ sprintf (end, "DSF2_%ld", label_index);
+
+ // DW_TAG_member
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_MEMBER);
+ dwarf2_write_string (info->f, klass->fields [idx].name);
+ if (!subclass->valuetype)
+ dwarf2_write_type_ptr_ref (info->f, type_index);
+ else
+ dwarf2_write_type_ref (info->f, type_index);
+
+ if (klass->fields [idx].type->attrs & FIELD_ATTRIBUTE_PRIVATE)
+ dwarf2_write_byte (info->f, DW_ACCESS_private);
+ else if (klass->fields [idx].type->attrs & FIELD_ATTRIBUTE_FAMILY)
+ dwarf2_write_byte (info->f, DW_ACCESS_protected);
+ else
+ dwarf2_write_byte (info->f, DW_ACCESS_public);
+
+ dwarf2_write_section_size (info->f, start, end);
+ dwarf2_write_label (info->f, start);
+ dwarf2_write_byte (info->f, DW_OP_constu);
+ dwarf2_write_uleb128 (info->f, klass->fields [idx].offset - start_offset);
+ dwarf2_write_label (info->f, end);
+
+ dwarf2_write_long (info->f, subclass->instance_size);
+}
+
+static void
+dwarf2_write_class_method (AssemblyDebugInfo *info, MonoClass *klass, MonoMethod *method)
+{
+ MonoType *ret_type = NULL;
+ gchar **names;
+ int i;
+
+ if (method->signature->ret->type != MONO_TYPE_VOID)
+ ret_type = method->signature->ret;
+
+ // DW_TAG_subprogram
+ if (ret_type)
+ dwarf2_write_byte (info->f, ABBREV_CLASS_METHOD_RETVAL);
+ else
+ dwarf2_write_byte (info->f, ABBREV_CLASS_METHOD);
+ dwarf2_write_string (info->f, method->name);
+
+ if (method->flags & METHOD_ATTRIBUTE_PUBLIC)
+ dwarf2_write_byte (info->f, DW_ACCESS_public);
+ else if (method->flags & METHOD_ATTRIBUTE_PRIVATE)
+ dwarf2_write_byte (info->f, DW_ACCESS_private);
+ else
+ dwarf2_write_byte (info->f, DW_ACCESS_protected);
+
+ if (method->flags & METHOD_ATTRIBUTE_VIRTUAL)
+ dwarf2_write_byte (info->f, DW_VIRTUALITY_pure_virtual);
+ else
+ dwarf2_write_byte (info->f, DW_VIRTUALITY_none);
+
+ dwarf2_write_byte (info->f, DW_CC_nocall);
+
+ if (ret_type) {
+ MonoClass *k = mono_class_from_mono_type (ret_type);
+ int type_index = mono_debug_get_type (info, k);
+ dwarf2_write_type_ref (info->f, type_index);
+ }
+
+ if (method->signature->hasthis) {
+ int type_index = mono_debug_get_type (info, klass);
+
+ dwarf2_write_byte (info->f, ABBREV_ARTIFICIAL_PARAMETER);
+ dwarf2_write_string (info->f, "this");
+ dwarf2_write_type_ptr_ref (info->f, type_index);
+ dwarf2_write_byte (info->f, 1);
+ }
+
+ names = g_new (char *, method->signature->param_count);
+ mono_method_get_param_names (method, (const char **) names);
+
+ for (i = 0; i < method->signature->param_count; i++) {
+ MonoType *subtype = method->signature->params [i];
+ MonoClass *subklass = mono_class_from_mono_type (subtype);
+ int type_index = mono_debug_get_type (info, subklass);
+
+ // DW_TAG_formal_parameter
+ dwarf2_write_byte (info->f, ABBREV_FORMAL_PARAMETER);
+ dwarf2_write_string (info->f, names [i]);
+ if (subklass->valuetype)
+ dwarf2_write_type_ref (info->f, type_index);
+ else
+ dwarf2_write_type_ptr_ref (info->f, type_index);
+ }
+
+ g_free (names);
+
+ dwarf2_write_byte (info->f, 0);
+ // DW_TAG_subprogram ends here
+}
+
+static void
+dwarf2_write_struct_type (AssemblyDebugInfo *info, MonoClass *klass)
+{
+ guint32 *idxs;
+ int i;
+
+ idxs = g_new0 (guint32, klass->field.last - klass->field.first + 1);
+ for (i = 0; i < klass->field.count; i++) {
+ MonoClass *subclass = mono_class_from_mono_type (klass->fields [i].type);
+ idxs [i] = mono_debug_get_type (info, subclass);
+ }
+
+ // DW_TAG_structure_type
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_TYPE);
+ dwarf2_write_string (info->f, klass->name);
+ dwarf2_write_long (info->f, klass->instance_size - sizeof (MonoObject));
+
+ for (i = 0; i < klass->field.count; i++)
+ dwarf2_write_class_field (info, klass, i, idxs [i], sizeof (MonoObject));
+
+ dwarf2_write_byte (info->f, 0);
+ // DW_TAG_structure_type ends here
+
+ g_free (idxs);
+}
+
+static void
+dwarf2_write_class_type (AssemblyDebugInfo *info, MonoClass *klass)
+{
+ guint32 *idxs;
+ int i;
+
+ idxs = g_new0 (guint32, klass->field.last - klass->field.first + 1);
+ for (i = 0; i < klass->field.count; i++) {
+ MonoClass *subclass = mono_class_from_mono_type (klass->fields [i].type);
+ idxs [i] = mono_debug_get_type (info, subclass);
+ }
+
+ // DW_TAG_structure_type
+ dwarf2_write_byte (info->f, ABBREV_CLASS_TYPE);
+ dwarf2_write_string (info->f, klass->name);
+ dwarf2_write_long (info->f, klass->instance_size);
+ if (klass->flags & TYPE_ATTRIBUTE_PUBLIC)
+ dwarf2_write_byte (info->f, DW_ACCESS_public);
+ else
+ dwarf2_write_byte (info->f, DW_ACCESS_private);
+
+ if (klass->parent && klass->parent->byval_arg.type == MONO_TYPE_CLASS) {
+ guint32 parent_index = mono_debug_get_type (info, klass->parent);
+
+ // DW_TAG_inheritance
+ dwarf2_write_byte (info->f, ABBREV_CLASS_INHERITANCE);
+ dwarf2_write_type_ref (info->f, parent_index);
+ if (klass->parent->flags & TYPE_ATTRIBUTE_PUBLIC)
+ dwarf2_write_byte (info->f, DW_ACCESS_public);
+ else
+ dwarf2_write_byte (info->f, DW_ACCESS_private);
+ }
+
+ for (i = 0; i < klass->field.count; i++)
+ dwarf2_write_class_field (info, klass, i, idxs [i], 0);
+
+ for (i = 0; i < klass->method.count; i++) {
+ if (!strcmp (klass->methods [i]->name, ".ctor"))
+ continue;
+
+ dwarf2_write_class_method (info, klass, klass->methods [i]);
+ }
+
+ dwarf2_write_byte (info->f, 0);
+ // DW_TAG_class_type ends here
+
+ g_free (idxs);
+}
+
+static void
+dwarf2_write_array (AssemblyDebugInfo *info, const gchar *name, MonoClass *element_class,
+ int rank, int idx)
+{
+ unsigned long uint32_index = mono_debug_get_type (info, mono_defaults.uint32_class);
+ char buffer [BUFSIZ];
+ MonoArray array;
+
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_TYPE);
+ dwarf2_write_string (info->f, name);
+ dwarf2_write_long (info->f, sizeof (MonoArray));
+
+ // DW_TAG_structure_type
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_MEMBER);
+ dwarf2_write_string (info->f, "max_length");
+ dwarf2_write_type_ref (info->f, uint32_index);
+ dwarf2_write_byte (info->f, DW_ACCESS_public);
+ dwarf2_write_long (info->f, 2);
+ dwarf2_write_byte (info->f, DW_OP_const1u);
+ dwarf2_write_byte (info->f, (guchar *) &array.max_length - (guchar *) &array);
+ dwarf2_write_long (info->f, 4);
+
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_MEMBER);
+ dwarf2_write_string (info->f, "bounds");
+ dwarf2_write_relative_ref (info->f, "ARRAY_BOUNDS_PTR", idx);
+ dwarf2_write_byte (info->f, DW_ACCESS_public);
+ dwarf2_write_long (info->f, 2);
+ dwarf2_write_byte (info->f, DW_OP_const1u);
+ dwarf2_write_byte (info->f, (guchar *) &array.bounds - (guchar *) &array);
+ dwarf2_write_long (info->f, 4);
+
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_MEMBER);
+ dwarf2_write_string (info->f, "vector");
+ dwarf2_write_relative_ref (info->f, "ARRAY_PTR", idx);
+ dwarf2_write_byte (info->f, DW_ACCESS_public);
+ dwarf2_write_long (info->f, 2);
+ dwarf2_write_byte (info->f, DW_OP_const1u);
+ dwarf2_write_byte (info->f, (guchar *) &array.vector - (guchar *) &array);
+ dwarf2_write_long (info->f, 4);
+
+ dwarf2_write_byte (info->f, 0);
+ // DW_TAG_structure_type ends here
+
+ sprintf (buffer, "ARRAY_BOUNDS_PTR_%u", idx);
+ dwarf2_write_label (info->f, buffer);
+
+ // DW_TAG_pointer_type
+ dwarf2_write_byte (info->f, ABBREV_POINTER_TYPE);
+ dwarf2_write_relative_ref (info->f, "ARRAY_BOUNDS", idx);
+
+ sprintf (buffer, "ARRAY_BOUNDS_%u", idx);
+ dwarf2_write_label (info->f, buffer);
+
+ // DW_TAG_array_type
+ dwarf2_write_byte (info->f, ABBREV_ARRAY);
+ dwarf2_write_string (info->f, name);
+ dwarf2_write_type_ref (info->f, uint32_index);
+ dwarf2_write_long (info->f, rank * 2);
+
+ // DW_TAG_subrange_type
+ dwarf2_write_byte (info->f, ABBREV_SUBRANGE);
+ dwarf2_write_long (info->f, 0);
+ dwarf2_write_long (info->f, rank-1);
+ dwarf2_write_long (info->f, rank);
+
+ // DW_TAG_subrange_type
+ dwarf2_write_byte (info->f, ABBREV_SUBRANGE);
+ dwarf2_write_long (info->f, 0);
+ dwarf2_write_long (info->f, 1);
+ dwarf2_write_long (info->f, 2);
+
+ dwarf2_write_byte (info->f, 0);
+ // DW_TAG_array_type ends here
+
+ sprintf (buffer, "ARRAY_PTR_%u", idx);
+ dwarf2_write_label (info->f, buffer);
+
+ // DW_TAG_array_type
+ dwarf2_write_byte (info->f, ABBREV_SIMPLE_ARRAY);
+ dwarf2_write_string (info->f, name);
+ if (element_class->valuetype)
+ dwarf2_write_type_ref (info->f, mono_debug_get_type (info, element_class));
+ else
+ dwarf2_write_type_ptr_ref (info->f, mono_debug_get_type (info, element_class));
+}
+
+static void
+dwarf2_write_array_type (AssemblyDebugInfo *info, MonoClass *klass, int idx)
+{
+ char buffer [BUFSIZ], *name;
+ int i;
+
+ buffer[0] = '\0';
+ for (i = 0; i < klass->rank; i++)
+ strcat (buffer, "[]");
+
+ name = g_strdup_printf ("%s%s", klass->element_class->name, buffer);
+
+ dwarf2_write_array (info, name, klass->element_class, klass->rank, idx);
+
+ g_free (name);
+}
+
+static void
+dwarf2_write_string_type (AssemblyDebugInfo *info, MonoClass *klass, int idx)
+{
+ unsigned long uint32_index = mono_debug_get_type (info, mono_defaults.uint32_class);
+ char buffer [BUFSIZ];
+ MonoString string;
+
+ // DW_TAG_structure_type
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_TYPE);
+ dwarf2_write_string (info->f, klass->name);
+ dwarf2_write_long (info->f, sizeof (MonoString));
+
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_MEMBER);
+ dwarf2_write_string (info->f, "length");
+ dwarf2_write_type_ref (info->f, uint32_index);
+ dwarf2_write_byte (info->f, DW_ACCESS_public);
+ dwarf2_write_long (info->f, 2);
+ dwarf2_write_byte (info->f, DW_OP_const1u);
+ dwarf2_write_byte (info->f, (guchar *) &string.length - (guchar *) &string);
+ dwarf2_write_long (info->f, 4);
+
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_MEMBER);
+ dwarf2_write_string (info->f, "c_str");
+ dwarf2_write_relative_ref (info->f, "CSTRING_PTR", idx);
+ dwarf2_write_byte (info->f, DW_ACCESS_public);
+ dwarf2_write_long (info->f, 2);
+ dwarf2_write_byte (info->f, DW_OP_const1u);
+ //fixme: don't know how to handle this
+ //dwarf2_write_byte (info->f, (guchar *) &string.c_str - (guchar *) &string);
+ g_assert_not_reached ();
+ dwarf2_write_long (info->f, 4);
+
+ dwarf2_write_byte (info->f, 0);
+ // DW_TAG_structure_type ends here
+
+ sprintf (buffer, "CSTRING_PTR_%u", idx);
+ dwarf2_write_label (info->f, buffer);
+
+ // DW_TAG_pointer_type
+ dwarf2_write_byte (info->f, ABBREV_POINTER_TYPE);
+ dwarf2_write_relative_ref (info->f, "CSTRING", idx);
+
+ sprintf (buffer, "CSTRING_%u", idx);
+ dwarf2_write_label (info->f, buffer);
+
+ dwarf2_write_array (info, "Char[]", mono_defaults.char_class, 1, idx);
+}
+
+static void
+dwarf2_write_class (AssemblyDebugInfo *info, MonoClass *klass, int idx)
+{
+ char buffer [BUFSIZ];
+ int print = 0;
+
+ if (!strncmp (klass->name, "My", 2)) {
+ g_message (G_STRLOC ": %s - %s - %x", klass->name_space, klass->name, klass->flags);
+ print = 1;
+ // G_BREAKPOINT ();
+ }
+
+ if (!klass->valuetype) {
+ sprintf (buffer, "TYPE_PTR_%u", idx);
+ dwarf2_write_label (info->f, buffer);
+
+ // DW_TAG_pointer_type
+ dwarf2_write_byte (info->f, ABBREV_POINTER_TYPE);
+ dwarf2_write_type_ref (info->f, idx);
+ }
+
+ sprintf (buffer, "TYPE_%u", idx);
+ dwarf2_write_label (info->f, buffer);
+
+ if (klass->enumtype) {
+ dwarf2_write_enum_type (info, klass);
+ return;
+ }
+
+ switch (klass->byval_arg.type) {
+ case MONO_TYPE_VALUETYPE:
+ dwarf2_write_struct_type (info, klass);
+ break;
+ case MONO_TYPE_CLASS:
+ dwarf2_write_class_type (info, klass);
+ break;
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ dwarf2_write_array_type (info, klass, idx);
+ break;
+ case MONO_TYPE_STRING:
+ dwarf2_write_string_type (info, klass, idx);
+ break;
+ default:
+ g_message (G_STRLOC ": %s.%s - 0x%x - 0x%x", klass->name_space, klass->name,
+ klass->byval_arg.type, klass->flags);
+
+ // DW_TAG_basic_type
+ dwarf2_write_byte (info->f, ABBREV_BASE_TYPE);
+ dwarf2_write_string (info->f, klass->name);
+ dwarf2_write_byte (info->f, DW_ATE_address);
+ dwarf2_write_byte (info->f, 0);
+ break;
+ }
+}
+
+static void
+dwarf2_write_variable_location (AssemblyDebugInfo *info, MonoDebugVarInfo *var)
+{
+ switch (var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS) {
+ case MONO_DEBUG_VAR_ADDRESS_MODE_STACK:
+ /*
+ * Variable is on the stack.
+ *
+ * If `index' is zero, use the normal frame register. Otherwise, bits
+ * 0..4 of `index' contain the frame register.
+ *
+ */
+
+ if (!var->index)
+ /* Use the normal frame register (%ebp on the i386). */
+ dwarf2_write_byte (info->f, DW_OP_fbreg);
+ else
+ /* Use a custom frame register. */
+ dwarf2_write_byte (info->f, DW_OP_breg0 + (var->index & 0x001f));
+ dwarf2_write_sleb128 (info->f, var->offset);
+ break;
+
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
+ /*
+ * Variable is in the register whose number is contained in bits 0..4
+ * of `index'.
+ *
+ */
+ dwarf2_write_byte (info->f, DW_OP_reg0 + (var->index & 0x001f));
+ if (var->offset) {
+ dwarf2_write_byte (info->f, DW_OP_consts);
+ dwarf2_write_sleb128 (info->f, var->offset);
+ dwarf2_write_byte (info->f, DW_OP_plus);
+ }
+ break;
+
+ case MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS:
+ /*
+ * Variable is in two registers whose numbers are in bits 0..4 and 5..9 of
+ * the `index' field.
+ */
+ dwarf2_write_byte (info->f, DW_OP_reg0 + (var->index & 0x001f));
+ dwarf2_write_byte (info->f, DW_OP_piece);
+ dwarf2_write_byte (info->f, sizeof (int));
+
+ dwarf2_write_byte (info->f, DW_OP_reg0 + ((var->index & 0x1f0) >> 5));
+ dwarf2_write_byte (info->f, DW_OP_piece);
+ dwarf2_write_byte (info->f, sizeof (int));
+
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+}
+
+static void
+dwarf2_write_parameter (AssemblyDebugInfo *info, DebugMethodInfo *minfo, const gchar *name,
+ MonoDebugVarInfo *var, MonoClass *klass)
+{
+ static long label_index = 0;
+ int type_index = mono_debug_get_type (info, klass);
+ char start [BUFSIZ], end [BUFSIZ];
+
+ sprintf (start, "DT1_%ld", ++label_index);
+ sprintf (end, "DT2_%ld", label_index);
+
+ // DW_TAG_format_parameter
+ dwarf2_write_byte (info->f, ABBREV_PARAMETER);
+ dwarf2_write_string (info->f, name);
+ if (klass->valuetype)
+ dwarf2_write_type_ref (info->f, type_index);
+ else
+ dwarf2_write_type_ptr_ref (info->f, type_index);
+ dwarf2_write_section_size (info->f, start, end);
+ dwarf2_write_label (info->f, start);
+ dwarf2_write_variable_location (info, var);
+ dwarf2_write_label (info->f, end);
+ dwarf2_write_long (info->f, minfo->method_info.prologue_end);
+}
+
+static void
+dwarf2_write_variable (AssemblyDebugInfo *info, DebugMethodInfo *minfo, const gchar *name,
+ MonoDebugVarInfo *var, MonoClass *klass)
+{
+ static long label_index = 0;
+ int type_index = mono_debug_get_type (info, klass);
+ char start [BUFSIZ], end [BUFSIZ];
+
+ sprintf (start, "DT3_%ld", ++label_index);
+ sprintf (end, "DT4_%ld", label_index);
+
+ // DW_TAG_formal_parameter
+ dwarf2_write_byte (info->f, ABBREV_LOCAL_VARIABLE);
+ dwarf2_write_string (info->f, name);
+ if (klass->valuetype)
+ dwarf2_write_type_ref (info->f, type_index);
+ else
+ dwarf2_write_type_ptr_ref (info->f, type_index);
+ dwarf2_write_section_size (info->f, start, end);
+ dwarf2_write_label (info->f, start);
+ dwarf2_write_variable_location (info, var);
+ dwarf2_write_label (info->f, end);
+ dwarf2_write_address (info->f, minfo->method_info.code_start + var->begin_scope);
+ dwarf2_write_address (info->f, minfo->method_info.code_start + var->end_scope);
+}
+
+static void
+write_method_lines_dwarf2 (AssemblyDebugInfo *info, DebugMethodInfo *minfo)
+{
+ guint32 st_line = 0;
+ gpointer st_address = 0;
+ int i;
+
+ if (!minfo->line_numbers)
+ return;
+
+ // Start of statement program
+ dwarf2_write_dw_lns_advance_line (info->f, minfo->start_line - 1);
+ dwarf2_write_dw_lne_set_address (info->f, minfo->method_info.code_start);
+ dwarf2_write_dw_lns_negate_stmt (info->f);
+ dwarf2_write_dw_lns_copy (info->f);
+
+ st_line = minfo->start_line;
+ st_address = minfo->method_info.code_start;
+
+ for (i = 1; i < minfo->line_numbers->len; i++) {
+ DebugLineNumberInfo *lni = g_ptr_array_index (minfo->line_numbers, i);
+ gint32 line_inc, addr_inc, opcode;
+ int used_standard_opcode = 0;
+
+ line_inc = lni->line - st_line;
+ addr_inc = (char *)lni->address - (char *)st_address;
+
+ if (addr_inc < 0) {
+ dwarf2_write_dw_lne_set_address (info->f, lni->address);
+ used_standard_opcode = 1;
+ } else if (addr_inc && !line_inc) {
+ dwarf2_write_dw_lns_advance_pc (info->f, addr_inc);
+ used_standard_opcode = 1;
+ }
+
+ if ((line_inc < 0) || (line_inc >= line_range)) {
+ dwarf2_write_dw_lns_advance_pc (info->f, addr_inc);
+ dwarf2_write_dw_lns_advance_line (info->f, line_inc);
+ used_standard_opcode = 1;
+ } else if (line_inc > 0) {
+ opcode = (line_inc - 1) + (line_range * addr_inc) + opcode_base;
+ g_assert (opcode >= 0);
+
+ if (opcode >= 256) {
+ dwarf2_write_dw_lns_advance_pc (info->f, addr_inc);
+ dwarf2_write_dw_lns_advance_line (info->f, line_inc);
+ used_standard_opcode = 1;
+ } else
+ dwarf2_write_byte (info->f, opcode);
+ }
+
+ if (used_standard_opcode)
+ dwarf2_write_dw_lns_copy (info->f);
+
+ st_line += line_inc;
+ st_address = (char *)st_address + addr_inc;
+ }
+
+ dwarf2_write_dw_lne_set_address (info->f,
+ (char *)minfo->method_info.code_start +
+ minfo->method_info.epilogue_begin);
+ dwarf2_write_dw_lns_advance_line (info->f, minfo->last_line - st_line);
+ dwarf2_write_dw_lns_copy (info->f);
+
+ dwarf2_write_dw_lns_copy (info->f);
+ dwarf2_write_dw_lne_end_sequence (info->f);
+}
+
+static void
+write_method_lines_func (gpointer key, gpointer value, gpointer user_data)
+{
+ write_method_lines_dwarf2 (user_data, value);
+}
+
+static void
+write_line_numbers (AssemblyDebugInfo *info)
+{
+ /* State machine registers. */
+ const char *source_file;
+ int i;
+
+ source_file = (gchar *) g_ptr_array_index (info->source_files, 0);
+
+ // Line number information.
+ dwarf2_write_section_start (info->f, "debug_line");
+ dwarf2_write_label (info->f, "debug_line_b");
+ dwarf2_write_section_size (info->f, "DL1", "debug_line_e");
+ dwarf2_write_label (info->f, "DL1");
+ dwarf2_write_2byte (info->f, 2);
+ dwarf2_write_section_size (info->f, "DL2", "DL3");
+ dwarf2_write_label (info->f, "DL2");
+ // minimum instruction length
+ dwarf2_write_byte (info->f, 1);
+ // default is statement
+ dwarf2_write_byte (info->f, 1);
+ // line base
+ dwarf2_write_byte (info->f, line_base);
+ // line range
+ dwarf2_write_byte (info->f, line_range);
+ // opcode base
+ dwarf2_write_byte (info->f, opcode_base);
+ // standard opcode sizes
+ for (i = 1; i < opcode_base; i++)
+ dwarf2_write_byte (info->f, standard_opcode_sizes [i]);
+ // include directories
+ dwarf2_write_byte (info->f, 0);
+ // file names
+ {
+ // File 0
+ dwarf2_write_string (info->f, source_file);
+ dwarf2_write_uleb128 (info->f, 0);
+ dwarf2_write_uleb128 (info->f, 0);
+ dwarf2_write_uleb128 (info->f, 0);
+ // end of list
+ dwarf2_write_byte (info->f, 0);
+ }
+ dwarf2_write_label (info->f, "DL3");
+
+ g_hash_table_foreach (info->methods, write_method_lines_func, info);
+
+ dwarf2_write_label (info->f, "debug_line_e");
+ dwarf2_write_section_end (info->f);
+}
+
+static void
+write_class_dwarf2 (AssemblyDebugInfo *info, MonoClass *klass, guint idx)
+{
+ switch (klass->byval_arg.type) {
+ case MONO_TYPE_VOID:
+ dwarf2_write_base_type (info, idx, DW_ATE_unsigned, 0, "Void");
+ break;
+ case MONO_TYPE_BOOLEAN:
+ dwarf2_write_base_type (info, idx, DW_ATE_boolean, 1, "Boolean");
+ break;
+ case MONO_TYPE_CHAR:
+ dwarf2_write_base_type (info, idx, DW_ATE_unsigned_char, 2, "Char");
+ break;
+ case MONO_TYPE_I1:
+ dwarf2_write_base_type (info, idx, DW_ATE_signed, 1, "SByte");
+ break;
+ case MONO_TYPE_U1:
+ dwarf2_write_base_type (info, idx, DW_ATE_unsigned, 1, "Byte");
+ break;
+ case MONO_TYPE_I2:
+ dwarf2_write_base_type (info, idx, DW_ATE_signed, 2, "Int16");
+ break;
+ case MONO_TYPE_U2:
+ dwarf2_write_base_type (info, idx, DW_ATE_unsigned, 2, "UInt16");
+ break;
+ case MONO_TYPE_I4:
+ dwarf2_write_base_type (info, idx, DW_ATE_signed, 4, "Int32");
+ break;
+ case MONO_TYPE_U4:
+ dwarf2_write_base_type (info, idx, DW_ATE_unsigned, 4, "UInt32");
+ break;
+ case MONO_TYPE_I8:
+ dwarf2_write_base_type (info, idx, DW_ATE_signed, 8, "Int64");
+ break;
+ case MONO_TYPE_U8:
+ dwarf2_write_base_type (info, idx, DW_ATE_unsigned, 8, "UInt64");
+ break;
+ case MONO_TYPE_R4:
+ dwarf2_write_base_type (info, idx, DW_ATE_float, 4, "Float");
+ break;
+ case MONO_TYPE_R8:
+ dwarf2_write_base_type (info, idx, DW_ATE_float, 8, "Double");
+ break;
+ default:
+ dwarf2_write_class (info, klass, idx);
+ break;
+ }
+}
+
+static void
+write_class (gpointer key, gpointer value, gpointer user_data)
+{
+ write_class_dwarf2 (user_data, key, GPOINTER_TO_INT (value));
+}
+
+static void
+write_method_dwarf2 (AssemblyDebugInfo *info, DebugMethodInfo *minfo)
+{
+ int is_external = 0, i;
+ MonoType *ret_type = NULL;
+ gchar **names;
+
+ if (minfo->method_info.method->signature->ret->type != MONO_TYPE_VOID)
+ ret_type = minfo->method_info.method->signature->ret;
+
+ // DW_TAG_subprogram
+ if (ret_type)
+ dwarf2_write_byte (info->f, ABBREV_SUBPROGRAM_RETVAL);
+ else
+ dwarf2_write_byte (info->f, ABBREV_SUBPROGRAM);
+ dwarf2_write_string (info->f, minfo->name);
+ dwarf2_write_byte (info->f, is_external);
+ dwarf2_write_address (info->f, minfo->method_info.code_start);
+ dwarf2_write_address (info->f, (char *)minfo->method_info.code_start + minfo->method_info.code_size);
+ dwarf2_write_byte (info->f, DW_CC_nocall);
+ if (ret_type) {
+ MonoClass *klass = mono_class_from_mono_type (ret_type);
+ int type_index = mono_debug_get_type (info, klass);
+ dwarf2_write_type_ref (info->f, type_index);
+ }
+
+ if (minfo->method_info.method->signature->hasthis)
+ dwarf2_write_parameter (info, minfo, "this", minfo->method_info.this_var,
+ minfo->method_info.method->klass);
+
+ names = g_new (char *, minfo->method_info.method->signature->param_count);
+ mono_method_get_param_names (minfo->method_info.method, (const char **) names);
+
+ for (i = 0; i < minfo->method_info.num_params; i++) {
+ MonoType *type = minfo->method_info.method->signature->params [i];
+ MonoClass *klass = mono_class_from_mono_type (type);
+
+ dwarf2_write_parameter (info, minfo, names [i], &minfo->method_info.params [i], klass);
+ }
+
+ g_free (names);
+
+ for (i = 0; i < minfo->method_info.num_locals; i++) {
+ MonoMethodHeader *header = ((MonoMethodNormal*) minfo->method_info.method)->header;
+ MonoClass *klass = mono_class_from_mono_type (header->locals [i]);
+ char name [BUFSIZ];
+
+ sprintf (name, "V_%d", i);
+ dwarf2_write_variable (info, minfo, name, &minfo->method_info.locals [i], klass);
+ }
+
+ dwarf2_write_byte (info->f, 0);
+ // DW_TAG_subprogram ends here
+}
+
+static void
+write_method_func (gpointer key, gpointer value, gpointer user_data)
+{
+ write_method_dwarf2 (user_data, value);
+}
+
+void
+mono_debug_write_assembly_dwarf2 (AssemblyDebugInfo *info)
+{
+ gchar *source_file = g_ptr_array_index (info->source_files, 0);
+ char *buf;
+
+ if (!(info->f = fopen (info->filename, "w")))
+ return;
+
+ // DWARF 2 Abbreviation table.
+ dwarf2_write_section_start (info->f, "debug_abbrev");
+ dwarf2_write_label (info->f, "debug_abbrev");
+
+ dwarf2_write_byte (info->f, ABBREV_COMPILE_UNIT);
+ dwarf2_write_byte (info->f, DW_TAG_compile_unit);
+ dwarf2_write_byte (info->f, DW_CHILDREN_yes);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_language, DW_FORM_data2);
+ dwarf2_write_pair (info->f, DW_AT_producer, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_stmt_list, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_SUBPROGRAM);
+ dwarf2_write_byte (info->f, DW_TAG_subprogram);
+ dwarf2_write_byte (info->f, DW_CHILDREN_yes);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_external, DW_FORM_flag);
+ dwarf2_write_pair (info->f, DW_AT_low_pc, DW_FORM_addr);
+ dwarf2_write_pair (info->f, DW_AT_high_pc, DW_FORM_addr);
+ dwarf2_write_pair (info->f, DW_AT_calling_convention, DW_FORM_data1);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_SUBPROGRAM_RETVAL);
+ dwarf2_write_byte (info->f, DW_TAG_subprogram);
+ dwarf2_write_byte (info->f, DW_CHILDREN_yes);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_external, DW_FORM_flag);
+ dwarf2_write_pair (info->f, DW_AT_low_pc, DW_FORM_addr);
+ dwarf2_write_pair (info->f, DW_AT_high_pc, DW_FORM_addr);
+ dwarf2_write_pair (info->f, DW_AT_calling_convention, DW_FORM_data1);
+ dwarf2_write_pair (info->f, DW_AT_type, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_BASE_TYPE);
+ dwarf2_write_byte (info->f, DW_TAG_base_type);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_encoding, DW_FORM_data1);
+ dwarf2_write_pair (info->f, DW_AT_byte_size, DW_FORM_data1);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_FORMAL_PARAMETER);
+ dwarf2_write_byte (info->f, DW_TAG_formal_parameter);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_type, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_ARTIFICIAL_PARAMETER);
+ dwarf2_write_byte (info->f, DW_TAG_formal_parameter);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_type, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, DW_AT_artificial, DW_FORM_data1);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_PARAMETER);
+ dwarf2_write_byte (info->f, DW_TAG_formal_parameter);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_type, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, DW_AT_location, DW_FORM_block4);
+ dwarf2_write_pair (info->f, DW_AT_start_scope, DW_FORM_data4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_LOCAL_VARIABLE);
+ dwarf2_write_byte (info->f, DW_TAG_variable);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_type, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, DW_AT_location, DW_FORM_block4);
+ dwarf2_write_pair (info->f, DW_AT_start_scope, DW_FORM_addr);
+ dwarf2_write_pair (info->f, DW_AT_end_scope, DW_FORM_addr);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_TYPE);
+ dwarf2_write_byte (info->f, DW_TAG_structure_type);
+ dwarf2_write_byte (info->f, DW_CHILDREN_yes);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_byte_size, DW_FORM_data4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_MEMBER);
+ dwarf2_write_byte (info->f, DW_TAG_member);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_type, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, DW_AT_accessibility, DW_FORM_data1);
+ dwarf2_write_pair (info->f, DW_AT_data_member_location, DW_FORM_block4);
+ dwarf2_write_pair (info->f, DW_AT_byte_size, DW_FORM_data4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_STRUCT_ACCESS);
+ dwarf2_write_byte (info->f, DW_TAG_access_declaration);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_accessibility, DW_FORM_data1);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_ENUM_TYPE);
+ dwarf2_write_byte (info->f, DW_TAG_enumeration_type);
+ dwarf2_write_byte (info->f, DW_CHILDREN_yes);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_byte_size, DW_FORM_data4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE);
+ dwarf2_write_byte (info->f, DW_TAG_enumerator);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_const_value, DW_FORM_data4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE_UNSIGNED);
+ dwarf2_write_byte (info->f, DW_TAG_enumerator);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_const_value, DW_FORM_udata);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_ENUM_VALUE_SIGNED);
+ dwarf2_write_byte (info->f, DW_TAG_enumerator);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_const_value, DW_FORM_sdata);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_CLASS_TYPE);
+ dwarf2_write_byte (info->f, DW_TAG_class_type);
+ dwarf2_write_byte (info->f, DW_CHILDREN_yes);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_byte_size, DW_FORM_data4);
+ dwarf2_write_pair (info->f, DW_AT_accessibility, DW_FORM_data1);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_CLASS_INHERITANCE);
+ dwarf2_write_byte (info->f, DW_TAG_inheritance);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_type, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, DW_AT_accessibility, DW_FORM_data1);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_POINTER_TYPE);
+ dwarf2_write_byte (info->f, DW_TAG_pointer_type);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_type, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_CLASS_METHOD);
+ dwarf2_write_byte (info->f, DW_TAG_subprogram);
+ dwarf2_write_byte (info->f, DW_CHILDREN_yes);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_accessibility, DW_FORM_data1);
+ dwarf2_write_pair (info->f, DW_AT_virtuality, DW_FORM_data1);
+ dwarf2_write_pair (info->f, DW_AT_calling_convention, DW_FORM_data1);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_CLASS_METHOD_RETVAL);
+ dwarf2_write_byte (info->f, DW_TAG_subprogram);
+ dwarf2_write_byte (info->f, DW_CHILDREN_yes);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_accessibility, DW_FORM_data1);
+ dwarf2_write_pair (info->f, DW_AT_virtuality, DW_FORM_data1);
+ dwarf2_write_pair (info->f, DW_AT_calling_convention, DW_FORM_data1);
+ dwarf2_write_pair (info->f, DW_AT_type, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_SIMPLE_ARRAY);
+ dwarf2_write_byte (info->f, DW_TAG_array_type);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_type, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_ARRAY);
+ dwarf2_write_byte (info->f, DW_TAG_array_type);
+ dwarf2_write_byte (info->f, DW_CHILDREN_yes);
+ dwarf2_write_pair (info->f, DW_AT_name, DW_FORM_string);
+ dwarf2_write_pair (info->f, DW_AT_type, DW_FORM_ref4);
+ dwarf2_write_pair (info->f, DW_AT_byte_size, DW_FORM_data4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_byte (info->f, ABBREV_SUBRANGE);
+ dwarf2_write_byte (info->f, DW_TAG_subrange_type);
+ dwarf2_write_byte (info->f, DW_CHILDREN_no);
+ dwarf2_write_pair (info->f, DW_AT_lower_bound, DW_FORM_data4);
+ dwarf2_write_pair (info->f, DW_AT_upper_bound, DW_FORM_data4);
+ dwarf2_write_pair (info->f, DW_AT_count, DW_FORM_data4);
+ dwarf2_write_pair (info->f, 0, 0);
+
+ dwarf2_write_label (info->f, "debug_abbrev_e");
+ dwarf2_write_section_end (info->f);
+
+ // Line numbers
+ write_line_numbers (info);
+
+ // Compile unit header
+ dwarf2_write_section_start (info->f, "debug_info");
+ dwarf2_write_label (info->f, "debug_info_b");
+ dwarf2_write_section_size (info->f, "DI1", "debug_info_e");
+ dwarf2_write_label (info->f, "DI1");
+ dwarf2_write_2byte (info->f, 2);
+ dwarf2_write_ref4 (info->f, "debug_abbrev_b");
+ dwarf2_write_byte (info->f, sizeof (gpointer));
+
+ // DW_TAG_compile_unit
+ dwarf2_write_byte (info->f, ABBREV_COMPILE_UNIT);
+ dwarf2_write_string (info->f, source_file);
+ dwarf2_write_2byte (info->f, DW_LANG_C_sharp);
+ dwarf2_write_string (info->f, info->producer_name);
+ dwarf2_write_ref4 (info->f, "debug_lines_b");
+
+ // Methods
+ g_hash_table_foreach (info->methods, write_method_func, info);
+
+ // Derived types
+ g_hash_table_foreach (info->type_hash, write_class, info);
+
+ dwarf2_write_byte (info->f, 0);
+ // DW_TAG_compile_unit ends here
+
+ dwarf2_write_label (info->f, "debug_info_e");
+
+ dwarf2_write_section_end (info->f);
+
+ fclose (info->f);
+ info->f = NULL;
+
+ /* yes, it's completely unsafe */
+ buf = g_strdup_printf ("as %s -o /tmp/%s.o", info->filename, info->name);
+ system (buf);
+ g_free (buf);
+}
diff --git a/mono/jit/debug-private.h b/mono/jit/debug-private.h
new file mode 100644
index 00000000000..9cb4ef0f205
--- /dev/null
+++ b/mono/jit/debug-private.h
@@ -0,0 +1,73 @@
+#ifndef __MONO_JIT_DEBUG_PRIVATE_H__
+#define __MONO_JIT_DEBUG_PRIVATE_H__
+
+#include <mono/metadata/debug-symfile.h>
+
+#include "debug.h"
+
+typedef struct {
+ gpointer address;
+ guint32 line;
+ int is_basic_block;
+ int source_file;
+} DebugLineNumberInfo;
+
+typedef struct _AssemblyDebugInfo AssemblyDebugInfo;
+
+typedef struct {
+ MonoDebugMethodInfo method_info;
+ gchar *name;
+ int source_file;
+ guint32 method_number;
+ guint32 start_line;
+ guint32 first_line;
+ guint32 last_line;
+ GPtrArray *line_numbers;
+} DebugMethodInfo;
+
+struct _AssemblyDebugInfo {
+ FILE *f;
+ char *filename;
+ char *name;
+ char *producer_name;
+ int total_lines;
+ int *mlines;
+ int *moffsets;
+ int nmethods;
+ int next_idx;
+ MonoImage *image;
+ GHashTable *methods;
+ GHashTable *type_hash;
+ int next_klass_idx;
+ GPtrArray *source_files;
+ MonoDebugFormat format;
+ gpointer _priv;
+};
+
+struct _MonoDebugHandle {
+ char *name;
+ MonoDebugFormat default_format;
+ GList *info;
+};
+
+guint32 mono_debug_get_type (AssemblyDebugInfo* info, MonoClass *klass);
+
+void mono_debug_open_assembly_stabs (AssemblyDebugInfo *info);
+
+void mono_debug_open_assembly_dwarf2 (AssemblyDebugInfo *info);
+
+void mono_debug_open_assembly_dwarf2_plus (AssemblyDebugInfo *info);
+
+void mono_debug_write_assembly_stabs (AssemblyDebugInfo *info);
+
+void mono_debug_write_assembly_dwarf2 (AssemblyDebugInfo *info);
+
+void mono_debug_write_assembly_dwarf2_plus (AssemblyDebugInfo *info);
+
+void mono_debug_close_assembly_stabs (AssemblyDebugInfo *info);
+
+void mono_debug_close_assembly_dwarf2 (AssemblyDebugInfo *info);
+
+void mono_debug_close_assembly_dwarf2_plus (AssemblyDebugInfo *info);
+
+#endif /* __MONO_JIT_DEBUG_PRIVATE_H__ */
diff --git a/mono/jit/debug-stabs.c b/mono/jit/debug-stabs.c
new file mode 100644
index 00000000000..270e181770f
--- /dev/null
+++ b/mono/jit/debug-stabs.c
@@ -0,0 +1,213 @@
+#include <stdlib.h>
+#include <string.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/jit/codegen.h>
+#include <mono/jit/debug.h>
+
+#include "debug-private.h"
+
+typedef struct {
+ const char *name;
+ const char *spec;
+} BaseTypes;
+
+/*
+ * Not 64 bit clean.
+ * Note: same order of MonoTypeEnum.
+ */
+static BaseTypes
+base_types[] = {
+ {"", NULL},
+ {"Void", "(0,1)"},
+ {"Boolean", ";0;255;"},
+ {"Char", ";0;65535;"},
+ {"SByte", ";-128;127;"},
+ {"Byte", ";0;255;"},
+ {"Int16", ";-32768;32767;"},
+ {"UInt16", ";0;65535;"},
+ {"Int32", ";0020000000000;0017777777777;"},
+ {"UInt32", ";0000000000000;0037777777777;"},
+ {"Int64", ";01000000000000000000000;0777777777777777777777;"},
+ {"UInt64", ";0000000000000;01777777777777777777777;"},
+ {"Single", "r(0,8);4;0;"},
+ {"Double", "r(0,8);8;0;"},
+ {"String", "(0,41)=*(0,42)=xsMonoString:"}, /*string*/
+ {"", }, /*ptr*/
+ {"", }, /*byref*/
+ {"", }, /*valuetype*/
+ {"Class", "(0,44)=*(0,45)=xsMonoObject:"}, /*class*/
+ {"", }, /*unused*/
+ {"Array", }, /*array*/
+ {"", }, /*typedbyref*/
+ {"", }, /*unused*/
+ {"", }, /*unused*/
+ {"IntPtr", ";0020000000000;0017777777777;"},
+ {"UIntPtr", ";0000000000000;0037777777777;"},
+ {"", }, /*unused*/
+ {"FnPtr", "*(0,1)"}, /*fnptr*/
+ {"Object", "(0,47)=*(0,48)=xsMonoObject:"}, /*object*/
+ {"SzArray", "(0,50)=*(0,51))=xsMonoArray:"}, /*szarray*/
+ {NULL, NULL}
+};
+
+void
+mono_debug_open_assembly_stabs (AssemblyDebugInfo* info)
+{
+}
+
+void
+mono_debug_close_assembly_stabs (AssemblyDebugInfo* info)
+{
+}
+
+static void
+write_method_stabs (AssemblyDebugInfo *info, DebugMethodInfo *minfo)
+{
+ int i;
+ MonoMethod *method = minfo->method_info.method;
+ MonoClass *klass = method->klass;
+ MonoMethodSignature *sig = method->signature;
+ char **names = g_new (char*, sig->param_count);
+
+ fprintf (info->f, ".stabs \"%s:F(0,%d)\",36,0,%d,%p\n", minfo->name, sig->ret->type,
+ minfo->start_line, minfo->method_info.code_start);
+
+ /* params */
+ mono_method_get_param_names (method, (const char **)names);
+ if (sig->hasthis)
+ fprintf (info->f, ".stabs \"this:p(0,%d)=(0,%d)\",160,0,%d,%d\n",
+ info->next_idx++, klass->byval_arg.type, minfo->start_line,
+ minfo->method_info.this_var->offset);
+ for (i = 0; i < minfo->method_info.num_params; i++) {
+ int stack_offset = minfo->method_info.params [i].offset;
+
+ fprintf (info->f, ".stabs \"%s:p(0,%d)=(0,%d)\",160,0,%d,%d\n",
+ names [i], info->next_idx++, sig->params [i]->type,
+ minfo->start_line, stack_offset);
+ }
+
+ /* local vars */
+ for (i = 0; i < minfo->method_info.num_locals; ++i) {
+ MonoMethodHeader *header = ((MonoMethodNormal*)method)->header;
+ int stack_offset = minfo->method_info.locals [i].offset;
+
+ fprintf (info->f, ".stabs \"local_%d:(0,%d)=(0,%d)\",128,0,%d,%d\n",
+ i, info->next_idx++, header->locals [i]->type, minfo->start_line, stack_offset);
+ }
+
+ if (minfo->line_numbers) {
+ fprintf (info->f, ".stabn 68,0,%d,%d\n", minfo->start_line, 0);
+ fprintf (info->f, ".stabn 68,0,%d,%d\n", minfo->first_line, minfo->method_info.prologue_end);
+
+ for (i = 1; i < minfo->line_numbers->len; i++) {
+ DebugLineNumberInfo *lni = g_ptr_array_index (minfo->line_numbers, i);
+
+ fprintf (info->f, ".stabn 68,0,%d,%d\n", lni->line,
+ (char *)lni->address - minfo->method_info.code_start);
+ }
+
+ fprintf (info->f, ".stabn 68,0,%d,%d\n", minfo->last_line, minfo->method_info.epilogue_begin);
+ }
+
+ /* end of function */
+ fprintf (info->f, ".stabs \"\",36,0,0,%d\n", minfo->method_info.code_size);
+
+ g_free (names);
+ fflush (info->f);
+}
+
+static void
+get_enumvalue (MonoClass *klass, int idx, char *buf)
+{
+ guint32 const_cols [MONO_CONSTANT_SIZE];
+ const char *ptr;
+ guint32 crow = mono_metadata_get_constant_index (klass->image, MONO_TOKEN_FIELD_DEF | (idx + 1));
+
+ if (!crow) {
+ buf [0] = '0';
+ buf [1] = 0;
+ return;
+ }
+ mono_metadata_decode_row (&klass->image->tables [MONO_TABLE_CONSTANT], crow-1, const_cols, MONO_CONSTANT_SIZE);
+ ptr = mono_metadata_blob_heap (klass->image, const_cols [MONO_CONSTANT_VALUE]);
+ switch (const_cols [MONO_CONSTANT_TYPE]) {
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ /* FIXME: add other types... */
+ default:
+ g_snprintf (buf, 64, "%d", *(gint32*)ptr);
+ }
+}
+
+static void
+write_method_func (gpointer key, gpointer value, gpointer user_data)
+{
+ write_method_stabs (user_data, value);
+}
+
+static void
+write_class_stabs (AssemblyDebugInfo *info, MonoClass *klass, int idx)
+{
+ char *name;
+ int i;
+ char buf [64];
+
+ /* output enums ...*/
+ if (klass->enumtype) {
+ name = g_strdup_printf ("%s%s%s", klass->name_space, klass->name_space [0]? "_": "", klass->name);
+ fprintf (info->f, ".stabs \"%s:T%d=e", name, ++info->next_idx);
+ g_free (name);
+ for (i = 0; i < klass->field.count; ++i) {
+ if (klass->fields [i].type->attrs & FIELD_ATTRIBUTE_LITERAL) {
+ get_enumvalue (klass, klass->field.first + i, buf);
+ fprintf (info->f, "%s_%s=%s,", klass->name, klass->fields [i].name, buf);
+ }
+ }
+ fprintf (info->f, ";\",128,0,0,0\n");
+ }
+ fflush (info->f);
+}
+
+static void
+write_class (gpointer key, gpointer value, gpointer user_data)
+{
+ write_class_stabs (user_data, key, GPOINTER_TO_INT (value));
+}
+
+void
+mono_debug_write_assembly_stabs (AssemblyDebugInfo* info)
+{
+ char *buf;
+ int i;
+
+ if (!(info->f = fopen (info->filename, "w")))
+ return;
+
+ fprintf (info->f, ".stabs \"%s.il\",100,0,0,0\n", info->name);
+
+ for (i = 0; base_types [i].name; ++i) {
+ if (! base_types [i].spec)
+ continue;
+ fprintf (info->f, ".stabs \"%s:t(0,%d)=", base_types [i].name, i);
+ if (base_types [i].spec [0] == ';') {
+ fprintf (info->f, "r(0,%d)%s\"", i, base_types [i].spec);
+ } else {
+ fprintf (info->f, "%s\"", base_types [i].spec);
+ }
+ fprintf (info->f, ",128,0,0,0\n");
+ }
+
+ g_hash_table_foreach (info->methods, write_method_func, info);
+
+ g_hash_table_foreach (info->type_hash, write_class, info);
+
+ fclose (info->f);
+ info->f = NULL;
+
+ /* yes, it's completely unsafe */
+ buf = g_strdup_printf ("as %s -o /tmp/%s.o", info->filename, info->name);
+ system (buf);
+ g_free (buf);
+}
diff --git a/mono/jit/debug.c b/mono/jit/debug.c
new file mode 100644
index 00000000000..5a085ba6e97
--- /dev/null
+++ b/mono/jit/debug.c
@@ -0,0 +1,513 @@
+#include <stdlib.h>
+#include <string.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/jit/codegen.h>
+#include <mono/jit/debug.h>
+
+#include "debug-private.h"
+
+MonoDebugHandle*
+mono_debug_open_file (const char *filename, MonoDebugFormat format)
+{
+ MonoDebugHandle *debug;
+
+ debug = g_new0 (MonoDebugHandle, 1);
+ debug->name = g_strdup (filename);
+ debug->default_format = format;
+ return debug;
+}
+
+static void
+debug_load_method_lines (AssemblyDebugInfo* info)
+{
+ FILE *f;
+ char buf [1024];
+ int i, mnum;
+ char *name = g_strdup_printf ("%s.il", info->name);
+ int offset = -1;
+
+ /* use an env var with directories for searching. */
+ if (!(f = fopen (name, "r"))) {
+ g_warning ("cannot open IL assembly file %s", name);
+ g_free (name);
+ return;
+ }
+
+ info->total_lines = 100;
+ info->moffsets = g_malloc (info->total_lines * sizeof (int));
+
+ g_free (name);
+ i = 0;
+ while (fgets (buf, sizeof (buf), f)) {
+ int pos = i;
+
+ info->moffsets [i++] = offset;
+ if (i + 2 >= info->total_lines) {
+ info->total_lines += 100;
+ info->moffsets = g_realloc (info->moffsets, info->total_lines * sizeof (int));
+ g_assert (info->moffsets);
+ }
+
+ if (!sscanf (buf, " // method line %d", &mnum))
+ continue;
+
+ offset = 0;
+
+ if (mnum >= info->nmethods)
+ break;
+
+ while (fgets (buf, sizeof (buf), f)) {
+ int newoffset;
+
+ ++i;
+ if (i + 2 >= info->total_lines) {
+ info->total_lines += 100;
+ info->moffsets = g_realloc (info->moffsets, info->total_lines * sizeof (int));
+ g_assert (info->moffsets);
+ }
+
+ if (strstr (buf, "}")) {
+ offset = -1;
+ break;
+ }
+
+ if (sscanf (buf, " IL_%x:", &newoffset)) {
+ offset = newoffset;
+ if (!offset)
+ pos = i;
+ }
+
+ info->moffsets [i] = offset;
+ }
+ /* g_print ("method %d found at %d\n", mnum, pos); */
+ info->mlines [mnum] = pos;
+ }
+ fclose (f);
+}
+
+static void
+record_line_number (DebugMethodInfo *minfo, gpointer address, guint32 line, int is_basic_block)
+{
+ DebugLineNumberInfo *lni = g_new0 (DebugLineNumberInfo, 1);
+
+ lni->address = address;
+ lni->line = line;
+ lni->is_basic_block = is_basic_block;
+ lni->source_file = 0;
+
+ g_ptr_array_add (minfo->line_numbers, lni);
+}
+
+static void
+record_il_offset (GPtrArray *array, guint32 offset, guint32 address)
+{
+ MonoDebugILOffsetInfo *info = g_new0 (MonoDebugILOffsetInfo, 1);
+
+ info->offset = offset;
+ info->address = address;
+
+ g_ptr_array_add (array, info);
+}
+
+static void
+debug_generate_method_lines (AssemblyDebugInfo *info, DebugMethodInfo *minfo, MonoFlowGraph* cfg)
+{
+ guint32 st_address, st_line;
+ GPtrArray *il_offsets;
+ int i;
+
+ il_offsets = g_ptr_array_new ();
+ minfo->line_numbers = g_ptr_array_new ();
+
+ st_line = minfo->first_line;
+ st_address = minfo->method_info.prologue_end;
+
+ /* record_line_number takes absolute memory addresses. */
+ record_line_number (minfo, minfo->method_info.code_start, minfo->start_line, FALSE);
+ /* record_il_offsets uses offsets relative to minfo->method_info.code_start. */
+ record_il_offset (il_offsets, 0, st_address);
+
+ /* This is the first actual code line of the method. */
+ record_line_number (minfo, minfo->method_info.code_start + st_address, st_line, TRUE);
+
+ /* start lines of basic blocks */
+ for (i = 0; i < cfg->block_count; ++i) {
+ int j;
+
+ for (j = 0; cfg->bblocks [i].forest && (j < cfg->bblocks [i].forest->len); ++j) {
+ MBTree *t = (MBTree *) g_ptr_array_index (cfg->bblocks [i].forest, j);
+ gint32 line_inc = 0, addr_inc;
+
+ if (!i && !j) {
+ st_line = minfo->first_line;
+ st_address = t->addr - 1;
+
+ record_line_number (minfo, cfg->start + st_address, st_line, TRUE);
+ }
+
+ addr_inc = t->addr - st_address - 1;
+ st_address += addr_inc;
+
+ if (t->cli_addr != -1)
+ record_il_offset (il_offsets, t->cli_addr, st_address);
+
+ if (!info->moffsets)
+ continue;
+
+
+ if (t->cli_addr != -1) {
+ int *lines = info->moffsets + st_line;
+ int *k = lines;
+
+ while ((*k != -1) && (*k < t->cli_addr))
+ k++;
+
+ line_inc = k - lines;
+ }
+
+ st_line += line_inc;
+
+ record_line_number (minfo, minfo->method_info.code_start + st_address,
+ st_line, j == 0);
+ }
+ }
+
+ minfo->method_info.num_il_offsets = il_offsets->len;
+ minfo->method_info.il_offsets = g_new0 (MonoDebugILOffsetInfo, il_offsets->len);
+ for (i = 0; i < il_offsets->len; i++) {
+ MonoDebugILOffsetInfo *il = (MonoDebugILOffsetInfo *) g_ptr_array_index (il_offsets, i);
+
+ minfo->method_info.il_offsets [i] = *il;
+ }
+
+ g_ptr_array_free (il_offsets, TRUE);
+}
+
+static void
+free_method_info (DebugMethodInfo *minfo)
+{
+ if (minfo->line_numbers)
+ g_ptr_array_free (minfo->line_numbers, TRUE);
+ g_free (minfo->method_info.params);
+ g_free (minfo->method_info.locals);
+ g_free (minfo);
+}
+
+static AssemblyDebugInfo*
+mono_debug_open_assembly (MonoDebugHandle* handle, MonoImage *image)
+{
+ GList *tmp;
+ AssemblyDebugInfo* info;
+
+ for (tmp = handle->info; tmp; tmp = tmp->next) {
+ info = (AssemblyDebugInfo*)tmp->data;
+ if (strcmp (info->name, image->assembly_name) == 0)
+ return info;
+ }
+ info = g_new0 (AssemblyDebugInfo, 1);
+ info->format = handle->default_format;
+ switch (handle->default_format) {
+ case MONO_DEBUG_FORMAT_STABS:
+ info->filename = g_strdup_printf ("%s-stabs.s", image->assembly_name);
+ break;
+ case MONO_DEBUG_FORMAT_DWARF2:
+ info->filename = g_strdup_printf ("%s-dwarf.s", image->assembly_name);
+ break;
+ case MONO_DEBUG_FORMAT_DWARF2_PLUS:
+ info->filename = g_strdup_printf ("%s-debug.o", image->assembly_name);
+
+ g_message (G_STRLOC ": %s - %s", image->assembly_name, image->name);
+
+ /* Fall back to dwarf if we can't find the symbol file. */
+ if (!g_file_test (info->filename, G_FILE_TEST_EXISTS)) {
+ gchar *fname = g_strdup_printf ("%s-dwarf.s", image->assembly_name);
+
+ if (g_file_test (fname, G_FILE_TEST_EXISTS)) {
+ g_warning ("Can't open symbol file `%s', falling back to DWARF 2.",
+ info->filename);
+ g_free (info->filename);
+ info->filename = fname;
+ info->format = MONO_DEBUG_FORMAT_DWARF2;
+ } else
+ g_free (fname);
+ }
+
+ break;
+ }
+ info->image = image;
+ info->image->ref_count++;
+ info->name = g_strdup (image->assembly_name);
+ info->methods = g_hash_table_new_full (g_direct_hash, g_direct_equal,
+ NULL, (GDestroyNotify) free_method_info);
+ info->source_files = g_ptr_array_new ();
+ info->type_hash = g_hash_table_new (NULL, NULL);
+
+ g_ptr_array_add (info->source_files, g_strdup_printf ("%s.il", image->assembly_name));
+ info->producer_name = g_strdup_printf ("Mono JIT compiler version %s", VERSION);
+
+ mono_debug_get_type (info, mono_defaults.void_class);
+ mono_debug_get_type (info, mono_defaults.object_class);
+ mono_debug_get_type (info, mono_defaults.void_class);
+ mono_debug_get_type (info, mono_defaults.boolean_class);
+ mono_debug_get_type (info, mono_defaults.char_class);
+ mono_debug_get_type (info, mono_defaults.sbyte_class);
+ mono_debug_get_type (info, mono_defaults.byte_class);
+ mono_debug_get_type (info, mono_defaults.int16_class);
+ mono_debug_get_type (info, mono_defaults.uint16_class);
+ mono_debug_get_type (info, mono_defaults.int32_class);
+ mono_debug_get_type (info, mono_defaults.uint32_class);
+ mono_debug_get_type (info, mono_defaults.int_class);
+ mono_debug_get_type (info, mono_defaults.uint_class);
+ mono_debug_get_type (info, mono_defaults.int64_class);
+ mono_debug_get_type (info, mono_defaults.uint64_class);
+ mono_debug_get_type (info, mono_defaults.single_class);
+ mono_debug_get_type (info, mono_defaults.double_class);
+ mono_debug_get_type (info, mono_defaults.string_class);
+
+ switch (info->format) {
+ case MONO_DEBUG_FORMAT_STABS:
+ mono_debug_open_assembly_stabs (info);
+ break;
+ case MONO_DEBUG_FORMAT_DWARF2:
+ mono_debug_open_assembly_dwarf2 (info);
+ break;
+ case MONO_DEBUG_FORMAT_DWARF2_PLUS:
+ mono_debug_open_assembly_dwarf2_plus (info);
+ break;
+ }
+
+ info->next_idx = 100;
+ handle->info = g_list_prepend (handle->info, info);
+
+ info->nmethods = image->tables [MONO_TABLE_METHOD].rows + 1;
+ info->mlines = g_new0 (int, info->nmethods);
+
+ if (info->format != MONO_DEBUG_FORMAT_DWARF2_PLUS)
+ debug_load_method_lines (info);
+
+ return info;
+}
+
+void
+mono_debug_make_symbols (void)
+{
+ GList *tmp;
+ AssemblyDebugInfo* info;
+
+ if (!mono_debug_handle)
+ return;
+
+ for (tmp = mono_debug_handle->info; tmp; tmp = tmp->next) {
+ info = (AssemblyDebugInfo*)tmp->data;
+
+ switch (info->format) {
+ case MONO_DEBUG_FORMAT_STABS:
+ mono_debug_write_assembly_stabs (info);
+ break;
+ case MONO_DEBUG_FORMAT_DWARF2:
+ mono_debug_write_assembly_dwarf2 (info);
+ break;
+ case MONO_DEBUG_FORMAT_DWARF2_PLUS:
+ mono_debug_write_assembly_dwarf2_plus (info);
+ break;
+ }
+ }
+}
+
+static void
+mono_debug_close_assembly (AssemblyDebugInfo* info)
+{
+ g_free (info->mlines);
+ g_free (info->moffsets);
+ g_free (info->name);
+ g_free (info->filename);
+ g_ptr_array_free (info->source_files, TRUE);
+ g_hash_table_destroy (info->type_hash);
+ g_hash_table_destroy (info->methods);
+ g_free (info->producer_name);
+ g_free (info);
+}
+
+void
+mono_debug_close (MonoDebugHandle* debug)
+{
+ GList *tmp;
+ AssemblyDebugInfo* info;
+
+ mono_debug_make_symbols ();
+
+ for (tmp = debug->info; tmp; tmp = tmp->next) {
+ info = (AssemblyDebugInfo*)tmp->data;
+
+ switch (info->format) {
+ case MONO_DEBUG_FORMAT_STABS:
+ mono_debug_close_assembly_stabs (info);
+ break;
+ case MONO_DEBUG_FORMAT_DWARF2:
+ mono_debug_close_assembly_dwarf2 (info);
+ break;
+ case MONO_DEBUG_FORMAT_DWARF2_PLUS:
+ mono_debug_close_assembly_dwarf2_plus (info);
+ break;
+ }
+
+ mono_debug_close_assembly (info);
+ }
+
+ g_free (debug->name);
+ g_free (debug);
+}
+
+guint32
+mono_debug_get_type (AssemblyDebugInfo* info, MonoClass *klass)
+{
+ guint index, i;
+
+ mono_class_init (klass);
+
+ index = GPOINTER_TO_INT (g_hash_table_lookup (info->type_hash, klass));
+ if (index)
+ return index;
+
+ index = ++info->next_klass_idx;
+ g_hash_table_insert (info->type_hash, klass, GINT_TO_POINTER (index));
+
+ if (klass->enumtype)
+ return index;
+
+ switch (klass->byval_arg.type) {
+ case MONO_TYPE_CLASS:
+ if (klass->parent)
+ mono_debug_get_type (info, klass->parent);
+
+ for (i = 0; i < klass->method.count; i++) {
+ MonoMethod *method = klass->methods [i];
+ MonoType *ret_type = NULL;
+ int j;
+
+ if (method->signature->ret->type != MONO_TYPE_VOID)
+ ret_type = method->signature->ret;
+
+ if (ret_type) {
+ MonoClass *ret_klass = mono_class_from_mono_type (ret_type);
+ mono_debug_get_type (info, ret_klass);
+ }
+
+ for (j = 0; j < method->signature->param_count; j++) {
+ MonoType *sub_type = method->signature->params [j];
+ MonoClass *sub_klass = mono_class_from_mono_type (sub_type);
+ mono_debug_get_type (info, sub_klass);
+ }
+ }
+ // fall through
+ case MONO_TYPE_VALUETYPE:
+ for (i = 0; i < klass->field.count; i++) {
+ MonoClass *subclass = mono_class_from_mono_type (klass->fields [i].type);
+ mono_debug_get_type (info, subclass);
+ }
+ break;
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY:
+ mono_debug_get_type (info, klass->element_class);
+ break;
+ default:
+ break;
+ }
+
+ return index;
+}
+
+void
+mono_debug_add_type (MonoDebugHandle* debug, MonoClass *klass)
+{
+ AssemblyDebugInfo* info = mono_debug_open_assembly (debug, klass->image);
+
+ mono_debug_get_type (info, klass);
+}
+
+void
+mono_debug_add_method (MonoDebugHandle* debug, MonoFlowGraph *cfg)
+{
+ MonoMethod *method = cfg->method;
+ MonoClass *klass = method->klass;
+ AssemblyDebugInfo* info = mono_debug_open_assembly (debug, klass->image);
+ int method_number = 0, line = 0, start_line = 0, end_line = 0, i;
+ DebugMethodInfo *minfo;
+ char *name;
+
+ mono_class_init (klass);
+ /*
+ * Find the method index in the image.
+ */
+ for (i = 0; klass->methods && i < klass->method.count; ++i) {
+ if (klass->methods [i] == method) {
+ method_number = klass->method.first + i + 1;
+ line = info->mlines [method_number];
+ break;
+ }
+ }
+
+ if (g_hash_table_lookup (info->methods, method))
+ return;
+
+ if (info->moffsets) {
+ /* info->moffsets contains -1 "outside" of functions. */
+ for (i = line; (i > 0) && (info->moffsets [i] == 0); i--)
+ ;
+ start_line = i + 1;
+
+ for (i = start_line; info->moffsets [i] != -1; i++)
+ ;
+ end_line = i;
+ }
+
+ name = g_strdup_printf ("%s%s%s.%s", klass->name_space, klass->name_space [0]? ".": "",
+ klass->name, method->name);
+
+ minfo = g_new0 (DebugMethodInfo, 1);
+ minfo->name = name;
+ minfo->start_line = start_line;
+ minfo->first_line = line;
+ minfo->last_line = end_line;
+ minfo->method_info.code_start = cfg->start + 1;
+ minfo->method_info.code_size = cfg->code_size;
+ minfo->method_number = method_number;
+ minfo->method_info.method = method;
+ minfo->method_info.num_params = method->signature->param_count;
+ minfo->method_info.params = g_new0 (MonoDebugVarInfo, minfo->method_info.num_params);
+ minfo->method_info.prologue_end = cfg->prologue_end - 1;
+ minfo->method_info.epilogue_begin = cfg->epilogue_begin - 1;
+
+ if (method->signature->hasthis) {
+ MonoVarInfo *ptr = ((MonoVarInfo *) cfg->varinfo->data) + cfg->args_start_index;
+
+ minfo->method_info.this_var = g_new0 (MonoDebugVarInfo, 1);
+ minfo->method_info.this_var->offset = ptr->offset;
+ }
+
+ for (i = 0; i < minfo->method_info.num_params; i++) {
+ MonoVarInfo *ptr = ((MonoVarInfo *) cfg->varinfo->data) + cfg->args_start_index +
+ method->signature->hasthis;
+
+ minfo->method_info.params [i].offset = ptr [i].offset;
+ }
+
+ if (!method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME)) {
+ MonoMethodHeader *header = ((MonoMethodNormal*)method)->header;
+ MonoVarInfo *ptr = ((MonoVarInfo *) cfg->varinfo->data) + cfg->locals_start_index;
+
+ minfo->method_info.num_locals = header->num_locals;
+ minfo->method_info.locals = g_new0 (MonoDebugVarInfo, header->num_locals);
+ for (i = 0; i < minfo->method_info.num_locals; i++) {
+ minfo->method_info.locals [i].offset = ptr [i].offset;
+ minfo->method_info.locals [i].begin_scope = minfo->method_info.prologue_end;
+ minfo->method_info.locals [i].end_scope = minfo->method_info.epilogue_begin;
+ }
+ }
+
+ debug_generate_method_lines (info, minfo, cfg);
+
+ g_hash_table_insert (info->methods, method, minfo);
+}
diff --git a/mono/jit/debug.h b/mono/jit/debug.h
new file mode 100644
index 00000000000..eb68e7dacf0
--- /dev/null
+++ b/mono/jit/debug.h
@@ -0,0 +1,73 @@
+#ifndef __MONO_JIT_DEBUG_H__
+#define __MONO_JIT_DEBUG_H__
+
+#include <glib.h>
+#include <stdio.h>
+#include <mono/metadata/loader.h>
+#include <mono/jit/jit.h>
+
+typedef struct _MonoDebugHandle MonoDebugHandle;
+
+typedef enum {
+ MONO_DEBUG_FORMAT_STABS,
+ MONO_DEBUG_FORMAT_DWARF2,
+ MONO_DEBUG_FORMAT_DWARF2_PLUS
+} MonoDebugFormat;
+
+extern MonoDebugHandle *mono_debug_handle;
+extern GList *mono_debug_methods;
+
+/*
+ * This variable is intended to be set in a debugger.
+ *
+ * If it's non-zero, arch_compile_method() will insert a breakpoint next time
+ * it compiles a method.
+ *
+ * If it's positive, it acts as a counter which is decremented each time it's
+ * used. Set it to a negative value to make arch_compile_method() insert a
+ * breakpoint for each method.
+ *
+ * To use this, you should create a GDB macro like this:
+ *
+ * define enter
+ * set mono_debug_insert_breakpoint = 1
+ * continue
+ * set *mono_debug_last_breakpoint_address = 0x90
+ * reload-symbol-files
+ * frame
+ * end
+ *
+ * define reload-symbol-files
+ * call mono_debug_make_symbols ()
+ * add-symbol-file Test-debug.o
+ * add-symbol-file /tmp/corlib.o
+ * end
+ *
+ */
+extern int mono_debug_insert_breakpoint;
+
+/*
+ * This is set the the core address of the last inserted breakpoint. You can
+ * use this in GDB to unset the breakpoint.
+ */
+
+extern gchar *mono_debug_last_breakpoint_address;
+
+MonoDebugHandle* mono_debug_open_file (const char *filename, MonoDebugFormat format);
+
+void mono_debug_close (MonoDebugHandle* debug);
+
+void mono_debug_add_method (MonoDebugHandle* debug, MonoFlowGraph *cfg);
+
+void mono_debug_add_type (MonoDebugHandle* debug, MonoClass *klass);
+
+/* DEBUGGER PUBLIC FUNCTION:
+ *
+ * This is a public function which is supposed to be called from within a debugger
+ * each time the program stops. It's used to recreate the symbol file to tell the
+ * debugger about method addresses and such things. After calling this function,
+ * you must tell your debugger to reload its symbol file.
+ */
+void mono_debug_make_symbols (void);
+
+#endif /* __MONO_JIT_DEBUG_H__ */
diff --git a/mono/jit/delegate.c b/mono/jit/delegate.c
new file mode 100644
index 00000000000..d7011cafe7c
--- /dev/null
+++ b/mono/jit/delegate.c
@@ -0,0 +1,439 @@
+/*
+ * delegate.c: delegate support functions
+ *
+ * Authors:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/arch/x86/x86-codegen.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/threads.h>
+#ifndef PLATFORM_WIN32
+#include "mono/io-layer/wapi.h"
+#include "mono/io-layer/uglify.h"
+#endif
+
+#include "jit.h"
+#include "codegen.h"
+
+/* FIXME:
+ * - worker threads need to be initialized correctly.
+ * - worker threads should be domain specific
+ */
+
+typedef struct {
+ MonoMethodMessage *msg;
+ HANDLE wait_semaphore;
+ MonoMethod *cb_method;
+ MonoDelegate *cb_target;
+ int inside_cb;
+ MonoObject *state;
+ MonoObject *res;
+ MonoArray *out_args;
+} ASyncCall;
+
+static guint32 async_invoke_thread (void);
+
+static GList *async_call_queue = NULL;
+static CRITICAL_SECTION delegate_section;
+static HANDLE delegate_semaphore = NULL;
+static int stop_worker = 0;
+
+/**
+ * mono_delegate_ctor:
+ * @this: pointer to an uninitialized delegate object
+ * @target: target object
+ * @addr: pointer to native code
+ *
+ * This is used to initialize a delegate. We also insert the method_info if
+ * we find the info with mono_jit_info_table_find().
+ */
+void
+mono_delegate_ctor (MonoDelegate *this, MonoObject *target, gpointer addr)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoMethod *method = NULL;
+ MonoClass *class;
+ MonoJitInfo *ji;
+
+ g_assert (this);
+ g_assert (addr);
+
+ class = this->object.vtable->klass;
+
+ if ((ji = mono_jit_info_table_find (domain, addr))) {
+ method = ji->method;
+ this->method_info = mono_method_get_object (domain, method);
+ }
+
+ if (target && target->vtable->klass == mono_defaults.transparent_proxy_class) {
+ g_assert (method);
+ this->method_ptr = arch_create_remoting_trampoline (method);
+ this->target = target;
+ } else {
+ this->method_ptr = addr;
+ this->target = target;
+ }
+}
+
+static void
+mono_async_invoke (MonoAsyncResult *ares, gboolean cb_only)
+{
+ ASyncCall *ac = (ASyncCall *)ares->data;
+
+ if (!cb_only) {
+ ac->res = mono_message_invoke (ares->async_delegate, ac->msg,
+ &ac->msg->exc, &ac->out_args);
+ g_assert (ac->res);
+ }
+ ac->inside_cb = 1;
+ ares->completed = 1;
+
+ /* notify listeners */
+ ReleaseSemaphore (ac->wait_semaphore, 0x7fffffff, NULL);
+
+ /* call async callback if cb_method != null*/
+ if (ac->cb_method) {
+ void *pa = &ares;
+ mono_runtime_invoke (ac->cb_method, ac->cb_target, pa);
+ }
+}
+
+gpointer
+arch_begin_invoke (MonoMethod *method, gpointer ret_ip, MonoObject *delegate)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoAsyncResult *ares;
+ MonoDelegate *async_callback;
+ MonoClass *klass;
+ MonoMethod *im;
+ ASyncCall *ac;
+ int i;
+
+ ac = g_new0 (ASyncCall, 1);
+ ac->wait_semaphore = CreateSemaphore (NULL, 0, 0x7fffffff, NULL);
+
+ klass = method->klass;
+ im = NULL;
+
+ for (i = 0; i < klass->method.count; ++i) {
+ if (klass->methods [i]->name[0] == 'I' &&
+ !strcmp ("Invoke", klass->methods [i]->name) &&
+ klass->methods [i]->signature->param_count ==
+ (method->signature->param_count - 2)) {
+ im = klass->methods [i];
+ }
+ }
+
+ g_assert (im);
+
+ ac->msg = arch_method_call_message_new (method, &delegate, im, &async_callback, &ac->state);
+
+ if (async_callback) {
+ klass = ((MonoObject *)async_callback)->vtable->klass;
+ im = NULL;
+ for (i = 0; i < klass->method.count; ++i) {
+ if (klass->methods [i]->name[0] == 'I' &&
+ !strcmp ("Invoke", klass->methods [i]->name) &&
+ klass->methods [i]->signature->param_count == 1) {
+ im = klass->methods [i];
+ break;
+ }
+ }
+ g_assert (im);
+ ac->cb_method = im;
+ ac->cb_target = async_callback;
+ }
+
+ ares = mono_async_result_new (domain, ac->wait_semaphore, ac->state, ac);
+ ares->async_delegate = delegate;
+
+ EnterCriticalSection (&delegate_section);
+ async_call_queue = g_list_append (async_call_queue, ares);
+ LeaveCriticalSection (&delegate_section);
+
+ ReleaseSemaphore (delegate_semaphore, 1, NULL);
+
+ return ares;
+}
+
+void
+arch_end_invoke (MonoMethod *method, gpointer first_arg, ...)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoAsyncResult *ares;
+ MonoMethodSignature *sig = method->signature;
+ MonoMethodMessage *msg;
+ ASyncCall *ac;
+ GList *l;
+
+ g_assert (method);
+
+ msg = arch_method_call_message_new (method, &first_arg, NULL, NULL, NULL);
+
+ ares = mono_array_get (msg->args, gpointer, sig->param_count - 1);
+ g_assert (ares);
+
+ ac = (ASyncCall *)ares->data;
+
+ /* check if we call EndInvoke twice */
+ if (!ares->data) {
+ MonoException *e;
+ e = mono_exception_from_name (mono_defaults.corlib, "System",
+ "InvalidOperationException");
+ mono_raise_exception (e);
+ }
+
+ ares->endinvoke_called = 1;
+
+ EnterCriticalSection (&delegate_section);
+ if ((l = g_list_find (async_call_queue, ares))) {
+ async_call_queue = g_list_remove_link (async_call_queue, l);
+ mono_async_invoke (ares, FALSE);
+ }
+ LeaveCriticalSection (&delegate_section);
+
+ /* wait until we are really finished */
+ WaitForSingleObject (ac->wait_semaphore, INFINITE);
+
+ if (ac->msg->exc) {
+ char *strace = mono_string_to_utf8 (((MonoException*)ac->msg->exc)->stack_trace);
+ char *tmp;
+ tmp = g_strdup_printf ("%s\nException Rethrown at:\n", strace);
+ g_free (strace);
+ ((MonoException*)ac->msg->exc)->stack_trace = mono_string_new (domain, tmp);
+ g_free (tmp);
+ mono_raise_exception ((MonoException*)ac->msg->exc);
+ }
+
+ /* restore return value */
+ g_assert (ac->res);
+ arch_method_return_message_restore (method, &first_arg, ac->res, ac->out_args);
+}
+
+gpointer
+arch_get_delegate_invoke (MonoMethod *method, int *size)
+{
+ /*
+ * Invoke( args .. ) {
+ * if ( prev )
+ * prev.Invoke();
+ * return this.<m_target>( args );
+ * }
+ */
+ MonoMethodSignature *csig = method->signature;
+ guint8 *code, *addr, *br[2], *pos[2];
+ int i, arg_size, this_pos = 4;
+
+ if (csig->ret->type == MONO_TYPE_VALUETYPE) {
+ g_assert (!csig->ret->byref);
+ this_pos = 8;
+ }
+
+ arg_size = 0;
+ if (csig->param_count) {
+ int align;
+
+ for (i = 0; i < csig->param_count; ++i) {
+ arg_size += mono_type_stack_size (csig->params [i], &align);
+ g_assert (align == 4);
+ }
+ }
+
+ code = addr = g_malloc (64 + arg_size * 2);
+
+ /* load the this pointer */
+ x86_mov_reg_membase (code, X86_EAX, X86_ESP, this_pos, 4);
+
+ /* load prev */
+ x86_mov_reg_membase (code, X86_EDX, X86_EAX, G_STRUCT_OFFSET (MonoMulticastDelegate, prev), 4);
+
+ /* prev == 0 ? */
+ x86_alu_reg_imm (code, X86_CMP, X86_EDX, 0);
+ br[0] = code; x86_branch32 (code, X86_CC_EQ, 0, TRUE );
+ pos[0] = code;
+
+ x86_push_reg( code, X86_EAX );
+ /* push args */
+ for ( i = 0; i < (arg_size>>2); i++ )
+ x86_push_membase( code, X86_ESP, (arg_size + this_pos + 4) );
+ /* push next */
+ x86_push_reg( code, X86_EDX );
+ if (this_pos == 8)
+ x86_push_membase (code, X86_ESP, (arg_size + 8));
+ /* recurse */
+ br[1] = code; x86_call_imm( code, 0 );
+ pos[1] = code; x86_call_imm( br[1], addr - pos[1] );
+
+ if (this_pos == 8)
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, arg_size + 8);
+ else
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, arg_size + 4);
+ x86_pop_reg( code, X86_EAX );
+
+ /* prev == 0 */
+ x86_branch32( br[0], X86_CC_EQ, code - pos[0], TRUE );
+
+ /* load mtarget */
+ x86_mov_reg_membase (code, X86_EDX, X86_EAX, G_STRUCT_OFFSET (MonoDelegate, target), 4);
+ /* mtarget == 0 ? */
+ x86_alu_reg_imm (code, X86_CMP, X86_EDX, 0);
+ br[0] = code; x86_branch32 (code, X86_CC_EQ, 0, TRUE);
+ pos[0] = code;
+
+ /*
+ * virtual delegate methods: we have to
+ * replace the this pointer with the actual
+ * target
+ */
+ x86_mov_membase_reg (code, X86_ESP, this_pos, X86_EDX, 4);
+
+ /* jump to method_ptr() */
+ x86_jump_membase (code, X86_EAX, G_STRUCT_OFFSET (MonoDelegate, method_ptr));
+
+ /* mtarget != 0 */
+ x86_branch32( br[0], X86_CC_EQ, code - pos[0], TRUE);
+ /*
+ * static delegate methods: we have to remove
+ * the this pointer from the activation frame
+ * - I do this creating a new stack frame anx
+ * copy all arguments except the this pointer
+ */
+ g_assert ((arg_size & 3) == 0);
+ for (i = 0; i < (arg_size>>2); i++) {
+ x86_push_membase (code, X86_ESP, (arg_size + this_pos));
+ }
+
+ if (this_pos == 8)
+ x86_push_membase (code, X86_ESP, (arg_size + 4));
+
+ x86_call_membase (code, X86_EAX, G_STRUCT_OFFSET (MonoDelegate, method_ptr));
+ if (arg_size) {
+ if (this_pos == 8)
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, arg_size + 4);
+ else
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, arg_size);
+ }
+
+ x86_ret (code);
+
+ g_assert ((code - addr) < (64 + arg_size * 2));
+
+ if (size)
+ *size = code - addr;
+
+ return addr;
+}
+
+static void
+async_invoke_abort (MonoObject *obj)
+{
+ MonoDomain *domain = obj->vtable->domain;
+ MonoAsyncResult *ares = TlsGetValue (async_result_id);
+ ASyncCall *ac = (ASyncCall *)ares->data;
+
+ ares->completed = 1;
+
+ if (!ac->msg->exc)
+ ac->msg->exc = obj;
+
+ /* we need to call the callback if not already called */
+ if (!ac->inside_cb) {
+ ac->inside_cb = 1;
+ mono_async_invoke (ares, TRUE);
+ }
+
+ /* signal that we finished processing */
+ ReleaseSemaphore (ac->wait_semaphore, 0x7fffffff, NULL);
+
+ /* start a new worker */
+ mono_thread_create (domain, async_invoke_thread);
+ /* exit current one */
+ ExitThread (0);
+}
+
+static guint32
+async_invoke_thread ()
+{
+ MonoDomain *domain;
+ static int workers = 1;
+ static HANDLE first_worker = NULL;
+
+ if (!first_worker) {
+ first_worker = GetCurrentThread ();
+ g_assert (first_worker);
+ }
+
+ TlsSetValue (exc_cleanup_id, async_invoke_abort);
+
+ for (;;) {
+ MonoAsyncResult *ar;
+ gboolean new_worker = FALSE;
+
+ if (WaitForSingleObject (delegate_semaphore, 3000) == WAIT_TIMEOUT) {
+ if (GetCurrentThread () != first_worker)
+ ExitThread (0);
+ }
+
+ ar = NULL;
+ EnterCriticalSection (&delegate_section);
+
+ if (async_call_queue) {
+ if ((g_list_length (async_call_queue) > 1) && (workers < mono_worker_threads)) {
+ new_worker = TRUE;
+ workers++;
+ }
+
+ ar = (MonoAsyncResult *)async_call_queue->data;
+ async_call_queue = g_list_remove_link (async_call_queue, async_call_queue);
+
+ }
+
+ LeaveCriticalSection (&delegate_section);
+
+ if (stop_worker)
+ ExitThread (0);
+
+ if (!ar)
+ continue;
+
+ /* worker threads invokes methods in different domains,
+ * so we need to set the right domain here */
+ domain = ((MonoObject *)ar)->vtable->domain;
+ mono_domain_set (domain);
+
+ if (new_worker)
+ mono_thread_create (domain, async_invoke_thread);
+
+ TlsSetValue (async_result_id, ar);
+
+ mono_async_invoke (ar, FALSE);
+ }
+
+ return 0;
+}
+
+void
+mono_delegate_init ()
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoObject *thread;
+
+ delegate_semaphore = CreateSemaphore (NULL, 0, 0x7fffffff, NULL);
+ g_assert (delegate_semaphore != INVALID_HANDLE_VALUE);
+ InitializeCriticalSection (&delegate_section);
+ thread = mono_thread_create (domain, async_invoke_thread);
+ g_assert (thread != NULL);
+}
+
+void
+mono_delegate_cleanup ()
+{
+ stop_worker = 1;
+}
diff --git a/mono/jit/emit-x86.c b/mono/jit/emit-x86.c
new file mode 100644
index 00000000000..ea2c4387b7f
--- /dev/null
+++ b/mono/jit/emit-x86.c
@@ -0,0 +1,968 @@
+/*
+ * emit-x86.c: Support functions for emitting x86 code
+ *
+ * Authors:
+ * Dietmar Maurer (dietmar@ximian.com)
+ * Miguel de Icaza (miguel@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/metadata/assembly.h>
+#include <mono/metadata/loader.h>
+#include <mono/metadata/cil-coff.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/debug-helpers.h>
+#include <mono/metadata/mono-endian.h>
+#include <mono/arch/x86/x86-codegen.h>
+#include <mono/metadata/profiler-private.h>
+
+#include "jit.h"
+#include "codegen.h"
+#include "debug.h"
+
+static void
+enter_method (MonoMethod *method, char *ebp)
+{
+ int i, j;
+ MonoClass *class;
+ MonoObject *o;
+
+ printf ("ENTER: %s.%s::%s\n(", method->klass->name_space,
+ method->klass->name, method->name);
+
+
+ if (((int)ebp & 3) != 0) {
+ g_error ("unaligned stack detected (%p)", ebp);
+ }
+
+ ebp += 8;
+
+ if (ISSTRUCT (method->signature->ret)) {
+ int size, align;
+
+ g_assert (!method->signature->ret->byref);
+
+ size = mono_type_stack_size (method->signature->ret, &align);
+
+ printf ("VALUERET:%p, ", *((gpointer *)ebp));
+ ebp += sizeof (gpointer);
+ }
+
+ if (method->signature->hasthis) {
+ if (method->klass->valuetype) {
+ printf ("value:%p, ", *((gpointer *)ebp));
+ } else {
+ o = *((MonoObject **)ebp);
+
+ g_assert (o);
+
+ class = o->vtable->klass;
+
+ if (class == mono_defaults.string_class) {
+ printf ("this:[STRING:%p:%s], ", o, mono_string_to_utf8 ((MonoString *)o));
+ } else {
+ printf ("this:%p[%s.%s], ", o, class->name_space, class->name);
+ }
+ }
+ ebp += sizeof (gpointer);
+ }
+
+ for (i = 0; i < method->signature->param_count; ++i) {
+ MonoType *type = method->signature->params [i];
+ int size, align;
+ size = mono_type_stack_size (type, &align);
+
+ if (type->byref) {
+ printf ("[BYREF:%p], ", *((gpointer *)ebp));
+ } else switch (type->type) {
+
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ printf ("%d, ", *((int *)(ebp)));
+ break;
+ case MONO_TYPE_STRING: {
+ MonoString *s = *((MonoString **)ebp);
+ if (s) {
+ g_assert (((MonoObject *)s)->vtable->klass == mono_defaults.string_class);
+ printf ("[STRING:%p:%s], ", s, mono_string_to_utf8 (s));
+ } else
+ printf ("[STRING:null], ");
+ break;
+ }
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT: {
+ o = *((MonoObject **)ebp);
+ if (o) {
+ class = o->vtable->klass;
+
+ if (class == mono_defaults.string_class) {
+ printf ("[STRING:%p:%s], ", o, mono_string_to_utf8 ((MonoString *)o));
+ } else if (class == mono_defaults.int32_class) {
+ printf ("[INT32:%p:%d], ", o, *(gint32 *)((char *)o + sizeof (MonoObject)));
+ } else
+ printf ("[%s.%s:%p], ", class->name_space, class->name, o);
+ } else {
+ printf ("%p, ", *((gpointer *)(ebp)));
+ }
+ break;
+ }
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_FNPTR:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY:
+ printf ("%p, ", *((gpointer *)(ebp)));
+ break;
+ case MONO_TYPE_I8:
+ printf ("%lld, ", *((gint64 *)(ebp)));
+ break;
+ case MONO_TYPE_R4:
+ printf ("%f, ", *((float *)(ebp)));
+ break;
+ case MONO_TYPE_R8:
+ printf ("%f, ", *((double *)(ebp)));
+ break;
+ case MONO_TYPE_VALUETYPE:
+ printf ("[");
+ for (j = 0; j < size; j++)
+ printf ("%02x,", *((guint8*)ebp +j));
+ printf ("], ");
+ break;
+ default:
+ printf ("XX, ");
+ }
+
+ g_assert (align == 4 || align == 8);
+ ebp += size + align - 1;
+ ebp = (gpointer)((unsigned)ebp & ~(align - 1));
+ }
+
+ printf (")\n");
+}
+
+static void
+leave_method (MonoMethod *method, int edx, int eax, double test)
+{
+ gint64 l;
+
+ printf ("LEAVE: %s.%s::%s ", method->klass->name_space,
+ method->klass->name, method->name);
+
+ switch (method->signature->ret->type) {
+ case MONO_TYPE_VOID:
+ break;
+ case MONO_TYPE_BOOLEAN:
+ if (eax)
+ printf ("TRUE:%d", eax);
+ else
+ printf ("FALSE");
+
+ break;
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ printf ("EAX=%d", eax);
+ break;
+ case MONO_TYPE_STRING: {
+ MonoString *s = (MonoString *)eax;
+
+ if (s) {
+ g_assert (((MonoObject *)s)->vtable->klass == mono_defaults.string_class);
+ printf ("[STRING:%p:%s]", s, mono_string_to_utf8 (s));
+ } else
+ printf ("[STRING:null], ");
+ break;
+ }
+ case MONO_TYPE_OBJECT: {
+ MonoObject *o = (MonoObject *)eax;
+
+ if (o) {
+ if (o->vtable->klass == mono_defaults.boolean_class) {
+ printf ("[BOOLEAN:%p:%d]", o, *((guint8 *)o + sizeof (MonoObject)));
+ } else if (o->vtable->klass == mono_defaults.int32_class) {
+ printf ("[INT32:%p:%d]", o, *((gint32 *)((char *)o + sizeof (MonoObject))));
+ } else
+ printf ("[%s.%s:%p]", o->vtable->klass->name_space, o->vtable->klass->name, o);
+ } else
+ printf ("[OBJECT:%p]", o);
+
+ break;
+ }
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_FNPTR:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY:
+ printf ("EAX=%p", (gpointer)eax);
+ break;
+ case MONO_TYPE_I8:
+ *((gint32 *)&l) = eax;
+ *((gint32 *)&l + 1) = edx;
+ printf ("EAX/EDX=%lld", l);
+ break;
+ case MONO_TYPE_R8:
+ printf ("FP=%f\n", test);
+ break;
+ default:
+ printf ("(unknown return type)");
+ }
+
+ printf ("\n");
+}
+
+/**
+ * arch_emit_prologue:
+ * @cfg: pointer to status information
+ *
+ * Emits the function prolog.
+ */
+static void
+arch_emit_prologue (MonoFlowGraph *cfg)
+{
+ MonoMethod *method = cfg->method;
+ MonoMethodHeader *header = ((MonoMethodNormal *)method)->header;
+ int i, j;
+
+ x86_push_reg (cfg->code, X86_EBP);
+ x86_mov_reg_reg (cfg->code, X86_EBP, X86_ESP, 4);
+
+ if (cfg->locals_size)
+ x86_alu_reg_imm (cfg->code, X86_SUB, X86_ESP, cfg->locals_size);
+
+ if (mono_regset_reg_used (cfg->rs, X86_EBX))
+ x86_push_reg (cfg->code, X86_EBX);
+
+ if (mono_regset_reg_used (cfg->rs, X86_EDI))
+ x86_push_reg (cfg->code, X86_EDI);
+
+ if (mono_regset_reg_used (cfg->rs, X86_ESI))
+ x86_push_reg (cfg->code, X86_ESI);
+
+ if (mono_jit_trace_calls) {
+ x86_push_reg (cfg->code, X86_EBP);
+ x86_push_imm (cfg->code, cfg->method);
+ x86_mov_reg_imm (cfg->code, X86_EAX, enter_method);
+ x86_call_reg (cfg->code, X86_EAX);
+ x86_alu_reg_imm (cfg->code, X86_ADD, X86_ESP, 8);
+ }
+ if (mono_jit_profile) {
+ x86_push_imm (cfg->code, cfg->method);
+ x86_mov_reg_imm (cfg->code, X86_EAX, mono_profiler_method_enter);
+ x86_call_reg (cfg->code, X86_EAX);
+ x86_alu_reg_imm (cfg->code, X86_ADD, X86_ESP, 4);
+ }
+
+ /* initialize local vars */
+ if (header->num_locals) {
+
+ if (header->init_locals) {
+ int offset = g_array_index (cfg->varinfo, MonoVarInfo,
+ cfg->locals_start_index + header->num_locals - 1).offset;
+ int size = - offset;
+
+ if (size == 1 || size == 2 || size == 4) {
+ x86_mov_membase_imm (cfg->code, X86_EBP, offset, 0, size);
+ return;
+ }
+
+ i = size / 4;
+ j = size % 4;
+
+ if (i) {
+ if (!mono_regset_reg_used (cfg->rs, X86_EDI))
+ x86_push_reg (cfg->code, X86_EDI);
+ x86_lea_membase (cfg->code, X86_EDI, X86_EBP, offset);
+ x86_alu_reg_reg (cfg->code, X86_XOR, X86_EAX, X86_EAX);
+ x86_mov_reg_imm (cfg->code, X86_ECX, i);
+ x86_cld (cfg->code);
+ x86_prefix (cfg->code, X86_REP_PREFIX);
+ x86_stosl (cfg->code);
+ for (i = 0; i < j; i++)
+ x86_stosb (cfg->code);
+ if (!mono_regset_reg_used (cfg->rs, X86_EDI))
+ x86_pop_reg (cfg->code, X86_EDI);
+ } else {
+
+ g_assert (j == 3);
+ x86_mov_membase_imm (cfg->code, X86_EBP, offset, 0, 2);
+ x86_mov_membase_imm (cfg->code, X86_EBP, offset + 2, 0, 1);
+ }
+
+ } else {
+
+ /* we always need to initialize object pointers */
+
+ for (i = 0; i < header->num_locals; ++i) {
+ MonoType *t = header->locals [i];
+ int offset = g_array_index (cfg->varinfo, MonoVarInfo, cfg->locals_start_index + i).offset;
+
+ if (t->byref) {
+ x86_mov_membase_imm (cfg->code, X86_EBP, offset, 0, 4);
+ continue;
+ }
+
+ switch (t->type) {
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_OBJECT:
+ x86_mov_membase_imm (cfg->code, X86_EBP, offset, 0, 4);
+ break;
+ }
+
+ }
+ }
+ }
+}
+
+/**
+ * arch_emit_epilogue:
+ * @cfg: pointer to status information
+ *
+ * Emits the function epilog.
+ */
+static void
+arch_emit_epilogue (MonoFlowGraph *cfg)
+{
+ /*
+ * note: with trace and profiling the value on the FP stack may get clobbered.
+ */
+ if (mono_jit_trace_calls) {
+ x86_fld_reg (cfg->code, 0);
+ x86_alu_reg_imm (cfg->code, X86_SUB, X86_ESP, 8);
+ x86_fst_membase (cfg->code, X86_ESP, 0, TRUE, TRUE);
+ x86_push_reg (cfg->code, X86_EAX);
+ x86_push_reg (cfg->code, X86_EDX);
+ x86_push_imm (cfg->code, cfg->method);
+ x86_mov_reg_imm (cfg->code, X86_EAX, leave_method);
+ x86_call_reg (cfg->code, X86_EAX);
+ x86_alu_reg_imm (cfg->code, X86_ADD, X86_ESP, 4);
+ x86_pop_reg (cfg->code, X86_EDX);
+ x86_pop_reg (cfg->code, X86_EAX);
+ x86_alu_reg_imm (cfg->code, X86_ADD, X86_ESP, 8);
+ }
+ if (mono_jit_profile) {
+ x86_push_reg (cfg->code, X86_EAX);
+ x86_push_reg (cfg->code, X86_EDX);
+ x86_push_imm (cfg->code, cfg->method);
+ x86_mov_reg_imm (cfg->code, X86_EAX, mono_profiler_method_leave);
+ x86_call_reg (cfg->code, X86_EAX);
+ x86_alu_reg_imm (cfg->code, X86_ADD, X86_ESP, 4);
+ x86_pop_reg (cfg->code, X86_EDX);
+ x86_pop_reg (cfg->code, X86_EAX);
+ }
+
+ if (mono_regset_reg_used (cfg->rs, X86_ESI))
+ x86_pop_reg (cfg->code, X86_ESI);
+
+ if (mono_regset_reg_used (cfg->rs, X86_EDI))
+ x86_pop_reg (cfg->code, X86_EDI);
+
+ if (mono_regset_reg_used (cfg->rs, X86_EBX))
+ x86_pop_reg (cfg->code, X86_EBX);
+
+ x86_leave (cfg->code);
+ x86_ret (cfg->code);
+}
+
+static void
+mono_label_cfg (MonoFlowGraph *cfg)
+{
+ int i, j;
+
+ for (i = 0; i < cfg->block_count; i++) {
+ GPtrArray *forest = cfg->bblocks [i].forest;
+ int top;
+
+ if (!cfg->bblocks [i].reached) /* unreachable code */
+ continue;
+
+ top = forest->len;
+
+ for (j = 0; j < top; j++) {
+ MBTree *t1 = (MBTree *) g_ptr_array_index (forest, j);
+ MBState *mbstate;
+
+ mbstate = mono_burg_label (t1, cfg);
+
+ if (!mbstate) {
+ cfg->invalid = 1;
+ if (mono_debug_handle)
+ return;
+ g_warning ("tree does not match");
+ mono_print_ctree (t1); printf ("\n\n");
+
+ mono_print_forest (forest);
+ g_assert_not_reached ();
+ }
+ }
+ }
+}
+
+static void
+tree_preallocate_regs (MBTree *tree, int goal, MonoRegSet *rs)
+{
+ switch (tree->op) {
+ case MB_TERM_CALL_I4:
+ case MB_TERM_CALL_I8:
+ case MB_TERM_CALL_R8:
+// case MB_TERM_CALL_VOID :
+ tree->reg1 = mono_regset_alloc_reg (rs, X86_EAX, tree->exclude_mask);
+ tree->reg2 = mono_regset_alloc_reg (rs, X86_EDX, tree->exclude_mask);
+ tree->reg3 = mono_regset_alloc_reg (rs, X86_ECX, tree->exclude_mask);
+ return;
+ default: break;
+ }
+
+ switch (goal) {
+ case MB_NTERM_reg:
+ case MB_NTERM_lreg: {
+ switch (tree->op) {
+ case MB_TERM_SHL:
+ case MB_TERM_SHR:
+ case MB_TERM_SHR_UN:
+ tree->exclude_mask |= (1 << X86_ECX);
+ tree->left->exclude_mask |= (1 << X86_ECX);
+ break;
+ case MB_TERM_MUL:
+ case MB_TERM_MUL_OVF:
+ case MB_TERM_MUL_OVF_UN:
+ case MB_TERM_DIV:
+ case MB_TERM_DIV_UN:
+ case MB_TERM_REM:
+ case MB_TERM_REM_UN:
+ tree->reg1 = mono_regset_alloc_reg (rs, X86_EAX, tree->exclude_mask);
+ tree->reg2 = mono_regset_alloc_reg (rs, X86_EDX, tree->exclude_mask);
+ if (goal == MB_NTERM_reg) {
+ tree->left->exclude_mask |= (1 << X86_EDX);
+ tree->right->exclude_mask |= (1 << X86_EDX) | (1 << X86_EAX);
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+static void
+tree_allocate_regs (MBTree *tree, int goal, MonoRegSet *rs)
+{
+ MBTree *kids[10];
+ int ern = mono_burg_rule (tree->state, goal);
+ const guint16 *nts = mono_burg_nts [ern];
+ int i;
+
+ mono_burg_kids (tree, ern, kids);
+
+ //printf ("RALLOC START %d %p %d %d\n", tree->op, rs->free_mask, goal, (nts [0] && kids [0] == tree));
+
+ if (nts [0] && kids [0] == tree) {
+ /* chain rule */
+ tree_allocate_regs (kids [0], nts [0], rs);
+ /* special case reg: coni4 */
+ if (goal == MB_NTERM_reg) {
+ if (tree->reg1 == -1)
+ tree->reg1 = mono_regset_alloc_reg (rs, -1, tree->exclude_mask);
+ g_assert (tree->reg1 != -1);
+ }
+ return;
+ }
+
+ for (i = 0; nts [i]; i++)
+ tree_preallocate_regs (kids [i], nts [i], rs);
+
+ for (i = 0; nts [i]; i++)
+ tree_allocate_regs (kids [i], nts [i], rs);
+
+ for (i = 0; nts [i]; i++) {
+ mono_regset_free_reg (rs, kids [i]->reg1);
+ mono_regset_free_reg (rs, kids [i]->reg2);
+ mono_regset_free_reg (rs, kids [i]->reg3);
+ }
+
+ switch (goal) {
+ case MB_NTERM_reg:
+ if (tree->reg1 < 0) {
+ tree->reg1 = mono_regset_alloc_reg (rs, -1, tree->exclude_mask);
+ g_assert (tree->reg1 != -1);
+ }
+ break;
+
+ case MB_NTERM_lreg:
+ if (tree->reg1 < 0) {
+ tree->reg1 = mono_regset_alloc_reg (rs, -1, tree->exclude_mask);
+ g_assert (tree->reg1 != -1);
+ }
+ if (tree->reg2 < 0) {
+ tree->reg2 = mono_regset_alloc_reg (rs, -1, tree->exclude_mask);
+ g_assert (tree->reg2 != -1);
+ }
+ break;
+
+ case MB_NTERM_freg:
+ /* fixme: allocate floating point registers */
+ break;
+
+ case MB_NTERM_addr:
+ if (tree->op == MB_TERM_ADD) {
+ tree->reg1 = mono_regset_alloc_reg (rs, tree->left->reg1, tree->exclude_mask);
+ tree->reg2 = mono_regset_alloc_reg (rs, tree->right->reg1, tree->exclude_mask);
+ }
+ break;
+
+ case MB_NTERM_base:
+ if (tree->op == MB_TERM_ADD) {
+ tree->reg1 = mono_regset_alloc_reg (rs, tree->left->reg1, tree->exclude_mask);
+ }
+ break;
+
+ case MB_NTERM_index:
+ if (tree->op == MB_TERM_SHL ||
+ tree->op == MB_TERM_MUL) {
+ tree->reg1 = mono_regset_alloc_reg (rs, tree->left->reg1, tree->exclude_mask);
+ }
+ break;
+
+ default:
+ /* do nothing */
+ }
+
+ //printf ("RALLOC END %d %p\n", tree->op, rs->free_mask);
+ tree->emit = mono_burg_func [ern];
+}
+
+static void
+arch_allocate_regs (MonoFlowGraph *cfg)
+{
+ int i, j;
+
+ for (i = 0; i < cfg->block_count; i++) {
+ GPtrArray *forest = cfg->bblocks [i].forest;
+ int top;
+
+ if (!cfg->bblocks [i].reached) /* unreachable code */
+ continue;
+
+ top = forest->len;
+
+ for (j = 0; j < top; j++) {
+ MBTree *t1 = (MBTree *) g_ptr_array_index (forest, j);
+ //printf ("AREGSTART %d:%d %p\n", i, j, cfg->rs->free_mask);
+ tree_allocate_regs (t1, 1, cfg->rs);
+ //printf ("AREGENDT %d:%d %p\n", i, j, cfg->rs->free_mask);
+ g_assert (cfg->rs->free_mask == 0xffffffff);
+ }
+ }
+}
+
+static void
+tree_emit (int goal, MonoFlowGraph *cfg, MBTree *tree)
+{
+ MBTree *kids[10];
+ int i, ern = mono_burg_rule (tree->state, goal);
+ const guint16 *nts = mono_burg_nts [ern];
+ MBEmitFunc emit;
+ int offset;
+
+ mono_burg_kids (tree, ern, kids);
+
+ for (i = 0; nts [i]; i++)
+ tree_emit (nts [i], cfg, kids [i]);
+
+ tree->addr = offset = cfg->code - cfg->start;
+
+ // we assume an instruction uses a maximum of 128 bytes
+ if ((cfg->code_size - offset) <= 128) {
+ int add = MIN (cfg->code_size, 128);
+ cfg->code_size += add;
+ mono_jit_stats.code_reallocs++;
+ cfg->start = g_realloc (cfg->start, cfg->code_size);
+ g_assert (cfg->start);
+ cfg->code = cfg->start + offset;
+ }
+
+ if ((emit = mono_burg_func [ern]))
+ emit (tree, cfg);
+
+ g_assert ((cfg->code - cfg->start) < cfg->code_size);
+}
+
+static void
+mono_emit_cfg (MonoFlowGraph *cfg)
+{
+ int i, j;
+
+ for (i = 0; i < cfg->block_count; i++) {
+ MonoBBlock *bb = &cfg->bblocks [i];
+ GPtrArray *forest = bb->forest;
+ int top;
+
+ if (!bb->reached) /* unreachable code */
+ continue;
+
+ top = forest->len;
+
+ bb->addr = cfg->code - cfg->start;
+
+ for (j = 0; j < top; j++) {
+ MBTree *t1 = (MBTree *) g_ptr_array_index (forest, j);
+
+ tree_emit (1, cfg, t1);
+ }
+ }
+
+ cfg->epilog = cfg->code - cfg->start;
+}
+
+static void
+mono_compute_branches (MonoFlowGraph *cfg)
+{
+ MonoJumpInfo *ji;
+ guint8 *end;
+ int i, j;
+
+ end = cfg->code;
+
+ for (j = 0; j < cfg->block_count; j++) {
+ MonoBBlock *bb = &cfg->bblocks [j];
+ GPtrArray *forest = bb->forest;
+ int top;
+
+ if (!bb->reached) /* unreachable code */
+ continue;
+
+ top = forest->len;
+
+ for (i = 0; i < top; i++) {
+ MBTree *t1 = (MBTree *) g_ptr_array_index (forest, i);
+
+ if (t1->op == MB_TERM_SWITCH) {
+ MonoBBlock **jt = (MonoBBlock **)t1->data.p;
+ guint32 *rt = (guint32 *)t1->data.p;
+ int m = *((guint32 *)t1->data.p) + 1;
+ int k;
+
+ for (k = 1; k <= m; k++)
+ rt [k] = (int)(jt [k]->addr + cfg->start);
+
+ /* emit the switch instruction again to update addresses */
+ cfg->code = cfg->start + t1->addr;
+ ((MBEmitFunc)t1->emit) (t1, cfg);
+ }
+ }
+ }
+
+ cfg->code = end;
+
+ for (ji = cfg->jump_info; ji; ji = ji->next) {
+ gpointer *ip = GUINT_TO_POINTER (GPOINTER_TO_UINT (ji->ip) + cfg->start);
+ char *target;
+
+ switch (ji->type) {
+ case MONO_JUMP_INFO_BB:
+ target = ji->data.bb->addr + cfg->start;
+ *ip = target - GPOINTER_TO_UINT(ip) - 4;
+ break;
+ case MONO_JUMP_INFO_ABS:
+ target = ji->data.target;
+ *ip = target - GPOINTER_TO_UINT(ip) - 4;
+ break;
+ case MONO_JUMP_INFO_EPILOG:
+ target = cfg->epilog + cfg->start;
+ *ip = target - GPOINTER_TO_UINT(ip) - 4;
+ break;
+ case MONO_JUMP_INFO_IP:
+ *ip = ip;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ }
+}
+
+void
+mono_add_jump_info (MonoFlowGraph *cfg, gpointer ip, MonoJumpInfoType type, gpointer target)
+{
+ MonoJumpInfo *ji = mono_mempool_alloc (cfg->mp, sizeof (MonoJumpInfo));
+
+ ji->type = type;
+ ji->ip = GUINT_TO_POINTER (GPOINTER_TO_UINT (ip) - GPOINTER_TO_UINT (cfg->start));
+ ji->data.target = target;
+ ji->next = cfg->jump_info;
+
+ cfg->jump_info = ji;
+}
+
+static int
+match_debug_method (MonoMethod* method)
+{
+ GList *tmp = mono_debug_methods;
+
+ for (; tmp; tmp = tmp->next) {
+ if (mono_method_desc_full_match (tmp->data, method))
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * arch_compile_method:
+ * @method: pointer to the method info
+ *
+ * JIT compilation of a single method.
+ *
+ * Returns: a pointer to the newly created code.
+ */
+gpointer
+arch_compile_method (MonoMethod *method)
+{
+ MonoDomain *target_domain, *domain = mono_domain_get ();
+ MonoJitInfo *ji;
+ guint8 *addr;
+ GHashTable *jit_code_hash;
+
+ if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
+ (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) {
+ if (!method->info)
+ method->info = arch_create_native_wrapper (method);
+ return method->info;
+ }
+
+ if (mono_jit_share_code)
+ target_domain = mono_root_domain;
+ else
+ target_domain = domain;
+
+ jit_code_hash = target_domain->jit_code_hash;
+
+ if ((addr = g_hash_table_lookup (jit_code_hash, method))) {
+ mono_jit_stats.methods_lookups++;
+ return addr;
+ }
+
+ mono_jit_stats.methods_compiled++;
+
+ if (mono_jit_trace_calls || mono_jit_dump_asm || mono_jit_dump_forest) {
+ printf ("Start JIT compilation of %s.%s:%s\n", method->klass->name_space,
+ method->klass->name, method->name);
+ }
+
+ if (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) {
+ const char *name = method->name;
+ guint8 *code;
+ gboolean delegate = FALSE;
+
+ if (method->klass->parent == mono_defaults.multicastdelegate_class)
+ delegate = TRUE;
+
+ if (delegate && *name == '.' && (strcmp (name, ".ctor") == 0)) {
+ addr = (gpointer)mono_delegate_ctor;
+ } else if (delegate && *name == 'I' && (strcmp (name, "Invoke") == 0)) {
+ int size;
+
+ addr = arch_get_delegate_invoke (method, &size);
+
+ if (mono_jit_dump_asm) {
+ char *id = g_strdup_printf ("%s.%s_%s", method->klass->name_space,
+ method->klass->name, method->name);
+ mono_disassemble_code (addr, size, id);
+ g_free (id);
+ }
+ } else if (delegate && *name == 'B' && (strcmp (name, "BeginInvoke") == 0)) {
+ code = addr = g_malloc (32);
+ x86_push_imm (code, method);
+ x86_call_code (code, arch_begin_invoke);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 4);
+ x86_ret (code);
+ g_assert ((code - addr) <= 32);
+ } else if (delegate && *name == 'E' && (strcmp (name, "EndInvoke") == 0)) {
+ /* this can raise exceptions, so we need a wrapper to save/restore LMF */
+ method->addr = (gpointer)arch_end_invoke;
+ addr = arch_create_native_wrapper (method);
+ } else {
+ mono_profiler_method_end_jit (method, MONO_PROFILE_FAILED);
+ if (mono_debug_handle)
+ return NULL;
+
+ g_error ("Don't know how to exec runtime method %s.%s::%s",
+ method->klass->name_space, method->klass->name, method->name);
+ }
+
+ } else {
+ MonoMethodHeader *header = ((MonoMethodNormal *)method)->header;
+ MonoFlowGraph *cfg;
+ MonoMemPool *mp;
+ gulong code_size_ratio;
+
+ mono_profiler_method_jit (method);
+
+ ji = mono_mempool_alloc0 (target_domain->mp, sizeof (MonoJitInfo));
+
+ mp = mono_mempool_new ();
+
+ cfg = mono_cfg_new (method, mp);
+
+ mono_analyze_flow (cfg);
+ if (cfg->invalid) {
+ mono_profiler_method_end_jit (method, MONO_PROFILE_FAILED);
+ return NULL;
+ }
+
+ mono_analyze_stack (cfg);
+ if (cfg->invalid) {
+ mono_profiler_method_end_jit (method, MONO_PROFILE_FAILED);
+ return NULL;
+ }
+
+ cfg->rs = mono_regset_new (X86_NREG);
+ mono_regset_reserve_reg (cfg->rs, X86_ESP);
+ mono_regset_reserve_reg (cfg->rs, X86_EBP);
+
+ cfg->code_size = MAX (header->code_size * 5, 256);
+ cfg->start = cfg->code = g_malloc (cfg->code_size);
+
+ mono_debug_last_breakpoint_address = cfg->code;
+
+ if (match_debug_method (method) || mono_debug_insert_breakpoint)
+ x86_breakpoint (cfg->code);
+ else if (mono_debug_handle)
+ x86_nop (cfg->code);
+
+ if (mono_debug_insert_breakpoint > 0)
+ mono_debug_insert_breakpoint--;
+
+ if (mono_jit_dump_forest) {
+ int i;
+ printf ("FOREST %s.%s:%s\n", method->klass->name_space,
+ method->klass->name, method->name);
+ for (i = 0; i < cfg->block_count; i++) {
+ printf ("BLOCK %d:\n", i);
+ mono_print_forest (cfg->bblocks [i].forest);
+ }
+ }
+
+ mono_label_cfg (cfg);
+ if (cfg->invalid) {
+ mono_profiler_method_end_jit (method, MONO_PROFILE_FAILED);
+ return NULL;
+ }
+
+ arch_allocate_regs (cfg);
+
+ /* align to 8 byte boundary */
+ cfg->locals_size += 7;
+ cfg->locals_size &= ~7;
+
+ arch_emit_prologue (cfg);
+ cfg->prologue_end = cfg->code - cfg->start;
+ mono_emit_cfg (cfg);
+ cfg->epilogue_begin = cfg->code - cfg->start;
+ arch_emit_epilogue (cfg);
+
+ addr = cfg->start;
+
+ mono_jit_stats.allocated_code_size += cfg->code_size;
+
+ code_size_ratio = cfg->code - cfg->start;
+ if (code_size_ratio > mono_jit_stats.biggest_method_size) {
+ mono_jit_stats.biggest_method_size = code_size_ratio;
+ mono_jit_stats.biggest_method = method;
+ }
+ code_size_ratio = (code_size_ratio * 100) / header->code_size;
+ if (code_size_ratio > mono_jit_stats.max_code_size_ratio) {
+ mono_jit_stats.max_code_size_ratio = code_size_ratio;
+ mono_jit_stats.max_ratio_method = method;
+ }
+
+ mono_compute_branches (cfg);
+
+ if (mono_jit_dump_asm) {
+ char *id = g_strdup_printf ("%s.%s_%s", method->klass->name_space,
+ method->klass->name, method->name);
+ mono_disassemble_code (cfg->start, cfg->code - cfg->start, id);
+ g_free (id);
+ }
+ if (mono_debug_handle)
+ mono_debug_add_method (mono_debug_handle, cfg);
+
+ ji->code_size = cfg->code - cfg->start;
+ ji->used_regs = cfg->rs->used_mask;
+ ji->method = method;
+ ji->code_start = addr;
+
+ mono_jit_stats.native_code_size += ji->code_size;
+
+ if (header->num_clauses) {
+ int i, start_block, end_block;
+
+ ji->num_clauses = header->num_clauses;
+ ji->clauses = mono_mempool_alloc0 (target_domain->mp,
+ sizeof (MonoJitExceptionInfo) * header->num_clauses);
+
+ for (i = 0; i < header->num_clauses; i++) {
+ MonoExceptionClause *ec = &header->clauses [i];
+ MonoJitExceptionInfo *ei = &ji->clauses [i];
+
+ ei->flags = ec->flags;
+ ei->token_or_filter = ec->token_or_filter;
+
+ g_assert (cfg->bcinfo [ec->try_offset].is_block_start);
+ start_block = cfg->bcinfo [ec->try_offset].block_id;
+ end_block = cfg->bcinfo [ec->try_offset + ec->try_len].block_id;
+ g_assert (cfg->bcinfo [ec->try_offset + ec->try_len].is_block_start);
+
+ ei->try_start = cfg->start + cfg->bblocks [start_block].addr;
+ ei->try_end = cfg->start + cfg->bblocks [end_block].addr;
+
+ g_assert (cfg->bcinfo [ec->handler_offset].is_block_start);
+ start_block = cfg->bcinfo [ec->handler_offset].block_id;
+ ei->handler_start = cfg->start + cfg->bblocks [start_block].addr;
+
+ //printf ("TEST %x %x %x\n", ei->try_start, ei->try_end, ei->handler_start);
+ }
+ }
+
+ mono_jit_info_table_add (target_domain, ji);
+
+ mono_regset_free (cfg->rs);
+
+ mono_cfg_free (cfg);
+
+ mono_mempool_destroy (mp);
+
+ mono_profiler_method_end_jit (method, MONO_PROFILE_OK);
+ }
+
+ if (mono_jit_trace_calls || mono_jit_dump_asm || mono_jit_dump_forest) {
+ printf ("END JIT compilation of %s.%s:%s %p %p\n", method->klass->name_space,
+ method->klass->name, method->name, method, addr);
+ }
+
+ g_hash_table_insert (jit_code_hash, method, addr);
+
+ return addr;
+}
+
diff --git a/mono/jit/exception.c b/mono/jit/exception.c
new file mode 100644
index 00000000000..6975f3edebe
--- /dev/null
+++ b/mono/jit/exception.c
@@ -0,0 +1,370 @@
+/*
+ * exception.c: exception support
+ *
+ * Authors:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/arch/x86/x86-codegen.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/tabledefs.h>
+
+#include "jit.h"
+#include "codegen.h"
+
+/*
+ * arch_get_restore_context:
+ *
+ * Returns a pointer to a method which restores a previously saved sigcontext.
+ */
+static gpointer
+arch_get_restore_context (void)
+{
+ static guint8 *start = NULL;
+ guint8 *code;
+
+ if (start)
+ return start;
+
+ /* restore_contect (struct sigcontext *ctx) */
+ /* we do not restore X86_EAX, X86_EDX */
+
+ start = code = g_malloc (1024);
+
+ /* load ctx */
+ x86_mov_reg_membase (code, X86_EAX, X86_ESP, 4, 4);
+
+ /* get return address, stored in EDX */
+ x86_mov_reg_membase (code, X86_EDX, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, eip), 4);
+ /* restore EBX */
+ x86_mov_reg_membase (code, X86_EBX, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, ebx), 4);
+ /* restore EDI */
+ x86_mov_reg_membase (code, X86_EDI, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, edi), 4);
+ /* restore ESI */
+ x86_mov_reg_membase (code, X86_ESI, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, esi), 4);
+ /* restore ESP */
+ x86_mov_reg_membase (code, X86_ESP, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, esp), 4);
+ /* restore EBP */
+ x86_mov_reg_membase (code, X86_EBP, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, ebp), 4);
+ /* restore ECX. the exception object is passed here to the catch handler */
+ x86_mov_reg_membase (code, X86_ECX, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, ecx), 4);
+
+ /* jump to the saved IP */
+ x86_jump_reg (code, X86_EDX);
+
+ return start;
+}
+
+/*
+ * arch_get_call_finally:
+ *
+ * Returns a pointer to a method which calls a finally handler.
+ */
+static gpointer
+arch_get_call_finally (void)
+{
+ static guint8 start [28];
+ static int inited = 0;
+ guint8 *code;
+
+ if (inited)
+ return start;
+
+ inited = 1;
+ /* call_finally (struct sigcontext *ctx, unsigned long eip) */
+ code = start;
+
+ x86_push_reg (code, X86_EBP);
+ x86_mov_reg_reg (code, X86_EBP, X86_ESP, 4);
+ x86_push_reg (code, X86_EBX);
+ x86_push_reg (code, X86_EDI);
+ x86_push_reg (code, X86_ESI);
+
+ /* load ctx */
+ x86_mov_reg_membase (code, X86_EAX, X86_EBP, 8, 4);
+ /* load eip */
+ x86_mov_reg_membase (code, X86_ECX, X86_EBP, 12, 4);
+ /* save EBP */
+ x86_push_reg (code, X86_EBP);
+ /* set new EBP */
+ x86_mov_reg_membase (code, X86_EBP, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, ebp), 4);
+ /* call the handler */
+ x86_call_reg (code, X86_ECX);
+ /* restore EBP */
+ x86_pop_reg (code, X86_EBP);
+ /* restore saved regs */
+ x86_pop_reg (code, X86_ESI);
+ x86_pop_reg (code, X86_EDI);
+ x86_pop_reg (code, X86_EBX);
+ x86_leave (code);
+ x86_ret (code);
+
+ g_assert ((code - start) < 28);
+ return start;
+}
+
+
+/**
+ * arch_handle_exception:
+ * @ctx: saved processor state
+ * @obj:
+ */
+void
+arch_handle_exception (struct sigcontext *ctx, gpointer obj)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoJitInfo *ji;
+ gpointer ip = (gpointer)ctx->eip;
+ static void (*restore_context) (struct sigcontext *);
+ static void (*call_finally) (struct sigcontext *, unsigned long);
+ void (*cleanup) (MonoObject *exc);
+
+ g_assert (ctx != NULL);
+ g_assert (obj != NULL);
+
+ ji = mono_jit_info_table_find (domain, ip);
+
+ if (!restore_context)
+ restore_context = arch_get_restore_context ();
+
+ if (!call_finally)
+ call_finally = arch_get_call_finally ();
+
+ cleanup = TlsGetValue (exc_cleanup_id);
+ g_assert (cleanup);
+
+ if (ji) { /* we are inside managed code */
+ MonoMethod *m = ji->method;
+ int offset = 2;
+
+ if (ji->num_clauses) {
+ int i;
+
+ g_assert (ji->clauses);
+
+ for (i = 0; i < ji->num_clauses; i++) {
+ MonoJitExceptionInfo *ei = &ji->clauses [i];
+
+ if (ei->try_start <= ip && ip <= (ei->try_end)) {
+ /* catch block */
+ if (ei->flags == 0 && mono_object_isinst (obj,
+ mono_class_get (m->klass->image, ei->token_or_filter))) {
+
+ ctx->eip = (unsigned long)ei->handler_start;
+ ctx->ecx = (unsigned long)obj;
+ restore_context (ctx);
+ g_assert_not_reached ();
+ }
+ }
+ }
+
+ /* no handler found - we need to call all finally handlers */
+ for (i = 0; i < ji->num_clauses; i++) {
+ MonoJitExceptionInfo *ei = &ji->clauses [i];
+
+ if (ei->try_start <= ip && ip < (ei->try_end) &&
+ (ei->flags & MONO_EXCEPTION_CLAUSE_FINALLY)) {
+ call_finally (ctx, (unsigned long)ei->handler_start);
+ }
+ }
+ }
+
+ if (mono_object_isinst (obj, mono_defaults.exception_class)) {
+ char *strace = mono_string_to_utf8 (((MonoException*)obj)->stack_trace);
+ char *tmp;
+
+ if (!strcmp (strace, "TODO: implement stack traces")){
+ g_free (strace);
+ strace = g_strdup ("");
+ }
+
+ tmp = g_strdup_printf ("%sin %s.%s:%s ()\n", strace, m->klass->name_space,
+ m->klass->name, m->name);
+
+ g_free (strace);
+
+ ((MonoException*)obj)->stack_trace = mono_string_new (domain, tmp);
+ g_free (tmp);
+ }
+
+ /* continue unwinding */
+
+ /* restore caller saved registers */
+ if (ji->used_regs & X86_ESI_MASK) {
+ ctx->esi = *((int *)ctx->ebp + offset);
+ offset++;
+ }
+ if (ji->used_regs & X86_EDI_MASK) {
+ ctx->edi = *((int *)ctx->ebp + offset);
+ offset++;
+ }
+ if (ji->used_regs & X86_EBX_MASK) {
+ ctx->ebx = *((int *)ctx->ebp + offset);
+ }
+
+ ctx->esp = ctx->ebp;
+ ctx->eip = *((int *)ctx->ebp + 1);
+ ctx->ebp = *((int *)ctx->ebp);
+
+ if (ctx->ebp < (unsigned)mono_end_of_stack)
+ arch_handle_exception (ctx, obj);
+ else
+ cleanup (obj);
+
+ } else {
+ gpointer *lmf_addr = TlsGetValue (lmf_thread_id);
+ MonoLMF *lmf;
+ MonoMethod *m;
+
+ g_assert (lmf_addr);
+ lmf = *((MonoLMF **)lmf_addr);
+
+ if (!lmf)
+ cleanup (obj);
+
+ m = lmf->method;
+
+ *lmf_addr = lmf->previous_lmf;
+
+ ctx->esi = lmf->esi;
+ ctx->edi = lmf->edi;
+ ctx->ebx = lmf->ebx;
+ ctx->ebp = lmf->ebp;
+ ctx->eip = lmf->eip;
+ ctx->esp = (unsigned long)&lmf->eip;
+
+ if (mono_object_isinst (obj, mono_defaults.exception_class)) {
+ char *strace = mono_string_to_utf8 (((MonoException*)obj)->stack_trace);
+ char *tmp;
+
+ if (!strcmp (strace, "TODO: implement stack traces"))
+ strace = g_strdup ("");
+
+ tmp = g_strdup_printf ("%sin (unmanaged) %s.%s:%s ()\n", strace, m->klass->name_space,
+ m->klass->name, m->name);
+
+ g_free (strace);
+
+ ((MonoException*)obj)->stack_trace = mono_string_new (domain, tmp);
+ g_free (tmp);
+ }
+
+ if (ctx->eip < (unsigned)mono_end_of_stack)
+ arch_handle_exception (ctx, obj);
+ else
+ cleanup (obj);
+ }
+
+ g_assert_not_reached ();
+}
+
+static void
+throw_exception (unsigned long eax, unsigned long ecx, unsigned long edx, unsigned long ebx,
+ unsigned long esi, unsigned long edi, unsigned long ebp, MonoObject *exc,
+ unsigned long eip, unsigned long esp)
+{
+ struct sigcontext ctx;
+
+ ctx.esp = esp;
+ ctx.eip = eip;
+ ctx.ebp = ebp;
+ ctx.edi = edi;
+ ctx.esi = esi;
+ ctx.ebx = ebx;
+ ctx.edx = edx;
+ ctx.ecx = ecx;
+ ctx.eax = eax;
+
+ arch_handle_exception (&ctx, exc);
+
+ g_assert_not_reached ();
+}
+
+/**
+ * arch_get_throw_exception:
+ *
+ * Returns a function pointer which can be used to raise
+ * exceptions. The returned function has the following
+ * signature: void (*func) (MonoException *exc);
+ * For example to raise an arithmetic exception you can use:
+ *
+ * x86_push_imm (code, mono_get_exception_arithmetic ());
+ * x86_call_code (code, arch_get_throw_exception ());
+ *
+ */
+gpointer
+arch_get_throw_exception (void)
+{
+ static guint8 start [24];
+ static int inited = 0;
+ guint8 *code;
+
+ if (inited)
+ return start;
+
+ inited = 1;
+ code = start;
+
+ x86_push_reg (code, X86_ESP);
+ x86_push_membase (code, X86_ESP, 4); /* IP */
+ x86_push_membase (code, X86_ESP, 12); /* exception */
+ x86_push_reg (code, X86_EBP);
+ x86_push_reg (code, X86_EDI);
+ x86_push_reg (code, X86_ESI);
+ x86_push_reg (code, X86_EBX);
+ x86_push_reg (code, X86_EDX);
+ x86_push_reg (code, X86_ECX);
+ x86_push_reg (code, X86_EAX);
+ x86_call_code (code, throw_exception);
+ /* we should never reach this breakpoint */
+ x86_breakpoint (code);
+
+ g_assert ((code - start) < 24);
+ return start;
+}
+
+/**
+ * arch_get_throw_exception_by_name:
+ *
+ * Returns a function pointer which can be used to raise
+ * corlib exceptions. The returned function has the following
+ * signature: void (*func) (char *exc_name);
+ * For example to raise an arithmetic exception you can use:
+ *
+ * x86_push_imm (code, "ArithmeticException");
+ * x86_call_code (code, arch_get_throw_exception ());
+ *
+ */
+gpointer
+arch_get_throw_exception_by_name ()
+{
+ static guint8 start [32];
+ static int inited = 0;
+ guint8 *code;
+
+ if (inited)
+ return start;
+
+ inited = 1;
+ code = start;
+
+ /* fixme: we do not save EAX, EDX, ECD - unsure if we need that */
+
+ x86_push_membase (code, X86_ESP, 4); /* exception name */
+ x86_push_imm (code, "System");
+ x86_push_imm (code, mono_defaults.exception_class->image);
+ x86_call_code (code, mono_exception_from_name);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 12);
+ /* save the newly create object (overwrite exception name)*/
+ x86_mov_membase_reg (code, X86_ESP, 4, X86_EAX, 4);
+ x86_jump_code (code, arch_get_throw_exception ());
+
+ g_assert ((code - start) < 32);
+
+ return start;
+}
diff --git a/mono/jit/interp.brg b/mono/jit/interp.brg
new file mode 100644
index 00000000000..8a17a139585
--- /dev/null
+++ b/mono/jit/interp.brg
@@ -0,0 +1,731 @@
+/*
+ * interp.brg: experimental interpreter code
+ *
+ * This is another approach for an interpreter. CIL is translated into another
+ * byte code which can be interpreted more efficiently. First measurements
+ * showed a quite good performance.
+ *
+ * We do not develop this further at the moment because of a lack of time.
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc. */
+
+#include <glib.h>
+#include <stdio.h>
+
+#include <mono/metadata/blob.h>
+#include <mono/metadata/metadata.h>
+#include <mono/metadata/loader.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/class.h>
+
+#include "mempool.h"
+
+#define MBTREE_TYPE MBTree
+#define MBCGEN_TYPE MBCodeGenStatus
+#define MBCOST_DATA MBCodeGenStatus
+#define MBALLOC_STATE mono_mempool_alloc (data->mp, sizeof (MBState))
+
+#define d(x)
+
+typedef struct _MonoInvocation MonoInvocation;
+
+typedef void (*MIntFunc) (MonoInvocation *frame);
+
+typedef struct {
+ MonoMemPool *mp;
+ guint8 *start;
+ guint8 *code;
+ GPtrArray *forest;
+} MBCodeGenStatus;
+
+typedef struct _MBTree MBTree;
+struct _MBTree {
+ guint16 op;
+ MBTree *left, *right;
+ gpointer state;
+ gpointer emit;
+
+ guint is_jump:1;
+ guint last_instr:1;
+ guint jump_target:1;
+
+ gint32 cli_addr; /* virtual cli address */
+ gint32 addr; /* address of emitted instruction */
+ gint32 first_addr; /* first code address of a tree */
+
+ gint32 size;
+
+ union {
+ gint32 i;
+ gint64 l;
+ gpointer p;
+ } data;
+};
+
+typedef struct {
+ union {
+ gint32 i;
+ gint64 l;
+ double f;
+ gpointer p;
+ } data;
+} stackval;
+
+struct _MonoInvocation {
+ MonoInvocation *parent; /* parent */
+ MonoInvocation *child;
+ MonoMethod *method; /* parent */
+ stackval *retval; /* parent */
+ void *obj; /* this - parent */
+ char *locals;
+ char *args;
+ stackval *stack;
+};
+
+typedef enum {
+ IC_CONST_I4,
+ IC_ADDR_L,
+ IC_ADDR_A,
+ IC_LDIND_I4,
+ IC_LDIND_LOC_I4,
+ IC_LDIND_ARG_I4,
+ IC_STIND_I4,
+ IC_STIND_LOC_I4,
+ IC_MUL_I4,
+ IC_ADD_I4,
+ IC_ADD_LOC_LOC_I4,
+ IC_SUB_I4,
+ IC_SUB_ARG_CI4,
+ IC_BR,
+ IC_BRTRUE_I4,
+ IC_BRTRUE_LOC_I4,
+ IC_BLT_I4,
+ IC_BEQ_I4,
+ IC_BGE_I4,
+ IC_BGE_I4_C,
+ IC_RET,
+ IC_RETV_I4,
+ IC_CALL_I4,
+ IC_PUSH_I4,
+} MIntCommands;
+
+#define INIT_FRAME(frame,parent_frame,obj_this,method_args,method_retval,mono_method) \
+ do { \
+ (frame)->parent = (parent_frame); \
+ (frame)->obj = (obj_this); \
+ (frame)->args = (method_args); \
+ (frame)->retval = (method_retval); \
+ (frame)->method = (mono_method); \
+ } while (0)
+
+#define COMMAND(c,name) do { *(c)++ = name; } while (0)
+
+#define MB_OPT_LEVEL 1
+
+#if MB_OPT_LEVEL == 0
+#define MB_USE_OPT1(c) 65535
+#define MB_USE_OPT2(c) 65535
+#endif
+#if MB_OPT_LEVEL == 1
+#define MB_USE_OPT1(c) c
+#define MB_USE_OPT2(c) 65535
+#endif
+#if MB_OPT_LEVEL >= 2
+#define MB_USE_OPT1(c) c
+#define MB_USE_OPT2(c) c
+#endif
+
+%%
+
+#
+# terminal definitions
+#
+
+# constatnts
+%term CONST_I4 CONST_I8 CONST_R4 CONST_R8
+%term LDIND_I1 LDIND_U1 LDIND_I2 LDIND_U2 LDIND_I4 LDIND_I8 LDIND_R4 LDIND_R8
+%term LDIND_U4
+%term STIND_I1 STIND_I2 STIND_I4 STIND_I8 STIND_R4 STIND_R8
+%term ADDR_L ADDR_A ADDR_G ARG ARG_END CALL_I4 CALL_I8 CALL_R8
+%term BREAK SWITCH BR RET RETV
+%term ADD SUB MUL DIV DIV_UN REM REM_UN AND OR XOR SHL SHR SHR_UN NEG NOT
+%term BLT BLT_UN BEQ BNE_UN BRTRUE BRFALSE BGE BGE_UN BLE BLE_UN BGT BGT_UN
+%term CONV_I4 CONV_I1 CONV_I2 CONV_I8 CONV_R8
+
+#
+# we start at stmt
+#
+%start stmt
+
+#
+# tree definitions
+#
+
+reg: CONST_I4 1 {
+ COMMAND (s->code, IC_CONST_I4);
+ *((gint32*)s->code)++ = tree->data.i;
+}
+
+# do nothing
+reg: CONV_I4 (reg)
+
+reg: ADDR_L 1 {
+ COMMAND (s->code, IC_ADDR_L);
+ *((gint32*)s->code)++ = tree->data.i;
+}
+
+reg: ADDR_A 1 {
+ COMMAND (s->code, IC_ADDR_A);
+ *((gint32*)s->code)++ = tree->data.i;
+}
+
+reg: LDIND_I4 (reg) {
+ COMMAND (s->code, IC_LDIND_I4);
+}
+
+reg: LDIND_I4 (ADDR_L) "MB_USE_OPT1(0)" {
+ COMMAND (s->code, IC_LDIND_LOC_I4);
+ *((gint32*)s->code)++ = tree->left->data.i;
+}
+
+reg: LDIND_I4 (ADDR_A) "MB_USE_OPT1(0)" {
+ COMMAND (s->code, IC_LDIND_ARG_I4);
+ *((gint32*)s->code)++ = tree->left->data.i;
+}
+
+reg: MUL (reg, reg) {
+ COMMAND (s->code, IC_MUL_I4);
+}
+
+
+reg: ADD (reg, reg) {
+ COMMAND (s->code, IC_ADD_I4);
+}
+
+reg: SUB (reg, reg) {
+ COMMAND (s->code, IC_SUB_I4);
+}
+
+# just an optimisations
+reg: SUB (LDIND_I4 (ADDR_A), CONST_I4) "MB_USE_OPT1(0)" {
+ COMMAND (s->code, IC_SUB_ARG_CI4);
+ *((gint32*)s->code)++ = tree->left->left->data.i;
+ *((gint32*)s->code)++ = tree->right->data.i;
+}
+
+stmt: STIND_I4 (reg, reg) {
+ COMMAND (s->code, IC_STIND_I4);
+}
+
+stmt: STIND_I4 (ADDR_L, reg) "MB_USE_OPT1(0)" {
+ COMMAND (s->code, IC_STIND_LOC_I4);
+ *((gint32*)s->code)++ = tree->left->data.i;
+}
+
+stmt: BR {
+ tree->is_jump = 1;
+
+ COMMAND (s->code, IC_BR);
+ *((gint32*)s->code)++ = tree->data.i - 5;
+}
+
+stmt: BLT (reg, reg) 1 {
+ tree->is_jump = 1;
+
+ COMMAND (s->code, IC_BLT_I4);
+ *((gint32*)s->code)++ = tree->data.i - 5;
+}
+
+stmt: BEQ (reg, reg) {
+ tree->is_jump = 1;
+
+ COMMAND (s->code, IC_BEQ_I4);
+ *((gint32*)s->code)++ = tree->data.i - 5;
+}
+
+stmt: BGE (reg, reg) 1 {
+ tree->is_jump = 1;
+
+ COMMAND (s->code, IC_BGE_I4);
+ *((gint32*)s->code)++ = tree->data.i - 5;
+}
+
+stmt: BGE (reg, CONST_I4) "MB_USE_OPT1(0)" {
+ tree->is_jump = 1;
+
+ COMMAND (s->code, IC_BGE_I4_C);
+ *((gint32*)s->code)++ = tree->right->data.i;
+ *((gint32*)s->code)++ = tree->data.i - 9;
+}
+
+stmt: BRTRUE (reg) 1 {
+ tree->is_jump = 1;
+
+ COMMAND (s->code, IC_BRTRUE_I4);
+ *((gint32*)s->code)++ = tree->data.i - 5;
+}
+
+stmt: BRTRUE (LDIND_I4 (ADDR_L)) "MB_USE_OPT1(0)" {
+ tree->is_jump = 1;
+
+ COMMAND (s->code, IC_BRTRUE_LOC_I4);
+ *((gint32*)s->code)++ = tree->left->left->data.i;
+ *((gint32*)s->code)++ = tree->data.i - 9;
+}
+
+stmt: RETV (reg) {
+ COMMAND (s->code, IC_RETV_I4);
+}
+
+stmt: RET {
+ COMMAND (s->code, IC_RET);
+}
+
+argl: ARG (argl, reg) {
+ COMMAND (s->code, IC_PUSH_I4);
+}
+
+argl: ARG_END
+
+reg: CALL_I4 (argl) {
+ COMMAND (s->code, IC_CALL_I4);
+ *((gint32*)s->code)++ = tree->data.i;
+}
+
+stmt: CALL_I4 (argl) {
+ COMMAND (s->code, IC_CALL_I4);
+ *((gint32*)s->code)++ = tree->data.i;
+}
+
+%%
+
+#include "jit.h"
+
+
+MBTree *
+mono_ctree_new (MonoMemPool *mp, int op, MBTree *left, MBTree *right)
+{
+ MBTree *t = mono_mempool_alloc0 (mp, sizeof (MBTree));
+
+ t->op = op;
+ t->left = left;
+ t->right = right;
+ t->cli_addr = -1;
+ return t;
+}
+
+MBTree *
+mono_ctree_new_leaf (MonoMemPool *mp, int op)
+{
+ return mono_ctree_new (mp, op, NULL, NULL);
+}
+
+static void
+interp_exec_method (MonoInvocation *frame)
+{
+ MonoInvocation child_frame;
+ MonoMethodHeader *header;
+ guint8 *ip, *ap, *args;
+ register stackval *sp;
+
+ d(printf ("EXEC METHOD %p\n", frame->args));
+
+ g_assert (frame->method->addr != NULL);
+
+ if (!frame->method->klass->inited)
+ mono_jit_init_class (frame->method->klass);
+
+ child_frame.parent = frame;
+
+ header = ((MonoMethodNormal *)frame->method)->header;
+
+ ip = frame->method->addr;
+
+ sp = frame->stack = alloca (sizeof (stackval) * header->max_stack);
+
+ args = ap = alloca (256); // fixme: use max args size
+
+ if (header->num_locals) {
+ frame->locals = alloca (header->locals_size);
+ memset (frame->locals, 0, header->locals_size);
+ frame->locals += header->locals_size;
+ }
+
+ while (1) {
+
+ switch (*ip++) {
+ case IC_CONST_I4: {
+ sp->data.i = *((gint32*)ip);
+ d(printf ("IC_CONST_I4 %d:\n", sp->data.i));
+ ip += 4;
+ sp++;
+ break;
+ }
+ case IC_ADDR_L: {
+ d(printf ("IC_ADDR_L: %p\n", sp));
+ sp->data.p = frame->locals + *((gint32*)ip);
+ ip += 4;
+ sp++;
+ break;
+ }
+ case IC_ADDR_A: {
+ sp->data.p = frame->args + *((gint32*)ip);
+ d(printf ("IC_ADDR_A: %p\n", sp->data.p));
+ ip += 4;
+ sp++;
+ break;
+ }
+ case IC_LDIND_I4: {
+ sp--;
+ sp->data.i = *(gint32*)sp->data.p;
+ d(printf ("IC_LDIND_I4: %p %d\n", sp->data.p, sp->data.i));
+ sp++;
+ break;
+ }
+ case IC_LDIND_LOC_I4: {
+ gint32 *p = (gint32 *)frame->locals + *((gint32*)ip);
+ sp->data.i = *p;
+ d(printf ("IC_LDIND_LOC_I4: %p %d\n", p, sp->data.i));
+ sp++;
+ ip += 4;
+ break;
+ }
+ case IC_LDIND_ARG_I4: {
+ gint32 *p = (gint32 *)frame->args + *((gint32*)ip);
+ sp->data.i = *p;
+ d(printf ("IC_LDIND_LOC_I4: %p %d\n", p, sp->data.i));
+ sp++;
+ ip += 4;
+ break;
+ }
+ case IC_STIND_I4: {
+ sp -= 2;
+ d(printf ("IC_STIND_I4: %p %d\n", sp->data.p, sp [1].data.i));
+ *(gint32*)sp->data.p = sp [1].data.i;
+ break;
+ }
+ case IC_STIND_LOC_I4: {
+ gint32 *p = (gint32 *)frame->locals + *((gint32*)ip);
+ sp -= 1;
+ d(printf ("IC_STIND_LOC_I4: %p %d\n", p, sp->data.i));
+ *p = sp->data.i;
+ ip += 4;
+ break;
+ }
+ case IC_MUL_I4: {
+ d(printf ("IC_MUL_I4:\n"));
+ g_assert_not_reached ();
+ break;
+ }
+ case IC_ADD_I4: {
+ sp -= 2;
+ sp->data.i = sp [0].data.i + sp [1].data.i;
+ d(printf ("IC_ADD_I4: %d\n", sp->data.i));
+ sp++;
+ break;
+ }
+ case IC_SUB_I4: {
+ sp -= 2;
+ sp->data.i = sp [0].data.i - sp [1].data.i;
+ d(printf ("IC_SUB_I4: %d\n", sp->data.i));
+ sp++;
+ break;
+ }
+ case IC_ADD_LOC_LOC_I4: {
+ gint32 *p1 = (gint32 *)frame->args + *((gint32*)ip);
+ gint32 *p2 = (gint32 *)frame->args + *((gint32*)ip+1);
+
+ sp->data.i = *p1 + *p2;
+ d(printf ("IC_ADD_LOC_LOC_I4: %d\n", sp->data.i));
+ sp++;
+ ip += 8;
+
+ break;
+ }
+ case IC_SUB_ARG_CI4: {
+ gint32 *p = (gint32 *)frame->args + *((gint32*)ip);
+ sp->data.i = *p - *(((gint32*)ip) + 1);
+ d(printf ("IC_SUB_ARG_CI4: %d\n", sp->data.i));
+ sp++;
+ ip += 8;
+
+ break;
+ }
+ case IC_BR: {
+ d(printf ("IC_BR:\n"));
+ ip += 4 + *((gint32*)ip);
+ break;
+ }
+ case IC_BLT_I4: {
+ d(printf ("IC_BLT_I4:\n"));
+ ip += 4;
+ g_assert_not_reached ();
+ break;
+ }
+ case IC_BRTRUE_I4: {
+ sp -= 1;
+ d(printf ("IC_BRTRUE_I4: (%d) %d\n", sp [0].data.i, *((gint32*)ip)));
+
+ if (sp [0].data.i)
+ ip += 4 + *((gint32*)ip);
+ else
+ ip += 4;
+ break;
+ }
+ case IC_BRTRUE_LOC_I4: {
+ gint32 *p = (gint32 *)frame->locals + *((gint32*)ip);
+
+ d(printf ("IC_BRTRUE_LOC_I4: %d %d\n", p, *((gint32*)ip+1)));
+
+ if (*p)
+ ip += 8 + *((gint32*)ip+1);
+ else
+ ip += 8;
+ break;
+ }
+ case IC_BEQ_I4: {
+ sp -= 2;
+ d(printf ("IC_BEQ_I4: (%d == %d) %d\n", sp [0].data.i, sp [1].data.i, *((gint32*)ip)));
+
+ if (sp [0].data.i == sp [1].data.i)
+ ip += 4 + *((gint32*)ip);
+ else
+ ip += 4;
+ break;
+ }
+ case IC_BGE_I4: {
+ sp -= 2;
+ d(printf ("IC_BGE_I4: (%d >= %d) %d\n", sp [0].data.i, sp [1].data.i, *((gint32*)ip)));
+
+ if (sp [0].data.i >= sp [1].data.i)
+ ip += 4 + *((gint32*)ip);
+ else
+ ip += 4;
+ break;
+ }
+ case IC_BGE_I4_C: {
+ sp--;
+ d(printf ("IC_BGE_I4: (%d >= %d) %d\n", sp [0].data.i,
+ *((gint32*)ip), *(((gint32*)ip) + 1)));
+ if (sp [0].data.i >= *((gint32*)ip))
+ ip += 8 + *(((gint32*)ip) + 1);
+ else
+ ip += 8;
+ break;
+ }
+ case IC_RET: {
+ d(printf ("IC_RET:\n"));
+ g_error ("RETURN");
+ break;
+ }
+ case IC_RETV_I4: {
+ --sp;
+ d(printf ("IC_RETV_I4: %d\n", sp->data.i));
+ frame->retval->data.i = sp->data.i;
+ return;
+ break;
+ }
+ case IC_PUSH_I4: {
+ sp--;
+ *((gint32*)ap) = sp->data.i;
+ d(printf ("IC_PUSH: %d\n", sp->data.i));
+ ap += 4;
+ break;
+ }
+ case IC_CALL_I4: {
+ MonoMethod *m = (MonoMethod *)*((gint32*)ip);
+ gpointer p;
+
+ if (!m->addr)
+ arch_compile_method (m);
+
+ p = sp [-1].data.p;
+
+ INIT_FRAME (&child_frame, NULL, NULL, args, sp, m);
+
+ interp_exec_method (&child_frame);
+ d(printf ("RESULT: %d\n", sp->data.i));
+ ap = args;
+
+ sp++;
+ ip += 4;
+ break;
+ }
+ default:
+ g_warning ("unknown interpreter opcode %d\n", *(ip -1));
+ g_assert_not_reached ();
+ break;
+ }
+
+ }
+}
+
+static gint32
+get_address (GPtrArray *forest, gint32 cli_addr, gint base, gint len)
+{
+ gint32 ind, pos;
+ MBTree *t1;
+
+ ind = (len / 2);
+ pos = base + ind;
+
+ /* skip trees with cli_addr == -1 */
+ while ((t1 = (MBTree *) g_ptr_array_index (forest, pos)) &&
+ t1->cli_addr == -1 && ind) {
+ ind--;
+ pos--;
+ }
+
+ if (t1->cli_addr == cli_addr) {
+ t1->jump_target = 1;
+ return t1->first_addr;
+ }
+
+ if (len <= 1)
+ return -1;
+
+ if (t1->cli_addr > cli_addr) {
+ return get_address (forest, cli_addr, base, ind);
+ } else {
+ ind = (len / 2);
+ return get_address (forest, cli_addr, base + ind, len - ind);
+ }
+}
+
+static void
+compute_branches (MBCodeGenStatus *s)
+{
+ GPtrArray *forest = s->forest;
+ const int top = forest->len;
+ gint32 addr;
+ guint8 *end;
+ int i;
+
+ end = s->code;
+
+ for (i = 0; i < top; i++) {
+ MBTree *t1 = (MBTree *) g_ptr_array_index (forest, i);
+
+ if (t1->is_jump) {
+
+ if ((i + 1) < forest->len) {
+ MBTree *t2 = (MBTree *) g_ptr_array_index (forest, i + 1);
+ t2->jump_target = 1;
+ }
+
+ addr = get_address (forest, t1->data.i, 0, forest->len);
+ if (addr == -1) {
+ g_error ("address 0x%x not found at IL_%04x",
+ t1->data.i, t1->cli_addr);
+ }
+ t1->data.i = addr - t1->addr;
+
+ /* emit the jump instruction again to update addresses */
+ s->code = s->start + t1->addr;
+ ((MBEmitFunc)t1->emit) (t1, s);
+
+ }
+ }
+
+ s->code = end;
+}
+
+static void
+tree_emit (int goal, MBCodeGenStatus *s, MBTree *tree)
+{
+ MBTree *kids[10];
+ int i, ern = mono_burg_rule (tree->state, goal);
+ guint16 *nts = mono_burg_nts [ern];
+
+ mono_burg_kids (tree, ern, kids);
+
+ for (i = 0; nts [i]; i++)
+ tree_emit (nts [i], s, kids [i]);
+
+ tree->addr = s->code - s->start;
+
+ if ((tree->emit = mono_burg_func [ern]))
+ ((MBEmitFunc)tree->emit) (tree, s);
+}
+
+static void
+forest_emit (MBCodeGenStatus *s)
+{
+ GPtrArray *forest = s->forest;
+ const int top = forest->len;
+ int i;
+
+ for (i = 0; i < top; i++) {
+ MBTree *t1 = (MBTree *) g_ptr_array_index (forest, i);
+ t1->first_addr = s->code - s->start;
+ tree_emit (1, s, t1);
+ }
+}
+
+static void
+emit_method (MonoMethod *method, MBCodeGenStatus *s)
+{
+ method->addr = s->start = s->code = g_malloc (1024);
+
+ if (mono_jit_dump_forest)
+ mono_print_forest (s->forest);
+
+ mono_jit_label_forest (s);
+
+ forest_emit (s);
+ compute_branches (s);
+
+
+ //if (mono_jit_dump_asm)
+ // mono_disassemble_code (s->start, s->code - s->start);
+}
+
+gpointer
+arch_compile_method (MonoMethod *method)
+{
+ MBCodeGenStatus cgstat;
+ MonoMemPool *mp = mono_mempool_new ();
+ guint locals_size;
+
+ g_assert (!(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL));
+ g_assert (!(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL));
+
+ printf ("Start JIT compilation of %s\n", method->name);
+
+ cgstat.forest = mono_create_forest (method, mp, &locals_size);
+ cgstat.code = NULL;
+ cgstat.mp = mp;
+
+ emit_method (method, &cgstat);
+
+ g_ptr_array_free (cgstat.forest, TRUE);
+
+ mono_mempool_destroy (mp);
+
+ return method->addr;
+}
+
+gpointer
+arch_create_jit_trampoline (MonoMethod *method)
+{
+
+ return NULL;
+}
+
+int
+arch_exec (MonoMethod *method)
+{
+ stackval result;
+ MonoInvocation call;
+
+ arch_compile_method (method);
+
+ INIT_FRAME (&call, NULL, NULL, NULL, &result, method);
+
+ interp_exec_method (&call);
+
+ return result.data.i;
+}
diff --git a/mono/jit/invoke.c b/mono/jit/invoke.c
new file mode 100644
index 00000000000..cab9a4cbb4a
--- /dev/null
+++ b/mono/jit/invoke.c
@@ -0,0 +1,606 @@
+/*
+ * invoke.c: runtime invoke code
+ *
+ * Authors:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/arch/x86/x86-codegen.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/profiler-private.h>
+
+#include "jit.h"
+#include "codegen.h"
+
+/*
+ * this returns a helper method to invoke a method with a user supplied
+ * stack frame. The returned method has the following signature:
+ * invoke_method_with_frame ((gpointer code, gpointer frame, int frame_size);
+ */
+static gpointer
+get_invoke_method_with_frame (void)
+{
+ static guint8 *start;
+ guint8 *code;
+
+ if (start)
+ return start;
+
+ start = code = g_malloc (64);
+
+ /* Prolog */
+ x86_push_reg (code, X86_EBP);
+ x86_mov_reg_reg (code, X86_EBP, X86_ESP, 4);
+ x86_push_reg (code, X86_EBX);
+ x86_push_reg (code, X86_EDI);
+ x86_push_reg (code, X86_ESI);
+
+ x86_mov_reg_membase (code, X86_EAX, X86_EBP, 16, 4);
+ x86_alu_reg_reg (code, X86_SUB, X86_ESP, X86_EAX);
+
+ x86_push_membase (code, X86_EBP, 16);
+ x86_push_membase (code, X86_EBP, 12);
+ x86_lea_membase (code, X86_EAX, X86_ESP, 2*4);
+ x86_push_reg (code, X86_EAX);
+ x86_call_code (code, memcpy);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 12);
+
+ x86_mov_reg_membase (code, X86_EAX, X86_EBP, 8, 4);
+ x86_call_reg (code, X86_EAX);
+
+ x86_mov_reg_membase (code, X86_ECX, X86_EBP, 16, 4);
+ x86_alu_reg_reg (code, X86_ADD, X86_ESP, X86_ECX);
+
+ /* Epilog */
+ x86_pop_reg (code, X86_ESI);
+ x86_pop_reg (code, X86_EDI);
+ x86_pop_reg (code, X86_EBX);
+ x86_leave (code);
+ x86_ret (code);
+
+ g_assert ((code - start) < 64);
+
+ return start;
+}
+
+/**
+ * arch_runtime_invoke:
+ * @method: the method to invoke
+ * @obj: this pointer
+ * @params: array of parameter values.
+ *
+ * TODO: very ugly piece of code. we should replace that with a method-specific
+ * trampoline (as suggested by Paolo).
+ */
+MonoObject*
+arch_runtime_invoke (MonoMethod *method, void *obj, void **params)
+{
+ static guint64 (*invoke_int64) (gpointer code, gpointer frame, int frame_size) = NULL;
+ static double (*invoke_double) (gpointer code, gpointer frame, int frame_size) = NULL;
+ MonoObject *retval;
+ MonoMethodSignature *sig;
+ int i, tmp, type, sp = 0;
+ void *ret;
+ int frame_size = 0;
+ gpointer *frame;
+ gpointer code;
+
+ sig = method->signature;
+
+ /* allocate ret object. */
+ if (sig->ret->type == MONO_TYPE_VOID) {
+ retval = NULL;
+ ret = NULL;
+ } else {
+ MonoClass *klass = mono_class_from_mono_type (sig->ret);
+ if (klass->valuetype) {
+ retval = mono_object_new (mono_domain_get (), klass);
+ ret = ((char*)retval) + sizeof (MonoObject);
+ } else {
+ ret = &retval;
+ }
+ }
+
+ if (ISSTRUCT (sig->ret))
+ frame_size += sizeof (gpointer);
+
+ if (sig->hasthis)
+ frame_size += sizeof (gpointer);
+
+ for (i = 0; i < sig->param_count; ++i) {
+ int align;
+ frame_size += mono_type_stack_size (sig->params [i], &align);
+ }
+
+ frame = alloca (frame_size);
+
+ if (ISSTRUCT (sig->ret))
+ frame [sp++] = ret;
+
+ if (sig->hasthis)
+ frame [sp++] = obj;
+
+
+ for (i = 0; i < sig->param_count; ++i) {
+ if (sig->params [i]->byref) {
+ frame [sp++] = params [i];
+ continue;
+ }
+ type = sig->params [i]->type;
+handle_enum:
+ switch (type) {
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_BOOLEAN:
+ tmp = *(MonoBoolean*)params [i];
+ frame [sp++] = (gpointer)tmp;
+ break;
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_CHAR:
+ tmp = *(gint16*)params [i];
+ frame [sp++] = (gpointer)tmp;
+ break;
+#if SIZEOF_VOID_P == 4
+ case MONO_TYPE_U:
+ case MONO_TYPE_I:
+#endif
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ frame [sp++] = (gpointer)*(gint32*)params [i];
+ break;
+#if SIZEOF_VOID_P == 8
+ case MONO_TYPE_U:
+ case MONO_TYPE_I:
+#endif
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8:
+ frame [sp++] = (gpointer)*(gint32*)params [i];
+ frame [sp++] = (gpointer)*(((gint32*)params [i]) + 1);
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->params [i]->data.klass->enumtype) {
+ type = sig->params [i]->data.klass->enum_basetype->type;
+ goto handle_enum;
+ } else {
+ g_warning ("generic valutype %s not handled in runtime invoke", sig->params [i]->data.klass->name);
+ }
+ break;
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_OBJECT:
+ frame [sp++] = params [i];
+ break;
+ default:
+ g_error ("type 0x%x not handled in arch_runtime_invoke", sig->params [i]->type);
+ }
+ }
+
+ code = arch_compile_method (method);
+
+ if (!invoke_int64)
+ invoke_int64 = (gpointer)invoke_double = get_invoke_method_with_frame ();
+
+ type = sig->ret->type;
+handle_enum_2:
+ switch (type) {
+ case MONO_TYPE_VOID:
+ invoke_int64 (code, frame, frame_size);
+ break;
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_CHAR:
+#if SIZEOF_VOID_P == 4
+ case MONO_TYPE_U:
+ case MONO_TYPE_I:
+#endif
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_STRING:
+ *((guint32 *)ret) = invoke_int64 (code, frame, frame_size);
+ break;
+#if SIZEOF_VOID_P == 8
+ case MONO_TYPE_U:
+ case MONO_TYPE_I:
+#endif
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8:
+ *((guint64 *)ret) = invoke_int64 (code, frame, frame_size);
+ break;
+ case MONO_TYPE_R4:
+ *((float *)ret) = invoke_double (code, frame, frame_size);
+ break;
+ case MONO_TYPE_R8:
+ *((double *)ret) = invoke_double (code, frame, frame_size);
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (sig->ret->data.klass->enumtype) {
+ type = sig->ret->data.klass->enum_basetype->type;
+ goto handle_enum_2;
+ } else {
+ invoke_int64 (code, frame, frame_size);
+ }
+ break;
+ default:
+ g_error ("return type 0x%x not handled in arch_runtime_invoke", type);
+ }
+
+ return retval;
+}
+
+/**
+ * arch_create_delegate_trampoline:
+ * @delegate: pointer to a Delegate object
+ *
+ * This trampoline is called when we invoke delegates from unmanaged code
+ */
+static gpointer
+arch_create_delegate_trampoline (MonoDelegate *delegate)
+{
+ MonoMethod *method, *invoke;
+ MonoMethodSignature *sig;
+ MonoClass *klass;
+ guint8 *code, *start, *invoke_code;
+ int i, align, arg_size = 0;;
+
+ if (!delegate)
+ return NULL;
+
+ /* fixme: add the delegate to a scanned hash
+ * so that is is never destroyed, or store
+ * this wrapper inside a new field in the delegate */
+
+ klass = ((MonoObject *)delegate)->vtable->klass;
+ g_assert (klass->delegate);
+
+ if (delegate->delegate_trampoline)
+ return delegate->delegate_trampoline;
+
+ method = delegate->method_info->method;
+ sig = method->signature;
+
+ if (sig->param_count) {
+ for (i = 0; i < sig->param_count; ++i)
+ arg_size += mono_type_stack_size (sig->params [i], &align);
+ }
+
+ invoke = 0;
+ for (i = 0; i < klass->method.count; ++i) {
+ if (klass->methods [i]->name[0] == 'I' &&
+ !strcmp ("Invoke", klass->methods [i]->name) &&
+ klass->methods [i]->signature->param_count == sig->param_count) {
+ invoke = klass->methods [i];
+ }
+ }
+ g_assert (invoke);
+ invoke_code = arch_compile_method (invoke);
+
+ /* fixme: when do we free this code ? */
+
+ code = start = g_malloc (64 + arg_size);
+
+ /* start of original frame */
+ x86_lea_membase (code, X86_ECX, X86_ESP, 4);
+
+ /* allocate stack frame */
+ x86_alu_reg_imm (code, X86_SUB, X86_ESP, arg_size);
+
+ /* fixme: mybe we need to transform char* to Strings */
+
+ /* memcopy activation frame to the stack */
+ x86_push_imm (code, arg_size);
+ x86_push_reg (code, X86_ECX);
+ x86_lea_membase (code, X86_ECX, X86_ESP, 8);
+ x86_push_reg (code, X86_ECX);
+ x86_call_code (code, memcpy);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 12);
+
+ /* call delegate invoke */
+ x86_push_imm (code, delegate);
+ x86_call_code (code, invoke_code);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, arg_size + 4);
+
+ x86_ret (code);
+
+ delegate->delegate_trampoline = start;
+
+ return start;
+}
+
+gpointer
+arch_create_native_wrapper (MonoMethod *method)
+{
+ MonoMethodSignature *csig = method->signature;
+ MonoJitInfo *ji;
+ guint8 *code, *start;
+ int i, align, locals = 0, arg_size = 0;
+ gboolean pinvoke = FALSE;
+ GList *free_list = NULL;
+ gboolean end_invoke = FALSE;
+
+ mono_profiler_method_jit (method);
+
+ if (!(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) &&
+ (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL))
+ pinvoke = TRUE;
+
+ /* compute the size of the activation frame */
+
+ if (csig->hasthis)
+ arg_size += sizeof (gpointer);
+
+ if (csig->ret->type == MONO_TYPE_VALUETYPE) {
+ g_assert (!csig->ret->byref);
+ arg_size += sizeof (gpointer);
+ }
+
+ for (i = 0; i < csig->param_count; ++i) {
+ arg_size += mono_type_stack_size (csig->params [i], &align);
+ if (pinvoke && (csig->params [i]->type == MONO_TYPE_STRING))
+ locals++;
+ if (pinvoke && (csig->params [i]->type == MONO_TYPE_OBJECT) &&
+ csig->params [i]->data.klass->delegate)
+ locals++;
+ }
+
+ start = code = g_malloc (512);
+
+ if (mono_jit_profile) {
+ x86_push_imm (code, method);
+ x86_mov_reg_imm (code, X86_EAX, mono_profiler_method_enter);
+ x86_call_reg (code, X86_EAX);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 4);
+ }
+
+ /* save LMF - the instruction pointer is already on the
+ * stack (return address) */
+
+ /* save all caller saved regs */
+ x86_push_reg (code, X86_EBX);
+ x86_push_reg (code, X86_EDI);
+ x86_push_reg (code, X86_ESI);
+ x86_push_reg (code, X86_EBP);
+
+ /* save method info */
+ x86_push_imm (code, method);
+
+ /* get the address of lmf for the current thread */
+ x86_call_code (code, arch_get_lmf_addr);
+ /* push lmf */
+ x86_push_reg (code, X86_EAX);
+ /* push *lfm (previous_lmf) */
+ x86_push_membase (code, X86_EAX, 0);
+ /* *(lmf) = ESP */
+ x86_mov_membase_reg (code, X86_EAX, 0, X86_ESP, 4);
+
+ if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME)) {
+ guint8 *l1, *l2;
+
+ if (method->klass->parent == mono_defaults.multicastdelegate_class &&
+ *method->name == 'E' && !strcmp (method->name, "EndInvoke"))
+ end_invoke = TRUE;
+
+ if (arg_size) {
+ /* repush all arguments */
+ /* load argument size -4 into ECX */
+ x86_mov_reg_imm (code, X86_ECX, (arg_size - 4));
+ /* load source address */
+ x86_lea_membase (code, X86_ESI, X86_ESP, sizeof (MonoLMF));
+ /* allocate destination */
+ x86_alu_reg_imm (code, X86_SUB, X86_ESP, arg_size);
+ /* load destination address */
+ x86_mov_reg_reg (code, X86_EDI, X86_ESP, 4);
+
+ l1 = code;
+ x86_mov_reg_memindex (code, X86_EAX, X86_ESI, 0, X86_ECX, 0, 4);
+ x86_mov_memindex_reg (code, X86_EDI, 0, X86_ECX, 0, X86_EAX, 4);
+ x86_alu_reg_imm (code, X86_SUB, X86_ECX, 4);
+ l2 = code;
+ x86_branch8 (code, X86_CC_GEZ, l1 - (l2 + 2), FALSE);
+ }
+
+ } else if (pinvoke) {
+ int offset = arg_size + (locals <<2) + sizeof (MonoLMF) - 4;
+ int l = 0;
+
+ /* allocate locals */
+ if (locals) {
+ x86_alu_reg_imm (code, X86_SUB, X86_ESP, (locals<<2));
+ x86_mov_reg_reg (code, X86_EBP, X86_ESP, 4);
+ }
+
+ for (i = csig->param_count - 1; i >= 0; i--) {
+ MonoType *t = csig->params [i];
+ int type;
+
+ if (t->byref) {
+ x86_push_membase (code, X86_ESP, offset);
+ continue;
+ }
+
+ type = t->type;
+enum_marshal:
+ switch (type) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_TYPEDBYREF:
+ case MONO_TYPE_R4:
+ x86_push_membase (code, X86_ESP, offset);
+ break;
+ case MONO_TYPE_FNPTR:
+ /* fixme: dont know when this is used */
+ g_assert_not_reached ();
+ break;
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ if (t->data.klass->delegate) {
+ x86_push_membase (code, X86_ESP, offset);
+ x86_call_code (code, arch_create_delegate_trampoline);
+ x86_mov_membase_reg (code, X86_ESP, 0, X86_EAX, 4);
+ } else
+ x86_push_membase (code, X86_ESP, offset);
+ break;
+ case MONO_TYPE_STRING:
+ x86_push_membase (code, X86_ESP, offset);
+ x86_call_code (code, mono_string_to_utf8);
+ x86_mov_membase_reg (code, X86_ESP, 0, X86_EAX, 4);
+ free_list = g_list_prepend (free_list, (gpointer)l);
+ x86_mov_membase_reg (code, X86_EBP, l, X86_EAX, 4);
+ l+= 4;
+ break;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R8:
+ x86_push_membase (code, X86_ESP, offset);
+ x86_push_membase (code, X86_ESP, offset);
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (t->data.klass->enumtype) {
+ type = t->data.klass->enum_basetype->type;
+ goto enum_marshal;
+ } else {
+ int j, size;
+ size = mono_type_stack_size (csig->params [i], &align);
+ size = size >> 2;
+ for (j = 0; j < size; j++)
+ x86_push_membase (code, X86_ESP, offset);
+ }
+ break;
+ default:
+ g_error ("type 0x%02x unknown", t->type);
+
+ }
+ }
+
+ if (csig->ret->type == MONO_TYPE_VALUETYPE) {
+ g_assert (!csig->ret->byref);
+ x86_push_membase (code, X86_ESP, offset);
+ }
+
+ if (csig->hasthis) {
+ x86_push_membase (code, X86_ESP, offset);
+ }
+
+ } else {
+ g_assert_not_reached ();
+ }
+
+ if (method->addr) {
+ /* special case EndInvoke - we pass the MonoMethod as first parameter */
+ if (end_invoke)
+ x86_push_imm (code, method);
+ /* call the native code */
+ x86_call_code (code, method->addr);
+ } else {
+ /* raise exception */
+ x86_push_imm (code, "NotImplementedException");
+ x86_call_code (code, arch_get_throw_exception_by_name ());
+ }
+
+ /* free pinvoke string args */
+ if (free_list) {
+ GList *l;
+
+ x86_push_reg (code, X86_EAX);
+ x86_push_reg (code, X86_EDX);
+
+ for (l = free_list; l; l = l->next) {
+ x86_push_membase (code, X86_EBP, ((int)l->data));
+ x86_call_code (code, g_free);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 4);
+ }
+
+ x86_pop_reg (code, X86_EDX);
+ x86_pop_reg (code, X86_EAX);
+
+ g_list_free (free_list);
+ }
+
+ /* remove arguments from stack */
+ if (arg_size || locals || end_invoke)
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, arg_size + (locals<<2) +
+ (end_invoke ? 4 : 0));
+
+ if (pinvoke && !csig->ret->byref && (csig->ret->type == MONO_TYPE_STRING)) {
+ /* If the argument is non-null, then convert the value back */
+ x86_alu_reg_reg (code, X86_OR, X86_EAX, X86_EAX);
+ x86_branch8 (code, X86_CC_EQ, 9, FALSE);
+ x86_push_reg (code, X86_EAX);
+ x86_call_code (code, mono_string_new_wrapper);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 4);
+ }
+
+ /* restore the LMF */
+
+ /* ebx = previous_lmf */
+ x86_pop_reg (code, X86_EBX);
+ /* edi = lmf */
+ x86_pop_reg (code, X86_EDI);
+ /* *(lmf) = previous_lmf */
+ x86_mov_membase_reg (code, X86_EDI, 0, X86_EBX, 4);
+
+ /* discard method info */
+ x86_pop_reg (code, X86_ESI);
+
+ /* restore caller saved regs */
+ x86_pop_reg (code, X86_EBP);
+ x86_pop_reg (code, X86_ESI);
+ x86_pop_reg (code, X86_EDI);
+ x86_pop_reg (code, X86_EBX);
+
+ if (mono_jit_profile) {
+ x86_push_reg (code, X86_EAX);
+ x86_push_reg (code, X86_EDX);
+ x86_push_imm (code, method);
+ x86_mov_reg_imm (code, X86_EAX, mono_profiler_method_leave);
+ x86_call_reg (code, X86_EAX);
+ x86_alu_reg_imm (code, X86_ADD, X86_ESP, 4);
+ x86_pop_reg (code, X86_EDX);
+ x86_pop_reg (code, X86_EAX);
+ }
+ x86_ret (code);
+
+ /* we store a dummy jit info (code size 4), so that mono_delegate_ctor
+ * is able to find a method info for icalls and pinvoke methods */
+ ji = mono_mempool_alloc0 (mono_root_domain->mp, sizeof (MonoJitInfo));
+ ji->method = method;
+ ji->code_start = start;
+ ji->code_size = 4;
+ ji->used_regs = 0;
+ ji->num_clauses = 0;
+ mono_jit_info_table_add (mono_root_domain, ji);
+
+ g_assert ((code - start) < 512);
+
+ mono_profiler_method_end_jit (method, MONO_PROFILE_OK);
+ return start;
+}
+
diff --git a/mono/jit/jit.c b/mono/jit/jit.c
new file mode 100644
index 00000000000..0a6b255c5b7
--- /dev/null
+++ b/mono/jit/jit.c
@@ -0,0 +1,3688 @@
+/*
+ * jit.c: The mono JIT compiler.
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#endif
+#include <glib.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <mono/metadata/verify.h>
+#include <mono/metadata/assembly.h>
+#include <mono/metadata/loader.h>
+#include <mono/metadata/cil-coff.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/object.h>
+#include <mono/metadata/debug-helpers.h>
+#include <mono/metadata/opcodes.h>
+#include <mono/metadata/mono-endian.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/metadata/threads.h>
+#include <mono/metadata/socket-io.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/arch/x86/x86-codegen.h>
+#include <mono/io-layer/io-layer.h>
+
+#include "jit.h"
+#include "regset.h"
+#include "codegen.h"
+#include "debug.h"
+
+/*
+ * Pull the list of opcodes
+ */
+#define OPDEF(a,b,c,d,e,f,g,h,i,j) \
+ a = i,
+
+enum {
+#include "mono/cil/opcode.def"
+ LAST = 0xff
+};
+#undef OPDEF
+
+#define SET_VARINFO(vi,t,k,o,s) do { vi.type=t; vi.kind=k; vi.offset=o; vi.size=s; } while (0)
+
+#define MAKE_CJUMP(name) \
+case CEE_##name: \
+case CEE_##name##_S: { \
+ gint32 target; \
+ int near_jump = *ip == CEE_##name##_S; \
+ ++ip; \
+ sp -= 2; \
+ t1 = mono_ctree_new (mp, MB_TERM_##name, sp [0], sp [1]); \
+ if (near_jump) \
+ target = cli_addr + 2 + (signed char) *ip; \
+ else \
+ target = cli_addr + 5 + (gint32) read32 (ip); \
+ g_assert (target >= 0 && target <= header->code_size); \
+ g_assert (bcinfo [target].is_block_start); \
+ tbb = &cfg->bblocks [bcinfo [target].block_id]; \
+ create_outstack (cfg, bb, stack, sp - stack); \
+ mark_reached (cfg, tbb, bb->outstack, bb->outdepth); \
+ t1->data.p = tbb; \
+ ADD_TREE (t1, cli_addr); \
+ ip += near_jump ? 1: 4; \
+ break; \
+}
+
+#define MAKE_BI_ALU(name) \
+case CEE_##name: { \
+ ++ip; \
+ sp -= 2; \
+ t1 = mono_ctree_new (mp, MB_TERM_##name, sp [0], sp [1]); \
+ PUSH_TREE (t1, sp [0]->svt); \
+ break; \
+}
+
+#define MAKE_CMP(cname) \
+case CEE_##cname: { \
+ ++ip; \
+ sp -= 2; \
+ t1 = mono_ctree_new (mp, MB_TERM_##cname, sp [0], sp [1]); \
+ PUSH_TREE (t1, VAL_I32); \
+ break; \
+}
+
+#define MAKE_SPILLED_BI_ALU(name) \
+case CEE_##name: { \
+ ++ip; \
+ sp -= 2; \
+ t1 = mono_ctree_new (mp, MB_TERM_##name, sp [0], sp [1]); \
+ t1->svt = sp [0]->svt; \
+ t1 = mono_store_tree (cfg, -1, t1, &t2); \
+ g_assert (t1); \
+ ADD_TREE (t1, cli_addr); \
+ PUSH_TREE (t2, t2->svt); \
+ break; \
+}
+
+#define MAKE_LDIND(name, op, svt) \
+case CEE_##name: { \
+ ++ip; \
+ sp--; \
+ t1 = mono_ctree_new (mp, op, *sp, NULL); \
+ PUSH_TREE (t1, svt); \
+ break; \
+}
+
+#define MAKE_LDELEM(name, op, svt, s) \
+case CEE_##name: { \
+ ++ip; \
+ sp -= 2; \
+ t1 = mono_ctree_new (mp, MB_TERM_LDELEMA, sp [0], sp [1]); \
+ t1->data.i = s; \
+ t1 = mono_ctree_new (mp, op, t1, NULL); \
+ PUSH_TREE (t1, svt); \
+ break; \
+}
+
+#define MAKE_LDELEM_OLD(name, op, svt, s) \
+case CEE_##name: { \
+ ++ip; \
+ sp -= 2; \
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4); \
+ t1->data.i = s; \
+ t1 = mono_ctree_new (mp, MB_TERM_MUL, sp [1], t1); \
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4); \
+ t2->data.i = G_STRUCT_OFFSET (MonoArray, vector); \
+ t2 = mono_ctree_new (mp, MB_TERM_ADD, sp [0], t2); \
+ t1 = mono_ctree_new (mp, MB_TERM_ADD, t1, t2); \
+ t1 = mono_ctree_new (mp, op, t1, NULL); \
+ PUSH_TREE (t1, svt); \
+ break; \
+}
+
+#define MAKE_STIND(name, op) \
+case CEE_##name: { \
+ ++ip; \
+ sp -= 2; \
+ t1 = mono_ctree_new (mp, op, sp [0], sp [1]); \
+ ADD_TREE (t1, cli_addr); \
+ break; \
+}
+
+#define MAKE_STELEM(name, op, s) \
+case CEE_##name: { \
+ ++ip; \
+ sp -= 3; \
+ t1 = mono_ctree_new (mp, MB_TERM_LDELEMA, sp [0], sp [1]); \
+ t1->data.i = s; \
+ t1 = mono_ctree_new (mp, op, t1, sp [2]); \
+ ADD_TREE (t1, cli_addr); \
+ break; \
+}
+
+#define MAKE_STELEM_OLD(name, op, s) \
+case CEE_##name: { \
+ ++ip; \
+ sp -= 3; \
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4); \
+ t1->data.i = s; \
+ t1 = mono_ctree_new (mp, MB_TERM_MUL, sp [1], t1); \
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4); \
+ t2->data.i = G_STRUCT_OFFSET (MonoArray, vector); \
+ t2 = mono_ctree_new (mp, MB_TERM_ADD, sp [0], t2); \
+ t1 = mono_ctree_new (mp, MB_TERM_ADD, t1, t2); \
+ t1 = mono_ctree_new (mp, op, t1, sp [2]); \
+ ADD_TREE (t1, cli_addr); \
+ break; \
+}
+
+typedef struct {
+ MonoMethod *method;
+ MBTree **arg_map;
+ const unsigned char *end, *saved_ip;
+ MonoImage *saved_image;
+} MonoInlineInfo;
+
+/* Whether to dump the assembly code after genreating it */
+gboolean mono_jit_dump_asm = FALSE;
+
+/* Whether to dump the forest */
+gboolean mono_jit_dump_forest = FALSE;
+
+/* Whether to print function call traces */
+gboolean mono_jit_trace_calls = FALSE;
+
+/* Whether to insert in the code profile callbacks */
+gboolean mono_jit_profile = FALSE;
+
+/* Force jit to share code between application domains */
+gboolean mono_jit_share_code = FALSE;
+
+/* inline code */
+gboolean mono_jit_inline_code = TRUE;
+
+/* maximum number of worker threads */
+int mono_worker_threads = 1;
+
+MonoDebugHandle *mono_debug_handle = NULL;
+GList *mono_debug_methods = NULL;
+
+/* If non-zero, insert a breakpoint when compiling the next method.
+ * If positive, interpret this variable as a counter and decrement
+ * it after setting the breakpoint. */
+int mono_debug_insert_breakpoint = 0;
+
+/* This is the address of the last breakpoint which was inserted. */
+gchar *mono_debug_last_breakpoint_address = NULL;
+
+gpointer mono_end_of_stack = NULL;
+
+/* last managed frame (used by pinvoke) */
+guint32 lmf_thread_id = 0;
+
+/* used to store a function pointer called after uncatched exceptions */
+guint32 exc_cleanup_id = 0;
+
+/* stores a pointer to async result used by exceptions */
+guint32 async_result_id = 0;
+
+MonoJitStats mono_jit_stats;
+
+CRITICAL_SECTION *metadata_section = NULL;
+
+/*
+ * We sometimes need static data, for example the forest generator need it to
+ * store constants or class data.
+ */
+inline static gpointer
+mono_alloc_static (int size)
+{
+ return g_malloc (size);
+}
+inline static gpointer
+mono_alloc_static0 (int size)
+{
+ return g_malloc0 (size);
+}
+
+typedef void (*MonoCCtor) (void);
+
+static int
+map_store_svt_type (int svt)
+{
+ switch (svt) {
+ case VAL_I32:
+ return MB_TERM_STIND_I4;
+ case VAL_POINTER:
+ return MB_TERM_STIND_REF;
+ case VAL_I64:
+ return MB_TERM_STIND_I8;
+ case VAL_DOUBLE:
+ return MB_TERM_STIND_R8;
+ default:
+ g_assert_not_reached ();
+ }
+
+ return 0;
+}
+
+/**
+ * map_stind_type:
+ * @type: the type to map
+ *
+ * Translates the MonoType @type into the corresponding store opcode
+ * for the code generator.
+ */
+static int
+map_stind_type (MonoType *type)
+{
+ if (type->byref)
+ return MB_TERM_STIND_REF;
+
+ switch (type->type) {
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_BOOLEAN:
+ return MB_TERM_STIND_I1;
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ return MB_TERM_STIND_I2;
+ case MONO_TYPE_I:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ return MB_TERM_STIND_I4;
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ return MB_TERM_STIND_REF;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ return MB_TERM_STIND_I8;
+ case MONO_TYPE_R4:
+ return MB_TERM_STIND_R4;
+ case MONO_TYPE_R8:
+ return MB_TERM_STIND_R8;
+ case MONO_TYPE_VALUETYPE:
+ if (type->data.klass->enumtype)
+ return map_stind_type (type->data.klass->enum_basetype);
+ else
+ return MB_TERM_STIND_OBJ;
+ default:
+ g_warning ("unknown type %02x", type->type);
+ g_assert_not_reached ();
+ }
+
+ g_assert_not_reached ();
+ return -1;
+}
+
+/**
+ * map_remote_stind_type:
+ * @type: the type to map
+ *
+ * Translates the MonoType @type into the corresponding remote store opcode
+ * for the code generator.
+ */
+static int
+map_remote_stind_type (MonoType *type)
+{
+ if (type->byref) {
+ return MB_TERM_REMOTE_STIND_REF;
+ }
+
+ switch (type->type) {
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_BOOLEAN:
+ return MB_TERM_REMOTE_STIND_I1;
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ return MB_TERM_REMOTE_STIND_I2;
+ case MONO_TYPE_I:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ return MB_TERM_REMOTE_STIND_I4;
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ return MB_TERM_REMOTE_STIND_REF;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ return MB_TERM_REMOTE_STIND_I8;
+ case MONO_TYPE_R4:
+ return MB_TERM_REMOTE_STIND_R4;
+ case MONO_TYPE_R8:
+ return MB_TERM_REMOTE_STIND_R8;
+ case MONO_TYPE_VALUETYPE:
+ if (type->data.klass->enumtype)
+ return map_remote_stind_type (type->data.klass->enum_basetype);
+ else
+ return MB_TERM_REMOTE_STIND_OBJ;
+ default:
+ g_warning ("unknown type %02x", type->type);
+ g_assert_not_reached ();
+ }
+
+ g_assert_not_reached ();
+ return -1;
+}
+
+static int
+map_starg_type (MonoType *type)
+{
+ if (type->byref)
+ return MB_TERM_STIND_REF;
+
+ switch (type->type) {
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ return MB_TERM_STIND_I4;
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ return MB_TERM_STIND_REF;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ return MB_TERM_STIND_I8;
+ case MONO_TYPE_R4:
+ return MB_TERM_STIND_R4;
+ case MONO_TYPE_R8:
+ return MB_TERM_STIND_R8;
+ case MONO_TYPE_VALUETYPE:
+ if (type->data.klass->enumtype)
+ return map_starg_type (type->data.klass->enum_basetype);
+ else
+ return MB_TERM_STIND_OBJ;
+ default:
+ g_warning ("unknown type %02x", type->type);
+ g_assert_not_reached ();
+ }
+
+ g_assert_not_reached ();
+ return -1;
+}
+
+static int
+map_arg_type (MonoType *type)
+{
+ if (type->byref)
+ return MB_TERM_ARG_I4;
+
+ switch (type->type) {
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ return MB_TERM_ARG_I4;
+ case MONO_TYPE_STRING:
+ return MB_TERM_ARG_I4;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ return MB_TERM_ARG_I8;
+ case MONO_TYPE_R4:
+ return MB_TERM_ARG_R4;
+ case MONO_TYPE_R8:
+ return MB_TERM_ARG_R8;
+ case MONO_TYPE_VALUETYPE:
+ if (type->data.klass->enumtype)
+ return map_arg_type (type->data.klass->enum_basetype);
+ else
+ return MB_TERM_ARG_OBJ;
+ default:
+ g_warning ("unknown type %02x", type->type);
+ g_assert_not_reached ();
+ }
+
+ g_assert_not_reached ();
+ return -1;
+}
+
+/**
+ * map_ldind_type:
+ * @type: the type to map
+ *
+ * Translates the MonoType @type into the corresponding load opcode
+ * for the code generator.
+ */
+static int
+map_ldind_type (MonoType *type, MonoValueType *svt)
+{
+ if (type->byref) {
+ *svt = VAL_POINTER;
+ return MB_TERM_LDIND_REF;
+ }
+
+ switch (type->type) {
+ case MONO_TYPE_I1:
+ *svt = VAL_I32;
+ return MB_TERM_LDIND_I1;
+ case MONO_TYPE_U1:
+ case MONO_TYPE_BOOLEAN:
+ *svt = VAL_I32;
+ return MB_TERM_LDIND_U1;
+ case MONO_TYPE_I2:
+ *svt = VAL_I32;
+ return MB_TERM_LDIND_I2;
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ *svt = VAL_I32;
+ return MB_TERM_LDIND_U2;
+ case MONO_TYPE_I:
+ case MONO_TYPE_I4:
+ *svt = VAL_I32;
+ return MB_TERM_LDIND_I4;
+ case MONO_TYPE_U4:
+ *svt = VAL_I32;
+ return MB_TERM_LDIND_U4;
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ *svt = VAL_POINTER;
+ return MB_TERM_LDIND_REF;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ *svt = VAL_I64;
+ return MB_TERM_LDIND_I8;
+ case MONO_TYPE_R4:
+ *svt = VAL_DOUBLE;
+ return MB_TERM_LDIND_R4;
+ case MONO_TYPE_R8:
+ *svt = VAL_DOUBLE;
+ return MB_TERM_LDIND_R8;
+ case MONO_TYPE_VALUETYPE:
+ if (type->data.klass->enumtype) {
+ return map_ldind_type (type->data.klass->enum_basetype, svt);
+ } else {
+ *svt = VAL_UNKNOWN;
+ return MB_TERM_LDIND_OBJ;
+ }
+ default:
+ g_warning ("unknown type %02x", type->type);
+ g_assert_not_reached ();
+ }
+
+ g_assert_not_reached ();
+ return -1;
+}
+
+static int
+map_ldarg_type (MonoType *type, MonoValueType *svt)
+{
+ if (type->byref) {
+ *svt = VAL_POINTER;
+ return MB_TERM_LDIND_REF;
+ }
+
+ switch (type->type) {
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ *svt = VAL_I32;
+ return MB_TERM_LDIND_U4;
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ *svt = VAL_POINTER;
+ return MB_TERM_LDIND_U4;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ *svt = VAL_I64;
+ return MB_TERM_LDIND_I8;
+ case MONO_TYPE_R4:
+ *svt = VAL_DOUBLE;
+ return MB_TERM_LDIND_R4;
+ case MONO_TYPE_R8:
+ *svt = VAL_DOUBLE;
+ return MB_TERM_LDIND_R8;
+ case MONO_TYPE_VALUETYPE:
+ if (type->data.klass->enumtype) {
+ return map_ldarg_type (type->data.klass->enum_basetype, svt);
+ } else {
+ *svt = VAL_UNKNOWN;
+ return MB_TERM_LDIND_OBJ;
+ }
+ default:
+ g_warning ("unknown type %02x", type->type);
+ g_assert_not_reached ();
+ }
+
+ g_assert_not_reached ();
+ return -1;
+}
+
+/**
+ * map_call_type:
+ * @type: the type to map
+ *
+ * Translates the MonoType @type into the corresponding call opcode
+ * for the code generator.
+ */
+static int
+map_call_type (MonoType *type, MonoValueType *svt)
+{
+ if (type->byref)
+ return MB_TERM_CALL_I4;
+
+ switch (type->type) {
+ case MONO_TYPE_VOID:
+ *svt = VAL_UNKNOWN;
+ return MB_TERM_CALL_VOID;
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ *svt = VAL_I32;
+ return MB_TERM_CALL_I4;
+ case MONO_TYPE_VALUETYPE:
+ if (type->data.klass->enumtype) {
+ return map_call_type (type->data.klass->enum_basetype, svt);
+ } else {
+ *svt = VAL_I32;
+ return MB_TERM_CALL_VOID;
+ }
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ *svt = VAL_POINTER;
+ return MB_TERM_CALL_I4;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ *svt = VAL_I64;
+ return MB_TERM_CALL_I8;
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ *svt = VAL_DOUBLE;
+ return MB_TERM_CALL_R8;
+ default:
+ g_warning ("unknown type %02x", type->type);
+ g_assert_not_reached ();
+ }
+
+ g_assert_not_reached ();
+ return -1;
+}
+
+/*
+ * prints the tree to stdout
+ */
+void
+mono_print_ctree (MBTree *tree)
+{
+ int arity;
+
+ if (!tree)
+ return;
+
+ arity = (tree->left != NULL) + (tree->right != NULL);
+
+ if (arity)
+ printf (" (%s", mono_burg_term_string [tree->op]);
+ else
+ printf (" %s", mono_burg_term_string [tree->op]);
+
+ switch (tree->op) {
+ case MB_TERM_CONST_I4:
+ case MB_TERM_ADDR_L:
+ printf ("[%d]", tree->data.i);
+ break;
+ }
+
+ g_assert (!(tree->right && !tree->left));
+
+ mono_print_ctree (tree->left);
+ mono_print_ctree (tree->right);
+
+ if (arity)
+ printf (")");
+}
+
+/*
+ * prints the whole forest to stdout
+ */
+void
+mono_print_forest (GPtrArray *forest)
+{
+ const int top = forest->len;
+ int i;
+
+ for (i = 0; i < top; i++) {
+ MBTree *t = (MBTree *) g_ptr_array_index (forest, i);
+ printf (" ");
+ mono_print_ctree (t);
+ printf ("\n");
+ }
+
+}
+
+/**
+ * mono_disassemble_code:
+ * @code: a pointer to the code
+ * @size: the code size in bytes
+ *
+ * Disassemble to code to stdout.
+ */
+void
+mono_disassemble_code (guint8 *code, int size, char *id)
+{
+ int i;
+ FILE *ofd;
+
+ if (!(ofd = fopen ("/tmp/test.s", "w")))
+ g_assert_not_reached ();
+
+ fprintf (ofd, "%s:\n", id);
+
+ for (i = 0; i < size; ++i)
+ fprintf (ofd, ".byte %d\n", (unsigned int) code [i]);
+
+ fclose (ofd);
+
+ system ("as /tmp/test.s -o /tmp/test.o;objdump -d /tmp/test.o");
+}
+
+static int
+arch_allocate_var (MonoFlowGraph *cfg, int size, int align, MonoValueKind kind, MonoValueType type)
+{
+ MonoVarInfo vi;
+
+ mono_jit_stats.allocate_var++;
+
+ switch (kind) {
+ case MONO_TEMPVAR:
+ case MONO_LOCALVAR: {
+ cfg->locals_size += size;
+ cfg->locals_size += align - 1;
+ cfg->locals_size &= ~(align - 1);
+
+ SET_VARINFO (vi, type, kind, - cfg->locals_size, size);
+ g_array_append_val (cfg->varinfo, vi);
+ break;
+ }
+ case MONO_ARGVAR: {
+ int arg_start = 8 + cfg->has_vtarg*4;
+
+ g_assert ((align & 3) == 0);
+
+ SET_VARINFO (vi, type, kind, cfg->args_size + arg_start, size);
+ g_array_append_val (cfg->varinfo, vi);
+
+ cfg->args_size += size;
+ cfg->args_size += 3;
+ cfg->args_size &= ~3;
+ break;
+ }
+ default:
+ g_assert_not_reached ();
+ }
+
+ return cfg->varinfo->len - 1;
+}
+
+inline static void
+mono_get_val_sizes (MonoValueType type, int *size, int *align)
+{
+ switch (type) {
+ case VAL_I32:
+ *size = *align = sizeof (gint32);
+ break;
+ case VAL_I64:
+ *size = *align = sizeof (gint64);
+ break;
+ case VAL_POINTER:
+ *size = *align = sizeof (gpointer);
+ break;
+ case VAL_DOUBLE:
+ *size = *align = sizeof (double);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+}
+
+static int
+mono_allocate_intvar (MonoFlowGraph *cfg, int slot, MonoValueType type)
+{
+ int size, align, vnum, pos;
+
+ g_assert (type != VAL_UNKNOWN);
+
+ /* take care if you modify MonoValueType */
+ g_assert (VAL_DOUBLE == 4);
+
+ /* fixme: machine dependant */
+ if (type == VAL_POINTER)
+ type = VAL_I32; /* VAL_I32 and VAL_POINTER share the same slot */
+
+ pos = type - 1 + slot * VAL_DOUBLE;
+
+ if ((vnum = cfg->intvars [pos]))
+ return vnum;
+ mono_get_val_sizes (type, &size, &align);
+
+ cfg->intvars[pos] = arch_allocate_var (cfg, size, align, MONO_TEMPVAR, type);
+
+ return cfg->intvars[pos];
+}
+
+static int
+mono_allocate_excvar (MonoFlowGraph *cfg)
+{
+ if (cfg->excvar)
+ return cfg->excvar;
+
+ cfg->excvar = arch_allocate_var (cfg, 4, 4, MONO_TEMPVAR, VAL_POINTER);
+
+ return cfg->excvar;
+}
+
+
+/**
+ * ctree_create_load:
+ * @cfg: pointer to the control flow graph
+ * @type: the type of the value to load
+ * @addr: the address of the value
+ *
+ * Creates a tree to load the value at address @addr.
+ */
+inline static MBTree *
+ctree_create_load (MonoFlowGraph *cfg, MonoType *type, MBTree *addr, MonoValueType *svt, gboolean arg)
+{
+ MonoMemPool *mp = cfg->mp;
+ int ldind;
+ MBTree *t;
+
+ if (arg)
+ ldind = map_ldarg_type (type, svt);
+ else
+ ldind = map_ldind_type (type, svt);
+
+ t = mono_ctree_new (mp, ldind, addr, NULL);
+
+ return t;
+}
+
+/**
+ * ctree_create_store:
+ * @mp: pointer to a memory pool
+ * @addr_type: address type (MB_TERM_ADDR_L or MB_TERM_ADDR_G)
+ * @s: the value (tree) to store
+ * @type: the type of the value
+ * @addr: the address of the value
+ *
+ * Creates a tree to store the value @s at address @addr.
+ */
+inline static MBTree *
+ctree_create_store (MonoFlowGraph *cfg, MonoType *type, MBTree *addr,
+ MBTree *s, gboolean arg)
+{
+ MonoMemPool *mp = cfg->mp;
+ int stind;
+ MBTree *t;
+
+ if (arg)
+ stind = map_starg_type (type);
+ else
+ stind = map_stind_type (type);
+
+ t = mono_ctree_new (mp, stind, addr, s);
+
+ if (ISSTRUCT (type))
+ t->data.i = mono_class_value_size (type->data.klass, NULL);
+
+ return t;
+}
+
+inline static MBTree *
+ctree_dup_address (MonoMemPool *mp, MBTree *s)
+{
+ MBTree *t;
+
+ switch (s->op) {
+
+ case MB_TERM_ADDR_L:
+ case MB_TERM_ADDR_G:
+ t = mono_ctree_new_leaf (mp, s->op);
+ t->data.i = s->data.i;
+ t->svt = VAL_POINTER;
+ return t;
+ default:
+ g_warning ("unknown tree opcode %d", s->op);
+ g_assert_not_reached ();
+ }
+
+ return NULL;
+}
+
+/**
+ * Create a duplicate of the value of a tree. This is
+ * easy for trees starting with LDIND/STIND, since the
+ * duplicate is simple a LDIND tree with the same address.
+ * For other trees we have to split the tree into one tree
+ * storing the value to a new temporary variable, and
+ * another tree which loads that value back. We can then
+ * duplicate the second tree.
+ */
+static MBTree *
+ctree_create_dup (MonoMemPool *mp, MBTree *s)
+{
+ MBTree *t;
+
+ switch (s->op) {
+ case MB_TERM_STIND_I1:
+ case MB_TERM_LDIND_I1:
+ t = ctree_dup_address (mp, s->left);
+ t = mono_ctree_new (mp, MB_TERM_LDIND_I1, t, NULL);
+ t->svt = VAL_I32;
+ break;
+ case MB_TERM_STIND_I2:
+ case MB_TERM_LDIND_I2:
+ t = ctree_dup_address (mp, s->left);
+ t = mono_ctree_new (mp, MB_TERM_LDIND_I2, t, NULL);
+ t->svt = VAL_I32;
+ break;
+ case MB_TERM_STIND_REF:
+ case MB_TERM_LDIND_REF:
+ t = ctree_dup_address (mp, s->left);
+ t = mono_ctree_new (mp, MB_TERM_LDIND_REF, t, NULL);
+ t->svt = VAL_POINTER;
+ break;
+ case MB_TERM_STIND_I4:
+ case MB_TERM_LDIND_I4:
+ t = ctree_dup_address (mp, s->left);
+ t = mono_ctree_new (mp, MB_TERM_LDIND_I4, t, NULL);
+ t->svt = VAL_I32;
+ break;
+ case MB_TERM_LDIND_U4:
+ t = ctree_dup_address (mp, s->left);
+ t = mono_ctree_new (mp, MB_TERM_LDIND_U4, t, NULL);
+ t->svt = VAL_I32;
+ break;
+ case MB_TERM_STIND_I8:
+ case MB_TERM_LDIND_I8:
+ t = ctree_dup_address (mp, s->left);
+ t = mono_ctree_new (mp, MB_TERM_LDIND_I8, t, NULL);
+ t->svt = VAL_I64;
+ break;
+ case MB_TERM_STIND_R4:
+ case MB_TERM_LDIND_R4:
+ t = ctree_dup_address (mp, s->left);
+ t = mono_ctree_new (mp, MB_TERM_LDIND_R4, t, NULL);
+ t->svt = VAL_DOUBLE;
+ break;
+ case MB_TERM_STIND_R8:
+ case MB_TERM_LDIND_R8:
+ t = ctree_dup_address (mp, s->left);
+ t = mono_ctree_new (mp, MB_TERM_LDIND_R8, t, NULL);
+ t->svt = VAL_DOUBLE;
+ break;
+ default:
+ g_warning ("unknown op \"%s\"", mono_burg_term_string [s->op]);
+ g_assert_not_reached ();
+ }
+
+ return t;
+}
+
+static MBTree *
+mono_store_tree (MonoFlowGraph *cfg, int slot, MBTree *s, MBTree **tdup)
+{
+ MonoMemPool *mp = cfg->mp;
+ MBTree *t;
+ int vnum = 0;
+
+ switch (s->op) {
+ case MB_TERM_STIND_I1:
+ case MB_TERM_LDIND_I1:
+ case MB_TERM_STIND_I2:
+ case MB_TERM_LDIND_I2:
+ case MB_TERM_STIND_I4:
+ case MB_TERM_LDIND_I4:
+ case MB_TERM_STIND_REF:
+ case MB_TERM_LDIND_REF:
+ case MB_TERM_STIND_I8:
+ case MB_TERM_LDIND_I8:
+ case MB_TERM_STIND_R4:
+ case MB_TERM_LDIND_R4:
+ case MB_TERM_STIND_R8:
+ case MB_TERM_LDIND_R8: {
+ if (slot >= 0) {
+ vnum = mono_allocate_intvar (cfg, slot, s->svt);
+
+ if (s->left->op == MB_TERM_ADDR_L && s->left->data.i == vnum) {
+ if (tdup)
+ *tdup = ctree_create_dup (mp, s);
+ return NULL;
+ }
+ // fall through
+ } else {
+ if (tdup)
+ *tdup = ctree_create_dup (mp, s);
+ return NULL;
+ }
+ }
+ default: {
+ g_assert (s->svt != VAL_UNKNOWN);
+
+ if (slot >= 0) {
+ vnum = mono_allocate_intvar (cfg, slot, s->svt);
+ } else {
+ int size, align;
+ mono_get_val_sizes (s->svt, &size, &align);
+ vnum = arch_allocate_var (cfg, size, align, MONO_TEMPVAR, s->svt);
+ }
+
+ t = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t->data.i = vnum;
+
+ t = mono_ctree_new (mp, map_store_svt_type (s->svt), t, s);
+ t->svt = s->svt;
+ }
+ }
+
+ if (tdup)
+ mono_store_tree (cfg, -1, t, tdup);
+
+ return t;
+}
+
+MonoFlowGraph *
+mono_cfg_new (MonoMethod *method, MonoMemPool *mp)
+{
+ MonoVarInfo vi;
+ MonoFlowGraph *cfg;
+
+ g_assert (((MonoMethodNormal *)method)->header);
+
+ cfg = mono_mempool_alloc0 (mp, sizeof (MonoFlowGraph));
+
+ cfg->domain = mono_domain_get ();
+ cfg->method = method;
+ cfg->mp = mp;
+
+ /* fixme: we should also consider loader optimisation attributes */
+ cfg->share_code = mono_jit_share_code;
+
+ cfg->varinfo = g_array_new (FALSE, TRUE, sizeof (MonoVarInfo));
+
+ SET_VARINFO (vi, 0, 0, 0, 0);
+ g_array_append_val (cfg->varinfo, vi); /* add invalid value at position 0 */
+
+ cfg->intvars = mono_mempool_alloc0 (mp, sizeof (guint16) * VAL_DOUBLE *
+ ((MonoMethodNormal *)method)->header->max_stack);
+ return cfg;
+}
+
+void
+mono_cfg_free (MonoFlowGraph *cfg)
+{
+ int i;
+
+ for (i = 0; i < cfg->block_count; i++) {
+ if (!cfg->bblocks [i].reached)
+ continue;
+ g_ptr_array_free (cfg->bblocks [i].forest, TRUE);
+ }
+
+ if (cfg->bcinfo)
+ g_free (cfg->bcinfo);
+
+ if (cfg->bblocks)
+ g_free (cfg->bblocks);
+
+ g_array_free (cfg->varinfo, TRUE);
+}
+
+static MonoBBlock *
+mono_find_final_block (MonoFlowGraph *cfg, guint32 ip, int type)
+{
+ MonoMethod *method = cfg->method;
+ MonoBytecodeInfo *bcinfo = cfg->bcinfo;
+ MonoMethodHeader *header = ((MonoMethodNormal *)method)->header;
+ MonoExceptionClause *clause;
+ int i;
+
+ for (i = 0; i < header->num_clauses; ++i) {
+ clause = &header->clauses [i];
+ if (MONO_OFFSET_IN_HANDLER (clause, ip))
+ continue;
+
+ if (MONO_OFFSET_IN_CLAUSE (clause, ip)) {
+ if (clause->flags & type) {
+ g_assert (bcinfo [clause->handler_offset].is_block_start);
+ return &cfg->bblocks [bcinfo [clause->handler_offset].block_id];
+ } else
+ return NULL;
+ }
+ }
+ return NULL;
+}
+
+#define CREATE_BLOCK(t) {if (!bcinfo [t].is_block_start) {block_count++;bcinfo [t].is_block_start = 1; }}
+
+void
+mono_analyze_flow (MonoFlowGraph *cfg)
+{
+ MonoMethod *method = cfg->method;
+ register const unsigned char *ip, *end;
+ MonoMethodHeader *header;
+ MonoBytecodeInfo *bcinfo;
+ MonoExceptionClause *clause;
+ MonoBBlock *bblocks, *bb;
+ const MonoOpcode *opcode;
+ gboolean block_end;
+ int i, block_count;
+
+ header = ((MonoMethodNormal *)method)->header;
+
+ bcinfo = g_malloc0 (header->code_size * sizeof (MonoBytecodeInfo));
+ bcinfo [0].is_block_start = 1;
+ block_count = 1;
+ block_end = FALSE;
+
+ ip = header->code;
+ end = ip + header->code_size;
+
+ mono_jit_stats.cil_code_size += header->code_size;
+
+ /* fixme: add block boundaries for exceptions */
+ for (i = 0; i < header->num_clauses; ++i) {
+ clause = &header->clauses [i];
+ CREATE_BLOCK (clause->try_offset);
+ CREATE_BLOCK (clause->handler_offset);
+ }
+
+ while (ip < end) {
+ guint32 cli_addr = ip - header->code;
+
+ //printf ("IL%04x OPCODE %s\n", cli_addr, mono_opcode_names [*ip]);
+
+ if (block_end) {
+ CREATE_BLOCK (cli_addr);
+ block_end = FALSE;
+ }
+
+ if (*ip == 0xfe) {
+ ++ip;
+ i = *ip + 256;
+ } else {
+ i = *ip;
+ }
+
+ opcode = &mono_opcodes [i];
+
+ switch (opcode->flow_type) {
+ case MONO_FLOW_RETURN:
+ case MONO_FLOW_ERROR:
+ block_end = 1;
+ break;
+ case MONO_FLOW_BRANCH: /* we handle branch when checking the argument type */
+ case MONO_FLOW_COND_BRANCH:
+ case MONO_FLOW_CALL:
+ case MONO_FLOW_NEXT:
+ case MONO_FLOW_META:
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ switch (opcode->argument) {
+ case MonoInlineNone:
+ ++ip;
+ break;
+ case MonoInlineString:
+ mono_ldstr (mono_domain_get (), method->klass->image, mono_metadata_token_index (read32 (ip + 1)));
+ /* fall through */
+ case MonoInlineType:
+ case MonoInlineField:
+ case MonoInlineMethod:
+ case MonoInlineTok:
+ case MonoInlineSig:
+ case MonoShortInlineR:
+ case MonoInlineI:
+ ip += 5;
+ break;
+ case MonoInlineVar:
+ ip += 3;
+ break;
+ case MonoShortInlineVar:
+ case MonoShortInlineI:
+ ip += 2;
+ break;
+ case MonoShortInlineBrTarget:
+ ip++;
+ i = (signed char)*ip;
+ ip++;
+ CREATE_BLOCK (cli_addr + 2 + i);
+ block_end = 1;
+
+ break;
+ case MonoInlineBrTarget:
+ ip++;
+ i = read32 (ip);
+ ip += 4;
+ CREATE_BLOCK (cli_addr + 5 + i);
+ block_end = 1;
+ break;
+ case MonoInlineSwitch: {
+ gint32 st, target, n;
+ ++ip;
+ n = read32 (ip);
+ ip += 4;
+ st = cli_addr + 5 + 4 * n;
+ CREATE_BLOCK (st);
+
+ for (i = 0; i < n; i++) {
+ target = read32 (ip) + st;
+ ip += 4;
+ CREATE_BLOCK (target);
+ }
+ /*
+ * Note: the code didn't set block_end in switch.
+ */
+ break;
+ }
+ case MonoInlineR:
+ case MonoInlineI8:
+ ip += 9;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ }
+
+
+ g_assert (block_count);
+
+ bb = bblocks = g_malloc0 (sizeof (MonoBBlock) * block_count);
+
+ block_count = 0;
+ bblocks [0].reached = 1;
+
+ for (i = 0; i < header->code_size; i++) {
+ if (bcinfo [i].is_block_start) {
+ bb->cli_addr = i;
+ if (block_count)
+ bb [-1].length = i - bb [-1].cli_addr;
+ bcinfo [i].block_id = block_count;
+ bb++;
+ block_count++;
+ }
+ }
+ bb [-1].length = header->code_size - bb [-1].cli_addr;
+
+ cfg->bcinfo = bcinfo;
+ cfg->bblocks = bblocks;
+ cfg->block_count = block_count;
+}
+
+/**
+ * ves_array_element_address:
+ * @this: a pointer to the array object
+ *
+ * Returns: the address of an array element.
+ */
+static gpointer
+ves_array_element_address (MonoArray *this, ...)
+{
+ MonoClass *class;
+ va_list ap;
+ int i, ind, esize;
+ gpointer ea;
+
+ g_assert (this != NULL);
+
+ va_start(ap, this);
+
+ class = this->obj.vtable->klass;
+
+ ind = va_arg(ap, int);
+ if (this->bounds != NULL) {
+ ind -= this->bounds [0].lower_bound;
+ for (i = 1; i < class->rank; i++) {
+ ind = ind*this->bounds [i].length + va_arg(ap, int) -
+ this->bounds [i].lower_bound;;
+ }
+ }
+
+ esize = mono_array_element_size (class);
+ ea = (gpointer*)((char*)this->vector + (ind * esize));
+ //printf ("AADDRESS %p %p %d\n", this, ea, ind);
+
+ va_end(ap);
+
+ return ea;
+}
+
+static MonoArray *
+mono_array_new_va (MonoMethod *cm, ...)
+{
+ MonoDomain *domain = mono_domain_get ();
+ va_list ap;
+ guint32 *lengths;
+ guint32 *lower_bounds;
+ int pcount = cm->signature->param_count;
+ int rank = cm->klass->rank;
+ int i, d;
+
+ va_start (ap, cm);
+
+ lengths = alloca (sizeof (guint32) * pcount);
+ for (i = 0; i < pcount; ++i)
+ lengths [i] = d = va_arg(ap, int);
+
+ if (rank == pcount) {
+ /* Only lengths provided. */
+ lower_bounds = NULL;
+ } else {
+ g_assert (pcount == (rank * 2));
+ /* lower bounds are first. */
+ lower_bounds = lengths;
+ lengths += rank;
+ }
+ va_end(ap);
+
+ return mono_array_new_full (domain, cm->klass, lengths, lower_bounds);
+}
+
+#define ADD_TREE(t,a) do { t->cli_addr = a; g_ptr_array_add (forest, (t)); } while (0)
+#define PUSH_TREE(t,k) do { int tt = k; *sp = t; t->svt = tt; sp++; } while (0)
+
+#define LOCAL_POS(n) (1 + n)
+#define LOCAL_TYPE(n) ((header)->locals [(n)])
+
+#define ARG_POS(n) (firstarg + n)
+#define ARG_TYPE(n) ((n) ? (signature)->params [(n) - (signature)->hasthis] : \
+ (signature)->hasthis ? &method->klass->this_arg: (signature)->params [(0)])
+
+static int
+check_inlining (MonoMethod *method)
+{
+ MonoMethodHeader *header;
+ MonoMethodSignature *signature = method->signature;
+ register const unsigned char *ip, *end;
+ gboolean stop;
+ int i, arg_used [256];
+
+ g_assert (method);
+
+ if (method->inline_info)
+ return method->inline_count;
+
+ method->inline_info = 1;
+
+ if ((method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) ||
+ (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
+ (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
+ (method->klass->marshalbyref) ||
+ ISSTRUCT (signature->ret))
+ goto fail;;
+
+ if (!(header = ((MonoMethodNormal *)method)->header) ||
+ header->num_clauses)
+ goto fail;;
+
+ if (header->num_clauses)
+ goto fail;
+
+ ip = header->code;
+ end = ip + header->code_size;
+
+ for (i = 0; i < 256; i++)
+ arg_used [i] = 0;
+
+ stop = FALSE;
+ while (!stop && ip < end) {
+
+ switch (*ip) {
+ case CEE_NOP:
+ case CEE_BREAK:
+ case CEE_DUP:
+ case CEE_POP:
+ case CEE_LDIND_I1:
+ case CEE_LDIND_U1:
+ case CEE_LDIND_I2:
+ case CEE_LDIND_U2:
+ case CEE_LDIND_I4:
+ case CEE_LDIND_U4:
+ case CEE_LDIND_I8:
+ case CEE_LDIND_I:
+ case CEE_LDIND_R4:
+ case CEE_LDIND_R8:
+ case CEE_LDIND_REF:
+ case CEE_STIND_REF:
+ case CEE_STIND_I1:
+ case CEE_STIND_I2:
+ case CEE_STIND_I4:
+ case CEE_STIND_I8:
+ case CEE_STIND_R4:
+ case CEE_STIND_R8:
+ case CEE_ADD:
+ case CEE_SUB:
+ case CEE_MUL:
+ case CEE_DIV:
+ case CEE_DIV_UN:
+ case CEE_REM:
+ case CEE_REM_UN:
+ case CEE_AND:
+ case CEE_OR:
+ case CEE_XOR:
+ case CEE_SHL:
+ case CEE_SHR:
+ case CEE_SHR_UN:
+ case CEE_NEG:
+ case CEE_NOT:
+ case CEE_CONV_I1:
+ case CEE_CONV_I2:
+ case CEE_CONV_I4:
+ case CEE_CONV_I8:
+ case CEE_CONV_R4:
+ case CEE_CONV_R8:
+ case CEE_CONV_U4:
+ case CEE_CONV_U8:
+ case CEE_CONV_R_UN:
+ case CEE_THROW:
+ case CEE_CONV_OVF_I1_UN:
+ case CEE_CONV_OVF_I2_UN:
+ case CEE_CONV_OVF_I4_UN:
+ case CEE_CONV_OVF_I8_UN:
+ case CEE_CONV_OVF_U1_UN:
+ case CEE_CONV_OVF_U2_UN:
+ case CEE_CONV_OVF_U4_UN:
+ case CEE_CONV_OVF_U8_UN:
+ case CEE_CONV_OVF_I_UN:
+ case CEE_CONV_OVF_U_UN:
+ case CEE_LDLEN:
+ case CEE_LDELEM_I1:
+ case CEE_LDELEM_U1:
+ case CEE_LDELEM_I2:
+ case CEE_LDELEM_U2:
+ case CEE_LDELEM_I4:
+ case CEE_LDELEM_U4:
+ case CEE_LDELEM_I8:
+ case CEE_LDELEM_I:
+ case CEE_LDELEM_R4:
+ case CEE_LDELEM_R8:
+ case CEE_LDELEM_REF:
+ case CEE_STELEM_I:
+ case CEE_STELEM_I1:
+ case CEE_STELEM_I2:
+ case CEE_STELEM_I4:
+ case CEE_STELEM_I8:
+ case CEE_STELEM_R4:
+ case CEE_STELEM_R8:
+ case CEE_STELEM_REF:
+ case CEE_CONV_OVF_I1:
+ case CEE_CONV_OVF_U1:
+ case CEE_CONV_OVF_I2:
+ case CEE_CONV_OVF_U2:
+ case CEE_CONV_OVF_I4:
+ case CEE_CONV_OVF_U4:
+ case CEE_CONV_OVF_I8:
+ case CEE_CONV_OVF_U8:
+ case CEE_CKFINITE:
+ case CEE_CONV_U2:
+ case CEE_CONV_U1:
+ case CEE_CONV_I:
+ case CEE_CONV_OVF_I:
+ case CEE_CONV_OVF_U:
+ case CEE_ADD_OVF:
+ case CEE_ADD_OVF_UN:
+ case CEE_MUL_OVF:
+ case CEE_MUL_OVF_UN:
+ case CEE_SUB_OVF:
+ case CEE_SUB_OVF_UN:
+ case CEE_STIND_I:
+ case CEE_CONV_U:
+ case CEE_LDNULL:
+ case CEE_LDC_I4_M1:
+ case CEE_LDC_I4_0:
+ case CEE_LDC_I4_1:
+ case CEE_LDC_I4_2:
+ case CEE_LDC_I4_3:
+ case CEE_LDC_I4_4:
+ case CEE_LDC_I4_5:
+ case CEE_LDC_I4_6:
+ case CEE_LDC_I4_7:
+ case CEE_LDC_I4_8:
+ ++ip;
+ break;
+ case CEE_LDC_I4_S:
+ ip += 2;
+ break;
+ case CEE_LDC_I4:
+ case CEE_LDC_R4:
+ case CEE_CPOBJ:
+ case CEE_LDOBJ:
+ case CEE_LDSTR:
+ case CEE_NEWOBJ:
+ case CEE_CASTCLASS:
+ case CEE_ISINST:
+ case CEE_UNBOX:
+ case CEE_LDFLD:
+ case CEE_LDFLDA:
+ case CEE_STFLD:
+ case CEE_LDSFLD:
+ case CEE_LDSFLDA:
+ case CEE_STSFLD:
+ case CEE_STOBJ:
+ case CEE_BOX:
+ case CEE_NEWARR:
+ case CEE_LDELEMA:
+ case CEE_LDTOKEN:
+ ip += 5;
+ break;
+ case CEE_LDC_I8:
+ case CEE_LDC_R8:
+ ip += 9;
+ break;
+ case CEE_CALL:
+ case CEE_CALLVIRT: {
+ MonoMethod *cm;
+ guint32 token;
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+
+ cm = mono_get_method (method->klass->image, token, NULL);
+ g_assert (cm);
+
+ if (cm == method)
+ goto fail;
+
+ break;
+ }
+ case CEE_LDARG_0:
+ case CEE_LDARG_1:
+ case CEE_LDARG_2:
+ case CEE_LDARG_3: {
+ int an = (*ip) - CEE_LDARG_0;
+ if (arg_used [an])
+ goto fail;
+ arg_used [an] = TRUE;
+ ++ip;
+ break;
+ }
+ case CEE_LDARG_S:
+ ++ip;
+ if (arg_used [*ip])
+ goto fail;
+ arg_used [*ip] = TRUE;
+ ++ip;
+ break;
+
+ case CEE_PREFIX1: {
+ ++ip;
+ switch (*ip) {
+ case CEE_LDARG: {
+ int an;
+ ip++;
+ an = read32 (ip);
+ ip += 4;
+ if (an > 255 || arg_used [an])
+ goto fail;
+ arg_used [an] = TRUE;
+ break;
+ }
+
+ case CEE_CEQ:
+ case CEE_CGT:
+ case CEE_CGT_UN:
+ case CEE_CLT:
+ case CEE_CLT_UN:
+ case CEE_CPBLK:
+ case CEE_INITBLK:
+ ip++;
+ break;
+ case CEE_LDFTN:
+ case CEE_LDVIRTFTN:
+ case CEE_INITOBJ:
+ case CEE_SIZEOF:
+ ip += 5;
+ break;
+ default:
+ stop = TRUE;
+ break;
+ }
+ }
+ default:
+ stop = TRUE;
+ break;
+ }
+ }
+
+ if (ip >= end ||
+ !(ip [0] == CEE_RET ||
+ ((ip + 4) < end &&
+ ip [0] == CEE_STLOC_0 &&
+ ip [1] == CEE_BR_S &&
+ ip [2] == 0 &&
+ ip [3] == CEE_LDLOC_0 &&
+ ip [4] == CEE_RET)))
+ goto fail;
+
+ if (signature->hasthis && arg_used [0])
+ method->uses_this = 1;
+
+ mono_jit_stats.inlineable_methods++;
+
+ return method->inline_count = ip - header->code;
+
+ fail:
+ return method->inline_count = -1;
+}
+
+static void
+create_outstack (MonoFlowGraph *cfg, MonoBBlock *bb, MBTree **stack, int depth)
+{
+ MonoMemPool *mp = cfg->mp;
+ MBTree **c = stack, *t1, *t2;
+ GPtrArray *forest = bb->forest;
+ int i;
+
+ g_assert (bb->reached);
+
+ if (depth <= 0)
+ return;
+
+ if (bb->outstack) {
+ g_assert (bb->outdepth == depth);
+ return;
+ }
+
+ bb->outdepth = depth;
+ bb->outstack = mono_mempool_alloc (mp, depth * sizeof (MBTree *));
+
+ for (i = 0; i < depth; i++) {
+ if ((t1 = mono_store_tree (cfg, i, c [i], &t2)))
+ ADD_TREE (t1, -1);
+ bb->outstack [i] = t2;
+ }
+}
+
+static void
+mark_reached (MonoFlowGraph *cfg, MonoBBlock *target, MBTree **stack, int depth)
+{
+ MonoMemPool *mp = cfg->mp;
+ int i;
+
+ if (target->reached)
+ return;
+
+ target->reached = 1;
+
+ if (depth == 0)
+ return;
+
+ g_assert (stack);
+
+ if (target->instack) {
+ g_assert (target->indepth == depth);
+ return;
+ }
+
+ target->indepth = depth;
+ target->instack = mono_mempool_alloc (mp, depth * sizeof (MBTree *));
+
+ for (i = 0; i < depth; i++) {
+ target->instack [i] = ctree_create_dup (mp, stack [i]);
+ }
+
+
+}
+
+#define MARK_REACHED(bb) do { if (!bb->reached) { bb->reached = 1; }} while (0)
+
+/**
+ * mono_analyze_stack:
+ * @cfg: control flow graph
+ *
+ * This is the architecture independent part of JIT compilation.
+ * It creates a forest of trees which can then be fed into the
+ * architecture dependent code generation.
+ *
+ * The algorithm is from Andi Krall, the same is used in CACAO
+ */
+void
+mono_analyze_stack (MonoFlowGraph *cfg)
+{
+ MonoMethod *method = cfg->method;
+ MonoMemPool *mp = cfg->mp;
+ MonoBytecodeInfo *bcinfo = cfg->bcinfo;
+ MonoMethodHeader *header;
+ MonoMethodSignature *signature;
+ MonoImage *image;
+ MonoValueType svt;
+ MBTree **sp, **stack, **arg_sp, **arg_map = NULL, *t1, *t2, *t3;
+ register const unsigned char *ip, *end;
+ GPtrArray *forest;
+ int i, j, depth, repeat_count;
+ int varnum = 0, firstarg = 0, retvtarg = 0;
+ gboolean repeat, superblock_end;
+ MonoBBlock *bb, *tbb;
+ int maxstack;
+ GList *inline_list = NULL;
+
+ header = ((MonoMethodNormal *)method)->header;
+ signature = method->signature;
+ image = method->klass->image;
+
+ /* we add 10 extra slots for method inlining */
+ maxstack = header->max_stack + 10;
+ sp = stack = alloca (sizeof (MBTree *) * (maxstack + 1));
+
+ if (header->num_locals) {
+ int size, align;
+
+ for (i = 0; i < header->num_locals; ++i) {
+ size = mono_type_size (header->locals [i], &align);
+ varnum = arch_allocate_var (cfg, size, align, MONO_LOCALVAR, VAL_UNKNOWN);
+ if (i == 0)
+ cfg->locals_start_index = varnum;
+ }
+ }
+
+ if (ISSTRUCT (signature->ret)) {
+ int size, align;
+
+ cfg->has_vtarg = 1;
+
+ size = mono_type_size (signature->ret, &align);
+
+ retvtarg = varnum = arch_allocate_var (cfg, size, align, MONO_LOCALVAR, VAL_UNKNOWN);
+
+ //printf ("VALUETYPE METHOD %s.%s::%s %d\n", method->klass->name_space,
+ //method->klass->name, method->name, size);
+ }
+
+ cfg->args_start_index = firstarg = varnum + 1;
+
+ if (signature->hasthis) {
+ arch_allocate_var (cfg, sizeof (gpointer), sizeof (gpointer), MONO_ARGVAR, VAL_POINTER);
+ }
+
+ if (signature->param_count) {
+ int align, size;
+
+ for (i = 0; i < signature->param_count; ++i) {
+ size = mono_type_stack_size (signature->params [i], &align);
+ arch_allocate_var (cfg, size, align, MONO_ARGVAR, VAL_UNKNOWN);
+ }
+ }
+
+ for (i = 0; i < header->num_clauses; ++i) {
+ MonoExceptionClause *clause = &header->clauses [i];
+ tbb = &cfg->bblocks [bcinfo [clause->handler_offset].block_id];
+ if (clause->flags == MONO_EXCEPTION_CLAUSE_NONE) {
+ tbb->instack = mono_mempool_alloc (mp, sizeof (MBTree *));
+ tbb->indepth = 1;
+ tbb->instack [0] = t1 = mono_ctree_new_leaf (mp, MB_TERM_EXCEPTION);
+ t1->data.i = mono_allocate_excvar (cfg);
+ t1->svt = VAL_POINTER;
+ tbb->reached = 1;
+ } else if (clause->flags == MONO_EXCEPTION_CLAUSE_FINALLY) {
+ mark_reached (cfg, tbb, NULL, 0);
+ } else {
+ g_warning ("implement me");
+ g_assert_not_reached ();
+ }
+ }
+
+ repeat_count = 0;
+
+ do {
+ repeat = FALSE;
+ superblock_end = TRUE;
+ sp = stack;
+
+ //printf ("START\n");
+ for (i = 0; i < cfg->block_count; i++) {
+ bb = &cfg->bblocks [i];
+
+ //printf ("BBS %d %05x %05x %d %d %d %s\n", i, bb->cli_addr, bb->cli_addr + bb->length, bb->reached, bb->finished, superblock_end, method->name);
+
+ if (!bb->reached && !superblock_end) {
+ MonoBBlock *sbb = &cfg->bblocks [i - 1];
+
+ g_assert (sbb->outdepth == (sp - stack));
+
+ mark_reached (cfg, bb, sbb->outstack, sbb->outdepth);
+ }
+
+ if (bb->reached) {
+
+ if (!bb->finished) {
+
+ sp = stack;
+
+ for (j = 0; j < bb->indepth; j++) {
+ sp [j] = bb->instack [j];
+ }
+ sp += bb->indepth;
+
+ bb->finished = 1;
+
+ ip = header->code + bb->cli_addr;
+ end = ip + bb->length;
+
+ bb->forest = forest = g_ptr_array_new ();
+
+ superblock_end = FALSE;
+
+
+ while (inline_list || ip < end) {
+ guint32 cli_addr;
+
+ if (inline_list) {
+ MonoInlineInfo *ii = (MonoInlineInfo *)inline_list->data;
+ if (ip >= ii->end) {
+ inline_list = g_list_remove_link (inline_list, inline_list);
+ ip = ii->saved_ip;
+ image = ii->saved_image;
+ if (inline_list)
+ arg_map = ((MonoInlineInfo *)inline_list->data)->arg_map;
+ else
+ arg_map = NULL;
+ continue;
+ }
+ } else
+ cli_addr = ip - header->code;
+
+
+ //if (inline_list) printf ("INLINE IL%04x OPCODE %s\n", cli_addr, mono_opcode_names [*ip]);
+
+ //printf ("%d IL%04x OPCODE %s %d %d %d\n", i, cli_addr, mono_opcode_names [*ip],
+ //forest->len, superblock_end, sp - stack);
+
+ switch (*ip) {
+ case CEE_THROW: {
+ --sp;
+ ip++;
+
+ t1 = mono_ctree_new (mp, MB_TERM_THROW, *sp, NULL);
+ ADD_TREE (t1, cli_addr);
+ superblock_end = TRUE;
+ break;
+ }
+ case CEE_BOX: {
+ MonoClass *c;
+ guint32 token;
+
+ --sp;
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+
+ c = mono_class_get (image, token);
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_NEWOBJ);
+ t1->data.p = c;
+ t1->svt = VAL_POINTER;
+
+ t1 = mono_store_tree (cfg, -1, t1, &t3);
+ g_assert (t1);
+ ADD_TREE (t1, cli_addr);
+
+ t1 = ctree_create_dup (mp, t3);
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t2->data.i = sizeof (MonoObject);
+ t1 = mono_ctree_new (mp, MB_TERM_ADD, t1, t2);
+
+ t1 = ctree_create_store (cfg, &c->byval_arg, t1, *sp, FALSE);
+ ADD_TREE (t1, cli_addr);
+
+ PUSH_TREE (t3, VAL_POINTER);
+
+ break;
+ }
+ case CEE_UNBOX: {
+ MonoClass *class;
+ guint32 token;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ sp--;
+
+ class = mono_class_get (image, token);
+ t1 = mono_ctree_new (mp, MB_TERM_UNBOX, *sp, NULL);
+ t1->data.klass = class;
+
+ PUSH_TREE (t1, VAL_POINTER);
+ break;
+ }
+ case CEE_LDLEN: {
+ ip++;
+ sp--;
+
+ t1 = mono_ctree_new (mp, MB_TERM_LDLEN, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+
+ case CEE_LDOBJ: {
+ guint32 token;
+ MonoClass *c;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ sp--;
+
+ c = mono_class_get (image, token);
+ g_assert (c->valuetype);
+
+ t1 = ctree_create_load (cfg, &c->byval_arg, *sp, &svt, FALSE);
+ PUSH_TREE (t1, svt);
+ break;
+ }
+ case CEE_STOBJ: {
+ guint32 token;
+ MonoClass *c;
+ int size;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ sp -= 2;
+
+ c = mono_class_get (image, token);
+ g_assert (c->valuetype);
+
+ size = mono_class_value_size (c, NULL);
+
+ t1 = mono_ctree_new (mp, MB_TERM_STIND_OBJ, sp [0], sp [1]);
+ t1->data.i = size;
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+ case CEE_LDSTR: {
+ MonoObject *o;
+ guint32 ind;
+
+ ++ip;
+ ind = mono_metadata_token_index (read32 (ip));
+ ip += 4;
+
+ if (cfg->share_code) {
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_LDSTR);
+ t1->data.i = ind;
+ } else {
+ o = (MonoObject *) mono_ldstr (cfg->domain, image, ind);
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t1->data.p = o;
+ }
+
+ PUSH_TREE (t1, VAL_POINTER);
+ break;
+ }
+ case CEE_LDSFLD:
+ case CEE_LDSFLDA: {
+ MonoClass *klass;
+ MonoClassField *field;
+ guint32 token;
+ int load_addr = *ip == CEE_LDSFLDA;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+
+ /* need to handle fieldrefs */
+ if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) {
+ field = mono_field_from_memberref (image, token, &klass);
+ mono_class_init (klass);
+ } else {
+ klass = mono_class_get (image,
+ MONO_TOKEN_TYPE_DEF | mono_metadata_typedef_from_field (image, token & 0xffffff));
+ mono_class_init (klass);
+ field = mono_class_get_field (klass, token);
+ }
+
+ g_assert (field);
+
+ if (cfg->share_code) {
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t1->data.i = field->offset;
+ t1 = mono_ctree_new (mp, MB_TERM_LDSFLDA, t1, NULL);
+ t1->data.klass = klass;
+ } else {
+ MonoVTable *vt = mono_class_vtable (cfg->domain, klass);
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_G);
+ t1->data.p = (char*)(vt->data) + field->offset;
+ }
+
+ if (load_addr) {
+ svt = VAL_POINTER;
+ } else {
+ t1 = ctree_create_load (cfg, field->type, t1, &svt, FALSE);
+ }
+
+ PUSH_TREE (t1, svt);
+ break;
+ }
+ case CEE_LDFLD:
+ case CEE_LDFLDA: {
+ MonoClass *klass;
+ MonoClassField *field;
+ guint32 token;
+ int load_addr = *ip == CEE_LDFLDA;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ sp--;
+
+ /* need to handle fieldrefs */
+ if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) {
+ field = mono_field_from_memberref (image, token, &klass);
+ mono_class_init (klass);
+ } else {
+ klass = mono_class_get (image,
+ MONO_TOKEN_TYPE_DEF | mono_metadata_typedef_from_field (image, token & 0xffffff));
+ mono_class_init (klass);
+ field = mono_class_get_field (klass, token);
+ }
+ g_assert (field);
+
+ if (klass->marshalbyref) {
+ t1 = mono_ctree_new (mp, MB_TERM_REMOTE_LDFLDA, sp [0], NULL);
+ t1->data.fi.klass = klass;
+ t1->data.fi.field = field;
+ } else {
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+
+ if (klass->valuetype)
+ t1->data.i = field->offset - sizeof (MonoObject);
+ else
+ t1->data.i = field->offset;
+
+ t1 = mono_ctree_new (mp, MB_TERM_ADD, sp [0], t1);
+ }
+
+ if (!load_addr)
+ t1 = ctree_create_load (cfg, field->type, t1, &svt, FALSE);
+ else
+ svt = VAL_POINTER;
+
+ PUSH_TREE (t1, svt);
+ break;
+ }
+ case CEE_STSFLD: {
+ MonoClass *klass;
+ MonoClassField *field;
+ guint32 token;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ --sp;
+
+ /* need to handle fieldrefs */
+ if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) {
+ field = mono_field_from_memberref (image, token, &klass);
+ mono_class_init (klass);
+ } else {
+ klass = mono_class_get (image,
+ MONO_TOKEN_TYPE_DEF | mono_metadata_typedef_from_field (image, token & 0xffffff));
+ mono_class_init (klass);
+ field = mono_class_get_field (klass, token);
+
+ }
+ g_assert (field);
+
+ if (cfg->share_code) {
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t1->data.i = field->offset;
+ t1 = mono_ctree_new (mp, MB_TERM_LDSFLDA, t1, NULL);
+ t1->data.klass = klass;
+ } else {
+ MonoVTable *vt = mono_class_vtable (cfg->domain, klass);
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_G);
+ t1->data.p = (char*)(vt->data) + field->offset;
+ }
+ t1 = ctree_create_store (cfg, field->type, t1, *sp, FALSE);
+
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+ case CEE_STFLD: {
+ MonoClass *klass;
+ MonoClassField *field;
+ guint32 token;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ sp -= 2;
+
+ /* need to handle fieldrefs */
+ if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) {
+ field = mono_field_from_memberref (image, token, &klass);
+ mono_class_init (klass);
+ } else {
+ klass = mono_class_get (image,
+ MONO_TOKEN_TYPE_DEF | mono_metadata_typedef_from_field (image, token & 0xffffff));
+ mono_class_init (klass);
+ field = mono_class_get_field (klass, token);
+ }
+ g_assert (field);
+
+ if (klass->marshalbyref) {
+ t1 = mono_ctree_new (mp, map_remote_stind_type (field->type), sp [0], sp [1]);
+ t1->data.fi.klass = klass;
+ t1->data.fi.field = field;
+ } else {
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t1->data.i = klass->valuetype ? field->offset - sizeof (MonoObject) : field->offset;
+ t1 = mono_ctree_new (mp, MB_TERM_ADD, sp [0], t1);
+ t1 = ctree_create_store (cfg, field->type, t1, sp [1], FALSE);
+ }
+
+
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+ case CEE_LDELEMA: {
+ MonoClass *class;
+ guint32 esize, token;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ sp -= 2;
+
+ class = mono_class_get (image, token);
+
+ mono_class_init (class);
+
+ esize = mono_class_instance_size (class);
+ if (class->valuetype)
+ esize -= sizeof (MonoObject);
+
+ t1 = mono_ctree_new (mp, MB_TERM_LDELEMA, sp [0], sp [1]);
+ t1->data.i = esize;
+ PUSH_TREE (t1, VAL_POINTER);
+ break;
+ }
+ case CEE_NOP: {
+ ++ip;
+ break;
+ }
+ case CEE_BREAK: {
+ ++ip;
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_BREAK);
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+ case CEE_SWITCH: {
+ guint32 k, n;
+ MonoBBlock **jt;
+ gint32 st, target;
+
+ ++ip;
+ n = read32 (ip);
+ ip += 4;
+ --sp;
+
+ t1 = mono_ctree_new (mp, MB_TERM_SWITCH, *sp, NULL);
+ jt = t1->data.p = mono_alloc_static (sizeof (gpointer) * (n + 2));
+ st = cli_addr + 5 + 4 * n;
+
+ // hack: we store n at position 0
+ jt [0] = (MonoBBlock *)n;
+
+ create_outstack (cfg, bb, stack, sp - stack);
+
+ for (k = 1; k <= (n + 1); k++) {
+ if (k > n)
+ target = st;
+ else {
+ target = read32 (ip) + st;
+ ip += 4;
+ }
+ g_assert (target >= 0 && target <= header->code_size);
+ g_assert (bcinfo [target].is_block_start);
+ tbb = &cfg->bblocks [bcinfo [target].block_id];
+ mark_reached (cfg, tbb, stack, sp - stack);
+ jt [k] = tbb;
+ }
+
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+ case CEE_LDTOKEN: {
+ gpointer handle;
+ MonoClass *handle_class;
+
+ ++ip;
+ handle = mono_ldtoken (image, read32 (ip), &handle_class);
+ ip += 4;
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t1->data.p = handle;
+ PUSH_TREE (t1, VAL_POINTER);
+
+ break;
+ }
+ case CEE_NEWARR: {
+ MonoClass *class;
+ guint32 token;
+
+ ip++;
+ --sp;
+ token = read32 (ip);
+ class = mono_class_get (image, token);
+ ip += 4;
+
+ if (cfg->share_code) {
+ t1 = mono_ctree_new (mp, MB_TERM_NEWARR, *sp, NULL);
+ t1->data.p = class;
+ }
+ else {
+ MonoClass *ac = mono_array_class_get (&class->byval_arg, 1);
+ MonoVTable *vt = mono_class_vtable (cfg->domain, ac);
+
+ t1 = mono_ctree_new (mp, MB_TERM_NEWARR_SPEC, *sp, NULL);
+ t1->data.p = vt;
+ }
+
+ PUSH_TREE (t1, VAL_POINTER);
+ break;
+ }
+ case CEE_CPOBJ: {
+ MonoClass *class;
+ guint32 token;
+
+ ++ip;
+ token = read32 (ip);
+ class = mono_class_get (image, token);
+ ip += 4;
+ sp -= 2;
+
+ t1 = mono_ctree_new (mp, MB_TERM_CPOBJ, sp [0], sp [1]);
+ ADD_TREE (t1, cli_addr);
+
+ break;
+ }
+ case CEE_NEWOBJ: {
+ MonoMethodSignature *csig;
+ MonoMethod *cm;
+ MBTree *this = NULL;
+ guint32 token;
+ int k, align, size, args_size = 0;
+ int newarr = FALSE;
+ int newstr = FALSE;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+
+ cm = mono_get_method (image, token, NULL);
+ g_assert (cm);
+ g_assert (!strcmp (cm->name, ".ctor"));
+
+ csig = cm->signature;
+ g_assert (csig->call_convention == MONO_CALL_DEFAULT);
+ g_assert (csig->hasthis);
+
+ arg_sp = sp -= csig->param_count;
+
+ if (!cm->klass->inited)
+ mono_class_init (cm->klass);
+
+ if (cm->klass->parent == mono_defaults.array_class) {
+ newarr = TRUE;
+ this = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ this->data.m = cm;
+ } else if (cm->klass == mono_defaults.string_class) {
+ newstr = TRUE;
+ this = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ this->data.m = cm;
+ } else {
+ if (cm->klass->valuetype) {
+ this = mono_ctree_new_leaf (mp, MB_TERM_NEWSTRUCT);
+ this->data.i = mono_class_value_size (cm->klass, NULL);
+ } else if (cfg->share_code) {
+ this = mono_ctree_new_leaf (mp, MB_TERM_NEWOBJ);
+ this->data.klass = cm->klass;
+ } else {
+ MonoVTable *vt = mono_class_vtable (cfg->domain, cm->klass);
+ this = mono_ctree_new_leaf (mp, MB_TERM_NEWOBJ_SPEC);
+ this->data.p = vt;
+ }
+
+ this->svt = VAL_POINTER;
+
+ t1 = mono_store_tree (cfg, -1, this, &this);
+ g_assert (t1);
+ ADD_TREE (t1, cli_addr);
+ }
+
+ args_size += sizeof (gpointer); /* this argument */
+
+ for (k = csig->param_count - 1; k >= 0; k--) {
+ MonoType *type = cm->signature->params [k];
+
+ size = mono_type_stack_size (type, &align);
+ t1 = mono_ctree_new (mp, map_arg_type (type), arg_sp [k], NULL);
+ t1->data.i = size;
+ ADD_TREE (t1, cli_addr);
+ args_size += size;
+ }
+
+
+ if (newarr || newstr) {
+
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ if (newarr) {
+ t2->data.p = mono_array_new_va;
+ } else {
+ t2->data.p = arch_create_jit_trampoline (cm);
+ }
+
+ t1 = mono_ctree_new (mp, MB_TERM_CALL_I4, this, t2);
+ t1->data.ci.m = cm;
+ t1->data.ci.args_size = args_size;
+ t1->data.ci.vtype_num = 0;
+
+ t1->svt = VAL_POINTER;
+
+ t1 = mono_store_tree (cfg, -1, t1, &t2);
+ g_assert (t1);
+ ADD_TREE (t1, cli_addr);
+ PUSH_TREE (t2, t2->svt);
+
+ } else {
+
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_G);
+ t2->data.p = arch_create_jit_trampoline (cm);
+
+ t1 = mono_ctree_new (mp, map_call_type (csig->ret, &svt), this, t2);
+ t1->data.ci.m = cm;
+ t1->data.ci.args_size = args_size;
+ t1->data.ci.vtype_num = 0;
+ t1->svt = svt;
+
+ ADD_TREE (t1, cli_addr);
+
+ t1 = ctree_create_dup (mp, this);
+
+ if (cm->klass->valuetype) {
+ t2 = ctree_create_load (cfg, &cm->klass->byval_arg, t1, &svt, FALSE);
+ PUSH_TREE (t2, svt);
+ } else {
+ PUSH_TREE (t1, t1->svt);
+ }
+ }
+ break;
+ }
+ case CEE_CALL:
+ case CEE_CALLVIRT: {
+ MonoMethodSignature *csig;
+ MonoMethod *cm;
+ MBTree *this = NULL;
+ guint32 token;
+ int k, align, size, args_size = 0;
+ int virtual = *ip == CEE_CALLVIRT;
+ gboolean array_set = FALSE;
+ gboolean array_get = FALSE;
+ /* fixme: compute this value */
+ gboolean shared_to_unshared_call = FALSE;
+ int nargs, vtype_num = 0;
+
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+
+ cm = mono_get_method (image, token, NULL);
+ g_assert (cm);
+
+ if (cm->klass == mono_defaults.string_class &&
+ *cm->name == '.' && !strcmp (cm->name, ".ctor"))
+ g_assert_not_reached ();
+
+ arg_sp = sp -= cm->signature->param_count;
+
+ if ((cm->flags & METHOD_ATTRIBUTE_FINAL) ||
+ !(cm->flags & METHOD_ATTRIBUTE_VIRTUAL))
+ virtual = 0;
+
+ if (mono_jit_inline_code && !virtual && cm->inline_count != -1 &&
+ (cm->inline_info || check_inlining (cm) >= 0)) {
+ MonoInlineInfo *ii = alloca (sizeof (MonoInlineInfo));
+ int args;
+
+ mono_jit_stats.inlined_methods++;
+
+ if (cm->signature->hasthis)
+ sp--;
+
+ args = cm->signature->param_count + cm->signature->hasthis;
+
+ ii->method = cm;
+ ii->saved_ip = ip;
+ ii->saved_image = image;
+ ii->arg_map = alloca (args * sizeof (MBTree *));
+ memcpy (ii->arg_map, sp, args * sizeof (MBTree *));
+
+ if (cm->signature->hasthis && !cm->uses_this &&
+ (ii->arg_map [0]->op != MB_TERM_CHECKTHIS)) {
+ ii->arg_map [0] = mono_ctree_new (mp, MB_TERM_CHECKTHIS,
+ ii->arg_map [0], NULL);
+ ADD_TREE (ii->arg_map [0], cli_addr);
+ }
+
+ if (cm->inline_count) {
+ inline_list = g_list_prepend (inline_list, ii);
+ ip = ((MonoMethodNormal *)cm)->header->code;
+ ii->end = ip + cm->inline_count;
+ arg_map = ii->arg_map;
+ image = cm->klass->image;
+ }
+ continue;
+ }
+
+ csig = cm->signature;
+ nargs = csig->param_count;
+ g_assert (csig->call_convention == MONO_CALL_DEFAULT);
+ g_assert (!virtual || csig->hasthis);
+
+ /* fixme: we need to unbox the this pointer for value types ?*/
+ g_assert (!virtual || !cm->klass->valuetype);
+
+ if (cm->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) {
+ if (cm->klass->parent == mono_defaults.array_class) {
+ if (!strcmp (cm->name, "Set")) {
+ array_set = TRUE;
+ nargs--;
+ } else if (!strcmp (cm->name, "Get"))
+ array_get = TRUE;
+ }
+ }
+
+ for (k = nargs - 1; k >= 0; k--) {
+ MonoType *type = cm->signature->params [k];
+ t1 = mono_ctree_new (mp, map_arg_type (type), arg_sp [k], NULL);
+ size = mono_type_stack_size (type, &align);
+ t1->data.i = size;
+ ADD_TREE (t1, cli_addr);
+ args_size += size;
+ // fixme: align value type arguments to 8 byte boundary on the stack
+ }
+
+ if (csig->hasthis) {
+ this = *(--sp);
+ args_size += sizeof (gpointer);
+ } else
+ this = mono_ctree_new_leaf (mp, MB_TERM_NOP);
+
+ if (ISSTRUCT (csig->ret)) {
+ size = mono_type_size (csig->ret, &align);
+ vtype_num = arch_allocate_var (cfg, size, align, MONO_TEMPVAR, VAL_UNKNOWN);
+ }
+
+ if (array_get) {
+ int vnum;
+
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t2->data.p = ves_array_element_address;
+
+ t1 = mono_ctree_new (mp, MB_TERM_CALL_I4, this, t2);
+ t1->data.ci.m = cm;
+ t1->data.ci.args_size = args_size;
+ t1->data.ci.vtype_num = vtype_num;
+
+ t1 = mono_ctree_new (mp, map_ldind_type (csig->ret, &svt), t1, NULL);
+ t1->svt = svt;
+
+ mono_get_val_sizes (t1->svt, &size, &align);
+ vnum = arch_allocate_var (cfg, size, align, MONO_TEMPVAR, svt);
+
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t2->data.i = vnum;
+ t1 = mono_ctree_new (mp, map_store_svt_type (svt), t2, t1);
+ t1->svt = svt;
+
+ ADD_TREE (t1, cli_addr);
+ t1 = ctree_create_dup (mp, t1);
+ PUSH_TREE (t1, t1->svt);
+
+ } else if (array_set) {
+
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t2->data.p = ves_array_element_address;
+
+ t1 = mono_ctree_new (mp, MB_TERM_CALL_I4, this, t2);
+ t1->data.ci.m = cm;
+ t1->data.ci.args_size = args_size;
+ t1->data.ci.vtype_num = vtype_num;
+
+ t1 = ctree_create_store (cfg, csig->params [nargs], t1, arg_sp [nargs], FALSE);
+ ADD_TREE (t1, cli_addr);
+
+ } else {
+
+ if (virtual || (csig->hasthis && (cm->klass->marshalbyref ||
+ shared_to_unshared_call ||
+ cm->klass == mono_defaults.object_class))) {
+ mono_class_init (cm->klass);
+
+ if (cm->klass->flags & TYPE_ATTRIBUTE_INTERFACE)
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_INTF_ADDR);
+ else
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_VFUNC_ADDR);
+
+ t2->data.m = cm;
+
+ } else {
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_G);
+ t2->data.p = arch_create_jit_trampoline (cm);
+ }
+
+ t1 = mono_ctree_new (mp, map_call_type (csig->ret, &svt), this, t2);
+ t1->data.ci.m = cm;
+ t1->data.ci.args_size = args_size;
+ t1->data.ci.vtype_num = vtype_num;
+ t1->svt = svt;
+
+ if (csig->ret->type != MONO_TYPE_VOID) {
+
+ if (vtype_num) {
+ ADD_TREE (t1, cli_addr);
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = vtype_num;
+ PUSH_TREE (t1, VAL_POINTER);
+ } else {
+ t1 = mono_store_tree (cfg, -1, t1, &t2);
+ g_assert (t1);
+ ADD_TREE (t1, cli_addr);
+ PUSH_TREE (t2, t2->svt);
+ }
+ } else
+ ADD_TREE (t1, cli_addr);
+
+ }
+
+ break;
+ }
+ case CEE_ISINST: {
+ MonoClass *c;
+ guint32 token;
+ ++ip;
+ token = read32 (ip);
+ --sp;
+
+ c = mono_class_get (image, token);
+ if (!c->inited)
+ mono_class_init (c);
+
+ t1 = mono_ctree_new (mp, MB_TERM_ISINST, *sp, NULL);
+ t1->data.klass = c;
+
+ PUSH_TREE (t1, VAL_POINTER);
+
+ ip += 4;
+ break;
+ }
+ case CEE_CASTCLASS: {
+ MonoClass *c;
+ guint32 token;
+ ++ip;
+ token = read32 (ip);
+ --sp;
+
+ c = mono_class_get (image, token);
+ if (!c->inited)
+ mono_class_init (c);
+
+ t1 = mono_ctree_new (mp, MB_TERM_CASTCLASS, *sp, NULL);
+ t1->data.klass = c;
+
+ PUSH_TREE (t1, VAL_POINTER);
+
+ ip += 4;
+ break;
+ }
+ case CEE_LDC_I4_S: {
+ ++ip;
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t1->data.i = *(const gint8 *)ip;
+ ++ip;
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_LDC_I4: {
+ ++ip;
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t1->data.i = read32 (ip);
+ ip += 4;
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_LDC_I4_M1:
+ case CEE_LDC_I4_0:
+ case CEE_LDC_I4_1:
+ case CEE_LDC_I4_2:
+ case CEE_LDC_I4_3:
+ case CEE_LDC_I4_4:
+ case CEE_LDC_I4_5:
+ case CEE_LDC_I4_6:
+ case CEE_LDC_I4_7:
+ case CEE_LDC_I4_8: {
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t1->data.i = (*ip) - CEE_LDC_I4_0;
+ ++ip;
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_LDNULL: {
+ //fixme: don't know if this is portable ?
+ ++ip;
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t1->data.i = 0;
+ PUSH_TREE (t1, VAL_POINTER);
+ break;
+ }
+ case CEE_LDC_I8: {
+ ++ip;
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I8);
+ t1->data.l = read64 (ip);
+ ip += 8;
+ PUSH_TREE (t1, VAL_I64);
+ break;
+ }
+ case CEE_LDC_R4: {
+ float *f = mono_alloc_static (sizeof (float));
+ ++ip;
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_R4);
+ readr4 (ip, f);
+ t1->data.p = f;
+ ip += 4;
+ PUSH_TREE (t1, VAL_DOUBLE);
+ break;
+ }
+ case CEE_LDC_R8: {
+ double *d = mono_alloc_static (sizeof (double));
+ ++ip;
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_R8);
+ readr8 (ip, d);
+ t1->data.p = d;
+ ip += 8;
+ PUSH_TREE (t1, VAL_DOUBLE);
+ break;
+ }
+ case CEE_LDLOC_0:
+ case CEE_LDLOC_1:
+ case CEE_LDLOC_2:
+ case CEE_LDLOC_3: {
+ int n = (*ip) - CEE_LDLOC_0;
+ ++ip;
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = LOCAL_POS (n);
+ if (!ISSTRUCT (LOCAL_TYPE (n)))
+ t1 = ctree_create_load (cfg, LOCAL_TYPE (n), t1, &svt, FALSE);
+
+ PUSH_TREE (t1, svt);
+ break;
+ }
+ case CEE_LDLOC_S: {
+ ++ip;
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = LOCAL_POS (*ip);
+ if (!ISSTRUCT (LOCAL_TYPE (*ip)))
+ t1 = ctree_create_load (cfg, LOCAL_TYPE (*ip), t1, &svt, FALSE);
+ ++ip;
+
+ PUSH_TREE (t1, svt);
+ break;
+ }
+ case CEE_LDLOCA_S: {
+ ++ip;
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = LOCAL_POS (*ip);
+ ++ip;
+ PUSH_TREE (t1, VAL_POINTER);
+ break;
+ }
+ case CEE_STLOC_0:
+ case CEE_STLOC_1:
+ case CEE_STLOC_2:
+ case CEE_STLOC_3: {
+ int n = (*ip) - CEE_STLOC_0;
+ ++ip;
+ --sp;
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = LOCAL_POS (n);
+ t1 = ctree_create_store (cfg, LOCAL_TYPE (n), t1, *sp, FALSE);
+
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+ case CEE_STLOC_S: {
+ ++ip;
+ --sp;
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = LOCAL_POS (*ip);
+ t1 = ctree_create_store (cfg, LOCAL_TYPE (*ip), t1, *sp, FALSE);
+
+ ++ip;
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+
+ case CEE_SHR: {
+ ++ip;
+ sp -= 2;
+ t1 = mono_ctree_new (mp, MB_TERM_SHR, sp [0], sp [1]);
+ PUSH_TREE (t1, sp [0]->svt);
+ break;
+ }
+ case CEE_SHR_UN: {
+ ++ip;
+ sp -= 2;
+ t1 = mono_ctree_new (mp, MB_TERM_SHR_UN, sp [0], sp [1]);
+ PUSH_TREE (t1, sp [0]->svt);
+ break;
+ }
+ case CEE_SHL: {
+ ++ip;
+ sp -= 2;
+ t1 = mono_ctree_new (mp, MB_TERM_SHL, sp [0], sp [1]);
+ PUSH_TREE (t1, sp [0]->svt);
+ break;
+ }
+
+ MAKE_BI_ALU (ADD)
+ MAKE_BI_ALU (ADD_OVF)
+ MAKE_BI_ALU (ADD_OVF_UN)
+ MAKE_BI_ALU (SUB)
+ MAKE_BI_ALU (SUB_OVF)
+ MAKE_BI_ALU (SUB_OVF_UN)
+ MAKE_BI_ALU (AND)
+ MAKE_BI_ALU (OR)
+ MAKE_BI_ALU (XOR)
+ MAKE_SPILLED_BI_ALU (MUL)
+ MAKE_SPILLED_BI_ALU (MUL_OVF)
+ MAKE_SPILLED_BI_ALU (MUL_OVF_UN)
+ MAKE_SPILLED_BI_ALU (DIV)
+ MAKE_SPILLED_BI_ALU (DIV_UN)
+ MAKE_SPILLED_BI_ALU (REM)
+ MAKE_SPILLED_BI_ALU (REM_UN)
+
+ MAKE_LDIND (LDIND_I1, MB_TERM_LDIND_I1, VAL_I32)
+ MAKE_LDIND (LDIND_U1, MB_TERM_LDIND_U1, VAL_I32)
+ MAKE_LDIND (LDIND_I2, MB_TERM_LDIND_I2, VAL_I32)
+ MAKE_LDIND (LDIND_U2, MB_TERM_LDIND_U2, VAL_I32)
+ MAKE_LDIND (LDIND_I, MB_TERM_LDIND_I4, VAL_I32)
+ MAKE_LDIND (LDIND_I4, MB_TERM_LDIND_I4, VAL_I32)
+ MAKE_LDIND (LDIND_REF, MB_TERM_LDIND_REF, VAL_POINTER)
+ MAKE_LDIND (LDIND_U4, MB_TERM_LDIND_U4, VAL_I32)
+ MAKE_LDIND (LDIND_I8, MB_TERM_LDIND_I8, VAL_I64)
+ MAKE_LDIND (LDIND_R4, MB_TERM_LDIND_R4, VAL_DOUBLE)
+ MAKE_LDIND (LDIND_R8, MB_TERM_LDIND_R8, VAL_DOUBLE)
+
+ MAKE_STIND (STIND_I1, MB_TERM_STIND_I1)
+ MAKE_STIND (STIND_I2, MB_TERM_STIND_I2)
+ MAKE_STIND (STIND_I, MB_TERM_STIND_I4)
+ MAKE_STIND (STIND_I4, MB_TERM_STIND_I4)
+ MAKE_STIND (STIND_I8, MB_TERM_STIND_I8)
+ MAKE_STIND (STIND_R4, MB_TERM_STIND_R4)
+ MAKE_STIND (STIND_R8, MB_TERM_STIND_R8)
+ MAKE_STIND (STIND_REF, MB_TERM_STIND_REF)
+
+ MAKE_LDELEM (LDELEM_I1, MB_TERM_LDIND_I1, VAL_I32, 1)
+ MAKE_LDELEM (LDELEM_U1, MB_TERM_LDIND_U1, VAL_I32, 1)
+ MAKE_LDELEM (LDELEM_I2, MB_TERM_LDIND_I2, VAL_I32, 2)
+ MAKE_LDELEM (LDELEM_U2, MB_TERM_LDIND_U2, VAL_I32, 2)
+ MAKE_LDELEM (LDELEM_I, MB_TERM_LDIND_I4, VAL_I32, 4)
+ MAKE_LDELEM (LDELEM_I4, MB_TERM_LDIND_I4, VAL_I32, 4)
+ MAKE_LDELEM (LDELEM_REF, MB_TERM_LDIND_REF, VAL_POINTER, sizeof (gpointer))
+ MAKE_LDELEM (LDELEM_U4, MB_TERM_LDIND_U4, VAL_I32, 4)
+ MAKE_LDELEM (LDELEM_I8, MB_TERM_LDIND_I8, VAL_I64, 8)
+ MAKE_LDELEM (LDELEM_R4, MB_TERM_LDIND_R4, VAL_DOUBLE, 4)
+ MAKE_LDELEM (LDELEM_R8, MB_TERM_LDIND_R8, VAL_DOUBLE, 8)
+
+ MAKE_STELEM (STELEM_I1, MB_TERM_STIND_I1, 1)
+ MAKE_STELEM (STELEM_I2, MB_TERM_STIND_I2, 2)
+ MAKE_STELEM (STELEM_I4, MB_TERM_STIND_I4, 4)
+ MAKE_STELEM (STELEM_I, MB_TERM_STIND_I4, 4)
+ MAKE_STELEM (STELEM_REF, MB_TERM_STIND_REF, sizeof (gpointer))
+ MAKE_STELEM (STELEM_I8, MB_TERM_STIND_I8, 8)
+ MAKE_STELEM (STELEM_R4, MB_TERM_STIND_R4, 4)
+ MAKE_STELEM (STELEM_R8, MB_TERM_STIND_R8, 8)
+
+ case CEE_NEG: {
+ ip++;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_NEG, sp [0], NULL);
+ PUSH_TREE (t1, sp [0]->svt);
+ break;
+ }
+ case CEE_NOT: {
+ ip++;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_NOT, sp [0], NULL);
+ PUSH_TREE (t1, sp [0]->svt);
+ break;
+ }
+ case CEE_BR:
+ case CEE_BR_S: {
+ gint32 target;
+ int br_s = (*ip == CEE_BR_S);
+
+ ++ip;
+ if (br_s)
+ target = cli_addr + 2 + (signed char) *ip;
+ else
+ target = cli_addr + 5 + (gint32) read32(ip);
+
+ g_assert (target >= 0 && target <= header->code_size);
+ g_assert (bcinfo [target].is_block_start);
+ tbb = &cfg->bblocks [bcinfo [target].block_id];
+ create_outstack (cfg, bb, stack, sp - stack);
+ mark_reached (cfg, tbb, bb->outstack, bb->outdepth);
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_BR);
+ t1->data.p = tbb;
+ ADD_TREE (t1, cli_addr);
+
+ if (br_s)
+ ++ip;
+ else
+ ip += 4;
+
+ superblock_end = TRUE;
+ break;
+ }
+ case CEE_LEAVE:
+ case CEE_LEAVE_S: {
+ gint32 target;
+ MonoBBlock *hb;
+ int leave_s = (*ip == CEE_LEAVE_S);
+
+ ++ip;
+ if (leave_s)
+ target = cli_addr + 2 + (signed char) *ip;
+ else
+ target = cli_addr + 5 + (gint32) read32(ip);
+
+ g_assert (target >= 0 && target <= header->code_size);
+ g_assert (bcinfo [target].is_block_start);
+ tbb = &cfg->bblocks [bcinfo [target].block_id];
+
+ /* empty the stack */
+ sp = stack;
+
+ mark_reached (cfg, tbb, NULL, 0);
+
+ /* fixme: fault handler */
+
+ if ((hb = mono_find_final_block (cfg, cli_addr, MONO_EXCEPTION_CLAUSE_FINALLY))) {
+ mark_reached (cfg, hb, NULL, 0);
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_HANDLER);
+ t1->data.p = hb;
+ ADD_TREE (t1, cli_addr);
+ }
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_BR);
+ t1->data.p = tbb;
+ ADD_TREE (t1, cli_addr);
+
+ if (leave_s)
+ ++ip;
+ else
+ ip += 4;
+
+ superblock_end = TRUE;
+ break;
+ }
+
+
+ MAKE_CJUMP(BGT)
+ MAKE_CJUMP(BGT_UN)
+ MAKE_CJUMP(BLT)
+ MAKE_CJUMP(BLT_UN)
+ MAKE_CJUMP(BNE_UN)
+ MAKE_CJUMP(BEQ)
+ MAKE_CJUMP(BGE)
+ MAKE_CJUMP(BGE_UN)
+ MAKE_CJUMP(BLE)
+ MAKE_CJUMP(BLE_UN)
+
+ case CEE_BRTRUE:
+ case CEE_BRTRUE_S: {
+ gint32 target;
+ int near_jump = *ip == CEE_BRTRUE_S;
+ ++ip;
+ --sp;
+
+ t1 = mono_ctree_new (mp, MB_TERM_BRTRUE, sp [0], NULL);
+
+ if (near_jump)
+ target = cli_addr + 2 + (signed char) *ip;
+ else
+ target = cli_addr + 5 + (gint32) read32 (ip);
+
+ g_assert (target >= 0 && target <= header->code_size);
+ g_assert (bcinfo [target].is_block_start);
+ tbb = &cfg->bblocks [bcinfo [target].block_id];
+ create_outstack (cfg, bb, stack, sp - stack);
+ mark_reached (cfg, tbb, bb->outstack, bb->outdepth);
+
+ t1->data.p = tbb;
+ ip += near_jump ? 1: 4;
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+ case CEE_BRFALSE:
+ case CEE_BRFALSE_S: {
+ gint32 target;
+ int near_jump = *ip == CEE_BRFALSE_S;
+ ++ip;
+ --sp;
+
+ t1 = mono_ctree_new (mp, MB_TERM_BRFALSE, sp [0], NULL);
+
+ if (near_jump)
+ target = cli_addr + 2 + (signed char) *ip;
+ else
+ target = cli_addr + 5 + (gint32) read32 (ip);
+
+ g_assert (target >= 0 && target <= header->code_size);
+ g_assert (bcinfo [target].is_block_start);
+ tbb = &cfg->bblocks [bcinfo [target].block_id];
+ create_outstack (cfg, bb, stack, sp - stack);
+ mark_reached (cfg, tbb, bb->outstack, bb->outdepth);
+
+ t1->data.p = tbb;
+ ip += near_jump ? 1: 4;
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+ case CEE_RET: {
+ MonoType *ret = signature->ret;
+
+ ip++;
+
+ if (ret->type != MONO_TYPE_VOID) {
+ --sp;
+ if (ISSTRUCT (ret)) {
+ int align;
+ t1 = mono_ctree_new (mp, MB_TERM_RET_OBJ, *sp, NULL);
+ t1->data.i = mono_class_value_size (ret->data.klass, &align);
+ } else {
+ t1 = mono_ctree_new (mp, MB_TERM_RET, *sp, NULL);
+ }
+ } else {
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_RET_VOID);
+ }
+
+ t1->last_instr = (ip == (header->code + header->code_size));
+
+ ADD_TREE (t1, cli_addr);
+
+ if (sp > stack) {
+ g_warning ("more values on stack at IL_%04x: %d", ip - header->code, sp - stack);
+ mono_print_ctree (sp [-1]);
+ printf ("\n");
+ }
+ superblock_end = TRUE;
+ break;
+ }
+ case CEE_ENDFINALLY: {
+ ip++;
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ENDFINALLY);
+ ADD_TREE (t1, cli_addr);
+ t1->last_instr = FALSE;
+
+ g_assert (sp == stack);
+ superblock_end = TRUE;
+ break;
+ }
+ case CEE_LDARG_0:
+ case CEE_LDARG_1:
+ case CEE_LDARG_2:
+ case CEE_LDARG_3: {
+ int n = (*ip) - CEE_LDARG_0;
+ ++ip;
+
+ if (arg_map) {
+ *sp = arg_map [n];
+ sp++;
+ } else {
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = ARG_POS (n);
+ if (!ISSTRUCT (ARG_TYPE (n)))
+ t1 = ctree_create_load (cfg, ARG_TYPE (n), t1, &svt, TRUE);
+
+ PUSH_TREE (t1, svt);
+ }
+
+ break;
+ }
+ case CEE_LDARG_S: {
+ ++ip;
+
+ if (arg_map) {
+ *sp = arg_map [*ip];
+ sp++;
+ } else {
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = ARG_POS (*ip);
+ if (!ISSTRUCT (ARG_TYPE (*ip)))
+ t1 = ctree_create_load (cfg, ARG_TYPE (*ip), t1, &svt, TRUE);
+ PUSH_TREE (t1, svt);
+ }
+ ++ip;
+ break;
+ }
+ case CEE_LDARGA_S: {
+ ++ip;
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = ARG_POS (*ip);
+ PUSH_TREE (t1, VAL_POINTER);
+ ++ip;
+ break;
+ }
+ case CEE_STARG_S: {
+ ++ip;
+ --sp;
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = ARG_POS (*ip);
+ t1 = ctree_create_store (cfg, ARG_TYPE (*ip), t1, *sp, TRUE);
+ ++ip;
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+ case CEE_DUP: {
+ int vnum;
+
+ ++ip;
+
+ /* fixme: maybe we should add more of these optimisations */
+ if (sp [-1]->op == MB_TERM_CONST_I4) {
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t1->data.i = sp [-1]->data.i;
+ PUSH_TREE (t1, VAL_I32);
+
+ } else {
+ sp--;
+
+ vnum = mono_allocate_intvar (cfg, sp - stack, sp [0]->svt);
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = vnum;
+
+ t2 = mono_ctree_new (mp, map_store_svt_type (sp [0]->svt), t1, sp [0]);
+ t2->svt = sp [0]->svt;
+ ADD_TREE (t2, cli_addr);
+
+ t1 = ctree_create_dup (mp, t2);
+ PUSH_TREE (t1, t1->svt);
+ t1 = ctree_create_dup (mp, t1);
+ PUSH_TREE (t1, t1->svt);
+ }
+ break;
+ }
+ case CEE_POP: {
+ ++ip;
+ --sp;
+
+ t1 = mono_ctree_new (mp, MB_TERM_POP, *sp, NULL);
+ ADD_TREE (t1, cli_addr);
+
+ break;
+ }
+ case CEE_CONV_U1:
+ case CEE_CONV_I1: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_I1, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_U2:
+ case CEE_CONV_I2: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_I2, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_I:
+ case CEE_CONV_U:
+ case CEE_CONV_U4:
+ case CEE_CONV_I4: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_I4, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_I8: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_I8, *sp, NULL);
+ PUSH_TREE (t1, VAL_I64);
+ break;
+ }
+ case CEE_CONV_U8: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_I8, *sp, NULL);
+ PUSH_TREE (t1, VAL_I64);
+ break;
+ }
+ case CEE_CONV_R8: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_R8, *sp, NULL);
+ PUSH_TREE (t1, VAL_DOUBLE);
+ break;
+ }
+ case CEE_CONV_R4: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_R4, *sp, NULL);
+ PUSH_TREE (t1, VAL_DOUBLE);
+ break;
+ }
+ case CEE_CONV_R_UN: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_R_UN, *sp, NULL);
+ PUSH_TREE (t1, VAL_DOUBLE);
+ break;
+ }
+ case CEE_CONV_OVF_I:
+ case CEE_CONV_OVF_I4: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_I4, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_I_UN:
+ case CEE_CONV_OVF_I4_UN: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_I4_UN, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_U:
+ case CEE_CONV_OVF_U4: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_U4, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_I1: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_I1, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_I1_UN: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_I1_UN, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_U1_UN: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_U1_UN, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+
+ case CEE_CONV_OVF_U1: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_U1, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_I2: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_I2, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_U2_UN: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_U2_UN, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_U2: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_U2, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_I2_UN: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_I2_UN, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_U8: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_U8, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_U_UN:
+ case CEE_CONV_OVF_U4_UN: {
+ // fixme: raise exceptions ?
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_I4, *sp, NULL);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_CONV_OVF_I8_UN: {
+ ++ip;
+ sp--;
+ t1 = mono_ctree_new (mp, MB_TERM_CONV_OVF_I8_UN, *sp, NULL);
+ PUSH_TREE (t1, VAL_I64);
+ break;
+ }
+ case CEE_PREFIX1: {
+ ++ip;
+ switch (*ip) {
+
+ case CEE_LDLOC: {
+ int n;
+ ++ip;
+ n = read16 (ip);
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = LOCAL_POS (n);
+ if (!ISSTRUCT (LOCAL_TYPE (n)))
+ t1 = ctree_create_load (cfg, LOCAL_TYPE (n), t1, &svt, FALSE);
+ ip += 2;
+
+ PUSH_TREE (t1, svt);
+ break;
+ }
+ case CEE_LDLOCA: {
+ ++ip;
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = LOCAL_POS (read16 (ip));
+ ip += 2;
+ PUSH_TREE (t1, VAL_POINTER);
+ break;
+ }
+ case CEE_STLOC: {
+ ++ip;
+ --sp;
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = LOCAL_POS (read16 (ip));
+ t1 = ctree_create_store (cfg, LOCAL_TYPE (read16 (ip)), t1, *sp, FALSE);
+
+ ip += 2;
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+
+ MAKE_CMP (CEQ)
+ MAKE_CMP (CLT)
+ MAKE_CMP (CLT_UN)
+ MAKE_CMP (CGT)
+ MAKE_CMP (CGT_UN)
+
+ case CEE_RETHROW: {
+ ++ip;
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_RETHROW);
+ t1->data.i = mono_allocate_excvar (cfg);
+ ADD_TREE (t1, cli_addr);
+ break;
+ }
+ case CEE_LDFTN: {
+ MonoMethod *cm;
+ guint32 token;
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+
+ cm = mono_get_method (image, token, NULL);
+ g_assert (cm);
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_LDFTN);
+ t1->data.m = cm;
+ PUSH_TREE (t1, VAL_POINTER);
+ break;
+ }
+ case CEE_LDVIRTFTN: {
+ MonoMethod *cm;
+ guint32 token;
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ --sp;
+
+ cm = mono_get_method (image, token, NULL);
+ g_assert (cm);
+
+ if (cm->klass->flags & TYPE_ATTRIBUTE_INTERFACE)
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_INTF_ADDR);
+ else
+ t2 = mono_ctree_new_leaf (mp, MB_TERM_VFUNC_ADDR);
+
+ t2->data.m = cm;
+
+ t1 = mono_ctree_new (mp, MB_TERM_LDVIRTFTN, *sp, t2);
+
+ PUSH_TREE (t1, VAL_POINTER);
+
+ break;
+ }
+ case CEE_INITOBJ: {
+ MonoClass *class;
+ guint32 token;
+
+ ++ip;
+ token = read32 (ip);
+ class = mono_class_get (image, token);
+ ip += 4;
+ sp--;
+
+ t1 = mono_ctree_new (mp, MB_TERM_INITOBJ, *sp, NULL);
+ t1->data.i = mono_class_value_size (class, NULL);
+ ADD_TREE (t1, cli_addr);
+
+ break;
+ }
+ case CEE_LDARG: {
+ guint32 n;
+ ++ip;
+ n = read32 (ip);
+ ip += 4;
+
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_ADDR_L);
+ t1->data.i = ARG_POS (n);
+ if (!ISSTRUCT (ARG_TYPE (n)))
+ t1 = ctree_create_load (cfg, ARG_TYPE (n), t1, &svt, TRUE);
+ PUSH_TREE (t1, svt);
+ break;
+ }
+ case CEE_SIZEOF: {
+ guint32 token;
+ MonoType *type;
+ int align;
+ ++ip;
+ token = read32 (ip);
+ ip += 4;
+ type = mono_type_create_from_typespec (image, token);
+ t1 = mono_ctree_new_leaf (mp, MB_TERM_CONST_I4);
+ t1->data.i = mono_type_size (type, &align);
+ mono_metadata_free_type (type);
+ PUSH_TREE (t1, VAL_I32);
+ break;
+ }
+ case CEE_UNALIGNED_: {
+ ++ip;
+ // fixme: implement me
+ break;
+ }
+ case CEE_VOLATILE_: {
+ ++ip;
+ // fixme: implement me
+ break;
+ }
+ default:
+ g_error ("Unimplemented opcode at IL_%04x "
+ "0xFE %02x", ip - header->code, *ip);
+ }
+ break;
+ }
+ default:
+ g_warning ("unknown instruction `%s' at IL_%04X",
+ mono_opcode_names [*ip], ip - header->code);
+ if (mono_debug_handle) {
+ cfg->invalid = 1;
+ return;
+ }
+ mono_print_forest (forest);
+ g_assert_not_reached ();
+ }
+ }
+
+ if ((depth = sp - stack)) {
+ //printf ("DEPTH %d %d\n", depth, sp [0]->op);
+ //mono_print_forest (forest);
+ create_outstack (cfg, bb, stack, sp - stack);
+ }
+
+ } else
+ superblock_end = TRUE;
+
+ } else {
+ superblock_end = TRUE;
+ //printf ("unreached block %d\n", i);
+ repeat = TRUE;
+ if (repeat_count >= 10) {
+ /*mono_print_forest (forest);
+ g_warning ("repeat count exceeded at ip: 0x%04x in %s\n", bb->cli_addr, cfg->method->name);*/
+ repeat = FALSE;
+ }
+ }
+ //printf ("BBE %d %d %d %d\n", i, bb->reached, bb->finished, superblock_end);
+ }
+
+ repeat_count++;
+ //printf ("REPEAT %d\n", repeat);
+ mono_jit_stats.analyze_stack_repeat++;
+
+
+ } while (repeat);
+
+ //printf ("FINISHED\n");
+}
+
+/* this function is never called */
+static void
+ves_array_set (MonoArray *this, ...)
+{
+ g_assert_not_reached ();
+}
+
+/* this function is never called */
+static void
+ves_array_get (MonoArray *this, ...)
+{
+ g_assert_not_reached ();
+}
+
+/**
+ * mono_jit_exec:
+ * @assembly: reference to an assembly
+ * @argc: argument count
+ * @argv: argument vector
+ *
+ * Start execution of a program.
+ */
+int
+mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[])
+{
+ MonoArray *args = NULL;
+ MonoImage *image = assembly->image;
+ MonoCLIImageInfo *iinfo;
+ MonoMethod *method;
+
+ iinfo = image->image_info;
+ method = mono_get_method (image, iinfo->cli_cli_header.ch_entry_point, NULL);
+
+ if (method->signature->param_count) {
+ int i;
+ args = (MonoArray*)mono_array_new (domain, mono_defaults.string_class, argc);
+ for (i = 0; i < argc; ++i) {
+ MonoString *arg = mono_string_new (domain, argv [i]);
+ mono_array_set (args, gpointer, i, arg);
+ }
+ }
+
+ return mono_runtime_exec_main (method, args);
+}
+
+#ifdef PLATFORM_WIN32
+#define GET_CONTEXT \
+ struct sigcontext *ctx = (struct sigcontext*)_dummy;
+#else
+#define GET_CONTEXT \
+ void **_p = (void **)&_dummy; \
+ struct sigcontext *ctx = (struct sigcontext *)++_p;
+#endif
+
+static void
+sigfpe_signal_handler (int _dummy)
+{
+ MonoException *exc;
+ GET_CONTEXT
+
+ exc = mono_get_exception_divide_by_zero ();
+
+ arch_handle_exception (ctx, exc);
+
+ g_error ("we should never reach this code");
+}
+
+static void
+sigill_signal_handler (int _dummy)
+{
+ MonoException *exc;
+ GET_CONTEXT
+
+ exc = mono_get_exception_execution_engine ("SIGILL");
+
+ arch_handle_exception (ctx, exc);
+
+ g_error ("we should never reach this code");
+}
+
+static void
+sigsegv_signal_handler (int _dummy)
+{
+ MonoException *exc;
+ GET_CONTEXT
+
+ exc = mono_get_exception_null_reference ();
+
+ arch_handle_exception (ctx, exc);
+
+ g_error ("we should never reach this code");
+}
+
+/**
+ * mono_jit_abort:
+ * @obj: exception object
+ *
+ * abort the program, print exception information and stack trace
+ */
+static void
+mono_jit_abort (MonoObject *obj)
+{
+ const char *message = "";
+ char *trace = NULL;
+ MonoString *str; ;
+
+ g_assert (obj);
+
+ if (mono_object_isinst (obj, mono_defaults.exception_class)) {
+ if ((str = ((MonoException *)obj)->message))
+ message = mono_string_to_utf8 (str);
+ if ((str = ((MonoException *)obj)->stack_trace))
+ trace = mono_string_to_utf8 (str);
+ }
+
+ g_warning ("unhandled exception %s.%s: \"%s\"", obj->vtable->klass->name_space,
+ obj->vtable->klass->name, message);
+
+ if (trace) {
+ g_printerr (trace);
+ g_printerr ("\n");
+ }
+
+ exit (1);
+}
+
+static CRITICAL_SECTION ms;
+
+MonoDomain*
+mono_jit_init (char *file) {
+#ifndef PLATFORM_WIN32
+ struct sigaction sa;
+#endif
+ MonoDomain *domain;
+
+
+#ifdef PLATFORM_WIN32
+ win32_seh_init();
+ win32_seh_set_handler(SIGFPE, sigfpe_signal_handler);
+ win32_seh_set_handler(SIGILL, sigill_signal_handler);
+ win32_seh_set_handler(SIGSEGV, sigsegv_signal_handler);
+#else /* !PLATFORM_WIN32 */
+ /* catch SIGFPE */
+ sa.sa_handler = sigfpe_signal_handler;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ g_assert (syscall (SYS_sigaction, SIGFPE, &sa, NULL) != -1);
+
+ /* catch SIGILL */
+ sa.sa_handler = sigill_signal_handler;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ g_assert (syscall (SYS_sigaction, SIGILL, &sa, NULL) != -1);
+
+#if 1
+ /* catch SIGSEGV */
+ sa.sa_handler = sigsegv_signal_handler;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ g_assert (syscall (SYS_sigaction, SIGSEGV, &sa, NULL) != -1);
+#endif
+#endif /* PLATFORM_WIN32 */
+
+ mono_init_icall ();
+ mono_add_internal_call ("System.Array::Set", ves_array_set);
+ mono_add_internal_call ("System.Array::Get", ves_array_get);
+ mono_add_internal_call ("System.Array::Address", ves_array_element_address);
+
+ metadata_section = &ms;
+ InitializeCriticalSection (metadata_section);
+
+ lmf_thread_id = TlsAlloc ();
+ TlsSetValue (lmf_thread_id, NULL);
+ exc_cleanup_id = TlsAlloc ();
+ TlsSetValue (exc_cleanup_id, mono_jit_abort);
+ async_result_id = TlsAlloc ();
+
+ mono_install_trampoline (arch_create_jit_trampoline);
+ mono_install_remoting_trampoline (arch_create_remoting_trampoline);
+ mono_install_handler (arch_get_throw_exception ());
+ mono_install_runtime_invoke (arch_runtime_invoke);
+
+ domain = mono_init (file);
+ mono_runtime_init (domain);
+ mono_thread_init (domain);
+ mono_network_init ();
+ mono_delegate_init ();
+
+ return domain;
+}
+
+void
+mono_jit_cleanup (MonoDomain *domain)
+{
+ if (mono_debug_handle)
+ mono_debug_close (mono_debug_handle);
+
+#ifdef PLATFORM_WIN32
+ win32_seh_cleanup();
+#endif
+
+ mono_delegate_cleanup ();
+ mono_network_cleanup ();
+ mono_thread_cleanup ();
+
+ mono_domain_unload (domain, TRUE);
+
+ if (mono_jit_stats.enabled) {
+ g_print ("Mono Jit statistics\n");
+ g_print ("Compiled methods: %ld\n", mono_jit_stats.methods_compiled);
+ g_print ("Methods cache lookup: %ld\n", mono_jit_stats.methods_lookups);
+ g_print ("Method trampolines: %ld\n", mono_jit_stats.method_trampolines);
+ g_print ("Allocated vars: %ld\n", mono_jit_stats.allocate_var);
+ g_print ("Analyze stack repeat: %ld\n", mono_jit_stats.analyze_stack_repeat);
+ g_print ("Compiled CIL code size: %ld\n", mono_jit_stats.cil_code_size);
+ g_print ("Native code size: %ld\n", mono_jit_stats.native_code_size);
+ g_print ("Max code size ratio: %.2f (%s::%s)\n", mono_jit_stats.max_code_size_ratio/100.0,
+ mono_jit_stats.max_ratio_method->klass->name, mono_jit_stats.max_ratio_method->name);
+ g_print ("Biggest method: %ld (%s::%s)\n", mono_jit_stats.biggest_method_size,
+ mono_jit_stats.biggest_method->klass->name, mono_jit_stats.biggest_method->name);
+ g_print ("Code reallocs: %ld\n", mono_jit_stats.code_reallocs);
+ g_print ("Allocated code size: %ld\n", mono_jit_stats.allocated_code_size);
+ g_print ("Inlineable methods: %ld\n", mono_jit_stats.inlineable_methods);
+ g_print ("Inlined methods: %ld\n", mono_jit_stats.inlined_methods);
+
+ g_print ("\nCreated object count: %ld\n", mono_stats.new_object_count);
+ g_print ("Initialized classes: %ld\n", mono_stats.initialized_class_count);
+ g_print ("Used classes: %ld\n", mono_stats.used_class_count);
+ g_print ("Static data size: %ld\n", mono_stats.class_static_data_size);
+ g_print ("VTable data size: %ld\n", mono_stats.class_vtable_size);
+ }
+
+ DeleteCriticalSection (metadata_section);
+
+}
+
diff --git a/mono/jit/jit.h b/mono/jit/jit.h
new file mode 100644
index 00000000000..522aeada738
--- /dev/null
+++ b/mono/jit/jit.h
@@ -0,0 +1,284 @@
+/*
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#ifndef _MONO_JIT_JIT_H_
+#define _MONO_JIT_JIT_H_
+
+#include <config.h>
+/*
+ * io-layer.h must be _BEFORE_ win32-exception.h to avoid problems when
+ * compiling with version 1.2 of mingw and w32api.
+ */
+#include <mono/io-layer/io-layer.h>
+
+#ifdef PLATFORM_WIN32
+#include "win32-exception.h"
+#else
+#include <signal.h>
+#endif
+
+#include <mono/metadata/loader.h>
+#include <mono/metadata/object.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/mempool.h>
+#include <mono/metadata/reflection.h>
+
+#include "regset.h"
+
+#define ISSTRUCT(t) (!t->byref && t->type == MONO_TYPE_VALUETYPE && !t->data.klass->enumtype)
+
+typedef struct _MBTree MBTree;
+
+typedef enum {
+ VAL_UNKNOWN,
+ VAL_I32,
+ VAL_I64,
+ VAL_POINTER,
+ VAL_DOUBLE, /* must be the last - do not reorder */
+} MonoValueType;
+
+typedef enum {
+ MONO_ARGVAR,
+ MONO_LOCALVAR,
+ MONO_TEMPVAR,
+} MonoValueKind;
+
+typedef struct {
+ gpointer previous_lmf;
+ gpointer lmf_addr;
+ MonoMethod *method;
+ guint32 ebp;
+ guint32 esi;
+ guint32 edi;
+ guint32 ebx;
+ guint32 eip;
+} MonoLMF;
+
+typedef struct {
+ MonoValueType type;
+ MonoValueKind kind;
+ int offset;
+ int size;
+} MonoVarInfo;
+
+typedef struct {
+ unsigned block_id:15;
+ unsigned is_block_start:1;
+} MonoBytecodeInfo;
+
+typedef struct {
+ unsigned reached:1;
+ unsigned finished:1;
+
+ gint32 cli_addr; /* start instruction */
+ gint32 length; /* length of stream */
+ GPtrArray *forest;
+ MBTree **instack;
+ gint32 indepth;
+ MBTree **outstack;
+ gint32 outdepth;
+ gint32 addr;
+} MonoBBlock;
+
+typedef enum {
+ MONO_JUMP_INFO_BB,
+ MONO_JUMP_INFO_ABS,
+ MONO_JUMP_INFO_EPILOG,
+ MONO_JUMP_INFO_IP,
+} MonoJumpInfoType;
+
+typedef struct _MonoJumpInfo MonoJumpInfo;
+struct _MonoJumpInfo {
+ MonoJumpInfo *next;
+ gpointer ip;
+ MonoJumpInfoType type;
+ union {
+ gpointer target;
+ MonoBBlock *bb;
+ } data;
+};
+
+typedef struct {
+ MonoDomain *domain;
+ unsigned has_vtarg:1;
+ unsigned share_code:1;
+ MonoMethod *method;
+ MonoBytecodeInfo *bcinfo;
+ MonoBBlock *bblocks;
+ int block_count;
+ GArray *varinfo;
+ gint32 locals_size;
+ gint32 args_size;
+ guint16 *intvars;
+ guint16 excvar;
+
+ MonoMemPool *mp;
+ guint8 *start;
+ guint8 *code;
+ gint32 code_size;
+ gint32 prologue_end;
+ gint32 epilogue_begin;
+ MonoRegSet *rs;
+ guint32 epilog;
+ guint32 args_start_index;
+ guint32 locals_start_index;
+ gint invalid;
+
+ MonoJumpInfo *jump_info;
+} MonoFlowGraph;
+
+typedef struct {
+ MonoMethod *m;
+ gint16 args_size;
+ gint16 vtype_num;
+} MonoJitCallInfo;
+
+typedef struct {
+ MonoClass *klass;
+ MonoClassField *field;
+} MonoJitFieldInfo;
+
+typedef struct {
+ gulong methods_compiled;
+ gulong methods_lookups;
+ gulong method_trampolines;
+ gulong allocate_var;
+ gulong analyze_stack_repeat;
+ gulong cil_code_size;
+ gulong native_code_size;
+ gulong code_reallocs;
+ gulong max_code_size_ratio;
+ gulong biggest_method_size;
+ gulong allocated_code_size;
+ gulong inlineable_methods;
+ gulong inlined_methods;
+ MonoMethod *max_ratio_method;
+ MonoMethod *biggest_method;
+ gboolean enabled;
+} MonoJitStats;
+
+extern MonoJitStats mono_jit_stats;
+extern gboolean mono_jit_dump_asm;
+extern gboolean mono_jit_dump_forest;
+extern gboolean mono_jit_trace_calls;
+extern gboolean mono_jit_profile;
+extern gboolean mono_jit_share_code;
+extern gboolean mono_jit_inline_code;
+extern gpointer mono_end_of_stack;
+extern int mono_worker_threads;
+extern guint32 lmf_thread_id;
+extern guint32 exc_cleanup_id;
+extern guint32 async_result_id;
+
+extern CRITICAL_SECTION *metadata_section;
+
+void
+arch_handle_exception (struct sigcontext *ctx, gpointer obj);
+
+gpointer
+arch_get_throw_exception (void);
+
+gpointer
+arch_get_throw_exception_by_name (void);
+
+MonoFlowGraph *
+mono_cfg_new (MonoMethod *method, MonoMemPool *mp);
+
+void
+mono_cfg_free (MonoFlowGraph *cfg);
+
+MBTree *
+mono_ctree_new (MonoMemPool *mp, int op, MBTree *left,
+ MBTree *right);
+MBTree *
+mono_ctree_new_leaf (MonoMemPool *mp, int op);
+
+void
+mono_analyze_flow (MonoFlowGraph *cfg);
+
+void
+mono_analyze_stack (MonoFlowGraph *cfg);
+
+void
+mono_add_jump_info (MonoFlowGraph *cfg, gpointer ip,
+ MonoJumpInfoType type, gpointer target);
+
+void
+mono_disassemble_code (guint8 *code, int size, char *id);
+
+gpointer
+arch_compile_method (MonoMethod *method);
+
+gpointer
+arch_create_jit_trampoline (MonoMethod *method);
+
+gpointer
+arch_create_remoting_trampoline (MonoMethod *method);
+
+MonoObject*
+arch_runtime_invoke (MonoMethod *method, void *obj, void **params);
+
+gpointer
+arch_create_native_wrapper (MonoMethod *method);
+
+/* delegate support functions */
+
+void
+mono_delegate_init (void);
+
+void
+mono_delegate_cleanup (void);
+
+void
+mono_delegate_ctor (MonoDelegate *this, MonoObject *target, gpointer addr);
+
+gpointer
+arch_begin_invoke (MonoMethod *method, gpointer ret_ip, MonoObject *delegate);
+
+void
+arch_end_invoke (MonoMethod *method, gpointer first_arg, ...);
+
+gpointer
+arch_get_delegate_invoke (MonoMethod *method, int *size);
+
+gpointer
+mono_load_remote_field (MonoObject *this, MonoClass *klass, MonoClassField *field, gpointer *res);
+
+void
+mono_store_remote_field (MonoObject *this, MonoClass *klass, MonoClassField *field, gpointer val);
+
+MonoDomain *
+mono_jit_init (char *file);
+
+int
+mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly,
+ int argc, char *argv[]);
+
+void
+mono_jit_cleanup (MonoDomain *domain);
+
+MonoMethodMessage *
+arch_method_call_message_new (MonoMethod *method, gpointer stack, MonoMethod *invoke,
+ MonoDelegate **cb, MonoObject **state);
+
+void
+arch_return_value (MonoType *return_type, MonoObject *result, gpointer stack);
+
+void
+arch_method_return_message_restore (MonoMethod *method, gpointer stack,
+ MonoObject *result, MonoArray *out_args);
+
+
+/* some handy debugging functions */
+
+void
+mono_print_ctree (MBTree *tree);
+
+void
+mono_print_forest (GPtrArray *forest);
+
+#endif
diff --git a/mono/jit/message.c b/mono/jit/message.c
new file mode 100644
index 00000000000..5ce18ce295d
--- /dev/null
+++ b/mono/jit/message.c
@@ -0,0 +1,342 @@
+/*
+ * message.c: stack <-> message translation
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+
+#include <mono/metadata/metadata.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/tabledefs.h>
+
+#include "jit.h"
+
+void
+arch_return_value (MonoType *return_type, MonoObject *result, gpointer stack)
+{
+ gpointer resp, vt_resp;
+ int type;
+
+ resp = &result;
+ vt_resp = (char *)result + sizeof (MonoObject);
+
+ if (return_type->byref) {
+ asm ("movl (%0),%%eax" : : "r" (resp) : "eax");
+ return;
+ }
+
+ type = return_type->type;
+ handle_enum:
+ switch (type) {
+ case MONO_TYPE_VOID:
+ /* nothing to do */
+ break;
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_CHAR:
+#if SIZEOF_VOID_P == 4
+ case MONO_TYPE_U:
+ case MONO_TYPE_I:
+#endif
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ asm ("movl (%0),%%eax" : : "r" (vt_resp) : "eax");
+ break;
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_CLASS:
+ asm ("movl (%0),%%eax" : : "r" (resp) : "eax");
+ break;
+#if SIZEOF_VOID_P == 8
+ case MONO_TYPE_U:
+ case MONO_TYPE_I:
+#endif
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8:
+ asm ("movl 0(%0),%%eax;"
+ "movl 4(%0),%%edx"
+ : : "r"(vt_resp)
+ : "eax", "edx");
+ break;
+ case MONO_TYPE_R4:
+ asm ("fld (%0)" : : "r" (vt_resp) : "st", "st(1)" );
+ break;
+ case MONO_TYPE_R8:
+ asm ("fldl (%0)" : : "r" (vt_resp) : "st", "st(1)" );
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (return_type->data.klass->enumtype) {
+ type = return_type->data.klass->enum_basetype->type;
+ goto handle_enum;
+ } else {
+ memcpy (*((gpointer *)stack), vt_resp,
+ mono_class_value_size (return_type->data.klass, NULL));
+ }
+ break;
+ default:
+ g_error ("type 0x%x not handled in remoting invoke", return_type->type);
+
+ }
+}
+
+/**
+ * arch_method_return_message_restore:
+ * @method: method info
+ * @stack: pointer to the stack arguments
+ * @result: result to restore
+ * @out_args: out arguments to restore
+ *
+ * Restore results from message based processing back to the stack.
+ */
+void
+arch_method_return_message_restore (MonoMethod *method, gpointer stack,
+ MonoObject *result, MonoArray *out_args)
+{
+ MonoMethodSignature *sig = method->signature;
+ MonoClass *class;
+ int i, j, type, size, align;
+ char *cpos = stack;
+
+ if (ISSTRUCT (sig->ret))
+ cpos += 4;
+
+ if (sig->hasthis)
+ cpos += 4;
+
+ for (i = 0, j = 0; i < sig->param_count; i++) {
+ size = mono_type_stack_size (sig->params [i], &align);
+
+ if (sig->params [i]->byref) {
+ char *arg = mono_array_get (out_args, gpointer, j);
+ type = sig->params [i]->type;
+ class = mono_class_from_mono_type (sig->params [i]);
+
+ switch (type) {
+ case MONO_TYPE_VOID:
+ g_assert_not_reached ();
+ break;
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ case MONO_TYPE_VALUETYPE: {
+ memcpy (*((gpointer *)cpos), arg + sizeof (MonoObject), size);
+ break;
+ }
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY:
+ *((MonoObject **)cpos) = (MonoObject *)arg;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ j++;
+ }
+
+ cpos += size;
+ }
+
+ arch_return_value (sig->ret, result, stack);
+}
+
+/**
+ * arch_method_call_message_new:
+ * @method: method info
+ * @stack: pointer to the stack arguments
+ *
+ * Translates arguments on the stack into a Message.
+ */
+
+MonoMethodMessage *
+arch_method_call_message_new (MonoMethod *method, gpointer stack, MonoMethod *invoke,
+ MonoDelegate **cb, MonoObject **state)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoMethodSignature *sig = method->signature;
+ MonoMethodMessage *msg;
+ int i, count, type, size, align;
+ char *cpos = stack;
+
+ msg = (MonoMethodMessage *)mono_object_new (domain, mono_defaults.mono_method_message_class);
+
+ if (invoke) {
+ mono_message_init (domain, msg, mono_method_get_object (domain, invoke), NULL);
+ count = sig->param_count - 2;
+ } else {
+ mono_message_init (domain, msg, mono_method_get_object (domain, method), NULL);
+ count = sig->param_count;
+ }
+ /* the first argument is an implizit reference for valuetype
+ * return values */
+ if (!invoke && ISSTRUCT (sig->ret))
+ cpos += 4;
+
+ if (sig->hasthis)
+ cpos += 4;
+
+
+ for (i = 0; i < count; i++) {
+ gpointer vpos;
+ MonoClass *class;
+ MonoObject *arg;
+
+ size = mono_type_stack_size (sig->params [i], &align);
+
+ if (sig->params [i]->byref)
+ vpos = *((gpointer *)cpos);
+ else
+ vpos = cpos;
+
+ type = sig->params [i]->type;
+ class = mono_class_from_mono_type (sig->params [i]);
+
+ if (class->valuetype)
+ arg = mono_value_box (domain, class, vpos);
+ else
+ arg = *((MonoObject **)vpos);
+
+ mono_array_set (msg->args, gpointer, i, arg);
+ cpos += size;
+ }
+
+ if (invoke) {
+ *cb = *((MonoObject **)cpos);
+ cpos += sizeof (MonoObject *);
+ *state = *((MonoObject **)cpos);
+ }
+
+ return msg;
+}
+
+/**
+ * mono_load_remote_field:
+ * @this: pointer to an object
+ * @klass: klass of the object containing @field
+ * @field: the field to load
+ * @res: a storage to store the result
+ *
+ * This method is called by the runtime on attempts to load fields of
+ * transparent proxy objects. @this points to such TP, @klass is the class of
+ * the object containing @field. @res is only a storage location which can be
+ * used to store the result.
+ *
+ * Returns: an address pointing to the value of field.
+ */
+gpointer
+mono_load_remote_field (MonoObject *this, MonoClass *klass, MonoClassField *field, gpointer *res)
+{
+ static MonoMethod *getter = NULL;
+ MonoDomain *domain = mono_domain_get ();
+ MonoClass *field_class;
+ MonoMethodMessage *msg;
+ MonoArray *out_args;
+ MonoObject *exc;
+
+ g_assert (this->vtable->klass == mono_defaults.transparent_proxy_class);
+
+ if (!getter) {
+ int i;
+
+ for (i = 0; i < mono_defaults.object_class->method.count; ++i) {
+ MonoMethod *cm = mono_defaults.object_class->methods [i];
+
+ if (!strcmp (cm->name, "FieldGetter")) {
+ getter = cm;
+ break;
+ }
+ }
+ g_assert (getter);
+ }
+
+ field_class = mono_class_from_mono_type (field->type);
+
+ msg = (MonoMethodMessage *)mono_object_new (domain, mono_defaults.mono_method_message_class);
+ out_args = mono_array_new (domain, mono_defaults.object_class, 1);
+ mono_message_init (domain, msg, mono_method_get_object (domain, getter), out_args);
+
+ mono_array_set (msg->args, gpointer, 0, mono_string_new (domain, klass->name));
+ mono_array_set (msg->args, gpointer, 1, mono_string_new (domain, field->name));
+
+ mono_remoting_invoke ((MonoObject *)((MonoTransparentProxy *)this)->rp, msg, &exc, &out_args);
+
+ *res = mono_array_get (out_args, MonoObject *, 0);
+
+ if (field_class->valuetype) {
+ return ((char *)*res) + sizeof (MonoObject);
+ } else
+ return res;
+}
+
+/**
+ * mono_store_remote_field:
+ * @this: pointer to an object
+ * @klass: klass of the object containing @field
+ * @field: the field to load
+ * @val: the value/object to store
+ *
+ * This method is called by the runtime on attempts to store fields of
+ * transparent proxy objects. @this points to such TP, @klass is the class of
+ * the object containing @field. @val is the new value to store in @field.
+ */
+void
+mono_store_remote_field (MonoObject *this, MonoClass *klass, MonoClassField *field, gpointer val)
+{
+ static MonoMethod *setter = NULL;
+ MonoDomain *domain = mono_domain_get ();
+ MonoClass *field_class;
+ MonoMethodMessage *msg;
+ MonoArray *out_args;
+ MonoObject *exc;
+ MonoObject *arg;
+
+ g_assert (this->vtable->klass == mono_defaults.transparent_proxy_class);
+
+ if (!setter) {
+ int i;
+
+ for (i = 0; i < mono_defaults.object_class->method.count; ++i) {
+ MonoMethod *cm = mono_defaults.object_class->methods [i];
+
+ if (!strcmp (cm->name, "FieldSetter")) {
+ setter = cm;
+ break;
+ }
+ }
+ g_assert (setter);
+ }
+
+ field_class = mono_class_from_mono_type (field->type);
+
+ if (field_class->valuetype)
+ arg = mono_value_box (domain, field_class, val);
+ else
+ arg = *((MonoObject **)val);
+
+
+ msg = (MonoMethodMessage *)mono_object_new (domain, mono_defaults.mono_method_message_class);
+ mono_message_init (domain, msg, mono_method_get_object (domain, setter), NULL);
+
+ mono_array_set (msg->args, gpointer, 0, mono_string_new (domain, klass->name));
+ mono_array_set (msg->args, gpointer, 1, mono_string_new (domain, field->name));
+ mono_array_set (msg->args, gpointer, 2, arg);
+
+ mono_remoting_invoke ((MonoObject *)((MonoTransparentProxy *)this)->rp, msg, &exc, &out_args);
+}
+
diff --git a/mono/jit/mono.c b/mono/jit/mono.c
new file mode 100644
index 00000000000..12f1b415b57
--- /dev/null
+++ b/mono/jit/mono.c
@@ -0,0 +1,227 @@
+
+#include "jit.h"
+#include "regset.h"
+#include "codegen.h"
+#include "debug.h"
+#include "mono/metadata/debug-helpers.h"
+#include "mono/metadata/verify.h"
+#include "mono/metadata/profiler.h"
+
+/**
+ * mono_jit_assembly:
+ * @assembly: reference to an assembly
+ *
+ * JIT compilation of all methods in the assembly. Prints debugging
+ * information on stdout.
+ */
+static void
+mono_jit_assembly (MonoAssembly *assembly)
+{
+ MonoImage *image = assembly->image;
+ MonoMethod *method;
+ MonoTableInfo *t = &image->tables [MONO_TABLE_METHOD];
+ int i;
+
+ for (i = 0; i < t->rows; i++) {
+
+ method = mono_get_method (image,
+ (MONO_TABLE_METHOD << 24) | (i + 1),
+ NULL);
+
+ printf ("\nMethod: %s\n\n", method->name);
+
+ if (method->flags & METHOD_ATTRIBUTE_ABSTRACT)
+ printf ("ABSTARCT\n");
+ else
+ arch_compile_method (method);
+
+ }
+
+}
+
+static void
+usage (char *name)
+{
+ fprintf (stderr,
+ "%s %s, the Mono ECMA CLI JIT Compiler, (C) 2001 Ximian, Inc.\n\n"
+ "Usage is: %s [options] executable args...\n", name, VERSION, name);
+ fprintf (stderr,
+ "Valid Options are:\n"
+ "-d debug the jit, show disassembler output.\n"
+ "--dump-asm dumps the assembly code generated\n"
+ "--dump-forest dumps the reconstructed forest\n"
+ "--trace printf function call trace\n"
+ "--profile record and dump profile info\n"
+ "--share-code force jit to produce shared code\n"
+ "--print-vtable print the VTable of all used classes\n"
+ "--workers n maximum number of worker threads\n"
+ "--stabs write stabs debug information\n"
+ "--dwarf write dwarf2 debug information\n"
+ "--dwarf-plus write extended dwarf2 debug information\n"
+ "--stats print statistics about the jit operations\n"
+ "--noinline do not inline code\n"
+ "--compile cname compile methods in given class (namespace.name[:methodname])\n"
+ "--ncompile num compile methods num times (default: 1000)\n"
+ "--debug name insert a breakpoint at the start of method name\n"
+ "--help print this help message\n");
+ exit (1);
+}
+
+
+int
+main (int argc, char *argv [])
+{
+ MonoDomain *domain;
+ MonoAssembly *assembly;
+ int retval = 0, i;
+ int compile_times = 1000;
+ char *compile_class = NULL;
+ char *file, *error;
+ gboolean testjit = FALSE;
+ int stack, verbose = FALSE;
+
+ mono_end_of_stack = &stack; /* a pointer to a local variable is always < BP */
+
+ if (argc < 2)
+ usage (argv [0]);
+
+ for (i = 1; i < argc && argv [i][0] == '-'; i++){
+ if (strcmp (argv [i], "--help") == 0) {
+ usage (argv [0]);
+ } else if (strcmp (argv [i], "-d") == 0) {
+ testjit = TRUE;
+ mono_jit_dump_asm = TRUE;
+ mono_jit_dump_forest = TRUE;
+ } else if (strcmp (argv [i], "--dump-asm") == 0)
+ mono_jit_dump_asm = TRUE;
+ else if (strcmp (argv [i], "--dump-forest") == 0)
+ mono_jit_dump_forest = TRUE;
+ else if (strcmp (argv [i], "--trace") == 0)
+ mono_jit_trace_calls = TRUE;
+ else if (strcmp (argv [i], "--share-code") == 0)
+ mono_jit_share_code = TRUE;
+ else if (strcmp (argv [i], "--noinline") == 0)
+ mono_jit_inline_code = FALSE;
+ else if (strcmp (argv [i], "--print-vtable") == 0)
+ mono_print_vtable = TRUE;
+ else if (strcmp (argv [i], "--debug") == 0) {
+ MonoMethodDesc *desc = mono_method_desc_new (argv [++i], FALSE);
+ if (!desc)
+ g_error ("Invalid method name '%s'", argv [i]);
+ mono_debug_methods = g_list_append (mono_debug_methods, desc);
+ } else if (strcmp (argv [i], "--count") == 0) {
+ compile_times = atoi (argv [++i]);
+ } else if (strcmp (argv [i], "--workers") == 0) {
+ mono_worker_threads = atoi (argv [++i]);
+ if (mono_worker_threads < 1)
+ mono_worker_threads = 1;
+ } else if (strcmp (argv [i], "--profile") == 0) {
+ mono_jit_profile = TRUE;
+ mono_profiler_install_simple ();
+ } else if (strcmp (argv [i], "--compile") == 0) {
+ compile_class = argv [++i];
+ } else if (strcmp (argv [i], "--ncompile") == 0) {
+ compile_times = atoi (argv [++i]);
+ } else if (strcmp (argv [i], "--stats") == 0) {
+ memset (&mono_jit_stats, 0, sizeof (MonoJitStats));
+ mono_jit_stats.enabled = TRUE;
+ } else if (strcmp (argv [i], "--stabs") == 0) {
+ if (mono_debug_handle)
+ g_error ("You can use either --stabs or --dwarf, but not both.");
+ mono_debug_handle = mono_debug_open_file ("", MONO_DEBUG_FORMAT_STABS);
+ } else if (strcmp (argv [i], "--dwarf") == 0) {
+ if (mono_debug_handle)
+ g_error ("You can use either --stabs or --dwarf, but not both.");
+ mono_debug_handle = mono_debug_open_file ("", MONO_DEBUG_FORMAT_DWARF2);
+ } else if (strcmp (argv [i], "--dwarf-plus") == 0) {
+ if (mono_debug_handle)
+ g_error ("You can use either --stabs or --dwarf, but not both.");
+ mono_debug_handle = mono_debug_open_file ("", MONO_DEBUG_FORMAT_DWARF2_PLUS);
+ } else if (strcmp (argv [i], "--verbose") == 0) {
+ verbose = TRUE;;
+ } else
+ usage (argv [0]);
+ }
+
+ file = argv [i];
+
+ if (!file)
+ usage (argv [0]);
+
+ domain = mono_jit_init (file);
+
+ error = mono_verify_corlib ();
+ if (error) {
+ fprintf (stderr, "Corlib not in sync with this runtime: %s\n", error);
+ exit (1);
+ }
+
+ assembly = mono_domain_assembly_open (domain, file);
+ if (!assembly){
+ fprintf (stderr, "Can not open image %s\n", file);
+ exit (1);
+ }
+
+ if (testjit) {
+ mono_jit_assembly (assembly);
+ } else if (compile_class) {
+ const char *cmethod = strrchr (compile_class, ':');
+ char *cname;
+ char *code;
+ int j;
+ MonoClass *class;
+
+ if (cmethod) {
+ MonoMethodDesc *mdesc;
+ MonoMethod *m;
+ mdesc = mono_method_desc_new (compile_class, FALSE);
+ if (!mdesc)
+ g_error ("Invalid method name '%s'", compile_class);
+ m = mono_method_desc_search_in_image (mdesc, assembly->image);
+ if (!m)
+ g_error ("Cannot find method '%s'", compile_class);
+ for (j = 0; j < compile_times; ++j) {
+ code = arch_compile_method (m);
+ g_free (code);
+ }
+ } else {
+ cname = strrchr (compile_class, '.');
+ if (cname)
+ *cname++ = 0;
+ else {
+ cname = compile_class;
+ compile_class = (char *)"";
+ }
+ class = mono_class_from_name (assembly->image, compile_class, cname);
+ if (!class)
+ g_error ("Cannot find class %s.%s", compile_class, cname);
+ mono_class_init (class);
+ for (j = 0; j < compile_times; ++j) {
+ for (i = 0; i < class->method.count; ++i) {
+ if (class->methods [i]->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)
+ continue;
+ if (class->methods [i]->flags & METHOD_ATTRIBUTE_ABSTRACT)
+ continue;
+ if (verbose)
+ g_print ("Compiling: %s\n", class->methods [i]->name);
+ code = arch_compile_method (class->methods [i]);
+ g_free (code);
+ }
+ }
+ }
+ } else {
+ /*
+ * skip the program name from the args.
+ */
+ ++i;
+ retval = mono_jit_exec (domain, assembly, argc - i, argv + i);
+ printf ("RESULT: %d\n", retval);
+ }
+
+ mono_profiler_shutdown ();
+ mono_jit_cleanup (domain);
+
+ return retval;
+}
+
+
diff --git a/mono/jit/regset.c b/mono/jit/regset.c
new file mode 100644
index 00000000000..2b7cae5bf83
--- /dev/null
+++ b/mono/jit/regset.c
@@ -0,0 +1,115 @@
+/*
+ * regset.c: register set abstraction
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include "regset.h"
+#include <mono/arch/x86/x86-codegen.h>
+
+MonoRegSet *
+mono_regset_new (int max_regs)
+{
+ MonoRegSet *rs;
+
+ g_return_val_if_fail (max_regs > 0 && max_regs <= 32, NULL);
+
+ rs = g_new0 (MonoRegSet, 1);
+
+ rs->max_regs = max_regs;
+ rs->used_mask = 0;
+ rs->free_mask = ~rs->used_mask;
+ rs->reserved_mask = 0;
+
+ return rs;
+}
+
+void
+mono_regset_free (MonoRegSet *rs)
+{
+ g_free (rs);
+}
+
+void
+mono_regset_reserve_reg (MonoRegSet *rs, int regnum)
+{
+ guint32 ind;
+
+ g_return_if_fail (rs != NULL);
+ g_return_if_fail (rs->max_regs > regnum);
+
+ ind = 1 << regnum;
+
+ rs->reserved_mask |= ind;
+}
+
+int
+mono_regset_alloc_reg (MonoRegSet *rs, int regnum, guint8 exclude_mask)
+{
+ guint32 i, ind;
+
+ g_return_val_if_fail (rs != NULL, -1);
+ g_return_val_if_fail (rs->max_regs > regnum, -1);
+
+ if (regnum < 0) {
+ for (i = 0, ind = 1; i < rs->max_regs; i++, ind = ind << 1) {
+ if (exclude_mask & ind)
+ continue;
+ if ((rs->free_mask & ind) && !(rs->reserved_mask & ind)) {
+ rs->free_mask &= ~ind;
+ rs->used_mask |= ind;
+ return i;
+ }
+ }
+ return -1;
+ } else {
+ ind = 1 << regnum;
+
+ if (exclude_mask & ind)
+ return -1;
+
+ if ((rs->free_mask & ind) && !(rs->reserved_mask & ind)) {
+ rs->free_mask &= ~ind;
+ rs->used_mask |= ind;
+ return regnum;
+ }
+ return -1;
+ }
+}
+
+void
+mono_regset_free_reg (MonoRegSet *rs, int regnum)
+{
+ guint32 ind;
+
+ g_return_if_fail (rs != NULL);
+ g_return_if_fail (rs->max_regs > regnum);
+
+ if (regnum < 0)
+ return;
+
+ ind = 1 << regnum;
+
+ g_return_if_fail (rs->free_mask && ind);
+
+ rs->free_mask |= ind;
+}
+
+gboolean
+mono_regset_reg_used (MonoRegSet *rs, int regnum)
+{
+ guint32 ind;
+
+ g_return_val_if_fail (rs != NULL, FALSE);
+ g_return_val_if_fail (rs->max_regs > regnum, FALSE);
+ g_return_val_if_fail (regnum >= 0, FALSE);
+
+ ind = 1 << regnum;
+
+ return rs->used_mask & ind;
+}
+
+
diff --git a/mono/jit/regset.h b/mono/jit/regset.h
new file mode 100644
index 00000000000..2cb0060469d
--- /dev/null
+++ b/mono/jit/regset.h
@@ -0,0 +1,38 @@
+/*
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#ifndef _MONO_JIT_REGSET_H_
+#define _MONO_JIT_REGSET_H_
+
+#include <glib.h>
+
+typedef struct {
+ int max_regs;
+ guint32 free_mask;
+ guint32 used_mask;
+ guint32 reserved_mask;
+} MonoRegSet;
+
+MonoRegSet *
+mono_regset_new (int max_regs);
+
+void
+mono_regset_free (MonoRegSet *rs);
+
+int
+mono_regset_alloc_reg (MonoRegSet *rs, int regnum, guint8 exclude_mask);
+
+void
+mono_regset_free_reg (MonoRegSet *rs, int regnum);
+
+void
+mono_regset_reserve_reg (MonoRegSet *rs, int regnum);
+
+gboolean
+mono_regset_reg_used (MonoRegSet *rs, int regnum);
+
+#endif
diff --git a/mono/jit/trampoline.c b/mono/jit/trampoline.c
new file mode 100644
index 00000000000..8b0a1753464
--- /dev/null
+++ b/mono/jit/trampoline.c
@@ -0,0 +1,342 @@
+/*
+ * trampoline.c: JIT trampoline code
+ *
+ * Authors:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/arch/x86/x86-codegen.h>
+
+#include "jit.h"
+#include "codegen.h"
+
+static void
+arch_remoting_invoke (MonoMethod *method, gpointer ip, gpointer first_arg)
+{
+ MonoMethodSignature *sig = method->signature;
+ MonoMethodMessage *msg;
+ MonoTransparentProxy *this;
+ MonoObject *res, *exc;
+ MonoArray *out_args;
+ int this_pos = 0;
+
+ //printf ("REMOTING %s.%s:%s\n", method->klass->name_space, method->klass->name,
+ //method->name);
+
+ if (ISSTRUCT (sig->ret))
+ this_pos += 4;
+
+ this = *(MonoTransparentProxy **)(((char *)&first_arg) + this_pos);
+
+ g_assert (((MonoObject *)this)->vtable->klass == mono_defaults.transparent_proxy_class);
+
+ msg = arch_method_call_message_new (method, &first_arg, NULL, NULL, NULL);
+
+ res = mono_remoting_invoke ((MonoObject *)this->rp, msg, &exc, &out_args);
+
+ if (exc)
+ mono_raise_exception ((MonoException *)exc);
+
+ arch_method_return_message_restore (method, &first_arg, res, out_args);
+
+ /* WARNING: do not write any code here, because that would destroy
+ * the return value
+ */
+}
+
+/*
+ * get_unbox_trampoline:
+ * @m: method pointer
+ * @addr: pointer to native code for @m
+ *
+ * when value type methods are called through the vtable we need to unbox the
+ * this argument. This method returns a pointer to a trampoline which does
+ * unboxing before calling the method
+ */
+static gpointer
+get_unbox_trampoline (MonoMethod *m, gpointer addr)
+{
+ guint8 *code, *start;
+ int this_pos = 4;
+
+ if (!m->signature->ret->byref && m->signature->ret->type == MONO_TYPE_VALUETYPE)
+ this_pos = 8;
+
+ start = code = g_malloc (16);
+
+ x86_alu_membase_imm (code, X86_ADD, X86_ESP, this_pos, sizeof (MonoObject));
+ x86_jump_code (code, addr);
+ g_assert ((code - start) < 16);
+
+ return start;
+}
+
+/**
+ * x86_magic_trampoline:
+ * @eax: saved x86 register
+ * @ecx: saved x86 register
+ * @edx: saved x86 register
+ * @esi: saved x86 register
+ * @edi: saved x86 register
+ * @ebx: saved x86 register
+ * @code: pointer into caller code
+ * @method: the method to translate
+ *
+ * This method is called by the trampoline functions for virtual
+ * methods. It inspects the caller code to find the address of the
+ * vtable slot, then calls the JIT compiler and writes the address
+ * of the compiled method back to the vtable. All virtual methods
+ * are called with: x86_call_membase (inst, basereg, disp). We always
+ * use 32 bit displacement to ensure that the length of the call
+ * instruction is 6 bytes. We need to get the value of the basereg
+ * and the constant displacement.
+ */
+static gpointer
+x86_magic_trampoline (int eax, int ecx, int edx, int esi, int edi,
+ int ebx, guint8 *code, MonoMethod *m)
+{
+ guint8 reg;
+ gint32 disp;
+ char *o;
+ gpointer addr;
+
+ EnterCriticalSection (metadata_section);
+ addr = arch_compile_method (m);
+ LeaveCriticalSection (metadata_section);
+ g_assert (addr);
+
+ /* go to the start of the call instruction
+ *
+ * address_byte = (m << 6) | (o << 3) | reg
+ * call opcode: 0xff address_byte displacement
+ * 0xff m=1,o=2 imm8
+ * 0xff m=2,o=2 imm32
+ */
+ code -= 6;
+ if ((code [1] != 0xe8) && (code [3] == 0xff) && ((code [4] & 0x18) == 0x10) && ((code [4] >> 6) == 1)) {
+ reg = code [4] & 0x07;
+ disp = (signed char)code [5];
+ } else {
+ if ((code [0] == 0xff) && ((code [1] & 0x18) == 0x10) && ((code [1] >> 6) == 2)) {
+ reg = code [1] & 0x07;
+ disp = *((gint32*)(code + 2));
+ } else if ((code [1] == 0xe8)) {
+ *((guint32*)(code + 2)) = (guint)addr - ((guint)code + 1) - 5;
+ return addr;
+ } else {
+ printf ("%x %x %x %x %x %x \n", code [0], code [1], code [2], code [3],
+ code [4], code [5]);
+ g_assert_not_reached ();
+ }
+ }
+
+ switch (reg) {
+ case X86_EAX:
+ o = (gpointer)eax;
+ break;
+ case X86_EDX:
+ o = (gpointer)edx;
+ break;
+ case X86_ECX:
+ o = (gpointer)ecx;
+ break;
+ case X86_ESI:
+ o = (gpointer)esi;
+ break;
+ case X86_EDI:
+ o = (gpointer)edi;
+ break;
+ case X86_EBX:
+ o = (gpointer)ebx;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ o += disp;
+
+ if (m->klass->valuetype) {
+ return *((gpointer *)o) = get_unbox_trampoline (m, addr);
+ } else {
+ return *((gpointer *)o) = addr;
+ }
+}
+
+/**
+ * arch_create_jit_trampoline:
+ * @method: pointer to the method info
+ *
+ * Creates a trampoline function for virtual methods. If the created
+ * code is called it first starts JIT compilation of method,
+ * and then calls the newly created method. I also replaces the
+ * corresponding vtable entry (see x86_magic_trampoline).
+ *
+ * Returns: a pointer to the newly created code
+ */
+gpointer
+arch_create_jit_trampoline (MonoMethod *method)
+{
+ MonoDomain *domain = mono_domain_get ();
+ guint8 *code, *buf;
+ static guint8 *vc = NULL;
+ GHashTable *jit_code_hash;
+
+ /* previously created trampoline code */
+ if (method->info)
+ return method->info;
+
+ /* we immediately compile runtime provided functions */
+ if (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) {
+ method->info = arch_compile_method (method);
+ return method->info;
+ }
+
+ /* icalls use method->addr */
+ if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
+ (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) {
+ method->info = arch_create_native_wrapper (method);
+ return method->info;
+ }
+
+ /* check if we already have JITed code */
+ if (mono_jit_share_code)
+ jit_code_hash = mono_root_domain->jit_code_hash;
+ else
+ jit_code_hash = domain->jit_code_hash;
+
+ if ((code = g_hash_table_lookup (jit_code_hash, method))) {
+ mono_jit_stats.methods_lookups++;
+ return code;
+ }
+
+ if (!vc) {
+ vc = buf = g_malloc (256);
+
+ /* save caller save regs because we need to do a call */
+ x86_push_reg (buf, X86_EDX);
+ x86_push_reg (buf, X86_EAX);
+ x86_push_reg (buf, X86_ECX);
+
+ /* save LMF begin */
+
+ /* save the IP (caller ip) */
+ x86_push_membase (buf, X86_ESP, 16);
+
+ x86_push_reg (buf, X86_EBX);
+ x86_push_reg (buf, X86_EDI);
+ x86_push_reg (buf, X86_ESI);
+ x86_push_reg (buf, X86_EBP);
+
+ /* save method info */
+ x86_push_membase (buf, X86_ESP, 32);
+ /* get the address of lmf for the current thread */
+ x86_call_code (buf, arch_get_lmf_addr);
+ /* push lmf */
+ x86_push_reg (buf, X86_EAX);
+ /* push *lfm (previous_lmf) */
+ x86_push_membase (buf, X86_EAX, 0);
+ /* *(lmf) = ESP */
+ x86_mov_membase_reg (buf, X86_EAX, 0, X86_ESP, 4);
+ /* save LFM end */
+
+ /* push the method info */
+ x86_push_membase (buf, X86_ESP, 44);
+ /* push the return address onto the stack */
+ x86_push_membase (buf, X86_ESP, 52);
+
+ /* save all register values */
+ x86_push_reg (buf, X86_EBX);
+ x86_push_reg (buf, X86_EDI);
+ x86_push_reg (buf, X86_ESI);
+ x86_push_membase (buf, X86_ESP, 64); /* EDX */
+ x86_push_membase (buf, X86_ESP, 64); /* ECX */
+ x86_push_membase (buf, X86_ESP, 64); /* EAX */
+
+ x86_call_code (buf, x86_magic_trampoline);
+ x86_alu_reg_imm (buf, X86_ADD, X86_ESP, 8*4);
+
+ /* restore LMF start */
+ /* ebx = previous_lmf */
+ x86_pop_reg (buf, X86_EBX);
+ /* edi = lmf */
+ x86_pop_reg (buf, X86_EDI);
+ /* *(lmf) = previous_lmf */
+ x86_mov_membase_reg (buf, X86_EDI, 0, X86_EBX, 4);
+ /* discard method info */
+ x86_pop_reg (buf, X86_ESI);
+ /* restore caller saved regs */
+ x86_pop_reg (buf, X86_EBP);
+ x86_pop_reg (buf, X86_ESI);
+ x86_pop_reg (buf, X86_EDI);
+ x86_pop_reg (buf, X86_EBX);
+ /* discard save IP */
+ x86_alu_reg_imm (buf, X86_ADD, X86_ESP, 4);
+ /* restore LMF end */
+
+ x86_alu_reg_imm (buf, X86_ADD, X86_ESP, 16);
+
+ /* call the compiled method */
+ x86_jump_reg (buf, X86_EAX);
+
+ g_assert ((buf - vc) <= 256);
+ }
+
+ code = buf = g_malloc (16);
+ x86_push_imm (buf, method);
+ x86_jump_code (buf, vc);
+ g_assert ((buf - code) <= 16);
+
+ /* store trampoline address */
+ method->info = code;
+
+ mono_jit_stats.method_trampolines++;
+
+ return code;
+}
+
+/* arch_create_remoting_trampoline:
+ * @method: pointer to the method info
+ *
+ * Creates a trampoline which calls the remoting functions. This
+ * is used in the vtable of transparent proxies.
+ *
+ * Returns: a pointer to the newly created code
+ */
+gpointer
+arch_create_remoting_trampoline (MonoMethod *method)
+{
+ MonoJitInfo *ji;
+ guint8 *code, *buf;
+
+ if (method->remoting_tramp)
+ return method->remoting_tramp;
+
+ code = buf = g_malloc (16);
+ x86_push_imm (buf, method);
+ x86_call_code (buf, arch_remoting_invoke);
+ x86_alu_reg_imm (buf, X86_ADD, X86_ESP, 4);
+ x86_ret (buf);
+
+ g_assert ((buf - code) <= 16);
+
+ method->remoting_tramp = code;
+
+ /* we store a jit info, so that mono_delegate_ctor
+ * is able to find a method info */
+ ji = mono_mempool_alloc0 (mono_root_domain->mp, sizeof (MonoJitInfo));
+ ji->method = method;
+ ji->code_start = code;
+ ji->code_size = buf - code;
+ ji->used_regs = 0;
+ ji->num_clauses = 0;
+ mono_jit_info_table_add (mono_root_domain, ji);
+
+ return code;
+}
diff --git a/mono/jit/win32-exception.c b/mono/jit/win32-exception.c
new file mode 100644
index 00000000000..7d71e63e6f7
--- /dev/null
+++ b/mono/jit/win32-exception.c
@@ -0,0 +1,104 @@
+/*
+ * win32-exception.c: Win32 SEH filter.
+ *
+ * (C) 2002 Ximian, Inc.
+ */
+
+#include "win32-exception.h"
+
+#ifdef PLATFORM_WIN32
+
+#include <glib.h>
+
+
+LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep);
+
+static MonoW32ExceptionHandler fpe_handler;
+static MonoW32ExceptionHandler ill_handler;
+static MonoW32ExceptionHandler segv_handler;
+
+static LPTOP_LEVEL_EXCEPTION_FILTER old_handler;
+
+#define W32_SEH_COPY_CONTEXT \
+ sctx->eax = ctx->Eax;\
+ sctx->ebx = ctx->Ebx;\
+ sctx->ecx = ctx->Ecx;\
+ sctx->edx = ctx->Edx;\
+ sctx->ebp = ctx->Ebp;\
+ sctx->esp = ctx->Esp;\
+ sctx->esi = ctx->Esi;\
+ sctx->edi = ctx->Edi;\
+ sctx->eip = ctx->Eip;
+
+#define W32_SEH_HANDLE_EX(_ex) \
+ if (_ex##_handler) _ex##_handler((int)sctx)
+
+/*
+ * Unhandled Exception Filter
+ * Top-level per-process exception handler.
+ */
+LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep)
+{
+ EXCEPTION_RECORD* er;
+ CONTEXT* ctx;
+ struct sigcontext* sctx;
+ LONG res;
+
+ res = EXCEPTION_CONTINUE_SEARCH;
+
+ er = ep->ExceptionRecord;
+ ctx = ep->ContextRecord;
+ sctx = g_malloc(sizeof(struct sigcontext));
+ W32_SEH_COPY_CONTEXT
+
+ switch (er->ExceptionCode) {
+ case EXCEPTION_ACCESS_VIOLATION:
+ W32_SEH_HANDLE_EX(segv);
+ break;
+ case EXCEPTION_ILLEGAL_INSTRUCTION:
+ W32_SEH_HANDLE_EX(ill);
+ break;
+ case EXCEPTION_INT_DIVIDE_BY_ZERO:
+ case EXCEPTION_INT_OVERFLOW:
+ case EXCEPTION_FLT_DIVIDE_BY_ZERO:
+ case EXCEPTION_FLT_OVERFLOW:
+ case EXCEPTION_FLT_UNDERFLOW:
+ case EXCEPTION_FLT_INEXACT_RESULT:
+ W32_SEH_HANDLE_EX(fpe);
+ break;
+ default:
+ break;
+ }
+
+ return res;
+}
+
+void win32_seh_init()
+{
+ old_handler = SetUnhandledExceptionFilter(seh_handler);
+}
+
+void win32_seh_cleanup()
+{
+ if (old_handler) SetUnhandledExceptionFilter(old_handler);
+}
+
+void win32_seh_set_handler(int type, MonoW32ExceptionHandler handler)
+{
+ switch (type) {
+ case SIGFPE:
+ fpe_handler = handler;
+ break;
+ case SIGILL:
+ ill_handler = handler;
+ break;
+ case SIGSEGV:
+ segv_handler = handler;
+ break;
+ default:
+ break;
+ }
+}
+
+#endif /* PLATFORM_WIN32 */
+
diff --git a/mono/jit/win32-exception.h b/mono/jit/win32-exception.h
new file mode 100644
index 00000000000..44b0f8bb951
--- /dev/null
+++ b/mono/jit/win32-exception.h
@@ -0,0 +1,58 @@
+#ifndef _MONO_WIN32_EXCEPTION_H_
+#define _MONO_WIN32_EXCEPTION_H_
+
+#include <config.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef PLATFORM_WIN32
+
+#include <windows.h>
+
+/* use SIG* defines if possible */
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+/* sigcontext surrogate */
+struct sigcontext {
+ unsigned int eax;
+ unsigned int ebx;
+ unsigned int ecx;
+ unsigned int edx;
+ unsigned int ebp;
+ unsigned int esp;
+ unsigned int esi;
+ unsigned int edi;
+ unsigned int eip;
+};
+
+
+typedef void (* MonoW32ExceptionHandler) (int);
+void win32_seh_init(void);
+void win32_seh_cleanup(void);
+void win32_seh_set_handler(int type, MonoW32ExceptionHandler handler);
+
+#ifndef SIGFPE
+#define SIGFPE 4
+#endif
+
+#ifndef SIGILL
+#define SIGILL 8
+#endif
+
+#ifndef SIGSEGV
+#define SIGSEGV 11
+#endif
+
+#endif /* PLATFORM_WIN32 */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MONO_WIN32_EXCEPTION_H_ */
diff --git a/mono/jit/x86.brg b/mono/jit/x86.brg
new file mode 100644
index 00000000000..1576654aff9
--- /dev/null
+++ b/mono/jit/x86.brg
@@ -0,0 +1,4092 @@
+/*
+ * x86.brg: X86 code generator
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <stdio.h>
+#include <string.h>
+#ifndef PLATFORM_WIN32
+#include <signal.h>
+#include <sys/syscall.h>
+#endif
+
+#include <mono/metadata/blob.h>
+#include <mono/metadata/metadata.h>
+#include <mono/metadata/loader.h>
+#include <mono/metadata/object.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/arch/x86/x86-codegen.h>
+
+#include "regset.h"
+#include "jit.h"
+
+
+void print_lmf (void);
+
+#define MBTREE_TYPE MBTree
+#define MBCGEN_TYPE MonoFlowGraph
+#define MBCOST_DATA MonoFlowGraph
+#define MBALLOC_STATE mono_mempool_alloc (data->mp, sizeof (MBState))
+
+typedef enum {
+ AMImmediate = 0, // ptr
+ AMBase = 1, // V[REG]
+ AMIndex = 2, // V[REG*X]
+ AMBaseIndex = 3, // V[REG*X][REG]
+} X86AddMode;
+
+typedef struct {
+ int offset;
+ X86AddMode amode:2;
+ unsigned int shift:2;
+ gint8 basereg;
+ gint8 indexreg;
+} X86AddressInfo;
+
+struct _MBTree {
+ guint16 op;
+ unsigned last_instr:1;
+
+ MBTree *left, *right;
+ gpointer state;
+ gpointer emit;
+
+ gint32 addr;
+ gint32 cli_addr;
+
+ guint8 exclude_mask;
+
+ gint8 reg1;
+ gint8 reg2;
+ gint8 reg3;
+
+ MonoValueType svt;
+
+ union {
+ gint32 i;
+ gint64 l;
+ gpointer p;
+ MonoBBlock *bb;
+ MonoMethod *m;
+ MonoClass *klass;
+ MonoClassField *field;
+ X86AddressInfo ainfo;
+ MonoJitCallInfo ci;
+ MonoJitFieldInfo fi;
+ } data;
+};
+
+gint64 mono_llmult (gint64 a, gint64 b);
+guint64 mono_llmult_ovf (gpointer *exc, guint32 al, gint32 ah, guint32 bl, gint32 bh);
+guint64 mono_llmult_ovf_un (gpointer *exc, guint32 al, guint32 ah, guint32 bl, guint32 bh);
+gint64 mono_lldiv (gint64 a, gint64 b);
+gint64 mono_llrem (gint64 a, gint64 b);
+guint64 mono_lldiv_un (guint64 a, guint64 b);
+guint64 mono_llrem_un (guint64 a, guint64 b);
+gpointer mono_ldsflda (MonoClass *klass, int offset);
+
+gpointer arch_get_lmf_addr (void);
+
+MonoArray*
+mono_array_new_wrapper (MonoClass *eclass, guint32 n);
+MonoObject *
+mono_object_new_wrapper (MonoClass *klass);
+MonoString*
+mono_ldstr_wrapper (MonoImage *image, guint32 ind);
+
+gpointer
+get_mono_object_isinst (void);
+
+#define MB_OPT_LEVEL 1
+
+#if MB_OPT_LEVEL == 0
+#define MB_USE_OPT1(c) 65535
+#define MB_USE_OPT2(c) 65535
+#endif
+#if MB_OPT_LEVEL == 1
+#define MB_USE_OPT1(c) c
+#define MB_USE_OPT2(c) 65535
+#endif
+#if MB_OPT_LEVEL >= 2
+#define MB_USE_OPT1(c) c
+#define MB_USE_OPT2(c) c
+#endif
+
+//#define DEBUG
+
+#define REAL_PRINT_REG(text,reg) \
+mono_assert (reg >= 0); \
+x86_push_reg (s->code, X86_EAX); \
+x86_push_reg (s->code, X86_EDX); \
+x86_push_reg (s->code, X86_ECX); \
+x86_push_reg (s->code, reg); \
+x86_push_imm (s->code, reg); \
+x86_push_imm (s->code, text " %d %p\n"); \
+x86_mov_reg_imm (s->code, X86_EAX, printf); \
+x86_call_reg (s->code, X86_EAX); \
+x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 3*4); \
+x86_pop_reg (s->code, X86_ECX); \
+x86_pop_reg (s->code, X86_EDX); \
+x86_pop_reg (s->code, X86_EAX);
+
+#ifdef DEBUG
+#define MEMCOPY debug_memcpy
+void *MEMCOPY (void *dest, const void *src, size_t n);
+
+#define PRINT_REG(text,reg) REAL_PRINT_REG(text,reg)
+#else
+
+#define MEMCOPY memcpy
+
+#define PRINT_REG(x,y)
+
+#endif
+
+/* The call instruction for virtual functions must have a known
+ * size (used by x86_magic_trampoline)
+ */
+#define x86_call_virtual(inst,basereg,disp) \
+ do { \
+ *(inst)++ = (unsigned char)0xff; \
+ x86_address_byte ((inst), 2, 2, (basereg)); \
+ x86_imm_emit32 ((inst), (disp)); \
+ } while (0)
+
+/* emit an exception if condition is fail */
+#define EMIT_COND_SYSTEM_EXCEPTION(cond,signed,exc_name) \
+ do { \
+ gpointer t; \
+ x86_branch8 (s->code, cond, 10, signed); \
+ x86_push_imm (s->code, exc_name); \
+ t = arch_get_throw_exception_by_name (); \
+ mono_add_jump_info (s, s->code + 1, \
+ MONO_JUMP_INFO_ABS, t); \
+ x86_call_code (s->code, 0); \
+ } while (0);
+
+%%
+
+#
+# terminal definitions
+#
+
+# constatnts
+%term CONST_I4 CONST_I8 CONST_R4 CONST_R8
+%term LDIND_I1 LDIND_U1 LDIND_I2 LDIND_U2 LDIND_I4 LDIND_REF LDIND_I8 LDIND_R4 LDIND_R8
+%term LDIND_U4 LDIND_OBJ
+%term STIND_I1 STIND_I2 STIND_I4 STIND_REF STIND_I8 STIND_R4 STIND_R8 STIND_OBJ
+%term ADDR_L ADDR_G ARG_I4 ARG_I8 ARG_R4 ARG_R8 ARG_OBJ ARG_STRING CALL_I4 CALL_I8 CALL_R8 CALL_VOID
+%term BREAK SWITCH BR RET_VOID RET RET_OBJ ENDFINALLY
+%term ADD ADD_OVF ADD_OVF_UN SUB SUB_OVF SUB_OVF_UN MUL MUL_OVF MUL_OVF_UN
+%term DIV DIV_UN REM REM_UN AND OR XOR SHL SHR SHR_UN NEG NOT
+%term BLT BLT_UN BEQ BNE_UN BRTRUE BRFALSE BGE BGE_UN BLE BLE_UN BGT BGT_UN
+%term CEQ CLT CLT_UN CGT CGT_UN
+%term CONV_I4 CONV_I1 CONV_I2 CONV_I8 CONV_U8 CONV_R4 CONV_R8 CONV_R_UN
+%term INTF_ADDR VFUNC_ADDR NOP NEWARR NEWARR_SPEC NEWOBJ NEWOBJ_SPEC NEWSTRUCT CPOBJ POP INITOBJ
+%term ISINST CASTCLASS UNBOX
+%term CONV_OVF_I1 CONV_OVF_U1 CONV_OVF_I2 CONV_OVF_U2 CONV_OVF_U4 CONV_OVF_U8 CONV_OVF_I4
+%term CONV_OVF_I4_UN CONV_OVF_U1_UN CONV_OVF_U2_UN
+%term CONV_OVF_I2_UN CONV_OVF_I8_UN CONV_OVF_I1_UN
+%term EXCEPTION THROW RETHROW HANDLER CHECKTHIS
+%term LDLEN LDELEMA LDFTN LDVIRTFTN LDSTR LDSFLDA
+%term REMOTE_LDFLDA REMOTE_STIND_I1 REMOTE_STIND_I2 REMOTE_STIND_I4 REMOTE_STIND_REF
+%term REMOTE_STIND_I8 REMOTE_STIND_R4 REMOTE_STIND_R8 REMOTE_STIND_OBJ
+#
+# we start at stmt
+#
+%start stmt
+
+#
+# tree definitions
+#
+
+# integer constant folding
+coni4: AND (coni4, coni4) {
+ tree->data.i = tree->left->data.i & tree->right->data.i;
+}
+
+coni4: OR (coni4, coni4) {
+ tree->data.i = tree->left->data.i | tree->right->data.i;
+}
+
+coni4: XOR (coni4, coni4) {
+ tree->data.i = tree->left->data.i ^ tree->right->data.i;
+}
+
+coni4: SHL (coni4, coni4) {
+ tree->data.i = tree->left->data.i << tree->right->data.i;
+}
+
+coni4: SHR (coni4, coni4) {
+ tree->data.i = tree->left->data.i >> tree->right->data.i;
+}
+
+coni4: NOT (coni4) {
+ tree->data.i = ~tree->left->data.i;
+}
+
+coni4: ADD (coni4, coni4) {
+ tree->data.i = tree->left->data.i + tree->right->data.i;
+}
+
+coni4: SUB (coni4, coni4) {
+ tree->data.i = tree->left->data.i - tree->right->data.i;
+}
+
+coni4: MUL (coni4, coni4) {
+ tree->data.i = tree->left->data.i * tree->right->data.i;
+}
+
+coni4: DIV (coni4, coni4) {
+ tree->data.i = tree->left->data.i / tree->right->data.i;
+} cost {
+ MBCOND (tree->right->data.i)
+ return 0;
+}
+
+coni4: REM (coni4, coni4) {
+ tree->data.i = tree->left->data.i % tree->right->data.i;
+} cost {
+ MBCOND (tree->right->data.i)
+ return 0;
+}
+
+coni4: CEQ (coni4, coni4) {
+ if (tree->left->data.i == tree->right->data.i)
+ tree->data.i = 1;
+ else
+ tree->data.i = 0;
+}
+
+coni4: CGT (coni4, coni4) {
+ if (tree->left->data.i > tree->right->data.i)
+ tree->data.i = 1;
+ else
+ tree->data.i = 0;
+}
+
+coni4: CLT (coni4, coni4) {
+ if (tree->left->data.i < tree->right->data.i)
+ tree->data.i = 1;
+ else
+ tree->data.i = 0;
+}
+
+coni4: CONST_I4 {
+ /* do nothing */
+}
+
+#
+# x86 adressing mode
+#
+
+acon: coni4 {
+ tree->data.ainfo.offset = tree->data.i;
+ tree->data.ainfo.amode = AMImmediate;
+}
+
+acon: ADDR_G {
+ tree->data.ainfo.offset = tree->data.i;
+ tree->data.ainfo.amode = AMImmediate;
+}
+
+acon: ADD (ADDR_G, coni4) {
+ tree->data.ainfo.offset = (unsigned)tree->left->data.p + tree->right->data.i;
+ tree->data.ainfo.amode = AMImmediate;
+}
+
+base: acon
+
+base: reg {
+ tree->data.ainfo.offset = 0;
+ tree->data.ainfo.basereg = tree->reg1;
+ tree->data.ainfo.amode = AMBase;
+}
+
+base: ADD (reg, coni4) {
+ tree->data.ainfo.offset = tree->right->data.i;
+ tree->data.ainfo.basereg = tree->left->reg1;
+ tree->data.ainfo.amode = AMBase;
+}
+
+base: ADDR_L {
+ tree->data.ainfo.offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.i).offset;
+ tree->data.ainfo.basereg = X86_EBP;
+ tree->data.ainfo.amode = AMBase;
+}
+
+index: reg {
+ tree->data.ainfo.offset = 0;
+ tree->data.ainfo.indexreg = tree->reg1;
+ tree->data.ainfo.shift = 0;
+ tree->data.ainfo.amode = AMIndex;
+}
+
+index: SHL (reg, coni4) {
+ tree->data.ainfo.offset = 0;
+ tree->data.ainfo.amode = AMIndex;
+ tree->data.ainfo.indexreg = tree->left->reg1;
+ tree->data.ainfo.shift = tree->right->data.i;
+} cost {
+ MBCOND (tree->right->data.i == 0 ||
+ tree->right->data.i == 1 ||
+ tree->right->data.i == 2 ||
+ tree->right->data.i == 3);
+
+ return 0;
+}
+
+index: MUL (reg, coni4) {
+ static int fast_log2 [] = { 1, 0, 1, -1, 2, -1, -1, -1, 3 };
+
+ tree->data.ainfo.offset = 0;
+ tree->data.ainfo.amode = AMIndex;
+ tree->data.ainfo.indexreg = tree->left->reg1;
+ tree->data.ainfo.shift = fast_log2 [tree->right->data.i];
+} cost {
+ MBCOND (tree->right->data.i == 1 ||
+ tree->right->data.i == 2 ||
+ tree->right->data.i == 4 ||
+ tree->right->data.i == 8);
+
+ return 0;
+}
+
+addr: base
+
+addr: index
+
+addr: ADD (index, base) {
+ tree->data.ainfo.offset = tree->right->data.ainfo.offset;
+ tree->data.ainfo.basereg = tree->right->data.ainfo.basereg;
+ tree->data.ainfo.amode = tree->left->data.ainfo.amode |
+ tree->right->data.ainfo.amode;
+ tree->data.ainfo.shift = tree->left->data.ainfo.shift;
+ tree->data.ainfo.indexreg = tree->left->data.ainfo.indexreg;
+}
+
+# we pass exception in ECX to catch handler
+reg: EXCEPTION {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.i).offset;
+
+ if (tree->reg1 != X86_ECX)
+ x86_mov_reg_reg (s->code, tree->reg1, X86_ECX, 4);
+
+ /* store it so that we can RETHROW it later */
+ x86_mov_membase_reg (s->code, X86_EBP, offset, tree->reg1, 4);
+}
+
+stmt: THROW (reg) {
+ gpointer target;
+
+ x86_push_reg (s->code, tree->left->reg1);
+ target = arch_get_throw_exception ();
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, target);
+ x86_call_code (s->code, target);
+}
+
+stmt: RETHROW {
+ int off = g_array_index (s->varinfo, MonoVarInfo, tree->data.i).offset;
+ gpointer target;
+
+ x86_push_membase (s->code, X86_EBP, off);
+ target = arch_get_throw_exception ();
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, target);
+ x86_call_code (s->code, target);
+}
+
+stmt: HANDLER {
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_call_imm (s->code, 0);
+}
+
+stmt: ENDFINALLY {
+ x86_ret (s->code);
+}
+
+# this slows down performance!
+#stmt: STIND_I4 (addr, coni4) {
+# switch (tree->left->data.ainfo.amode) {
+#
+# case AMImmediate:
+# x86_mov_mem_imm (s->code, tree->left->data.ainfo.offset, tree->right->data.i, 4);
+# break;
+#
+# case AMBase:
+# x86_mov_membase_imm (s->code, tree->left->data.ainfo.basereg,
+# tree->left->data.ainfo.offset, tree->right->data.i, 4);
+# break;
+# case AMIndex:
+# x86_mov_memindex_imm (s->code, X86_NOBASEREG, tree->left->data.ainfo.offset,
+# tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+# tree->right->data.i, 4);
+# break;
+# case AMBaseIndex:
+# x86_mov_memindex_imm (s->code, tree->left->data.ainfo.basereg, tree->left->data.ainfo.offset,
+# tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+# tree->right->data.i, 4);
+# break;
+# }
+#}
+
+stmt: STIND_I4 (addr, reg) {
+ PRINT_REG ("STIND_I4", tree->right->reg1);
+
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_mov_mem_reg (s->code, tree->left->data.ainfo.offset, tree->right->reg1, 4);
+ break;
+
+ case AMBase:
+ x86_mov_membase_reg (s->code, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->right->reg1, 4);
+ break;
+ case AMIndex:
+ x86_mov_memindex_reg (s->code, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg1, 4);
+ break;
+ case AMBaseIndex:
+ x86_mov_memindex_reg (s->code, tree->left->data.ainfo.basereg, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg1, 4);
+ break;
+ }
+}
+
+stmt: REMOTE_STIND_I4 (reg, reg) {
+ guint8 *br[2];
+ int treg = X86_EAX;
+ int lreg = tree->left->reg1;
+ int rreg = tree->right->reg1;
+ int offset;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (rreg == treg)
+ treg = X86_ECX;
+
+ x86_mov_reg_membase (s->code, treg, lreg, 0, 4);
+ x86_alu_membase_imm (s->code, X86_CMP, treg, 0, ((int)mono_defaults.transparent_proxy_class));
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+
+ /* this is a transparent proxy - remote the call */
+
+ /* save value to stack */
+ x86_push_reg (s->code, rreg);
+
+ x86_push_reg (s->code, X86_ESP);
+ x86_push_imm (s->code, tree->data.fi.field);
+ x86_push_imm (s->code, tree->data.fi.klass);
+ x86_push_reg (s->code, lreg);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_store_remote_field);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 20);
+
+ br [1] = s->code; x86_jump8 (s->code, 0);
+
+ x86_patch (br [0], s->code);
+ offset = tree->data.fi.klass->valuetype ? tree->data.fi.field->offset - sizeof (MonoObject) :
+ tree->data.fi.field->offset;
+ x86_mov_membase_reg (s->code, lreg, offset, rreg, 4);
+
+ x86_patch (br [1], s->code);
+}
+
+stmt: STIND_REF (addr, reg) {
+ PRINT_REG ("STIND_REF", tree->right->reg1);
+
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_mov_mem_reg (s->code, tree->left->data.ainfo.offset, tree->right->reg1, 4);
+ break;
+
+ case AMBase:
+ x86_mov_membase_reg (s->code, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->right->reg1, 4);
+ break;
+ case AMIndex:
+ x86_mov_memindex_reg (s->code, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg1, 4);
+ break;
+ case AMBaseIndex:
+ x86_mov_memindex_reg (s->code, tree->left->data.ainfo.basereg, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg1, 4);
+ break;
+ }
+}
+
+stmt: REMOTE_STIND_REF (reg, reg) {
+ guint8 *br[2];
+ int treg = X86_EAX;
+ int lreg = tree->left->reg1;
+ int rreg = tree->right->reg1;
+ int offset;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (rreg == treg)
+ treg = X86_ECX;
+
+ x86_mov_reg_membase (s->code, treg, lreg, 0, 4);
+ x86_alu_membase_imm (s->code, X86_CMP, treg, 0, ((int)mono_defaults.transparent_proxy_class));
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+
+ /* this is a transparent proxy - remote the call */
+
+ /* save value to stack */
+ x86_push_reg (s->code, rreg);
+
+ x86_push_reg (s->code, X86_ESP);
+ x86_push_imm (s->code, tree->data.fi.field);
+ x86_push_imm (s->code, tree->data.fi.klass);
+ x86_push_reg (s->code, lreg);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_store_remote_field);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 20);
+
+ br [1] = s->code; x86_jump8 (s->code, 0);
+
+ x86_patch (br [0], s->code);
+ offset = tree->data.fi.klass->valuetype ? tree->data.fi.field->offset - sizeof (MonoObject) :
+ tree->data.fi.field->offset;
+ x86_mov_membase_reg (s->code, lreg, offset, rreg, 4);
+
+ x86_patch (br [1], s->code);
+}
+
+stmt: STIND_I1 (addr, reg) {
+ PRINT_REG ("STIND_I1", tree->right->reg1);
+
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_mov_mem_reg (s->code, tree->left->data.ainfo.offset, tree->right->reg1, 1);
+ break;
+
+ case AMBase:
+ x86_mov_membase_reg (s->code, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->right->reg1, 1);
+ break;
+ case AMIndex:
+ x86_mov_memindex_reg (s->code, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg1, 1);
+ break;
+ case AMBaseIndex:
+ x86_mov_memindex_reg (s->code, tree->left->data.ainfo.basereg, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg1, 1);
+ break;
+ }
+}
+
+stmt: REMOTE_STIND_I1 (reg, reg) {
+ guint8 *br[2];
+ int treg = X86_EAX;
+ int lreg = tree->left->reg1;
+ int rreg = tree->right->reg1;
+ int offset;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (rreg == treg)
+ treg = X86_ECX;
+
+ x86_mov_reg_membase (s->code, treg, lreg, 0, 4);
+ x86_alu_membase_imm (s->code, X86_CMP, treg, 0, ((int)mono_defaults.transparent_proxy_class));
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+
+ /* this is a transparent proxy - remote the call */
+
+ /* save value to stack */
+ x86_push_reg (s->code, rreg);
+
+ x86_push_reg (s->code, X86_ESP);
+ x86_push_imm (s->code, tree->data.fi.field);
+ x86_push_imm (s->code, tree->data.fi.klass);
+ x86_push_reg (s->code, lreg);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_store_remote_field);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 20);
+
+ br [1] = s->code; x86_jump8 (s->code, 0);
+
+ x86_patch (br [0], s->code);
+ offset = tree->data.fi.klass->valuetype ? tree->data.fi.field->offset - sizeof (MonoObject) :
+ tree->data.fi.field->offset;
+ x86_mov_membase_reg (s->code, lreg, offset, rreg, 1);
+
+ x86_patch (br [1], s->code);
+}
+
+stmt: STIND_I2 (addr, reg) {
+ PRINT_REG ("STIND_I2", tree->right->reg1);
+
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_mov_mem_reg (s->code, tree->left->data.ainfo.offset, tree->right->reg1, 2);
+ break;
+
+ case AMBase:
+ x86_mov_membase_reg (s->code, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->right->reg1, 2);
+ break;
+ case AMIndex:
+ x86_mov_memindex_reg (s->code, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg1, 2);
+ break;
+ case AMBaseIndex:
+ x86_mov_memindex_reg (s->code, tree->left->data.ainfo.basereg, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg1, 2);
+ break;
+ }
+}
+
+stmt: REMOTE_STIND_I2 (reg, reg) {
+ guint8 *br[2];
+ int treg = X86_EAX;
+ int lreg = tree->left->reg1;
+ int rreg = tree->right->reg1;
+ int offset;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (rreg == treg)
+ treg = X86_ECX;
+
+ x86_mov_reg_membase (s->code, treg, lreg, 0, 4);
+ x86_alu_membase_imm (s->code, X86_CMP, treg, 0, ((int)mono_defaults.transparent_proxy_class));
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+
+ /* this is a transparent proxy - remote the call */
+
+ /* save value to stack */
+ x86_push_reg (s->code, rreg);
+
+ x86_push_reg (s->code, X86_ESP);
+ x86_push_imm (s->code, tree->data.fi.field);
+ x86_push_imm (s->code, tree->data.fi.klass);
+ x86_push_reg (s->code, lreg);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_store_remote_field);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 20);
+
+ br [1] = s->code; x86_jump8 (s->code, 0);
+
+ x86_patch (br [0], s->code);
+ offset = tree->data.fi.klass->valuetype ? tree->data.fi.field->offset - sizeof (MonoObject) :
+ tree->data.fi.field->offset;
+ x86_mov_membase_reg (s->code, lreg, offset, rreg, 2);
+
+ x86_patch (br [1], s->code);
+}
+
+reg: LDIND_I4 (addr) {
+
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_mov_reg_mem (s->code, tree->reg1, tree->left->data.ainfo.offset, 4);
+ break;
+
+ case AMBase:
+ x86_mov_reg_membase (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, 4);
+ break;
+ case AMIndex:
+ x86_mov_reg_memindex (s->code, tree->reg1, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift, 4);
+ break;
+ case AMBaseIndex:
+ x86_mov_reg_memindex (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->left->data.ainfo.indexreg,
+ tree->left->data.ainfo.shift, 4);
+ break;
+ }
+
+
+ PRINT_REG ("LDIND_I4", tree->reg1);
+}
+
+reg: LDIND_REF (addr) {
+
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_mov_reg_mem (s->code, tree->reg1, tree->left->data.ainfo.offset, 4);
+ break;
+
+ case AMBase:
+ x86_mov_reg_membase (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, 4);
+ break;
+ case AMIndex:
+ x86_mov_reg_memindex (s->code, tree->reg1, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift, 4);
+ break;
+ case AMBaseIndex:
+ x86_mov_reg_memindex (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->left->data.ainfo.indexreg,
+ tree->left->data.ainfo.shift, 4);
+ break;
+ }
+
+
+ PRINT_REG ("LDIND_REF", tree->reg1);
+}
+
+reg: LDIND_I1 (addr) {
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_widen_mem (s->code, tree->reg1, tree->left->data.ainfo.offset, TRUE, FALSE);
+ break;
+
+ case AMBase:
+ x86_widen_membase (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, TRUE, FALSE);
+ break;
+ case AMIndex:
+ x86_widen_memindex (s->code, tree->reg1, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift, TRUE, FALSE);
+ break;
+ case AMBaseIndex:
+ x86_widen_memindex (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->left->data.ainfo.indexreg,
+ tree->left->data.ainfo.shift, TRUE, FALSE);
+ break;
+ }
+
+ PRINT_REG ("LDIND_I1", tree->reg1);
+}
+
+reg: LDIND_U1 (addr) {
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_widen_mem (s->code, tree->reg1, tree->left->data.ainfo.offset, FALSE, FALSE);
+ break;
+
+ case AMBase:
+ x86_widen_membase (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, FALSE, FALSE);
+ break;
+ case AMIndex:
+ x86_widen_memindex (s->code, tree->reg1, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift, FALSE, FALSE);
+ break;
+ case AMBaseIndex:
+ x86_widen_memindex (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->left->data.ainfo.indexreg,
+ tree->left->data.ainfo.shift, FALSE, FALSE);
+ break;
+ }
+
+ PRINT_REG ("LDIND_U1", tree->reg1);
+}
+
+reg: LDIND_I2 (addr) {
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_widen_mem (s->code, tree->reg1, tree->left->data.ainfo.offset, TRUE, TRUE);
+ break;
+
+ case AMBase:
+ x86_widen_membase (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, TRUE, TRUE);
+ break;
+ case AMIndex:
+ x86_widen_memindex (s->code, tree->reg1, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift, TRUE, TRUE);
+ break;
+ case AMBaseIndex:
+ x86_widen_memindex (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->left->data.ainfo.indexreg,
+ tree->left->data.ainfo.shift, TRUE, TRUE);
+ break;
+ }
+
+ PRINT_REG ("LDIND_U2", tree->reg1);
+}
+
+reg: LDIND_U2 (addr) {
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_widen_mem (s->code, tree->reg1, tree->left->data.ainfo.offset, FALSE, TRUE);
+ break;
+
+ case AMBase:
+ x86_widen_membase (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, FALSE, TRUE);
+ break;
+ case AMIndex:
+ x86_widen_memindex (s->code, tree->reg1, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift, FALSE, TRUE);
+ break;
+ case AMBaseIndex:
+ x86_widen_memindex (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->left->data.ainfo.indexreg,
+ tree->left->data.ainfo.shift, FALSE, TRUE);
+ break;
+ }
+
+ PRINT_REG ("LDIND_U2", tree->reg1);
+}
+
+reg: LDIND_U4 (addr) {
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_mov_reg_mem (s->code, tree->reg1, tree->left->data.ainfo.offset, 4);
+ break;
+
+ case AMBase:
+ x86_mov_reg_membase (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, 4);
+ break;
+ case AMIndex:
+ x86_mov_reg_memindex (s->code, tree->reg1, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift, 4);
+ break;
+ case AMBaseIndex:
+ x86_mov_reg_memindex (s->code, tree->reg1, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->left->data.ainfo.indexreg,
+ tree->left->data.ainfo.shift, 4);
+ break;
+ }
+
+ PRINT_REG ("LDIND_U4", tree->reg1);
+}
+
+reg: REMOTE_LDFLDA (reg) {
+ guint8 *br[2];
+ int treg = X86_EAX;
+ int lreg = tree->left->reg1;
+
+ if (lreg == X86_EAX)
+ treg = X86_EDX;
+
+ if (tree->reg1 != treg)
+ x86_push_reg (s->code, treg);
+
+ x86_mov_reg_membase (s->code, treg, lreg, 0, 4);
+ x86_alu_membase_imm (s->code, X86_CMP, treg, 0, ((int)mono_defaults.transparent_proxy_class));
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+
+ /* this is a transparent proxy - remote the call */
+ if (treg != X86_EAX)
+ x86_push_reg (s->code, X86_EAX);
+ if (treg != X86_EDX)
+ x86_push_reg (s->code, X86_EDX);
+ x86_push_reg (s->code, X86_ECX);
+
+ x86_push_reg (s->code, X86_ESP);
+ x86_push_imm (s->code, tree->data.fi.field);
+ x86_push_imm (s->code, tree->data.fi.klass);
+ x86_push_reg (s->code, lreg);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_load_remote_field);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 16);
+
+ if (treg != X86_EAX)
+ x86_mov_reg_reg (s->code, treg, X86_EAX, 4);
+
+ x86_pop_reg (s->code, X86_ECX);
+ if (treg != X86_EDX)
+ x86_pop_reg (s->code, X86_EDX);
+ if (treg != X86_EAX)
+ x86_pop_reg (s->code, X86_EAX);
+
+ x86_mov_reg_reg (s->code, tree->reg1, treg, 4);
+
+ br [1] = s->code; x86_jump8 (s->code, 0);
+
+ x86_patch (br [0], s->code);
+ if (tree->data.fi.klass->valuetype)
+ x86_lea_membase (s->code, tree->reg1, lreg,
+ tree->data.fi.field->offset - sizeof (MonoObject));
+ else
+ x86_lea_membase (s->code, tree->reg1, lreg, tree->data.fi.field->offset);
+
+ x86_patch (br [1], s->code);
+
+ if (tree->reg1 != treg)
+ x86_pop_reg (s->code, treg);
+}
+
+reg: ADDR_L 5 {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.i).offset;
+
+ x86_lea_membase (s->code, tree->reg1, X86_EBP, offset);
+
+ PRINT_REG ("ADDR_L", tree->reg1);
+}
+
+
+reg: ADDR_G 5 {
+ x86_mov_reg_imm (s->code, tree->reg1, tree->data.p);
+}
+
+reg: CONV_I1 (reg) {
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, TRUE, FALSE);
+}
+
+reg: CONV_I2 (reg) {
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, TRUE, TRUE);
+}
+
+# warning: this chain rule requires a register
+reg: coni4 1 {
+ x86_mov_reg_imm (s->code, tree->reg1, tree->data.i);
+}
+
+reg: CONV_I4 (reg) {
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ PRINT_REG ("CONV_I4", tree->left->reg1);
+}
+
+reg: CONV_OVF_U4 (reg) {
+ /* Keep in sync with CONV_OVF_I4_UN below, they are the same on 32-bit machines */
+ x86_test_reg_imm (s->code, tree->left->reg1, 0x8000000);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, FALSE, "OverflowException");
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: CONV_OVF_I4_UN (reg) {
+ /* Keep in sync with CONV_OVF_U4 above, they are the same on 32-bit machines */
+ x86_test_reg_imm (s->code, tree->left->reg1, 0x8000000);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, FALSE, "OverflowException");
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: CONV_OVF_I1 (reg) {
+ /* probe value to be within -128 to 127 */
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, 127);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_LE, TRUE, "OverflowException");
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, -128);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_GT, TRUE, "OverflowException");
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, TRUE, FALSE);
+}
+
+reg: CONV_OVF_I1_UN (reg) {
+ /* probe values between 0 to 128 */
+ x86_test_reg_imm (s->code, tree->left->reg1, 0xffffff80);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, FALSE, "OverflowException");
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, FALSE, FALSE);
+}
+
+reg: CONV_OVF_U1 (reg) {
+ /* Keep in sync with CONV_OVF_U1_UN routine below, they are the same on 32-bit machines */
+ /* probe value to be within 0 to 255 */
+ x86_test_reg_imm (s->code, tree->left->reg1, 0xffffff00);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, FALSE, "OverflowException");
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, FALSE, FALSE);
+}
+
+reg: CONV_OVF_U1_UN (reg) {
+ /* Keep in sync with CONV_OVF_U1 routine above, they are the same on 32-bit machines */
+ /* probe value to be within 0 to 255 */
+ x86_test_reg_imm (s->code, tree->left->reg1, 0xffffff00);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, FALSE, "OverflowException");
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, FALSE, FALSE);
+}
+
+reg: CONV_OVF_I2 (reg) {
+ /* Probe value to be within -32768 and 32767 */
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, 32767);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_LE, TRUE, "OverflowException");
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, -32768);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_GE, TRUE, "OverflowException");
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, TRUE, TRUE);
+}
+
+reg: CONV_OVF_U2 (reg) {
+ /* Keep in sync with CONV_OVF_U2_UN below, they are the same on 32-bit machines */
+ /* Probe value to be within 0 and 65535 */
+ x86_test_reg_imm (s->code, tree->left->reg1, 0xffff0000);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, TRUE, "OverflowException");
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, FALSE, TRUE);
+}
+
+reg: CONV_OVF_U2_UN (reg) {
+ /* Keep in sync with CONV_OVF_U2 above, they are the same on 32-bit machines */
+ /* Probe value to be within 0 and 65535 */
+ x86_test_reg_imm (s->code, tree->left->reg1, 0xffff0000);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, FALSE, "OverflowException");
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, FALSE, TRUE);
+}
+
+reg: CONV_OVF_I2_UN (reg) {
+ /* Convert uint value into short, value within 0 and 32767 */
+ x86_test_reg_imm (s->code, tree->left->reg1, 0xffff8000);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, FALSE, "OverflowException");
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, FALSE, TRUE);
+}
+
+reg: MUL (reg, reg) {
+ x86_imul_reg_reg (s->code, tree->left->reg1, tree->right->reg1);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: MUL_OVF (reg, reg) {
+ x86_imul_reg_reg (s->code, tree->left->reg1, tree->right->reg1);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NO, TRUE, "OverflowException");
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: MUL_OVF_UN (reg, reg) {
+ mono_assert (tree->right->reg1 != X86_EAX);
+
+ if (tree->left->reg1 != X86_EAX)
+ x86_mov_reg_reg (s->code, X86_EAX, tree->left->reg1, 4);
+
+ x86_mul_reg (s->code, tree->right->reg1, FALSE);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NO, TRUE, "OverflowException");
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+reg: DIV (reg, reg) {
+ mono_assert (tree->right->reg1 != X86_EAX);
+
+ if (tree->left->reg1 != X86_EAX)
+ x86_mov_reg_reg (s->code, X86_EAX, tree->left->reg1, 4);
+
+ x86_cdq (s->code);
+ x86_div_reg (s->code, tree->right->reg1, TRUE);
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+reg: DIV_UN (reg, reg) {
+ mono_assert (tree->right->reg1 != X86_EAX);
+
+ if (tree->left->reg1 != X86_EAX)
+ x86_mov_reg_reg (s->code, X86_EAX, tree->left->reg1, 4);
+
+ x86_mov_reg_imm (s->code, X86_EDX, 0);
+ x86_div_reg (s->code, tree->right->reg1, FALSE);
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+reg: REM (reg, reg) {
+ mono_assert (tree->right->reg1 != X86_EAX);
+ mono_assert (tree->right->reg1 != X86_EDX);
+
+ if (tree->left->reg1 != X86_EAX)
+ x86_mov_reg_reg (s->code, X86_EAX, tree->left->reg1, 4);
+
+ /* sign extend to 64bit in EAX/EDX */
+ x86_cdq (s->code);
+ x86_div_reg (s->code, tree->right->reg1, TRUE);
+ x86_mov_reg_reg (s->code, X86_EAX, X86_EDX, 4);
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+reg: REM_UN (reg, reg) {
+ mono_assert (tree->right->reg1 != X86_EAX);
+ mono_assert (tree->right->reg1 != X86_EDX);
+
+ if (tree->left->reg1 != X86_EAX)
+ x86_mov_reg_reg (s->code, X86_EAX, tree->left->reg1, 4);
+
+ /* zero extend to 64bit in EAX/EDX */
+ x86_mov_reg_imm (s->code, X86_EDX, 0);
+ x86_div_reg (s->code, tree->right->reg1, FALSE);
+ x86_mov_reg_reg (s->code, X86_EAX, X86_EDX, 4);
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+reg: ADD (reg, coni4) "MB_USE_OPT1(0)" {
+ if (tree->right->data.i == 1)
+ x86_inc_reg (s->code, tree->left->reg1);
+ else
+ x86_alu_reg_imm (s->code, X86_ADD, tree->left->reg1, tree->right->data.i);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+
+}
+
+reg: ADD (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_ADD, tree->left->reg1, tree->right->reg1);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: ADD_OVF (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_ADD, tree->left->reg1, tree->right->reg1);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NO, TRUE, "OverflowException");
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: ADD_OVF_UN (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_ADD, tree->left->reg1, tree->right->reg1);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NC, FALSE, "OverflowException");
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: SUB (reg, coni4) "MB_USE_OPT1(0)" {
+ if (tree->right->data.i == 1)
+ x86_dec_reg (s->code, tree->left->reg1);
+ else
+ x86_alu_reg_imm (s->code, X86_SUB, tree->left->reg1, tree->right->data.i);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: SUB (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_SUB, tree->left->reg1, tree->right->reg1);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: SUB_OVF (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_SUB, tree->left->reg1, tree->right->reg1);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NO, TRUE, "OverflowException");
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: SUB_OVF_UN (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_SUB, tree->left->reg1, tree->right->reg1);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NC, FALSE, "OverflowException");
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: CEQ (reg, coni4) "MB_USE_OPT1(0)" {
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, tree->right->data.i);
+ x86_set_reg (s->code, X86_CC_EQ, tree->reg1, TRUE);
+ x86_widen_reg (s->code, tree->reg1, tree->reg1, FALSE, FALSE);
+}
+
+reg: CEQ (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ x86_set_reg (s->code, X86_CC_EQ, tree->reg1, TRUE);
+ x86_widen_reg (s->code, tree->reg1, tree->reg1, FALSE, FALSE);
+}
+
+reg: CGT (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ x86_set_reg (s->code, X86_CC_GT, tree->reg1, TRUE);
+ x86_widen_reg (s->code, tree->reg1, tree->reg1, FALSE, FALSE);
+}
+
+reg: CGT_UN (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ x86_set_reg (s->code, X86_CC_GT, tree->reg1, FALSE);
+ x86_widen_reg (s->code, tree->reg1, tree->reg1, FALSE, FALSE);
+}
+
+reg: CLT (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ x86_set_reg (s->code, X86_CC_LT, tree->reg1, TRUE);
+ x86_widen_reg (s->code, tree->reg1, tree->reg1, FALSE, FALSE);
+}
+
+reg: CLT_UN (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ x86_set_reg (s->code, X86_CC_LT, tree->reg1, FALSE);
+ x86_widen_reg (s->code, tree->reg1, tree->reg1, FALSE, FALSE);
+}
+
+reg: AND (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_AND, tree->left->reg1, tree->right->reg1);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: OR (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_OR, tree->left->reg1, tree->right->reg1);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: XOR (reg, reg) {
+ x86_alu_reg_reg (s->code, X86_XOR, tree->left->reg1, tree->right->reg1);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: NEG (reg) {
+ x86_neg_reg (s->code, tree->left->reg1);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: NOT (reg) {
+ x86_not_reg (s->code, tree->left->reg1);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: SHL (reg, coni4) {
+ x86_shift_reg_imm (s->code, X86_SHL, tree->left->reg1, tree->right->data.i);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: SHL (reg, reg) {
+ if (tree->right->reg1 != X86_ECX)
+ x86_mov_reg_reg (s->code, X86_ECX, tree->right->reg1, 4);
+ x86_shift_reg (s->code, X86_SHL, tree->left->reg1);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+
+ mono_assert (tree->reg1 != X86_ECX &&
+ tree->left->reg1 != X86_ECX);
+}
+
+reg: SHR (reg, coni4) {
+ x86_shift_reg_imm (s->code, X86_SAR, tree->left->reg1, tree->right->data.i);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: SHR (reg, reg) {
+ if (tree->right->reg1 != X86_ECX)
+ x86_mov_reg_reg (s->code, X86_ECX, tree->right->reg1, 4);
+ x86_shift_reg (s->code, X86_SAR, tree->left->reg1);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+
+ mono_assert (tree->reg1 != X86_ECX &&
+ tree->left->reg1 != X86_ECX);
+}
+
+reg: SHR_UN (reg, coni4) {
+ x86_shift_reg_imm (s->code, X86_SHR, tree->left->reg1, tree->right->data.i);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: SHR_UN (reg, reg) {
+ if (tree->right->reg1 != X86_ECX)
+ x86_mov_reg_reg (s->code, X86_ECX, tree->right->reg1, 4);
+ x86_shift_reg (s->code, X86_SHR, tree->left->reg1);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+
+ mono_assert (tree->reg1 != X86_ECX &&
+ tree->left->reg1 != X86_ECX);
+}
+
+reg: LDSFLDA (coni4) {
+ if (tree->reg1 != X86_EAX)
+ x86_push_reg (s->code, X86_EAX);
+ x86_push_reg (s->code, X86_ECX);
+ x86_push_reg (s->code, X86_EDX);
+
+ x86_push_imm (s->code, tree->left->data.i);
+ x86_push_imm (s->code, tree->data.klass);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_ldsflda);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 8);
+
+ x86_pop_reg (s->code, X86_EDX);
+ x86_pop_reg (s->code, X86_ECX);
+ if (tree->reg1 != X86_EAX) {
+ x86_mov_reg_reg (s->code, tree->reg1, X86_EAX, 4);
+ x86_pop_reg (s->code, X86_EAX);
+ }
+}
+
+# array support
+reg: LDLEN (reg) {
+ x86_test_reg_reg (s->code, tree->left->reg1, tree->left->reg1);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NE, TRUE, "NullReferenceException");
+
+ x86_mov_reg_membase (s->code, tree->reg1, tree->left->reg1,
+ G_STRUCT_OFFSET (MonoArray, max_length), 4);
+}
+
+reg: LDELEMA (reg, reg) {
+ x86_alu_reg_membase (s->code, X86_CMP, tree->right->reg1, tree->left->reg1, G_STRUCT_OFFSET (MonoArray, max_length));
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_LT, FALSE, "IndexOutOfRangeException");
+
+ if (tree->data.i == 1 || tree->data.i == 2 ||
+ tree->data.i == 4 || tree->data.i == 8) {
+ static int fast_log2 [] = { 1, 0, 1, -1, 2, -1, -1, -1, 3 };
+ x86_lea_memindex (s->code, tree->reg1, tree->left->reg1,
+ G_STRUCT_OFFSET (MonoArray, vector), tree->right->reg1,
+ fast_log2 [tree->data.i]);
+ } else {
+ x86_imul_reg_reg_imm (s->code, tree->right->reg1, tree->right->reg1, tree->data.i);
+ x86_alu_reg_reg (s->code, X86_ADD, tree->reg1, tree->right->reg1);
+ x86_alu_reg_imm (s->code, X86_ADD, tree->reg1, G_STRUCT_OFFSET (MonoArray, vector));
+ }
+}
+
+reg: LDSTR {
+ if (tree->reg1 != X86_EAX)
+ x86_push_reg (s->code, X86_EAX);
+ x86_push_reg (s->code, X86_ECX);
+ x86_push_reg (s->code, X86_EDX);
+
+ x86_push_imm (s->code, tree->data.p);
+ x86_push_imm (s->code, s->method->klass->image);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_ldstr_wrapper);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 8);
+
+ x86_pop_reg (s->code, X86_EDX);
+ x86_pop_reg (s->code, X86_ECX);
+ if (tree->reg1 != X86_EAX) {
+ x86_mov_reg_reg (s->code, tree->reg1, X86_EAX, 4);
+ x86_pop_reg (s->code, X86_EAX);
+ }
+
+ PRINT_REG ("LDSTR", tree->reg1);
+}
+
+reg: NEWARR (reg) {
+ if (tree->reg1 != X86_EAX)
+ x86_push_reg (s->code, X86_EAX);
+ x86_push_reg (s->code, X86_ECX);
+ x86_push_reg (s->code, X86_EDX);
+
+ x86_push_reg (s->code, tree->left->reg1);
+ x86_push_imm (s->code, tree->data.p);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_array_new_wrapper);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, sizeof (gpointer) + 4);
+
+ x86_pop_reg (s->code, X86_EDX);
+ x86_pop_reg (s->code, X86_ECX);
+ if (tree->reg1 != X86_EAX) {
+ x86_mov_reg_reg (s->code, tree->reg1, X86_EAX, 4);
+ x86_pop_reg (s->code, X86_EAX);
+ }
+
+ PRINT_REG ("NEWARR", tree->reg1);
+}
+
+reg: NEWARR_SPEC (reg) {
+ if (tree->reg1 != X86_EAX)
+ x86_push_reg (s->code, X86_EAX);
+ x86_push_reg (s->code, X86_ECX);
+ x86_push_reg (s->code, X86_EDX);
+
+ x86_push_reg (s->code, tree->left->reg1);
+ x86_push_imm (s->code, tree->data.p);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_array_new_specific);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, sizeof (gpointer) + 4);
+
+ x86_pop_reg (s->code, X86_EDX);
+ x86_pop_reg (s->code, X86_ECX);
+ if (tree->reg1 != X86_EAX) {
+ x86_mov_reg_reg (s->code, tree->reg1, X86_EAX, 4);
+ x86_pop_reg (s->code, X86_EAX);
+ }
+
+ PRINT_REG ("NEWARR_SPEC", tree->reg1);
+}
+
+reg: NEWOBJ {
+ if (tree->reg1 != X86_EAX)
+ x86_push_reg (s->code, X86_EAX);
+ x86_push_reg (s->code, X86_ECX);
+ x86_push_reg (s->code, X86_EDX);
+
+ x86_push_imm (s->code, tree->data.klass);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_object_new_wrapper);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, sizeof (gpointer));
+
+ x86_pop_reg (s->code, X86_EDX);
+ x86_pop_reg (s->code, X86_ECX);
+ if (tree->reg1 != X86_EAX) {
+ x86_mov_reg_reg (s->code, tree->reg1, X86_EAX, 4);
+ x86_pop_reg (s->code, X86_EAX);
+ }
+ PRINT_REG ("NEWOBJ", tree->reg1);
+}
+
+reg: NEWOBJ_SPEC {
+ if (tree->reg1 != X86_EAX)
+ x86_push_reg (s->code, X86_EAX);
+ x86_push_reg (s->code, X86_ECX);
+ x86_push_reg (s->code, X86_EDX);
+
+ x86_push_imm (s->code, tree->data.p);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_object_new_specific);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, sizeof (gpointer));
+
+ x86_pop_reg (s->code, X86_EDX);
+ x86_pop_reg (s->code, X86_ECX);
+ if (tree->reg1 != X86_EAX) {
+ x86_mov_reg_reg (s->code, tree->reg1, X86_EAX, 4);
+ x86_pop_reg (s->code, X86_EAX);
+ }
+ PRINT_REG ("NEWOBJ_SPEC", tree->reg1);
+}
+
+reg: NEWSTRUCT {
+ int size = tree->data.i;
+ int sa;
+
+ mono_assert (size > 0);
+
+ sa = size + 3;
+ sa &= ~3;
+
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, sa);
+ x86_mov_reg_reg (s->code, tree->reg1, X86_ESP, 4);
+}
+
+reg: UNBOX (reg) {
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+
+ x86_test_reg_reg (s->code, tree->reg1, tree->reg1);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NE, TRUE, "NullReferenceException");
+
+ x86_push_reg (s->code, tree->reg1);
+ x86_mov_reg_membase (s->code, tree->reg1, tree->reg1, 0, 4);
+ x86_mov_reg_membase (s->code, tree->reg1, tree->reg1, 0, 4);
+ x86_alu_membase_imm (s->code, X86_CMP, tree->reg1,
+ G_STRUCT_OFFSET (MonoClass, element_class), ((int)(tree->data.klass->element_class)));
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, TRUE, "InvalidCastException");
+ x86_pop_reg (s->code, tree->reg1);
+ x86_alu_reg_imm (s->code, X86_ADD, tree->reg1, sizeof (MonoObject));
+}
+
+reg: CASTCLASS (reg) {
+ MonoClass *klass = tree->data.klass;
+ guint8 *br [2];
+ int lreg = tree->left->reg1;
+
+ x86_push_reg (s->code, lreg);
+ x86_test_reg_reg (s->code, lreg, lreg);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_EQ, 0, FALSE);
+
+ if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+ /* lreg = obj->vtable */
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+
+ x86_alu_membase_imm (s->code, X86_CMP, lreg, G_STRUCT_OFFSET (MonoVTable, max_interface_id),
+ klass->interface_id);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_GE, FALSE, "InvalidCastException");
+ /* lreg = obj->vtable->interface_offsets */
+ x86_mov_reg_membase (s->code, lreg, lreg, G_STRUCT_OFFSET (MonoVTable, interface_offsets), 4);
+ x86_alu_membase_imm (s->code, X86_CMP, lreg, klass->interface_id << 2, 0);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NE, FALSE, "InvalidCastException");
+ } else {
+
+ /* lreg = obj->vtable */
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+ /* lreg = obj->vtable->klass */
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+
+ if (klass->rank) {
+
+ x86_alu_membase_imm (s->code, X86_CMP, lreg, G_STRUCT_OFFSET (MonoClass, rank), klass->rank);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, FALSE, "InvalidCastException");
+ x86_mov_reg_membase (s->code, lreg, lreg, G_STRUCT_OFFSET (MonoClass, element_class), 4);
+ x86_mov_reg_membase (s->code, lreg, lreg, G_STRUCT_OFFSET (MonoClass, baseval), 4);
+ x86_alu_reg_mem (s->code, X86_SUB, lreg, &klass->element_class->baseval);
+ x86_alu_reg_mem (s->code, X86_CMP, lreg, &klass->element_class->diffval);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_LE, FALSE, "InvalidCastException");
+
+ } else {
+
+ if (klass->marshalbyref) {
+ /* check for transparent_proxy */
+ x86_alu_reg_imm (s->code, X86_CMP, lreg, (int)mono_defaults.transparent_proxy_class);
+ br [1] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+
+ /* lreg = obj */
+ x86_mov_reg_membase (s->code, lreg, X86_ESP, 0, 4);
+ x86_mov_reg_membase (s->code, lreg, lreg, G_STRUCT_OFFSET (MonoTransparentProxy,
+ klass), 4);
+
+ x86_patch (br [1], s->code);
+ }
+
+ x86_mov_reg_membase (s->code, lreg, lreg, G_STRUCT_OFFSET (MonoClass, baseval), 4);
+ x86_alu_reg_mem (s->code, X86_SUB, lreg, &klass->baseval);
+ x86_alu_reg_mem (s->code, X86_CMP, lreg, &klass->diffval);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_LE, FALSE, "InvalidCastException");
+ }
+ }
+
+ x86_patch (br [0], s->code);
+ x86_pop_reg (s->code, tree->reg1);
+}
+
+reg: ISINST (reg) {
+ MonoClass *klass = tree->data.klass;
+ guint8 *br [3];
+ int lreg = tree->left->reg1;
+
+ x86_push_reg (s->code, lreg);
+ x86_test_reg_reg (s->code, lreg, lreg);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_EQ, 0, FALSE);
+
+ if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+ /* lreg = obj->vtable */
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+
+ x86_alu_membase_imm (s->code, X86_CMP, lreg, G_STRUCT_OFFSET (MonoVTable, max_interface_id),
+ klass->interface_id);
+ br [1] = s->code; x86_branch8 (s->code, X86_CC_LT, 0, FALSE);
+ /* lreg = obj->vtable->interface_offsets */
+ x86_mov_reg_membase (s->code, lreg, lreg, G_STRUCT_OFFSET (MonoVTable, interface_offsets), 4);
+ x86_alu_membase_imm (s->code, X86_CMP, lreg, klass->interface_id << 2, 0);
+ br [2] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+ x86_patch (br [1], s->code);
+ x86_mov_membase_imm (s->code, X86_ESP, 0, 0, 4);
+ x86_patch (br [2], s->code);
+
+ } else {
+
+ /* lreg = obj->vtable */
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+ /* lreg = obj->vtable->klass */
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+
+ if (klass->rank) {
+
+ x86_alu_membase_imm (s->code, X86_CMP, lreg, G_STRUCT_OFFSET (MonoClass, rank), klass->rank);
+ br [1] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+ x86_mov_reg_membase (s->code, lreg, lreg, G_STRUCT_OFFSET (MonoClass, element_class), 4);
+ x86_mov_reg_membase (s->code, lreg, lreg, G_STRUCT_OFFSET (MonoClass, baseval), 4);
+ x86_alu_reg_mem (s->code, X86_SUB, lreg, &klass->element_class->baseval);
+ x86_alu_reg_mem (s->code, X86_CMP, lreg, &klass->element_class->diffval);
+ br [2] = s->code; x86_branch8 (s->code, X86_CC_LE, 0, FALSE);
+ x86_patch (br [1], s->code);
+ x86_mov_membase_imm (s->code, X86_ESP, 0, 0, 4);
+ x86_patch (br [2], s->code);
+
+ } else {
+
+ if (klass->marshalbyref) {
+ /* check for transparent_proxy */
+ x86_alu_reg_imm (s->code, X86_CMP, lreg, (int)mono_defaults.transparent_proxy_class);
+ br [1] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+
+ /* lreg = obj */
+ x86_mov_reg_membase (s->code, lreg, X86_ESP, 0, 4);
+ x86_mov_reg_membase (s->code, lreg, lreg, G_STRUCT_OFFSET (MonoTransparentProxy,
+ klass), 4);
+ x86_patch (br [1], s->code);
+ }
+
+ x86_mov_reg_membase (s->code, lreg, lreg, G_STRUCT_OFFSET (MonoClass, baseval), 4);
+ x86_alu_reg_mem (s->code, X86_SUB, lreg, &klass->baseval);
+ x86_alu_reg_mem (s->code, X86_CMP, lreg, &klass->diffval);
+ br [2] = s->code; x86_branch8 (s->code, X86_CC_LE, 0, FALSE);
+ x86_mov_membase_imm (s->code, X86_ESP, 0, 0, 4);
+ x86_patch (br [2], s->code);
+ }
+ }
+
+ x86_patch (br [0], s->code);
+ x86_pop_reg (s->code, tree->reg1);
+}
+
+stmt: INITOBJ (reg) {
+ int i, j;
+
+ i = tree->data.i;
+
+ if (i == 1 || i == 2 || i == 4) {
+ x86_mov_membase_imm (s->code, tree->left->reg1, 0, 0, i);
+ return;
+ }
+
+ i = tree->data.i / 4;
+ j = tree->data.i % 4;
+
+ x86_push_reg (s->code, X86_EAX);
+
+ if (tree->left->reg1 != X86_EDI) {
+ x86_push_reg (s->code, X86_EDI);
+ x86_mov_reg_reg (s->code, X86_EDI, tree->left->reg1, 4);
+ }
+
+ if (i) {
+ x86_push_reg (s->code, X86_ECX);
+ x86_alu_reg_reg (s->code, X86_XOR, X86_EAX, X86_EAX);
+ x86_mov_reg_imm (s->code, X86_ECX, i);
+ x86_cld (s->code);
+ x86_prefix (s->code, X86_REP_PREFIX);
+ x86_stosl (s->code);
+ x86_pop_reg (s->code, X86_ECX);
+
+ for (i = 0; i < j; i++)
+ x86_stosb (s->code);
+
+ } else {
+ g_assert (j == 3);
+ x86_mov_membase_imm (s->code, X86_EDI, 0, 0, 2);
+ x86_mov_membase_imm (s->code, X86_EDI, 2, 0, 1);
+ }
+
+
+
+ if (tree->left->reg1 != X86_EDI)
+ x86_pop_reg (s->code, X86_EDI);
+
+ x86_pop_reg (s->code, X86_EAX);
+}
+
+stmt: NOP
+
+stmt: POP (reg)
+
+stmt: BR {
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_jump32 (s->code, 0);
+}
+
+stmt: BLT (reg, reg) 1 {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LT, 0, TRUE);
+}
+
+stmt: BLT (reg, coni4) "MB_USE_OPT1(0)" {
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, tree->right->data.i);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LT, 0, TRUE);
+}
+
+stmt: BLT_UN (reg, reg) 1 {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LT, 0, FALSE);
+}
+
+stmt: BLT_UN (reg, coni4) "MB_USE_OPT1(0)" {
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, tree->right->data.i);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LT, 0, FALSE);
+}
+
+stmt: BGT (reg, reg) 1 {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GT, 0, TRUE);
+}
+
+stmt: BGT (reg, coni4) "MB_USE_OPT1(0)" {
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, tree->right->data.i);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GT, 0, TRUE);
+}
+
+stmt: BGT_UN (reg, reg) 1 {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GT, 0, FALSE);
+}
+
+stmt: BGT_UN (reg, coni4) "MB_USE_OPT1(0)" {
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, tree->right->data.i);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GT, 0, FALSE);
+}
+
+stmt: BEQ (reg, coni4) "MB_USE_OPT1(0)" {
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, tree->right->data.i);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_EQ, 0, TRUE);
+}
+
+stmt: BEQ (reg, reg) 1 {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_EQ, 0, TRUE);
+}
+
+stmt: BNE_UN (reg, reg) 1 {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_NE, 0, FALSE);
+}
+
+stmt: BNE_UN (reg, coni4) "MB_USE_OPT1(0)" {
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, tree->right->data.i);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_NE, 0, FALSE);
+}
+
+stmt: BGE (reg, reg) 1 {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GE, 0, TRUE);
+}
+
+stmt: BGE (reg, coni4) "MB_USE_OPT1(0)" {
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, tree->right->data.i);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GE, 0, TRUE);
+}
+
+stmt: BGE_UN (reg, reg) 1 {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GE, 0, FALSE);
+}
+
+stmt: BGE_UN (reg, coni4) "MB_USE_OPT1(0)" {
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, tree->right->data.i);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GE, 0, FALSE);
+}
+
+stmt: BLE (reg, reg) 1 {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LE, 0, TRUE);
+}
+
+stmt: BLE (reg, coni4) "MB_USE_OPT1(0)" {
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, tree->right->data.i);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LE, 0, TRUE);
+}
+
+stmt: BLE_UN (reg, reg) 1 {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LE, 0, FALSE);
+}
+
+stmt: BLE_UN (reg, coni4) "MB_USE_OPT1(0)" {
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, tree->right->data.i);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LE, 0, FALSE);
+}
+
+stmt: BRTRUE (reg) {
+ x86_test_reg_reg (s->code, tree->left->reg1, tree->left->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_NE, 0, TRUE);
+}
+
+stmt: BRFALSE (reg) {
+ x86_test_reg_reg (s->code, tree->left->reg1, tree->left->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_EQ, 0, TRUE);
+}
+
+stmt: BREAK {
+ x86_breakpoint (s->code);
+}
+
+stmt: RET (reg) {
+ if (tree->left->reg1 != X86_EAX)
+ x86_mov_reg_reg (s->code, X86_EAX, tree->left->reg1, 4);
+
+ if (!tree->last_instr) {
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_EPILOG, NULL);
+ x86_jump32 (s->code, 0);
+ }
+}
+
+stmt: RET_VOID {
+ if (!tree->last_instr) {
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_EPILOG, NULL);
+ x86_jump32 (s->code, 0);
+ }
+}
+
+
+stmt: ARG_I4 (LDIND_I4 (addr)) {
+ MBTree *at = tree->left->left;
+
+ switch (at->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_push_mem (s->code, at->data.ainfo.offset);
+ break;
+
+ case AMBase:
+ x86_push_membase (s->code, at->data.ainfo.basereg, at->data.ainfo.offset);
+ break;
+ case AMIndex:
+ x86_push_memindex (s->code, X86_NOBASEREG, at->data.ainfo.offset,
+ at->data.ainfo.indexreg, at->data.ainfo.shift);
+ break;
+ case AMBaseIndex:
+ x86_push_memindex (s->code, at->data.ainfo.basereg,
+ at->data.ainfo.offset, at->data.ainfo.indexreg,
+ at->data.ainfo.shift);
+ break;
+ }
+}
+
+stmt: ARG_I4 (LDIND_U4 (addr)) {
+ MBTree *at = tree->left->left;
+
+ switch (at->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_push_mem (s->code, at->data.ainfo.offset);
+ break;
+
+ case AMBase:
+ x86_push_membase (s->code, at->data.ainfo.basereg, at->data.ainfo.offset);
+ break;
+ case AMIndex:
+ x86_push_memindex (s->code, X86_NOBASEREG, at->data.ainfo.offset,
+ at->data.ainfo.indexreg, at->data.ainfo.shift);
+ break;
+ case AMBaseIndex:
+ x86_push_memindex (s->code, at->data.ainfo.basereg,
+ at->data.ainfo.offset, at->data.ainfo.indexreg,
+ at->data.ainfo.shift);
+ break;
+ }
+}
+
+stmt: ARG_I4 (reg) {
+ x86_push_reg (s->code, tree->left->reg1);
+ PRINT_REG ("ARG_I4", tree->left->reg1);
+}
+
+# fixme: we must free the allocated strings somewhere
+stmt: ARG_STRING (reg) {
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, 4);
+ x86_push_reg (s->code, X86_EAX);
+ x86_push_reg (s->code, X86_ECX);
+ x86_push_reg (s->code, X86_EDX);
+
+ x86_push_reg (s->code, tree->left->reg1);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_string_to_utf8);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 4);
+
+ x86_mov_membase_reg (s->code, X86_ESP, 12, X86_EAX, 4);
+
+ x86_pop_reg (s->code, X86_EDX);
+ x86_pop_reg (s->code, X86_ECX);
+ x86_pop_reg (s->code, X86_EAX);
+}
+
+stmt: ARG_I4 (ADDR_G) {
+ x86_push_imm (s->code, tree->left->data.p);
+}
+
+stmt: ARG_I4 (coni4) "MB_USE_OPT1(0)" {
+ x86_push_imm (s->code, tree->left->data.i);
+}
+
+this: reg {
+ PRINT_REG ("THIS", tree->reg1);
+}
+
+reg: CHECKTHIS (reg) {
+ /* try to access the vtable - this will raise an exception
+ * if the object is NULL */
+ x86_alu_membase_imm (s->code, X86_CMP, tree->left->reg1, 0, 0);
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+stmt: CHECKTHIS (reg) {
+ x86_alu_membase_imm (s->code, X86_CMP, tree->left->reg1, 0, 0);
+}
+
+this: NOP
+
+reg: CALL_I4 (this, reg) {
+ int treg = X86_EAX;
+ int lreg = tree->left->reg1;
+ int rreg = tree->right->reg1;
+
+ if (lreg == treg || rreg == treg)
+ treg = X86_EDX;
+ if (lreg == treg || rreg == treg)
+ treg = X86_ECX;
+ if (lreg == treg || rreg == treg)
+ mono_assert_not_reached ();
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ x86_call_reg (s->code, rreg);
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+
+ PRINT_REG ("CALL_I4", tree->reg1);
+
+ mono_assert (tree->reg1 == X86_EAX);
+}
+
+reg: CALL_I4 (this, ADDR_G) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ x86_alu_membase_imm (s->code, X86_CMP, lreg, 0, 0);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, tree->right->data.p);
+ x86_call_code (s->code, 0);
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+
+ PRINT_REG ("CALL_I4", tree->reg1);
+
+ mono_assert (tree->reg1 == X86_EAX);
+}
+
+reg: LDVIRTFTN (reg, INTF_ADDR) {
+ int lreg = tree->left->reg1;
+
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+ x86_mov_reg_membase (s->code, lreg, lreg,
+ G_STRUCT_OFFSET (MonoVTable, interface_offsets), 4);
+ x86_mov_reg_membase (s->code, lreg, lreg, tree->right->data.m->klass->interface_id << 2, 4);
+ x86_mov_reg_membase (s->code, tree->reg1, lreg, tree->right->data.m->slot << 2, 4);
+}
+
+reg: CALL_I4 (this, INTF_ADDR) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+ x86_mov_reg_membase (s->code, lreg, lreg,
+ G_STRUCT_OFFSET (MonoVTable, interface_offsets), 4);
+ x86_mov_reg_membase (s->code, lreg, lreg, tree->right->data.m->klass->interface_id << 2, 4);
+ x86_call_virtual (s->code, lreg, tree->right->data.m->slot << 2);
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+
+ PRINT_REG ("CALL_I4(INTERFACE)", tree->reg1);
+
+ mono_assert (tree->reg1 == X86_EAX);
+}
+
+reg: LDVIRTFTN (reg, VFUNC_ADDR) {
+ int lreg = tree->left->reg1;
+
+ x86_mov_reg_membase (s->code, tree->reg1, lreg, 0, 4);
+
+ x86_mov_reg_membase (s->code, tree->reg1, tree->reg1, G_STRUCT_OFFSET (MonoVTable, vtable) + (tree->right->data.m->slot << 2), 4);
+}
+
+reg: LDFTN {
+ if (tree->reg1 != X86_EAX)
+ x86_push_reg (s->code, X86_EAX);
+ x86_push_reg (s->code, X86_ECX);
+ x86_push_reg (s->code, X86_EDX);
+
+ x86_push_imm (s->code, tree->data.m);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, arch_compile_method);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, sizeof (gpointer));
+
+ x86_pop_reg (s->code, X86_EDX);
+ x86_pop_reg (s->code, X86_ECX);
+ if (tree->reg1 != X86_EAX) {
+ x86_mov_reg_reg (s->code, tree->reg1, X86_EAX, 4);
+ x86_pop_reg (s->code, X86_EAX);
+ }
+ PRINT_REG ("LDFTN", tree->reg1);
+}
+
+
+reg: CALL_I4 (this, VFUNC_ADDR) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+ x86_call_virtual (s->code, lreg,
+ G_STRUCT_OFFSET (MonoVTable, vtable) + (tree->right->data.m->slot << 2));
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+
+ PRINT_REG ("CALL_I4(VIRTUAL)", tree->reg1);
+
+ mono_assert (tree->reg1 == X86_EAX);
+}
+
+stmt: CALL_VOID (this, ADDR_G) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ x86_alu_membase_imm (s->code, X86_CMP, lreg, 0, 0);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, tree->right->data.p);
+ x86_call_code (s->code, 0);
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+}
+
+stmt: CALL_VOID (this, INTF_ADDR) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+ x86_mov_reg_membase (s->code, lreg, lreg,
+ G_STRUCT_OFFSET (MonoVTable, interface_offsets), 4);
+ x86_mov_reg_membase (s->code, lreg, lreg, tree->right->data.m->klass->interface_id << 2, 4);
+ x86_call_virtual (s->code, lreg, tree->right->data.m->slot << 2);
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+}
+
+stmt: CALL_VOID (this, VFUNC_ADDR) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+ x86_call_virtual (s->code, lreg,
+ G_STRUCT_OFFSET (MonoVTable, vtable) + (tree->right->data.m->slot << 2));
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+}
+
+stmt: SWITCH (reg) {
+ guint32 offset;
+ guint32 *jt = (guint32 *)tree->data.p;
+
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, jt [0]);
+ offset = 6 + (guint32)s->code;
+ x86_branch32 (s->code, X86_CC_GE, jt [jt [0] + 1] - offset, FALSE);
+
+ x86_mov_reg_memindex (s->code, X86_EAX, X86_NOBASEREG,
+ tree->data.i + 4, tree->left->reg1, 2, 4);
+ x86_jump_reg (s->code, X86_EAX);
+}
+
+#
+# 64 bit integers
+#
+
+reg: CONV_I1 (lreg) {
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, TRUE, FALSE);
+}
+
+reg: CONV_I2 (lreg) {
+ x86_widen_reg (s->code, tree->reg1, tree->left->reg1, TRUE, TRUE);
+}
+
+reg: CONV_I4 (lreg) {
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+
+reg: CONV_OVF_I4 (lreg){
+ guint8 *start = s->code;
+ guchar* o1, *o2, *o3, *o4, *o5;
+ int i;
+
+ /*
+ * Valid ints: 0xffffffff:8000000 to 00000000:0x7f000000
+ */
+ for (i = 0; i < 2; i++) {
+ s->code = start;
+
+ x86_test_reg_reg (s->code, tree->left->reg1, tree->left->reg1);
+
+ /* If the low word top bit is set, see if we are negative */
+ x86_branch8 (s->code, X86_CC_LT, o3 - o1, TRUE);
+ o1 = s->code;
+
+ /* We are not negative (no top bit set, check for our top word to be zero */
+ x86_test_reg_reg (s->code, tree->left->reg2, tree->left->reg2);
+ x86_branch8 (s->code, X86_CC_EQ, o4 - o2, TRUE);
+ o2 = s->code;
+
+ /* throw exception */
+ x86_push_imm (s->code, "OverflowException");
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS,
+ arch_get_throw_exception_by_name ());
+ x86_call_code (s->code, 0);
+
+ o3 = s->code;
+ /* our top bit is set, check that top word is 0xfffffff */
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg2, 0xffffffff);
+
+ o4 = s->code;
+ /* nope, emit exception */
+ x86_branch8 (s->code, X86_CC_NE, o2 - o5, TRUE);
+ o5 = s->code;
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ }
+}
+reg: CONV_OVF_I4 (lreg){
+ guint8 *br [3], *label [1];
+
+ /*
+ * Valid ints: 0xffffffff:8000000 to 00000000:0x7f000000
+ */
+ x86_test_reg_reg (s->code, tree->left->reg1, tree->left->reg1);
+
+ /* If the low word top bit is set, see if we are negative */
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_LT, 0, TRUE);
+
+ /* We are not negative (no top bit set, check for our top word to be zero */
+ x86_test_reg_reg (s->code, tree->left->reg2, tree->left->reg2);
+ br [1] = s->code; x86_branch8 (s->code, X86_CC_EQ, 0, TRUE);
+ label [0] = s->code;
+
+ /* throw exception */
+ x86_push_imm (s->code, "OverflowException");
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS,
+ arch_get_throw_exception_by_name ());
+ x86_call_code (s->code, 0);
+
+ x86_patch (br [0], s->code);
+ /* our top bit is set, check that top word is 0xfffffff */
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg2, 0xffffffff);
+
+ x86_patch (br [1], s->code);
+ /* nope, emit exception */
+ br [2] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, TRUE);
+ x86_patch (br [2], label [0]);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: CONV_OVF_U4 (lreg) {
+ /* Keep in sync with CONV_OVF_I4_UN below, they are the same on 32-bit machines */
+ /* top word must be 0 */
+ x86_test_reg_reg (s->code, tree->left->reg2, tree->left->reg2);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, TRUE, "OverflowException");
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+reg: CONV_OVF_I4_UN (lreg) {
+ /* Keep in sync with CONV_OVF_U4 above, they are the same on 32-bit machines */
+ /* top word must be 0 */
+ x86_test_reg_reg (s->code, tree->left->reg2, tree->left->reg2);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, TRUE, "OverflowException");
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+stmt: POP (lreg)
+
+lreg: CONST_I8 1 {
+ x86_mov_reg_imm (s->code, tree->reg1, *((gint32 *)&tree->data.p));
+ x86_mov_reg_imm (s->code, tree->reg2, *((gint32 *)&tree->data.p + 1));
+}
+
+lreg: CONV_I8 (coni4) {
+ x86_mov_reg_imm (s->code, tree->reg1, tree->left->data.i);
+
+ if (tree->left->data.i >= 0)
+ x86_alu_reg_reg (s->code, X86_XOR, tree->reg2, tree->reg2);
+ else
+ x86_mov_reg_imm (s->code, tree->reg2, -1);
+}
+
+lreg: CONV_I8 (reg) {
+ guint8 *i1;
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+
+ x86_alu_reg_reg (s->code, X86_XOR, tree->reg2, tree->reg2);
+ x86_alu_reg_imm (s->code, X86_CMP, tree->left->reg1, 0);
+ x86_branch8 (s->code, X86_CC_GE, 5, TRUE);
+ i1 = s->code;
+ x86_mov_reg_imm (s->code, tree->reg2, -1);
+ mono_assert ((s->code - i1) == 5);
+}
+
+lreg: CONV_U8 (coni4) 1 {
+ x86_mov_reg_imm (s->code, tree->reg1, tree->left->data.i);
+ x86_alu_reg_reg (s->code, X86_XOR, tree->reg2, tree->reg2);
+}
+
+lreg: CONV_OVF_U8 (coni4) {
+ if (tree->left->data.i < 0){
+ x86_push_imm (s->code, "OverflowException");
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS,
+ arch_get_throw_exception_by_name ());
+ x86_call_code (s->code, 0);
+ } else {
+ x86_mov_reg_imm (s->code, tree->reg1, tree->left->data.i);
+ x86_alu_reg_reg (s->code, X86_XOR, tree->reg2, tree->reg2);
+ }
+}
+
+lreg: CONV_OVF_I8_UN (coni4) {
+ x86_mov_reg_imm (s->code, tree->reg1, tree->left->data.i);
+ x86_alu_reg_reg (s->code, X86_XOR, tree->reg2, tree->reg2);
+}
+
+lreg: CONV_OVF_U8 (reg) {
+ x86_test_reg_imm (s->code, tree->left->reg1, 0x8000000);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_EQ, TRUE, "OverflowException");
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ x86_alu_reg_reg (s->code, X86_XOR, tree->reg2, tree->reg2);
+}
+
+lreg: CONV_OVF_I8_UN (reg) {
+ /* Convert uint value into int64, we pass everything */
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ x86_alu_reg_reg (s->code, X86_XOR, tree->reg2, tree->reg2);
+}
+
+stmt: STIND_I8 (addr, lreg) {
+
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_mov_mem_reg (s->code, tree->left->data.ainfo.offset, tree->right->reg1, 4);
+ x86_mov_mem_reg (s->code, tree->left->data.ainfo.offset + 4, tree->right->reg2, 4);
+ break;
+
+ case AMBase:
+ x86_mov_membase_reg (s->code, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->right->reg1, 4);
+ x86_mov_membase_reg (s->code, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset + 4, tree->right->reg2, 4);
+ break;
+ case AMIndex:
+ x86_mov_memindex_reg (s->code, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg1, 4);
+ x86_mov_memindex_reg (s->code, X86_NOBASEREG, tree->left->data.ainfo.offset + 4,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg2, 4);
+ break;
+ case AMBaseIndex:
+ x86_mov_memindex_reg (s->code, tree->left->data.ainfo.basereg, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg1, 4);
+ x86_mov_memindex_reg (s->code, tree->left->data.ainfo.basereg, tree->left->data.ainfo.offset + 4,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift,
+ tree->right->reg2, 4);
+ break;
+ }
+
+}
+
+stmt: REMOTE_STIND_I8 (reg, lreg) {
+ guint8 *br[2];
+ int offset;
+
+ x86_push_reg (s->code, tree->right->reg1);
+ x86_mov_reg_membase (s->code, tree->right->reg1, tree->left->reg1, 0, 4);
+ x86_alu_membase_imm (s->code, X86_CMP, tree->right->reg1, 0, ((int)mono_defaults.transparent_proxy_class));
+ x86_pop_reg (s->code, tree->right->reg1);
+
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+
+ /* this is a transparent proxy - remote the call */
+
+ /* save value to stack */
+ x86_push_reg (s->code, tree->right->reg2);
+ x86_push_reg (s->code, tree->right->reg1);
+
+ x86_push_reg (s->code, X86_ESP);
+ x86_push_imm (s->code, tree->data.fi.field);
+ x86_push_imm (s->code, tree->data.fi.klass);
+ x86_push_reg (s->code, tree->left->reg1);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_store_remote_field);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 24);
+
+ br [1] = s->code; x86_jump8 (s->code, 0);
+
+ x86_patch (br [0], s->code);
+ offset = tree->data.fi.klass->valuetype ? tree->data.fi.field->offset - sizeof (MonoObject) :
+ tree->data.fi.field->offset;
+ x86_mov_membase_reg (s->code, tree->left->reg1, offset, tree->right->reg1, 4);
+ x86_mov_membase_reg (s->code, tree->left->reg1, offset + 4, tree->right->reg2, 4);
+
+ x86_patch (br [1], s->code);
+}
+
+
+# an addr can use two address register (base and index register). The must take care
+# that we do not override them (thus the use of x86_lea)
+lreg: LDIND_I8 (addr) {
+
+ switch (tree->left->data.ainfo.amode) {
+
+ case AMImmediate:
+ x86_mov_reg_mem (s->code, tree->reg1, tree->left->data.ainfo.offset, 4);
+ x86_mov_reg_mem (s->code, tree->reg2, tree->left->data.ainfo.offset + 4, 4);
+ break;
+
+ case AMBase:
+ x86_lea_membase (s->code, tree->reg2, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset);
+ x86_mov_reg_membase (s->code, tree->reg1, tree->reg2, 0, 4);
+ x86_mov_reg_membase (s->code, tree->reg2, tree->reg2, 4, 4);
+ break;
+ case AMIndex:
+ x86_lea_memindex (s->code, tree->reg2, X86_NOBASEREG, tree->left->data.ainfo.offset,
+ tree->left->data.ainfo.indexreg, tree->left->data.ainfo.shift);
+ x86_mov_reg_membase (s->code, tree->reg1, tree->reg2, 0, 4);
+ x86_mov_reg_membase (s->code, tree->reg2, tree->reg2, 4, 4);
+ break;
+ case AMBaseIndex:
+ x86_lea_memindex (s->code, tree->reg2, tree->left->data.ainfo.basereg,
+ tree->left->data.ainfo.offset, tree->left->data.ainfo.indexreg,
+ tree->left->data.ainfo.shift);
+ x86_mov_reg_membase (s->code, tree->reg1, tree->reg2, 0, 4);
+ x86_mov_reg_membase (s->code, tree->reg2, tree->reg2, 4, 4);
+ break;
+ }
+ PRINT_REG ("LDIND_I8_0", tree->reg1);
+ PRINT_REG ("LDIND_I8_1", tree->reg2);
+}
+
+lreg: SHR (lreg, coni4) {
+ if (tree->right->data.i < 32) {
+ x86_shrd_reg_imm (s->code, tree->left->reg1, tree->left->reg2, tree->right->data.i);
+ x86_shift_reg_imm (s->code, X86_SAR, tree->left->reg2, tree->right->data.i);
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+ } else if (tree->right->data.i < 64) {
+ if (tree->reg1 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg2, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+ x86_shift_reg_imm (s->code, X86_SAR, tree->reg2, 31);
+ x86_shift_reg_imm (s->code, X86_SAR, tree->reg1, (tree->right->data.i - 32));
+ } /* else unspecified result */
+}
+
+lreg: SHR_UN (lreg, coni4) {
+ if (tree->right->data.i < 32) {
+ x86_shrd_reg_imm (s->code, tree->left->reg1, tree->left->reg2, tree->right->data.i);
+ x86_shift_reg_imm (s->code, X86_SHR, tree->left->reg2, tree->right->data.i);
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+ } else if (tree->right->data.i < 64) {
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg2, 4);
+ x86_shift_reg_imm (s->code, X86_SHR, tree->reg1, (tree->right->data.i - 32));
+ x86_mov_reg_imm (s->code, tree->reg2, 0);
+ } /* else unspecified result */
+}
+
+lreg: SHR (lreg, reg) {
+ guint8 *br [1];
+
+ if (tree->right->reg1 != X86_ECX)
+ x86_mov_reg_reg (s->code, X86_ECX, tree->right->reg1, 4);
+
+ x86_shrd_reg (s->code, tree->left->reg1, tree->left->reg2);
+ x86_shift_reg (s->code, X86_SAR, tree->left->reg2);
+ x86_test_reg_imm (s->code, X86_ECX, 32);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_EQ, 0, FALSE);
+ x86_mov_reg_reg (s->code, tree->left->reg1, tree->left->reg2, 4);
+ x86_shift_reg_imm (s->code, X86_SAR, tree->reg2, 31);
+ x86_patch (br [0], s->code);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: SHR_UN (lreg, reg) {
+ guint8 *br [1];
+
+ if (tree->right->reg1 != X86_ECX)
+ x86_mov_reg_reg (s->code, X86_ECX, tree->right->reg1, 4);
+
+ x86_shrd_reg (s->code, tree->left->reg1, tree->left->reg2);
+ x86_shift_reg (s->code, X86_SHR, tree->left->reg2);
+ x86_test_reg_imm (s->code, X86_ECX, 32);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_EQ, 0, FALSE);
+ x86_mov_reg_reg (s->code, tree->left->reg1, tree->left->reg2, 4);
+ x86_shift_reg_imm (s->code, X86_SHR, tree->reg2, 31);
+ x86_patch (br [0], s->code);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: SHL (lreg, coni4) {
+ if (tree->right->data.i < 32) {
+ x86_shld_reg_imm (s->code, tree->left->reg2, tree->left->reg1, tree->right->data.i);
+ x86_shift_reg_imm (s->code, X86_SHL, tree->left->reg1, tree->right->data.i);
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+ } else if (tree->right->data.i < 64) {
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg1, 4);
+ x86_shift_reg_imm (s->code, X86_SHL, tree->reg2, (tree->right->data.i - 32));
+ x86_alu_reg_reg (s->code, X86_XOR, tree->reg1, tree->reg1);
+ } /* else unspecified result */
+}
+
+lreg: SHL (lreg, reg) {
+ guint8 *br [1];
+
+ if (tree->right->reg1 != X86_ECX)
+ x86_mov_reg_reg (s->code, X86_ECX, tree->right->reg1, 4);
+
+ x86_shld_reg (s->code, tree->left->reg2, tree->left->reg1);
+ x86_shift_reg (s->code, X86_SHL, tree->left->reg1);
+ x86_test_reg_imm (s->code, X86_ECX, 32);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_EQ, 0, FALSE);
+ x86_mov_reg_reg (s->code, tree->left->reg2, tree->left->reg1, 4);
+ x86_alu_reg_reg (s->code, X86_XOR, tree->left->reg1, tree->left->reg1);
+ x86_patch (br [0], s->code);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: ADD (lreg, lreg) {
+ x86_alu_reg_reg (s->code, X86_ADD, tree->left->reg1, tree->right->reg1);
+ x86_alu_reg_reg (s->code, X86_ADC, tree->left->reg2, tree->right->reg2);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: ADD_OVF (lreg, lreg) {
+ x86_alu_reg_reg (s->code, X86_ADD, tree->left->reg1, tree->right->reg1);
+ x86_alu_reg_reg (s->code, X86_ADC, tree->left->reg2, tree->right->reg2);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NO, TRUE, "OverflowException");
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: ADD_OVF_UN (lreg, lreg) {
+ x86_alu_reg_reg (s->code, X86_ADD, tree->left->reg1, tree->right->reg1);
+ x86_alu_reg_reg (s->code, X86_ADC, tree->left->reg2, tree->right->reg2);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NC, FALSE, "OverflowException");
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: SUB (lreg, lreg) {
+ x86_alu_reg_reg (s->code, X86_SUB, tree->left->reg1, tree->right->reg1);
+ x86_alu_reg_reg (s->code, X86_SBB, tree->left->reg2, tree->right->reg2);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: SUB_OVF (lreg, lreg) {
+ x86_alu_reg_reg (s->code, X86_SUB, tree->left->reg1, tree->right->reg1);
+ x86_alu_reg_reg (s->code, X86_SBB, tree->left->reg2, tree->right->reg2);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NO, TRUE, "OverflowException");
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: SUB_OVF_UN (lreg, lreg) {
+ x86_alu_reg_reg (s->code, X86_SUB, tree->left->reg1, tree->right->reg1);
+ x86_alu_reg_reg (s->code, X86_SBB, tree->left->reg2, tree->right->reg2);
+ EMIT_COND_SYSTEM_EXCEPTION (X86_CC_NC, FALSE, "OverflowException");
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: AND (lreg, lreg) {
+ x86_alu_reg_reg (s->code, X86_AND, tree->left->reg1, tree->right->reg1);
+ x86_alu_reg_reg (s->code, X86_AND, tree->left->reg2, tree->right->reg2);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: OR (lreg, lreg) {
+ x86_alu_reg_reg (s->code, X86_OR, tree->left->reg1, tree->right->reg1);
+ x86_alu_reg_reg (s->code, X86_OR, tree->left->reg2, tree->right->reg2);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: XOR (lreg, lreg) {
+ x86_alu_reg_reg (s->code, X86_XOR, tree->left->reg1, tree->right->reg1);
+ x86_alu_reg_reg (s->code, X86_XOR, tree->left->reg2, tree->right->reg2);
+
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+}
+
+lreg: NEG (lreg) {
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+
+ x86_neg_reg (s->code, tree->reg1);
+ x86_alu_reg_imm (s->code, X86_ADC, tree->reg2, 0);
+ x86_neg_reg (s->code, tree->reg2);
+}
+
+lreg: NOT (lreg) {
+ if (tree->reg1 != tree->left->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+ if (tree->reg2 != tree->left->reg2)
+ x86_mov_reg_reg (s->code, tree->reg2, tree->left->reg2, 4);
+
+ x86_not_reg (s->code, tree->reg1);
+ x86_not_reg (s->code, tree->reg2);
+}
+
+lreg: MUL (lreg, lreg) {
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_push_reg (s->code, X86_ECX);
+
+ x86_push_reg (s->code, tree->right->reg2);
+ x86_push_reg (s->code, tree->right->reg1);
+ x86_push_reg (s->code, tree->left->reg2);
+ x86_push_reg (s->code, tree->left->reg1);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_llmult);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 16);
+
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_pop_reg (s->code, X86_ECX);
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+lreg: MUL_OVF (lreg, lreg) {
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_push_reg (s->code, X86_ECX);
+
+ x86_push_reg (s->code, tree->right->reg2);
+ x86_push_reg (s->code, tree->right->reg1);
+ x86_push_reg (s->code, tree->left->reg2);
+ x86_push_reg (s->code, tree->left->reg1);
+ /* pass a pointer to store the resulting exception -
+ * ugly, but it works */
+ x86_push_reg (s->code, X86_ESP);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_llmult_ovf);
+ x86_call_code (s->code, 0);
+ x86_mov_reg_membase (s->code, X86_ECX, X86_ESP, 4, 4);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 20);
+ x86_alu_reg_imm (s->code, X86_CMP, X86_ECX, 0);
+
+ /* cond. emit exception */
+ x86_branch8 (s->code, X86_CC_EQ, 7, FALSE);
+ x86_push_reg (s->code, X86_ECX);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, arch_get_throw_exception ());
+ x86_call_code (s->code, 0);
+
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_pop_reg (s->code, X86_ECX);
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+lreg: MUL_OVF_UN (lreg, lreg) {
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_push_reg (s->code, X86_ECX);
+
+ x86_push_reg (s->code, tree->right->reg2);
+ x86_push_reg (s->code, tree->right->reg1);
+ x86_push_reg (s->code, tree->left->reg2);
+ x86_push_reg (s->code, tree->left->reg1);
+ /* pass a pointer to store the resulting exception -
+ * ugly, but it works */
+ x86_push_reg (s->code, X86_ESP);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_llmult_ovf_un);
+ x86_call_code (s->code, 0);
+ x86_mov_reg_membase (s->code, X86_ECX, X86_ESP, 4, 4);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 20);
+ x86_alu_reg_imm (s->code, X86_CMP, X86_ECX, 0);
+
+ /* cond. emit exception */
+ x86_branch8 (s->code, X86_CC_EQ, 7, FALSE);
+ x86_push_reg (s->code, X86_ECX);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, arch_get_throw_exception ());
+ x86_call_code (s->code, 0);
+
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_pop_reg (s->code, X86_ECX);
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+lreg: DIV (lreg, lreg) {
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_push_reg (s->code, X86_ECX);
+
+ x86_push_reg (s->code, tree->right->reg2);
+ x86_push_reg (s->code, tree->right->reg1);
+ x86_push_reg (s->code, tree->left->reg2);
+ x86_push_reg (s->code, tree->left->reg1);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_lldiv);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 16);
+
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_pop_reg (s->code, X86_ECX);
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+lreg: REM (lreg, lreg) {
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_push_reg (s->code, X86_ECX);
+
+ x86_push_reg (s->code, tree->right->reg2);
+ x86_push_reg (s->code, tree->right->reg1);
+ x86_push_reg (s->code, tree->left->reg2);
+ x86_push_reg (s->code, tree->left->reg1);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_llrem);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 16);
+
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_pop_reg (s->code, X86_ECX);
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+lreg: DIV_UN (lreg, lreg) {
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_push_reg (s->code, X86_ECX);
+
+ x86_push_reg (s->code, tree->right->reg2);
+ x86_push_reg (s->code, tree->right->reg1);
+ x86_push_reg (s->code, tree->left->reg2);
+ x86_push_reg (s->code, tree->left->reg1);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_lldiv_un);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 16);
+
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_pop_reg (s->code, X86_ECX);
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+lreg: REM_UN (lreg, lreg) {
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_push_reg (s->code, X86_ECX);
+
+ x86_push_reg (s->code, tree->right->reg2);
+ x86_push_reg (s->code, tree->right->reg1);
+ x86_push_reg (s->code, tree->left->reg2);
+ x86_push_reg (s->code, tree->left->reg1);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_llrem_un);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 16);
+
+ if (mono_regset_reg_used (s->rs, X86_ECX))
+ x86_pop_reg (s->code, X86_ECX);
+
+ mono_assert (tree->reg1 == X86_EAX &&
+ tree->reg2 == X86_EDX);
+}
+
+lreg: CALL_I8 (this, ADDR_G) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ x86_alu_membase_imm (s->code, X86_CMP, lreg, 0, 0);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, tree->right->data.p);
+ x86_call_code (s->code, 0);
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+
+ mono_assert (tree->reg1 == X86_EAX);
+ mono_assert (tree->reg2 == X86_EDX);
+}
+
+lreg: CALL_I8 (this, VFUNC_ADDR) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+ x86_call_virtual (s->code, lreg,
+ G_STRUCT_OFFSET (MonoVTable, vtable) + (tree->right->data.m->slot << 2));
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+
+ PRINT_REG ("CALL0_I8(VIRTUAL)", tree->reg1);
+ PRINT_REG ("CALL1_I8(VIRTUAL)", tree->reg2);
+
+ mono_assert (tree->reg1 == X86_EAX);
+ mono_assert (tree->reg2 == X86_EDX);
+}
+
+lreg: CALL_I8 (this, INTF_ADDR) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+ x86_mov_reg_membase (s->code, lreg, lreg,
+ G_STRUCT_OFFSET (MonoVTable, interface_offsets), 4);
+ x86_mov_reg_membase (s->code, lreg, lreg, tree->right->data.m->klass->interface_id << 2, 4);
+ x86_call_virtual (s->code, lreg, tree->right->data.m->slot << 2);
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+
+ PRINT_REG ("CALL_I8(INTERFACE)", tree->reg1);
+
+ mono_assert (tree->reg1 == X86_EAX);
+ mono_assert (tree->reg2 == X86_EDX);
+}
+
+stmt: RET (lreg) {
+ if (tree->left->reg1 != X86_EAX) {
+ if (tree->left->reg2 != X86_EAX) {
+ x86_mov_reg_reg (s->code, X86_EAX, tree->left->reg1, 4);
+ if (tree->left->reg2 != X86_EDX)
+ x86_mov_reg_reg (s->code, X86_EDX, tree->left->reg2, 4);
+ } else {
+ x86_mov_reg_reg (s->code, X86_ECX, tree->left->reg2, 4);
+ x86_mov_reg_reg (s->code, X86_EAX, tree->left->reg1, 4);
+ x86_mov_reg_reg (s->code, X86_EDX, X86_ECX, 4);
+ }
+ } else if (tree->left->reg2 != X86_EDX) {
+ x86_mov_reg_reg (s->code, X86_EDX, tree->left->reg2, 4);
+ }
+
+ if (!tree->last_instr) {
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_EPILOG, NULL);
+ x86_jump32 (s->code, 0);
+ }
+}
+
+
+stmt: ARG_I8 (lreg) {
+ x86_push_reg (s->code, tree->left->reg2);
+ x86_push_reg (s->code, tree->left->reg1);
+}
+
+reg: CEQ (lreg, lreg) {
+ guint8 *br [1];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ x86_patch (br [0], s->code);
+ x86_set_reg (s->code, X86_CC_EQ, tree->reg1, FALSE);
+ x86_widen_reg (s->code, tree->reg1, tree->reg1, FALSE, FALSE);
+}
+
+reg: CLT (lreg, lreg) {
+ guint8 *br [4];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_GT, 0, TRUE);
+ br [1] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, TRUE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ br [2] = s->code; x86_branch8 (s->code, X86_CC_GE, 0, FALSE);
+
+ /* set result to 1 */
+ x86_patch (br [1], s->code);
+ x86_mov_reg_imm (s->code, tree->reg1, 1);
+ br [3] = s->code; x86_jump8 (s->code, 0);
+
+ /* set result to 0 */
+ x86_patch (br [0], s->code);
+ x86_patch (br [2], s->code);
+ x86_mov_reg_imm (s->code, tree->reg1, 0);
+
+ x86_patch (br [3], s->code);
+}
+
+reg: CLT_UN (lreg, lreg) {
+ guint8 *br [4];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_GT, 0, FALSE);
+ br [1] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ br [2] = s->code; x86_branch8 (s->code, X86_CC_GE, 0, FALSE);
+
+ /* set result to 1 */
+ x86_patch (br [1], s->code);
+ x86_mov_reg_imm (s->code, tree->reg1, 1);
+ br [3] = s->code; x86_jump8 (s->code, 0);
+
+ /* set result to 0 */
+ x86_patch (br [0], s->code);
+ x86_patch (br [2], s->code);
+ x86_mov_reg_imm (s->code, tree->reg1, 0);
+
+ x86_patch (br [3], s->code);
+}
+
+reg: CGT (lreg, lreg) {
+ guint8 *br [4];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->right->reg2, tree->left->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_GT, 0, TRUE);
+ br [1] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, TRUE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->right->reg1, tree->left->reg1);
+ br [2] = s->code; x86_branch8 (s->code, X86_CC_GE, 0, FALSE);
+
+ /* set result to 1 */
+ x86_patch (br [1], s->code);
+ x86_mov_reg_imm (s->code, tree->reg1, 1);
+ br [3] = s->code; x86_jump8 (s->code, 0);
+
+ /* set result to 0 */
+ x86_patch (br [0], s->code);
+ x86_patch (br [2], s->code);
+ x86_mov_reg_imm (s->code, tree->reg1, 0);
+
+ x86_patch (br [3], s->code);
+}
+
+reg: CGT_UN (lreg, lreg) {
+ guint8 *br [4];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->right->reg2, tree->left->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_GT, 0, FALSE);
+ br [1] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->right->reg1, tree->left->reg1);
+ br [2] = s->code; x86_branch8 (s->code, X86_CC_GE, 0, FALSE);
+
+ /* set result to 1 */
+ x86_patch (br [1], s->code);
+ x86_mov_reg_imm (s->code, tree->reg1, 1);
+ br [3] = s->code; x86_jump8 (s->code, 0);
+
+ /* set result to 0 */
+ x86_patch (br [0], s->code);
+ x86_patch (br [2], s->code);
+ x86_mov_reg_imm (s->code, tree->reg1, 0);
+
+ x86_patch (br [3], s->code);
+}
+
+stmt: BEQ (lreg, lreg) {
+ guint8 *br [1];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_EQ, 0, TRUE);
+ x86_patch (br [0], s->code);
+
+}
+
+stmt: BNE_UN (lreg, lreg) {
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_NE, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_NE, 0, FALSE);
+}
+
+stmt: BGE (lreg, lreg) {
+ guint8 *br [1];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GT, 0, TRUE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, TRUE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GE, 0, FALSE);
+ x86_patch (br [0], s->code);
+}
+
+stmt: BGE_UN (lreg, lreg) {
+ guint8 *br [1];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GT, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GE, 0, FALSE);
+ x86_patch (br [0], s->code);
+}
+
+stmt: BGT (lreg, lreg) {
+ guint8 *br [1];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GT, 0, TRUE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, TRUE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GT, 0, FALSE);
+ x86_patch (br [0], s->code);
+}
+
+stmt: BGT_UN (lreg, lreg) {
+ guint8 *br [1];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GT, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_GT, 0, FALSE);
+ x86_patch (br [0], s->code);
+}
+
+stmt: BLT (lreg, lreg) {
+ guint8 *br [1];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LT, 0, TRUE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, TRUE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LT, 0, FALSE);
+ x86_patch (br [0], s->code);
+}
+
+stmt: BLT_UN (lreg, lreg) {
+ guint8 *br [1];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LT, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LT, 0, FALSE);
+ x86_patch (br [0], s->code);
+}
+
+stmt: BLE (lreg, lreg) {
+ guint8 *br [1];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LT, 0, TRUE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, TRUE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LE, 0, FALSE);
+ x86_patch (br [0], s->code);
+}
+
+stmt: BLE_UN (lreg, lreg) {
+ guint8 *br [1];
+
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LT, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg2, tree->right->reg2);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+ x86_alu_reg_reg (s->code, X86_CMP, tree->left->reg1, tree->right->reg1);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_LE, 0, FALSE);
+ x86_patch (br [0], s->code);
+}
+
+#
+# floating point
+
+#stmt: STLOC (CONV_I4 (freg)) {
+# // fixme: set CW
+# x86_fist_pop_membase (s->code, X86_EBP, tree->data.i, FALSE);
+#}
+
+reg: CONV_I1 (freg) {
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, 4);
+ x86_fnstcw_membase(s->code, X86_ESP, 0);
+ x86_mov_reg_membase (s->code, tree->reg1, X86_ESP, 0, 2);
+ x86_alu_reg_imm (s->code, X86_OR, tree->reg1, 0xc00);
+ x86_mov_membase_reg (s->code, X86_ESP, 2, tree->reg1, 2);
+ x86_fldcw_membase (s->code, X86_ESP, 2);
+ x86_push_reg (s->code, X86_EAX); // SP = SP - 4
+ x86_fist_pop_membase (s->code, X86_ESP, 0, FALSE);
+ x86_pop_reg (s->code, tree->reg1);
+ x86_widen_reg (s->code, tree->reg1, tree->reg1, TRUE, FALSE);
+ x86_fldcw_membase (s->code, X86_ESP, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 4);
+}
+
+reg: CONV_I2 (freg) {
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, 4);
+ x86_fnstcw_membase(s->code, X86_ESP, 0);
+ x86_mov_reg_membase (s->code, tree->reg1, X86_ESP, 0, 2);
+ x86_alu_reg_imm (s->code, X86_OR, tree->reg1, 0xc00);
+ x86_mov_membase_reg (s->code, X86_ESP, 2, tree->reg1, 2);
+ x86_fldcw_membase (s->code, X86_ESP, 2);
+ x86_push_reg (s->code, X86_EAX); // SP = SP - 4
+ x86_fist_pop_membase (s->code, X86_ESP, 0, FALSE);
+ x86_pop_reg (s->code, tree->reg1);
+ x86_widen_reg (s->code, tree->reg1, tree->reg1, TRUE, TRUE);
+ x86_fldcw_membase (s->code, X86_ESP, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 4);
+}
+
+reg: CONV_I4 (freg) {
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, 4);
+ x86_fnstcw_membase(s->code, X86_ESP, 0);
+ x86_mov_reg_membase (s->code, tree->reg1, X86_ESP, 0, 2);
+ x86_alu_reg_imm (s->code, X86_OR, tree->reg1, 0xc00);
+ x86_mov_membase_reg (s->code, X86_ESP, 2, tree->reg1, 2);
+ x86_fldcw_membase (s->code, X86_ESP, 2);
+ x86_push_reg (s->code, X86_EAX); // SP = SP - 4
+ x86_fist_pop_membase (s->code, X86_ESP, 0, FALSE);
+ x86_pop_reg (s->code, tree->reg1);
+ x86_fldcw_membase (s->code, X86_ESP, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 4);
+}
+
+lreg: CONV_I8 (freg) {
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, 4);
+ x86_fnstcw_membase(s->code, X86_ESP, 0);
+ x86_mov_reg_membase (s->code, tree->reg1, X86_ESP, 0, 2);
+ x86_alu_reg_imm (s->code, X86_OR, tree->reg1, 0xc00);
+ x86_mov_membase_reg (s->code, X86_ESP, 2, tree->reg1, 2);
+ x86_fldcw_membase (s->code, X86_ESP, 2);
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, 8);
+ x86_fist_pop_membase (s->code, X86_ESP, 0, TRUE);
+ x86_pop_reg (s->code, tree->reg1);
+ x86_pop_reg (s->code, tree->reg2);
+ x86_fldcw_membase (s->code, X86_ESP, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 8);
+}
+
+reg: CEQ (freg, freg) {
+ int treg = tree->reg1;
+
+ if (treg != X86_EAX)
+ x86_push_reg (s->code, X86_EAX); // save EAX
+
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ x86_alu_reg_imm (s->code, X86_CMP, X86_EAX, 0x4000);
+ x86_set_reg (s->code, X86_CC_EQ, tree->reg1, TRUE);
+ x86_widen_reg (s->code, treg, treg, FALSE, FALSE);
+
+ if (treg != X86_EAX)
+ x86_pop_reg (s->code, X86_EAX); // save EAX
+}
+
+reg: CGT (freg, freg) {
+ int treg = tree->reg1;
+
+ if (treg != X86_EAX)
+ x86_push_reg (s->code, X86_EAX); // save EAX
+
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ x86_alu_reg_imm (s->code, X86_CMP, X86_EAX, 0x0100);
+ x86_set_reg (s->code, X86_CC_EQ, tree->reg1, TRUE);
+ x86_widen_reg (s->code, treg, treg, FALSE, FALSE);
+
+ if (treg != X86_EAX)
+ x86_pop_reg (s->code, X86_EAX); // save EAX
+}
+
+reg: CGT_UN (freg, freg) {
+ int treg = tree->reg1;
+
+ if (treg != X86_EAX)
+ x86_push_reg (s->code, X86_EAX); // save EAX
+
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ x86_alu_reg_imm (s->code, X86_CMP, X86_EAX, 0x0100);
+ x86_set_reg (s->code, X86_CC_EQ, tree->reg1, TRUE);
+ x86_widen_reg (s->code, treg, treg, FALSE, FALSE);
+
+ if (treg != X86_EAX)
+ x86_pop_reg (s->code, X86_EAX); // save EAX
+}
+
+reg: CLT (freg, freg) {
+ int treg = tree->reg1;
+
+ if (treg != X86_EAX)
+ x86_push_reg (s->code, X86_EAX); // save EAX
+
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ x86_set_reg (s->code, X86_CC_EQ, tree->reg1, TRUE);
+ x86_widen_reg (s->code, treg, treg, FALSE, FALSE);
+
+ if (treg != X86_EAX)
+ x86_pop_reg (s->code, X86_EAX); // save EAX
+}
+
+reg: CLT_UN (freg, freg) {
+ int treg = tree->reg1;
+
+ if (treg != X86_EAX)
+ x86_push_reg (s->code, X86_EAX); // save EAX
+
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ x86_set_reg (s->code, X86_CC_EQ, tree->reg1, TRUE);
+ x86_widen_reg (s->code, treg, treg, FALSE, FALSE);
+
+ if (treg != X86_EAX)
+ x86_pop_reg (s->code, X86_EAX); // save EAX
+}
+
+freg: CONV_R8 (freg) {
+ /* nothing to do */
+}
+
+freg: CONV_R4 (freg) {
+ /* fixme: nothing to do ??*/
+}
+
+freg: CONV_R8 (LDIND_I4 (ADDR_G)) {
+ x86_fild (s->code, tree->left->left->data.p, FALSE);
+}
+
+freg: CONV_R4 (reg) {
+ x86_push_reg (s->code, tree->left->reg1);
+ x86_fild_membase (s->code, X86_ESP, 0, FALSE);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 4);
+}
+
+freg: CONV_R8 (reg) {
+ x86_push_reg (s->code, tree->left->reg1);
+ x86_fild_membase (s->code, X86_ESP, 0, FALSE);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 4);
+}
+
+freg: CONV_R_UN (reg) {
+ x86_push_imm (s->code, 0);
+ x86_push_reg (s->code, tree->left->reg1);
+ x86_fild_membase (s->code, X86_ESP, 0, TRUE);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 8);
+}
+
+freg: CONV_R_UN (lreg) {
+ static guint8 mn[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x40 };
+ guint8 *br [1];
+
+ /* load 64bit integer to FP stack */
+ x86_push_imm (s->code, 0);
+ x86_push_reg (s->code, tree->left->reg2);
+ x86_push_reg (s->code, tree->left->reg1);
+ x86_fild_membase (s->code, X86_ESP, 0, TRUE);
+ /* store as 80bit FP value */
+ x86_fst80_membase (s->code, X86_ESP, 0);
+
+ /* test if lreg is negative */
+ x86_test_reg_reg (s->code, tree->left->reg1, tree->left->reg1);
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_GEZ, 0, TRUE);
+
+ /* add correction constant mn */
+ x86_fld80_mem (s->code, mn);
+ x86_fld80_membase (s->code, X86_ESP, 0);
+ x86_fp_op_reg (s->code, X86_FADD, 1, TRUE);
+ x86_fst80_membase (s->code, X86_ESP, 0);
+
+ x86_patch (br [0], s->code);
+
+ x86_fld80_membase (s->code, X86_ESP, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 12);
+}
+
+freg: CONV_R4 (lreg) {
+ x86_push_reg (s->code, tree->left->reg2);
+ x86_push_reg (s->code, tree->left->reg1);
+ x86_fild_membase (s->code, X86_ESP, 0, TRUE);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 8);
+}
+
+freg: CONV_R8 (lreg) {
+ x86_push_reg (s->code, tree->left->reg2);
+ x86_push_reg (s->code, tree->left->reg1);
+ x86_fild_membase (s->code, X86_ESP, 0, TRUE);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 8);
+}
+
+freg: CONST_R4 {
+ float f = *(float *)tree->data.p;
+
+ if (f == 0.0)
+ x86_fldz (s->code);
+ else if (f == 1.0)
+ x86_fld1(s->code);
+ else
+ x86_fld (s->code, tree->data.p, FALSE);
+}
+
+freg: CONST_R8 {
+ double d = *(double *)tree->data.p;
+
+ if (d == 0.0)
+ x86_fldz (s->code);
+ else if (d == 1.0)
+ x86_fld1(s->code);
+ else
+ x86_fld (s->code, tree->data.p, TRUE);
+}
+
+freg: LDIND_R4 (reg) {
+ x86_fld_membase (s->code, tree->left->reg1, 0, FALSE);
+}
+
+freg: LDIND_R8 (reg) {
+ x86_fld_membase (s->code, tree->left->reg1, 0, TRUE);
+}
+
+freg: ADD (freg, freg) {
+ x86_fp_op_reg (s->code, X86_FADD, 1, TRUE);
+}
+
+freg: SUB (freg, freg) {
+ x86_fp_op_reg (s->code, X86_FSUB, 1, TRUE);
+}
+
+freg: MUL (freg, freg) {
+ x86_fp_op_reg (s->code, X86_FMUL, 1, TRUE);
+}
+
+freg: DIV (freg, freg) {
+ x86_fp_op_reg (s->code, X86_FDIV, 1, TRUE);
+}
+
+freg: REM (freg, freg) {
+ guint8 *l1, *l2;
+
+ /* we need to exchange ST(0) with ST(1) */
+ x86_fxch (s->code, 1);
+
+ /* this requires a loop, because fprem1 somtimes
+ * returns a partial remainder */
+ l1 = s->code;
+ x86_fprem1 (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x0400);
+ l2 = s->code + 2;
+ x86_branch8 (s->code, X86_CC_NE, l1 - l2, FALSE);
+
+ /* pop result */
+ x86_fstp (s->code, 1);
+}
+
+freg: NEG (freg) {
+ x86_fchs (s->code);
+}
+
+stmt: POP (freg)
+
+stmt: STIND_R4 (ADDR_L, freg) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->left->data.i).offset;
+ x86_fst_membase (s->code, X86_EBP, offset, FALSE, TRUE);
+}
+
+stmt: STIND_R4 (reg, freg) {
+ x86_fst_membase (s->code, tree->left->reg1, 0, FALSE, TRUE);
+}
+
+stmt: REMOTE_STIND_R4 (reg, freg) {
+ guint8 *br[2];
+ int treg = X86_EAX;
+ int lreg = tree->left->reg1;
+ int offset;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ x86_mov_reg_membase (s->code, treg, lreg, 0, 4);
+ x86_alu_membase_imm (s->code, X86_CMP, treg, 0, ((int)mono_defaults.transparent_proxy_class));
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+
+ /* this is a transparent proxy - remote the call */
+
+ /* save value to stack */
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, 4);
+ x86_fst_membase (s->code, X86_ESP, 0, FALSE, TRUE);
+
+ x86_push_reg (s->code, X86_ESP);
+ x86_push_imm (s->code, tree->data.fi.field);
+ x86_push_imm (s->code, tree->data.fi.klass);
+ x86_push_reg (s->code, lreg);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_store_remote_field);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 20);
+
+ br [1] = s->code; x86_jump8 (s->code, 0);
+
+ x86_patch (br [0], s->code);
+ offset = tree->data.fi.klass->valuetype ? tree->data.fi.field->offset - sizeof (MonoObject) :
+ tree->data.fi.field->offset;
+ x86_fst_membase (s->code, lreg, offset, FALSE, TRUE);
+
+ x86_patch (br [1], s->code);
+}
+
+stmt: STIND_R8 (ADDR_L, freg) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->left->data.i).offset;
+ x86_fst_membase (s->code, X86_EBP, offset, TRUE, TRUE);
+}
+
+stmt: STIND_R8 (reg, freg) {
+ x86_fst_membase (s->code, tree->left->reg1, 0, TRUE, TRUE);
+}
+
+stmt: REMOTE_STIND_R8 (reg, freg) {
+ guint8 *br[2];
+ int treg = X86_EAX;
+ int lreg = tree->left->reg1;
+ int offset;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ x86_mov_reg_membase (s->code, treg, lreg, 0, 4);
+ x86_alu_membase_imm (s->code, X86_CMP, treg, 0, ((int)mono_defaults.transparent_proxy_class));
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+
+ /* this is a transparent proxy - remote the call */
+
+ /* save value to stack */
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, 8);
+ x86_fst_membase (s->code, X86_ESP, 0, TRUE, TRUE);
+
+ x86_push_reg (s->code, X86_ESP);
+ x86_push_imm (s->code, tree->data.fi.field);
+ x86_push_imm (s->code, tree->data.fi.klass);
+ x86_push_reg (s->code, lreg);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_store_remote_field);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 24);
+
+ br [1] = s->code; x86_jump8 (s->code, 0);
+
+ x86_patch (br [0], s->code);
+ offset = tree->data.fi.klass->valuetype ? tree->data.fi.field->offset - sizeof (MonoObject) :
+ tree->data.fi.field->offset;
+ x86_fst_membase (s->code, lreg, offset, TRUE, TRUE);
+
+ x86_patch (br [1], s->code);
+}
+
+stmt: ARG_R4 (freg) {
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, 4);
+ x86_fst_membase (s->code, X86_ESP, 0, FALSE, TRUE);
+}
+
+stmt: ARG_R8 (freg) {
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, 8);
+ x86_fst_membase (s->code, X86_ESP, 0, TRUE, TRUE);
+}
+
+# fixme: we need to implement unordered and ordered compares
+
+stmt: BEQ (freg, freg) {
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ x86_alu_reg_imm (s->code, X86_CMP, X86_EAX, 0x4000);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_EQ, 0, TRUE);
+}
+
+stmt: BNE_UN (freg, freg) {
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ x86_alu_reg_imm (s->code, X86_CMP, X86_EAX, 0x4000);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_NE, 0, FALSE);
+}
+
+stmt: BLT (freg, freg) {
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_EQ, 0, FALSE);
+}
+
+# fixme: unordered ??
+stmt: BLT_UN (freg, freg) {
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_EQ, 0, FALSE);
+}
+
+stmt: BGE (freg, freg) {
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_NE, 0, FALSE);
+}
+
+stmt: BGE_UN (freg, freg) {
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_NE, 0, FALSE);
+}
+
+stmt: BGT (freg, freg) {
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ x86_alu_reg_imm (s->code, X86_CMP, X86_EAX, 0x0100);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_EQ, 0, FALSE);
+}
+
+stmt: BGT_UN (freg, freg) {
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ x86_alu_reg_imm (s->code, X86_CMP, X86_EAX, 0x0100);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_EQ, 0, FALSE);
+}
+
+stmt: BLE (freg, freg) {
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ x86_alu_reg_imm (s->code, X86_CMP, X86_EAX, 0x0100);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_NE, 0, FALSE);
+}
+
+stmt: BLE_UN (freg, freg) {
+ x86_fcompp (s->code);
+ x86_fnstsw (s->code);
+ x86_alu_reg_imm (s->code, X86_AND, X86_EAX, 0x4500);
+ x86_alu_reg_imm (s->code, X86_CMP, X86_EAX, 0x0100);
+ mono_add_jump_info (s, s->code + 2, MONO_JUMP_INFO_BB, tree->data.bb);
+ x86_branch32 (s->code, X86_CC_NE, 0, FALSE);
+}
+
+freg: CALL_R8 (this, ADDR_G) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ x86_alu_membase_imm (s->code, X86_CMP, lreg, 0, 0);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, tree->right->data.p);
+ x86_call_code (s->code, 0);
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+}
+
+freg: CALL_R8 (this, INTF_ADDR) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+ x86_mov_reg_membase (s->code, lreg, lreg,
+ G_STRUCT_OFFSET (MonoVTable, interface_offsets), 4);
+ x86_mov_reg_membase (s->code, lreg, lreg, tree->right->data.m->klass->interface_id << 2, 4);
+ x86_call_virtual (s->code, lreg, tree->right->data.m->slot << 2);
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+}
+
+freg: CALL_R8 (this, VFUNC_ADDR) {
+ int lreg = tree->left->reg1;
+ int treg = X86_EAX;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (tree->left->op != MB_TERM_NOP) {
+ mono_assert (lreg >= 0);
+ x86_push_reg (s->code, lreg);
+ }
+
+ if (tree->data.ci.vtype_num) {
+ int offset = g_array_index (s->varinfo, MonoVarInfo, tree->data.ci.vtype_num).offset;
+ x86_lea_membase (s->code, treg, X86_EBP, offset);
+ x86_push_reg (s->code, treg);
+ }
+
+ x86_mov_reg_membase (s->code, lreg, lreg, 0, 4);
+ x86_call_virtual (s->code, lreg,
+ G_STRUCT_OFFSET (MonoVTable, vtable) + (tree->right->data.m->slot << 2));
+
+ if (tree->data.ci.args_size)
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, tree->data.ci.args_size);
+}
+
+stmt: RET (freg) {
+ if (!tree->last_instr) {
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_EPILOG, NULL);
+ x86_jump32 (s->code, 0);
+ }
+}
+
+# support for value types
+
+reg: LDIND_OBJ (reg) {
+ if (tree->left->reg1 != tree->reg1)
+ x86_mov_reg_reg (s->code, tree->reg1, tree->left->reg1, 4);
+}
+
+stmt: STIND_OBJ (reg, reg) {
+ mono_assert (tree->data.i > 0);
+ x86_push_imm (s->code, tree->data.i);
+ x86_push_reg (s->code, tree->right->reg1);
+ x86_push_reg (s->code, tree->left->reg1);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, MEMCOPY);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 12);
+}
+
+stmt: REMOTE_STIND_OBJ (reg, reg) {
+ guint8 *br[2];
+ int treg = X86_EAX;
+ int lreg = tree->left->reg1;
+ int rreg = tree->right->reg1;
+ int offset;
+
+ if (lreg == treg)
+ treg = X86_EDX;
+
+ if (rreg == treg)
+ treg = X86_ECX;
+
+ x86_mov_reg_membase (s->code, treg, lreg, 0, 4);
+ x86_alu_membase_imm (s->code, X86_CMP, treg, 0, ((int)mono_defaults.transparent_proxy_class));
+ br [0] = s->code; x86_branch8 (s->code, X86_CC_NE, 0, FALSE);
+
+ /* this is a transparent proxy - remote the call */
+
+ x86_push_reg (s->code, rreg);
+ x86_push_imm (s->code, tree->data.fi.field);
+ x86_push_imm (s->code, tree->data.fi.klass);
+ x86_push_reg (s->code, lreg);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, mono_store_remote_field);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 16);
+
+ br [1] = s->code; x86_jump8 (s->code, 0);
+
+ x86_patch (br [0], s->code);
+ offset = tree->data.fi.klass->valuetype ? tree->data.fi.field->offset - sizeof (MonoObject) :
+ tree->data.fi.field->offset;
+
+ x86_push_imm (s->code, mono_class_value_size (tree->data.fi.klass, NULL));
+ x86_push_reg (s->code, tree->right->reg1);
+ x86_alu_reg_imm (s->code, X86_ADD, tree->left->reg1, sizeof (MonoObject));
+ x86_push_reg (s->code, tree->left->reg1);
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, MEMCOPY);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 12);
+
+ x86_patch (br [1], s->code);
+
+ /* please test this first */
+ g_assert_not_reached ();
+}
+
+stmt: ARG_OBJ (coni4) {
+ x86_push_imm (s->code, tree->left->data.i);
+}
+
+stmt: ARG_OBJ (reg) {
+ int size = tree->data.i;
+ int sa;
+
+ mono_assert (size > 0);
+
+ sa = size + 3;
+ sa &= ~3;
+
+ /* reserve space for the argument */
+ x86_alu_reg_imm (s->code, X86_SUB, X86_ESP, sa);
+
+ x86_push_reg (s->code, X86_EAX);
+ x86_push_reg (s->code, X86_EDX);
+ x86_push_reg (s->code, X86_ECX);
+
+ x86_push_imm (s->code, size);
+ x86_push_reg (s->code, tree->left->reg1);
+ x86_lea_membase (s->code, X86_EAX, X86_ESP, 5*4);
+ x86_push_reg (s->code, X86_EAX);
+
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, MEMCOPY);
+ x86_call_code (s->code, 0);
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 12);
+
+ x86_pop_reg (s->code, X86_ECX);
+ x86_pop_reg (s->code, X86_EDX);
+ x86_pop_reg (s->code, X86_EAX);
+}
+
+stmt: RET_OBJ (reg) {
+ int size = tree->data.i;
+
+ x86_push_imm (s->code, size);
+ x86_push_reg (s->code, tree->left->reg1);
+ x86_push_membase (s->code, X86_EBP, 8);
+
+
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_ABS, MEMCOPY);
+ x86_call_code (s->code, 0);
+
+ x86_alu_reg_imm (s->code, X86_ADD, X86_ESP, 12);
+
+ if (!tree->last_instr) {
+ mono_add_jump_info (s, s->code + 1, MONO_JUMP_INFO_EPILOG, NULL);
+ x86_jump32 (s->code, 0);
+ }
+}
+
+%%
+
+#include "jit.h"
+
+gint64
+mono_llmult (gint64 a, gint64 b)
+{
+ return a * b;
+}
+
+guint64
+mono_llmult_ovf_un (gpointer *exc, guint32 al, guint32 ah, guint32 bl, guint32 bh)
+{
+ guint64 res, t1;
+
+ // fixme: this is incredible slow
+
+ if (ah && bh)
+ goto raise_exception;
+
+ res = (guint64)al * (guint64)bl;
+
+ t1 = (guint64)ah * (guint64)bl + (guint64)al * (guint64)bh;
+
+ if (t1 > 0xffffffff)
+ goto raise_exception;
+
+ res += ((guint64)t1) << 32;
+
+ *exc = NULL;
+ return res;
+
+ raise_exception:
+ *exc = mono_get_exception_overflow ();
+ return 0;
+}
+
+guint64
+mono_llmult_ovf (gpointer *exc, guint32 al, gint32 ah, guint32 bl, gint32 bh)
+{
+ gint64 res, t1;
+
+ // fixme: check for overflow
+
+ res = (gint64)al * (gint64)bl;
+
+ t1 = (gint64)ah * bl + al * (gint64)bh;
+
+ res += ((gint64)t1) << 32;
+
+ *exc = NULL;
+ return res;
+/*
+ raise_exception:
+ *exc = mono_get_exception_overflow ();
+ return 0;
+*/
+}
+
+gint64
+mono_lldiv (gint64 a, gint64 b)
+{
+ return a / b;
+}
+
+gint64
+mono_llrem (gint64 a, gint64 b)
+{
+ return a % b;
+}
+
+guint64
+mono_lldiv_un (guint64 a, guint64 b)
+{
+ return a / b;
+}
+
+guint64
+mono_llrem_un (guint64 a, guint64 b)
+{
+ return a % b;
+}
+
+MBTree *
+mono_ctree_new (MonoMemPool *mp, int op, MBTree *left, MBTree *right)
+{
+ MBTree *t = mono_mempool_alloc0 (mp, sizeof (MBTree));
+
+ t->op = op;
+ t->left = left;
+ t->right = right;
+ t->reg1 = -1;
+ t->reg2 = -1;
+ t->reg3 = -1;
+ t->svt = VAL_UNKNOWN;
+ t->cli_addr = -1;
+ return t;
+}
+
+MBTree *
+mono_ctree_new_leaf (MonoMemPool *mp, int op)
+{
+ return mono_ctree_new (mp, op, NULL, NULL);
+}
+
+gpointer
+arch_get_lmf_addr (void)
+{
+ gpointer *lmf;
+
+ if ((lmf = TlsGetValue (lmf_thread_id)))
+ return lmf;
+
+ lmf = g_malloc (sizeof (gpointer));
+ *lmf = NULL;
+
+ TlsSetValue (lmf_thread_id, lmf);
+
+ return lmf;
+}
+
+MonoArray*
+mono_array_new_wrapper (MonoClass *eclass, guint32 n)
+{
+ MonoDomain *domain = mono_domain_get ();
+
+ return mono_array_new (domain, eclass, n);
+}
+
+MonoObject *
+mono_object_new_wrapper (MonoClass *klass)
+{
+ MonoDomain *domain = mono_domain_get ();
+
+ return mono_object_new (domain, klass);
+}
+
+MonoString*
+mono_ldstr_wrapper (MonoImage *image, guint32 ind)
+{
+ MonoDomain *domain = mono_domain_get ();
+
+ return mono_ldstr (domain, image, ind);
+}
+
+gpointer
+mono_ldsflda (MonoClass *klass, int offset)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoVTable *vt;
+ gpointer addr;
+
+ vt = mono_class_vtable (domain, klass);
+ addr = (char*)(vt->data) + offset;
+
+ return addr;
+}
+
+#ifdef DEBUG
+void *
+MEMCOPY (void *dest, const void *src, size_t n)
+{
+ int i, l = n;
+
+ printf ("MEMCPY(%p to %p [%d]) ", src, dest, n);
+
+ for (i = 0; i < l; i++)
+ printf ("%02x ", *((guint8 *)src + i));
+ printf ("\n");
+
+ return memcpy (dest, src, n);
+}
+#endif
+
diff --git a/mono/metadata/.cvsignore b/mono/metadata/.cvsignore
new file mode 100644
index 00000000000..896769d89cf
--- /dev/null
+++ b/mono/metadata/.cvsignore
@@ -0,0 +1,5 @@
+Makefile
+Makefile.in
+pedump
+.libs
+.deps
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog
new file mode 100644
index 00000000000..829ce1bd77f
--- /dev/null
+++ b/mono/metadata/ChangeLog
@@ -0,0 +1,2163 @@
+2002-04-24 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * string-icalls.c : String does now passes unit tests without any
+ errors, the following changes has been made:
+
+ Implemented replace methods.
+ Renaming of methods to (try) follow the standard.
+ Fixed compare ordinal
+ Made all memory allocated directly to function instead of via icall function.
+ Small performance fix in is_in_array function
+
+ (2002-04-23) Changes from Duncan Mak <duncan@ximian.com>
+
+ c (mono_string_Internal_ctor_charp_int_int):
+ (mono_string_Internal_ctor_sbytep_int_int): Removed check for
+ sindex < 0, throw ArgumentOutOfRangeException instead of
+ ArgumentNullException.
+
+ Added new check for length == 0, however
+ I need to make it return String.Empty from the C code.
+
+ (mono_string_Internal_ctor_sbytep): Use mono_string_new, and let
+ that calculate the length for us here.
+
+ (mono_string_Internal_ctor_sbytep_int_int): Replaced
+ mono_string_new_utf16 with mono_string_new, since value is utf8.
+
+Wed Apr 24 18:43:29 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * object.c: register the object for finalization if needed.
+ Allocate one more char in the string for the terminating 0 char.
+
+Wed Apr 24 18:22:27 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c, class.h, image.c: check if a type implemenst a destructor.
+ Use the proper key for array class lookups.
+ * icall.c: register the icalls in the System.GC class.
+ * gc.c, gc.h: GC-related functions and icalls.
+
+2002-04-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * icall.c:
+ * socket-io.c:
+ * unicode.c: free some strings gotten from mono_string_to_utf8 and
+ changed a couple of free () by g_free ().
+
+ * decimal.c: one-liner in the comments for decimal2string ().
+
+2002-04-24 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * object.c (mono_runtime_invoke_array) : Bug because of my incompetence.
+
+2002-04-24 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * reflection.c (mono_reflection_get_custom_attrs) : fixed image bug (crash)
+ * object.c (mono_runtime_invoke_array) : handle null in params
+
+2002-04-23 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * string-icalls.c: fixed bug in split (one off bug)
+
+2002-04-23 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * string-icalls.c: fixed bug in remove and lastindexofany, add equals icall.
+ * icalls.c: added String::Equals as internal method
+
+2002-04-23 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * threads.c: fixed bug in the double interlocked functions
+
+2002-04-22 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * threads.c: implemented all of the new interlocked icalls.
+ * string-icalls.c: fix a bug in insert.
+ * icalls.c: added the icalls for interlocked, removed old string functions.
+
+Mon Apr 22 19:44:16 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * loader.c: fix off-by-one error when reading argument names.
+
+Mon Apr 22 19:28:14 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * profiler.c: win32 counter implementation (untested).
+ * icall.cs: win32 GetNow() and GetTimeZoneData() implementations
+ (the latter needs testing and more complete impl. from win32 folks).
+
+2002-04-21 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * object.c: mono_array_new_full workaround mono_array_class_get
+ problem.
+
+2002-04-17 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * string-icalls.c (mono_string_InternalRemove): Fixed overwrite bug.
+ * object.h (mono_string_chars): Changed casting type.
+
+2002-04-17 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * string-icalls.c: Fixed trim method, added the constructors done by Duncan, fixed
+ method signatures to use gunichar2 instead of gint16.
+
+2002-04-20 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * object.h, object.c: domain-specific versions of mono_object_new and
+ mono_array_new.
+
+2002-04-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * object.c: changed String layout
+
+ * string-icalls.c (mono_string_Internal_ctor_chara): added
+ internal string constructors.
+
+Sat Apr 20 13:33:07 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * threads.c: pass 'this' to the thread start routine.
+
+2002-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * string-icalls.c: fix IndexOf and LastIndexOf. Now
+ InternalCompareStr don't call twice mono_string_cmp_char for the last
+ character. Improved performance in mono_string_cmp_char.
+
+Fri Apr 19 19:26:28 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am, appdomain.c, class.c, object.c: split runtime-depended
+ code into its own library: libmonoruntime.
+
+2002-04-19 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * object.h, object.c: changed array format so that szarrays do not
+ require a bounds structure.
+ * icall.c, appdomain.c: support for new szarray format.
+
+Fri Apr 19 18:04:34 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c: compare also the retuns type when comparing signatures:
+ we didn't do this as an optimization since really overloaded methods
+ must differ also in the arguments, but this doesn't work with
+ low-level IL code (or when using explicit conversion operators: see
+ bug#23498 for an example).
+
+Fri Apr 19 16:14:52 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * loader.c: SZARRAY types can be saved as TYPESPEC, too.
+
+Thu Apr 18 17:15:09 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: make MonoType::GetElementType its own icall.
+
+Thu Apr 18 16:41:30 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: remove MonoMethod_get_Name().
+ * reflection.c, reflection.h, verify: cache the method name in the MonoMethod
+ object.
+
+2002-04-17 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * string-icalls.c: optimized a few methods.
+
+2002-04-17 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * icall.c: added all new string internal calls
+ * string-icalls.c: added, new string internal call implementation.
+ * object.c: added mono_string_new_size for allocating a string a size
+
+2002-04-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * object.c (mono_object_isinst): use the same code as in the
+ optimized x86 version.
+
+Wed Apr 17 14:14:36 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * profiler.c: TSC-based timer code (faster and more accurate).
+ Not hooked up in configure, yet (set USE_X86TSC to 1).
+
+Wed Apr 17 12:33:10 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * profiler.c, profiler.h: track time spent compiling methods.
+ * threads.c: track thread creation/destruction.
+
+Tue Apr 16 20:08:43 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * profiler.c, profiler.h, profiler-private.h: profiling interface
+ and sample implementation. Moved here so that it can be used also by
+ the jit.
+
+Tue Apr 16 12:58:12 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.c, reflection.h: keep types and other handles separate in
+ the hash tables for referred tokens. Add guid for modules.
+
+Mon Apr 15 11:37:33 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.c: fix bugs found with valgrind.
+ * metadata.h, metadata.c: added mono_metadata_guid_heap().
+
+2002-04-14 Patrik Torstensson <patrik.torstensson@labs2.com>
+
+ * threads: added icall support for getting current domain for
+ the thread.
+
+2002-04-13 Martin Baulig <martin@gnome.org>
+
+ * debug-symfile.h (MonoDebugLocalInfo): Renamed to MonoDebugVarInfo.
+ (MonoDebugVarInfo): Added `index' field for register based addresses.
+ (MONO_DEBUG_SYMBOL_FILE_VERSION): Increased to 9.
+ (MonoDebugMethodInfo): Replaced `guint32 *param_offsets' with
+ `MonoDebugVarInfo *params' and `guint32 this_offset' with
+ `MonoDebugVarInfo *this_var'.
+
+ * debug-symfile.c (relocate_variable): New static function to write
+ a location description for a local variable or method parameter.
+
+2002-04-12 Martin Baulig <martin@gnome.org>
+
+ * debug-symfile.h (MonoDebugLocalInfo): New type. This contains the
+ stack offset and begin/end scope address of a local variable.
+ (MonoDebugMethodInfo): Replaced `guint32 *local_offsets' with
+ 'MonoDebugLocalInfo *locals', added `prologue_end' and `epilogue_begin'.
+ (MONO_DEBUG_SYMBOL_FILE_VERSION): Increased to 8.
+
+ * debug-symfile.c (MRT_variable_start_scope, MRT_variable_end_scope):
+ Added new relocation types for start/end scope of a local variable.
+
+Fri Apr 12 18:30:29 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * object.h: add mono_object_domain() macro.
+ * reflection.c: handle typespecs.
+ * icall.c: MonoMethod::get_Name() implementation.
+
+Thu Apr 11 12:29Ni:14 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: String::GetHashCode() icall implementation.
+
+Wed Apr 10 21:16:56 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: String::IndexOfAny icall.
+ * object.c, object.h: make array->max_length more useful.
+ Intrduced mono_object_class() and mono_string_length() macros.
+
+2002-04-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * unicode.c (ves_icall_System_Char_IsNumber): use g_unichar_isxdigit
+ instead of g_unichar_isdigit.
+
+2002-04-11 Nick Drochak <ndrochak@gol.com>
+
+ * icall.c: Implement a simple Double.ToString().
+
+Tue Apr 9 21:31:16 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * appdomain.h: only io-layer.h is supposed to be included.
+ * icall.c: explicitly import environ. Fix warning.
+
+2002-04-10 Nick Drochak <ndrochak@gol.com>
+
+ * icall.c (ves_icall_System_CurrentTimeZone_GetTimeZoneData) :
+ return true even if it's not Daylight Savings time.
+ Only return false for the case where the function isn't
+ implemented for a plaform (read Windows).
+
+Tue Apr 9 13:05:56 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * appdomain.h, appdomain.c, class.c, object.c: protect MonoDomain
+ data with a mutex.
+
+2002-04-09 Dietmar Maurer <dietmar@ximian.com>
+
+ * mempool.c (mono_mempool_alloc): only use g_malloc when
+ absolutely necessary.
+
+2002-04-08 Dietmar Maurer <dietmar@ximian.com>
+
+ * mempool.c (MEM_ALIGN): hardcode MEM_ALIGN to 8
+
+ * class.c (mono_class_vtable): use domain mempool to allocate vtable
+ (mono_class_proxy_vtable): use domain mempool
+
+Mon Apr 8 17:17:04 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * appdomain.h, appdomain.c: split initialization that requires the
+ execution engine support into mono_runtime_init().
+
+2002-04-08 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_init): don't include vtable inside MonoClass
+ to save some memory, gather some statistics.
+ (mono_class_vtable): use g_malloc instead of GC_malloc when possible
+
+Sat Apr 6 20:07:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: internalcall implementation for ValueType.Equals().
+
+2002-04-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * object.c (mono_message_init): moved
+ (mono_runtime_exec_main): new arch. independent impl.
+ (mono_runtime_invoke_array): new method - like
+ mono_runtime_invoke, but you can pass an array of objects.
+ (mono_remoting_invoke): new arch. independent impl.
+ (mono_message_invoke): new arch. independent impl.
+ (mono_runtime_class_init): new arch. independent impl.
+ (mono_runtime_object_init): new arch. independent impl.
+
+Fri Apr 5 18:29:14 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c, object.c, reflection.c: documented the exported
+ functions.
+
+Fri Apr 5 15:42:31 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: simpler code to pass the assembly builder data to corlib.
+ Implement GetNestedTypes() internalcall.
+
+Thu Apr 4 21:46:48 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: warn if a type can't be loaded.
+
+2002-04-04 Dietmar Maurer <dietmar@ximian.com>
+
+ * image.h: typedef MonoImageOpenStatus
+ * types.h: removed unused file
+
+2002-04-04 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * icall.c: Enum_ToObject accepts enum value arguments.
+
+Thu Apr 4 11:35:37 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: move initialization of properties, events and nested
+ classes, so that they happen for interfaces, too.
+
+Wed Apr 3 20:03:32 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: cleanup some ugly casts in Array_SetValue*.
+
+Wed Apr 3 19:49:53 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: the values array fro enums is of the correct type, now.
+ Implement (correctly) getFullName instead of assQualifiedName for
+ MonoType.
+ * reflection.h, reflection.c: added mono_type_get_name ().
+
+Wed Apr 3 17:56:22 CEST 2002 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.c, image.h: for each MonoImage, record from wich assembly
+ it was loaded.
+ * reflection.h, icall.c: added System_Reflection_Assembly_GetTypes().
+ Make Type.Assembly work.
+
+2002-04-03 Dietmar Maurer <dietmar@ximian.com>
+
+ * debug-symfile.h: use char* instead of gpointer to avoid
+ unnecessary casts.
+
+ * appdomain.c (mono_jit_info_table_find): use char* instead of gpointer
+
+ * icall.c (ves_icall_InternalExecute): impl. FielSetter
+ (ves_icall_System_Array_SetValueImpl): removed strange MonoArray cast
+
+2002-03-30 Dietmar Maurer <dietmar@ximian.com>
+
+ * icall.c (mono_message_init): impl. (code cleanup)
+ (ves_icall_InternalExecute): impl. FieldGetter
+
+ * class.c (mono_class_init): added exerimental EXT_VTABLE_HACK, if
+ defined we call all (non-static)methods through the vtable.
+
+Fri Mar 29 18:09:08 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: it seems GC_debug_malloc() makes the Boehm GC call the
+ finalizer even though the memory is still referenced (and the chunk of
+ memory is not freed).
+
+Fri Mar 29 17:43:04 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.c: fix brokeness.
+
+Fri Mar 29 16:09:54 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: kill some warnings. Check explicit interface method
+ implementation also without considering the namespace.
+ Load also literal strings in static class data.
+
+2002-03-29 Miguel de Icaza <miguel@ximian.com>
+
+ * assembly.c (default_assembly_name_resolver): Kill memory leak.
+ (default_assembly_name_resolver): Make the resolver take the
+ "base" directory where the assembly was originally defined, so we
+ can load DLLs that are in the same directory as the assembly that
+ is being referenced.
+
+2002-03-28 Dick Porter <dick@ximian.com>
+
+ * file-io.h:
+ * file-io.c:
+ * socket-io.c:
+ * unicode.h:
+ * unicode.c: Warning cleanups
+
+Thu Mar 28 18:06:14 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * object.h, reflection.h: use the correct type instead of MonoObject.
+
+2002-03-28 Martin Baulig <martin@gnome.org>
+
+ * debug-symfile.c (mono_debug_class_get): Don't look in referenced assemblies.
+ (mono_debug_update_symbol_file): Initialize classes if necessary.
+
+Thu Mar 28 15:58:43 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.c, debug-helpers.c, image.c, image.h, metadata.c, pedump.c,
+ rawbuffer.c, reflection.c, verify.c: mare warning cleanups.
+
+Thu Mar 28 15:20:39 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.h: fix function prototype.
+ * metadata.h, metadata.c, object.h, private.h: get rid of warnings.
+ * mono-endian.h: use const cast.
+
+2002-03-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * icall.c (ves_icall_MonoMethodMessage_InitMessage): moved from message.c
+
+Thu Mar 28 12:32:00 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * loader.c: don't assert when a typeref can't be loaded, give
+ a chance to the runtime to trow an exception instead.
+ * loader.h: fix warning.
+
+2002-03-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_proxy_vtable): added proxy support
+
+2002-03-27 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * icall.c: removed last of PAL calls, added System.Environment
+ * file-io.h, file-io.c: MonoIO implementation
+ * object.h, object.c: mono_string_to_utf16() now returns gunichar2*
+
+Tue Mar 26 19:56:10 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * appdomain.c: do not use the byte marker in ldstr table lookup.
+ * debug-helpers.c: allow two ':' to separate class and method name.
+ * object.c: allocate arrays bounds with the GC, too.
+ * verify: add a few more checks.
+
+Tue Mar 26 18:45:46 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.c: output also literal strings. Allocate parameter data
+ with GC_malloc() (thanks, Martin, for catching this!).
+
+2002-03-26 Martin Baulig <martin@gnome.org>
+
+ * debug-symfile.h (MonoDebugMethodInfo): Added `this_offset', don't
+ include the `this' offset in the `param_offsets'.
+
+2002-03-25 Martin Baulig <martin@gnome.org>
+
+ * debug-symfile.c (mono_debug_update_symbol_file): Use a new
+ mono_debug_get_class() function to get the classes. Added new
+ relocation types for arrays and strings.
+ (mono_debug_get_class): New static function to search in all
+ referenced assemblies for a metadata token.
+
+ * debug-symfile.h (MONO_DEBUG_SYMBOL_FILE_VERSION): Increased to 7.
+
+Mon Mar 25 13:08:18 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.h, reflection.c: use a gc-safe hash for hash tables that
+ hold gc-allocated objects. Make the string heap a stream like the
+ others. Removed duplicated code when writing stream info.
+ Added asserts to catch possible buffer overflows. Set the sorted map
+ for tables that need sorting. Added some documentation.
+
+Mon Mar 25 13:04:56 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * appdomain.h, appdomain.c, class.c, object.c: use a GC-safe hash table
+ for interned strings and vtables.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * icall.c (ves_icall_Type_GetFields): Reverse the list before storing
+ it in the array since it was created with g_slist_prepend().
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * debug-symfile.c (mono_debug_local_type_from_signature): Renamed
+ to ves_icall_Debugger_MonoSymbolWriter_get_local_type_from_sig().
+ (mono_debug_method_from_token): Renamed to
+ ves_icall_Debugger_MonoSymbolWriter_method_from_token().
+ (ves_icall_Debugger_DwarfFileWriter_get_type_token): New interncall.
+
+ * debug-symfile.c (MRT_type_sizeof, MRT_type_field_offset): New
+ relocation types.
+
+ * debug-symfile.h (MONO_DEBUG_SYMBOL_FILE_VERSION): Increased to 6.
+
+2002-03-24 Martin Baulig <martin@gnome.org>
+
+ * debug-symfile.c (mono_debug_local_type_from_signature): New func.
+ (mono_debug_method_from_token): New func.
+
+ * icall.c (Mono.CSharp.Debugger.MonoSymbolWriter::get_local_type_from_sig):
+ New interncall, calls mono_debug_local_type_from_signature().
+ (Mono.CSharp.Debugger.MonoSymbolWriter::get_method): New interncall,
+ calls mono_debug_method_from_token().
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * unicode.c (ves_icall_iconv_get_char_count): The `count' argument
+ specifies the number of bytes to be converted, not the array size.
+ Return the number of chars, not the number of bytes.
+ (ves_icall_iconv_get_chars): The `byteCount' argument
+ specifies the number of bytes to be converted, not the array size.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * reflection.h (MonoReflectionSigHelper): New type.
+
+ * reflection.c (mono_reflection_sighelper_get_signature_local),
+ (mono_reflection_sighelper_get_signature_local): New functions.
+
+ * icall.c (System.Reflection.Emit.SignatureHelper::get_signature_local),
+ (System.Reflection.Emit.SignatureHelper::get_signature_field): New
+ interncalls.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * rawbuffer.c (mono_raw_buffer_load_mmap): Use MAP_SHARED when
+ is_writeable is set.
+ (mono_raw_buffer_update): New function to write the modified map
+ back to disk.
+
+ * debug-symfile.h (MonoDebugSymbolFile): Added `raw_contents_size'.
+
+ * debug-symfile.c (mono_debug_update_symbol_file): Call
+ mono_raw_buffer_update() when done writing.
+
+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * debug-symfile.h (MONO_DEBUG_SYMBOL_FILE_VERSION): Increased to 5.
+
+ * debug-symfile.c: Added support for arguments and local variables.
+
+2002-03-23 Dick Porter <dick@ximian.com>
+
+ * debug-symfile.c: Remove extraneous 'include <elf.h>' that wasn't
+ protected by ifdefs, hence breaking the w32 build.
+
+Thu Mar 21 17:35:01 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * object.c: implement is_interned() the right way.
+
+2002-03-21 Martin Baulig <martin@gnome.org>
+
+ * debug-symfile.[ch]: New files to handle debugging information
+ files. There's also support to dynamically update these symbol
+ files to include machine dependent information.
+
+2002-03-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * threads.c (mono_thread_create): new function to create thread
+ from C
+
+2002-03-20 Martin Baulig <martin@gnome.org>
+
+ * icall.c (ves_icall_InternalInvoke): Create a new object if the
+ method is a constructor.
+ (icall_map): Added "System.Reflection.MonoCMethod::InternalInvoke",
+ points to ves_icall_InternalInvoke().
+
+2002-03-20 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * file-io.c: Flush shouldn't throw exceptions.
+
+2002-03-19 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * file-io.c: FileStream flush support; FileSetLength now
+ restores file pointer.
+
+Tue Mar 19 18:17:21 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: set image for pointer classes.
+
+2002/03/19 Nick Drochak <ndrochak@gol.com>
+
+ * sysmath.c: Forgot one.
+
+2002-03-18 Miguel de Icaza <miguel@ximian.com>
+
+ * sysmath.c: Avoid redefining existing names.
+
+2002-03-18 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * sysmath.c, sysmath.h, icall.c, Makefile.am: math routines now
+ handled by runtime as icall rather than dllimport from libm.so
+ * file-io.c, file-io.h: fixed handle argument type.
+
+2002-03-18 Dick Porter <dick@ximian.com>
+
+ * reflection.c (mono_image_get_type_info): rename interface to
+ iface, because of "#define interface struct" on windows.
+
+Sat Mar 16 19:18:38 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c, class.h: rename and export mono_ptr_class_get().
+ * metadata.c: support MONO_TYPE_ARRAY in MonoType compare.
+ * reflection.c, reflection.h, icall.c: better/saner type name
+ parsing and MonoType creation. Handle MONO_TYPE_ARRAY in
+ method signatures.
+
+2002-03-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_init): removed hardcoded GHC_SLOT
+
+ * icall.c (ves_icall_InternalInvoke): impl.
+
+Wed Mar 13 00:27:30 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.c: output the interface map table, too.
+
+2002-03-12 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (class_compute_field_layout): separate computation of
+ static field layout
+
+2002-03-12 Dan Lewis <dihlewis@yahoo.co.uk>
+
+ * icall.c: added System.Buffer support.
+ * file-io.c: moved file icalls from PAL to FileStream.
+
+2002-03-12 Dietmar Maurer <dietmar@ximian.com>
+
+ * icall.c (ves_icall_System_Object_GetHashCode): impl.
+
+2002-03-11 Dietmar Maurer <dietmar@ximian.com>
+
+ * icall.c (ves_icall_System_ValueType_GetHashCode): impl.
+
+Mon Mar 11 14:45:42 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * verify.c, verify.h: moved here the corlib/runtime consistency checks.
+
+Mon Mar 11 11:12:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * debug-helpers.{c,h}: moved here from monograph some useful functions
+ to locate a method by name/signature in a class or image. Included
+ also a small and flexible IL disassembler.
+
+Fri Mar 8 16:29:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.c: fixup tokens in methods with small header size, too.
+
+2002-03-08 Dietmar Maurer <dietmar@ximian.com>
+
+ * object.c (mono_string_to_utf8): remove assert(!error), instead
+ print a warning.
+
+Thu Mar 7 18:55:15 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: update to the new mono_Array_class_get interface.
+
+Thu Mar 7 17:23:26 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * appdomain.c, object.c: Boehm-GC enable.
+ * icall.c: make get_data_chunk() support split data requests.
+ Ensure a class is initialized in more cases. Return only the first
+ property found in GetProperties() or the compiler gets confused.
+ Implemented GetEvents(). Temporary fix to GetType(), needs rewriting.
+ * reflection.h, reflection.c: add fixup mechanism for field and method
+ tokens. Initialize assembly->typeref in a single place. Output
+ properties after events. Support custom attributes for events, too.
+ Typo fix for paramter custom attrs.
+
+2002-03-07 Martin Baulig <martin@gnome.org>
+
+ * icall.c (ves_icall_System_Array_FastCopy): Small fix.
+
+2002-03-07 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_array_class_get): fix. for multi. dim. arrays
+
+2002-03-06 Martin Baulig <martin@gnome.org>
+
+ * icall.c (ves_icall_System_Array_CreateInstanceImpl): Make this work with
+ non-zero lower bounds. See testcases #F10-#F13.
+
+2002-03-05 Martin Baulig <martin@gnome.org>
+
+ * exception.c (mono_get_exception_argument_out_of_range): New exception.
+
+ * icall.c (ves_icall_System_Array_GetValue): Moved actual implementation to
+ ves_icall_System_Array_GetValue(), only calculate the absolute array position
+ here.
+ (ves_icall_System_Array_SetValue): Likewise.
+ (ves_icall_System_Array_GetValueImpl): New interncall. Takes an array position
+ as argument and does the actual work. This function is used when copying a
+ multi-dimensional array.
+ (ves_icall_System_Array_SetValueImpl): Almost completely rewrote this. It can
+ now do all the widening conversions of value types.
+ (ves_icall_System_Array_CreateInstanceImpl): Implemented.
+
+Tue Mar 5 18:14:01 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: remove some magic numbers and use the smbolic names,
+ instead. Added init_events() to load event info at class init time.
+ * metadata.h, metadata.c: added mono_metadata_events_from_typedef()
+ and mono_metadata_methods_from_event().
+ * reflection.h, reflection.c: added support for writing out the evnets
+ related information.
+
+Mon Mar 4 20:32:43 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.h, icall.c: use a different method (GetInterfaces)
+ to gather interface info and add isbyref, isprimitive and
+ ispointer to the ves_icall_get_type_info() return value.
+
+Mon Mar 4 11:22:26 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.h: stared adding support for events.
+ * icall.c: split find_members implementation. Added debug icall to get
+ the address of an object.
+ * reflection.c: handle TypeBuilders in mono_type_get_object().
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * icall.c (ves_icall_System_Array_GetLength): This must throw an
+ ArgumentOutOfRangeException(), not an ArgumentException().
+ (ves_icall_System_Array_GetLowerBound): Likewise.
+ (ves_icall_System_Array_GetValue): Improved argument checking.
+ (ves_icall_System_Array_SetValue): Improved argument checking.
+
+2002-03-01 Martin Baulig <martin@gnome.org>
+
+ * icall.c (ves_icall_System_Array_GetValue): Raise an exception when
+ called with invalid arguments rather than just dying with g_assert().
+ (ves_icall_System_Array_SetValue): Likewise.
+ (ves_icall_System_Array_CreateInstanceImpl): Don't g_assert_not_reached(),
+ raise a NotImplementedException instead.
+ (ves_icall_System_Array_GetLength): Added argument checking.
+ (ves_icall_System_Array_GetLowerBound): Added argument checking.
+
+2002-03-01 Dietmar Maurer <dietmar@ximian.com>
+
+ * object.h (mono_assert): new macros mono_assert and
+ mono_assert_not_reached
+
+2002-02-28 Martin Baulig <martin@gnome.org>
+
+ * icall.c: Rename "System::String::Intern" to "System::String::_Intern"
+ and "System::String::IsInterned" to "System::String::_IsInterned".
+
+Thu Feb 28 19:19:35 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: remove hacks for typebuilder. Added icall to create a
+ modified type from a tybebuilder.
+ * reflection.c: removed hacks for TypeBuilder. Create also a MonoImage
+ in mono_image_basic_init (). Added mono_reflection_setup_internal_class ()
+ to create a backing MonoClass for a TypeBuilder.
+
+Thu Feb 28 15:35:51 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c, class.h: more refactoring of class init.
+ Export mono_class_setup_mono_type() and mono_class_setup_parent().
+
+Thu Feb 28 12:33:41 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * marshal.c, marshal.h: start of marshaling interface.
+
+Wed Feb 27 22:15:17 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: fix order in assembly qualified name icall.
+
+Wed Feb 27 18:45:03 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: do not free str, since we store it in the hash table.
+ * reflection.h: add label field to MonoILExceptionInfo.
+ * reflection.c: handle references to more than one assembly. Handle
+ case when there isn't a module created in the assembly.
+
+Wed Feb 27 12:35:10 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: Fix typo. Start refactoring of class init code.
+
+Wed Feb 27 12:23:00 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * appdomain.c: exit with 1 on error.
+ * class.c: we already have the name in MonoClassField.
+ * image.c, image.h, metadata.c, pedump.c: use directly a pointer in
+ MonoStreamHeader instead of an offset of image->raw_metadata.
+
+2002-02-26 Miguel de Icaza <miguel@ximian.com>
+
+ * appdomain.c (mono_init): Be even more descriptive about the error.
+
+Tue Feb 26 16:18:07 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * appdomain.c: give the user an informative message when corlib can't
+ be loaded.
+
+2002-02-26 Martin Baulig <martin@gnome.org>
+
+ * icall.c (ves_icall_System_CurrentTimeZone_GetTimeZoneData):
+ New icall to get the time zone data.
+
+Mon Feb 25 15:51:51 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.c: set virtual and raw size of section correctly.
+ * threads.c: transfer domain information to newly created threads.
+
+Fri Feb 22 18:55:57 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: when instancing a class in a domain, load the default
+ vaules for static fields from the constant table. Fix System.Enum to
+ not be an enum.
+ * icall.c: implement Object::GetType() internalcall. Implemented
+ MonoField::GetValue() internalcall. Avoid SEGV in search_method().
+ Fixed checking of binding flags in find_members().
+ * metadata.c, metadata.h: introduce mono_metadata_type_hash().
+ * reflection.c: handle enumerations when writing to the constant
+ table. Use a different object cache for types.
+
+
+2002-02-22 Dietmar Maurer <dietmar@ximian.com>
+
+ * object.c (mono_object_isinst): fix for arrays
+
+ * icall.c (ves_icall_type_is_subtype_of): fix for 2 interfaces
+
+Thu Feb 21 21:00:13 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * object.c: don't use mprotect () and fix intern pool hash table
+ lookup for big endian systems.
+
+Thu Feb 21 19:30:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: change type_is_subtype_of () signature.
+
+2002-02-21 Mark Crichton <crichton@gimp.org>
+
+ * rand.c, rand.h: Added random number generator for
+ System.Security.Cryptography classes.
+
+ * exception.c, exception.h: Added mono_get_exception_not_implemeted.
+
+ * icall.c: Added System.Security.Cryptography calls.
+
+Thu Feb 21 16:45:34 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c, icall.c, metadata.c: better support for pointer types.
+ Create a class for them as suggested by dietmar. Fix TYPE_ARRAY class.
+ * reflection.c: Add support for getting custom attrs for properties
+ and simplify some code.
+
+Wed Feb 20 22:20:29 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: change getToken () and add custom attribute GetBlob()helper
+ method.
+ * reflection.h: add custom attrs array to the reflection builder structures.
+ * reflection.c: encode and emit custom attributes for all the relevant
+ reflection objects. Cache fieldref and methodref tokens. Change
+ mono_image_create_token() interface to take a MonoDynamicAssembly.
+ More complete custom attributes decoder. Load custom attributes for
+ Assembly, Field, Method and Constructor objects, too. Make the
+ returned array an Attribute[] one, not object[]. Added
+ mono_reflection_get_custom_attrs_blob() to encode the arguments of a
+ custom attribute constructor.
+
+2002-02-20 Dick Porter <dick@ximian.com>
+
+ * icall.c:
+ * rawbuffer.c:
+ * socket-io.c: Windows portability fixes (sometimes just ifdeffing
+ problem code out for now).
+
+2002-02-19 Radek Doulik <rodo@ximian.com>
+
+ * object.c (mono_ldstr): use hash table to avoid multiple swapping
+
+Tue Feb 19 20:23:11 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: register the GetCustomAttributes method.
+ * object.c, object.h: add mono_string_new_len ().
+ * reflection.h, reflection.c: added mono_runtime_invoke(),
+ mono_install_runtime_invoke(). Added
+ mono_reflection_get_custom_attrs () to load custom attributes and
+ create the attribute objects.
+
+2002-02-19 Dick Porter <dick@ximian.com>
+ * threads-dummy-types.c:
+ * threads-dummy-types.h:
+ * threads-dummy.c:
+ * threads-dummy.h:
+ * threads-pthread-types.c:
+ * threads-pthread-types.h:
+ * threads-pthread.c:
+ * threads-pthread.h: Deleted obsolete files
+
+2002-02-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_vtable): runtime init the class when we
+ allocate static class data.
+
+ * icall.c (ves_icall_System_Array_SetValue): check for null values.
+
+ * appdomain.c (mono_domain_transfer_object): impl. hack for Arrays
+ and String - but we will need generic marshalling support in the
+ future.
+ (mono_init): set the domain name in a ms compatible way
+
+ * object.c (mono_string_new_utf16): bug fix: use char[] instead of
+ String[].
+
+2002-02-18 Dietmar Maurer <dietmar@ximian.com>
+
+ * object.c (mono_array_clone): use alloca() instead of g_malloc
+ for sizes
+
+ * appdomain.c (mono_domain_unload): impl.
+
+Mon Feb 18 15:52:20 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * appdomain.c, object.c: fix intern pool implementation.
+ * class.c: fix alignment code.
+
+2002-02-16 Radek Doulik <rodo@ximian.com>
+
+ * icall.c (ves_icall_System_Enum_ToObject): in case of big endian
+ and s2 > s1, just copy lower bytes to be compatible with little
+ endian (i.e. 64bit value & 0xffffffff --> 32bit value)
+ (ves_icall_System_Enum_ToObject): and likewise for s1 > s2
+
+ * unicode.c (ves_icall_iconv_new_encoder): decide on big_endian,
+ force big_endian to be 1 for big endian machines
+ (ves_icall_iconv_new_decoder): ditto
+
+2002-02-16 Jeffrey Stedfast <fejj@ximian.com>
+
+ * socket-io.c (convert_sockopt_level_and_name): If the system
+ doesn't define SOL_IP or SOL_TCP, get them by hand using
+ getprotobyname() and caching the values (because this could be a
+ slow operation).
+ (ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal):
+ Use the appropriate struct when the system does support it. Ie,
+ not all systems have struct ip_mreqn so use struct ip_mreq when
+ appropriate.
+
+Fri Feb 15 18:15:44 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.c: handle finally clauses.
+
+Fri Feb 15 15:06:33 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * socket-io.c: use g_snprintf() instead of snprintf.
+
+2002-02-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * reflection.c (mono_param_get_objects): Cast second argument to
+ mono_method_get_param_names to a const char** to silence the
+ compiler warning.
+
+ * appdomain.c (mono_domain_assembly_open): Put parens around the
+ truth statement in the for-loop.
+
+ * unicode.c (iconv_convert): Got rid of a compiler warning about
+ int i being unused when the system has a new iconv.
+ (iconv_get_length): Same.
+
+ * image.c (load_class_names): Cast the second argument to
+ g_hash_table_insert() to char* to hush compiler warnings about the
+ arg being a const.
+ (mono_image_open): Same here.
+
+ * socket-io.c: Don't conditionally include sys/filio.h or
+ sys/sockio.h here anymore since we now get them from
+ io-layer/io-layer.h
+ (inet_pton): If the system doesn't support inet_aton, implement
+ using inet_addr and also #define INADDR_NONE if it isn't defined
+ by the system.
+
+Thu Feb 14 19:01:06 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c, metadata.h: added function to get packing and size info
+ of a typedef.
+ * reflection.h, reflection.c: handle field RVA data. Save info about
+ the table layout if needed. Assign typedef indexes to all the types
+ before dumping the info about them to avoid forward reference problems.
+
+2002-02-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * socket-io.c (convert_sockopt_level_and_name): ifdef
+ SO_ACCEPTCONN because it is not defined on my system (old debian)
+
+Thu Feb 14 11:49:30 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * opcode.c: use stddef.h to get NULL.
+
+2002-02-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * socket-io.c: conditionally include sys/filio.h and sys/sockio.h
+ for FIONBIO, FIONREAD and SIOCATMARK.
+ (ves_icall_System_Net_Dns_GetHostByAddr_internal): SunOS doesn't
+ define INADDR_NONE and besides, inet_addr() is deprecated and
+ should not be used. Use inet_pton() instead - it also has the
+ added bonus that it can easily handle IPv6 addresses as well.
+ (inet_pton): Implement using inet_aton() ifndef HAVE_INET_PTON.
+
+Wed Feb 13 23:00:21 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * decimal.c: remove _MSC_VER conditional.
+
+2002-02-13 Dick Porter <dick@ximian.com>
+
+ * socket-io.c:
+ * icall.c: Internal calls for Blocking, Select, Shutdown,
+ GetSocketOption and SetSocketOption
+
+Wed Feb 13 19:20:01 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.cs: better resolver: use it instead of some kludgy
+ code.
+
+Wed Feb 13 18:25:55 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.c: the best way to speed-up the compiler is to avoid
+ infinite loops.
+
+2002-02-13 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_vtable): changed the object layout
+ (obj->vtable->class).
+ (mono_class_create_from_typespec): consider MONO_TYPE_PTR
+
+Tue Feb 12 20:06:01 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.c: look for assemblies in the assembly dir, too.
+
+Tue Feb 12 14:03:42 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: fix thinko in mono_class_from_type().
+
+Mon Feb 11 19:43:51 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * exception.h, exception.c: added TypeLoadException.
+ * object.h, object.c: added mono_array_clone ().
+ * icall.c: handle throwOnError in AssemblyGetType().
+ Added Array.Clone().
+ * opcode.h, opcode.c: use a single value for the opcode val.
+ Compile fix for non-gcc compilers.
+
+Fri Feb 8 12:26:37 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * opcodes.c, opcodes.h: export interesting info about opcodes.
+
+2002-02-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * object.h (MONO_CHECK_ARG, MONO_CHECK_ARG_NULL): new macro for
+ icalls.
+
+ * class.c (class_compute_field_layout): set element_class for enums
+ (mono_class_create_from_typedef): set element_class for normal classes
+
+ * icall.c (ves_icall_System_Enum_get_value): impl.
+
+ * class.c (mono_class_create_from_typedef): do not set valuetype
+ flag for System.ValueType and System.Enum
+
+2002-02-04 Dietmar Maurer <dietmar@ximian.com>
+
+ * unicode.c (iconv_convert): fix big endian problem.
+
+Fri Feb 1 16:13:20 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: add asserts if we are ever going to scribble over memory.
+ * socket-io.c: not all systems have AF_IRDA defined.
+
+2002-01-31 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (class_compute_field_layout): do not consider static
+ fields to compute alignment
+
+2002-01-25 Dietmar Maurer <dietmar@ximian.com>
+
+ * appdomain.c (mono_appdomain_get): impl.
+ (ves_icall_System_AppDomain_ExecuteAssembly): impl.
+
+Thu Jan 24 12:59:23 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: ignore "file://" prefix when loading an assembly.
+
+2002-01-23 Dick Porter <dick@ximian.com>
+
+ * socket-io.c:
+ * icall.c:
+ * Makefile.am: Added socket support
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * icall.c (ves_icall_appdomain_get_default_assemblies): put this
+ code back. This should return the assemblies that are loaded by
+ the runtime on behalf of an application domain.
+
+ The current implementation is still broken, it just returns every
+ assembly loaded, but until we get real applications domain this
+ will do.
+
+2002-01-23 Dietmar Maurer <dietmar@ximian.com>
+
+ * icall.c (ves_icall_appdomain_get_cur_domain): runtime_init the
+ AppDomain object.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * icall.c (ves_icall_appdomain_get_cur_domain): Cache the value of
+ the mono_class_from_name lookup.
+ (ves_icall_get_parameter_info): ditto.
+ (ves_icall_appdomain_get_assemblies, add_assembly): Implement new internal
+ method.
+ (ves_icall_System_Reflection_Assembly_get_code_base): Another new call.
+
+Tue Jan 22 22:43:47 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: load also nested classes on class init.
+ System.ValueType instance methods gets passed boxed
+ values, unless methods in derived classed that get a pointer to the
+ data.
+ * icall.c: use better name parsing code in GetType().
+ * image.c, image.h: add mono_image_loaded ().
+ * metadata.c, metadata.h: add mono_metadata_nesting_typedef ().
+ * reflection.c, reflection.h: added mono_reflection_parse_type().
+
+2002-01-22 Veronica De Santis <veron78@interfree.it>
+
+ * icall.c : Added mapping of internal calls for Manual and Auto reset events
+ * threads.c : Added the implementation of internal calls for events
+ * threads.h : Added prototypes of internal calls for events
+
+2002-01-21 Radek Doulik <rodo@ximian.com>
+
+ * icall.c (ves_icall_InitializeArray): swap bytes on big endians
+
+2002-01-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_init): set min_align to 1 (instead of 0)
+ (mono_class_value_size): use min_align
+
+2002-01-20 Dick Porter <dick@ximian.com>
+
+ * threads.h:
+ * threads.c: Replaced all instances of WapiHandle * with HANDLE,
+ so it compiles on w32.
+
+2002-01-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * metadata.c (mono_type_stack_size): impl.
+
+ * class.c (mono_class_get_field): impl. memberref token
+
+2002-01-16 Veronica De Santis <veron78@@interfree.it>
+
+ * icall.h : Added the internal calls mapping for CreateMutex_internal
+ and ReleaseMutex_internal.
+ * threads.h : Added the prototype of mutexes internal calls.
+ * threads.c : Added the implementations of mutexes internal calls.
+
+Tue Jan 15 22:47:57 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * metaparse.h: removed unused file.
+ * reflection.c, reflection.h: added stream_data_align () function
+ to align data in streams and keep stream aligned. Add support for
+ exception support in method headers.
+
+Tue Jan 15 19:42:50 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * unicode.c: make iconv_convert () return the number of bytess written
+ in the output buffer.
+
+2002-01-15 Dick Porter <dick@ximian.com>
+ * threads.c: Make the runtime's idea of infinite timeouts coincide
+ with the class library's
+
+ Fix a particularly egregious bug in mono_thread_cleanup(). That
+ code was so utterly bogus it must have been written on a Monday.
+
+Mon Jan 14 17:01:03 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.h: add subtypes field to TypeBuilder.
+ * reflection.c: encode constants for literal fields.
+ Handle subtypes. Fix user string token (and add a zero byte)
+ at the end.
+
+2002-01-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_init): bug fix: assign slot numbers for
+ abstract methods.
+
+Fri Jan 11 18:54:42 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.c: don't try to output a code RVA for abstract methods.
+ Small fixes for method header format. Output parameter info to the
+ ParamDef table. Save method overriding info to MethodImpl table.
+ Fix property support. Allow typedef.extends to be a type in the
+ building assembly.
+ * verify.c: fix off-by-one error.
+
+Thu Jan 10 19:36:27 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: fix mono_class_from_mono_type () for szarray types.
+ Remove unused cache check in mono_class_from_type_spec().
+ * icall.c: *type_from_name () functions handle simple arrays and byref.
+ * reflection.c: handle byref and szarray types. Handle methods without
+ body (gets P/Invoke compilation working). Handle types and fields in
+ get_token ().
+ * reflection.h: add rank to MonoTypeInfo.
+
+2002-01-10 Dick Porter <dick@ximian.com>
+
+ * threads.c: Implemented WaitAll(), WaitAny() and WaitOne()
+ internal calls
+
+Wed Jan 9 19:27:13 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: initialize class in type_from_handle ().
+ Loop also in parent classes for get_method ().
+ * reflection.c: properly encode class and valuetype types.
+ Start on encoding TypeBuilder types. Handle fieldrefs.
+ Use correct length when registering a user string.
+ Handle ConstructorBuilder and MonoMethod in get_token ().
+ Make mono_type_get_object () aware of cached types.
+ * object.c: back out change to mono_string_new ().
+
+Tue Jan 8 22:47:44 EST 2002 Matt Kimball <matt@kimball.net>
+ * object.c: mono_string_new should return a NULL when the string
+ passed in is NULL -- not try to deference it.
+
+Sat Jan 5 15:48:04 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: hack to make IsSubType work for TypeBuilders.
+ * reflection.c: emit constructors before methods.
+ Retrieve param names in mono_param_get_objects().
+
+2002/01/05 Nick Drochak <ndrochak@gol.com>
+
+ * Makefile.am: fix list of headers and sources so automake 1.5
+ doesn't complain. Removed \# at end of list.
+
+Thu Jan 3 23:17:17 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * reflection.c: get token for a method ref. Set return type of
+ constructor to void.
+ * loader.c: debug message.
+ * class.c: typo fix.
+
+Mon Dec 24 17:18:10 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: fix array init with rank > 1. FindMembers
+ loops in parent class as well.
+ * image.c: do not insert nested types in name cache.
+ * reflection.c: warning fix.
+ * reflection.h: add override method (for interface impl).
+
+Mon Dec 24 16:16:56 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c: fix customattr decoding.
+
+2001-12-21 Miguel de Icaza <miguel@ximian.com>
+
+ * rawbuffer.cs: Added native Win32 implementation, avoids using
+ mmap on Cygwin. This patch is from Dan Lewis (dihlewis@yahoo.co.uk)
+
+Thu Dec 20 20:11:26 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: make the low-level routines handle the cache.
+
+Thu Dec 20 15:20:35 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * image.c: fopen (file, "rb") ("David Dawkins" <david@dawkins.st>).
+
+Tue Dec 18 18:50:00 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: fix mono_array_element_size() for objects.
+ * class.h, class.c: add properties to MonoClass and load them
+ at init time.
+ * icall.c: check with isinst() when assigning a value to an array
+ instead of requiring the classes to match exactly.
+ Implemented icall for System.Type::GetType().
+ Implemented icalls to get ParameterInfo, ProprtyInfo and info about
+ enums. Handle bindingflags when looking for methods and fields.
+ * metadata.h, metadata.c: implemented mono_metadata_properties_from_typedef()
+ and mono_metadata_methods_from_property().
+ * reflection.h, reflection.c: added structures for propreties,
+ parameters and enums. Implemented mono_property_get_object() and
+ mono_param_get_objects().
+
+2001-12-18 Dick Porter <dick@ximian.com>
+
+ * file-io.c: Use mono_string_to_utf16() instead of
+ mono_string_chars()
+
+ * object.c: Added mono_string_to_utf16(), which copies the non
+ NULL-terminated MonoString into a new double-null-terminated
+ buffer.
+
+2001-12-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * icall.c (ves_icall_System_DateTime_GetNow): added EPOCH adjustment
+
+2001-12-16 Dietmar Maurer <dietmar@ximian.com>
+
+ * file-io.c: raise exceptions if handle is invalid.
+
+Thu Dec 13 20:27:08 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.c: yet another check for mscorlib.
+ * class.c, class.h: load nesting info for classes.
+ * icall.c: many new functions to support the Reflection classes.
+ * metadata.c, metadata.h: mono_metadata_nested_in_typedef() added.
+ * reflection.h, reflection.c: mono_image_create_token(),
+ mono_assembly_get_object(), mono_type_get_object(),
+ mono_method_get_object(), mono_field_get_object(): methods to return
+ objects that parallel the C representation of assemblies, types,
+ methods, fields.
+
+2001-12-11 Dick Porter <dick@ximian.com>
+
+ * icall.c:
+ * file-io.c: Internal calls for file IO.
+
+Thu Dec 6 16:21:30 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * tabledefs.h: missing FileAttributes.
+ * verify.h, verify.c: use is_valid_string () to simplify and check for
+ valid strings more correctly. Fix warnings and speeling.
+ Check more tables: Filed, File, ModuleRef, StandAloneSig.
+ Check code: branches, maxstack, method calls.
+
+2001-12-04 Dietmar Maurer <dietmar@ximian.com>
+
+ * object.c (mono_object_allocate): removed static, so that the jit
+ can allocate value types.
+
+ * icall.c (ves_icall_System_DateTime_GetNow): impl.
+
+Mon Dec 3 17:02:01 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: init enum types right away and register the
+ token->MonoClass map in mono_class_create_from_typedef ().
+ * verify.h, verify.c: first cut of the verifier.
+ * pedump.c: add --verify switch to verify metadata tables.
+ * tabledefs.h: add some missing enums.
+
+2001-11-30 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_install_runtime_class_init): impl.
+ (mono_class_init): renamed mono_class_metadata_init to
+ mono_class_init, also removed the metadata_inited flag
+
+ * object.c (mono_object_isinst): use faster algorithm
+
+2001-11-30 Radek Doulik <rodo@ximian.com>
+
+ * mono-endian.h: reverted last change
+ added function prototypes
+
+ * Makefile.am (libmetadata_a_SOURCES): reverted my last change and
+ add mono-endian.c back
+
+ * mono-endian.c: returned back, as Paolo pointed out, it's needed
+ for unaligned access, I've mistaked it with endianess. I am
+ sorry.
+ (mono_read16): fix reverted endianess
+ (mono_read64): ditto
+ (mono_read32): ditto
+
+2001-11-30 Dick Porter <dick@ximian.com>
+
+ * exception.c: Implement mono_exception_from_name()
+
+Fri Nov 30 12:01:02 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.h, metadata.c: remove params_size and locals_size and their
+ calculation from the metadata code: they are only usefult to the
+ interp.
+
+2001-11-29 Radek Doulik <rodo@ximian.com>
+
+ * object.c (mono_ldstr): swap bytes here, it's probably not the
+ best place, but works for me now, I'll redo it once I know mono
+ better, also note that I add PROT_WRITE and don't reset back, also
+ note that it's only affects big endians, so x86 should be OK
+
+ * mono-endian.h (read16): use just glib macros for both endians
+
+ * mono-endian.c: removed as glib macros are used in in
+ mono-endian.h so we don't need to care about endianess for read
+ macros as glib does that for us already
+
+Thu Nov 29 18:20:58 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.h, class.h: take minimum alignment into consideration so
+ that the fields of a class remain aligned also when in an array.
+
+Tue Nov 27 16:39:01 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * loader.h, loader.c: add mono_method_get_param_names().
+ * class.c: 0-init class fields.
+
+2001-11-26 Dick Porter <dick@ximian.com>
+
+ * icall.c:
+ * threads-types.h:
+ * threads.c: New file that handles System.Threading on all platforms
+
+ * object.c:
+ * object.h: Remove the synchronisation struct from MonoObject,
+ replace it with a pointer that gets initialised on demand
+
+ * Makefile.am: Replace all the system-specific threading code with
+ a single file that uses the new wrapper library
+
+Mon Nov 19 11:37:14 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.c, class.h: add mono_install_trampoline() so that the runtime
+ can register a function to create a trampoline: removes the ugly
+ requirement that a runtime needed to export arch_create_jit_trampoline.
+ * object.h, object.c: added mono_install_handler() so that the runtime
+ can install an handler for exceptions generated in C code (with
+ mono_raise_exception()). Added C struct for System.Delegate.
+ * pedump.c: removed arch_create_jit_trampoline.
+ * reflection.c: some cleanups to allow registering user strings and
+ later getting a token for methodrefs and fieldrefs before the assembly
+ is built.
+ * row-indexes.h: updates and fixes from the new ECMA specs.
+
+Thu Nov 15 17:44:49 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.h, class.c: add enum_basetype field to MonoClass.
+ * metadata.h, metadata.c: add mono_metadata_get_constant_index()
+ to get index in the constant table reated to a field, param or
+ property.
+ * reflection.h, reflection.c: handle constructors. Set public-key and
+ version number of the built assembly to 0.
+ * row-indexes.h: update from new ECMA spec.
+
+Wed Nov 14 19:26:06 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.h, class.c: add a max_interface_id to MonoClass.
+ * icall.c: rename my_mono_new_object() to my_mono_new_mono_type()
+ since it's used to do that. Added mono_type_type_from_obj().
+ Make GetType() return NULL instead of segfaulting if the type was not
+ found. Handle simple arrays in assQualifiedName.
+ * object.h: add a struct to represent an Exception.
+ * reflection.c: output call convention in method signature.
+ Add code to support P/Invoke methods and fixed offsets for fields.
+
+Mon Nov 12 12:41:32 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * decimal.c, decimal.h: mono_double2decimal() get the sign bit from
+ the value.
+ * icall.c: use mono_array_addr instead of array->vector: fixes the
+ reflection image writing.
+ * reflection.c: init call convention byte to 0 in method signature.
+ Encode the property signature. Don't output property-related methods
+ twice. Really process the properties for a type (don't cast a field to
+ a property, my mom always told me that).
+ Fix 64 bit issues in pointer alignment in a different and more
+ readable way.
+
+2001-11-10 Sean MacIsaac <macisaac@ximian.com>
+
+ * loader.h: Removed type class from MonoDefaults, added monotype
+
+ * loader.c: Loaded MonoType, removed loading of Type
+
+ * icall.c (my_mono_new_object): Now returns a System.MonoType,
+ and fills in System.Type._impl with a RuntimeTypeHandle rather
+ than the actual MonoClass *
+
+ (ves_icall_type_from_handle): change from type_class to
+ monotype_class
+
+ (ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr):
+ implemented
+
+ (ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAuto):
+ implemented
+
+ (ves_icall_System_Reflection_Assembly_LoadFrom): implemented
+
+ (ves_icall_System_Reflection_Assembly_GetType): implemented
+
+ (ves_icall_System_MonoType_assQualifiedName): implemented
+
+ (ves_icall_System_PAL_OpSys_GetCurrentDirecotry): implemented
+
+2001-11-09 Miguel de Icaza <miguel@ximian.com>
+
+ * assembly.c (mono_assembly_open): Implement a cache for the
+ assemblies.
+
+ (mono_assembly_close): only destroy the assembly when the last
+ reference is gone.
+
+2001-11-09 Dick Porter <dick@ximian.com>
+
+ * Makefile.am (pedump_LDADD): Don't need THREAD_LIBS any more
+
+2001-11-09 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_metadata_init): bug fix: compute the right slot
+
+Fri Nov 9 15:48:02 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c, decimal.h, decimal.c: integrated decimal internalcalls
+ from Martin Weindel.
+ * object.h: add mono_string_chars ().
+
+2001-11-07 Miguel de Icaza <miguel@ximian.com>
+
+ * reflection.c (build_compressed_metadata): Eliminates warnings
+ and uses 64-bit clean code.
+
+ * metadata.c (mono_type_hash): Change signature to eliminate warnings.
+ (mono_type_equal): Change signature to eliminate warnings.
+
+Wed Nov 7 15:40:01 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c, loader.c: remove the internalcall array constructors.
+ Changes to match the new MonoArray structure.
+ * object.h, object.c: an array object doesn't allocate an extra
+ vector. Add mono_array_new_full () to create jagged arrays easily.
+
+Mon Nov 5 19:51:06 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.h, metadata.c: add mono_metadata_field_info () to
+ retreive all the info about a field from vairous tables.
+ * icall.c: implement S.Runtime.CServices::InitializeArray () icall.
+ * class.h, class.c: augment MonoClassField with more info.
+ Implemented mono_ldtoken for fields. Implemented ExplicitLayout
+ policy and load a field's RVA if needed.
+
+2001-11-05 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_metadata_init): create a trampoline for all
+ virtual functions instead of actually compiling them.
+
+Fri Nov 2 19:37:51 CET 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.h, class.c: include name in MonoClassField.
+ * class.c: fix fundamental type of System.Object and System.String.
+ Set the right fundamental type for SZARRAY, too. Handle TypeSpec
+ tokens in ldtoken.
+ * icall.c: remove internalcalls for the Reflection stuff that is now
+ done in C# code.
+ * loader.c: mono_field_from_memberref () implementation.
+ * mono-endian.c: thinko (s/struct/union/g).
+ * object.c, object.h: make the mono_string_* prototypes actually use
+ MonoString instead of MonoObject.
+ * reflection.c, reflection.h: updates for changes in the reflection
+ code in corlib: we use C structures that map to the actual C# classes.
+ Handle SZARRAYs when encoding types. Handle locals in methods. Use a
+ fat method header if needed and use the info from the ILGenerator for
+ methods. Handle fields in types. Misc fixes.
+
+2001-10-17 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_metadata_init): bug fix: always allocate
+ space for static class data
+
+2001-10-25 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_compute_relative_numbering): use relative
+ numbering to support fast runtime type checks.
+
+2001-10-17 Sean MacIsaac <macisaac@ximian.com>
+
+ * class.c (mono_class_create_from_typeref): added debugging output
+ to print class name when MonoDummy is returned instead of real class
+
+2001-10-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_metadata_init): interface offset table now
+ contains pointers into the vtable - this is more efficient for the jit
+
+2001-10-12 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_metadata_init): use a temporary vtable (the
+ old algorithm only worked for the interpreter, but not for the jit)
+
+2001-10-11 Dietmar Maurer <dietmar@ximian.com>
+
+ * loader.c (method_from_memberref): use mono_class_get to get the
+ class of an array instead of using System.Array directly.
+ (mono_get_method): also add MEMBERREF methods to the method cache
+ which usefull for arrays.
+
+2001-10-10 Dietmar Maurer <dietmar@ximian.com>
+
+ * pedump.c (arch_compile_method): added to compute vtable entry
+
+ * metadata.c (mono_metadata_interfaces_from_typedef): also return the
+ number of interfaces.
+
+ * class.h: merged MonoArrayClass into MonoClass
+
+ * class.c (mono_class_create_from_typedef): compute the vtable size and
+ allocate space to include the vtable inside MonoClass
+ (mono_class_metadata_init): initialize the vtable
+
+Mon Oct 8 16:12:38 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c, metadata.h: use MonoArrayType to describe the shape of an array.
+ Guard against calling bsearch with a NULL pointer (pointed out by Laurent Rioux, smoux).
+ * image.c: endian fixes by Laurent Rioux.
+ * object.h, object.c: rename MonoStringObject to MonoString and
+ MonoArrayObject to MonoArray. Change some function names to conform to
+ the style mono_<object>_<action>. mono_string_new_utf16 () takes a
+ guint16* as first argument, so don't use char*.
+ Provide macros to do the interesting things on arrays in a portable way.
+ * threads-pthread.c: updates for the API changes and #include <sched.h>
+ (required for sched_yield()).
+ * icall.c: updates for the API changes above.
+ * Makefile.am, mono-endian.c. mono-endian.h: include unaligned read routines for
+ platforms that need them.
+
+Mon Oct 8 10:43:23 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: set the correct type for all the fundamental
+ type when loading the class.
+
+2001-10-05 Dick Porter <dick@ximian.com>
+
+ * threads-pthread.c (pthread_mutex_timedlock): Simple
+ compatibility version for C libraries that lack this call.
+
+Thu Oct 4 19:10:30 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: MonoTypes stored in MonoClass are stored as
+ fundamental MonoTypes when the class represents a
+ fundamental type (System.Int32, ...).
+ The TypeHandle return by ldtoken is a MonoType*.
+ * icall.c: ves_icall_get_data_chunk () write out all the
+ PE/COFF stuff. Implement ves_icall_define_method (),
+ ves_icall_set_method_body (), ves_icall_type_from_handle ().
+ * image.c: properly skip unknown streams.
+ * loader.h, loader.c: add type_class to mono_defaults.
+ * metadata.c, metadata.h: export compute_size () as
+ mono_metadata_compute_size () with a better interface.
+ Typo and C&P fixes.
+ * pedump.c: don't try to print the entry point RVA if there is no entry point.
+ * reflection.c, reflection.h: many cleanups, fixes, output method
+ signatures and headers, typedef and typeref info, compress the metadata
+ tables, output all the heap streams, cli header etc.
+ * row-indexes.h: typo fixes.
+
+2001-10-04 Dick Porter <dick@ximian.com>
+
+ * object.h: Add a synchronisation mutex struct to MonoObject
+
+ * object.c (mono_new_object): Initialise the object
+ synchronisation mutexes
+
+ * icall.c: System.Threading.Monitor internal calls
+
+ * threads-pthread.h:
+ * threads-pthread.c: System.Threading.Monitor internal calls
+
+ * threads-types.h: New file, includes the system-specific thread
+ structures
+
+ * threads-pthread-types.h:
+ * threads-pthread-types.c: New files, handle pthread-specific
+ synchronisation types
+
+ * threads-dummy-types.h:
+ * threads-dummy-types.c: New files of dummy support for
+ thread-specific types
+
+ * metadata.c:
+ * image.c:
+ * pedump.c: include mono-endian.h not endian.h
+
+ * Makefile.am: More threads files.
+ Name mono-endian.h not endian.h
+
+Tue Oct 2 20:33:48 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am, reflection.h, reflection.c: move here the reflection related
+ stuff and implement a few more bits.
+ * icall.c: a field needs to be dereferenced twice. Do not use the same
+ name for two variables in the same scope.
+ * image.c, image.h: cleanups.
+
+2001-10-02 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_metadata_init): bug fix: compute the right size
+
+Mon Oct 1 20:43:57 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * icall.c: implemented some of the Reflection internalcalls.
+ * image.c, image.h: start writing out the PE/COFF image.
+ * metadata.h, metadata.c: implement mono_metadata_encode_value ()
+ that does the reverse than decode_blob_size ().
+ * object.c: use mono_metadata_encode_value (). Move here
+ temporary implementation of mono_string_to_utf8 ().
+ * rawbuffer.c: make malloc_map static.
+
+Fri Sep 28 19:26:30 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c: fix type comparison for arrays.
+ * loader.h, loader.c: half-assed fix to get more tests work in cygwin.
+ Added a couple of new classes to monodefaults.
+ * icall.c: added a couple of Reflection-related internalcalls.
+ * class.h, class.c: implemented mono_ldtoken () for RuntimeTypeHandles.
+ Added a byval_arg MonoType to MonoClass.
+
+2001-09-28 Dick Porter <dick@ximian.com>
+
+ * icall.c:
+ * threads-pthread.h:
+ * threads-pthread.c: Implemented internal calls for
+ LocalDataStoreSlot operations. Applied mutexes around all shared
+ data. Reworked the thread creation and Start() operations to
+ avoid a race condition.
+
+ * threads-dummy.h:
+ * threads-dummy.c: Dummy calls for the LocalDataStoreSlot operations
+
+Thu Sep 27 21:45:55 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * rawbuffer.c: disable mmap on cygwin since it seems to be broken there.
+
+Thu Sep 27 19:52:11 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.c, loader.c: warn and return NULL instead of erroring out.
+ * icall.c: added System.AppDomain::getCurDomain().
+ * loader.c: we don't need to lookup the typedef again for p/invoke calls.
+
+2001-09-25 Dick Porter <dick@ximian.com>
+
+ * threads-pthread.h:
+ * threads-pthread.c: Implemented timed thread joining and added
+ System.Threading.Thread::Join_internal internal call
+
+ * icall.c: Added System.Threading.Thread::Join_internal internal call
+
+ * threads-dummy.h:
+ * threads-dummy.c: Dummy calls for System.Thread.Thread::Join_internal
+
+Mon Sep 24 18:56:59 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * object.c, object.h: added mono_ldstr (), mono_string_is_interned () and
+ mono_string_intern () to implement the semantics of the ldstr opcode
+ and the interning of System.Strings.
+ * icall.c: provide hooks to make String::IsIntern and String::Intern
+ internalcalls.
+
+2001-09-23 Dick Porter <dick@ximian.com>
+
+ * threads-dummy.c:
+ * threads-dummy.h: New files of dummy threading routines
+
+ * Makefile.am (THREAD_SOURCE): Arrange to compile different thread
+ support code based on system specifics
+
+ Rename PTHREAD_LIBS to THREAD_LIBS
+
+2001-09-23 Dick Porter <dick@ximian.com>
+
+ * threads-pthread.c: Implement the System.Threading.Thread::Sleep,
+ Schedule (called when asked to Sleep for 0 ms) and CurrentThread
+ internal calls.
+ (mono_thread_init): Set up a Thread object instance to return when
+ the main thread calls Thread.CurrentThread
+ (mono_thread_cleanup): Wait for all subthreads to exit
+
+ * icall.c: New internal calls for System.Threading.Thread::Sleep
+ (including Schedule) and CurrentThread
+
+ * threads.h: New file, to insulate thread-specific stuff from the
+ rest of the code
+
+2001-09-21 Dick Porter <dick@ximian.com>
+
+ * threads-pthread.h:
+ * threads-pthread.c: New file, for handling pthreads-style
+ threading support. Start() now starts a new thread and executes
+ the ThreadStart delegate instance.
+
+ * icall.c: Added the internalcall for
+ System.Threading.Thread::Start_internal
+
+ * Makefile.am: Added new files, and PTHREADS_LIBS to the link line
+
+Thu Sep 20 19:37:39 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * loader.c: work around the different signatures for delegates
+ constructors csc generates in compiled code vs the ones compiled in mscorlib.
+
+Tue Sep 18 13:16:32 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.h, class.c: add mono_class_get_field_from_name ().
+ * *: Fix C comments and other ANSI C issues.
+
+Mon Sep 10 20:21:34 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * endian.h, assembly.c: fix some endianness issues.
+
+Fri Sep 7 18:40:40 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * loader.h, load.c: add delegate_class to mono_defaults.
+ Handle runtime provided methods in mono_get_method ().
+
+2001-08-29 Dietmar Maurer <dietmar@ximian.com>
+
+ * loader.c (mono_get_method): use pinvoke for internal call
+
+ * icall.c: use pinvoke for internal call
+
+ * loader.c (method_from_memberref): set the method name
+
+Wed Aug 29 12:43:41 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c: help the compiler generate better code for
+ mono_class_from_mono_type ().
+
+2001-08-28 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_metadata_init): delayed computing of the
+ class size to mono_class_metadata_init ()
+
+Tue Aug 28 15:47:15 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.c, class.h: add an interfaces member to MonoClass.
+ * image.c, image.h: add assembly_name field to MonoImage
+ from the assembly table.
+ * metadata.c, metadata.h: add mono_metadata_interfaces_from_typedef ().
+
+Mon Aug 27 20:12:01 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.c: Handle Array in mono_class_from_mono_type ().
+ * metadata.c, pedump.c: some endian fixes.
+
+Mon Aug 27 15:23:23 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.c, loader.c, loader.h: More types handled in mono_class_from_mono_type ().
+ * metadata.c: fix small problem introduced with the latest commit.
+
+Mon Aug 27 12:17:17 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * loader.c, metadata.c, metadata.h: Export mono_metadata_type_equal().
+ We don't need a MonoMetadata pointer anymore to compare signatures in
+ mono_metadata_signature_equal (), update callers.
+ Reduced memory usage an number of allocations for MonoMethodHeader and
+ MonoMethodSignature.
+
+Sun Aug 26 23:03:09 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c: added compare for szarray.
+
+Sun Aug 26 11:34:24 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.h, class.c, loader.h, loader.c: export mono_class_from_mono_type ()
+ and add a couple more types to it and mono_defaults. Give an hint on
+ classes that need implementing in our corlib and are referenced
+ in mscorlib.
+
+Sat Aug 25 12:52:54 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.h, class.c: keep track if a class is also an Enum.
+ * loader.c: Implement a couple more types for use in libffi
+ marshalling. Gives better diagnostics when failing to dlopen
+ a library. Set method->klass for P/Invoke methods, too.
+
+Fri Aug 24 19:30:25 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.c, class.h: add a MonoType this_arg to MonoClass that
+ represents a pointer to an object of the class' type that
+ can be used by the interpreter and later the type cache.
+ Add best guess alignment info for valuetype objects.
+
+Fri Aug 24 15:50:31 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.h, metadata.c, class.h, class.c: squeezed MonoParam
+ into MonoType: one less level of indirection and allocation and
+ simplifies quite a bit of code. Added cache for MonoTypes that are
+ used frequently, so that we don't need to allocate them all the time.
+
+2001-08-24 Dietmar Maurer <dietmar@ximian.com>
+
+ * class.c (mono_class_create_from_typedef): System.Enum is also a
+ value type, although it does not derive from System.ValueType
+ (maybe a bug in the ms compiler?)
+
+ * metadata.c (mono_type_size): return the right size for value types
+
+ * loader.c (mono_get_method): only initialize method header if not abstract
+
+ * class.c (mono_class_from_mono_type): use mono_default values.
+
+2001-08-23 Dietmar Maurer <dietmar@ximian.com>
+
+ * *: use MonoClass pointers instead of <type_tokens>
+
+ * class.h: new flag: metadata_inited.
+
+ * class.c (mono_class_metadata_init): impl.
+ (mono_class_instance_size): impl.
+ (mono_class_data_size): impl.
+
+Wed Aug 22 16:27:30 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c, loader.h, loader.c, image.h, image.c, class.h, class.c:
+ MonoClass now has the name and name_space fields.
+ MonoMethod has a pointer to its MonoClass, instead of MonoImage.
+ mono_get_method () takes and optional MonoClass as argument.
+ Removed mono_typedef_from_name() and added mono_class_token_from_name()
+ instead that takes advantage of a map from class names to typedef
+ tokens in MonoImage.
+
+Tue Aug 21 18:54:58 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c: zero is not a valid alignment boundary.
+ Merge MONO_TYPE_VOID in default decoding code.
+
+2001-08-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * image.h: merged MonoMetadata into MonoImage
+
+ * class.h: cleanup of MonoArrayClass, use a MonoClass pointer to
+ identify the type of elements.
+
+Mon Aug 20 19:39:00 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * blob.h: fix MONO_TYPE_TYPEDBYREF value.
+ * cil-coff.h: split MonoMSDOSHeader and add size info.
+ * image.c: add some consistency checks.
+ * metadata.c: fix row size computation: one programmer
+ error and one LAMESPEC. Handle MONO_TYPE_TYPEDBYREF.
+ add explanation for the locator routine.
+ Fix decoding of size in method header.
+
+2001-08-20 Miguel de Icaza <miguel@ximian.com>
+
+ * assembly.c (g_concat_dir_and_file): Use _S for string concat.
+ (g_concat_dir_and_file): Bring g_concat_dir_and_file
+ function from gnome-libs. This uses the right path separator
+ based on the OS, and also works around a bug in some systems where
+ a double slash is not allowed.
+ (default_assembly_name_resolver): Use g_concat_dir_and_file
+ (mono_assembly_open): ditto.
+
+2001-08-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * metadata.c (mono_metadata_signature_equal): impl.
+
+ * *: void is now a realy MonoType (instead of using NULL)
+
+ * metadata.c (do_mono_metadata_parse_type): use
+ mono_metadata_parse_type to parse void value.
+
+Sat Aug 18 12:51:28 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c, metadata.h: in the signature and method header store
+ only the space required for holding the loca vars and incoming arguments.
+
+2001-08-15 Dietmar Maurer <dietmar@ximian.com>
+
+ * metadata.c (do_mono_metadata_parse_type): treat void like any
+ other type (instead of assigning NULL);
+
+2001-08-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * metadata.c (mono_metadata_parse_mh): fixxed pinned/byref value
+
+2001-08-09 Dietmar Maurer <dietmar@ximian.com>
+
+ * image.c (do_mono_image_open): added a cache for arrays.
+
+Sat Aug 4 12:46:02 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.h, metadata.c: add mono_metadata_decode_row_col () to
+ decode a single column from a row in a metadata table and changes
+ to take advantage of it in the typedef locator (gives a nice speed up).
+ Store offset info for function params.
+
+2001-08-02 Dietmar Maurer <dietmar@ximian.com>
+
+ * image.h (MONO_IMAGE_IS_CORLIB): removed
+
+Wed Aug 1 22:54:08 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.c: how could mono_assembly_close () had ever worked?
+ * metadata.c, metadata.h: provide offset info for local vars.
+ Implement mono_type_size () to take care of alignment as well
+ as size (it was mono_field_type_size in cli/class.c before).
+
+2001-08-01 Dietmar Maurer <dietmar@ximian.com>
+
+ * image.h (MONO_IMAGE_IS_CORLIB): new macro to check root image
+
+ * assembly.h (CORLIB_NAME): set to corlib.dll
+
+ * assembly.c (mono_assembly_open): replaced strcmp() with !strcmp()
+
+Tue Jul 31 17:54:02 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.h, metadata.c, Makefile.am, private.h, assembly.c, blob.h,
+ cil-coff.h, image.c, image.h, pedump.c, rawbuffer.c, rawbuffer.h, row-indexes.h,
+ tokentype.h: massive namespace cleanup.
+
+Mon Jul 30 20:11:01 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.h, metadata.c: decode exception clauses when parsing method header.
+
+2001-07-27 Dietmar Maurer <dietmar@ximian.com>
+
+ * metadata.c (mono_metadata_free_type): added check for type !=
+ NULL (void) before calling mono_metadata_free_type()
+
+Thu Jul 26 19:11:19 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.h, row_indexes.h: added header with enumerations to use
+ to index in the columns from tables in metadata and to decode coded
+ tokens: we should start using this instead of embedding magic numbers
+ all over the code.
+
+Thu Jul 26 13:03:27 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.c, cil-coff.h, image.c, image.h, pedump.c, typedef.c:
+ Move metadata_t info from cli_image_info_t to MonoImage, where
+ it's easily accessible. Changed all the uses accordingly.
+ Added the method and class caches to MonoImage.
+ * metadata.c, metadata.h: Changed mono_metadata_decode_blob_size ()
+ and mono_metadata_decode_value () signature to be more consistent
+ with the other parse functions (and simplify code). Taken advantage
+ of zero-length array allocation with GCC. Removed reduntant (and
+ wrong) MonoFieldType struct and use MonoParam instead. Changed
+ mono_metadata_parse_field_type () to use common code for parsing.
+ Added mono_metadata_typedef_from_field () and
+ mono_metadata_typedef_from_method () to lookup a typedef index from a
+ field or method token.
+ Pack the MonoRetType structure more tightly (fits in 8 bytes now).
+
+2001-07-23 Miguel de Icaza <miguel@ximian.com>
+
+ * metadata.c (mono_metadata_parse_field_type): Implement.
+ (do_mono_metadata_parse_type): Split engine from
+ mono_metadata_parse_type, so that we can create smaller structures
+ for things that just have one pointer to the MonoType (look at
+ the MonoFieldType)
+
+2001-07-20 Miguel de Icaza <miguel@ximian.com>
+
+ * metadata.c (mono_metadata_parse_mh): Correct the implementation,
+ as Jan Gray found out, it is incorrect.
+
+2001-07-18 Miguel de Icaza <miguel@ximian.com>
+
+ * assembly.c: Implement asssembly loading. This loads an image
+ and loads all the referenced assemblies. Come to think of it, we
+ could always do lazy loading of the assemblies.
+
+ * image.c (mono_image_open): Keep loaded images in a hashtable.
+
+ * image.h (MonoImage): Add reference count.
+
+2001-07-17 Miguel de Icaza <miguel@ximian.com>
+
+ * assembly.c (mono_assembly_open): Keep track of the file name in
+ case the assembly has no ASSEMBLY table.
+
+ * metadata.h: Fixed Paolo's quick hack. Put the documnentation
+ from get.c here.
+
+Sun Jul 15 19:39:06 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.c, metadata.h: decode local vars in method header
+ parse function. Change callers accordingly.
+
+Sun Jul 15 17:40:47 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metadata.h, cil-coff.h: protect against multiple inclusion.
+ Added some new structures to hold information decoded from metadata:
+ MonoType, MonoParam, MonoArray, MonoMethod, MonoMethodSignature
+ and relevant decoding/free functions.
+ * metadata.c: implement decoding functions. Add warning for out of bounds
+ index in mono_metadata_locate(). Implement mono_get_method () to retreive
+ all the info about a method signature and invocation. Remove check on
+ uninitialized local var in parse_mh() and fix memory leak.
+
+2001-07-12 Miguel de Icaza <miguel@ximian.com>
+
+ * metadata.h: More macros.
+
+ * tokentype.h: New file.
+
+Fri Jul 6 11:30:53 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.c: added a consistency check and initialize
+ some structures with g_new0().
+ * metadata.c: fixed a couple more bugs in table size computation
+ and add other checks for out-of bound access to metadata.
+
+Thu Jul 5 22:34:21 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * metatada.c: fix bugs computing table sizes. Spew a
+ warning when index in string heap is out of bounds.
+
+2001-07-04 Miguel de Icaza <miguel@ximian.com>
+
+ * metadata.h: Add a couple of macros to manipulate tokens.
+
+Tue Jul 3 18:33:32 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * assembly.c: g_free(ii->cli_sections) (and avoid double free of
+ cli_section_tables).
+
+2001-07-01 Miguel de Icaza <miguel@ximian.com>
+
+ * metadata.c (mono_metadata_user_string): New function, provides
+ access to the UserString heap.
+
+2001-06-27 Miguel de Icaza <miguel@ximian.com>
+
+ * metadata.c: Add inline documentation.
+
+2001-06-26 Miguel de Icaza <miguel@ximian.com>
+
+ * propertyattr.h, paramattr.h, methodsem.h, methodattr.h: New
+ files.
+
+2001-06-22 Miguel de Icaza <miguel@ximian.com>
+
+ * typeattr.h: New file, TypeAttribute flags.
+
+2001-06-21 Miguel de Icaza <miguel@ximian.com>
+
+ * mono/metadata/assembly.c (mono_assembly_ensure_section_idx,
+ mono_assembly_ensure_section): Section loading code.
+ (load_section_tables): Load the sections.
+
+ * mono/metadata/metadata.c (mono_metadata_locate_token,
+ mono_metadata_locate): Functions to locate the information
+ definition given a token or a table and an index.
+ (mono_metadata_compute_table_bases): New.
+ (compute_size): New function to compute the sizes of the various
+ tables.
+
+ * mono/metadata/metadata.h: Finish listing the different index
+ types.
+
+ * mono/metadata/pedump.c: Improve to dump new information.
+
+2001-06-19 Miguel de Icaza <miguel@ximian.com>
+
+ * mono/metadata/metadata.c: Entered all the tables matching
+ Beta2.
+
+ * mono/metadata/assembly.c (load_metadata_ptrs): Fix for Beta2
+
diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am
index 505141d5abc..f8e105aa06c 100644
--- a/mono/metadata/Makefile.am
+++ b/mono/metadata/Makefile.am
@@ -1,19 +1,96 @@
noinst_PROGRAMS = pedump
-lib_LIBRARIES = libmetadata.a
+lib_LIBRARIES = libmetadata.a libmonoruntime.a
-INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)
+#
+# Keep in sync with mono/runtime/Makefile.am
+#
+assembliesdir = $(libdir)
+
+INCLUDES = $(GLIB_CFLAGS) $(GMODULE_CFLAGS) -I$(top_srcdir) -I$(top_srcdir)/mono \
+ -DMONO_ASSEMBLIES=\""$(assembliesdir)"\"
+
+libmonoruntime_a_SOURCES = \
+ reflection.c \
+ object.c \
+ icall.c \
+ decimal.c \
+ decimal.h \
+ gc.c \
+ gc.h \
+ marshal.c \
+ marshal.h \
+ threads.c \
+ threads.h \
+ threads-types.h \
+ file-io.c \
+ file-io.h \
+ socket-io.c \
+ socket-io.h \
+ exception.c \
+ exception.h \
+ unicode.c \
+ unicode.h \
+ appdomain.h \
+ appdomain.c \
+ debug-helpers.h \
+ debug-helpers.c \
+ debug-symfile.h \
+ debug-symfile.c \
+ profiler.c \
+ profiler-private.h \
+ rand.h \
+ rand.c \
+ string-icalls.c \
+ string-icalls.h \
+ sysmath.h \
+ sysmath.c
libmetadata_a_SOURCES = \
- assembly.h \
assembly.c \
- cil-coff.h \
+ domain.c \
+ opcodes.c \
+ image.c \
metadata.c \
- metadata.h \
+ verify.c \
+ mono-endian.c \
+ private.h \
rawbuffer.c \
- rawbuffer.h
+ loader.c \
+ class.c \
+ mempool.h \
+ mempool.c \
+ debug-helpers.h \
+ debug-helpers.c
+
+libmetadataincludedir = $(includedir)/mono/metadata
+libmonoruntimeincludedir = $(includedir)/mono/metadata
+
+libmetadatainclude_HEADERS = \
+ assembly.h \
+ opcodes.h \
+ blob.h \
+ cil-coff.h \
+ mono-endian.h \
+ image.h \
+ metadata.h \
+ verify.h \
+ rawbuffer.h \
+ reflection.h \
+ row-indexes.h \
+ tabledefs.h \
+ tokentype.h \
+ loader.h \
+ class.h \
+ object.h \
+ exception.h \
+ profiler.h \
+ appdomain.h \
+ rand.h
pedump_SOURCES = \
pedump.c $(libmetadata_a_SOURCES)
-pedump_LDADD = $(GLIB_LIBS)
+pedump_LDADD = ../io-layer/libwapi.a ../utils/libmonoutils.a $(GLIB_LIBS) $(GMODULE_LIBS) -lm
+
+
diff --git a/mono/metadata/TODO b/mono/metadata/TODO
new file mode 100644
index 00000000000..98c3ce7b7d3
--- /dev/null
+++ b/mono/metadata/TODO
@@ -0,0 +1,15 @@
+
+* mono_class_from_name
+
+ In many places we call mono_class_from_name with static values,
+ we should cache that instead:
+
+ static MonoClass *klass;
+
+ if (!klass){
+ klass = mono_class_from_name (...);
+ }
+
+* Uniform names
+
+ We have a mess of names in the icall.c file, we need to sort that out.
diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c
new file mode 100644
index 00000000000..83836704c4d
--- /dev/null
+++ b/mono/metadata/appdomain.c
@@ -0,0 +1,351 @@
+/*
+ * appdomain.c: AppDomain functions
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#endif
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/assembly.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/cil-coff.h>
+
+/*
+ * mono_runtime_init:
+ * @domain: domain returned by mono_init ()
+ *
+ * Initialize the core AppDomain: this function will run also some
+ * IL initialization code, so it needs the execution engine to be fully
+ * operational.
+ */
+void
+mono_runtime_init (MonoDomain *domain)
+{
+ MonoAppDomainSetup *setup;
+ MonoAppDomain *ad;
+ MonoClass *class;
+
+ class = mono_class_from_name (mono_defaults.corlib, "System", "AppDomainSetup");
+ setup = (MonoAppDomainSetup *) mono_object_new (domain, class);
+ ves_icall_System_AppDomainSetup_InitAppDomainSetup (setup);
+
+ class = mono_class_from_name (mono_defaults.corlib, "System", "AppDomain");
+ ad = (MonoAppDomain *) mono_object_new (domain, class);
+ ad->data = domain;
+ domain->domain = ad;
+ domain->setup = setup;
+
+ return;
+}
+
+void
+ves_icall_System_AppDomainSetup_InitAppDomainSetup (MonoAppDomainSetup *setup)
+{
+ // fixme: implement me
+}
+
+/**
+ * mono_domain_transfer_object:
+ * @src: the source domain
+ * @dst: the destination domain
+ * @obj: the object to transfer
+ *
+ * This function is used to transfer objects between domains. This is done by
+ * marshalling or serialisation.
+ */
+static MonoObject *
+mono_domain_transfer_object (MonoDomain *src, MonoDomain *dst, MonoObject *obj)
+{
+ MonoClass *klass;
+ MonoObject *res;
+
+ if (!obj)
+ return NULL;
+
+ g_assert (obj->vtable->domain == src);
+
+ /* fixme: transfer an object from one domain into another */
+
+ klass = obj->vtable->klass;
+
+ if (MONO_CLASS_IS_ARRAY (klass)) {
+ MonoArray *ao = (MonoArray *)obj;
+ int esize, ecount, i;
+ guint32 *sizes;
+
+ esize = mono_array_element_size (klass);
+ if (ao->bounds == NULL) {
+ ecount = mono_array_length (ao);
+ res = (MonoObject *)mono_array_new_full (dst, klass, &ecount, NULL);
+ }
+ else {
+ sizes = alloca (klass->rank * sizeof(guint32) * 2);
+ ecount = 1;
+ for (i = 0; i < klass->rank; ++i) {
+ sizes [i] = ao->bounds [i].length;
+ ecount *= ao->bounds [i].length;
+ sizes [i + klass->rank] = ao->bounds [i].lower_bound;
+ }
+ res = (MonoObject *)mono_array_new_full (dst, klass, sizes, sizes + klass->rank);
+ }
+ if (klass->element_class->valuetype) {
+ memcpy (res, (char *)ao + sizeof(MonoArray), esize * ecount);
+ } else {
+ g_assert (esize == sizeof (gpointer));
+ for (i = 0; i < ecount; i++) {
+ int offset = sizeof (MonoArray) + esize * i;
+ gpointer *src_ea = (gpointer *)((char *)ao + offset);
+ gpointer *dst_ea = (gpointer *)((char *)res + offset);
+
+ *dst_ea = mono_domain_transfer_object (src, dst, *src_ea);
+ }
+ }
+ } else if (klass == mono_defaults.string_class) {
+ MonoString *str = (MonoString *)obj;
+ res = (MonoObject *)mono_string_new_utf16 (dst,
+ (const guint16 *)mono_string_chars (str), str->length);
+ } else {
+ // fixme: we need generic marshalling code here */
+ g_assert_not_reached ();
+ }
+
+ return res;
+}
+
+MonoObject *
+ves_icall_System_AppDomain_GetData (MonoAppDomain *ad, MonoString *name)
+{
+ MonoDomain *add = ad->data;
+ MonoDomain *cur = mono_domain_get ();
+ MonoObject *o;
+ char *str;
+
+ g_assert (ad != NULL);
+ g_assert (name != NULL);
+
+ str = mono_string_to_utf8 (name);
+
+ mono_domain_lock (add);
+ if (!strcmp (str, "APPBASE"))
+ o = (MonoObject *)add->setup->application_base;
+ else if (!strcmp (str, "APP_CONFIG_FILE"))
+ o = (MonoObject *)add->setup->configuration_file;
+ else if (!strcmp (str, "DYNAMIC_BASE"))
+ o = (MonoObject *)add->setup->dynamic_base;
+ else if (!strcmp (str, "APP_NAME"))
+ o = (MonoObject *)add->setup->application_name;
+ else if (!strcmp (str, "CACHE_BASE"))
+ o = (MonoObject *)add->setup->cache_path;
+ else if (!strcmp (str, "PRIVATE_BINPATH"))
+ o = (MonoObject *)add->setup->private_bin_path;
+ else if (!strcmp (str, "BINPATH_PROBE_ONLY"))
+ o = (MonoObject *)add->setup->private_bin_path_probe;
+ else if (!strcmp (str, "SHADOW_COPY_DIRS"))
+ o = (MonoObject *)add->setup->shadow_copy_directories;
+ else if (!strcmp (str, "FORCE_CACHE_INSTALL"))
+ o = (MonoObject *)add->setup->shadow_copy_files;
+ else
+ o = g_hash_table_lookup (add->env, str);
+
+ mono_domain_unlock (add);
+ g_free (str);
+
+ if (!o)
+ return NULL;
+
+ return mono_domain_transfer_object (add, cur, o);
+}
+
+void
+ves_icall_System_AppDomain_SetData (MonoAppDomain *ad, MonoString *name, MonoObject *data)
+{
+ MonoDomain *add = ad->data;
+ MonoDomain *cur = mono_domain_get ();
+ MonoObject *o;
+ char *str;
+
+ g_assert (ad != NULL);
+ g_assert (name != NULL);
+
+ o = mono_domain_transfer_object (cur, add, data);
+
+ /* fixme: need a hash func for MonoString */
+ str = mono_string_to_utf8 (name);
+ mono_domain_lock (add);
+ g_hash_table_insert (add->env, str, o);
+ mono_domain_unlock (add);
+ g_free (str);
+}
+
+MonoAppDomainSetup *
+ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad)
+{
+ g_assert (ad != NULL);
+ g_assert (ad->data != NULL);
+
+ return ad->data->setup;
+}
+
+MonoString *
+ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad)
+{
+ g_assert (ad != NULL);
+ g_assert (ad->data != NULL);
+
+ return mono_string_new (ad->data, ad->data->friendly_name);
+}
+
+MonoAppDomain *
+ves_icall_System_AppDomain_getCurDomain ()
+{
+ MonoDomain *add = mono_domain_get ();
+ return add->domain;
+}
+
+MonoAppDomain *
+ves_icall_System_AppDomain_createDomain (MonoString *friendly_name, MonoAppDomainSetup *setup)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoClass *adclass;
+ MonoAppDomain *ad;
+ MonoDomain *data;
+
+ adclass = mono_class_from_name (mono_defaults.corlib, "System", "AppDomain");
+
+ // fixme: pin all those objects
+ ad = (MonoAppDomain *) mono_object_new (domain, adclass);
+ ad->data = data = mono_domain_create ();
+ data->domain = ad;
+ data->setup = setup;
+ data->friendly_name = mono_string_to_utf8 (friendly_name);
+
+ // fixme: what to do next ?
+
+ return ad;
+}
+
+typedef struct {
+ MonoArray *res;
+ MonoDomain *domain;
+ int idx;
+} add_assembly_helper_t;
+
+static void
+add_assembly (gpointer key, gpointer value, gpointer user_data)
+{
+ add_assembly_helper_t *ah = (add_assembly_helper_t *) user_data;
+
+ mono_array_set (ah->res, gpointer, ah->idx++, mono_assembly_get_object (ah->domain, value));
+}
+
+MonoArray *
+ves_icall_System_AppDomain_GetAssemblies (MonoAppDomain *ad)
+{
+ MonoDomain *domain = ad->data;
+ static MonoClass *System_Reflection_Assembly;
+ MonoArray *res;
+ add_assembly_helper_t ah;
+
+ if (!System_Reflection_Assembly)
+ System_Reflection_Assembly = mono_class_from_name (
+ mono_defaults.corlib, "System.Reflection", "Assembly");
+
+ res = mono_array_new (domain, System_Reflection_Assembly, g_hash_table_size (domain->assemblies));
+
+ ah.domain = domain;
+ ah.res = res;
+ ah.idx = 0;
+ mono_domain_lock (domain);
+ g_hash_table_foreach (domain->assemblies, add_assembly, &ah);
+ mono_domain_unlock (domain);
+
+ return res;
+}
+
+
+MonoReflectionAssembly *
+ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad, MonoReflectionAssemblyName *assRef, MonoObject *evidence)
+{
+ MonoDomain *domain = ad->data;
+ char *name, *filename;
+ MonoImageOpenStatus status = MONO_IMAGE_OK;
+ MonoAssembly *ass;
+
+ /* FIXME : examine evidence? */
+
+ g_assert (assRef != NULL);
+ g_assert (assRef->name != NULL);
+
+ /* FIXME : examine version, culture info */
+
+ name = filename = mono_string_to_utf8 (assRef->name);
+
+ if (strncmp (filename, "file://", 7) == 0)
+ filename += 7;
+
+ ass = mono_assembly_open (filename, NULL, &status);
+
+ g_free (name);
+
+ if (!ass)
+ mono_raise_exception ((MonoException *)mono_exception_from_name (mono_defaults.corlib, "System.IO", "FileNotFoundException"));
+
+ return mono_assembly_get_object (domain, ass);
+}
+
+void
+ves_icall_System_AppDomain_Unload (MonoAppDomain *ad)
+{
+ mono_domain_unload (ad->data, FALSE);
+}
+
+gint32
+ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomain *ad, MonoString *file,
+ MonoObject *evidence, MonoArray *args)
+{
+ MonoDomain *cdom = mono_domain_get ();
+ MonoAssembly *assembly;
+ MonoImage *image;
+ MonoCLIImageInfo *iinfo;
+ MonoMethod *method;
+ MonoObject *margs;
+ char *filename;
+ gint32 res;
+
+ mono_domain_set (ad->data);
+
+ filename = mono_string_to_utf8 (file);
+ assembly = mono_assembly_open (filename, NULL, NULL);
+ g_free (filename);
+
+ if (!assembly) {
+ mono_raise_exception ((MonoException *)mono_exception_from_name (
+ mono_defaults.corlib, "System.IO", "FileNotFoundException"));
+ }
+
+ image = assembly->image;
+ iinfo = image->image_info;
+ method = mono_get_method (image, iinfo->cli_cli_header.ch_entry_point, NULL);
+
+ if (!method)
+ g_error ("No entry point method found in %s", image->name);
+
+ margs = mono_domain_transfer_object (cdom, ad->data, (MonoObject *)args);
+ res = mono_runtime_exec_main (method, (MonoArray *)margs);
+
+ mono_domain_set (cdom);
+
+ return res;
+}
+
diff --git a/mono/metadata/appdomain.h b/mono/metadata/appdomain.h
new file mode 100644
index 00000000000..0521857919e
--- /dev/null
+++ b/mono/metadata/appdomain.h
@@ -0,0 +1,155 @@
+/*
+ * appdomain.h: AppDomain functions
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#ifndef _MONO_METADATA_APPDOMAIN_H_
+#define _MONO_METADATA_APPDOMAIN_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/reflection.h>
+#include <mono/metadata/mempool.h>
+#include <mono/utils/mono-hash.h>
+#include <mono/io-layer/io-layer.h>
+
+/* This is a copy of System.AppDomainSetup */
+typedef struct {
+ MonoObject object;
+ MonoString *application_base;
+ MonoString *application_name;
+ MonoString *cache_path;
+ MonoString *configuration_file;
+ MonoString *dynamic_base;
+ MonoString *license_file;
+ MonoString *private_bin_path;
+ MonoString *private_bin_path_probe;
+ MonoString *shadow_copy_directories;
+ MonoString *shadow_copy_files;
+ MonoBoolean publisher_policy;
+} MonoAppDomainSetup;
+
+typedef GArray MonoJitInfoTable;
+
+typedef struct {
+ guint32 flags;
+ gpointer try_start;
+ gpointer try_end;
+ gpointer handler_start;
+ guint32 token_or_filter;
+} MonoJitExceptionInfo;
+
+typedef struct {
+ MonoMethod *method;
+ gpointer code_start;
+ int code_size;
+ guint32 used_regs;
+ unsigned num_clauses;
+ MonoJitExceptionInfo *clauses;
+} MonoJitInfo;
+
+typedef struct _MonoAppDomain MonoAppDomain;
+
+struct _MonoDomain {
+ MonoAppDomain *domain;
+ CRITICAL_SECTION lock;
+ MonoMemPool *mp;
+ GHashTable *env;
+ GHashTable *assemblies;
+ MonoAppDomainSetup *setup;
+ char* *friendly_name;
+ MonoGHashTable *ldstr_table;
+ MonoGHashTable *class_vtable_hash;
+ MonoGHashTable *proxy_vtable_hash;
+ MonoGHashTable *static_data_hash;
+ GHashTable *jit_code_hash;
+ MonoJitInfoTable *jit_info_table;
+};
+
+/* This is a copy of System.AppDomain */
+struct _MonoAppDomain {
+ MonoObject object;
+ MonoDomain *data;
+};
+
+extern MonoDomain *mono_root_domain;
+
+#define mono_domain_lock(domain) EnterCriticalSection(&(domain)->lock)
+#define mono_domain_unlock(domain) LeaveCriticalSection(&(domain)->lock)
+
+MonoDomain*
+mono_init (const char *filename);
+
+void
+mono_runtime_init (MonoDomain *domain);
+
+MonoDomain *
+mono_domain_create (void);
+
+inline MonoDomain *
+mono_domain_get (void);
+
+inline void
+mono_domain_set (MonoDomain *domain);
+
+MonoAssembly *
+mono_domain_assembly_open (MonoDomain *domain, char *name);
+
+void
+mono_domain_unload (MonoDomain *domain, gboolean force);
+
+void
+mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji);
+
+MonoJitInfo *
+mono_jit_info_table_find (MonoDomain *domain, char *addr);
+
+void
+ves_icall_System_AppDomainSetup_InitAppDomainSetup (MonoAppDomainSetup *setup);
+
+MonoAppDomain *
+ves_icall_System_AppDomain_getCurDomain (void);
+
+MonoAppDomain *
+ves_icall_System_AppDomain_createDomain (MonoString *friendly_name,
+ MonoAppDomainSetup *setup);
+
+MonoObject *
+ves_icall_System_AppDomain_GetData (MonoAppDomain *ad,
+ MonoString *name);
+
+void
+ves_icall_System_AppDomain_SetData (MonoAppDomain *ad,
+ MonoString *name,
+ MonoObject *data);
+
+MonoAppDomainSetup *
+ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad);
+
+MonoString *
+ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad);
+
+MonoArray *
+ves_icall_System_AppDomain_GetAssemblies (MonoAppDomain *ad);
+
+MonoReflectionAssembly *
+ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,
+ MonoReflectionAssemblyName *assRef,
+ MonoObject *evidence);
+
+void
+ves_icall_System_AppDomain_Unload (MonoAppDomain *ad);
+
+gint32
+ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomain *ad,
+ MonoString *file,
+ MonoObject *evidence,
+ MonoArray *args);
+
+#endif /* _MONO_METADATA_APPDOMAIN_H_ */
diff --git a/mono/metadata/assembly.c b/mono/metadata/assembly.c
index 6d6b2602d7f..80842c12347 100644
--- a/mono/metadata/assembly.c
+++ b/mono/metadata/assembly.c
@@ -1,6 +1,5 @@
/*
- * assembly.c: Routines for manipulating and assembly stored in an
- * extended PE/COFF file.
+ * assembly.c: Routines for loading assemblies.
*
* Author:
* Miguel de Icaza (miguel@ximian.com)
@@ -8,7 +7,7 @@
* (C) 2001 Ximian, Inc. http://www.ximian.com
*
* TODO:
- * Do byteswaps for big-endian systems on the various headers.
+ * Implement big-endian versions of the reading routines.
*/
#include <config.h>
#include <stdio.h>
@@ -16,288 +15,236 @@
#include <errno.h>
#include <string.h>
#include "assembly.h"
+#include "image.h"
#include "cil-coff.h"
#include "rawbuffer.h"
-#define INVALID_ADDRESS 0xffffffff
+#define CSIZE(x) (sizeof (x) / 4)
-/* FIXME: implement big endian versions */
-#define le64_to_cpu(x) (x)
-#define le32_to_cpu(x) (x)
-#define le16_to_cpu(x) (x)
-#define read32(x) le32_to_cpu (*((guint32 *) (x)))
-#define read16(x) le16_to_cpu (*((guint16 *) (x)))
-#define read64(x) le64_to_cpu (*((guint64 *) (x)))
+/*
+ * keeps track of loaded assemblies
+ */
+static GHashTable *assemblies;
-static guint32
-coff_map (dotnet_image_info_t *iinfo, guint32 addr)
+/**
+ * g_concat_dir_and_file:
+ * @dir: directory name
+ * @file: filename.
+ *
+ * returns a new allocated string that is the concatenation of dir and file,
+ * takes care of the exact details for concatenating them.
+ */
+static char *
+g_concat_dir_and_file (const char *dir, const char *file)
{
- const int top = iinfo->dn_section_count;
- section_table_t *tables = iinfo->dn_section_tables;
- int i;
-
- for (i = 0; i < top; i++){
- if ((addr >= tables->st_virtual_address) &&
- (addr < tables->st_virtual_address + tables->st_raw_data_size)){
- return addr - tables->st_virtual_address + tables->st_raw_data_ptr;
- }
- tables++;
- }
- return INVALID_ADDRESS;
+ g_return_val_if_fail (dir != NULL, NULL);
+ g_return_val_if_fail (file != NULL, NULL);
+
+ /*
+ * If the directory name doesn't have a / on the end, we need
+ * to add one so we get a proper path to the file
+ */
+ if (dir [strlen(dir) - 1] != G_DIR_SEPARATOR)
+ return g_strconcat (dir, G_DIR_SEPARATOR_S, file, NULL);
+ else
+ return g_strconcat (dir, file, NULL);
}
-static int
-load_section_tables (MonoAssembly *assembly, dotnet_image_info_t *iinfo)
+static char *
+default_assembly_name_resolver (const char *base_dir, const char *name)
{
- const int top = iinfo->dn_header.coff.coff_sections;
- int i;
-
- iinfo->dn_section_count = top;
- iinfo->dn_section_tables = g_new (section_table_t, top);
-
- for (i = 0; i < top; i++){
- section_table_t *t = &iinfo->dn_section_tables [i];
-
- if (fread (t, sizeof (section_table_t), 1, assembly->f) != 1)
- return FALSE;
-
- t->st_virtual_size = le32_to_cpu (t->st_virtual_size);
- t->st_virtual_address = le32_to_cpu (t->st_virtual_address);
- t->st_raw_data_size = le32_to_cpu (t->st_raw_data_size);
- t->st_raw_data_ptr = le32_to_cpu (t->st_raw_data_ptr);
- t->st_reloc_ptr = le32_to_cpu (t->st_reloc_ptr);
- t->st_lineno_ptr = le32_to_cpu (t->st_lineno_ptr);
- t->st_reloc_count = le16_to_cpu (t->st_reloc_count);
- t->st_line_count = le16_to_cpu (t->st_line_count);
+ char *file, *path;
+
+ if ((strcmp (name, "mscorlib") == 0) ||
+ (strcmp (name, "mscorlib.dll") == 0) ||
+ (strcmp (name, "corlib.dll") == 0) ||
+ (strcmp (name, "corlib") == 0))
+ {
+ return g_concat_dir_and_file (MONO_ASSEMBLIES, CORLIB_NAME);
}
- return TRUE;
-}
-
-static gboolean
-load_cli_header (MonoAssembly *assembly, dotnet_image_info_t *iinfo)
-{
- guint32 offset;
- int n;
+ /* Full name already supplied */
+ path = g_strdup (name);
+ if (g_file_test (name, G_FILE_TEST_EXISTS))
+ return path;
+
+ g_free (path);
+ path = g_concat_dir_and_file (base_dir, name);
+ if (g_file_test (path, G_FILE_TEST_EXISTS))
+ return path;
+
+ file = path;
+ path = g_strconcat (file, ".dll", NULL);
+ g_free (file);
+ if (g_file_test (path, G_FILE_TEST_EXISTS))
+ return path;
+ g_free (path);
- offset = coff_map (iinfo, iinfo->dn_header.datadir.pe_cli_header.rva);
- if (offset == INVALID_ADDRESS)
- return FALSE;
+ path = g_concat_dir_and_file (MONO_ASSEMBLIES, name);
+ if (g_file_test (path, G_FILE_TEST_EXISTS))
+ return path;
+ g_free (path);
- if (fseek (assembly->f, offset, 0) != 0)
- return FALSE;
-
- if ((n = fread (&iinfo->dn_cli_header, sizeof (cli_header_t), 1, assembly->f)) != 1)
- return FALSE;
-
- /* Catch new uses of the fields that are supposed to be zero */
-
- if ((iinfo->dn_cli_header.ch_eeinfo_table.rva != 0) ||
- (iinfo->dn_cli_header.ch_helper_table.rva != 0) ||
- (iinfo->dn_cli_header.ch_dynamic_info.rva != 0) ||
- (iinfo->dn_cli_header.ch_delay_load_info.rva != 0) ||
- (iinfo->dn_cli_header.ch_module_image.rva != 0) ||
- (iinfo->dn_cli_header.ch_external_fixups.rva != 0) ||
- (iinfo->dn_cli_header.ch_ridmap.rva != 0) ||
- (iinfo->dn_cli_header.ch_debug_map.rva != 0) ||
- (iinfo->dn_cli_header.ch_ip_map.rva != 0)){
- g_message ("Some fields in the CLI header which should have been zero are not zero");
- }
-
- return TRUE;
+ file = g_strconcat (name, ".dll", NULL);
+ path = g_concat_dir_and_file (MONO_ASSEMBLIES, file);
+ g_free (file);
+
+ return path;
}
-static gboolean
-load_metadata_ptrs (MonoAssembly *assembly, dotnet_image_info_t *iinfo)
+/**
+ * mono_assembly_open:
+ * @filename: Opens the assembly pointed out by this name
+ * @resolver: A user provided function to resolve assembly references
+ * @status: where a status code can be returned
+ *
+ * mono_assembly_open opens the PE-image pointed by @filename, and
+ * loads any external assemblies referenced by it.
+ *
+ * NOTE: we could do lazy loading of the assemblies. Or maybe not worth
+ * it.
+ */
+MonoAssembly *
+mono_assembly_open (const char *filename, MonoAssemblyResolverFn resolver,
+ MonoImageOpenStatus *status)
{
- metadata_t *metadata = &iinfo->dn_metadata;
- guint32 offset, size;
- guint16 records;
+ MonoAssembly *ass;
+ MonoImage *image;
+ MonoTableInfo *t;
int i;
- char *ptr;
-
- offset = coff_map (iinfo, iinfo->dn_cli_header.ch_metadata.rva);
- size = iinfo->dn_cli_header.ch_metadata.size;
+ char *fullname, *base_dir;
+ const char *base_name = strrchr (filename, G_DIR_SEPARATOR);
+ static MonoAssembly *corlib;
- metadata->raw_metadata = raw_buffer_load (fileno (assembly->f), FALSE, offset, size);
- if (metadata->raw_metadata == NULL)
- return FALSE;
+ g_return_val_if_fail (filename != NULL, NULL);
- ptr = metadata->raw_metadata;
+ if (assemblies == NULL)
+ assemblies = g_hash_table_new (g_str_hash, g_str_equal);
- /*
- * Handle Beta 1 and ECMA versions of the metadata root
- */
- if (strncmp (ptr, "COM+", 4) == 0){
- ptr += 10;
- } else if (strncmp (ptr, "BSJB", 4) == 0){
- guint32 version_string_len;
-
- ptr += 8;
- version_string_len = read32 (ptr);
- ptr += version_string_len;
- if (((guint32) ptr) % 4)
- ptr += 4 - (((guint32) ptr) %4);
+ if ((ass = g_hash_table_lookup (assemblies, filename)) != NULL){
+ ass->ref_count++;
+ return ass;
}
-
- records = read16 (ptr);
- ptr += 2;
-
- for (i = 0; i < records; i++){
- if (strncmp (ptr + 8, "#~", 3) == 0){
- metadata->heap_tables.sh_offset = read32 (ptr);
- metadata->heap_tables.sh_size = read32 (ptr + 4);
- ptr += 8 + 3;
- } else if (strncmp (ptr + 8, "#Strings", 9) == 0){
- metadata->heap_strings.sh_offset = read32 (ptr);
- metadata->heap_strings.sh_size = read32 (ptr + 4);
- ptr += 8 + 9;
- } else if (strncmp (ptr + 8, "#US", 4) == 0){
- metadata->heap_us.sh_offset = read32 (ptr);
- metadata->heap_us.sh_size = read32 (ptr + 4);
- ptr += 8 + 4;
- } else if (strncmp (ptr + 8, "#Blob", 6) == 0){
- metadata->heap_blob.sh_offset = read32 (ptr);
- metadata->heap_blob.sh_size = read32 (ptr + 4);
- ptr += 8 + 6;
- } else if (strncmp (ptr + 8, "#GUID", 6) == 0){
- metadata->heap_guid.sh_offset = read32 (ptr);
- metadata->heap_guid.sh_size = read32 (ptr + 4);
- ptr += 8 + 6;
- } else
- g_message ("Unknown heap type: %s\n", ptr + 8);
- if (((guint32)ptr) % 4){
- ptr += 4 - (((guint32)ptr) % 4);
- }
- }
- return TRUE;
-}
-
-static gboolean
-load_tables (MonoAssembly *assembly, metadata_t *meta)
-{
- char *heap_tables = meta->raw_metadata + meta->heap_tables.sh_offset;
- guint32 *rows;
- guint64 valid_mask;
- int valid = 0, table;
- valid_mask = read64 (heap_tables + 8);
- rows = (guint32 *) (heap_tables + 24);
-
- for (table = 0; table < 64; table++){
- if ((valid_mask & ((guint64) 1 << table)) == 0){
- meta->rows [table] = 0;
- continue;
- }
- meta->rows [table] = *rows;
- rows++;
- valid++;
- }
+ if (base_name == NULL)
+ base_name = filename;
+ else
+ base_name++;
- return TRUE;
-}
+ if (resolver == NULL)
+ resolver = default_assembly_name_resolver;
-static gboolean
-load_metadata (MonoAssembly *assembly, dotnet_image_info_t *iinfo)
-{
- if (!load_metadata_ptrs (assembly, iinfo))
- return FALSE;
-
- return load_tables (assembly, &iinfo->dn_metadata);
-}
+ base_dir = g_path_get_dirname (filename);
+
+ fullname = resolver (base_dir, filename);
+ image = mono_image_open (fullname, status);
-MonoAssembly *
-mono_assembly_open (const char *fname, enum MonoAssemblyOpenStatus *status)
-{
- dotnet_image_info_t *iinfo;
- dotnet_header_t *header;
- msdos_header_t msdos;
- MonoAssembly *assembly;
- int n;
-
- assembly = g_new (MonoAssembly, 1);
- assembly->f = fopen (fname, "r");
- iinfo = g_new (dotnet_image_info_t, 1);
- assembly->image_info = iinfo;
-
- header = &iinfo->dn_header;
-
- if (assembly->f == NULL){
+ if (!image){
if (status)
- *status = MONO_ASSEMBLY_ERROR_ERRNO;
- mono_assembly_close (assembly);
+ *status = MONO_IMAGE_ERROR_ERRNO;
+ g_free (fullname);
+ g_free (base_dir);
return NULL;
}
- if (status)
- *status = MONO_ASSEMBLY_IMAGE_INVALID;
-
- if (fread (&msdos, sizeof (msdos), 1, assembly->f) != 1)
- goto invalid_image;
-
- if (!(msdos.msdos_header [0] == 0x4d && msdos.msdos_header [1] == 0x5a))
- goto invalid_image;
-
- if ((n = fread (header, sizeof (dotnet_header_t), 1, assembly->f)) != 1)
- goto invalid_image;
+ t = &image->tables [MONO_TABLE_ASSEMBLYREF];
+
+ image->references = g_new0 (MonoAssembly *, t->rows + 1);
/*
- * FIXME: byte swap all addresses here for header.
+ * Create assembly struct, and enter it into the assembly cache
*/
-
- if (!load_section_tables (assembly, iinfo))
- goto invalid_image;
-
- /* Load the CLI header */
- if (!load_cli_header (assembly, iinfo))
- goto invalid_image;
+ ass = g_new0 (MonoAssembly, 1);
+ ass->name = fullname;
+ ass->image = image;
- if (!load_metadata (assembly, iinfo))
- goto invalid_image;
-
- if (status)
- *status = MONO_ASSEMBLY_OK;
+ image->assembly = ass;
- return assembly;
+ g_hash_table_insert (assemblies, image->name, ass);
+ g_hash_table_insert (assemblies, ass->name, ass);
+
+ /*
+ * Load any assemblies this image references
+ */
+ for (i = 0; i < t->rows; i++){
+ char *assembly_ref;
+ const char *name;
+ guint32 cols [MONO_ASSEMBLYREF_SIZE];
+
+ mono_metadata_decode_row (t, i, cols, CSIZE (cols));
+ name = mono_metadata_string_heap (image, cols [MONO_ASSEMBLYREF_NAME]);
+
+ /*
+ * Special case until we have a passable corlib:
+ *
+ * ie, references to mscorlib from corlib.dll are ignored
+ * and we do not load corlib twice.
+ */
+ if (strcmp (base_name, CORLIB_NAME) == 0){
+ if (corlib == NULL)
+ corlib = ass;
+
+ if (strcmp (name, "mscorlib") == 0)
+ continue;
+ }
+
+ assembly_ref = (*resolver) (base_dir, name);
+
+ image->references [i] = mono_assembly_open (assembly_ref, resolver, status);
+
+ if (image->references [i] == NULL){
+ int j;
+
+ for (j = 0; j < i; j++)
+ mono_assembly_close (image->references [j]);
+ g_free (image->references);
+ mono_image_close (image);
+
+ g_warning ("Could not find assembly %s %s", name, assembly_ref);
+ g_free (assembly_ref);
+ if (status)
+ *status = MONO_IMAGE_MISSING_ASSEMBLYREF;
+ g_free (ass);
+ g_free (base_dir);
+ return NULL;
+ }
+ g_free (assembly_ref);
+ }
+ image->references [i] = NULL;
-invalid_image:
- mono_assembly_close (assembly);
- return NULL;
+ g_free (base_dir);
+ return ass;
}
void
mono_assembly_close (MonoAssembly *assembly)
{
- g_return_if_fail (assembly != NULL);
-
- if (assembly->f)
- fclose (assembly->f);
-
- if (assembly->image_info){
- dotnet_image_info_t *ii = assembly->image_info;
-
- if (ii->dn_metadata.raw_metadata != NULL)
- raw_buffer_free (ii->dn_metadata.raw_metadata);
+ MonoImage *image;
+ int i;
- if (ii->dn_section_tables)
- g_free (ii->dn_section_tables);
+ g_return_if_fail (assembly != NULL);
- g_free (assembly->image_info);
- }
+ if (--assembly->ref_count != 0)
+ return;
+ image = assembly->image;
+ for (i = 0; image->references [i] != NULL; i++)
+ mono_image_close (image->references [i]->image);
+ g_free (image->references);
+
+ g_hash_table_remove (assemblies, assembly->name);
+
+ mono_image_close (assembly->image);
+
+ g_free (assembly->name);
g_free (assembly);
}
-const char *
-mono_assembly_strerror (enum MonoAssemblyOpenStatus status)
+/*
+ * Temporary hack until we get AppDomains
+ */
+GHashTable *
+mono_get_assemblies ()
{
- switch (status){
- case MONO_ASSEMBLY_OK:
- return "succes";
- case MONO_ASSEMBLY_ERROR_ERRNO:
- return strerror (errno);
- case MONO_ASSEMBLY_IMAGE_INVALID:
- return "File does not contain a valid CIL image";
- }
- return "Internal error";
+ return assemblies;
}
diff --git a/mono/metadata/assembly.h b/mono/metadata/assembly.h
index dcec354f007..fcabb8c0c38 100644
--- a/mono/metadata/assembly.h
+++ b/mono/metadata/assembly.h
@@ -1,20 +1,16 @@
#ifndef _MONONET_METADATA_ASSEMBLY_H_
#define _MONONET_METADATA_ASSEMBLY_H_
-typedef struct {
- FILE *f;
- void *image_info;
-} MonoAssembly;
+#include <mono/metadata/image.h>
-enum MonoAssemblyOpenStatus {
- MONO_ASSEMBLY_OK,
- MONO_ASSEMBLY_ERROR_ERRNO,
- MONO_ASSEMBLY_IMAGE_INVALID
-};
+#define CORLIB_NAME "corlib.dll"
-MonoAssembly *mono_assembly_open (const char *fname, enum MonoAssemblyOpenStatus *status);
-void mono_assembly_close (MonoAssembly *assembly);
+typedef char * (*MonoAssemblyResolverFn)(const char *base_dir, const char *name);
-const char *mono_assembly_strerror (enum MonoAssemblyOpenStatus status);
-
+MonoAssembly *mono_assembly_open (const char *fname,
+ MonoAssemblyResolverFn resolver,
+ MonoImageOpenStatus *status);
+void mono_assembly_close (MonoAssembly *assembly);
+
+GHashTable *mono_get_assemblies (void);
#endif
diff --git a/mono/metadata/blob.h b/mono/metadata/blob.h
new file mode 100644
index 00000000000..41243d76c4b
--- /dev/null
+++ b/mono/metadata/blob.h
@@ -0,0 +1,51 @@
+/*
+ * blob.h: Definitions used to pull information out of the Blob
+ *
+ */
+#ifndef _MONO_METADATA_BLOB_H_
+#define _MONO_METADATA_BLOB_H_
+
+#define SIGNATURE_HAS_THIS 0x20
+#define SIGNATURE_EXPLICIT_THIS 0x40
+#define SIGNATURE_VARARG 0x05
+
+/*
+ * Encoding for type signatures used in the Metadata
+ */
+typedef enum {
+ MONO_TYPE_END = 0x00, /* End of List */
+ MONO_TYPE_VOID = 0x01,
+ MONO_TYPE_BOOLEAN = 0x02,
+ MONO_TYPE_CHAR = 0x03,
+ MONO_TYPE_I1 = 0x04,
+ MONO_TYPE_U1 = 0x05,
+ MONO_TYPE_I2 = 0x06,
+ MONO_TYPE_U2 = 0x07,
+ MONO_TYPE_I4 = 0x08,
+ MONO_TYPE_U4 = 0x09,
+ MONO_TYPE_I8 = 0x0a,
+ MONO_TYPE_U8 = 0x0b,
+ MONO_TYPE_R4 = 0x0c,
+ MONO_TYPE_R8 = 0x0d,
+ MONO_TYPE_STRING = 0x0e,
+ MONO_TYPE_PTR = 0x0f, /* arg: <type> token */
+ MONO_TYPE_BYREF = 0x10, /* arg: <type> token */
+ MONO_TYPE_VALUETYPE = 0x11, /* arg: <type> token */
+ MONO_TYPE_CLASS = 0x12, /* arg: <type> token */
+ MONO_TYPE_ARRAY = 0x14, /* type, rank, boundsCount, bound1, loCount, lo1 */
+ MONO_TYPE_TYPEDBYREF = 0x16,
+ MONO_TYPE_I = 0x18,
+ MONO_TYPE_U = 0x19,
+ MONO_TYPE_FNPTR = 0x1b, /* arg: full method signature */
+ MONO_TYPE_OBJECT = 0x1c,
+ MONO_TYPE_SZARRAY = 0x1d, /* 0-based one-dim-array */
+ MONO_TYPE_CMOD_REQD = 0x1f, /* arg: typedef or typeref token */
+ MONO_TYPE_CMOD_OPT = 0x20, /* optional arg: typedef or typref token */
+ MONO_TYPE_INTERNAL = 0x21, /* CLR internal type */
+
+ MONO_TYPE_MODIFIER = 0x40, /* Or with the following types */
+ MONO_TYPE_SENTINEL = 0x41, /* Sentinel for varargs method signature */
+ MONO_TYPE_PINNED = 0x45 /* Local var that points to pinned object */
+} MonoTypeEnum;
+
+#endif
diff --git a/mono/metadata/cil-coff.h b/mono/metadata/cil-coff.h
index ee4f001e2b0..1393c801306 100644
--- a/mono/metadata/cil-coff.h
+++ b/mono/metadata/cil-coff.h
@@ -1,12 +1,40 @@
-#include <mono/metadata/metadata.h>
-/* A metadata token */
-typedef guint32 mtoken_t;
+#ifndef __MONO_CIL_COFF_H__
+#define __MONO_CIL_COFF_H__
+
+#include <mono/metadata/metadata.h>
+/*
+ * 25.2.1: Method header type values
+ */
+#define METHOD_HEADER_FORMAT_MASK 7
+#define METHOD_HEADER_TINY_FORMAT 2
+#define METHOD_HEADER_TINY_FORMAT1 6
+#define METHOD_HEADER_FAT_FORMAT 3
+
+/*
+ * 25.2.3.1: Flags for method headers
+ */
+#define METHOD_HEADER_INIT_LOCALS 0x10
+#define METHOD_HEADER_MORE_SECTS 0x08
+
+/*
+ * For section data (25.3)
+ */
+#define METHOD_HEADER_SECTION_RESERVED 0
+#define METHOD_HEADER_SECTION_EHTABLE 1
+#define METHOD_HEADER_SECTION_OPTIL_TABLE 2
+#define METHOD_HEADER_SECTION_FAT_FORMAT 0x40
+#define METHOD_HEADER_SECTION_MORE_SECTS 0x80
+
+/* 128 bytes */
typedef struct {
- char msdos_header [128];
-} msdos_header_t;
+ char msdos_header [60];
+ guint32 pe_offset;
+ char msdos_header2 [64];
+} MonoMSDOSHeader;
+/* 20 bytes */
typedef struct {
guint16 coff_machine;
guint16 coff_sections;
@@ -15,11 +43,12 @@ typedef struct {
guint32 coff_symcount;
guint16 coff_opt_header_size;
guint16 coff_attributes;
-} coff_header_t;
+} MonoCOFFHeader;
#define COFF_ATTRIBUTE_EXECUTABLE_IMAGE 0x0002
#define COFF_ATTRIBUTE_LIBRARY_IMAGE 0x2000
+/* 28 bytes */
typedef struct {
guint16 pe_magic;
guchar pe_major;
@@ -30,8 +59,9 @@ typedef struct {
guint32 pe_rva_entry_point;
guint32 pe_rva_code_base;
guint32 pe_rva_data_base;
-} pe_header_t;
+} MonoPEHeader;
+/* 68 bytes */
typedef struct {
guint32 pe_image_base; /* must be 0x400000 */
guint32 pe_section_align; /* must be 8192 */
@@ -54,39 +84,41 @@ typedef struct {
guint32 pe_heap_commit;
guint32 pe_loader_flags;
guint32 pe_data_dir_count;
-} pe_header_nt_t;
+} MonoPEHeaderNT;
typedef struct {
guint32 rva;
guint32 size;
-} pe_dir_entry_t;
+} MonoPEDirEntry;
+/* 128 bytes */
typedef struct {
- pe_dir_entry_t pe_export_table;
- pe_dir_entry_t pe_import_table;
- pe_dir_entry_t pe_resource_table;
- pe_dir_entry_t pe_exception_table;
- pe_dir_entry_t pe_certificate_table;
- pe_dir_entry_t pe_reloc_table;
- pe_dir_entry_t pe_debug;
- pe_dir_entry_t pe_copyright;
- pe_dir_entry_t pe_global_ptr;
- pe_dir_entry_t pe_tls_table;
- pe_dir_entry_t pe_load_config_table;
- pe_dir_entry_t pe_bound_import;
- pe_dir_entry_t pe_iat;
- pe_dir_entry_t pe_delay_import_desc;
- pe_dir_entry_t pe_cli_header;
- pe_dir_entry_t pe_reserved;
-} pe_datadir_t;
-
+ MonoPEDirEntry pe_export_table;
+ MonoPEDirEntry pe_import_table;
+ MonoPEDirEntry pe_resource_table;
+ MonoPEDirEntry pe_exception_table;
+ MonoPEDirEntry pe_certificate_table;
+ MonoPEDirEntry pe_reloc_table;
+ MonoPEDirEntry pe_debug;
+ MonoPEDirEntry pe_copyright;
+ MonoPEDirEntry pe_global_ptr;
+ MonoPEDirEntry pe_tls_table;
+ MonoPEDirEntry pe_load_config_table;
+ MonoPEDirEntry pe_bound_import;
+ MonoPEDirEntry pe_iat;
+ MonoPEDirEntry pe_delay_import_desc;
+ MonoPEDirEntry pe_cli_header;
+ MonoPEDirEntry pe_reserved;
+} MonoPEDatadir;
+
+/* 248 bytes */
typedef struct {
char pesig [4];
- coff_header_t coff;
- pe_header_t pe;
- pe_header_nt_t nt;
- pe_datadir_t datadir;
-} dotnet_header_t;
+ MonoCOFFHeader coff;
+ MonoPEHeader pe;
+ MonoPEHeaderNT nt;
+ MonoPEDatadir datadir;
+} MonoDotNetHeader;
typedef struct {
char st_name [8];
@@ -110,47 +142,49 @@ typedef struct {
#define SECT_FLAGS_MEM_READ 0x40000000
#define SECT_FLAGS_MEM_WRITE 0x80000000
guint32 st_flags;
-} section_table_t;
+
+} MonoSectionTable;
typedef struct {
guint32 ch_size;
guint16 ch_runtime_major;
guint16 ch_runtime_minor;
- pe_dir_entry_t ch_metadata;
+ MonoPEDirEntry ch_metadata;
#define CLI_FLAGS_ILONLY 0x01
#define CLI_FLAGS_32BITREQUIRED 0x02
#define CLI_FLAGS_TRACKDEBUGDATA 0x00010000
guint32 ch_flags;
- mtoken_t ch_entry_point;
- pe_dir_entry_t ch_resources;
- pe_dir_entry_t ch_strong_name;
- pe_dir_entry_t ch_code_manager_table;
- pe_dir_entry_t ch_vtable_fixups;
- pe_dir_entry_t ch_export_address_table_jumps;
+ guint32 ch_entry_point;
+ MonoPEDirEntry ch_resources;
+ MonoPEDirEntry ch_strong_name;
+ MonoPEDirEntry ch_code_manager_table;
+ MonoPEDirEntry ch_vtable_fixups;
+ MonoPEDirEntry ch_export_address_table_jumps;
/* The following are zero in the current docs */
- pe_dir_entry_t ch_eeinfo_table;
- pe_dir_entry_t ch_helper_table;
- pe_dir_entry_t ch_dynamic_info;
- pe_dir_entry_t ch_delay_load_info;
- pe_dir_entry_t ch_module_image;
- pe_dir_entry_t ch_external_fixups;
- pe_dir_entry_t ch_ridmap;
- pe_dir_entry_t ch_debug_map;
- pe_dir_entry_t ch_ip_map;
-} cli_header_t;
+ MonoPEDirEntry ch_eeinfo_table;
+ MonoPEDirEntry ch_helper_table;
+ MonoPEDirEntry ch_dynamic_info;
+ MonoPEDirEntry ch_delay_load_info;
+ MonoPEDirEntry ch_module_image;
+ MonoPEDirEntry ch_external_fixups;
+ MonoPEDirEntry ch_ridmap;
+ MonoPEDirEntry ch_debug_map;
+ MonoPEDirEntry ch_ip_map;
+} MonoCLIHeader;
/* This is not an on-disk structure */
typedef struct {
- dotnet_header_t dn_header;
- int dn_section_count;
- section_table_t *dn_section_tables;
- cli_header_t dn_cli_header;
-
- metadata_t dn_metadata;
-} dotnet_image_info_t;
-
+ MonoDotNetHeader cli_header;
+ int cli_section_count;
+ MonoSectionTable *cli_section_tables;
+ void **cli_sections;
+ MonoCLIHeader cli_cli_header;
+} MonoCLIImageInfo;
+guint32 mono_cli_rva_image_map (MonoCLIImageInfo *iinfo, guint32 rva);
+char *mono_cli_rva_map (MonoCLIImageInfo *iinfo, guint32 rva);
+#endif /* __MONO_CIL_COFF_H__ */
diff --git a/mono/metadata/class.c b/mono/metadata/class.c
new file mode 100644
index 00000000000..4a8d48298fd
--- /dev/null
+++ b/mono/metadata/class.c
@@ -0,0 +1,1427 @@
+/*
+ * class.c: Class management for the Mono runtime
+ *
+ * Author:
+ * Miguel de Icaza (miguel@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ *
+ * Possible Optimizations:
+ * in mono_class_create, do not allocate the class right away,
+ * but wait until you know the size of the FieldMap, so that
+ * the class embeds directly the FieldMap after the vtable.
+ *
+ *
+ */
+#include <config.h>
+#include <glib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <mono/metadata/image.h>
+#include <mono/metadata/cil-coff.h>
+#include <mono/metadata/metadata.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/object.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/mono-endian.h>
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#endif
+
+#define CSIZE(x) (sizeof (x) / 4)
+
+gboolean mono_print_vtable = FALSE;
+
+static MonoClass * mono_class_create_from_typedef (MonoImage *image, guint32 type_token);
+
+static MonoClass *
+mono_class_create_from_typeref (MonoImage *image, guint32 type_token)
+{
+ guint32 cols [MONO_TYPEREF_SIZE];
+ MonoTableInfo *t = &image->tables [MONO_TABLE_TYPEREF];
+ guint32 idx;
+ const char *name, *nspace;
+ MonoClass *res;
+
+ mono_metadata_decode_row (t, (type_token&0xffffff)-1, cols, MONO_TYPEREF_SIZE);
+ idx = cols [MONO_TYPEREF_SCOPE] >> RESOLTION_SCOPE_BITS;
+ switch (cols [MONO_TYPEREF_SCOPE] & RESOLTION_SCOPE_MASK) {
+ case RESOLTION_SCOPE_MODULE:
+ if (!idx)
+ g_error ("null ResolutionScope not yet handled");
+ /* a typedef in disguise */
+ return mono_class_create_from_typedef (image, MONO_TOKEN_TYPE_DEF | (1+idx));
+ case RESOLTION_SCOPE_MODULEREF:
+ g_error ("ModuleRef ResolutionScope not yet handled");
+ case RESOLTION_SCOPE_TYPEREF:
+ g_error ("TypeRef ResolutionScope not yet handled");
+ case RESOLTION_SCOPE_ASSEMBLYREF:
+ break;
+ }
+
+ if (!image->references || !image->references [idx-1]) {
+ /*
+ * detected a reference to mscorlib, we simply return a reference to a dummy
+ * until we have a better solution.
+ */
+ fprintf(stderr, "Sending dummy where %s.%s expected\n", mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAMESPACE]), mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAME]));
+
+ res = mono_class_from_name (image, "System", "MonoDummy");
+ /* prevent method loading */
+ res->dummy = 1;
+ /* some storage if the type is used - very ugly hack */
+ res->instance_size = 2*sizeof (gpointer);
+ return res;
+ }
+
+ name = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAME]);
+ nspace = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAMESPACE]);
+
+ /* load referenced assembly */
+ image = image->references [idx-1]->image;
+
+ return mono_class_from_name (image, nspace, name);
+}
+
+/**
+ * class_compute_field_layout:
+ * @m: pointer to the metadata.
+ * @class: The class to initialize
+ *
+ * Initializes the class->fields.
+ *
+ * Currently we only support AUTO_LAYOUT, and do not even try to do
+ * a good job at it. This is temporary to get the code for Paolo.
+ */
+static void
+class_compute_field_layout (MonoClass *class)
+{
+ MonoImage *m = class->image;
+ const int top = class->field.count;
+ guint32 layout = class->flags & TYPE_ATTRIBUTE_LAYOUT_MASK;
+ MonoTableInfo *t = &m->tables [MONO_TABLE_FIELD];
+ int i;
+
+ /*
+ * Fetch all the field information.
+ */
+ for (i = 0; i < top; i++){
+ const char *sig;
+ guint32 cols [MONO_FIELD_SIZE];
+ int idx = class->field.first + i;
+
+ mono_metadata_decode_row (t, idx, cols, CSIZE (cols));
+ /* The name is needed for fieldrefs */
+ class->fields [i].name = mono_metadata_string_heap (m, cols [MONO_FIELD_NAME]);
+ sig = mono_metadata_blob_heap (m, cols [MONO_FIELD_SIGNATURE]);
+ mono_metadata_decode_value (sig, &sig);
+ /* FIELD signature == 0x06 */
+ g_assert (*sig == 0x06);
+ class->fields [i].type = mono_metadata_parse_field_type (
+ m, cols [MONO_FIELD_FLAGS], sig + 1, &sig);
+ if (cols [MONO_FIELD_FLAGS] & FIELD_ATTRIBUTE_HAS_FIELD_RVA) {
+ mono_metadata_field_info (m, idx, NULL, &class->fields [i].data, NULL);
+ if (!class->fields [i].data)
+ g_warning ("field %s in %s should have RVA data, but hasn't", class->fields [i].name, class->name);
+ }
+ if (class->enumtype && !(cols [MONO_FIELD_FLAGS] & FIELD_ATTRIBUTE_STATIC)) {
+ class->enum_basetype = class->fields [i].type;
+ class->element_class = mono_class_from_mono_type (class->enum_basetype);
+ }
+ }
+ if (class->enumtype && !class->enum_basetype) {
+ if (!((strcmp (class->name, "Enum") == 0) && (strcmp (class->name_space, "System") == 0)))
+ G_BREAKPOINT ();
+ }
+ /*
+ * Compute field layout and total size (not considering static fields)
+ */
+ switch (layout) {
+ case TYPE_ATTRIBUTE_AUTO_LAYOUT:
+ case TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT:
+ for (i = 0; i < top; i++){
+ int size, align;
+
+ if (class->fields [i].type->attrs & FIELD_ATTRIBUTE_STATIC)
+ continue;
+
+ size = mono_type_size (class->fields [i].type, &align);
+
+ class->min_align = MAX (align, class->min_align);
+ class->fields [i].offset = class->instance_size;
+ class->fields [i].offset += align - 1;
+ class->fields [i].offset &= ~(align - 1);
+ class->instance_size = class->fields [i].offset + size;
+ }
+
+ if (class->instance_size & (class->min_align - 1)) {
+ class->instance_size += class->min_align - 1;
+ class->instance_size &= ~(class->min_align - 1);
+ }
+ break;
+ case TYPE_ATTRIBUTE_EXPLICIT_LAYOUT:
+ for (i = 0; i < top; i++) {
+ int size, align;
+ int idx = class->field.first + i;
+
+ /*
+ * There must be info about all the fields in a type if it
+ * uses explicit layout.
+ */
+
+ if (class->fields [i].type->attrs & FIELD_ATTRIBUTE_STATIC)
+ continue;
+
+ size = mono_type_size (class->fields [i].type, &align);
+
+ mono_metadata_field_info (m, idx, &class->fields [i].offset, NULL, NULL);
+ if (class->fields [i].offset == (guint32)-1)
+ g_warning ("%s not initialized correctly (missing field layout info for %s)", class->name, class->fields [i].name);
+ /*
+ * The offset is from the start of the object: this works for both
+ * classes and valuetypes.
+ */
+ class->fields [i].offset += sizeof (MonoObject);
+ /*
+ * Calc max size.
+ */
+ size += class->fields [i].offset;
+ class->instance_size = MAX (class->instance_size, size);
+ }
+ break;
+ }
+
+ class->size_inited = 1;
+
+ /*
+ * Compute static field layout and size
+ */
+ switch (layout) {
+ case TYPE_ATTRIBUTE_AUTO_LAYOUT:
+ case TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT:
+ for (i = 0; i < top; i++){
+ int size, align;
+
+ if (!(class->fields [i].type->attrs & FIELD_ATTRIBUTE_STATIC))
+ continue;
+
+ size = mono_type_size (class->fields [i].type, &align);
+ class->fields [i].offset = class->class_size;
+ class->fields [i].offset += align - 1;
+ class->fields [i].offset &= ~(align - 1);
+ class->class_size = class->fields [i].offset + size;
+ }
+ break;
+ case TYPE_ATTRIBUTE_EXPLICIT_LAYOUT:
+ for (i = 0; i < top; i++){
+ int size, align;
+
+ /*
+ * There must be info about all the fields in a type if it
+ * uses explicit layout.
+ */
+
+
+ if (!(class->fields [i].type->attrs & FIELD_ATTRIBUTE_STATIC))
+ continue;
+
+ size = mono_type_size (class->fields [i].type, &align);
+ class->fields [i].offset = class->class_size;
+ class->fields [i].offset += align - 1;
+ class->fields [i].offset &= ~(align - 1);
+ class->class_size = class->fields [i].offset + size;
+ }
+ break;
+ }
+}
+
+static void
+init_properties (MonoClass *class)
+{
+ guint startm, endm, i, j;
+ guint32 cols [MONO_PROPERTY_SIZE];
+ MonoTableInfo *pt = &class->image->tables [MONO_TABLE_PROPERTY];
+ MonoTableInfo *msemt = &class->image->tables [MONO_TABLE_METHODSEMANTICS];
+
+ class->property.first = mono_metadata_properties_from_typedef (class->image, mono_metadata_token_index (class->type_token) - 1, &class->property.last);
+ class->property.count = class->property.last - class->property.first;
+
+ class->properties = g_new0 (MonoProperty, class->property.count);
+ for (i = class->property.first; i < class->property.last; ++i) {
+ mono_metadata_decode_row (pt, i, cols, MONO_PROPERTY_SIZE);
+ class->properties [i - class->property.first].attrs = cols [MONO_PROPERTY_FLAGS];
+ class->properties [i - class->property.first].name = mono_metadata_string_heap (class->image, cols [MONO_PROPERTY_NAME]);
+
+ startm = mono_metadata_methods_from_property (class->image, i, &endm);
+ for (j = startm; j < endm; ++j) {
+ mono_metadata_decode_row (msemt, j, cols, MONO_METHOD_SEMA_SIZE);
+ switch (cols [MONO_METHOD_SEMA_SEMANTICS]) {
+ case METHOD_SEMANTIC_SETTER:
+ class->properties [i - class->property.first].set = class->methods [cols [MONO_METHOD_SEMA_METHOD] - 1 - class->method.first];
+ break;
+ case METHOD_SEMANTIC_GETTER:
+ class->properties [i - class->property.first].get = class->methods [cols [MONO_METHOD_SEMA_METHOD] - 1 - class->method.first];
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
+
+static void
+init_events (MonoClass *class)
+{
+ guint startm, endm, i, j;
+ guint32 cols [MONO_EVENT_SIZE];
+ MonoTableInfo *pt = &class->image->tables [MONO_TABLE_EVENT];
+ MonoTableInfo *msemt = &class->image->tables [MONO_TABLE_METHODSEMANTICS];
+
+ class->event.first = mono_metadata_events_from_typedef (class->image, mono_metadata_token_index (class->type_token) - 1, &class->event.last);
+ class->event.count = class->event.last - class->event.first;
+
+ class->events = g_new0 (MonoEvent, class->event.count);
+ for (i = class->event.first; i < class->event.last; ++i) {
+ mono_metadata_decode_row (pt, i, cols, MONO_EVENT_SIZE);
+ class->events [i - class->event.first].attrs = cols [MONO_EVENT_FLAGS];
+ class->events [i - class->event.first].name = mono_metadata_string_heap (class->image, cols [MONO_EVENT_NAME]);
+
+ startm = mono_metadata_methods_from_event (class->image, i, &endm);
+ for (j = startm; j < endm; ++j) {
+ mono_metadata_decode_row (msemt, j, cols, MONO_METHOD_SEMA_SIZE);
+ switch (cols [MONO_METHOD_SEMA_SEMANTICS]) {
+ case METHOD_SEMANTIC_ADD_ON:
+ class->events [i - class->event.first].add = class->methods [cols [MONO_METHOD_SEMA_METHOD] - 1 - class->method.first];
+ break;
+ case METHOD_SEMANTIC_REMOVE_ON:
+ class->events [i - class->event.first].remove = class->methods [cols [MONO_METHOD_SEMA_METHOD] - 1 - class->method.first];
+ break;
+ case METHOD_SEMANTIC_FIRE:
+ class->events [i - class->event.first].raise = class->methods [cols [MONO_METHOD_SEMA_METHOD] - 1 - class->method.first];
+ break;
+ case METHOD_SEMANTIC_OTHER: /* don't care for now */
+ default:
+ break;
+ }
+ }
+ }
+}
+
+static guint
+mono_get_unique_iid (MonoClass *class)
+{
+ static GHashTable *iid_hash = NULL;
+ static guint iid = 0;
+
+ char *str;
+ gpointer value;
+
+ g_assert (class->flags & TYPE_ATTRIBUTE_INTERFACE);
+
+ if (!iid_hash)
+ iid_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
+ str = g_strdup_printf ("%s|%s.%s\n", class->image->name, class->name_space, class->name);
+
+ if (g_hash_table_lookup_extended (iid_hash, str, NULL, &value)) {
+ g_free (str);
+ return (guint)value;
+ } else {
+ g_hash_table_insert (iid_hash, str, (gpointer)iid);
+ ++iid;
+ }
+
+ return iid - 1;
+}
+
+/**
+ * mono_class_init:
+ * @class: the class to initialize
+ *
+ * compute the instance_size, class_size and other infos that cannot be
+ * computed at mono_class_get() time. Also compute a generic vtable and
+ * the method slot numbers. We use this infos later to create a domain
+ * specific vtable.
+ */
+void
+mono_class_init (MonoClass *class)
+{
+ MonoClass *k, *ic;
+ MonoMethod **vtable;
+ int i, max_vtsize = 0, max_iid, cur_slot = 0;
+ static MonoMethod *default_ghc = NULL;
+ static MonoMethod *default_finalize = NULL;
+ static int finalize_slot = -1;
+ static int ghc_slot = -1;
+
+ g_assert (class);
+
+ if (class->inited)
+ return;
+
+ if (class->init_pending) {
+ /* this indicates a cyclic dependency */
+ g_error ("pending init %s.%s\n", class->name_space, class->name);
+ }
+
+ class->init_pending = 1;
+
+// mono_stats.initialized_class_count++;
+
+ if (class->parent) {
+ if (!class->parent->inited)
+ mono_class_init (class->parent);
+ class->instance_size += class->parent->instance_size;
+ class->class_size += class->parent->class_size;
+ class->min_align = class->parent->min_align;
+ cur_slot = class->parent->vtable_size;
+ } else
+ class->min_align = 1;
+
+ /*
+ * Computes the size used by the fields, and their locations
+ */
+ if (!class->size_inited && class->field.count > 0){
+ class->fields = g_new0 (MonoClassField, class->field.count);
+ class_compute_field_layout (class);
+ }
+
+ if (!(class->flags & TYPE_ATTRIBUTE_INTERFACE)) {
+ for (i = 0; i < class->interface_count; i++)
+ max_vtsize += class->interfaces [i]->method.count;
+
+ if (class->parent)
+ max_vtsize += class->parent->vtable_size;
+
+ max_vtsize += class->method.count;
+ }
+
+ vtable = alloca (sizeof (gpointer) * max_vtsize);
+ memset (vtable, 0, sizeof (gpointer) * max_vtsize);
+
+ /* initialize method pointers */
+ class->methods = g_new (MonoMethod*, class->method.count);
+ for (i = 0; i < class->method.count; ++i)
+ class->methods [i] = mono_get_method (class->image,
+ MONO_TOKEN_METHOD_DEF | (i + class->method.first + 1), class);
+
+ init_properties (class);
+ init_events (class);
+
+ i = mono_metadata_nesting_typedef (class->image, class->type_token);
+ while (i) {
+ MonoClass* nclass;
+ guint32 cols [MONO_NESTED_CLASS_SIZE];
+ mono_metadata_decode_row (&class->image->tables [MONO_TABLE_NESTEDCLASS], i - 1, cols, MONO_NESTED_CLASS_SIZE);
+ if (cols [MONO_NESTED_CLASS_ENCLOSING] != mono_metadata_token_index (class->type_token))
+ break;
+ nclass = mono_class_create_from_typedef (class->image, MONO_TOKEN_TYPE_DEF | cols [MONO_NESTED_CLASS_NESTED]);
+ class->nested_classes = g_list_prepend (class->nested_classes, nclass);
+ ++i;
+ }
+
+ if (class->flags & TYPE_ATTRIBUTE_INTERFACE) {
+ for (i = 0; i < class->method.count; ++i)
+ class->methods [i]->slot = i;
+ class->init_pending = 0;
+ class->inited = 1;
+ return;
+ }
+
+ //printf ("METAINIT %s.%s\n", class->name_space, class->name);
+
+ /* compute maximum number of slots and maximum interface id */
+ max_iid = 0;
+ for (k = class; k ; k = k->parent) {
+ for (i = 0; i < k->interface_count; i++) {
+ ic = k->interfaces [i];
+
+ if (!ic->inited)
+ mono_class_init (ic);
+
+ if (max_iid < ic->interface_id)
+ max_iid = ic->interface_id;
+ }
+ }
+
+ class->max_interface_id = max_iid;
+ /* compute vtable offset for interfaces */
+ class->interface_offsets = g_malloc (sizeof (gpointer) * (max_iid + 1));
+
+ for (i = 0; i <= max_iid; i++)
+ class->interface_offsets [i] = -1;
+
+ for (i = 0; i < class->interface_count; i++) {
+ ic = class->interfaces [i];
+ class->interface_offsets [ic->interface_id] = cur_slot;
+ cur_slot += ic->method.count;
+ }
+
+ for (k = class->parent; k ; k = k->parent) {
+ for (i = 0; i < k->interface_count; i++) {
+ ic = k->interfaces [i];
+ if (class->interface_offsets [ic->interface_id] == -1) {
+ int io = k->interface_offsets [ic->interface_id];
+
+ g_assert (io >= 0);
+ g_assert (io <= max_vtsize);
+
+ class->interface_offsets [ic->interface_id] = io;
+ }
+ }
+ }
+
+ if (class->parent && class->parent->vtable_size)
+ memcpy (vtable, class->parent->vtable, sizeof (gpointer) * class->parent->vtable_size);
+
+ for (k = class; k ; k = k->parent) {
+ for (i = 0; i < k->interface_count; i++) {
+ int j, l, io;
+
+ ic = k->interfaces [i];
+ io = k->interface_offsets [ic->interface_id];
+
+ g_assert (io >= 0);
+ g_assert (io <= max_vtsize);
+
+ if (k == class) {
+ for (l = 0; l < ic->method.count; l++) {
+ MonoMethod *im = ic->methods [l];
+ for (j = 0; j < class->method.count; ++j) {
+ MonoMethod *cm = class->methods [j];
+ if (!(cm->flags & METHOD_ATTRIBUTE_VIRTUAL) ||
+ !(cm->flags & METHOD_ATTRIBUTE_PUBLIC) ||
+ !(cm->flags & METHOD_ATTRIBUTE_NEW_SLOT))
+ continue;
+ if (!strcmp(cm->name, im->name) &&
+ mono_metadata_signature_equal (cm->signature, im->signature)) {
+ g_assert (io + l <= max_vtsize);
+ vtable [io + l] = cm;
+ }
+ }
+ }
+ } else {
+ /* already implemented */
+ if (io >= k->vtable_size)
+ continue;
+ }
+
+ for (l = 0; l < ic->method.count; l++) {
+ MonoMethod *im = ic->methods [l];
+ MonoClass *k1;
+
+ g_assert (io + l <= max_vtsize);
+
+ if (vtable [io + l])
+ continue;
+
+ for (k1 = class; k1; k1 = k1->parent) {
+ for (j = 0; j < k1->method.count; ++j) {
+ MonoMethod *cm = k1->methods [j];
+
+ if (!(cm->flags & METHOD_ATTRIBUTE_VIRTUAL) ||
+ !(cm->flags & METHOD_ATTRIBUTE_PUBLIC))
+ continue;
+
+ if (!strcmp(cm->name, im->name) &&
+ mono_metadata_signature_equal (cm->signature, im->signature)) {
+ g_assert (io + l <= max_vtsize);
+ vtable [io + l] = cm;
+ break;
+ }
+
+ }
+ g_assert (io + l <= max_vtsize);
+ if (vtable [io + l])
+ break;
+ }
+ }
+
+ for (l = 0; l < ic->method.count; l++) {
+ MonoMethod *im = ic->methods [l];
+ char *qname, *fqname;
+
+ qname = g_strconcat (ic->name, ".", im->name, NULL);
+ if (ic->name_space && ic->name_space [0])
+ fqname = g_strconcat (ic->name_space, ".", ic->name, ".", im->name, NULL);
+ else
+ fqname = NULL;
+
+ for (j = 0; j < class->method.count; ++j) {
+ MonoMethod *cm = class->methods [j];
+
+ if (!(cm->flags & METHOD_ATTRIBUTE_VIRTUAL))
+ continue;
+
+ if (((fqname && !strcmp (cm->name, fqname)) || !strcmp (cm->name, qname)) &&
+ mono_metadata_signature_equal (cm->signature, im->signature)) {
+ g_assert (io + l <= max_vtsize);
+ vtable [io + l] = cm;
+ break;
+ }
+ }
+ g_free (qname);
+ g_free (fqname);
+ }
+
+
+ if (!(class->flags & TYPE_ATTRIBUTE_ABSTRACT)) {
+ for (l = 0; l < ic->method.count; l++) {
+ MonoMethod *im = ic->methods [l];
+ g_assert (io + l <= max_vtsize);
+ if (!(vtable [io + l])) {
+ printf ("no implementation for interface method %s.%s::%s in class %s.%s\n",
+ ic->name_space, ic->name, im->name, class->name_space, class->name);
+
+ for (j = 0; j < class->method.count; ++j) {
+ MonoMethod *cm = class->methods [j];
+
+ printf ("METHOD %s\n", cm->name);
+ }
+ g_assert_not_reached ();
+ }
+ }
+ }
+
+ for (l = 0; l < ic->method.count; l++) {
+ MonoMethod *im = vtable [io + l];
+
+ if (im) {
+ g_assert (io + l <= max_vtsize);
+ if (im->slot < 0) {
+ // fixme: why do we need this ?
+ im->slot = io + l;
+ // g_assert_not_reached ();
+ }
+ }
+ }
+ }
+ }
+
+ for (i = 0; i < class->method.count; ++i) {
+ MonoMethod *cm;
+
+ cm = class->methods [i];
+
+
+#if 0
+ if (!(cm->flags & METHOD_ATTRIBUTE_VIRTUAL) ||
+ (cm->slot >= 0))
+ continue;
+#else /* EXT_VTABLE_HACK */
+ if (cm->slot >= 0)
+ continue;
+#endif
+
+ if (!(cm->flags & METHOD_ATTRIBUTE_NEW_SLOT) && (cm->flags & METHOD_ATTRIBUTE_VIRTUAL)) {
+ for (k = class->parent; k ; k = k->parent) {
+ int j;
+ for (j = 0; j < k->method.count; ++j) {
+ MonoMethod *m1 = k->methods [j];
+ if (!(m1->flags & METHOD_ATTRIBUTE_VIRTUAL))
+ continue;
+ if (!strcmp(cm->name, m1->name) &&
+ mono_metadata_signature_equal (cm->signature, m1->signature)) {
+ cm->slot = k->methods [j]->slot;
+ g_assert (cm->slot < max_vtsize);
+ break;
+ }
+ }
+ if (cm->slot >= 0)
+ break;
+ }
+ }
+
+ if (cm->slot < 0)
+ cm->slot = cur_slot++;
+
+ if (!(cm->flags & METHOD_ATTRIBUTE_ABSTRACT))
+ vtable [cm->slot] = cm;
+ }
+
+
+ class->vtable_size = cur_slot;
+ class->vtable = g_malloc0 (sizeof (gpointer) * class->vtable_size);
+ memcpy (class->vtable, vtable, sizeof (gpointer) * class->vtable_size);
+
+ class->inited = 1;
+ class->init_pending = 0;
+
+ if (mono_print_vtable) {
+ int icount = 0;
+
+ for (i = 0; i <= max_iid; i++)
+ if (class->interface_offsets [i] != -1)
+ icount++;
+
+ printf ("VTable %s.%s (size = %d, interfaces = %d)\n", class->name_space,
+ class->name, class->vtable_size, icount);
+
+ for (i = 0; i < class->vtable_size; ++i) {
+ MonoMethod *cm;
+
+ cm = vtable [i];
+ if (cm) {
+ printf (" slot %03d(%03d) %s.%s:%s\n", i, cm->slot,
+ cm->klass->name_space, cm->klass->name,
+ cm->name);
+ }
+ }
+
+
+ if (icount) {
+ printf ("Interfaces %s.%s (max_iid = %d)\n", class->name_space,
+ class->name, max_iid);
+
+ for (i = 0; i < class->interface_count; i++) {
+ ic = class->interfaces [i];
+ printf (" slot %03d(%03d) %s.%s\n",
+ class->interface_offsets [ic->interface_id],
+ ic->method.count, ic->name_space, ic->name);
+ }
+
+ for (k = class->parent; k ; k = k->parent) {
+ for (i = 0; i < k->interface_count; i++) {
+ ic = k->interfaces [i];
+ printf (" slot %03d(%03d) %s.%s\n",
+ class->interface_offsets [ic->interface_id],
+ ic->method.count, ic->name_space, ic->name);
+ }
+ }
+ }
+ }
+
+ if (!default_ghc) {
+ if (class == mono_defaults.object_class) {
+
+ for (i = 0; i < class->vtable_size; ++i) {
+ MonoMethod *cm = vtable [i];
+
+ if (!strcmp (cm->name, "GetHashCode")) {
+ ghc_slot = i;
+ break;
+ }
+ }
+
+ g_assert (ghc_slot > 0);
+
+ default_ghc = vtable [ghc_slot];
+ }
+ }
+
+ class->ghcimpl = 1;
+ if (class != mono_defaults.object_class) {
+
+ if (vtable [ghc_slot] == default_ghc) {
+ class->ghcimpl = 0;
+ }
+ }
+
+ if (!default_finalize) {
+ if (class == mono_defaults.object_class) {
+
+ for (i = 0; i < class->vtable_size; ++i) {
+ MonoMethod *cm = vtable [i];
+
+ if (!strcmp (cm->name, "Finalize")) {
+ finalize_slot = i;
+ break;
+ }
+ }
+
+ g_assert (finalize_slot > 0);
+
+ default_finalize = vtable [finalize_slot];
+ }
+ }
+
+ /* Object::Finalize should have empty implemenatation */
+ class->has_finalize = 0;
+ if (class != mono_defaults.object_class) {
+ if (vtable [finalize_slot] != default_finalize)
+ class->has_finalize = 1;
+ }
+}
+
+
+/*
+ * Compute a relative numbering of the class hierarchy as described in
+ * "Java for Large-Scale Scientific Computations?"
+ */
+static void
+mono_compute_relative_numbering (MonoClass *class, int *c)
+{
+ GList *s;
+
+ (*c)++;
+
+ class->baseval = *c;
+
+ for (s = class->subclasses; s; s = s->next)
+ mono_compute_relative_numbering ((MonoClass *)s->data, c);
+
+ class->diffval = *c - class->baseval;
+}
+
+void
+mono_class_setup_mono_type (MonoClass *class)
+{
+ const char *name = class->name;
+ const char *nspace = class->name_space;
+
+ class->this_arg.byref = 1;
+ class->this_arg.data.klass = class;
+ class->this_arg.type = MONO_TYPE_CLASS;
+ class->byval_arg.data.klass = class;
+ class->byval_arg.type = MONO_TYPE_CLASS;
+
+ if (!strcmp (nspace, "System")) {
+ if (!strcmp (name, "ValueType")) {
+ /*
+ * do not set the valuetype bit for System.ValueType.
+ * class->valuetype = 1;
+ */
+ } else if (!strcmp (name, "Enum")) {
+ /*
+ * do not set the valuetype bit for System.Enum.
+ * class->valuetype = 1;
+ */
+ class->valuetype = 0;
+ class->enumtype = 0;
+ } else if (!strcmp (name, "Object")) {
+ class->this_arg.type = class->byval_arg.type = MONO_TYPE_OBJECT;
+ } else if (!strcmp (name, "String")) {
+ class->this_arg.type = class->byval_arg.type = MONO_TYPE_STRING;
+ }
+ }
+
+ if (class->valuetype) {
+ int t = MONO_TYPE_VALUETYPE;
+ if (!strcmp (nspace, "System")) {
+ switch (*name) {
+ case 'B':
+ if (!strcmp (name, "Boolean")) {
+ t = MONO_TYPE_BOOLEAN;
+ } else if (!strcmp(name, "Byte")) {
+ t = MONO_TYPE_U1;
+ }
+ break;
+ case 'C':
+ if (!strcmp (name, "Char")) {
+ t = MONO_TYPE_CHAR;
+ }
+ break;
+ case 'D':
+ if (!strcmp (name, "Double")) {
+ t = MONO_TYPE_R8;
+ }
+ break;
+ case 'I':
+ if (!strcmp (name, "Int32")) {
+ t = MONO_TYPE_I4;
+ } else if (!strcmp(name, "Int16")) {
+ t = MONO_TYPE_I2;
+ } else if (!strcmp(name, "Int64")) {
+ t = MONO_TYPE_I8;
+ } else if (!strcmp(name, "IntPtr")) {
+ t = MONO_TYPE_I;
+ }
+ break;
+ case 'S':
+ if (!strcmp (name, "Single")) {
+ t = MONO_TYPE_R4;
+ } else if (!strcmp(name, "SByte")) {
+ t = MONO_TYPE_I1;
+ }
+ break;
+ case 'U':
+ if (!strcmp (name, "UInt32")) {
+ t = MONO_TYPE_U4;
+ } else if (!strcmp(name, "UInt16")) {
+ t = MONO_TYPE_U2;
+ } else if (!strcmp(name, "UInt64")) {
+ t = MONO_TYPE_U8;
+ } else if (!strcmp(name, "UIntPtr")) {
+ t = MONO_TYPE_U;
+ }
+ break;
+ case 'V':
+ if (!strcmp (name, "Void")) {
+ t = MONO_TYPE_VOID;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ class->this_arg.type = class->byval_arg.type = t;
+ }
+}
+
+void
+mono_class_setup_parent (MonoClass *class, MonoClass *parent)
+{
+ gboolean system_namespace;
+
+ system_namespace = !strcmp (class->name_space, "System");
+
+ /* if root of the hierarchy */
+ if (system_namespace && !strcmp (class->name, "Object")) {
+ class->parent = NULL;
+ class->instance_size = sizeof (MonoObject);
+ return;
+ }
+
+ if (!(class->flags & TYPE_ATTRIBUTE_INTERFACE)) {
+ int rnum = 0;
+ class->parent = parent;
+
+ class->marshalbyref = parent->marshalbyref;
+ class->contextbound = parent->contextbound;
+ class->delegate = parent->delegate;
+
+ if (system_namespace) {
+ if (*class->name == 'M' && !strcmp (class->name, "MarshalByRefObject"))
+ class->marshalbyref = 1;
+
+ if (*class->name == 'C' && !strcmp (class->name, "ContextBoundObject"))
+ class->contextbound = 1;
+
+ if (*class->name == 'D' && !strcmp (class->name, "Delegate"))
+ class->delegate = 1;
+ }
+
+ if (class->parent->enumtype || ((strcmp (class->parent->name, "ValueType") == 0) &&
+ (strcmp (class->parent->name_space, "System") == 0)))
+ class->valuetype = 1;
+ if (((strcmp (class->parent->name, "Enum") == 0) && (strcmp (class->parent->name_space, "System") == 0))) {
+ class->valuetype = class->enumtype = 1;
+ }
+ //class->enumtype = class->parent->enumtype;
+ class->parent->subclasses = g_list_prepend (class->parent->subclasses, class);
+ mono_compute_relative_numbering (mono_defaults.object_class, &rnum);
+ } else {
+ class->parent = NULL;
+ }
+
+}
+
+/**
+ * @image: context where the image is created
+ * @type_token: typedef token
+ */
+static MonoClass *
+mono_class_create_from_typedef (MonoImage *image, guint32 type_token)
+{
+ MonoTableInfo *tt = &image->tables [MONO_TABLE_TYPEDEF];
+ MonoClass *class, *parent = NULL;
+ guint32 cols [MONO_TYPEDEF_SIZE];
+ guint32 cols_next [MONO_TYPEDEF_SIZE];
+ guint tidx = mono_metadata_token_index (type_token);
+ const char *name, *nspace;
+ guint icount = 0;
+ MonoClass **interfaces;
+
+ if ((class = g_hash_table_lookup (image->class_cache, GUINT_TO_POINTER (type_token))))
+ return class;
+
+ g_assert (mono_metadata_token_table (type_token) == MONO_TABLE_TYPEDEF);
+
+ mono_metadata_decode_row (tt, tidx - 1, cols, CSIZE (cols));
+
+ name = mono_metadata_string_heap (image, cols[1]);
+ nspace = mono_metadata_string_heap (image, cols[2]);
+
+ if (!(!strcmp (nspace, "System") && !strcmp (name, "Object")) &&
+ !(cols [0] & TYPE_ATTRIBUTE_INTERFACE)) {
+ parent = mono_class_get (image, mono_metadata_token_from_dor (cols [3]));
+ }
+ interfaces = mono_metadata_interfaces_from_typedef (image, type_token, &icount);
+
+ class = g_malloc0 (sizeof (MonoClass));
+
+ g_hash_table_insert (image->class_cache, GUINT_TO_POINTER (type_token), class);
+
+ class->interfaces = interfaces;
+ class->interface_count = icount;
+
+ class->name = name;
+ class->name_space = nspace;
+
+ class->image = image;
+ class->type_token = type_token;
+ class->flags = cols [MONO_TYPEDEF_FLAGS];
+
+ class->element_class = class;
+
+ /*g_print ("Init class %s\n", name);*/
+
+ mono_class_setup_parent (class, parent);
+
+ mono_class_setup_mono_type (class);
+
+ /*
+ * Compute the field and method lists
+ */
+ class->field.first = cols [MONO_TYPEDEF_FIELD_LIST] - 1;
+ class->method.first = cols [MONO_TYPEDEF_METHOD_LIST] - 1;
+
+ if (tt->rows > tidx){
+ mono_metadata_decode_row (tt, tidx, cols_next, CSIZE (cols_next));
+ class->field.last = cols_next [MONO_TYPEDEF_FIELD_LIST] - 1;
+ class->method.last = cols_next [MONO_TYPEDEF_METHOD_LIST] - 1;
+ } else {
+ class->field.last = image->tables [MONO_TABLE_FIELD].rows;
+ class->method.last = image->tables [MONO_TABLE_METHOD].rows;
+ }
+
+ if (cols [MONO_TYPEDEF_FIELD_LIST] &&
+ cols [MONO_TYPEDEF_FIELD_LIST] <= image->tables [MONO_TABLE_FIELD].rows)
+ class->field.count = class->field.last - class->field.first;
+ else
+ class->field.count = 0;
+
+ if (cols [MONO_TYPEDEF_METHOD_LIST] <= image->tables [MONO_TABLE_METHOD].rows)
+ class->method.count = class->method.last - class->method.first;
+ else
+ class->method.count = 0;
+
+ /* reserve space to store vector pointer in arrays */
+ if (!strcmp (nspace, "System") && !strcmp (name, "Array")) {
+ class->instance_size += 2 * sizeof (gpointer);
+ g_assert (class->field.count == 0);
+ }
+
+ if (class->flags & TYPE_ATTRIBUTE_INTERFACE)
+ class->interface_id = mono_get_unique_iid (class);
+
+ //class->interfaces = mono_metadata_interfaces_from_typedef (image, type_token, &class->interface_count);
+
+ if (class->enumtype) {
+ class->fields = g_new0 (MonoClassField, class->field.count);
+ class_compute_field_layout (class);
+ }
+
+ if ((type_token = mono_metadata_nested_in_typedef (image, type_token)))
+ class->nested_in = mono_class_create_from_typedef (image, type_token);
+ return class;
+}
+
+MonoClass *
+mono_ptr_class_get (MonoType *type)
+{
+ MonoClass *result;
+ MonoClass *el_class;
+ static GHashTable *ptr_hash = NULL;
+
+ if (!ptr_hash)
+ ptr_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
+ el_class = mono_class_from_mono_type (type);
+ if ((result = g_hash_table_lookup (ptr_hash, el_class)))
+ return result;
+ result = g_new0 (MonoClass, 1);
+
+ result->parent = NULL; /* no parent for PTR types */
+ result->name = "System";
+ result->name_space = "MonoPtrFakeClass";
+ result->image = el_class->image;
+ result->inited = TRUE;
+ /* Can pointers get boxed? */
+ result->instance_size = sizeof (gpointer);
+ /*
+ * baseval, diffval: need them to allow casting ?
+ */
+ result->element_class = el_class;
+ result->enum_basetype = &result->element_class->byval_arg;
+
+ result->this_arg.type = result->byval_arg.type = MONO_TYPE_PTR;
+ result->this_arg.data.type = result->byval_arg.data.type = result->enum_basetype;
+ result->this_arg.byref = TRUE;
+
+ g_hash_table_insert (ptr_hash, el_class, result);
+
+ return result;
+}
+
+MonoClass *
+mono_class_from_mono_type (MonoType *type)
+{
+ switch (type->type) {
+ case MONO_TYPE_OBJECT:
+ return mono_defaults.object_class;
+ case MONO_TYPE_VOID:
+ return mono_defaults.void_class;
+ case MONO_TYPE_BOOLEAN:
+ return mono_defaults.boolean_class;
+ case MONO_TYPE_CHAR:
+ return mono_defaults.char_class;
+ case MONO_TYPE_I1:
+ return mono_defaults.sbyte_class;
+ case MONO_TYPE_U1:
+ return mono_defaults.byte_class;
+ case MONO_TYPE_I2:
+ return mono_defaults.int16_class;
+ case MONO_TYPE_U2:
+ return mono_defaults.uint16_class;
+ case MONO_TYPE_I4:
+ return mono_defaults.int32_class;
+ case MONO_TYPE_U4:
+ return mono_defaults.uint32_class;
+ case MONO_TYPE_I:
+ return mono_defaults.int_class;
+ case MONO_TYPE_U:
+ return mono_defaults.uint_class;
+ case MONO_TYPE_I8:
+ return mono_defaults.int64_class;
+ case MONO_TYPE_U8:
+ return mono_defaults.uint64_class;
+ case MONO_TYPE_R4:
+ return mono_defaults.single_class;
+ case MONO_TYPE_R8:
+ return mono_defaults.double_class;
+ case MONO_TYPE_STRING:
+ return mono_defaults.string_class;
+ case MONO_TYPE_ARRAY:
+ return mono_array_class_get (type->data.array->type, type->data.array->rank);
+ case MONO_TYPE_PTR:
+ return mono_ptr_class_get (type->data.type);
+ case MONO_TYPE_SZARRAY:
+ return mono_array_class_get (type->data.type, 1);
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_VALUETYPE:
+ return type->data.klass;
+ default:
+ g_warning ("implement me %02x\n", type->type);
+ g_assert_not_reached ();
+ }
+
+ return NULL;
+}
+
+/**
+ * @image: context where the image is created
+ * @type_spec: typespec token
+ */
+static MonoClass *
+mono_class_create_from_typespec (MonoImage *image, guint32 type_spec)
+{
+ MonoType *type;
+ MonoClass *class;
+
+ type = mono_type_create_from_typespec (image, type_spec);
+
+ switch (type->type) {
+ case MONO_TYPE_ARRAY:
+ class = mono_array_class_get (type->data.array->type, type->data.array->rank);
+ break;
+ case MONO_TYPE_SZARRAY:
+ class = mono_array_class_get (type->data.type, 1);
+ break;
+ case MONO_TYPE_PTR:
+ class = mono_class_from_mono_type (type->data.type);
+ break;
+ default:
+ g_warning ("implement me: %08x (from typespec: %08x)", type->type, type_spec);
+ g_assert_not_reached ();
+ }
+
+ mono_metadata_free_type (type);
+
+ return class;
+}
+
+/**
+ * mono_array_class_get:
+ * @element_type: element type
+ * @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 (MonoType *element_type, guint32 rank)
+{
+ MonoClass *eclass;
+ MonoImage *image;
+ MonoClass *class;
+ MonoClass *parent = NULL;
+ GSList *list;
+ int rnum = 0;
+
+ eclass = mono_class_from_mono_type (element_type);
+ g_assert (rank <= 255);
+
+ parent = mono_defaults.array_class;
+
+ if (!parent->inited)
+ mono_class_init (parent);
+
+ image = eclass->image;
+
+ if ((list = g_hash_table_lookup (image->array_cache, element_type))) {
+ for (; list; list = list->next) {
+ class = list->data;
+ if (class->rank == rank)
+ return class;
+ }
+ }
+
+ class = g_malloc0 (sizeof (MonoClass) + parent->vtable_size * sizeof (gpointer));
+
+ class->image = image;
+ class->name_space = "System";
+ class->name = "Array";
+ class->type_token = 0;
+ class->flags = TYPE_ATTRIBUTE_CLASS;
+ class->parent = parent;
+ class->instance_size = mono_class_instance_size (class->parent);
+ class->class_size = 0;
+ class->vtable_size = parent->vtable_size;
+ class->parent->subclasses = g_list_prepend (class->parent->subclasses, class);
+ mono_compute_relative_numbering (mono_defaults.object_class, &rnum);
+
+ class->rank = rank;
+ class->element_class = eclass;
+ if (rank > 1) {
+ MonoArrayType *at = g_new0 (MonoArrayType, 1);
+ class->byval_arg.type = MONO_TYPE_ARRAY;
+ class->byval_arg.data.array = at;
+ at->type = &eclass->byval_arg;
+ 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.type = &eclass->byval_arg;
+ }
+ class->this_arg = class->byval_arg;
+ class->this_arg.byref = 1;
+
+ list = g_slist_append (list, class);
+ g_hash_table_insert (image->array_cache, &class->element_class->byval_arg, list);
+ return class;
+}
+
+/**
+ * mono_class_instance_size:
+ * @klass: a class
+ *
+ * Returns: the size of an object instance
+ */
+gint32
+mono_class_instance_size (MonoClass *klass)
+{
+
+ if (!klass->size_inited)
+ mono_class_init (klass);
+
+ return klass->instance_size;
+}
+
+/**
+ * mono_class_value_size:
+ * @klass: a class
+ *
+ * This function is used for value types, and return the
+ * space and the alignment to store that kind of value object.
+ *
+ * Returns: the size of a value of kind @klass
+ */
+gint32
+mono_class_value_size (MonoClass *klass, guint32 *align)
+{
+ gint32 size;
+
+ /* fixme: check disable, because we still have external revereces to
+ * mscorlib and Dummy Objects
+ */
+ /*g_assert (klass->valuetype);*/
+
+ size = mono_class_instance_size (klass) - sizeof (MonoObject);
+
+ if (align)
+ *align = klass->min_align;
+
+ return size;
+}
+
+/**
+ * mono_class_data_size:
+ * @klass: a class
+ *
+ * Returns: the size of the static class data
+ */
+gint32
+mono_class_data_size (MonoClass *klass)
+{
+
+ if (!klass->inited)
+ mono_class_init (klass);
+
+ return klass->class_size;
+}
+
+/*
+ * Auxiliary routine to mono_class_get_field
+ *
+ * Takes a field index instead of a field token.
+ */
+static MonoClassField *
+mono_class_get_field_idx (MonoClass *class, int idx)
+{
+ if (class->field.count){
+ if ((idx >= class->field.first) && (idx < class->field.last)){
+ return &class->fields [idx - class->field.first];
+ }
+ }
+
+ if (!class->parent)
+ return NULL;
+
+ return mono_class_get_field_idx (class->parent, idx);
+}
+
+/**
+ * mono_class_get_field:
+ * @class: the class to lookup the field.
+ * @field_token: the field token
+ *
+ * Returns: A MonoClassField representing the type and offset of
+ * the field, or a NULL value if the field does not belong to this
+ * class.
+ */
+MonoClassField *
+mono_class_get_field (MonoClass *class, guint32 field_token)
+{
+ int idx = mono_metadata_token_index (field_token);
+
+ g_assert (mono_metadata_token_code (field_token) == MONO_TOKEN_FIELD_DEF);
+
+ return mono_class_get_field_idx (class, idx - 1);
+}
+
+MonoClassField *
+mono_class_get_field_from_name (MonoClass *klass, const char *name)
+{
+ int i;
+
+ for (i = 0; i < klass->field.count; ++i) {
+ if (strcmp (name, klass->fields [i].name) == 0)
+ return &klass->fields [i];
+ }
+ return NULL;
+}
+
+/**
+ * mono_class_get:
+ * @image: the image where the class resides
+ * @type_token: the token for the class
+ * @at: an optional pointer to return the array element type
+ *
+ * Returns: the MonoClass that represents @type_token in @image
+ */
+MonoClass *
+mono_class_get (MonoImage *image, guint32 type_token)
+{
+ MonoClass *class;
+
+ switch (type_token & 0xff000000){
+ case MONO_TOKEN_TYPE_DEF:
+ class = mono_class_create_from_typedef (image, type_token);
+ break;
+ case MONO_TOKEN_TYPE_REF:
+ class = mono_class_create_from_typeref (image, type_token);
+ break;
+ case MONO_TOKEN_TYPE_SPEC:
+ class = mono_class_create_from_typespec (image, type_token);
+ break;
+ default:
+ g_warning ("unknown token type %x", type_token & 0xff000000);
+ g_assert_not_reached ();
+ }
+
+ if (!class)
+ g_warning ("Could not load class from token 0x%08x", type_token);
+ return class;
+}
+
+MonoClass *
+mono_class_from_name (MonoImage *image, const char* name_space, const char *name)
+{
+ GHashTable *nspace_table;
+ guint32 token;
+
+ nspace_table = g_hash_table_lookup (image->name_cache, name_space);
+ if (!nspace_table)
+ return 0;
+ token = GPOINTER_TO_UINT (g_hash_table_lookup (nspace_table, name));
+
+ if (!token) {
+ /*g_warning ("token not found for %s.%s in image %s", name_space, name, image->name);*/
+ return NULL;
+ }
+
+ token = MONO_TOKEN_TYPE_DEF | token;
+
+ return mono_class_get (image, token);
+}
+
+/**
+ * mono_array_element_size:
+ * @ac: pointer to a #MonoArrayClass
+ *
+ * Returns: the size of single array element.
+ */
+gint32
+mono_array_element_size (MonoClass *ac)
+{
+ if (ac->element_class->valuetype)
+ return mono_class_instance_size (ac->element_class) - sizeof (MonoObject);
+ else
+ return sizeof (gpointer);
+}
+
+gpointer
+mono_ldtoken (MonoImage *image, guint32 token, MonoClass **handle_class)
+{
+ switch (token & 0xff000000) {
+ case MONO_TOKEN_TYPE_DEF:
+ case MONO_TOKEN_TYPE_REF: {
+ MonoClass *class;
+ if (handle_class)
+ *handle_class = mono_defaults.typehandle_class;
+ class = mono_class_get (image, token);
+ mono_class_init (class);
+ /* We return a MonoType* as handle */
+ return &class->byval_arg;
+ }
+ case MONO_TOKEN_TYPE_SPEC: {
+ MonoClass *class;
+ if (handle_class)
+ *handle_class = mono_defaults.typehandle_class;
+ class = mono_class_create_from_typespec (image, token);
+ mono_class_init (class);
+ return &class->byval_arg;
+ }
+ case MONO_TOKEN_FIELD_DEF: {
+ MonoClass *class;
+ guint32 type = mono_metadata_typedef_from_field (image, mono_metadata_token_index (token));
+ class = mono_class_get (image, MONO_TOKEN_TYPE_DEF | type);
+ mono_class_init (class);
+ if (handle_class)
+ *handle_class = mono_class_from_name (mono_defaults.corlib, "System", "RuntimeFieldHandle");
+ return mono_class_get_field (class, token);
+ }
+ case MONO_TOKEN_METHOD_DEF:
+ case MONO_TOKEN_MEMBER_REF:
+ default:
+ g_warning ("Unknown token 0x%08x in ldtoken", token);
+ break;
+ }
+ return NULL;
+}
+
diff --git a/mono/metadata/class.h b/mono/metadata/class.h
new file mode 100644
index 00000000000..078df65d48b
--- /dev/null
+++ b/mono/metadata/class.h
@@ -0,0 +1,199 @@
+#ifndef _MONO_CLI_CLASS_H_
+#define _MONO_CLI_CLASS_H_
+
+#include <mono/metadata/metadata.h>
+#include <mono/metadata/image.h>
+#include <mono/metadata/loader.h>
+
+#define MONO_CLASS_IS_ARRAY(c) ((c)->rank)
+
+extern gboolean mono_print_vtable;
+
+typedef struct {
+ MonoType *type;
+ int offset;
+ const char *name;
+ const char *data;
+ /* add marshal data, too */
+} MonoClassField;
+
+typedef struct {
+ const char *name;
+ MonoMethod *get;
+ MonoMethod *set;
+ guint32 attrs;
+} MonoProperty;
+
+typedef struct {
+ const char *name;
+ MonoMethod *add;
+ MonoMethod *remove;
+ MonoMethod *raise;
+ MonoMethod **other;
+ guint32 attrs;
+} MonoEvent;
+
+struct _MonoClass {
+ MonoImage *image;
+ guint32 type_token;
+
+ guint dummy : 1; /* temorary hack */
+ guint inited : 1;
+
+ /* We use init_pending to detect cyclic calls to mono_class_init */
+ guint init_pending : 1;
+
+ /* A class contains static and non static data. Static data can be
+ * of the same type as the class itselfs, but it does not influence
+ * the instance size of the class. To avoid cyclic calls to
+ * mono_class_init (from mono_class_instance_size ()) we first
+ * initialise all non static fields. After that we set size_inited
+ * to 1, because we know the instance size now. After that we
+ * initialise all static fields.
+ */
+ guint size_inited : 1;
+ guint valuetype : 1; /* derives from System.ValueType */
+ guint enumtype : 1; /* derives from System.Enum */
+ guint ghcimpl : 1; /* class has its own GetHashCode impl */
+ guint has_finalize : 1; /* class has its own Finalize impl */
+ guint marshalbyref : 1; /* class is a MarshalByRefObject */
+ guint contextbound : 1; /* class is a ContextBoundObject */
+ guint delegate : 1; /* class is a Delegate */
+ guint min_align : 4;
+
+ MonoClass *parent;
+ MonoClass *nested_in;
+ GList *nested_classes;
+ GList *subclasses; /* list of all subclasses */
+
+ const char *name;
+ const char *name_space;
+
+ guint interface_count;
+ guint interface_id; /* unique inderface id (for interfaces) */
+ guint max_interface_id;
+ gint *interface_offsets;
+ MonoClass **interfaces;
+
+ /*
+ * Computed object instance size, total.
+ */
+ int instance_size;
+ int class_size;
+ int vtable_size; /* number of slots */
+
+ /*
+ * relative numbering for fast type checking
+ */
+ unsigned int baseval;
+ unsigned int diffval;
+
+ /*
+ * From the TypeDef table
+ */
+ guint32 flags;
+ struct {
+ guint32 first, last;
+ int count;
+ } field, method, property, event;
+
+ /*
+ * Field information: Type and location from object base
+ */
+ MonoClassField *fields;
+
+ MonoProperty *properties;
+
+ MonoEvent *events;
+
+ MonoMethod **methods;
+
+ /* The underlying type of the enum */
+ MonoType *enum_basetype;
+ /* element class for arrays and enum */
+ MonoClass *element_class;
+ /* array dimension */
+ guint32 rank;
+
+ /* used as the type of the this argument and when passing the arg by value */
+ MonoType this_arg;
+ MonoType byval_arg;
+
+ void *reflection_info;
+
+ MonoMethod **vtable;
+};
+
+typedef struct {
+ MonoClass *klass;
+ MonoDomain *domain; /* each object/vtable belongs to exactly one domain */
+ guint max_interface_id;
+ gpointer *interface_offsets;
+ gpointer data;
+ gpointer vtable [0];
+} MonoVTable;
+
+
+typedef gpointer (*MonoTrampoline) (MonoMethod *method);
+
+MonoClass *
+mono_class_get (MonoImage *image, guint32 type_token);
+
+void
+mono_class_init (MonoClass *klass);
+
+MonoVTable *
+mono_class_vtable (MonoDomain *domain, MonoClass *class);
+
+MonoVTable *
+mono_class_proxy_vtable (MonoDomain *domain, MonoClass *class);
+
+void
+mono_class_setup_mono_type (MonoClass *class);
+
+void
+mono_class_setup_parent (MonoClass *class, MonoClass *parent);
+
+MonoClass *
+mono_class_from_name (MonoImage *image, const char* name_space, const char *name);
+
+MonoClassField*
+mono_field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass);
+
+MonoClass *
+mono_array_class_get (MonoType *element_type, guint32 rank);
+
+MonoClass *
+mono_ptr_class_get (MonoType *type);
+
+MonoClassField *
+mono_class_get_field (MonoClass *klass, guint32 field_token);
+
+MonoClassField *
+mono_class_get_field_from_name (MonoClass *klass, const char *name);
+
+gint32
+mono_array_element_size (MonoClass *ac);
+
+gint32
+mono_class_instance_size (MonoClass *klass);
+
+gint32
+mono_class_value_size (MonoClass *klass, guint32 *align);
+
+gint32
+mono_class_data_size (MonoClass *klass);
+
+MonoClass *
+mono_class_from_mono_type (MonoType *type);
+
+gpointer
+mono_ldtoken (MonoImage *image, guint32 token, MonoClass **retclass);
+
+void
+mono_install_trampoline (MonoTrampoline func);
+
+void
+mono_install_remoting_trampoline (MonoTrampoline func);
+
+#endif /* _MONO_CLI_CLASS_H_ */
diff --git a/mono/metadata/debug-helpers.c b/mono/metadata/debug-helpers.c
new file mode 100644
index 00000000000..e70a4b791c1
--- /dev/null
+++ b/mono/metadata/debug-helpers.c
@@ -0,0 +1,416 @@
+
+#include <string.h>
+#include "mono/metadata/tokentype.h"
+#include "mono/metadata/opcodes.h"
+#include "mono/metadata/mono-endian.h"
+#include "mono/metadata/debug-helpers.h"
+
+struct MonoMethodDesc {
+ char *namespace;
+ char *klass;
+ char *name;
+ char *args;
+ guint num_args;
+ gboolean include_namespace;
+};
+
+void
+mono_type_get_desc (GString *res, MonoType *type, gboolean include_namespace) {
+ switch (type->type) {
+ case MONO_TYPE_VOID:
+ g_string_append (res, "void"); break;
+ case MONO_TYPE_CHAR:
+ g_string_append (res, "char"); break;
+ case MONO_TYPE_BOOLEAN:
+ g_string_append (res, "bool"); break;
+ case MONO_TYPE_U1:
+ g_string_append (res, "byte"); break;
+ case MONO_TYPE_I1:
+ g_string_append (res, "sbyte"); break;
+ case MONO_TYPE_U2:
+ g_string_append (res, "uint16"); break;
+ case MONO_TYPE_I2:
+ g_string_append (res, "int16"); break;
+ case MONO_TYPE_U4:
+ g_string_append (res, "int"); break;
+ case MONO_TYPE_I4:
+ g_string_append (res, "uint"); break;
+ case MONO_TYPE_U8:
+ g_string_append (res, "ulong"); break;
+ case MONO_TYPE_I8:
+ g_string_append (res, "long"); break;
+ case MONO_TYPE_FNPTR: /* who cares for the exact signature? */
+ g_string_append (res, "*()"); break;
+ case MONO_TYPE_U:
+ g_string_append (res, "intptr"); break;
+ case MONO_TYPE_I:
+ g_string_append (res, "uintptr"); break;
+ case MONO_TYPE_R4:
+ g_string_append (res, "single"); break;
+ case MONO_TYPE_R8:
+ g_string_append (res, "double"); break;
+ case MONO_TYPE_STRING:
+ g_string_append (res, "string"); break;
+ case MONO_TYPE_OBJECT:
+ g_string_append (res, "object"); break;
+ case MONO_TYPE_PTR:
+ mono_type_get_desc (res, type->data.type, include_namespace);
+ g_string_append_c (res, '*');
+ break;
+ case MONO_TYPE_ARRAY:
+ mono_type_get_desc (res, type->data.array->type, include_namespace);
+ g_string_sprintfa (res, "[%d]", type->data.array->rank);
+ break;
+ case MONO_TYPE_SZARRAY:
+ mono_type_get_desc (res, type->data.type, include_namespace);
+ g_string_append (res, "[]");
+ break;
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_VALUETYPE: {
+ MonoClass *class = type->data.klass;
+ if (!class) {
+ g_string_append (res, "Unknown");
+ break;
+ }
+ if (include_namespace && *(class->name_space))
+ g_string_sprintfa (res, "%s.", class->name_space);
+ g_string_sprintfa (res, "%s", class->name);
+ break;
+ }
+ default:
+ break;
+ }
+ if (type->byref)
+ g_string_append_c (res, '&');
+}
+
+char*
+mono_signature_get_desc (MonoMethodSignature *sig, gboolean include_namespace)
+{
+ int i;
+ char *result;
+ GString *res = g_string_new ("");
+
+ for (i = 0; i < sig->param_count; ++i) {
+ if (i > 0)
+ g_string_append_c (res, ',');
+ mono_type_get_desc (res, sig->params [i], include_namespace);
+ }
+ result = res->str;
+ g_string_free (res, FALSE);
+ return result;
+}
+
+/*
+ * The allowed format of a method description string is:
+ * [namespace.]classname:methodname[(args...)]
+ * TODO: describe instance methods.
+ */
+MonoMethodDesc*
+mono_method_desc_new (const char *name, gboolean include_namespace)
+{
+ MonoMethodDesc *result;
+ char *class_name, *class_nspace, *method_name, *use_args, *end;
+ int use_namespace;
+
+ class_nspace = g_strdup (name);
+ use_args = strchr (class_nspace, '(');
+ if (use_args) {
+ *use_args++ = 0;
+ end = strchr (use_args, ')');
+ if (!end) {
+ g_free (class_nspace);
+ return NULL;
+ }
+ *end = 0;
+ }
+ method_name = strrchr (class_nspace, ':');
+ if (!method_name) {
+ g_free (class_nspace);
+ return NULL;
+ }
+ *method_name++ = 0;
+ /* allow two :: to separate the method name */
+ if (*method_name == ':')
+ method_name++;
+ class_name = strrchr (class_nspace, '.');
+ if (class_name) {
+ *class_name++ = 0;
+ use_namespace = 1;
+ } else {
+ class_name = class_nspace;
+ use_namespace = 0;
+ }
+ result = g_new0 (MonoMethodDesc, 1);
+ result->include_namespace = include_namespace;
+ result->name = method_name;
+ result->klass = class_name;
+ result->namespace = use_namespace? class_nspace: NULL;
+ result->args = use_args? use_args: NULL;
+ if (use_args) {
+ end = use_args;
+ if (*end)
+ result->num_args = 1;
+ while (*end) {
+ if (*end == ',')
+ result->num_args++;
+ }
+ }
+
+ return result;
+}
+
+void
+mono_method_desc_free (MonoMethodDesc *desc)
+{
+ if (desc->namespace)
+ g_free (desc->namespace);
+ else if (desc->klass)
+ g_free (desc->klass);
+ g_free (desc);
+}
+
+/*
+ * namespace and class are supposed to match already if this function is used.
+ */
+gboolean
+mono_method_desc_match (MonoMethodDesc *desc, MonoMethod *method)
+{
+ char *sig;
+ if (strcmp (desc->name, method->name))
+ return FALSE;
+ if (!desc->args)
+ return TRUE;
+ if (desc->num_args != method->signature->param_count)
+ return FALSE;
+ sig = mono_signature_get_desc (method->signature, desc->include_namespace);
+ if (strcmp (sig, desc->args)) {
+ g_free (sig);
+ return FALSE;
+ }
+ g_free (sig);
+ return TRUE;
+}
+
+gboolean
+mono_method_desc_full_match (MonoMethodDesc *desc, MonoMethod *method)
+{
+ if (strcmp (desc->klass, method->klass->name))
+ return FALSE;
+ if (desc->namespace && strcmp (desc->namespace, method->klass->name_space))
+ return FALSE;
+ return mono_method_desc_match (desc, method);
+}
+
+MonoMethod*
+mono_method_desc_search_in_class (MonoMethodDesc *desc, MonoClass *klass)
+{
+ int i;
+
+ mono_class_init (klass);
+ for (i = 0; i < klass->method.count; ++i) {
+ if (mono_method_desc_match (desc, klass->methods [i]))
+ return klass->methods [i];
+ }
+ return NULL;
+}
+
+MonoMethod*
+mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image)
+{
+ MonoClass *klass;
+ MonoTableInfo *tdef;
+ MonoTableInfo *methods;
+ MonoMethod *method;
+ int i;
+
+ if (desc->namespace && desc->klass) {
+ klass = mono_class_from_name (image, desc->namespace, desc->klass);
+ if (!klass)
+ return NULL;
+ return mono_method_desc_search_in_class (desc, klass);
+ }
+
+ tdef = &image->tables [MONO_TABLE_TYPEDEF];
+ methods = &image->tables [MONO_TABLE_METHOD];
+ for (i = 0; i < methods->rows; ++i) {
+ guint32 token = mono_metadata_decode_row_col (methods, i, MONO_METHOD_NAME);
+ const char *n = mono_metadata_string_heap (image, token);
+
+ if (strcmp (n, desc->name))
+ continue;
+ method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL);
+ if (mono_method_desc_full_match (desc, method))
+ return method;
+ }
+ return NULL;
+}
+
+static const unsigned char*
+dis_one (GString *str, MonoDisHelper *dh, MonoMethod *method, const unsigned char *ip)
+{
+ MonoMethodHeader *header = ((MonoMethodNormal*)method)->header;
+ const MonoOpcode *opcode;
+ guint32 i, label, token;
+ gint32 sval;
+ char *tmp;
+
+ label = ip - header->code;
+ if (dh->indenter) {
+ tmp = dh->indenter (dh, method, label);
+ g_string_append (str, tmp);
+ g_free (tmp);
+ }
+ if (dh->label_format)
+ g_string_sprintfa (str, dh->label_format, label);
+
+ i = *ip;
+ if (*ip == 0xfe) {
+ ip++;
+ i = *ip + 256;
+ }
+ ++ip;
+ opcode = &mono_opcodes [i];
+ g_string_sprintfa (str, "%-10s", mono_opcode_names [i]);
+
+ switch (opcode->argument) {
+ case MonoInlineNone:
+ break;
+ case MonoInlineType:
+ case MonoInlineField:
+ case MonoInlineMethod:
+ case MonoInlineTok:
+ case MonoInlineSig:
+ token = read32 (ip);
+ if (dh->tokener) {
+ tmp = dh->tokener (dh, method, token);
+ g_string_append (str, tmp);
+ g_free (tmp);
+ } else {
+ g_string_sprintfa (str, "0x%08x", token);
+ }
+ ip += 4;
+ break;
+ case MonoInlineString:
+ /* TODO */
+ ip += 4;
+ break;
+ case MonoInlineVar:
+ g_string_sprintfa (str, "%d", read16 (ip));
+ ip += 2;
+ break;
+ case MonoShortInlineVar:
+ g_string_sprintfa (str, "%d", (*ip));
+ ip ++;
+ break;
+ case MonoInlineBrTarget:
+ sval = read32 (ip);
+ ip += 4;
+ if (dh->label_target)
+ g_string_sprintfa (str, dh->label_target, ip + sval - header->code);
+ else
+ g_string_sprintfa (str, "%d", sval);
+ break;
+ case MonoShortInlineBrTarget:
+ sval = *(const signed char*)ip;
+ ip ++;
+ if (dh->label_target)
+ g_string_sprintfa (str, dh->label_target, ip + sval - header->code);
+ else
+ g_string_sprintfa (str, "%d", sval);
+ break;
+ case MonoInlineSwitch: {
+ const unsigned char *end;
+ sval = read32 (ip);
+ ip += 4;
+ end = ip + sval * 4;
+ g_string_append_c (str, '(');
+ for (i = 0; i < sval; ++i) {
+ if (i > 0)
+ g_string_append (str, ", ");
+ label = read32 (ip);
+ if (dh->label_target)
+ g_string_sprintfa (str, dh->label_target, end + label - header->code);
+ else
+ g_string_sprintfa (str, "%d", label);
+ ip += 4;
+ }
+ g_string_append_c (str, ')');
+ break;
+ }
+ case MonoInlineR: {
+ double r;
+ readr8 (ip, &r);
+ g_string_sprintfa (str, "%g", r);
+ ip += 8;
+ break;
+ }
+ case MonoShortInlineR: {
+ float r;
+ readr4 (ip, &r);
+ g_string_sprintfa (str, "%g", r);
+ ip += 4;
+ break;
+ }
+ case MonoInlineI:
+ g_string_sprintfa (str, "%d", (gint32)read32 (ip));
+ ip += 4;
+ break;
+ case MonoShortInlineI:
+ g_string_sprintfa (str, "%d", *(const signed char*)ip);
+ ip ++;
+ break;
+ case MonoInlineI8:
+ ip += 8;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ if (dh->newline)
+ g_string_append (str, dh->newline);
+
+ return ip;
+}
+
+static MonoDisHelper
+default_dh = {
+ "\n",
+ "IL_%04x: ", /* label_format */
+ "IL_%04x", /* label_target */
+ NULL, /* indenter */
+ NULL, /* tokener */
+ NULL /* user data */
+};
+
+char*
+mono_disasm_code_one (MonoDisHelper *dh, MonoMethod *method, const guchar *ip)
+{
+ char *result;
+ GString *res = g_string_new ("");
+
+ if (!dh)
+ dh = &default_dh;
+ dis_one (res, dh, method, ip);
+
+ result = res->str;
+ g_string_free (res, FALSE);
+ return result;
+}
+
+char*
+mono_disasm_code (MonoDisHelper *dh, MonoMethod *method, const guchar *ip, const guchar* end)
+{
+ char *result;
+ GString *res = g_string_new ("");
+
+ if (!dh)
+ dh = &default_dh;
+ while (ip < end) {
+ ip = dis_one (res, dh, method, ip);
+ }
+
+ result = res->str;
+ g_string_free (res, FALSE);
+ return result;
+}
+
diff --git a/mono/metadata/debug-helpers.h b/mono/metadata/debug-helpers.h
new file mode 100644
index 00000000000..0903c1ce354
--- /dev/null
+++ b/mono/metadata/debug-helpers.h
@@ -0,0 +1,37 @@
+#ifndef __MONO_DEBUG_HELPERS_H__
+#define __MONO_DEBUG_HELPERS_H__
+
+#include <glib.h>
+#include <mono/metadata/class.h>
+
+typedef struct MonoDisHelper MonoDisHelper;
+
+typedef char* (*MonoDisIndenter) (MonoDisHelper *dh, MonoMethod *method, guint32 ip_offset);
+typedef char* (*MonoDisTokener) (MonoDisHelper *dh, MonoMethod *method, guint32 token);
+
+struct MonoDisHelper {
+ const char *newline;
+ const char *label_format;
+ const char *label_target;
+ MonoDisIndenter indenter;
+ MonoDisTokener tokener;
+ gpointer user_data;
+};
+
+char* mono_disasm_code_one (MonoDisHelper *dh, MonoMethod *method, const guchar *ip);
+char* mono_disasm_code (MonoDisHelper *dh, MonoMethod *method, const guchar *ip, const guchar* end);
+
+typedef struct MonoMethodDesc MonoMethodDesc;
+
+void mono_type_get_desc (GString *res, MonoType *type, gboolean include_namespace);
+char* mono_signature_get_desc (MonoMethodSignature *sig, gboolean include_namespace);
+
+MonoMethodDesc* mono_method_desc_new (const char *name, gboolean include_namespace);
+void mono_method_desc_free (MonoMethodDesc *desc);
+gboolean mono_method_desc_match (MonoMethodDesc *desc, MonoMethod *method);
+gboolean mono_method_desc_full_match (MonoMethodDesc *desc, MonoMethod *method);
+MonoMethod* mono_method_desc_search_in_class (MonoMethodDesc *desc, MonoClass *klass);
+MonoMethod* mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image);
+
+#endif /* __MONO_DEBUG_HELPERS_H__ */
+
diff --git a/mono/metadata/debug-symfile.c b/mono/metadata/debug-symfile.c
new file mode 100644
index 00000000000..ddbdae99975
--- /dev/null
+++ b/mono/metadata/debug-symfile.c
@@ -0,0 +1,815 @@
+#include <config.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mono/metadata/metadata.h>
+#include <mono/metadata/rawbuffer.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/debug-symfile.h>
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#ifdef HAVE_ELF_H
+#include <elf.h>
+#endif
+
+/* Keep in sync with Mono.CSharp.Debugger.MonoDwarfFileWriter */
+#define MRT_none 0x00
+#define MRT_target_address_size 0x01
+#define MRT_il_offset 0x02
+#define MRT_method_start_address 0x03
+#define MRT_method_end_address 0x04
+#define MRT_local_variable 0x05
+#define MRT_method_parameter 0x06
+#define MRT_type_sizeof 0x07
+#define MRT_type_field_offset 0x08
+#define MRT_mono_string_sizeof 0x09
+#define MRT_mono_string_offset 0x0a
+#define MRT_mono_array_sizeof 0x0b
+#define MRT_mono_array_offset 0x0c
+#define MRT_mono_array_bounds_sizeof 0x0d
+#define MRT_mono_array_bounds_offset 0x0e
+#define MRT_variable_start_scope 0x0f
+#define MRT_variable_end_scope 0x10
+#define MRT_mono_string_fieldsize 0x11
+#define MRT_mono_array_fieldsize 0x12
+#define MRT_type_field_fieldsize 0x13
+
+#define MRI_string_offset_length 0x00
+#define MRI_string_offset_vector 0x01
+
+#define MRI_array_offset_bounds 0x00
+#define MRI_array_offset_max_length 0x01
+#define MRI_array_offset_vector 0x02
+
+#define MRI_array_bounds_offset_lower 0x00
+#define MRI_array_bounds_offset_length 0x01
+
+#define MRS_debug_info 0x01
+#define MRS_debug_abbrev 0x02
+#define MRS_debug_line 0x03
+#define MRS_mono_reloc_table 0x04
+
+#define DW_OP_const4s 0x0d
+#define DW_OP_plus 0x22
+#define DW_OP_reg0 0x50
+#define DW_OP_breg0 0x70
+#define DW_OP_fbreg 0x91
+#define DW_OP_piece 0x93
+#define DW_OP_nop 0x96
+
+#ifdef HAVE_ELF_H
+
+static gboolean
+get_sections_elf32 (MonoDebugSymbolFile *symfile, gboolean emit_warnings)
+{
+ Elf32_Ehdr *header;
+ Elf32_Shdr *section, *strtab_section;
+ const char *strtab;
+ int i;
+
+ header = (Elf32_Ehdr *)symfile->raw_contents;
+ if (header->e_version != EV_CURRENT) {
+ if (emit_warnings)
+ g_warning ("Symbol file %s has unknown ELF version %d",
+ symfile->file_name, header->e_version);
+ return FALSE;
+ }
+
+ if (header->e_machine != EM_386) {
+ if (emit_warnings)
+ g_warning ("ELF file %s is for unknown architecture %d",
+ symfile->file_name, header->e_machine);
+ return FALSE;
+ }
+
+ if (header->e_shentsize != sizeof (*section)) {
+ if (emit_warnings)
+ g_warning ("ELF file %s has unknown section header size "
+ "(expected %d, got %d)", symfile->file_name,
+ sizeof (*section), header->e_shentsize);
+ return FALSE;
+ }
+
+ symfile->section_offsets = g_new0 (MonoDebugSymbolFileSection, MONO_DEBUG_SYMBOL_SECTION_MAX);
+
+ section = (Elf32_Shdr *)(symfile->raw_contents + header->e_shoff);
+ strtab_section = section + header->e_shstrndx;
+ strtab = symfile->raw_contents + strtab_section->sh_offset;
+
+ for (i = 0; i < header->e_shnum; i++, section++) {
+ const gchar *name = strtab + section->sh_name;
+
+ if (!strcmp (name, ".debug_info")) {
+ MonoDebugSymbolFileSection *sfs;
+
+ sfs = &symfile->section_offsets [MONO_DEBUG_SYMBOL_SECTION_DEBUG_INFO];
+ sfs->type = MONO_DEBUG_SYMBOL_SECTION_DEBUG_INFO;
+ sfs->file_offset = section->sh_offset;
+ sfs->size = section->sh_size;
+ } else if (!strcmp (name, ".debug_line")) {
+ MonoDebugSymbolFileSection *sfs;
+
+ sfs = &symfile->section_offsets [MONO_DEBUG_SYMBOL_SECTION_DEBUG_LINE];
+ sfs->type = MONO_DEBUG_SYMBOL_SECTION_DEBUG_LINE;
+ sfs->file_offset = section->sh_offset;
+ sfs->size = section->sh_size;
+ } else if (!strcmp (name, ".debug_abbrev")) {
+ MonoDebugSymbolFileSection *sfs;
+
+ sfs = &symfile->section_offsets [MONO_DEBUG_SYMBOL_SECTION_DEBUG_ABBREV];
+ sfs->type = MONO_DEBUG_SYMBOL_SECTION_DEBUG_ABBREV;
+ sfs->file_offset = section->sh_offset;
+ sfs->size = section->sh_size;
+ } else if (!strcmp (name, ".mono_reloc_table")) {
+ MonoDebugSymbolFileSection *sfs;
+
+ sfs = &symfile->section_offsets [MONO_DEBUG_SYMBOL_SECTION_MONO_RELOC_TABLE];
+ sfs->type = MONO_DEBUG_SYMBOL_SECTION_MONO_RELOC_TABLE;
+ sfs->file_offset = section->sh_offset;
+ sfs->size = section->sh_size;
+ }
+ }
+
+ return TRUE;
+}
+
+#endif /* HAVE_ELF_H */
+
+static gboolean
+get_sections (MonoDebugSymbolFile *symfile, gboolean emit_warnings)
+{
+#ifdef HAVE_ELF_H
+#ifdef __FreeBSD__
+ static const char ELFMAG[] = { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3, 0 };
+#endif
+ if (!strncmp (symfile->raw_contents, ELFMAG, strlen (ELFMAG)))
+ return get_sections_elf32 (symfile, emit_warnings);
+#endif
+
+ if (emit_warnings)
+ g_warning ("Symbol file %s has unknown file format", symfile->file_name);
+
+ return FALSE;
+}
+
+static MonoClass *
+mono_debug_class_get (MonoDebugSymbolFile *symfile, guint32 type_token)
+{
+ MonoClass *klass;
+
+ if ((klass = g_hash_table_lookup (symfile->image->class_cache, GUINT_TO_POINTER (type_token))))
+ return klass;
+
+ return NULL;
+}
+
+MonoDebugSymbolFile *
+mono_debug_open_symbol_file (MonoImage *image, const char *filename, gboolean emit_warnings)
+{
+ MonoDebugSymbolFile *symfile;
+ off_t file_size;
+ void *ptr;
+ int fd;
+
+ fd = open (filename, O_RDWR);
+ if (fd == -1) {
+ if (emit_warnings)
+ g_warning ("Can't open symbol file: %s", filename);
+ return NULL;
+ }
+
+ file_size = lseek (fd, 0, SEEK_END);
+ lseek (fd, 0, SEEK_SET);
+
+ if (file_size == (off_t) -1) {
+ if (emit_warnings)
+ g_warning ("Can't get size of symbol file: %s", filename);
+ return NULL;
+ }
+
+ ptr = mono_raw_buffer_load (fd, 1, 0, file_size);
+ if (!ptr) {
+ if (emit_warnings)
+ g_warning ("Can't read symbol file: %s", filename);
+ return NULL;
+ }
+
+ symfile = g_new0 (MonoDebugSymbolFile, 1);
+ symfile->fd = fd;
+ symfile->file_name = g_strdup (filename);
+ symfile->image = image;
+ symfile->raw_contents = ptr;
+ symfile->raw_contents_size = file_size;
+
+ if (!get_sections (symfile, emit_warnings)) {
+ mono_debug_close_symbol_file (symfile);
+ return NULL;
+ }
+
+ return symfile;
+}
+
+void
+mono_debug_close_symbol_file (MonoDebugSymbolFile *symfile)
+{
+ if (!symfile)
+ return;
+
+ if (symfile->raw_contents)
+ mono_raw_buffer_free (symfile->raw_contents);
+ if (symfile->fd)
+ close (symfile->fd);
+
+ g_free (symfile->file_name);
+ g_free (symfile->section_offsets);
+ g_free (symfile);
+}
+
+static void
+relocate_variable (MonoDebugVarInfo *var, void *base_ptr)
+{
+ if (!var) {
+ * ((guint8 *) base_ptr)++ = DW_OP_nop;
+ * ((guint8 *) base_ptr)++ = DW_OP_nop;
+ * ((guint8 *) base_ptr)++ = DW_OP_nop;
+ * ((guint8 *) base_ptr)++ = DW_OP_nop;
+ * ((guint8 *) base_ptr)++ = DW_OP_nop;
+ * ((guint8 *) base_ptr)++ = DW_OP_nop;
+ * ((guint8 *) base_ptr)++ = DW_OP_nop;
+ * ((guint8 *) base_ptr)++ = DW_OP_nop;
+ return;
+ }
+
+ /*
+ * Update the location description for a local variable or method parameter.
+ * MCS always reserves 8 bytes for us to do this, if we don't need them all
+ * we just fill up the rest with DW_OP_nop's.
+ */
+
+ switch (var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS) {
+ case MONO_DEBUG_VAR_ADDRESS_MODE_STACK:
+ /*
+ * Variable is on the stack.
+ *
+ * If `index' is zero, use the normal frame register. Otherwise, bits
+ * 0..4 of `index' contain the frame register.
+ *
+ * Both DW_OP_fbreg and DW_OP_breg0 ... DW_OP_breg31 take an ULeb128
+ * argument - since this has an variable size, we set it to zero and
+ * manually add a 4 byte constant using DW_OP_plus.
+ */
+ if (!var->index)
+ /* Use the normal frame register (%ebp on the i386). */
+ * ((guint8 *) base_ptr)++ = DW_OP_fbreg;
+ else
+ /* Use a custom frame register. */
+ * ((guint8 *) base_ptr)++ = DW_OP_breg0 + (var->index & 0x001f);
+ * ((guint8 *) base_ptr)++ = 0;
+ * ((guint8 *) base_ptr)++ = DW_OP_const4s;
+ * ((gint32 *) base_ptr)++ = var->offset;
+ * ((guint8 *) base_ptr)++ = DW_OP_plus;
+ break;
+
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
+ /*
+ * Variable is in the register whose number is contained in bits 0..4
+ * of `index'.
+ *
+ * We need to write exactly 8 bytes in this location description, so instead
+ * of filling up the rest with DW_OP_nop's just add the `offset' even if
+ * it's zero.
+ */
+ * ((guint8 *) base_ptr)++ = DW_OP_reg0 + (var->index & 0x001f);
+ * ((guint8 *) base_ptr)++ = DW_OP_nop;
+ * ((guint8 *) base_ptr)++ = DW_OP_const4s;
+ * ((gint32 *) base_ptr)++ = var->offset;
+ * ((guint8 *) base_ptr)++ = DW_OP_plus;
+ break;
+
+ case MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS:
+ /*
+ * Variable is in two registers whose numbers are in bits 0..4 and 5..9 of
+ * the `index' field. Don't add `offset' since we have only two bytes left,
+ * fill them up with DW_OP_nop's.
+ */
+ * ((guint8 *) base_ptr)++ = DW_OP_reg0 + (var->index & 0x001f);
+ * ((guint8 *) base_ptr)++ = DW_OP_piece;
+ * ((guint8 *) base_ptr)++ = sizeof (int);
+ * ((guint8 *) base_ptr)++ = DW_OP_reg0 + ((var->index & 0x1f0) >> 5);
+ * ((guint8 *) base_ptr)++ = DW_OP_piece;
+ * ((guint8 *) base_ptr)++ = sizeof (int);
+ * ((guint8 *) base_ptr)++ = DW_OP_nop;
+ * ((guint8 *) base_ptr)++ = DW_OP_nop;
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+}
+
+void
+mono_debug_update_symbol_file (MonoDebugSymbolFile *symfile,
+ MonoDebugMethodInfoFunc method_info_func,
+ gpointer user_data)
+{
+ const char *reloc_ptr, *reloc_start, *reloc_end;
+ int version, already_relocated = 0;
+ long reloc_size;
+
+ if (!symfile->section_offsets [MONO_DEBUG_SYMBOL_SECTION_MONO_RELOC_TABLE].file_offset)
+ return;
+
+ reloc_ptr = reloc_start = symfile->raw_contents +
+ symfile->section_offsets [MONO_DEBUG_SYMBOL_SECTION_MONO_RELOC_TABLE].file_offset;
+
+ version = *((guint16 *) reloc_ptr)++;
+ if (version != MONO_DEBUG_SYMBOL_FILE_VERSION) {
+ g_warning ("Symbol file %s has incorrect relocation table version "
+ "(expected %d, got %d)", symfile->file_name,
+ MONO_DEBUG_SYMBOL_FILE_VERSION, version);
+ return;
+ }
+
+ already_relocated = *reloc_ptr;
+ *((char *) reloc_ptr)++ = 1;
+
+ reloc_size = *((guint32 *) reloc_ptr)++;
+ reloc_end = reloc_ptr + reloc_size;
+
+ while (reloc_ptr < reloc_end) {
+ int type, size, section, offset;
+ const char *tmp_ptr;
+ char *base_ptr;
+
+ type = *reloc_ptr++;
+ size = * ((guint32 *) reloc_ptr)++;
+
+ tmp_ptr = reloc_ptr;
+ reloc_ptr += size;
+
+ section = *tmp_ptr++;
+ offset = *((guint32 *) tmp_ptr)++;
+
+ if (section >= MONO_DEBUG_SYMBOL_SECTION_MAX) {
+ g_warning ("Symbol file %s contains a relocation entry for unknown section %d",
+ symfile->file_name, section);
+ continue;
+ }
+
+ if (!symfile->section_offsets [section].file_offset) {
+ g_warning ("Symbol file %s contains a relocation entry for non-existing "
+ "section %d", symfile->file_name, section);
+ continue;
+ }
+
+ base_ptr = symfile->raw_contents + symfile->section_offsets [section].file_offset;
+ base_ptr = base_ptr + offset;
+
+ switch (type) {
+ case MRT_target_address_size:
+ * (guint8 *) base_ptr = sizeof (void *);
+ break;
+ case MRT_method_start_address: {
+ int token = *((guint32 *) tmp_ptr)++;
+ MonoDebugMethodInfo *minfo;
+
+ minfo = method_info_func (symfile, token, user_data);
+
+ if (!minfo) {
+ * (void **) base_ptr = 0;
+ continue;
+ }
+
+#if 0
+ g_message ("Start of `%s' relocated to %p", minfo->method->name, minfo->code_start);
+#endif
+
+ * (void **) base_ptr = minfo->code_start;
+
+ break;
+ }
+ case MRT_method_end_address: {
+ int token = *((guint32 *) tmp_ptr)++;
+ MonoDebugMethodInfo *minfo;
+
+ minfo = method_info_func (symfile, token, user_data);
+
+ if (!minfo) {
+ * (void **) base_ptr = 0;
+ continue;
+ }
+
+ * (void **) base_ptr = (char *)minfo->code_start + minfo->code_size;
+
+ break;
+ }
+ case MRT_il_offset: {
+ guint32 token = *((guint32 *) tmp_ptr)++;
+ guint32 original = *((guint32 *) tmp_ptr)++;
+ MonoDebugMethodInfo *minfo;
+ guint32 address;
+ int i;
+
+ minfo = method_info_func (symfile, token, user_data);
+
+ if (!minfo) {
+ * (void **) base_ptr = 0;
+ continue;
+ }
+
+ address = minfo->code_size;
+
+ for (i = 0; i < minfo->num_il_offsets; i++) {
+ MonoDebugILOffsetInfo *il = &minfo->il_offsets [i];
+
+ if (il->offset >= original) {
+ address = il->address;
+ break;
+ }
+ }
+
+#if 0
+ g_message ("Relocating IL offset %04x in `%s' to %d (%p)",
+ original, minfo->method->name, address,
+ minfo->code_start + address);
+#endif
+
+ * (void **) base_ptr = minfo->code_start + address;
+
+ break;
+ }
+ case MRT_local_variable: {
+ guint32 token = *((guint32 *) tmp_ptr)++;
+ guint32 original = *((guint32 *) tmp_ptr)++;
+ MonoDebugMethodInfo *minfo;
+
+ minfo = method_info_func (symfile, token, user_data);
+
+ if (!minfo) {
+ relocate_variable (NULL, base_ptr);
+ continue;
+ }
+
+ if (original > minfo->num_locals) {
+ g_warning ("Symbol file %s contains relocation entry for non-existing "
+ "local variable %d, but method %s only has %d local variables.",
+ symfile->file_name, original, minfo->method->name,
+ minfo->num_locals);
+ continue;
+ }
+
+ relocate_variable (&minfo->locals [original], base_ptr);
+
+ break;
+ }
+ case MRT_method_parameter: {
+ guint32 token = *((guint32 *) tmp_ptr)++;
+ guint32 original = *((guint32 *) tmp_ptr)++;
+ MonoDebugMethodInfo *minfo;
+
+ minfo = method_info_func (symfile, token, user_data);
+
+ if (!minfo) {
+ relocate_variable (NULL, base_ptr);
+ continue;
+ }
+
+ if (minfo->method->signature->hasthis) {
+ if (original == 0) {
+ relocate_variable (minfo->this_var, base_ptr);
+ continue;
+ }
+
+ original--;
+ }
+
+ if (original > minfo->num_params) {
+ g_warning ("Symbol file %s contains relocation entry for non-existing "
+ "parameter %d, but method %s only has %d parameters.",
+ symfile->file_name, original, minfo->method->name,
+ minfo->num_params);
+ continue;
+ }
+
+ relocate_variable (&minfo->params [original], base_ptr);
+
+ break;
+ }
+ case MRT_type_sizeof: {
+ guint32 token = *((guint32 *) tmp_ptr)++;
+ MonoClass *klass = mono_debug_class_get (symfile, token);
+
+ if (!klass)
+ continue;
+
+ mono_class_init (klass);
+
+ if (klass->enumtype || klass->valuetype)
+ * (gint8 *) base_ptr = klass->instance_size - sizeof (MonoObject);
+ else
+ * (gint8 *) base_ptr = klass->instance_size;
+
+ break;
+ }
+ case MRT_type_field_offset: {
+ guint32 token = *((guint32 *) tmp_ptr)++;
+ guint32 original = *((guint32 *) tmp_ptr)++;
+ MonoClass *klass = mono_debug_class_get (symfile, token);
+ guint32 off;
+
+ if (!klass)
+ continue;
+
+ mono_class_init (klass);
+
+ if (original > klass->field.count) {
+ g_warning ("Symbol file %s contains invalid field offset entry.",
+ symfile->file_name);
+ continue;
+ }
+
+ if (!klass->fields)
+ continue;
+
+ off = klass->fields [original].offset;
+ if (klass->byval_arg.type == MONO_TYPE_VALUETYPE)
+ off -= sizeof (MonoObject);
+
+#if 0
+ g_message ("Setting field %d of type %u to offset %d", original,
+ token, off);
+#endif
+
+ * (guint32 *) base_ptr = off;
+
+ break;
+ }
+ case MRT_mono_string_sizeof:
+ * (gint8 *) base_ptr = sizeof (MonoString);
+ break;
+
+ case MRT_mono_string_offset: {
+ guint32 idx = *((guint32 *) tmp_ptr)++;
+ MonoString string;
+ guint32 off;
+
+ switch (idx) {
+ case MRI_string_offset_length:
+ off = (guchar *) &string.length - (guchar *) &string;
+ break;
+
+ case MRI_string_offset_vector:
+ // fixme: don know how to fix this
+ g_assert_not_reached ();
+ //off = (guchar *) &string.c_str - (guchar *) &string;
+ break;
+
+ default:
+ g_warning ("Symbol file %s contains invalid string offset entry",
+ symfile->file_name);
+ continue;
+ }
+
+ * (guint32 *) base_ptr = off;
+
+ break;
+ }
+ case MRT_mono_array_sizeof:
+ * (gint8 *) base_ptr = sizeof (MonoArray);
+ break;
+
+ case MRT_mono_array_offset: {
+ guint32 idx = *((guint32 *) tmp_ptr)++;
+ MonoArray array;
+ guint32 off;
+
+ switch (idx) {
+ case MRI_array_offset_bounds:
+ off = (guchar *) &array.bounds - (guchar *) &array;
+ break;
+
+ case MRI_array_offset_max_length:
+ off = (guchar *) &array.max_length - (guchar *) &array;
+ break;
+
+ case MRI_array_offset_vector:
+ off = (guchar *) &array.vector - (guchar *) &array;
+ break;
+
+ default:
+ g_warning ("Symbol file %s contains invalid array offset entry",
+ symfile->file_name);
+ continue;
+ }
+
+ * (guint32 *) base_ptr = off;
+
+ break;
+ }
+
+ case MRT_mono_array_bounds_sizeof:
+ * (gint8 *) base_ptr = sizeof (MonoArrayBounds);
+ break;
+
+ case MRT_mono_array_bounds_offset: {
+ guint32 idx = *((guint32 *) tmp_ptr)++;
+ MonoArrayBounds bounds;
+ guint32 off;
+
+ switch (idx) {
+ case MRI_array_bounds_offset_lower:
+ off = (guchar *) &bounds.lower_bound - (guchar *) &bounds;
+ break;
+
+ case MRI_array_bounds_offset_length:
+ off = (guchar *) &bounds.length - (guchar *) &bounds;
+ break;
+
+ default:
+ g_warning ("Symbol file %s contains invalid array bounds offset entry",
+ symfile->file_name);
+ continue;
+ }
+
+ * (guint32 *) base_ptr = off;
+
+ break;
+ }
+
+ case MRT_variable_start_scope: {
+ guint32 token = *((guint32 *) tmp_ptr)++;
+ guint32 original = *((guint32 *) tmp_ptr)++;
+ MonoDebugMethodInfo *minfo;
+ gint32 address;
+
+ minfo = method_info_func (symfile, token, user_data);
+
+ if (!minfo) {
+ * (void **) base_ptr = 0;
+ continue;
+ }
+
+ if (original > minfo->num_locals) {
+ g_warning ("Symbol file %s contains relocation entry for non-existing "
+ "local variable %d, but method %s only has %d local variables.",
+ symfile->file_name, original, minfo->method->name,
+ minfo->num_locals);
+ continue;
+ }
+
+ address = minfo->locals [original].begin_scope;
+
+ * (void **) base_ptr = minfo->code_start + address;
+
+ break;
+ }
+
+ case MRT_variable_end_scope: {
+ guint32 token = *((guint32 *) tmp_ptr)++;
+ guint32 original = *((guint32 *) tmp_ptr)++;
+ MonoDebugMethodInfo *minfo;
+ gint32 address;
+
+ minfo = method_info_func (symfile, token, user_data);
+
+ if (!minfo) {
+ * (void **) base_ptr = 0;
+ continue;
+ }
+
+ if (original > minfo->num_locals) {
+ g_warning ("Symbol file %s contains relocation entry for non-existing "
+ "local variable %d, but method %s only has %d local variables.",
+ symfile->file_name, original, minfo->method->name,
+ minfo->num_locals);
+ continue;
+ }
+
+ address = minfo->locals [original].end_scope;
+
+ * (void **) base_ptr = minfo->code_start + address;
+
+ break;
+ }
+
+ case MRT_mono_string_fieldsize: {
+ guint32 idx = *((guint32 *) tmp_ptr)++;
+ MonoString string;
+ guint32 fieldsize;
+
+ switch (idx) {
+ case MRI_string_offset_length:
+ fieldsize = sizeof (string.length);
+ break;
+
+ case MRI_string_offset_vector:
+ // fixme:
+ //fieldsize = sizeof (string.c_str);
+ g_assert_not_reached ();
+ break;
+
+ default:
+ g_warning ("Symbol file %s contains invalid string fieldsize entry",
+ symfile->file_name);
+ continue;
+ }
+
+ * (guint32 *) base_ptr = fieldsize;
+
+ break;
+ }
+
+ case MRT_mono_array_fieldsize: {
+ guint32 idx = *((guint32 *) tmp_ptr)++;
+ MonoArray array;
+ guint32 fieldsize;
+
+ switch (idx) {
+ case MRI_array_offset_bounds:
+ fieldsize = sizeof (array.bounds);
+ break;
+
+ case MRI_array_offset_max_length:
+ fieldsize = sizeof (array.max_length);
+ break;
+
+ case MRI_array_offset_vector:
+ fieldsize = sizeof (array.vector);
+ break;
+
+ default:
+ g_warning ("Symbol file %s contains invalid array fieldsize entry",
+ symfile->file_name);
+ continue;
+ }
+
+ * (guint32 *) base_ptr = fieldsize;
+
+ break;
+ }
+
+
+ default:
+ g_warning ("Symbol file %s contains unknown relocation entry %d",
+ symfile->file_name, type);
+ break;
+ }
+ }
+
+ mono_raw_buffer_update (symfile->raw_contents, symfile->raw_contents_size);
+}
+
+MonoReflectionType *
+ves_icall_Debugger_MonoSymbolWriter_get_local_type_from_sig (MonoReflectionAssembly *assembly,
+ MonoArray *signature)
+{
+ MonoDomain *domain;
+ MonoImage *image;
+ MonoType *type;
+ const char *ptr;
+ int len = 0;
+
+ MONO_CHECK_ARG_NULL (assembly);
+ MONO_CHECK_ARG_NULL (signature);
+
+ domain = mono_domain_get();
+ image = assembly->assembly->image;
+
+ ptr = mono_array_addr (signature, char, 0);
+ g_assert (*ptr++ == 0x07);
+ len = mono_metadata_decode_value (ptr, &ptr);
+ g_assert (len == 1);
+
+ type = mono_metadata_parse_type (image, MONO_PARSE_LOCAL, 0, ptr, &ptr);
+
+ return mono_type_get_object (domain, type);
+}
+
+MonoReflectionMethod *
+ves_icall_Debugger_MonoSymbolWriter_method_from_token (MonoReflectionAssembly *assembly, guint32 token)
+{
+ MonoDomain *domain;
+ MonoImage *image;
+ MonoMethod *method;
+
+ MONO_CHECK_ARG_NULL (assembly);
+
+ domain = mono_domain_get();
+ image = assembly->assembly->image;
+
+ method = mono_get_method (image, token, NULL);
+
+ return mono_method_get_object (domain, method);
+}
+
+guint32
+ves_icall_Debugger_DwarfFileWriter_get_type_token (MonoReflectionType *type)
+{
+ MonoClass *klass = mono_class_from_mono_type (type->type);
+
+ mono_class_init (klass);
+
+ return klass->type_token;
+}
diff --git a/mono/metadata/debug-symfile.h b/mono/metadata/debug-symfile.h
new file mode 100644
index 00000000000..ce44d43872a
--- /dev/null
+++ b/mono/metadata/debug-symfile.h
@@ -0,0 +1,128 @@
+#ifndef __MONO_DEBUG_SYMFILE_H__
+#define __MONO_DEBUG_SYMFILE_H__
+
+#include <glib.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/reflection.h>
+
+typedef struct MonoDebugSymbolFile MonoDebugSymbolFile;
+typedef struct MonoDebugSymbolFileSection MonoDebugSymbolFileSection;
+typedef struct MonoDebugMethodInfo MonoDebugMethodInfo;
+typedef struct MonoDebugVarInfo MonoDebugVarInfo;
+typedef struct MonoDebugILOffsetInfo MonoDebugILOffsetInfo;
+
+/* Machine dependent information about a method.
+ *
+ * This structure is created by the MonoDebugMethodInfoFunc callback of
+ * mono_debug_update_symbol_file (). */
+struct MonoDebugMethodInfo {
+ MonoMethod *method;
+ char *code_start;
+ guint32 code_size;
+ guint32 num_params;
+ MonoDebugVarInfo *this_var;
+ MonoDebugVarInfo *params;
+ guint32 num_locals;
+ MonoDebugVarInfo *locals;
+ guint32 num_il_offsets;
+ MonoDebugILOffsetInfo *il_offsets;
+ guint32 prologue_end;
+ guint32 epilogue_begin;
+ gpointer _priv;
+};
+
+/*
+ * These bits of the MonoDebugLocalInfo's "index" field are flags specifying
+ * where the variable is actually stored.
+ *
+ * See relocate_variable() in debug-symfile.c for more info.
+ */
+#define MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS 0xf0000000
+
+/* If "index" is zero, the variable is at stack offset "offset". */
+#define MONO_DEBUG_VAR_ADDRESS_MODE_STACK 0
+
+/* The variable is in the register whose number is contained in bits 0..4 of the
+ * "index" field plus an offset of "offset" (which can be zero).
+ */
+#define MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER 0x10000000
+
+/* The variables in in the two registers whose numbers are contained in bits 0..4
+ * and 5..9 of the "index" field plus an offset of "offset" (which can be zero).
+ */
+#define MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS 0x20000000
+
+struct MonoDebugVarInfo {
+ guint32 index;
+ guint32 offset;
+ guint32 begin_scope;
+ guint32 end_scope;
+};
+
+struct MonoDebugILOffsetInfo {
+ guint32 offset;
+ guint32 address;
+};
+
+struct MonoDebugSymbolFile {
+ int fd;
+ char *file_name;
+ MonoImage *image;
+ /* Pointer to the mmap()ed contents of the file. */
+ char *raw_contents;
+ size_t raw_contents_size;
+ /* Array of MONO_DEBUG_SYMBOL_SECTION_MAX elements. */
+ MonoDebugSymbolFileSection *section_offsets;
+ gpointer user_data;
+};
+
+struct MonoDebugSymbolFileSection {
+ int type;
+ gulong file_offset;
+ gulong size;
+};
+
+#define MONO_DEBUG_SYMBOL_FILE_VERSION 9
+
+/* Keep in sync with Mono.CSharp.Debugger.MonoDwarfFileWriter.Section */
+#define MONO_DEBUG_SYMBOL_SECTION_DEBUG_INFO 0x01
+#define MONO_DEBUG_SYMBOL_SECTION_DEBUG_ABBREV 0x02
+#define MONO_DEBUG_SYMBOL_SECTION_DEBUG_LINE 0x03
+#define MONO_DEBUG_SYMBOL_SECTION_MONO_RELOC_TABLE 0x04
+
+#define MONO_DEBUG_SYMBOL_SECTION_MAX 0x05
+
+/* Tries to load `filename' as a debugging information file, if `emit_warnings" is set,
+ * use g_warning() to signal error messages on failure, otherwise silently return NULL. */
+MonoDebugSymbolFile *mono_debug_open_symbol_file (MonoImage *image,
+ const char *filename,
+ gboolean emit_warnings);
+
+/* This callback function needs to return a MonoDebugMethodInfo structure containing the
+ * machine-dependent information about method associated with the metadata_token.
+ * It's highly recommended to cache the generated data since this function can be called
+ * several times per method. */
+typedef MonoDebugMethodInfo * (*MonoDebugMethodInfoFunc) (MonoDebugSymbolFile *symbol_file,
+ guint32 metadata_token,
+ gpointer user_data);
+
+void mono_debug_update_symbol_file (MonoDebugSymbolFile *symbol_file,
+ MonoDebugMethodInfoFunc method_info_func,
+ gpointer user_data);
+
+void mono_debug_close_symbol_file (MonoDebugSymbolFile *symbol_file);
+
+MonoReflectionType *
+ves_icall_Debugger_MonoSymbolWriter_get_local_type_from_sig (MonoReflectionAssembly *assembly,
+ MonoArray *signature);
+
+MonoReflectionMethod *
+ves_icall_Debugger_MonoSymbolWriter_method_from_token (MonoReflectionAssembly *assembly,
+ guint32 token);
+
+guint32
+ves_icall_Debugger_DwarfFileWriter_get_type_token (MonoReflectionType *type);
+
+
+#endif /* __MONO_DEBUG_SYMFILE_H__ */
+
diff --git a/mono/metadata/decimal.c b/mono/metadata/decimal.c
new file mode 100644
index 00000000000..9d37b88380b
--- /dev/null
+++ b/mono/metadata/decimal.c
@@ -0,0 +1,1517 @@
+/*
+ decimal.c
+
+ conversions and numerical operations for the c# type System.Decimal
+
+ Author: Martin Weindel (martin.weindel@t-online.de)
+
+ (C) 2001 by Martin Weindel
+*/
+
+/*
+ * machine dependent configuration for
+ * CSharp value type System.Decimal
+ */
+
+#include <stdio.h>
+#include <memory.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+/* needed for building microsoft dll */
+#define DECINLINE __inline
+
+#define LIT_GUINT32(x) x
+#define LIT_GUINT64(x) x##L
+
+
+/* we need a UInt64 type => guint64 */
+#include <glib.h>
+
+#include "decimal.h"
+
+/*
+ * Deal with anon union support.
+ */
+#define ss32 u.ss32
+#define signscale u.signscale
+
+/* debugging stuff */
+#ifdef _DEBUG
+#include <assert.h>
+#define PRECONDITION(flag) assert(flag)
+#define POSTCONDITION(flag) assert(flag)
+#define TEST(flag) assert(flag)
+#define INVARIANT_TEST(p) assert(p->signscale.scale >= 0 && p->signscale.scale <= DECIMAL_MAX_SCALE \
+ && p->signscale.reserved1 == 0 && p->signscale.reserved2 == 0);
+#else
+#define PRECONDITION(flag)
+#define POSTCONDITION(flag)
+#define TEST(flag)
+#define INVARIANT_TEST(p)
+#endif //#ifdef _DEBUG
+
+#define DECIMAL_MAX_SCALE 28
+#define DECIMAL_MAX_INTFACTORS 9
+
+#define DECIMAL_SUCCESS 0
+#define DECIMAL_FINISHED 1
+#define DECIMAL_OVERFLOW 2
+#define DECIMAL_INVALID_CHARACTER 2
+#define DECIMAL_INTERNAL_ERROR 3
+#define DECIMAL_INVALID_BITS 4
+#define DECIMAL_DIVIDE_BY_ZERO 5
+#define DECIMAL_BUFFER_OVERFLOW 6
+
+/* some MACROS */
+#define DECINIT(src) memset(src, 0, sizeof(decimal_repr))
+
+#define DECCOPY(dest, src) memcpy(dest, src, sizeof(decimal_repr))
+
+#define DECSWAP(p1, p2, h) \
+ h = (p1)->ss32; (p1)->ss32 = (p2)->ss32; (p2)->ss32 = h; \
+ h = (p1)->hi32; (p1)->hi32 = (p2)->hi32; (p2)->hi32 = h; \
+ h = (p1)->mid32; (p1)->mid32 = (p2)->mid32; (p2)->mid32 = h; \
+ h = (p1)->lo32; (p1)->lo32 = (p2)->lo32; (p2)->lo32 = h;
+
+#define DECNEGATE(p1) (p1)->signscale.sign = 1 - (p1)->signscale.sign
+
+#define LIT_DEC128(hi, mid, lo) { (((guint64)mid)<<32 | lo), hi }
+
+#define DECTO128(pd, lo, hi) \
+ lo = (((guint64)(pd)->mid32) << 32) | (pd)->lo32; \
+ hi = (pd)->hi32;
+
+/* some constants */
+#define LIT_GUINT32_HIGHBIT LIT_GUINT32(0x80000000)
+#define LIT_GUINT64_HIGHBIT LIT_GUINT64(0x8000000000000000)
+
+#define DECIMAL_LOG_NEGINF -1000
+
+static guint32 constantsDecadeInt32Factors[DECIMAL_MAX_INTFACTORS+1] = {
+ LIT_GUINT32(1), LIT_GUINT32(10), LIT_GUINT32(100), LIT_GUINT32(1000),
+ LIT_GUINT32(10000), LIT_GUINT32(100000), LIT_GUINT32(1000000),
+ LIT_GUINT32(10000000), LIT_GUINT32(100000000), LIT_GUINT32(1000000000)
+};
+
+typedef struct {
+ guint64 lo;
+ guint64 hi;
+} dec128_repr;
+
+static dec128_repr dec128decadeFactors[DECIMAL_MAX_SCALE+1] = {
+ LIT_DEC128( 0, 0, 1u), /* == 1 */
+ LIT_DEC128( 0, 0, 10u), /* == 10 */
+ LIT_DEC128( 0, 0, 100u), /* == 100 */
+ LIT_DEC128( 0, 0, 1000u), /* == 1e3m */
+ LIT_DEC128( 0, 0, 10000u), /* == 1e4m */
+ LIT_DEC128( 0, 0, 100000u), /* == 1e5m */
+ LIT_DEC128( 0, 0, 1000000u), /* == 1e6m */
+ LIT_DEC128( 0, 0, 10000000u), /* == 1e7m */
+ LIT_DEC128( 0, 0, 100000000u), /* == 1e8m */
+ LIT_DEC128( 0, 0, 1000000000u), /* == 1e9m */
+ LIT_DEC128( 0, 2u, 1410065408u), /* == 1e10m */
+ LIT_DEC128( 0, 23u, 1215752192u), /* == 1e11m */
+ LIT_DEC128( 0, 232u, 3567587328u), /* == 1e12m */
+ LIT_DEC128( 0, 2328u, 1316134912u), /* == 1e13m */
+ LIT_DEC128( 0, 23283u, 276447232u), /* == 1e14m */
+ LIT_DEC128( 0, 232830u, 2764472320u), /* == 1e15m */
+ LIT_DEC128( 0, 2328306u, 1874919424u), /* == 1e16m */
+ LIT_DEC128( 0, 23283064u, 1569325056u), /* == 1e17m */
+ LIT_DEC128( 0, 232830643u, 2808348672u), /* == 1e18m */
+ LIT_DEC128( 0, 2328306436u, 2313682944u), /* == 1e19m */
+ LIT_DEC128( 5u, 1808227885u, 1661992960u), /* == 1e20m */
+ LIT_DEC128( 54u, 902409669u, 3735027712u), /* == 1e21m */
+ LIT_DEC128( 542u, 434162106u, 2990538752u), /* == 1e22m */
+ LIT_DEC128( 5421u, 46653770u, 4135583744u), /* == 1e23m */
+ LIT_DEC128( 54210u, 466537709u, 2701131776u), /* == 1e24m */
+ LIT_DEC128( 542101u, 370409800u, 1241513984u), /* == 1e25m */
+ LIT_DEC128( 5421010u, 3704098002u, 3825205248u), /* == 1e26m */
+ LIT_DEC128( 54210108u, 2681241660u, 3892314112u), /* == 1e27m */
+ LIT_DEC128( 542101086u, 1042612833u, 268435456u), /* == 1e28m */
+};
+
+/* 192 bit addition: c = a + b
+ addition is modulo 2**128, any carry is lost */
+DECINLINE static void add128(guint64 alo, guint64 ahi,
+ guint64 blo, guint64 bhi,
+ guint64* pclo, guint64* pchi)
+{
+ alo += blo;
+ if (alo < blo) ahi++; /* carry */
+ ahi += bhi;
+
+ *pclo = alo;
+ *pchi = ahi;
+}
+
+/* 128 bit subtraction: c = a - b
+ subtraction is modulo 2**128, any carry is lost */
+DECINLINE static void sub128(guint64 alo, guint64 ahi,
+ guint64 blo, guint64 bhi,
+ guint64* pclo, guint64* pchi)
+{
+ guint64 clo, chi;
+
+ clo = alo - blo;
+ chi = ahi - bhi;
+ if (alo < blo) chi--; /* borrow */
+
+ *pclo = clo;
+ *pchi = chi;
+}
+
+/* 192 bit addition: c = a + b
+ addition is modulo 2**192, any carry is lost */
+DECINLINE static void add192(guint64 alo, guint64 ami, guint64 ahi,
+ guint64 blo, guint64 bmi, guint64 bhi,
+ guint64* pclo, guint64* pcmi, guint64* pchi)
+{
+ alo += blo;
+ if (alo < blo) { /* carry low */
+ ami++;
+ if (ami == 0) ahi++; /* carry mid */
+ }
+ ami += bmi;
+ if (ami < bmi) ahi++; /* carry mid */
+ ahi += bhi;
+ *pclo = alo;
+ *pcmi = ami;
+ *pchi = ahi;
+}
+
+/* 192 bit subtraction: c = a - b
+ subtraction is modulo 2**192, any carry is lost */
+DECINLINE static void sub192(guint64 alo, guint64 ami, guint64 ahi,
+ guint64 blo, guint64 bmi, guint64 bhi,
+ guint64* pclo, guint64* pcmi, guint64* pchi)
+{
+ guint64 clo, cmi, chi;
+
+ clo = alo - blo;
+ cmi = ami - bmi;
+ chi = ahi - bhi;
+ if (alo < blo) {
+ if (cmi == 0) chi--; /* borrow mid */
+ cmi--; /* borrow low */
+ }
+ if (ami < bmi) chi--; /* borrow mid */
+ *pclo = clo;
+ *pcmi = cmi;
+ *pchi = chi;
+}
+
+/* multiplication c(192bit) = a(96bit) * b(96bit) */
+DECINLINE static void mult96by96to192(guint32 alo, guint32 ami, guint32 ahi,
+ guint32 blo, guint32 bmi, guint32 bhi,
+ guint64* pclo, guint64* pcmi, guint64* pchi)
+{
+ guint64 a, b, c, d;
+ guint32 h0, h1, h2, h3, h4, h5;
+ int carry0, carry1;
+
+ a = ((guint64)alo) * blo;
+ h0 = (guint32) a;
+
+ a >>= 32; carry0 = 0;
+ b = ((guint64)alo) * bmi;
+ c = ((guint64)ami) * blo;
+ a += b; if (a < b) carry0++;
+ a += c; if (a < c) carry0++;
+ h1 = (guint32) a;
+
+ a >>= 32; carry1 = 0;
+ b = ((guint64)alo) * bhi;
+ c = ((guint64)ami) * bmi;
+ d = ((guint64)ahi) * blo;
+ a += b; if (a < b) carry1++;
+ a += c; if (a < c) carry1++;
+ a += d; if (a < d) carry1++;
+ h2 = (guint32) a;
+
+ a >>= 32; a += carry0; carry0 = 0;
+ b = ((guint64)ami) * bhi;
+ c = ((guint64)ahi) * bmi;
+ a += b; if (a < b) carry0++;
+ a += c; if (a < c) carry0++;
+ h3 = (guint32) a;
+
+ a >>= 32; a += carry1;
+ b = ((guint64)ahi) * bhi;
+ a += b;
+ h4 = (guint32) a;
+
+ a >>= 32; a += carry0;
+ h5 = (guint32) a;
+
+ *pclo = ((guint64)h1) << 32 | h0;
+ *pcmi = ((guint64)h3) << 32 | h2;
+ *pchi = ((guint64)h5) << 32 | h4;
+}
+
+/* multiplication c(128bit) = a(96bit) * b(32bit) */
+DECINLINE static void mult96by32to128(guint32 alo, guint32 ami, guint32 ahi,
+ guint32 factor,
+ guint64* pclo, guint64* pchi)
+{
+ guint64 a;
+ guint32 h0, h1;
+
+ a = ((guint64)alo) * factor;
+ h0 = (guint32) a;
+
+ a >>= 32;
+ a += ((guint64)ami) * factor;
+ h1 = (guint32) a;
+
+ a >>= 32;
+ a += ((guint64)ahi) * factor;
+
+ *pclo = ((guint64)h1) << 32 | h0;
+ *pchi = a;
+}
+
+/* multiplication c(128bit) *= b(32bit) */
+DECINLINE static int mult128by32(guint64* pclo, guint64* pchi, guint32 factor, int roundBit)
+{
+ guint64 a;
+ guint32 h0, h1;
+
+ a = ((guint64)(guint32)(*pclo)) * factor;
+ if (roundBit) a += factor / 2;
+ h0 = (guint32) a;
+
+ a >>= 32;
+ a += (*pclo >> 32) * factor;
+ h1 = (guint32) a;
+
+ *pclo = ((guint64)h1) << 32 | h0;
+
+ a >>= 32;
+ a += ((guint64)(guint32)(*pchi)) * factor;
+ h0 = (guint32) a;
+
+ a >>= 32;
+ a += (*pchi >> 32) * factor;
+ h1 = (guint32) a;
+
+ *pchi = ((guint64)h1) << 32 | h0;
+
+ return ((a >> 32) == 0) ? DECIMAL_SUCCESS : DECIMAL_OVERFLOW;
+}
+
+DECINLINE static int mult128DecadeFactor(guint64* pclo, guint64* pchi, int powerOfTen)
+{
+ int idx, rc;
+
+ while (powerOfTen > 0) {
+ idx = (powerOfTen >= DECIMAL_MAX_INTFACTORS) ? DECIMAL_MAX_INTFACTORS : powerOfTen;
+ powerOfTen -= idx;
+ rc = mult128by32(pclo, pchi, constantsDecadeInt32Factors[idx], 0);
+ if (rc != DECIMAL_SUCCESS) return rc;
+ }
+ return DECIMAL_SUCCESS;
+}
+
+/* division: x(128bit) /= factor(32bit)
+ returns roundBit */
+DECINLINE static int div128by32(guint64* plo, guint64* phi, guint32 factor, guint32* pRest)
+{
+ guint64 a, b, c, h;
+
+ h = *phi;
+ a = (guint32)(h >> 32);
+ b = a / factor;
+ a -= b * factor;
+ a <<= 32;
+ a |= (guint32) h;
+ c = a / factor;
+ a -= c * factor;
+ a <<= 32;
+ *phi = b << 32 | (guint32)c;
+
+ h = *plo;
+ a |= (guint32)(h >> 32);
+ b = a / factor;
+ a -= b * factor;
+ a <<= 32;
+ a |= (guint32) h;
+ c = a / factor;
+ a -= c * factor;
+ *plo = b << 32 | (guint32)c;
+
+ if (pRest) *pRest = (guint32) a;
+
+ a <<= 1;
+ return (a > factor || (a == factor && (c & 1) == 1)) ? 1 : 0;
+}
+
+/* division: x(192bit) /= factor(32bit)
+ no rest and no rounding*/
+DECINLINE static void div192by32(guint64* plo, guint64* pmi, guint64* phi,
+ guint32 factor)
+{
+ guint64 a, b, c, h;
+
+ h = *phi;
+ a = (guint32)(h >> 32);
+ b = a / factor;
+ a -= b * factor;
+ a <<= 32;
+ a |= (guint32) h;
+ c = a / factor;
+ a -= c * factor;
+ a <<= 32;
+ *phi = b << 32 | (guint32)c;
+
+ h = *pmi;
+ a |= (guint32)(h >> 32);
+ b = a / factor;
+ a -= b * factor;
+ a <<= 32;
+ a |= (guint32) h;
+ c = a / factor;
+ a -= c * factor;
+ a <<= 32;
+ *pmi = b << 32 | (guint32)c;
+
+ h = *plo;
+ a |= (guint32)(h >> 32);
+ b = a / factor;
+ a -= b * factor;
+ a <<= 32;
+ a |= (guint32) h;
+ c = a / factor;
+ a -= c * factor;
+ a <<= 32;
+ *plo = b << 32 | (guint32)c;
+}
+
+/* returns upper 32bit for a(192bit) /= b(32bit)
+ a will contain remainder */
+static guint32 div192by96to32withRest(guint64* palo, guint64* pami, guint64* pahi,
+ guint32 blo, guint32 bmi, guint32 bhi)
+{
+ guint64 rlo, rmi, rhi; /* remainder */
+ guint64 tlo, thi; /* term */
+ guint32 c;
+
+ rlo = *palo; rmi = *pami; rhi = *pahi;
+ if (rhi >= (((guint64)bhi) << 32)) {
+ c = LIT_GUINT32(0xFFFFFFFF);
+ } else {
+ c = (guint32) (rhi / bhi);
+ }
+ mult96by32to128(blo, bmi, bhi, c, &tlo, &thi);
+ sub192(rlo, rmi, rhi, 0, tlo, thi, &rlo, &rmi, &rhi);
+ while (((gint64)rhi) < 0) {
+ c--;
+ add192(rlo, rmi, rhi, 0, (((guint64)bmi)<<32) | blo, bhi, &rlo, &rmi, &rhi);
+ }
+ *palo = rlo ; *pami = rmi ; *pahi = rhi;
+
+ POSTCONDITION(rhi >> 32 == 0);
+
+ return c;
+}
+
+/* c(128bit) = a(192bit) / b(96bit)
+ b must be >= 2^95 */
+static void div192by96to128(guint64 alo, guint64 ami, guint64 ahi,
+ guint32 blo, guint32 bmi, guint32 bhi,
+ guint64* pclo, guint64* pchi)
+{
+ guint64 rlo, rmi, rhi; /* remainder */
+ guint32 h, c;
+
+ PRECONDITION(ahi < (((guint64)bhi) << 32 | bmi)
+ || (ahi == (((guint64)bhi) << 32 | bmi) && (ami >> 32) > blo));
+
+ /* high 32 bit*/
+ rlo = alo; rmi = ami; rhi = ahi;
+ h = div192by96to32withRest(&rlo, &rmi, &rhi, blo, bmi, bhi);
+
+ /* mid 32 bit*/
+ rhi = (rhi << 32) | (rmi >> 32); rmi = (rmi << 32) | (rlo >> 32); rlo <<= 32;
+ *pchi = (((guint64)h) << 32) | div192by96to32withRest(&rlo, &rmi, &rhi, blo, bmi, bhi);
+
+ /* low 32 bit */
+ rhi = (rhi << 32) | (rmi >> 32); rmi = (rmi << 32) | (rlo >> 32); rlo <<= 32;
+ h = div192by96to32withRest(&rlo, &rmi, &rhi, blo, bmi, bhi);
+
+ /* estimate lowest 32 bit (two last bits may be wrong) */
+ if (rhi >= bhi) {
+ c = LIT_GUINT32(0xFFFFFFFF);
+ } else {
+ rhi <<= 32;
+ c = (guint32) (rhi / bhi);
+ }
+ *pclo = (((guint64)h) << 32) | c;
+}
+
+DECINLINE static void roundUp128(guint64* pclo, guint64* pchi) {
+ if (++(*pclo) == 0) ++(*pchi);
+}
+
+static int normalize128(guint64* pclo, guint64* pchi, int* pScale,
+ int roundFlag, int roundBit)
+{
+ guint32 overhang = (guint32)(*pchi >> 32);
+ int scale = *pScale;
+ int deltaScale;
+
+ while (overhang != 0) {
+ for (deltaScale = 1; deltaScale < DECIMAL_MAX_INTFACTORS; deltaScale++)
+ {
+ if (overhang < constantsDecadeInt32Factors[deltaScale]) break;
+ }
+
+ scale -= deltaScale;
+ if (scale < 0) return DECIMAL_OVERFLOW;
+
+ roundBit = div128by32(pclo, pchi, constantsDecadeInt32Factors[deltaScale], 0);
+
+ overhang = (guint32)(*pchi >> 32);
+ if (roundFlag && roundBit && *pclo == (guint64)-1 && (gint32)*pchi == (gint32)-1) {
+ overhang = 1;
+ }
+ }
+
+ *pScale = scale;
+
+ if (roundFlag && roundBit) {
+ roundUp128(pclo, pchi);
+ TEST((*pchi >> 32) == 0);
+ }
+
+ return DECIMAL_SUCCESS;
+}
+
+DECINLINE static int maxLeftShift(/*[In, Out]*/decimal_repr* pA)
+{
+ guint64 lo64 = (((guint64)(pA->mid32)) << 32) | pA->lo32;
+ guint32 hi32 = pA->hi32;
+ int shift;
+
+ for (shift = 0; ((gint32)hi32) >= 0 && shift < 96; shift++) {
+ hi32 <<= 1;
+ if (((gint64)lo64) < 0) hi32++;
+ lo64 <<= 1;
+ }
+
+ pA->lo32 = (guint32) lo64;
+ pA->mid32 = (guint32)(lo64>>32);
+ pA->hi32 = hi32;
+
+ return shift;
+}
+
+DECINLINE static void rshift128(guint64* pclo, guint64* pchi)
+{
+ *pclo >>= 1;
+ if (*pchi & 1) *pclo |= LIT_GUINT64_HIGHBIT;
+ *pchi >>= 1;
+}
+
+DECINLINE static void lshift96(guint32* pclo, guint32* pcmid, guint32* pchi)
+{
+ *pchi <<= 1;
+ if (*pcmid & LIT_GUINT32_HIGHBIT) (*pchi)++;
+ *pcmid <<= 1;
+ if (*pclo & LIT_GUINT32_HIGHBIT) (*pcmid)++;
+ *pclo <<= 1;
+}
+
+DECINLINE static void lshift128(guint64* pclo, guint64* pchi)
+{
+ *pchi <<= 1;
+ if (*pclo & LIT_GUINT64_HIGHBIT) (*pchi)++;
+ *pclo <<= 1;
+}
+
+DECINLINE static void rshift192(guint64* pclo, guint64* pcmi, guint64* pchi)
+{
+ *pclo >>= 1;
+ if (*pcmi & 1) *pclo |= LIT_GUINT64_HIGHBIT;
+ *pcmi >>= 1;
+ if (*pchi & 1) *pcmi |= LIT_GUINT64_HIGHBIT;
+ *pchi >>= 1;
+}
+
+/* returns log2(a) or DECIMAL_LOG_NEGINF for a = 0 */
+DECINLINE static int log2_32(guint32 a)
+{
+ int tlog2 = 0;
+
+ if (a == 0) return DECIMAL_LOG_NEGINF;
+
+ if ((a >> 16) != 0) {
+ a >>= 16;
+ tlog2 += 16;
+ }
+ if ((a >> 8) != 0) {
+ a >>= 8;
+ tlog2 += 8;
+ }
+ if ((a >> 4) != 0) {
+ a >>= 4;
+ tlog2 += 4;
+ }
+ if ((a >> 2) != 0) {
+ a >>= 2;
+ tlog2 += 2;
+ }
+ if ((a >> 1) != 0) {
+ a >>= 1;
+ tlog2 += 1;
+ }
+ tlog2 += (int) a;
+
+ return tlog2;
+}
+
+/* returns log2(a) or DECIMAL_LOG_NEGINF for a = 0 */
+DECINLINE static int log2_64(guint64 a)
+{
+ int tlog2 = 0;
+
+ if (a == 0) return DECIMAL_LOG_NEGINF;
+
+ if ((a >> 32) != 0) {
+ a >>= 32;
+ tlog2 += 32;
+ }
+ if ((a >> 16) != 0) {
+ a >>= 16;
+ tlog2 += 16;
+ }
+ if ((a >> 8) != 0) {
+ a >>= 8;
+ tlog2 += 8;
+ }
+ if ((a >> 4) != 0) {
+ a >>= 4;
+ tlog2 += 4;
+ }
+ if ((a >> 2) != 0) {
+ a >>= 2;
+ tlog2 += 2;
+ }
+ if ((a >> 1) != 0) {
+ a >>= 1;
+ tlog2 += 1;
+ }
+ tlog2 += (int) a;
+
+ return tlog2;
+}
+
+/* returns log2(a) or DECIMAL_LOG_NEGINF for a = 0 */
+DECINLINE static int log2_128(guint64 alo, guint64 ahi)
+{
+ if (ahi == 0) return log2_64(alo);
+ else return log2_64(ahi) + 64;
+}
+
+/* returns a upper limit for log2(a) considering scale */
+DECINLINE static int log2withScale_128(guint64 alo, guint64 ahi, int scale)
+{
+ int tlog2 = log2_128(alo, ahi);
+ if (tlog2 < 0) tlog2 = 0;
+ return tlog2 - (scale * 33219) / 10000;
+}
+
+DECINLINE static int pack128toDecimal(/*[Out]*/decimal_repr* pA, guint64 alo, guint64 ahi,
+ int scale, int sign)
+{
+ PRECONDITION((ahi >> 32) == 0);
+ PRECONDITION(sign == 0 || sign == 1);
+ PRECONDITION(scale >= 0 && scale <= DECIMAL_MAX_SCALE);
+
+ if (scale < 0 || scale > DECIMAL_MAX_SCALE || (ahi >> 32) != 0) {
+ return DECIMAL_OVERFLOW;
+ }
+
+ pA->lo32 = (guint32) alo;
+ pA->mid32 = (guint32) (alo >> 32);
+ pA->hi32 = (guint32) ahi;
+ pA->signscale.sign = sign;
+ pA->signscale.scale = scale;
+
+ return DECIMAL_SUCCESS;
+}
+
+DECINLINE static int adjustScale128(guint64* palo, guint64* pahi, int deltaScale)
+{
+ int idx, rc;
+
+ if (deltaScale < 0) {
+ deltaScale *= -1;
+ if (deltaScale > DECIMAL_MAX_SCALE) return DECIMAL_INTERNAL_ERROR;
+ while (deltaScale > 0) {
+ idx = (deltaScale > DECIMAL_MAX_INTFACTORS) ? DECIMAL_MAX_INTFACTORS : deltaScale;
+ deltaScale -= idx;
+ div128by32(palo, pahi, constantsDecadeInt32Factors[idx], 0);
+ }
+ } else if (deltaScale > 0) {
+ if (deltaScale > DECIMAL_MAX_SCALE) return DECIMAL_INTERNAL_ERROR;
+ while (deltaScale > 0) {
+ idx = (deltaScale > DECIMAL_MAX_INTFACTORS) ? DECIMAL_MAX_INTFACTORS : deltaScale;
+ deltaScale -= idx;
+ rc = mult128by32(palo, pahi, constantsDecadeInt32Factors[idx], 0);
+ if (rc != DECIMAL_SUCCESS) return rc;
+ }
+ }
+
+ return DECIMAL_SUCCESS;
+}
+
+/* input: c * 10^-(*pScale) * 2^-exp
+ output: c * 10^-(*pScale) with
+ minScale <= *pScale <= maxScale and (chi >> 32) == 0 */
+DECINLINE static int rescale128(guint64* pclo, guint64* pchi, int* pScale, int texp,
+ int minScale, int maxScale, int roundFlag)
+{
+ guint32 factor, overhang;
+ int scale, i, rc, roundBit = 0;
+
+ PRECONDITION(texp >= 0);
+
+ scale = *pScale;
+
+ if (texp > 0) {
+ /* reduce exp */
+ while (texp > 0 && scale <= maxScale) {
+ overhang = (guint32)(*pchi >> 32);
+ while (texp > 0 && ((*pclo & 1) == 0 || overhang > (2<<DECIMAL_MAX_INTFACTORS))) {
+ if (--texp == 0) roundBit = (int)(*pclo & 1);
+ rshift128(pclo, pchi);
+ overhang = (guint32)(*pchi >> 32);
+ }
+
+ if (texp > DECIMAL_MAX_INTFACTORS) i = DECIMAL_MAX_INTFACTORS;
+ else i = texp;
+ if (scale + i > maxScale) i = maxScale - scale;
+ if (i == 0) break;
+ texp -= i;
+ scale += i;
+ factor = constantsDecadeInt32Factors[i] >> i; /* 10^i/2^i=5^i */
+ mult128by32(pclo, pchi, factor, 0);
+ //printf("3: %.17e\n", (((double)chi) * pow(2,64) + clo) * pow(10, -scale) * pow(2, -texp));
+ }
+
+ while (texp > 0) {
+ if (--texp == 0) roundBit = (int)(*pclo & 1);
+ rshift128(pclo, pchi);
+ }
+ }
+
+ TEST(texp == 0);
+
+ while (scale > maxScale) {
+ i = scale - maxScale;
+ if (i > DECIMAL_MAX_INTFACTORS) i = DECIMAL_MAX_INTFACTORS;
+ scale -= i;
+ roundBit = div128by32(pclo, pchi, constantsDecadeInt32Factors[i], 0);
+ }
+
+ while (scale < minScale) {
+ if (!roundFlag) roundBit = 0;
+ i = minScale - scale;
+ if (i > DECIMAL_MAX_INTFACTORS) i = DECIMAL_MAX_INTFACTORS;
+ scale += i;
+ rc = mult128by32(pclo, pchi, constantsDecadeInt32Factors[i], roundBit);
+ if (rc != DECIMAL_SUCCESS) return rc;
+ roundBit = 0;
+ }
+
+ TEST(scale >= 0 && scale <= DECIMAL_MAX_SCALE);
+
+ *pScale = scale;
+
+ return normalize128(pclo, pchi, pScale, roundFlag, roundBit);
+}
+
+/* performs a += b */
+gint32 mono_decimalIncr(/*[In, Out]*/decimal_repr* pA, /*[In]*/decimal_repr* pB)
+{
+ guint64 alo, ahi, blo, bhi;
+ int log2A, log2B, log2Result, log10Result, rc;
+ int subFlag, sign, scaleA, scaleB;
+
+ DECTO128(pA, alo, ahi);
+ DECTO128(pB, blo, bhi);
+
+ sign = pA->signscale.sign;
+ subFlag = sign - (int)pB->signscale.sign;
+ scaleA = pA->signscale.scale;
+ scaleB = pB->signscale.scale;
+ if (scaleA == scaleB) {
+ /* same scale, that's easy */
+ if (subFlag) {
+ sub128(alo, ahi, blo, bhi, &alo, &ahi);
+ if (ahi & LIT_GUINT64_HIGHBIT) {
+ alo--;
+ alo = ~alo;
+ if (alo == 0) ahi--;
+ ahi = ~ahi;
+ sign = !sign;
+ }
+ } else {
+ add128(alo, ahi, blo, bhi, &alo, &ahi);
+ }
+ rc = normalize128(&alo, &ahi, &scaleA, 1, 0);
+ } else {
+ /* scales must be adjusted */
+ /* Estimate log10 and scale of result for adjusting scales */
+ log2A = log2withScale_128(alo, ahi, scaleA);
+ log2B = log2withScale_128(blo, bhi, scaleB);
+ log2Result = (log2A >= log2B) ? log2A : log2B;
+ if (!subFlag) log2Result++; /* result can have one bit more */
+ log10Result = (log2Result * 1000) / 3322 + 1;
+ /* we will calculate in 128bit, so we may need to adjust scale */
+ if (scaleB > scaleA) scaleA = scaleB;
+ if (scaleA + log10Result > DECIMAL_MAX_SCALE + 7) {
+ /* this may not fit in 128bit, so limit it */
+ scaleA = DECIMAL_MAX_SCALE + 7 - log10Result;
+ }
+
+ rc = adjustScale128(&alo, &ahi, scaleA - (int)pA->signscale.scale);
+ if (rc != DECIMAL_SUCCESS) return rc;
+ rc = adjustScale128(&blo, &bhi, scaleA - scaleB);
+ if (rc != DECIMAL_SUCCESS) return rc;
+
+ if (subFlag) {
+ sub128(alo, ahi, blo, bhi, &alo, &ahi);
+ if (ahi & LIT_GUINT64_HIGHBIT) {
+ alo--;
+ alo = ~alo;
+ if (alo == 0) ahi--;
+ ahi = ~ahi;
+ sign = !sign;
+ }
+ } else {
+ add128(alo, ahi, blo, bhi, &alo, &ahi);
+ }
+
+ if (rc != DECIMAL_SUCCESS) return rc;
+
+ rc = rescale128(&alo, &ahi,&scaleA, 0, 0, DECIMAL_MAX_SCALE, 1);
+ }
+
+ if (rc != DECIMAL_SUCCESS) return rc;
+
+ return pack128toDecimal(pA, alo, ahi, scaleA, sign);
+}
+
+/* performs a += factor * constants[idx] */
+static int incMultConstant128(guint64* palo, guint64* pahi, int idx, int factor)
+{
+ guint64 blo, bhi, h;
+
+ PRECONDITION(idx >= 0 && idx <= DECIMAL_MAX_SCALE);
+ PRECONDITION(factor > 0 && factor <= 9);
+
+ blo = dec128decadeFactors[idx].lo;
+ h = bhi = dec128decadeFactors[idx].hi;
+ if (factor != 1) {
+ mult128by32(&blo, &bhi, factor, 0);
+ if (h > bhi) return DECIMAL_OVERFLOW;
+ }
+ h = *pahi;
+ add128(*palo, *pahi, blo, bhi, palo, pahi);
+ if (h > *pahi) return DECIMAL_OVERFLOW;
+ return DECIMAL_SUCCESS;
+}
+
+DECINLINE static void div128DecadeFactor(guint64* palo, guint64* pahi, int powerOfTen)
+{
+ int idx, roundBit = 0;
+
+ while (powerOfTen > 0) {
+ idx = (powerOfTen > DECIMAL_MAX_INTFACTORS) ? DECIMAL_MAX_INTFACTORS : powerOfTen;
+ powerOfTen -= idx;
+ roundBit = div128by32(palo, pahi, constantsDecadeInt32Factors[idx], 0);
+ }
+
+ if (roundBit) roundUp128(palo, pahi);
+}
+
+/* calc significant digits of mantisse */
+DECINLINE static int calcDigits(guint64 alo, guint64 ahi)
+{
+ int tlog2 = 0;
+ int tlog10;
+
+ if (ahi == 0) {
+ if (alo == 0) {
+ return 0; /* zero has no signficant digits */
+ } else {
+ tlog2 = log2_64(alo);
+ }
+ } else {
+ tlog2 = 64 + log2_64(ahi);
+ }
+
+ tlog10 = (tlog2 * 1000) / 3322;
+ /* we need an exact floor value of log10(a) */
+ if (dec128decadeFactors[tlog10].hi > ahi
+ || (dec128decadeFactors[tlog10].hi == ahi
+ && dec128decadeFactors[tlog10].lo > alo)) {
+ --tlog10;
+ }
+ return tlog10+1;
+}
+
+gint32 mono_double2decimal(/*[Out]*/decimal_repr* pA, double val, gint32 digits)
+{
+ guint64 alo, ahi;
+ guint64* p = (guint64*)(&val);
+ int sigDigits, sign, texp, rc, scale;
+ guint16 k;
+
+ PRECONDITION(digits <= 15);
+
+ sign = ((*p & LIT_GUINT64_HIGHBIT) != 0) ? 1 : 0;
+ k = ((guint16)((*p) >> 52)) & 0x7FF;
+ alo = (*p & LIT_GUINT64(0xFFFFFFFFFFFFF)) | LIT_GUINT64(0x10000000000000);
+ ahi = 0;
+
+ texp = (k & 0x7FF) - 0x3FF;
+ if (k == 0x7FF || texp >= 96) return DECIMAL_OVERFLOW; /* NaNs, SNaNs, Infinities or >= 2^96 */
+ if (k == 0 || texp <= -94) { /* Subnormals, Zeros or < 2^-94 */
+ DECINIT(pA); /* return zero */
+ return DECIMAL_SUCCESS;
+ }
+
+ texp -= 52;
+ if (texp > 0) {
+ for (; texp > 0; texp--) {
+ lshift128(&alo, &ahi);
+ }
+ }
+
+ scale = 0;
+ rc = rescale128(&alo, &ahi, &scale, -texp, 0, DECIMAL_MAX_SCALE, 0);
+ if (rc != DECIMAL_SUCCESS) return rc;
+
+ sigDigits = calcDigits(alo, ahi);
+ /* too much digits, then round */
+ if (sigDigits > digits) {
+ div128DecadeFactor(&alo, &ahi, sigDigits - digits);
+ scale -= sigDigits - digits;
+ /* check value, may be 10^(digits+1) caused by rounding */
+ if (ahi == dec128decadeFactors[digits].hi
+ && alo == dec128decadeFactors[digits].lo) {
+ div128by32(&alo, &ahi, 10, 0);
+ scale--;
+ }
+ if (scale < 0) {
+ rc = mult128DecadeFactor(&alo, &ahi, -scale);
+ if (rc != DECIMAL_SUCCESS) return rc;
+ scale = 0;
+ }
+ }
+
+ return pack128toDecimal(pA, alo, ahi, scale, sign);
+}
+
+/**
+ * converts a digit string to decimal
+ * The significant digits must be passed as an integer in buf !
+ *
+ * 1. Example:
+ * if you want to convert the number 123.456789012345678901234 to decimal
+ * buf := "123456789012345678901234"
+ * decrDecimal := 3
+ * sign := 0
+ *
+ * 2. Example:
+ * you want to convert -79228162514264337593543950335 to decimal
+ * buf := "79228162514264337593543950335"
+ * decrDecimal := 29
+ * sign := 1
+ *
+ * 3. Example:
+ * you want to convert -7922816251426433759354395033.250000000000001 to decimal
+ * buf := "7922816251426433759354395033250000000000001"
+ * decrDecimal := 29
+ * sign := 1
+ * returns (decimal)-7922816251426433759354395033.3
+ *
+ * 4. Example:
+ * you want to convert -7922816251426433759354395033.250000000000000 to decimal
+ * buf := "7922816251426433759354395033250000000000000"
+ * decrDecimal := 29
+ * sign := 1
+ * returns (decimal)-7922816251426433759354395033.2
+ *
+ * 5. Example:
+ * you want to convert -7922816251426433759354395033.150000000000000 to decimal
+ * buf := "7922816251426433759354395033150000000000000"
+ * decrDecimal := 29
+ * sign := 1
+ * returns (decimal)-7922816251426433759354395033.2
+ *
+ * Uses banker's rule for rounding if there are more digits than can be
+ * represented by the significant
+ */
+gint32 mono_string2decimal(/*[Out]*/decimal_repr* pA, MonoString* str, gint32 decrDecimal, gint32 sign)
+{
+ gushort *buf = mono_string_chars(str);
+ gushort *p;
+ guint64 alo, ahi;
+ int n, rc, i, len, sigLen = -1, firstNonZero;
+ int scale, roundBit = 0;
+
+ alo = ahi = 0;
+ DECINIT(pA);
+
+ for (p = buf, len = 0; *p != 0; len++, p++) { }
+
+ for (p = buf, i = 0; *p != 0; i++, p++) {
+ n = *p - '0';
+ if (n < 0 || n > 9) {
+ return DECIMAL_INVALID_CHARACTER;
+ }
+ if (n) {
+ if (sigLen < 0) {
+ firstNonZero = i;
+ sigLen = (len - firstNonZero > DECIMAL_MAX_SCALE+1)
+ ? DECIMAL_MAX_SCALE+1+firstNonZero : len;
+ if (decrDecimal > sigLen+1) return DECIMAL_OVERFLOW;
+ }
+ if (i >= sigLen) break;
+ rc = incMultConstant128(&alo, &ahi, sigLen - 1 - i, n);
+ if (rc != DECIMAL_SUCCESS) {
+ return rc;
+ }
+ }
+ }
+
+ scale = sigLen - decrDecimal;
+
+ if (i < len) { /* too much digits, we must round */
+ n = buf[i] - '0';
+ if (n < 0 || n > 9) {
+ return DECIMAL_INVALID_CHARACTER;
+ }
+ if (n > 5) roundBit = 1;
+ else if (n == 5) { /* we must take a nearer look */
+ n = buf[i-1] - '0';
+ for (++i; i < len; ++i) {
+ if (buf[i] != '0') break; /* we are greater than .5 */
+ }
+ if (i < len /* greater than exactly .5 */
+ || n % 2 == 1) { /* exactly .5, use banker's rule for rounding */
+ roundBit = 1;
+ }
+ }
+ }
+
+ if (ahi != 0) {
+ rc = normalize128(&alo, &ahi, &scale, 1, roundBit);
+ if (rc != DECIMAL_SUCCESS) return rc;
+ }
+
+ if (alo == 0 && ahi == 0) {
+ DECINIT(pA);
+ return DECIMAL_SUCCESS;
+ } else {
+ return pack128toDecimal(pA, alo, ahi, sigLen - decrDecimal, sign);
+ }
+}
+
+/**
+ * returns minimal number of digit string to represent decimal
+ * No leading or trailing zeros !
+ * Examples:
+ * *pA == 0 => buf = "", *pDecPos = 1, *pSign = 0
+ * *pA == 12.34 => buf = "1234", *pDecPos = 2, *pSign = 0
+ * *pA == -1000.0000 => buf = "1", *pDecPos = 4, *pSign = 1
+ * *pA == -0.00000076 => buf = "76", *pDecPos = -6, *pSign = 0
+ *
+ * Parameters:
+ * pA decimal instance to convert
+ * digits < 0: use decimals instead
+ * = 0: gets mantisse as integer
+ * > 0: gets at most <digits> digits, rounded according to banker's rule if necessary
+ * decimals only used if digits < 0
+ * >= 0: number of decimal places
+ * buf pointer to result buffer
+ * bufSize size of buffer
+ * pDecPos receives insert position of decimal point relative to start of buffer
+ * pSign receives sign
+ */
+
+gint32 mono_decimal2string(/*[In]*/decimal_repr* pA, gint32 digits, gint32 decimals,
+ MonoArray* pArray, gint32 bufSize, gint32* pDecPos, gint32* pSign)
+{
+ guint16 tmp[41];
+ guint16 *buf = (guint16*) mono_array_addr(pArray, guint16, 0);
+ guint16 *q, *p = tmp;
+ decimal_repr aa;
+ guint64 alo, ahi;
+ guint32 rest;
+ gint32 sigDigits, d;
+ int i, scale, len;
+
+ scale = pA->signscale.scale;
+ DECTO128(pA, alo, ahi);
+ sigDigits = calcDigits(alo, ahi); /* significant digits */
+
+ /* calc needed digits (without leading or trailing zeros) */
+ d = (digits == 0) ? sigDigits : digits;
+ if (d < 0) { /* use decimals ? */
+ if (0 <= decimals && decimals < scale) {
+ d = sigDigits - scale + decimals;
+ } else {
+ d = sigDigits; /* use all you can get */
+ }
+ }
+
+ if (sigDigits > d) { /* we need to round decimal number */
+ DECCOPY(&aa, pA);
+ aa.signscale.scale = DECIMAL_MAX_SCALE;
+ mono_decimalRound(&aa, DECIMAL_MAX_SCALE - sigDigits + d);
+ DECTO128(&aa, alo, ahi);
+ sigDigits += calcDigits(alo, ahi) - d;
+ }
+
+ len = 0;
+ if (d > 0) {
+ /* get digits starting from the tail */
+ for (; (alo != 0 || ahi != 0) && len < 40; len++) {
+ div128by32(&alo, &ahi, 10, &rest);
+ *p++ = '0' + (char) rest;
+ }
+ }
+ *p = 0;
+
+ if (len >= bufSize) return DECIMAL_BUFFER_OVERFLOW;
+
+ /* now we have the minimal count of digits,
+ extend to wished count of digits or decimals */
+ q = buf;
+ if (digits >= 0) { /* count digits */
+ if (digits >= bufSize) return DECIMAL_BUFFER_OVERFLOW;
+ if (len == 0) {
+ /* zero or rounded to zero */
+ *pDecPos = 1;
+ } else {
+ /* copy significant digits */
+ for (i = 0; i < len; i++) {
+ *q++ = *(--p);
+ }
+ *pDecPos = sigDigits - scale;
+ }
+ /* add trailing zeros */
+ for (i = len; i < digits; i++) {
+ *q++ = '0';
+ }
+ } else { /* count decimals */
+ if (scale >= sigDigits) { /* add leading zeros */
+ if (decimals+2 >= bufSize) return DECIMAL_BUFFER_OVERFLOW;
+ *pDecPos = 1;
+ for (i = 0; i <= scale - sigDigits; i++) {
+ *q++ = '0';
+ }
+ } else {
+ if (sigDigits - scale + decimals+1 >= bufSize) return DECIMAL_BUFFER_OVERFLOW;
+ *pDecPos = sigDigits - scale;
+ }
+ /* copy significant digits */
+ for (i = 0; i < len; i++) {
+ *q++ = *(--p);
+ }
+ /* add trailing zeros */
+ for (i = scale; i < decimals; i++) {
+ *q++ = '0';
+ }
+ }
+ *q = 0;
+
+ *pSign = (sigDigits > 0) ? pA->signscale.sign : 0; /* zero has positive sign */
+
+ return DECIMAL_SUCCESS;
+}
+
+/**
+ * converts a decimal to an UInt64 without rounding
+ */
+gint32 mono_decimal2UInt64(/*[In]*/decimal_repr* pA, guint64* pResult)
+{
+ guint64 alo, ahi;
+ int scale;
+
+ DECTO128(pA, alo, ahi);
+ scale = pA->signscale.scale;
+ if (scale > 0) {
+ div128DecadeFactor(&alo, &ahi, scale);
+ }
+
+ /* overflow if integer too large or < 0 */
+ if (ahi != 0 || (alo != 0 && pA->signscale.sign)) return DECIMAL_OVERFLOW;
+
+ *pResult = alo;
+ return DECIMAL_SUCCESS;
+}
+
+/**
+ * converts a decimal to an Int64 without rounding
+ */
+gint32 mono_decimal2Int64(/*[In]*/decimal_repr* pA, gint64* pResult)
+{
+ guint64 alo, ahi;
+ int sign, scale;
+
+ DECTO128(pA, alo, ahi);
+ scale = pA->signscale.scale;
+ if (scale > 0) {
+ div128DecadeFactor(&alo, &ahi, scale);
+ }
+
+ if (ahi != 0) return DECIMAL_OVERFLOW;
+
+ sign = pA->signscale.sign;
+ if (sign && alo != 0) {
+ if (alo > LIT_GUINT64_HIGHBIT) return DECIMAL_OVERFLOW;
+ *pResult = (gint64) ~(alo-1);
+ } else {
+ if (alo & LIT_GUINT64_HIGHBIT) return DECIMAL_OVERFLOW;
+ *pResult = (gint64) alo;
+ }
+
+ return DECIMAL_SUCCESS;
+}
+
+void mono_decimalFloorAndTrunc(/*[In, Out]*/decimal_repr* pA, gint32 floorFlag)
+{
+ guint64 alo, ahi;
+ guint32 factor, rest;
+ int scale, sign, idx;
+ int hasRest = 0;
+
+ scale = pA->signscale.scale;
+ if (scale == 0) return; /* nothing to do */
+
+ DECTO128(pA, alo, ahi);
+ sign = pA->signscale.sign;
+
+ while (scale > 0) {
+ idx = (scale > DECIMAL_MAX_INTFACTORS) ? DECIMAL_MAX_INTFACTORS : scale;
+ factor = constantsDecadeInt32Factors[idx];
+ scale -= idx;
+ div128by32(&alo, &ahi, factor, &rest);
+ hasRest = hasRest || (rest != 0);
+ }
+
+ if (floorFlag && hasRest && sign) { /* floor: if negative, we must round up */
+ roundUp128(&alo, &ahi);
+ }
+
+ pack128toDecimal(pA, alo, ahi, 0, sign);
+}
+
+void mono_decimalRound(/*[In, Out]*/decimal_repr* pA, gint32 decimals)
+{
+ guint64 alo, ahi;
+ int scale, sign;
+
+ DECTO128(pA, alo, ahi);
+ scale = pA->signscale.scale;
+ sign = pA->signscale.sign;
+ if (scale > decimals) {
+ div128DecadeFactor(&alo, &ahi, scale - decimals);
+ scale = decimals;
+ }
+
+ pack128toDecimal(pA, alo, ahi, scale, sign);
+}
+
+gint32 mono_decimalMult(/*[In, Out]*/decimal_repr* pA, /*[In]*/decimal_repr* pB)
+{
+ guint64 low, mid, high;
+ guint32 factor;
+ int scale, sign, rc;
+
+ mult96by96to192(pA->lo32, pA->mid32, pA->hi32, pB->lo32, pB->mid32, pB->hi32,
+ &low, &mid, &high);
+
+ /* adjust scale and sign */
+ scale = (int)pA->signscale.scale + (int)pB->signscale.scale;
+ sign = pA->signscale.sign ^ pB->signscale.sign;
+
+ /* first scaling step */
+ factor = constantsDecadeInt32Factors[DECIMAL_MAX_INTFACTORS];
+ while (high != 0 || (mid>>32) >= factor) {
+ if (high < 100) {
+ factor /= 1000; /* we need some digits for final rounding */
+ scale -= DECIMAL_MAX_INTFACTORS - 3;
+ } else {
+ scale -= DECIMAL_MAX_INTFACTORS;
+ }
+
+ div192by32(&low, &mid, &high, factor);
+ }
+
+ /* second and final scaling */
+ rc = rescale128(&low, &mid, &scale, 0, 0, DECIMAL_MAX_SCALE, 1);
+ if (rc != DECIMAL_SUCCESS) return rc;
+
+ return pack128toDecimal(pA, low, mid, scale, sign);
+}
+
+static int decimalDivSub(/*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB,
+ guint64* pclo, guint64* pchi, int* pExp)
+{
+ guint64 alo, ami, ahi;
+ guint64 tlo, tmi, thi;
+ guint32 blo, bmi, bhi;
+ int ashift, bshift, extraBit, texp;
+
+ ahi = (((guint64)(pA->hi32)) << 32) | pA->mid32;
+ ami = ((guint64)(pA->lo32)) << 32;
+ alo = 0;
+ blo = pB->lo32;
+ bmi = pB->mid32;
+ bhi = pB->hi32;
+
+ if (blo == 0 && bmi == 0 && bhi == 0) {
+ return DECIMAL_DIVIDE_BY_ZERO;
+ }
+
+ if (ami == 0 && ahi == 0) {
+ *pclo = *pchi = 0;
+ return DECIMAL_FINISHED;
+ }
+
+ /* enlarge dividend to get maximal precision */
+ for (ashift = 0; (ahi & LIT_GUINT64_HIGHBIT) == 0; ++ashift) {
+ lshift128(&ami, &ahi);
+ }
+
+ /* ensure that divisor is at least 2^95 */
+ for (bshift = 0; (bhi & LIT_GUINT32_HIGHBIT) == 0; ++bshift) {
+ lshift96(&blo, &bmi, &bhi);
+ }
+
+ thi = ((guint64)bhi)<<32 | bmi;
+ tmi = ((guint64)blo)<<32;
+ tlo = 0;
+ if (ahi > thi || (ahi == thi && ami >= tmi)) {
+ sub192(alo, ami, ahi, tlo, tmi, thi, &alo, &ami, &ahi);
+ extraBit = 1;
+ } else {
+ extraBit = 0;
+ }
+
+ div192by96to128(alo, ami, ahi, blo, bmi, bhi, pclo, pchi);
+ texp = 128 + ashift - bshift;
+
+ if (extraBit) {
+ rshift128(pclo, pchi);
+ *pchi += LIT_GUINT64_HIGHBIT;
+ texp--;
+ }
+
+ /* try loss free right shift */
+ while (texp > 0 && (*pclo & 1) == 0) {
+ /* right shift */
+ rshift128(pclo, pchi);
+ texp--;
+ }
+
+ *pExp = texp;
+
+ return DECIMAL_SUCCESS;
+}
+
+gint32 mono_decimalDiv(/*[Out]*/decimal_repr* pC, /*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB)
+{
+ guint64 clo, chi; /* result */
+ int scale, texp, rc;
+
+ rc = decimalDivSub(pA, pB, &clo, &chi, &texp);
+ if (rc != DECIMAL_SUCCESS) {
+ if (rc == DECIMAL_FINISHED) rc = DECIMAL_SUCCESS;
+ return rc;
+ }
+
+ /* adjust scale and sign */
+ scale = (int)pA->signscale.scale - (int)pB->signscale.scale;
+
+ //test: printf("0: %.17e\n", (((double)chi) * pow(2,64) + clo) * pow(10, -scale) * pow(2, -exp));
+ rc = rescale128(&clo, &chi, &scale, texp, 0, DECIMAL_MAX_SCALE, 1);
+ if (rc != DECIMAL_SUCCESS) return rc;
+
+ return pack128toDecimal(pC, clo, chi, scale, pA->signscale.sign ^ pB->signscale.sign);
+}
+
+gint32 mono_decimalIntDiv(/*[Out]*/decimal_repr* pC, /*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB)
+{
+ guint64 clo, chi; /* result */
+ int scale, texp, rc;
+
+ rc = decimalDivSub(pA, pB, &clo, &chi, &texp);
+ if (rc != DECIMAL_SUCCESS) {
+ if (rc == DECIMAL_FINISHED) rc = DECIMAL_SUCCESS;
+ return rc;
+ }
+
+ /* calc scale */
+ scale = (int)pA->signscale.scale - (int)pB->signscale.scale;
+
+ /* truncate result to integer */
+ rc = rescale128(&clo, &chi, &scale, texp, 0, 0, 0);
+ if (rc != DECIMAL_SUCCESS) return rc;
+
+ return pack128toDecimal(pC, clo, chi, scale, pA->signscale.sign);
+}
+
+/* approximation for log2 of a
+ If q is the exact value for log2(a), then q <= decimalLog2(a) <= q+1 */
+DECINLINE static int decimalLog2(/*[In]*/decimal_repr* pA)
+{
+ int tlog2;
+ int scale = pA->signscale.scale;
+
+ if (pA->hi32 != 0) tlog2 = 64 + log2_32(pA->hi32);
+ else if (pA->mid32 != 0) tlog2 = 32 + log2_32(pA->mid32);
+ else tlog2 = log2_32(pA->lo32);
+
+ if (tlog2 != DECIMAL_LOG_NEGINF) {
+ tlog2 -= (scale * 33219) / 10000;
+ }
+
+ return tlog2;
+}
+
+DECINLINE static int decimalIsZero(/*[In]*/decimal_repr* pA)
+{
+ return (pA->lo32 == 0 && pA->mid32 == 0 && pA->hi32 == 0);
+}
+
+gint32 mono_decimalCompare(/*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB)
+{
+ int log2a, log2b, delta, sign;
+ decimal_repr aa;
+
+ sign = (pA->signscale.sign) ? -1 : 1;
+
+ if (pA->signscale.sign ^ pB->signscale.sign) {
+ return (decimalIsZero(pA) && decimalIsZero(pB)) ? 0 : sign;
+ }
+
+ /* try fast comparison via log2 */
+ log2a = decimalLog2(pA);
+ log2b = decimalLog2(pB);
+ delta = log2a - log2b;
+ /* decimalLog2 is not exact, so we can say nothing
+ if abs(delta) <= 1 */
+ if (delta < -1) return -sign;
+ if (delta > 1) return sign;
+
+ DECCOPY(&aa, pA);
+ DECNEGATE(&aa);
+ mono_decimalIncr(&aa, pB);
+
+ if (decimalIsZero(&aa)) return 0;
+
+ return (aa.signscale.sign) ? 1 : -1;
+}
+
+/* d=(-1)^sign * n * 2^(k-52) with sign (1bit), k(11bit), n-2^52(52bit) */
+DECINLINE static void buildIEEE754Double(double* pd, int sign, int texp, guint64 mantisse)
+{
+ guint64* p = (guint64*) pd;
+
+ PRECONDITION(sign == 0 || sign == 1);
+ *p = (((guint64)sign) << 63) | (((guint64)((1023+texp)&0x7ff)) << 52) | mantisse;
+}
+
+double mono_decimal2double(/*[In]*/decimal_repr* pA)
+{
+ double d;
+ guint64 alo, ahi, mantisse;
+ guint32 overhang, factor, roundBits;
+ int scale, texp, log5, i;
+
+ ahi = (((guint64)(pA->hi32)) << 32) | pA->mid32;
+ alo = ((guint64)(pA->lo32)) << 32;
+
+ /* special case zero */
+ if (ahi == 0 && alo == 0) return 0.0;
+
+ texp = 0;
+ scale = pA->signscale.scale;
+
+ /* transform n * 10^-scale and exp = 0 => m * 2^-exp and scale = 0 */
+ while (scale > 0) {
+ while ((ahi & LIT_GUINT64_HIGHBIT) == 0) {
+ lshift128(&alo, &ahi);
+ texp++;
+ }
+
+ overhang = (guint32) (ahi >> 32);
+ if (overhang >= 5) {
+ /* estimate log5 */
+ log5 = (log2_32(overhang) * 1000) / 2322; /* ln(5)/ln(2) = 2.3219... */
+ if (log5 < DECIMAL_MAX_INTFACTORS) {
+ /* get maximal factor=5^i, so that overhang / factor >= 1 */
+ factor = constantsDecadeInt32Factors[log5] >> log5; /* 5^n = 10^n/2^n */
+ i = log5 + overhang / factor;
+ } else {
+ i = DECIMAL_MAX_INTFACTORS; /* we have only constants up to 10^DECIMAL_MAX_INTFACTORS */
+ }
+ if (i > scale) i = scale;
+ factor = constantsDecadeInt32Factors[i] >> i; /* 5^n = 10^n/2^n */
+ /* n * 10^-scale * 2^-exp => m * 10^-(scale-i) * 2^-(exp+i) with m = n * 5^-i */
+ div128by32(&alo, &ahi, factor, 0);
+ scale -= i;
+ texp += i;
+ }
+ }
+
+ /* normalize significand (highest bit should be 1) */
+ while ((ahi & LIT_GUINT64_HIGHBIT) == 0) {
+ lshift128(&alo, &ahi);
+ texp++;
+ }
+
+ /* round to nearest even */
+ roundBits = (guint32)ahi & 0x7ff;
+ ahi += 0x400;
+ if ((ahi & LIT_GUINT64_HIGHBIT) == 0) { /* overflow ? */
+ ahi >>= 1;
+ texp++;
+ } else if ((roundBits & 0x400) == 0) ahi &= ~1;
+
+ /* 96 bit => 1 implizit bit and 52 explicit bits */
+ mantisse = (ahi & ~LIT_GUINT64_HIGHBIT) >> 11;
+
+ buildIEEE754Double(&d, pA->signscale.sign, -texp+95, mantisse);
+
+ return d;
+}
+
+/* a *= 10^exp */
+gint32 mono_decimalSetExponent(/*[In, Out]*/decimal_repr* pA, gint32 texp)
+{
+ guint64 alo, ahi;
+ int rc;
+ int scale = pA->signscale.scale;
+
+ scale -= texp;
+
+ if (scale < 0 || scale > DECIMAL_MAX_SCALE) {
+ DECTO128(pA, alo, ahi);
+ rc = rescale128(&alo, &ahi, &scale, 0, 0, DECIMAL_MAX_SCALE, 1);
+ if (rc != DECIMAL_SUCCESS) return rc;
+ return pack128toDecimal(pA, alo, ahi, scale, pA->signscale.sign);
+ } else {
+ pA->signscale.scale = scale;
+ return DECIMAL_SUCCESS;
+ }
+}
diff --git a/mono/metadata/decimal.h b/mono/metadata/decimal.h
new file mode 100644
index 00000000000..a01c0ff7fa6
--- /dev/null
+++ b/mono/metadata/decimal.h
@@ -0,0 +1,39 @@
+#include "mono/metadata/object.h"
+
+/* representation for C# type decimal */
+/* This is the layout of MSC */
+typedef struct
+{
+ union {
+ guint32 ss32;
+ struct {
+ unsigned int reserved1 : 16;
+ unsigned int scale : 8;
+ unsigned int reserved2 : 7;
+ unsigned int sign : 1;
+ } signscale;
+ } u;
+ guint32 hi32;
+ guint32 lo32;
+ guint32 mid32;
+} decimal_repr;
+
+
+/* function prototypes */
+gint32 mono_decimalIncr(/*[In, Out]*/decimal_repr* pA, /*[In]*/decimal_repr* pB);
+gint32 mono_double2decimal(/*[Out]*/decimal_repr* pA, double val, gint32 digits);
+gint32 mono_decimal2UInt64(/*[In]*/decimal_repr* pD, guint64* pResult);
+gint32 mono_decimal2Int64(/*[In]*/decimal_repr* pD, gint64* pResult);
+void mono_decimalFloorAndTrunc(/*[In, Out]*/decimal_repr* pD, gint32 floorFlag);
+void mono_decimalRound(/*[In, Out]*/decimal_repr* pD, gint32 decimals);
+gint32 mono_decimalMult(/*[In, Out]*/decimal_repr* pA, /*[In]*/decimal_repr* pB);
+gint32 mono_decimalDiv(/*[Out]*/decimal_repr* pC, /*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB);
+gint32 mono_decimalIntDiv(/*[Out]*/decimal_repr* pC, /*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB);
+gint32 mono_decimalCompare(/*[In]*/decimal_repr* pA, /*[In]*/decimal_repr* pB);
+double mono_decimal2double(/*[In]*/decimal_repr* pA);
+gint32 mono_decimalSetExponent(/*[In, Out]*/decimal_repr* pA, gint32 texp);
+
+gint32 mono_string2decimal(/*[Out]*/decimal_repr* pA, /*[In]*/MonoString* s, gint32 decrDecimal, gint32 sign);
+gint32 mono_decimal2string(/*[In]*/decimal_repr* pA, int digits, int decimals,
+ /*[Out]*/MonoArray* pArray, gint32 bufSize, gint32* pDecPos, gint32* pSign);
+
diff --git a/mono/metadata/domain.c b/mono/metadata/domain.c
new file mode 100644
index 00000000000..02ed96e7420
--- /dev/null
+++ b/mono/metadata/domain.c
@@ -0,0 +1,434 @@
+
+/*
+ * domain.c: MonoDomain functions
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#endif
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/assembly.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/cil-coff.h>
+
+static guint32 appdomain_thread_id = 0;
+
+MonoDomain *mono_root_domain = NULL;
+
+static MonoJitInfoTable *
+mono_jit_info_table_new (void)
+{
+ return g_array_new (FALSE, FALSE, sizeof (gpointer));
+}
+
+static void
+mono_jit_info_table_free (MonoJitInfoTable *table)
+{
+ g_array_free (table, TRUE);
+}
+
+static int
+mono_jit_info_table_index (MonoJitInfoTable *table, char *addr)
+{
+ int left = 0, right = table->len;
+
+ while (left < right) {
+ int pos = (left + right) / 2;
+ MonoJitInfo *ji = g_array_index (table, gpointer, pos);
+ char *start = ji->code_start;
+ char *end = start + ji->code_size;
+
+ if (addr < start)
+ right = pos;
+ else if (addr >= end)
+ left = pos + 1;
+ else
+ return pos;
+ }
+
+ return left;
+}
+
+MonoJitInfo *
+mono_jit_info_table_find (MonoDomain *domain, char *addr)
+{
+ MonoJitInfoTable *table = domain->jit_info_table;
+ int left = 0, right = table->len;
+
+ while (left < right) {
+ int pos = (left + right) / 2;
+ MonoJitInfo *ji = g_array_index (table, gpointer, pos);
+ char *start = ji->code_start;
+ char *end = start + ji->code_size;
+
+ if (addr < start)
+ right = pos;
+ else if (addr >= end)
+ left = pos + 1;
+ else
+ return ji;
+ }
+
+ /* maybe irt is shared code, so we also search in the root domain */
+ if (domain != mono_root_domain)
+ return mono_jit_info_table_find (domain, addr);
+
+ return NULL;
+}
+
+void
+mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji)
+{
+ MonoJitInfoTable *table = domain->jit_info_table;
+ gpointer start = ji->code_start;
+ int pos = mono_jit_info_table_index (table, start);
+
+ g_array_insert_val (table, pos, ji);
+}
+
+static int
+ldstr_hash (const char* str)
+{
+ guint len, h;
+ const char *end;
+ len = mono_metadata_decode_blob_size (str, &str) - 1;
+ end = str + len;
+ h = *str;
+ /*
+ * FIXME: The distribution may not be so nice with lots of
+ * null chars in the string.
+ */
+ for (str += 1; str < end; str++)
+ h = (h << 5) - h + *str;
+ return h;
+}
+
+static gboolean
+ldstr_equal (const char *str1, const char *str2) {
+ int len, len2;
+ len = mono_metadata_decode_blob_size (str1, NULL) - 1;
+ len2 = mono_metadata_decode_blob_size (str2, NULL) - 1;
+ if (len != len2)
+ return 0;
+ return memcmp (str1, str2, len) == 0;
+}
+
+#if HAVE_BOEHM_GC
+static void
+domain_finalizer (void *obj, void *data) {
+ g_print ("domain finalized\n");
+}
+#endif
+
+MonoDomain *
+mono_domain_create (void)
+{
+ MonoDomain *domain;
+
+#if HAVE_BOEHM_GC
+ domain = GC_malloc (sizeof (MonoDomain));
+ GC_register_finalizer (domain, domain_finalizer, NULL, NULL, NULL);
+#else
+ domain = g_new0 (MonoDomain, 1);
+#endif
+ domain->domain = NULL;
+ domain->setup = NULL;
+ domain->friendly_name = NULL;
+
+ domain->mp = mono_mempool_new ();
+ domain->env = g_hash_table_new (g_str_hash, g_str_equal);
+ domain->assemblies = g_hash_table_new (g_str_hash, g_str_equal);
+ domain->class_vtable_hash = mono_g_hash_table_new (NULL, NULL);
+ domain->proxy_vtable_hash = mono_g_hash_table_new (NULL, NULL);
+ domain->static_data_hash = mono_g_hash_table_new (NULL, NULL);
+ domain->jit_code_hash = g_hash_table_new (NULL, NULL);
+ domain->ldstr_table = mono_g_hash_table_new ((GHashFunc)ldstr_hash, (GCompareFunc)ldstr_equal);
+ domain->jit_info_table = mono_jit_info_table_new ();
+
+ InitializeCriticalSection (&domain->lock);
+ return domain;
+}
+
+/**
+ * mono_init:
+ *
+ * Creates the initial application domain and initializes the mono_defaults
+ * structure.
+ * This function is guaranteed to not run any IL code.
+ *
+ * Returns: the initial domain.
+ */
+MonoDomain *
+mono_init (const char *filename)
+{
+ static MonoDomain *domain = NULL;
+ MonoAssembly *ass;
+ MonoImageOpenStatus status = MONO_IMAGE_OK;
+
+ if (domain)
+ g_assert_not_reached ();
+
+ appdomain_thread_id = TlsAlloc ();
+
+ domain = mono_domain_create ();
+ mono_root_domain = domain;
+
+ TlsSetValue (appdomain_thread_id, domain);
+
+ /* find the corlib */
+ ass = mono_assembly_open (CORLIB_NAME, NULL, &status);
+ if ((status != MONO_IMAGE_OK) || (ass == NULL)) {
+ switch (status){
+ case MONO_IMAGE_ERROR_ERRNO:
+ g_print ("The assembly corlib.dll was not found or could not be loaded.\n");
+ g_print ("It should have been installed in the `%s' directory.\n", MONO_ASSEMBLIES);
+ break;
+ case MONO_IMAGE_IMAGE_INVALID:
+ g_print ("The file %s/corlib.dll is an invalid CIL image\n", MONO_ASSEMBLIES);
+ break;
+ case MONO_IMAGE_MISSING_ASSEMBLYREF:
+ g_print ("Minning assembly reference in %s/corlib.dll\n", MONO_ASSEMBLIES);
+ break;
+ case MONO_IMAGE_OK:
+ /* to suppress compiler warning */
+ }
+
+ exit (1);
+ }
+ mono_defaults.corlib = ass->image;
+
+ mono_defaults.object_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Object");
+ g_assert (mono_defaults.object_class != 0);
+
+ mono_defaults.void_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Void");
+ g_assert (mono_defaults.void_class != 0);
+
+ mono_defaults.boolean_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Boolean");
+ g_assert (mono_defaults.boolean_class != 0);
+
+ mono_defaults.byte_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Byte");
+ g_assert (mono_defaults.byte_class != 0);
+
+ mono_defaults.sbyte_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "SByte");
+ g_assert (mono_defaults.sbyte_class != 0);
+
+ mono_defaults.int16_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Int16");
+ g_assert (mono_defaults.int16_class != 0);
+
+ mono_defaults.uint16_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "UInt16");
+ g_assert (mono_defaults.uint16_class != 0);
+
+ mono_defaults.int32_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Int32");
+ g_assert (mono_defaults.int32_class != 0);
+
+ mono_defaults.uint32_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "UInt32");
+ g_assert (mono_defaults.uint32_class != 0);
+
+ mono_defaults.uint_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "UIntPtr");
+ g_assert (mono_defaults.uint_class != 0);
+
+ mono_defaults.int_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "IntPtr");
+ g_assert (mono_defaults.int_class != 0);
+
+ mono_defaults.int64_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Int64");
+ g_assert (mono_defaults.int64_class != 0);
+
+ mono_defaults.uint64_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "UInt64");
+ g_assert (mono_defaults.uint64_class != 0);
+
+ mono_defaults.single_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Single");
+ g_assert (mono_defaults.single_class != 0);
+
+ mono_defaults.double_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Double");
+ g_assert (mono_defaults.double_class != 0);
+
+ mono_defaults.char_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Char");
+ g_assert (mono_defaults.char_class != 0);
+
+ mono_defaults.string_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "String");
+ g_assert (mono_defaults.string_class != 0);
+
+ mono_defaults.enum_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Enum");
+ g_assert (mono_defaults.enum_class != 0);
+
+ mono_defaults.array_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Array");
+ g_assert (mono_defaults.array_class != 0);
+
+ mono_defaults.multicastdelegate_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "MulticastDelegate");
+ g_assert (mono_defaults.multicastdelegate_class != 0 );
+
+ mono_defaults.asyncresult_class = mono_class_from_name (
+ mono_defaults.corlib, "System.Runtime.Remoting.Messaging",
+ "AsyncResult");
+ g_assert (mono_defaults.asyncresult_class != 0 );
+
+ mono_defaults.waithandle_class = mono_class_from_name (
+ mono_defaults.corlib, "System.Threading", "WaitHandle");
+ g_assert (mono_defaults.waithandle_class != 0 );
+
+ mono_defaults.typehandle_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "RuntimeTypeHandle");
+ g_assert (mono_defaults.typehandle_class != 0);
+
+ mono_defaults.methodhandle_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "RuntimeMethodHandle");
+ g_assert (mono_defaults.methodhandle_class != 0);
+
+ mono_defaults.fieldhandle_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "RuntimeFieldHandle");
+ g_assert (mono_defaults.fieldhandle_class != 0);
+
+ mono_defaults.monotype_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "MonoType");
+ g_assert (mono_defaults.monotype_class != 0);
+
+ mono_defaults.exception_class = mono_class_from_name (
+ mono_defaults.corlib, "System", "Exception");
+ g_assert (mono_defaults.exception_class != 0);
+
+ mono_defaults.thread_class = mono_class_from_name (
+ mono_defaults.corlib, "System.Threading", "Thread");
+ g_assert (mono_defaults.thread_class != 0);
+
+ mono_defaults.transparent_proxy_class = mono_class_from_name (
+ mono_defaults.corlib, "System.Runtime.Remoting.Proxies", "TransparentProxy");
+ g_assert (mono_defaults.transparent_proxy_class != 0);
+
+ mono_defaults.real_proxy_class = mono_class_from_name (
+ mono_defaults.corlib, "System.Runtime.Remoting.Proxies", "RealProxy");
+ g_assert (mono_defaults.real_proxy_class != 0);
+
+ mono_defaults.mono_method_message_class = mono_class_from_name (
+ mono_defaults.corlib, "System.Runtime.Remoting.Messaging", "MonoMethodMessage");
+ g_assert (mono_defaults.mono_method_message_class != 0);
+
+ domain->friendly_name = g_path_get_basename (filename);
+
+ return domain;
+}
+
+/**
+ * mono_domain_get:
+ *
+ * Returns the current domain.
+ */
+inline MonoDomain *
+mono_domain_get ()
+{
+ return ((MonoDomain *)TlsGetValue (appdomain_thread_id));
+}
+
+/**
+ * mono_domain_set:
+ * @domain: the new domain
+ *
+ * Sets the current domain to @domain.
+ */
+inline void
+mono_domain_set (MonoDomain *domain)
+{
+ TlsSetValue (appdomain_thread_id, domain);
+}
+
+/**
+ * mono_domain_assembly_open:
+ * @domain: the application domain
+ * @name: file name of the assembly
+ *
+ * fixme: maybe we should integrate this with mono_assembly_open ??
+ */
+MonoAssembly *
+mono_domain_assembly_open (MonoDomain *domain, char *name)
+{
+ MonoAssembly *ass, *tmp;
+ int i;
+
+ if ((ass = g_hash_table_lookup (domain->assemblies, name)))
+ return ass;
+
+ if (!(ass = mono_assembly_open (name, NULL, NULL)))
+ return NULL;
+
+ mono_domain_lock (domain);
+ g_hash_table_insert (domain->assemblies, ass->name, ass);
+ mono_domain_unlock (domain);
+
+ // fixme: maybe this must be recursive ?
+ for (i = 0; (tmp = ass->image->references [i]) != NULL; i++) {
+ if (!g_hash_table_lookup (domain->assemblies, tmp->name))
+ g_hash_table_insert (domain->assemblies, tmp->name, tmp);
+ }
+
+ return ass;
+}
+
+static void
+remove_assembly (gpointer key, gpointer value, gpointer user_data)
+{
+ mono_assembly_close ((MonoAssembly *)value);
+}
+
+void
+mono_domain_unload (MonoDomain *domain, gboolean force)
+{
+ if ((domain == mono_root_domain) && !force) {
+ g_warning ("cant unload root domain");
+ return;
+ }
+
+ g_free (domain->friendly_name);
+ g_hash_table_foreach (domain->assemblies, remove_assembly, NULL);
+
+ g_hash_table_destroy (domain->env);
+ g_hash_table_destroy (domain->assemblies);
+ mono_g_hash_table_destroy (domain->class_vtable_hash);
+ mono_g_hash_table_destroy (domain->proxy_vtable_hash);
+ mono_g_hash_table_destroy (domain->static_data_hash);
+ g_hash_table_destroy (domain->jit_code_hash);
+ mono_g_hash_table_destroy (domain->ldstr_table);
+ mono_jit_info_table_free (domain->jit_info_table);
+ mono_mempool_destroy (domain->mp);
+ DeleteCriticalSection (&domain->lock);
+
+ // fixme: anything else required ? */
+
+#if HAVE_BOEHM_GC
+#else
+ g_free (domain);
+#endif
+
+ if ((domain == mono_root_domain))
+ mono_root_domain = NULL;
+}
+
diff --git a/mono/metadata/exception.c b/mono/metadata/exception.c
new file mode 100644
index 00000000000..3ed2b9952e8
--- /dev/null
+++ b/mono/metadata/exception.c
@@ -0,0 +1,201 @@
+/*
+ * exception.c: Exception handling
+ *
+ * Authors:
+ * Paolo Molaro (lupus@ximian.com)
+ * Dietmar Maurer (dietmar@ximian.com)
+ * Dick Porter (dick@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <mono/metadata/exception.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/appdomain.h>
+
+MonoException *
+mono_exception_from_name (MonoImage *image, const char *name_space,
+ const char *name)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoClass *klass;
+ MonoObject *o;
+
+ klass = mono_class_from_name (image, name_space, name);
+
+ o = mono_object_new (domain, klass);
+ g_assert (o != NULL);
+
+ mono_runtime_object_init (o);
+
+ return (MonoException *)o;
+}
+
+MonoException *
+mono_get_exception_divide_by_zero ()
+{
+ return mono_exception_from_name (mono_defaults.corlib, "System",
+ "DivideByZeroException");
+}
+
+MonoException *
+mono_get_exception_security ()
+{
+ return mono_exception_from_name (mono_defaults.corlib, "System",
+ "SecurityException");
+}
+
+MonoException *
+mono_get_exception_arithmetic ()
+{
+ return mono_exception_from_name (mono_defaults.corlib, "System",
+ "ArithmeticException");
+}
+
+MonoException *
+mono_get_exception_overflow ()
+{
+ return mono_exception_from_name (mono_defaults.corlib, "System",
+ "OverflowException");
+}
+
+MonoException *
+mono_get_exception_null_reference ()
+{
+ return mono_exception_from_name (mono_defaults.corlib, "System",
+ "NullReferenceException");
+}
+
+MonoException *
+mono_get_exception_execution_engine (const guchar *msg)
+{
+ MonoException *ex;
+ MonoDomain *domain;
+
+ ex = mono_exception_from_name (mono_defaults.corlib, "System",
+ "ExecutionEngineException");
+
+ domain = ((MonoObject *)ex)->vtable->domain;
+
+ if (msg)
+ ex->message = mono_string_new (domain, msg);
+
+ return ex;
+}
+
+MonoException *
+mono_get_exception_invalid_cast ()
+{
+ return mono_exception_from_name (mono_defaults.corlib, "System",
+ "InvalidCastException");
+}
+
+MonoException *
+mono_get_exception_index_out_of_range ()
+{
+ return mono_exception_from_name (mono_defaults.corlib, "System",
+ "IndexOutOfRangeException");
+}
+
+MonoException *
+mono_get_exception_array_type_mismatch ()
+{
+ return mono_exception_from_name (mono_defaults.corlib, "System",
+ "ArrayTypeMismatchException");
+}
+
+MonoException *
+mono_get_exception_type_load ()
+{
+ return mono_exception_from_name (mono_defaults.corlib, "System",
+ "TypeLoadException");
+}
+
+MonoException *
+mono_get_exception_not_implemented ()
+{
+ return mono_exception_from_name (mono_defaults.corlib, "System",
+ "NotImplementedException");
+}
+
+MonoException *
+mono_get_exception_missing_method ()
+{
+ return mono_exception_from_name (mono_defaults.corlib, "System",
+ "MissingMethodException");
+}
+
+MonoException*
+mono_get_exception_argument_null (const guchar *arg)
+{
+ MonoException *ex;
+ MonoDomain *domain;
+
+ ex = (MonoException *)mono_exception_from_name (
+ mono_defaults.corlib, "System", "ArgumentNullException");
+
+ domain = ((MonoObject *)ex)->vtable->domain;
+
+ if (arg)
+ ((MonoArgumentException *)ex)->param_name =
+ mono_string_new (domain, arg);
+
+ return ex;
+}
+
+MonoException *
+mono_get_exception_argument (const guchar *arg, const guchar *msg)
+{
+ MonoException *ex;
+ MonoDomain *domain;
+
+ ex = (MonoException *)mono_exception_from_name (
+ mono_defaults.corlib, "System", "ArgumentException");
+
+ domain = ((MonoObject *)ex)->vtable->domain;
+
+ if (msg)
+ ex->message = mono_string_new (domain, msg);
+
+ if (arg)
+ ((MonoArgumentException *)ex)->param_name =
+ mono_string_new (domain, arg);
+
+ return ex;
+}
+
+MonoException *
+mono_get_exception_argument_out_of_range (const guchar *arg)
+{
+ MonoException *ex;
+ MonoDomain *domain;
+
+ ex = (MonoException *)mono_exception_from_name (
+ mono_defaults.corlib, "System", "ArgumentOutOfRangeException");
+
+ domain = ((MonoObject *)ex)->vtable->domain;
+
+ if (arg)
+ ((MonoArgumentException *)ex)->param_name =
+ mono_string_new (domain, arg);
+
+ return ex;
+}
+
+MonoException *
+mono_get_exception_io (const guchar *msg)
+{
+ MonoException *ex;
+ MonoDomain *domain;
+
+ ex=(MonoException *)mono_exception_from_name (
+ mono_defaults.corlib, "System.IO", "IOException");
+
+ domain = ((MonoObject *)ex)->vtable->domain;
+
+ ex->message=mono_string_new (domain, msg);
+
+ return(ex);
+}
+
+
diff --git a/mono/metadata/exception.h b/mono/metadata/exception.h
new file mode 100644
index 00000000000..81bbc2206ae
--- /dev/null
+++ b/mono/metadata/exception.h
@@ -0,0 +1,67 @@
+#ifndef _MONO_METADATA_EXCEPTION_H_
+#define _MONO_METADATA_EXCEPTION_H_
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/image.h>
+
+typedef void (*MonoExceptionClassInitFunc)(MonoClass *klass);
+typedef void (*MonoExceptionObjectInitFunc)(MonoObject *obj, MonoClass *klass);
+
+extern void
+mono_exception_install_handlers (MonoExceptionClassInitFunc class_init,
+ MonoExceptionObjectInitFunc obj_init);
+
+extern MonoException *
+mono_exception_from_name (MonoImage *image,
+ const char* name_space,
+ const char *name);
+
+MonoException *
+mono_get_exception_divide_by_zero (void);
+
+MonoException *
+mono_get_exception_security (void);
+
+MonoException *
+mono_get_exception_arithmetic (void);
+
+MonoException *
+mono_get_exception_overflow (void);
+
+MonoException *
+mono_get_exception_null_reference (void);
+
+MonoException *
+mono_get_exception_execution_engine (const guchar *msg);
+
+MonoException *
+mono_get_exception_invalid_cast (void);
+
+MonoException *
+mono_get_exception_index_out_of_range (void);
+
+MonoException *
+mono_get_exception_array_type_mismatch (void);
+
+MonoException *
+mono_get_exception_type_load (void);
+
+MonoException *
+mono_get_exception_missing_method (void);
+
+MonoException *
+mono_get_exception_not_implemented (void);
+
+MonoException*
+mono_get_exception_argument_null (const guchar *arg);
+
+MonoException *
+mono_get_exception_argument (const guchar *arg, const guchar *msg);
+
+MonoException *
+mono_get_exception_argument_out_of_range (const guchar *arg);
+
+MonoException *
+mono_get_exception_io (const guchar *msg);
+
+#endif /* _MONO_METADATA_EXCEPTION_H_ */
diff --git a/mono/metadata/file-io.c b/mono/metadata/file-io.c
new file mode 100644
index 00000000000..56a3d7ab3e1
--- /dev/null
+++ b/mono/metadata/file-io.c
@@ -0,0 +1,597 @@
+/*
+ * file-io.c: File IO internal calls
+ *
+ * Author:
+ * Dick Porter (dick@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/metadata/object.h>
+#include <mono/io-layer/io-layer.h>
+#include <mono/metadata/file-io.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/appdomain.h>
+
+#define DEBUG
+
+/* conversion functions */
+
+static guint32 convert_mode(MonoFileMode mono_mode)
+{
+ guint32 mode;
+
+ switch(mono_mode) {
+ case FileMode_CreateNew:
+ mode=CREATE_NEW;
+ break;
+ case FileMode_Create:
+ mode=CREATE_ALWAYS;
+ break;
+ case FileMode_Open:
+ mode=OPEN_EXISTING;
+ break;
+ case FileMode_OpenOrCreate:
+ mode=OPEN_ALWAYS;
+ break;
+ case FileMode_Truncate:
+ mode=TRUNCATE_EXISTING;
+ break;
+ case FileMode_Append:
+ mode=OPEN_ALWAYS;
+ break;
+ default:
+ g_warning("System.IO.FileMode has unknown value 0x%x",
+ mono_mode);
+ /* Safe fallback */
+ mode=OPEN_EXISTING;
+ }
+
+ return(mode);
+}
+
+static guint32 convert_access(MonoFileAccess mono_access)
+{
+ guint32 access;
+
+ switch(mono_access) {
+ case FileAccess_Read:
+ access=GENERIC_READ;
+ break;
+ case FileAccess_Write:
+ access=GENERIC_WRITE;
+ break;
+ case FileAccess_ReadWrite:
+ access=GENERIC_READ|GENERIC_WRITE;
+ break;
+ default:
+ g_warning("System.IO.FileAccess has unknown value 0x%x",
+ mono_access);
+ /* Safe fallback */
+ access=GENERIC_READ;
+ }
+
+ return(access);
+}
+
+static guint32 convert_share(MonoFileShare mono_share)
+{
+ guint32 share;
+
+ switch(mono_share) {
+ case FileShare_None:
+ share=0;
+ break;
+ case FileShare_Read:
+ share=FILE_SHARE_READ;
+ break;
+ case FileShare_Write:
+ share=FILE_SHARE_WRITE;
+ break;
+ case FileShare_ReadWrite:
+ share=FILE_SHARE_READ|FILE_SHARE_WRITE;
+ break;
+ default:
+ g_warning("System.IO.FileShare has unknown value 0x%x",
+ mono_share);
+ /* Safe fallback */
+ share=0;
+ }
+
+ return(share);
+}
+
+#if 0
+static guint32 convert_stdhandle(guint32 fd)
+{
+ guint32 stdhandle;
+
+ switch(fd) {
+ case 0:
+ stdhandle=STD_INPUT_HANDLE;
+ break;
+ case 1:
+ stdhandle=STD_OUTPUT_HANDLE;
+ break;
+ case 2:
+ stdhandle=STD_ERROR_HANDLE;
+ break;
+ default:
+ g_warning("unknown standard file descriptor %d", fd);
+ stdhandle=STD_INPUT_HANDLE;
+ }
+
+ return(stdhandle);
+}
+#endif
+
+static guint32 convert_seekorigin(MonoSeekOrigin origin)
+{
+ guint32 w32origin;
+
+ switch(origin) {
+ case SeekOrigin_Begin:
+ w32origin=FILE_BEGIN;
+ break;
+ case SeekOrigin_Current:
+ w32origin=FILE_CURRENT;
+ break;
+ case SeekOrigin_End:
+ w32origin=FILE_END;
+ break;
+ default:
+ g_warning("System.IO.SeekOrigin has unknown value 0x%x",
+ origin);
+ /* Safe fallback */
+ w32origin=FILE_CURRENT;
+ }
+
+ return(w32origin);
+}
+
+static gint64 convert_filetime (const FILETIME *filetime)
+{
+ gint64 *ticks;
+
+ ticks = (gint64 *)filetime;
+ return *ticks;
+}
+
+static void convert_win32_file_attribute_data (const WIN32_FILE_ATTRIBUTE_DATA *data, const gunichar2 *name, MonoIOStat *stat)
+{
+ int len;
+
+ stat->attributes = data->dwFileAttributes;
+ stat->creation_time = convert_filetime (&data->ftCreationTime);
+ stat->last_access_time = convert_filetime (&data->ftLastAccessTime);
+ stat->last_write_time = convert_filetime (&data->ftLastWriteTime);
+ stat->length = ((gint64)data->nFileSizeHigh << 32) | data->nFileSizeLow;
+
+ len = 0;
+ while (name [len])
+ ++ len;
+
+ stat->name = mono_string_new_utf16 (mono_domain_get (), name, len);
+}
+
+/* System.IO.MonoIO internal calls */
+
+gint32
+ves_icall_System_IO_MonoIO_GetLastError ()
+{
+ return GetLastError ();
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path)
+{
+ gunichar2 *utf16_path;
+ gboolean result;
+
+ utf16_path = mono_string_to_utf16 (path);
+ result = CreateDirectory (utf16_path, NULL);
+ g_free (utf16_path);
+
+ return result;
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path)
+{
+ gunichar2 *utf16_path;
+ gboolean result;
+
+ utf16_path = mono_string_to_utf16 (path);
+ result = RemoveDirectory (utf16_path);
+ g_free (utf16_path);
+
+ return result;
+}
+
+HANDLE
+ves_icall_System_IO_MonoIO_FindFirstFile (MonoString *path, MonoIOStat *stat)
+{
+ gunichar2 *utf16_path;
+ WIN32_FIND_DATA data;
+ HANDLE result;
+
+ utf16_path = mono_string_to_utf16 (path);
+ result = FindFirstFile (utf16_path, &data);
+ g_free (utf16_path);
+
+ /* note: WIN32_FIND_DATA is an extension of WIN32_FILE_ATTRIBUTE_DATA */
+
+ if (result != INVALID_HANDLE_VALUE)
+ convert_win32_file_attribute_data ((const WIN32_FILE_ATTRIBUTE_DATA *)&data,
+ &data.cFileName [0], stat);
+
+ return result;
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_FindNextFile (HANDLE find, MonoIOStat *stat)
+{
+ WIN32_FIND_DATA data;
+ gboolean result;
+
+ result = FindNextFile (find, &data);
+ if (result)
+ convert_win32_file_attribute_data ((const WIN32_FILE_ATTRIBUTE_DATA *)&data,
+ &data.cFileName [0], stat);
+
+ return result;
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_FindClose (HANDLE find)
+{
+ return FindClose (find);
+}
+
+MonoString *
+ves_icall_System_IO_MonoIO_GetCurrentDirectory ()
+{
+ MonoString *result;
+ gunichar2 *buf;
+ int len;
+
+ len = MAX_PATH + 1;
+ buf = g_new (gunichar2, len);
+
+ result = NULL;
+ if (GetCurrentDirectory (len, buf) > 0) {
+ len = 0;
+ while (buf [len])
+ ++ len;
+
+ result = mono_string_new_utf16 (mono_domain_get (), buf, len);
+ }
+
+ g_free (buf);
+ return result;
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_SetCurrentDirectory (MonoString *path)
+{
+ gunichar2 *utf16_path;
+ gboolean result;
+
+ utf16_path = mono_string_to_utf16 (path);
+ result = SetCurrentDirectory (utf16_path);
+ g_free (utf16_path);
+
+ return result;
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_MoveFile (MonoString *path, MonoString *dest)
+{
+ gunichar2 *utf16_path, *utf16_dest;
+ gboolean result;
+
+ utf16_path = mono_string_to_utf16 (path);
+ utf16_dest = mono_string_to_utf16 (dest);
+ result = MoveFile (utf16_path, utf16_dest);
+ g_free (utf16_path);
+ g_free (utf16_dest);
+
+ return result;
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_CopyFile (MonoString *path, MonoString *dest, gboolean overwrite)
+{
+ gunichar2 *utf16_path, *utf16_dest;
+ gboolean result;
+
+ utf16_path = mono_string_to_utf16 (path);
+ utf16_dest = mono_string_to_utf16 (dest);
+ result = CopyFile (utf16_path, utf16_dest, !overwrite);
+ g_free (utf16_path);
+ g_free (utf16_dest);
+
+ return result;
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_DeleteFile (MonoString *path)
+{
+ gunichar2 *utf16_path;
+ gboolean result;
+
+ utf16_path = mono_string_to_utf16 (path);
+ result = DeleteFile (utf16_path);
+ g_free (utf16_path);
+
+ return result;
+}
+
+gint32
+ves_icall_System_IO_MonoIO_GetFileAttributes (MonoString *path)
+{
+ gunichar2 *utf16_path;
+ gint32 result;
+
+ utf16_path = mono_string_to_utf16 (path);
+ result = GetFileAttributes (utf16_path);
+ g_free (utf16_path);
+
+ return result;
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_SetFileAttributes (MonoString *path, gint32 attrs)
+{
+ gunichar2 *utf16_path;
+ gboolean result;
+
+ utf16_path = mono_string_to_utf16 (path);
+ result = SetFileAttributes (utf16_path, attrs);
+ g_free (utf16_path);
+
+ return result;
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_GetFileStat (MonoString *path, MonoIOStat *stat)
+{
+ gunichar2 *utf16_path;
+ gboolean result;
+ WIN32_FILE_ATTRIBUTE_DATA data;
+
+ utf16_path = mono_string_to_utf16 (path);
+ result = GetFileAttributesEx (utf16_path, GetFileExInfoStandard, &data);
+ g_free (utf16_path);
+
+ if (result)
+ convert_win32_file_attribute_data (&data, utf16_path, stat);
+
+ return result;
+}
+
+HANDLE
+ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode, gint32 access_mode, gint32 share)
+{
+ gunichar2 *utf16_filename;
+ HANDLE result;
+
+ utf16_filename = mono_string_to_utf16 (filename);
+ result = CreateFile (utf16_filename, convert_access (access_mode), convert_share (share),
+ NULL, convert_mode (mode), FILE_ATTRIBUTE_NORMAL, NULL);
+ g_free (utf16_filename);
+
+ return result;
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_Close (HANDLE handle)
+{
+ return CloseHandle (handle);
+}
+
+gint32
+ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArray *dest, gint32 dest_offset, gint32 count)
+{
+ guchar *buffer;
+ gboolean result;
+ guint32 n;
+
+ if (dest_offset + count > mono_array_length (dest))
+ return 0;
+
+ buffer = mono_array_addr (dest, guchar, dest_offset);
+ result = ReadFile (handle, buffer, count, &n, NULL);
+
+ if (!result)
+ return -1;
+
+ return (gint32)n;
+}
+
+gint32
+ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArray *src, gint32 src_offset, gint32 count)
+{
+ guchar *buffer;
+ gboolean result;
+ guint32 n;
+
+ if (src_offset + count > mono_array_length (src))
+ return 0;
+
+ buffer = mono_array_addr (src, guchar, src_offset);
+ result = WriteFile (handle, buffer, count, &n, NULL);
+
+ if (!result)
+ return -1;
+
+ return (gint32)n;
+}
+
+gint64
+ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin)
+{
+ guint32 offset_hi;
+
+ offset_hi = offset >> 32;
+ offset = SetFilePointer (handle, offset & 0xFFFFFFFF, &offset_hi,
+ convert_seekorigin (origin));
+
+ return offset | ((gint64)offset_hi << 32);
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_Flush (HANDLE handle)
+{
+ return FlushFileBuffers (handle);
+}
+
+gint64
+ves_icall_System_IO_MonoIO_GetLength (HANDLE handle)
+{
+ gint64 length;
+ guint32 length_hi;
+
+ length = GetFileSize (handle, &length_hi);
+ return length | ((gint64)length_hi << 32);
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length)
+{
+ gint64 offset;
+ gint32 offset_hi;
+ gint32 length_hi;
+ gboolean result;
+
+ /* save file pointer */
+
+ offset_hi = 0;
+ offset = SetFilePointer (handle, 0, &offset_hi, FILE_CURRENT);
+
+ /* extend or truncate */
+
+ length_hi = length >> 32;
+ SetFilePointer (handle, length & 0xFFFFFFFF, &length_hi, FILE_BEGIN);
+ result = SetEndOfFile (handle);
+
+ /* restore file pointer */
+
+ SetFilePointer (handle, offset & 0xFFFFFFFF, &offset_hi, FILE_BEGIN);
+
+ return result;
+}
+
+gboolean
+ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time, gint64 last_access_time, gint64 last_write_time)
+{
+ const FILETIME *creation_filetime;
+ const FILETIME *last_access_filetime;
+ const FILETIME *last_write_filetime;
+
+ if (creation_time < 0)
+ creation_filetime = NULL;
+ else
+ creation_filetime = (FILETIME *)&creation_time;
+
+ if (last_access_time < 0)
+ last_access_filetime = NULL;
+ else
+ last_access_filetime = (FILETIME *)&last_access_time;
+
+ if (last_write_time < 0)
+ last_write_filetime = NULL;
+ else
+ last_write_filetime = (FILETIME *)&last_write_time;
+
+ return SetFileTime (handle, creation_filetime, last_access_filetime, last_write_filetime);
+}
+
+HANDLE
+ves_icall_System_IO_MonoIO_get_ConsoleOutput ()
+{
+ return GetStdHandle (STD_OUTPUT_HANDLE);
+}
+
+HANDLE
+ves_icall_System_IO_MonoIO_get_ConsoleInput ()
+{
+ return GetStdHandle (STD_INPUT_HANDLE);
+}
+
+HANDLE
+ves_icall_System_IO_MonoIO_get_ConsoleError ()
+{
+ return GetStdHandle (STD_ERROR_HANDLE);
+}
+
+gunichar2
+ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar ()
+{
+#if defined (PLATFORM_WIN32)
+ return (gunichar2) 0x003a; /* colon */
+#else
+ return (gunichar2) 0x002f; /* forward slash */
+#endif
+}
+
+gunichar2
+ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar ()
+{
+#if defined (PLATFORM_WIN32)
+ return (gunichar2) 0x005c; /* backslash */
+#else
+ return (gunichar2) 0x002f; /* forward slash */
+#endif
+}
+
+gunichar2
+ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar ()
+{
+#if defined (PLATFORM_WIN32)
+ return (gunichar2) 0x002f; /* forward slash */
+#else
+ return (gunichar2) 0x005c; /* backslash */
+#endif
+}
+
+gunichar2
+ves_icall_System_IO_MonoIO_get_PathSeparator ()
+{
+#if defined (PLATFORM_WIN32)
+ return (gunichar2) 0x003b; /* semicolon */
+#else
+ return (gunichar2) 0x003a; /* colon */
+#endif
+}
+
+static gunichar2 invalid_path_chars [] = {
+#if defined (PLATFORM_WIN32)
+ 0x0022, /* double quote */
+ 0x003c, /* less than */
+ 0x003e, /* greater than */
+ 0x007c, /* pipe */
+#endif
+ 0x0000 /* null */
+};
+
+MonoArray *
+ves_icall_System_IO_MonoIO_get_InvalidPathChars ()
+{
+ MonoArray *chars;
+ MonoDomain *domain;
+ int i, n;
+
+ domain = mono_domain_get ();
+ chars = mono_array_new (domain, mono_defaults.char_class, 5);
+
+ n = sizeof (invalid_path_chars) / sizeof (gunichar2);
+
+ for (i = 0; i < n; ++ i)
+ mono_array_set (chars, gunichar2, i, invalid_path_chars [i]);
+
+ return chars;
+}
diff --git a/mono/metadata/file-io.h b/mono/metadata/file-io.h
new file mode 100644
index 00000000000..ec6839ee737
--- /dev/null
+++ b/mono/metadata/file-io.h
@@ -0,0 +1,157 @@
+/*
+ * file-io.h: File IO internal calls
+ *
+ * Authors:
+ * Dick Porter (dick@ximian.com)
+ * Dan Lewis (dihlewis@yahoo.co.uk)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#ifndef _MONO_METADATA_FILEIO_H_
+#define _MONO_METADATA_FILEIO_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/metadata/object.h>
+#include <mono/io-layer/io-layer.h>
+
+/* This is a copy of System.IO.FileAccess */
+typedef enum {
+ FileAccess_Read=0x01,
+ FileAccess_Write=0x02,
+ FileAccess_ReadWrite=FileAccess_Read|FileAccess_Write,
+} MonoFileAccess;
+
+/* This is a copy of System.IO.FileMode */
+typedef enum {
+ FileMode_CreateNew=1,
+ FileMode_Create=2,
+ FileMode_Open=3,
+ FileMode_OpenOrCreate=4,
+ FileMode_Truncate=5,
+ FileMode_Append=6,
+} MonoFileMode;
+
+/* This is a copy of System.IO.FileShare */
+typedef enum {
+ FileShare_None=0x0,
+ FileShare_Read=0x01,
+ FileShare_Write=0x02,
+ FileShare_ReadWrite=FileShare_Read|FileShare_Write,
+} MonoFileShare;
+
+/* This is a copy of System.IO.SeekOrigin */
+typedef enum {
+ SeekOrigin_Begin=0,
+ SeekOrigin_Current=1,
+ SeekOrigin_End=2,
+} MonoSeekOrigin;
+
+/* This is a copy of System.IO.MonoIOStat */
+typedef struct _MonoIOStat {
+ MonoString *name;
+ gint32 attributes;
+ gint64 length;
+ gint64 creation_time;
+ gint64 last_access_time;
+ gint64 last_write_time;
+} MonoIOStat;
+
+/* System.IO.MonoIO */
+
+extern gint32
+ves_icall_System_IO_MonoIO_GetLastError (void);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path);
+
+extern HANDLE
+ves_icall_System_IO_MonoIO_FindFirstFile (MonoString *path, MonoIOStat *stat);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_FindNextFile (HANDLE find, MonoIOStat *stat);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_FindClose (HANDLE find);
+
+extern MonoString *
+ves_icall_System_IO_MonoIO_GetCurrentDirectory (void);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_SetCurrentDirectory (MonoString *path);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_MoveFile (MonoString *path, MonoString *dest);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_CopyFile (MonoString *path, MonoString *dest, gboolean overwrite);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_DeleteFile (MonoString *path);
+
+extern gint32
+ves_icall_System_IO_MonoIO_GetFileAttributes (MonoString *path);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_SetFileAttributes (MonoString *path, gint32 attrs);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_GetFileStat (MonoString *path, MonoIOStat *stat);
+
+extern HANDLE
+ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode, gint32 access_mode, gint32 share);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_Close (HANDLE handle);
+
+extern gint32
+ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArray *dest, gint32 dest_offset, gint32 count);
+
+extern gint32
+ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArray *src, gint32 src_offset, gint32 count);
+
+extern gint64
+ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_Flush (HANDLE handle);
+
+extern gint64
+ves_icall_System_IO_MonoIO_GetLength (HANDLE handle);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length);
+
+extern gboolean
+ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time, gint64 last_access_time, gint64 last_write_time);
+
+extern HANDLE
+ves_icall_System_IO_MonoIO_get_ConsoleOutput (void);
+
+extern HANDLE
+ves_icall_System_IO_MonoIO_get_ConsoleInput (void);
+
+extern HANDLE
+ves_icall_System_IO_MonoIO_get_ConsoleError (void);
+
+extern gunichar2
+ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar (void);
+
+extern gunichar2
+ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar (void);
+
+extern gunichar2
+ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar (void);
+
+extern gunichar2
+ves_icall_System_IO_MonoIO_get_PathSeparator (void);
+
+extern MonoArray *
+ves_icall_System_IO_MonoIO_get_InvalidPathChars (void);
+
+#endif /* _MONO_METADATA_FILEIO_H_ */
diff --git a/mono/metadata/gc.c b/mono/metadata/gc.c
new file mode 100644
index 00000000000..e9319dab01c
--- /dev/null
+++ b/mono/metadata/gc.c
@@ -0,0 +1,103 @@
+/*
+ * metadata/gc.c: GC icalls.
+ *
+ * Author: Paolo Molaro <lupus@ximian.com>
+ *
+ * (C) 2002 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/metadata/gc.h>
+#include <mono/metadata/threads.h>
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#endif
+
+static int finalize_slot = -1;
+
+/*
+ * actually, we might want to queue the finalize requests in a separate thread,
+ * but we need to be careful about the execution domain of the thread...
+ */
+static void
+run_finalize (void *obj, void *data)
+{
+ MonoObject *o = obj;
+
+ if (finalize_slot < 0) {
+ int i;
+ for (i = 0; i < mono_defaults.object_class->vtable_size; ++i) {
+ MonoMethod *cm = mono_defaults.object_class->vtable [i];
+
+ if (!strcmp (cm->name, "Finalize")) {
+ finalize_slot = i;
+ break;
+ }
+ }
+ }
+ /* speedup later... */
+ /*
+ * Disabled: it seems to be called too early.
+ * g_print ("finalizer is run on %s\n", mono_object_class(o)->name);
+ mono_runtime_invoke (o->vtable->klass->vtable [finalize_slot], obj, NULL);*/
+}
+
+void
+mono_object_register_finalizer (MonoObject *obj)
+{
+#if HAVE_BOEHM_GC
+ GC_register_finalizer (obj, run_finalize, NULL, NULL, NULL);
+#endif
+}
+
+void
+ves_icall_System_GC_InternalCollect (int generation)
+{
+#if HAVE_BOEHM_GC
+ GC_gcollect ();
+#endif
+}
+
+gint64
+ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection)
+{
+#if HAVE_BOEHM_GC
+ if (forceCollection)
+ GC_gcollect ();
+ return GC_get_heap_size ();
+#else
+ return 0;
+#endif
+}
+
+void
+ves_icall_System_GC_KeepAlive (MonoObject *obj)
+{
+ /*
+ * Does nothing.
+ */
+}
+
+void
+ves_icall_System_GC_ReRegisterForFinalize (MonoObject *obj)
+{
+#if HAVE_BOEHM_GC
+ GC_register_finalizer (obj, run_finalize, NULL, NULL, NULL);
+#endif
+}
+
+void
+ves_icall_System_GC_SuppressFinalize (MonoObject *obj)
+{
+#if HAVE_BOEHM_GC
+ GC_register_finalizer (obj, NULL, NULL, NULL, NULL);
+#endif
+}
+
+void
+ves_icall_System_GC_WaitForPendingFinalizers (void)
+{
+}
+
diff --git a/mono/metadata/gc.h b/mono/metadata/gc.h
new file mode 100644
index 00000000000..52823fbc70a
--- /dev/null
+++ b/mono/metadata/gc.h
@@ -0,0 +1,24 @@
+/*
+ * metadata/gc.h: GC icalls.
+ *
+ * Author: Paolo Molaro <lupus@ximian.com>
+ *
+ * (C) 2002 Ximian, Inc.
+ */
+
+#ifndef __MONO_METADATA_GC_H__
+#define __MONO_METADATA_GC_H__
+
+#include <glib.h>
+#include <mono/metadata/object.h>
+
+void mono_object_register_finalizer (MonoObject *obj);
+void ves_icall_System_GC_InternalCollect (int generation);
+gint64 ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection);
+void ves_icall_System_GC_KeepAlive (MonoObject *obj);
+void ves_icall_System_GC_ReRegisterForFinalize (MonoObject *obj);
+void ves_icall_System_GC_SuppressFinalize (MonoObject *obj);
+void ves_icall_System_GC_WaitForPendingFinalizers (void);
+
+#endif /* __MONO_METADATA_GC_H__ */
+
diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c
new file mode 100644
index 00000000000..1931f66d7e0
--- /dev/null
+++ b/mono/metadata/icall.c
@@ -0,0 +1,2535 @@
+/*
+ * icall.c:
+ *
+ * Authors:
+ * Dietmar Maurer (dietmar@ximian.com)
+ * Paolo Molaro (lupus@ximian.com)
+ * Patrik Torstensson (patrik.torstensson@labs2.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#if defined (PLATFORM_WIN32)
+#include <stdlib.h>
+#endif
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/threads.h>
+#include <mono/metadata/reflection.h>
+#include <mono/metadata/assembly.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/file-io.h>
+#include <mono/metadata/socket-io.h>
+#include <mono/metadata/mono-endian.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/metadata/unicode.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/gc.h>
+#include <mono/metadata/rand.h>
+#include <mono/metadata/sysmath.h>
+#include <mono/metadata/debug-symfile.h>
+#include <mono/metadata/string-icalls.h>
+#include <mono/io-layer/io-layer.h>
+
+#if defined (PLATFORM_WIN32)
+#include <windows.h>
+#endif
+#include "decimal.h"
+
+static MonoString *
+mono_double_ToStringImpl (double value)
+{
+ /* FIXME: Handle formats, etc. */
+ const gchar *retVal;
+ retVal = g_strdup_printf ("%f", value);
+ return mono_string_new (mono_domain_get (), retVal);
+}
+
+static MonoObject *
+ves_icall_System_Array_GetValueImpl (MonoObject *this, guint32 pos)
+{
+ MonoClass *ac;
+ MonoArray *ao;
+ gint32 esize;
+ gpointer *ea;
+
+ ao = (MonoArray *)this;
+ ac = (MonoClass *)ao->obj.vtable->klass;
+
+ esize = mono_array_element_size (ac);
+ ea = (gpointer*)((char*)ao->vector + (pos * esize));
+
+ if (ac->element_class->valuetype)
+ return mono_value_box (this->vtable->domain, ac->element_class, ea);
+ else
+ return *ea;
+}
+
+static MonoObject *
+ves_icall_System_Array_GetValue (MonoObject *this, MonoObject *idxs)
+{
+ MonoClass *ac, *ic;
+ MonoArray *ao, *io;
+ gint32 i, pos, *ind;
+
+ MONO_CHECK_ARG_NULL (idxs);
+
+ io = (MonoArray *)idxs;
+ ic = (MonoClass *)io->obj.vtable->klass;
+
+ ao = (MonoArray *)this;
+ ac = (MonoClass *)ao->obj.vtable->klass;
+
+ g_assert (ic->rank == 1);
+ if (io->bounds != NULL || io->max_length != ac->rank)
+ mono_raise_exception (mono_get_exception_argument (NULL, NULL));
+
+ ind = (guint32 *)io->vector;
+
+ if (ao->bounds == NULL) {
+ if (*ind < 0 || *ind >= ao->max_length)
+ mono_raise_exception (mono_get_exception_index_out_of_range ());
+
+ return ves_icall_System_Array_GetValueImpl (this, *ind);
+ }
+
+ for (i = 0; i < ac->rank; i++)
+ if ((ind [i] < ao->bounds [i].lower_bound) ||
+ (ind [i] >= ao->bounds [i].length + ao->bounds [i].lower_bound))
+ mono_raise_exception (mono_get_exception_index_out_of_range ());
+
+ pos = ind [0] - ao->bounds [0].lower_bound;
+ for (i = 1; i < ac->rank; i++)
+ pos = pos*ao->bounds [i].length + ind [i] -
+ ao->bounds [i].lower_bound;
+
+ return ves_icall_System_Array_GetValueImpl (this, pos);
+}
+
+static void
+ves_icall_System_Array_SetValueImpl (MonoArray *this, MonoObject *value, guint32 pos)
+{
+ MonoClass *ac, *vc, *ec;
+ gint32 esize, vsize;
+ gpointer *ea, *va;
+
+ guint64 u64;
+ gint64 i64;
+ gdouble r64;
+
+ if (value)
+ vc = value->vtable->klass;
+ else
+ vc = NULL;
+
+ ac = this->obj.vtable->klass;
+ ec = ac->element_class;
+
+ esize = mono_array_element_size (ac);
+ ea = (gpointer*)((char*)this->vector + (pos * esize));
+ va = (gpointer*)((char*)value + sizeof (MonoObject));
+
+ if (!value) {
+ memset (ea, 0, esize);
+ return;
+ }
+
+#define NO_WIDENING_CONVERSION G_STMT_START{\
+ mono_raise_exception (mono_get_exception_argument ( \
+ "value", "not a widening conversion")); \
+}G_STMT_END
+
+#define CHECK_WIDENING_CONVERSION(extra) G_STMT_START{\
+ if (esize < vsize + ## extra) \
+ mono_raise_exception (mono_get_exception_argument ( \
+ "value", "not a widening conversion")); \
+}G_STMT_END
+
+#define INVALID_CAST G_STMT_START{\
+ mono_raise_exception (mono_get_exception_invalid_cast ()); \
+}G_STMT_END
+
+ /* Check element (destination) type. */
+ switch (ec->byval_arg.type) {
+ case MONO_TYPE_STRING:
+ switch (vc->byval_arg.type) {
+ case MONO_TYPE_STRING:
+ break;
+ default:
+ INVALID_CAST;
+ }
+ break;
+ case MONO_TYPE_BOOLEAN:
+ switch (vc->byval_arg.type) {
+ case MONO_TYPE_BOOLEAN:
+ break;
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ NO_WIDENING_CONVERSION;
+ default:
+ INVALID_CAST;
+ }
+ break;
+ }
+
+ if (!ec->valuetype) {
+ *ea = (gpointer)value;
+ return;
+ }
+
+ if (mono_object_isinst (value, ec)) {
+ memcpy (ea, (char *)value + sizeof (MonoObject), esize);
+ return;
+ }
+
+ if (!vc->valuetype)
+ INVALID_CAST;
+
+ vsize = mono_class_instance_size (vc) - sizeof (MonoObject);
+
+#if 0
+ g_message (G_STRLOC ": %d (%d) <= %d (%d)",
+ ec->byval_arg.type, esize,
+ vc->byval_arg.type, vsize);
+#endif
+
+#define ASSIGN_UNSIGNED(etype) G_STMT_START{\
+ switch (vc->byval_arg.type) { \
+ case MONO_TYPE_U1: \
+ case MONO_TYPE_U2: \
+ case MONO_TYPE_U4: \
+ case MONO_TYPE_U8: \
+ case MONO_TYPE_CHAR: \
+ CHECK_WIDENING_CONVERSION(0); \
+ *(## etype *) ea = (## etype) u64; \
+ return; \
+ /* You can't assign a signed value to an unsigned array. */ \
+ case MONO_TYPE_I1: \
+ case MONO_TYPE_I2: \
+ case MONO_TYPE_I4: \
+ case MONO_TYPE_I8: \
+ /* You can't assign a floating point number to an integer array. */ \
+ case MONO_TYPE_R4: \
+ case MONO_TYPE_R8: \
+ NO_WIDENING_CONVERSION; \
+ } \
+}G_STMT_END
+
+#define ASSIGN_SIGNED(etype) G_STMT_START{\
+ switch (vc->byval_arg.type) { \
+ case MONO_TYPE_I1: \
+ case MONO_TYPE_I2: \
+ case MONO_TYPE_I4: \
+ case MONO_TYPE_I8: \
+ CHECK_WIDENING_CONVERSION(0); \
+ *(## etype *) ea = (## etype) i64; \
+ return; \
+ /* You can assign an unsigned value to a signed array if the array's */ \
+ /* element size is larger than the value size. */ \
+ case MONO_TYPE_U1: \
+ case MONO_TYPE_U2: \
+ case MONO_TYPE_U4: \
+ case MONO_TYPE_U8: \
+ case MONO_TYPE_CHAR: \
+ CHECK_WIDENING_CONVERSION(1); \
+ *(## etype *) ea = (## etype) u64; \
+ return; \
+ /* You can't assign a floating point number to an integer array. */ \
+ case MONO_TYPE_R4: \
+ case MONO_TYPE_R8: \
+ NO_WIDENING_CONVERSION; \
+ } \
+}G_STMT_END
+
+#define ASSIGN_REAL(etype) G_STMT_START{\
+ switch (vc->byval_arg.type) { \
+ case MONO_TYPE_R4: \
+ case MONO_TYPE_R8: \
+ CHECK_WIDENING_CONVERSION(0); \
+ *(## etype *) ea = (## etype) r64; \
+ return; \
+ /* All integer values fit into a floating point array, so we don't */ \
+ /* need to CHECK_WIDENING_CONVERSION here. */ \
+ case MONO_TYPE_I1: \
+ case MONO_TYPE_I2: \
+ case MONO_TYPE_I4: \
+ case MONO_TYPE_I8: \
+ *(## etype *) ea = (## etype) i64; \
+ return; \
+ case MONO_TYPE_U1: \
+ case MONO_TYPE_U2: \
+ case MONO_TYPE_U4: \
+ case MONO_TYPE_U8: \
+ case MONO_TYPE_CHAR: \
+ *(## etype *) ea = (## etype) u64; \
+ return; \
+ } \
+}G_STMT_END
+
+ switch (vc->byval_arg.type) {
+ case MONO_TYPE_U1:
+ u64 = *(guint8 *) va;
+ break;
+ case MONO_TYPE_U2:
+ u64 = *(guint16 *) va;
+ break;
+ case MONO_TYPE_U4:
+ u64 = *(guint32 *) va;
+ break;
+ case MONO_TYPE_U8:
+ u64 = *(guint64 *) va;
+ break;
+ case MONO_TYPE_I1:
+ i64 = *(gint8 *) va;
+ break;
+ case MONO_TYPE_I2:
+ i64 = *(gint16 *) va;
+ break;
+ case MONO_TYPE_I4:
+ i64 = *(gint32 *) va;
+ break;
+ case MONO_TYPE_I8:
+ i64 = *(gint64 *) va;
+ break;
+ case MONO_TYPE_R4:
+ r64 = *(gfloat *) va;
+ break;
+ case MONO_TYPE_R8:
+ r64 = *(gdouble *) va;
+ break;
+ case MONO_TYPE_CHAR:
+ u64 = *(guint16 *) va;
+ break;
+ case MONO_TYPE_BOOLEAN:
+ /* Boolean is only compatible with itself. */
+ switch (ec->byval_arg.type) {
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ NO_WIDENING_CONVERSION;
+ default:
+ INVALID_CAST;
+ }
+ break;
+ }
+
+ /* If we can't do a direct copy, let's try a widening conversion. */
+ switch (ec->byval_arg.type) {
+ case MONO_TYPE_CHAR:
+ ASSIGN_UNSIGNED (guint16);
+ case MONO_TYPE_U1:
+ ASSIGN_UNSIGNED (guint8);
+ case MONO_TYPE_U2:
+ ASSIGN_UNSIGNED (guint16);
+ case MONO_TYPE_U4:
+ ASSIGN_UNSIGNED (guint32);
+ case MONO_TYPE_U8:
+ ASSIGN_UNSIGNED (guint64);
+ case MONO_TYPE_I1:
+ ASSIGN_SIGNED (gint8);
+ case MONO_TYPE_I2:
+ ASSIGN_SIGNED (gint16);
+ case MONO_TYPE_I4:
+ ASSIGN_SIGNED (gint32);
+ case MONO_TYPE_I8:
+ ASSIGN_SIGNED (gint64);
+ case MONO_TYPE_R4:
+ ASSIGN_REAL (gfloat);
+ case MONO_TYPE_R8:
+ ASSIGN_REAL (gdouble);
+ }
+
+ INVALID_CAST;
+ /* Not reached, INVALID_CAST does not return. Just to avoid a compiler warning ... */
+ return;
+
+#undef INVALID_CAST
+#undef NO_WIDENING_CONVERSION
+#undef CHECK_WIDENING_CONVERSION
+#undef ASSIGN_UNSIGNED
+#undef ASSIGN_SIGNED
+#undef ASSIGN_REAL
+}
+
+static void
+ves_icall_System_Array_SetValue (MonoArray *this, MonoObject *value,
+ MonoArray *idxs)
+{
+ MonoClass *ac, *ic;
+ gint32 i, pos, *ind;
+
+ MONO_CHECK_ARG_NULL (idxs);
+
+ ic = idxs->obj.vtable->klass;
+ ac = this->obj.vtable->klass;
+
+ g_assert (ic->rank == 1);
+ if (idxs->bounds != NULL || idxs->max_length != ac->rank)
+ mono_raise_exception (mono_get_exception_argument (NULL, NULL));
+
+ ind = (guint32 *)idxs->vector;
+
+ if (this->bounds == NULL) {
+ if (*ind < 0 || *ind >= this->max_length)
+ mono_raise_exception (mono_get_exception_index_out_of_range ());
+
+ ves_icall_System_Array_SetValueImpl (this, value, *ind);
+ return;
+ }
+
+ for (i = 0; i < ac->rank; i++)
+ if ((ind [i] < this->bounds [i].lower_bound) ||
+ (ind [i] >= this->bounds [i].length + this->bounds [i].lower_bound))
+ mono_raise_exception (mono_get_exception_index_out_of_range ());
+
+ pos = ind [0] - this->bounds [0].lower_bound;
+ for (i = 1; i < ac->rank; i++)
+ pos = pos * this->bounds [i].length + ind [i] -
+ this->bounds [i].lower_bound;
+
+ ves_icall_System_Array_SetValueImpl (this, value, pos);
+}
+
+static MonoArray *
+ves_icall_System_Array_CreateInstanceImpl (MonoReflectionType *type, MonoArray *lengths, MonoArray *bounds)
+{
+ MonoClass *aklass;
+ MonoArray *array;
+ gint32 *sizes, i;
+
+ MONO_CHECK_ARG_NULL (type);
+ MONO_CHECK_ARG_NULL (lengths);
+
+ MONO_CHECK_ARG (lengths, mono_array_length (lengths) > 0);
+ if (bounds)
+ MONO_CHECK_ARG (bounds, mono_array_length (lengths) == mono_array_length (bounds));
+
+ for (i = 0; i < mono_array_length (lengths); i++)
+ if (mono_array_get (lengths, gint32, i) < 0)
+ mono_raise_exception (mono_get_exception_argument_out_of_range (NULL));
+
+ aklass = mono_array_class_get (type->type, mono_array_length (lengths));
+
+ sizes = alloca (aklass->rank * sizeof(guint32) * 2);
+ for (i = 0; i < aklass->rank; ++i) {
+ sizes [i] = mono_array_get (lengths, gint32, i);
+ if (bounds)
+ sizes [i + aklass->rank] = mono_array_get (bounds, gint32, i);
+ else
+ sizes [i + aklass->rank] = 0;
+ }
+
+ array = mono_array_new_full (mono_domain_get (), aklass, sizes, sizes + aklass->rank);
+
+ return array;
+}
+
+static gint32
+ves_icall_System_Array_GetRank (MonoObject *this)
+{
+ return this->vtable->klass->rank;
+}
+
+static gint32
+ves_icall_System_Array_GetLength (MonoArray *this, gint32 dimension)
+{
+ gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
+ if ((dimension < 0) || (dimension >= rank))
+ mono_raise_exception (mono_get_exception_index_out_of_range ());
+
+ if (this->bounds == NULL)
+ return this->max_length;
+
+ return this->bounds [dimension].length;
+}
+
+static gint32
+ves_icall_System_Array_GetLowerBound (MonoArray *this, gint32 dimension)
+{
+ gint32 rank = ((MonoObject *)this)->vtable->klass->rank;
+ if ((dimension < 0) || (dimension >= rank))
+ mono_raise_exception (mono_get_exception_index_out_of_range ());
+
+ if (this->bounds == NULL)
+ return 0;
+
+ return this->bounds [dimension].lower_bound;
+}
+
+static void
+ves_icall_System_Array_FastCopy (MonoArray *source, int source_idx, MonoArray* dest, int dest_idx, int length)
+{
+ int element_size = mono_array_element_size (source->obj.vtable->klass);
+ void * dest_addr = mono_array_addr_with_size (dest, element_size, dest_idx);
+ void * source_addr = mono_array_addr_with_size (source, element_size, source_idx);
+
+ g_assert (dest_idx + length <= mono_array_length (dest));
+ g_assert (source_idx + length <= mono_array_length (source));
+ memmove (dest_addr, source_addr, element_size * length);
+}
+
+static void
+ves_icall_InitializeArray (MonoArray *array, MonoClassField *field_handle)
+{
+ MonoClass *klass = array->obj.vtable->klass;
+ guint32 size = mono_array_element_size (klass);
+ int i;
+
+ if (array->bounds == NULL)
+ size *= array->max_length;
+ else
+ for (i = 0; i < klass->rank; ++i)
+ size *= array->bounds [i].length;
+
+ memcpy (mono_array_addr (array, char, 0), field_handle->data, size);
+
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+#define SWAP(n) {\
+ gint i; \
+ guint ## n tmp; \
+ guint ## n *data = (guint ## n *) mono_array_addr (array, char, 0); \
+\
+ for (i = 0; i < size; i += n/8, data++) { \
+ tmp = read ## n (data); \
+ *data = tmp; \
+ } \
+}
+
+ printf ("Initialize array with elements of %s type\n", klass->element_class->name);
+
+ switch (klass->element_class->byval_arg.type) {
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ SWAP (16);
+ break;
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ SWAP (32);
+ break;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ SWAP (64);
+ break;
+ }
+
+#endif
+}
+
+static MonoObject *
+ves_icall_System_Object_MemberwiseClone (MonoObject *this)
+{
+ return mono_object_clone (this);
+}
+
+static gint32
+ves_icall_System_Object_GetHashCode (MonoObject *this)
+{
+ return *((gint32 *)this - 1);
+}
+
+/*
+ * A hash function for value types. I have no idea if this is a good hash
+ * function (its similar to g_str_hash).
+ */
+static gint32
+ves_icall_System_ValueType_GetHashCode (MonoObject *this)
+{
+ gint32 i, size;
+ const char *p;
+ guint h;
+
+ MONO_CHECK_ARG_NULL (this);
+
+ size = this->vtable->klass->instance_size - sizeof (MonoObject);
+
+ p = (const char *)this + sizeof (MonoObject);
+
+ for (i = 0; i < size; i++) {
+ h = (h << 5) - h + *p;
+ p++;
+ }
+
+ return h;
+}
+
+static MonoBoolean
+ves_icall_System_ValueType_Equals (MonoObject *this, MonoObject *that)
+{
+ gint32 size;
+ const char *p, *s;
+
+ MONO_CHECK_ARG_NULL (that);
+
+ if (this->vtable != that->vtable)
+ return FALSE;
+
+ size = this->vtable->klass->instance_size - sizeof (MonoObject);
+
+ p = (const char *)this + sizeof (MonoObject);
+ s = (const char *)that + sizeof (MonoObject);
+
+ return memcmp (p, s, size)? FALSE: TRUE;
+}
+
+static MonoReflectionType *
+ves_icall_System_Object_GetType (MonoObject *obj)
+{
+ return mono_type_get_object (mono_domain_get (), &obj->vtable->klass->byval_arg);
+}
+
+static void
+mono_type_type_from_obj (MonoReflectionType *mtype, MonoObject *obj)
+{
+ mtype->type = &obj->vtable->klass->byval_arg;
+ g_assert (mtype->type->type);
+}
+
+static gint32
+ves_icall_AssemblyBuilder_getToken (MonoReflectionAssemblyBuilder *assb, MonoObject *obj)
+{
+ return mono_image_create_token (assb->dynamic_assembly, obj);
+}
+
+static gint32
+ves_icall_AssemblyBuilder_getPEHeader (MonoReflectionAssemblyBuilder *assb, MonoArray *buf, gint32 *data_size)
+{
+ int count, hsize;
+ MonoDynamicAssembly *ass = assb->dynamic_assembly;
+
+ hsize = mono_image_get_header (assb, (char*)buf->vector, mono_array_length (buf));
+ if (hsize < 0)
+ return hsize;
+ count = ass->code.index + ass->meta_size;
+ count += 512 - 1;
+ count &= ~(512 - 1);
+ *data_size = count;
+
+ return hsize;
+}
+
+static gint32
+ves_icall_AssemblyBuilder_getDataChunk (MonoReflectionAssemblyBuilder *assb, MonoArray *buf)
+{
+ int count, real_data;
+ MonoDynamicAssembly *ass = assb->dynamic_assembly;
+ char *p = mono_array_addr (buf, char, 0);
+
+ count = real_data = ass->code.index + ass->meta_size;
+ count += 512 - 1;
+ count &= ~(512 - 1);
+ if (count > mono_array_length (buf))
+ return -1;
+ count -= real_data;
+
+ memcpy (p, ass->code.data, ass->code.index);
+ p += ass->code.index;
+ memcpy (p, ass->assembly.image->raw_metadata, ass->meta_size);
+ p += ass->meta_size;
+ /* null-pad section */
+ memset (p, 0, count);
+
+ return real_data + count;
+}
+
+static MonoReflectionType*
+ves_icall_type_from_name (MonoString *name)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoType *type;
+ MonoImage *image;
+ MonoTypeNameParse info;
+ gchar *str;
+
+ str = mono_string_to_utf8 (name);
+ /*g_print ("requested type %s\n", str);*/
+ if (!mono_reflection_parse_type (str, &info)) {
+ g_free (str);
+ g_list_free (info.modifiers);
+ return NULL;
+ }
+
+ if (info.assembly) {
+ image = mono_image_loaded (info.assembly);
+ /* do we need to load if it's not already loaded? */
+ if (!image) {
+ g_free (str);
+ g_list_free (info.modifiers);
+ return NULL;
+ }
+ } else
+ image = mono_defaults.corlib;
+
+ type = mono_reflection_get_type (image, &info, FALSE);
+ g_free (str);
+ g_list_free (info.modifiers);
+ if (!type)
+ return NULL;
+ /*g_print ("got it\n");*/
+ return mono_type_get_object (domain, type);
+}
+
+static MonoReflectionType*
+ves_icall_type_from_handle (MonoType *handle)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoClass *klass = mono_class_from_mono_type (handle);
+
+ mono_class_init (klass);
+ return mono_type_get_object (domain, handle);
+}
+
+static guint32
+ves_icall_type_Equals (MonoReflectionType *type, MonoReflectionType *c)
+{
+ if (type->type && c->type)
+ return mono_metadata_type_equal (type->type, c->type);
+ g_print ("type equals\n");
+ return 0;
+}
+
+static guint32
+ves_icall_type_is_subtype_of (MonoReflectionType *type, MonoReflectionType *c, MonoBoolean check_interfaces)
+{
+ MonoDomain *domain;
+ MonoClass *klass;
+ MonoClass *klassc;
+
+ g_assert (type != NULL);
+
+ domain = ((MonoObject *)type)->vtable->domain;
+
+ if (!c) /* FIXME: dont know what do do here */
+ return 0;
+
+ klass = mono_class_from_mono_type (type->type);
+ klassc = mono_class_from_mono_type (c->type);
+
+ /* cut&paste from mono_object_isinst (): keep in sync */
+ if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && !(klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
+ MonoVTable *klass_vt = mono_class_vtable (domain, klass);
+ if ((klassc->interface_id <= klass->max_interface_id) &&
+ klass_vt->interface_offsets [klassc->interface_id])
+ return 1;
+ } else if (check_interfaces && (klassc->flags & TYPE_ATTRIBUTE_INTERFACE) && (klass->flags & TYPE_ATTRIBUTE_INTERFACE)) {
+ int i;
+
+ for (i = 0; i < klass->interface_count; i ++) {
+ MonoClass *ic = klass->interfaces [i];
+ if (ic == klassc)
+ return 1;
+ }
+ } else {
+ /*
+ * klass->baseval is 0 for interfaces
+ */
+ if (klass->baseval && ((klass->baseval - klassc->baseval) <= klassc->diffval))
+ return 1;
+ }
+ return 0;
+}
+
+static guint32
+ves_icall_get_attributes (MonoReflectionType *type)
+{
+ MonoClass *klass = mono_class_from_mono_type (type->type);
+
+ return klass->flags;
+}
+
+static void
+ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info)
+{
+ MonoDomain *domain = mono_domain_get ();
+
+ info->parent = mono_type_get_object (domain, &method->klass->byval_arg);
+ info->ret = mono_type_get_object (domain, method->signature->ret);
+ info->attrs = method->flags;
+ info->implattrs = method->iflags;
+}
+
+static MonoArray*
+ves_icall_get_parameter_info (MonoMethod *method)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoArray *res;
+ static MonoClass *System_Reflection_ParameterInfo;
+ MonoReflectionParameter** args;
+ int i;
+
+ args = mono_param_get_objects (domain, method);
+ if (!System_Reflection_ParameterInfo)
+ System_Reflection_ParameterInfo = mono_class_from_name (
+ mono_defaults.corlib, "System.Reflection", "ParameterInfo");
+ res = mono_array_new (domain, System_Reflection_ParameterInfo, method->signature->param_count);
+ for (i = 0; i < method->signature->param_count; ++i) {
+ mono_array_set (res, gpointer, i, args [i]);
+ }
+ return res;
+}
+
+static void
+ves_icall_get_field_info (MonoReflectionField *field, MonoFieldInfo *info)
+{
+ MonoDomain *domain = mono_domain_get ();
+
+ info->parent = mono_type_get_object (domain, &field->klass->byval_arg);
+ info->type = mono_type_get_object (domain, field->field->type);
+ info->name = mono_string_new (domain, field->field->name);
+ info->attrs = field->field->type->attrs;
+}
+
+static MonoObject *
+ves_icall_MonoField_GetValue (MonoReflectionField *field, MonoObject *obj) {
+ MonoObject *res;
+ MonoClass *klass;
+ MonoType *ftype = field->field->type;
+ int type = ftype->type;
+ char *p, *r;
+ guint32 align;
+
+ mono_class_init (field->klass);
+ if (ftype->attrs & FIELD_ATTRIBUTE_STATIC) {
+ MonoVTable *vtable;
+ vtable = mono_class_vtable (mono_domain_get (), field->klass);
+ p = (char*)(vtable->data) + field->field->offset;
+ } else {
+ p = (char*)obj + field->field->offset;
+ }
+
+ switch (type) {
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ return *(MonoObject**)p;
+ }
+ klass = mono_class_from_mono_type (ftype);
+ res = mono_object_new (mono_domain_get (), klass);
+ r = (char*)res + sizeof (MonoObject);
+ memcpy (r, p, mono_class_value_size (klass, &align));
+
+ return res;
+}
+
+static void
+ves_icall_get_property_info (MonoReflectionProperty *property, MonoPropertyInfo *info)
+{
+ MonoDomain *domain = mono_domain_get ();
+
+ 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;
+ info->set = property->property->set ? mono_method_get_object (domain, property->property->set): NULL;
+ /*
+ * There may be other methods defined for properties, though, it seems they are not exposed
+ * in the reflection API
+ */
+}
+
+static MonoArray*
+ves_icall_Type_GetInterfaces (MonoReflectionType* type)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoArray *intf;
+ int ninterf, i;
+ MonoClass *class = mono_class_from_mono_type (type->type);
+ MonoClass *parent;
+
+ ninterf = 0;
+ for (parent = class; parent; parent = parent->parent) {
+ ninterf += parent->interface_count;
+ }
+ intf = mono_array_new (domain, mono_defaults.monotype_class, ninterf);
+ ninterf = 0;
+ for (parent = class; parent; parent = parent->parent) {
+ for (i = 0; i < parent->interface_count; ++i) {
+ mono_array_set (intf, gpointer, ninterf, mono_type_get_object (domain, &parent->interfaces [i]->byval_arg));
+ ++ninterf;
+ }
+ }
+ return intf;
+}
+
+static MonoReflectionType*
+ves_icall_MonoType_GetElementType (MonoReflectionType *type)
+{
+ MonoClass *class = mono_class_from_mono_type (type->type);
+ if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
+ return mono_type_get_object (mono_object_domain (type), class->enum_basetype);
+ else if (class->element_class)
+ return mono_type_get_object (mono_object_domain (type), &class->element_class->byval_arg);
+ else
+ return NULL;
+}
+
+static void
+ves_icall_get_type_info (MonoType *type, MonoTypeInfo *info)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoClass *class = mono_class_from_mono_type (type);
+
+ info->parent = class->parent ? mono_type_get_object (domain, &class->parent->byval_arg): NULL;
+ info->name = mono_string_new (domain, class->name);
+ info->name_space = mono_string_new (domain, class->name_space);
+ info->attrs = class->flags;
+ info->rank = class->rank;
+ info->assembly = mono_assembly_get_object (domain, class->image->assembly);
+ if (class->enumtype && class->enum_basetype) /* types that are modifierd typebuilkders may not have enum_basetype set */
+ info->etype = mono_type_get_object (domain, class->enum_basetype);
+ else if (class->element_class)
+ info->etype = mono_type_get_object (domain, &class->element_class->byval_arg);
+ else
+ info->etype = NULL;
+
+ info->isbyref = type->byref;
+ info->ispointer = type->type == MONO_TYPE_PTR;
+ info->isprimitive = (type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8);
+}
+
+static MonoObject *
+ves_icall_InternalInvoke (MonoReflectionMethod *method, MonoObject *this, MonoArray *params)
+{
+ return mono_runtime_invoke_array (method->method, this, params);
+}
+
+static MonoObject *
+ves_icall_InternalExecute (MonoReflectionMethod *method, MonoObject *this, MonoArray *params, MonoArray **outArgs)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoMethod *m = method->method;
+ MonoMethodSignature *sig = m->signature;
+ MonoArray *out_args;
+ MonoObject *result;
+ int i, j, outarg_count = 0;
+
+ if (m->klass == mono_defaults.object_class) {
+
+ if (!strcmp (m->name, "FieldGetter")) {
+ MonoClass *k = this->vtable->klass;
+ MonoString *name = mono_array_get (params, MonoString *, 1);
+ char *str;
+
+ str = mono_string_to_utf8 (name);
+
+ for (i = 0; i < k->field.count; i++) {
+ if (!strcmp (k->fields [i].name, str)) {
+ MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
+ if (field_klass->valuetype)
+ result = mono_value_box (domain, field_klass,
+ (char *)this + k->fields [i].offset);
+ else
+ result = *((gpointer *)((char *)this + k->fields [i].offset));
+
+ g_assert (result);
+ out_args = mono_array_new (domain, mono_defaults.object_class, 1);
+ *outArgs = out_args;
+ mono_array_set (out_args, gpointer, 0, result);
+ g_free (str);
+ return NULL;
+ }
+ }
+
+ g_free (str);
+ g_assert_not_reached ();
+
+ } else if (!strcmp (m->name, "FieldSetter")) {
+ MonoClass *k = this->vtable->klass;
+ MonoString *name = mono_array_get (params, MonoString *, 1);
+ int size, align;
+ char *str;
+
+ str = mono_string_to_utf8 (name);
+
+ for (i = 0; i < k->field.count; i++) {
+ if (!strcmp (k->fields [i].name, str)) {
+ MonoClass *field_klass = mono_class_from_mono_type (k->fields [i].type);
+ MonoObject *val = mono_array_get (params, gpointer, 2);
+
+ if (field_klass->valuetype) {
+ size = mono_type_size (k->fields [i].type, &align);
+ memcpy ((char *)this + k->fields [i].offset,
+ ((char *)val) + sizeof (MonoObject), size);
+ } else
+ *((gpointer *)this + k->fields [i].offset) = val;
+
+ g_assert (result);
+ g_free (str);
+ return NULL;
+ }
+ }
+
+ g_free (str);
+ g_assert_not_reached ();
+
+ }
+ }
+
+ for (i = 0; i < mono_array_length (params); i++) {
+ if (sig->params [i]->byref)
+ outarg_count++;
+ }
+
+ out_args = mono_array_new (domain, mono_defaults.object_class, outarg_count);
+
+ for (i = 0, j = 0; i < mono_array_length (params); i++) {
+ if (sig->params [i]->byref) {
+ gpointer arg;
+ arg = mono_array_get (params, gpointer, i);
+ mono_array_set (out_args, gpointer, j, arg);
+ j++;
+ }
+ }
+
+ /* fixme: handle constructors? */
+ if (!strcmp (method->method->name, ".ctor"))
+ g_assert_not_reached ();
+
+ result = mono_runtime_invoke_array (method->method, this, params);
+
+ *outArgs = out_args;
+
+ return result;
+}
+
+static MonoObject *
+ves_icall_System_Enum_ToObject (MonoReflectionType *type, MonoObject *obj)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoClass *enumc, *objc;
+ gint32 s1, s2;
+ MonoObject *res;
+
+ MONO_CHECK_ARG_NULL (type);
+ MONO_CHECK_ARG_NULL (obj);
+
+ enumc = mono_class_from_mono_type (type->type);
+ objc = obj->vtable->klass;
+
+ MONO_CHECK_ARG (obj, enumc->enumtype == TRUE);
+ MONO_CHECK_ARG (obj, (objc->enumtype) || (objc->byval_arg.type >= MONO_TYPE_I1 &&
+ objc->byval_arg.type <= MONO_TYPE_U8));
+
+ s1 = mono_class_value_size (enumc, NULL);
+ s2 = mono_class_value_size (objc, NULL);
+
+ res = mono_object_new (domain, enumc);
+
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ memcpy ((char *)res + sizeof (MonoObject), (char *)obj + sizeof (MonoObject), MIN (s1, s2));
+#else
+ memcpy ((char *)res + sizeof (MonoObject) + (s1 > s2 ? s1 - s2 : 0),
+ (char *)obj + sizeof (MonoObject) + (s2 > s1 ? s2 - s1 : 0),
+ MIN (s1, s2));
+#endif
+ return res;
+}
+
+static MonoObject *
+ves_icall_System_Enum_get_value (MonoObject *this)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoObject *res;
+ MonoClass *enumc;
+ gpointer dst;
+ gpointer src;
+ int size;
+
+ if (!this)
+ return NULL;
+
+ g_assert (this->vtable->klass->enumtype);
+
+ enumc = mono_class_from_mono_type (this->vtable->klass->enum_basetype);
+ res = mono_object_new (domain, enumc);
+ dst = (char *)res + sizeof (MonoObject);
+ src = (char *)this + sizeof (MonoObject);
+ size = mono_class_value_size (enumc, NULL);
+
+ memcpy (dst, src, size);
+
+ return res;
+}
+
+static void
+ves_icall_get_enum_info (MonoReflectionType *type, MonoEnumInfo *info)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoClass *enumc = mono_class_from_mono_type (type->type);
+ guint i, j, nvalues, crow;
+ MonoClassField *field;
+
+ info->utype = mono_type_get_object (domain, enumc->enum_basetype);
+ nvalues = enumc->field.count - 1;
+ info->names = mono_array_new (domain, mono_defaults.string_class, nvalues);
+ info->values = mono_array_new (domain, enumc, nvalues);
+
+ for (i = 0, j = 0; i < enumc->field.count; ++i) {
+ field = &enumc->fields [i];
+ if (strcmp ("value__", field->name) == 0)
+ continue;
+ mono_array_set (info->names, gpointer, j, mono_string_new (domain, field->name));
+ if (!field->data) {
+ crow = mono_metadata_get_constant_index (enumc->image, MONO_TOKEN_FIELD_DEF | (i+enumc->field.first+1));
+ 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);
+ }
+ switch (enumc->enum_basetype->type) {
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ mono_array_set (info->values, gchar, j, *field->data);
+ break;
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2:
+ mono_array_set (info->values, gint16, j, read16 (field->data));
+ break;
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ mono_array_set (info->values, gint32, j, read32 (field->data));
+ break;
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8:
+ mono_array_set (info->values, gint64, j, read64 (field->data));
+ break;
+ default:
+ g_error ("Implement type 0x%02x in get_enum_info", enumc->enum_basetype->type);
+ }
+ ++j;
+ }
+}
+
+static MonoMethod*
+search_method (MonoReflectionType *type, const char *name, guint32 flags, MonoArray *args)
+{
+ MonoClass *klass, *start_class;
+ MonoMethod *m;
+ MonoReflectionType *paramt;
+ int i, j;
+
+ start_class = klass = mono_class_from_mono_type (type->type);
+ while (klass) {
+ for (i = 0; i < klass->method.count; ++i) {
+ m = klass->methods [i];
+ if (!((m->flags & flags) == flags))
+ continue;
+ if (strcmp(m->name, name))
+ continue;
+ if (m->signature->param_count != mono_array_length (args))
+ continue;
+ for (j = 0; j < m->signature->param_count; ++j) {
+ paramt = mono_array_get (args, MonoReflectionType*, j);
+ if (!mono_metadata_type_equal (paramt->type, m->signature->params [j]))
+ break;
+ }
+ if (j == m->signature->param_count)
+ return m;
+ }
+ klass = klass->parent;
+ }
+ g_print ("Method %s.%s::%s (%d) not found\n", start_class->name_space, start_class->name, name, mono_array_length (args));
+ return NULL;
+}
+
+static MonoReflectionMethod*
+ves_icall_get_constructor (MonoReflectionType *type, MonoArray *args)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoMethod *m;
+
+ m = search_method (type, ".ctor", METHOD_ATTRIBUTE_RT_SPECIAL_NAME, args);
+ if (m)
+ return mono_method_get_object (domain, m);
+ return NULL;
+}
+
+static MonoReflectionMethod*
+ves_icall_get_method (MonoReflectionType *type, MonoString *name, MonoArray *args)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoMethod *m;
+ char *n = mono_string_to_utf8 (name);
+
+ m = search_method (type, n, 0, args);
+ g_free (n);
+ if (m)
+ return mono_method_get_object (domain, m);
+ return NULL;
+}
+
+static MonoProperty*
+search_property (MonoClass *klass, char* name, MonoArray *args) {
+ int i;
+ MonoProperty *p;
+
+ /* FIXME: handle args */
+ for (i = 0; i < klass->property.count; ++i) {
+ p = &klass->properties [i];
+ if (strcmp (p->name, name) == 0)
+ return p;
+ }
+ return NULL;
+}
+
+static MonoReflectionProperty*
+ves_icall_get_property (MonoReflectionType *type, MonoString *name, MonoArray *args)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoProperty *p;
+ MonoClass *class = mono_class_from_mono_type (type->type);
+ char *n = mono_string_to_utf8 (name);
+
+ p = search_property (class, n, args);
+ g_free (n);
+ if (p)
+ return mono_property_get_object (domain, class, p);
+ return NULL;
+}
+
+enum {
+ BFLAGS_IgnoreCase = 1,
+ BFLAGS_DeclaredOnly = 2,
+ BFLAGS_Instance = 4,
+ BFLAGS_Static = 8,
+ BFLAGS_Public = 0x10,
+ BFLAGS_NonPublic = 0x20,
+ BFLAGS_InvokeMethod = 0x100,
+ BFLAGS_CreateInstance = 0x200,
+ BFLAGS_GetField = 0x400,
+ BFLAGS_SetField = 0x800,
+ BFLAGS_GetProperty = 0x1000,
+ BFLAGS_SetProperty = 0x2000,
+ BFLAGS_ExactBinding = 0x10000,
+ BFLAGS_SuppressChangeType = 0x20000,
+ BFLAGS_OptionalParamBinding = 0x40000
+};
+
+static MonoArray*
+ves_icall_Type_GetFields (MonoReflectionType *type, guint32 bflags)
+{
+ MonoDomain *domain;
+ GSList *l = NULL, *tmp;
+ static MonoClass *System_Reflection_FieldInfo;
+ MonoClass *startklass, *klass;
+ MonoArray *res;
+ MonoObject *member;
+ int i, len, match;
+ MonoClassField *field;
+
+ domain = ((MonoObject *)type)->vtable->domain;
+ klass = startklass = mono_class_from_mono_type (type->type);
+
+handle_parent:
+ for (i = 0; i < klass->field.count; ++i) {
+ match = 0;
+ field = &klass->fields [i];
+ if ((field->type->attrs & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
+ if (bflags & BFLAGS_Public)
+ match++;
+ } else {
+ if (bflags & BFLAGS_NonPublic)
+ match++;
+ }
+ if (!match)
+ continue;
+ match = 0;
+ if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) {
+ if (bflags & BFLAGS_Static)
+ match++;
+ } else {
+ if (bflags & BFLAGS_Instance)
+ match++;
+ }
+
+ if (!match)
+ continue;
+ member = (MonoObject*)mono_field_get_object (domain, klass, field);
+ l = g_slist_prepend (l, member);
+ }
+ if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
+ goto handle_parent;
+ len = g_slist_length (l);
+ if (!System_Reflection_FieldInfo)
+ System_Reflection_FieldInfo = mono_class_from_name (
+ mono_defaults.corlib, "System.Reflection", "FieldInfo");
+ res = mono_array_new (domain, System_Reflection_FieldInfo, len);
+ i = 0;
+ tmp = g_slist_reverse (l);
+ for (; tmp; tmp = tmp->next, ++i)
+ mono_array_set (res, gpointer, i, tmp->data);
+ g_slist_free (l);
+ return res;
+}
+
+static MonoArray*
+ves_icall_Type_GetMethods (MonoReflectionType *type, guint32 bflags)
+{
+ MonoDomain *domain;
+ GSList *l = NULL, *tmp;
+ static MonoClass *System_Reflection_MethodInfo;
+ MonoClass *startklass, *klass;
+ MonoArray *res;
+ MonoMethod *method;
+ MonoObject *member;
+ int i, len, match;
+
+ domain = ((MonoObject *)type)->vtable->domain;
+ klass = startklass = mono_class_from_mono_type (type->type);
+
+handle_parent:
+ for (i = 0; i < klass->method.count; ++i) {
+ match = 0;
+ method = klass->methods [i];
+ if (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0)
+ continue;
+ if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
+ if (bflags & BFLAGS_Public)
+ match++;
+ } else {
+ if (bflags & BFLAGS_NonPublic)
+ match++;
+ }
+ if (!match)
+ continue;
+ match = 0;
+ if (method->flags & METHOD_ATTRIBUTE_STATIC) {
+ if (bflags & BFLAGS_Static)
+ match++;
+ } else {
+ if (bflags & BFLAGS_Instance)
+ match++;
+ }
+
+ if (!match)
+ continue;
+ match = 0;
+ member = (MonoObject*)mono_method_get_object (domain, method);
+
+ l = g_slist_prepend (l, member);
+ }
+ if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
+ goto handle_parent;
+ len = g_slist_length (l);
+ if (!System_Reflection_MethodInfo)
+ System_Reflection_MethodInfo = mono_class_from_name (
+ mono_defaults.corlib, "System.Reflection", "MethodInfo");
+ res = mono_array_new (domain, System_Reflection_MethodInfo, len);
+ i = 0;
+ tmp = l;
+ for (; tmp; tmp = tmp->next, ++i)
+ mono_array_set (res, gpointer, i, tmp->data);
+ g_slist_free (l);
+
+ return res;
+}
+
+static MonoArray*
+ves_icall_Type_GetConstructors (MonoReflectionType *type, guint32 bflags)
+{
+ MonoDomain *domain;
+ GSList *l = NULL, *tmp;
+ static MonoClass *System_Reflection_ConstructorInfo;
+ MonoClass *startklass, *klass;
+ MonoArray *res;
+ MonoMethod *method;
+ MonoObject *member;
+ int i, len, match;
+
+ domain = ((MonoObject *)type)->vtable->domain;
+ klass = startklass = mono_class_from_mono_type (type->type);
+
+handle_parent:
+ for (i = 0; i < klass->method.count; ++i) {
+ match = 0;
+ method = klass->methods [i];
+ if (strcmp (method->name, ".ctor") && strcmp (method->name, ".cctor"))
+ continue;
+ if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
+ if (bflags & BFLAGS_Public)
+ match++;
+ } else {
+ if (bflags & BFLAGS_NonPublic)
+ match++;
+ }
+ if (!match)
+ continue;
+ match = 0;
+ if (method->flags & METHOD_ATTRIBUTE_STATIC) {
+ if (bflags & BFLAGS_Static)
+ match++;
+ } else {
+ if (bflags & BFLAGS_Instance)
+ match++;
+ }
+
+ if (!match)
+ continue;
+ member = (MonoObject*)mono_method_get_object (domain, method);
+
+ l = g_slist_prepend (l, member);
+ }
+ if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
+ goto handle_parent;
+ len = g_slist_length (l);
+ if (!System_Reflection_ConstructorInfo)
+ System_Reflection_ConstructorInfo = mono_class_from_name (
+ mono_defaults.corlib, "System.Reflection", "ConstructorInfo");
+ res = mono_array_new (domain, System_Reflection_ConstructorInfo, len);
+ i = 0;
+ tmp = l;
+ for (; tmp; tmp = tmp->next, ++i)
+ mono_array_set (res, gpointer, i, tmp->data);
+ g_slist_free (l);
+ return res;
+}
+
+static MonoArray*
+ves_icall_Type_GetProperties (MonoReflectionType *type, guint32 bflags)
+{
+ MonoDomain *domain;
+ GSList *l = NULL, *tmp;
+ static MonoClass *System_Reflection_PropertyInfo;
+ MonoClass *startklass, *klass;
+ MonoArray *res;
+ MonoMethod *method;
+ MonoProperty *prop;
+ int i, len, match;
+
+ domain = ((MonoObject *)type)->vtable->domain;
+ klass = startklass = mono_class_from_mono_type (type->type);
+
+handle_parent:
+ for (i = 0; i < klass->property.count; ++i) {
+ prop = &klass->properties [i];
+ match = 0;
+ method = prop->get;
+ if (!method)
+ method = prop->set;
+ if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
+ if (bflags & BFLAGS_Public)
+ match++;
+ } else {
+ if (bflags & BFLAGS_NonPublic)
+ match++;
+ }
+ if (!match)
+ continue;
+ match = 0;
+ if (method->flags & METHOD_ATTRIBUTE_STATIC) {
+ if (bflags & BFLAGS_Static)
+ match++;
+ } else {
+ if (bflags & BFLAGS_Instance)
+ match++;
+ }
+
+ if (!match)
+ continue;
+ match = 0;
+ l = g_slist_prepend (l, mono_property_get_object (domain, klass, prop));
+ }
+ if (!l && (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent)))
+ goto handle_parent;
+ len = g_slist_length (l);
+ if (!System_Reflection_PropertyInfo)
+ System_Reflection_PropertyInfo = mono_class_from_name (
+ mono_defaults.corlib, "System.Reflection", "PropertyInfo");
+ res = mono_array_new (domain, System_Reflection_PropertyInfo, len);
+ i = 0;
+ tmp = l;
+ for (; tmp; tmp = tmp->next, ++i)
+ mono_array_set (res, gpointer, i, tmp->data);
+ g_slist_free (l);
+ return res;
+}
+
+static MonoArray*
+ves_icall_Type_GetEvents (MonoReflectionType *type, guint32 bflags)
+{
+ MonoDomain *domain;
+ GSList *l = NULL, *tmp;
+ static MonoClass *System_Reflection_EventInfo;
+ MonoClass *startklass, *klass;
+ MonoArray *res;
+ MonoMethod *method;
+ MonoEvent *event;
+ int i, len, match;
+
+ domain = ((MonoObject *)type)->vtable->domain;
+ klass = startklass = mono_class_from_mono_type (type->type);
+
+handle_parent:
+ for (i = 0; i < klass->event.count; ++i) {
+ event = &klass->events [i];
+ match = 0;
+ method = event->add;
+ if (!method)
+ method = event->remove;
+ if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
+ if (bflags & BFLAGS_Public)
+ match++;
+ } else {
+ if (bflags & BFLAGS_NonPublic)
+ match++;
+ }
+ if (!match)
+ continue;
+ match = 0;
+ if (method->flags & METHOD_ATTRIBUTE_STATIC) {
+ if (bflags & BFLAGS_Static)
+ match++;
+ } else {
+ if (bflags & BFLAGS_Instance)
+ match++;
+ }
+
+ if (!match)
+ continue;
+ match = 0;
+ l = g_slist_prepend (l, mono_event_get_object (domain, klass, event));
+ }
+ if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
+ goto handle_parent;
+ len = g_slist_length (l);
+ if (!System_Reflection_EventInfo)
+ System_Reflection_EventInfo = mono_class_from_name (
+ mono_defaults.corlib, "System.Reflection", "EventInfo");
+ res = mono_array_new (domain, System_Reflection_EventInfo, len);
+ i = 0;
+ tmp = l;
+ for (; tmp; tmp = tmp->next, ++i)
+ mono_array_set (res, gpointer, i, tmp->data);
+ g_slist_free (l);
+ return res;
+}
+
+static MonoArray*
+ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
+{
+ MonoDomain *domain;
+ GSList *l = NULL, *tmp;
+ GList *tmpn;
+ MonoClass *startklass, *klass;
+ MonoArray *res;
+ MonoObject *member;
+ int i, len, match;
+ MonoClass *nested;
+
+ domain = ((MonoObject *)type)->vtable->domain;
+ klass = startklass = mono_class_from_mono_type (type->type);
+
+ for (tmpn = klass->nested_classes; tmpn; tmpn = tmpn->next) {
+ match = 0;
+ nested = tmpn->data;
+ if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
+ if (bflags & BFLAGS_Public)
+ match++;
+ } else {
+ if (bflags & BFLAGS_NonPublic)
+ match++;
+ }
+ if (!match)
+ continue;
+ member = (MonoObject*)mono_type_get_object (domain, &nested->byval_arg);
+ l = g_slist_prepend (l, member);
+ }
+ len = g_slist_length (l);
+ res = mono_array_new (domain, mono_defaults.monotype_class, len);
+ i = 0;
+ tmp = g_slist_reverse (l);
+ for (; tmp; tmp = tmp->next, ++i)
+ mono_array_set (res, gpointer, i, tmp->data);
+ g_slist_free (l);
+ return res;
+}
+
+static gpointer
+ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr (gpointer ptr)
+{
+ return (gpointer)(*(int *)ptr);
+}
+
+static MonoString*
+ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAuto (gpointer ptr)
+{
+ MonoDomain *domain = mono_domain_get ();
+
+ return mono_string_new (domain, (char *)ptr);
+}
+
+static guint32 ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error(void)
+{
+ return(GetLastError());
+}
+
+static MonoReflectionType*
+ves_icall_System_Reflection_Assembly_GetType (MonoReflectionAssembly *assembly, MonoString *name, MonoBoolean throwOnError, MonoBoolean ignoreCase)
+{
+ MonoDomain *domain = mono_domain_get ();
+ gchar *str;
+ MonoType *type;
+ MonoTypeNameParse info;
+
+ str = mono_string_to_utf8 (name);
+ /*g_print ("requested type %s in %s\n", str, assembly->assembly->name);*/
+ if (!mono_reflection_parse_type (str, &info)) {
+ g_free (str);
+ g_list_free (info.modifiers);
+ if (throwOnError) /* uhm: this is a parse error, though... */
+ mono_raise_exception (mono_get_exception_type_load ());
+ /*g_print ("failed parse\n");*/
+ return NULL;
+ }
+
+ type = mono_reflection_get_type (assembly->assembly->image, &info, ignoreCase);
+ g_free (str);
+ g_list_free (info.modifiers);
+ if (!type) {
+ if (throwOnError)
+ mono_raise_exception (mono_get_exception_type_load ());
+ /* g_print ("failed find\n"); */
+ return NULL;
+ }
+ /* g_print ("got it\n"); */
+ return mono_type_get_object (domain, type);
+
+}
+
+static MonoString *
+ves_icall_System_Reflection_Assembly_get_code_base (MonoReflectionAssembly *assembly)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoString *res;
+ char *name = g_strconcat (
+ "file://", assembly->assembly->image->name, NULL);
+
+ res = mono_string_new (domain, name);
+ g_free (name);
+ return res;
+}
+
+static MonoString *
+ves_icall_System_MonoType_getFullName (MonoReflectionType *object)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoString *res;
+ gchar *name;
+
+ name = mono_type_get_name (object->type);
+ res = mono_string_new (domain, name);
+ g_free (name);
+
+ return res;
+}
+
+static MonoArray*
+ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoBoolean exportedOnly)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoArray *res;
+ MonoClass *klass;
+ MonoTableInfo *tdef = &assembly->assembly->image->tables [MONO_TABLE_TYPEDEF];
+ int i, count;
+ guint32 attrs, visibility;
+
+ if (exportedOnly) {
+ count = 0;
+ for (i = 0; i < tdef->rows; ++i) {
+ attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
+ visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
+ if (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)
+ count++;
+ }
+ } else {
+ count = tdef->rows;
+ }
+ res = mono_array_new (domain, mono_defaults.monotype_class, count);
+ count = 0;
+ for (i = 0; i < tdef->rows; ++i) {
+ attrs = mono_metadata_decode_row_col (tdef, i, MONO_TYPEDEF_FLAGS);
+ visibility = attrs & TYPE_ATTRIBUTE_VISIBILITY_MASK;
+ if (!exportedOnly || (visibility == TYPE_ATTRIBUTE_PUBLIC || visibility == TYPE_ATTRIBUTE_NESTED_PUBLIC)) {
+ klass = mono_class_get (assembly->assembly->image, (i + 1) | MONO_TOKEN_TYPE_DEF);
+ mono_array_set (res, gpointer, count, mono_type_get_object (domain, &klass->byval_arg));
+ count++;
+ }
+ }
+
+ return res;
+}
+
+static MonoReflectionType*
+ves_icall_ModuleBuilder_create_modified_type (MonoReflectionTypeBuilder *tb, MonoString *smodifiers)
+{
+ MonoClass *klass;
+ int isbyref = 0, rank;
+ char *str = mono_string_to_utf8 (smodifiers);
+ char *p;
+
+ klass = mono_class_from_mono_type (tb->type.type);
+ p = str;
+ /* logic taken from mono_reflection_parse_type(): keep in sync */
+ while (*p) {
+ switch (*p) {
+ case '&':
+ if (isbyref) { /* only one level allowed by the spec */
+ g_free (str);
+ return NULL;
+ }
+ isbyref = 1;
+ p++;
+ g_free (str);
+ return mono_type_get_object (mono_domain_get (), &klass->this_arg);
+ break;
+ case '*':
+ klass = mono_ptr_class_get (&klass->byval_arg);
+ mono_class_init (klass);
+ p++;
+ break;
+ case '[':
+ rank = 1;
+ p++;
+ while (*p) {
+ if (*p == ']')
+ break;
+ if (*p == ',')
+ rank++;
+ else if (*p != '*') { /* '*' means unknown lower bound */
+ g_free (str);
+ return NULL;
+ }
+ ++p;
+ }
+ if (*p != ']') {
+ g_free (str);
+ return NULL;
+ }
+ p++;
+ klass = mono_array_class_get (&klass->byval_arg, rank);
+ mono_class_init (klass);
+ break;
+ default:
+ break;
+ }
+ }
+ g_free (str);
+ return mono_type_get_object (mono_domain_get (), &klass->byval_arg);
+}
+
+/*
+ * Magic number to convert a time which is relative to
+ * Jan 1, 1970 into a value which is relative to Jan 1, 0001.
+ */
+#define EPOCH_ADJUST ((gint64)62135596800L)
+
+static gint64
+ves_icall_System_DateTime_GetNow (void)
+{
+#ifdef PLATFORM_WIN32
+ SYSTEMTIME st;
+ FILETIME ft;
+
+ GetLocalTime (&st);
+ SystemTimeToFileTime (&st, &ft);
+ return (gint64)504911232000000000L + (((gint64)ft.dwHighDateTime)<<32) | ft.dwLowDateTime;
+#else
+ /* FIXME: put this in io-layer and call it GetLocalTime */
+ struct timeval tv;
+ gint64 res;
+
+ if (gettimeofday (&tv, NULL) == 0) {
+ res = (((gint64)tv.tv_sec + EPOCH_ADJUST)* 1000000 + tv.tv_usec)*10;
+ return res;
+ }
+ /* fixme: raise exception */
+ return 0;
+#endif
+}
+
+/*
+ * This is heavily based on zdump.c from glibc 2.2.
+ *
+ * * data[0]: start of daylight saving time (in DateTime ticks).
+ * * data[1]: end of daylight saving time (in DateTime ticks).
+ * * data[2]: utcoffset (in TimeSpan ticks).
+ * * data[3]: additional offset when daylight saving (in TimeSpan ticks).
+ * * name[0]: name of this timezone when not daylight saving.
+ * * name[1]: name of this timezone when daylight saving.
+ *
+ * FIXME: This only works with "standard" Unix dates (years between 1900 and 2100) while
+ * the class library allows years between 1 and 9999.
+ *
+ * Returns true on success and zero on failure.
+ */
+static guint32
+ves_icall_System_CurrentTimeZone_GetTimeZoneData (guint32 year, MonoArray **data, MonoArray **names)
+{
+#ifndef PLATFORM_WIN32
+ MonoDomain *domain = mono_domain_get ();
+ struct tm start, tt;
+ time_t t;
+
+ long int gmtoff;
+ int is_daylight = 0, day;
+
+ memset (&start, 0, sizeof (start));
+
+ start.tm_mday = 1;
+ start.tm_year = year-1900;
+
+ t = mktime (&start);
+ gmtoff = start.tm_gmtoff;
+
+ MONO_CHECK_ARG_NULL (data);
+ MONO_CHECK_ARG_NULL (names);
+
+ (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
+ (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
+
+ /* For each day of the year, calculate the tm_gmtoff. */
+ for (day = 0; day < 365; day++) {
+
+ t += 3600*24;
+ tt = *localtime (&t);
+
+ /* Daylight saving starts or ends here. */
+ if (tt.tm_gmtoff != gmtoff) {
+ struct tm tt1;
+ time_t t1;
+
+ /* Try to find the exact hour when daylight saving starts/ends. */
+ t1 = t;
+ do {
+ t1 -= 3600;
+ tt1 = *localtime (&t1);
+ } while (tt1.tm_gmtoff != gmtoff);
+
+ /* Try to find the exact minute when daylight saving starts/ends. */
+ do {
+ t1 += 60;
+ tt1 = *localtime (&t1);
+ } while (tt1.tm_gmtoff == gmtoff);
+
+ /* Write data, if we're already in daylight saving, we're done. */
+ if (is_daylight) {
+ mono_array_set ((*names), gpointer, 0, mono_string_new (domain, tt.tm_zone));
+ mono_array_set ((*data), gint64, 1, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
+ return 1;
+ } else {
+ mono_array_set ((*names), gpointer, 1, mono_string_new (domain, tt.tm_zone));
+ mono_array_set ((*data), gint64, 0, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
+ is_daylight = 1;
+ }
+
+ /* This is only set once when we enter daylight saving. */
+ mono_array_set ((*data), gint64, 2, (gint64)gmtoff * 10000000L);
+ mono_array_set ((*data), gint64, 3, (gint64)(tt.tm_gmtoff - gmtoff) * 10000000L);
+
+ gmtoff = tt.tm_gmtoff;
+ }
+
+ gmtoff = tt.tm_gmtoff;
+ }
+ return 1;
+#else
+ MonoDomain *domain = mono_domain_get ();
+ TIME_ZONE_INFORMATION tz_info;
+ FILETIME ft;
+ int i;
+
+ GetTimeZoneInformation (&tz_info);
+
+ MONO_CHECK_ARG_NULL (data);
+ MONO_CHECK_ARG_NULL (names);
+
+ (*data) = mono_array_new (domain, mono_defaults.int64_class, 4);
+ (*names) = mono_array_new (domain, mono_defaults.string_class, 2);
+
+ for (i = 0; i < 32; ++i)
+ if (!tz_info.DaylightName [i])
+ break;
+ mono_array_set ((*names), gpointer, 1, mono_string_new_utf16 (domain, tz_info.DaylightName, i));
+ for (i = 0; i < 32; ++i)
+ if (!tz_info.StandardName [i])
+ break;
+ mono_array_set ((*names), gpointer, 0, mono_string_new_utf16 (domain, tz_info.StandardName, i));
+
+ SystemTimeToFileTime (&tz_info.StandardDate, &ft);
+ mono_array_set ((*data), gint64, 1, ((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime);
+ SystemTimeToFileTime (&tz_info.DaylightDate, &ft);
+ mono_array_set ((*data), gint64, 0, ((guint64)ft.dwHighDateTime<<32) | ft.dwLowDateTime);
+ mono_array_set ((*data), gint64, 3, tz_info.Bias + tz_info.StandardBias);
+ mono_array_set ((*data), gint64, 2, tz_info.Bias + tz_info.DaylightBias);
+
+ return 1;
+#endif
+}
+
+static gpointer
+ves_icall_System_Object_obj_address (MonoObject *this) {
+ return this;
+}
+
+/* System.Buffer */
+
+static gint32
+ves_icall_System_Buffer_ByteLengthInternal (MonoArray *array) {
+ MonoClass *klass;
+ MonoTypeEnum etype;
+ int length, esize;
+ int i;
+
+ klass = array->obj.vtable->klass;
+ etype = klass->element_class->byval_arg.type;
+ if (etype < MONO_TYPE_BOOLEAN || etype > MONO_TYPE_R8)
+ return -1;
+
+ if (array->bounds == NULL)
+ length = array->max_length;
+ else {
+ length = 0;
+ for (i = 0; i < klass->rank; ++ i)
+ length += array->bounds [i].length;
+ }
+
+ esize = mono_array_element_size (klass);
+ return length * esize;
+}
+
+static gint8
+ves_icall_System_Buffer_GetByteInternal (MonoArray *array, gint32 idx) {
+ return mono_array_get (array, gint8, idx);
+}
+
+static void
+ves_icall_System_Buffer_SetByteInternal (MonoArray *array, gint32 idx, gint8 value) {
+ mono_array_set (array, gint8, idx, value);
+}
+
+static void
+ves_icall_System_Buffer_BlockCopyInternal (MonoArray *src, gint32 src_offset, MonoArray *dest, gint32 dest_offset, gint32 count) {
+ char *src_buf, *dest_buf;
+
+ src_buf = (gint8 *)src->vector + src_offset;
+ dest_buf = (gint8 *)dest->vector + dest_offset;
+
+ memcpy (dest_buf, src_buf, count);
+}
+
+static MonoObject *
+ves_icall_Remoting_RealProxy_GetTransparentProxy (MonoObject *this)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoObject *res;
+ MonoRealProxy *rp = ((MonoRealProxy *)this);
+ MonoType *type;
+ MonoClass *klass;
+
+ res = mono_object_new (domain, mono_defaults.transparent_proxy_class);
+
+ ((MonoTransparentProxy *)res)->rp = rp;
+ type = ((MonoReflectionType *)rp->class_to_proxy)->type;
+ klass = mono_class_from_mono_type (type);
+
+ ((MonoTransparentProxy *)res)->klass = klass;
+
+ res->vtable = mono_class_proxy_vtable (domain, klass);
+
+ return res;
+}
+
+/* System.Environment */
+
+static MonoString *
+ves_icall_System_Environment_get_MachineName (void)
+{
+#if defined (PLATFORM_WIN32)
+ gunichar2 *buf;
+ guint32 len;
+ MonoString *result;
+
+ len = MAX_COMPUTERNAME_LENGTH + 1;
+ buf = g_new (gunichar2, len);
+
+ result = NULL;
+ if (GetComputerName (buf, &len))
+ result = mono_string_new_utf16 (mono_domain_get (), buf, len);
+
+ g_free (buf);
+ return result;
+#else
+ gchar *buf;
+ int len;
+ MonoString *result;
+
+ len = 256;
+ buf = g_new (gchar, len);
+
+ result = NULL;
+ if (gethostname (buf, len) != 0)
+ result = mono_string_new (mono_domain_get (), buf);
+
+ g_free (buf);
+ return result;
+#endif
+}
+
+static MonoString *
+ves_icall_System_Environment_get_NewLine (void)
+{
+#if defined (PLATFORM_WIN32)
+ return mono_string_new (mono_domain_get (), "\r\n");
+#else
+ return mono_string_new (mono_domain_get (), "\n");
+#endif
+}
+
+static MonoString *
+ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
+{
+ const gchar *value;
+ gchar *utf8_name;
+
+ if (name == NULL)
+ return NULL;
+
+ utf8_name = mono_string_to_utf8 (name); /* FIXME: this should be ascii */
+ value = g_getenv (utf8_name);
+ g_free (utf8_name);
+
+ if (value == 0)
+ return NULL;
+
+ return mono_string_new (mono_domain_get (), value);
+}
+
+/*
+ * There is no standard way to get at environ.
+ */
+extern char **environ;
+
+static MonoArray *
+ves_icall_System_Environment_GetEnvironmentVariableNames (void)
+{
+ MonoArray *names;
+ MonoDomain *domain;
+ MonoString *str;
+ gchar **e, **parts;
+ int n;
+
+ n = 0;
+ for (e = environ; *e != 0; ++ e)
+ ++ n;
+
+ domain = mono_domain_get ();
+ names = mono_array_new (domain, mono_defaults.string_class, n);
+
+ n = 0;
+ for (e = environ; *e != 0; ++ e) {
+ parts = g_strsplit (*e, "=", 2);
+ if (*parts != 0) {
+ str = mono_string_new (domain, *parts);
+ mono_array_set (names, MonoString *, n, str);
+ }
+
+ g_strfreev (parts);
+
+ ++ n;
+ }
+
+ return names;
+}
+
+static MonoString *
+ves_icall_System_Environment_GetCommandLine (void)
+{
+ return NULL; /* FIXME */
+}
+
+static void
+ves_icall_MonoMethodMessage_InitMessage (MonoMethodMessage *this,
+ MonoReflectionMethod *method,
+ MonoArray *out_args)
+{
+ MonoDomain *domain = mono_domain_get ();
+
+ mono_message_init (domain, this, method, out_args);
+}
+
+static MonoBoolean
+ves_icall_IsTransparentProxy (MonoObject *proxy)
+{
+ if (!proxy)
+ return 0;
+
+ if (proxy->vtable->klass == mono_defaults.transparent_proxy_class)
+ return 1;
+
+ return 0;
+}
+
+
+/* icall map */
+
+static gconstpointer icall_map [] = {
+ /*
+ * System.Array
+ */
+ "System.Array::GetValue", ves_icall_System_Array_GetValue,
+ "System.Array::SetValue", ves_icall_System_Array_SetValue,
+ "System.Array::GetValueImpl", ves_icall_System_Array_GetValueImpl,
+ "System.Array::SetValueImpl", ves_icall_System_Array_SetValueImpl,
+ "System.Array::GetRank", ves_icall_System_Array_GetRank,
+ "System.Array::GetLength", ves_icall_System_Array_GetLength,
+ "System.Array::GetLowerBound", ves_icall_System_Array_GetLowerBound,
+ "System.Array::CreateInstanceImpl", ves_icall_System_Array_CreateInstanceImpl,
+ "System.Array::FastCopy", ves_icall_System_Array_FastCopy,
+ "System.Array::Clone", mono_array_clone,
+
+ /*
+ * System.Object
+ */
+ "System.Object::MemberwiseClone", ves_icall_System_Object_MemberwiseClone,
+ "System.Object::GetType", ves_icall_System_Object_GetType,
+ "System.Object::GetHashCode", ves_icall_System_Object_GetHashCode,
+ "System.Object::obj_address", ves_icall_System_Object_obj_address,
+
+ /*
+ * System.ValueType
+ */
+ "System.ValueType::GetHashCode", ves_icall_System_ValueType_GetHashCode,
+ "System.ValueType::Equals", ves_icall_System_ValueType_Equals,
+
+ /*
+ * System.String
+ */
+
+ "System.String::.ctor(char*)", ves_icall_System_String_ctor_charp,
+ "System.String::.ctor(char*,uint,uint)", ves_icall_System_String_ctor_charp_int_int,
+ "System.String::.ctor(sbyte*)", ves_icall_System_String_ctor_sbytep,
+ "System.String::.ctor(sbyte*,uint,uint)", ves_icall_System_String_ctor_sbytep_int_int,
+ "System.String::.ctor(sbyte*,uint,uint,System.Text.Encoding)", ves_icall_System_String_ctor_encoding,
+ "System.String::.ctor(char[])", ves_icall_System_String_ctor_chara,
+ "System.String::.ctor(char[],uint,uint)", ves_icall_System_String_ctor_chara_int_int,
+ "System.String::.ctor(char,uint)", ves_icall_System_String_ctor_char_int,
+ "System.String::InternalEquals", ves_icall_System_String_InternalEquals,
+ "System.String::InternalJoin", ves_icall_System_String_InternalJoin,
+ "System.String::InternalInsert", ves_icall_System_String_InternalInsert,
+ "System.String::InternalReplace(char,char)", ves_icall_System_String_InternalReplace_Char,
+ "System.String::InternalReplace(string,string)", ves_icall_System_String_InternalReplace_Str,
+ "System.String::InternalRemove", ves_icall_System_String_InternalRemove,
+ "System.String::InternalCopyTo", ves_icall_System_String_InternalCopyTo,
+ "System.String::InternalSplit", ves_icall_System_String_InternalSplit,
+ "System.String::InternalTrim", ves_icall_System_String_InternalTrim,
+ "System.String::InternalIndexOf(char,uint,uint)", ves_icall_System_String_InternalIndexOf_Char,
+ "System.String::InternalIndexOf(string,uint,uint)", ves_icall_System_String_InternalIndexOf_Str,
+ "System.String::InternalIndexOfAny", ves_icall_System_String_InternalIndexOfAny,
+ "System.String::InternalLastIndexOf(char,uint,uint)", ves_icall_System_String_InternalLastIndexOf_Char,
+ "System.String::InternalLastIndexOf(string,uint,uint)", ves_icall_System_String_InternalLastIndexOf_Str,
+ "System.String::InternalLastIndexOfAny", ves_icall_System_String_InternalLastIndexOfAny,
+ "System.String::InternalPad", ves_icall_System_String_InternalPad,
+ "System.String::InternalToLower", ves_icall_System_String_InternalToLower,
+ "System.String::InternalToUpper", ves_icall_System_String_InternalToUpper,
+ "System.String::InternalAllocateStr", ves_icall_System_String_InternalAllocateStr,
+ "System.String::InternalStrcpy(string,uint,string)", ves_icall_System_String_InternalStrcpy_Str,
+ "System.String::InternalStrcpy(string,uint,string,uint,uint)", ves_icall_System_String_InternalStrcpy_StrN,
+ "System.String::InternalIntern", ves_icall_System_String_InternalIntern,
+ "System.String::InternalIsInterned", ves_icall_System_String_InternalIsInterned,
+ "System.String::InternalCompare(string,uint,string,uint,uint,bool)", ves_icall_System_String_InternalCompareStr_N,
+ "System.String::GetHashCode", ves_icall_System_String_GetHashCode,
+ "System.String::get_Chars", ves_icall_System_String_get_Chars,
+
+ /*
+ * System.AppDomain
+ */
+ "System.AppDomain::createDomain", ves_icall_System_AppDomain_createDomain,
+ "System.AppDomain::getCurDomain", ves_icall_System_AppDomain_getCurDomain,
+ "System.AppDomain::GetData", ves_icall_System_AppDomain_GetData,
+ "System.AppDomain::SetData", ves_icall_System_AppDomain_SetData,
+ "System.AppDomain::getSetup", ves_icall_System_AppDomain_getSetup,
+ "System.AppDomain::getFriendlyName", ves_icall_System_AppDomain_getFriendlyName,
+ "System.AppDomain::GetAssemblies", ves_icall_System_AppDomain_GetAssemblies,
+ "System.AppDomain::LoadAssembly", ves_icall_System_AppDomain_LoadAssembly,
+ "System.AppDomain::Unload", ves_icall_System_AppDomain_Unload,
+ "System.AppDomain::ExecuteAssembly", ves_icall_System_AppDomain_ExecuteAssembly,
+
+ /*
+ * System.AppDomainSetup
+ */
+ "System.AppDomainSetup::InitAppDomainSetup", ves_icall_System_AppDomainSetup_InitAppDomainSetup,
+
+ /*
+ * System.Double
+ */
+ "System.Double::ToStringImpl", mono_double_ToStringImpl,
+
+ /*
+ * System.Decimal
+ */
+ "System.Decimal::decimal2UInt64", mono_decimal2UInt64,
+ "System.Decimal::decimal2Int64", mono_decimal2Int64,
+ "System.Decimal::double2decimal", mono_double2decimal, /* FIXME: wrong signature. */
+ "System.Decimal::decimalIncr", mono_decimalIncr,
+ "System.Decimal::decimalSetExponent", mono_decimalSetExponent,
+ "System.Decimal::decimal2double", mono_decimal2double,
+ "System.Decimal::decimalFloorAndTrunc", mono_decimalFloorAndTrunc,
+ "System.Decimal::decimalRound", mono_decimalRound,
+ "System.Decimal::decimalMult", mono_decimalMult,
+ "System.Decimal::decimalDiv", mono_decimalDiv,
+ "System.Decimal::decimalIntDiv", mono_decimalIntDiv,
+ "System.Decimal::decimalCompare", mono_decimalCompare,
+ "System.Decimal::string2decimal", mono_string2decimal,
+ "System.Decimal::decimal2string", mono_decimal2string,
+
+ /*
+ * ModuleBuilder
+ */
+ "System.Reflection.Emit.ModuleBuilder::create_modified_type", ves_icall_ModuleBuilder_create_modified_type,
+
+ /*
+ * AssemblyBuilder
+ */
+ "System.Reflection.Emit.AssemblyBuilder::getDataChunk", ves_icall_AssemblyBuilder_getDataChunk,
+ "System.Reflection.Emit.AssemblyBuilder::getPEHeader", ves_icall_AssemblyBuilder_getPEHeader,
+ "System.Reflection.Emit.AssemblyBuilder::getUSIndex", mono_image_insert_string,
+ "System.Reflection.Emit.AssemblyBuilder::getToken", ves_icall_AssemblyBuilder_getToken,
+ "System.Reflection.Emit.AssemblyBuilder::basic_init", mono_image_basic_init,
+
+ /*
+ * Reflection stuff.
+ */
+ "System.Reflection.MonoMethodInfo::get_method_info", ves_icall_get_method_info,
+ "System.Reflection.MonoMethodInfo::get_parameter_info", ves_icall_get_parameter_info,
+ "System.Reflection.MonoFieldInfo::get_field_info", ves_icall_get_field_info,
+ "System.Reflection.MonoPropertyInfo::get_property_info", ves_icall_get_property_info,
+ "System.Reflection.MonoMethod::InternalInvoke", ves_icall_InternalInvoke,
+ "System.Reflection.MonoCMethod::InternalInvoke", ves_icall_InternalInvoke,
+ "System.MonoCustomAttrs::GetCustomAttributes", mono_reflection_get_custom_attrs,
+ "System.Reflection.Emit.CustomAttributeBuilder::GetBlob", mono_reflection_get_custom_attrs_blob,
+ "System.Reflection.MonoField::GetValue", ves_icall_MonoField_GetValue,
+ "System.Reflection.Emit.SignatureHelper::get_signature_local", mono_reflection_sighelper_get_signature_local,
+ "System.Reflection.Emit.SignatureHelper::get_signature_field", mono_reflection_sighelper_get_signature_field,
+
+
+ /* System.Enum */
+
+ "System.MonoEnumInfo::get_enum_info", ves_icall_get_enum_info,
+ "System.Enum::get_value", ves_icall_System_Enum_get_value,
+ "System.Enum::ToObject", ves_icall_System_Enum_ToObject,
+
+ /*
+ * TypeBuilder
+ */
+ "System.Reflection.Emit.TypeBuilder::setup_internal_class", mono_reflection_setup_internal_class,
+
+
+ /*
+ * MethodBuilder
+ */
+
+ /*
+ * System.Type
+ */
+ "System.Type::internal_from_name", ves_icall_type_from_name,
+ "System.Type::internal_from_handle", ves_icall_type_from_handle,
+ "System.Type::get_constructor", ves_icall_get_constructor,
+ "System.Type::get_property", ves_icall_get_property,
+ "System.Type::get_method", ves_icall_get_method,
+ "System.MonoType::get_attributes", ves_icall_get_attributes,
+ "System.Type::type_is_subtype_of", ves_icall_type_is_subtype_of,
+ "System.Type::Equals", ves_icall_type_Equals,
+
+ /*
+ * System.Runtime.CompilerServices.RuntimeHelpers
+ */
+ "System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray", ves_icall_InitializeArray,
+
+ /*
+ * System.Threading
+ */
+ "System.Threading.Thread::Thread_internal", ves_icall_System_Threading_Thread_Thread_internal,
+ "System.Threading.Thread::Start_internal", ves_icall_System_Threading_Thread_Start_internal,
+ "System.Threading.Thread::Sleep_internal", ves_icall_System_Threading_Thread_Sleep_internal,
+ "System.Threading.Thread::CurrentThread_internal", ves_icall_System_Threading_Thread_CurrentThread_internal,
+ "System.Threading.Thread::CurrentThreadDomain_internal", ves_icall_System_Threading_Thread_CurrentThreadDomain_internal,
+ "System.Threading.Thread::Join_internal", ves_icall_System_Threading_Thread_Join_internal,
+ "System.Threading.Thread::SlotHash_lookup", ves_icall_System_Threading_Thread_SlotHash_lookup,
+ "System.Threading.Thread::SlotHash_store", ves_icall_System_Threading_Thread_SlotHash_store,
+ "System.Threading.Monitor::Monitor_exit", ves_icall_System_Threading_Monitor_Monitor_exit,
+ "System.Threading.Monitor::Monitor_test_owner", ves_icall_System_Threading_Monitor_Monitor_test_owner,
+ "System.Threading.Monitor::Monitor_test_synchronised", ves_icall_System_Threading_Monitor_Monitor_test_synchronised,
+ "System.Threading.Monitor::Monitor_pulse", ves_icall_System_Threading_Monitor_Monitor_pulse,
+ "System.Threading.Monitor::Monitor_pulse_all", ves_icall_System_Threading_Monitor_Monitor_pulse_all,
+ "System.Threading.Monitor::Monitor_try_enter", ves_icall_System_Threading_Monitor_Monitor_try_enter,
+ "System.Threading.Monitor::Monitor_wait", ves_icall_System_Threading_Monitor_Monitor_wait,
+ "System.Threading.Mutex::CreateMutex_internal", ves_icall_System_Threading_Mutex_CreateMutex_internal,
+ "System.Threading.Mutex::ReleaseMutex_internal", ves_icall_System_Threading_Mutex_ReleaseMutex_internal,
+ "System.Threading.NativeEventCalls::CreateEvent_internal", ves_icall_System_Threading_Events_CreateEvent_internal,
+ "System.Threading.NativeEventCalls::SetEvent_internal", ves_icall_System_Threading_Events_SetEvent_internal,
+ "System.Threading.NativeEventCalls::ResetEvent_internal", ves_icall_System_Threading_Events_ResetEvent_internal,
+
+ /*
+ * System.Threading.WaitHandle
+ */
+ "System.Threading.WaitHandle::WaitAll_internal", ves_icall_System_Threading_WaitHandle_WaitAll_internal,
+ "System.Threading.WaitHandle::WaitAny_internal", ves_icall_System_Threading_WaitHandle_WaitAny_internal,
+ "System.Threading.WaitHandle::WaitOne_internal", ves_icall_System_Threading_WaitHandle_WaitOne_internal,
+
+ "System.Runtime.InteropServices.Marshal::ReadIntPtr", ves_icall_System_Runtime_InteropServices_Marshal_ReadIntPtr,
+ "System.Runtime.InteropServices.Marshal::PtrToStringAuto", ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAuto,
+ "System.Runtime.InteropServices.Marshal::GetLastWin32Error", ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error,
+
+ "System.Reflection.Assembly::GetType", ves_icall_System_Reflection_Assembly_GetType,
+ "System.Reflection.Assembly::GetTypes", ves_icall_System_Reflection_Assembly_GetTypes,
+ "System.Reflection.Assembly::get_code_base", ves_icall_System_Reflection_Assembly_get_code_base,
+
+ /*
+ * System.MonoType.
+ */
+ "System.MonoType::getFullName", ves_icall_System_MonoType_getFullName,
+ "System.MonoType::type_from_obj", mono_type_type_from_obj,
+ "System.MonoType::GetElementType", ves_icall_MonoType_GetElementType,
+ "System.MonoType::get_type_info", ves_icall_get_type_info,
+ "System.MonoType::GetFields", ves_icall_Type_GetFields,
+ "System.MonoType::GetMethods", ves_icall_Type_GetMethods,
+ "System.MonoType::GetConstructors", ves_icall_Type_GetConstructors,
+ "System.MonoType::GetProperties", ves_icall_Type_GetProperties,
+ "System.MonoType::GetEvents", ves_icall_Type_GetEvents,
+ "System.MonoType::GetInterfaces", ves_icall_Type_GetInterfaces,
+ "System.MonoType::GetNestedTypes", ves_icall_Type_GetNestedTypes,
+
+ /*
+ * System.Net.Sockets I/O Services
+ */
+ "System.Net.Sockets.Socket::Socket_internal", ves_icall_System_Net_Sockets_Socket_Socket_internal,
+ "System.Net.Sockets.Socket::Close_internal", ves_icall_System_Net_Sockets_Socket_Close_internal,
+ "System.Net.Sockets.SocketException::WSAGetLastError_internal", ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal,
+ "System.Net.Sockets.Socket::Available_internal", ves_icall_System_Net_Sockets_Socket_Available_internal,
+ "System.Net.Sockets.Socket::Blocking_internal", ves_icall_System_Net_Sockets_Socket_Blocking_internal,
+ "System.Net.Sockets.Socket::Accept_internal", ves_icall_System_Net_Sockets_Socket_Accept_internal,
+ "System.Net.Sockets.Socket::Listen_internal", ves_icall_System_Net_Sockets_Socket_Listen_internal,
+ "System.Net.Sockets.Socket::LocalEndPoint_internal", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal,
+ "System.Net.Sockets.Socket::RemoteEndPoint_internal", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal,
+ "System.Net.Sockets.Socket::Bind_internal", ves_icall_System_Net_Sockets_Socket_Bind_internal,
+ "System.Net.Sockets.Socket::Connect_internal", ves_icall_System_Net_Sockets_Socket_Connect_internal,
+ "System.Net.Sockets.Socket::Receive_internal", ves_icall_System_Net_Sockets_Socket_Receive_internal,
+ "System.Net.Sockets.Socket::RecvFrom_internal", ves_icall_System_Net_Sockets_Socket_RecvFrom_internal,
+ "System.Net.Sockets.Socket::Send_internal", ves_icall_System_Net_Sockets_Socket_Send_internal,
+ "System.Net.Sockets.Socket::SendTo_internal", ves_icall_System_Net_Sockets_Socket_SendTo_internal,
+ "System.Net.Sockets.Socket::Select_internal", ves_icall_System_Net_Sockets_Socket_Select_internal,
+ "System.Net.Sockets.Socket::Shutdown_internal", ves_icall_System_Net_Sockets_Socket_Shutdown_internal,
+ "System.Net.Sockets.Socket::GetSocketOption_obj_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal,
+ "System.Net.Sockets.Socket::GetSocketOption_arr_internal", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal,
+ "System.Net.Sockets.Socket::SetSocketOption_internal", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal,
+ "System.Net.Dns::GetHostByName_internal", ves_icall_System_Net_Dns_GetHostByName_internal,
+ "System.Net.Dns::GetHostByAddr_internal", ves_icall_System_Net_Dns_GetHostByAddr_internal,
+
+ /*
+ * System.Char
+ */
+ "System.Char::GetNumericValue", ves_icall_System_Char_GetNumericValue,
+ "System.Char::GetUnicodeCategory", ves_icall_System_Char_GetUnicodeCategory,
+ "System.Char::IsControl", ves_icall_System_Char_IsControl,
+ "System.Char::IsDigit", ves_icall_System_Char_IsDigit,
+ "System.Char::IsLetter", ves_icall_System_Char_IsLetter,
+ "System.Char::IsLower", ves_icall_System_Char_IsLower,
+ "System.Char::IsUpper", ves_icall_System_Char_IsUpper,
+ "System.Char::IsNumber", ves_icall_System_Char_IsNumber,
+ "System.Char::IsPunctuation", ves_icall_System_Char_IsPunctuation,
+ "System.Char::IsSeparator", ves_icall_System_Char_IsSeparator,
+ "System.Char::IsSurrogate", ves_icall_System_Char_IsSurrogate,
+ "System.Char::IsSymbol", ves_icall_System_Char_IsSymbol,
+ "System.Char::IsWhiteSpace", ves_icall_System_Char_IsWhiteSpace,
+ "System.Char::ToLower", ves_icall_System_Char_ToLower,
+ "System.Char::ToUpper", ves_icall_System_Char_ToUpper,
+
+ "System.Text.Encoding::IConvNewEncoder", ves_icall_iconv_new_encoder,
+ "System.Text.Encoding::IConvNewDecoder", ves_icall_iconv_new_decoder,
+ "System.Text.Encoding::IConvReset", ves_icall_iconv_reset,
+ "System.Text.Encoding::IConvGetByteCount", ves_icall_iconv_get_byte_count,
+ "System.Text.Encoding::IConvGetBytes", ves_icall_iconv_get_bytes,
+ "System.Text.Encoding::IConvGetCharCount", ves_icall_iconv_get_char_count,
+ "System.Text.Encoding::IConvGetChars", ves_icall_iconv_get_chars,
+
+ "System.DateTime::GetNow", ves_icall_System_DateTime_GetNow,
+ "System.CurrentTimeZone::GetTimeZoneData", ves_icall_System_CurrentTimeZone_GetTimeZoneData,
+
+ /*
+ * System.GC
+ */
+ "System.GC::InternalCollect", ves_icall_System_GC_InternalCollect,
+ "System.GC::GetTotalMemory", ves_icall_System_GC_GetTotalMemory,
+ "System.GC::KeepAlive", ves_icall_System_GC_KeepAlive,
+ "System.GC::ReRegisterForFinalize", ves_icall_System_GC_ReRegisterForFinalize,
+ "System.GC::SuppressFinalize", ves_icall_System_GC_SuppressFinalize,
+ "System.GC::WaitForPendingFinalizers", ves_icall_System_GC_WaitForPendingFinalizers,
+
+ /*
+ * System.Security.Cryptography calls
+ */
+
+ "System.Security.Cryptography.RNGCryptoServiceProvider::GetBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetBytes,
+ "System.Security.Cryptography.RNG_CryptoServiceProvider::GetNonZeroBytes", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetNonZeroBytes,
+
+ /*
+ * System.Buffer
+ */
+ "System.Buffer::ByteLengthInternal", ves_icall_System_Buffer_ByteLengthInternal,
+ "System.Buffer::GetByteInternal", ves_icall_System_Buffer_GetByteInternal,
+ "System.Buffer::SetByteInternal", ves_icall_System_Buffer_SetByteInternal,
+ "System.Buffer::BlockCopyInternal", ves_icall_System_Buffer_BlockCopyInternal,
+
+ /*
+ * System.IO.MonoIO
+ */
+ "System.IO.MonoIO::GetLastError", ves_icall_System_IO_MonoIO_GetLastError,
+ "System.IO.MonoIO::CreateDirectory", ves_icall_System_IO_MonoIO_CreateDirectory,
+ "System.IO.MonoIO::RemoveDirectory", ves_icall_System_IO_MonoIO_RemoveDirectory,
+ "System.IO.MonoIO::FindFirstFile", ves_icall_System_IO_MonoIO_FindFirstFile,
+ "System.IO.MonoIO::FindNextFile", ves_icall_System_IO_MonoIO_FindNextFile,
+ "System.IO.MonoIO::FindClose", ves_icall_System_IO_MonoIO_FindClose,
+ "System.IO.MonoIO::GetCurrentDirectory", ves_icall_System_IO_MonoIO_GetCurrentDirectory,
+ "System.IO.MonoIO::SetCurrentDirectory", ves_icall_System_IO_MonoIO_SetCurrentDirectory,
+ "System.IO.MonoIO::MoveFile", ves_icall_System_IO_MonoIO_MoveFile,
+ "System.IO.MonoIO::CopyFile", ves_icall_System_IO_MonoIO_CopyFile,
+ "System.IO.MonoIO::DeleteFile", ves_icall_System_IO_MonoIO_DeleteFile,
+ "System.IO.MonoIO::GetFileAttributes", ves_icall_System_IO_MonoIO_GetFileAttributes,
+ "System.IO.MonoIO::SetFileAttributes", ves_icall_System_IO_MonoIO_SetFileAttributes,
+ "System.IO.MonoIO::GetFileStat", ves_icall_System_IO_MonoIO_GetFileStat,
+ "System.IO.MonoIO::Open", ves_icall_System_IO_MonoIO_Open,
+ "System.IO.MonoIO::Close", ves_icall_System_IO_MonoIO_Close,
+ "System.IO.MonoIO::Read", ves_icall_System_IO_MonoIO_Read,
+ "System.IO.MonoIO::Write", ves_icall_System_IO_MonoIO_Write,
+ "System.IO.MonoIO::Seek", ves_icall_System_IO_MonoIO_Seek,
+ "System.IO.MonoIO::GetLength", ves_icall_System_IO_MonoIO_GetLength,
+ "System.IO.MonoIO::SetLength", ves_icall_System_IO_MonoIO_SetLength,
+ "System.IO.MonoIO::SetFileTime", ves_icall_System_IO_MonoIO_SetFileTime,
+ "System.IO.MonoIO::Flush", ves_icall_System_IO_MonoIO_Flush,
+ "System.IO.MonoIO::get_ConsoleOutput", ves_icall_System_IO_MonoIO_get_ConsoleOutput,
+ "System.IO.MonoIO::get_ConsoleInput", ves_icall_System_IO_MonoIO_get_ConsoleInput,
+ "System.IO.MonoIO::get_ConsoleError", ves_icall_System_IO_MonoIO_get_ConsoleError,
+ "System.IO.MonoIO::get_VolumeSeparatorChar", ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar,
+ "System.IO.MonoIO::get_DirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar,
+ "System.IO.MonoIO::get_AltDirectorySeparatorChar", ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar,
+ "System.IO.MonoIO::get_PathSeparator", ves_icall_System_IO_MonoIO_get_PathSeparator,
+ "System.IO.MonoIO::get_InvalidPathChars", ves_icall_System_IO_MonoIO_get_InvalidPathChars,
+
+ /*
+ * System.Math
+ */
+ "System.Math::Sin", ves_icall_System_Math_Sin,
+ "System.Math::Cos", ves_icall_System_Math_Cos,
+ "System.Math::Tan", ves_icall_System_Math_Tan,
+ "System.Math::Sinh", ves_icall_System_Math_Sinh,
+ "System.Math::Cosh", ves_icall_System_Math_Cosh,
+ "System.Math::Tanh", ves_icall_System_Math_Tanh,
+ "System.Math::Acos", ves_icall_System_Math_Acos,
+ "System.Math::Asin", ves_icall_System_Math_Asin,
+ "System.Math::Atan", ves_icall_System_Math_Atan,
+ "System.Math::Atan2", ves_icall_System_Math_Atan2,
+ "System.Math::Exp", ves_icall_System_Math_Exp,
+ "System.Math::Log", ves_icall_System_Math_Log,
+ "System.Math::Log10", ves_icall_System_Math_Log10,
+ "System.Math::Pow", ves_icall_System_Math_Pow,
+ "System.Math::Sqrt", ves_icall_System_Math_Sqrt,
+
+ /*
+ * System.Environment
+ */
+ "System.Environment::get_MachineName", ves_icall_System_Environment_get_MachineName,
+ "System.Environment::get_NewLine", ves_icall_System_Environment_get_NewLine,
+ "System.Environment::GetEnvironmentVariable", ves_icall_System_Environment_GetEnvironmentVariable,
+ "System.Environment::GetEnvironmentVariableNames", ves_icall_System_Environment_GetEnvironmentVariableNames,
+ "System.Environment::GetCommandLine", ves_icall_System_Environment_GetCommandLine,
+
+ /*
+ * Mono.CSharp.Debugger
+ */
+ "Mono.CSharp.Debugger.MonoSymbolWriter::get_local_type_from_sig",
+ ves_icall_Debugger_MonoSymbolWriter_get_local_type_from_sig,
+ "Mono.CSharp.Debugger.MonoSymbolWriter::get_method",
+ ves_icall_Debugger_MonoSymbolWriter_method_from_token,
+ "Mono.CSharp.Debugger.DwarfFileWriter::get_type_token",
+ ves_icall_Debugger_DwarfFileWriter_get_type_token,
+
+
+ /*
+ * System.Runtime.Remoting
+ */
+ "System.Runtime.Remoting.RemotingServices::InternalExecute",
+ ves_icall_InternalExecute,
+ "System.Runtime.Remoting.RemotingServices::IsTransparentProxy",
+ ves_icall_IsTransparentProxy,
+
+ /*
+ * System.Runtime.Remoting.Messaging
+ */
+ "System.Runtime.Remoting.Messaging.MonoMethodMessage::InitMessage",
+ ves_icall_MonoMethodMessage_InitMessage,
+
+ /*
+ * System.Runtime.Remoting.Proxies
+ */
+ "System.Runtime.Remoting.Proxies.RealProxy::GetTransparentProxy",
+ ves_icall_Remoting_RealProxy_GetTransparentProxy,
+
+ /*
+ * System.Threading.Interlocked
+ */
+ "System.Threading.Interlocked::Increment(uint&)", ves_icall_System_Threading_Interlocked_Increment_Int,
+ "System.Threading.Interlocked::Increment(long&)", ves_icall_System_Threading_Interlocked_Increment_Long,
+ "System.Threading.Interlocked::Decrement(uint&)", ves_icall_System_Threading_Interlocked_Decrement_Int,
+ "System.Threading.Interlocked::Decrement(long&)", ves_icall_System_Threading_Interlocked_Decrement_Long,
+ "System.Threading.Interlocked::CompareExchange(uint&,uint,uint)", ves_icall_System_Threading_Interlocked_CompareExchange_Int,
+ "System.Threading.Interlocked::CompareExchange(object&,object,object)", ves_icall_System_Threading_Interlocked_CompareExchange_Object,
+ "System.Threading.Interlocked::CompareExchange(single&,single,single)", ves_icall_System_Threading_Interlocked_CompareExchange_Single,
+ "System.Threading.Interlocked::Exchange(uint&,uint)", ves_icall_System_Threading_Interlocked_Exchange_Int,
+ "System.Threading.Interlocked::Exchange(object&,object)", ves_icall_System_Threading_Interlocked_Exchange_Object,
+ "System.Threading.Interlocked::Exchange(single&,single)", ves_icall_System_Threading_Interlocked_Exchange_Single,
+
+ /*
+ * add other internal calls here
+ */
+ NULL, NULL
+};
+
+void
+mono_init_icall (void)
+{
+ const char *name;
+ int i = 0;
+
+ while ((name = icall_map [i])) {
+ mono_add_internal_call (name, icall_map [i+1]);
+ i += 2;
+ }
+
+}
+
+
diff --git a/mono/metadata/image.c b/mono/metadata/image.c
new file mode 100644
index 00000000000..2c7885f8ce1
--- /dev/null
+++ b/mono/metadata/image.c
@@ -0,0 +1,651 @@
+/*
+ * image.c: Routines for manipulating an image stored in an
+ * extended PE/COFF file.
+ *
+ * Author:
+ * Miguel de Icaza (miguel@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc. http://www.ximian.com
+ *
+ * TODO:
+ * Implement big-endian versions of the reading routines.
+ */
+#include <config.h>
+#include <stdio.h>
+#include <glib.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+#include "image.h"
+#include "cil-coff.h"
+#include "rawbuffer.h"
+#include "mono-endian.h"
+#include "private.h"
+#include "tabledefs.h"
+
+#define INVALID_ADDRESS 0xffffffff
+
+/*
+ * Keeps track of the various assemblies loaded
+ */
+static GHashTable *loaded_images_hash;
+
+guint32
+mono_cli_rva_image_map (MonoCLIImageInfo *iinfo, guint32 addr)
+{
+ const int top = iinfo->cli_section_count;
+ MonoSectionTable *tables = iinfo->cli_section_tables;
+ int i;
+
+ for (i = 0; i < top; i++){
+ if ((addr >= tables->st_virtual_address) &&
+ (addr < tables->st_virtual_address + tables->st_raw_data_size)){
+ return addr - tables->st_virtual_address + tables->st_raw_data_ptr;
+ }
+ tables++;
+ }
+ return INVALID_ADDRESS;
+}
+
+char *
+mono_cli_rva_map (MonoCLIImageInfo *iinfo, guint32 addr)
+{
+ const int top = iinfo->cli_section_count;
+ MonoSectionTable *tables = iinfo->cli_section_tables;
+ int i;
+
+ for (i = 0; i < top; i++){
+ if ((addr >= tables->st_virtual_address) &&
+ (addr < tables->st_virtual_address + tables->st_raw_data_size)){
+ return (char*)iinfo->cli_sections [i] +
+ (addr - tables->st_virtual_address);
+ }
+ tables++;
+ }
+ return NULL;
+}
+
+/**
+ * mono_image_ensure_section_idx:
+ * @image: The image we are operating on
+ * @section: section number that we will load/map into memory
+ *
+ * This routine makes sure that we have an in-memory copy of
+ * an image section (.text, .rsrc, .data).
+ *
+ * Returns: TRUE on success
+ */
+int
+mono_image_ensure_section_idx (MonoImage *image, int section)
+{
+ MonoCLIImageInfo *iinfo = image->image_info;
+ MonoSectionTable *sect;
+ gboolean writable;
+
+ g_return_val_if_fail (section < iinfo->cli_section_count, FALSE);
+
+ if (iinfo->cli_sections [section] != NULL)
+ return TRUE;
+
+ sect = &iinfo->cli_section_tables [section];
+
+ writable = sect->st_flags & SECT_FLAGS_MEM_WRITE;
+
+ iinfo->cli_sections [section] = mono_raw_buffer_load (
+ fileno (image->f), writable,
+ sect->st_raw_data_ptr, sect->st_raw_data_size);
+
+ if (iinfo->cli_sections [section] == NULL)
+ return FALSE;
+
+ return TRUE;
+}
+
+/**
+ * mono_image_ensure_section:
+ * @image: The image we are operating on
+ * @section: section name that we will load/map into memory
+ *
+ * This routine makes sure that we have an in-memory copy of
+ * an image section (.text, .rsrc, .data).
+ *
+ * Returns: TRUE on success
+ */
+int
+mono_image_ensure_section (MonoImage *image, const char *section)
+{
+ MonoCLIImageInfo *ii = image->image_info;
+ int i;
+
+ for (i = 0; i < ii->cli_section_count; i++){
+ if (strncmp (ii->cli_section_tables [i].st_name, section, 8) != 0)
+ continue;
+
+ return mono_image_ensure_section_idx (image, i);
+ }
+ return FALSE;
+}
+
+static int
+load_section_tables (MonoImage *image, MonoCLIImageInfo *iinfo)
+{
+ const int top = iinfo->cli_header.coff.coff_sections;
+ int i;
+
+ iinfo->cli_section_count = top;
+ iinfo->cli_section_tables = g_new0 (MonoSectionTable, top);
+ iinfo->cli_sections = g_new0 (void *, top);
+
+ for (i = 0; i < top; i++){
+ MonoSectionTable *t = &iinfo->cli_section_tables [i];
+
+ if (fread (t, sizeof (MonoSectionTable), 1, image->f) != 1)
+ return FALSE;
+
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+ t->st_virtual_size = GUINT32_FROM_LE (t->st_virtual_size);
+ t->st_virtual_address = GUINT32_FROM_LE (t->st_virtual_address);
+ t->st_raw_data_size = GUINT32_FROM_LE (t->st_raw_data_size);
+ t->st_raw_data_ptr = GUINT32_FROM_LE (t->st_raw_data_ptr);
+ t->st_reloc_ptr = GUINT32_FROM_LE (t->st_reloc_ptr);
+ t->st_lineno_ptr = GUINT32_FROM_LE (t->st_lineno_ptr);
+ t->st_reloc_count = GUINT16_FROM_LE (t->st_reloc_count);
+ t->st_line_count = GUINT16_FROM_LE (t->st_line_count);
+ t->st_flags = GUINT32_FROM_LE (t->st_flags);
+#endif
+ /* consistency checks here */
+ }
+
+ for (i = 0; i < top; i++)
+ if (!mono_image_ensure_section_idx (image, i))
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+load_cli_header (MonoImage *image, MonoCLIImageInfo *iinfo)
+{
+ guint32 offset;
+ int n;
+
+ offset = mono_cli_rva_image_map (iinfo, iinfo->cli_header.datadir.pe_cli_header.rva);
+ if (offset == INVALID_ADDRESS)
+ return FALSE;
+
+ if (fseek (image->f, offset, SEEK_SET) != 0)
+ return FALSE;
+
+ if ((n = fread (&iinfo->cli_cli_header, sizeof (MonoCLIHeader), 1, image->f)) != 1)
+ return FALSE;
+
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+#define SWAP32(x) (x) = GUINT32_FROM_LE ((x))
+#define SWAP16(x) (x) = GUINT16_FROM_LE ((x))
+#define SWAPPDE(x) do { (x).rva = GUINT32_FROM_LE ((x).rva); (x).size = GUINT32_FROM_LE ((x).size);} while (0)
+ SWAP32 (iinfo->cli_cli_header.ch_size);
+ SWAP32 (iinfo->cli_cli_header.ch_flags);
+ SWAP32 (iinfo->cli_cli_header.ch_entry_point);
+ SWAP16 (iinfo->cli_cli_header.ch_runtime_major);
+ SWAP16 (iinfo->cli_cli_header.ch_runtime_minor);
+ SWAPPDE (iinfo->cli_cli_header.ch_metadata);
+ SWAPPDE (iinfo->cli_cli_header.ch_resources);
+ SWAPPDE (iinfo->cli_cli_header.ch_strong_name);
+ SWAPPDE (iinfo->cli_cli_header.ch_code_manager_table);
+ SWAPPDE (iinfo->cli_cli_header.ch_vtable_fixups);
+ SWAPPDE (iinfo->cli_cli_header.ch_export_address_table_jumps);
+ SWAPPDE (iinfo->cli_cli_header.ch_eeinfo_table);
+ SWAPPDE (iinfo->cli_cli_header.ch_helper_table);
+ SWAPPDE (iinfo->cli_cli_header.ch_dynamic_info);
+ SWAPPDE (iinfo->cli_cli_header.ch_delay_load_info);
+ SWAPPDE (iinfo->cli_cli_header.ch_module_image);
+ SWAPPDE (iinfo->cli_cli_header.ch_external_fixups);
+ SWAPPDE (iinfo->cli_cli_header.ch_ridmap);
+ SWAPPDE (iinfo->cli_cli_header.ch_debug_map);
+ SWAPPDE (iinfo->cli_cli_header.ch_ip_map);
+#undef SWAP32
+#undef SWAP16
+#undef SWAPPDE
+#endif
+ /* Catch new uses of the fields that are supposed to be zero */
+
+ if ((iinfo->cli_cli_header.ch_eeinfo_table.rva != 0) ||
+ (iinfo->cli_cli_header.ch_helper_table.rva != 0) ||
+ (iinfo->cli_cli_header.ch_dynamic_info.rva != 0) ||
+ (iinfo->cli_cli_header.ch_delay_load_info.rva != 0) ||
+ (iinfo->cli_cli_header.ch_module_image.rva != 0) ||
+ (iinfo->cli_cli_header.ch_external_fixups.rva != 0) ||
+ (iinfo->cli_cli_header.ch_ridmap.rva != 0) ||
+ (iinfo->cli_cli_header.ch_debug_map.rva != 0) ||
+ (iinfo->cli_cli_header.ch_ip_map.rva != 0)){
+
+ /*
+ * No need to scare people who are testing this, I am just
+ * labelling this as a LAMESPEC
+ */
+ /* g_warning ("Some fields in the CLI header which should have been zero are not zero"); */
+
+ }
+
+ return TRUE;
+}
+
+static gboolean
+load_metadata_ptrs (MonoImage *image, MonoCLIImageInfo *iinfo)
+{
+ guint32 offset, size;
+ guint16 streams;
+ int i;
+ char *ptr;
+
+ offset = mono_cli_rva_image_map (iinfo, iinfo->cli_cli_header.ch_metadata.rva);
+ size = iinfo->cli_cli_header.ch_metadata.size;
+
+ image->raw_metadata = mono_raw_buffer_load (fileno (image->f), FALSE, offset, size);
+ if (image->raw_metadata == NULL)
+ return FALSE;
+
+ ptr = image->raw_metadata;
+
+ if (strncmp (ptr, "BSJB", 4) == 0){
+ guint32 version_string_len;
+
+ ptr += 12;
+ version_string_len = read32 (ptr);
+ ptr += 4;
+ ptr += version_string_len;
+ if (((guint32) ptr) % 4)
+ ptr += 4 - (((guint32) ptr) %4);
+ } else
+ return FALSE;
+
+ /* skip over flags */
+ ptr += 2;
+
+ streams = read16 (ptr);
+ ptr += 2;
+
+ for (i = 0; i < streams; i++){
+ if (strncmp (ptr + 8, "#~", 3) == 0){
+ image->heap_tables.data = image->raw_metadata + read32 (ptr);
+ image->heap_tables.size = read32 (ptr + 4);
+ ptr += 8 + 3;
+ } else if (strncmp (ptr + 8, "#Strings", 9) == 0){
+ image->heap_strings.data = image->raw_metadata + read32 (ptr);
+ image->heap_strings.size = read32 (ptr + 4);
+ ptr += 8 + 9;
+ } else if (strncmp (ptr + 8, "#US", 4) == 0){
+ image->heap_us.data = image->raw_metadata + read32 (ptr);
+ image->heap_us.size = read32 (ptr + 4);
+ ptr += 8 + 4;
+ } else if (strncmp (ptr + 8, "#Blob", 6) == 0){
+ image->heap_blob.data = image->raw_metadata + read32 (ptr);
+ image->heap_blob.size = read32 (ptr + 4);
+ ptr += 8 + 6;
+ } else if (strncmp (ptr + 8, "#GUID", 6) == 0){
+ image->heap_guid.data = image->raw_metadata + read32 (ptr);
+ image->heap_guid.size = read32 (ptr + 4);
+ ptr += 8 + 6;
+ } else {
+ g_message ("Unknown heap type: %s\n", ptr + 8);
+ ptr += 8 + strlen (ptr) + 1;
+ }
+ if (((guint32)ptr) % 4){
+ ptr += 4 - (((guint32)ptr) % 4);
+ }
+ }
+ return TRUE;
+}
+
+/*
+ * Load representation of logical metadata tables, from the "#~" stream
+ */
+static gboolean
+load_tables (MonoImage *image)
+{
+ const char *heap_tables = image->heap_tables.data;
+ const guint32 *rows;
+ guint64 valid_mask;
+ int valid = 0, table;
+ int heap_sizes;
+
+ heap_sizes = heap_tables [6];
+ image->idx_string_wide = ((heap_sizes & 0x01) == 1);
+ image->idx_guid_wide = ((heap_sizes & 0x02) == 2);
+ image->idx_blob_wide = ((heap_sizes & 0x04) == 4);
+
+ valid_mask = read64 (heap_tables + 8);
+ rows = (const guint32 *) (heap_tables + 24);
+
+ for (table = 0; table < 64; table++){
+ if ((valid_mask & ((guint64) 1 << table)) == 0){
+ image->tables [table].rows = 0;
+ continue;
+ }
+ if (table > 0x2b) {
+ g_warning("bits in valid must be zero above 0x2b (II - 23.1.6)");
+ }
+ image->tables [table].rows = read32 (rows);
+ rows++;
+ valid++;
+ }
+
+ image->tables_base = (heap_tables + 24) + (4 * valid);
+
+ /* They must be the same */
+ g_assert ((const void *) image->tables_base == (const void *) rows);
+
+ mono_metadata_compute_table_bases (image);
+ return TRUE;
+}
+
+static gboolean
+load_metadata (MonoImage *image, MonoCLIImageInfo *iinfo)
+{
+ if (!load_metadata_ptrs (image, iinfo))
+ return FALSE;
+
+ return load_tables (image);
+}
+
+static void
+load_class_names (MonoImage *image)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_TYPEDEF];
+ guint32 cols [MONO_TYPEDEF_SIZE];
+ const char *name;
+ const char *nspace;
+ GHashTable *nspace_table;
+ GHashTable *name_cache = image->name_cache;
+ guint32 i, visib;
+
+ for (i = 1; i <= t->rows; ++i) {
+ mono_metadata_decode_row (t, i - 1, cols, MONO_TYPEDEF_SIZE);
+ /* nested types are accessed from the nesting name */
+ visib = cols [MONO_TYPEDEF_FLAGS] & TYPE_ATTRIBUTE_VISIBILITY_MASK;
+ if (visib > TYPE_ATTRIBUTE_PUBLIC && visib < TYPE_ATTRIBUTE_NESTED_ASSEMBLY)
+ continue;
+ name = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAME]);
+ nspace = mono_metadata_string_heap (image, cols [MONO_TYPEDEF_NAMESPACE]);
+ if (!(nspace_table = g_hash_table_lookup (name_cache, nspace))) {
+ nspace_table = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_insert (name_cache, (char *)nspace, (char *)nspace_table);
+ }
+ g_hash_table_insert (nspace_table, (char *) name, GUINT_TO_POINTER (i));
+ }
+}
+
+static MonoImage *
+do_mono_image_open (const char *fname, MonoImageOpenStatus *status)
+{
+ MonoCLIImageInfo *iinfo;
+ MonoDotNetHeader *header;
+ MonoMSDOSHeader msdos;
+ MonoImage *image;
+ int n;
+
+ image = g_new0 (MonoImage, 1);
+ image->f = fopen (fname, "rb");
+ image->name = g_strdup (fname);
+ iinfo = g_new0 (MonoCLIImageInfo, 1);
+ image->image_info = iinfo;
+
+ image->method_cache = g_hash_table_new (g_direct_hash, g_direct_equal);
+ image->class_cache = g_hash_table_new (g_direct_hash, g_direct_equal);
+ image->name_cache = g_hash_table_new (g_str_hash, g_str_equal);
+ image->array_cache = g_hash_table_new (mono_metadata_type_hash, mono_metadata_type_equal);
+
+ header = &iinfo->cli_header;
+
+ if (image->f == NULL){
+ if (status)
+ *status = MONO_IMAGE_ERROR_ERRNO;
+ mono_image_close (image);
+ return NULL;
+ }
+
+ if (status)
+ *status = MONO_IMAGE_IMAGE_INVALID;
+
+ if (fread (&msdos, sizeof (msdos), 1, image->f) != 1)
+ goto invalid_image;
+
+ if (!(msdos.msdos_header [0] == 'M' && msdos.msdos_header [1] == 'Z'))
+ goto invalid_image;
+
+ msdos.pe_offset = GUINT32_FROM_LE (msdos.pe_offset);
+
+ if (msdos.pe_offset != sizeof (msdos))
+ fseek (image->f, msdos.pe_offset, SEEK_SET);
+
+ if ((n = fread (header, sizeof (MonoDotNetHeader), 1, image->f)) != 1)
+ goto invalid_image;
+
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+#define SWAP32(x) (x) = GUINT32_FROM_LE ((x))
+#define SWAP16(x) (x) = GUINT16_FROM_LE ((x))
+#define SWAPPDE(x) do { (x).rva = GUINT32_FROM_LE ((x).rva); (x).size = GUINT32_FROM_LE ((x).size);} while (0)
+ SWAP32 (header->coff.coff_time);
+ SWAP32 (header->coff.coff_symptr);
+ SWAP32 (header->coff.coff_symcount);
+ SWAP16 (header->coff.coff_machine);
+ SWAP16 (header->coff.coff_sections);
+ SWAP16 (header->coff.coff_opt_header_size);
+ SWAP16 (header->coff.coff_attributes);
+ /* MonoPEHeader */
+ SWAP32 (header->pe.pe_code_size);
+ SWAP32 (header->pe.pe_data_size);
+ SWAP32 (header->pe.pe_uninit_data_size);
+ SWAP32 (header->pe.pe_rva_entry_point);
+ SWAP32 (header->pe.pe_rva_code_base);
+ SWAP32 (header->pe.pe_rva_data_base);
+ SWAP16 (header->pe.pe_magic);
+
+ /* MonoPEHeaderNT: not used yet */
+ SWAP32 (header->nt.pe_image_base); /* must be 0x400000 */
+ SWAP32 (header->nt.pe_section_align); /* must be 8192 */
+ SWAP32 (header->nt.pe_file_alignment); /* must be 512 or 4096 */
+ SWAP16 (header->nt.pe_os_major); /* must be 4 */
+ SWAP16 (header->nt.pe_os_minor); /* must be 0 */
+ SWAP16 (header->nt.pe_user_major);
+ SWAP16 (header->nt.pe_user_minor);
+ SWAP16 (header->nt.pe_subsys_major);
+ SWAP16 (header->nt.pe_subsys_minor);
+ SWAP32 (header->nt.pe_reserved_1);
+ SWAP32 (header->nt.pe_image_size);
+ SWAP32 (header->nt.pe_header_size);
+ SWAP32 (header->nt.pe_checksum);
+ SWAP16 (header->nt.pe_subsys_required);
+ SWAP16 (header->nt.pe_dll_flags);
+ SWAP32 (header->nt.pe_stack_reserve);
+ SWAP32 (header->nt.pe_stack_commit);
+ SWAP32 (header->nt.pe_heap_reserve);
+ SWAP32 (header->nt.pe_heap_commit);
+ SWAP32 (header->nt.pe_loader_flags);
+ SWAP32 (header->nt.pe_data_dir_count);
+
+ /* MonoDotNetHeader: mostly unused */
+ SWAPPDE (header->datadir.pe_export_table);
+ SWAPPDE (header->datadir.pe_import_table);
+ SWAPPDE (header->datadir.pe_resource_table);
+ SWAPPDE (header->datadir.pe_exception_table);
+ SWAPPDE (header->datadir.pe_certificate_table);
+ SWAPPDE (header->datadir.pe_reloc_table);
+ SWAPPDE (header->datadir.pe_debug);
+ SWAPPDE (header->datadir.pe_copyright);
+ SWAPPDE (header->datadir.pe_global_ptr);
+ SWAPPDE (header->datadir.pe_tls_table);
+ SWAPPDE (header->datadir.pe_load_config_table);
+ SWAPPDE (header->datadir.pe_bound_import);
+ SWAPPDE (header->datadir.pe_iat);
+ SWAPPDE (header->datadir.pe_delay_import_desc);
+ SWAPPDE (header->datadir.pe_cli_header);
+ SWAPPDE (header->datadir.pe_reserved);
+
+#undef SWAP32
+#undef SWAP16
+#undef SWAPPDE
+#endif
+
+ if (header->coff.coff_machine != 0x14c)
+ goto invalid_image;
+
+ if (header->coff.coff_opt_header_size != (sizeof (MonoDotNetHeader) - sizeof (MonoCOFFHeader) - 4))
+ goto invalid_image;
+
+ if (header->pesig[0] != 'P' || header->pesig[1] != 'E' || header->pe.pe_magic != 0x10B)
+ goto invalid_image;
+
+ if (header->pe.pe_major != 6 || header->pe.pe_minor != 0)
+ goto invalid_image;
+
+ /*
+ * FIXME: byte swap all addresses here for header.
+ */
+
+ if (!load_section_tables (image, iinfo))
+ goto invalid_image;
+
+ /* Load the CLI header */
+ if (!load_cli_header (image, iinfo))
+ goto invalid_image;
+
+ if (!load_metadata (image, iinfo))
+ goto invalid_image;
+
+ load_class_names (image);
+
+ image->assembly_name = mono_metadata_string_heap (image,
+ mono_metadata_decode_row_col (&image->tables [MONO_TABLE_ASSEMBLY],
+ 0, MONO_ASSEMBLY_NAME));
+
+ if (status)
+ *status = MONO_IMAGE_OK;
+
+ return image;
+
+invalid_image:
+ mono_image_close (image);
+ return NULL;
+}
+
+MonoImage *
+mono_image_loaded (const char *name) {
+ if (loaded_images_hash)
+ return g_hash_table_lookup (loaded_images_hash, name);
+ return NULL;
+}
+
+/**
+ * mono_image_open:
+ * @fname: filename that points to the module we want to open
+ * @status: An error condition is returned in this field
+ *
+ * Retuns: An open image of type %MonoImage or NULL on error.
+ * if NULL, then check the value of @status for details on the error
+ */
+MonoImage *
+mono_image_open (const char *fname, MonoImageOpenStatus *status)
+{
+ MonoImage *image;
+
+ g_return_val_if_fail (fname != NULL, NULL);
+
+ if (loaded_images_hash){
+ image = g_hash_table_lookup (loaded_images_hash, fname);
+ if (image){
+ image->ref_count++;
+ return image;
+ }
+ }
+
+ image = do_mono_image_open (fname, status);
+ if (image == NULL)
+ return NULL;
+
+ if (!loaded_images_hash)
+ loaded_images_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_insert (loaded_images_hash, image->name, image);
+ g_hash_table_insert (loaded_images_hash, (char *) image->assembly_name, image);
+
+ return image;
+}
+
+static void
+free_hash_table(gpointer key, gpointer val, gpointer user_data)
+{
+ g_hash_table_destroy ((GHashTable*)val);
+}
+
+/**
+ * mono_image_close:
+ * @image: The image file we wish to close
+ *
+ * Closes an image file, deallocates all memory consumed and
+ * unmaps all possible sections of the file
+ */
+void
+mono_image_close (MonoImage *image)
+{
+ g_return_if_fail (image != NULL);
+
+ if (--image->ref_count)
+ return;
+
+ g_hash_table_remove (loaded_images_hash, image->name);
+
+ if (image->f)
+ fclose (image->f);
+
+ g_free (image->name);
+
+ g_hash_table_destroy (image->method_cache);
+ g_hash_table_destroy (image->class_cache);
+ g_hash_table_destroy (image->array_cache);
+ g_hash_table_foreach (image->name_cache, free_hash_table, NULL);
+ g_hash_table_destroy (image->name_cache);
+
+ if (image->raw_metadata != NULL)
+ mono_raw_buffer_free (image->raw_metadata);
+
+ if (image->image_info){
+ MonoCLIImageInfo *ii = image->image_info;
+ int i;
+
+ for (i = 0; i < ii->cli_section_count; i++){
+ if (!ii->cli_sections [i])
+ continue;
+ mono_raw_buffer_free (ii->cli_sections [i]);
+ }
+ if (ii->cli_section_tables)
+ g_free (ii->cli_section_tables);
+ if (ii->cli_sections)
+ g_free (ii->cli_sections);
+ g_free (image->image_info);
+ }
+
+ g_free (image);
+}
+
+/**
+ * mono_image_strerror:
+ * @status: an code indicating the result from a recent operation
+ *
+ * Returns: a string describing the error
+ */
+const char *
+mono_image_strerror (MonoImageOpenStatus status)
+{
+ switch (status){
+ case MONO_IMAGE_OK:
+ return "success";
+ case MONO_IMAGE_ERROR_ERRNO:
+ return strerror (errno);
+ case MONO_IMAGE_IMAGE_INVALID:
+ return "File does not contain a valid CIL image";
+ case MONO_IMAGE_MISSING_ASSEMBLYREF:
+ return "An assembly was referenced, but could not be found";
+ }
+ return "Internal error";
+}
+
diff --git a/mono/metadata/image.h b/mono/metadata/image.h
new file mode 100644
index 00000000000..99fa946d752
--- /dev/null
+++ b/mono/metadata/image.h
@@ -0,0 +1,116 @@
+#ifndef _MONONET_METADATA_IMAGE_H_
+#define _MONONET_METADATA_IMAGE_H_
+
+#include <stdio.h>
+#include <glib.h>
+
+typedef struct _MonoImage MonoImage;
+
+typedef struct {
+ int ref_count;
+ char *name;
+
+ MonoImage *image;
+ /* Load files here */
+} MonoAssembly;
+
+typedef struct {
+ const char* data;
+ guint32 size;
+} MonoStreamHeader;
+
+typedef struct {
+ guint32 rows, row_size;
+ const char *base;
+
+ /*
+ * Tables contain up to 9 columns and the possible sizes of the
+ * fields in the documentation are 1, 2 and 4 bytes. So we
+ * can encode in 2 bits the size.
+ *
+ * A 32 bit value can encode the resulting size
+ *
+ * The top eight bits encode the number of columns in the table.
+ * we only need 4, but 8 is aligned no shift required.
+ */
+ guint32 size_bitfield;
+} MonoTableInfo;
+
+struct _MonoImage {
+ int ref_count;
+ FILE *f;
+ char *name;
+ const char *assembly_name;
+ void *image_info;
+
+ char *raw_metadata;
+
+ gboolean idx_string_wide, idx_guid_wide, idx_blob_wide;
+
+ MonoStreamHeader heap_strings;
+ MonoStreamHeader heap_us;
+ MonoStreamHeader heap_blob;
+ MonoStreamHeader heap_guid;
+ MonoStreamHeader heap_tables;
+
+ const char *tables_base;
+
+ MonoTableInfo tables [64];
+
+ /*
+ * references is initialized only by using the mono_assembly_open
+ * function, and not by using the lowlevel mono_image_open.
+ *
+ * It is NULL terminated.
+ */
+ MonoAssembly **references;
+
+ /*
+ * The Assembly this image was loaded from.
+ */
+ MonoAssembly *assembly;
+
+ /*
+ * Indexed by method tokens and typedef tokens.
+ */
+ GHashTable *method_cache;
+ GHashTable *class_cache;
+ /*
+ * Indexes namespaces to hash tables that map class name to typedef token.
+ */
+ GHashTable *name_cache;
+
+ /*
+ * Indexed by ((rank << 24) | (typedef & 0xffffff)), which limits us to a
+ * maximal rank of 255
+ */
+ GHashTable *array_cache;
+
+ void *reflection_info;
+
+ /*
+ * user_info is a public field and is not touched by the
+ * metadata engine
+ */
+ void *user_info;
+};
+
+typedef enum {
+ MONO_IMAGE_OK,
+ MONO_IMAGE_ERROR_ERRNO,
+ MONO_IMAGE_MISSING_ASSEMBLYREF,
+ MONO_IMAGE_IMAGE_INVALID
+} MonoImageOpenStatus;
+
+MonoImage *mono_image_open (const char *fname,
+ MonoImageOpenStatus *status);
+MonoImage *mono_image_loaded (const char *name);
+void mono_image_close (MonoImage *image);
+const char *mono_image_strerror (MonoImageOpenStatus status);
+
+int mono_image_ensure_section (MonoImage *image,
+ const char *section);
+int mono_image_ensure_section_idx (MonoImage *image,
+ int section);
+
+#endif
diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c
new file mode 100644
index 00000000000..9767b73cfb1
--- /dev/null
+++ b/mono/metadata/loader.c
@@ -0,0 +1,512 @@
+/*
+ * loader.c: Image Loader
+ *
+ * Authors:
+ * Paolo Molaro (lupus@ximian.com)
+ * Miguel de Icaza (miguel@ximian.com)
+ * Patrik Torstensson (patrik.torstensson@labs2.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ *
+ * This file is used by the interpreter and the JIT engine to locate
+ * assemblies. Used to load AssemblyRef and later to resolve various
+ * kinds of `Refs'.
+ *
+ * TODO:
+ * This should keep track of the assembly versions that we are loading.
+ *
+ */
+#include <config.h>
+#include <glib.h>
+#include <gmodule.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <mono/metadata/metadata.h>
+#include <mono/metadata/image.h>
+#include <mono/metadata/assembly.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/metadata/cil-coff.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/loader.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/debug-helpers.h>
+
+static gboolean dummy_icall = TRUE;
+
+MonoDefaults mono_defaults;
+
+#ifdef __CYGWIN__
+#define mono_map_dll(name) (name)
+#else
+static const char *dll_map[] = {
+ "libc", "libc.so.6",
+ "libm", "libm.so.6",
+ "cygwin1.dll", "libc.so.6",
+ NULL, NULL
+};
+
+static const char *
+mono_map_dll (const char *name)
+{
+ int i = 0;
+
+ while (dll_map [i]) {
+ if (!strcmp (dll_map [i], name))
+ return dll_map [i + 1];
+ i += 2;
+ }
+
+ return name;
+}
+#endif
+
+static GHashTable *icall_hash = NULL;
+
+void
+mono_add_internal_call (const char *name, gconstpointer method)
+{
+ if (!icall_hash) {
+ dummy_icall = FALSE;
+ icall_hash = g_hash_table_new (g_str_hash , g_str_equal);
+ }
+
+ g_hash_table_insert (icall_hash, g_strdup (name), method);
+}
+
+static void
+ves_icall_dummy (void)
+{
+ g_warning ("the mono runtime is not initialized");
+ g_assert_not_reached ();
+}
+
+gpointer
+mono_lookup_internal_call (MonoMethod *method)
+{
+ char *name;
+ char *tmpsig;
+ gpointer res;
+
+ if (dummy_icall)
+ return ves_icall_dummy;
+
+ if (!method) {
+ g_warning ("can't resolve internal call, method is null");
+ }
+
+ if (!icall_hash) {
+ g_warning ("icall_hash not initialized");
+ g_assert_not_reached ();
+ }
+
+ name = g_strconcat (method->klass->name_space, ".", method->klass->name, "::", method->name, NULL);
+ if (!(res = g_hash_table_lookup (icall_hash, name))) {
+ // trying to resolve with full signature
+ g_free (name);
+
+ tmpsig = mono_signature_get_desc(method->signature, TRUE);
+ name = g_strconcat (method->klass->name_space, ".", method->klass->name, "::", method->name, "(", tmpsig, ")", NULL);
+ if (!(res = g_hash_table_lookup (icall_hash, name))) {
+ g_warning ("cant resolve internal call to \"%s\" (tested without signature also)", name);
+
+ g_free (name);
+ g_free(tmpsig);
+
+ return NULL;
+ }
+
+ g_free(tmpsig);
+ }
+
+ g_free (name);
+
+ return res;
+}
+
+MonoClassField*
+mono_field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass)
+{
+ MonoImage *mimage;
+ MonoClass *klass;
+ MonoTableInfo *tables = image->tables;
+ guint32 cols[6];
+ guint32 nindex, class, i;
+ const char *fname, *name, *nspace;
+ const char *ptr;
+ guint32 idx = mono_metadata_token_index (token);
+
+ mono_metadata_decode_row (&tables [MONO_TABLE_MEMBERREF], idx-1, cols, MONO_MEMBERREF_SIZE);
+ nindex = cols [MONO_MEMBERREF_CLASS] >> MEMBERREF_PARENT_BITS;
+ class = cols [MONO_MEMBERREF_CLASS] & MEMBERREF_PARENT_MASK;
+
+ fname = mono_metadata_string_heap (image, cols [MONO_MEMBERREF_NAME]);
+
+ ptr = mono_metadata_blob_heap (image, cols [MONO_MEMBERREF_SIGNATURE]);
+ mono_metadata_decode_blob_size (ptr, &ptr);
+ /* we may want to check the signature here... */
+
+ switch (class) {
+ case MEMBERREF_PARENT_TYPEREF: {
+ guint32 scopeindex, scopetable;
+
+ mono_metadata_decode_row (&tables [MONO_TABLE_TYPEREF], nindex-1, cols, MONO_TYPEREF_SIZE);
+ scopeindex = cols [MONO_TYPEREF_SCOPE] >> RESOLTION_SCOPE_BITS;
+ scopetable = cols [MONO_TYPEREF_SCOPE] & RESOLTION_SCOPE_MASK;
+ /*g_print ("typeref: 0x%x 0x%x %s.%s\n", scopetable, scopeindex,
+ mono_metadata_string_heap (m, cols [MONO_TYPEREF_NAMESPACE]),
+ mono_metadata_string_heap (m, cols [MONO_TYPEREF_NAME]));*/
+ switch (scopetable) {
+ case RESOLTION_SCOPE_ASSEMBLYREF:
+ /*
+ * To find the field we have the following info:
+ * *) name and namespace of the class from the TYPEREF table
+ * *) name and signature of the field from the MEMBERREF table
+ */
+ nspace = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAMESPACE]);
+ name = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAME]);
+
+ /* this will triggered by references to mscorlib */
+ if (image->references [scopeindex-1] == NULL)
+ g_error ("Reference to mscorlib? Probably need to implement %s.%s::%s in corlib", nspace, name, fname);
+
+ mimage = image->references [scopeindex-1]->image;
+
+ klass = mono_class_from_name (mimage, nspace, name);
+ mono_class_init (klass);
+
+ /* mostly dumb search for now */
+ for (i = 0; i < klass->field.count; ++i) {
+ MonoClassField *f = &klass->fields [i];
+ if (!strcmp (fname, f->name)) {
+ if (retklass)
+ *retklass = klass;
+ return f;
+ }
+ }
+ g_warning ("Missing field %s.%s::%s", nspace, name, fname);
+ return NULL;
+ default:
+ return NULL;
+ }
+ break;
+ }
+ default:
+ return NULL;
+ }
+}
+
+static MonoMethod *
+method_from_memberref (MonoImage *image, guint32 idx)
+{
+ MonoImage *mimage;
+ MonoClass *klass;
+ MonoTableInfo *tables = image->tables;
+ guint32 cols[6];
+ guint32 nindex, class, i;
+ const char *mname, *name, *nspace;
+ MonoMethodSignature *sig;
+ const char *ptr;
+
+ mono_metadata_decode_row (&tables [MONO_TABLE_MEMBERREF], idx-1, cols, 3);
+ nindex = cols [MONO_MEMBERREF_CLASS] >> MEMBERREF_PARENT_BITS;
+ class = cols [MONO_MEMBERREF_CLASS] & MEMBERREF_PARENT_MASK;
+ /*g_print ("methodref: 0x%x 0x%x %s\n", class, nindex,
+ mono_metadata_string_heap (m, cols [MONO_MEMBERREF_NAME]));*/
+
+ mname = mono_metadata_string_heap (image, cols [MONO_MEMBERREF_NAME]);
+
+ ptr = mono_metadata_blob_heap (image, cols [MONO_MEMBERREF_SIGNATURE]);
+ mono_metadata_decode_blob_size (ptr, &ptr);
+ sig = mono_metadata_parse_method_signature (image, 0, ptr, NULL);
+
+ switch (class) {
+ case MEMBERREF_PARENT_TYPEREF: {
+ guint32 scopeindex, scopetable;
+
+ mono_metadata_decode_row (&tables [MONO_TABLE_TYPEREF], nindex-1, cols, MONO_TYPEREF_SIZE);
+ scopeindex = cols [MONO_TYPEREF_SCOPE] >> RESOLTION_SCOPE_BITS;
+ scopetable = cols [MONO_TYPEREF_SCOPE] & RESOLTION_SCOPE_MASK;
+ /*g_print ("typeref: 0x%x 0x%x %s.%s\n", scopetable, scopeindex,
+ mono_metadata_string_heap (m, cols [MONO_TYPEREF_NAMESPACE]),
+ mono_metadata_string_heap (m, cols [MONO_TYPEREF_NAME]));*/
+ switch (scopetable) {
+ case RESOLTION_SCOPE_ASSEMBLYREF:
+ /*
+ * To find the method we have the following info:
+ * *) name and namespace of the class from the TYPEREF table
+ * *) name and signature of the method from the MEMBERREF table
+ */
+ nspace = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAMESPACE]);
+ name = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAME]);
+
+ /* this will triggered by references to mscorlib */
+ if (image->references [scopeindex-1] == NULL)
+ g_error ("Reference to mscorlib? Probably need to implement %s.%s::%s in corlib", nspace, name, mname);
+
+ mimage = image->references [scopeindex-1]->image;
+
+ klass = mono_class_from_name (mimage, nspace, name);
+ if (!klass) {
+ g_warning ("Missing method %s.%s::%s", nspace, name, mname);
+ mono_metadata_free_method_signature (sig);
+ return NULL;
+ }
+ mono_class_init (klass);
+
+ /* mostly dumb search for now */
+ for (i = 0; i < klass->method.count; ++i) {
+ MonoMethod *m = klass->methods [i];
+ if (!strcmp (mname, m->name)) {
+ if (mono_metadata_signature_equal (sig, m->signature)) {
+ mono_metadata_free_method_signature (sig);
+ return m;
+ }
+ }
+ }
+ g_warning ("Missing method %s.%s::%s", nspace, name, mname);
+ mono_metadata_free_method_signature (sig);
+ return NULL;
+ default:
+ mono_metadata_free_method_signature (sig);
+ return NULL;
+ }
+ break;
+ }
+ case MEMBERREF_PARENT_TYPESPEC: {
+ guint32 bcols [MONO_TYPESPEC_SIZE];
+ guint32 len;
+ MonoType *type;
+ MonoMethod *result;
+
+ mono_metadata_decode_row (&tables [MONO_TABLE_TYPESPEC], nindex - 1,
+ bcols, MONO_TYPESPEC_SIZE);
+ ptr = mono_metadata_blob_heap (image, bcols [MONO_TYPESPEC_SIGNATURE]);
+ len = mono_metadata_decode_value (ptr, &ptr);
+ type = mono_metadata_parse_type (image, MONO_PARSE_TYPE, 0, ptr, &ptr);
+
+ if (type->type != MONO_TYPE_ARRAY && type->type != MONO_TYPE_SZARRAY)
+ g_assert_not_reached ();
+
+ result = (MonoMethod *)g_new0 (MonoMethodPInvoke, 1);
+ result->klass = mono_class_get (image, MONO_TOKEN_TYPE_SPEC | nindex);
+ result->iflags = METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL;
+ result->signature = sig;
+ result->name = mname;
+
+ if (!strcmp (mname, ".ctor")) {
+ /* we special-case this in the runtime. */
+ result->addr = NULL;
+ return result;
+ }
+
+ if (!strcmp (mname, "Set")) {
+ g_assert (sig->hasthis);
+ g_assert (type->data.array->rank + 1 == sig->param_count);
+
+ result->addr = mono_lookup_internal_call(result);
+ return result;
+ }
+
+ if (!strcmp (mname, "Get")) {
+ g_assert (sig->hasthis);
+ g_assert (type->data.array->rank == sig->param_count);
+
+ result->addr = mono_lookup_internal_call(result);
+ return result;
+ }
+
+ if (!strcmp (mname, "Address")) {
+ g_assert (sig->hasthis);
+ g_assert (type->data.array->rank == sig->param_count);
+
+ result->addr = mono_lookup_internal_call(result);
+ return result;
+ }
+
+ g_assert_not_reached ();
+ break;
+ }
+ default:
+ g_assert_not_reached ();
+ }
+
+ return NULL;
+}
+
+static void
+fill_pinvoke_info (MonoImage *image, MonoMethodPInvoke *piinfo, int idx)
+{
+ MonoMethod *mh = &piinfo->method;
+ MonoTableInfo *tables = image->tables;
+ MonoTableInfo *im = &tables [MONO_TABLE_IMPLMAP];
+ MonoTableInfo *mr = &tables [MONO_TABLE_MODULEREF];
+ guint32 im_cols [4];
+ guint32 mr_cols [1];
+ const char *import = NULL;
+ const char *scope = NULL;
+ char *full_name;
+ GModule *gmodule;
+ int i;
+
+ for (i = 0; i < im->rows; i++) {
+
+ mono_metadata_decode_row (im, i, im_cols, 4);
+
+ if ((im_cols[1] >> 1) == idx + 1) {
+
+ import = mono_metadata_string_heap (image, im_cols [2]);
+
+ mono_metadata_decode_row (mr, im_cols [3] - 1, mr_cols,
+ 1);
+
+ scope = mono_metadata_string_heap (image, mr_cols [0]);
+ }
+ }
+
+ piinfo->piflags = im_cols [0];
+
+ g_assert (import && scope);
+
+ scope = mono_map_dll (scope);
+ full_name = g_module_build_path (NULL, scope);
+ gmodule = g_module_open (full_name, G_MODULE_BIND_LAZY);
+
+ mh->addr = NULL;
+ if (!gmodule) {
+ if (!(gmodule=g_module_open (scope, G_MODULE_BIND_LAZY))) {
+ g_warning ("Failed to load library %s (%s)", full_name, scope);
+ g_free (full_name);
+ return;
+ }
+ }
+ g_free (full_name);
+
+ g_module_symbol (gmodule, import, &mh->addr);
+
+ if (!mh->addr) {
+ g_warning ("Failed to load function %s from %s", import, scope);
+ return;
+ }
+
+ mh->flags |= METHOD_ATTRIBUTE_PINVOKE_IMPL;
+}
+
+MonoMethod *
+mono_get_method (MonoImage *image, guint32 token, MonoClass *klass)
+{
+ MonoMethod *result;
+ int table = mono_metadata_token_table (token);
+ int idx = mono_metadata_token_index (token);
+ MonoTableInfo *tables = image->tables;
+ const char *loc, *sig = NULL;
+ int size;
+ guint32 cols [MONO_TYPEDEF_SIZE];
+
+ if ((result = g_hash_table_lookup (image->method_cache, GINT_TO_POINTER (token))))
+ return result;
+
+ if (table != MONO_TABLE_METHOD) {
+ if (table != MONO_TABLE_MEMBERREF)
+ g_print("got wrong token: 0x%08x\n", token);
+ g_assert (table == MONO_TABLE_MEMBERREF);
+ result = method_from_memberref (image, idx);
+ g_hash_table_insert (image->method_cache, GINT_TO_POINTER (token), result);
+ return result;
+ }
+
+ mono_metadata_decode_row (&tables [table], idx - 1, cols, 6);
+
+ if ((cols [2] & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
+ (cols [1] & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL))
+ result = (MonoMethod *)g_new0 (MonoMethodPInvoke, 1);
+ else
+ result = (MonoMethod *)g_new0 (MonoMethodNormal, 1);
+
+ result->slot = -1;
+ result->klass = klass;
+ result->flags = cols [2];
+ result->iflags = cols [1];
+ result->name = mono_metadata_string_heap (image, cols [3]);
+
+ if (!sig) /* already taken from the methodref */
+ sig = mono_metadata_blob_heap (image, cols [4]);
+ size = mono_metadata_decode_blob_size (sig, &sig);
+ result->signature = mono_metadata_parse_method_signature (image, 0, sig, NULL);
+
+ if (!result->klass) {
+ guint32 type = mono_metadata_typedef_from_method (image, token);
+ result->klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | type);
+ }
+
+ if (cols [1] & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) {
+ result->addr = mono_lookup_internal_call (result);
+ result->flags |= METHOD_ATTRIBUTE_PINVOKE_IMPL;
+ } else if (cols [2] & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+ fill_pinvoke_info (image, (MonoMethodPInvoke *)result, idx - 1);
+ } else {
+ /* if this is a methodref from another module/assembly, this fails */
+ loc = mono_cli_rva_map ((MonoCLIImageInfo *)image->image_info, cols [0]);
+
+ if (!result->klass->dummy && !(result->flags & METHOD_ATTRIBUTE_ABSTRACT) &&
+ !(result->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME)) {
+ g_assert (loc);
+ ((MonoMethodNormal *)result)->header = mono_metadata_parse_mh (image, loc);
+ }
+ }
+
+ g_hash_table_insert (image->method_cache, GINT_TO_POINTER (token), result);
+
+ return result;
+}
+
+void
+mono_free_method (MonoMethod *method)
+{
+ mono_metadata_free_method_signature (method->signature);
+ if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+ MonoMethodPInvoke *piinfo = (MonoMethodPInvoke *)method;
+ g_free (piinfo->code);
+ } else if (!(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)) {
+ mono_metadata_free_mh (((MonoMethodNormal *)method)->header);
+ }
+
+ g_free (method);
+}
+
+void
+mono_method_get_param_names (MonoMethod *method, const char **names)
+{
+ int i, lastp;
+ MonoClass *klass = method->klass;
+ MonoTableInfo *methodt = &klass->image->tables [MONO_TABLE_METHOD];
+ MonoTableInfo *paramt = &klass->image->tables [MONO_TABLE_PARAM];
+
+ if (!method->signature->param_count)
+ return;
+ for (i = 0; i < method->signature->param_count; ++i)
+ names [i] = "";
+
+ mono_class_init (klass);
+ if (!klass->methods)
+ return;
+
+ for (i = 0; i < klass->method.count; ++i) {
+ if (method == klass->methods [i]) {
+ guint32 idx = klass->method.first + i;
+ guint32 cols [MONO_PARAM_SIZE];
+ guint param_index = mono_metadata_decode_row_col (methodt, idx, MONO_METHOD_PARAMLIST);
+
+ if (idx + 1 < methodt->rows)
+ lastp = mono_metadata_decode_row_col (methodt, idx + 1, MONO_METHOD_PARAMLIST);
+ else
+ lastp = paramt->rows;
+ for (i = param_index; i < lastp; ++i) {
+ mono_metadata_decode_row (paramt, i -1, cols, MONO_PARAM_SIZE);
+ if (cols [MONO_PARAM_SEQUENCE]) /* skip return param spec */
+ names [cols [MONO_PARAM_SEQUENCE] - 1] = mono_metadata_string_heap (klass->image, cols [MONO_PARAM_NAME]);
+ }
+ return;
+ }
+ }
+}
diff --git a/mono/metadata/loader.h b/mono/metadata/loader.h
new file mode 100644
index 00000000000..4e645507be5
--- /dev/null
+++ b/mono/metadata/loader.h
@@ -0,0 +1,93 @@
+#ifndef _MONO_METADATA_LOADER_H_
+#define _MONO_METADATA_LOADER_H_ 1
+
+#include <mono/metadata/metadata.h>
+#include <mono/metadata/image.h>
+
+typedef struct {
+ guint16 flags; /* method flags */
+ guint16 iflags; /* method implementation flags */
+ MonoClass *klass;
+ MonoMethodSignature *signature;
+ gpointer addr;
+ gpointer info; /* runtime info */
+ gpointer remoting_tramp;
+ gint slot;
+ /* name is useful mostly for debugging */
+ const char *name;
+ /* this is used by the inlining algorithm */
+ unsigned int inline_info:1;
+ unsigned int uses_this:1;
+ gint16 inline_count;
+} MonoMethod;
+
+typedef struct {
+ MonoMethod method;
+ MonoMethodHeader *header;
+} MonoMethodNormal;
+
+typedef struct {
+ MonoMethod method;
+ guint16 piflags; /* pinvoke flags */
+ void (*code) (void);
+} MonoMethodPInvoke;
+
+typedef struct {
+ MonoImage *corlib;
+ MonoClass *object_class;
+ MonoClass *byte_class;
+ MonoClass *void_class;
+ MonoClass *boolean_class;
+ MonoClass *sbyte_class;
+ MonoClass *int16_class;
+ MonoClass *uint16_class;
+ MonoClass *int32_class;
+ MonoClass *uint32_class;
+ MonoClass *int_class;
+ MonoClass *uint_class;
+ MonoClass *int64_class;
+ MonoClass *uint64_class;
+ MonoClass *single_class;
+ MonoClass *double_class;
+ MonoClass *char_class;
+ MonoClass *string_class;
+ MonoClass *enum_class;
+ MonoClass *array_class;
+ MonoClass *multicastdelegate_class;
+ MonoClass *asyncresult_class;
+ MonoClass *waithandle_class;
+ MonoClass *typehandle_class;
+ MonoClass *fieldhandle_class;
+ MonoClass *methodhandle_class;
+ MonoClass *monotype_class;
+ MonoClass *exception_class;
+ MonoClass *thread_class;
+ MonoClass *transparent_proxy_class;
+ MonoClass *real_proxy_class;
+ MonoClass *mono_method_message_class;
+} MonoDefaults;
+
+extern MonoDefaults mono_defaults;
+
+void
+mono_init_icall (void);
+
+MonoMethod *
+mono_get_method (MonoImage *image, guint32 token, MonoClass *klass);
+
+void
+mono_free_method (MonoMethod *method);
+
+MonoImage *
+mono_load_image (const char *fname, MonoImageOpenStatus *status);
+
+void
+mono_add_internal_call (const char *name, gconstpointer method);
+
+gpointer
+mono_lookup_internal_call (MonoMethod *method);
+
+void
+mono_method_get_param_names (MonoMethod *method, const char **names);
+
+#endif
diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c
new file mode 100644
index 00000000000..6fb9907adf4
--- /dev/null
+++ b/mono/metadata/marshal.c
@@ -0,0 +1,33 @@
+/*
+ * marshal.c: Routines for marshaling complex types in P/Invoke methods.
+ *
+ * Author:
+ * Paolo Molaro (lupus@ximian.com)
+ *
+ * (C) 2002 Ximian, Inc. http://www.ximian.com
+ *
+ */
+
+#include "object.h"
+#include "loader.h"
+#include "marshal.h"
+
+void*
+mono_marshal_string_array (MonoArray *array)
+{
+ char **result;
+ int i, len;
+
+ if (!array)
+ return NULL;
+
+ len = mono_array_length (array);
+
+ result = g_malloc (sizeof (char*) * len);
+ for (i = 0; i < len; ++i) {
+ MonoString *s = (MonoString*)mono_array_get (array, gpointer, i);
+ result [i] = s ? mono_string_to_utf8 (s): NULL;
+ }
+ return result;
+}
+
diff --git a/mono/metadata/marshal.h b/mono/metadata/marshal.h
new file mode 100644
index 00000000000..4b65d8cea91
--- /dev/null
+++ b/mono/metadata/marshal.h
@@ -0,0 +1,18 @@
+
+/*
+ * marshal.h: Routines for marshaling complex types in P/Invoke methods.
+ *
+ * Author:
+ * Paolo Molaro (lupus@ximian.com)
+ *
+ * (C) 2002 Ximian, Inc. http://www.ximian.com
+ *
+ */
+
+#ifndef __MONO_MARSHAL_H__
+#define __MONO_MARSHAL_H__
+
+void* mono_marshal_string_array (MonoArray *array);
+
+#endif /* __MONO_MARSHAL_H__ */
+
diff --git a/mono/metadata/mempool.c b/mono/metadata/mempool.c
new file mode 100644
index 00000000000..2347b45b661
--- /dev/null
+++ b/mono/metadata/mempool.c
@@ -0,0 +1,123 @@
+/*
+ * mempool.c: efficient memory allocation
+ *
+ * MonoMemPool is for fast allocation of memory. We free
+ * all memory when the pool is destroyed.
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+#include <string.h>
+
+#include "mempool.h"
+
+/*
+ * MonoMemPool is for fast allocation of memory. We free
+ * all memory when the pool is destroyed.
+ */
+
+#define MEM_ALIGN 8
+
+#define MONO_MEMPOOL_PAGESIZE 8192
+
+struct _MonoMemPool {
+ MonoMemPool *next;
+ gint rest;
+ gpointer pos;
+ double pad; /* to assure proper alignment */
+};
+
+/**
+ * mono_mempool_new:
+ *
+ * Returns: a new memory pool.
+ */
+MonoMemPool *
+mono_mempool_new ()
+{
+ MonoMemPool *pool = g_malloc (MONO_MEMPOOL_PAGESIZE);
+
+ pool->next = NULL;
+ pool->pos = (char *)pool + sizeof (MonoMemPool);
+ pool->rest = MONO_MEMPOOL_PAGESIZE - sizeof (MonoMemPool);
+ return pool;
+}
+
+/**
+ * mono_mempool_destroy:
+ * @pool: the momory pool to destroy
+ *
+ * Free all memory associated with this pool.
+ */
+void
+mono_mempool_destroy (MonoMemPool *pool)
+{
+ MonoMemPool *p, *n;
+
+ p = pool;
+ while (p) {
+ n = p->next;
+ g_free (p);
+ p = n;
+ }
+}
+
+/**
+ * mono_mempool_alloc:
+ * @pool: the momory pool to destroy
+ * @size: size of the momory block
+ *
+ * Allocates a new block of memory in @pool. @size must
+ * be smaller than 256.
+ *
+ * Returns: the address of a newly allocated memory block.
+ */
+gpointer
+mono_mempool_alloc (MonoMemPool *pool, guint size)
+{
+ gpointer rval;
+
+ g_assert (pool != NULL);
+
+ size = (size + MEM_ALIGN - 1) & ~(MEM_ALIGN - 1);
+
+ if (pool->rest < size) {
+ if (size >= 4096) {
+ MonoMemPool *np = g_malloc (sizeof (MonoMemPool) + size);
+ np->next = pool->next;
+ pool->next = np;
+ return (char *)np + sizeof (MonoMemPool);
+ } else {
+ MonoMemPool *np = g_malloc (MONO_MEMPOOL_PAGESIZE);
+ np->next = pool->next;
+ pool->next = np;
+ pool->pos = (char *)np + sizeof (MonoMemPool);
+ pool->rest = MONO_MEMPOOL_PAGESIZE - sizeof (MonoMemPool);
+ }
+ }
+
+ rval = pool->pos;
+ pool->rest -= size;
+ pool->pos = (char *)pool->pos + size;
+
+ return rval;
+}
+
+/**
+ * mono_mempool_alloc0:
+ *
+ * same as mono_mempool_alloc, but fills memory with zero.
+ */
+gpointer
+mono_mempool_alloc0 (MonoMemPool *pool, guint size)
+{
+ gpointer rval = mono_mempool_alloc (pool, size);
+ memset (rval, 0, size);
+ return rval;
+}
+
diff --git a/mono/metadata/mempool.h b/mono/metadata/mempool.h
new file mode 100644
index 00000000000..5ee9a6fc57d
--- /dev/null
+++ b/mono/metadata/mempool.h
@@ -0,0 +1,20 @@
+#ifndef _MONO_MEMPOOL_H_
+#define _MONO_MEMPOOL_H_
+
+typedef struct _MonoMemPool MonoMemPool;
+
+MonoMemPool *
+mono_mempool_new (void);
+
+void
+mono_mempool_destroy (MonoMemPool *pool);
+
+gpointer
+mono_mempool_alloc (MonoMemPool *pool,
+ guint size);
+
+gpointer
+mono_mempool_alloc0 (MonoMemPool *pool,
+ guint size);
+
+#endif
diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c
index 02db6e5c04b..cc128dda7d3 100644
--- a/mono/metadata/metadata.c
+++ b/mono/metadata/metadata.c
@@ -8,6 +8,2583 @@
*/
#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <glib.h>
#include "metadata.h"
+#include "tabledefs.h"
+#include "mono-endian.h"
+#include "cil-coff.h"
+#include "tokentype.h"
+#include "private.h"
+#include "class.h"
+
+static void do_mono_metadata_parse_type (MonoType *type, MonoImage *m, const char *ptr, const char **rptr);
+
+/*
+ * Encoding of the "description" argument:
+ *
+ * identifier [CODE ARG]
+ *
+ * If CODE is ':', then a lookup on table ARG is performed
+ * If CODE is '=', then a lookup in the aliased-table ARG is performed
+ * If CODE is '#', then this encodes a flag, ARG is the flag name.
+ *
+ * Aliased table for example is `CustomAttributeType' which depending on the
+ * information might refer to different tables.
+ */
+
+static MonoMetaTable AssemblySchema [] = {
+ { MONO_MT_UINT32, "HashId" },
+ { MONO_MT_UINT16, "Major" },
+ { MONO_MT_UINT16, "Minor" },
+ { MONO_MT_UINT16, "BuildNumber" },
+ { MONO_MT_UINT16, "RevisionNumber" },
+ { MONO_MT_UINT32, "Flags" },
+ { MONO_MT_BLOB_IDX, "PublicKey" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_STRING_IDX, "Culture" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable AssemblyOSSchema [] = {
+ { MONO_MT_UINT32, "OSPlatformID" },
+ { MONO_MT_UINT32, "OSMajor" },
+ { MONO_MT_UINT32, "OSMinor" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable AssemblyProcessorSchema [] = {
+ { MONO_MT_UINT32, "Processor" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable AssemblyRefSchema [] = {
+ { MONO_MT_UINT16, "Major" },
+ { MONO_MT_UINT16, "Minor" },
+ { MONO_MT_UINT16, "Build" },
+ { MONO_MT_UINT16, "Revision" },
+ { MONO_MT_UINT32, "Flags" },
+ { MONO_MT_BLOB_IDX, "PublicKeyOrToken" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_STRING_IDX, "Culture" },
+ { MONO_MT_BLOB_IDX, "HashValue" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable AssemblyRefOSSchema [] = {
+ { MONO_MT_UINT32, "OSPlatformID" },
+ { MONO_MT_UINT32, "OSMajorVersion" },
+ { MONO_MT_UINT32, "OSMinorVersion" },
+ { MONO_MT_TABLE_IDX, "AssemblyRef:AssemblyRef" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable AssemblyRefProcessorSchema [] = {
+ { MONO_MT_UINT32, "Processor" },
+ { MONO_MT_TABLE_IDX, "AssemblyRef:AssemblyRef" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable ClassLayoutSchema [] = {
+ { MONO_MT_UINT16, "PackingSize" },
+ { MONO_MT_UINT32, "ClassSize" },
+ { MONO_MT_TABLE_IDX, "Parent:TypeDef" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable ConstantSchema [] = {
+ { MONO_MT_UINT8, "Type" },
+ { MONO_MT_UINT8, "PaddingZero" },
+ { MONO_MT_CONST_IDX, "Parent" },
+ { MONO_MT_BLOB_IDX, "Value" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable CustomAttributeSchema [] = {
+ { MONO_MT_HASCAT_IDX, "Parent" },
+ { MONO_MT_CAT_IDX, "Type" },
+ { MONO_MT_BLOB_IDX, "Value" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable DeclSecuritySchema [] = {
+ { MONO_MT_UINT16, "Action" },
+ { MONO_MT_HASDEC_IDX, "Parent" },
+ { MONO_MT_BLOB_IDX, "PermissionSet" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable EventMapSchema [] = {
+ { MONO_MT_TABLE_IDX, "Parent:TypeDef" },
+ { MONO_MT_TABLE_IDX, "EventList:Event" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable EventSchema [] = {
+ { MONO_MT_UINT16, "EventFlags#EventAttribute" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_TABLE_IDX, "EventType" }, /* TypeDef or TypeRef */
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable ExportedTypeSchema [] = {
+ { MONO_MT_UINT32, "Flags" },
+ { MONO_MT_TABLE_IDX, "TypeDefId" },
+ { MONO_MT_STRING_IDX, "TypeName" },
+ { MONO_MT_STRING_IDX, "TypeNameSpace" },
+ { MONO_MT_IMPL_IDX, "Implementation" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable FieldSchema [] = {
+ { MONO_MT_UINT16, "Flags" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_BLOB_IDX, "Signature" },
+ { MONO_MT_END, NULL }
+};
+static MonoMetaTable FieldLayoutSchema [] = {
+ { MONO_MT_UINT32, "Offset" },
+ { MONO_MT_TABLE_IDX, "Field:Field" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable FieldMarshalSchema [] = {
+ { MONO_MT_HFM_IDX, "Parent" },
+ { MONO_MT_BLOB_IDX, "NativeType" },
+ { MONO_MT_END, NULL }
+};
+static MonoMetaTable FieldRVASchema [] = {
+ { MONO_MT_UINT32, "RVA" },
+ { MONO_MT_TABLE_IDX, "Field:Field" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable FileSchema [] = {
+ { MONO_MT_UINT32, "Flags" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_BLOB_IDX, "Value" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable ImplMapSchema [] = {
+ { MONO_MT_UINT16, "MappingFlag" },
+ { MONO_MT_MF_IDX, "MemberForwarded" },
+ { MONO_MT_STRING_IDX, "ImportName" },
+ { MONO_MT_TABLE_IDX, "ImportScope:ModuleRef" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable InterfaceImplSchema [] = {
+ { MONO_MT_TABLE_IDX, "Class:TypeDef" },
+ { MONO_MT_TDOR_IDX, "Interface=TypeDefOrRef" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable ManifestResourceSchema [] = {
+ { MONO_MT_UINT32, "Offset" },
+ { MONO_MT_UINT32, "Flags" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_IMPL_IDX, "Implementation" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable MemberRefSchema [] = {
+ { MONO_MT_MRP_IDX, "Class" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_BLOB_IDX, "Signature" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable MethodSchema [] = {
+ { MONO_MT_UINT32, "RVA" },
+ { MONO_MT_UINT16, "ImplFlags#MethodImplAttributes" },
+ { MONO_MT_UINT16, "Flags#MethodAttribute" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_BLOB_IDX, "Signature" },
+ { MONO_MT_TABLE_IDX, "ParamList:Param" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable MethodImplSchema [] = {
+ { MONO_MT_TABLE_IDX, "Class:TypeDef" },
+ { MONO_MT_MDOR_IDX, "MethodBody" },
+ { MONO_MT_MDOR_IDX, "MethodDeclaration" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable MethodSemanticsSchema [] = {
+ { MONO_MT_UINT16, "MethodSemantic" },
+ { MONO_MT_TABLE_IDX, "Method:Method" },
+ { MONO_MT_HS_IDX, "Association" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable ModuleSchema [] = {
+ { MONO_MT_UINT16, "Generation" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_GUID_IDX, "MVID" },
+ { MONO_MT_GUID_IDX, "EncID" },
+ { MONO_MT_GUID_IDX, "EncBaseID" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable ModuleRefSchema [] = {
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable NestedClassSchema [] = {
+ { MONO_MT_TABLE_IDX, "NestedClass:TypeDef" },
+ { MONO_MT_TABLE_IDX, "EnclosingClass:TypeDef" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable ParamSchema [] = {
+ { MONO_MT_UINT16, "Flags" },
+ { MONO_MT_UINT16, "Sequence" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable PropertySchema [] = {
+ { MONO_MT_UINT16, "Flags" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_BLOB_IDX, "Type" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable PropertyMapSchema [] = {
+ { MONO_MT_TABLE_IDX, "Parent:TypeDef" },
+ { MONO_MT_TABLE_IDX, "PropertyList:Property" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable StandaloneSigSchema [] = {
+ { MONO_MT_BLOB_IDX, "Signature" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable TypeDefSchema [] = {
+ { MONO_MT_UINT32, "Flags" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_STRING_IDX, "Namespace" },
+ { MONO_MT_TDOR_IDX, "Extends" },
+ { MONO_MT_TABLE_IDX, "FieldList:Field" },
+ { MONO_MT_TABLE_IDX, "MethodList:Method" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable TypeRefSchema [] = {
+ { MONO_MT_RS_IDX, "ResolutionScope=ResolutionScope" },
+ { MONO_MT_STRING_IDX, "Name" },
+ { MONO_MT_STRING_IDX, "Namespace" },
+ { MONO_MT_END, NULL }
+};
+
+static MonoMetaTable TypeSpecSchema [] = {
+ { MONO_MT_BLOB_IDX, "Signature" },
+ { MONO_MT_END, NULL }
+};
+
+static struct {
+ MonoMetaTable *table;
+ const char *name;
+} tables [] = {
+ /* 0 */ { ModuleSchema, "Module" },
+ /* 1 */ { TypeRefSchema, "TypeRef" },
+ /* 2 */ { TypeDefSchema, "TypeDef" },
+ /* 3 */ { NULL, NULL },
+ /* 4 */ { FieldSchema, "Field" },
+ /* 5 */ { NULL, NULL },
+ /* 6 */ { MethodSchema, "Method" },
+ /* 7 */ { NULL, NULL },
+ /* 8 */ { ParamSchema, "Param" },
+ /* 9 */ { InterfaceImplSchema, "InterfaceImpl" },
+ /* A */ { MemberRefSchema, "MemberRef" },
+ /* B */ { ConstantSchema, "Constant" },
+ /* C */ { CustomAttributeSchema, "CustomAttribute" },
+ /* D */ { FieldMarshalSchema, "FieldMarshal" },
+ /* E */ { DeclSecuritySchema, "DeclSecurity" },
+ /* F */ { ClassLayoutSchema, "ClassLayout" },
+ /* 10 */ { FieldLayoutSchema, "FieldLayout" },
+ /* 11 */ { StandaloneSigSchema, "StandaloneSig" },
+ /* 12 */ { EventMapSchema, "EventMap" },
+ /* 13 */ { NULL, NULL },
+ /* 14 */ { EventSchema, "Event" },
+ /* 15 */ { PropertyMapSchema, "PropertyMap" },
+ /* 16 */ { NULL, NULL },
+ /* 17 */ { PropertySchema, "PropertyTable" },
+ /* 18 */ { MethodSemanticsSchema, "MethodSemantics" },
+ /* 19 */ { MethodImplSchema, "MethodImpl" },
+ /* 1A */ { ModuleRefSchema, "ModuleRef" },
+ /* 1B */ { TypeSpecSchema, "TypeSpec" },
+ /* 1C */ { ImplMapSchema, "ImplMap" },
+ /* 1D */ { FieldRVASchema, "FieldRVA" },
+ /* 1E */ { NULL, NULL },
+ /* 1F */ { NULL, NULL },
+ /* 20 */ { AssemblySchema, "Assembly" },
+ /* 21 */ { AssemblyProcessorSchema, "AssemblyProcessor" },
+ /* 22 */ { AssemblyOSSchema, "AssemblyOS" },
+ /* 23 */ { AssemblyRefSchema, "AssemblyRef" },
+ /* 24 */ { AssemblyRefProcessorSchema, "AssemblyRefProcessor" },
+ /* 25 */ { AssemblyRefOSSchema, "AssemblyRefOS" },
+ /* 26 */ { FileSchema, "File" },
+ /* 27 */ { ExportedTypeSchema, "ExportedType" },
+ /* 28 */ { ManifestResourceSchema, "ManifestResource" },
+ /* 29 */ { NestedClassSchema, "NestedClass" },
+ /* 2A */ { NULL, NULL },
+ /* 2B */ { NULL, NULL },
+};
+
+/**
+ * mono_meta_table_name:
+ * @table: table index
+ *
+ * Returns the name for the @table index
+ */
+const char *
+mono_meta_table_name (int table)
+{
+ if ((table < 0) || (table > 0x29))
+ return "";
+
+ return tables [table].name;
+}
+
+/* The guy who wrote the spec for this should not be allowed near a
+ * computer again.
+
+If e is a coded token(see clause 23.1.7) that points into table ti out of n possible tables t0, .. tn-1,
+then it is stored as e << (log n) & tag{ t0, .. tn-1}[ ti] using 2 bytes if the maximum number of
+rows of tables t0, ..tn-1, is less than 2^16 - (log n), and using 4 bytes otherwise. The family of
+finite maps tag{ t0, ..tn-1} is defined below. Note that to decode a physical row, you need the
+inverse of this mapping.
+
+ */
+#define rtsize(s,b) (((s) < (1 << (b)) ? 2 : 4))
+#define idx_size(tableidx) (meta->tables [(tableidx)].rows < 65536 ? 2 : 4)
+
+/* Reference: Partition II - 23.2.6 */
+/*
+ * mono_metadata_compute_size:
+ * @meta: metadata context
+ * @tableindex: metadata table number
+ * @result_bitfield: pointer to guint32 where to store additional info
+ *
+ * mono_metadata_compute_size() computes the lenght in bytes of a single
+ * row in a metadata table. The size of each column is encoded in the
+ * @result_bitfield return value along with the number of columns in the table.
+ * the resulting bitfield should be handed to the mono_metadata_table_size()
+ * and mono_metadata_table_count() macros.
+ */
+int
+mono_metadata_compute_size (MonoImage *meta, int tableindex, guint32 *result_bitfield)
+{
+ guint32 bitfield = 0;
+ int size = 0, field_size;
+ int i, n, code;
+ int shift = 0;
+ MonoMetaTable *table = tables [tableindex].table;
+
+ for (i = 0; (code = table [i].code) != MONO_MT_END; i++){
+ switch (code){
+ case MONO_MT_UINT32:
+ field_size = 4; break;
+
+ case MONO_MT_UINT16:
+ field_size = 2; break;
+
+ case MONO_MT_UINT8:
+ field_size = 1; break;
+
+ case MONO_MT_BLOB_IDX:
+ field_size = meta->idx_blob_wide ? 4 : 2; break;
+
+ case MONO_MT_STRING_IDX:
+ field_size = meta->idx_string_wide ? 4 : 2; break;
+
+ case MONO_MT_GUID_IDX:
+ field_size = meta->idx_guid_wide ? 4 : 2; break;
+
+ case MONO_MT_TABLE_IDX:
+ /* Uhm, a table index can point to other tables besides the current one
+ * so, it's not correct to use the rowcount of the current table to
+ * get the size for this column - lupus
+ */
+ switch (tableindex) {
+ case MONO_TABLE_ASSEMBLYREFOS:
+ g_assert (i == 3);
+ field_size = idx_size (MONO_TABLE_ASSEMBLYREF); break;
+ case MONO_TABLE_ASSEMBLYPROCESSOR:
+ g_assert (i == 1);
+ field_size = idx_size (MONO_TABLE_ASSEMBLYREF); break;
+ case MONO_TABLE_CLASSLAYOUT:
+ g_assert (i == 2);
+ field_size = idx_size (MONO_TABLE_TYPEDEF); break;
+ case MONO_TABLE_EVENTMAP:
+ g_assert (i == 0 || i == 1);
+ field_size = i ? idx_size (MONO_TABLE_EVENT):
+ idx_size(MONO_TABLE_TYPEDEF);
+ break;
+ case MONO_TABLE_EVENT:
+ g_assert (i == 2);
+ field_size = MAX (idx_size (MONO_TABLE_TYPEDEF), idx_size(MONO_TABLE_TYPEREF));
+ field_size = MAX (field_size, idx_size(MONO_TABLE_TYPESPEC));
+ break;
+ case MONO_TABLE_EXPORTEDTYPE:
+ g_assert (i == 1);
+ field_size = idx_size (MONO_TABLE_TYPEDEF); break;
+ case MONO_TABLE_FIELDLAYOUT:
+ g_assert (i == 1);
+ field_size = idx_size (MONO_TABLE_FIELD); break;
+ case MONO_TABLE_FIELDRVA:
+ g_assert (i == 1);
+ field_size = idx_size (MONO_TABLE_FIELD); break;
+ case MONO_TABLE_IMPLMAP:
+ g_assert (i == 3);
+ field_size = idx_size (MONO_TABLE_MODULEREF); break;
+ case MONO_TABLE_INTERFACEIMPL:
+ g_assert (i == 0);
+ field_size = idx_size (MONO_TABLE_TYPEDEF); break;
+ case MONO_TABLE_METHOD:
+ g_assert (i == 5);
+ field_size = idx_size (MONO_TABLE_PARAM); break;
+ case MONO_TABLE_METHODIMPL:
+ g_assert (i == 0);
+ field_size = idx_size (MONO_TABLE_TYPEDEF); break;
+ case MONO_TABLE_METHODSEMANTICS:
+ g_assert (i == 1);
+ field_size = idx_size (MONO_TABLE_METHOD); break;
+ case MONO_TABLE_NESTEDCLASS:
+ g_assert (i == 0 || i == 1);
+ field_size = idx_size (MONO_TABLE_TYPEDEF); break;
+ case MONO_TABLE_PROPERTYMAP:
+ g_assert (i == 0 || i == 1);
+ field_size = i ? idx_size (MONO_TABLE_PROPERTY):
+ idx_size(MONO_TABLE_TYPEDEF);
+ break;
+ case MONO_TABLE_TYPEDEF:
+ g_assert (i == 4 || i == 5);
+ field_size = i == 4 ? idx_size (MONO_TABLE_FIELD):
+ idx_size(MONO_TABLE_METHOD);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ if (field_size != idx_size (tableindex))
+ g_warning ("size changed (%d to %d)", idx_size (tableindex), field_size);
+
+ break;
+
+ /*
+ * HasConstant: ParamDef, FieldDef, Property
+ */
+ case MONO_MT_CONST_IDX:
+ n = MAX (meta->tables [MONO_TABLE_PARAM].rows,
+ meta->tables [MONO_TABLE_FIELD].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_PROPERTY].rows);
+
+ /* 2 bits to encode tag */
+ field_size = rtsize (n, 16-2);
+ break;
+
+ /*
+ * HasCustomAttribute: points to any table but
+ * itself.
+ */
+ case MONO_MT_HASCAT_IDX:
+ /*
+ * We believe that since the signature and
+ * permission are indexing the Blob heap,
+ * we should consider the blob size first
+ */
+ /* I'm not a believer - lupus
+ if (meta->idx_blob_wide){
+ field_size = 4;
+ break;
+ }*/
+
+ n = MAX (meta->tables [MONO_TABLE_METHOD].rows,
+ meta->tables [MONO_TABLE_FIELD].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_TYPEREF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_TYPEDEF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_PARAM].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_INTERFACEIMPL].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_MEMBERREF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_MODULE].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_DECLSECURITY].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_PROPERTY].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_EVENT].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_STANDALONESIG].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_MODULEREF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_TYPESPEC].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_ASSEMBLY].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_ASSEMBLYREF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_FILE].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_EXPORTEDTYPE].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_MANIFESTRESOURCE].rows);
+
+ /* 5 bits to encode */
+ field_size = rtsize (n, 16-5);
+ break;
+
+ /*
+ * CustomAttributeType: TypeDef, TypeRef, MethodDef,
+ * MemberRef and String.
+ */
+ case MONO_MT_CAT_IDX:
+ /* String is a heap, if it is wide, we know the size */
+ /* See above, nope.
+ if (meta->idx_string_wide){
+ field_size = 4;
+ break;
+ }*/
+
+ n = MAX (meta->tables [MONO_TABLE_TYPEREF].rows,
+ meta->tables [MONO_TABLE_TYPEDEF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_METHOD].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_MEMBERREF].rows);
+
+ /* 3 bits to encode */
+ field_size = rtsize (n, 16-3);
+ break;
+
+ /*
+ * HasDeclSecurity: Typedef, MethodDef, Assembly
+ */
+ case MONO_MT_HASDEC_IDX:
+ n = MAX (meta->tables [MONO_TABLE_TYPEDEF].rows,
+ meta->tables [MONO_TABLE_METHOD].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_ASSEMBLY].rows);
+
+ /* 2 bits to encode */
+ field_size = rtsize (n, 16-2);
+ break;
+
+ /*
+ * Implementation: File, AssemblyRef, ExportedType
+ */
+ case MONO_MT_IMPL_IDX:
+ n = MAX (meta->tables [MONO_TABLE_FILE].rows,
+ meta->tables [MONO_TABLE_ASSEMBLYREF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_EXPORTEDTYPE].rows);
+
+ /* 2 bits to encode tag */
+ field_size = rtsize (n, 16-2);
+ break;
+
+ /*
+ * HasFieldMarshall: FieldDef, ParamDef
+ */
+ case MONO_MT_HFM_IDX:
+ n = MAX (meta->tables [MONO_TABLE_FIELD].rows,
+ meta->tables [MONO_TABLE_PARAM].rows);
+
+ /* 1 bit used to encode tag */
+ field_size = rtsize (n, 16-1);
+ break;
+
+ /*
+ * MemberForwarded: FieldDef, MethodDef
+ */
+ case MONO_MT_MF_IDX:
+ n = MAX (meta->tables [MONO_TABLE_FIELD].rows,
+ meta->tables [MONO_TABLE_METHOD].rows);
+
+ /* 1 bit used to encode tag */
+ field_size = rtsize (n, 16-1);
+ break;
+
+ /*
+ * TypeDefOrRef: TypeDef, ParamDef, TypeSpec
+ * LAMESPEC
+ * It is TypeDef, _TypeRef_, TypeSpec, instead.
+ */
+ case MONO_MT_TDOR_IDX:
+ n = MAX (meta->tables [MONO_TABLE_TYPEDEF].rows,
+ meta->tables [MONO_TABLE_TYPEREF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_TYPESPEC].rows);
+
+ /* 2 bits to encode */
+ field_size = rtsize (n, 16-2);
+ break;
+
+ /*
+ * MemberRefParent: TypeDef, TypeRef, MethodDef, ModuleRef, TypeSpec, MemberRef
+ */
+ case MONO_MT_MRP_IDX:
+ n = MAX (meta->tables [MONO_TABLE_TYPEDEF].rows,
+ meta->tables [MONO_TABLE_TYPEREF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_METHOD].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_MODULEREF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_TYPESPEC].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_MEMBERREF].rows);
+
+ /* 3 bits to encode */
+ field_size = rtsize (n, 16 - 3);
+ break;
+
+ case MONO_MT_MDOR_IDX:
+
+ /*
+ * MethodDefOrRef: MethodDef, MemberRef
+ */
+ case MONO_MT_HS_IDX:
+ n = MAX (meta->tables [MONO_TABLE_METHOD].rows,
+ meta->tables [MONO_TABLE_MEMBERREF].rows);
+
+ /* 1 bit used to encode tag */
+ field_size = rtsize (n, 16-1);
+ break;
+
+ /*
+ * ResolutionScope: Module, ModuleRef, AssemblyRef, TypeRef
+ */
+ case MONO_MT_RS_IDX:
+ n = MAX (meta->tables [MONO_TABLE_MODULE].rows,
+ meta->tables [MONO_TABLE_MODULEREF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_ASSEMBLYREF].rows);
+ n = MAX (n, meta->tables [MONO_TABLE_TYPEREF].rows);
+
+ /* 2 bits used to encode tag (ECMA spec claims 3) */
+ field_size = rtsize (n, 16 - 2);
+ break;
+ }
+
+ /*
+ * encode field size as follows (we just need to
+ * distinguish them).
+ *
+ * 4 -> 3
+ * 2 -> 1
+ * 1 -> 0
+ */
+ bitfield |= (field_size-1) << shift;
+ shift += 2;
+ size += field_size;
+ /*g_print ("table %02x field %d size %d\n", tableindex, i, field_size);*/
+ }
+
+ *result_bitfield = (i << 24) | bitfield;
+ return size;
+}
+
+/**
+ * mono_metadata_compute_table_bases:
+ * @meta: metadata context to compute table values
+ *
+ * Computes the table bases for the metadata structure.
+ * This is an internal function used by the image loader code.
+ */
+void
+mono_metadata_compute_table_bases (MonoImage *meta)
+{
+ int i;
+ const char *base = meta->tables_base;
+
+ for (i = 0; i < 64; i++){
+ if (meta->tables [i].rows == 0)
+ continue;
+
+ meta->tables [i].row_size = mono_metadata_compute_size (
+ meta, i, &meta->tables [i].size_bitfield);
+ meta->tables [i].base = base;
+ base += meta->tables [i].rows * meta->tables [i].row_size;
+ }
+}
+
+/**
+ * mono_metadata_locate:
+ * @meta: metadata context
+ * @table: table code.
+ * @idx: index of element to retrieve from @table.
+ *
+ * Returns a pointer to the @idx element in the metadata table
+ * whose code is @table.
+ */
+const char *
+mono_metadata_locate (MonoImage *meta, int table, int idx)
+{
+ /* idx == 0 refers always to NULL */
+ g_return_val_if_fail (idx > 0 && idx <= meta->tables [table].rows, "");
+
+ return meta->tables [table].base + (meta->tables [table].row_size * (idx - 1));
+}
+
+/**
+ * mono_metadata_locate_token:
+ * @meta: metadata context
+ * @token: metadata token
+ *
+ * Returns a pointer to the data in the metadata represented by the
+ * token #token.
+ */
+const char *
+mono_metadata_locate_token (MonoImage *meta, guint32 token)
+{
+ return mono_metadata_locate (meta, token >> 24, token & 0xffffff);
+}
+
+/**
+ * mono_metadata_get_table:
+ * @table: table to retrieve
+ *
+ * Returns the MonoMetaTable structure for table @table
+ */
+MonoMetaTable *
+mono_metadata_get_table (MonoMetaTableEnum table)
+{
+ int x = (int) table;
+
+ g_return_val_if_fail ((x > 0) && (x <= MONO_TABLE_LAST), NULL);
+
+ return tables [table].table;
+}
+
+/**
+ * mono_metadata_string_heap:
+ * @meta: metadata context
+ * @index: index into the string heap.
+ *
+ * Returns: an in-memory pointer to the @index in the string heap.
+ */
+const char *
+mono_metadata_string_heap (MonoImage *meta, guint32 index)
+{
+ g_return_val_if_fail (index < meta->heap_strings.size, "");
+ return meta->heap_strings.data + index;
+}
+
+/**
+ * mono_metadata_user_string:
+ * @meta: metadata context
+ * @index: index into the user string heap.
+ *
+ * Returns: an in-memory pointer to the @index in the user string heap ("#US").
+ */
+const char *
+mono_metadata_user_string (MonoImage *meta, guint32 index)
+{
+ g_return_val_if_fail (index < meta->heap_us.size, "");
+ return meta->heap_us.data + index;
+}
+
+/**
+ * mono_metadata_blob_heap:
+ * @meta: metadata context
+ * @index: index into the blob.
+ *
+ * Returns: an in-memory pointer to the @index in the Blob heap.
+ */
+const char *
+mono_metadata_blob_heap (MonoImage *meta, guint32 index)
+{
+ g_return_val_if_fail (index < meta->heap_blob.size, "");
+ return meta->heap_blob.data + index;
+}
+
+/**
+ * mono_metadata_guid_heap:
+ * @meta: metadata context
+ * @index: index into the guid heap.
+ *
+ * Returns: an in-memory pointer to the @index in the guid heap.
+ */
+const char *
+mono_metadata_guid_heap (MonoImage *meta, guint32 index)
+{
+ --index;
+ index *= 16; /* adjust for guid size and 1-based index */
+ g_return_val_if_fail (index < meta->heap_guid.size, "");
+ return meta->heap_guid.data + index;
+}
+
+static const char *
+dword_align (const char *ptr)
+{
+ return (const char *) (((guint32) (ptr + 3)) & ~3);
+}
+
+/**
+ * mono_metadata_decode_row:
+ * @t: table to extract information from.
+ * @idx: index in table.
+ * @res: array of @res_size cols to store the results in
+ *
+ * This decompresses the metadata element @idx in table @t
+ * into the guint32 @res array that has res_size elements
+ */
+void
+mono_metadata_decode_row (MonoTableInfo *t, int idx, guint32 *res, int res_size)
+{
+ guint32 bitfield = t->size_bitfield;
+ int i, count = mono_metadata_table_count (bitfield);
+ const char *data = t->base + idx * t->row_size;
+
+ g_assert (res_size == count);
+
+ for (i = 0; i < count; i++){
+ int n = mono_metadata_table_size (bitfield, i);
+
+ switch (n){
+ case 1:
+ res [i] = *data; break;
+ case 2:
+ res [i] = read16 (data); break;
+
+ case 4:
+ res [i] = read32 (data); break;
+
+ default:
+ g_assert_not_reached ();
+ }
+ data += n;
+ }
+}
+
+/**
+ * mono_metadata_decode_row_col:
+ * @t: table to extract information from.
+ * @idx: index for row in table.
+ * @col: column in the row.
+ *
+ * This function returns the value of column @col from the @idx
+ * row in the table @t.
+ */
+guint32
+mono_metadata_decode_row_col (MonoTableInfo *t, int idx, guint col)
+{
+ guint32 bitfield = t->size_bitfield;
+ int i;
+ register const char *data = t->base + idx * t->row_size;
+ register int n;
+
+ g_assert (col < mono_metadata_table_count (bitfield));
+
+ n = mono_metadata_table_size (bitfield, 0);
+ for (i = 0; i < col; ++i) {
+ data += n;
+ n = mono_metadata_table_size (bitfield, i + 1);
+ }
+ switch (n){
+ case 1:
+ return *data;
+ case 2:
+ return read16 (data);
+ case 4:
+ return read32 (data);
+ default:
+ g_assert_not_reached ();
+ }
+ return 0;
+}
+/**
+ * mono_metadata_decode_blob_size:
+ * @ptr: pointer to a blob object
+ * @rptr: the new position of the pointer
+ *
+ * This decodes a compressed size as described by 23.1.4 (a blob or user string object)
+ *
+ * Returns: the size of the blob object
+ */
+guint32
+mono_metadata_decode_blob_size (const char *xptr, const char **rptr)
+{
+ const unsigned char *ptr = (const unsigned char *)xptr;
+ guint32 size;
+
+ if ((*ptr & 0x80) == 0){
+ size = ptr [0] & 0x7f;
+ ptr++;
+ } else if ((*ptr & 0x40) == 0){
+ size = ((ptr [0] & 0x3f) << 8) + ptr [1];
+ ptr += 2;
+ } else {
+ size = ((ptr [0] & 0x1f) << 24) +
+ (ptr [1] << 16) +
+ (ptr [2] << 8) +
+ ptr [3];
+ ptr += 4;
+ }
+ if (rptr)
+ *rptr = ptr;
+ return size;
+}
+
+
+/**
+ * mono_metadata_decode_value:
+ * @ptr: pointer to decode from
+ * @rptr: the new position of the pointer
+ *
+ * This routine decompresses 32-bit values as specified in the "Blob and
+ * Signature" section (22.2)
+ *
+ * Returns: the decoded value
+ */
+guint32
+mono_metadata_decode_value (const char *_ptr, const char **rptr)
+{
+ const unsigned char *ptr = (const unsigned char *) _ptr;
+ unsigned char b = *ptr;
+ guint32 len;
+
+ if ((b & 0x80) == 0){
+ len = b;
+ ++ptr;
+ } else if ((b & 0x40) == 0){
+ len = ((b & 0x3f) << 8 | ptr [1]);
+ ptr += 2;
+ } else {
+ len = ((b & 0x1f) << 24) |
+ (ptr [1] << 16) |
+ (ptr [2] << 8) |
+ ptr [3];
+ ptr += 4;
+ }
+ if (rptr)
+ *rptr = ptr;
+
+ return len;
+}
+
+/*
+ * mono_metadata_parse_typedef_or_ref:
+ * @m: a metadata context.
+ * @ptr: a pointer to an encoded TypedefOrRef in @m
+ * @rptr: pointer updated to match the end of the decoded stream
+ *
+ * Returns: a token valid in the @m metadata decoded from
+ * the compressed representation.
+ */
+guint32
+mono_metadata_parse_typedef_or_ref (MonoImage *m, const char *ptr, const char **rptr)
+{
+ guint32 token;
+ token = mono_metadata_decode_value (ptr, &ptr);
+ if (rptr)
+ *rptr = ptr;
+ return mono_metadata_token_from_dor (token);
+}
+
+/*
+ * mono_metadata_parse_custom_mod:
+ * @m: a metadata context.
+ * @dest: storage where the info about the custom modifier is stored (may be NULL)
+ * @ptr: a pointer to (possibly) the start of a custom modifier list
+ * @rptr: pointer updated to match the end of the decoded stream
+ *
+ * Checks if @ptr points to a type custom modifier compressed representation.
+ *
+ * Returns: #TRUE if a custom modifier was found, #FALSE if not.
+ */
+int
+mono_metadata_parse_custom_mod (MonoImage *m, MonoCustomMod *dest, const char *ptr, const char **rptr)
+{
+ MonoCustomMod local;
+ if ((*ptr == MONO_TYPE_CMOD_OPT) ||
+ (*ptr == MONO_TYPE_CMOD_REQD)) {
+ if (!dest)
+ dest = &local;
+ dest->required = *ptr == MONO_TYPE_CMOD_REQD ? 1 : 0;
+ dest->token = mono_metadata_parse_typedef_or_ref (m, ptr + 1, &ptr);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*
+ * mono_metadata_parse_array:
+ * @m: a metadata context.
+ * @ptr: a pointer to an encoded array description.
+ * @rptr: pointer updated to match the end of the decoded stream
+ *
+ * Decodes the compressed array description found in the metadata @m at @ptr.
+ *
+ * Returns: a #MonoArrayType structure describing the array type
+ * and dimensions.
+ */
+MonoArrayType *
+mono_metadata_parse_array (MonoImage *m, const char *ptr, const char **rptr)
+{
+ int i;
+ MonoArrayType *array = g_new0 (MonoArrayType, 1);
+
+ array->type = mono_metadata_parse_type (m, MONO_PARSE_TYPE, 0, ptr, &ptr);
+ array->rank = mono_metadata_decode_value (ptr, &ptr);
+
+ array->numsizes = mono_metadata_decode_value (ptr, &ptr);
+ if (array->numsizes)
+ array->sizes = g_new0 (int, array->numsizes);
+ for (i = 0; i < array->numsizes; ++i)
+ array->sizes [i] = mono_metadata_decode_value (ptr, &ptr);
+
+ array->numlobounds = mono_metadata_decode_value (ptr, &ptr);
+ if (array->numlobounds)
+ array->lobounds = g_new0 (int, array->numlobounds);
+ for (i = 0; i < array->numlobounds; ++i)
+ array->lobounds [i] = mono_metadata_decode_value (ptr, &ptr);
+
+ if (rptr)
+ *rptr = ptr;
+ return array;
+}
+
+/*
+ * mono_metadata_free_array:
+ * @array: array description
+ *
+ * Frees the array description returned from mono_metadata_parse_array().
+ */
+void
+mono_metadata_free_array (MonoArrayType *array)
+{
+ mono_metadata_free_type (array->type);
+ g_free (array->sizes);
+ g_free (array->lobounds);
+ g_free (array);
+}
+
+/*
+ * need to add common field and param attributes combinations:
+ * [out] param
+ * public static
+ * public static literal
+ * private
+ * private static
+ * private static literal
+ */
+static MonoType
+builtin_types[] = {
+ /* data, attrs, type, nmods, byref, pinned */
+ {{NULL}, 0, MONO_TYPE_VOID, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_BOOLEAN, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_BOOLEAN, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_CHAR, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_CHAR, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_I1, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_I1, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_U1, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_U1, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_I2, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_I2, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_U2, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_U2, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_I4, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_I4, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_U4, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_U4, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_I8, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_I8, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_U8, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_U8, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_R4, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_R4, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_R8, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_R8, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_STRING, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_STRING, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_TYPEDBYREF, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_I, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_I, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_U, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_U, 0, 1, 0},
+ {{NULL}, 0, MONO_TYPE_OBJECT, 0, 0, 0},
+ {{NULL}, 0, MONO_TYPE_OBJECT, 0, 1, 0}
+};
+
+#define NBUILTIN_TYPES() (sizeof (builtin_types) / sizeof (builtin_types [0]))
+
+static GHashTable *type_cache = NULL;
+
+/*
+ * MonoTypes with modifies are never cached, so we never check or use that field.
+ */
+static guint
+mono_type_hash (gconstpointer data)
+{
+ const MonoType *type = (const MonoType *) data;
+ return type->type | (type->byref << 8) | (type->attrs << 9);
+}
+
+static gint
+mono_type_equal (gconstpointer ka, gconstpointer kb)
+{
+ const MonoType *a = (const MonoType *) ka;
+ const MonoType *b = (const MonoType *) kb;
+
+ if (a->type != b->type || a->byref != b->byref || a->attrs != b->attrs || a->pinned != b->pinned)
+ return 0;
+ /* need other checks */
+ return 1;
+}
+
+/*
+ * mono_metadata_parse_type:
+ * @m: metadata context
+ * @mode: king of type that may be found at @ptr
+ * @opt_attrs: optional attributes to store in the returned type
+ * @ptr: pointer to the type representation
+ * @rptr: pointer updated to match the end of the decoded stream
+ *
+ * Decode a compressed type description found at @ptr in @m.
+ * @mode can be one of MONO_PARSE_MOD_TYPE, MONO_PARSE_PARAM, MONO_PARSE_RET,
+ * MONO_PARSE_FIELD, MONO_PARSE_LOCAL, MONO_PARSE_TYPE.
+ * This function can be used to decode type descriptions in method signatures,
+ * field signatures, locals signatures etc.
+ *
+ * Returns: a #MonoType structure representing the decoded type.
+ */
+MonoType*
+mono_metadata_parse_type (MonoImage *m, MonoParseTypeMode mode, short opt_attrs, const char *ptr, const char **rptr)
+{
+ MonoType *type, *cached;
+
+ if (!type_cache) {
+ int i;
+ type_cache = g_hash_table_new (mono_type_hash, mono_type_equal);
+
+ for (i = 0; i < NBUILTIN_TYPES (); ++i)
+ g_hash_table_insert (type_cache, &builtin_types [i], &builtin_types [i]);
+ }
+
+ switch (mode) {
+ case MONO_PARSE_MOD_TYPE:
+ case MONO_PARSE_PARAM:
+ case MONO_PARSE_RET:
+ case MONO_PARSE_FIELD: {
+ /* count the modifiers */
+ const char *tmp_ptr = ptr;
+ int count = 0;
+ while (mono_metadata_parse_custom_mod (m, NULL, tmp_ptr, &tmp_ptr))
+ count++;
+ if (count) {
+ type = g_malloc0 (sizeof (MonoType) + (count - MONO_ZERO_LEN_ARRAY) * sizeof (MonoCustomMod));
+ type->num_mods = count;
+ if (count > 64)
+ g_warning ("got more than 64 modifiers in type");
+ /* save them this time */
+ count = 0;
+ while (mono_metadata_parse_custom_mod (m, &(type->modifiers [count]), ptr, &ptr))
+ count++;
+ break;
+ } /* fall through */
+ }
+ case MONO_PARSE_LOCAL:
+ case MONO_PARSE_TYPE:
+ /*
+ * Later we can avoid doing this allocation.
+ */
+ type = g_new0 (MonoType, 1);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ type->attrs = opt_attrs;
+ if (mode == MONO_PARSE_LOCAL) {
+ /*
+ * check for pinned flag
+ */
+ if (*ptr == MONO_TYPE_PINNED) {
+ type->pinned = 1;
+ ++ptr;
+ }
+ }
+
+ switch (*ptr) {
+ case MONO_TYPE_BYREF:
+ if (mode == MONO_PARSE_FIELD)
+ g_warning ("A field type cannot be byref");
+ type->byref = 1;
+ ptr++;
+ /* follow through */
+ default:
+ /*if (*ptr == MONO_TYPE_VOID && mode != MONO_PARSE_RET)
+ g_error ("void not allowed in param");*/
+ do_mono_metadata_parse_type (type, m, ptr, &ptr);
+ break;
+ }
+ if (rptr)
+ *rptr = ptr;
+ if (mode != MONO_PARSE_PARAM && !type->num_mods && (cached = g_hash_table_lookup (type_cache, type))) {
+ mono_metadata_free_type (type);
+ return cached;
+ } else {
+ return type;
+ }
+}
+
+/*
+ * mono_metadata_parse_method_signature:
+ * @m: metadata context
+ * @def: use #TRUE when parsing MethodDef, #FALSE with MethodRef signatures.
+ * @ptr: pointer to the signature metadata representation
+ * @rptr: pointer updated to match the end of the decoded stream
+ *
+ * Decode a method signature stored at @ptr.
+ *
+ * Returns: a MonoMethodSignature describing the signature.
+ */
+MonoMethodSignature *
+mono_metadata_parse_method_signature (MonoImage *m, int def, const char *ptr, const char **rptr)
+{
+ MonoMethodSignature *method;
+ int i;
+ guint32 hasthis = 0, explicit_this = 0, call_convention, param_count;
+
+ if (*ptr & 0x20)
+ hasthis = 1;
+ if (*ptr & 0x40)
+ explicit_this = 1;
+ call_convention = *ptr & 0x0F;
+ ptr++;
+ param_count = mono_metadata_decode_value (ptr, &ptr);
+
+ method = g_malloc0 (sizeof (MonoMethodSignature) + (param_count - MONO_ZERO_LEN_ARRAY) * sizeof (MonoType*));
+ method->param_count = param_count;
+ method->hasthis = hasthis;
+ method->explicit_this = explicit_this;
+ method->call_convention = call_convention;
+ method->ret = mono_metadata_parse_type (m, MONO_PARSE_RET, 0, ptr, &ptr);
+
+ if (method->param_count) {
+ method->sentinelpos = -1;
+
+ for (i = 0; i < method->param_count; ++i) {
+ if (*ptr == MONO_TYPE_SENTINEL) {
+ if (method->call_convention != MONO_CALL_VARARG || def)
+ g_error ("found sentinel for methoddef or no vararg method");
+ method->sentinelpos = i;
+ ptr++;
+ }
+ method->params [i] = mono_metadata_parse_type (m, MONO_PARSE_PARAM, 0, ptr, &ptr);
+ }
+ }
+
+ if (rptr)
+ *rptr = ptr;
+ /*
+ * Add signature to a cache and increase ref count...
+ */
+ return method;
+}
+
+/*
+ * mono_metadata_free_method_signature:
+ * @sig: signature to destroy
+ *
+ * Free the memory allocated in the signature @sig.
+ */
+void
+mono_metadata_free_method_signature (MonoMethodSignature *sig)
+{
+ int i;
+ mono_metadata_free_type (sig->ret);
+ for (i = 0; i < sig->param_count; ++i)
+ mono_metadata_free_type (sig->params [i]);
+
+ g_free (sig);
+}
+
+/*
+ * do_mono_metadata_parse_type:
+ * @type: MonoType to be filled in with the return value
+ * @
+ * Internal routine used to "fill" the contents of @type from an
+ * allocated pointer. This is done this way to avoid doing too
+ * many mini-allocations (particularly for the MonoFieldType which
+ * most of the time is just a MonoType, but sometimes might be augmented).
+ *
+ * This routine is used by mono_metadata_parse_type and
+ * mono_metadata_parse_field_type
+ *
+ * This extracts a Type as specified in Partition II (22.2.12)
+ */
+static void
+do_mono_metadata_parse_type (MonoType *type, MonoImage *m, const char *ptr, const char **rptr)
+{
+ type->type = mono_metadata_decode_value (ptr, &ptr);
+
+ switch (type->type){
+ case MONO_TYPE_VOID:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_TYPEDBYREF:
+ break;
+ case MONO_TYPE_VALUETYPE:
+ case MONO_TYPE_CLASS: {
+ guint32 token;
+ token = mono_metadata_parse_typedef_or_ref (m, ptr, &ptr);
+ type->data.klass = mono_class_get (m, token);
+ break;
+ }
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_PTR:
+ type->data.type = mono_metadata_parse_type (m, MONO_PARSE_MOD_TYPE, 0, ptr, &ptr);
+ break;
+ case MONO_TYPE_FNPTR:
+ type->data.method = mono_metadata_parse_method_signature (m, 0, ptr, &ptr);
+ break;
+ case MONO_TYPE_ARRAY:
+ type->data.array = mono_metadata_parse_array (m, ptr, &ptr);
+ break;
+ default:
+ g_error ("type 0x%02x not handled in mono_metadata_parse_type", type->type);
+ }
+
+ if (rptr)
+ *rptr = ptr;
+}
+
+/*
+ * mono_metadata_free_type:
+ * @type: type to free
+ *
+ * Free the memory allocated for type @type.
+ */
+void
+mono_metadata_free_type (MonoType *type)
+{
+ if (type >= builtin_types && type < builtin_types + NBUILTIN_TYPES ())
+ return;
+ switch (type->type){
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_PTR:
+ mono_metadata_free_type (type->data.type);
+ break;
+ case MONO_TYPE_FNPTR:
+ mono_metadata_free_method_signature (type->data.method);
+ break;
+ case MONO_TYPE_ARRAY:
+ mono_metadata_free_array (type->data.array);
+ break;
+ }
+ g_free (type);
+}
+
+#if 0
+static void
+hex_dump (const char *buffer, int base, int count)
+{
+ int show_header = 1;
+ int i;
+
+ if (count < 0){
+ count = -count;
+ show_header = 0;
+ }
+
+ for (i = 0; i < count; i++){
+ if (show_header)
+ if ((i % 16) == 0)
+ printf ("\n0x%08x: ", (unsigned char) base + i);
+
+ printf ("%02x ", (unsigned char) (buffer [i]));
+ }
+ fflush (stdout);
+}
+#endif
+
+/**
+ * @mh: The Method header
+ * @ptr: Points to the beginning of the Section Data (25.3)
+ */
+static void
+parse_section_data (MonoMethodHeader *mh, const unsigned char *ptr)
+{
+ unsigned char sect_data_flags;
+ const unsigned char *sptr;
+ int is_fat;
+ guint32 sect_data_len;
+
+ while (1) {
+ /* align on 32-bit boundary */
+ /* FIXME: not 64-bit clean code */
+ sptr = ptr = dword_align (ptr);
+ sect_data_flags = *ptr;
+ ptr++;
+
+ is_fat = sect_data_flags & METHOD_HEADER_SECTION_FAT_FORMAT;
+ if (is_fat) {
+ sect_data_len = (ptr [2] << 16) | (ptr [1] << 8) | ptr [0];
+ ptr += 3;
+ } else {
+ sect_data_len = ptr [0];
+ ++ptr;
+ }
+ /*
+ g_print ("flags: %02x, len: %d\n", sect_data_flags, sect_data_len);
+ hex_dump (sptr, 0, sect_data_len+8);
+ g_print ("\nheader: ");
+ hex_dump (sptr-4, 0, 4);
+ g_print ("\n");
+ */
+
+ if (sect_data_flags & METHOD_HEADER_SECTION_EHTABLE) {
+ const unsigned char *p = dword_align (ptr);
+ int i;
+ mh->num_clauses = is_fat ? sect_data_len / 24: sect_data_len / 12;
+ /* we could just store a pointer if we don't need to byteswap */
+ mh->clauses = g_new0 (MonoExceptionClause, mh->num_clauses);
+ for (i = 0; i < mh->num_clauses; ++i) {
+ MonoExceptionClause *ec = &mh->clauses [i];
+
+ if (is_fat) {
+ /* we could memcpy and byteswap */
+ ec->flags = read32 (p);
+ p += 4;
+ ec->try_offset = read32 (p);
+ p += 4;
+ ec->try_len = read32 (p);
+ p += 4;
+ ec->handler_offset = read32 (p);
+ p += 4;
+ ec->handler_len = read32 (p);
+ p += 4;
+ ec->token_or_filter = read32 (p);
+ p += 4;
+ } else {
+ ec->flags = read16 (p);
+ p += 2;
+ ec->try_offset = read16 (p);
+ p += 2;
+ ec->try_len = *p;
+ ++p;
+ ec->handler_offset = read16 (p);
+ p += 2;
+ ec->handler_len = *p;
+ ++p;
+ ec->token_or_filter = read32 (p);
+ p += 4;
+ }
+ /* g_print ("try %d: %x %04x-%04x %04x\n", i, ec->flags, ec->try_offset, ec->try_offset+ec->try_len, ec->try_len); */
+ }
+
+ }
+ if (sect_data_flags & METHOD_HEADER_SECTION_MORE_SECTS)
+ ptr += sect_data_len - 4; /* LAMESPEC: it seems the size includes the header */
+ else
+ return;
+ }
+}
+
+/*
+ * mono_metadata_parse_mh:
+ * @m: metadata context
+ * @ptr: pointer to the method header.
+ *
+ * Decode the method header at @ptr, including pointer to the IL code,
+ * info about local variables and optional exception tables.
+ *
+ * Returns: a MonoMethodHeader.
+ */
+MonoMethodHeader *
+mono_metadata_parse_mh (MonoImage *m, const char *ptr)
+{
+ MonoMethodHeader *mh;
+ unsigned char flags = *(const unsigned char *) ptr;
+ unsigned char format = flags & METHOD_HEADER_FORMAT_MASK;
+ guint16 fat_flags;
+ guint32 local_var_sig_tok, max_stack, code_size, init_locals;
+ const unsigned char *code;
+ int hsize;
+
+ g_return_val_if_fail (ptr != NULL, NULL);
+
+ switch (format){
+ case METHOD_HEADER_TINY_FORMAT:
+ mh = g_new0 (MonoMethodHeader, 1);
+ ptr++;
+ mh->max_stack = 8;
+ local_var_sig_tok = 0;
+ mh->code_size = flags >> 2;
+ mh->code = ptr;
+ return mh;
+ case METHOD_HEADER_TINY_FORMAT1:
+ mh = g_new0 (MonoMethodHeader, 1);
+ ptr++;
+ mh->max_stack = 8;
+ local_var_sig_tok = 0;
+
+ /*
+ * The spec claims 3 bits, but the Beta2 is
+ * incorrect
+ */
+ mh->code_size = flags >> 2;
+ mh->code = ptr;
+ return mh;
+ case METHOD_HEADER_FAT_FORMAT:
+ fat_flags = read16 (ptr);
+ ptr += 2;
+ hsize = (fat_flags >> 12) & 0xf;
+ max_stack = read16 (ptr);
+ ptr += 2;
+ code_size = read32 (ptr);
+ ptr += 4;
+ local_var_sig_tok = read32 (ptr);
+ ptr += 4;
+
+ if (fat_flags & METHOD_HEADER_INIT_LOCALS)
+ init_locals = 1;
+ else
+ init_locals = 0;
+
+ code = ptr;
+
+ if (!(fat_flags & METHOD_HEADER_MORE_SECTS))
+ break;
+
+ /*
+ * There are more sections
+ */
+ ptr = code + code_size;
+
+ break;
+
+ default:
+ return NULL;
+ }
+
+ if (local_var_sig_tok) {
+ MonoTableInfo *t = &m->tables [MONO_TABLE_STANDALONESIG];
+ const char *locals_ptr;
+ guint32 cols [MONO_STAND_ALONE_SIGNATURE_SIZE];
+ int len=0, i, bsize;
+
+ mono_metadata_decode_row (t, (local_var_sig_tok & 0xffffff)-1, cols, 1);
+ locals_ptr = mono_metadata_blob_heap (m, cols [MONO_STAND_ALONE_SIGNATURE]);
+ bsize = mono_metadata_decode_blob_size (locals_ptr, &locals_ptr);
+ if (*locals_ptr != 0x07)
+ g_warning ("wrong signature for locals blob");
+ locals_ptr++;
+ len = mono_metadata_decode_value (locals_ptr, &locals_ptr);
+ mh = g_malloc0 (sizeof (MonoMethodHeader) + (len - MONO_ZERO_LEN_ARRAY) * sizeof (MonoType*));
+ mh->num_locals = len;
+ for (i = 0; i < len; ++i)
+ mh->locals [i] = mono_metadata_parse_type (m, MONO_PARSE_LOCAL, 0, locals_ptr, &locals_ptr);
+ } else {
+ mh = g_new0 (MonoMethodHeader, 1);
+ }
+ mh->code = code;
+ mh->code_size = code_size;
+ mh->max_stack = max_stack;
+ mh->init_locals = init_locals;
+ if (fat_flags & METHOD_HEADER_MORE_SECTS)
+ parse_section_data (mh, (const unsigned char*)ptr);
+ return mh;
+}
+
+/*
+ * mono_metadata_free_mh:
+ * @mh: a method header
+ *
+ * Free the memory allocated for the method header.
+ */
+void
+mono_metadata_free_mh (MonoMethodHeader *mh)
+{
+ int i;
+ for (i = 0; i < mh->num_locals; ++i)
+ mono_metadata_free_type (mh->locals[i]);
+ g_free (mh->clauses);
+ g_free (mh);
+}
+
+/**
+ * mono_metadata_parse_field_type:
+ * @m: metadata context to extract information from
+ * @ptr: pointer to the field signature
+ * @rptr: pointer updated to match the end of the decoded stream
+ *
+ * Parses the field signature, and returns the type information for it.
+ *
+ * Returns: The MonoType that was extracted from @ptr.
+ */
+MonoType *
+mono_metadata_parse_field_type (MonoImage *m, short field_flags, const char *ptr, const char **rptr)
+{
+ return mono_metadata_parse_type (m, MONO_PARSE_FIELD, field_flags, ptr, rptr);
+}
+
+/**
+ * mono_metadata_parse_param:
+ * @m: metadata context to extract information from
+ * @ptr: pointer to the param signature
+ * @rptr: pointer updated to match the end of the decoded stream
+ *
+ * Parses the param signature, and returns the type information for it.
+ *
+ * Returns: The MonoType that was extracted from @ptr.
+ */
+MonoType *
+mono_metadata_parse_param (MonoImage *m, const char *ptr, const char **rptr)
+{
+ return mono_metadata_parse_type (m, MONO_PARSE_PARAM, 0, ptr, rptr);
+}
+
+/*
+ * mono_metadata_token_from_dor:
+ * @dor_token: A TypeDefOrRef coded index
+ *
+ * dor_token is a TypeDefOrRef coded index: it contains either
+ * a TypeDef, TypeRef or TypeSpec in the lower bits, and the upper
+ * bits contain an index into the table.
+ *
+ * Returns: an expanded token
+ */
+guint32
+mono_metadata_token_from_dor (guint32 dor_index)
+{
+ guint32 table, idx;
+
+ table = dor_index & 0x03;
+ idx = dor_index >> 2;
+
+ switch (table){
+ case 0: /* TypeDef */
+ return MONO_TOKEN_TYPE_DEF | idx;
+
+ case 1: /* TypeRef */
+ return MONO_TOKEN_TYPE_REF | idx;
+
+ case 2: /* TypeSpec */
+ return MONO_TOKEN_TYPE_SPEC | idx;
+
+ default:
+ g_assert_not_reached ();
+ }
+
+ return 0;
+}
+
+/*
+ * We use this to pass context information to the row locator
+ */
+typedef struct {
+ int idx; /* The index that we are trying to locate */
+ int col_idx; /* The index in the row where idx may be stored */
+ MonoTableInfo *t; /* pointer to the table */
+ guint32 result;
+} locator_t;
+
+#define CSIZE(x) (sizeof (x) / 4)
+
+/*
+ * How the row locator works.
+ *
+ * Table A
+ * ___|___
+ * ___|___ Table B
+ * ___|___------> _______
+ * ___|___ _______
+ *
+ * A column in the rows of table A references an index in table B.
+ * For example A may be the TYPEDEF table and B the METHODDEF table.
+ *
+ * Given an index in table B we want to get the row in table A
+ * where the column n references our index in B.
+ *
+ * In the locator_t structure:
+ * t is table A
+ * col_idx is the column number
+ * index is the index in table B
+ * result will be the index in table A
+ *
+ * Examples:
+ * Table A Table B column (in table A)
+ * TYPEDEF METHODDEF MONO_TYPEDEF_METHOD_LIST
+ * TYPEDEF FIELD MONO_TYPEDEF_FIELD_LIST
+ * PROPERTYMAP PROPERTY MONO_PROPERTY_MAP_PROPERTY_LIST
+ * INTERFIMPL TYPEDEF MONO_INTERFACEIMPL_CLASS
+ * METHODSEM PROPERTY ASSOCIATION (encoded index)
+ *
+ * Note that we still don't support encoded indexes.
+ *
+ */
+static int
+typedef_locator (const void *a, const void *b)
+{
+ locator_t *loc = (locator_t *) a;
+ const char *bb = (const char *) b;
+ int typedef_index = (bb - loc->t->base) / loc->t->row_size;
+ guint32 col, col_next;
+
+ col = mono_metadata_decode_row_col (loc->t, typedef_index, loc->col_idx);
+
+ if (loc->idx < col)
+ return -1;
+
+ /*
+ * Need to check that the next row is valid.
+ */
+ if (typedef_index + 1 < loc->t->rows) {
+ col_next = mono_metadata_decode_row_col (loc->t, typedef_index + 1, loc->col_idx);
+ if (loc->idx >= col_next)
+ return 1;
+
+ if (col == col_next)
+ return 1;
+ }
+
+ loc->result = typedef_index;
+
+ return 0;
+}
+
+static int
+table_locator (const void *a, const void *b)
+{
+ locator_t *loc = (locator_t *) a;
+ const char *bb = (const char *) b;
+ guint32 table_index = (bb - loc->t->base) / loc->t->row_size;
+ guint32 col;
+
+ col = mono_metadata_decode_row_col (loc->t, table_index, loc->col_idx);
+
+ if (loc->idx == col) {
+ loc->result = table_index;
+ return 0;
+ }
+ if (loc->idx < col)
+ return -1;
+ else
+ return 1;
+}
+
+/*
+ * mono_metadata_typedef_from_field:
+ * @meta: metadata context
+ * @index: FieldDef token
+ *
+ * Returns the 1-based index into the TypeDef table of the type that
+ * declared the field described by @index.
+ * Returns 0 if not found.
+ */
+guint32
+mono_metadata_typedef_from_field (MonoImage *meta, guint32 index)
+{
+ MonoTableInfo *tdef = &meta->tables [MONO_TABLE_TYPEDEF];
+ locator_t loc;
+
+ if (!tdef->base)
+ return 0;
+
+ loc.idx = mono_metadata_token_index (index);
+ loc.col_idx = MONO_TYPEDEF_FIELD_LIST;
+ loc.t = tdef;
+
+ if (!bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, typedef_locator))
+ g_assert_not_reached ();
+
+ /* loc_result is 0..1, needs to be mapped to table index (that is +1) */
+ return loc.result + 1;
+}
+
+/*
+ * mono_metadata_typedef_from_method:
+ * @meta: metadata context
+ * @index: MethodDef token
+ *
+ * Returns the 1-based index into the TypeDef table of the type that
+ * declared the method described by @index.
+ * Returns 0 if not found.
+ */
+guint32
+mono_metadata_typedef_from_method (MonoImage *meta, guint32 index)
+{
+ MonoTableInfo *tdef = &meta->tables [MONO_TABLE_TYPEDEF];
+ locator_t loc;
+
+ if (!tdef->base)
+ return 0;
+
+ loc.idx = mono_metadata_token_index (index);
+ loc.col_idx = MONO_TYPEDEF_METHOD_LIST;
+ loc.t = tdef;
+
+ if (!bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, typedef_locator))
+ g_assert_not_reached ();
+
+ /* loc_result is 0..1, needs to be mapped to table index (that is +1) */
+ return loc.result + 1;
+}
+
+/*
+ * mono_metadata_interfaces_from_typedef:
+ * @meta: metadata context
+ * @index: typedef token
+ *
+ * Returns and array of interfaces that the @index typedef token implements.
+ * The number of elemnts in the array is returned in @count.
+ */
+MonoClass**
+mono_metadata_interfaces_from_typedef (MonoImage *meta, guint32 index, guint *count)
+{
+ MonoTableInfo *tdef = &meta->tables [MONO_TABLE_INTERFACEIMPL];
+ locator_t loc;
+ guint32 start, i;
+ guint32 cols [MONO_INTERFACEIMPL_SIZE];
+ MonoClass **result;
+
+ *count = 0;
+
+ if (!tdef->base)
+ return NULL;
+
+ loc.idx = mono_metadata_token_index (index);
+ loc.col_idx = MONO_INTERFACEIMPL_CLASS;
+ loc.t = tdef;
+
+ if (!bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator))
+ return NULL;
+
+ start = loc.result;
+ /*
+ * We may end up in the middle of the rows...
+ */
+ while (start > 0) {
+ if (loc.idx == mono_metadata_decode_row_col (tdef, start - 1, MONO_INTERFACEIMPL_CLASS))
+ start--;
+ else
+ break;
+ }
+ result = NULL;
+ i = 0;
+ while (start < tdef->rows) {
+ mono_metadata_decode_row (tdef, start, cols, MONO_INTERFACEIMPL_SIZE);
+ if (cols [MONO_INTERFACEIMPL_CLASS] != loc.idx)
+ break;
+ result = g_renew (MonoClass*, result, i + 1);
+ result [i] = mono_class_get (meta, mono_metadata_token_from_dor (cols [MONO_INTERFACEIMPL_INTERFACE]));
+ *count = ++i;
+ ++start;
+ }
+ return result;
+}
+
+/*
+ * mono_metadata_nested_in_typedef:
+ * @meta: metadata context
+ * @index: typedef token
+ *
+ * Returns: the 1-based index into the TypeDef table of the type
+ * where the type described by @index is nested.
+ * Retruns 0 if @index describes a non-nested type.
+ */
+guint32
+mono_metadata_nested_in_typedef (MonoImage *meta, guint32 index)
+{
+ MonoTableInfo *tdef = &meta->tables [MONO_TABLE_NESTEDCLASS];
+ locator_t loc;
+
+ if (!tdef->base)
+ return 0;
+
+ loc.idx = mono_metadata_token_index (index);
+ loc.col_idx = MONO_NESTED_CLASS_NESTED;
+ loc.t = tdef;
+
+ if (!bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator))
+ return 0;
+
+ /* loc_result is 0..1, needs to be mapped to table index (that is +1) */
+ return mono_metadata_decode_row_col (tdef, loc.result, MONO_NESTED_CLASS_ENCLOSING) | MONO_TOKEN_TYPE_DEF;
+}
+
+/*
+ * mono_metadata_nesting_typedef:
+ * @meta: metadata context
+ * @index: typedef token
+ *
+ * Returns: the 1-based index into the TypeDef table of the first type
+ * that is nested inside the type described by @index.
+ * Retruns 0 if @index doesn't have nested types.
+ */
+guint32
+mono_metadata_nesting_typedef (MonoImage *meta, guint32 index)
+{
+ MonoTableInfo *tdef = &meta->tables [MONO_TABLE_NESTEDCLASS];
+ locator_t loc;
+ guint32 start;
+
+ if (!tdef->base)
+ return 0;
+
+ loc.idx = mono_metadata_token_index (index);
+ loc.col_idx = MONO_NESTED_CLASS_ENCLOSING;
+ loc.t = tdef;
+
+ if (!bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator))
+ return 0;
+
+ start = loc.result;
+
+ while (start > 0) {
+ if (loc.idx == mono_metadata_decode_row_col (tdef, start - 1, MONO_NESTED_CLASS_ENCLOSING))
+ start--;
+ else
+ break;
+ }
+
+ /* loc_result is 0..1, needs to be mapped to table index (that is +1) */
+ return start + 1;
+}
+
+/*
+ * mono_metadata_packing_from_typedef:
+ * @meta: metadata context
+ * @index: token representing a type
+ *
+ * Returns the info stored in the ClassLAyout table for the given typedef token
+ * into the @packing and @size pointers.
+ * Returns 0 if the info is not found.
+ */
+guint32
+mono_metadata_packing_from_typedef (MonoImage *meta, guint32 index, guint32 *packing, guint32 *size)
+{
+ MonoTableInfo *tdef = &meta->tables [MONO_TABLE_CLASSLAYOUT];
+ locator_t loc;
+ guint32 cols [MONO_CLASS_LAYOUT_SIZE];
+
+ if (!tdef->base)
+ return 0;
+
+ loc.idx = mono_metadata_token_index (index);
+ loc.col_idx = MONO_CLASS_LAYOUT_PARENT;
+ loc.t = tdef;
+
+ if (!bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator))
+ return 0;
+
+ mono_metadata_decode_row (tdef, loc.result, cols, MONO_CLASS_LAYOUT_SIZE);
+ if (packing)
+ *packing = cols [MONO_CLASS_LAYOUT_PACKING_SIZE];
+ if (size)
+ *size = cols [MONO_CLASS_LAYOUT_CLASS_SIZE];
+
+ /* loc_result is 0..1, needs to be mapped to table index (that is +1) */
+ return loc.result + 1;
+}
+
+#ifndef __GNUC__
+#define __alignof__(a) sizeof(a)
+#endif
+
+/*
+ * mono_type_size:
+ * @t: the type to return the size of
+ *
+ * Returns: the number of bytes required to hold an instance of this
+ * type in memory
+ */
+int
+mono_type_size (MonoType *t, gint *align)
+{
+ if (!t) {
+ *align = 1;
+ return 0;
+ }
+ if (t->byref) {
+ *align = __alignof__(gpointer);
+ return sizeof (gpointer);
+ }
+
+ switch (t->type){
+ case MONO_TYPE_VOID:
+ *align = 1;
+ return 0;
+ case MONO_TYPE_BOOLEAN:
+ *align = __alignof__(char);
+ return sizeof (char);
+
+ case MONO_TYPE_CHAR:
+ *align = __alignof__(short);
+ return sizeof (short);
+
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ *align = __alignof__(char);
+ return 1;
+
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ *align = __alignof__(gint16);
+ return 2;
+
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ *align = __alignof__(gint32);
+ return 4;
+ case MONO_TYPE_R4:
+ *align = __alignof__(float);
+ return 4;
+
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ *align = __alignof__(gint64);
+ case MONO_TYPE_R8:
+ *align = __alignof__(double);
+ return 8;
+
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ *align = __alignof__(gpointer);
+ return sizeof (gpointer);
+
+ case MONO_TYPE_STRING:
+ *align = __alignof__(gpointer);
+ return sizeof (gpointer);
+
+ case MONO_TYPE_OBJECT:
+ *align = __alignof__(gpointer);
+ return sizeof (gpointer);
+
+ case MONO_TYPE_VALUETYPE: {
+ guint32 size;
+
+ if (!t->data.klass->size_inited)
+ mono_class_init (t->data.klass);
+
+ if (t->data.klass->enumtype) {
+ return mono_type_size (t->data.klass->enum_basetype, align);
+ } else {
+ size = mono_class_value_size (t->data.klass, align);
+ return size;
+ }
+ }
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_FNPTR:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_TYPEDBYREF: /* we may want to use a struct {MonoType* type, void *data } instead ...*/
+ *align = __alignof__(gpointer);
+ return sizeof (gpointer);
+ default:
+ g_error ("type 0x%02x unknown", t->type);
+ }
+ return 0;
+}
+
+/*
+ * mono_type_stack_size:
+ * @t: the type to return the size it uses on the stack
+ *
+ * Returns: the number of bytes required to hold an instance of this
+ * type on the runtime stack
+ */
+int
+mono_type_stack_size (MonoType *t, gint *align)
+{
+ g_assert (t != NULL);
+
+ if (t->byref) {
+ *align = __alignof__(gpointer);
+ return sizeof (gpointer);
+ }
+
+ switch (t->type){
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_FNPTR:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_TYPEDBYREF:
+ *align = __alignof__(gpointer);
+ return sizeof (gpointer);
+ case MONO_TYPE_R4:
+ *align = __alignof__(float);
+ return 4;
+
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ *align = __alignof__(gint64);
+ case MONO_TYPE_R8:
+ *align = __alignof__(double);
+ return 8;
+
+ case MONO_TYPE_VALUETYPE: {
+ guint32 size;
+
+ if (t->data.klass->enumtype)
+ return mono_type_stack_size (t->data.klass->enum_basetype, align);
+ else {
+ size = mono_class_value_size (t->data.klass, align);
+ *align = __alignof__(gpointer);
+ return size;
+ }
+ }
+ default:
+ g_error ("type 0x%02x unknown", t->type);
+ }
+ return 0;
+}
+
+/*
+ * mono_metadata_type_hash:
+ * @t1: a type
+ *
+ * Computes an hash value for @t1 to be used in GHashTable.
+ */
+guint
+mono_metadata_type_hash (MonoType *t1)
+{
+ guint hash = t1->type;
+
+ hash |= t1->byref << 6; /* do not collide with t1->type values */
+ switch (t1->type) {
+ case MONO_TYPE_VALUETYPE:
+ case MONO_TYPE_CLASS:
+ /* check if the distribution is good enough */
+ return hash << 7 | g_str_hash (t1->data.klass->name);
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ return hash << 7 | mono_metadata_type_hash (t1->data.type);
+ }
+ return hash;
+}
+
+/*
+ * mono_metadata_type_equal:
+ * @t1: a type
+ * @t2: another type
+ *
+ * Determine if @t1 and @t2 represent the same type.
+ * Returns: #TRUE if @t1 and @t2 are equal.
+ */
+gboolean
+mono_metadata_type_equal (MonoType *t1, MonoType *t2)
+{
+ if (t1->type != t2->type ||
+ t1->byref != t2->byref)
+ return FALSE;
+
+ switch (t1->type) {
+ case MONO_TYPE_VOID:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_OBJECT:
+ return TRUE;
+ case MONO_TYPE_VALUETYPE:
+ case MONO_TYPE_CLASS:
+ return t1->data.klass == t2->data.klass;
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ return mono_metadata_type_equal (t1->data.type, t2->data.type);
+ case MONO_TYPE_ARRAY:
+ if (t1->data.array->rank != t2->data.array->rank)
+ return FALSE;
+ return mono_metadata_type_equal (t1->data.array->type, t2->data.array->type);
+ default:
+ g_error ("implement type compare for %0x!", t1->type);
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
+/*
+ * mono_metadata_signature_equal:
+ * @sig1: a signature
+ * @sig2: another signature
+ *
+ * Determine if @sig1 and @sig2 represent the same signature, with the
+ * same number of arguments and the same types.
+ * Returns: #TRUE if @sig1 and @sig2 are equal.
+ */
+gboolean
+mono_metadata_signature_equal (MonoMethodSignature *sig1, MonoMethodSignature *sig2)
+{
+ int i;
+
+ if (sig1->hasthis != sig2->hasthis ||
+ sig1->param_count != sig2->param_count)
+ return FALSE;
+
+ for (i = 0; i < sig1->param_count; i++) {
+ MonoType *p1 = sig1->params[i];
+ MonoType *p2 = sig2->params[i];
+
+ if (p1->attrs != p2->attrs)
+ return FALSE;
+
+ if (!mono_metadata_type_equal (p1, p2))
+ return FALSE;
+ }
+
+ if (!mono_metadata_type_equal (sig1->ret, sig2->ret))
+ return FALSE;
+ return TRUE;
+}
+
+/*
+ * mono_metadata_encode_value:
+ * @value: value to encode
+ * @buf: buffer where to write the compressed representation
+ * @endbuf: pointer updated to point at the end of the encoded output
+ *
+ * Encodes the value @value in the compressed representation used
+ * in metadata and stores the result in @buf. @buf needs to be big
+ * enough to hold the data (4 bytes).
+ */
+void
+mono_metadata_encode_value (guint32 value, char *buf, char **endbuf)
+{
+ char *p = buf;
+
+ if (value <= 127)
+ *p++ = value;
+ else if (value <= 16384) {
+ p [0] = 0x80 | (value >> 8);
+ p [1] = value & 0xff;
+ p += 2;
+ } else {
+ p [0] = (value >> 24) | 0xc0;
+ p [1] = (value >> 16) & 0xff;
+ p [2] = (value >> 8) & 0xff;
+ p [3] = value & 0xff;
+ p += 4;
+ }
+ if (endbuf)
+ *endbuf = p;
+}
+
+/*
+ * mono_metadata_field_info:
+ * @meta: the Image the field is defined in
+ * @index: the index in the field table representing the field
+ * @offset: a pointer to an integer where to store the offset that
+ * may have been specified for the field in a FieldLayout table
+ * @rva: a pointer to the address of the field data in the image that
+ * may have been defined in a FieldRVA table
+ * @marshal_info: a pointer to the marshal signature that may have been
+ * defined for the field in a FieldMarshal table.
+ *
+ * Gather info for field @index that may have been defined in the FieldLayout,
+ * FieldRVA and FieldMarshal tables.
+ * Either of offset, rva and marshal_info can be NULL if you're not interested
+ * in the data.
+ */
+void
+mono_metadata_field_info (MonoImage *meta, guint32 index, guint32 *offset, const char **rva, const char **marshal_info)
+{
+ MonoTableInfo *tdef;
+ locator_t loc;
+
+ loc.idx = index + 1;
+ if (offset) {
+ tdef = &meta->tables [MONO_TABLE_FIELDLAYOUT];
+
+ loc.col_idx = MONO_FIELD_LAYOUT_FIELD;
+ loc.t = tdef;
+
+ if (tdef->base && bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator)) {
+ *offset = mono_metadata_decode_row_col (tdef, loc.result, MONO_FIELD_LAYOUT_OFFSET);
+ } else {
+ *offset = (guint32)-1;
+ }
+ }
+ if (rva) {
+ tdef = &meta->tables [MONO_TABLE_FIELDRVA];
+
+ loc.col_idx = MONO_FIELD_RVA_FIELD;
+ loc.t = tdef;
+
+ if (tdef->base && bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator)) {
+ /*
+ * LAMESPEC: There is no signature, no nothing, just the raw data.
+ */
+ *rva = mono_cli_rva_map (meta->image_info, mono_metadata_decode_row_col (tdef, loc.result, MONO_FIELD_RVA_RVA));
+ } else {
+ *rva = NULL;
+ }
+ }
+
+}
+
+/*
+ * mono_metadata_get_constant_index:
+ * @meta: the Image the field is defined in
+ * @index: the token that may have a row defined in the constants table
+ *
+ * @token must be a FieldDef, ParamDef or PropertyDef token.
+ *
+ * Returns: the index into the Constsnts table or 0 if not found.
+ */
+guint32
+mono_metadata_get_constant_index (MonoImage *meta, guint32 token)
+{
+ MonoTableInfo *tdef;
+ locator_t loc;
+ guint32 index = mono_metadata_token_index (token);
+
+ tdef = &meta->tables [MONO_TABLE_CONSTANT];
+ index <<= HASCONSTANT_BITS;
+ switch (mono_metadata_token_table (token)) {
+ case MONO_TABLE_FIELD:
+ index |= HASCONSTANT_FIEDDEF;
+ break;
+ case MONO_TABLE_PARAM:
+ index |= HASCONSTANT_PARAM;
+ break;
+ case MONO_TABLE_PROPERTY:
+ index |= HASCONSTANT_PROPERTY;
+ break;
+ default:
+ g_warning ("Not a valid token for the constant table: 0x%08x", token);
+ return 0;
+ }
+ loc.idx = index;
+ loc.col_idx = MONO_CONSTANT_PARENT;
+ loc.t = tdef;
+
+ if (tdef->base && bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator)) {
+ return loc.result + 1;
+ }
+ return 0;
+}
+
+/*
+ * mono_metadata_events_from_typedef:
+ * @meta: metadata context
+ * @index: 0-based index (in the TypeDef table) describing a type
+ *
+ * Returns: the 0-based index in the Event table for the events in the
+ * type. The last event that belongs to the type (plus 1) is stored
+ * in the @end_idx pointer.
+ */
+guint32
+mono_metadata_events_from_typedef (MonoImage *meta, guint32 index, guint *end_idx)
+{
+ locator_t loc;
+ guint32 start, end;
+ MonoTableInfo *tdef = &meta->tables [MONO_TABLE_EVENTMAP];
+
+ *end_idx = 0;
+
+ if (!tdef->base)
+ return 0;
+
+ loc.t = tdef;
+ loc.col_idx = MONO_EVENT_MAP_PARENT;
+ loc.idx = index + 1;
+
+ if (!bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator))
+ return 0;
+
+ start = mono_metadata_decode_row_col (tdef, loc.result, MONO_EVENT_MAP_EVENTLIST);
+ if (loc.result + 1 < tdef->rows) {
+ end = mono_metadata_decode_row_col (tdef, loc.result + 1, MONO_EVENT_MAP_EVENTLIST) - 1;
+ } else {
+ end = meta->tables [MONO_TABLE_EVENT].rows;
+ }
+
+ *end_idx = end;
+ return start - 1;
+}
+
+/*
+ * mono_metadata_methods_from_event:
+ * @meta: metadata context
+ * @index: 0-based index (in the Event table) describing a event
+ *
+ * Returns: the 0-based index in the MethodDef table for the methods in the
+ * event. The last method that belongs to the event (plus 1) is stored
+ * in the @end_idx pointer.
+ */
+guint32
+mono_metadata_methods_from_event (MonoImage *meta, guint32 index, guint *end_idx)
+{
+ locator_t loc;
+ guint start, end;
+ guint32 cols [MONO_METHOD_SEMA_SIZE];
+ MonoTableInfo *msemt = &meta->tables [MONO_TABLE_METHODSEMANTICS];
+
+ *end_idx = 0;
+ if (!msemt->base)
+ return 0;
+
+ loc.t = msemt;
+ loc.col_idx = MONO_METHOD_SEMA_ASSOCIATION;
+ loc.idx = ((index + 1) << HAS_SEMANTICS_BITS) | HAS_SEMANTICS_EVENT; /* Method association coded index */
+
+ if (!bsearch (&loc, msemt->base, msemt->rows, msemt->row_size, table_locator))
+ return 0;
+
+ start = loc.result;
+ /*
+ * We may end up in the middle of the rows...
+ */
+ while (start > 0) {
+ if (loc.idx == mono_metadata_decode_row_col (msemt, start - 1, MONO_METHOD_SEMA_ASSOCIATION))
+ start--;
+ else
+ break;
+ }
+ end = start + 1;
+ while (end < msemt->rows) {
+ mono_metadata_decode_row (msemt, end, cols, MONO_METHOD_SEMA_SIZE);
+ if (cols [MONO_METHOD_SEMA_ASSOCIATION] != loc.idx)
+ break;
+ ++end;
+ }
+ *end_idx = end;
+ return start;
+}
+
+/*
+ * mono_metadata_properties_from_typedef:
+ * @meta: metadata context
+ * @index: 0-based index (in the TypeDef table) describing a type
+ *
+ * Returns: the 0-based index in the Property table for the properties in the
+ * type. The last property that belongs to the type (plus 1) is stored
+ * in the @end_idx pointer.
+ */
+guint32
+mono_metadata_properties_from_typedef (MonoImage *meta, guint32 index, guint *end_idx)
+{
+ locator_t loc;
+ guint32 start, end;
+ MonoTableInfo *tdef = &meta->tables [MONO_TABLE_PROPERTYMAP];
+
+ *end_idx = 0;
+
+ if (!tdef->base)
+ return 0;
+
+ loc.t = tdef;
+ loc.col_idx = MONO_PROPERTY_MAP_PARENT;
+ loc.idx = index + 1;
+
+ if (!bsearch (&loc, tdef->base, tdef->rows, tdef->row_size, table_locator))
+ return 0;
+
+ start = mono_metadata_decode_row_col (tdef, loc.result, MONO_PROPERTY_MAP_PROPERTY_LIST);
+ if (loc.result + 1 < tdef->rows) {
+ end = mono_metadata_decode_row_col (tdef, loc.result + 1, MONO_PROPERTY_MAP_PROPERTY_LIST) - 1;
+ } else {
+ end = meta->tables [MONO_TABLE_PROPERTY].rows;
+ }
+
+ *end_idx = end;
+ return start - 1;
+}
+
+/*
+ * mono_metadata_methods_from_property:
+ * @meta: metadata context
+ * @index: 0-based index (in the PropertyDef table) describing a property
+ *
+ * Returns: the 0-based index in the MethodDef table for the methods in the
+ * property. The last method that belongs to the property (plus 1) is stored
+ * in the @end_idx pointer.
+ */
+guint32
+mono_metadata_methods_from_property (MonoImage *meta, guint32 index, guint *end_idx)
+{
+ locator_t loc;
+ guint start, end;
+ guint32 cols [MONO_METHOD_SEMA_SIZE];
+ MonoTableInfo *msemt = &meta->tables [MONO_TABLE_METHODSEMANTICS];
+
+ *end_idx = 0;
+ if (!msemt->base)
+ return 0;
+
+ loc.t = msemt;
+ loc.col_idx = MONO_METHOD_SEMA_ASSOCIATION;
+ loc.idx = ((index + 1) << HAS_SEMANTICS_BITS) | HAS_SEMANTICS_PROPERTY; /* Method association coded index */
+
+ if (!bsearch (&loc, msemt->base, msemt->rows, msemt->row_size, table_locator))
+ return 0;
+
+ start = loc.result;
+ /*
+ * We may end up in the middle of the rows...
+ */
+ while (start > 0) {
+ if (loc.idx == mono_metadata_decode_row_col (msemt, start - 1, MONO_METHOD_SEMA_ASSOCIATION))
+ start--;
+ else
+ break;
+ }
+ end = start + 1;
+ while (end < msemt->rows) {
+ mono_metadata_decode_row (msemt, end, cols, MONO_METHOD_SEMA_SIZE);
+ if (cols [MONO_METHOD_SEMA_ASSOCIATION] != loc.idx)
+ break;
+ ++end;
+ }
+ *end_idx = end;
+ return start;
+}
+
+/**
+ * @image: context where the image is created
+ * @type_spec: typespec token
+ *
+ * Creates a MonoType representing the TypeSpec indexed by the @type_spec
+ * token.
+ */
+MonoType *
+mono_type_create_from_typespec (MonoImage *image, guint32 type_spec)
+{
+ guint32 idx = mono_metadata_token_index (type_spec);
+ MonoTableInfo *t;
+ guint32 cols [MONO_TYPESPEC_SIZE];
+ const char *ptr;
+ guint32 len;
+ MonoType *type;
+
+ t = &image->tables [MONO_TABLE_TYPESPEC];
+
+ mono_metadata_decode_row (t, idx-1, cols, MONO_TYPESPEC_SIZE);
+ ptr = mono_metadata_blob_heap (image, cols [MONO_TYPESPEC_SIGNATURE]);
+ len = mono_metadata_decode_value (ptr, &ptr);
+ type = mono_metadata_parse_type (image, MONO_PARSE_TYPE, 0, ptr, &ptr);
+
+ return type;
+}
diff --git a/mono/metadata/metadata.h b/mono/metadata/metadata.h
index 6e34877013f..34e90afd1dc 100644
--- a/mono/metadata/metadata.h
+++ b/mono/metadata/metadata.h
@@ -1,18 +1,293 @@
+#ifndef __MONO_METADATA_H__
+#define __MONO_METADATA_H__
+
+#include <glib.h>
+
+#include <mono/metadata/blob.h>
+#include <mono/metadata/row-indexes.h>
+#include <mono/metadata/image.h>
+
+#ifdef __GNUC__
+#define MONO_ZERO_LEN_ARRAY 0
+#else
+#define MONO_ZERO_LEN_ARRAY 1
+#endif
+
+typedef struct _MonoClass MonoClass;
+typedef struct _MonoDomain MonoDomain;
+
+typedef enum {
+ MONO_TABLE_MODULE,
+ MONO_TABLE_TYPEREF,
+ MONO_TABLE_TYPEDEF,
+ MONO_TABLE_UNUSED1,
+ MONO_TABLE_FIELD,
+ MONO_TABLE_UNUSED2,
+ MONO_TABLE_METHOD,
+ MONO_TABLE_UNUSED3,
+ MONO_TABLE_PARAM,
+ MONO_TABLE_INTERFACEIMPL,
+ MONO_TABLE_MEMBERREF,
+ MONO_TABLE_CONSTANT,
+ MONO_TABLE_CUSTOMATTRIBUTE,
+ MONO_TABLE_FIELDMARSHAL,
+ MONO_TABLE_DECLSECURITY,
+ MONO_TABLE_CLASSLAYOUT,
+ MONO_TABLE_FIELDLAYOUT,
+ MONO_TABLE_STANDALONESIG,
+ MONO_TABLE_EVENTMAP,
+ MONO_TABLE_UNUSED4,
+ MONO_TABLE_EVENT,
+ MONO_TABLE_PROPERTYMAP,
+ MONO_TABLE_UNUSED5,
+ MONO_TABLE_PROPERTY,
+ MONO_TABLE_METHODSEMANTICS,
+ MONO_TABLE_METHODIMPL,
+ MONO_TABLE_MODULEREF,
+ MONO_TABLE_TYPESPEC,
+ MONO_TABLE_IMPLMAP,
+ MONO_TABLE_FIELDRVA,
+ MONO_TABLE_UNUSED6,
+ MONO_TABLE_UNUSED7,
+ MONO_TABLE_ASSEMBLY,
+ MONO_TABLE_ASSEMBLYPROCESSOR,
+ MONO_TABLE_ASSEMBLYOS,
+ MONO_TABLE_ASSEMBLYREF,
+ MONO_TABLE_ASSEMBLYREFPROCESSOR,
+ MONO_TABLE_ASSEMBLYREFOS,
+ MONO_TABLE_FILE,
+ MONO_TABLE_EXPORTEDTYPE,
+ MONO_TABLE_MANIFESTRESOURCE,
+ MONO_TABLE_NESTEDCLASS
+
+#define MONO_TABLE_LAST MONO_TABLE_NESTEDCLASS
+} MonoMetaTableEnum;
+
+typedef enum {
+ MONO_EXCEPTION_CLAUSE_NONE,
+ MONO_EXCEPTION_CLAUSE_FILTER,
+ MONO_EXCEPTION_CLAUSE_FINALLY,
+ MONO_EXCEPTION_CLAUSE_FAULT = 4
+} MonoExceptionEnum;
+
+typedef enum {
+ MONO_CALL_DEFAULT,
+ MONO_CALL_C,
+ MONO_CALL_STDCALL,
+ MONO_CALL_THISCALL,
+ MONO_CALL_FASTCALL,
+ MONO_CALL_VARARG
+} MonoCallConvention;
+
+void mono_metadata_decode_row (MonoTableInfo *t,
+ int idx,
+ guint32 *res,
+ int res_size);
+
+guint32 mono_metadata_decode_row_col (MonoTableInfo *t,
+ int idx,
+ guint col);
+
+/*
+ * This macro is used to extract the size of the table encoded in
+ * the size_bitfield of MonoTableInfo.
+ */
+#define mono_metadata_table_size(bitfield,table) ((((bitfield) >> ((table)*2)) & 0x3) + 1)
+#define mono_metadata_table_count(bitfield) ((bitfield) >> 24)
+
+int mono_metadata_compute_size (MonoImage *meta,
+ int tableindex,
+ guint32 *result_bitfield);
+
+/*
+ *
+ */
+const char *mono_metadata_locate (MonoImage *meta, int table, int idx);
+const char *mono_metadata_locate_token (MonoImage *meta, guint32 token);
+
+const char *mono_metadata_string_heap (MonoImage *meta, guint32 table_index);
+const char *mono_metadata_blob_heap (MonoImage *meta, guint32 table_index);
+const char *mono_metadata_user_string (MonoImage *meta, guint32 table_index);
+const char *mono_metadata_guid_heap (MonoImage *meta, guint32 table_index);
+
+guint32 mono_metadata_typedef_from_field (MonoImage *meta, guint32 table_index);
+guint32 mono_metadata_typedef_from_method (MonoImage *meta, guint32 table_index);
+guint32 mono_metadata_nested_in_typedef (MonoImage *meta, guint32 table_index);
+guint32 mono_metadata_nesting_typedef (MonoImage *meta, guint32 table_index);
+
+MonoClass** mono_metadata_interfaces_from_typedef (MonoImage *meta, guint32 table_index, guint *count);
+
+guint32 mono_metadata_events_from_typedef (MonoImage *meta, guint32 table_index, guint *end_idx);
+guint32 mono_metadata_methods_from_event (MonoImage *meta, guint32 table_index, guint *end);
+guint32 mono_metadata_properties_from_typedef (MonoImage *meta, guint32 table_index, guint *end);
+guint32 mono_metadata_methods_from_property (MonoImage *meta, guint32 table_index, guint *end);
+guint32 mono_metadata_packing_from_typedef (MonoImage *meta, guint32 table_index, guint32 *packing, guint32 *size);
+
+void mono_metadata_field_info (MonoImage *meta,
+ guint32 table_index,
+ guint32 *offset,
+ const char **rva,
+ const char **marshal_info);
+
+guint32 mono_metadata_get_constant_index (MonoImage *meta, guint32 token);
+
+/*
+ * Functions to extract information from the Blobs
+ */
+guint32 mono_metadata_decode_value (const char *ptr,
+ const char **rptr);
+guint32 mono_metadata_decode_blob_size (const char *ptr,
+ const char **rptr);
+
+void mono_metadata_encode_value (guint32 value, char *bug, char **endbuf);
+
+#define MONO_OFFSET_IN_CLAUSE(clause,offset) \
+ ((clause)->try_offset <= (offset) && (offset) < ((clause)->try_offset + (clause)->try_len))
+#define MONO_OFFSET_IN_HANDLER(clause,offset) \
+ ((clause)->handler_offset <= (offset) && (offset) < ((clause)->handler_offset + (clause)->handler_len))
+
+typedef struct {
+ guint32 flags;
+ guint32 try_offset;
+ guint32 try_len;
+ guint32 handler_offset;
+ guint32 handler_len;
+ guint32 token_or_filter;
+} MonoExceptionClause;
+
+typedef struct _MonoType MonoType;
+typedef struct _MonoArrayType MonoArrayType;
+typedef struct _MonoMethodSignature MonoMethodSignature;
+
typedef struct {
- guint32 sh_offset;
- guint32 sh_size;
-} stream_header_t;
+ unsigned int required : 1;
+ unsigned int token : 31;
+} MonoCustomMod;
+
+struct _MonoArrayType {
+ MonoType *type;
+ int rank;
+ int numsizes;
+ int numlobounds;
+ int *sizes;
+ int *lobounds;
+};
+
+struct _MonoType {
+ union {
+ MonoClass *klass; /* for VALUETYPE and CLASS */
+ MonoType *type; /* for PTR and SZARRAY */
+ MonoArrayType *array; /* for ARRAY */
+ MonoMethodSignature *method;
+ } data;
+ unsigned int attrs : 16; /* param attributes or field flags */
+ unsigned int type : 8; /* ElementTypeEnum */
+ unsigned int num_mods : 6; /* max 64 modifiers follow at the end */
+ unsigned int byref : 1;
+ unsigned int pinned : 1; /* valid when included in a local var signature */
+ MonoCustomMod modifiers [MONO_ZERO_LEN_ARRAY]; /* this may grow */
+};
+
+struct _MonoMethodSignature {
+ unsigned int hasthis : 1;
+ unsigned int explicit_this : 1;
+ unsigned int call_convention : 6;
+ unsigned int ref_count : 24;
+ guint16 param_count;
+ guint16 sentinelpos;
+ MonoType *ret;
+ MonoType *params [MONO_ZERO_LEN_ARRAY];
+};
typedef struct {
- char *raw_metadata;
+ guint32 code_size;
+ const unsigned char *code;
+ guint16 max_stack;
+ unsigned int num_clauses : 15;
+ /* if num_locals != 0, then the following apply: */
+ unsigned int init_locals : 1;
+ guint16 num_locals;
+ MonoExceptionClause *clauses;
+ MonoType *locals [MONO_ZERO_LEN_ARRAY];
+} MonoMethodHeader;
+
+typedef enum {
+ MONO_PARSE_TYPE,
+ MONO_PARSE_MOD_TYPE,
+ MONO_PARSE_LOCAL,
+ MONO_PARSE_PARAM,
+ MONO_PARSE_RET,
+ MONO_PARSE_FIELD
+} MonoParseTypeMode;
+
+guint32 mono_metadata_parse_typedef_or_ref (MonoImage *m,
+ const char *ptr,
+ const char **rptr);
+int mono_metadata_parse_custom_mod (MonoImage *m,
+ MonoCustomMod *dest,
+ const char *ptr,
+ const char **rptr);
+MonoArrayType *mono_metadata_parse_array (MonoImage *m,
+ const char *ptr,
+ const char **rptr);
+void mono_metadata_free_array (MonoArrayType *array);
+MonoType *mono_metadata_parse_type (MonoImage *m,
+ MonoParseTypeMode mode,
+ short opt_attrs,
+ const char *ptr,
+ const char **rptr);
+MonoType *mono_metadata_parse_param (MonoImage *m,
+ const char *ptr,
+ const char **rptr);
+MonoType *mono_metadata_parse_ret_type (MonoImage *m,
+ const char *ptr,
+ const char **rptr);
+MonoType *mono_metadata_parse_field_type (MonoImage *m,
+ short field_flags,
+ const char *ptr,
+ const char **rptr);
+MonoType *mono_type_create_from_typespec (MonoImage *image,
+ guint32 type_spec);
+void mono_metadata_free_type (MonoType *type);
+int mono_type_size (MonoType *type,
+ int *alignment);
+int mono_type_stack_size (MonoType *type,
+ int *alignment);
+
+guint mono_metadata_type_hash (MonoType *t1);
+gboolean mono_metadata_type_equal (MonoType *t1, MonoType *t2);
+
+MonoMethodSignature *mono_metadata_parse_method_signature (MonoImage *m,
+ int def,
+ const char *ptr,
+ const char **rptr);
+void mono_metadata_free_method_signature (MonoMethodSignature *method);
+
+gboolean mono_metadata_signature_equal (MonoMethodSignature *sig1,
+ MonoMethodSignature *sig2);
+
+MonoMethodHeader *mono_metadata_parse_mh (MonoImage *m, const char *ptr);
+void mono_metadata_free_mh (MonoMethodHeader *mh);
+
+/*
+ * Makes a token based on a table and an index
+ */
+#define mono_metadata_make_token(table,idx) (((table) << 24)| idx)
+
+/*
+ * Returns the table index that this token encodes.
+ */
+#define mono_metadata_token_table(token) ((token) >> 24)
+
+ /*
+ * Returns the index that a token refers to
+ */
+#define mono_metadata_token_index(token) ((token & 0xffffff))
+
- stream_header_t heap_strings;
- stream_header_t heap_us;
- stream_header_t heap_blob;
- stream_header_t heap_guid;
- stream_header_t heap_tables;
+#define mono_metadata_token_code(token) ((token & 0xff000000))
- guint32 rows [64];
-} metadata_t;
+guint32 mono_metadata_token_from_dor (guint32 dor_index);
+#endif /* __MONO_METADATA_H__ */
diff --git a/mono/metadata/mono-endian.c b/mono/metadata/mono-endian.c
new file mode 100644
index 00000000000..0cd01f2fc5c
--- /dev/null
+++ b/mono/metadata/mono-endian.c
@@ -0,0 +1,78 @@
+#include "mono-endian.h"
+
+#if NO_UNALIGNED_ACCESS
+
+typedef union {
+ char c [2];
+ guint16 i;
+} mono_rint16;
+
+typedef union {
+ char c [4];
+ guint32 i;
+} mono_rint32;
+
+typedef union {
+ char c [8];
+ guint64 i;
+} mono_rint64;
+
+guint16
+mono_read16 (const unsigned char *x)
+{
+ mono_rint16 r;
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ r.c [0] = x [0];
+ r.c [1] = x [1];
+#else
+ r.c [1] = x [0];
+ r.c [0] = x [1];
+#endif
+ return r.i;
+}
+
+guint32
+mono_read32 (const unsigned char *x)
+{
+ mono_rint32 r;
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ r.c [0] = x [0];
+ r.c [1] = x [1];
+ r.c [2] = x [2];
+ r.c [3] = x [3];
+#else
+ r.c [3] = x [0];
+ r.c [2] = x [1];
+ r.c [1] = x [2];
+ r.c [0] = x [3];
+#endif
+ return r.i;
+}
+
+guint64
+mono_read64 (const unsigned char *x)
+{
+ mono_rint64 r;
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ r.c [0] = x [0];
+ r.c [1] = x [1];
+ r.c [2] = x [2];
+ r.c [3] = x [3];
+ r.c [4] = x [4];
+ r.c [5] = x [5];
+ r.c [6] = x [6];
+ r.c [7] = x [7];
+#else
+ r.c [7] = x [0];
+ r.c [6] = x [1];
+ r.c [5] = x [2];
+ r.c [4] = x [3];
+ r.c [3] = x [4];
+ r.c [2] = x [5];
+ r.c [1] = x [6];
+ r.c [0] = x [7];
+#endif
+ return r.i;
+}
+
+#endif
diff --git a/mono/metadata/mono-endian.h b/mono/metadata/mono-endian.h
new file mode 100644
index 00000000000..c371250f91b
--- /dev/null
+++ b/mono/metadata/mono-endian.h
@@ -0,0 +1,48 @@
+#ifndef _MONO_METADATA_ENDIAN_H_
+#define _MONO_METADATA_ENDIAN_H_ 1
+
+#include <glib.h>
+
+typedef union {
+ guint32 ival;
+ float fval;
+} mono_rfloat;
+
+typedef union {
+ guint64 ival;
+ double fval;
+} mono_rdouble;
+
+#if NO_UNALIGNED_ACCESS
+
+guint16 mono_read16 (const unsigned char *x);
+guint32 mono_read32 (const unsigned char *x);
+guint64 mono_read64 (const unsigned char *x);
+
+#define read16(x) (mono_read16 ((x)))
+#define read32(x) (mono_read32 ((x)))
+#define read64(x) (mono_read64 ((x)))
+
+#else
+
+#define read16(x) GUINT16_FROM_LE (*((const guint16 *) (x)))
+#define read32(x) GUINT32_FROM_LE (*((const guint32 *) (x)))
+#define read64(x) GUINT64_FROM_LE (*((const guint64 *) (x)))
+
+#endif
+
+#define readr4(x,dest) \
+ do { \
+ mono_rfloat mf; \
+ mf.ival = read32 ((x)); \
+ *(dest) = mf.fval; \
+ } while (0)
+
+#define readr8(x,dest) \
+ do { \
+ mono_rdouble mf; \
+ mf.ival = read64 ((x)); \
+ *(dest) = mf.fval; \
+ } while (0)
+
+#endif /* _MONO_METADATA_ENDIAN_H_ */
diff --git a/mono/metadata/object.c b/mono/metadata/object.c
new file mode 100644
index 00000000000..83077d647b6
--- /dev/null
+++ b/mono/metadata/object.c
@@ -0,0 +1,1192 @@
+/*
+ * object.c: Object creation for the Mono runtime
+ *
+ * Author:
+ * Miguel de Icaza (miguel@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <signal.h>
+#include <string.h>
+#include <mono/metadata/mono-endian.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/tokentype.h>
+#include <mono/metadata/loader.h>
+#include <mono/metadata/object.h>
+#include <mono/metadata/gc.h>
+#include <mono/metadata/appdomain.h>
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#endif
+
+MonoStats mono_stats;
+
+/* next object id for object hashcode */
+static guint32 uoid = 0;
+
+void
+mono_runtime_object_init (MonoObject *this)
+{
+ int i;
+ MonoMethod *method = NULL;
+ MonoClass *klass = this->vtable->klass;
+
+ for (i = 0; i < klass->method.count; ++i) {
+ if (!strcmp (".ctor", klass->methods [i]->name) &&
+ klass->methods [i]->signature->param_count == 0) {
+ method = klass->methods [i];
+ break;
+ }
+ }
+
+ g_assert (method);
+
+ mono_runtime_invoke (method, this, NULL);
+}
+
+/*
+ * runtime_class_init:
+ * @klass: klass that needs to be initialized
+ *
+ * This routine calls the class constructor for @class.
+ */
+void
+mono_runtime_class_init (MonoClass *klass)
+{
+ int i;
+
+ for (i = 0; i < klass->method.count; ++i) {
+ MonoMethod *method = klass->methods [i];
+ if ((method->flags & METHOD_ATTRIBUTE_SPECIAL_NAME) &&
+ (strcmp (".cctor", method->name) == 0)) {
+ mono_runtime_invoke (method, NULL, NULL);
+ return;
+ }
+ }
+ /* No class constructor found */
+}
+
+static gpointer
+default_trampoline (MonoMethod *method)
+{
+ return method;
+}
+
+static gpointer
+default_remoting_trampoline (MonoMethod *method)
+{
+ g_error ("remoting not installed");
+ return NULL;
+}
+
+static MonoTrampoline arch_create_jit_trampoline = default_trampoline;
+static MonoTrampoline arch_create_remoting_trampoline = default_remoting_trampoline;
+
+void
+mono_install_trampoline (MonoTrampoline func)
+{
+ arch_create_jit_trampoline = func? func: default_trampoline;
+}
+
+void
+mono_install_remoting_trampoline (MonoTrampoline func)
+{
+ arch_create_remoting_trampoline = func? func: default_remoting_trampoline;
+}
+
+#if 0 && HAVE_BOEHM_GC
+static void
+vtable_finalizer (void *obj, void *data) {
+ g_print ("%s finalized (%p)\n", (char*)data, obj);
+}
+#endif
+
+/**
+ * mono_class_vtable:
+ * @domain: the application domain
+ * @class: the class to initialize
+ *
+ * VTables are domain specific because we create domain specific code, and
+ * they contain the domain specific static class data.
+ */
+MonoVTable *
+mono_class_vtable (MonoDomain *domain, MonoClass *class)
+{
+ MonoClass *k;
+ MonoVTable *vt;
+ MonoClassField *field;
+ guint32 cindex;
+ guint32 cols [MONO_CONSTANT_SIZE];
+ const char *p;
+ char *t;
+ int i, len;
+
+ g_assert (class);
+
+ /* can interfaces have static fields? */
+ if (class->flags & TYPE_ATTRIBUTE_INTERFACE)
+ g_assert_not_reached ();
+
+ mono_domain_lock (domain);
+ if ((vt = mono_g_hash_table_lookup (domain->class_vtable_hash, class))) {
+ mono_domain_unlock (domain);
+ return vt;
+ }
+
+ if (!class->inited)
+ mono_class_init (class);
+
+// mono_stats.used_class_count++;
+// mono_stats.class_vtable_size += sizeof (MonoVTable) + class->vtable_size * sizeof (gpointer);
+
+ vt = mono_mempool_alloc0 (domain->mp, sizeof (MonoVTable) +
+ class->vtable_size * sizeof (gpointer));
+ vt->klass = class;
+ vt->domain = domain;
+
+ if (class->class_size) {
+#if HAVE_BOEHM_GC
+ vt->data = GC_malloc (class->class_size + 8);
+ /*vt->data = GC_debug_malloc (class->class_size + 8, class->name, 2);*/
+ /*GC_register_finalizer (vt->data, vtable_finalizer, class->name, NULL, NULL);*/
+ mono_g_hash_table_insert (domain->static_data_hash, class, vt->data);
+#else
+ vt->data = mono_mempool_alloc0 (domain->mp, class->class_size + 8);
+
+#endif
+// mono_stats.class_static_data_size += class->class_size + 8;
+ }
+
+ for (i = class->field.first; i < class->field.last; ++i) {
+ field = &class->fields [i - class->field.first];
+ if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC))
+ continue;
+ if (!(field->type->attrs & FIELD_ATTRIBUTE_HAS_DEFAULT))
+ continue;
+ cindex = mono_metadata_get_constant_index (class->image, MONO_TOKEN_FIELD_DEF | (i + 1));
+ if (!cindex) {
+ g_warning ("constant for field %s not found", field->name);
+ continue;
+ }
+ mono_metadata_decode_row (&class->image->tables [MONO_TABLE_CONSTANT], cindex - 1, cols, MONO_CONSTANT_SIZE);
+ p = mono_metadata_blob_heap (class->image, cols [MONO_CONSTANT_VALUE]);
+ len = mono_metadata_decode_blob_size (p, &p);
+ t = (char*)vt->data + field->offset;
+ /* should we check that the type matches? */
+ switch (cols [MONO_CONSTANT_TYPE]) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ *t = *p;
+ break;
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2: {
+ guint16 *val = (guint16*)t;
+ *val = read16 (p);
+ break;
+ }
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4: {
+ guint32 *val = (guint32*)t;
+ *val = read32 (p);
+ break;
+ }
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8: {
+ guint64 *val = (guint64*)t;
+ *val = read64 (p);
+ break;
+ }
+ case MONO_TYPE_R4: {
+ float *val = (float*)t;
+ readr4 (p, val);
+ break;
+ }
+ case MONO_TYPE_R8: {
+ double *val = (double*)t;
+ readr8 (p, val);
+ break;
+ }
+ case MONO_TYPE_STRING: {
+ //gpointer *val = (gpointer*)t;
+ //*val = mono_string_new_utf16 (domain, (const guint16*)p, len/2);
+ break;
+ }
+ case MONO_TYPE_CLASS:
+ /* nothing to do, we malloc0 the data and the value can be 0 only */
+ break;
+ default:
+ g_warning ("type 0x%02x should not be in constant table", cols [MONO_CONSTANT_TYPE]);
+ }
+ }
+
+ vt->max_interface_id = class->max_interface_id;
+
+ vt->interface_offsets = mono_mempool_alloc0 (domain->mp,
+ sizeof (gpointer) * (class->max_interface_id + 1));
+
+ /* initialize interface offsets */
+ for (k = class; k ; k = k->parent) {
+ for (i = 0; i < k->interface_count; i++) {
+ int slot;
+ MonoClass *ic = k->interfaces [i];
+ slot = class->interface_offsets [ic->interface_id];
+ vt->interface_offsets [ic->interface_id] = &vt->vtable [slot];
+ }
+ }
+
+ /* initialize vtable */
+ for (i = 0; i < class->vtable_size; ++i) {
+ MonoMethod *cm;
+
+ if ((cm = class->vtable [i]))
+ vt->vtable [i] = arch_create_jit_trampoline (cm);
+ }
+
+ mono_g_hash_table_insert (domain->class_vtable_hash, class, vt);
+ mono_domain_unlock (domain);
+
+ mono_runtime_class_init (class);
+
+ return vt;
+}
+
+/**
+ * mono_class_proxy_vtable:
+ * @domain: the application domain
+ * @class: the class to proxy
+ *
+ * Creates a vtable for transparent proxies. It is basically
+ * a copy of the real vtable of @class, but all function pointers invoke
+ * the remoting functions, and vtable->klass points to the
+ * transparent proxy class, and not to @class.
+ */
+MonoVTable *
+mono_class_proxy_vtable (MonoDomain *domain, MonoClass *class)
+{
+ MonoVTable *vt, *pvt;
+ int i, vtsize;
+
+ if ((pvt = mono_g_hash_table_lookup (domain->proxy_vtable_hash, class)))
+ return pvt;
+
+ vt = mono_class_vtable (domain, class);
+ vtsize = sizeof (MonoVTable) + class->vtable_size * sizeof (gpointer);
+
+// mono_stats.class_vtable_size += vtsize;
+
+ pvt = mono_mempool_alloc (domain->mp, vtsize);
+ memcpy (pvt, vt, vtsize);
+
+ pvt->klass = mono_defaults.transparent_proxy_class;
+
+ /* initialize vtable */
+ for (i = 0; i < class->vtable_size; ++i) {
+ MonoMethod *cm;
+
+ if ((cm = class->vtable [i]))
+ pvt->vtable [i] = arch_create_remoting_trampoline (cm);
+ }
+
+ mono_g_hash_table_insert (domain->proxy_vtable_hash, class, pvt);
+
+ return pvt;
+}
+
+static MonoInvokeFunc default_mono_runtime_invoke = NULL;
+
+MonoObject*
+mono_runtime_invoke (MonoMethod *method, void *obj, void **params)
+{
+ if (!default_mono_runtime_invoke) {
+ g_error ("runtime invoke called on uninitialized runtime");
+ return NULL;
+ }
+ return default_mono_runtime_invoke (method, obj, params);
+}
+
+int
+mono_runtime_exec_main (MonoMethod *method, MonoArray *args)
+{
+ gpointer pa [1];
+
+ pa [0] = args;
+
+ if (method->signature->ret->type == MONO_TYPE_I4) {
+ MonoObject *res;
+ res = mono_runtime_invoke (method, NULL, pa);
+ return *(guint32 *)((char *)res + sizeof (MonoObject));
+ } else {
+ mono_runtime_invoke (method, NULL, pa);
+ return 0;
+ }
+}
+
+void
+mono_install_runtime_invoke (MonoInvokeFunc func)
+{
+ default_mono_runtime_invoke = func;
+}
+
+MonoObject*
+mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params)
+{
+ MonoMethodSignature *sig = method->signature;
+ gpointer *pa = NULL;
+ int i;
+
+ if (NULL != params) {
+ pa = alloca (sizeof (gpointer) * mono_array_length (params));
+ for (i = 0; i < mono_array_length (params); i++) {
+ if (sig->params [i]->byref) {
+ /* nothing to do */
+ }
+
+ switch (sig->params [i]->type) {
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_U:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_VALUETYPE:
+ pa [i] = (char *)(((gpointer *)params->vector)[i]) + sizeof (MonoObject);
+ break;
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_CLASS:
+ pa [i] = (char *)(((gpointer *)params->vector)[i]);
+ break;
+ default:
+ g_error ("type 0x%x not handled in ves_icall_InternalInvoke", sig->params [i]->type);
+ }
+ }
+ }
+
+ if (!strcmp (method->name, ".ctor")) {
+ obj = mono_object_new (mono_domain_get (), method->klass);
+ mono_runtime_invoke (method, obj, pa);
+ return obj;
+ } else
+ return mono_runtime_invoke (method, obj, pa);
+}
+
+/**
+ * mono_object_allocate:
+ * @size: number of bytes to allocate
+ *
+ * This is a very simplistic routine until we have our GC-aware
+ * memory allocator.
+ *
+ * Returns: an allocated object of size @size, or NULL on failure.
+ */
+void *
+mono_object_allocate (size_t size)
+{
+#if HAVE_BOEHM_GC
+ void *o = GC_debug_malloc (size, "object", 1);
+#else
+ void *o = calloc (1, size);
+#endif
+
+ return o;
+}
+
+/**
+ * mono_object_free:
+ *
+ * Frees the memory used by the object. Debugging purposes
+ * only, as we will have our GC system.
+ */
+void
+mono_object_free (MonoObject *o)
+{
+#if HAVE_BOEHM_GC
+ g_error ("mono_object_free called with boehm gc.");
+#else
+ MonoClass *c = o->vtable->klass;
+
+ memset (o, 0, c->instance_size);
+ free (o);
+#endif
+}
+
+/**
+ * mono_object_new:
+ * @klass: the class of the object that we want to create
+ *
+ * Returns: A newly created object whose definition is
+ * looked up using @klass
+ */
+MonoObject *
+mono_object_new (MonoDomain *domain, MonoClass *klass)
+{
+ return mono_object_new_specific (mono_class_vtable (domain, klass));
+}
+
+/**
+ * mono_object_new_specific:
+ * @vtable: the vtable of the object that we want to create
+ *
+ * Returns: A newly created object with class and domain specified
+ * by @vtable
+ */
+MonoObject *
+mono_object_new_specific (MonoVTable *vtable)
+{
+ MonoObject *o;
+
+ mono_stats.new_object_count++; /* thread safe? */
+
+ if (vtable->klass->ghcimpl)
+ o = mono_object_allocate (vtable->klass->instance_size);
+ else {
+ guint32 *t;
+ t = mono_object_allocate (vtable->klass->instance_size + 4);
+ *t = ++uoid;
+ o = (MonoObject *)(++t);
+ }
+ o->vtable = vtable;
+ if (vtable->klass->has_finalize)
+ mono_object_register_finalizer (o);
+
+ return o;
+}
+
+/**
+ * mono_object_new_from_token:
+ * @image: Context where the type_token is hosted
+ * @token: a token of the type that we want to create
+ *
+ * Returns: A newly created object whose definition is
+ * looked up using @token in the @image image
+ */
+MonoObject *
+mono_object_new_from_token (MonoDomain *domain, MonoImage *image, guint32 token)
+{
+ MonoClass *class;
+
+ class = mono_class_get (image, token);
+
+ return mono_object_new (domain, class);
+}
+
+
+/**
+ * mono_object_clone:
+ * @obj: the object to clone
+ *
+ * Returns: A newly created object who is a shallow copy of @obj
+ */
+MonoObject *
+mono_object_clone (MonoObject *obj)
+{
+ MonoObject *o;
+ int size;
+
+ size = obj->vtable->klass->instance_size;
+ o = mono_object_allocate (size);
+
+ memcpy (o, obj, size);
+
+ if (obj->vtable->klass->has_finalize)
+ mono_object_register_finalizer (o);
+ return o;
+}
+
+/**
+ * mono_array_clone:
+ * @array: the array to clone
+ *
+ * Returns: A newly created array who is a shallow copy of @array
+ */
+MonoArray*
+mono_array_clone (MonoArray *array)
+{
+ MonoArray *o;
+ int size, i;
+ guint32 *sizes;
+ MonoClass *klass = array->obj.vtable->klass;
+
+ if (array->bounds == NULL) {
+ size = mono_array_length (array);
+ o = mono_array_new_full (((MonoObject *)array)->vtable->domain,
+ klass, &size, NULL);
+
+ size *= mono_array_element_size (klass);
+ memcpy (o, array, sizeof (MonoArray) + size);
+
+ return o;
+ }
+
+ sizes = alloca (klass->rank * sizeof(guint32) * 2);
+ size = mono_array_element_size (klass);
+ for (i = 0; i < klass->rank; ++i) {
+ sizes [i] = array->bounds [i].length;
+ size *= array->bounds [i].length;
+ sizes [i + klass->rank] = array->bounds [i].lower_bound;
+ }
+ o = mono_array_new_full (((MonoObject *)array)->vtable->domain,
+ klass, sizes, sizes + klass->rank);
+ memcpy (o, array, sizeof(MonoArray) + size);
+
+ return o;
+}
+
+/*
+ * mono_array_new_full:
+ * @domain: domain where the object is created
+ * @array_class: array class
+ * @lengths: lengths for each dimension in the array
+ * @lower_bounds: lower bounds for each dimension in the array (may be NULL)
+ *
+ * This routine creates a new array objects with the given dimensions,
+ * lower bounds and type.
+ */
+MonoArray*
+mono_array_new_full (MonoDomain *domain, MonoClass *array_class,
+ guint32 *lengths, guint32 *lower_bounds)
+{
+ guint32 byte_len, len;
+ MonoObject *o;
+ MonoArray *array;
+ MonoArrayBounds *bounds;
+ int i;
+
+ if (!array_class->inited)
+ mono_class_init (array_class);
+
+ byte_len = mono_array_element_size (array_class);
+ len = 1;
+
+ if (array_class->rank == 1 &&
+ (lower_bounds == NULL || lower_bounds [0] == 0)) {
+ bounds = NULL;
+ len = lengths [0];
+ } else {
+ #if HAVE_BOEHM_GC
+ bounds = GC_debug_malloc (sizeof (MonoArrayBounds) * array_class->rank, "bounds", 0);
+ #else
+ bounds = g_malloc0 (sizeof (MonoArrayBounds) * array_class->rank);
+ #endif
+ for (i = 0; i < array_class->rank; ++i) {
+ bounds [i].length = lengths [i];
+ len *= lengths [i];
+ }
+
+ if (lower_bounds)
+ for (i = 0; i < array_class->rank; ++i)
+ bounds [i].lower_bound = lower_bounds [i];
+ }
+
+ byte_len *= len;
+ /*
+ * Following three lines almost taken from mono_object_new ():
+ * they need to be kept in sync.
+ */
+ o = mono_object_allocate (sizeof (MonoArray) + byte_len);
+ if (!o)
+ G_BREAKPOINT ();
+ o->vtable = mono_class_vtable (domain, array_class);
+
+ array = (MonoArray*)o;
+
+ array->bounds = bounds;
+ array->max_length = len;
+
+ return array;
+}
+
+/*
+ * mono_array_new:
+ * @domain: domain where the object is created
+ * @eclass: element class
+ * @n: number of array elements
+ *
+ * This routine creates a new szarray with @n elements of type @eclass.
+ */
+MonoArray *
+mono_array_new (MonoDomain *domain, MonoClass *eclass, guint32 n)
+{
+ MonoClass *ac;
+
+ ac = mono_array_class_get (&eclass->byval_arg, 1);
+ g_assert (ac != NULL);
+
+ return mono_array_new_specific (mono_class_vtable (domain, ac), n);
+}
+
+/*
+ * mono_array_new_specific:
+ * @vtable: a vtable in the appropriate domain for an initialized class
+ * @n: number of array elements
+ *
+ * This routine is a fast alternative to mono_array_new() for code which
+ * can be sure about the domain it operates in.
+ */
+MonoArray *
+mono_array_new_specific (MonoVTable *vtable, guint32 n)
+{
+ MonoObject *o;
+ MonoArray *ao;
+ gsize byte_len;
+
+ byte_len = n * mono_array_element_size (vtable->klass);
+ o = mono_object_allocate (sizeof (MonoArray) + byte_len);
+ if (!o)
+ G_BREAKPOINT ();
+ o->vtable = vtable;
+
+ ao = (MonoArray *)o;
+ ao->bounds = NULL;
+ ao->max_length = n;
+
+ return ao;
+}
+
+/**
+ * mono_string_new_utf16:
+ * @text: a pointer to an utf16 string
+ * @len: the length of the string
+ *
+ * Returns: A newly created string object which contains @text.
+ */
+MonoString *
+mono_string_new_utf16 (MonoDomain *domain, const guint16 *text, gint32 len)
+{
+ MonoString *s;
+
+ s = mono_string_new_size (domain, len);
+ g_assert (s != NULL);
+
+ memcpy (mono_string_chars (s), text, len * 2);
+
+ return s;
+}
+
+/**
+ * mono_string_new_size:
+ * @text: a pointer to an utf16 string
+ * @len: the length of the string
+ *
+ * Returns: A newly created string object of @len
+ */
+MonoString *
+mono_string_new_size (MonoDomain *domain, gint32 len)
+{
+ MonoString *s;
+
+ s = (MonoString*)mono_object_allocate (sizeof (MonoString) + ((len + 1) * 2));
+ if (!s)
+ G_BREAKPOINT ();
+
+ s->object.vtable = mono_class_vtable (domain, mono_defaults.string_class);
+ s->length = len;
+
+ return s;
+}
+
+/*
+ * mono_string_new_len:
+ * @text: a pointer to an utf8 string
+ * @length: number of bytes in @text to consider
+ *
+ * Returns: A newly created string object which contains @text.
+ */
+MonoString*
+mono_string_new_len (MonoDomain *domain, const char *text, guint length)
+{
+ GError *error = NULL;
+ MonoString *o = NULL;
+ guint16 *ut;
+ glong items_written;
+
+
+ ut = g_utf8_to_utf16 (text, length, NULL, &items_written, &error);
+
+ if (!error)
+ o = mono_string_new_utf16 (domain, ut, items_written);
+ else
+ g_error_free (error);
+
+ g_free (ut);
+
+ return o;
+}
+
+/**
+ * mono_string_new:
+ * @text: a pointer to an utf8 string
+ *
+ * Returns: A newly created string object which contains @text.
+ */
+MonoString*
+mono_string_new (MonoDomain *domain, const char *text)
+{
+ GError *error = NULL;
+ MonoString *o = NULL;
+ guint16 *ut;
+ glong items_written;
+ int l;
+
+ l = strlen (text);
+
+ ut = g_utf8_to_utf16 (text, l, NULL, &items_written, &error);
+
+ if (!error)
+ o = mono_string_new_utf16 (domain, ut, items_written);
+ else
+ g_error_free (error);
+
+ g_free (ut);
+
+ return o;
+}
+
+/*
+ * mono_string_new_wrapper:
+ * @text: pointer to utf8 characters.
+ *
+ * Helper function to create a string object from @text in the current domain.
+ */
+MonoString*
+mono_string_new_wrapper (const char *text)
+{
+ MonoDomain *domain = mono_domain_get ();
+
+ return mono_string_new (domain, text);
+}
+
+/**
+ * mono_value_box:
+ * @class: the class of the value
+ * @value: a pointer to the unboxed data
+ *
+ * Returns: A newly created object which contains @value.
+ */
+MonoObject *
+mono_value_box (MonoDomain *domain, MonoClass *class, gpointer value)
+{
+ MonoObject *res;
+ int size;
+
+ g_assert (class->valuetype);
+
+ size = mono_class_instance_size (class);
+ res = mono_object_allocate (size);
+ res->vtable = mono_class_vtable (domain, class);
+
+ size = size - sizeof (MonoObject);
+
+ memcpy ((char *)res + sizeof (MonoObject), value, size);
+
+ if (class->has_finalize)
+ mono_object_register_finalizer (res);
+ return res;
+}
+
+/**
+ * mono_object_isinst:
+ * @obj: an object
+ * @klass: a pointer to a class
+ *
+ * Returns: @obj if @obj is derived from @klass
+ */
+MonoObject *
+mono_object_isinst (MonoObject *obj, MonoClass *klass)
+{
+ MonoVTable *vt;
+ MonoClass *oklass;
+
+ if (!obj)
+ return NULL;
+
+ vt = obj->vtable;
+ oklass = vt->klass;
+
+ if (!klass->inited)
+ mono_class_init (klass);
+
+ if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+ if ((klass->interface_id <= oklass->max_interface_id) &&
+ vt->interface_offsets [klass->interface_id])
+ return obj;
+ } else {
+ if (oklass == mono_defaults.transparent_proxy_class) {
+ /* fixme: add check for IRemotingTypeInfo */
+ oklass = ((MonoTransparentProxy *)obj)->klass;
+ }
+ if (klass->rank) {
+ if (oklass->rank == klass->rank &&
+ (oklass->element_class->baseval - klass->element_class->baseval) <=
+ klass->element_class->diffval)
+ return obj;
+
+ } else if ((oklass->baseval - klass->baseval) <= klass->diffval)
+ return obj;
+ }
+
+ return NULL;
+}
+
+static MonoString*
+mono_string_is_interned_lookup (MonoString *str, int insert)
+{
+ MonoGHashTable *ldstr_table;
+ MonoString *res;
+ MonoDomain *domain;
+ char *ins = g_malloc (4 + str->length * 2);
+ char *p;
+ int bloblen;
+
+ /* Encode the length */
+ p = ins;
+ mono_metadata_encode_value (2 * str->length, p, &p);
+ bloblen = p - ins;
+ p = ins;
+ mono_metadata_encode_value (bloblen + 2 * str->length, p, &p);
+ bloblen = (p - ins) + 2 * str->length;
+ /*
+ * ins is stored in the hash table as a key and needs to have the same
+ * representation as in the metadata: we swap the character bytes on big
+ * endian boxes.
+ */
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+ {
+ int i;
+ char *p2 = mono_string_chars (str);
+ for (i = 0; i < str->length; ++i) {
+ *p++ = p2 [1];
+ *p++ = p2 [0];
+ p2 += 2;
+ }
+ }
+#else
+ memcpy (p, mono_string_chars (str), str->length * 2);
+#endif
+ domain = ((MonoObject *)str)->vtable->domain;
+ ldstr_table = domain->ldstr_table;
+ mono_domain_lock (domain);
+ if ((res = mono_g_hash_table_lookup (ldstr_table, ins))) {
+ mono_domain_unlock (domain);
+ g_free (ins);
+ return res;
+ }
+ if (insert) {
+ mono_g_hash_table_insert (ldstr_table, ins, str);
+ mono_domain_unlock (domain);
+ return str;
+ }
+ mono_domain_unlock (domain);
+ g_free (ins);
+ return NULL;
+}
+
+MonoString*
+mono_string_is_interned (MonoString *o)
+{
+ return mono_string_is_interned_lookup (o, FALSE);
+}
+
+MonoString*
+mono_string_intern (MonoString *str)
+{
+ return mono_string_is_interned_lookup (str, TRUE);
+}
+
+/*
+ * mono_ldstr:
+ * @domain: the domain where the string will be used.
+ * @image: a metadata context
+ * @idx: index into the user string table.
+ *
+ * Implementation for the ldstr opcode.
+ */
+MonoString*
+mono_ldstr (MonoDomain *domain, MonoImage *image, guint32 idx)
+{
+ const char *str, *sig;
+ MonoString *o;
+ size_t len2;
+
+ sig = str = mono_metadata_user_string (image, idx);
+
+ mono_domain_lock (domain);
+ if ((o = mono_g_hash_table_lookup (domain->ldstr_table, sig))) {
+ mono_domain_unlock (domain);
+ return o;
+ }
+
+ len2 = mono_metadata_decode_blob_size (str, &str);
+ len2 >>= 1;
+
+ o = mono_string_new_utf16 (domain, (guint16*)str, len2);
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+ {
+ int i;
+ guint16 *p2 = (guint16*)mono_array_addr (o->c_str, guint16, 0);
+ for (i = 0; i < len2; ++i) {
+ *p2 = GUINT16_FROM_LE (*p2);
+ ++p2;
+ }
+ }
+#endif
+ mono_g_hash_table_insert (domain->ldstr_table, (gpointer)sig, o);
+ mono_domain_unlock (domain);
+
+ return o;
+}
+
+/*
+ * mono_string_to_utf8:
+ * @s: a System.String
+ *
+ * Return the UTF8 representation for @s.
+ * the resulting buffer nedds to be freed with g_free().
+ */
+char *
+mono_string_to_utf8 (MonoString *s)
+{
+ char *as;
+ GError *error = NULL;
+
+ g_assert (s != NULL);
+
+ if (!s->length)
+ return g_strdup ("");
+
+ as = g_utf16_to_utf8 (mono_string_chars (s), s->length, NULL, NULL, &error);
+ if (error)
+ g_warning (error->message);
+
+ return as;
+}
+
+/*
+ * mono_string_to_utf16:
+ * @s: a MonoString
+ *
+ * Return an null-terminated array of the utf-16 chars
+ * contained in @s. The result must be freed with g_free().
+ * This is a temporary helper until our string implementation
+ * is reworked to always include the null terminating char.
+ */
+gunichar2 *
+mono_string_to_utf16 (MonoString *s)
+{
+ char *as;
+
+ g_assert (s != NULL);
+
+ as = g_malloc ((s->length * 2) + 2);
+ as [(s->length * 2)] = '\0';
+ as [(s->length * 2) + 1] = '\0';
+
+ if (!s->length) {
+ return (gunichar2 *)(as);
+ }
+
+ memcpy (as, mono_string_chars(s), s->length * 2);
+
+ return (gunichar2 *)(as);
+}
+
+static void
+default_ex_handler (MonoException *ex)
+{
+ MonoObject *o = (MonoObject*)ex;
+ g_error ("Exception %s.%s raised in C code", o->vtable->klass->name_space, o->vtable->klass->name);
+}
+
+static MonoExceptionFunc ex_handler = default_ex_handler;
+
+void
+mono_install_handler (MonoExceptionFunc func)
+{
+ ex_handler = func? func: default_ex_handler;
+}
+
+/*
+ * mono_raise_exception:
+ * @ex: exception object
+ *
+ * Signal the runtime that the exception @ex has been raised in unmanaged code.
+ */
+void
+mono_raise_exception (MonoException *ex)
+{
+ ex_handler (ex);
+}
+
+MonoWaitHandle *
+mono_wait_handle_new (MonoDomain *domain, HANDLE handle)
+{
+ MonoWaitHandle *res;
+
+ res = (MonoWaitHandle *)mono_object_new (domain, mono_defaults.waithandle_class);
+
+ res->handle = handle;
+
+ return res;
+}
+
+MonoAsyncResult *
+mono_async_result_new (MonoDomain *domain, HANDLE handle, MonoObject *state, gpointer data)
+{
+ MonoAsyncResult *res;
+
+ res = (MonoAsyncResult *)mono_object_new (domain, mono_defaults.asyncresult_class);
+
+ res->data = data;
+ res->async_state = state;
+ res->handle = (MonoObject *)mono_wait_handle_new (domain, handle);
+ res->sync_completed = FALSE;
+ res->completed = FALSE;
+
+ return res;
+}
+
+void
+mono_message_init (MonoDomain *domain,
+ MonoMethodMessage *this,
+ MonoReflectionMethod *method,
+ MonoArray *out_args)
+{
+ MonoMethodSignature *sig = method->method->signature;
+ MonoString *name;
+ int i, j;
+ char **names;
+ guint8 arg_type;
+
+ this->method = method;
+
+ this->args = mono_array_new (domain, mono_defaults.object_class, sig->param_count);
+ this->arg_types = mono_array_new (domain, mono_defaults.byte_class, sig->param_count);
+
+ names = g_new (char *, sig->param_count);
+ mono_method_get_param_names (method->method, (const char **) names);
+ this->names = mono_array_new (domain, mono_defaults.string_class, sig->param_count);
+
+ for (i = 0; i < sig->param_count; i++) {
+ name = mono_string_new (domain, names [i]);
+ mono_array_set (this->names, gpointer, i, name);
+ }
+
+ g_free (names);
+
+ for (i = 0, j = 0; i < sig->param_count; i++) {
+
+ if (sig->params [i]->byref) {
+ if (out_args) {
+ gpointer arg = mono_array_get (out_args, gpointer, j);
+ mono_array_set (this->args, gpointer, i, arg);
+ j++;
+ }
+ arg_type = 2;
+ if (sig->params [i]->attrs & PARAM_ATTRIBUTE_IN)
+ arg_type |= 1;
+ } else {
+ arg_type = 1;
+ }
+
+ mono_array_set (this->arg_types, guint8, i, arg_type);
+ }
+}
+
+/**
+ * mono_remoting_invoke:
+ * @real_proxy: pointer to a RealProxy object
+ * @msg: The MonoMethodMessage to execute
+ * @exc: used to store exceptions
+ * @out_args: used to store output arguments
+ *
+ * This is used to call RealProxy::Invoke(). RealProxy::Invoke() returns an
+ * IMessage interface and it is not trivial to extract results from there. So
+ * we call an helper method PrivateInvoke instead of calling
+ * RealProxy::Invoke() directly.
+ *
+ * Returns: the result object.
+ */
+MonoObject *
+mono_remoting_invoke (MonoObject *real_proxy, MonoMethodMessage *msg,
+ MonoObject **exc, MonoArray **out_args)
+{
+ static MonoMethod *im = NULL;
+ gpointer pa [4];
+
+ //static MonoObject *(*invoke) (gpointer, gpointer, MonoObject **, MonoArray **) = NULL;
+
+ /* fixme: make this domain dependent */
+ if (!im) {
+ MonoClass *klass;
+ int i;
+
+ klass = mono_defaults.real_proxy_class;
+
+ for (i = 0; i < klass->method.count; ++i) {
+ if (!strcmp ("PrivateInvoke", klass->methods [i]->name) &&
+ klass->methods [i]->signature->param_count == 4) {
+ im = klass->methods [i];
+ break;
+ }
+ }
+
+ g_assert (im);
+ }
+
+ pa [0] = real_proxy;
+ pa [1] = msg;
+ pa [2] = exc;
+ pa [3] = out_args;
+
+ return mono_runtime_invoke (im, NULL, pa);
+}
+
+MonoObject *
+mono_message_invoke (MonoObject *target, MonoMethodMessage *msg,
+ MonoObject **exc, MonoArray **out_args)
+{
+ if (target && target->vtable->klass == mono_defaults.transparent_proxy_class) {
+
+ return mono_remoting_invoke ((MonoObject *)((MonoTransparentProxy *)target)->rp,
+ msg, exc, out_args);
+
+ } else {
+ MonoDomain *domain = mono_domain_get ();
+ MonoMethod *method = msg->method->method;
+ MonoMethodSignature *sig = method->signature;
+ int i, j, outarg_count = 0;
+
+ for (i = 0; i < sig->param_count; i++) {
+ if (sig->params [i]->byref)
+ outarg_count++;
+ }
+
+ *out_args = mono_array_new (domain, mono_defaults.object_class, outarg_count);
+ *exc = NULL;
+
+ for (i = 0, j = 0; i < sig->param_count; i++) {
+ if (sig->params [i]->byref) {
+ gpointer arg;
+ arg = mono_array_get (msg->args, gpointer, i);
+ mono_array_set (*out_args, gpointer, j, arg);
+ j++;
+ }
+ }
+
+ return mono_runtime_invoke_array (method, target, msg->args);
+ }
+}
+
+
+
diff --git a/mono/metadata/object.h b/mono/metadata/object.h
new file mode 100644
index 00000000000..65daf10ceb7
--- /dev/null
+++ b/mono/metadata/object.h
@@ -0,0 +1,289 @@
+#ifndef _MONO_CLI_OBJECT_H_
+#define _MONO_CLI_OBJECT_H_
+
+#include <mono/metadata/class.h>
+#include <mono/metadata/threads-types.h>
+
+#if 1
+#define mono_assert(expr) G_STMT_START{ \
+ if (!(expr)) \
+ { \
+ MonoException *ex; \
+ char *msg = g_strdup_printf ("file %s: line %d (%s): " \
+ "assertion failed: (%s)", __FILE__, __LINE__, \
+ __PRETTY_FUNCTION__, #expr); \
+ ex = mono_get_exception_execution_engine (msg); \
+ g_free (msg); \
+ mono_raise_exception (ex); \
+ }; }G_STMT_END
+
+#define mono_assert_not_reached() G_STMT_START{ \
+ MonoException *ex; \
+ char *msg = g_strdup_printf ("file %s: line %d (%s): " \
+ "should not be reached", __FILE__, __LINE__, __PRETTY_FUNCTION__); \
+ ex = mono_get_exception_execution_engine (msg); \
+ g_free (msg); \
+ mono_raise_exception (ex); \
+}G_STMT_END
+#else
+#define mono_assert(expr) g_assert(expr)
+#define mono_assert_not_reached() g_assert_not_reached()
+#endif
+
+#define MONO_CHECK_ARG(arg, expr) G_STMT_START{ \
+ if (!(expr)) \
+ { \
+ MonoException *ex; \
+ char *msg = g_strdup_printf ("assertion `%s' failed", \
+ #expr); \
+ if (arg) {} /* check if the name exists */ \
+ ex = mono_get_exception_argument (#arg, msg); \
+ g_free (msg); \
+ mono_raise_exception (ex); \
+ }; }G_STMT_END
+
+#define MONO_CHECK_ARG_NULL(arg) G_STMT_START{ \
+ if (arg == NULL) \
+ { \
+ MonoException *ex; \
+ if (arg) {} /* check if the name exists */ \
+ ex = mono_get_exception_argument_null (#arg); \
+ mono_raise_exception (ex); \
+ }; }G_STMT_END
+
+typedef guchar MonoBoolean;
+
+typedef struct _MonoReflectionMethod MonoReflectionMethod;
+
+typedef struct {
+ MonoVTable *vtable;
+ MonoThreadsSync *synchronisation;
+} MonoObject;
+
+typedef struct {
+ guint32 length;
+ guint32 lower_bound;
+} MonoArrayBounds;
+
+typedef struct {
+ MonoObject obj;
+ /* bounds is NULL for szarrays */
+ MonoArrayBounds *bounds;
+ /* total number of elements of the array */
+ guint32 max_length;
+ /* we use double to ensure proper alignment on platforms that need it */
+ double vector [MONO_ZERO_LEN_ARRAY];
+} MonoArray;
+
+typedef struct {
+ MonoObject object;
+ gint32 length;
+ gunichar2 chars [MONO_ZERO_LEN_ARRAY];
+} MonoString;
+
+typedef struct {
+ MonoObject object;
+ MonoType *type;
+} MonoReflectionType;
+
+typedef struct {
+ MonoObject object;
+ MonoObject *inner_ex;
+ MonoString *message;
+ MonoString *help_link;
+ MonoString *class_name;
+ MonoString *stack_trace;
+ gint32 hresult;
+ MonoString *source;
+} MonoException;
+
+typedef struct {
+ MonoException base;
+} MonoSystemException;
+
+typedef struct {
+ MonoSystemException base;
+ MonoString *param_name;
+} MonoArgumentException;
+
+typedef struct {
+ MonoObject object;
+ MonoObject *async_state;
+ MonoObject *handle;
+ MonoObject *async_delegate;
+ gpointer data;
+ MonoBoolean sync_completed;
+ MonoBoolean completed;
+ MonoBoolean endinvoke_called;
+} MonoAsyncResult;
+
+typedef struct {
+ MonoObject object;
+ gpointer handle;
+ MonoBoolean disposed;
+} MonoWaitHandle;
+
+typedef struct {
+ MonoObject object;
+ MonoReflectionType *class_to_proxy;
+} MonoRealProxy;
+
+typedef struct {
+ MonoObject object;
+ MonoRealProxy *rp;
+ MonoClass *klass;
+} MonoTransparentProxy;
+
+typedef struct {
+ MonoObject obj;
+ MonoReflectionMethod *method;
+ MonoArray *args;
+ MonoArray *names;
+ MonoArray *arg_types;
+ MonoObject *ctx;
+ MonoObject *rval;
+ MonoObject *exc;
+} MonoMethodMessage;
+
+typedef struct {
+ gulong new_object_count;
+ gulong initialized_class_count;
+ gulong used_class_count;
+ gulong class_vtable_size;
+ gulong class_static_data_size;
+} MonoStats;
+
+typedef MonoObject* (*MonoInvokeFunc) (MonoMethod *method, void *obj, void **params);
+
+#define mono_object_class(obj) (((MonoObject*)(obj))->vtable->klass)
+#define mono_object_domain(obj) (((MonoObject*)(obj))->vtable->domain)
+
+#define mono_array_length(array) ((array)->max_length)
+#define mono_array_addr(array,type,index) ( ((char*)(array)->vector) + sizeof (type) * (index) )
+#define mono_array_addr_with_size(array,size,index) ( ((char*)(array)->vector) + (size) * (index) )
+#define mono_array_get(array,type,index) ( *(type*)mono_array_addr ((array), type, (index)) )
+#define mono_array_set(array,type,index,value) \
+ do { \
+ type *__p = (type *) mono_array_addr ((array), type, (index)); \
+ *__p = (value); \
+ } while (0)
+
+#define mono_string_chars(s) ((gunichar2*)(s)->chars)
+#define mono_string_length(s) ((s)->length)
+
+extern MonoStats mono_stats;
+
+void *
+mono_object_allocate (size_t size);
+
+MonoObject *
+mono_object_new (MonoDomain *domain, MonoClass *klass);
+
+MonoObject *
+mono_object_new_specific (MonoVTable *vtable);
+
+MonoObject *
+mono_object_new_from_token (MonoDomain *domain, MonoImage *image, guint32 token);
+
+MonoArray*
+mono_array_new (MonoDomain *domain, MonoClass *eclass, guint32 n);
+
+MonoArray*
+mono_array_new_full (MonoDomain *domain, MonoClass *array_class,
+ guint32 *lengths, guint32 *lower_bounds);
+
+MonoArray *
+mono_array_new_specific (MonoVTable *vtable, guint32 n);
+
+MonoArray*
+mono_array_clone (MonoArray *array);
+
+MonoString*
+mono_string_new_utf16 (MonoDomain *domain, const guint16 *text, gint32 len);
+
+MonoString*
+mono_string_new_size (MonoDomain *domain, gint32 len);
+
+MonoString*
+mono_ldstr (MonoDomain *domain, MonoImage *image, guint32 str_index);
+
+MonoString*
+mono_string_is_interned (MonoString *str);
+
+MonoString*
+mono_string_intern (MonoString *str);
+
+MonoString*
+mono_string_new (MonoDomain *domain, const char *text);
+
+MonoString*
+mono_string_new_wrapper (const char *text);
+
+MonoString*
+mono_string_new_len (MonoDomain *domain, const char *text, guint length);
+
+char *
+mono_string_to_utf8 (MonoString *string_obj);
+
+gunichar2 *
+mono_string_to_utf16 (MonoString *string_obj);
+
+void
+mono_object_free (MonoObject *o);
+
+MonoObject *
+mono_value_box (MonoDomain *domain, MonoClass *klass, gpointer val);
+
+MonoObject *
+mono_object_clone (MonoObject *obj);
+
+MonoObject *
+mono_object_isinst (MonoObject *obj, MonoClass *klass);
+
+typedef void (*MonoExceptionFunc) (MonoException *ex);
+
+void
+mono_install_handler (MonoExceptionFunc func);
+
+void
+mono_raise_exception (MonoException *ex);
+
+void
+mono_runtime_object_init (MonoObject *this);
+
+void
+mono_runtime_class_init (MonoClass *klass);
+
+void
+mono_install_runtime_invoke (MonoInvokeFunc func);
+
+MonoObject*
+mono_runtime_invoke (MonoMethod *method, void *obj, void **params);
+
+MonoObject*
+mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params);
+
+int
+mono_runtime_exec_main (MonoMethod *method, MonoArray *args);
+
+MonoAsyncResult *
+mono_async_result_new (MonoDomain *domain, HANDLE handle,
+ MonoObject *state, gpointer data);
+
+MonoWaitHandle *
+mono_wait_handle_new (MonoDomain *domain, HANDLE handle);
+
+void
+mono_message_init (MonoDomain *domain, MonoMethodMessage *this,
+ MonoReflectionMethod *method, MonoArray *out_args);
+
+MonoObject *
+mono_remoting_invoke (MonoObject *real_proxy, MonoMethodMessage *msg,
+ MonoObject **exc, MonoArray **out_args);
+
+MonoObject *
+mono_message_invoke (MonoObject *target, MonoMethodMessage *msg,
+ MonoObject **exc, MonoArray **out_args);
+
+#endif
+
diff --git a/mono/metadata/opcodes.c b/mono/metadata/opcodes.c
new file mode 100644
index 00000000000..9718ff5ac44
--- /dev/null
+++ b/mono/metadata/opcodes.c
@@ -0,0 +1,30 @@
+/*
+ * opcodes.c: CIL instruction information
+ *
+ * Author:
+ * Paolo Molaro (lupus@ximian.com)
+ *
+ * (C) 2002 Ximian, Inc.
+ */
+#include <mono/metadata/opcodes.h>
+#include <stddef.h> /* for NULL */
+
+#define OPDEF(a,b,c,d,e,f,g,h,i,j) \
+ { Mono ## e, MONO_FLOW_ ## j, ((g-1)<<8) | i },
+
+const MonoOpcode
+mono_opcodes [MONO_N_OPCODES] = {
+#include "mono/cil/opcode.def"
+ {0}
+};
+
+#undef OPDEF
+
+#define OPDEF(a,b,c,d,e,f,g,h,i,j) b,
+
+const char* const
+mono_opcode_names [MONO_N_OPCODES] = {
+#include "mono/cil/opcode.def"
+ NULL
+};
+
diff --git a/mono/metadata/opcodes.h b/mono/metadata/opcodes.h
new file mode 100644
index 00000000000..c5a3e6926c7
--- /dev/null
+++ b/mono/metadata/opcodes.h
@@ -0,0 +1,54 @@
+#ifndef __MONO_METADATA_OPCODES_H__
+#define __MONO_METADATA_OPCODES_H__
+
+/*
+ * opcodes.h: CIL instruction information
+ *
+ * Author:
+ * Paolo Molaro (lupus@ximian.com)
+ *
+ * (C) 2002 Ximian, Inc.
+ */
+
+enum {
+ MONO_FLOW_NEXT,
+ MONO_FLOW_BRANCH,
+ MONO_FLOW_COND_BRANCH,
+ MONO_FLOW_ERROR,
+ MONO_FLOW_CALL,
+ MONO_FLOW_RETURN,
+ MONO_FLOW_META
+};
+
+enum {
+ MonoInlineNone,
+ MonoInlineType,
+ MonoInlineField,
+ MonoInlineMethod,
+ MonoInlineTok,
+ MonoInlineString,
+ MonoInlineSig,
+ MonoInlineVar,
+ MonoShortInlineVar,
+ MonoInlineBrTarget,
+ MonoShortInlineBrTarget,
+ MonoInlineSwitch,
+ MonoInlineR,
+ MonoShortInlineR,
+ MonoInlineI,
+ MonoShortInlineI,
+ MonoInlineI8
+};
+
+typedef struct {
+ unsigned char argument;
+ unsigned char flow_type;
+ unsigned short opval;
+} MonoOpcode;
+
+#define MONO_N_OPCODES 300
+
+extern const MonoOpcode mono_opcodes [MONO_N_OPCODES];
+extern const char* const mono_opcode_names [MONO_N_OPCODES];
+
+#endif /* __MONO_METADATA_OPCODES_H__ */
diff --git a/mono/metadata/pedump.c b/mono/metadata/pedump.c
index 7a716cf3ea7..64da6ea3a27 100644
--- a/mono/metadata/pedump.c
+++ b/mono/metadata/pedump.c
@@ -8,12 +8,21 @@
*/
#include <config.h>
#include <stdio.h>
-#include "assembly.h"
+#include <stdlib.h>
+#include <string.h>
+#include "image.h"
#include <glib.h>
#include "cil-coff.h"
+#include "private.h"
+#include "mono-endian.h"
+#include "verify.h"
+#include <mono/metadata/class.h>
+
+gboolean dump_data = TRUE;
+gboolean verify_pe = FALSE;
static void
-hex_dump (char *buffer, int base, int count)
+hex_dump (const char *buffer, int base, int count)
{
int i;
@@ -26,25 +35,25 @@ hex_dump (char *buffer, int base, int count)
}
static void
-hex8 (char *label, unsigned char x)
+hex8 (const char *label, unsigned char x)
{
printf ("\t%s: 0x%02x\n", label, (unsigned char) x);
}
static void
-hex16 (char *label, guint16 x)
+hex16 (const char *label, guint16 x)
{
printf ("\t%s: 0x%04x\n", label, x);
}
static void
-hex32 (char *label, guint32 x)
+hex32 (const char *label, guint32 x)
{
printf ("\t%s: 0x%08x\n", label, x);
}
static void
-dump_coff_header (coff_header_t *coff)
+dump_coff_header (MonoCOFFHeader *coff)
{
printf ("\nCOFF Header:\n");
hex16 (" Machine", coff->coff_machine);
@@ -58,7 +67,7 @@ dump_coff_header (coff_header_t *coff)
}
static void
-dump_pe_header (pe_header_t *pe)
+dump_pe_header (MonoPEHeader *pe)
{
printf ("\nPE Header:\n");
hex16 (" Magic (0x010b)", pe->pe_magic);
@@ -74,7 +83,7 @@ dump_pe_header (pe_header_t *pe)
}
static void
-dump_nt_header (pe_header_nt_t *nt)
+dump_nt_header (MonoPEHeaderNT *nt)
{
printf ("\nNT Header:\n");
@@ -102,13 +111,13 @@ dump_nt_header (pe_header_nt_t *nt)
}
static void
-dent (const char *label, pe_dir_entry_t de)
+dent (const char *label, MonoPEDirEntry de)
{
printf ("\t%s: 0x%08x [0x%08x]\n", label, de.rva, de.size);
}
static void
-dump_datadir (pe_datadir_t *dd)
+dump_datadir (MonoPEDatadir *dd)
{
printf ("\nData directories:\n");
dent (" Export Table", dd->pe_export_table);
@@ -129,7 +138,7 @@ dump_datadir (pe_datadir_t *dd)
}
static void
-dump_dotnet_header (dotnet_header_t *header)
+dump_dotnet_header (MonoDotNetHeader *header)
{
dump_coff_header (&header->coff);
dump_pe_header (&header->pe);
@@ -138,7 +147,7 @@ dump_dotnet_header (dotnet_header_t *header)
}
static void
-dump_section_table (section_table_t *st)
+dump_section_table (MonoSectionTable *st)
{
guint32 flags = st->st_flags;
@@ -166,17 +175,17 @@ dump_section_table (section_table_t *st)
}
static void
-dump_sections (dotnet_image_info_t *iinfo)
+dump_sections (MonoCLIImageInfo *iinfo)
{
- const int top = iinfo->dn_header.coff.coff_sections;
+ const int top = iinfo->cli_header.coff.coff_sections;
int i;
for (i = 0; i < top; i++)
- dump_section_table (&iinfo->dn_section_tables [i]);
+ dump_section_table (&iinfo->cli_section_tables [i]);
}
static void
-dump_cli_header (cli_header_t *ch)
+dump_cli_header (MonoCLIHeader *ch)
{
printf ("\n");
printf (" CLI header size: %d\n", ch->ch_size);
@@ -195,114 +204,151 @@ dump_cli_header (cli_header_t *ch)
}
static void
-dsh (char *label, dotnet_image_info_t *iinfo, stream_header_t *sh)
+dsh (const char *label, MonoImage *meta, MonoStreamHeader *sh)
{
printf ("%s: 0x%08x - 0x%08x [%d == 0x%08x]\n",
label,
- sh->sh_offset, sh->sh_offset + sh->sh_size,
- sh->sh_size, sh->sh_size);
+ sh->data - meta->raw_metadata, sh->data + sh->size - meta->raw_metadata,
+ sh->size, sh->size);
}
static void
-dump_metadata_ptrs (dotnet_image_info_t *iinfo)
+dump_metadata_ptrs (MonoImage *meta)
{
- metadata_t *meta = &iinfo->dn_metadata;
-
printf ("\nMetadata pointers:\n");
- dsh ("\tTables (#~)", iinfo, &meta->heap_tables);
- dsh ("\t Strings", iinfo, &meta->heap_strings);
- dsh ("\t Blob", iinfo, &meta->heap_blob);
- dsh ("\tUser string", iinfo, &meta->heap_us);
- dsh ("\t GUID", iinfo, &meta->heap_guid);
-}
-
-static const char *
-table_to_string (int table)
-{
- char *map_table_to_string [] = {
- /* 0 */ "Module", "TypeRef", "TypeDef", "FieldPtr",
- /* 4 */ "FieldDef", "MethodPtr", "MethodDef", "ParamPtr",
- /* 8 */ "ParamDef", "InterfaceImpl", "MemberRef", "FieldInit",
- /* 12 */ "CustomAttr", "MarshalDef", "Permission", "LayoutDef",
- /* 16 */ "FieldOffset", "Signature", "EventAssoc", "EventPtr",
- /* 20 */ "Event", "PropertyAssoc", "PropertyPtr", "Property",
- /* 24 */ "MethodAssoc", "MethodImpl", "ModuleRef", "TypeSpec",
- /* 28 */ "PInvoke", "Data", "EncLog", "EncAssoc",
- /* 32 */ "Assembly", "ProcessorDef", "OSDef", "AssemblyRef",
- /* 36 */ "ProcessorRef", "OSRef", "File", "ComType",
- /* 40 */ "ManifestResource", "ExeLocation", "42", "43",
- /* 44 */ "44", "45", "NestedClass", "47"
- /* 48 */ "48", "49", "50", "51",
- /* 52 */ "52", "53", "54", "55"
- /* 56 */ "56", "57", "58", "59"
- /* 60 */ "60", "61", "62", "63"
- };
-
- if (table < 0 || table > 63)
- return "Unknown table name";
-
- return map_table_to_string [table];
+ dsh ("\tTables (#~)", meta, &meta->heap_tables);
+ dsh ("\t Strings", meta, &meta->heap_strings);
+ dsh ("\t Blob", meta, &meta->heap_blob);
+ dsh ("\tUser string", meta, &meta->heap_us);
+ dsh ("\t GUID", meta, &meta->heap_guid);
}
static void
-dump_metadata (dotnet_image_info_t *iinfo)
+dump_metadata (MonoImage *meta)
{
- metadata_t *meta = &iinfo->dn_metadata;
int table;
- dump_metadata_ptrs (iinfo);
+ dump_metadata_ptrs (meta);
printf ("Rows:\n");
for (table = 0; table < 64; table++){
- if (meta->rows [table] == 0)
+ if (meta->tables [table].rows == 0)
continue;
- printf ("Table %s (%d): %d rows\n", table_to_string (table), table, meta->rows [table]);
+ printf ("Table %s: %d records (%d bytes, at %p)\n",
+ mono_meta_table_name (table),
+ meta->tables [table].rows,
+ meta->tables [table].row_size,
+ meta->tables [table].base
+ );
}
}
static void
-dump_dotnet_iinfo (dotnet_image_info_t *iinfo)
+dump_methoddef (MonoImage *metadata, guint32 token)
{
- dump_dotnet_header (&iinfo->dn_header);
+ const char *loc;
+
+ if (!token)
+ return;
+ loc = mono_metadata_locate_token (metadata, token);
+
+ printf ("RVA for Entry Point: 0x%08x\n", read32 (loc));
+}
+
+static void
+dump_dotnet_iinfo (MonoImage *image)
+{
+ MonoCLIImageInfo *iinfo = image->image_info;
+
+ dump_dotnet_header (&iinfo->cli_header);
dump_sections (iinfo);
- dump_cli_header (&iinfo->dn_cli_header);
- dump_metadata (iinfo);
+ dump_cli_header (&iinfo->cli_cli_header);
+ dump_metadata (image);
+
+ dump_methoddef (image, iinfo->cli_cli_header.ch_entry_point);
+}
+
+static void
+dump_verify_info (MonoImage *image, int flags)
+{
+ GSList *errors, *tmp;
+ const char* desc [] = {
+ "Ok", "Error", "Warning", NULL, "CLS"
+ };
+
+ errors = mono_image_verify_tables (image, flags);
+
+ for (tmp = errors; tmp; tmp = tmp->next) {
+ MonoVerifyInfo *info = tmp->data;
+ g_print ("%s: %s\n", desc [info->status], info->message);
+ }
+ mono_free_verify_list (errors);
}
static void
usage (void)
{
- printf ("Usage is: pedump [-m] file.exe\n");
+ printf ("Usage is: pedump [--verify error,warn,cls,all] file.exe\n");
exit (1);
}
int
main (int argc, char *argv [])
{
- dotnet_image_info_t *iinfo;
- MonoAssembly *assembly;
+ MonoImage *image;
char *file = NULL;
+ char *flags = NULL;
+ const char *flag_desc [] = {"error", "warn", "cls", "all", NULL};
+ guint flag_vals [] = {MONO_VERIFY_ERROR, MONO_VERIFY_WARNING, MONO_VERIFY_CLS, MONO_VERIFY_ALL};
int i;
for (i = 1; i < argc; i++){
if (argv [i][0] != '-'){
- file = argv [1];
+ file = argv [i];
continue;
}
- if (argv [i][1] == 'h')
+ if (strcmp (argv [i], "--help") == 0)
usage ();
+ else if (strcmp (argv [i], "--verify") == 0) {
+ verify_pe = 1;
+ dump_data = 0;
+ ++i;
+ flags = argv [i];
+ } else {
+ usage ();
+ }
}
if (!file)
usage ();
- assembly = mono_assembly_open (file, NULL);
- iinfo = assembly->image_info;
-
- dump_dotnet_iinfo (iinfo);
+ image = mono_image_open (file, NULL);
+ if (!image){
+ fprintf (stderr, "Can not open image %s\n", file);
+ exit (1);
+ }
- mono_assembly_close (assembly);
+ if (dump_data)
+ dump_dotnet_iinfo (image);
+ if (verify_pe) {
+ int f = 0;
+ char *tok = strtok (flags, ",");
+ while (tok) {
+ for (i = 0; flag_desc [i]; ++i) {
+ if (strcmp (tok, flag_desc [i]) == 0) {
+ f |= flag_vals [i];
+ break;
+ }
+ }
+ if (!flag_desc [i])
+ g_print ("Unknown verify flag %s\n", tok);
+ tok = strtok (NULL, ",");
+ }
+ dump_verify_info (image, f);
+ }
+
+ mono_image_close (image);
return 0;
}
diff --git a/mono/metadata/private.h b/mono/metadata/private.h
new file mode 100644
index 00000000000..ce301839829
--- /dev/null
+++ b/mono/metadata/private.h
@@ -0,0 +1,78 @@
+#ifndef __MONO_METADATA_PRIVATE_H__
+#define __MONO_METADATA_PRIVATE_H__
+
+/*
+ * This enumeration is used to describe the data types in the metadata
+ * tables
+ */
+enum {
+ MONO_MT_END,
+
+ /* Sized elements */
+ MONO_MT_UINT32,
+ MONO_MT_UINT16,
+ MONO_MT_UINT8,
+
+ /* Index into Blob heap */
+ MONO_MT_BLOB_IDX,
+
+ /* Index into String heap */
+ MONO_MT_STRING_IDX,
+
+ /* GUID index */
+ MONO_MT_GUID_IDX,
+
+ /* Pointer into a table */
+ MONO_MT_TABLE_IDX,
+
+ /* HasConstant:Parent pointer (Param, Field or Property) */
+ MONO_MT_CONST_IDX,
+
+ /* HasCustomAttribute index. Indexes any table except CustomAttribute */
+ MONO_MT_HASCAT_IDX,
+
+ /* CustomAttributeType encoded index */
+ MONO_MT_CAT_IDX,
+
+ /* HasDeclSecurity index: TypeDef Method or Assembly */
+ MONO_MT_HASDEC_IDX,
+
+ /* Implementation coded index: File, Export AssemblyRef */
+ MONO_MT_IMPL_IDX,
+
+ /* HasFieldMarshal coded index: Field or Param table */
+ MONO_MT_HFM_IDX,
+
+ /* MemberForwardedIndex: Field or Method */
+ MONO_MT_MF_IDX,
+
+ /* TypeDefOrRef coded index: typedef, typeref, typespec */
+ MONO_MT_TDOR_IDX,
+
+ /* MemberRefParent coded index: typeref, moduleref, method, memberref, typesepc, typedef */
+ MONO_MT_MRP_IDX,
+
+ /* MethodDefOrRef coded index: Method or Member Ref table */
+ MONO_MT_MDOR_IDX,
+
+ /* HasSemantic coded index: Event or Property */
+ MONO_MT_HS_IDX,
+
+ /* ResolutionScope coded index: Module, ModuleRef, AssemblytRef, TypeRef */
+ MONO_MT_RS_IDX
+};
+
+typedef struct {
+ int code;
+ const char *def;
+} MonoMetaTable;
+
+const char *mono_meta_table_name (int table);
+
+/* Internal functions */
+void mono_metadata_compute_table_bases (MonoImage *meta);
+
+MonoMetaTable *mono_metadata_get_table (MonoMetaTableEnum table);
+
+#endif /* __MONO_METADATA_PRIVATE_H__ */
+
diff --git a/mono/metadata/profiler-private.h b/mono/metadata/profiler-private.h
new file mode 100644
index 00000000000..2fa63e0a93f
--- /dev/null
+++ b/mono/metadata/profiler-private.h
@@ -0,0 +1,40 @@
+
+#ifndef __MONO_PROFILER_PRIVATE_H__
+#define __MONO_PROFILER_PRIVATE_H__
+
+#include <mono/metadata/profiler.h>
+
+extern MonoProfileFlags mono_profiler_events;
+
+enum {
+ MONO_PROFILE_START_LOAD,
+ MONO_PROFILE_END_LOAD,
+ MONO_PROFILE_START_UNLOAD,
+ MONO_PROFILE_END_UNLOAD
+};
+
+void mono_profiler_shutdown (void);
+
+void mono_profiler_method_enter (MonoMethod *method);
+void mono_profiler_method_leave (MonoMethod *method);
+void mono_profiler_method_jit (MonoMethod *method);
+void mono_profiler_method_end_jit (MonoMethod *method, int result);
+
+void mono_profiler_code_transition (MonoMethod *method, int result);
+void mono_profiler_thread_start (HANDLE thread);
+void mono_profiler_thread_end (HANDLE thread);
+
+void mono_profiler_assembly_event (MonoAssembly *assembly, int code);
+void mono_profiler_assembly_loaded (MonoAssembly *assembly, int result);
+
+void mono_profiler_module_event (MonoImage *image, int code);
+void mono_profiler_module_loaded (MonoImage *image, int result);
+
+void mono_profiler_class_event (MonoClass *klass, int code);
+void mono_profiler_class_loaded (MonoClass *klass, int result);
+
+void mono_profiler_appdomain_event (MonoDomain *domain, int code);
+void mono_profiler_appdomain_loaded (MonoDomain *domain, int result);
+
+#endif /* __MONO_PROFILER_PRIVATE_H__ */
+
diff --git a/mono/metadata/profiler.c b/mono/metadata/profiler.c
new file mode 100644
index 00000000000..f88579c5e07
--- /dev/null
+++ b/mono/metadata/profiler.c
@@ -0,0 +1,618 @@
+
+#include "mono/metadata/profiler-private.h"
+#include "mono/metadata/debug-helpers.h"
+#include <string.h>
+
+static MonoProfiler * current_profiler = NULL;
+
+static MonoProfileAppDomainFunc domain_start_load;
+static MonoProfileAppDomainResult domain_end_load;
+static MonoProfileAppDomainFunc domain_start_unload;
+static MonoProfileAppDomainFunc domain_end_unload;
+
+static MonoProfileAssemblyFunc assembly_start_load;
+static MonoProfileAssemblyResult assembly_end_load;
+static MonoProfileAssemblyFunc assembly_start_unload;
+static MonoProfileAssemblyFunc assembly_end_unload;
+
+static MonoProfileModuleFunc module_start_load;
+static MonoProfileModuleResult module_end_load;
+static MonoProfileModuleFunc module_start_unload;
+static MonoProfileModuleFunc module_end_unload;
+
+static MonoProfileClassFunc class_start_load;
+static MonoProfileClassResult class_end_load;
+static MonoProfileClassFunc class_start_unload;
+static MonoProfileClassFunc class_end_unload;
+
+static MonoProfileMethodFunc jit_start;
+static MonoProfileMethodResult jit_end;
+static MonoProfileMethodResult man_unman_transition;
+static MonoProfileMethodFunc method_enter;
+static MonoProfileMethodFunc method_leave;
+
+static MonoProfileThreadFunc thread_start;
+static MonoProfileThreadFunc thread_end;
+
+static MonoProfileFunc shutdown_callback;
+
+/* this is directly accessible to other mono libs. */
+MonoProfileFlags mono_profiler_events;
+
+void
+mono_profiler_install (MonoProfiler *prof, MonoProfileFunc callback)
+{
+ if (current_profiler)
+ g_error ("profiler already setup");
+ current_profiler = prof;
+ shutdown_callback = callback;
+}
+
+void
+mono_profiler_set_events (MonoProfileFlags events)
+{
+ mono_profiler_events = events;
+}
+
+MonoProfileFlags
+mono_profiler_get_events (void)
+{
+ return mono_profiler_events;
+}
+
+void
+mono_profiler_install_enter_leave (MonoProfileMethodFunc enter, MonoProfileMethodFunc leave)
+{
+ method_enter = enter;
+ method_leave = leave;
+}
+
+void
+mono_profiler_install_jit_compile (MonoProfileMethodFunc start, MonoProfileMethodResult end)
+{
+ jit_start = start;
+ jit_end = end;
+}
+
+void
+mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end)
+{
+ thread_start = start;
+ thread_end = end;
+}
+
+void
+mono_profiler_install_transition (MonoProfileMethodResult callback)
+{
+ man_unman_transition = callback;
+}
+
+void
+mono_profiler_install_appdomain (MonoProfileAppDomainFunc start_load, MonoProfileAppDomainResult end_load,
+ MonoProfileAppDomainFunc start_unload, MonoProfileAppDomainFunc end_unload)
+
+{
+ domain_start_load = start_load;
+ domain_end_load = end_load;
+ domain_start_unload = start_unload;
+ domain_end_unload = end_unload;
+}
+
+void
+mono_profiler_install_assembly (MonoProfileAssemblyFunc start_load, MonoProfileAssemblyResult end_load,
+ MonoProfileAssemblyFunc start_unload, MonoProfileAssemblyFunc end_unload)
+{
+ assembly_start_load = start_load;
+ assembly_end_load = end_load;
+ assembly_start_unload = start_unload;
+ assembly_end_unload = end_unload;
+}
+
+void
+mono_profiler_install_module (MonoProfileModuleFunc start_load, MonoProfileModuleResult end_load,
+ MonoProfileModuleFunc start_unload, MonoProfileModuleFunc end_unload)
+{
+ module_start_load = start_load;
+ module_end_load = end_load;
+ module_start_unload = start_unload;
+ module_end_unload = end_unload;
+}
+
+void
+mono_profiler_install_class (MonoProfileClassFunc start_load, MonoProfileClassResult end_load,
+ MonoProfileClassFunc start_unload, MonoProfileClassFunc end_unload)
+{
+ class_start_load = start_load;
+ class_end_load = end_load;
+ class_start_unload = start_unload;
+ class_end_unload = end_unload;
+}
+
+void
+mono_profiler_method_enter (MonoMethod *method)
+{
+ if ((mono_profiler_events & MONO_PROFILE_ENTER_LEAVE) && method_enter)
+ method_enter (current_profiler, method);
+}
+
+void
+mono_profiler_method_leave (MonoMethod *method)
+{
+ if ((mono_profiler_events & MONO_PROFILE_ENTER_LEAVE) && method_leave)
+ method_leave (current_profiler, method);
+}
+
+void
+mono_profiler_method_jit (MonoMethod *method)
+{
+ if ((mono_profiler_events & MONO_PROFILE_JIT_COMPILATION) && jit_start)
+ jit_start (current_profiler, method);
+}
+
+void
+mono_profiler_method_end_jit (MonoMethod *method, int result)
+{
+ if ((mono_profiler_events & MONO_PROFILE_JIT_COMPILATION) && jit_end)
+ jit_end (current_profiler, method, result);
+}
+
+void
+mono_profiler_code_transition (MonoMethod *method, int result)
+{
+ if ((mono_profiler_events & MONO_PROFILE_TRANSITIONS) && man_unman_transition)
+ man_unman_transition (current_profiler, method, result);
+}
+
+void
+mono_profiler_thread_start (HANDLE thread)
+{
+ if ((mono_profiler_events & MONO_PROFILE_THREADS) && thread_start)
+ thread_start (current_profiler, thread);
+}
+
+void
+mono_profiler_thread_end (HANDLE thread)
+{
+ if ((mono_profiler_events & MONO_PROFILE_THREADS) && thread_end)
+ thread_end (current_profiler, thread);
+}
+
+void
+mono_profiler_assembly_event (MonoAssembly *assembly, int code)
+{
+ if (!(mono_profiler_events & MONO_PROFILE_ASSEMBLY_EVENTS))
+ return;
+
+ switch (code) {
+ case MONO_PROFILE_START_LOAD:
+ if (assembly_start_load)
+ assembly_start_load (current_profiler, assembly);
+ break;
+ case MONO_PROFILE_START_UNLOAD:
+ if (assembly_start_unload)
+ assembly_start_unload (current_profiler, assembly);
+ break;
+ case MONO_PROFILE_END_UNLOAD:
+ if (assembly_end_unload)
+ assembly_end_unload (current_profiler, assembly);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+}
+
+void
+mono_profiler_assembly_loaded (MonoAssembly *assembly, int result)
+{
+ if ((mono_profiler_events & MONO_PROFILE_ASSEMBLY_EVENTS) && assembly_end_load)
+ assembly_end_load (current_profiler, assembly, result);
+}
+
+void
+mono_profiler_module_event (MonoImage *module, int code)
+{
+ if (!(mono_profiler_events & MONO_PROFILE_MODULE_EVENTS))
+ return;
+
+ switch (code) {
+ case MONO_PROFILE_START_LOAD:
+ if (module_start_load)
+ module_start_load (current_profiler, module);
+ break;
+ case MONO_PROFILE_START_UNLOAD:
+ if (module_start_unload)
+ module_start_unload (current_profiler, module);
+ break;
+ case MONO_PROFILE_END_UNLOAD:
+ if (module_end_unload)
+ module_end_unload (current_profiler, module);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+}
+
+void
+mono_profiler_module_loaded (MonoImage *module, int result)
+{
+ if ((mono_profiler_events & MONO_PROFILE_MODULE_EVENTS) && module_end_load)
+ module_end_load (current_profiler, module, result);
+}
+
+void
+mono_profiler_class_event (MonoClass *klass, int code)
+{
+ if (!(mono_profiler_events & MONO_PROFILE_CLASS_EVENTS))
+ return;
+
+ switch (code) {
+ case MONO_PROFILE_START_LOAD:
+ if (class_start_load)
+ class_start_load (current_profiler, klass);
+ break;
+ case MONO_PROFILE_START_UNLOAD:
+ if (class_start_unload)
+ class_start_unload (current_profiler, klass);
+ break;
+ case MONO_PROFILE_END_UNLOAD:
+ if (class_end_unload)
+ class_end_unload (current_profiler, klass);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+}
+
+void
+mono_profiler_class_loaded (MonoClass *klass, int result)
+{
+ if ((mono_profiler_events & MONO_PROFILE_CLASS_EVENTS) && class_end_load)
+ class_end_load (current_profiler, klass, result);
+}
+
+void
+mono_profiler_appdomain_event (MonoDomain *domain, int code)
+{
+ if (!(mono_profiler_events & MONO_PROFILE_APPDOMAIN_EVENTS))
+ return;
+
+ switch (code) {
+ case MONO_PROFILE_START_LOAD:
+ if (domain_start_load)
+ domain_start_load (current_profiler, domain);
+ break;
+ case MONO_PROFILE_START_UNLOAD:
+ if (domain_start_unload)
+ domain_start_unload (current_profiler, domain);
+ break;
+ case MONO_PROFILE_END_UNLOAD:
+ if (domain_end_unload)
+ domain_end_unload (current_profiler, domain);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+}
+
+void
+mono_profiler_appdomain_loaded (MonoDomain *domain, int result)
+{
+ if ((mono_profiler_events & MONO_PROFILE_APPDOMAIN_EVENTS) && domain_end_load)
+ domain_end_load (current_profiler, domain, result);
+}
+
+void
+mono_profiler_shutdown (void)
+{
+ if (current_profiler && shutdown_callback)
+ shutdown_callback (current_profiler);
+}
+
+/*
+ * Small profiler extracted from mint: we should move it in a loadable module
+ * and improve it to do graphs and more accurate timestamping with rdtsc.
+ */
+
+#define USE_X86TSC 0
+#define USE_WIN32COUNTER 0
+#if USE_X86TSC
+
+typedef struct {
+ unsigned int lows, highs, lowe, highe;
+} MonoRdtscTimer;
+
+#define rdtsc(low,high) \
+ __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
+
+static int freq;
+
+static double
+rdtsc_elapsed (MonoRdtscTimer *t)
+{
+ unsigned long long diff;
+ unsigned int highe = t->highe;
+ if (t->lowe < t->lows)
+ highe--;
+ diff = (((unsigned long long) highe - t->highs) << 32) + (t->lowe - t->lows);
+ return ((double)diff / freq) / 1000000; /* have to return the result in seconds */
+}
+
+static int
+have_rdtsc (void) {
+ char buf[256];
+ int have_freq = 0;
+ int have_flag = 0;
+ float val;
+ FILE *cpuinfo;
+
+ if (!(cpuinfo = fopen ("/proc/cpuinfo", "r")))
+ return 0;
+ while (fgets (buf, sizeof(buf), cpuinfo)) {
+ if (sscanf (buf, "cpu MHz : %f", &val) == 1) {
+ /*printf ("got mh: %f\n", val);*/
+ have_freq = val;
+ }
+ if (strncmp (buf, "flags", 5) == 0) {
+ if (strstr (buf, "tsc")) {
+ have_flag = 1;
+ /*printf ("have tsc\n");*/
+ }
+ }
+ }
+ fclose (cpuinfo);
+ return have_flag? have_freq: 0;
+}
+
+#define MONO_TIMER_STARTUP \
+ if (!(freq = have_rdtsc ())) g_error ("Compiled with TSC support, but none found");
+#define MONO_TIMER_TYPE MonoRdtscTimer
+#define MONO_TIMER_INIT(t)
+#define MONO_TIMER_DESTROY(t)
+#define MONO_TIMER_START(t) rdtsc ((t).lows, (t).highs);
+#define MONO_TIMER_STOP(t) rdtsc ((t).lowe, (t).highe);
+#define MONO_TIMER_ELAPSED(t) rdtsc_elapsed (&(t))
+
+#elif USE_WIN32COUNTER
+#include <windows.h>
+
+typedef struct {
+ LARGE_INTEGER start, stop;
+} MonoWin32Timer;
+
+static int freq;
+
+static double
+win32_elapsed (MonoWin32Timer *t)
+{
+ LONGLONG diff = t->stop.QuadPart - t->start.QuadPart;
+ return ((double)diff / freq) / 1000000; /* have to return the result in seconds */
+}
+
+static int
+have_win32counter (void) {
+ LARGE_INTEGER f;
+
+ if (!QueryPerformanceFrequency (&f))
+ return 0;
+ return f.LowPart;
+}
+
+#define MONO_TIMER_STARTUP \
+ if (!(freq = have_win32counter ())) g_error ("Compiled with Win32 counter support, but none found");
+#define MONO_TIMER_TYPE MonoWin32Timer
+#define MONO_TIMER_INIT(t)
+#define MONO_TIMER_DESTROY(t)
+#define MONO_TIMER_START(t) QueryPerformanceCounter (&(t).start)
+#define MONO_TIMER_STOP(t) QueryPerformanceCounter (&(t).stop)
+#define MONO_TIMER_ELAPSED(t) win32_elapsed (&(t))
+
+#else
+
+typedef struct {
+ GTimeVal start, stop;
+} MonoGLibTimer;
+
+static double
+timeval_elapsed (MonoGLibTimer *t)
+{
+ if (t->start.tv_usec > t->stop.tv_usec) {
+ t->stop.tv_usec += G_USEC_PER_SEC;
+ t->stop.tv_sec--;
+ }
+ return (t->stop.tv_sec - t->start.tv_sec)
+ + ((double)(t->stop.tv_usec - t->start.tv_usec))/ G_USEC_PER_SEC;
+}
+
+#define MONO_TIMER_STARTUP
+#define MONO_TIMER_TYPE MonoGLibTimer
+#define MONO_TIMER_INIT(t)
+#define MONO_TIMER_DESTROY(t)
+#define MONO_TIMER_START(t) g_get_current_time (&(t).start)
+#define MONO_TIMER_STOP(t) g_get_current_time (&(t).stop)
+#define MONO_TIMER_ELAPSED(t) timeval_elapsed (&(t))
+#endif
+
+struct _MonoProfiler {
+ GHashTable *methods;
+ GHashTable *newobjs;
+ MONO_TIMER_TYPE jit_timer;
+ double jit_time;
+ int methods_jitted;
+};
+
+typedef struct {
+ union {
+ MONO_TIMER_TYPE timer;
+ MonoMethod *method;
+ } u;
+ guint64 count;
+ double total;
+} MethodProfile;
+
+typedef struct _MethodCallProfile MethodCallProfile;
+
+struct _MethodCallProfile {
+ MethodCallProfile *next;
+ MONO_TIMER_TYPE timer;
+ MonoMethod *method;
+};
+
+static gint
+compare_profile (MethodProfile *profa, MethodProfile *profb)
+{
+ return (gint)((profb->total - profa->total)*1000);
+}
+
+static void
+build_profile (MonoMethod *m, MethodProfile *prof, GList **funcs)
+{
+ MONO_TIMER_DESTROY (prof->u.timer);
+ prof->u.method = m;
+ *funcs = g_list_insert_sorted (*funcs, prof, (GCompareFunc)compare_profile);
+}
+
+static void
+output_profile (GList *funcs)
+{
+ GList *tmp;
+ MethodProfile *p;
+ char buf [256];
+ char *sig;
+ guint64 total_calls = 0;
+
+ if (funcs)
+ g_print ("Method name\t\t\t\t\tTotal (ms) Calls Per call (ms)\n");
+ for (tmp = funcs; tmp; tmp = tmp->next) {
+ p = tmp->data;
+ total_calls += p->count;
+ if (!(gint)(p->total*1000))
+ continue;
+ sig = mono_signature_get_desc (p->u.method->signature, FALSE);
+ g_snprintf (buf, sizeof (buf), "%s.%s::%s(%s)",
+ p->u.method->klass->name_space, p->u.method->klass->name,
+ p->u.method->name, sig);
+ g_free (sig);
+ printf ("%-52s %7d %7llu %7d\n", buf,
+ (gint)(p->total*1000), p->count, (gint)((p->total*1000)/p->count));
+ }
+ printf ("Total number of calls: %lld\n", total_calls);
+}
+
+typedef struct {
+ MonoClass *klass;
+ guint count;
+} NewobjProfile;
+
+static gint
+compare_newobj_profile (NewobjProfile *profa, NewobjProfile *profb)
+{
+ return (gint)profb->count - (gint)profa->count;
+}
+
+static void
+build_newobj_profile (MonoClass *class, gpointer count, GList **funcs)
+{
+ NewobjProfile *prof = g_new (NewobjProfile, 1);
+ prof->klass = class;
+ prof->count = GPOINTER_TO_UINT (count);
+ *funcs = g_list_insert_sorted (*funcs, prof, (GCompareFunc)compare_newobj_profile);
+}
+
+static void
+output_newobj_profile (GList *proflist)
+{
+ GList *tmp;
+ NewobjProfile *p;
+ MonoClass *klass;
+ const char* isarray;
+ char buf [256];
+
+ if (proflist)
+ g_print ("\n%-52s %9s\n", "Objects created:", "count");
+ for (tmp = proflist; tmp; tmp = tmp->next) {
+ p = tmp->data;
+ klass = p->klass;
+ if (klass->rank) {
+ isarray = "[]";
+ klass = klass->element_class;
+ } else {
+ isarray = "";
+ }
+ g_snprintf (buf, sizeof (buf), "%s.%s%s",
+ klass->name_space, klass->name, isarray);
+ g_print ("%-52s %9d\n", buf, p->count);
+ }
+}
+
+static void
+simple_method_enter (MonoProfiler *prof, MonoMethod *method)
+{
+ MethodProfile *profile_info;
+ if (!(profile_info = g_hash_table_lookup (prof->methods, method))) {
+ profile_info = g_new0 (MethodProfile, 1);
+ MONO_TIMER_INIT (profile_info->u.timer);
+ g_hash_table_insert (prof->methods, method, profile_info);
+ }
+ profile_info->count++;
+ MONO_TIMER_START (profile_info->u.timer);
+}
+
+static void
+simple_method_leave (MonoProfiler *prof, MonoMethod *method)
+{
+ MethodProfile *profile_info;
+ if (!(profile_info = g_hash_table_lookup (prof->methods, method)))
+ g_assert_not_reached ();
+
+ MONO_TIMER_STOP (profile_info->u.timer);
+ profile_info->total += MONO_TIMER_ELAPSED (profile_info->u.timer);
+}
+
+static void
+simple_method_jit (MonoProfiler *prof, MonoMethod *method)
+{
+ prof->methods_jitted++;
+ MONO_TIMER_START (prof->jit_timer);
+}
+
+static void
+simple_method_end_jit (MonoProfiler *prof, MonoMethod *method, int result)
+{
+ MONO_TIMER_STOP (prof->jit_timer);
+ prof->jit_time += MONO_TIMER_ELAPSED (prof->jit_timer);
+}
+
+static void
+simple_shutdown (MonoProfiler *prof)
+{
+ GList *profile = NULL;
+
+ printf("Total time spent compiling %d methods (sec): %.4g\n", prof->methods_jitted, prof->jit_time);
+ g_hash_table_foreach (prof->methods, (GHFunc)build_profile, &profile);
+ output_profile (profile);
+ g_list_free (profile);
+ profile = NULL;
+
+ g_hash_table_foreach (prof->newobjs, (GHFunc)build_newobj_profile, &profile);
+ output_newobj_profile (profile);
+ g_list_free (profile);
+}
+
+void
+mono_profiler_install_simple (void)
+{
+ MonoProfiler *prof = g_new0 (MonoProfiler, 1);
+
+ MONO_TIMER_STARTUP;
+
+ prof->methods = g_hash_table_new (g_direct_hash, g_direct_equal);
+ prof->newobjs = g_hash_table_new (g_direct_hash, g_direct_equal);
+ MONO_TIMER_INIT (prof->jit_timer);
+
+ mono_profiler_install (prof, simple_shutdown);
+ /* later do also object creation */
+ mono_profiler_install_enter_leave (simple_method_enter, simple_method_leave);
+ mono_profiler_install_jit_compile (simple_method_jit, simple_method_end_jit);
+ mono_profiler_set_events (MONO_PROFILE_ENTER_LEAVE|MONO_PROFILE_JIT_COMPILATION);
+}
+
diff --git a/mono/metadata/profiler.h b/mono/metadata/profiler.h
new file mode 100644
index 00000000000..1f6ab146bb1
--- /dev/null
+++ b/mono/metadata/profiler.h
@@ -0,0 +1,80 @@
+#ifndef __MONO_PROFILER_H__
+#define __MONO_PROFILER_H__
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/io-layer/io-layer.h>
+
+typedef enum {
+ MONO_PROFILE_NONE = 0,
+ MONO_PROFILE_APPDOMAIN_EVENTS = 1 << 0,
+ MONO_PROFILE_ASSEMBLY_EVENTS = 1 << 1,
+ MONO_PROFILE_MODULE_EVENTS = 1 << 2,
+ MONO_PROFILE_CLASS_EVENTS = 1 << 3,
+ MONO_PROFILE_JIT_COMPILATION = 1 << 4,
+ MONO_PROFILE_INLINING = 1 << 5,
+ MONO_PROFILE_EXCEPTIONS = 1 << 6,
+ MONO_PROFILE_ALLOCATIONS = 1 << 7,
+ MONO_PROFILE_GC = 1 << 8,
+ MONO_PROFILE_THREADS = 1 << 9,
+ MONO_PROFILE_REMOTING = 1 << 10,
+ MONO_PROFILE_TRANSITIONS = 1 << 11,
+ MONO_PROFILE_ENTER_LEAVE = 1 << 12
+} MonoProfileFlags;
+
+typedef enum {
+ MONO_PROFILE_OK,
+ MONO_PROFILE_FAILED
+} MonoProfileResult;
+
+typedef struct _MonoProfiler MonoProfiler;
+
+/*
+ * Functions that the runtime will call on the profiler.
+ */
+
+typedef void (*MonoProfileFunc) (MonoProfiler *prof);
+
+typedef void (*MonoProfileAppDomainFunc) (MonoProfiler *prof, MonoDomain *domain);
+typedef void (*MonoProfileMethodFunc) (MonoProfiler *prof, MonoMethod *method);
+typedef void (*MonoProfileClassFunc) (MonoProfiler *prof, MonoClass *klass);
+typedef void (*MonoProfileModuleFunc) (MonoProfiler *prof, MonoImage *module);
+typedef void (*MonoProfileAssemblyFunc) (MonoProfiler *prof, MonoAssembly *assembly);
+
+typedef void (*MonoProfileAppDomainResult)(MonoProfiler *prof, MonoDomain *domain, int result);
+typedef void (*MonoProfileMethodResult) (MonoProfiler *prof, MonoMethod *method, int result);
+typedef void (*MonoProfileClassResult) (MonoProfiler *prof, MonoClass *klass, int result);
+typedef void (*MonoProfileModuleResult) (MonoProfiler *prof, MonoImage *module, int result);
+typedef void (*MonoProfileAssemblyResult) (MonoProfiler *prof, MonoAssembly *assembly, int result);
+
+typedef void (*MonoProfileMethodInline) (MonoProfiler *prof, MonoMethod *parent, MonoMethod *child, int *ok);
+
+typedef void (*MonoProfileThreadFunc) (MonoProfiler *prof, HANDLE thread);
+typedef void (*MonoProfileAllocFunc) (MonoProfiler *prof, MonoObject *obj, MonoClass *klass);
+
+/*
+ * Function the profiler may call.
+ */
+void mono_profiler_install (MonoProfiler *prof, MonoProfileFunc shutdown_callback);
+void mono_profiler_set_events (MonoProfileFlags events);
+
+MonoProfileFlags mono_profiler_get_events (void);
+
+void mono_profiler_install_appdomain (MonoProfileAppDomainFunc start_load, MonoProfileAppDomainResult end_load,
+ MonoProfileAppDomainFunc start_unload, MonoProfileAppDomainFunc end_unload);
+void mono_profiler_install_assembly (MonoProfileAssemblyFunc start_load, MonoProfileAssemblyResult end_load,
+ MonoProfileAssemblyFunc start_unload, MonoProfileAssemblyFunc end_unload);
+void mono_profiler_install_module (MonoProfileModuleFunc start_load, MonoProfileModuleResult end_load,
+ MonoProfileModuleFunc start_unload, MonoProfileModuleFunc end_unload);
+void mono_profiler_install_class (MonoProfileClassFunc start_load, MonoProfileClassResult end_load,
+ MonoProfileClassFunc start_unload, MonoProfileClassFunc end_unload);
+
+void mono_profiler_install_jit_compile (MonoProfileMethodFunc start, MonoProfileMethodResult end);
+void mono_profiler_install_enter_leave (MonoProfileMethodFunc enter, MonoProfileMethodFunc leave);
+void mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end);
+void mono_profiler_install_transition (MonoProfileMethodResult callback);
+
+void mono_profiler_install_simple (void);
+
+#endif /* __MONO_PROFILER_H__ */
+
diff --git a/mono/metadata/rand.c b/mono/metadata/rand.c
new file mode 100644
index 00000000000..98611d4332a
--- /dev/null
+++ b/mono/metadata/rand.c
@@ -0,0 +1,112 @@
+/*
+ * rand.c: System.Security.Cryptography.RNGCryptoServiceProvider support
+ *
+ * Author:
+ * Mark Crichton (crichton@gimp.org)
+ *
+ * (C) 2001 Ximian, Inc.
+ *
+ */
+
+
+/* Ok, the exception handling is bogus. I need to work on that */
+
+#include <config.h>
+#include <glib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/rand.h>
+#include <mono/metadata/exception.h>
+
+#if defined (NAME_DEV_RANDOM) && defined (HAVE_CRYPT_RNG)
+
+void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetBytes(MonoArray *arry)
+{
+ guint32 len;
+ gint file;
+ gint err;
+ guchar *buf;
+
+ len = mono_array_length(arry);
+ buf = mono_array_addr(arry, guchar, 0);
+
+ file = open(NAME_DEV_RANDOM, O_RDONLY);
+
+ if (file < 0) {
+ g_warning("Entropy problem! Can't open %s", NAME_DEV_RANDOM);
+
+ /* This needs to be a crypto exception */
+ mono_raise_exception(mono_get_exception_not_implemented());
+ }
+
+ /* A little optimization.... */
+ err = read(file, buf, len);
+
+ if (err < 0) {
+ g_warning("Entropy error! Error in read.");
+ mono_raise_exception(mono_get_exception_not_implemented());
+ }
+
+ if (err != len) {
+ g_warning("Entropy error! Length != bytes read");
+ mono_raise_exception(mono_get_exception_not_implemented());
+ }
+
+ close(file);
+}
+
+void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetNonZeroBytes(MonoArray *arry)
+{
+ guint32 len;
+ gint file, i;
+ gint err;
+ guchar byte = 0;
+
+ len = mono_array_length(arry);
+
+ file = open(NAME_DEV_RANDOM, O_RDONLY);
+
+ if (file < 0) {
+ g_warning("Entropy problem! Can't open %s", NAME_DEV_RANDOM);
+
+ /* This needs to be a crypto exception */
+ mono_raise_exception(mono_get_exception_not_implemented());
+ }
+
+ for (i = 0; i < len; i++) {
+
+ do {
+ err = read(file, &byte, 1);
+ } while (byte == 0);
+
+ if (err < 0) {
+ g_warning("Entropy error! Error in read.");
+ mono_raise_exception(mono_get_exception_not_implemented());
+ }
+
+ mono_array_set(arry, guchar, i, byte);
+ }
+
+ close(file);
+}
+
+/* This needs to change when I do the Win32 support... */
+#else
+#warning "No Entropy Source Found"
+void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetBytes(MonoArray *arry)
+{
+ g_warning("0K problem. We have no entropy. Badness will occur.");
+ mono_raise_exception(mono_get_exception_not_implemented());
+}
+
+void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetNonZeroBytes(MonoArray *arry)
+{
+ g_warning("0K problem. We have no entropy. Badness will occur.");
+ mono_raise_exception(mono_get_exception_not_implemented());
+}
+
+#endif
diff --git a/mono/metadata/rand.h b/mono/metadata/rand.h
new file mode 100644
index 00000000000..3005d96d9d5
--- /dev/null
+++ b/mono/metadata/rand.h
@@ -0,0 +1,19 @@
+/*
+ * rand.h: System.Security.Cryptography.RNGCryptoServiceProvider support
+ *
+ * Author:
+ * Mark Crichton (crichton@gimp.org)
+ *
+ * (C) 2001 Ximian, Inc.
+ *
+ */
+
+#ifndef _MONO_METADATA_RAND_H_
+#define _MONO_METADATA_RAND_H_
+
+#include <mono/metadata/object.h>
+
+void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetBytes(MonoArray *arry);
+void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_GetNonZeroBytes(MonoArray *arry);
+
+#endif
diff --git a/mono/metadata/rawbuffer.c b/mono/metadata/rawbuffer.c
index a72705af35e..ba016796f94 100644
--- a/mono/metadata/rawbuffer.c
+++ b/mono/metadata/rawbuffer.c
@@ -7,64 +7,200 @@
* (C) 2001 Ximian, Inc.
*/
#include <config.h>
+#if defined(PLATFORM_WIN32)
+#define USE_WIN32_API 1
+#endif
+
#include <unistd.h>
+#ifdef USE_WIN32_API
+#include <windows.h>
+#include <io.h>
+#else
#include <sys/mman.h>
+#endif
#include <sys/types.h>
#include <glib.h>
#include "rawbuffer.h"
-#define PAGESIZE 8192
+#define ROUND_DOWN(VALUE,SIZE) ((VALUE) & ~((SIZE) - 1))
+#define ROUND_UP(VALUE,SIZE) (ROUND_DOWN((VALUE) + (SIZE) - 1, (SIZE)))
-GHashTable *malloc_map;
+static GHashTable *mmap_map = NULL;
+static size_t alignment = 0;
-void *
-raw_buffer_load (int fd, int is_writable, guint32 base, size_t size)
+static void
+get_alignment (void)
+{
+#ifdef USE_WIN32_API
+ SYSTEM_INFO info;
+
+ GetSystemInfo (&info);
+ alignment = info.dwAllocationGranularity;
+#else
+ alignment = getpagesize ();
+#endif
+}
+
+static void *
+mono_raw_buffer_load_malloc (int fd, int is_writable, guint32 base, size_t size)
+{
+ void *ptr;
+
+ ptr = g_malloc (size);
+ if (ptr == NULL)
+ return NULL;
+
+ if (lseek (fd, base, 0) == (off_t) -1) {
+ g_free (ptr);
+ return NULL;
+ }
+
+ read (fd, ptr, size);
+ return ptr;
+}
+
+static void
+mono_raw_buffer_free_malloc (void *base)
+{
+ g_free (base);
+}
+
+static void *
+mono_raw_buffer_load_mmap (int fd, int is_writable, guint32 base, size_t size)
{
+#ifdef USE_WIN32_API
+ /* FileMapping implementation */
+
+ DWORD start, end;
+ int prot, access;
+ void *ptr;
+ HANDLE file, mapping;
+
+ if (alignment == 0)
+ get_alignment ();
+ start = ROUND_DOWN (base, alignment);
+ end = base + size;
+
+ if (is_writable) {
+ prot = PAGE_WRITECOPY;
+ access = FILE_MAP_COPY;
+ }
+ else {
+ prot = PAGE_READONLY;
+ access = FILE_MAP_READ;
+ }
+
+ file = (HANDLE) _get_osfhandle (fd);
+ mapping = CreateFileMapping (file, NULL, prot, 0, 0, NULL);
+ if (mapping == NULL)
+ return 0;
+
+ ptr = MapViewOfFile (mapping, access, 0, start, end - start);
+ if (ptr == NULL) {
+ CloseHandle (mapping);
+ return 0;
+ }
+
+ if (mmap_map == NULL)
+ mmap_map = g_hash_table_new (g_direct_hash, g_direct_equal);
+
+ g_hash_table_insert (mmap_map, ptr, GINT_TO_POINTER (mapping));
+
+ return ((char *)ptr) + (base - start);
+
+#else
+ /* mmap implementation */
+
+
size_t start, end;
int prot = PROT_READ;
int flags = 0;
- void *ptr, *mmap_ptr;
-
+ void *ptr;
+
+ if (alignment == 0)
+ get_alignment ();
+ start = ROUND_DOWN (base, alignment);
+ end = ROUND_UP (base + size, alignment);
+
if (is_writable){
prot |= PROT_WRITE;
+ flags = MAP_SHARED;
+ } else {
+ flags = MAP_PRIVATE;
}
- flags = MAP_PRIVATE;
- start = base & ~(PAGESIZE - 1);
- end = (base + size + PAGESIZE - 1) & ~(PAGESIZE - 1);
+ ptr = mmap (0, end - start, prot, flags, fd, start);
+
+ if (ptr == (void *) -1)
+ return 0;
- mmap_ptr = mmap (0, end - start, prot, flags, fd, start);
- if (mmap_ptr == (void *) -1){
- ptr = g_malloc (size);
- if (ptr == NULL)
- return NULL;
- if (lseek (fd, base, 0) == (off_t) -1)
- return NULL;
- read (fd, ptr, size);
- return ptr;
- }
- if (malloc_map == NULL)
- malloc_map = g_hash_table_new (g_direct_hash, g_direct_equal);
+ if (mmap_map == NULL)
+ mmap_map = g_hash_table_new (g_direct_hash, g_direct_equal);
+
+ g_hash_table_insert (mmap_map, ptr, GINT_TO_POINTER (size));
+
+ return ((char *)ptr) + (base - start);
+#endif
+}
+
+static void
+mono_raw_buffer_free_mmap (void *base)
+{
+ int value;
+
+ value = GPOINTER_TO_INT (g_hash_table_lookup (mmap_map, base));
+
+#ifdef USE_WIN32_API
+ UnmapViewOfFile (base);
+ CloseHandle ((HANDLE) value);
+#else
+ munmap (base, value);
+#endif
+}
- g_hash_table_insert (malloc_map, mmap_ptr, GINT_TO_POINTER (size));
+static void
+mono_raw_buffer_update_mmap (void *base, size_t size)
+{
+#ifdef USE_WIN32_API
+ FlushViewOfFile (base, size);
+#else
+ msync (base, size, MS_SYNC);
+#endif
+}
- return ((char *)mmap_ptr) + (base - start);
+void *
+mono_raw_buffer_load (int fd, int is_writable, guint32 base, size_t size)
+{
+ void *ptr;
+
+ ptr = mono_raw_buffer_load_mmap (fd, is_writable, base, size);
+ if (ptr == 0)
+ ptr = mono_raw_buffer_load_malloc (fd, is_writable, base, size);
+
+ return ptr;
}
void
-raw_buffer_free (void *buffer)
+mono_raw_buffer_update (void *buffer, size_t size)
{
- int size, diff;
- char *base;
+ char *mmap_base;
+
+ mmap_base = GINT_TO_POINTER (ROUND_DOWN (GPOINTER_TO_INT (buffer), alignment));
- if (!malloc_map){
- g_free (buffer);
- return;
- }
+ if (mmap_map && g_hash_table_lookup (mmap_map, mmap_base))
+ mono_raw_buffer_update_mmap (mmap_base, size);
+}
- diff = ((unsigned int) buffer) & (PAGESIZE - 1);
- base = ((char *)buffer) - diff;
+void
+mono_raw_buffer_free (void *buffer)
+{
+ char *mmap_base;
+
+ mmap_base = GINT_TO_POINTER (ROUND_DOWN (GPOINTER_TO_INT (buffer), alignment));
- size = GPOINTER_TO_INT (g_hash_table_lookup (malloc_map, base));
- munmap (base, size);
+ if (mmap_map && g_hash_table_lookup (mmap_map, mmap_base))
+ mono_raw_buffer_free_mmap (mmap_base);
+ else
+ mono_raw_buffer_free_malloc (buffer);
}
+
diff --git a/mono/metadata/rawbuffer.h b/mono/metadata/rawbuffer.h
index 4091fc434c2..47232a2639f 100644
--- a/mono/metadata/rawbuffer.h
+++ b/mono/metadata/rawbuffer.h
@@ -1,3 +1,4 @@
-void *raw_buffer_load (int fd, int writable, guint32 base, size_t size);
-void raw_buffer_free (void *buffer);
+void *mono_raw_buffer_load (int fd, int writable, guint32 base, size_t size);
+void mono_raw_buffer_update (void *buffer, size_t size);
+void mono_raw_buffer_free (void *buffer);
diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c
new file mode 100644
index 00000000000..05a6f9f67e0
--- /dev/null
+++ b/mono/metadata/reflection.c
@@ -0,0 +1,3042 @@
+
+/*
+ * reflection.c: Routines for creating an image at runtime.
+ *
+ * Author:
+ * Paolo Molaro (lupus@ximian.com)
+ *
+ * (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
+ *
+ */
+#include <config.h>
+#include "mono/metadata/reflection.h"
+#include "mono/metadata/tabledefs.h"
+#include "mono/metadata/tokentype.h"
+#include "mono/metadata/appdomain.h"
+#include "mono/metadata/opcodes.h"
+#include <stdio.h>
+#include <glib.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+#include "image.h"
+#include "cil-coff.h"
+#include "rawbuffer.h"
+#include "mono-endian.h"
+#include "private.h"
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#endif
+
+#define TEXT_OFFSET 512
+#define CLI_H_SIZE 136
+#define FILE_ALIGN 512
+#define START_TEXT_RVA 0x00002000
+
+typedef struct {
+ MonoReflectionILGen *ilgen;
+ MonoReflectionType *rtype;
+ MonoArray *parameters;
+ MonoArray *pinfo;
+ guint32 attrs;
+ guint32 iattrs;
+ guint32 call_conv;
+ guint32 *table_idx; /* note: it's a pointer */
+ MonoArray *code;
+ MonoObject *type;
+ MonoString *name;
+} ReflectionMethodBuilder;
+
+const unsigned char table_sizes [64] = {
+ MONO_MODULE_SIZE,
+ MONO_TYPEREF_SIZE,
+ MONO_TYPEDEF_SIZE,
+ 0,
+ MONO_FIELD_SIZE,
+ 0,
+ MONO_METHOD_SIZE,
+ 0,
+ MONO_PARAM_SIZE,
+ MONO_INTERFACEIMPL_SIZE,
+ MONO_MEMBERREF_SIZE, /* 0x0A */
+ MONO_CONSTANT_SIZE,
+ MONO_CUSTOM_ATTR_SIZE,
+ MONO_FIELD_MARSHAL_SIZE,
+ MONO_DECL_SECURITY_SIZE,
+ MONO_CLASS_LAYOUT_SIZE,
+ MONO_FIELD_LAYOUT_SIZE, /* 0x10 */
+ MONO_STAND_ALONE_SIGNATURE_SIZE,
+ MONO_EVENT_MAP_SIZE,
+ 0,
+ MONO_EVENT_SIZE,
+ MONO_PROPERTY_MAP_SIZE,
+ 0,
+ MONO_PROPERTY_SIZE,
+ MONO_METHOD_SEMA_SIZE,
+ MONO_MTHODIMPL_SIZE,
+ MONO_MODULEREF_SIZE, /* 0x1A */
+ MONO_TYPESPEC_SIZE,
+ MONO_IMPLMAP_SIZE,
+ MONO_FIELD_RVA_SIZE,
+ 0,
+ 0,
+ MONO_ASSEMBLY_SIZE, /* 0x20 */
+ MONO_ASSEMBLY_PROCESSOR_SIZE,
+ MONO_ASSEMBLYOS_SIZE,
+ MONO_ASSEMBLYREF_SIZE,
+ MONO_ASSEMBLYREFPROC_SIZE,
+ MONO_ASSEMBLYREFOS_SIZE,
+ MONO_FILE_SIZE,
+ MONO_EXP_TYPE_SIZE,
+ MONO_MANIFEST_SIZE,
+ MONO_NESTED_CLASS_SIZE,
+ 0 /* 0x2A */
+};
+
+static guint32 mono_image_typedef_or_ref (MonoDynamicAssembly *assembly, MonoType *type);
+static guint32 mono_image_get_methodref_token (MonoDynamicAssembly *assembly, MonoMethod *method);
+
+static void
+alloc_table (MonoDynamicTable *table, guint nrows)
+{
+ table->rows = nrows;
+ g_assert (table->columns);
+ table->values = g_realloc (table->values, (1 + table->rows) * table->columns * sizeof (guint32));
+}
+
+static guint32
+string_heap_insert (MonoDynamicStream *sh, const char *str)
+{
+ guint32 idx;
+ guint32 len;
+ gpointer oldkey, oldval;
+
+ if (g_hash_table_lookup_extended (sh->hash, str, &oldkey, &oldval))
+ return GPOINTER_TO_UINT (oldval);
+
+ len = strlen (str) + 1;
+ idx = sh->index;
+ if (idx + len > sh->alloc_size) {
+ sh->alloc_size += len + 4096;
+ sh->data = g_realloc (sh->data, sh->alloc_size);
+ }
+ /*
+ * We strdup the string even if we already copy them in sh->data
+ * so that the string pointers in the hash remain valid even if
+ * we need to realloc sh->data. We may want to avoid that later.
+ */
+ g_hash_table_insert (sh->hash, g_strdup (str), GUINT_TO_POINTER (idx));
+ memcpy (sh->data + idx, str, len);
+ sh->index += len;
+ return idx;
+}
+
+static void
+string_heap_init (MonoDynamicStream *sh)
+{
+ sh->index = 0;
+ sh->alloc_size = 4096;
+ sh->data = g_malloc (4096);
+ sh->hash = g_hash_table_new (g_str_hash, g_str_equal);
+ string_heap_insert (sh, "");
+}
+
+#if 0 /* never used */
+static void
+string_heap_free (MonoDynamicStream *sh)
+{
+ g_free (sh->data);
+ g_hash_table_foreach (sh->hash, (GHFunc)g_free, NULL);
+ g_hash_table_destroy (sh->hash);
+}
+#endif
+
+static guint32
+mono_image_add_stream_data (MonoDynamicStream *stream, const char *data, guint32 len)
+{
+ guint32 idx;
+ if (stream->alloc_size < stream->index + len) {
+ stream->alloc_size += len + 4096;
+ stream->data = g_realloc (stream->data, stream->alloc_size);
+ }
+ memcpy (stream->data + stream->index, data, len);
+ idx = stream->index;
+ stream->index += len;
+ /*
+ * align index? Not without adding an additional param that controls it since
+ * we may store a blob value in pieces.
+ */
+ return idx;
+}
+
+static void
+stream_data_align (MonoDynamicStream *stream)
+{
+ char buf [4] = {0};
+ guint32 count = stream->index % 4;
+
+ /* we assume the stream data will be aligned */
+ if (count)
+ mono_image_add_stream_data (stream, buf, 4 - count);
+}
+
+static void
+encode_type (MonoDynamicAssembly *assembly, MonoType *type, char *p, char **endbuf)
+{
+ if (!type) {
+ g_assert_not_reached ();
+ return;
+ }
+
+ if (type->byref)
+ mono_metadata_encode_value (MONO_TYPE_BYREF, p, &p);
+
+ switch (type->type){
+ case MONO_TYPE_VOID:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_TYPEDBYREF:
+ mono_metadata_encode_value (type->type, p, &p);
+ break;
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ mono_metadata_encode_value (type->type, p, &p);
+ encode_type (assembly, type->data.type, p, &p);
+ break;
+ case MONO_TYPE_VALUETYPE:
+ case MONO_TYPE_CLASS:
+ mono_metadata_encode_value (type->type, p, &p);
+ mono_metadata_encode_value (mono_image_typedef_or_ref (assembly, type), p, &p);
+ break;
+ case MONO_TYPE_ARRAY:
+ mono_metadata_encode_value (type->type, p, &p);
+ encode_type (assembly, type->data.array->type, p, &p);
+ mono_metadata_encode_value (type->data.array->rank, p, &p);
+ mono_metadata_encode_value (0, p, &p); /* FIXME: set to 0 for now */
+ mono_metadata_encode_value (0, p, &p);
+ break;
+ default:
+ g_error ("need to encode type %x", type->type);
+ }
+ *endbuf = p;
+}
+
+static void
+encode_reflection_type (MonoDynamicAssembly *assembly, MonoReflectionType *type, char *p, char **endbuf)
+{
+ if (!type) {
+ mono_metadata_encode_value (MONO_TYPE_VOID, p, endbuf);
+ return;
+ }
+ if (type->type) {
+ encode_type (assembly, type->type, p, endbuf);
+ return;
+ }
+
+ g_assert_not_reached ();
+
+}
+
+static guint32
+method_encode_signature (MonoDynamicAssembly *assembly, MonoMethodSignature *sig)
+{
+ char *buf;
+ char *p;
+ int i;
+ guint32 nparams = sig->param_count;
+ guint32 size = 10 + nparams * 10;
+ guint32 idx;
+ char blob_size [6];
+ char *b = blob_size;
+
+ p = buf = g_malloc (size);
+ /*
+ * FIXME: vararg, explicit_this, differenc call_conv values...
+ */
+ *p = sig->call_convention;
+ if (sig->hasthis)
+ *p |= 0x20; /* hasthis */
+ p++;
+ mono_metadata_encode_value (nparams, p, &p);
+ encode_type (assembly, sig->ret, p, &p);
+ for (i = 0; i < nparams; ++i)
+ encode_type (assembly, sig->params [i], p, &p);
+ /* store length */
+ g_assert (p - buf < size);
+ mono_metadata_encode_value (p-buf, b, &b);
+ idx = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+ mono_image_add_stream_data (&assembly->blob, buf, p-buf);
+ g_free (buf);
+ return idx;
+}
+
+static guint32
+method_builder_encode_signature (MonoDynamicAssembly *assembly, ReflectionMethodBuilder *mb)
+{
+ /*
+ * FIXME: reuse code from method_encode_signature().
+ */
+ char *buf;
+ char *p;
+ int i;
+ guint32 nparams = mb->parameters ? mono_array_length (mb->parameters): 0;
+ guint32 size = 10 + nparams * 10;
+ guint32 idx;
+ char blob_size [6];
+ char *b = blob_size;
+
+ p = buf = g_malloc (size);
+ /* LAMESPEC: all the call conv spec is foobared */
+ *p = mb->call_conv & 0x60; /* has-this, explicit-this */
+ if (mb->call_conv & 2)
+ *p |= 0x5; /* vararg */
+ if (!(mb->attrs & METHOD_ATTRIBUTE_STATIC))
+ *p |= 0x20; /* hasthis */
+ p++;
+ mono_metadata_encode_value (nparams, p, &p);
+ encode_reflection_type (assembly, mb->rtype, p, &p);
+ for (i = 0; i < nparams; ++i) {
+ MonoReflectionType *pt = mono_array_get (mb->parameters, MonoReflectionType*, i);
+ encode_reflection_type (assembly, pt, p, &p);
+ }
+ /* store length */
+ g_assert (p - buf < size);
+ mono_metadata_encode_value (p-buf, b, &b);
+ idx = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+ mono_image_add_stream_data (&assembly->blob, buf, p-buf);
+ g_free (buf);
+ return idx;
+}
+
+static guint32
+encode_locals (MonoDynamicAssembly *assembly, MonoReflectionILGen *ilgen)
+{
+ MonoDynamicTable *table;
+ guint32 *values;
+ char *p;
+ guint32 idx, sig_idx, size;
+ guint nl = mono_array_length (ilgen->locals);
+ char *buf;
+ char blob_size [6];
+ char *b = blob_size;
+ int i;
+
+ size = 10 + nl * 10;
+ p = buf = g_malloc (size);
+ table = &assembly->tables [MONO_TABLE_STANDALONESIG];
+ idx = table->next_idx ++;
+ table->rows ++;
+ alloc_table (table, table->rows);
+ values = table->values + idx * MONO_STAND_ALONE_SIGNATURE_SIZE;
+
+ mono_metadata_encode_value (0x07, p, &p);
+ mono_metadata_encode_value (nl, p, &p);
+ for (i = 0; i < nl; ++i) {
+ MonoReflectionLocalBuilder *lb = mono_array_get (ilgen->locals, MonoReflectionLocalBuilder*, i);
+ encode_reflection_type (assembly, lb->type, p, &p);
+ }
+ g_assert (p - buf < size);
+ mono_metadata_encode_value (p-buf, b, &b);
+ sig_idx = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+ mono_image_add_stream_data (&assembly->blob, buf, p-buf);
+ g_free (buf);
+
+ values [MONO_STAND_ALONE_SIGNATURE] = sig_idx;
+
+ return idx;
+}
+
+static guint32
+method_encode_code (MonoDynamicAssembly *assembly, ReflectionMethodBuilder *mb)
+{
+ char flags = 0;
+ guint32 idx;
+ guint32 code_size;
+ gint32 max_stack, i;
+ gint32 num_locals = 0;
+ gint32 num_exception = 0;
+ gint maybe_small;
+ guint32 fat_flags;
+ char fat_header [12];
+ guint32 *intp;
+ guint16 *shortp;
+ guint32 local_sig = 0;
+ guint32 header_size = 12;
+ MonoArray *code;
+
+ if ((mb->attrs & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
+ (mb->iattrs & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
+ (mb->iattrs & METHOD_IMPL_ATTRIBUTE_RUNTIME) ||
+ (mb->attrs & METHOD_ATTRIBUTE_ABSTRACT))
+ return 0;
+
+ /*if (mb->name)
+ g_print ("Encode method %s\n", mono_string_to_utf8 (mb->name));*/
+ if (mb->ilgen) {
+ code = mb->ilgen->code;
+ code_size = mb->ilgen->code_len;
+ max_stack = mb->ilgen->max_stack;
+ num_locals = mb->ilgen->locals ? mono_array_length (mb->ilgen->locals) : 0;
+ if (mb->ilgen->ex_handlers) {
+ MonoILExceptionInfo *ex_info;
+ for (i = 0; i < mono_array_length (mb->ilgen->ex_handlers); ++i) {
+ ex_info = (MonoILExceptionInfo*)mono_array_addr (mb->ilgen->ex_handlers, MonoILExceptionInfo, i);
+ if (ex_info->handlers)
+ num_exception += mono_array_length (ex_info->handlers);
+ else
+ num_exception++;
+ }
+ }
+ } else {
+ code = mb->code;
+ code_size = mono_array_length (code);
+ max_stack = 8; /* we probably need to run a verifier on the code... */
+ }
+
+ /* check for exceptions, maxstack, locals */
+ maybe_small = (max_stack <= 8) && (!num_locals) && (!num_exception);
+ if (maybe_small) {
+ if (code_size < 64 && !(code_size & 1)) {
+ flags = (code_size << 2) | 0x2;
+ } else if (code_size < 32 && (code_size & 1)) {
+ flags = (code_size << 2) | 0x6; /* LAMESPEC: see metadata.c */
+ } else {
+ goto fat_header;
+ }
+ idx = mono_image_add_stream_data (&assembly->code, &flags, 1);
+ /* add to the fixup todo list */
+ if (mb->ilgen && mb->ilgen->num_token_fixups)
+ mono_g_hash_table_insert (assembly->token_fixups, mb->ilgen, GUINT_TO_POINTER (idx + 1));
+ mono_image_add_stream_data (&assembly->code, mono_array_addr (code, char, 0), code_size);
+ return assembly->text_rva + idx + CLI_H_SIZE;
+ }
+fat_header:
+ if (num_locals)
+ local_sig = MONO_TOKEN_SIGNATURE | encode_locals (assembly, mb->ilgen);
+ /*
+ * FIXME: need to set also the header size in fat_flags.
+ * (and more sects and init locals flags)
+ */
+ fat_flags = 0x03;
+ if (num_exception)
+ fat_flags |= METHOD_HEADER_MORE_SECTS;
+ fat_header [0] = fat_flags;
+ fat_header [1] = (header_size / 4 ) << 4;
+ shortp = (guint16*)(fat_header + 2);
+ *shortp = max_stack;
+ intp = (guint32*)(fat_header + 4);
+ *intp = code_size;
+ intp = (guint32*)(fat_header + 8);
+ *intp = local_sig;
+ idx = mono_image_add_stream_data (&assembly->code, fat_header, 12);
+ /* add to the fixup todo list */
+ if (mb->ilgen && mb->ilgen->num_token_fixups)
+ mono_g_hash_table_insert (assembly->token_fixups, mb->ilgen, GUINT_TO_POINTER (idx + 12));
+
+ mono_image_add_stream_data (&assembly->code, mono_array_addr (code, char, 0), code_size);
+ if (num_exception) {
+ unsigned char sheader [4];
+ MonoExceptionClause clause;
+ MonoILExceptionInfo * ex_info;
+ MonoILExceptionBlock * ex_block;
+ int j;
+
+ stream_data_align (&assembly->code);
+ /* always use fat format for now */
+ sheader [0] = METHOD_HEADER_SECTION_FAT_FORMAT | METHOD_HEADER_SECTION_EHTABLE;
+ num_exception *= sizeof (MonoExceptionClause);
+ sheader [1] = num_exception & 0xff;
+ sheader [2] = (num_exception >> 8) & 0xff;
+ sheader [3] = (num_exception >> 16) & 0xff;
+ mono_image_add_stream_data (&assembly->code, sheader, 4);
+ /* fat header, so we are already aligned */
+ /* reverse order */
+ for (i = mono_array_length (mb->ilgen->ex_handlers) - 1; i >= 0; --i) {
+ ex_info = (MonoILExceptionInfo *)mono_array_addr (mb->ilgen->ex_handlers, MonoILExceptionInfo, i);
+ if (ex_info->handlers) {
+ int finally_start = 0;
+ for (j = 0; j < mono_array_length (ex_info->handlers); ++j) {
+ ex_block = (MonoILExceptionBlock*)mono_array_addr (ex_info->handlers, MonoILExceptionBlock, j);
+ clause.flags = ex_block->type;
+ clause.try_offset = ex_info->start;
+ /* need fault, too, probably */
+ if (clause.flags == MONO_EXCEPTION_CLAUSE_FINALLY)
+ clause.try_len = finally_start - ex_info->start;
+ else
+ clause.try_len = ex_info->len;
+ clause.handler_offset = ex_block->start;
+ clause.handler_len = ex_block->len;
+ finally_start = clause.handler_offset + clause.handler_len;
+ clause.token_or_filter = ex_block->extype ? mono_metadata_token_from_dor (
+ mono_image_typedef_or_ref (assembly, ex_block->extype->type)): 0;
+ /*g_print ("out clause %d: from %d len=%d, handler at %d, %d\n",
+ clause.flags, clause.try_offset, clause.try_len, clause.handler_offset, clause.handler_len);*/
+ /* FIXME: ENOENDIAN */
+ mono_image_add_stream_data (&assembly->code, (char*)&clause, sizeof (clause));
+ }
+ } else {
+ g_error ("No clauses for ex info block %d", i);
+ }
+ }
+ }
+ return assembly->text_rva + idx + CLI_H_SIZE;
+}
+
+static guint32
+find_index_in_table (MonoDynamicAssembly *assembly, int table_idx, int col, guint32 token)
+{
+ int i;
+ MonoDynamicTable *table;
+ guint32 *values;
+
+ table = &assembly->tables [table_idx];
+
+ g_assert (col < table->columns);
+
+ values = table->values + table->columns;
+ for (i = 1; i <= table->rows; ++i) {
+ if (values [col] == token)
+ return i;
+ }
+ return 0;
+}
+
+/*
+ * idx is the table index of the object
+ * type is one of CUSTOM_ATTR_*
+ */
+static void
+mono_image_add_cattrs (MonoDynamicAssembly *assembly, guint32 idx, guint32 type, MonoArray *cattrs)
+{
+ MonoDynamicTable *table;
+ MonoReflectionCustomAttr *cattr;
+ guint32 *values;
+ guint32 count, i, token;
+ char blob_size [6];
+ char *p = blob_size;
+
+ /* it is legal to pass a NULL cattrs: we avoid to use the if in a lot of places */
+ if (!cattrs)
+ return;
+ count = mono_array_length (cattrs);
+ table = &assembly->tables [MONO_TABLE_CUSTOMATTRIBUTE];
+ table->rows += count;
+ alloc_table (table, table->rows);
+ values = table->values + table->next_idx * MONO_CUSTOM_ATTR_SIZE;
+ idx <<= CUSTOM_ATTR_BITS;
+ idx |= type;
+ for (i = 0; i < count; ++i) {
+ cattr = (MonoReflectionCustomAttr*)mono_array_get (cattrs, gpointer, i);
+ values [MONO_CUSTOM_ATTR_PARENT] = idx;
+ token = mono_image_create_token (assembly, (MonoObject*)cattr->ctor);
+ type = mono_metadata_token_index (token);
+ type <<= CUSTOM_ATTR_TYPE_BITS;
+ switch (mono_metadata_token_table (token)) {
+ case MONO_TABLE_METHOD:
+ type |= CUSTOM_ATTR_TYPE_METHODDEF;
+ break;
+ case MONO_TABLE_MEMBERREF:
+ type |= CUSTOM_ATTR_TYPE_MEMBERREF;
+ break;
+ default:
+ g_error ("got wrong token in custom attr");
+ }
+ values [MONO_CUSTOM_ATTR_TYPE] = type;
+ p = blob_size;
+ mono_metadata_encode_value (mono_array_length (cattr->data), p, &p);
+ values [MONO_CUSTOM_ATTR_VALUE] = mono_image_add_stream_data (&assembly->blob, blob_size, p - blob_size);
+ mono_image_add_stream_data (&assembly->blob,
+ mono_array_addr (cattr->data, char, 0), mono_array_length (cattr->data));
+ values += MONO_CUSTOM_ATTR_SIZE;
+ ++table->next_idx;
+ }
+}
+
+/*
+ * Fill in the MethodDef and ParamDef tables for a method.
+ * This is used for both normal methods and constructors.
+ */
+static void
+mono_image_basic_method (ReflectionMethodBuilder *mb, MonoDynamicAssembly *assembly)
+{
+ MonoDynamicTable *table;
+ guint32 *values;
+ char *name;
+ guint i, count;
+
+ /* room in this table is already allocated */
+ table = &assembly->tables [MONO_TABLE_METHOD];
+ *mb->table_idx = table->next_idx ++;
+ values = table->values + *mb->table_idx * MONO_METHOD_SIZE;
+ if (mb->name) {
+ name = mono_string_to_utf8 (mb->name);
+ values [MONO_METHOD_NAME] = string_heap_insert (&assembly->sheap, name);
+ g_free (name);
+ } else { /* a constructor */
+ values [MONO_METHOD_NAME] = string_heap_insert (&assembly->sheap, mb->attrs & METHOD_ATTRIBUTE_STATIC? ".cctor": ".ctor");
+ }
+ values [MONO_METHOD_FLAGS] = mb->attrs;
+ values [MONO_METHOD_IMPLFLAGS] = mb->iattrs;
+ values [MONO_METHOD_SIGNATURE] = method_builder_encode_signature (assembly, mb);
+ values [MONO_METHOD_RVA] = method_encode_code (assembly, mb);
+
+ table = &assembly->tables [MONO_TABLE_PARAM];
+ values [MONO_METHOD_PARAMLIST] = table->next_idx;
+
+ if (mb->pinfo) {
+ count = 0;
+ for (i = 0; i < mono_array_length (mb->pinfo); ++i) {
+ if (mono_array_get (mb->pinfo, gpointer, i))
+ count++;
+ }
+ table->rows += count;
+ alloc_table (table, table->rows);
+ values = table->values + table->next_idx * MONO_PARAM_SIZE;
+ for (i = 0; i < mono_array_length (mb->pinfo); ++i) {
+ MonoReflectionParamBuilder *pb;
+ if ((pb = mono_array_get (mb->pinfo, MonoReflectionParamBuilder*, i))) {
+ values [MONO_PARAM_FLAGS] = pb->attrs;
+ values [MONO_PARAM_SEQUENCE] = i;
+ name = mono_string_to_utf8 (pb->name);
+ values [MONO_PARAM_NAME] = string_heap_insert (&assembly->sheap, name);
+ g_free (name);
+ values += MONO_PARAM_SIZE;
+ table->next_idx++;
+ mono_image_add_cattrs (assembly, pb->table_idx, CUSTOM_ATTR_PARAMDEF, pb->cattrs);
+ }
+ }
+ }
+}
+
+static void
+mono_image_get_method_info (MonoReflectionMethodBuilder *mb, MonoDynamicAssembly *assembly)
+{
+ MonoDynamicTable *table;
+ guint32 *values;
+ char *name;
+ ReflectionMethodBuilder rmb;
+
+ rmb.ilgen = mb->ilgen;
+ rmb.rtype = mb->rtype;
+ rmb.parameters = mb->parameters;
+ rmb.pinfo = mb->pinfo;
+ rmb.attrs = mb->attrs;
+ rmb.iattrs = mb->iattrs;
+ rmb.call_conv = mb->call_conv;
+ rmb.code = mb->code;
+ rmb.type = mb->type;
+ rmb.name = mb->name;
+ rmb.table_idx = &mb->table_idx;
+
+ mono_image_basic_method (&rmb, assembly);
+
+ if (mb->dll) { /* It's a P/Invoke method */
+ guint32 moduleref;
+ table = &assembly->tables [MONO_TABLE_IMPLMAP];
+ table->rows ++;
+ alloc_table (table, table->rows);
+ values = table->values + table->rows * MONO_IMPLMAP_SIZE;
+ values [MONO_IMPLMAP_FLAGS] = (mb->native_cc << 8) | mb->charset;
+ values [MONO_IMPLMAP_MEMBER] = (mb->table_idx << 1) | 1; /* memberforwarded: method */
+ name = mono_string_to_utf8 (mb->dllentry);
+ values [MONO_IMPLMAP_NAME] = string_heap_insert (&assembly->sheap, name);
+ g_free (name);
+ name = mono_string_to_utf8 (mb->dll);
+ moduleref = string_heap_insert (&assembly->sheap, name);
+ g_free (name);
+ if (!(values [MONO_IMPLMAP_SCOPE] = find_index_in_table (assembly, MONO_TABLE_MODULEREF, MONO_MODULEREF_NAME, moduleref))) {
+ table = &assembly->tables [MONO_TABLE_MODULEREF];
+ table->rows ++;
+ alloc_table (table, table->rows);
+ table->values [table->rows * MONO_MODULEREF_SIZE + MONO_MODULEREF_NAME] = moduleref;
+ values [MONO_IMPLMAP_SCOPE] = table->rows;
+ }
+ }
+ if (mb->override_method) {
+ MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)mb->type;
+ table = &assembly->tables [MONO_TABLE_METHODIMPL];
+ table->rows ++;
+ alloc_table (table, table->rows);
+ values = table->values + table->rows * MONO_MTHODIMPL_SIZE;
+ values [MONO_MTHODIMPL_CLASS] = tb->table_idx;
+ values [MONO_MTHODIMPL_BODY] = METHODDEFORREF_METHODDEF | (mb->table_idx << METHODDEFORREF_BITS);
+ if (mb->override_method->method)
+ values [MONO_MTHODIMPL_DECLARATION] = mono_image_get_methodref_token (assembly, mb->override_method->method);
+ else {
+ MonoReflectionMethodBuilder *omb = (MonoReflectionMethodBuilder*)mb->override_method;
+ values [MONO_MTHODIMPL_DECLARATION] = METHODDEFORREF_METHODDEF | (omb->table_idx << METHODDEFORREF_BITS);
+ }
+ }
+ mono_image_add_cattrs (assembly, mb->table_idx, CUSTOM_ATTR_METHODDEF, mb->cattrs);
+}
+
+static void
+mono_image_get_ctor_info (MonoDomain *domain, MonoReflectionCtorBuilder *mb, MonoDynamicAssembly *assembly)
+{
+ ReflectionMethodBuilder rmb;
+
+ rmb.ilgen = mb->ilgen;
+ rmb.rtype = mono_type_get_object (domain, &mono_defaults.void_class->byval_arg);
+ rmb.parameters = mb->parameters;
+ rmb.pinfo = mb->pinfo;
+ rmb.attrs = mb->attrs;
+ rmb.iattrs = mb->iattrs;
+ rmb.call_conv = mb->call_conv;
+ rmb.code = NULL;
+ rmb.type = mb->type;
+ rmb.name = NULL;
+ rmb.table_idx = &mb->table_idx;
+
+ mono_image_basic_method (&rmb, assembly);
+ mono_image_add_cattrs (assembly, mb->table_idx, CUSTOM_ATTR_METHODDEF, mb->cattrs);
+
+}
+
+static guint32
+fieldref_encode_signature (MonoDynamicAssembly *assembly, MonoClassField *field)
+{
+ char blob_size [64];
+ char *b = blob_size;
+ char *p;
+ char* buf;
+ guint32 idx;
+
+ p = buf = g_malloc (64);
+
+ /* No start code with field refs...
+ * mono_metadata_encode_value (0x06, p, &p);
+ */
+ /* encode custom attributes before the type */
+ encode_type (assembly, field->type, p, &p);
+ g_assert (p-buf < 64);
+ mono_metadata_encode_value (p-buf, b, &b);
+ idx = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+ mono_image_add_stream_data (&assembly->blob, buf, p-buf);
+ g_free (buf);
+ return idx;
+}
+
+static guint32
+field_encode_signature (MonoDynamicAssembly *assembly, MonoReflectionFieldBuilder *fb)
+{
+ char blob_size [64];
+ char *b = blob_size;
+ char *p;
+ char* buf;
+ guint32 idx;
+
+ p = buf = g_malloc (64);
+
+ mono_metadata_encode_value (0x06, p, &p);
+ /* encode custom attributes before the type */
+ encode_reflection_type (assembly, fb->type, p, &p);
+ g_assert (p-buf < 64);
+ mono_metadata_encode_value (p-buf, b, &b);
+ idx = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+ mono_image_add_stream_data (&assembly->blob, buf, p-buf);
+ g_free (buf);
+ return idx;
+}
+
+static guint32
+encode_constant (MonoDynamicAssembly *assembly, MonoObject *val, guint32 *ret_type) {
+ char blob_size [64];
+ char *b = blob_size;
+ char *p, *box_val;
+ char* buf;
+ guint32 idx, len;
+
+ p = buf = g_malloc (64);
+
+ box_val = ((char*)val) + sizeof (MonoObject);
+ *ret_type = val->vtable->klass->byval_arg.type;
+handle_enum:
+ switch (*ret_type) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ len = 1;
+ break;
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2:
+ len = 2;
+ break;
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_R4:
+ len = 4;
+ break;
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_R8:
+ len = 8;
+ break;
+ case MONO_TYPE_VALUETYPE:
+ if (val->vtable->klass->enumtype) {
+ *ret_type = val->vtable->klass->enum_basetype->type;
+ goto handle_enum;
+ } else
+ g_error ("we can't encode valuetypes");
+ case MONO_TYPE_STRING: {
+ MonoString *str = (MonoString*)val;
+ /* there is no signature */
+ len = str->length * 2;
+ mono_metadata_encode_value (len, b, &b);
+ idx = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+ /* FIXME: ENOENDIAN */
+ mono_image_add_stream_data (&assembly->blob, (const char*)mono_string_chars (str), len);
+
+ g_free (buf);
+ return idx;
+ }
+ default:
+ g_error ("we don't encode constant type 0x%02x yet", *ret_type);
+ }
+
+ /* there is no signature */
+ mono_metadata_encode_value (len, b, &b);
+ idx = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+ /* FIXME: ENOENDIAN */
+ mono_image_add_stream_data (&assembly->blob, box_val, len);
+
+ g_free (buf);
+ return idx;
+}
+
+static void
+mono_image_get_field_info (MonoReflectionFieldBuilder *fb, MonoDynamicAssembly *assembly)
+{
+ MonoDynamicTable *table;
+ guint32 *values;
+ char *name;
+
+ /* maybe this fixup should be done in the C# code */
+ if (fb->attrs & FIELD_ATTRIBUTE_LITERAL)
+ fb->attrs |= FIELD_ATTRIBUTE_HAS_DEFAULT;
+ table = &assembly->tables [MONO_TABLE_FIELD];
+ fb->table_idx = table->next_idx ++;
+ values = table->values + fb->table_idx * MONO_FIELD_SIZE;
+ name = mono_string_to_utf8 (fb->name);
+ values [MONO_FIELD_NAME] = string_heap_insert (&assembly->sheap, name);
+ g_free (name);
+ values [MONO_FIELD_FLAGS] = fb->attrs;
+ values [MONO_FIELD_SIGNATURE] = field_encode_signature (assembly, fb);
+
+ if (fb->offset != -1) {
+ table = &assembly->tables [MONO_TABLE_FIELDLAYOUT];
+ table->rows ++;
+ alloc_table (table, table->rows);
+ values = table->values + table->rows * MONO_FIELD_LAYOUT_SIZE;
+ values [MONO_FIELD_LAYOUT_FIELD] = fb->table_idx;
+ values [MONO_FIELD_LAYOUT_OFFSET] = fb->offset;
+ }
+ if (fb->attrs & FIELD_ATTRIBUTE_LITERAL) {
+ guint32 field_type = 0;
+ table = &assembly->tables [MONO_TABLE_CONSTANT];
+ table->rows ++;
+ alloc_table (table, table->rows);
+ values = table->values + table->rows * MONO_CONSTANT_SIZE;
+ values [MONO_CONSTANT_PARENT] = HASCONSTANT_FIEDDEF | (fb->table_idx << HASCONSTANT_BITS);
+ values [MONO_CONSTANT_VALUE] = encode_constant (assembly, fb->def_value, &field_type);
+ values [MONO_CONSTANT_TYPE] = field_type;
+ values [MONO_CONSTANT_PADDING] = 0;
+ }
+ if (fb->rva_data) {
+ guint32 rva_idx;
+ table = &assembly->tables [MONO_TABLE_FIELDRVA];
+ table->rows ++;
+ alloc_table (table, table->rows);
+ values = table->values + table->rows * MONO_FIELD_RVA_SIZE;
+ values [MONO_FIELD_RVA_FIELD] = fb->table_idx;
+ /*
+ * We store it in the code section because it's simpler for now.
+ */
+ rva_idx = mono_image_add_stream_data (&assembly->code, mono_array_addr (fb->rva_data, char, 0), mono_array_length (fb->rva_data));
+ values [MONO_FIELD_RVA_RVA] = rva_idx + assembly->text_rva + CLI_H_SIZE;
+ }
+ mono_image_add_cattrs (assembly, fb->table_idx, CUSTOM_ATTR_FIELDDEF, fb->cattrs);
+}
+
+static guint32
+property_encode_signature (MonoDynamicAssembly *assembly, MonoReflectionPropertyBuilder *fb)
+{
+ char *buf, *p;
+ char blob_size [6];
+ char *b = blob_size;
+ guint32 nparams = 0;
+ MonoReflectionMethodBuilder *mb = fb->get_method;
+ guint32 idx, i, size;
+
+ if (mb && mb->parameters)
+ nparams = mono_array_length (mb->parameters);
+ size = 24 + nparams * 10;
+ buf = p = g_malloc (size);
+ *p = 0x08;
+ p++;
+ mono_metadata_encode_value (nparams, p, &p);
+ if (mb) {
+ encode_reflection_type (assembly, mb->rtype, p, &p);
+ for (i = 0; i < nparams; ++i) {
+ MonoReflectionType *pt = mono_array_get (mb->parameters, MonoReflectionType*, i);
+ encode_reflection_type (assembly, pt, p, &p);
+ }
+ } else {
+ *p++ = 1; /* void: a property should probably not be allowed without a getter */
+ }
+ /* store length */
+ g_assert (p - buf < size);
+ mono_metadata_encode_value (p-buf, b, &b);
+ idx = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+ mono_image_add_stream_data (&assembly->blob, buf, p-buf);
+ g_free (buf);
+ return idx;
+}
+
+static void
+mono_image_get_property_info (MonoReflectionPropertyBuilder *pb, MonoDynamicAssembly *assembly)
+{
+ MonoDynamicTable *table;
+ guint32 *values;
+ char *name;
+ guint num_methods = 0;
+ guint32 semaidx;
+
+ /*
+ * we need to set things in the following tables:
+ * PROPERTYMAP (info already filled in _get_type_info ())
+ * PROPERTY (rows already preallocated in _get_type_info ())
+ * METHOD (method info already done with the generic method code)
+ * METHODSEMANTICS
+ */
+ table = &assembly->tables [MONO_TABLE_PROPERTY];
+ pb->table_idx = table->next_idx ++;
+ values = table->values + pb->table_idx * MONO_PROPERTY_SIZE;
+ name = mono_string_to_utf8 (pb->name);
+ values [MONO_PROPERTY_NAME] = string_heap_insert (&assembly->sheap, name);
+ g_free (name);
+ values [MONO_PROPERTY_FLAGS] = pb->attrs;
+ values [MONO_PROPERTY_TYPE] = property_encode_signature (assembly, pb);
+
+ /* FIXME: we still don't handle 'other' methods */
+ if (pb->get_method) num_methods ++;
+ if (pb->set_method) num_methods ++;
+
+ table = &assembly->tables [MONO_TABLE_METHODSEMANTICS];
+ table->rows += num_methods;
+ alloc_table (table, table->rows);
+
+ if (pb->get_method) {
+ semaidx = table->next_idx ++;
+ values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
+ values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_GETTER;
+ values [MONO_METHOD_SEMA_METHOD] = pb->get_method->table_idx;
+ values [MONO_METHOD_SEMA_ASSOCIATION] = (pb->table_idx << HAS_SEMANTICS_BITS) | HAS_SEMANTICS_PROPERTY;
+ }
+ if (pb->set_method) {
+ semaidx = table->next_idx ++;
+ values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
+ values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_SETTER;
+ values [MONO_METHOD_SEMA_METHOD] = pb->set_method->table_idx;
+ values [MONO_METHOD_SEMA_ASSOCIATION] = (pb->table_idx << HAS_SEMANTICS_BITS) | HAS_SEMANTICS_PROPERTY;
+ }
+ mono_image_add_cattrs (assembly, pb->table_idx, CUSTOM_ATTR_PROPERTY, pb->cattrs);
+}
+
+static void
+mono_image_get_event_info (MonoReflectionEventBuilder *eb, MonoDynamicAssembly *assembly)
+{
+ MonoDynamicTable *table;
+ guint32 *values;
+ char *name;
+ guint num_methods = 0;
+ guint32 semaidx;
+
+ /*
+ * we need to set things in the following tables:
+ * EVENTMAP (info already filled in _get_type_info ())
+ * EVENT (rows already preallocated in _get_type_info ())
+ * METHOD (method info already done with the generic method code)
+ * METHODSEMANTICS
+ */
+ table = &assembly->tables [MONO_TABLE_EVENT];
+ eb->table_idx = table->next_idx ++;
+ values = table->values + eb->table_idx * MONO_EVENT_SIZE;
+ name = mono_string_to_utf8 (eb->name);
+ values [MONO_EVENT_NAME] = string_heap_insert (&assembly->sheap, name);
+ g_free (name);
+ values [MONO_EVENT_FLAGS] = eb->attrs;
+ values [MONO_EVENT_TYPE] = mono_image_typedef_or_ref (assembly, eb->type->type);
+
+ /*
+ * FIXME: we still don't handle 'other' methods
+ */
+ if (eb->add_method) num_methods ++;
+ if (eb->remove_method) num_methods ++;
+ if (eb->raise_method) num_methods ++;
+
+ table = &assembly->tables [MONO_TABLE_METHODSEMANTICS];
+ table->rows += num_methods;
+ alloc_table (table, table->rows);
+
+ if (eb->add_method) {
+ semaidx = table->next_idx ++;
+ values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
+ values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_ADD_ON;
+ values [MONO_METHOD_SEMA_METHOD] = eb->add_method->table_idx;
+ values [MONO_METHOD_SEMA_ASSOCIATION] = (eb->table_idx << HAS_SEMANTICS_BITS) | HAS_SEMANTICS_EVENT;
+ }
+ if (eb->remove_method) {
+ semaidx = table->next_idx ++;
+ values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
+ values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_REMOVE_ON;
+ values [MONO_METHOD_SEMA_METHOD] = eb->remove_method->table_idx;
+ values [MONO_METHOD_SEMA_ASSOCIATION] = (eb->table_idx << HAS_SEMANTICS_BITS) | HAS_SEMANTICS_EVENT;
+ }
+ if (eb->raise_method) {
+ semaidx = table->next_idx ++;
+ values = table->values + semaidx * MONO_METHOD_SEMA_SIZE;
+ values [MONO_METHOD_SEMA_SEMANTICS] = METHOD_SEMANTIC_FIRE;
+ values [MONO_METHOD_SEMA_METHOD] = eb->raise_method->table_idx;
+ values [MONO_METHOD_SEMA_ASSOCIATION] = (eb->table_idx << HAS_SEMANTICS_BITS) | HAS_SEMANTICS_EVENT;
+ }
+ mono_image_add_cattrs (assembly, eb->table_idx, CUSTOM_ATTR_EVENT, eb->cattrs);
+}
+
+static guint32
+resolution_scope_from_image (MonoDynamicAssembly *assembly, MonoImage *image)
+{
+ MonoDynamicTable *table;
+ guint32 token;
+ guint32 *values;
+ guint32 cols [MONO_ASSEMBLY_SIZE];
+
+ if ((token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, image))))
+ return token;
+
+ mono_metadata_decode_row (&image->tables [MONO_TABLE_ASSEMBLY], 0, cols, MONO_ASSEMBLY_SIZE);
+
+ table = &assembly->tables [MONO_TABLE_ASSEMBLYREF];
+ token = table->next_idx ++;
+ table->rows ++;
+ alloc_table (table, table->rows);
+ values = table->values + token * MONO_ASSEMBLYREF_SIZE;
+ if (strcmp ("corlib", image->assembly_name) == 0)
+ values [MONO_ASSEMBLYREF_NAME] = string_heap_insert (&assembly->sheap, "mscorlib");
+ else
+ values [MONO_ASSEMBLYREF_NAME] = string_heap_insert (&assembly->sheap, image->assembly_name);
+ values [MONO_ASSEMBLYREF_MAJOR_VERSION] = cols [MONO_ASSEMBLY_MAJOR_VERSION];
+ values [MONO_ASSEMBLYREF_MINOR_VERSION] = cols [MONO_ASSEMBLY_MINOR_VERSION];
+ values [MONO_ASSEMBLYREF_BUILD_NUMBER] = cols [MONO_ASSEMBLY_BUILD_NUMBER];
+ values [MONO_ASSEMBLYREF_REV_NUMBER] = cols [MONO_ASSEMBLY_REV_NUMBER];
+ values [MONO_ASSEMBLYREF_FLAGS] = 0;
+ values [MONO_ASSEMBLYREF_PUBLIC_KEY] = 0;
+ values [MONO_ASSEMBLYREF_CULTURE] = 0;
+ values [MONO_ASSEMBLYREF_HASH_VALUE] = 0;
+
+ token <<= RESOLTION_SCOPE_BITS;
+ token |= RESOLTION_SCOPE_ASSEMBLYREF;
+ g_hash_table_insert (assembly->handleref, image, GUINT_TO_POINTER (token));
+ return token;
+}
+
+static guint32
+create_typespec (MonoDynamicAssembly *assembly, MonoType *type)
+{
+ MonoDynamicTable *table;
+ guint32 *values;
+ guint32 token;
+ char sig [128];
+ char *p = sig;
+ char blob_size [6];
+ char *b = blob_size;
+
+ switch (type->type) {
+ case MONO_TYPE_FNPTR:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ encode_type (assembly, type, p, &p);
+ break;
+ default:
+ return 0;
+ }
+
+ g_assert (p-sig < 128);
+ mono_metadata_encode_value (p-sig, b, &b);
+ token = mono_image_add_stream_data (&assembly->blob, blob_size, b-blob_size);
+ mono_image_add_stream_data (&assembly->blob, sig, p-sig);
+
+ table = &assembly->tables [MONO_TABLE_TYPESPEC];
+ alloc_table (table, table->rows + 1);
+ values = table->values + table->next_idx * MONO_TYPESPEC_SIZE;
+ values [MONO_TYPESPEC_SIGNATURE] = token;
+
+ token = TYPEDEFORREF_TYPESPEC | (table->next_idx << TYPEDEFORREF_BITS);
+ g_hash_table_insert (assembly->typeref, type, GUINT_TO_POINTER(token));
+ table->next_idx ++;
+ return token;
+}
+
+/*
+ * Despite the name, we handle also TypeSpec (with the above helper).
+ */
+static guint32
+mono_image_typedef_or_ref (MonoDynamicAssembly *assembly, MonoType *type)
+{
+ MonoDynamicTable *table;
+ guint32 *values;
+ guint32 token;
+ MonoClass *klass;
+
+ token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->typeref, type));
+ if (token)
+ return token;
+ token = create_typespec (assembly, type);
+ if (token)
+ return token;
+ klass = mono_class_from_mono_type (type);
+ /*
+ * If it's in the same module:
+ */
+ if (klass->image == assembly->assembly.image) {
+ MonoReflectionTypeBuilder *tb = klass->reflection_info;
+ return TYPEDEFORREF_TYPEDEF | (tb->table_idx << TYPEDEFORREF_BITS);
+ }
+
+ table = &assembly->tables [MONO_TABLE_TYPEREF];
+ alloc_table (table, table->rows + 1);
+ values = table->values + table->next_idx * MONO_TYPEREF_SIZE;
+ values [MONO_TYPEREF_SCOPE] = resolution_scope_from_image (assembly, klass->image);
+ values [MONO_TYPEREF_NAME] = string_heap_insert (&assembly->sheap, klass->name);
+ values [MONO_TYPEREF_NAMESPACE] = string_heap_insert (&assembly->sheap, klass->name_space);
+ token = TYPEDEFORREF_TYPEREF | (table->next_idx << TYPEDEFORREF_BITS); /* typeref */
+ g_hash_table_insert (assembly->typeref, type, GUINT_TO_POINTER(token));
+ table->next_idx ++;
+ return token;
+}
+
+/*
+ * Insert a memberef row into the metadata: the token that point to the memberref
+ * is returned. Caching is done in the caller (mono_image_get_methodref_token() or
+ * mono_image_get_fieldref_token()).
+ * The sig param is an index to an already built signature.
+ */
+static guint32
+mono_image_get_memberref_token (MonoDynamicAssembly *assembly, MonoClass *klass, const char *name, guint32 sig)
+{
+ MonoDynamicTable *table;
+ guint32 *values;
+ guint32 token, pclass;
+ guint32 parent;
+
+ parent = mono_image_typedef_or_ref (assembly, &klass->byval_arg);
+ switch (parent & TYPEDEFORREF_MASK) {
+ case TYPEDEFORREF_TYPEREF:
+ pclass = MEMBERREF_PARENT_TYPEREF;
+ break;
+ case TYPEDEFORREF_TYPESPEC:
+ pclass = MEMBERREF_PARENT_TYPESPEC;
+ break;
+ case TYPEDEFORREF_TYPEDEF:
+ /* should never get here */
+ default:
+ g_error ("unknow typeref or def token");
+ }
+ /* extract the index */
+ parent >>= TYPEDEFORREF_BITS;
+
+ table = &assembly->tables [MONO_TABLE_MEMBERREF];
+ alloc_table (table, table->rows + 1);
+ values = table->values + table->next_idx * MONO_MEMBERREF_SIZE;
+ values [MONO_MEMBERREF_CLASS] = pclass | (parent << MEMBERREF_PARENT_BITS);
+ values [MONO_MEMBERREF_NAME] = string_heap_insert (&assembly->sheap, name);
+ values [MONO_MEMBERREF_SIGNATURE] = sig;
+ token = MONO_TOKEN_MEMBER_REF | table->next_idx;
+ table->next_idx ++;
+
+ return token;
+}
+
+static guint32
+mono_image_get_methodref_token (MonoDynamicAssembly *assembly, MonoMethod *method)
+{
+ guint32 token;
+
+ token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, method));
+ if (token)
+ return token;
+ token = mono_image_get_memberref_token (assembly, method->klass,
+ method->name, method_encode_signature (assembly, method->signature));
+ g_hash_table_insert (assembly->handleref, method, GUINT_TO_POINTER(token));
+ return token;
+}
+
+static guint32
+mono_image_get_fieldref_token (MonoDynamicAssembly *assembly, MonoClassField *field, MonoClass *klass)
+{
+ guint32 token;
+
+ token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, field));
+ if (token)
+ return token;
+ token = mono_image_get_memberref_token (assembly, klass,
+ field->name, fieldref_encode_signature (assembly, field));
+ g_hash_table_insert (assembly->handleref, field, GUINT_TO_POINTER(token));
+ return token;
+}
+
+/*
+ * Insert into the metadata tables all the info about the TypeBuilder tb.
+ * Data in the tables is inserted in a predefined order, since some tables need to be sorted.
+ */
+static void
+mono_image_get_type_info (MonoDomain *domain, MonoReflectionTypeBuilder *tb, MonoDynamicAssembly *assembly)
+{
+ MonoDynamicTable *table;
+ guint *values;
+ int i;
+ char *n;
+
+ table = &assembly->tables [MONO_TABLE_TYPEDEF];
+ values = table->values + tb->table_idx * MONO_TYPEDEF_SIZE;
+ values [MONO_TYPEDEF_FLAGS] = tb->attrs;
+ if (tb->parent) { /* interfaces don't have a parent */
+ values [MONO_TYPEDEF_EXTENDS] = mono_image_typedef_or_ref (assembly, tb->parent->type);
+ } else
+ values [MONO_TYPEDEF_EXTENDS] = 0;
+ n = mono_string_to_utf8 (tb->name);
+ values [MONO_TYPEDEF_NAME] = string_heap_insert (&assembly->sheap, n);
+ g_free (n);
+ n = mono_string_to_utf8 (tb->nspace);
+ values [MONO_TYPEDEF_NAMESPACE] = string_heap_insert (&assembly->sheap, n);
+ g_free (n);
+ values [MONO_TYPEDEF_FIELD_LIST] = assembly->tables [MONO_TABLE_FIELD].next_idx;
+ values [MONO_TYPEDEF_METHOD_LIST] = assembly->tables [MONO_TABLE_METHOD].next_idx;
+
+ /*
+ * if we have explicitlayout or sequentiallayouts, output data in the
+ * ClassLayout table.
+ */
+ if ((tb->attrs & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_AUTO_LAYOUT) {
+ table = &assembly->tables [MONO_TABLE_CLASSLAYOUT];
+ table->rows++;
+ alloc_table (table, table->rows);
+ values = table->values + table->rows * MONO_CLASS_LAYOUT_SIZE;
+ values [MONO_CLASS_LAYOUT_PARENT] = tb->table_idx;
+ values [MONO_CLASS_LAYOUT_CLASS_SIZE] = tb->class_size;
+ values [MONO_CLASS_LAYOUT_PACKING_SIZE] = tb->packing_size;
+ }
+
+ /* handle interfaces */
+ if (tb->interfaces) {
+ table = &assembly->tables [MONO_TABLE_INTERFACEIMPL];
+ i = table->rows;
+ table->rows += mono_array_length (tb->interfaces);
+ alloc_table (table, table->rows);
+ values = table->values + (i + 1) * MONO_INTERFACEIMPL_SIZE;
+ for (i = 0; i < mono_array_length (tb->interfaces); ++i) {
+ MonoReflectionType* iface = (MonoReflectionType*) mono_array_get (tb->interfaces, gpointer, i);
+ values [MONO_INTERFACEIMPL_CLASS] = tb->table_idx;
+ values [MONO_INTERFACEIMPL_INTERFACE] = mono_image_typedef_or_ref (assembly, iface->type);
+ values += MONO_INTERFACEIMPL_SIZE;
+ }
+ }
+
+ /* handle fields */
+ if (tb->fields) {
+ table = &assembly->tables [MONO_TABLE_FIELD];
+ table->rows += mono_array_length (tb->fields);
+ alloc_table (table, table->rows);
+ for (i = 0; i < mono_array_length (tb->fields); ++i)
+ mono_image_get_field_info (
+ mono_array_get (tb->fields, MonoReflectionFieldBuilder*, i), assembly);
+ }
+
+ /* handle constructors */
+ if (tb->ctors) {
+ table = &assembly->tables [MONO_TABLE_METHOD];
+ table->rows += mono_array_length (tb->ctors);
+ alloc_table (table, table->rows);
+ for (i = 0; i < mono_array_length (tb->ctors); ++i)
+ mono_image_get_ctor_info (domain,
+ mono_array_get (tb->ctors, MonoReflectionCtorBuilder*, i), assembly);
+ }
+
+ /* handle methods */
+ if (tb->methods) {
+ table = &assembly->tables [MONO_TABLE_METHOD];
+ table->rows += mono_array_length (tb->methods);
+ alloc_table (table, table->rows);
+ for (i = 0; i < mono_array_length (tb->methods); ++i)
+ mono_image_get_method_info (
+ mono_array_get (tb->methods, MonoReflectionMethodBuilder*, i), assembly);
+ }
+
+ /* Do the same with properties etc.. */
+ /*
+ * FIXME: note that the methodsemantics table needs to be sorted, so events
+ * go before properties; not sure if this is enough...
+ */
+ if (tb->events && mono_array_length (tb->events)) {
+ table = &assembly->tables [MONO_TABLE_EVENT];
+ table->rows += mono_array_length (tb->events);
+ alloc_table (table, table->rows);
+ table = &assembly->tables [MONO_TABLE_EVENTMAP];
+ table->rows ++;
+ alloc_table (table, table->rows);
+ values = table->values + table->rows * MONO_EVENT_MAP_SIZE;
+ values [MONO_EVENT_MAP_PARENT] = tb->table_idx;
+ values [MONO_EVENT_MAP_EVENTLIST] = assembly->tables [MONO_TABLE_EVENT].next_idx;
+ for (i = 0; i < mono_array_length (tb->events); ++i)
+ mono_image_get_event_info (
+ mono_array_get (tb->events, MonoReflectionEventBuilder*, i), assembly);
+ }
+ if (tb->properties && mono_array_length (tb->properties)) {
+ table = &assembly->tables [MONO_TABLE_PROPERTY];
+ table->rows += mono_array_length (tb->properties);
+ alloc_table (table, table->rows);
+ table = &assembly->tables [MONO_TABLE_PROPERTYMAP];
+ table->rows ++;
+ alloc_table (table, table->rows);
+ values = table->values + table->rows * MONO_PROPERTY_MAP_SIZE;
+ values [MONO_PROPERTY_MAP_PARENT] = tb->table_idx;
+ values [MONO_PROPERTY_MAP_PROPERTY_LIST] = assembly->tables [MONO_TABLE_PROPERTY].next_idx;
+ for (i = 0; i < mono_array_length (tb->properties); ++i)
+ mono_image_get_property_info (
+ mono_array_get (tb->properties, MonoReflectionPropertyBuilder*, i), assembly);
+ }
+ if (tb->subtypes) {
+ MonoDynamicTable *ntable;
+
+ table = &assembly->tables [MONO_TABLE_TYPEDEF];
+ table->rows += mono_array_length (tb->subtypes);
+ alloc_table (table, table->rows);
+
+ ntable = &assembly->tables [MONO_TABLE_NESTEDCLASS];
+ ntable->rows += mono_array_length (tb->subtypes);
+ alloc_table (ntable, ntable->rows);
+ values = ntable->values + ntable->next_idx * MONO_NESTED_CLASS_SIZE;
+
+ for (i = 0; i < mono_array_length (tb->subtypes); ++i) {
+ MonoReflectionTypeBuilder *subtype = mono_array_get (tb->subtypes, MonoReflectionTypeBuilder*, i);
+
+ mono_image_get_type_info (domain, subtype, assembly);
+ values [MONO_NESTED_CLASS_NESTED] = subtype->table_idx;
+ values [MONO_NESTED_CLASS_ENCLOSING] = tb->table_idx;
+ /*g_print ("nesting %s (%d) in %s (%d) (rows %d/%d)\n",
+ mono_string_to_utf8 (subtype->name), subtype->table_idx,
+ mono_string_to_utf8 (tb->name), tb->table_idx,
+ ntable->next_idx, ntable->rows);*/
+ values += MONO_NESTED_CLASS_SIZE;
+ ntable->next_idx++;
+ }
+ }
+ mono_image_add_cattrs (assembly, tb->table_idx, CUSTOM_ATTR_TYPEDEF, tb->cattrs);
+}
+
+static void
+mono_image_fill_module_table (MonoDomain *domain, MonoReflectionModuleBuilder *mb, MonoDynamicAssembly *assembly)
+{
+ MonoDynamicTable *table;
+ int i;
+ char *name;
+
+ table = &assembly->tables [MONO_TABLE_MODULE];
+ mb->table_idx = table->next_idx ++;
+ name = mono_string_to_utf8 (mb->module.name);
+ table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_NAME] = string_heap_insert (&assembly->sheap, name);
+ g_free (name);
+ i = mono_image_add_stream_data (&assembly->guid, mono_array_addr (mb->guid, char, 0), 16);
+ i /= 16;
+ ++i;
+ table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_MVID] = i;
+ table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_ENC] = 0;
+ table->values [mb->table_idx * MONO_MODULE_SIZE + MONO_MODULE_ENCBASE] = 0;
+
+ mono_image_add_cattrs (assembly, mb->table_idx, CUSTOM_ATTR_MODULE, mb->cattrs);
+ /*
+ * fill-in info in other tables as well.
+ */
+ table = &assembly->tables [MONO_TABLE_TYPEDEF];
+ table->rows += mono_array_length (mb->types);
+ alloc_table (table, table->rows);
+ /*
+ * We assign here the typedef indexes to avoid mismatches if a type that
+ * has not yet been stored in the tables is referenced by another type.
+ */
+ for (i = 0; i < mono_array_length (mb->types); ++i) {
+ int j;
+ MonoReflectionTypeBuilder *type = mono_array_get (mb->types, MonoReflectionTypeBuilder*, i);
+ type->table_idx = table->next_idx ++;
+ if (!type->subtypes)
+ continue;
+ for (j = 0; j < mono_array_length (type->subtypes); ++j) {
+ MonoReflectionTypeBuilder *subtype = mono_array_get (type->subtypes, MonoReflectionTypeBuilder*, j);
+ subtype->table_idx = table->next_idx ++;
+ }
+ }
+ for (i = 0; i < mono_array_length (mb->types); ++i)
+ mono_image_get_type_info (domain, mono_array_get (mb->types, MonoReflectionTypeBuilder*, i), assembly);
+}
+
+#define align_pointer(base,p)\
+ do {\
+ guint32 __diff = (unsigned char*)(p)-(unsigned char*)(base);\
+ if (__diff & 3)\
+ (p) += 4 - (__diff & 3);\
+ } while (0)
+
+/*
+ * build_compressed_metadata() fills in the blob of data that represents the
+ * raw metadata as it will be saved in the PE file. The five streams are output
+ * and the metadata tables are comnpressed from the guint32 array representation,
+ * to the compressed on-disk format.
+ */
+static void
+build_compressed_metadata (MonoDynamicAssembly *assembly)
+{
+ int i;
+ guint64 valid_mask = 0;
+ guint64 sorted_mask;
+ guint32 heapt_size = 0;
+ guint32 meta_size = 256; /* allow for header and other stuff */
+ guint32 table_offset;
+ guint32 ntables = 0;
+ guint64 *int64val;
+ guint32 *int32val;
+ guint16 *int16val;
+ MonoImage *meta;
+ unsigned char *p;
+ const char *version = "mono" VERSION;
+ struct StreamDesc {
+ const char *name;
+ MonoDynamicStream *stream;
+ } stream_desc [] = {
+ {"#~", &assembly->tstream},
+ {"#Strings", &assembly->sheap},
+ {"#US", &assembly->us},
+ {"#Blob", &assembly->blob},
+ {"#GUID", &assembly->guid},
+ };
+
+ /* tables that are sorted */
+ sorted_mask = ((guint64)1 << MONO_TABLE_CONSTANT) | ((guint64)1 << MONO_TABLE_FIELDMARSHAL)
+ | ((guint64)1 << MONO_TABLE_METHODSEMANTICS) | ((guint64)1 << MONO_TABLE_CLASSLAYOUT)
+ | ((guint64)1 << MONO_TABLE_FIELDLAYOUT) | ((guint64)1 << MONO_TABLE_FIELDRVA)
+ | ((guint64)1 << MONO_TABLE_IMPLMAP) | ((guint64)1 << MONO_TABLE_NESTEDCLASS)
+ | ((guint64)1 << MONO_TABLE_METHODIMPL) | ((guint64)1 << MONO_TABLE_CUSTOMATTRIBUTE)
+ | ((guint64)1 << MONO_TABLE_DECLSECURITY);
+
+ /* Compute table sizes */
+ /* the MonoImage has already been created in mono_image_basic_init() */
+ meta = assembly->assembly.image;
+
+ /* Setup the info used by compute_sizes () */
+ meta->idx_blob_wide = assembly->blob.index >= 65536 ? 1 : 0;
+ meta->idx_guid_wide = assembly->guid.index >= 65536 ? 1 : 0;
+ meta->idx_string_wide = assembly->sheap.index >= 65536 ? 1 : 0;
+
+ meta_size += assembly->blob.index;
+ meta_size += assembly->guid.index;
+ meta_size += assembly->sheap.index;
+ meta_size += assembly->us.index;
+
+ for (i=0; i < 64; ++i)
+ meta->tables [i].rows = assembly->tables [i].rows;
+
+ for (i = 0; i < 64; i++){
+ if (meta->tables [i].rows == 0)
+ continue;
+ valid_mask |= (guint64)1 << i;
+ ntables ++;
+ meta->tables [i].row_size = mono_metadata_compute_size (
+ meta, i, &meta->tables [i].size_bitfield);
+ heapt_size += meta->tables [i].row_size * meta->tables [i].rows;
+ }
+ heapt_size += 24; /* #~ header size */
+ heapt_size += ntables * 4;
+ meta_size += heapt_size;
+ meta->raw_metadata = g_malloc0 (meta_size);
+ p = meta->raw_metadata;
+ /* the metadata signature */
+ *p++ = 'B'; *p++ = 'S'; *p++ = 'J'; *p++ = 'B';
+ /* version numbers and 4 bytes reserved */
+ int16val = (guint16*)p;
+ *int16val++ = 1;
+ *int16val = 1;
+ p += 8;
+ /* version string */
+ int32val = (guint32*)p;
+ *int32val = strlen (version);
+ p += 4;
+ memcpy (p, version, *int32val);
+ p += *int32val;
+ align_pointer (meta->raw_metadata, p);
+ int16val = (guint16*)p;
+ *int16val++ = 0; /* flags must be 0 */
+ *int16val = 5; /* number of streams */
+ p += 4;
+
+ /*
+ * write the stream info.
+ */
+ table_offset = (p - (unsigned char*)meta->raw_metadata) + 5 * 8 + 40; /* room needed for stream headers */
+ table_offset += 3; table_offset &= ~3;
+
+ assembly->tstream.index = heapt_size;
+ for (i = 0; i < 5; ++i) {
+ int32val = (guint32*)p;
+ *int32val++ = stream_desc [i].stream->offset = table_offset;
+ *int32val = stream_desc [i].stream->index;
+ table_offset += *int32val;
+ table_offset += 3; table_offset &= ~3;
+ p += 8;
+ strcpy (p, stream_desc [i].name);
+ p += strlen (stream_desc [i].name) + 1;
+ align_pointer (meta->raw_metadata, p);
+ }
+ /*
+ * now copy the data, the table stream header and contents goes first.
+ */
+ g_assert ((p - (unsigned char*)meta->raw_metadata) < assembly->tstream.offset);
+ p = meta->raw_metadata + assembly->tstream.offset;
+ int32val = (guint32*)p;
+ *int32val = 0; /* reserved */
+ p += 4;
+ *p++ = 1; /* version */
+ *p++ = 0;
+ if (meta->idx_string_wide)
+ *p |= 0x01;
+ if (meta->idx_guid_wide)
+ *p |= 0x02;
+ if (meta->idx_blob_wide)
+ *p |= 0x04;
+ ++p;
+ *p++ = 0; /* reserved */
+ int64val = (guint64*)p;
+ *int64val++ = valid_mask;
+ *int64val++ = valid_mask & sorted_mask; /* bitvector of sorted tables */
+ p += 16;
+ int32val = (guint32*)p;
+ for (i = 0; i < 64; i++){
+ if (meta->tables [i].rows == 0)
+ continue;
+ *int32val++ = meta->tables [i].rows;
+ }
+ p = (unsigned char*)int32val;
+ /* compress the tables */
+ for (i = 0; i < 64; i++){
+ int row, col;
+ guint32 *values;
+ guint32 bitfield = meta->tables [i].size_bitfield;
+ if (!meta->tables [i].rows)
+ continue;
+ if (assembly->tables [i].columns != mono_metadata_table_count (bitfield))
+ g_error ("col count mismatch in %d: %d %d", i, assembly->tables [i].columns, mono_metadata_table_count (bitfield));
+ meta->tables [i].base = p;
+ for (row = 1; row <= meta->tables [i].rows; ++row) {
+ values = assembly->tables [i].values + row * assembly->tables [i].columns;
+ for (col = 0; col < assembly->tables [i].columns; ++col) {
+ switch (mono_metadata_table_size (bitfield, col)) {
+ case 1:
+ *p++ = values [col];
+ break;
+ case 2:
+ int16val = (guint16*)p;
+ *int16val = values [col];
+ p += 2;
+ break;
+ case 4:
+ int32val = (guint32*)p;
+ *int32val = values [col];
+ p += 4;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ }
+ }
+ g_assert ((p - (const unsigned char*)meta->tables [i].base) == (meta->tables [i].rows * meta->tables [i].row_size));
+ }
+
+ g_assert (assembly->guid.offset + assembly->guid.index < meta_size);
+ memcpy (meta->raw_metadata + assembly->sheap.offset, assembly->sheap.data, assembly->sheap.index);
+ memcpy (meta->raw_metadata + assembly->us.offset, assembly->us.data, assembly->us.index);
+ memcpy (meta->raw_metadata + assembly->blob.offset, assembly->blob.data, assembly->blob.index);
+ memcpy (meta->raw_metadata + assembly->guid.offset, assembly->guid.data, assembly->guid.index);
+
+ assembly->meta_size = assembly->guid.offset + assembly->guid.index;
+}
+
+/*
+ * Some tables in metadata need to be sorted according to some criteria, but
+ * when methods and fields are first created with reflection, they may be assigned a token
+ * that doesn't correspond to the final token they will get assigned after the sorting.
+ * ILGenerator.cs keeps a fixup table that maps the position of tokens in the IL code stream
+ * with the reflection objects that represent them. Once all the tables are set up, the
+ * reflection objects will contains the correct table index. fixup_method() will fixup the
+ * tokens for the method with ILGenerator @ilgen.
+ */
+static void
+fixup_method (MonoReflectionILGen *ilgen, gpointer value, MonoDynamicAssembly *assembly) {
+ guint32 code_idx = GPOINTER_TO_UINT (value);
+ MonoReflectionILTokenInfo *iltoken;
+ MonoReflectionFieldBuilder *field;
+ MonoReflectionCtorBuilder *ctor;
+ MonoReflectionMethodBuilder *method;
+ guint32 i, idx;
+ unsigned char *target;
+
+ for (i = 0; i < ilgen->num_token_fixups; ++i) {
+ iltoken = (MonoReflectionILTokenInfo *)mono_array_addr_with_size (ilgen->token_fixups, sizeof (MonoReflectionILTokenInfo), i);
+ target = assembly->code.data + code_idx + iltoken->code_pos;
+ switch (target [3]) {
+ case MONO_TABLE_FIELD:
+ if (strcmp (iltoken->member->vtable->klass->name, "FieldBuilder"))
+ g_assert_not_reached ();
+ field = (MonoReflectionFieldBuilder *)iltoken->member;
+ idx = field->table_idx;
+ break;
+ case MONO_TABLE_METHOD:
+ if (!strcmp (iltoken->member->vtable->klass->name, "MethodBuilder")) {
+ method = (MonoReflectionMethodBuilder *)iltoken->member;
+ idx = method->table_idx;
+ } else if (!strcmp (iltoken->member->vtable->klass->name, "ConstructorBuilder")) {
+ ctor = (MonoReflectionCtorBuilder *)iltoken->member;
+ idx = ctor->table_idx;
+ } else {
+ g_assert_not_reached ();
+ }
+ break;
+ default:
+ g_error ("got unexpected table 0x%02x in fixup", target [3]);
+ }
+ target [0] = idx & 0xff;
+ target [1] = (idx >> 8) & 0xff;
+ target [2] = (idx >> 16) & 0xff;
+ }
+}
+
+/*
+ * mono_image_build_metadata() will fill the info in all the needed metadata tables
+ * for the AssemblyBuilder @assemblyb: it iterates over the assembly modules
+ * and recursively outputs the info for a module. Each module will output all the info
+ * about it's types etc.
+ * At the end of the process, method and field tokens are fixed up and the on-disk
+ * compressed metadata representation is created.
+ */
+static void
+mono_image_build_metadata (MonoReflectionAssemblyBuilder *assemblyb)
+{
+ MonoDynamicTable *table;
+ MonoDynamicAssembly *assembly = assemblyb->dynamic_assembly;
+ MonoDomain *domain = ((MonoObject *)assemblyb)->vtable->domain;
+ guint32 len;
+ guint32 *values;
+ char *name;
+ int i;
+
+ assembly->text_rva = START_TEXT_RVA;
+
+ table = &assembly->tables [MONO_TABLE_ASSEMBLY];
+ alloc_table (table, 1);
+ values = table->values + MONO_ASSEMBLY_SIZE;
+ values [MONO_ASSEMBLY_HASH_ALG] = 0x8004;
+ name = mono_string_to_utf8 (assemblyb->name);
+ values [MONO_ASSEMBLY_NAME] = string_heap_insert (&assembly->sheap, name);
+ g_free (name);
+ values [MONO_ASSEMBLY_CULTURE] = string_heap_insert (&assembly->sheap, "");
+ values [MONO_ASSEMBLY_PUBLIC_KEY] = 0;
+ values [MONO_ASSEMBLY_MAJOR_VERSION] = 0;
+ values [MONO_ASSEMBLY_MINOR_VERSION] = 0;
+ values [MONO_ASSEMBLY_REV_NUMBER] = 0;
+ values [MONO_ASSEMBLY_BUILD_NUMBER] = 0;
+ values [MONO_ASSEMBLY_FLAGS] = 0;
+
+ mono_image_add_cattrs (assembly, 1, CUSTOM_ATTR_ASSEMBLY, assemblyb->cattrs);
+
+ assembly->tables [MONO_TABLE_TYPEDEF].rows = 1; /* .<Module> */
+ assembly->tables [MONO_TABLE_TYPEDEF].next_idx++;
+
+ if (assemblyb->modules) {
+ len = mono_array_length (assemblyb->modules);
+ table = &assembly->tables [MONO_TABLE_MODULE];
+ alloc_table (table, len);
+ for (i = 0; i < len; ++i)
+ mono_image_fill_module_table (domain, mono_array_get (assemblyb->modules, MonoReflectionModuleBuilder*, i), assembly);
+ } else {
+ table = &assembly->tables [MONO_TABLE_MODULE];
+ table->rows++;
+ alloc_table (table, table->rows);
+ table->values [table->next_idx * MONO_MODULE_SIZE + MONO_MODULE_NAME] = string_heap_insert (&assembly->sheap, "RefEmit_YouForgotToDefineAModule");
+ table->next_idx ++;
+ }
+
+ table = &assembly->tables [MONO_TABLE_TYPEDEF];
+ /*
+ * table->rows is already set above and in mono_image_fill_module_table.
+ */
+ alloc_table (table, table->rows);
+ /*
+ * Set the first entry.
+ */
+ values = table->values + table->columns;
+ values [MONO_TYPEDEF_FLAGS] = 0;
+ values [MONO_TYPEDEF_NAME] = string_heap_insert (&assembly->sheap, "<Module>") ;
+ values [MONO_TYPEDEF_NAMESPACE] = string_heap_insert (&assembly->sheap, "") ;
+ values [MONO_TYPEDEF_EXTENDS] = 0;
+ values [MONO_TYPEDEF_FIELD_LIST] = 1;
+ values [MONO_TYPEDEF_METHOD_LIST] = 1;
+
+ /* fixup tokens */
+ mono_g_hash_table_foreach (assembly->token_fixups, (GHFunc)fixup_method, assembly);
+
+ build_compressed_metadata (assembly);
+}
+
+/*
+ * mono_image_insert_string:
+ * @assembly: assembly builder object
+ * @str: a string
+ *
+ * Insert @str into the user string stream of @assembly.
+ */
+guint32
+mono_image_insert_string (MonoReflectionAssemblyBuilder *assembly, MonoString *str)
+{
+ guint32 idx;
+ char buf [16];
+ char *b = buf;
+
+ if (!assembly->dynamic_assembly)
+ mono_image_basic_init (assembly);
+ mono_metadata_encode_value (1 | (str->length * 2), b, &b);
+ idx = mono_image_add_stream_data (&assembly->dynamic_assembly->us, buf, b-buf);
+ /* FIXME: ENOENDIAN */
+ mono_image_add_stream_data (&assembly->dynamic_assembly->us, (const char*)mono_string_chars (str), str->length * 2);
+ mono_image_add_stream_data (&assembly->dynamic_assembly->us, "", 1);
+ return MONO_TOKEN_STRING | idx;
+}
+
+/*
+ * mono_image_create_token:
+ * @assembly: a dynamic assembly
+ * @obj:
+ *
+ * Get a token to insert in the IL code stream for the given MemberInfo.
+ * @obj can be one of:
+ * ConstructorBuilder
+ * MethodBuilder
+ * FieldBuilder
+ * MonoCMethod
+ * MonoMethod
+ * MonoField
+ * MonoType
+ * TypeBuilder
+ */
+guint32
+mono_image_create_token (MonoDynamicAssembly *assembly, MonoObject *obj)
+{
+ MonoClass *klass;
+ guint32 token;
+
+ if (!obj)
+ g_error ("System.Array methods not yet supported");
+
+ klass = obj->vtable->klass;
+ if (strcmp (klass->name, "MethodBuilder") == 0) {
+ MonoReflectionMethodBuilder *mb = (MonoReflectionMethodBuilder *)obj;
+ token = mb->table_idx | MONO_TOKEN_METHOD_DEF;
+ /*g_print ("got token 0x%08x for %s\n", token, mono_string_to_utf8 (mb->name));*/
+ return token;
+ }
+ if (strcmp (klass->name, "ConstructorBuilder") == 0) {
+ MonoReflectionCtorBuilder *mb = (MonoReflectionCtorBuilder *)obj;
+ token = mb->table_idx | MONO_TOKEN_METHOD_DEF;
+ /*g_print ("got token 0x%08x for %s\n", token, mono_string_to_utf8 (mb->name));*/
+ return token;
+ }
+ if (strcmp (klass->name, "FieldBuilder") == 0) {
+ MonoReflectionFieldBuilder *mb = (MonoReflectionFieldBuilder *)obj;
+ return mb->table_idx | MONO_TOKEN_FIELD_DEF;
+ }
+ if (strcmp (klass->name, "TypeBuilder") == 0) {
+ MonoReflectionTypeBuilder *tb = (MonoReflectionTypeBuilder *)obj;
+ return tb->table_idx | MONO_TOKEN_TYPE_DEF;
+ }
+ if (strcmp (klass->name, "MonoType") == 0) {
+ MonoReflectionType *tb = (MonoReflectionType *)obj;
+ return mono_metadata_token_from_dor (
+ mono_image_typedef_or_ref (assembly, tb->type));
+ }
+ if (strcmp (klass->name, "MonoCMethod") == 0 ||
+ strcmp (klass->name, "MonoMethod") == 0) {
+ MonoReflectionMethod *m = (MonoReflectionMethod *)obj;
+ token = mono_image_get_methodref_token (assembly, m->method);
+ /*g_print ("got token 0x%08x for %s\n", token, m->method->name);*/
+ return token;
+ }
+ if (strcmp (klass->name, "MonoField") == 0) {
+ MonoReflectionField *f = (MonoReflectionField *)obj;
+ token = mono_image_get_fieldref_token (assembly, f->field, f->klass);
+ /*g_print ("got token 0x%08x for %s\n", token, f->field->name);*/
+ return token;
+ }
+ g_print ("requested token for %s\n", klass->name);
+ return 0;
+}
+
+/*
+ * mono_image_basic_ini:
+ * @assembly: an assembly builder object
+ *
+ * Create the MonoImage that represents the assembly builder and setup some
+ * of the helper hash table and the basic metadata streams.
+ */
+void
+mono_image_basic_init (MonoReflectionAssemblyBuilder *assemblyb)
+{
+ MonoDynamicAssembly *assembly;
+ MonoImage *image;
+ int i;
+
+ if (assemblyb->dynamic_assembly)
+ return;
+
+#if HAVE_BOEHM_GC
+ assembly = assemblyb->dynamic_assembly = GC_malloc (sizeof (MonoDynamicAssembly));
+#else
+ assembly = assemblyb->dynamic_assembly = g_new0 (MonoDynamicAssembly, 1);
+#endif
+
+ assembly->token_fixups = mono_g_hash_table_new (g_direct_hash, g_direct_equal);
+ assembly->handleref = g_hash_table_new (g_direct_hash, g_direct_equal);
+ assembly->typeref = g_hash_table_new (mono_metadata_type_hash, mono_metadata_type_equal);
+
+ string_heap_init (&assembly->sheap);
+ mono_image_add_stream_data (&assembly->us, "", 1);
+ mono_image_add_stream_data (&assembly->blob, "", 1);
+
+ for (i=0; i < 64; ++i) {
+ assembly->tables [i].next_idx = 1;
+ assembly->tables [i].columns = table_sizes [i];
+ }
+
+ image = g_new0 (MonoImage, 1);
+
+ /* keep in sync with image.c */
+ image->name = mono_string_to_utf8 (assemblyb->name);
+ image->assembly_name = image->name; /* they may be different */
+
+ image->method_cache = g_hash_table_new (g_direct_hash, g_direct_equal);
+ image->class_cache = g_hash_table_new (g_direct_hash, g_direct_equal);
+ image->name_cache = g_hash_table_new (g_str_hash, g_str_equal);
+ image->array_cache = g_hash_table_new (g_direct_hash, g_direct_equal);
+
+ assembly->assembly.image = image;
+
+}
+
+/*
+ * mono_image_get_heade:
+ * @assemblyb: an assembly builder object
+ * @buffer:
+ * @maxsize
+ *
+ * When we need to save an assembly, we first call this function that ensures the metadata
+ * tables are built for all the modules in the assembly. This function creates the PE-COFF
+ * header, the image sections, the CLI header etc. The header is written in @buffer
+ * and the length of the data written is returned.
+ * If @buffer is not big enough (@maxsize), -1 is returned.
+ */
+int
+mono_image_get_header (MonoReflectionAssemblyBuilder *assemblyb, char *buffer, int maxsize)
+{
+ MonoMSDOSHeader *msdos;
+ MonoDotNetHeader *header;
+ MonoSectionTable *section;
+ MonoCLIHeader *cli_header;
+ guint32 header_size = TEXT_OFFSET + CLI_H_SIZE;
+ MonoDynamicAssembly *assembly;
+
+ static const unsigned char msheader[] = {
+ 0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
+ 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd, 0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68,
+ 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f,
+ 0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20,
+ 0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ if (maxsize < header_size)
+ return -1;
+
+ mono_image_basic_init (assemblyb);
+ assembly = assemblyb->dynamic_assembly;
+
+ mono_image_build_metadata (assemblyb);
+
+ memset (buffer, 0, header_size);
+ memcpy (buffer, msheader, sizeof (MonoMSDOSHeader));
+
+ msdos = (MonoMSDOSHeader *)buffer;
+ header = (MonoDotNetHeader *)(buffer + sizeof (MonoMSDOSHeader));
+ section = (MonoSectionTable*) (buffer + sizeof (MonoMSDOSHeader) + sizeof (MonoDotNetHeader));
+
+ /* FIXME: ENDIAN problem: byteswap as needed */
+ msdos->pe_offset = sizeof (MonoMSDOSHeader);
+
+ header->pesig [0] = 'P';
+ header->pesig [1] = 'E';
+ header->pesig [2] = header->pesig [3] = 0;
+
+ header->coff.coff_machine = 0x14c;
+ header->coff.coff_sections = 1; /* only .text supported now */
+ header->coff.coff_time = time (NULL);
+ header->coff.coff_opt_header_size = sizeof (MonoDotNetHeader) - sizeof (MonoCOFFHeader) - 4;
+ /* it's an exe */
+ header->coff.coff_attributes = 0x010e;
+ /* it's a dll */
+ //header->coff.coff_attributes = 0x210e;
+ header->pe.pe_magic = 0x10B;
+ header->pe.pe_major = 6;
+ header->pe.pe_minor = 0;
+ /* need to set: pe_code_size pe_data_size pe_rva_entry_point pe_rva_code_base pe_rva_data_base */
+
+ header->nt.pe_image_base = 0x400000;
+ header->nt.pe_section_align = 8192;
+ header->nt.pe_file_alignment = FILE_ALIGN;
+ header->nt.pe_os_major = 4;
+ header->nt.pe_os_minor = 0;
+ header->nt.pe_subsys_major = 4;
+ /* need to set pe_image_size, pe_header_size */
+ header->nt.pe_header_size = 0x200;
+ header->nt.pe_image_size = 0x00008000;
+ header->nt.pe_subsys_required = 3; /* 3 -> cmdline app, 2 -> GUI app */
+ header->nt.pe_stack_reserve = 0x00100000;
+ header->nt.pe_stack_commit = 0x00001000;
+ header->nt.pe_heap_reserve = 0x00100000;
+ header->nt.pe_heap_commit = 0x00001000;
+ header->nt.pe_loader_flags = 0;
+ header->nt.pe_data_dir_count = 16;
+
+#if 0
+ /* set: */
+ header->datadir.pe_import_table
+ pe_resource_table
+ pe_reloc_table
+ pe_iat
+#endif
+ header->datadir.pe_cli_header.size = 72;
+ header->datadir.pe_cli_header.rva = assembly->text_rva; /* we put it always at the beginning */
+
+ /* Write section tables */
+ strcpy (section->st_name, ".text");
+ section->st_virtual_address = START_TEXT_RVA;
+ section->st_virtual_size = assembly->meta_size + assembly->code.index;
+ section->st_raw_data_size = section->st_virtual_size + (FILE_ALIGN - 1);
+ section->st_raw_data_size &= ~(FILE_ALIGN - 1);
+ section->st_raw_data_ptr = TEXT_OFFSET;
+ section->st_flags = SECT_FLAGS_HAS_CODE | SECT_FLAGS_MEM_EXECUTE | SECT_FLAGS_MEM_READ;
+
+ /*
+ * align: build_compressed_metadata () assumes metadata is aligned
+ * see below:
+ * cli_header->ch_metadata.rva = assembly->text_rva + assembly->code.index + CLI_H_SIZE;
+ */
+ assembly->code.index += 3;
+ assembly->code.index &= ~3;
+
+ /*
+ * Write the MonoCLIHeader header
+ */
+ cli_header = (MonoCLIHeader*)(buffer + TEXT_OFFSET);
+ cli_header->ch_size = 72;
+ cli_header->ch_runtime_major = 2;
+ cli_header->ch_flags = CLI_FLAGS_ILONLY;
+ if (assemblyb->entry_point)
+ cli_header->ch_entry_point = assemblyb->entry_point->table_idx | MONO_TOKEN_METHOD_DEF;
+ else
+ cli_header->ch_entry_point = 0;
+ cli_header->ch_metadata.rva = assembly->text_rva + assembly->code.index + CLI_H_SIZE;
+ cli_header->ch_metadata.size = assembly->meta_size;
+
+ return header_size;
+}
+
+/*
+ * We need to return always the same object for MethodInfo, FieldInfo etc..
+ * type uses a different hash, since it uses custom hash/equal functions.
+ */
+static MonoGHashTable *object_cache = NULL;
+static MonoGHashTable *type_cache = NULL;
+
+#define CHECK_OBJECT(t,p) \
+ do { \
+ t _obj; \
+ if (!object_cache) \
+ object_cache = mono_g_hash_table_new (g_direct_hash, g_direct_equal); \
+ if ((_obj = mono_g_hash_table_lookup (object_cache, (p)))) \
+ return _obj; \
+ } while (0)
+
+#define CACHE_OBJECT(p,o) \
+ do { \
+ mono_g_hash_table_insert (object_cache, p,o); \
+ } while (0)
+
+/*
+ * mono_assembly_get_object:
+ * @domain: an app domain
+ * @assembly: an assembly
+ *
+ * Return an System.Reflection.Assembly object representing the MonoAssembly @assembly.
+ */
+MonoReflectionAssembly*
+mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly)
+{
+ static MonoClass *System_Reflection_Assembly;
+ MonoReflectionAssembly *res;
+
+ CHECK_OBJECT (MonoReflectionAssembly *, assembly);
+ if (!System_Reflection_Assembly)
+ System_Reflection_Assembly = mono_class_from_name (
+ mono_defaults.corlib, "System.Reflection", "Assembly");
+ res = (MonoReflectionAssembly *)mono_object_new (domain, System_Reflection_Assembly);
+ res->assembly = assembly;
+ CACHE_OBJECT (assembly, res);
+ return res;
+}
+
+static gboolean
+mymono_metadata_type_equal (MonoType *t1, MonoType *t2)
+{
+ if ((t1->type != t2->type) ||
+ (t1->byref != t2->byref))
+ return FALSE;
+
+ switch (t1->type) {
+ case MONO_TYPE_VOID:
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_OBJECT:
+ return TRUE;
+ case MONO_TYPE_VALUETYPE:
+ case MONO_TYPE_CLASS:
+ return t1->data.klass == t2->data.klass;
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ return mymono_metadata_type_equal (t1->data.type, t2->data.type);
+ case MONO_TYPE_ARRAY:
+ if (t1->data.array->rank != t2->data.array->rank)
+ return FALSE;
+ return mymono_metadata_type_equal (t1->data.array->type, t2->data.array->type);
+ default:
+ g_error ("implement type compare for %0x!", t1->type);
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
+static guint
+mymono_metadata_type_hash (MonoType *t1)
+{
+ guint hash;
+
+ hash = t1->type;
+
+ hash |= t1->byref << 6; /* do not collide with t1->type values */
+ switch (t1->type) {
+ case MONO_TYPE_VALUETYPE:
+ case MONO_TYPE_CLASS:
+ /* check if the distribution is good enough */
+ return hash << 7 | g_str_hash (t1->data.klass->name);
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_SZARRAY:
+ return hash << 7 | mymono_metadata_type_hash (t1->data.type);
+ }
+ return hash;
+}
+
+/*
+ * mono_type_get_object:
+ * @domain: an app domain
+ * @type: a type
+ *
+ * Return an System.MonoType object representing the type @type.
+ */
+MonoReflectionType*
+mono_type_get_object (MonoDomain *domain, MonoType *type)
+{
+ MonoReflectionType *res;
+ MonoClass *klass = mono_class_from_mono_type (type);
+
+ if (!type_cache)
+ type_cache = mono_g_hash_table_new ((GHashFunc)mymono_metadata_type_hash,
+ (GCompareFunc)mymono_metadata_type_equal);
+ if ((res = mono_g_hash_table_lookup (type_cache, type)))
+ return res;
+ if (klass->reflection_info) {
+ /* should this be considered an error condition? */
+ if (!type->byref)
+ return klass->reflection_info;
+ }
+ mono_class_init (klass);
+ res = (MonoReflectionType *)mono_object_new (domain, mono_defaults.monotype_class);
+ res->type = type;
+ mono_g_hash_table_insert (type_cache, type, res);
+ return res;
+}
+
+/*
+ * mono_method_get_object:
+ * @domain: an app domain
+ * @method: a method
+ *
+ * Return an System.Reflection.MonoMethod object representing the method @method.
+ */
+MonoReflectionMethod*
+mono_method_get_object (MonoDomain *domain, MonoMethod *method)
+{
+ /*
+ * We use the same C representation for methods and constructors, but the type
+ * name in C# is different.
+ */
+ const char *cname;
+ MonoClass *klass;
+ MonoReflectionMethod *ret;
+
+ CHECK_OBJECT (MonoReflectionMethod *, method);
+ if (*method->name == '.' && (strcmp (method->name, ".ctor") == 0 || strcmp (method->name, ".cctor") == 0))
+ cname = "MonoCMethod";
+ else
+ cname = "MonoMethod";
+ klass = mono_class_from_name (mono_defaults.corlib, "System.Reflection", cname);
+
+ ret = (MonoReflectionMethod*)mono_object_new (domain, klass);
+ ret->method = method;
+ ret->name = mono_string_new (domain, method->name);
+ CACHE_OBJECT (method, ret);
+ return ret;
+}
+
+/*
+ * mono_field_get_object:
+ * @domain: an app domain
+ * @klass: a type
+ * @field: a field
+ *
+ * Return an System.Reflection.MonoField object representing the field @field
+ * in class @klass.
+ */
+MonoReflectionField*
+mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field)
+{
+ MonoReflectionField *res;
+ MonoClass *oklass;
+
+ CHECK_OBJECT (MonoReflectionField *, field);
+ oklass = mono_class_from_name (mono_defaults.corlib, "System.Reflection", "MonoField");
+ res = (MonoReflectionField *)mono_object_new (domain, oklass);
+ res->klass = klass;
+ res->field = field;
+ CACHE_OBJECT (field, res);
+ return res;
+}
+
+/*
+ * mono_property_get_object:
+ * @domain: an app domain
+ * @klass: a type
+ * @property: a property
+ *
+ * Return an System.Reflection.MonoProperty object representing the property @property
+ * in class @klass.
+ */
+MonoReflectionProperty*
+mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property)
+{
+ MonoReflectionProperty *res;
+ MonoClass *oklass;
+
+ CHECK_OBJECT (MonoReflectionProperty *, property);
+ oklass = mono_class_from_name (mono_defaults.corlib, "System.Reflection", "MonoProperty");
+ res = (MonoReflectionProperty *)mono_object_new (domain, oklass);
+ res->klass = klass;
+ res->property = property;
+ CACHE_OBJECT (property, res);
+ return res;
+}
+
+/*
+ * mono_event_get_object:
+ * @domain: an app domain
+ * @klass: a type
+ * @event: a event
+ *
+ * Return an System.Reflection.MonoEvent object representing the event @event
+ * in class @klass.
+ */
+MonoReflectionEvent*
+mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event)
+{
+ MonoReflectionEvent *res;
+ MonoClass *oklass;
+
+ CHECK_OBJECT (MonoReflectionEvent *, event);
+ oklass = mono_class_from_name (mono_defaults.corlib, "System.Reflection", "MonoEvent");
+ res = (MonoReflectionEvent *)mono_object_new (domain, oklass);
+ res->klass = klass;
+ res->event = event;
+ CACHE_OBJECT (event, res);
+ return res;
+}
+
+/*
+ * mono_param_get_objects:
+ * @domain: an app domain
+ * @method: a method
+ *
+ * Return an System.Reflection.ParameterInfo array object representing the parameters
+ * in the method @method.
+ */
+MonoReflectionParameter**
+mono_param_get_objects (MonoDomain *domain, MonoMethod *method)
+{
+ MonoReflectionParameter **res;
+ MonoReflectionMethod *member;
+ MonoClass *oklass;
+ char **names;
+ int i;
+
+ if (!method->signature->param_count)
+ return NULL;
+
+ member = mono_method_get_object (domain, method);
+ names = g_new (char *, method->signature->param_count);
+ mono_method_get_param_names (method, (const char **) names);
+
+ /* Note: the cache is based on the address of the signature into the method
+ * since we already cache MethodInfos with the method as keys.
+ */
+ CHECK_OBJECT (MonoReflectionParameter**, &(method->signature));
+ oklass = mono_class_from_name (mono_defaults.corlib, "System.Reflection", "ParameterInfo");
+#if HAVE_BOEHM_GC
+ res = GC_malloc (sizeof (MonoReflectionParameter*) * method->signature->param_count);
+#else
+ res = g_new0 (MonoReflectionParameter*, method->signature->param_count);
+#endif
+ for (i = 0; i < method->signature->param_count; ++i) {
+ res [i] = (MonoReflectionParameter *)mono_object_new (domain, oklass);
+ res [i]->ClassImpl = mono_type_get_object (domain, method->signature->params [i]);
+ res [i]->DefaultValueImpl = NULL; /* FIXME */
+ res [i]->MemberImpl = (MonoObject*)member;
+ res [i]->NameImpl = mono_string_new (domain, names [i]);
+ res [i]->PositionImpl = i + 1;
+ res [i]->AttrsImpl = method->signature->params [i]->attrs;
+ }
+ g_free (names);
+ CACHE_OBJECT (&(method->signature), res);
+ return res;
+}
+
+/*
+ * mono_reflection_parse_type:
+ * @name: type name
+ *
+ * Parse a type name as accepted by the GetType () method and output the info
+ * extracted in the info structure.
+ * the name param will be mangled, so, make a copy before passing it to this function.
+ * The fields in info will be valid until the memory pointed to by name is valid.
+ * Returns 0 on parse error.
+ * See also mono_type_get_name () below.
+ */
+int
+mono_reflection_parse_type (char *name, MonoTypeNameParse *info) {
+
+ char *start, *p, *w, *last_point;
+ int in_modifiers = 0;
+ int isbyref = 0, rank;
+
+ start = p = w = name;
+
+ info->name = info->name_space = info->assembly = NULL;
+ info->nest_name = info->nest_name_space = NULL;
+ info->modifiers = NULL;
+
+ last_point = NULL;
+
+ while (*p) {
+ switch (*p) {
+ case '+':
+ /* we have parsed the nesting namespace + name */
+ if (last_point) {
+ info->nest_name_space = start;
+ *last_point = 0;
+ info->nest_name = last_point + 1;
+ } else {
+ info->nest_name_space = (char *)"";
+ info->nest_name = start;
+ }
+ *p = 0; /* NULL terminate */
+ last_point = NULL;
+ start = p + 1;
+ break;
+ case '.':
+ last_point = w;
+ break;
+ case '\\':
+ ++p;
+ break;
+ case '&':
+ case '*':
+ case '[':
+ case ',':
+ in_modifiers = 1;
+ break;
+ default:
+ break;
+ }
+ if (in_modifiers)
+ break;
+ *w++ = *p++;
+ }
+
+ if (last_point) {
+ info->name_space = start;
+ *last_point = 0;
+ info->name = last_point + 1;
+ } else {
+ info->name_space = (char *)"";
+ info->name = start;
+ }
+ while (*p) {
+ switch (*p) {
+ case '&':
+ if (isbyref) /* only one level allowed by the spec */
+ return 0;
+ isbyref = 1;
+ info->modifiers = g_list_append (info->modifiers, GUINT_TO_POINTER (0));
+ *p++ = 0;
+ break;
+ case '*':
+ info->modifiers = g_list_append (info->modifiers, GUINT_TO_POINTER (-1));
+ *p++ = 0;
+ break;
+ case '[':
+ rank = 1;
+ *p++ = 0;
+ while (*p) {
+ if (*p == ']')
+ break;
+ if (*p == ',')
+ rank++;
+ else if (*p != '*') /* '*' means unknown lower bound */
+ return 0;
+ ++p;
+ }
+ if (*p++ != ']')
+ return 0;
+ info->modifiers = g_list_append (info->modifiers, GUINT_TO_POINTER (rank));
+ break;
+ case ',':
+ *p++ = 0;
+ while (*p) {
+ if (*p == ' ') {
+ ++p;
+ continue;
+ }
+ break;
+ }
+ if (!*p)
+ return 0; /* missing assembly name */
+ info->assembly = p;
+ break;
+ default:
+ break;
+ }
+ }
+ *w = 0; /* terminate class name */
+ if (!info->name || !*info->name)
+ return 0;
+ if (info->nest_name && !*info->nest_name)
+ return 0;
+ /* add other consistency checks */
+ return 1;
+}
+
+static void
+mono_type_get_name_recurse (MonoType *type, GString *str)
+{
+ MonoClass *klass;
+
+ switch (type->type) {
+ case MONO_TYPE_ARRAY: {
+ int i, rank = type->data.array->rank;
+
+ mono_type_get_name_recurse (type->data.array->type, str);
+ g_string_append_c (str, '[');
+ for (i = 1; i < rank; i++)
+ g_string_append_c (str, ',');
+ g_string_append_c (str, ']');
+ break;
+ }
+ case MONO_TYPE_SZARRAY:
+ mono_type_get_name_recurse (type->data.type, str);
+ g_string_append (str, "[]");
+ break;
+ case MONO_TYPE_PTR:
+ mono_type_get_name_recurse (type->data.type, str);
+ g_string_append_c (str, '*');
+ break;
+ default:
+ klass = mono_class_from_mono_type (type);
+ if (klass->nested_in) {
+ mono_type_get_name_recurse (&klass->nested_in->byval_arg, str);
+ g_string_append_c (str, '+');
+ }
+ if (*klass->name_space) {
+ g_string_append (str, klass->name_space);
+ g_string_append_c (str, '.');
+ }
+ g_string_append (str, klass->name);
+ break;
+ }
+}
+
+/*
+ * mono_type_get_name:
+ * @type: a type
+ *
+ * Returns the string representation for type as required by System.Reflection.
+ * The inverse of mono_reflection_parse_type ().
+ */
+char*
+mono_type_get_name (MonoType *type)
+{
+ GString* result = g_string_new ("");
+ mono_type_get_name_recurse (type, result);
+
+ if (type->byref)
+ g_string_append_c (result, '&');
+
+ return g_string_free (result, FALSE);
+}
+
+/*
+ * mono_reflection_get_type:
+ * @image: a metadata context
+ * @info: type description structure
+ * @ignorecase: flag for case-insensitive string compares
+ *
+ * Build a MonoType from the type description in @info.
+ *
+ */
+MonoType*
+mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase)
+{
+ MonoClass *klass;
+ GList *mod;
+ int modval;
+
+ if (ignorecase) {
+ g_warning ("Ignore case not yet supported in GetType()");
+ return NULL;
+ }
+
+ if (!image)
+ image = mono_defaults.corlib;
+
+ if (info->nest_name) {
+ klass = mono_class_from_name (image, info->nest_name_space, info->nest_name);
+ if (klass) {
+ GList *nested;
+ mono_class_init (klass);
+ nested = klass->nested_classes;
+ klass = NULL;
+ while (nested) {
+ klass = nested->data;
+ if (strcmp (klass->name, info->nest_name) == 0 &&
+ strcmp (klass->name_space, info->nest_name_space) == 0)
+ break;
+ klass = NULL;
+ nested = nested->next;
+ }
+ }
+ } else {
+ klass = mono_class_from_name (image, info->name_space, info->name);
+ }
+ if (!klass)
+ return NULL;
+ mono_class_init (klass);
+ for (mod = info->modifiers; mod; mod = mod->next) {
+ modval = GPOINTER_TO_UINT (mod->data);
+ if (!modval) { /* byref: must be last modifier */
+ return &klass->this_arg;
+ } else if (modval == -1) {
+ klass = mono_ptr_class_get (&klass->byval_arg);
+ } else { /* array rank */
+ klass = mono_array_class_get (&klass->byval_arg, modval);
+ }
+ mono_class_init (klass);
+ }
+ return &klass->byval_arg;
+}
+
+/*
+ * Optimization we could avoid mallocing() an little-endian archs that
+ * don't crash with unaligned accesses.
+ */
+static void
+fill_param_data (MonoImage *image, MonoMethodSignature *sig, guint32 blobidx, void **params) {
+ int len, i, slen, type;
+ const char *p = mono_metadata_blob_heap (image, blobidx);
+
+ len = mono_metadata_decode_value (p, &p);
+ if (len < 2 || read16 (p) != 0x0001) /* Prolog */
+ return;
+
+ /* skip prolog */
+ p += 2;
+ for (i = 0; i < sig->param_count; ++i) {
+ type = sig->params [i]->type;
+handle_enum:
+ switch (type) {
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_BOOLEAN: {
+ MonoBoolean *bval = params [i] = g_malloc (sizeof (MonoBoolean));
+ *bval = *p;
+ ++p;
+ break;
+ }
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2: {
+ guint16 *val = params [i] = g_malloc (sizeof (guint16));
+ *val = read16 (p);
+ p += 2;
+ break;
+ }
+#if SIZEOF_VOID_P == 4
+ case MONO_TYPE_U:
+ case MONO_TYPE_I:
+#endif
+ case MONO_TYPE_R4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4: {
+ guint32 *val = params [i] = g_malloc (sizeof (guint32));
+ *val = read32 (p);
+ p += 4;
+ break;
+ }
+#if SIZEOF_VOID_P == 8
+ case MONO_TYPE_U: /* error out instead? this should probably not happen */
+ case MONO_TYPE_I:
+#endif
+ case MONO_TYPE_R8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8: {
+ guint64 *val = params [i] = g_malloc (sizeof (guint64));
+ *val = read64 (p);
+ p += 8;
+ break;
+ }
+ case MONO_TYPE_VALUETYPE:
+ if (sig->params [i]->data.klass->enumtype) {
+ type = sig->params [i]->data.klass->enum_basetype->type;
+ goto handle_enum;
+ } else {
+ g_warning ("generic valutype %s not handled in custom attr value decoding", sig->params [i]->data.klass->name);
+ }
+ break;
+ case MONO_TYPE_STRING: {
+ slen = mono_metadata_decode_value (p, &p);
+ params [i] = mono_string_new_len (mono_domain_get (), p, slen);
+ p += slen;
+ break;
+ }
+ default:
+ g_warning ("Type %02x not handled in custom attr value decoding", sig->params [i]->type);
+ break;
+ }
+ }
+}
+
+static void
+free_param_data (MonoMethodSignature *sig, void **params) {
+ int i;
+ for (i = 0; i < sig->param_count; ++i) {
+ switch (sig->params [i]->type) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_U:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_R8:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_VALUETYPE:
+ g_free (params [i]);
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+/*
+ * Find the method index in the metadata methodDef table.
+ * Later put these three helper methods in metadata and export them.
+ */
+static guint32
+find_method_index (MonoMethod *method) {
+ MonoClass *klass = method->klass;
+ int i;
+
+ for (i = 0; i < klass->method.count; ++i) {
+ if (method == klass->methods [i])
+ return klass->method.first + 1 + i;
+ }
+ return 0;
+}
+
+/*
+ * Find the field index in the metadata FieldDef table.
+ */
+static guint32
+find_field_index (MonoClass *klass, MonoClassField *field) {
+ int i;
+
+ for (i = 0; i < klass->field.count; ++i) {
+ if (field == &klass->fields [i])
+ return klass->field.first + 1 + i;
+ }
+ return 0;
+}
+
+/*
+ * Find the property index in the metadata Property table.
+ */
+static guint32
+find_property_index (MonoClass *klass, MonoProperty *property) {
+ int i;
+
+ for (i = 0; i < klass->property.count; ++i) {
+ if (property == &klass->properties [i])
+ return klass->property.first + 1 + i;
+ }
+ return 0;
+}
+
+/*
+ * Find the event index in the metadata Event table.
+ */
+static guint32
+find_event_index (MonoClass *klass, MonoEvent *event) {
+ int i;
+
+ for (i = 0; i < klass->event.count; ++i) {
+ if (event == &klass->events [i])
+ return klass->event.first + 1 + i;
+ }
+ return 0;
+}
+
+/*
+ * mono_reflection_get_custom_attrs:
+ * @obj: a reflection object handle
+ *
+ * Return an array with all the custom attributes defined of the
+ * reflection handle @obj. The objects are fully build.
+ */
+MonoArray*
+mono_reflection_get_custom_attrs (MonoObject *obj)
+{
+ guint32 idx, mtoken, i, len;
+ guint32 cols [MONO_CUSTOM_ATTR_SIZE];
+ MonoClass *klass;
+ MonoImage *image;
+ MonoTableInfo *ca;
+ MonoMethod *method;
+ MonoObject *attr;
+ MonoArray *result;
+ GList *list = NULL;
+ void **params;
+
+ klass = obj->vtable->klass;
+ /* FIXME: need to handle: Module */
+ if (klass == mono_defaults.monotype_class) {
+ MonoReflectionType *rtype = (MonoReflectionType*)obj;
+ klass = mono_class_from_mono_type (rtype->type);
+ idx = mono_metadata_token_index (klass->type_token);
+ idx <<= CUSTOM_ATTR_BITS;
+ idx |= CUSTOM_ATTR_TYPEDEF;
+ image = klass->image;
+ } else if (strcmp ("Assembly", klass->name) == 0) {
+ MonoReflectionAssembly *rassembly = (MonoReflectionAssembly*)obj;
+ idx = 1; /* there is only one assembly */
+ idx <<= CUSTOM_ATTR_BITS;
+ idx |= CUSTOM_ATTR_ASSEMBLY;
+ image = rassembly->assembly->image;
+ } else if (strcmp ("MonoProperty", klass->name) == 0) {
+ MonoReflectionProperty *rprop = (MonoReflectionProperty*)obj;
+ idx = find_property_index (rprop->klass, rprop->property);
+ idx <<= CUSTOM_ATTR_BITS;
+ idx |= CUSTOM_ATTR_PROPERTY;
+ image = rprop->klass->image;
+ } else if (strcmp ("MonoEvent", klass->name) == 0) {
+ MonoReflectionEvent *revent = (MonoReflectionEvent*)obj;
+ idx = find_event_index (revent->klass, revent->event);
+ idx <<= CUSTOM_ATTR_BITS;
+ idx |= CUSTOM_ATTR_EVENT;
+ image = revent->klass->image;
+ } else if (strcmp ("MonoField", klass->name) == 0) {
+ MonoReflectionField *rfield = (MonoReflectionField*)obj;
+ idx = find_field_index (rfield->klass, rfield->field);
+ idx <<= CUSTOM_ATTR_BITS;
+ idx |= CUSTOM_ATTR_FIELDDEF;
+ image = rfield->klass->image;
+ } else if ((strcmp ("MonoMethod", klass->name) == 0) || (strcmp ("MonoCMethod", klass->name) == 0)) {
+ MonoReflectionMethod *rmethod = (MonoReflectionMethod*)obj;
+ idx = find_method_index (rmethod->method);
+ idx <<= CUSTOM_ATTR_BITS;
+ idx |= CUSTOM_ATTR_METHODDEF;
+ image = rmethod->method->klass->image;
+ } else if (strcmp ("ParameterInfo", klass->name) == 0) {
+ MonoReflectionParameter *param = (MonoReflectionParameter*)obj;
+ MonoReflectionMethod *rmethod = (MonoReflectionMethod*)param->MemberImpl;
+ guint32 method_index = find_method_index (rmethod->method);
+ guint32 param_list, param_last, param_pos, found;
+
+ image = rmethod->method->klass->image;
+ ca = &image->tables [MONO_TABLE_METHOD];
+
+ param_list = mono_metadata_decode_row_col (ca, method_index - 1, MONO_METHOD_PARAMLIST);
+ if (method_index == ca->rows) {
+ ca = &image->tables [MONO_TABLE_PARAM];
+ param_last = ca->rows + 1;
+ } else {
+ param_last = mono_metadata_decode_row_col (ca, method_index, MONO_METHOD_PARAMLIST);
+ ca = &image->tables [MONO_TABLE_PARAM];
+ }
+ found = 0;
+ for (i = param_list; i < param_last; ++i) {
+ param_pos = mono_metadata_decode_row_col (ca, i - 1, MONO_PARAM_SEQUENCE);
+ if (param_pos == param->PositionImpl) {
+ found = 1;
+ break;
+ }
+ }
+ if (!found)
+ return mono_array_new (mono_domain_get (), mono_defaults.object_class, 0);
+ idx = i;
+ idx <<= CUSTOM_ATTR_BITS;
+ idx |= CUSTOM_ATTR_PARAMDEF;
+ } else { /* handle other types here... */
+ g_error ("get custom attrs not yet supported for %s", klass->name);
+ }
+
+ /* at this point image and index are set correctly for searching the custom attr */
+ ca = &image->tables [MONO_TABLE_CUSTOMATTRIBUTE];
+ /* the table is not sorted */
+ for (i = 0; i < ca->rows; ++i) {
+ mono_metadata_decode_row (ca, i, cols, MONO_CUSTOM_ATTR_SIZE);
+ if (cols [MONO_CUSTOM_ATTR_PARENT] != idx)
+ continue;
+ mtoken = cols [MONO_CUSTOM_ATTR_TYPE] >> CUSTOM_ATTR_TYPE_BITS;
+ switch (cols [MONO_CUSTOM_ATTR_TYPE] & CUSTOM_ATTR_TYPE_MASK) {
+ case CUSTOM_ATTR_TYPE_METHODDEF:
+ mtoken |= MONO_TOKEN_METHOD_DEF;
+ break;
+ case CUSTOM_ATTR_TYPE_MEMBERREF:
+ mtoken |= MONO_TOKEN_MEMBER_REF;
+ break;
+ default:
+ g_error ("Unknown table for custom attr type %08x", cols [MONO_CUSTOM_ATTR_TYPE]);
+ break;
+ }
+ method = mono_get_method (image, mtoken, NULL);
+ if (!method)
+ g_error ("Can't find custom attr constructor");
+ mono_class_init (method->klass);
+ /*g_print ("got attr %s\n", method->klass->name);*/
+ params = g_new (void*, method->signature->param_count);
+ fill_param_data (image, method->signature, cols [MONO_CUSTOM_ATTR_VALUE], params);
+ attr = mono_object_new (mono_domain_get (), method->klass);
+ mono_runtime_invoke (method, attr, params);
+ list = g_list_prepend (list, attr);
+ free_param_data (method->signature, params);
+ g_free (params);
+ }
+
+ len = g_list_length (list);
+ /*
+ * The return type is really object[], but System/Attribute.cs does a cast
+ * to (Attribute []) and that is not allowed: I'm lazy for now, but we should
+ * probably fix that.
+ */
+ klass = mono_class_from_name (mono_defaults.corlib, "System", "Attribute");
+ result = mono_array_new (mono_domain_get (), klass, len);
+ for (i = 0; i < len; ++i) {
+ mono_array_set (result, gpointer, i, list->data);
+ list = list->next;
+ }
+ g_list_free (g_list_first (list));
+
+ return result;
+}
+
+/*
+ * mono_reflection_get_custom_attrs_blob:
+ * @ctor: custom attribute constructor
+ * @ctorArgs: arguments o the constructor
+ * @properties:
+ * @propValues:
+ * @fields:
+ * @fieldValues:
+ *
+ * Creates the blob of data that needs to be saved in the metadata and that represents
+ * the custom attributed described by @ctor, @ctorArgs etc.
+ * Returns: a Byte array representing the blob of data.
+ */
+MonoArray*
+mono_reflection_get_custom_attrs_blob (MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues) {
+ MonoArray *result;
+ MonoMethodSignature *sig;
+ MonoObject *arg;
+ char *buffer, *p, *argval;
+ guint32 buflen, i, type;
+
+ if (strcmp (ctor->vtable->klass->name, "MonoCMethod")) {
+ g_warning ("ConstructorBuilder Custom attribute not yet supported");
+ /*
+ * maybe we should have a param array to method signature function and
+ * continue with the normal codepath.
+ */
+ result = mono_array_new (mono_domain_get (), mono_defaults.byte_class, 4);
+ mono_array_set (result, char, 0, 1);
+ return result;
+ }
+ buflen = 256;
+ p = buffer = g_malloc (buflen);
+ /* write the prolog */
+ *p++ = 1;
+ *p++ = 0;
+ sig = ((MonoReflectionMethod*)ctor)->method->signature;
+ /* FIXME: ENOENDIAN */
+ for (i = 0; i < sig->param_count; ++i) {
+ if ((p-buffer) + 10 >= buflen) {
+ char *newbuf;
+ buflen *= 2;
+ newbuf = g_realloc (buffer, buflen);
+ p = newbuf + (p-buffer);
+ buffer = newbuf;
+ }
+ arg = (MonoObject*)mono_array_get (ctorArgs, gpointer, i);
+ argval = ((char*)arg + sizeof (MonoObject));
+ type = sig->params [i]->type;
+handle_enum:
+ switch (type) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I1:
+ *p++ = *argval;
+ break;
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I2: {
+ guint16 *val = (guint16*)p;
+ *val = *(guint16*)argval;
+ p += 2;
+ break;
+ }
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_R4: {
+ guint32 *val = (guint32*)p;
+ *val = *(guint32*)argval;
+ p += 4;
+ break;
+ }
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_R8: {
+ guint64 *val = (guint64*)p;
+ *val = *(guint64*)argval;
+ p += 8;
+ break;
+ }
+ case MONO_TYPE_VALUETYPE:
+ if (sig->params [i]->data.klass->enumtype) {
+ type = sig->params [i]->data.klass->enum_basetype->type;
+ goto handle_enum;
+ } else {
+ g_warning ("generic valutype %s not handled in custom attr value decoding", sig->params [i]->data.klass->name);
+ }
+ break;
+ case MONO_TYPE_STRING: {
+ char *str = mono_string_to_utf8 ((MonoString*)arg);
+ guint32 slen = strlen (str);
+ if ((p-buffer) + 10 + slen >= buflen) {
+ char *newbuf;
+ buflen *= 2;
+ buflen += slen;
+ newbuf = g_realloc (buffer, buflen);
+ p = newbuf + (p-buffer);
+ buffer = newbuf;
+ }
+ mono_metadata_encode_value (slen, p, &p);
+ memcpy (p, str, slen);
+ p += slen;
+ g_free (str);
+ break;
+ }
+ default:
+ g_error ("type 0x%02x not yet supported in custom attr encoder", type);
+ }
+ }
+ /*
+ * we don't support properties and fields, yet, set to 0.
+ */
+ *p++ = 0;
+ *p++ = 0;
+ buflen = p - buffer;
+ result = mono_array_new (mono_domain_get (), mono_defaults.byte_class, buflen);
+ p = mono_array_addr (result, char, 0);
+ memcpy (p, buffer, buflen);
+ g_free (buffer);
+ return result;
+}
+
+/*
+ * mono_reflection_setup_internal_class:
+ * @tb: a TypeBuilder object
+ *
+ * Creates a MonoClass that represents the TypeBuilder.
+ * This is a trick that lets us simplify a lot of reflection code
+ * (and will allow us to support Build and Run assemblies easier).
+ */
+void
+mono_reflection_setup_internal_class (MonoReflectionTypeBuilder *tb)
+{
+ MonoClass *klass, *parent;
+
+ klass = g_new0 (MonoClass, 1);
+
+ klass->image = tb->module->assemblyb->dynamic_assembly->assembly.image;
+
+ if (tb->parent)
+ parent = mono_class_from_mono_type (tb->parent->type);
+
+ klass->inited = 1; /* we lie to the runtime */
+ klass->name = mono_string_to_utf8 (tb->name);
+ klass->name_space = mono_string_to_utf8 (tb->nspace);
+ klass->type_token = MONO_TOKEN_TYPE_DEF | tb->table_idx;
+ klass->flags = tb->attrs;
+
+ klass->element_class = klass;
+ klass->reflection_info = tb; /* need to pin. */
+
+ mono_class_setup_parent (klass, parent);
+ mono_class_setup_mono_type (klass);
+
+ /*
+ * FIXME: handle interfaces.
+ */
+
+ tb->type.type = &klass->byval_arg;
+
+ /*g_print ("setup %s as %s (%p)\n", klass->name, ((MonoObject*)tb)->vtable->klass->name, tb);*/
+}
+
+MonoArray *
+mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig)
+{
+ MonoDynamicAssembly *assembly = sig->module->assemblyb->dynamic_assembly;
+ guint32 na = mono_array_length (sig->arguments);
+ guint32 buflen, i;
+ MonoArray *result;
+ char *buf, *p;
+
+ p = buf = g_malloc (10 + na * 10);
+
+ mono_metadata_encode_value (0x07, p, &p);
+ mono_metadata_encode_value (na, p, &p);
+ for (i = 0; i < na; ++i) {
+ MonoReflectionType *type = mono_array_get (sig->arguments, MonoReflectionType *, i);
+ encode_reflection_type (assembly, type, p, &p);
+ }
+
+ buflen = p - buf;
+ result = mono_array_new (mono_domain_get (), mono_defaults.byte_class, buflen);
+ p = mono_array_addr (result, char, 0);
+ memcpy (p, buf, buflen);
+ g_free (buf);
+
+ return result;
+}
+
+MonoArray *
+mono_reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig)
+{
+ MonoDynamicAssembly *assembly = sig->module->assemblyb->dynamic_assembly;
+ guint32 na = mono_array_length (sig->arguments);
+ guint32 buflen, i;
+ MonoArray *result;
+ char *buf, *p;
+
+ p = buf = g_malloc (10 + na * 10);
+
+ mono_metadata_encode_value (0x06, p, &p);
+ for (i = 0; i < na; ++i) {
+ MonoReflectionType *type = mono_array_get (sig->arguments, MonoReflectionType *, i);
+ encode_reflection_type (assembly, type, p, &p);
+ }
+
+ buflen = p - buf;
+ result = mono_array_new (mono_domain_get (), mono_defaults.byte_class, buflen);
+ p = mono_array_addr (result, char, 0);
+ memcpy (p, buf, buflen);
+ g_free (buf);
+
+ return result;
+}
+
diff --git a/mono/metadata/reflection.h b/mono/metadata/reflection.h
new file mode 100644
index 00000000000..7242716c796
--- /dev/null
+++ b/mono/metadata/reflection.h
@@ -0,0 +1,373 @@
+#ifndef __METADATA_REFLECTION_H__
+#define __METADATA_REFLECTION_H__
+
+#include <mono/metadata/image.h>
+#include <mono/metadata/metadata.h>
+#include <mono/metadata/class.h>
+#include <mono/metadata/object.h>
+#include <mono/utils/mono-hash.h>
+
+typedef struct {
+ GHashTable *hash;
+ char *data;
+ guint32 alloc_size; /* malloced bytes */
+ guint32 index;
+ guint32 offset; /* from start of metadata */
+} MonoDynamicStream;
+
+typedef struct {
+ guint32 rows;
+ guint32 row_size; /* calculated later with column_sizes */
+ guint32 columns;
+ guint32 column_sizes [9];
+ guint32 *values; /* rows * columns */
+ guint32 next_idx;
+} MonoDynamicTable;
+
+/*
+ * The followinbg structure must match the C# implementation in our corlib.
+ */
+
+struct _MonoReflectionMethod {
+ MonoObject object;
+ MonoMethod *method;
+ MonoString *name;
+};
+
+typedef struct {
+ MonoObject object;
+ MonoObject *target_type;
+ MonoObject *target;
+ MonoString *method_name;
+ gpointer method_ptr;
+ gpointer delegate_trampoline;
+ MonoReflectionMethod *method_info;
+} MonoDelegate;
+
+typedef struct _MonoMulticastDelegate MonoMulticastDelegate;
+struct _MonoMulticastDelegate {
+ MonoDelegate delegate;
+ MonoMulticastDelegate *prev;
+};
+
+typedef struct {
+ MonoObject object;
+ MonoClass *klass;
+ MonoClassField *field;
+} MonoReflectionField;
+
+typedef struct {
+ MonoObject object;
+ MonoClass *klass;
+ MonoProperty *property;
+} MonoReflectionProperty;
+
+typedef struct {
+ MonoObject object;
+ MonoClass *klass;
+ MonoEvent *event;
+} MonoReflectionEvent;
+
+typedef struct {
+ MonoObject object;
+ MonoReflectionType *ClassImpl;
+ MonoObject *DefaultValueImpl;
+ MonoObject *MemberImpl;
+ MonoString *NameImpl;
+ gint32 PositionImpl;
+ guint32 AttrsImpl;
+} MonoReflectionParameter;
+
+typedef struct {
+ MonoObject object;
+ MonoAssembly *assembly;
+} MonoReflectionAssembly;
+
+typedef struct {
+ MonoReflectionType *utype;
+ MonoArray *values;
+ MonoArray *names;
+} MonoEnumInfo;
+
+typedef struct {
+ MonoReflectionType *parent;
+ MonoReflectionType *ret;
+ guint32 attrs;
+ guint32 implattrs;
+} MonoMethodInfo;
+
+typedef struct {
+ MonoReflectionType *parent;
+ MonoString *name;
+ MonoReflectionMethod *get;
+ MonoReflectionMethod *set;
+ guint32 attrs;
+} MonoPropertyInfo;
+
+typedef struct {
+ MonoReflectionType *parent;
+ MonoReflectionType *type;
+ MonoString *name;
+ guint32 attrs;
+} MonoFieldInfo;
+
+typedef struct {
+ MonoString *name;
+ MonoString *name_space;
+ MonoReflectionType *parent;
+ MonoReflectionType *etype;
+ MonoReflectionAssembly *assembly;
+ guint32 attrs;
+ guint32 rank;
+ MonoBoolean isbyref, ispointer, isprimitive;
+} MonoTypeInfo;
+
+typedef struct {
+ MonoObject *member;
+ gint32 code_pos;
+} MonoReflectionILTokenInfo;
+
+typedef struct {
+ MonoObject object;
+ MonoArray *code;
+ MonoObject *mbuilder;
+ gint32 code_len;
+ gint32 max_stack;
+ gint32 cur_stack;
+ MonoArray *locals;
+ MonoArray *ex_handlers;
+ gint32 num_token_fixups;
+ MonoArray *token_fixups;
+} MonoReflectionILGen;
+
+typedef struct {
+ MonoArray *handlers;
+ gint32 start;
+ gint32 len;
+ gint32 label;
+} MonoILExceptionInfo;
+
+typedef struct {
+ MonoReflectionType *extype;
+ gint32 type;
+ gint32 start;
+ gint32 len;
+ gint32 filter_offset;
+} MonoILExceptionBlock;
+
+typedef struct {
+ MonoObject object;
+ MonoReflectionType *type;
+ MonoString *name;
+} MonoReflectionLocalBuilder;
+
+typedef struct {
+ MonoObject object;
+ MonoObject* methodb;
+ MonoString *name;
+ MonoArray *cattrs;
+ guint32 attrs;
+ int position;
+ guint32 table_idx;
+} MonoReflectionParamBuilder;
+
+typedef struct {
+ MonoObject object;
+ MonoReflectionILGen *ilgen;
+ MonoArray *parameters;
+ guint32 attrs;
+ guint32 iattrs;
+ guint32 table_idx;
+ guint32 call_conv;
+ MonoObject *type;
+ MonoArray *pinfo;
+ MonoArray *cattrs;
+} MonoReflectionCtorBuilder;
+
+typedef struct {
+ MonoObject object;
+ MonoMethod *mhandle;
+ MonoReflectionType *rtype;
+ MonoArray *parameters;
+ guint32 attrs;
+ guint32 iattrs;
+ MonoString *name;
+ guint32 table_idx;
+ MonoArray *code;
+ MonoReflectionILGen *ilgen;
+ MonoObject *type;
+ MonoArray *pinfo;
+ MonoArray *cattrs;
+ MonoReflectionMethod *override_method;
+ MonoString *dll;
+ MonoString *dllentry;
+ guint32 charset;
+ guint32 native_cc;
+ guint32 call_conv;
+} MonoReflectionMethodBuilder;
+
+typedef struct {
+ MonoAssembly assembly;
+ guint32 meta_size;
+ guint32 text_rva;
+ guint32 metadata_rva;
+ GHashTable *typeref;
+ GHashTable *handleref;
+ MonoGHashTable *token_fixups;
+ MonoDynamicStream sheap;
+ MonoDynamicStream code; /* used to store method headers and bytecode */
+ MonoDynamicStream us;
+ MonoDynamicStream blob;
+ MonoDynamicStream tstream;
+ MonoDynamicStream guid;
+ MonoDynamicTable tables [64];
+} MonoDynamicAssembly;
+
+typedef struct {
+ MonoReflectionAssembly assembly;
+ MonoDynamicAssembly *dynamic_assembly;
+ MonoReflectionMethodBuilder *entry_point;
+ MonoArray *modules;
+ MonoString *name;
+ MonoString *dir;
+ MonoArray *cattrs;
+} MonoReflectionAssemblyBuilder;
+
+typedef struct {
+ MonoObject object;
+ guint32 attrs;
+ MonoReflectionType *type;
+ MonoString *name;
+ MonoObject *def_value;
+ gint32 offset;
+ gint32 table_idx;
+ MonoReflectionType *typeb;
+ MonoArray *rva_data;
+ MonoArray *cattrs;
+} MonoReflectionFieldBuilder;
+
+typedef struct {
+ MonoObject object;
+ guint32 attrs;
+ MonoString *name;
+ MonoReflectionType *type;
+ MonoArray *parameters;
+ MonoArray *cattrs;
+ MonoObject *def_value;
+ MonoReflectionMethodBuilder *set_method;
+ MonoReflectionMethodBuilder *get_method;
+ gint32 table_idx;
+} MonoReflectionPropertyBuilder;
+
+typedef struct {
+ MonoObject obj;
+ MonoImage *image;
+ MonoObject *assembly;
+ MonoString *fqname;
+ MonoString *name;
+ MonoString *scopename;
+} MonoReflectionModule;
+
+typedef struct {
+ MonoReflectionModule module;
+ MonoArray *types;
+ MonoArray *cattrs;
+ MonoArray *guid;
+ guint32 table_idx;
+ MonoReflectionAssemblyBuilder *assemblyb;
+} MonoReflectionModuleBuilder;
+
+typedef struct {
+ MonoReflectionType type;
+ MonoString *name;
+ MonoString *nspace;
+ MonoReflectionType *parent;
+ MonoArray *interfaces;
+ MonoArray *methods;
+ MonoArray *ctors;
+ MonoArray *properties;
+ MonoArray *fields;
+ MonoArray *events;
+ MonoArray *cattrs;
+ MonoArray *subtypes;
+ guint32 attrs;
+ guint32 table_idx;
+ MonoReflectionModuleBuilder *module;
+ gint32 class_size;
+ gint32 packing_size;
+} MonoReflectionTypeBuilder;
+
+typedef struct {
+ MonoObject obj;
+ MonoString *name;
+ MonoString *codebase;
+ MonoObject *version;
+} MonoReflectionAssemblyName;
+
+typedef struct {
+ MonoObject obj;
+ MonoString *name;
+ MonoReflectionType *type;
+ MonoReflectionTypeBuilder *typeb;
+ MonoArray *cattrs;
+ MonoReflectionMethodBuilder *add_method;
+ MonoReflectionMethodBuilder *remove_method;
+ MonoReflectionMethodBuilder *raise_method;
+ MonoArray *other_methods;
+ guint32 attrs;
+ guint32 table_idx;
+} MonoReflectionEventBuilder;
+
+typedef struct {
+ MonoObject obj;
+ MonoReflectionMethod *ctor;
+ MonoArray *data;
+} MonoReflectionCustomAttr;
+
+typedef struct {
+ char *nest_name_space;
+ char *nest_name;
+ char *name_space;
+ char *name;
+ char *assembly;
+ GList *modifiers; /* 0 -> byref, -1 -> pointer, > 0 -> array rank */
+} MonoTypeNameParse;
+
+typedef struct {
+ MonoObject object;
+ MonoReflectionModuleBuilder *module;
+ MonoArray *arguments;
+ guint32 type;
+} MonoReflectionSigHelper;
+
+
+
+char* mono_type_get_name (MonoType *type);
+int mono_reflection_parse_type (char *name, MonoTypeNameParse *info);
+MonoType* mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase);
+
+int mono_image_get_header (MonoReflectionAssemblyBuilder *assembly, char *buffer, int maxsize);
+void mono_image_basic_init (MonoReflectionAssemblyBuilder *assembly);
+guint32 mono_image_insert_string (MonoReflectionAssemblyBuilder *assembly, MonoString *str);
+guint32 mono_image_create_token (MonoDynamicAssembly *assembly, MonoObject *obj);
+
+MonoReflectionAssembly* mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly);
+MonoReflectionType* mono_type_get_object (MonoDomain *domain, MonoType *type);
+MonoReflectionMethod* mono_method_get_object (MonoDomain *domain, MonoMethod *method);
+MonoReflectionField* mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field);
+MonoReflectionProperty* mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property);
+MonoReflectionEvent* mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event);
+/* note: this one is slightly different: we keep the whole array of params in the cache */
+MonoReflectionParameter** mono_param_get_objects (MonoDomain *domain, MonoMethod *method);
+
+MonoArray* mono_reflection_get_custom_attrs (MonoObject *obj);
+MonoArray* mono_reflection_get_custom_attrs_blob (MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues);
+
+void mono_reflection_setup_internal_class (MonoReflectionTypeBuilder *tb);
+
+MonoArray *mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig);
+
+MonoArray *mono_reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig);
+
+#endif /* __METADATA_REFLECTION_H__ */
+
diff --git a/mono/metadata/row-indexes.h b/mono/metadata/row-indexes.h
new file mode 100644
index 00000000000..9595ee63415
--- /dev/null
+++ b/mono/metadata/row-indexes.h
@@ -0,0 +1,385 @@
+
+#ifndef __MONO_METADATA_ROW_INDEXES_H__
+#define __MONO_METADATA_ROW_INDEXES_H__
+
+/*
+ * The last entry in the enum is used to give the number
+ * of columns in the row.
+ */
+
+enum {
+ MONO_ASSEMBLY_HASH_ALG,
+ MONO_ASSEMBLY_MAJOR_VERSION,
+ MONO_ASSEMBLY_MINOR_VERSION,
+ MONO_ASSEMBLY_BUILD_NUMBER,
+ MONO_ASSEMBLY_REV_NUMBER,
+ MONO_ASSEMBLY_FLAGS,
+ MONO_ASSEMBLY_PUBLIC_KEY,
+ MONO_ASSEMBLY_NAME,
+ MONO_ASSEMBLY_CULTURE,
+ MONO_ASSEMBLY_SIZE
+};
+
+enum {
+ MONO_ASSEMBLYOS_PLATFORM,
+ MONO_ASSEMBLYOS_MAJOR_VERSION,
+ MONO_ASSEMBLYOS_MINOR_VERSION,
+ MONO_ASSEMBLYOS_SIZE
+};
+
+enum {
+ MONO_ASSEMBLY_PROCESSOR,
+ MONO_ASSEMBLY_PROCESSOR_SIZE
+};
+
+enum {
+ MONO_ASSEMBLYREF_MAJOR_VERSION,
+ MONO_ASSEMBLYREF_MINOR_VERSION,
+ MONO_ASSEMBLYREF_BUILD_NUMBER,
+ MONO_ASSEMBLYREF_REV_NUMBER,
+ MONO_ASSEMBLYREF_FLAGS,
+ MONO_ASSEMBLYREF_PUBLIC_KEY,
+ MONO_ASSEMBLYREF_NAME,
+ MONO_ASSEMBLYREF_CULTURE,
+ MONO_ASSEMBLYREF_HASH_VALUE,
+ MONO_ASSEMBLYREF_SIZE
+};
+
+enum {
+ MONO_ASSEMBLYREFOS_PLATFORM,
+ MONO_ASSEMBLYREFOS_MAJOR_VERSION,
+ MONO_ASSEMBLYREFOS_MINOR_VERSION,
+ MONO_ASSEMBLYREFOS_ASSEMBLYREF,
+ MONO_ASSEMBLYREFOS_SIZE
+};
+
+enum {
+ MONO_ASSEMBLYREFPROC_PROCESSOR,
+ MONO_ASSEMBLYREFPROC_ASSEMBLYREF,
+ MONO_ASSEMBLYREFPROC_SIZE
+};
+
+enum {
+ MONO_CLASS_LAYOUT_PACKING_SIZE,
+ MONO_CLASS_LAYOUT_CLASS_SIZE,
+ MONO_CLASS_LAYOUT_PARENT,
+ MONO_CLASS_LAYOUT_SIZE
+};
+
+enum {
+ MONO_CONSTANT_TYPE,
+ MONO_CONSTANT_PADDING,
+ MONO_CONSTANT_PARENT,
+ MONO_CONSTANT_VALUE,
+ MONO_CONSTANT_SIZE
+};
+
+enum {
+ MONO_CUSTOM_ATTR_PARENT,
+ MONO_CUSTOM_ATTR_TYPE,
+ MONO_CUSTOM_ATTR_VALUE,
+ MONO_CUSTOM_ATTR_SIZE
+};
+
+enum {
+ MONO_DECL_SECURITY_ACTION,
+ MONO_DECL_SECURITY_PARENT,
+ MONO_DECL_SECURITY_PERMISSIONSET,
+ MONO_DECL_SECURITY_SIZE
+};
+
+enum {
+ MONO_EVENT_MAP_PARENT,
+ MONO_EVENT_MAP_EVENTLIST,
+ MONO_EVENT_MAP_SIZE
+};
+
+enum {
+ MONO_EVENT_FLAGS,
+ MONO_EVENT_NAME,
+ MONO_EVENT_TYPE,
+ MONO_EVENT_SIZE
+};
+
+enum {
+ MONO_EXP_TYPE_FLAGS,
+ MONO_EXP_TYPE_TYPEDEF,
+ MONO_EXP_TYPE_NAME,
+ MONO_EXP_TYPE_NAMESPACE,
+ MONO_EXP_TYPE_IMPLEMENTATION,
+ MONO_EXP_TYPE_SIZE
+};
+
+enum {
+ MONO_FIELD_FLAGS,
+ MONO_FIELD_NAME,
+ MONO_FIELD_SIGNATURE,
+ MONO_FIELD_SIZE
+};
+
+enum {
+ MONO_FIELD_LAYOUT_OFFSET,
+ MONO_FIELD_LAYOUT_FIELD,
+ MONO_FIELD_LAYOUT_SIZE
+};
+
+enum {
+ MONO_FIELD_MARSHAL_PARENT,
+ MONO_FIELD_MARSHAL_NATIVE_TYPE,
+ MONO_FIELD_MARSHAL_SIZE
+};
+
+enum {
+ MONO_FIELD_RVA_RVA,
+ MONO_FIELD_RVA_FIELD,
+ MONO_FIELD_RVA_SIZE
+};
+
+enum {
+ MONO_FILE_FLAGS,
+ MONO_FILE_NAME,
+ MONO_FILE_HASH_VALUE,
+ MONO_FILE_SIZE
+};
+
+enum {
+ MONO_IMPLMAP_FLAGS,
+ MONO_IMPLMAP_MEMBER,
+ MONO_IMPLMAP_NAME,
+ MONO_IMPLMAP_SCOPE,
+ MONO_IMPLMAP_SIZE
+};
+
+enum {
+ MONO_INTERFACEIMPL_CLASS,
+ MONO_INTERFACEIMPL_INTERFACE,
+ MONO_INTERFACEIMPL_SIZE
+};
+
+enum {
+ MONO_MANIFEST_OFFSET,
+ MONO_MANIFEST_FLAGS,
+ MONO_MANIFEST_NAME,
+ MONO_MANIFEST_IMPLEMENTATION,
+ MONO_MANIFEST_SIZE
+};
+
+enum {
+ MONO_MEMBERREF_CLASS,
+ MONO_MEMBERREF_NAME,
+ MONO_MEMBERREF_SIGNATURE,
+ MONO_MEMBERREF_SIZE
+};
+
+enum {
+ MONO_METHOD_RVA,
+ MONO_METHOD_IMPLFLAGS,
+ MONO_METHOD_FLAGS,
+ MONO_METHOD_NAME,
+ MONO_METHOD_SIGNATURE,
+ MONO_METHOD_PARAMLIST,
+ MONO_METHOD_SIZE
+};
+
+enum {
+ MONO_MTHODIMPL_CLASS,
+ MONO_MTHODIMPL_BODY,
+ MONO_MTHODIMPL_DECLARATION,
+ MONO_MTHODIMPL_SIZE
+};
+
+enum {
+ MONO_METHOD_SEMA_SEMANTICS,
+ MONO_METHOD_SEMA_METHOD,
+ MONO_METHOD_SEMA_ASSOCIATION,
+ MONO_METHOD_SEMA_SIZE
+};
+
+enum {
+ MONO_MODULE_GENERATION,
+ MONO_MODULE_NAME,
+ MONO_MODULE_MVID,
+ MONO_MODULE_ENC,
+ MONO_MODULE_ENCBASE,
+ MONO_MODULE_SIZE
+};
+
+enum {
+ MONO_MODULEREF_NAME,
+ MONO_MODULEREF_SIZE
+};
+
+enum {
+ MONO_NESTED_CLASS_NESTED,
+ MONO_NESTED_CLASS_ENCLOSING,
+ MONO_NESTED_CLASS_SIZE
+};
+
+enum {
+ MONO_PARAM_FLAGS,
+ MONO_PARAM_SEQUENCE,
+ MONO_PARAM_NAME,
+ MONO_PARAM_SIZE
+};
+
+enum {
+ MONO_PROPERTY_FLAGS,
+ MONO_PROPERTY_NAME,
+ MONO_PROPERTY_TYPE,
+ MONO_PROPERTY_SIZE
+};
+
+enum {
+ MONO_PROPERTY_MAP_PARENT,
+ MONO_PROPERTY_MAP_PROPERTY_LIST,
+ MONO_PROPERTY_MAP_SIZE
+};
+
+enum {
+ MONO_STAND_ALONE_SIGNATURE,
+ MONO_STAND_ALONE_SIGNATURE_SIZE
+};
+
+enum {
+ MONO_TYPEDEF_FLAGS,
+ MONO_TYPEDEF_NAME,
+ MONO_TYPEDEF_NAMESPACE,
+ MONO_TYPEDEF_EXTENDS,
+ MONO_TYPEDEF_FIELD_LIST,
+ MONO_TYPEDEF_METHOD_LIST,
+ MONO_TYPEDEF_SIZE
+};
+
+enum {
+ MONO_TYPEREF_SCOPE,
+ MONO_TYPEREF_NAME,
+ MONO_TYPEREF_NAMESPACE,
+ MONO_TYPEREF_SIZE
+};
+
+enum {
+ MONO_TYPESPEC_SIGNATURE,
+ MONO_TYPESPEC_SIZE
+};
+
+/*
+ * Coded Tokens
+ * The _BITS entry is for the bits used in the token.
+ * The _MASK entry is for mask the index out.
+ */
+
+enum {
+ TYPEDEFORREF_TYPEDEF,
+ TYPEDEFORREF_TYPEREF,
+ TYPEDEFORREF_TYPESPEC,
+ TYPEDEFORREF_BITS = 2,
+ TYPEDEFORREF_MASK = 3
+};
+
+enum {
+ HASCONSTANT_FIEDDEF,
+ HASCONSTANT_PARAM,
+ HASCONSTANT_PROPERTY,
+ HASCONSTANT_BITS = 2,
+ HASCONSTANT_MASK = 3
+};
+
+enum {
+ CUSTOM_ATTR_METHODDEF,
+ CUSTOM_ATTR_FIELDDEF,
+ CUSTOM_ATTR_TYPEREF,
+ CUSTOM_ATTR_TYPEDEF,
+ CUSTOM_ATTR_PARAMDEF,
+ CUSTOM_ATTR_INTERFACE,
+ CUSTOM_ATTR_MEMBERREF,
+ CUSTOM_ATTR_MODULE,
+ CUSTOM_ATTR_PERMISSION,
+ CUSTOM_ATTR_PROPERTY,
+ CUSTOM_ATTR_EVENT,
+ CUSTOM_ATTR_SIGNATURE,
+ CUSTOM_ATTR_MODULEREF,
+ CUSTOM_ATTR_TYPESPEC,
+ CUSTOM_ATTR_ASSEMBLY,
+ CUSTOM_ATTR_ASSEMBLYREF,
+ CUSTOM_ATTR_FILE,
+ CUSTOM_ATTR_EXP_TYPE,
+ CUSTOM_ATTR_MANIFEST,
+ CUSTOM_ATTR_BITS = 5,
+ CUSTOM_ATTR_MASK = 0x1F
+};
+
+enum {
+ HAS_FIELD_MARSHAL_FIELDSREF,
+ HAS_FIELD_MARSHAL_PARAMDEF,
+ HAS_FIELD_MARSHAL_BITS = 1,
+ HAS_FIELD_MARSHAL_MASK = 1
+};
+
+enum {
+ HAS_DECL_SECURITY_TYPEDEF,
+ HAS_DECL_SECURITY_METHODDEF,
+ HAS_DECL_SECURITY_ASSEMBLY,
+ HAS_DECL_SECURITY_BITS = 2,
+ HAS_DECL_SECURITY_MASK = 3
+};
+
+enum {
+ MEMBERREF_PARENT_TYPEDEF, /* not used */
+ MEMBERREF_PARENT_TYPEREF,
+ MEMBERREF_PARENT_MODULEREF,
+ MEMBERREF_PARENT_METHODDEF,
+ MEMBERREF_PARENT_TYPESPEC,
+ MEMBERREF_PARENT_BITS = 3,
+ MEMBERREF_PARENT_MASK = 7
+};
+
+enum {
+ HAS_SEMANTICS_EVENT,
+ HAS_SEMANTICS_PROPERTY,
+ HAS_SEMANTICS_BITS = 1,
+ HAS_SEMANTICS_MASK = 1
+};
+
+enum {
+ METHODDEFORREF_METHODDEF,
+ METHODDEFORREF_METHODREF,
+ METHODDEFORREF_BITS = 1,
+ METHODDEFORREF_MASK = 1
+};
+
+enum {
+ MEMBERFORWD_FIELDDEF,
+ MEMBERFORWD_METHODDEF,
+ MEMBERFORWD_BITS = 1,
+ MEMBERFORWD_MASK = 1
+};
+
+enum {
+ IMPLEMENTATION_FILE,
+ IMPLEMENTATION_ASSEMBLYREF,
+ IMPLEMENTATION_EXP_TYPE,
+ IMPLEMENTATION_BITS = 2,
+ IMPLEMENTATION_MASK = 3
+};
+
+enum {
+ CUSTOM_ATTR_TYPE_TYPEREF, /* not used */
+ CUSTOM_ATTR_TYPE_TYPEDEF, /* not used */
+ CUSTOM_ATTR_TYPE_METHODDEF,
+ CUSTOM_ATTR_TYPE_MEMBERREF,
+ CUSTOM_ATTR_TYPE_STRING, /* not used */
+ CUSTOM_ATTR_TYPE_BITS = 3,
+ CUSTOM_ATTR_TYPE_MASK = 7
+};
+
+enum {
+ RESOLTION_SCOPE_MODULE,
+ RESOLTION_SCOPE_MODULEREF,
+ RESOLTION_SCOPE_ASSEMBLYREF,
+ RESOLTION_SCOPE_TYPEREF,
+ RESOLTION_SCOPE_BITS = 2,
+ RESOLTION_SCOPE_MASK = 3
+};
+
+#endif /* __MONO_METADATA_ROW_INDEXES_H__ */
+
diff --git a/mono/metadata/socket-io.c b/mono/metadata/socket-io.c
new file mode 100644
index 00000000000..1e84cba0645
--- /dev/null
+++ b/mono/metadata/socket-io.c
@@ -0,0 +1,1371 @@
+/*
+ * socket-io.c: Socket IO internal calls
+ *
+ * Author:
+ * Dick Porter (dick@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <mono/metadata/object.h>
+#include <mono/io-layer/io-layer.h>
+#include <mono/metadata/socket-io.h>
+#include <mono/metadata/exception.h>
+#include <mono/metadata/appdomain.h>
+
+#include <sys/time.h>
+
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#undef DEBUG
+
+static gint32 convert_family(MonoAddressFamily mono_family)
+{
+ gint32 family=-1;
+
+ switch(mono_family) {
+ case AddressFamily_Unknown:
+ case AddressFamily_ImpLink:
+ case AddressFamily_Pup:
+ case AddressFamily_Chaos:
+ case AddressFamily_Iso:
+ case AddressFamily_Ecma:
+ case AddressFamily_DataKit:
+ case AddressFamily_Ccitt:
+ case AddressFamily_DataLink:
+ case AddressFamily_Lat:
+ case AddressFamily_HyperChannel:
+ case AddressFamily_NetBios:
+ case AddressFamily_VoiceView:
+ case AddressFamily_FireFox:
+ case AddressFamily_Banyan:
+ case AddressFamily_Atm:
+ case AddressFamily_Cluster:
+ case AddressFamily_Ieee12844:
+ case AddressFamily_NetworkDesigners:
+ g_warning("System.Net.Sockets.AddressFamily has unsupported value 0x%x", mono_family);
+ break;
+
+ case AddressFamily_Unspecified:
+ family=AF_UNSPEC;
+ break;
+
+ case AddressFamily_Unix:
+ family=AF_UNIX;
+ break;
+
+ case AddressFamily_InterNetwork:
+ family=AF_INET;
+ break;
+
+ case AddressFamily_Ipx:
+ family=AF_IPX;
+ break;
+
+ case AddressFamily_Sna:
+ family=AF_SNA;
+ break;
+
+ case AddressFamily_DecNet:
+ family=AF_DECnet;
+ break;
+
+ case AddressFamily_AppleTalk:
+ family=AF_APPLETALK;
+ break;
+
+ case AddressFamily_InterNetworkV6:
+ family=AF_INET6;
+ break;
+#ifdef AF_IRDA
+ case AddressFamily_Irda:
+ family=AF_IRDA;
+ break;
+#endif
+ default:
+ g_warning("System.Net.Sockets.AddressFamily has unknown value 0x%x", mono_family);
+ }
+
+ return(family);
+}
+
+static MonoAddressFamily convert_to_mono_family(guint16 af_family)
+{
+ MonoAddressFamily family=AddressFamily_Unknown;
+
+ switch(af_family) {
+ case AF_UNSPEC:
+ family=AddressFamily_Unspecified;
+ break;
+
+ case AF_UNIX:
+ family=AddressFamily_Unix;
+ break;
+
+ case AF_INET:
+ family=AddressFamily_InterNetwork;
+ break;
+
+ case AF_IPX:
+ family=AddressFamily_Ipx;
+ break;
+
+ case AF_SNA:
+ family=AddressFamily_Sna;
+ break;
+
+ case AF_DECnet:
+ family=AddressFamily_DecNet;
+ break;
+
+ case AF_APPLETALK:
+ family=AddressFamily_AppleTalk;
+ break;
+
+ case AF_INET6:
+ family=AddressFamily_InterNetworkV6;
+ break;
+
+#ifdef AF_IRDA
+ case AF_IRDA:
+ family=AddressFamily_Irda;
+ break;
+#endif
+ default:
+ g_warning("unknown address family 0x%x", af_family);
+ }
+
+ return(family);
+}
+
+static gint32 convert_type(MonoSocketType mono_type)
+{
+ gint32 type=-1;
+
+ switch(mono_type) {
+ case SocketType_Stream:
+ type=SOCK_STREAM;
+ break;
+
+ case SocketType_Dgram:
+ type=SOCK_DGRAM;
+ break;
+
+ case SocketType_Raw:
+ type=SOCK_RAW;
+ break;
+
+ case SocketType_Rdm:
+ type=SOCK_RDM;
+ break;
+
+ case SocketType_Seqpacket:
+ type=SOCK_SEQPACKET;
+ break;
+
+ case SocketType_Unknown:
+ g_warning("System.Net.Sockets.SocketType has unsupported value 0x%x", mono_type);
+ break;
+
+ default:
+ g_warning("System.Net.Sockets.SocketType has unknown value 0x%x", mono_type);
+ }
+
+ return(type);
+}
+
+static gint32 convert_proto(MonoProtocolType mono_proto)
+{
+ gint32 proto=-1;
+
+ switch(mono_proto) {
+ case ProtocolType_IP:
+ case ProtocolType_Icmp:
+ case ProtocolType_Igmp:
+ case ProtocolType_Ggp:
+ case ProtocolType_Tcp:
+ case ProtocolType_Pup:
+ case ProtocolType_Udp:
+ case ProtocolType_Idp:
+ /* These protocols are known (on my system at least) */
+ proto=mono_proto;
+ break;
+
+ case ProtocolType_ND:
+ case ProtocolType_Raw:
+ case ProtocolType_Ipx:
+ case ProtocolType_Spx:
+ case ProtocolType_SpxII:
+ case ProtocolType_Unknown:
+ /* These protocols arent */
+ g_warning("System.Net.Sockets.ProtocolType has unsupported value 0x%x", mono_proto);
+ break;
+
+ default:
+ }
+
+ return(proto);
+}
+
+static gint32 convert_sockopt_level_and_name(MonoSocketOptionLevel mono_level,
+ MonoSocketOptionName mono_name,
+ int *system_level,
+ int *system_name)
+{
+ switch (mono_level) {
+ case SocketOptionLevel_Socket:
+ *system_level = SOL_SOCKET;
+
+ switch(mono_name) {
+ case SocketOptionName_DontLinger:
+ /* This is SO_LINGER, because the setsockopt
+ * internal call maps DontLinger to SO_LINGER
+ * with l_onoff=0
+ */
+ *system_name = SO_LINGER;
+ break;
+ case SocketOptionName_Debug:
+ *system_name = SO_DEBUG;
+ break;
+#ifdef SO_ACCEPTCONN
+ case SocketOptionName_AcceptConnection:
+ *system_name = SO_ACCEPTCONN;
+ break;
+#endif
+ case SocketOptionName_ReuseAddress:
+ *system_name = SO_REUSEADDR;
+ break;
+ case SocketOptionName_KeepAlive:
+ *system_name = SO_KEEPALIVE;
+ break;
+ case SocketOptionName_DontRoute:
+ *system_name = SO_DONTROUTE;
+ break;
+ case SocketOptionName_Broadcast:
+ *system_name = SO_BROADCAST;
+ break;
+ case SocketOptionName_Linger:
+ *system_name = SO_LINGER;
+ break;
+ case SocketOptionName_OutOfBandInline:
+ *system_name = SO_OOBINLINE;
+ break;
+ case SocketOptionName_SendBuffer:
+ *system_name = SO_SNDBUF;
+ break;
+ case SocketOptionName_ReceiveBuffer:
+ *system_name = SO_RCVBUF;
+ break;
+ case SocketOptionName_SendLowWater:
+ *system_name = SO_SNDLOWAT;
+ break;
+ case SocketOptionName_ReceiveLowWater:
+ *system_name = SO_RCVLOWAT;
+ break;
+ case SocketOptionName_SendTimeout:
+ *system_name = SO_SNDTIMEO;
+ break;
+ case SocketOptionName_ReceiveTimeout:
+ *system_name = SO_RCVTIMEO;
+ break;
+ case SocketOptionName_Error:
+ *system_name = SO_ERROR;
+ break;
+ case SocketOptionName_Type:
+ *system_name = SO_TYPE;
+ break;
+ case SocketOptionName_ExclusiveAddressUse:
+ case SocketOptionName_UseLoopback:
+ case SocketOptionName_MaxConnections:
+ /* Can't figure out how to map these, so fall
+ * through
+ */
+ default:
+ g_warning("System.Net.Sockets.SocketOptionName 0x%x is not supported at Socket level", mono_name);
+ return(-1);
+ }
+ break;
+
+ case SocketOptionLevel_IP:
+#ifdef HAVE_SOL_IP
+ *system_level = SOL_IP;
+#else
+ if (1) {
+ static int cached = 0;
+ static int proto;
+
+ if (!cached) {
+ struct protoent *pent;
+
+ pent = getprotobyname ("IP");
+ proto = pent ? pent->p_proto : 0 /* 0 a good default value?? */;
+ cached = 1;
+ }
+
+ *system_level = proto;
+ }
+#endif /* HAVE_SOL_IP */
+
+ switch(mono_name) {
+ case SocketOptionName_IPOptions:
+ *system_name = IP_OPTIONS;
+ break;
+#ifdef IP_HDRINCL
+ case SocketOptionName_HeaderIncluded:
+ *system_name = IP_HDRINCL;
+ break;
+#endif
+#ifdef IP_TOS
+ case SocketOptionName_TypeOfService:
+ *system_name = IP_TOS;
+ break;
+#endif
+#ifdef IP_TTL
+ case SocketOptionName_IpTimeToLive:
+ *system_name = IP_TTL;
+ break;
+#endif
+ case SocketOptionName_MulticastInterface:
+ *system_name = IP_MULTICAST_IF;
+ break;
+ case SocketOptionName_MulticastTimeToLive:
+ *system_name = IP_MULTICAST_TTL;
+ break;
+ case SocketOptionName_MulticastLoopback:
+ *system_name = IP_MULTICAST_LOOP;
+ break;
+ case SocketOptionName_AddMembership:
+ *system_name = IP_ADD_MEMBERSHIP;
+ break;
+ case SocketOptionName_DropMembership:
+ *system_name = IP_DROP_MEMBERSHIP;
+ break;
+#ifdef HAVE_IP_PKTINFO
+ case SocketOptionName_PacketInformation:
+ *system_name = IP_PKTINFO;
+ break;
+#endif /* HAVE_IP_PKTINFO */
+ case SocketOptionName_DontFragment:
+ case SocketOptionName_AddSourceMembership:
+ case SocketOptionName_DropSourceMembership:
+ case SocketOptionName_BlockSource:
+ case SocketOptionName_UnblockSource:
+ /* Can't figure out how to map these, so fall
+ * through
+ */
+ default:
+ g_warning("System.Net.Sockets.SocketOptionName 0x%x is not supported at IP level", mono_name);
+ return(-1);
+ }
+ break;
+
+ case SocketOptionLevel_Tcp:
+#ifdef HAVE_SOL_TCP
+ *system_level = SOL_TCP;
+#else
+ if (1) {
+ static int cached = 0;
+ static int proto;
+
+ if (!cached) {
+ struct protoent *pent;
+
+ pent = getprotobyname ("TCP");
+ proto = pent ? pent->p_proto : 6 /* is 6 a good default value?? */;
+ cached = 1;
+ }
+
+ *system_level = proto;
+ }
+#endif /* HAVE_SOL_TCP */
+
+ switch(mono_name) {
+ case SocketOptionName_NoDelay:
+ *system_name = TCP_NODELAY;
+ break;
+#if 0
+ /* The documentation is talking complete
+ * bollocks here: rfc-1222 is titled
+ * 'Advancing the NSFNET Routing Architecture'
+ * and doesn't mention either of the words
+ * "expedite" or "urgent".
+ */
+ case SocketOptionName_BsdUrgent:
+ case SocketOptionName_Expedited:
+#endif
+ default:
+ g_warning("System.Net.Sockets.SocketOptionName 0x%x is not supported at TCP level", mono_name);
+ return(-1);
+ }
+ break;
+
+ case SocketOptionLevel_Udp:
+ g_warning("System.Net.Sockets.SocketOptionLevel has unsupported value 0x%x", mono_level);
+
+ switch(mono_name) {
+ case SocketOptionName_NoChecksum:
+ case SocketOptionName_ChecksumCoverage:
+ default:
+ g_warning("System.Net.Sockets.SocketOptionName 0x%x is not supported at UDP level", mono_name);
+ return(-1);
+ }
+ return(-1);
+ break;
+
+ default:
+ g_warning("System.Net.Sockets.SocketOptionLevel has unknown value 0x%x", mono_level);
+ return(-1);
+ }
+
+ return(0);
+}
+
+#define STASH_SYS_ASS(this) \
+ if(system_assembly == NULL) { \
+ system_assembly=this->vtable->klass->image; \
+ }
+
+static MonoImage *system_assembly=NULL;
+
+static MonoException *get_socket_exception(guint32 error_code)
+{
+ /* Don't cache this exception, because we need the object
+ * constructor to set up the message from the sockets error code.
+ */
+ MonoException *ex;
+
+ /* This is a bit of a kludge. The SocketException 0-arg
+ * constructor calls WSAGetLastError() to find the error code
+ * to use. Until we can init objects with parameters, this
+ * will have to do.
+ */
+ WSASetLastError(error_code);
+
+ ex=(MonoException *)mono_exception_from_name(system_assembly,
+ "System.Net.Sockets",
+ "SocketException");
+ return(ex);
+}
+
+SOCKET ves_icall_System_Net_Sockets_Socket_Socket_internal(MonoObject *this, gint32 family, gint32 type, gint32 proto)
+{
+ SOCKET sock;
+ gint32 sock_family;
+ gint32 sock_proto;
+ gint32 sock_type;
+ int ret;
+ int true=1;
+
+ STASH_SYS_ASS(this);
+
+ sock_family=convert_family(family);
+ if(sock_family==-1) {
+ mono_raise_exception(get_socket_exception(WSAEAFNOSUPPORT));
+ return(NULL);
+ }
+
+ sock_proto=convert_proto(proto);
+ if(sock_proto==-1) {
+ mono_raise_exception(get_socket_exception(WSAEPROTONOSUPPORT));
+ return(NULL);
+ }
+
+ sock_type=convert_type(type);
+ if(sock_type==-1) {
+ mono_raise_exception(get_socket_exception(WSAESOCKTNOSUPPORT));
+ return(NULL);
+ }
+
+ sock=socket(sock_family, sock_type, sock_proto);
+ if(sock==INVALID_SOCKET) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ return(NULL);
+ }
+
+ /* .net seems to set this by default */
+ ret=setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &true, sizeof(true));
+ if(ret==SOCKET_ERROR) {
+ closesocket(sock);
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ return(NULL);
+ }
+
+ return(sock);
+}
+
+void ves_icall_System_Net_Sockets_Socket_Close_internal(SOCKET sock)
+{
+ closesocket(sock);
+}
+
+gint32 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal(void)
+{
+ g_message(G_GNUC_PRETTY_FUNCTION ": returning %d", WSAGetLastError());
+ return(WSAGetLastError());
+}
+
+gint32 ves_icall_System_Net_Sockets_Socket_Available_internal(SOCKET sock)
+{
+ int ret, amount;
+
+ ret=ioctlsocket(sock, FIONREAD, &amount);
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ return(0);
+ }
+
+ return(amount);
+}
+
+void ves_icall_System_Net_Sockets_Socket_Blocking_internal(SOCKET sock,
+ gboolean block)
+{
+ int ret;
+
+ ret=ioctlsocket(sock, FIONBIO, &block);
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+}
+
+SOCKET ves_icall_System_Net_Sockets_Socket_Accept_internal(SOCKET sock)
+{
+ SOCKET newsock;
+
+ newsock=accept(sock, NULL, 0);
+ if(newsock==INVALID_SOCKET) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ return(NULL);
+ }
+
+ return(newsock);
+}
+
+void ves_icall_System_Net_Sockets_Socket_Listen_internal(SOCKET sock,
+ guint32 backlog)
+{
+ int ret;
+
+ ret=listen(sock, backlog);
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+}
+
+static MonoObject *create_object_from_sockaddr(struct sockaddr *saddr,
+ int sa_size)
+{
+ MonoDomain *domain = mono_domain_get ();
+ MonoObject *sockaddr_obj;
+ MonoClass *sockaddr_class;
+ MonoClassField *field;
+ MonoArray *data;
+ MonoAddressFamily family;
+
+ /* Build a System.Net.SocketAddress object instance */
+ sockaddr_class=mono_class_from_name(system_assembly, "System.Net", "SocketAddress");
+ sockaddr_obj=mono_object_new(domain, sockaddr_class);
+
+ /* Locate the SocketAddress data buffer in the object */
+ field=mono_class_get_field_from_name(sockaddr_class, "data");
+
+ /* Make sure there is space for the family and size bytes */
+ data=mono_array_new(domain, mono_defaults.byte_class, sa_size+2);
+
+ /* The data buffer is laid out as follows:
+ * byte 0 is the address family
+ * byte 1 is the buffer length
+ * bytes 2 and 3 are the port info
+ * the rest is the address info
+ */
+
+ family=convert_to_mono_family(saddr->sa_family);
+ if(family==AddressFamily_Unknown) {
+ mono_raise_exception(get_socket_exception(WSAEAFNOSUPPORT));
+ return(NULL);
+ }
+
+ mono_array_set(data, guint8, 0, family);
+ mono_array_set(data, guint8, 1, sa_size+2);
+
+ if(saddr->sa_family==AF_INET) {
+ struct sockaddr_in *sa_in=(struct sockaddr_in *)saddr;
+ guint16 port=ntohs(sa_in->sin_port);
+ guint32 address=ntohl(sa_in->sin_addr.s_addr);
+
+ if(sa_size<8) {
+ mono_raise_exception((MonoException *)mono_exception_from_name(mono_defaults.corlib, "System", "SystemException"));
+ }
+
+ mono_array_set(data, guint8, 2, (port>>8) & 0xff);
+ mono_array_set(data, guint8, 3, (port) & 0xff);
+ mono_array_set(data, guint8, 4, (address>>24) & 0xff);
+ mono_array_set(data, guint8, 5, (address>>16) & 0xff);
+ mono_array_set(data, guint8, 6, (address>>8) & 0xff);
+ mono_array_set(data, guint8, 7, (address) & 0xff);
+
+ *(MonoArray **)(((char *)sockaddr_obj) + field->offset)=data;
+
+ return(sockaddr_obj);
+ } else {
+ mono_raise_exception(get_socket_exception(WSAEAFNOSUPPORT));
+ return(NULL);
+ }
+}
+
+extern MonoObject *ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal(SOCKET sock)
+{
+ struct sockaddr sa;
+ int salen;
+ int ret;
+
+ salen=sizeof(struct sockaddr);
+ ret=getsockname(sock, &sa, &salen);
+
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": bound to %s port %d", inet_ntoa((struct sockaddr_in)sa.sin_addr), ntohs((struct sockaddr_in)sa.sin_port));
+#endif
+
+ return(create_object_from_sockaddr(&sa, salen));
+}
+
+extern MonoObject *ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal(SOCKET sock)
+{
+ struct sockaddr sa;
+ int salen;
+ int ret;
+
+ salen=sizeof(struct sockaddr);
+ ret=getpeername(sock, &sa, &salen);
+
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": connected to %s port %d", inet_ntoa((struct sockaddr_in)sa.sin_addr), ntohs((struct sockaddr_in)sa.sin_port));
+#endif
+
+ return(create_object_from_sockaddr(&sa, salen));
+}
+
+static struct sockaddr *create_sockaddr_from_object(MonoObject *saddr_obj,
+ int *sa_size)
+{
+ MonoClassField *field;
+ MonoArray *data;
+ gint32 family;
+ int len;
+
+ /* Dig the SocketAddress data buffer out of the object */
+ field=mono_class_get_field_from_name(saddr_obj->vtable->klass, "data");
+ data=*(MonoArray **)(((char *)saddr_obj) + field->offset);
+
+ /* The data buffer is laid out as follows:
+ * byte 0 is the address family
+ * byte 1 is the buffer length
+ * bytes 2 and 3 are the port info
+ * the rest is the address info
+ */
+ len=mono_array_get(data, guint8, 1);
+ if((len<2) || (mono_array_length(data)!=len)) {
+ mono_raise_exception((MonoException *)mono_exception_from_name(mono_defaults.corlib, "System", "SystemException"));
+ }
+
+ family=convert_family(mono_array_get(data, guint8, 0));
+ if(family==AF_INET) {
+ struct sockaddr_in *sa=g_new0(struct sockaddr_in, 1);
+ guint16 port=(mono_array_get(data, guint8, 2) << 8) +
+ mono_array_get(data, guint8, 3);
+ guint32 address=(mono_array_get(data, guint8, 4) << 24) +
+ (mono_array_get(data, guint8, 5) << 16 ) +
+ (mono_array_get(data, guint8, 6) << 8) +
+ mono_array_get(data, guint8, 7);
+
+ sa->sin_family=family;
+ sa->sin_addr.s_addr=htonl(address);
+ sa->sin_port=htons(port);
+
+ *sa_size=sizeof(struct sockaddr_in);
+ return((struct sockaddr *)sa);
+ } else {
+ mono_raise_exception(get_socket_exception(WSAEAFNOSUPPORT));
+ return(0);
+ }
+}
+
+extern void ves_icall_System_Net_Sockets_Socket_Bind_internal(SOCKET sock, MonoObject *sockaddr)
+{
+ struct sockaddr *sa;
+ int sa_size;
+ int ret;
+
+ sa=create_sockaddr_from_object(sockaddr, &sa_size);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": binding to %s port %d", inet_ntoa(sa.sin_addr), port);
+#endif
+
+ ret=bind(sock, sa, sa_size);
+ g_free(sa);
+
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+}
+
+extern void ves_icall_System_Net_Sockets_Socket_Connect_internal(SOCKET sock, MonoObject *sockaddr)
+{
+ struct sockaddr *sa;
+ int sa_size;
+ int ret;
+
+ sa=create_sockaddr_from_object(sockaddr, &sa_size);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": connecting to %s port %d", inet_ntoa(sa.sin_addr), port);
+#endif
+
+ ret=connect(sock, sa, sa_size);
+ g_free(sa);
+
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+}
+
+gint32 ves_icall_System_Net_Sockets_Socket_Receive_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags)
+{
+ int ret;
+ guchar *buf;
+ gint32 alen;
+ int recvflags=0;
+
+ alen=mono_array_length(buffer);
+ if(offset+count>alen) {
+ return(0);
+ }
+
+ buf=mono_array_addr(buffer, guchar, offset);
+
+ ret=recv(sock, buf, count, recvflags);
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+
+ return(ret);
+}
+
+gint32 ves_icall_System_Net_Sockets_Socket_RecvFrom_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr)
+{
+ int ret;
+ guchar *buf;
+ gint32 alen;
+ int recvflags=0;
+ struct sockaddr *sa;
+ int sa_size;
+
+ alen=mono_array_length(buffer);
+ if(offset+count>alen) {
+ return(0);
+ }
+
+ sa=create_sockaddr_from_object(*sockaddr, &sa_size);
+
+ buf=mono_array_addr(buffer, guchar, offset);
+
+ ret=recvfrom(sock, buf, count, recvflags, sa, &sa_size);
+ g_free(sa);
+
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+
+ *sockaddr=create_object_from_sockaddr(sa, sa_size);
+
+ return(ret);
+}
+
+gint32 ves_icall_System_Net_Sockets_Socket_Send_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags)
+{
+ int ret;
+ guchar *buf;
+ gint32 alen;
+ int sendflags=0;
+
+ alen=mono_array_length(buffer);
+ if(offset+count>alen) {
+ return(0);
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": alen: %d", alen);
+#endif
+
+ buf=mono_array_addr(buffer, guchar, offset);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Sending %d bytes", count);
+#endif
+
+ ret=send(sock, buf, count, sendflags);
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+
+ return(ret);
+}
+
+gint32 ves_icall_System_Net_Sockets_Socket_SendTo_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr)
+{
+ int ret;
+ guchar *buf;
+ gint32 alen;
+ int sendflags=0;
+ struct sockaddr *sa;
+ int sa_size;
+
+ alen=mono_array_length(buffer);
+ if(offset+count>alen) {
+ return(0);
+ }
+
+ sa=create_sockaddr_from_object(sockaddr, &sa_size);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": alen: %d", alen);
+#endif
+
+ buf=mono_array_addr(buffer, guchar, offset);
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Sending %d bytes", count);
+#endif
+
+ ret=sendto(sock, buf, count, sendflags, sa, sa_size);
+ g_free(sa);
+
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+
+ return(ret);
+}
+
+static SOCKET Socket_to_SOCKET(MonoObject *sockobj)
+{
+ SOCKET sock;
+ MonoClassField *field;
+
+ field=mono_class_get_field_from_name(sockobj->vtable->klass, "socket");
+ sock=*(SOCKET *)(((char *)sockobj)+field->offset);
+
+ return(sock);
+}
+
+void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks, MonoArray **write_socks, MonoArray **err_socks, gint32 timeout)
+{
+ fd_set readfds, writefds, errfds;
+ struct timeval tv;
+ div_t divvy;
+ int ret;
+ int readarrsize, writearrsize, errarrsize;
+ MonoDomain *domain=mono_domain_get();
+ MonoClass *sock_arr_class;
+ MonoArray *socks;
+ int count;
+ int i;
+
+ readarrsize=mono_array_length(*read_socks);
+ if(readarrsize>FD_SETSIZE) {
+ mono_raise_exception(get_socket_exception(WSAEFAULT));
+ return;
+ }
+
+ FD_ZERO(&readfds);
+ for(i=0; i<readarrsize; i++) {
+ FD_SET(Socket_to_SOCKET(mono_array_get(*read_socks, MonoObject *, i)), &readfds);
+ }
+
+ writearrsize=mono_array_length(*write_socks);
+ if(writearrsize>FD_SETSIZE) {
+ mono_raise_exception(get_socket_exception(WSAEFAULT));
+ return;
+ }
+
+ FD_ZERO(&writefds);
+ for(i=0; i<writearrsize; i++) {
+ FD_SET(Socket_to_SOCKET(mono_array_get(*write_socks, MonoObject *, i)), &writefds);
+ }
+
+ errarrsize=mono_array_length(*err_socks);
+ if(errarrsize>FD_SETSIZE) {
+ mono_raise_exception(get_socket_exception(WSAEFAULT));
+ return;
+ }
+
+ FD_ZERO(&errfds);
+ for(i=0; i<errarrsize; i++) {
+ FD_SET(Socket_to_SOCKET(mono_array_get(*err_socks, MonoObject *, i)), &errfds);
+ }
+
+ /* Negative timeout meaning block until ready is only
+ * specified in Poll, not Select
+ */
+ if(timeout>=0) {
+ divvy=div(timeout, 1000000);
+ tv.tv_sec=divvy.quot;
+ tv.tv_usec=divvy.rem*1000000;
+
+ ret=select(0, &readfds, &writefds, &errfds, &tv);
+ } else {
+ ret=select(0, &readfds, &writefds, &errfds, NULL);
+ }
+
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ return;
+ }
+
+ sock_arr_class=((MonoObject *)*read_socks)->vtable->klass;
+
+ count=0;
+ for(i=0; i<readarrsize; i++) {
+ if(FD_ISSET(Socket_to_SOCKET(mono_array_get(*read_socks, MonoObject *, i)), &readfds)) {
+ count++;
+ }
+ }
+ socks=mono_array_new_full(domain, sock_arr_class, &count, NULL);
+ count=0;
+ for(i=0; i<readarrsize; i++) {
+ MonoObject *sock=mono_array_get(*read_socks, MonoObject *, i);
+
+ if(FD_ISSET(Socket_to_SOCKET(sock), &readfds)) {
+ mono_array_set(socks, MonoObject *, count, sock);
+ count++;
+ }
+ }
+ *read_socks=socks;
+
+ count=0;
+ for(i=0; i<writearrsize; i++) {
+ if(FD_ISSET(Socket_to_SOCKET(mono_array_get(*write_socks, MonoObject *, i)), &writefds)) {
+ count++;
+ }
+ }
+ socks=mono_array_new_full(domain, sock_arr_class, &count, NULL);
+ count=0;
+ for(i=0; i<writearrsize; i++) {
+ MonoObject *sock=mono_array_get(*write_socks, MonoObject *, i);
+
+ if(FD_ISSET(Socket_to_SOCKET(sock), &writefds)) {
+ mono_array_set(socks, MonoObject *, count, sock);
+ count++;
+ }
+ }
+ *write_socks=socks;
+
+ count=0;
+ for(i=0; i<errarrsize; i++) {
+ if(FD_ISSET(Socket_to_SOCKET(mono_array_get(*err_socks, MonoObject *, i)), &errfds)) {
+ count++;
+ }
+ }
+ socks=mono_array_new_full(domain, sock_arr_class, &count, NULL);
+ count=0;
+ for(i=0; i<errarrsize; i++) {
+ MonoObject *sock=mono_array_get(*err_socks, MonoObject *, i);
+
+ if(FD_ISSET(Socket_to_SOCKET(sock), &errfds)) {
+ mono_array_set(socks, MonoObject *, count, sock);
+ count++;
+ }
+ }
+ *err_socks=socks;
+}
+
+void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET sock, gint32 level, gint32 name, MonoObject **obj_val)
+{
+ int system_level;
+ int system_name;
+ int ret;
+ int val;
+ int valsize=sizeof(val);
+ struct linger linger;
+ int lingersize=sizeof(linger);
+ MonoDomain *domain=mono_domain_get();
+ MonoObject *obj;
+ MonoClass *obj_class;
+ MonoClassField *field;
+
+ ret=convert_sockopt_level_and_name(level, name, &system_level,
+ &system_name);
+ if(ret==-1) {
+ mono_raise_exception(get_socket_exception(WSAENOPROTOOPT));
+ return;
+ }
+
+ /* No need to deal with MulticastOption names here, because
+ * you cant getsockopt AddMembership or DropMembership (the
+ * int getsockopt will error, causing an exception)
+ */
+ switch(name) {
+ case SocketOptionName_Linger:
+ case SocketOptionName_DontLinger:
+ ret=getsockopt(sock, system_level, system_name, &linger,
+ &lingersize);
+ break;
+
+ default:
+ ret=getsockopt(sock, system_level, system_name, &val,
+ &valsize);
+ }
+
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ return;
+ }
+
+ switch(name) {
+ case SocketOptionName_Linger:
+ /* build a System.Net.Sockets.LingerOption */
+ obj_class=mono_class_from_name(system_assembly,
+ "System.Net.Sockets",
+ "LingerOption");
+ obj=mono_object_new(domain, obj_class);
+
+ /* Locate and set the fields "bool enabled" and "int
+ * seconds"
+ */
+ field=mono_class_get_field_from_name(obj_class, "enabled");
+ *(guint8 *)(((char *)obj)+field->offset)=linger.l_onoff;
+
+ field=mono_class_get_field_from_name(obj_class, "seconds");
+ *(guint32 *)(((char *)obj)+field->offset)=linger.l_linger;
+
+ break;
+
+ case SocketOptionName_DontLinger:
+ /* construct a bool int in val - true if linger is off */
+ val=!linger.l_onoff;
+
+ /* fall through */
+
+ default:
+ /* construct an Int32 object to hold val */
+ obj=mono_object_new(domain, mono_defaults.int32_class);
+
+ /* Locate and set the "value" field */
+ field=mono_class_get_field_from_name(mono_defaults.int32_class,
+ "value");
+ *(gint32 *)(((char *)obj)+field->offset)=val;
+ }
+
+ *obj_val=obj;
+}
+
+void ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal(SOCKET sock, gint32 level, gint32 name, MonoArray **byte_val)
+{
+ int system_level;
+ int system_name;
+ int ret;
+ guchar *buf;
+ int valsize;
+
+ ret=convert_sockopt_level_and_name(level, name, &system_level,
+ &system_name);
+ if(ret==-1) {
+ mono_raise_exception(get_socket_exception(WSAENOPROTOOPT));
+ return;
+ }
+
+ valsize=mono_array_length(*byte_val);
+ buf=mono_array_addr(*byte_val, guchar, 0);
+
+ ret=getsockopt(sock, system_level, system_name, buf, &valsize);
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+}
+
+static struct in_addr ipaddress_to_struct_in_addr(MonoObject *ipaddr)
+{
+ struct in_addr inaddr;
+ guint64 addr;
+ MonoClassField *field;
+
+ field=mono_class_get_field_from_name(ipaddr->vtable->klass, "address");
+ addr=*(guint64 *)(((char *)ipaddr)+field->offset);
+
+ /* No idea why .net uses a 64bit type to hold a 32bit value */
+ inaddr.s_addr=htonl((guint32)addr);
+
+ return(inaddr);
+}
+
+void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, gint32 level, gint32 name, MonoObject *obj_val, MonoArray *byte_val, gint32 int_val)
+{
+ int system_level;
+ int system_name;
+ int ret;
+
+ ret=convert_sockopt_level_and_name(level, name, &system_level,
+ &system_name);
+ if(ret==-1) {
+ mono_raise_exception(get_socket_exception(WSAENOPROTOOPT));
+ return;
+ }
+
+ /* Only one of obj_val, byte_val or int_val has data */
+ if(obj_val!=NULL) {
+ MonoClassField *field;
+ struct linger linger;
+ int valsize;
+
+ switch(name) {
+ case SocketOptionName_DontLinger:
+ linger.l_onoff=0;
+ linger.l_linger=0;
+ valsize=sizeof(linger);
+ ret=setsockopt(sock, system_level, system_name,
+ &linger, valsize);
+ break;
+
+ case SocketOptionName_Linger:
+ /* Dig out "bool enabled" and "int seconds"
+ * fields
+ */
+ field=mono_class_get_field_from_name(obj_val->vtable->klass, "enabled");
+ linger.l_onoff=*(guint8 *)(((char *)obj_val)+field->offset);
+ field=mono_class_get_field_from_name(obj_val->vtable->klass, "seconds");
+ linger.l_linger=*(guint32 *)(((char *)obj_val)+field->offset);
+
+ valsize=sizeof(linger);
+ ret=setsockopt(sock, system_level, system_name,
+ &linger, valsize);
+ break;
+ case SocketOptionName_AddMembership:
+ case SocketOptionName_DropMembership:
+ {
+#ifdef HAVE_STRUCT_IP_MREQN
+ struct ip_mreqn mreq;
+#else
+ struct ip_mreq mreq;
+#endif /* HAVE_STRUCT_IP_MREQN */
+
+ /* pain! MulticastOption holds two IPAddress
+ * members, so I have to dig the value out of
+ * those :-(
+ */
+ field = mono_class_get_field_from_name (obj_val->vtable->klass, "group");
+ mreq.imr_multiaddr = ipaddress_to_struct_in_addr (*(gpointer *)(((char *)obj_val) +
+ field->offset));
+ field = mono_class_get_field_from_name (obj_val->vtable->klass, "local");
+#ifdef HAVE_STRUCT_IP_MREQN
+ mreq.imr_address = ipaddress_to_struct_in_addr (*(gpointer *)(((char *)obj_val) +
+ field->offset));
+#else
+ mreq.imr_interface = ipaddress_to_struct_in_addr (*(gpointer *)(((char *)obj_val) +
+ field->offset));
+#endif /* HAVE_STRUCT_IP_MREQN */
+
+ ret = setsockopt (sock, system_level, system_name,
+ &mreq, sizeof (mreq));
+ break;
+ }
+ default:
+ /* Throw an exception */
+ mono_raise_exception(get_socket_exception(WSAEINVAL));
+ }
+ } else if (byte_val!=NULL) {
+ 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);
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+ } else {
+ ret=setsockopt(sock, system_level, system_name, &int_val,
+ sizeof(int_val));
+ }
+
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+}
+
+void ves_icall_System_Net_Sockets_Socket_Shutdown_internal(SOCKET sock,
+ gint32 how)
+{
+ int ret;
+
+ /* Currently, the values for how (recv=0, send=1, both=2) match
+ * the BSD API
+ */
+ ret=shutdown(sock, how);
+ if(ret==SOCKET_ERROR) {
+ mono_raise_exception(get_socket_exception(WSAGetLastError()));
+ }
+}
+
+static gboolean hostent_to_IPHostEntry(struct hostent *he, MonoString **h_name,
+ MonoArray **h_aliases,
+ MonoArray **h_addr_list)
+{
+ MonoDomain *domain = mono_domain_get ();
+ int i;
+
+ if(he->h_length!=4 || he->h_addrtype!=AF_INET) {
+ return(FALSE);
+ }
+
+ *h_name=mono_string_new(domain, he->h_name);
+
+ i=0;
+ while(he->h_aliases[i]!=NULL) {
+ i++;
+ }
+
+ *h_aliases=mono_array_new(domain, mono_defaults.string_class, i);
+ i=0;
+ while(he->h_aliases[i]!=NULL) {
+ MonoString *alias;
+
+ alias=mono_string_new(domain, he->h_aliases[i]);
+ mono_array_set(*h_aliases, MonoString *, i, alias);
+ i++;
+ }
+
+ i=0;
+ while(he->h_addr_list[i]!=NULL) {
+ i++;
+ }
+
+ *h_addr_list=mono_array_new(domain, mono_defaults.string_class, i);
+ i=0;
+ while(he->h_addr_list[i]!=NULL) {
+ MonoString *addr_string;
+ char addr[16];
+
+ g_snprintf(addr, 16, "%u.%u.%u.%u",
+ (unsigned char)he->h_addr_list[i][0],
+ (unsigned char)he->h_addr_list[i][1],
+ (unsigned char)he->h_addr_list[i][2],
+ (unsigned char)he->h_addr_list[i][3]);
+
+ addr_string=mono_string_new(domain, addr);
+ mono_array_set(*h_addr_list, MonoString *, i, addr_string);
+ i++;
+ }
+
+ return(TRUE);
+}
+
+extern gboolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list)
+{
+ char *hostname;
+ struct hostent *he;
+
+ hostname=mono_string_to_utf8(host);
+ he=gethostbyname(hostname);
+ g_free(hostname);
+
+ if(he==NULL) {
+ return(FALSE);
+ }
+
+ return(hostent_to_IPHostEntry(he, h_name, h_aliases, h_addr_list));
+}
+
+#ifndef HAVE_INET_PTON
+static int
+inet_pton (int family, const char *address, void *inaddrp)
+{
+ if (family == AF_INET) {
+#ifdef HAVE_INET_ATON
+ struct in_addr inaddr;
+
+ if (!inet_aton (address, &inaddr))
+ return 0;
+
+ memcpy (inaddrp, &inaddr, sizeof (struct in_addr));
+ return 1;
+#else
+ /* assume the system has inet_addr(), if it doesn't
+ have that we're pretty much screwed... */
+ guint32 inaddr;
+
+ if (!strcmp (address, "255.255.255.255")) {
+ /* special-case hack */
+ inaddr = 0xffffffff;
+ } else {
+ inaddr = inet_addr (address);
+#ifndef INADDR_NONE
+#define INADDR_NONE ((in_addr_t) -1)
+#endif
+ if (inaddr == INADDR_NONE)
+ return 0;
+ }
+
+ memcpy (inaddrp, &inaddr, sizeof (guint32));
+ return 1;
+#endif /* HAVE_INET_ATON */
+ }
+
+ return -1;
+}
+#endif /* !HAVE_INET_PTON */
+
+extern gboolean ves_icall_System_Net_Dns_GetHostByAddr_internal(MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list)
+{
+ struct in_addr inaddr;
+ struct hostent *he;
+ char *address;
+
+ address = mono_string_to_utf8 (addr);
+ if (inet_pton (AF_INET, address, &inaddr) <= 0) {
+ g_free (address);
+ return FALSE;
+ }
+
+ g_free (address);
+ if ((he = gethostbyaddr ((char *) &inaddr, sizeof (inaddr), AF_INET)) == NULL)
+ return FALSE;
+
+ return(hostent_to_IPHostEntry(he, h_name, h_aliases, h_addr_list));
+}
+
+void mono_network_init(void)
+{
+ WSADATA wsadata;
+ int err;
+
+ err=WSAStartup(MAKEWORD(2,0), &wsadata);
+ if(err!=0) {
+ g_error(G_GNUC_PRETTY_FUNCTION ": Couldn't initialise networking");
+ exit(-1);
+ }
+
+#ifdef DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Using socket library: %s", wsadata.szDescription);
+ g_message(G_GNUC_PRETTY_FUNCTION ": Socket system status: %s", wsadata.szSystemStatus);
+#endif
+}
+
+void mono_network_cleanup(void)
+{
+ WSACleanup();
+}
diff --git a/mono/metadata/socket-io.h b/mono/metadata/socket-io.h
new file mode 100644
index 00000000000..e256127db80
--- /dev/null
+++ b/mono/metadata/socket-io.h
@@ -0,0 +1,160 @@
+/*
+ * socket-io.h: Socket IO internal calls
+ *
+ * Author:
+ * Dick Porter (dick@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#ifndef _MONO_METADATA_SOCKET_H_
+#define _MONO_METADATA_SOCKET_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/metadata/object.h>
+#include <mono/io-layer/io-layer.h>
+
+/* This is a copy of System.Net.Sockets.SocketType */
+typedef enum {
+ SocketType_Stream=1,
+ SocketType_Dgram=2,
+ SocketType_Raw=3,
+ SocketType_Rdm=4,
+ SocketType_Seqpacket=5,
+ SocketType_Unknown=-1,
+} MonoSocketType;
+
+/* This is a copy of System.Net.Sockets.AddressFamily */
+typedef enum {
+ AddressFamily_Unknown=-1,
+ AddressFamily_Unspecified=0,
+ AddressFamily_Unix=1,
+ AddressFamily_InterNetwork=2,
+ AddressFamily_ImpLink=3,
+ AddressFamily_Pup=4,
+ AddressFamily_Chaos=5,
+ AddressFamily_NS=6,
+ AddressFamily_Ipx=6,
+ AddressFamily_Iso=7,
+ AddressFamily_Osi=7,
+ AddressFamily_Ecma=8,
+ AddressFamily_DataKit=9,
+ AddressFamily_Ccitt=10,
+ AddressFamily_Sna=11,
+ AddressFamily_DecNet=12,
+ AddressFamily_DataLink=13,
+ AddressFamily_Lat=14,
+ AddressFamily_HyperChannel=15,
+ AddressFamily_AppleTalk=16,
+ AddressFamily_NetBios=17,
+ AddressFamily_VoiceView=18,
+ AddressFamily_FireFox=19,
+ AddressFamily_Banyan=21,
+ AddressFamily_Atm=22,
+ AddressFamily_InterNetworkV6=23,
+ AddressFamily_Cluster=24,
+ AddressFamily_Ieee12844=25,
+ AddressFamily_Irda=26,
+ AddressFamily_NetworkDesigners=28,
+} MonoAddressFamily;
+
+/* This is a copy of System.Net.Sockets.ProtocolType */
+typedef enum {
+ ProtocolType_IP=0,
+ ProtocolType_Icmp=1,
+ ProtocolType_Igmp=2,
+ ProtocolType_Ggp=3,
+ ProtocolType_Tcp=6,
+ ProtocolType_Pup=12,
+ ProtocolType_Udp=17,
+ ProtocolType_Idp=22,
+ ProtocolType_ND=77,
+ ProtocolType_Raw=255,
+ ProtocolType_Unspecified=0,
+ ProtocolType_Ipx=1000,
+ ProtocolType_Spx=1256,
+ ProtocolType_SpxII=1257,
+ ProtocolType_Unknown=-1,
+} MonoProtocolType;
+
+/* This is a copy of System.Net.Sockets.SocketOptionLevel */
+typedef enum {
+ SocketOptionLevel_Socket=65535,
+ SocketOptionLevel_IP=0,
+ SocketOptionLevel_Tcp=6,
+ SocketOptionLevel_Udp=17,
+} MonoSocketOptionLevel;
+
+/* This is a copy of System.Net.Sockets.SocketOptionName */
+typedef enum {
+ SocketOptionName_Debug=1,
+ SocketOptionName_AcceptConnection=2,
+ SocketOptionName_ReuseAddress=4,
+ SocketOptionName_KeepAlive=8,
+ SocketOptionName_DontRoute=16,
+ SocketOptionName_Broadcast=32,
+ SocketOptionName_UseLoopback=64,
+ SocketOptionName_Linger=128,
+ SocketOptionName_OutOfBandInline=256,
+ SocketOptionName_DontLinger= -129,
+ SocketOptionName_ExclusiveAddressUse= -5,
+ SocketOptionName_SendBuffer= 4097,
+ SocketOptionName_ReceiveBuffer=4098,
+ SocketOptionName_SendLowWater=4099,
+ SocketOptionName_ReceiveLowWater=4100,
+ SocketOptionName_SendTimeout=4101,
+ SocketOptionName_ReceiveTimeout=4102,
+ SocketOptionName_Error=4103,
+ SocketOptionName_Type=4104,
+ SocketOptionName_MaxConnections=2147483647,
+ SocketOptionName_IPOptions=1,
+ SocketOptionName_HeaderIncluded=2,
+ SocketOptionName_TypeOfService=3,
+ SocketOptionName_IpTimeToLive=4,
+ SocketOptionName_MulticastInterface=9,
+ SocketOptionName_MulticastTimeToLive=10,
+ SocketOptionName_MulticastLoopback=11,
+ SocketOptionName_AddMembership=12,
+ SocketOptionName_DropMembership=13,
+ SocketOptionName_DontFragment=14,
+ SocketOptionName_AddSourceMembership=15,
+ SocketOptionName_DropSourceMembership=16,
+ SocketOptionName_BlockSource=17,
+ SocketOptionName_UnblockSource=18,
+ SocketOptionName_PacketInformation=19,
+ SocketOptionName_NoDelay=1,
+ SocketOptionName_BsdUrgent=2,
+ SocketOptionName_Expedited=2,
+ SocketOptionName_NoChecksum=1,
+ SocketOptionName_ChecksumCoverage=20,
+} MonoSocketOptionName;
+
+extern SOCKET ves_icall_System_Net_Sockets_Socket_Socket_internal(MonoObject *this, gint32 family, gint32 type, gint32 proto);
+extern void ves_icall_System_Net_Sockets_Socket_Close_internal(SOCKET sock);
+extern gint32 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal(void);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Available_internal(SOCKET sock);
+extern void ves_icall_System_Net_Sockets_Socket_Blocking_internal(SOCKET sock, gboolean block);
+extern SOCKET ves_icall_System_Net_Sockets_Socket_Accept_internal(SOCKET sock);
+extern void ves_icall_System_Net_Sockets_Socket_Listen_internal(SOCKET sock, guint32 backlog);
+extern MonoObject *ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal(SOCKET sock);
+extern MonoObject *ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal(SOCKET sock);
+extern void ves_icall_System_Net_Sockets_Socket_Bind_internal(SOCKET sock, MonoObject *sockaddr);
+extern void ves_icall_System_Net_Sockets_Socket_Connect_internal(SOCKET sock, MonoObject *sockaddr);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Receive_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags);
+extern gint32 ves_icall_System_Net_Sockets_Socket_RecvFrom_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Send_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags);
+extern gint32 ves_icall_System_Net_Sockets_Socket_SendTo_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr);
+extern void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **read_socks, MonoArray **write_socks, MonoArray **err_socks, gint32 timeout);
+extern void ves_icall_System_Net_Sockets_Socket_Shutdown_internal(SOCKET sock, gint32 how);
+extern void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET sock, gint32 level, gint32 name, MonoObject **obj_val);
+extern void ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal(SOCKET sock, gint32 level, gint32 name, MonoArray **byte_val);
+extern void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, gint32 level, gint32 name, MonoObject *obj_val, MonoArray *byte_val, gint32 int_val);
+extern gboolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list);
+extern gboolean ves_icall_System_Net_Dns_GetHostByAddr_internal(MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list);
+
+extern void mono_network_init(void);
+extern void mono_network_cleanup(void);
+
+#endif /* _MONO_METADATA_SOCKET_H_ */
diff --git a/mono/metadata/string-icalls.c b/mono/metadata/string-icalls.c
new file mode 100644
index 00000000000..cb078aa951a
--- /dev/null
+++ b/mono/metadata/string-icalls.c
@@ -0,0 +1,813 @@
+/*
+ * string-icalls.c: String internal calls for the corlib
+ *
+ * Author:
+ * Patrik Torstensson (patrik.torstensson@labs2.com)
+ * Duncan Mak (duncan@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <signal.h>
+#include <string.h>
+#include <mono/metadata/string-icalls.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/loader.h>
+#include <mono/metadata/object.h>
+#include <mono/metadata/unicode.h>
+#include <mono/metadata/exception.h>
+
+MonoString *
+ves_icall_System_String_ctor_charp (gpointer dummy, gunichar2 *value)
+{
+ gint32 i, length;
+ MonoDomain *domain;
+
+ domain = mono_domain_get ();
+
+ if (value == NULL)
+ length = 0;
+ else {
+ for (i = 0; *(value + i) != '\0'; i++);
+ length = i;
+ }
+
+ return mono_string_new_utf16 (domain, value, length);
+}
+
+MonoString *
+ves_icall_System_String_ctor_char_int (gpointer dummy, gunichar2 value, gint32 count)
+{
+ MonoDomain *domain;
+ MonoString *res;
+ gunichar2 *chars;
+ gint32 i;
+
+ domain = mono_domain_get ();
+ res = mono_string_new_size (domain, count);
+
+ chars = mono_string_chars (res);
+ for (i = 0; i < count; i++)
+ chars [i] = value;
+
+ return res;
+}
+
+MonoString *
+ves_icall_System_String_ctor_charp_int_int (gpointer dummy, gunichar2 *value, gint32 sindex, gint32 length)
+{
+ gunichar2 *begin;
+ MonoDomain * domain;
+
+ domain = mono_domain_get ();
+
+ if ((value == NULL) && (length != 0))
+ mono_raise_exception (mono_get_exception_argument_out_of_range ("Out of range"));
+
+ if ((sindex < 0) || (length < 0))
+ mono_raise_exception (mono_get_exception_argument_out_of_range ("Out of range"));
+
+ if (length == 0) { /* fixme: return String.Empty here */
+ g_warning ("string doesn't yet support empy strings in char* constructor");
+ g_assert_not_reached ();
+ }
+
+ begin = (gunichar2 *) (value + sindex);
+
+ return mono_string_new_utf16 (domain, begin, length);
+}
+
+MonoString *
+ves_icall_System_String_ctor_sbytep (gpointer dummy, gint8 *value)
+{
+ MonoDomain *domain;
+
+ domain = mono_domain_get ();
+
+ if (NULL == value) { /* fixme: return String.Empty here */
+ g_warning ("string doesn't yet support empy strings in char* constructor");
+ g_assert_not_reached ();
+ }
+
+ return mono_string_new (domain, (const char *) value);
+}
+
+MonoString *
+ves_icall_System_String_ctor_sbytep_int_int (gpointer dummy, gint8 *value, gint32 sindex, gint32 length)
+{
+ char *begin;
+ MonoDomain *domain;
+
+ domain = mono_domain_get ();
+
+ if ((value == NULL) && (length != 0))
+ mono_raise_exception (mono_get_exception_argument_out_of_range ("Out of range"));
+
+ if ((sindex < 0) || (length < 0))
+ mono_raise_exception (mono_get_exception_argument_out_of_range ("Out of range"));
+
+ begin = (char *) (value + sindex);
+
+ return mono_string_new_len (domain, begin, length);
+}
+
+MonoString *
+ves_icall_System_String_ctor_chara (gpointer dummy, MonoArray *value)
+{
+ MonoDomain *domain;
+
+ MONO_CHECK_ARG_NULL (value);
+
+ domain = mono_domain_get ();
+
+ return mono_string_new_utf16 (domain, (gunichar2 *) mono_array_addr(value, gunichar2, 0), value->max_length);
+}
+
+MonoString *
+ves_icall_System_String_ctor_chara_int_int (gpointer dummy, MonoArray *value,
+ gint32 sindex, gint32 length)
+{
+ MonoDomain *domain;
+
+ MONO_CHECK_ARG_NULL (value);
+
+ domain = mono_domain_get ();
+
+ return mono_string_new_utf16 (domain, (gunichar2 *) mono_array_addr(value, gunichar2, sindex), length);
+}
+
+MonoString *
+ves_icall_System_String_ctor_encoding (gpointer dummy, gint8 *value, gint32 sindex,
+ gint32 length, MonoObject *enc)
+{
+ g_warning("string.ctor with encoding obj unimplemented");
+ g_assert_not_reached ();
+ return NULL;
+}
+
+MonoBoolean
+ves_icall_System_String_InternalEquals (MonoString *str1, MonoString *str2)
+{
+ gunichar2 *str1ptr;
+ gunichar2 *str2ptr;
+ gint32 str1len;
+
+ /* Length checking is done in C# */
+ str1len = mono_string_length(str1);
+
+ str1ptr = mono_string_chars(str1);
+ str2ptr = mono_string_chars(str2);
+
+ return (0 == memcmp(str1ptr, str2ptr, str1len * sizeof(gunichar2)));
+}
+
+MonoString *
+ves_icall_System_String_InternalJoin (MonoString *separator, MonoArray * value, gint32 sindex, gint32 count)
+{
+ MonoString * ret;
+ gint32 length;
+ gint32 pos;
+ gint32 insertlen;
+ gint32 destpos;
+ gint32 srclen;
+ gunichar2 *insert;
+ gunichar2 *dest;
+ gunichar2 *src;
+
+ insert = mono_string_chars(separator);
+ insertlen = mono_string_length(separator);
+
+ length = 0;
+ for (pos = sindex; pos != sindex + count; pos++) {
+ length += mono_string_length(mono_array_get(value, MonoString *, pos));
+ if (pos < sindex + count - 1)
+ length += insertlen;
+ }
+
+ ret = mono_string_new_size( mono_domain_get (), length);
+ dest = mono_string_chars(ret);
+ destpos = 0;
+
+ for (pos = sindex; pos != sindex + count; pos++) {
+ src = mono_string_chars(mono_array_get(value, MonoString *, pos));
+ srclen = mono_string_length(mono_array_get(value, MonoString *, pos));
+
+ memcpy(dest + destpos, src, srclen * sizeof(gunichar2));
+ destpos += srclen;
+
+ if (pos < sindex + count - 1) {
+ memcpy(dest + destpos, insert, insertlen * sizeof(gunichar2));
+ destpos += insertlen;
+ }
+ }
+
+ return ret;
+}
+
+MonoString *
+ves_icall_System_String_InternalInsert (MonoString *me, gint32 sindex, MonoString *value)
+{
+ MonoString * ret;
+ gunichar2 *src;
+ gunichar2 *insertsrc;
+ gunichar2 *dest;
+ gint32 srclen;
+ gint32 insertlen;
+
+ src = mono_string_chars(me);
+ srclen = mono_string_length(me);
+
+ insertsrc = mono_string_chars(value);
+ insertlen = mono_string_length(value);
+
+ ret = mono_string_new_size( mono_domain_get (), srclen + insertlen);
+ dest = mono_string_chars(ret);
+
+ memcpy(dest, src, sindex * sizeof(gunichar2));
+ memcpy(dest + sindex, insertsrc, insertlen * sizeof(gunichar2));
+ memcpy(dest + sindex + insertlen, src + sindex, (srclen - sindex) * sizeof(gunichar2));
+
+ return ret;
+}
+
+MonoString *
+ves_icall_System_String_InternalReplace_Char (MonoString *me, gunichar2 oldChar, gunichar2 newChar)
+{
+ MonoString *ret;
+ gunichar2 *src;
+ gunichar2 *dest;
+ gint32 i, srclen;
+
+ src = mono_string_chars(me);
+ srclen = mono_string_length(me);
+
+ ret = mono_string_new_size( mono_domain_get (), srclen);
+ dest = mono_string_chars(ret);
+
+ for (i = 0; i != srclen; i++) {
+ if (src[i] == oldChar)
+ dest[i] = newChar;
+ else
+ dest[i] = src[i];
+ }
+
+ return ret;
+}
+
+MonoString *
+ves_icall_System_String_InternalReplace_Str (MonoString *me, MonoString *oldValue, MonoString *newValue)
+{
+ MonoString *ret;
+ gunichar2 *src;
+ gunichar2 *dest;
+ gunichar2 *oldstr;
+ gunichar2 *newstr;
+ gint32 i, destpos;
+ gint32 occurr;
+ gint32 newsize;
+ gint32 oldstrlen;
+ gint32 newstrlen;
+ gint32 srclen;
+
+ occurr = 0;
+ destpos = 0;
+
+ oldstr = mono_string_chars(oldValue);
+ oldstrlen = mono_string_length(oldValue);
+
+ if (NULL != newValue) {
+ newstr = mono_string_chars(newValue);
+ newstrlen = mono_string_length(newValue);
+ } else
+ newstrlen = 0;
+
+ src = mono_string_chars(me);
+ srclen = mono_string_length(me);
+
+ if (oldstrlen != newstrlen) {
+ for (i = 0; i != srclen - oldstrlen + 1; i++)
+ if (0 == memcmp(src + i, oldstr, oldstrlen * sizeof(gunichar2)))
+ occurr++;
+
+ newsize = srclen + ((newstrlen - oldstrlen) * occurr);
+ } else
+ newsize = srclen;
+
+ ret = mono_string_new_size( mono_domain_get (), newsize);
+ dest = mono_string_chars(ret);
+
+ i = 0;
+ while (i < srclen) {
+ if (0 == memcmp(src + i, oldstr, oldstrlen * sizeof(gunichar2))) {
+ if (newstrlen > 0) {
+ memcpy(dest + destpos, newstr, newstrlen * sizeof(gunichar2));
+ destpos += newstrlen;
+ }
+ i += oldstrlen;
+ } else {
+ dest[destpos] = src[i];
+ destpos++;
+ i++;
+ }
+ }
+
+ return ret;
+}
+
+MonoString *
+ves_icall_System_String_InternalRemove (MonoString *me, gint32 sindex, gint32 count)
+{
+ MonoString * ret;
+ gint32 srclen;
+ gunichar2 *dest;
+ gunichar2 *src;
+
+ srclen = mono_string_length(me);
+ ret = mono_string_new_size( mono_domain_get (), srclen - count);
+
+ src = mono_string_chars(me);
+ dest = mono_string_chars(ret);
+
+ memcpy(dest, src, sindex * sizeof(gunichar2));
+ memcpy(dest + sindex, src + sindex + count, (srclen - count - sindex) * sizeof(gunichar2));
+
+ return ret;
+}
+
+void
+ves_icall_System_String_InternalCopyTo (MonoString *me, gint32 sindex, MonoArray *dest, gint32 dindex, gint32 count)
+{
+ gunichar2 *destptr = (gunichar2 *) mono_array_addr(dest, gunichar2, dindex);
+ gunichar2 *src = mono_string_chars(me);
+
+ memcpy(destptr, src + sindex, sizeof(gunichar2) * count);
+}
+
+MonoArray *
+ves_icall_System_String_InternalSplit (MonoString *me, MonoArray *separator, gint32 count)
+{
+ MonoString * tmpstr;
+ MonoArray * retarr;
+ gunichar2 *src;
+ gint32 arrsize, srcsize, splitsize;
+ gint32 i, lastpos, arrpos;
+ gint32 tmpstrsize;
+ gunichar2 *tmpstrptr;
+
+ gunichar2 cmpchar;
+
+ src = mono_string_chars(me);
+ srcsize = mono_string_length(me);
+ arrsize = mono_array_length(separator);
+
+ cmpchar = mono_array_get(separator, gunichar2, 0);
+
+ splitsize = 0;
+ for (i = 0; i != srcsize && splitsize < count; i++) {
+ if (string_icall_is_in_array(separator, arrsize, src[i]))
+ splitsize++;
+ }
+
+ lastpos = 0;
+ arrpos = 0;
+
+ /* if no split chars found return the string */
+ if (splitsize == 0) {
+ retarr = mono_array_new(mono_domain_get(), mono_defaults.string_class, 1);
+ tmpstr = mono_string_new_size( mono_domain_get (), srcsize);
+ tmpstrptr = mono_string_chars(tmpstr);
+
+ memcpy(tmpstrptr, src, srcsize * sizeof(gunichar2));
+ mono_array_set(retarr, MonoString *, 0, tmpstr);
+
+ return retarr;
+ }
+
+ if (splitsize != count)
+ splitsize++;
+
+ retarr = mono_array_new(mono_domain_get(), mono_defaults.string_class, splitsize);
+ for (i = 0; i != srcsize && arrpos != count; i++) {
+ if (string_icall_is_in_array(separator, arrsize, src[i])) {
+ if (arrpos == count - 1)
+ tmpstrsize = srcsize - lastpos;
+ else
+ tmpstrsize = i - lastpos;
+
+ tmpstr = mono_string_new_size( mono_domain_get (), tmpstrsize);
+ tmpstrptr = mono_string_chars(tmpstr);
+
+ memcpy(tmpstrptr, src + lastpos, tmpstrsize * sizeof(gunichar2));
+ mono_array_set(retarr, MonoString *, arrpos, tmpstr);
+ arrpos++;
+ lastpos = i + 1;
+ }
+ }
+
+ if (arrpos < count) {
+ tmpstrsize = srcsize - lastpos;
+ tmpstr = mono_string_new_size( mono_domain_get (), tmpstrsize);
+ tmpstrptr = mono_string_chars(tmpstr);
+
+ memcpy(tmpstrptr, src + lastpos, tmpstrsize * sizeof(gunichar2));
+ mono_array_set(retarr, MonoString *, arrpos, tmpstr);
+ }
+
+ return retarr;
+}
+
+gboolean
+string_icall_is_in_array (MonoArray *chars, gint32 arraylength, gunichar2 chr)
+{
+ gunichar2 cmpchar;
+ gint32 arrpos;
+
+ for (arrpos = 0; arrpos != arraylength; arrpos++) {
+ cmpchar = mono_array_get(chars, gunichar2, arrpos);
+ if (cmpchar == chr)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+MonoString *
+ves_icall_System_String_InternalTrim (MonoString *me, MonoArray *chars, gint32 typ)
+{
+ MonoString * ret;
+ gunichar2 *src, *dest;
+ gint32 srclen, newlen, arrlen;
+ gint32 i, lenfirst, lenlast;
+
+ srclen = mono_string_length(me);
+ src = mono_string_chars(me);
+ arrlen = mono_array_length(chars);
+
+ lenfirst = 0;
+ lenlast = 0;
+
+ if (0 == typ || 1 == typ) {
+ for (i = 0; i != srclen; i++) {
+ if (string_icall_is_in_array(chars, arrlen, src[i]))
+ lenfirst++;
+ else
+ break;
+ }
+ }
+
+ if (0 == typ || 2 == typ) {
+ for (i = srclen - 1; i > lenfirst - 1; i--) {
+ if (string_icall_is_in_array(chars, arrlen, src[i]))
+ lenlast++;
+ else
+ break;
+ }
+ }
+
+ newlen = srclen - lenfirst - lenlast;
+
+ ret = mono_string_new_size( mono_domain_get (), newlen);
+ dest = mono_string_chars(ret);
+
+ memcpy(dest, src + lenfirst, newlen *sizeof(gunichar2));
+
+ return ret;
+}
+
+gint32
+ves_icall_System_String_InternalIndexOf_Char (MonoString *me, gunichar2 value, gint32 sindex, gint32 count)
+{
+ gint32 pos;
+ gunichar2 *src;
+
+ src = mono_string_chars(me);
+ for (pos = sindex; pos != count + sindex; pos++) {
+ if ( src [pos] == value)
+ return pos;
+ }
+
+ return -1;
+}
+
+gint32
+ves_icall_System_String_InternalIndexOf_Str (MonoString *me, MonoString *value, gint32 sindex, gint32 count)
+{
+ gint32 lencmpstr;
+ gint32 pos;
+ gunichar2 *src;
+ gunichar2 *cmpstr;
+
+ lencmpstr = mono_string_length(value);
+
+ src = mono_string_chars(me);
+ cmpstr = mono_string_chars(value);
+
+ for (pos = sindex; pos != count + sindex; pos++) {
+ if (pos + lencmpstr > count + sindex)
+ return -1;
+
+ if (0 == memcmp(src + pos, cmpstr, lencmpstr * sizeof(gunichar2)))
+ return pos;
+ }
+
+ return -1;
+}
+
+gint32
+ves_icall_System_String_InternalIndexOfAny (MonoString *me, MonoArray *arr, gint32 sindex, gint32 count)
+{
+ gint32 pos;
+ gint32 loop;
+ gint32 arraysize;
+ gunichar2 *src;
+
+ arraysize = mono_array_length(arr);
+ src = mono_string_chars(me);
+
+ for (pos = sindex; pos != count + sindex; pos++) {
+ for (loop = 0; loop != arraysize; loop++)
+ if ( src [pos] == mono_array_get(arr, gunichar2, loop) )
+ return pos;
+ }
+
+ return -1;
+}
+
+gint32
+ves_icall_System_String_InternalLastIndexOf_Char (MonoString *me, gunichar2 value, gint32 sindex, gint32 count)
+{
+ gint32 pos;
+ gunichar2 *src;
+
+ src = mono_string_chars(me);
+ for (pos = sindex; pos > sindex - count; pos--) {
+ if (src [pos] == value)
+ return pos;
+ }
+
+ return -1;
+}
+
+gint32
+ves_icall_System_String_InternalLastIndexOf_Str (MonoString *me, MonoString *value, gint32 sindex, gint32 count)
+{
+ gint32 lencmpstr;
+ gint32 pos;
+ gunichar2 *src;
+ gunichar2 *cmpstr;
+
+ lencmpstr = mono_string_length(value);
+
+ src = mono_string_chars(me);
+ cmpstr = mono_string_chars(value);
+
+ for (pos = sindex - lencmpstr + 1; pos > sindex - count; pos--) {
+ if (0 == memcmp(src + pos, cmpstr, lencmpstr * sizeof(gunichar2)))
+ return pos;
+ }
+
+ return -1;
+}
+
+gint32
+ves_icall_System_String_InternalLastIndexOfAny (MonoString *me, MonoArray *anyOf, gint32 sindex, gint32 count)
+{
+ gint32 pos;
+ gint32 loop;
+ gint32 arraysize;
+ gunichar2 *src;
+
+ arraysize = mono_array_length(anyOf);
+ src = mono_string_chars(me);
+
+ for (pos = sindex; pos > sindex - count; pos--) {
+ for (loop = 0; loop != arraysize; loop++)
+ if ( src [pos] == mono_array_get(anyOf, gunichar2, loop) )
+ return pos;
+ }
+
+ return -1;
+}
+
+MonoString *
+ves_icall_System_String_InternalPad (MonoString *me, gint32 width, gunichar2 chr, MonoBoolean right)
+{
+ MonoString * ret;
+ gunichar2 *src;
+ gunichar2 *dest;
+ gint32 fillcount;
+ gint32 srclen;
+ gint32 i;
+
+ srclen = mono_string_length(me);
+ src = mono_string_chars(me);
+
+ ret = mono_string_new_size( mono_domain_get (), width);
+ dest = mono_string_chars(ret);
+ fillcount = width - srclen;
+
+ if (right) {
+ memcpy(dest, src, srclen * sizeof(gunichar2));
+ for (i = srclen; i != width; i++)
+ dest[i] = chr;
+
+ return ret;
+ }
+
+ /* left fill */
+ for (i = 0; i != fillcount; i++)
+ dest[i] = chr;
+
+ memcpy(dest + fillcount, src, srclen * sizeof(gunichar2));
+
+ return ret;
+}
+
+MonoString *
+ves_icall_System_String_InternalToLower (MonoString *me)
+{
+ MonoString * ret;
+ gunichar2 *src;
+ gunichar2 *dest;
+ gint32 i;
+
+ ret = mono_string_new_size(mono_domain_get (), mono_string_length(me));
+
+ src = mono_string_chars (me);
+ dest = mono_string_chars (ret);
+
+ for (i = 0; i < mono_string_length (me); ++i)
+ dest[i] = g_unichar_tolower(src[i]);
+
+ return ret;
+}
+
+MonoString *
+ves_icall_System_String_InternalToUpper (MonoString *me)
+{
+ int i;
+ MonoString * ret;
+ gunichar2 *src;
+ gunichar2 *dest;
+
+ ret = mono_string_new_size(mono_domain_get (), mono_string_length(me));
+
+ src = mono_string_chars (me);
+ dest = mono_string_chars (ret);
+
+ for (i = 0; i < mono_string_length (me); ++i)
+ dest[i] = g_unichar_toupper(src[i]);
+
+ return ret;
+}
+
+MonoString *
+ves_icall_System_String_InternalAllocateStr (gint32 length)
+{
+ return mono_string_new_size(mono_domain_get (), length);
+}
+
+void
+ves_icall_System_String_InternalStrcpy_Str (MonoString *dest, gint32 destPos, MonoString *src)
+{
+ gunichar2 *srcptr;
+ gunichar2 *destptr;
+
+ srcptr = mono_string_chars (src);
+ destptr = mono_string_chars (dest);
+
+ memcpy(destptr + destPos, srcptr, mono_string_length(src) * sizeof(gunichar2));
+}
+
+void
+ves_icall_System_String_InternalStrcpy_StrN (MonoString *dest, gint32 destPos, MonoString *src, gint32 startPos, gint32 count)
+{
+ gunichar2 *srcptr;
+ gunichar2 *destptr;
+
+ srcptr = mono_string_chars (src);
+ destptr = mono_string_chars (dest);
+ memcpy(destptr + destPos, srcptr + startPos, count * sizeof(gunichar2));
+}
+
+MonoString *
+ves_icall_System_String_InternalIntern (MonoString *str)
+{
+ return mono_string_intern(str);
+}
+
+MonoString *
+ves_icall_System_String_InternalIsInterned (MonoString *str)
+{
+ return mono_string_is_interned(str);
+}
+
+gint32
+ves_icall_System_String_InternalCompareStr_N (MonoString *s1, gint32 i1, MonoString *s2, gint32 i2, gint32 length, MonoBoolean inCase)
+{
+ /* c translation of C# code from old string.cs.. :) */
+ gint32 lenstr1;
+ gint32 lenstr2;
+ gint32 charcmp;
+ gunichar2 *str1;
+ gunichar2 *str2;
+
+ gint32 pos;
+ gint16 mode;
+
+ if (inCase)
+ mode = 1;
+ else
+ mode = 0;
+
+ lenstr1 = mono_string_length(s1);
+ lenstr2 = mono_string_length(s2);
+
+ str1 = mono_string_chars(s1);
+ str2 = mono_string_chars(s2);
+
+ pos = 0;
+
+ for (pos = 0; pos != length; pos++) {
+ if (i1 + pos >= lenstr1 || i2 + pos >= lenstr2)
+ break;
+
+ charcmp = string_icall_cmp_char(str1[i1 + pos], str2[i2 + pos], mode);
+ if (charcmp != 0)
+ return charcmp;
+ }
+
+ /* the lesser wins, so if we have looped until length we just need to check the last char */
+ if (pos == length) {
+ return string_icall_cmp_char(str1[i1 + pos - 1], str2[i2 + pos - 1], mode);
+ }
+
+ /* Test if one the strings has been compared to the end */
+ if (i1 + pos >= lenstr1) {
+ if (i2 + pos >= lenstr2)
+ return 0;
+ else
+ return -1;
+ } else if (i2 + pos >= lenstr2)
+ return 1;
+
+ /* if not, check our last char only.. (can this happen?) */
+ return string_icall_cmp_char(str1[i1 + pos], str2[i2 + pos], mode);
+}
+
+gint32
+ves_icall_System_String_GetHashCode (MonoString *me)
+{
+ int i, h = 0;
+ gunichar2 *data = mono_string_chars (me);
+
+ for (i = 0; i < mono_string_length (me); ++i)
+ h = (h << 5) - h + data [i];
+
+ return h;
+}
+
+gunichar2
+ves_icall_System_String_get_Chars (MonoString *me, gint32 idx)
+{
+ return mono_string_chars(me)[idx];
+}
+
+/* @mode : 0 = StringCompareModeDirect
+ 1 = StringCompareModeCaseInsensitive
+ 2 = StringCompareModeOrdinal
+*/
+gint32
+string_icall_cmp_char (gunichar2 c1, gunichar2 c2, gint16 mode)
+{
+ gint32 result;
+ GUnicodeType c1type, c2type;
+
+ c1type = g_unichar_type (c1);
+ c2type = g_unichar_type (c2);
+
+ switch (mode) {
+ case 0:
+ /* TODO: compare with culture info */
+ if (c1type == G_UNICODE_UPPERCASE_LETTER && c2type == G_UNICODE_LOWERCASE_LETTER)
+ return 1;
+
+ if (c1type == G_UNICODE_LOWERCASE_LETTER && c2type == G_UNICODE_UPPERCASE_LETTER)
+ return -1;
+
+ result = (gint32) c1 - c2;
+ break;
+ case 1:
+ result = (gint32) (c1type != G_UNICODE_LOWERCASE_LETTER ? g_unichar_tolower(c1) : c1) -
+ (c2type != G_UNICODE_LOWERCASE_LETTER ? g_unichar_tolower(c2) : c2);
+ break;
+ case 2:
+ result = (gint32) c1 - c2;
+ break;
+ }
+
+ return ((result < 0) ? -1 : (result > 0) ? 1 : 0);
+}
diff --git a/mono/metadata/string-icalls.h b/mono/metadata/string-icalls.h
new file mode 100644
index 00000000000..8bb69156ebb
--- /dev/null
+++ b/mono/metadata/string-icalls.h
@@ -0,0 +1,129 @@
+#ifndef _MONO_CLI_STRING_ICALLS_H_
+#define _MONO_CLI_STRING_ICALLS_H_
+
+/*
+ * string-icalls.h: String internal calls for the corlib
+ *
+ * Author:
+ * Patrik Torstensson (patrik.torstensson@labs2.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <mono/metadata/class.h>
+#include <mono/metadata/object.h>
+
+MonoString *
+ves_icall_System_String_ctor_charp (gpointer dummy, gunichar2 *value);
+
+MonoString *
+ves_icall_System_String_ctor_char_int (gpointer dummy, gunichar2 value, gint32 count);
+
+MonoString *
+ves_icall_System_String_ctor_charp_int_int (gpointer dummy, gunichar2 *value, gint32 sindex, gint32 length);
+
+MonoString *
+ves_icall_System_String_ctor_sbytep (gpointer dummy, gint8 *value);
+
+MonoString *
+ves_icall_System_String_ctor_sbytep_int_int (gpointer dummy, gint8 *value, gint32 sindex, gint32 length);
+
+MonoString *
+ves_icall_System_String_ctor_chara (gpointer dummy, MonoArray *value);
+
+MonoString *
+ves_icall_System_String_ctor_chara_int_int (gpointer dummy, MonoArray *value, gint32 sindex, gint32 length);
+
+MonoString *
+ves_icall_System_String_ctor_encoding (gpointer dummy, gint8 *value, gint32 sindex, gint32 length, MonoObject *enc);
+
+MonoBoolean
+ves_icall_System_String_InternalEquals (MonoString *str1, MonoString *str2);
+
+MonoString *
+ves_icall_System_String_InternalJoin (MonoString *separator, MonoArray * value, gint32 sindex, gint32 count);
+
+MonoString *
+ves_icall_System_String_InternalInsert (MonoString *me, gint32 sindex, MonoString *value);
+
+MonoString *
+ves_icall_System_String_InternalReplace_Char (MonoString *me, gunichar2 oldChar, gunichar2 newChar);
+
+MonoString *
+ves_icall_System_String_InternalReplace_Str (MonoString *me, MonoString *oldValue, MonoString *newValue);
+
+MonoString *
+ves_icall_System_String_InternalRemove (MonoString *me, gint32 sindex, gint32 count);
+
+void
+ves_icall_System_String_InternalCopyTo (MonoString *me, gint32 sindex, MonoArray *dest, gint32 dindex, gint32 count);
+
+MonoArray *
+ves_icall_System_String_InternalSplit (MonoString *me, MonoArray *separator, gint32 count);
+
+MonoString *
+ves_icall_System_String_InternalTrim (MonoString *me, MonoArray *chars, gint32 typ);
+
+gint32
+ves_icall_System_String_InternalIndexOf_Char (MonoString *me, gunichar2 value, gint32 sindex, gint32 count);
+
+gint32
+ves_icall_System_String_InternalIndexOf_Str (MonoString *me, MonoString *value, gint32 sindex, gint32 count);
+
+gint32
+ves_icall_System_String_InternalIndexOfAny (MonoString *me, MonoArray *arr, gint32 sindex, gint32 count);
+
+gint32
+ves_icall_System_String_InternalLastIndexOf_Char (MonoString *me, gunichar2 value, gint32 sindex, gint32 count);
+
+gint32
+ves_icall_System_String_InternalLastIndexOf_Str (MonoString *me, MonoString *value, gint32 sindex, gint32 count);
+
+gint32
+ves_icall_System_String_InternalLastIndexOfAny (MonoString *me, MonoArray *anyOf, gint32 sindex, gint32 count);
+
+MonoString *
+ves_icall_System_String_InternalPad (MonoString *me, gint32 width, gunichar2 chr, MonoBoolean right);
+
+MonoString *
+ves_icall_System_String_InternalToLower (MonoString *me);
+
+MonoString *
+ves_icall_System_String_InternalToUpper (MonoString *me);
+
+MonoString *
+ves_icall_System_String_InternalAllocateStr (gint32 length);
+
+void
+ves_icall_System_String_InternalStrcpy_Str (MonoString *dest, gint32 destPos, MonoString *src);
+
+void
+ves_icall_System_String_InternalStrcpy_StrN (MonoString *dest, gint32 destPos, MonoString *src, gint32 startPos, gint32 count);
+
+MonoString *
+ves_icall_System_String_InternalIntern (MonoString *str);
+
+MonoString *
+ves_icall_System_String_InternalIsInterned (MonoString *str);
+
+gint32
+ves_icall_System_String_InternalCompareStr (MonoString *s1, MonoString *s2, MonoBoolean inCase);
+
+gint32
+ves_icall_System_String_InternalCompareStr_N (MonoString *s1, gint32 i1, MonoString *s2, gint32 i2, gint32 length, MonoBoolean inCase);
+
+gint32
+ves_icall_System_String_GetHashCode (MonoString *me);
+
+gunichar2
+ves_icall_System_String_get_Chars (MonoString *me, gint32 idx);
+
+/* Internal helper methods */
+
+gboolean
+string_icall_is_in_array (MonoArray *chars, gint32 arraylength, gunichar2 chr);
+
+gint32
+string_icall_cmp_char (gunichar2 c1, gunichar2 c2, gint16 mode);
+
+#endif // _MONO_CLI_STRING_ICALLS_H_
diff --git a/mono/metadata/sysmath.c b/mono/metadata/sysmath.c
new file mode 100644
index 00000000000..fd6a54661cc
--- /dev/null
+++ b/mono/metadata/sysmath.c
@@ -0,0 +1,116 @@
+/* math.c - these are based on bob smith's csharp routines */
+
+#include <math.h>
+#include <mono/metadata/sysmath.h>
+
+static const gdouble MONO_NAN = 0.0 / 0.0;
+static const gdouble MONO_INF = 1.0 / 0.0;
+
+gdouble
+ves_icall_System_Math_Sin (gdouble x)
+{
+ return sin (x);
+}
+
+gdouble
+ves_icall_System_Math_Cos (gdouble x)
+{
+ return cos (x);
+}
+
+gdouble
+ves_icall_System_Math_Tan (gdouble x)
+{
+ return tan (x);
+}
+
+gdouble
+ves_icall_System_Math_Sinh (gdouble x)
+{
+ return sinh (x);
+}
+
+gdouble
+ves_icall_System_Math_Cosh (gdouble x)
+{
+ return cosh (x);
+}
+
+gdouble
+ves_icall_System_Math_Tanh (gdouble x)
+{
+ return tanh (x);
+}
+
+gdouble
+ves_icall_System_Math_Acos (gdouble x)
+{
+ if (x < -1 || x > 1)
+ return MONO_NAN;
+
+ return acos (x);
+}
+
+gdouble
+ves_icall_System_Math_Asin (gdouble x)
+{
+ if (x < -1 || x > 1)
+ return MONO_NAN;
+
+ return acos (x);
+}
+
+gdouble
+ves_icall_System_Math_Atan (gdouble x)
+{
+ return atan (x);
+}
+
+gdouble
+ves_icall_System_Math_Atan2 (gdouble y, gdouble x)
+{
+ return atan2 (y, x);
+}
+
+gdouble
+ves_icall_System_Math_Exp (gdouble x)
+{
+ return exp (x);
+}
+
+gdouble
+ves_icall_System_Math_Log (gdouble x)
+{
+ if (x == 0)
+ return -MONO_INF;
+ else if (x < 0)
+ return MONO_NAN;
+
+ return log (x);
+}
+
+gdouble
+ves_icall_System_Math_Log10 (gdouble x)
+{
+ if (x == 0)
+ return -MONO_INF;
+ else if (x < 0)
+ return MONO_NAN;
+
+ return log10 (x);
+}
+
+gdouble
+ves_icall_System_Math_Pow (gdouble x, gdouble y)
+{
+ return pow (x, y);
+}
+
+gdouble
+ves_icall_System_Math_Sqrt (gdouble x)
+{
+ if (x < 0)
+ return MONO_NAN;
+
+ return sqrt (x);
+}
diff --git a/mono/metadata/sysmath.h b/mono/metadata/sysmath.h
new file mode 100644
index 00000000000..c906a5a82f3
--- /dev/null
+++ b/mono/metadata/sysmath.h
@@ -0,0 +1,61 @@
+/*
+ * math.h
+ *
+ * Author:
+ * Dan Lewis (dihlewis@yahoo.co.uk)
+ *
+ * (C) Ximian, Inc. 2002
+ */
+
+#ifndef __METADATA_SYSMATH_H__
+#define __METADATA_SYSMATH_H__
+
+#include <config.h>
+#include <glib.h>
+
+extern gdouble
+ves_icall_System_Math_Sin (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Cos (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Tan (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Sinh (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Cosh (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Tanh (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Acos (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Asin (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Atan (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Atan2 (gdouble y, gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Exp (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Log (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Log10 (gdouble x);
+
+extern gdouble
+ves_icall_System_Math_Pow (gdouble x, gdouble y);
+
+extern gdouble
+ves_icall_System_Math_Sqrt (gdouble x);
+
+#endif
diff --git a/mono/metadata/tabledefs.h b/mono/metadata/tabledefs.h
new file mode 100644
index 00000000000..5d5671b4a96
--- /dev/null
+++ b/mono/metadata/tabledefs.h
@@ -0,0 +1,213 @@
+/*
+ * tabledefs.h: This file contains the various definitions for constants
+ * found on the metadata tables
+ *
+ * Author:
+ * Miguel de Icaza (miguel@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ *
+ * From the ECMA documentation
+ */
+
+#ifndef _MONO_METADATA_TABLEDEFS_H_
+#define _MONO_METADATA_TABLEDEFS_H_
+
+/*
+ * 22.1.1 Values for AssemblyHashAlgorithm
+ */
+
+enum {
+ ASSEMBLY_HASH_NONE,
+ ASSEMBLY_HASH_MD5 = 0x8003,
+ ASSEMBLY_HASH_SHA1 = 0x8004
+};
+
+/*
+ * 22.1.4 Flags for Event.EventAttributes
+ */
+
+enum {
+ EVENT_SPECIALNAME = 0x0200,
+ EVENT_RTSPECIALNAME = 0x0400
+};
+
+/*
+ * 22.1.6 Flags for FileAttributes
+ */
+
+enum {
+ FILE_CONTAINS_METADATA = 0,
+ FILE_CONTAINS_NO_METADATA = 1
+};
+
+/*
+ * Field Attributes (21.1.5).
+ */
+
+#define FIELD_ATTRIBUTE_FIELD_ACCESS_MASK 0x0007
+#define FIELD_ATTRIBUTE_COMPILER_CONTROLLED 0x0000
+#define FIELD_ATTRIBUTE_PRIVATE 0x0001
+#define FIELD_ATTRIBUTE_FAM_AND_ASSEM 0x0002
+#define FIELD_ATTRIBUTE_ASSEMBLY 0x0003
+#define FIELD_ATTRIBUTE_FAMILY 0x0004
+#define FIELD_ATTRIBUTE_FAM_OR_ASSEM 0x0005
+#define FIELD_ATTRIBUTE_PUBLIC 0x0006
+
+#define FIELD_ATTRIBUTE_STATIC 0x0010
+#define FIELD_ATTRIBUTE_INIT_ONLY 0x0020
+#define FIELD_ATTRIBUTE_LITERAL 0x0040
+#define FIELD_ATTRIBUTE_NOT_SERIALIZED 0x0080
+#define FIELD_ATTRIBUTE_SPECIAL_NAME 0x0200
+#define FIELD_ATTRIBUTE_PINVOKE_IMPL 0x2000
+
+/* For runtime use only */
+#define FIELD_ATTRIBUTE_RESERVED_MASK 0x9500
+#define FIELD_ATTRIBUTE_RT_SPECIAL_NAME 0x0400
+#define FIELD_ATTRIBUTE_HAS_FIELD_MARSHAL 0x1000
+#define FIELD_ATTRIBUTE_HAS_DEFAULT 0x8000
+#define FIELD_ATTRIBUTE_HAS_FIELD_RVA 0x0100
+
+/*
+ * Type Attributes (21.1.13).
+ */
+#define TYPE_ATTRIBUTE_VISIBILITY_MASK 0x00000007
+#define TYPE_ATTRIBUTE_NOT_PUBLIC 0x00000000
+#define TYPE_ATTRIBUTE_PUBLIC 0x00000001
+#define TYPE_ATTRIBUTE_NESTED_PUBLIC 0x00000002
+#define TYPE_ATTRIBUTE_NESTED_PRIVATE 0x00000003
+#define TYPE_ATTRIBUTE_NESTED_FAMILY 0x00000004
+#define TYPE_ATTRIBUTE_NESTED_ASSEMBLY 0x00000005
+#define TYPE_ATTRIBUTE_NESTED_FAM_AND_ASSEM 0x00000006
+#define TYPE_ATTRIBUTE_NESTED_FAM_OR_ASSEM 0x00000007
+
+#define TYPE_ATTRIBUTE_LAYOUT_MASK 0x00000018
+#define TYPE_ATTRIBUTE_AUTO_LAYOUT 0x00000000
+#define TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT 0x00000008
+#define TYPE_ATTRIBUTE_EXPLICIT_LAYOUT 0x00000010
+
+#define TYPE_ATTRIBUTE_CLASS_SEMANTIC_MASK 0x00000020
+#define TYPE_ATTRIBUTE_CLASS 0x00000000
+#define TYPE_ATTRIBUTE_INTERFACE 0x00000020
+
+#define TYPE_ATTRIBUTE_ABSTRACT 0x00000080
+#define TYPE_ATTRIBUTE_SEALED 0x00000100
+#define TYPE_ATTRIBUTE_SPECIAL_NAME 0x00000400
+
+#define TYPE_ATTRIBUTE_IMPORT 0x00001000
+#define TYPE_ATTRIBUTE_SERIALIZABLE 0x00002000
+
+#define TYPE_ATTRIBUTE_STRING_FORMAT_MASK 0x00030000
+#define TYPE_ATTRIBUTE_ANSI_CLASS 0x00000000
+#define TYPE_ATTRIBUTE_UNICODE_CLASS 0x00010000
+#define TYPE_ATTRIBUTE_AUTO_CLASS 0x00020000
+
+#define TYPE_ATTRIBUTE_BEFORE_FIELD_INIT 0x00100000
+
+#define TYPE_ATTRIBUTE_RESERVED_MASK 0x00040800
+#define TYPE_ATTRIBUTE_RT_SPECIAL_NAME 0x00000800
+#define TYPE_ATTRIBUTE_HAS_SECURITY 0x00040000
+
+/*
+ * Method Attributes (22.1.9)
+ */
+
+#define METHOD_IMPL_ATTRIBUTE_CODE_TYPE_MASK 0x0003
+#define METHOD_IMPL_ATTRIBUTE_IL 0x0000
+#define METHOD_IMPL_ATTRIBUTE_NATIVE 0x0001
+#define METHOD_IMPL_ATTRIBUTE_OPTIL 0x0002
+#define METHOD_IMPL_ATTRIBUTE_RUNTIME 0x0003
+
+#define METHOD_IMPL_ATTRIBUTE_MANAGED_MASK 0x0004
+#define METHOD_IMPL_ATTRIBUTE_UNMANAGED 0x0004
+#define METHOD_IMPL_ATTRIBUTE_MANAGED 0x0000
+
+#define METHOD_IMPL_ATTRIBUTE_FORWARD_REF 0x0010
+#define METHOD_IMPL_ATTRIBUTE_PRESERVE_SIG 0x0080
+#define METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL 0x1000
+#define METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED 0x0020
+#define METHOD_IMPL_ATTRIBUTE_NOINLINING 0x0008
+#define METHOD_IMPL_ATTRIBUTE_MAX_METHOD_IMPL_VAL 0xffff
+
+#define METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK 0x0007
+#define METHOD_ATTRIBUTE_COMPILER_CONTROLLED 0x0000
+#define METHOD_ATTRIBUTE_PRIVATE 0x0001
+#define METHOD_ATTRIBUTE_FAM_AND_ASSEM 0x0002
+#define METHOD_ATTRIBUTE_ASSEM 0x0003
+#define METHOD_ATTRIBUTE_FAMILY 0x0004
+#define METHOD_ATTRIBUTE_FAM_OR_ASSEM 0x0005
+#define METHOD_ATTRIBUTE_PUBLIC 0x0006
+
+#define METHOD_ATTRIBUTE_STATIC 0x0010
+#define METHOD_ATTRIBUTE_FINAL 0x0020
+#define METHOD_ATTRIBUTE_VIRTUAL 0x0040
+#define METHOD_ATTRIBUTE_HIDE_BY_SIG 0x0080
+
+#define METHOD_ATTRIBUTE_VTABLE_LAYOUT_MASK 0x0100
+#define METHOD_ATTRIBUTE_REUSE_SLOT 0x0000
+#define METHOD_ATTRIBUTE_NEW_SLOT 0x0100
+
+#define METHOD_ATTRIBUTE_ABSTRACT 0x0400
+#define METHOD_ATTRIBUTE_SPECIAL_NAME 0x0800
+
+#define METHOD_ATTRIBUTE_PINVOKE_IMPL 0x2000
+#define METHOD_ATTRIBUTE_UNMANAGED_EXPORT 0x0008
+
+/*
+ * For runtime use only
+ */
+#define METHOD_ATTRIBUTE_RESERVED_MASK 0xd000
+#define METHOD_ATTRIBUTE_RT_SPECIAL_NAME 0x1000
+#define METHOD_ATTRIBUTE_HAS_SECURITY 0x4000
+#define METHOD_ATTRIBUTE_REQUIRE_SEC_OBJECT 0x8000
+
+
+/*
+ * Method Semantics ([MethodSemanticAttributes]) 22.1.10
+ */
+
+#define METHOD_SEMANTIC_SETTER 0x0001
+#define METHOD_SEMANTIC_GETTER 0x0002
+#define METHOD_SEMANTIC_OTHER 0x0004
+#define METHOD_SEMANTIC_ADD_ON 0x0008
+#define METHOD_SEMANTIC_REMOVE_ON 0x0010
+#define METHOD_SEMANTIC_FIRE 0x0020
+
+/*
+ * Flags for Params (22.1.11)
+ */
+#define PARAM_ATTRIBUTE_IN 0x0001
+#define PARAM_ATTRIBUTE_OUT 0x0002
+#define PARAM_ATTRIBUTE_OPTIONAL 0x0004
+#define PARAM_ATTRIBUTE_RESERVED_MASK 0xf000
+#define PARAM_ATTRIBUTE_HAS_DEFAULT 0x1000
+#define PARAM_ATTRIBUTE_HAS_FIELD_MARSHAL 0x2000
+#define PARAM_ATTRIBUTE_UNUSED 0xcfe0
+
+/*
+ * 22.1.12 PropertyAttributes
+ */
+#define PROPERTY_ATTRIBUTE_SPECIAL_NAME 0x0200
+#define PROPERTY_ATTRIBUTE_RESERVED_MASK 0xf400
+#define PROPERTY_ATTRIBUTE_RT_SPECIAL_NAME 0x0400
+#define PROPERTY_ATTRIBUTE_HAS_DEFAULT 0x1000
+#define PROPERTY_ATTRIBUTE_UNUSED 0xe9ff
+
+/*
+ * 22.1.7 Flags for ImplMap [PInvokeAttributes]
+ */
+#define PINVOKE_ATTRIBUTE_NO_MANGLE 0x0001
+#define PINVOKE_ATTRIBUTE_CHAR_SET_MASK 0x0006
+#define PINVOKE_ATTRIBUTE_CHAR_SET_NOT_SPEC 0x0000
+#define PINVOKE_ATTRIBUTE_CHAR_SET_ANSI 0x0002
+#define PINVOKE_ATTRIBUTE_CHAR_SET_UNICODE 0x0004
+#define PINVOKE_ATTRIBUTE_CHAR_SET_AUTO 0x0006
+#define PINVOKE_ATTRIBUTE_SUPPORTS_LAST_ERROR 0x0040
+#define PINVOKE_ATTRIBUTE_CALL_CONV_MASK 0x0700
+#define PINVOKE_ATTRIBUTE_CALL_CONV_WINAPI 0x0100
+#define PINVOKE_ATTRIBUTE_CALL_CONV_CDECL 0x0200
+#define PINVOKE_ATTRIBUTE_CALL_CONV_STDCALL 0x0300
+#define PINVOKE_ATTRIBUTE_CALL_CONV_THISCALL 0x0400
+#define PINVOKE_ATTRIBUTE_CALL_CONV_FASTCALL 0x0500
+
+#endif
diff --git a/mono/metadata/threads-types.h b/mono/metadata/threads-types.h
new file mode 100644
index 00000000000..aac7d5f26c4
--- /dev/null
+++ b/mono/metadata/threads-types.h
@@ -0,0 +1,46 @@
+/*
+ * threads-types.h: Generic thread typedef support (includes
+ * system-specific files)
+ *
+ * Author:
+ * Dick Porter (dick@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc
+ */
+
+#ifndef _MONO_METADATA_THREADS_TYPES_H_
+#define _MONO_METADATA_THREADS_TYPES_H_
+
+
+#include <config.h>
+
+#include <mono/io-layer/io-layer.h>
+
+/*
+ * This is bonkers. We are emulating condition variables here using
+ * win32 calls, which on Linux are being emulated with condition
+ * variables :-)
+ *
+ * See http://www.cs.wustl.edu/~schmidt/win32-cv-1.html for the design.
+ */
+
+typedef struct
+{
+ HANDLE monitor;
+ guint32 tid;
+
+ /* Need to count how many times this monitor object has been
+ * locked by the owning thread, so that we can unlock it
+ * completely in Wait()
+ */
+ guint32 count;
+
+ /* condition variable management */
+ guint32 waiters_count;
+ CRITICAL_SECTION waiters_count_lock;
+ HANDLE sema;
+ HANDLE waiters_done;
+ gboolean was_broadcast;
+} MonoThreadsSync;
+
+#endif /* _MONO_METADATA_THREADS_TYPES_H_ */
diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c
new file mode 100644
index 00000000000..6ab46d24d32
--- /dev/null
+++ b/mono/metadata/threads.c
@@ -0,0 +1,904 @@
+/*
+ * threads.c: Thread support internal calls
+ *
+ * Author:
+ * Dick Porter (dick@ximian.com)
+ * Patrik Torstensson (patrik.torstensson@labs2.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/appdomain.h>
+#include <mono/metadata/profiler-private.h>
+#include <mono/metadata/threads.h>
+#include <mono/metadata/threads-types.h>
+#include <mono/io-layer/io-layer.h>
+
+#undef THREAD_DEBUG
+#undef THREAD_LOCK_DEBUG
+#undef THREAD_WAIT_DEBUG
+
+struct StartInfo
+{
+ guint32 (*func)(void *);
+ MonoObject *obj;
+ void *this;
+ MonoDomain *domain;
+};
+
+typedef union {
+ gint32 ival;
+ gfloat fval;
+} IntFloatUnion;
+
+/* Controls access to the 'threads' array */
+static CRITICAL_SECTION threads_mutex;
+
+/* Controls access to the sync field in MonoObjects, to avoid race
+ * conditions when adding sync data to an object for the first time.
+ */
+static CRITICAL_SECTION monitor_mutex;
+
+/* The array of existing threads that need joining before exit */
+static GPtrArray *threads=NULL;
+
+/* The MonoObject associated with the main thread */
+static MonoObject *main_thread;
+
+/* The TLS key that holds the MonoObject assigned to each thread */
+static guint32 current_object_key;
+
+/* The TLS key that holds the LocalDataStoreSlot hash in each thread */
+static guint32 slothash_key;
+
+/* Spin lock for InterlockedXXX 64 bit functions */
+static CRITICAL_SECTION interlocked_mutex;
+
+static guint32 start_wrapper(void *data)
+{
+ struct StartInfo *start_info=(struct StartInfo *)data;
+ guint32 (*start_func)(void *);
+ void *this;
+
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Start wrapper");
+#endif
+
+ /* FIXME: GC problem here with recorded object
+ * pointer!
+ *
+ * This is recorded so CurrentThread can return the
+ * Thread object.
+ */
+ TlsSetValue (current_object_key, start_info->obj);
+ start_func = start_info->func;
+ mono_domain_set (start_info->domain);
+ this = start_info->this;
+ g_free (start_info);
+
+ start_func (this);
+
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Start wrapper terminating");
+#endif
+
+ return(0);
+}
+
+static void handle_store(HANDLE thread)
+{
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": thread %p", thread);
+#endif
+
+ EnterCriticalSection(&threads_mutex);
+ if(threads==NULL) {
+ threads=g_ptr_array_new();
+ }
+ g_ptr_array_add(threads, thread);
+ LeaveCriticalSection(&threads_mutex);
+}
+
+static void handle_remove(HANDLE thread)
+{
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": thread %p", thread);
+#endif
+
+ EnterCriticalSection(&threads_mutex);
+ g_ptr_array_remove_fast(threads, thread);
+ LeaveCriticalSection(&threads_mutex);
+ CloseHandle(thread);
+}
+
+MonoObject *
+mono_thread_create (MonoDomain *domain, gpointer func)
+{
+ MonoClassField *field;
+ MonoObject *thread;
+ HANDLE thread_handle;
+ struct StartInfo *start_info;
+ guint32 tid;
+
+ thread = mono_object_new (domain, mono_defaults.thread_class);
+
+ field=mono_class_get_field_from_name(mono_defaults.thread_class, "system_thread_handle");
+ g_assert (field);
+
+ start_info=g_new0 (struct StartInfo, 1);
+ start_info->func = func;
+ start_info->obj = thread;
+ start_info->domain = domain;
+
+ thread_handle = CreateThread(NULL, 0, start_wrapper, start_info, 0, &tid);
+ g_assert (thread_handle);
+
+ *(gpointer *)(((char *)thread) + field->offset) = thread_handle;
+
+ /*
+ * This thread is not added to the threads array: why?
+ */
+ mono_profiler_thread_start (thread_handle);
+ return thread;
+}
+
+HANDLE ves_icall_System_Threading_Thread_Thread_internal(MonoObject *this,
+ MonoObject *start)
+{
+ MonoMulticastDelegate *delegate = (MonoMulticastDelegate*)start;
+ guint32 (*start_func)(void *);
+ struct StartInfo *start_info;
+ HANDLE thread;
+ guint32 tid;
+
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Trying to start a new thread: this (%p) start (%p)",
+ this, start);
+#endif
+
+ start_func = delegate->delegate.method_ptr;
+
+ if(start_func==NULL) {
+ g_warning(G_GNUC_PRETTY_FUNCTION
+ ": Can't locate start method!");
+ return(NULL);
+ } else {
+ /* This is freed in start_wrapper */
+ start_info = g_new0 (struct StartInfo, 1);
+ start_info->func = start_func;
+ start_info->this = delegate->delegate.target;
+ start_info->obj = this;
+ start_info->domain = mono_domain_get ();
+
+ thread=CreateThread(NULL, 0, start_wrapper, start_info,
+ CREATE_SUSPENDED, &tid);
+ if(thread==NULL) {
+ g_warning(G_GNUC_PRETTY_FUNCTION
+ ": CreateThread error 0x%x", GetLastError());
+ return(NULL);
+ }
+
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Started thread ID %d",
+ tid);
+#endif
+
+ /* Store handle for cleanup later */
+ handle_store(thread);
+ mono_profiler_thread_start (thread);
+
+ return(thread);
+ }
+}
+
+void ves_icall_System_Threading_Thread_Start_internal(MonoObject *this,
+ HANDLE thread)
+{
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Launching thread %p", this);
+#endif
+
+ ResumeThread(thread);
+}
+
+void ves_icall_System_Threading_Thread_Sleep_internal(gint32 ms)
+{
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Sleeping for %d ms", ms);
+#endif
+
+ Sleep(ms);
+}
+
+MonoAppDomain *ves_icall_System_Threading_Thread_CurrentThreadDomain_internal(void)
+{
+ /* return the current app */
+ return mono_domain_get()->domain;
+}
+
+MonoObject *ves_icall_System_Threading_Thread_CurrentThread_internal(void)
+{
+ MonoObject *thread;
+
+ /* Find the current thread object */
+ thread=TlsGetValue(current_object_key);
+ return(thread);
+}
+
+gboolean ves_icall_System_Threading_Thread_Join_internal(MonoObject *this,
+ int ms, HANDLE thread)
+{
+ gboolean ret;
+
+ if(ms== -1) {
+ ms=INFINITE;
+ }
+
+ ret=WaitForSingleObject(thread, ms);
+ if(ret==WAIT_OBJECT_0) {
+ /* is the handle still valid at this point? */
+ mono_profiler_thread_end (thread);
+ /* Clean up the handle */
+ handle_remove(thread);
+ return(TRUE);
+ }
+
+ return(FALSE);
+}
+
+void ves_icall_System_Threading_Thread_SlotHash_store(MonoObject *data)
+{
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Storing key %p", data);
+#endif
+
+ /* Object location stored here */
+ TlsSetValue(slothash_key, data);
+}
+
+MonoObject *ves_icall_System_Threading_Thread_SlotHash_lookup(void)
+{
+ MonoObject *data;
+
+ data=TlsGetValue(slothash_key);
+
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Retrieved key %p", data);
+#endif
+
+ return(data);
+}
+
+static MonoThreadsSync *mon_new(void)
+{
+ MonoThreadsSync *new;
+
+ /* This should be freed when the object that owns it is
+ * deleted
+ */
+
+ new=(MonoThreadsSync *)g_new0(MonoThreadsSync, 1);
+ new->monitor=CreateMutex(NULL, FALSE, NULL);
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": ThreadsSync mutex created: %p",
+ new->monitor);
+#endif
+
+ new->waiters_count=0;
+ new->was_broadcast=FALSE;
+ InitializeCriticalSection(&new->waiters_count_lock);
+ new->sema=CreateSemaphore(NULL, 0, 0x7fffffff, NULL);
+ new->waiters_done=CreateEvent(NULL, FALSE, FALSE, NULL);
+
+ return(new);
+}
+
+gboolean ves_icall_System_Threading_Monitor_Monitor_try_enter(MonoObject *obj,
+ int ms)
+{
+ MonoThreadsSync *mon;
+ guint32 ret;
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Trying to lock %p in thread %d", obj,
+ GetCurrentThreadId());
+#endif
+
+ EnterCriticalSection(&monitor_mutex);
+
+ mon=obj->synchronisation;
+ if(mon==NULL) {
+ mon=mon_new();
+ obj->synchronisation=mon;
+ }
+
+ /* Don't hold the monitor lock while waiting to acquire the
+ * object lock
+ */
+ LeaveCriticalSection(&monitor_mutex);
+
+ /* Acquire the mutex */
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Acquiring monitor mutex %p",
+ mon->monitor);
+#endif
+ ret=WaitForSingleObject(mon->monitor, ms);
+ if(ret==WAIT_OBJECT_0) {
+ mon->count++;
+ mon->tid=GetCurrentThreadId();
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": %p now locked %d times", obj,
+ mon->count);
+#endif
+
+ return(TRUE);
+ }
+
+ return(FALSE);
+}
+
+void ves_icall_System_Threading_Monitor_Monitor_exit(MonoObject *obj)
+{
+ MonoThreadsSync *mon;
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Unlocking %p in thread %d", obj,
+ GetCurrentThreadId());
+#endif
+
+ /* No need to lock monitor_mutex here because we only adjust
+ * the monitor state if this thread already owns the lock
+ */
+ mon=obj->synchronisation;
+
+ if(mon==NULL) {
+ return;
+ }
+
+ if(mon->tid!=GetCurrentThreadId()) {
+ return;
+ }
+
+ mon->count--;
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": %p now locked %d times", obj,
+ mon->count);
+#endif
+
+ if(mon->count==0) {
+ mon->tid=0; /* FIXME: check that 0 isnt a valid id */
+ }
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Releasing mutex %p", mon->monitor);
+#endif
+
+ ReleaseMutex(mon->monitor);
+}
+
+gboolean ves_icall_System_Threading_Monitor_Monitor_test_owner(MonoObject *obj)
+{
+ MonoThreadsSync *mon;
+ gboolean ret=FALSE;
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Testing if %p is owned by thread %d", obj,
+ GetCurrentThreadId());
+#endif
+
+ EnterCriticalSection(&monitor_mutex);
+
+ mon=obj->synchronisation;
+ if(mon==NULL) {
+ goto finished;
+ }
+
+ if(mon->tid!=GetCurrentThreadId()) {
+ goto finished;
+ }
+
+ ret=TRUE;
+
+finished:
+ LeaveCriticalSection(&monitor_mutex);
+
+ return(ret);
+}
+
+gboolean ves_icall_System_Threading_Monitor_Monitor_test_synchronised(MonoObject *obj)
+{
+ MonoThreadsSync *mon;
+ gboolean ret=FALSE;
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Testing if %p is owned by any thread", obj);
+#endif
+
+ EnterCriticalSection(&monitor_mutex);
+
+ mon=obj->synchronisation;
+ if(mon==NULL) {
+ goto finished;
+ }
+
+ if(mon->tid==0) {
+ goto finished;
+ }
+
+ g_assert(mon->count);
+
+ ret=TRUE;
+
+finished:
+ LeaveCriticalSection(&monitor_mutex);
+
+ return(ret);
+}
+
+
+void ves_icall_System_Threading_Monitor_Monitor_pulse(MonoObject *obj)
+{
+ gboolean have_waiters;
+ MonoThreadsSync *mon;
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message("Pulsing %p in thread %d", obj, GetCurrentThreadId());
+#endif
+
+ EnterCriticalSection(&monitor_mutex);
+
+ mon=obj->synchronisation;
+ if(mon==NULL) {
+ LeaveCriticalSection(&monitor_mutex);
+ return;
+ }
+
+ if(mon->tid!=GetCurrentThreadId()) {
+ LeaveCriticalSection(&monitor_mutex);
+ return;
+ }
+ LeaveCriticalSection(&monitor_mutex);
+
+ EnterCriticalSection(&mon->waiters_count_lock);
+ have_waiters=(mon->waiters_count>0);
+ LeaveCriticalSection(&mon->waiters_count_lock);
+
+ if(have_waiters==TRUE) {
+ ReleaseSemaphore(mon->sema, 1, 0);
+ }
+}
+
+void ves_icall_System_Threading_Monitor_Monitor_pulse_all(MonoObject *obj)
+{
+ gboolean have_waiters=FALSE;
+ MonoThreadsSync *mon;
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message("Pulsing all %p", obj);
+#endif
+
+ EnterCriticalSection(&monitor_mutex);
+
+ mon=obj->synchronisation;
+ if(mon==NULL) {
+ LeaveCriticalSection(&monitor_mutex);
+ return;
+ }
+
+ if(mon->tid!=GetCurrentThreadId()) {
+ LeaveCriticalSection(&monitor_mutex);
+ return;
+ }
+ LeaveCriticalSection(&monitor_mutex);
+
+ EnterCriticalSection(&mon->waiters_count_lock);
+ if(mon->waiters_count>0) {
+ mon->was_broadcast=TRUE;
+ have_waiters=TRUE;
+ }
+
+ if(have_waiters==TRUE) {
+ ReleaseSemaphore(mon->sema, mon->waiters_count, 0);
+
+ LeaveCriticalSection(&mon->waiters_count_lock);
+
+ WaitForSingleObject(mon->waiters_done, INFINITE);
+ mon->was_broadcast=FALSE;
+ } else {
+ LeaveCriticalSection(&mon->waiters_count_lock);
+ }
+}
+
+gboolean ves_icall_System_Threading_Monitor_Monitor_wait(MonoObject *obj,
+ int ms)
+{
+ gboolean last_waiter;
+ MonoThreadsSync *mon;
+ guint32 save_count;
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message("Trying to wait for %p in thread %d with timeout %dms", obj,
+ GetCurrentThreadId(), ms);
+#endif
+
+ EnterCriticalSection(&monitor_mutex);
+
+ mon=obj->synchronisation;
+ if(mon==NULL) {
+ LeaveCriticalSection(&monitor_mutex);
+ return(FALSE);
+ }
+
+ if(mon->tid!=GetCurrentThreadId()) {
+ LeaveCriticalSection(&monitor_mutex);
+ return(FALSE);
+ }
+ LeaveCriticalSection(&monitor_mutex);
+
+ EnterCriticalSection(&mon->waiters_count_lock);
+ mon->waiters_count++;
+ LeaveCriticalSection(&mon->waiters_count_lock);
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": %p locked %d times", obj,
+ mon->count);
+#endif
+
+ /* We need to put the lock count back afterwards */
+ save_count=mon->count;
+
+ while(mon->count>1) {
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Releasing mutex %p",
+ mon->monitor);
+#endif
+
+ ReleaseMutex(mon->monitor);
+ mon->count--;
+ }
+
+ /* We're releasing this mutex */
+ mon->count=0;
+ mon->tid=0;
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Signalling monitor mutex %p",
+ mon->monitor);
+#endif
+
+ SignalObjectAndWait(mon->monitor, mon->sema, INFINITE, FALSE);
+
+ EnterCriticalSection(&mon->waiters_count_lock);
+ mon->waiters_count++;
+ last_waiter=mon->was_broadcast && mon->waiters_count==0;
+ LeaveCriticalSection(&mon->waiters_count_lock);
+
+ if(last_waiter) {
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Waiting for monitor mutex %p",
+ mon->monitor);
+#endif
+ SignalObjectAndWait(mon->waiters_done, mon->monitor, INFINITE, FALSE);
+ } else {
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Waiting for monitor mutex %p",
+ mon->monitor);
+#endif
+ WaitForSingleObject(mon->monitor, INFINITE);
+ }
+
+ /* We've reclaimed this mutex */
+ mon->count=save_count;
+ mon->tid=GetCurrentThreadId();
+
+ /* Lock the mutex the required number of times */
+ while(save_count>1) {
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Waiting for monitor mutex %p", mon->monitor);
+#endif
+ WaitForSingleObject(mon->monitor, INFINITE);
+ save_count--;
+ }
+
+#ifdef THREAD_LOCK_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": %p still locked %d times", obj,
+ mon->count);
+#endif
+
+ return(TRUE);
+}
+
+/* FIXME: exitContext isnt documented */
+gboolean ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext)
+{
+ HANDLE *handles;
+ guint32 numhandles;
+ guint32 ret;
+ guint32 i;
+
+ numhandles=mono_array_length(mono_handles);
+ handles=g_new0(HANDLE, numhandles);
+ for(i=0; i<numhandles; i++) {
+ handles[i]=mono_array_get(mono_handles, HANDLE, i);
+ }
+
+ if(ms== -1) {
+ ms=INFINITE;
+ }
+
+ ret=WaitForMultipleObjects(numhandles, handles, TRUE, ms);
+
+ g_free(handles);
+
+ if(ret==WAIT_FAILED) {
+#ifdef THREAD_WAIT_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Wait failed");
+#endif
+ return(FALSE);
+ } else if(ret==WAIT_TIMEOUT) {
+#ifdef THREAD_WAIT_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Wait timed out");
+#endif
+ return(FALSE);
+ }
+
+ return(TRUE);
+}
+
+/* FIXME: exitContext isnt documented */
+gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext)
+{
+ HANDLE *handles;
+ guint32 numhandles;
+ guint32 ret;
+ guint32 i;
+
+ numhandles=mono_array_length(mono_handles);
+ handles=g_new0(HANDLE, numhandles);
+ for(i=0; i<numhandles; i++) {
+ handles[i]=mono_array_get(mono_handles, HANDLE, i);
+ }
+
+ if(ms== -1) {
+ ms=INFINITE;
+ }
+
+ ret=WaitForMultipleObjects(numhandles, handles, FALSE, ms);
+
+ g_free(handles);
+
+#ifdef THREAD_WAIT_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": returning %d", ret);
+#endif
+
+ return(ret);
+}
+
+/* FIXME: exitContext isnt documented */
+gboolean ves_icall_System_Threading_WaitHandle_WaitOne_internal(MonoObject *this, HANDLE handle, gint32 ms, gboolean exitContext)
+{
+ guint32 ret;
+
+#ifdef THREAD_WAIT_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": waiting for %p", handle);
+#endif
+
+ if(ms== -1) {
+ ms=INFINITE;
+ }
+
+ ret=WaitForSingleObject(handle, ms);
+ if(ret==WAIT_FAILED) {
+#ifdef THREAD_WAIT_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Wait failed");
+#endif
+ return(FALSE);
+ } else if(ret==WAIT_TIMEOUT) {
+#ifdef THREAD_WAIT_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION ": Wait timed out");
+#endif
+ return(FALSE);
+ }
+
+ return(TRUE);
+}
+
+HANDLE ves_icall_System_Threading_Mutex_CreateMutex_internal (MonoBoolean owned,char *name) {
+ return(CreateMutex(NULL,owned,name));
+}
+
+void ves_icall_System_Threading_Mutex_ReleaseMutex_internal (HANDLE handle ) {
+ ReleaseMutex(handle);
+}
+
+HANDLE ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual,
+ MonoBoolean initial,
+ char *name) {
+ return (CreateEvent(NULL,manual,initial,name));
+}
+
+gboolean ves_icall_System_Threading_Events_SetEvent_internal (HANDLE handle) {
+ return (SetEvent(handle));
+}
+
+gboolean ves_icall_System_Threading_Events_ResetEvent_internal (HANDLE handle) {
+ return (ResetEvent(handle));
+}
+
+void mono_thread_init(MonoDomain *domain)
+{
+ MonoClass *thread_class;
+
+ /* Build a System.Threading.Thread object instance to return
+ * for the main line's Thread.CurrentThread property.
+ */
+ thread_class=mono_class_from_name(mono_defaults.corlib, "System.Threading", "Thread");
+
+ /* I wonder what happens if someone tries to destroy this
+ * object? In theory, I guess the whole program should act as
+ * though exit() were called :-)
+ */
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Starting to build main Thread object");
+#endif
+ main_thread = mono_object_new (domain, thread_class);
+#ifdef THREAD_DEBUG
+ g_message(G_GNUC_PRETTY_FUNCTION
+ ": Finished to building main Thread object");
+#endif
+
+ InitializeCriticalSection(&threads_mutex);
+ InitializeCriticalSection(&monitor_mutex);
+ InitializeCriticalSection(&interlocked_mutex);
+
+ current_object_key=TlsAlloc();
+ TlsSetValue(current_object_key, main_thread);
+
+ slothash_key=TlsAlloc();
+}
+
+void mono_thread_cleanup(void)
+{
+ HANDLE wait[MAXIMUM_WAIT_OBJECTS];
+ guint32 i, j;
+
+ /* join each thread that's still running */
+#ifdef THREAD_DEBUG
+ g_message("Joining each running thread...");
+#endif
+
+ if(threads==NULL) {
+#ifdef THREAD_DEBUG
+ g_message("No threads");
+#endif
+ return;
+ }
+
+ /* This isnt the right way to do it.
+ *
+ * The first method call should be started in its own thread,
+ * and then the main thread should poll an event and wait for
+ * any terminated threads, until there are none left.
+ */
+#ifdef THREAD_DEBUG
+ g_message("There are %d threads to join", threads->len);
+ for(i=0; i<threads->len; i++) {
+ g_message("Waiting for: %p", g_ptr_array_index(threads, i));
+ }
+#endif
+
+ for(i=0; i<threads->len; i+=MAXIMUM_WAIT_OBJECTS) {
+ for(j=0; j<MAXIMUM_WAIT_OBJECTS && i+j<threads->len; j++) {
+#ifdef THREAD_DEBUG
+ g_message("Waiting for threads %d in slot %d", i+j, j);
+#endif
+ wait[j]=g_ptr_array_index(threads, i+j);
+ }
+#ifdef THREAD_DEBUG
+ g_message("%d threads to wait for in this batch", j);
+#endif
+
+ WaitForMultipleObjects(j, wait, TRUE, INFINITE);
+ }
+
+ g_ptr_array_free(threads, FALSE);
+ threads=NULL;
+}
+
+gint32 ves_icall_System_Threading_Interlocked_Increment_Int (gint32 *location)
+{
+ return InterlockedIncrement (location);
+}
+
+gint64 ves_icall_System_Threading_Interlocked_Increment_Long (gint64 *location)
+{
+ gint32 lowret;
+ gint32 highret;
+
+ EnterCriticalSection(&interlocked_mutex);
+
+ lowret = InterlockedIncrement((gint32 *) location);
+ if (0 == lowret)
+ highret = InterlockedIncrement((gint32 *) location + 1);
+ else
+ highret = *((gint32 *) location + 1);
+
+ LeaveCriticalSection(&interlocked_mutex);
+
+ return (gint64) highret << 32 | (gint64) lowret;
+}
+
+gint32 ves_icall_System_Threading_Interlocked_Decrement_Int (gint32 *location)
+{
+ return InterlockedDecrement(location);
+}
+
+gint64 ves_icall_System_Threading_Interlocked_Decrement_Long (gint64 * location)
+{
+ gint32 lowret;
+ gint32 highret;
+
+ EnterCriticalSection(&interlocked_mutex);
+
+ lowret = InterlockedDecrement((gint32 *) location);
+ if (-1 == lowret)
+ highret = InterlockedDecrement((gint32 *) location + 1);
+ else
+ highret = *((gint32 *) location + 1);
+
+ LeaveCriticalSection(&interlocked_mutex);
+
+ return (gint64) highret << 32 | (gint64) lowret;
+}
+
+gint32 ves_icall_System_Threading_Interlocked_Exchange_Int (gint32 *location1, gint32 value)
+{
+ return InterlockedExchange(location1, value);
+}
+
+MonoObject * ves_icall_System_Threading_Interlocked_Exchange_Object (MonoObject **location1, MonoObject *value)
+{
+ return (MonoObject *) InterlockedExchangePointer((gpointer *) location1, value);
+}
+
+gfloat ves_icall_System_Threading_Interlocked_Exchange_Single (gfloat *location1, gfloat value)
+{
+ IntFloatUnion val, ret;
+
+ val.fval = value;
+ ret.ival = InterlockedExchange((gint32 *) location1, val.ival);
+
+ return ret.fval;
+}
+
+gint32 ves_icall_System_Threading_Interlocked_CompareExchange_Int(gint32 *location1, gint32 value, gint32 comparand)
+{
+ return InterlockedCompareExchange(location1, value, comparand);
+}
+
+MonoObject * ves_icall_System_Threading_Interlocked_CompareExchange_Object (MonoObject **location1, MonoObject *value, MonoObject *comparand)
+{
+ return (MonoObject *) InterlockedCompareExchangePointer((gpointer *) location1, value, comparand);
+}
+
+gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single (gfloat *location1, gfloat value, gfloat comparand)
+{
+ IntFloatUnion val, ret, cmp;
+
+ val.fval = value;
+ cmp.fval = comparand;
+ ret.ival = InterlockedCompareExchange((gint32 *) location1, val.ival, cmp.ival);
+
+ return ret.fval;
+}
diff --git a/mono/metadata/threads.h b/mono/metadata/threads.h
new file mode 100644
index 00000000000..ab4d63c8f42
--- /dev/null
+++ b/mono/metadata/threads.h
@@ -0,0 +1,64 @@
+/*
+ * threads.h: Thread support internal calls
+ *
+ * Author:
+ * Dick Porter (dick@ximian.com)
+ * Patrik Torstensson (patrik.torstensson@labs2.com)
+ *
+ * (C) 2001 Ximian, Inc
+ */
+
+#ifndef _MONO_METADATA_THREADS_H_
+#define _MONO_METADATA_THREADS_H_
+
+#include <config.h>
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/appdomain.h>
+
+extern void mono_thread_init (MonoDomain *domain);
+extern void mono_thread_cleanup(void);
+
+MonoObject *mono_thread_create (MonoDomain *domain, gpointer func);
+
+extern HANDLE ves_icall_System_Threading_Thread_Thread_internal(MonoObject *this, MonoObject *start);
+extern void ves_icall_System_Threading_Thread_Start_internal(MonoObject *this, HANDLE thread);
+extern void ves_icall_System_Threading_Thread_Sleep_internal(int ms);
+extern MonoObject *ves_icall_System_Threading_Thread_CurrentThread_internal(void);
+extern MonoAppDomain * ves_icall_System_Threading_Thread_CurrentThreadDomain_internal(void);
+extern gboolean ves_icall_System_Threading_Thread_Join_internal(MonoObject *this, int ms, HANDLE thread);
+extern void ves_icall_System_Threading_Thread_SlotHash_store(MonoObject *data);
+extern MonoObject *ves_icall_System_Threading_Thread_SlotHash_lookup(void);
+extern gboolean ves_icall_System_Threading_Monitor_Monitor_try_enter(MonoObject *obj, int ms);
+extern void ves_icall_System_Threading_Monitor_Monitor_exit(MonoObject *obj);
+extern gboolean ves_icall_System_Threading_Monitor_Monitor_test_owner(MonoObject *obj);
+extern gboolean ves_icall_System_Threading_Monitor_Monitor_test_synchronised(MonoObject *obj);
+extern void ves_icall_System_Threading_Monitor_Monitor_pulse(MonoObject *obj);
+extern void ves_icall_System_Threading_Monitor_Monitor_pulse_all(MonoObject *obj);
+extern gboolean ves_icall_System_Threading_Monitor_Monitor_wait(MonoObject *obj, int ms);
+extern HANDLE ves_icall_System_Threading_Mutex_CreateMutex_internal(MonoBoolean owned,char *name);
+extern void ves_icall_System_Threading_Mutex_ReleaseMutex_internal(HANDLE handle);
+extern void ves_icall_System_Threading_Mutex_ReleaseMutex_internal (HANDLE handle );
+extern HANDLE ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual,MonoBoolean initial,char *name);
+extern gboolean ves_icall_System_Threading_Events_SetEvent_internal (HANDLE handle);
+extern gboolean ves_icall_System_Threading_Events_ResetEvent_internal (HANDLE handle);
+
+extern gboolean ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext);
+extern gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext);
+extern gboolean ves_icall_System_Threading_WaitHandle_WaitOne_internal(MonoObject *this, HANDLE handle, gint32 ms, gboolean exitContext);
+
+extern gint32 ves_icall_System_Threading_Interlocked_Increment_Int(gint32 *location);
+extern gint64 ves_icall_System_Threading_Interlocked_Increment_Long(gint64 *location);
+extern gint32 ves_icall_System_Threading_Interlocked_Decrement_Int(gint32 *location);
+extern gint64 ves_icall_System_Threading_Interlocked_Decrement_Long(gint64 * location);
+
+extern gint32 ves_icall_System_Threading_Interlocked_Exchange_Int(gint32 *location1, gint32 value);
+extern MonoObject *ves_icall_System_Threading_Interlocked_Exchange_Object(MonoObject **location1, MonoObject *value);
+extern gfloat ves_icall_System_Threading_Interlocked_Exchange_Single(gfloat *location1, gfloat value);
+
+extern gint32 ves_icall_System_Threading_Interlocked_CompareExchange_Int(gint32 *location1, gint32 value, gint32 comparand);
+extern MonoObject *ves_icall_System_Threading_Interlocked_CompareExchange_Object(MonoObject **location1, MonoObject *value, MonoObject *comparand);
+extern gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single(gfloat *location1, gfloat value, gfloat comparand);
+
+
+#endif /* _MONO_METADATA_THREADS_H_ */
diff --git a/mono/metadata/tokentype.h b/mono/metadata/tokentype.h
new file mode 100644
index 00000000000..b99b173923a
--- /dev/null
+++ b/mono/metadata/tokentype.h
@@ -0,0 +1,39 @@
+#ifndef _MONO_METADATA_TOKENTYPE_H_
+#define _MONO_METADATA_TOKENTYPE_H_
+
+/*
+ * These tokens match the table ID except for the last
+ * three (string, name and base type which are special)
+ */
+
+typedef enum {
+ MONO_TOKEN_MODULE = 0x00000000,
+ MONO_TOKEN_TYPE_REF = 0x01000000,
+ MONO_TOKEN_TYPE_DEF = 0x02000000,
+ MONO_TOKEN_FIELD_DEF = 0x04000000,
+ MONO_TOKEN_METHOD_DEF = 0x06000000,
+ MONO_TOKEN_PARAM_DEF = 0x08000000,
+ MONO_TOKEN_INTERFACE_IMPL = 0x09000000,
+ MONO_TOKEN_MEMBER_REF = 0x0a000000,
+ MONO_TOKEN_CUSTOM_ATTRIBUTE = 0x0c000000,
+ MONO_TOKEN_PERMISSION = 0x0e000000,
+ MONO_TOKEN_SIGNATURE = 0x11000000,
+ MONO_TOKEN_EVENT = 0x14000000,
+ MONO_TOKEN_PROPERTY = 0x17000000,
+ MONO_TOKEN_MODULE_REF = 0x1a000000,
+ MONO_TOKEN_TYPE_SPEC = 0x1b000000,
+ MONO_TOKEN_ASSEMBLY = 0x20000000,
+ MONO_TOKEN_ASSEMBLY_REF = 0x23000000,
+ MONO_TOKEN_FILE = 0x26000000,
+ MONO_TOKEN_EXPORTED_TYPE = 0x27000000,
+ MONO_TOKEN_MANIFEST_RESOURCE = 0x28000000,
+
+ /*
+ * These do not match metadata tables directly
+ */
+ MONO_TOKEN_STRING = 0x70000000,
+ MONO_TOKEN_NAME = 0x71000000,
+ MONO_TOKEN_BASE_TYPE = 0x72000000
+} MonoTokenType;
+
+#endif /* _MONO_METADATA_TOKENTYPE_H_ */
diff --git a/mono/metadata/typedef.c b/mono/metadata/typedef.c
new file mode 100644
index 00000000000..f488ec25745
--- /dev/null
+++ b/mono/metadata/typedef.c
@@ -0,0 +1,54 @@
+/*
+ * typedef.c: Handling of TypeDefs.
+ *
+ * Author:
+ * Miguel de Icaza (miguel@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+#include <config.h>
+#include <mono/metadata/typedef.h>
+
+/**
+ * mono_typedef_decode:
+ * @image: image to decode from
+ * @tidx: typedef number
+ *
+ * Decodes the TypeDef whose index is @tidx in @image
+ */
+void
+mono_typedef_decode (MonoImage *image, guint32 tidx, MonoTypedef *ret)
+{
+ MonoMetadata *m = &image->metadata;
+ MonoTableInfo *tt = m->tables [MONO_TABLE_TYPEDEF];
+ int next_is_valid;
+ guint32 cols_next [MONO_TYPEDEF_SIZE];
+ guint last;
+
+ g_assert (typedef_token < tt->rows);
+
+ mono_metadata_decode_row (tt, typedef_idx, &ret->cols, CSIZE (ret->cols));
+
+ /*
+ * Get the field and method range
+ */
+ ret->field.first = ret->cols [MONO_TYPEREF_FIELD_LIST] - 1;
+ ret->method.first = ret->cols [MONO_TYPEDEF_METHOD_LIST] - 1;
+
+ if (tt->rows > typedef_idx + 1){
+ mono_metadata_decode_row (tt, typedef_idx + 1, cols_next, CSIZE (cols_next));
+ ret->field.last = cols_next [MONO_TYPEREF_FIELD_LIST] - 1;
+ ret->method.last = cols_next [MONO_TYPEREF_FIELD_LIST] - 1;
+ } else {
+ ret->field.last = m->tables [MONO_TABLE_FIELD].rows;
+ ret->field.method = m->tables [MONO_TABLE_METHOD].rows;
+ }
+
+ /*
+ * Get the method range
+ */
+ ref
+
+}
+
+
diff --git a/mono/metadata/unicode.c b/mono/metadata/unicode.c
new file mode 100644
index 00000000000..158403def15
--- /dev/null
+++ b/mono/metadata/unicode.c
@@ -0,0 +1,464 @@
+/*
+ * unicode.h: Unicode support
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <config.h>
+#include <glib.h>
+#include <errno.h>
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/unicode.h>
+
+#if HAVE_ICONV_H
+#include <iconv.h>
+#elif HAVE_GICONV_H
+#include <giconv.h>
+#endif
+
+static MonoUnicodeCategory catmap[] = {
+ /* G_UNICODE_CONTROL = */ Control,
+ /* G_UNICODE_FORMAT = */ Format,
+ /* G_UNICODE_UNASSIGNED = */ OtherNotAssigned,
+ /* G_UNICODE_PRIVATE_USE = */ PrivateUse,
+ /* G_UNICODE_SURROGATE = */ Surrogate,
+ /* G_UNICODE_LOWERCASE_LETTER = */ LowercaseLetter,
+ /* G_UNICODE_MODIFIER_LETTER = */ ModifierLetter,
+ /* G_UNICODE_OTHER_LETTER = */ OtherLetter,
+ /* G_UNICODE_TITLECASE_LETTER = */ TitlecaseLetter,
+ /* G_UNICODE_UPPERCASE_LETTER = */ UppercaseLetter,
+ /* G_UNICODE_COMBINING_MARK = */ SpaceCombiningMark,
+ /* G_UNICODE_ENCLOSING_MARK = */ EnclosingMark,
+ /* G_UNICODE_NON_SPACING_MARK = */ NonSpacingMark,
+ /* G_UNICODE_DECIMAL_NUMBER = */ DecimalDigitNumber,
+ /* G_UNICODE_LETTER_NUMBER = */ LetterNumber,
+ /* G_UNICODE_OTHER_NUMBER = */ OtherNumber,
+ /* G_UNICODE_CONNECT_PUNCTUATION = */ ConnectorPunctuation,
+ /* G_UNICODE_DASH_PUNCTUATION = */ DashPunctuation,
+ /* G_UNICODE_CLOSE_PUNCTUATION = */ ClosePunctuation,
+ /* G_UNICODE_FINAL_PUNCTUATION = */ FinalQuotePunctuation,
+ /* G_UNICODE_INITIAL_PUNCTUATION = */ InitialQuotePunctuation,
+ /* G_UNICODE_OTHER_PUNCTUATION = */ OtherPunctuation,
+ /* G_UNICODE_OPEN_PUNCTUATION = */ OpenPunctuation,
+ /* G_UNICODE_CURRENCY_SYMBOL = */ CurrencySymbol,
+ /* G_UNICODE_MODIFIER_SYMBOL = */ ModifierSymbol,
+ /* G_UNICODE_MATH_SYMBOL = */ MathSymbol,
+ /* G_UNICODE_OTHER_SYMBOL = */ OtherSymbol,
+ /* G_UNICODE_LINE_SEPARATOR = */ LineSeperator,
+ /* G_UNICODE_PARAGRAPH_SEPARATOR = */ ParagraphSeperator,
+ /* G_UNICODE_SPACE_SEPARATOR = */ SpaceSeperator,
+};
+
+double
+ves_icall_System_Char_GetNumericValue (gunichar2 c)
+{
+ return (double)g_unichar_digit_value (c);
+}
+
+MonoUnicodeCategory
+ves_icall_System_Char_GetUnicodeCategory (gunichar2 c)
+{
+ return catmap [g_unichar_type (c)];
+}
+
+gboolean
+ves_icall_System_Char_IsControl (gunichar2 c)
+{
+ return g_unichar_iscntrl (c);
+}
+
+gboolean
+ves_icall_System_Char_IsDigit (gunichar2 c)
+{
+ return g_unichar_isdigit (c);
+}
+
+gboolean
+ves_icall_System_Char_IsLetter (gunichar2 c)
+{
+ return g_unichar_isalpha (c);
+}
+
+gboolean
+ves_icall_System_Char_IsLower (gunichar2 c)
+{
+ return g_unichar_islower (c);
+}
+
+gboolean
+ves_icall_System_Char_IsUpper (gunichar2 c)
+{
+ return g_unichar_isupper (c);
+}
+
+gboolean
+ves_icall_System_Char_IsNumber (gunichar2 c)
+{
+ return g_unichar_isxdigit (c);
+}
+
+gboolean
+ves_icall_System_Char_IsPunctuation (gunichar2 c)
+{
+ return g_unichar_ispunct (c);
+}
+
+gboolean
+ves_icall_System_Char_IsSeparator (gunichar2 c)
+{
+ GUnicodeType t = g_unichar_type (c);
+
+ return (t == G_UNICODE_LINE_SEPARATOR ||
+ t == G_UNICODE_PARAGRAPH_SEPARATOR ||
+ t == G_UNICODE_SPACE_SEPARATOR);
+}
+
+gboolean
+ves_icall_System_Char_IsSurrogate (gunichar2 c)
+{
+ return (g_unichar_type (c) == G_UNICODE_SURROGATE);
+}
+
+gboolean
+ves_icall_System_Char_IsSymbol (gunichar2 c)
+{
+ GUnicodeType t = g_unichar_type (c);
+
+ return (t == G_UNICODE_CURRENCY_SYMBOL ||
+ t == G_UNICODE_MODIFIER_SYMBOL ||
+ t == G_UNICODE_MATH_SYMBOL ||
+ t == G_UNICODE_OTHER_SYMBOL);
+}
+
+gboolean
+ves_icall_System_Char_IsWhiteSpace (gunichar2 c)
+{
+ return g_unichar_isspace (c);
+}
+
+gunichar2
+ves_icall_System_Char_ToLower (gunichar2 c)
+{
+ return g_unichar_tolower (c);
+}
+
+gunichar2
+ves_icall_System_Char_ToUpper (gunichar2 c)
+{
+ return g_unichar_toupper (c);
+}
+
+gpointer
+ves_icall_iconv_new_encoder (MonoString *name, MonoBoolean big_endian)
+{
+ iconv_t cd;
+ char *n;
+
+ // fixme: don't enforce big endian, support old iconv
+
+ g_assert (name);
+
+ n = mono_string_to_utf8 (name);
+
+ /* force big endian before class libraries are fixed */
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+ big_endian = 1;
+#endif
+
+#ifdef HAVE_NEW_ICONV
+ cd = iconv_open (n, big_endian ? "UTF-16be" : "UTF-16le");
+#else
+ cd = iconv_open (n, "UTF-16");
+#endif
+ g_assert (cd != (iconv_t)-1);
+ g_free (n);
+
+ return (gpointer)cd;
+}
+
+gpointer
+ves_icall_iconv_new_decoder (MonoString *name, MonoBoolean big_endian)
+{
+ iconv_t cd;
+ char *n;
+
+ // fixme: don't enforce big endian, support old iconv
+
+ g_assert (name);
+
+ n = mono_string_to_utf8 (name);
+
+ /* force big endian before class libraries are fixed */
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+ big_endian = 1;
+#endif
+
+#ifdef HAVE_NEW_ICONV
+ cd = iconv_open (big_endian ? "UTF-16be" : "UTF-16le", n);
+#else
+ cd = iconv_open ("UTF-16", n);
+#endif
+ g_assert (cd != (iconv_t)-1);
+ g_free (n);
+
+ return (gpointer)cd;
+}
+
+void
+ves_icall_iconv_reset (gpointer converter)
+{
+ iconv_t cd = (iconv_t)converter;
+
+ g_assert (cd);
+
+ iconv(cd, NULL, NULL, NULL, NULL);
+}
+
+static int
+iconv_get_length (iconv_t cd, guchar *src, int len, gboolean encode)
+{
+ guchar buf [512];
+ int res;
+ guchar *outp;
+ guchar *p;
+ guint inbytes_remaining;
+ guint outbytes_remaining;
+ guint outbuf_size;
+ gboolean have_error = FALSE;
+ size_t err;
+
+ g_assert (cd);
+ g_assert (src);
+
+#ifndef HAVE_NEW_ICONV
+ if (G_BYTE_ORDER == G_LITTLE_ENDIAN && encode) {
+ int i;
+
+ src = g_memdup (src, len);
+ for (i = 0; i < len; i += 2) {
+ char t = src [i];
+ src [i] = src [i + 1];
+ src [i + 1] = t;
+ }
+ }
+#endif
+
+ p = src;
+ inbytes_remaining = len;
+ res = 0;
+
+again:
+ outbuf_size = 512;
+ outbytes_remaining = outbuf_size;
+ outp = buf;
+
+ err = iconv (cd, (char **)&p, &inbytes_remaining,
+ (char **)&outp, &outbytes_remaining);
+
+ if(err == (size_t)-1) {
+ switch(errno) {
+ case EINVAL:
+ /* Incomplete text, do not report an error */
+ break;
+ case E2BIG: {
+ res += outp - buf;
+ goto again;
+ }
+ case EILSEQ:
+ have_error = TRUE;
+ break;
+ default:
+ have_error = TRUE;
+ break;
+ }
+ }
+
+ res += outp - buf;
+
+ if((p - src) != len) {
+ if(!have_error) {
+ have_error = TRUE;
+ }
+ }
+
+#ifndef HAVE_NEW_ICONV
+ if (G_BYTE_ORDER == G_LITTLE_ENDIAN && encode)
+ g_free (src);
+#endif
+
+ if (have_error) {
+ g_assert_not_reached ();
+ return 0;
+ } else {
+ return res;
+ }
+}
+
+int
+ves_icall_iconv_get_byte_count (gpointer converter, MonoArray *chars, gint32 idx, gint32 count)
+{
+ iconv_t cd = (iconv_t)converter;
+ guchar *src;
+ int len;
+
+ g_assert (cd);
+ g_assert (chars);
+ g_assert (mono_array_length (chars) > idx);
+ g_assert (mono_array_length (chars) >= (idx + count));
+
+ if (!(len = (mono_array_length (chars) - idx) * 2))
+ return 0;
+
+ src = mono_array_addr (chars, guint16, idx);
+
+ return iconv_get_length (cd, src, len, TRUE);
+}
+
+static int
+iconv_convert (iconv_t cd, guchar *src, int len, guchar *dest, int max_len, gboolean encode)
+{
+ guchar *p, *outp;
+ guint inbytes_remaining;
+ guint outbytes_remaining;
+ guint outbuf_size;
+ gboolean have_error = FALSE;
+ size_t err;
+
+ g_assert (cd);
+ g_assert (src);
+ g_assert (dest);
+
+#ifndef HAVE_NEW_ICONV
+ if (G_BYTE_ORDER == G_LITTLE_ENDIAN && encode) {
+ int i;
+
+ src = g_memdup (src, len);
+ for (i = 0; i < len; i += 2) {
+ char t = src [i];
+ src [i] = src [i + 1];
+ src [i + 1] = t;
+ }
+ }
+#endif
+
+ p = src;
+ inbytes_remaining = len;
+ outbuf_size = max_len;
+
+ outbytes_remaining = outbuf_size;
+ outp = dest;
+
+ err = iconv (cd, (char **)&p, &inbytes_remaining, (char **)&outp, &outbytes_remaining);
+
+ if(err == (size_t)-1) {
+ if (errno == EINVAL) {
+ /* Incomplete text, do not report an error */
+ } else {
+ have_error = TRUE;
+ }
+ }
+
+ if ((p - src) != len) {
+ if (!have_error) {
+ have_error = TRUE;
+ }
+ }
+
+#ifndef HAVE_NEW_ICONV
+ if (G_BYTE_ORDER == G_LITTLE_ENDIAN) {
+ if (encode) {
+ g_free (src);
+ } else {
+ int mb = max_len - outbytes_remaining;
+ int i;
+ for (i = 0; i < mb; i+=2) {
+ char t = dest [i];
+ dest [i] = dest [i + 1];
+ dest [i + 1] = t;
+ }
+ }
+}
+#endif
+ if (have_error) {
+ g_assert_not_reached ();
+ return 0;
+ } else {
+ /* we return the number of bytes written in dest */
+ return max_len - outbytes_remaining;
+ }
+}
+
+int
+ves_icall_iconv_get_bytes (gpointer converter, MonoArray *chars, gint32 charIndex, gint32 charCount,
+ MonoArray *bytes, gint32 byteIndex)
+{
+ iconv_t cd = (iconv_t)converter;
+ guchar *src, *dest;
+ int len, max_len;
+
+ if (!charCount)
+ return 0;
+
+ g_assert (cd);
+ g_assert (chars);
+ g_assert (bytes);
+ g_assert (mono_array_length (chars) > charIndex);
+ g_assert (mono_array_length (chars) >= (charIndex + charCount));
+ g_assert (mono_array_length (bytes) > byteIndex);
+ g_assert (mono_array_length (chars) >= (byteIndex + charCount));
+
+ if (!(len = (mono_array_length (chars) - charIndex) * 2))
+ return 0;
+
+ src = mono_array_addr (chars, guint16, charIndex);
+ dest = mono_array_addr (bytes, char, byteIndex);
+
+ max_len = mono_array_length (bytes) - byteIndex;
+
+ return iconv_convert (cd, src, len, dest, max_len, TRUE);
+}
+
+int
+ves_icall_iconv_get_char_count (gpointer converter, MonoArray *bytes, gint32 idx, gint32 count)
+{
+ iconv_t cd = (iconv_t)converter;
+ guchar *src;
+
+ g_assert (cd);
+ g_assert (bytes);
+ g_assert (mono_array_length (bytes) > idx);
+ g_assert (mono_array_length (bytes) >= (idx + count));
+
+ src = mono_array_addr (bytes, char, idx);
+
+ /* iconv_get_length () returns the number of bytes */
+ return iconv_get_length (cd, src, (int) count, FALSE) / 2;
+}
+
+int
+ves_icall_iconv_get_chars (gpointer converter, MonoArray *bytes, gint32 byteIndex, gint32 byteCount,
+ MonoArray *chars, gint32 charIndex)
+{
+ iconv_t cd = (iconv_t)converter;
+ guchar *src, *dest;
+ int max_len;
+
+ g_assert (cd);
+ g_assert (chars);
+ g_assert (bytes);
+ g_assert (mono_array_length (bytes) > byteIndex);
+ g_assert (mono_array_length (chars) >= (byteIndex + byteCount));
+ g_assert (mono_array_length (chars) > charIndex);
+
+ src = mono_array_addr (bytes, char, byteIndex);
+ dest = mono_array_addr (chars, guint16, charIndex);
+
+ max_len = (mono_array_length (chars) - charIndex) * 2;
+
+ /* iconv_convert () returns the number of bytes */
+ return iconv_convert (cd, src, (int) byteCount, dest, max_len, FALSE) / 2;
+}
diff --git a/mono/metadata/unicode.h b/mono/metadata/unicode.h
new file mode 100644
index 00000000000..f954e02da7c
--- /dev/null
+++ b/mono/metadata/unicode.h
@@ -0,0 +1,123 @@
+/*
+ * unicode.h: Unicode support
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#ifndef _MONO_METADATA_UNICODE_H_
+#define _MONO_METADATA_UNICODE_H_
+
+#include <config.h>
+#include <glib.h>
+
+#include <mono/metadata/object.h>
+
+typedef enum {
+ UppercaseLetter = 0,
+ LowercaseLetter = 1,
+ TitlecaseLetter = 2,
+ ModifierLetter = 3,
+ OtherLetter = 4,
+ NonSpacingMark = 5,
+ SpaceCombiningMark = 6,
+ EnclosingMark = 7,
+ DecimalDigitNumber = 8,
+ LetterNumber = 9,
+ OtherNumber = 10,
+ SpaceSeperator = 11,
+ LineSeperator = 12,
+ ParagraphSeperator = 13,
+ Control = 14,
+ Format = 15,
+ Surrogate = 16,
+ PrivateUse = 17,
+ ConnectorPunctuation = 18,
+ DashPunctuation = 19,
+ OpenPunctuation = 20,
+ ClosePunctuation = 21,
+ InitialQuotePunctuation = 22,
+ FinalQuotePunctuation = 23,
+ OtherPunctuation = 24,
+ MathSymbol = 25,
+ CurrencySymbol = 26,
+ ModifierSymbol = 27,
+ OtherSymbol = 28,
+ OtherNotAssigned = 29,
+} MonoUnicodeCategory;
+
+double
+ves_icall_System_Char_GetNumericValue (gunichar2 c);
+
+MonoUnicodeCategory
+ves_icall_System_Char_GetUnicodeCategory (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsControl (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsDigit (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsLetter (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsLower (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsUpper (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsNumber (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsPunctuation (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsSeparator (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsSurrogate (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsSymbol (gunichar2 c);
+
+gboolean
+ves_icall_System_Char_IsWhiteSpace (gunichar2 c);
+
+gunichar2
+ves_icall_System_Char_ToLower (gunichar2 c);
+
+gunichar2
+ves_icall_System_Char_ToUpper (gunichar2 c);
+
+gpointer
+ves_icall_iconv_new_encoder (MonoString *name, MonoBoolean big_endian);
+
+gpointer
+ves_icall_iconv_new_decoder (MonoString *name, MonoBoolean big_endian);
+
+void
+ves_icall_iconv_reset (gpointer converter);
+
+int
+ves_icall_iconv_get_byte_count (gpointer converter, MonoArray *chars,
+ gint32 idx, gint32 count);
+
+int
+ves_icall_iconv_get_bytes (gpointer converter, MonoArray *chars,
+ gint32 charIndex, gint32 charCount,
+ MonoArray *bytes, gint32 byteIndex);
+
+int
+ves_icall_iconv_get_char_count (gpointer converter, MonoArray *bytes,
+ gint32 idx, gint32 count);
+
+int
+ves_icall_iconv_get_chars (gpointer converter, MonoArray *bytes,
+ gint32 byteIndex, gint32 byteCount,
+ MonoArray *chars, gint32 charIndex);
+
+#endif
diff --git a/mono/metadata/verify.c b/mono/metadata/verify.c
new file mode 100644
index 00000000000..024401712d1
--- /dev/null
+++ b/mono/metadata/verify.c
@@ -0,0 +1,2067 @@
+
+#include <mono/metadata/object.h>
+#include <mono/metadata/verify.h>
+#include <mono/metadata/opcodes.h>
+#include <mono/metadata/tabledefs.h>
+#include <mono/metadata/reflection.h>
+#include <mono/metadata/mono-endian.h>
+#include <string.h>
+#include <signal.h>
+#include <ctype.h>
+
+/*
+ * Pull the list of opcodes
+ */
+#define OPDEF(a,b,c,d,e,f,g,h,i,j) \
+ a = i,
+
+enum {
+#include "mono/cil/opcode.def"
+ LAST = 0xff
+};
+#undef OPDEF
+
+void
+mono_free_verify_list (GSList *list)
+{
+ MonoVerifyInfo* info;
+ GSList *tmp;
+
+ for (tmp = list; tmp; tmp = tmp->next) {
+ info = tmp->data;
+ g_free (info->message);
+ g_free (info);
+ }
+ g_slist_free (list);
+}
+
+#define ADD_ERROR(list,msg) \
+ do { \
+ MonoVerifyInfo *vinfo = g_new (MonoVerifyInfo, 1); \
+ vinfo->status = MONO_VERIFY_ERROR; \
+ vinfo->message = (msg); \
+ (list) = g_slist_prepend ((list), vinfo); \
+ } while (0)
+
+#define ADD_WARN(list,code,msg) \
+ do { \
+ MonoVerifyInfo *vinfo = g_new (MonoVerifyInfo, 1); \
+ vinfo->status = (code); \
+ vinfo->message = (msg); \
+ (list) = g_slist_prepend ((list), vinfo); \
+ } while (0)
+
+static const char* const
+valid_cultures[] = {
+ "ar-SA", "ar-IQ", "ar-EG", "ar-LY",
+ "ar-DZ", "ar-MA", "ar-TN", "ar-OM",
+ "ar-YE", "ar-SY", "ar-JO", "ar-LB",
+ "ar-KW", "ar-AE", "ar-BH", "ar-QA",
+ "bg-BG", "ca-ES", "zh-TW", "zh-CN",
+ "zh-HK", "zh-SG", "zh-MO", "cs-CZ",
+ "da-DK", "de-DE", "de-CH", "de-AT",
+ "de-LU", "de-LI", "el-GR", "en-US",
+ "en-GB", "en-AU", "en-CA", "en-NZ",
+ "en-IE", "en-ZA", "en-JM", "en-CB",
+ "en-BZ", "en-TT", "en-ZW", "en-PH",
+ "es-ES-Ts", "es-MX", "es-ES-Is", "es-GT",
+ "es-CR", "es-PA", "es-DO", "es-VE",
+ "es-CO", "es-PE", "es-AR", "es-EC",
+ "es-CL", "es-UY", "es-PY", "es-BO",
+ "es-SV", "es-HN", "es-NI", "es-PR",
+ "Fi-FI", "fr-FR", "fr-BE", "fr-CA",
+ "Fr-CH", "fr-LU", "fr-MC", "he-IL",
+ "hu-HU", "is-IS", "it-IT", "it-CH",
+ "Ja-JP", "ko-KR", "nl-NL", "nl-BE",
+ "nb-NO", "nn-NO", "pl-PL", "pt-BR",
+ "pt-PT", "ro-RO", "ru-RU", "hr-HR",
+ "Lt-sr-SP", "Cy-sr-SP", "sk-SK", "sq-AL",
+ "sv-SE", "sv-FI", "th-TH", "tr-TR",
+ "ur-PK", "id-ID", "uk-UA", "be-BY",
+ "sl-SI", "et-EE", "lv-LV", "lt-LT",
+ "fa-IR", "vi-VN", "hy-AM", "Lt-az-AZ",
+ "Cy-az-AZ",
+ "eu-ES", "mk-MK", "af-ZA",
+ "ka-GE", "fo-FO", "hi-IN", "ms-MY",
+ "ms-BN", "kk-KZ", "ky-KZ", "sw-KE",
+ "Lt-uz-UZ", "Cy-uz-UZ", "tt-TA", "pa-IN",
+ "gu-IN", "ta-IN", "te-IN", "kn-IN",
+ "mr-IN", "sa-IN", "mn-MN", "gl-ES",
+ "kok-IN", "syr-SY", "div-MV",
+ NULL
+};
+
+static int
+is_valid_culture (const char *cname)
+{
+ int i;
+ int found;
+
+ found = *cname == 0;
+ for (i = 0; !found && valid_cultures [i]; ++i) {
+ if (g_strcasecmp (valid_cultures [i], cname))
+ found = 1;
+ }
+ return found;
+}
+
+static int
+is_valid_assembly_flags (guint32 flags) {
+ /* Metadata: 22.1.2 */
+ flags &= ~(0x8000 | 0x4000); /* ignore reserved bits 0x0030? */
+ return ((flags == 1) || (flags == 0));
+}
+
+static int
+is_valid_blob (MonoImage *image, guint32 blob_index, int notnull)
+{
+ guint32 size;
+ const char *p, *blob_end;
+
+ if (blob_index >= image->heap_blob.size)
+ return 0;
+ p = mono_metadata_blob_heap (image, blob_index);
+ size = mono_metadata_decode_blob_size (p, &blob_end);
+ if (blob_index + size + (blob_end-p) > image->heap_blob.size)
+ return 0;
+ if (notnull && !size)
+ return 0;
+ return 1;
+}
+
+static const char*
+is_valid_string (MonoImage *image, guint32 str_index, int notnull)
+{
+ const char *p, *blob_end, *res;
+
+ if (str_index >= image->heap_strings.size)
+ return NULL;
+ res = p = mono_metadata_string_heap (image, str_index);
+ blob_end = mono_metadata_string_heap (image, image->heap_strings.size - 1);
+ if (notnull && !*p)
+ return 0;
+ /*
+ * FIXME: should check it's a valid utf8 string, too.
+ */
+ while (p <= blob_end) {
+ if (!*p)
+ return res;
+ ++p;
+ }
+ return *p? NULL: res;
+}
+
+static int
+is_valid_cls_ident (const char *p)
+{
+ /*
+ * FIXME: we need the full unicode glib support for this.
+ * Check: http://www.unicode.org/unicode/reports/tr15/Identifier.java
+ * We do the lame thing for now.
+ */
+ if (!isalpha (*p))
+ return 0;
+ ++p;
+ while (*p) {
+ if (!isalnum (*p) && *p != '_')
+ return 0;
+ ++p;
+ }
+ return 1;
+}
+
+static int
+is_valid_filename (const char *p)
+{
+ if (!*p)
+ return 0;
+ return strpbrk (p, "\\//:")? 0: 1;
+}
+
+static GSList*
+verify_assembly_table (MonoImage *image, GSList *list, int level)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_ASSEMBLY];
+ guint32 cols [MONO_ASSEMBLY_SIZE];
+ const char *p;
+
+ if (level & MONO_VERIFY_ERROR) {
+ if (t->rows > 1)
+ ADD_ERROR (list, g_strdup ("Assembly table may only have 0 or 1 rows"));
+ mono_metadata_decode_row (t, 0, cols, MONO_ASSEMBLY_SIZE);
+
+ switch (cols [MONO_ASSEMBLY_HASH_ALG]) {
+ case ASSEMBLY_HASH_NONE:
+ case ASSEMBLY_HASH_MD5:
+ case ASSEMBLY_HASH_SHA1:
+ break;
+ default:
+ ADD_ERROR (list, g_strdup_printf ("Hash algorithm 0x%x unknown", cols [MONO_ASSEMBLY_HASH_ALG]));
+ }
+
+ if (!is_valid_assembly_flags (cols [MONO_ASSEMBLY_FLAGS]))
+ ADD_ERROR (list, g_strdup_printf ("Invalid flags in assembly: 0x%x", cols [MONO_ASSEMBLY_FLAGS]));
+
+ if (!is_valid_blob (image, cols [MONO_ASSEMBLY_PUBLIC_KEY], FALSE))
+ ADD_ERROR (list, g_strdup ("Assembly public key is an invalid index"));
+
+ if (!(p = is_valid_string (image, cols [MONO_ASSEMBLY_NAME], TRUE))) {
+ ADD_ERROR (list, g_strdup ("Assembly name is invalid"));
+ } else {
+ if (strpbrk (p, ":\\/."))
+ ADD_ERROR (list, g_strdup_printf ("Assembly name `%s' contains invalid chars", p));
+ }
+
+ if (!(p = is_valid_string (image, cols [MONO_ASSEMBLY_CULTURE], FALSE))) {
+ ADD_ERROR (list, g_strdup ("Assembly culture is an invalid index"));
+ } else {
+ if (!is_valid_culture (p))
+ ADD_ERROR (list, g_strdup_printf ("Assembly culture `%s' is invalid", p));
+ }
+ }
+ return list;
+}
+
+static GSList*
+verify_assemblyref_table (MonoImage *image, GSList *list, int level)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_ASSEMBLYREF];
+ guint32 cols [MONO_ASSEMBLYREF_SIZE];
+ const char *p;
+ int i;
+
+ if (level & MONO_VERIFY_ERROR) {
+ for (i = 0; i < t->rows; ++i) {
+ mono_metadata_decode_row (t, i, cols, MONO_ASSEMBLYREF_SIZE);
+ if (!is_valid_assembly_flags (cols [MONO_ASSEMBLYREF_FLAGS]))
+ ADD_ERROR (list, g_strdup_printf ("Invalid flags in assemblyref row %d: 0x%x", i + 1, cols [MONO_ASSEMBLY_FLAGS]));
+
+ if (!is_valid_blob (image, cols [MONO_ASSEMBLYREF_PUBLIC_KEY], FALSE))
+ ADD_ERROR (list, g_strdup_printf ("AssemblyRef public key in row %d is an invalid index", i + 1));
+
+ if (!(p = is_valid_string (image, cols [MONO_ASSEMBLYREF_CULTURE], FALSE))) {
+ ADD_ERROR (list, g_strdup_printf ("AssemblyRef culture in row %d is invalid", i + 1));
+ } else {
+ if (!is_valid_culture (p))
+ ADD_ERROR (list, g_strdup_printf ("AssemblyRef culture `%s' in row %d is invalid", p, i + 1));
+ }
+
+ if (cols [MONO_ASSEMBLYREF_HASH_VALUE] && !is_valid_blob (image, cols [MONO_ASSEMBLYREF_HASH_VALUE], TRUE))
+ ADD_ERROR (list, g_strdup_printf ("AssemblyRef hash value in row %d is invalid or not null and empty", i + 1));
+ }
+ }
+ if (level & MONO_VERIFY_WARNING) {
+ /* check for duplicated rows */
+ for (i = 0; i < t->rows; ++i) {
+ }
+ }
+ return list;
+}
+
+static GSList*
+verify_class_layout_table (MonoImage *image, GSList *list, int level)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_CLASSLAYOUT];
+ MonoTableInfo *tdef = &image->tables [MONO_TABLE_TYPEDEF];
+ guint32 cols [MONO_CLASS_LAYOUT_SIZE];
+ guint32 value, i;
+
+ if (level & MONO_VERIFY_ERROR) {
+ for (i = 0; i < t->rows; ++i) {
+ mono_metadata_decode_row (t, i, cols, MONO_CLASS_LAYOUT_SIZE);
+
+ if (cols [MONO_CLASS_LAYOUT_PARENT] > tdef->rows || !cols [MONO_CLASS_LAYOUT_PARENT]) {
+ ADD_ERROR (list, g_strdup_printf ("Parent in class layout is invalid in row %d", i + 1));
+ } else {
+ value = mono_metadata_decode_row_col (tdef, cols [MONO_CLASS_LAYOUT_PARENT] - 1, MONO_TYPEDEF_FLAGS);
+ if (value & TYPE_ATTRIBUTE_INTERFACE)
+ ADD_ERROR (list, g_strdup_printf ("Parent in class layout row %d is an interface", i + 1));
+ if (value & TYPE_ATTRIBUTE_AUTO_LAYOUT)
+ ADD_ERROR (list, g_strdup_printf ("Parent in class layout row %d is AutoLayout", i + 1));
+ if (value & TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT) {
+ switch (cols [MONO_CLASS_LAYOUT_PACKING_SIZE]) {
+ case 0: case 1: case 2: case 4: case 8: case 16:
+ case 32: case 64: case 128: break;
+ default:
+ ADD_ERROR (list, g_strdup_printf ("Packing size %d in class layout row %d is invalid", cols [MONO_CLASS_LAYOUT_PACKING_SIZE], i + 1));
+ }
+ } else if (value & TYPE_ATTRIBUTE_EXPLICIT_LAYOUT) {
+ /*
+ * FIXME: LAMESPEC: it claims it must be 0 (it's 1, instead).
+ if (cols [MONO_CLASS_LAYOUT_PACKING_SIZE])
+ ADD_ERROR (list, g_strdup_printf ("Packing size %d in class layout row %d is invalid with explicit layout", cols [MONO_CLASS_LAYOUT_PACKING_SIZE], i + 1));
+ */
+ }
+ /*
+ * FIXME: we need to check that if class size != 0,
+ * it needs to be greater than the class calculated size.
+ * If parent is a valuetype it also needs to be smaller than
+ * 1 MByte (0x100000 bytes).
+ * To do both these checks we need to load the referenced
+ * assemblies, though (the spec claims we didn't have to, bah).
+ */
+ /*
+ * We need to check that the parent types have the samme layout
+ * type as well.
+ */
+ }
+ }
+ }
+
+ return list;
+}
+
+static GSList*
+verify_constant_table (MonoImage *image, GSList *list, int level)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_CONSTANT];
+ guint32 cols [MONO_CONSTANT_SIZE];
+ guint32 value, i;
+ GHashTable *dups = g_hash_table_new (g_direct_hash, g_direct_equal);
+
+ for (i = 0; i < t->rows; ++i) {
+ mono_metadata_decode_row (t, i, cols, MONO_CONSTANT_SIZE);
+
+ if (level & MONO_VERIFY_ERROR)
+ if (g_hash_table_lookup (dups, GUINT_TO_POINTER (cols [MONO_CONSTANT_PARENT])))
+ ADD_ERROR (list, g_strdup_printf ("Parent 0x%08x is duplicated in Constant row %d", cols [MONO_CONSTANT_PARENT], i + 1));
+ g_hash_table_insert (dups, GUINT_TO_POINTER (cols [MONO_CONSTANT_PARENT]),
+ GUINT_TO_POINTER (cols [MONO_CONSTANT_PARENT]));
+
+ switch (cols [MONO_CONSTANT_TYPE]) {
+ case MONO_TYPE_U1: /* LAMESPEC: it says I1...*/
+ case MONO_TYPE_U2:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_U8:
+ if (level & MONO_VERIFY_CLS)
+ ADD_WARN (list, MONO_VERIFY_CLS, g_strdup_printf ("Type 0x%x not CLS compliant in Constant row %d", cols [MONO_CONSTANT_TYPE], i + 1));
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_CLASS:
+ break;
+ default:
+ if (level & MONO_VERIFY_ERROR)
+ ADD_ERROR (list, g_strdup_printf ("Type 0x%x is invalid in Constant row %d", cols [MONO_CONSTANT_TYPE], i + 1));
+ }
+ if (level & MONO_VERIFY_ERROR) {
+ value = cols [MONO_CONSTANT_PARENT] >> HASCONSTANT_BITS;
+ switch (cols [MONO_CONSTANT_PARENT] & HASCONSTANT_MASK) {
+ case HASCONSTANT_FIEDDEF:
+ if (value > image->tables [MONO_TABLE_FIELD].rows)
+ ADD_ERROR (list, g_strdup_printf ("Parent (field) is invalid in Constant row %d", i + 1));
+ break;
+ case HASCONSTANT_PARAM:
+ if (value > image->tables [MONO_TABLE_PARAM].rows)
+ ADD_ERROR (list, g_strdup_printf ("Parent (param) is invalid in Constant row %d", i + 1));
+ break;
+ case HASCONSTANT_PROPERTY:
+ if (value > image->tables [MONO_TABLE_PROPERTY].rows)
+ ADD_ERROR (list, g_strdup_printf ("Parent (property) is invalid in Constant row %d", i + 1));
+ break;
+ default:
+ ADD_ERROR (list, g_strdup_printf ("Parent is invalid in Constant row %d", i + 1));
+ break;
+ }
+ }
+ if (level & MONO_VERIFY_CLS) {
+ /*
+ * FIXME: verify types is consistent with the enum type
+ * is parent is an enum.
+ */
+ }
+ }
+ g_hash_table_destroy (dups);
+ return list;
+}
+
+static GSList*
+verify_event_map_table (MonoImage *image, GSList *list, int level)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_EVENTMAP];
+ guint32 cols [MONO_EVENT_MAP_SIZE];
+ guint32 i, last_event;
+ GHashTable *dups = g_hash_table_new (g_direct_hash, g_direct_equal);
+
+ last_event = 0;
+
+ for (i = 0; i < t->rows; ++i) {
+ mono_metadata_decode_row (t, i, cols, MONO_EVENT_MAP_SIZE);
+ if (level & MONO_VERIFY_ERROR)
+ if (g_hash_table_lookup (dups, GUINT_TO_POINTER (cols [MONO_EVENT_MAP_PARENT])))
+ ADD_ERROR (list, g_strdup_printf ("Parent 0x%08x is duplicated in Event Map row %d", cols [MONO_EVENT_MAP_PARENT], i + 1));
+ g_hash_table_insert (dups, GUINT_TO_POINTER (cols [MONO_EVENT_MAP_PARENT]),
+ GUINT_TO_POINTER (cols [MONO_EVENT_MAP_PARENT]));
+ if (level & MONO_VERIFY_ERROR) {
+ if (cols [MONO_EVENT_MAP_PARENT] > image->tables [MONO_TABLE_TYPEDEF].rows)
+ ADD_ERROR (list, g_strdup_printf ("Parent 0x%08x is invalid in Event Map row %d", cols [MONO_EVENT_MAP_PARENT], i + 1));
+ if (cols [MONO_EVENT_MAP_EVENTLIST] > image->tables [MONO_TABLE_EVENT].rows)
+ ADD_ERROR (list, g_strdup_printf ("EventList 0x%08x is invalid in Event Map row %d", cols [MONO_EVENT_MAP_EVENTLIST], i + 1));
+
+ if (cols [MONO_EVENT_MAP_EVENTLIST] <= last_event)
+ ADD_ERROR (list, g_strdup_printf ("EventList overlap in Event Map row %d", i + 1));
+ last_event = cols [MONO_EVENT_MAP_EVENTLIST];
+ }
+ }
+
+ g_hash_table_destroy (dups);
+ return list;
+}
+
+static GSList*
+verify_event_table (MonoImage *image, GSList *list, int level)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_EVENT];
+ guint32 cols [MONO_EVENT_SIZE];
+ const char *p;
+ guint32 value, i;
+
+ for (i = 0; i < t->rows; ++i) {
+ mono_metadata_decode_row (t, i, cols, MONO_EVENT_SIZE);
+
+ if (cols [MONO_EVENT_FLAGS] & ~(EVENT_SPECIALNAME|EVENT_RTSPECIALNAME)) {
+ if (level & MONO_VERIFY_ERROR)
+ ADD_ERROR (list, g_strdup_printf ("Flags 0x%04x invalid in Event row %d", cols [MONO_EVENT_FLAGS], i + 1));
+ }
+ if (!(p = is_valid_string (image, cols [MONO_EVENT_NAME], TRUE))) {
+ if (level & MONO_VERIFY_ERROR)
+ ADD_ERROR (list, g_strdup_printf ("Invalid name in Event row %d", i + 1));
+ } else {
+ if (level & MONO_VERIFY_CLS) {
+ if (!is_valid_cls_ident (p))
+ ADD_WARN (list, MONO_VERIFY_CLS, g_strdup_printf ("Invalid CLS name '%s` in Event row %d", p, i + 1));
+ }
+ }
+
+ if (level & MONO_VERIFY_ERROR && cols [MONO_EVENT_TYPE]) {
+ value = cols [MONO_EVENT_TYPE] >> TYPEDEFORREF_BITS;
+ switch (cols [MONO_EVENT_TYPE] & TYPEDEFORREF_MASK) {
+ case TYPEDEFORREF_TYPEDEF:
+ if (!value || value > image->tables [MONO_TABLE_TYPEDEF].rows)
+ ADD_ERROR (list, g_strdup_printf ("Type invalid in Event row %d", i + 1));
+ break;
+ case TYPEDEFORREF_TYPEREF:
+ if (!value || value > image->tables [MONO_TABLE_TYPEREF].rows)
+ ADD_ERROR (list, g_strdup_printf ("Type invalid in Event row %d", i + 1));
+ break;
+ case TYPEDEFORREF_TYPESPEC:
+ if (!value || value > image->tables [MONO_TABLE_TYPESPEC].rows)
+ ADD_ERROR (list, g_strdup_printf ("Type invalid in Event row %d", i + 1));
+ break;
+ default:
+ ADD_ERROR (list, g_strdup_printf ("Type invalid in Event row %d", i + 1));
+ }
+ }
+ /*
+ * FIXME: check that there is 1 add and remove row in methodsemantics
+ * and 0 or 1 raise and 0 or more other (maybe it's better to check for
+ * these while checking methodsemantics).
+ * check for duplicated names for the same type [ERROR]
+ * check for CLS duplicate names for the same type [CLS]
+ */
+ }
+ return list;
+}
+
+static GSList*
+verify_field_table (MonoImage *image, GSList *list, int level)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_FIELD];
+ guint32 cols [MONO_FIELD_SIZE];
+ const char *p;
+ guint32 i, flags;
+
+ for (i = 0; i < t->rows; ++i) {
+ mono_metadata_decode_row (t, i, cols, MONO_FIELD_SIZE);
+ /*
+ * Check this field has only one owner and that the owner is not
+ * an interface (done in verify_typedef_table() )
+ */
+ flags = cols [MONO_FIELD_FLAGS];
+ switch (flags & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) {
+ case FIELD_ATTRIBUTE_COMPILER_CONTROLLED:
+ case FIELD_ATTRIBUTE_PRIVATE:
+ case FIELD_ATTRIBUTE_FAM_AND_ASSEM:
+ case FIELD_ATTRIBUTE_ASSEMBLY:
+ case FIELD_ATTRIBUTE_FAMILY:
+ case FIELD_ATTRIBUTE_FAM_OR_ASSEM:
+ case FIELD_ATTRIBUTE_PUBLIC:
+ break;
+ default:
+ if (level & MONO_VERIFY_ERROR)
+ ADD_ERROR (list, g_strdup_printf ("Invalid access mask in Field row %d", i + 1));
+ break;
+ }
+ if (level & MONO_VERIFY_ERROR) {
+ if ((flags & FIELD_ATTRIBUTE_LITERAL) && (flags & FIELD_ATTRIBUTE_INIT_ONLY))
+ ADD_ERROR (list, g_strdup_printf ("Literal and InitOnly cannot be both set in Field row %d", i + 1));
+ if ((flags & FIELD_ATTRIBUTE_LITERAL) && !(flags & FIELD_ATTRIBUTE_STATIC))
+ ADD_ERROR (list, g_strdup_printf ("Literal needs also Static set in Field row %d", i + 1));
+ if ((flags & FIELD_ATTRIBUTE_RT_SPECIAL_NAME) && !(flags & FIELD_ATTRIBUTE_SPECIAL_NAME))
+ ADD_ERROR (list, g_strdup_printf ("RTSpecialName needs also SpecialName set in Field row %d", i + 1));
+ /*
+ * FIXME: check there is only ono owner in the respective table.
+ * if (flags & FIELD_ATTRIBUTE_HAS_FIELD_MARSHAL)
+ * if (flags & FIELD_ATTRIBUTE_HAS_DEFAULT)
+ * if (flags & FIELD_ATTRIBUTE_HAS_FIELD_RVA)
+ */
+ }
+ if (!(p = is_valid_string (image, cols [MONO_FIELD_NAME], TRUE))) {
+ if (level & MONO_VERIFY_ERROR)
+ ADD_ERROR (list, g_strdup_printf ("Invalid name in Field row %d", i + 1));
+ } else {
+ if (level & MONO_VERIFY_CLS) {
+ if (!is_valid_cls_ident (p))
+ ADD_WARN (list, MONO_VERIFY_CLS, g_strdup_printf ("Invalid CLS name '%s` in Field row %d", p, i + 1));
+ }
+ }
+ /*
+ * check signature.
+ * if owner is module needs to be static, access mask needs to be compilercontrolled,
+ * public or private (not allowed in cls mode).
+ * if owner is an enum ...
+ */
+
+
+ }
+ return list;
+}
+
+static GSList*
+verify_file_table (MonoImage *image, GSList *list, int level)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_FILE];
+ guint32 cols [MONO_FILE_SIZE];
+ const char *p;
+ guint32 i;
+ GHashTable *dups = g_hash_table_new (g_str_hash, g_str_equal);
+
+ for (i = 0; i < t->rows; ++i) {
+ mono_metadata_decode_row (t, i, cols, MONO_FILE_SIZE);
+ if (level & MONO_VERIFY_ERROR) {
+ if (cols [MONO_FILE_FLAGS] != FILE_CONTAINS_METADATA && cols [MONO_FILE_FLAGS] != FILE_CONTAINS_NO_METADATA)
+ ADD_ERROR (list, g_strdup_printf ("Invalid flags in File row %d", i + 1));
+ if (!is_valid_blob (image, cols [MONO_FILE_HASH_VALUE], TRUE))
+ ADD_ERROR (list, g_strdup_printf ("File hash value in row %d is invalid or not null and empty", i + 1));
+ }
+ if (!(p = is_valid_string (image, cols [MONO_FILE_NAME], TRUE))) {
+ if (level & MONO_VERIFY_ERROR)
+ ADD_ERROR (list, g_strdup_printf ("Invalid name in File row %d", i + 1));
+ } else {
+ if (level & MONO_VERIFY_ERROR) {
+ if (!is_valid_filename (p))
+ ADD_ERROR (list, g_strdup_printf ("Invalid name '%s` in File row %d", p, i + 1));
+ else if (g_hash_table_lookup (dups, p)) {
+ ADD_ERROR (list, g_strdup_printf ("Duplicate name '%s` in File row %d", p, i + 1));
+ }
+ g_hash_table_insert (dups, (gpointer)p, (gpointer)p);
+ }
+ }
+ /*
+ * FIXME: I don't understand what this means:
+ * If this module contains a row in the Assembly table (that is, if this module "holds the manifest")
+ * then there shall not be any row in the File table for this module - i.e., no self-reference [ERROR]
+ */
+
+ }
+ if (level & MONO_VERIFY_WARNING) {
+ if (!t->rows && image->tables [MONO_TABLE_EXPORTEDTYPE].rows)
+ ADD_WARN (list, MONO_VERIFY_WARNING, g_strdup ("ExportedType table should be empty if File table is empty"));
+ }
+ g_hash_table_destroy (dups);
+ return list;
+}
+
+static GSList*
+verify_moduleref_table (MonoImage *image, GSList *list, int level)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_MODULEREF];
+ MonoTableInfo *tfile = &image->tables [MONO_TABLE_FILE];
+ guint32 cols [MONO_MODULEREF_SIZE];
+ const char *p, *pf;
+ guint32 found, i, j, value;
+ GHashTable *dups = g_hash_table_new (g_str_hash, g_str_equal);
+
+ for (i = 0; i < t->rows; ++i) {
+ mono_metadata_decode_row (t, i, cols, MONO_MODULEREF_SIZE);
+ if (!(p = is_valid_string (image, cols [MONO_MODULEREF_NAME], TRUE))) {
+ if (level & MONO_VERIFY_ERROR)
+ ADD_ERROR (list, g_strdup_printf ("Invalid name in ModuleRef row %d", i + 1));
+ } else {
+ if (level & MONO_VERIFY_ERROR) {
+ if (!is_valid_filename (p))
+ ADD_ERROR (list, g_strdup_printf ("Invalid name '%s` in ModuleRef row %d", p, i + 1));
+ else if (g_hash_table_lookup (dups, p)) {
+ ADD_WARN (list, MONO_VERIFY_WARNING, g_strdup_printf ("Duplicate name '%s` in ModuleRef row %d", p, i + 1));
+ g_hash_table_insert (dups, (gpointer)p, (gpointer)p);
+ found = 0;
+ for (j = 0; j < tfile->rows; ++j) {
+ value = mono_metadata_decode_row_col (tfile, j, MONO_FILE_NAME);
+ if ((pf = is_valid_string (image, value, TRUE)))
+ if (strcmp (p, pf) == 0) {
+ found = 1;
+ break;
+ }
+ }
+ if (!found)
+ ADD_ERROR (list, g_strdup_printf ("Name '%s` in ModuleRef row %d doesn't have a match in File table", p, i + 1));
+ }
+ }
+ }
+ }
+ g_hash_table_destroy (dups);
+ return list;
+}
+
+static GSList*
+verify_standalonesig_table (MonoImage *image, GSList *list, int level)
+{
+ MonoTableInfo *t = &image->tables [MONO_TABLE_STANDALONESIG];
+ guint32 cols [MONO_STAND_ALONE_SIGNATURE_SIZE];
+ const char *p;
+ guint32 i;
+
+ for (i = 0; i < t->rows; ++i) {
+ mono_metadata_decode_row (t, i, cols, MONO_STAND_ALONE_SIGNATURE_SIZE);
+ if (level & MONO_VERIFY_ERROR) {
+ if (!is_valid_blob (image, cols [MONO_STAND_ALONE_SIGNATURE], TRUE)) {
+ ADD_ERROR (list, g_strdup_printf ("Signature is invalid in StandAloneSig row %d", i + 1));
+ } else {
+ p = mono_metadata_blob_heap (image, cols [MONO_STAND_ALONE_SIGNATURE]);
+ /* FIXME: check it's a valid locals or method sig.*/
+ }
+ }
+ }
+ return list;
+}
+
+GSList*
+mono_image_verify_tables (MonoImage *image, int level)
+{
+ GSList *error_list = NULL;
+
+ error_list = verify_assembly_table (image, error_list, level);
+ /*
+ * AssemblyOS, AssemblyProcessor, AssemblyRefOs and
+ * AssemblyRefProcessor should be ignored,
+ * though we may want to emit a warning, since it should not
+ * be present in a PE file.
+ */
+ error_list = verify_assemblyref_table (image, error_list, level);
+ error_list = verify_class_layout_table (image, error_list, level);
+ error_list = verify_constant_table (image, error_list, level);
+ /*
+ * cutom attribute, declsecurity
+ */
+ error_list = verify_event_map_table (image, error_list, level);
+ error_list = verify_event_table (image, error_list, level);
+ error_list = verify_field_table (image, error_list, level);
+ error_list = verify_file_table (image, error_list, level);
+ error_list = verify_moduleref_table (image, error_list, level);
+ error_list = verify_standalonesig_table (image, error_list, level);
+
+ return g_slist_reverse (error_list);
+}
+
+enum {
+ TYPE_INVALID = 0, /* leave at 0. */
+ TYPE_INT32 = 1,
+ TYPE_INT64 = 2,
+ TYPE_NINT = 3,
+ TYPE_FLOAT = 4,
+ TYPE_MANP = 5,
+ TYPE_OBJREF = 6,
+ TYPE_MAX = 7
+};
+
+const static unsigned char
+valid_binops [TYPE_MAX] [TYPE_MAX] = {
+ {TYPE_INVALID},
+ {TYPE_INVALID, TYPE_INT32, TYPE_INVALID, TYPE_NINT, TYPE_INVALID, TYPE_MANP},
+ {TYPE_INVALID, TYPE_INVALID, TYPE_INT64, TYPE_INVALID},
+ {TYPE_INVALID, TYPE_NINT, TYPE_INVALID, TYPE_NINT, TYPE_INVALID, TYPE_MANP},
+ {TYPE_INVALID, TYPE_INVALID, TYPE_INVALID, TYPE_INVALID, TYPE_FLOAT},
+ {TYPE_INVALID, TYPE_MANP, TYPE_INVALID, TYPE_MANP, TYPE_INVALID, TYPE_NINT},
+ {TYPE_INVALID}
+ /* int32 */ /* int64 */ /* native */ /* float */ /* managed p */ /* objref */
+};
+
+const static unsigned char
+valid_unnops [TYPE_MAX] = {
+ TYPE_INVALID, TYPE_INT32, TYPE_INT64, TYPE_NINT, TYPE_FLOAT, TYPE_INVALID
+ /* int32 */ /* int64 */ /* native */ /* float */ /* managed p */ /* objref */
+};
+
+/* note: the resulting type is always a boolean */
+const static unsigned char
+valid_bincomp [TYPE_MAX] [TYPE_MAX] = {
+ {TYPE_INVALID},
+ {TYPE_INVALID, TYPE_INT32, TYPE_INVALID, TYPE_INT32, TYPE_INVALID},
+ {TYPE_INVALID, TYPE_INVALID, TYPE_INT32, TYPE_INVALID},
+ {TYPE_INVALID, TYPE_INT32, TYPE_INVALID, TYPE_INT32, TYPE_INVALID, TYPE_INT32},
+ {TYPE_INVALID, TYPE_INVALID, TYPE_INVALID, TYPE_INVALID, TYPE_INT32},
+ {TYPE_INVALID, TYPE_INVALID, TYPE_INVALID, TYPE_INT32, TYPE_INVALID, TYPE_INT32},
+ {TYPE_INVALID, TYPE_INVALID, TYPE_INVALID, TYPE_INVALID, TYPE_INVALID, TYPE_INVALID, TYPE_INT32}
+ /* int32 */ /* int64 */ /* native */ /* float */ /* managed p */ /* objref */
+};
+
+const static unsigned char
+valid_intops [TYPE_MAX] [TYPE_MAX] = {
+ {TYPE_INVALID},
+ {TYPE_INVALID, TYPE_INT32, TYPE_INVALID, TYPE_NINT},
+ {TYPE_INVALID, TYPE_INVALID, TYPE_INT64},
+ {TYPE_INVALID, TYPE_NINT, TYPE_INVALID, TYPE_NINT},
+ {TYPE_INVALID}
+};
+
+const static unsigned char
+valid_shiftops [TYPE_MAX] [TYPE_MAX] = {
+ {TYPE_INVALID},
+ {TYPE_INVALID, TYPE_INT32, TYPE_INVALID, TYPE_INT32},
+ {TYPE_INVALID, TYPE_INT64, TYPE_INVALID, TYPE_INT64},
+ {TYPE_INVALID, TYPE_NINT, TYPE_INVALID, TYPE_NINT},
+ {TYPE_INVALID}
+};
+
+#define ADD_INVALID(list,msg) \
+ do { \
+ MonoVerifyInfo *vinfo = g_new (MonoVerifyInfo, 1); \
+ vinfo->status = MONO_VERIFY_ERROR; \
+ vinfo->message = (msg); \
+ (list) = g_slist_prepend ((list), vinfo); \
+ G_BREAKPOINT (); \
+ goto invalid_cil; \
+ } while (0)
+
+#define CHECK_STACK_UNDERFLOW(num) \
+ do { \
+ if (cur_stack < (num)) \
+ ADD_INVALID (list, g_strdup_printf ("Stack underflow at 0x%04x", ip_offset)); \
+ } while (0)
+
+#define CHECK_STACK_OVERFLOW() \
+ do { \
+ if (cur_stack >= max_stack) \
+ ADD_INVALID (list, g_strdup_printf ("Maxstack exceeded at 0x%04x", ip_offset)); \
+ } while (0)
+
+enum {
+ PREFIX_UNALIGNED = 1,
+ PREFIX_VOLATILE = 2,
+ PREFIX_TAIL = 4,
+ PREFIX_ADDR_MASK = 3,
+ PREFIX_FUNC_MASK = 4
+};
+
+enum {
+ CODE_SEEN = 1
+};
+
+typedef struct {
+ MonoClass *klass;
+ int type;
+} ILStackDesc;
+
+typedef struct {
+ ILStackDesc *stack;
+ guint16 stack_count;
+ guint16 flags;
+} ILCodeDesc;
+
+static int
+in_any_block (MonoMethodHeader *header, guint offset)
+{
+ int i;
+ MonoExceptionClause *clause;
+
+ for (i = 0; i < header->num_clauses; ++i) {
+ clause = &header->clauses [i];
+ if (MONO_OFFSET_IN_CLAUSE (clause, offset))
+ return 1;
+ if (MONO_OFFSET_IN_HANDLER (clause, offset))
+ return 1;
+ /* need to check filter ... */
+ }
+ return 0;
+}
+
+static int
+in_same_block (MonoMethodHeader *header, guint offset, guint target)
+{
+ int i;
+ MonoExceptionClause *clause;
+
+ for (i = 0; i < header->num_clauses; ++i) {
+ clause = &header->clauses [i];
+ if (MONO_OFFSET_IN_CLAUSE (clause, offset) && !MONO_OFFSET_IN_CLAUSE (clause, target))
+ return 0;
+ if (MONO_OFFSET_IN_HANDLER (clause, offset) && !MONO_OFFSET_IN_HANDLER (clause, target))
+ return 0;
+ /* need to check filter ... */
+ }
+ return 1;
+}
+
+/*
+ * A leave can't escape a finally block
+ */
+static int
+is_correct_leave (MonoMethodHeader *header, guint offset, guint target)
+{
+ int i;
+ MonoExceptionClause *clause;
+
+ for (i = 0; i < header->num_clauses; ++i) {
+ clause = &header->clauses [i];
+ if (clause->flags == MONO_EXCEPTION_CLAUSE_FINALLY && MONO_OFFSET_IN_HANDLER (clause, offset) && !MONO_OFFSET_IN_HANDLER (clause, target))
+ return 0;
+ /* need to check filter ... */
+ }
+ return 1;
+}
+
+static int
+can_merge_stack (ILCodeDesc *a, ILCodeDesc *b)
+{
+ if (!b->flags & CODE_SEEN) {
+ b->flags |= CODE_SEEN;
+ b->stack_count = a->stack_count;
+ /* merge types */
+ return 1;
+ }
+ if (a->stack_count != b->stack_count)
+ return 0;
+ /* merge types */
+ return 1;
+}
+
+/*
+ * FIXME: need to distinguish between valid and verifiable.
+ * Need to keep track of types on the stack.
+ * Verify types for opcodes.
+ */
+GSList*
+mono_method_verify (MonoMethod *method, int level)
+{
+ MonoMethodHeader *header;
+ MonoMethodSignature *signature, *csig;
+ MonoMethod *cmethod;
+ MonoImage *image;
+ register const unsigned char *ip;
+ register const unsigned char *end;
+ const unsigned char *target; /* branch target */
+ int max_args, max_stack, cur_stack, i, n, need_merge, start;
+ guint32 token, ip_offset;
+ char *local_state = NULL;
+ GSList *list = NULL;
+ guint prefix = 0;
+ ILCodeDesc *code;
+
+ signature = method->signature;
+ header = ((MonoMethodNormal *)method)->header;
+ ip = header->code;
+ end = ip + header->code_size;
+ max_args = method->signature->param_count + method->signature->hasthis;
+ max_stack = header->max_stack;
+ need_merge = cur_stack = 0;
+ start = 1;
+ image = method->klass->image;
+ code = g_new0 (ILCodeDesc, header->code_size);
+
+ if (header->num_locals) {
+ local_state = g_new (char, header->num_locals);
+ memset (local_state, header->init_locals, header->num_locals);
+ }
+ g_print ("Method %s.%s::%s\n", method->klass->name_space, method->klass->name, method->name);
+
+ while (ip < end) {
+ ip_offset = ip - header->code;
+ g_print ("IL_%04x: %02x %s\n", ip_offset, *ip, mono_opcode_names [*ip]);
+ if (start || !(code [ip_offset].flags & CODE_SEEN)) {
+ if (start) {
+ code [ip_offset].stack_count = 0;
+ start = 0;
+ } else {
+ code [ip_offset].stack_count = cur_stack;
+ }
+ code [ip_offset].flags |= CODE_SEEN;
+ } else {
+ /* stack merge */
+ if (code [ip_offset].stack_count != cur_stack)
+ ADD_INVALID (list, g_strdup_printf ("Cannot merge stack states at 0x%04x", ip_offset));
+ }
+ if (need_merge) {
+ if (!can_merge_stack (&code [ip_offset], &code [target - header->code]))
+ ADD_INVALID (list, g_strdup_printf ("Cannot merge stack states at 0x%04x", ip_offset));
+ need_merge = 0;
+ }
+
+ switch (*ip) {
+ case CEE_NOP:
+ case CEE_BREAK:
+ ++ip;
+ break;
+ case CEE_LDARG_0:
+ case CEE_LDARG_1:
+ case CEE_LDARG_2:
+ case CEE_LDARG_3:
+ if (*ip - CEE_LDARG_0 >= max_args)
+ ADD_INVALID (list, g_strdup_printf ("Method doesn't have argument %d at 0x%04x", *ip - CEE_LDARG_0, ip_offset));
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ++ip;
+ break;
+ case CEE_LDLOC_0:
+ case CEE_LDLOC_1:
+ case CEE_LDLOC_2:
+ case CEE_LDLOC_3:
+ if (*ip - CEE_LDLOC_0 >= header->num_locals)
+ ADD_INVALID (list, g_strdup_printf ("Method doesn't have local var %d at 0x%04x", *ip - CEE_LDLOC_0, ip_offset));
+ if (!local_state [*ip - CEE_LDLOC_0])
+ ADD_INVALID (list, g_strdup_printf ("Local var %d is initialized at 0x%04x", *ip - CEE_LDLOC_0, ip_offset));
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ++ip;
+ break;
+ case CEE_STLOC_0:
+ case CEE_STLOC_1:
+ case CEE_STLOC_2:
+ case CEE_STLOC_3:
+ if (*ip - CEE_STLOC_0 >= header->num_locals)
+ ADD_INVALID (list, g_strdup_printf ("Method doesn't have local var %d at 0x%04x", *ip - CEE_STLOC_0, ip_offset));
+ local_state [*ip - CEE_STLOC_0] = 1;
+ CHECK_STACK_UNDERFLOW (1);
+ --cur_stack;
+ ++ip;
+ break;
+ case CEE_LDARG_S:
+ case CEE_LDARGA_S:
+ if (ip [1] >= max_args)
+ ADD_INVALID (list, g_strdup_printf ("Method doesn't have argument %d at 0x%04x", ip [1], ip_offset));
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ip += 2;
+ break;
+ case CEE_STARG_S:
+ if (ip [1] >= max_args)
+ ADD_INVALID (list, g_strdup_printf ("Method doesn't have argument %d at 0x%04x", ip [1], ip_offset));
+ CHECK_STACK_UNDERFLOW (1);
+ --cur_stack;
+ ip += 2;
+ break;
+ case CEE_LDLOC_S:
+ case CEE_LDLOCA_S:
+ if (ip [1] >= header->num_locals)
+ ADD_INVALID (list, g_strdup_printf ("Method doesn't have local var %d at 0x%04x", ip [1], ip_offset));
+ /* no need to check if the var is initialized if the address is taken */
+ if (*ip == CEE_LDLOC_S && !local_state [ip [1]])
+ ADD_INVALID (list, g_strdup_printf ("Local var %d is initialized at 0x%04x", ip [1], ip_offset));
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ip += 2;
+ break;
+ case CEE_STLOC_S:
+ if (ip [1] >= header->num_locals)
+ ADD_INVALID (list, g_strdup_printf ("Method doesn't have local var %d at 0x%04x", ip [1], ip_offset));
+ local_state [ip [1]] = 1;
+ CHECK_STACK_UNDERFLOW (1);
+ --cur_stack;
+ ip += 2;
+ break;
+ case CEE_LDNULL:
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ++ip;
+ break;
+ case CEE_LDC_I4_M1:
+ case CEE_LDC_I4_0:
+ case CEE_LDC_I4_1:
+ case CEE_LDC_I4_2:
+ case CEE_LDC_I4_3:
+ case CEE_LDC_I4_4:
+ case CEE_LDC_I4_5:
+ case CEE_LDC_I4_6:
+ case CEE_LDC_I4_7:
+ case CEE_LDC_I4_8:
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ++ip;
+ break;
+ case CEE_LDC_I4_S:
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ip += 2;
+ break;
+ case CEE_LDC_I4:
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ip += 5;
+ break;
+ case CEE_LDC_I8:
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ip += 9;
+ break;
+ case CEE_LDC_R4:
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ip += 5;
+ break;
+ case CEE_LDC_R8:
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ip += 9;
+ break;
+ case CEE_UNUSED99: ++ip; break; /* warn/error instead? */
+ case CEE_DUP:
+ CHECK_STACK_UNDERFLOW (1);
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ++ip;
+ break;
+ case CEE_POP:
+ CHECK_STACK_UNDERFLOW (1);
+ --cur_stack;
+ ++ip;
+ break;
+ case CEE_JMP:
+ if (cur_stack)
+ ADD_INVALID (list, g_strdup_printf ("Eval stack must be empty in jmp at 0x%04x", ip_offset));
+ token = read32 (ip + 1);
+ if (in_any_block (header, ip_offset))
+ ADD_INVALID (list, g_strdup_printf ("jmp cannot escape exception blocks at 0x%04x", ip_offset));
+ /*
+ * FIXME: check signature, retval, arguments etc.
+ */
+ ip += 5;
+ break;
+ case CEE_CALL:
+ case CEE_CALLVIRT:
+ token = read32 (ip + 1);
+ /*
+ * FIXME: we could just load the signature ...
+ */
+ cmethod = mono_get_method (image, token, NULL);
+ if (!cmethod)
+ ADD_INVALID (list, g_strdup_printf ("Method 0x%08x not found at 0x%04x", token, ip_offset));
+ csig = cmethod->signature;
+ CHECK_STACK_UNDERFLOW (csig->param_count + csig->hasthis);
+ cur_stack -= csig->param_count + csig->hasthis;
+ if (csig->ret->type != MONO_TYPE_VOID) {
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ }
+ ip += 5;
+ break;
+ case CEE_CALLI:
+ token = read32 (ip + 1);
+ /*
+ * FIXME: check signature, retval, arguments etc.
+ */
+ ip += 5;
+ break;
+ case CEE_RET:
+ if (signature->ret->type != MONO_TYPE_VOID) {
+ if (cur_stack != 1)
+ ADD_INVALID (list, g_strdup_printf ("Stack not empty after ret at 0x%04x", ip_offset));
+ --cur_stack;
+ } else {
+ if (cur_stack)
+ ADD_INVALID (list, g_strdup_printf ("Stack not empty after ret at 0x%04x", ip_offset));
+ cur_stack = 0;
+ }
+ if (in_any_block (header, ip_offset))
+ ADD_INVALID (list, g_strdup_printf ("ret cannot escape exception blocks at 0x%04x", ip_offset));
+ ++ip;
+ break;
+ case CEE_BR_S:
+ target = ip + (signed char)ip [1] + 2;
+ if (target >= end || target < header->code)
+ ADD_INVALID (list, g_strdup_printf ("Branch target out of code at 0x%04x", ip_offset));
+ if (!in_same_block (header, ip_offset, target - header->code))
+ ADD_INVALID (list, g_strdup_printf ("Branch target escapes out of exception block at 0x%04x", ip_offset));
+ ip += 2;
+ start = 1;
+ break;
+ case CEE_BRFALSE_S:
+ case CEE_BRTRUE_S:
+ target = ip + (signed char)ip [1] + 2;
+ if (target >= end || target < header->code)
+ ADD_INVALID (list, g_strdup_printf ("Branch target out of code at 0x%04x", ip_offset));
+ if (!in_same_block (header, ip_offset, target - header->code))
+ ADD_INVALID (list, g_strdup_printf ("Branch target escapes out of exception block at 0x%04x", ip_offset));
+ CHECK_STACK_UNDERFLOW (1);
+ --cur_stack;
+ ip += 2;
+ need_merge = 1;
+ break;
+ case CEE_BEQ_S:
+ case CEE_BGE_S:
+ case CEE_BGT_S:
+ case CEE_BLE_S:
+ case CEE_BLT_S:
+ case CEE_BNE_UN_S:
+ case CEE_BGE_UN_S:
+ case CEE_BGT_UN_S:
+ case CEE_BLE_UN_S:
+ case CEE_BLT_UN_S:
+ target = ip + (signed char)ip [1] + 2;
+ if (target >= end || target < header->code)
+ ADD_INVALID (list, g_strdup_printf ("Branch target out of code at 0x%04x", ip_offset));
+ if (!in_same_block (header, ip_offset, target - header->code))
+ ADD_INVALID (list, g_strdup_printf ("Branch target escapes out of exception block at 0x%04x", ip_offset));
+ CHECK_STACK_UNDERFLOW (2);
+ cur_stack -= 2;
+ ip += 2;
+ need_merge = 1;
+ break;
+ case CEE_BR:
+ target = ip + (gint32)read32 (ip + 1) + 5;
+ if (target >= end || target < header->code)
+ ADD_INVALID (list, g_strdup_printf ("Branch target out of code at 0x%04x", ip_offset));
+ if (!in_same_block (header, ip_offset, target - header->code))
+ ADD_INVALID (list, g_strdup_printf ("Branch target escapes out of exception block at 0x%04x", ip_offset));
+ ip += 5;
+ start = 1;
+ break;
+ case CEE_BRFALSE:
+ case CEE_BRTRUE:
+ target = ip + (gint32)read32 (ip + 1) + 5;
+ if (target >= end || target < header->code)
+ ADD_INVALID (list, g_strdup_printf ("Branch target out of code at 0x%04x", ip_offset));
+ if (!in_same_block (header, ip_offset, target - header->code))
+ ADD_INVALID (list, g_strdup_printf ("Branch target escapes out of exception block at 0x%04x", ip_offset));
+ CHECK_STACK_UNDERFLOW (1);
+ --cur_stack;
+ ip += 5;
+ need_merge = 1;
+ break;
+ case CEE_BEQ:
+ case CEE_BGE:
+ case CEE_BGT:
+ case CEE_BLE:
+ case CEE_BLT:
+ case CEE_BNE_UN:
+ case CEE_BGE_UN:
+ case CEE_BGT_UN:
+ case CEE_BLE_UN:
+ case CEE_BLT_UN:
+ target = ip + (gint32)read32 (ip + 1) + 5;
+ if (target >= end || target < header->code)
+ ADD_INVALID (list, g_strdup_printf ("Branch target out of code at 0x%04x", ip_offset));
+ if (!in_same_block (header, ip_offset, target - header->code))
+ ADD_INVALID (list, g_strdup_printf ("Branch target escapes out of exception block at 0x%04x", ip_offset));
+ CHECK_STACK_UNDERFLOW (2);
+ cur_stack -= 2;
+ ip += 5;
+ need_merge = 1;
+ break;
+ case CEE_SWITCH:
+ n = read32 (ip + 1);
+ target = ip + sizeof (guint32) * n;
+ /* FIXME: check that ip is in range (and within the same exception block) */
+ for (i = 0; i < n; ++i)
+ if (target + (gint32) read32 (ip + 5 + i * sizeof (gint32)) >= end || target + (gint32) read32 (ip + 5 + i * sizeof (gint32)) < header->code)
+ ADD_INVALID (list, g_strdup_printf ("Branch target out of code at 0x%04x", ip_offset));
+ CHECK_STACK_UNDERFLOW (1);
+ --cur_stack;
+ ip += 5 + sizeof (guint32) * n;
+ break;
+ case CEE_LDIND_I1:
+ case CEE_LDIND_U1:
+ case CEE_LDIND_I2:
+ case CEE_LDIND_U2:
+ case CEE_LDIND_I4:
+ case CEE_LDIND_U4:
+ case CEE_LDIND_I8:
+ case CEE_LDIND_I:
+ case CEE_LDIND_R4:
+ case CEE_LDIND_R8:
+ case CEE_LDIND_REF:
+ CHECK_STACK_UNDERFLOW (1);
+ ++ip;
+ break;
+ case CEE_STIND_REF:
+ case CEE_STIND_I1:
+ case CEE_STIND_I2:
+ case CEE_STIND_I4:
+ case CEE_STIND_I8:
+ case CEE_STIND_R4:
+ case CEE_STIND_R8:
+ CHECK_STACK_UNDERFLOW (2);
+ cur_stack -= 2;
+ ++ip;
+ break;
+ case CEE_ADD:
+ case CEE_SUB:
+ case CEE_MUL:
+ case CEE_DIV:
+ case CEE_DIV_UN:
+ case CEE_REM:
+ case CEE_REM_UN:
+ case CEE_AND:
+ case CEE_OR:
+ case CEE_XOR:
+ case CEE_SHL:
+ case CEE_SHR:
+ case CEE_SHR_UN:
+ CHECK_STACK_UNDERFLOW (2);
+ --cur_stack;
+ ++ip;
+ break;
+ case CEE_NEG:
+ case CEE_NOT:
+ case CEE_CONV_I1:
+ case CEE_CONV_I2:
+ case CEE_CONV_I4:
+ case CEE_CONV_I8:
+ case CEE_CONV_R4:
+ case CEE_CONV_R8:
+ case CEE_CONV_U4:
+ case CEE_CONV_U8:
+ CHECK_STACK_UNDERFLOW (1);
+ ++ip;
+ break;
+ case CEE_CPOBJ:
+ token = read32 (ip + 1);
+ CHECK_STACK_UNDERFLOW (2);
+ cur_stack -= 2;
+ ip += 5;
+ break;
+ case CEE_LDOBJ:
+ token = read32 (ip + 1);
+ CHECK_STACK_UNDERFLOW (1);
+ ip += 5;
+ break;
+ case CEE_LDSTR:
+ token = read32 (ip + 1);
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ip += 5;
+ break;
+ case CEE_NEWOBJ:
+ token = read32 (ip + 1);
+ /*
+ * FIXME: we could just load the signature ...
+ */
+ cmethod = mono_get_method (image, token, NULL);
+ if (!cmethod)
+ ADD_INVALID (list, g_strdup_printf ("Constructor 0x%08x not found at 0x%04x", token, ip_offset));
+ csig = cmethod->signature;
+ CHECK_STACK_UNDERFLOW (csig->param_count);
+ cur_stack -= csig->param_count;
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ip += 5;
+ break;
+ case CEE_CASTCLASS:
+ case CEE_ISINST:
+ token = read32 (ip + 1);
+ CHECK_STACK_UNDERFLOW (1);
+ ip += 5;
+ break;
+ case CEE_CONV_R_UN:
+ CHECK_STACK_UNDERFLOW (1);
+ ++ip;
+ break;
+ case CEE_UNUSED58:
+ case CEE_UNUSED1:
+ ++ip; /* warn, error ? */
+ break;
+ case CEE_UNBOX:
+ token = read32 (ip + 1);
+ CHECK_STACK_UNDERFLOW (1);
+ ip += 5;
+ break;
+ case CEE_THROW:
+ CHECK_STACK_UNDERFLOW (1);
+ --cur_stack;
+ ++ip;
+ break;
+ case CEE_LDFLD:
+ CHECK_STACK_UNDERFLOW (1);
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_LDFLDA:
+ CHECK_STACK_UNDERFLOW (1);
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_STFLD:
+ CHECK_STACK_UNDERFLOW (2);
+ cur_stack -= 2;
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_LDSFLD:
+ CHECK_STACK_OVERFLOW ();
+ token = read32 (ip + 1);
+ ++cur_stack;
+ ip += 5;
+ break;
+ case CEE_LDSFLDA:
+ CHECK_STACK_OVERFLOW ();
+ token = read32 (ip + 1);
+ ++cur_stack;
+ ip += 5;
+ break;
+ case CEE_STSFLD:
+ CHECK_STACK_UNDERFLOW (1);
+ --cur_stack;
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_STOBJ:
+ CHECK_STACK_UNDERFLOW (2);
+ cur_stack -= 2;
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_CONV_OVF_I1_UN:
+ case CEE_CONV_OVF_I2_UN:
+ case CEE_CONV_OVF_I4_UN:
+ case CEE_CONV_OVF_I8_UN:
+ case CEE_CONV_OVF_U1_UN:
+ case CEE_CONV_OVF_U2_UN:
+ case CEE_CONV_OVF_U4_UN:
+ case CEE_CONV_OVF_U8_UN:
+ case CEE_CONV_OVF_I_UN:
+ case CEE_CONV_OVF_U_UN:
+ CHECK_STACK_UNDERFLOW (1);
+ ++ip;
+ break;
+ case CEE_BOX:
+ CHECK_STACK_UNDERFLOW (1);
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_NEWARR:
+ CHECK_STACK_UNDERFLOW (1);
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_LDLEN:
+ CHECK_STACK_UNDERFLOW (1);
+ ++ip;
+ break;
+ case CEE_LDELEMA:
+ CHECK_STACK_UNDERFLOW (2);
+ --cur_stack;
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_LDELEM_I1:
+ case CEE_LDELEM_U1:
+ case CEE_LDELEM_I2:
+ case CEE_LDELEM_U2:
+ case CEE_LDELEM_I4:
+ case CEE_LDELEM_U4:
+ case CEE_LDELEM_I8:
+ case CEE_LDELEM_I:
+ case CEE_LDELEM_R4:
+ case CEE_LDELEM_R8:
+ case CEE_LDELEM_REF:
+ CHECK_STACK_UNDERFLOW (2);
+ --cur_stack;
+ ++ip;
+ break;
+ case CEE_STELEM_I:
+ case CEE_STELEM_I1:
+ case CEE_STELEM_I2:
+ case CEE_STELEM_I4:
+ case CEE_STELEM_I8:
+ case CEE_STELEM_R4:
+ case CEE_STELEM_R8:
+ case CEE_STELEM_REF:
+ CHECK_STACK_UNDERFLOW (3);
+ cur_stack -= 3;
+ ++ip;
+ break;
+ case CEE_UNUSED2:
+ case CEE_UNUSED3:
+ case CEE_UNUSED4:
+ case CEE_UNUSED5:
+ case CEE_UNUSED6:
+ case CEE_UNUSED7:
+ case CEE_UNUSED8:
+ case CEE_UNUSED9:
+ case CEE_UNUSED10:
+ case CEE_UNUSED11:
+ case CEE_UNUSED12:
+ case CEE_UNUSED13:
+ case CEE_UNUSED14:
+ case CEE_UNUSED15:
+ case CEE_UNUSED16:
+ case CEE_UNUSED17:
+ ++ip; /* warn, error ? */
+ break;
+ case CEE_CONV_OVF_I1:
+ case CEE_CONV_OVF_U1:
+ case CEE_CONV_OVF_I2:
+ case CEE_CONV_OVF_U2:
+ case CEE_CONV_OVF_I4:
+ case CEE_CONV_OVF_U4:
+ case CEE_CONV_OVF_I8:
+ case CEE_CONV_OVF_U8:
+ CHECK_STACK_UNDERFLOW (1);
+ ++ip;
+ break;
+ case CEE_UNUSED50:
+ case CEE_UNUSED18:
+ case CEE_UNUSED19:
+ case CEE_UNUSED20:
+ case CEE_UNUSED21:
+ case CEE_UNUSED22:
+ case CEE_UNUSED23:
+ ++ip; /* warn, error ? */
+ break;
+ case CEE_REFANYVAL:
+ CHECK_STACK_UNDERFLOW (1);
+ ++ip;
+ break;
+ case CEE_CKFINITE:
+ CHECK_STACK_UNDERFLOW (1);
+ ++ip;
+ break;
+ case CEE_UNUSED24:
+ case CEE_UNUSED25:
+ ++ip; /* warn, error ? */
+ break;
+ case CEE_MKREFANY:
+ CHECK_STACK_UNDERFLOW (1);
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_UNUSED59:
+ case CEE_UNUSED60:
+ case CEE_UNUSED61:
+ case CEE_UNUSED62:
+ case CEE_UNUSED63:
+ case CEE_UNUSED64:
+ case CEE_UNUSED65:
+ case CEE_UNUSED66:
+ case CEE_UNUSED67:
+ ++ip; /* warn, error ? */
+ break;
+ case CEE_LDTOKEN:
+ CHECK_STACK_OVERFLOW ();
+ token = read32 (ip + 1);
+ ++cur_stack;
+ ip += 5;
+ break;
+ case CEE_CONV_U2:
+ case CEE_CONV_U1:
+ case CEE_CONV_I:
+ case CEE_CONV_OVF_I:
+ case CEE_CONV_OVF_U:
+ CHECK_STACK_UNDERFLOW (1);
+ ++ip;
+ break;
+ case CEE_ADD_OVF:
+ case CEE_ADD_OVF_UN:
+ case CEE_MUL_OVF:
+ case CEE_MUL_OVF_UN:
+ case CEE_SUB_OVF:
+ case CEE_SUB_OVF_UN:
+ CHECK_STACK_UNDERFLOW (2);
+ --cur_stack;
+ ++ip;
+ break;
+ case CEE_ENDFINALLY:
+ ++ip;
+ start = 1;
+ break;
+ case CEE_LEAVE:
+ target = ip + (gint32)read32(ip + 1) + 5;
+ if (target >= end || target < header->code)
+ ADD_INVALID (list, g_strdup_printf ("Branch target out of code at 0x%04x", ip_offset));
+ if (!is_correct_leave (header, ip_offset, target - header->code))
+ ADD_INVALID (list, g_strdup_printf ("Leave not allowed in finally block at 0x%04x", ip_offset));
+ ip += 5;
+ start = 1;
+ break;
+ case CEE_LEAVE_S:
+ target = ip + (signed char)ip [1] + 2;
+ if (target >= end || target < header->code)
+ ADD_INVALID (list, g_strdup_printf ("Branch target out of code at 0x%04x", ip_offset));
+ if (!is_correct_leave (header, ip_offset, target - header->code))
+ ADD_INVALID (list, g_strdup_printf ("Leave not allowed in finally block at 0x%04x", ip_offset));
+ ip += 2;
+ start = 1;
+ break;
+ case CEE_STIND_I:
+ CHECK_STACK_UNDERFLOW (2);
+ cur_stack -= 2;
+ ++ip;
+ break;
+ case CEE_CONV_U:
+ CHECK_STACK_UNDERFLOW (1);
+ ++ip;
+ break;
+ case CEE_UNUSED26:
+ case CEE_UNUSED27:
+ case CEE_UNUSED28:
+ case CEE_UNUSED29:
+ case CEE_UNUSED30:
+ case CEE_UNUSED31:
+ case CEE_UNUSED32:
+ case CEE_UNUSED33:
+ case CEE_UNUSED34:
+ case CEE_UNUSED35:
+ case CEE_UNUSED36:
+ case CEE_UNUSED37:
+ case CEE_UNUSED38:
+ case CEE_UNUSED39:
+ case CEE_UNUSED40:
+ case CEE_UNUSED41:
+ case CEE_UNUSED42:
+ case CEE_UNUSED43:
+ case CEE_UNUSED44:
+ case CEE_UNUSED45:
+ case CEE_UNUSED46:
+ case CEE_UNUSED47:
+ case CEE_UNUSED48:
+ ++ip;
+ break;
+ case CEE_PREFIX7:
+ case CEE_PREFIX6:
+ case CEE_PREFIX5:
+ case CEE_PREFIX4:
+ case CEE_PREFIX3:
+ case CEE_PREFIX2:
+ case CEE_PREFIXREF:
+ ++ip;
+ break;
+ case CEE_PREFIX1:
+ ++ip;
+ switch (*ip) {
+ case CEE_ARGLIST:
+ CHECK_STACK_OVERFLOW ();
+ ++ip;
+ break;
+ case CEE_CEQ:
+ case CEE_CGT:
+ case CEE_CGT_UN:
+ case CEE_CLT:
+ case CEE_CLT_UN:
+ CHECK_STACK_UNDERFLOW (2);
+ --cur_stack;
+ ++ip;
+ break;
+ case CEE_LDFTN:
+ CHECK_STACK_OVERFLOW ();
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_LDVIRTFTN:
+ CHECK_STACK_UNDERFLOW (1);
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_UNUSED56:
+ ++ip;
+ break;
+ case CEE_LDARG:
+ case CEE_LDARGA:
+ if (read16 (ip + 1) >= max_args)
+ ADD_INVALID (list, g_strdup_printf ("Method doesn't have argument %d at 0x%04x", read16 (ip + 1), ip_offset));
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ip += 3;
+ break;
+ case CEE_STARG:
+ if (read16 (ip + 1) >= max_args)
+ ADD_INVALID (list, g_strdup_printf ("Method doesn't have argument %d at 0x%04x", read16(ip + 1), ip_offset));
+ CHECK_STACK_UNDERFLOW (1);
+ --cur_stack;
+ ip += 3;
+ break;
+ case CEE_LDLOC:
+ case CEE_LDLOCA:
+ if (read16 (ip + 1) >= header->num_locals)
+ ADD_INVALID (list, g_strdup_printf ("Method doesn't have local var %d at 0x%04x", read16 (ip + 1), ip_offset));
+ /* no need to check if the var is initialized if the address is taken */
+ if (*ip == CEE_LDLOC && !local_state [read16 (ip + 1)])
+ ADD_INVALID (list, g_strdup_printf ("Local var %d is initialized at 0x%04x", read16 (ip + 1), ip_offset));
+ CHECK_STACK_OVERFLOW ();
+ ++cur_stack;
+ ip += 3;
+ break;
+ case CEE_STLOC:
+ if (read16 (ip + 1) >= header->num_locals)
+ ADD_INVALID (list, g_strdup_printf ("Method doesn't have local var %d at 0x%04x", read16 (ip + 1), ip_offset));
+ local_state [read16 (ip + 1)] = 1;
+ CHECK_STACK_UNDERFLOW (1);
+ --cur_stack;
+ ip += 3;
+ break;
+ case CEE_LOCALLOC:
+ if (cur_stack != 1)
+ ADD_INVALID (list, g_strdup_printf ("Stack must have only size item in localloc at 0x%04x", ip_offset));
+ ++ip;
+ break;
+ case CEE_UNUSED57:
+ ++ip;
+ break;
+ case CEE_ENDFILTER:
+ if (cur_stack != 1)
+ ADD_INVALID (list, g_strdup_printf ("Stack must have only filter result in endfilter at 0x%04x", ip_offset));
+ ++ip;
+ break;
+ case CEE_UNALIGNED_:
+ prefix |= PREFIX_UNALIGNED;
+ ++ip;
+ break;
+ case CEE_VOLATILE_:
+ prefix |= PREFIX_VOLATILE;
+ ++ip;
+ break;
+ case CEE_TAIL_:
+ prefix |= PREFIX_TAIL;
+ ++ip;
+ if (ip < end && (*ip != CEE_CALL && *ip != CEE_CALLI && *ip != CEE_CALLVIRT))
+ ADD_INVALID (list, g_strdup_printf ("tail prefix must be used only with call opcodes at 0x%04x", ip_offset));
+ break;
+ case CEE_INITOBJ:
+ CHECK_STACK_UNDERFLOW (1);
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_UNUSED68:
+ ++ip;
+ break;
+ case CEE_CPBLK:
+ CHECK_STACK_UNDERFLOW (3);
+ ip++;
+ break;
+ case CEE_INITBLK:
+ CHECK_STACK_UNDERFLOW (3);
+ ip++;
+ break;
+ case CEE_UNUSED69:
+ ++ip;
+ break;
+ case CEE_RETHROW:
+ ++ip;
+ break;
+ case CEE_UNUSED:
+ ++ip;
+ break;
+ case CEE_SIZEOF:
+ CHECK_STACK_OVERFLOW ();
+ token = read32 (ip + 1);
+ ip += 5;
+ break;
+ case CEE_REFANYTYPE:
+ CHECK_STACK_UNDERFLOW (1);
+ ++ip;
+ break;
+ case CEE_UNUSED52:
+ case CEE_UNUSED53:
+ case CEE_UNUSED54:
+ case CEE_UNUSED55:
+ case CEE_UNUSED70:
+ ++ip;
+ break;
+ }
+ }
+ }
+ /*
+ * FIXME: if ip != end we overflowed: mark as error.
+ */
+invalid_cil:
+
+ g_free (local_state);
+ g_free (code);
+ return list;
+}
+
+typedef struct {
+ const char *name;
+ guint64 offset;
+} FieldDesc;
+
+typedef struct {
+ const char *name;
+ const FieldDesc *fields;
+} ClassDesc;
+
+static const FieldDesc
+typebuilder_fields[] = {
+ {"tname", G_STRUCT_OFFSET (MonoReflectionTypeBuilder, name)},
+ {"nspace", G_STRUCT_OFFSET (MonoReflectionTypeBuilder, nspace)},
+ {"parent", G_STRUCT_OFFSET (MonoReflectionTypeBuilder, parent)},
+ {"interfaces", G_STRUCT_OFFSET (MonoReflectionTypeBuilder, interfaces)},
+ {"methods", G_STRUCT_OFFSET (MonoReflectionTypeBuilder, methods)},
+ {"properties", G_STRUCT_OFFSET (MonoReflectionTypeBuilder, properties)},
+ {"fields", G_STRUCT_OFFSET (MonoReflectionTypeBuilder, fields)},
+ {"attrs", G_STRUCT_OFFSET (MonoReflectionTypeBuilder, attrs)},
+ {"table_idx", G_STRUCT_OFFSET (MonoReflectionTypeBuilder, table_idx)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+modulebuilder_fields[] = {
+ {"types", G_STRUCT_OFFSET (MonoReflectionModuleBuilder, types)},
+ {"cattrs", G_STRUCT_OFFSET (MonoReflectionModuleBuilder, cattrs)},
+ {"guid", G_STRUCT_OFFSET (MonoReflectionModuleBuilder, guid)},
+ {"table_idx", G_STRUCT_OFFSET (MonoReflectionModuleBuilder, table_idx)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+assemblybuilder_fields[] = {
+ {"entry_point", G_STRUCT_OFFSET (MonoReflectionAssemblyBuilder, entry_point)},
+ {"modules", G_STRUCT_OFFSET (MonoReflectionAssemblyBuilder, modules)},
+ {"name", G_STRUCT_OFFSET (MonoReflectionAssemblyBuilder, name)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+ctorbuilder_fields[] = {
+ {"ilgen", G_STRUCT_OFFSET (MonoReflectionCtorBuilder, ilgen)},
+ {"parameters", G_STRUCT_OFFSET (MonoReflectionCtorBuilder, parameters)},
+ {"attrs", G_STRUCT_OFFSET (MonoReflectionCtorBuilder, attrs)},
+ {"iattrs", G_STRUCT_OFFSET (MonoReflectionCtorBuilder, iattrs)},
+ {"table_idx", G_STRUCT_OFFSET (MonoReflectionCtorBuilder, table_idx)},
+ {"call_conv", G_STRUCT_OFFSET (MonoReflectionCtorBuilder, call_conv)},
+ {"type", G_STRUCT_OFFSET (MonoReflectionCtorBuilder, type)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+methodbuilder_fields[] = {
+ {"mhandle", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, mhandle)},
+ {"rtype", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, rtype)},
+ {"parameters", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, parameters)},
+ {"attrs", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, attrs)},
+ {"iattrs", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, iattrs)},
+ {"name", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, name)},
+ {"table_idx", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, table_idx)},
+ {"code", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, code)},
+ {"ilgen", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, ilgen)},
+ {"type", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, type)},
+ {"pinfo", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, pinfo)},
+ {"pi_dll", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, dll)},
+ {"pi_entry", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, dllentry)},
+ {"ncharset", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, charset)},
+ {"native_cc", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, native_cc)},
+ {"call_conv", G_STRUCT_OFFSET (MonoReflectionMethodBuilder, call_conv)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+fieldbuilder_fields[] = {
+ {"attrs", G_STRUCT_OFFSET (MonoReflectionFieldBuilder, attrs)},
+ {"type", G_STRUCT_OFFSET (MonoReflectionFieldBuilder, type)},
+ {"name", G_STRUCT_OFFSET (MonoReflectionFieldBuilder, name)},
+ {"def_value", G_STRUCT_OFFSET (MonoReflectionFieldBuilder, def_value)},
+ {"offset", G_STRUCT_OFFSET (MonoReflectionFieldBuilder, offset)},
+ {"table_idx", G_STRUCT_OFFSET (MonoReflectionFieldBuilder, table_idx)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+propertybuilder_fields[] = {
+ {"attrs", G_STRUCT_OFFSET (MonoReflectionPropertyBuilder, attrs)},
+ {"name", G_STRUCT_OFFSET (MonoReflectionPropertyBuilder, name)},
+ {"type", G_STRUCT_OFFSET (MonoReflectionPropertyBuilder, type)},
+ {"parameters", G_STRUCT_OFFSET (MonoReflectionPropertyBuilder, parameters)},
+ {"def_value", G_STRUCT_OFFSET (MonoReflectionPropertyBuilder, def_value)},
+ {"set_method", G_STRUCT_OFFSET (MonoReflectionPropertyBuilder, set_method)},
+ {"get_method", G_STRUCT_OFFSET (MonoReflectionPropertyBuilder, get_method)},
+ {"table_idx", G_STRUCT_OFFSET (MonoReflectionPropertyBuilder, table_idx)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+ilgenerator_fields[] = {
+ {"code", G_STRUCT_OFFSET (MonoReflectionILGen, code)},
+ {"mbuilder", G_STRUCT_OFFSET (MonoReflectionILGen, mbuilder)},
+ {"code_len", G_STRUCT_OFFSET (MonoReflectionILGen, code_len)},
+ {"max_stack", G_STRUCT_OFFSET (MonoReflectionILGen, max_stack)},
+ {"cur_stack", G_STRUCT_OFFSET (MonoReflectionILGen, cur_stack)},
+ {"locals", G_STRUCT_OFFSET (MonoReflectionILGen, locals)},
+ {"ex_handlers", G_STRUCT_OFFSET (MonoReflectionILGen, ex_handlers)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+ilexinfo_fields[] = {
+ {"handlers", G_STRUCT_OFFSET (MonoILExceptionInfo, handlers)},
+ {"start", G_STRUCT_OFFSET (MonoILExceptionInfo, start)},
+ {"len", G_STRUCT_OFFSET (MonoILExceptionInfo, len)},
+ {"end", G_STRUCT_OFFSET (MonoILExceptionInfo, label)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+ilexblock_fields[] = {
+ {"extype", G_STRUCT_OFFSET (MonoILExceptionBlock, extype)},
+ {"type", G_STRUCT_OFFSET (MonoILExceptionBlock, type)},
+ {"start", G_STRUCT_OFFSET (MonoILExceptionBlock, start)},
+ {"len", G_STRUCT_OFFSET (MonoILExceptionBlock, len)},
+ {"filter_offset", G_STRUCT_OFFSET (MonoILExceptionBlock, filter_offset)},
+ {NULL, 0}
+};
+
+static const ClassDesc
+emit_classes_to_check [] = {
+ {"TypeBuilder", typebuilder_fields},
+ {"ModuleBuilder", modulebuilder_fields},
+ {"AssemblyBuilder", assemblybuilder_fields},
+ {"ConstructorBuilder", ctorbuilder_fields},
+ {"MethodBuilder", methodbuilder_fields},
+ {"FieldBuilder", fieldbuilder_fields},
+ {"PropertyBuilder", propertybuilder_fields},
+ {"ILGenerator", ilgenerator_fields},
+ {"ILExceptionBlock", ilexblock_fields},
+ {"ILExceptionInfo", ilexinfo_fields},
+ {NULL, NULL}
+};
+
+static const FieldDesc
+monoevent_fields[] = {
+ {"klass", G_STRUCT_OFFSET (MonoReflectionEvent, klass)},
+ {"handle", G_STRUCT_OFFSET (MonoReflectionEvent, event)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monoproperty_fields[] = {
+ {"klass", G_STRUCT_OFFSET (MonoReflectionProperty, klass)},
+ {"prop", G_STRUCT_OFFSET (MonoReflectionProperty, property)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monofield_fields[] = {
+ {"klass", G_STRUCT_OFFSET (MonoReflectionField, klass)},
+ {"fhandle", G_STRUCT_OFFSET (MonoReflectionField, field)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monomethodinfo_fields[] = {
+ {"parent", G_STRUCT_OFFSET (MonoMethodInfo, parent)},
+ {"ret", G_STRUCT_OFFSET (MonoMethodInfo, ret)},
+ {"attrs", G_STRUCT_OFFSET (MonoMethodInfo, attrs)},
+ {"iattrs", G_STRUCT_OFFSET (MonoMethodInfo, implattrs)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monopropertyinfo_fields[] = {
+ {"parent", G_STRUCT_OFFSET (MonoPropertyInfo, parent)},
+ {"name", G_STRUCT_OFFSET (MonoPropertyInfo, name)},
+ {"get_method", G_STRUCT_OFFSET (MonoPropertyInfo, get)},
+ {"set_method", G_STRUCT_OFFSET (MonoPropertyInfo, set)},
+ {"attrs", G_STRUCT_OFFSET (MonoPropertyInfo, attrs)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monofieldinfo_fields[] = {
+ {"parent", G_STRUCT_OFFSET (MonoFieldInfo, parent)},
+ {"type", G_STRUCT_OFFSET (MonoFieldInfo, type)},
+ {"name", G_STRUCT_OFFSET (MonoFieldInfo, name)},
+ {"attrs", G_STRUCT_OFFSET (MonoFieldInfo, attrs)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monomethod_fields[] = {
+ {"mhandle", G_STRUCT_OFFSET (MonoReflectionMethod, method)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+monocmethod_fields[] = {
+ {"mhandle", G_STRUCT_OFFSET (MonoReflectionMethod, method)},
+ {NULL, 0}
+};
+
+static const FieldDesc
+pinfo_fields[] = {
+ {"ClassImpl", G_STRUCT_OFFSET (MonoReflectionParameter, ClassImpl)},
+ {"DefaultValueImpl", G_STRUCT_OFFSET (MonoReflectionParameter, DefaultValueImpl)},
+ {"MemberImpl", G_STRUCT_OFFSET (MonoReflectionParameter, MemberImpl)},
+ {"NameImpl", G_STRUCT_OFFSET (MonoReflectionParameter, NameImpl)},
+ {"PositionImpl", G_STRUCT_OFFSET (MonoReflectionParameter, PositionImpl)},
+ {"AttrsImpl", G_STRUCT_OFFSET (MonoReflectionParameter, AttrsImpl)},
+ {NULL, 0}
+};
+
+static const ClassDesc
+reflection_classes_to_check [] = {
+ {"MonoEvent", monoevent_fields},
+ {"MonoProperty", monoproperty_fields},
+ {"MonoField", monofield_fields},
+ {"MonoMethodInfo", monomethodinfo_fields},
+ {"MonoPropertyInfo", monopropertyinfo_fields},
+ {"MonoFieldInfo", monofieldinfo_fields},
+ {"MonoMethod", monomethod_fields},
+ {"MonoCMethod", monocmethod_fields},
+ {"ParameterInfo", pinfo_fields},
+ {NULL, NULL}
+};
+
+static FieldDesc
+enuminfo_fields[] = {
+ {"utype", G_STRUCT_OFFSET (MonoEnumInfo, utype)},
+ {"values", G_STRUCT_OFFSET (MonoEnumInfo, values)},
+ {"names", G_STRUCT_OFFSET (MonoEnumInfo, names)},
+ {NULL, 0}
+};
+
+static FieldDesc
+delegate_fields[] = {
+ {"target_type", G_STRUCT_OFFSET (MonoDelegate, target_type)},
+ {"m_target", G_STRUCT_OFFSET (MonoDelegate, target)},
+ {"method_name", G_STRUCT_OFFSET (MonoDelegate, method_name)},
+ {"method_ptr", G_STRUCT_OFFSET (MonoDelegate, method_ptr)},
+ {"delegate_trampoline", G_STRUCT_OFFSET (MonoDelegate, delegate_trampoline)},
+ {"method_info", G_STRUCT_OFFSET (MonoDelegate, method_info)},
+ {NULL, 0}
+};
+
+static FieldDesc
+multicast_delegate_fields[] = {
+ {"prev", G_STRUCT_OFFSET (MonoMulticastDelegate, prev)},
+ {NULL, 0}
+};
+
+static FieldDesc
+async_result_fields[] = {
+ {"async_state", G_STRUCT_OFFSET (MonoAsyncResult, async_state)},
+ {"handle", G_STRUCT_OFFSET (MonoAsyncResult, handle)},
+ {"async_delegate", G_STRUCT_OFFSET (MonoAsyncResult, async_delegate)},
+ {"data", G_STRUCT_OFFSET (MonoAsyncResult, data)},
+ {"sync_completed", G_STRUCT_OFFSET (MonoAsyncResult, sync_completed)},
+ {"completed", G_STRUCT_OFFSET (MonoAsyncResult, completed)},
+ {"endinvoke_called", G_STRUCT_OFFSET (MonoAsyncResult, endinvoke_called)},
+ {NULL, 0}
+};
+
+static const ClassDesc
+system_classes_to_check [] = {
+ {"MonoEnumInfo", enuminfo_fields},
+ {"Delegate", delegate_fields},
+ {"MulticastDelegate", multicast_delegate_fields},
+ {NULL, NULL}
+};
+
+static FieldDesc
+mono_method_message_fields[] = {
+ {"method", G_STRUCT_OFFSET (MonoMethodMessage, method)},
+ {"args", G_STRUCT_OFFSET (MonoMethodMessage, args)},
+ {"names", G_STRUCT_OFFSET (MonoMethodMessage, names)},
+ {"arg_types", G_STRUCT_OFFSET (MonoMethodMessage, arg_types)},
+ {"ctx", G_STRUCT_OFFSET (MonoMethodMessage, ctx)},
+ {"rval", G_STRUCT_OFFSET (MonoMethodMessage, rval)},
+ {"exc", G_STRUCT_OFFSET (MonoMethodMessage, exc)},
+ {NULL, 0}
+};
+
+static const ClassDesc
+messaging_classes_to_check [] = {
+ {"AsyncResult", async_result_fields},
+ {"MonoMethodMessage", mono_method_message_fields},
+ {NULL, NULL}
+};
+
+static FieldDesc
+transparent_proxy_fields[] = {
+ {"_rp", G_STRUCT_OFFSET (MonoTransparentProxy, rp)},
+ {"_class", G_STRUCT_OFFSET (MonoTransparentProxy, klass)},
+ {NULL, 0}
+};
+
+static FieldDesc
+real_proxy_fields[] = {
+ {"class_to_proxy", G_STRUCT_OFFSET (MonoRealProxy, class_to_proxy)},
+ {NULL, 0}
+};
+
+static const ClassDesc
+proxy_classes_to_check [] = {
+ {"TransparentProxy", transparent_proxy_fields},
+ {"RealProxy", real_proxy_fields},
+ {NULL, NULL}
+};
+
+static FieldDesc
+wait_handle_fields[] = {
+ {"os_handle", G_STRUCT_OFFSET (MonoWaitHandle, handle)},
+ {"disposed", G_STRUCT_OFFSET (MonoWaitHandle, disposed)},
+ {NULL, 0}
+};
+
+static const ClassDesc
+threading_classes_to_check [] = {
+ {"WaitHandle", wait_handle_fields},
+ {NULL, NULL}
+};
+
+typedef struct {
+ const char *name;
+ const ClassDesc *types;
+} NameSpaceDesc;
+
+static const NameSpaceDesc
+namespaces_to_check[] = {
+ {"System.Runtime.Remoting.Proxies", proxy_classes_to_check},
+ {"System.Runtime.Remoting.Messaging", messaging_classes_to_check},
+ {"System.Reflection.Emit", emit_classes_to_check},
+ {"System.Reflection", reflection_classes_to_check},
+ {"System.Threading", threading_classes_to_check},
+ {"System", system_classes_to_check},
+ {NULL, NULL}
+};
+
+static char*
+check_corlib (MonoImage *corlib)
+{
+ MonoClass *klass;
+ MonoClassField *field;
+ const FieldDesc *fdesc;
+ const ClassDesc *cdesc;
+ const NameSpaceDesc *ndesc;
+ gint struct_offset;
+
+ for (ndesc = namespaces_to_check; ndesc->name; ++ndesc) {
+ for (cdesc = ndesc->types; cdesc->name; ++cdesc) {
+ klass = mono_class_from_name (corlib, ndesc->name, cdesc->name);
+ if (!klass)
+ return g_strdup_printf ("Cannot find class %s", cdesc->name);
+ mono_class_init (klass);
+ /*
+ * FIXME: we should also check the size of valuetypes, or
+ * we're going to have trouble when we access them in arrays.
+ */
+ if (klass->valuetype)
+ struct_offset = 8;
+ else
+ struct_offset = 0;
+ for (fdesc = cdesc->fields; fdesc->name; ++fdesc) {
+ field = mono_class_get_field_from_name (klass, fdesc->name);
+ if (!field || (field->offset != (fdesc->offset + struct_offset)))
+ return g_strdup_printf ("field `%s' mismatch in class %s (%ld != %ld)", fdesc->name, cdesc->name, (long) fdesc->offset, (long) (field?field->offset:-1));
+ }
+ }
+ }
+ return NULL;
+}
+
+char*
+mono_verify_corlib () {
+ return check_corlib (mono_defaults.corlib);
+}
+
diff --git a/mono/metadata/verify.h b/mono/metadata/verify.h
new file mode 100644
index 00000000000..b15c501f49a
--- /dev/null
+++ b/mono/metadata/verify.h
@@ -0,0 +1,27 @@
+#ifndef __MONO_METADATA_VERIFY_H__
+#define __MONO_METADATA_VERIFY_H__
+
+#include <mono/metadata/metadata.h>
+#include <mono/metadata/image.h>
+#include <mono/metadata/loader.h>
+
+typedef enum {
+ MONO_VERIFY_OK,
+ MONO_VERIFY_ERROR,
+ MONO_VERIFY_WARNING,
+ MONO_VERIFY_CLS = 4,
+ MONO_VERIFY_ALL = 7
+} MonoVerifyStatus;
+
+typedef struct {
+ char *message;
+ MonoVerifyStatus status;
+} MonoVerifyInfo;
+
+GSList* mono_image_verify_tables (MonoImage *image, int level);
+GSList* mono_method_verify (MonoMethod *method, int level);
+void mono_free_verify_list (GSList *list);
+char* mono_verify_corlib (void);
+
+#endif /* __MONO_METADATA_VERIFY_H__ */
+
diff --git a/mono/monoburg/.cvsignore b/mono/monoburg/.cvsignore
new file mode 100644
index 00000000000..c6304ef05ad
--- /dev/null
+++ b/mono/monoburg/.cvsignore
@@ -0,0 +1,8 @@
+Makefile
+Makefile.in
+.libs
+.deps
+monoburg
+sample
+sample.c
+parser.c
diff --git a/mono/monoburg/ChangeLog b/mono/monoburg/ChangeLog
new file mode 100644
index 00000000000..1a80085a17b
--- /dev/null
+++ b/mono/monoburg/ChangeLog
@@ -0,0 +1,94 @@
+2002-04-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * monoburg.y (yylex): bug fix in number parsing
+
+2002-04-12 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * monoburg.c: added option -s to specify the c source file for output.
+
+2002-04-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * monoburg.c: added a default handler for warning messages that just
+ output the messages to stderr instead of stdout.
+
+Mon Feb 18 14:28:10 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am: fix compatibility problem with automake 1.4.
+
+Fri Feb 15 14:20:30 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am: avoid automake for build on host stuff.
+
+Fri Feb 8 12:31:40 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * monoburg.c: make generated arrays const, so that they are shared.
+
+Fri Feb 1 15:14:16 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am: support cross-compilation.
+
+2001-11-07 Miguel de Icaza <miguel@ximian.com>
+
+ * monoburg.y: Include string.h, stdlib.h to kill warnings.
+
+ * sample.brg: Include string.h to remove warnings.
+
+2001-09-23 Dietmar Maurer <dietmar@ximian.com>
+
+ * monoburg.c: add a macro MBALLOC_STATE to define the allocation
+ function for MBState. Added an additional user data argument to
+ mono_burg_label - the data can be used in the cost functions. The
+ type can be defined with MBCOST_DATA macro.
+ (emit_cost_func): inline cost functions
+
+2001-09-22 Dietmar Maurer <dietmar@ximian.com>
+
+ * monoburg.y (strndup): removed, use g_strndup instead
+
+ * monoburg.c (create_term): bug fix: g_strdup strings from the parser
+
+2001-09-21 Miguel de Icaza <miguel@ximian.com>
+
+ * Makefile.am (EXTRA_DIST): Add man page to the distro
+
+2001-09-21 Dietmar Maurer <dietmar@ximian.com>
+
+ * monoburg.y (yylex): bug fix
+
+2001-09-19 Dietmar Maurer <dietmar@ximian.com>
+
+ * monoburg.c (emit_header): bug fix for MBCOND macro
+
+Tue Sep 18 13:15:12 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * monoburg.y: fix ANSI C issue.
+
+2001-09-14 Dietmar Maurer <dietmar@ximian.com>
+
+ * monoburg.c (emit_prototypes): add an additional argument to the
+ code emit function - a pointer to the code buffer
+
+Tue Sep 11 13:46:35 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am: get it to work on platforms that insist on having
+ a weird extension at the end of an executable name.
+
+Mon Sep 10 17:24:45 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * Makefile.am: make it work for make distcheck.
+
+2001-09-09 Nick Drochak <ndrochak@gol.com>
+
+ * Makefile.am: change CLEANFILES line to use just '=' instead of '+='
+ some versions of automake complain if you try to '+=' before you '='
+
+2001-09-08 Dietmar Maurer <dietmar@ximian.com>
+
+ * monoburg.c (emit_header): added some convenient macros
+
+ * monoburg.y (optcfunc): allow arbitrary cost functions
+
+2001-09-06 Dietmar Maurer <dietmar@ximian.com>
+
+ * monoburg.c (emit_header): use macros to access the tree (like in iburg)
+
diff --git a/mono/monoburg/Makefile.am b/mono/monoburg/Makefile.am
new file mode 100644
index 00000000000..eb0401eb31d
--- /dev/null
+++ b/mono/monoburg/Makefile.am
@@ -0,0 +1,28 @@
+INCLUDES = $(BUILD_GLIB_CFLAGS)
+CC=$(CC_FOR_BUILD)
+
+#noinst_PROGRAMS = sample
+
+#sample_SOURCES = sample.c
+
+all: monoburg$(BUILD_EXEEXT)
+
+parser.c: $(srcdir)/monoburg.y
+ bison $(srcdir)/monoburg.y -o parser.c
+
+monoburg$(BUILD_EXEEXT): $(srcdir)/monoburg.c $(srcdir)/monoburg.h parser.c
+ $(CC_FOR_BUILD) -o $@ $(srcdir)/monoburg.c parser.c $(INCLUDES) $(BUILD_GLIB_LIBS)
+
+sample.c: monoburg$(BUILD_EXEEXT) $(srcdir)/sample.brg
+ ./monoburg$(BUILD_EXEEXT) $(srcdir)/sample.brg > sample.c
+
+#sample_LDADD = $(BUILD_GLIB_LIBS)
+
+BUILT_SOURCES = parser.c sample.c
+
+CLEANFILES = $(BUILT_SOURCES) monoburg$(BUILD_EXEEXT)
+
+man_MANS = monoburg.1
+
+EXTRA_DIST = ChangeLog monoburg.c monoburg.h monoburg.y sample.brg $(man_MANS)
+
diff --git a/mono/monoburg/README b/mono/monoburg/README
new file mode 100644
index 00000000000..61348bbdaaa
--- /dev/null
+++ b/mono/monoburg/README
@@ -0,0 +1,9 @@
+This is an implementation of an IBurg like code generator generator. It is
+based on the papers from Christopher W. Fraser, Robert R. Henry and Todd
+A. Proebsting:
+
+Reference 1: BURG - Fast Optimal Instruction Selection and Tree Parsing
+Reference 2: Engineering a Simple, Efficient Code Generator Generator
+
+Examples: sample.brg
+
diff --git a/mono/monoburg/monoburg.1 b/mono/monoburg/monoburg.1
new file mode 100644
index 00000000000..5edf819801f
--- /dev/null
+++ b/mono/monoburg/monoburg.1
@@ -0,0 +1,90 @@
+.\"
+.\" monoburg manual page.
+.\" (C) Ximian, Inc.
+.\" Author:
+.\" Dietmar Maurer (dietmar@ximian.com)
+.\"
+.TH Mono "Mono 1.0"
+.SH NAME
+monoburg \- code generator generator
+.SH SYNOPSIS
+.PP
+.B monoburg
+[\-h]
+[\-d HEADER]
+FILE
+.SH DESCRIPTION
+The \fImonoburg\fP program is used to generate tree pattern matchers
+from BURG specifications. \fImonoburg\fP accepts the following EBNF grammar.
+.PP
+.nf
+.RS
+.ft CW
+spec: ccode `%%' { dcl } [`%%' ccode]
+
+dcl: `%start' nonterm
+ `%term' { identifier [`=' integer] }
+ nonterm `:' tree [cost] [ `{' ccode `}' ] [costfunc]
+
+tree: term `(' tree `,' tree `)'
+ term `(' tree `)'
+ term
+ nonterm
+
+cost: `"' string '"'
+ integer
+
+costfunc: `cost' `{' ccode `}'
+.RE
+.fi
+.PP
+Where \fIccode\fP is arbitrary C code. \fIcost\fP and \fIcostfunc\fP are
+used mutually exclusive, you can't use both in one rule. \fIcost\fP must be a C
+expression, whereas \fIccode\fP inside \fIcostfunc\fP is the body of a C
+function. Here are some example rules:
+.PP
+.nf
+.RS
+.ft CW
+# define some terminal
+%term Fetch Four Mul Plus
+
+# this rule uses fixed costs
+addr: Plus (con, Mul (Four, reg)) 2
+{
+ printf ("Emit your code here.");
+}
+
+# this one computes costs inside a function
+reg: Fetch (addr)
+{
+ printf ("Tree address is %p", tree);
+
+} cost {
+ int c;
+
+ c = 1; /* calculate the costs here */
+
+ return c;
+}
+.RE
+.fi
+.PP
+
+.SH OPTIONS
+The following options are supported:
+.TP
+.I "-h"
+Displays usage instructions.
+.TP
+.I "-d HEADER"
+Writes a separate header file which contains all monoburg definitions.
+.PP
+.SH AUTHOR
+monoburg was written by Dietmar Maurer. It is based on the papers from
+Christopher W.\ Fraser, Robert R.\ Henry and Todd A.\ Proebsting:
+"BURG - Fast Optimal Instruction Selection and Tree Parsing" and
+"Engineering a Simple, Efficient Code Generator Generator".
+.SH SEE ALSO
+.BR monodis(1)
+.BR pedump(1)
diff --git a/mono/monoburg/monoburg.c b/mono/monoburg/monoburg.c
new file mode 100644
index 00000000000..795b959fff3
--- /dev/null
+++ b/mono/monoburg/monoburg.c
@@ -0,0 +1,928 @@
+/*
+ * monoburg.c: an iburg like code generator generator
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "monoburg.h"
+
+extern void yyparse (void);
+
+static GHashTable *term_hash;
+static GList *term_list;
+static GHashTable *nonterm_hash;
+static GList *nonterm_list;
+static GList *rule_list;
+
+FILE *inputfd;
+FILE *outputfd;
+static FILE *deffd;
+static FILE *cfd;
+
+static void output (char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf (outputfd, fmt, ap);
+ va_end (ap);
+}
+
+void
+create_rule (char *id, Tree *tree, char *code, char *cost, char *cfunc)
+{
+ Rule *rule = g_new0 (Rule, 1);
+
+ if (!cfunc && !cost)
+ cost = "0";
+
+ rule->lhs = nonterm (id);
+ rule->tree = tree;
+ rule_list = g_list_append (rule_list, rule);
+ rule->cost = g_strdup (cost);
+ rule->cfunc = g_strdup (cfunc);
+ rule->code = g_strdup (code);
+
+ if (cfunc) {
+ if (cost)
+ yyerror ("duplicated costs (constant costs and cost function)");
+ else
+ rule->cost = g_strdup_printf ("mono_burg_cost_%d (tree, data)",
+ g_list_length (rule_list));
+ }
+
+ rule->lhs->rules = g_list_append (rule->lhs->rules, rule);
+
+ if (tree->op)
+ tree->op->rules = g_list_append (tree->op->rules, rule);
+ else
+ tree->nonterm->chain = g_list_append (tree->nonterm->chain, rule);
+}
+
+Tree *
+create_tree (char *id, Tree *left, Tree *right)
+{
+ int arity = (left != NULL) + (right != NULL);
+ Term *term = g_hash_table_lookup (term_hash, id);
+ Tree *tree = g_new0 (Tree, 1);
+
+ if (term) {
+ if (term->arity == -1)
+ term->arity = arity;
+
+ if (term->arity != arity)
+ yyerror ("changed arity of terminal %s from %d to %d",
+ id, term->arity, arity);
+
+ tree->op = term;
+ tree->left = left;
+ tree->right = right;
+ } else {
+ tree->nonterm = nonterm (id);
+ }
+
+ return tree;
+}
+
+static void
+check_term_num (char *key, Term *value, int num)
+{
+ if (num != -1 && value->number == num)
+ yyerror ("duplicate terminal id \"%s\"", key);
+}
+
+void
+create_term (char *id, int num)
+{
+ Term *term;
+
+ if (nonterm_list)
+ yyerror ("terminal definition after nonterminal definition");
+
+ if (num < -1)
+ yyerror ("invalid terminal number %d", num);
+
+ if (!term_hash)
+ term_hash = g_hash_table_new (g_str_hash , g_str_equal);
+
+ g_hash_table_foreach (term_hash, (GHFunc) check_term_num, (gpointer) num);
+
+ term = g_new0 (Term, 1);
+
+ term->name = g_strdup (id);
+ term->number = num;
+ term->arity = -1;
+
+ term_list = g_list_append (term_list, term);
+
+ g_hash_table_insert (term_hash, term->name, term);
+}
+
+NonTerm *
+nonterm (char *id)
+{
+ NonTerm *nterm;
+
+ if (!nonterm_hash)
+ nonterm_hash = g_hash_table_new (g_str_hash , g_str_equal);
+
+ if ((nterm = g_hash_table_lookup (nonterm_hash, id)))
+ return nterm;
+
+ nterm = g_new0 (NonTerm, 1);
+
+ nterm->name = g_strdup (id);
+ nonterm_list = g_list_append (nonterm_list, nterm);
+ nterm->number = g_list_length (nonterm_list);
+
+ g_hash_table_insert (nonterm_hash, nterm->name, nterm);
+
+ return nterm;
+}
+
+void
+start_nonterm (char *id)
+{
+ static gboolean start_def;
+
+ if (start_def)
+ yyerror ("start symbol redeclared");
+
+ start_def = TRUE;
+ nonterm (id);
+}
+
+static void
+emit_tree_string (Tree *tree)
+{
+ if (tree->op) {
+ output ("%s", tree->op->name);
+ if (tree->op->arity) {
+ output ("(");
+ emit_tree_string (tree->left);
+ if (tree->right) {
+ output (", ");
+ emit_tree_string (tree->right);
+ }
+ output (")");
+ }
+ } else
+ output ("%s", tree->nonterm->name);
+}
+
+static void
+emit_rule_string (Rule *rule, char *fill)
+{
+ output ("%s/* ", fill);
+
+ output ("%s: ", rule->lhs->name);
+
+ emit_tree_string (rule->tree);
+
+ output (" */\n");
+}
+
+static int
+next_term_num ()
+{
+ GList *l = term_list;
+ int i = 1;
+
+ while (l) {
+ Term *t = (Term *)l->data;
+ if (t->number == i) {
+ l = term_list;
+ i++;
+ } else
+ l = l->next;
+ }
+ return i;
+}
+
+static int
+term_compare_func (Term *t1, Term *t2)
+{
+ return t1->number - t2->number;
+}
+
+static void
+emit_header ()
+{
+ GList *l;
+
+ output ("#include <glib.h>\n");
+ output ("\n");
+
+ output ("#ifndef MBTREE_TYPE\n#error MBTREE_TYPE undefined\n#endif\n");
+ output ("#ifndef MBTREE_OP\n#define MBTREE_OP(t) ((t)->op)\n#endif\n");
+ output ("#ifndef MBTREE_LEFT\n#define MBTREE_LEFT(t) ((t)->left)\n#endif\n");
+ output ("#ifndef MBTREE_RIGHT\n#define MBTREE_RIGHT(t) ((t)->right)\n#endif\n");
+ output ("#ifndef MBTREE_STATE\n#define MBTREE_STATE(t) ((t)->state)\n#endif\n");
+ output ("#ifndef MBCGEN_TYPE\n#define MBCGEN_TYPE int\n#endif\n");
+ output ("#ifndef MBALLOC_STATE\n#define MBALLOC_STATE g_new (MBState, 1)\n#endif\n");
+ output ("#ifndef MBCOST_DATA\n#define MBCOST_DATA gpointer\n#endif\n");
+ output ("\n");
+ output ("#define MBMAXCOST 32768\n");
+
+ output ("\n");
+ output ("#define MBCOND(x) if (!(x)) return MBMAXCOST;\n");
+
+ output ("\n");
+
+ for (l = term_list; l; l = l->next) {
+ Term *t = (Term *)l->data;
+ if (t->number == -1)
+ t->number = next_term_num ();
+ }
+ term_list = g_list_sort (term_list, (GCompareFunc)term_compare_func);
+
+ for (l = term_list; l; l = l->next) {
+ Term *t = (Term *)l->data;
+ if (t->number == -1)
+ t->number = next_term_num ();
+
+ output ("#define MB_TERM_%s\t %d\n", t->name, t->number);
+
+ }
+ output ("\n");
+
+}
+
+static void
+emit_nonterm ()
+{
+ GList *l;
+
+ for (l = nonterm_list; l; l = l->next) {
+ NonTerm *n = (NonTerm *)l->data;
+ output ("#define MB_NTERM_%s\t%d\n", n->name, n->number);
+ }
+ output ("#define MB_MAX_NTERMS\t%d\n", g_list_length (nonterm_list));
+ output ("\n");
+}
+
+static void
+emit_state ()
+{
+ GList *l;
+ int i, j;
+
+ output ("typedef struct _MBState MBState;\n");
+ output ("struct _MBState {\n");
+ output ("\tint\t\t op;\n");
+ output ("\tMBState\t\t*left, *right;\n");
+ output ("\tguint16\t\tcost[%d];\n", g_list_length (nonterm_list) + 1);
+
+ for (l = nonterm_list; l; l = l->next) {
+ NonTerm *n = (NonTerm *)l->data;
+ g_assert (g_list_length (n->rules) < 256);
+ i = g_list_length (n->rules);
+ j = 1;
+ while (i >>= 1)
+ j++;
+ output ("\tunsigned int\t rule_%s:%d;\n", n->name, j);
+ }
+ output ("};\n\n");
+}
+
+static void
+emit_decoders ()
+{
+ GList *l;
+ GList *rl;
+
+ for (l = nonterm_list; l; l = l->next) {
+ NonTerm *n = (NonTerm *)l->data;
+ output ("const int mono_burg_decode_%s[] = {\n", n->name);
+ output ("\t0,\n");
+ for (rl = n->rules; rl; rl = rl->next) {
+ Rule *rule = (Rule *)rl->data;
+ output ("\t%d,\n", g_list_index (rule_list, rule) + 1);
+ }
+
+ output ("};\n\n");
+ }
+}
+
+static void
+emit_tree_match (char *st, Tree *t)
+{
+ char *tn;
+
+ output ("\t\t\t%sop == %d /* %s */", st, t->op->number, t->op->name);
+
+ if (t->left && t->left->op) {
+ tn = g_strconcat (st, "left->", NULL);
+ output (" &&\n");
+ emit_tree_match (tn, t->left);
+ g_free (tn);
+ }
+
+ if (t->right && t->right->op) {
+ tn = g_strconcat (st, "right->", NULL);
+ output (" &&\n");
+ emit_tree_match (tn, t->right);
+ g_free (tn);
+ }
+}
+
+static void
+emit_rule_match (Rule *rule)
+{
+ Tree *t = rule->tree;
+
+ if ((t->left && t->left->op) ||
+ (t->right && t->right->op)) {
+ output ("\t\tif (\n");
+ emit_tree_match ("p->", t);
+ output ("\n\t\t)\n");
+ }
+}
+
+static void
+emit_costs (char *st, Tree *t)
+{
+ char *tn;
+
+ if (t->op) {
+
+ if (t->left) {
+ tn = g_strconcat (st, "left->", NULL);
+ emit_costs (tn, t->left);
+ g_free (tn);
+ }
+
+ if (t->right) {
+ tn = g_strconcat (st, "right->", NULL);
+ emit_costs (tn, t->right);
+ }
+ } else
+ output ("%scost[MB_NTERM_%s] + ", st, t->nonterm->name);
+}
+
+static void
+emit_cond_assign (Rule *rule, char *cost, char *fill)
+{
+ char *rc;
+
+ if (cost)
+ rc = g_strconcat ("c + ", cost, NULL);
+ else
+ rc = g_strdup ("c");
+
+
+ output ("%sif (%s < p->cost[MB_NTERM_%s]) {\n", fill, rc, rule->lhs->name);
+
+ output ("%s\tp->cost[MB_NTERM_%s] = %s;\n", fill, rule->lhs->name, rc);
+
+ output ("%s\tp->rule_%s = %d;\n", fill, rule->lhs->name,
+ g_list_index (rule->lhs->rules, rule) + 1);
+
+ if (rule->lhs->chain)
+ output ("%s\tclosure_%s (p, %s);\n", fill, rule->lhs->name, rc);
+
+ output ("%s}\n", fill);
+
+ g_free (rc);
+
+}
+
+static void
+emit_label_func ()
+{
+ GList *l;
+ int i;
+
+ output ("static MBState *\n");
+ output ("mono_burg_label_priv (MBTREE_TYPE *tree, MBCOST_DATA *data) {\n");
+
+ output ("\tint arity;\n");
+ output ("\tint c;\n");
+ output ("\tMBState *p, *left, *right;\n\n");
+
+ output ("\tswitch (mono_burg_arity [MBTREE_OP(tree)]) {\n");
+ output ("\tcase 0:\n");
+ output ("\t\tleft = NULL;\n");
+ output ("\t\tright = NULL;\n");
+ output ("\t\tbreak;\n");
+ output ("\tcase 1:\n");
+ output ("\t\tleft = mono_burg_label_priv (MBTREE_LEFT(tree), data);\n");
+ output ("\t\tright = NULL;\n");
+ output ("\t\tbreak;\n");
+ output ("\tcase 2:\n");
+ output ("\t\tleft = mono_burg_label_priv (MBTREE_LEFT(tree), data);\n");
+ output ("\t\tright = mono_burg_label_priv (MBTREE_RIGHT(tree), data);\n");
+ output ("\t}\n\n");
+
+ output ("\tarity = (left != NULL) + (right != NULL);\n");
+ output ("\tg_assert (arity == mono_burg_arity [MBTREE_OP(tree)]);\n\n");
+
+ output ("\tp = MBALLOC_STATE;\n");
+ output ("\tmemset (p, 0, sizeof (MBState));\n");
+ output ("\tp->op = MBTREE_OP(tree);\n");
+ output ("\tp->left = left;\n");
+ output ("\tp->right = right;\n");
+
+ for (l = nonterm_list, i = 0; l; l = l->next) {
+ output ("\tp->cost [%d] = 32767;\n", ++i);
+ }
+ output ("\n");
+
+ output ("\tswitch (MBTREE_OP(tree)) {\n");
+ for (l = term_list; l; l = l->next) {
+ Term *t = (Term *)l->data;
+ GList *rl;
+ output ("\tcase %d: /* %s */\n", t->number, t->name);
+
+ for (rl = t->rules; rl; rl = rl->next) {
+ Rule *rule = (Rule *)rl->data;
+ Tree *t = rule->tree;
+
+ emit_rule_string (rule, "\t\t");
+
+ emit_rule_match (rule);
+
+ output ("\t\t{\n");
+
+ output ("\t\t\tc = ");
+
+ emit_costs ("", t);
+
+ output ("%s;\n", rule->cost);
+
+ emit_cond_assign (rule, NULL, "\t\t\t");
+
+ output ("\t\t}\n");
+ }
+
+ output ("\t\tbreak;\n");
+ }
+
+ output ("\tdefault:\n");
+ output ("\t\tg_error (\"unknown operator\");\n");
+ output ("\t}\n\n");
+
+ output ("\tMBTREE_STATE(tree) = p;\n");
+
+ output ("\treturn p;\n");
+
+ output ("}\n\n");
+
+ output ("MBState *\n");
+ output ("mono_burg_label (MBTREE_TYPE *tree, MBCOST_DATA *data)\n{\n");
+ output ("\tMBState *p = mono_burg_label_priv (tree, data);\n");
+ output ("\treturn p->rule_%s ? p : NULL;\n", ((NonTerm *)nonterm_list->data)->name);
+ output ("}\n\n");
+}
+
+static char *
+compute_kids (char *ts, Tree *tree, int *n)
+{
+ char *res;
+
+ if (tree->nonterm) {
+ return g_strdup_printf ("\t\tkids[%d] = %s;\n", (*n)++, ts);
+ } else if (tree->op && tree->op->arity) {
+ char *res2 = NULL;
+
+ res = compute_kids (g_strdup_printf ("MBTREE_LEFT(%s)", ts),
+ tree->left, n);
+ if (tree->op->arity == 2)
+ res2 = compute_kids (g_strdup_printf ("MBTREE_RIGHT(%s)", ts),
+ tree->right, n);
+ return g_strconcat (res, res2, NULL);
+ }
+ return "";
+}
+
+static void
+emit_kids ()
+{
+ GList *l, *nl;
+ int i, j, c, n, *si;
+ char **sa;
+
+ output ("int\n");
+ output ("mono_burg_rule (MBState *state, int goal)\n{\n");
+
+ output ("\tg_return_val_if_fail (state != NULL, 0);\n");
+ output ("\tg_return_val_if_fail (goal > 0, 0);\n\n");
+
+ output ("\tswitch (goal) {\n");
+
+ for (nl = nonterm_list; nl; nl = nl->next) {
+ NonTerm *n = (NonTerm *)nl->data;
+ output ("\tcase MB_NTERM_%s:\n", n->name);
+ output ("\t\treturn mono_burg_decode_%s [state->rule_%s];\n",
+ n->name, n->name);
+ }
+
+ output ("\tdefault: g_assert_not_reached ();\n");
+ output ("\t}\n");
+ output ("\treturn 0;\n");
+ output ("}\n\n");
+
+
+ output ("MBTREE_TYPE **\n");
+ output ("mono_burg_kids (MBTREE_TYPE *tree, int rulenr, MBTREE_TYPE *kids [])\n{\n");
+ output ("\tg_return_val_if_fail (tree != NULL, NULL);\n");
+ output ("\tg_return_val_if_fail (MBTREE_STATE(tree) != NULL, NULL);\n");
+ output ("\tg_return_val_if_fail (kids != NULL, NULL);\n\n");
+
+ output ("\tswitch (rulenr) {\n");
+
+ n = g_list_length (rule_list);
+ sa = g_new0 (char *, n);
+ si = g_new0 (int, n);
+
+ /* compress the case statement */
+ for (l = rule_list, i = 0, c = 0; l; l = l->next) {
+ Rule *rule = (Rule *)l->data;
+ int kn = 0;
+ char *k;
+
+ k = compute_kids ("tree", rule->tree, &kn);
+ for (j = 0; j < c; j++)
+ if (!strcmp (sa [j], k))
+ break;
+
+ si [i++] = j;
+ if (j == c)
+ sa [c++] = k;
+ }
+
+ for (i = 0; i < c; i++) {
+ for (l = rule_list, j = 0; l; l = l->next, j++)
+ if (i == si [j])
+ output ("\tcase %d:\n", j + 1);
+ output ("%s", sa [i]);
+ output ("\t\tbreak;\n");
+ }
+
+ output ("\tdefault:\n\t\tg_assert_not_reached ();\n");
+ output ("\t}\n");
+ output ("\treturn kids;\n");
+ output ("}\n\n");
+
+}
+
+static void
+emit_emitter_func ()
+{
+ GList *l;
+ int i;
+
+ for (l = rule_list, i = 0; l; l = l->next) {
+ Rule *rule = (Rule *)l->data;
+
+ if (rule->code) {
+ output ("static void ");
+
+ emit_rule_string (rule, "");
+
+ output ("mono_burg_emit_%d (MBTREE_TYPE *tree, MBCGEN_TYPE *s)\n", i);
+ output ("{\n");
+ output ("%s\n", rule->code);
+ output ("}\n\n");
+ }
+ i++;
+ }
+
+ output ("MBEmitFunc const mono_burg_func [] = {\n");
+ output ("\tNULL,\n");
+ for (l = rule_list, i = 0; l; l = l->next) {
+ Rule *rule = (Rule *)l->data;
+ if (rule->code)
+ output ("\tmono_burg_emit_%d,\n", i);
+ else
+ output ("\tNULL,\n");
+ i++;
+ }
+ output ("};\n\n");
+}
+
+static void
+emit_cost_func ()
+{
+ GList *l;
+ int i;
+
+ for (l = rule_list, i = 0; l; l = l->next) {
+ Rule *rule = (Rule *)l->data;
+
+ if (rule->cfunc) {
+ output ("inline static guint16\n");
+
+ emit_rule_string (rule, "");
+
+ output ("mono_burg_cost_%d (MBTREE_TYPE *tree, MBCOST_DATA *data)\n", i + 1);
+ output ("{\n");
+ output ("%s\n", rule->cfunc);
+ output ("}\n\n");
+ }
+ i++;
+ }
+}
+
+static void
+emit_closure ()
+{
+ GList *l, *rl;
+
+ for (l = nonterm_list; l; l = l->next) {
+ NonTerm *n = (NonTerm *)l->data;
+
+ if (n->chain)
+ output ("static void closure_%s (MBState *p, int c);\n", n->name);
+ }
+
+ output ("\n");
+
+ for (l = nonterm_list; l; l = l->next) {
+ NonTerm *n = (NonTerm *)l->data;
+
+ if (n->chain) {
+ output ("static void\n");
+ output ("closure_%s (MBState *p, int c)\n{\n", n->name);
+ for (rl = n->chain; rl; rl = rl->next) {
+ Rule *rule = (Rule *)rl->data;
+
+ emit_rule_string (rule, "\t");
+ emit_cond_assign (rule, rule->cost, "\t");
+ }
+ output ("}\n\n");
+ }
+ }
+}
+
+static char *
+compute_nonterms (Tree *tree)
+{
+ if (!tree)
+ return "";
+
+ if (tree->nonterm) {
+ return g_strdup_printf ("MB_NTERM_%s, ", tree->nonterm->name);
+ } else {
+ return g_strconcat (compute_nonterms (tree->left),
+ compute_nonterms (tree->right), NULL);
+ }
+}
+
+static void
+emit_vardefs ()
+{
+ GList *l;
+ int i, j, c, n, *si;
+ char **sa;
+
+ output ("const guint8 mono_burg_arity [] = {\n");
+ for (l = term_list, i = 0; l; l = l->next) {
+ Term *t = (Term *)l->data;
+
+ while (i < t->number) {
+ output ("\t0,\n");
+ i++;
+ }
+
+ output ("\t%d, /* %s */\n", t->arity, t->name);
+
+ i++;
+ }
+ output ("};\n\n");
+
+ output ("const char *const mono_burg_term_string [] = {\n");
+ output ("\tNULL,\n");
+ for (l = term_list, i = 0; l; l = l->next) {
+ Term *t = (Term *)l->data;
+ output ("\t\"%s\",\n", t->name);
+ }
+ output ("};\n\n");
+
+ output ("const char * const mono_burg_rule_string [] = {\n");
+ output ("\tNULL,\n");
+ for (l = rule_list, i = 0; l; l = l->next) {
+ Rule *rule = (Rule *)l->data;
+ output ("\t\"%s: ", rule->lhs->name);
+ emit_tree_string (rule->tree);
+ output ("\",\n");
+ }
+ output ("};\n\n");
+
+ n = g_list_length (rule_list);
+ sa = g_new0 (char *, n);
+ si = g_new0 (int, n);
+
+ /* compress the _nts array */
+ for (l = rule_list, i = 0, c = 0; l; l = l->next) {
+ Rule *rule = (Rule *)l->data;
+ char *s = compute_nonterms (rule->tree);
+
+ for (j = 0; j < c; j++)
+ if (!strcmp (sa [j], s))
+ break;
+
+ si [i++] = j;
+ if (j == c) {
+ output ("static const guint16 mono_burg_nts_%d [] = { %s0 };\n", c, s);
+ sa [c++] = s;
+ }
+ }
+ output ("\n");
+
+ output ("const guint16 *const mono_burg_nts [] = {\n");
+ output ("\t0,\n");
+ for (l = rule_list, i = 0; l; l = l->next) {
+ Rule *rule = (Rule *)l->data;
+ output ("\tmono_burg_nts_%d, ", si [i++]);
+ emit_rule_string (rule, "");
+ }
+ output ("};\n\n");
+}
+
+static void
+emit_prototypes ()
+{
+ output ("typedef void (*MBEmitFunc) (MBTREE_TYPE *tree, MBCGEN_TYPE *s);\n\n");
+
+ output ("extern const char * const mono_burg_term_string [];\n");
+ output ("extern const char * const mono_burg_rule_string [];\n");
+ output ("extern const guint16 *const mono_burg_nts [];\n");
+ output ("extern MBEmitFunc const mono_burg_func [];\n");
+
+ output ("MBState *mono_burg_label (MBTREE_TYPE *tree, MBCOST_DATA *data);\n");
+ output ("int mono_burg_rule (MBState *state, int goal);\n");
+ output ("MBTREE_TYPE **mono_burg_kids (MBTREE_TYPE *tree, int rulenr, MBTREE_TYPE *kids []);\n");
+
+ output ("\n");
+}
+
+static void check_reach (NonTerm *n);
+
+static void
+mark_reached (Tree *tree)
+{
+ if (tree->nonterm && !tree->nonterm->reached)
+ check_reach (tree->nonterm);
+ if (tree->left)
+ mark_reached (tree->left);
+ if (tree->right)
+ mark_reached (tree->right);
+}
+
+static void
+check_reach (NonTerm *n)
+{
+ GList *l;
+
+ n->reached = 1;
+ for (l = n->rules; l; l = l->next) {
+ Rule *rule = (Rule *)l->data;
+ mark_reached (rule->tree);
+ }
+}
+
+static void
+check_result ()
+{
+ GList *l;
+
+ for (l = term_list; l; l = l->next) {
+ Term *term = (Term *)l->data;
+ if (term->arity == -1)
+ g_warning ("unused terminal \"%s\"",term->name);
+ }
+
+ check_reach (((NonTerm *)nonterm_list->data));
+
+ for (l = nonterm_list; l; l = l->next) {
+ NonTerm *n = (NonTerm *)l->data;
+ if (!n->reached)
+ g_error ("unreachable nonterm \"%s\"", n->name);
+ }
+}
+
+static void
+usage ()
+{
+ fprintf (stderr,
+ "Usage is: monoburg -d file.h -s file.c [inputfile] \n");
+ exit (1);
+}
+
+static void
+warning_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+ (void) fprintf ((FILE *) user_data, "** WARNING **: %s\n", message);
+}
+
+int
+main (int argc, char *argv [])
+{
+ char *cfile = NULL;
+ char *deffile = NULL;
+ char *infile = NULL;
+ int i;
+
+ g_log_set_handler (NULL, G_LOG_LEVEL_WARNING, warning_handler, stderr);
+
+ for (i = 1; i < argc; i++){
+ if (argv [i][0] == '-'){
+ if (argv [i][1] == 'h') {
+ usage ();
+ } else if (argv [i][1] == 'd') {
+ deffile = argv [++i];
+ } else if (argv [i][1] == 's') {
+ cfile = argv [++i];
+ } else {
+ usage ();
+ }
+ } else {
+ if (infile)
+ usage ();
+ else
+ infile = argv [i];
+ }
+ }
+
+ if (deffile) {
+ if (!(deffd = fopen (deffile, "w"))) {
+ perror ("cant open header output file");
+ exit (-1);
+ }
+ outputfd = deffd;
+ output ("#ifndef _MONO_BURG_DEFS_\n");
+ output ("#define _MONO_BURG_DEFS_\n\n");
+ } else
+ outputfd = stdout;
+
+
+ if (infile) {
+ if (!(inputfd = fopen (infile, "r"))) {
+ perror ("cant open input file");
+ exit (-1);
+ }
+ } else {
+ inputfd = stdin;
+ }
+
+ yyparse ();
+
+ check_result ();
+
+ if (!nonterm_list)
+ g_error ("no start symbol found");
+
+ emit_header ();
+ emit_nonterm ();
+ emit_state ();
+ emit_prototypes ();
+
+ if (deffd) {
+ output ("#endif /* _MONO_BURG_DEFS_ */\n");
+ fclose (deffd);
+
+ if (cfile == NULL)
+ outputfd = stdout;
+ else {
+ if (!(cfd = fopen (cfile, "w"))) {
+ perror ("cant open c output file");
+ (void) remove (deffile);
+ exit (-1);
+ }
+
+ outputfd = cfd;
+ }
+
+ output ("#include \"%s\"\n\n", deffile);
+ }
+
+ emit_vardefs ();
+ emit_cost_func ();
+ emit_emitter_func ();
+ emit_decoders ();
+
+ emit_closure ();
+ emit_label_func ();
+
+ emit_kids ();
+
+ yyparsetail ();
+
+ if (cfile)
+ fclose (cfd);
+
+ if (infile)
+ fclose (inputfd);
+
+ return 0;
+}
diff --git a/mono/monoburg/monoburg.h b/mono/monoburg/monoburg.h
new file mode 100644
index 00000000000..f1011867fab
--- /dev/null
+++ b/mono/monoburg/monoburg.h
@@ -0,0 +1,63 @@
+#ifndef __MONO_MONOBURG_H__
+#define __MONO_MONOBURG_H__
+
+#include <glib.h>
+
+void yyerror (char *fmt, ...);
+int yylex (void);
+
+extern FILE *inputfd;
+extern FILE *outputfd;
+
+typedef struct _Rule Rule;
+
+typedef struct _Term Term;
+struct _Term{
+ char *name;
+ int number;
+ int arity;
+ GList *rules; /* rules that start with this terminal */
+};
+
+typedef struct _NonTerm NonTerm;
+
+struct _NonTerm {
+ char *name;
+ int number;
+ GList *rules; /* rules with this nonterm on the left side */
+ GList *chain;
+ gboolean reached;
+};
+
+typedef struct _Tree Tree;
+
+struct _Tree {
+ Term *op;
+ Tree *left;
+ Tree *right;
+ NonTerm *nonterm; /* used by chain rules */
+};
+
+struct _Rule {
+ NonTerm *lhs;
+ Tree *tree;
+ char *code;
+ char *cost;
+ char *cfunc;
+};
+
+
+Tree *create_tree (char *id, Tree *left, Tree *right);
+
+void create_term (char *id, int num);
+
+NonTerm *nonterm (char *id);
+
+void start_nonterm (char *id);
+
+void create_rule (char *id, Tree *tree, char *code, char *cost,
+ char *cfunc);
+
+void yyparsetail (void);
+
+#endif
diff --git a/mono/monoburg/monoburg.y b/mono/monoburg/monoburg.y
new file mode 100644
index 00000000000..9c56a290a0d
--- /dev/null
+++ b/mono/monoburg/monoburg.y
@@ -0,0 +1,241 @@
+%{
+/*
+ * monoburg.y: yacc input grammer
+ *
+ * Author:
+ * Dietmar Maurer (dietmar@ximian.com)
+ *
+ * (C) 2001 Ximian, Inc.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <assert.h>
+#include <stdarg.h>
+
+#include "monoburg.h"
+
+static int yylineno = 0;
+static int yylinepos = 0;
+
+%}
+
+%union {
+ char *text;
+ int ivalue;
+ Tree *tree;
+}
+
+%token <text> IDENT
+%token <text> CODE
+%token <text> STRING
+%token START
+%token COST
+%token TERM
+%token <ivalue> INTEGER
+
+%type <tree> tree
+%type <text> optcost
+%type <text> optcfunc
+%type <text> optcode
+
+%%
+
+decls : /* empty */
+ | START IDENT { start_nonterm ($2); } decls
+ | TERM tlist decls
+ | IDENT ':' tree optcost optcode optcfunc { create_rule ($1, $3, $5, $4, $6); } decls
+ ;
+
+optcode : /* empty */ { $$ = NULL }
+ | CODE
+ ;
+
+tlist : /* empty */
+ | tlist IDENT { create_term ($2, -1);}
+ | tlist IDENT '=' INTEGER { create_term ($2, $4); }
+ ;
+
+tree : IDENT { $$ = create_tree ($1, NULL, NULL); }
+ | IDENT '(' tree ')' { $$ = create_tree ($1, $3, NULL); }
+ | IDENT '(' tree ',' tree ')' { $$ = create_tree ($1, $3, $5); }
+ ;
+
+optcost : /* empty */ {$$ = NULL; }
+ | STRING
+ | INTEGER { $$ = g_strdup_printf ("%d", $1); }
+ ;
+
+optcfunc : /*empty */ { $$ = NULL; }
+ | COST CODE { $$ = $2; }
+ ;
+%%
+
+static char input[2048];
+static char *next = input;
+
+void
+yyerror (char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+
+ fprintf (stderr, "line %d(%d): ", yylineno, yylinepos);
+ vfprintf (stderr, fmt, ap);
+ fprintf(stderr, "\n");
+
+ va_end (ap);
+
+ exit (-1);
+}
+
+static char
+nextchar ()
+{
+ static int state = 0;
+ int next_state ;
+ gboolean ll;
+
+ if (!*next) {
+ next = input;
+ *next = 0;
+ do {
+ if (!fgets (input, sizeof (input), inputfd))
+ return 0;
+
+ ll = (input [0] == '%' && input [1] == '%');
+ next_state = state;
+
+ switch (state) {
+ case 0:
+ if (ll) {
+ next_state = 1;
+ } else
+ fputs (input, outputfd);
+ break;
+ case 1:
+ if (ll) {
+ next_state = 2;
+ *next = 0;
+ }
+ break;
+ default:
+ return 0;
+ }
+ ll = state != 1 || input[0] == '#';
+ state = next_state;
+ yylineno++;
+ } while (next_state == 2 || ll);
+ }
+
+ return *next++;
+}
+
+void
+yyparsetail (void)
+{
+ fputs (input, outputfd);
+ while (fgets (input, sizeof (input), inputfd))
+ fputs (input, outputfd);
+}
+
+int
+yylex (void)
+{
+ char c;
+
+ do {
+
+ if (!(c = nextchar ()))
+ return 0;
+
+ yylinepos = next - input + 1;
+
+ if (isspace (c))
+ continue;
+
+ if (c == '%') {
+ if (!strncmp (next, "start", 5) && isspace (next[5])) {
+ next += 5;
+ return START;
+ }
+
+ if (!strncmp (next, "term", 4) && isspace (next[4])) {
+ next += 4;
+ return TERM;
+ }
+ return c;
+ }
+
+ if (isdigit (c)) {
+ int num = 0;
+
+ do {
+ num = 10*num + (c - '0');
+ } while (isdigit (c = (*next++)));
+
+ yylval.ivalue = num;
+ return INTEGER;
+ }
+
+ if (isalpha (c)) {
+ char *n = next;
+ int l;
+
+ if (!strncmp (next - 1, "cost", 4) && isspace (next[3])) {
+ next += 4;
+ return COST;
+ }
+
+ while (isalpha (*n) || isdigit (*n) || *n == '_')
+ n++;
+
+ l = n - next + 1;
+ yylval.text = g_strndup (next - 1, l);
+ next = n;
+ return IDENT;
+ }
+
+ if (c == '"') {
+ int i = 0;
+ static char buf [100000];
+
+ while ((c = *next++) != '"' && c)
+ buf [i++] = c;
+
+ buf [i] = '\0';
+ yylval.text = g_strdup (buf);
+
+ return STRING;
+ }
+
+ if (c == '{') {
+ int i = 0, d = 1;
+ static char buf [100000];
+
+ while (d && (c = nextchar ())) {
+ buf [i++] = c;
+ assert (i < sizeof (buf));
+
+ switch (c) {
+ case '{': d++; break;
+ case '}': d--; break;
+ default:
+ break;
+ }
+ }
+ buf [--i] = '\0';
+ yylval.text = g_strdup (buf);
+
+ return CODE;
+ }
+
+ return c;
+
+ } while (1);
+}
+
diff --git a/mono/monoburg/sample.brg b/mono/monoburg/sample.brg
new file mode 100644
index 00000000000..82812c7e322
--- /dev/null
+++ b/mono/monoburg/sample.brg
@@ -0,0 +1,145 @@
+/*
+ * This header (everything before the first "%%") is copied
+ * directly to the output.
+ */
+
+#include <glib.h>
+#include <stdio.h>
+#include <string.h>
+
+#define MBTREE_TYPE MBTree
+
+typedef struct _MBTree MBTree;
+struct _MBTree {
+ guint16 op;
+ MBTree *left, *right;
+ gpointer state;
+};
+
+%% these are the monoburg definition
+#
+# This is the start of the definitions
+# comments start with a '#' as first line character
+#
+
+#
+# we must fisrt define the terminals
+# with or without numbers
+#
+%term Assign Constant Fetch=3 Four=8 Mul=5 Plus=6
+
+#
+# optional start nonterminal
+#
+%start reg
+
+con: Constant 0
+
+con: Four 0
+
+addr: con 0
+
+addr: Plus(con,reg)
+{
+ int ern = mono_burg_rule (tree->state, MB_NTERM_addr);
+ printf ("%s\n", mono_burg_rule_string [ern]);
+} cost
+{
+ return 1;
+}
+
+addr: Plus(con,Mul(Four,reg)) 2
+{
+ int ern = mono_burg_rule (tree->state, MB_NTERM_addr);
+ printf ("%s\n", mono_burg_rule_string [ern]);
+}
+
+reg: Fetch(addr) 1
+{
+ int ern = mono_burg_rule (tree->state, MB_NTERM_reg);
+ printf ("%s\n", mono_burg_rule_string [ern]);
+}
+
+reg: Assign(addr,reg) 1
+{
+ int ern = mono_burg_rule (tree->state, MB_NTERM_reg);
+ printf ("%s\n", mono_burg_rule_string [ern]);
+}
+
+%% the rest is also copied directly to the output
+/* everything below the second "%%" is also copied directly
+ * to the output file.
+ */
+
+static MBTree *
+create_tree (int op, MBTree *left, MBTree *right)
+{
+ MBTree *t = g_new0 (MBTree, 1);
+
+ t->op = op;
+ t->left = left;
+ t->right = right;
+
+ return t;
+}
+
+static void
+reduce (MBTree *tree, int goal)
+{
+ MBTree *kids[10];
+ int ern = mono_burg_rule (tree->state, goal);
+ guint16 *nts = mono_burg_nts [ern];
+ int i, n;
+
+ mono_burg_kids (tree, ern, kids);
+
+ // printf ("TEST %d %d %s %d\n", goal, ern, mono_burg_rule_string [ern], nts [0]);
+
+ for (i = 0; nts [i]; i++)
+ reduce (kids [i], nts [i]);
+
+ n = (tree->left != NULL) + (tree->right != NULL);
+
+ if (n) { /* not a terminal */
+ // printf ("XXTE %s %d\n", mono_burg_rule_string [ern], n);
+ if (mono_burg_func [ern])
+ mono_burg_func [ern] (tree, NULL);
+ else
+ g_warning ("no code for rule %s\n",
+ mono_burg_rule_string [ern]);
+ } else {
+ if (mono_burg_func [ern])
+ g_warning ("unused code in rule %s\n",
+ mono_burg_rule_string [ern]);
+ }
+}
+
+int
+main ()
+{
+ MBTree *t, *l, *r;
+ MBState *s;
+
+ l = create_tree (MB_TERM_Constant, NULL, NULL);
+
+ r = create_tree (MB_TERM_Fetch, l, NULL);
+ l = create_tree (MB_TERM_Constant, NULL, NULL);
+
+ r = create_tree (MB_TERM_Assign, l, r);
+ l = create_tree (MB_TERM_Four, NULL, NULL);
+
+ r = create_tree (MB_TERM_Mul, l, r);
+ l = create_tree (MB_TERM_Constant, NULL, NULL);
+
+ l = create_tree (MB_TERM_Plus, l, r);
+
+ t = create_tree (MB_TERM_Fetch, l, NULL);
+
+ s = mono_burg_label (t, NULL);
+
+ g_assert (s);
+
+ reduce (t, MB_NTERM_reg);
+
+ return 0;
+}
diff --git a/mono/monograph/.cvsignore b/mono/monograph/.cvsignore
new file mode 100644
index 00000000000..7ab65366557
--- /dev/null
+++ b/mono/monograph/.cvsignore
@@ -0,0 +1,5 @@
+.deps
+.libs
+Makefile
+Makefile.in
+monograph
diff --git a/mono/monograph/ChangeLog b/mono/monograph/ChangeLog
new file mode 100644
index 00000000000..3ab82e73031
--- /dev/null
+++ b/mono/monograph/ChangeLog
@@ -0,0 +1,30 @@
+
+Thu Mar 28 15:18:50 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * monograph.c: some warning cleanups.
+
+Mon Mar 11 11:58:27 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * monograph.c: update --help output, Make error messages less
+ intimidating and more informative.
+
+Mon Mar 11 11:16:53 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * monograph.c: removed method signature and searching helpers
+ that are now provided in libmetadata. Added --control-flow option to
+ create a control flow graph of a method, with basic blocks etc.
+
+Wed Feb 20 17:53:59 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * monograph.c: added -i option to create a graph of the types
+ implementing an interface.
+
+Tue Feb 19 12:24:15 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * monograph.c: fix typo. Update for changes in mono_init ().
+
+Mon Feb 18 14:37:17 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * monograph.c: First commit: program to generate call graphs
+ or type hierarchies from CIL programs.
+
diff --git a/mono/monograph/Makefile.am b/mono/monograph/Makefile.am
new file mode 100644
index 00000000000..5c1feb7e739
--- /dev/null
+++ b/mono/monograph/Makefile.am
@@ -0,0 +1,27 @@
+
+bin_PROGRAMS = monograph
+
+INCLUDES = \
+ -I$(top_srcdir) \
+ $(GMODULE_CFLAGS) \
+ $(GLIB_CFLAGS)
+
+monograph_LDADD = \
+ ../metadata/libmetadata.a \
+ ../io-layer/libwapi.a \
+ ../utils/libmonoutils.a \
+ $(GLIB_LIBS) \
+ $(GMODULE_LIBS) \
+ -lm
+
+GRAPHS=System.Object System.Enum System.Attribute System.ValueType System.Reflection.MemberInfo
+OUT=$(GRAPHS:=.jpeg)
+
+graphs: $(OUT)
+
+%.jpeg: monograph
+ ./monograph -n -o $*.png corlib.dll $*
+ convert -geometry '480x360>' $*.png $*.jpeg
+
+EXTRA_DIST = ChangeLog
+
diff --git a/mono/monograph/monograph.c b/mono/monograph/monograph.c
new file mode 100644
index 00000000000..60bd16472bd
--- /dev/null
+++ b/mono/monograph/monograph.c
@@ -0,0 +1,766 @@
+#include <glib.h>
+#include <string.h>
+#include "mono/metadata/class.h"
+#include "mono/metadata/assembly.h"
+#include "mono/metadata/tokentype.h"
+#include "mono/metadata/opcodes.h"
+#include "mono/metadata/tabledefs.h"
+#include "mono/metadata/cil-coff.h" /* MonoCLIImageInfo */
+#include "mono/metadata/mono-endian.h"
+#include "mono/metadata/appdomain.h" /* mono_init */
+#include "mono/metadata/debug-helpers.h"
+
+static FILE *output;
+static int include_namespace = 0;
+static int max_depth = 6;
+static int verbose = 0;
+static const char *graph_properties = "\tnode [fontsize=8.0]\n\tedge [len=2,color=red]\n";
+
+static void
+output_type_edge (MonoClass *first, MonoClass *second) {
+ if (include_namespace)
+ fprintf (output, "\t\"%s.%s\" -> \"%s.%s\"\n", first->name_space, first->name, second->name_space, second->name);
+ else
+ fprintf (output, "\t\"%s\" -> \"%s\"\n", first->name, second->name);
+}
+
+static void
+print_subtypes (MonoImage *image, MonoClass *class, int depth) {
+ int i, token;
+ MonoTableInfo *t;
+ MonoClass *child;
+
+ if (depth++ > max_depth)
+ return;
+
+ t = &image->tables [MONO_TABLE_TYPEDEF];
+
+ token = mono_metadata_token_index (class->type_token);
+ token <<= TYPEDEFORREF_BITS;
+ token |= TYPEDEFORREF_TYPEDEF;
+
+ /* use a subgraph? */
+ for (i = 0; i < t->rows; ++i) {
+ if (token == mono_metadata_decode_row_col (t, i, MONO_TYPEDEF_EXTENDS)) {
+ child = mono_class_get (image, MONO_TOKEN_TYPE_DEF | (i + 1));
+ output_type_edge (class, child);
+ print_subtypes (image, child, depth);
+ }
+ }
+}
+
+static void
+type_graph (MonoImage *image, const char* cname) {
+ MonoClass *class;
+ MonoClass *parent;
+ MonoClass *child;
+ const char *name_space;
+ char *p;
+ int depth = 0;
+
+ cname = g_strdup (cname);
+ p = strrchr (cname, '.');
+ if (p) {
+ name_space = cname;
+ *p++ = 0;
+ cname = p;
+ } else {
+ name_space = "";
+ }
+ class = mono_class_from_name (image, name_space, cname);
+ if (!class) {
+ g_print ("class %s.%s not found\n", name_space, cname);
+ exit (1);
+ }
+ fprintf (output, "digraph blah {\n");
+ fprintf (output, "%s", graph_properties);
+ child = class;
+ /* go back and print the parents for the node as well: not sure it's a good idea */
+ for (parent = class->parent; parent; parent = parent->parent) {
+ output_type_edge (parent, child);
+ child = parent;
+ }
+ print_subtypes (image, class, depth);
+ fprintf (output, "}\n");
+}
+
+static void
+interface_graph (MonoImage *image, const char* cname) {
+ MonoClass *class;
+ MonoClass *child;
+ const char *name_space;
+ char *p;
+ guint32 cols [MONO_INTERFACEIMPL_SIZE];
+ guint32 token, i, count = 0;
+ MonoTableInfo *intf = &image->tables [MONO_TABLE_INTERFACEIMPL];
+
+ cname = g_strdup (cname);
+ p = strrchr (cname, '.');
+ if (p) {
+ name_space = cname;
+ *p++ = 0;
+ cname = p;
+ } else {
+ name_space = "";
+ }
+ class = mono_class_from_name (image, name_space, cname);
+ if (!class) {
+ g_print ("interface %s.%s not found\n", name_space, cname);
+ exit (1);
+ }
+ /* chek if it's really an interface... */
+ fprintf (output, "digraph interface {\n");
+ fprintf (output, "%s", graph_properties);
+ /* TODO: handle inetrface defined in one image and class defined in another. */
+ token = mono_metadata_token_index (class->type_token);
+ token <<= TYPEDEFORREF_BITS;
+ token |= TYPEDEFORREF_TYPEDEF;
+ for (i = 0; i < intf->rows; ++i) {
+ mono_metadata_decode_row (intf, i, cols, MONO_INTERFACEIMPL_SIZE);
+ /*g_print ("index: %d [%d implements %d]\n", index, cols [MONO_INTERFACEIMPL_CLASS], cols [MONO_INTERFACEIMPL_INTERFACE]);*/
+ if (token == cols [MONO_INTERFACEIMPL_INTERFACE]) {
+ child = mono_class_get (image, MONO_TOKEN_TYPE_DEF | cols [MONO_INTERFACEIMPL_CLASS]);
+ output_type_edge (class, child);
+ count++;
+ }
+ }
+ fprintf (output, "}\n");
+ if (verbose && !count)
+ g_print ("No class implements %s.%s\n", class->name_space, class->name);
+
+}
+
+static char *
+get_signature (MonoMethod *method) {
+ GString *res;
+ static GHashTable *hash = NULL;
+ char *result;
+
+ if (!hash)
+ hash = g_hash_table_new (g_direct_hash, g_direct_equal);
+ if ((result = g_hash_table_lookup (hash, method)))
+ return result;
+
+ res = g_string_new ("");
+ if (include_namespace && *(method->klass->name_space))
+ g_string_sprintfa (res, "%s.", method->klass->name_space);
+ result = mono_signature_get_desc (method->signature, include_namespace);
+ g_string_sprintfa (res, "%s:%s(%s)", method->klass->name, method->name, result);
+ g_free (result);
+ g_hash_table_insert (hash, method, res->str);
+
+ result = res->str;
+ g_string_free (res, FALSE);
+ return result;
+
+}
+
+static void
+output_method_edge (MonoMethod *first, MonoMethod *second) {
+ char * f = get_signature (first);
+ char * s = get_signature (second);
+
+ fprintf (output, "\t\"%s\" -> \"%s\"\n", f, s);
+}
+
+/*
+ * We need to handle virtual calls is derived types.
+ * We could check what types implement the method and
+ * disassemble all of them: this can make the graph to explode.
+ * We could try and keep track of the 'this' pointer type and
+ * consider only the methods in the classes derived from that:
+ * this can reduce the graph complexity somewhat (and it would
+ * be the more correct approach).
+ */
+static void
+print_method (MonoMethod *method, int depth) {
+ const MonoOpcode *opcode;
+ MonoMethodHeader *header;
+ GHashTable *hash;
+ const unsigned char *ip;
+ int i;
+
+ if (depth++ > max_depth)
+ return;
+ if (method->info) /* avoid recursion */
+ return;
+ method->info = method;
+
+ if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))
+ return;
+ if (method->flags & (METHOD_ATTRIBUTE_PINVOKE_IMPL | METHOD_ATTRIBUTE_ABSTRACT))
+ return;
+
+ header = ((MonoMethodNormal *)method)->header;
+ ip = header->code;
+
+ hash = g_hash_table_new (g_direct_hash, g_direct_equal);
+
+ while (ip < (header->code + header->code_size)) {
+ if (*ip == 0xfe) {
+ ++ip;
+ i = *ip + 256;
+ } else {
+ i = *ip;
+ }
+
+ opcode = &mono_opcodes [i];
+
+ switch (opcode->argument) {
+ case MonoInlineNone:
+ ++ip;
+ break;
+ case MonoInlineType:
+ case MonoInlineField:
+ case MonoInlineTok:
+ case MonoInlineString:
+ case MonoInlineSig:
+ case MonoShortInlineR:
+ case MonoInlineI:
+ case MonoInlineBrTarget:
+ ip += 5;
+ break;
+ case MonoInlineVar:
+ ip += 3;
+ break;
+ case MonoShortInlineVar:
+ case MonoShortInlineI:
+ case MonoShortInlineBrTarget:
+ ip += 2;
+ break;
+ case MonoInlineSwitch: {
+ gint32 n;
+ ++ip;
+ n = read32 (ip);
+ ip += 4;
+ ip += 4 * n;
+ break;
+ }
+ case MonoInlineR:
+ case MonoInlineI8:
+ ip += 9;
+ break;
+ case MonoInlineMethod: {
+ guint32 token;
+ MonoMethod *called;
+ ip++;
+ token = read32 (ip);
+ ip += 4;
+ called = mono_get_method (method->klass->image, token, NULL);
+ if (!called)
+ break; /* warn? */
+ if (g_hash_table_lookup (hash, called))
+ break;
+ g_hash_table_insert (hash, called, called);
+ output_method_edge (method, called);
+ print_method (called, depth);
+ break;
+ }
+ default:
+ g_assert_not_reached ();
+ }
+ }
+ g_hash_table_destroy (hash);
+}
+
+static void
+method_graph (MonoImage *image, const char *name) {
+ int depth = 0;
+ MonoMethod *method = NULL;
+
+ if (!name) {
+ guint32 token = ((MonoCLIImageInfo*)image->image_info)->cli_cli_header.ch_entry_point;
+ if (!token || !(method = mono_get_method (image, token, NULL))) {
+ g_print ("Cannot find entry point in %s: specify an explict method name.\n", image->name);
+ exit (1);
+ }
+ } else {
+ /* search the method */
+ MonoMethodDesc *desc;
+
+ desc = mono_method_desc_new (name, include_namespace);
+ if (!desc) {
+ g_print ("Invalid method name %s\n", name);
+ exit (1);
+ }
+ method = mono_method_desc_search_in_image (desc, image);
+ if (!method) {
+ g_print ("Cannot find method %s\n", name);
+ exit (1);
+ }
+ }
+ fprintf (output, "digraph blah {\n");
+ fprintf (output, "%s", graph_properties);
+
+ print_method (method, depth);
+
+ fprintf (output, "}\n");
+}
+
+typedef struct MonoBasicBlock MonoBasicBlock;
+
+struct MonoBasicBlock {
+ const unsigned char* cil_code;
+ gint32 cil_length;
+ gint dfn;
+ GList *in_bb;
+ GList *out_bb;
+};
+
+static const unsigned char *debug_start;
+
+static void
+link_bblock (MonoBasicBlock *from, MonoBasicBlock* to)
+{
+ from->out_bb = g_list_prepend (from->out_bb, to);
+ to->in_bb = g_list_prepend (to->in_bb, from);
+ /*fprintf (stderr, "linking IL_%04x to IL_%04x\n", from->cil_code-debug_start, to->cil_code-debug_start);*/
+}
+
+static int
+compare_bblock (void *a, void *b)
+{
+ MonoBasicBlock **ab = a;
+ MonoBasicBlock **bb = b;
+
+ return (*ab)->cil_code - (*bb)->cil_code;
+}
+
+static GPtrArray*
+mono_method_find_bblocks (MonoMethodHeader *header)
+{
+ const unsigned char *ip, *end, *start;
+ const MonoOpcode *opcode;
+ int i, block_end = 0;
+ GPtrArray *result = g_ptr_array_new ();
+ GHashTable *table = g_hash_table_new (g_direct_hash, g_direct_equal);
+ MonoBasicBlock *entry_bb, *end_bb, *bb, *target;
+
+ ip = header->code;
+ end = ip + header->code_size;
+ debug_start = ip;
+
+ entry_bb = g_new0 (MonoBasicBlock, 1);
+ end_bb = g_new0 (MonoBasicBlock, 1);
+ g_ptr_array_add (result, entry_bb);
+ g_ptr_array_add (result, end_bb);
+
+ bb = g_new0 (MonoBasicBlock, 1);
+ bb->cil_code = ip;
+ g_ptr_array_add (result, bb);
+ link_bblock (entry_bb, bb);
+ g_hash_table_insert (table, (char*)ip, bb);
+ block_end = TRUE;
+
+ /* handle exception code blocks... */
+ while (ip < end) {
+ start = ip;
+ if ((target = g_hash_table_lookup (table, ip)) && target != bb) {
+ if (!block_end)
+ link_bblock (bb, target);
+ bb = target;
+ block_end = FALSE;
+ }
+ if (block_end) {
+ /*fprintf (stderr, "processing bbclok at IL_%04x\n", ip - header->code);*/
+ if (!(bb = g_hash_table_lookup (table, ip))) {
+ bb = g_new0 (MonoBasicBlock, 1);
+ bb->cil_code = ip;
+ g_ptr_array_add (result, bb);
+ g_hash_table_insert (table, (char*)ip, bb);
+ }
+ block_end = FALSE;
+ }
+ if (*ip == 0xfe) {
+ ++ip;
+ i = *ip + 256;
+ } else {
+ i = *ip;
+ }
+
+ opcode = &mono_opcodes [i];
+ switch (opcode->flow_type) {
+ case MONO_FLOW_RETURN:
+ link_bblock (bb, end_bb);
+ case MONO_FLOW_ERROR:
+ block_end = 1;
+ break;
+ case MONO_FLOW_BRANCH: /* we handle branch when checking the argument type */
+ case MONO_FLOW_COND_BRANCH:
+ case MONO_FLOW_CALL:
+ case MONO_FLOW_NEXT:
+ case MONO_FLOW_META:
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ switch (opcode->argument) {
+ case MonoInlineNone:
+ ++ip;
+ break;
+ case MonoInlineType:
+ case MonoInlineField:
+ case MonoInlineMethod:
+ case MonoInlineTok:
+ case MonoInlineString:
+ case MonoInlineSig:
+ case MonoShortInlineR:
+ case MonoInlineI:
+ ip += 5;
+ break;
+ case MonoInlineVar:
+ ip += 3;
+ break;
+ case MonoShortInlineVar:
+ case MonoShortInlineI:
+ ip += 2;
+ break;
+ case MonoShortInlineBrTarget:
+ case MonoInlineBrTarget:
+ ip++;
+ if (opcode->argument == MonoShortInlineBrTarget) {
+ i = (signed char)*ip;
+ ip++;
+ } else {
+ i = (gint32) read32 (ip);
+ ip += 4;
+ }
+ if (opcode->flow_type == MONO_FLOW_COND_BRANCH) {
+ if (!(target = g_hash_table_lookup (table, ip))) {
+ target = g_new0 (MonoBasicBlock, 1);
+ target->cil_code = ip;
+ g_ptr_array_add (result, target);
+ g_hash_table_insert (table, (char*)ip, target);
+ }
+ link_bblock (bb, target);
+ }
+ if (!(target = g_hash_table_lookup (table, ip + i))) {
+ target = g_new0 (MonoBasicBlock, 1);
+ target->cil_code = ip + i;
+ g_ptr_array_add (result, target);
+ g_hash_table_insert (table, (char*)ip + i, target);
+ }
+ link_bblock (bb, target);
+ block_end = 1;
+ break;
+ case MonoInlineSwitch: {
+ gint32 n;
+ const char *itarget, *st;
+ ++ip;
+ n = read32 (ip);
+ ip += 4;
+ st = (const char*)ip + 4 * n;
+
+ for (i = 0; i < n; i++) {
+ itarget = st + read32 (ip);
+ ip += 4;
+ if (!(target = g_hash_table_lookup (table, itarget))) {
+ target = g_new0 (MonoBasicBlock, 1);
+ target->cil_code = itarget;
+ g_ptr_array_add (result, target);
+ g_hash_table_insert (table, itarget, target);
+ }
+ link_bblock (bb, target);
+ }
+ /*
+ * Note: the code didn't set block_end in switch.
+ */
+ break;
+ }
+ case MonoInlineR:
+ case MonoInlineI8:
+ ip += 9;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ }
+ g_hash_table_destroy (table);
+ qsort (result->pdata, result->len, sizeof (gpointer), compare_bblock);
+ /* skip entry and end */
+ bb = target = NULL;
+ for (i = 2; i < result->len; ++i) {
+ bb = (MonoBasicBlock*)g_ptr_array_index (result, i);
+ if (target)
+ target->cil_length = bb->cil_code - target->cil_code;
+ target = bb;
+ /*fprintf (stderr, "bblock %d at IL_%04x:\n", i, bb->cil_code - header->code);*/
+ }
+ bb->cil_length = header->code + header->code_size - bb->cil_code;
+ return result;
+}
+
+static char*
+indenter (MonoDisHelper *dh, MonoMethod *method, guint32 ip_offset)
+{
+ return g_strdup (" ");
+}
+
+static MonoDisHelper graph_dh = {
+ "\\l",
+ NULL,
+ "IL_%04x",
+ indenter,
+ NULL,
+ NULL
+};
+
+static void
+df_visit (MonoBasicBlock *bb, int *dfn, const unsigned char* code)
+{
+ GList *tmp;
+ MonoBasicBlock *next;
+
+ if (bb->dfn)
+ return;
+ ++(*dfn);
+ bb->dfn = *dfn;
+ for (tmp = bb->out_bb; tmp; tmp = tmp->next) {
+ next = tmp->data;
+ if (!next->dfn) {
+ if (!bb->cil_code)
+ fprintf (output, "\t\"DF entry\" -> \"IL_%04x (%d)\"\n", next->cil_code - code, *dfn + 1);
+ else
+ fprintf (output, "\t\"IL_%04x (%d)\" -> \"IL_%04x (%d)\"\n", bb->cil_code - code, bb->dfn, next->cil_code - code, *dfn + 1);
+ df_visit (next, dfn, code);
+ }
+ }
+}
+
+static void
+print_method_cfg (MonoMethod *method) {
+ GPtrArray *bblocks;
+ GList *tmp;
+ MonoBasicBlock *bb, *target;
+ MonoMethodHeader *header;
+ int i, dfn;
+ char *code;
+
+ header = ((MonoMethodNormal*)method)->header;
+ bblocks = mono_method_find_bblocks (header);
+ for (i = 0; i < bblocks->len; ++i) {
+ bb = (MonoBasicBlock*)g_ptr_array_index (bblocks, i);
+ if (i == 0)
+ fprintf (output, "\tB%p [shape=record,label=\"entry\"]\n", bb);
+ else if (i == 1)
+ fprintf (output, "\tB%p [shape=record,label=\"end\"]\n", bb);
+ else {
+ code = mono_disasm_code (&graph_dh, method, bb->cil_code, bb->cil_code + bb->cil_length);
+ fprintf (output, "\tB%p [shape=record,label=\"IL_%04x\\n%s\"]\n", bb, bb->cil_code - header->code, code);
+ g_free (code);
+ }
+ }
+ for (i = 0; i < bblocks->len; ++i) {
+ bb = (MonoBasicBlock*)g_ptr_array_index (bblocks, i);
+ for (tmp = bb->out_bb; tmp; tmp = tmp->next) {
+ target = tmp->data;
+ fprintf (output, "\tB%p -> B%p\n", bb, target);
+ }
+ }
+#if 0
+ for (i = 0; i < bblocks->len; ++i) {
+ bb = (MonoBasicBlock*)g_ptr_array_index (bblocks, i);
+ bb->dfn = 0;
+ }
+ dfn = 0;
+ for (i = 0; i < bblocks->len; ++i) {
+ bb = (MonoBasicBlock*)g_ptr_array_index (bblocks, i);
+ df_visit (bb, &dfn, header->code);
+ }
+#endif
+}
+
+/*
+ * TODO: change to create the DF tree, dominance relation etc.
+ */
+static void
+method_cfg (MonoImage *image, const char *name) {
+ MonoMethod *method = NULL;
+ const static char *cfg_graph_properties = "\tnode [fontsize=8.0]\n\tedge [len=1.5,color=red]\n";
+
+ if (!name) {
+ guint32 token = ((MonoCLIImageInfo*)image->image_info)->cli_cli_header.ch_entry_point;
+ if (!token || !(method = mono_get_method (image, token, NULL))) {
+ g_print ("Cannot find entry point in %s: specify an explict method name.\n", image->name);
+ exit (1);
+ }
+ } else {
+ /* search the method */
+ MonoMethodDesc *desc;
+
+ desc = mono_method_desc_new (name, include_namespace);
+ if (!desc) {
+ g_print ("Invalid method name %s\n", name);
+ exit (1);
+ }
+ method = mono_method_desc_search_in_image (desc, image);
+ if (!method) {
+ g_print ("Cannot find method %s\n", name);
+ exit (1);
+ }
+ }
+ fprintf (output, "digraph blah {\n");
+ fprintf (output, "%s", cfg_graph_properties);
+
+ print_method_cfg (method);
+
+ fprintf (output, "}\n");
+}
+
+static void
+usage (void) {
+ printf ("monograph 0.2 Copyright (c) 2002 Ximian, Inc\n");
+ printf ("Create call graph or type hierarchy information from CIL assemblies.\n");
+ printf ("Usage: monograph [options] [assembly [typename|methodname]]\n");
+ printf ("Valid options are:\n");
+ printf ("\t-c|--call output call graph instead of type hierarchy\n");
+ printf ("\t-C|--control-flow output control flow of methodname\n");
+ printf ("\t-d|--depth num max depth recursion (default: 6)\n");
+ printf ("\t-o|--output filename write graph to file filename (default: stdout)\n");
+ printf ("\t-f|--fullname include namespace in type and method names\n");
+ printf ("\t-n|--neato invoke neato directly\n");
+ printf ("\t-v|--verbose verbose operation\n");
+ printf ("The default assembly is corlib.dll. The default method for\n");
+ printf ("the --call and --control-flow options is the entrypoint.\n");
+ printf ("When the --neato option is used the output type info is taken\n");
+ printf ("from the output filename extension. You need the graphviz package installed\n");
+ printf ("to be able to use this option.\n");
+ printf ("Sample runs:\n");
+ printf ("\tmonograph -n -o vt.png corlib.dll System.ValueType\n");
+ printf ("\tmonograph -n -o expr.png mcs.exe Mono.CSharp.Expression\n");
+ printf ("\tmonograph -n -o cfg.png -C mcs.exe Driver:Main\n");
+ printf ("\tmonograph -d 3 -n -o callgraph.png -c mis.exe\n");
+ exit (1);
+}
+
+enum {
+ GRAPH_TYPES,
+ GRAPH_CALL,
+ GRAPH_INTERFACE,
+ GRAPH_CONTROL_FLOW
+};
+
+/*
+ * TODO:
+ * * virtual method calls as explained above
+ * * maybe track field references
+ * * track what exceptions a method could throw?
+ * * for some inputs neato appears to hang or take a long time: kill it?
+ * * allow passing additional command-line arguments to neato
+ * * allow setting different graph/node/edge options directly
+ * * option to avoid specialname methods
+ * * make --neato option the default?
+ * * use multiple classes/method roots?
+ * * write a manpage
+ * * reverse call graph: given a method what methods call it?
+ */
+int
+main (int argc, char *argv[]) {
+ MonoAssembly *assembly;
+ const char *cname = NULL;
+ const char *aname = NULL;
+ char *outputfile = NULL;
+ int graphtype = GRAPH_TYPES;
+ int callneato = 0;
+ int i;
+
+ mono_init (argv [0]);
+ output = stdout;
+
+ for (i = 1; i < argc; ++i) {
+ if (argv [i] [0] != '-')
+ break;
+ if (strcmp (argv [i], "--call") == 0 || strcmp (argv [i], "-c") == 0) {
+ graphtype = GRAPH_CALL;
+ } else if (strcmp (argv [i], "--control-flow") == 0 || strcmp (argv [i], "-C") == 0) {
+ graphtype = GRAPH_CONTROL_FLOW;
+ } else if (strcmp (argv [i], "--interface") == 0 || strcmp (argv [i], "-i") == 0) {
+ graphtype = GRAPH_INTERFACE;
+ } else if (strcmp (argv [i], "--fullname") == 0 || strcmp (argv [i], "-f") == 0) {
+ include_namespace = 1;
+ } else if (strcmp (argv [i], "--neato") == 0 || strcmp (argv [i], "-n") == 0) {
+ callneato = 1;
+ } else if (strcmp (argv [i], "--verbose") == 0 || strcmp (argv [i], "-v") == 0) {
+ verbose++;
+ } else if (strcmp (argv [i], "--output") == 0 || strcmp (argv [i], "-o") == 0) {
+ if (i + 1 >= argc)
+ usage ();
+ outputfile = argv [++i];
+ } else if (strcmp (argv [i], "--depth") == 0 || strcmp (argv [i], "-d") == 0) {
+ if (i + 1 >= argc)
+ usage ();
+ max_depth = atoi (argv [++i]);
+ } else {
+ usage ();
+ }
+
+ }
+ if (argc > i)
+ aname = argv [i];
+ if (argc > i + 1)
+ cname = argv [i + 1];
+ if (!aname)
+ aname = "corlib.dll";
+ if (!cname && (graphtype == GRAPH_TYPES))
+ cname = "System.Object";
+
+ assembly = mono_assembly_open (aname, NULL, NULL);
+ if (!assembly) {
+ g_print ("cannot open assembly %s\n", aname);
+ exit (1);
+ }
+
+ if (callneato) {
+ GString *command = g_string_new ("neato");
+ char *type = NULL;
+
+ if (outputfile) {
+ type = strrchr (outputfile, '.');
+ g_string_sprintfa (command, " -o %s", outputfile);
+ }
+ if (type)
+ g_string_sprintfa (command, " -T%s", type + 1);
+ output = popen (command->str, "w");
+ if (!output) {
+ g_print ("Cannot run neato: you may need to install the graphviz package.\n");
+ exit (1);
+ }
+ } else if (outputfile) {
+ output = fopen (outputfile, "w");
+ if (!output) {
+ g_print ("Cannot open file: %s\n", outputfile);
+ exit (1);
+ }
+ }
+ /* if it looks like a method name, we want a callgraph. */
+ if (cname && strchr (cname, ':') && graphtype == GRAPH_TYPES)
+ graphtype = GRAPH_CALL;
+
+ switch (graphtype) {
+ case GRAPH_TYPES:
+ type_graph (assembly->image, cname);
+ break;
+ case GRAPH_CALL:
+ method_graph (assembly->image, cname);
+ break;
+ case GRAPH_INTERFACE:
+ interface_graph (assembly->image, cname);
+ break;
+ case GRAPH_CONTROL_FLOW:
+ method_cfg (assembly->image, cname);
+ break;
+ default:
+ g_error ("wrong graph type");
+ }
+
+ if (callneato) {
+ if (verbose)
+ g_print ("waiting for neato.\n");
+ pclose (output);
+ } else if (outputfile)
+ fclose (output);
+ return 0;
+}
+
+
diff --git a/mono/tests/.cvsignore b/mono/tests/.cvsignore
new file mode 100644
index 00000000000..602a0b0fd10
--- /dev/null
+++ b/mono/tests/.cvsignore
@@ -0,0 +1,7 @@
+Makefile.in
+Makefile
+*.stdout
+.deps
+.libs
+libtest.la
+libtest.lo
diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am
new file mode 100644
index 00000000000..941cee245f4
--- /dev/null
+++ b/mono/tests/Makefile.am
@@ -0,0 +1,150 @@
+
+TEST_PROG=../interpreter/mint
+JITTEST_PROG=../jit/mono
+
+CSC=csc /unsafe
+
+BENCHSRC=fib.cs random.cs nested-loops.cs ackermann.cs tight-loop.cs sieve.cs
+
+TESTSRC= \
+ array-init.cs \
+ arraylist.cs \
+ field-layout.cs \
+ hash-table.cs \
+ test-ops.cs \
+ obj.cs \
+ string.cs \
+ stringbuilder.cs \
+ switch.cs \
+ outparm.cs \
+ delegate.cs \
+ bitconverter.cs \
+ exception.cs \
+ exception2.cs \
+ exception3.cs \
+ exception4.cs \
+ exception5.cs \
+ exception6.cs \
+ exception7.cs \
+ struct.cs \
+ valuetype-gettype.cs \
+ static-constructor.cs \
+ pinvoke.cs \
+ pinvoke1.cs \
+ box.cs \
+ array.cs \
+ enum.cs \
+ enum2.cs \
+ property.cs \
+ enumcast.cs \
+ assignable-tests.cs \
+ array-cast.cs \
+ cattr-compile.cs \
+ custom-attr.cs \
+ double-cast.cs \
+ newobj-valuetype.cs \
+ arraylist-clone.cs \
+ setenv.cs \
+ vtype.cs \
+ isvaluetype.cs \
+ iface6.cs \
+ ipaddress.cs \
+ array-vt.cs \
+ interface1.cs \
+ reflection-enum.cs \
+ reflection-prop.cs \
+ reflection4.cs \
+ reflection5.cs \
+ many-locals.cs \
+ string-compare.cs \
+ test-prime.cs \
+ params.cs \
+ reflection.cs \
+ interface.cs \
+ iface.cs \
+ iface2.cs \
+ iface3.cs \
+ iface4.cs \
+ virtual-method.cs \
+ intptrcast.cs \
+ indexer.cs \
+ stream.cs \
+ console.cs \
+ jit-int.cs \
+ jit-uint.cs \
+ jit-long.cs \
+ long.cs \
+ jit-ulong.cs \
+ jit-float.cs \
+ pop.cs \
+ time.cs \
+ appdomain.cs \
+ appdomain-client.cs \
+ pointer.cs \
+ vararg.cs \
+ rounding.cs \
+ hashcode.cs \
+ delegate1.cs \
+ delegate2.cs \
+ delegate3.cs \
+ delegate4.cs \
+ remoting1.cs \
+ remoting2.cs \
+ remoting3.cs \
+ nonvirt.cs
+
+
+TESTSI=$(TESTSRC:.cs=.exe)
+TESTBS=$(BENCHSRC:.cs=.exe)
+
+EXTRA_DIST=test-driver $(TESTSRC)
+
+%.exe: %.cs
+ $(CSC) $<
+
+test: $(TEST_PROG) $(TESTSI) libtest.la
+ @failed=0; \
+ passed=0; \
+ export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
+ for i in $(TESTSI); do \
+ if ./test-driver $(TEST_PROG) $$i; \
+ then \
+ passed=`expr $${passed} + 1`; \
+ else \
+ failed=`expr $${failed} + 1`; \
+ fi \
+ done; \
+ echo "$${passed} test(s) passed. $${failed} test(s) failed."
+
+testb: $(TEST_PROG) $(TESTBS)
+ for i in $(TESTBS); do \
+ ./test-driver $(TEST_PROG) $$i; \
+ done
+
+testjit: $(JITTEST_PROG) $(TESTSI) $(TESTBS)
+ @failed=0; \
+ passed=0; \
+ export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
+ for i in $(TESTSI) $(TESTBS); do \
+ if ./test-driver $(JITTEST_PROG) $$i; \
+ then \
+ passed=`expr $${passed} + 1`; \
+ else \
+ failed=`expr $${failed} + 1`; \
+ fi \
+ done; \
+ echo "$${passed} test(s) passed. $${failed} test(s) failed."
+
+testjitspeed: $(JITTEST_PROG) $(TESTBS)
+ for i in $(TESTBS); do \
+ echo $$i; \
+ time $(JITTEST_PROG) $$i; \
+ done
+
+check:
+ @echo no check yet
+
+noinst_LTLIBRARIES = libtest.la
+
+libtest_la_LDFLAGS = -rpath `pwd`
+libtest_la_SOURCES = libtest.c
diff --git a/mono/tests/ackermann.cs b/mono/tests/ackermann.cs
new file mode 100644
index 00000000000..95d331c48d1
--- /dev/null
+++ b/mono/tests/ackermann.cs
@@ -0,0 +1,18 @@
+// $Id: ackermann.cs,v 1.2 2001/11/19 07:11:32 lupus Exp $
+// http://www.bagley.org/~doug/shootout/
+
+public class ackermann {
+
+ public static int Main() {
+ int NUM = 8;
+ return Ack(3, NUM) != 2045? 1: 0;
+ //System.out.print("Ack(3," + NUM + "): " + Ack(3, NUM) + "\n");
+ }
+
+ public static int Ack(int M, int N) {
+ if (M == 0) return( N + 1 );
+ if (N == 0) return( Ack(M - 1, 1) );
+ return( Ack(M - 1, Ack(M, (N - 1))) );
+ }
+
+}
diff --git a/mono/tests/appdomain-client.cs b/mono/tests/appdomain-client.cs
new file mode 100644
index 00000000000..4b9585bbd86
--- /dev/null
+++ b/mono/tests/appdomain-client.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Security.Policy;
+using System.Threading;
+
+class Client {
+
+ [LoaderOptimization (LoaderOptimization.SingleDomain)]
+ static int Main (string[] args)
+ {
+ int res = 0;
+
+ foreach (string s in args) {
+ Console.WriteLine (s);
+ res += Convert.ToInt32 (s);
+ }
+
+ Console.WriteLine ("Sum: " + res);
+ return res;
+ }
+}
diff --git a/mono/tests/appdomain.cs b/mono/tests/appdomain.cs
new file mode 100644
index 00000000000..32511033f46
--- /dev/null
+++ b/mono/tests/appdomain.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Security.Policy;
+using System.Threading;
+
+class Container {
+
+ [LoaderOptimization (LoaderOptimization.SingleDomain)]
+ static int arg_sum (string[] args) {
+ int res = 0;
+ foreach (string s in args) {
+ res += Convert.ToInt32 (s);
+ }
+ return res;
+ }
+
+ static int Main ()
+ {
+ int res;
+
+ AppDomainSetup setup = new AppDomainSetup ();
+ setup.ApplicationBase = ".";
+
+ Console.WriteLine (AppDomain.CurrentDomain.FriendlyName);
+
+ AppDomain newDomain = AppDomain.CreateDomain ("NewDomain", new Evidence (), setup);
+
+ string[] args = { "1", "2", "3"};
+ res = newDomain.ExecuteAssembly ("appdomain-client.exe", null, args);
+ if (res != arg_sum (args))
+ return 1;
+
+ Console.WriteLine ("Ready");
+
+ return 0;
+ }
+}
diff --git a/mono/tests/array-cast.cs b/mono/tests/array-cast.cs
new file mode 100644
index 00000000000..0eeb8064e61
--- /dev/null
+++ b/mono/tests/array-cast.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace Test {
+ public class Test {
+ public static int Main () {
+ Attribute[] attr_array = new Attribute [1];
+ object obj = (object) attr_array;
+ object[] obj_array = (object[]) obj;
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/array-init.cs b/mono/tests/array-init.cs
new file mode 100644
index 00000000000..30059e3203c
--- /dev/null
+++ b/mono/tests/array-init.cs
@@ -0,0 +1,44 @@
+using System;
+
+namespace Test {
+ public class Test {
+ private static int[] array = {0, 1, 2, 3};
+ private static int [,] bar = { {0,1}, {4,5}, {10,20} };
+
+ public static int Main() {
+ int num = 1;
+ int t = 0;
+ foreach (int i in array) {
+ if (i != t++)
+ return num;
+ }
+
+ num++;
+ if (bar [0,0] != 0)
+ return num;
+ num++;
+ if (bar [0,1] != 1)
+ return num;
+ num++;
+ if (bar [1,0] != 4)
+ return num;
+ num++;
+ if (bar [1,1] != 5)
+ return num;
+ num++;
+ if (bar [2,0] != 10)
+ return num;
+ num++;
+ if (bar [2,1] != 20)
+ return num;
+
+ num++;
+
+ short [,] j = new short [4,2] { {0,1}, {2,3}, {4,5}, {6,7} };
+ if (j [1,1] != 3)
+ return num;
+
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/array-vt.cs b/mono/tests/array-vt.cs
new file mode 100644
index 00000000000..5eee592e371
--- /dev/null
+++ b/mono/tests/array-vt.cs
@@ -0,0 +1,15 @@
+using System;
+
+public struct Test {
+ int a1;
+ int a2;
+
+ static public int Main () {
+ Test[] tarray = new Test [20];
+ tarray[0].a1 = 1;
+ tarray[0].a2 = 2;
+ if (tarray[0].a1 + tarray[0].a2 != 3)
+ return 1;
+ return 0;
+ }
+}
diff --git a/mono/tests/array.cs b/mono/tests/array.cs
new file mode 100755
index 00000000000..b0e9d47ff1e
--- /dev/null
+++ b/mono/tests/array.cs
@@ -0,0 +1,127 @@
+using System;
+using System.Runtime.InteropServices;
+
+public class Test {
+
+ static void puts (string s)
+ {
+ Console.WriteLine (s);
+ }
+
+ public static int jagged ()
+ {
+ int[][] j2 = new int [3][];
+
+ // does not work
+ // j2 [0] = new int[] {1, 2, 3};
+ // j2 [1] = new int[] {1, 2, 3, 4, 5, 6};
+ // j2 [2] = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9};
+
+ j2 [0] = new int[3];
+ j2 [1] = new int[6];
+ j2 [2] = new int[9];
+
+ for (int i = 0; i < j2.Length; i++)
+ for (int j = 0; j < (i+1)*3; j++)
+ j2 [i][j] = j;
+
+ for (int i = 0; i < j2.Length; i++)
+ for (int j = 0; j < (i+1)*3; j++)
+ if (j2 [i][j] != j)
+ return 1;
+ return 0;
+ }
+
+ public static int stest ()
+ {
+ string[] sa = new string[32];
+
+ sa [0] = "This";
+ sa [2] = "is";
+ sa [10] = "a";
+ sa [20] = "stupid";
+ sa [21] = "Test";
+
+ for (int i = 0; i < sa.Length; i++){
+ if (sa [i] != null)
+ puts (sa [i]);
+ }
+
+ return 0;
+ }
+
+ public static int atest2 ()
+ {
+ int[,] ia = new int[32,32];
+
+ for (int i = 0; i <ia.GetLength (0); i++)
+ ia [i,i] = i*i;
+
+ for (int i = 0; i <ia.GetLength (0); i++)
+ if (ia [i,i] != i*i)
+ return 1;
+
+ for (int i = 0; i <ia.GetLength (0); i++)
+ ia.SetValue (i*i*i, i, i);
+
+ for (int i = 0; i <ia.GetLength (0); i++)
+ if ((int)ia.GetValue (i, i) != i*i*i)
+ return 1;
+
+ return 0;
+ }
+
+ public static int atest ()
+ {
+ int[] ia = new int[32];
+
+ for (int i = 0; i <ia.Length; i++)
+ ia [i] = i*i;
+
+ for (int i = 0; i <ia.Length; i++)
+ if (ia [i] != i*i)
+ return 1;
+
+ if (ia.Rank != 1)
+ return 2;
+
+ if (ia.GetValue (2) == null)
+ return 3;
+
+ for (int i = 0; i <ia.Length; i++)
+ ia.SetValue (i*i*i, i);
+
+ for (int i = 0; i <ia.Length; i++)
+ if ((int)ia.GetValue (i) != i*i*i){
+ puts ("Crap: " + i + " " + (int) ia.GetValue (i) );
+
+ return 4;
+ }
+
+ return 0;
+ }
+
+
+ public static int Main () {
+ puts ("a");
+ if (atest () != 0)
+ return atest ();
+ puts ("b");
+ if (atest2 () != 0)
+ return 1;
+ puts ("c");
+ if (atest2 () != 0)
+ return 1;
+ puts ("d");
+ if (stest () != 0)
+ return 1;
+ puts ("e");
+ if (jagged () != 0)
+ return 1;
+
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/array2.cs b/mono/tests/array2.cs
new file mode 100644
index 00000000000..016953ca939
--- /dev/null
+++ b/mono/tests/array2.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace Test {
+ public class Test {
+ public static int Main () {
+
+ Char[,] c2 = new Char[1,1];
+ Console.WriteLine (c2);
+
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/arraylist-clone.cs b/mono/tests/arraylist-clone.cs
new file mode 100644
index 00000000000..f8832828d28
--- /dev/null
+++ b/mono/tests/arraylist-clone.cs
@@ -0,0 +1,34 @@
+
+
+using System.IO;
+using System;
+using System.Collections;
+
+namespace T {
+ public class T {
+ string name="unset";
+
+ T(string n) {
+ name=n;
+ }
+
+ public static int Main () {
+ ArrayList tlist=new ArrayList(), newlist;
+ T[] tarray = new T [2];
+ T t1=new T("t1");
+ T t2=new T("t2");
+ tlist.Add(t1);
+ tlist.Add(t2);
+
+ newlist=(ArrayList)tlist.Clone();
+ newlist.CopyTo (tarray);
+
+ if (tarray [0].name != "t1")
+ return 1;
+ if (tarray [1].name != "t2")
+ return 2;
+
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/arraylist.cs b/mono/tests/arraylist.cs
new file mode 100644
index 00000000000..aaf8197c1ec
--- /dev/null
+++ b/mono/tests/arraylist.cs
@@ -0,0 +1,19 @@
+using System.Collections;
+
+namespace Test {
+ public class Test {
+ public static int Main() {
+ ArrayList a = new ArrayList (10);
+ int i = 0;
+ a.Add (0);
+ a.Add (1);
+ a.Add (2);
+ a.Add (3);
+ foreach (int elem in a) {
+ if (elem != i++)
+ return i;
+ }
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/assignable-tests.cs b/mono/tests/assignable-tests.cs
new file mode 100644
index 00000000000..f1513829a16
--- /dev/null
+++ b/mono/tests/assignable-tests.cs
@@ -0,0 +1,69 @@
+
+using System;
+
+namespace Test {
+ public interface A {
+ void method ();
+ }
+ public interface B : A {
+ void method2 ();
+ }
+ public class test {
+ public static int Main () {
+ Type int_type = typeof (int);
+ Type obj_type = typeof (object);
+ Type vt_type = typeof (System.ValueType);
+ Type comp_type = typeof (System.IComparable);
+ Type a_type = typeof (A);
+ Type b_type = typeof (B);
+ int error = 1;
+
+ if (!int_type.IsSubclassOf(vt_type))
+ return error;
+ ++error;
+ if (!int_type.IsSubclassOf(obj_type))
+ return error;
+ ++error;
+ if (int_type.IsSubclassOf(comp_type))
+ return error;
+ ++error;
+
+ if (int_type.IsAssignableFrom(vt_type))
+ return error;
+ ++error;
+ if (int_type.IsAssignableFrom (obj_type))
+ return error;
+ ++error;
+ if (int_type.IsAssignableFrom(comp_type))
+ return error;
+ ++error;
+
+ if (!int_type.IsAssignableFrom(int_type))
+ return error;
+ ++error;
+ if (!obj_type.IsAssignableFrom (int_type))
+ return error;
+ ++error;
+ if (!vt_type.IsAssignableFrom(int_type))
+ return error;
+ ++error;
+ if (!comp_type.IsAssignableFrom(int_type))
+ return error;
+ ++error;
+
+ if (a_type.IsSubclassOf(b_type))
+ return error;
+ ++error;
+ if (b_type.IsAssignableFrom(a_type))
+ return error;
+ ++error;
+ if (b_type.IsSubclassOf(a_type))
+ return error;
+ ++error;
+ if (!a_type.IsAssignableFrom(b_type))
+ return error;
+ ++error;
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/autoresetevents.cs b/mono/tests/autoresetevents.cs
new file mode 100755
index 00000000000..28a4650cf25
--- /dev/null
+++ b/mono/tests/autoresetevents.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Threading;
+
+class EventTest
+{
+ public static AutoResetEvent e;
+
+ // Code for first thread
+ public static void ThreadMethod_waiter_1()
+ {
+ Console.WriteLine("[Thread A] - Started.....");
+ Console.WriteLine("[Thread A] - I'm before wait for event .....");
+ e.WaitOne();
+ Console.WriteLine("[Thread A] - I'm after wait for event.");
+ Console.WriteLine("[Thread A] - I now set again the event to let other thread continue.");
+ e.Set();
+ }
+
+ // Code for second thread
+ public static void ThreadMethod_waiter_2()
+ {
+ Console.WriteLine("[Thread B] - Started.....");
+ Console.WriteLine("[Thread B] - I'm before wait for event .....");
+ e.WaitOne();
+ Console.WriteLine("[Thread B] - I'm after wait for event.");
+ Console.WriteLine("[Thread B] - I now set again the event to let other thread continue.");
+ e.Set();
+ }
+
+ // Code for 3th thread
+ public static void ThreadMethod_blocker()
+ {
+ Console.WriteLine("[Thread C] - Started.....");
+ Console.WriteLine("[Thread C] - Sleeping for 5000ms....");
+ Thread.Sleep(5000);
+ Console.WriteLine("[Thread C] - Setting the event....");
+ e.Set();
+ Console.WriteLine("[Thread C] - Finished.....");
+ }
+
+
+ public static void Main()
+ {
+ e = new AutoResetEvent(false);
+
+
+ // Create the waiter thread's group
+ Console.WriteLine("[ Main ] - Creating first thread..");
+ ThreadStart Thread_1 = new ThreadStart(ThreadMethod_waiter_1);
+ ThreadStart Thread_2 = new ThreadStart(ThreadMethod_waiter_2);
+
+ // Create the blocker thread
+ Console.WriteLine("[ Main ] - Creating second thread..");
+ ThreadStart Thread_3 = new ThreadStart(ThreadMethod_blocker);
+
+ Thread A = new Thread(Thread_1);
+ Thread B = new Thread(Thread_2);
+ Thread C = new Thread(Thread_3);
+
+ A.Start();
+ B.Start();
+ C.Start();
+
+ Thread.Sleep(500);
+ Console.WriteLine("[ Main ] - Finish...");
+ }
+}
diff --git a/mono/tests/bench1.cs b/mono/tests/bench1.cs
new file mode 100644
index 00000000000..d820878e136
--- /dev/null
+++ b/mono/tests/bench1.cs
@@ -0,0 +1,46 @@
+using System;
+
+public class Benchmark {
+
+ public static int Run ()
+ {
+ int count = 32;
+ int[] fibs = new int [count + 1];
+ int index;
+ int index2;
+ int temp;
+
+ fibs[0] = 1;
+ fibs[1] = 1;
+ for(index = 2; index <= count; ++index)
+ {
+ fibs[index] = fibs[index - 2] + fibs [index - 1];
+ }
+
+ for(index = 0; index <= count; ++index)
+ {
+ for(index2 = 1; index2 <= count; ++index2)
+ {
+ if(fibs[index2 - 1] < fibs[index2])
+ {
+ int ti = index2 - 1;
+ temp = fibs[ti];
+ fibs[ti] = fibs[index2];
+ fibs[index2] = temp;
+ }
+ }
+ }
+
+ return fibs [0];
+ }
+
+ public static int Main () {
+ for (int i = 0; i < 1000000; i++)
+ if (Run () != 3524578)
+ return 1;
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/bitconverter.cs b/mono/tests/bitconverter.cs
new file mode 100644
index 00000000000..853f22e95d1
--- /dev/null
+++ b/mono/tests/bitconverter.cs
@@ -0,0 +1,22 @@
+using System;
+
+namespace Test {
+
+ public class Test {
+ public static int Main() {
+ byte[] rep;
+ double d = 5.0;
+
+ rep = BitConverter.GetBytes (d);
+ double res = BitConverter.ToDouble (rep, 0);
+#if DEBUG
+ Console.WriteLine ("{0} {1} {2} {3} {4} {5} {6} {7}",
+ rep [0], rep [1], rep [2], rep [3], rep [4],
+ rep [5], rep [6], rep [7]);
+#endif
+ if (d != res)
+ return 1;
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/box.cs b/mono/tests/box.cs
new file mode 100755
index 00000000000..6ca47d62b3e
--- /dev/null
+++ b/mono/tests/box.cs
@@ -0,0 +1,33 @@
+using System;
+using System.IO;
+
+public class Test {
+
+ public static int boxtest ()
+ {
+ int i = 123;
+ object o = i;
+
+ int j = (int) o;
+
+ if (i != j)
+ return 1;
+
+ return 0;
+ }
+
+ public static int Main () {
+ string t = 123.ToString();
+
+ if (t != "123")
+ return 1;
+
+ if (boxtest () != 0)
+ return 1;
+
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/cattr-compile.cs b/mono/tests/cattr-compile.cs
new file mode 100644
index 00000000000..4007e9b536f
--- /dev/null
+++ b/mono/tests/cattr-compile.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace Test {
+ [CLSCompliant(false)]
+ public class Test {
+ [CLSCompliant(false)]
+ public static int Main() {
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/codegen-interfaces.cs b/mono/tests/codegen-interfaces.cs
new file mode 100644
index 00000000000..73e9d2d386b
--- /dev/null
+++ b/mono/tests/codegen-interfaces.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+class CGen {
+
+ public static int Main() {
+ AssemblyBuilder abuilder;
+ ModuleBuilder mbuilder;
+ TypeBuilder tbuilder;
+ FieldBuilder fbuilder;
+ PropertyBuilder pbuilder;
+ AssemblyName an;
+ String name = "tcgen.exe";
+ MethodBuilder method, get_method;
+ TypeAttributes attrs = TypeAttributes.Public | TypeAttributes.Class;
+ MethodAttributes mattrs = MethodAttributes.Public | MethodAttributes.Static;
+ byte[] body = {0x16, 0x2a}; // ldc.i4.0 ret
+
+ an = new AssemblyName ();
+ an.Name = name;
+ abuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (an, AssemblyBuilderAccess.Save);
+
+ mbuilder = abuilder.DefineDynamicModule (name, name);
+
+ tbuilder = mbuilder.DefineType ("Test.CodeGen", attrs, null, new Type [0]);
+ Type result = typeof(int);
+ Type[] param = new Type[] {typeof (String[])};
+ method = tbuilder.DefineMethod("Main", mattrs, result, param);
+ method.CreateMethodBody (body, body.Length);
+
+ fbuilder = tbuilder.DefineField ("int_field", typeof(int), FieldAttributes.Private);
+ fbuilder = tbuilder.DefineField ("string_field", typeof(string), FieldAttributes.Public);
+ /*pbuilder = tbuilder.DefineProperty ("FieldI", PropertyAttributes.None, typeof(int), null);
+ get_method = tbuilder.DefineMethod("get_FieldI", MethodAttributes.Public, result, null);
+ get_method.CreateMethodBody (body, body.Length);
+ pbuilder.SetGetMethod (get_method);*/
+
+ Type t = tbuilder.CreateType ();
+ abuilder.SetEntryPoint (method);
+ abuilder.Save (name);
+ return 0;
+ }
+}
diff --git a/mono/tests/codegen.cs b/mono/tests/codegen.cs
new file mode 100644
index 00000000000..76f02358a3e
--- /dev/null
+++ b/mono/tests/codegen.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+class CGen {
+
+ public static int Main() {
+ AssemblyBuilder abuilder;
+ ModuleBuilder mbuilder;
+ TypeBuilder tbuilder;
+ FieldBuilder fbuilder;
+ PropertyBuilder pbuilder;
+ AssemblyName an;
+ String name = "tcgen.exe";
+ MethodBuilder method, get_method;
+ TypeAttributes attrs = TypeAttributes.Public | TypeAttributes.Class;
+ MethodAttributes mattrs = MethodAttributes.Public | MethodAttributes.Static;
+ byte[] body = {0x16, 0x2a}; // ldc.i4.0 ret
+
+ an = new AssemblyName ();
+ an.Name = name;
+ abuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (an, AssemblyBuilderAccess.Save);
+
+ mbuilder = abuilder.DefineDynamicModule (name, name);
+
+ tbuilder = mbuilder.DefineType ("Test.CodeGen", attrs);
+ Type result = typeof(int);
+ Type[] param = new Type[] {typeof (String[])};
+ method = tbuilder.DefineMethod("Main", mattrs, result, param);
+ method.CreateMethodBody (body, body.Length);
+
+ fbuilder = tbuilder.DefineField ("int_field", typeof(int), FieldAttributes.Private);
+ fbuilder = tbuilder.DefineField ("string_field", typeof(string), FieldAttributes.Public);
+ /*pbuilder = tbuilder.DefineProperty ("FieldI", PropertyAttributes.None, typeof(int), null);
+ get_method = tbuilder.DefineMethod("get_FieldI", MethodAttributes.Public, result, null);
+ get_method.CreateMethodBody (body, body.Length);
+ pbuilder.SetGetMethod (get_method);*/
+
+ Type t = tbuilder.CreateType ();
+ abuilder.SetEntryPoint (method);
+ abuilder.Save (name);
+ return 0;
+ }
+}
diff --git a/mono/tests/codegen2.cs b/mono/tests/codegen2.cs
new file mode 100644
index 00000000000..f914f93f6c9
--- /dev/null
+++ b/mono/tests/codegen2.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+class CGen {
+
+ public static int Main() {
+ AssemblyBuilder abuilder;
+ ModuleBuilder mbuilder;
+ TypeBuilder tbuilder, tb2;
+ FieldBuilder fbuilder;
+ PropertyBuilder pbuilder;
+ ILGenerator ilg;
+ AssemblyName an;
+ String name = "tcgen.exe";
+ MethodBuilder get_method, entryp;
+ TypeAttributes attrs = TypeAttributes.Public | TypeAttributes.Class;
+ MethodAttributes mattrs = MethodAttributes.Public | MethodAttributes.Static;
+
+ an = new AssemblyName ();
+ an.Name = name;
+ abuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (an, AssemblyBuilderAccess.Save);
+
+ mbuilder = abuilder.DefineDynamicModule (name, name);
+
+ tbuilder = mbuilder.DefineType ("Test.CodeGen", attrs);
+ Type result = typeof(int);
+ Type[] param = new Type[] {typeof (String[])};
+ entryp = tbuilder.DefineMethod("Main", mattrs, result, param);
+ ilg = entryp.GetILGenerator (128);
+ ilg.DeclareLocal (typeof(int));
+ Label fail = ilg.DefineLabel ();
+ ilg.Emit (OpCodes.Ldc_I4_2);
+ ilg.Emit (OpCodes.Dup);
+ ilg.Emit (OpCodes.Add);
+ ilg.Emit (OpCodes.Stloc_0);
+ ilg.Emit (OpCodes.Ldc_I4_4);
+ ilg.Emit (OpCodes.Ldloc_0);
+ ilg.Emit (OpCodes.Sub);
+ ilg.Emit (OpCodes.Brfalse, fail);
+ ilg.Emit (OpCodes.Ldc_I4_1);
+ ilg.Emit (OpCodes.Ret);
+ ilg.MarkLabel (fail);
+ ilg.Emit (OpCodes.Ldc_I4_0);
+ ilg.Emit (OpCodes.Ret);
+
+
+ fbuilder = tbuilder.DefineField ("int_field", typeof(int), FieldAttributes.Private);
+ pbuilder = tbuilder.DefineProperty ("FieldI", PropertyAttributes.None, typeof(int), null);
+ get_method = tbuilder.DefineMethod("get_FieldI", MethodAttributes.Public, result, null);
+ ilg = get_method.GetILGenerator (128);
+ ilg.Emit (OpCodes.Ldloc_0);
+ ilg.Emit (OpCodes.Ldloc_0);
+ ilg.Emit (OpCodes.Ceq);
+ ilg.Emit (OpCodes.Ret);
+ pbuilder.SetGetMethod (get_method);
+
+ Type t = tbuilder.CreateType ();
+ abuilder.SetEntryPoint (entryp);
+ abuilder.Save (name);
+ return 0;
+ }
+}
diff --git a/mono/tests/console.cs b/mono/tests/console.cs
new file mode 100755
index 00000000000..d0546f19a57
--- /dev/null
+++ b/mono/tests/console.cs
@@ -0,0 +1,13 @@
+using System;
+
+public class Test {
+
+ public static int Main () {
+
+ Console.WriteLine ("We can now write to the console");
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/custom-attr.cs b/mono/tests/custom-attr.cs
new file mode 100644
index 00000000000..4fa114186a9
--- /dev/null
+++ b/mono/tests/custom-attr.cs
@@ -0,0 +1,37 @@
+
+using System;
+using System.Reflection;
+
+namespace Test {
+ public class MyAttribute: Attribute {
+ public string val;
+ public MyAttribute (string stuff) {
+ System.Console.WriteLine (stuff);
+ val = stuff;
+ }
+ }
+ public class My2Attribute: MyAttribute {
+ public int ival;
+ public My2Attribute (string stuff, int blah) : base (stuff) {
+ System.Console.WriteLine ("ctor with int val"+stuff);
+ ival = blah;
+ }
+ }
+ [My("testclass")]
+ [My2("testclass", 22)]
+ public class Test {
+ static public int Main() {
+ System.Reflection.MemberInfo info = typeof (Test);
+ object[] attributes = info.GetCustomAttributes (false);
+ for (int i = 0; i < attributes.Length; i ++) {
+ System.Console.WriteLine(attributes[i]);
+ }
+ if (attributes.Length != 2)
+ return 1;
+ MyAttribute attr = (MyAttribute) attributes [0];
+ if (attr.val != "testclass")
+ return 2;
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/delegate.cs b/mono/tests/delegate.cs
new file mode 100644
index 00000000000..7c86a174f13
--- /dev/null
+++ b/mono/tests/delegate.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Bah {
+class Test {
+ [DllImport("cygwin1.dll", EntryPoint="puts", CharSet=CharSet.Ansi)]
+ public static extern int puts (string name);
+
+ delegate void SimpleDelegate ();
+ delegate string NotSimpleDelegate (int a);
+ delegate int AnotherDelegate (string s);
+
+ public int data;
+
+ static void F () {
+ Console.WriteLine ("Test.F from delegate");
+ }
+ public static string G (int a) {
+ if (a != 2)
+ throw new Exception ("Something went wrong in G");
+ return "G got: " + a.ToString ();
+ }
+ public string H (int a) {
+ if (a != 3)
+ throw new Exception ("Something went wrong in H");
+ return "H got: " + a.ToString () + " and " + data.ToString ();
+ }
+
+ public virtual void VF () {
+ Console.WriteLine ("Test.VF from delegate");
+ }
+
+ public Test () {
+ data = 5;
+ }
+ static int Main () {
+ Test test = new Test ();
+ SimpleDelegate d = new SimpleDelegate (F);
+ SimpleDelegate d1 = new SimpleDelegate (test.VF);
+ NotSimpleDelegate d2 = new NotSimpleDelegate (G);
+ NotSimpleDelegate d3 = new NotSimpleDelegate (test.H);
+ d ();
+ d1 ();
+ // we run G() and H() before and after using them as delegates
+ // to be sure we don't corrupt them.
+ G (2);
+ test.H (3);
+ Console.WriteLine (d2 (2));
+ Console.WriteLine (d3 (3));
+ G (2);
+ test.H (3);
+
+ if (d.Method.Name != "F")
+ return 1;
+
+ if (d3.Method == null)
+ return 1;
+
+ object [] args = {3};
+ Console.WriteLine (d3.DynamicInvoke (args));
+
+ AnotherDelegate d4 = new AnotherDelegate (puts);
+ if (d4.Method == null)
+ return 1;
+
+ Console.WriteLine (d4.Method);
+ Console.WriteLine (d4.Method.Name);
+ Console.WriteLine (d4.Method.DeclaringType);
+
+ return 0;
+
+
+ }
+}
+}
diff --git a/mono/tests/delegate1.cs b/mono/tests/delegate1.cs
new file mode 100644
index 00000000000..ddfc2dbc05b
--- /dev/null
+++ b/mono/tests/delegate1.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+
+class Test {
+ delegate int SimpleDelegate (int a);
+
+ static int F (int a) {
+ Console.WriteLine ("Test.F from delegate: " + a);
+ Thread.Sleep (200);
+ return a;
+ }
+
+ static void async_callback (IAsyncResult ar)
+ {
+ Console.WriteLine ("Async Callback " + ar.AsyncState);
+ }
+
+ static int Main () {
+ SimpleDelegate d = new SimpleDelegate (F);
+ AsyncCallback ac = new AsyncCallback (async_callback);
+ string state1 = "STATE1";
+ string state2 = "STATE2";
+ string state3 = "STATE3";
+ string state4 = "STATE4";
+ int fin = 0;
+
+ IAsyncResult ar1 = d.BeginInvoke (1, ac, state1);
+ IAsyncResult ar2 = d.BeginInvoke (2, ac, state2);
+ IAsyncResult ar3 = d.BeginInvoke (3, ac, state3);
+ IAsyncResult ar4 = d.BeginInvoke (4, ac, state4);
+
+ int res = d.EndInvoke (ar1);
+
+ Console.WriteLine ("Result = " + res);
+
+ try {
+ d.EndInvoke (ar1);
+ } catch (InvalidOperationException) {
+ Console.WriteLine ("cant execute EndInvoke twice ... OK");
+ }
+
+ ar1.AsyncWaitHandle.WaitOne ();
+ if (ar1.IsCompleted) fin++;
+ Console.WriteLine ("completed1: " + ar1.IsCompleted);
+ ar2.AsyncWaitHandle.WaitOne ();
+ if (ar2.IsCompleted) fin++;
+ Console.WriteLine ("completed2: " + ar2.IsCompleted);
+ ar3.AsyncWaitHandle.WaitOne ();
+ if (ar3.IsCompleted) fin++;
+ Console.WriteLine ("completed3: " + ar3.IsCompleted);
+ ar4.AsyncWaitHandle.WaitOne ();
+ if (ar4.IsCompleted) fin++;
+ Console.WriteLine ("completed4: " + ar4.IsCompleted);
+
+ if (fin != 4)
+ return 1;
+
+ return 0;
+ }
+}
diff --git a/mono/tests/delegate2.cs b/mono/tests/delegate2.cs
new file mode 100644
index 00000000000..52b5f61d9f1
--- /dev/null
+++ b/mono/tests/delegate2.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+
+class Test {
+ delegate int SimpleDelegate (int a);
+
+ static int cb_state = 0;
+
+ static int F (int a) {
+ Console.WriteLine ("Test.F from delegate: " + a);
+ throw new NotImplementedException ();
+ }
+
+ static void async_callback (IAsyncResult ar)
+ {
+ Console.WriteLine ("Async Callback " + ar.AsyncState);
+ cb_state = 1;
+ throw new NotImplementedException ();
+ }
+
+ static int Main () {
+ SimpleDelegate d = new SimpleDelegate (F);
+ AsyncCallback ac = new AsyncCallback (async_callback);
+ string state1 = "STATE1";
+ int res = 0;
+
+ IAsyncResult ar1 = d.BeginInvoke (1, ac, state1);
+
+ ar1.AsyncWaitHandle.WaitOne ();
+
+ try {
+ res = d.EndInvoke (ar1);
+ } catch (NotImplementedException) {
+ res = 1;
+ Console.WriteLine ("received exception ... OK");
+ }
+
+ while (cb_state == 0)
+ Thread.Sleep (0);
+
+ if (cb_state != 1)
+ return 1;
+
+ if (res != 1)
+ return 2;
+
+ return 0;
+ }
+}
diff --git a/mono/tests/delegate3.cs b/mono/tests/delegate3.cs
new file mode 100644
index 00000000000..a5639efa8f0
--- /dev/null
+++ b/mono/tests/delegate3.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting.Messaging;
+
+class Test {
+ delegate int SimpleDelegate (int a);
+
+ static int cb_state = 0;
+
+ static int F (int a) {
+ Console.WriteLine ("Test.F from delegate: " + a);
+ throw new NotImplementedException ();
+ }
+
+ static void async_callback (IAsyncResult ar)
+ {
+ AsyncResult ares = (AsyncResult)ar;
+ AsyncCallback ac = new AsyncCallback (async_callback);
+
+ Console.WriteLine ("Async Callback " + ar.AsyncState);
+ cb_state++;
+ SimpleDelegate d = (SimpleDelegate)ares.AsyncDelegate;
+
+ if (cb_state < 5)
+ d.BeginInvoke (cb_state, ac, cb_state);
+
+ //throw new NotImplementedException ();
+ }
+
+ static int Main () {
+ SimpleDelegate d = new SimpleDelegate (F);
+ AsyncCallback ac = new AsyncCallback (async_callback);
+
+ IAsyncResult ar1 = d.BeginInvoke (cb_state, ac, cb_state);
+
+ ar1.AsyncWaitHandle.WaitOne ();
+
+
+ while (cb_state < 5)
+ Thread.Sleep (200);
+
+ return 0;
+ }
+}
diff --git a/mono/tests/delegate4.cs b/mono/tests/delegate4.cs
new file mode 100644
index 00000000000..5d4f03da1fa
--- /dev/null
+++ b/mono/tests/delegate4.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting.Messaging;
+
+class Test {
+ public delegate int SimpleDelegate (int a, int b);
+
+ [DllImport ("libtest.so", EntryPoint="mono_invoke_delegate")]
+ static extern int mono_invoke_delegate (SimpleDelegate d);
+
+ public static int Add (int a, int b) {
+ Console.WriteLine ("Test.Add from delegate: " + a + "+ " + b);
+ return a + b;
+ }
+
+ static int Main () {
+ SimpleDelegate d = new SimpleDelegate (Add);
+
+ mono_invoke_delegate (d);
+
+ return 0;
+ }
+}
diff --git a/mono/tests/double-cast.cs b/mono/tests/double-cast.cs
new file mode 100644
index 00000000000..63c40d3c0be
--- /dev/null
+++ b/mono/tests/double-cast.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace System {
+ public class Test {
+ public static int Main() {
+ double d = 5.0;
+ object o = d;
+ double e = (double) o;
+
+ if (e != d)
+ return 1;
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/enum.cs b/mono/tests/enum.cs
new file mode 100755
index 00000000000..2f8f55cd53a
--- /dev/null
+++ b/mono/tests/enum.cs
@@ -0,0 +1,38 @@
+namespace Test {
+
+public enum YaddaYadda {
+ buba,
+ birba,
+ dadoom,
+};
+
+public enum byteenum : byte {
+ zero,
+ one,
+ two,
+ three
+}
+
+public enum longenum: long {
+ s0 = 0,
+ s1 = 1
+}
+
+public enum sbyteenum : sbyte {
+ d0,
+ d1
+}
+
+public class test {
+ public static int Main () {
+ YaddaYadda val = YaddaYadda.dadoom;
+ byteenum be = byteenum.one;
+ if (val != YaddaYadda.dadoom)
+ return 1;
+ if (be != (byteenum)1)
+ return 2;
+ return 0;
+ }
+}
+
+}
diff --git a/mono/tests/enum2.cs b/mono/tests/enum2.cs
new file mode 100755
index 00000000000..724d99da0b1
--- /dev/null
+++ b/mono/tests/enum2.cs
@@ -0,0 +1,79 @@
+using System;
+
+enum A {
+ Hello,
+ Bye
+}
+
+class X {
+
+ static int Main ()
+ {
+ int num = 0;
+
+ object x = A.Hello;
+ object y = A.Bye;
+
+ num++;
+ if ((int)x != 0)
+ return num;
+
+ num++;
+ if ((int)y != 1)
+ return num;
+
+ num++;
+ if ("Hello" != A.Hello.ToString ())
+ return num;
+
+ num++;
+ if (!x.Equals(x))
+ return num;
+
+ num++;
+ if (x.Equals(y))
+ return num;
+
+ num++;
+ if (x.Equals(0))
+ return num;
+
+ num++;
+ Type et = x.GetType ();
+ object z = Enum.ToObject (et, Int64.MaxValue);
+ if ((int)z != -1)
+ return num;
+
+ num++;
+ z = Enum.ToObject (et, 0);
+ if (!x.Equals(z))
+ return num;
+
+ num++;
+ z = Enum.ToObject (et, 1);
+ if (!y.Equals(z))
+ return num;
+
+ num++;
+ z = Enum.Parse (et, "Bye");
+ if (!y.Equals(z))
+ return num;
+
+ num++;
+ try {
+ z = Enum.Parse (et, "bye");
+ } catch {
+ z = null;
+ }
+ if (z != null)
+ return num;
+
+ num++;
+ z = Enum.Parse (et, "bye", true);
+ if (!y.Equals(z))
+ return num;
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/enum3.cs b/mono/tests/enum3.cs
new file mode 100755
index 00000000000..6a4474d60cf
--- /dev/null
+++ b/mono/tests/enum3.cs
@@ -0,0 +1,32 @@
+using System;
+
+namespace Test {
+
+enum TestingEnum {This, Is, A, Test};
+enum TestingEnum2 {This, Is, A, Test};
+
+public class test {
+ public static int Main () {
+ int num = 0;
+
+ Enum e1 = new TestingEnum();
+ Enum e2 = new TestingEnum();
+ Enum e3 = new TestingEnum2();
+
+ ++num;
+ if (!e1.Equals(e2))
+ return num;
+
+ ++num;
+ if (e1.Equals(e3))
+ return num;
+
+ ++num;
+ if (TestingEnum.Test.Equals(TestingEnum2.Test))
+ return num;
+
+ return 0;
+ }
+}
+
+}
diff --git a/mono/tests/enumcast.cs b/mono/tests/enumcast.cs
new file mode 100644
index 00000000000..8650ba501db
--- /dev/null
+++ b/mono/tests/enumcast.cs
@@ -0,0 +1,19 @@
+namespace Test {
+ enum MyEnum {
+ ZERO,
+ ONE
+ }
+ public class Test {
+
+ static int unbox_and_return (object obj) {
+ return (int)(MyEnum)obj;
+ }
+ public static int Main() {
+ if (unbox_and_return (MyEnum.ZERO) != 0)
+ return 1;
+ if (unbox_and_return (MyEnum.ONE) != 1)
+ return 2;
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/exception.cs b/mono/tests/exception.cs
new file mode 100755
index 00000000000..c60e9a3b500
--- /dev/null
+++ b/mono/tests/exception.cs
@@ -0,0 +1,50 @@
+using System;
+
+public class Ex {
+
+ int p;
+
+ public static int test1 () {
+ Ex x = null;
+
+ try {
+ x.p = 1;
+ } catch (NullReferenceException) {
+ return 0;
+ }
+ return 1;
+ }
+
+ public static int test (int a) {
+ int res;
+ int fin = 0;
+ try {
+ res = 10/a;
+ } catch (DivideByZeroException ex) {
+ if (fin != 1)
+ res = 34;
+ else
+ res = 33;
+ } catch {
+ if (fin != 1)
+ res = 24;
+ else
+ res = 22;
+ } finally {
+ fin = 1;
+ }
+ return res;
+ }
+ public static int Main () {
+ if (test(1) != 10)
+ return 1;
+ if (test(0) != 34)
+ return 2;
+ if (test1() != 0)
+ return 3;
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/exception2.cs b/mono/tests/exception2.cs
new file mode 100755
index 00000000000..f298b8fda7c
--- /dev/null
+++ b/mono/tests/exception2.cs
@@ -0,0 +1,22 @@
+using System;
+
+public class Ex2 {
+
+ public static int test (int a) {
+ int res;
+ res = 10/a;
+ return res;
+ }
+ public static int Main () {
+ int res = 1;
+ try {
+ test(1);
+ test(0);
+ } catch {
+ res = 0;
+ }
+ return res;
+ }
+}
+
+
diff --git a/mono/tests/exception3.cs b/mono/tests/exception3.cs
new file mode 100755
index 00000000000..dfabf778948
--- /dev/null
+++ b/mono/tests/exception3.cs
@@ -0,0 +1,53 @@
+using System;
+
+public class MyEx : Exception {
+ public MyEx () {}
+}
+
+public class Ex {
+
+ static int fin;
+
+ public static int test (int a) {
+ int res;
+
+ fin = 0;
+
+ try {
+ try {
+ res = 10/a;
+ throw new MyEx ();
+ } catch (DivideByZeroException ex) {
+ if (fin != 1)
+ res = 34;
+ else
+ res = 33;
+ } finally {
+ fin = 1;
+ }
+ } finally {
+ fin += 1;
+ }
+
+ return res;
+ }
+ public static int Main () {
+ int catched = 0;
+ try {
+ test (1);
+ } catch (MyEx ex) {
+ catched = 1;
+ }
+ if (catched != 1)
+ return 2;
+
+ if (fin != 2)
+ return 3;
+
+ if (test(0) != 34)
+ return 4;
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/exception4.cs b/mono/tests/exception4.cs
new file mode 100755
index 00000000000..4ac6173091e
--- /dev/null
+++ b/mono/tests/exception4.cs
@@ -0,0 +1,47 @@
+using System;
+
+public class MyEx : Exception {
+ public MyEx () {}
+}
+
+public class Ex {
+
+ public static int test (int a) {
+ int res;
+ int fin = 0;
+ try {
+ res = 10/a;
+ throw new MyEx ();
+ } catch (Exception ex) {
+ ex = new MyEx ();
+ throw;
+ } finally {
+ fin = 1;
+ }
+ return res;
+ }
+ public static int Main () {
+ int catched = 0;
+ try {
+ test (1);
+ } catch (MyEx ex) {
+ catched = 1;
+ }
+ if (catched != 1)
+ return 2;
+ try {
+ test (0);
+ } catch (MyEx ex) {
+ catched = 2;
+ } catch {
+ // we should get here because rethrow rethrows the dividebyzero ex
+ // not the exception assigned to the local var (a MyEx)
+ catched = 3;
+ }
+ if (catched != 3)
+ return 3;
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/exception5.cs b/mono/tests/exception5.cs
new file mode 100755
index 00000000000..362f9c1af50
--- /dev/null
+++ b/mono/tests/exception5.cs
@@ -0,0 +1,30 @@
+using System;
+
+public class Ex {
+
+ public static int test (int a) {
+ int res;
+ int fin = 0;
+ try {
+ try {
+ res = 10/a;
+ } catch (DivideByZeroException ex) {
+ res = 34;
+ } catch {
+ res = 22;
+ }
+ } catch {
+ res = 44;
+ } finally {
+ fin += 1;
+ }
+ return fin;
+ }
+ public static int Main () {
+ if (test(0) != 1)
+ return 1;
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/exception6.cs b/mono/tests/exception6.cs
new file mode 100755
index 00000000000..b2e09b9296b
--- /dev/null
+++ b/mono/tests/exception6.cs
@@ -0,0 +1,224 @@
+using System;
+
+public class Ex {
+
+ public static int test () {
+ int ocount = 0;
+
+ checked {
+
+ ocount = 0;
+ try {
+ ulong a = UInt64.MaxValue - 1;
+ ulong t = a++;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 0)
+ return 1;
+
+ ocount = 0;
+ try {
+ ulong a = UInt64.MaxValue;
+ ulong t = a++;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 1)
+ return 2;
+
+ ocount = 0;
+ try {
+ long a = Int64.MaxValue - 1;
+ long t = a++;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 0)
+ return 3;
+
+ try {
+ long a = Int64.MaxValue;
+ long t = a++;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 1)
+ return 4;
+
+ ocount = 0;
+ try {
+ ulong a = UInt64.MaxValue - 1;
+ ulong t = a++;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 0)
+ return 5;
+
+ try {
+ ulong a = UInt64.MaxValue;
+ ulong t = a++;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 1)
+ return 6;
+
+ ocount = 0;
+ try {
+ long a = Int64.MinValue + 1;
+ long t = a--;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 0)
+ return 7;
+
+ ocount = 0;
+ try {
+ long a = Int64.MinValue;
+ long t = a--;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 1)
+ return 8;
+
+ ocount = 0;
+ try {
+ ulong a = UInt64.MinValue + 1;
+ ulong t = a--;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 0)
+ return 9;
+
+ ocount = 0;
+ try {
+ ulong a = UInt64.MinValue;
+ ulong t = a--;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 1)
+ return 10;
+
+ ocount = 0;
+ try {
+ int a = Int32.MinValue + 1;
+ int t = a--;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 0)
+ return 11;
+
+ ocount = 0;
+ try {
+ int a = Int32.MinValue;
+ int t = a--;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 1)
+ return 12;
+
+ ocount = 0;
+ try {
+ uint a = 1;
+ uint t = a--;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 0)
+ return 13;
+
+ ocount = 0;
+ try {
+ uint a = 0;
+ uint t = a--;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 1)
+ return 14;
+
+ ocount = 0;
+ try {
+ sbyte a = 126;
+ sbyte t = a++;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 0)
+ return 15;
+
+ ocount = 0;
+ try {
+ sbyte a = 127;
+ sbyte t = a++;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 1)
+ return 16;
+
+ ocount = 0;
+ try {
+ } catch {
+ ocount++;
+ }
+ if (ocount != 0)
+ return 17;
+
+ ocount = 0;
+ try {
+ int a = 1 << 29;
+ int t = a*2;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 0)
+ return 18;
+
+ ocount = 0;
+ try {
+ int a = 1 << 30;
+ int t = a*2;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 1)
+ return 19;
+
+ ocount = 0;
+ try {
+ ulong a = 0xffffffffff;
+ ulong t = a*0x0ffffff;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 0)
+ return 20;
+
+ ocount = 0;
+ try {
+ ulong a = 0xffffffffff;
+ ulong t = a*0x0fffffff;
+ } catch {
+ ocount++;
+ }
+ if (ocount != 1)
+ return 21;
+ }
+
+ return 0;
+ }
+ public static int Main () {
+ return test();
+ }
+}
+
+
diff --git a/mono/tests/exception7.cs b/mono/tests/exception7.cs
new file mode 100644
index 00000000000..a730dbbed56
--- /dev/null
+++ b/mono/tests/exception7.cs
@@ -0,0 +1,20 @@
+using System;
+
+public class Test {
+ public static int Main() {
+ try {
+ Console.WriteLine("In try");
+ throw new Exception();
+ //return(1);
+ }
+ catch (Exception e) {
+ Console.WriteLine("In catch");
+ return(0);
+ }
+ finally {
+ Console.WriteLine("In finally");
+ }
+ return 2;
+ }
+}
+
diff --git a/mono/tests/fib.cs b/mono/tests/fib.cs
new file mode 100755
index 00000000000..212889482a0
--- /dev/null
+++ b/mono/tests/fib.cs
@@ -0,0 +1,26 @@
+using System;
+
+public class Fib {
+
+ public static int fib (int n) {
+ if (n < 2)
+ return 1;
+ return fib(n-2)+fib(n-1);
+ }
+ public static int Main (string[] args) {
+ int repeat = 1;
+
+ if (args.Length == 1)
+ repeat = Convert.ToInt32 (args [0]);
+
+ Console.WriteLine ("Repeat = " + repeat);
+
+ for (int i = 0; i < repeat; i++)
+ if (fib (32) != 3524578)
+ return 1;
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/field-layout.cs b/mono/tests/field-layout.cs
new file mode 100644
index 00000000000..6e32df69896
--- /dev/null
+++ b/mono/tests/field-layout.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Test {
+ [StructLayout ( LayoutKind.Explicit )]
+ public struct Doh {
+ [ FieldOffset(0) ] public int a;
+ [ FieldOffset(0) ] public byte a1;
+ [ FieldOffset(1) ] public byte a2;
+ [ FieldOffset(2) ] public byte a3;
+ [ FieldOffset(3) ] public byte a4;
+ }
+ [StructLayout ( LayoutKind.Explicit )]
+ public class Doh2 {
+ [ FieldOffset(0) ] public int a;
+ [ FieldOffset(0) ] public byte a1;
+ [ FieldOffset(1) ] public byte a2;
+ [ FieldOffset(2) ] public byte a3;
+ [ FieldOffset(3) ] public byte a4;
+ }
+ [StructLayout ( LayoutKind.Explicit )]
+ public class Doh3: Doh2 {
+ [ FieldOffset(0) ] public int b;
+ }
+ public class Test {
+ public static int Main() {
+ Doh doh;
+ Doh3 doh2 = new Doh3 ();
+ bool success = false;
+ // shut up the compiler
+ doh.a1 = doh.a2 = doh.a3 = doh.a4 = 0;
+ doh.a = 1;
+ if (doh.a1 == 1 && doh.a2 == 0 && doh.a3 == 0 && doh.a4 == 0) {
+ System.Console.WriteLine ("Little endian");
+ success = true;
+ } else if (doh.a1 == 0 && doh.a2 == 0 && doh.a3 == 0 && doh.a4 == 1) {
+ System.Console.WriteLine ("Big endian");
+ success = true;
+ }
+ if (!success)
+ return 1;
+ // shut up the compiler
+ doh2.a1 = doh2.a2 = doh2.a3 = doh2.a4 = 0;
+ doh2.a = 1;
+ if (doh2.a1 == 1 && doh2.a2 == 0 && doh2.a3 == 0 && doh2.a4 == 0) {
+ success = true;
+ } else if (doh2.a1 == 0 && doh2.a2 == 0 && doh2.a3 == 0 && doh2.a4 == 1) {
+ success = true;
+ }
+ doh2.b = 3;
+ if (doh2.a != 3)
+ success = false;
+ if (!success)
+ return 1;
+ return 0;
+
+ }
+ }
+}
diff --git a/mono/tests/hash-table.cs b/mono/tests/hash-table.cs
new file mode 100644
index 00000000000..6043aa880b8
--- /dev/null
+++ b/mono/tests/hash-table.cs
@@ -0,0 +1,27 @@
+using System.Collections;
+
+namespace Test {
+ public class Test {
+ public static int Main () {
+ string[] names = {
+ "one", "two", "three", "four"
+ };
+ Hashtable hash = new Hashtable ();
+
+ for (int i=0; i < names.Length; ++i) {
+ hash.Add (names [i], i);
+ }
+ if ((int)hash ["one"] != 0)
+ return 1;
+ if ((int)hash ["two"] != 1)
+ return 2;
+ if ((int)hash ["three"] != 2)
+ return 3;
+ if ((int)hash ["four"] != 3)
+ return 4;
+ if (hash.Contains("urka"))
+ return 5;
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/hashcode.cs b/mono/tests/hashcode.cs
new file mode 100644
index 00000000000..15f2eecbdb7
--- /dev/null
+++ b/mono/tests/hashcode.cs
@@ -0,0 +1,28 @@
+using System;
+
+public class X {
+ int a;
+}
+
+public class Test {
+
+ struct test {
+ public int v1;
+ }
+ public static int Main () {
+
+ test a = new test();
+
+ a.v1 = 5;
+
+ Console.WriteLine (a.GetHashCode ());
+
+ X b = new X();
+ X c = new X();
+
+ Console.WriteLine (b.GetHashCode ());
+ Console.WriteLine (c.GetHashCode ());
+
+ return 0;
+ }
+}
diff --git a/mono/tests/iface.cs b/mono/tests/iface.cs
new file mode 100644
index 00000000000..5596a3bbdde
--- /dev/null
+++ b/mono/tests/iface.cs
@@ -0,0 +1,23 @@
+public interface IHelloWorldWriter
+{
+ int WriteIt();
+}
+
+public class RealWriter : IHelloWorldWriter
+{
+ public int WriteIt()
+ {
+ return 33;
+ }
+}
+
+public class ProjectName {
+ static int Main()
+ {
+ IHelloWorldWriter writer = new RealWriter();
+ if (writer.WriteIt() != 33)
+ return 1;
+ return 0;
+ }
+}
+
diff --git a/mono/tests/iface2.cs b/mono/tests/iface2.cs
new file mode 100644
index 00000000000..cc86c357051
--- /dev/null
+++ b/mono/tests/iface2.cs
@@ -0,0 +1,81 @@
+interface IA
+{
+ int Add(int i);
+
+ int Add2(int i);
+}
+
+interface IB
+{
+ int Add(int i);
+}
+
+interface IC
+{
+ int Add(int i);
+}
+
+interface ID : IA, IB {}
+
+class D : ID
+{
+ int IA.Add (int i) {
+ return 5;
+ }
+
+ int IA.Add2 (int i) {
+ return 6;
+ }
+
+ int IB.Add (int i) {
+ return 7;
+ }
+}
+
+
+class E : IC, ID
+{
+ int IC.Add (int i) {
+ return 8;
+ }
+
+ int IA.Add (int i) {
+ return 9;
+ }
+
+ int IA.Add2 (int i) {
+ return 10;
+ }
+
+ int IB.Add (int i) {
+ return 11;
+ }
+}
+
+
+class C
+{
+ static int Test(ID n) {
+
+ if (((IA)n).Add2(0) != 6)
+ return 1;
+
+ if (((IB)n).Add(0) != 7)
+ return 1;
+
+
+ return 0;
+ }
+
+ static int Main()
+ {
+ D d = new D();
+ E e = new E();
+
+ if (Test (d) != 0)
+ return 1;
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/iface3.cs b/mono/tests/iface3.cs
new file mode 100644
index 00000000000..b3c8622354d
--- /dev/null
+++ b/mono/tests/iface3.cs
@@ -0,0 +1,49 @@
+using System;
+
+public interface ICommon {
+ int DoIt ();
+}
+
+public class Base : ICommon {
+ int ICommon.DoIt () { return 1; }
+ public virtual int DoIt () { return 2; }
+}
+
+public class Derived : Base, ICommon {
+ int ICommon.DoIt () { return 3; }
+ public new virtual int DoIt () { return 4; }
+}
+
+public class ReallyDerived : Derived {
+ public override int DoIt () { return 5; }
+}
+
+public class Test {
+
+ static int Main () {
+ ReallyDerived r1 = new ReallyDerived ();
+ Derived r2 = r1;
+ Base r3 = r1;
+ ICommon r4 = r1;
+ Object r5 = r1;
+
+ if (r1.DoIt() != 5)
+ return 1;
+
+ if (((ICommon)r1).DoIt() != 3)
+ return 2;
+
+ //Console.WriteLine ("TEST {0}", ((ICommon)r1).DoIt ());
+
+ if (r2.DoIt() != 5)
+ return 3;
+
+ if (r3.DoIt() != 2)
+ return 4;
+
+ if (r4.DoIt() != 3)
+ return 5;
+
+ return 0;
+ }
+}
diff --git a/mono/tests/iface4.cs b/mono/tests/iface4.cs
new file mode 100644
index 00000000000..72d93951dcf
--- /dev/null
+++ b/mono/tests/iface4.cs
@@ -0,0 +1,58 @@
+using System;
+
+public interface IVehicle {
+ int Start ();
+ int Stop ();
+ int Turn ();
+}
+
+public class Base : IVehicle {
+ int IVehicle.Start () { return 1; }
+ public int Stop () { return 2; }
+ public virtual int Turn () { return 3; }
+}
+
+public class Derived1 : Base {
+ // replaces Base.Turn + IVehice.Turn
+ public override int Turn () { return 4; }
+}
+
+public class Derived2 : Base, IVehicle {
+ // legal - we redeclared IVehicle support
+ public new int Stop () { return 6; }
+ // legal - we redeclared IVehicle support
+ int IVehicle.Start () { return 5; }
+ // replaces IVehicle.Turn
+ int IVehicle.Turn () { return 7; }
+ // replaces Base.Turn
+ public override int Turn () { return 8; }
+}
+
+public class Test {
+
+ static int Main () {
+ Derived1 d1 = new Derived1 ();
+ Derived2 d2 = new Derived2 ();
+ Base b1 = d1;
+ Base b2 = d2;
+
+ if (d1.Turn () != 4)
+ return 1;
+
+ if (((IVehicle)d1).Turn () != 4)
+ return 2;
+
+ if (((IVehicle)d2).Turn () != 7)
+ return 3;
+
+ if (b2.Turn () != 8)
+ return 4;
+
+ if (((IVehicle)b2).Turn () != 7)
+ return 5;
+
+ //Console.WriteLine ("TEST {0}", ((IVehicle)b2).Turn ());
+
+ return 0;
+ }
+}
diff --git a/mono/tests/iface6.cs b/mono/tests/iface6.cs
new file mode 100644
index 00000000000..6e89a23e7f4
--- /dev/null
+++ b/mono/tests/iface6.cs
@@ -0,0 +1,79 @@
+using System;
+
+interface IA
+{
+ int Add(int i);
+}
+
+interface IB
+{
+ int Add(int i);
+}
+
+interface IC : IA, IB {}
+
+interface IE : ICloneable, IDisposable {
+ void doom ();
+}
+
+class D : IC, IB
+{
+ int IA.Add (int i) {
+ return 5;
+ }
+
+ int IB.Add (int i) {
+ return 6;
+ }
+}
+
+class E: IE, IC {
+ public E() {
+ }
+ public void doom () {
+ return;
+ }
+ public Object Clone () {
+ return null;
+ }
+ public void Dispose () {}
+ int IA.Add (int i) {
+ return 7;
+ }
+
+ int IB.Add (int i) {
+ return 8;
+ }
+}
+
+class C
+{
+ static int Test(IC n) {
+
+ if (((IA)n).Add(0) != 5)
+ return 1;
+
+ if (((IB)n).Add(0) != 6)
+ return 1;
+
+
+ return 0;
+ }
+
+ static void Test2(IE ie) {
+ ie.doom ();
+ object o = ie.Clone();
+ ie.Dispose ();
+ }
+
+ static int Main()
+ {
+ D d = new D();
+ E e = new E();
+ int a = Test (e);
+ Test2 (e);
+
+ return Test (d);
+ }
+}
+
diff --git a/mono/tests/indexer.cs b/mono/tests/indexer.cs
new file mode 100644
index 00000000000..9ce4c8f7a6d
--- /dev/null
+++ b/mono/tests/indexer.cs
@@ -0,0 +1,32 @@
+namespace Test {
+public class Patient {
+ int id;
+ double age;
+ bool dead;
+ public object this[string name] {
+ get {
+ switch (name) {
+ case "id": return id;
+ case "age": return age;
+ case "dead": return dead;
+ default: return null;
+ }
+ }
+ set {
+ switch (name) {
+ case "id": id = (int)value; break;
+ case "age": age = (double)value; break;
+ case "dead": dead = (bool)value; break;
+ }
+ }
+ }
+ public static int Main() {
+ Patient bob = new Patient();
+ bob["age"] = 32.0;
+ if ((bool)bob["dead"])
+ return 1;
+ return 0;
+ }
+}
+}
+
diff --git a/mono/tests/interface.cs b/mono/tests/interface.cs
new file mode 100644
index 00000000000..5c2a8611351
--- /dev/null
+++ b/mono/tests/interface.cs
@@ -0,0 +1,56 @@
+using System;
+
+namespace Obj {
+ interface Measurable {
+ double Area ();
+ };
+ class Obj : Measurable {
+ public double Area () {
+ return 0.0;
+ }
+ };
+ class Rect : Obj {
+ int x, y, w, h;
+ public Rect (int vx, int vy, int vw, int vh) {
+ x = vx;
+ y = vy;
+ w = vw;
+ h = vh;
+ }
+ public new double Area () {
+ return (double)w*h;
+ }
+ }
+ class Circle : Obj {
+ int x, y, r;
+ public Circle (int vx, int vy, int vr) {
+ x = vx;
+ y = vy;
+ r = vr;
+ }
+ public new double Area () {
+ return r*r*System.Math.PI;
+ }
+ }
+ class Test {
+ static public int Main () {
+ Obj rect, circle;
+ double sum;
+ rect = new Rect (0, 0, 10, 20);
+ circle = new Circle (0, 0, 20);
+ sum = rect.Area() + circle.Area ();
+ /* surprise! this calls Obj.Area... */
+ if (sum != 0.0)
+ return 1;
+ /* now call the derived methods */
+ sum = ((Rect)rect).Area() + ((Circle)circle).Area ();
+ if (sum != (200 + 400*System.Math.PI))
+ return 2;
+ /* let's try to cast to the interface, instead */
+ sum = ((Measurable)rect).Area() + ((Measurable)circle).Area ();
+ if (sum != 0.0)
+ return 3;
+ return 0;
+ }
+ };
+};
diff --git a/mono/tests/interface1.cs b/mono/tests/interface1.cs
new file mode 100644
index 00000000000..251c8692e40
--- /dev/null
+++ b/mono/tests/interface1.cs
@@ -0,0 +1,19 @@
+namespace intf {
+ public class A {
+ public virtual int method () {
+ return 1;
+ }
+ }
+ public interface B {
+ int method ();
+ }
+ public class C : A, B {
+
+ static int Main() {
+ C c = new C ();
+ if (c.method() != 1)
+ return 1;
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/intptrcast.cs b/mono/tests/intptrcast.cs
new file mode 100644
index 00000000000..c69df851800
--- /dev/null
+++ b/mono/tests/intptrcast.cs
@@ -0,0 +1,14 @@
+using System;
+
+public class Test {
+
+ public static int Main () {
+ IntPtr ip = (IntPtr)1;
+
+ if (ip.ToString () != "1")
+ return 1;
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/ipaddress.cs b/mono/tests/ipaddress.cs
new file mode 100644
index 00000000000..fbb7acb8654
--- /dev/null
+++ b/mono/tests/ipaddress.cs
@@ -0,0 +1,30 @@
+using System.Net;
+using System.Net.Sockets;
+using System.IO;
+using System;
+
+namespace T {
+ public class T {
+
+ public static int Main () {
+
+ /*
+ Console.WriteLine ("address is " + IPAddress.NetworkToHostOrder (0x0100007f).ToString("X"));
+ */
+
+ IPAddress testadd = IPAddress.Parse ("127.0.0.1");
+ Console.WriteLine("address is " + testadd.Address.ToString ("X"));
+ if (testadd.Address != 0x0100007f)
+ return 1;
+
+
+ IPAddress hostadd = new IPAddress(0x0100007f);
+ Console.WriteLine("address is " + hostadd.ToString());
+ if (hostadd.ToString() != "127.0.0.1")
+ return 1;
+
+ return 0;
+ }
+ }
+}
+
diff --git a/mono/tests/isvaluetype.cs b/mono/tests/isvaluetype.cs
new file mode 100644
index 00000000000..e1c8a796f04
--- /dev/null
+++ b/mono/tests/isvaluetype.cs
@@ -0,0 +1,38 @@
+using System;
+
+namespace test {
+
+ public class Test {
+ public static int Main (string[] args) {
+ int verbose = 0;
+ if (args.Length > 0 && args[0] == "-v")
+ verbose++;
+
+ if (verbose != 0)
+ Console.WriteLine ("ValueType is valuetype: "+ typeof(System.ValueType).IsValueType.ToString());
+ if (typeof(System.ValueType).IsValueType)
+ return 1;
+ if (verbose != 0)
+ Console.WriteLine ("Enum is valuetype: "+ typeof(System.Enum).IsValueType.ToString());
+ if (typeof(System.Enum).IsValueType)
+ return 2;
+ if (verbose != 0)
+ Console.WriteLine ("TypeAttributes is valuetype: "+ typeof(System.Reflection.TypeAttributes).IsValueType.ToString());
+ if (!typeof(System.Reflection.TypeAttributes).IsValueType)
+ return 3;
+ if (verbose != 0)
+ Console.WriteLine ("TypeAttributes is enum: "+ typeof(System.Reflection.TypeAttributes).IsEnum.ToString());
+ if (!typeof(System.Reflection.TypeAttributes).IsEnum)
+ return 4;
+ if (verbose != 0)
+ Console.WriteLine ("Enum is enum: "+ typeof(System.Enum).IsEnum.ToString());
+ if (typeof(System.Enum).IsEnum)
+ return 5;
+ if (verbose != 0)
+ Console.WriteLine ("Int32 is valuetype: "+ typeof(System.Int32).IsValueType.ToString());
+ if (!typeof(System.Int32).IsValueType)
+ return 6;
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/jit-float.cs b/mono/tests/jit-float.cs
new file mode 100644
index 00000000000..97e47474cd2
--- /dev/null
+++ b/mono/tests/jit-float.cs
@@ -0,0 +1,125 @@
+using System;
+
+public class TestJit {
+
+ public static int test_nan ()
+ {
+ double nan1 = Double.NaN;
+ double nan2 = Double.NaN;
+ double neg_inf1 = Double.NegativeInfinity;
+ double neg_inf2 = Double.NegativeInfinity;
+ double pos_inf1 = Double.PositiveInfinity;
+ double pos_inf2 = Double.PositiveInfinity;
+
+ if (nan1 == nan2)
+ return 1;
+
+ if (!nan1.Equals(nan2))
+ return 1;
+
+ if (neg_inf1 != neg_inf2)
+ return 1;
+
+ if (!neg_inf1.Equals(neg_inf2))
+ return 1;
+
+ if (pos_inf1 != pos_inf2)
+ return 1;
+
+ if (!pos_inf1.Equals(pos_inf2))
+ return 1;
+
+ if (pos_inf1 == neg_inf1)
+ return 1;
+
+ if (pos_inf1.Equals (neg_inf1))
+ return 1;
+
+ if (pos_inf1 == nan1)
+ return 1;
+
+ return 0;
+ }
+
+ public static double test_call (double a, double b) {
+ return a+b;
+ }
+
+ public static int test_alu ()
+ {
+ double a = 9, b = 6;
+
+ if ((a + b) != 15)
+ return 1;
+
+ if ((a - b) != 3)
+ return 1;
+
+ if ((a * b) != 54)
+ return 1;
+
+ if ((a / 4) != 2.25)
+ return 1;
+
+ if ((a % 4) != 1)
+ return 1;
+
+ if (-a != -9)
+ return 1;
+
+ return 0;
+ }
+
+ public static int test_branch ()
+ {
+ double a = 0.5, b = 0.5, t;
+
+ if (a == b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a != b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ if (a >= b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a > b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ if (a <= b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a < b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ if (a > 1.0) return 1;
+
+ if (a < 0.1) return 1;
+
+ return 0;
+ }
+
+ public static int Main() {
+ int num = 1;
+
+ if (test_call (3, 5) != 8)
+ return num;
+ num++;
+
+ if (test_branch () != 0)
+ return num;
+ num++;
+
+ if (test_alu () != 0)
+ return num;
+ num++;
+
+ if (test_nan () != 0)
+ return num;
+ num++;
+
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/jit-int.cs b/mono/tests/jit-int.cs
new file mode 100644
index 00000000000..6cb0f2127b3
--- /dev/null
+++ b/mono/tests/jit-int.cs
@@ -0,0 +1,142 @@
+using System;
+
+public class TestJit {
+
+ public static int test_short ()
+ {
+ int max = 32767;
+ int min = -32768;
+
+ int t1 = 0xffeedd;
+ short s1 = (short)t1;
+ int t2 = s1;
+
+ if ((uint)t2 != 0xffffeedd)
+ return 1;
+
+ Console.WriteLine (t2.ToString ("X"));
+
+ if (Int16.Parse((min).ToString()) != -32768)
+ return 1;
+
+ if (Int16.Parse((max).ToString()) != 32767)
+ return 1;
+
+ return 0;
+ }
+
+ public static int test_call (int a, int b) {
+ return a+b;
+ }
+
+ public static int test_shift ()
+ {
+ int a = 9, b = 1;
+
+ if ((a << 1) != 18)
+ return 1;
+
+ if ((a << b) != 18)
+ return 1;
+
+ if ((a >> 1) != 4)
+ return 1;
+
+ if ((a >> b) != 4)
+ return 1;
+
+ a = -9;
+ if ((a >> b) != -5)
+ return 1;
+
+ return 0;
+ }
+
+ public static int test_alu ()
+ {
+ int a = 9, b = 6;
+
+ if ((a + b) != 15)
+ return 1;
+
+ if ((a - b) != 3)
+ return 1;
+
+ if ((a & 8) != 8)
+ return 1;
+
+ if ((a | 2) != 11)
+ return 1;
+
+ if ((a * b) != 54)
+ return 1;
+
+ if ((a / 4) != 2)
+ return 1;
+
+ if ((a % 4) != 1)
+ return 1;
+
+ if (-a != -9)
+ return 1;
+
+ b = -1;
+ if (~b != 0)
+ return 1;
+
+ return 0;
+ }
+
+ public static int test_branch ()
+ {
+ int a = 5, b = 5, t;
+
+ if (a == b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a != b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ if (a >= b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a > b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ if (a <= b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a < b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ return 0;
+ }
+
+ public static int Main() {
+ int num = 0;
+
+ num++;
+ if (test_short () != 0)
+ return num;
+
+ num++;
+ if (test_call (3, 5) != 8)
+ return num;
+ num++;
+
+ if (test_branch () != 0)
+ return num;
+ num++;
+
+ if (test_alu () != 0)
+ return num;
+ num++;
+
+ if (test_shift () != 0)
+ return num;
+ num++;
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/jit-long.cs b/mono/tests/jit-long.cs
new file mode 100644
index 00000000000..48276b27645
--- /dev/null
+++ b/mono/tests/jit-long.cs
@@ -0,0 +1,178 @@
+using System;
+
+public class TestJit {
+
+ public static long test_call (long a, long b) {
+ return a+b;
+ }
+
+ public static int test_shift_1 ()
+ {
+ long a = 9;
+ int b = 1;
+
+ if ((a >> b) != 4)
+ return 1;
+
+ if ((a >> 63) != 0)
+ return 1;
+
+ if ((a << 1) != 18)
+ return 1;
+
+ if ((a << b) != 18)
+ return 1;
+
+ a = -9;
+ if ((a >> b) != -5)
+ return 1;
+
+ return 0;
+ }
+
+ public static int test_shift_2 ()
+ {
+ unchecked {
+ long c = (long)0x800000ff00000000;
+ long d = (long)0x8ef0abcd00000000;
+ long t;
+ int sa;
+
+ t = c>>4;
+ Console.WriteLine (t.ToString ("X"));
+ if (t != (long)0xf800000ff0000000)
+ return 1;
+
+ if ((t << 4) != c)
+ return 1;
+
+ t = d>>40;
+ Console.WriteLine (t.ToString ("X"));
+ if (t != (long)0xffffffffff8ef0ab)
+ return 1;
+
+ if ((t << 40) != (long)0x8ef0ab0000000000)
+ return 1;
+
+
+ }
+
+ return 0;
+ }
+
+ public static int test_shift_3 ()
+ {
+ checked {
+ ulong c = 0x800000ff00000000;
+ ulong d = 0x8ef0abcd00000000;
+ ulong t;
+
+ t = c >> 4;
+ Console.WriteLine (t.ToString ("X"));
+ if (t != 0x0800000ff0000000)
+ return 1;
+
+ if ((t << 4) != c)
+ return 1;
+
+ t = d >> 40;
+ Console.WriteLine (t.ToString ("X"));
+ if (t != 0x8ef0ab)
+ return 1;
+
+ if ((t << 40) != 0x8ef0ab0000000000)
+ return 1;
+ }
+
+ return 0;
+ }
+
+ public static int test_alu ()
+ {
+ long a = 9, b = 6;
+
+ if ((a + b) != 15)
+ return 1;
+
+ if ((a - b) != 3)
+ return 1;
+
+ if ((a & 8) != 8)
+ return 1;
+
+ if ((a | 2) != 11)
+ return 1;
+
+ if ((a * b) != 54)
+ return 1;
+
+ if ((a / 4) != 2)
+ return 1;
+
+ if ((a % 4) != 1)
+ return 1;
+
+ if (-a != -9)
+ return 1;
+
+ b = -1;
+ if (~b != 0)
+ return 1;
+
+ return 0;
+ }
+
+ public static int test_branch ()
+ {
+ long a = 5, b = 5, t;
+
+ if (a == b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a != b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ if (a >= b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a > b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ if (a <= b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a < b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ return 0;
+ }
+
+ public static int Main() {
+ int num = 0;
+
+ num++;
+ if (test_shift_1 () != 0)
+ return num;
+ num++;
+ if (test_shift_2 () != 0)
+ return num;
+ num++;
+ if (test_shift_3 () != 0)
+ return num;
+
+ num++;
+ if (test_call (3, 5) != 8)
+ return num;
+
+ num++;
+ if (test_branch () != 0)
+ return num;
+
+ num++;
+ if (test_alu () != 0)
+ return num;
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/jit-uint.cs b/mono/tests/jit-uint.cs
new file mode 100644
index 00000000000..7dd325562ee
--- /dev/null
+++ b/mono/tests/jit-uint.cs
@@ -0,0 +1,82 @@
+public class TestJit {
+
+ public static uint test_call (uint a, uint b) {
+ return a+b;
+ }
+
+ public static int test_alu ()
+ {
+ uint a = 9, b = 6;
+
+ if ((a + b) != 15)
+ return 1;
+
+ if ((a - b) != 3)
+ return 1;
+
+ if ((a & 8) != 8)
+ return 1;
+
+ if ((a | 2) != 11)
+ return 1;
+
+ if ((a * b) != 54)
+ return 1;
+
+ if ((a / 4) != 2)
+ return 1;
+
+ if ((a % 4) != 1)
+ return 1;
+
+ b = 0;
+ if (~b != 0xffffffff)
+ return 1;
+
+ return 0;
+ }
+
+ public static int test_branch ()
+ {
+ uint a = 5, b = 5, t;
+
+ if (a == b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a != b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ if (a >= b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a > b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ if (a <= b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a < b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ return 0;
+ }
+
+ public static int Main() {
+ int num = 1;
+
+ if (test_call (3, 5) != 8)
+ return num;
+ num++;
+
+ if (test_branch () != 0)
+ return num;
+ num++;
+
+ if (test_alu () != 0)
+ return num;
+ num++;
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/jit-ulong.cs b/mono/tests/jit-ulong.cs
new file mode 100644
index 00000000000..9254919faaf
--- /dev/null
+++ b/mono/tests/jit-ulong.cs
@@ -0,0 +1,82 @@
+public class TestJit {
+
+ public static ulong test_call (ulong a, ulong b) {
+ return a+b;
+ }
+
+ public static int test_alu ()
+ {
+ ulong a = 9, b = 6;
+
+ if ((a + b) != 15)
+ return 1;
+
+ if ((a - b) != 3)
+ return 1;
+
+ if ((a & 8) != 8)
+ return 1;
+
+ if ((a | 2) != 11)
+ return 1;
+
+ if ((a * b) != 54)
+ return 1;
+
+ if ((a / 4) != 2)
+ return 1;
+
+ if ((a % 4) != 1)
+ return 1;
+
+ b = 0;
+ if (~b != 0xffffffffffffffff)
+ return 1;
+
+ return 0;
+ }
+
+ public static int test_branch ()
+ {
+ ulong a = 5, b = 5, t;
+
+ if (a == b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a != b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ if (a >= b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a > b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ if (a <= b) t = 1; else t = 0;
+ if (t != 1) return 1;
+
+ if (a < b) t = 0; else t = 1;
+ if (t != 1) return 1;
+
+ return 0;
+ }
+
+ public static int Main() {
+ int num = 1;
+
+ if (test_call (3, 5) != 8)
+ return num;
+ num++;
+
+ if (test_branch () != 0)
+ return num;
+ num++;
+
+ if (test_alu () != 0)
+ return num;
+ num++;
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/libtest.c b/mono/tests/libtest.c
new file mode 100644
index 00000000000..081e360adba
--- /dev/null
+++ b/mono/tests/libtest.c
@@ -0,0 +1,49 @@
+#include <stdio.h>
+
+int mono_test_many_int_arguments (int a, int b, int c, int d, int e,
+ int f, int g, int h, int i, int j);
+short mono_test_many_short_arguments (short a, short b, short c, short d, short e,
+ short f, short g, short h, short i, short j);
+char mono_test_many_char_arguments (char a, char b, char c, char d, char e,
+ char f, char g, char h, char i, char j);
+
+int
+mono_test_many_int_arguments (int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
+{
+ return a + b + c + d + e + f + g + h + i + j;
+}
+
+short
+mono_test_many_short_arguments (short a, short b, short c, short d, short e, short f, short g, short h, short i, short j)
+{
+ return a + b + c + d + e + f + g + h + i + j;
+}
+
+char
+mono_test_many_byte_arguments (char a, char b, char c, char d, char e, char f, char g, char h, char i, char j)
+{
+ return a + b + c + d + e + f + g + h + i + j;
+}
+
+int
+mono_test_puts_static (char *s)
+{
+ printf ("TEST %s\n", s);
+ return 1;
+}
+
+typedef int (*SimpleDelegate) (int a, int b);
+
+int
+mono_invoke_delegate (SimpleDelegate delegate)
+{
+ int res;
+
+ printf ("start invoke %p\n", delegate);
+
+ res = delegate (2, 3);
+
+ printf ("end invoke\n");
+
+ return res;
+}
diff --git a/mono/tests/long.cs b/mono/tests/long.cs
new file mode 100644
index 00000000000..012207c1e42
--- /dev/null
+++ b/mono/tests/long.cs
@@ -0,0 +1,50 @@
+namespace test {
+
+ public class T {
+ static ulong[] values = {
+ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048,
+ 4096, 8192, 16384, 32768, 65536, 131072,
+ 262144, 524288, 1048576, 2097152, 4194304, 8388608,
+ 16777216, 33554432, 67108864, 134217728, 268435456,
+ 536870912, 1073741824, 2147483648, 4294967296,
+ 8589934592, 17179869184, 34359738368, 68719476736,
+ 137438953472, 274877906944, 549755813888, 1099511627776,
+ 2199023255552, 4398046511104, 8796093022208,
+ 17592186044416, 35184372088832, 70368744177664,
+ 140737488355328, 281474976710656, 562949953421312,
+ 1125899906842624, 2251799813685248, 4503599627370496,
+ 9007199254740992, 18014398509481984, 36028797018963968,
+ 72057594037927936, 144115188075855872, 288230376151711744,
+ 576460752303423488, 1152921504606846976,
+ 2305843009213693952, 4611686018427387904,
+ 9223372036854775808
+ };
+ public static int Main() {
+ int i;
+ ulong val = 1;
+ ulong val17 = 131072;
+ ulong val33 = 8589934592;
+ ulong val39 = 549755813888;
+ ulong val47 = 140737488355328;
+ ulong val55 = 36028797018963968;
+
+ for (i = 0; i < values.Length; ++i) {
+ if (val != values [i])
+ return i+1;
+ val *= 2;
+ }
+ if (val33 != values [33])
+ return 1;
+ if (val39 != values [39])
+ return 2;
+ if (val47 != values [47])
+ return 3;
+ if (val55 != values [55])
+ return 4;
+ if (val17 != values [17])
+ return 5;
+
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/manualresetevents.cs b/mono/tests/manualresetevents.cs
new file mode 100755
index 00000000000..9c5b6981dda
--- /dev/null
+++ b/mono/tests/manualresetevents.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Threading;
+
+class EventTest
+{
+ public static ManualResetEvent e;
+
+ // Code for first thread
+ public static void ThreadMethod_waiter_1()
+ {
+ Console.WriteLine("[Thread A] - Started.....");
+ Console.WriteLine("[Thread A] - I'm before wait for event .....");
+ e.WaitOne();
+ Console.WriteLine("[Thread A] - I'm after wait for event.");
+ }
+
+ // Code for second thread
+ public static void ThreadMethod_waiter_2()
+ {
+ Console.WriteLine("[Thread B] - Started.....");
+ Console.WriteLine("[Thread B] - I'm before wait for event .....");
+ e.WaitOne();
+ Console.WriteLine("[Thread B] - I'm after wait for event.");
+ }
+
+ // Code for 3th thread
+ public static void ThreadMethod_blocker()
+ {
+ Console.WriteLine("[Thread C] - Started.....");
+ Console.WriteLine("[Thread C] - Sleeping for 5000ms....");
+ Thread.Sleep(5000);
+ Console.WriteLine("[Thread C] - Setting the event....");
+ e.Set();
+ Console.WriteLine("[Thread C] - Finished.....");
+ }
+
+
+ public static void Main()
+ {
+ e = new ManualResetEvent(false);
+
+
+ // Create the waiter thread's group
+ Console.WriteLine("[ Main ] - Creating first thread..");
+ ThreadStart Thread_1 = new ThreadStart(ThreadMethod_waiter_1);
+ ThreadStart Thread_2 = new ThreadStart(ThreadMethod_waiter_2);
+
+ // Create the blocker thread
+ Console.WriteLine("[ Main ] - Creating second thread..");
+ ThreadStart Thread_3 = new ThreadStart(ThreadMethod_blocker);
+
+ Thread A = new Thread(Thread_1);
+ Thread B = new Thread(Thread_2);
+ Thread C = new Thread(Thread_3);
+
+ A.Start();
+ B.Start();
+ C.Start();
+
+ Thread.Sleep(500);
+ Console.WriteLine("[ Main ] - Finish...");
+ }
+}
diff --git a/mono/tests/many-locals.cs b/mono/tests/many-locals.cs
new file mode 100644
index 00000000000..82470f770e1
--- /dev/null
+++ b/mono/tests/many-locals.cs
@@ -0,0 +1,427 @@
+namespace Simple {
+
+ public struct T {
+ private uint a;
+ private uint b;
+
+ public T (uint A, uint B) {
+ a = A;
+ b = B;
+ }
+ public uint A {
+ get {return a;}
+ }
+ public uint B {
+ get {return b;}
+ }
+ }
+
+ public class Test {
+ public static int Main() {
+ T loc0 = new T (0xdeadbeef, 0xcafebabe);
+ T loc1 = new T (0xdeadbeef, 0xcafebabe);
+ T loc2 = new T (0xdeadbeef, 0xcafebabe);
+ T loc3 = new T (0xdeadbeef, 0xcafebabe);
+ T loc4 = new T (0xdeadbeef, 0xcafebabe);
+ T loc5 = new T (0xdeadbeef, 0xcafebabe);
+ T loc6 = new T (0xdeadbeef, 0xcafebabe);
+ T loc7 = new T (0xdeadbeef, 0xcafebabe);
+ T loc8 = new T (0xdeadbeef, 0xcafebabe);
+ T loc9 = new T (0xdeadbeef, 0xcafebabe);
+ T loc10 = new T (0xdeadbeef, 0xcafebabe);
+ T loc11 = new T (0xdeadbeef, 0xcafebabe);
+ T loc12 = new T (0xdeadbeef, 0xcafebabe);
+ T loc13 = new T (0xdeadbeef, 0xcafebabe);
+ T loc14 = new T (0xdeadbeef, 0xcafebabe);
+ T loc15 = new T (0xdeadbeef, 0xcafebabe);
+ T loc16 = new T (0xdeadbeef, 0xcafebabe);
+ T loc17 = new T (0xdeadbeef, 0xcafebabe);
+ T loc18 = new T (0xdeadbeef, 0xcafebabe);
+ T loc19 = new T (0xdeadbeef, 0xcafebabe);
+ T loc20 = new T (0xdeadbeef, 0xcafebabe);
+ T loc21 = new T (0xdeadbeef, 0xcafebabe);
+ T loc22 = new T (0xdeadbeef, 0xcafebabe);
+ T loc23 = new T (0xdeadbeef, 0xcafebabe);
+ T loc24 = new T (0xdeadbeef, 0xcafebabe);
+ T loc25 = new T (0xdeadbeef, 0xcafebabe);
+ T loc26 = new T (0xdeadbeef, 0xcafebabe);
+ T loc27 = new T (0xdeadbeef, 0xcafebabe);
+ T loc28 = new T (0xdeadbeef, 0xcafebabe);
+ T loc29 = new T (0xdeadbeef, 0xcafebabe);
+ T loc30 = new T (0xdeadbeef, 0xcafebabe);
+ T loc31 = new T (0xdeadbeef, 0xcafebabe);
+ T loc32 = new T (0xdeadbeef, 0xcafebabe);
+ T loc33 = new T (0xdeadbeef, 0xcafebabe);
+ T loc34 = new T (0xdeadbeef, 0xcafebabe);
+ T loc35 = new T (0xdeadbeef, 0xcafebabe);
+ T loc36 = new T (0xdeadbeef, 0xcafebabe);
+ T loc37 = new T (0xdeadbeef, 0xcafebabe);
+ T loc38 = new T (0xdeadbeef, 0xcafebabe);
+ T loc39 = new T (0xdeadbeef, 0xcafebabe);
+ T loc40 = new T (0xdeadbeef, 0xcafebabe);
+ T loc41 = new T (0xdeadbeef, 0xcafebabe);
+ T loc42 = new T (0xdeadbeef, 0xcafebabe);
+ T loc43 = new T (0xdeadbeef, 0xcafebabe);
+ T loc44 = new T (0xdeadbeef, 0xcafebabe);
+ T loc45 = new T (0xdeadbeef, 0xcafebabe);
+ T loc46 = new T (0xdeadbeef, 0xcafebabe);
+ T loc47 = new T (0xdeadbeef, 0xcafebabe);
+ T loc48 = new T (0xdeadbeef, 0xcafebabe);
+ T loc49 = new T (0xdeadbeef, 0xcafebabe);
+ T loc50 = new T (0xdeadbeef, 0xcafebabe);
+ T loc51 = new T (0xdeadbeef, 0xcafebabe);
+ T loc52 = new T (0xdeadbeef, 0xcafebabe);
+ T loc53 = new T (0xdeadbeef, 0xcafebabe);
+ T loc54 = new T (0xdeadbeef, 0xcafebabe);
+ T loc55 = new T (0xdeadbeef, 0xcafebabe);
+ T loc56 = new T (0xdeadbeef, 0xcafebabe);
+ T loc57 = new T (0xdeadbeef, 0xcafebabe);
+ T loc58 = new T (0xdeadbeef, 0xcafebabe);
+ T loc59 = new T (0xdeadbeef, 0xcafebabe);
+ T loc60 = new T (0xdeadbeef, 0xcafebabe);
+ T loc61 = new T (0xdeadbeef, 0xcafebabe);
+ T loc62 = new T (0xdeadbeef, 0xcafebabe);
+ T loc63 = new T (0xdeadbeef, 0xcafebabe);
+ T loc64 = new T (0xdeadbeef, 0xcafebabe);
+ T loc65 = new T (0xdeadbeef, 0xcafebabe);
+ T loc66 = new T (0xdeadbeef, 0xcafebabe);
+ T loc67 = new T (0xdeadbeef, 0xcafebabe);
+ T loc68 = new T (0xdeadbeef, 0xcafebabe);
+ T loc69 = new T (0xdeadbeef, 0xcafebabe);
+ T loc70 = new T (0xdeadbeef, 0xcafebabe);
+ T loc71 = new T (0xdeadbeef, 0xcafebabe);
+ T loc72 = new T (0xdeadbeef, 0xcafebabe);
+ T loc73 = new T (0xdeadbeef, 0xcafebabe);
+ T loc74 = new T (0xdeadbeef, 0xcafebabe);
+ T loc75 = new T (0xdeadbeef, 0xcafebabe);
+ T loc76 = new T (0xdeadbeef, 0xcafebabe);
+ T loc77 = new T (0xdeadbeef, 0xcafebabe);
+ T loc78 = new T (0xdeadbeef, 0xcafebabe);
+ T loc79 = new T (0xdeadbeef, 0xcafebabe);
+ T loc80 = new T (0xdeadbeef, 0xcafebabe);
+ T loc81 = new T (0xdeadbeef, 0xcafebabe);
+ T loc82 = new T (0xdeadbeef, 0xcafebabe);
+ T loc83 = new T (0xdeadbeef, 0xcafebabe);
+ T loc84 = new T (0xdeadbeef, 0xcafebabe);
+ T loc85 = new T (0xdeadbeef, 0xcafebabe);
+ T loc86 = new T (0xdeadbeef, 0xcafebabe);
+ T loc87 = new T (0xdeadbeef, 0xcafebabe);
+ T loc88 = new T (0xdeadbeef, 0xcafebabe);
+ T loc89 = new T (0xdeadbeef, 0xcafebabe);
+ T loc90 = new T (0xdeadbeef, 0xcafebabe);
+ T loc91 = new T (0xdeadbeef, 0xcafebabe);
+ T loc92 = new T (0xdeadbeef, 0xcafebabe);
+ T loc93 = new T (0xdeadbeef, 0xcafebabe);
+ T loc94 = new T (0xdeadbeef, 0xcafebabe);
+ T loc95 = new T (0xdeadbeef, 0xcafebabe);
+ T loc96 = new T (0xdeadbeef, 0xcafebabe);
+ T loc97 = new T (0xdeadbeef, 0xcafebabe);
+ T loc98 = new T (0xdeadbeef, 0xcafebabe);
+ T loc99 = new T (0xdeadbeef, 0xcafebabe);
+ T loc100 = new T (0xdeadbeef, 0xcafebabe);
+ T loc101 = new T (0xdeadbeef, 0xcafebabe);
+ T loc102 = new T (0xdeadbeef, 0xcafebabe);
+ T loc103 = new T (0xdeadbeef, 0xcafebabe);
+ T loc104 = new T (0xdeadbeef, 0xcafebabe);
+ T loc105 = new T (0xdeadbeef, 0xcafebabe);
+ T loc106 = new T (0xdeadbeef, 0xcafebabe);
+ T loc107 = new T (0xdeadbeef, 0xcafebabe);
+ T loc108 = new T (0xdeadbeef, 0xcafebabe);
+ T loc109 = new T (0xdeadbeef, 0xcafebabe);
+ T loc110 = new T (0xdeadbeef, 0xcafebabe);
+ T loc111 = new T (0xdeadbeef, 0xcafebabe);
+ T loc112 = new T (0xdeadbeef, 0xcafebabe);
+ T loc113 = new T (0xdeadbeef, 0xcafebabe);
+ T loc114 = new T (0xdeadbeef, 0xcafebabe);
+ T loc115 = new T (0xdeadbeef, 0xcafebabe);
+ T loc116 = new T (0xdeadbeef, 0xcafebabe);
+ T loc117 = new T (0xdeadbeef, 0xcafebabe);
+ T loc118 = new T (0xdeadbeef, 0xcafebabe);
+ T loc119 = new T (0xdeadbeef, 0xcafebabe);
+ T loc120 = new T (0xdeadbeef, 0xcafebabe);
+ T loc121 = new T (0xdeadbeef, 0xcafebabe);
+ T loc122 = new T (0xdeadbeef, 0xcafebabe);
+ T loc123 = new T (0xdeadbeef, 0xcafebabe);
+ T loc124 = new T (0xdeadbeef, 0xcafebabe);
+ T loc125 = new T (0xdeadbeef, 0xcafebabe);
+ T loc126 = new T (0xdeadbeef, 0xcafebabe);
+ T loc127 = new T (0xdeadbeef, 0xcafebabe);
+ T loc128 = new T (0xdeadbeef, 0xcafebabe);
+ T loc129 = new T (0xdeadbeef, 0xcafebabe);
+ T loc130 = new T (0xdeadbeef, 0xcafebabe);
+ T loc131 = new T (0xdeadbeef, 0xcafebabe);
+ T loc132 = new T (0xdeadbeef, 0xcafebabe);
+ T loc133 = new T (0xdeadbeef, 0xcafebabe);
+ T loc134 = new T (0xdeadbeef, 0xcafebabe);
+ T loc135 = new T (0xdeadbeef, 0xcafebabe);
+ T loc136 = new T (0xdeadbeef, 0xcafebabe);
+ T loc137 = new T (0xdeadbeef, 0xcafebabe);
+ T loc138 = new T (0xdeadbeef, 0xcafebabe);
+ T loc139 = new T (0xdeadbeef, 0xcafebabe);
+ T loc140 = new T (0xdeadbeef, 0xcafebabe);
+ T loc141 = new T (0xdeadbeef, 0xcafebabe);
+ T loc142 = new T (0xdeadbeef, 0xcafebabe);
+ T loc143 = new T (0xdeadbeef, 0xcafebabe);
+ T loc144 = new T (0xdeadbeef, 0xcafebabe);
+ T loc145 = new T (0xdeadbeef, 0xcafebabe);
+ T loc146 = new T (0xdeadbeef, 0xcafebabe);
+ T loc147 = new T (0xdeadbeef, 0xcafebabe);
+ T loc148 = new T (0xdeadbeef, 0xcafebabe);
+ T loc149 = new T (0xdeadbeef, 0xcafebabe);
+ T loc150 = new T (0xdeadbeef, 0xcafebabe);
+ T loc151 = new T (0xdeadbeef, 0xcafebabe);
+ T loc152 = new T (0xdeadbeef, 0xcafebabe);
+ T loc153 = new T (0xdeadbeef, 0xcafebabe);
+ T loc154 = new T (0xdeadbeef, 0xcafebabe);
+ T loc155 = new T (0xdeadbeef, 0xcafebabe);
+ T loc156 = new T (0xdeadbeef, 0xcafebabe);
+ T loc157 = new T (0xdeadbeef, 0xcafebabe);
+ T loc158 = new T (0xdeadbeef, 0xcafebabe);
+ T loc159 = new T (0xdeadbeef, 0xcafebabe);
+ T loc160 = new T (0xdeadbeef, 0xcafebabe);
+ T loc161 = new T (0xdeadbeef, 0xcafebabe);
+ T loc162 = new T (0xdeadbeef, 0xcafebabe);
+ T loc163 = new T (0xdeadbeef, 0xcafebabe);
+ T loc164 = new T (0xdeadbeef, 0xcafebabe);
+ T loc165 = new T (0xdeadbeef, 0xcafebabe);
+ T loc166 = new T (0xdeadbeef, 0xcafebabe);
+ T loc167 = new T (0xdeadbeef, 0xcafebabe);
+ T loc168 = new T (0xdeadbeef, 0xcafebabe);
+ T loc169 = new T (0xdeadbeef, 0xcafebabe);
+ T loc170 = new T (0xdeadbeef, 0xcafebabe);
+ T loc171 = new T (0xdeadbeef, 0xcafebabe);
+ T loc172 = new T (0xdeadbeef, 0xcafebabe);
+ T loc173 = new T (0xdeadbeef, 0xcafebabe);
+ T loc174 = new T (0xdeadbeef, 0xcafebabe);
+ T loc175 = new T (0xdeadbeef, 0xcafebabe);
+ T loc176 = new T (0xdeadbeef, 0xcafebabe);
+ T loc177 = new T (0xdeadbeef, 0xcafebabe);
+ T loc178 = new T (0xdeadbeef, 0xcafebabe);
+ T loc179 = new T (0xdeadbeef, 0xcafebabe);
+ T loc180 = new T (0xdeadbeef, 0xcafebabe);
+ T loc181 = new T (0xdeadbeef, 0xcafebabe);
+ T loc182 = new T (0xdeadbeef, 0xcafebabe);
+ T loc183 = new T (0xdeadbeef, 0xcafebabe);
+ T loc184 = new T (0xdeadbeef, 0xcafebabe);
+ T loc185 = new T (0xdeadbeef, 0xcafebabe);
+ T loc186 = new T (0xdeadbeef, 0xcafebabe);
+ T loc187 = new T (0xdeadbeef, 0xcafebabe);
+ T loc188 = new T (0xdeadbeef, 0xcafebabe);
+ T loc189 = new T (0xdeadbeef, 0xcafebabe);
+ T loc190 = new T (0xdeadbeef, 0xcafebabe);
+ T loc191 = new T (0xdeadbeef, 0xcafebabe);
+ T loc192 = new T (0xdeadbeef, 0xcafebabe);
+ T loc193 = new T (0xdeadbeef, 0xcafebabe);
+ T loc194 = new T (0xdeadbeef, 0xcafebabe);
+ T loc195 = new T (0xdeadbeef, 0xcafebabe);
+ T loc196 = new T (0xdeadbeef, 0xcafebabe);
+ T loc197 = new T (0xdeadbeef, 0xcafebabe);
+ T loc198 = new T (0xdeadbeef, 0xcafebabe);
+ T loc199 = new T (0xdeadbeef, 0xcafebabe);
+
+ if (loc0.A != 0xdeadbeef || loc0.B != 0xcafebabe) throw new System.Exception ();
+ if (loc1.A != 0xdeadbeef || loc1.B != 0xcafebabe) throw new System.Exception();
+ if (loc2.A != 0xdeadbeef || loc2.B != 0xcafebabe) throw new System.Exception();
+ if (loc3.A != 0xdeadbeef || loc3.B != 0xcafebabe) throw new System.Exception();
+ if (loc4.A != 0xdeadbeef || loc4.B != 0xcafebabe) throw new System.Exception();
+ if (loc5.A != 0xdeadbeef || loc5.B != 0xcafebabe) throw new System.Exception();
+ if (loc6.A != 0xdeadbeef || loc6.B != 0xcafebabe) throw new System.Exception();
+ if (loc7.A != 0xdeadbeef || loc7.B != 0xcafebabe) throw new System.Exception();
+ if (loc8.A != 0xdeadbeef || loc8.B != 0xcafebabe) throw new System.Exception();
+ if (loc9.A != 0xdeadbeef || loc9.B != 0xcafebabe) throw new System.Exception();
+ if (loc10.A != 0xdeadbeef || loc10.B != 0xcafebabe) throw new System.Exception();
+ if (loc11.A != 0xdeadbeef || loc11.B != 0xcafebabe) throw new System.Exception();
+ if (loc12.A != 0xdeadbeef || loc12.B != 0xcafebabe) throw new System.Exception();
+ if (loc13.A != 0xdeadbeef || loc13.B != 0xcafebabe) throw new System.Exception();
+ if (loc14.A != 0xdeadbeef || loc14.B != 0xcafebabe) throw new System.Exception();
+ if (loc15.A != 0xdeadbeef || loc15.B != 0xcafebabe) throw new System.Exception();
+ if (loc16.A != 0xdeadbeef || loc16.B != 0xcafebabe) throw new System.Exception();
+ if (loc17.A != 0xdeadbeef || loc17.B != 0xcafebabe) throw new System.Exception();
+ if (loc18.A != 0xdeadbeef || loc18.B != 0xcafebabe) throw new System.Exception();
+ if (loc19.A != 0xdeadbeef || loc19.B != 0xcafebabe) throw new System.Exception();
+ if (loc20.A != 0xdeadbeef || loc20.B != 0xcafebabe) throw new System.Exception();
+ if (loc21.A != 0xdeadbeef || loc21.B != 0xcafebabe) throw new System.Exception();
+ if (loc22.A != 0xdeadbeef || loc22.B != 0xcafebabe) throw new System.Exception();
+ if (loc23.A != 0xdeadbeef || loc23.B != 0xcafebabe) throw new System.Exception();
+ if (loc24.A != 0xdeadbeef || loc24.B != 0xcafebabe) throw new System.Exception();
+ if (loc25.A != 0xdeadbeef || loc25.B != 0xcafebabe) throw new System.Exception();
+ if (loc26.A != 0xdeadbeef || loc26.B != 0xcafebabe) throw new System.Exception();
+ if (loc27.A != 0xdeadbeef || loc27.B != 0xcafebabe) throw new System.Exception();
+ if (loc28.A != 0xdeadbeef || loc28.B != 0xcafebabe) throw new System.Exception();
+ if (loc29.A != 0xdeadbeef || loc29.B != 0xcafebabe) throw new System.Exception();
+ if (loc30.A != 0xdeadbeef || loc30.B != 0xcafebabe) throw new System.Exception();
+ if (loc31.A != 0xdeadbeef || loc31.B != 0xcafebabe) throw new System.Exception();
+ if (loc32.A != 0xdeadbeef || loc32.B != 0xcafebabe) throw new System.Exception();
+ if (loc33.A != 0xdeadbeef || loc33.B != 0xcafebabe) throw new System.Exception();
+ if (loc34.A != 0xdeadbeef || loc34.B != 0xcafebabe) throw new System.Exception();
+ if (loc35.A != 0xdeadbeef || loc35.B != 0xcafebabe) throw new System.Exception();
+ if (loc36.A != 0xdeadbeef || loc36.B != 0xcafebabe) throw new System.Exception();
+ if (loc37.A != 0xdeadbeef || loc37.B != 0xcafebabe) throw new System.Exception();
+ if (loc38.A != 0xdeadbeef || loc38.B != 0xcafebabe) throw new System.Exception();
+ if (loc39.A != 0xdeadbeef || loc39.B != 0xcafebabe) throw new System.Exception();
+ if (loc40.A != 0xdeadbeef || loc40.B != 0xcafebabe) throw new System.Exception();
+ if (loc41.A != 0xdeadbeef || loc41.B != 0xcafebabe) throw new System.Exception();
+ if (loc42.A != 0xdeadbeef || loc42.B != 0xcafebabe) throw new System.Exception();
+ if (loc43.A != 0xdeadbeef || loc43.B != 0xcafebabe) throw new System.Exception();
+ if (loc44.A != 0xdeadbeef || loc44.B != 0xcafebabe) throw new System.Exception();
+ if (loc45.A != 0xdeadbeef || loc45.B != 0xcafebabe) throw new System.Exception();
+ if (loc46.A != 0xdeadbeef || loc46.B != 0xcafebabe) throw new System.Exception();
+ if (loc47.A != 0xdeadbeef || loc47.B != 0xcafebabe) throw new System.Exception();
+ if (loc48.A != 0xdeadbeef || loc48.B != 0xcafebabe) throw new System.Exception();
+ if (loc49.A != 0xdeadbeef || loc49.B != 0xcafebabe) throw new System.Exception();
+ if (loc50.A != 0xdeadbeef || loc50.B != 0xcafebabe) throw new System.Exception();
+ if (loc51.A != 0xdeadbeef || loc51.B != 0xcafebabe) throw new System.Exception();
+ if (loc52.A != 0xdeadbeef || loc52.B != 0xcafebabe) throw new System.Exception();
+ if (loc53.A != 0xdeadbeef || loc53.B != 0xcafebabe) throw new System.Exception();
+ if (loc54.A != 0xdeadbeef || loc54.B != 0xcafebabe) throw new System.Exception();
+ if (loc55.A != 0xdeadbeef || loc55.B != 0xcafebabe) throw new System.Exception();
+ if (loc56.A != 0xdeadbeef || loc56.B != 0xcafebabe) throw new System.Exception();
+ if (loc57.A != 0xdeadbeef || loc57.B != 0xcafebabe) throw new System.Exception();
+ if (loc58.A != 0xdeadbeef || loc58.B != 0xcafebabe) throw new System.Exception();
+ if (loc59.A != 0xdeadbeef || loc59.B != 0xcafebabe) throw new System.Exception();
+ if (loc60.A != 0xdeadbeef || loc60.B != 0xcafebabe) throw new System.Exception();
+ if (loc61.A != 0xdeadbeef || loc61.B != 0xcafebabe) throw new System.Exception();
+ if (loc62.A != 0xdeadbeef || loc62.B != 0xcafebabe) throw new System.Exception();
+ if (loc63.A != 0xdeadbeef || loc63.B != 0xcafebabe) throw new System.Exception();
+ if (loc64.A != 0xdeadbeef || loc64.B != 0xcafebabe) throw new System.Exception();
+ if (loc65.A != 0xdeadbeef || loc65.B != 0xcafebabe) throw new System.Exception();
+ if (loc66.A != 0xdeadbeef || loc66.B != 0xcafebabe) throw new System.Exception();
+ if (loc67.A != 0xdeadbeef || loc67.B != 0xcafebabe) throw new System.Exception();
+ if (loc68.A != 0xdeadbeef || loc68.B != 0xcafebabe) throw new System.Exception();
+ if (loc69.A != 0xdeadbeef || loc69.B != 0xcafebabe) throw new System.Exception();
+ if (loc70.A != 0xdeadbeef || loc70.B != 0xcafebabe) throw new System.Exception();
+ if (loc71.A != 0xdeadbeef || loc71.B != 0xcafebabe) throw new System.Exception();
+ if (loc72.A != 0xdeadbeef || loc72.B != 0xcafebabe) throw new System.Exception();
+ if (loc73.A != 0xdeadbeef || loc73.B != 0xcafebabe) throw new System.Exception();
+ if (loc74.A != 0xdeadbeef || loc74.B != 0xcafebabe) throw new System.Exception();
+ if (loc75.A != 0xdeadbeef || loc75.B != 0xcafebabe) throw new System.Exception();
+ if (loc76.A != 0xdeadbeef || loc76.B != 0xcafebabe) throw new System.Exception();
+ if (loc77.A != 0xdeadbeef || loc77.B != 0xcafebabe) throw new System.Exception();
+ if (loc78.A != 0xdeadbeef || loc78.B != 0xcafebabe) throw new System.Exception();
+ if (loc79.A != 0xdeadbeef || loc79.B != 0xcafebabe) throw new System.Exception();
+ if (loc80.A != 0xdeadbeef || loc80.B != 0xcafebabe) throw new System.Exception();
+ if (loc81.A != 0xdeadbeef || loc81.B != 0xcafebabe) throw new System.Exception();
+ if (loc82.A != 0xdeadbeef || loc82.B != 0xcafebabe) throw new System.Exception();
+ if (loc83.A != 0xdeadbeef || loc83.B != 0xcafebabe) throw new System.Exception();
+ if (loc84.A != 0xdeadbeef || loc84.B != 0xcafebabe) throw new System.Exception();
+ if (loc85.A != 0xdeadbeef || loc85.B != 0xcafebabe) throw new System.Exception();
+ if (loc86.A != 0xdeadbeef || loc86.B != 0xcafebabe) throw new System.Exception();
+ if (loc87.A != 0xdeadbeef || loc87.B != 0xcafebabe) throw new System.Exception();
+ if (loc88.A != 0xdeadbeef || loc88.B != 0xcafebabe) throw new System.Exception();
+ if (loc89.A != 0xdeadbeef || loc89.B != 0xcafebabe) throw new System.Exception();
+ if (loc90.A != 0xdeadbeef || loc90.B != 0xcafebabe) throw new System.Exception();
+ if (loc91.A != 0xdeadbeef || loc91.B != 0xcafebabe) throw new System.Exception();
+ if (loc92.A != 0xdeadbeef || loc92.B != 0xcafebabe) throw new System.Exception();
+ if (loc93.A != 0xdeadbeef || loc93.B != 0xcafebabe) throw new System.Exception();
+ if (loc94.A != 0xdeadbeef || loc94.B != 0xcafebabe) throw new System.Exception();
+ if (loc95.A != 0xdeadbeef || loc95.B != 0xcafebabe) throw new System.Exception();
+ if (loc96.A != 0xdeadbeef || loc96.B != 0xcafebabe) throw new System.Exception();
+ if (loc97.A != 0xdeadbeef || loc97.B != 0xcafebabe) throw new System.Exception();
+ if (loc98.A != 0xdeadbeef || loc98.B != 0xcafebabe) throw new System.Exception();
+ if (loc99.A != 0xdeadbeef || loc99.B != 0xcafebabe) throw new System.Exception();
+ if (loc100.A != 0xdeadbeef || loc100.B != 0xcafebabe) throw new System.Exception();
+ if (loc101.A != 0xdeadbeef || loc101.B != 0xcafebabe) throw new System.Exception();
+ if (loc102.A != 0xdeadbeef || loc102.B != 0xcafebabe) throw new System.Exception();
+ if (loc103.A != 0xdeadbeef || loc103.B != 0xcafebabe) throw new System.Exception();
+ if (loc104.A != 0xdeadbeef || loc104.B != 0xcafebabe) throw new System.Exception();
+ if (loc105.A != 0xdeadbeef || loc105.B != 0xcafebabe) throw new System.Exception();
+ if (loc106.A != 0xdeadbeef || loc106.B != 0xcafebabe) throw new System.Exception();
+ if (loc107.A != 0xdeadbeef || loc107.B != 0xcafebabe) throw new System.Exception();
+ if (loc108.A != 0xdeadbeef || loc108.B != 0xcafebabe) throw new System.Exception();
+ if (loc109.A != 0xdeadbeef || loc109.B != 0xcafebabe) throw new System.Exception();
+ if (loc110.A != 0xdeadbeef || loc110.B != 0xcafebabe) throw new System.Exception();
+ if (loc111.A != 0xdeadbeef || loc111.B != 0xcafebabe) throw new System.Exception();
+ if (loc112.A != 0xdeadbeef || loc112.B != 0xcafebabe) throw new System.Exception();
+ if (loc113.A != 0xdeadbeef || loc113.B != 0xcafebabe) throw new System.Exception();
+ if (loc114.A != 0xdeadbeef || loc114.B != 0xcafebabe) throw new System.Exception();
+ if (loc115.A != 0xdeadbeef || loc115.B != 0xcafebabe) throw new System.Exception();
+ if (loc116.A != 0xdeadbeef || loc116.B != 0xcafebabe) throw new System.Exception();
+ if (loc117.A != 0xdeadbeef || loc117.B != 0xcafebabe) throw new System.Exception();
+ if (loc118.A != 0xdeadbeef || loc118.B != 0xcafebabe) throw new System.Exception();
+ if (loc119.A != 0xdeadbeef || loc119.B != 0xcafebabe) throw new System.Exception();
+ if (loc120.A != 0xdeadbeef || loc120.B != 0xcafebabe) throw new System.Exception();
+ if (loc121.A != 0xdeadbeef || loc121.B != 0xcafebabe) throw new System.Exception();
+ if (loc122.A != 0xdeadbeef || loc122.B != 0xcafebabe) throw new System.Exception();
+ if (loc123.A != 0xdeadbeef || loc123.B != 0xcafebabe) throw new System.Exception();
+ if (loc124.A != 0xdeadbeef || loc124.B != 0xcafebabe) throw new System.Exception();
+ if (loc125.A != 0xdeadbeef || loc125.B != 0xcafebabe) throw new System.Exception();
+ if (loc126.A != 0xdeadbeef || loc126.B != 0xcafebabe) throw new System.Exception();
+ if (loc127.A != 0xdeadbeef || loc127.B != 0xcafebabe) throw new System.Exception();
+ if (loc128.A != 0xdeadbeef || loc128.B != 0xcafebabe) throw new System.Exception();
+ if (loc129.A != 0xdeadbeef || loc129.B != 0xcafebabe) throw new System.Exception();
+ if (loc130.A != 0xdeadbeef || loc130.B != 0xcafebabe) throw new System.Exception();
+ if (loc131.A != 0xdeadbeef || loc131.B != 0xcafebabe) throw new System.Exception();
+ if (loc132.A != 0xdeadbeef || loc132.B != 0xcafebabe) throw new System.Exception();
+ if (loc133.A != 0xdeadbeef || loc133.B != 0xcafebabe) throw new System.Exception();
+ if (loc134.A != 0xdeadbeef || loc134.B != 0xcafebabe) throw new System.Exception();
+ if (loc135.A != 0xdeadbeef || loc135.B != 0xcafebabe) throw new System.Exception();
+ if (loc136.A != 0xdeadbeef || loc136.B != 0xcafebabe) throw new System.Exception();
+ if (loc137.A != 0xdeadbeef || loc137.B != 0xcafebabe) throw new System.Exception();
+ if (loc138.A != 0xdeadbeef || loc138.B != 0xcafebabe) throw new System.Exception();
+ if (loc139.A != 0xdeadbeef || loc139.B != 0xcafebabe) throw new System.Exception();
+ if (loc140.A != 0xdeadbeef || loc140.B != 0xcafebabe) throw new System.Exception();
+ if (loc141.A != 0xdeadbeef || loc141.B != 0xcafebabe) throw new System.Exception();
+ if (loc142.A != 0xdeadbeef || loc142.B != 0xcafebabe) throw new System.Exception();
+ if (loc143.A != 0xdeadbeef || loc143.B != 0xcafebabe) throw new System.Exception();
+ if (loc144.A != 0xdeadbeef || loc144.B != 0xcafebabe) throw new System.Exception();
+ if (loc145.A != 0xdeadbeef || loc145.B != 0xcafebabe) throw new System.Exception();
+ if (loc146.A != 0xdeadbeef || loc146.B != 0xcafebabe) throw new System.Exception();
+ if (loc147.A != 0xdeadbeef || loc147.B != 0xcafebabe) throw new System.Exception();
+ if (loc148.A != 0xdeadbeef || loc148.B != 0xcafebabe) throw new System.Exception();
+ if (loc149.A != 0xdeadbeef || loc149.B != 0xcafebabe) throw new System.Exception();
+ if (loc150.A != 0xdeadbeef || loc150.B != 0xcafebabe) throw new System.Exception();
+ if (loc151.A != 0xdeadbeef || loc151.B != 0xcafebabe) throw new System.Exception();
+ if (loc152.A != 0xdeadbeef || loc152.B != 0xcafebabe) throw new System.Exception();
+ if (loc153.A != 0xdeadbeef || loc153.B != 0xcafebabe) throw new System.Exception();
+ if (loc154.A != 0xdeadbeef || loc154.B != 0xcafebabe) throw new System.Exception();
+ if (loc155.A != 0xdeadbeef || loc155.B != 0xcafebabe) throw new System.Exception();
+ if (loc156.A != 0xdeadbeef || loc156.B != 0xcafebabe) throw new System.Exception();
+ if (loc157.A != 0xdeadbeef || loc157.B != 0xcafebabe) throw new System.Exception();
+ if (loc158.A != 0xdeadbeef || loc158.B != 0xcafebabe) throw new System.Exception();
+ if (loc159.A != 0xdeadbeef || loc159.B != 0xcafebabe) throw new System.Exception();
+ if (loc160.A != 0xdeadbeef || loc160.B != 0xcafebabe) throw new System.Exception();
+ if (loc161.A != 0xdeadbeef || loc161.B != 0xcafebabe) throw new System.Exception();
+ if (loc162.A != 0xdeadbeef || loc162.B != 0xcafebabe) throw new System.Exception();
+ if (loc163.A != 0xdeadbeef || loc163.B != 0xcafebabe) throw new System.Exception();
+ if (loc164.A != 0xdeadbeef || loc164.B != 0xcafebabe) throw new System.Exception();
+ if (loc165.A != 0xdeadbeef || loc165.B != 0xcafebabe) throw new System.Exception();
+ if (loc166.A != 0xdeadbeef || loc166.B != 0xcafebabe) throw new System.Exception();
+ if (loc167.A != 0xdeadbeef || loc167.B != 0xcafebabe) throw new System.Exception();
+ if (loc168.A != 0xdeadbeef || loc168.B != 0xcafebabe) throw new System.Exception();
+ if (loc169.A != 0xdeadbeef || loc169.B != 0xcafebabe) throw new System.Exception();
+ if (loc170.A != 0xdeadbeef || loc170.B != 0xcafebabe) throw new System.Exception();
+ if (loc171.A != 0xdeadbeef || loc171.B != 0xcafebabe) throw new System.Exception();
+ if (loc172.A != 0xdeadbeef || loc172.B != 0xcafebabe) throw new System.Exception();
+ if (loc173.A != 0xdeadbeef || loc173.B != 0xcafebabe) throw new System.Exception();
+ if (loc174.A != 0xdeadbeef || loc174.B != 0xcafebabe) throw new System.Exception();
+ if (loc175.A != 0xdeadbeef || loc175.B != 0xcafebabe) throw new System.Exception();
+ if (loc176.A != 0xdeadbeef || loc176.B != 0xcafebabe) throw new System.Exception();
+ if (loc177.A != 0xdeadbeef || loc177.B != 0xcafebabe) throw new System.Exception();
+ if (loc178.A != 0xdeadbeef || loc178.B != 0xcafebabe) throw new System.Exception();
+ if (loc179.A != 0xdeadbeef || loc179.B != 0xcafebabe) throw new System.Exception();
+ if (loc180.A != 0xdeadbeef || loc180.B != 0xcafebabe) throw new System.Exception();
+ if (loc181.A != 0xdeadbeef || loc181.B != 0xcafebabe) throw new System.Exception();
+ if (loc182.A != 0xdeadbeef || loc182.B != 0xcafebabe) throw new System.Exception();
+ if (loc183.A != 0xdeadbeef || loc183.B != 0xcafebabe) throw new System.Exception();
+ if (loc184.A != 0xdeadbeef || loc184.B != 0xcafebabe) throw new System.Exception();
+ if (loc185.A != 0xdeadbeef || loc185.B != 0xcafebabe) throw new System.Exception();
+ if (loc186.A != 0xdeadbeef || loc186.B != 0xcafebabe) throw new System.Exception();
+ if (loc187.A != 0xdeadbeef || loc187.B != 0xcafebabe) throw new System.Exception();
+ if (loc188.A != 0xdeadbeef || loc188.B != 0xcafebabe) throw new System.Exception();
+ if (loc189.A != 0xdeadbeef || loc189.B != 0xcafebabe) throw new System.Exception();
+ if (loc190.A != 0xdeadbeef || loc190.B != 0xcafebabe) throw new System.Exception();
+ if (loc191.A != 0xdeadbeef || loc191.B != 0xcafebabe) throw new System.Exception();
+ if (loc192.A != 0xdeadbeef || loc192.B != 0xcafebabe) throw new System.Exception();
+ if (loc193.A != 0xdeadbeef || loc193.B != 0xcafebabe) throw new System.Exception();
+ if (loc194.A != 0xdeadbeef || loc194.B != 0xcafebabe) throw new System.Exception();
+ if (loc195.A != 0xdeadbeef || loc195.B != 0xcafebabe) throw new System.Exception();
+ if (loc196.A != 0xdeadbeef || loc196.B != 0xcafebabe) throw new System.Exception();
+ if (loc197.A != 0xdeadbeef || loc197.B != 0xcafebabe) throw new System.Exception();
+ if (loc198.A != 0xdeadbeef || loc198.B != 0xcafebabe) throw new System.Exception();
+ if (loc199.A != 0xdeadbeef || loc199.B != 0xcafebabe) throw new System.Exception();
+
+
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/mis.cs b/mono/tests/mis.cs
new file mode 100755
index 00000000000..d6bb5b22a8c
--- /dev/null
+++ b/mono/tests/mis.cs
@@ -0,0 +1,247 @@
+
+using System.Net;
+using System.Net.Sockets;
+using System.IO;
+using System;
+using System.Text;
+using System.Collections;
+
+namespace T {
+ public class T {
+
+ private static String docroot="/home/dick/mono/install/html";
+ //private static String docroot="./";
+
+ private static Hashtable mime_types = new Hashtable();
+
+ private static Socket NetSetup() {
+ Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ s.Bind(new IPEndPoint(IPAddress.Any, 8000));
+
+ Console.WriteLine("Listening on " + s.LocalEndPoint.ToString());
+
+ s.Listen(5);
+
+ return(s);
+ }
+
+ private static String NetRead(Socket sock) {
+ byte[] buf=new byte[256];
+
+ int count=sock.Receive(buf);
+
+ // Supply the length because otherwise I get a
+ // string of 260-odd chars instead of 30 for some reason
+ String req=new String(Encoding.UTF8.GetChars(buf), 0, count);
+ return(req);
+ }
+
+ private static void NetWrite(Socket sock, String data) {
+ byte[] buf=new UTF8Encoding().GetBytes(data);
+
+ sock.Send(buf);
+ }
+
+ private static void ReplyHeaders(Socket sock, int code,
+ String detail,
+ String content_type,
+ String content_opt,
+ long content_length) {
+ NetWrite(sock, "HTTP/1.0 " + code + " " + detail + "\r\n");
+ NetWrite(sock, "Date: Sat, 12 Jan 2002 01:52:56 GMT\r\n");
+ NetWrite(sock, "Server: MIS\r\n");
+ NetWrite(sock, "Last-Modified: Sat, 12 Jan 2002 01:52:56 GMT\r\n");
+ NetWrite(sock, "Connection: close\r\n");
+ if(content_length>0) {
+ NetWrite(sock, "Content-Length: " + content_length + "\r\n");
+ }
+ NetWrite(sock, "Content-type: " + content_type);
+ if(content_opt!=null) {
+ NetWrite(sock, "; " + content_opt);
+ }
+ NetWrite(sock, "\r\n");
+ NetWrite(sock, "\r\n");
+ }
+
+ private static void NotFound(Socket sock) {
+ ReplyHeaders(sock, 404, "Not Found", "text/html",
+ "charset=iso-8859-1", 0);
+ NetWrite(sock, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n");
+ NetWrite(sock, "<HTML><HEAD>\r\n");
+ NetWrite(sock, "<TITLE>404 Not Found</TITLE>\r\n");
+ NetWrite(sock, "</HEAD><BODY>\r\n");
+ NetWrite(sock, "<H1>Not Found</H1>\r\n");
+ NetWrite(sock, "</BODY></HTML>\r\n");
+ }
+
+ static void GetHeaders(out String req, out String[] headers,
+ String data, Socket sock) {
+ // First, find the \r\n denoting the end of the
+ // request line
+ int pos=data.IndexOf("\r\n");
+ while(pos==-1) {
+ Console.WriteLine("Couldn't isolate request");
+ data=data+NetRead(sock);
+ pos=data.IndexOf("\r\n");
+ }
+
+ req=data.Remove(pos, data.Length-pos);
+
+ // We've isolated the request line, now get the headers
+
+ // Make sure we have all the headers
+ pos=data.IndexOf("\r\n\r\n");
+ while(pos==-1) {
+ //Console.WriteLine("Didn't read all the headers");
+ data=data+NetRead(sock);
+ pos=data.IndexOf("\r\n\r\n");
+ }
+
+ String hdr=data.Remove(0, req.Length+2);
+ headers=hdr.Split(new char[]{'\r', '\n'});
+ }
+
+ private static void Get(Socket sock, String data) {
+ String req;
+ String[] headers;
+
+ GetHeaders(out req, out headers, data, sock);
+ for(int i=0; i<headers.Length; i++) {
+ if(headers[i].StartsWith("User-Agent: ")) {
+ Console.WriteLine(headers[i]);
+ }
+ }
+
+ // Remove the method, and prepend the docroot
+ req=String.Concat(docroot, req.Remove(0, 4));
+
+ // Trim the trailing protocol info
+ int pos=req.IndexOfAny(new char[]{' '});
+ if(pos>=0) {
+ req=req.Remove(pos, req.Length-pos);
+ }
+
+ pos=req.LastIndexOf('.');
+ String filetype;
+ if (pos != -1)
+ filetype = req.Substring(pos);
+ else
+ filetype = "";
+
+
+
+ string mime_type = (string) mime_types [filetype];
+ if (mime_type == null)
+ mime_type = "text/plain";
+
+ Console.WriteLine("File is " + req);
+ Console.WriteLine("Mime type is " + mime_type);
+
+ try {
+ FileStream f=new FileStream(req, FileMode.Open, FileAccess.Read);
+ byte[] fbuf=new byte[256];
+
+ ReplyHeaders(sock, 200, "OK",
+ mime_type,
+ null, f.Length);
+
+ int count;
+ while((count=f.Read(fbuf, 0, 256))>0) {
+ // Specify amount, so the last
+ // block doesnt send extra crud at
+ // the end
+ sock.Send(fbuf, count, SocketFlags.None);
+ }
+
+ f.Close();
+ } catch(FileNotFoundException) {
+ Console.WriteLine("File not found");
+ NotFound(sock);
+ } catch(IOException) {
+ Console.WriteLine("IO error");
+ NotFound(sock);
+ }
+ }
+
+ private static void Head(Socket sock, String data) {
+ String req;
+ String[] headers;
+
+ GetHeaders(out req, out headers, data, sock);
+ for(int i=0; i<headers.Length; i++) {
+ if(headers[i].StartsWith("User-Agent: ")) {
+ Console.WriteLine(headers[i]);
+ }
+ }
+
+ // Remove the method, and prepend the docroot
+ req=String.Concat(docroot, req.Remove(0, 5));
+
+ // Trim the trailing protocol info
+ int pos=req.IndexOfAny(new char[]{' '});
+ if(pos>=0) {
+ req=req.Remove(pos, req.Length-pos);
+ }
+
+ pos=req.LastIndexOf('.');
+ string filetype;
+ if (pos != -1)
+ filetype=req.Substring(pos);
+ else
+ filetype = "";
+
+ string mime_type = (string) mime_types [filetype];
+ if (mime_type == null)
+ mime_type = "text/plain";
+ Console.WriteLine("File is " + req);
+ Console.WriteLine("Mime type is " + mime_type);
+
+ try {
+ FileStream f=new FileStream(req, FileMode.Open, FileAccess.Read);
+ byte[] fbuf=new byte[256];
+
+ ReplyHeaders(sock, 200, "OK",
+ mime_type,
+ null, f.Length);
+
+ f.Close();
+ } catch(FileNotFoundException) {
+ Console.WriteLine("File not found");
+ NotFound(sock);
+ } catch(IOException) {
+ Console.WriteLine("IO error");
+ NotFound(sock);
+ }
+ }
+
+ public static int Main (string [] args) {
+ // Set up mime types
+ mime_types.Add(".html", "text/html");
+ mime_types.Add(".jpeg", "image/jpeg");
+ mime_types.Add(".png", "image/png");
+ mime_types.Add(".cs", "text/plain");
+
+ if (args.Length == 2 && args [0] == "--root"){
+ docroot = args [1];
+ }
+
+ Socket s=NetSetup();
+
+ while(true) {
+ Socket newsock=s.Accept();
+ String req=NetRead(newsock);
+
+ if(String.Compare(req, 0, "GET ", 0, 4)==0) {
+ Get(newsock, req);
+ } else if(String.Compare(req, 0, "HEAD ", 0, 5)==0) {
+ Head(newsock, req);
+ } else {
+ Console.WriteLine("Unknown method!");
+ Console.WriteLine("[" + req + "]");
+ }
+
+ newsock.Close();
+ }
+ }
+ }
+}
diff --git a/mono/tests/mutexes.cs b/mono/tests/mutexes.cs
new file mode 100644
index 00000000000..94af84160cf
--- /dev/null
+++ b/mono/tests/mutexes.cs
@@ -0,0 +1,87 @@
+/////////////////////////////////// Test Overview ////////////////////////////////
+//
+// Two threads are started from Main, which allocates 10 static mutexes.
+// The first thread locks each mutex in turn, with a delay of 2000ms between
+// locks.
+// The second thread recursively locks mutex no. 5 10 times, blocking the
+// progress of the first thread as this second thread has a delay of 4500ms
+// between each lock.When the second thread has called ReleaseMutex on the mutex 10
+// times it terminates and the first thread can carry on its cycle of locking and
+// releasing mutexes until it exits.
+//
+/////////////////////////////////////////////////////////////////////////////////
+
+
+using System;
+using System.Threading;
+
+class MutexTest
+{
+ public static Mutex[] m;
+
+ // Code for first thread
+ public static void ThreadMethod_A()
+ {
+ Console.WriteLine("[Thread A] - Started.....");
+
+ for (int i=0;i<10;i++)
+ {
+ Console.WriteLine("[Thread A] - Trying to lock mutex "+i+"...");
+ m[i].WaitOne();
+ Console.WriteLine("[Thread A] - m["+i+"] Locked!");
+ Console.WriteLine("[Thread A] - Now using mutex ["+i+"]");
+ Thread.Sleep(2000);
+ m[i].ReleaseMutex();
+ Console.WriteLine("[Thread A] - Unlocked the mutex ["+i+"]");
+ }
+
+ Console.WriteLine("[Thread A] - exiting.....");
+ }
+
+ // Code for second thread
+ public static void ThreadMethod_B()
+ {
+ Console.WriteLine("[Thread B] - Started.....");
+
+ for (int h=0;h<10;h++)
+ {
+ int i=5;
+ Console.WriteLine("[Thread B] - Trying to lock mutex "+i+" for "+h+" time...");
+ m[i].WaitOne();
+ Console.WriteLine("[Thread B] - m["+i+"] Locked recursively ["+h+"] times!");
+ Thread.Sleep(4500);
+ }
+ for (int h=0;h<10;h++)
+ {
+ int i=5;
+ m[i].ReleaseMutex();
+ Console.WriteLine("[Thread B] - Unlocked the mutex ["+i+"] for ["+h+"] times");
+ }
+
+ Console.WriteLine("[Thread B] - Finished.....");
+ }
+
+
+ public static void Main()
+ {
+ m = new Mutex[10];
+ for (int i = 0 ; i<10 ; i++ )
+ m[i] = new Mutex();
+
+ // Create the first thread
+ Console.WriteLine("[ Main ] - Creating first thread..");
+ ThreadStart Thread_1 = new ThreadStart(ThreadMethod_A);
+
+ // Create the second thread
+ Console.WriteLine("[ Main ] - Creating second thread..");
+ ThreadStart Thread_2 = new ThreadStart(ThreadMethod_B);
+
+ Thread A = new Thread(Thread_1);
+ Thread B = new Thread(Thread_2);
+ A.Start();
+ B.Start();
+
+ Thread.Sleep(500);
+ Console.WriteLine("[ Main ] - Test Ended");
+ }
+}
diff --git a/mono/tests/nested-loops.cs b/mono/tests/nested-loops.cs
new file mode 100755
index 00000000000..4475ab7d715
--- /dev/null
+++ b/mono/tests/nested-loops.cs
@@ -0,0 +1,31 @@
+
+public class NestedLoop {
+ static public int Main() {
+ int n = 16;
+ int x = 0;
+ int a = n;
+ while (a-- != 0) {
+ int b = n;
+ while (b-- != 0) {
+ int c = n;
+ while (c-- != 0) {
+ int d = n;
+ while (d-- != 0) {
+ int e = n;
+ while (e-- != 0) {
+ int f = n;
+ while (f-- != 0) {
+ x++;
+ }
+ }
+ }
+ }
+ }
+ }
+ if (x != 16777216)
+ return 1;
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/newobj-valuetype.cs b/mono/tests/newobj-valuetype.cs
new file mode 100644
index 00000000000..9cc5de2b0d1
--- /dev/null
+++ b/mono/tests/newobj-valuetype.cs
@@ -0,0 +1,21 @@
+
+namespace Test {
+ public struct Struct {
+ public int a;
+
+ public Struct (int val) {
+ a = val;
+ }
+
+ public static int Main () {
+ object o = new Struct (1);
+ Struct s = new Struct (2);
+
+ if (s.a != 2)
+ return 1;
+ if (((Struct)o).a != 1)
+ return 2;
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/nonvirt.cs b/mono/tests/nonvirt.cs
new file mode 100755
index 00000000000..e45bf5af76a
--- /dev/null
+++ b/mono/tests/nonvirt.cs
@@ -0,0 +1,22 @@
+using System;
+
+public class TestObj {
+
+ public int amethod () {
+ return 1;
+ }
+
+ public static int Main () {
+ TestObj obj = null;
+
+ try {
+ obj.amethod ();
+ } catch (NullReferenceException) {
+ return 0;
+ }
+
+ return 1;
+ }
+}
+
+
diff --git a/mono/tests/obj.cs b/mono/tests/obj.cs
new file mode 100755
index 00000000000..84bba6ea4b0
--- /dev/null
+++ b/mono/tests/obj.cs
@@ -0,0 +1,30 @@
+using System;
+
+public class TestObj {
+ static public int sbah = 5;
+ public int bah = 1;
+ public int boh;
+
+ public TestObj () {
+ boh = 2;
+ }
+ public int amethod () {
+ return boh;
+ }
+ public static int Main () {
+ TestObj obj = new TestObj ();
+ TestObj clone;
+
+ if (sbah + obj.bah + obj.amethod () != 8)
+ return 1;
+
+ clone = (TestObj)obj.MemberwiseClone ();
+
+ if (clone.boh != 2)
+ return 1;
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/outparm.cs b/mono/tests/outparm.cs
new file mode 100755
index 00000000000..b7f9d3db150
--- /dev/null
+++ b/mono/tests/outparm.cs
@@ -0,0 +1,21 @@
+public class OutParm {
+
+ public static void out_param (out int n) {
+ n = 1;
+ }
+ public static void ref_param (ref int n) {
+ n += 2;
+ }
+ public static int Main () {
+ int n = 0;
+ out_param (out n);
+ if (n != 1)
+ return 1;
+ ref_param (ref n);
+ if (n != 3)
+ return 2;
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/params.cs b/mono/tests/params.cs
new file mode 100644
index 00000000000..b405df075ca
--- /dev/null
+++ b/mono/tests/params.cs
@@ -0,0 +1,22 @@
+using System;
+
+public class T {
+
+ static public void method (int nargs, string arg) {
+ int i;
+ Console.WriteLine ("Got single arg "+arg);
+ }
+ static public void method (int nargs, params string[] args) {
+ int i;
+ Console.Write ("Got "+nargs.ToString()+" args ");
+ Console.WriteLine ("("+args.Length.ToString()+"):");
+ for (i = 0; i < nargs; ++i)
+ Console.WriteLine (args [i]);
+ }
+ public static int Main() {
+ method (1, "hello");
+ method (2, "hello", "World");
+ method (3, "hello", "World", "blah");
+ return 0;
+ }
+}
diff --git a/mono/tests/pinvoke.cs b/mono/tests/pinvoke.cs
new file mode 100755
index 00000000000..81e4c13ea14
--- /dev/null
+++ b/mono/tests/pinvoke.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Runtime.InteropServices;
+
+public class Test {
+
+ [DllImport("cygwin1.dll", EntryPoint="puts", CharSet=CharSet.Ansi)]
+ public static extern int puts (string name);
+
+ [DllImport ("libtest.so", EntryPoint="mono_test_many_int_arguments")]
+ public static extern int mono_test_many_int_arguments (int a, int b, int c, int d, int e,
+ int f, int g, int h, int i, int j);
+ [DllImport ("libtest.so", EntryPoint="mono_test_many_short_arguments")]
+ public static extern int mono_test_many_short_arguments (short a, short b, short c, short d, short e,
+ short f, short g, short h, short i, short j);
+ [DllImport ("libtest.so", EntryPoint="mono_test_many_byte_arguments")]
+ public static extern int mono_test_many_byte_arguments (byte a, byte b, byte c, byte d, byte e,
+ byte f, byte g, byte h, byte i, byte j);
+
+ public static int Main () {
+ puts ("A simple Test for PInvoke");
+
+ if (Math.Cos (Math.PI) != -1)
+ return 1;
+ if (Math.Acos (1) != 0)
+ return 1;
+ if (mono_test_many_int_arguments (1, 1, 1, 1, 1, 1, 1, 1, 1, 1) != 10)
+ return 1;
+ if (mono_test_many_short_arguments (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) != 55)
+ return 1;
+ if (mono_test_many_byte_arguments (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) != 55)
+ return 1;
+
+ return 0;
+ }
+}
diff --git a/mono/tests/pinvoke1.cs b/mono/tests/pinvoke1.cs
new file mode 100755
index 00000000000..8e95d35461b
--- /dev/null
+++ b/mono/tests/pinvoke1.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+public class T {
+
+ public virtual object MyClone ()
+ {
+ return null;
+ }
+
+}
+
+public class Test : T {
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public override extern object MyClone ();
+
+ delegate int MyDelegate (string name);
+
+ [DllImport ("libtest.so", EntryPoint="mono_test_puts_static")]
+ public static extern int puts_static (string name);
+
+ public static int Main () {
+ puts_static ("A simple Test for PInvoke 1");
+
+ MyDelegate d = new MyDelegate (puts_static);
+ d ("A simple Test for PInvoke 2");
+
+ object [] args = {"A simple Test for PInvoke 3"};
+ d.DynamicInvoke (args);
+
+ int noimpl = 0;
+ try {
+ Test X = new Test ();
+ X.MyClone ();
+ } catch {
+ noimpl = 1;
+ }
+
+ if (noimpl == 0)
+ return 1;
+
+ return 0;
+ }
+}
diff --git a/mono/tests/pointer.cs b/mono/tests/pointer.cs
new file mode 100644
index 00000000000..3cf97d2f959
--- /dev/null
+++ b/mono/tests/pointer.cs
@@ -0,0 +1,33 @@
+using System;
+
+public class Test {
+
+ public static IntPtr to_intptr (int value)
+ {
+ return new IntPtr (value);
+ }
+
+ unsafe public static int Main () {
+ int num = 0;
+
+ num++;
+ IntPtr a = to_intptr (1);
+ if ((int)a != 1)
+ return num;
+
+ num++;
+ if (sizeof (void*) != 4)
+ return num;
+
+ num++;
+ if (sizeof (byte*) != 4)
+ return num;
+
+ num++;
+ if (sizeof (int*) != 4)
+ return num;
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/pop.cs b/mono/tests/pop.cs
new file mode 100644
index 00000000000..decdf64927d
--- /dev/null
+++ b/mono/tests/pop.cs
@@ -0,0 +1,25 @@
+class pop_test {
+
+ public static int t = 4;
+
+ static int f ()
+ {
+ t = 0;
+
+ return 1;
+ }
+
+ static int Main ()
+ {
+ if (t != 4)
+ return 1;
+
+ // we ignore the return value - the compiler emits a pop
+ f ();
+
+ if (t != 0)
+ return 1;
+
+ return 0;
+ }
+}
diff --git a/mono/tests/property.cs b/mono/tests/property.cs
new file mode 100755
index 00000000000..91d1857d3af
--- /dev/null
+++ b/mono/tests/property.cs
@@ -0,0 +1,25 @@
+using System;
+
+public class TestProp {
+
+ private int my_prop;
+
+ public int MyProp {
+ get {return my_prop;}
+ set {my_prop = value;}
+ }
+
+ public TestProp (int v) {
+ my_prop = v;
+ }
+
+ public static int Main() {
+ TestProp p = new TestProp (2);
+ if (p.MyProp != 2)
+ return 1;
+ p.MyProp = 54;
+ if (p.MyProp != 54)
+ return 2;
+ return 0;
+ }
+}
diff --git a/mono/tests/random.cs b/mono/tests/random.cs
new file mode 100755
index 00000000000..004046c9765
--- /dev/null
+++ b/mono/tests/random.cs
@@ -0,0 +1,21 @@
+
+public class GenRandom {
+ static int last = 42;
+
+ public static double gen_random(double max) {
+
+ last = (last * 3877 + 29573) % 139968;
+ return( max * last / 139968 );
+ }
+
+ public static int Main() {
+ int N = 900000;
+ double result = 0;
+
+ while (N-- != 0) {
+ result = gen_random(100.0);
+ }
+ //printf("%.9f\n", result);
+ return(0);
+ }
+}
diff --git a/mono/tests/reflection-enum.cs b/mono/tests/reflection-enum.cs
new file mode 100644
index 00000000000..e4496eaa11f
--- /dev/null
+++ b/mono/tests/reflection-enum.cs
@@ -0,0 +1,44 @@
+using System.Reflection;
+using System;
+
+namespace Test {
+ public class T {
+ public static int Main(string[] args) {
+ string defaultn = "System.Reflection.ParameterAttributes";
+ string name = defaultn;
+ int verbose = 0;
+ foreach (string arg in args) {
+ if (arg == "-v")
+ verbose = 1;
+ else
+ name = arg;
+ }
+ Type t = Type.GetType (name);
+ Array values = Enum.GetValues (t);
+ string[] names = Enum.GetNames (t);
+ int i;
+
+ if (verbose != 0) {
+ Console.WriteLine ("Enum "+t.Name);
+ for (i = 0; i < names.Length; ++i) {
+ Console.WriteLine (names [i] + " = " + ((int)values.GetValue(i)).ToString());
+ }
+ }
+ if (name == defaultn) {
+ string[] truenames = {"None", "In", "Out", "Lcid", "Retval",
+ "Optional", "HasDefault", "HasFieldMarshal",
+ "Reserved3", "Reserved4", "ReservedMask"};
+ int[] truevalues = {0, 1, 2, 4, 8, 16, 4096, 8192,
+ 16384, 32768, 61440};
+
+ for (i = 0; i < names.Length; ++i) {
+ if (names [i] != truenames [i])
+ return 1 + i;
+ if ((int)values.GetValue (i) != truevalues [i])
+ return 1 + names.Length + i;
+ }
+ }
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/reflection-prop.cs b/mono/tests/reflection-prop.cs
new file mode 100644
index 00000000000..159f64493a3
--- /dev/null
+++ b/mono/tests/reflection-prop.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using System;
+
+namespace Test {
+ public class T {
+ public static int Main(string[] args) {
+ string name = "System.String";
+ if (args.Length > 0)
+ name = args [0];
+ Type t = Type.GetType (name);
+ PropertyInfo[] ms = t.GetProperties();
+
+ foreach (PropertyInfo m in ms) {
+ if (m.CanRead)
+ Console.Write ("Type "+m.PropertyType.Name+" ");
+ Console.WriteLine (m.Name);
+ }
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/reflection.cs b/mono/tests/reflection.cs
new file mode 100644
index 00000000000..2fc292b7f69
--- /dev/null
+++ b/mono/tests/reflection.cs
@@ -0,0 +1,37 @@
+using System.Reflection;
+using System.Collections;
+using System;
+
+namespace Test {
+ internal class CM : IComparer {
+ public int Compare (object x, object y) {
+ return ((MethodInfo)x).Name.CompareTo (((MethodInfo)y).Name);
+ }
+ }
+ public class T {
+ public static int Main(string[] args) {
+ string[] names = {
+ "Equals", "Equals",
+ "GetHashCode", "GetType",
+ "ReferenceEquals", "ToString"
+ };
+ int i;
+ string name = "System.Object";
+ if (args.Length > 0)
+ name = args [0];
+ Type t = Type.GetType (name, true);
+ MethodInfo[] ms = t.GetMethods();
+
+ Array.Sort (ms, new CM());
+ foreach (MethodInfo m in ms) {
+ Console.WriteLine (m.ReturnType.Name + " " + m.Name);
+ }
+ if (name == "System.Object") {
+ for (i=0; i < names.Length; ++i)
+ if (names [i] != ms [i].Name)
+ return i + 1;
+ }
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/reflection4.cs b/mono/tests/reflection4.cs
new file mode 100644
index 00000000000..6683c3680f4
--- /dev/null
+++ b/mono/tests/reflection4.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Reflection;
+
+public class T {
+
+ public static int Main() {
+ Type t = typeof (System.Console);
+ Type[] p= {typeof(string)};
+
+ MethodInfo m = t.GetMethod ("WriteLine", p);
+
+ if (typeof(void) != m.ReturnType) {
+ Console.WriteLine ("Type mismatch");
+ return 1;
+ }
+ return 0;
+ }
+}
diff --git a/mono/tests/reflection5.cs b/mono/tests/reflection5.cs
new file mode 100644
index 00000000000..1d63ec208e5
--- /dev/null
+++ b/mono/tests/reflection5.cs
@@ -0,0 +1,16 @@
+using System.Reflection;
+using System;
+
+public class T {
+ public static int Main() {
+ int[] arr = {1};
+ Type t = arr.GetType ();
+ Console.WriteLine ("type is: "+t.ToString());
+ Console.WriteLine ("type is array: "+t.IsArray);
+ if (t.ToString() != "System.Int32[]")
+ return 1;
+ if (!t.IsArray)
+ return 2;
+ return 0;
+ }
+}
diff --git a/mono/tests/remoting1.cs b/mono/tests/remoting1.cs
new file mode 100644
index 00000000000..9469fdc7890
--- /dev/null
+++ b/mono/tests/remoting1.cs
@@ -0,0 +1,175 @@
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+
+class MyProxy : RealProxy {
+ readonly MarshalByRefObject target;
+
+ public MyProxy (MarshalByRefObject target) : base (target.GetType())
+ {
+ this.target = target;
+ }
+
+ public override IMessage Invoke (IMessage request) {
+ IMethodCallMessage call = (IMethodCallMessage)request;
+ Console.WriteLine ("Invoke " + call.MethodName);
+
+ Console.Write ("ARGS(");
+ for (int i = 0; i < call.ArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (call.GetArgName (i) + " " +
+ call.GetArg (i));
+ }
+ Console.WriteLine (")");
+ Console.Write ("INARGS(");
+ for (int i = 0; i < call.InArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (call.GetInArgName (i) + " " +
+ call.GetInArg (i));
+ }
+ Console.WriteLine (")");
+
+ IMethodReturnMessage res = RemotingServices.ExecuteMessage (target, call);
+
+ Console.Write ("RESARGS(");
+ for (int i = 0; i < res.ArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (res.GetArgName (i) + " " +
+ res.GetArg (i));
+ }
+ Console.WriteLine (")");
+
+ Console.Write ("RESOUTARGS(");
+ for (int i = 0; i < res.OutArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (res.GetOutArgName (i) + " " +
+ res.GetOutArg (i));
+ }
+ Console.WriteLine (")");
+
+ return res;
+ }
+}
+
+public struct MyStruct {
+ public int a;
+ public int b;
+ public int c;
+}
+
+class R1 : MarshalByRefObject {
+
+ public int test_field = 5;
+
+ public virtual MyStruct Add (int a, out int c, int b) {
+ Console.WriteLine ("ADD");
+ c = a + b;
+
+ MyStruct res = new MyStruct ();
+
+ res.a = a;
+ res.b = b;
+ res.c = c;
+
+ return res;
+ }
+
+ public long nonvirtual_Add (int a, int b) {
+ Console.WriteLine ("nonvirtual_Add");
+ return a + b;
+ }
+}
+
+class Test {
+
+ delegate MyStruct RemoteDelegate1 (int a, out int c, int b);
+ delegate long RemoteDelegate2 (int a, int b);
+
+ static long test_call (R1 o)
+ {
+ return o.nonvirtual_Add (2, 3);
+ }
+
+ static int Main () {
+ R1 myobj = new R1 ();
+ int res = 0;
+ long lres;
+
+ MyProxy real_proxy = new MyProxy (myobj);
+
+ R1 o = (R1)real_proxy.GetTransparentProxy ();
+
+ if (RemotingServices.IsTransparentProxy (null))
+ return 1;
+
+ if (!RemotingServices.IsTransparentProxy (o))
+ return 1;
+
+ Console.WriteLine (o.GetType ());
+
+ MyStruct myres = o.Add (2, out res, 3);
+
+ Console.WriteLine ("Result: " + myres.a + " " +
+ myres.b + " " + myres.c + " " + res);
+
+ if (myres.a != 2)
+ return 1;
+
+ if (myres.b != 3)
+ return 1;
+
+ if (myres.c != 5)
+ return 1;
+
+ if (res != 5)
+ return 1;
+
+ R1 o2 = new R1 ();
+
+ lres = test_call (o2);
+
+ lres = test_call (o);
+
+ Console.WriteLine ("Result: " + lres);
+ if (lres != 5)
+ return 1;
+
+ lres = test_call (o);
+
+ o.test_field = 2;
+
+ Console.WriteLine ("test_field: " + o.test_field);
+ if (o.test_field != 2)
+ return 1;
+
+ RemoteDelegate1 d1 = new RemoteDelegate1 (o.Add);
+ MyStruct myres2 = d1 (2, out res, 3);
+
+ Console.WriteLine ("Result: " + myres2.a + " " +
+ myres2.b + " " + myres2.c + " " + res);
+
+ if (myres2.a != 2)
+ return 1;
+
+ if (myres2.b != 3)
+ return 1;
+
+ if (myres2.c != 5)
+ return 1;
+
+ if (res != 5)
+ return 1;
+
+ RemoteDelegate2 d2 = new RemoteDelegate2 (o.nonvirtual_Add);
+ d2 (6, 7);
+
+ return 0;
+ }
+}
diff --git a/mono/tests/remoting2.cs b/mono/tests/remoting2.cs
new file mode 100644
index 00000000000..eda80c67395
--- /dev/null
+++ b/mono/tests/remoting2.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+
+class MyProxy : RealProxy {
+ readonly MarshalByRefObject target;
+
+ public MyProxy (MarshalByRefObject target) : base (target.GetType())
+ {
+ this.target = target;
+ }
+
+ public override IMessage Invoke (IMessage request) {
+ IMethodCallMessage call = (IMethodCallMessage)request;
+ Console.WriteLine ("Invoke " + call.MethodName);
+
+ Console.Write ("ARGS(");
+ for (int i = 0; i < call.ArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (call.GetArgName (i) + " " +
+ call.GetArg (i));
+ }
+ Console.WriteLine (")");
+ Console.Write ("INARGS(");
+ for (int i = 0; i < call.InArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (call.GetInArgName (i) + " " +
+ call.GetInArg (i));
+ }
+ Console.WriteLine (")");
+
+ IMethodReturnMessage res = RemotingServices.ExecuteMessage (target, call);
+
+ Console.Write ("RESARGS(");
+ for (int i = 0; i < res.ArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (res.GetArgName (i) + " " +
+ res.GetArg (i));
+ }
+ Console.WriteLine (")");
+
+ Console.Write ("RESOUTARGS(");
+ for (int i = 0; i < res.OutArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (res.GetOutArgName (i) + " " +
+ res.GetOutArg (i));
+ }
+ Console.WriteLine (")");
+
+ return res;
+ }
+}
+
+public struct MyStruct {
+ public int a;
+ public int b;
+ public int c;
+}
+
+class R1 : MarshalByRefObject {
+
+ public int test_field = 5;
+
+ public virtual MyStruct Add (int a, out int c, int b) {
+ Console.WriteLine ("ADD");
+ c = a + b;
+
+ MyStruct res = new MyStruct ();
+
+ res.a = a;
+ res.b = b;
+ res.c = c;
+
+ return res;
+ }
+
+ public long nonvirtual_Add (int a, int b) {
+ Console.WriteLine ("nonvirtual_Add");
+ return a + b;
+ }
+}
+
+class Test {
+
+ delegate long RemoteDelegate2 (int a, int b);
+
+
+ static int Main () {
+ R1 myobj = new R1 ();
+ long lres;
+
+ MyProxy real_proxy = new MyProxy (myobj);
+
+ R1 o = (R1)real_proxy.GetTransparentProxy ();
+
+ RemoteDelegate2 d2 = new RemoteDelegate2 (o.nonvirtual_Add);
+ d2 (6, 7);
+
+ IAsyncResult ar1 = d2.BeginInvoke (2, 4, null, null);
+ lres = d2.EndInvoke (ar1);
+ if (lres != 6)
+ return 1;
+
+ return 0;
+ }
+}
diff --git a/mono/tests/remoting3.cs b/mono/tests/remoting3.cs
new file mode 100644
index 00000000000..a7c726b1bae
--- /dev/null
+++ b/mono/tests/remoting3.cs
@@ -0,0 +1,124 @@
+using System;
+using System.Threading;
+using System.Runtime.InteropServices;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+
+class MyProxy : RealProxy {
+ readonly MarshalByRefObject target;
+
+ public MyProxy (MarshalByRefObject target) : base (target.GetType())
+ {
+ this.target = target;
+ }
+
+ public override IMessage Invoke (IMessage request) {
+ IMethodCallMessage call = (IMethodCallMessage)request;
+ Console.WriteLine ("Invoke " + call.MethodName);
+
+ Console.Write ("ARGS(");
+ for (int i = 0; i < call.ArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (call.GetArgName (i) + " " +
+ call.GetArg (i));
+ }
+ Console.WriteLine (")");
+ Console.Write ("INARGS(");
+ for (int i = 0; i < call.InArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (call.GetInArgName (i) + " " +
+ call.GetInArg (i));
+ }
+ Console.WriteLine (")");
+
+ IMethodReturnMessage res = RemotingServices.ExecuteMessage (target, call);
+
+ Console.Write ("RESARGS(");
+ for (int i = 0; i < res.ArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (res.GetArgName (i) + " " +
+ res.GetArg (i));
+ }
+ Console.WriteLine (")");
+
+ Console.Write ("RESOUTARGS(");
+ for (int i = 0; i < res.OutArgCount; i++) {
+ if (i != 0)
+ Console.Write (", ");
+ Console.Write (res.GetOutArgName (i) + " " +
+ res.GetOutArg (i));
+ }
+ Console.WriteLine (")");
+
+ return res;
+ }
+}
+
+public struct MyStruct {
+ public int a;
+ public int b;
+ public int c;
+}
+
+class R1 : MarshalByRefObject {
+
+ public int test_field = 5;
+
+ public virtual MyStruct Add (int a, out int c, int b) {
+ Console.WriteLine ("ADD");
+ c = a + b;
+
+ MyStruct res = new MyStruct ();
+
+ res.a = a;
+ res.b = b;
+ res.c = c;
+
+ return res;
+ }
+
+ public long nonvirtual_Add (int a, int b) {
+ Console.WriteLine ("nonvirtual_Add");
+ return a + b;
+ }
+}
+
+class Test {
+
+ delegate MyStruct RemoteDelegate1 (int a, out int c, int b);
+
+ static int Main () {
+ R1 myobj = new R1 ();
+ int res = 0;
+
+ MyProxy real_proxy = new MyProxy (myobj);
+
+ R1 o = (R1)real_proxy.GetTransparentProxy ();
+
+
+ RemoteDelegate1 d1 = new RemoteDelegate1 (o.Add);
+
+ IAsyncResult ar = d1.BeginInvoke (2, out res, 3, null, null);
+ MyStruct myres = d1.EndInvoke (out res, ar);
+
+ Console.WriteLine ("Result: " + myres.a + " " +
+ myres.b + " " + myres.c + " " + res);
+ if (myres.a != 2)
+ return 1;
+
+ if (myres.b != 3)
+ return 2;
+
+ if (myres.c != 5)
+ return 3;
+
+ if (res != 5)
+ return 4;
+
+ return 0;
+ }
+}
diff --git a/mono/tests/rounding.cs b/mono/tests/rounding.cs
new file mode 100644
index 00000000000..4dc273affae
--- /dev/null
+++ b/mono/tests/rounding.cs
@@ -0,0 +1,15 @@
+public class TestJit {
+
+ public static int Main() {
+ long ticks = 631502475130080000L;
+ long ticksperday = 864000000000L;
+
+ double days = (double) ticks / ticksperday;
+
+ if ((int)days != 730905)
+ return 1;
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/setenv.cs b/mono/tests/setenv.cs
new file mode 100644
index 00000000000..63ad579fdc4
--- /dev/null
+++ b/mono/tests/setenv.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace Test {
+
+ public class Test {
+ [DllImport("libc")]
+ static extern int setenv(string name, string value, int overwrite);
+ [DllImport("libc")]
+ static extern string getenv(string name);
+
+ static int Main() {
+ string name = "mono_test";
+ string value = "val";
+
+ setenv (name, value, 1);
+ string ret = getenv (name);
+
+ if (ret != value)
+ return 1;
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/sieve.cs b/mono/tests/sieve.cs
new file mode 100644
index 00000000000..dbcd3aa2c24
--- /dev/null
+++ b/mono/tests/sieve.cs
@@ -0,0 +1,32 @@
+/* -*- mode: c -*-
+ * $Id: sieve.cs,v 1.1 2001/11/19 06:52:53 lupus Exp $
+ * http://www.bagley.org/~doug/shootout/
+ */
+
+class Test {
+static public int Main() {
+ //int NUM = ((argc == 2) ? atoi(argv[1]) : 1);
+ int NUM = 300;
+ byte[] flags = new byte[8192 + 1];
+ int i, k;
+ int count = 0;
+
+ while (NUM-- != 0) {
+ count = 0;
+ for (i=2; i <= 8192; i++) {
+ flags[i] = 1;
+ }
+ for (i=2; i <= 8192; i++) {
+ if (flags[i] != 0) {
+ // remove all multiples of prime: i
+ for (k=i+i; k <= 8192; k+=i) {
+ flags[k] = 0;
+ }
+ count++;
+ }
+ }
+ }
+ //printf("Count: %d\n", count);
+ return(0);
+}
+}
diff --git a/mono/tests/static-constructor.cs b/mono/tests/static-constructor.cs
new file mode 100755
index 00000000000..754022537d3
--- /dev/null
+++ b/mono/tests/static-constructor.cs
@@ -0,0 +1,23 @@
+
+public class GenRandom {
+ static int last = 42;
+ static int burp;
+
+ static GenRandom () {
+ /*
+ * This is really at test of the compiler: it should init
+ * last before getting here.
+ */
+ if (last != 42)
+ burp = 5;
+ else
+ burp = 4;
+ }
+ public static int Main() {
+ if (last != 42)
+ return 1;
+ if (burp != 4)
+ return 1;
+ return 0;
+ }
+}
diff --git a/mono/tests/stream-writer.cs b/mono/tests/stream-writer.cs
new file mode 100755
index 00000000000..116bf9320bc
--- /dev/null
+++ b/mono/tests/stream-writer.cs
@@ -0,0 +1,19 @@
+using System;
+using System.IO;
+
+public class Test {
+
+ public static int Main () {
+ FileStream s = new FileStream ((IntPtr)1, FileAccess.Write);
+ StreamWriter sw = new StreamWriter (s);
+ string ts = "This is another test";
+
+ sw.WriteLine (ts);
+
+ sw.WriteLine (123456);
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/stream.cs b/mono/tests/stream.cs
new file mode 100755
index 00000000000..d3314381c00
--- /dev/null
+++ b/mono/tests/stream.cs
@@ -0,0 +1,25 @@
+using System;
+using System.IO;
+
+public class Test {
+
+ public static int Main () {
+ byte[] buf = new byte [20];
+ int i;
+ FileStream s = new FileStream ("stest.dat", FileMode.OpenOrCreate, FileAccess.ReadWrite);
+ for (i=0; i < 20; ++i)
+ buf [i] = 65;
+ s.Write (buf, 0, 20);
+ s.Position = 0;
+ for (i=0; i < 20; ++i)
+ buf [i] = 66;
+ s.Read (buf, 0, 20);
+ for (i=0; i < 20; ++i)
+ if (buf [i] != 65)
+ return 1;
+
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/string-compare.cs b/mono/tests/string-compare.cs
new file mode 100644
index 00000000000..3cb82cfdcfa
--- /dev/null
+++ b/mono/tests/string-compare.cs
@@ -0,0 +1,50 @@
+using System;
+
+namespace T {
+ struct datum {
+ public string a;
+ public string b;
+ public int result;
+
+ public datum (string A, string B, int r) {
+ a = A;
+ b = B;
+ result =r;
+ }
+
+ public bool match () {
+ int r = String.Compare (a, b);
+ switch (result) {
+ case -1:
+ if (r < 0) return true;
+ break;
+ case 0:
+ if (r == 0) return true;
+ break;
+ case 1:
+ if (r > 0) return true;
+ break;
+ default:
+ return false;
+ }
+ return false;
+ }
+ }
+ public class test {
+ public static int Main() {
+ datum[] data = {
+ new datum ("a", "b", -1),
+ new datum ("a", "a", 0),
+ new datum ("b", "a", 1),
+ new datum ("ba", "b", 1),
+ new datum ("b", "ba", -1),
+ };
+ int i;
+ for (i = 0; i < data.Length; ++i) {
+ if (!data[i].match())
+ return i+1;
+ }
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/string.cs b/mono/tests/string.cs
new file mode 100755
index 00000000000..f2e899bda93
--- /dev/null
+++ b/mono/tests/string.cs
@@ -0,0 +1,19 @@
+using System;
+
+public class TestString {
+
+ public static int Main() {
+ string a = "ddd";
+ string b = "ddd";
+ string c = "ddda";
+ if (a != b)
+ return 1;
+ if (c != String.Concat(b , "a"))
+ return 2;
+ if (!System.Object.ReferenceEquals(a, b))
+ return 3;
+ if (System.Object.ReferenceEquals(c, String.Concat(b, "a")))
+ return 4;
+ return 0;
+ }
+}
diff --git a/mono/tests/stringbuilder.cs b/mono/tests/stringbuilder.cs
new file mode 100644
index 00000000000..c125a506942
--- /dev/null
+++ b/mono/tests/stringbuilder.cs
@@ -0,0 +1,25 @@
+using System.Text;
+
+namespace test {
+ public class Test {
+ public static int Main() {
+ StringBuilder b = new StringBuilder ();
+ /*b.Append ('A');
+ b.Append ('b');
+ b.Append ('r');*/
+ b.Append ("Abr");
+ if (b.ToString() != "Abr") {
+ System.Console.WriteLine ("Got: " + b.ToString());
+ return 1;
+ }
+ b.Append ('a');
+ b.Append ("cadabra");
+ if (b.ToString() != "Abracadabra") {
+ System.Console.WriteLine ("Got: " + b.ToString());
+ return 2;
+ }
+ return 0;
+
+ }
+ }
+}
diff --git a/mono/tests/struct.cs b/mono/tests/struct.cs
new file mode 100755
index 00000000000..1af2cfd14cf
--- /dev/null
+++ b/mono/tests/struct.cs
@@ -0,0 +1,58 @@
+struct Point
+{
+ public int x, y, z;
+ public Point(int x, int y) {
+ this.x = x;
+ this.y = y;
+ this.z = 5;
+ }
+ public static Point get_zerop () {
+ Point p = new Point (0, 0);
+ p.z = 0;
+ return p;
+ }
+ public static int struct_param (Point p) {
+ if (p.x != p.y || p.y != p.z || p.z != 0)
+ return 1;
+ /* should modify the local copy */
+ p.x = 1;
+ p.y = 2;
+ p.z = 3;
+ return 0;
+ }
+}
+
+public class test {
+ public static int Main () {
+ Point p = new Point (10, 20);
+ Point c = p;
+ Point zp;
+
+ if (c.x != 10)
+ return 1;
+ if (c.y != 20)
+ return 2;
+ if (c.z != 5)
+ return 3;
+ if (p.x != 10)
+ return 4;
+ if (p.y != 20)
+ return 5;
+ if (p.z != 5)
+ return 6;
+ p.z = 7;
+ if (p.z != 7)
+ return 7;
+ if (c.x != 10)
+ return 8;
+
+ zp = Point.get_zerop ();
+ if (zp.x != zp.y || zp.y != zp.z || zp.z != 0)
+ return 9;
+ if (Point.struct_param (zp) != 0)
+ return 10;
+ if (zp.x != zp.y || zp.y != zp.z || zp.z != 0)
+ return 11;
+ return 0;
+ }
+}
diff --git a/mono/tests/switch-string.cs b/mono/tests/switch-string.cs
new file mode 100644
index 00000000000..c264d1feb66
--- /dev/null
+++ b/mono/tests/switch-string.cs
@@ -0,0 +1,23 @@
+using System;
+
+public class fall_through {
+
+ public static void Main(string[] args)
+ {
+ foreach(string str in args)
+ {
+ Console.WriteLine(str);
+
+ switch(str)
+ {
+ case "test":
+ Console.WriteLine("passed");
+ continue;
+
+ default:
+ return;
+ }
+ }
+ }
+}
+
diff --git a/mono/tests/switch.cs b/mono/tests/switch.cs
new file mode 100755
index 00000000000..10db17507ce
--- /dev/null
+++ b/mono/tests/switch.cs
@@ -0,0 +1,26 @@
+public class Switch {
+
+ public static int test (int n) {
+ switch (n) {
+ case 0: return 1;
+ case 1: return 0;
+ case -1: return 2;
+ default:
+ return 0xff;
+ }
+ return 100;
+ }
+ public static int Main () {
+ if (test(0) != 1)
+ return 1;
+ if (test(1) != 0)
+ return 2;
+ if (test(-1) != 2)
+ return 3;
+ if (test(3) != 0xff)
+ return 4;
+ return 0;
+ }
+}
+
+
diff --git a/mono/tests/test-driver b/mono/tests/test-driver
new file mode 100755
index 00000000000..f64835e2905
--- /dev/null
+++ b/mono/tests/test-driver
@@ -0,0 +1,35 @@
+#!/usr/bin/perl -w
+
+my $interpreter = shift;
+my $test = shift;
+my $output = $test;
+my $stdout = $test.'.stdout';
+my $stderr = $test.'.stderr';
+
+$output =~ s/\.exe$/.output/;
+
+$| = 0;
+print "Testing $test... ";
+
+my $res = system("$interpreter $test 2>/dev/null 1>$stdout");
+
+if ($res) {
+ printf ("failed $? (%d) signal (%d).\n", $? >> 8, $? & 127);
+ exit (1);
+} elsif (-f $output) {
+ print "failed output.\n" if (read_file ($output) ne read_file ($stdout));
+ exit (1);
+} else {
+ print "pass.\n";
+ #unlink ($result);
+}
+exit (0);
+
+sub read_file {
+ local ($/);
+ my $out = shift;
+ open (F, "<$out") || die $!;
+ $out = <F>;
+ close(F);
+ return $out;
+}
diff --git a/mono/tests/test-ops.cs b/mono/tests/test-ops.cs
new file mode 100755
index 00000000000..809f5d34bad
--- /dev/null
+++ b/mono/tests/test-ops.cs
@@ -0,0 +1,69 @@
+
+public class TestIntOps {
+
+ public static sbyte sbyte_add (sbyte a, sbyte b) {
+ return (sbyte)(a+b);
+ }
+
+ public static short short_add (short a, short b) {
+ return (short)(a+b);
+ }
+
+ public static double double_add (double a, double b) {
+ return a+b;
+ }
+
+ public static int int_add (int a, int b) {
+ return a+b;
+ }
+
+ public static int int_sub (int a, int b) {
+ return a-b;
+ }
+
+ public static int int_mul (int a, int b) {
+ return a*b;
+ }
+
+ public static int int_div (int a, int b) {
+ return a/b;
+ }
+
+ public static int Main() {
+ int num = 1;
+
+ if (int_div (5, 2) != 2) return num;
+ num++;
+
+ if (int_add (1, 1) != 2) return num;
+ num++;
+
+ if (int_add (31, -1) != 30) return num;
+ num++;
+
+ if (int_sub (31, -1) != 32) return num;
+ num++;
+
+ if (int_mul (12, 12) != 144) return num;
+ num++;
+
+ if (sbyte_add (1, 1) != 2) return num;
+ num++;
+
+ if (sbyte_add (31, -1) != 30) return num;
+ num++;
+
+ if (short_add (1, 1) != 2) return num;
+ num++;
+
+ if (short_add (31, -1) != 30) return num;
+ num++;
+
+ if (double_add (1.5, 1.5) != 3) return num;
+ num++;
+
+ // add more meaningful tests
+
+ return 0;
+ }
+}
diff --git a/mono/tests/test-prime.cs b/mono/tests/test-prime.cs
new file mode 100644
index 00000000000..28ffb3de4ad
--- /dev/null
+++ b/mono/tests/test-prime.cs
@@ -0,0 +1,20 @@
+using System;
+
+class Test {
+ public static bool testprime (int x) {
+ if ((x & 1) != 0) {
+ for (int n = 3; n < x; n += 2) {
+ if ((x % n) == 0)
+ return false;
+ }
+ return true;
+ }
+ return (x == 2);
+ }
+
+ public static int Main () {
+ if (!testprime (17))
+ return 1;
+ return 0;
+ }
+}
diff --git a/mono/tests/thread.cs b/mono/tests/thread.cs
new file mode 100755
index 00000000000..db2f11f569b
--- /dev/null
+++ b/mono/tests/thread.cs
@@ -0,0 +1,20 @@
+
+using System;
+using System.Threading;
+
+public class Test {
+ private void Thread_func() {
+ Console.WriteLine("In a thread!");
+ }
+
+ public static int Main () {
+ Console.WriteLine ("Hello, World!");
+ Test test = new Test();
+ Thread thr=new Thread(new ThreadStart(test.Thread_func));
+ thr.Start();
+ Console.WriteLine("In the main line!");
+ thr.Join ();
+ return 0;
+ }
+}
+
diff --git a/mono/tests/thread2.cs b/mono/tests/thread2.cs
new file mode 100755
index 00000000000..5ae01388778
--- /dev/null
+++ b/mono/tests/thread2.cs
@@ -0,0 +1,96 @@
+
+using System;
+using System.Threading;
+
+public class Test {
+ static LocalDataStoreSlot slot;
+
+ private void Thread_func() {
+ //Throws undocumented exception :-(
+ //LocalDataStoreSlot namedslot=Thread.AllocateNamedDataSlot("data-slot");
+ LocalDataStoreSlot namedslot=Thread.GetNamedDataSlot("data-slot");
+
+ Console.WriteLine("In a thread!");
+
+ Thread thr=Thread.CurrentThread;
+ Console.WriteLine("Found thread!");
+ thr.Name="wobble";
+ Thread otherthr=Thread.CurrentThread;
+ Console.WriteLine("Other subthread is " + otherthr.Name);
+
+ Thread.SetData(slot, thr);
+ Thread storedthr=(Thread)Thread.GetData(slot);
+ Console.WriteLine("Stored subthread is " + storedthr.Name);
+
+ Thread.SetData(namedslot, thr);
+ storedthr=(Thread)Thread.GetData(namedslot);
+ Console.WriteLine("Stored subthread is " + storedthr.Name);
+
+ Console.WriteLine("Locking thr for 1.5s");
+ lock(thr) {
+ Thread.Sleep(1500);
+ }
+
+ Console.WriteLine("Waiting for signal");
+ lock(thr) {
+ Monitor.Wait(thr);
+ Console.WriteLine("Thread signalled!");
+ }
+
+ Console.WriteLine("Sleeping for 10s");
+ Thread.Sleep(10000);
+
+ Thread storedthr2=(Thread)Thread.GetData(slot);
+ Console.WriteLine("Stored subthread is still " + storedthr2.Name);
+ }
+
+ public static int Main () {
+ Console.WriteLine ("Hello, World!");
+ slot=Thread.AllocateDataSlot();
+ LocalDataStoreSlot namedslot=Thread.AllocateNamedDataSlot("data-slot");
+
+ Test test = new Test();
+ Thread thr=new Thread(new ThreadStart(test.Thread_func));
+ thr.Start();
+ Thread.Sleep(1000);
+ Thread main=Thread.CurrentThread;
+ main.Name="wibble";
+ Thread othermain=Thread.CurrentThread;
+ Console.WriteLine("Other name " + othermain.Name);
+ Thread.Sleep(0);
+
+ Console.WriteLine("In the main line!");
+
+ Console.WriteLine("Trying to enter lock");
+ if(Monitor.TryEnter(thr, 100)==true) {
+ Console.WriteLine("Returned lock");
+ Monitor.Exit(thr);
+ } else {
+ Console.WriteLine("Didn't get lock");
+ }
+
+ Thread.SetData(slot, main);
+ Thread storedthr=(Thread)Thread.GetData(slot);
+ Console.WriteLine("Stored subthread is " + storedthr.Name);
+
+ Thread.SetData(namedslot, main);
+ storedthr=(Thread)Thread.GetData(namedslot);
+ Console.WriteLine("Stored subthread is " + storedthr.Name);
+
+ if(thr.Join(5000)) {
+ Console.WriteLine("Joined thread");
+ } else {
+ Console.WriteLine("Didn't join thread");
+ }
+
+ lock(thr) {
+ Monitor.Pulse(thr);
+ Console.WriteLine("Signalled thread");
+ }
+
+ thr.Join();
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/thread3.cs b/mono/tests/thread3.cs
new file mode 100755
index 00000000000..3b59df49814
--- /dev/null
+++ b/mono/tests/thread3.cs
@@ -0,0 +1,68 @@
+
+using System;
+using System.Threading;
+
+public class Test {
+ private void Thread_func() {
+ Console.WriteLine("In a thread!");
+
+ Thread thr=Thread.CurrentThread;
+
+ Console.WriteLine("Locking thr for 1.5s");
+ lock(thr) {
+ Console.WriteLine("Locked");
+ Thread.Sleep(2000);
+ Console.WriteLine("Slept for 2s");
+ Thread.Sleep(15000);
+ }
+
+ Console.WriteLine("Waiting for signal");
+ lock(thr) {
+ Console.WriteLine("Waiting...");
+ Monitor.Wait(thr);
+ Console.WriteLine("Thread signalled!");
+ }
+
+ Console.WriteLine("Sleeping for 2s");
+ Thread.Sleep(2000);
+
+ Console.WriteLine("Leaving thread");
+ }
+
+ public static int Main () {
+ Console.WriteLine ("Hello, World!");
+ Thread thr=new Thread(new ThreadStart(new Test().Thread_func));
+ thr.Start();
+ Thread.Sleep(1000);
+
+ Console.WriteLine("Trying to enter lock");
+ if(Monitor.TryEnter(thr, 1000)==true) {
+ Console.WriteLine("Returned lock");
+ Monitor.Exit(thr);
+ } else {
+ Console.WriteLine("Didn't get lock");
+ // .net seems to leave thr locked here !!!!
+
+ // This test deadlocks on .net with the thread
+ // trying to lock(thr) between the two
+ // WriteLine()s Monitor.Exit(thr); here and it
+ // magically works :) Of course, then mint
+ // throws a
+ // SynchronizationLockException... (like it
+ // should)
+ //Monitor.Exit(thr);
+ }
+
+ Thread.Sleep(20000);
+
+ lock(thr) {
+ Monitor.Pulse(thr);
+ Console.WriteLine("Signalled thread");
+ }
+
+ thr.Join();
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/thread4.cs b/mono/tests/thread4.cs
new file mode 100644
index 00000000000..a31d14eb8e5
--- /dev/null
+++ b/mono/tests/thread4.cs
@@ -0,0 +1,16 @@
+
+using System;
+using System.Threading;
+
+public class Test {
+
+ public static int Main () {
+ Console.WriteLine ("Starting test\n");
+
+ Console.WriteLine("Domain name: {0}\n", Thread.GetDomain().FriendlyName);
+ Console.WriteLine("Domain id: {0}\n", Thread.GetDomainID().ToString());
+
+ return 0;
+ }
+}
+
diff --git a/mono/tests/tight-loop.cs b/mono/tests/tight-loop.cs
new file mode 100644
index 00000000000..a596f4d8d68
--- /dev/null
+++ b/mono/tests/tight-loop.cs
@@ -0,0 +1,9 @@
+class T {
+ public static int Main () {
+ int n = 0;
+ while (n < 100000000) {
+ ++n;
+ }
+ return 0;
+ }
+}
diff --git a/mono/tests/time.cs b/mono/tests/time.cs
new file mode 100644
index 00000000000..5e0cdfd5f4d
--- /dev/null
+++ b/mono/tests/time.cs
@@ -0,0 +1,17 @@
+using System;
+
+class time_test {
+
+ static int Main ()
+ {
+ DateTime uepoch = new DateTime (1970, 1, 1);
+
+ if (uepoch.Ticks != 621355968000000000)
+ return 1;
+
+ TimeSpan ts = new TimeSpan (1, 0, 0);
+ Console.WriteLine (ts.Ticks);
+
+ return 0;
+ }
+}
diff --git a/mono/tests/unreachable-code.cs b/mono/tests/unreachable-code.cs
new file mode 100644
index 00000000000..c1a9923e374
--- /dev/null
+++ b/mono/tests/unreachable-code.cs
@@ -0,0 +1,17 @@
+using System;
+
+// You need to compile this test with mcs:
+// csc will discard unreachable code sections
+
+namespace Test {
+ public class Test {
+ public static int Main () {
+ int var = 0;
+ goto label2;
+ label1:
+ goto label2;
+ label2:
+ return var;
+ }
+ }
+}
diff --git a/mono/tests/valuetype-gettype.cs b/mono/tests/valuetype-gettype.cs
new file mode 100644
index 00000000000..673f341e0cc
--- /dev/null
+++ b/mono/tests/valuetype-gettype.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace Test {
+ struct val {
+ int t;
+
+ val (int v) {
+ t = v;
+ }
+
+ public static int Main() {
+ val v = new val (1);;
+ Console.WriteLine (v.ToString());
+ return 0;
+ }
+ }
+}
diff --git a/mono/tests/vararg.cs b/mono/tests/vararg.cs
new file mode 100644
index 00000000000..b192cf06178
--- /dev/null
+++ b/mono/tests/vararg.cs
@@ -0,0 +1,30 @@
+using System;
+
+class Class1
+{
+ static int AddABunchOfInts (__arglist)
+ {
+ int result = 0;
+
+ System.ArgIterator iter = new System.ArgIterator (__arglist);
+ int argCount = iter.GetRemainingCount();
+
+ for (int i = 0; i < argCount; i++) {
+ System.TypedReference typedRef = iter.GetNextArg();
+ result += (int)TypedReference.ToObject( typedRef );
+ }
+
+ return result;
+ }
+
+ static int Main (string[] args)
+ {
+ int result = AddABunchOfInts ( __arglist ( 2, 3, 4 ));
+ Console.WriteLine ("Answer: {0}", result);
+
+ if (result != 9)
+ return 1;
+
+ return 0;
+ }
+}
diff --git a/mono/tests/virtual-method.cs b/mono/tests/virtual-method.cs
new file mode 100644
index 00000000000..5a732c416f9
--- /dev/null
+++ b/mono/tests/virtual-method.cs
@@ -0,0 +1,41 @@
+using System;
+
+namespace Obj {
+ interface Bah {
+ int H ();
+ }
+ class A : Bah {
+ public int F () {return 1;}
+ public virtual int G () {return 2;}
+ public int H () {return 10;}
+ }
+ class B : A {
+ public new int F () {return 3;}
+ public override int G () {return 4;}
+ public new int H () {return 11;}
+ }
+ class Test {
+ static public int Main () {
+ int result = 0;
+ B b = new B ();
+ A a = b;
+ if (a.F () != 1)
+ result |= 1 << 0;
+ if (b.F () != 3)
+ result |= 1 << 1;
+ if (b.G () != 4)
+ result |= 1 << 2;
+ if (a.G () != 4)
+ result |= 1 << 3;
+ if (a.H () != 10)
+ result |= 1 << 4;
+ if (b.H () != 11)
+ result |= 1 << 5;
+ if (((A)b).H () != 10)
+ result |= 1 << 6;
+ if (((B)a).H () != 11)
+ result |= 1 << 7;
+ return result;
+ }
+ };
+};
diff --git a/mono/tests/vtype.cs b/mono/tests/vtype.cs
new file mode 100644
index 00000000000..2a2dc91536a
--- /dev/null
+++ b/mono/tests/vtype.cs
@@ -0,0 +1,20 @@
+using System;
+
+namespace T {
+
+ public class Test {
+
+ public static int Main () {
+ int i = 12;
+ object o = i;
+
+ if (i.ToString () != "12")
+ return 1;
+ if (((Int32)o).ToString () != "12")
+ return 2;
+ if (o.ToString () != "12")
+ return 3;
+ return 0;
+ }
+ }
+}
diff --git a/mono/utils/.cvsignore b/mono/utils/.cvsignore
new file mode 100644
index 00000000000..051d1bd50ba
--- /dev/null
+++ b/mono/utils/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+.deps
diff --git a/mono/utils/ChangeLog b/mono/utils/ChangeLog
new file mode 100644
index 00000000000..d024a680754
--- /dev/null
+++ b/mono/utils/ChangeLog
@@ -0,0 +1,9 @@
+
+Mon Mar 25 12:50:53 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * First checkin: libmonoutils is meant to hold some utility
+ data structures and bits that are usefult to the rest of the project
+ and don't require metadata/runtime support.
+ mono-hash is a GC-safe hash table: i.e. you can store GC-allocated
+ data in it.
+
diff --git a/mono/utils/Makefile.am b/mono/utils/Makefile.am
new file mode 100644
index 00000000000..ed6927e5894
--- /dev/null
+++ b/mono/utils/Makefile.am
@@ -0,0 +1,14 @@
+lib_LIBRARIES = libmonoutils.a
+
+INCLUDES = $(GLIB_CFLAGS) $(GMODULE_CFLAGS) -I$(top_srcdir) -I$(top_srcdir)/mono
+
+libmonoutils_a_SOURCES = \
+ mono-hash.c \
+ mono-hash.h
+
+libmonoutilsincludedir = $(includedir)/mono/utils
+
+libmonoutilsinclude_HEADERS =
+
+EXTRA_DIST = ChangeLog
+
diff --git a/mono/utils/mono-hash.c b/mono/utils/mono-hash.c
new file mode 100644
index 00000000000..4dbba68f3e8
--- /dev/null
+++ b/mono/utils/mono-hash.c
@@ -0,0 +1,720 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+/*
+ * MT safe
+ */
+
+/*
+ * Imported in mono cvs from version 1.32 of gnome cvs.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#if HAVE_BOEHM_GC
+#include <gc/gc.h>
+#endif
+#include "mono-hash.h"
+
+#define HASH_TABLE_MIN_SIZE 11
+#define HASH_TABLE_MAX_SIZE 13845163
+
+
+typedef struct _MonoGHashNode MonoGHashNode;
+
+struct _MonoGHashNode
+{
+ gpointer key;
+ gpointer value;
+ MonoGHashNode *next;
+};
+
+struct _MonoGHashTable
+{
+ gint size;
+ gint nnodes;
+ MonoGHashNode **nodes;
+ GHashFunc hash_func;
+ GEqualFunc key_equal_func;
+ GDestroyNotify key_destroy_func;
+ GDestroyNotify value_destroy_func;
+};
+
+#define G_HASH_TABLE_RESIZE(hash_table) \
+ G_STMT_START { \
+ if ((hash_table->size >= 3 * hash_table->nnodes && \
+ hash_table->size > HASH_TABLE_MIN_SIZE) || \
+ (3 * hash_table->size <= hash_table->nnodes && \
+ hash_table->size < HASH_TABLE_MAX_SIZE)) \
+ g_hash_table_resize (hash_table); \
+ } G_STMT_END
+
+static void g_hash_table_resize (MonoGHashTable *hash_table);
+static MonoGHashNode** g_hash_table_lookup_node (MonoGHashTable *hash_table,
+ gconstpointer key);
+static MonoGHashNode* g_hash_node_new (gpointer key,
+ gpointer value);
+static void g_hash_node_destroy (MonoGHashNode *hash_node,
+ GDestroyNotify key_destroy_func,
+ GDestroyNotify value_destroy_func);
+static void g_hash_nodes_destroy (MonoGHashNode *hash_node,
+ GDestroyNotify key_destroy_func,
+ GDestroyNotify value_destroy_func);
+static guint g_hash_table_foreach_remove_or_steal (MonoGHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data,
+ gboolean notify);
+
+
+G_LOCK_DEFINE_STATIC (g_hash_global);
+
+#if !HAVE_BOEHM_GC
+static GMemChunk *node_mem_chunk = NULL;
+#endif
+static MonoGHashNode *node_free_list = NULL;
+
+/**
+ * g_hash_table_new:
+ * @hash_func: a function to create a hash value from a key.
+ * Hash values are used to determine where keys are stored within the
+ * #GHashTable data structure. The g_direct_hash(), g_int_hash() and
+ * g_str_hash() functions are provided for some common types of keys.
+ * If hash_func is %NULL, g_direct_hash() is used.
+ * @key_equal_func: a function to check two keys for equality. This is
+ * used when looking up keys in the #GHashTable. The g_direct_equal(),
+ * g_int_equal() and g_str_equal() functions are provided for the most
+ * common types of keys. If @key_equal_func is %NULL, keys are compared
+ * directly in a similar fashion to g_direct_equal(), but without the
+ * overhead of a function call.
+ *
+ * Creates a new #GHashTable.
+ *
+ * Return value: a new #GHashTable.
+ **/
+MonoGHashTable*
+mono_g_hash_table_new (GHashFunc hash_func,
+ GEqualFunc key_equal_func)
+{
+ return mono_g_hash_table_new_full (hash_func, key_equal_func, NULL, NULL);
+}
+
+
+/**
+ * g_hash_table_new_full:
+ * @hash_func: a function to create a hash value from a key.
+ * @key_equal_func: a function to check two keys for equality.
+ * @key_destroy_func: a function to free the memory allocated for the key
+ * used when removing the entry from the #GHashTable or %NULL if you
+ * don't want to supply such a function.
+ * @value_destroy_func: a function to free the memory allocated for the
+ * value used when removing the entry from the #GHashTable or %NULL if
+ * you don't want to supply such a function.
+ *
+ * Creates a new #GHashTable like g_hash_table_new() and allows to specify
+ * functions to free the memory allocated for the key and value that get
+ * called when removing the entry from the #GHashTable.
+ *
+ * Return value: a new #GHashTable.
+ **/
+MonoGHashTable*
+mono_g_hash_table_new_full (GHashFunc hash_func,
+ GEqualFunc key_equal_func,
+ GDestroyNotify key_destroy_func,
+ GDestroyNotify value_destroy_func)
+{
+ MonoGHashTable *hash_table;
+
+#if HAVE_BOEHM_GC
+ hash_table = GC_malloc (sizeof (MonoGHashTable));
+#else
+ hash_table = g_new (MonoGHashTable, 1);
+#endif
+ hash_table->size = HASH_TABLE_MIN_SIZE;
+ hash_table->nnodes = 0;
+ hash_table->hash_func = hash_func ? hash_func : g_direct_hash;
+ hash_table->key_equal_func = key_equal_func;
+ hash_table->key_destroy_func = key_destroy_func;
+ hash_table->value_destroy_func = value_destroy_func;
+#if HAVE_BOEHM_GC
+ hash_table->nodes = GC_malloc (sizeof (MonoGHashNode*) * hash_table->size);
+#else
+ hash_table->nodes = g_new0 (MonoGHashNode*, hash_table->size);
+#endif
+
+ return hash_table;
+}
+
+/**
+ * g_hash_table_destroy:
+ * @hash_table: a #GHashTable.
+ *
+ * Destroys the #GHashTable. If keys and/or values are dynamically
+ * allocated, you should either free them first or create the #GHashTable
+ * using g_hash_table_new_full(). In the latter case the destroy functions
+ * you supplied will be called on all keys and values before destroying
+ * the #GHashTable.
+ **/
+void
+mono_g_hash_table_destroy (MonoGHashTable *hash_table)
+{
+ guint i;
+
+ g_return_if_fail (hash_table != NULL);
+
+ for (i = 0; i < hash_table->size; i++)
+ g_hash_nodes_destroy (hash_table->nodes[i],
+ hash_table->key_destroy_func,
+ hash_table->value_destroy_func);
+
+#if HAVE_BOEHM_GC
+#else
+ g_free (hash_table->nodes);
+ g_free (hash_table);
+#endif
+}
+
+static inline MonoGHashNode**
+g_hash_table_lookup_node (MonoGHashTable *hash_table,
+ gconstpointer key)
+{
+ MonoGHashNode **node;
+
+ node = &hash_table->nodes
+ [(* hash_table->hash_func) (key) % hash_table->size];
+
+ /* Hash table lookup needs to be fast.
+ * We therefore remove the extra conditional of testing
+ * whether to call the key_equal_func or not from
+ * the inner loop.
+ */
+ if (hash_table->key_equal_func)
+ while (*node && !(*hash_table->key_equal_func) ((*node)->key, key))
+ node = &(*node)->next;
+ else
+ while (*node && (*node)->key != key)
+ node = &(*node)->next;
+
+ return node;
+}
+
+/**
+ * g_hash_table_lookup:
+ * @hash_table: a #GHashTable.
+ * @key: the key to look up.
+ *
+ * Looks up a key in a #GHashTable.
+ *
+ * Return value: the associated value, or %NULL if the key is not found.
+ **/
+gpointer
+mono_g_hash_table_lookup (MonoGHashTable *hash_table,
+ gconstpointer key)
+{
+ MonoGHashNode *node;
+
+ g_return_val_if_fail (hash_table != NULL, NULL);
+
+ node = *g_hash_table_lookup_node (hash_table, key);
+
+ return node ? node->value : NULL;
+}
+
+/**
+ * g_hash_table_lookup_extended:
+ * @hash_table: a #GHashTable.
+ * @lookup_key: the key to look up.
+ * @orig_key: returns the original key.
+ * @value: returns the value associated with the key.
+ *
+ * Looks up a key in the #GHashTable, returning the original key and the
+ * associated value and a #gboolean which is %TRUE if the key was found. This
+ * is useful if you need to free the memory allocated for the original key,
+ * for example before calling g_hash_table_remove().
+ *
+ * Return value: %TRUE if the key was found in the #GHashTable.
+ **/
+gboolean
+mono_g_hash_table_lookup_extended (MonoGHashTable *hash_table,
+ gconstpointer lookup_key,
+ gpointer *orig_key,
+ gpointer *value)
+{
+ MonoGHashNode *node;
+
+ g_return_val_if_fail (hash_table != NULL, FALSE);
+
+ node = *g_hash_table_lookup_node (hash_table, lookup_key);
+
+ if (node)
+ {
+ if (orig_key)
+ *orig_key = node->key;
+ if (value)
+ *value = node->value;
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+/**
+ * g_hash_table_insert:
+ * @hash_table: a #GHashTable.
+ * @key: a key to insert.
+ * @value: the value to associate with the key.
+ *
+ * Inserts a new key and value into a #GHashTable.
+ *
+ * If the key already exists in the #GHashTable its current value is replaced
+ * with the new value. If you supplied a @value_destroy_func when creating the
+ * #GHashTable, the old value is freed using that function. If you supplied
+ * a @key_destroy_func when creating the #GHashTable, the passed key is freed
+ * using that function.
+ **/
+void
+mono_g_hash_table_insert (MonoGHashTable *hash_table,
+ gpointer key,
+ gpointer value)
+{
+ MonoGHashNode **node;
+
+ g_return_if_fail (hash_table != NULL);
+
+ node = g_hash_table_lookup_node (hash_table, key);
+
+ if (*node)
+ {
+ /* do not reset node->key in this place, keeping
+ * the old key is the intended behaviour.
+ * g_hash_table_replace() can be used instead.
+ */
+
+ /* free the passed key */
+ if (hash_table->key_destroy_func)
+ hash_table->key_destroy_func (key);
+
+ if (hash_table->value_destroy_func)
+ hash_table->value_destroy_func ((*node)->value);
+
+ (*node)->value = value;
+ }
+ else
+ {
+ *node = g_hash_node_new (key, value);
+ hash_table->nnodes++;
+ G_HASH_TABLE_RESIZE (hash_table);
+ }
+}
+
+/**
+ * g_hash_table_replace:
+ * @hash_table: a #GHashTable.
+ * @key: a key to insert.
+ * @value: the value to associate with the key.
+ *
+ * Inserts a new key and value into a #GHashTable similar to
+ * g_hash_table_insert(). The difference is that if the key already exists
+ * in the #GHashTable, it gets replaced by the new key. If you supplied a
+ * @value_destroy_func when creating the #GHashTable, the old value is freed
+ * using that function. If you supplied a @key_destroy_func when creating the
+ * #GHashTable, the old key is freed using that function.
+ **/
+void
+mono_g_hash_table_replace (MonoGHashTable *hash_table,
+ gpointer key,
+ gpointer value)
+{
+ MonoGHashNode **node;
+
+ g_return_if_fail (hash_table != NULL);
+
+ node = g_hash_table_lookup_node (hash_table, key);
+
+ if (*node)
+ {
+ if (hash_table->key_destroy_func)
+ hash_table->key_destroy_func ((*node)->key);
+
+ if (hash_table->value_destroy_func)
+ hash_table->value_destroy_func ((*node)->value);
+
+ (*node)->key = key;
+ (*node)->value = value;
+ }
+ else
+ {
+ *node = g_hash_node_new (key, value);
+ hash_table->nnodes++;
+ G_HASH_TABLE_RESIZE (hash_table);
+ }
+}
+
+/**
+ * g_hash_table_remove:
+ * @hash_table: a #GHashTable.
+ * @key: the key to remove.
+ *
+ * Removes a key and its associated value from a #GHashTable.
+ *
+ * If the #GHashTable was created using g_hash_table_new_full(), the
+ * key and value are freed using the supplied destroy functions, otherwise
+ * you have to make sure that any dynamically allocated values are freed
+ * yourself.
+ *
+ * Return value: %TRUE if the key was found and removed from the #GHashTable.
+ **/
+gboolean
+mono_g_hash_table_remove (MonoGHashTable *hash_table,
+ gconstpointer key)
+{
+ MonoGHashNode **node, *dest;
+
+ g_return_val_if_fail (hash_table != NULL, FALSE);
+
+ node = g_hash_table_lookup_node (hash_table, key);
+ if (*node)
+ {
+ dest = *node;
+ (*node) = dest->next;
+ g_hash_node_destroy (dest,
+ hash_table->key_destroy_func,
+ hash_table->value_destroy_func);
+ hash_table->nnodes--;
+
+ G_HASH_TABLE_RESIZE (hash_table);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ * g_hash_table_steal:
+ * @hash_table: a #GHashTable.
+ * @key: the key to remove.
+ *
+ * Removes a key and its associated value from a #GHashTable without
+ * calling the key and value destroy functions.
+ *
+ * Return value: %TRUE if the key was found and removed from the #GHashTable.
+ **/
+gboolean
+mono_g_hash_table_steal (MonoGHashTable *hash_table,
+ gconstpointer key)
+{
+ MonoGHashNode **node, *dest;
+
+ g_return_val_if_fail (hash_table != NULL, FALSE);
+
+ node = g_hash_table_lookup_node (hash_table, key);
+ if (*node)
+ {
+ dest = *node;
+ (*node) = dest->next;
+ g_hash_node_destroy (dest, NULL, NULL);
+ hash_table->nnodes--;
+
+ G_HASH_TABLE_RESIZE (hash_table);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/**
+ * g_hash_table_foreach_remove:
+ * @hash_table: a #GHashTable.
+ * @func: the function to call for each key/value pair.
+ * @user_data: user data to pass to the function.
+ *
+ * Calls the given function for each key/value pair in the #GHashTable.
+ * If the function returns %TRUE, then the key/value pair is removed from the
+ * #GHashTable. If you supplied key or value destroy functions when creating
+ * the #GHashTable, they are used to free the memory allocated for the removed
+ * keys and values.
+ *
+ * Return value: the number of key/value pairs removed.
+ **/
+guint
+mono_g_hash_table_foreach_remove (MonoGHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data)
+{
+ g_return_val_if_fail (hash_table != NULL, 0);
+ g_return_val_if_fail (func != NULL, 0);
+
+ return g_hash_table_foreach_remove_or_steal (hash_table, func, user_data, TRUE);
+}
+
+/**
+ * g_hash_table_foreach_steal:
+ * @hash_table: a #GHashTable.
+ * @func: the function to call for each key/value pair.
+ * @user_data: user data to pass to the function.
+ *
+ * Calls the given function for each key/value pair in the #GHashTable.
+ * If the function returns %TRUE, then the key/value pair is removed from the
+ * #GHashTable, but no key or value destroy functions are called.
+ *
+ * Return value: the number of key/value pairs removed.
+ **/
+guint
+mono_g_hash_table_foreach_steal (MonoGHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data)
+{
+ g_return_val_if_fail (hash_table != NULL, 0);
+ g_return_val_if_fail (func != NULL, 0);
+
+ return g_hash_table_foreach_remove_or_steal (hash_table, func, user_data, FALSE);
+}
+
+static guint
+g_hash_table_foreach_remove_or_steal (MonoGHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data,
+ gboolean notify)
+{
+ MonoGHashNode *node, *prev;
+ guint i;
+ guint deleted = 0;
+
+ for (i = 0; i < hash_table->size; i++)
+ {
+ restart:
+
+ prev = NULL;
+
+ for (node = hash_table->nodes[i]; node; prev = node, node = node->next)
+ {
+ if ((* func) (node->key, node->value, user_data))
+ {
+ deleted += 1;
+
+ hash_table->nnodes -= 1;
+
+ if (prev)
+ {
+ prev->next = node->next;
+ g_hash_node_destroy (node,
+ notify ? hash_table->key_destroy_func : NULL,
+ notify ? hash_table->value_destroy_func : NULL);
+ node = prev;
+ }
+ else
+ {
+ hash_table->nodes[i] = node->next;
+ g_hash_node_destroy (node,
+ notify ? hash_table->key_destroy_func : NULL,
+ notify ? hash_table->value_destroy_func : NULL);
+ goto restart;
+ }
+ }
+ }
+ }
+
+ G_HASH_TABLE_RESIZE (hash_table);
+
+ return deleted;
+}
+
+/**
+ * g_hash_table_foreach:
+ * @hash_table: a #GHashTable.
+ * @func: the function to call for each key/value pair.
+ * @user_data: user data to pass to the function.
+ *
+ * Calls the given function for each of the key/value pairs in the
+ * #GHashTable. The function is passed the key and value of each
+ * pair, and the given @user_data parameter. The hash table may not
+ * be modified while iterating over it (you can't add/remove
+ * items). To remove all items matching a predicate, use
+ * g_hash_table_remove().
+ **/
+void
+mono_g_hash_table_foreach (MonoGHashTable *hash_table,
+ GHFunc func,
+ gpointer user_data)
+{
+ MonoGHashNode *node;
+ gint i;
+
+ g_return_if_fail (hash_table != NULL);
+ g_return_if_fail (func != NULL);
+
+ for (i = 0; i < hash_table->size; i++)
+ for (node = hash_table->nodes[i]; node; node = node->next)
+ (* func) (node->key, node->value, user_data);
+}
+
+/**
+ * g_hash_table_size:
+ * @hash_table: a #GHashTable.
+ *
+ * Returns the number of elements contained in the #GHashTable.
+ *
+ * Return value: the number of key/value pairs in the #GHashTable.
+ **/
+guint
+mono_g_hash_table_size (MonoGHashTable *hash_table)
+{
+ g_return_val_if_fail (hash_table != NULL, 0);
+
+ return hash_table->nnodes;
+}
+
+static void
+g_hash_table_resize (MonoGHashTable *hash_table)
+{
+ MonoGHashNode **new_nodes;
+ MonoGHashNode *node;
+ MonoGHashNode *next;
+ guint hash_val;
+ gint new_size;
+ gint i;
+
+ new_size = g_spaced_primes_closest (hash_table->nnodes);
+ new_size = CLAMP (new_size, HASH_TABLE_MIN_SIZE, HASH_TABLE_MAX_SIZE);
+
+#if HAVE_BOEHM_GC
+ new_nodes = GC_malloc (sizeof (MonoGHashNode*) * new_size);
+#else
+ new_nodes = g_new0 (MonoGHashNode*, new_size);
+#endif
+
+ for (i = 0; i < hash_table->size; i++)
+ for (node = hash_table->nodes[i]; node; node = next)
+ {
+ next = node->next;
+
+ hash_val = (* hash_table->hash_func) (node->key) % new_size;
+
+ node->next = new_nodes[hash_val];
+ new_nodes[hash_val] = node;
+ }
+
+#if HAVE_BOEHM_GC
+#else
+ g_free (hash_table->nodes);
+#endif
+ hash_table->nodes = new_nodes;
+ hash_table->size = new_size;
+}
+
+static MonoGHashNode*
+g_hash_node_new (gpointer key,
+ gpointer value)
+{
+ MonoGHashNode *hash_node;
+
+ G_LOCK (g_hash_global);
+ if (node_free_list)
+ {
+ hash_node = node_free_list;
+ node_free_list = node_free_list->next;
+ }
+ else
+ {
+#if HAVE_BOEHM_GC
+ hash_node = GC_malloc (sizeof (MonoGHashNode));
+#else
+ if (!node_mem_chunk)
+ node_mem_chunk = g_mem_chunk_new ("hash node mem chunk",
+ sizeof (MonoGHashNode),
+ 1024, G_ALLOC_ONLY);
+
+ hash_node = g_chunk_new (MonoGHashNode, node_mem_chunk);
+#endif
+ }
+ G_UNLOCK (g_hash_global);
+
+ hash_node->key = key;
+ hash_node->value = value;
+ hash_node->next = NULL;
+
+ return hash_node;
+}
+
+static void
+g_hash_node_destroy (MonoGHashNode *hash_node,
+ GDestroyNotify key_destroy_func,
+ GDestroyNotify value_destroy_func)
+{
+ if (key_destroy_func)
+ key_destroy_func (hash_node->key);
+ if (value_destroy_func)
+ value_destroy_func (hash_node->value);
+
+ hash_node->key = NULL;
+ hash_node->value = NULL;
+
+ G_LOCK (g_hash_global);
+ hash_node->next = node_free_list;
+ node_free_list = hash_node;
+ G_UNLOCK (g_hash_global);
+}
+
+static void
+g_hash_nodes_destroy (MonoGHashNode *hash_node,
+ GFreeFunc key_destroy_func,
+ GFreeFunc value_destroy_func)
+{
+ if (hash_node)
+ {
+ MonoGHashNode *node = hash_node;
+
+ while (node->next)
+ {
+ if (key_destroy_func)
+ key_destroy_func (node->key);
+ if (value_destroy_func)
+ value_destroy_func (node->value);
+
+ node->key = NULL;
+ node->value = NULL;
+
+ node = node->next;
+ }
+
+ if (key_destroy_func)
+ key_destroy_func (node->key);
+ if (value_destroy_func)
+ value_destroy_func (node->value);
+
+ node->key = NULL;
+ node->value = NULL;
+
+ G_LOCK (g_hash_global);
+ node->next = node_free_list;
+ node_free_list = hash_node;
+ G_UNLOCK (g_hash_global);
+ }
+}
diff --git a/mono/utils/mono-hash.h b/mono/utils/mono-hash.h
new file mode 100644
index 00000000000..c76f7ca2620
--- /dev/null
+++ b/mono/utils/mono-hash.h
@@ -0,0 +1,81 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __MONO_G_HASH_H__
+#define __MONO_G_HASH_H__
+
+/*
+ * Imported in mono cvs from version 1.7 of gnome cvs.
+ * This hash table is GC friendly and the pointers stored in it
+ * are tracked by the garbage collector.
+ */
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct _MonoGHashTable MonoGHashTable;
+
+/* Hash tables
+ */
+MonoGHashTable* mono_g_hash_table_new (GHashFunc hash_func,
+ GEqualFunc key_equal_func);
+MonoGHashTable* mono_g_hash_table_new_full (GHashFunc hash_func,
+ GEqualFunc key_equal_func,
+ GDestroyNotify key_destroy_func,
+ GDestroyNotify value_destroy_func);
+void mono_g_hash_table_destroy (MonoGHashTable *hash_table);
+void mono_g_hash_table_insert (MonoGHashTable *hash_table,
+ gpointer key,
+ gpointer value);
+void mono_g_hash_table_replace (MonoGHashTable *hash_table,
+ gpointer key,
+ gpointer value);
+gboolean mono_g_hash_table_remove (MonoGHashTable *hash_table,
+ gconstpointer key);
+gboolean mono_g_hash_table_steal (MonoGHashTable *hash_table,
+ gconstpointer key);
+gpointer mono_g_hash_table_lookup (MonoGHashTable *hash_table,
+ gconstpointer key);
+gboolean mono_g_hash_table_lookup_extended (MonoGHashTable *hash_table,
+ gconstpointer lookup_key,
+ gpointer *orig_key,
+ gpointer *value);
+void mono_g_hash_table_foreach (MonoGHashTable *hash_table,
+ GHFunc func,
+ gpointer user_data);
+guint mono_g_hash_table_foreach_remove (MonoGHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data);
+guint mono_g_hash_table_foreach_steal (MonoGHashTable *hash_table,
+ GHRFunc func,
+ gpointer user_data);
+guint mono_g_hash_table_size (MonoGHashTable *hash_table);
+
+G_END_DECLS
+
+#endif /* __MONO_G_HASH_H__ */
+
diff --git a/mono/wrapper/.cvsignore b/mono/wrapper/.cvsignore
new file mode 100644
index 00000000000..0bd1e9e5d3d
--- /dev/null
+++ b/mono/wrapper/.cvsignore
@@ -0,0 +1,9 @@
+Makefile
+Makefile.in
+.deps
+.libs
+wrapper.h
+*.lo
+*.la
+Wrapper.cs
+libmonowrapper.def
diff --git a/mono/wrapper/ChangeLog b/mono/wrapper/ChangeLog
new file mode 100644
index 00000000000..00fbfbc9173
--- /dev/null
+++ b/mono/wrapper/ChangeLog
@@ -0,0 +1,61 @@
+2002-02-20 Dick Porter <dick@ximian.com>
+
+ * Makefile.am:
+ * wrapper.c: Windows portability fixes (sometimes just ifdeffing
+ problem code out for now).
+
+2002-02-16 Jeffrey Stedfast <fejj@ximian.com>
+
+ * wrapper.c (mono_wrapper_fstat): The MonoWrapperStat namespace is
+ mst_ now, so update this code. Also fix a copy/paste-o that
+ assigned st.st_ctime to buf->mst_mtime.
+ (mono_wrapper_stat): Same here.
+
+ * genwrapper.pl: Solaris does some nasty macro hadckery action for
+ st_[a,c,m]time and so lets namespace our wrapper members as
+ mst_[a,c,m]time to avoid namespace problems.
+
+Sun Feb 10 14:18:50 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * genwrapper.pl: use pkg-config instead of glib-config (pointed out by
+ Eric Molitor <eric@brainfood.com>).
+
+2002-01-31 Dietmar Maurer <dietmar@ximian.com>
+
+ * wrapper.c (mono_wrapper_readdir): ugly hack - we must return a String
+ instead of a char*
+
+Thu Jan 24 17:41:06 CET 2002 Paolo Molaro <lupus@ximian.com>
+
+ * glob.c: fix typo.
+
+2002-01-23 Miguel de Icaza <miguel@ximian.com>
+
+ * glob.c (mono_glob_compile): Make the glob expression contain ^
+ and $ at the beginning and end respectively.
+
+ * genwrapper.pl: Added wrappers for the mono_glob functions.
+
+ * glob.c: New file, with globing functions used by the Directory
+ code.
+
+ * wrapper.c: Changed things so that we can propagate ERRNO back.
+
+ Include stdio.h and unistd.h to remove a couple of warnings.
+
+ * genwrapper.pl: Added support for flagging non-CLS compliant
+ classes and structs with CLSCompliant(false).
+
+ Added mkdir, rmdir and rename wrappers.
+
+2001-09-20 Dietmar Maurer <dietmar@ximian.com>
+
+ * wrapper.c: added declaration of environ
+
+2001-09-07 Nick Drochak <ndrochak@gol.com>
+
+ * Makefile.am: Use '=' to set CLEANFILES instead of '+=' since
+ it's the first assignment.
+
+ * ChangeLog: added this file.
+
diff --git a/mono/wrapper/Makefile.am b/mono/wrapper/Makefile.am
new file mode 100644
index 00000000000..43357f1307e
--- /dev/null
+++ b/mono/wrapper/Makefile.am
@@ -0,0 +1,44 @@
+lib_LTLIBRARIES = libmonowrapper.la
+
+INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)
+
+if PLATFORM_WIN32
+# glob.c doesnt build under windows
+SRC= \
+ wrapper.c \
+ #
+else
+SRC= \
+ glob.c \
+ wrapper.c \
+ #
+endif
+
+libmonowrapper_la_SOURCES = $(SRC)
+
+libmonowrapperincludedir = $(includedir)/mono/wrapper
+
+libmonowrapperinclude_HEADERS =
+ wrapper.h
+
+noinst_HEADERS =
+
+libmonowrapper.def: genwrapper.pl
+ $(srcdir)/genwrapper.pl -d >libmonowrapper.def
+
+Wrapper.cs: genwrapper.pl
+ $(srcdir)/genwrapper.pl -c >Wrapper.cs
+
+libmonowrapper.dll: $(libmonowrapper_la_OBJECTS) libmonowrapper.rc libmonowrapper.def
+ ./build-dll libmonowrapper 0.1
+
+
+wrapper.h: genwrapper.pl
+ $(srcdir)/genwrapper.pl >wrapper.h
+
+BUILT_SOURCES = wrapper.h Wrapper.cs libmonowrapper.def
+
+CLEANFILES = $(BUILT_SOURCES) lib*.a lib*.dll
+
+EXTRA_DIST = genwrapper.pl
+
diff --git a/mono/wrapper/build-dll b/mono/wrapper/build-dll
new file mode 100755
index 00000000000..ac223d1fd42
--- /dev/null
+++ b/mono/wrapper/build-dll
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+# Temporary hack until building dlls is easier with gcc -mno-cygwin
+# ("mingw32").
+
+# This is usable with cygwin 1.1.x and gcc-2.95.2 for mingw as
+# distributed by Mumit Khan. For other combinations, no idea.
+
+GCC="gcc"
+DLLTOOL="dlltool"
+AS=as
+
+library=$1; shift
+version=$1; shift;
+def=$1; shift
+ldargs="$*"
+
+defswitch=""
+[ -n "$def" -a "$def" != '-' ] && defswitch="--def $def"
+
+libname=$library
+[ $version != '-' ] && libname=$library-$version
+dllfile=$libname.dll
+
+for F in $ldargs; do
+ case $F in
+ *.[ao]) objs="$objs $F";;
+ esac
+done
+
+# Check if we have a resource file for this DLL.
+resfile=""
+if [ -f $library.rc ]; then
+ resfile=$library-win32res.o
+ objs="$objs $resfile"
+ ldargs="$ldargs $resfile"
+
+ # Check if we have a build number stamp file.
+ if [ -f $library-build.stamp ]; then
+ read number <$library-build.stamp
+ buildnumber=$[number+1]
+ echo Build number is $buildnumber
+ echo $buildnumber >$library-build.stamp
+ else
+ echo Using zero as build number
+ buildnumber=0
+ fi
+
+ m4 -DBUILDNUMBER=$buildnumber <$library.rc >$library-win32res.rc
+ windres $library-win32res.rc $library-win32res.o
+ rm $library-win32res.rc
+fi
+
+# Build the DLL.
+
+$GCC -mdll -mno-cygwin -Wl,--base-file,$library.base -o $dllfile $ldargs &&
+$DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
+$GCC -mdll -mno-cygwin -Wl,--base-file,$library.base,$library.exp -o $dllfile $ldargs &&
+$DLLTOOL --as=$AS --dllname $dllfile $defswitch --base-file $library.base --output-exp $library.exp $objs &&
+$GCC -mdll -mno-cygwin -Wl,$library.exp -o $dllfile $ldargs &&
+$DLLTOOL --as=$AS --dllname $dllfile $defswitch --output-lib lib$libname.a $objs
+
+# Finally, also build import libraries for the Microsoft linker. You
+# will either need to have some decent version of MSVC, or get lib.exe
+# (and link.exe) from the (freely downloadable) Microsoft Platform SDK.
+
+if type -p lib.exe && [ -n "$def" -a "$def" != '-' ]; then
+ lib -name:$libname.dll -def:$def -out:$libname.lib
+fi
+
+rm $library.base $library.exp 2>/dev/null
diff --git a/mono/wrapper/genwrapper.pl b/mono/wrapper/genwrapper.pl
new file mode 100755
index 00000000000..15641aa59dc
--- /dev/null
+++ b/mono/wrapper/genwrapper.pl
@@ -0,0 +1,528 @@
+#!/usr/bin/perl
+
+# Author:
+# Dietmar Maurer (dietmar@ximian.com)
+#
+# (C) 2001 Ximian, Inc.
+
+use Getopt::Long;
+init();
+
+if ($ENV{"OSTYPE"} eq "cygwin") {
+@includes = ("sys/types.h", "sys/stat.h", "unistd.h", "fcntl.h", "glib.h",
+ "errno.h");
+} else {
+@includes = ("sys/types.h", "sys/stat.h", "unistd.h", "fcntl.h", "glib.h",
+ "errno.h");
+}
+
+$cflags = `pkg-config --cflags glib-2.0`;
+$cflags =~ s/\n//;
+
+$lib = "monowrapper";
+
+if ($csmode){
+ $res_struct .= "[CLSCompliant(false)]\n";
+}
+create_struct ("MonoWrapperStat", "stat",
+ "uint", "mst_dev",
+ "uint", "mst_mode",
+ "uint", "mst_nlink",
+ "uint", "mst_uid",
+ "uint", "mst_gid",
+ "long", "mst_size",
+ "uint", "mst_atime",
+ "uint", "mst_mtime",
+ "uint", "mst_ctime",
+ );
+
+create_func ($lib, "", "seek", "long",
+ "IntPtr", "fd",
+ "long", "offset",
+ "int", "whence");
+
+create_func ($lib, "", "mkdir", "int",
+ "string", "path",
+ "int", "mode");
+
+create_func ($lib, "", "rmdir", "int",
+ "string", "path");
+
+create_func ($lib, "", "read", "int",
+ "IntPtr", "fd",
+ "void *", "buf",
+ "int", "count");
+
+create_func ($lib, "", "write", "int",
+ "IntPtr", "fd",
+ "void *", "buf",
+ "int", "count");
+
+create_func ($lib, "", "fstat", "int",
+ "IntPtr", "fd",
+ "stat *", "buf");
+
+create_func ($lib, "", "ftruncate", "int",
+ "IntPtr", "fd",
+ "long", "length");
+
+create_func ($lib, "", "open", "IntPtr",
+ "string", "path",
+ "int", "flags",
+ "int", "mode");
+
+create_func ($lib, "", "close", "int",
+ "IntPtr", "fd");
+
+create_func ($lib, "", "stat", "int",
+ "string", "path",
+ "stat *", "buf");
+
+create_func ($lib, "", "unlink", "int",
+ "string", "path");
+
+create_func ($lib, "", "opendir", "IntPtr",
+ "string", "path");
+
+create_func ($lib, "", "readdir", "string",
+ "IntPtr", "dir");
+
+create_func ($lib, "", "closedir", "int",
+ "IntPtr", "dir");
+
+create_func ($lib, "", "getenv", "IntPtr",
+ "string", "variable");
+
+create_func ($lib, "", "environ", "IntPtr");
+
+create_func ($lib, "", "rename", "int",
+ "string", "source",
+ "string", "target");
+
+create_func ($lib, "", "utime", "int",
+ "string", "path",
+ "int", "atime",
+ "int", "mtime");
+
+create_func ($lib, "mono_glob_compile", "mono_glob_compile", "IntPtr",
+ "string", "glob");
+
+create_func ($lib, "mono_glob_match", "mono_glob_match", "int",
+ "IntPtr", "handle",
+ "string", "str");
+
+create_func ($lib, "mono_glob_dispose", "mono_glob_dispose", "void",
+ "IntPtr", "handle");
+
+map_const ("int", "%d", "SEEK_SET",
+ "int", "%d", "SEEK_CUR",
+ "int", "%d", "SEEK_END",
+
+ "int", "0x%08x", "O_RDONLY",
+ "int", "0x%08x", "O_WRONLY",
+ "int", "0x%08x", "O_RDWR",
+ "int", "0x%08x", "O_CREAT",
+ "int", "0x%08x", "O_EXCL",
+ "int", "0x%08x", "O_NOCTTY",
+ "int", "0x%08x", "O_TRUNC",
+ "int", "0x%08x", "O_SYNC",
+ "int", "0x%08x", "O_APPEND",
+
+ "int", "0x%08x", "STDIN_FILENO",
+ "int", "0x%08x", "STDOUT_FILENO",
+ "int", "0x%08x", "STDERR_FILENO",
+
+ "int", "0x%08x", "S_IFMT",
+ "int", "0x%08x", "S_IFSOCK",
+ "int", "0x%08x", "S_IFLNK",
+ "int", "0x%08x", "S_IFREG",
+ "int", "0x%08x", "S_IFBLK",
+ "int", "0x%08x", "S_IFDIR",
+ "int", "0x%08x", "S_IFCHR",
+ "int", "0x%08x", "S_IFIFO",
+ "int", "0x%08x", "S_ISUID",
+ "int", "0x%08x", "S_ISGID",
+ "int", "0x%08x", "S_ISVTX",
+ "int", "0x%08x", "S_IRWXU",
+ "int", "0x%08x", "S_IRUSR",
+ "int", "0x%08x", "S_IWUSR",
+ "int", "0x%08x", "S_IXUSR",
+ "int", "0x%08x", "S_IRWXG",
+ "int", "0x%08x", "S_IRGRP",
+ "int", "0x%08x", "S_IWGRP",
+ "int", "0x%08x", "S_IXGRP",
+ "int", "0x%08x", "S_IRWXO",
+ "int", "0x%08x", "S_IROTH",
+ "int", "0x%08x", "S_IWOTH",
+ "int", "0x%08x", "S_IXOTH",
+
+ "int", "%d", "EPERM",
+ "int", "%d", "ENOENT",
+ "int", "%d", "ESRCH",
+ "int", "%d", "EINTR",
+ "int", "%d", "EIO",
+ "int", "%d", "ENXIO",
+ "int", "%d", "E2BIG",
+ "int", "%d", "ENOEXEC",
+ "int", "%d", "EBADF",
+ "int", "%d", "ECHILD",
+ "int", "%d", "EAGAIN",
+ "int", "%d", "ENOMEM",
+ "int", "%d", "EACCES",
+ "int", "%d", "EFAULT",
+ "int", "%d", "ENOTBLK",
+ "int", "%d", "EBUSY",
+ "int", "%d", "EEXIST",
+ "int", "%d", "EXDEV",
+ "int", "%d", "ENODEV",
+ "int", "%d", "EISDIR",
+ "int", "%d", "EINVAL",
+ "int", "%d", "ENFILE",
+ "int", "%d", "EMFILE",
+ "int", "%d", "ENOTTY",
+ "int", "%d", "ETXTBSY",
+ "int", "%d", "EFBIG",
+ "int", "%d", "ENOSPC",
+ "int", "%d", "ESPIPE",
+ "int", "%d", "EROFS",
+ "int", "%d", "EMLINK",
+ "int", "%d", "EPIPE",
+ "int", "%d", "EDOM",
+ "int", "%d", "ERANGE",
+ "int", "%d", "EDEADLK",
+ "int", "%d", "ENAMETOOLONG",
+ "int", "%d", "ENOLCK",
+ "int", "%d", "ENOSYS",
+ "int", "%d", "ENOTEMPTY",
+ "int", "%d", "ELOOP",
+ "int", "%d", "EWOULDBLOCK",
+ "int", "%d", "ENOMSG",
+ "int", "%d", "EIDRM",
+ "int", "%d", "ECHRNG",
+ "int", "%d", "EL2NSYNC",
+ "int", "%d", "EL3HLT",
+ "int", "%d", "EL3RST",
+ "int", "%d", "ELNRNG",
+ "int", "%d", "EUNATCH",
+ "int", "%d", "ENOCSI",
+ "int", "%d", "EL2HLT",
+ "int", "%d", "EBADE",
+ "int", "%d", "EBADR",
+ "int", "%d", "EXFULL",
+ "int", "%d", "ENOANO",
+ "int", "%d", "EBADRQC",
+ "int", "%d", "EBADSLT",
+ "int", "%d", "EDEADLOCK",
+ "int", "%d", "EBFONT",
+ "int", "%d", "ENOSTR",
+ "int", "%d", "ENODATA",
+ "int", "%d", "ETIME",
+ "int", "%d", "ENOSR",
+ "int", "%d", "ENONET",
+ "int", "%d", "ENOPKG",
+ "int", "%d", "EREMOTE",
+ "int", "%d", "ENOLINK",
+ "int", "%d", "EADV",
+ "int", "%d", "ESRMNT",
+ "int", "%d", "ECOMM",
+ "int", "%d", "EPROTO",
+ "int", "%d", "EMULTIHOP",
+ "int", "%d", "EDOTDOT",
+ "int", "%d", "EBADMSG",
+ "int", "%d", "ENOTUNIQ",
+ "int", "%d", "EBADFD",
+ "int", "%d", "EREMCHG",
+ "int", "%d", "ELIBACC",
+ "int", "%d", "ELIBBAD",
+ "int", "%d", "ELIBSCN",
+ "int", "%d", "ELIBMAX",
+ "int", "%d", "ELIBEXEC",
+ "int", "%d", "EUSERS",
+ "int", "%d", "ENOTSOCK",
+ "int", "%d", "EDESTADDRREQ",
+ "int", "%d", "EMSGSIZE",
+ "int", "%d", "EPROTOTYPE",
+ "int", "%d", "ENOPROTOOPT",
+ "int", "%d", "EPROTONOSUPPORT",
+ "int", "%d", "ESOCKTNOSUPPORT",
+ "int", "%d", "EOPNOTSUPP",
+ "int", "%d", "EPFNOSUPPORT",
+ "int", "%d", "EAFNOSUPPORT",
+ "int", "%d", "EADDRINUSE",
+ "int", "%d", "EADDRNOTAVAIL",
+ "int", "%d", "ENETDOWN",
+ "int", "%d", "ENETUNREACH",
+ "int", "%d", "ENETRESET",
+ "int", "%d", "ECONNABORTED",
+ "int", "%d", "ECONNRESET",
+ "int", "%d", "ENOBUFS",
+ "int", "%d", "EISCONN",
+ "int", "%d", "ENOTCONN",
+ "int", "%d", "ESHUTDOWN",
+ "int", "%d", "ETOOMANYREFS",
+ "int", "%d", "ETIMEDOUT",
+ "int", "%d", "ECONNREFUSED",
+ "int", "%d", "EHOSTDOWN",
+ "int", "%d", "EHOSTUNREACH",
+ "int", "%d", "EALREADY",
+ "int", "%d", "EINPROGRESS",
+ "int", "%d", "ESTALE",
+ "int", "%d", "EDQUOT",
+ "int", "%d", "ENOMEDIUM",
+ "int", "%d", "ENOTDIR",
+ );
+
+sub init {
+
+ $csmode = 0;
+ $defmode = 0;
+
+ GetOptions ("c|csharp" => \$csmode,
+ "d|defmode" => \$defmode) or die "cant parse options";
+
+ $CC = $env{"CC"};
+
+ if (!$CC) {
+ $CC = "gcc";
+ }
+
+
+ %tmap = ("void" => "void",
+ "IntPtr" => "gpointer",
+ "sbyte" => "gint8",
+ "byte" => "guint8",
+ "short" => "gint16",
+ "ushort" => "guint16",
+ "int" => "gint32",
+ "uint" => "guint32",
+ "long" => "gint64",
+ "ulong" => "guint64",
+ "string" => "const char *",
+ );
+}
+
+sub t {
+ my ($name) = @_;
+ my ($rname) = $name;
+
+ if ($name =~ m/(.*)\*\s*$/) {
+ $rname = $1;
+ $rname =~ s/\s+$//; # remove trailing spaces
+ $rval = $tmap{$rname} || die "unable to map type \"$name\"";
+ return "$rval*";
+ }
+
+ $rval = $tmap{$name} || die "unable to map type \"$name\"";
+
+}
+
+sub create_func {
+ my (@func) = @_;
+ my ($i) = 0;
+ my ($res) = "";
+ my ($cls) = 1;
+ my ($j) = 4;
+ while ($j <= $#func){
+ if ($func[$j] =~ /\*/){
+ $cls = 0;
+ }
+ $j+=2;
+ }
+
+ if ($func[1] eq "") {
+ $func[1] = "mono_wrapper_$func[2]";
+ }
+
+ if ($defmode) {
+ $dlldef .= "\t$func[1]\n";
+ }
+
+ if ($csmode) {
+
+ $res = "\t[DllImport(\"$func[0]\", EntryPoint=\"$func[1]\", CharSet=CharSet.Ansi)]\n";
+ if ($cls == 0){
+ $res .= "\t[CLSCompliant(false)]\n";
+ }
+ $res .= "\tpublic unsafe static extern $func[3] $func[2] (";
+ $i +=4;
+ while ($i <= $#func) {
+ if ($i>4) {
+ $res .= ", ";
+ }
+ $res .= "$func[$i] $func[$i+1]";
+
+ $i+=2;
+ }
+ $res .= ");\n\n";
+
+ $res_func .= $res;
+
+ } else {
+
+ $res = t($func[3]) . "\n$func[1] (";
+
+ $i +=4;
+ while ($i <= $#func) {
+ if ($i>4) {
+ $res .= ", ";
+ }
+ $res .= t($func[$i]) . " $func[$i+1]";
+
+ $i+=2;
+ }
+ $res .= ");\n\n";
+
+ $res_func .= $res;
+ }
+}
+
+sub create_struct {
+ my (@str) = @_;
+ my ($i) = 0;
+ my ($res) = "";
+
+ if ($csmode) {
+ $res = "public struct $str[1] {\n";
+ $i +=2;
+ while ($i <= $#str) {
+ $res .= "\tpublic $str[$i] $str[$i+1];\n";
+ $i+=2;
+ }
+ $res .= "};\n\n";
+ } else {
+ $res = "typedef struct {\n";
+ $i += 2;
+ while ($i <= $#str) {
+ $res .= "\t" . t($str[$i]) . " $str[$i+1];\n";
+ $i+=2;
+ }
+ $res .= "} $str[0];\n\n";
+ }
+
+ $tmap{"$str[1]"} = "$str[0]";
+
+ $res_struct .= $res;
+}
+
+sub map_const {
+ my (@co) = @_;
+ my ($res) = "";
+ my ($l);
+ my ($space);
+
+ if (!$csmode) {
+ return;
+ }
+
+ my ($tfn) = "/tmp/etypes$$.c";
+
+ open (TFN, ">$tfn") || die (0);
+
+ for ($i = 0; $i <= $#includes; $i++) {
+ print TFN "#include \"$includes[$i]\"\n";
+ }
+
+ print TFN "\nint main () {\n";
+ for ($i = 0; $i <= $#co; $i+=3) {
+
+ $l = 20 - length($co[$i+2]);
+
+ $space = "";
+ for (my ($j) = 0; $j < $l; $j++) {
+ $space = $space . " ";
+ }
+
+ print TFN "printf (\"\\tpublic const %s %s $space= $co[$i+1];\\n\",".
+ " \"$co[$i]\", \"$co[$i+2]\", $co[$i+2]);\n";
+
+ }
+ print TFN "exit (-1);\n";
+ print TFN "}\n";
+
+ close (TFN);
+
+ system ("$CC $cflags $tfn -o conftest.exe") == 0
+ or die "calling c compiler failed";
+
+ system ("rm $tfn");
+
+ $res = `./conftest.exe`;
+
+ if (!$res) {
+ die "calling a.out failde";
+ }
+
+ $res_const = $res_const . $res;
+
+ system ("rm ./conftest.exe");
+}
+
+sub etypes_end {
+
+ @ae = split (/\./, $__class);
+
+ print $res_struct;
+
+ print "public class $ae[$#ae] {\n\n";
+
+ if ($res_const) {
+ print "$res_const\n\n";
+ }
+
+ print "$res_func";
+
+ printf "} // class $ae[$#ae]\n\n";
+
+ for ($i = $#ae - 1; $i >= 0; $i--) {
+ print "} // namescape $ae[$i]\n";
+ }
+
+}
+
+print "/*\n * Generated automatically: do not edit this file.\n */\n\n";
+
+
+if ($csmode) {
+
+ print "using System;\n";
+ print "using System.Runtime.InteropServices;\n\n";
+
+ print "namespace System.Private {\n\n";
+
+ print $res_struct;
+
+ print "public class Wrapper {\n\n";
+
+ if ($res_const) {
+ print "$res_const\n\n";
+ }
+
+ print "$res_func";
+
+ print "}\n";
+
+ print "}\n";
+
+} elsif ($defmode) {
+
+ print "LIBRARY libmonowrapper\n";
+ print "EXPORTS\n";
+ print "\tDllMain\n";
+ print $dlldef;
+
+} else {
+
+ print "#ifndef _MONO_WRAPPER_H_\n#define _MONO_WRAPPER_H_ 1\n\n";
+
+ for ($i = 0; $i <= $#includes; $i++) {
+ print "#include <$includes[$i]>\n";
+ }
+
+ print "\n";
+
+ print $res_struct;
+
+ print $res_func;
+
+ print "#endif\n";
+}
diff --git a/mono/wrapper/glob.c b/mono/wrapper/glob.c
new file mode 100644
index 00000000000..90aabe079b8
--- /dev/null
+++ b/mono/wrapper/glob.c
@@ -0,0 +1,57 @@
+/*
+ * glob.c: Simple glob support for the class libraries
+ *
+ * Author:
+ * Miguel de Icaza (miguel@ximian.com).
+ *
+ * (C) 2002 Ximian, Inc.
+ */
+#include <sys/types.h>
+#include <glib.h>
+#include <config.h>
+#include <regex.h>
+#include "wrapper.h"
+
+gpointer
+mono_glob_compile (const char *glob)
+{
+ regex_t *compiled = g_new (regex_t, 1);
+ GString *str = g_string_new ("^");
+ const char *p;
+
+ for (p = glob; *p; p++){
+ switch (*p){
+ case '?':
+ g_string_append_c (str, '.');
+ break;
+ case '*':
+ g_string_append (str, ".*");
+ break;
+
+ case '[': case ']': case '\\': case '(': case ')':
+ case '^': case '$': case '.':
+ g_string_append_c (str, '\\');
+ /* fall */
+ default:
+ g_string_append_c (str, *p);
+ }
+ }
+ g_string_append_c (str, '$');
+ regcomp (compiled, str->str, 0);
+
+ return compiled;
+}
+
+int
+mono_glob_match (gpointer handle, const char *str)
+{
+ regex_t *compiled = (regex_t *) handle;
+
+ return regexec (compiled, str, 0, NULL, 0) == 0;
+}
+
+void
+mono_glob_dispose (gpointer handle)
+{
+ regfree ((regex_t *) handle);
+}
diff --git a/mono/wrapper/libmonowrapper.rc b/mono/wrapper/libmonowrapper.rc
new file mode 100644
index 00000000000..ac32d325d33
--- /dev/null
+++ b/mono/wrapper/libmonowrapper.rc
@@ -0,0 +1,32 @@
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 0,6,0,1
+ PRODUCTVERSION 0,6,0,1
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "TODO: Put something here\0"
+ VALUE "CompanyName", "TODO: Put something here\0"
+ VALUE "FileDescription", "libmono\0"
+ VALUE "FileVersion", "0, 6, 0, 1\0"
+ VALUE "InternalName", "libmono\0"
+ VALUE "LegalCopyright", "Copyright © 2001\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "libmono.dll\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", " libmono\0"
+ VALUE "ProductVersion", "0, 6, 0, 1\0"
+ VALUE "SpecialBuild", "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/mono/wrapper/wrapper.c b/mono/wrapper/wrapper.c
new file mode 100644
index 00000000000..6ad29668e04
--- /dev/null
+++ b/mono/wrapper/wrapper.c
@@ -0,0 +1,201 @@
+#include <config.h>
+#include <limits.h>
+#include <dirent.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
+#include "wrapper.h"
+
+extern char **environ;
+
+gint64
+mono_wrapper_seek (gpointer fd, gint64 offset, gint32 whence)
+{
+ off_t code;
+
+ if (offset > INT_MAX || offset < INT_MIN)
+ return -EINVAL;
+
+ code = lseek ((int)fd, offset, whence);
+ if (code == -1)
+ return -errno;
+ else
+ return code;
+}
+
+gint32
+mono_wrapper_read (gpointer fd, void* buf, gint32 count)
+{
+ int n = read ((int)fd, buf, count);
+
+ if (n == -1)
+ return -errno;
+ return n;
+}
+
+gint32
+mono_wrapper_write (gpointer fd, void* buf, gint32 count)
+{
+ int n = write ((int)fd, buf, count);
+
+ if (n == -1)
+ return -errno;
+ return n;
+}
+
+gint32
+mono_wrapper_fstat (gpointer fd, MonoWrapperStat* buf)
+{
+ struct stat fs;
+
+ if (fstat ((int)fd, &fs) == -1)
+ return -errno;
+
+ buf->mst_dev = fs.st_dev;
+ buf->mst_mode = fs.st_mode;
+ buf->mst_nlink = fs.st_nlink;
+ buf->mst_uid = fs.st_uid;
+ buf->mst_gid = fs.st_gid;
+ buf->mst_size = fs.st_size;
+ buf->mst_atime = fs.st_atime;
+ buf->mst_mtime = fs.st_mtime;
+ buf->mst_ctime = fs.st_ctime;
+
+ return 0;
+}
+
+gint32
+mono_wrapper_ftruncate (gpointer fd, gint64 length)
+{
+ int code;
+
+ if (length > INT_MAX || length < INT_MIN)
+ return -1;
+
+ code = ftruncate ((int)fd, length);
+ if (code == -1)
+ return -errno;
+ return code;
+}
+
+gpointer
+mono_wrapper_open (const char * path, gint32 flags, gint32 mode)
+{
+ return (gpointer) open (path, flags, mode);
+}
+
+gint32
+mono_wrapper_close (gpointer fd)
+{
+ return close ((int)fd);
+}
+
+gint32
+mono_wrapper_stat (const char * path, MonoWrapperStat* buf)
+{
+ struct stat fs;
+
+ if (stat (path, &fs) != 0)
+ return errno;
+
+ buf->mst_dev = fs.st_dev;
+ buf->mst_mode = fs.st_mode;
+ buf->mst_nlink = fs.st_nlink;
+ buf->mst_uid = fs.st_uid;
+ buf->mst_gid = fs.st_gid;
+ buf->mst_size = fs.st_size;
+ buf->mst_atime = fs.st_atime;
+ buf->mst_mtime = fs.st_mtime;
+ buf->mst_ctime = fs.st_ctime;
+
+ return 0;
+}
+
+gint32
+mono_wrapper_unlink (const char * path)
+{
+ if (unlink(path) == -1)
+ return -errno;
+ return 0;
+}
+
+gpointer
+mono_wrapper_opendir (const char * path)
+{
+ return (gpointer)opendir(path);
+}
+
+const char *
+mono_wrapper_readdir (gpointer dir)
+{
+ struct dirent* p;
+
+ p = readdir((DIR*)dir);
+
+ return p != NULL ? p->d_name : NULL;
+}
+
+gint32
+mono_wrapper_closedir (gpointer dir)
+{
+ return closedir((DIR*)dir);
+}
+
+gpointer
+mono_wrapper_getenv (const char * variable)
+{
+ return (gpointer)getenv(variable);
+}
+
+gpointer
+mono_wrapper_environ ()
+{
+ return (gpointer)environ;
+}
+
+int
+mono_wrapper_mkdir (const char *path, int mode)
+{
+#ifndef PLATFORM_WIN32
+ if (mkdir (path, mode) == -1)
+ return -errno;
+#endif
+ return 0;
+}
+
+int
+mono_wrapper_rmdir (const char *path)
+{
+ if (rmdir (path) == -1)
+ return -errno;
+ return 0;
+}
+
+int
+mono_wrapper_rename (const char *src, const char *dst)
+{
+ if (rename (src, dst) == -1)
+ return -errno;
+ return 0;
+}
+
+int
+mono_wrapper_utime (const char *path, int atime, int mtime)
+{
+#ifndef PLATFORM_WIN32
+ struct utimbuf buf;
+
+ buf.actime = atime;
+ buf.modtime = mtime;
+
+ if (utime (path, &buf) == -1)
+ return -errno;
+#endif
+ return 0;
+}
+
diff --git a/notes/cil b/notes/cil
new file mode 100644
index 00000000000..458aca543ba
--- /dev/null
+++ b/notes/cil
@@ -0,0 +1,13 @@
+Random collection of notes
+
+ * What is the point of having the InlineVar argument to
+ opcodes be a signed integer instead of unsigned?
+
+
+Storage
+
+ The CIL metadata is a very compressed file format, even the
+ sizes of blobs and strings are recorded in a compressed form.
+ Still, all strings are encoded using 16-bit chars, instead of the
+ more efficient UTF-8.
+
diff --git a/runtime/.cvsignore b/runtime/.cvsignore
new file mode 100644
index 00000000000..f914cb46763
--- /dev/null
+++ b/runtime/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+*.dll
diff --git a/runtime/Makefile.am b/runtime/Makefile.am
new file mode 100644
index 00000000000..ef83eaf2854
--- /dev/null
+++ b/runtime/Makefile.am
@@ -0,0 +1,39 @@
+#
+# This is just used to copy and install the DLL files that are currently
+# being compiled on windows.
+#
+
+assemblies_DATA = \
+ corlib.dll \
+ System.dll \
+ System.Data.dll \
+ System.Xml.dll \
+ System.Web.dll \
+ System.Drawing.dll
+
+monobins_DATA = mcs.exe
+
+EXTRA_DIST = $(monobins_DATA) $(assemblies_DATA)
+
+#
+# Keep in sync with mono/mono/metadata/Makefile.am
+#
+assembliesdir = $(libdir)
+monobinsdir = $(bindir)
+
+$(assemblies_DATA):
+ cp $(top_srcdir)/../mcs/class/lib/$@ . || cp $(assembliesdir)/$@ . || touch $@
+
+$(monobins_DATA):
+ cp $(top_srcdir)/../mcs/mcs/$@ . || cp $(monobinsdir)/$@ . || touch $@
+
+dist-hook:
+ for i in $(monobins_DATA) $(assemblies_DATA); do \
+ if test ! -s $(srcdir)/$$i; then echo $$i is empty && exit 1; fi \
+ done
+
+copy_dlls:
+ cp /nt/mono/mcs/class/*/*.dll .
+
+push_dlls:
+ scp -o "Protocol 1" *.dll *.exe snapshot@mono-cvs.ximian.com:dlls
diff --git a/scripts/.cvsignore b/scripts/.cvsignore
new file mode 100644
index 00000000000..18805a6a484
--- /dev/null
+++ b/scripts/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+mcs
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
new file mode 100644
index 00000000000..e43f643e445
--- /dev/null
+++ b/scripts/Makefile.am
@@ -0,0 +1,9 @@
+EXTRA_DIST = mcs.in
+
+bin_SCRIPTS = mcs
+
+CLEANFILES = mcs
+
+mcs: mcs.in
+ sed -e 's^\@bindir\@^$(bindir)^g' < $(srcdir)/mcs.in > mcs.tmp \
+ && mv mcs.tmp mcs
diff --git a/scripts/mcs.in b/scripts/mcs.in
new file mode 100644
index 00000000000..e9d45e52b35
--- /dev/null
+++ b/scripts/mcs.in
@@ -0,0 +1,2 @@
+#!/bin/sh
+@bindir@/mono @bindir@/mcs.exe $*
diff --git a/status/.cvsignore b/status/.cvsignore
new file mode 100755
index 00000000000..8e0e10e891a
--- /dev/null
+++ b/status/.cvsignore
@@ -0,0 +1,7 @@
+compare.exe
+compare.pdb
+corlib.xml
+bn
+bm
+web
+cormissing.xml \ No newline at end of file
diff --git a/status/ByMaintainer.cs b/status/ByMaintainer.cs
new file mode 100755
index 00000000000..d76a0c8755b
--- /dev/null
+++ b/status/ByMaintainer.cs
@@ -0,0 +1,52 @@
+//
+// ByMaintainer.cs
+//
+// Author:
+// Sean MacIsaac (sean@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+
+namespace Mono.StatusReporter {
+ public class ByMaintainer {
+ static int Main (string[] args) {
+ XslTransform xslt = new XslTransform ();
+ xslt.Load ("ByMaintainer.xsl");
+ //StreamWriter sw = new StreamWriter ("bm/index");
+
+ XPathDocument doc = new XPathDocument ("class.xml");
+
+ XmlDocument maintainers = new XmlDocument();
+
+ maintainers.Load ("maintainers.xml");
+
+ XmlNodeList people = maintainers.GetElementsByTagName("person");
+ foreach (XmlNode node in people) {
+ string email = node.Attributes.GetNamedItem("email").Value;
+ string name = node.Attributes.GetNamedItem("name").Value;
+
+ //sw.WriteLine ("<li><a href=\"" + email + ".html\">" + email + "</a>");
+
+ XmlWriter writer = new XmlTextWriter ("src/" + email, null);
+
+ XsltArgumentList xslArg = new XsltArgumentList ();
+ xslArg.AddParam ("email", "", email);
+ xslArg.AddParam ("name", "", name);
+
+ xslt.Transform (doc, xslArg, writer);
+
+ writer.Close ();
+ }
+
+ //sw.Close ();
+
+ return 0;
+ }
+ }
+}
diff --git a/status/ByMaintainer.xsl b/status/ByMaintainer.xsl
new file mode 100755
index 00000000000..90fdb6b4bfc
--- /dev/null
+++ b/status/ByMaintainer.xsl
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
+
+<xsl:param name="email"/>
+<xsl:param name="name"/>
+
+<xsl:template match="/">
+ <h2>Maintained by <xsl:value-of select="$name"/> (<xsl:value-of select="$email"/>)</h2>
+ <table border="1">
+ <tr>
+ <td>Class Name</td>
+ <td>Last Activity</td>
+ <td>Implementation</td>
+ <td>Test Suite</td>
+ <td>Completion</td>
+ </tr>
+
+ <xsl:for-each select='classes/class'>
+
+ <xsl:sort select='@name' />
+ <xsl:if test="contains(maintainers/*, $email)">
+ <tr>
+ <td><xsl:value-of select="@name"/></td>
+ <td><xsl:value-of select="last-activity"/></td>
+ <td><xsl:value-of select="implementation"/></td>
+ <td><xsl:value-of select="test-suite"/></td>
+ <td><xsl:value-of select="completion"/></td>
+ </tr>
+ </xsl:if>
+
+ </xsl:for-each>
+
+ </table>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/status/ByNamespace.cs b/status/ByNamespace.cs
new file mode 100755
index 00000000000..9ca3a7bf44c
--- /dev/null
+++ b/status/ByNamespace.cs
@@ -0,0 +1,55 @@
+//
+// ByNamespace.cs
+//
+// Author:
+// Sean MacIsaac (sean@ximian.com)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using System.Collections;
+using System.IO;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+
+namespace Mono.StatusReporter {
+ public class ByMaintainer {
+ static int Main (string[] args) {
+ XslTransform xslt = new XslTransform ();
+ xslt.Load ("ByNamespace.xsl");
+ //StreamWriter sw = new StreamWriter ("bn/index");
+
+ XPathDocument doc = new XPathDocument ("class.xml");
+
+ XmlDocument classxml = new XmlDocument ();
+ classxml.Load ("class.xml");
+ ArrayList nsList = new ArrayList ();
+
+ XmlNodeList classes = classxml.GetElementsByTagName ("class");
+ foreach (XmlNode node in classes) {
+ string name = node.Attributes.GetNamedItem ("name").Value;
+ string ns = name.Substring(0, name.LastIndexOf ("."));
+ if (!nsList.Contains (ns)) nsList.Add (ns);
+ }
+
+ foreach (string str in nsList) {
+ //sw.WriteLine ("<li><a href=\"" + str + ".html\">" + str + "</a>");
+
+ XmlWriter writer = new XmlTextWriter ("src/" + str, null);
+
+ XsltArgumentList xslArg = new XsltArgumentList ();
+ xslArg.AddParam ("ns", "", str);
+
+ xslt.Transform (doc, xslArg, writer);
+
+ writer.Close ();
+ }
+
+ //sw.Close ();
+
+ return 0;
+ }
+ }
+}
diff --git a/status/ByNamespace.xsl b/status/ByNamespace.xsl
new file mode 100755
index 00000000000..1959633e795
--- /dev/null
+++ b/status/ByNamespace.xsl
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
+
+<xsl:output method="html" indent="yes"/>
+
+<xsl:param name="ns"/>
+
+<xsl:template match="/">
+ <h2>Classes in <xsl:value-of select="$ns"/></h2>
+ <table border="1">
+ <tr>
+ <td>Class Name</td>
+ <td>Head Maintainer</td>
+ <td>Last Activity</td>
+ <td>Implementation</td>
+ <td>Test Suite</td>
+ <td>Completion</td>
+ </tr>
+
+ <xsl:for-each select='classes/class'>
+ <xsl:sort select='@name' />
+ <xsl:if test="starts-with(@name, $ns) and not(contains(substring-after(@name, concat($ns, '.')), '.'))">
+ <tr>
+ <td><xsl:value-of select="@name"/></td>
+ <td><a href='mailto:{maintainers/maintainer[1]}'><xsl:value-of select="maintainers/maintainer[1]"/></a></td>
+ <td><xsl:value-of select="last-activity"/></td>
+ <td><xsl:value-of select="implementation"/></td>
+ <td><xsl:value-of select="test-suite"/></td>
+ <td><xsl:value-of select="completion"/></td>
+ </tr>
+ </xsl:if>
+ </xsl:for-each>
+
+ </table>
+
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/status/ChangeLog b/status/ChangeLog
new file mode 100755
index 00000000000..1f6b16d0b6b
--- /dev/null
+++ b/status/ChangeLog
@@ -0,0 +1,64 @@
+2002-04-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * maintainers.xml: added myself.
+ * class.xml: added System.Net.Sockets.UdpClient and updated
+ System.Net.IPAddress and IPEndPoint.
+
+2002-03-17 Nick Drochak <ndrochak@gol.com>
+
+ * class.xml: Added class I stubbed out:
+ ApplicationDirectoryMembershipCondition
+
+2002-01-14 Nick Drochak <ndrochak@gol.com>
+
+ * class.xml: Added classes I implemented.
+
+2002-01-07 John Barnette <jbarn@httcb.net>
+
+ * type-maintainers.xml: new format for information.
+
+2002-01-05 Nick Drochak <ndrochak@gol.com>
+
+ * .cvsignore: ignore cormissing file which is generated by
+ /mcs/tools/corcompare.exe
+
+2001-11-19 Daniel Weber <daniel-weber@austin.rr.co>
+ * class.xml : Added System.Xml classes
+ * maintainers.xml: Added myself
+2001-10-11
+
+ * ByMaintainer.xsl: support for sorting classnames
+ * ByNamespace.xsl: support for sorting classnames, mailto href on
+ maintainer
+
+Tue Sep 25 19:03:52 CEST 2001 Paolo Molaro <lupus@ximian.com>
+
+ * class.xml: updates.
+
+2001-09-14 Dick Porter <dick@ximian.com>
+
+ * class.xml: Added System.Threading classes
+
+ * maintainers.xml: Added myself
+
+2001-07-17 Sean MacIsaac <macisaac@ximian.com>
+
+ * ByNamespace.xsl: removed bug for improper handling of namespace.
+ eg System.Collections.Blah was showing up in System list.
+
+2001-07-16 Sean MacIsaac <macisaac@ximian.com>
+
+ * ByNamespace.xsl: Needed by ByNamespace.cs.
+
+ * ByNamespace.cs: Generates html by namespace..
+
+ * ByMaintainer.xsl: Needed by ByMaintainer.cs.
+
+ * ByMaintainer.cs: Generates html by maintainer.
+
+ * class.xml: Class maintainers go here.
+
+ * maintainers.xml: Only maintaining email/name pairs here.
+
+ * compare-assembly.cs: Started refactoring to give what Migee
+ wants.
diff --git a/status/class.xml b/status/class.xml
new file mode 100755
index 00000000000..a77f6fac033
--- /dev/null
+++ b/status/class.xml
@@ -0,0 +1,5337 @@
+<classes>
+ <class name="System.ApplicationException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ArgumentException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ArgumentNullException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ArgumentOutOfRangeException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ArithmeticException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Array">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>90</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ArrayTypeMismatchException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Attribute">
+ <last-activity>Aug-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>95</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Boolean">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>dsh2120@draper.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Byte">
+ <last-activity>Dec-21-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>yes</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>dholden@draper.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.CLSCompliantAttribute">
+ <last-activity>Aug-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>95</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.ArrayList">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>vladimir@pobox.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.BitArray">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>dmenest@yahoo.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.CaseInsensitiveComparer">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>serge@wildwestsoftware.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.CaseInsensitiveHashCodeProvider">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>serge@wildwestsoftware.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.CollectionBase">
+ <last-activity>Aug-03-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Comparer">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>serge@wildwestsoftware.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.DictionaryBase">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.DictionaryEntry">
+ <last-activity>Sept-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>90</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Hashtable">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>75</completion>
+ <maintainers>
+ <maintainer>jbarn@httcb.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.ICollection">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>vladimir@pobox.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.IComparer">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>vladimir@pobox.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.IDictionary">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>vladimir@pobox.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.IDictionaryEnumerator">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>vladimir@pobox.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.IEnumerable">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>vladimir@pobox.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.IEnumerator">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>vladimir@pobox.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.IHashCodeProvider">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>vladimir@pobox.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.IList">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>vladimir@pobox.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Queue">
+ <last-activity>Jul-30-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>ric@users.sourceforge.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.ReadOnlyCollectionBase">
+ <last-activity>Aug-03-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.SortedList">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>serge@wildwestsoftware.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Specialized.CollectionsUtil">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>jbarn@httcb.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Specialized.HybridDictionary">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>jbarn@httcb.net</maintainer>
+ <maintainer>josh@narf.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Specialized.KeysCollection">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>gleb@eurosoft.od.ua</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Specialized.ListDictionary">
+ <last-activity>Aug-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>jbarn@httcb.net</maintainer>
+ <maintainer>josh@narf.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Specialized.NameObjectCollectionBase">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>gleb@eurosoft.od.ua</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Specialized.NameValueCollection">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>gleb@eurosoft.od.ua</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Specialized.StringCollection">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>jbarn@httcb.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Specialized.StringDictionary">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>jbarn@httcb.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Specialized.StringEnumerator">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>jbarn@httcb.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Collections.Stack">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>rooneg@electricjellyfish.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.BrowsableAttribute">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.CategoryAttribute">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.Component">
+ <last-activity>Aug-2-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.ComponentCollection">
+ <last-activity>Aug-2-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.Container">
+ <last-activity>Aug-2-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.DescriptionAttribute">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.DesignerSerializationVisibility">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.DesignerSerializationVisibilityAttribute">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.DesignOnlyAttribute">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.IComponent">
+ <last-activity>Aug-2-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.IContainer">
+ <last-activity>Aug-2-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.ISite">
+ <last-activity>Aug-2-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.LocalizableAttribute">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.MemberDescriptor">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>70</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ComponentModel.PropertyDescriptor">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>30</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Configuration.ConfigurationException">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>cpodurgiel@msn.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Configuration.ConfigurationSettings">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>cpodurgiel@msn.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Configuration.IConfigurationSectionHandler">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>cpodurgiel@msn.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Configuration.IgnoreSectionHandler">
+ <last-activity>Aug-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>cpodurgiel@msn.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Configuration.NameValueSectionHandler">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>cpodurgiel@msn.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Console">
+ <last-activity>Jul-0-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>marcel@narings.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ContextBoundObject">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ContextBoundObject">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ContextStaticAttribute">
+ <last-activity>Aug-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>95</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Convert">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>dsh2120@draper.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.DataRow">
+ <last-activity>Jan-8-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>swildermuth@adoguy.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.DataTable">
+ <last-activity>Jan-8-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>swildermuth@adoguy.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.DataAdapter">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.DataColumnMapping">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.DataColumnMappingCollection">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.DataTableMapping">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.DataTableMappingCollection">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.DbDataAdapter">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.DbDataPermission">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.DbDataPermissionAttribute">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.DbDataRecord">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.DbEnumerator">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.RowUpdatedEventArgs">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.Common.RowUpdatingEventArgs">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.SqlClient.SqlCommand">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ <maintainer>danmorg@sc.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.SqlClient.SqlConnection">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ <maintainer>danmorg@sc.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.SqlClient.SqlDataAdapter">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.SqlClient.SqlDataReader">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.SqlClient.SqlError">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.SqlClient.SqlErrorCollection">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.SqlClient.SqlException">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.SqlClient.SqlParameter">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.SqlClient.SqlParameterCollection">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Data.SqlClient.SqlTransaction">
+ <last-activity>Apr-12-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>rodrigo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.DateTime">
+ <last-activity>Jul-23-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>marcel@narings.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Decimal">
+ <last-activity>Oct-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>90</completion>
+ <maintainers>
+ <maintainer>martin.weindel@t-online.de</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.BooleanSwitch">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>angryjohn69@nc.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.ConditionalAttribute">
+ <last-activity>Aug-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>99</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.Debug">
+ <last-activity>March-08-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>99</completion>
+ <maintainers>
+ <maintainer>jonpryor@vt.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.DebuggableAttribute">
+ <last-activity>Aug-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>99</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.DiagnosticsConfigurationHandler">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>angryjohn69@nc.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.StackFrame">
+ <last-activity>Aug-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>klyubin@aqris.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.StackTrace">
+ <last-activity>Aug-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>klyubin@aqris.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.Switch">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>angryjohn69@nc.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.Trace">
+ <last-activity>April-06-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>jonpryor@vt.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.TraceLevel">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>angryjohn69@nc.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.TraceListener">
+ <last-activity>Apr-07-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>99</completion>
+ <maintainers>
+ <maintainer>jonpryor@vt.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Diagnostics.TraceSwitch">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>angryjohn69@nc.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.DivideByZeroException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Color">
+ <last-activity>Aug-10-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>mkestner@speakeasy.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.CombineMode">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.CompositingMode">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.CompositingQuality">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.CoordinateSpace">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.DashCap">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.DashStyle">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.FillMode">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.FlushIntention">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.HatchStyle">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.InterpolationMode">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.LinearGradientMode">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.LineCap">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.LineJoin">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.Matrix">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.MatrixOrder">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.PathPointType">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.PenAlignment">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.PenType">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.PixelOffsetMode">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.QualityMode">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.SmoothingMode">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.WarpMode">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Drawing2D.WrapMode">
+ <last-activity>Aug-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>sm@cg.tuwien.ac.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Point">
+ <last-activity>Aug-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>mkestner@speakeasy.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.PointF">
+ <last-activity>Aug-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>mkestner@speakeasy.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Rectangle">
+ <last-activity>Aug-10-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>mkestner@speakeasy.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.RectangleF">
+ <last-activity>Aug-10-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>mkestner@speakeasy.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.Size">
+ <last-activity>Aug-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>mkestner@speakeasy.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Drawing.SizeF">
+ <last-activity>Aug-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>mkestner@speakeasy.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.DuplicateWaitObjectException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Environment">
+ <last-activity>Aug-22-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>40</completion>
+ <maintainers>
+ <maintainer>develop@wtfo-guru.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.EventArgs">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>yes</completion>
+ <maintainers>
+ <maintainer>michaellambert@bellsouth.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.EventHandler">
+ <last-activity>Aug-2-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Exception">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ExecutionEngineException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.FlagsAttribute">
+ <last-activity>Aug-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>95</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.FormatException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.Calendar">
+ <last-activity>Sep-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>wictor@iBizkit.se</maintainer>
+ <maintainer>marcel@narings.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.Calendar.WeekRule">
+ <last-activity>Sep-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>wictor@iBizkit.se</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.Calendar.WeekRule">
+ <last-activity>Sep-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>wictor@iBizkit.se</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.CultureInfo">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.GregorianCalendar">
+ <last-activity>Sep-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>wictor@iBizkit.se</maintainer>
+ <maintainer>marcel@narings.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.GregorianCalendarTypes">
+ <last-activity>Sep-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>wictor@iBizkit.se</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.HebrewCalendar">
+ <last-activity>Jul-24-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>marcel@narings.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.HijriCalendar">
+ <last-activity>Jul-24-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>marcel@narings.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.JapaneseCalendar">
+ <last-activity>Jul-24-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>marcel@narings.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.JulianCalendar">
+ <last-activity>Jul-24-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>marcel@narings.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.JulianCalendar">
+ <last-activity>Sep-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>wictor@iBizkit.se</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.KoreanCalendar">
+ <last-activity>Jul-24-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>marcel@narings.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.NumberFormatInfo">
+ <last-activity>Jul-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>dholden@draper.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.TaiwanCalendar">
+ <last-activity>Jul-24-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>marcel@narings.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.ThaiBuddhistCalendar">
+ <last-activity>Jul-24-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>marcel@narings.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Globalization.UnicodeCateogy">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IAsyncResult">
+ <last-activity>Jul-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>yes</completion>
+ <maintainers>
+ <maintainer>michaellambert@bellsouth.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ICloneable">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IComparible">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IConvertible">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ICustomFormatter">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IDisposable">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IFormatProvider">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IFormattable">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IndexOutOfRangeException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IndividualCastException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Int16">
+ <last-activity>Dec-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Int32">
+ <last-activity>Dec-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Int64">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IntPtr">
+ <last-activity>Jul-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>yes</completion>
+ <maintainers>
+ <maintainer>michaellambert@bellsouth.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.InvalidOperationException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.InvalidProgramException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.BinaryReader">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>czw@home.se</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.BinaryWriter">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>czw@home.se</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.Directory">
+ <last-activity>Aug-22-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>75</completion>
+ <maintainers>
+ <maintainer>develop@wtfo-guru.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.DirectoryInfo">
+ <last-activity>Sep-10-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>develop@wtfo-guru.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.File">
+ <last-activity>Aug-22-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>75</completion>
+ <maintainers>
+ <maintainer>develop@wtfo-guru.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.FileInfo">
+ <last-activity>Sep-10-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>develop@wtfo-guru.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.FileLoadException">
+ <last-activity>Sept-13-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.FileNotFoundException">
+ <last-activity>Sept-13-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.FileStream">
+ <last-activity>Dec-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>dietmar@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.FileSystemInfo">
+ <last-activity>Sep-10-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>85</completion>
+ <maintainers>
+ <maintainer>develop@wtfo-guru.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.IOException">
+ <last-activity>Aug-26-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.MemoryStream">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>marcins@zipworld.com.au</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.Path">
+ <last-activity>Aug-22-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>75</completion>
+ <maintainers>
+ <maintainer>develop@wtfo-guru.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.Stream">
+ <last-activity>Dec-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>dietmar@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.StreamReader">
+ <last-activity>Dec-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>20</completion>
+ <maintainers>
+ <maintainer>dietmar@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.StreamWriter">
+ <last-activity>Dec-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>20</completion>
+ <maintainers>
+ <maintainer>dietmar@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.StringReader">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>marcins@zipworld.com.au</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.StringWriter">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>yes</test-suite>
+ <completion>yes</completion>
+ <maintainers>
+ <maintainer>marcins@zipworld.com.au</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.TextReader">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>marcins@zipworld.com.au</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IO.TextWriter">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>yes</completion>
+ <maintainers>
+ <maintainer>marcins@zipworld.com.au</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.IServiceProvider">
+ <last-activity>Aug-2-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.LocalDataStoreSlot">
+ <last-activity>Sep-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.MarshalByRefObject">
+ <last-activity>Aug-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>20</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Math">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>95</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.MemberAccessException">
+ <last-activity>Sept-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>90</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.MissingMemberException">
+ <last-activity>Sept-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>90</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.MissingMethodException">
+ <last-activity>Sept-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>90</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.MulticastNotSupportedException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.AuthenticationManager">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>75</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.Authorization">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>75</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.Dns">
+ <last-activity>Feb-11-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>mpultz@get2net.dk</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.EndPoint">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>75</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.IAuthenticationModule">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>75</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.ICredentialLookup">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>75</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.IPAdress">
+ <last-activity>Apr-15-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.IPEndPoint">
+ <last-activity>Apr-15-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.IPHostEntry">
+ <last-activity>Feb-11-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>mpultz@get2net.dk</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.SocketAddress">
+ <last-activity>Apr-15-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.Sockets.TcpClient">
+ <last-activity>Nov-23-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>pp@myelin.co.nz</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.Sockets.TcpListener">
+ <last-activity>Nov-23-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>pp@myelin.co.nz</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Net.Sockets.UdpClient">
+ <last-activity>Apr-15-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>gonzalo@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.NotFiniteNumberException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.NotSupportedException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.NullReferenceException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Object">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>75</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.OperatingSystem">
+ <last-activity>Aug-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>75</completion>
+ <maintainers>
+ <maintainer>develop@wtfo-guru.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.OutOfMemoryException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.OverflowExceptionException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Random">
+ <last-activity>Aug-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>85</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.RankException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.Assembly">
+ <last-activity>Sept-13-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>5</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.ConstructorInfo">
+ <last-activity>Sept-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>20</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.Emit.ConstructorBuilder">
+ <last-activity>Sept-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.Emit.ILGenerator">
+ <last-activity>Sept-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>5</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.Emit.Label">
+ <last-activity>Sept-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>5</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.Emit.ModuleBuilder">
+ <last-activity>Sept-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.Emit.ModuleBuilder">
+ <last-activity>Sept-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.Emit.PEFileKinds">
+ <last-activity>Sept-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.Emit.TypeBuilder">
+ <last-activity>Sept-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.MemberFilter">
+ <last-activity>Sept-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.MethodBase">
+ <last-activity>Sept-13-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.MethodInfo">
+ <last-activity>Sept-13-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Reflection.Module">
+ <last-activity>Sept-24-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>20</completion>
+ <maintainers>
+ <maintainer>lupus@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Resources.IResourceReader">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duncan@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Resources.IResourceWriter">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duncan@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Resources.MissingManifestResourceException">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duncan@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Resources.NeutralResourceLanguageAttribute">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duncan@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Resources.ResourceManager">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duncan@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Resources.ResourceReader">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duncan@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Resources.ResourceSet">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duncan@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Resources.ResourceWriter">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duncan@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Resources.ResXFileRef">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duncan@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Resources.ResXResourceReader">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duncan@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Resources.SatelliteContractVersionAttribute">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duncan@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Activation.ActivatorLevel">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Activation.IActivator">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Activation.IConstructionCallMessage">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Activation.IConstructionReturnMessage">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Contexts.Context">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Contexts.ContextAttribute">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Contexts.IContextAttribute">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Contexts.IContextProperty">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Contexts.IDynamicMessageSink">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Contexts.IDynamicProperty">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Contexts.SynchronizationAttribute">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Messaging.IMessage">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Messaging.IMethodMessage">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Messaging.IMethodMessage">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.Messaging.IMethodReturnMessage">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Remoting.ObjRef">
+ <last-activity>Aug-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>20</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Serialization.Formatters.BinaryFormatter">
+ <last-activity>Jan-16-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>kbottner@istation.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Serialization.Formatters.SoapFormamter">
+ <last-activity>Jan-16-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>kbottner@istation.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Serialization.IDeserializationCallback">
+ <last-activity>Dec-30-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Serialization.IFormatterConverter">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Serialization.IObjectReference">
+ <last-activity>Aug-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Serialization.ISerializable">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Serialization.SerializationInfo">
+ <last-activity>Oct-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Serialization.StreamingContext">
+ <last-activity>Aug-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Runtime.Serialization.StreamingContextStates">
+ <last-activity>Aug-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.SByte">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>dholden@draper.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.CodeAccessPermission">
+ <last-activity>Dec-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>5</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.AsymmetricAlgorithm">
+ <last-activity>Oct-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>95</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.AsymmetricKeyExchangeDeformatter">
+ <last-activity>Oct-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.AsymmetricKeyExchangeFormatter">
+ <last-activity>Oct-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.AsymmetricSignatureDeformatter">
+ <last-activity>Oct-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.AsymmetricSignatureFormatter">
+ <last-activity>Oct-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.CipherMode">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.CryptoAPITransform">
+ <last-activity>Oct-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>20</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.CryptograhicUnexpectedOperationException">
+ <last-activity>Oct-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.CryptographicException">
+ <last-activity>Oct-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.CryptoStream">
+ <last-activity>Oct-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>20</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.CryptoStreamMode">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.CspParameters">
+ <last-activity>Oct-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.CspProviderFlags">
+ <last-activity>Oct-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.DeriveBytes">
+ <last-activity>Oct-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.DES">
+ <last-activity>Aug-1-2001</last-activity>
+ <implementation>no/soft</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>serge@wildwestsoftware.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.DESCrytpoServiceProvider">
+ <last-activity>Aug-1-2001</last-activity>
+ <implementation>no/soft</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>serge@wildwestsoftware.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.DSA">
+ <last-activity>Oct-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.DSAParameters">
+ <last-activity>Oct-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.DSASignatureDeformatter">
+ <last-activity>Oct-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>30</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.DSASignatureFormatter">
+ <last-activity>Oct-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>30</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.FromBase64Transform">
+ <last-activity>Aug-1-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>serge@wildwestsoftware.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.HashAlgorithm">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.KeySizes">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.MD5">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.MD5CryptoServiceProvider">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.PaddingMode">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.PasswordDeriveBytes">
+ <last-activity>Aug-1-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.Rijndael">
+ <last-activity>Aug-1-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>crichton@gimp.org</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.RijndaelManaged">
+ <last-activity>Aug-1-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>crichton@gimp.org</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.RNGCryptoServiceProvider">
+ <last-activity>Feb-21-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>70</completion>
+ <maintainers>
+ <maintainer>crichton@gimp.org</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.SHA1">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.SHA1CryptoServiceProvider">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.SHA256">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.SHA384">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.SHA512">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Matthew.S.Ford@rose-hulman.edu</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.SignatureDescription">
+ <last-activity>Oct-6-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.SymmetricAlgorithm">
+ <last-activity>Oct-11-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>95</completion>
+ <maintainers>
+ <maintainer>tome@sbox.tugraz.at</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.ToBase64Transform">
+ <last-activity>Aug-1-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>serge@wildwestsoftware.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.TripleDES">
+ <last-activity>Jan-16-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>john.giffin@xor.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Cryptography.TripleDESServiceProvider">
+ <last-activity>Jan-16-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>john.giffin@xor.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.IPermission">
+ <last-activity>Dec-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.ISecurityPolicyEncodable">
+ <last-activity>Dec-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.IStackWalk">
+ <last-activity>Dec-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Permissions.CodeAccessSecurityAttribute">
+ <last-activity>Jan-08-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Permissions.FileIOPermission">
+ <last-activity>Jan-14-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Permissions.IUnrestrictedPermission">
+ <last-activity>Jan-02-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Permissions.SecurityAttribute">
+ <last-activity>Jan-08-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Permissions.SecurityPermissionAttribute">
+ <last-activity>Jan-08-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.PermissionSet">
+ <last-activity>Dec-30-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>1</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Policy.ApplicationDirectoryMembershipCondition">
+ <last-activity>Mar-17-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>5</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Policy.IIdentityPermissionFactory">
+ <last-activity>Jan-03-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>1</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Policy.IMembershipCondition">
+ <last-activity>Jan-03-2002</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>1</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.Policy.PolicyLevel">
+ <last-activity>Dec-29-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>1</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.PolicyLevelType">
+ <last-activity>Dec-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.SecurityElement">
+ <last-activity>Dec-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.SecurityException">
+ <last-activity>Dec-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.SecurityManager">
+ <last-activity>Dec-30-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>1</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.SecurityZone">
+ <last-activity>Dec-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.SuppressUnmanagedCodeSecurityAttribute">
+ <last-activity>Dec-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.UnverifiableCodeAttribute">
+ <last-activity>Dec-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Security.XmlSyntaxException">
+ <last-activity>Dec-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>ndrochak@gol.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Single">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>dholden@draper.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.StackOverflowException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.String">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>fejj@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.StringBuilder">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>marcins@zipworld.com.au</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.SystemException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Text.ASCIIEncoding">
+ <last-activity>Jan-05-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>99</completion>
+ <maintainers>
+ <maintainer>dietmar@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Text.Decoder">
+ <last-activity>Jan-05-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>99</completion>
+ <maintainers>
+ <maintainer>dietmar@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Text.Encoder">
+ <last-activity>Jan-05-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>99</completion>
+ <maintainers>
+ <maintainer>dietmar@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Text.Encoding">
+ <last-activity>Jan-05-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>99</completion>
+ <maintainers>
+ <maintainer>dietmar@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Text.UnicodeEncoding">
+ <last-activity>Jan-05-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>99</completion>
+ <maintainers>
+ <maintainer>dietmar@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Text.UTF7Encoding">
+ <last-activity>Jan-05-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>99</completion>
+ <maintainers>
+ <maintainer>dietmar@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Text.UTF8Encoding">
+ <last-activity>Jan-05-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>99</completion>
+ <maintainers>
+ <maintainer>dietmar@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ApartmentState">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.AutoResetEvent">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.Interlocked">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.IOCompletionCallback">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.LockCookie">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ManualResetEvent">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.Monitor">
+ <last-activity>Oct-03-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.Mutex">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.NativeOverlapped">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.Overlapped">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ReaderWriterLock">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.RegisteredWaitHandle">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.SynchronizationLockException">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.Thread">
+ <last-activity>Sep-25-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ThreadAbortException">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ThreadExceptionEventArgs">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ThreadExceptionEventHandler">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ThreadInterruptedException">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ThreadPool">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ThreadPriority">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>michaellambert@bellsouth.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ThreadStart">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ThreadState">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>michaellambert@bellsouth.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.ThreadStateException">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.Timeout">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.Timer">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.TimerCallback">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.WaitCallback">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.WaitHandle">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Threading.WaitOrTimerCallback">
+ <last-activity>Sep-14-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>dick@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.TimeSpan">
+ <last-activity>Jul-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>duco@lorentz.xs4all.nl</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.TypeCode">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.TypeInitializationException">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>joe@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.UInt16">
+ <last-activity>Dec-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.UInt32">
+ <last-activity>Dec-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.UInt64">
+ <last-activity>Dec-21-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.UIntPtr">
+ <last-activity>Aug-23-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>yes</completion>
+ <maintainers>
+ <maintainer>michaellambert@bellsouth.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Uri">
+ <last-activity>Jul-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>40</completion>
+ <maintainers>
+ <maintainer>rooneg@electricjellyfish.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.UriBuilder">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>scott@stonecobra.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.UriFormatException">
+ <last-activity>Jul-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>85</completion>
+ <maintainers>
+ <maintainer>scott@stonecobra.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.ValueType">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Version">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Void">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>miguel@ximian.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.BeginEventHandler">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.Cache">
+ <last-activity>Jul-20-2001</last-activity>
+ <implementation>no</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>Patrik.Torstensson@labs2.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.EndEventHandler">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.Hosting.AppDomainFactory">
+ <last-activity>Aug-30-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.Hosting.ApplicationHost">
+ <last-activity>Aug-30-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.Hosting.IAppDomainFactory">
+ <last-activity>Aug-30-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.Hosting.IISAPIRuntime">
+ <last-activity>Aug-30-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.Hosting.ISAPIRuntime">
+ <last-activity>Aug-30-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.Hosting.SimpleWorkerRequest">
+ <last-activity>Aug-30-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.HttpCacheability">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.HttpCacheRevalidation">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.HttpCacheValidateHandler">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.HttpCookie">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.HttpCookieCollection">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.HttpValidationStatus">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.HttpWorkerRequest">
+ <last-activity>Aug-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.HttpWorkerRequest.EndOfSendNotification">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.IHttpAsyncHandler">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.IHttpHandler">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.IHttpHandlerFactory">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.IHttpModule">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.ProcessShutdownReason">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.ProcessStatus">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.TraceMode">
+ <last-activity>Aug-9-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.BuildMethod">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.BuildTemplateMethod">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.Control">
+ <last-activity>Dec-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>0%</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.HtmlControlls.HtmlContainerControl">
+ <last-activity>Aug-22-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.HtmlControlls.HtmlControl">
+ <last-activity>Aug-22-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.HtmlControlls.HtmlGenericControl">
+ <last-activity>Aug-22-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.HtmlTextWriterAttribute">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.HtmlTextWriterStyle">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.HtmlTextWriterTag">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.IAttributeAccessor">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.IDataBindingsAccessor">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.ImageClickEventHandler">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.INamingContainer">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.IParserAccessor">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.IPostBackDataHandler">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.IPostBackEventHandler">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.ISiteManager">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.ITagNameToTypeMapper">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.ITemplate">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.IValidator">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.OutputCacheLocation">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.PersistanceMode">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.PropertyConverter">
+ <last-activity>Dec-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.StateBag">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.StateItem">
+ <last-activity>Aug-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100</completion>
+ <maintainers>
+ <maintainer>bob@thestuff.net</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.AdCreatedEventArgs">
+ <last-activity>Dec-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.AdCreatedEventHandler">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.AdRotator">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.BaseCompareValidator">
+ <last-activity>Jan-07-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.BaseDataList">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.BaseValidator">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.BorderStyle">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.BoundColumn">
+ <last-activity>Jan-07-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>60%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.Button">
+ <last-activity>Jan-17-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ButtonColumn">
+ <last-activity>Jan-09-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ButtonColumnType">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.Calendar">
+ <last-activity>Feb-21-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>98%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.CalendarDay">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.CalendarSelectionMode">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.CheckBox">
+ <last-activity>Jan-07-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.CheckBoxList">
+ <last-activity>Jan-07-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.CommandEventArgs">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.CommandEventHandler">
+ <last-activity>Dec-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.CompareValidator">
+ <last-activity>Jan-07-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.CustomValidator">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGrid">
+ <last-activity>Feb-21-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>95%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridColumn">
+ <last-activity>Mar-03-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridColumnCollection">
+ <last-activity>Mar-03-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>??%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridCommandEventArgs">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridCommandEventHandler">
+ <last-activity>Dec-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridItem">
+ <last-activity>Feb-21-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridItemCollection">
+ <last-activity>Mar-03-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridItemEventArgs">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridItemEventHandler">
+ <last-activity>Dec-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridPageChangedEventArgs">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridPageChangedEventHandler">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridPagerStyle">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridSortCommandEventArgs">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataGridSortCommandEventHandler">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataKeyCollection">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataList">
+ <last-activity>Feb-01-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>70%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataListCommandEventArgs">
+ <last-activity>Dec-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataListCommandEventHandler">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataListItem">
+ <last-activity>Mar-03-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>95%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataListItemCollection">
+ <last-activity>Mar-03-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataListItemEventArgs">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DataListItemEventHandler">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DayNameFormat">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DayRenderEventArgs">
+ <last-activity>Dec-18-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DayRenderEventHandler">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.DropDownList">
+ <last-activity>Jan-30-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.EditCommandColumn">
+ <last-activity>Mar-03-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>95%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.FirstDayOfWeek">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.FontInfo">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.FontNamesConverter">
+ <last-activity>Jan-28-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.FontSize">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.FontUnit">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.FontUnitConverter">
+ <last-activity>Jan-28-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>60%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.GridLines">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.HorizontalAlign">
+ <last-activity>Dec-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.HyperLink">
+ <last-activity>Dec-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.HyperLinkColumn">
+ <last-activity>Jan-09-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>5%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.HyperLinkControlBuilder">
+ <last-activity>Jan-09-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.Image">
+ <last-activity>Dec-27-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ImageAlign">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ImageButton">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.IRepeatInfoUser">
+ <last-activity>Dec-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.Label">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.LabelControlBuilder">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.LinkButton">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.LinkButtonControlBuilder">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ListBox">
+ <last-activity>Feb-07-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ListControl">
+ <last-activity>Dec-20-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ListItem">
+ <last-activity>Feb-02-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ListItemCollection">
+ <last-activity>Feb-02-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ListItemControlBuilder">
+ <last-activity>Jan-28-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ListItemType">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ListSelectionMode">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.Literal">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.LiteralControlBuilder">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.MonthChangedEventArgs">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.MonthChangedEventHandler">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.NextPrevFormat">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.PagedDataSource">
+ <last-activity>Mar-03-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.PagerMode">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.PagerPosition">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.Panel">
+ <last-activity>Jan-25-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.PlaceHolder">
+ <last-activity>Jan-30-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.PlaceHolderControlBuilder">
+ <last-activity>Jan-30-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RadioButton">
+ <last-activity>Jan-26-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RadioButtonList">
+ <last-activity>Jan-30-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>95%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RangeValidator">
+ <last-activity>Mar-03-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RegularExpressionValidator">
+ <last-activity>Mar-03-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RepeatDirection">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.Repeater">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>90%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RepeaterCommandEventArgs">
+ <last-activity>Dec-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RepeaterCommandEventHandler">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RepeaterItem">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>40%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RepeaterItemCollection">
+ <last-activity>Mar-02-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RepeaterItemEventArgs">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RepeaterItemEventHandler">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RepeatInfo">
+ <last-activity>Jan-31-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>90%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RepeatLayout">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.RequiredFieldValidator">
+ <last-activity>Feb-07-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.SelectedDatesCollection">
+ <last-activity>Mar-03-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ServerValidateEventArgs">
+ <last-activity>Mar-04-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ServerValidateEventHandler">
+ <last-activity>Dec-28-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.Style">
+ <last-activity>Jan-25-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.Table">
+ <last-activity>Jan-09-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TableCell">
+ <last-activity>Jan-09-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TableCellCollection">
+ <last-activity>Jan-18-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TableCellControlBuilder">
+ <last-activity>Jan-09-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TableHeaderCell">
+ <last-activity>Jan-18-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TableItemStyle">
+ <last-activity>Jan-25-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TableRow">
+ <last-activity>Jan-18-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TableRowCollection">
+ <last-activity>Jan-18-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TableStyle">
+ <last-activity>Jan-31-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TargetConverter">
+ <last-activity>Feb-01-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TemplateColumn">
+ <last-activity>Feb-01-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TextAlign">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TextBox">
+ <last-activity>Jan-27-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>80%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TextBoxControlBuilder">
+ <last-activity>Jan-27-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TextBoxMode">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.TitleFormat">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.Unit">
+ <last-activity>Dec-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.UnitConverter">
+ <last-activity>Jan-30-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.UnitType">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ValidatedControlConverter">
+ <last-activity>Jan-30-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ValidationCompareOperator">
+ <last-activity>Dec-17-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ValidationDataType">
+ <last-activity>Dec-16-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ValidationSummary">
+ <last-activity>Jan-30-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>??%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ValidationSummaryDisplayMode">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.ValidatorDisplay">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.VerticalAlign">
+ <last-activity>Dec-02-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>100%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.WebColorConverter">
+ <last-activity>Jan-30-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>??%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.WebControl">
+ <last-activity>Feb-01-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>40%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Web.UI.WebControls.Xml">
+ <last-activity>Jan-27-2002</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>75%</completion>
+ <maintainers>
+ <maintainer>gvaish@iitk.ac.in</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlAttribute">
+ <last-activity>Jul-29-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlAttributeCollection">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>90</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlComment">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>5</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlDocument">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>5</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlDocumentFragment">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>5</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlElement">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>10</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlLinkedNode">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlNamedNodeMap">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>90</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlNamespaceManager">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>jason@injektilo.org</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlNameTable">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>jason@injektilo.org</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlNode">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>5</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlNodeChangedEventArgs">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>90</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlNodeList">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlNodeType">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>jason@injektilo.org</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlParserContext">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>jason@injektilo.org</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlReader">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>jason@injektilo.org</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlResolver">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>jason@injektilo.org</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlSpace">
+ <last-activity>Jul-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>jason@injektilo.org</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlText">
+ <last-activity>Nov-19-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>no</test-suite>
+ <completion>50</completion>
+ <maintainers>
+ <maintainer>daniel-weber@austin.rr.com</maintainer>
+ </maintainers>
+ </class>
+ <class name="System.Xml.XmlTextReader">
+ <last-activity>Jul-15-2001</last-activity>
+ <implementation>yes</implementation>
+ <test-suite>yes</test-suite>
+ <completion>?</completion>
+ <maintainers>
+ <maintainer>jason@injektilo.org</maintainer>
+ </maintainers>
+ </class>
+</classes>
diff --git a/status/commands b/status/commands
new file mode 100755
index 00000000000..6c169d7baf5
--- /dev/null
+++ b/status/commands
@@ -0,0 +1,86 @@
+0,Class Libraries,index.html,index.src
+0,Namespace,namespace.html,namespace.src
+1,System,System.html,bn/System
+1,System.Collections,System.Collections.html,bn/System.Collections
+1,System.Collections.Specialized,System.Collections.Specialized.html,bn/System.Collections.Specialized
+1,System.ComponentModel,System.ComponentModel.html,bn/System.ComponentModel
+1,System.Configuration,System.Configuration.html,bn/System.Configuration
+1,System.Configuration.Assemblies,System.Configuration.Assemblies.html,bn/System.Configuration.Assemblies
+1,System.Data,System.Data.html,bn/System.Data
+1,System.Diagnostics,System.Diagnostics.html,bn/System.Diagnostics
+1,System.Drawing,System.Drawing.html,bn/System.Drawing
+1,System.Drawing.Drawing2D,System.Drawing.Drawing2D.html,bn/System.Drawing.Drawing2D
+1,System.Globalization,System.Globalization.html,bn/System.Globalization
+1,System.Globalization.Calendar,System.Globalization.Calendar.html,bn/System.Globalization.Calendar
+1,System.IO,System.IO.html,bn/System.IO
+1,System.Net,System.Net.html,bn/System.Net
+1,System.Net.Sockets,System.Net.Sockets.html,bn/System.Net.Sockets
+1,System.Reflection,System.Reflection.html,bn/System.Reflection
+1,System.Reflection.Emit,System.Reflection.Emit.html,bn/System.Reflection.Emit
+1,System.Resources,System.Resources.html,bn/System.Resources
+1,System.Runtime.Remoting,System.Runtime.Remoting.html,bn/System.Runtime.Remoting
+1,System.Runtime.Remoting.Activation,System.Runtime.Remoting.Activation.html,bn/System.Runtime.Remoting.Activation
+1,System.Runtime.Remoting.Contexts,System.Runtime.Remoting.Contexts.html,bn/System.Runtime.Remoting.Contexts
+1,System.Runtime.Remoting.Messaging,System.Runtime.Remoting.Messaging.html,bn/System.Runtime.Remoting.Messaging
+1,System.Runtime.Serialization,System.Runtime.Serialization.html,bn/System.Runtime.Serialization
+1,System.Runtime.Serialization.Formatters,System.Runtime.Serialization.Formatters.html,bn/System.Runtime.Serialization.Formatters
+1,System.Security,System.Security.html,bn/System.Security
+1,System.Security.Cryptography,System.Security.Cryptography.html,bn/System.Security.Cryptography
+1,System.Security.Permissions,System.Security.Permissions.html,bn/System.Security.Permissions
+1,System.Security.Policy,System.Security.Policy.html,bn/System.Security.Policy
+1,System.Text,System.Text.html,bn/System.Text
+1,System.Threading,System.Threading.html,bn/System.Threading
+1,System.Web,System.Web.html,bn/System.Web
+1,System.Web.Hosting,System.Web.Hosting.html,bn/System.Web.Hosting
+1,System.Web.HttpWorkerRequest,System.Web.HttpWorkerRequest.html,bn/System.Web.HttpWorkerRequest
+1,System.Web.UI,System.Web.UI.html,bn/System.Web.UI
+1,System.Web.UI.HtmlControlls,System.Web.UI.HtmlControlls.html,bn/System.Web.UI.HtmlControlls
+1,System.Web.UI.WebControls,System.Web.UI.WebControls.html,bn/System.Web.UI.WebControls
+1,System.Xml,System.Xml.html,bn/System.Xml
+0,Maintainer,maintainer.html,maintainer.src
+1,Matthew.S.Ford@rose-hulman.edu,Matthew.S.Ford@rose-hulman.edu.html,bm/Matthew.S.Ford@rose-hulman.edu
+1,Patrik.Torstensson@labs2.com,Patrik.Torstensson@labs2.com.html,bm/Patrik.Torstensson@labs2.com
+1,angryjohn69@nc.rr.com,angryjohn69@nc.rr.com.html,bm/angryjohn69@nc.rr.com
+1,bob@thestuff.net,bob@thestuff.net.html,bm/bob@thestuff.net
+1,cpodurgiel@msn.com,cpodurgiel@msn.com.html,bm/cpodurgiel@msn.com
+1,crichton@gimp.org,crichton@gimp.org.html,bm/crichton@gimp.org
+1,czw@home.se,czw@home.se.html,bm/czw@home.se
+1,daniel-weber@austin.rr.com,daniel-weber@austin.rr.com.html,bm/daniel-weber@austin.rr.com
+1,develop@wtfo-guru.com,develop@wtfo-guru.com.html,bm/develop@wtfo-guru.com
+1,dholden@draper.com,dholden@draper.com.html,bm/dholden@draper.com
+1,dick@ximian.com,dick@ximian.com.html,bm/dick@ximian.com
+1,dietmar@ximian.com,dietmar@ximian.com.html,bm/dietmar@ximian.com
+1,dmenest@yahoo.com,dmenest@yahoo.com.html,bm/dmenest@yahoo.com
+1,dsh2120@draper.com,dsh2120@draper.com.html,bm/dsh2120@draper.com
+1,duco@lorentz.xs4all.nl,duco@lorentz.xs4all.nl.html,bm/duco@lorentz.xs4all.nl
+1,duncan@ximian.com,duncan@ximian.com.html,bm/duncan@ximian.com
+1,fejj@ximian.com,fejj@ximian.com.html,bm/fejj@ximian.com
+1,gleb@eurosoft.od.ua,gleb@eurosoft.od.ua.html,bm/gleb@eurosoft.od.ua
+1,gvaish@iitk.ac.in,gvaish@iitk.ac.in.html,bm/gvaish@iitk.ac.in
+1,hildjj@cursive.net,hildjj@cursive.net.html,bm/hildjj@cursive.net
+1,iain@ximian.com,iain@ximian.com.html,bm/iain@ximian.com
+1,jason@injektilo.org,jason@injektilo.org.html,bm/jason@injektilo.org
+1,jbarn@httcb.net,jbarn@httcb.net.html,bm/jbarn@httcb.net
+1,joe@ximian.com,joe@ximian.com.html,bm/joe@ximian.com
+1,john.giffin@xor.com,john.giffin@xor.com.html,bm/john.giffin@xor.com
+1,kbottner@istation.com,kbottner@istation.com.html,bm/kbottner@istation.com
+1,lupus@ximian.com,lupus@ximian.com.html,bm/lupus@ximian.com
+1,macisaac@ximian.com,macisaac@ximian.com.html,bm/macisaac@ximian.com
+1,marcel@narings.nl,marcel@narings.nl.html,bm/marcel@narings.nl
+1,marcins@zipworld.com.au,marcins@zipworld.com.au.html,bm/marcins@zipworld.com.au
+1,martin.weindel@t-online.de,martin.weindel@t-online.de.html,bm/martin.weindel@t-online.de
+1,michaellambert@bellsouth.net,michaellambert@bellsouth.net.html,bm/michaellambert@bellsouth.net
+1,miguel@ximian.com,miguel@ximian.com.html,bm/miguel@ximian.com
+1,mkestner@speakeasy.net,mkestner@speakeasy.net.html,bm/mkestner@speakeasy.net
+1,mpultz@get2net.dk,mpultz@get2net.dk.html,bm/mpultz@get2net.dk
+1,ndrochak@gol.com,ndrochak@gol.com.html,bm/ndrochak@gol.com
+1,rooneg@electricjellyfish.net,rooneg@electricjellyfish.net.html,bm/rooneg@electricjellyfish.net
+1,scott@stonecobra.com,scott@stonecobra.com.html,bm/scott@stonecobra.com
+1,serge@wildwestsoftware.com,serge@wildwestsoftware.com.html,bm/serge@wildwestsoftware.com
+1,sm@cg.tuwien.ac.at,sm@cg.tuwien.ac.at.html,bm/sm@cg.tuwien.ac.at
+1,swildermuth@adoguy.com,swildermuth@adoguy.com.html,bm/swildermuth@adoguy.com
+1,toelen@hotmail.com,toelen@hotmail.com.html,bm/toelen@hotmail.com
+1,tomasr@mvps.org,tomasr@mvps.org.html,bm/tomasr@mvps.org
+1,tome@sbox.tugraz.at,tome@sbox.tugraz.at.html,bm/tome@sbox.tugraz.at
+1,vladimir@pobox.com,vladimir@pobox.com.html,bm/vladimir@pobox.com
+1,wictor@iBizkit.se,wictor@iBizkit.se.html,bm/wictor@iBizkit.se
diff --git a/status/compare-assembly.cs b/status/compare-assembly.cs
new file mode 100755
index 00000000000..87028889922
--- /dev/null
+++ b/status/compare-assembly.cs
@@ -0,0 +1,164 @@
+/*
+Tool #1:
+
+ compare file1.dll file2.dll annotations.xml
+
+ file1.dll: This is an assembly created by Microsoft.
+
+ file2.dll: This is a Mono assembly (currently we have none
+ that build).
+
+ annotations.xml: contains comments about a class:
+
+ <class name="System.Object">
+ <maintainer>
+ <email>miguel@ximian.com</email>
+ <name>Miguel de Icaza</name>
+ </maintainer>
+ <status test-suite="no" percent="XX">
+ </class>
+
+ That would generate an XML file with all the classes that are
+ implemented in the second library. If there is nothing for a
+ given class, it should generate an emtpy group:
+
+ <class name="System.Object">
+ </class>
+
+Tool #2:
+
+ Using a Perl script that can grok XML, generate HTML pages
+ that we can put on the web site:
+
+ Per assembly status.
+ Per maintainer status.
+ Per Percent status.
+
+*/
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Xml;
+
+namespace Mapper
+{
+ public class Mapper
+ {
+ Assembly ms, mono;
+ XmlDocument annotations, output;
+
+ public Mapper(string ms_lib, string mono_lib, string annotation)
+ {
+ Assembly ms = Assembly.LoadFrom (ms_lib);
+ Assembly mono = Assembly.LoadFrom (mono_lib);
+ annotations = new XmlDocument ();
+ annotations.Load (annotation);
+ output = new XmlDocument ();
+ }
+
+ void DumpMember (MemberInfo mi)
+ {
+ string kind;
+ string more="";
+
+ switch (mi.MemberType)
+ {
+ case MemberTypes.Field:
+ kind = "field";
+ break;
+ case MemberTypes.Method:
+ if (((MethodInfo)mi).IsSpecialName) {
+ return;
+ }
+ kind = "method";
+ more = " signature='" + mi.ToString() +"'";
+ break;
+ case MemberTypes.Event:
+ kind = "event";
+ break;
+ case MemberTypes.Property:
+ kind = "property";
+ break;
+ default:
+ kind = "***UNKOWN***";
+ break;
+ }
+ }
+
+ void DumpType (Type t)
+ {
+ string kind, name, attrs = "";
+
+ name = t.Name;
+
+ if (t.IsClass) {
+ kind = "class";
+ } else if (t.IsInterface) {
+ kind = "interface";
+ } else if (t.IsValueType) {
+ kind = "valueType";
+ } else if (t.IsEnum) {
+ kind = "enum";
+ } else return;
+
+ if (t.IsAbstract) {
+ attrs += "abstract='true'";
+ } else if (t.IsSealed) {
+ attrs += "sealed='true'";
+ } else if (t.IsCOMObject) {
+ attrs += "comobject='true'";
+ }
+
+ foreach (Type type in t.GetNestedTypes ()) {
+ DumpType (type);
+ }
+
+ foreach (FieldInfo field in t.GetFields ()) {
+ DumpMember (field);
+ }
+
+ foreach (MethodInfo method in t.GetMethods ()) {
+ DumpMember (method);
+ }
+
+ }
+
+ void LoadTypeList (Type [] types)
+ {
+ foreach (Type t in types) {
+ }
+ }
+
+ public void Map ()
+ {
+ Type [] types;
+ Module [] modules;
+ string name;
+
+ name = ms.GetName ().Name;
+ types = ms.GetExportedTypes ();
+ modules = ms.GetModules ();
+
+ DumpTypeList (types);
+ }
+
+ public static int Main(string[] args)
+ {
+ Mapper m;
+ string basedir = "c:\\WINDOWS\\Microsoft.NET\\Framework\\v1.0.2914\\";
+
+ if (args.Length != 3) {
+ Console.WriteLine ("usage: compare ms_lib.dll mono_lib.dll annotations.xml");
+ }
+ try {
+ m = new Mapper (args[0], args[1], args[2]);
+ m.Map ();
+ } catch (Exception e) {
+ Console.WriteLine("Error: " + e.ToString ());
+ }
+ return 0;
+ }
+ }
+}
+
diff --git a/status/index.src b/status/index.src
new file mode 100755
index 00000000000..04e2617f163
--- /dev/null
+++ b/status/index.src
@@ -0,0 +1,17 @@
+You can browse the status of the class library and see who has
+registered to work on what parts of the system. You can view either
+by maintainer or by namespace.
+<p>
+The tables represent things that contributors are working on. We
+register the date when they started working on a particular class, and
+whether a contributor has sent code in (the "implementation" column).
+<p>
+If you want to contribute to Mono, you want to pick a class which is
+not listed here. Alternatively, you can contact the maintainer of a
+class if you want for example to help him improve his code, make it
+faster, better, provide documentation or make comments.
+<p>
+Sometimes contributors will get too busy with other tasks, so they
+will abandon their work on a class. That is why we keep track of the
+time when they "reserve" a class to work on. If the contributor gets
+too busy, we will know if someone else can work on it
diff --git a/status/maintainer.src b/status/maintainer.src
new file mode 100755
index 00000000000..8f514e6c0f3
--- /dev/null
+++ b/status/maintainer.src
@@ -0,0 +1 @@
+These lists are by maintainer.
diff --git a/status/maintainers.xml b/status/maintainers.xml
new file mode 100755
index 00000000000..fa7984074c0
--- /dev/null
+++ b/status/maintainers.xml
@@ -0,0 +1,54 @@
+<maintainers>
+ <person email="miguel@ximian.com" name="Miguel de Icaza"/>
+ <person email="fejj@ximian.com" name="Jeffrey Stedfast"/>
+ <person email="jbarn@httcb.net" name="John Barnette"/>
+ <person email="iain@ximian.com" name="Iain"/>
+ <person email="bob@thestuff.net" name="Bob Smith"/>
+ <person email="joe@ximian.com" name="Joe Shaw"/>
+ <person email="marcins@zipworld.com.au" name="Marcin Szczepanski"/>
+ <person email="rooneg@electricjellyfish.net" name="Garrett Rooney"/>
+ <person email="angryjohn69@nc.rr.com" name="John R. Hicks"/>
+ <person email="czw@home.se" name="Jens Backman"/>
+ <person email="jason@injektilo.org" name="Jason Diamon"/>
+ <person email="macisaac@ximian.com" name="Sean MacIsaac"/>
+ <person email="vladimir@pobox.com" name="Vladimir Vukicevic"/>
+ <person name="Michael Lambert" email="michaellambert@bellsouth.net"/>
+ <person email="serge@wildwestsoftware.com" name="Sergey Chaban"/>
+ <person email="scott@stonecobra.com" name="Scott Sanders"/>
+ <person name="Garrett Rooney" email="rooneg@electricjellyfish.net"/>
+ <person name="David Menestrina" email="dmenest@yahoo.com"/>
+ <person name="Duco Fijma" email="duco@lorentz.xs4all.nl"/>
+ <person name="Patrik Torstensson" email="Patrik.Torstensson@labs2.com"/>
+ <person name="Tomas Restrepo" email="tomasr@mvps.org"/>
+ <person name="Derek Holden" email="dholden@draper.com"/>
+ <person name="Derek Holden" email="dsh2120@draper.com"/>
+ <person name="Gleb Novodran" email="gleb@eurosoft.od.ua"/>
+ <person name="Matthew S. Ford" email="Matthew.S.Ford@rose-hulman.edu"/>
+ <person name="Marcel Narings" email="marcel@narings.nl"/>
+ <person name="Joe Hildebrand" email="hildjj@cursive.net"/>
+ <person name="Nick Drochak" email="ndrochak@gol.com"/>
+ <person name="Mike Kestner" email="mkestner@speakeasy.net"/>
+ <person name="Jim Richardson" email="develop@wtfo-guru.com"/>
+ <person name="Leen Toelen" email="toelen@hotmail.com"/>
+ <person name="Chris Podurgiel" email="cpodurgiel@msn.com"/>
+ <person name="Stefan Maierhofer" email="sm@cg.tuwien.ac.at"/>
+ <person email="dick@ximian.com" name="Dick Porter"/>
+ <person email="lupus@ximian.com" name="Paolo Molaro"/>
+ <person email="dietmar@ximian.com" name="Dietmar Maurer"/>
+ <person name="Gaurav Vaish" email="Gaurav.Vaish@iitk.ac.in"/>
+ <person name="Mads Pultz" email="mpultz@get2net.dk"/>
+ <person name="Wictor Wilen" email="wictor@iBizkit.se"/>
+ <person name="Thomas Neidhart" email="tome@sbox.tugraz.at"/>
+ <person name="Martin Weindel" email="martin.weindel@t-online.de"/>
+ <person name="Shawn Wildermuth" email="swildermuth@adoguy.com"/>
+ <person name="Daniel Weber" email="daniel-weber@austin.rr.com"/>
+ <person name="John Griffin" email="john.giffin@xor.com"/>
+ <person name="Duncan Mak" email="duncan@ximian.com"/>
+ <person name="Keith Bottner" email="kbottner@istation.com"/>
+ <person name="Mark Crichton" email="crichton@gimp.org"/>
+ <person name="Daniel Morgan" email="danmorg@sc.rr.com"/>
+ <person name="Rodrigo Moya" email="rodrigo@ximian.com"/>
+ <person name="Jonathan Pryor" email="jonpryor@vt.edu"/>
+ <person name="Gonzalo Paniagua" email="gonzalo@ximian.com"/>
+</maintainers>
+
diff --git a/status/make_web.pl b/status/make_web.pl
new file mode 100755
index 00000000000..39796753ab0
--- /dev/null
+++ b/status/make_web.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl -w
+
+open COMMANDS, ">commands";
+
+print COMMANDS "0,Class Libraries,index.html,index.src\n";
+
+print COMMANDS "0,Namespace,namespace.html,namespace.src\n";
+$files_list = `ls bn`;
+@files = split(/\s+/, $files_list);
+foreach $file (@files) {
+ print COMMANDS "1,$file,$file.html,bn/$file\n";
+}
+
+print COMMANDS "0,Maintainer,maintainer.html,maintainer.src\n";
+$files_list = `ls bm`;
+@files = split(/\s+/, $files_list);
+foreach $file (@files) {
+ print COMMANDS "1,$file,$file.html,bm/$file\n";
+}
+
+close COMMANDS
diff --git a/status/makefile b/status/makefile
new file mode 100644
index 00000000000..8bb3931012a
--- /dev/null
+++ b/status/makefile
@@ -0,0 +1,36 @@
+NETDIR=c:\\winnt\\microsoft.net\\framework\\v1.0.2914
+MCSCLASSDIR=..\\..\\mcs\\class
+CSC=csc.exe /nologo
+
+all: ByMaintainer ByNamespace webfiles
+
+exec:
+ $(CSC) /debug+ /debug:full /target:exe /out:compare.exe compare-assembly.cs
+
+xml:
+ ./compare.exe $(NETDIR)\\mscorlib.dll $(MCSCLASSDIR)\\corlib\\corlib.dll > corlib.xml
+
+push:
+ scp -P 2200 *.xml web/*html www@www.ximian.com:/web/cvsmodules/mono/class-status
+
+clean:
+ -rm -f compare.exe compare.pdb corlib.xml ByMaintainer.exe ByNamespace.exe commands *~ .*~
+ -rm -rf src
+ -rm -rf bm
+ -rm -rf web
+
+ByNamespace: ByNamespace.xsl class.xml
+ $(CSC) ByNamespace.cs
+ -mkdir src
+ ./ByNamespace
+
+ByMaintainer: ByMaintainer.xsl class.xml
+ $(CSC) ByMaintainer.cs
+ -mkdir src
+ ./ByMaintainer
+
+webfiles:
+ -mkdir web
+ ./make_web.pl
+ cp *.src src
+ ../doc/web/process.pl commands ../doc/web/template.html.in web
diff --git a/status/mono-stats b/status/mono-stats
new file mode 100755
index 00000000000..64a2947df09
--- /dev/null
+++ b/status/mono-stats
@@ -0,0 +1,289 @@
+#!/usr/bin/perl -w
+
+use strict;
+use XML::Parser;
+#use Data::Dumper;
+
+# command line arguments: shell globs for the files containing the info
+# for the ms assemblyes and mono's
+my $msglob = shift || 'ms*.xml';
+my $monoglob = shift || 'mono*.xml';
+# maintainers file
+my $mfile = 'maintainers.xml';
+my $curfile;
+
+# positions in array refs
+use constant MNAME => 0;
+use constant MASSEMBLY => 1;
+use constant MCLASS => 2;
+
+use constant MAINTAINER => 0;
+use constant PERCENT => 1;
+use constant HASH => 2;
+# we store all the data in some global hash tables
+# $email => [$name, \%assembly, \%class]
+my %maintainer;
+
+# $name => [$maintainer, $percent, \%classes];
+my %assembly;
+
+# $name => [$maintainer, $percent, \%methods]
+my %class;
+
+# my parsing state machine
+my @status;
+# current maintainer, class and assembly pointers
+my ($curm, $curc, $cura);
+my $mono = 0;
+my $namespace = '';
+my %status_action = (
+ MAINTAINERS => sub {
+ my ($elem, %attrs) = @_;
+ malformed ($mfile, $elem, 'maintainers', \@status);
+ push @status, 'DUDE';
+ },
+ DUDE => sub {
+ my ($elem, %attrs) = @_;
+ malformed ($mfile, $elem, 'person', \@status);
+ foreach(qw(email name)) {die "$_ not included in person\n" unless defined $attrs{$_}}
+ $curm = $maintainer{$attrs{email}} = [$attrs{name}, {}, {}];
+ push @status, 'DUDE_CONTENT';
+ },
+ DUDE_CONTENT => sub {
+ my ($elem, %attrs) = @_;
+ malformed ($mfile, $elem, 'class|assembly', \@status);
+ if ($elem eq 'class') {
+ $curm->[MCLASS]->{$attrs{name}} = '';
+ } elsif ($elem eq 'assembly') {
+ $curm->[MASSEMBLY]->{$attrs{name}} = '';
+ }
+ push @status, 'DUDE_CONTENT';
+ },
+ ASSEMBLY => sub {
+ my ($elem, %attrs) = @_;
+ malformed ($curfile, $elem, 'assembly', \@status);
+ $namespace = '';
+ $cura = $assembly{$attrs{name}} = ['', 0, {}];
+ push @status, 'NAMESPACE';
+ },
+ NAMESPACE => sub {
+ my ($elem, %attrs) = @_;
+ malformed ($curfile, $elem, 'namespace', \@status);
+ $namespace = $attrs{name};
+ push @status, 'CLASS';
+ },
+ CLASS => sub {
+ my ($elem, %attrs) = @_;
+ malformed ($curfile, $elem, 'class|valueType|interface', \@status);
+ if ($elem eq 'class') {
+ my $name = $namespace ? $namespace.".".$attrs{name} : $attrs{name};
+ if ($mono) {
+ warn "mono implements non exisistent class $name\n"
+ if (!exists $class{$name});
+ $curc = $class{$name};
+ } else {
+ $curc = $class{$name} = ['', 0, {}];
+ }
+ $cura->[HASH]->{$name} = $mono;
+ push @status, 'METHOD';
+ } else {
+ push @status, 'METHOD';
+ }
+ },
+ METHOD => sub {
+ my ($elem, %attrs) = @_;
+ malformed ($curfile, $elem, 'method|field|valueType', \@status);
+ if ($elem eq 'method') {
+ my $name = $attrs{signature};
+ if ($mono) {
+ warn "mono implements non exisistent method $name\n"
+ if (!exists $curc->[HASH]->{$name});
+ }
+ $curc->[HASH]->{$name} = $mono;
+ push @status, 'METHOD';
+ } else {
+ push @status, 'METHOD';
+ }
+ },
+);
+
+
+my $parser = new XML::Parser (Handlers => {Start => \&handle_tag, End => \&end_tag});
+
+# parse the maintainers info
+if ($mfile) {
+ @status = 'MAINTAINERS';
+ $parser->parsefile($mfile);
+ #print Dumper(\%maintainer);
+}
+
+foreach (glob($msglob)) {
+ $curfile = $_;
+ @status = 'ASSEMBLY';
+ $mono = 0;
+ $parser->parsefile($_);
+}
+
+foreach (glob($monoglob)) {
+ $curfile = $_;
+ @status = 'ASSEMBLY';
+ $mono = 1;
+ $parser->parsefile($_);
+}
+
+create_stats();
+create_html();
+#print Dumper(\%assembly);
+#print Dumper(\%class);
+exit(0);
+
+sub malformed {
+ my ($file, $elem, $match, $data) = @_;
+ unless ($elem =~ /^$match$/) {
+ $data = Dumper($data) if defined $data;
+ die "file $file malformed ($elem instead of $match) $data\n"
+ }
+}
+
+sub handle_tag {
+ my $parser = shift @_;
+ my $status = $status[-1];
+ die "status $status unknown" unless exists $status_action{$status};
+ $status_action{$status}->(@_);
+}
+
+sub end_tag {
+ my $last = pop @status;
+ # print STDERR "done with $last\n";
+}
+
+sub assign_maintainer {
+ my ($m, $from, $to, $type) = @_;
+ foreach (keys %$from) {
+ if (!exists $to->{$_}) {
+ warn "$m maintains unknown $type $_\n";
+ # fixup to avoid warnings
+ $to->{$_}->[MAINTAINER] = $m;
+ $to->{$_}->[PERCENT] = 0;
+ $to->{$_}->[HASH] = {};
+ } else {
+ warn "$to->{$_}->[MAINTAINER] already maintains $_ (now $m)\n" if $to->{$_}->[MAINTAINER];
+ $to->{$_}->[MAINTAINER] = $m;
+ }
+ }
+}
+
+sub completeness {
+ my $hash = shift @_;
+ my $total = keys %$hash;
+ my $done = 0;
+ map {$done += $_} values %$hash;
+ return 0 unless $total;
+ return int($done*100/$total);
+}
+
+sub create_stats {
+ # set maintainer field in assembly and class hashes
+ foreach my $m (sort keys %maintainer) {
+ assign_maintainer ($m, $maintainer{$m}->[MASSEMBLY], \%assembly, 'assembly');
+ assign_maintainer ($m, $maintainer{$m}->[MCLASS], \%class, 'class');
+ }
+ # assign completeness percent
+ foreach my $ass (values %assembly) {
+ $ass->[PERCENT] = completeness ($ass->[HASH]);
+ }
+ foreach my $class (values %class) {
+ $class->[PERCENT] = completeness ($class->[HASH]);
+ }
+}
+
+sub html_header {
+ my ($title) = @_;
+return <<"EOF";
+<html><head><title>$title</title></head><body bgcolor="#ffffff">
+<h1 ALIGN=center>$title</H1>
+EOF
+
+}
+
+sub unimplemented ($) {
+ my ($c) = @_;
+ my $id = $c;
+ $id =~ tr/./-/;
+ return "<A HREF='per-unimplemented.html#$id'>$c</A>";
+}
+
+sub create_html {
+
+ open(F, ">per-assembly.html") || die "Cannot open file: $!";
+ print F html_header("Mono - per-assembly stats");
+ print F "<TABLE BORDER=1><TR><TH>Assembly<TH>Maintainer<TH>Completion\n";
+ foreach my $ass (sort keys %assembly) {
+ print F "\t<TR><TD>", join('<TD>', $ass, $assembly{$ass}->[MAINTAINER], $assembly{$ass}->[PERCENT]), "\n";
+ }
+ print F "</TABLE>\n";
+ print F "</body></html>\n";
+ close(F);
+
+ # per maintainer info
+ open(F, ">per-maintainer.html") || die "Cannot open file: $!";
+ print F html_header("Mono - per-maintainer stats");
+ print F "<TABLE BORDER=1><TR><TH>Maintainer<TH>Class<TH>Completion\n";
+ foreach my $m (sort keys %maintainer) {
+ my @classes = sort keys %{$maintainer{$m}->[MCLASS]};
+ my $count = @classes;
+ foreach my $c (@classes) {
+ my $start = $count?"\t<TR><TD ROWSPAN=$count>$m<TD>":"\t<TR><TD>";
+ $count = 0;
+ print F $start, join('<TD>', $c, $class{$c}->[PERCENT]), "\n";
+ }
+ }
+ my @unmantained = sort grep {!$class{$_}->[MAINTAINER]} keys %class;
+ my $count = @unmantained;
+ foreach my $c (@unmantained) {
+ my $start = $count?"\t<TR><TD ROWSPAN=$count>Unmantained<TD>":"\t<TR><TD>";
+ $count = 0;
+ print F $start, join('<TD>', $c, $class{$c}->[PERCENT]), "\n";
+ }
+ print F "</TABLE>\n";
+ print F "</body></html>\n";
+ close(F);
+
+ # per-completion info
+ open(F, ">per-completion.html") || die "Cannot open file: $!";
+ print F html_header("Mono - per-completion stats");
+ print F "<TABLE BORDER=1><TR><TH>Completion<TH>Class<TH>Maintainer\n";
+ foreach my $c (sort {$class{$b}->[PERCENT] <=> $class{$a}->[PERCENT]} keys %class) {
+ print F "\t<TR><TD>", join('<TD>', $class{$c}->[PERCENT], unimplemented($c), $class{$c}->[MAINTAINER]), "\n";
+ }
+ print F "</TABLE>\n";
+ print F "</body></html>\n";
+ close(F);
+
+ # unimplemented methods
+ # FIXME: this can create a very big file, split on assembly name
+ # and fix also the unimplemented() sub
+ open(F, ">per-unimplemented.html") || die "Cannot open file: $!";
+ print F html_header("Mono - unimplemented methods stats");
+ print F "<TABLE BORDER=1><TR><TH>Class<TH>Method\n";
+ foreach my $c (sort grep {$class{$_}->[PERCENT] != 100} keys %class) {
+ my @methods = sort grep {!$class{$c}->[HASH]->{$_}} keys %{$class{$c}->[HASH]};
+ my $count = @methods;
+ my $aname = '';
+ if ($count) {
+ my $id = $c;
+ $id =~ tr/./-/;
+ $aname = "<A NAME='$id'></A>";
+ }
+ foreach my $m (@methods) {
+ my $start = $count?"\t<TR><TD ROWSPAN=$count>$aname$c<TD>":"\t<TR><TD>";
+ $count = 0;
+ print F $start, join('<TD>', $m), "\n";
+ }
+ }
+ print F "</TABLE>\n";
+ print F "</body></html>\n";
+ close(F);
+
+}
+
diff --git a/status/namespace.src b/status/namespace.src
new file mode 100755
index 00000000000..0d20d369b35
--- /dev/null
+++ b/status/namespace.src
@@ -0,0 +1 @@
+These lists are by Namespace.
diff --git a/web/.cvsignore b/web/.cvsignore
new file mode 100644
index 00000000000..6d3ceb93234
--- /dev/null
+++ b/web/.cvsignore
@@ -0,0 +1,4 @@
+Makefile.in
+Makefile
+all-docs
+pending-classes.in
diff --git a/web/Makefile.am b/web/Makefile.am
new file mode 100644
index 00000000000..8ef4e422c5d
--- /dev/null
+++ b/web/Makefile.am
@@ -0,0 +1,32 @@
+WEB_FILES= \
+ ado-net c-sharp class-library contact contributing documentation download \
+ faq gcc-frontend ideas index passport rationale resources \
+ roadmap runtime status team testing thanks tools porting anoncvs monodoc-xml winforms
+
+OTHERS= pending resources-pending todo mono-build.sh mono-build-w32.sh
+
+EXTRA_DIST = $(WEB_FILES) README $(OTHERS)
+
+all-docs: $(WEB_FILES)
+ cat rationale roadmap c-sharp tools class-library \
+ runtime documentation download faq contributing \
+ resources status > all-docs
+
+class-status: class-status.in pending-classes Makefile.am
+ cat class-status.in pending-classes > class-status
+
+pending-classes:
+
+#pending-classes: pending-classes.in Makefile.am
+# echo "This is a list of pending classes, and links to their documentation on MSDN.Microsoft.com<p><p>" > pending-classes
+# for i in `cat pending-classes.in`; do x=`echo $$i | sed s/\\\.//g`; link=`echo http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrf@@@ClassTopic.asp | sed "s/@@@/$$x/"`; echo " <a href=\"$$link\">$$i</a><br>" >> pending-classes; done
+
+
+webit: dummy
+ (cd web; make && make push)
+
+push-notes:
+ scp release-notes/mono* www@www:/web/cvsmodules/mono/archive
+
+dummy:
+
diff --git a/web/README b/web/README
new file mode 100644
index 00000000000..333d133943f
--- /dev/null
+++ b/web/README
@@ -0,0 +1,17 @@
+To edit the website appearance:
+
+cd doc/web
+edit template.html.in
+make
+
+To edit website content:
+
+cd doc (this directory)
+edit files carefully
+cd web
+make
+
+To publish changes:
+
+cd web
+make push
diff --git a/web/ado-net b/web/ado-net
new file mode 100644
index 00000000000..438b47cb2be
--- /dev/null
+++ b/web/ado-net
@@ -0,0 +1,44 @@
+* ADO.NET
+
+ The coordinator for the ADO.NET implementation is <a
+ href="mailto:rodrigo@ximian.com">Rodrigo Moya</a>.
+
+* Action plan
+
+ The current plan to implement ADO.NET is as follows:
+
+ <b>Step 1:</b> SqlClient:
+
+ <ul>
+ * Implementation of System.Data.SqlClient based on
+ the PostgreSQL C API.
+
+ * Once the System.Data.SqlClient code is functional and
+ is usable by other people, we willl move it to
+ System.Data.PostgreSQL, and will convert the existing
+ System.Data.SqlClient to be just a wrapper around
+ System.Data.PostgreSQL.
+
+ </ul>
+
+ <b>Step 2:</b> OleDBClient:
+ <ul>
+ * On Unix systems: System.Data.OleDb will use LibGDA as its
+ engine.
+
+ LibGDA is the data access engine that is used by
+ Gnome-Db (only libgda, not libgnomedb at all).
+
+ * On Windows systems: System.Data.OleDb will use OLE-DB as
+ its engine.
+ </ul>
+
+ <b>Step 3:</b> System.Data.SqlClient Providers:
+
+ <ul>
+ * System.Data.SqlClient will then become a generic
+ proxy for binding to other SQL implementations other
+ than PostgreSQL (MySQL on Unix/Windows; MS SQL on
+ Window; Interbase on Unix/Windows). Others are welcomed.
+ </ul>
+
diff --git a/web/anoncvs b/web/anoncvs
new file mode 100644
index 00000000000..ed70a4c0074
--- /dev/null
+++ b/web/anoncvs
@@ -0,0 +1,70 @@
+* Anonymous CVS access
+
+ Anonymous access to the Mono is available currently from three
+ servers (anoncvs-spain-1.go-mono.com,
+ anoncvs-spain-2.go-mono.com and anoncvs-us-1.go-mono.com).
+
+ You can also use `anoncvs.go-mono.com', and that will pick a
+ server automatically for you.
+
+ Sources are currently being updated every hour.
+
+** Checking out the sources
+
+ To check out the sources for the first time from the
+ repository, use this command:
+
+<pre>
+ export CVSROOT=:pserver:anonymous@anoncvs.go-mono.com:/mono
+ cvs login
+ cvs -z3 co mcs mono gtk-sharp
+</pre>
+
+ That will get you the compiler and class libraries (mcs), the
+ interpreter and JITer (mono) and the Gtk# bindings.
+
+ The server is located in Spain.
+
+** Updating the sources
+
+ To update your sources every day, you use this command:
+
+<pre>
+ export CVSROOT=:pserver:anonymous@reypastor.hispalinux.es:/mono
+ cvs -z3 update -dP mcs mono gtk-sharp
+</pre>
+
+** Thanks
+
+ Thanks to <a href="http://www.hispalinux.es">HispaLinux</a>
+ for providing this Anon CVS server. The server is located in
+ Spain.
+
+ Special thanks to Jesus Climent, Rodrigo Moya, Juantomás
+ García and Ismael Olea for making this happen.
+
+<a name="#mirror">
+** Becoming an AnonCVS mirror
+
+ To become an AnonCVS mirror, you currently need about 20
+ megabytes of free disk space and bandwidth that you do not
+ mind sharing (you probably want enough to spare).
+
+ I need to be able to rsync to your machine from the main CVS
+ server. The preferred method to rsync is to setup ssh in your
+ machine.
+
+ The requirements are:
+ <ul>
+ * An account where we can ssh into.
+
+ * rsync.
+
+ * AnonCVS setup with the same paths as the rest of the
+ servers.
+
+ * Currently, about 40 megabytes of disk space, but this
+ will likely grow as the project evolves.
+
+ * A sysadmin contact e-mail address.
+ </ul>
diff --git a/web/asp-net b/web/asp-net
new file mode 100755
index 00000000000..49f31f872d4
--- /dev/null
+++ b/web/asp-net
@@ -0,0 +1,11 @@
+* ASP.NET
+
+ The classes for running ASP.NET are being actively written.
+ Gaurav, Leen and Patrik have been building the classes
+ required to run ASP.NET web application as well as a small
+ embeddable web server.
+
+ Currently ASP.NET does not work, but work is underway. If you
+ are interested in helping the effort please contact the
+ mono-list mailing list.
+
diff --git a/web/books b/web/books
new file mode 100644
index 00000000000..d5933e79836
--- /dev/null
+++ b/web/books
@@ -0,0 +1,37 @@
+* C# Books
+
+ A Programmer's Introduction to C# - Second Edition: Eric Gunnerson
+
+* Remoting
+
+ <a href="http://www.dotnetremoting.cc/book/AdvancedDotNetRemoting.asp">
+ Advanced .NET Remoting: Ingo Rammer</a>
+
+* Compiler Implementation
+
+ Compilers - Principles, Techniques, and Tools: Alfred V. Aho, Ravi Sethi,
+ Jeffrey D. Ullman
+
+ Advanced Compiler Design Implementation: Steven S. Muchnick
+
+ Modern Compiler Implementation in C: Andrew W. Appel
+
+ A Retargetable C Compiler - Design and Implementation: C. Fraser, David
+ Hanson
+
+* Reference Manuals
+
+ <a
+ href="http://developer.intel.com/design/pentium/manuals/24319101.pdf">Intel
+ Architecture Software Developer's Manual, Volume 2 - Instruction Set Reference Manual</a>
+
+ <a
+ href="http://www.caldera.com/developers/devspecs/abi386-4.pdf">System V ABI
+ - i386 Architecture Processor Supplement</a>
+
+ <a
+ href="http://www.caldera.com/developers/devspecs/mipsabi.pdf">System V ABI -
+ MIPS Processor supplement</a>
+
+ <a href="http://www.sparc.org/standards/V8.pdf">The SPARC Architecture
+ Manual Version 8</a> \ No newline at end of file
diff --git a/web/c-sharp b/web/c-sharp
new file mode 100644
index 00000000000..fa4dad1d732
--- /dev/null
+++ b/web/c-sharp
@@ -0,0 +1,223 @@
+* MCS: The Ximian C# compiler
+
+ MCS is currently able to compile itself and many more C#
+ programs (there is a test suite included that you can use).
+
+ We are in feature completion mode right now. There are still
+ a couple of areas that are not covered by the Mono compiler, but
+ they are very very few at this point.
+
+ MCS was able to parse itself on April 2001, MCS compiled itself
+ for the first time on December 28 2001. MCS became self hosting
+ on January 3rd, 2002.
+
+ The Mono Runtime and the Mono execution engine were able to make
+ our compiler self hosting on March 12, 2002.
+
+ A test suite is maintained to track the progress of
+ the compiler and various programs are routinely compiled and
+ ran.
+
+** Obtaining MCS
+
+ The Mono C# compiler is part of the `mcs' module in the Mono CVS
+ you can get it from our <a href="anoncvs.html">Anonymous CVS</a> server,
+ or you can get nightly <a href="download.html">download page</a>.
+
+** Running MCS
+
+ MCS is written in C# and uses heavily the .NET APIs. MCS runs
+ on Linux (with the Mono runtime) and Windows (with the .NET
+ framework runtime)
+
+** Reporting Bugs in MCS
+
+ When you report a bug, try to provide a small test case that would
+ show the error so we can include this as part of the Mono C# regression
+ test suite.
+
+ If the bug is an error or a warning that we do not flag, write
+ a sample program called `csXXXX.cs' where XXXX is the code number
+ that is used by the Microsoft C# compiler that illustrates the
+ problem. That way we can also do regression tests on the invalid
+ input.
+
+** Phases of the compiler
+
+ The compiler has a number of phases:
+
+ <ul>
+ * Lexical analyzer: hand-coded lexical analyzer that
+ provides tokens to the parser.
+
+ * The Parser: the parser is implemented using Jay (A
+ Berkeley Yacc port to Java, that I ported to C#).
+ The parser does minimal work and syntax checking,
+ and only constructs a parsed tree.
+
+ Each language element gets its own class. The code
+ convention is to use an uppercase name for the
+ language element. So a C# class and its associated
+ information is kept in a "Class" class, a "struct"
+ in a "Struct" class and so on. Statements derive
+ from the "Statement" class, and Expressions from the
+ Expr class.
+
+ * Parent class resolution: before the actual code
+ generation, we need to resolve the parents and
+ interfaces for interface, classe and struct
+ definitions.
+
+ * Semantic analysis: since C# can not resolve in a
+ top-down pass what identifiers actually mean, we
+ have to postpone this decision until the above steps
+ are finished.
+
+ * Code generation: The code generation is done through
+ the System.Reflection.Emit API.
+ </ul>
+
+** CIL Optimizations.
+
+ The compiler performs a number of simple optimizations on its input:
+ constant folding (this is required by the C# language spec) and
+ can perform dead code elimination.
+
+ Other more interesting optimizations like hoisting are not possible
+ at this point since the compiler output at this point does not
+ generate an intermediate representation that is suitable to
+ perform basic block computation.
+
+ Adding an intermediate layer to enable the basic block
+ computation to the compiler should be a simple task, but we
+ are considering having a generic CIL optimizer. Since all the
+ information that is required to perform basic block-based
+ optimizations is available at the CIL level, we might just skip
+ this step altogether and have just a generic IL optimizer that
+ would perform hoisting on arbitrary CIL programs, not only
+ those produced by MCS.
+
+ If this tool is further expanded to perform constant folding
+ (not needed for our C# compiler, as it is already in there)
+ and dead code elimination, other compiler authors might be
+ able to use this generic CIL optimizer in their projects
+ reducing their time to develop a production compiler.
+
+<a name="tasks">
+** Current pending tasks
+
+ Simple tasks:
+
+ <ul>
+ * Redo the way we deal with built-in operators.
+ </ul>
+
+ Larger tasks:
+ <ul>
+
+ * Jay does not work correctly with `error'
+ productions, making parser errors hard to point. It
+ would be best to port the Bison-To-Java compiler to
+ become Bison-to-C# compiler.
+
+ Nick Drochak has started a project on SourceForge for this.
+ You can find the project at: <a href="http://sourceforge.net/projects/jb2csharp/">
+ http://sourceforge.net/projects/jb2csharp/</a>
+
+ * Semantic Analysis: Return path coverage and
+ initialization before use coverage are two great
+ features of C# that help reduce the number of bugs
+ in applications. It is one interesting hack.
+
+ </ul>
+
+** Questions and Answers
+
+Q: Why not write a C# front-end for GCC?
+
+A: I wanted to learn about C#, and this was an exercise in this
+ task. The resulting compiler is highly object-oriented, which has
+ lead to a very nice, easy to follow and simple implementation of
+ the compiler.
+
+ I found that the design of this compiler is very similar to
+ Guavac's implementation.
+
+ Targeting the CIL/MSIL byte codes would require to re-architecting
+ GCC, as GCC is mostly designed to be used for register machines.
+
+ The GCC Java engine that generates Java byte codes cheats: it does
+ not use the GCC backend; it has a special backend just for Java, so
+ you can not really generate Java bytecodes from the other languages
+ supported by GCC.
+
+Q: If your C# compiler is written in C#, how do you plan on getting
+ this working on a non-Microsoft environment.
+
+ We will do this through an implementation of the CLI Virtual
+ Execution System for Unix (our JIT engine).
+
+ Our JIT engine is working for the purposes of using the compiler.
+ The supporting class libraries are being worked on to fully support
+ the compiler.
+
+Q: Do you use Bison?
+
+A: No, currently I am using Jay which is a port of Berkeley Yacc to
+ Java that I later ported to C#. This means that error recovery is
+ not as nice as I would like to, and for some reason error
+ productions are not being caught.
+
+ In the future I want to port one of the Bison/Java ports to C# for
+ the parser.
+
+Q: Should someone work on a GCC front-end to C#?
+
+A: I would love if someone does, and we would love to help anyone that
+ takes on that task, but we do not have the time or expertise to
+ build a C# compiler with the GCC engine. I find it a lot more fun
+ personally to work on C# on a C# compiler, which has an intrinsic
+ beauty.
+
+ We can provide help and assistance to anyone who would like to work
+ on this task.
+
+Q: Should someone make a GCC backend that will generate CIL images?
+
+A: I would love to see a backend to GCC that generates CIL images. It
+ would provide a ton of free compilers that would generate CIL
+ code. This is something that people would want to look into
+ anyways for Windows interoperation in the future.
+
+ Again, we would love to provide help and assistance to anyone
+ interested in working in such a project.
+
+Q: What about making a front-end to GCC that takes CIL images and
+ generates native code?
+
+A: I would love to see this, specially since GCC supports this same
+ feature for Java Byte Codes. You could use the metadata library
+ from Mono to read the byte codes (ie, this would be your
+ "front-end") and generate the trees that get passed to the
+ optimizer.
+
+ Ideally our implementation of the CLI will be available as a shared
+ library that could be linked with your application as its runtime
+ support.
+
+ Again, we would love to provide help and assistance to anyone
+ interested in working in such a project.
+
+Q: But would this work around the GPL in the GCC compiler and allow
+ people to work on non-free front-ends?
+
+A: People can already do this by targeting the JVM byte codes (there
+ are about 130 compilers for various languages that target the JVM).
+
+Q: Why are you writing a JIT engine instead of a front-end to GCC?
+
+A: The JIT engine and runtime engine will be able to execute CIL
+ executables generated on Windows.
+
+You might also want to look at the <a href="faq.html#gcc">GCC</a>
+section on the main FAQ
diff --git a/web/ccvs b/web/ccvs
new file mode 100644
index 00000000000..c7710b56601
--- /dev/null
+++ b/web/ccvs
@@ -0,0 +1,138 @@
+* CVS Access
+
+ If you are an active Mono developer, you can get a CVS account
+ that hosts the Mono source code.
+
+ If you are not a developer, but want to track the development, please
+ see the <a href="anoncvs.html">AnonCVS</a> instructions.
+
+ Send an e-mail to miguel with your public SSH key for this
+ purpose. Please specify if the key was generated with SSH1 or SSH2.
+
+ If you are using SSH2, please generate your key using:
+
+<pre>
+ ssh-keygen -t rsa
+</pre>
+
+ And mail me the id_rsa.pub file.
+
+ If you are using SSH1, run:
+<pre>
+ ssh-keygen
+</pre>
+
+ And mail me your identity.pub file.
+
+ You will need CVS and SSH. Windows users can get both by
+ installing Cygwin (<a
+ href="http://www.cygwin.com">http://www.cygwin.com</a>)
+
+ Unix users will probably have those tools installed already.
+
+** Checking out the sources
+
+ To check out the sources for the first time from the
+ repository, use this command:
+
+<pre>
+ export CVS_RSH=ssh
+ export CVSROOT=username@mono-cvs.ximian.com:/cvs/public
+ cvs -z3 co mcs mono
+</pre>
+
+** Updating your sources
+
+ Every day people will be making changes, to get your latest
+ updated sources, use:
+
+<pre>
+ cvs -z3 update -Pd mcs mono
+</pre>
+
+ Note: The '-z3' enables compression for the whole cvs action.
+ The '-Pd' makes the update operation (P)rune directories that
+ have been deleted and get new (d)irectories added to the
+ repository.
+
+** Making patches
+
+ Usually you will want to make a patch to contribute, and let
+ other people review it before commiting it. To obtain such a
+ "patch", you type:
+
+<pre>
+ cd directory-you-want-to-diff
+ cvs -z3 diff -u > file.diff
+ mail mono-list@ximian.com < file.diff
+</pre>
+
+** Keeping track of changes.
+
+ We provide two e-mail based mechanisms to keep track of
+ changes to the code base:
+
+ <ul>
+ * <a href="mailto:mono-patches-request@ximian.com">
+ mono-patches@ximian.com</a>: This mailing list receives
+ in patch form all the changes that are being made to the
+ CVS.
+
+ * <a href="mailto:mono-cvs-list-request@ximian.com">
+ mono-cvs-list@ximian.com</a>: This mailing list only
+ receives the CVS commit logs with a list of files
+ modified.
+ </ul>
+
+ We hope to offer LXR and Bonsai in the future as well.
+
+** Commiting your work
+
+ Once you get approval to commit to the CVS, or if you are
+ commiting code that you are the maintainer of, you will want
+ to commit your code to CVS.
+
+ To do this, you have to "add" any new files that you created:
+
+<pre>
+ cvs add new-file.cs
+</pre>
+
+ And then commit your changes to the repository:
+
+<pre>
+ cvs commit file-1.cs file-2.cs
+</pre>
+
+** The Mailing List
+
+ To keep track of the various development and changes to the
+ CVS tree, you can subscribe to the mono-cvs-list@ximian.com.
+ To subscribe, send an email message to
+ mono-cvs-list-request@ximian.com and in the body of the
+ message put `subscribe'.
+
+ This will send you an email message every time a change is
+ made to the CVS repository, together with the information that
+ the author of the changes submitted.
+
+** Recommendations
+
+ Please do not commit code that would break the compile to the
+ CVS, because that normally wastes everybody's time. Two things
+ are important in this step: trying to build your sources and making
+ sure that you add all the new files before you do a commit.
+
+ To build the sources, most of the type trying the `make' command
+ is enough. In some cases (the class libraries) we use nant, so
+ you need to run nant manually.
+
+ Use ChangeLog entries so we can keep textual descriptions of
+ your work, and use the contents of your ChangeLog file as the
+ CVS commit message (ie, paste the contents of this into the
+ editor buffer).
+
+ If you are making changes to someone else's code, please make
+ sure you get in touch with the maintainer of that code before
+ applying patches. You want to avoid commiting conflicting
+ work to someone else's code.
diff --git a/web/class-library b/web/class-library
new file mode 100644
index 00000000000..95b56cacf9d
--- /dev/null
+++ b/web/class-library
@@ -0,0 +1,190 @@
+* The Class Library
+
+ The Class Library should be compatible with Microsoft's .NET
+ implementation.
+
+ Please see the <a href="class-status.html">Class Status</a>
+ page for a status of who is working on which classes.
+
+ We will write as much code as possible in C#. We may need to
+ interface with code written in C to gain access to the
+ functionality of libraries like libart, Gtk+, and libc.
+
+** Contributing
+
+ We welcome contributions to the the Class Library. To get
+ started, check the status page for information about which
+ APIs are being worked on, and how to get in touch with
+ individual maintainers.
+
+ If you want to work on a class, first check the <a
+ href="download.html">Classes Distribution</a> to see if it is
+ not implemented yet, if not, check the <a
+ href="class-status.html">Class Status</a> to see if someone is
+ already working on it, and maybe contact them.
+
+ If nobody is working on it, mail <a
+ href="mailto:mono-list@ximian.com">mono-list@ximian.com</a>
+ with the class you want to implement and CC <a
+ href="mailto:miguel@ximian.com">miguel@ximian.com</a>.
+
+ You can also track live the activities of the Mono CVS module
+ by subscribing to the <a
+ href="http://lists.ximian.com/mailman/listinfo/mono-cvs-list">mono-cvs-list</a>
+
+
+** Missing features
+
+ Our class libraries miss some features, for example, most classes
+ do not implement the serialization bits at all, it would be a good
+ contribution to add this to each class.
+
+ This is a simple task, but it needs to be done in a compatible way
+ with the Microsoft.NET classes: using the same arguments to serialize
+ and reincarnate data.
+
+** Layout
+
+ The Class Library resides in the `mcs' module in the directoy
+ `class'.
+
+ Each directory in the directory represents the assembly where
+ the code belongs to, and inside each directory we divide the
+ code based on the namespace they implement.
+
+ There are two cases when we should consider portability: when
+ we are dealing with a couple of classes only that differ from
+ system to system (Consider System.Net and System.IO for Win32
+ and Unix). In those cases we will just place the files for
+ example on <t>corlib/System/System.IO/Unix-Console.cs</t> and
+ <t>corlib/System/System.IO/Win32-Console.cs</t>.
+
+ For classes that might differ more (for example, the
+ implementation of Windows.Forms), we might have different
+ directories altogether: <t>System.Windows.Forms/Win32</t>,
+ <t>System.Windows.Forms/Gtk+</t> and
+ <t>System.Windows.Forms/Cocoa</t>.
+
+** Using existing components from GNOME.
+
+ Our current plan is to implement the GUI tools on top of
+ Gtk+. The only obstacle here is that applications from Windows
+ might expect to be able to pull the HWND property from the
+ widgets and use PInvoke to call Windows functions.
+
+** Class Library and Win32 dependencies.
+
+ There are a few spots where the Win32 foundation is exposed to
+ the class library (for example, the HDC and HWND properties in
+ the GDI+). Casual inspection suggests that these can be
+ safely mapped to Gdk's GC and GdkWindow pointers without
+ breaking anything.
+
+ The only drawback is that support for PInvoke of Win32 code
+ won't be available. An alternate solution would be to use
+ portions of Wine, or even to use Wine as our toolkit.
+
+*** Initial GDI+ and WinForms implementation
+
+ The initial implementation will use Gtk+ as the underlying
+ toolkit. Since GTK+ has already been ported to many windowing
+ systems other than X (including frame buffer, Win32, and BeOS)
+ its use should cover most applications for most users.
+
+*** Database access
+
+ We will implement ADO.NET functionality by reusing <a
+ href="http://www.gnome-db.org">GNOME-DB</a>. This is an ideal
+ choice, since GNOME-DB was implemented precisely to provide an
+ ADO-like system for GNOME.
+
+*** Component Integration
+
+ We will provide a new namespace to use GNOME specific features
+ as well as a namespace to host Bonobo interfaces and classes
+ in Mono.
+
+** Licensing
+
+ The class library is being licensed under the terms of the
+ <a
+ href="http://www.opensource.org/licenses/mit-license.html">MIT
+ license.</a> This is the same license used by the X11 window
+ system.
+
+** Class Library testing
+
+ We need to write regression tests that will verify
+ the correctness of the class library, compiler, and JIT
+ engine.
+
+ Please write your regression tests using <a
+ href="http://nunit.sourceforge.net">NUnit</a>
+
+** Coding conventions
+
+ Please follow the conventions on the ECMA specification (On
+ the Annex Partition) for your coding your libraries.
+
+ Use 8 space tabs for writing your code (hopefully we can keep
+ this consistent). If you are modifying someone else's code, try
+ to keep the coding style similar.
+
+ For a rationale on 8 space tabs, read Linus Torvald's Coding
+ Style guidelines in the Linux kernel source for a rationale.
+
+*** Missing implementation bits
+
+ If you implement a class and you are missing implementation bits,
+ please put in the code the word "TODO" and a description of what
+ is missing to be implemented.
+
+*** Tagging buggy code
+
+ If there is a bug in your implementation tag the problem by using
+ the word "FIXME" in the code, together with a description of the
+ problem.
+
+ Do not use XXX or obscure descriptions, because otherwise people
+ will not be able to understand what you mean.
+
+*** Tagging Lame specs
+
+ Sometimes the specification will be lame (consider Version.ToString (fieldCount)
+ where there is no way of knowing how many fields are available, making the API
+ not only stupid, but leading to unreliable code).
+
+ In those cases, use the keyword "LAMESPEC".
+
+** Namespaces
+
+ We are using a number of namespaces in the class libraries for
+ private classes when we need them, you are encouraged to use these:
+
+<pre>
+Mono
+ .Languages // General Compiler classes
+ .CSharp // Specific C# parsing/tokenizing classes
+ .MonoBASIC // Specific VB.NET/MonoBASIC parsing/tokenizing classes
+ .Python // Specific Python parsing/tokenizing classes
+ .Runtime
+ .LateBind // General latebinding-support for MonoBASIC/Python
+ .MonoBASIC // Specific runtime classes for MonoBASIC programs
+ .Python // Specific runtime classes for Python programs
+ .Web
+ .UI
+ .Utils // Gaurav utility classes
+</pre>
+
+** FAQ
+
+Frequently asked questions about the class library:
+
+Q: I am writing a new class that overrides one of the system classes,
+ and I am getting a 1595 warning from the compiler. Should we use a
+ different namespace?
+
+A: There is a quick solution to the problem, you can pass the command
+ line argument /nowarn:1595 and this will effectively let you use
+ your implementation of the code, while overriding the ones from the
+ system assemblies. \ No newline at end of file
diff --git a/web/class-status.in b/web/class-status.in
new file mode 100644
index 00000000000..a66aa18092e
--- /dev/null
+++ b/web/class-status.in
@@ -0,0 +1,26 @@
+* Status of the various pieces of the class library
+
+ You can browse the status of the class library and see who has
+ registered to work on what parts of the system. These list
+ work-in-progress components currently.
+
+ Browse the current <a href="class-status/index.html">status</a>.
+
+ You can also download the XML <a
+ href="class-status/maintainers.xml">maintainers</a> file that
+ contains the actual maintainers list.
+
+ You can also download the master <a
+ href="class-status/class.xml">Class Status XML</a> file.
+
+* List of not-implemented classes
+
+ Pick from the list of assemblies in the menu on the left to
+ view the current status of that assembly.
+
+ The tree shows items that are either missing or that have TODO
+ attributes associated with them.
+ You can use the checkboxes to show only missing or only TODO items.
+
+ Clicking on a name will take you to the <a href="http://msdn.microsoft.com/">MSDN documentation</a> for that item.
+ CTRL-Clicking will take you to the <a href="http://cvs.hispalinux.es/cgi-bin/cvsweb/?cvsroot=Mono">mono CVS tree</a>.
diff --git a/web/classlib-doc b/web/classlib-doc
new file mode 100644
index 00000000000..14fdc9e7191
--- /dev/null
+++ b/web/classlib-doc
@@ -0,0 +1,105 @@
+* Class Library Documentation
+
+** Summary
+
+ <em>
+ [This documentation is in progress. Comments to
+ <a href="mailto:jbarn@httcb.net">jbarn@httcb.net</a>.]
+ </em>
+
+ While using inline XML tags to document classes is certainly
+ convenient, properly verbose documentation quickly overwhelms
+ the code, making the source quite difficult to read. Furthermore,
+ multilingual documentation makes for significant additional text.
+
+ With these considerations in mind, Mono will use external XML files
+ for type documentation, rather than documenting the source inline.
+
+ Several tools will be created for managing, verifying, generating,
+ and updating class library documentation, including:
+
+ <ul>
+ <li><a href="#docstub">docstub</a></li>
+ <li><a href="#docverify">docverify</a></li>
+ <li><a href="#docconv">docconv</a></li>
+ <li><a href="#docgen">docgen</a></li>
+ <li><a href="#monodoc">monodoc</a></li>
+ </ul>
+
+** XML Documentation Files and Formats
+
+
+*** Monodoc XML
+ This XML is similar to the XML documentation described in the
+ C# standard, with added tags for internationalization and a
+ slightly different structure. Documentation and a DTD/Schema
+ for Monodoc XML is forthcoming.
+
+ Monodoc XML does not contain any definitive type information,
+ and is only useful in conjunction with the Type definition for
+ whatever is being documented.
+
+ This XML could be generated by hand, by monostub, or by monodoc.
+
+*** Assembly XML
+ This XML is generated by combining runtime type information for
+ an Assembly with a collection of Monodoc XML files. The resultant
+ XML (in the best of cases) contains both complete type and
+ documentary information for each type in the assembly.
+
+ This XML contains enough information to be transformed into
+ user-accessible documentation. It is likely that scripts
+ will be created to generate reference docs as HTML and other
+ formats.
+
+ Documentation and a DTD/Schema for Assembly XML is forthcoming.
+
+** Documentation Tools
+
+*** <a name="docstub">docstub</a>
+ Given a type name and an assembly, generates stub Monodoc XML
+ documentation for the type. Optionally, docstub can attempt to
+ populate initial documentation from an XML file in the format
+ published along with the ECMA standard.
+
+*** <a name="docverify">docverify</a>
+ Given a Monodoc XML file and an assembly, verifies that the
+ documentation matches the compiled type. Checks signatures,
+ parameters, et cetera.
+
+*** <a name="docconv">docconv</a>
+ Converts from Monodoc XML to the standard C# compiler-emitted
+ XML format and vice versa.
+
+*** <a name="docgen">docgen</a>
+ Given an assembly and a collection of Monodoc XML files, creates
+ an Assembly XML file containing all documentation and type information
+ available. This output is suitable for transforming into user
+ documentation.
+
+*** <a name="monodoc">monodoc</a>
+ A GUI tool for documentation and translation, this encapsulates
+ the capabilities of docstub, docverify, docconv, and docgen in
+ a friendly user interface. In addition, monodoc provides features
+ to ease translation, such as side-by-side editing and coverage
+ statistics.
+
+** Status and Roadmap
+
+*** 2 January 2002
+
+ As I write the initial version of this document, very little has been
+ implemented. Currently, there is a:
+
+ <ul>
+ <li>Preliminary version of the Monodoc XML format</li>
+ <li>Preliminary version of the docstub utility</li>
+ </ul>
+
+ Here's hoping for frequent, productive updates.
+
+** Get Involved
+
+ Help us define Mono's documentation structure! Subscribe to
+ <a href="http://lists.ximian.com/mailman/listinfo/mono-docs-list">mono-docs-list</a>
+ and wade right in.
diff --git a/web/contact b/web/contact
new file mode 100644
index 00000000000..74e09d9a195
--- /dev/null
+++ b/web/contact
@@ -0,0 +1,13 @@
+* Contacting the Mono team.
+
+ You can contact the general forum of discussion by sending
+ e-mail to <a href="mailto:mono-list@ximian.com">mono-list@ximian.com</a>
+
+ You can contact me (Miguel de Icaza) by sending e-mail to <a
+ href="mailto:miguel@ximian.com">miguel@ximian.com</a>. My web
+ page is <a
+ href="http://primates.ximian.com/~miguel">http://primates.ximian.com/~miguel"</a>
+
+ You can also <a
+ href="http://www.ximian.com/about/contact.php3">reach Ximian.</a>
+
diff --git a/web/contributing b/web/contributing
new file mode 100644
index 00000000000..5bec9cefda5
--- /dev/null
+++ b/web/contributing
@@ -0,0 +1,189 @@
+* Contributing to the Mono project
+
+ There are many ways in which you can help in the Mono project:
+
+ <ul>
+ * <b>Programmers:</b> You can work on a free
+ implementation of the <a
+ href="class-library.html">class libraries</a>, the
+ <a href="runtime.html">runtime engine</a>, <a
+ href="tools.html">the tools</a>, the <a
+ href="testing.html">testing framework</a>
+
+ * <b>Writers:</b> You can help us bywriting <a
+ href="documentation.html">documentation</a>.
+ </ul>
+
+ Those are just broad things that need to be worked on, but
+ something that would help tremendously would be to help with
+ small duties in the project that need to be addressed.
+
+ You can see what needs to be done in the class libraries <a href="class-status.html">here</a>
+
+** To start contributing
+
+ As a programmer, you can contribute in three different scenarios to Mono:
+
+ <ul>
+ * If you only have Linux/Unix.
+ * If you only have Windows.
+
+ * If you have both Linux and Windows.
+ </ul>
+
+ You might also want to check our <a href="#setup">common
+ setups</a> section that describes some common setups that people
+ use while working on Mono.
+
+*** Contributing to the class library, regression tests or the compiler
+
+ This only requires Windows currently.
+
+ To start developing classes or to contribute to the compiler,
+ you only need Windows and the .NET Framework 1.0 SDK. Please notice
+ that you do not need Visual Studio (although you can use it if
+ you want). The .NET Framework SDK requires some version of
+ Windows XP or Windows NT. If you are running Windows 98, 95
+ or Me, you could use instead the <a
+ href="http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/829/msdncompositedoc.xml">.NET Redist package</a>, but it
+ lacks the documentation browser and the ildasm program (C#, VB, JScript and IL
+ assembler are included).
+
+ You can get it <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>
+
+ If you are new to .NET, writing regression tests is a good way
+ of starting to contribute: it will help you get used to C# as
+ well as getting comfortable with the .NET APIs.
+
+ This helps because at this point you might be the best
+ qualified person to fix a problem found by the regression
+ test, or you might have a new class to implement in the .NET
+ world that only has a test suite.
+
+ To get started writing tests see the <a href="testing.html">Test Suite</a>
+ section.
+
+*** Contributing to the runtime engine
+
+ This only requires Linux, currently some tasks are easier if you
+ have access to Windows as well.
+
+ Here are a few things you can do:
+ <ul>
+ * Port the runtime to other architectures.
+ * Port the runtime to other operating systems.
+ * Finish the IL code verifier in the runtime.
+ * Hack the JIT, improve the code generator, add new
+ pattern rules, improve the register allocator.
+ * Implement the debugging interfaaces
+ </ul>
+
+** Bug reporting
+
+ If you find bugs in Mono, please make sure you enter a bug
+ report so we can keep track of problems in Mono.
+
+ To enter bug reports go to <a href="http://bugzilla.ximian.com">
+ http://bugzilla.ximian.com</a> and enter bug reports against
+ your favorite component (Mono, Runtime, C# compiler).
+
+ You can review the list of current bugs by going <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FClass+Libraries&product=Mono%2FMCS&product=Mono%2FRuntime&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&order=%27Importance%27&form_name=query">here</a>
+
+** Small tasks
+
+ A few smaller tasks are here, dropped in no particular order:
+ <ul>
+ * <b>Mono/doc and web site:</b> They need to be
+ packaged up in the official `distribution'
+
+ * Adding serialization support to all the classes.
+
+ We have many classes, but we have not implemented in
+ many cases the serialization and re-incarnation support in
+ them (this is pretty straight forward code, and simple,
+ but there is a lot to be done here).
+ </ul>
+
+* Emacs support
+
+ Brad Merryl's C# mode for Emacs is available: <a
+ href="http://www.cybercom.net/~zbrad/DotNet/Emacs/">http://www.cybercom.net/~zbrad/DotNet/Emacs/</a>
+
+* Books on C# and DotNet.
+
+ <ul>
+ * Dotnet Books (<a href="http://www.dotnetbooks.com">http://www.dotnetbooks.com</a>)
+
+ * Dotnet Resources (<a href="http://www.dotnetexperts.com/resources/">
+ http://www.dotnetexperts.com/resources</a>)
+
+ * O'Reilly C# Essentials (<a href="http://www.oreilly.com/catalog/csharpess/">
+ http://www.oreally.com/catalog/csharpess</a>)
+
+ * O'Really .NET Essentials (<a href="http://www.oreilly.com/catalog/dotnetfrmess/">
+ http://www.oreally.com/catalog/dotnetfrmess</a>)
+ </ul>
+
+<a name="setup">
+* Common Setups
+
+ People running both Linux and Windows while contributing to
+ Mono use a number of tricks to increase their productivity.
+
+ Scenarios:
+
+ <ul>
+ * <b>Linux host and Windows host</b>
+
+ The Windows file system is shared (right click on
+ your hard drive icon, and select sharing, allow this
+ to be shared).
+
+ The Windows machine has the required build tools
+ (cygwin, and the .NET framework). On the Windows
+ machine, you want to setup the ssh server (run the
+ ssh-host-config program to configure your ssh) and
+ run it (from a cygwin terminal, type: /usr/sbin/sshd).
+
+ From the Linux side, you want to mount the Windows
+ file system, using something like this:
+
+<tt><pre>
+ mount -t smbfs -o uid=miguel,username="Miguel de Icaza" "//quack/c$" /mnt
+</pre></tt>
+
+ In the above example, my Linux user name is
+ `miguel', and this will allow this user to have
+ read/write access to the share.
+
+ The host name is `quack', and the name of the share
+ is `c$' (that is the C: partition).
+
+ The file system is accessible on /mnt.
+
+ You can perform your cvs update and cvs commits from
+ the /mnt directory, and run Emacs or your favorite
+ Linux text editor on the Unix side in this way.
+
+ Then from another terminal, you can ssh into your
+ Windows box using ssh, like this: ssh "Miguel de Icaza@quack"
+ </ul>
+
+* Special Note
+
+ If you have looked at Microsoft's implementation of .NET or
+ their shared source code, you may not be able to contribute
+ to Mono. Details will follow when we know more about this.
+
+ In general be careful when you are implementing free software
+ and you have access to proprietary code. We need to make sure
+ that we are not using someone else's copyrighted code
+ accidentally.
+
+ Please do not use the <b>ildasm</b> program to disassemble
+ proprietary code when you are planning to reimplement a class
+ for Mono. If you have done this, we might not be able to use
+ your code.
+
+ Please stick to published documentation for implementing any
+ classes.
diff --git a/web/devel-faq b/web/devel-faq
new file mode 100644
index 00000000000..9ca89285219
--- /dev/null
+++ b/web/devel-faq
@@ -0,0 +1,190 @@
+* Developer FAQ
+
+** New classes
+
+Q: Should we write classes which are not part of the .NET or ECMA specs?
+
+A: Yes. The ECMA and .NET specifications are far from complete, and
+ to produce a complete platform we will need a number of other
+ classes and components.
+
+ Any new classes that are not part of .NET or ECMA should be
+ designed to be reusable on anyone's CLI implementation. So that
+ Windows developers can also use any new classes that we come up
+ with.
+
+ We have a few existing <a href="ideas.html">Ideas on missing
+ classes</a>
+
+** Language Compatibility
+
+Q: What is the magic that allow multiple languages to co-exist?
+
+A: From Fergus Henderson:
+
+<i><blockquote>
+There are different levels of interoperability.
+The ECMA spec defines different categories of
+CLS (Common Language Specification) conformance.
+There are also some useful categories that don't
+correspond to any of the levels defined in the ECMA spec.
+In increasing degree of difficulty, your language implementation
+can
+
+ <ul>
+ * (a) just generate IL
+
+ * (b) be a CLS "consumer", which means that it can read in
+ meta-data describing component interfaces,
+ and that it provides a way to declare variables of
+ CLS-complaint types and to call CLS-complaint methods.
+
+ * (c) be a CLS "extender", which means that it can in addition
+ derive from CLS-compliant classes
+ and implement CLS-compliant interfaces
+
+ * (d) be able to produce components with *any* CLS-compliant
+ component interface.
+ </ul>
+
+Supporting some of these may require extending your language. However,
+you can get quite a lot of interoperability by just putting appropriate
+functionality in your compiler, without extending your language.
+
+For some things, e.g. ASP.NET, your language implementation also needs to be
+able to
+
+ <ul>
+ * (e) consume CodeDom trees. CodeDom trees are an abstract
+ representation of programs in a form similar to a C# parse
+ tree, with embedded code snippets (unparsed strings).
+ Given a CodeDom tree, with the snippets in your language,
+ your language implementation needs to generate a (i) .NET
+ assembly and possibly also (ii) a source file in your language.
+
+ * (f) produce CodeDom trees. For some applications,
+ your language implementation also needs to be able to
+ round-trip from CodeDom -> your language -> CodeDom.
+ </ul>
+
+and for some things it needs to
+
+ <ul>
+ * (g) generate *verifiable* IL
+ </ul>
+
+So when you hear all the hype about how language XYZ is a
+".NET language", make sure you ask which of these different
+things are supported.
+
+[For the record, Mercury currently supports (a). We're working on
+(b) and (g), and on parts of (c) and (e). We're never going to do (f), I very
+strongly doubt we'll ever do (d), and for (c) we might only ever support
+implementing interfaces, not deriving from classes.]
+
+</blockquote></i>
+
+** PInvoke
+
+Q: What are the two major initiatives to implement PInvoke?
+
+A: Fergus Henderson answers:
+
+<i><blockquote>
+Many of the .NET APIs will need to be implemented using code that calls C/Unix
+APIs, such as stat(). The standard way of interfacing with native code from
+.NET code is to use "PInvoke". However, there is a difficulty: many of
+these APIs are defined in terms of types such as C's `long' or `size_t'
+or the Posix `struct stat' whose representation varies depending on the
+platform (architecture/OS/C compiler). There's no *portable* way of
+accessing those from .NET managed code.
+
+So, there are a couple of different approaches.
+One possibility is to access such routines by writing a wrapper, e.g. in C,
+that provides the same functionality without using types with a system-dependent
+representation. The wrapper can then be directly accessed from portable
+.NET code. The .NET code remains both source- and binary-portable;
+the wrapper code is source-portable, but needs to be compiled
+seperately for each target platform. The drawback of this approach is
+that you have to write a lot of cumbersome wrapper code.
+
+Another possibility is to extend the .NET VM with support for an
+additional custom attribute, e.g. "[PosixType]". The VM would then
+represent types tagged with this attribute in the same way that the
+underlying system represents those types. With this approach, no
+wrapper code would be needed. A drawback of this approach is that it
+pushes quite a bit of complexity into the VM; the VM would have to know
+the native representation of all types annotated with this attribute.
+Another drawback is that code using this extension might not work on
+different VMs.
+
+There have also been some other suggestions, but those are the two that
+I think are the best.
+</blockquote></i>
+
+Q: What is the problem implementing PInvoke?
+
+A: Again, from Fergus Henderson:
+
+<i><blockquote>
+There's no problem implementing PInvoke as specified in the ECMA
+specs and/or MS documentation. It's just that PInvoke by itself
+doesn't solve all of the problems; in particular it doesn't solve
+the problem of C types whose representation is different on different
+systems.
+</blockquote></i>
+
+** CVS use
+
+Q: Why do we keep ChangeLogs and make the CVS commit messages be the
+ same? One could be generated from the other
+
+A: There are a number of reasons for keeping ChangeLog files as well as
+ CVS commit files:
+
+ <ul>
+ * Offline programming: when people are traveling, CVS logs are
+ not available.
+
+ * Slow CVS access: Many people work over modem lines (very
+ typical for contributors in Europe, Asia, Latin America)
+ using CVS is slow and might not be available to you (cvs
+ server down, no anoncvs server available).
+
+ * ChangeLogs travel in a released tarball package, so it is
+ possible to study the rationale of changes even after a
+ project is long "released", or you only have the sources for
+ the code.
+
+ * ChangeLog are not metadata for each file, they are live
+ files that you can browse in the package that is being
+ distributed.
+ </ul>
+
+Making the CVS commit message be the same as the ChangeLog has other
+benefits:
+
+ <ul>
+ * You can track down with `cvs log' what things were changed,
+ and match those to meaningful reports on the intentions of
+ the commit.
+
+ * When reading the commits-list, you can get a glimpse of the
+ changes without having to diff out or cvs update your tree.
+
+ * You can read off-line the changes that are being made
+ (asyncrouns operation).
+ </ul>
+
+This mechanism works very well for GNOME and other projects.
+
+Q: Should I use any of the special RCS keywords like $Id: devel-faq,v 1.1 2001/07/31 21:13:05 miguel Exp $, $Author: miguel $,
+ $Date: 2001/07/31 21:13:05 $, or $Revision: 1.1 $?
+
+A: Please avoid using those in the source code in the CVS. They
+ are not really useful, and they cause a lot of conflicts when
+ people have separate CVS trees.
+
+ It was a nightmare with the Linux kernel when two people had their
+ private CVS trees and were submitting patches to the core.
+
diff --git a/web/documentation b/web/documentation
new file mode 100644
index 00000000000..4ed2e6a6639
--- /dev/null
+++ b/web/documentation
@@ -0,0 +1,62 @@
+* Documentation
+
+ Although most of the concepts from Microsoft.NET can
+ be applied to the completed Mono platform, we do need to
+ have a complete set of free documentation written specifically
+ for Mono.
+
+ The documentation license we have chosen is the GNU Free
+ Documentation License (FDL), the standard for most documents
+ in the free software world.
+
+ We need documentation on a number of topics:
+
+ <ul>
+
+ * The development tools (compilers, assembler tools,
+ language reference, design time features).
+
+ * Frequently Asked Question compilations.
+
+ * HOWTO documents.
+
+ * The Class Libraries
+
+ * Tutorials on Mono and the specifics of running it.
+
+ * A guide to Mono as compared to the Microsoft.NET
+ Framework SDK
+
+ </ul>
+
+** Class Library documentation
+
+ We are moving to a new setup for documenting the class libraries,
+ and you can read about it <a href="classlib-doc.html">here</a>.
+
+ A few words of warning and advice for class documentors:
+
+ A well-documented API can ease hours of frustration; as Mono
+ matures, robust and complete class library documentation will
+ become increasingly important. As you write API documentation,
+ whether it is embedded in source files or in external Monodoc XML,
+ please keep the following in mind:
+
+ Plagarism, even if it's unintentional, is a Bad Thing(TM).
+ Microsoft's .NET Framework Class Library documentation is an
+ excellent resource for understanding the behavior and properties of
+ a type, and a lot of hard work went in to creating this (copyrighted)
+ resource. Please don't copy from Microsoft's reference when
+ documenting a type.
+
+ To avoid this, I (<a href="mailto:jbarn@httcb.net">jbarn@httcb.net</a>)
+ suggest that you read the complete Microsoft documentation for a type,
+ ponder it for a while, and write the Mono documentation in your own
+ words. While it's certainly okay to refer to the Microsoft
+ documentation to clarify your understanding of behavior or properties,
+ please don't open the Microsoft docs and refer to them for each member
+ you document.
+
+ There's a lot of domain expertise among the class library contributors;
+ let's put the same personal stamp on the class library documentation
+ that we have on the class libraries themselves. \ No newline at end of file
diff --git a/web/download b/web/download
new file mode 100644
index 00000000000..10755d1caa5
--- /dev/null
+++ b/web/download
@@ -0,0 +1,352 @@
+* Software Availability
+
+ The Virtual Execution System is available in package `mono'.
+ Currently this contains a metadata library and the
+ disassembler. Please refer to our <a
+ href="runtime.html">Runtime</a> description for more details
+ on this part of the project.
+
+ The code for the C# compiler as well as the language error
+ test suite and the class library are in the `mcs' package, we
+ will move this later into `mono' itself.
+
+ In order to make mcs and the class libraries you will need a computer
+ running Windows with the <strong>GNU make tools</strong> from the
+ <strong>Cygwin</strong> environment, <strong>Microsoft's .NET Framework
+ SDK</strong>, <strong>GLIB 1.3</strong> and
+ <strong>pkg-config</strong>.
+
+ When installing Cygwin, don't forget to include
+ <tt>mingw-runtime</tt>. If you omit this, you will encounter
+ configure problems regarding not being able to generate
+ executables.
+
+<a name="sources">
+*** Sources
+
+ Stay up to date on the Mono team's development using the
+ <a href="http://lists.ximian.com/mailman/listinfo/mono-cvs-list">
+ mono-cvs-list</a> mailing list. The CVS source code can also
+ be browsed <a href="http://cvs.hispalinux.es/cgi-bin/cvsweb/mcs/mcs/cfold.cs?cvsroot=Mono">here</a>
+
+<a name="mar-27">
+ <b>Mono 0.10</b>
+
+ New packaged versions of the Mono C# compiler and Mono runtime
+ are now available. The latest version is 0.10.
+
+ <ul>
+ * <a href="archive/mono-0.10">Mono 0.10 release notes</a>
+
+ * <a href="archive/mcs-0.10.tar.gz">mcs-0.10.tar.gz</a>
+ Mono C# compiler
+ * <a href="archive/mono-0.10.tar.gz">mono-0.10.tar.gz</a>
+ Mono runtime
+ </ul>
+
+<a name="feb-22">
+ <b>Mono 0.9</b>
+
+ New packaged versions of the Mono C# compiler and Mono runtime
+ are now available. The latest version is 0.9.
+
+ <ul>
+ * <a href="archive/mono-0.9">Mono 0.9 release notes</a>
+
+ * <a href="archive/mcs-0.9.tar.gz">mcs-0.9.tar.gz</a>
+ Mono C# compiler
+ * <a href="archive/mono-0.9.tar.gz">mono-0.9.tar.gz</a>
+ Mono runtime
+ </ul>
+
+<a name="snapshots">
+ For up to date sources, it is recommended that you use the Mono
+ source code from either 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. They should give you a window to see what we are
+ up to.
+
+ You can download the GNU make tools and the Cygwin environment from
+ <a href="http://www.cygwin.com">www.cygwin.com</a>.
+
+ You can download Microsoft's .NET Framework SDK from
+ <a href="http://msdn.microsoft.com/downloads">
+ msdn.microsoft.com/downloads</a>.
+
+ 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.
+
+ The script will download required packages from
+ www.go-mono.com and do a cvs checkout of mono in the current
+ directory. The cvs server chosen defaults to anonymous cvs;
+ set your CVSROOT environment variable before running the script to
+ select a particular cvs server.
+
+** Mono Regression Test Suite
+
+ You can get binaries for the Mono Regression Test Suite <a
+ href="archive/mono-tests.tar.gz">here</a>
+
+<a name="install">
+** Building the software manually
+
+*** Download the required software.
+
+ <ul>
+
+ * 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 1.3 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.80-tml-20020101.zip">http://www.go-mono.com/archive/pkgconfig-0.80-tml-20020101.zip</a>
+ <a href="http://www.go-mono.com/archive/glib-1.3.12-20020101.zip">http://www.go-mono.com/archive/glib-1.3.12-20020101.zip</a>
+ <a href="http://www.go-mono.com/archive/glib-dev-1.3.12-20020101.zip">http://www.go-mono.com/archive/glib-dev-1.3.12-20020101.zip</a>
+ <a href="http://www.go-mono.com/archive/libiconv-1.7.zip">http://www.go-mono.com/archive/libiconv-1.7.zip</a>
+ <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>
+ <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>
+
+ * 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>
+
+
+*** Install Cygwin and the GNU build tools, Microsoft's .NET Framework SDK and the precompiled GLIB 1.3 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 <strong>/usr/local</strong> directory
+ of your Cygwin installation.<br>
+ Unzip the precompiled packages listed above.
+
+ </ul>
+
+*** On Windows, to install and work on the compiler and the class libraries:
+
+ <ul>
+
+ * If you downloaded the Mono
+ <a href="http://www.go-mono.com/snapshots">nightly snapshot
+ </a>, untar the snapshot.
+
+ * Change directories to <strong>"mcs"</strong>.
+
+ * Compile:
+
+<pre>
+<strong>make windows</strong>
+</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 <strong>"mono"</strong>.
+
+ * Configure, compile and install:
+
+<pre><strong>
+./configure --prefix=c:/mono
+make
+make install
+</strong></pre>
+
+ </ul>
+
+*** On Unix, to compile the mono runtime:
+
+ <ul>
+
+ * Install <a href="http://www.freedesktop.org/software/pkgconfig">pkg-config</a>.
+
+ * Install glib 1.3. You can download it
+ from <a href="ftp://ftp.gtk.org/pub/gtk/v1.3/glib-1.3.12.tar.gz">ftp.gtk.org</a>. Maybe you need
+ to modify your ACLOCAL_FLAGS for pkg-config, for example if
+ your install prefix is /usr/local:
+<pre>
+<strong>export ACLOCAL_FLAGS="-I /usr/local/share/aclocal"</strong>
+</pre>
+
+ * If you downloaded the Mono
+ <a href="http://www.go-mono.com/snapshots">nightly snapshots
+ </a>, untar the snapshot.
+
+ * Change directories to <strong>"mono"</strong>.
+
+ * Configure, compile and install:
+<pre><strong>
+./configure
+make
+make install</strong>
+</pre>
+ </ul>
+
+*** Notes on compiling GLIB 1.3 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><strong>
+tar xzvf pkg-config-0.8.0.tar.gz
+cd pkg-config-0.8.0
+./configure --prefix=/usr
+make
+make install</strong>
+</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/v1.3/glib-1.3.12.tar.gz">
+ glib 1.3</a> from source.
+
+ </ul>
+
+
+<a name="oldreleases">
+
+*** Very old releases.
+
+ <ul>
+ <a name="feb-11">
+ <b>February 11, 2002</b>
+ * <a href="archive/mcs-0.8.tar.gz">mcs-0.8.tar.gz</a>
+ Mono C# compiler
+ * <a href="archive/mono-0.8.tar.gz">mono-0.8.tar.gz</a>
+ Mono runtime
+ </ul>
+
+ <a name="sep-18">
+ <b>September 18, 2001</b>
+ <ul>
+ * <a href="archive/mono-0.7.tar.gz">mono-0.7.tar.gz</a>: Mono Runtime 0.7 release.
+ * <a href="archive/mcs-0.7.tar.gz">mcs-0.7.tar.gz</a>: Mono Compiler and Classes 0.7 release.
+ * <a href="archive/mono-0.7">Release Notes.</a>
+ </ul>
+
+ <a name="august-22">
+ <b>August 22, 2001</b>
+ <ul>
+ * <a href="archive/mono-0.6.tar.gz">mono-0.6.tar.gz</a>: Mono Runtime 0.6 release.
+ * <a href="archive/mono-compiler-classes-0.6.tar.gz">mono-compiler-classes-0.6.tar.gz</a>: Mono Compiler and Classes 0.6 release.
+ * <a href="archive/mono-0.6">Release Notes.</a>
+ </ul>
+
+
+ <a name="july-29">
+ <b>July 29, 2001</b>
+ <ul>
+ * <a href="archive/mono-0.5.tar.gz">mono-0.5.tar.gz</a>: Mono Runtime 0.5 release.
+ * <a href="archive/mono-0.5">Release Notes.</a>
+ </ul>
+
+
+ <a name="july-22">
+ <b>July 22, 2001</b>
+ <ul>
+ * <a href="archive/mcs-22-Jul-2001.tar.gz">mcs-22-Jul-2001.tar.gz</a>: CVS snapshot.
+ * <a href="archive/mcs-Jul-22-Jul-19-2001.tar.gz">Differences since 19</a>: CVS snapshot.
+ * <a href="archive/mcs-22">Release Notes.</a>
+ </ul>
+
+ <a name="july-19">
+ <b>July 19th, 2001</b>
+ <ul>
+ * <a href="archive/mcs-19-Jul-2001.tar.gz">mcs-19-Jul-2001.tar.gz</a>: CVS snapshot.
+ * <a href="archive/mcs-Jul-17-Jul-19-2001.tar.gz">Differences since 17</a>: CVS snapshot.
+ * <a href="archive/mcs-19">Release Notes.</a>
+ </ul>
+
+ <a name="july-17">
+ <b>July 17th, 2001</b>
+ <ul>
+ * <a href="archive/mcs-17-Jul-2001.tar.gz">mcs-17-Jul-2001.tar.gz</a>: CVS snapshot.
+ * <a href="archive/mcs-Jul-15-Jul-17-2001.tar.gz">Differences since 15</a>: CVS snapshot.
+ * <a href="archive/mcs-17">Release Notes.</a>
+ </ul>
+
+ <a name="july-15">
+ <b>July 15th, 2001</b>
+ <ul>
+ * <a href="archive/mcs-15-Jul-2001.tar.gz">mcs-15-Jul-2001.tar.gz</a>: CVS snapshot.
+ * <a href="archive/mono-0.4.tar.gz">mono-0.4.tar.gz</a>: Packaged Source Code.
+ * <a href="archive/mono-0.4">Release Notes.</a>
+ </ul>
+
+ <a name="july-14">
+ <b>July 14th, 2001</b>
+ <ul>
+ * <a href="archive/mcs-12-Jul-2001.tar.gz">mcs-12-Jul-2001.tar.gz</a>: CVS snapshot.
+ * <a href="archive/mono-0.3.tar.gz">mono-0.3.tar.gz</a>: Packaged Source Code.
+ </ul>
+
+ <a name="july-8">
+ <b>July 8th, 2001</b>
+
+ <ul>
+ * <a href="archive/mcs-08-Jul-2001.tar.gz">mcs-08-Jul-2001.tar.gz</a>: CVS Snapshot
+ * <a href="archive/mono-08-Jul-2001.tar.gz">mono-08-Jul-2001.tar.gz</a>: CVS Snapshot
+ </ul>
+ </ul>
+
diff --git a/web/faq b/web/faq
new file mode 100644
index 00000000000..00bb0989cce
--- /dev/null
+++ b/web/faq
@@ -0,0 +1,698 @@
+<a href="#basics">Basics</a><br>
+<a href="#ximian">The Ximian Role in the Mono project</a><br>
+<a href="#gnome">Mono and GNOME</a><br>
+<a href="#gui">Building GUI applications with Mono</a><br>
+<a href="#msft">Mono and Microsoft</a><br>
+<a href="#pnpproject">Mono and the Portable.NET Project</a><br>
+<a href="#webservices">Web Services</a><br>
+<a href="#devel">Development Tools and Issues</a><br>
+<a href="#java">Mono and Java</a><br>
+<a href="#extending">Extending Mono</a><br>
+<a href="#portability">Portability</a><br>
+<a href="#reuse">Reusing Existing Code</a><br>
+<a href="#gcc">Mono and GCC</a><br>
+<a href="#performance">Performance</a><br>
+<a href="#licensing">Licensing</a><br>
+<a href="#patents">Patents</a><br>
+<a href="#etc">Miscellaneous Questions</a><br>
+
+
+<a name="basics"></a>
+** Basics
+
+Q: What is Mono exactly?
+
+A: The Mono Project is an open development initiative sponsored by
+ Ximian that is working to develop an open source, Linux-based
+ version of the Microsoft .NET development platform. Its objective
+ is to enable Linux developers to build and
+ deploy cross-platform .NET Applications. The project will
+ implement various technologies developed by Microsoft that have now
+ been submitted to the ECMA for standardization.
+
+Q: What is the difference between Mono and the .NET Initiative?
+
+A: The ".NET Initiative" is a somewhat nebulous company-wide effort by
+ Microsoft, one part of which is a cross-platform development
+ framework. Mono is an implementation of the development framework,
+ but not an implementation of anything else related to the .NET
+ Initiative, such as Passport, software-as-a-service, or
+ corporate rebranding.
+
+Q: What technologies are included in Mono?
+
+A: Mono contains a number of components useful for building new
+ software:
+
+ <ul>
+ * A Common Language Infrastructure (CLI) virtual
+ machine that contains a class loader, Just-in-time
+ compiler, and a garbage collecting runtime.
+
+ * A class library that can work with any language
+ which works on the CLR.
+
+ * A compiler for the C# language. In the future we
+ might work on other compilers that target the Common
+ Language Runtime.
+ </ul>
+
+
+ Windows has compilers that target the virtual machine from <a
+ href="http://msdn.microsoft.com/net/thirdparty/default.asp#lang">a
+ number of languages:</a> Managed C++, Java Script, Eiffel,
+ Component Pascal, APL, Cobol, Oberon, Perl, Python, Scheme,
+ Smalltalk, Standard ML, Haskell, Mercury and Oberon.
+
+ The CLR and the Common Type System (CTS) enables applications and
+ libraries to be written in a collection of different languages that
+ target the byte code
+
+ This means for example that if you define a class to do algebraic
+ manipulation in C#, that class can be reused from any other
+ language that supports the CLI. You could create a class in C#,
+ subclass it in C++ and instantiate it in an Eiffel program.
+
+ A single object system, threading system, class libraries, and
+ garbage collection system can be shared across all these languages.
+
+Q: Where can I find the specification for these technologies?
+
+A: You can find the work-in-progress documentation from the T3G ECMA
+ group here:
+
+ <a href="http://www.dotnetexperts.com">http://www.dotnetexperts.com</a>
+
+Q: Will you implement the .NET Framework SDK class libraries?
+
+A: Yes, we will be implementing the APIs of the .NET Framework SDK
+ class libraries.
+
+Q: Will you offer an ECMA-compliant set of class libraries?
+
+A: Eventually we will. Our current focus is on interoperating
+ with the Microsoft SDK, but we will also offer an ECMA compliant
+ set of libraries.
+
+Q: What does the name "Mono" mean?
+
+A: Mono is the word for `monkey' in Spanish. We like monkeys.
+
+Q: Is Mono usable?
+
+A: The JIT engine is usable on Intel x86 machines. An interpreter
+ can be used on other non-Intel x86 machines.
+
+ The class libraries are not yet mature enough to run real applications,
+ but if you are interested in trying out Mono, you can definetly start
+ testing things out as many programs run.
+
+ The C# compiler has made significant progress, it can even compile
+ itself now, but it can not yet be ran with our class libraries as
+ they are missing some features.
+
+Q: When will you ship it?
+
+A: It is premature to target a shipdate for the code, but we
+ anticipate that it will be available some time in the middle of
+ 2002.
+
+Q: How can I contribute?
+
+A: Check the <a href="contributing.html">contributing</a> section.
+
+Q: Aren't you just copying someone else's work?
+
+A: We are interested in providing the best tools for programmers to
+ develop applications for Free Operating Systems. We also want to help
+ provide the interoperability that will allow those systems to fit in
+ with other standards.
+
+ For more background, read the <a href="http://www.go-mono.com/rationale.html">Mono
+ Project white paper</a>.
+ the project.
+
+
+<a name="ximian"></a>
+
+** The Ximian Role in the Mono Project
+
+Q: Why is Ximian working on .NET?
+
+A: Ximian is interested in providing the best tools for programmers to
+ develop applications for Free Operating Systems.
+
+ For more information, read the project <a
+ href="rationale.html">rationale</a> page.
+
+Q: Will Ximian be able to take on a project of this size?
+
+A: Of course not. Ximian a supporter of the Mono project, but the only way
+ to implement something of this size is for the entire free software
+ community to get involved. Visit the <a href="contributing.html">contributing</a>
+ page if you'd like to help out.
+
+Q: What pieces will Ximian be working on?
+
+A: We will devote most of our resources to work on the pieces which are
+ on the critical path to release a development and execution
+ environment. Once the project is at a stage where it is useful in
+ the real world, it will achieve a critical mass of developers to
+ improve it further.
+
+Q: Will Ximian offer Mono commercially?
+
+A: When Mono is ready to be shipped Ximian will offer a commercial
+ support and services for Mono.
+
+Q: Will you wait until Mono is finished?
+
+A: Mono will ship on various stages as they mature. Some people
+ require only a subset of the technologies, those will ship first.
+
+ More advanced features will take more time to develop. A support
+ timeline will be available in June 2002.
+
+<a name="gnome"></a>
+** Mono and GNOME
+
+Q: How is Mono related to GNOME?
+
+A: In a number of ways. This project was born out of the need of
+ providing improved tools for the GNOME community, and will use
+ existing components that have been developed for GNOME when they
+ are available. For example, we plan to use Gtk+ and Libart to
+ implement Winforms and the Drawing2D API and are considering
+ GObject support.
+
+Q: Has the GNOME Foundation or the GNOME team adopted Mono?
+
+A: Mono is too new to be adopted by those groups. We hope that the
+ tools that we will provide will be adopted by free software
+ programmers including the GNOME Foundation members and the GNOME
+ project generally.
+
+Q: Should GNOME programmers switch over to Mono now?
+
+A: It is still far to early for discussions of "switching over." No
+ pieces of Mono will be ready within the next six months, and a
+ complete implementation is roughly one year away.
+
+ We encourage GNOME developers to continue using the existing tools,
+ libraries and components. Improvements made to GNOME will have an
+ impact on Mono, as they would be the "backend" for various classes.
+
+Q: Will Mono include compatibility with Bonobo components? What is the
+ relationship between Mono and Bonobo?
+
+A: Yes, we will provide a set of classes for implementing and using
+ Bonobo components from within Mono. Mono should allow you to write
+ Bonobo components more easily, just like .NET on Windows allows you
+ to export .NET components to COM.
+
+Q: Does Mono depend on GNOME?
+
+A: No, Mono does not depend on GNOME. We use a few packages produced by
+ the GNOME team like the `glib' library.
+
+Q: But will I be able to build GNOME applications?
+
+A: Yes, we will enable people to write GNOME applications using Mono.
+
+<a name="gui"></a>
+** GUI applications
+
+Q: Will Mono enable GUI applications to be authored?
+
+A: Yes, you will be able to build GUI applications. Indeed, that is our
+ main focus. We will provide both the Windows.Forms API and the Gtk# API.
+
+Q: What is the difference between Gtk# and System.Windows.Forms?
+
+A: Gtk# is a set of bindings for the Gtk+ toolkit for C# (and other
+ CIL-enabled languages). System.Windows.Forms is an API defined
+ by Microsoft to build GUI applications.
+
+Q: Will I be able to run my smart clients on systems powered by Mono?
+
+A: As long as your applications are 100% .NET and do not make use
+ of P/Invoke to call Win32 functions, your smart client applications
+ will run on Mono platforms.
+
+<a name="msft"></a>
+** Mono and Microsoft
+
+Q: Is Microsoft helping Ximian with this project?
+
+A: No. Ximian CTO Miguel de Icaza had a friendly conversation with
+ Microsoft software architect David Stutz, but that's about the
+ extent of the contact. Microsoft is interested in other
+ implementations of .NET and are willing to help make the ECMA spec
+ more accurate for this purpose.
+
+ Ximian representatives have also spoken with Sam Ruby at the ECMA
+ TG3 committee to discuss the same issues.
+
+Q: Is Microsoft or Corel paying Ximian to do this?
+
+A: No.
+
+Q: Do you fear that Microsoft will change the spec and render Mono
+ useless?
+
+A: No. Microsoft proved with the CLI and the C# language that it was
+ possible to create a powerful foundation for many languages to
+ interoperate. We will always have that.
+
+ Even if changes happened in the platform which were undocumented,
+ the existing platform would a value on its own.
+
+Q: Are you writing Mono from the ECMA specs?
+
+A: Yes, we are writing them from the ECMA specs and the published
+ materials in print about .NET.
+
+Q: If my applications use Mono, will I have to pay a service fee?
+
+A: No. Mono is not related to Microsoft's initiative of
+ software-as-a-service.
+
+Q: Is the Mono Project is related to the Microsoft Hailstorm effort? Is
+ Ximian endorsing Hailstorm?
+
+A: No. The Mono Project is focused on providing a compatible set of
+ tools for the Microsoft .NET development platform. It does not
+ address, require, or otherwise endorse the MS Passport-based
+ Hailstorm single sign-on system that is part of Windows XP and
+ other services.
+
+Q: Will Mono or .NET applications depend on Microsoft Passport?
+
+A: No. MS Passport is unrelated to running .NET compatible applications
+ produced with the Mono tools. The only thing you will need is a
+ just-in-time compiler (JIT).
+
+Q: What is a 100% .NET application?
+
+A: A `100% .NET application' is one that only uses the APIs defined
+ under the System namespace and does not use PInvoke. These
+ applications would in theory run unmodified on Windows, Linux,
+ HP-UX, Solaris, MacOS X and others.
+
+Q: If Microsoft will release a port of their .NET platform under the
+ `Shared Source' license, why should I bother with anything else?
+
+A: The Shared Source implementation will be expensive and its uses
+ will be tightly restricted, especially for commercial use. We are
+ working towards an implementation that will grant a number of
+ important rights to recipients: use for any purpose,
+ redistribution, modification, and redistribution of modifications.
+
+ This is what we call <a
+ href="http://www.gnu.org/philosophy/free-sw.html">Free Software</a>
+
+Q: Is Mono a free implementation of Passport?
+
+A: No. Mono is just a runtime, a compiler and a set of class
+ libraries.
+
+Q: Will the System.Web.Security.PassportIdentity class mean
+ that my software will depend on Passport?
+
+A: No. Applications may use that API to contact a Passport site, but
+ are not required to do so.
+
+ As long as your application does not use Passport, you will not
+ need Passport.
+
+Q: Will Mono running on Linux make Passport available for Linux?
+
+A: No. However, the Passport toolkit for Linux-based web servers is
+ available from Microsoft.
+
+Q: Will Mono allow me to run Microsoft Office on Linux?
+
+A: No, it will not. Microsoft Office is a Windows application. To
+ learn more about running Windows applications on Intel Unix systems
+ refer to <a href="http://www.winehq.com">the Wine Project</a>.
+
+<a name="pnpproject"></a>
+** Mono and Portable.NET
+
+Q: What are the differences between Mono and Portable.NET?
+
+A: Most of Mono is being written using C#, with only
+ a few parts written in C (The JIT engine, the runtime, the
+ interfaces to the garbage collection system). The Portable.NET
+ Project is using C for development.
+
+<a name="webservices"></a>
+** Web Services
+
+Q: How is Mono related to Web Services?
+
+A: Mono is only related to Web Services in that it will implement the
+ same set of classes that have been authored in the .NET Framework
+ to simplify and streamline the process of building Web Services.
+
+ But most importantly, Mono is an Open Source implementation of the
+ .NET Framework.
+
+Q: Can I author Web Services with Mono?
+
+A: You will be able to write Web Services on .NET that run on Mono and
+ viceversa.
+
+Q: If Mono implements the SDK classes, will I be able to write and
+ execute .NET Web Services with it?
+
+A: Yes. When the project is finished, you will be able to use the
+ same technologies that are available through the .NET Framework SDK
+ on Windows to write Web Services.
+
+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>.
+
+Q: Can I use CORBA?
+
+A: Yes. The CLI contains enough information about a class that
+ exposing it to other RPC systems (like CORBA) is really simple, and
+ does not even require support from an object.
+
+ We will be implementing CORBA interoperation as an extension to the
+ Mono classes so that we can integrate with Bonobo, just like
+ Microsoft provides COM interoperation classes and support
+ mechanisms.
+
+Q: Can I serialize my objects to other things other than XML?
+
+A: Yes, although the serializing tools have not yet been planned, and
+you would probably have to implement them yourself.
+
+Q: Will Mono use ORBit?
+
+A: No. Mono will be using a new implementation of CORBA that isn't still started.
+
+<a name="devel"></a>
+** Development Tools and Issues
+
+Q: Will it be possible to use the CLI features without using bytecodes
+ or the JIT?
+
+A: Yes. The CLI engine will be made available as a shared library.
+ The garbage collection engine, the threading abstraction, the
+ object system, the dynamic type code system and the JIT will be
+ available for C developers to integreate with their applications if
+ they wish to do so.
+
+Q: Will you have new development tools?
+
+A: With any luck, Free Software enthusiasts will contribute tools to
+ improve the developer environment. These tools could be developed
+ initially using the Microsoft implementation of the CLI and then
+ executed later with Mono.
+
+Q: What kind of rules make the Common Intermediate Language useful for
+ JITers?
+
+A: The main rule is that the stack in the CLI is not a general purpose
+ stack. You are not allowed to use it for other purposes than
+ computing values and passing arguments to functions or return
+ values.
+
+ At any given call or return instruction, the types on the stack
+ have to be the same independently of the flow of execution of your
+ code.
+
+Q: Is it true that the CIL is ideal for JITing and not efficient for
+ interpreters?
+
+A: The CIL is better suited to be JITed than JVM byte codes, but you
+ can interpret them as trivially as you can interpret JVM byte
+ codes.
+
+<a name="java">
+** Mono and Java
+
+Q: Why don't you use Java? After all, there are many languages that
+ target the Java VM.
+
+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">frontend 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
+ <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>.
+
+ The JVM is not designed to be a general purpose virtual machine.
+ The Common Intermediate Language (CIL), on the other hand, is
+ designed to be a target for a
+ wide variety of programming languages, and has a set of rules
+ designed to be optimal for JITers.
+
+Q: Could Java target the CLI?
+
+A: Yes, Java could target the CLI. We have details on a <a
+ href="ideas.html#guavac">project</a> that someone could take on to
+ make this happen.
+
+ Microsoft has an implemenation of the Java language called J# that
+ can target the CIL execution engine.
+
+Q: Is it possible to write a JVM byte code to CIL convertor?
+
+A: Yes, it is possible. Here are a few starting point:
+
+ <ul>
+ * A byte code representation is really a flattened forest of
+ trees. Look at the Mono JIT engine to see how we compute
+ the basic blocks (this is used to figure out the "trees").
+
+ The forest is just an array of trees.
+
+ Indeed, run the JIT engine with -d (mono -d prog.exe) and
+ you will see how these trees look like.
+
+ You will have to do something similar for Java.
+
+ * Each "forest of trees" has a meaning. This meaning can now
+ be translated into the equivalent "meaning" in CLR-land.
+ </ul>
+
+<a name="extending"></a>
+** Extending Mono
+
+Q: Would you allow other classes other than those in the
+ specification?
+
+A: Yes. The Microsoft class collection is very big, but it is by no
+ means complete. It would be nice to have a port of `Camel' (the
+ Mail API used by Evolution inspired by Java Mail) for Mono
+ applications.
+
+ You might also want to look into implementing CORBA for Mono. Not
+ only because it would be useful, but because it sounds like a fun
+ thing to do, given the fact that the CLI is such a type rich
+ system.
+
+ For more information on extending Mono, see our <a
+ href="ideas.html">ideas</a> page.
+
+Q: Do you plan to Embrace and Extend .NET?
+
+A: Embracing a good technology is good. Extending technologies in
+ incompatible ways is bad for the users, so we do not plan on
+ extending the technologies.
+
+ If you have innovative ideas, and want to create new classes, we
+ encourage you to make those classes operate correctly well in both
+ Mono and .NET
+
+<a name="portability"></a>
+** Portability
+
+Q: Will Mono only work on Linux?
+
+A: Currently, we are doing our work on Linux-based systems and
+ Windows. We do not expect many Linux-isms in the code, so it
+ should be easy to port Mono to other UNIX variants.
+
+Q: What about Mono on non X-based systems?
+
+A: Our main intention at Ximian is to be able to develop GNOME
+ applications with Mono, but if you are interested in providing a
+ port of the Winform classes to other platforms (frame buffer or
+ MacOS X for example), we would gladly integrate them, as long
+ they are under an open source license.
+
+Q: Will Mono run on Windows?
+
+A: We hope so. Currently some parts of Mono only run on Windows
+ (the C# compiler is a .NET executable) and other parts have only
+ been compiled on Linux, but work on Windows with Cygwin.
+
+Q: Will Mono depend on GNOME?
+
+A: It will depend only if you are using a particular assembly (for
+ example, for doing GUI applications). If you are just interested
+ in Mono for implementing a `Hello World Enterprise P2P Web
+ Service', you will not need any GNOME components.
+
+<a name="reuse"></a>
+** Reusing Existing Code
+
+Q: What projects will you reuse or build upon?
+
+A: We want to get Mono in the hands of programmers soon. We are
+ interested in reusing existing open source software.
+
+Q: What about Intel's research JIT framework, ORP?
+
+A: At this time, we are investigating whether we can use elements of
+ ORP for Mono. ORP is a research JIT engine that has a clearly
+ defined API that splits the JIT from the GC system and the actual
+ byte code implementation.
+
+Q: What about using GNU Lightning?
+
+A: We are also researching <a
+ href="http://www.gnu.org/software/lightning/lightning.html">GNU
+ Lightning</a>.
+
+<a name="gcc"></a>
+** Mono and GCC
+
+Q: Are you working on a GCC front-end to C#? A GCC backend that will
+ generate CIL images? What about making a front-end to GCC that
+ takes CIL images and generates native code?
+
+A: We are currently seeking volunteers for those projects.
+ Visit the <a href="contributing.html">contributing</a> section if
+ you are interested.
+
+Q: But would this work around the GPL in the GCC compiler and allow
+ people to work on non-free front-ends?
+
+A: People can already do this by targeting the JVM byte codes (there
+ are about 130 compilers for various languages that target the JVM).
+
+Q: Why are you writing a JIT engine instead of a front-end to GCC?
+
+A: We want the JIT engine and runtime engine because they will be able
+ to execute CIL executables generated on Windows, and so no recompilation
+ will be necessary.
+
+<a name="performance"></a>
+** Performance
+
+Q: How fast will Mono be?
+
+A: We can not predict the future, but a conservative estimate is that
+ it would be at least `as fast as other JIT engines'.
+
+ We would like to ship various JIT engines with Mono, just like
+ Microsoft has done with their .NET development platform. We could
+ provide a faster, JIT for fast load times but lower performance,
+ and an and an optimizing JIT that would be slower at generating
+ code but produce more optimal output.
+
+ The CIL has some advantages over the Java byte code: it is really
+ an intermediate representation and there are a number of
+ restrictions on how you can emit CIL code that simplify creating
+ better JIT engines.
+
+ For example, on the CIL, the stack is not really an abstraction
+ available for the code generator to use at will. Rather, it is a
+ way of creating a postfix representation of the parsed tree. At
+ any given call point or return point, the contents of the stack are
+ expected to contain the same object types independently of how the
+ instruction was reached.
+
+<a name="licensing"></a>
+** Licensing
+
+Q: Will I be able to write proprietary applications that run with
+ Mono?
+
+A: Yes. The licensing scheme is planned to allow proprietary
+ developers to write applications with Mono.
+
+Q: What license or licenses are you using for the Mono Project?
+
+A: The C# Compiler is released under the terms of the <a
+ href="http://www.opensource.org/licenses/gpl-license.html">GNU GPL</a>. The runtime
+ libraries are under the <a
+ href="http://www.opensource.org/licenses/lgpl-license.html">GNU
+ Library GPL</a>. And the class libraries are released
+ under the terms of the <a
+ href="http://www.opensource.org/licenses/mit-license.html">MIT X11</a>
+ license.
+
+Q: I would like to contribute code to Mono under a particular
+ license. What licenses will you accept?
+
+A: We will have to evaluate the licenses for compatibility first,
+ but as a general rule, we will accept the code under the same
+ terms of the "container" module.
+
+<a name="patents></a>
+** Patents
+
+Q: Could patents be used to completely disable Mono (either submarine
+ patents filed now, or changes made by Microsoft specifically to
+ create patent problems)?
+
+A: No. First, its basic functional capabilities have pre-existed too
+ long to be held up by patents. The basic components of Mono are
+ technologically equivalent to Sun's Java technology, which has been
+ around for years. Mono will also implement multi-language and
+ multi-architecture support, but there are previous technologies
+ such as UCSD p-code and ANDF that also support multiple languages
+ using a common intermediate language. The libraries are similar
+ to other language's libraries, so again, they're too similar to
+ be patentable in large measure.
+
+ However, if Microsoft does patent some technology, then our plan is
+ to either (1) work around it, (2) chop out patented pieces, (3)
+ find prior art that would render the patent useless.
+
+ Not providing a patented capability would weaken the
+ interoperability, but it would still provide the free software /
+ open source software community with good development tools, which
+ is the primary reason for developing Mono.
+
+<a name="etc"></a> **
+Miscellaneous Questions
+
+Q: You say that the CLI allows multiple languages to execute on the
+ same environment. Isn't this the purpose of CORBA?
+
+A: The key difference between CORBA (and COM) and the CLI is that the
+ CLI allows "data-level interoperability" because every
+ language/component uses the same data layout and memory management.
+
+ This means you can operate directly upon the datatypes that someone
+ else provides, without having to go via their interfaces. It also
+ means you don't have to "marshall" (convert) parameters (data
+ layouts are the same, so you can just pass components directly) and
+ you don't have to worry about memory managment, because all
+ languages/components share the same garbage collector and address
+ space. This means much less copying and no need for reference
+ counting.
+
+Q: Will you support COM?
+
+A: The runtime will support XPCOM on Unix systems and COM on Windows.
+ Most of the code for dynamic trampolines exists already.
+
+Q: Will Ximian offer certifications on Mono or related technologies?.
+
+A: It's possible. But there is no plan about this. So the short answer is no.
+
diff --git a/web/gcc-frontend b/web/gcc-frontend
new file mode 100644
index 00000000000..2b15346db69
--- /dev/null
+++ b/web/gcc-frontend
@@ -0,0 +1,9 @@
+* The GCC front-end
+
+ The GCC front-end will accept input in a binary file with
+ codes in the Common Intermediate Language (CIL), and generate
+ native code.
+
+ This will allow pre-compilation and full optimization to take
+ place before a program is executed.
+
diff --git a/web/ideas b/web/ideas
new file mode 100644
index 00000000000..0a97cdcc4d2
--- /dev/null
+++ b/web/ideas
@@ -0,0 +1,112 @@
+* Ideas
+
+ There are many pending classes that need to be implemented. Those have
+ the highest impact in the Mono project: the sooner they are done,
+ the sooner we can start using this platform to create new and
+ exciting applications.
+
+ That being said, if you are not very excited about working on class
+ libraries, here is a list of other related projects or tools that might
+ be useful to the Mono project.
+
+ Here are a few ideas of tools, classes and projects that you
+ could start. More are forthcoming.
+
+<a name="runtime">
+** Runtime
+
+ We need a verifier that can be run on an executable (assembly)
+ and tells whether the metadata for the executable is correct
+ or not. It should report any anomalies.
+
+ For a list of anomalies in assemblies, check the various assertions
+ that are described on the ECMA documentation.
+
+ This will help test our generated executables and can be also
+ used as an external verifier.
+
+<a name="classes">
+** Classes
+
+ <ul>
+TODO=jxta,The JXTA Peer to Peer foundation
+ * Implement a JXTA protocol implementation:
+ <a href="http://www.jxta.org">http://www.jxta.org</a>
+
+TODO=camel,Mail API
+ * Implement a Mail API, similar to Camel or JavaMail (Camel has
+ significant architecture features that are required on a real
+ mailer).
+
+ You can check the current C
+ <a href="http://cvs.gnome.org/bonsai/rview.cgi?dir=evolution%2Fcamel">
+ Camel implementation</a>.
+
+ Such an implementation could be used both with
+ Microsoft .NET and Mono.
+
+TODO=multimedia
+ * Interfacing to Multimedia systems. You might want
+ to look into the Quicktime API. I know <a
+ href="mailto:vladimir@ximian.com">Vladimir</a> has
+ researched the problem before
+
+ </ul>
+
+<a name="projects">
+** Projects
+
+ <ul>
+TODO=xmlStorage,
+ * Implement an xmlStorageSystem for the CLI:
+ <a href="http://www.soapware.org/xmlStorageSystem">
+ http://www.soapware.org/xmlStorageSystem</a>
+
+TODO=guavac,Java compiler for .NET
+ * You could take one of the existing Java compilers
+ (Guavac comes to mind as it is so nice) and modify
+ it to generate .NET code rather than JVM byte
+ codes.
+
+ This should be a pretty straightforward task.
+ Guavac has the advantage of being written in C++ and
+ it could be compiled with the Microsoft Managed C++
+ compiler and produce a .NET executable with it.
+
+TODO=CORBA,CORBA implementation
+ * Build a CORBA interoperability engine for the CLR.
+ You do not need to do all of the work, just talking
+ the protocol will get us a long way (<a
+ href="http://www.omg.org">The OMG site</a> has the
+ CORBA specs).
+
+ Get in touch with David Taylor (dtaylo11 at bigpond
+ dot net dot au) as he has been working on this
+ project.
+
+TODO=Bonobo,Bonobo for Mono
+ * Once CORBA is done, implement the Bonobo interfaces
+ to allow people to use Bonobo components in Mono and
+ Mono components with Bonobo. The best of both worlds!
+
+TODO=moniker,Object Naming System with Monikers
+ * A naming space for Mono. An object naming space is
+ a very powerful tool. Bonobo implements a moniker
+ system that is more powerful than the original
+ moniker concept that was pioneered by COM/OLE in the
+ Microsoft world.
+
+ Our implementation builds on a concept, and we have
+ made it simpler, more powerful, more extensible and
+ a much better mechanism than the equivalent monikers
+ on Windows.
+
+ Implementing Mono monikers would benefit both
+ Windows users using .NET and Mono users on Unix and
+ Windows.
+
+ Here is <a
+ href="http://primates.ximian.com/~miguel/monikers.html">an
+ overview of the moniker system</a> in Bonobo.
+
+ </ul>
diff --git a/web/index b/web/index
new file mode 100644
index 00000000000..e3409bd1d4c
--- /dev/null
+++ b/web/index
@@ -0,0 +1,1016 @@
+<table>
+ <tr>
+ <td>
+ <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.
+
+ Mono includes: <a href="c-sharp.html">a compiler</a> for the
+ C# language, a <a href="runtime.html">runtime</a> for the
+ Common Language Infrastructure and a set of <a
+ href="class-library.html">class libraries</a>.
+
+ You can read our <a href="rationale.html">rationale</a> for
+ this project. If you have questions about the project, please
+ read our list of <a href="faq.html">Frequently Asked
+ Questions</a> or <a href="mailto:mono-list@ximian.com">contact us.</a>
+
+ You might also want to <a href="download.html">Download the
+ source</a> for our work so far. Grab a <a
+ href="snapshots">snapshot</a> of our current work, or <a
+ href="http://cvs.hispalinux.es/cgi-bin/cvsweb/?hidenonreadable=1&f=u&logsort=date&sortby=file&hideattic=1&cvsroot=Mono">browse
+ the sources</a>
+
+ You might want to <a
+ href="mailing-lists.html">subscribe</a> to our mono-list
+ and mono-announce-list
+
+ You can contact the team at: <a
+ href="mailto:mono-list@ximian.com">mono-list@ximian.com</a>
+ </td>
+ <td>
+ <table border=1 bgcolor>
+ <tr>
+ </tr>
+ <tr>
+ <td>
+ <b><a href="c-sharp.html">C# Compiler</a></b>
+ </td>
+ <td>
+ <b>Self hosting on Linux</b><br>
+ Self hosting on .NET.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>JIT</b>
+ </td>
+ <td>
+ Linux/x86 working.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>Interpreter</b>
+ </td>
+ <td>
+ Working:<br>
+ Linux/x86, Linux/PPC<br>
+ In progress: StrongARM, SPARC.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a href="class-status.html">Classes</a></b>
+ </td>
+ <td>
+ Corlib is self hosting.
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+** Apr 24, 2002
+
+ SharpDevelop 0.88a <a href="http://www.icsharpcode.net/OpenSource/SD">is out!</a>
+
+ Congratulations to the developers behind SharpDevelop for
+ their new release.
+
+** Apr 20, 2002
+
+ Some updates from the hacking lines:
+
+ <b>The web:</b> Patrik Torstensson last week contributed the
+ http runtime support and started work on thread pools. This
+ is part of the ASP.NET support.
+
+ <b>Docs:</b> John Barnette, John Sohn and Adam Treat have been
+ hacking on MonoDoc.
+
+ <b>ADO.NET:</b> Daniel Morgan and Rodrigo Moya have been
+ working on the <a href="ado-net">ADO.NET</a> support, and got
+ the first signs of life this week (we can connect, insert
+ rows; do transactions: commit/rollback; SQL errors and
+ exceptions work). Check <a
+ href="mailing-lists.html">mono-patches</a> for all the
+ goodies.
+
+ <b>Optimizations:</b> A number of optimizations in the runtime
+ made the compiler twice as fast this week:
+
+ Early this week Patrik started the string
+ rewrite in the runtime. Today Dietmar finished the
+ constructors and deployed the new layout.
+
+ Paolo got the JIT engine to generate profiles, which were in
+ turn used to find hot spots in Reflection, which he improved.
+
+ Daniel Lewis (of Regex fame) noticed the performance issues
+ with our current array layout, and contributed a new array
+ representation.
+
+ At the same time Dietmar started the the JIT inline code and
+ implemented constant propagation. These two optimizations
+ together are very powerful.
+
+ <b>Bug fixing:</b> And of course everyone has been helping out
+ with the bug fixing (Duncan, Gonzalo, Jonathan, Miguel, Nick,
+ Ravi, Sergey)
+
+
+** Apr 18, 2002
+
+ Dietmar's inlining for the JIT engine just landed into
+ CVS. This is only a first cut and more improvements will come later.
+
+ Patrik, Paolo, Dietmar and Gonzalo have been busy optimizing
+ our class libraries and runtime engine to become faster. Many changes
+ on CVS as well.
+
+** Apr 11, 2002
+
+ Gtk# 0.1 "ButtonHook" has been <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2002-April/000048.html">released</a>
+
+ Binaries for the Mono Regression Test Suite are <a
+ href="archive/mono-tests.tar.gz">available</a> for
+ people porting the Mono Runtime to new platforms.
+
+** Apr 6, 2002
+
+ <a href="http://www.dotnetremoting.cc/book/AdvancedDotNetRemoting.asp">
+ Advanced .NET Remoting</a> from Ingo Rammer is now available. Ingo
+ helped us to implement the proxy support and the book is a valuable
+ resource for anyone interested in remoting.
+
+** Apr 5, 2002
+
+ Transparent proxy support has been finished, congrats to
+ Dietmar. Our JIT engine on CVS contains the implementation.
+ This should enable people to test the remoting framework on
+ Mono.
+
+** Mar 28, 2002
+
+ Debugging information is now generated by the compiler thanks
+ to Martin's work. The resulting dwarf file can be used to
+ single step C# code in GDB. A document will be shortly published with
+ the details.
+
+** Mar 27, 2002
+
+ <b>Mono 0.10 is out!</b> The self hosting release of Mono has
+ been released.
+
+ A new version of the runtime, compiler and class libraries has
+ been packaged for your download pleasure. Binaries are
+ included. The <a href="archive/mono-0.10">Release Notes</a>
+ are available.
+
+ You can get it <a
+ href="download.html#mar-27">Here</a> (quick links: <a
+ href="archive/mono-0.10.tar.gz">runtime</a> and <a
+ href="archive/mcs-0.10.tar.gz">compiler/classes</a>).
+
+** Mar 26, 2002
+
+ Paolo finally fixed the last bug in the JITer that stopped
+ us from using it to run the Mono C# compiler. Goodies are on
+ CVS.
+
+ <a href="http://gtk-sharp.sourceforge.net">Gtk#</a> runs <a
+ href="http://gtk-sharp.sourceforge.net/gtk-hello-world.png">Hello
+ World</a>. Mike posted some <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2002-March/000034.html">details.</a>
+
+
+** Mar 19, 2002
+
+ Martin has been working on our debugging infrastructure, both
+ on the JIT side of things (adding dward support) as well as on
+ the class libraries (so that MCS can start generating
+ debugging information).
+
+ Jason and Kral keep working on the System.Xml namespace,
+ allowing Mike to move more to self-hosting his Gtk# code.
+
+ The System.Web classes are now part of the build (and they are
+ also part of the class status now). Ajay contributed a large
+ chunk of code to the System.Xml.Schema namespace
+
+ Dan (of regex fame) has been working on internal calls
+ support: moving more code from the old monowrapper to become
+ internal calls.
+
+ Paolo and Dietmar are working steadily on our runtime
+ environment, fixing bugs, adding missing features and allowing
+ us to run the compiler on Linux.
+
+ Remember to post your bug reports.
+
+ The nice class status on the right is brought to you by
+ endless hacking hours from Piers and Nick. These status
+ report pages have been helping us track down various mistakes
+ in our classes (very useful, check it out for yourself)
+
+** Mar 12, 2002
+
+ At midnight, in Italy, Paolo got the Mono C# compiler to self
+ host on Linux, the last bug has been squashed to self
+ hostingness. We have now a fully self hosting compiler in Linux.
+
+ A release will follow up shortly.
+
+** Mar 9, 2002
+
+ Updated the <a href="class-status.html">class status</a>, now
+ it is possible to use the right-side menu to browse a specific
+ assembly.
+
+** Mar 7, 2002
+
+ MCS compiles on Linux!
+
+ Today Paolo got the <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-March/003726.html">MCS
+ compiler compiling itself on Linux</a>
+ completely for the first time! The resulting image still contains
+ some errors, but the whole compiler process goes now. Later in the day
+ and a couple of small optimizations and bug fixes, the compile
+ speed was improved in 400%
+
+ We are very close to have a complete self hosting environment now.
+
+ Mono is temporarly using the Bohem GC garbage collector while
+ we deploy the more advanced ORP one.
+
+** Mar 5, 2002
+
+ The CVS repository <a href="http://cvs.hispalinux.es/cgi-bin/cvsweb/?hidenonreadable=1&f=u&logsort=date&sortby=file&hideattic=1&cvsroot=Mono">can be browsed</a>
+
+ Jason has got an incredible amount of work on the Xml
+ classes during the weekend, and Gaurav is very close to have
+ the complete System.Web.UI.WebControls namespace implemented.
+
+ Martin and Duco have been killing bugs by using the recently
+ revamped regression test suite.
+
+ Piers has updated our <a href="class-status.html">class
+ status</a> page again, with even more information available.
+
+ The C# compiler has full constant folding implemented now and Ravi
+ killed bugs of bugs in the <a href="http://bugzilla.ximian.com/buglist.cgi?product=Mono%2FClass+Libraries&product=Mono%2FMCS&product=Mono%2FRuntime&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=substring&long_desc=&long_desc_type=substring&bug_file_loc=&bug_file_loc_type=substring&keywords=&keywords_type=anywords&op_sys_details=&op_sys_details_type=substring&version_details=&version_details_type=substring&cmdtype=doit&order=%27Importance%27&form_name=query">Mono Bug List</a>
+
+** Mar 1, 2002
+
+ RPMs of Mono 0.9 are available at <a href="http://mono.baselabs.org/#download">mono.baselabs.com</a>
+
+** Feb 28, 2002
+
+ <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-February/003464.html">Christophe</a>
+ has setup his <a href="http://mono.baselabs.org">First Steps in Mono</a> web site, which
+ shows you a step-by-step process on getting Mono running on your system.
+
+ RPMs of Mono 0.9 are available at <a href="http://mono.baselabs.org/index.php/software/">mono.baselabs.org</a>
+
+** Feb 27, 2002
+
+ New <a href="class-status.html">class status</a> engine that
+ provides detailed information about missing functionality in
+ our class libraries. Nick built the cormissing tool and Piers
+ did the XSLT and DHTML magic.
+
+ More compiler progress on Linux: our support runtime now
+ enables the compiler to compile `MIS' on Linux (MIS being
+ Dick's Mono sample HTTP server ;-)
+
+** Feb 26, 2002
+
+ Paolo posted a list of <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-February/003266.html">ways
+ you can help</a> if you do not have Windows right now. Sergey followed up with
+ <a href="http://lists.ximian.com/archives/public/mono-list/2002-February/003268.html">his</a>
+ suggestions.
+
+** Feb 25, 2002
+
+ StrongARM port from Sergey Chaban has been checked into CVS.
+
+** Feb 24, 2002
+
+ SPARC: 44 out of 74 tests pass now (Jeff)
+
+ Power PC: delegates are working now (Radek)
+
+** Feb 22, 2002
+
+ <b>Mono 0.9 has been released!</b>
+
+ A new version of the runtime, compiler and class libraries has
+ been packaged for your download pleasure. The <a
+ href="archive/mono-0.9">Release Notes</a>
+
+ You can get it <a
+ href="download.html#feb-22">Here</a> (quick links: <a
+ href="archive/mono-0.9.tar.gz">runtime</a> and <a
+ href="archive/mcs-0.9.tar.gz">compiler/classes</a>).
+
+** Feb 21, 2002
+
+ Paolo got our compiler natively to compile 117 of our tests.
+ Self hosting is closer every day.
+
+ Unsafe support is finished in the C# compiler.
+
+** Feb 20, 2002
+
+ Gaurav got DataGrid and DataGridItemCollection done.
+
+ C# compiler: Unsafe support is mostly complete (only stackalloc is missing).
+
+ New easy to run scripts for compiling Mono on Unix and Windows
+ is <a href="download.html">available</a>. We can now easily compile
+ Mono on Windows and Linux. If you had trouble before, use the
+ above scripts which will get the setup right for you.
+
+ There are now three machines that can provide AnonCVS, just
+ use anoncvs.go-mono.com as the hostname for your CVSROOT and
+ you will get one of the machines.
+
+** Feb 19, 2002
+
+ Do you want to see what <a href="http://people.debian.org/~lupus/mono/">Mono Looks Like?</a>
+
+** Feb 18, 2002
+
+ Application Domains now support the two LoaderOptimization
+ modes: share code or do not share code, and you can control
+ this with the --share-code command line option.
+
+ Paolo has now 100+ test cases run on Linux now with our class
+ libraries.
+
+ PowerPC and SPARC ports are moving along (Radek and Jeff)
+
+** Feb 13, 2002
+
+ Excellent news since the 11th, here is a quick rundown:
+
+ AppDomains have been deployed (Dietmar). Socket work is done
+ (Dick). Corlib compiled with no refs to mscorlib (Dan). New
+ comprehensive tests for colib bits (David). Nick is driving the
+ regression test suite efforts and class library completeness.
+ New System.Data work (Chris). Bug fixes (Paolo, Duncan, Ravi, Miguel)
+
+ Miguel is off to the <a
+ href="http://www.fosdem.org">FOSDEM</a> conference in Brussels.
+
+** Feb 11, 2002
+
+ <b>Mono 0.8 has been released!</b>
+
+ A new version of the runtime, compiler and class libraries has
+ been packaged for your download pleasure.
+
+ You can get it <a
+ href="download.html#feb-11">Here</a> (quick links: <a
+ href="archive/mono-0.8.tar.gz">runtime</a> and <a
+ href="archive/mcs-0.8.tar.gz">compiler/classes</a>)
+
+** Feb 11, 2002
+
+ We would like to welcome all the new developers that have
+ joined the project in the last couple of days. The classes
+ are rapidly moving.
+
+ An explanation of the relationship between <a
+ href="http://mail.gnome.org/archives/gnome-hackers/2002-February/msg00031.html">GNOME
+ and Mono</a>.
+
+ Nick is still leading our test suite platform. I can not
+ stress how important it is to have a good regression test suite
+ for our platform, as buggy class libraries are what are
+ stopping the compiler from running completely on Linux.
+
+ We are of course psyched to see Mono run on
+ non-Linux systems. Work is moving on native code generation
+ for StrongARM, PowerPC, and SPARC as well as porting Mono to
+ other systems.
+
+ There are a couple of debates on the Mono list on implementing
+ a set of web server classes for <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-February/002911.html">enabling
+ ASP.NET</a> on Mono.
+
+ Paolo also <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-February/002944.html">
+ posted a list of pending tasks</a> to enable the compiler to run on Linux
+
+** Feb 10, 2002
+
+ Mike Kestner has posted an <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2002-February/000024.html">Update
+ on his Gtk#</a> activities.
+
+** Feb 4, 2002
+
+ Adam has done <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-February/002808.html">Qt
+ bindings</a> for .NET. Adam is cool.
+
+** Jan 29, 2002
+
+ Dan Lewis has contributed a major missing set of classes to
+ Mono: <a
+ href="http://lists.ximian.com/archives/public/mono-list/2002-January/002745.html">
+ System.Text.RegularExpressions</a>.
+
+ This is a fully .NET compatible implementation of the .NET regular expressions,
+ fully Unicode aware. This contribution is very appreciated, as implementing this
+ was not entirely trivial (supporting Unicode, plus a regex engine which is a super
+ set of the Perl regex engine).
+
+** Jan 28, 2002
+
+ The Mono contributors have relicensed the Class Libraries under
+ the terms of the
+ <a href="http://www.opensource.org/licenses/mit-license.html">MIT X11</a> license.
+
+ This license is an Open Source license, and is used by other projects
+ (most notably, the XFree86 project).
+
+ The runtime (JIT, metadata library, interpreter) remains under
+ the LGPL and the C# compiler remains under the GPL.
+
+ Our <a
+ href="http://www.ximian.com/about_us/press_center/press_releases/mono_partners.html">Press
+ Release</a>
+
+ Press coverage: <a
+ href="http://news.com.com/2100-1001-823734.html">CNet</a>, <a
+ href="http://www.wired.com/news/technology/0,1282,50037-2,00.html">Wired</a>,
+ <a href="http://www.infoworld.com/articles/hn/xml/02/01/28/020128hnopennet.xml">InfoWorld</a>,
+ <a href="http://www.newsforge.com/article.pl?sid=02/01/27/2232231">NewsForge</a>.
+
+** Jan 23, 2002
+
+ New mailing list: <a href="mailto:mono-patches-request@ximian.com">mono-patches@ximian.com</a>.
+ This mailing list will receive automatically the patches that are submitted
+ to the Mono CVS to any of its modules.
+
+ This allows anyone who wants to participate in the peer-review of the
+ code submitted to CVS to receive patches on e-mail. It should also
+ expose to everyone the changes that are being done by the team every day.
+
+** Jan 21, 2002
+
+ Dick has got a simple web server running with Mono (`MIS: Mono
+ Internet Server') that is mostly used to test our IO layer, a
+ <a href="http://primates.ximian.com/~miguel/dick-mis-server.png">screenshot</a>
+
+ Paolo and Dietmar are busy making our runtime self sufficient on
+ non-Windows platforms.
+
+ C# compiler front: A lot of focus in the past weeks after
+ the C# became self hosting has been in making the compiler a useful
+ tool for development: improve error handling, provide better error
+ reports, fixing all known bugs, and finally profiling of the compiler
+ has begun.
+
+** Jan 8, 2002
+
+ Our compiler has been self-supporting since January 3rd. In
+ the meantime, we have been busy working on making it run on
+ Linux. Today Paolo got more work done on Reflection.Emit and
+ the compiler compiled `console.cs' (a sample Mono program) on
+ Linux.
+
+** Jan 4, 2002
+
+ Dietmar landed the Unicode support patch. Class libraries and
+ runtimes are now fully Unicode aware. The details are <a href=
+ "http://lists.ximian.com/archives/public/mono-list/2002-January/002409.html">
+ here</a>
+
+ Last minute breaking news: Paolo got our compiler in Linux to
+ compile fib.cs, patches are comming tomorrow once we have
+ ChangeLog entries.
+
+** Jan 4, 2002
+
+ Mike Kestner posted an update on Gtk# <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2002-January/000021.html"><i>New
+ year, new direction</i></a>.
+
+ Gtk# will be our foundation on which we will be implementing
+ System.Windows.Forms.
+
+** Jan 3, 2002
+
+ Mono C# compiler becomes self-sufficient. We can now continue
+ development of the compiler with itself.
+
+ Work on the class libraries is still underway for having a full
+ self hosting system. We hope to achieve our goal of self-hosting
+ on Linux before the end of the month.
+
+ Join the fun by downloading either tonight's <a
+ href="snapshots">snapshot</a> or getting your sources from our
+ <a href="anoncvs.html">Anonymous CVS server</a>.
+
+** Dec 28, 2001
+
+ After a lot of work, the C# compiler can compile itself.
+ There are still errors in the generated image, but they are
+ being fixed quickly.
+
+ We will soon have the first non-Microsoft C# implementation!
+
+** Dec 18, 2001
+
+ JIT: More work on our IO abstraction layer (Dick).
+
+ JIT: exception handling for unmanaged code (Dietmar)
+
+ System.Reflection: Support for PropertyInfo and
+ PropertyBuilder as well as the various queries for MethodBase.
+
+ C#: Pre-processor; Rewrite of MemberLookup which fixed many of
+ the outstanding issues. More bug fixing allows it to compile
+ more programs.
+
+** Dec 14, 2001
+
+ Dietmar has improved the register allocation and now Mono performs
+ two to three times as fast as it did yesterday. Amazing.
+
+ The compiler keeps moving along, explicit interface
+ implementation is there.
+
+** Dec 11, 2001
+
+ The JIT engine can now run all the compiler regression tests as
+ well as assorted other programs, many more opcodes added
+ recently. Currently the JIT engine uses a very simplistic register
+ allocator (just enough to allow us to focus on feature completeness)
+ and that will be the next major task to improve performance and
+ reduce spills and reloads.
+
+ On the C# compiler front: language features are now pretty
+ much complete. The big missing tasks are unsafe code support,
+ visibility, explicit interface implementation plus static flow
+ analysis. There are many small bugs that need to be addressed.
+
+ You can get your copy of the <a href="snapshots">latest Mono</a>
+
+ More work is also required on fixing the foundation class
+ libraries, it is easy to find spots now since Nick got the
+ `make test' going.
+
+** Dec 1, 2001
+
+ AnonCVS access to Mono is here (updated every hour). Thanks
+ to <a href="http://www.hispalinux.es">HispaLinux</a> and Jesus
+ Climent for helping to set this up.
+
+** Nov 30, 2001
+
+ All tests from the mono runtime work with the JIT engine now
+ (Dietmar).
+
+ Recursive enumeration definition in the C# compiler are
+ working now (Ravi).
+
+ More work on the Web classes (Gaurav).
+
+** Nov 28, 2001
+
+ JIT land: Paolo got GDB support into the JIT engine while
+ Dietmar added exceptions support to it.
+
+ The C# compiler supports all array initializations now, and the
+ switch statement as well as fixing many existing bugs. Many
+ new more tests.
+
+ Nick keeps working on improving our class library test suite.
+
+ Dick has almost completed the Mono IO layer.
+
+** Nov 16, 2001
+
+<blockquote>
+ Mike Kestner has posted an <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2001-November/000015.html">update</a>
+ on Gtk# development.
+</blockquote>
+
+** Nov 14, 2001
+
+<blockquote>
+ Paolo today got the Mono C# compiler running <a
+ href="http://lists.ximian.com/archives/public/mono-list/2001-November/001941.html">on
+ Linux</a>. It compiles a sample program and then the sample
+ program is executed.
+
+ Mutator unary operators (++ and --) in the compiler are fully
+ functional, they used to only work on variables, and now they
+ are complete.
+
+ To sum things up: The Mono C# compiler is written in C# and
+ uses the .NET classes to get its work done. To make this work
+ on Linux work has to happen in various fronts:
+<ul>
+ * The C# compiler is being worked on and can compile
+ many programs now (our test suite at this point is
+ made up of 40 tests).
+
+ * The class libraries need to be mature enough to support
+ the compiler, particularly System.Reflection.Emit (which is
+ what Paolo has been working on lately).
+
+ The compiler currently requires 103 classes from the
+ .NET runtime (you can get the list by running: <b>monodis --typeref mcs.exe</b>
+
+ * The interpreter should be mature enough to run the actual
+ compiler byte codes and the corlib bytecodes.
+</ul>
+
+ At the same time, Dietmar is working on the JIT engine which will
+ replace our interpreter in production.
+</blockquote>
+
+** Nov 12, 2001
+
+<blockquote>
+ Dietmar got value types working on the JIT engine. Sean has
+ got assembly loading in the runtime (required for NUnit).
+
+ More progress on enumerations and attributes from Ravi.
+
+ Nick keeps working on improving our class libraries.
+</blockquote>
+
+** Nov 8, 2001
+
+<blockquote>
+ Enumerations, array access and attributes for the C# compiler are into the CVS now.
+
+ Full array support is not complete, but moving along.
+</blockquote>
+
+** Nov 5, 2001
+
+<blockquote>
+ Dietmar's new set of patches to the JIT have 20 out of 33
+ tests running now.
+</blockquote>
+
+** Nov 4, 2001
+
+<blockquote>
+ Mike Kestner, main Gtk# contributor has posted a very interesting <a
+ href="http://lists.ximian.com/archives/public/gtk-sharp-list/2001-November/000013.html">
+ update</a> on his work on Gtk#.
+
+ Ravi commited the initial support for Attributes in the
+ compiler.
+
+ Many HTML Controls from Leen checked into CVS.
+
+ Paolo checked in his new System.Reflection and
+ System.Reflection.Emit implementations. He has been working
+ steadily on this huge task for a few weeks now. This is the
+ foundation for the Mono C# compiler, and hence a very
+ important piece of the puzzle.
+</blockquote>
+
+** Nov 3, 2001
+
+<blockquote>
+ Many clean ups have been going into the class library by Nick Drochak.
+
+ Mega patch from Dietmar: he commited the flow analysis code
+ for the JITer.
+
+ A lot of work has been going into the WebControls by Gaurav (4
+ new controls plus improved and bug fixed base classes).
+</blockquote>
+
+** Nov 1, 2001
+
+<blockquote>
+ Ravi commited the caller-side method selection of methods with
+ variable length arguments. Now he depends on Miguel finishing
+ the array handling support.
+</blockquote>
+
+** Oct 27, 2001
+
+<blockquote>
+ Lots of classes for System.Web from Gaurav were commited this
+ morning.
+
+ Some large recent developments:
+
+ The Decimal implementation from Martin Weindel has been
+ partially integrated (we need to put the internalcalls in
+ place now and compile and link the decimal code).
+
+ Derek Holden commited recently the IntegerFormatter code into
+ the CVS, so we got a pretty comprehensive integer formatting
+ engine that we can finally use all over the place.
+
+ Compiler got support for lock as well as assorted bug fixes.
+ Ravi is still working on array support (and then we can
+ optimize foreach for the array case).
+
+ Dietmar is busy working on flow analysis on the JITer, the
+ previous mechanism of generating the forest was wrong. Paolo
+ has been a busy bee reworking the System.Reflection.Emit
+ support code, and we should have some pretty nice stuff next
+ week. Dick on the other hand is still working on the
+ WaitOne/WaitAll emulation code. WaitAll is like select on
+ steroids: it can wait for different kinds of objects: files,
+ mutexes, events and a couple of others.
+
+ Mike Kestner is busy working on Gtk# which is now using the
+ .defs files to quickly wrap the API.
+</blockquote>
+
+** Oct 18, 2001
+
+<blockquote>
+ Reworking expressions to support cleanly indexers and
+ properties. <a href="http://www.nat.org/evolution.php3">11
+ days</a> until Evolution 1.0 ships.
+
+ Ximian users around the world <!--a
+ href="http://www.bez.it/IMAGES/nora.jpg"-->rejoice<!--/a--> with
+ recent C# compiler progress.
+</blockquote>
+
+** Oct 17, 2001
+
+<blockquote>
+ Delegate support has been checked into the compiler
+ (definition and invocation); break/continue implemented.
+</blockquote>
+
+** Oct 15, 2001
+
+<blockquote>
+ JIT engine supports many of the object constructs now (object
+ creation, vtable setup, interface table setup).
+
+ The C# compiler now has almost full property support (only
+ missing bit are pre-post increment/decrement operations),
+ delegates are now created (still missing delegate invocation).
+ try/catch/finally is also supported in the compiler now.
+
+ System.Decimal implementation is in, as well as many crypto
+ classes.
+</blockquote>
+
+** Oct 5, 2001
+
+<blockquote>
+ Sergey has released his first version of the <b>ilasm</b>
+ assembler written in C#. You can get it from his web page:
+ <a
+ href="http://mono.eurosoft.od.ua">http://mono.eurosoft.od.ua</a>.
+
+ The plan is to integrate ildasm into the Mono CVS soon. This
+ component should in theory also be reusable for SharpDevelop
+ eventually.
+</blockquote>
+
+** Oct 4, 2001
+
+<blockquote>
+ Our System.Reflection.Emit implementation created its first
+ executable today. This means that a very simple .NET program
+ that was compiled on Windows was able to generate a .NET program
+ while running on Linux using the Mono runtime.
+
+ The various piece of the puzzle are starting to get together:
+ the compiler can compile simple programs now and we are
+ basically focusing on completeness now.
+</blockquote>
+
+** Sep 28, 2001
+
+<blockquote>
+ <a
+ href="http://www.icsharpcode.net/OpenSource/SD/default.asp">Sharp
+ Develop 0.80</a> was released today.
+</blockquote>
+
+** Sep 26, 2001
+
+<blockquote>
+ More progress: more opcodes are working (Paolo); The compiler
+ runs up to a point in Mint (Paolo); operator overloading works
+ (both unary and binary) all over the place (Miguel); Completed decimal
+ type conversions (Miguel); New build system in place based on
+ Ant (Sean and Sergey); Refactored and documented the
+ internals of the JIT engine (Dietmar); StatementExpressions
+ handled correctly (Miguel).
+</blockquote>
+
+** Sep 21, 2001
+
+<blockquote>
+ A couple of news-worthy items: Dick got the initial thread
+ support into mint; Paolo implemented many new opcodes; Dietmar
+ got long operations and mul/div working on the JITer; Ravi rewrote
+ the Method selector for expressions to be conformant; Miguel
+ got i++ working. All in tonight's snapshot
+</blockquote>
+
+** Sep 19, 2001
+
+<blockquote>
+ Paolo has written a section on <a href="porting.html">Porting
+ Mono</a> to othre architectures.
+</blockquote>
+
+** Sep 18, 2001
+
+<blockquote>
+ <A a href="download.html#sep-18">Mono 0.7</a> has been
+ released (runtime engine, class libraries
+ and C# compiler). Check the <a href="archive/mono-0.7">Mono
+ 0.7 announcement</a> for details
+</blockquote>
+
+** Sep 17, 2001
+
+<blockquote>
+ Mike Kestner's Gtk# (Gtk-sharp) was checked into the CVS
+ repository. Gtk# can run a simple hello world application.
+ The binding is nice, as it maps Gtk+ signals to delegates in
+ C#. You can see the Gtk# Hello World program <a href="src/HelloWorld.cs">here</a>
+
+ Gtk-sharp should be available on the next snapshot set.
+</blockquote>
+
+** Sep 10, 2001
+
+<blockquote>
+ Dietmar checked in his CIL tree/forest regeneration and most
+ importantly, the x86 instruction selector burg grammar.
+</blockquote>
+
+
+** Sep 5, 2001
+
+<blockquote>
+ The MCS compiler <b>can compile the sample Hello World</b>
+ application and generate a Windows/CIL executable that runs!
+
+ This executable runs with the Mono Interpreter of course (see
+ August 28)
+</blockquote>
+
+** Sep 4, 2001
+
+<blockquote>
+ Dietmar checked into CVS the `monoburg' architecture
+ independent instruction selector for the JIT engine.
+</blockquote>
+
+** Aug 28, 2001
+
+<blockquote>
+ <b>.NET Hello World is working under Mono!</b> The latest snapshots
+ will let you run it.
+
+ Hello World consits of 1821 CIL instructions,
+ performs 66 subroutine calls and loads 12 classes from the corlib.dll
+
+ Good work Mono team!
+</blockquote>
+
+** Aug 23, 2001
+
+<blockquote>
+ Lloyd Dupont has announced his OpenGL bindings for C#, they
+ are available here: <a
+ href="http://csgl.sourceforge.net">http://csgl.sourceforge.net</a>
+</blockquote>
+
+** Aug 22, 2001
+
+<blockquote>
+ New version of the Mono Runtime, Compiler and Classes has been
+ <a
+ href="download.html#august-22">released.</a> Check the <a
+ href="archive/mono-0.6">0.6 announcement</a>.
+</blockquote>
+
+** Aug 20, 2001
+
+<blockquote>
+ A new <a href="contributing.html#compile-service">Compilation
+ service</a> has been made available by Derek to allow people
+ without access to the <a
+ href="http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/000/976/msdncompositedoc.xml&frame=true">.NET SDK</a>
+</blockquote>
+
+** Aug 3, 2001
+
+<blockquote>
+ Daily snapshots of mcs and mono are now available, they will
+ run every night at 10pm Boston time.
+</blockquote>
+
+** Jul 29, 2001
+
+<blockquote>
+ Mono Runtime 0.5 has been <a
+ href="download.html#july-29">released.</a> Check the <a
+ href="archive/mono-0.5">release notes</a>
+</blockquote>
+
+** Jul 25, 2001
+
+<blockquote>
+ The slides for <A href="Presentations/O-Reilly">my
+ presentation</a> at <a href="http://www.oreilly.com">O'Reilly
+ Open Source Software Convention</a>
+</blockquote>
+
+** Jul 22, 2001
+
+<blockquote>
+ Another release of the class libraries is out, check the <a
+ href="archive/mcs-22">MCS 22-July Release Notes</a>. You can
+ get the new class libraries from <a
+ href="download.html#july-22">here</a>
+</blockquote>
+
+** Jul 19, 2001
+
+<blockquote>
+ Another release of the class libraries is out, check the <a
+ href="archive/mcs-19">MCS 19-July Release Notes</a>. You can
+ get the new class libraries from <a
+ href="download.html#july-19">here</a>
+</blockquote>
+
+** Jul 17, 2001
+
+<blockquote>
+ Another release of the class libraries is out, check the <a
+ href="archive/mcs-17">MCS 17-July Release Notes</a>. You can
+ get the new class libraries from <a
+ href="download.html#july-17">here</a>
+
+ Do not forget to check out the updated <a href="faq.html">FAQ</a>.
+
+ Got Sean's new <a href="class-status/index.html">Class
+ Status</a> web pages up. These are a lot better than mine, and
+ we are now keeping better track of contributors.
+</blockquote>
+
+** Jul 15, 2001
+
+<blockquote>
+ Another release of Mono is out, check the <a
+ href="archive/mono-0.4">Mono 0.4 Release Notes</a>. Get it <a
+ href="download.html#july-15">here</a>.
+</blockquote>
+
+** Jul 14, 2001
+
+<blockquote>
+ A <a
+ href="http://lists.ximian.com/archives/public/mono-list/2001-July/000399.html">new
+ release</a> of the
+ runtime, compiler and classes has been made. Get it <a href="download.html#july-14">here</a>
+</blockquote>
+
+** Jul 12, 2001
+
+<blockquote>
+ I keep getting questions about my opinion on Passport, even when
+ Mono has <b>nothing</b> to do with it. I finally <a
+ href="passport.html">wrote something.</a>
+</blockquote>
+
+** Jul 9, 2001
+
+<blockquote>
+ Project launched.
+</blockquote>
+
+** O'Reilly
+
+<blockquote>
+ Brian posted a story on <a
+ href="http://www.oreillynet.com/dotnet">O'Reilly Network .NET</a>
+</blockquote>
diff --git a/web/java b/web/java
new file mode 100755
index 00000000000..a6cd58f34af
--- /dev/null
+++ b/web/java
@@ -0,0 +1,52 @@
+* Java
+
+ It would be interesting to support the Java language as part
+ of the Mono project.
+
+ You have to think of Java as various pieces: Java the
+ language and Java the virtual machine.
+
+ It is possible to compile Java to .NET, as shown by the
+ Microsoft J# compiler. We could then allow the migration of
+ Java applications to the Mono runtime.
+
+** The translator.
+
+ It would be interesting to write a semantic translator that
+ converts java byte codes into CIL opcodes. This is possible
+ because the Java byte codes are a subset of the CIL ones.
+
+ A semantic tree needs to be constructed (very much in the
+ spirit of what is done in mono_analize_stack in
+ <tt>mono/mono/jit/jit.c</tt>. Once such a semantic tree is
+ constructed, we could generate the equivalent Java code.
+
+ This has a number of interesting side effects: people can
+ continue to use their existing Java compilers to compile their
+ code, and a simple tool that converts their .class files into
+ a .NET assembly can be used.
+
+** Libraries
+
+ We could translate the GNU Classpath libraries with the above
+ tools to provide the Java runtime required to host into the
+ Mono runtime. Some special treatment would be required for
+ core data types like integers, arrays and strings, and of
+ course reuse where possible existing classes from .NET to make
+ them compatible.
+
+** JILC - Java to IL Compiler
+
+ This is an attempt to make the java bytecode available for the
+ .NET environment.
+
+ The project attempts to generate the IL code / bytecode from the
+ compiled java class files. It has reached the stage of code-generation.
+ The issues that needs to be addressed is the mapping of java objects
+ to the IL objects, eg: java.lang.String to System.String.
+
+ Gaurav Vaish and Abhaya Agarwal are currently leading this project.
+ The project is currently hosted at <a href="http://sourceforge.net/projects/jilc">SourceForge.Net</a>.
+ The official home page of the project is
+ <a href="http://jilc.sourceforge.net">http://jilc.sourceforge.net</a>.
+
diff --git a/web/jit-debug b/web/jit-debug
new file mode 100644
index 00000000000..867738101ae
--- /dev/null
+++ b/web/jit-debug
@@ -0,0 +1,181 @@
+* How to debug your C# application with the JIT engine
+
+ To debug a C# application you need to run the JIT in your debugger.
+
+ Before you can do anything useful in a debugger, you need a symbol
+ file which tells your debugger about functions, types, line numbers
+ and such. Unfortunately, this symbol file needs to be recreated each
+ time the JIT compiles a new method since it doesn't know anything
+ about this method (especially not its memory address) before actually
+ compiling it.
+
+ You have two ways of creating a symbol file:
+
+** Letting the JIT dynamically create the symbol file
+
+ This'll give you a symbol file which is suitable for debugging IL byte
+ code - you won't see your C# source code.
+
+ However, this method has the advantage that it works with every assembly,
+ no matter whether it has been compiled with Mono's C# compiler (MCS) or
+ with any other compiler. It's currently the only way to debug
+ <tt>corlib.dll</tt> or any other library which cannot be compiled with
+ our compiler yet.
+
+ All that you need is a dump of the IL bytecode for each assembly (including
+ all assemblies this assembly is referencing). This is done by using the
+ <tt>monodis</tt> utility:
+
+ <pre>
+ monodis /home/export/martin/MONO-LINUX/lib/corlib.dll > corlib.il<br>
+ monodis /home/export/martin/MONO-LINUX/lib/System.dll > System.il<br>
+ monodis /home/export/martin/MONO-LINUX/bin/mcs.exe > mcs.il
+ </pre>
+
+ Make sure that all the .il files have the same name as their corresponding
+ assembly and that they're all created in the current directory.
+
+ The JIT supports two different debugging file formats:
+
+ <ul>
+ * STABS: This is a very simple debugging format, but it may be the only one
+ which is supported on your system. It is limited to source files of no more
+ than 65.535 lines and it's type support is also very limited. You should only
+ use this if your debugger doesn't support DWARF 2.
+
+ To generate STABS output, use the <tt>--stabs</tt> command line argument.
+
+
+ * DWARF 2: The DWARF 2 debugging format is a very powerful debugging format
+ which can handle source files of arbitrary size and has a highly sophisticated
+ type support. It's the recommended format unless you need to use STABS because
+ your debugger doesn't support DWARF 2.
+
+ To generate DWARF 2 output, use the <tt>--dwarf</tt> command line argument.
+ </ul>
+
+
+ You need to regenerate the symbol file each time the JIT compiled a new
+ method and each time you restart the JIT. You cannot reuse your symbol file
+ if you start the JIT a second file, not even if you're running the same
+ application with the same input data a second time.
+
+ Regenerating the symbol file is done by calling the JIT's
+ <tt>mono_debug_make_symbols ()</tt> function from within your debugger and
+ then reloading the symbol files. This function creates a <tt>filename-dwarf.s</tt>
+ (or <tt>filename-stabs.s</tt>) assembler input file in the current directory and
+ an object file in <tt>/tmp/filename.o</tt> - you need to tell your debugger to
+ add this object file as symbol file.
+
+ If you're using the GNU debugger, this is done like this:
+
+ <pre>
+ call mono_debug_make_symbols ()
+ add-symbol-file /tmp/corlib.o
+ add-symbol-file /tmp/mcs.o
+ add-symbol-file /tmp/Mono.CSharp.Debugger.o
+ </pre>
+
+ You can also write a GDB macro like this:
+
+ <pre>
+ define reload
+ call mono_debug_make_symbols ()
+ add-symbol-file /tmp/corlib.o
+ add-symbol-file /tmp/mcs.o
+ add-symbol-file /tmp/Mono.CSharp.Debugger.o
+ end
+ </pre>
+
+ Then you can just say <tt>reload</tt> to have GDB recreate the symbol file.
+
+ There's also an <a href="jit-debug-sample.html">example debugging session</a> using
+ the GNU debugger.
+
+** Using a symbol file which have been created by the Mono C# compiler
+
+ If you compiled your application with Mono's C# compiler (MCS), you can tell it to
+ create a symbol file which is then processed and rewritten by the JIT engine.
+
+ To do this, you must give MCS the <tt>-g</tt> option:
+
+ <pre>
+ $ mcs -g Foo.cs
+ </pre>
+
+ This creates a <tt>Foo-debug.s</tt> assembler input file.
+
+ To use this in the JIT, you must first copy it to the target machine (the machine
+ where you want to run the JIT to debug your application) and run it through the
+ assembler to produce an object file <tt>Foo-debug.o</tt>. This object file must be
+ in the current directory.
+
+ Then start the JIT in your debugger and give it the <tt>--dwarf-plus</tt> command
+ line argument.
+
+ Each time you call <tt>mono_debug_make_symbols ()</tt> from withing your debugger,
+ the JIT will read this <tt>Foo-debug.o</tt>, fix some machine dependent things like
+ memory addresses etc. in it and write it back to disk.
+
+ If you're using the GNU debugger, you'll want to use a macro like this:
+
+ <pre>
+ define relocate
+ call mono_debug_make_symbols ()
+ add-symbol-file /tmp/corlib.o
+ add-symbol-file mcs-debug.o
+ add-symbol-file Mono.CSharp.Debugger-debug.o
+ end
+ </pre>
+
+ If there is no <tt>assembly-debug.o</tt> file, but an <tt>assembly.il</tt> one, the
+ JIT will fall back to normal DWARF 2 (in the example above, <tt>corlib.dll</tt> was
+ compiled with Microsoft's compiler and the JIT is thus using DWARF to debug it).
+
+ This debugging method only works if you compiled your assembly with MCS, but it'll
+ allow you to actually debug your C# source code :-)
+
+ Here's an <a href="jit-debug-sample2.html">example debugging session</a> using
+ the GNU debugger.
+
+** Breakpoints and single stepping
+
+ The JIT has a <tt>--debug</tt> command line argument to insert a breakpoint at the
+ beginning of this method. It takes a <tt>Namespace.Class:Method</tt> argument which
+ is the method. This argument can be given multiple times.
+
+ However, once your application is stopped in GDB you may want to insert a breakpoint
+ the next time the JIT compiles a method. There's a global variable
+ <tt>mono_debug_insert_breakpoint</tt> which you can modify in your debugger.
+
+ If this variable is set to a non-zero value, the JIT's <tt>arch_compile_method</tt>
+ will insert a breakpoint the next time it is called, ie. at the top of the next
+ method it compiles. If this value has a positive value, it acts as a counter and is
+ decremented after inserting the breakpoint - setting it to a negative value will let
+ the JIT insert the breakpoint each time it compiles a new method.
+
+ There's also global variable <tt>mono_debug_last_breakpoint_address</tt> which always
+ contains the address of the last inserted breakpoint. You may manually override this
+ address with a <tt>nop</tt> instruction to delete the breakpoint.
+
+ For instance, I have a GDB macro called <tt>enter</tt> which I use to enter a method
+ rather than stepping over it:
+
+ <pre>
+ define enter
+ set mono_debug_insert_breakpoint = 1
+ continue
+ set *mono_debug_last_breakpoint_address = 0x90
+ relocate
+ frame
+ </pre>
+
+ Btw. speaking of single stepping - you should use your debuggers <tt>next</tt> command,
+ not its <tt>step</tt> command for single stepping unless you compiled the JIT without
+ debugging support. The reason for this is that the JIT creates machine code which contains
+ calls to JIT methods such as <tt>mono_object_new_wrapper</tt> at places where you don't
+ expect them - so unless the JIT is compiled at least without line numbers, your debugger
+ will enter such methods if you use <tt>step</tt> rather than <tt>next</tt>.
+
+
+
diff --git a/web/jit-debug-sample b/web/jit-debug-sample
new file mode 100644
index 00000000000..a0c5d2d8b48
--- /dev/null
+++ b/web/jit-debug-sample
@@ -0,0 +1,86 @@
+* A debugging session using a dynamically generated symbol file.
+
+ Let's assume we have the following C# application which we want to debug:
+
+ <pre>
+ using System;
+
+ public class Foo
+ {
+ public struct MyStruct {
+ int a;
+ long b;
+ double c;
+ }
+
+ public static void Main ()
+ {
+ Int32 value = 5;
+ long test = 512;
+
+ MyStruct my_struct;
+ my_struct.a = 5;
+ my_struct.b = test;
+ my_struct.c = 23323.5235;
+ }
+ }
+ </pre>
+
+ First of all, we need to compile it and create the .il files:
+
+ <pre>
+ $ mcs ./Foo.cs
+ $ monodis /home/export/martin/MONO-LINUX/lib/corlib.dll > corlib.il
+ $ monodis Foo.exe > Foo.il
+ </pre>
+
+ Now we can start the JIT in the debugger:
+
+ <pre>
+ $ gdb ~/monocvs/mono/mono/jit/mono
+ (gdb) r --dwarf --debug Foo:Main ./Foo.exe
+ Starting program: /home/martin/monocvs/mono/mono/jit/mono --dwarf --debug Foo:Main ./Foo.exe
+ 0x081e8911 in ?? ()
+ (gdb) call mono_debug_make_symbols ()
+ (gdb) add-symbol-file /tmp/Foo.o
+ Reading symbols from /tmp/Foo.o...done.
+ Current language: auto; currently c++
+ (gdb) frame
+ #0 Foo.Main () at Foo.il:26
+ 26 // method line 2
+ (gdb) n
+ Foo.Main () at Foo.il:38
+ 38 IL_0000: ldc.i4.5
+ (gdb) list
+ 33 .maxstack 2
+ 34 .locals (
+ 35 int32 V_0,
+ 36 int64 V_1,
+ 37 valuetype MyStruct V_2)
+ 38 IL_0000: ldc.i4.5
+ 39 IL_0001: stloc.0
+ 40 IL_0002: ldc.i4 512
+ 41 IL_0007: conv.i8
+ 42 IL_0008: stloc.1
+ 43 IL_0009: ldloca.s 2
+ 44 IL_000b: ldc.i4.5
+ 45 IL_000c: stfld int32 .MyStruct::a
+ 46 IL_0011: ldloca.s 2
+ 47 IL_0013: ldloc.1
+ 48 IL_0014: stfld int64 .MyStruct::b
+ 49 IL_0019: ldloca.s 2
+ 50 IL_001b: ldc.r8 23323.5
+ 51 IL_0024: stfld float64 .MyStruct::c
+ 52 IL_0029: ret
+ (gdb) until 52
+ Foo.Main () at Foo.il:53
+ 53 }
+ (gdb) info locals
+ V_0 = 5
+ V_1 = 512
+ V_2 = {a = 5, b = 512, c = 23323.523499999999}
+ </pre>
+
+ As you see in this example, you need to know IL code to use this debugging method - but
+ it may be the only way to debug a library.
+
diff --git a/web/jit-debug-sample2 b/web/jit-debug-sample2
new file mode 100644
index 00000000000..ae75ceed591
--- /dev/null
+++ b/web/jit-debug-sample2
@@ -0,0 +1,70 @@
+* A debugging session using a symbol file which has been created by MCS.
+
+ Let's assume we have the following C# application which we want to debug:
+
+ <pre>
+ using System;
+
+ public class Foo
+ {
+ public struct MyStruct {
+ int a;
+ long b;
+ double c;
+ }
+
+ public static void Main ()
+ {
+ Int32 value = 5;
+ long test = 512;
+
+ MyStruct my_struct;
+ my_struct.a = 5;
+ my_struct.b = test;
+ my_struct.c = 23323.5235;
+ }
+ }
+ </pre>
+
+ First of all, we need to compile it with MCS, assemble the generated .s file and
+ create the .il files for all referenced assemblies which were not compiled with MCS:
+
+ <pre>
+ $ mcs -g ./Foo.cs
+ $ as -o Foo-debug.o Foo-debug.s
+ $ monodis /home/export/martin/MONO-LINUX/lib/corlib.dll > corlib.il
+ </pre>
+
+ Now we can start the JIT in the debugger:
+
+ <pre>
+ $ gdb ~/monocvs/mono/mono/jit/mono
+ (gdb) r --dwarf-plus --debug Foo:Main ./Foo.exe
+ Starting program: /home/martin/monocvs/mono/mono/jit/mono --dwarf-plus --debug Foo:Main ./Foo.exe
+ Program received signal SIGTRAP, Trace/breakpoint trap.
+ 0x081e8681 in ?? ()
+ (gdb) call mono_debug_make_symbols ()
+ (gdb) add-symbol-file Foo-debug.o
+ (gdb) add-symbol-file /tmp/corlib.o
+` (gdb) frame
+ #0 Main () at ./Foo.cs:11
+ 11 public static void Main ()
+ (gdb) n
+ Main () at ./Foo.cs:13
+ 13 Int32 value = 5;
+ (gdb)
+ 14 long test = 512;
+ (gdb)
+ 17 my_struct.a = 5;
+ (gdb)
+ 18 my_struct.b = test;
+ (gdb)
+ 19 my_struct.c = 23323.5235;
+ (gdb)
+ 20 }
+ (gdb) info locals
+ value = 5
+ test = 512
+ my_struct = { a = 5, b = 512, c = 23323.5235 }
+ </pre>
+
diff --git a/web/languages b/web/languages
new file mode 100755
index 00000000000..209bbdd8626
--- /dev/null
+++ b/web/languages
@@ -0,0 +1,19 @@
+* Compilers for other languages
+
+ Here are some other free compilers for other languages that
+ target .NET and should work with Mono with no problem:
+
+* Oberon
+
+ This Oberon compiler is written in Oberon.NET (another self
+ hosting compiler):
+
+ <a href="http://www.superin.formativ.net/mono/oberon/oberon.zip">http://www.superin.formativ.net/mono/oberon/oberon.zip</a>
+
+* Component Pascal
+
+ The Component Pascal compiler: <a
+ href="http://www2.fit.qut.edu.au/CompSci/PLAS/ComponentPascal">Home
+ Page</a>, you can <a
+ href="http://www2.fit.qut.edu.au/CompSci/PLAS/ComponentPascal/gpcp1.1.4-netRTM.zip">
+ download it</a>
diff --git a/web/mailing-lists b/web/mailing-lists
new file mode 100644
index 00000000000..22a71135ac1
--- /dev/null
+++ b/web/mailing-lists
@@ -0,0 +1,90 @@
+* Mailing Lists
+
+ There are a number of mailing lists for Mono
+
+ <table>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-list">mono-list</a></b>
+ </td>
+ <td>
+ The general Mono discussion list.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-announce-list">mono-announce-list</a></b>
+ </td>
+ <td>
+ Announcements of Mono developments.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-gc-list">mono-gc-list</a></b>
+ </td>
+ <td>
+ Discussion on the GC system of Mono.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-patches">mono-patches</a></b>
+ </td>
+ <td>
+ Track the CVS activity of Mono on this mailing list (patches are sent to recipients).
+ You can get <a href="http://www.go-mono.com/snapshots">daily snapshots</a> as well.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-cvs-list">mono-cvs-list</a></b>
+ </td>
+ <td>
+ Track the CVS activity of Mono on this mailing list.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-docs-list">mono-docs-list</a></b>
+ </td>
+ <td>
+ Discussion on the documentation of Mono.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a
+ href="http://lists.ximian.com/mailman/listinfo/mono-patches">mono-patches</a></b>
+ </td>
+ <td>
+ Track the development of Mono in realtime: receive patches to the Mono repository
+ by email.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b><a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs</a></b>
+ </td>
+ <td>
+ This mailing list is used to keep track of the bugs in Mono as reported
+ in <a href="http://bugzilla.ximian.com">Bugzilla.ximian.com</a>
+ </td>
+ </tr>
+ </table>
+
+ Other mailing lists of interest:
+
+ <ul>
+ * <b><a
+ href="http://discuss.develop.com/dotnet.html">Dotnet mailing
+ list at Develop.com:</a></b> The guys at Develop Mentor run
+ this general purpose mailing list.
+ </ul>
+ </ul> \ No newline at end of file
diff --git a/web/mono-build-w32.sh b/web/mono-build-w32.sh
new file mode 100755
index 00000000000..a1f141a718d
--- /dev/null
+++ b/web/mono-build-w32.sh
@@ -0,0 +1,142 @@
+#!/bin/bash
+
+# Script to automate the building of mono and its dependencies on
+# cygwin. Relies on wget being installed (could make it fall back to
+# using lynx, links, w3, curl etc), assumes that gcc, make, tar,
+# automake, etc are already installed too (may be worth testing for
+# all that right at the top and bailing out if missing/too old/too new
+# etc).
+
+
+# See where we are. This will become the top level directory for the
+# installation, unless we are given an alternative location
+here=$1
+test -z "$here" && here=`pwd`
+
+echo "Building Mono and dependencies in $here, installing to $here/install"
+
+PATH=$here/install/bin:$here/install/lib:$PATH
+
+# Check mono out first, so we can run aclocal from inside the mono dir (it
+# needs to see which version of the real aclocal to run)
+test -z "$CVSROOT" && CVSROOT=:pserver:anonymous@anoncvs.go-mono.com:/mono
+export CVSROOT
+
+echo "Updating mono"
+
+# cvs checkout does the same as cvs update, except that it copes with
+# new modules being added
+
+# Older versions of cvs insist on a cvs login for :pserver: methods
+# Make sure cvs is using ssh for :ext: methods
+
+if [ ${CVSROOT:0:5} = ":ext:" ]; then
+ CVS_RSH=ssh
+ export CVS_RSH
+elif [ ${CVSROOT:0:9} = ":pserver:" ]; then
+ if ! grep $CVSROOT ~/.cvspass > /dev/null 2>&1 ; then
+ echo "Logging into CVS server. Anonymous CVS password is probably empty"
+ cvs login || exit -1
+ fi
+fi
+
+cvs checkout mono || exit -1
+
+# Need to install pkgconfig and set ACLOCAL_FLAGS if there is not a
+# pkgconfig installed already. Otherwise set PKG_CONFIG_PATH to the
+# glib we're about to install in $here/install. This script could
+# attempt to be clever and see if glib 2 is already installed, too.
+
+
+# --print-ac-dir was added in 1.2h according to the ChangeLog. This
+# should mean that any automake new enough for us has it.
+
+# This sets ACLOCAL_FLAGS to point to the freshly installed pkgconfig
+# if it doesnt already exist on the system (otherwise auto* breaks if
+# it finds two copies of the m4 macros). The GIMP for Windows
+# pkgconfig sets its prefix based on the location of its binary, so we
+# dont need PKG_CONFIG_PATH (the internal pkgconfig config file
+# $prefix is handled similarly).
+
+function aclocal_scan () {
+ # Quietly ignore the rogue '-I' and other aclocal flags that
+ # aren't actually directories...
+ #
+ # cd into mono/ so that the aclocal wrapper can work out which version
+ # of aclocal to run
+ for i in `(cd mono && aclocal --print-ac-dir)` $ACLOCAL_FLAGS
+ do
+ if [ -f $i/$1 ]; then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+function install_package() {
+ zipfile=$1
+ markerfile=$2
+ name=$3
+
+ echo "Installing $name..."
+ if [ ! -f $here/$zipfile ]; then
+ wget http://www.go-mono.com/archive/$zipfile
+ fi
+
+ # Assume that the package is installed correctly if the marker
+ # file is there
+ if [ ! -f $here/install/$markerfile ]; then
+ (cd $here/install || exit -1; unzip -o $here/$zipfile || exit -1) || exit -1
+ fi
+}
+
+if ! aclocal_scan pkg.m4 ; then
+ ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
+fi
+
+export PATH
+export ACLOCAL_FLAGS
+
+# Grab pkg-config, glib etc
+if [ ! -d $here/install ]; then
+ mkdir $here/install || exit -1
+fi
+
+# Fetch and install pkg-config, glib, iconv, intl
+
+install_package pkgconfig-0.80-tml-20020101.zip bin/pkg-config.exe pkgconfig
+install_package glib-1.3.12-20020101.zip lib/libglib-1.3-12.dll glib
+install_package glib-dev-1.3.12-20020101.zip lib/glib-1.3.lib glib-dev
+install_package libiconv-1.7.zip lib/iconv.dll iconv
+install_package libiconv-dev-1.7.zip lib/iconv.lib iconv-dev
+install_package libintl-0.10.40-20020101.zip lib/libintl-1.dll intl
+install_package libgc-dev.zip lib/gc.dll gc-dev
+
+# Needed to find the libiconv bits
+CPPFLAGS="$CPPFLAGS -I$here/install/include"
+LDFLAGS="$LDFLAGS -L$here/install/lib"
+export CPPFLAGS
+export LDFLAGS
+
+# Make sure we build native w32, not cygwin
+#CC="gcc -mno-cygwin"
+#export CC
+
+# --prefix is used to set the class library dir in mono, and it needs
+# to be in windows-native form. It also needs to have '\' turned into
+# '/' to avoid quoting issues during the build.
+prefix=`cygpath -w $here/install | sed -e 's@\\\\@/@g'`
+
+# Build and install mono
+echo "Building and installing mono"
+
+(cd $here/mono; ./autogen.sh --prefix=$prefix || exit -1; make || exit -1; make install || exit -1) || exit -1
+
+
+echo ""
+echo ""
+echo "All done."
+echo "Add $here/install/bin and $here/install/lib to \$PATH"
+echo "Don't forget to copy the class libraries to $here/install/lib"
+
diff --git a/web/mono-build.sh b/web/mono-build.sh
new file mode 100755
index 00000000000..10878bf2780
--- /dev/null
+++ b/web/mono-build.sh
@@ -0,0 +1,183 @@
+#!/bin/bash
+
+# Script to automate the building of mono and its dependencies.
+# Relies on wget being installed (could make it fall back to using
+# lynx, links, w3, curl etc), assumes that gcc, make, tar, automake,
+# etc are already installed too (may be worth testing for all that
+# right at the top and bailing out if missing/too old/too new etc).
+
+
+# See where we are. This will become the top level directory for the
+# installation, unless we are given an alternative location
+here=$1
+test -z "$here" && here=`pwd`
+
+echo "Building Mono and dependencies in $here, installing to $here/install"
+
+PATH=$here/install/bin:$PATH
+LD_LIBRARY_PATH=$here/install/lib:$LD_LIBRARY_PATH
+
+# Need to install pkgconfig and set ACLOCAL_FLAGS if there is not a
+# pkgconfig installed already. Otherwise set PKG_CONFIG_PATH to the
+# glib we're about to install in $here/install. This script could
+# attempt to be clever and see if glib 2 is already installed, too.
+
+
+# --print-ac-dir was added in 1.2h according to the ChangeLog. This
+# should mean that any automake new enough for us has it.
+
+function aclocal_scan () {
+ # Quietly ignore the rogue '-I' and other aclocal flags that
+ # aren't actually directories...
+ for i in `aclocal --print-ac-dir` $ACLOCAL_FLAGS
+ do
+ if [ -f $i/$1 ]; then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+function pkgconfig_scan () {
+ module=$1
+
+ echo "Finding pkgconfig files for $module..."
+
+ # Should we use locate? or just a list of well-known directories?
+ # locate has the problem of false positives in src dirs
+ for i in /usr/lib/pkgconfig /usr/local/lib/pkgconfig
+ do
+ echo "Looking in $i..."
+ if [ -f $i/${module}.pc ]; then
+ echo $i
+ return
+ fi
+ done
+}
+
+function install_package() {
+ tarfile=$1
+ dirname=$2
+ name=$3
+ configure_options=$4
+
+ echo "Installing $name..."
+ if [ ! -f $here/$tarfile ]; then
+ wget http://www.go-mono.org/archive/$tarfile
+ fi
+
+ # Assume that the package built correctly if the dir is there
+ if [ ! -d $here/$dirname ]; then
+ # Build and install package
+ tar xzf $here/$tarfile || exit -1
+ (cd $here/$dirname; ./configure --prefix=$here/install $configure_options || exit -1; make || exit -1; make install || exit -1)
+ success=$?
+ if [ $success -ne 0 ]; then
+ echo "***** $name build failure. Run rm -rf $here/$dirname to have this script attempt to build $name again next time"
+ exit -1
+ fi
+ fi
+}
+
+if aclocal_scan pkg.m4 ; then
+ install_pkgconfig=no
+else
+ install_pkgconfig=yes
+fi
+
+if aclocal_scan glib-2.0.m4 ; then
+ install_glib=no
+ if [ $install_pkgconfig = "yes" ]; then
+ # We have to tell the newly-installed pkgconfig about the
+ # system-installed glib
+ PKG_CONFIG_PATH=`pkgconfig_scan glib-2.0`:$PKG_CONFIG_PATH
+ fi
+else
+ install_glib=yes
+ PKG_CONFIG_PATH="$here/install/lib/pkgconfig:$PKG_CONFIG_PATH"
+fi
+
+if [ -f /usr/include/gc/gc.h ]; then
+ install_libgc=no
+else
+ install_libgc=yes
+fi
+
+if [ $install_pkgconfig = "yes" -o $install_glib = "yes" ]; then
+ ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
+fi
+
+export PATH
+export LD_LIBRARY_PATH
+export ACLOCAL_FLAGS
+export PKG_CONFIG_PATH
+
+CPPFLAGS="$CPPFLAGS -I$here/install/include"
+LDFLAGS="$LDFLAGS -L$here/install/lib"
+export CPPFLAGS
+export LDFLAGS
+
+# Grab pkg-config-0.8, glib-1.3.12 if necessary
+
+if [ $install_pkgconfig = "yes" ]; then
+ install_package pkgconfig-0.8.0.tar.gz pkgconfig-0.8.0 pkgconfig ""
+else
+ echo "Not installing pkgconfig, you already seem to have it installed"
+fi
+
+if [ $install_glib = "yes" ]; then
+ install_package glib-1.3.13.tar.gz glib-1.3.13 glib ""
+else
+ echo "Not installing glib, you already seem to have it installed"
+fi
+
+if [ $install_libgc = "yes" ]; then
+ LIBS="-ldl" install_package gc6.0.tar.gz gc6.0 libgc "--enable-threads=pthreads"
+ # make install didnt do the headers!
+ mkdir -p $here/install/include/gc
+ cp -r $here/gc6.0/include/* $here/install/include/gc
+else
+ echo "Not installing libgc, you already seem to have it installed"
+fi
+
+# End of build dependencies, now get the latest mono checkout and build that
+
+test -z "$CVSROOT" && CVSROOT=:pserver:anonymous@anoncvs.go-mono.com:/mono
+export CVSROOT
+
+echo "Updating mono"
+
+# cvs checkout does the same as cvs update, except that it copes with
+# new modules being added
+
+# Older versions of cvs insist on a cvs login for :pserver: methods
+# Make sure cvs is using ssh for :ext: methods
+
+if [ ${CVSROOT:0:5} = ":ext:" ]; then
+ CVS_RSH=ssh
+ export CVS_RSH
+elif [ ${CVSROOT:0:9} = ":pserver:" ]; then
+ # Chop off the trailing /mono because cvs 1.11 adds the port number
+ # into the .cvspass line
+ if ! grep ${CVSROOT%:/mono} ~/.cvspass > /dev/null 2>&1 ; then
+ echo "Logging into CVS server. Anonymous CVS password is probably empty"
+ cvs login
+ fi
+fi
+
+cvs checkout mono || exit -1
+
+# Build and install mono
+echo "Building and installing mono"
+
+(cd $here/mono; ./autogen.sh --prefix=$here/install || exit -1; make || exit -1; make install || exit -1) || exit -1
+
+
+echo ""
+echo ""
+echo "All done."
+echo "Add $here/install/bin to \$PATH"
+echo "Add $here/install/lib to \$LD_LIBRARY_PATH"
+echo "Don't forget to copy the class libraries to $here/install/lib"
+
diff --git a/web/monodoc-xml b/web/monodoc-xml
new file mode 100644
index 00000000000..e8a5ffe2c71
--- /dev/null
+++ b/web/monodoc-xml
@@ -0,0 +1,755 @@
+* MonoDoc XML Tag Reference
+
+** Introduction
+
+<em>
+[This documentation is in progress. Comments to
+<a href="mailto:jbarn@httcb.net">jbarn@httcb.net</a> and/or
+<a href="mailto:mono-docs-list@ximian.com">mono-docs-list@ximian.com</a>.]
+</em>
+
+MonoDoc XML, our format for multilingual API documentation stored outside of
+source files, is very similar to the output of Microsoft's csc /doc. Minor
+alterations have been made to ease human parsing and hand-editing, but
+the majority of the tags are identical. In fact, many of the descriptions
+and examples below are taken from the ECMA C# Language Specification with
+little or no alteration.
+
+This document provides a list of all available MonoDoc XML tags, with
+syntax and examples. A complete example can be found in
+<a href="#appendix-a">Appendix A</a>, and both a <a href="#">DTD</a> and
+<a href="#">XSD schema</a> will be available very shortly.
+
+** MonoDoc XML Tags
+
+<dl>
+<dt><code><a href="#c">&lt;c&gt;</a></code></dt>
+<dd>Mark short sections of text as code.</dd>
+
+<dt><code><code><a href="#code">&lt;code&gt;</a></code></dt></code>
+<dd>Mark one or more lines as code or output.</dd>
+
+<dt><code><a href="#doc">&lt;doc&gt;</a></dt></code>
+<dd>Root element of documentation XML.</dd>
+
+<dt><code><a href="#event">&lt;event&gt;</a></dt></code>
+<dd>Describe an event.</dd>
+
+<dt><code><a href="#example">&lt;example&gt;</a></dt></code>
+<dd>An example.</dd>
+
+<dt><code><a href="#exception">&lt;exception&gt;</a></dt></code>
+<dd>Specify an exception a method can throw.</dd>
+
+<dt><code><a href="#field">&lt;field&gt;</a></dt></code>
+<dd>Describe a field.</dd>
+
+<dt><code><a href="#list">&lt;list&gt;</a></dt></code>
+<dd>Create a list or table.</dd>
+
+<dt><code><a href="#method">&lt;method&gt;</a></dt></code>
+<dd>Describe a method.</dd>
+
+<dt><code><a href="#para">&lt;para&gt;</a></dt></code>
+<dd>Allow text to be structured in paragraphs.</dd>
+
+<dt><code><a href="#param">&lt;param&gt;</a></dt></code>
+<dd>Specify a parameter for a method.</dd>
+
+<dt><code><a href="#paramref">&lt;paramref&gt;</a></dt></code>
+<dd>Mark a word as a parameter.</dd>
+
+<dt><code><a href="#permission">&lt;permission&gt;</a></dt></code>
+<dd>Define the access level of a member.</dd>
+
+<dt><code><a href="#property">&lt;property&gt;</a></dt></code>
+<dd>Describe a property.</dd>
+
+<dt><code><a href="#remarks">&lt;remarks&gt;</a></dt></code>
+<dd>Provide verbose information for a type or member.</dd>
+
+<dt><code><a href="#returns">&lt;returns&gt;</a></dt></code>
+<dd>Specify the return value of a method.</dd>
+
+<dt><code><a href="#see">&lt;see&gt;</a></dt></code>
+<dd>Specify a link.</dd>
+
+<dt><code><a href="#seealso">&lt;seealso&gt;</a></dt></code>
+<dd>Specify a 'see also' entry.</dd>
+
+<dt><code><a href="#summary">&lt;summary&gt;</a></dt></code>
+<dd>Provide a brief (usually one sentence) description of a member or type.</dd>
+
+<dt><code><a href="#type">&lt;type&gt;</a></dt></code>
+<dd>Describe a type.</dd>
+</dl>
+
+** Definitions and Examples
+
+*** <a name="c">&lt;c&gt;</a>
+
+This tag can be used to mark short, inline fragments of text that should
+be considered source code or program output. User agents should render
+this tag in a special -- likely monospace -- font. For larger sections,
+use <a href="#code"><code>&lt;code&gt;</code></a>.
+
+**** Syntax
+
+<pre>
+&lt;c&gt;code or output text&lt;/c&gt;
+</pre>
+
+**** Example
+
+<pre>
+&lt;remarks&gt;
+ Class &lt;c&gt;Point&lt;/c&gt; models a point in two-dimensional space.
+&lt;/remarks&gt;
+</pre>
+
+*** <a name="code">&lt;code&gt;</a>
+
+This tag can be used to mark one or more lines of text as source code or
+program output. User agents should render this tag in a special (likely
+monospace) font, and preserve both whitespace and newlines.
+
+**** Syntax
+
+ <code>&lt;code&gt;source or program output&lt;/code&gt;</code>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This method changes the point's location by the given
+ x- and y-offsets.
+ &lt;example lang="C#"&gt;
+ A C# example:
+ &lt;code&gt;
+ Point p = new Point(3, 5);
+ p.Translate(-1, 3);
+ // p == (2, 8);
+ &lt;/code&gt;
+ &lt;/example&gt;
+&lt;/summary&gt;
+</pre>
+
+*** <a name="doc">&lt;doc&gt;</a>
+
+This tag is the root element of the documentation file. It can contain
+any number of &lt;type&gt; elements.
+
+**** Syntax
+
+<code>&lt;doc lang="language" assembly="assembly"&gt;typedocs&lt;/doc&gt;</code>
+
+<blockquote>
+<em>lang="language"</em><br />
+The two-letter ISO code that specifies what language the contained
+documentation is written in.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;doc lang="en"&gt;
+ &lt;type name="Graphics.Point"&gt;
+ &lt;!-- ... --&gt;
+ &lt;/type&gt;
+&lt;/doc&gt;
+</pre>
+
+*** <a name="event">&lt;event&gt;</a>
+
+This tag documents an event.
+
+**** Syntax
+
+<code>&lt;event name="eventname"&gt;documentation&lt;/event&gt;</code>
+
+<blockquote>
+<em>name="eventname"</em><br />
+The name of the event being documented.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;event name="Click"&gt;
+ &lt;summary&gt;
+ Occurs when the control is clicked.
+ &lt;/summary&gt;
+ &lt;data&gt;
+ The event handler receives an argument of type EventArgs
+ containing data related to this event.
+ &lt;/data&gt;
+ &lt;remarks&gt;
+ &lt;para&gt;The ControlStyles.StandardClick style must be set
+ for this event to be raised.&lt;/para&gt;
+ &lt;para&gt;For more information about handling events, see
+ Consuming Events.&lt;/para&gt;
+ &lt;/remarks&gt;
+&lt;/event&gt;
+</pre>
+
+*** <a name="example">&lt;example&gt;</a>
+
+This tag marks a section of text as an example, and optionally specifies
+what programming language <code><a href="#code">&lt;code&gt;</a></code> portions of the example are written in.
+
+**** Syntax
+
+<code><example lang="language">example text and code</example></code>
+
+<blockquote>
+<em>lang="language"</em><br />
+(optional) The name of the programming language <code><a href="#code">&lt;code&gt;</a></code> blocks in this example
+use. This information can be used by user agents to provide
+intelligent access to examples in multiple languages.
+</blockquote>
+
+**** Example
+
+See <code><a href="#code">&lt;code&gt;<a/></code> for an example.
+
+*** <a name="exception">&lt;exception&gt;</a>
+
+This tag provides a way to specify the exceptions a method can throw.
+
+**** Syntax
+
+<code>&lt;exception cref="exception-type"&gt;description&lt;/exception&gt;</code>
+
+<blockquote>
+<em>cref="exception-type"</em><br />
+The name of an exception type.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;exception cref="System.IO.FileNotFoundException"&gt;
+ Thrown when the requested file is not found.
+&lt;/exception&gt;
+</pre>
+
+*** <a name="field">&lt;field&gt;</a>
+
+This tag is used to describe a field.
+
+**** Syntax
+
+<code>&lt;field name="fieldname"&gt;documentation&lt;/field&gt;</code>
+
+<blockquote>
+<em>name="fieldname"</em><br />
+The name of the field being documented.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;field name="x"&gt;
+ &lt;summary&gt;
+ Instance variable &lt;c&gt;x&lt;/c&gt; represents the point's
+ x-coordinate.
+ &lt;/summary&gt;
+&lt;/field&gt;
+</pre>
+
+*** <a name="list">&lt;list&gt;</a>
+
+This tag is used to create a list or table of items. It may contain a
+<code>&lt;listheader&gt;</code> block to define the heading row of either a table or
+definition list. (When defining a table, only an entry for 'term' in the
+heading need be supplied.)
+
+Each item in the list is specified with an <code>&lt;item&gt;</code> block. When creating a
+definition list, both <code>&lt;term&gt;</code> and <code>&ltdescription&gt;</code> must be specified.
+However, for a table, bulleted list, or numbered list, only <code>&lt;description&gt;</code>
+need be specified.
+
+**** Syntax
+
+<pre>
+&lt;list type="bullet" | "number" | "table"&gt;
+ &lt;listheader&gt;
+ &lt;term&gt;term&lt;/term&gt;
+ &lt;description&gt;description&lt;/description&gt;
+ &lt;/listheader&gt;
+ &lt;item&gt;
+ &lt;term&gt;term&lt;/term&gt;
+ &lt;description&gt;description&lt;/description&gt;
+ &lt;/item&gt;
+
+ ...
+
+&lt;/list&gt;
+</pre>
+
+<blockquote>
+<em>term</em><br />
+The term to define, whose definition is in <code>&lt;description&gt;</code>.
+<br /><br />
+<em>description</em><br />
+Either an item in a bullet or numbered list, or the definition of a <code>&lt;term&gt;</code>.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;list type="bullet"&gt;
+ &lt;item&gt;
+ &lt;description&gt;Item 1&lt;/description&gt;
+ &lt;/item&gt;
+ &lt;item&gt;
+ &lt;description&gt;Item 2&lt;/description&gt;
+ &lt;/item&gt;
+&lt;/list&gt;
+</pre>
+
+*** <a name="method">&lt;method&gt;</a>
+
+This tag is the overall containing tag for documenting a method.
+
+**** Syntax
+
+<code>&lt;method name="methodname"&gt;documentation&lt;/method&gt;</code>
+
+**** Example
+
+<pre>
+&lt;method name="op_Equality(Graphics.Point,Graphics.Point)"&gt;
+ &lt;summary&gt;
+ This operator determines whether two points have
+ the same location.
+ &lt;/summary&gt;
+ &lt;param name="p1"&gt;
+ &lt;c&gt;p1&lt;/c&gt; is the first Point to be compared.
+ &lt;/param&gt;
+ &lt;param name="p2"&gt;
+ &lt;c&gt;p2&lt;/c&gt; is the second Point to be compared.
+ &lt;/param&gt;
+ &lt;returns&gt;
+ True if the points have the same location and they
+ have the exact same type; otherwise, false.
+ &lt;/returns&gt;
+ &lt;seealso cref="Equals(System.Object)" /&gt;
+ &lt;seealso cref="op_Inequality(Graphics.Point,Graphics.Point)" /&gt;
+&lt;/method&gt;
+</pre>
+
+*** <a name="para">&lt;para&gt;</a>
+
+
+This tag is for use inside other tags such as <code>&lt;remarks&gt;</code> or <code>&lt;returns&gt;</code>, and
+allows text to be structured into paragraphs.
+
+**** Syntax
+
+<code>&lt;para&gt;text&lt;/para&gt;</code>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ &lt;para&gt;
+ This is the entry point of the &lt;c&gt;Point&lt;/c&gt; class testing
+ program.
+ &lt;/para&gt;
+ &lt;para&gt;
+ This program tests each method and operator, and
+ is intended to be run after any non-trivial maintenance has
+ been performed on the &lt;c&gt;Point&lt;/c&gt; class.
+ &lt;/para&gt;
+&lt;/summary&gt;
+</pre>
+
+*** <a name="param">&lt;param&gt;</a>
+
+This tag is used to describe a parameter for a method, constructor, or
+indexer.
+
+**** Syntax
+
+<code>&lt;param name="name"&gt;description&lt;/param&gt;</code>
+
+<blockquote>
+<em>name</em><br />
+The name of the parameter.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This is the entry point of the &lt;c&gt;Point&lt;/c&gt;
+ class.
+&lt;/summary&gt;
+&lt;param name="xor"&gt;&lt;c&gt;xor&lt;/c&gt; is the new x-coordinate.&lt;/param&gt;
+&lt;param name "yor"&gt;&lt;c&gt;yor&lt;/c&gt; is the new y-coordinate.&lt;/param&gt;
+</pre>
+
+*** <a name="paramref">&lt;paramref&gt;</a>
+
+This tag is used to indicate that a word is a parameter. User agents
+could use this information for special formatting or hyperlink insertion.
+
+**** Syntax
+
+<code>&lt;paramref name="name" /&gt;</code>
+
+<blockquote>
+<em>name</em><br />
+The name of the parameter.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This constructor initializes the new Point to
+ (&lt;paramref name="xor" /&gt;,&lt;paramref name="yor" /&gt;).
+&lt;/summary&gt;
+&lt;param name="xor"&gt;&lt;c&gt;xor&lt;/c&gt; is the new x-coordinate.&lt;/param&gt;
+&lt;param name "yor"&gt;&lt;c&gt;yor&lt;/c&gt; is the new y-coordinate.&lt;/param&gt;
+</pre>
+
+*** <a name="permission">&lt;permission&gt;</a>
+
+This tag allows the security accessibility of a member to be documented.
+
+**** Syntax
+
+<code>&lt;permission cref="member"&gt;description&lt;/permission&gt;</code>
+
+<blockquote>
+<em>cref="member"</em><br />
+The name of a member.</br>
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;permission cref="System.Security.PermissionSet"&gt;
+ Everyone can access this method.
+&lt;/permission&gt;
+</pre>
+
+*** <a name="property">&ltproperty&gt;</a>
+
+This tag is the overall containing tag for documenting a property.
+
+**** Syntax
+
+<code>&lt;property name="propertyname"&gt;documentation&lt;/property&gt;</code>
+
+<blockquote>
+<em>name="propertyname"</em><br />
+The name of the property.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;property name="X"&gt;
+ &lt;summary&gt;
+ Gets or sets the point's x-coordinate.
+ &lt;value&gt;
+ The point's x-coordinate.
+ &lt;/value&gt;
+&lt;/property&gt;
+</pre>
+
+
+*** <a name="remarks">&lt;remarks&gt;</a>
+
+This tag contains extended discussion and information about a member or
+a type. <em>[jbarn: This differs from both the ECMA docs and
+portions of Microsoft's documentation, but seems consistent with both
+common usage, and, more importantly, NDoc convention.]</em>
+
+**** Syntax
+
+<code>&lt;remarks&gt;description&lt;/remarks&gt;</code>
+
+**** Example
+
+<pre>
+&lt;type name="Graphics.Point"&gt;
+ &lt;summary&gt;
+ Models a point in a two-dimensional plane.
+ &lt;/summary&gt;
+ &lt;remarks&gt;
+ Herein I might have an extended discussion of
+ the validity of Cartesian coordinate systems,
+ with examples pro and con, and perhaps
+ some code.
+ &lt;/remarks&gt;
+
+ &lt;!-- ... --&gt;
+&lt;/type&gt;
+</pre>
+
+*** <a name="returns">&lt;returns&gt;</a>
+
+This tag is used to describe the return value of a method.
+
+**** Syntax
+
+<code>&lt;returns&gt;description&lt;/returns&gt;</code>
+
+**** Example
+
+<pre>
+&lt;method name="op_Inequality(Graphics.Point,Graphics.Point)"&gt;
+ &lt;summary&gt;
+ This operator determines whether two points have the
+ same location.
+ &lt;/summary&gt;
+ &lt;param name="p1"&gt;&lt;c&gt;p1&lt;/c&gt; is the first Point to be compared.&lt;/param&gt;
+ &lt;param name="p2"&gt;&lt;c&gt;p2&lt;/c&gt; is the second Point to be compared.&lt;/param&gt;
+ &lt;returns&gt;
+ True if the points do not have the same location and they
+ have the exact same type; otherwise, false.
+ &lt;/returns&gt;
+&lt;/method&gt;
+</pre>
+
+*** <a name="see">&lt;see&gt;</a>
+
+This tag allows a link to be specified within documentation text. (Use
+<code>&lt;seealso&gt;</code> to indicate links that should appear in a 'See Also' section.)
+
+**** Syntax
+
+<code>&lt;see cref="destination" /&gt;</code>
+
+<blockquote>
+<em>cref="destination"</em><br />
+A destination, such as a type or a member of a type.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This method changes the point's location to the given
+ coordinates. This is an asinine way to insert a link,
+ but &lt;see cref="Equals(Object)" /&gt; to understand
+ how points are compared.
+&lt;/summary&gt;
+</pre>
+
+*** <a name="seealso">&lt;seealso&gt;</a>
+
+This tag allows an entry to be generated for the 'See Also' section. (Use
+<code>&lt;see&gt;</code> to specify a link from within text.)
+
+**** Syntax
+
+<code>&lt;seealso cref="destination" /&gt;</code>
+
+<blockquote>
+<em>cref="destination"</em><br />
+A destination, such as a type or a member of a type.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This method determines whether two Points have the
+ same location.
+&lt;/summary&gt;
+&lt;seealso cref="op_Equality(Graphics.Point,Graphics.Point)" /&gt;
+&lt;seealso cref="op_Inequality(Graphics.Point,Graphics.Point" /&gt;
+</pre>
+
+*** <a name="summary">&lt;summary&gt;</a>
+
+This tag contains a short summary of a member or type,
+often one sentence. <em>[jbarn: This differs from both the ECMA docs and
+portions of Microsoft's documentation, but seems consistent with both
+common usage, and, more importantly, NDoc convention.]</em>
+
+**** Syntax
+
+<code>&lt;summary&gt;description&lt;/summary&gt;</code>
+
+**** Example
+
+<pre>
+&lt;summary&gt;
+ This is the entry point of the &lt;c&gt;Point&lt;/c&gt; class testing
+ program.
+&lt;/summary&gt;
+&lt;remarks&gt;
+ This program tests each method an operator, and is intended
+ to be run after any non-trivial maintenance is performed
+ on the &lt;c&gt;Point&lt;/c&gt; class.
+&lt;/remarks&gt;
+</pre>
+
+*** <a name="type">&lt;type&gt;</a>
+
+This tag is the overall containing tag for documenting a type.
+
+**** Syntax
+
+<code>&lttype name="typename" assembly="assemblyname"&gt;documentation&lt;/type&gt;</code>
+
+<blockquote>
+<em>name="typename"</em><br />
+The name of the type being documented.
+<br /><br />
+<em>assembly="assemblyname"</em><br />
+The assembly this type resides in. This attribute is not required for nested types.
+</blockquote>
+
+**** Example
+
+<pre>
+&lt;type name="Graphics.Point" assembly="Point"&gt;
+ &lt;summary&gt;
+ Models a point in two-dimensional space.
+ &lt;/summary&gt;
+
+ &lt;!-- members --&gt;
+
+ &lt;field name="x"&gt;
+ &lt;summary&gt;
+ Represents the point's x-coordinate.
+ &lt;/summary&gt;
+ &lt;/field&gt;
+&lt;/type&gt;
+</pre>
+
+** <a name="appendix-a">Appendix A: Complete Example</a>
+
+<em>[jbarn: Please, please, don't take the human-readable portions of
+this example to be good guidelines for writing your own documentation.
+this XML is intended only to show structure.]</em>
+
+<pre>
+&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+&lt;doc lang="en"&gt;
+ &lt;type name="Graphics.Point" assembly="Point"&gt;
+ &lt;summary&gt;
+ Models a point in a two-dimensional plane.
+ &lt;/summary&gt;
+ &lt;remarks&gt;
+ No useful remarks.
+ &lt;/remarks&gt;
+
+ &lt;!-- fields --&gt;
+ &lt;field name="x"&gt;
+ &lt;summary&gt;
+ Instance variable &lt;c&gt;x&lt;/c&gt; represents the point's x-coordinate.
+ &lt;/summary&gt;
+ &lt;/field&gt;
+
+ &lt;field name="y"&gt;
+ &lt;summary&gt;
+ Instance variable &lt;c&gt;y&lt;/c&gt; represents the point's y-coordinate.
+ &lt;/summary&gt;
+ &lt;/field&gt;
+
+ &lt;!-- methods --&gt;
+ &lt;method name="#ctor"&gt;
+ &lt;summary&gt;
+ Initializes the new point to &lt;c&gt;(0,0)&lt;/c&gt;.
+ &lt;/summary&gt;
+ &lt;/method&gt;
+
+ &lt;method name="#ctor(System.Int32,System.Int32)"&gt;
+ &lt;summary&gt;
+ Initializes the new Point to (&lt;paramref name="xor" /&gt;,&lt;paramref name="yor" /&gt;).
+ &lt;/summary&gt;
+ &lt;param name="xor"&gt;&lt;c&gt;xor&lt;/c&gt; is the new x-coordinate.&lt;/param&gt;
+ &lt;param name="yor"&gt;&lt;c&gt;yor&lt;/c&gt; is the new y-coordinate.&lt;/param&gt;
+ &lt;/method&gt;
+
+ &lt;method name="Move(System.Int32,System.Int32)"&gt;
+ &lt;summary&gt;
+ This method changes the point's location to the given coordinates.
+ &lt;/summary&gt;
+ &lt;param name="xor"&gt;&lt;c&gt;xor&lt;/c&gt; is the new x-coordinate.&lt;/param&gt;
+ &lt;param name="yor"&gt;&lt;c&gt;yor&lt;/c&gt; is the new y-coordinate.&lt;/param&gt;
+ &lt;seealso cref="Translate(System.Int32,System.Int32)" /&gt;
+ &lt;/method&gt;
+
+ &lt;method name="Translate(System.Int32,System.Int32)"&gt;
+ &lt;summary&gt;This method changes the point's location by the given x- and y-offsets.&lt;/summary&gt;
+ &lt;remarks&gt;
+ &lt;example lang="C#"&gt;
+ A C# example:
+ &lt;code&gt;
+ Point p = new Point(3, 5);
+ p.Translate(-1, 3);
+ &lt;/code&gt;
+ This code results in &lt;c&gt;p&lt;/c&gt; having the value (2,8).
+ &lt;/example&gt;
+ &lt;/remarks&gt;
+ &lt;param name="xor"&gt;&lt;c&gt;xor&lt;/c&gt; is the relative x-offset.&lt;/param&gt;
+ &lt;param name="yor"&gt;&lt;c&gt;yor&lt;/c&gt; is the relative y-offset.&lt;/param&gt;
+ &lt;seealso cref="Move(System.Int32,System.Int32)" /&gt;
+ &lt;/method&gt;
+
+ &lt;method name="Equals(System.Object)"&gt;
+ &lt;summary&gt;This method determines whether two points have the same location.&lt;/summary&gt;
+ &lt;param name="o"&gt;&lt;c&gt;o&lt;/c&gt; is the object to be compared to the current object.&lt;/param&gt;
+ &lt;returns&gt;True if the Points have the same location and they have the exact same
+ type; otherwise, false.&lt;/returns&gt;
+ &lt;seealso cref="op_Equality(Graphics.Point,Graphics.Point)" /&gt;
+ &lt;seealso cref="op_Inequality(Graphics.Point,Graphics.Point" /&gt;
+ &lt;/method&gt;
+
+ &lt;method name="ToString"&gt;
+ &lt;summary&gt;Report a point's location as a string.&lt;/summary&gt;
+ &lt;returns&gt;A string representing a point's location, in the form (x,y), without any
+ leading, trailing, or embedded whitespace.&lt;/returns&gt;
+ &lt;/method&gt;
+
+ &lt;method name="op_Equality(Graphics.Point,Graphics.Point)"&gt;
+ &lt;summary&gt;This operator determines whether two points have the same location.&lt;/summary&gt;
+ &lt;param name="p1"&gt;&lt;c&gt;p1&lt;/c&gt; is the first Point to be compared.&lt;/param&gt;
+ &lt;param name="p2"&gt;&lt;c&gt;p2&lt;/c&gt; is the second Point to be compared.&lt;/param&gt;
+ &lt;returns&gt;True if the points have the same location and they have the exact same
+ type; otherwise, false.&lt;/returns&gt;
+ &lt;seealso cref="Equals(System.Object)" /&gt;
+ &lt;seealso cref="op_Inequality(Graphics.Point,Graphics.Point)" /&gt;
+ &lt;/method&gt;
+
+ &lt;method name="op_Inequality(Graphics.Point,Graphics.Point)"&gt;
+ &lt;summary&gt;This operator determines whether two points have the same location.&lt;/summary&gt;
+ &lt;param name="p1"&gt;&lt;c&gt;p1&lt;/c&gt; is the first Point to be compared.&lt;/param&gt;
+ &lt;param name="p2"&gt;&lt;c&gt;p2&lt;/c&gt; is the second Point to be compared.&lt;/param&gt;
+ &lt;returns&gt;True if the points do not have the same location and they have the exact same
+ type; otherwise, false.&lt;/returns&gt;
+ &lt;seealso cref="Equals(System.Object)" /&gt;
+ &lt;seealso cref="op_Equality(Graphics.Point,Graphics.Point)" /&gt;
+ &lt;/method&gt;
+
+ &lt;method name="Main"&gt;
+ &lt;summary&gt;
+ This is the entry point of the Point class testing program.
+ &lt;/summary&gt;
+ &lt;remarks&gt;
+ &lt;para&gt;This program tests each method and operator, and is intended to be run after
+ any non-trivial maintenance has been performed on the Point class.&lt;/para&gt;
+ &lt;/remarks&gt;
+ &lt;/method&gt;
+
+ &lt;!-- properties --&gt;
+ &lt;property name="X"&gt;
+ &lt;value&gt;Property &lt;c&gt;X&lt;/c&gt; represents the point's x-coordinate.&lt;/value&gt;
+ &lt;/property&gt;
+
+ &lt;property name="Y"&gt;
+ &lt;value&gt;Property &lt;c&gt;y&lt;/c&gt; represents the point's y-coordinate.&lt;/value&gt;
+ &lt;/property&gt;
+ &lt;/type&gt;
+&lt;/doc&gt;
+</pre>
+
diff --git a/web/papers b/web/papers
new file mode 100644
index 00000000000..36a31988e83
--- /dev/null
+++ b/web/papers
@@ -0,0 +1,96 @@
+* JIT Compiler
+
+ <a
+ href="http://citeseer.nj.nec.com/vitek97efficient.html">
+ Efficient Type Inclusion Tests: Jahn Vitek, R. Nigel Horspool, Andres
+ Krall</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/cytron91efficiently.html">
+ Efficiently Computing Static Single Assignment Form and the Control
+ Dependence Graph: Ron Cytron, Jeanne Ferrante</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/193349.html">
+ Practical Improvements to the Construction and Destruction of Static Single Assignment Form: Preston Briggs,
+ Keith Cooper, Timothy Harvey, Taylor Simpson</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/krall98efficient.html">
+ Efficient JavaVM Just-in-Time Compilation: Andreas Krall</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/452617.html">Java for
+ Large-Scale Scientific Computations: Andreas Krall, Phillip Thomsich</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/117522.html">
+ Engineering Simple, Efficient Code Generator Generator: Christopher
+ W. Fraser, David R. Hanson, Todd A. Proebsting</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/proebsting92code.html">
+ Code Generation Techniques: Todd Alan Proebsting</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/74629.html">Fast,
+ Effective Code Generation in a Just-In-Time Java Compiler: Ali-Reza
+ Adl-Tabatabai Guei-Yuan Lueh, Vishesh M. Parikh, James M. Stichnoth...</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/bodik00abcd.html">
+ ABCD: Eliminating Array-Bounds Checks on Demand: Rastislav Bodik, Rajiv Gupta, Vivek Sarkar</a>
+
+* Register Allocation
+
+ <a
+ href="http://citeseer.nj.nec.com/poletto99linear.html">
+ Linear Scan Register Allocation: Massimiliano Poletto, Vivek Sarkar</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/traub98quality.html">
+ Quality and Speed in Linear-scan Register Allocation: Omri Traub, Glenn
+ Holloway, Michael D. Smith</a>
+
+* Loop Transformations
+
+ <a
+ href="http://citeseer.nj.nec.com/bacon93compiler.html">
+ Compiler Transformations for High-Performance Computing: David Bacon</a>
+
+* Interpreter
+
+ <a
+ href="http://citeseer.nj.nec.com/470069.html">
+ vmgen-A Generator of Efficient Virtual Machine Interpreters: M. Anton
+ Ertl, David Gregg, Andreas Krall, Bernd Paysan</a>
+
+* Synchronization
+
+ <a
+ href="http://citeseer.nj.nec.com/krall98monitors.html">
+ Monitors and Exceptions - How to implement Java efficiently: Andreas Krall,
+ Mark Probst</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/bacon98thin.html">
+ Thin Locks: Featherweight Synchronization for Java: David Bacon</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/278639.html">
+ Featherweight Monitors with Bacon Bits: David Bacon</a>
+
+* Garbage Collection
+
+ <a
+ href="http://citeseer.nj.nec.com/wilson92uniprocessor.html">
+ Uniprocessor Garbage Collection Techniques: Paul Wilson</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/41666.html">
+ A Language-Independent Garbage Collector Toolkit: Richard Hudson, Eliot Moss, Amer Diwan, Christopher Weight</a>
+
+ <a
+ href="http://citeseer.nj.nec.com/seligmann95incremental.html">
+ Incremental Collection of Mature Objects: Richard Hudson, Eliot Moss</a>
+
diff --git a/web/passport b/web/passport
new file mode 100644
index 00000000000..fd402772293
--- /dev/null
+++ b/web/passport
@@ -0,0 +1,293 @@
+* Updates
+
+ <b>Sep 20, 2001:</b> Microsoft has just announced some changes
+ to passport that are rather interesting. This document
+ reflects the Passport system without taking into account the
+ new changes.
+
+ Read about it <a href="http://www.microsoft.com/presspass/features/2001/sep01/09-20passport.asp">here</a>.
+
+ For an analysis of security problems with passport, check <a
+ href="http://avirubin.com/passport.html">http://avirubin.com/passport.html</a>.
+ The bottom line is that you should not put any sensitive
+ information on passport.
+
+ I have received many comments from people, and I have updated
+ the page accordingly. From removing incorrect statements, to
+ fixing typos, to include mentions to other software pieces.
+
+ I also corrected my statement about IIS and a trojan horse, I
+ should read a more educated press in the future. My apologies
+ to Microsoft and its employees on this particular topic. IIS
+ did not have a trojan horse built in.
+
+* Microsoft Hailstorm and Passport
+
+ Microsoft Passport is a centralized database hosted by
+ Microsoft that enhances the consumer experience with the Web
+ by providing a single logon system that they can use across a
+ number of participant web sites.
+
+ As you might know by now from our extensive <a
+ href="faq.html">FAQ</a>, the Mono project has nothing to do
+ with Microsoft Hailstorm or <a
+ href="http://www.passport.com">Microsoft Passport.</a>
+
+ Still a lot of people have asked us our opinion on them.
+
+** Passport
+
+ Passport is important not because of it being a breakthrough
+ technologically speaking, but because the company is in a
+ position to drive most people toward being suscribers of it.
+
+ At the time of this writing passport is required to use the
+ free mail service <a href="http://www.hotmail.com">Hotmail</a>
+ to get customized support for the <a
+ href="http://www.msn.com">MSN portal</a>, <a
+ href="http://msdn.microsoft.com">Microsoft Developers
+ Network</a> and according to the original announcement from
+ Microsoft <a href="http://www.americanexpress.com">American
+ Express</a> and <a href="http://www.ebay.com">EBay</a> will be
+ adopting it.
+
+ There is already a <a
+ href="http://www.passport.com/Directory/Default.asp?PPDir=C&lc=1033">Large
+ list</a> of participating sites.
+
+ There are many current users of it and Microsoft will be
+ driving more users towards Passport as it <a
+ href="http://news.cnet.com/news/0-1003-200-6343275.html">integrates
+ it</a> in their upcoming release of Windows.
+
+ Microsoft has also <a
+ href="http://www.passport.com/Business/JoinPassportNetwork.asp?lc=1033">developed
+ a toolkit</a> to enable current web merchants to integrate
+ their services with passport.
+
+ To the end user, there is a clear benefit: they only have to
+ log into a single network and not remember multiple passwords
+ across sites on the internet. Companies that adopt passport
+ will have a competition advantage over those that dont.
+ Microsoft lists a list of <a
+ href="http://www.passport.com/Business/Default.asp?lc=1033">benefits</a>
+ to companies.
+
+
+** The problems of Passport
+
+ There are a number of concerns that different groups have over
+ Passport. Sometimes I have some, sometimes I do not. But
+ overall, consumers and businesses can have better solutions.
+
+ <ul>
+ * <b>Single Point of Failure:</b> As more services and
+ components depend on remote servers, functionality can
+ grind to a halt if there is a failure on the
+ centralized Passport system.
+
+ Such a failure was predicted, and we recently <a
+ href="http://news.cnet.com/news/0-1005-200-6473003.html">witnessed</a>
+ got a lot of people worried.
+
+ The outgage lasted for seven days. Think what this
+ could do to your business.
+
+ * <b>Trust:</b> Not everyone trusts Microsoft to keep
+ their information confidential. Concerns are not only
+ at the corporate level policy, but also the fact that
+ the source code for Microsoft products is not
+ available, means that trojans or worms could be built
+ into the products by malicious engineers.
+
+ * <b>Security:</b> With a centralized system like
+ Passport, imagine the repercussions of a malicious
+ hacker gaining access to the Passport database.
+ Personal information and credit card information about
+ almost everyone using a computer could be stored there.
+
+ Hackers have already <a
+ href="http://slashdot.org/articles/00/10/27/1147248.shtml">broken
+ into Microsoft</a> in the past. And the company was
+ unable to figure out for how long their systems had
+ been hacked.
+
+ Security holes have been found in <a
+ href="http://slashdot.org/articles/00/04/14/0619206.shtml">IIS
+ in the past.</a> If all the world's data is stored on
+ a central location, when a single security hole is
+ detected, it would allow an intruder to install a
+ backdoor within seconds into the corporate network
+ without people ever noticing.
+
+ Microsoft itself has been recently hit by worms,
+ imagine if all your business depended on a single
+ provider for providing all or your authentication
+ needs
+ </ul>
+
+ Microsoft might or might not realize this. The idea behind
+ Passport is indeed a good one (I can start to get rid of my
+ file that keeps track of the 30 logins and passwords or so
+ that I use across the various services on the net myself).
+
+** Alternatives to Microsoft Passport
+
+ An alternative to Microsoft Passport needs to take the above
+ problems into consideration. Any solution of the form `We
+ will just have a competing offering' will not work.
+
+ The system thus has to be:
+
+ <ul>
+ * <b>Distributed:</b> The entire authentication
+ system should not create an internet `blackout' in the
+ case of failure.
+
+ A distributed system using different software
+ platforms and different vendors would be more
+ resistent to an attack, as holes in a particular
+ implementation of the server software would not affect
+ every person at the same time.
+
+ A security hole attack might not even be relevant to
+ other software vendors software.
+
+ * <b>Allow for multiple registrars:</b> Users should
+ be able to choose a registrar (their banks, local
+ phone company, service provider, Swiss bank, or any
+ other entity they trust.
+
+ * <b>Mandate good security measures:</b> As a
+ principle, only Open Source software should be used
+ for servers in the registrar, and they should conform
+ to a standard set of tools and software that can be
+ examined by third parties.
+ </ul>
+
+ An implementation of this protocol could use the DNS or a
+ DNS-like setup to distribute the information of users with the
+ possibility of replicating and caching public information
+ about the user.
+
+ For instant messaging (another piece of the Hailstorm bit),
+ you want to use a non-centralized system like Sun's <a
+ href="http://www.jxta.org">JXTA</a>. Some people mailed me to
+ mention Jabber as a messaging platform and other people
+ pointed out to the <a
+ href="http://java.sun.com/products/jms/">Java Message
+ Service</a>. The JMS does support a number of very
+ interesting features that are worth researching.
+
+ It could also just use the user e-mail address as the `key' to
+ choose the registrar (msn.com, hotmail.com -> passport.com;
+ aol.com -> aol.passport.com; you get the idea).
+
+ The <a
+ href="http://www.soapware.org/xmlStorageSystem">xmlStorage</a>
+ idea from <a href="http://www.scripting.com">Dave Winer</a>
+ could be used to store the information.
+
+ A toolkit for various popular web servers could be provided,
+ authenticated and should be open sourced (for those of you who
+ think that a binary program would give more security and would
+ prevent people from tampering: you are wrong. You can always
+ use a proxy system that "behaves" like the binary, and passes
+ information back and forth from the real program, and snoops
+ in-transit information).
+
+ Good cryptographers need to be involved in this problem to
+ figure out the details and the possible insecure pieces of a
+ proposal like this.
+
+** Implementation: In short
+
+ To keep it short: <b>DNS, JXTA, xmlStorage.</b>
+
+
+** Deploying it
+
+ The implementation of such a system should be a pretty
+ straightforward task once security cryptographers have
+ designed such a beast.
+
+ The major problems are:
+
+ <ul>
+ * <b>People might just not care:</b> In a poll to US
+ citizens a couple of decades ago, it was found that
+ most people did not care about the rights they were
+ given by the Bill of Rights, which lead to a number of
+ laws to be passed in the US that eliminated most of
+ the rights people had.
+
+ * <b>The industry will move way too slow:</b>
+ Microsoft's implementation is out in the open now: it
+ is being deployed, and soon it will be insinuated to
+ many, many users. The industry needs to get together
+ soon if they care about this issue.
+
+ By the time the industry reacts, it might be too
+ late.
+ </ul>
+
+** Passport and Mono
+
+ The .NET class libraries include a Passport class that
+ applications might use to authenticate with Passport. Since
+ we do not have information at this point on the exact protocol
+ of Passport, it is not even feasible to implement it.
+
+ If at some point the information is disclosed, it could be
+ implemented.
+
+ If a competing system to Passport existed, we could probably
+ hide all the authentication information to use a number of
+ different passport-like systems.
+
+ If a user does not want to use Passport at all, he could
+ always turn it off (or completely remove the class from the
+ library). After all, this is free software.
+
+ Currently, we are too far from the point where this is a real
+ issue.
+
+** Passport and endangering Open Source.
+
+ A few people have said: `Mono will allow Passport to be
+ available for Linux and that is bad'. This is plain
+ misinformation.
+
+ Currently, you can obtain Passport for Linux from Microsoft
+ itself and deploy it today on your Web server. Mono does not
+ even enter the picture here. Go to passport.com and download
+ the toolkit and you will see with your own eyes that passport
+ is <B>already</b> available for Linux.
+
+** Disclaimer
+
+ This is just a group of personal thoughts of mine that I have
+ placed here because I get asked this question a lot lately.
+ The views of this page are not a statement from my employer
+ (Ximian, Inc).
+
+ This is not part of Mono. We are not trying to deal with this
+ problem.
+
+ Nat Friedman (Ximian's co-founder) has his own ideas on how a
+ competing system to Passport could be designed, but I will let
+ <a href="http://www.nat.org/">him</a> post his own story.
+
+** Other Passport Comments
+
+ An interesting study on the security of passport is available at: <a
+ href="http://avirubin.com/passport.html">http://avirubin.com/passport.html</a>
+
+** Other Alternatives
+
+ Some people have pointed out <a
+ href="http://www.xns.org">XNS</a>
+
+Send comments to me: Miguel de Icaza (<a
+ href="mailto:miguel@ximian.com">miguel@ximian.com</a>)
+
diff --git a/web/pending b/web/pending
new file mode 100644
index 00000000000..e243a10dedf
--- /dev/null
+++ b/web/pending
@@ -0,0 +1,14 @@
+** Microsoft and GNU and Linux.
+
+Q: Does this mean that Microsoft is better than Linux?
+
+A: Many of us are working on <a
+ href="http://www.gnu.org/philosophy/free-sw.html">free software<a>
+ and want to have an <a href="http://www.opensource.org">open
+ source</a> environment that we can change, modify, improve, learn
+ from, and share with others. Some of us also think that this will
+ lead on the long run to better software: more efficient, faster,
+ more robust and more.
+
+ We are willing to take good ideas from any source they come from.
+
diff --git a/web/pending-classes.in b/web/pending-classes.in
new file mode 100644
index 00000000000..1cdb5a4cb36
--- /dev/null
+++ b/web/pending-classes.in
@@ -0,0 +1,246 @@
+System.Object
+System.Exception
+System.ValueType
+System.Delegate
+System.MulticastDelegate
+System.Enum
+System.Activator
+System.ArgIterator
+System.__ComObject
+System.TypedReference
+System.Security.AllowPartiallyTrustedCallersAttribute
+System.Runtime.Serialization.Formatter
+System.Runtime.Serialization.FormatterConverter
+System.Runtime.Serialization.FormatterServices
+System.Runtime.Serialization.ObjectIDGenerator
+System.Runtime.Serialization.ObjectManager
+System.Reflection.ModuleResolveEventHandler
+System.Reflection.Pointer
+System.Globalization.CompareInfo
+System.Globalization.HebrewCalendar
+System.Globalization.HijriCalendar
+System.Globalization.JapaneseCalendar
+System.Globalization.KoreanCalendar
+System.Globalization.SortKey
+System.Globalization.StringInfo
+System.Globalization.TaiwanCalendar
+System.Globalization.TextElementEnumerator
+System.Globalization.TextInfo
+System.Globalization.ThaiBuddhistCalendar
+System.IO.IsolatedStorage.IsolatedStorageFile
+System.Reflection.Emit.MethodRental
+System.Runtime.CompilerServices.AccessedThroughPropertyAttribute
+System.Runtime.CompilerServices.CallConvCdecl
+System.Runtime.CompilerServices.CallConvStdcall
+System.Runtime.CompilerServices.CallConvThiscall
+System.Runtime.CompilerServices.CallConvFastcall
+System.Runtime.CompilerServices.CustomConstantAttribute
+System.Runtime.CompilerServices.DateTimeConstantAttribute
+System.Runtime.CompilerServices.DiscardableAttribute
+System.Runtime.CompilerServices.DecimalConstantAttribute
+System.Runtime.CompilerServices.CompilationRelaxationsAttribute
+System.Runtime.CompilerServices.CompilerGlobalScopeAttribute
+System.Runtime.CompilerServices.IDispatchConstantAttribute
+System.Runtime.CompilerServices.IsVolatile
+System.Runtime.CompilerServices.IUnknownConstantAttribute
+System.Runtime.CompilerServices.RequiredAttributeAttribute
+System.Runtime.InteropServices.ArrayWithOffset
+System.Runtime.InteropServices.DispIdAttribute
+System.Runtime.InteropServices.ClassInterfaceType
+System.Runtime.InteropServices.ClassInterfaceAttribute
+System.Runtime.InteropServices.ComVisibleAttribute
+System.Runtime.InteropServices.LCIDConversionAttribute
+System.Runtime.InteropServices.ComRegisterFunctionAttribute
+System.Runtime.InteropServices.ComUnregisterFunctionAttribute
+System.Runtime.InteropServices.ProgIdAttribute
+System.Runtime.InteropServices.ImportedFromTypeLibAttribute
+System.Runtime.InteropServices.IDispatchImplType
+System.Runtime.InteropServices.IDispatchImplAttribute
+System.Runtime.InteropServices.ComSourceInterfacesAttribute
+System.Runtime.InteropServices.ComConversionLossAttribute
+System.Runtime.InteropServices.TypeLibTypeFlags
+System.Runtime.InteropServices.TypeLibFuncFlags
+System.Runtime.InteropServices.TypeLibVarFlags
+System.Runtime.InteropServices.TypeLibTypeAttribute
+System.Runtime.InteropServices.TypeLibFuncAttribute
+System.Runtime.InteropServices.TypeLibVarAttribute
+System.Runtime.InteropServices.ComImportAttribute
+System.Runtime.InteropServices.PreserveSigAttribute
+System.Runtime.InteropServices.ComAliasNameAttribute
+System.Runtime.InteropServices.AutomationProxyAttribute
+System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute
+System.Runtime.InteropServices.CoClassAttribute
+System.Runtime.InteropServices.ComEventInterfaceAttribute
+System.Runtime.InteropServices.COMException
+System.Runtime.InteropServices.ComMemberType
+System.Runtime.InteropServices.CurrencyWrapper
+System.Runtime.InteropServices.DispatchWrapper
+System.Runtime.InteropServices.ErrorWrapper
+System.Runtime.InteropServices.ExtensibleClassFactory
+System.Runtime.InteropServices.HandleRef
+System.Runtime.InteropServices.InvalidComObjectException
+System.Runtime.InteropServices.InvalidOleVariantTypeException
+System.Runtime.InteropServices.TypeLibImporterFlags
+System.Runtime.InteropServices.ExporterEventKind
+System.Runtime.InteropServices.ITypeLibExporterNotifySink
+System.Runtime.InteropServices.ITypeLibConverter
+System.Runtime.InteropServices.MarshalDirectiveException
+System.Runtime.InteropServices.ObjectCreationDelegate
+System.Runtime.InteropServices.RuntimeEnvironment
+System.Runtime.InteropServices.RegistrationServices
+System.Runtime.InteropServices.SafeArrayRankMismatchException
+System.Runtime.InteropServices.SafeArrayTypeMismatchException
+System.Runtime.InteropServices.SEHException
+System.Runtime.InteropServices.TypeLibConverter
+System.Runtime.InteropServices.BIND_OPTS
+System.Runtime.InteropServices.UCOMIBindCtx
+System.Runtime.InteropServices.UCOMIConnectionPointContainer
+System.Runtime.InteropServices.UCOMIConnectionPoint
+System.Runtime.InteropServices.UCOMIEnumMoniker
+System.Runtime.InteropServices.CONNECTDATA
+System.Runtime.InteropServices.UCOMIEnumConnections
+System.Runtime.InteropServices.UCOMIEnumConnectionPoints
+System.Runtime.InteropServices.UCOMIEnumString
+System.Runtime.InteropServices.UCOMIEnumVARIANT
+System.Runtime.InteropServices.FILETIME
+System.Runtime.InteropServices.UCOMIMoniker
+System.Runtime.InteropServices.UCOMIPersistFile
+System.Runtime.InteropServices.UCOMIRunningObjectTable
+System.Runtime.InteropServices.STATSTG
+System.Runtime.InteropServices.UCOMIStream
+System.Runtime.InteropServices.DESCKIND
+System.Runtime.InteropServices.BINDPTR
+System.Runtime.InteropServices.UCOMITypeComp
+System.Runtime.InteropServices.TYPEKIND
+System.Runtime.InteropServices.TYPEFLAGS
+System.Runtime.InteropServices.IMPLTYPEFLAGS
+System.Runtime.InteropServices.TYPEATTR
+System.Runtime.InteropServices.FUNCDESC
+System.Runtime.InteropServices.IDLFLAG
+System.Runtime.InteropServices.IDLDESC
+System.Runtime.InteropServices.PARAMFLAG
+System.Runtime.InteropServices.PARAMDESC
+System.Runtime.InteropServices.TYPEDESC
+System.Runtime.InteropServices.ELEMDESC
+System.Runtime.InteropServices.VARDESC
+System.Runtime.InteropServices.DISPPARAMS
+System.Runtime.InteropServices.EXCEPINFO
+System.Runtime.InteropServices.FUNCKIND
+System.Runtime.InteropServices.INVOKEKIND
+System.Runtime.InteropServices.CALLCONV
+System.Runtime.InteropServices.FUNCFLAGS
+System.Runtime.InteropServices.VARFLAGS
+System.Runtime.InteropServices.UCOMITypeInfo
+System.Runtime.InteropServices.SYSKIND
+System.Runtime.InteropServices.LIBFLAGS
+System.Runtime.InteropServices.TYPELIBATTR
+System.Runtime.InteropServices.UCOMITypeLib
+System.Runtime.InteropServices.UnknownWrapper
+System.Runtime.Remoting.IObjectHandle
+System.Runtime.Remoting.IRemotingTypeInfo
+System.Runtime.Remoting.IChannelInfo
+System.Runtime.Remoting.IEnvoyInfo
+System.Runtime.Remoting.RemotingConfiguration
+System.Runtime.Remoting.TypeEntry
+System.Runtime.Remoting.ActivatedClientTypeEntry
+System.Runtime.Remoting.ActivatedServiceTypeEntry
+System.Runtime.Remoting.WellKnownClientTypeEntry
+System.Runtime.Remoting.WellKnownServiceTypeEntry
+System.Runtime.Remoting.RemotingException
+System.Runtime.Remoting.ServerException
+System.Runtime.Remoting.RemotingTimeoutException
+System.Runtime.Remoting.RemotingServices
+System.Runtime.Remoting.InternalRemotingServices
+System.Runtime.Remoting.SoapServices
+System.Runtime.Remoting.Activation.UrlAttribute
+System.Runtime.Remoting.Messaging.IMessageSink
+System.Runtime.Remoting.Messaging.AsyncResult
+System.Runtime.Remoting.Messaging.CallContext
+System.Runtime.Remoting.Messaging.ILogicalThreadAffinative
+System.Runtime.Remoting.Messaging.InternalMessageWrapper
+System.Runtime.Remoting.Messaging.IMethodCallMessage
+System.Runtime.Remoting.Messaging.MethodCallMessageWrapper
+System.Runtime.Remoting.Messaging.HeaderHandler
+System.Runtime.Remoting.Messaging.IMessageCtrl
+System.Runtime.Remoting.Messaging.IRemotingFormatter
+System.Runtime.Remoting.Messaging.ReturnMessage
+System.Runtime.Remoting.Messaging.MethodCall
+System.Runtime.Remoting.Messaging.ConstructionCall
+System.Runtime.Remoting.Messaging.MethodResponse
+System.Runtime.Remoting.Messaging.ConstructionResponse
+System.Runtime.Remoting.Messaging.MethodReturnMessageWrapper
+System.Runtime.Remoting.Messaging.OneWayAttribute
+System.Runtime.Remoting.Messaging.MessageSurrogateFilter
+System.Runtime.Remoting.Messaging.RemotingSurrogateSelector
+System.Runtime.Remoting.Contexts.CrossContextDelegate
+System.Runtime.Remoting.Contexts.ContextProperty
+System.Runtime.Remoting.Contexts.IContextPropertyActivator
+System.Runtime.Remoting.Contexts.IContributeClientContextSink
+System.Runtime.Remoting.Contexts.IContributeDynamicSink
+System.Runtime.Remoting.Contexts.IContributeEnvoySink
+System.Runtime.Remoting.Contexts.IContributeObjectSink
+System.Runtime.Remoting.Contexts.IContributeServerContextSink
+System.Runtime.Serialization.Formatters.InternalRM
+System.Runtime.Serialization.Formatters.InternalST
+System.Runtime.Serialization.Formatters.SoapMessage
+System.Runtime.Serialization.Formatters.SoapFault
+System.Runtime.Serialization.Formatters.ServerFault
+System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+System.Security.Cryptography.CryptoConfig
+System.Security.Cryptography.KeyedHashAlgorithm
+System.Security.Cryptography.HMACSHA1
+System.Security.Cryptography.MACTripleDES
+System.Security.Cryptography.MaskGenerationMethod
+System.Security.Cryptography.PasswordDeriveBytes
+System.Security.Cryptography.PKCS1MaskGenerationMethod
+System.Security.Cryptography.RC2
+System.Security.Cryptography.RC2CryptoServiceProvider
+System.Security.Cryptography.RSACryptoServiceProvider
+System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter
+System.Security.Cryptography.RSAOAEPKeyExchangeFormatter
+System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter
+System.Security.Cryptography.RSAPKCS1KeyExchangeFormatter
+System.Security.Cryptography.RSAPKCS1SignatureDeformatter
+System.Security.Cryptography.RSAPKCS1SignatureFormatter
+System.Security.Cryptography.SHA1Managed
+System.Security.Cryptography.TripleDES
+System.Security.Cryptography.TripleDESCryptoServiceProvider
+System.Security.Permissions.EnvironmentPermission
+System.Security.Permissions.FileDialogPermission
+System.Security.Permissions.IsolatedStorageFilePermission
+System.Security.Permissions.PrincipalPermissionAttribute
+System.Security.Permissions.SecurityPermissionAttribute
+System.Security.Permissions.PublisherIdentityPermissionAttribute
+System.Security.Permissions.PublisherIdentityPermission
+System.Security.Permissions.ReflectionPermission
+System.Security.Permissions.RegistryPermission
+System.Security.Permissions.PrincipalPermission
+System.Security.Permissions.SiteIdentityPermission
+System.Security.Permissions.StrongNameIdentityPermission
+System.Security.Permissions.StrongNamePublicKeyBlob
+System.Security.Permissions.UIPermission
+System.Security.Permissions.UrlIdentityPermission
+System.Security.Permissions.ZoneIdentityPermission
+System.Security.Policy.ApplicationDirectory
+System.Security.Policy.ApplicationDirectoryMembershipCondition
+System.Security.Policy.FirstMatchCodeGroup
+System.Security.Policy.Hash
+System.Security.Policy.HashMembershipCondition
+System.Security.Policy.NetCodeGroup
+System.Security.Policy.PermissionRequestEvidence
+System.Security.Policy.Publisher
+System.Security.Policy.PublisherMembershipCondition
+System.Security.Policy.Site
+System.Security.Policy.SiteMembershipCondition
+System.Security.Policy.StrongName
+System.Security.Policy.StrongNameMembershipCondition
+System.Security.Policy.UnionCodeGroup
+System.Security.Policy.Url
+System.Security.Policy.UrlMembershipCondition
+System.Security.Policy.Zone
+System.Security.Policy.ZoneMembershipCondition
+System.Security.Principal.WindowsIdentity
+System.Security.Principal.WindowsImpersonationContext
+System.Security.Principal.WindowsPrincipal
+System.Threading.CompressedStack
+
diff --git a/web/plans b/web/plans
new file mode 100755
index 00000000000..db6f6dde7c8
--- /dev/null
+++ b/web/plans
@@ -0,0 +1,15 @@
+* Plans
+
+ Here we are tracking some plans to particular pieces of
+ technology that are part of Mono.
+
+ This is just a repository of information that is handy for
+ contributors.
+
+ Currently you can read our plans for <a
+ href="ado-net.html">ADO.NET</a>, <a
+ href="asp-net">ASP.NET</a>, <a href="java.html">Java</a> and
+ <a href="winforms.html">WinForms</a>.
+
+
+
diff --git a/web/porting b/web/porting
new file mode 100644
index 00000000000..a09ab69deaa
--- /dev/null
+++ b/web/porting
@@ -0,0 +1,63 @@
+* How to port Mono to your preferred architecture
+
+** Endian, 64 bits and unaligned access issues
+
+ The first thing to do is to check that the metadata handling
+ library works on your target processor. You may use the disassembler
+ on simple programs and check that you get sensible results
+ (assuming it compiles at all on your system:-).
+
+ The main issue is to write macros that read unaligned
+ little endian shorts/ints/longs/float/doubles: look into
+ mono/metadata/endian.h. There may be other spots in the code that are
+ unsafe at reading/writing to some datatypes that require special
+ alignment, but there should be few such issues and they need to be fixed.
+
+ Once this stuff is sorted out, you should be able to run the interpreter
+ on simple programs that don't require delegates, P/Invoke functions etc..
+
+** Generating assembly bytecodes for the target processor
+
+ Next, you need to provide the support code for generating assembly bytecode
+ for your target platform (in mono/arch/{ppc,sparc,alpha,*}).
+ The code should be more or less like the code in x86-codegen.h:
+ macros that produce fast in-line code. You don't need to provide
+ code to create every possible code, at first, just the code to
+ create trampolines and execute them is fine (you'll need to research
+ how the call convention works on your platform): that would be, for
+ example, the prolog and epilog code in a function, code to pass function
+ parameters and deal with the return value and so on.
+
+ libffi in gcc or the xptcall sources in mozilla may be helpful to
+ understand how the calling convention works, if you can't find a specification.
+ You'd need a processor manual to know how to create the assembly binary data.
+ This requires a lot of reading if you're not familiar with the assembly for your
+ target platform. Manuals for many processors are available as PDF files on the
+ web site of the respective vendors. Note that some processors require you to
+ flush the I-cache before executing the code: have a look at how the same thing is
+ done in GNU lightning.
+
+** Getting the interpreter to work
+
+ Once you can generate binary code, you can start working on a
+ mono_create_trampoline() function for your platform: this function will receive
+ a MonoMethod that describes the arguments and the return type of a C function
+ and will create the code to call such function. When this function is complete
+ you'll be able to run more sample programs, that use System.IO, P/Invoke
+ functions etc.
+
+ To support delegates you'll need to write a mono_create_method_pointer()
+ function that creates a native function: this can be used to call the
+ method using the runtime's calling convention (it's basically the reverse
+ of mono_create_trampoline()).
+
+** The final step: porting the JIT
+
+ At this point you'd need to have a more complete code generation header file
+ and you can start writing the machine description file for the monoburg
+ system. This code (jit/tesjit.c) will require some machine specific tweaks,
+ but hopefully all you have to do is create the grammar that emit assembly
+ code from the IR tree. Work is at the early stages also for x86 on this stuff
+ as we are still testing various solutions: you'd want to read about burg-like
+ code-generator generators (the LCC book is a good starting point).
+
diff --git a/web/rationale b/web/rationale
new file mode 100644
index 00000000000..d63cf225a59
--- /dev/null
+++ b/web/rationale
@@ -0,0 +1,173 @@
+
+* The Mono Project
+
+** Background.
+
+ The GNOME project goal was to bring missing technologies to
+ Unix and make it competitive in the current market place for
+ desktop applications. We also realized early on that language
+ independence was important, and that is why GNOME APIs were
+ coded using a standard that allowed the APIs to be easily
+ wrapped for other languages. Our APIs are available to most
+ programming languages on Unix (Perl, Python, Scheme, C++,
+ Objective-C, Ada).
+
+ Later on we decided to use better methods for encapsulating
+ our APIs, and we started to use CORBA to define interfaces to
+ components. We complemented it with policy and a set of
+ standard GNOME interfaces for easily creating reusable,
+ language independent components, controls and compound
+ documents. This technology is known as <a
+ href="http://developer.ximian.com/tech/bonobo.html">Bonobo</a>.
+ Interfaces to Bonobo exist for C, Perl, Python, and
+ Java.
+
+ CORBA is good when you define coarse interfaces, and most
+ Bonobo interfaces are coarse. The only problem is that
+ Bonobo/CORBA interfaces are not good for small interfaces.
+ For example, an XML parsing Bonobo/CORBA component would be
+ inefficient compared to a C API.
+
+** Another explanation
+
+ I recently explained our motivations to Dave Winer, and he posted
+ it <a
+ href="http://scriptingnews.userland.com/stories/storyReader$1275">here</a>
+
+** Microsoft's .NET
+
+ The Microsoft .NET initiative is confusing because it is a
+ company wide effort that ranges from development tools to end
+ user applications. .NET is a branding formative that
+ has been applied to:
+
+ <ul>
+ * The .NET development platform, a new platform for
+ writing software.
+
+ * Web services.
+
+ * Microsoft Server Applications.
+
+ * New tools that use the new development platform.
+
+ * Hailstorm, the Passport centralized single-signon
+ system that is being integrated into Windows XP.
+
+ </ul>
+
+ Mono is an implementation of the .NET development platform.
+
+** The Common Language Infrastructure platform.
+
+ Microsoft has created a new development platform. The
+ highlights of this new development platform are:
+
+ <ul>
+ * A runtime environment that provides garbage
+ collection, threading and a virtual machine
+ specification (The Virtual Execution System, VES)
+
+ * A comprehensive class library.
+
+ * A new language, C#. Very similar to Java, C#
+ allows programmers to use all the features available
+ on the .NET runtime.
+
+ * A language specification that compilers can
+ follow if they want to generate classes and code
+ that can interoperate with other programming
+ languages (The Common Language Specification: CLS)
+ </ul>
+
+ The Common Language Infrastructure platform is similar to the
+ goals we had in GNOME of giving language independence to
+ programmers. It is more mature, documented, larger in scope,
+ and has a consistent design.
+
+ Any API that is written using a CLS provider language can be
+ used by any language that is a CLS consumer. Compilers
+ generate code in a format called Common Intermediate Language
+ (CIL) which is an intermediate representation of a compiled
+ program and is easy to compile to native code or compiled
+ using Just-in-Time (JIT) engines. The restrictions placed by
+ the runtime on the CIL byte codes ensures that it is possible
+ to do a good job at optimizing the code in a JIT compiler.
+
+ There is not really a lot of innovation in this platform: we
+ have seen all of these concepts before, and we are all
+ familiar with how these things work.
+
+ What makes the Common Language Infrastructure development
+ platform interesting is that it is a good mix of technologies
+ that have been nicely integrated.
+
+ The .NET development platform is essentially a new foundation
+ for program development that gives Microsoft a room to grow
+ for the coming years.
+
+** ECMA standards.
+
+ Microsoft has submitted the
+ specifications of C#, the runtime, the metadata and the
+ other various bits of the .NET development platform to the
+ <a href="http://www.ecma.ch">ECMA</a> for standarization.
+
+ You can get a copy of the specifications submitted to ECMA
+ from: <a href="http://www.dotnetexperts.com/ecma">http://www.dotnetexperts.com/ecma</a>
+
+** Mono: an Open Source Common Language Infrastructure implementation.
+
+ Ximian has begun work on Mono, a project that aims to bring
+ the Common Language Infrastructure platform to free systems.
+
+ When the GNU project was launched, they picked the best
+ operating system that was available out there, and they
+ began to clone it: Unix.
+
+ The .NET development platform is a very rich, powerful, and
+ well designed platform that would help improve the free
+ software development platform. Just like the GNU project
+ began to clone Unix sixteen years ago, we will be cloning the
+ .NET development platform because it is a great platform to
+ build on.
+
+** What makes up Mono?
+
+ There are various pieces that will make up Mono:
+
+ <ul>
+ * A C# compiler.
+
+ * The Virtual Execution System: that will have the
+ Just-in-Time compiler, garbage collector, loader,
+ threading engine.
+
+ A byte code interpreter will be provided for quickly
+ porting Mono to new systems and debugging the JIT
+ purposes, but it is not intended to be the ideal
+ execution environment.
+
+ * An implemenation of the .NET class library.
+
+ * Visual development tools.
+
+ * A CIL GCC frontend.
+ </ul>
+
+** Why use GNOME components?
+
+ GNOME is an umbrella project that consists of infrastructural
+ components (GUI toolkit, XML libraries, CORBA implementation,
+ printing architecture, imaging system), a desktop environment,
+ and productivity applications.
+
+ The GNOME infrastructural components can be used to quickly
+ implement various pieces of the class libraries without reinventing
+ the wheel, and since all those components are licensed under
+ the terms of the GNU LGPL it is a perfect fit.
+
+ Libart will be used to implement the Drawing.2D API; Gtk+ and
+ the GNOME libraries will be used to implement the WinForms
+ API and of course Glib and libxml will be used in various
+ places. \ No newline at end of file
diff --git a/web/release-notes/mono-0.3 b/web/release-notes/mono-0.3
new file mode 100644
index 00000000000..4976037b957
--- /dev/null
+++ b/web/release-notes/mono-0.3
@@ -0,0 +1,46 @@
+To: mono-list@ximian.com, mono-announce-list@ximian.com
+Subject: July 12 snapshots.
+FCC: ~/Mail/outbox.txt
+X-Windows: Sometimes you fill a vacuum and it still sucks.
+--text follows this line--
+
+Hey!
+
+ July 12 snapshots of class libraries, the compiler and the mono
+runtime are available.
+
+New on this release:
+
+ * Runtime (module: mono)
+
+ The beginning of a simple interpreter that Paolo started
+ workign on (can run really simple .NET programs).
+
+ Disassembler copes with more elements of the binary format and
+ more tokens are decoded. Paolo is working now on moving some
+ of these to the metadata library.
+
+ More tables are dumped.
+
+ * Class libraries (module: mcs/class)
+
+ Many new more classes are in from Joe, Vladimir, Jeff, Sean
+ and yours truly.
+
+ Sean fixed the build process, and it is now possible to
+ compile with a single command the assemblies. We will be
+ revisiting this mechanism in the future to compile per-OS
+ assemblies (ie, Unix, Windows, MacOS, etc).
+
+ * Compiler (module mcs/mcs)
+
+ Not much done this week, just a few fixes here and there, and
+ more work to make it easy to compiler.
+
+ * Documentation (module: mono/doc)
+
+ All the changes to the web site are there for your browsing
+ pleasure. We still need to integrate the status system in
+ there.
+
+Miguel.
diff --git a/web/release-notes/mono-0.4 b/web/release-notes/mono-0.4
new file mode 100644
index 00000000000..1d7e1cea5f1
--- /dev/null
+++ b/web/release-notes/mono-0.4
@@ -0,0 +1,43 @@
+To: mono-list@ximian.com
+Subject: Sunday snapshot available.
+Gcc: mail.2001-07
+--text follows this line--
+
+Hey guys,
+
+ I promise I will not be doing these so often once we have the CVS
+server up. In the meantime:
+
+ * MCS
+
+ Sean got the classes to compile in a single go. You
+ will need CygWin (www.cygwin.org) to compile though
+ (GNU make and stuff is required).
+
+ System.Xml.XmlReader contribution from Jason
+ (WOOHHOO!!). It also contains a nice test-suite for
+ his functions, and in his new code bit, his
+ implementation is faster than Microsoft's
+
+ We now ship `jay' as part of the distribution to allow
+ you to compile the compiler with the same `make'
+ command. Small fixes to the parser as well were
+ introduced.
+
+ * Mono 0.4
+
+ Paolo's interpreter supports call instructions and has
+ the test suite program that he posted about.
+
+
+ All documentation ships now in the mono-0.4.tar.gz
+
+Notes:
+
+ As usual, MCS is targeted to be compiled on a Windows machine
+ (you will need Cygwin).
+
+ Mono is targeted to be compiled on a Unix machine or a Windows
+ machine running Cygwin.
+
+Miguel. \ No newline at end of file
diff --git a/web/resources b/web/resources
new file mode 100644
index 00000000000..7efc6d8909d
--- /dev/null
+++ b/web/resources
@@ -0,0 +1,188 @@
+
+* Resources
+
+ There are a number of resources available for those of you who
+ want to contribute to the Mono project. Here are a few links.
+
+ If you want to send suggestions for links, address them to <a
+ mailto="web-mono@ximian.com">web-mono@ximian.com</a>.
+
+** Microsoft .NET
+
+ The <a href="http://msdn.microsoft.com/net">Microsoft.NET site.</a>
+
+ The Microsoft .NET Framework 1.0 can be downloaded <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>
+
+ New methods that are not documented in 1.0, are documented <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/framewrkaddend.asp">here</a>
+
+** IRC
+
+ Various Mono contributors get together on channel #mono on
+ irc.gnome.org
+
+** Mono related sites.
+
+ Sergey's web page on Mono resources:
+
+ <a href="http://mono.eurosoft.od.ua">http://mono.eurosoft.od.ua</a>
+
+ Got Dot Net:
+
+ <a href="http://www.gotdotnet.com">Got Dot Net</a>
+
+ MonoMail:
+
+ <a href="http://sourceforge.net/projects/monomail/">http://sourceforge.net/projects/monomail/</a>
+
+ Zip classes:
+
+ Mike's port to .NET: <a
+ href="http://www.icsharpcode.net/OpenSource/NZipLib/default.asp">NZipLib</a>
+
+ .NET Security:
+
+ A nice overview paper on the <a
+ href="http://www.foundstone.com/pdf/dotnet-security-framework.pdf">.NET
+ security architecture</a>.
+
+** 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.ch/ecma1/STAND/ecma-334.htm">C# Language Specification</a>
+ * <a href="http://www.ecma.ch/ecma1/STAND/ecma-335.htm">Common Language Infrastructure</a>
+ </ul>
+
+
+ Older copies of the standard are available here:
+
+ <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>
+
+ These contain specifications for the assembler, the metadata,
+ byte codes supported by the CLI virtual machine, the C#
+ language and the core class libraries.
+
+ For details on the .NET class libraries, you can
+ visit the Microsoft's Developer Network:
+
+ <ul>
+ * <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/cpref_start.asp">.NET Framework Class Library</a>
+ </ul>
+
+ You can also get this information if you install the Beta2
+ release of the .NET Framework.
+
+** Discussion Groups.
+
+ <ul>
+
+ * <a href="http://www.oreillynet.com">O'Reilly
+ Network</a> has a <a
+ href="http://www.oreillynet.com/dotnet">section devoted to
+ .NET</a>
+ * <a
+ href="http://msdn.microsoft.com/newsgroups">MSDN</a> also
+ lists various newsgroups related to .NET</ul>
+ </ul>
+
+** Other .NET related projects
+
+ There are a number of related projects to Mono:
+
+ <ul>
+ * <a
+ href="http://www.icsharpcode.net/OpenSource/SD/default.asp">Sharp
+ Develop:</a> an IDE for the C# language written in C#.
+
+ * <a
+ href="http://www.improve-technologies.com/alpha/esharp/">Eclipse
+ Plugin for C#</a>
+
+ * <a
+ href="http://janet-js.sourceforge.net/">Janet:</a>
+ an implemention of ECMAScript (the standarized
+ version of JavaScript) in C#
+
+ * <a
+ href="http://xmarks.sourceforge.net/doc.html">XMarks DOC.NET:</a> For
+ creating online documentation you can browse for your own classes.
+
+ * <a href="http://nunit.sourceforge.net">NUnit:</a> A
+ testing framework for .NET classes.
+
+ * <a href="http://www.kaffe.org">Kaffe:</a> A popular
+ Free Software JIT engine for Java.
+
+ * <a href="http://www.intel.com/research/mrl/orp">ORP:</a> A research
+ JIT/VM/GC system from Intel.
+
+ * C# bindings for OpenGL and SDL are available here: <a
+ href="http://csgl.sourceforge.net">http://csgl.sourceforge.net</a>
+
+ * <a
+ href="http://www.southern-storm.com.au/portable_net.html">Portable.NET:</a>
+ Another implementation of the CLI and C# compiler.
+
+ </ul>
+
+** GNOME Documentation
+
+ Documnetation on GNOME, and the GNOME APIs is available from
+ the <a href="http://developer.gnome.org">developer</a> site at
+ GNOME:
+
+ <ul>
+ * <a href="http://developer.gnome.org/doc/API/">GNOME
+ API documentation</a>
+
+ * <a href="http://developer.gnome.org/doc/books">GNOME
+ Online books</a>
+
+ * <A
+ href="http://developer.gnome.org/arch/">Architecture Overview</a>
+ </ul>
+
+** Assembly Language Manuals online
+
+ <ul>
+ * <a href="http://www.agner.org/assem/#optimize">
+ Pentium optimization tutorial</a> by Agner Fog
+
+ * <a href="http://webster.cs.ucr.edu/">
+ Art of Assembly</a> (x86 only)
+
+ * Documentation for various CPUs
+ (<a href="http://www.mit.edu/afs/sipb/contrib/doc/specs/ic/cpu/">
+ x86, IA64, MIPS, ARM, Alpha</a>)
+
+ * <a href="http://www.heyrick.co.uk/assembler/">
+ ARM Assembler</a> tutorial
+
+ * PowerPC
+ <a href="http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF7785256996007558C6">
+ Compiler Writer's Guide</a>
+
+ * <a href="http://www.lightsoft.co.uk/Fantasm/Beginners/begin1.html">
+ Beginners Guide to PowerPC Assembler</a>
+ </ul>
+
+** Win32
+
+ <ul>
+ * Win32 <a href="http://www.jorgon.freeserve.co.uk/ExceptFrame.htm">
+ Structured Exception Handling (SEH)</a> internals (x86 specific)
+ </ul>
diff --git a/web/resources-pending b/web/resources-pending
new file mode 100644
index 00000000000..fd9b9073d64
--- /dev/null
+++ b/web/resources-pending
@@ -0,0 +1,30 @@
+** MacOS Documentation
+
+** Assembly Language Manuals online
+ Intel
+ MIPS
+ SPARC
+
+** Microsoft
+ msdn.microsoft.com/net
+ Research.microsoft.com
+
+** Related Technologies
+
+ <ul>
+
+ * The CLI allows people to create Web Services using the SOAP
+ protocol. SOAP is based on XML, XML schemas an the HTTP
+ protocol.
+ <ul>
+ * XML specification.
+ * XML Namespaces.
+ * XML Schemas.
+ * SOAP Specification.
+ </ul>
+ </ul>
+
+** Compiler Information
+ GCC
+ GCC Sample front-end tutorial
+
diff --git a/web/roadmap b/web/roadmap
new file mode 100644
index 00000000000..6cdfa1366a8
--- /dev/null
+++ b/web/roadmap
@@ -0,0 +1,12 @@
+* Roadmap
+
+ We are working on the following three projects at Ximian:
+
+ The C# Compiler (mcs/mcs)
+
+ A .NET compatible Class Library (mcs/class)
+
+ The JIT/interpreter (mono)
+
+
+ \ No newline at end of file
diff --git a/web/runtime b/web/runtime
new file mode 100644
index 00000000000..908600e8f84
--- /dev/null
+++ b/web/runtime
@@ -0,0 +1,195 @@
+* The Mono runtime
+
+ The Mono runtime implements a JIT engine for the CIL virtual
+ machine (as well as a byte code interpreter, this is to
+ quickly port it to new systems), the class loader, the garbage
+ collector, threading system and metadata access libraries.
+
+ We currently have two runtimes:
+
+ <ul>
+ * <b>mono:</b> The Just In Time compiler implemented
+ using a BURS instruction selector. We only support
+ x86 machines in the JIT engine at this point.
+
+ * <b>mint:</b> The Mono interpreter. This is an
+ easy-to-port runtime engine.
+ </ul>
+
+ Currently we are using the Bohem conservative garbage
+ collector, but we working on incorporating the ORP GC engine.
+
+** Executing MSIL/CIL images
+
+ The code will load an executable and map the references to
+ external assemblies to our own version of the assemblies on
+ Linux.
+
+ Our roadmap looks like this, this has been updated as of
+ <b>Dec 18, 2001</b>:
+
+ <ul>
+
+ * Milestone 1: <b>Done</b> Fully read and parse all CIL byte-codes
+ and metadata tokens (ie, a disassembler).
+
+ * Milestone 2: <b>Done</b> Complete an interpreter for CIL byte
+ codes. This interpreter can be used temporarly to
+ run CIL byte code on a system where no JIT is
+ available.
+
+ * Milestone 3: <b>Done</b>Define an <i>lburg</i>-like
+ instruction selector for the JITer for Intel.
+
+ * Milestone 4: <b>Done</b> Implement JITer. This is where our
+ current efforts are focused on, the JITer currently runs
+ all of the code we have tested on it. The major limitation
+ is that our class libraries are not complete, and hence not
+ every application can be ran.
+
+ * Milestone 5: Port of the JITer to non IA32 systems.
+ </ul>
+
+ A setup similar to the Kaffe JIT engine will be used to
+ layout the code to support non-IA32 architectures. Our work
+ will be focused on getting a IA32 version running first.
+
+ The JIT engine works on Linux and Win32, although you
+ will need to install the CygWin32 development tools to get a
+ Unix-like compilation environment (mostly we use GNU make in
+ a few of the makefiles).
+
+** JIT Engine (<b>updated, April 21, 2002</b>)
+
+ The JIT engine uses a code-generator generator approach for
+ compilation. Given the properties of CIL byte codes, we can
+ take full advantage of a real instruction selector for our
+ code generator.
+
+ The JIT engine implements a number of optimizations:
+
+ <ul>
+ * Opcode cost estimates (our architecture allows
+ us to generate different code paths depending
+ on the target CPU dynamically).
+
+ * Inlining.
+
+ * Constant folding.
+
+ Although compilers typically do
+ constant folding, the combination of inlining with
+ constant folding gives some very good results.
+ </ul>
+
+ There are a couple of books that deal with this technique: "A
+ Retargetable C Compiler" and "Advanced Compiler Design and
+ Implementation" are good references. You can also get a
+ technical description of <a
+ href="http://research.microsoft.com/copyright/accept.asp?path=http://www.research.microsoft.com/~drh/pubs/iburg.pdf&pub=ACM">lbrug</a>.
+
+ A few papers that describe the instruction selector:
+
+ <ul>
+ * <a href="http://research.microsoft.com/copyright/accept.asp?path=http://www.research.microsoft.com/~drh/pubs/interface.pdf&pub=wiley">A code generation interface for ANSI C</a>
+
+
+ * <a href="http://research.microsoft.com/copyright/accept.asp?path=http://www.research.microsoft.com/~drh/pubs/iburg.pdf&pub=ACM">Engineering efficient code generators using tree matching and dynamic programming.</a>
+
+ </ul>
+
+** Future plans
+
+ We are evaluating the future directions for the JIT engine:
+ both from our needs (optimizations like inlining, better register allocation,
+ instruction scheduling, and porting to other CPUs).
+
+ We have not yet decided how we will evolve the JIT engine. We
+ might just upgrade our current architecture, and provide optimizations as
+ an extra layer.
+
+** Garbage Collection
+
+ Currently we are using the Boehm conservative GC. Although our plans
+ are to move to the Intel ORP GC engine, our plans on a next generation
+ dual-JIT engine have to be taken into account.
+
+ We will be using the Intel ORP GC engine as it provides a precise
+ garbage collector engine, similar to what is available on the
+ .NET environment.
+
+ Although using a conservative garbage collector like Bohem's
+ would work, all the type information is available at runtime,
+ so we can actually implement a better collector than a
+ conservative collector.
+
+ <ul>
+ * Garbage collection list and FAQ:<br>
+ <a href="http://www.iecc.com/gclist/">http://www.iecc.com/gclist/</a>
+
+ * "GC points in a Threaded Environment":<br>
+ <a href="http://research.sun.com/techrep/1998/abstract-70.html">
+ http://research.sun.com/techrep/1998/abstract-70.html</a>
+
+ * "A Generational Mostly-concurrent Garbage Collector":
+ <a href="http://research.sun.com/techrep/2000/abstract-88.html">
+ http://research.sun.com/techrep/2000/abstract-88.html</a>
+
+ * Details on The Microsoft .NET Garbage Collection Implementation:<br>
+ <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI.asp</a>
+ <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI2.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmag00/html/GCI2.asp</a>
+ </ul>
+
+** IO and threading
+
+ The ECMA runtime and the .NET runtime assume an IO model and a
+ threading model that is very similar to the Win32 API.
+
+ Dick Porter has been working on the Mono abstraction layer
+ that allows our runtime to execute code that depend on this
+ behaviour.
+
+** Useful links
+
+ Paolo Molaro found a few interesting links:
+
+ <ul>
+ * On compilation of stack-based languages:<br>
+ <a href="http://www.complang.tuwien.ac.at/projects/rafts.html">
+ http://www.complang.tuwien.ac.at/projects/rafts.html</a>
+
+ * A paper on fast JIT compilation of a stack-based language:<br>
+ <a href="http://www.research.microsoft.com/~cwfraser/pldi99codegen.pdf">
+ http://www.research.microsoft.com/~cwfraser/pldi99codegen.pdf</a>
+
+ * Vmgen generates much of the code for efficient virtual machine (VM)
+ interpreters from simple descriptions of the VM instructions:<br>
+ <a href="http://www.complang.tuwien.ac.at/anton/vmgen/">
+ http://www.complang.tuwien.ac.at/anton/vmgen</a>
+ </ul>
+
+** PInvoke
+
+ PInvoke is the mechanism we are using to wrap Unix API calls
+ as well as talking to system libraries.
+
+ Initially we used libffi, but it was fairly slow, so we have
+ reused parts of the JIT work to create efficient PInvoke trampolines.
+
+** Remoting
+
+ Mono has support for remoting and proxy objects, just like
+ .NET does. The runtime provides these facilities.
+
+** Porting
+
+ If you are interested in porting the Mono runtime to other
+ platforms, you might find the pre-compiled <a
+ href="archive/mono-tests.tar.gz">Mono regression test
+ suite</a> useful to debug your implementation.
+
+* COM and XPCOM
+
+ We plan on adding support for XPCOM on Unix and COM on Microsoft
+ Windows later in our development process.
+
diff --git a/web/status b/web/status
new file mode 100644
index 00000000000..f175d7b0890
--- /dev/null
+++ b/web/status
@@ -0,0 +1,40 @@
+* Project Status
+
+
+ Pieces of Mono that have been implemented:
+
+ <ul>
+ * C# compiler: The C# compiler is mostly complete, a
+ few features are still missing (for a list, check the
+ <a href="c-sharp.html">C# compiler</a> web page.
+
+ * The Mono JIT engine (<b>mono</b>. The JIT engine is
+ the real
+ virtual machine that we support. It is
+ functionaly currently, and we are improving its speed,
+ and making it feature complete.
+
+ * A CIL bytecode interpreter (<b>mint</b>). This
+ currently can be used to run most .NET programs
+ (modulo the fact that our class libraries are not
+ complete enough).
+
+ <b>mint</b> can currently run the Mono C# compiler and
+ the compiler generates valid code.
+
+ We use <b>mint</b> as a reference implementation of
+ the runtime environment and to quickly support
+ non-Intel platforms.
+
+ * Metadata library: Can currently parse
+ and load information from .NET modules (executables
+ and DLL files).
+
+ * Disassembler: Can disassemble .NET modules. Still
+ lacking exception handling as well as useful debugging
+ tools (hex dumping, token dumping).
+
+ * Class Libraries: You can check the current status in the
+ <a href="class-status.html">Class Status page</a>.
+ </ul>
+
diff --git a/web/team b/web/team
new file mode 100644
index 00000000000..eff7bc9d3d5
--- /dev/null
+++ b/web/team
@@ -0,0 +1,2 @@
+* The MonoNet Team
+
diff --git a/web/testing b/web/testing
new file mode 100644
index 00000000000..f97902ec306
--- /dev/null
+++ b/web/testing
@@ -0,0 +1,46 @@
+* Testing
+
+ Testing is an important part of the Mono project: every one of its
+ three major components has a test suite tailored for its needs. This
+ is very helpful, because in the course of developing the software it
+ is very common to introduce bugs in existing code. A test suite
+ helps us fix the bugs as soon as they are introduced.
+
+** Class Library Tests
+
+ All classes in Mono libraries should have comprehensive unit test
+ suites to go with them. Unit testing is a software engineering
+ methodology that makes it easier to build correct code. Every
+ method in every class should have a set of tests to verify
+ that they work correctly. Mono also needs a testing framework
+ to make it easy to write and run lots of tests.
+
+ Try <a href="http://nunit.sourceforge.net">NUnit</a>
+
+ Why do unit testing? It becomes simple to run automated tests
+ for the whole library. Unit tests are a safety net - you can
+ change part of the code and verify that you haven't broken
+ anything. Ideally, tests are written before the actual library
+ code itself. And every time a bug is discovered, a test should
+ be written to demonstrate the bug and its fix. Then, if
+ you ever reintroduce the bug, you will know immediately. For
+ more info, read <a
+ href="http://junit.sourceforge.net/doc/testinfected/testing.htm">
+ JUnit Test Infected: Programmers Love Writing Tests</a>.
+
+
+** Getting Started
+
+ We welcome all contributions to the Class Libary Test Suite.
+
+ There is information to help you get started in CVS at
+ mcs/class/doc/NUnitGuidelines. Once you have written your test, please
+ post it to <a href="mailing-lists.html">mono-list</a>.
+
+ Someone will make sure to add the file or apply the patch as
+ appropriate. If you plan to be an on-going contributor and
+ would like to get cvs account, email <a href="mailto:miguel@ximian.com">miguel</a>.
+
+ Normally, after you send a couple of well-written new files
+ and/or patches to the list, you will be given cvs access.
+
diff --git a/web/thanks b/web/thanks
new file mode 100644
index 00000000000..5f2df36f9cd
--- /dev/null
+++ b/web/thanks
@@ -0,0 +1,6 @@
+* Thanks
+
+ We would like to thank Tim O'Reilly, Brian Jepson and Nathan
+ Torkington for their help.
+
+ Dave Winer for provided interesting comments and a to read.
diff --git a/web/todo b/web/todo
new file mode 100644
index 00000000000..abae8cdfb40
--- /dev/null
+++ b/web/todo
@@ -0,0 +1 @@
+Discuss with write new JIT \ No newline at end of file
diff --git a/web/tools b/web/tools
new file mode 100644
index 00000000000..eabef48bb88
--- /dev/null
+++ b/web/tools
@@ -0,0 +1,67 @@
+* Tools
+
+ We need a number of tools to make people productive using a
+ Mono-based solution. Some of these tools can be developed on
+ Windows before Mono is fully finished.
+
+ All of these tools should be written using C#.
+
+ For the tools that are typically command line tools: Try to
+ write these as components that could load their input from
+ streams or collections of streams, and implement the command
+ line tools as wrappers around those classes.
+
+ For example, we will be making the C# compiler a component
+ that could be reused by applications that might have a use for
+ the various bits of the compiler (either to embed the
+ compiler, or reuse the code generator part of it).
+
+ This is important so that these components (compiler,
+ assembler, linker, etc) can be integrated later into the
+ visual development environment (hopefully with the help of the
+ SharpDevelop hackers).
+
+TODO=ilasm,IL Assembler
+** IL Assembler.
+
+ This assembler should basically take as input a file
+ containing IL bytecodes as specified in the `Partition II' of
+ the ECMA spec, and produce a binary file.
+
+TODO=al,Assembly Linker
+** Assembly Linker.
+
+ This tool is used to construct assemblies, which are basically
+ deployment units for CLI executables.
+
+TODO=debugger,Debugger
+** Debugger
+
+ We will need a debugging API to debug CLI applications and
+ then a debugger component that can be used in an IDE
+ environment.
+
+TODO=ide,Integrated Development Environment
+** Integrated Development Environment
+
+ There is already a project to create a C# development
+ environment: <a
+ href="http://www.icsharpcode.net/OpenSource/SD/default.asp">SharpDevelop</a>.
+ People should work with the SharpDevelop hackers to produce a
+ unified development environment.
+
+ Please work with the SharpDevelop hackers to build a good IDE.
+ We will work on creating an embedable compiler component and
+ an embeddable debugger component that can be used withing
+ SharpDevelop
+
+TODO=hbrowser,Help Browser
+** Help Browser
+
+ We need a good help browser that can be used to browse
+ documentation. Ideally this help browser can accept as input
+ XML Docbook input and an assorted set of file formats
+ (Microsoft Help, Unix manual pages, Unix Info pages)
+
+ Look at the GNOME DevHelp for a good set of ideas on how to
+ implement this. \ No newline at end of file
diff --git a/web/web/.cvsignore b/web/web/.cvsignore
new file mode 100644
index 00000000000..a023a6f9c7c
--- /dev/null
+++ b/web/web/.cvsignore
@@ -0,0 +1,2 @@
+*.src
+*.html
diff --git a/web/web/commands b/web/web/commands
new file mode 100644
index 00000000000..bb05fc861cb
--- /dev/null
+++ b/web/web/commands
@@ -0,0 +1,40 @@
+0,Home,index.html,index.src
+1,FAQ,faq.html,faq.src
+0,Mono,rationale.html,rationale.src
+1,Runtime,runtime.html,runtime.src
+1,Classes,class-library.html,class-library.src
+1,Gtk#,http://gtk-sharp.sourceforge.net
+1,Class Status,class-status.html,class-status.src,cm/cormissing.css,cm/cormissing.js
+2,corlib,class-status-corlib.html,class-status-corlib.src,cm/cormissing.css,cm/cormissing.js
+2,System,class-status-System.html,class-status-System.src,cm/cormissing.css,cm/cormissing.js
+2,System.Xml,class-status-System.Xml.html,class-status-System.Xml.src,cm/cormissing.css,cm/cormissing.js
+2,System.Data,class-status-System.Data.html,class-status-System.Data.src,cm/cormissing.css,cm/cormissing.js
+2,System.Web,class-status-System.Web.html,class-status-System.Web.src,cm/cormissing.css,cm/cormissing.js
+1,C# Compiler,c-sharp.html,c-sharp.src
+1,Debugging,jit-debug.html,jit-debug.src
+2,Example 1,jit-debug-sample.html,jit-debug-sample.src
+2,Example 2,jit-debug-sample2.html,jit-debug-sample2.src
+1,Status,status.html,status.src
+0,Download,download.html,download.src
+1,CVS access,ccvs.html,ccvs.src
+1,AnonCVS access,anoncvs.html,anoncvs.src
+0,Contributing,contributing.html,contributing.src
+1,Documentation,documentation.html,documentation.src
+1,Class Docs,classlib-doc.html,classlib-doc.src
+1,Doc format,monodoc-xml.html,monodoc-xml.src
+1,Test Suite,testing.html,testing.src
+1,Tools,tools.html,tools.src
+1,Porting,porting.html,porting.src
+0,Plans,plans.html,plans.src
+1,ADO.NET,ado-net.html,ado-net.src
+1,ASP.NET,asp-net.html,asp-net.src
+1,Java,java.html,java.src
+1,Windows.Forms,winforms.html,winforms.src
+0,Resources,resources.html,resources.src
+1,Mailing Lists,mailing-lists.html,mailing-lists.src
+1,Ideas,ideas.html,ideas.src
+1,Passport,passport.html,passport.src
+1,Books,books.html,books.src
+1,Papers,papers.html,papers.src
+1,Languages,languages.html,languages.src
+0,Contact,contact.html,contact.src
diff --git a/web/web/deploy/.cvsignore b/web/web/deploy/.cvsignore
new file mode 100755
index 00000000000..2d19fc766d9
--- /dev/null
+++ b/web/web/deploy/.cvsignore
@@ -0,0 +1 @@
+*.html
diff --git a/web/web/deploy/cm/c.gif b/web/web/deploy/cm/c.gif
new file mode 100644
index 00000000000..02c347efd0b
--- /dev/null
+++ b/web/web/deploy/cm/c.gif
Binary files differ
diff --git a/web/web/deploy/cm/cormissing.css b/web/web/deploy/cm/cormissing.css
new file mode 100644
index 00000000000..1f22da54273
--- /dev/null
+++ b/web/web/deploy/cm/cormissing.css
@@ -0,0 +1,182 @@
+.y IMG
+{
+ border: 0px;
+ padding: 0px;
+ margin: 0px;
+ margin-right: 4px;
+ vertical-align: middle;
+}
+
+.y, .y_,
+.n, .n_,
+.c, .c_,
+.c, .c_,
+.d, .d_,
+.en, .en_,
+.i, .i_,
+.s, .s_,
+.e, .e_,
+.f, .f_,
+.m, .m_,
+.o, .o_,
+.p, .p_,
+.r, .r_,
+.x, .x_
+{
+ FONT: 10px 'Verdana';
+ margin-left: 20px;
+}
+
+.y_ .n,
+.y_ .n_,
+.n_ .c,
+.n_ .c_,
+.n_ .s,
+.n_ .s_,
+.n_ .d,
+.n_ .d_,
+.n_ .en,
+.n_ .en_,
+.n_ .i,
+.n_ .i_,
+.c_ .c,
+.c_ .c_,
+.c_ .e,
+.c_ .e_,
+.c_ .f,
+.c_ .f_,
+.c_ .m,
+.c_ .m_,
+.c_ .o,
+.c_ .o_,
+.c_ .p,
+.c_ .p_,
+.c_ .r,
+.c_ .r_,
+.c_ .x,
+.c_ .x_,
+.c_ .i,
+.c_ .i_,
+.d_ .c,
+.d_ .c_,
+.d_ .e,
+.d_ .e_,
+.d_ .f,
+.d_ .f_,
+.d_ .m,
+.d_ .m_,
+.d_ .o,
+.d_ .o_,
+.d_ .p,
+.d_ .p_,
+.d_ .r,
+.d_ .r_,
+.d_ .x,
+.d_ .x_,
+.en_ .c,
+.en_ .c_,
+.en_ .e,
+.en_ .e_,
+.en_ .f,
+.en_ .f_,
+.en_ .m,
+.en_ .m_,
+.en_ .o,
+.en_ .o_,
+.en_ .p,
+.en_ .p_,
+.en_ .r,
+.en_ .r_,
+.en_ .x,
+.en_ .x_,
+.i_ .c,
+.i_ .c_,
+.i_ .e,
+.i_ .e_,
+.i_ .f,
+.i_ .f_,
+.i_ .m,
+.i_ .m_,
+.i_ .o,
+.i_ .o_,
+.i_ .p,
+.i_ .p_,
+.i_ .r,
+.i_ .r_,
+.i_ .x,
+.i_ .x_,
+.i_ .i,
+.i_ .i_,
+.s_ .c,
+.s_ .c_,
+.s_ .e,
+.s_ .e_,
+.s_ .f,
+.s_ .f_,
+.s_ .m,
+.s_ .m_,
+.s_ .o,
+.s_ .o_,
+.s_ .p,
+.s_ .p_,
+.s_ .r,
+.s_ .r_,
+.s_ .x,
+.s_ .x_,
+.s_ .i,
+.s_ .i_,
+
+.e_ .r,
+.e_ .r_,
+.e_ .o,
+.e_ .o_,
+.f_ .r,
+.f_ .r_,
+.f_ .o,
+.f_ .o_,
+.m_ .r,
+.m_ .r_,
+.m_ .o,
+.m_ .o_,
+.o_ .r,
+.o_ .r_,
+.o_ .o,
+.o_ .o_,
+.p_ .r,
+.p_ .r_,
+.p_ .o,
+.p_ .o_,
+.r_ .r,
+.r_ .r_,
+.r_ .o,
+.r_ .o_,
+.x_ .r,
+.x_ .r_,
+.x_ .o,
+.x_ .o_
+{
+ display: none;
+}
+
+.t
+{
+ cursor: pointer;
+ margin-right: 8px;
+}
+
+.filter
+{
+ cursor: pointer;
+ vertical-align: middle;
+}
+
+
+.st
+{
+ margin-left: 20px;
+}
+
+.l
+{
+ cursor: pointer;
+}
diff --git a/web/web/deploy/cm/cormissing.js b/web/web/deploy/cm/cormissing.js
new file mode 100644
index 00000000000..e6b12ac4fd2
--- /dev/null
+++ b/web/web/deploy/cm/cormissing.js
@@ -0,0 +1,392 @@
+function toggle (elt)
+{
+ if (elt == null)
+ return;
+
+ var eltLink = elt.firstChild;
+ if (eltLink != null && eltLink.className == 't') // toggle
+ {
+ var ich = elt.className.indexOf ('_');
+ if (ich < 0)
+ {
+ eltLink.src = 'cm/tp.gif';
+ elt.className += '_';
+ }
+ else
+ {
+ eltLink.src = 'cm/tm.gif';
+ elt.className = elt.className.slice (0, ich);
+ }
+ }
+}
+
+function setView (elt, fView)
+{
+ var eltLink = elt.firstChild;
+ if (eltLink != null && eltLink.className == 't') // toggle
+ {
+ var ich = elt.className.indexOf ('_');
+ if (ich < 0 && !fView)
+ {
+ eltLink.src = 'cm/tp.gif';
+ elt.className += '_';
+ }
+ else if (ich >= 0 && fView)
+ {
+ eltLink.src = 'cm/tm.gif';
+ elt.className = elt.className.slice (0, ich);
+ }
+ }
+}
+
+function trimSrc (strSrc)
+{
+ return strSrc.slice (strSrc.lastIndexOf ('/') + 1, strSrc.lastIndexOf ('.'));
+}
+
+function getChildrenByTagName (elt, strTag)
+{
+ strTag = strTag.toLowerCase ();
+ var rgChildren = new Array ();
+ var eltChild = elt.firstChild;
+ while (eltChild)
+ {
+ if (eltChild.tagName && eltChild.tagName.toLowerCase () == strTag)
+ rgChildren.push (eltChild);
+ eltChild = eltChild.nextSibling;
+ }
+ return rgChildren;
+}
+
+function viewAll (elt, dictTypes)
+{
+ var fView = false;
+ var rgImages = getChildrenByTagName (elt, 'IMG');
+ var cImages = rgImages.length;
+ for (var iImage = 0; iImage < cImages; iImage++)
+ {
+ var strImage = trimSrc (rgImages [iImage].src);
+ if (dictTypes [strImage])
+ {
+ fView = true;
+ break;
+ }
+ }
+ var rgElts = getChildrenByTagName (elt, 'DIV');
+ var cElts = rgElts.length;
+ if (cElts != 0)
+ {
+ var iElt;
+ for (iElt = 0; iElt < cElts; iElt ++)
+ fView |= viewAll (rgElts [iElt], dictTypes);
+ }
+ elt.style.display = fView ? '' : 'none';
+ return fView;
+}
+
+function getView (elt)
+{
+ var eltLink = elt.firstChild;
+ if (eltLink != null && eltLink.className == 't') // toggle
+ {
+ var ich = elt.className.indexOf ('_');
+ if (ich < 0)
+ return true;
+ }
+ return false;
+}
+
+function getParentDiv (elt)
+{
+ if (elt)
+ {
+ do
+ {
+ elt = elt.parentNode;
+ }
+ while (elt && elt.tagName != 'DIV');
+ }
+
+ return elt;
+}
+
+function getName (elt)
+{
+ var rgSpans = getChildrenByTagName (elt, 'SPAN');
+ for (var iSpan = 0; iSpan < rgSpans.length; iSpan ++)
+ {
+ var span = rgSpans [iSpan];
+ if (span.className == 'l') // label
+ {
+ if (span.innerText)
+ return span.innerText;
+ else
+ return span.firstChild.nodeValue;
+ }
+ }
+ return null;
+}
+
+function clickHandler (evt)
+{
+ var elt;
+ if (document.layers)
+ elt = evt.taget;
+ else if (window.event && window.event.srcElement)
+ {
+ elt = window.event.srcElement;
+ evt = window.event;
+ }
+ else if (evt && evt.stopPropagation)
+ elt = evt.target;
+
+ if (!elt.className && elt.parentNode)
+ elt = elt.parentNode;
+
+ if (elt.className == 'l') // label
+ {
+ var strClass;
+ var strField;
+ var strNamespace;
+ var strAssembly;
+
+ elt = getParentDiv (elt);
+ var strEltClass = elt.className;
+ if (strEltClass.charAt (strEltClass.length - 1) == '_')
+ strEltClass = strEltClass.slice (0, strEltClass.length - 1);
+
+ if (strEltClass == 'x') // constructor
+ {
+ strField = 'ctor';
+ elt = getParentDiv (elt);
+ }
+ else
+ if (strEltClass == 'm' || // method
+ strEltClass == 'p' || // property
+ strEltClass == 'e' || // event
+ strEltClass == 'f') // field
+ {
+ strField = getName (elt).toLowerCase ();
+ var match = strField.match ( /[\.A-Z0-9_]*/i );
+ if (match)
+ strField = match [0];
+ elt = getParentDiv (elt);
+
+ }
+
+ var strEltClass = elt.className;
+ if (strEltClass.charAt (strEltClass.length - 1) == '_')
+ strEltClass = strEltClass.slice (0, strEltClass.length - 1);
+
+ if (strEltClass == 'c' || // class
+ strEltClass == 's' || // struct
+ strEltClass == 'i' || // struct
+ strEltClass == 'd' || // delegate
+ strEltClass == 'en') // enum
+ {
+ strClass = getName (elt);
+ if (strEltClass == 'en')
+ strField = null;
+ elt = getParentDiv (elt);
+ }
+
+ var strEltClass = elt.className;
+ if (strEltClass.charAt (strEltClass.length - 1) == '_')
+ strEltClass = strEltClass.slice (0, strEltClass.length - 1);
+
+ if (strEltClass == 'n')
+ {
+ strNamespace = getName (elt);
+ elt = getParentDiv (elt);
+ }
+
+ var strEltClass = elt.className;
+ if (strEltClass.charAt (strEltClass.length - 1) == '_')
+ strEltClass = strEltClass.slice (0, strEltClass.length - 1);
+
+ if (strEltClass == 'y')
+ {
+ strAssembly = getName (elt);
+ }
+
+ if (evt.ctrlKey)
+ {
+ var strRoot = 'http://cvs.hispalinux.es/cgi-bin/cvsweb/mcs/class/';
+ var strExtra = '?cvsroot=Mono';
+
+ if (strAssembly)
+ {
+ strRoot = strRoot + strAssembly + '/';
+ if (strNamespace)
+ {
+ strRoot = strRoot + strNamespace + '/';
+ if (strClass)
+ {
+ strRoot += strClass + '.cs';
+ strExtra += '&rev=1';
+ }
+ }
+ window.open (strRoot + strExtra, 'CVS');
+ }
+ }
+ else if (strNamespace)
+ {
+ var re = /\./g ;
+ strNamespace = strNamespace.toLowerCase ().replace (re, '');
+ if (strClass)
+ strNamespace += strClass.toLowerCase () + 'class';
+ if (strField)
+ strNamespace += strField;
+ if (strClass || strField)
+ strNamespace += 'topic';
+
+ window.open ('http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrf' + strNamespace + '.asp', 'MSDN');
+ }
+ }
+ else
+ {
+ if (elt.parentNode && elt.parentNode.className == 't') // toggle
+ elt = elt.parentNode;
+ else if (elt.className != 't') // toggle
+ return;
+
+ while (elt != null && elt.tagName != 'DIV')
+ elt = elt.parentNode;
+
+ if (evt.shiftKey)
+ {
+ var rgElts = getChildrenByTagName (elt, 'DIV');
+ var cElts = rgElts.length;
+ if (cElts != 0)
+ {
+ var fView = false;
+ var iElt;
+ for (iElt = 0; iElt < cElts; iElt ++)
+ {
+ if (getView (rgElts [iElt]))
+ {
+ fView = true;
+ break;
+ }
+ }
+ for (iElt = 0; iElt < cElts; iElt ++)
+ {
+ setView (rgElts [iElt], !fView);
+ }
+ }
+ }
+ else if (evt.ctrlKey)
+ {
+ setView (elt, true);
+ var eltParent = getParentDiv (elt);
+ while (eltParent)
+ {
+ var rgSiblings = getChildrenByTagName (eltParent, 'DIV');
+ var cSiblings = rgSiblings.length;
+ for (var iSibling = 0; iSibling < cSiblings; iSibling++)
+ {
+ var eltSibling = rgSiblings [iSibling];
+ if (eltSibling != elt)
+ {
+ setView (eltSibling, false);
+ }
+ }
+ elt = eltParent;
+ eltParent = getParentDiv (elt);
+ }
+ }
+ else
+ toggle (elt);
+ }
+
+ return false;
+}
+
+function filterTree ()
+{
+ var eltMissing = document.getElementById ('missing');
+ var eltTodo = document.getElementById ('todo');
+ var eltExtra = document.getElementById ('extra');
+ var eltErrors = document.getElementById ('errors');
+
+ var dictTypes = new Object ();
+ if (eltMissing.checked)
+ dictTypes ['sm'] = true;
+ if (eltTodo.checked)
+ dictTypes ['st'] = true;
+ if (eltErrors.checked)
+ dictTypes ['se'] = true;
+ if (eltExtra.checked)
+ dictTypes ['sx'] = true;
+// dictTypes ['sc'] = true;
+
+ viewAll (document.getElementById ('ROOT'), dictTypes);
+}
+
+function selectMissing ()
+{
+ toggleFilter ('missing');
+}
+
+function selectTodo ()
+{
+ toggleFilter ('todo');
+}
+
+function selectExtra ()
+{
+ toggleFilter ('extra');
+}
+
+function selectErrors ()
+{
+ toggleFilter ('errors');
+}
+
+function toggleFilter (strFilter)
+{
+ var eltTodo = document.getElementById ('todo');
+ var eltMissing = document.getElementById ('missing');
+ var eltExtra = document.getElementById ('extra');
+ var eltErrors = document.getElementById ('errors');
+
+ var eltToggle = document.getElementById (strFilter);
+ if (window && window.event && window.event.shiftKey)
+ {
+ eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = false;
+ eltToggle.checked = true;
+ }
+ else
+ if (!eltTodo.checked && !eltMissing.checked && !eltExtra.checked && !eltErrors.checked)
+ {
+ eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = true;
+ eltToggle.checked = false;
+ }
+ filterTree ();
+}
+
+function onLoad ()
+{
+ var eltMissing = document.getElementById ('missing');
+ var eltTodo = document.getElementById ('todo');
+ var eltExtra = document.getElementById ('extra');
+ var eltErrors = document.getElementById ('errors');
+ eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = true;
+}
+
+if (document.layers)
+{
+ document.captureEvents (Event.MOUSEUP);
+ document.onmouseup = clickHandler;
+}
+else if (document.attachEvent)
+{
+ document.attachEvent('onclick', clickHandler);
+}
+else if (document.addEventListener)
+{
+ document.addEventListener('click', clickHandler, false);
+}
+else
+ document.onclick = clickHandler;
+
diff --git a/web/web/deploy/cm/d.gif b/web/web/deploy/cm/d.gif
new file mode 100644
index 00000000000..c9735952f33
--- /dev/null
+++ b/web/web/deploy/cm/d.gif
Binary files differ
diff --git a/web/web/deploy/cm/e.gif b/web/web/deploy/cm/e.gif
new file mode 100644
index 00000000000..1137246bfae
--- /dev/null
+++ b/web/web/deploy/cm/e.gif
Binary files differ
diff --git a/web/web/deploy/cm/en.gif b/web/web/deploy/cm/en.gif
new file mode 100644
index 00000000000..00026b77300
--- /dev/null
+++ b/web/web/deploy/cm/en.gif
Binary files differ
diff --git a/web/web/deploy/cm/f.gif b/web/web/deploy/cm/f.gif
new file mode 100644
index 00000000000..f78a2f53bbc
--- /dev/null
+++ b/web/web/deploy/cm/f.gif
Binary files differ
diff --git a/web/web/deploy/cm/i.gif b/web/web/deploy/cm/i.gif
new file mode 100644
index 00000000000..56cd032a565
--- /dev/null
+++ b/web/web/deploy/cm/i.gif
Binary files differ
diff --git a/web/web/deploy/cm/m.gif b/web/web/deploy/cm/m.gif
new file mode 100644
index 00000000000..75fe3586d48
--- /dev/null
+++ b/web/web/deploy/cm/m.gif
Binary files differ
diff --git a/web/web/deploy/cm/n.gif b/web/web/deploy/cm/n.gif
new file mode 100644
index 00000000000..f6fa746304d
--- /dev/null
+++ b/web/web/deploy/cm/n.gif
Binary files differ
diff --git a/web/web/deploy/cm/p.gif b/web/web/deploy/cm/p.gif
new file mode 100644
index 00000000000..b79d0dd7edb
--- /dev/null
+++ b/web/web/deploy/cm/p.gif
Binary files differ
diff --git a/web/web/deploy/cm/r.gif b/web/web/deploy/cm/r.gif
new file mode 100644
index 00000000000..a3ef0f38ef0
--- /dev/null
+++ b/web/web/deploy/cm/r.gif
Binary files differ
diff --git a/web/web/deploy/cm/s.gif b/web/web/deploy/cm/s.gif
new file mode 100644
index 00000000000..f2fd5c8aee2
--- /dev/null
+++ b/web/web/deploy/cm/s.gif
Binary files differ
diff --git a/web/web/deploy/cm/sc.gif b/web/web/deploy/cm/sc.gif
new file mode 100644
index 00000000000..b02afd9b2e0
--- /dev/null
+++ b/web/web/deploy/cm/sc.gif
Binary files differ
diff --git a/web/web/deploy/cm/se.gif b/web/web/deploy/cm/se.gif
new file mode 100644
index 00000000000..1c46eaa5887
--- /dev/null
+++ b/web/web/deploy/cm/se.gif
Binary files differ
diff --git a/web/web/deploy/cm/sm.gif b/web/web/deploy/cm/sm.gif
new file mode 100644
index 00000000000..0c7194786d5
--- /dev/null
+++ b/web/web/deploy/cm/sm.gif
Binary files differ
diff --git a/web/web/deploy/cm/st.gif b/web/web/deploy/cm/st.gif
new file mode 100644
index 00000000000..067582cb398
--- /dev/null
+++ b/web/web/deploy/cm/st.gif
Binary files differ
diff --git a/web/web/deploy/cm/sx.gif b/web/web/deploy/cm/sx.gif
new file mode 100644
index 00000000000..2c8ca547929
--- /dev/null
+++ b/web/web/deploy/cm/sx.gif
Binary files differ
diff --git a/web/web/deploy/cm/tb.gif b/web/web/deploy/cm/tb.gif
new file mode 100644
index 00000000000..ee68c5a356b
--- /dev/null
+++ b/web/web/deploy/cm/tb.gif
Binary files differ
diff --git a/web/web/deploy/cm/tm.gif b/web/web/deploy/cm/tm.gif
new file mode 100644
index 00000000000..3c8f18aecea
--- /dev/null
+++ b/web/web/deploy/cm/tm.gif
Binary files differ
diff --git a/web/web/deploy/cm/tp.gif b/web/web/deploy/cm/tp.gif
new file mode 100644
index 00000000000..8b7435361b7
--- /dev/null
+++ b/web/web/deploy/cm/tp.gif
Binary files differ
diff --git a/web/web/deploy/cm/y.gif b/web/web/deploy/cm/y.gif
new file mode 100644
index 00000000000..08f00d4ea11
--- /dev/null
+++ b/web/web/deploy/cm/y.gif
Binary files differ
diff --git a/web/web/deploy/images/bgsquares.gif b/web/web/deploy/images/bgsquares.gif
new file mode 100644
index 00000000000..864bcd44038
--- /dev/null
+++ b/web/web/deploy/images/bgsquares.gif
Binary files differ
diff --git a/web/web/deploy/images/bgsquares.png b/web/web/deploy/images/bgsquares.png
new file mode 100644
index 00000000000..a9e2bb94dbb
--- /dev/null
+++ b/web/web/deploy/images/bgsquares.png
Binary files differ
diff --git a/web/web/deploy/images/bgsquares.xcf.gz b/web/web/deploy/images/bgsquares.xcf.gz
new file mode 100644
index 00000000000..200b5805615
--- /dev/null
+++ b/web/web/deploy/images/bgsquares.xcf.gz
Binary files differ
diff --git a/web/web/deploy/images/mono.gif b/web/web/deploy/images/mono.gif
new file mode 100644
index 00000000000..298976a07b7
--- /dev/null
+++ b/web/web/deploy/images/mono.gif
Binary files differ
diff --git a/web/web/deploy/images/mono.png b/web/web/deploy/images/mono.png
new file mode 100644
index 00000000000..21709009d60
--- /dev/null
+++ b/web/web/deploy/images/mono.png
Binary files differ
diff --git a/web/web/deploy/images/pixel.gif b/web/web/deploy/images/pixel.gif
new file mode 100644
index 00000000000..a4f37d7e02e
--- /dev/null
+++ b/web/web/deploy/images/pixel.gif
Binary files differ
diff --git a/web/web/deploy/images/pixel.png b/web/web/deploy/images/pixel.png
new file mode 100644
index 00000000000..85cfd14929a
--- /dev/null
+++ b/web/web/deploy/images/pixel.png
Binary files differ
diff --git a/web/web/htmlify b/web/web/htmlify
new file mode 100644
index 00000000000..f3bff2d42d2
--- /dev/null
+++ b/web/web/htmlify
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+$q = 1;
+
+while (<>){
+ chop;
+ if (/^\* (.*)$/){
+ print "<h1>$1</h1>\n";
+ } elsif (/^\*\* (.*)$/) {
+ print "<h2>$1</h2>\n";
+ } elsif (/^\*\*\* (.*)$/) {
+ print "<h3>$1</h3>\n";
+ } elsif (/^\*\*\*\* (.*)$/) {
+ print "<h4>$1</h4>\n";
+ } elsif (/^$/) {
+ print "<p>\n";
+ } elsif (/^\t\t\* (.*)$/) {
+ print "<li>$1\n";
+ } elsif (/^Q: (.*)$/){
+ print "<p><a name=\"q$q\"></a><b>Question $q:</b> $1\n";
+ $q++;
+ } elsif (/^A: (.*)$/){
+ print "$1\n";
+ } elsif (/^TODO=(.*),$/){
+ print "<a name=\"$1\">\n";
+ } else {
+ print "$_\n";
+ }
+}
diff --git a/web/web/icaza.pl b/web/web/icaza.pl
new file mode 100644
index 00000000000..ce8b87c44da
--- /dev/null
+++ b/web/web/icaza.pl
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+$q = 1;
+
+# Modified by Edwin Lima (edwinlima@hotmail.com; edwin.lima@nec-computers.com)
+# Date: 08/21/01, The Netherlands
+# $f: Variable used as a flag to create the list of questions on top of the question-answers set. This
+# is the only way that I found to scan the questions which have a <CR><LF>, in such a way that I will not
+# scan the answer together at same time.
+# @aname: Buffer used to store the question-answers set to print them out just after the print of the
+# questions.
+# @href: Buffer used to store the anchors (only questions) to the questions-answers set on the bottom
+# of the page.
+# I opened explicitly the file for input (input.txt) but U can change this as it was originally.
+#
+#
+
+#comment this line if you are not open the file explicitly
+#open(IN, "input.txt") || die "cannot open file input.txt" ;
+
+print("<A name=TOP>") ;
+
+#Uncomment line bellow to make it work as it was originally.
+while (<>){
+
+#comment line bellow
+
+#while (<IN>){
+ chop;
+ if (/^\* (.*)$/){
+ push(@aname,"<h1>$1</h1>\n");
+# print $body;
+ } elsif (/^\*\* (.*)$/) {
+ push(@aname, "<h2>$1</h2>\n");
+ push(@href, "<h2>$1</h2>\n");
+ } elsif (/^\*\*\* (.*)$/) {
+ push(@aname, "<h3>$1</h3>\n");
+
+ } elsif (/^$/) {
+ push(@aname, "<p>\n");
+# push(@href, "<p>\n"); NOT NEEDED
+ } elsif (/^\t\t\* (.*)$/) {
+ push(@aname, "<li>$1\n");
+ } elsif (/^Q: (.*)$/){
+ push(@aname, "<p><a name=\"q$q\"></a><b>Question $q:</b> $1\n");
+ push(@href,"<p><a href=\"#q$q\"><b>Question $q:</b></a> $1\n");
+ $f=1;
+ $q++;
+ } elsif (/^A: (.*)$/){
+ push(@aname,"<P>\n<A HREF=#TOP>Top</A>\n<P>");
+ push(@aname,"$1\n");
+ $f=0;
+ } elsif (/^TODO=(.*),$/){
+ push(@aname, "<a name=\"$1\">\n");
+ #push(@href, "<a name=\"$1\">\n");
+ } else {
+ push(@aname,"$_\n");
+ if ($f==1) {
+ push(@href,"$_\n");
+ }
+ }
+}
+
+foreach $line (@href) #"\n\n";
+{
+ print $line;
+ }
+
+foreach $line (@aname) #"\n\n";
+{
+ print $line;
+ }
+
+
+#comment this line if you are not open the file explicitly
+# close(IN) || die "cannot close file" ;
+
diff --git a/web/web/images/bgsquares.gif b/web/web/images/bgsquares.gif
new file mode 100644
index 00000000000..864bcd44038
--- /dev/null
+++ b/web/web/images/bgsquares.gif
Binary files differ
diff --git a/web/web/images/bgsquares.png b/web/web/images/bgsquares.png
new file mode 100644
index 00000000000..54de2ad1e6d
--- /dev/null
+++ b/web/web/images/bgsquares.png
Binary files differ
diff --git a/web/web/images/bgsquares.xcf.gz b/web/web/images/bgsquares.xcf.gz
new file mode 100644
index 00000000000..200b5805615
--- /dev/null
+++ b/web/web/images/bgsquares.xcf.gz
Binary files differ
diff --git a/web/web/images/mono.gif b/web/web/images/mono.gif
new file mode 100644
index 00000000000..298976a07b7
--- /dev/null
+++ b/web/web/images/mono.gif
Binary files differ
diff --git a/web/web/images/mono.png b/web/web/images/mono.png
new file mode 100644
index 00000000000..a19e38acedd
--- /dev/null
+++ b/web/web/images/mono.png
Binary files differ
diff --git a/web/web/images/pixel.gif b/web/web/images/pixel.gif
new file mode 100644
index 00000000000..a4f37d7e02e
--- /dev/null
+++ b/web/web/images/pixel.gif
Binary files differ
diff --git a/web/web/images/pixel.png b/web/web/images/pixel.png
new file mode 100644
index 00000000000..d8f33a2a3e4
--- /dev/null
+++ b/web/web/images/pixel.png
Binary files differ
diff --git a/web/web/makefile b/web/web/makefile
new file mode 100644
index 00000000000..586e4000ddd
--- /dev/null
+++ b/web/web/makefile
@@ -0,0 +1,100 @@
+CSCRIPT = $(SYSTEMROOT)/system32/cscript.exe
+
+CORCOMPARE=../../../mcs/tools/corcompare
+
+OBJECTS= \
+ deploy/ado-net.html \
+ deploy/anoncvs.html \
+ deploy/asp-net.html \
+ deploy/books.html \
+ deploy/contributing.html \
+ deploy/class-status.html \
+ deploy/class-status-corlib.html \
+ deploy/class-status-System.Xml.html \
+ deploy/class-status-System.Data.html \
+ deploy/class-status-System.Web.html \
+ deploy/class-library.html \
+ deploy/classlib-doc.html \
+ deploy/contact.html \
+ deploy/c-sharp.html \
+ deploy/ccvs.html \
+ deploy/documentation.html \
+ deploy/download.html \
+ deploy/faq.html \
+ deploy/gcc-frontend.html \
+ deploy/index.html \
+ deploy/ideas.html \
+ deploy/java.html \
+ deploy/jit-debug.html \
+ deploy/jit-debug-sample.html \
+ deploy/jit-debug-sample2.html \
+ deploy/languages.html \
+ deploy/mailing-lists.html \
+ deploy/monodoc-xml.html \
+ deploy/papers.html \
+ deploy/passport.html \
+ deploy/plans.html \
+ deploy/porting.html \
+ deploy/rationale.html \
+ deploy/resources.html \
+ deploy/roadmap.html \
+ deploy/runtime.html \
+ deploy/status.html \
+ deploy/testing.html \
+ deploy/tools.html \
+ deploy/winforms.html
+
+# deploy/class-status-System.html \
+
+NON_HTML_SOURCES= \
+ ../mono-build.sh \
+ ../mono-build-w32.sh
+
+
+all: $(OBJECTS)
+ perl process.pl commands template.html.in deploy
+
+clean:
+ rm -f $(OBJECTS) $(patsubst deploy/%.html,src/%.src, $(OBJECTS)) src/*.xml src/*.html.in ../class-status-* ../class-status
+
+push:
+ cp -f $(NON_HTML_SOURCES) deploy
+ echo scp -P 2200 -r deploy/* www@www.ximian.com:/web/cvsmodules/mono
+ (cd deploy; rsync --verbose --recursive --checksum --update --rsh='ssh -p 2200' . www@www.ximian.com:/web/cvsmodules/mono )
+
+push2:
+ scp -r deploy/* primates:public_html/xxx
+
+$(OBJECTS): $(patsubst deploy/%.html,src/%.src, $(OBJECTS))
+
+#.PRECIOUS: $(patsubst deploy/%.html,src/%.src, $(OBJECTS))
+
+
+
+.PRECIOUS: src/%.src
+src/%.src: ../% commands makefile template.html.in
+ perl htmlify $< > $@
+
+
+
+.PRECIOUS: ../class-status-%
+../class-status-%: src/%.html.in ../class-status.in
+ cat ../class-status.in $< > $@
+
+
+.PRECIOUS: src/%.html.in
+src/%.html.in: src/%.xml $(CORCOMPARE)/transform.js $(CORCOMPARE)/cormissing.xsl
+ $(CSCRIPT) /nologo $(CORCOMPARE)/transform.js $< $(CORCOMPARE)/cormissing.xsl > $@
+
+
+
+.PRECIOUS: src/%.xml
+src/%.xml: ../../../mcs/class/lib/%.dll $(CORCOMPARE)/CorCompare.exe
+ $(CORCOMPARE)/CorCompare.exe -x $@ $<
+
+src/corlib.xml: ../../../mcs/class/lib/corlib_cmp.dll $(CORCOMPARE)/CorCompare.exe
+ $(CORCOMPARE)/CorCompare.exe -f corlib -ms mscorlib -x $@ $<
+
+
+../class-status: ../class-status.in
+ cp -f $< $@
diff --git a/web/web/process.pl b/web/web/process.pl
new file mode 100755
index 00000000000..9739f9b4384
--- /dev/null
+++ b/web/web/process.pl
@@ -0,0 +1,89 @@
+#!/usr/bin/perl
+#
+# Author:
+# Sean MacIsaac
+#
+
+use strict;
+
+my $full_expand = 1;
+my @template;
+my $n;
+
+if ($#ARGV != 2) {
+ print "process.pl command_file template_file directory_prefix\n";
+ exit ();
+}
+
+my $menu = "";
+
+open COMMANDS, $ARGV[0] || die "Can not open $ARGV[0]";
+while (<COMMANDS>) {
+ chop;
+ my @command = split /,/;
+ if ($command[0] != -1) {
+ $menu .= "\t\t";
+ $menu .= "<tr><td valign=\"top\" class=\"navi" . $command[0];
+ $menu .= "\"><a class=\"navi" . $command[0];
+ $menu .= "\"";
+ $menu .= "HREF=\"$command[2]\">$command[1]</A></td></tr>\n\n";
+ }
+}
+close COMMANDS;
+
+open TEMPLATE, $ARGV[1] || die "Can not open $ARGV[1]";
+while (<TEMPLATE>) {
+ push @template, $_;
+}
+close TEMPLATE;
+
+open COMMANDS, $ARGV[0] || die "Can not open $ARGV[0]";
+while (<COMMANDS>) {
+ chop;
+ my @command = split /,/;
+
+ if ($command[2] =~ /^http:/){
+ } else {
+ $n = $ARGV[2] . "/" . $command[2];
+ open OUTPUT, ">" . $n || die "Can not create $n";
+
+ my $content = "";
+ open INPUT, "src/$command[3]" || die "Can not open $command[3]";
+ while (<INPUT>) {
+ $content .= $_;
+ }
+ close INPUT;
+
+ my $line;
+ my $temp;
+ my $tit;
+ my $title;
+ my $css;
+ my $script;
+
+ $tit = $command[1];
+ $css = $command[4];
+ $script = $command[5];
+
+ foreach $line (@template) {
+ $temp = $line;
+ $title = "$tit / Mono";
+ $temp =~ s/#TITLE#/$title/;
+ $temp =~ s/#CONTENT#/$content/;
+ $temp =~ s/#MENU#/$menu/;
+ if ($css) {
+ $temp =~ s/#CSS#/<LINK rel="stylesheet" type="text\/css" href="$css">/;
+ } else {
+ $temp =~ s/#CSS#//;
+ }
+
+ if ($script) {
+ $temp =~ s/#SCRIPT#/<SCRIPT src="$script"><\/SCRIPT>/;
+ } else {
+ $temp =~ s/#SCRIPT#//;
+ }
+ print OUTPUT $temp;
+ }
+ }
+ close OUTPUT;
+}
diff --git a/web/web/src/.cvsignore b/web/web/src/.cvsignore
new file mode 100755
index 00000000000..5053fb08904
--- /dev/null
+++ b/web/web/src/.cvsignore
@@ -0,0 +1 @@
+*.src
diff --git a/web/web/template.html.in b/web/web/template.html.in
new file mode 100644
index 00000000000..7603e1945d5
--- /dev/null
+++ b/web/web/template.html.in
@@ -0,0 +1,85 @@
+<html>
+<head>
+<title>#TITLE#</title>
+<style type="text/css">
+<!--
+ body { font-family: "trebuchet ms", lucida, verdana, helvetica;
+ background-image: url("images/bgsquares.gif");
+ background-attachment: fixed; }
+ body, td, table { font-family: "trebuchet ms", lucida, verdana, helvetica;
+ font-size: 14px; }
+
+ .navi0 { font-size: 14px; font-weight: bold; background: #444444; }
+ .navi1 { font-size: 14px; font-weight: bold; left-margin: 10pt}
+ .navi2 { font-size: 10px; font-weight: bold; left-margin: 20pt}
+ .footnote { font-size: 12px; color: #aaaaaa; }
+
+ a.navi0 { color: #ffffff; text-decoration: none}
+ a.navi0:visited { color: #cccccc; }
+ a.navi0:hover { color: #ee9900; text-decoration: underline; }
+
+ a.navi1 { color: #ffffff; text-decoration: none; margin-left: 7px;}
+ a.navi1:visited { color: #cccccc; }
+ a.navi1:hover { color: #ee9900; text-decoration: underline; }
+
+ a.navi2 { color: #ffffff; text-decoration: none; margin-left: 20px;}
+ a.navi2:visited { color: #cccccc; }
+ a.navi2:hover { color: #ee9900; text-decoration: underline; }
+
+// -->
+</style>
+#CSS#
+#SCRIPT#
+</head>
+<body bgcolor="#555555" text="#000000">
+
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+ <tr>
+ <td><img src="images/pixel.gif"></td><!-- left border -->
+ <td colspan="4">
+ <a href="http://www.go-mono.com"><img src="images/mono.gif" border="0"></a></td>
+ <td><img src="images/pixel.gif"></td><!-- right border -->
+ </tr>
+ <tr>
+ <td><img src="images/pixel.gif" width="1" height="1"></td>
+ <td colspan="3" bgcolor="black"><img src="images/pixel.gif" height="2"></td>
+ <td bgcolor="black"><img src="images/pixel.gif" width="1"></td>
+ <td><img src="images/pixel.gif"></td>
+ </tr>
+ <tr>
+ <td width="100"><img src="images/pixel.gif"></td>
+ <td valign="top">
+ <table cellpadding="2" valign="top" cellspacing="0" border="0">
+ #MENU#
+ </table>
+ </td>
+ <td bgcolor="black" width="1"><img src="images/pixel.gif" width="1"></td>
+ <td bgcolor="white" align="left" width="80%" valign="top">
+ <table cellpadding="16">
+ <tr><td>
+ #CONTENT#
+ </td></tr>
+ </table>
+ </td>
+ <td bgcolor="black"><img src="images/pixel.gif" width="1"></td>
+ <td width="100"><img src="images/pixel.gif"></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <img src="images/pixel.gif"></td>
+ <td colspan="2" bgcolor="black"><img src="images/pixel.gif" height="1"></td>
+ <td bgcolor="black"><img src="images/pixel.gif" width="1"></td>
+ <td><img src="images/pixel.gif"></td>
+ </tr>
+
+ <td colspan="2"></td>
+ <td colspan="2" align="center">
+ <a class="footnote" href="mailto: webmaster@go-mono.com">webmaster@go-mono.com</a>
+ </td>
+ <td colspan="2"></td>
+ </tr>
+</tr>
+</table>
+
+</body>
+</html>
diff --git a/web/winforms b/web/winforms
new file mode 100644
index 00000000000..2d8c1e3d79d
--- /dev/null
+++ b/web/winforms
@@ -0,0 +1,90 @@
+* System.Windows.Forms
+
+ System.Windows.Forms eventually will support multiple
+ toolkits. Ximian will be delivering a product that will allow
+ for System.Windows.Forms applications to integrate with GNOME
+ through Gtk and MacOS X using Cocoa.
+
+ There are no current plans to support embedded devices, but
+ Gtk/FrameBuffer is an option. If you have suggestions or
+ recommendations, please let us <a
+ href="mailto:mono-hackers-list@ximian.com">let us know</a>
+
+* Contributing
+
+ Currently Ximian developers are busy making our JIT engine
+ feature complete, and dealing with the low-level details of
+ the Mono runtime.
+
+ If you are interested in contributing, you can start stubbing
+ out classes and providing enumerations. That will help us
+ significantly when we start working on the actual bindings.
+
+ Christian Meyer is currently organizing this effort.
+
+* System.Drawing
+
+ Using existing libraries to implement some of the functionality required
+
+ <ul>
+ * gdk-pixbuf is a generic image loader that loads an image
+ and leaves it into an RGB buffer. It hides all the details
+ about what image file format is being loaded.
+
+ * Libart is a general framework for rendering RGB/RGBA
+ buffers into RGB buffers and rendering postscript-like paths into
+ RGB/RGBA buffers.
+ </ul>
+
+ We want to use gdk-pixbuf as the image loader for the image
+ classes, and then we need operations to render that into the
+ windowing system (Gtk+, MacOS, etc). But notice how there is
+ very little dependnecies in Gdk-pixbuf on gtk, and libart has
+ none.
+
+ They are pretty independent from a windowing system
+ (gdk-pixbuf comes with some "helper" routines for rendering
+ data into a pixmap and to load pixmaps into RGB buffers).
+
+ A few things to keep in mind:
+
+ <ul>
+
+ * gdk-pixbuf can be used to load images for Gtk+,
+ MacOS X and Windows, it should be pretty portable,
+ although we might need in the future to back-port
+ some new features from Gtk head.
+
+ * Libart is probably only going to be used with X11,
+ as the MacOS X provides the same features in Quartz,
+ and Win32 *probably* has that in GDI+. If not, we
+ should use libart in Win32 as well (or for older
+ Windows systems).
+ </ul>
+
+* Directory Layout
+
+ System.Drawing (assembly directory)
+ System.Drawing.Blah
+ Common code for "Blah"
+ Stubs for "Blah" to ease ports.
+
+ Gtk
+ System.Drawing.Blah.
+ Gtk ports of "System.Drawing.Blah"
+ MacOS
+ System.Drawing.Blah
+ MacOS ports of "System.Drawing.Blah"
+ Win32
+ System.Drawing.Blah
+ Win32 ports of "System.Drawing.Blah"
+
+ Then we use nant targets to include/exclude the right set of
+ files to create the assembly.
+
+* Open questions:
+
+ I believe that the graphics contexts that are used to render
+ can accept either libart-like rendering operations and
+ X11-like rendering operations. This complicates matters, but
+ I am not sure. Someone needs to investigate this.